commit 2bf1117b97b62890300af2c27f4a1c5f432fe94e Author: cruales Date: Thu Oct 27 16:58:46 2022 -0500 salvando sincoar postgres diff --git a/.svn/entries b/.svn/entries new file mode 100644 index 0000000..e192f99 --- /dev/null +++ b/.svn/entries @@ -0,0 +1,117 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources +svn://172.17.26.185/COMACO + + + +2022-04-19T03:16:43.485564Z +4669 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +frontend +dir + +tools +dir + +clients +dir + +appletFirma +dir + +transport.xsd +file + + + + +2022-07-28T03:40:48.334827Z +4f536f6eb1bf511b9104963f7b7a495c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4147 + +base +dir + +centralwebservices +dir + +pom.xml +file + + + + +2022-07-28T03:40:48.334827Z +1d49d454883b8d88c61293062edf98e0 +2014-12-31T05:29:42.479725Z +3704 +cpiedra + + + + + + + + + + + + + + + + + + + + + +26244 + +reports-jsf +dir + diff --git a/.svn/text-base/pom.xml.svn-base b/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..992e7f0 --- /dev/null +++ b/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,687 @@ + + + 4.0.0 + com.fp + FlipBean + Maia + 2.1 + pom + + ISO-8859-1 + /app/maia + + + base + clients + frontend + + + Mantis + http://190.57.146.125/mantis + + + + flipbean + Flipbean + flipbean.s.a@gmail.com + + Project Manager + Architect + + + + + scm:svn:svn+ssh://maia/repo/fuentes/sources + http://192.168.2.201/svn/fuentes/sources + + + MAIA + http://190.57.146.125/tech + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + true + ${project.build.sourceEncoding} + 1.7 + 1.7 + + + + + org.apache.maven.plugins + maven-ejb-plugin + 2.3 + + 3.0 + + + + + org.apache.maven.plugins + maven-site-plugin + 3.0 + + + + + org.apache.maven.wagon + wagon-ssh-external + 2.2 + + + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 2.4 + + + + cim + dependencies + dependency-convergence + dependency-management + index + issue-tracking + license + mailing-list + plugin-management + project-team + scm + summary + + + + + + + maven-javadoc-plugin + 2.8 + + 1.5 + es_EC + ${cfg.path}/stylesheet.css + gr.spinellis.umlgraph.doclet.UmlGraphDoc + + + gr.spinellis + UmlGraph + 4.4 + + -inferrel -inferdep -quiet -hide java.* + -collpackages java.util.* -qualify -postfixpackage + -nodefontsize 9 -nodefontpackagesize 7 -attributes + -operations -enumerations -enumconstants -visibility + + + + + org.apache.maven.plugins + maven-pmd-plugin + 2.5 + + true + ISO-8859-1 + 30 + 1.5 + + ${cfg.path}/Rules.xml + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + 2.8 + + ${cfg.path}/checkstyle.xml + + + + org.codehaus.mojo + findbugs-maven-plugin + 2.3.2 + + low + Max + ${cfg.path}/findbugs.xml + + + + org.apache.maven.plugins + maven-surefire-report-plugin + 2.10 + + + org.apache.maven.plugins + maven-jxr-plugin + 2.3 + + + + + + maia + scpexe://gfiallos@localhost/app/maia/bin + + + maia + scpexe://root@localhost/srv/www/htdocs/tech + + + + + release + + + + /app/maia/bin + bpmlib + + + + + org.apache.maven.plugins + maven-source-plugin + 2.1.2 + + /app/maia/bin + ${project.artifactId}-src + true + + + + attach-sources + + jar-no-fork + + + + + + + + true + + + + jboss + + true + + + true + + + + up + + false + + + true + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.3.2 + + /app/maia/bin + + + + + + + + + + + + junit + junit + test + + + + + + org.apache.maven.wagon + wagon-ssh + 2.2 + + + org.apache.ant + ant-launcher + 1.7.0 + + + org.apache.ant + ant + 1.7.0 + + + + + + org.hibernate + hibernate-core + 4.0.1.Final + provided + + + org.hibernate + hibernate-search + 4.0.0.Final + provided + + + org.hibernate + hibernate-entitymanager + 4.0.1.Final + provided + + + org.hibernate + hibernate-validator + 4.2.0.Final + provided + + + + javax.servlet + servlet-api + 2.5 + + + javax.servlet + jsp-api + 2.0 + + + org.jboss.spec.javax.ejb + jboss-ejb-api_3.1_spec + 1.0.1.Final + provided + + + org.slf4j + slf4j-log4j12 + 1.6.2 + + + groovy + groovy-all + 1.6.4 + + + commons-beanutils + commons-beanutils + 1.7.0 + provided + + + commons-collections + commons-collections + 3.2.1 + provided + + + log4j + log4j + 1.2.14 + + + net.sf.json-lib + json-lib + 2.2.3 + provided + + + xom + xom + 1.2.5 + provided + + + + xalan + xalan + 2.7.1 + provided + + + xerces + xercesImpl + 2.9.1 + test + + + xerces + xmlParserAPIs + 2.6.2 + test + + + xml-apis + xml-apis + 1.3.04 + test + + + jdom + jdom + 1.1 + test + + + msv + xsdlib + 20050913 + test + + + msv + relaxngDatatype + 20050913 + test + + + xpp3 + xpp3 + 1.1.3.3 + test + + + stax + stax-api + 1.0.1 + test + + + pull-parser + pull-parser + 2.1.10 + test + + + net.sourceforge.jtds + jtds + 1.2.4 + test + + + com.jaspersoft.ireports + jaspersoft-ireport + 4.7.0 + + + com.jaspersoft.ireports + ireport-jasperserver + 4.7.0 + + + net.sf.jasperreports + jasperreports + 4.7.0 + + + org.codeartisans.thirdparties.swing + org-openide-util + 8.6.2 + + + com.jaspersoft.jasperserver + jasperserver-common-ws + 4.7.0 + + + javax.xml + jaxrpc-api + 1.1 + + + commons-digester + commons-digester + 2.1 + + + com.lowagie + itext + 2.1.7 + + + oracle + JDBC + 6.0 + + + jaxme + jaxme-api + 0.3.1 + test + + + jaxen + jaxen + 1.1.1 + test + + + + junit + junit + 4.0 + + + jline + jline + 0.9.94 + + + + + org.codehaus.btm + btm + 2.1.2 + test + + + org.mvel + mvel2 + 2.1.Beta3 + provided + + + commons-lang + commons-lang + 2.6 + jar + provided + + + commons-logging + commons-logging + 1.1.1 + jar + provided + + + net.sf.ezmorph + ezmorph + 1.0.6 + jar + provided + + + org.apache.velocity + velocity-tools + 2.0 + jar + compile + + + org.apache.velocity + velocity + 1.6.4 + jar + compile + + + + org.apache.xmlbeans + xmlbeans + 2.3.0 + jar + compile + + + org.antlr + antlr + 3.3 + jar + provide + + + org.antlr + antlr-runtime + 3.3 + jar + provide + + + org.antlr + stringtemplate + 3.2.1 + jar + provide + + + jboss + jboss-ejb-api + 4.2.1.GA + + + + com.fp.base + facadeclient + 2.1 + + + com.fp.base + facade + 2.1 + + + commons-fileupload + commons-fileupload + 1.2.2 + compile + + + axis + axis + 1.4 + + + axis + axis-wsdl4j + 1.5.1 + + + commons-codec + commons-codec + 1.4 + + + commons-discovery + commons-discovery + 0.4 + + + commons-httpclient + commons-httpclient + 3.1 + + + wsdl4j + wsdl4j + 1.6.2 + + + commons-io + commons-io + 1.4 + provided + + + javax.mail + mail + 1.4.4 + jar + compile + + + javax.activation + activation + 1.1.1 + jar + compile + + + jep + jep + 2.4.1 + jar + compile + + + org.jboss.spec + jboss-javaee-6.0 + 3.0.0.Final + pom + import + + + + + diff --git a/.svn/text-base/transport.xsd.svn-base b/.svn/text-base/transport.xsd.svn-base new file mode 100644 index 0000000..fea28aa --- /dev/null +++ b/.svn/text-base/transport.xsd.svn-base @@ -0,0 +1,138 @@ + + + + + Cabecera de mensajes + + + + + + + + + + + + + + + + + + Mensaje de Negocio, Altas y Bajas + + + + + + + + + + + Mensaje de negocio + + + + + + + Multiregistro A, B + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Objeto de negocio + + + + + + + + + + + Registros de una tabla + + + + + + + + + + Campo de un registro + + + + + Nombre de un campo suelto + + + + + Valor del campo + + + + + diff --git a/appletFirma/.svn/entries b/appletFirma/.svn/entries new file mode 100644 index 0000000..6941597 --- /dev/null +++ b/appletFirma/.svn/entries @@ -0,0 +1,68 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/appletFirma +svn://172.17.26.185/COMACO + + + +2015-04-28T07:21:43.253845Z +4061 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +lib +dir + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:24.126723Z +bd2a0d053d394874dc41aafd42d7188b +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1497 + diff --git a/appletFirma/.svn/prop-base/pom.xml.svn-base b/appletFirma/.svn/prop-base/pom.xml.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/appletFirma/.svn/prop-base/pom.xml.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/appletFirma/.svn/text-base/pom.xml.svn-base b/appletFirma/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..d16a16a --- /dev/null +++ b/appletFirma/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,51 @@ + + 4.0.0 + + com.fp.firma + appletFirma + 2.1 + jar + + appletFirma + http://maven.apache.org + + + UTF-8 + + + + + junit + junit + 4.1 + test + + + + org.bouncycastle + bcmail-jdk15on + 1.51 + + + org.bouncycastle + bcprov-jdk15on + 1.49 + + + org.bouncycastle + bcprov-ext-jdk15on + 1.49 + + + org.bouncycastle + bcpkix-jdk15on + 1.49 + + + com.itextpdf + itextpdf + 5.5.3 + + + diff --git a/appletFirma/lib/.svn/entries b/appletFirma/lib/.svn/entries new file mode 100644 index 0000000..8775b1b --- /dev/null +++ b/appletFirma/lib/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/appletFirma/lib +svn://172.17.26.185/COMACO + + + +2014-12-31T05:22:02.287651Z +3703 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +itextpdf-5.5.3.jar +file + + + + +2022-07-28T03:40:23.429719Z +1f8b7633f9f21668d178566e9e85fe7c +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +2237618 + diff --git a/appletFirma/lib/.svn/prop-base/itextpdf-5.5.3.jar.svn-base b/appletFirma/lib/.svn/prop-base/itextpdf-5.5.3.jar.svn-base new file mode 100644 index 0000000..dbc918b --- /dev/null +++ b/appletFirma/lib/.svn/prop-base/itextpdf-5.5.3.jar.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/appletFirma/lib/.svn/text-base/itextpdf-5.5.3.jar.svn-base b/appletFirma/lib/.svn/text-base/itextpdf-5.5.3.jar.svn-base new file mode 100644 index 0000000..0cff7af Binary files /dev/null and b/appletFirma/lib/.svn/text-base/itextpdf-5.5.3.jar.svn-base differ diff --git a/appletFirma/lib/itextpdf-5.5.3.jar b/appletFirma/lib/itextpdf-5.5.3.jar new file mode 100755 index 0000000..0cff7af Binary files /dev/null and b/appletFirma/lib/itextpdf-5.5.3.jar differ diff --git a/appletFirma/nb-configuration.xml b/appletFirma/nb-configuration.xml new file mode 100644 index 0000000..a79d2e4 --- /dev/null +++ b/appletFirma/nb-configuration.xml @@ -0,0 +1,18 @@ + + + + + + ORACLE_JDK_1.8 + + diff --git a/appletFirma/pom.xml b/appletFirma/pom.xml new file mode 100644 index 0000000..bbb37ca --- /dev/null +++ b/appletFirma/pom.xml @@ -0,0 +1,56 @@ + + 4.0.0 + + com.fp.firma + appletFirma + 2.1 + jar + + appletFirma + http://maven.apache.org + + + UTF-8 + + + + + junit + junit + 4.1 + test + + + + org.bouncycastle + bcmail-jdk15on + 1.51 + + + org.bouncycastle + bcprov-jdk15on + 1.49 + + + org.bouncycastle + bcprov-ext-jdk15on + 1.49 + + + org.bouncycastle + bcpkix-jdk15on + 1.49 + + + com.itextpdf + itextpdf + 5.5.3 + + + io.rubrica + rubrica + 1.0.0-SNAPSHOT + + + diff --git a/appletFirma/src/.svn/entries b/appletFirma/src/.svn/entries new file mode 100644 index 0000000..f948539 --- /dev/null +++ b/appletFirma/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/appletFirma/src +svn://172.17.26.185/COMACO + + + +2015-04-28T07:21:43.253845Z +4061 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/appletFirma/src/main/.svn/entries b/appletFirma/src/main/.svn/entries new file mode 100644 index 0000000..d553017 --- /dev/null +++ b/appletFirma/src/main/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/appletFirma/src/main +svn://172.17.26.185/COMACO + + + +2015-04-28T07:21:43.253845Z +4061 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/appletFirma/src/main/java/.svn/entries b/appletFirma/src/main/java/.svn/entries new file mode 100644 index 0000000..e3c9d30 --- /dev/null +++ b/appletFirma/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/appletFirma/src/main/java +svn://172.17.26.185/COMACO + + + +2015-04-28T07:21:43.253845Z +4061 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/appletFirma/src/main/java/com/.svn/entries b/appletFirma/src/main/java/com/.svn/entries new file mode 100644 index 0000000..5b92ddd --- /dev/null +++ b/appletFirma/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/appletFirma/src/main/java/com +svn://172.17.26.185/COMACO + + + +2015-04-28T07:21:43.253845Z +4061 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/appletFirma/src/main/java/com/fp/.svn/entries b/appletFirma/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..d38b438 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/appletFirma/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2015-04-28T07:21:43.253845Z +4061 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +firma +dir + diff --git a/appletFirma/src/main/java/com/fp/firma/.svn/entries b/appletFirma/src/main/java/com/fp/firma/.svn/entries new file mode 100644 index 0000000..3e93d2b --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/.svn/entries @@ -0,0 +1,43 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/appletFirma/src/main/java/com/fp/firma +svn://172.17.26.185/COMACO + + + +2015-04-28T07:21:43.253845Z +4061 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +component +dir + +applet +dir + +keystore +dir + +dto +dir + +common +dir + diff --git a/appletFirma/src/main/java/com/fp/firma/applet/.svn/entries b/appletFirma/src/main/java/com/fp/firma/applet/.svn/entries new file mode 100644 index 0000000..5baf692 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/applet/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/appletFirma/src/main/java/com/fp/firma/applet +svn://172.17.26.185/COMACO + + + +2015-04-28T07:21:43.253845Z +4061 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +FirmaApplet.java +file + + + + +2022-07-28T03:40:23.755721Z +c6fc0b382335939010b5277beb9a38dd +2015-04-28T07:21:43.253845Z +4061 +cpiedra +has-props + + + + + + + + + + + + + + + + + + + + +16793 + +FirmaApplet.form +file + + + + +2022-07-28T03:40:23.755721Z +575cbea3cc9720565e5a28838bc7a45e +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +7804 + diff --git a/appletFirma/src/main/java/com/fp/firma/applet/.svn/prop-base/FirmaApplet.form.svn-base b/appletFirma/src/main/java/com/fp/firma/applet/.svn/prop-base/FirmaApplet.form.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/applet/.svn/prop-base/FirmaApplet.form.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/appletFirma/src/main/java/com/fp/firma/applet/.svn/prop-base/FirmaApplet.java.svn-base b/appletFirma/src/main/java/com/fp/firma/applet/.svn/prop-base/FirmaApplet.java.svn-base new file mode 100644 index 0000000..085986a --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/applet/.svn/prop-base/FirmaApplet.java.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/appletFirma/src/main/java/com/fp/firma/applet/.svn/text-base/FirmaApplet.form.netbeans-base b/appletFirma/src/main/java/com/fp/firma/applet/.svn/text-base/FirmaApplet.form.netbeans-base new file mode 100644 index 0000000..d34e00e --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/applet/.svn/text-base/FirmaApplet.form.netbeans-base @@ -0,0 +1,152 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/appletFirma/src/main/java/com/fp/firma/applet/.svn/text-base/FirmaApplet.form.svn-base b/appletFirma/src/main/java/com/fp/firma/applet/.svn/text-base/FirmaApplet.form.svn-base new file mode 100644 index 0000000..d34e00e --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/applet/.svn/text-base/FirmaApplet.form.svn-base @@ -0,0 +1,152 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/appletFirma/src/main/java/com/fp/firma/applet/.svn/text-base/FirmaApplet.java.netbeans-base b/appletFirma/src/main/java/com/fp/firma/applet/.svn/text-base/FirmaApplet.java.netbeans-base new file mode 100644 index 0000000..5b3b412 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/applet/.svn/text-base/FirmaApplet.java.netbeans-base @@ -0,0 +1,345 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.firma.applet; + +import com.fp.firma.common.CertificateUtils; +import com.fp.firma.common.FirmMessages; +import com.itextpdf.text.Rectangle; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.swing.JComponent; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPasswordField; + +/** + * Applet de firma electrónica a través de token + * @author dcruz + */ +public class FirmaApplet extends javax.swing.JApplet { + + /** + * + */ + private static final long serialVersionUID = 1L; + private static final String PREFIX = "firmado_"; + private String rutaArchivoFirmar = ""; + private static final Logger logger = Logger.getLogger(FirmaApplet.class .getName()); + + private String tipoFirma; + /** + * Initializes the applet FirmaApplet + */ + @Override + public void init() { +// FileHandler handler; +// try { +// handler = new FileHandler(System.getProperty("java.io.tmpdir")+"\\applet.txt"); +// handler.setFormatter(new SimpleFormatter()); +// logger.addHandler(handler); +// } catch (IOException ex) { +// Logger.getLogger(FirmaApplet.class.getName()).log(Level.SEVERE, null, ex); +// } catch (SecurityException ex) { +// Logger.getLogger(FirmaApplet.class.getName()).log(Level.SEVERE, null, ex); +// } + + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(FirmaApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(FirmaApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(FirmaApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(FirmaApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the applet */ + try { + java.awt.EventQueue.invokeAndWait(new Runnable() { + public void run() { + initComponents(); + } + }); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + /** + * This method is called from within the init() method to initialize the form. WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + grupoRadios = new javax.swing.ButtonGroup(); + jPanel1 = new javax.swing.JPanel(); + labelArchivoFirma = new javax.swing.JLabel(); + txtRutaArchivo = new javax.swing.JTextField(); + btnExaminar = new javax.swing.JButton(); + btnFirmarArchivo = new javax.swing.JButton(); + tokenIkey = new javax.swing.JRadioButton(); + tokenAlladin = new javax.swing.JRadioButton(); + tokenSD = new javax.swing.JRadioButton(); + grupoRadios.add(tokenIkey); + grupoRadios.add(tokenAlladin); + grupoRadios.add(tokenSD); + + labelArchivoFirma.setText("Archivo a firmar"); + + txtRutaArchivo.setEditable(false); + btnFirmarArchivo.setEnabled(true); + btnExaminar.setEnabled(true); + + btnExaminar.setText("Examinar"); + btnExaminar.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnExaminarActionPerformed(evt); + } + }); + + btnFirmarArchivo.setText("Firmar"); + btnFirmarArchivo.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnFirmarArchivoActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(labelArchivoFirma) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(12, 12, 12) + .addComponent(btnFirmarArchivo)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(txtRutaArchivo, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnExaminar))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(labelArchivoFirma) + .addComponent(txtRutaArchivo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btnExaminar)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(btnFirmarArchivo) + .addContainerGap()) + ); + + tokenIkey.setText("iKey 2032"); + tokenIkey.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + tokenIkeyActionPerformed(evt); + } + }); + + tokenAlladin.setText("eTokenPro"); + tokenAlladin.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + tokenAlladinActionPerformed(evt); + } + }); + + tokenSD.setText("Security Data"); + tokenSD.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + tokenSDActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + .addGroup(layout.createSequentialGroup() + .addGap(41, 41, 41) + .addComponent(tokenIkey) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(tokenAlladin) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(tokenSD) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap(75, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(tokenAlladin) + .addComponent(tokenSD) + .addComponent(tokenIkey)) + .addGap(18, 18, 18) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(25, 25, 25)) + ); + }// //GEN-END:initComponents + + private void btnExaminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExaminarActionPerformed + // TODO add your handling code here: + try + { + /**llamamos el metodo que permite cargar la ventana*/ + JFileChooser fileChooser=new JFileChooser(); + String rutaArchivo = txtRutaArchivo.getText(); + File directorio = new File(rutaArchivo).getParentFile(); + fileChooser.setCurrentDirectory(directorio); +// System.out.println("Directorio del archivo "+fileChooser.getCurrentDirectory() != null ? fileChooser.getCurrentDirectory().getAbsolutePath() : ""); + /**abrimos el archivo seleccionado*/ + int respuestaDialog = fileChooser.showOpenDialog(this); + + if(respuestaDialog == JFileChooser.APPROVE_OPTION){ + File fileSelected = fileChooser.getSelectedFile(); + rutaArchivoFirmar = fileSelected.getAbsolutePath(); + System.out.println("Ruta del archivo escogido "+rutaArchivoFirmar); + txtRutaArchivo.setText(rutaArchivoFirmar); + } else{ + JOptionPane.showMessageDialog(null,"" + + "\nAccion cancelada por el usuario", + "ADVERTENCIA!!!",JOptionPane.WARNING_MESSAGE); + } + + + /**recorremos el archivo, lo leemos para plasmarlo + *en el area de texto*/ + + }catch(Throwable ex) + { + JOptionPane.showMessageDialog(null,ex+"" + + "\nNo se ha encontrado el archivo", + "ADVERTENCIA!!!",JOptionPane.WARNING_MESSAGE); + } + }//GEN-LAST:event_btnExaminarActionPerformed + + private void btnFirmarArchivoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFirmarArchivoActionPerformed + // TODO add your handling code here: + InputStream inputStream = null; + try{ + String razon = getParameter("razon") != null ? getParameter("razon") : ""; + String lugar = getParameter("lugar") != null ? getParameter("lugar") : ""; + String nombreFirma = getParameter("firma") != null ? getParameter("firma") : ""; + Float llx = Float.valueOf(getParameter("llx") != null ? Float.parseFloat(getParameter("llx")) : 0.0F); + Float lly = Float.valueOf(getParameter("lly") != null ? Float.parseFloat(getParameter("lly")) : 0.0F); + Float urx = Float.valueOf(getParameter("urx") != null ? Float.parseFloat(getParameter("urx")) : 0.0F); + Float ury = Float.valueOf(getParameter("ury") != null ? Float.parseFloat(getParameter("ury")) : 0.0F); + if(tipoFirma == null){ + JOptionPane.showMessageDialog(null, "Debe seleccionar un Token con el cual firmar", "Tipo Firma", JOptionPane.ERROR_MESSAGE); + return; + } + if(txtRutaArchivo.getText() != null){ + JPasswordField txtPasswordToken = new JPasswordField(); + final JComponent[] components = new JComponent[]{new JLabel("Password:"), txtPasswordToken}; + JOptionPane.showMessageDialog(null, components, "TOKEN", JOptionPane.PLAIN_MESSAGE); + if(txtPasswordToken.getPassword() == null){ + throw new NullPointerException(FirmMessages.getString("FIR-0007")); + } + inputStream = new FileInputStream(txtRutaArchivo.getText()); + byte[] datos = CertificateUtils.sign(inputStream, null, new String(txtPasswordToken.getPassword()), razon, lugar, Boolean.FALSE.booleanValue(), Boolean.FALSE.booleanValue(), new Rectangle(llx.floatValue(), lly.floatValue(), urx.floatValue(), ury.floatValue()), 1, nombreFirma, this.tipoFirma); + if(datos != null){ + escribirArchivo(datos); + txtPasswordToken.setText(""); + JOptionPane.showMessageDialog(null, "El archivo se modificado correctamente", "Archivo firmado", JOptionPane.INFORMATION_MESSAGE); + } + }else{ + JOptionPane.showMessageDialog(null, "Debe seleccionar un archivo", "Archivo no encontrado", JOptionPane.ERROR_MESSAGE); + } + btnFirmarArchivo.setEnabled(false); + btnExaminar.setEnabled(false); + } catch(IOException e){ + JOptionPane.showMessageDialog(null, e.getMessage(), "IO Error", JOptionPane.ERROR_MESSAGE); + } catch(Exception e){ + JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); + } finally{ + try { + if(inputStream != null){ + inputStream.close(); + } + } catch (IOException ex) { + Logger.getLogger(FirmaApplet.class.getName()).log(Level.SEVERE, null, ex); + } + } + }//GEN-LAST:event_btnFirmarArchivoActionPerformed + + public void escribirArchivo(byte[] data){ + System.out.println("Ingreso a escribir el archivo"); + FileOutputStream fo = null; + try { + File archivoFirmado = new File(txtRutaArchivo.getText()); + fo = new FileOutputStream(archivoFirmado); + fo.write(data); + } catch (FileNotFoundException e) { + JOptionPane.showMessageDialog(null, e.getMessage(), "Error archivo no encontrado", JOptionPane.ERROR_MESSAGE); + } catch (IOException e) { + JOptionPane.showMessageDialog(null, e.getMessage(), "Error al escribir el archivo firmado", JOptionPane.ERROR_MESSAGE); + } finally { + try { + fo.close(); + } catch (IOException ex) { + Logger.getLogger(FirmaApplet.class.getName()).log(Level.SEVERE, null, ex); + } + } + } + private void tokenIkeyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tokenIkeyActionPerformed + // TODO add your handling code here: + tipoFirma = "1"; + }//GEN-LAST:event_tokenIkeyActionPerformed + + private void tokenAlladinActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tokenAlladinActionPerformed + // TODO add your handling code here: + tipoFirma = "2"; + }//GEN-LAST:event_tokenAlladinActionPerformed + + private void tokenSDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tokenSDActionPerformed + // TODO add your handling code here: + tipoFirma = "3"; + }//GEN-LAST:event_tokenSDActionPerformed + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton btnExaminar; + private javax.swing.JButton btnFirmarArchivo; + private javax.swing.ButtonGroup grupoRadios; + private javax.swing.JPanel jPanel1; + private javax.swing.JLabel labelArchivoFirma; + private javax.swing.JRadioButton tokenAlladin; + private javax.swing.JRadioButton tokenIkey; + private javax.swing.JRadioButton tokenSD; + private javax.swing.JTextField txtRutaArchivo; + // End of variables declaration//GEN-END:variables +} diff --git a/appletFirma/src/main/java/com/fp/firma/applet/.svn/text-base/FirmaApplet.java.svn-base b/appletFirma/src/main/java/com/fp/firma/applet/.svn/text-base/FirmaApplet.java.svn-base new file mode 100644 index 0000000..5b3b412 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/applet/.svn/text-base/FirmaApplet.java.svn-base @@ -0,0 +1,345 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.firma.applet; + +import com.fp.firma.common.CertificateUtils; +import com.fp.firma.common.FirmMessages; +import com.itextpdf.text.Rectangle; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.swing.JComponent; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPasswordField; + +/** + * Applet de firma electrónica a través de token + * @author dcruz + */ +public class FirmaApplet extends javax.swing.JApplet { + + /** + * + */ + private static final long serialVersionUID = 1L; + private static final String PREFIX = "firmado_"; + private String rutaArchivoFirmar = ""; + private static final Logger logger = Logger.getLogger(FirmaApplet.class .getName()); + + private String tipoFirma; + /** + * Initializes the applet FirmaApplet + */ + @Override + public void init() { +// FileHandler handler; +// try { +// handler = new FileHandler(System.getProperty("java.io.tmpdir")+"\\applet.txt"); +// handler.setFormatter(new SimpleFormatter()); +// logger.addHandler(handler); +// } catch (IOException ex) { +// Logger.getLogger(FirmaApplet.class.getName()).log(Level.SEVERE, null, ex); +// } catch (SecurityException ex) { +// Logger.getLogger(FirmaApplet.class.getName()).log(Level.SEVERE, null, ex); +// } + + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(FirmaApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(FirmaApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(FirmaApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(FirmaApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the applet */ + try { + java.awt.EventQueue.invokeAndWait(new Runnable() { + public void run() { + initComponents(); + } + }); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + /** + * This method is called from within the init() method to initialize the form. WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + grupoRadios = new javax.swing.ButtonGroup(); + jPanel1 = new javax.swing.JPanel(); + labelArchivoFirma = new javax.swing.JLabel(); + txtRutaArchivo = new javax.swing.JTextField(); + btnExaminar = new javax.swing.JButton(); + btnFirmarArchivo = new javax.swing.JButton(); + tokenIkey = new javax.swing.JRadioButton(); + tokenAlladin = new javax.swing.JRadioButton(); + tokenSD = new javax.swing.JRadioButton(); + grupoRadios.add(tokenIkey); + grupoRadios.add(tokenAlladin); + grupoRadios.add(tokenSD); + + labelArchivoFirma.setText("Archivo a firmar"); + + txtRutaArchivo.setEditable(false); + btnFirmarArchivo.setEnabled(true); + btnExaminar.setEnabled(true); + + btnExaminar.setText("Examinar"); + btnExaminar.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnExaminarActionPerformed(evt); + } + }); + + btnFirmarArchivo.setText("Firmar"); + btnFirmarArchivo.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnFirmarArchivoActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(labelArchivoFirma) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(12, 12, 12) + .addComponent(btnFirmarArchivo)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(txtRutaArchivo, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnExaminar))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(labelArchivoFirma) + .addComponent(txtRutaArchivo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btnExaminar)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(btnFirmarArchivo) + .addContainerGap()) + ); + + tokenIkey.setText("iKey 2032"); + tokenIkey.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + tokenIkeyActionPerformed(evt); + } + }); + + tokenAlladin.setText("eTokenPro"); + tokenAlladin.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + tokenAlladinActionPerformed(evt); + } + }); + + tokenSD.setText("Security Data"); + tokenSD.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + tokenSDActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + .addGroup(layout.createSequentialGroup() + .addGap(41, 41, 41) + .addComponent(tokenIkey) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(tokenAlladin) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(tokenSD) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap(75, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(tokenAlladin) + .addComponent(tokenSD) + .addComponent(tokenIkey)) + .addGap(18, 18, 18) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(25, 25, 25)) + ); + }// //GEN-END:initComponents + + private void btnExaminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExaminarActionPerformed + // TODO add your handling code here: + try + { + /**llamamos el metodo que permite cargar la ventana*/ + JFileChooser fileChooser=new JFileChooser(); + String rutaArchivo = txtRutaArchivo.getText(); + File directorio = new File(rutaArchivo).getParentFile(); + fileChooser.setCurrentDirectory(directorio); +// System.out.println("Directorio del archivo "+fileChooser.getCurrentDirectory() != null ? fileChooser.getCurrentDirectory().getAbsolutePath() : ""); + /**abrimos el archivo seleccionado*/ + int respuestaDialog = fileChooser.showOpenDialog(this); + + if(respuestaDialog == JFileChooser.APPROVE_OPTION){ + File fileSelected = fileChooser.getSelectedFile(); + rutaArchivoFirmar = fileSelected.getAbsolutePath(); + System.out.println("Ruta del archivo escogido "+rutaArchivoFirmar); + txtRutaArchivo.setText(rutaArchivoFirmar); + } else{ + JOptionPane.showMessageDialog(null,"" + + "\nAccion cancelada por el usuario", + "ADVERTENCIA!!!",JOptionPane.WARNING_MESSAGE); + } + + + /**recorremos el archivo, lo leemos para plasmarlo + *en el area de texto*/ + + }catch(Throwable ex) + { + JOptionPane.showMessageDialog(null,ex+"" + + "\nNo se ha encontrado el archivo", + "ADVERTENCIA!!!",JOptionPane.WARNING_MESSAGE); + } + }//GEN-LAST:event_btnExaminarActionPerformed + + private void btnFirmarArchivoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFirmarArchivoActionPerformed + // TODO add your handling code here: + InputStream inputStream = null; + try{ + String razon = getParameter("razon") != null ? getParameter("razon") : ""; + String lugar = getParameter("lugar") != null ? getParameter("lugar") : ""; + String nombreFirma = getParameter("firma") != null ? getParameter("firma") : ""; + Float llx = Float.valueOf(getParameter("llx") != null ? Float.parseFloat(getParameter("llx")) : 0.0F); + Float lly = Float.valueOf(getParameter("lly") != null ? Float.parseFloat(getParameter("lly")) : 0.0F); + Float urx = Float.valueOf(getParameter("urx") != null ? Float.parseFloat(getParameter("urx")) : 0.0F); + Float ury = Float.valueOf(getParameter("ury") != null ? Float.parseFloat(getParameter("ury")) : 0.0F); + if(tipoFirma == null){ + JOptionPane.showMessageDialog(null, "Debe seleccionar un Token con el cual firmar", "Tipo Firma", JOptionPane.ERROR_MESSAGE); + return; + } + if(txtRutaArchivo.getText() != null){ + JPasswordField txtPasswordToken = new JPasswordField(); + final JComponent[] components = new JComponent[]{new JLabel("Password:"), txtPasswordToken}; + JOptionPane.showMessageDialog(null, components, "TOKEN", JOptionPane.PLAIN_MESSAGE); + if(txtPasswordToken.getPassword() == null){ + throw new NullPointerException(FirmMessages.getString("FIR-0007")); + } + inputStream = new FileInputStream(txtRutaArchivo.getText()); + byte[] datos = CertificateUtils.sign(inputStream, null, new String(txtPasswordToken.getPassword()), razon, lugar, Boolean.FALSE.booleanValue(), Boolean.FALSE.booleanValue(), new Rectangle(llx.floatValue(), lly.floatValue(), urx.floatValue(), ury.floatValue()), 1, nombreFirma, this.tipoFirma); + if(datos != null){ + escribirArchivo(datos); + txtPasswordToken.setText(""); + JOptionPane.showMessageDialog(null, "El archivo se modificado correctamente", "Archivo firmado", JOptionPane.INFORMATION_MESSAGE); + } + }else{ + JOptionPane.showMessageDialog(null, "Debe seleccionar un archivo", "Archivo no encontrado", JOptionPane.ERROR_MESSAGE); + } + btnFirmarArchivo.setEnabled(false); + btnExaminar.setEnabled(false); + } catch(IOException e){ + JOptionPane.showMessageDialog(null, e.getMessage(), "IO Error", JOptionPane.ERROR_MESSAGE); + } catch(Exception e){ + JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); + } finally{ + try { + if(inputStream != null){ + inputStream.close(); + } + } catch (IOException ex) { + Logger.getLogger(FirmaApplet.class.getName()).log(Level.SEVERE, null, ex); + } + } + }//GEN-LAST:event_btnFirmarArchivoActionPerformed + + public void escribirArchivo(byte[] data){ + System.out.println("Ingreso a escribir el archivo"); + FileOutputStream fo = null; + try { + File archivoFirmado = new File(txtRutaArchivo.getText()); + fo = new FileOutputStream(archivoFirmado); + fo.write(data); + } catch (FileNotFoundException e) { + JOptionPane.showMessageDialog(null, e.getMessage(), "Error archivo no encontrado", JOptionPane.ERROR_MESSAGE); + } catch (IOException e) { + JOptionPane.showMessageDialog(null, e.getMessage(), "Error al escribir el archivo firmado", JOptionPane.ERROR_MESSAGE); + } finally { + try { + fo.close(); + } catch (IOException ex) { + Logger.getLogger(FirmaApplet.class.getName()).log(Level.SEVERE, null, ex); + } + } + } + private void tokenIkeyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tokenIkeyActionPerformed + // TODO add your handling code here: + tipoFirma = "1"; + }//GEN-LAST:event_tokenIkeyActionPerformed + + private void tokenAlladinActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tokenAlladinActionPerformed + // TODO add your handling code here: + tipoFirma = "2"; + }//GEN-LAST:event_tokenAlladinActionPerformed + + private void tokenSDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tokenSDActionPerformed + // TODO add your handling code here: + tipoFirma = "3"; + }//GEN-LAST:event_tokenSDActionPerformed + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton btnExaminar; + private javax.swing.JButton btnFirmarArchivo; + private javax.swing.ButtonGroup grupoRadios; + private javax.swing.JPanel jPanel1; + private javax.swing.JLabel labelArchivoFirma; + private javax.swing.JRadioButton tokenAlladin; + private javax.swing.JRadioButton tokenIkey; + private javax.swing.JRadioButton tokenSD; + private javax.swing.JTextField txtRutaArchivo; + // End of variables declaration//GEN-END:variables +} diff --git a/appletFirma/src/main/java/com/fp/firma/applet/FirmaApplet.form b/appletFirma/src/main/java/com/fp/firma/applet/FirmaApplet.form new file mode 100755 index 0000000..d34e00e --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/applet/FirmaApplet.form @@ -0,0 +1,152 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/appletFirma/src/main/java/com/fp/firma/applet/FirmaApplet.java b/appletFirma/src/main/java/com/fp/firma/applet/FirmaApplet.java new file mode 100755 index 0000000..5b3b412 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/applet/FirmaApplet.java @@ -0,0 +1,345 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.firma.applet; + +import com.fp.firma.common.CertificateUtils; +import com.fp.firma.common.FirmMessages; +import com.itextpdf.text.Rectangle; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.swing.JComponent; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPasswordField; + +/** + * Applet de firma electrónica a través de token + * @author dcruz + */ +public class FirmaApplet extends javax.swing.JApplet { + + /** + * + */ + private static final long serialVersionUID = 1L; + private static final String PREFIX = "firmado_"; + private String rutaArchivoFirmar = ""; + private static final Logger logger = Logger.getLogger(FirmaApplet.class .getName()); + + private String tipoFirma; + /** + * Initializes the applet FirmaApplet + */ + @Override + public void init() { +// FileHandler handler; +// try { +// handler = new FileHandler(System.getProperty("java.io.tmpdir")+"\\applet.txt"); +// handler.setFormatter(new SimpleFormatter()); +// logger.addHandler(handler); +// } catch (IOException ex) { +// Logger.getLogger(FirmaApplet.class.getName()).log(Level.SEVERE, null, ex); +// } catch (SecurityException ex) { +// Logger.getLogger(FirmaApplet.class.getName()).log(Level.SEVERE, null, ex); +// } + + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(FirmaApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(FirmaApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(FirmaApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(FirmaApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the applet */ + try { + java.awt.EventQueue.invokeAndWait(new Runnable() { + public void run() { + initComponents(); + } + }); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + /** + * This method is called from within the init() method to initialize the form. WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + grupoRadios = new javax.swing.ButtonGroup(); + jPanel1 = new javax.swing.JPanel(); + labelArchivoFirma = new javax.swing.JLabel(); + txtRutaArchivo = new javax.swing.JTextField(); + btnExaminar = new javax.swing.JButton(); + btnFirmarArchivo = new javax.swing.JButton(); + tokenIkey = new javax.swing.JRadioButton(); + tokenAlladin = new javax.swing.JRadioButton(); + tokenSD = new javax.swing.JRadioButton(); + grupoRadios.add(tokenIkey); + grupoRadios.add(tokenAlladin); + grupoRadios.add(tokenSD); + + labelArchivoFirma.setText("Archivo a firmar"); + + txtRutaArchivo.setEditable(false); + btnFirmarArchivo.setEnabled(true); + btnExaminar.setEnabled(true); + + btnExaminar.setText("Examinar"); + btnExaminar.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnExaminarActionPerformed(evt); + } + }); + + btnFirmarArchivo.setText("Firmar"); + btnFirmarArchivo.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnFirmarArchivoActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(labelArchivoFirma) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(12, 12, 12) + .addComponent(btnFirmarArchivo)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(txtRutaArchivo, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnExaminar))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(labelArchivoFirma) + .addComponent(txtRutaArchivo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btnExaminar)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(btnFirmarArchivo) + .addContainerGap()) + ); + + tokenIkey.setText("iKey 2032"); + tokenIkey.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + tokenIkeyActionPerformed(evt); + } + }); + + tokenAlladin.setText("eTokenPro"); + tokenAlladin.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + tokenAlladinActionPerformed(evt); + } + }); + + tokenSD.setText("Security Data"); + tokenSD.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + tokenSDActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + .addGroup(layout.createSequentialGroup() + .addGap(41, 41, 41) + .addComponent(tokenIkey) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(tokenAlladin) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(tokenSD) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap(75, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(tokenAlladin) + .addComponent(tokenSD) + .addComponent(tokenIkey)) + .addGap(18, 18, 18) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(25, 25, 25)) + ); + }// //GEN-END:initComponents + + private void btnExaminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExaminarActionPerformed + // TODO add your handling code here: + try + { + /**llamamos el metodo que permite cargar la ventana*/ + JFileChooser fileChooser=new JFileChooser(); + String rutaArchivo = txtRutaArchivo.getText(); + File directorio = new File(rutaArchivo).getParentFile(); + fileChooser.setCurrentDirectory(directorio); +// System.out.println("Directorio del archivo "+fileChooser.getCurrentDirectory() != null ? fileChooser.getCurrentDirectory().getAbsolutePath() : ""); + /**abrimos el archivo seleccionado*/ + int respuestaDialog = fileChooser.showOpenDialog(this); + + if(respuestaDialog == JFileChooser.APPROVE_OPTION){ + File fileSelected = fileChooser.getSelectedFile(); + rutaArchivoFirmar = fileSelected.getAbsolutePath(); + System.out.println("Ruta del archivo escogido "+rutaArchivoFirmar); + txtRutaArchivo.setText(rutaArchivoFirmar); + } else{ + JOptionPane.showMessageDialog(null,"" + + "\nAccion cancelada por el usuario", + "ADVERTENCIA!!!",JOptionPane.WARNING_MESSAGE); + } + + + /**recorremos el archivo, lo leemos para plasmarlo + *en el area de texto*/ + + }catch(Throwable ex) + { + JOptionPane.showMessageDialog(null,ex+"" + + "\nNo se ha encontrado el archivo", + "ADVERTENCIA!!!",JOptionPane.WARNING_MESSAGE); + } + }//GEN-LAST:event_btnExaminarActionPerformed + + private void btnFirmarArchivoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFirmarArchivoActionPerformed + // TODO add your handling code here: + InputStream inputStream = null; + try{ + String razon = getParameter("razon") != null ? getParameter("razon") : ""; + String lugar = getParameter("lugar") != null ? getParameter("lugar") : ""; + String nombreFirma = getParameter("firma") != null ? getParameter("firma") : ""; + Float llx = Float.valueOf(getParameter("llx") != null ? Float.parseFloat(getParameter("llx")) : 0.0F); + Float lly = Float.valueOf(getParameter("lly") != null ? Float.parseFloat(getParameter("lly")) : 0.0F); + Float urx = Float.valueOf(getParameter("urx") != null ? Float.parseFloat(getParameter("urx")) : 0.0F); + Float ury = Float.valueOf(getParameter("ury") != null ? Float.parseFloat(getParameter("ury")) : 0.0F); + if(tipoFirma == null){ + JOptionPane.showMessageDialog(null, "Debe seleccionar un Token con el cual firmar", "Tipo Firma", JOptionPane.ERROR_MESSAGE); + return; + } + if(txtRutaArchivo.getText() != null){ + JPasswordField txtPasswordToken = new JPasswordField(); + final JComponent[] components = new JComponent[]{new JLabel("Password:"), txtPasswordToken}; + JOptionPane.showMessageDialog(null, components, "TOKEN", JOptionPane.PLAIN_MESSAGE); + if(txtPasswordToken.getPassword() == null){ + throw new NullPointerException(FirmMessages.getString("FIR-0007")); + } + inputStream = new FileInputStream(txtRutaArchivo.getText()); + byte[] datos = CertificateUtils.sign(inputStream, null, new String(txtPasswordToken.getPassword()), razon, lugar, Boolean.FALSE.booleanValue(), Boolean.FALSE.booleanValue(), new Rectangle(llx.floatValue(), lly.floatValue(), urx.floatValue(), ury.floatValue()), 1, nombreFirma, this.tipoFirma); + if(datos != null){ + escribirArchivo(datos); + txtPasswordToken.setText(""); + JOptionPane.showMessageDialog(null, "El archivo se modificado correctamente", "Archivo firmado", JOptionPane.INFORMATION_MESSAGE); + } + }else{ + JOptionPane.showMessageDialog(null, "Debe seleccionar un archivo", "Archivo no encontrado", JOptionPane.ERROR_MESSAGE); + } + btnFirmarArchivo.setEnabled(false); + btnExaminar.setEnabled(false); + } catch(IOException e){ + JOptionPane.showMessageDialog(null, e.getMessage(), "IO Error", JOptionPane.ERROR_MESSAGE); + } catch(Exception e){ + JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); + } finally{ + try { + if(inputStream != null){ + inputStream.close(); + } + } catch (IOException ex) { + Logger.getLogger(FirmaApplet.class.getName()).log(Level.SEVERE, null, ex); + } + } + }//GEN-LAST:event_btnFirmarArchivoActionPerformed + + public void escribirArchivo(byte[] data){ + System.out.println("Ingreso a escribir el archivo"); + FileOutputStream fo = null; + try { + File archivoFirmado = new File(txtRutaArchivo.getText()); + fo = new FileOutputStream(archivoFirmado); + fo.write(data); + } catch (FileNotFoundException e) { + JOptionPane.showMessageDialog(null, e.getMessage(), "Error archivo no encontrado", JOptionPane.ERROR_MESSAGE); + } catch (IOException e) { + JOptionPane.showMessageDialog(null, e.getMessage(), "Error al escribir el archivo firmado", JOptionPane.ERROR_MESSAGE); + } finally { + try { + fo.close(); + } catch (IOException ex) { + Logger.getLogger(FirmaApplet.class.getName()).log(Level.SEVERE, null, ex); + } + } + } + private void tokenIkeyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tokenIkeyActionPerformed + // TODO add your handling code here: + tipoFirma = "1"; + }//GEN-LAST:event_tokenIkeyActionPerformed + + private void tokenAlladinActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tokenAlladinActionPerformed + // TODO add your handling code here: + tipoFirma = "2"; + }//GEN-LAST:event_tokenAlladinActionPerformed + + private void tokenSDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tokenSDActionPerformed + // TODO add your handling code here: + tipoFirma = "3"; + }//GEN-LAST:event_tokenSDActionPerformed + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton btnExaminar; + private javax.swing.JButton btnFirmarArchivo; + private javax.swing.ButtonGroup grupoRadios; + private javax.swing.JPanel jPanel1; + private javax.swing.JLabel labelArchivoFirma; + private javax.swing.JRadioButton tokenAlladin; + private javax.swing.JRadioButton tokenIkey; + private javax.swing.JRadioButton tokenSD; + private javax.swing.JTextField txtRutaArchivo; + // End of variables declaration//GEN-END:variables +} diff --git a/appletFirma/src/main/java/com/fp/firma/common/.svn/entries b/appletFirma/src/main/java/com/fp/firma/common/.svn/entries new file mode 100644 index 0000000..26d9970 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/common/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/appletFirma/src/main/java/com/fp/firma/common +svn://172.17.26.185/COMACO + + + +2014-12-31T05:22:02.287651Z +3703 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +FirmasException.java +file + + + + +2022-07-28T03:40:23.887721Z +84290c6223a2073cf617d181f8c1bdc5 +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +720 + +CertificateUtils.java +file + + + + +2022-07-28T03:40:23.887721Z +17c37f7ea3aec267390dece54b70a43b +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +25187 + +FirmMessages.java +file + + + + +2022-07-28T03:40:23.888721Z +214a4e732a4b72d7ee6b901019619bf0 +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +361 + diff --git a/appletFirma/src/main/java/com/fp/firma/common/.svn/prop-base/CertificateUtils.java.svn-base b/appletFirma/src/main/java/com/fp/firma/common/.svn/prop-base/CertificateUtils.java.svn-base new file mode 100644 index 0000000..085986a --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/common/.svn/prop-base/CertificateUtils.java.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/appletFirma/src/main/java/com/fp/firma/common/.svn/prop-base/FirmMessages.java.svn-base b/appletFirma/src/main/java/com/fp/firma/common/.svn/prop-base/FirmMessages.java.svn-base new file mode 100644 index 0000000..085986a --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/common/.svn/prop-base/FirmMessages.java.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/appletFirma/src/main/java/com/fp/firma/common/.svn/prop-base/FirmasException.java.svn-base b/appletFirma/src/main/java/com/fp/firma/common/.svn/prop-base/FirmasException.java.svn-base new file mode 100644 index 0000000..085986a --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/common/.svn/prop-base/FirmasException.java.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/appletFirma/src/main/java/com/fp/firma/common/.svn/text-base/CertificateUtils.java.svn-base b/appletFirma/src/main/java/com/fp/firma/common/.svn/text-base/CertificateUtils.java.svn-base new file mode 100644 index 0000000..44082ba --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/common/.svn/text-base/CertificateUtils.java.svn-base @@ -0,0 +1,584 @@ +package com.fp.firma.common; + +import java.io.ByteArrayOutputStream; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.Security; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Enumeration; +import java.util.List; + +import org.bouncycastle.jce.provider.BouncyCastleProvider; + +import com.fp.firma.dto.TfirmDatosFirmante; +import com.fp.firma.keystore.KeyStoreProvider; +import com.fp.firma.keystore.LinuxKeyStoreProvider; +import com.fp.firma.keystore.WindowsJDK6KeyStoreProvider; +import com.itextpdf.text.DocumentException; +import com.itextpdf.text.Font; +import com.itextpdf.text.Rectangle; +import com.itextpdf.text.pdf.AcroFields; +import com.itextpdf.text.pdf.PdfReader; +import com.itextpdf.text.pdf.PdfSignatureAppearance; +import com.itextpdf.text.pdf.PdfStamper; +import com.itextpdf.text.pdf.security.BouncyCastleDigest; +import com.itextpdf.text.pdf.security.CertificateInfo; +import com.itextpdf.text.pdf.security.CertificateInfo.X500Name; +import com.itextpdf.text.pdf.security.DigestAlgorithms; +import com.itextpdf.text.pdf.security.ExternalDigest; +import com.itextpdf.text.pdf.security.ExternalSignature; +import com.itextpdf.text.pdf.security.MakeSignature; +import com.itextpdf.text.pdf.security.MakeSignature.CryptoStandard; +import com.itextpdf.text.pdf.security.OcspClient; +import com.itextpdf.text.pdf.security.OcspClientBouncyCastle; +import com.itextpdf.text.pdf.security.PrivateKeySignature; +import com.itextpdf.text.pdf.security.TSAClient; +//import javax.persistence.NoResultException; +//import javax.persistence.Query; + +/** + * Clase que contiene métodos utilitarios para manejar certificados + * + * @author dcruz + * + */ +public class CertificateUtils { + + /* + * CONSTANTES DESIGNADAS SEGUN LA NUEVA ESTRUCTURA DEL BCE + */ + // OIDs de Campos del Certificado: + public static final String OID_CEDULA_PASAPORTE = FirmMessages.getString("oid.cedula_pasaporte"); + + public static final String OID_NOMBRES = FirmMessages.getString("oid.nombres_persona"); + + public static final String OID_APELLIDO_1 = FirmMessages.getString("oid.apellido_persona1"); + + public static final String OID_APELLIDO_2 = FirmMessages.getString("oid.apellido_persona2"); + + public static final String OID_CARGO = FirmMessages.getString("oid.cargo"); + + public static final String OID_INSTITUCION = FirmMessages.getString("oid.institucion"); + + public static final String OID_DIRECCION = FirmMessages.getString("oid.direccion"); + + public static final String OID_TELEFONO = FirmMessages.getString("oid.telefono"); + + public static final String OID_CIUDAD = FirmMessages.getString("oid.ciudad"); + + public static final String OID_RAZON_SOCIAL = FirmMessages.getString("oid.razon_social"); + + public static final String OID_RUC = FirmMessages.getString("oid.ruc"); + + public static final String X509 = "X.509"; + + static { + BouncyCastleProvider provider = new BouncyCastleProvider(); + Security.addProvider(provider); + } + + /** + * Retorna el certificado del usuario contenido en la firma + * + * @param store el store en el que se va a buscar los certificados + * @param aliases los alias que estan dentro del keystore + * @return el {@link java.security.Certificate} + * @throws KeyStoreException + */ + public synchronized static Certificate obtainCertificateInAlias(KeyStore store, Enumeration aliases) throws KeyStoreException { + Certificate certs[] = null; + synchronized (aliases) { + int i = 0; + while (aliases.hasMoreElements()) { + String alias = aliases.nextElement(); + System.out.println("Se imprime los alias: " + i + " " + alias); + certs = store.getCertificateChain(alias); + for (int j = 0; j < certs.length; j++) { + X509Certificate certificate = (X509Certificate) certs[j]; + boolean[] usages = certificate.getKeyUsage(); + System.out.println("Certificado en primera posicion usado: " + j + " " + usages[0]); + if (usages[0]) { + return certificate; + } + } + i++; + } + + } + return null; + } + + /** + * Se devuelve todos los datos de la firma del usuario en base al certificado enviado + * + * @param certificate el certificado enviado + * @return Los datos del certificado de dicho usuario + */ + public static TfirmDatosFirmante obtainDataForCertificate(Certificate certificate) { + X509Certificate signedCertificate = (X509Certificate) certificate; + TfirmDatosFirmante datosFirmante = new TfirmDatosFirmante(); + if (signedCertificate.getExtensionValue(OID_CEDULA_PASAPORTE) != null) { + datosFirmante.setIdentificacion(new String(signedCertificate.getExtensionValue(OID_CEDULA_PASAPORTE)).trim()); + } + if (signedCertificate.getExtensionValue(OID_NOMBRES) != null) { + datosFirmante.setNombre(new String(signedCertificate.getExtensionValue(OID_NOMBRES)).trim()); + } + if (signedCertificate.getExtensionValue(OID_APELLIDO_1) != null) { + datosFirmante.setApellido1(new String(signedCertificate.getExtensionValue(OID_APELLIDO_1)).trim()); + if (signedCertificate.getExtensionValue(OID_APELLIDO_2) != null) { + datosFirmante.setApellido2(new String(signedCertificate.getExtensionValue(OID_APELLIDO_2)).trim()); + } else { + datosFirmante.setApellido2(""); + } + } + if (signedCertificate.getExtensionValue(OID_TELEFONO) != null) { + datosFirmante.setTelefono(new String(signedCertificate.getExtensionValue(OID_TELEFONO)).trim()); + } + if (signedCertificate.getExtensionValue(OID_CARGO) != null) { + datosFirmante.setCargo(new String(signedCertificate.getExtensionValue(OID_CARGO)).trim()); + } + if (signedCertificate.getExtensionValue(OID_CIUDAD) != null) { + datosFirmante.setCiudad(new String(signedCertificate.getExtensionValue(OID_CIUDAD)).trim()); + } + if (signedCertificate.getExtensionValue(OID_DIRECCION) != null) { + datosFirmante.setDireccion(new String(signedCertificate.getExtensionValue(OID_DIRECCION)).trim()); + } + if (signedCertificate.getExtensionValue(OID_INSTITUCION) != null) { + datosFirmante.setInstitucion(new String(signedCertificate.getExtensionValue(OID_INSTITUCION)).trim()); + } + if (signedCertificate.getExtensionValue(OID_RAZON_SOCIAL) != null) { + datosFirmante.setInstitucion(new String(signedCertificate.getExtensionValue(OID_RAZON_SOCIAL)).trim()); + } + if (signedCertificate.getExtensionValue(OID_RUC) != null) { + datosFirmante.setRuc(new String(signedCertificate.getExtensionValue(OID_RUC)).trim()); + } + datosFirmante.setFechaInicioVigencia(signedCertificate.getNotBefore()); + datosFirmante.setFechaVigencia(signedCertificate.getNotAfter()); + return datosFirmante; + } + + /** + * Valida que el certificado del usuario sea un certificado valido contra el servicio OCSP del proveedor + * + * @param certificateUser + * @throws FileNotFoundException + * @throws CertificateException + */ + public static void validateOcsCertificate(Certificate certificateUser) throws FileNotFoundException, CertificateException { + System.out.println(((X509Certificate) certificateUser).getIssuerDN().getName()); + CertificateFactory cf = CertificateFactory.getInstance(X509); + InputStream subordStream = new FileInputStream(FirmMessages.getString("dir.ruta.base.repositorio") + "/" + + FirmMessages.getString("nombre.certificado.subordinado")); + X509Certificate subordCertificate = (X509Certificate) cf.generateCertificate(subordStream); + check((X509Certificate) certificateUser, subordCertificate); + } + + /** + * Valida que los certificados enviados sean validos por la entidad certificadora + * + * @param issuerCert certificado del usuario + * @param x509Cert certificado que firmo el certificado expedido + */ + public static void check(X509Certificate issuerCert, X509Certificate x509Cert) { +// try { +// +// BigInteger serialNumber = issuerCert.getSerialNumber(); +// X509CertificateHolder holder; +// +// try { +// holder = new X509CertificateHolder(x509Cert.getEncoded()); +// } catch (IOException e) { +// throw new RuntimeException(e); +// } +// +// CertificateID id = new CertificateID(new JcaDigestCalculatorProviderBuilder().setProvider(BouncyCastleProvider.PROVIDER_NAME).build() +// .get(CertificateID.HASH_SHA1), holder, serialNumber); +// +// OCSPReqBuilder ocspGen = new OCSPReqBuilder(); +// ocspGen.addRequest(id); +// OCSPReq ocspReq = ocspGen.build(); +// +// // Ir al OCSP +// String ocspUrl = CertificateUtil.getOCSPURL(issuerCert); +// +// if (ocspUrl == null) { +// System.out.println("URL de OCSP is null"); +// return; +// } +// +// URL url; +// +// try { +// url = new URL(ocspUrl); +// } catch (MalformedURLException e) { +// throw new RuntimeException(e); +// } +// +// HttpURLConnection con; +// OCSPResp ocspResponse; +// DataOutputStream dataOut = null; +// try { +// con = (HttpURLConnection) url.openConnection(); +// +// con.setRequestProperty("Content-Type", "application/ocsp-request"); +// con.setRequestProperty("Accept", "application/ocsp-response"); +// con.setDoOutput(true); +// +// OutputStream out = con.getOutputStream(); +// dataOut = new DataOutputStream(new BufferedOutputStream(out)); +// dataOut.write(ocspReq.getEncoded()); +// +// System.out.println("Estado de respuesta de la peticion=" + con.getResponseCode()); +// +// /* +// * Se parsea la respuesta y se obtiene el estado del certificado retornado por el OCSP +// */ +// InputStream in = (InputStream) con.getContent(); +// byte[] resp = read(in); // Read the reponse +// ocspResponse = new OCSPResp(resp); +// } catch (IOException e) { +// throw new FirmasException("ERROR AL ESTABLECER CONEXI\u00d3N AL SERVICIO: "+url); +// } finally{ +// if(dataOut != null){ +// try { +// dataOut.flush(); +// dataOut.close(); +// } catch (IOException e) {} +// } +// } +// +// int status = ocspResponse.getStatus(); +// System.out.println("status=" + status); +// +// BasicOCSPResp basicResponse = (BasicOCSPResp) ocspResponse.getResponseObject(); +// +// if (basicResponse != null) { +// SingleResp[] responses = basicResponse.getResponses(); +// SingleResp response = responses[0]; +// CertificateStatus certStatus = (CertificateStatus) response.getCertStatus(); +// +// if (certStatus instanceof RevokedStatus) { +// System.out.println("REVOKED"); +// RevokedStatus revokedStatus = (RevokedStatus) certStatus; +// System.out.println("Reason: " + revokedStatus.getRevocationReason()); +// System.out.println("Date: " + revokedStatus.getRevocationTime()); +// +// throw new FirmasException("ERROR, CERTIFICADO REVOCADO POR "+revokedStatus.getRevocationReason()+" CON FECHA "+ revokedStatus.getRevocationTime()); +// } +// } +// } catch (OCSPException e) { +// throw new RuntimeException(e); +// } catch (CertificateEncodingException e) { +// throw new RuntimeException(e); +// } + } + + /** + * Devuelve los nombres de firmas de un documento PDF + * + * @param docStream el documento a verificar + * @return un lista de nombres de firmas + */ + public static List obtainNameSigns(InputStream docStream) { + try { + PdfReader docPdf = new PdfReader(docStream); + AcroFields af = docPdf.getAcroFields(); + return af.getSignatureNames(); + } catch (IOException e) { + System.err.println("Error al obtener los nombres del documentoss"); + return null; + } finally{ + + } + } + +/** + * Método para firmar documentos + * @param fileSrc + * @param usuario + * @param password + * @param compania + * @param reason + * @param location + * @param rectangle + * @param numPage + * @param nameSign + * @return + * @throws Exception + */ + public static byte[] sign(InputStream fileSrc, String usuario, String password, Integer compania, String reason, String location, + Rectangle rectangle, int numPage, String nameSign, String pathCertificate) throws Exception { + String path = pathCertificate; + FileInputStream ceritificateInputStream = new FileInputStream(path); + return sign(fileSrc, ceritificateInputStream, password, reason, location, false, true, rectangle, numPage, nameSign, null); + } + + /** + * Metodo para firmar documentos + * @param fileSrc + * @param usuario + * @param password + * @param compania + * @param reason + * @param location + * @param rectangle + * @param numPage + * @param nameSign + * @return + * @throws Exception + */ + public static byte[] sign(InputStream fileSrc, String usuario, String password, Integer compania, String reason, String location, + Rectangle rectangle, int numPage, String nameSign) throws Exception { + String path = ""; + FileInputStream ceritificateInputStream = new FileInputStream(path); + return sign(fileSrc, ceritificateInputStream, password, reason, location, false, true, rectangle, numPage, nameSign, null); + } + + /** + * Método que firma un documento en base los parámetros indicados + * + * @param fileSrc archivo origen + * @param fileCert archivo firma en formato digital si no es null el firmado es con archivo caso contrario es token + * @param password contrasena + * @param reason razón o motivo de la firma. + * @param location localización coemtario adicional de la firma. + * @param withTS tiene TS estamapado de tiempo. + * @param withOCSP tiene OCSP verificacion de la firma por el la entidad certificadora BCE. + * @param rectangle lugar localizaci´n firma + * @param numPage número pagina + * @param nameSign nombre firma + * @param tipoFirma es el tipo de token que se usará(Token que tipo?) + * @return el documento firmado + */ + public static byte[] sign(InputStream fileSrc, InputStream fileCert, String password, String reason, String location, boolean withTS, + boolean withOCSP, Rectangle rectangle, int numPage, String nameSign, String tipoFirma) { + OutputStream outputStream = null; + System.out.println("Ingreso a firmar"); + try { + PdfReader pdfReader = new PdfReader(fileSrc); + outputStream = new ByteArrayOutputStream(512); + PdfStamper stamper = PdfStamper.createSignature(pdfReader, outputStream, '\0'); + PdfSignatureAppearance appearance = stamper.getSignatureAppearance(); + KeyStore store; + String alias; +// PrivateKey privateKey = null; + ExternalSignature signature = null; + if(fileCert != null){ + store = KeyStore.getInstance("PKCS12"); + store.load(fileCert, password.toCharArray()); + alias = store.aliases().nextElement(); + signature = new PrivateKeySignature((PrivateKey) store.getKey(alias, password.toCharArray()), DigestAlgorithms.SHA256, + "SunRsaSign"); + } else{//firma por token + KeyStoreProvider provider = getKeyStoreProvider(tipoFirma); + store = provider.getKeystore(password.toCharArray()); + alias = store.aliases().nextElement(); +// privateKey = (PrivateKey) store.getKey(alias, null); + signature = new PrivateKeySignature((PrivateKey) store.getKey(alias, null), DigestAlgorithms.SHA1, + null); + } +// appearance.setCrypto(privateKey, store.getCertificateChain(alias), null, null); + appearance.setLayer2Text(generateSignText(store.getCertificateChain(alias), reason, location)); + appearance.setLayer2Font(new Font(Font.FontFamily.UNDEFINED, 8F)); + appearance.setVisibleSignature(rectangle, numPage, nameSign); + TSAClient tsc = null; + if (withTS) { + + } + OcspClient ocsp = null; + if (withOCSP) { + ocsp = new OcspClientBouncyCastle(); + } +// stamper.close(); + ExternalDigest externalDigest = new BouncyCastleDigest(); + MakeSignature.signDetached(appearance, externalDigest, signature, store.getCertificateChain(alias), null, ocsp, tsc, 15000, + CryptoStandard.CADES); + return ((ByteArrayOutputStream) outputStream).toByteArray(); + } catch (IOException e) { + throw new RuntimeException(e); + } catch (DocumentException e) { + throw new RuntimeException(e); + } catch (KeyStoreException e) { + throw new RuntimeException(e); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } catch (CertificateException e) { + throw new RuntimeException(e); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } catch (FirmasException e) { + throw new RuntimeException(FirmMessages.getString("FIR-0006")); + } catch (Throwable e) { + throw new RuntimeException(e); + } finally{ + try { + if(fileCert != null){ + fileCert.close(); + } + } catch (IOException e) {} + try { + fileSrc.close(); + } catch (IOException e) {} + try { + if(outputStream != null){ + + outputStream.close(); + } + } catch (IOException e) {} + } + } + + /** + * Arma documento el texto a mostrar de la plantilla + * @param chains certificados + * @param reason razón + * @param location lugar + * @return una layout de la firma + */ + private static String generateSignText(Certificate[] chains, String reason, String location){ + StringBuffer textLayout = new StringBuffer("Firmado digitalmente por: "); + String name = null; + X500Name x500name = CertificateInfo.getSubjectFields((X509Certificate)chains[0]); + if (x500name != null) { + name = x500name.getField("CN"); + if (name == null) + name = x500name.getField("E"); + } + if(name == null){ + name = ""; + } + textLayout.append(name).append("\n"); + if(reason != null){ + textLayout.append("Raz\u00f3n: ").append(reason).append("\n"); + } + if(location != null){ + textLayout.append("Lugar: ").append(location).append("\n"); + } + SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); + textLayout.append("Fecha: ").append(format.format(new Date(System.currentTimeMillis()))); + return textLayout.toString(); + } + + /** + * Retorna el keystore del token especificado + * @param tipoToken + * @return + * @throws KeyStoreException + */ + private static KeyStoreProvider getKeyStoreProvider(String tipoToken) { + String osName = System.getProperty("os.name"); + KeyStoreProvider provider = null; + if(tipoToken == null){ + return provider; + } + if (osName.toUpperCase().indexOf("WINDOWS") == 0) { + provider = new WindowsJDK6KeyStoreProvider(); + if (tipoToken.equals("2")) { + provider = new WindowsJDK6KeyStoreProvider(); // trabaja con librerias sera para eToken + }else if (tipoToken.equals("1")) { + provider = new WindowsJDK6KeyStoreProvider(); // trabaja con librerias sera para iKey + }else if (tipoToken.equals("3")) { + provider = new WindowsJDK6KeyStoreProvider(); // trabaja con librerias sera para iKey + } + } else { + provider = new LinuxKeyStoreProvider(); + } + return provider; + } + + private static byte[] read(InputStream in) throws IOException { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + int next = in.read(); + while (next > -1) { + bos.write(next); + next = in.read(); + } + bos.flush(); + return bos.toByteArray(); + } + + /** + * Entrega el path en el que se encuentra el certificado digital. + * + * @param cusuario Codigo de usuario. + * @param ccompania Codigo de compania. + * @return String + * @throws Exception + */ +// private static String getPath(String cusuario, Integer ccompania) throws Exception { +// TfirmCertificado tfirmcertificado = getTfirmCertificado(cusuario); +// TgeneParametersKey tgeneParametersKey = new TgeneParametersKey("PATH_CERTIFICADO_BCE", ccompania); +// TgeneParameters tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), tgeneParametersKey); +// String path = tgeneParameters.getTextvalue() + "/" + tfirmcertificado.getPk().getIdcertificado(); +// return path; +// } + + /** + * Sentencia que entrega la defincion vigente de un certificado digital para un usuario. + */ +// private static final String JPQL = "from TfirmCertificado where t.codigousuario = :cusuario"; + + /** + * Entrega defincion de certificados digitales vigente. + * + * @param cusuario Codigo de usuario. + * @return TfirmCertificado. + * @throws Exception + */ +// private static TfirmCertificado getTfirmCertificado(String cusuario) throws Exception { +// TfirmCertificado tfirmCertificado = null; +// Query qry = PersistenceHelper.getEntityManager().createQuery(JPQL); +// qry.setParameter("cusuario", cusuario); +// try { +// tfirmCertificado = (TfirmCertificado) qry.getSingleResult(); +// } catch (NoResultException e) { +// throw new FirmasException("FIR-0001", "PARAMETROS DEL CERTIFICADO DIGITAL NO DEFINIDO PARA EL USUARIO: {0}", cusuario); +// } +// return tfirmCertificado; +// } + + + /* + public static boolean validatePassword(InputStream fileSrc, String usuario, String password, Integer compania, String reason, String location, + Rectangle rectangle, int numPage, String nameSign) throws Exception { + String path = getPath(usuario, compania); + FileInputStream ceritificateInputStream = new FileInputStream(path); + return pass(fileSrc, ceritificateInputStream, password, reason, location, false, true, rectangle, numPage, nameSign); + } + + + private static boolean pass(InputStream fileSrc, InputStream fileCert, String password, String reason, String location, boolean withTS, + boolean withOCSP, Rectangle rectangle, int numPage, String nameSign) { + try { + PdfReader pdfReader = new PdfReader(fileSrc); + OutputStream outputStream = new ByteArrayOutputStream(512); + PdfStamper stamper = PdfStamper.createSignature(pdfReader, outputStream, '\0'); + PdfSignatureAppearance appearance = stamper.getSignatureAppearance(); + + KeyStore store = KeyStore.getInstance("PKCS12"); + store.load(fileCert, password.toCharArray()); + String alias = store.aliases().nextElement(); + ExternalSignature signature = new PrivateKeySignature((PrivateKey) store.getKey(alias, password.toCharArray()), DigestAlgorithms.SHA256, + "SunRsaSign"); + return true; + } catch (Exception e) { + return false; + } + } + */ + + +} diff --git a/appletFirma/src/main/java/com/fp/firma/common/.svn/text-base/FirmMessages.java.svn-base b/appletFirma/src/main/java/com/fp/firma/common/.svn/text-base/FirmMessages.java.svn-base new file mode 100644 index 0000000..c560464 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/common/.svn/text-base/FirmMessages.java.svn-base @@ -0,0 +1,19 @@ +package com.fp.firma.common; + +import java.util.ResourceBundle; + +public class FirmMessages { + + private final static String RESOURCE = "firmessages_es"; + + private final static ResourceBundle firmessages; + + static{ + firmessages = ResourceBundle.getBundle(RESOURCE); + } + + public static String getString(String key) { + return firmessages.getString(key); + } + +} diff --git a/appletFirma/src/main/java/com/fp/firma/common/.svn/text-base/FirmasException.java.svn-base b/appletFirma/src/main/java/com/fp/firma/common/.svn/text-base/FirmasException.java.svn-base new file mode 100644 index 0000000..d781306 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/common/.svn/text-base/FirmasException.java.svn-base @@ -0,0 +1,30 @@ +package com.fp.firma.common; + + +/** + * Clase que manejará todos los errores relacionados con la firma digital + * + * @author dcruz + * + */ +public class FirmasException extends RuntimeException { + + private static final long serialVersionUID = -599185902882644036L; + + public FirmasException(String message) { + super(message); + } + + public FirmasException(String message, Throwable cause) { + super(message, cause); + } + + public FirmasException(Throwable cause) { + super(cause); + } + + public FirmasException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } + +} diff --git a/appletFirma/src/main/java/com/fp/firma/common/CertificateUtils.java b/appletFirma/src/main/java/com/fp/firma/common/CertificateUtils.java new file mode 100755 index 0000000..44082ba --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/common/CertificateUtils.java @@ -0,0 +1,584 @@ +package com.fp.firma.common; + +import java.io.ByteArrayOutputStream; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.Security; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Enumeration; +import java.util.List; + +import org.bouncycastle.jce.provider.BouncyCastleProvider; + +import com.fp.firma.dto.TfirmDatosFirmante; +import com.fp.firma.keystore.KeyStoreProvider; +import com.fp.firma.keystore.LinuxKeyStoreProvider; +import com.fp.firma.keystore.WindowsJDK6KeyStoreProvider; +import com.itextpdf.text.DocumentException; +import com.itextpdf.text.Font; +import com.itextpdf.text.Rectangle; +import com.itextpdf.text.pdf.AcroFields; +import com.itextpdf.text.pdf.PdfReader; +import com.itextpdf.text.pdf.PdfSignatureAppearance; +import com.itextpdf.text.pdf.PdfStamper; +import com.itextpdf.text.pdf.security.BouncyCastleDigest; +import com.itextpdf.text.pdf.security.CertificateInfo; +import com.itextpdf.text.pdf.security.CertificateInfo.X500Name; +import com.itextpdf.text.pdf.security.DigestAlgorithms; +import com.itextpdf.text.pdf.security.ExternalDigest; +import com.itextpdf.text.pdf.security.ExternalSignature; +import com.itextpdf.text.pdf.security.MakeSignature; +import com.itextpdf.text.pdf.security.MakeSignature.CryptoStandard; +import com.itextpdf.text.pdf.security.OcspClient; +import com.itextpdf.text.pdf.security.OcspClientBouncyCastle; +import com.itextpdf.text.pdf.security.PrivateKeySignature; +import com.itextpdf.text.pdf.security.TSAClient; +//import javax.persistence.NoResultException; +//import javax.persistence.Query; + +/** + * Clase que contiene métodos utilitarios para manejar certificados + * + * @author dcruz + * + */ +public class CertificateUtils { + + /* + * CONSTANTES DESIGNADAS SEGUN LA NUEVA ESTRUCTURA DEL BCE + */ + // OIDs de Campos del Certificado: + public static final String OID_CEDULA_PASAPORTE = FirmMessages.getString("oid.cedula_pasaporte"); + + public static final String OID_NOMBRES = FirmMessages.getString("oid.nombres_persona"); + + public static final String OID_APELLIDO_1 = FirmMessages.getString("oid.apellido_persona1"); + + public static final String OID_APELLIDO_2 = FirmMessages.getString("oid.apellido_persona2"); + + public static final String OID_CARGO = FirmMessages.getString("oid.cargo"); + + public static final String OID_INSTITUCION = FirmMessages.getString("oid.institucion"); + + public static final String OID_DIRECCION = FirmMessages.getString("oid.direccion"); + + public static final String OID_TELEFONO = FirmMessages.getString("oid.telefono"); + + public static final String OID_CIUDAD = FirmMessages.getString("oid.ciudad"); + + public static final String OID_RAZON_SOCIAL = FirmMessages.getString("oid.razon_social"); + + public static final String OID_RUC = FirmMessages.getString("oid.ruc"); + + public static final String X509 = "X.509"; + + static { + BouncyCastleProvider provider = new BouncyCastleProvider(); + Security.addProvider(provider); + } + + /** + * Retorna el certificado del usuario contenido en la firma + * + * @param store el store en el que se va a buscar los certificados + * @param aliases los alias que estan dentro del keystore + * @return el {@link java.security.Certificate} + * @throws KeyStoreException + */ + public synchronized static Certificate obtainCertificateInAlias(KeyStore store, Enumeration aliases) throws KeyStoreException { + Certificate certs[] = null; + synchronized (aliases) { + int i = 0; + while (aliases.hasMoreElements()) { + String alias = aliases.nextElement(); + System.out.println("Se imprime los alias: " + i + " " + alias); + certs = store.getCertificateChain(alias); + for (int j = 0; j < certs.length; j++) { + X509Certificate certificate = (X509Certificate) certs[j]; + boolean[] usages = certificate.getKeyUsage(); + System.out.println("Certificado en primera posicion usado: " + j + " " + usages[0]); + if (usages[0]) { + return certificate; + } + } + i++; + } + + } + return null; + } + + /** + * Se devuelve todos los datos de la firma del usuario en base al certificado enviado + * + * @param certificate el certificado enviado + * @return Los datos del certificado de dicho usuario + */ + public static TfirmDatosFirmante obtainDataForCertificate(Certificate certificate) { + X509Certificate signedCertificate = (X509Certificate) certificate; + TfirmDatosFirmante datosFirmante = new TfirmDatosFirmante(); + if (signedCertificate.getExtensionValue(OID_CEDULA_PASAPORTE) != null) { + datosFirmante.setIdentificacion(new String(signedCertificate.getExtensionValue(OID_CEDULA_PASAPORTE)).trim()); + } + if (signedCertificate.getExtensionValue(OID_NOMBRES) != null) { + datosFirmante.setNombre(new String(signedCertificate.getExtensionValue(OID_NOMBRES)).trim()); + } + if (signedCertificate.getExtensionValue(OID_APELLIDO_1) != null) { + datosFirmante.setApellido1(new String(signedCertificate.getExtensionValue(OID_APELLIDO_1)).trim()); + if (signedCertificate.getExtensionValue(OID_APELLIDO_2) != null) { + datosFirmante.setApellido2(new String(signedCertificate.getExtensionValue(OID_APELLIDO_2)).trim()); + } else { + datosFirmante.setApellido2(""); + } + } + if (signedCertificate.getExtensionValue(OID_TELEFONO) != null) { + datosFirmante.setTelefono(new String(signedCertificate.getExtensionValue(OID_TELEFONO)).trim()); + } + if (signedCertificate.getExtensionValue(OID_CARGO) != null) { + datosFirmante.setCargo(new String(signedCertificate.getExtensionValue(OID_CARGO)).trim()); + } + if (signedCertificate.getExtensionValue(OID_CIUDAD) != null) { + datosFirmante.setCiudad(new String(signedCertificate.getExtensionValue(OID_CIUDAD)).trim()); + } + if (signedCertificate.getExtensionValue(OID_DIRECCION) != null) { + datosFirmante.setDireccion(new String(signedCertificate.getExtensionValue(OID_DIRECCION)).trim()); + } + if (signedCertificate.getExtensionValue(OID_INSTITUCION) != null) { + datosFirmante.setInstitucion(new String(signedCertificate.getExtensionValue(OID_INSTITUCION)).trim()); + } + if (signedCertificate.getExtensionValue(OID_RAZON_SOCIAL) != null) { + datosFirmante.setInstitucion(new String(signedCertificate.getExtensionValue(OID_RAZON_SOCIAL)).trim()); + } + if (signedCertificate.getExtensionValue(OID_RUC) != null) { + datosFirmante.setRuc(new String(signedCertificate.getExtensionValue(OID_RUC)).trim()); + } + datosFirmante.setFechaInicioVigencia(signedCertificate.getNotBefore()); + datosFirmante.setFechaVigencia(signedCertificate.getNotAfter()); + return datosFirmante; + } + + /** + * Valida que el certificado del usuario sea un certificado valido contra el servicio OCSP del proveedor + * + * @param certificateUser + * @throws FileNotFoundException + * @throws CertificateException + */ + public static void validateOcsCertificate(Certificate certificateUser) throws FileNotFoundException, CertificateException { + System.out.println(((X509Certificate) certificateUser).getIssuerDN().getName()); + CertificateFactory cf = CertificateFactory.getInstance(X509); + InputStream subordStream = new FileInputStream(FirmMessages.getString("dir.ruta.base.repositorio") + "/" + + FirmMessages.getString("nombre.certificado.subordinado")); + X509Certificate subordCertificate = (X509Certificate) cf.generateCertificate(subordStream); + check((X509Certificate) certificateUser, subordCertificate); + } + + /** + * Valida que los certificados enviados sean validos por la entidad certificadora + * + * @param issuerCert certificado del usuario + * @param x509Cert certificado que firmo el certificado expedido + */ + public static void check(X509Certificate issuerCert, X509Certificate x509Cert) { +// try { +// +// BigInteger serialNumber = issuerCert.getSerialNumber(); +// X509CertificateHolder holder; +// +// try { +// holder = new X509CertificateHolder(x509Cert.getEncoded()); +// } catch (IOException e) { +// throw new RuntimeException(e); +// } +// +// CertificateID id = new CertificateID(new JcaDigestCalculatorProviderBuilder().setProvider(BouncyCastleProvider.PROVIDER_NAME).build() +// .get(CertificateID.HASH_SHA1), holder, serialNumber); +// +// OCSPReqBuilder ocspGen = new OCSPReqBuilder(); +// ocspGen.addRequest(id); +// OCSPReq ocspReq = ocspGen.build(); +// +// // Ir al OCSP +// String ocspUrl = CertificateUtil.getOCSPURL(issuerCert); +// +// if (ocspUrl == null) { +// System.out.println("URL de OCSP is null"); +// return; +// } +// +// URL url; +// +// try { +// url = new URL(ocspUrl); +// } catch (MalformedURLException e) { +// throw new RuntimeException(e); +// } +// +// HttpURLConnection con; +// OCSPResp ocspResponse; +// DataOutputStream dataOut = null; +// try { +// con = (HttpURLConnection) url.openConnection(); +// +// con.setRequestProperty("Content-Type", "application/ocsp-request"); +// con.setRequestProperty("Accept", "application/ocsp-response"); +// con.setDoOutput(true); +// +// OutputStream out = con.getOutputStream(); +// dataOut = new DataOutputStream(new BufferedOutputStream(out)); +// dataOut.write(ocspReq.getEncoded()); +// +// System.out.println("Estado de respuesta de la peticion=" + con.getResponseCode()); +// +// /* +// * Se parsea la respuesta y se obtiene el estado del certificado retornado por el OCSP +// */ +// InputStream in = (InputStream) con.getContent(); +// byte[] resp = read(in); // Read the reponse +// ocspResponse = new OCSPResp(resp); +// } catch (IOException e) { +// throw new FirmasException("ERROR AL ESTABLECER CONEXI\u00d3N AL SERVICIO: "+url); +// } finally{ +// if(dataOut != null){ +// try { +// dataOut.flush(); +// dataOut.close(); +// } catch (IOException e) {} +// } +// } +// +// int status = ocspResponse.getStatus(); +// System.out.println("status=" + status); +// +// BasicOCSPResp basicResponse = (BasicOCSPResp) ocspResponse.getResponseObject(); +// +// if (basicResponse != null) { +// SingleResp[] responses = basicResponse.getResponses(); +// SingleResp response = responses[0]; +// CertificateStatus certStatus = (CertificateStatus) response.getCertStatus(); +// +// if (certStatus instanceof RevokedStatus) { +// System.out.println("REVOKED"); +// RevokedStatus revokedStatus = (RevokedStatus) certStatus; +// System.out.println("Reason: " + revokedStatus.getRevocationReason()); +// System.out.println("Date: " + revokedStatus.getRevocationTime()); +// +// throw new FirmasException("ERROR, CERTIFICADO REVOCADO POR "+revokedStatus.getRevocationReason()+" CON FECHA "+ revokedStatus.getRevocationTime()); +// } +// } +// } catch (OCSPException e) { +// throw new RuntimeException(e); +// } catch (CertificateEncodingException e) { +// throw new RuntimeException(e); +// } + } + + /** + * Devuelve los nombres de firmas de un documento PDF + * + * @param docStream el documento a verificar + * @return un lista de nombres de firmas + */ + public static List obtainNameSigns(InputStream docStream) { + try { + PdfReader docPdf = new PdfReader(docStream); + AcroFields af = docPdf.getAcroFields(); + return af.getSignatureNames(); + } catch (IOException e) { + System.err.println("Error al obtener los nombres del documentoss"); + return null; + } finally{ + + } + } + +/** + * Método para firmar documentos + * @param fileSrc + * @param usuario + * @param password + * @param compania + * @param reason + * @param location + * @param rectangle + * @param numPage + * @param nameSign + * @return + * @throws Exception + */ + public static byte[] sign(InputStream fileSrc, String usuario, String password, Integer compania, String reason, String location, + Rectangle rectangle, int numPage, String nameSign, String pathCertificate) throws Exception { + String path = pathCertificate; + FileInputStream ceritificateInputStream = new FileInputStream(path); + return sign(fileSrc, ceritificateInputStream, password, reason, location, false, true, rectangle, numPage, nameSign, null); + } + + /** + * Metodo para firmar documentos + * @param fileSrc + * @param usuario + * @param password + * @param compania + * @param reason + * @param location + * @param rectangle + * @param numPage + * @param nameSign + * @return + * @throws Exception + */ + public static byte[] sign(InputStream fileSrc, String usuario, String password, Integer compania, String reason, String location, + Rectangle rectangle, int numPage, String nameSign) throws Exception { + String path = ""; + FileInputStream ceritificateInputStream = new FileInputStream(path); + return sign(fileSrc, ceritificateInputStream, password, reason, location, false, true, rectangle, numPage, nameSign, null); + } + + /** + * Método que firma un documento en base los parámetros indicados + * + * @param fileSrc archivo origen + * @param fileCert archivo firma en formato digital si no es null el firmado es con archivo caso contrario es token + * @param password contrasena + * @param reason razón o motivo de la firma. + * @param location localización coemtario adicional de la firma. + * @param withTS tiene TS estamapado de tiempo. + * @param withOCSP tiene OCSP verificacion de la firma por el la entidad certificadora BCE. + * @param rectangle lugar localizaci´n firma + * @param numPage número pagina + * @param nameSign nombre firma + * @param tipoFirma es el tipo de token que se usará(Token que tipo?) + * @return el documento firmado + */ + public static byte[] sign(InputStream fileSrc, InputStream fileCert, String password, String reason, String location, boolean withTS, + boolean withOCSP, Rectangle rectangle, int numPage, String nameSign, String tipoFirma) { + OutputStream outputStream = null; + System.out.println("Ingreso a firmar"); + try { + PdfReader pdfReader = new PdfReader(fileSrc); + outputStream = new ByteArrayOutputStream(512); + PdfStamper stamper = PdfStamper.createSignature(pdfReader, outputStream, '\0'); + PdfSignatureAppearance appearance = stamper.getSignatureAppearance(); + KeyStore store; + String alias; +// PrivateKey privateKey = null; + ExternalSignature signature = null; + if(fileCert != null){ + store = KeyStore.getInstance("PKCS12"); + store.load(fileCert, password.toCharArray()); + alias = store.aliases().nextElement(); + signature = new PrivateKeySignature((PrivateKey) store.getKey(alias, password.toCharArray()), DigestAlgorithms.SHA256, + "SunRsaSign"); + } else{//firma por token + KeyStoreProvider provider = getKeyStoreProvider(tipoFirma); + store = provider.getKeystore(password.toCharArray()); + alias = store.aliases().nextElement(); +// privateKey = (PrivateKey) store.getKey(alias, null); + signature = new PrivateKeySignature((PrivateKey) store.getKey(alias, null), DigestAlgorithms.SHA1, + null); + } +// appearance.setCrypto(privateKey, store.getCertificateChain(alias), null, null); + appearance.setLayer2Text(generateSignText(store.getCertificateChain(alias), reason, location)); + appearance.setLayer2Font(new Font(Font.FontFamily.UNDEFINED, 8F)); + appearance.setVisibleSignature(rectangle, numPage, nameSign); + TSAClient tsc = null; + if (withTS) { + + } + OcspClient ocsp = null; + if (withOCSP) { + ocsp = new OcspClientBouncyCastle(); + } +// stamper.close(); + ExternalDigest externalDigest = new BouncyCastleDigest(); + MakeSignature.signDetached(appearance, externalDigest, signature, store.getCertificateChain(alias), null, ocsp, tsc, 15000, + CryptoStandard.CADES); + return ((ByteArrayOutputStream) outputStream).toByteArray(); + } catch (IOException e) { + throw new RuntimeException(e); + } catch (DocumentException e) { + throw new RuntimeException(e); + } catch (KeyStoreException e) { + throw new RuntimeException(e); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } catch (CertificateException e) { + throw new RuntimeException(e); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } catch (FirmasException e) { + throw new RuntimeException(FirmMessages.getString("FIR-0006")); + } catch (Throwable e) { + throw new RuntimeException(e); + } finally{ + try { + if(fileCert != null){ + fileCert.close(); + } + } catch (IOException e) {} + try { + fileSrc.close(); + } catch (IOException e) {} + try { + if(outputStream != null){ + + outputStream.close(); + } + } catch (IOException e) {} + } + } + + /** + * Arma documento el texto a mostrar de la plantilla + * @param chains certificados + * @param reason razón + * @param location lugar + * @return una layout de la firma + */ + private static String generateSignText(Certificate[] chains, String reason, String location){ + StringBuffer textLayout = new StringBuffer("Firmado digitalmente por: "); + String name = null; + X500Name x500name = CertificateInfo.getSubjectFields((X509Certificate)chains[0]); + if (x500name != null) { + name = x500name.getField("CN"); + if (name == null) + name = x500name.getField("E"); + } + if(name == null){ + name = ""; + } + textLayout.append(name).append("\n"); + if(reason != null){ + textLayout.append("Raz\u00f3n: ").append(reason).append("\n"); + } + if(location != null){ + textLayout.append("Lugar: ").append(location).append("\n"); + } + SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); + textLayout.append("Fecha: ").append(format.format(new Date(System.currentTimeMillis()))); + return textLayout.toString(); + } + + /** + * Retorna el keystore del token especificado + * @param tipoToken + * @return + * @throws KeyStoreException + */ + private static KeyStoreProvider getKeyStoreProvider(String tipoToken) { + String osName = System.getProperty("os.name"); + KeyStoreProvider provider = null; + if(tipoToken == null){ + return provider; + } + if (osName.toUpperCase().indexOf("WINDOWS") == 0) { + provider = new WindowsJDK6KeyStoreProvider(); + if (tipoToken.equals("2")) { + provider = new WindowsJDK6KeyStoreProvider(); // trabaja con librerias sera para eToken + }else if (tipoToken.equals("1")) { + provider = new WindowsJDK6KeyStoreProvider(); // trabaja con librerias sera para iKey + }else if (tipoToken.equals("3")) { + provider = new WindowsJDK6KeyStoreProvider(); // trabaja con librerias sera para iKey + } + } else { + provider = new LinuxKeyStoreProvider(); + } + return provider; + } + + private static byte[] read(InputStream in) throws IOException { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + int next = in.read(); + while (next > -1) { + bos.write(next); + next = in.read(); + } + bos.flush(); + return bos.toByteArray(); + } + + /** + * Entrega el path en el que se encuentra el certificado digital. + * + * @param cusuario Codigo de usuario. + * @param ccompania Codigo de compania. + * @return String + * @throws Exception + */ +// private static String getPath(String cusuario, Integer ccompania) throws Exception { +// TfirmCertificado tfirmcertificado = getTfirmCertificado(cusuario); +// TgeneParametersKey tgeneParametersKey = new TgeneParametersKey("PATH_CERTIFICADO_BCE", ccompania); +// TgeneParameters tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), tgeneParametersKey); +// String path = tgeneParameters.getTextvalue() + "/" + tfirmcertificado.getPk().getIdcertificado(); +// return path; +// } + + /** + * Sentencia que entrega la defincion vigente de un certificado digital para un usuario. + */ +// private static final String JPQL = "from TfirmCertificado where t.codigousuario = :cusuario"; + + /** + * Entrega defincion de certificados digitales vigente. + * + * @param cusuario Codigo de usuario. + * @return TfirmCertificado. + * @throws Exception + */ +// private static TfirmCertificado getTfirmCertificado(String cusuario) throws Exception { +// TfirmCertificado tfirmCertificado = null; +// Query qry = PersistenceHelper.getEntityManager().createQuery(JPQL); +// qry.setParameter("cusuario", cusuario); +// try { +// tfirmCertificado = (TfirmCertificado) qry.getSingleResult(); +// } catch (NoResultException e) { +// throw new FirmasException("FIR-0001", "PARAMETROS DEL CERTIFICADO DIGITAL NO DEFINIDO PARA EL USUARIO: {0}", cusuario); +// } +// return tfirmCertificado; +// } + + + /* + public static boolean validatePassword(InputStream fileSrc, String usuario, String password, Integer compania, String reason, String location, + Rectangle rectangle, int numPage, String nameSign) throws Exception { + String path = getPath(usuario, compania); + FileInputStream ceritificateInputStream = new FileInputStream(path); + return pass(fileSrc, ceritificateInputStream, password, reason, location, false, true, rectangle, numPage, nameSign); + } + + + private static boolean pass(InputStream fileSrc, InputStream fileCert, String password, String reason, String location, boolean withTS, + boolean withOCSP, Rectangle rectangle, int numPage, String nameSign) { + try { + PdfReader pdfReader = new PdfReader(fileSrc); + OutputStream outputStream = new ByteArrayOutputStream(512); + PdfStamper stamper = PdfStamper.createSignature(pdfReader, outputStream, '\0'); + PdfSignatureAppearance appearance = stamper.getSignatureAppearance(); + + KeyStore store = KeyStore.getInstance("PKCS12"); + store.load(fileCert, password.toCharArray()); + String alias = store.aliases().nextElement(); + ExternalSignature signature = new PrivateKeySignature((PrivateKey) store.getKey(alias, password.toCharArray()), DigestAlgorithms.SHA256, + "SunRsaSign"); + return true; + } catch (Exception e) { + return false; + } + } + */ + + +} diff --git a/appletFirma/src/main/java/com/fp/firma/common/FirmMessages.java b/appletFirma/src/main/java/com/fp/firma/common/FirmMessages.java new file mode 100755 index 0000000..c560464 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/common/FirmMessages.java @@ -0,0 +1,19 @@ +package com.fp.firma.common; + +import java.util.ResourceBundle; + +public class FirmMessages { + + private final static String RESOURCE = "firmessages_es"; + + private final static ResourceBundle firmessages; + + static{ + firmessages = ResourceBundle.getBundle(RESOURCE); + } + + public static String getString(String key) { + return firmessages.getString(key); + } + +} diff --git a/appletFirma/src/main/java/com/fp/firma/common/FirmasException.java b/appletFirma/src/main/java/com/fp/firma/common/FirmasException.java new file mode 100755 index 0000000..d781306 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/common/FirmasException.java @@ -0,0 +1,30 @@ +package com.fp.firma.common; + + +/** + * Clase que manejará todos los errores relacionados con la firma digital + * + * @author dcruz + * + */ +public class FirmasException extends RuntimeException { + + private static final long serialVersionUID = -599185902882644036L; + + public FirmasException(String message) { + super(message); + } + + public FirmasException(String message, Throwable cause) { + super(message, cause); + } + + public FirmasException(Throwable cause) { + super(cause); + } + + public FirmasException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } + +} diff --git a/appletFirma/src/main/java/com/fp/firma/component/.svn/entries b/appletFirma/src/main/java/com/fp/firma/component/.svn/entries new file mode 100644 index 0000000..44d0f5e --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/component/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/appletFirma/src/main/java/com/fp/firma/component +svn://172.17.26.185/COMACO + + + +2014-12-31T05:22:02.287651Z +3703 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +PasswordDialog.java +file + + + + +2022-07-28T03:40:23.697721Z +2b492580e233dc08baf86d4b915c4e2a +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1794 + diff --git a/appletFirma/src/main/java/com/fp/firma/component/.svn/prop-base/PasswordDialog.java.svn-base b/appletFirma/src/main/java/com/fp/firma/component/.svn/prop-base/PasswordDialog.java.svn-base new file mode 100644 index 0000000..085986a --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/component/.svn/prop-base/PasswordDialog.java.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/appletFirma/src/main/java/com/fp/firma/component/.svn/text-base/PasswordDialog.java.svn-base b/appletFirma/src/main/java/com/fp/firma/component/.svn/text-base/PasswordDialog.java.svn-base new file mode 100644 index 0000000..3667ca9 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/component/.svn/text-base/PasswordDialog.java.svn-base @@ -0,0 +1,53 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.firma.component; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import javax.swing.JDialog; +import javax.swing.JOptionPane; +import javax.swing.JPasswordField; + +/** + * Dialog que permite el ingreso del password del token para la firma + * @author dcruz + */ +public class PasswordDialog extends JDialog implements ActionListener, PropertyChangeListener{ + + private JPasswordField txtPasswordCertificado; + + public PasswordDialog(){ + super(); + txtPasswordCertificado = new JPasswordField(); + setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + addComponentListener(new ComponentAdapter() { + @Override + public void componentShown(ComponentEvent ce) { + txtPasswordCertificado.requestFocusInWindow(); + } + }); + txtPasswordCertificado.addActionListener(this); + } + + public void actionPerformed(ActionEvent e) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + public void propertyChange(PropertyChangeEvent evt) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + /** This method clears the dialog and hides it. */ + public void clearAndHide() { + txtPasswordCertificado.setText(null); + setVisible(false); + } +} diff --git a/appletFirma/src/main/java/com/fp/firma/component/PasswordDialog.java b/appletFirma/src/main/java/com/fp/firma/component/PasswordDialog.java new file mode 100755 index 0000000..3667ca9 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/component/PasswordDialog.java @@ -0,0 +1,53 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.firma.component; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import javax.swing.JDialog; +import javax.swing.JOptionPane; +import javax.swing.JPasswordField; + +/** + * Dialog que permite el ingreso del password del token para la firma + * @author dcruz + */ +public class PasswordDialog extends JDialog implements ActionListener, PropertyChangeListener{ + + private JPasswordField txtPasswordCertificado; + + public PasswordDialog(){ + super(); + txtPasswordCertificado = new JPasswordField(); + setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + addComponentListener(new ComponentAdapter() { + @Override + public void componentShown(ComponentEvent ce) { + txtPasswordCertificado.requestFocusInWindow(); + } + }); + txtPasswordCertificado.addActionListener(this); + } + + public void actionPerformed(ActionEvent e) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + public void propertyChange(PropertyChangeEvent evt) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + /** This method clears the dialog and hides it. */ + public void clearAndHide() { + txtPasswordCertificado.setText(null); + setVisible(false); + } +} diff --git a/appletFirma/src/main/java/com/fp/firma/dto/.svn/entries b/appletFirma/src/main/java/com/fp/firma/dto/.svn/entries new file mode 100644 index 0000000..a2055ff --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/dto/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/appletFirma/src/main/java/com/fp/firma/dto +svn://172.17.26.185/COMACO + + + +2014-12-31T05:22:02.287651Z +3703 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TfirmDatosFirmante.java +file + + + + +2022-07-28T03:40:23.854721Z +dab60ed3fdfb2662d1e1b54882a17c12 +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +3379 + diff --git a/appletFirma/src/main/java/com/fp/firma/dto/.svn/prop-base/TfirmDatosFirmante.java.svn-base b/appletFirma/src/main/java/com/fp/firma/dto/.svn/prop-base/TfirmDatosFirmante.java.svn-base new file mode 100644 index 0000000..085986a --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/dto/.svn/prop-base/TfirmDatosFirmante.java.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/appletFirma/src/main/java/com/fp/firma/dto/.svn/text-base/TfirmDatosFirmante.java.svn-base b/appletFirma/src/main/java/com/fp/firma/dto/.svn/text-base/TfirmDatosFirmante.java.svn-base new file mode 100644 index 0000000..39b5ea0 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/dto/.svn/text-base/TfirmDatosFirmante.java.svn-base @@ -0,0 +1,169 @@ +package com.fp.firma.dto; + +import java.io.Serializable; +import java.util.Date; + +/** + * Clase que contiene los datos del usuario que es dueno de la firma y en la cual + * + * @author dcruz + * + */ +public class TfirmDatosFirmante implements + Serializable, Cloneable { + + private static final long serialVersionUID = 4232773513442100177L; + private String aliasCertificado; + private String identificacion; + private String nombre; + private String apellido1; + private String apellido2; + private String cargo; + private String institucion; + private String direccion; + private String telefono; + private String ciudad; + private String razonSocial; + private String ruc; + private Date fechaInicioVigencia; + private Date fechaVigencia; + + public TfirmDatosFirmante(){} + + public TfirmDatosFirmante(String identificacion, String nombre, + String apellido1, String apellido2, String cargo, + String institucion, String direccion, String telefono, + String ciudad, String razonSocial, String ruc) { + super(); + this.identificacion = identificacion; + this.nombre = nombre; + this.apellido1 = apellido1; + this.apellido2 = apellido2; + this.cargo = cargo; + this.institucion = institucion; + this.direccion = direccion; + this.telefono = telefono; + this.ciudad = ciudad; + this.razonSocial = razonSocial; + this.ruc = ruc; + } + + + + public String getIdentificacion() { + return identificacion; + } + + public void setIdentificacion(String identificacion) { + this.identificacion = identificacion; + } + + public String getNombre() { + return nombre; + } + + public void setNombre(String nombre) { + this.nombre = nombre; + } + + public String getApellido1() { + return apellido1; + } + + public void setApellido1(String apellido1) { + this.apellido1 = apellido1; + } + + public String getApellido2() { + return apellido2; + } + + public void setApellido2(String apellido2) { + this.apellido2 = apellido2; + } + + public String getCargo() { + return cargo; + } + + public void setCargo(String cargo) { + this.cargo = cargo; + } + + public String getInstitucion() { + return institucion; + } + + public void setInstitucion(String institucion) { + this.institucion = institucion; + } + + public String getDireccion() { + return direccion; + } + + public void setDireccion(String direccion) { + this.direccion = direccion; + } + + public String getTelefono() { + return telefono; + } + + public void setTelefono(String telefono) { + this.telefono = telefono; + } + + public String getCiudad() { + return ciudad; + } + + public void setCiudad(String ciudad) { + this.ciudad = ciudad; + } + + public String getRazonSocial() { + return razonSocial; + } + + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + public String getRuc() { + return ruc; + } + + public void setRuc(String ruc) { + this.ruc = ruc; + } + + public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); + } + + public Date getFechaVigencia() { + return fechaVigencia; + } + + public void setFechaVigencia(Date fechaVigencia) { + this.fechaVigencia = fechaVigencia; + } + + public Date getFechaInicioVigencia() { + return fechaInicioVigencia; + } + + public void setFechaInicioVigencia(Date fechaInicioVigencia) { + this.fechaInicioVigencia = fechaInicioVigencia; + } + + public String getAliasCertificado() { + return aliasCertificado; + } + + public void setAliasCertificado(String aliasCertificado) { + this.aliasCertificado = aliasCertificado; + } + +} diff --git a/appletFirma/src/main/java/com/fp/firma/dto/TfirmDatosFirmante.java b/appletFirma/src/main/java/com/fp/firma/dto/TfirmDatosFirmante.java new file mode 100755 index 0000000..39b5ea0 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/dto/TfirmDatosFirmante.java @@ -0,0 +1,169 @@ +package com.fp.firma.dto; + +import java.io.Serializable; +import java.util.Date; + +/** + * Clase que contiene los datos del usuario que es dueno de la firma y en la cual + * + * @author dcruz + * + */ +public class TfirmDatosFirmante implements + Serializable, Cloneable { + + private static final long serialVersionUID = 4232773513442100177L; + private String aliasCertificado; + private String identificacion; + private String nombre; + private String apellido1; + private String apellido2; + private String cargo; + private String institucion; + private String direccion; + private String telefono; + private String ciudad; + private String razonSocial; + private String ruc; + private Date fechaInicioVigencia; + private Date fechaVigencia; + + public TfirmDatosFirmante(){} + + public TfirmDatosFirmante(String identificacion, String nombre, + String apellido1, String apellido2, String cargo, + String institucion, String direccion, String telefono, + String ciudad, String razonSocial, String ruc) { + super(); + this.identificacion = identificacion; + this.nombre = nombre; + this.apellido1 = apellido1; + this.apellido2 = apellido2; + this.cargo = cargo; + this.institucion = institucion; + this.direccion = direccion; + this.telefono = telefono; + this.ciudad = ciudad; + this.razonSocial = razonSocial; + this.ruc = ruc; + } + + + + public String getIdentificacion() { + return identificacion; + } + + public void setIdentificacion(String identificacion) { + this.identificacion = identificacion; + } + + public String getNombre() { + return nombre; + } + + public void setNombre(String nombre) { + this.nombre = nombre; + } + + public String getApellido1() { + return apellido1; + } + + public void setApellido1(String apellido1) { + this.apellido1 = apellido1; + } + + public String getApellido2() { + return apellido2; + } + + public void setApellido2(String apellido2) { + this.apellido2 = apellido2; + } + + public String getCargo() { + return cargo; + } + + public void setCargo(String cargo) { + this.cargo = cargo; + } + + public String getInstitucion() { + return institucion; + } + + public void setInstitucion(String institucion) { + this.institucion = institucion; + } + + public String getDireccion() { + return direccion; + } + + public void setDireccion(String direccion) { + this.direccion = direccion; + } + + public String getTelefono() { + return telefono; + } + + public void setTelefono(String telefono) { + this.telefono = telefono; + } + + public String getCiudad() { + return ciudad; + } + + public void setCiudad(String ciudad) { + this.ciudad = ciudad; + } + + public String getRazonSocial() { + return razonSocial; + } + + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + public String getRuc() { + return ruc; + } + + public void setRuc(String ruc) { + this.ruc = ruc; + } + + public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); + } + + public Date getFechaVigencia() { + return fechaVigencia; + } + + public void setFechaVigencia(Date fechaVigencia) { + this.fechaVigencia = fechaVigencia; + } + + public Date getFechaInicioVigencia() { + return fechaInicioVigencia; + } + + public void setFechaInicioVigencia(Date fechaInicioVigencia) { + this.fechaInicioVigencia = fechaInicioVigencia; + } + + public String getAliasCertificado() { + return aliasCertificado; + } + + public void setAliasCertificado(String aliasCertificado) { + this.aliasCertificado = aliasCertificado; + } + +} diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/entries b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/entries new file mode 100644 index 0000000..38c0ed9 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/entries @@ -0,0 +1,470 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/appletFirma/src/main/java/com/fp/firma/keystore +svn://172.17.26.185/COMACO + + + +2014-12-31T05:22:02.287651Z +3703 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +WindowsJDK5KeyStoreProvider_SD.java +file + + + + +2022-07-28T03:40:23.800721Z +4355360f5ecffb2d4776d5895e69d2ef +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +5923 + +FileKeyStoreProvider.java +file + + + + +2022-07-28T03:40:23.801721Z +352ad7236593816e5385e65d46a8b0f2 +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1478 + +KeyStoreProvider.java +file + + + + +2022-07-28T03:40:23.801721Z +a0f54011dfb2d1e7f45d631fc88fd1b5 +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +712 + +LinuxKeyStoreProvider.java +file + + + + +2022-07-28T03:40:23.801721Z +cd842f1fbfeb4276644783b68fc000f2 +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +4707 + +AppleKeyStoreProvider.java +file + + + + +2022-07-28T03:40:23.802721Z +9cb997093c0456d0e27e53487b3089ed +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1435 + +PKCS11KeyStoreProvider.java +file + + + + +2022-07-28T03:40:23.802721Z +9d48dfb6533b29e3de2b09e3558a4102 +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +2747 + +SimpleCallbackHandler.java +file + + + + +2022-07-28T03:40:23.802721Z +f61edcced631f06f1e348a9e69df41a2 +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1136 + +KeyStoreProviderFactory.java +file + + + + +2022-07-28T03:40:23.803721Z +6592e7f0cf2ac2b4c84453799ff34a3a +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1209 + +WindowsJDK5KeyStoreProvider.java +file + + + + +2022-07-28T03:40:23.803721Z +7bf432721d15fd670c94fb663f37d404 +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +5464 + +MockKeyStoreProvider.java +file + + + + +2022-07-28T03:40:23.804721Z +b634940536517cc8b206d61696baaeeb +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1696 + +WindowsJDK5KeyStoreProvider_iKey.java +file + + + + +2022-07-28T03:40:23.804721Z +08c26de2f28d4b0ec66430d288a760cc +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +5977 + +WindowsJDK6KeyStoreProvider.java +file + + + + +2022-07-28T03:40:23.804721Z +17872a0f5c62ffaa84c62af09d9a9da2 +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1650 + +WindowsKeyStoreProvider.java +file + + + + +2022-07-28T03:40:23.805721Z +32b9f0efba427dd9cb235cbb97baa6e2 +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1367 + diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/AppleKeyStoreProvider.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/AppleKeyStoreProvider.java.svn-base new file mode 100644 index 0000000..085986a --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/AppleKeyStoreProvider.java.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/FileKeyStoreProvider.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/FileKeyStoreProvider.java.svn-base new file mode 100644 index 0000000..085986a --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/FileKeyStoreProvider.java.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/KeyStoreProvider.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/KeyStoreProvider.java.svn-base new file mode 100644 index 0000000..085986a --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/KeyStoreProvider.java.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/KeyStoreProviderFactory.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/KeyStoreProviderFactory.java.svn-base new file mode 100644 index 0000000..085986a --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/KeyStoreProviderFactory.java.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/LinuxKeyStoreProvider.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/LinuxKeyStoreProvider.java.svn-base new file mode 100644 index 0000000..085986a --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/LinuxKeyStoreProvider.java.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/MockKeyStoreProvider.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/MockKeyStoreProvider.java.svn-base new file mode 100644 index 0000000..085986a --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/MockKeyStoreProvider.java.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/PKCS11KeyStoreProvider.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/PKCS11KeyStoreProvider.java.svn-base new file mode 100644 index 0000000..085986a --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/PKCS11KeyStoreProvider.java.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/SimpleCallbackHandler.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/SimpleCallbackHandler.java.svn-base new file mode 100644 index 0000000..085986a --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/SimpleCallbackHandler.java.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/WindowsJDK5KeyStoreProvider.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/WindowsJDK5KeyStoreProvider.java.svn-base new file mode 100644 index 0000000..085986a --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/WindowsJDK5KeyStoreProvider.java.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/WindowsJDK5KeyStoreProvider_SD.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/WindowsJDK5KeyStoreProvider_SD.java.svn-base new file mode 100644 index 0000000..085986a --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/WindowsJDK5KeyStoreProvider_SD.java.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/WindowsJDK5KeyStoreProvider_iKey.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/WindowsJDK5KeyStoreProvider_iKey.java.svn-base new file mode 100644 index 0000000..085986a --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/WindowsJDK5KeyStoreProvider_iKey.java.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/WindowsJDK6KeyStoreProvider.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/WindowsJDK6KeyStoreProvider.java.svn-base new file mode 100644 index 0000000..085986a --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/WindowsJDK6KeyStoreProvider.java.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/WindowsKeyStoreProvider.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/WindowsKeyStoreProvider.java.svn-base new file mode 100644 index 0000000..085986a --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/prop-base/WindowsKeyStoreProvider.java.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/AppleKeyStoreProvider.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/AppleKeyStoreProvider.java.svn-base new file mode 100644 index 0000000..ee50daa --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/AppleKeyStoreProvider.java.svn-base @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2009 Libreria para Firma Digital development team. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +package com.fp.firma.keystore; + +import java.io.IOException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.NoSuchProviderException; +import java.security.cert.CertificateException; + +/** + * Implementacion de KeyStoreProvider para el + * sistema operativo Mac OS X. + * + */ +public class AppleKeyStoreProvider implements KeyStoreProvider { + + private static final String APPLE_PROVIDER_TYPE = "KeychainStore"; + private static final String APPLE_PROVIDER_NAME = "Apple"; + + @Override + public KeyStore getKeystore(char[] password) throws KeyStoreException { + try { + KeyStore keyStore = KeyStore.getInstance(APPLE_PROVIDER_TYPE, APPLE_PROVIDER_NAME); + keyStore.load(null, null); + return keyStore; + } catch (NoSuchProviderException e) { + throw new KeyStoreException(e); + } catch (NoSuchAlgorithmException e) { + throw new KeyStoreException(e); + } catch (CertificateException e) { + throw new KeyStoreException(e); + } catch (IOException e) { + throw new KeyStoreException(e); + } + } +} \ No newline at end of file diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/FileKeyStoreProvider.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/FileKeyStoreProvider.java.svn-base new file mode 100644 index 0000000..7f87eec --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/FileKeyStoreProvider.java.svn-base @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2009 Libreria para Firma Digital development team. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +package com.fp.firma.keystore; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; + +/** + * Implementación de KeyStoreProvider para leer de un archivo. + * + */ +public class FileKeyStoreProvider implements KeyStoreProvider { + + @Override + public KeyStore getKeystore(char[] password) throws KeyStoreException { + try { + InputStream input = new FileInputStream(System.getProperty("user.home") + File.separator + ".keystore"); + + KeyStore keyStore = KeyStore.getInstance("jks"); + keyStore.load(input, password); + return keyStore; + } catch (FileNotFoundException e) { + throw new KeyStoreException(e); + } catch (NoSuchAlgorithmException e) { + throw new KeyStoreException(e); + } catch (CertificateException e) { + throw new KeyStoreException(e); + } catch (IOException e) { + throw new KeyStoreException(e); + } finally { + // TODO: Close InputStream + } + } +} \ No newline at end of file diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/KeyStoreProvider.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/KeyStoreProvider.java.svn-base new file mode 100644 index 0000000..b71f43e --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/KeyStoreProvider.java.svn-base @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2009 Libreria para Firma Digital development team. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +package com.fp.firma.keystore; + +import java.security.KeyStore; +import java.security.KeyStoreException; + +/** + * Obtiene un KeyStore. + * + */ +public interface KeyStoreProvider { + + /** + * Obtiene un KeyStore protegido por un password. + * + * @param password + * @return + * @throws KeyStoreException + */ + KeyStore getKeystore(char[] password) throws KeyStoreException; +} \ No newline at end of file diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/KeyStoreProviderFactory.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/KeyStoreProviderFactory.java.svn-base new file mode 100644 index 0000000..032dce4 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/KeyStoreProviderFactory.java.svn-base @@ -0,0 +1,40 @@ +package com.fp.firma.keystore; + +import java.util.logging.Logger; + +/** + * Obtiene la implementacion correcta de KeyStoreProvider de acuerdo al sistema + * operativo. + */ +public class KeyStoreProviderFactory { + + private static final Logger log = Logger.getLogger(KeyStoreProviderFactory.class.getName()); + + /** + * Obtiene la implementacion correcta de KeyStoreProvider de acuerdo al + * sistema operativo. + * + * @return implementacion de KeyStoreProvider + */ + public static KeyStoreProvider createKeyStoreProvider() { + String osName = System.getProperty("os.name"); + String javaVersion = System.getProperty("java.version"); + + log.finer("Operating System:" + osName); + log.finer("Java Version:" + javaVersion); + + if (osName.toUpperCase().indexOf("WINDOWS") == 0) { + if (javaVersion.indexOf("1.6") == 0) { + return new WindowsJDK6KeyStoreProvider(); + } else { + return new WindowsJDK5KeyStoreProvider(); + } + } else if (osName.toUpperCase().indexOf("LINUX") == 0) { + return new LinuxKeyStoreProvider(); + } else if (osName.toUpperCase().indexOf("MAC") == 0) { + return new AppleKeyStoreProvider(); + } else { + throw new IllegalArgumentException("Sistema operativo no soportado!"); + } + } +} \ No newline at end of file diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/LinuxKeyStoreProvider.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/LinuxKeyStoreProvider.java.svn-base new file mode 100644 index 0000000..ed1155e --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/LinuxKeyStoreProvider.java.svn-base @@ -0,0 +1,123 @@ +/* + * Copyright (C) 2009 Libreria para Firma Digital development team. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +package com.fp.firma.keystore; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.security.AuthProvider; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.Provider; +import java.security.Security; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.security.auth.login.LoginException; + +/** + * Implementacion de KeyStoreProvider para utilizar con librerias + * PKCS#11 del sistema operativo Linux. + * + * Utiza OpenCT para acceder a un Token USB. + * + * + */ +public class LinuxKeyStoreProvider implements KeyStoreProvider { + + //MAC: /usr/local/lib/libsfntpkcs11.dylib\nslot = 1 + private static final byte[] PKCS11_CONFIG = "name = SmartCard\nlibrary = /usr/local/SafeNet/lib/libsfntpkcs11.so\nslot = 1 \n showInfo = true".getBytes(); // /usr/local/SafeNet/lib/libsfntpkcs11.so\nslot = 1 + ///usr/local/lib/libsfntpkcs11.dylib + private static final String SUN_PKCS11_PROVIDER_CLASS = "sun.security.pkcs11.SunPKCS11"; + private AuthProvider aprov; + @Override + public KeyStore getKeystore(char[] password) throws KeyStoreException { + try { + InputStream configStream = new ByteArrayInputStream(PKCS11_CONFIG); + + Provider sunPKCS11Provider = this.createSunPKCS11Provider(configStream); + Security.addProvider(sunPKCS11Provider); + +// Eestas lineas se añadieron para poder hacer un logout del keystore +// + + KeyStore.Builder ksBuilder = KeyStore.Builder.newInstance( + "PKCS11", + null, + new KeyStore.CallbackHandlerProtection( new SimpleCallbackHandler(null,password ) )); //cmdLineHdlr + + KeyStore ks = ksBuilder.getKeyStore(); +// + + aprov = (AuthProvider) Security.getProvider( sunPKCS11Provider.getName() ); + aprov.setCallbackHandler( new SimpleCallbackHandler(null,password ) ); //cmdLineHdlr + + try { + aprov.login(null, null); + } catch (LoginException ex) { + Logger.getLogger(LinuxKeyStoreProvider.class.getName()).log(Level.SEVERE, null, ex); + throw new LoginException( /*ex*/ ); + } + +// KeyStore keyStore = KeyStore.getInstance("PKCS11"); +// +// keyStore.load(null, password); //null + System.out.println("Dentro LinuxKeystore anntes de ks:" + ks); + // aprov.logout(); + return ks; //keyStore +// } catch (CertificateException e) { +// throw new KeyStoreException(e); +// } catch (NoSuchAlgorithmException e) { +// throw new KeyStoreException(e); +// } catch (IOException e) { +// throw new KeyStoreException(e); +// } + } catch (Exception e){ + System.out.println("Error en el keystore:" + e); + e.printStackTrace(); + throw new KeyStoreException(e); + } + } + /** + * logout + * Esta función permite limpiar de memoria el keystore. + * @throws javax.security.auth.login.LoginException + */ + public void logout() throws LoginException{ + + this.aprov.logout(); + } + /** + * Instancia la clase sun.security.pkcs11.SunPKCS11 + * dinamicamente, usando Java Reflection. + * + * @return una instancia de sun.security.pkcs11.SunPKCS11 + */ + @SuppressWarnings("unchecked") + private Provider createSunPKCS11Provider(InputStream configStream) throws KeyStoreException { + try { + Class sunPkcs11Class = Class.forName(SUN_PKCS11_PROVIDER_CLASS); + Constructor pkcs11Constr = sunPkcs11Class.getConstructor(InputStream.class); + Provider pkcs11Provider = (Provider) pkcs11Constr.newInstance(configStream); + + return pkcs11Provider; + } catch (ClassNotFoundException e) { + throw new KeyStoreException(e); + } catch (NoSuchMethodException e) { + throw new KeyStoreException(e); + } catch (InvocationTargetException e) { + throw new KeyStoreException(e); + } catch (IllegalAccessException e) { + throw new KeyStoreException(e); + } catch (InstantiationException e) { + throw new KeyStoreException(e); + } + } +} diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/MockKeyStoreProvider.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/MockKeyStoreProvider.java.svn-base new file mode 100644 index 0000000..4781c35 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/MockKeyStoreProvider.java.svn-base @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2009 Libreria para Firma Digital development team. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +package com.fp.firma.keystore; + +import java.io.BufferedInputStream; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.KeyStoreException; + +/** + * Implementacion de KeyStoreProvider para pruebas. + * + */ +public class MockKeyStoreProvider implements KeyStoreProvider { + + private static final String KEYSTORE_FILE = "/home/ricardo/ricardostore"; + + // private static final String KEYSTORE_ALIAS = "firmadigital"; + // private static final char[] KEYSTORE_PASSWORD = "abc123".toCharArray(); + // private static final char[] KEY_PASSWORD = "ricardo".toCharArray(); + + @Override + public KeyStore getKeystore(char[] password) throws KeyStoreException { + try { + KeyStore keyStore = KeyStore.getInstance("JKS"); + FileInputStream ksfis; + ksfis = new FileInputStream(KEYSTORE_FILE); + BufferedInputStream ksbufin = new BufferedInputStream(ksfis); + + keyStore.load(ksbufin, password); + // PrivateKey priv = (PrivateKey) keyStore.getKey(KEYSTORE_ALIAS, + // KEY_PASSWORD); + + return keyStore; + } catch (FileNotFoundException e) { + throw new KeyStoreException(e); + } catch (GeneralSecurityException e) { + throw new KeyStoreException(e); + } catch (IOException e) { + throw new KeyStoreException(e); + } + } +} \ No newline at end of file diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/PKCS11KeyStoreProvider.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/PKCS11KeyStoreProvider.java.svn-base new file mode 100644 index 0000000..6d17b14 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/PKCS11KeyStoreProvider.java.svn-base @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2009 Libreria para Firma Digital development team. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +package com.fp.firma.keystore; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.Provider; +import java.security.Security; +import java.security.cert.CertificateException; + + +/** + * Implementacion de KeyStoreProvider para utilizar con librerias + * PKCS#11 del sistema operativo. + * + * Utiza OpenCT para acceder a un Token USB. + * + * + */ +public abstract class PKCS11KeyStoreProvider implements KeyStoreProvider { + + /** + * Obtiene la configuración para el Provider, según el sistema operativo que se utilice. + * + * @return + */ + public abstract String getConfig(); + + public KeyStore getKeystore(char[] password) throws KeyStoreException { + try { + InputStream configStream = new ByteArrayInputStream(getConfig().getBytes()); + + Provider sunPKCS11Provider = this.createSunPKCS11Provider(configStream); + Security.addProvider(sunPKCS11Provider); + + KeyStore keyStore = KeyStore.getInstance("PKCS11"); + keyStore.load(null, password); + + return keyStore; + } catch (CertificateException e) { + throw new KeyStoreException(e); + } catch (NoSuchAlgorithmException e) { + throw new KeyStoreException(e); + } catch (IOException e) { + throw new KeyStoreException(e); + } + } + + /** + * Instancia la clase sun.security.pkcs11.SunPKCS11 + * dinamicamente, usando Java Reflection. + * + * @return una instancia de sun.security.pkcs11.SunPKCS11 + */ + @SuppressWarnings("unchecked") + private Provider createSunPKCS11Provider(InputStream configStream) throws KeyStoreException { + try { + Class sunPkcs11Class = Class.forName("sun.security.pkcs11.SunPKCS11"); + Constructor pkcs11Constr = sunPkcs11Class.getConstructor(InputStream.class); + return (Provider) pkcs11Constr.newInstance(configStream); + } catch (ClassNotFoundException e) { + throw new KeyStoreException(e); + } catch (NoSuchMethodException e) { + throw new KeyStoreException(e); + } catch (InvocationTargetException e) { + throw new KeyStoreException(e); + } catch (IllegalAccessException e) { + throw new KeyStoreException(e); + } catch (InstantiationException e) { + throw new KeyStoreException(e); + } + } +} \ No newline at end of file diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/SimpleCallbackHandler.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/SimpleCallbackHandler.java.svn-base new file mode 100644 index 0000000..55ee16b --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/SimpleCallbackHandler.java.svn-base @@ -0,0 +1,49 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.fp.firma.keystore; + +/** + * + * @author subinfo + */ +import javax.security.auth.callback.*; + +/** + * This simple callback handler presents the given user name and password. + * @version 1.0 2004-09-14 + * @author Cay Horstmann + */ +public class SimpleCallbackHandler implements CallbackHandler +{ + /** + * Constructs the callback handler. + * @param username the user name + * @param password a character array containing the password + */ + public SimpleCallbackHandler(String username, char[] password) + { + this.username = username; + this.password = password; + } + + public void handle(Callback[] callbacks) + { + for (Callback callback : callbacks) + { + if (callback instanceof NameCallback) + { + ((NameCallback) callback).setName(username); + } + else if (callback instanceof PasswordCallback) + { + ((PasswordCallback) callback).setPassword(password); + } + } + } + + private String username; + private char[] password; +} diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/WindowsJDK5KeyStoreProvider.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/WindowsJDK5KeyStoreProvider.java.svn-base new file mode 100644 index 0000000..344e2a8 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/WindowsJDK5KeyStoreProvider.java.svn-base @@ -0,0 +1,129 @@ +/** Programa para La firma electrónica de archivos + * Desarrollado y Modificado por la Subsecretaría de Tecnologías de la Información + * de la Secretaría Nacional de la Administración Pública del Ecuador + * Firma Digital firmadigital.informatica.gob.ec + *------------------------------------------------------------------------------ + * This program is free software: you can redistribute it and/or +modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public +License + * along with this program. If not, see http://www.gnu.org/licenses. [^] + *------------------------------------------------------------------------------ + **/ +package com.fp.firma.keystore; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.security.AuthProvider; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.Provider; +import java.security.ProviderException; +import java.security.Security; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.management.ReflectionException; +import javax.security.auth.login.LoginException; + +/** + * maneja el keystore de windows, no el CAPI, accede a travez de librerias, en esta se usa librerias para eTokenPro + **/ +public class WindowsJDK5KeyStoreProvider implements KeyStoreProvider { + + + //private static final byte[] PKCS11_CONFIG = "name = SmartCard\nlibrary = C:\\WINDOWS\\SYSTEM32\\DKCK201.DLL \ndisabledMechanisms = { CKM_SHA1_RSA_PKCS }".getBytes(); + private static String windowsDir = "name = SmartCard\nlibrary = " + System.getenv("WINDIR") + "\\SYSTEM32\\eTPKCS11.DLL \ndisabledMechanisms = { CKM_SHA1_RSA_PKCS } \n showInfo = true"; //showInfo = true + private static final byte[] PKCS11_CONFIG = windowsDir.getBytes(); + private static final String SUN_PKCS11_PROVIDER_CLASS = "sun.security.pkcs11.SunPKCS11"; + private AuthProvider aprov; + + @Override + public KeyStore getKeystore(char[] password) throws KeyStoreException { + try { + System.out.println("Tiene PKCS11: " + PKCS11_CONFIG); + InputStream configStream = new ByteArrayInputStream(PKCS11_CONFIG); + + Provider sunPKCS11Provider = this.createSunPKCS11Provider(configStream); + Security.addProvider(sunPKCS11Provider); + + KeyStore.Builder ksBuilder = KeyStore.Builder.newInstance( + "PKCS11", + null, + new KeyStore.CallbackHandlerProtection(new SimpleCallbackHandler(null, password))); //cmdLineHdlr + + KeyStore ks = ksBuilder.getKeyStore(); + + aprov = (AuthProvider) Security.getProvider(sunPKCS11Provider.getName()); + aprov.setCallbackHandler(new SimpleCallbackHandler(null, password)); //cmdLineHdlr + + aprov.login(null, null); +// + + return ks; //keyStore +// + + } catch (LoginException ex) { + Logger.getLogger(WindowsJDK5KeyStoreProvider.class.getName()).log(Level.SEVERE, null, ex); + System.out.println("error en el loginExcep" + ex); + } catch (KeyStoreException e) { + System.out.println("e:" + e.getCause().toString().length()); + throw new KeyStoreException(e); + } +// catch (Exception e){ +// System.out.println("Error en el keystore:" + e.getCause().toString().length() ); +// throw new KeyStoreException( e.getMessage() ,e.getCause()); +// } + return null; + } + + /** + * logout + * Esta función permite limpiar de memoria el keystore. + * @throws javax.security.auth.login.LoginException + */ + public void logout() throws LoginException { + + this.aprov.logout(); + } + + /** + * Instancia la clase sun.security.pkcs11.SunPKCS11 + * dinamicamente, usando Java Reflection. + * + * @return una instancia de sun.security.pkcs11.SunPKCS11 + */ + @SuppressWarnings("unchecked") + private Provider createSunPKCS11Provider(InputStream configStream) throws ProviderException, KeyStoreException { + try { + Class sunPkcs11Class = Class.forName(SUN_PKCS11_PROVIDER_CLASS); + + Constructor pkcs11Constr = sunPkcs11Class.getConstructor(InputStream.class); + Provider pkcs11Provider = (Provider) pkcs11Constr.newInstance(configStream); + + return pkcs11Provider; + + } catch (ClassNotFoundException e) { + throw new KeyStoreException(e); + } catch (NoSuchMethodException e) { + throw new KeyStoreException(e); + } catch (InvocationTargetException e) { + + throw new KeyStoreException(e.getMessage(), e.getCause()); + } catch (IllegalAccessException e) { + throw new KeyStoreException(e); + } catch (InstantiationException e) { + throw new KeyStoreException(e); + } + } +} diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/WindowsJDK5KeyStoreProvider_SD.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/WindowsJDK5KeyStoreProvider_SD.java.svn-base new file mode 100644 index 0000000..6333abf --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/WindowsJDK5KeyStoreProvider_SD.java.svn-base @@ -0,0 +1,139 @@ +/** Programa para La firma electrónica de archivos +* Desarrollado y Modificado por la Subsecretaría de Tecnologías de la Información +* de la Secretaría Nacional de la Administración Pública del Ecuador +* Firma Digital firmadigital.informatica.gob.ec +*------------------------------------------------------------------------------ +* This program is free software: you can redistribute it and/or +modify +* it under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation, either version 3 of the +* License, or (at your option) any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public +License +* along with this program. If not, see http://www.gnu.org/licenses. [^] +*------------------------------------------------------------------------------ +**/ +package com.fp.firma.keystore; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.security.AuthProvider; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.Provider; +import java.security.Security; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.security.auth.login.LoginException; + +/** + * Esta clase se usa para obtener el keystore (Con el se pueden obtener luego los certificados dentro del token) en Windows + */ +public class WindowsJDK5KeyStoreProvider_SD implements KeyStoreProvider { + + //private static final byte[] PKCS11_CONFIG = "name = SmartCard\nlibrary = C:\\WINDOWS\\SYSTEM32\\DKCK201.DLL \ndisabledMechanisms = { CKM_SHA1_RSA_PKCS }".getBytes(); + // esta linea corrige el error de la ubicación de Windows + // para trabajar con iKey + private static final String windowsDir_SD = "name = ePass3003\nlibrary = C:\\WINDOWS\\SYSTEM32\\SecurityDataCsp11_3003.dll \ndisabledMechanisms = { CKM_SHA1_RSA_PKCS } \n\r showInfo = true"; + private static final byte[] PKCS11_CONFIG_SD = windowsDir_SD.getBytes(); + private static final String SUN_PKCS11_PROVIDER_CLASS = "sun.security.pkcs11.SunPKCS11"; + private AuthProvider aprov; + + /** + * getKeystore + * Esta funcion se utiliza para obtener el keystore de java para manejar luego la clave privada y los certificados dentro del token + * @param password Se pasa la clave del token + * @return + * @throws java.security.KeyStoreException + */ + @Override + public KeyStore getKeystore(char[] password) throws KeyStoreException { + try { + // empieza intentando con eToken + InputStream configStream = new ByteArrayInputStream(PKCS11_CONFIG_SD); + + Provider sunPKCS11Provider = this.createSunPKCS11Provider(configStream); + Security.addProvider(sunPKCS11Provider); + + + KeyStore.Builder ksBuilder = KeyStore.Builder.newInstance( + "PKCS11", + null, + new KeyStore.CallbackHandlerProtection(new SimpleCallbackHandler(null, password))); //cmdLineHdlr + + KeyStore ks = ksBuilder.getKeyStore(); + + // Estas lineas se añadieron para controlar mejor el logout del token + aprov = (AuthProvider) Security.getProvider(sunPKCS11Provider.getName()); + aprov.setCallbackHandler(new SimpleCallbackHandler(null, password)); //cmdLineHdlr + + try { + aprov.login(null, null); + } catch (LoginException ex) { + Logger.getLogger(WindowsJDK5KeyStoreProvider_SD.class.getName()).log(Level.SEVERE, null, ex); + throw new LoginException( /*ex*/); + } + + + + + return ks; //keyStore + } catch (LoginException ex) { + Logger.getLogger(WindowsJDK5KeyStoreProvider_SD.class.getName()).log(Level.SEVERE, null, ex); + System.out.println("error en el loginExcep" + ex); + } catch (KeyStoreException e) { + System.out.println("e:" + e.getCause().toString().length()); + throw new KeyStoreException(e); + } + +// } catch (Exception e){ +// System.out.println("Error en el keystore:" + e); +// throw new KeyStoreException(e); +// } + return null; + } + + /** + * logout + * Esta función permite limpiar de memoria el keystore. + * @throws javax.security.auth.login.LoginException + */ + public void logout() throws LoginException { + + this.aprov.logout(); + } + + /** + * Instancia la clase sun.security.pkcs11.SunPKCS11 + * dinamicamente, usando Java Reflection. + * + * @return una instancia de sun.security.pkcs11.SunPKCS11 + */ + @SuppressWarnings("unchecked") + private Provider createSunPKCS11Provider(InputStream configStream) throws KeyStoreException { + try { + Class sunPkcs11Class = Class.forName(SUN_PKCS11_PROVIDER_CLASS); + Constructor pkcs11Constr = sunPkcs11Class.getConstructor(InputStream.class); + Provider pkcs11Provider = (Provider) pkcs11Constr.newInstance(configStream); + + return pkcs11Provider; + } catch (ClassNotFoundException e) { + throw new KeyStoreException(e); + } catch (NoSuchMethodException e) { + throw new KeyStoreException(e); + } catch (InvocationTargetException e) { + throw new KeyStoreException(e); + } catch (IllegalAccessException e) { + throw new KeyStoreException(e); + } catch (InstantiationException e) { + throw new KeyStoreException(e); + } + } +} \ No newline at end of file diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/WindowsJDK5KeyStoreProvider_iKey.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/WindowsJDK5KeyStoreProvider_iKey.java.svn-base new file mode 100644 index 0000000..fcf686f --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/WindowsJDK5KeyStoreProvider_iKey.java.svn-base @@ -0,0 +1,144 @@ +/** Programa para La firma electrónica de archivos +* Desarrollado y Modificado por la Subsecretaría de Tecnologías de la Información +* de la Secretaría Nacional de la Administración Pública del Ecuador +* Firma Digital firmadigital.informatica.gob.ec +*------------------------------------------------------------------------------ +* This program is free software: you can redistribute it and/or +modify +* it under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation, either version 3 of the +* License, or (at your option) any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public +License +* along with this program. If not, see http://www.gnu.org/licenses. [^] +*------------------------------------------------------------------------------ +**/ + + +package com.fp.firma.keystore; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.security.AuthProvider; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.Provider; +import java.security.Security; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.security.auth.login.LoginException; + +/** + * Esta clase se usa para obtener el keystore (Con el se pueden obtener luego los certificados dentro del token iKEY) en Windows + */ +public class WindowsJDK5KeyStoreProvider_iKey implements KeyStoreProvider { + + + + //private static final byte[] PKCS11_CONFIG = "name = SmartCard\nlibrary = C:\\WINDOWS\\SYSTEM32\\DKCK201.DLL \ndisabledMechanisms = { CKM_SHA1_RSA_PKCS }".getBytes(); + // esta linea corrige el error de la ubicación de Windows + // para trabajar con iKey + private static String windowsDir_iKey ="name = SmartCard\nlibrary = "+ System.getenv("WINDIR") + "\\SYSTEM32\\DKCK201.DLL \ndisabledMechanisms = { CKM_SHA1_RSA_PKCS } \n showInfo = true"; + private static final byte[] PKCS11_CONFIG_IKEY = windowsDir_iKey.getBytes(); + + + private static final String SUN_PKCS11_PROVIDER_CLASS = "sun.security.pkcs11.SunPKCS11"; + private AuthProvider aprov; + + /** + * getKeystore + * Esta funcion se utiliza para obtener el keystore de java para manejar luego la clave privada y los certificados dentro del token + * @param password Se pasa la clave del token + * @return + * @throws java.security.KeyStoreException + */ + @Override + public KeyStore getKeystore(char[] password) throws KeyStoreException { + try { + // empieza intentando con eToken + InputStream configStream = new ByteArrayInputStream(PKCS11_CONFIG_IKEY); + + Provider sunPKCS11Provider = this.createSunPKCS11Provider(configStream); + Security.addProvider(sunPKCS11Provider); + + + KeyStore.Builder ksBuilder = KeyStore.Builder.newInstance( + "PKCS11", + null, + new KeyStore.CallbackHandlerProtection( new SimpleCallbackHandler(null,password ) )); //cmdLineHdlr + + KeyStore ks = ksBuilder.getKeyStore(); + + // Estas lineas se añadieron para controlar mejor el logout del token + aprov = (AuthProvider) Security.getProvider( sunPKCS11Provider.getName() ); + aprov.setCallbackHandler( new SimpleCallbackHandler(null,password ) ); //cmdLineHdlr + + try { + aprov.login(null, null); + } catch (LoginException ex) { + Logger.getLogger(WindowsJDK5KeyStoreProvider_iKey.class.getName()).log(Level.SEVERE, null, ex); + throw new LoginException( /*ex*/ ); + } + + + + + return ks; //keyStore + } + catch (LoginException ex) { + Logger.getLogger(WindowsJDK5KeyStoreProvider_iKey.class.getName()).log(Level.SEVERE, null, ex); + System.out.println("error en el loginExcep" + ex); + } catch (KeyStoreException e) { + System.out.println("e:"+ e.getCause().toString().length() ); + throw new KeyStoreException(e); + } + +// } catch (Exception e){ +// System.out.println("Error en el keystore:" + e); +// throw new KeyStoreException(e); +// } + return null; + } + /** + * logout + * Esta función permite limpiar de memoria el keystore. + * @throws javax.security.auth.login.LoginException + */ + public void logout() throws LoginException{ + + this.aprov.logout(); + } + /** + * Instancia la clase sun.security.pkcs11.SunPKCS11 + * dinamicamente, usando Java Reflection. + * + * @return una instancia de sun.security.pkcs11.SunPKCS11 + */ + @SuppressWarnings("unchecked") + private Provider createSunPKCS11Provider(InputStream configStream) throws KeyStoreException { + try { + Class sunPkcs11Class = Class.forName(SUN_PKCS11_PROVIDER_CLASS); + Constructor pkcs11Constr = sunPkcs11Class.getConstructor(InputStream.class); + Provider pkcs11Provider = (Provider) pkcs11Constr.newInstance(configStream); + + return pkcs11Provider; + } catch (ClassNotFoundException e) { + throw new KeyStoreException(e); + } catch (NoSuchMethodException e) { + throw new KeyStoreException(e); + } catch (InvocationTargetException e) { + throw new KeyStoreException(e); + } catch (IllegalAccessException e) { + throw new KeyStoreException(e); + } catch (InstantiationException e) { + throw new KeyStoreException(e); + } + } +} \ No newline at end of file diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/WindowsJDK6KeyStoreProvider.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/WindowsJDK6KeyStoreProvider.java.svn-base new file mode 100644 index 0000000..5dfb66f --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/WindowsJDK6KeyStoreProvider.java.svn-base @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2009 Libreria para Firma Digital development team. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +package com.fp.firma.keystore; + +import java.io.IOException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateException; + +import com.fp.firma.common.FirmasException; + +/** + * Implementación de KeyStoreProvider para acceder al keystore del sistema operativo + * Microsoft Windows. + * + * Utiliza funcionalidad disponible desde el JDK6 en adelante para acceder al MS CAPI. + * + */ +public class WindowsJDK6KeyStoreProvider implements KeyStoreProvider { + + public KeyStore getKeystore(char[] password) throws KeyStoreException { + try { + KeyStore keyStore = KeyStore.getInstance("Windows-MY"); + keyStore.load(null, password); + return keyStore; + } catch (NoSuchAlgorithmException e) { + throw new KeyStoreException(e); + } catch (CertificateException e) { + throw new KeyStoreException(e); + } catch (IOException e) { + if(e.getCause() instanceof UnrecoverableKeyException){ + throw new FirmasException(e); + } else{ + throw new KeyStoreException(e); + } + } catch (Throwable e) { + if ((e instanceof UnrecoverableKeyException)) { + throw new FirmasException(e); + } else{ + throw new KeyStoreException(e); + } + } + } +} \ No newline at end of file diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/WindowsKeyStoreProvider.java.svn-base b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/WindowsKeyStoreProvider.java.svn-base new file mode 100644 index 0000000..a704f9f --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/.svn/text-base/WindowsKeyStoreProvider.java.svn-base @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2009 Libreria para Firma Digital development team. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +package com.fp.firma.keystore; + +import java.io.IOException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; + +/** + * Implementacion de KeyStoreProvider para acceder al keystore del sistema operativo + * Microsoft Windows. + * + * Utiliza funcionalidad disponible desde el JDK6 en adelante para acceder al MS CAPI. + * + */ +public class WindowsKeyStoreProvider implements KeyStoreProvider { + + private static final String MICROSOFT_WINDOWS_PROVIDER_TYPE = "Windows-MY"; + + @Override + public KeyStore getKeystore(char[] password) throws KeyStoreException { + try { + KeyStore keyStore = KeyStore.getInstance(MICROSOFT_WINDOWS_PROVIDER_TYPE); + keyStore.load(null, password); + return keyStore; + } catch (NoSuchAlgorithmException e) { + throw new KeyStoreException(e); + } catch (CertificateException e) { + throw new KeyStoreException(e); + } catch (IOException e) { + throw new KeyStoreException(e); + } + } +} \ No newline at end of file diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/AppleKeyStoreProvider.java b/appletFirma/src/main/java/com/fp/firma/keystore/AppleKeyStoreProvider.java new file mode 100755 index 0000000..ee50daa --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/AppleKeyStoreProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2009 Libreria para Firma Digital development team. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +package com.fp.firma.keystore; + +import java.io.IOException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.NoSuchProviderException; +import java.security.cert.CertificateException; + +/** + * Implementacion de KeyStoreProvider para el + * sistema operativo Mac OS X. + * + */ +public class AppleKeyStoreProvider implements KeyStoreProvider { + + private static final String APPLE_PROVIDER_TYPE = "KeychainStore"; + private static final String APPLE_PROVIDER_NAME = "Apple"; + + @Override + public KeyStore getKeystore(char[] password) throws KeyStoreException { + try { + KeyStore keyStore = KeyStore.getInstance(APPLE_PROVIDER_TYPE, APPLE_PROVIDER_NAME); + keyStore.load(null, null); + return keyStore; + } catch (NoSuchProviderException e) { + throw new KeyStoreException(e); + } catch (NoSuchAlgorithmException e) { + throw new KeyStoreException(e); + } catch (CertificateException e) { + throw new KeyStoreException(e); + } catch (IOException e) { + throw new KeyStoreException(e); + } + } +} \ No newline at end of file diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/FileKeyStoreProvider.java b/appletFirma/src/main/java/com/fp/firma/keystore/FileKeyStoreProvider.java new file mode 100755 index 0000000..7f87eec --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/FileKeyStoreProvider.java @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2009 Libreria para Firma Digital development team. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +package com.fp.firma.keystore; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; + +/** + * Implementación de KeyStoreProvider para leer de un archivo. + * + */ +public class FileKeyStoreProvider implements KeyStoreProvider { + + @Override + public KeyStore getKeystore(char[] password) throws KeyStoreException { + try { + InputStream input = new FileInputStream(System.getProperty("user.home") + File.separator + ".keystore"); + + KeyStore keyStore = KeyStore.getInstance("jks"); + keyStore.load(input, password); + return keyStore; + } catch (FileNotFoundException e) { + throw new KeyStoreException(e); + } catch (NoSuchAlgorithmException e) { + throw new KeyStoreException(e); + } catch (CertificateException e) { + throw new KeyStoreException(e); + } catch (IOException e) { + throw new KeyStoreException(e); + } finally { + // TODO: Close InputStream + } + } +} \ No newline at end of file diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/KeyStoreProvider.java b/appletFirma/src/main/java/com/fp/firma/keystore/KeyStoreProvider.java new file mode 100755 index 0000000..b71f43e --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/KeyStoreProvider.java @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2009 Libreria para Firma Digital development team. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +package com.fp.firma.keystore; + +import java.security.KeyStore; +import java.security.KeyStoreException; + +/** + * Obtiene un KeyStore. + * + */ +public interface KeyStoreProvider { + + /** + * Obtiene un KeyStore protegido por un password. + * + * @param password + * @return + * @throws KeyStoreException + */ + KeyStore getKeystore(char[] password) throws KeyStoreException; +} \ No newline at end of file diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/KeyStoreProviderFactory.java b/appletFirma/src/main/java/com/fp/firma/keystore/KeyStoreProviderFactory.java new file mode 100755 index 0000000..032dce4 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/KeyStoreProviderFactory.java @@ -0,0 +1,40 @@ +package com.fp.firma.keystore; + +import java.util.logging.Logger; + +/** + * Obtiene la implementacion correcta de KeyStoreProvider de acuerdo al sistema + * operativo. + */ +public class KeyStoreProviderFactory { + + private static final Logger log = Logger.getLogger(KeyStoreProviderFactory.class.getName()); + + /** + * Obtiene la implementacion correcta de KeyStoreProvider de acuerdo al + * sistema operativo. + * + * @return implementacion de KeyStoreProvider + */ + public static KeyStoreProvider createKeyStoreProvider() { + String osName = System.getProperty("os.name"); + String javaVersion = System.getProperty("java.version"); + + log.finer("Operating System:" + osName); + log.finer("Java Version:" + javaVersion); + + if (osName.toUpperCase().indexOf("WINDOWS") == 0) { + if (javaVersion.indexOf("1.6") == 0) { + return new WindowsJDK6KeyStoreProvider(); + } else { + return new WindowsJDK5KeyStoreProvider(); + } + } else if (osName.toUpperCase().indexOf("LINUX") == 0) { + return new LinuxKeyStoreProvider(); + } else if (osName.toUpperCase().indexOf("MAC") == 0) { + return new AppleKeyStoreProvider(); + } else { + throw new IllegalArgumentException("Sistema operativo no soportado!"); + } + } +} \ No newline at end of file diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/LinuxKeyStoreProvider.java b/appletFirma/src/main/java/com/fp/firma/keystore/LinuxKeyStoreProvider.java new file mode 100755 index 0000000..ed1155e --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/LinuxKeyStoreProvider.java @@ -0,0 +1,123 @@ +/* + * Copyright (C) 2009 Libreria para Firma Digital development team. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +package com.fp.firma.keystore; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.security.AuthProvider; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.Provider; +import java.security.Security; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.security.auth.login.LoginException; + +/** + * Implementacion de KeyStoreProvider para utilizar con librerias + * PKCS#11 del sistema operativo Linux. + * + * Utiza OpenCT para acceder a un Token USB. + * + * + */ +public class LinuxKeyStoreProvider implements KeyStoreProvider { + + //MAC: /usr/local/lib/libsfntpkcs11.dylib\nslot = 1 + private static final byte[] PKCS11_CONFIG = "name = SmartCard\nlibrary = /usr/local/SafeNet/lib/libsfntpkcs11.so\nslot = 1 \n showInfo = true".getBytes(); // /usr/local/SafeNet/lib/libsfntpkcs11.so\nslot = 1 + ///usr/local/lib/libsfntpkcs11.dylib + private static final String SUN_PKCS11_PROVIDER_CLASS = "sun.security.pkcs11.SunPKCS11"; + private AuthProvider aprov; + @Override + public KeyStore getKeystore(char[] password) throws KeyStoreException { + try { + InputStream configStream = new ByteArrayInputStream(PKCS11_CONFIG); + + Provider sunPKCS11Provider = this.createSunPKCS11Provider(configStream); + Security.addProvider(sunPKCS11Provider); + +// Eestas lineas se añadieron para poder hacer un logout del keystore +// + + KeyStore.Builder ksBuilder = KeyStore.Builder.newInstance( + "PKCS11", + null, + new KeyStore.CallbackHandlerProtection( new SimpleCallbackHandler(null,password ) )); //cmdLineHdlr + + KeyStore ks = ksBuilder.getKeyStore(); +// + + aprov = (AuthProvider) Security.getProvider( sunPKCS11Provider.getName() ); + aprov.setCallbackHandler( new SimpleCallbackHandler(null,password ) ); //cmdLineHdlr + + try { + aprov.login(null, null); + } catch (LoginException ex) { + Logger.getLogger(LinuxKeyStoreProvider.class.getName()).log(Level.SEVERE, null, ex); + throw new LoginException( /*ex*/ ); + } + +// KeyStore keyStore = KeyStore.getInstance("PKCS11"); +// +// keyStore.load(null, password); //null + System.out.println("Dentro LinuxKeystore anntes de ks:" + ks); + // aprov.logout(); + return ks; //keyStore +// } catch (CertificateException e) { +// throw new KeyStoreException(e); +// } catch (NoSuchAlgorithmException e) { +// throw new KeyStoreException(e); +// } catch (IOException e) { +// throw new KeyStoreException(e); +// } + } catch (Exception e){ + System.out.println("Error en el keystore:" + e); + e.printStackTrace(); + throw new KeyStoreException(e); + } + } + /** + * logout + * Esta función permite limpiar de memoria el keystore. + * @throws javax.security.auth.login.LoginException + */ + public void logout() throws LoginException{ + + this.aprov.logout(); + } + /** + * Instancia la clase sun.security.pkcs11.SunPKCS11 + * dinamicamente, usando Java Reflection. + * + * @return una instancia de sun.security.pkcs11.SunPKCS11 + */ + @SuppressWarnings("unchecked") + private Provider createSunPKCS11Provider(InputStream configStream) throws KeyStoreException { + try { + Class sunPkcs11Class = Class.forName(SUN_PKCS11_PROVIDER_CLASS); + Constructor pkcs11Constr = sunPkcs11Class.getConstructor(InputStream.class); + Provider pkcs11Provider = (Provider) pkcs11Constr.newInstance(configStream); + + return pkcs11Provider; + } catch (ClassNotFoundException e) { + throw new KeyStoreException(e); + } catch (NoSuchMethodException e) { + throw new KeyStoreException(e); + } catch (InvocationTargetException e) { + throw new KeyStoreException(e); + } catch (IllegalAccessException e) { + throw new KeyStoreException(e); + } catch (InstantiationException e) { + throw new KeyStoreException(e); + } + } +} diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/MockKeyStoreProvider.java b/appletFirma/src/main/java/com/fp/firma/keystore/MockKeyStoreProvider.java new file mode 100755 index 0000000..4781c35 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/MockKeyStoreProvider.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2009 Libreria para Firma Digital development team. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +package com.fp.firma.keystore; + +import java.io.BufferedInputStream; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.KeyStoreException; + +/** + * Implementacion de KeyStoreProvider para pruebas. + * + */ +public class MockKeyStoreProvider implements KeyStoreProvider { + + private static final String KEYSTORE_FILE = "/home/ricardo/ricardostore"; + + // private static final String KEYSTORE_ALIAS = "firmadigital"; + // private static final char[] KEYSTORE_PASSWORD = "abc123".toCharArray(); + // private static final char[] KEY_PASSWORD = "ricardo".toCharArray(); + + @Override + public KeyStore getKeystore(char[] password) throws KeyStoreException { + try { + KeyStore keyStore = KeyStore.getInstance("JKS"); + FileInputStream ksfis; + ksfis = new FileInputStream(KEYSTORE_FILE); + BufferedInputStream ksbufin = new BufferedInputStream(ksfis); + + keyStore.load(ksbufin, password); + // PrivateKey priv = (PrivateKey) keyStore.getKey(KEYSTORE_ALIAS, + // KEY_PASSWORD); + + return keyStore; + } catch (FileNotFoundException e) { + throw new KeyStoreException(e); + } catch (GeneralSecurityException e) { + throw new KeyStoreException(e); + } catch (IOException e) { + throw new KeyStoreException(e); + } + } +} \ No newline at end of file diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/PKCS11KeyStoreProvider.java b/appletFirma/src/main/java/com/fp/firma/keystore/PKCS11KeyStoreProvider.java new file mode 100755 index 0000000..6d17b14 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/PKCS11KeyStoreProvider.java @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2009 Libreria para Firma Digital development team. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +package com.fp.firma.keystore; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.Provider; +import java.security.Security; +import java.security.cert.CertificateException; + + +/** + * Implementacion de KeyStoreProvider para utilizar con librerias + * PKCS#11 del sistema operativo. + * + * Utiza OpenCT para acceder a un Token USB. + * + * + */ +public abstract class PKCS11KeyStoreProvider implements KeyStoreProvider { + + /** + * Obtiene la configuración para el Provider, según el sistema operativo que se utilice. + * + * @return + */ + public abstract String getConfig(); + + public KeyStore getKeystore(char[] password) throws KeyStoreException { + try { + InputStream configStream = new ByteArrayInputStream(getConfig().getBytes()); + + Provider sunPKCS11Provider = this.createSunPKCS11Provider(configStream); + Security.addProvider(sunPKCS11Provider); + + KeyStore keyStore = KeyStore.getInstance("PKCS11"); + keyStore.load(null, password); + + return keyStore; + } catch (CertificateException e) { + throw new KeyStoreException(e); + } catch (NoSuchAlgorithmException e) { + throw new KeyStoreException(e); + } catch (IOException e) { + throw new KeyStoreException(e); + } + } + + /** + * Instancia la clase sun.security.pkcs11.SunPKCS11 + * dinamicamente, usando Java Reflection. + * + * @return una instancia de sun.security.pkcs11.SunPKCS11 + */ + @SuppressWarnings("unchecked") + private Provider createSunPKCS11Provider(InputStream configStream) throws KeyStoreException { + try { + Class sunPkcs11Class = Class.forName("sun.security.pkcs11.SunPKCS11"); + Constructor pkcs11Constr = sunPkcs11Class.getConstructor(InputStream.class); + return (Provider) pkcs11Constr.newInstance(configStream); + } catch (ClassNotFoundException e) { + throw new KeyStoreException(e); + } catch (NoSuchMethodException e) { + throw new KeyStoreException(e); + } catch (InvocationTargetException e) { + throw new KeyStoreException(e); + } catch (IllegalAccessException e) { + throw new KeyStoreException(e); + } catch (InstantiationException e) { + throw new KeyStoreException(e); + } + } +} \ No newline at end of file diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/SimpleCallbackHandler.java b/appletFirma/src/main/java/com/fp/firma/keystore/SimpleCallbackHandler.java new file mode 100755 index 0000000..55ee16b --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/SimpleCallbackHandler.java @@ -0,0 +1,49 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.fp.firma.keystore; + +/** + * + * @author subinfo + */ +import javax.security.auth.callback.*; + +/** + * This simple callback handler presents the given user name and password. + * @version 1.0 2004-09-14 + * @author Cay Horstmann + */ +public class SimpleCallbackHandler implements CallbackHandler +{ + /** + * Constructs the callback handler. + * @param username the user name + * @param password a character array containing the password + */ + public SimpleCallbackHandler(String username, char[] password) + { + this.username = username; + this.password = password; + } + + public void handle(Callback[] callbacks) + { + for (Callback callback : callbacks) + { + if (callback instanceof NameCallback) + { + ((NameCallback) callback).setName(username); + } + else if (callback instanceof PasswordCallback) + { + ((PasswordCallback) callback).setPassword(password); + } + } + } + + private String username; + private char[] password; +} diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/WindowsJDK5KeyStoreProvider.java b/appletFirma/src/main/java/com/fp/firma/keystore/WindowsJDK5KeyStoreProvider.java new file mode 100755 index 0000000..344e2a8 --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/WindowsJDK5KeyStoreProvider.java @@ -0,0 +1,129 @@ +/** Programa para La firma electrónica de archivos + * Desarrollado y Modificado por la Subsecretaría de Tecnologías de la Información + * de la Secretaría Nacional de la Administración Pública del Ecuador + * Firma Digital firmadigital.informatica.gob.ec + *------------------------------------------------------------------------------ + * This program is free software: you can redistribute it and/or +modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public +License + * along with this program. If not, see http://www.gnu.org/licenses. [^] + *------------------------------------------------------------------------------ + **/ +package com.fp.firma.keystore; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.security.AuthProvider; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.Provider; +import java.security.ProviderException; +import java.security.Security; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.management.ReflectionException; +import javax.security.auth.login.LoginException; + +/** + * maneja el keystore de windows, no el CAPI, accede a travez de librerias, en esta se usa librerias para eTokenPro + **/ +public class WindowsJDK5KeyStoreProvider implements KeyStoreProvider { + + + //private static final byte[] PKCS11_CONFIG = "name = SmartCard\nlibrary = C:\\WINDOWS\\SYSTEM32\\DKCK201.DLL \ndisabledMechanisms = { CKM_SHA1_RSA_PKCS }".getBytes(); + private static String windowsDir = "name = SmartCard\nlibrary = " + System.getenv("WINDIR") + "\\SYSTEM32\\eTPKCS11.DLL \ndisabledMechanisms = { CKM_SHA1_RSA_PKCS } \n showInfo = true"; //showInfo = true + private static final byte[] PKCS11_CONFIG = windowsDir.getBytes(); + private static final String SUN_PKCS11_PROVIDER_CLASS = "sun.security.pkcs11.SunPKCS11"; + private AuthProvider aprov; + + @Override + public KeyStore getKeystore(char[] password) throws KeyStoreException { + try { + System.out.println("Tiene PKCS11: " + PKCS11_CONFIG); + InputStream configStream = new ByteArrayInputStream(PKCS11_CONFIG); + + Provider sunPKCS11Provider = this.createSunPKCS11Provider(configStream); + Security.addProvider(sunPKCS11Provider); + + KeyStore.Builder ksBuilder = KeyStore.Builder.newInstance( + "PKCS11", + null, + new KeyStore.CallbackHandlerProtection(new SimpleCallbackHandler(null, password))); //cmdLineHdlr + + KeyStore ks = ksBuilder.getKeyStore(); + + aprov = (AuthProvider) Security.getProvider(sunPKCS11Provider.getName()); + aprov.setCallbackHandler(new SimpleCallbackHandler(null, password)); //cmdLineHdlr + + aprov.login(null, null); +// + + return ks; //keyStore +// + + } catch (LoginException ex) { + Logger.getLogger(WindowsJDK5KeyStoreProvider.class.getName()).log(Level.SEVERE, null, ex); + System.out.println("error en el loginExcep" + ex); + } catch (KeyStoreException e) { + System.out.println("e:" + e.getCause().toString().length()); + throw new KeyStoreException(e); + } +// catch (Exception e){ +// System.out.println("Error en el keystore:" + e.getCause().toString().length() ); +// throw new KeyStoreException( e.getMessage() ,e.getCause()); +// } + return null; + } + + /** + * logout + * Esta función permite limpiar de memoria el keystore. + * @throws javax.security.auth.login.LoginException + */ + public void logout() throws LoginException { + + this.aprov.logout(); + } + + /** + * Instancia la clase sun.security.pkcs11.SunPKCS11 + * dinamicamente, usando Java Reflection. + * + * @return una instancia de sun.security.pkcs11.SunPKCS11 + */ + @SuppressWarnings("unchecked") + private Provider createSunPKCS11Provider(InputStream configStream) throws ProviderException, KeyStoreException { + try { + Class sunPkcs11Class = Class.forName(SUN_PKCS11_PROVIDER_CLASS); + + Constructor pkcs11Constr = sunPkcs11Class.getConstructor(InputStream.class); + Provider pkcs11Provider = (Provider) pkcs11Constr.newInstance(configStream); + + return pkcs11Provider; + + } catch (ClassNotFoundException e) { + throw new KeyStoreException(e); + } catch (NoSuchMethodException e) { + throw new KeyStoreException(e); + } catch (InvocationTargetException e) { + + throw new KeyStoreException(e.getMessage(), e.getCause()); + } catch (IllegalAccessException e) { + throw new KeyStoreException(e); + } catch (InstantiationException e) { + throw new KeyStoreException(e); + } + } +} diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/WindowsJDK5KeyStoreProvider_SD.java b/appletFirma/src/main/java/com/fp/firma/keystore/WindowsJDK5KeyStoreProvider_SD.java new file mode 100755 index 0000000..6333abf --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/WindowsJDK5KeyStoreProvider_SD.java @@ -0,0 +1,139 @@ +/** Programa para La firma electrónica de archivos +* Desarrollado y Modificado por la Subsecretaría de Tecnologías de la Información +* de la Secretaría Nacional de la Administración Pública del Ecuador +* Firma Digital firmadigital.informatica.gob.ec +*------------------------------------------------------------------------------ +* This program is free software: you can redistribute it and/or +modify +* it under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation, either version 3 of the +* License, or (at your option) any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public +License +* along with this program. If not, see http://www.gnu.org/licenses. [^] +*------------------------------------------------------------------------------ +**/ +package com.fp.firma.keystore; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.security.AuthProvider; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.Provider; +import java.security.Security; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.security.auth.login.LoginException; + +/** + * Esta clase se usa para obtener el keystore (Con el se pueden obtener luego los certificados dentro del token) en Windows + */ +public class WindowsJDK5KeyStoreProvider_SD implements KeyStoreProvider { + + //private static final byte[] PKCS11_CONFIG = "name = SmartCard\nlibrary = C:\\WINDOWS\\SYSTEM32\\DKCK201.DLL \ndisabledMechanisms = { CKM_SHA1_RSA_PKCS }".getBytes(); + // esta linea corrige el error de la ubicación de Windows + // para trabajar con iKey + private static final String windowsDir_SD = "name = ePass3003\nlibrary = C:\\WINDOWS\\SYSTEM32\\SecurityDataCsp11_3003.dll \ndisabledMechanisms = { CKM_SHA1_RSA_PKCS } \n\r showInfo = true"; + private static final byte[] PKCS11_CONFIG_SD = windowsDir_SD.getBytes(); + private static final String SUN_PKCS11_PROVIDER_CLASS = "sun.security.pkcs11.SunPKCS11"; + private AuthProvider aprov; + + /** + * getKeystore + * Esta funcion se utiliza para obtener el keystore de java para manejar luego la clave privada y los certificados dentro del token + * @param password Se pasa la clave del token + * @return + * @throws java.security.KeyStoreException + */ + @Override + public KeyStore getKeystore(char[] password) throws KeyStoreException { + try { + // empieza intentando con eToken + InputStream configStream = new ByteArrayInputStream(PKCS11_CONFIG_SD); + + Provider sunPKCS11Provider = this.createSunPKCS11Provider(configStream); + Security.addProvider(sunPKCS11Provider); + + + KeyStore.Builder ksBuilder = KeyStore.Builder.newInstance( + "PKCS11", + null, + new KeyStore.CallbackHandlerProtection(new SimpleCallbackHandler(null, password))); //cmdLineHdlr + + KeyStore ks = ksBuilder.getKeyStore(); + + // Estas lineas se añadieron para controlar mejor el logout del token + aprov = (AuthProvider) Security.getProvider(sunPKCS11Provider.getName()); + aprov.setCallbackHandler(new SimpleCallbackHandler(null, password)); //cmdLineHdlr + + try { + aprov.login(null, null); + } catch (LoginException ex) { + Logger.getLogger(WindowsJDK5KeyStoreProvider_SD.class.getName()).log(Level.SEVERE, null, ex); + throw new LoginException( /*ex*/); + } + + + + + return ks; //keyStore + } catch (LoginException ex) { + Logger.getLogger(WindowsJDK5KeyStoreProvider_SD.class.getName()).log(Level.SEVERE, null, ex); + System.out.println("error en el loginExcep" + ex); + } catch (KeyStoreException e) { + System.out.println("e:" + e.getCause().toString().length()); + throw new KeyStoreException(e); + } + +// } catch (Exception e){ +// System.out.println("Error en el keystore:" + e); +// throw new KeyStoreException(e); +// } + return null; + } + + /** + * logout + * Esta función permite limpiar de memoria el keystore. + * @throws javax.security.auth.login.LoginException + */ + public void logout() throws LoginException { + + this.aprov.logout(); + } + + /** + * Instancia la clase sun.security.pkcs11.SunPKCS11 + * dinamicamente, usando Java Reflection. + * + * @return una instancia de sun.security.pkcs11.SunPKCS11 + */ + @SuppressWarnings("unchecked") + private Provider createSunPKCS11Provider(InputStream configStream) throws KeyStoreException { + try { + Class sunPkcs11Class = Class.forName(SUN_PKCS11_PROVIDER_CLASS); + Constructor pkcs11Constr = sunPkcs11Class.getConstructor(InputStream.class); + Provider pkcs11Provider = (Provider) pkcs11Constr.newInstance(configStream); + + return pkcs11Provider; + } catch (ClassNotFoundException e) { + throw new KeyStoreException(e); + } catch (NoSuchMethodException e) { + throw new KeyStoreException(e); + } catch (InvocationTargetException e) { + throw new KeyStoreException(e); + } catch (IllegalAccessException e) { + throw new KeyStoreException(e); + } catch (InstantiationException e) { + throw new KeyStoreException(e); + } + } +} \ No newline at end of file diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/WindowsJDK5KeyStoreProvider_iKey.java b/appletFirma/src/main/java/com/fp/firma/keystore/WindowsJDK5KeyStoreProvider_iKey.java new file mode 100755 index 0000000..fcf686f --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/WindowsJDK5KeyStoreProvider_iKey.java @@ -0,0 +1,144 @@ +/** Programa para La firma electrónica de archivos +* Desarrollado y Modificado por la Subsecretaría de Tecnologías de la Información +* de la Secretaría Nacional de la Administración Pública del Ecuador +* Firma Digital firmadigital.informatica.gob.ec +*------------------------------------------------------------------------------ +* This program is free software: you can redistribute it and/or +modify +* it under the terms of the GNU Affero General Public License as +* published by the Free Software Foundation, either version 3 of the +* License, or (at your option) any later version. +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Affero General Public License for more details. +* +* You should have received a copy of the GNU Affero General Public +License +* along with this program. If not, see http://www.gnu.org/licenses. [^] +*------------------------------------------------------------------------------ +**/ + + +package com.fp.firma.keystore; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.security.AuthProvider; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.Provider; +import java.security.Security; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.security.auth.login.LoginException; + +/** + * Esta clase se usa para obtener el keystore (Con el se pueden obtener luego los certificados dentro del token iKEY) en Windows + */ +public class WindowsJDK5KeyStoreProvider_iKey implements KeyStoreProvider { + + + + //private static final byte[] PKCS11_CONFIG = "name = SmartCard\nlibrary = C:\\WINDOWS\\SYSTEM32\\DKCK201.DLL \ndisabledMechanisms = { CKM_SHA1_RSA_PKCS }".getBytes(); + // esta linea corrige el error de la ubicación de Windows + // para trabajar con iKey + private static String windowsDir_iKey ="name = SmartCard\nlibrary = "+ System.getenv("WINDIR") + "\\SYSTEM32\\DKCK201.DLL \ndisabledMechanisms = { CKM_SHA1_RSA_PKCS } \n showInfo = true"; + private static final byte[] PKCS11_CONFIG_IKEY = windowsDir_iKey.getBytes(); + + + private static final String SUN_PKCS11_PROVIDER_CLASS = "sun.security.pkcs11.SunPKCS11"; + private AuthProvider aprov; + + /** + * getKeystore + * Esta funcion se utiliza para obtener el keystore de java para manejar luego la clave privada y los certificados dentro del token + * @param password Se pasa la clave del token + * @return + * @throws java.security.KeyStoreException + */ + @Override + public KeyStore getKeystore(char[] password) throws KeyStoreException { + try { + // empieza intentando con eToken + InputStream configStream = new ByteArrayInputStream(PKCS11_CONFIG_IKEY); + + Provider sunPKCS11Provider = this.createSunPKCS11Provider(configStream); + Security.addProvider(sunPKCS11Provider); + + + KeyStore.Builder ksBuilder = KeyStore.Builder.newInstance( + "PKCS11", + null, + new KeyStore.CallbackHandlerProtection( new SimpleCallbackHandler(null,password ) )); //cmdLineHdlr + + KeyStore ks = ksBuilder.getKeyStore(); + + // Estas lineas se añadieron para controlar mejor el logout del token + aprov = (AuthProvider) Security.getProvider( sunPKCS11Provider.getName() ); + aprov.setCallbackHandler( new SimpleCallbackHandler(null,password ) ); //cmdLineHdlr + + try { + aprov.login(null, null); + } catch (LoginException ex) { + Logger.getLogger(WindowsJDK5KeyStoreProvider_iKey.class.getName()).log(Level.SEVERE, null, ex); + throw new LoginException( /*ex*/ ); + } + + + + + return ks; //keyStore + } + catch (LoginException ex) { + Logger.getLogger(WindowsJDK5KeyStoreProvider_iKey.class.getName()).log(Level.SEVERE, null, ex); + System.out.println("error en el loginExcep" + ex); + } catch (KeyStoreException e) { + System.out.println("e:"+ e.getCause().toString().length() ); + throw new KeyStoreException(e); + } + +// } catch (Exception e){ +// System.out.println("Error en el keystore:" + e); +// throw new KeyStoreException(e); +// } + return null; + } + /** + * logout + * Esta función permite limpiar de memoria el keystore. + * @throws javax.security.auth.login.LoginException + */ + public void logout() throws LoginException{ + + this.aprov.logout(); + } + /** + * Instancia la clase sun.security.pkcs11.SunPKCS11 + * dinamicamente, usando Java Reflection. + * + * @return una instancia de sun.security.pkcs11.SunPKCS11 + */ + @SuppressWarnings("unchecked") + private Provider createSunPKCS11Provider(InputStream configStream) throws KeyStoreException { + try { + Class sunPkcs11Class = Class.forName(SUN_PKCS11_PROVIDER_CLASS); + Constructor pkcs11Constr = sunPkcs11Class.getConstructor(InputStream.class); + Provider pkcs11Provider = (Provider) pkcs11Constr.newInstance(configStream); + + return pkcs11Provider; + } catch (ClassNotFoundException e) { + throw new KeyStoreException(e); + } catch (NoSuchMethodException e) { + throw new KeyStoreException(e); + } catch (InvocationTargetException e) { + throw new KeyStoreException(e); + } catch (IllegalAccessException e) { + throw new KeyStoreException(e); + } catch (InstantiationException e) { + throw new KeyStoreException(e); + } + } +} \ No newline at end of file diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/WindowsJDK6KeyStoreProvider.java b/appletFirma/src/main/java/com/fp/firma/keystore/WindowsJDK6KeyStoreProvider.java new file mode 100755 index 0000000..5dfb66f --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/WindowsJDK6KeyStoreProvider.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2009 Libreria para Firma Digital development team. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +package com.fp.firma.keystore; + +import java.io.IOException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateException; + +import com.fp.firma.common.FirmasException; + +/** + * Implementación de KeyStoreProvider para acceder al keystore del sistema operativo + * Microsoft Windows. + * + * Utiliza funcionalidad disponible desde el JDK6 en adelante para acceder al MS CAPI. + * + */ +public class WindowsJDK6KeyStoreProvider implements KeyStoreProvider { + + public KeyStore getKeystore(char[] password) throws KeyStoreException { + try { + KeyStore keyStore = KeyStore.getInstance("Windows-MY"); + keyStore.load(null, password); + return keyStore; + } catch (NoSuchAlgorithmException e) { + throw new KeyStoreException(e); + } catch (CertificateException e) { + throw new KeyStoreException(e); + } catch (IOException e) { + if(e.getCause() instanceof UnrecoverableKeyException){ + throw new FirmasException(e); + } else{ + throw new KeyStoreException(e); + } + } catch (Throwable e) { + if ((e instanceof UnrecoverableKeyException)) { + throw new FirmasException(e); + } else{ + throw new KeyStoreException(e); + } + } + } +} \ No newline at end of file diff --git a/appletFirma/src/main/java/com/fp/firma/keystore/WindowsKeyStoreProvider.java b/appletFirma/src/main/java/com/fp/firma/keystore/WindowsKeyStoreProvider.java new file mode 100755 index 0000000..a704f9f --- /dev/null +++ b/appletFirma/src/main/java/com/fp/firma/keystore/WindowsKeyStoreProvider.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2009 Libreria para Firma Digital development team. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +package com.fp.firma.keystore; + +import java.io.IOException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; + +/** + * Implementacion de KeyStoreProvider para acceder al keystore del sistema operativo + * Microsoft Windows. + * + * Utiliza funcionalidad disponible desde el JDK6 en adelante para acceder al MS CAPI. + * + */ +public class WindowsKeyStoreProvider implements KeyStoreProvider { + + private static final String MICROSOFT_WINDOWS_PROVIDER_TYPE = "Windows-MY"; + + @Override + public KeyStore getKeystore(char[] password) throws KeyStoreException { + try { + KeyStore keyStore = KeyStore.getInstance(MICROSOFT_WINDOWS_PROVIDER_TYPE); + keyStore.load(null, password); + return keyStore; + } catch (NoSuchAlgorithmException e) { + throw new KeyStoreException(e); + } catch (CertificateException e) { + throw new KeyStoreException(e); + } catch (IOException e) { + throw new KeyStoreException(e); + } + } +} \ No newline at end of file diff --git a/appletFirma/src/main/resources/.svn/entries b/appletFirma/src/main/resources/.svn/entries new file mode 100644 index 0000000..3aaa452 --- /dev/null +++ b/appletFirma/src/main/resources/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/appletFirma/src/main/resources +svn://172.17.26.185/COMACO + + + +2014-12-31T05:22:02.287651Z +3703 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +firmessages_es.properties +file + + + + +2022-07-28T03:40:24.020722Z +3474bb130f9466563b3dd13b5fbb1efb +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +2185 + diff --git a/appletFirma/src/main/resources/.svn/prop-base/firmessages_es.properties.svn-base b/appletFirma/src/main/resources/.svn/prop-base/firmessages_es.properties.svn-base new file mode 100644 index 0000000..085986a --- /dev/null +++ b/appletFirma/src/main/resources/.svn/prop-base/firmessages_es.properties.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/appletFirma/src/main/resources/.svn/text-base/firmessages_es.properties.svn-base b/appletFirma/src/main/resources/.svn/text-base/firmessages_es.properties.svn-base new file mode 100644 index 0000000..2882ef5 --- /dev/null +++ b/appletFirma/src/main/resources/.svn/text-base/firmessages_es.properties.svn-base @@ -0,0 +1,48 @@ +################################################### +##### S\u00edmbolos unicode +#####\u00e1 -> +#####\u00e9 -> +#####\u00ed -> +#####\u00f3 -> +#####\u00fa -> +#####\u00c1 -> +#####\u00c9 -> +#####\u00cd -> +#####\u00d3 -> +#####\u00da -> +#####\u00f1 -> +#####\u00d1 -> +#####\u0020 -> Espacio en blanco +################################################### + +#======================================================================================== +#=======CODIGO EXCEPCIONES=============================================================== +#======================================================================================== +FIR-0001=ERROR AL ESTABLECER CONEXI\u00D3N AL SERVICIO\: {0} +FIR-0002=ERROR, CERTIFICADO REVOCADO POR {0} CON FECHA {1} +FIR-0005=ERROR, ES OBLIGATORIO CARGAR UN ARCHIVO +FIR-0006=ERROR, LA CONTRASE\u00d1A INGRESADA ES INCORRECTA +FIR-0007=ERROR, EL CAMPO PASSWORD ES OBLIGATORIO +#======================================================================================== +#=======OIDs GENERALES DE IDENTIFICACION DEL USUARIO EN EL CERTIFICADO=================== +#======================================================================================== +oid.cedula_pasaporte=1.3.6.1.4.1.37947.3.1 +oid.nombres_persona=1.3.6.1.4.1.37947.3.2 +oid.apellido_persona1=1.3.6.1.4.1.37947.3.3 +oid.apellido_persona2=1.3.6.1.4.1.37947.3.4 +oid.cargo=1.3.6.1.4.1.37947.3.5 +oid.institucion=1.3.6.1.4.1.37947.3.6 +oid.direccion=1.3.6.1.4.1.37947.3.7 +oid.telefono=1.3.6.1.4.1.37947.3.8 +oid.ciudad=1.3.6.1.4.1.37947.3.9 +oid.razon_social=1.3.6.1.4.1.37947.3.10 +oid.ruc=1.3.6.1.4.1.37947.3.11 +#======================================================================================== +#=======RUTAS DE LOS DIRECTORIOS DEL REPOSITORIO DE CERTIFICADOS========================= +#======================================================================================== +dir.ruta.base.repositorio=/media/store/maia/jboss-eap-6.0/digital_repository +dir.nombre.carpeta.usuarios=users +nombre.certificado.raiz=CARAIZ.cer +nombre.certificado.subordinado=CASUBORDINADO.cer +service.url.address.ocsp=http://ocsp.digsigtrust.com:80 +#service.url.address.ocsp=http://ocsp.openvalidation.org:80 \ No newline at end of file diff --git a/appletFirma/src/main/resources/firmessages_es.properties b/appletFirma/src/main/resources/firmessages_es.properties new file mode 100755 index 0000000..2882ef5 --- /dev/null +++ b/appletFirma/src/main/resources/firmessages_es.properties @@ -0,0 +1,48 @@ +################################################### +##### S\u00edmbolos unicode +#####\u00e1 -> +#####\u00e9 -> +#####\u00ed -> +#####\u00f3 -> +#####\u00fa -> +#####\u00c1 -> +#####\u00c9 -> +#####\u00cd -> +#####\u00d3 -> +#####\u00da -> +#####\u00f1 -> +#####\u00d1 -> +#####\u0020 -> Espacio en blanco +################################################### + +#======================================================================================== +#=======CODIGO EXCEPCIONES=============================================================== +#======================================================================================== +FIR-0001=ERROR AL ESTABLECER CONEXI\u00D3N AL SERVICIO\: {0} +FIR-0002=ERROR, CERTIFICADO REVOCADO POR {0} CON FECHA {1} +FIR-0005=ERROR, ES OBLIGATORIO CARGAR UN ARCHIVO +FIR-0006=ERROR, LA CONTRASE\u00d1A INGRESADA ES INCORRECTA +FIR-0007=ERROR, EL CAMPO PASSWORD ES OBLIGATORIO +#======================================================================================== +#=======OIDs GENERALES DE IDENTIFICACION DEL USUARIO EN EL CERTIFICADO=================== +#======================================================================================== +oid.cedula_pasaporte=1.3.6.1.4.1.37947.3.1 +oid.nombres_persona=1.3.6.1.4.1.37947.3.2 +oid.apellido_persona1=1.3.6.1.4.1.37947.3.3 +oid.apellido_persona2=1.3.6.1.4.1.37947.3.4 +oid.cargo=1.3.6.1.4.1.37947.3.5 +oid.institucion=1.3.6.1.4.1.37947.3.6 +oid.direccion=1.3.6.1.4.1.37947.3.7 +oid.telefono=1.3.6.1.4.1.37947.3.8 +oid.ciudad=1.3.6.1.4.1.37947.3.9 +oid.razon_social=1.3.6.1.4.1.37947.3.10 +oid.ruc=1.3.6.1.4.1.37947.3.11 +#======================================================================================== +#=======RUTAS DE LOS DIRECTORIOS DEL REPOSITORIO DE CERTIFICADOS========================= +#======================================================================================== +dir.ruta.base.repositorio=/media/store/maia/jboss-eap-6.0/digital_repository +dir.nombre.carpeta.usuarios=users +nombre.certificado.raiz=CARAIZ.cer +nombre.certificado.subordinado=CASUBORDINADO.cer +service.url.address.ocsp=http://ocsp.digsigtrust.com:80 +#service.url.address.ocsp=http://ocsp.openvalidation.org:80 \ No newline at end of file diff --git a/appletFirma/src/test/.svn/entries b/appletFirma/src/test/.svn/entries new file mode 100644 index 0000000..5675703 --- /dev/null +++ b/appletFirma/src/test/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/appletFirma/src/test +svn://172.17.26.185/COMACO + + + +2014-12-31T05:22:02.287651Z +3703 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + diff --git a/appletFirma/src/test/java/.svn/entries b/appletFirma/src/test/java/.svn/entries new file mode 100644 index 0000000..13a7e41 --- /dev/null +++ b/appletFirma/src/test/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/appletFirma/src/test/java +svn://172.17.26.185/COMACO + + + +2014-12-31T05:22:02.287651Z +3703 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/appletFirma/src/test/java/com/.svn/entries b/appletFirma/src/test/java/com/.svn/entries new file mode 100644 index 0000000..1e1d802 --- /dev/null +++ b/appletFirma/src/test/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/appletFirma/src/test/java/com +svn://172.17.26.185/COMACO + + + +2014-12-31T05:22:02.287651Z +3703 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/appletFirma/src/test/java/com/fp/.svn/entries b/appletFirma/src/test/java/com/fp/.svn/entries new file mode 100644 index 0000000..0111b38 --- /dev/null +++ b/appletFirma/src/test/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/appletFirma/src/test/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-12-31T05:22:02.287651Z +3703 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +firma +dir + diff --git a/appletFirma/src/test/java/com/fp/firma/.svn/entries b/appletFirma/src/test/java/com/fp/firma/.svn/entries new file mode 100644 index 0000000..44cdf31 --- /dev/null +++ b/appletFirma/src/test/java/com/fp/firma/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/appletFirma/src/test/java/com/fp/firma +svn://172.17.26.185/COMACO + + + +2014-12-31T05:22:02.287651Z +3703 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +applet +dir + diff --git a/appletFirma/src/test/java/com/fp/firma/applet/.svn/entries b/appletFirma/src/test/java/com/fp/firma/applet/.svn/entries new file mode 100644 index 0000000..95f9e75 --- /dev/null +++ b/appletFirma/src/test/java/com/fp/firma/applet/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/appletFirma/src/test/java/com/fp/firma/applet +svn://172.17.26.185/COMACO + + + +2014-12-31T05:22:02.287651Z +3703 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +AppTest.java +file + + + + +2022-07-28T03:40:23.474720Z +344982b9ae13a54e1ca56bbb62751f55 +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +647 + +PruebaFirma.java +file + + + + +2022-07-28T03:40:23.474720Z +16809319f5505f378ce18fb335a59914 +2014-12-31T05:22:02.287651Z +3703 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1324 + diff --git a/appletFirma/src/test/java/com/fp/firma/applet/.svn/prop-base/AppTest.java.svn-base b/appletFirma/src/test/java/com/fp/firma/applet/.svn/prop-base/AppTest.java.svn-base new file mode 100644 index 0000000..085986a --- /dev/null +++ b/appletFirma/src/test/java/com/fp/firma/applet/.svn/prop-base/AppTest.java.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/appletFirma/src/test/java/com/fp/firma/applet/.svn/prop-base/PruebaFirma.java.svn-base b/appletFirma/src/test/java/com/fp/firma/applet/.svn/prop-base/PruebaFirma.java.svn-base new file mode 100644 index 0000000..085986a --- /dev/null +++ b/appletFirma/src/test/java/com/fp/firma/applet/.svn/prop-base/PruebaFirma.java.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/appletFirma/src/test/java/com/fp/firma/applet/.svn/text-base/AppTest.java.svn-base b/appletFirma/src/test/java/com/fp/firma/applet/.svn/text-base/AppTest.java.svn-base new file mode 100644 index 0000000..413c140 --- /dev/null +++ b/appletFirma/src/test/java/com/fp/firma/applet/.svn/text-base/AppTest.java.svn-base @@ -0,0 +1,38 @@ +package com.fp.firma.applet; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/appletFirma/src/test/java/com/fp/firma/applet/.svn/text-base/PruebaFirma.java.svn-base b/appletFirma/src/test/java/com/fp/firma/applet/.svn/text-base/PruebaFirma.java.svn-base new file mode 100644 index 0000000..8948a9d --- /dev/null +++ b/appletFirma/src/test/java/com/fp/firma/applet/.svn/text-base/PruebaFirma.java.svn-base @@ -0,0 +1,39 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.firma.applet; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.InputStream; + +import com.fp.firma.common.CertificateUtils; +import com.itextpdf.text.Rectangle; + +/** + * + * @author dcruz + */ +public class PruebaFirma { + +// @Test + public static void main(String[] args){ + try { + InputStream is = new FileInputStream("C:\\Users\\abenalcazar\\dwhelper\\Downloads\\Tutorial_de_Maven_3_Erick_Camacho.pdf"); + String password = "Password#1"; + byte[] array = CertificateUtils.sign(is, null, password, "Firmado digitalmente", "Por firmar", Boolean.FALSE, Boolean.FALSE, new Rectangle(50, 50, 200, 200), 1, "Firma 2", "2"); + is.close(); + System.out.println("Tam array "+ array != null ? array.length:0); + FileOutputStream os = new FileOutputStream("C:\\Users\\abenalcazar\\dwhelper\\Downloads\\Tutorial_de_Maven_3_Erick_Camacho.pdf"); + os.write(array); + os.flush(); + os.close(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (Throwable e){ + e.printStackTrace(); + } + } +} diff --git a/appletFirma/src/test/java/com/fp/firma/applet/AppTest.java b/appletFirma/src/test/java/com/fp/firma/applet/AppTest.java new file mode 100755 index 0000000..413c140 --- /dev/null +++ b/appletFirma/src/test/java/com/fp/firma/applet/AppTest.java @@ -0,0 +1,38 @@ +package com.fp.firma.applet; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/appletFirma/src/test/java/com/fp/firma/applet/PruebaFirma.java b/appletFirma/src/test/java/com/fp/firma/applet/PruebaFirma.java new file mode 100755 index 0000000..8948a9d --- /dev/null +++ b/appletFirma/src/test/java/com/fp/firma/applet/PruebaFirma.java @@ -0,0 +1,39 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.firma.applet; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.InputStream; + +import com.fp.firma.common.CertificateUtils; +import com.itextpdf.text.Rectangle; + +/** + * + * @author dcruz + */ +public class PruebaFirma { + +// @Test + public static void main(String[] args){ + try { + InputStream is = new FileInputStream("C:\\Users\\abenalcazar\\dwhelper\\Downloads\\Tutorial_de_Maven_3_Erick_Camacho.pdf"); + String password = "Password#1"; + byte[] array = CertificateUtils.sign(is, null, password, "Firmado digitalmente", "Por firmar", Boolean.FALSE, Boolean.FALSE, new Rectangle(50, 50, 200, 200), 1, "Firma 2", "2"); + is.close(); + System.out.println("Tam array "+ array != null ? array.length:0); + FileOutputStream os = new FileOutputStream("C:\\Users\\abenalcazar\\dwhelper\\Downloads\\Tutorial_de_Maven_3_Erick_Camacho.pdf"); + os.write(array); + os.flush(); + os.close(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (Throwable e){ + e.printStackTrace(); + } + } +} diff --git a/appletFirma/target/appletFirma-2.1.jar b/appletFirma/target/appletFirma-2.1.jar new file mode 100644 index 0000000..7746982 Binary files /dev/null and b/appletFirma/target/appletFirma-2.1.jar differ diff --git a/appletFirma/target/classes/.netbeans_automatic_build b/appletFirma/target/classes/.netbeans_automatic_build new file mode 100644 index 0000000..e69de29 diff --git a/appletFirma/target/classes/com/fp/firma/applet/FirmaApplet$1.class b/appletFirma/target/classes/com/fp/firma/applet/FirmaApplet$1.class new file mode 100644 index 0000000..ebd2148 Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/applet/FirmaApplet$1.class differ diff --git a/appletFirma/target/classes/com/fp/firma/applet/FirmaApplet$2.class b/appletFirma/target/classes/com/fp/firma/applet/FirmaApplet$2.class new file mode 100644 index 0000000..74f9d13 Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/applet/FirmaApplet$2.class differ diff --git a/appletFirma/target/classes/com/fp/firma/applet/FirmaApplet$3.class b/appletFirma/target/classes/com/fp/firma/applet/FirmaApplet$3.class new file mode 100644 index 0000000..c2e7a76 Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/applet/FirmaApplet$3.class differ diff --git a/appletFirma/target/classes/com/fp/firma/applet/FirmaApplet$4.class b/appletFirma/target/classes/com/fp/firma/applet/FirmaApplet$4.class new file mode 100644 index 0000000..ce82788 Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/applet/FirmaApplet$4.class differ diff --git a/appletFirma/target/classes/com/fp/firma/applet/FirmaApplet$5.class b/appletFirma/target/classes/com/fp/firma/applet/FirmaApplet$5.class new file mode 100644 index 0000000..c43254a Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/applet/FirmaApplet$5.class differ diff --git a/appletFirma/target/classes/com/fp/firma/applet/FirmaApplet$6.class b/appletFirma/target/classes/com/fp/firma/applet/FirmaApplet$6.class new file mode 100644 index 0000000..417d08f Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/applet/FirmaApplet$6.class differ diff --git a/appletFirma/target/classes/com/fp/firma/applet/FirmaApplet.class b/appletFirma/target/classes/com/fp/firma/applet/FirmaApplet.class new file mode 100644 index 0000000..0586329 Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/applet/FirmaApplet.class differ diff --git a/appletFirma/target/classes/com/fp/firma/common/CertificateUtils.class b/appletFirma/target/classes/com/fp/firma/common/CertificateUtils.class new file mode 100644 index 0000000..3a9c1e0 Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/common/CertificateUtils.class differ diff --git a/appletFirma/target/classes/com/fp/firma/common/FirmMessages.class b/appletFirma/target/classes/com/fp/firma/common/FirmMessages.class new file mode 100644 index 0000000..47d4d90 Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/common/FirmMessages.class differ diff --git a/appletFirma/target/classes/com/fp/firma/common/FirmasException.class b/appletFirma/target/classes/com/fp/firma/common/FirmasException.class new file mode 100644 index 0000000..dca5274 Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/common/FirmasException.class differ diff --git a/appletFirma/target/classes/com/fp/firma/component/PasswordDialog$1.class b/appletFirma/target/classes/com/fp/firma/component/PasswordDialog$1.class new file mode 100644 index 0000000..e899881 Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/component/PasswordDialog$1.class differ diff --git a/appletFirma/target/classes/com/fp/firma/component/PasswordDialog.class b/appletFirma/target/classes/com/fp/firma/component/PasswordDialog.class new file mode 100644 index 0000000..07473e9 Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/component/PasswordDialog.class differ diff --git a/appletFirma/target/classes/com/fp/firma/dto/TfirmDatosFirmante.class b/appletFirma/target/classes/com/fp/firma/dto/TfirmDatosFirmante.class new file mode 100644 index 0000000..3cb8294 Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/dto/TfirmDatosFirmante.class differ diff --git a/appletFirma/target/classes/com/fp/firma/keystore/AppleKeyStoreProvider.class b/appletFirma/target/classes/com/fp/firma/keystore/AppleKeyStoreProvider.class new file mode 100644 index 0000000..74d5061 Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/keystore/AppleKeyStoreProvider.class differ diff --git a/appletFirma/target/classes/com/fp/firma/keystore/FileKeyStoreProvider.class b/appletFirma/target/classes/com/fp/firma/keystore/FileKeyStoreProvider.class new file mode 100644 index 0000000..b54a175 Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/keystore/FileKeyStoreProvider.class differ diff --git a/appletFirma/target/classes/com/fp/firma/keystore/KeyStoreProvider.class b/appletFirma/target/classes/com/fp/firma/keystore/KeyStoreProvider.class new file mode 100644 index 0000000..77c36bf Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/keystore/KeyStoreProvider.class differ diff --git a/appletFirma/target/classes/com/fp/firma/keystore/KeyStoreProviderFactory.class b/appletFirma/target/classes/com/fp/firma/keystore/KeyStoreProviderFactory.class new file mode 100644 index 0000000..c9a198e Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/keystore/KeyStoreProviderFactory.class differ diff --git a/appletFirma/target/classes/com/fp/firma/keystore/LinuxKeyStoreProvider.class b/appletFirma/target/classes/com/fp/firma/keystore/LinuxKeyStoreProvider.class new file mode 100644 index 0000000..8e0a8ec Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/keystore/LinuxKeyStoreProvider.class differ diff --git a/appletFirma/target/classes/com/fp/firma/keystore/MockKeyStoreProvider.class b/appletFirma/target/classes/com/fp/firma/keystore/MockKeyStoreProvider.class new file mode 100644 index 0000000..0ef6043 Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/keystore/MockKeyStoreProvider.class differ diff --git a/appletFirma/target/classes/com/fp/firma/keystore/PKCS11KeyStoreProvider.class b/appletFirma/target/classes/com/fp/firma/keystore/PKCS11KeyStoreProvider.class new file mode 100644 index 0000000..e3a699d Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/keystore/PKCS11KeyStoreProvider.class differ diff --git a/appletFirma/target/classes/com/fp/firma/keystore/SimpleCallbackHandler.class b/appletFirma/target/classes/com/fp/firma/keystore/SimpleCallbackHandler.class new file mode 100644 index 0000000..d626ab8 Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/keystore/SimpleCallbackHandler.class differ diff --git a/appletFirma/target/classes/com/fp/firma/keystore/WindowsJDK5KeyStoreProvider.class b/appletFirma/target/classes/com/fp/firma/keystore/WindowsJDK5KeyStoreProvider.class new file mode 100644 index 0000000..6fdeead Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/keystore/WindowsJDK5KeyStoreProvider.class differ diff --git a/appletFirma/target/classes/com/fp/firma/keystore/WindowsJDK5KeyStoreProvider_SD.class b/appletFirma/target/classes/com/fp/firma/keystore/WindowsJDK5KeyStoreProvider_SD.class new file mode 100644 index 0000000..3c1a6d9 Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/keystore/WindowsJDK5KeyStoreProvider_SD.class differ diff --git a/appletFirma/target/classes/com/fp/firma/keystore/WindowsJDK5KeyStoreProvider_iKey.class b/appletFirma/target/classes/com/fp/firma/keystore/WindowsJDK5KeyStoreProvider_iKey.class new file mode 100644 index 0000000..bdbb734 Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/keystore/WindowsJDK5KeyStoreProvider_iKey.class differ diff --git a/appletFirma/target/classes/com/fp/firma/keystore/WindowsJDK6KeyStoreProvider.class b/appletFirma/target/classes/com/fp/firma/keystore/WindowsJDK6KeyStoreProvider.class new file mode 100644 index 0000000..7668d4d Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/keystore/WindowsJDK6KeyStoreProvider.class differ diff --git a/appletFirma/target/classes/com/fp/firma/keystore/WindowsKeyStoreProvider.class b/appletFirma/target/classes/com/fp/firma/keystore/WindowsKeyStoreProvider.class new file mode 100644 index 0000000..26b575d Binary files /dev/null and b/appletFirma/target/classes/com/fp/firma/keystore/WindowsKeyStoreProvider.class differ diff --git a/appletFirma/target/classes/firmessages_es.properties b/appletFirma/target/classes/firmessages_es.properties new file mode 100644 index 0000000..2882ef5 --- /dev/null +++ b/appletFirma/target/classes/firmessages_es.properties @@ -0,0 +1,48 @@ +################################################### +##### S\u00edmbolos unicode +#####\u00e1 -> +#####\u00e9 -> +#####\u00ed -> +#####\u00f3 -> +#####\u00fa -> +#####\u00c1 -> +#####\u00c9 -> +#####\u00cd -> +#####\u00d3 -> +#####\u00da -> +#####\u00f1 -> +#####\u00d1 -> +#####\u0020 -> Espacio en blanco +################################################### + +#======================================================================================== +#=======CODIGO EXCEPCIONES=============================================================== +#======================================================================================== +FIR-0001=ERROR AL ESTABLECER CONEXI\u00D3N AL SERVICIO\: {0} +FIR-0002=ERROR, CERTIFICADO REVOCADO POR {0} CON FECHA {1} +FIR-0005=ERROR, ES OBLIGATORIO CARGAR UN ARCHIVO +FIR-0006=ERROR, LA CONTRASE\u00d1A INGRESADA ES INCORRECTA +FIR-0007=ERROR, EL CAMPO PASSWORD ES OBLIGATORIO +#======================================================================================== +#=======OIDs GENERALES DE IDENTIFICACION DEL USUARIO EN EL CERTIFICADO=================== +#======================================================================================== +oid.cedula_pasaporte=1.3.6.1.4.1.37947.3.1 +oid.nombres_persona=1.3.6.1.4.1.37947.3.2 +oid.apellido_persona1=1.3.6.1.4.1.37947.3.3 +oid.apellido_persona2=1.3.6.1.4.1.37947.3.4 +oid.cargo=1.3.6.1.4.1.37947.3.5 +oid.institucion=1.3.6.1.4.1.37947.3.6 +oid.direccion=1.3.6.1.4.1.37947.3.7 +oid.telefono=1.3.6.1.4.1.37947.3.8 +oid.ciudad=1.3.6.1.4.1.37947.3.9 +oid.razon_social=1.3.6.1.4.1.37947.3.10 +oid.ruc=1.3.6.1.4.1.37947.3.11 +#======================================================================================== +#=======RUTAS DE LOS DIRECTORIOS DEL REPOSITORIO DE CERTIFICADOS========================= +#======================================================================================== +dir.ruta.base.repositorio=/media/store/maia/jboss-eap-6.0/digital_repository +dir.nombre.carpeta.usuarios=users +nombre.certificado.raiz=CARAIZ.cer +nombre.certificado.subordinado=CASUBORDINADO.cer +service.url.address.ocsp=http://ocsp.digsigtrust.com:80 +#service.url.address.ocsp=http://ocsp.openvalidation.org:80 \ No newline at end of file diff --git a/appletFirma/target/maven-archiver/pom.properties b/appletFirma/target/maven-archiver/pom.properties new file mode 100644 index 0000000..05a72af --- /dev/null +++ b/appletFirma/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Wed Sep 07 09:13:14 ECT 2022 +version=2.1 +groupId=com.fp.firma +artifactId=appletFirma diff --git a/appletFirma/target/surefire-reports/TEST-com.fp.firma.applet.AppTest.xml b/appletFirma/target/surefire-reports/TEST-com.fp.firma.applet.AppTest.xml new file mode 100644 index 0000000..153c900 --- /dev/null +++ b/appletFirma/target/surefire-reports/TEST-com.fp.firma.applet.AppTest.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/appletFirma/target/surefire-reports/com.fp.firma.applet.AppTest.txt b/appletFirma/target/surefire-reports/com.fp.firma.applet.AppTest.txt new file mode 100644 index 0000000..f7043c5 --- /dev/null +++ b/appletFirma/target/surefire-reports/com.fp.firma.applet.AppTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: com.fp.firma.applet.AppTest +------------------------------------------------------------------------------- +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.022 sec diff --git a/appletFirma/target/test-classes/.netbeans_automatic_build b/appletFirma/target/test-classes/.netbeans_automatic_build new file mode 100644 index 0000000..e69de29 diff --git a/appletFirma/target/test-classes/com/fp/firma/applet/AppTest.class b/appletFirma/target/test-classes/com/fp/firma/applet/AppTest.class new file mode 100644 index 0000000..81d8a2f Binary files /dev/null and b/appletFirma/target/test-classes/com/fp/firma/applet/AppTest.class differ diff --git a/appletFirma/target/test-classes/com/fp/firma/applet/PruebaFirma.class b/appletFirma/target/test-classes/com/fp/firma/applet/PruebaFirma.class new file mode 100644 index 0000000..4f4b7b5 Binary files /dev/null and b/appletFirma/target/test-classes/com/fp/firma/applet/PruebaFirma.class differ diff --git a/base/.svn/entries b/base/.svn/entries new file mode 100644 index 0000000..a51fa9e --- /dev/null +++ b/base/.svn/entries @@ -0,0 +1,86 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base +svn://172.17.26.185/COMACO + + + +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +facadeclient +dir + +facade +dir + +persistence +dir + +dto +dir + +core +dir + +pom.xml +file + + + + +2022-07-28T03:40:46.966821Z +c232a48b461cc67137386d7589ab9a3e +2014-09-11T06:04:01.437037Z +655 +jvaca + + + + + + + + + + + + + + + + + + + + + +2675 + +business +dir + +sessionbeans +dir + +bpm +dir + diff --git a/base/.svn/text-base/pom.xml.svn-base b/base/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..b8baae0 --- /dev/null +++ b/base/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,82 @@ + + + + FlipBean + com.fp + 2.1 + + 4.0.0 + com.fp + base + Base + 2.1 + pom + + 6.1.0.Final + 6.1.0.Final + ISO-8859-1 + + + dto + bpm + persistence + core + business + facadeclient + facade + sessionbeans + + + + + + + + org.drools + drools-bom + pom + ${drools.version} + import + + + + + org.jbpm + jbpm-bom + pom + ${jbpm.version} + import + + + + + org.apache.poi + poi + 3.5-FINAL + jar + provided + + + org.apache.poi + poi-ooxml-schemas + 3.6 + jar + provided + + + org.apache.poi + poi-ooxml + 3.5-FINAL + jar + provided + + + org.apache.poi + ooxml-schemas + 1.0 + jar + provided + + + + diff --git a/base/bpm/.svn/entries b/base/bpm/.svn/entries new file mode 100644 index 0000000..c195e79 --- /dev/null +++ b/base/bpm/.svn/entries @@ -0,0 +1,71 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +bpmlib +dir + +simple +dir + +flows +dir + +pom.xml +file + + + + +2022-07-28T03:40:46.961821Z +4ba706af7eab765adb2a4e82b23f5687 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +714 + diff --git a/base/bpm/.svn/text-base/pom.xml.svn-base b/base/bpm/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..2537b32 --- /dev/null +++ b/base/bpm/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,22 @@ + + + + base + com.fp + 2.1 + + 4.0.0 + com.fp.base + bpm + bpm-jbpm + 2.1 + pom + BPM + + bpmlib + simple + + diff --git a/base/bpm/bpmlib/.svn/dir-prop-base b/base/bpm/bpmlib/.svn/dir-prop-base new file mode 100644 index 0000000..3e2a6f2 --- /dev/null +++ b/base/bpm/bpmlib/.svn/dir-prop-base @@ -0,0 +1,9 @@ +K 10 +svn:ignore +V 37 +.classpath +.project +.settings +target + +END diff --git a/base/bpm/bpmlib/.svn/entries b/base/bpm/bpmlib/.svn/entries new file mode 100644 index 0000000..dde369d --- /dev/null +++ b/base/bpm/bpmlib/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:46.310818Z +b77a781c02f2ae6238c01d704b9fbfb4 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +3609 + diff --git a/base/bpm/bpmlib/.svn/text-base/pom.xml.netbeans-base b/base/bpm/bpmlib/.svn/text-base/pom.xml.netbeans-base new file mode 100644 index 0000000..7483e5f --- /dev/null +++ b/base/bpm/bpmlib/.svn/text-base/pom.xml.netbeans-base @@ -0,0 +1,121 @@ + + + + bpm + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.bpm + bpmlib + fp Platform - BPMLib + + + org.jboss.spec.javax.ejb + jboss-ejb-api_3.1_spec + provided + + + com.fp.base.dto + dto + ${project.version} + compile + + + com.fp.base.dto + common + ${project.version} + compile + + + com.fp.base.persistence + pbpm + ${project.version} + compile + + + com.fp.base.persistence + pgeneral + ${project.version} + compile + + + com.fp.base.persistence + util + ${project.version} + compile + + + com.fp.base.bpm + simple + ${project.version} + + + com.fp.base.core + bpm + ${project.version} + + + org.hibernate + hibernate-entitymanager + + + + + org.jbpm + jbpm-flow + provided + + + org.jbpm + jbpm-flow-builder + provided + + + org.jbpm + jbpm-bpmn2 + provided + + + org.jbpm + jbpm-persistence-jpa + provided + + + org.jbpm + jbpm-human-task-core + provided + + + org.jbpm + jbpm-runtime-manager + provided + + + + org.kie + kie-api + provided + + + org.drools + drools-decisiontables + provided + + + org.jbpm + jbpm-kie-services + provided + + + + org.jboss.netty + netty + + + + + + + diff --git a/base/bpm/bpmlib/.svn/text-base/pom.xml.svn-base b/base/bpm/bpmlib/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..7483e5f --- /dev/null +++ b/base/bpm/bpmlib/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,121 @@ + + + + bpm + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.bpm + bpmlib + fp Platform - BPMLib + + + org.jboss.spec.javax.ejb + jboss-ejb-api_3.1_spec + provided + + + com.fp.base.dto + dto + ${project.version} + compile + + + com.fp.base.dto + common + ${project.version} + compile + + + com.fp.base.persistence + pbpm + ${project.version} + compile + + + com.fp.base.persistence + pgeneral + ${project.version} + compile + + + com.fp.base.persistence + util + ${project.version} + compile + + + com.fp.base.bpm + simple + ${project.version} + + + com.fp.base.core + bpm + ${project.version} + + + org.hibernate + hibernate-entitymanager + + + + + org.jbpm + jbpm-flow + provided + + + org.jbpm + jbpm-flow-builder + provided + + + org.jbpm + jbpm-bpmn2 + provided + + + org.jbpm + jbpm-persistence-jpa + provided + + + org.jbpm + jbpm-human-task-core + provided + + + org.jbpm + jbpm-runtime-manager + provided + + + + org.kie + kie-api + provided + + + org.drools + drools-decisiontables + provided + + + org.jbpm + jbpm-kie-services + provided + + + + org.jboss.netty + netty + + + + + + + diff --git a/base/bpm/bpmlib/pom.xml b/base/bpm/bpmlib/pom.xml new file mode 100644 index 0000000..7483e5f --- /dev/null +++ b/base/bpm/bpmlib/pom.xml @@ -0,0 +1,121 @@ + + + + bpm + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.bpm + bpmlib + fp Platform - BPMLib + + + org.jboss.spec.javax.ejb + jboss-ejb-api_3.1_spec + provided + + + com.fp.base.dto + dto + ${project.version} + compile + + + com.fp.base.dto + common + ${project.version} + compile + + + com.fp.base.persistence + pbpm + ${project.version} + compile + + + com.fp.base.persistence + pgeneral + ${project.version} + compile + + + com.fp.base.persistence + util + ${project.version} + compile + + + com.fp.base.bpm + simple + ${project.version} + + + com.fp.base.core + bpm + ${project.version} + + + org.hibernate + hibernate-entitymanager + + + + + org.jbpm + jbpm-flow + provided + + + org.jbpm + jbpm-flow-builder + provided + + + org.jbpm + jbpm-bpmn2 + provided + + + org.jbpm + jbpm-persistence-jpa + provided + + + org.jbpm + jbpm-human-task-core + provided + + + org.jbpm + jbpm-runtime-manager + provided + + + + org.kie + kie-api + provided + + + org.drools + drools-decisiontables + provided + + + org.jbpm + jbpm-kie-services + provided + + + + org.jboss.netty + netty + + + + + + + diff --git a/base/bpm/bpmlib/src/.svn/entries b/base/bpm/bpmlib/src/.svn/entries new file mode 100644 index 0000000..8415b0c --- /dev/null +++ b/base/bpm/bpmlib/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/base/bpm/bpmlib/src/main/.svn/entries b/base/bpm/bpmlib/src/main/.svn/entries new file mode 100644 index 0000000..8ad2f32 --- /dev/null +++ b/base/bpm/bpmlib/src/main/.svn/entries @@ -0,0 +1,37 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +config +dir + +resources +dir + diff --git a/base/bpm/bpmlib/src/main/config/.svn/entries b/base/bpm/bpmlib/src/main/config/.svn/entries new file mode 100644 index 0000000..08a7e20 --- /dev/null +++ b/base/bpm/bpmlib/src/main/config/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/config +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +jbpm-ds.xml +file + + + + +2022-07-28T03:40:46.021817Z +5f160b7b0a250b4b599c12e7ca877dbe +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +1258 + +jbpm-mysql-ds.xml +file + + + + +2022-07-28T03:40:46.021817Z +744ffdbece303ec631e545dad9807a29 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +2311 + +jbpm-oracle-ds.xml +file + + + + +2022-07-28T03:40:46.021817Z +d3b034ac33bcf0281efb4f60c7167e12 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +1304 + diff --git a/base/bpm/bpmlib/src/main/config/.svn/text-base/jbpm-ds.xml.svn-base b/base/bpm/bpmlib/src/main/config/.svn/text-base/jbpm-ds.xml.svn-base new file mode 100644 index 0000000..1890541 --- /dev/null +++ b/base/bpm/bpmlib/src/main/config/.svn/text-base/jbpm-ds.xml.svn-base @@ -0,0 +1,33 @@ + + + + jdbc/JBPM + false + jdbc:mysql://localhost:3306/jbpm + com.mysql.jdbc.Driver + root + + 5 + 20 + 80 + 0 + + MySql + + + + jdbc/TASKS + false + jdbc:mysql://localhost:3306/jbpm + com.mysql.jdbc.Driver + root + + 5 + 20 + 80 + 0 + + MySql + + + diff --git a/base/bpm/bpmlib/src/main/config/.svn/text-base/jbpm-mysql-ds.xml.svn-base b/base/bpm/bpmlib/src/main/config/.svn/text-base/jbpm-mysql-ds.xml.svn-base new file mode 100644 index 0000000..be62980 --- /dev/null +++ b/base/bpm/bpmlib/src/main/config/.svn/text-base/jbpm-mysql-ds.xml.svn-base @@ -0,0 +1,49 @@ + + + + + jdbc/JBPM + jdbc:mysql://localhost:3306/jbpm?autoReconnect=true&autoReconnectForPools=true + com.mysql.jdbc.jdbc2.optional.MysqlXADataSource + root + + org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter + org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker + 50 + 200 + 10 + + mySQL + + + + jdbc/TASKS + false + jdbc:mysql://localhost:3306/jbpm?autoReconnect=true&autoReconnectForPools=true + com.mysql.jdbc.Driver + root + + 50 + 200 + 80 + 0 + + MySql + + + diff --git a/base/bpm/bpmlib/src/main/config/.svn/text-base/jbpm-oracle-ds.xml.svn-base b/base/bpm/bpmlib/src/main/config/.svn/text-base/jbpm-oracle-ds.xml.svn-base new file mode 100644 index 0000000..de02e6b --- /dev/null +++ b/base/bpm/bpmlib/src/main/config/.svn/text-base/jbpm-oracle-ds.xml.svn-base @@ -0,0 +1,33 @@ + + + + jdbc/JBPM + false + jdbc:oracle:thin:@192.168.2.201:1521:maia + oracle.jdbc.driver.OracleDriver + jbpm5 + jbpm5 + 5 + 20 + 80 + 0 + + Oracle + + + + jdbc/TASKS + false + jdbc:oracle:thin:@192.168.2.201:1521:maia + oracle.jdbc.driver.OracleDriver + jbpm5 + jbpm5 + 5 + 20 + 80 + 0 + + Oracle + + + diff --git a/base/bpm/bpmlib/src/main/config/jbpm-ds.xml b/base/bpm/bpmlib/src/main/config/jbpm-ds.xml new file mode 100644 index 0000000..1890541 --- /dev/null +++ b/base/bpm/bpmlib/src/main/config/jbpm-ds.xml @@ -0,0 +1,33 @@ + + + + jdbc/JBPM + false + jdbc:mysql://localhost:3306/jbpm + com.mysql.jdbc.Driver + root + + 5 + 20 + 80 + 0 + + MySql + + + + jdbc/TASKS + false + jdbc:mysql://localhost:3306/jbpm + com.mysql.jdbc.Driver + root + + 5 + 20 + 80 + 0 + + MySql + + + diff --git a/base/bpm/bpmlib/src/main/config/jbpm-mysql-ds.xml b/base/bpm/bpmlib/src/main/config/jbpm-mysql-ds.xml new file mode 100644 index 0000000..be62980 --- /dev/null +++ b/base/bpm/bpmlib/src/main/config/jbpm-mysql-ds.xml @@ -0,0 +1,49 @@ + + + + + jdbc/JBPM + jdbc:mysql://localhost:3306/jbpm?autoReconnect=true&autoReconnectForPools=true + com.mysql.jdbc.jdbc2.optional.MysqlXADataSource + root + + org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter + org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker + 50 + 200 + 10 + + mySQL + + + + jdbc/TASKS + false + jdbc:mysql://localhost:3306/jbpm?autoReconnect=true&autoReconnectForPools=true + com.mysql.jdbc.Driver + root + + 50 + 200 + 80 + 0 + + MySql + + + diff --git a/base/bpm/bpmlib/src/main/config/jbpm-oracle-ds.xml b/base/bpm/bpmlib/src/main/config/jbpm-oracle-ds.xml new file mode 100644 index 0000000..de02e6b --- /dev/null +++ b/base/bpm/bpmlib/src/main/config/jbpm-oracle-ds.xml @@ -0,0 +1,33 @@ + + + + jdbc/JBPM + false + jdbc:oracle:thin:@192.168.2.201:1521:maia + oracle.jdbc.driver.OracleDriver + jbpm5 + jbpm5 + 5 + 20 + 80 + 0 + + Oracle + + + + jdbc/TASKS + false + jdbc:oracle:thin:@192.168.2.201:1521:maia + oracle.jdbc.driver.OracleDriver + jbpm5 + jbpm5 + 5 + 20 + 80 + 0 + + Oracle + + + diff --git a/base/bpm/bpmlib/src/main/java/.svn/entries b/base/bpm/bpmlib/src/main/java/.svn/entries new file mode 100644 index 0000000..7698b44 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/bpm/bpmlib/src/main/java/com/.svn/entries b/base/bpm/bpmlib/src/main/java/com/.svn/entries new file mode 100644 index 0000000..6bd7efe --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/.svn/entries b/base/bpm/bpmlib/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..99f25af --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +bpmlib +dir + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/.svn/entries b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/.svn/entries new file mode 100644 index 0000000..d2e9c56 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/.svn/entries @@ -0,0 +1,262 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com/fp/bpmlib +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +metadata +dir + +mail +dir + +transaction +dir + +db +dir + +RegisterFlow.java +file + + + + +2022-07-28T03:40:45.983817Z +e594d7732885e47395fdf9493697fdaf +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1607 + +ProcessUtil.java +file + + + + +2022-07-28T03:40:45.983817Z +84995a2be386c1530f5989305d3fcaaf +2015-08-05T10:41:30.517767Z +4258 +cpiedra + + + + + + + + + + + + + + + + + + + + + +8949 + +Flujo.java +file + + + + +2022-07-28T03:40:45.983817Z +200a41c049d9ffe84522bc5c199dfd34 +2014-12-16T10:20:52.870795Z +3535 +gbenavides + + + + + + + + + + + + + + + + + + + + + +4829 + +ejb +dir + +task +dir + +package-info.java +file + + + + +2022-07-28T03:40:45.984817Z +f48f5318cf41acb2aae161b000af3cf3 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +83 + +query +dir + +CustomSystemEventListener.java +file + + + + +2022-07-28T03:40:45.984817Z +e4c80e2dbef16d1ad1e188d1edbeaaa0 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +2563 + +messages +dir + +flow +dir + +Common.java +file + + + + +2022-07-28T03:40:45.984817Z +f09b36d41faf47cdfdb440498aa7d5fe +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +972 + +report +dir + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/.svn/text-base/Common.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/.svn/text-base/Common.java.svn-base new file mode 100644 index 0000000..566b1ff --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/.svn/text-base/Common.java.svn-base @@ -0,0 +1,48 @@ +/* + * + */ +package com.fp.bpmlib; + +import java.util.Date; + +// TODO: Auto-generated Javadoc +/** + * Class Common encargada de. + * + * @author gfiallos + */ +public final class Common { + + /** El valor de instance. */ + private static Common instance = null; + + /** + * Obtiene la única instancia de Common. + * + * @return única instancia de Common + */ + public static Common getInstance() { + synchronized (Common.class) { + if (Common.instance == null) { + Common.instance = new Common(); + } + return Common.instance; + } + } + + /** + * Crea una nueva instancia de common. + */ + private Common() { + } + + /** + * Obtiene el valor de current date. + * + * @return Valor de current date + * @throws Exception la exception + */ + public Date getCurrentDate() throws Exception { + return new Date(); + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/.svn/text-base/CustomSystemEventListener.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/.svn/text-base/CustomSystemEventListener.java.svn-base new file mode 100644 index 0000000..820ae64 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/.svn/text-base/CustomSystemEventListener.java.svn-base @@ -0,0 +1,115 @@ +/* + * + */ +package com.fp.bpmlib; + +import org.apache.log4j.Logger; + +// TODO: Auto-generated Javadoc + +/** + * The listener interface for receiving customSystemEvent events. The class that is interested in processing a + * customSystemEvent event implements this interface, and the object created with that class is registered with a + * component using the component's addCustomSystemEventListener method. When + * the customSystemEvent event occurs, that object's appropriate + * method is invoked. + * + */ +public class CustomSystemEventListener implements org.kie.internal.SystemEventListener { + + /** Constante LOG. */ + private static final Logger LOG = Logger.getLogger(CustomSystemEventListener.class); + + /** + * Debug. + * + * @param message the message + */ + @Override + public void debug(String message) { + CustomSystemEventListener.LOG.debug(message); + + } + + /** + * Debug. + * + * @param message the message + * @param object the object + */ + @Override + public void debug(String message, Object object) { + CustomSystemEventListener.LOG.debug(message + " " + object); + + } + + /** + * Exception. + * + * @param message the message + * @param e the e + */ + @Override + public void exception(String message, Throwable e) { + CustomSystemEventListener.LOG.error(message, e); + + } + + /** + * Exception. + * + * @param e the e + */ + @Override + public void exception(Throwable e) { + CustomSystemEventListener.LOG.error(e, e); + + } + + /** + * Info. + * + * @param message the message + */ + @Override + public void info(String message) { + CustomSystemEventListener.LOG.info(message); + + } + + /** + * Info. + * + * @param message the message + * @param object the object + */ + @Override + public void info(String message, Object object) { + CustomSystemEventListener.LOG.info(message + " " + object); + + } + + /** + * Warning. + * + * @param message the message + */ + @Override + public void warning(String message) { + CustomSystemEventListener.LOG.warn(message); + + } + + /** + * Warning. + * + * @param message the message + * @param object the object + */ + @Override + public void warning(String message, Object object) { + CustomSystemEventListener.LOG.warn(message + " " + object); + + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/.svn/text-base/Flujo.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/.svn/text-base/Flujo.java.svn-base new file mode 100644 index 0000000..9bec368 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/.svn/text-base/Flujo.java.svn-base @@ -0,0 +1,137 @@ +package com.fp.bpmlib; + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +import javax.naming.InitialContext; + +import org.jbpm.process.instance.event.listeners.TriggerRulesEventListener; +import org.jbpm.services.task.lifecycle.listeners.BAMTaskEventListener; +import org.jbpm.services.task.lifecycle.listeners.TaskLifeCycleEventListener; +import org.kie.api.runtime.KieSession; +import org.kie.api.runtime.manager.RuntimeEngine; +import org.kie.api.runtime.manager.RuntimeManager; +import org.kie.api.runtime.process.ProcessInstance; +import org.kie.api.task.TaskService; +import org.kie.internal.task.api.EventService; + +import com.fp.base.persistence.util.helper.MessageManager; +import com.fp.bpmlib.ejb.local.JbpmBeanLocal; +import com.fp.bpmlib.task.MaiaWorkItemHandler; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.save.SaveRequest; +import com.fp.simple.flow.DataMap; + +/** + * Class encargada del inicio de un flujo de trabajo. + * + * @author jvaca + * @version 2.1 + */ +public class Flujo { + + private KieSession kiesession; + private ProcessInstance processInstance = null; + private TaskService taskService; + /** + * Crea una instancia de flujo. + */ + public Flujo() throws Exception{ + JbpmBeanLocal local = (JbpmBeanLocal) new InitialContext().lookup("java:global/maiaear-2.1/bpmlib/jbpmbean"); + RuntimeManager manager = local.getRuntimeManager(); + RuntimeEngine runtime = manager.getRuntimeEngine(null); + taskService = runtime.getTaskService(); + kiesession = runtime.getKieSession(); + kiesession.addEventListener(new TriggerRulesEventListener(kiesession)); + kiesession.getWorkItemManager().registerWorkItemHandler("Human Task", new MaiaWorkItemHandler()); + this.addListeners(runtime); + } + + /** + * Crea una instancia de flujo y obtiene una instancia del proceso. + * @param processid Id de una instancia de proceso. + * @throws Exception + */ + public Flujo(Long processid) throws Exception { + this(); + processInstance = kiesession.getProcessInstance(processid); + } + + /** + * Adiciona listener, para el manejo del bam de tareas. + * @param engine + */ + @SuppressWarnings("unchecked") + private void addListeners(RuntimeEngine engine) { + EventService eventService = (EventService) engine.getTaskService(); + boolean hasBamEventListener = false; + for (TaskLifeCycleEventListener listener : eventService.getTaskEventListeners()) { + if (listener instanceof BAMTaskEventListener) { + hasBamEventListener = true; + break; + } + } + if (!hasBamEventListener) { + BAMTaskEventListener bamTaskEventListener = new BAMTaskEventListener(); + eventService.registerTaskEventListener(bamTaskEventListener); + } + } + + /** + * Inicia la ejecucion de un flujo de trabajo. + * @param flujo Id del flujo se toma del archivo.jbpm + * @param parametros Parametros con los que inicia la ejeccion de un flujo. + * @throws Exception + */ + public Long iniciar(String idproceso, Request request) throws Exception { + APPLogger.getLogger().info("Prepara Flujo"); + //Se crea un nuevo request para grabar en el bpm la minima informacion. + SaveRequest sr = new SaveRequest(); + sr.setJsf(true); + request.copy(sr); + request.copyMapValuesWithOutSaveBean(sr); + sr.mbeans.clear(); + sr.remove("MSAVE"); + sr.remove("MQUERY"); + sr.remove("lOrderPersistentBeans"); + sr.setResponse(null); + + + Map m = new HashMap(); + m.put(ProcessUtil.TASKS_METADATA, new LinkedHashMap()); + Map data = new DataMap(); + // Map data = new HashMap<>(); + if ((sr.getSubject() == null) || (sr.getSubject().compareTo("") == 0)) { + sr.setSubject(MessageManager.getMessage(request)); + } + data.put(ProcessUtil.REQUEST, sr); + m.put(ProcessUtil.DATA, data); + + processInstance = kiesession.startProcess(idproceso, m); + + APPLogger.getLogger().info("Flujo preparado"); + + return processInstance.getId(); + } + + /** + * Cierra la session de trabajo. + */ + public void close() { + // no cerrar la session, esta se cierra en el commit trabaja con JTA. + } + + public KieSession getKiesession() { + return kiesession; + } + + public ProcessInstance getProcessInstance() { + return processInstance; + } + + + + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/.svn/text-base/ProcessUtil.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/.svn/text-base/ProcessUtil.java.svn-base new file mode 100644 index 0000000..b6a7919 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/.svn/text-base/ProcessUtil.java.svn-base @@ -0,0 +1,252 @@ +/* + * + */ +package com.fp.bpmlib; + +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.jbpm.services.task.audit.impl.model.BAMTaskSummaryImpl; +import org.kie.api.task.model.Task; +import org.kie.api.task.model.TaskData; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpmlib.db.DataHelper; +import com.fp.bpmlib.flow.Monitor; +import com.fp.dto.Request; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.log.TgeneTransactionLog; +import com.fp.simple.dto.TaskInfo; + +// TODO: Auto-generated Javadoc +/** + * Class ProcessUtil encargada de. + * + * @author gfiallos + */ +public final class ProcessUtil { + + /** Constante ACTUAL_TASK. */ + public static final String ACTUAL_TASK = "actualTask"; + + /** Constante DATA. */ + public static final String DATA = "maia"; + + /** El valor de instance. */ + private static ProcessUtil instance = null; + + /** Constante PID. */ + public static final String PID = "pid"; + + /** Constante REQUEST. */ + public static final String REQUEST = "request"; + + /** Constante SNAPSHOT. */ + public static final String SNAPSHOT = "snapshot"; + + /** Constante TASK_METADATA. */ + public static final String TASK_METADATA = "taskMetaData"; + + /** Constante TASKS_METADATA. */ + public static final String TASKS_METADATA = "tasksMetaData"; + + /** + * Obtiene el valor de done task meta data. + * + * @param pProcess the process + * @param pName the name + * @return Valor de done task meta data + * @throws Exception la exception + */ + @SuppressWarnings("unchecked") + public static Object getDoneTaskMetaData(Monitor monitor, String pName) throws Exception { + Object tasks = monitor.getVariable(ProcessUtil.TASKS_METADATA); + if (tasks != null) { + Map m = (Map) tasks; + Map record = new HashMap(); + record.put(pName, ProcessUtil.manageHistory(monitor,(List) m.get(pName))); + return record; + } + return null; + } + + /** + * Obtiene el valor de first done task meta data. + * + * @param pProcess the process + * @return Valor de first done task meta data + * @throws Exception la exception + */ + @SuppressWarnings("unchecked") + public static Map getFirstDoneTaskMetaData(Monitor monitor) throws Exception { + Object tasks = monitor.getVariable(ProcessUtil.TASKS_METADATA); + if (tasks != null) { + Map m = (Map) tasks; + for (Entry entry : m.entrySet()) { + Map record = new HashMap(); + record.put(entry.getKey(), ProcessUtil.getDoneTaskMetaData(monitor, entry.getKey())); + return record; + } + } + return null; + } + + /** + * Obtiene la única instancia de ProcessUtil. + * + * @return única instancia de ProcessUtil + */ + public static ProcessUtil getInstance() { + synchronized (ProcessUtil.class) { + if (ProcessUtil.instance == null) { + ProcessUtil.instance = new ProcessUtil(); + } + return ProcessUtil.instance; + } + } + + /** + * Manage history. + * + * @param pHistory the history + * @return list + * @throws Exception la exception + */ + protected static List manageHistory(Monitor monitor,List pHistory) throws Exception { + if (pHistory == null) { + return null; + } + for (TaskInfo taskInfo : pHistory) { + Object tid = taskInfo.getTaskId(); + if (tid == null) { + tid = taskInfo.getTaskId(); + } + if (tid != null) { + ProcessUtil.manageTaskId(monitor, taskInfo, Long.valueOf("" + tid)); + } + } + return pHistory; + } + + /** + * Manage task id. + * + * @param pTask the task + * @param pTID the tID + * @throws Exception la exception + */ + private static void manageTaskId(Monitor monitor,TaskInfo pTask, Long pTID) throws Exception { + pTask.setTaskId(pTID); + Map aditionalData = pTask.getAditionalData(); + + Task t = monitor.getTaskService().getTaskById(pTID); + BAMTaskSummaryImpl bam = monitor.getBAMTaskSummaryImpl(pTID); + pTask.setCreated(new Timestamp(t.getTaskData().getCreatedOn().getTime()) ); + pTask.setStarted(new Timestamp(bam.getStartDate().getTime()) ); + pTask.setCompleted(new Timestamp(bam.getEndDate().getTime())); + TaskData td = t.getTaskData(); + aditionalData.put("status", td.getStatus().name()); + aditionalData.put("userId", td.getActualOwner().getId()); + aditionalData.put("name", GeneralDescriptions.getUsername(td.getActualOwner().getId())); + + } + + /** + * Crea una nueva instancia de process util. + */ + private ProcessUtil() { + } + + + /** + * Prepare record. + * + * @param pName the name + * @param pValue the value + * @param pRequest the request + * @param label the label + * @return map + * @throws Exception la exception + */ + public Map prepareRecord(String pName, Object pValue, Request pRequest, boolean label) throws Exception { + Map m = new HashMap(); + if (label) { + m.put("NAME", GeneralDescriptions.getLabel(pName, pRequest.getLanguage(), pRequest.getChannelCode())); + } else { + m.put("NAME", pName); + } + m.put("VALUE", pValue); + m.put("CODE", pName); + return m; + } + + /** + * Prepare record. + * + * @param pName the name + * @param pValue the value + * @param pRequest the request + * @return map + * @throws Exception la exception + */ + public Map prepareRecord(String pName, Object pValue, Request pRequest) throws Exception { + return this.prepareRecord(pName, pValue, pRequest, true); + } + + + + /** + * Transaction data. + * + * @param pJournalId the journal id + * @param pRequest the request + * @param label the label + * @return list + * @throws Exception la exception + */ + public List> transactionData(String pJournalId, Request pRequest, boolean label) throws Exception { + TgeneTransactionLog log = TgeneTransactionLog.find(PersistenceHelper.getEntityManager(), pJournalId); + List> data = new ArrayList>(); + SimpleDateFormat sdf = DataHelper.getInstance().getDateTimeFormat(pRequest.getCompany()); + + if(log!=null){ + + + data.add(this.prepareRecord("creationdate", sdf.format(log.getRealdate()), pRequest, label)); + data.add(this.prepareRecord("user", log.getUsercode(), pRequest, label)); + data.add(this.prepareRecord("name", GeneralDescriptions.getOfficername(log.getUsercode()), pRequest, label)); + data.add(this.prepareRecord("email", GeneralDescriptions.getEmailByUser(log.getUsercode()), pRequest, label)); + data.add(this.prepareRecord("branch", + log.getBranchcode() + " " + GeneralDescriptions.getBranchdesc(log.getBranchcode(), pRequest.getCompany()), pRequest, label)); + data.add(this.prepareRecord("office", + log.getOfficecode() + " " + GeneralDescriptions.getOfficedesc(log.getOfficecode(), log.getBranchcode(), pRequest.getCompany()), + pRequest, label)); + + data.add(this.prepareRecord("transaction", log.getTransactionmodule() + "-" + log.getTransactioncode() + "-" + log.getTransactionversion() + + " " + GeneralDescriptions.getTransactiondesc(log.getTransactionmodule(), log.getTransactioncode(), log.getTransactionversion()), + pRequest, label)); + if (log.getAditionaldata() != null) { + data.add(this.prepareRecord("message", log.getAditionaldata(), pRequest, label)); + } + + } + return data; + } + + /** + * Transaction data. + * + * @param pJournalId the journal id + * @param pRequest the request + * @return list + * @throws Exception la exception + */ + public List> transactionData(String pJournalId, Request pRequest) throws Exception { + return this.transactionData(pJournalId, pRequest, true); + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/.svn/text-base/RegisterFlow.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/.svn/text-base/RegisterFlow.java.svn-base new file mode 100644 index 0000000..36f2234 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/.svn/text-base/RegisterFlow.java.svn-base @@ -0,0 +1,63 @@ +/* + * + */ +package com.fp.bpmlib; + +import com.fp.common.helper.Constant; +import com.fp.common.logger.APPLogger; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pbpm.gene.TbpmProcessInstance; + + +/** + * Class RegisterFlow encargada de. + * + * @author jvaca + * @version 2.1 + */ +public class RegisterFlow { + + + /** El valor de process. */ + private Flujo flujo; + + /** El valor de request. */ + private SaveRequest request; + + + /** + * Crea una nueva instancia de register flow. + * + * @param pProcess the process + * @param pRequest the request + * @param pCompany the company + * @throws Exception la exception + */ + public RegisterFlow(Flujo flujo, SaveRequest pRequest) throws Exception { + this.flujo = flujo; + this.request = pRequest; + } + + + + /** + * Register flow. + * + * @throws Exception la exception + */ + public void registerFlow() throws Exception { + APPLogger.getLogger().info("registro Instancia de Flujo"); + TbpmProcessInstance pi = new TbpmProcessInstance(this.request.getJournalId(), this.flujo.getKiesession().getId(), FormatDates.getInstance() + .getDataBaseDate()); + pi.setProcessid(this.flujo.getProcessInstance().getId()); + pi.setFinalized(Constant.STR_N); + PersistenceHelper.persist(pi); + APPLogger.getLogger().info("Graba Instancia de Flujo " + pi.getProcessid()); + + } + + + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/.svn/text-base/package-info.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..aaa706e --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,4 @@ +/** + * Provee los utilitarios para el acceso a GUVNOR + */ +package com.fp.bpmlib; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/Common.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/Common.java new file mode 100644 index 0000000..566b1ff --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/Common.java @@ -0,0 +1,48 @@ +/* + * + */ +package com.fp.bpmlib; + +import java.util.Date; + +// TODO: Auto-generated Javadoc +/** + * Class Common encargada de. + * + * @author gfiallos + */ +public final class Common { + + /** El valor de instance. */ + private static Common instance = null; + + /** + * Obtiene la única instancia de Common. + * + * @return única instancia de Common + */ + public static Common getInstance() { + synchronized (Common.class) { + if (Common.instance == null) { + Common.instance = new Common(); + } + return Common.instance; + } + } + + /** + * Crea una nueva instancia de common. + */ + private Common() { + } + + /** + * Obtiene el valor de current date. + * + * @return Valor de current date + * @throws Exception la exception + */ + public Date getCurrentDate() throws Exception { + return new Date(); + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/CustomSystemEventListener.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/CustomSystemEventListener.java new file mode 100644 index 0000000..820ae64 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/CustomSystemEventListener.java @@ -0,0 +1,115 @@ +/* + * + */ +package com.fp.bpmlib; + +import org.apache.log4j.Logger; + +// TODO: Auto-generated Javadoc + +/** + * The listener interface for receiving customSystemEvent events. The class that is interested in processing a + * customSystemEvent event implements this interface, and the object created with that class is registered with a + * component using the component's addCustomSystemEventListener method. When + * the customSystemEvent event occurs, that object's appropriate + * method is invoked. + * + */ +public class CustomSystemEventListener implements org.kie.internal.SystemEventListener { + + /** Constante LOG. */ + private static final Logger LOG = Logger.getLogger(CustomSystemEventListener.class); + + /** + * Debug. + * + * @param message the message + */ + @Override + public void debug(String message) { + CustomSystemEventListener.LOG.debug(message); + + } + + /** + * Debug. + * + * @param message the message + * @param object the object + */ + @Override + public void debug(String message, Object object) { + CustomSystemEventListener.LOG.debug(message + " " + object); + + } + + /** + * Exception. + * + * @param message the message + * @param e the e + */ + @Override + public void exception(String message, Throwable e) { + CustomSystemEventListener.LOG.error(message, e); + + } + + /** + * Exception. + * + * @param e the e + */ + @Override + public void exception(Throwable e) { + CustomSystemEventListener.LOG.error(e, e); + + } + + /** + * Info. + * + * @param message the message + */ + @Override + public void info(String message) { + CustomSystemEventListener.LOG.info(message); + + } + + /** + * Info. + * + * @param message the message + * @param object the object + */ + @Override + public void info(String message, Object object) { + CustomSystemEventListener.LOG.info(message + " " + object); + + } + + /** + * Warning. + * + * @param message the message + */ + @Override + public void warning(String message) { + CustomSystemEventListener.LOG.warn(message); + + } + + /** + * Warning. + * + * @param message the message + * @param object the object + */ + @Override + public void warning(String message, Object object) { + CustomSystemEventListener.LOG.warn(message + " " + object); + + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/Flujo.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/Flujo.java new file mode 100644 index 0000000..9bec368 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/Flujo.java @@ -0,0 +1,137 @@ +package com.fp.bpmlib; + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +import javax.naming.InitialContext; + +import org.jbpm.process.instance.event.listeners.TriggerRulesEventListener; +import org.jbpm.services.task.lifecycle.listeners.BAMTaskEventListener; +import org.jbpm.services.task.lifecycle.listeners.TaskLifeCycleEventListener; +import org.kie.api.runtime.KieSession; +import org.kie.api.runtime.manager.RuntimeEngine; +import org.kie.api.runtime.manager.RuntimeManager; +import org.kie.api.runtime.process.ProcessInstance; +import org.kie.api.task.TaskService; +import org.kie.internal.task.api.EventService; + +import com.fp.base.persistence.util.helper.MessageManager; +import com.fp.bpmlib.ejb.local.JbpmBeanLocal; +import com.fp.bpmlib.task.MaiaWorkItemHandler; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.save.SaveRequest; +import com.fp.simple.flow.DataMap; + +/** + * Class encargada del inicio de un flujo de trabajo. + * + * @author jvaca + * @version 2.1 + */ +public class Flujo { + + private KieSession kiesession; + private ProcessInstance processInstance = null; + private TaskService taskService; + /** + * Crea una instancia de flujo. + */ + public Flujo() throws Exception{ + JbpmBeanLocal local = (JbpmBeanLocal) new InitialContext().lookup("java:global/maiaear-2.1/bpmlib/jbpmbean"); + RuntimeManager manager = local.getRuntimeManager(); + RuntimeEngine runtime = manager.getRuntimeEngine(null); + taskService = runtime.getTaskService(); + kiesession = runtime.getKieSession(); + kiesession.addEventListener(new TriggerRulesEventListener(kiesession)); + kiesession.getWorkItemManager().registerWorkItemHandler("Human Task", new MaiaWorkItemHandler()); + this.addListeners(runtime); + } + + /** + * Crea una instancia de flujo y obtiene una instancia del proceso. + * @param processid Id de una instancia de proceso. + * @throws Exception + */ + public Flujo(Long processid) throws Exception { + this(); + processInstance = kiesession.getProcessInstance(processid); + } + + /** + * Adiciona listener, para el manejo del bam de tareas. + * @param engine + */ + @SuppressWarnings("unchecked") + private void addListeners(RuntimeEngine engine) { + EventService eventService = (EventService) engine.getTaskService(); + boolean hasBamEventListener = false; + for (TaskLifeCycleEventListener listener : eventService.getTaskEventListeners()) { + if (listener instanceof BAMTaskEventListener) { + hasBamEventListener = true; + break; + } + } + if (!hasBamEventListener) { + BAMTaskEventListener bamTaskEventListener = new BAMTaskEventListener(); + eventService.registerTaskEventListener(bamTaskEventListener); + } + } + + /** + * Inicia la ejecucion de un flujo de trabajo. + * @param flujo Id del flujo se toma del archivo.jbpm + * @param parametros Parametros con los que inicia la ejeccion de un flujo. + * @throws Exception + */ + public Long iniciar(String idproceso, Request request) throws Exception { + APPLogger.getLogger().info("Prepara Flujo"); + //Se crea un nuevo request para grabar en el bpm la minima informacion. + SaveRequest sr = new SaveRequest(); + sr.setJsf(true); + request.copy(sr); + request.copyMapValuesWithOutSaveBean(sr); + sr.mbeans.clear(); + sr.remove("MSAVE"); + sr.remove("MQUERY"); + sr.remove("lOrderPersistentBeans"); + sr.setResponse(null); + + + Map m = new HashMap(); + m.put(ProcessUtil.TASKS_METADATA, new LinkedHashMap()); + Map data = new DataMap(); + // Map data = new HashMap<>(); + if ((sr.getSubject() == null) || (sr.getSubject().compareTo("") == 0)) { + sr.setSubject(MessageManager.getMessage(request)); + } + data.put(ProcessUtil.REQUEST, sr); + m.put(ProcessUtil.DATA, data); + + processInstance = kiesession.startProcess(idproceso, m); + + APPLogger.getLogger().info("Flujo preparado"); + + return processInstance.getId(); + } + + /** + * Cierra la session de trabajo. + */ + public void close() { + // no cerrar la session, esta se cierra en el commit trabaja con JTA. + } + + public KieSession getKiesession() { + return kiesession; + } + + public ProcessInstance getProcessInstance() { + return processInstance; + } + + + + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ProcessUtil.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ProcessUtil.java new file mode 100644 index 0000000..b6a7919 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ProcessUtil.java @@ -0,0 +1,252 @@ +/* + * + */ +package com.fp.bpmlib; + +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.jbpm.services.task.audit.impl.model.BAMTaskSummaryImpl; +import org.kie.api.task.model.Task; +import org.kie.api.task.model.TaskData; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpmlib.db.DataHelper; +import com.fp.bpmlib.flow.Monitor; +import com.fp.dto.Request; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.log.TgeneTransactionLog; +import com.fp.simple.dto.TaskInfo; + +// TODO: Auto-generated Javadoc +/** + * Class ProcessUtil encargada de. + * + * @author gfiallos + */ +public final class ProcessUtil { + + /** Constante ACTUAL_TASK. */ + public static final String ACTUAL_TASK = "actualTask"; + + /** Constante DATA. */ + public static final String DATA = "maia"; + + /** El valor de instance. */ + private static ProcessUtil instance = null; + + /** Constante PID. */ + public static final String PID = "pid"; + + /** Constante REQUEST. */ + public static final String REQUEST = "request"; + + /** Constante SNAPSHOT. */ + public static final String SNAPSHOT = "snapshot"; + + /** Constante TASK_METADATA. */ + public static final String TASK_METADATA = "taskMetaData"; + + /** Constante TASKS_METADATA. */ + public static final String TASKS_METADATA = "tasksMetaData"; + + /** + * Obtiene el valor de done task meta data. + * + * @param pProcess the process + * @param pName the name + * @return Valor de done task meta data + * @throws Exception la exception + */ + @SuppressWarnings("unchecked") + public static Object getDoneTaskMetaData(Monitor monitor, String pName) throws Exception { + Object tasks = monitor.getVariable(ProcessUtil.TASKS_METADATA); + if (tasks != null) { + Map m = (Map) tasks; + Map record = new HashMap(); + record.put(pName, ProcessUtil.manageHistory(monitor,(List) m.get(pName))); + return record; + } + return null; + } + + /** + * Obtiene el valor de first done task meta data. + * + * @param pProcess the process + * @return Valor de first done task meta data + * @throws Exception la exception + */ + @SuppressWarnings("unchecked") + public static Map getFirstDoneTaskMetaData(Monitor monitor) throws Exception { + Object tasks = monitor.getVariable(ProcessUtil.TASKS_METADATA); + if (tasks != null) { + Map m = (Map) tasks; + for (Entry entry : m.entrySet()) { + Map record = new HashMap(); + record.put(entry.getKey(), ProcessUtil.getDoneTaskMetaData(monitor, entry.getKey())); + return record; + } + } + return null; + } + + /** + * Obtiene la única instancia de ProcessUtil. + * + * @return única instancia de ProcessUtil + */ + public static ProcessUtil getInstance() { + synchronized (ProcessUtil.class) { + if (ProcessUtil.instance == null) { + ProcessUtil.instance = new ProcessUtil(); + } + return ProcessUtil.instance; + } + } + + /** + * Manage history. + * + * @param pHistory the history + * @return list + * @throws Exception la exception + */ + protected static List manageHistory(Monitor monitor,List pHistory) throws Exception { + if (pHistory == null) { + return null; + } + for (TaskInfo taskInfo : pHistory) { + Object tid = taskInfo.getTaskId(); + if (tid == null) { + tid = taskInfo.getTaskId(); + } + if (tid != null) { + ProcessUtil.manageTaskId(monitor, taskInfo, Long.valueOf("" + tid)); + } + } + return pHistory; + } + + /** + * Manage task id. + * + * @param pTask the task + * @param pTID the tID + * @throws Exception la exception + */ + private static void manageTaskId(Monitor monitor,TaskInfo pTask, Long pTID) throws Exception { + pTask.setTaskId(pTID); + Map aditionalData = pTask.getAditionalData(); + + Task t = monitor.getTaskService().getTaskById(pTID); + BAMTaskSummaryImpl bam = monitor.getBAMTaskSummaryImpl(pTID); + pTask.setCreated(new Timestamp(t.getTaskData().getCreatedOn().getTime()) ); + pTask.setStarted(new Timestamp(bam.getStartDate().getTime()) ); + pTask.setCompleted(new Timestamp(bam.getEndDate().getTime())); + TaskData td = t.getTaskData(); + aditionalData.put("status", td.getStatus().name()); + aditionalData.put("userId", td.getActualOwner().getId()); + aditionalData.put("name", GeneralDescriptions.getUsername(td.getActualOwner().getId())); + + } + + /** + * Crea una nueva instancia de process util. + */ + private ProcessUtil() { + } + + + /** + * Prepare record. + * + * @param pName the name + * @param pValue the value + * @param pRequest the request + * @param label the label + * @return map + * @throws Exception la exception + */ + public Map prepareRecord(String pName, Object pValue, Request pRequest, boolean label) throws Exception { + Map m = new HashMap(); + if (label) { + m.put("NAME", GeneralDescriptions.getLabel(pName, pRequest.getLanguage(), pRequest.getChannelCode())); + } else { + m.put("NAME", pName); + } + m.put("VALUE", pValue); + m.put("CODE", pName); + return m; + } + + /** + * Prepare record. + * + * @param pName the name + * @param pValue the value + * @param pRequest the request + * @return map + * @throws Exception la exception + */ + public Map prepareRecord(String pName, Object pValue, Request pRequest) throws Exception { + return this.prepareRecord(pName, pValue, pRequest, true); + } + + + + /** + * Transaction data. + * + * @param pJournalId the journal id + * @param pRequest the request + * @param label the label + * @return list + * @throws Exception la exception + */ + public List> transactionData(String pJournalId, Request pRequest, boolean label) throws Exception { + TgeneTransactionLog log = TgeneTransactionLog.find(PersistenceHelper.getEntityManager(), pJournalId); + List> data = new ArrayList>(); + SimpleDateFormat sdf = DataHelper.getInstance().getDateTimeFormat(pRequest.getCompany()); + + if(log!=null){ + + + data.add(this.prepareRecord("creationdate", sdf.format(log.getRealdate()), pRequest, label)); + data.add(this.prepareRecord("user", log.getUsercode(), pRequest, label)); + data.add(this.prepareRecord("name", GeneralDescriptions.getOfficername(log.getUsercode()), pRequest, label)); + data.add(this.prepareRecord("email", GeneralDescriptions.getEmailByUser(log.getUsercode()), pRequest, label)); + data.add(this.prepareRecord("branch", + log.getBranchcode() + " " + GeneralDescriptions.getBranchdesc(log.getBranchcode(), pRequest.getCompany()), pRequest, label)); + data.add(this.prepareRecord("office", + log.getOfficecode() + " " + GeneralDescriptions.getOfficedesc(log.getOfficecode(), log.getBranchcode(), pRequest.getCompany()), + pRequest, label)); + + data.add(this.prepareRecord("transaction", log.getTransactionmodule() + "-" + log.getTransactioncode() + "-" + log.getTransactionversion() + + " " + GeneralDescriptions.getTransactiondesc(log.getTransactionmodule(), log.getTransactioncode(), log.getTransactionversion()), + pRequest, label)); + if (log.getAditionaldata() != null) { + data.add(this.prepareRecord("message", log.getAditionaldata(), pRequest, label)); + } + + } + return data; + } + + /** + * Transaction data. + * + * @param pJournalId the journal id + * @param pRequest the request + * @return list + * @throws Exception la exception + */ + public List> transactionData(String pJournalId, Request pRequest) throws Exception { + return this.transactionData(pJournalId, pRequest, true); + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/RegisterFlow.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/RegisterFlow.java new file mode 100644 index 0000000..36f2234 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/RegisterFlow.java @@ -0,0 +1,63 @@ +/* + * + */ +package com.fp.bpmlib; + +import com.fp.common.helper.Constant; +import com.fp.common.logger.APPLogger; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pbpm.gene.TbpmProcessInstance; + + +/** + * Class RegisterFlow encargada de. + * + * @author jvaca + * @version 2.1 + */ +public class RegisterFlow { + + + /** El valor de process. */ + private Flujo flujo; + + /** El valor de request. */ + private SaveRequest request; + + + /** + * Crea una nueva instancia de register flow. + * + * @param pProcess the process + * @param pRequest the request + * @param pCompany the company + * @throws Exception la exception + */ + public RegisterFlow(Flujo flujo, SaveRequest pRequest) throws Exception { + this.flujo = flujo; + this.request = pRequest; + } + + + + /** + * Register flow. + * + * @throws Exception la exception + */ + public void registerFlow() throws Exception { + APPLogger.getLogger().info("registro Instancia de Flujo"); + TbpmProcessInstance pi = new TbpmProcessInstance(this.request.getJournalId(), this.flujo.getKiesession().getId(), FormatDates.getInstance() + .getDataBaseDate()); + pi.setProcessid(this.flujo.getProcessInstance().getId()); + pi.setFinalized(Constant.STR_N); + PersistenceHelper.persist(pi); + APPLogger.getLogger().info("Graba Instancia de Flujo " + pi.getProcessid()); + + } + + + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/db/.svn/entries b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/db/.svn/entries new file mode 100644 index 0000000..7233abc --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/db/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/db +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +package-info.java +file + + + + +2022-07-28T03:40:45.550815Z +04c6dd6eca1dcbaf9254eca0a4b012d4 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +97 + +DataHelper.java +file + + + + +2022-07-28T03:40:45.551815Z +4febe9b3b7b0480600fe25a1fff3426e +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +2520 + +BPMProperties.java +file + + + + +2022-07-28T03:40:45.551815Z +316bb8a6713e214fd46493fcd8a07993 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +2606 + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/db/.svn/text-base/BPMProperties.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/db/.svn/text-base/BPMProperties.java.svn-base new file mode 100644 index 0000000..010b71d --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/db/.svn/text-base/BPMProperties.java.svn-base @@ -0,0 +1,85 @@ +/* + * + */ +package com.fp.bpmlib.db; + +import com.fp.common.properties.PropertiesHandler; + +// TODO: Auto-generated Javadoc +/** + * Class BPMProperties encargada de. + * + * @author gfiallos + */ +public final class BPMProperties extends PropertiesHandler { + + /** Constante GUVNOR_URL. */ + public static final String GUVNOR_URL = "guvnor.url"; + + /** Constante GUVNOR_CHANGE_SET. */ + public static final String GUVNOR_CHANGE_SET = "guvnor.change.set"; + + /** Constante GUVNOR_REFRESH. */ + public static final String GUVNOR_REFRESH = "guvnor.refresh"; + + /** Constante BPM_MEMORY. */ + public static final String BPM_MEMORY = "bpm.memory"; + + /** Constante TASK_IP. */ + public static final String TASK_IP = "task.ip"; + + /** Constante TASK_IP_SERVER. */ + public static final String TASK_IP_SERVER = "task.ip.server"; + + /** Constante TASK_PORT. */ + public static final String TASK_PORT = "task.port"; + + /** Constante FLOWS_PACKAGE. */ + public static final String FLOWS_PACKAGE = "flows.package"; + + /** Constante FLOWS_SNAPSHOT. */ + public static final String FLOWS_SNAPSHOT = "flows.snapshot"; + + /** Constante INBOX_ICON_PATH. */ + public static final String INBOX_ICON_PATH = "inbox.icon.path"; + + /** Constante INBOX_ICON_EXTENSION. */ + public static final String INBOX_ICON_EXTENSION = "inbox.icon.extension"; + + /** Constante GUVNOR_SECURITY_BASIC_AUTHENTICATION. */ + public static final String GUVNOR_SECURITY_BASIC_AUTHENTICATION = "guvnor.security.basicAuthentication"; + + /** Constante GUVNOR_SECURITY_USERNAME. */ + public static final String GUVNOR_SECURITY_USERNAME = "guvnor.security.username"; + + /** Constante GUVNOR_SECURITY_PASSWORD. */ + public static final String GUVNOR_SECURITY_PASSWORD = "guvnor.security.password"; + + /** El valor de instance. */ + private static BPMProperties instance = null; + + /** + * Obtiene la Unica instancia de BPMProperties. + * + * @return Unica instancia de BPMProperties + * @throws Exception + */ + public static BPMProperties getInstance() throws Exception { + synchronized (BPMProperties.class) { + if (BPMProperties.instance == null) { + BPMProperties.instance = new BPMProperties(); + } + return BPMProperties.instance; + } + } + + /** + * Crea una nueva instancia de bPM properties. + * + * @throws Exception la exception + */ + private BPMProperties() throws Exception { + super("bpm"); + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/db/.svn/text-base/DataHelper.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/db/.svn/text-base/DataHelper.java.svn-base new file mode 100644 index 0000000..86318a8 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/db/.svn/text-base/DataHelper.java.svn-base @@ -0,0 +1,83 @@ +/* + * Acceso a Datos + */ +package com.fp.bpmlib.db; + +import java.text.SimpleDateFormat; + +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.HqlStatement; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pbpm.gene.TbpmProcessInstance; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; + +// TODO: Auto-generated Javadoc +/** + * Clase utilitaria para el manejo de Caché del proyecto BPMLIB. + * + * @author GF + * @version 2.1 + */ +public final class DataHelper { + + /** Almacena una instancia de DataHelper. */ + private static DataHelper cache; + + /** Constante HQL_PROCESS. */ + private static final String HQL_PROCESS = "from TbpmProcessInstance tb " + " where tb.processid=:pid "; + + /** + * Entrega una instancia de DataHelper. + * + * @return DataHelper + */ + public static DataHelper getInstance() { + synchronized (DataHelper.class) { + if (DataHelper.cache != null) { + return DataHelper.cache; + } + + if (DataHelper.cache == null) { + DataHelper.cache = new DataHelper(); + } + } + return DataHelper.cache; + } + + + + /** + * Obtiene el valor de date time format. + * + * @param pCompany the company + * @return Valor de date time format + * @throws Exception la exception + */ + public SimpleDateFormat getDateTimeFormat(Integer pCompany) throws Exception { + TgeneParametersKey k = new TgeneParametersKey("FORMATDATE", pCompany); + TgeneParameters f = TgeneParameters.find(PersistenceHelper.getEntityManager(), k); + return new SimpleDateFormat(f.getTextvalue() + " HH:mm"); + } + + + /** + * Obtiene el valor de tbpm process instance. + * + * @param pId the id + * @return Valor de tbpm process instance + * @throws Exception la exception + */ + public TbpmProcessInstance getTbpmProcessInstance(Long pId) throws Exception { + TbpmProcessInstance process = null; + HqlStatement hql = new HqlStatement(DataHelper.HQL_PROCESS); + hql.setLong("pid", pId); + process = hql.getObject(TbpmProcessInstance.class); + if (process == null) { + throw new GeneralException("BPM-0004", "LA INSTANCIA {0} NO ESTA DISPONIBLE O YA FUE FINALIZADA", pId); + } + return process; + } + + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/db/.svn/text-base/package-info.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/db/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..ca93261 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/db/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,4 @@ +/** + * Provee los utilitarios para el acceso a la Base de Datos. + */ +package com.fp.bpmlib.db; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/db/BPMProperties.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/db/BPMProperties.java new file mode 100644 index 0000000..010b71d --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/db/BPMProperties.java @@ -0,0 +1,85 @@ +/* + * + */ +package com.fp.bpmlib.db; + +import com.fp.common.properties.PropertiesHandler; + +// TODO: Auto-generated Javadoc +/** + * Class BPMProperties encargada de. + * + * @author gfiallos + */ +public final class BPMProperties extends PropertiesHandler { + + /** Constante GUVNOR_URL. */ + public static final String GUVNOR_URL = "guvnor.url"; + + /** Constante GUVNOR_CHANGE_SET. */ + public static final String GUVNOR_CHANGE_SET = "guvnor.change.set"; + + /** Constante GUVNOR_REFRESH. */ + public static final String GUVNOR_REFRESH = "guvnor.refresh"; + + /** Constante BPM_MEMORY. */ + public static final String BPM_MEMORY = "bpm.memory"; + + /** Constante TASK_IP. */ + public static final String TASK_IP = "task.ip"; + + /** Constante TASK_IP_SERVER. */ + public static final String TASK_IP_SERVER = "task.ip.server"; + + /** Constante TASK_PORT. */ + public static final String TASK_PORT = "task.port"; + + /** Constante FLOWS_PACKAGE. */ + public static final String FLOWS_PACKAGE = "flows.package"; + + /** Constante FLOWS_SNAPSHOT. */ + public static final String FLOWS_SNAPSHOT = "flows.snapshot"; + + /** Constante INBOX_ICON_PATH. */ + public static final String INBOX_ICON_PATH = "inbox.icon.path"; + + /** Constante INBOX_ICON_EXTENSION. */ + public static final String INBOX_ICON_EXTENSION = "inbox.icon.extension"; + + /** Constante GUVNOR_SECURITY_BASIC_AUTHENTICATION. */ + public static final String GUVNOR_SECURITY_BASIC_AUTHENTICATION = "guvnor.security.basicAuthentication"; + + /** Constante GUVNOR_SECURITY_USERNAME. */ + public static final String GUVNOR_SECURITY_USERNAME = "guvnor.security.username"; + + /** Constante GUVNOR_SECURITY_PASSWORD. */ + public static final String GUVNOR_SECURITY_PASSWORD = "guvnor.security.password"; + + /** El valor de instance. */ + private static BPMProperties instance = null; + + /** + * Obtiene la Unica instancia de BPMProperties. + * + * @return Unica instancia de BPMProperties + * @throws Exception + */ + public static BPMProperties getInstance() throws Exception { + synchronized (BPMProperties.class) { + if (BPMProperties.instance == null) { + BPMProperties.instance = new BPMProperties(); + } + return BPMProperties.instance; + } + } + + /** + * Crea una nueva instancia de bPM properties. + * + * @throws Exception la exception + */ + private BPMProperties() throws Exception { + super("bpm"); + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/db/DataHelper.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/db/DataHelper.java new file mode 100644 index 0000000..86318a8 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/db/DataHelper.java @@ -0,0 +1,83 @@ +/* + * Acceso a Datos + */ +package com.fp.bpmlib.db; + +import java.text.SimpleDateFormat; + +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.HqlStatement; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pbpm.gene.TbpmProcessInstance; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; + +// TODO: Auto-generated Javadoc +/** + * Clase utilitaria para el manejo de Caché del proyecto BPMLIB. + * + * @author GF + * @version 2.1 + */ +public final class DataHelper { + + /** Almacena una instancia de DataHelper. */ + private static DataHelper cache; + + /** Constante HQL_PROCESS. */ + private static final String HQL_PROCESS = "from TbpmProcessInstance tb " + " where tb.processid=:pid "; + + /** + * Entrega una instancia de DataHelper. + * + * @return DataHelper + */ + public static DataHelper getInstance() { + synchronized (DataHelper.class) { + if (DataHelper.cache != null) { + return DataHelper.cache; + } + + if (DataHelper.cache == null) { + DataHelper.cache = new DataHelper(); + } + } + return DataHelper.cache; + } + + + + /** + * Obtiene el valor de date time format. + * + * @param pCompany the company + * @return Valor de date time format + * @throws Exception la exception + */ + public SimpleDateFormat getDateTimeFormat(Integer pCompany) throws Exception { + TgeneParametersKey k = new TgeneParametersKey("FORMATDATE", pCompany); + TgeneParameters f = TgeneParameters.find(PersistenceHelper.getEntityManager(), k); + return new SimpleDateFormat(f.getTextvalue() + " HH:mm"); + } + + + /** + * Obtiene el valor de tbpm process instance. + * + * @param pId the id + * @return Valor de tbpm process instance + * @throws Exception la exception + */ + public TbpmProcessInstance getTbpmProcessInstance(Long pId) throws Exception { + TbpmProcessInstance process = null; + HqlStatement hql = new HqlStatement(DataHelper.HQL_PROCESS); + hql.setLong("pid", pId); + process = hql.getObject(TbpmProcessInstance.class); + if (process == null) { + throw new GeneralException("BPM-0004", "LA INSTANCIA {0} NO ESTA DISPONIBLE O YA FUE FINALIZADA", pId); + } + return process; + } + + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/db/package-info.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/db/package-info.java new file mode 100644 index 0000000..ca93261 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/db/package-info.java @@ -0,0 +1,4 @@ +/** + * Provee los utilitarios para el acceso a la Base de Datos. + */ +package com.fp.bpmlib.db; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/.svn/entries b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/.svn/entries new file mode 100644 index 0000000..32627de --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/.svn/entries @@ -0,0 +1,99 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb +svn://172.17.26.185/COMACO + + + +2015-02-22T10:57:32.256273Z +3844 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +local +dir + +LogMailBean.java +file + + + + +2022-07-28T03:40:45.746816Z +2532097cd036a6e3014184f23a36054d +2015-02-22T10:57:32.256273Z +3844 +cpiedra + + + + + + + + + + + + + + + + + + + + + +3008 + +JbpmBean.java +file + + + + +2022-07-28T03:40:45.746816Z +ec28a4f58519779c3fd2ad0aa916e3a9 +2014-11-04T10:22:15.189612Z +2294 +jvaca + + + + + + + + + + + + + + + + + + + + + +4068 + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/.svn/text-base/JbpmBean.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/.svn/text-base/JbpmBean.java.svn-base new file mode 100644 index 0000000..6860587 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/.svn/text-base/JbpmBean.java.svn-base @@ -0,0 +1,123 @@ +package com.fp.bpmlib.ejb; + +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.ejb.Singleton; +import javax.ejb.Startup; +import javax.persistence.EntityManagerFactory; +import javax.persistence.PersistenceUnit; + +import org.kie.api.io.ResourceType; +import org.kie.api.runtime.EnvironmentName; +import org.kie.api.runtime.manager.RuntimeEnvironment; +import org.kie.api.runtime.manager.RuntimeEnvironmentBuilder; +import org.kie.api.runtime.manager.RuntimeManager; +import org.kie.api.runtime.manager.RuntimeManagerFactory; +import org.kie.internal.io.ResourceFactory; + +import com.fp.bpmlib.ejb.local.JbpmBeanLocal; +import com.fp.bpmlib.task.util.MaiaUserGroupCallback; +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; +import com.fp.persistence.pbpm.gene.TbpmRules; + +/** + * Clase utilitaria, utilizada para creacion de base de conocimento y RuntimeManager + * + * @author Jvc + * @version 2.1 + */ +@Startup +@Singleton(name = "jbpmbean") +public class JbpmBean implements JbpmBeanLocal { + @PersistenceUnit(unitName = "org.jbpm.domain") + private EntityManagerFactory emf; + + private RuntimeManager runtimemanager; + + @PostConstruct + private final void crearSingletonManager() { + try { + if (emf == null) { + emf = PersistenceManager.getInstance().getEntityManagerFactoryAuxiliar("org.jbpm.domain"); + } + } catch (Exception e) { + APPLogger.getLogger().error(e); + } + } + + @PreDestroy + private void close() { + try { + runtimemanager.close(); + } catch (Exception e) { + // no hacer nada. + } + + } + + /** + * Crea un RuntimeManagerFactory. + * + * @param emf Entiy manager factury utilizado en el manejo de flujos de trabajo. + * @return RuntimeEnvironment + * @throws Exception + */ + private RuntimeEnvironment crearRuntimeManager(EntityManagerFactory emf) throws Exception { + + MaiaUserGroupCallback usergroupCallback = new MaiaUserGroupCallback(); + RuntimeEnvironmentBuilder builder = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder().entityManagerFactory(emf); + builder.userGroupCallback(usergroupCallback); + + this.adicionarFlujos(builder); + + RuntimeEnvironment environment = builder.get(); + environment.getEnvironment().set(EnvironmentName.USE_PESSIMISTIC_LOCKING, true); + + return environment; + } + + @Override + public RuntimeManager getRuntimeManager() throws Exception { + + if (runtimemanager == null) { + RuntimeEnvironment environment = this.crearRuntimeManager(emf); + runtimemanager = RuntimeManagerFactory.Factory.get().newPerRequestRuntimeManager(environment); + } + return runtimemanager; + } + + /** + * Adiciona definiciones de flujos a un map con los cuales se crea la base de conocimiento. + * + * @param resources Map que contiene definicion de flujos y reglas con los cuales se crea la base de conocimiento. + * @throws Exception + */ + private void adicionarFlujos(RuntimeEnvironmentBuilder builder) throws Exception { + + List ldata = TbpmRules.findRules(PersistenceHelper.getEntityManager()); + + // adiciona subprocesos. + for (TbpmRules obj : ldata) { + if (obj.getFiletype().equals("F")) { + builder.addAsset(ResourceFactory.newClassPathResource(obj.getPath(), "UTF-8"), ResourceType.BPMN2); + } else { + builder.addAsset(ResourceFactory.newClassPathResource(obj.getPath(), "UTF-8"), ResourceType.DTABLE); + } + } + } + + /** + * Entrega el entitymanagerfactory asociado al manejo de jbpm. + * + * @return + */ + @Override + public EntityManagerFactory getEmf() { + return emf; + } + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/.svn/text-base/LogMailBean.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/.svn/text-base/LogMailBean.java.svn-base new file mode 100644 index 0000000..bb0d140 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/.svn/text-base/LogMailBean.java.svn-base @@ -0,0 +1,94 @@ +package com.fp.bpmlib.ejb; + +import java.sql.Timestamp; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.ejb.Stateless; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; + +import com.fp.bpmlib.ejb.local.LogMailBeanLocal; +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.pbpm.gene.TbpmLogMail; + +/** + * Clase utilitaria, utilizada para creacion de base de conocimento y RuntimeManager + * + * @author Jvc + * @version 2.1 + */ +@Stateless(name="logMailBean") +public class LogMailBean implements LogMailBeanLocal { +// @PersistenceUnit(unitName = "local1") + private EntityManagerFactory emf; + + @PostConstruct + private final void crearManager() { + try { + if (emf == null) { + Map configOverrides = new HashMap(); + configOverrides.put("hibernate.ejb.cfgfile", "hibernateFlipMapping.cfg.xml"); + emf = Persistence.createEntityManagerFactory("local1" , configOverrides); + } + SessionData sessionData = new SessionData(); + sessionData.setCompany(1); + sessionData.setIsEjb(Boolean.FALSE); + ThreadFacade.setSaveRequest(sessionData); + } catch (Exception e) { + APPLogger.getLogger().error(e); + } + } + + @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) + public void logMail(Map mapMail) throws Exception { + System.out.println("Ingresa al log del mail..................................."); + EntityManager em=emf.createEntityManager(); + TbpmLogMail logMail= new TbpmLogMail(); + //logMail.setPk(getCodigo("CLOGMAIL")); + if(mapMail.get("subject")!=null){ + logMail.setAsunto(mapMail.get("subject").toString()); + } + if(mapMail.get("cont")!=null){ + logMail.setContenido(mapMail.get("cont").toString()); + } + if(mapMail.get("to")!=null){ + logMail.setCorreo(mapMail.get("to").toString()); + } + if(mapMail.get("error")!=null){ + logMail.setDescripcionerror(mapMail.get("error").toString()); + } + if(mapMail.get("estado")!=null){ + logMail.setEstado(mapMail.get("estado").toString()); + } + logMail.setFecharegistro(new Timestamp(new Date().getTime())); + if(em==null){ + crearManager(); + em=emf.createEntityManager(); + } + + em.clear(); + em.persist(logMail); + em.flush(); + em.close(); + } + + + /** + * Entrega el entitymanagerfactory + * + * @return + */ + @Override + public EntityManagerFactory getEmf() { + return emf; + } + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/JbpmBean.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/JbpmBean.java new file mode 100644 index 0000000..6860587 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/JbpmBean.java @@ -0,0 +1,123 @@ +package com.fp.bpmlib.ejb; + +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.ejb.Singleton; +import javax.ejb.Startup; +import javax.persistence.EntityManagerFactory; +import javax.persistence.PersistenceUnit; + +import org.kie.api.io.ResourceType; +import org.kie.api.runtime.EnvironmentName; +import org.kie.api.runtime.manager.RuntimeEnvironment; +import org.kie.api.runtime.manager.RuntimeEnvironmentBuilder; +import org.kie.api.runtime.manager.RuntimeManager; +import org.kie.api.runtime.manager.RuntimeManagerFactory; +import org.kie.internal.io.ResourceFactory; + +import com.fp.bpmlib.ejb.local.JbpmBeanLocal; +import com.fp.bpmlib.task.util.MaiaUserGroupCallback; +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; +import com.fp.persistence.pbpm.gene.TbpmRules; + +/** + * Clase utilitaria, utilizada para creacion de base de conocimento y RuntimeManager + * + * @author Jvc + * @version 2.1 + */ +@Startup +@Singleton(name = "jbpmbean") +public class JbpmBean implements JbpmBeanLocal { + @PersistenceUnit(unitName = "org.jbpm.domain") + private EntityManagerFactory emf; + + private RuntimeManager runtimemanager; + + @PostConstruct + private final void crearSingletonManager() { + try { + if (emf == null) { + emf = PersistenceManager.getInstance().getEntityManagerFactoryAuxiliar("org.jbpm.domain"); + } + } catch (Exception e) { + APPLogger.getLogger().error(e); + } + } + + @PreDestroy + private void close() { + try { + runtimemanager.close(); + } catch (Exception e) { + // no hacer nada. + } + + } + + /** + * Crea un RuntimeManagerFactory. + * + * @param emf Entiy manager factury utilizado en el manejo de flujos de trabajo. + * @return RuntimeEnvironment + * @throws Exception + */ + private RuntimeEnvironment crearRuntimeManager(EntityManagerFactory emf) throws Exception { + + MaiaUserGroupCallback usergroupCallback = new MaiaUserGroupCallback(); + RuntimeEnvironmentBuilder builder = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder().entityManagerFactory(emf); + builder.userGroupCallback(usergroupCallback); + + this.adicionarFlujos(builder); + + RuntimeEnvironment environment = builder.get(); + environment.getEnvironment().set(EnvironmentName.USE_PESSIMISTIC_LOCKING, true); + + return environment; + } + + @Override + public RuntimeManager getRuntimeManager() throws Exception { + + if (runtimemanager == null) { + RuntimeEnvironment environment = this.crearRuntimeManager(emf); + runtimemanager = RuntimeManagerFactory.Factory.get().newPerRequestRuntimeManager(environment); + } + return runtimemanager; + } + + /** + * Adiciona definiciones de flujos a un map con los cuales se crea la base de conocimiento. + * + * @param resources Map que contiene definicion de flujos y reglas con los cuales se crea la base de conocimiento. + * @throws Exception + */ + private void adicionarFlujos(RuntimeEnvironmentBuilder builder) throws Exception { + + List ldata = TbpmRules.findRules(PersistenceHelper.getEntityManager()); + + // adiciona subprocesos. + for (TbpmRules obj : ldata) { + if (obj.getFiletype().equals("F")) { + builder.addAsset(ResourceFactory.newClassPathResource(obj.getPath(), "UTF-8"), ResourceType.BPMN2); + } else { + builder.addAsset(ResourceFactory.newClassPathResource(obj.getPath(), "UTF-8"), ResourceType.DTABLE); + } + } + } + + /** + * Entrega el entitymanagerfactory asociado al manejo de jbpm. + * + * @return + */ + @Override + public EntityManagerFactory getEmf() { + return emf; + } + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/LogMailBean.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/LogMailBean.java new file mode 100644 index 0000000..bb0d140 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/LogMailBean.java @@ -0,0 +1,94 @@ +package com.fp.bpmlib.ejb; + +import java.sql.Timestamp; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.ejb.Stateless; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; + +import com.fp.bpmlib.ejb.local.LogMailBeanLocal; +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.pbpm.gene.TbpmLogMail; + +/** + * Clase utilitaria, utilizada para creacion de base de conocimento y RuntimeManager + * + * @author Jvc + * @version 2.1 + */ +@Stateless(name="logMailBean") +public class LogMailBean implements LogMailBeanLocal { +// @PersistenceUnit(unitName = "local1") + private EntityManagerFactory emf; + + @PostConstruct + private final void crearManager() { + try { + if (emf == null) { + Map configOverrides = new HashMap(); + configOverrides.put("hibernate.ejb.cfgfile", "hibernateFlipMapping.cfg.xml"); + emf = Persistence.createEntityManagerFactory("local1" , configOverrides); + } + SessionData sessionData = new SessionData(); + sessionData.setCompany(1); + sessionData.setIsEjb(Boolean.FALSE); + ThreadFacade.setSaveRequest(sessionData); + } catch (Exception e) { + APPLogger.getLogger().error(e); + } + } + + @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) + public void logMail(Map mapMail) throws Exception { + System.out.println("Ingresa al log del mail..................................."); + EntityManager em=emf.createEntityManager(); + TbpmLogMail logMail= new TbpmLogMail(); + //logMail.setPk(getCodigo("CLOGMAIL")); + if(mapMail.get("subject")!=null){ + logMail.setAsunto(mapMail.get("subject").toString()); + } + if(mapMail.get("cont")!=null){ + logMail.setContenido(mapMail.get("cont").toString()); + } + if(mapMail.get("to")!=null){ + logMail.setCorreo(mapMail.get("to").toString()); + } + if(mapMail.get("error")!=null){ + logMail.setDescripcionerror(mapMail.get("error").toString()); + } + if(mapMail.get("estado")!=null){ + logMail.setEstado(mapMail.get("estado").toString()); + } + logMail.setFecharegistro(new Timestamp(new Date().getTime())); + if(em==null){ + crearManager(); + em=emf.createEntityManager(); + } + + em.clear(); + em.persist(logMail); + em.flush(); + em.close(); + } + + + /** + * Entrega el entitymanagerfactory + * + * @return + */ + @Override + public EntityManagerFactory getEmf() { + return emf; + } + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/local/.svn/entries b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/local/.svn/entries new file mode 100644 index 0000000..14af563 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/local/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/local +svn://172.17.26.185/COMACO + + + +2014-12-12T07:56:38.758021Z +3458 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +LogMailBeanLocal.java +file + + + + +2022-07-28T03:40:45.723816Z +52854d15de90bdb5752754e602aef1b8 +2014-12-12T07:56:38.758021Z +3458 +cpiedra + + + + + + + + + + + + + + + + + + + + + +302 + +JbpmBeanLocal.java +file + + + + +2022-07-28T03:40:45.723816Z +df145af4e69f1ccf1988f89694dbf519 +2014-10-30T07:13:11.781809Z +2213 +wpatino + + + + + + + + + + + + + + + + + + + + + +322 + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/local/.svn/text-base/JbpmBeanLocal.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/local/.svn/text-base/JbpmBeanLocal.java.svn-base new file mode 100644 index 0000000..ea4adb8 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/local/.svn/text-base/JbpmBeanLocal.java.svn-base @@ -0,0 +1,15 @@ +package com.fp.bpmlib.ejb.local; + +import javax.ejb.Local; +import javax.persistence.EntityManagerFactory; + +import org.kie.api.runtime.manager.RuntimeManager; + +@Local +public interface JbpmBeanLocal { + + public RuntimeManager getRuntimeManager() throws Exception; + + public EntityManagerFactory getEmf(); + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/local/.svn/text-base/LogMailBeanLocal.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/local/.svn/text-base/LogMailBeanLocal.java.svn-base new file mode 100644 index 0000000..f945a97 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/local/.svn/text-base/LogMailBeanLocal.java.svn-base @@ -0,0 +1,14 @@ +package com.fp.bpmlib.ejb.local; + +import java.util.Map; + +import javax.ejb.Local; +import javax.persistence.EntityManagerFactory; + +@Local +public interface LogMailBeanLocal { + + public EntityManagerFactory getEmf(); + public void logMail(Map mapMail) throws Exception; + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/local/JbpmBeanLocal.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/local/JbpmBeanLocal.java new file mode 100644 index 0000000..ea4adb8 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/local/JbpmBeanLocal.java @@ -0,0 +1,15 @@ +package com.fp.bpmlib.ejb.local; + +import javax.ejb.Local; +import javax.persistence.EntityManagerFactory; + +import org.kie.api.runtime.manager.RuntimeManager; + +@Local +public interface JbpmBeanLocal { + + public RuntimeManager getRuntimeManager() throws Exception; + + public EntityManagerFactory getEmf(); + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/local/LogMailBeanLocal.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/local/LogMailBeanLocal.java new file mode 100644 index 0000000..f945a97 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/ejb/local/LogMailBeanLocal.java @@ -0,0 +1,14 @@ +package com.fp.bpmlib.ejb.local; + +import java.util.Map; + +import javax.ejb.Local; +import javax.persistence.EntityManagerFactory; + +@Local +public interface LogMailBeanLocal { + + public EntityManagerFactory getEmf(); + public void logMail(Map mapMail) throws Exception; + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/.svn/entries b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/.svn/entries new file mode 100644 index 0000000..79c4cbc --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow +svn://172.17.26.185/COMACO + + + +2016-02-19T18:02:18.312215Z +4468 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +FlowUtil.java +file + + + + +2022-07-28T03:40:45.948817Z +168c1d6c47a62a7004c5c3208940571c +2016-02-19T18:02:18.312215Z +4468 +fpazmino + + + + + + + + + + + + + + + + + + + + + +13286 + +RuleUtil.java +file + + + + +2022-07-28T03:40:45.949817Z +7318849112295fe6a6b1875b878d0324 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +7847 + +Monitor.java +file + + + + +2022-07-28T03:40:45.949817Z +da855582bede52e3a38ac8ff010931d7 +2014-11-04T10:22:15.189612Z +2294 +jvaca + + + + + + + + + + + + + + + + + + + + + +10004 + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/.svn/text-base/FlowUtil.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/.svn/text-base/FlowUtil.java.svn-base new file mode 100644 index 0000000..8dabc7a --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/.svn/text-base/FlowUtil.java.svn-base @@ -0,0 +1,323 @@ +package com.fp.bpmlib.flow; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.dto.Request; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.simple.action.TaskAction; +import com.fp.simple.dto.Kind; +import com.fp.simple.dto.TaskInfo; +import com.fp.simple.flow.FlowClass; +import com.fp.simple.maia.MailRecipient; +import com.fp.simple.maia.MailRecipientGroup; + +// TODO: Auto-generated Javadoc +/** + * Class FlowUtil encargada de. + * + * @author gfiallos + */ +public final class FlowUtil { + + /** + * Crea una nueva instancia de flow util. + */ + private FlowUtil() { + } + + /** + * Crea la instancia de task info. + * + * @param pModule the module + * @param pTransaction the transaction + * @param pVersion the version + * @param pMinutes the minutes + * @param pKind the kind + * @return task info + * @throws Exception la exception + */ + private static TaskInfo create(String pModule, Integer pTransaction, Integer pVersion, long pMinutes, String pKind) throws Exception { + TaskInfo ti = new TaskInfo(); + ti.setModule(pModule); + ti.setTransaction(pTransaction); + ti.setVersion(pVersion); + ti.setExpectedTime(pMinutes * 60000); + ti.setKind(Kind.OK_NO); + if (pKind.equals("OK")) { + ti.setKind(Kind.OK); + } + if (pKind.equals("OK_NO_REVIEW")) { + ti.setKind(Kind.OK_NO_REVIEW); + } + return ti; + } + + /** + * Crea la instancia de task info. + * + * @param pModule the module + * @param pTransaction the transaction + * @param pVersion the version + * @param pMinutes the minutes + * @param pRule the rule + * @param pKind the kind + * @return task info + * @throws Exception la exception + */ + public static TaskInfo createTaskInfo(String pModule, Integer pTransaction, Integer pVersion, long pMinutes, String pRule, String pKind) + throws Exception { + TaskInfo ti = FlowUtil.create(pModule, pTransaction, pVersion, pMinutes, pKind); + ti.setRuleCode(pRule); + return ti; + } + + /** + * Crea la instancia de task info. + * + * @param pModule the module + * @param pTransaction the transaction + * @param pVersion the version + * @param pMinutes the minutes + * @param pKind the kind + * @return task info + * @throws Exception la exception + */ + public static TaskInfo createTaskInfo(String pModule, Integer pTransaction, Integer pVersion, long pMinutes, + String taskName, Integer pMessageCode, String pKind) throws Exception { + TaskInfo ti = FlowUtil.create(pModule, pTransaction, pVersion, pMinutes, pKind); + ti.setMessageCode(pMessageCode); + ti.setTname(taskName); + return ti; + } + + /** + * Crea la instancia de task info. + * + * @param pModule the module + * @param pTransaction the transaction + * @param pVersion the version + * @param pMinutes the minutes + * @param pClassName Paquete clase encargado de obtener el responsable de ejecutar una tarea. + * @param pKind the kind + * @return task info + * @throws Exception la exception + */ + public static TaskInfo createTaskInfoByClassName(String pModule, Integer pTransaction, Integer pVersion, long pMinutes, String pClassName, + String taskName, Integer pMessageCode, String pKind) throws Exception { + TaskInfo ti = FlowUtil.create(pModule, pTransaction, pVersion, pMinutes, pKind); + ti.setClassCode(pClassName); + ti.setMessageCode(pMessageCode); + ti.setTname(taskName); + return ti; + } + + /** + * Eval rule. + * + * @param pName the name + * @param pParam the param + * @throws Exception la exception + */ + public static void evalRule(String pName, Object pParam) throws Exception { + if (pName == null) { + return; + } + Class c = Class.forName("com.fp.bpmlib.GuvnorClient"); + Object obj = c.getConstructor(String.class).newInstance(pName); + c.getMethod("eval", Object.class).invoke(obj, pParam); + } + + /** + * Eval rule. + * + * @param pName the name + * @param pContext the context + * @param pVar the var + * @throws Exception la exception + */ + public static void evalRule(String pName, Object pContext, String pVar) throws Exception { + if (pName == null) { + return; + } + Object val = FlowUtil.getVariable(pContext, pVar); + FlowUtil.evalRule(pName, val); + FlowUtil.setVariable(pContext, pVar, val); + } + + /** + * Eval rule. + * + * @param pName the name + * @param pParam the param + * @throws Exception la exception + */ + public static void executeClass(String pClassName, Object pParam) throws Exception { + if (pClassName == null) { + return; + } + TaskAction taction = (TaskAction) Class.forName(pClassName).newInstance(); + taction.assignOwner(pParam); + } + + /** + * Obtiene el valor de variable. + * + * @param pContext the context + * @param pVar the var + * @return Valor de variable + * @throws Exception la exception + */ + public static Object getVariable(Object pContext, String pVar) throws Exception { + return pContext.getClass().getMethod("getVariable", String.class).invoke(pContext, pVar); + } + + /** + * Fija el valor de variable. + * + * @param pContext the context + * @param pVar the var + * @param pVal the val + * @throws Exception la exception + */ + public static void setVariable(Object pContext, String pVar, Object pVal) throws Exception { + pContext.getClass().getMethod("setVariable", String.class, Object.class).invoke(pContext, pVar, pVal); + } + + /** + * End flow. + * + * @param pContext the context + * @throws Exception la exception + */ + public static void endFlow(Object pContext) throws Exception { + Class c = Class.forName("com.fp.bpmlib.query.monitor.FlowEnd"); + FlowClass o = (FlowClass) c.getConstructor(Object.class).newInstance(pContext); + o.process(); + } + + /** + * Metodo que se encarga de enviar mails a un grupo de usuarios bpm definidos en TbpmGroupsUsers. + * + * @param pClassName Paquete clase, que se encarga de obtener la lista de email asociados a un grupo. + * @param pParam Request con los parametros de un flujo. + * @param pSubjectTemplate Codigo de plantilla para generar el asusnto del mail. + * @param pContentTemplate Codigo de plantilla para generar el contenido del maial. + * @param pGroupCode Codigo de grupo del bpm. + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static void mailGroup(String pClassName, Object pParam, TaskInfo taskinfo, Integer pSubjectTemplate, Integer pContentTemplate, + String pGroupCode) throws Exception { + RuleUtil.setSubjectTemplate(pSubjectTemplate); + RuleUtil.setContentTemplate(pContentTemplate); + List lemail = new ArrayList(); + if (pClassName != null) { + MailRecipientGroup mail = (MailRecipientGroup) Class.forName(pClassName).newInstance(); + Map mresp = mail.getEmailAddress(pParam, pGroupCode); + lemail = (List) mresp.get("lemail"); + } + for (String email : lemail) { + RuleUtil.toField(email); + } + if (!lemail.isEmpty()) { + HashMap m = (HashMap) pParam; + ((Request) m.get("request")).put("cusuariobpm", taskinfo.getUserId()); + RuleUtil.sendMail((Request) m.get("request")); + } + } + + /** + * Metodo que se encarga del envio de emails a destinatarios enteragdos por la clase que llega como parametro. + * + * @param pClassName Paquete clase, que se encarga de obtener la lista de email a los cuales se envia + * notificaciones. + * @param pParam Request con los parametros de un flujo. + * @param pSubjectTemplate Codigo de plantilla para generar el asusnto del mail. + * @param pContentTemplate Codigo de plantilla para generar el contenido del maial. + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static void mail(String pClassName, Object pParam, TaskInfo taskinfo, Integer pSubjectTemplate, Integer pContentTemplate) throws Exception { + RuleUtil.setSubjectTemplate(pSubjectTemplate); + RuleUtil.setContentTemplate(pContentTemplate); + List lemail = new ArrayList(); + if (pClassName != null) { + MailRecipient mail = (MailRecipient) Class.forName(pClassName).newInstance(); + Map mresp = mail.getEmailAddress(pParam); + lemail = (List) mresp.get("lemail"); + } + + for (String email : lemail) { + RuleUtil.toAddress(email); + } + if (!lemail.isEmpty()) { + HashMap m = (HashMap) pParam; + ((Request) m.get("request")).put("cusuariobpm", taskinfo.getUserId()); + if(taskinfo!=null && taskinfo.getAditionalData()!=null && taskinfo.getAditionalData().get("datosmail")!=null && !taskinfo.getAditionalData().get("datosmail").equals("")){ + ((Request) m.get("request")).putAll((Map)taskinfo.getAditionalData().get("datosmail")); + } + RuleUtil.sendMail((Request) m.get("request")); + }else{ + RuleUtil.setSubjectTemplate(63); + TgeneParameters addres=TgeneParameters.find(PersistenceHelper.getEntityManager(), new TgeneParametersKey("MAIL.CENTRAL", 1)); + RuleUtil.toAddress(addres.getTextvalue()); + HashMap m = (HashMap) pParam; + ((Request) m.get("request")).put("cusuariobpm", taskinfo.getUserId()); + if(taskinfo!=null && taskinfo.getAditionalData()!=null && taskinfo.getAditionalData().get("datosmail")!=null && !taskinfo.getAditionalData().get("datosmail").equals("")){ + ((Request) m.get("request")).putAll((Map)taskinfo.getAditionalData().get("datosmail")); + } + RuleUtil.sendMail((Request) m.get("request")); + } + } + + /** + * Metodo que se encarga del envio de emails a destinatarios enteragdos por la clase que llega como parametro. + * + * @param pClassName Paquete clase, que se encarga de obtener la lista de email a los cuales se envia + * notificaciones. + * @param pParam Request con los parametros de un flujo. + * @param pSubjectTemplate Codigo de plantilla para generar el asusnto del mail. + * @param pContentTemplate Codigo de plantilla para generar el contenido del maial. + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static void mailDocumentoAdjunto(String pClassName, Object pParam, TaskInfo taskinfo, Integer pSubjectTemplate, Integer pContentTemplate) throws Exception { + RuleUtil.setSubjectTemplate(pSubjectTemplate); + RuleUtil.setContentTemplate(pContentTemplate); + List lemail = new ArrayList(); + if (pClassName != null) { + MailRecipient mail = (MailRecipient) Class.forName(pClassName).newInstance(); + Map mresp = mail.getEmailAddress(pParam); + lemail = (List) mresp.get("lemail"); + } + + for (String email : lemail) { + RuleUtil.toAddress(email); + } + if (!lemail.isEmpty()) { + HashMap m = (HashMap) pParam; + ((Request) m.get("request")).put("cusuariobpm", taskinfo.getUserId()); + if(taskinfo!=null && taskinfo.getAditionalData()!=null && taskinfo.getAditionalData().get("datosmail")!=null){ + ((Request) m.get("request")).putAll((Map)taskinfo.getAditionalData().get("datosmail")); + } + RuleUtil.sendMail((Request) m.get("request")); + }else{ + RuleUtil.setSubjectTemplate(63); + TgeneParameters addres=TgeneParameters.find(PersistenceHelper.getEntityManager(), new TgeneParametersKey("MAIL.CENTRAL", 1)); + RuleUtil.toAddress(addres.getTextvalue()); + HashMap m = (HashMap) pParam; + ((Request) m.get("request")).put("cusuariobpm", taskinfo.getUserId()); + if(taskinfo!=null && taskinfo.getAditionalData()!=null && taskinfo.getAditionalData().get("datosmail")!=null){ + ((Request) m.get("request")).putAll((Map)taskinfo.getAditionalData().get("datosmail")); + } + RuleUtil.sendMail((Request) m.get("request")); + } + } + + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/.svn/text-base/Monitor.java.netbeans-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/.svn/text-base/Monitor.java.netbeans-base new file mode 100644 index 0000000..334bafd --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/.svn/text-base/Monitor.java.netbeans-base @@ -0,0 +1,263 @@ +package com.fp.bpmlib.flow; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.naming.InitialContext; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import org.drools.core.common.InternalKnowledgeRuntime; +import org.drools.core.impl.InternalKnowledgeBase; +import org.drools.core.impl.StatefulKnowledgeSessionImpl; +import org.jbpm.ruleflow.instance.RuleFlowProcessInstance; +import org.jbpm.services.task.audit.impl.model.AuditTaskImpl; +import org.jbpm.services.task.audit.impl.model.BAMTaskSummaryImpl; +import org.jbpm.workflow.instance.node.HumanTaskNodeInstance; +import org.jbpm.workflow.instance.node.SubProcessNodeInstance; +import org.kie.api.definition.process.Node; +import org.kie.api.runtime.KieSession; +import org.kie.api.runtime.manager.RuntimeEngine; +import org.kie.api.runtime.manager.RuntimeManager; +import org.kie.api.runtime.process.NodeInstance; +import org.kie.api.runtime.process.ProcessInstance; +import org.kie.api.task.TaskService; +import org.kie.api.task.model.Task; +import org.kie.internal.runtime.manager.context.ProcessInstanceIdContext; + +import com.fp.bpmlib.ProcessUtil; +import com.fp.bpmlib.ejb.local.JbpmBeanLocal; +import com.fp.bpmlib.task.client.HumanTaskClient; +import com.fp.simple.dto.TaskInfo; +import com.fp.simple.dto.metadata.ProcessInstanceMeta; + +public class Monitor { + + private KieSession kiesession; + + private ProcessInstance processInstance = null; + + private TaskService taskService; + + private RuntimeManager runtimeManager; + + private RuntimeEngine runtimeEngine; + + private EntityManagerFactory emf; + + /** + * Crea una instancia de flujo. + */ + public Monitor(Long processid) throws Exception { + JbpmBeanLocal local = (JbpmBeanLocal) new InitialContext().lookup("java:global/maiaear-2.1/bpmlib/jbpmbean"); + runtimeManager = local.getRuntimeManager(); + emf = local.getEmf(); + runtimeEngine = runtimeManager.getRuntimeEngine(ProcessInstanceIdContext.get(processid)); + taskService = runtimeEngine.getTaskService(); + kiesession = runtimeEngine.getKieSession(); + processInstance = kiesession.getProcessInstance(processid); + } + + /** + * Cierra la session de trabajo. + */ + public void close() { + // no cerrar la session, esta se cierra en el commit trabaja con JTA. + } + + public KieSession getKiesession() { + return kiesession; + } + + public TaskService getTaskService() { + return taskService; + } + + public ProcessInstance getProcessInstance() { + return processInstance; + } + + /** + * Obtiene el valor de variable. + * + * @param pName Nombre de la varibale a buscar en una instancia de proceso. + * @return Valor de variable + * @throws Exception la exception + */ + public Object getVariable(String pName) throws Exception { + RuleFlowProcessInstance rfpi = (RuleFlowProcessInstance) this.processInstance; + return rfpi.getVariable(pName); + } + + /** + * Obtiene el valor de status. + * + * @param pVariables the variables + * @return Valor de status + * @throws Exception la exception + */ + @SuppressWarnings("unchecked") + public List getStatus() throws Exception { + List data = new ArrayList(); + if (this.processInstance == null) { + return data; + } + + RuleFlowProcessInstance rfpi = (RuleFlowProcessInstance) this.processInstance; + InternalKnowledgeRuntime internal = rfpi.getKnowledgeRuntime(); + if (internal == null) { + internal = new StatefulKnowledgeSessionImpl(1, (InternalKnowledgeBase) this.kiesession.getKieBase()); + rfpi.setKnowledgeRuntime(internal); + } + Collection nl = rfpi.getNodeInstances(); + + for (NodeInstance ni : nl) { + ProcessInstanceMeta pim = new ProcessInstanceMeta(this.processInstance.getId()); + data.add(pim); + Map m = ni.getNode().getMetaData(); + pim.setH(Integer.valueOf("" + m.get("height"))); + pim.setW(Integer.valueOf("" + m.get("width"))); + pim.setX(Integer.valueOf("" + m.get("x"))); + pim.setY(Integer.valueOf("" + m.get("y"))); + pim.setName(processInstance.getProcessName()); + pim.setVersion(processInstance.getProcess().getVersion()); + pim.setActivity(ni.getNodeName()); + pim.setPmetaid(ni.getNodeId()); + Map var = pim.getVariables(); + Object tasks = this.getVariable(ProcessUtil.TASKS_METADATA); + boolean req = true; + if (tasks != null) { + var.put(ProcessUtil.TASKS_METADATA, this.manageTasksMetaData((Map) tasks)); + req = false; + } + if (req) { + tasks = this.getVariable(ProcessUtil.ACTUAL_TASK); + if (tasks != null) { + var.put(ProcessUtil.ACTUAL_TASK, tasks); + } + } + this.manageNode(pim, ni); + } + return data; + } + + /** + * Manage node. + * + * @param pim the pim + * @param ni the ni + * @param pVariables the variables + * @throws Exception la exception + */ + private void manageNode(ProcessInstanceMeta pim, NodeInstance ni) throws Exception { + if (ni instanceof HumanTaskNodeInstance) { + HumanTaskNodeInstance sub = (HumanTaskNodeInstance) ni; + pim.setWorkItem(sub.getWorkItemId()); + Task t = this.taskService.getTaskByWorkItemId(pim.getWorkItem()); + // getDocumentContentId es el contenido de entrada de la tarea. + Map input = HumanTaskClient.getContenido(taskService.getContentById(t.getTaskData().getDocumentContentId())); + TaskInfo info = (TaskInfo) input.get("taskMetaData"); + info.getAditionalData().put("workItem", sub.getWorkItemId()); + pim.addAddtionalInfo("taskMetaData", info); + return; + } + if (ni instanceof SubProcessNodeInstance) { + SubProcessNodeInstance sub = (SubProcessNodeInstance) ni; + Monitor subflujo = new Monitor(sub.getProcessInstanceId()); + for (ProcessInstanceMeta pi : subflujo.getStatus()) { + pim.addSubProcess(pi); + } + return; + } + } + + /** + * Manage tasks meta data. + * + * @param pTasksMetaData the tasks meta data + * @return map + * @throws Exception la exception + */ + private Map manageTasksMetaData(Map pTasksMetaData) throws Exception { + Map data = new HashMap(); + RuleFlowProcessInstance instance = (RuleFlowProcessInstance) processInstance; + for (Entry element : pTasksMetaData.entrySet()) { + Map record = new HashMap(); + Node[] ns = instance.getRuleFlowProcess().getNodes(); + for (Node n : ns) { + if (n.getName().compareTo(element.getKey()) == 0) { + Map m = n.getMetaData(); + record.put("h", Integer.valueOf("" + m.get("height"))); + record.put("w", Integer.valueOf("" + m.get("width"))); + record.put("x", Integer.valueOf("" + m.get("x"))); + record.put("y", Integer.valueOf("" + m.get("y"))); + record.put("name", n.getName()); + break; + } + } + // record.put(ProcessUtil.TASK_METADATA, element.getValue()); + data.put(element.getKey(), record); + } + return data; + } + + /** + * JPQL TAREA_SUMMARY + */ + private static final String TAREA_SUMMARY = "select t from BAMTaskSummaryImpl t where t.taskId = :idtarea"; + + /** + * Obtiene el valor de unfinished tasks por Grupo. + * + * @param pGroupId the user id + * @param pCri the cri + * @return Valor de unfinished tasks + * @throws Exception la exception + */ + public BAMTaskSummaryImpl getBAMTaskSummaryImpl(long idtarea) throws Exception { + EntityManager em = null; + BAMTaskSummaryImpl dato = null; + try { + em = emf.createEntityManager(); + Query qry = em.createQuery(Monitor.TAREA_SUMMARY); + qry.setParameter("idtarea", idtarea); + dato = (BAMTaskSummaryImpl) qry.getSingleResult(); + } catch (NoResultException e) { + // retorna el objeto en null. + } finally { + if (em.isOpen()) { + em.close(); + } + } + return dato; + } + + /** + * JPQL TAREA_SUMMARY + */ + private static final String TAREA_AUDIT_IMP = "select t from AuditTaskImpl t where t.taskId = :idtarea"; + + public AuditTaskImpl getAuditTaskImpl(long idtarea) throws Exception { + EntityManager em = null; + AuditTaskImpl dato = null; + try { + em = emf.createEntityManager(); + Query qry = em.createQuery(Monitor.TAREA_AUDIT_IMP); + qry.setParameter("idtarea", idtarea); + dato = (AuditTaskImpl) qry.getSingleResult(); + } catch (NoResultException e) { + // retorna el objeto en null. + } finally { + if (em.isOpen()) { + em.close(); + } + } + return dato; + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/.svn/text-base/Monitor.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/.svn/text-base/Monitor.java.svn-base new file mode 100644 index 0000000..334bafd --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/.svn/text-base/Monitor.java.svn-base @@ -0,0 +1,263 @@ +package com.fp.bpmlib.flow; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.naming.InitialContext; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import org.drools.core.common.InternalKnowledgeRuntime; +import org.drools.core.impl.InternalKnowledgeBase; +import org.drools.core.impl.StatefulKnowledgeSessionImpl; +import org.jbpm.ruleflow.instance.RuleFlowProcessInstance; +import org.jbpm.services.task.audit.impl.model.AuditTaskImpl; +import org.jbpm.services.task.audit.impl.model.BAMTaskSummaryImpl; +import org.jbpm.workflow.instance.node.HumanTaskNodeInstance; +import org.jbpm.workflow.instance.node.SubProcessNodeInstance; +import org.kie.api.definition.process.Node; +import org.kie.api.runtime.KieSession; +import org.kie.api.runtime.manager.RuntimeEngine; +import org.kie.api.runtime.manager.RuntimeManager; +import org.kie.api.runtime.process.NodeInstance; +import org.kie.api.runtime.process.ProcessInstance; +import org.kie.api.task.TaskService; +import org.kie.api.task.model.Task; +import org.kie.internal.runtime.manager.context.ProcessInstanceIdContext; + +import com.fp.bpmlib.ProcessUtil; +import com.fp.bpmlib.ejb.local.JbpmBeanLocal; +import com.fp.bpmlib.task.client.HumanTaskClient; +import com.fp.simple.dto.TaskInfo; +import com.fp.simple.dto.metadata.ProcessInstanceMeta; + +public class Monitor { + + private KieSession kiesession; + + private ProcessInstance processInstance = null; + + private TaskService taskService; + + private RuntimeManager runtimeManager; + + private RuntimeEngine runtimeEngine; + + private EntityManagerFactory emf; + + /** + * Crea una instancia de flujo. + */ + public Monitor(Long processid) throws Exception { + JbpmBeanLocal local = (JbpmBeanLocal) new InitialContext().lookup("java:global/maiaear-2.1/bpmlib/jbpmbean"); + runtimeManager = local.getRuntimeManager(); + emf = local.getEmf(); + runtimeEngine = runtimeManager.getRuntimeEngine(ProcessInstanceIdContext.get(processid)); + taskService = runtimeEngine.getTaskService(); + kiesession = runtimeEngine.getKieSession(); + processInstance = kiesession.getProcessInstance(processid); + } + + /** + * Cierra la session de trabajo. + */ + public void close() { + // no cerrar la session, esta se cierra en el commit trabaja con JTA. + } + + public KieSession getKiesession() { + return kiesession; + } + + public TaskService getTaskService() { + return taskService; + } + + public ProcessInstance getProcessInstance() { + return processInstance; + } + + /** + * Obtiene el valor de variable. + * + * @param pName Nombre de la varibale a buscar en una instancia de proceso. + * @return Valor de variable + * @throws Exception la exception + */ + public Object getVariable(String pName) throws Exception { + RuleFlowProcessInstance rfpi = (RuleFlowProcessInstance) this.processInstance; + return rfpi.getVariable(pName); + } + + /** + * Obtiene el valor de status. + * + * @param pVariables the variables + * @return Valor de status + * @throws Exception la exception + */ + @SuppressWarnings("unchecked") + public List getStatus() throws Exception { + List data = new ArrayList(); + if (this.processInstance == null) { + return data; + } + + RuleFlowProcessInstance rfpi = (RuleFlowProcessInstance) this.processInstance; + InternalKnowledgeRuntime internal = rfpi.getKnowledgeRuntime(); + if (internal == null) { + internal = new StatefulKnowledgeSessionImpl(1, (InternalKnowledgeBase) this.kiesession.getKieBase()); + rfpi.setKnowledgeRuntime(internal); + } + Collection nl = rfpi.getNodeInstances(); + + for (NodeInstance ni : nl) { + ProcessInstanceMeta pim = new ProcessInstanceMeta(this.processInstance.getId()); + data.add(pim); + Map m = ni.getNode().getMetaData(); + pim.setH(Integer.valueOf("" + m.get("height"))); + pim.setW(Integer.valueOf("" + m.get("width"))); + pim.setX(Integer.valueOf("" + m.get("x"))); + pim.setY(Integer.valueOf("" + m.get("y"))); + pim.setName(processInstance.getProcessName()); + pim.setVersion(processInstance.getProcess().getVersion()); + pim.setActivity(ni.getNodeName()); + pim.setPmetaid(ni.getNodeId()); + Map var = pim.getVariables(); + Object tasks = this.getVariable(ProcessUtil.TASKS_METADATA); + boolean req = true; + if (tasks != null) { + var.put(ProcessUtil.TASKS_METADATA, this.manageTasksMetaData((Map) tasks)); + req = false; + } + if (req) { + tasks = this.getVariable(ProcessUtil.ACTUAL_TASK); + if (tasks != null) { + var.put(ProcessUtil.ACTUAL_TASK, tasks); + } + } + this.manageNode(pim, ni); + } + return data; + } + + /** + * Manage node. + * + * @param pim the pim + * @param ni the ni + * @param pVariables the variables + * @throws Exception la exception + */ + private void manageNode(ProcessInstanceMeta pim, NodeInstance ni) throws Exception { + if (ni instanceof HumanTaskNodeInstance) { + HumanTaskNodeInstance sub = (HumanTaskNodeInstance) ni; + pim.setWorkItem(sub.getWorkItemId()); + Task t = this.taskService.getTaskByWorkItemId(pim.getWorkItem()); + // getDocumentContentId es el contenido de entrada de la tarea. + Map input = HumanTaskClient.getContenido(taskService.getContentById(t.getTaskData().getDocumentContentId())); + TaskInfo info = (TaskInfo) input.get("taskMetaData"); + info.getAditionalData().put("workItem", sub.getWorkItemId()); + pim.addAddtionalInfo("taskMetaData", info); + return; + } + if (ni instanceof SubProcessNodeInstance) { + SubProcessNodeInstance sub = (SubProcessNodeInstance) ni; + Monitor subflujo = new Monitor(sub.getProcessInstanceId()); + for (ProcessInstanceMeta pi : subflujo.getStatus()) { + pim.addSubProcess(pi); + } + return; + } + } + + /** + * Manage tasks meta data. + * + * @param pTasksMetaData the tasks meta data + * @return map + * @throws Exception la exception + */ + private Map manageTasksMetaData(Map pTasksMetaData) throws Exception { + Map data = new HashMap(); + RuleFlowProcessInstance instance = (RuleFlowProcessInstance) processInstance; + for (Entry element : pTasksMetaData.entrySet()) { + Map record = new HashMap(); + Node[] ns = instance.getRuleFlowProcess().getNodes(); + for (Node n : ns) { + if (n.getName().compareTo(element.getKey()) == 0) { + Map m = n.getMetaData(); + record.put("h", Integer.valueOf("" + m.get("height"))); + record.put("w", Integer.valueOf("" + m.get("width"))); + record.put("x", Integer.valueOf("" + m.get("x"))); + record.put("y", Integer.valueOf("" + m.get("y"))); + record.put("name", n.getName()); + break; + } + } + // record.put(ProcessUtil.TASK_METADATA, element.getValue()); + data.put(element.getKey(), record); + } + return data; + } + + /** + * JPQL TAREA_SUMMARY + */ + private static final String TAREA_SUMMARY = "select t from BAMTaskSummaryImpl t where t.taskId = :idtarea"; + + /** + * Obtiene el valor de unfinished tasks por Grupo. + * + * @param pGroupId the user id + * @param pCri the cri + * @return Valor de unfinished tasks + * @throws Exception la exception + */ + public BAMTaskSummaryImpl getBAMTaskSummaryImpl(long idtarea) throws Exception { + EntityManager em = null; + BAMTaskSummaryImpl dato = null; + try { + em = emf.createEntityManager(); + Query qry = em.createQuery(Monitor.TAREA_SUMMARY); + qry.setParameter("idtarea", idtarea); + dato = (BAMTaskSummaryImpl) qry.getSingleResult(); + } catch (NoResultException e) { + // retorna el objeto en null. + } finally { + if (em.isOpen()) { + em.close(); + } + } + return dato; + } + + /** + * JPQL TAREA_SUMMARY + */ + private static final String TAREA_AUDIT_IMP = "select t from AuditTaskImpl t where t.taskId = :idtarea"; + + public AuditTaskImpl getAuditTaskImpl(long idtarea) throws Exception { + EntityManager em = null; + AuditTaskImpl dato = null; + try { + em = emf.createEntityManager(); + Query qry = em.createQuery(Monitor.TAREA_AUDIT_IMP); + qry.setParameter("idtarea", idtarea); + dato = (AuditTaskImpl) qry.getSingleResult(); + } catch (NoResultException e) { + // retorna el objeto en null. + } finally { + if (em.isOpen()) { + em.close(); + } + } + return dato; + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/.svn/text-base/RuleUtil.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/.svn/text-base/RuleUtil.java.svn-base new file mode 100644 index 0000000..892e472 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/.svn/text-base/RuleUtil.java.svn-base @@ -0,0 +1,284 @@ +package com.fp.bpmlib.flow; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.dto.Request; +import com.fp.dto.save.SaveRequest; +import com.fp.simple.flow.Asign; + +// TODO: Auto-generated Javadoc +/** + * Class RuleUtil encargada del manejo de las operaciones de una Regla. + * + * @author gfiallos + */ +public final class RuleUtil { + + /** + * Crea una nueva instancia de rule util. + */ + private RuleUtil() { + } + + /** El valor de message. */ + private static ThreadLocal> message = new ThreadLocal>(); + + /** + * Asign. + * + * @param pMaia the maia + * @param pClass the class + * @throws Exception la exception + */ + public static void asign(Map pMaia, String pClass) throws Exception { + Asign asign = (Asign) Class.forName(pClass).newInstance(); + asign.setRequest(RuleUtil.getRequest(pMaia)); + RuleUtil.setAction(pMaia, "A"); + if (!asign.isGroup()) { + RuleUtil.setUser(pMaia, asign.getId()); + } else { + RuleUtil.setGroup(pMaia, asign.getId()); + } + + } + + /** + * Asign officer. + * + * @param pMaia the maia + */ + public static void asignOfficer(Map pMaia) { + String officer = RuleUtil.getRequest(pMaia).getString("officer"); + RuleUtil.setUser(pMaia, officer); + RuleUtil.setAction(pMaia, "A"); + } + + /** + * Obtiene el valor de amount. + * + * @param pMaia the maia + * @return Valor de amount + */ + public static BigDecimal getAmount(Map pMaia) { + return RuleUtil.getRequest(pMaia).getBigDecimal("amount"); + } + + /** + * Obtiene el valor de financial amount. + * + * @param pMaia the maia + * @return Valor de financial amount + */ + public static BigDecimal getFinancialAmount(Map pMaia) { + return RuleUtil.getRequest(pMaia).getBigDecimal("financialamount"); + } + + /** + * Obtiene el valor de rate. + * + * @param pMaia the maia + * @return Valor de rate + */ + public static BigDecimal getRate(Map pMaia) { + return RuleUtil.getRequest(pMaia).getBigDecimal("rate"); + } + + /** + * Obtiene el valor de request. + * + * @param pMaia the maia + * @return Valor de request + */ + public static Request getRequest(Map pMaia) { + return (Request) pMaia.get("request"); + } + + /** + * Obtiene el valor de save request. + * + * @param pMaia the maia + * @return Valor de save request + */ + public static SaveRequest getSaveRequest(Map pMaia) { + return (SaveRequest) RuleUtil.getRequest(pMaia); + } + + /** + * Obtiene el valor de term. + * + * @param pMaia the maia + * @return Valor de term + */ + public static Integer getTerm(Map pMaia) { + return RuleUtil.getRequest(pMaia).getInteger("term"); + } + + /** + * Fija el valor de action. + * + * @param pMaia the maia + * @param pAction the action + */ + public static void setAction(Map pMaia, String pAction) { + pMaia.put("action", pAction); + } + + /** + * Fija el valor de action intermediate. + * + * @param pMaia the maia + * @param pAction the action + */ + public static void setActionIntermediate(Map pMaia, String pAction) { + pMaia.put("action", pAction); + pMaia.put("internalCode", "Y"); + + } + + /** + * Fija el valor de group. + * + * @param pMaia the maia + * @param pGroup the group + */ + public static void setGroup(Map pMaia, String pGroup) { + pMaia.put("groupId", pGroup); + RuleUtil.toGroup(pGroup); + } + + /** + * Fija el valor de user. + * + * @param pMaia the maia + * @param pUser the user + */ + public static void setUser(Map pMaia, String pUser) { + pMaia.put("userId", pUser); + } + + /** + * Obtiene el valor de message. + * + * @return Valor de message + */ + private static Map getMessage() { + Map msg = null; + synchronized (RuleUtil.message) { + msg = RuleUtil.message.get(); + if (msg == null) { + msg = new HashMap(); + RuleUtil.message.set(msg); + } + } + return msg; + } + + /** + * To user. + * + * @param pUser the user + */ + public static void toUser(String pUser) { + Map msg = RuleUtil.getMessage(); + @SuppressWarnings("unchecked") + List user = (List) msg.get("user"); + if (user == null) { + user = new ArrayList(); + msg.put("user", user); + } + user.add(pUser); + } + + /** + * To group. + * + * @param pGroup the group + */ + public static void toGroup(String pGroup) { + Map msg = RuleUtil.getMessage(); + @SuppressWarnings("unchecked") + List group = (List) msg.get("group"); + if (group == null) { + group = new ArrayList(); + msg.put("group", group); + } + group.add(pGroup); + } + + /** + * To field. + * + * @param pField the field + */ + public static void toField(String pField) { + Map msg = RuleUtil.getMessage(); + @SuppressWarnings("unchecked") + List field = (List) msg.get("field"); + if (field == null) { + field = new ArrayList(); + msg.put("field", field); + } + field.add(pField); + } + + /** + * To address. + * + * @param pField the field + */ + public static void toAddress(String pAddress) { + Map msg = RuleUtil.getMessage(); + @SuppressWarnings("unchecked") + List laddress = (List) msg.get("address"); + if (laddress == null) { + laddress = new ArrayList(); + msg.put("address", laddress); + } + if (!laddress.contains(pAddress)) { + laddress.add(pAddress); + } + } + + /** + * Fija el valor de subject template. + * + * @param pTemplate es el valor nuevo de subject template + */ + public static void setSubjectTemplate(Integer pTemplate) { + Map msg = RuleUtil.getMessage(); + msg.put("subject", pTemplate); + } + + /** + * Fija el valor de content template. + * + * @param pTemplate es el valor nuevo de content template + */ + public static void setContentTemplate(Integer pTemplate) { + Map msg = RuleUtil.getMessage(); + msg.put("content", pTemplate); + } + + /** + * Send mail. + * + * @param pRequest the request + * @throws Exception la exception + */ + public static void sendMail(Request pRequest) throws Exception { + Class c = Class.forName("com.fp.bpmlib.mail.MailCommand"); + Map msg = RuleUtil.getMessage(); + msg.put("request", pRequest); + Constructor con = c.getConstructor(Map.class); + Object obj = con.newInstance(msg); + Method m = c.getMethod("send"); + m.invoke(obj); + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/FlowUtil.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/FlowUtil.java new file mode 100644 index 0000000..8dabc7a --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/FlowUtil.java @@ -0,0 +1,323 @@ +package com.fp.bpmlib.flow; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.dto.Request; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.simple.action.TaskAction; +import com.fp.simple.dto.Kind; +import com.fp.simple.dto.TaskInfo; +import com.fp.simple.flow.FlowClass; +import com.fp.simple.maia.MailRecipient; +import com.fp.simple.maia.MailRecipientGroup; + +// TODO: Auto-generated Javadoc +/** + * Class FlowUtil encargada de. + * + * @author gfiallos + */ +public final class FlowUtil { + + /** + * Crea una nueva instancia de flow util. + */ + private FlowUtil() { + } + + /** + * Crea la instancia de task info. + * + * @param pModule the module + * @param pTransaction the transaction + * @param pVersion the version + * @param pMinutes the minutes + * @param pKind the kind + * @return task info + * @throws Exception la exception + */ + private static TaskInfo create(String pModule, Integer pTransaction, Integer pVersion, long pMinutes, String pKind) throws Exception { + TaskInfo ti = new TaskInfo(); + ti.setModule(pModule); + ti.setTransaction(pTransaction); + ti.setVersion(pVersion); + ti.setExpectedTime(pMinutes * 60000); + ti.setKind(Kind.OK_NO); + if (pKind.equals("OK")) { + ti.setKind(Kind.OK); + } + if (pKind.equals("OK_NO_REVIEW")) { + ti.setKind(Kind.OK_NO_REVIEW); + } + return ti; + } + + /** + * Crea la instancia de task info. + * + * @param pModule the module + * @param pTransaction the transaction + * @param pVersion the version + * @param pMinutes the minutes + * @param pRule the rule + * @param pKind the kind + * @return task info + * @throws Exception la exception + */ + public static TaskInfo createTaskInfo(String pModule, Integer pTransaction, Integer pVersion, long pMinutes, String pRule, String pKind) + throws Exception { + TaskInfo ti = FlowUtil.create(pModule, pTransaction, pVersion, pMinutes, pKind); + ti.setRuleCode(pRule); + return ti; + } + + /** + * Crea la instancia de task info. + * + * @param pModule the module + * @param pTransaction the transaction + * @param pVersion the version + * @param pMinutes the minutes + * @param pKind the kind + * @return task info + * @throws Exception la exception + */ + public static TaskInfo createTaskInfo(String pModule, Integer pTransaction, Integer pVersion, long pMinutes, + String taskName, Integer pMessageCode, String pKind) throws Exception { + TaskInfo ti = FlowUtil.create(pModule, pTransaction, pVersion, pMinutes, pKind); + ti.setMessageCode(pMessageCode); + ti.setTname(taskName); + return ti; + } + + /** + * Crea la instancia de task info. + * + * @param pModule the module + * @param pTransaction the transaction + * @param pVersion the version + * @param pMinutes the minutes + * @param pClassName Paquete clase encargado de obtener el responsable de ejecutar una tarea. + * @param pKind the kind + * @return task info + * @throws Exception la exception + */ + public static TaskInfo createTaskInfoByClassName(String pModule, Integer pTransaction, Integer pVersion, long pMinutes, String pClassName, + String taskName, Integer pMessageCode, String pKind) throws Exception { + TaskInfo ti = FlowUtil.create(pModule, pTransaction, pVersion, pMinutes, pKind); + ti.setClassCode(pClassName); + ti.setMessageCode(pMessageCode); + ti.setTname(taskName); + return ti; + } + + /** + * Eval rule. + * + * @param pName the name + * @param pParam the param + * @throws Exception la exception + */ + public static void evalRule(String pName, Object pParam) throws Exception { + if (pName == null) { + return; + } + Class c = Class.forName("com.fp.bpmlib.GuvnorClient"); + Object obj = c.getConstructor(String.class).newInstance(pName); + c.getMethod("eval", Object.class).invoke(obj, pParam); + } + + /** + * Eval rule. + * + * @param pName the name + * @param pContext the context + * @param pVar the var + * @throws Exception la exception + */ + public static void evalRule(String pName, Object pContext, String pVar) throws Exception { + if (pName == null) { + return; + } + Object val = FlowUtil.getVariable(pContext, pVar); + FlowUtil.evalRule(pName, val); + FlowUtil.setVariable(pContext, pVar, val); + } + + /** + * Eval rule. + * + * @param pName the name + * @param pParam the param + * @throws Exception la exception + */ + public static void executeClass(String pClassName, Object pParam) throws Exception { + if (pClassName == null) { + return; + } + TaskAction taction = (TaskAction) Class.forName(pClassName).newInstance(); + taction.assignOwner(pParam); + } + + /** + * Obtiene el valor de variable. + * + * @param pContext the context + * @param pVar the var + * @return Valor de variable + * @throws Exception la exception + */ + public static Object getVariable(Object pContext, String pVar) throws Exception { + return pContext.getClass().getMethod("getVariable", String.class).invoke(pContext, pVar); + } + + /** + * Fija el valor de variable. + * + * @param pContext the context + * @param pVar the var + * @param pVal the val + * @throws Exception la exception + */ + public static void setVariable(Object pContext, String pVar, Object pVal) throws Exception { + pContext.getClass().getMethod("setVariable", String.class, Object.class).invoke(pContext, pVar, pVal); + } + + /** + * End flow. + * + * @param pContext the context + * @throws Exception la exception + */ + public static void endFlow(Object pContext) throws Exception { + Class c = Class.forName("com.fp.bpmlib.query.monitor.FlowEnd"); + FlowClass o = (FlowClass) c.getConstructor(Object.class).newInstance(pContext); + o.process(); + } + + /** + * Metodo que se encarga de enviar mails a un grupo de usuarios bpm definidos en TbpmGroupsUsers. + * + * @param pClassName Paquete clase, que se encarga de obtener la lista de email asociados a un grupo. + * @param pParam Request con los parametros de un flujo. + * @param pSubjectTemplate Codigo de plantilla para generar el asusnto del mail. + * @param pContentTemplate Codigo de plantilla para generar el contenido del maial. + * @param pGroupCode Codigo de grupo del bpm. + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static void mailGroup(String pClassName, Object pParam, TaskInfo taskinfo, Integer pSubjectTemplate, Integer pContentTemplate, + String pGroupCode) throws Exception { + RuleUtil.setSubjectTemplate(pSubjectTemplate); + RuleUtil.setContentTemplate(pContentTemplate); + List lemail = new ArrayList(); + if (pClassName != null) { + MailRecipientGroup mail = (MailRecipientGroup) Class.forName(pClassName).newInstance(); + Map mresp = mail.getEmailAddress(pParam, pGroupCode); + lemail = (List) mresp.get("lemail"); + } + for (String email : lemail) { + RuleUtil.toField(email); + } + if (!lemail.isEmpty()) { + HashMap m = (HashMap) pParam; + ((Request) m.get("request")).put("cusuariobpm", taskinfo.getUserId()); + RuleUtil.sendMail((Request) m.get("request")); + } + } + + /** + * Metodo que se encarga del envio de emails a destinatarios enteragdos por la clase que llega como parametro. + * + * @param pClassName Paquete clase, que se encarga de obtener la lista de email a los cuales se envia + * notificaciones. + * @param pParam Request con los parametros de un flujo. + * @param pSubjectTemplate Codigo de plantilla para generar el asusnto del mail. + * @param pContentTemplate Codigo de plantilla para generar el contenido del maial. + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static void mail(String pClassName, Object pParam, TaskInfo taskinfo, Integer pSubjectTemplate, Integer pContentTemplate) throws Exception { + RuleUtil.setSubjectTemplate(pSubjectTemplate); + RuleUtil.setContentTemplate(pContentTemplate); + List lemail = new ArrayList(); + if (pClassName != null) { + MailRecipient mail = (MailRecipient) Class.forName(pClassName).newInstance(); + Map mresp = mail.getEmailAddress(pParam); + lemail = (List) mresp.get("lemail"); + } + + for (String email : lemail) { + RuleUtil.toAddress(email); + } + if (!lemail.isEmpty()) { + HashMap m = (HashMap) pParam; + ((Request) m.get("request")).put("cusuariobpm", taskinfo.getUserId()); + if(taskinfo!=null && taskinfo.getAditionalData()!=null && taskinfo.getAditionalData().get("datosmail")!=null && !taskinfo.getAditionalData().get("datosmail").equals("")){ + ((Request) m.get("request")).putAll((Map)taskinfo.getAditionalData().get("datosmail")); + } + RuleUtil.sendMail((Request) m.get("request")); + }else{ + RuleUtil.setSubjectTemplate(63); + TgeneParameters addres=TgeneParameters.find(PersistenceHelper.getEntityManager(), new TgeneParametersKey("MAIL.CENTRAL", 1)); + RuleUtil.toAddress(addres.getTextvalue()); + HashMap m = (HashMap) pParam; + ((Request) m.get("request")).put("cusuariobpm", taskinfo.getUserId()); + if(taskinfo!=null && taskinfo.getAditionalData()!=null && taskinfo.getAditionalData().get("datosmail")!=null && !taskinfo.getAditionalData().get("datosmail").equals("")){ + ((Request) m.get("request")).putAll((Map)taskinfo.getAditionalData().get("datosmail")); + } + RuleUtil.sendMail((Request) m.get("request")); + } + } + + /** + * Metodo que se encarga del envio de emails a destinatarios enteragdos por la clase que llega como parametro. + * + * @param pClassName Paquete clase, que se encarga de obtener la lista de email a los cuales se envia + * notificaciones. + * @param pParam Request con los parametros de un flujo. + * @param pSubjectTemplate Codigo de plantilla para generar el asusnto del mail. + * @param pContentTemplate Codigo de plantilla para generar el contenido del maial. + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static void mailDocumentoAdjunto(String pClassName, Object pParam, TaskInfo taskinfo, Integer pSubjectTemplate, Integer pContentTemplate) throws Exception { + RuleUtil.setSubjectTemplate(pSubjectTemplate); + RuleUtil.setContentTemplate(pContentTemplate); + List lemail = new ArrayList(); + if (pClassName != null) { + MailRecipient mail = (MailRecipient) Class.forName(pClassName).newInstance(); + Map mresp = mail.getEmailAddress(pParam); + lemail = (List) mresp.get("lemail"); + } + + for (String email : lemail) { + RuleUtil.toAddress(email); + } + if (!lemail.isEmpty()) { + HashMap m = (HashMap) pParam; + ((Request) m.get("request")).put("cusuariobpm", taskinfo.getUserId()); + if(taskinfo!=null && taskinfo.getAditionalData()!=null && taskinfo.getAditionalData().get("datosmail")!=null){ + ((Request) m.get("request")).putAll((Map)taskinfo.getAditionalData().get("datosmail")); + } + RuleUtil.sendMail((Request) m.get("request")); + }else{ + RuleUtil.setSubjectTemplate(63); + TgeneParameters addres=TgeneParameters.find(PersistenceHelper.getEntityManager(), new TgeneParametersKey("MAIL.CENTRAL", 1)); + RuleUtil.toAddress(addres.getTextvalue()); + HashMap m = (HashMap) pParam; + ((Request) m.get("request")).put("cusuariobpm", taskinfo.getUserId()); + if(taskinfo!=null && taskinfo.getAditionalData()!=null && taskinfo.getAditionalData().get("datosmail")!=null){ + ((Request) m.get("request")).putAll((Map)taskinfo.getAditionalData().get("datosmail")); + } + RuleUtil.sendMail((Request) m.get("request")); + } + } + + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/Monitor.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/Monitor.java new file mode 100644 index 0000000..334bafd --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/Monitor.java @@ -0,0 +1,263 @@ +package com.fp.bpmlib.flow; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.naming.InitialContext; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import org.drools.core.common.InternalKnowledgeRuntime; +import org.drools.core.impl.InternalKnowledgeBase; +import org.drools.core.impl.StatefulKnowledgeSessionImpl; +import org.jbpm.ruleflow.instance.RuleFlowProcessInstance; +import org.jbpm.services.task.audit.impl.model.AuditTaskImpl; +import org.jbpm.services.task.audit.impl.model.BAMTaskSummaryImpl; +import org.jbpm.workflow.instance.node.HumanTaskNodeInstance; +import org.jbpm.workflow.instance.node.SubProcessNodeInstance; +import org.kie.api.definition.process.Node; +import org.kie.api.runtime.KieSession; +import org.kie.api.runtime.manager.RuntimeEngine; +import org.kie.api.runtime.manager.RuntimeManager; +import org.kie.api.runtime.process.NodeInstance; +import org.kie.api.runtime.process.ProcessInstance; +import org.kie.api.task.TaskService; +import org.kie.api.task.model.Task; +import org.kie.internal.runtime.manager.context.ProcessInstanceIdContext; + +import com.fp.bpmlib.ProcessUtil; +import com.fp.bpmlib.ejb.local.JbpmBeanLocal; +import com.fp.bpmlib.task.client.HumanTaskClient; +import com.fp.simple.dto.TaskInfo; +import com.fp.simple.dto.metadata.ProcessInstanceMeta; + +public class Monitor { + + private KieSession kiesession; + + private ProcessInstance processInstance = null; + + private TaskService taskService; + + private RuntimeManager runtimeManager; + + private RuntimeEngine runtimeEngine; + + private EntityManagerFactory emf; + + /** + * Crea una instancia de flujo. + */ + public Monitor(Long processid) throws Exception { + JbpmBeanLocal local = (JbpmBeanLocal) new InitialContext().lookup("java:global/maiaear-2.1/bpmlib/jbpmbean"); + runtimeManager = local.getRuntimeManager(); + emf = local.getEmf(); + runtimeEngine = runtimeManager.getRuntimeEngine(ProcessInstanceIdContext.get(processid)); + taskService = runtimeEngine.getTaskService(); + kiesession = runtimeEngine.getKieSession(); + processInstance = kiesession.getProcessInstance(processid); + } + + /** + * Cierra la session de trabajo. + */ + public void close() { + // no cerrar la session, esta se cierra en el commit trabaja con JTA. + } + + public KieSession getKiesession() { + return kiesession; + } + + public TaskService getTaskService() { + return taskService; + } + + public ProcessInstance getProcessInstance() { + return processInstance; + } + + /** + * Obtiene el valor de variable. + * + * @param pName Nombre de la varibale a buscar en una instancia de proceso. + * @return Valor de variable + * @throws Exception la exception + */ + public Object getVariable(String pName) throws Exception { + RuleFlowProcessInstance rfpi = (RuleFlowProcessInstance) this.processInstance; + return rfpi.getVariable(pName); + } + + /** + * Obtiene el valor de status. + * + * @param pVariables the variables + * @return Valor de status + * @throws Exception la exception + */ + @SuppressWarnings("unchecked") + public List getStatus() throws Exception { + List data = new ArrayList(); + if (this.processInstance == null) { + return data; + } + + RuleFlowProcessInstance rfpi = (RuleFlowProcessInstance) this.processInstance; + InternalKnowledgeRuntime internal = rfpi.getKnowledgeRuntime(); + if (internal == null) { + internal = new StatefulKnowledgeSessionImpl(1, (InternalKnowledgeBase) this.kiesession.getKieBase()); + rfpi.setKnowledgeRuntime(internal); + } + Collection nl = rfpi.getNodeInstances(); + + for (NodeInstance ni : nl) { + ProcessInstanceMeta pim = new ProcessInstanceMeta(this.processInstance.getId()); + data.add(pim); + Map m = ni.getNode().getMetaData(); + pim.setH(Integer.valueOf("" + m.get("height"))); + pim.setW(Integer.valueOf("" + m.get("width"))); + pim.setX(Integer.valueOf("" + m.get("x"))); + pim.setY(Integer.valueOf("" + m.get("y"))); + pim.setName(processInstance.getProcessName()); + pim.setVersion(processInstance.getProcess().getVersion()); + pim.setActivity(ni.getNodeName()); + pim.setPmetaid(ni.getNodeId()); + Map var = pim.getVariables(); + Object tasks = this.getVariable(ProcessUtil.TASKS_METADATA); + boolean req = true; + if (tasks != null) { + var.put(ProcessUtil.TASKS_METADATA, this.manageTasksMetaData((Map) tasks)); + req = false; + } + if (req) { + tasks = this.getVariable(ProcessUtil.ACTUAL_TASK); + if (tasks != null) { + var.put(ProcessUtil.ACTUAL_TASK, tasks); + } + } + this.manageNode(pim, ni); + } + return data; + } + + /** + * Manage node. + * + * @param pim the pim + * @param ni the ni + * @param pVariables the variables + * @throws Exception la exception + */ + private void manageNode(ProcessInstanceMeta pim, NodeInstance ni) throws Exception { + if (ni instanceof HumanTaskNodeInstance) { + HumanTaskNodeInstance sub = (HumanTaskNodeInstance) ni; + pim.setWorkItem(sub.getWorkItemId()); + Task t = this.taskService.getTaskByWorkItemId(pim.getWorkItem()); + // getDocumentContentId es el contenido de entrada de la tarea. + Map input = HumanTaskClient.getContenido(taskService.getContentById(t.getTaskData().getDocumentContentId())); + TaskInfo info = (TaskInfo) input.get("taskMetaData"); + info.getAditionalData().put("workItem", sub.getWorkItemId()); + pim.addAddtionalInfo("taskMetaData", info); + return; + } + if (ni instanceof SubProcessNodeInstance) { + SubProcessNodeInstance sub = (SubProcessNodeInstance) ni; + Monitor subflujo = new Monitor(sub.getProcessInstanceId()); + for (ProcessInstanceMeta pi : subflujo.getStatus()) { + pim.addSubProcess(pi); + } + return; + } + } + + /** + * Manage tasks meta data. + * + * @param pTasksMetaData the tasks meta data + * @return map + * @throws Exception la exception + */ + private Map manageTasksMetaData(Map pTasksMetaData) throws Exception { + Map data = new HashMap(); + RuleFlowProcessInstance instance = (RuleFlowProcessInstance) processInstance; + for (Entry element : pTasksMetaData.entrySet()) { + Map record = new HashMap(); + Node[] ns = instance.getRuleFlowProcess().getNodes(); + for (Node n : ns) { + if (n.getName().compareTo(element.getKey()) == 0) { + Map m = n.getMetaData(); + record.put("h", Integer.valueOf("" + m.get("height"))); + record.put("w", Integer.valueOf("" + m.get("width"))); + record.put("x", Integer.valueOf("" + m.get("x"))); + record.put("y", Integer.valueOf("" + m.get("y"))); + record.put("name", n.getName()); + break; + } + } + // record.put(ProcessUtil.TASK_METADATA, element.getValue()); + data.put(element.getKey(), record); + } + return data; + } + + /** + * JPQL TAREA_SUMMARY + */ + private static final String TAREA_SUMMARY = "select t from BAMTaskSummaryImpl t where t.taskId = :idtarea"; + + /** + * Obtiene el valor de unfinished tasks por Grupo. + * + * @param pGroupId the user id + * @param pCri the cri + * @return Valor de unfinished tasks + * @throws Exception la exception + */ + public BAMTaskSummaryImpl getBAMTaskSummaryImpl(long idtarea) throws Exception { + EntityManager em = null; + BAMTaskSummaryImpl dato = null; + try { + em = emf.createEntityManager(); + Query qry = em.createQuery(Monitor.TAREA_SUMMARY); + qry.setParameter("idtarea", idtarea); + dato = (BAMTaskSummaryImpl) qry.getSingleResult(); + } catch (NoResultException e) { + // retorna el objeto en null. + } finally { + if (em.isOpen()) { + em.close(); + } + } + return dato; + } + + /** + * JPQL TAREA_SUMMARY + */ + private static final String TAREA_AUDIT_IMP = "select t from AuditTaskImpl t where t.taskId = :idtarea"; + + public AuditTaskImpl getAuditTaskImpl(long idtarea) throws Exception { + EntityManager em = null; + AuditTaskImpl dato = null; + try { + em = emf.createEntityManager(); + Query qry = em.createQuery(Monitor.TAREA_AUDIT_IMP); + qry.setParameter("idtarea", idtarea); + dato = (AuditTaskImpl) qry.getSingleResult(); + } catch (NoResultException e) { + // retorna el objeto en null. + } finally { + if (em.isOpen()) { + em.close(); + } + } + return dato; + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/RuleUtil.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/RuleUtil.java new file mode 100644 index 0000000..892e472 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/flow/RuleUtil.java @@ -0,0 +1,284 @@ +package com.fp.bpmlib.flow; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.dto.Request; +import com.fp.dto.save.SaveRequest; +import com.fp.simple.flow.Asign; + +// TODO: Auto-generated Javadoc +/** + * Class RuleUtil encargada del manejo de las operaciones de una Regla. + * + * @author gfiallos + */ +public final class RuleUtil { + + /** + * Crea una nueva instancia de rule util. + */ + private RuleUtil() { + } + + /** El valor de message. */ + private static ThreadLocal> message = new ThreadLocal>(); + + /** + * Asign. + * + * @param pMaia the maia + * @param pClass the class + * @throws Exception la exception + */ + public static void asign(Map pMaia, String pClass) throws Exception { + Asign asign = (Asign) Class.forName(pClass).newInstance(); + asign.setRequest(RuleUtil.getRequest(pMaia)); + RuleUtil.setAction(pMaia, "A"); + if (!asign.isGroup()) { + RuleUtil.setUser(pMaia, asign.getId()); + } else { + RuleUtil.setGroup(pMaia, asign.getId()); + } + + } + + /** + * Asign officer. + * + * @param pMaia the maia + */ + public static void asignOfficer(Map pMaia) { + String officer = RuleUtil.getRequest(pMaia).getString("officer"); + RuleUtil.setUser(pMaia, officer); + RuleUtil.setAction(pMaia, "A"); + } + + /** + * Obtiene el valor de amount. + * + * @param pMaia the maia + * @return Valor de amount + */ + public static BigDecimal getAmount(Map pMaia) { + return RuleUtil.getRequest(pMaia).getBigDecimal("amount"); + } + + /** + * Obtiene el valor de financial amount. + * + * @param pMaia the maia + * @return Valor de financial amount + */ + public static BigDecimal getFinancialAmount(Map pMaia) { + return RuleUtil.getRequest(pMaia).getBigDecimal("financialamount"); + } + + /** + * Obtiene el valor de rate. + * + * @param pMaia the maia + * @return Valor de rate + */ + public static BigDecimal getRate(Map pMaia) { + return RuleUtil.getRequest(pMaia).getBigDecimal("rate"); + } + + /** + * Obtiene el valor de request. + * + * @param pMaia the maia + * @return Valor de request + */ + public static Request getRequest(Map pMaia) { + return (Request) pMaia.get("request"); + } + + /** + * Obtiene el valor de save request. + * + * @param pMaia the maia + * @return Valor de save request + */ + public static SaveRequest getSaveRequest(Map pMaia) { + return (SaveRequest) RuleUtil.getRequest(pMaia); + } + + /** + * Obtiene el valor de term. + * + * @param pMaia the maia + * @return Valor de term + */ + public static Integer getTerm(Map pMaia) { + return RuleUtil.getRequest(pMaia).getInteger("term"); + } + + /** + * Fija el valor de action. + * + * @param pMaia the maia + * @param pAction the action + */ + public static void setAction(Map pMaia, String pAction) { + pMaia.put("action", pAction); + } + + /** + * Fija el valor de action intermediate. + * + * @param pMaia the maia + * @param pAction the action + */ + public static void setActionIntermediate(Map pMaia, String pAction) { + pMaia.put("action", pAction); + pMaia.put("internalCode", "Y"); + + } + + /** + * Fija el valor de group. + * + * @param pMaia the maia + * @param pGroup the group + */ + public static void setGroup(Map pMaia, String pGroup) { + pMaia.put("groupId", pGroup); + RuleUtil.toGroup(pGroup); + } + + /** + * Fija el valor de user. + * + * @param pMaia the maia + * @param pUser the user + */ + public static void setUser(Map pMaia, String pUser) { + pMaia.put("userId", pUser); + } + + /** + * Obtiene el valor de message. + * + * @return Valor de message + */ + private static Map getMessage() { + Map msg = null; + synchronized (RuleUtil.message) { + msg = RuleUtil.message.get(); + if (msg == null) { + msg = new HashMap(); + RuleUtil.message.set(msg); + } + } + return msg; + } + + /** + * To user. + * + * @param pUser the user + */ + public static void toUser(String pUser) { + Map msg = RuleUtil.getMessage(); + @SuppressWarnings("unchecked") + List user = (List) msg.get("user"); + if (user == null) { + user = new ArrayList(); + msg.put("user", user); + } + user.add(pUser); + } + + /** + * To group. + * + * @param pGroup the group + */ + public static void toGroup(String pGroup) { + Map msg = RuleUtil.getMessage(); + @SuppressWarnings("unchecked") + List group = (List) msg.get("group"); + if (group == null) { + group = new ArrayList(); + msg.put("group", group); + } + group.add(pGroup); + } + + /** + * To field. + * + * @param pField the field + */ + public static void toField(String pField) { + Map msg = RuleUtil.getMessage(); + @SuppressWarnings("unchecked") + List field = (List) msg.get("field"); + if (field == null) { + field = new ArrayList(); + msg.put("field", field); + } + field.add(pField); + } + + /** + * To address. + * + * @param pField the field + */ + public static void toAddress(String pAddress) { + Map msg = RuleUtil.getMessage(); + @SuppressWarnings("unchecked") + List laddress = (List) msg.get("address"); + if (laddress == null) { + laddress = new ArrayList(); + msg.put("address", laddress); + } + if (!laddress.contains(pAddress)) { + laddress.add(pAddress); + } + } + + /** + * Fija el valor de subject template. + * + * @param pTemplate es el valor nuevo de subject template + */ + public static void setSubjectTemplate(Integer pTemplate) { + Map msg = RuleUtil.getMessage(); + msg.put("subject", pTemplate); + } + + /** + * Fija el valor de content template. + * + * @param pTemplate es el valor nuevo de content template + */ + public static void setContentTemplate(Integer pTemplate) { + Map msg = RuleUtil.getMessage(); + msg.put("content", pTemplate); + } + + /** + * Send mail. + * + * @param pRequest the request + * @throws Exception la exception + */ + public static void sendMail(Request pRequest) throws Exception { + Class c = Class.forName("com.fp.bpmlib.mail.MailCommand"); + Map msg = RuleUtil.getMessage(); + msg.put("request", pRequest); + Constructor con = c.getConstructor(Map.class); + Object obj = con.newInstance(msg); + Method m = c.getMethod("send"); + m.invoke(obj); + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/.svn/entries b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/.svn/entries new file mode 100644 index 0000000..8982ffc --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +MailThreadWithAttachment.java +file + + + + +2022-07-28T03:40:45.528815Z +b6eeb4aac6301e4ddc91ff192f933b5e +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +729 + +MailCommand.java +file + + + + +2022-07-28T03:40:45.528815Z +8a7b7e2e828e1ccdd7767d40cc17a5f9 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +2414 + +package-info.java +file + + + + +2022-07-28T03:40:45.529815Z +c1ca351a60ee2fc9eb4d787831bd6f50 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +99 + +MailParameters.java +file + + + + +2022-07-28T03:40:45.529815Z +38edc2fa0c9739c5d822ba11472ee281 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +2656 + +Mailer.java +file + + + + +2022-07-28T03:40:45.529815Z +56b806da05ed6c889c7b09871483a68a +2016-01-15T17:41:51.430820Z +4381 +fpazmino + + + + + + + + + + + + + + + + + + + + + +8854 + +MailThread.java +file + + + + +2022-07-28T03:40:45.529815Z +c7a2fb2d97af2804d2836d6098c4f630 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +687 + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/.svn/text-base/MailCommand.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/.svn/text-base/MailCommand.java.svn-base new file mode 100644 index 0000000..53489aa --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/.svn/text-base/MailCommand.java.svn-base @@ -0,0 +1,89 @@ +/* + * + */ +package com.fp.bpmlib.mail; + +import java.util.List; +import java.util.Map; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; + +// TODO: Auto-generated Javadoc +/** + * MailCommand encargada del envío de correos a partir de una regla. + * + * @author gfiallos + */ +public class MailCommand { + + /** El valor de parameters. */ + private final Map parameters; + + /** El valor de request. */ + private final Request request; + + /** El valor de m. */ + private final Mailer m; + + /** + * Crea una nueva instancia de mail command. + * + * @param pParameters the parameters + * @throws Exception la exception + */ + public MailCommand(Map pParameters) throws Exception { + APPLogger.getLogger().info(pParameters); + parameters = pParameters; + request = (Request) parameters.get("request"); + m = new Mailer(request); + } + + /** + * Send. + * + * @throws Exception la exception + */ + public void send() throws Exception { + this.manageTo(); + m.setSubject((Integer) parameters.get("subject")); + m.setContent((Integer) parameters.get("content")); + MailThread mt = new MailThread(m); + mt.start(); + // this.m.send(); + } + + /** + * Maneja el campo to. + * + * @throws Exception la exception + */ + @SuppressWarnings("unchecked") + private void manageTo() throws Exception { + List users = (List) parameters.get("user"); + if (users != null) { + for (String user : users) { + m.setToUser(user); + } + } + List groups = (List) parameters.get("group"); + if (groups != null) { + for (String group : groups) { + m.setToGroup(group); + } + } + List fields = (List) parameters.get("field"); + if (fields != null) { + for (String field : fields) { + m.setTo(request.getString(field)); + } + } + List ladress = (List) parameters.get("address"); + if (ladress != null) { + for (String address : ladress) { + m.setTo(address); + } + parameters.remove("address"); + } + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/.svn/text-base/MailParameters.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/.svn/text-base/MailParameters.java.svn-base new file mode 100644 index 0000000..a97e4ac --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/.svn/text-base/MailParameters.java.svn-base @@ -0,0 +1,99 @@ +/* + * + */ +package com.fp.bpmlib.mail; + +import java.util.NoSuchElementException; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; + +// TODO: Auto-generated Javadoc +/** + * Parámetros del Sistema empleados para el manejo del Envío de Correos. + * + * @author gfiallos + * + */ +public enum MailParameters { + + /** REMITENTE. */ + MAIL_FROM("MAIL.FROM"), + + /** INDICADOR SI SE REQUIERE AUTENTICACIÓN CON EL SERVIDOR. */ + MAIL_SMTP_AUTH("MAIL.SMTP.AUTH"), + + /** PASSWORD DE INGRESO AL SERVIDOR SMTP. */ + MAIL_SMTP_PASSWORD("MAIL.SMTP.PASSWORD"), + + /** PUERTO SMTP. */ + MAIL_SMTP_PORT("MAIL.SMTP.PORT"), + + /** SERVIDOR SMTP. */ + MAIL_SMTP_SERVER("MAIL.SMTP.SERVER"), + + /** USUARIO DE INGRESO AL SERVIDOR SMTP. */ + MAIL_SMTP_USER("MAIL.SMTP.USER"), + + /** INDICADOR SI EL SERVIDOR MANEJA PROTOCOLO SEGURO. */ + MAIL_SMTPS("MAIL.SMTPS"); + + /** El valor de name. */ + private String name; + + /** + * Crea una nueva instancia de mail parameters. + * + * @param pName the name + */ + private MailParameters(String pName) { + this.name = pName; + } + + /** + * Obtiene el valor de parameter. + * + * @return Valor de parameter + * @throws Exception la exception + */ + private TgeneParameters getParameter() throws Exception { + TgeneParametersKey k = new TgeneParametersKey(this.name, ThreadFacade.getSessionData().getCompany()); + TgeneParameters p = TgeneParameters.find(PersistenceHelper.getEntityManager(), k); + if (p != null) { + return p; + } + throw new NoSuchElementException(); + } + + /** + * Obtiene el valor de string value. + * + * @return Valor de string value + * @throws Exception la exception + */ + public String getStringValue() throws Exception { + return this.getParameter().getTextvalue(); + } + + /** + * Obtiene el valor de int value. + * + * @return Valor de int value + * @throws Exception la exception + */ + public Integer getIntValue() throws Exception { + return this.getParameter().getNumbervalue().intValue(); + } + + /** + * Obtiene el valor de boolean value. + * + * @return Valor de boolean value + * @throws Exception la exception + */ + public boolean isBooleanValue() throws Exception { + return Boolean.valueOf(this.getStringValue()); + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/.svn/text-base/MailThread.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/.svn/text-base/MailThread.java.svn-base new file mode 100644 index 0000000..0d94308 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/.svn/text-base/MailThread.java.svn-base @@ -0,0 +1,40 @@ +/* + * + */ +package com.fp.bpmlib.mail; + +import com.fp.common.logger.APPLogger; + +// TODO: Auto-generated Javadoc +/** + * Class MailThread encargada de. + * + * @author gfiallos + */ +public class MailThread extends Thread { + + /** El valor de m. */ + private Mailer m; + + /** + * Crea una nueva instancia de mail thread. + * + * @param pMaler the maler + */ + public MailThread(Mailer pMaler) { + this.m = pMaler; + } + + /** + * Run. + */ + @Override + public void run() { + try { + this.m.send(); + } catch (Exception e) { + APPLogger.getLogger().warn(e, e); + } + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/.svn/text-base/MailThreadWithAttachment.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/.svn/text-base/MailThreadWithAttachment.java.svn-base new file mode 100644 index 0000000..857d2b6 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/.svn/text-base/MailThreadWithAttachment.java.svn-base @@ -0,0 +1,40 @@ +/* + * + */ +package com.fp.bpmlib.mail; + +import com.fp.common.logger.APPLogger; + +// TODO: Auto-generated Javadoc +/** + * Class MailThread encargada de. + * + * @author gfiallos + */ +public class MailThreadWithAttachment extends Thread { + + /** El valor de m. */ + private Mailer m; + + /** + * Crea una nueva instancia de mail thread. + * + * @param pMaler the maler + */ + public MailThreadWithAttachment(Mailer pMaler) { + this.m = pMaler; + } + + /** + * Run. + */ + @Override + public void run() { + try { + this.m.sendWithAttachment(); + } catch (Exception e) { + APPLogger.getLogger().warn(e, e); + } + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/.svn/text-base/Mailer.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/.svn/text-base/Mailer.java.svn-base new file mode 100644 index 0000000..7646d99 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/.svn/text-base/Mailer.java.svn-base @@ -0,0 +1,252 @@ +/* + * + */ +package com.fp.bpmlib.mail; + +import java.util.HashMap; +import java.util.Map; + +import javax.naming.InitialContext; +import javax.naming.NamingException; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpmlib.ejb.local.LogMailBeanLocal; +import com.fp.bpmlib.messages.MessageManager; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.mail.Mail; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.pbpm.gene.TbpmGroups; +import com.fp.persistence.pbpm.gene.TbpmGroupsKey; + +// TODO: Auto-generated Javadoc +/** + * Class Mailer encargada del envío de Correos. + * + * @author gfiallos + */ +public class Mailer { + + /** El valor de mail. */ + private Mail mail = null; + + /** El valor de request. */ + private final Request request; + + /** + * Crea una nueva instancia de mailer. + * + * @param pRequest the request + * @throws Exception la exception + */ + public Mailer(Request pRequest) throws Exception { + request = pRequest; + mail = new Mail(null, null, null, null, null, false); + this.config(); + } + + /** + * Config. + * + * @throws Exception la exception + */ + private void config() throws Exception { + System.out.println("---------------------------"+MailParameters.MAIL_SMTP_SERVER.getStringValue()); + System.out.println("---------------------------"+ MailParameters.MAIL_SMTP_PORT.getIntValue()); + mail.config(MailParameters.MAIL_FROM.getStringValue(), MailParameters.MAIL_SMTP_SERVER.getStringValue(), + MailParameters.MAIL_SMTP_PORT.getIntValue(), MailParameters.MAIL_SMTP_USER.getStringValue(), + MailParameters.MAIL_SMTP_PASSWORD.getStringValue(), MailParameters.MAIL_SMTP_AUTH.isBooleanValue(), + MailParameters.MAIL_SMTPS.isBooleanValue()); + } + + /** + * Prepare message manager. + * + * @param pTemplate the template + * @return message manager + * @throws Exception la exception + */ + private MessageManager prepareMessageManager(Integer pTemplate) throws Exception { + MessageManager m = new MessageManager(pTemplate, request.getLanguage(), null); + m.setValue("request", request); + return m; + } + + /** + * Fija el valor de subject. + * + * @param pTemplate es el valor nuevo de subject + * @throws Exception la exception + */ + public void setSubject(Integer pTemplate) throws Exception { + mail.setSubject(this.prepareMessageManager(pTemplate).getMessage()); + } + + /** + * Fija el valor de content. + * + * @param pTemplate es el valor nuevo de content + * @throws Exception la exception + */ + public void setContent(Integer pTemplate) throws Exception { + mail.setCont(this.prepareMessageManager(pTemplate).getMessage()); + } + + /** + * Fija el valor de to. + * + * @param pRef es el valor nuevo de to + * @throws Exception la exception + */ + public void setTo(String pRef) throws Exception { + String to = mail.getTo(); + if (to == null) { + mail.setTo(pRef); + } else { + mail.setTo(to + "," + pRef); + } + } + + /** + * Fija el valor de to user. + * + * @param pUser es el valor nuevo de to user + * @throws Exception la exception + */ + public void setToUser(String pUser) throws Exception { + this.setTo(GeneralDescriptions.getEmailByUser(pUser)); + } + + /** + * Fija el valor de to group. + * + * @param pGroup es el valor nuevo de to group + * @throws Exception la exception + */ + public void setToGroup(String pGroup) throws Exception { + TbpmGroupsKey k = new TbpmGroupsKey(pGroup, ThreadFacade.getSessionData().getCompany()); + TbpmGroups g = TbpmGroups.find(PersistenceHelper.getEntityManager(), k); + if (g == null) { + throw new Exception("GRUPO NO EXISTE |" + pGroup + "|"); + } + this.setTo(g.getEmail()); + } + + /** + * Envía el Correo. + * + * @throws Exception la exception + */ + public void send() throws Exception { + try { + if ((mail.getTo() == null) || (mail.getSubject() == null) || (mail.getCont() == null)) { + throw new Exception(mail.getTo() + " " + mail.getSubject() + " " + (mail.getCont() != null)); + } + String [] correosl=mail.getTo().split(","); + LogMailBeanLocal beanLocal = (LogMailBeanLocal) new InitialContext().lookup("java:global/maiaear-2.1/bpmlib/logMailBean"); + for(String para:correosl){ + try{ + mail.setTo(para); + APPLogger.getLogger().info("Mensaje a enviar " + mail.getSubject() + " para " + mail.getTo()); + mail.send(); + try { + Map mapaMail = new HashMap(); + mapaMail.put("to", mail.getTo()); + mapaMail.put("subject", mail.getSubject()); + mapaMail.put("cont", mail.getCont()); + mapaMail.put("estado", "Y"); + beanLocal.logMail(mapaMail); + } catch (Exception e) { + e.getMessage(); + APPLogger.getLogger().error("1.-Excepcion en seteo mail"); + } + + }catch (Exception e) { + APPLogger.getLogger().warn("El mensaje" + mail.getSubject() + " para " + mail.getTo() + " no se ha podido enviar "); + APPLogger.getLogger().error(e, e); + + try { + //LogMailBeanLocal beanLocal = (LogMailBeanLocal) new InitialContext().lookup("java:global/maiaear-2.1/bpmlib/logMailBean"); + Map mapaMail = new HashMap(); + mapaMail.put("to", mail.getTo()); + mapaMail.put("subject", mail.getSubject()); + mapaMail.put("cont", mail.getCont()); + mapaMail.put("estado", "N"); + mapaMail.put("error", e.getMessage()); + beanLocal.logMail(mapaMail); + } catch (Exception e2) { + e.getMessage(); + APPLogger.getLogger().error("2.-Excepcion en seteo mail"); + } + } + } + }catch (NamingException e) { + e.getMessage(); + APPLogger.getLogger().error("Servicio no encontrado"); + } + catch (Exception e) { + e.getMessage(); + APPLogger.getLogger().error("Excepcion al enviar mail"); + } + } + + /** + * Envía el Correo. + * + * @throws Exception la exception + */ + public void sendWithAttachment() throws Exception { + try { + if ((mail.getTo() == null) || (mail.getSubject() == null) || (mail.getCont() == null)) { + throw new Exception(mail.getTo() + " " + mail.getSubject() + " " + (mail.getCont() != null)); + } + String [] correosl=mail.getTo().split(","); + LogMailBeanLocal beanLocal = (LogMailBeanLocal) new InitialContext().lookup("java:global/maiaear-2.1/bpmlib/logMailBean"); + for(String para:correosl){ + try{ + mail.setTo(para); + APPLogger.getLogger().info("Mensaje a enviar " + mail.getSubject() + " para " + mail.getTo()); + mail.send(); + try { + Map mapaMail = new HashMap(); + mapaMail.put("to", mail.getTo()); + mapaMail.put("subject", mail.getSubject()); + mapaMail.put("cont", mail.getCont()); + mapaMail.put("estado", "Y"); + beanLocal.logMail(mapaMail); + } catch (Exception e) { + e.getMessage(); + APPLogger.getLogger().error("1.-Excepcion en seteo mail"); + } + + }catch (Exception e) { + APPLogger.getLogger().warn("El mensaje" + mail.getSubject() + " para " + mail.getTo() + " no se ha podido enviar "); + APPLogger.getLogger().error(e, e); + + try { + //LogMailBeanLocal beanLocal = (LogMailBeanLocal) new InitialContext().lookup("java:global/maiaear-2.1/bpmlib/logMailBean"); + Map mapaMail = new HashMap(); + mapaMail.put("to", mail.getTo()); + mapaMail.put("subject", mail.getSubject()); + mapaMail.put("cont", mail.getCont()); + mapaMail.put("estado", "N"); + mapaMail.put("error", e.getMessage()); + beanLocal.logMail(mapaMail); + } catch (Exception e2) { + e.getMessage(); + APPLogger.getLogger().error("2.-Excepcion en seteo mail"); + } + } + } + }catch (NamingException e) { + e.getMessage(); + APPLogger.getLogger().error("Servicio no encontrado"); + } + catch (Exception e) { + e.getMessage(); + APPLogger.getLogger().error("Excepcion al enviar mail"); + } + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/.svn/text-base/package-info.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..107e74b --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,4 @@ +/** + * Provee las clases para el envío de correos electrónicos + */ +package com.fp.bpmlib.mail; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/MailCommand.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/MailCommand.java new file mode 100644 index 0000000..53489aa --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/MailCommand.java @@ -0,0 +1,89 @@ +/* + * + */ +package com.fp.bpmlib.mail; + +import java.util.List; +import java.util.Map; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; + +// TODO: Auto-generated Javadoc +/** + * MailCommand encargada del envío de correos a partir de una regla. + * + * @author gfiallos + */ +public class MailCommand { + + /** El valor de parameters. */ + private final Map parameters; + + /** El valor de request. */ + private final Request request; + + /** El valor de m. */ + private final Mailer m; + + /** + * Crea una nueva instancia de mail command. + * + * @param pParameters the parameters + * @throws Exception la exception + */ + public MailCommand(Map pParameters) throws Exception { + APPLogger.getLogger().info(pParameters); + parameters = pParameters; + request = (Request) parameters.get("request"); + m = new Mailer(request); + } + + /** + * Send. + * + * @throws Exception la exception + */ + public void send() throws Exception { + this.manageTo(); + m.setSubject((Integer) parameters.get("subject")); + m.setContent((Integer) parameters.get("content")); + MailThread mt = new MailThread(m); + mt.start(); + // this.m.send(); + } + + /** + * Maneja el campo to. + * + * @throws Exception la exception + */ + @SuppressWarnings("unchecked") + private void manageTo() throws Exception { + List users = (List) parameters.get("user"); + if (users != null) { + for (String user : users) { + m.setToUser(user); + } + } + List groups = (List) parameters.get("group"); + if (groups != null) { + for (String group : groups) { + m.setToGroup(group); + } + } + List fields = (List) parameters.get("field"); + if (fields != null) { + for (String field : fields) { + m.setTo(request.getString(field)); + } + } + List ladress = (List) parameters.get("address"); + if (ladress != null) { + for (String address : ladress) { + m.setTo(address); + } + parameters.remove("address"); + } + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/MailParameters.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/MailParameters.java new file mode 100644 index 0000000..a97e4ac --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/MailParameters.java @@ -0,0 +1,99 @@ +/* + * + */ +package com.fp.bpmlib.mail; + +import java.util.NoSuchElementException; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; + +// TODO: Auto-generated Javadoc +/** + * Parámetros del Sistema empleados para el manejo del Envío de Correos. + * + * @author gfiallos + * + */ +public enum MailParameters { + + /** REMITENTE. */ + MAIL_FROM("MAIL.FROM"), + + /** INDICADOR SI SE REQUIERE AUTENTICACIÓN CON EL SERVIDOR. */ + MAIL_SMTP_AUTH("MAIL.SMTP.AUTH"), + + /** PASSWORD DE INGRESO AL SERVIDOR SMTP. */ + MAIL_SMTP_PASSWORD("MAIL.SMTP.PASSWORD"), + + /** PUERTO SMTP. */ + MAIL_SMTP_PORT("MAIL.SMTP.PORT"), + + /** SERVIDOR SMTP. */ + MAIL_SMTP_SERVER("MAIL.SMTP.SERVER"), + + /** USUARIO DE INGRESO AL SERVIDOR SMTP. */ + MAIL_SMTP_USER("MAIL.SMTP.USER"), + + /** INDICADOR SI EL SERVIDOR MANEJA PROTOCOLO SEGURO. */ + MAIL_SMTPS("MAIL.SMTPS"); + + /** El valor de name. */ + private String name; + + /** + * Crea una nueva instancia de mail parameters. + * + * @param pName the name + */ + private MailParameters(String pName) { + this.name = pName; + } + + /** + * Obtiene el valor de parameter. + * + * @return Valor de parameter + * @throws Exception la exception + */ + private TgeneParameters getParameter() throws Exception { + TgeneParametersKey k = new TgeneParametersKey(this.name, ThreadFacade.getSessionData().getCompany()); + TgeneParameters p = TgeneParameters.find(PersistenceHelper.getEntityManager(), k); + if (p != null) { + return p; + } + throw new NoSuchElementException(); + } + + /** + * Obtiene el valor de string value. + * + * @return Valor de string value + * @throws Exception la exception + */ + public String getStringValue() throws Exception { + return this.getParameter().getTextvalue(); + } + + /** + * Obtiene el valor de int value. + * + * @return Valor de int value + * @throws Exception la exception + */ + public Integer getIntValue() throws Exception { + return this.getParameter().getNumbervalue().intValue(); + } + + /** + * Obtiene el valor de boolean value. + * + * @return Valor de boolean value + * @throws Exception la exception + */ + public boolean isBooleanValue() throws Exception { + return Boolean.valueOf(this.getStringValue()); + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/MailThread.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/MailThread.java new file mode 100644 index 0000000..0d94308 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/MailThread.java @@ -0,0 +1,40 @@ +/* + * + */ +package com.fp.bpmlib.mail; + +import com.fp.common.logger.APPLogger; + +// TODO: Auto-generated Javadoc +/** + * Class MailThread encargada de. + * + * @author gfiallos + */ +public class MailThread extends Thread { + + /** El valor de m. */ + private Mailer m; + + /** + * Crea una nueva instancia de mail thread. + * + * @param pMaler the maler + */ + public MailThread(Mailer pMaler) { + this.m = pMaler; + } + + /** + * Run. + */ + @Override + public void run() { + try { + this.m.send(); + } catch (Exception e) { + APPLogger.getLogger().warn(e, e); + } + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/MailThreadWithAttachment.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/MailThreadWithAttachment.java new file mode 100644 index 0000000..857d2b6 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/MailThreadWithAttachment.java @@ -0,0 +1,40 @@ +/* + * + */ +package com.fp.bpmlib.mail; + +import com.fp.common.logger.APPLogger; + +// TODO: Auto-generated Javadoc +/** + * Class MailThread encargada de. + * + * @author gfiallos + */ +public class MailThreadWithAttachment extends Thread { + + /** El valor de m. */ + private Mailer m; + + /** + * Crea una nueva instancia de mail thread. + * + * @param pMaler the maler + */ + public MailThreadWithAttachment(Mailer pMaler) { + this.m = pMaler; + } + + /** + * Run. + */ + @Override + public void run() { + try { + this.m.sendWithAttachment(); + } catch (Exception e) { + APPLogger.getLogger().warn(e, e); + } + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/Mailer.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/Mailer.java new file mode 100644 index 0000000..7646d99 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/Mailer.java @@ -0,0 +1,252 @@ +/* + * + */ +package com.fp.bpmlib.mail; + +import java.util.HashMap; +import java.util.Map; + +import javax.naming.InitialContext; +import javax.naming.NamingException; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpmlib.ejb.local.LogMailBeanLocal; +import com.fp.bpmlib.messages.MessageManager; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.mail.Mail; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.pbpm.gene.TbpmGroups; +import com.fp.persistence.pbpm.gene.TbpmGroupsKey; + +// TODO: Auto-generated Javadoc +/** + * Class Mailer encargada del envío de Correos. + * + * @author gfiallos + */ +public class Mailer { + + /** El valor de mail. */ + private Mail mail = null; + + /** El valor de request. */ + private final Request request; + + /** + * Crea una nueva instancia de mailer. + * + * @param pRequest the request + * @throws Exception la exception + */ + public Mailer(Request pRequest) throws Exception { + request = pRequest; + mail = new Mail(null, null, null, null, null, false); + this.config(); + } + + /** + * Config. + * + * @throws Exception la exception + */ + private void config() throws Exception { + System.out.println("---------------------------"+MailParameters.MAIL_SMTP_SERVER.getStringValue()); + System.out.println("---------------------------"+ MailParameters.MAIL_SMTP_PORT.getIntValue()); + mail.config(MailParameters.MAIL_FROM.getStringValue(), MailParameters.MAIL_SMTP_SERVER.getStringValue(), + MailParameters.MAIL_SMTP_PORT.getIntValue(), MailParameters.MAIL_SMTP_USER.getStringValue(), + MailParameters.MAIL_SMTP_PASSWORD.getStringValue(), MailParameters.MAIL_SMTP_AUTH.isBooleanValue(), + MailParameters.MAIL_SMTPS.isBooleanValue()); + } + + /** + * Prepare message manager. + * + * @param pTemplate the template + * @return message manager + * @throws Exception la exception + */ + private MessageManager prepareMessageManager(Integer pTemplate) throws Exception { + MessageManager m = new MessageManager(pTemplate, request.getLanguage(), null); + m.setValue("request", request); + return m; + } + + /** + * Fija el valor de subject. + * + * @param pTemplate es el valor nuevo de subject + * @throws Exception la exception + */ + public void setSubject(Integer pTemplate) throws Exception { + mail.setSubject(this.prepareMessageManager(pTemplate).getMessage()); + } + + /** + * Fija el valor de content. + * + * @param pTemplate es el valor nuevo de content + * @throws Exception la exception + */ + public void setContent(Integer pTemplate) throws Exception { + mail.setCont(this.prepareMessageManager(pTemplate).getMessage()); + } + + /** + * Fija el valor de to. + * + * @param pRef es el valor nuevo de to + * @throws Exception la exception + */ + public void setTo(String pRef) throws Exception { + String to = mail.getTo(); + if (to == null) { + mail.setTo(pRef); + } else { + mail.setTo(to + "," + pRef); + } + } + + /** + * Fija el valor de to user. + * + * @param pUser es el valor nuevo de to user + * @throws Exception la exception + */ + public void setToUser(String pUser) throws Exception { + this.setTo(GeneralDescriptions.getEmailByUser(pUser)); + } + + /** + * Fija el valor de to group. + * + * @param pGroup es el valor nuevo de to group + * @throws Exception la exception + */ + public void setToGroup(String pGroup) throws Exception { + TbpmGroupsKey k = new TbpmGroupsKey(pGroup, ThreadFacade.getSessionData().getCompany()); + TbpmGroups g = TbpmGroups.find(PersistenceHelper.getEntityManager(), k); + if (g == null) { + throw new Exception("GRUPO NO EXISTE |" + pGroup + "|"); + } + this.setTo(g.getEmail()); + } + + /** + * Envía el Correo. + * + * @throws Exception la exception + */ + public void send() throws Exception { + try { + if ((mail.getTo() == null) || (mail.getSubject() == null) || (mail.getCont() == null)) { + throw new Exception(mail.getTo() + " " + mail.getSubject() + " " + (mail.getCont() != null)); + } + String [] correosl=mail.getTo().split(","); + LogMailBeanLocal beanLocal = (LogMailBeanLocal) new InitialContext().lookup("java:global/maiaear-2.1/bpmlib/logMailBean"); + for(String para:correosl){ + try{ + mail.setTo(para); + APPLogger.getLogger().info("Mensaje a enviar " + mail.getSubject() + " para " + mail.getTo()); + mail.send(); + try { + Map mapaMail = new HashMap(); + mapaMail.put("to", mail.getTo()); + mapaMail.put("subject", mail.getSubject()); + mapaMail.put("cont", mail.getCont()); + mapaMail.put("estado", "Y"); + beanLocal.logMail(mapaMail); + } catch (Exception e) { + e.getMessage(); + APPLogger.getLogger().error("1.-Excepcion en seteo mail"); + } + + }catch (Exception e) { + APPLogger.getLogger().warn("El mensaje" + mail.getSubject() + " para " + mail.getTo() + " no se ha podido enviar "); + APPLogger.getLogger().error(e, e); + + try { + //LogMailBeanLocal beanLocal = (LogMailBeanLocal) new InitialContext().lookup("java:global/maiaear-2.1/bpmlib/logMailBean"); + Map mapaMail = new HashMap(); + mapaMail.put("to", mail.getTo()); + mapaMail.put("subject", mail.getSubject()); + mapaMail.put("cont", mail.getCont()); + mapaMail.put("estado", "N"); + mapaMail.put("error", e.getMessage()); + beanLocal.logMail(mapaMail); + } catch (Exception e2) { + e.getMessage(); + APPLogger.getLogger().error("2.-Excepcion en seteo mail"); + } + } + } + }catch (NamingException e) { + e.getMessage(); + APPLogger.getLogger().error("Servicio no encontrado"); + } + catch (Exception e) { + e.getMessage(); + APPLogger.getLogger().error("Excepcion al enviar mail"); + } + } + + /** + * Envía el Correo. + * + * @throws Exception la exception + */ + public void sendWithAttachment() throws Exception { + try { + if ((mail.getTo() == null) || (mail.getSubject() == null) || (mail.getCont() == null)) { + throw new Exception(mail.getTo() + " " + mail.getSubject() + " " + (mail.getCont() != null)); + } + String [] correosl=mail.getTo().split(","); + LogMailBeanLocal beanLocal = (LogMailBeanLocal) new InitialContext().lookup("java:global/maiaear-2.1/bpmlib/logMailBean"); + for(String para:correosl){ + try{ + mail.setTo(para); + APPLogger.getLogger().info("Mensaje a enviar " + mail.getSubject() + " para " + mail.getTo()); + mail.send(); + try { + Map mapaMail = new HashMap(); + mapaMail.put("to", mail.getTo()); + mapaMail.put("subject", mail.getSubject()); + mapaMail.put("cont", mail.getCont()); + mapaMail.put("estado", "Y"); + beanLocal.logMail(mapaMail); + } catch (Exception e) { + e.getMessage(); + APPLogger.getLogger().error("1.-Excepcion en seteo mail"); + } + + }catch (Exception e) { + APPLogger.getLogger().warn("El mensaje" + mail.getSubject() + " para " + mail.getTo() + " no se ha podido enviar "); + APPLogger.getLogger().error(e, e); + + try { + //LogMailBeanLocal beanLocal = (LogMailBeanLocal) new InitialContext().lookup("java:global/maiaear-2.1/bpmlib/logMailBean"); + Map mapaMail = new HashMap(); + mapaMail.put("to", mail.getTo()); + mapaMail.put("subject", mail.getSubject()); + mapaMail.put("cont", mail.getCont()); + mapaMail.put("estado", "N"); + mapaMail.put("error", e.getMessage()); + beanLocal.logMail(mapaMail); + } catch (Exception e2) { + e.getMessage(); + APPLogger.getLogger().error("2.-Excepcion en seteo mail"); + } + } + } + }catch (NamingException e) { + e.getMessage(); + APPLogger.getLogger().error("Servicio no encontrado"); + } + catch (Exception e) { + e.getMessage(); + APPLogger.getLogger().error("Excepcion al enviar mail"); + } + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/package-info.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/package-info.java new file mode 100644 index 0000000..107e74b --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/mail/package-info.java @@ -0,0 +1,4 @@ +/** + * Provee las clases para el envío de correos electrónicos + */ +package com.fp.bpmlib.mail; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/messages/.svn/entries b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/messages/.svn/entries new file mode 100644 index 0000000..77f5664 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/messages/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/messages +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +MessageManager.java +file + + + + +2022-07-28T03:40:45.962817Z +756c8350b88ad95f51bf0d16088947b0 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +2136 + +package-info.java +file + + + + +2022-07-28T03:40:45.963817Z +ee13f1209f1d4af913b83c46782abf3f +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +103 + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/messages/.svn/text-base/MessageManager.java.netbeans-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/messages/.svn/text-base/MessageManager.java.netbeans-base new file mode 100644 index 0000000..79f2dc0 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/messages/.svn/text-base/MessageManager.java.netbeans-base @@ -0,0 +1,69 @@ +/* + * + */ +package com.fp.bpmlib.messages; + +import java.util.Map; +import java.util.Map.Entry; + +import com.fp.bpmlib.BPMException; +import com.fp.common.messages.MessageUtil; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDesc; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDescKey; + +// TODO: Auto-generated Javadoc +/** + * Class MessageManager encargada de. + * + * @author gfiallos + */ +public class MessageManager { + + /** El valor de msg. */ + private MessageUtil msg; + + /** + * Crea una nueva instancia de message manager. + * + * @param pMessageCode the message code + * @param pLanguage the language + * @param pReferences the references + * @throws Exception la exception + */ + public MessageManager(Integer pMessageCode, String pLanguage, Map pReferences) throws Exception { + TgeneMessageTemplatesDescKey tk = new TgeneMessageTemplatesDescKey(pMessageCode, pLanguage); + TgeneMessageTemplatesDesc t = TgeneMessageTemplatesDesc.find(PersistenceHelper.getEntityManager(), tk); + if (t == null) { + throw new BPMException("BPM-0011", "NO SE HA PODIDO ENCONTRAR LA PLANTILLA {0}", pMessageCode); + } + String template = t.getTemplate(); + this.msg = new MessageUtil(pLanguage, template); + if (pReferences != null) { + for (Entry e : pReferences.entrySet()) { + this.msg.setValue(e.getKey(), e.getValue()); + } + } + } + + /** + * Fija el valor de value. + * + * @param pName the name + * @param pValue the value + * @throws Exception la exception + */ + public void setValue(String pName, Object pValue) throws Exception { + this.msg.setValue(pName, pValue); + } + + /** + * Obtiene el valor de message. + * + * @return Valor de message + * @throws Exception la exception + */ + public String getMessage() throws Exception { + return this.msg.getMessage(); + } +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/messages/.svn/text-base/MessageManager.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/messages/.svn/text-base/MessageManager.java.svn-base new file mode 100644 index 0000000..79f2dc0 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/messages/.svn/text-base/MessageManager.java.svn-base @@ -0,0 +1,69 @@ +/* + * + */ +package com.fp.bpmlib.messages; + +import java.util.Map; +import java.util.Map.Entry; + +import com.fp.bpmlib.BPMException; +import com.fp.common.messages.MessageUtil; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDesc; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDescKey; + +// TODO: Auto-generated Javadoc +/** + * Class MessageManager encargada de. + * + * @author gfiallos + */ +public class MessageManager { + + /** El valor de msg. */ + private MessageUtil msg; + + /** + * Crea una nueva instancia de message manager. + * + * @param pMessageCode the message code + * @param pLanguage the language + * @param pReferences the references + * @throws Exception la exception + */ + public MessageManager(Integer pMessageCode, String pLanguage, Map pReferences) throws Exception { + TgeneMessageTemplatesDescKey tk = new TgeneMessageTemplatesDescKey(pMessageCode, pLanguage); + TgeneMessageTemplatesDesc t = TgeneMessageTemplatesDesc.find(PersistenceHelper.getEntityManager(), tk); + if (t == null) { + throw new BPMException("BPM-0011", "NO SE HA PODIDO ENCONTRAR LA PLANTILLA {0}", pMessageCode); + } + String template = t.getTemplate(); + this.msg = new MessageUtil(pLanguage, template); + if (pReferences != null) { + for (Entry e : pReferences.entrySet()) { + this.msg.setValue(e.getKey(), e.getValue()); + } + } + } + + /** + * Fija el valor de value. + * + * @param pName the name + * @param pValue the value + * @throws Exception la exception + */ + public void setValue(String pName, Object pValue) throws Exception { + this.msg.setValue(pName, pValue); + } + + /** + * Obtiene el valor de message. + * + * @return Valor de message + * @throws Exception la exception + */ + public String getMessage() throws Exception { + return this.msg.getMessage(); + } +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/messages/.svn/text-base/package-info.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/messages/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..2d01dd9 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/messages/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,4 @@ +/** + * Provee las clases para el manejo de Plantillas y mensajes + */ +package com.fp.bpmlib.messages; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/messages/MessageManager.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/messages/MessageManager.java new file mode 100644 index 0000000..79f2dc0 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/messages/MessageManager.java @@ -0,0 +1,69 @@ +/* + * + */ +package com.fp.bpmlib.messages; + +import java.util.Map; +import java.util.Map.Entry; + +import com.fp.bpmlib.BPMException; +import com.fp.common.messages.MessageUtil; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDesc; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDescKey; + +// TODO: Auto-generated Javadoc +/** + * Class MessageManager encargada de. + * + * @author gfiallos + */ +public class MessageManager { + + /** El valor de msg. */ + private MessageUtil msg; + + /** + * Crea una nueva instancia de message manager. + * + * @param pMessageCode the message code + * @param pLanguage the language + * @param pReferences the references + * @throws Exception la exception + */ + public MessageManager(Integer pMessageCode, String pLanguage, Map pReferences) throws Exception { + TgeneMessageTemplatesDescKey tk = new TgeneMessageTemplatesDescKey(pMessageCode, pLanguage); + TgeneMessageTemplatesDesc t = TgeneMessageTemplatesDesc.find(PersistenceHelper.getEntityManager(), tk); + if (t == null) { + throw new BPMException("BPM-0011", "NO SE HA PODIDO ENCONTRAR LA PLANTILLA {0}", pMessageCode); + } + String template = t.getTemplate(); + this.msg = new MessageUtil(pLanguage, template); + if (pReferences != null) { + for (Entry e : pReferences.entrySet()) { + this.msg.setValue(e.getKey(), e.getValue()); + } + } + } + + /** + * Fija el valor de value. + * + * @param pName the name + * @param pValue the value + * @throws Exception la exception + */ + public void setValue(String pName, Object pValue) throws Exception { + this.msg.setValue(pName, pValue); + } + + /** + * Obtiene el valor de message. + * + * @return Valor de message + * @throws Exception la exception + */ + public String getMessage() throws Exception { + return this.msg.getMessage(); + } +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/messages/package-info.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/messages/package-info.java new file mode 100644 index 0000000..2d01dd9 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/messages/package-info.java @@ -0,0 +1,4 @@ +/** + * Provee las clases para el manejo de Plantillas y mensajes + */ +package com.fp.bpmlib.messages; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/metadata/.svn/entries b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/metadata/.svn/entries new file mode 100644 index 0000000..5ad45cf --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/metadata/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/metadata +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +package-info.java +file + + + + +2022-07-28T03:40:45.500815Z +d3ee53809e70088e84dcd8e85516f460 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +120 + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/metadata/.svn/text-base/package-info.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/metadata/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..ff34c5a --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/metadata/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,4 @@ +/** + * Provee los utilitarios para el transporte de la información de los Flujos + */ +package com.fp.bpmlib.metadata; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/metadata/package-info.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/metadata/package-info.java new file mode 100644 index 0000000..ff34c5a --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/metadata/package-info.java @@ -0,0 +1,4 @@ +/** + * Provee los utilitarios para el transporte de la información de los Flujos + */ +package com.fp.bpmlib.metadata; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/package-info.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/package-info.java new file mode 100644 index 0000000..aaa706e --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/package-info.java @@ -0,0 +1,4 @@ +/** + * Provee los utilitarios para el acceso a GUVNOR + */ +package com.fp.bpmlib; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/entries b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/entries new file mode 100644 index 0000000..f6aecab --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/entries @@ -0,0 +1,284 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +groups +dir + +inbox +dir + +solicitud +dir + +task +dir + +package-info.java +file + + + + +2022-07-28T03:40:45.935817Z +11178781d4f7ef811cee5600ac58314e +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +100 + +monitor +dir + +TransactionLogResults.java +file + + + + +2022-07-28T03:40:45.935817Z +e38561b1139ca1d4dfb8c63414b6d75a +2014-12-16T05:58:36.188647Z +3520 +gbenavides + + + + + + + + + + + + + + + + + + + + + +4075 + +rules +dir + +EndedFlowDetail.java +file + + + + +2022-07-28T03:40:45.935817Z +6e62086abf0236da3519eb1dca407709 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +5484 + +EndedFlows.java +file + + + + +2022-07-28T03:40:45.936817Z +4dbeff082de606c6c95834afef0fef4c +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +3683 + +TransactionsLog.java +file + + + + +2022-07-28T03:40:45.936817Z +6cb5242779b9b12724042f6789a6f6ff +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +3019 + +RuleTrigger.java +file + + + + +2022-07-28T03:40:45.936817Z +f4fcf5078b63af8b69d4cd3579e5267a +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +785 + +EndedFlowsResults.java +file + + + + +2022-07-28T03:40:45.936817Z +9f0cfb477d25e0bd10c3c39d13c817de +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +5601 + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/text-base/EndedFlowDetail.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/text-base/EndedFlowDetail.java.svn-base new file mode 100644 index 0000000..6a0f550 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/text-base/EndedFlowDetail.java.svn-base @@ -0,0 +1,139 @@ +/* + * + */ +package com.fp.bpmlib.query; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pbpm.gene.TbpmTaskComments; +import com.fp.persistence.pgeneral.log.TgeneTransactionLog; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; +import com.fp.persistence.pgeneral.trans.TgeneTransactionKey; + +// TODO: Auto-generated Javadoc +/** + * Class EndedFlowDetail encargada de. + * + * @author gfiallos + */ +public class EndedFlowDetail extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** Constante SQL. */ + private static final String SQL = "SELECT " + + " a.activityname,a.sequence,a.usercode,a.groupcode,a.created,a.completed,a.expectedtime,a.response ,a.module,a.transaction,a.version, ( " + + " SELECT " + " z.name " + " FROM " + " tgenetransaction z " + " WHERE " + + " z.transactionmodule=a.module " + " AND z.transactioncode=a.transaction " + + " AND z.transactionversion=a.version),a.taskid " + " FROM " + " tbpmactivities a " + " WHERE " + + " a.journalid=:journal " + " ORDER BY " + " created"; + + /** El valor de id. */ + private String id; + + /** El valor de resp. */ + private Response resp; + + /** El valor de sdf1. */ + private SimpleDateFormat sdf1; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + this.sdf1 = new SimpleDateFormat("dd-MM-yyyy HH:mm"); + this.id = pQueryRequest.getString("ID"); + this.resp = pQueryRequest.getResponse(); + TgeneTransactionLog tl = TgeneTransactionLog.find(PersistenceHelper.getEntityManager(), this.id); + this.resp.put("DATA", tl.getAditionaldata()); + TgeneTransaction t = TgeneTransaction.find(PersistenceHelper.getEntityManager(), + new TgeneTransactionKey(tl.getTransactionmodule(), tl.getTransactioncode(), tl.getTransactionversion())); + this.resp.put("TRN", t.getName()); + this.manageActivities(); + return pQueryRequest; + } + + /** + * Manage activities. + * + * @throws Exception la exception + */ + public void manageActivities() throws Exception { + Query q = PersistenceHelper.createNativeQuery(EndedFlowDetail.SQL); + q.setParameter("journal", this.id); + @SuppressWarnings("unchecked") + List l = q.getResultList(); + List> data = new ArrayList>(); + + DecimalFormat df = new DecimalFormat("00"); + for (Object obj : l) { + Map rec = new HashMap(); + Object[] oData = (Object[]) obj; + rec.put("activityname", oData[0] + " (" + oData[11] + ")"); + rec.put("sequence", oData[1]); + rec.put("usercode", oData[2]); + rec.put("groupcode", oData[3]); + Timestamp completed = ((Timestamp) oData[5]); + Timestamp created = ((Timestamp) oData[4]); + rec.put("created", this.sdf1.format(created)); + rec.put("completed", this.sdf1.format(completed)); + Long exp = Long.valueOf("" + oData[6]) / 1000; + BigDecimal aux = new BigDecimal(exp / 60); + rec.put("expectedtime", df.format(aux.intValue()) + ":" + df.format(exp % 60)); + Long real = Long.valueOf("" + (completed.getTime() - created.getTime())) / 1000; + aux = new BigDecimal(real / 60); + rec.put("realtime", df.format(aux.intValue()) + ":" + df.format(real % 60)); + rec.put("response", oData[7]); + rec.put("obs", this.getComments(Long.valueOf("" + oData[12]))); + data.add(rec); + } + this.resp.put("TBPMACTIVITIES", data); + } + + /** + * Obtiene el valor de comments. + * + * @param pTID the tID + * @return Valor de comments + * @throws Exception la exception + */ + private String getComments(long pTID) throws Exception { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + try { + String jpql = "from TbpmTaskComments tc where tc.taskid=:tid"; + Query q = PersistenceHelper.createQuery(jpql); + q.setParameter("tid", pTID); + @SuppressWarnings("unchecked") + List tc = q.getResultList(); + for (TbpmTaskComments tbpmTaskComments : tc) { + pw.println(tbpmTaskComments.getUsercode() + " : " + this.sdf1.format(tbpmTaskComments.getAdded())); + pw.println(tbpmTaskComments.getText()); + } + } finally { + pw.close(); + } + return sw.toString(); + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/text-base/EndedFlows.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/text-base/EndedFlows.java.svn-base new file mode 100644 index 0000000..8433eca --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/text-base/EndedFlows.java.svn-base @@ -0,0 +1,102 @@ +/* + * + */ +package com.fp.bpmlib.query; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.GeneralQuery; +import com.fp.persistence.commondb.PersistenceHelper; + +// TODO: Auto-generated Javadoc +/** + * Clase que se encarga de presentar en el lov las transacciones que contiene la tabla TgeneTransactionLog. + * + * @author gfiallos + */ + +public class EndedFlows extends QueryRule { + + /** Constante serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Metodo que presenta la lista de transacciones en vuelo. + * + * @param qr the qr + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest qr) throws Exception { + if(qr.isJsf()){ + + }else{ + + } + Response response = qr.getResponse(); + + StringBuilder jpql = new StringBuilder(400); + jpql.append("select t.pk.transactionmodule,t.pk.transactioncode,t.pk.transactionversion,t.name " + + "from TgeneTransaction t where exists ( select 1 " + + "from TgeneTransactionLog r where exists(select 1 from TbpmProcessInstance o " + + "where o.pk = r.pk and coalesce(o.finalized, 'N')='Y') and t.pk.transactionmodule=r.transactionmodule " + + "and t.pk.transactioncode=r.transactioncode and t.pk.transactionversion=r.transactionversion ) "); + + //Ingresa y verifica el frontend + Query qry = this.processQuery(qr, jpql); + + + List ltransaction = qry.getResultList(); + List> detailgrid = new ArrayList>(); + for (int i = 0; i < ltransaction.size(); i++) { + Map detail = new HashMap(); + Object[] datos = (Object[]) ltransaction.get(i); + detail.put("pk_transactionmodule", datos[0]); + detail.put("pk_transactioncode", datos[1]); + detail.put("pk_transactionversion", datos[2]); + detail.put("name", datos[3]); + // detail.put("solicitudenumber", datos[4]); + detailgrid.add(detail); + } + response.put("TGENETRANSACTION", detailgrid); + return qr; + } + + /** + * Direcciona la consulta jsf y dojo + * @param qr + * @param jpql + * @return + * @throws Exception + */ + private Query processQuery(QueryRequest qr, StringBuilder jpql) throws Exception { + Query qry = null; + if(qr.isJsf()){ + DtoQuery dto = (DtoQuery)qr.getQueryTables().get("TGENETRANSACTION"); + GeneralQuery.addParametersJSF(jpql, dto); + qry = PersistenceHelper.getEntityManager().createQuery(jpql.toString()); + GeneralQuery.setParametersJSF(jpql, dto, qry); + }else{ + QueryBean qb = (QueryBean) qr.get("TGENETRANSACTION"); + Map criteria = new HashMap(); + GeneralQuery.addParameters(qb, jpql, criteria); + qry = PersistenceHelper.getEntityManager().createQuery(jpql.toString()); + /* + * qry.setParameter("init", qr.getDate("creationdate")); qry.setParameter("end", qr.getDate("enddate")); + */ + GeneralQuery.setParameters(qb, criteria, qry); + } + return qry; + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/text-base/EndedFlowsResults.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/text-base/EndedFlowsResults.java.svn-base new file mode 100644 index 0000000..daada8c --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/text-base/EndedFlowsResults.java.svn-base @@ -0,0 +1,145 @@ +/* + * + */ +package com.fp.bpmlib.query; + +import java.sql.Date; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.GeneralQuery; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.APPDates; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pbpm.gene.TbpmProcessInstance; + +// TODO: Auto-generated Javadoc +/** + * Clase que se encarga de presentar las transactiones que estan en vuelo en la TGENETRANSACTIONLOG. + * + * @author gfiallos + */ +public class EndedFlowsResults extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Metodo que presenta las transacciones en vuelo. + * + * @param qr the qr + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest qr) throws Exception { + Response response = qr.getResponse(); + + Query qry = this.prepareQuery(qr); + + List ltransactionLog = qry.getResultList(); + List> detailgrid = new ArrayList>(); + for (int i = 0; i < ltransactionLog.size(); i++) { + Map detail = new HashMap(); + Object[] datos = (Object[]) ltransactionLog.get(i); + detail.put("solicitudenumber", datos[0]); + detail.put("usercode", datos[1]); + // detail.put("terminalcode", datos[1]); + detail.put("aditionaldata", datos[5]); + TbpmProcessInstance pi = (TbpmProcessInstance) datos[6]; + detail.put("id", pi.getPk()); + detail.put("init", pi.getCreationdate()); + detail.put("end", pi.getEnddate()); + detail.put("duration", + FormatDates.getInstance().getTimeFormat().format(new Date(pi.getEnddate().getTime() - pi.getCreationdate().getTime()))); + detailgrid.add(detail); + } + response.put("TRANSACTIONLOG", detailgrid); + return qr; + } + + /** + * Prepare query. + * + * @param qr the qr + * @return query + * @throws Exception la exception + */ + private Query prepareQuery(QueryRequest qr) throws Exception { + StringBuilder jpql = new StringBuilder(300); + jpql.append("select t.solicitudenumber, t.usercode,t.terminalcode,t.duration, t.realdate as time,t.aditionaldata,o " + + " from TgeneTransactionLog t ,TbpmProcessInstance o" + + " where t.pk in (select i.pk from TbpmProcessInstance i where coalesce(i.finalized, 'N')='Y') and t.pk = o.pk "); + String creation = "" + qr.get("creationdate"); + creation = (creation.compareTo("") == 0) ? null : creation; + String enddate = "" + qr.get("enddate"); + enddate = (enddate.compareTo("") == 0) ? null : enddate; + if ((creation != null) && (enddate != null)) { + jpql.append(" and o.creationdate>=:creationdate "); + jpql.append(" and o.enddate<=:enddate "); + } + return this.manageParameters(qr, jpql, creation, enddate); + } + + /** + * Manage parameters. + * + * @param qr the qr + * @param jpql the jpql + * @param creation the creation + * @param enddate the enddate + * @return query + * @throws Exception la exception + */ + private Query manageParameters(QueryRequest qr, StringBuilder jpql, String creation, String enddate) throws Exception { + + //Verifica consulta frontend jsf/dojo + Query qry = this.processQuery(qr, jpql); + + if ((creation != null) && (enddate != null)) { + qry.setParameter("creationdate", (Date)qr.get("creationdate")); + APPDates ad = new APPDates((Date) qr.get("enddate")); + ad.addField(Calendar.DAY_OF_YEAR, 1); + qry.setParameter("enddate", ad.getDate()); + } + return qry; + } + + /** + * Metodo que maneja la peticion del frontend jsf/dojo + * @param qr + * @param jpql + * @return + * @throws Exception + */ + private Query processQuery(QueryRequest qr, StringBuilder jpql) throws Exception{ + Query qry = null; + if(qr.isJsf()){ + DtoQuery dto = (DtoQuery)qr.getQueryTables().get("TRANSACTIONLOG"); + GeneralQuery.addParametersJSF(jpql, dto); + qry = PersistenceHelper.getEntityManager().createQuery(jpql.toString()); + GeneralQuery.setParametersJSF(jpql, dto, qry); + }else{ + QueryBean qb = (QueryBean) qr.get("TRANSACTIONLOG"); + Map criteria = new HashMap(); + GeneralQuery.addParameters(qb, jpql, criteria); + jpql.append(",creationdate"); + qry = PersistenceHelper.getEntityManager().createQuery(jpql.toString()); + GeneralQuery.setParameters(qb, criteria, qry); + } + return qry; + } + /** Sentencia que consulta el nombre del usuario. */ + public static final String SQL = "select a.name from TcustPersonDetail a ,TsafeUser b" + " where a.pk.personcode = b.personcode" + + " and b.pk=:usercode" + " and a.pk.dateto=:dateto"; +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/text-base/RuleTrigger.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/text-base/RuleTrigger.java.svn-base new file mode 100644 index 0000000..85fb253 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/text-base/RuleTrigger.java.svn-base @@ -0,0 +1,34 @@ +/* + * + */ +package com.fp.bpmlib.query; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +// TODO: Auto-generated Javadoc +/** + * Clase encargada de disparar reglas dada una petición de consulta. + * + * @author gfiallos + */ +public class RuleTrigger extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Process. + * + * @param pRequest the request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + //GuvnorClient gc = new GuvnorClient(this.rule, pRequest.getCompany()); + //gc.eval(pRequest); + return pRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/text-base/TransactionLogResults.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/text-base/TransactionLogResults.java.svn-base new file mode 100644 index 0000000..22bef76 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/text-base/TransactionLogResults.java.svn-base @@ -0,0 +1,101 @@ +/* + * + */ +package com.fp.bpmlib.query; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.GeneralQuery; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; + +// TODO: Auto-generated Javadoc +/** + * Clase que se encarga de presentar las transactiones que estan en vuelo en la TGENETRANSACTIONLOG. + * + * @author jarias + */ +public class TransactionLogResults extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Metodo que presenta las transacciones en vuelo. + * + * @param qr the qr + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest qr) throws Exception { + Response response = qr.getResponse(); + + StringBuilder jpql = new StringBuilder(300); + jpql.append("select t.usercode,t.terminalcode,t.duration," + " t.realdate as time,t.aditionaldata,o.processid,o.sessionid,t.solicitudenumber " + + " from TgeneTransactionLog t ,TbpmProcessInstance o" + + " where t.pk in (select i.pk from TbpmProcessInstance i where coalesce(i.finalized, 'N')='N')" + " and t.pk = o.pk "); + Query qry = null; + if (qr.isJsf()) { + DtoQuery dto = qr.getQueryTables().get("TRANSACTIONLOG"); + GeneralQuery.addParametersJSF(jpql, dto, false); + jpql.append(" order by t.realdate desc"); + qry = PersistenceHelper.getEntityManager().createQuery(jpql.toString()); + GeneralQuery.setParametersJSF(jpql, dto, qry); + } else { + QueryBean qb = (QueryBean) qr.get("TRANSACTIONLOG"); + Map criteria = new HashMap(); + GeneralQuery.addParameters(qb, jpql, criteria); + qry = PersistenceHelper.getEntityManager().createQuery(jpql.toString()); + GeneralQuery.setParameters(qb, criteria, qry); + } + + List ltransactionLog = qry.getResultList(); + List> detailgrid = new ArrayList>(); + for (int i = 0; i < ltransactionLog.size(); i++) { + Map detail = new HashMap(); + Object[] datos = (Object[]) ltransactionLog.get(i); + detail.put("usercode", datos[0]); + detail.put("name", this.consulta(datos[0].toString())); + detail.put("terminalcode", datos[1]); + detail.put("duration", datos[2]); + detail.put("time", datos[3]); + detail.put("aditionaldata", datos[4]); + detail.put("processid", datos[5]); + detail.put("sessionid", datos[6]); + detail.put("solicitudenumber", datos[7]); + detailgrid.add(detail); + } + response.put("TRANSACTIONLOG", detailgrid); + return qr; + } + + /** + * Metodo que me retorna el nombre de usuario. + * + * @param usercode the usercode + * @return nombre del usuario + * @throws Exception la exception + */ + private String consulta(String usercode) throws Exception { + javax.persistence.Query qr = PersistenceHelper.getEntityManager().createQuery(TransactionLogResults.SQL); + qr.setParameter("usercode", usercode); + qr.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + return (String) qr.getSingleResult(); + + } + + /** Sentencia que consulta el nombre del usuario. */ + public static final String SQL = "select a.name from TcustPersonDetail a ,TsafeUser b" + " where a.pk.personcode = b.personcode" + + " and b.pk=:usercode" + " and a.pk.dateto=:dateto"; +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/text-base/TransactionsLog.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/text-base/TransactionsLog.java.svn-base new file mode 100644 index 0000000..8d1cc02 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/text-base/TransactionsLog.java.svn-base @@ -0,0 +1,74 @@ +/* + * + */ +package com.fp.bpmlib.query; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.GeneralQuery; +import com.fp.persistence.commondb.PersistenceHelper; + +// TODO: Auto-generated Javadoc +/** + * Clase que se encarga de presentar en el lov las transacciones que contiene la tabla TgeneTransactionLog. + * + * @author jarias + */ +public class TransactionsLog extends QueryRule { + + /** Constante serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Metodo que presenta la lista de transacciones en vuelo. + * + * @param qr the qr + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest qr) throws Exception { + Response response = qr.getResponse(); + QueryBean qb = (QueryBean) qr.get("TGENETRANSACTION"); + StringBuilder jpql = new StringBuilder(400); + jpql.append("select t.pk.transactionmodule,t.pk.transactioncode,t.pk.transactionversion,t.name " + + "from TgeneTransaction t where exists ( select 1 " + + "from TgeneTransactionLog r where exists(select 1 from TbpmProcessInstance o " + + "where o.pk = r.pk and coalesce(o.finalized, 'N')='N') and t.pk.transactionmodule=r.transactionmodule " + + "and t.pk.transactioncode=r.transactioncode and t.pk.transactionversion=r.transactionversion ) "); + Map criteria = new HashMap(); + GeneralQuery.addParameters(qb, jpql, criteria); + Query qry = PersistenceHelper.getEntityManager().createQuery(jpql.toString()); + GeneralQuery.setParameters(qb, criteria, qry); + List ltransaction = qry.getResultList(); + List> detailgrid = new ArrayList>(); + for (int i = 0; i < ltransaction.size(); i++) { + Map detail = new HashMap(); + Object[] datos = (Object[]) ltransaction.get(i); + detail.put("pk_transactionmodule", datos[0]); + detail.put("pk_transactioncode", datos[1]); + detail.put("pk_transactionversion", datos[2]); + detail.put("name", datos[3]); + detailgrid.add(detail); + } + if (ltransaction.isEmpty()) { + Map detail = new HashMap(); + detail.put("pk_transactionmodule", ""); + detail.put("pk_transactioncode", ""); + detail.put("pk_transactionversion", ""); + detail.put("name", ""); + detailgrid.add(detail); + } + response.put("TGENETRANSACTION", detailgrid); + return qr; + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/text-base/package-info.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..ef5d708 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,4 @@ +/** + * Provee los componentes para las transacciones de consulta + */ +package com.fp.bpmlib.query; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/EndedFlowDetail.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/EndedFlowDetail.java new file mode 100644 index 0000000..6a0f550 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/EndedFlowDetail.java @@ -0,0 +1,139 @@ +/* + * + */ +package com.fp.bpmlib.query; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pbpm.gene.TbpmTaskComments; +import com.fp.persistence.pgeneral.log.TgeneTransactionLog; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; +import com.fp.persistence.pgeneral.trans.TgeneTransactionKey; + +// TODO: Auto-generated Javadoc +/** + * Class EndedFlowDetail encargada de. + * + * @author gfiallos + */ +public class EndedFlowDetail extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** Constante SQL. */ + private static final String SQL = "SELECT " + + " a.activityname,a.sequence,a.usercode,a.groupcode,a.created,a.completed,a.expectedtime,a.response ,a.module,a.transaction,a.version, ( " + + " SELECT " + " z.name " + " FROM " + " tgenetransaction z " + " WHERE " + + " z.transactionmodule=a.module " + " AND z.transactioncode=a.transaction " + + " AND z.transactionversion=a.version),a.taskid " + " FROM " + " tbpmactivities a " + " WHERE " + + " a.journalid=:journal " + " ORDER BY " + " created"; + + /** El valor de id. */ + private String id; + + /** El valor de resp. */ + private Response resp; + + /** El valor de sdf1. */ + private SimpleDateFormat sdf1; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + this.sdf1 = new SimpleDateFormat("dd-MM-yyyy HH:mm"); + this.id = pQueryRequest.getString("ID"); + this.resp = pQueryRequest.getResponse(); + TgeneTransactionLog tl = TgeneTransactionLog.find(PersistenceHelper.getEntityManager(), this.id); + this.resp.put("DATA", tl.getAditionaldata()); + TgeneTransaction t = TgeneTransaction.find(PersistenceHelper.getEntityManager(), + new TgeneTransactionKey(tl.getTransactionmodule(), tl.getTransactioncode(), tl.getTransactionversion())); + this.resp.put("TRN", t.getName()); + this.manageActivities(); + return pQueryRequest; + } + + /** + * Manage activities. + * + * @throws Exception la exception + */ + public void manageActivities() throws Exception { + Query q = PersistenceHelper.createNativeQuery(EndedFlowDetail.SQL); + q.setParameter("journal", this.id); + @SuppressWarnings("unchecked") + List l = q.getResultList(); + List> data = new ArrayList>(); + + DecimalFormat df = new DecimalFormat("00"); + for (Object obj : l) { + Map rec = new HashMap(); + Object[] oData = (Object[]) obj; + rec.put("activityname", oData[0] + " (" + oData[11] + ")"); + rec.put("sequence", oData[1]); + rec.put("usercode", oData[2]); + rec.put("groupcode", oData[3]); + Timestamp completed = ((Timestamp) oData[5]); + Timestamp created = ((Timestamp) oData[4]); + rec.put("created", this.sdf1.format(created)); + rec.put("completed", this.sdf1.format(completed)); + Long exp = Long.valueOf("" + oData[6]) / 1000; + BigDecimal aux = new BigDecimal(exp / 60); + rec.put("expectedtime", df.format(aux.intValue()) + ":" + df.format(exp % 60)); + Long real = Long.valueOf("" + (completed.getTime() - created.getTime())) / 1000; + aux = new BigDecimal(real / 60); + rec.put("realtime", df.format(aux.intValue()) + ":" + df.format(real % 60)); + rec.put("response", oData[7]); + rec.put("obs", this.getComments(Long.valueOf("" + oData[12]))); + data.add(rec); + } + this.resp.put("TBPMACTIVITIES", data); + } + + /** + * Obtiene el valor de comments. + * + * @param pTID the tID + * @return Valor de comments + * @throws Exception la exception + */ + private String getComments(long pTID) throws Exception { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + try { + String jpql = "from TbpmTaskComments tc where tc.taskid=:tid"; + Query q = PersistenceHelper.createQuery(jpql); + q.setParameter("tid", pTID); + @SuppressWarnings("unchecked") + List tc = q.getResultList(); + for (TbpmTaskComments tbpmTaskComments : tc) { + pw.println(tbpmTaskComments.getUsercode() + " : " + this.sdf1.format(tbpmTaskComments.getAdded())); + pw.println(tbpmTaskComments.getText()); + } + } finally { + pw.close(); + } + return sw.toString(); + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/EndedFlows.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/EndedFlows.java new file mode 100644 index 0000000..8433eca --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/EndedFlows.java @@ -0,0 +1,102 @@ +/* + * + */ +package com.fp.bpmlib.query; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.GeneralQuery; +import com.fp.persistence.commondb.PersistenceHelper; + +// TODO: Auto-generated Javadoc +/** + * Clase que se encarga de presentar en el lov las transacciones que contiene la tabla TgeneTransactionLog. + * + * @author gfiallos + */ + +public class EndedFlows extends QueryRule { + + /** Constante serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Metodo que presenta la lista de transacciones en vuelo. + * + * @param qr the qr + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest qr) throws Exception { + if(qr.isJsf()){ + + }else{ + + } + Response response = qr.getResponse(); + + StringBuilder jpql = new StringBuilder(400); + jpql.append("select t.pk.transactionmodule,t.pk.transactioncode,t.pk.transactionversion,t.name " + + "from TgeneTransaction t where exists ( select 1 " + + "from TgeneTransactionLog r where exists(select 1 from TbpmProcessInstance o " + + "where o.pk = r.pk and coalesce(o.finalized, 'N')='Y') and t.pk.transactionmodule=r.transactionmodule " + + "and t.pk.transactioncode=r.transactioncode and t.pk.transactionversion=r.transactionversion ) "); + + //Ingresa y verifica el frontend + Query qry = this.processQuery(qr, jpql); + + + List ltransaction = qry.getResultList(); + List> detailgrid = new ArrayList>(); + for (int i = 0; i < ltransaction.size(); i++) { + Map detail = new HashMap(); + Object[] datos = (Object[]) ltransaction.get(i); + detail.put("pk_transactionmodule", datos[0]); + detail.put("pk_transactioncode", datos[1]); + detail.put("pk_transactionversion", datos[2]); + detail.put("name", datos[3]); + // detail.put("solicitudenumber", datos[4]); + detailgrid.add(detail); + } + response.put("TGENETRANSACTION", detailgrid); + return qr; + } + + /** + * Direcciona la consulta jsf y dojo + * @param qr + * @param jpql + * @return + * @throws Exception + */ + private Query processQuery(QueryRequest qr, StringBuilder jpql) throws Exception { + Query qry = null; + if(qr.isJsf()){ + DtoQuery dto = (DtoQuery)qr.getQueryTables().get("TGENETRANSACTION"); + GeneralQuery.addParametersJSF(jpql, dto); + qry = PersistenceHelper.getEntityManager().createQuery(jpql.toString()); + GeneralQuery.setParametersJSF(jpql, dto, qry); + }else{ + QueryBean qb = (QueryBean) qr.get("TGENETRANSACTION"); + Map criteria = new HashMap(); + GeneralQuery.addParameters(qb, jpql, criteria); + qry = PersistenceHelper.getEntityManager().createQuery(jpql.toString()); + /* + * qry.setParameter("init", qr.getDate("creationdate")); qry.setParameter("end", qr.getDate("enddate")); + */ + GeneralQuery.setParameters(qb, criteria, qry); + } + return qry; + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/EndedFlowsResults.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/EndedFlowsResults.java new file mode 100644 index 0000000..daada8c --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/EndedFlowsResults.java @@ -0,0 +1,145 @@ +/* + * + */ +package com.fp.bpmlib.query; + +import java.sql.Date; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.GeneralQuery; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.APPDates; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pbpm.gene.TbpmProcessInstance; + +// TODO: Auto-generated Javadoc +/** + * Clase que se encarga de presentar las transactiones que estan en vuelo en la TGENETRANSACTIONLOG. + * + * @author gfiallos + */ +public class EndedFlowsResults extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Metodo que presenta las transacciones en vuelo. + * + * @param qr the qr + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest qr) throws Exception { + Response response = qr.getResponse(); + + Query qry = this.prepareQuery(qr); + + List ltransactionLog = qry.getResultList(); + List> detailgrid = new ArrayList>(); + for (int i = 0; i < ltransactionLog.size(); i++) { + Map detail = new HashMap(); + Object[] datos = (Object[]) ltransactionLog.get(i); + detail.put("solicitudenumber", datos[0]); + detail.put("usercode", datos[1]); + // detail.put("terminalcode", datos[1]); + detail.put("aditionaldata", datos[5]); + TbpmProcessInstance pi = (TbpmProcessInstance) datos[6]; + detail.put("id", pi.getPk()); + detail.put("init", pi.getCreationdate()); + detail.put("end", pi.getEnddate()); + detail.put("duration", + FormatDates.getInstance().getTimeFormat().format(new Date(pi.getEnddate().getTime() - pi.getCreationdate().getTime()))); + detailgrid.add(detail); + } + response.put("TRANSACTIONLOG", detailgrid); + return qr; + } + + /** + * Prepare query. + * + * @param qr the qr + * @return query + * @throws Exception la exception + */ + private Query prepareQuery(QueryRequest qr) throws Exception { + StringBuilder jpql = new StringBuilder(300); + jpql.append("select t.solicitudenumber, t.usercode,t.terminalcode,t.duration, t.realdate as time,t.aditionaldata,o " + + " from TgeneTransactionLog t ,TbpmProcessInstance o" + + " where t.pk in (select i.pk from TbpmProcessInstance i where coalesce(i.finalized, 'N')='Y') and t.pk = o.pk "); + String creation = "" + qr.get("creationdate"); + creation = (creation.compareTo("") == 0) ? null : creation; + String enddate = "" + qr.get("enddate"); + enddate = (enddate.compareTo("") == 0) ? null : enddate; + if ((creation != null) && (enddate != null)) { + jpql.append(" and o.creationdate>=:creationdate "); + jpql.append(" and o.enddate<=:enddate "); + } + return this.manageParameters(qr, jpql, creation, enddate); + } + + /** + * Manage parameters. + * + * @param qr the qr + * @param jpql the jpql + * @param creation the creation + * @param enddate the enddate + * @return query + * @throws Exception la exception + */ + private Query manageParameters(QueryRequest qr, StringBuilder jpql, String creation, String enddate) throws Exception { + + //Verifica consulta frontend jsf/dojo + Query qry = this.processQuery(qr, jpql); + + if ((creation != null) && (enddate != null)) { + qry.setParameter("creationdate", (Date)qr.get("creationdate")); + APPDates ad = new APPDates((Date) qr.get("enddate")); + ad.addField(Calendar.DAY_OF_YEAR, 1); + qry.setParameter("enddate", ad.getDate()); + } + return qry; + } + + /** + * Metodo que maneja la peticion del frontend jsf/dojo + * @param qr + * @param jpql + * @return + * @throws Exception + */ + private Query processQuery(QueryRequest qr, StringBuilder jpql) throws Exception{ + Query qry = null; + if(qr.isJsf()){ + DtoQuery dto = (DtoQuery)qr.getQueryTables().get("TRANSACTIONLOG"); + GeneralQuery.addParametersJSF(jpql, dto); + qry = PersistenceHelper.getEntityManager().createQuery(jpql.toString()); + GeneralQuery.setParametersJSF(jpql, dto, qry); + }else{ + QueryBean qb = (QueryBean) qr.get("TRANSACTIONLOG"); + Map criteria = new HashMap(); + GeneralQuery.addParameters(qb, jpql, criteria); + jpql.append(",creationdate"); + qry = PersistenceHelper.getEntityManager().createQuery(jpql.toString()); + GeneralQuery.setParameters(qb, criteria, qry); + } + return qry; + } + /** Sentencia que consulta el nombre del usuario. */ + public static final String SQL = "select a.name from TcustPersonDetail a ,TsafeUser b" + " where a.pk.personcode = b.personcode" + + " and b.pk=:usercode" + " and a.pk.dateto=:dateto"; +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/RuleTrigger.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/RuleTrigger.java new file mode 100644 index 0000000..85fb253 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/RuleTrigger.java @@ -0,0 +1,34 @@ +/* + * + */ +package com.fp.bpmlib.query; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +// TODO: Auto-generated Javadoc +/** + * Clase encargada de disparar reglas dada una petición de consulta. + * + * @author gfiallos + */ +public class RuleTrigger extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Process. + * + * @param pRequest the request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + //GuvnorClient gc = new GuvnorClient(this.rule, pRequest.getCompany()); + //gc.eval(pRequest); + return pRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/TransactionLogResults.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/TransactionLogResults.java new file mode 100644 index 0000000..22bef76 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/TransactionLogResults.java @@ -0,0 +1,101 @@ +/* + * + */ +package com.fp.bpmlib.query; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.GeneralQuery; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; + +// TODO: Auto-generated Javadoc +/** + * Clase que se encarga de presentar las transactiones que estan en vuelo en la TGENETRANSACTIONLOG. + * + * @author jarias + */ +public class TransactionLogResults extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Metodo que presenta las transacciones en vuelo. + * + * @param qr the qr + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest qr) throws Exception { + Response response = qr.getResponse(); + + StringBuilder jpql = new StringBuilder(300); + jpql.append("select t.usercode,t.terminalcode,t.duration," + " t.realdate as time,t.aditionaldata,o.processid,o.sessionid,t.solicitudenumber " + + " from TgeneTransactionLog t ,TbpmProcessInstance o" + + " where t.pk in (select i.pk from TbpmProcessInstance i where coalesce(i.finalized, 'N')='N')" + " and t.pk = o.pk "); + Query qry = null; + if (qr.isJsf()) { + DtoQuery dto = qr.getQueryTables().get("TRANSACTIONLOG"); + GeneralQuery.addParametersJSF(jpql, dto, false); + jpql.append(" order by t.realdate desc"); + qry = PersistenceHelper.getEntityManager().createQuery(jpql.toString()); + GeneralQuery.setParametersJSF(jpql, dto, qry); + } else { + QueryBean qb = (QueryBean) qr.get("TRANSACTIONLOG"); + Map criteria = new HashMap(); + GeneralQuery.addParameters(qb, jpql, criteria); + qry = PersistenceHelper.getEntityManager().createQuery(jpql.toString()); + GeneralQuery.setParameters(qb, criteria, qry); + } + + List ltransactionLog = qry.getResultList(); + List> detailgrid = new ArrayList>(); + for (int i = 0; i < ltransactionLog.size(); i++) { + Map detail = new HashMap(); + Object[] datos = (Object[]) ltransactionLog.get(i); + detail.put("usercode", datos[0]); + detail.put("name", this.consulta(datos[0].toString())); + detail.put("terminalcode", datos[1]); + detail.put("duration", datos[2]); + detail.put("time", datos[3]); + detail.put("aditionaldata", datos[4]); + detail.put("processid", datos[5]); + detail.put("sessionid", datos[6]); + detail.put("solicitudenumber", datos[7]); + detailgrid.add(detail); + } + response.put("TRANSACTIONLOG", detailgrid); + return qr; + } + + /** + * Metodo que me retorna el nombre de usuario. + * + * @param usercode the usercode + * @return nombre del usuario + * @throws Exception la exception + */ + private String consulta(String usercode) throws Exception { + javax.persistence.Query qr = PersistenceHelper.getEntityManager().createQuery(TransactionLogResults.SQL); + qr.setParameter("usercode", usercode); + qr.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + return (String) qr.getSingleResult(); + + } + + /** Sentencia que consulta el nombre del usuario. */ + public static final String SQL = "select a.name from TcustPersonDetail a ,TsafeUser b" + " where a.pk.personcode = b.personcode" + + " and b.pk=:usercode" + " and a.pk.dateto=:dateto"; +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/TransactionsLog.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/TransactionsLog.java new file mode 100644 index 0000000..8d1cc02 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/TransactionsLog.java @@ -0,0 +1,74 @@ +/* + * + */ +package com.fp.bpmlib.query; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.GeneralQuery; +import com.fp.persistence.commondb.PersistenceHelper; + +// TODO: Auto-generated Javadoc +/** + * Clase que se encarga de presentar en el lov las transacciones que contiene la tabla TgeneTransactionLog. + * + * @author jarias + */ +public class TransactionsLog extends QueryRule { + + /** Constante serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Metodo que presenta la lista de transacciones en vuelo. + * + * @param qr the qr + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest qr) throws Exception { + Response response = qr.getResponse(); + QueryBean qb = (QueryBean) qr.get("TGENETRANSACTION"); + StringBuilder jpql = new StringBuilder(400); + jpql.append("select t.pk.transactionmodule,t.pk.transactioncode,t.pk.transactionversion,t.name " + + "from TgeneTransaction t where exists ( select 1 " + + "from TgeneTransactionLog r where exists(select 1 from TbpmProcessInstance o " + + "where o.pk = r.pk and coalesce(o.finalized, 'N')='N') and t.pk.transactionmodule=r.transactionmodule " + + "and t.pk.transactioncode=r.transactioncode and t.pk.transactionversion=r.transactionversion ) "); + Map criteria = new HashMap(); + GeneralQuery.addParameters(qb, jpql, criteria); + Query qry = PersistenceHelper.getEntityManager().createQuery(jpql.toString()); + GeneralQuery.setParameters(qb, criteria, qry); + List ltransaction = qry.getResultList(); + List> detailgrid = new ArrayList>(); + for (int i = 0; i < ltransaction.size(); i++) { + Map detail = new HashMap(); + Object[] datos = (Object[]) ltransaction.get(i); + detail.put("pk_transactionmodule", datos[0]); + detail.put("pk_transactioncode", datos[1]); + detail.put("pk_transactionversion", datos[2]); + detail.put("name", datos[3]); + detailgrid.add(detail); + } + if (ltransaction.isEmpty()) { + Map detail = new HashMap(); + detail.put("pk_transactionmodule", ""); + detail.put("pk_transactioncode", ""); + detail.put("pk_transactionversion", ""); + detail.put("name", ""); + detailgrid.add(detail); + } + response.put("TGENETRANSACTION", detailgrid); + return qr; + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/groups/.svn/entries b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/groups/.svn/entries new file mode 100644 index 0000000..f9bb13b --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/groups/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/groups +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +UserLov.java +file + + + + +2022-07-28T03:40:45.846816Z +ccf76d12706998c63ff274ca57d144c5 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1957 + +package-info.java +file + + + + +2022-07-28T03:40:45.847816Z +d92d37db555d6b222d00dd8c5266a8eb +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +92 + +UserToGroup.java +file + + + + +2022-07-28T03:40:45.847816Z +7b1264b6c843f24dabea3bbc782406c4 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +2431 + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/groups/.svn/text-base/UserLov.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/groups/.svn/text-base/UserLov.java.svn-base new file mode 100644 index 0000000..1633431 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/groups/.svn/text-base/UserLov.java.svn-base @@ -0,0 +1,55 @@ +package com.fp.bpmlib.query.groups; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; + +/** + * Lista de Valores de Usuarios + * + * @author gfiallos + * + */ +public class UserLov extends QueryRule { + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Consulta + */ + private static final String SQL = "select u.usercode, (select d.name from tcustpersondetail d where d.dateto=u.dateto and d.personcode=u.personcode)" + + " from tsafeuserdetail u where u.isuserbpm='Y' and u.dateto=:dateto and not exists( " + + " select 1 from tbpmgroupsusers i where i.companycode=:cia and i.groupcode=:group and i.usercode=u.usercode)"; + + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + QueryBean qb = (QueryBean) pRequest.get("TSAFEUSERDETAILLOV"); + Query qry = PersistenceHelper.createNativeQuery(UserLov.SQL); + qry.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + qry.setParameter("cia", pRequest.getCompany()); + qry.setParameter("group", qb.getCriteriaValue("group")); + @SuppressWarnings("unchecked") + List l = qry.getResultList(); + List> data = new ArrayList>(); + for (Object[] objects : l) { + Map m = new HashMap(); + m.put("pk_usercode", objects[0]); + m.put("name", objects[1]); + data.add(m); + } + pRequest.getResponse().put("TSAFEUSERDETAILLOV", data); + return pRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/groups/.svn/text-base/UserToGroup.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/groups/.svn/text-base/UserToGroup.java.svn-base new file mode 100644 index 0000000..9732f77 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/groups/.svn/text-base/UserToGroup.java.svn-base @@ -0,0 +1,64 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.bpmlib.query.groups; + +import java.util.List; + +import javax.persistence.EntityManager; + +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pbpm.gene.TbpmGroupsUsers; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; +import com.fp.persistence.pgeneral.safe.TsafeUser; + +// TODO: Auto-generated Javadoc +/** + * Class UserToGroup encargada de. + * + * @author BPTWPA + */ +public class UserToGroup extends QueryRule { + + /** Constante serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + @SuppressWarnings("unchecked") + List lobjects = (List) response.get("TBPMGROUPSUSERS"); + if (!lobjects.isEmpty()) { + for (Object obj : lobjects) { + TbpmGroupsUsers tbpmGroupsUsers = (TbpmGroupsUsers) obj; + if (tbpmGroupsUsers.getPk().getUsercode() != null) { + TsafeUser tsafeUser = TsafeUser.find(em, tbpmGroupsUsers.getPk().getUsercode()); + if (tsafeUser != null) { + TcustPersonDetailKey custPersonDetailKey = new TcustPersonDetailKey(tsafeUser.getPersoncode(), + FormatDates.getDefaultExpiryTimestamp()); + TcustPersonDetail tcutPersonDetail = TcustPersonDetail.find(em, custPersonDetailKey); + tbpmGroupsUsers.addAddtionalInfo("username", ((tcutPersonDetail == null) ? "" : tcutPersonDetail.getName())); + } + } + } + } + return pQueryRequest; + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/groups/.svn/text-base/package-info.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/groups/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..88d6bc6 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/groups/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,4 @@ +/** + * Provee las clases para el manejo de Grupos + */ +package com.fp.bpmlib.query.groups; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/groups/UserLov.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/groups/UserLov.java new file mode 100644 index 0000000..1633431 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/groups/UserLov.java @@ -0,0 +1,55 @@ +package com.fp.bpmlib.query.groups; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; + +/** + * Lista de Valores de Usuarios + * + * @author gfiallos + * + */ +public class UserLov extends QueryRule { + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Consulta + */ + private static final String SQL = "select u.usercode, (select d.name from tcustpersondetail d where d.dateto=u.dateto and d.personcode=u.personcode)" + + " from tsafeuserdetail u where u.isuserbpm='Y' and u.dateto=:dateto and not exists( " + + " select 1 from tbpmgroupsusers i where i.companycode=:cia and i.groupcode=:group and i.usercode=u.usercode)"; + + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + QueryBean qb = (QueryBean) pRequest.get("TSAFEUSERDETAILLOV"); + Query qry = PersistenceHelper.createNativeQuery(UserLov.SQL); + qry.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + qry.setParameter("cia", pRequest.getCompany()); + qry.setParameter("group", qb.getCriteriaValue("group")); + @SuppressWarnings("unchecked") + List l = qry.getResultList(); + List> data = new ArrayList>(); + for (Object[] objects : l) { + Map m = new HashMap(); + m.put("pk_usercode", objects[0]); + m.put("name", objects[1]); + data.add(m); + } + pRequest.getResponse().put("TSAFEUSERDETAILLOV", data); + return pRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/groups/UserToGroup.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/groups/UserToGroup.java new file mode 100644 index 0000000..9732f77 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/groups/UserToGroup.java @@ -0,0 +1,64 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.bpmlib.query.groups; + +import java.util.List; + +import javax.persistence.EntityManager; + +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pbpm.gene.TbpmGroupsUsers; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; +import com.fp.persistence.pgeneral.safe.TsafeUser; + +// TODO: Auto-generated Javadoc +/** + * Class UserToGroup encargada de. + * + * @author BPTWPA + */ +public class UserToGroup extends QueryRule { + + /** Constante serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + @SuppressWarnings("unchecked") + List lobjects = (List) response.get("TBPMGROUPSUSERS"); + if (!lobjects.isEmpty()) { + for (Object obj : lobjects) { + TbpmGroupsUsers tbpmGroupsUsers = (TbpmGroupsUsers) obj; + if (tbpmGroupsUsers.getPk().getUsercode() != null) { + TsafeUser tsafeUser = TsafeUser.find(em, tbpmGroupsUsers.getPk().getUsercode()); + if (tsafeUser != null) { + TcustPersonDetailKey custPersonDetailKey = new TcustPersonDetailKey(tsafeUser.getPersoncode(), + FormatDates.getDefaultExpiryTimestamp()); + TcustPersonDetail tcutPersonDetail = TcustPersonDetail.find(em, custPersonDetailKey); + tbpmGroupsUsers.addAddtionalInfo("username", ((tcutPersonDetail == null) ? "" : tcutPersonDetail.getName())); + } + } + } + } + return pQueryRequest; + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/groups/package-info.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/groups/package-info.java new file mode 100644 index 0000000..88d6bc6 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/groups/package-info.java @@ -0,0 +1,4 @@ +/** + * Provee las clases para el manejo de Grupos + */ +package com.fp.bpmlib.query.groups; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/entries b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/entries new file mode 100644 index 0000000..e424b58 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TransactionList.java +file + + + + +2022-07-28T03:40:45.864817Z +f8a31d97d3c51dacd5859e59823775ea +2014-10-30T07:13:11.781809Z +2213 +wpatino + + + + + + + + + + + + + + + + + + + + + +6642 + +package-info.java +file + + + + +2022-07-28T03:40:45.864817Z +ca7e9d1d5e69aa72689e0b21071541f1 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +98 + +TaskDetail.java +file + + + + +2022-07-28T03:40:45.864817Z +34698e18d7474994fb7dd3efde97afc7 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1911 + +TransactionTasksGroup.java +file + + + + +2022-07-28T03:40:45.864817Z +5de0dc42fcea8a8217aefc7cecb540e0 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +2755 + +TransactionTasks.java +file + + + + +2022-07-28T03:40:45.864817Z +324b09f062135890f1ce0ddcb2ee25fb +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +3640 + +TransactionListGroup.java +file + + + + +2022-07-28T03:40:45.865817Z +785ebda9459959164f622add267c0318 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +3226 + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/text-base/TaskDetail.java.netbeans-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/text-base/TaskDetail.java.netbeans-base new file mode 100644 index 0000000..364bc13 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/text-base/TaskDetail.java.netbeans-base @@ -0,0 +1,59 @@ +/* + * + */ +package com.fp.bpmlib.query.inbox; + +import java.util.Map; + +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +// TODO: Auto-generated Javadoc +/** + * Class TaskDetail encargada de mostrar el detalle de una tarea. + * + * @author gfiallos + */ +public class TaskDetail extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + long tid = pQueryRequest.getLong(TaskUtil.BPM_TID); + TaskUtil tu = new TaskUtil(tid); + try { + pQueryRequest.getResponse().put("detail", tu.getDetail(pQueryRequest.getLanguage())); + pQueryRequest.getResponse().put("param", tu.getDestinyData()); + pQueryRequest.getResponse().put("k", tu.getTaskInfo().getKind()); + pQueryRequest.getResponse().put("s", tu.getStatus()); + } finally { + tu.close(); + } + return pQueryRequest; + } + + public static void addTaskDetail(Map mtask, TaskUtil taskUtil, String language) throws Exception { + Response resp = new Response(Response.RESPONSE_OK, ""); + resp.put("detail", taskUtil.getDetail(language)); + resp.put("param", taskUtil.getDestinyData()); + resp.put("k", taskUtil.getTaskInfo().getKind()); + resp.put("s", taskUtil.getStatus()); + + Map param = (Map) resp.get("param"); + param.put("TID", taskUtil.getTid()); + param.put("KIND", resp.get("k")); + + mtask.put("taskDetail", resp); + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/text-base/TaskDetail.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/text-base/TaskDetail.java.svn-base new file mode 100644 index 0000000..364bc13 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/text-base/TaskDetail.java.svn-base @@ -0,0 +1,59 @@ +/* + * + */ +package com.fp.bpmlib.query.inbox; + +import java.util.Map; + +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +// TODO: Auto-generated Javadoc +/** + * Class TaskDetail encargada de mostrar el detalle de una tarea. + * + * @author gfiallos + */ +public class TaskDetail extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + long tid = pQueryRequest.getLong(TaskUtil.BPM_TID); + TaskUtil tu = new TaskUtil(tid); + try { + pQueryRequest.getResponse().put("detail", tu.getDetail(pQueryRequest.getLanguage())); + pQueryRequest.getResponse().put("param", tu.getDestinyData()); + pQueryRequest.getResponse().put("k", tu.getTaskInfo().getKind()); + pQueryRequest.getResponse().put("s", tu.getStatus()); + } finally { + tu.close(); + } + return pQueryRequest; + } + + public static void addTaskDetail(Map mtask, TaskUtil taskUtil, String language) throws Exception { + Response resp = new Response(Response.RESPONSE_OK, ""); + resp.put("detail", taskUtil.getDetail(language)); + resp.put("param", taskUtil.getDestinyData()); + resp.put("k", taskUtil.getTaskInfo().getKind()); + resp.put("s", taskUtil.getStatus()); + + Map param = (Map) resp.get("param"); + param.put("TID", taskUtil.getTid()); + param.put("KIND", resp.get("k")); + + mtask.put("taskDetail", resp); + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/text-base/TransactionList.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/text-base/TransactionList.java.svn-base new file mode 100644 index 0000000..63ee297 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/text-base/TransactionList.java.svn-base @@ -0,0 +1,182 @@ +/* + * + */ +package com.fp.bpmlib.query.inbox; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.kie.api.task.model.Content; +import org.kie.api.task.model.Task; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpmlib.task.client.HumanTaskClient; +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.common.helper.Constant; +import com.fp.dto.data.TransactionDTO; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; +import com.fp.persistence.pgeneral.trans.TgeneTransactionKey; + +// TODO: Auto-generated Javadoc +/** + * Class TransactionList encargada de listar las transacciones para el buzn de la persona. + * + * @author gfiallos + */ +public class TransactionList extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** El valor de htc. */ + private HumanTaskClient htc = null; + + /** El valor de request. */ + private QueryRequest request; + + List> data = new ArrayList>(); + + /** El valor de trn. */ + private final Map trn = new HashMap(); + + Map mtransaux = new HashMap(); + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + htc = new HumanTaskClient(); + try { + request = pQueryRequest; + if(request.get("codeS")==null) + { + this.addTransactionList(pQueryRequest.getLanguage()); + } + else + { + this.addTransactionList(pQueryRequest.getLanguage(),request.get("codeS").toString()); + } + + Set s = mtransaux.keySet(); + for (String key : s) { + data.add((Map) mtransaux.get(key)); + } + pQueryRequest.getResponse().put("transactions", data); + return pQueryRequest; + } finally { + htc.close(); + } + } + + /** + * Prepara la lista de Tareas. + * + * @throws Exception la exception + */ + @SuppressWarnings("unchecked") + private void addTransactionList(String language) throws Exception { + List t = htc.getUnfinishedTasksByUser(request.getUser()); + for (Object[] obj : t) { + Task task = (Task) obj[0]; + TaskUtil tu = new TaskUtil(task, htc); + + TransactionDTO tr = tu.getTransaction(); + Integer count = trn.get(tr.toString()); + if (count == null) { + count = 1; + } else { + count++; + } + trn.put(tr.toString(), count); + + Map mtran = (Map) mtransaux.get(tr.toString()); + if (mtran == null) { + mtran = this.addTransactionData(tu); + mtransaux.put(tr.toString(), mtran); + } + mtran.put("c", count); + + // Adiciona datos de una tarea. + TransactionTasks.addTask(mtran, tu, language); + } + } + + @SuppressWarnings({ "unchecked", "unused", "rawtypes" }) + private void addTransactionList(String language, String codSolicitud) throws Exception { + List t = htc.getUnfinishedTasksByUser(request.getUser()); + for (Object[] obj : t) { + Task task = (Task) obj[0]; + Content c = (Content) obj[1]; + TaskUtil tu = new TaskUtil(task, htc); + + ((SaveRequest)(((Map)tu.getActualData().get("maia")).get("request"))).get("csolicitud"); + TransactionDTO tr = tu.getTransaction(); + if(tu.getActualData().get("maia") instanceof Map) + { + if(((Map)tu.getActualData().get("maia")).get("request") != null) + { + if((((Map)tu.getActualData().get("maia")).get("request")) instanceof SaveRequest) + { + Object csolicitud = ((SaveRequest)(((Map)tu.getActualData().get("maia")).get("request"))).get("csolicitud"); + if(csolicitud!=null){ + String codS = csolicitud.toString(); + if(!codS.equals(codSolicitud)) + { + continue; + } + } + } + } + } + + Integer count = trn.get(tr.toString()); + if (count == null) { + count = 1; + } else { + count++; + } + trn.put(tr.toString(), count); + + Map mtran = (Map) mtransaux.get(tr.toString()); + if (mtran == null) { + mtran = this.addTransactionData(tu); + mtransaux.put(tr.toString(), mtran); + } + mtran.put("c", count); + + // Adiciona datos de una tarea. + TransactionTasks.addTask(mtran, tu, language); + } + } + + private Map addTransactionData(TaskUtil tu) throws Exception { + Map rec = new HashMap(); + TransactionDTO tr = tu.getTransaction(); + rec.put("m", tr.getModule()); + rec.put("t", tr.getTransaction()); + rec.put("v", tr.getVersion()); + rec.put("n", Constant.capitalize(GeneralDescriptions.getTransactiondesc(tr.getModule(), tr.getTransaction(), tr.getVersion()))); + TgeneTransactionKey k = new TgeneTransactionKey(tr.getModule(), tr.getTransaction(), tr.getVersion()); + TgeneTransaction t = TgeneTransaction.find(PersistenceHelper.getEntityManager(), k); + rec.put("p", t.getPage()); + rec.put("name", t.getName()); + rec.put("pjsf", t.getJsfpage()); + rec.put("pjsfurl", t.getJsfpage() + "?m=" + tr.getModule() + "&t=" + tr.getTransaction() + "&v=" + tr.getVersion()); + rec.put("q", t.getAutoquery()); + rec.put("f", t.getSignature()); + return rec; + } +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/text-base/TransactionListGroup.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/text-base/TransactionListGroup.java.svn-base new file mode 100644 index 0000000..ea0e1ce --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/text-base/TransactionListGroup.java.svn-base @@ -0,0 +1,101 @@ +/* + * + */ +package com.fp.bpmlib.query.inbox; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.kie.api.task.model.Task; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpmlib.task.client.HumanTaskClient; +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.common.helper.Constant; +import com.fp.dto.data.TransactionDTO; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +// TODO: Auto-generated Javadoc +/** + * Class TransactionList encargada de listar las transacciones para el buzn de la persona. + * + * @author gfiallos + */ +public class TransactionListGroup extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** El valor de htc. */ + private HumanTaskClient htc = null; + + /** El valor de trn. */ + private final Map trn = new HashMap(); + + /** El valor de trn dto. */ + private final Map trnDTO = new HashMap(); + + /** El valor de request. */ + private QueryRequest request; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + htc = new HumanTaskClient(); + try { + request = pQueryRequest; + this.prepareList(); + List> data = new ArrayList>(); + for (Entry e : trn.entrySet()) { + Map rec = new HashMap(); + rec.put("c", e.getValue()); + TransactionDTO tr = trnDTO.get(e.getKey()); + rec.put("m", tr.getModule()); + rec.put("t", tr.getTransaction()); + rec.put("v", tr.getVersion()); + rec.put("n", Constant.capitalize(GeneralDescriptions.getTransactiondesc(tr.getModule(), tr.getTransaction(), tr.getVersion()))); + data.add(rec); + } + pQueryRequest.getResponse().put("transactions", data); + return pQueryRequest; + } finally { + htc.close(); + } + } + + /** + * Prepara la lista de Tareas. + * + * @throws Exception la exception + */ + private void prepareList() throws Exception { + if (request.get("groupId") == null) { + return; + } + List t = htc.getTasksByGroup(request.getString("groupId"), "%"); + for (Object[] obj : t) { + Task task = (Task) obj[0]; + TaskUtil tu = new TaskUtil(task, htc); + TransactionDTO tr = tu.getTransaction(); + Integer count = trn.get(tr.toString()); + if (count == null) { + count = 1; + } else { + count++; + } + trn.put(tr.toString(), count); + trnDTO.put(tr.toString(), tr); + } + } + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/text-base/TransactionTasks.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/text-base/TransactionTasks.java.svn-base new file mode 100644 index 0000000..f7dada5 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/text-base/TransactionTasks.java.svn-base @@ -0,0 +1,93 @@ +/* + * + */ +package com.fp.bpmlib.query.inbox; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.kie.api.task.model.Task; + +import com.fp.bpmlib.db.BPMProperties; +import com.fp.bpmlib.task.client.HumanTaskClient; +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.common.properties.PropertiesHandler; +import com.fp.dto.data.TransactionDTO; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +/** + * Class TransactionTasks encargada de consultar las Tareas por transaccin. + * + * @author gfiallos + */ +public class TransactionTasks extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + PropertiesHandler ph = BPMProperties.getInstance(); + HumanTaskClient htc = new HumanTaskClient(); + try { + List t = htc.getUnfinishedTasksByUser(pQueryRequest.getUser()); + List> data = new ArrayList>(); + TransactionDTO trnP = new TransactionDTO(pQueryRequest.getTransactionModule(), pQueryRequest.getTransactionCode(), + pQueryRequest.getTransactionVersion()); + for (Object[] obj : t) { + Task task = (Task) obj[0]; + TaskUtil tu = new TaskUtil(task, htc); + TransactionDTO trn1 = tu.getTransaction(); + if (trn1.compareTo(trnP) != 0) { + continue; + } + Map rec = new HashMap(); + rec.put("tid", tu.getTid()); + rec.put("i", + ph.getStringValue(BPMProperties.INBOX_ICON_PATH) + tu.getStatus() + ph.getStringValue(BPMProperties.INBOX_ICON_EXTENSION)); + rec.put("c", "w" + task.getTaskData().getWorkItemId()); + rec.put("d", tu.getSubject()); + Map m = new HashMap(); + rec.put("desc", m); + m.put("c", "t" + tu.getTid()); + m.put("d", null); + data.add(rec); + } + pQueryRequest.getResponse().put("tasks", data); + return pQueryRequest; + } finally { + htc.close(); + } + } + + @SuppressWarnings("unchecked") + public static void addTask(Map mtran, TaskUtil taskUtil, String language) throws Exception { + PropertiesHandler ph = BPMProperties.getInstance(); + Map rec = new HashMap(); + rec.put("tid", taskUtil.getTid()); + rec.put("i", ph.getStringValue(BPMProperties.INBOX_ICON_PATH) + taskUtil.getStatus() + ph.getStringValue(BPMProperties.INBOX_ICON_EXTENSION)); + rec.put("c", "w" + taskUtil.getWorkItemId()); + rec.put("d", taskUtil.getSubject()); + rec.put("logsolicitude",taskUtil.getRequest().get("logsolicitude")); + List> ltasks = null; + if (mtran.get("tasks") == null) { + ltasks = new ArrayList<>(); + mtran.put("tasks", ltasks); + } else { + ltasks = (List>) mtran.get("tasks"); + } + TaskDetail.addTaskDetail(rec, taskUtil, language); + ltasks.add(rec); + } + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/text-base/TransactionTasksGroup.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/text-base/TransactionTasksGroup.java.svn-base new file mode 100644 index 0000000..3b2a86e --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/text-base/TransactionTasksGroup.java.svn-base @@ -0,0 +1,75 @@ +/* + * + */ +package com.fp.bpmlib.query.inbox; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.kie.api.task.model.Task; + +import com.fp.bpmlib.db.BPMProperties; +import com.fp.bpmlib.task.client.HumanTaskClient; +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.common.properties.PropertiesHandler; +import com.fp.dto.data.TransactionDTO; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +// TODO: Auto-generated Javadoc +/** + * Class TransactionTasks encargada de consultar las Tareas por transaccin. + * + * @author gfiallos + */ +public class TransactionTasksGroup extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + PropertiesHandler ph = BPMProperties.getInstance(); + HumanTaskClient htc = new HumanTaskClient(); + try { + List t = htc.getTasksByGroup(pQueryRequest.getString("groupId"), pQueryRequest.getString("cri")); + List> data = new ArrayList>(); + TransactionDTO trnP = new TransactionDTO(pQueryRequest.getTransactionModule(), pQueryRequest.getTransactionCode(), + pQueryRequest.getTransactionVersion()); + for (Object[] obj : t) { + Task task = (Task) obj[0]; + TaskUtil tu = new TaskUtil(task, htc); + TransactionDTO trn1 = tu.getTransaction(); + if (trn1.compareTo(trnP) != 0) { + continue; + } + Map rec = new HashMap(); + rec.put("tid", tu.getTid()); + rec.put("logsolicitude",tu.getRequest().get("logsolicitude")); + rec.put("i", + ph.getStringValue(BPMProperties.INBOX_ICON_PATH) + tu.getStatus() + ph.getStringValue(BPMProperties.INBOX_ICON_EXTENSION)); + rec.put("c", "w" + tu.getWorkItemId()); + rec.put("d", tu.getSubject()); + Map m = new HashMap(); + rec.put("desc", m); + m.put("c", "t" + tu.getTid()); + m.put("d", null); + data.add(rec); + } + pQueryRequest.getResponse().put("tasks", data); + return pQueryRequest; + } finally { + htc.close(); + } + } + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/text-base/package-info.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..904d4b5 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,4 @@ +/** + * Provee los componentes de consulta para la Agenda + */ +package com.fp.bpmlib.query.inbox; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/TaskDetail.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/TaskDetail.java new file mode 100644 index 0000000..364bc13 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/TaskDetail.java @@ -0,0 +1,59 @@ +/* + * + */ +package com.fp.bpmlib.query.inbox; + +import java.util.Map; + +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +// TODO: Auto-generated Javadoc +/** + * Class TaskDetail encargada de mostrar el detalle de una tarea. + * + * @author gfiallos + */ +public class TaskDetail extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + long tid = pQueryRequest.getLong(TaskUtil.BPM_TID); + TaskUtil tu = new TaskUtil(tid); + try { + pQueryRequest.getResponse().put("detail", tu.getDetail(pQueryRequest.getLanguage())); + pQueryRequest.getResponse().put("param", tu.getDestinyData()); + pQueryRequest.getResponse().put("k", tu.getTaskInfo().getKind()); + pQueryRequest.getResponse().put("s", tu.getStatus()); + } finally { + tu.close(); + } + return pQueryRequest; + } + + public static void addTaskDetail(Map mtask, TaskUtil taskUtil, String language) throws Exception { + Response resp = new Response(Response.RESPONSE_OK, ""); + resp.put("detail", taskUtil.getDetail(language)); + resp.put("param", taskUtil.getDestinyData()); + resp.put("k", taskUtil.getTaskInfo().getKind()); + resp.put("s", taskUtil.getStatus()); + + Map param = (Map) resp.get("param"); + param.put("TID", taskUtil.getTid()); + param.put("KIND", resp.get("k")); + + mtask.put("taskDetail", resp); + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/TransactionList.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/TransactionList.java new file mode 100644 index 0000000..63ee297 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/TransactionList.java @@ -0,0 +1,182 @@ +/* + * + */ +package com.fp.bpmlib.query.inbox; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.kie.api.task.model.Content; +import org.kie.api.task.model.Task; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpmlib.task.client.HumanTaskClient; +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.common.helper.Constant; +import com.fp.dto.data.TransactionDTO; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; +import com.fp.persistence.pgeneral.trans.TgeneTransactionKey; + +// TODO: Auto-generated Javadoc +/** + * Class TransactionList encargada de listar las transacciones para el buzn de la persona. + * + * @author gfiallos + */ +public class TransactionList extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** El valor de htc. */ + private HumanTaskClient htc = null; + + /** El valor de request. */ + private QueryRequest request; + + List> data = new ArrayList>(); + + /** El valor de trn. */ + private final Map trn = new HashMap(); + + Map mtransaux = new HashMap(); + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + htc = new HumanTaskClient(); + try { + request = pQueryRequest; + if(request.get("codeS")==null) + { + this.addTransactionList(pQueryRequest.getLanguage()); + } + else + { + this.addTransactionList(pQueryRequest.getLanguage(),request.get("codeS").toString()); + } + + Set s = mtransaux.keySet(); + for (String key : s) { + data.add((Map) mtransaux.get(key)); + } + pQueryRequest.getResponse().put("transactions", data); + return pQueryRequest; + } finally { + htc.close(); + } + } + + /** + * Prepara la lista de Tareas. + * + * @throws Exception la exception + */ + @SuppressWarnings("unchecked") + private void addTransactionList(String language) throws Exception { + List t = htc.getUnfinishedTasksByUser(request.getUser()); + for (Object[] obj : t) { + Task task = (Task) obj[0]; + TaskUtil tu = new TaskUtil(task, htc); + + TransactionDTO tr = tu.getTransaction(); + Integer count = trn.get(tr.toString()); + if (count == null) { + count = 1; + } else { + count++; + } + trn.put(tr.toString(), count); + + Map mtran = (Map) mtransaux.get(tr.toString()); + if (mtran == null) { + mtran = this.addTransactionData(tu); + mtransaux.put(tr.toString(), mtran); + } + mtran.put("c", count); + + // Adiciona datos de una tarea. + TransactionTasks.addTask(mtran, tu, language); + } + } + + @SuppressWarnings({ "unchecked", "unused", "rawtypes" }) + private void addTransactionList(String language, String codSolicitud) throws Exception { + List t = htc.getUnfinishedTasksByUser(request.getUser()); + for (Object[] obj : t) { + Task task = (Task) obj[0]; + Content c = (Content) obj[1]; + TaskUtil tu = new TaskUtil(task, htc); + + ((SaveRequest)(((Map)tu.getActualData().get("maia")).get("request"))).get("csolicitud"); + TransactionDTO tr = tu.getTransaction(); + if(tu.getActualData().get("maia") instanceof Map) + { + if(((Map)tu.getActualData().get("maia")).get("request") != null) + { + if((((Map)tu.getActualData().get("maia")).get("request")) instanceof SaveRequest) + { + Object csolicitud = ((SaveRequest)(((Map)tu.getActualData().get("maia")).get("request"))).get("csolicitud"); + if(csolicitud!=null){ + String codS = csolicitud.toString(); + if(!codS.equals(codSolicitud)) + { + continue; + } + } + } + } + } + + Integer count = trn.get(tr.toString()); + if (count == null) { + count = 1; + } else { + count++; + } + trn.put(tr.toString(), count); + + Map mtran = (Map) mtransaux.get(tr.toString()); + if (mtran == null) { + mtran = this.addTransactionData(tu); + mtransaux.put(tr.toString(), mtran); + } + mtran.put("c", count); + + // Adiciona datos de una tarea. + TransactionTasks.addTask(mtran, tu, language); + } + } + + private Map addTransactionData(TaskUtil tu) throws Exception { + Map rec = new HashMap(); + TransactionDTO tr = tu.getTransaction(); + rec.put("m", tr.getModule()); + rec.put("t", tr.getTransaction()); + rec.put("v", tr.getVersion()); + rec.put("n", Constant.capitalize(GeneralDescriptions.getTransactiondesc(tr.getModule(), tr.getTransaction(), tr.getVersion()))); + TgeneTransactionKey k = new TgeneTransactionKey(tr.getModule(), tr.getTransaction(), tr.getVersion()); + TgeneTransaction t = TgeneTransaction.find(PersistenceHelper.getEntityManager(), k); + rec.put("p", t.getPage()); + rec.put("name", t.getName()); + rec.put("pjsf", t.getJsfpage()); + rec.put("pjsfurl", t.getJsfpage() + "?m=" + tr.getModule() + "&t=" + tr.getTransaction() + "&v=" + tr.getVersion()); + rec.put("q", t.getAutoquery()); + rec.put("f", t.getSignature()); + return rec; + } +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/TransactionListGroup.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/TransactionListGroup.java new file mode 100644 index 0000000..ea0e1ce --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/TransactionListGroup.java @@ -0,0 +1,101 @@ +/* + * + */ +package com.fp.bpmlib.query.inbox; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.kie.api.task.model.Task; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpmlib.task.client.HumanTaskClient; +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.common.helper.Constant; +import com.fp.dto.data.TransactionDTO; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +// TODO: Auto-generated Javadoc +/** + * Class TransactionList encargada de listar las transacciones para el buzn de la persona. + * + * @author gfiallos + */ +public class TransactionListGroup extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** El valor de htc. */ + private HumanTaskClient htc = null; + + /** El valor de trn. */ + private final Map trn = new HashMap(); + + /** El valor de trn dto. */ + private final Map trnDTO = new HashMap(); + + /** El valor de request. */ + private QueryRequest request; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + htc = new HumanTaskClient(); + try { + request = pQueryRequest; + this.prepareList(); + List> data = new ArrayList>(); + for (Entry e : trn.entrySet()) { + Map rec = new HashMap(); + rec.put("c", e.getValue()); + TransactionDTO tr = trnDTO.get(e.getKey()); + rec.put("m", tr.getModule()); + rec.put("t", tr.getTransaction()); + rec.put("v", tr.getVersion()); + rec.put("n", Constant.capitalize(GeneralDescriptions.getTransactiondesc(tr.getModule(), tr.getTransaction(), tr.getVersion()))); + data.add(rec); + } + pQueryRequest.getResponse().put("transactions", data); + return pQueryRequest; + } finally { + htc.close(); + } + } + + /** + * Prepara la lista de Tareas. + * + * @throws Exception la exception + */ + private void prepareList() throws Exception { + if (request.get("groupId") == null) { + return; + } + List t = htc.getTasksByGroup(request.getString("groupId"), "%"); + for (Object[] obj : t) { + Task task = (Task) obj[0]; + TaskUtil tu = new TaskUtil(task, htc); + TransactionDTO tr = tu.getTransaction(); + Integer count = trn.get(tr.toString()); + if (count == null) { + count = 1; + } else { + count++; + } + trn.put(tr.toString(), count); + trnDTO.put(tr.toString(), tr); + } + } + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/TransactionTasks.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/TransactionTasks.java new file mode 100644 index 0000000..f7dada5 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/TransactionTasks.java @@ -0,0 +1,93 @@ +/* + * + */ +package com.fp.bpmlib.query.inbox; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.kie.api.task.model.Task; + +import com.fp.bpmlib.db.BPMProperties; +import com.fp.bpmlib.task.client.HumanTaskClient; +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.common.properties.PropertiesHandler; +import com.fp.dto.data.TransactionDTO; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +/** + * Class TransactionTasks encargada de consultar las Tareas por transaccin. + * + * @author gfiallos + */ +public class TransactionTasks extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + PropertiesHandler ph = BPMProperties.getInstance(); + HumanTaskClient htc = new HumanTaskClient(); + try { + List t = htc.getUnfinishedTasksByUser(pQueryRequest.getUser()); + List> data = new ArrayList>(); + TransactionDTO trnP = new TransactionDTO(pQueryRequest.getTransactionModule(), pQueryRequest.getTransactionCode(), + pQueryRequest.getTransactionVersion()); + for (Object[] obj : t) { + Task task = (Task) obj[0]; + TaskUtil tu = new TaskUtil(task, htc); + TransactionDTO trn1 = tu.getTransaction(); + if (trn1.compareTo(trnP) != 0) { + continue; + } + Map rec = new HashMap(); + rec.put("tid", tu.getTid()); + rec.put("i", + ph.getStringValue(BPMProperties.INBOX_ICON_PATH) + tu.getStatus() + ph.getStringValue(BPMProperties.INBOX_ICON_EXTENSION)); + rec.put("c", "w" + task.getTaskData().getWorkItemId()); + rec.put("d", tu.getSubject()); + Map m = new HashMap(); + rec.put("desc", m); + m.put("c", "t" + tu.getTid()); + m.put("d", null); + data.add(rec); + } + pQueryRequest.getResponse().put("tasks", data); + return pQueryRequest; + } finally { + htc.close(); + } + } + + @SuppressWarnings("unchecked") + public static void addTask(Map mtran, TaskUtil taskUtil, String language) throws Exception { + PropertiesHandler ph = BPMProperties.getInstance(); + Map rec = new HashMap(); + rec.put("tid", taskUtil.getTid()); + rec.put("i", ph.getStringValue(BPMProperties.INBOX_ICON_PATH) + taskUtil.getStatus() + ph.getStringValue(BPMProperties.INBOX_ICON_EXTENSION)); + rec.put("c", "w" + taskUtil.getWorkItemId()); + rec.put("d", taskUtil.getSubject()); + rec.put("logsolicitude",taskUtil.getRequest().get("logsolicitude")); + List> ltasks = null; + if (mtran.get("tasks") == null) { + ltasks = new ArrayList<>(); + mtran.put("tasks", ltasks); + } else { + ltasks = (List>) mtran.get("tasks"); + } + TaskDetail.addTaskDetail(rec, taskUtil, language); + ltasks.add(rec); + } + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/TransactionTasksGroup.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/TransactionTasksGroup.java new file mode 100644 index 0000000..3b2a86e --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/TransactionTasksGroup.java @@ -0,0 +1,75 @@ +/* + * + */ +package com.fp.bpmlib.query.inbox; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.kie.api.task.model.Task; + +import com.fp.bpmlib.db.BPMProperties; +import com.fp.bpmlib.task.client.HumanTaskClient; +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.common.properties.PropertiesHandler; +import com.fp.dto.data.TransactionDTO; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +// TODO: Auto-generated Javadoc +/** + * Class TransactionTasks encargada de consultar las Tareas por transaccin. + * + * @author gfiallos + */ +public class TransactionTasksGroup extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + PropertiesHandler ph = BPMProperties.getInstance(); + HumanTaskClient htc = new HumanTaskClient(); + try { + List t = htc.getTasksByGroup(pQueryRequest.getString("groupId"), pQueryRequest.getString("cri")); + List> data = new ArrayList>(); + TransactionDTO trnP = new TransactionDTO(pQueryRequest.getTransactionModule(), pQueryRequest.getTransactionCode(), + pQueryRequest.getTransactionVersion()); + for (Object[] obj : t) { + Task task = (Task) obj[0]; + TaskUtil tu = new TaskUtil(task, htc); + TransactionDTO trn1 = tu.getTransaction(); + if (trn1.compareTo(trnP) != 0) { + continue; + } + Map rec = new HashMap(); + rec.put("tid", tu.getTid()); + rec.put("logsolicitude",tu.getRequest().get("logsolicitude")); + rec.put("i", + ph.getStringValue(BPMProperties.INBOX_ICON_PATH) + tu.getStatus() + ph.getStringValue(BPMProperties.INBOX_ICON_EXTENSION)); + rec.put("c", "w" + tu.getWorkItemId()); + rec.put("d", tu.getSubject()); + Map m = new HashMap(); + rec.put("desc", m); + m.put("c", "t" + tu.getTid()); + m.put("d", null); + data.add(rec); + } + pQueryRequest.getResponse().put("tasks", data); + return pQueryRequest; + } finally { + htc.close(); + } + } + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/package-info.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/package-info.java new file mode 100644 index 0000000..904d4b5 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/inbox/package-info.java @@ -0,0 +1,4 @@ +/** + * Provee los componentes de consulta para la Agenda + */ +package com.fp.bpmlib.query.inbox; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/.svn/entries b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/.svn/entries new file mode 100644 index 0000000..7f685ef --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/.svn/entries @@ -0,0 +1,164 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +FlowMonitor.java +file + + + + +2022-07-28T03:40:45.913817Z +3d5f728ccc83abc92e6e1936fb1dec8c +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +2849 + +FlowActivitySave.java +file + + + + +2022-07-28T03:40:45.913817Z +29b7200b0c04bad3e45dcc0cc3a15ec2 +2014-12-17T13:06:41.233359Z +3580 +gbenavides + + + + + + + + + + + + + + + + + + + + + +7132 + +package-info.java +file + + + + +2022-07-28T03:40:45.913817Z +91e4a84136eef9a640feb73f8c133901 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +110 + +FlowEnd.java +file + + + + +2022-07-28T03:40:45.913817Z +a6276b3d4b3c03ed416fea3e114e6090 +2014-12-16T10:20:52.870795Z +3535 +gbenavides + + + + + + + + + + + + + + + + + + + + + +11524 + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/.svn/text-base/FlowActivitySave.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/.svn/text-base/FlowActivitySave.java.svn-base new file mode 100644 index 0000000..4ee36a7 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/.svn/text-base/FlowActivitySave.java.svn-base @@ -0,0 +1,169 @@ +package com.fp.bpmlib.query.monitor; + +import java.io.Serializable; +import java.sql.Timestamp; +import java.util.Map; + +import javax.persistence.Query; + +import org.apache.log4j.Logger; + +import com.fp.dto.json.Serializer; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pbpm.gene.TbpmActivities; +import com.fp.persistence.pbpm.gene.TbpmActivitiesKey; +import com.fp.simple.dto.TaskInfo; + +/** + * + * @author GBC + * + */ +public class FlowActivitySave { + + /** + * Logger + */ + private static final Logger LOG = Logger.getLogger(FlowActivitySave.class); + + /** + * JPQL TAREA_SUMMARY + */ + private static final String TAREA_SUMMARY = "select t from BAMTaskSummaryImpl t where t.taskId = :idtarea"; + + /* + * Nombre Nulo Tipo + ------------------ -------- ------------- + JOURNALID NOT NULL VARCHAR2(50) --maia + ACTIVITYNAME NOT NULL VARCHAR2(100) --taskdata + SEQUENCE NOT NULL NUMBER(5) --Id de la tarea + USERCODE VARCHAR2(20) -- taskdata usuario responsable //update para actualizar el usuario + GROUPCODE VARCHAR2(30) -- //grupo de la tarea taskinfo + COMPANYCODE NUMBER(10) -- maia***no se encontro + ACTION VARCHAR2(50) --vacio + ADITIONALDATA CLOB --taskinfo //actualizar al completar la tarea + COMPLETED TIMESTAMP(6) -- se actualiza al completar la tarea + CREATED TIMESTAMP(6) -- taskdata + EXPECTEDTIME NUMBER -- taskinfo + TASKJOURNALID VARCHAR2(50) -- revisar en el taskcomplete + RESPONSE VARCHAR2(50) -- taskcomplete + RULECODE VARCHAR2(30) + RULECODEDEFAULT VARCHAR2(30) + STARTED TIMESTAMP(6)-- actualizar en el start + TASKID NUMBER --en el metodo del handles + MODULE VARCHAR2(50) -- taskinfo + TRANSACTION NUMBER --taskinfo + VERSION NUMBER --taskinfo + INTERNALCODE VARCHAR2(50) -- usar el PID + PACKAGENAME VARCHAR2(120) + PACKAGENAMEDEFAULT VARCHAR2(120) + */ + + /** + * Manage activity. + * + * @param pTaskInfo the task info + * @param pActivityname the activityname + * @param pSequence the sequence + * @throws Exception la exception + */ + public static void crearActivity(Map mparam, TaskInfo taskInfo, long idTarea, java.util.Date onCreated) throws Exception { + //(mparam.get("journalid"), pActivityname, pSequence); + SaveRequest saveRequest = (SaveRequest) mparam.get("request"); + TbpmActivitiesKey k = new TbpmActivitiesKey(saveRequest.getJournalId(), taskInfo.getTname(),new Integer(mparam.get("PID").toString())); + TbpmActivities act = new TbpmActivities(); + act.setPk(k); + + if (taskInfo.getAditionalData() != null) { + Serializer ser = new Serializer((Serializable) taskInfo.getAditionalData()); + act.setAditionaldata(ser.toJSON()); + } + act.setGroupcode(taskInfo.getGroupId()); + act.setUsercode(taskInfo.getUserId()); + //act.setCompanycode(mparam.get(key)); + act.setCreated(new Timestamp(onCreated.getTime())); + act.setExpectedtime(taskInfo.getExpectedTime()); + act.setTaskjournalid(taskInfo.getJournalId()); + act.setTaskid(idTarea); + act.setRulecode(taskInfo.getRuleCode()); + act.setRulecodedefault(taskInfo.getRuleCodeDefault()); + act.setInternalcode(mparam.get("PID").toString()); + act.setVersion(taskInfo.getVersion().longValue()); + act.setModule(taskInfo.getModule()); + act.setTransaction(taskInfo.getTransaction().longValue()); + + PersistenceHelper.saveOrUpdate(act); + + + } + + /*** + * Metodo que actualiza la informacion cuando esta es asignada a un usuario + * @param idTarea + * @param userCode + * @throws CommondbException + * @throws Exception + */ + public static void actualizarActividadClaim(long idTarea, String userCode) throws CommondbException, Exception{ + Query q = PersistenceHelper.getEntityManager().createQuery("from TbpmActivities p where p.taskid=:idTarea"); + q.setParameter("idTarea", idTarea); + TbpmActivities act = (TbpmActivities) q.getSingleResult(); + act.setUsercode(userCode); + PersistenceHelper.saveOrUpdate(act); + + } + + /*** + * Metodo que actualiza la informacion cuando esta es seleccionada por el usuario + * @param idTarea + * @throws CommondbException + * @throws Exception + */ + public static void actualizarActividadStart(long idTarea) throws CommondbException, Exception{ + Query q = PersistenceHelper.getEntityManager().createQuery("from TbpmActivities p where p.taskid=:idTarea"); + q.setParameter("idTarea", idTarea); + TbpmActivities act = (TbpmActivities) q.getSingleResult(); + act.setStarted(FormatDates.getInstance().getDataBaseTimestamp()); +// act.setTaskjournalid(taskInfo.getJournalId()); + PersistenceHelper.saveOrUpdate(act); + + } + + /*** + * Metodo que actualiza la informacion de la tarea cuando esta es completada. + * @param idTarea + * @param taskInfo + * @throws CommondbException + * @throws Exception + */ + public static void actualizarActividadComplete(long idTarea, TaskInfo taskInfo) throws CommondbException, Exception{ + Query q = PersistenceHelper.getEntityManager().createQuery("from TbpmActivities p where p.taskid=:idTarea"); + q.setParameter("idTarea", idTarea); + TbpmActivities act = (TbpmActivities) q.getSingleResult(); + act.setCompleted(FormatDates.getInstance().getDataBaseTimestamp()); + act.setTaskjournalid(taskInfo.getJournalId()); + act.setResponse(taskInfo.getResponse()); + PersistenceHelper.saveOrUpdate(act); + + } + + /** + * Metodo q actualiza el usuario cuando esta tarea es reasignada + * @param idTarea + * @param userCode + * @throws CommondbException + * @throws Exception + */ + public static void actualizarActividadDelegate(long idTarea, String userCode) throws CommondbException, Exception{ + Query q = PersistenceHelper.getEntityManager().createQuery("from TbpmActivities p where p.taskid=:idTarea"); + q.setParameter("idTarea", idTarea); + TbpmActivities act = (TbpmActivities) q.getSingleResult(); + act.setUsercode(userCode); + PersistenceHelper.saveOrUpdate(act); + + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/.svn/text-base/FlowEnd.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/.svn/text-base/FlowEnd.java.svn-base new file mode 100644 index 0000000..b18f0e7 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/.svn/text-base/FlowEnd.java.svn-base @@ -0,0 +1,309 @@ +/* + * + */ +package com.fp.bpmlib.query.monitor; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.persistence.EntityManager; + +import org.apache.log4j.Logger; +import org.jbpm.ruleflow.instance.RuleFlowProcessInstance; +import org.kie.api.runtime.process.ProcessContext; + +import com.fp.bpmlib.task.TaskCleaner; +import com.fp.bpmlib.task.client.HumanTaskClient; +import com.fp.common.helper.Constant; +import com.fp.dto.data.SaveData; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pbpm.gene.TbpmProcessInstance; +import com.fp.persistence.pbpm.gene.TbpmProcessVariables; +import com.fp.persistence.pbpm.gene.TbpmProcessVariablesKey; +import com.fp.simple.flow.FlowClass; + +/** + * Class FlowEnd encargada de. + * + * @author gfiallos + */ +public class FlowEnd implements FlowClass { + /** + * Logger + */ + private static final Logger LOG = Logger.getLogger(FlowEnd.class); + + /** El valor de instance. */ + private final TbpmProcessInstance instance; + + /** El valor de . */ + private final RuleFlowProcessInstance p; + + /** El valor de htc. */ + private final HumanTaskClient htc; + + /** El valor de tc. */ + private final TaskCleaner tc; + + private final List lprocessvariable = new ArrayList(); + +// private final List lactivities = new ArrayList(); + + /** + * Crea una nueva instancia de flow end. + * + * @param pContext the context + * @throws Exception la exception + */ + public FlowEnd(Object pContext) throws Exception { + ProcessContext ctx = (ProcessContext) pContext; + p = (RuleFlowProcessInstance) ctx.getProcessInstance(); + long processId = p.getId(); + EntityManager em = PersistenceHelper.getEntityManager(); + instance = TbpmProcessInstance.findByProcessId(em, processId); + // TgeneTransactionLog log = TgeneTransactionLog.find(this.em, this.instance.getPk()); + // this.p = new Process(this.processId, this.instance.getSnapshot()); + htc = new HumanTaskClient(); + tc = new TaskCleaner(); + } + + /** + * Process. + * + * @throws Exception la exception + */ + @SuppressWarnings("unchecked") + @Override + public void process() throws Exception { + try { + FlowEnd.LOG.info("Inicia respaldo Flujo"); + Map m = p.getVariables(); + for (Entry e : m.entrySet()) { +// if (e.getKey().compareTo("tasksMetaData") == 0) { +// this.manageActivities((Map) e.getValue()); +// continue; +// } + if (e.getKey().compareTo("maia") == 0) { + for (Entry e1 : ((Map) e.getValue()).entrySet()) { + this.saveVariable(e1.getKey(), e1.getValue()); + } + continue; + } + this.saveVariable(e.getKey(), e.getValue()); + } + // PersistenceHelper.flushTransaction(); +// FlowEnd.LOG.info("Luego de Variables"); + instance.setEnddate(FormatDates.getInstance().getDataBaseDate()); + instance.setFinalized(Constant.STR_Y); + PersistenceHelper.saveOrUpdate(instance); + this.close(); + + SaveRequest sr = SaveData.getSaveRequest(); + sr.putSaveBean("TBPMPROCESSVARIABLES", lprocessvariable); + // sr.putSaveBean("TBPMACTIVITIES", lactivities); + // sr.putSaveBean("TBPMTASKCOMMENTS", ltaskcomments); + + // Eliminar tareas para que no tengan un workitem, puede ser de proceso diferentes. + tc.deleteTasks(); + FlowEnd.LOG.info("Luego de Instancia"); + } catch (Exception e) { + FlowEnd.LOG.error(e, e); + throw e; + } + } + + /** + * Save variable. + * + * @param pKey the key + * @param pValue the value + * @throws Exception la exception + */ + private void saveVariable(String pKey, Object pValue) throws Exception { + TbpmProcessVariablesKey pk = new TbpmProcessVariablesKey(instance.getPk(), pKey); + TbpmProcessVariables var = new TbpmProcessVariables(); + var.setPk(pk); + if (pValue == null) { + return; + } + Map rec = new HashMap(); + rec.put(pKey, pValue); + try { + var.setContent("."); + // Serializer ser = new Serializer((Serializable) rec); + // var.setContent(ser.toJSON()); + // PersistenceHelper.saveOrUpdate(var); + // PersistenceHelper.getEntityManager().persist(var); + var.put("isnew", true); + lprocessvariable.add(var); + } catch (Exception e) { + // no hacer nada + } + + } + +// /** +// * Manage activities. +// * +// * @param pValues the values +// * @throws Exception la exception +// */ +// private void manageActivities(Map pValues) throws Exception { +// FlowEnd.LOG.info("Maneja Actividades"); +// for (Entry e : pValues.entrySet()) { +// @SuppressWarnings("unchecked") +// List l = (List) e.getValue(); +// for (int i = 0; i < l.size(); i++) { +// try { +// TaskInfo taskInfo = l.get(i); +// this.manageActivity(taskInfo, e.getKey(), i); +// } catch (Exception e1) { +// if (e1 instanceof SQLException) { +// throw e1; +// } +// continue; +// } +// } +// } +// FlowEnd.LOG.info("Fin de Maneja Actividades"); +// } + +// /** +// * Manage activity. +// * +// * @param pTaskInfo the task info +// * @param pActivityname the activityname +// * @param pSequence the sequence +// * @throws Exception la exception +// */ +// private void manageActivity(TaskInfo pTaskInfo, String pActivityname, Integer pSequence) throws Exception { +// TbpmActivitiesKey k = new TbpmActivitiesKey(instance.getPk(), pActivityname, pSequence); +// TbpmActivities act = new TbpmActivities(); +// act.setPk(k); +// Field[] fs = TbpmActivities.class.getDeclaredFields(); +// for (Field field : fs) { +// try { +// Object val = BeanManager.getBeanAttributeValue(pTaskInfo, field.getName()); +// val = BeanManager.convertObject(val, BeanManager.getBeanGetterMethod(act, field.getName()).getReturnType()); +// BeanManager.setBeanAttributeValue(act, field.getName(), val); +// } catch (NoSuchMethodException e) { +// continue; +// } +// } +// if (pTaskInfo.getAditionalData() != null) { +// Serializer ser = new Serializer((Serializable) pTaskInfo.getAditionalData()); +// act.setAditionaldata(ser.toJSON()); +// } +// act.setGroupcode(pTaskInfo.getGroupId()); +// act.setUsercode(pTaskInfo.getUserId()); +// act.setExpectedtime(pTaskInfo.getExpectedTime()); +// act.setTaskjournalid(pTaskInfo.getJournalId()); +// act.setTaskid(pTaskInfo.getTaskId()); +// act.setRulecode(pTaskInfo.getRuleCode()); +// act.setRulecodedefault(pTaskInfo.getRuleCodeDefault()); +// act.setTaskid(pTaskInfo.getTaskId()); +// act.setInternalcode("" + pTaskInfo.getInternalCode()); +// +// BAMTaskSummaryImpl bam = this.getBAMTaskSummaryImpl(act.getTaskid()); +// act.setStarted(new Timestamp(bam.getStartDate().getTime())); +// act.setCompleted(new Timestamp(bam.getEndDate().getTime())); +// +// AuditTaskImpl atask = this.getAuditTaskImpl(act.getTaskid()); +// act.setCreated(new Timestamp(atask.getCreatedOn().getTime())); +// +// this.manageTask(act); +// PersistenceHelper.saveOrUpdate(act); +// lactivities.add(act); +// +// } + +// /** +// * Manage task. +// * +// * @param pAct the act +// * @throws Exception la exception +// */ +// private void manageTask(TbpmActivities pAct) throws Exception { +// Task t = htc.getTaskById(pAct.getTaskid()); +// TaskData td = t.getTaskData(); +// pAct.setUsercode(td.getActualOwner().getId()); +// List lc = td.getComments(); +// for (Comment comment : lc) { +// TbpmTaskComments c = new TbpmTaskComments(comment.getId(), new Date(comment.getAddedAt().getTime()), comment.getText(), pAct.getTaskid()); +// c.setUsercode(comment.getAddedBy().getId()); +// PersistenceHelper.saveOrUpdate(c); +// } +// } + + /** + * Close. + * + * @throws Exception la exception + */ + private void close() throws Exception { + // this.p.close(); + htc.close(); + + } + +// /** +// * JPQL TAREA_SUMMARY +// */ +// private static final String TAREA_SUMMARY = "select t from BAMTaskSummaryImpl t where t.taskId = :idtarea"; + +// /** +// * Obtiene el valor de unfinished tasks por Grupo. +// * +// * @param pGroupId the user id +// * @param pCri the cri +// * @return Valor de unfinished tasks +// * @throws Exception la exception +// */ +// public BAMTaskSummaryImpl getBAMTaskSummaryImpl(long idtarea) throws Exception { +// JbpmBeanLocal local = (JbpmBeanLocal) new InitialContext().lookup("java:global/maiaear-2.1/bpmlib/jbpmbean"); +// EntityManager em = null; +// BAMTaskSummaryImpl dato = null; +// try { +// em = local.getEmf().createEntityManager(); +// Query qry = em.createQuery(TAREA_SUMMARY); +// qry.setParameter("idtarea", idtarea); +// dato = (BAMTaskSummaryImpl) qry.getSingleResult(); +// } catch (NoResultException e) { +// // retorna el objeto en null. +// } finally { +// if (em.isOpen()) { +// em.close(); +// } +// } +// return dato; +// } +// +// /** +// * JPQL TAREA_SUMMARY +// */ +// private static final String TAREA_AUDIT_IMP = "select t from AuditTaskImpl t where t.taskId = :idtarea"; +// +// public AuditTaskImpl getAuditTaskImpl(long idtarea) throws Exception { +// JbpmBeanLocal local = (JbpmBeanLocal) new InitialContext().lookup("java:global/maiaear-2.1/bpmlib/jbpmbean"); +// EntityManager em = null; +// AuditTaskImpl dato = null; +// try { +// em = local.getEmf().createEntityManager(); +// Query qry = em.createQuery(TAREA_AUDIT_IMP); +// qry.setParameter("idtarea", idtarea); +// dato = (AuditTaskImpl) qry.getSingleResult(); +// } catch (NoResultException e) { +// // retorna el objeto en null. +// } finally { +// if (em.isOpen()) { +// em.close(); +// } +// } +// return dato; +// } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/.svn/text-base/FlowMonitor.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/.svn/text-base/FlowMonitor.java.svn-base new file mode 100644 index 0000000..77839cd --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/.svn/text-base/FlowMonitor.java.svn-base @@ -0,0 +1,87 @@ +/* + * + */ +package com.fp.bpmlib.query.monitor; + +import java.util.List; +import java.util.Map; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpmlib.BPMException; +import com.fp.bpmlib.ProcessUtil; +import com.fp.bpmlib.db.DataHelper; +import com.fp.bpmlib.flow.Monitor; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pbpm.gene.TbpmProcessInstance; +import com.fp.persistence.pgeneral.log.TgeneTransactionLog; + + +/** + * Class FlowMonitor encargada de. + * + * @author gfiallos + */ +public class FlowMonitor extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** El valor de pid. */ + private Long pid; + + /** El valor de request. */ + private QueryRequest request; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + this.request = pQueryRequest; + this.pid = this.request.getLong("PID"); + if (this.pid == null) { + throw new BPMException("BPM-0004", "LA INSTANCIA {0} NO ESTA DISPONIBLE O YA FUE FINALIZADA", this.pid); + } + this.manageFlow(); + this.manageOrigin(); + return pQueryRequest; + } + + /** + * Manage flow. + * + * @throws Exception la exception + */ + protected void manageFlow() throws Exception { + Monitor monitor = new Monitor(this.pid); + //p.setVariable("TEST", FormatDates.getInstance().getDataBaseTimestamp()); + this.request.getResponse().put("status", monitor.getStatus()); + Object tasks = ProcessUtil.getFirstDoneTaskMetaData(monitor); + this.request.getResponse().put("FIRST", tasks); + } + + /** + * Manage origin. + * + * @throws Exception la exception + */ + protected void manageOrigin() throws Exception { + TbpmProcessInstance pro = DataHelper.getInstance().getTbpmProcessInstance(this.pid); + TgeneTransactionLog log = TgeneTransactionLog.find(PersistenceHelper.getEntityManager(), pro.getPk()); + List> data = ProcessUtil.getInstance().transactionData(pro.getPk(), this.request); + this.request.getResponse().put("origin", data); + this.request.getResponse().put( + "TRN", + log.getTransactionmodule() + "-" + log.getTransactioncode() + "-" + log.getTransactionversion() + " " + + GeneralDescriptions.getTransactiondesc(log.getTransactionmodule(), log.getTransactioncode(), log.getTransactionversion())); + } + + + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/.svn/text-base/package-info.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..2567fb7 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,4 @@ +/** + * Provee los utilitarios para el manejo del monitor de Flujos + */ +package com.fp.bpmlib.query.monitor; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/FlowActivitySave.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/FlowActivitySave.java new file mode 100644 index 0000000..4ee36a7 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/FlowActivitySave.java @@ -0,0 +1,169 @@ +package com.fp.bpmlib.query.monitor; + +import java.io.Serializable; +import java.sql.Timestamp; +import java.util.Map; + +import javax.persistence.Query; + +import org.apache.log4j.Logger; + +import com.fp.dto.json.Serializer; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pbpm.gene.TbpmActivities; +import com.fp.persistence.pbpm.gene.TbpmActivitiesKey; +import com.fp.simple.dto.TaskInfo; + +/** + * + * @author GBC + * + */ +public class FlowActivitySave { + + /** + * Logger + */ + private static final Logger LOG = Logger.getLogger(FlowActivitySave.class); + + /** + * JPQL TAREA_SUMMARY + */ + private static final String TAREA_SUMMARY = "select t from BAMTaskSummaryImpl t where t.taskId = :idtarea"; + + /* + * Nombre Nulo Tipo + ------------------ -------- ------------- + JOURNALID NOT NULL VARCHAR2(50) --maia + ACTIVITYNAME NOT NULL VARCHAR2(100) --taskdata + SEQUENCE NOT NULL NUMBER(5) --Id de la tarea + USERCODE VARCHAR2(20) -- taskdata usuario responsable //update para actualizar el usuario + GROUPCODE VARCHAR2(30) -- //grupo de la tarea taskinfo + COMPANYCODE NUMBER(10) -- maia***no se encontro + ACTION VARCHAR2(50) --vacio + ADITIONALDATA CLOB --taskinfo //actualizar al completar la tarea + COMPLETED TIMESTAMP(6) -- se actualiza al completar la tarea + CREATED TIMESTAMP(6) -- taskdata + EXPECTEDTIME NUMBER -- taskinfo + TASKJOURNALID VARCHAR2(50) -- revisar en el taskcomplete + RESPONSE VARCHAR2(50) -- taskcomplete + RULECODE VARCHAR2(30) + RULECODEDEFAULT VARCHAR2(30) + STARTED TIMESTAMP(6)-- actualizar en el start + TASKID NUMBER --en el metodo del handles + MODULE VARCHAR2(50) -- taskinfo + TRANSACTION NUMBER --taskinfo + VERSION NUMBER --taskinfo + INTERNALCODE VARCHAR2(50) -- usar el PID + PACKAGENAME VARCHAR2(120) + PACKAGENAMEDEFAULT VARCHAR2(120) + */ + + /** + * Manage activity. + * + * @param pTaskInfo the task info + * @param pActivityname the activityname + * @param pSequence the sequence + * @throws Exception la exception + */ + public static void crearActivity(Map mparam, TaskInfo taskInfo, long idTarea, java.util.Date onCreated) throws Exception { + //(mparam.get("journalid"), pActivityname, pSequence); + SaveRequest saveRequest = (SaveRequest) mparam.get("request"); + TbpmActivitiesKey k = new TbpmActivitiesKey(saveRequest.getJournalId(), taskInfo.getTname(),new Integer(mparam.get("PID").toString())); + TbpmActivities act = new TbpmActivities(); + act.setPk(k); + + if (taskInfo.getAditionalData() != null) { + Serializer ser = new Serializer((Serializable) taskInfo.getAditionalData()); + act.setAditionaldata(ser.toJSON()); + } + act.setGroupcode(taskInfo.getGroupId()); + act.setUsercode(taskInfo.getUserId()); + //act.setCompanycode(mparam.get(key)); + act.setCreated(new Timestamp(onCreated.getTime())); + act.setExpectedtime(taskInfo.getExpectedTime()); + act.setTaskjournalid(taskInfo.getJournalId()); + act.setTaskid(idTarea); + act.setRulecode(taskInfo.getRuleCode()); + act.setRulecodedefault(taskInfo.getRuleCodeDefault()); + act.setInternalcode(mparam.get("PID").toString()); + act.setVersion(taskInfo.getVersion().longValue()); + act.setModule(taskInfo.getModule()); + act.setTransaction(taskInfo.getTransaction().longValue()); + + PersistenceHelper.saveOrUpdate(act); + + + } + + /*** + * Metodo que actualiza la informacion cuando esta es asignada a un usuario + * @param idTarea + * @param userCode + * @throws CommondbException + * @throws Exception + */ + public static void actualizarActividadClaim(long idTarea, String userCode) throws CommondbException, Exception{ + Query q = PersistenceHelper.getEntityManager().createQuery("from TbpmActivities p where p.taskid=:idTarea"); + q.setParameter("idTarea", idTarea); + TbpmActivities act = (TbpmActivities) q.getSingleResult(); + act.setUsercode(userCode); + PersistenceHelper.saveOrUpdate(act); + + } + + /*** + * Metodo que actualiza la informacion cuando esta es seleccionada por el usuario + * @param idTarea + * @throws CommondbException + * @throws Exception + */ + public static void actualizarActividadStart(long idTarea) throws CommondbException, Exception{ + Query q = PersistenceHelper.getEntityManager().createQuery("from TbpmActivities p where p.taskid=:idTarea"); + q.setParameter("idTarea", idTarea); + TbpmActivities act = (TbpmActivities) q.getSingleResult(); + act.setStarted(FormatDates.getInstance().getDataBaseTimestamp()); +// act.setTaskjournalid(taskInfo.getJournalId()); + PersistenceHelper.saveOrUpdate(act); + + } + + /*** + * Metodo que actualiza la informacion de la tarea cuando esta es completada. + * @param idTarea + * @param taskInfo + * @throws CommondbException + * @throws Exception + */ + public static void actualizarActividadComplete(long idTarea, TaskInfo taskInfo) throws CommondbException, Exception{ + Query q = PersistenceHelper.getEntityManager().createQuery("from TbpmActivities p where p.taskid=:idTarea"); + q.setParameter("idTarea", idTarea); + TbpmActivities act = (TbpmActivities) q.getSingleResult(); + act.setCompleted(FormatDates.getInstance().getDataBaseTimestamp()); + act.setTaskjournalid(taskInfo.getJournalId()); + act.setResponse(taskInfo.getResponse()); + PersistenceHelper.saveOrUpdate(act); + + } + + /** + * Metodo q actualiza el usuario cuando esta tarea es reasignada + * @param idTarea + * @param userCode + * @throws CommondbException + * @throws Exception + */ + public static void actualizarActividadDelegate(long idTarea, String userCode) throws CommondbException, Exception{ + Query q = PersistenceHelper.getEntityManager().createQuery("from TbpmActivities p where p.taskid=:idTarea"); + q.setParameter("idTarea", idTarea); + TbpmActivities act = (TbpmActivities) q.getSingleResult(); + act.setUsercode(userCode); + PersistenceHelper.saveOrUpdate(act); + + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/FlowEnd.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/FlowEnd.java new file mode 100644 index 0000000..b18f0e7 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/FlowEnd.java @@ -0,0 +1,309 @@ +/* + * + */ +package com.fp.bpmlib.query.monitor; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.persistence.EntityManager; + +import org.apache.log4j.Logger; +import org.jbpm.ruleflow.instance.RuleFlowProcessInstance; +import org.kie.api.runtime.process.ProcessContext; + +import com.fp.bpmlib.task.TaskCleaner; +import com.fp.bpmlib.task.client.HumanTaskClient; +import com.fp.common.helper.Constant; +import com.fp.dto.data.SaveData; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pbpm.gene.TbpmProcessInstance; +import com.fp.persistence.pbpm.gene.TbpmProcessVariables; +import com.fp.persistence.pbpm.gene.TbpmProcessVariablesKey; +import com.fp.simple.flow.FlowClass; + +/** + * Class FlowEnd encargada de. + * + * @author gfiallos + */ +public class FlowEnd implements FlowClass { + /** + * Logger + */ + private static final Logger LOG = Logger.getLogger(FlowEnd.class); + + /** El valor de instance. */ + private final TbpmProcessInstance instance; + + /** El valor de . */ + private final RuleFlowProcessInstance p; + + /** El valor de htc. */ + private final HumanTaskClient htc; + + /** El valor de tc. */ + private final TaskCleaner tc; + + private final List lprocessvariable = new ArrayList(); + +// private final List lactivities = new ArrayList(); + + /** + * Crea una nueva instancia de flow end. + * + * @param pContext the context + * @throws Exception la exception + */ + public FlowEnd(Object pContext) throws Exception { + ProcessContext ctx = (ProcessContext) pContext; + p = (RuleFlowProcessInstance) ctx.getProcessInstance(); + long processId = p.getId(); + EntityManager em = PersistenceHelper.getEntityManager(); + instance = TbpmProcessInstance.findByProcessId(em, processId); + // TgeneTransactionLog log = TgeneTransactionLog.find(this.em, this.instance.getPk()); + // this.p = new Process(this.processId, this.instance.getSnapshot()); + htc = new HumanTaskClient(); + tc = new TaskCleaner(); + } + + /** + * Process. + * + * @throws Exception la exception + */ + @SuppressWarnings("unchecked") + @Override + public void process() throws Exception { + try { + FlowEnd.LOG.info("Inicia respaldo Flujo"); + Map m = p.getVariables(); + for (Entry e : m.entrySet()) { +// if (e.getKey().compareTo("tasksMetaData") == 0) { +// this.manageActivities((Map) e.getValue()); +// continue; +// } + if (e.getKey().compareTo("maia") == 0) { + for (Entry e1 : ((Map) e.getValue()).entrySet()) { + this.saveVariable(e1.getKey(), e1.getValue()); + } + continue; + } + this.saveVariable(e.getKey(), e.getValue()); + } + // PersistenceHelper.flushTransaction(); +// FlowEnd.LOG.info("Luego de Variables"); + instance.setEnddate(FormatDates.getInstance().getDataBaseDate()); + instance.setFinalized(Constant.STR_Y); + PersistenceHelper.saveOrUpdate(instance); + this.close(); + + SaveRequest sr = SaveData.getSaveRequest(); + sr.putSaveBean("TBPMPROCESSVARIABLES", lprocessvariable); + // sr.putSaveBean("TBPMACTIVITIES", lactivities); + // sr.putSaveBean("TBPMTASKCOMMENTS", ltaskcomments); + + // Eliminar tareas para que no tengan un workitem, puede ser de proceso diferentes. + tc.deleteTasks(); + FlowEnd.LOG.info("Luego de Instancia"); + } catch (Exception e) { + FlowEnd.LOG.error(e, e); + throw e; + } + } + + /** + * Save variable. + * + * @param pKey the key + * @param pValue the value + * @throws Exception la exception + */ + private void saveVariable(String pKey, Object pValue) throws Exception { + TbpmProcessVariablesKey pk = new TbpmProcessVariablesKey(instance.getPk(), pKey); + TbpmProcessVariables var = new TbpmProcessVariables(); + var.setPk(pk); + if (pValue == null) { + return; + } + Map rec = new HashMap(); + rec.put(pKey, pValue); + try { + var.setContent("."); + // Serializer ser = new Serializer((Serializable) rec); + // var.setContent(ser.toJSON()); + // PersistenceHelper.saveOrUpdate(var); + // PersistenceHelper.getEntityManager().persist(var); + var.put("isnew", true); + lprocessvariable.add(var); + } catch (Exception e) { + // no hacer nada + } + + } + +// /** +// * Manage activities. +// * +// * @param pValues the values +// * @throws Exception la exception +// */ +// private void manageActivities(Map pValues) throws Exception { +// FlowEnd.LOG.info("Maneja Actividades"); +// for (Entry e : pValues.entrySet()) { +// @SuppressWarnings("unchecked") +// List l = (List) e.getValue(); +// for (int i = 0; i < l.size(); i++) { +// try { +// TaskInfo taskInfo = l.get(i); +// this.manageActivity(taskInfo, e.getKey(), i); +// } catch (Exception e1) { +// if (e1 instanceof SQLException) { +// throw e1; +// } +// continue; +// } +// } +// } +// FlowEnd.LOG.info("Fin de Maneja Actividades"); +// } + +// /** +// * Manage activity. +// * +// * @param pTaskInfo the task info +// * @param pActivityname the activityname +// * @param pSequence the sequence +// * @throws Exception la exception +// */ +// private void manageActivity(TaskInfo pTaskInfo, String pActivityname, Integer pSequence) throws Exception { +// TbpmActivitiesKey k = new TbpmActivitiesKey(instance.getPk(), pActivityname, pSequence); +// TbpmActivities act = new TbpmActivities(); +// act.setPk(k); +// Field[] fs = TbpmActivities.class.getDeclaredFields(); +// for (Field field : fs) { +// try { +// Object val = BeanManager.getBeanAttributeValue(pTaskInfo, field.getName()); +// val = BeanManager.convertObject(val, BeanManager.getBeanGetterMethod(act, field.getName()).getReturnType()); +// BeanManager.setBeanAttributeValue(act, field.getName(), val); +// } catch (NoSuchMethodException e) { +// continue; +// } +// } +// if (pTaskInfo.getAditionalData() != null) { +// Serializer ser = new Serializer((Serializable) pTaskInfo.getAditionalData()); +// act.setAditionaldata(ser.toJSON()); +// } +// act.setGroupcode(pTaskInfo.getGroupId()); +// act.setUsercode(pTaskInfo.getUserId()); +// act.setExpectedtime(pTaskInfo.getExpectedTime()); +// act.setTaskjournalid(pTaskInfo.getJournalId()); +// act.setTaskid(pTaskInfo.getTaskId()); +// act.setRulecode(pTaskInfo.getRuleCode()); +// act.setRulecodedefault(pTaskInfo.getRuleCodeDefault()); +// act.setTaskid(pTaskInfo.getTaskId()); +// act.setInternalcode("" + pTaskInfo.getInternalCode()); +// +// BAMTaskSummaryImpl bam = this.getBAMTaskSummaryImpl(act.getTaskid()); +// act.setStarted(new Timestamp(bam.getStartDate().getTime())); +// act.setCompleted(new Timestamp(bam.getEndDate().getTime())); +// +// AuditTaskImpl atask = this.getAuditTaskImpl(act.getTaskid()); +// act.setCreated(new Timestamp(atask.getCreatedOn().getTime())); +// +// this.manageTask(act); +// PersistenceHelper.saveOrUpdate(act); +// lactivities.add(act); +// +// } + +// /** +// * Manage task. +// * +// * @param pAct the act +// * @throws Exception la exception +// */ +// private void manageTask(TbpmActivities pAct) throws Exception { +// Task t = htc.getTaskById(pAct.getTaskid()); +// TaskData td = t.getTaskData(); +// pAct.setUsercode(td.getActualOwner().getId()); +// List lc = td.getComments(); +// for (Comment comment : lc) { +// TbpmTaskComments c = new TbpmTaskComments(comment.getId(), new Date(comment.getAddedAt().getTime()), comment.getText(), pAct.getTaskid()); +// c.setUsercode(comment.getAddedBy().getId()); +// PersistenceHelper.saveOrUpdate(c); +// } +// } + + /** + * Close. + * + * @throws Exception la exception + */ + private void close() throws Exception { + // this.p.close(); + htc.close(); + + } + +// /** +// * JPQL TAREA_SUMMARY +// */ +// private static final String TAREA_SUMMARY = "select t from BAMTaskSummaryImpl t where t.taskId = :idtarea"; + +// /** +// * Obtiene el valor de unfinished tasks por Grupo. +// * +// * @param pGroupId the user id +// * @param pCri the cri +// * @return Valor de unfinished tasks +// * @throws Exception la exception +// */ +// public BAMTaskSummaryImpl getBAMTaskSummaryImpl(long idtarea) throws Exception { +// JbpmBeanLocal local = (JbpmBeanLocal) new InitialContext().lookup("java:global/maiaear-2.1/bpmlib/jbpmbean"); +// EntityManager em = null; +// BAMTaskSummaryImpl dato = null; +// try { +// em = local.getEmf().createEntityManager(); +// Query qry = em.createQuery(TAREA_SUMMARY); +// qry.setParameter("idtarea", idtarea); +// dato = (BAMTaskSummaryImpl) qry.getSingleResult(); +// } catch (NoResultException e) { +// // retorna el objeto en null. +// } finally { +// if (em.isOpen()) { +// em.close(); +// } +// } +// return dato; +// } +// +// /** +// * JPQL TAREA_SUMMARY +// */ +// private static final String TAREA_AUDIT_IMP = "select t from AuditTaskImpl t where t.taskId = :idtarea"; +// +// public AuditTaskImpl getAuditTaskImpl(long idtarea) throws Exception { +// JbpmBeanLocal local = (JbpmBeanLocal) new InitialContext().lookup("java:global/maiaear-2.1/bpmlib/jbpmbean"); +// EntityManager em = null; +// AuditTaskImpl dato = null; +// try { +// em = local.getEmf().createEntityManager(); +// Query qry = em.createQuery(TAREA_AUDIT_IMP); +// qry.setParameter("idtarea", idtarea); +// dato = (AuditTaskImpl) qry.getSingleResult(); +// } catch (NoResultException e) { +// // retorna el objeto en null. +// } finally { +// if (em.isOpen()) { +// em.close(); +// } +// } +// return dato; +// } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/FlowMonitor.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/FlowMonitor.java new file mode 100644 index 0000000..77839cd --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/FlowMonitor.java @@ -0,0 +1,87 @@ +/* + * + */ +package com.fp.bpmlib.query.monitor; + +import java.util.List; +import java.util.Map; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpmlib.BPMException; +import com.fp.bpmlib.ProcessUtil; +import com.fp.bpmlib.db.DataHelper; +import com.fp.bpmlib.flow.Monitor; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pbpm.gene.TbpmProcessInstance; +import com.fp.persistence.pgeneral.log.TgeneTransactionLog; + + +/** + * Class FlowMonitor encargada de. + * + * @author gfiallos + */ +public class FlowMonitor extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** El valor de pid. */ + private Long pid; + + /** El valor de request. */ + private QueryRequest request; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + this.request = pQueryRequest; + this.pid = this.request.getLong("PID"); + if (this.pid == null) { + throw new BPMException("BPM-0004", "LA INSTANCIA {0} NO ESTA DISPONIBLE O YA FUE FINALIZADA", this.pid); + } + this.manageFlow(); + this.manageOrigin(); + return pQueryRequest; + } + + /** + * Manage flow. + * + * @throws Exception la exception + */ + protected void manageFlow() throws Exception { + Monitor monitor = new Monitor(this.pid); + //p.setVariable("TEST", FormatDates.getInstance().getDataBaseTimestamp()); + this.request.getResponse().put("status", monitor.getStatus()); + Object tasks = ProcessUtil.getFirstDoneTaskMetaData(monitor); + this.request.getResponse().put("FIRST", tasks); + } + + /** + * Manage origin. + * + * @throws Exception la exception + */ + protected void manageOrigin() throws Exception { + TbpmProcessInstance pro = DataHelper.getInstance().getTbpmProcessInstance(this.pid); + TgeneTransactionLog log = TgeneTransactionLog.find(PersistenceHelper.getEntityManager(), pro.getPk()); + List> data = ProcessUtil.getInstance().transactionData(pro.getPk(), this.request); + this.request.getResponse().put("origin", data); + this.request.getResponse().put( + "TRN", + log.getTransactionmodule() + "-" + log.getTransactioncode() + "-" + log.getTransactionversion() + " " + + GeneralDescriptions.getTransactiondesc(log.getTransactionmodule(), log.getTransactioncode(), log.getTransactionversion())); + } + + + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/package-info.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/package-info.java new file mode 100644 index 0000000..2567fb7 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/monitor/package-info.java @@ -0,0 +1,4 @@ +/** + * Provee los utilitarios para el manejo del monitor de Flujos + */ +package com.fp.bpmlib.query.monitor; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/package-info.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/package-info.java new file mode 100644 index 0000000..ef5d708 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/package-info.java @@ -0,0 +1,4 @@ +/** + * Provee los componentes para las transacciones de consulta + */ +package com.fp.bpmlib.query; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/rules/.svn/entries b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/rules/.svn/entries new file mode 100644 index 0000000..b78c943 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/rules/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/rules +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +package-info.java +file + + + + +2022-07-28T03:40:45.927817Z +aed4b5906c4fcbf84d50b987479a89f2 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +88 + +RefreshKnowledgeBase.java +file + + + + +2022-07-28T03:40:45.927817Z +2a963cd2a12a47c58514e8dc0bd09252 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +1088 + +Rules.java +file + + + + +2022-07-28T03:40:45.928817Z +8eb792d348a1ffcfd1867f7c1ebddd3e +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +4697 + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/rules/.svn/text-base/RefreshKnowledgeBase.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/rules/.svn/text-base/RefreshKnowledgeBase.java.svn-base new file mode 100644 index 0000000..3758fed --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/rules/.svn/text-base/RefreshKnowledgeBase.java.svn-base @@ -0,0 +1,36 @@ +package com.fp.bpmlib.query.rules; + +import java.util.List; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.pbpm.gene.TbpmRules; + +/** + * Clase que se encarga de refrescar la base de conocimiento dado un registro de tbpmrules. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class RefreshKnowledgeBase extends TransactionRule { + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if(pSaveRequest.get("refresh") == null){ + return pSaveRequest; + } + List ldata = pSaveRequest.getSaveBeanModifiedRecords("TBPMRULES"); + TbpmRules obj = (TbpmRules)ldata.get(0); + //KnowledgeBaseHelper kh = new KnowledgeBaseHelper(); + //kh.refreshKnowledgeBase(obj); + pSaveRequest.remove("TBPMRULES"); + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/rules/.svn/text-base/Rules.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/rules/.svn/text-base/Rules.java.svn-base new file mode 100644 index 0000000..2b931ae --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/rules/.svn/text-base/Rules.java.svn-base @@ -0,0 +1,124 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.bpmlib.query.rules; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; + +// TODO: Auto-generated Javadoc +/** + * Clase que realiza la consulta las reglas BPM. + * + * @author BPTWPA + */ +public class Rules extends QueryRule { + + /** Constante serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** Constante JPQL_RULES. */ + private static final String JPQL_RULES = "select r.pk.rulecode, r.pk.companycode, r.description, r.packagename, " + + "r.snapshot, r.active, r.refresh, r.parametertype, r.messagecode , m.description " + "from TbpmRules r, TgeneMessageTemplates m " + + "where r.messagecode=m.pk "; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + StringBuilder jpql = new StringBuilder(); + List> listResp = new ArrayList>(); + Response response = pQueryRequest.getResponse(); + QueryBean qb = (QueryBean) pQueryRequest.get("TBPMRULES"); + List lcriteria = qb.getCriteria(); + EntityManager em = PersistenceHelper.getEntityManager(); + jpql.append(Rules.JPQL_RULES); + Query qry = em.createQuery(this.addSimpleCriteriaJPQL(jpql, lcriteria, qb)); + this.setSimpleParametersJPQL(qry, lcriteria); + qry.setFirstResult((qb.getPage() - 1) * qb.getPageSize()); + qry.setMaxResults(qb.getPageSize()); + @SuppressWarnings("unchecked") + List list = qry.getResultList(); + if (!list.isEmpty()) { + for (Object oj : list) { + Map mapResp = new HashMap(); + Object[] obj = (Object[]) oj; + mapResp.put("pk_rulecode", obj[0]); + mapResp.put("pk_companycode", obj[1]); + mapResp.put("description", obj[2]); + mapResp.put("packagename", obj[3]); + mapResp.put("snapshot", obj[4]); + mapResp.put("active", obj[5]); + mapResp.put("refresh", obj[6]); + mapResp.put("parametertype", obj[7]); + mapResp.put("messagecode", obj[8]); + mapResp.put("descmessage", obj[9]); + listResp.add(mapResp); + } + } + response.put("TBPMRULES", listResp); + return pQueryRequest; + } + + /** + * M�todo que agrega los parametros de una consulta jpql. + * + * @param jpql Creado + * @param lcriteria Criterios de consulta + * @param qb the qb + * @return String del jpql + */ + private String addSimpleCriteriaJPQL(StringBuilder jpql, List lcriteria, QueryBean qb) { + for (QueryCriteria obj : lcriteria) { + if (obj.getValue() != null) { + jpql.append(" and ").append(obj.getProperty()).append(" ").append(obj.getOperation()).append(" :") + .append(obj.getProperty().replace(".", "")); + } + } + boolean first = true; + for (QueryCriteria order : qb.getOrder(true)) { + if (first) { + jpql.append(" ORDER BY "); + } else { + jpql.append(" asc, "); + } + jpql.append(order.getProperty()); + first = false; + } + return String.valueOf(jpql); + } + + /** + * M�todo que setea los parametros para la consulta. + * + * @param qry Query + * @param lcriteria Criterios de consluta + */ + private void setSimpleParametersJPQL(Query qry, List lcriteria) { + for (QueryCriteria obj : lcriteria) { + if (obj.getValue() != null) { + qry.setParameter(obj.getProperty().replace(".", ""), + ((obj.getProperty().replace(".", "").compareTo("rpkcompanycode") == 0) ? Integer.valueOf(String.valueOf(obj.getValue())) + : obj.getValue())); + } + } + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/rules/.svn/text-base/package-info.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/rules/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..b25d895 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/rules/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,4 @@ +/** + * Provee las clases de consulta de Reglas + */ +package com.fp.bpmlib.query.rules; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/rules/RefreshKnowledgeBase.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/rules/RefreshKnowledgeBase.java new file mode 100644 index 0000000..3758fed --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/rules/RefreshKnowledgeBase.java @@ -0,0 +1,36 @@ +package com.fp.bpmlib.query.rules; + +import java.util.List; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.pbpm.gene.TbpmRules; + +/** + * Clase que se encarga de refrescar la base de conocimiento dado un registro de tbpmrules. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class RefreshKnowledgeBase extends TransactionRule { + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if(pSaveRequest.get("refresh") == null){ + return pSaveRequest; + } + List ldata = pSaveRequest.getSaveBeanModifiedRecords("TBPMRULES"); + TbpmRules obj = (TbpmRules)ldata.get(0); + //KnowledgeBaseHelper kh = new KnowledgeBaseHelper(); + //kh.refreshKnowledgeBase(obj); + pSaveRequest.remove("TBPMRULES"); + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/rules/Rules.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/rules/Rules.java new file mode 100644 index 0000000..2b931ae --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/rules/Rules.java @@ -0,0 +1,124 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.bpmlib.query.rules; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; + +// TODO: Auto-generated Javadoc +/** + * Clase que realiza la consulta las reglas BPM. + * + * @author BPTWPA + */ +public class Rules extends QueryRule { + + /** Constante serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** Constante JPQL_RULES. */ + private static final String JPQL_RULES = "select r.pk.rulecode, r.pk.companycode, r.description, r.packagename, " + + "r.snapshot, r.active, r.refresh, r.parametertype, r.messagecode , m.description " + "from TbpmRules r, TgeneMessageTemplates m " + + "where r.messagecode=m.pk "; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + StringBuilder jpql = new StringBuilder(); + List> listResp = new ArrayList>(); + Response response = pQueryRequest.getResponse(); + QueryBean qb = (QueryBean) pQueryRequest.get("TBPMRULES"); + List lcriteria = qb.getCriteria(); + EntityManager em = PersistenceHelper.getEntityManager(); + jpql.append(Rules.JPQL_RULES); + Query qry = em.createQuery(this.addSimpleCriteriaJPQL(jpql, lcriteria, qb)); + this.setSimpleParametersJPQL(qry, lcriteria); + qry.setFirstResult((qb.getPage() - 1) * qb.getPageSize()); + qry.setMaxResults(qb.getPageSize()); + @SuppressWarnings("unchecked") + List list = qry.getResultList(); + if (!list.isEmpty()) { + for (Object oj : list) { + Map mapResp = new HashMap(); + Object[] obj = (Object[]) oj; + mapResp.put("pk_rulecode", obj[0]); + mapResp.put("pk_companycode", obj[1]); + mapResp.put("description", obj[2]); + mapResp.put("packagename", obj[3]); + mapResp.put("snapshot", obj[4]); + mapResp.put("active", obj[5]); + mapResp.put("refresh", obj[6]); + mapResp.put("parametertype", obj[7]); + mapResp.put("messagecode", obj[8]); + mapResp.put("descmessage", obj[9]); + listResp.add(mapResp); + } + } + response.put("TBPMRULES", listResp); + return pQueryRequest; + } + + /** + * M�todo que agrega los parametros de una consulta jpql. + * + * @param jpql Creado + * @param lcriteria Criterios de consulta + * @param qb the qb + * @return String del jpql + */ + private String addSimpleCriteriaJPQL(StringBuilder jpql, List lcriteria, QueryBean qb) { + for (QueryCriteria obj : lcriteria) { + if (obj.getValue() != null) { + jpql.append(" and ").append(obj.getProperty()).append(" ").append(obj.getOperation()).append(" :") + .append(obj.getProperty().replace(".", "")); + } + } + boolean first = true; + for (QueryCriteria order : qb.getOrder(true)) { + if (first) { + jpql.append(" ORDER BY "); + } else { + jpql.append(" asc, "); + } + jpql.append(order.getProperty()); + first = false; + } + return String.valueOf(jpql); + } + + /** + * M�todo que setea los parametros para la consulta. + * + * @param qry Query + * @param lcriteria Criterios de consluta + */ + private void setSimpleParametersJPQL(Query qry, List lcriteria) { + for (QueryCriteria obj : lcriteria) { + if (obj.getValue() != null) { + qry.setParameter(obj.getProperty().replace(".", ""), + ((obj.getProperty().replace(".", "").compareTo("rpkcompanycode") == 0) ? Integer.valueOf(String.valueOf(obj.getValue())) + : obj.getValue())); + } + } + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/rules/package-info.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/rules/package-info.java new file mode 100644 index 0000000..b25d895 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/rules/package-info.java @@ -0,0 +1,4 @@ +/** + * Provee las clases de consulta de Reglas + */ +package com.fp.bpmlib.query.rules; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/solicitud/.svn/entries b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/solicitud/.svn/entries new file mode 100644 index 0000000..0969fbe --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/solicitud/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/solicitud +svn://172.17.26.185/COMACO + + + +2020-01-29T23:31:52.972406Z +4628 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +EstadoSolicitudQuery.java +file + + + + +2022-07-28T03:40:45.874817Z +3925394381a2c96d953e35079af76d44 +2020-01-29T23:31:52.972406Z +4628 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1999 + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/solicitud/.svn/text-base/EstadoSolicitudQuery.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/solicitud/.svn/text-base/EstadoSolicitudQuery.java.svn-base new file mode 100644 index 0000000..c2dc3dc --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/solicitud/.svn/text-base/EstadoSolicitudQuery.java.svn-base @@ -0,0 +1,53 @@ +package com.fp.bpmlib.query.solicitud; + +import java.util.List; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; + +public class EstadoSolicitudQuery extends QueryRule{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + try { + System.out.println("*********consulta*************************************"); + String codigosolicitud = (String) pQueryRequest.get("codigosolicitudbpm"); + System.out.println("CODIGO DE CONSULTA : "+codigosolicitud); + if(codigosolicitud.contains("SOL")){ + codigosolicitud=codigosolicitud.replace("SOL", ""); + } + if(codigosolicitud.contains("TRA")){ + codigosolicitud=codigosolicitud.replace("TRA", ""); + } + + StringBuilder sql = new StringBuilder("select DISTINCT ta.ACTIVITYNAME,ta.USERCODE,ta.GROUPCODE,tk.STATUS,ta.CREATED,ta.STARTED,ta.COMPLETED " + + " from jbpm6.VARIABLEINSTANCELOG d, TBPMACTIVITIES ta, jbpm6.TASK tk " + + " where d.processInstanceId = ta.internalcode and tk.id (+) = ta.TASKID "); + + if(codigosolicitud.contains("SOL") || codigosolicitud.contains("TRA")){ + sql.append(" and (d.value like '%SOL"+codigosolicitud+"%' or d.value like '%TRA"+codigosolicitud+"%') ");//SOL-0000491173 + }else{ + sql.append(" and d.value like '%"+codigosolicitud+"%' "); + } + + sql.append( " order by ta.CREATED "); + + System.out.println("SQL_ESTADOS_SOLICITUDBPM: "+sql); + List listaVariables=PersistenceHelper.getEntityManager(). + createNativeQuery(sql.toString()).getResultList(); + System.out.println("consulta*************************************"+listaVariables); + pQueryRequest.getResponse().put("LISTASESTADOSOLICITUDBPM", listaVariables); + } catch (Exception e) { + e.printStackTrace(); + } + return pQueryRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/solicitud/EstadoSolicitudQuery.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/solicitud/EstadoSolicitudQuery.java new file mode 100644 index 0000000..c2dc3dc --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/solicitud/EstadoSolicitudQuery.java @@ -0,0 +1,53 @@ +package com.fp.bpmlib.query.solicitud; + +import java.util.List; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; + +public class EstadoSolicitudQuery extends QueryRule{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + try { + System.out.println("*********consulta*************************************"); + String codigosolicitud = (String) pQueryRequest.get("codigosolicitudbpm"); + System.out.println("CODIGO DE CONSULTA : "+codigosolicitud); + if(codigosolicitud.contains("SOL")){ + codigosolicitud=codigosolicitud.replace("SOL", ""); + } + if(codigosolicitud.contains("TRA")){ + codigosolicitud=codigosolicitud.replace("TRA", ""); + } + + StringBuilder sql = new StringBuilder("select DISTINCT ta.ACTIVITYNAME,ta.USERCODE,ta.GROUPCODE,tk.STATUS,ta.CREATED,ta.STARTED,ta.COMPLETED " + + " from jbpm6.VARIABLEINSTANCELOG d, TBPMACTIVITIES ta, jbpm6.TASK tk " + + " where d.processInstanceId = ta.internalcode and tk.id (+) = ta.TASKID "); + + if(codigosolicitud.contains("SOL") || codigosolicitud.contains("TRA")){ + sql.append(" and (d.value like '%SOL"+codigosolicitud+"%' or d.value like '%TRA"+codigosolicitud+"%') ");//SOL-0000491173 + }else{ + sql.append(" and d.value like '%"+codigosolicitud+"%' "); + } + + sql.append( " order by ta.CREATED "); + + System.out.println("SQL_ESTADOS_SOLICITUDBPM: "+sql); + List listaVariables=PersistenceHelper.getEntityManager(). + createNativeQuery(sql.toString()).getResultList(); + System.out.println("consulta*************************************"+listaVariables); + pQueryRequest.getResponse().put("LISTASESTADOSOLICITUDBPM", listaVariables); + } catch (Exception e) { + e.printStackTrace(); + } + return pQueryRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/entries b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/entries new file mode 100644 index 0000000..a6cf05c --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/entries @@ -0,0 +1,334 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +AsignedTasks.java +file + + + + +2022-07-28T03:40:45.893817Z +3c90b4778cbc749f86a7994c74e52182 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +2482 + +StartTask.java +file + + + + +2022-07-28T03:40:45.893817Z +3cf07cad8f16d8d9a7c7165a00921b36 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1142 + +TaskHistory.java +file + + + + +2022-07-28T03:40:45.893817Z +885fbc9fee7e7a1f0c5d14a9704c2b43 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +1218 + +package-info.java +file + + + + +2022-07-28T03:40:45.893817Z +feff889b6490a466cd8cebbbe7b69b0e +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +103 + +TaskDetail.java +file + + + + +2022-07-28T03:40:45.894817Z +65b0fffaee14754d69e46f5737f1c43b +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +4530 + +TaskPending.java +file + + + + +2022-07-28T03:40:45.894817Z +a49aa2db233caa8150686547cc062f19 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +4943 + +ClaimTask.java +file + + + + +2022-07-28T03:40:45.894817Z +b4a8a0fce4a882f2ce6038a34909e1ac +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1156 + +CompleteTask.java +file + + + + +2022-07-28T03:40:45.895817Z +47f0c268d8efdbf51b10a914ecf04c13 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1296 + +TaskServerStatus.java +file + + + + +2022-07-28T03:40:45.895817Z +c2624d932958268d19181a501be668a3 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +974 + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/AsignedTasks.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/AsignedTasks.java.svn-base new file mode 100644 index 0000000..f106bf1 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/AsignedTasks.java.svn-base @@ -0,0 +1,67 @@ +/* + * + */ +package com.fp.bpmlib.query.task; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.kie.api.task.model.Task; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpmlib.ProcessUtil; +import com.fp.bpmlib.task.client.HumanTaskClient; +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +// TODO: Auto-generated Javadoc +/** + * Class TransactionTasks encargada de consultar las Tareas por transaccin. + * + * @author gfiallos + */ +public class AsignedTasks extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + HumanTaskClient htc = new HumanTaskClient(); + try { + List t = htc.getAsignedTasks(pQueryRequest.getString("userCri")); + List> data = new ArrayList>(); + for (Object[] obj : t) { + Task task = (Task) obj[0]; + TaskUtil tu = new TaskUtil(task, htc); + Map rec = new HashMap(); + rec.put("tid", tu.getTid()); + rec.put("workItem", task.getTaskData().getWorkItemId()); + rec.put("detail", tu.getSubject()); + rec.put("userasigned", task.getTaskData().getActualOwner().getId()); + rec.put("nameasigned", GeneralDescriptions.getOfficername(task.getTaskData().getActualOwner().getId())); + rec.put("logsolicitude", tu.getRequest().get("logsolicitude")); + rec.put("rulename", task.getName()); + List> data1 = ProcessUtil.getInstance().transactionData(tu.getRequest().getJournalId(), pQueryRequest, false); + for (Map map : data1) { + rec.put((String) map.get("NAME"), map.get("VALUE")); + } + data.add(rec); + } + pQueryRequest.getResponse().put("tasks", data); + return pQueryRequest; + } finally { + htc.close(); + } + } +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/ClaimTask.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/ClaimTask.java.svn-base new file mode 100644 index 0000000..3b1445e --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/ClaimTask.java.svn-base @@ -0,0 +1,45 @@ +/* + * + */ +package com.fp.bpmlib.query.task; + +import com.fp.bpmlib.BPMException; +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.common.helper.BeanManager; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +// TODO: Auto-generated Javadoc +/** + * Class ClaimTask encargada de. + * + * @author gfiallos + */ +public class ClaimTask extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Long tid = BeanManager.convertObject(pQueryRequest.get("TID"), Long.class); + if (tid == null) { + throw new BPMException("BPM-0008", "NO SE HA ENCONTRADO LA TAREA {0}", tid); + } + TaskUtil t = new TaskUtil(tid); + try { + t.claim(pQueryRequest.getUser()); + } finally { + t.close(); + } + return pQueryRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/CompleteTask.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/CompleteTask.java.svn-base new file mode 100644 index 0000000..d07f111 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/CompleteTask.java.svn-base @@ -0,0 +1,48 @@ +/* + * + */ +package com.fp.bpmlib.query.task; + +import java.util.HashMap; + +import com.fp.bpmlib.BPMException; +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.common.helper.BeanManager; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.simple.dto.Responses; + +// TODO: Auto-generated Javadoc +/** + * Class CompleteTask encargada de. + * + * @author gfiallos + */ +public class CompleteTask extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Long tid = BeanManager.convertObject(pQueryRequest.get("TID"), Long.class); + if (tid == null) { + throw new BPMException("BPM-0008", "NO SE HA ENCONTRADO LA TAREA {0}", tid); + } + TaskUtil task = new TaskUtil(tid); + try { + task.complete(pQueryRequest.getJournalId(), new HashMap(), Responses.OK, "AA"); + } finally { + task.close(); + } + return pQueryRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/StartTask.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/StartTask.java.svn-base new file mode 100644 index 0000000..f503b30 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/StartTask.java.svn-base @@ -0,0 +1,45 @@ +/* + * + */ +package com.fp.bpmlib.query.task; + +import com.fp.bpmlib.BPMException; +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.common.helper.BeanManager; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +// TODO: Auto-generated Javadoc +/** + * Class StartTask encargada de. + * + * @author gfiallos + */ +public class StartTask extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Long tid = BeanManager.convertObject(pQueryRequest.get("TID"), Long.class); + if (tid == null) { + throw new BPMException("BPM-0008", "NO SE HA ENCONTRADO LA TAREA {0}", tid); + } + TaskUtil task = new TaskUtil(tid); + try { + task.start(); + } finally { + task.close(); + } + return pQueryRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/TaskDetail.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/TaskDetail.java.svn-base new file mode 100644 index 0000000..7434a3c --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/TaskDetail.java.svn-base @@ -0,0 +1,120 @@ +/* + * + */ +package com.fp.bpmlib.query.task; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.apache.log4j.Logger; +import org.kie.api.task.model.Comment; +import org.kie.api.task.model.TaskData; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpmlib.ProcessUtil; +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.simple.dto.TaskInfo; + +// TODO: Auto-generated Javadoc +/** + * Class TaskDetail encargada de. + * + * @author gfiallos + */ +public class TaskDetail extends QueryRule { + + /** Constante LOG. */ + private static final Logger LOG = Logger.getLogger(TaskDetail.class); + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** El valor de data. */ + private List> data; + + // private Process process; + + /** El valor de request. */ + private QueryRequest request; + + /** El valor de response. */ + private Response response; + + /** + * Manage task. + * + * @param tid the tid + * @return list + * @throws Exception la exception + */ + protected List> manageTask(Long tid) throws Exception { + TaskUtil t = new TaskUtil(tid); + try { + TaskData td = t.getTaskData(); + + TaskInfo ti = t.getTaskInfo(); + this.data.add(ProcessUtil.getInstance().prepareRecord("create", new Timestamp(td.getCreatedOn().getTime()), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("taskStatus", + GeneralDescriptions.getLabel(td.getStatus().name(), this.request.getLanguage(), this.request.getChannelCode()), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("workItem", td.getWorkItemId(), this.request)); + Map task = ProcessUtil.getInstance().prepareRecord("taskId", tid, this.request); + + this.data.add(task); + this.data.add(ProcessUtil.getInstance().prepareRecord("response", ti.getResponse(), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("realTime", + ti.getRealTimeString(FormatDates.getInstance().getDataBaseTimestamp().getTime()), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("expectedTime", ti.getExpectedTimeString(), this.request)); + Map add = ti.getAditionalData(); + for (Entry addE : add.entrySet()) { + this.data.add(ProcessUtil.getInstance().prepareRecord("" + addE.getKey(), addE.getValue(), this.request)); + } + List lc = t.getComments(); + List> comments = new ArrayList>(); + for (Comment comment : lc) { + Map record = new HashMap(); + record.put("user", comment.getAddedBy().getId()); + record.put("name", GeneralDescriptions.getUsername(comment.getAddedBy().getId())); + record.put("date", new Timestamp(comment.getAddedAt().getTime())); + record.put("comment", comment.getText()); + comments.add(record); + } + return comments; + } finally { + t.close(); + } + } + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + + this.request = pQueryRequest; + // Long pid = pQueryRequest.getLong("PID"); + Long tid = pQueryRequest.getLong("TID"); + String journalId = pQueryRequest.getString("JID"); + TaskDetail.LOG.debug("TID:" + tid); + TaskDetail.LOG.debug("journalId:" + journalId); + this.data = ProcessUtil.getInstance().transactionData(journalId, this.request); + + this.response = this.request.getResponse(); + this.response.put("data", this.data); + this.response.put("comments", this.manageTask(tid)); + + return pQueryRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/TaskHistory.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/TaskHistory.java.svn-base new file mode 100644 index 0000000..c0555ba --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/TaskHistory.java.svn-base @@ -0,0 +1,48 @@ +/* + * + */ +package com.fp.bpmlib.query.task; + + +import com.fp.bpmlib.ProcessUtil; +import com.fp.bpmlib.flow.Monitor; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + + +/** + * Class TaskHistory encargada de. + * + * @author gfiallos + */ +public class TaskHistory extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + QueryRequest request = pQueryRequest; + Long pid = pQueryRequest.getLong("PID"); + Long spid = pid; + try { + spid = pQueryRequest.getLong("SPID"); + } catch (Exception e) { + // + } + String name = pQueryRequest.getString("NAME"); + Response response = request.getResponse(); + Monitor monitor = new Monitor(pid); + response.put("DATA", ProcessUtil.getDoneTaskMetaData(monitor, name)); + return pQueryRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/TaskPending.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/TaskPending.java.svn-base new file mode 100644 index 0000000..9d8b0d8 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/TaskPending.java.svn-base @@ -0,0 +1,123 @@ +/* + * + */ +package com.fp.bpmlib.query.task; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.kie.api.task.model.Comment; +import org.kie.api.task.model.Task; +import org.kie.api.task.model.TaskData; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpmlib.ProcessUtil; +import com.fp.bpmlib.task.client.HumanTaskClient; +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.simple.dto.TaskInfo; + +// TODO: Auto-generated Javadoc +/** + * Class TaskPending encargada de. + * + * @author gfiallos + */ +public class TaskPending extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** El valor de data. */ + private List> data; + + /** El valor de htc. */ + private HumanTaskClient htc; + + // private Process process; + + /** El valor de request. */ + private QueryRequest request; + + // private static final Logger LOG = Logger.getLogger(TaskPending.class); + + /** + * Manage task. + * + * @param pWork the work + * @return list + * @throws Exception la exception + */ + protected List> manageTask(Long pWork) throws Exception { + Task t = this.htc.getTaskByWorkItemId(pWork); + TaskData td = t.getTaskData(); + TaskUtil tu = new TaskUtil(t.getId()); + TaskInfo ti = tu.getTaskInfo(); + ti.setCreated(new Timestamp(td.getCreatedOn().getTime())); + this.data = new ArrayList>(); + String user = ti.getUserId(); + try { + user = td.getActualOwner().getId(); + } catch (Exception e) { + user = ti.getUserId(); + } + this.data.add(ProcessUtil.getInstance().prepareRecord("userAsign", user, this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("name", GeneralDescriptions.getOfficername(user), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("groupAsign", ti.getGroupId(), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("taskStatus", + GeneralDescriptions.getLabel(td.getStatus().name(), this.request.getLanguage(), this.request.getChannelCode()), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("workItem", td.getWorkItemId(), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("taskId", t.getId(), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("create", new Timestamp(td.getCreatedOn().getTime()), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("realTime", + ti.getRealTimeString(FormatDates.getInstance().getDataBaseTimestamp().getTime()), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("expectedTime", ti.getExpectedTimeString(), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord( + "transaction", + ti.getModule() + "-" + ti.getTransaction() + "-" + ti.getVersion() + " " + + GeneralDescriptions.getTransactiondesc(ti.getModule(), ti.getTransaction(), ti.getVersion()), this.request)); + List lc = tu.getComments(); + List> comments = new ArrayList>(); + for (Comment comment : lc) { + Map record = new HashMap(); + record.put("user", comment.getAddedBy().getId()); + record.put("name", GeneralDescriptions.getUsername(comment.getAddedBy().getId())); + record.put("date", new Timestamp(comment.getAddedAt().getTime())); + record.put("comment", comment.getText()); + comments.add(record); + } + return comments; + } + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + this.htc = new HumanTaskClient(); + try { + this.request = pQueryRequest; + // Long pid = pQueryRequest.getLong("PID"); + // Long tid = pQueryRequest.getLong("TID"); + Long workId = pQueryRequest.getLong("WORKID"); + + Response response = this.request.getResponse(); + response.put("comments", this.manageTask(workId)); + response.put("data", this.data); + } finally { + this.htc.close(); + } + return pQueryRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/TaskServerStatus.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/TaskServerStatus.java.svn-base new file mode 100644 index 0000000..32c38b6 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/TaskServerStatus.java.svn-base @@ -0,0 +1,39 @@ +/* + * + */ +package com.fp.bpmlib.query.task; + +import com.fp.base.persistence.util.job.ServiceManager; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +// TODO: Auto-generated Javadoc +/** + * Class TaskServerStatus encargada de. + * + * @author gfiallos + */ +public class TaskServerStatus extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response rs = pQueryRequest.getResponse(); + String code = (String) pQueryRequest.get("code"); + ServiceManager sm = new ServiceManager(); + + rs.put("TSStatus", sm.isRunning(code)); + return pQueryRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/package-info.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..3cbd19f --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,4 @@ +/** + * Provee las clases para el manejo de consultas de tareas + */ +package com.fp.bpmlib.query.task; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/AsignedTasks.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/AsignedTasks.java new file mode 100644 index 0000000..f106bf1 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/AsignedTasks.java @@ -0,0 +1,67 @@ +/* + * + */ +package com.fp.bpmlib.query.task; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.kie.api.task.model.Task; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpmlib.ProcessUtil; +import com.fp.bpmlib.task.client.HumanTaskClient; +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +// TODO: Auto-generated Javadoc +/** + * Class TransactionTasks encargada de consultar las Tareas por transaccin. + * + * @author gfiallos + */ +public class AsignedTasks extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + HumanTaskClient htc = new HumanTaskClient(); + try { + List t = htc.getAsignedTasks(pQueryRequest.getString("userCri")); + List> data = new ArrayList>(); + for (Object[] obj : t) { + Task task = (Task) obj[0]; + TaskUtil tu = new TaskUtil(task, htc); + Map rec = new HashMap(); + rec.put("tid", tu.getTid()); + rec.put("workItem", task.getTaskData().getWorkItemId()); + rec.put("detail", tu.getSubject()); + rec.put("userasigned", task.getTaskData().getActualOwner().getId()); + rec.put("nameasigned", GeneralDescriptions.getOfficername(task.getTaskData().getActualOwner().getId())); + rec.put("logsolicitude", tu.getRequest().get("logsolicitude")); + rec.put("rulename", task.getName()); + List> data1 = ProcessUtil.getInstance().transactionData(tu.getRequest().getJournalId(), pQueryRequest, false); + for (Map map : data1) { + rec.put((String) map.get("NAME"), map.get("VALUE")); + } + data.add(rec); + } + pQueryRequest.getResponse().put("tasks", data); + return pQueryRequest; + } finally { + htc.close(); + } + } +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/ClaimTask.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/ClaimTask.java new file mode 100644 index 0000000..3b1445e --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/ClaimTask.java @@ -0,0 +1,45 @@ +/* + * + */ +package com.fp.bpmlib.query.task; + +import com.fp.bpmlib.BPMException; +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.common.helper.BeanManager; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +// TODO: Auto-generated Javadoc +/** + * Class ClaimTask encargada de. + * + * @author gfiallos + */ +public class ClaimTask extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Long tid = BeanManager.convertObject(pQueryRequest.get("TID"), Long.class); + if (tid == null) { + throw new BPMException("BPM-0008", "NO SE HA ENCONTRADO LA TAREA {0}", tid); + } + TaskUtil t = new TaskUtil(tid); + try { + t.claim(pQueryRequest.getUser()); + } finally { + t.close(); + } + return pQueryRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/CompleteTask.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/CompleteTask.java new file mode 100644 index 0000000..d07f111 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/CompleteTask.java @@ -0,0 +1,48 @@ +/* + * + */ +package com.fp.bpmlib.query.task; + +import java.util.HashMap; + +import com.fp.bpmlib.BPMException; +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.common.helper.BeanManager; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.simple.dto.Responses; + +// TODO: Auto-generated Javadoc +/** + * Class CompleteTask encargada de. + * + * @author gfiallos + */ +public class CompleteTask extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Long tid = BeanManager.convertObject(pQueryRequest.get("TID"), Long.class); + if (tid == null) { + throw new BPMException("BPM-0008", "NO SE HA ENCONTRADO LA TAREA {0}", tid); + } + TaskUtil task = new TaskUtil(tid); + try { + task.complete(pQueryRequest.getJournalId(), new HashMap(), Responses.OK, "AA"); + } finally { + task.close(); + } + return pQueryRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/StartTask.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/StartTask.java new file mode 100644 index 0000000..f503b30 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/StartTask.java @@ -0,0 +1,45 @@ +/* + * + */ +package com.fp.bpmlib.query.task; + +import com.fp.bpmlib.BPMException; +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.common.helper.BeanManager; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +// TODO: Auto-generated Javadoc +/** + * Class StartTask encargada de. + * + * @author gfiallos + */ +public class StartTask extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Long tid = BeanManager.convertObject(pQueryRequest.get("TID"), Long.class); + if (tid == null) { + throw new BPMException("BPM-0008", "NO SE HA ENCONTRADO LA TAREA {0}", tid); + } + TaskUtil task = new TaskUtil(tid); + try { + task.start(); + } finally { + task.close(); + } + return pQueryRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/TaskDetail.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/TaskDetail.java new file mode 100644 index 0000000..7434a3c --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/TaskDetail.java @@ -0,0 +1,120 @@ +/* + * + */ +package com.fp.bpmlib.query.task; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.apache.log4j.Logger; +import org.kie.api.task.model.Comment; +import org.kie.api.task.model.TaskData; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpmlib.ProcessUtil; +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.simple.dto.TaskInfo; + +// TODO: Auto-generated Javadoc +/** + * Class TaskDetail encargada de. + * + * @author gfiallos + */ +public class TaskDetail extends QueryRule { + + /** Constante LOG. */ + private static final Logger LOG = Logger.getLogger(TaskDetail.class); + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** El valor de data. */ + private List> data; + + // private Process process; + + /** El valor de request. */ + private QueryRequest request; + + /** El valor de response. */ + private Response response; + + /** + * Manage task. + * + * @param tid the tid + * @return list + * @throws Exception la exception + */ + protected List> manageTask(Long tid) throws Exception { + TaskUtil t = new TaskUtil(tid); + try { + TaskData td = t.getTaskData(); + + TaskInfo ti = t.getTaskInfo(); + this.data.add(ProcessUtil.getInstance().prepareRecord("create", new Timestamp(td.getCreatedOn().getTime()), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("taskStatus", + GeneralDescriptions.getLabel(td.getStatus().name(), this.request.getLanguage(), this.request.getChannelCode()), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("workItem", td.getWorkItemId(), this.request)); + Map task = ProcessUtil.getInstance().prepareRecord("taskId", tid, this.request); + + this.data.add(task); + this.data.add(ProcessUtil.getInstance().prepareRecord("response", ti.getResponse(), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("realTime", + ti.getRealTimeString(FormatDates.getInstance().getDataBaseTimestamp().getTime()), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("expectedTime", ti.getExpectedTimeString(), this.request)); + Map add = ti.getAditionalData(); + for (Entry addE : add.entrySet()) { + this.data.add(ProcessUtil.getInstance().prepareRecord("" + addE.getKey(), addE.getValue(), this.request)); + } + List lc = t.getComments(); + List> comments = new ArrayList>(); + for (Comment comment : lc) { + Map record = new HashMap(); + record.put("user", comment.getAddedBy().getId()); + record.put("name", GeneralDescriptions.getUsername(comment.getAddedBy().getId())); + record.put("date", new Timestamp(comment.getAddedAt().getTime())); + record.put("comment", comment.getText()); + comments.add(record); + } + return comments; + } finally { + t.close(); + } + } + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + + this.request = pQueryRequest; + // Long pid = pQueryRequest.getLong("PID"); + Long tid = pQueryRequest.getLong("TID"); + String journalId = pQueryRequest.getString("JID"); + TaskDetail.LOG.debug("TID:" + tid); + TaskDetail.LOG.debug("journalId:" + journalId); + this.data = ProcessUtil.getInstance().transactionData(journalId, this.request); + + this.response = this.request.getResponse(); + this.response.put("data", this.data); + this.response.put("comments", this.manageTask(tid)); + + return pQueryRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/TaskHistory.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/TaskHistory.java new file mode 100644 index 0000000..c0555ba --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/TaskHistory.java @@ -0,0 +1,48 @@ +/* + * + */ +package com.fp.bpmlib.query.task; + + +import com.fp.bpmlib.ProcessUtil; +import com.fp.bpmlib.flow.Monitor; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + + +/** + * Class TaskHistory encargada de. + * + * @author gfiallos + */ +public class TaskHistory extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + QueryRequest request = pQueryRequest; + Long pid = pQueryRequest.getLong("PID"); + Long spid = pid; + try { + spid = pQueryRequest.getLong("SPID"); + } catch (Exception e) { + // + } + String name = pQueryRequest.getString("NAME"); + Response response = request.getResponse(); + Monitor monitor = new Monitor(pid); + response.put("DATA", ProcessUtil.getDoneTaskMetaData(monitor, name)); + return pQueryRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/TaskPending.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/TaskPending.java new file mode 100644 index 0000000..9d8b0d8 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/TaskPending.java @@ -0,0 +1,123 @@ +/* + * + */ +package com.fp.bpmlib.query.task; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.kie.api.task.model.Comment; +import org.kie.api.task.model.Task; +import org.kie.api.task.model.TaskData; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpmlib.ProcessUtil; +import com.fp.bpmlib.task.client.HumanTaskClient; +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.simple.dto.TaskInfo; + +// TODO: Auto-generated Javadoc +/** + * Class TaskPending encargada de. + * + * @author gfiallos + */ +public class TaskPending extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** El valor de data. */ + private List> data; + + /** El valor de htc. */ + private HumanTaskClient htc; + + // private Process process; + + /** El valor de request. */ + private QueryRequest request; + + // private static final Logger LOG = Logger.getLogger(TaskPending.class); + + /** + * Manage task. + * + * @param pWork the work + * @return list + * @throws Exception la exception + */ + protected List> manageTask(Long pWork) throws Exception { + Task t = this.htc.getTaskByWorkItemId(pWork); + TaskData td = t.getTaskData(); + TaskUtil tu = new TaskUtil(t.getId()); + TaskInfo ti = tu.getTaskInfo(); + ti.setCreated(new Timestamp(td.getCreatedOn().getTime())); + this.data = new ArrayList>(); + String user = ti.getUserId(); + try { + user = td.getActualOwner().getId(); + } catch (Exception e) { + user = ti.getUserId(); + } + this.data.add(ProcessUtil.getInstance().prepareRecord("userAsign", user, this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("name", GeneralDescriptions.getOfficername(user), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("groupAsign", ti.getGroupId(), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("taskStatus", + GeneralDescriptions.getLabel(td.getStatus().name(), this.request.getLanguage(), this.request.getChannelCode()), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("workItem", td.getWorkItemId(), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("taskId", t.getId(), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("create", new Timestamp(td.getCreatedOn().getTime()), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("realTime", + ti.getRealTimeString(FormatDates.getInstance().getDataBaseTimestamp().getTime()), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord("expectedTime", ti.getExpectedTimeString(), this.request)); + this.data.add(ProcessUtil.getInstance().prepareRecord( + "transaction", + ti.getModule() + "-" + ti.getTransaction() + "-" + ti.getVersion() + " " + + GeneralDescriptions.getTransactiondesc(ti.getModule(), ti.getTransaction(), ti.getVersion()), this.request)); + List lc = tu.getComments(); + List> comments = new ArrayList>(); + for (Comment comment : lc) { + Map record = new HashMap(); + record.put("user", comment.getAddedBy().getId()); + record.put("name", GeneralDescriptions.getUsername(comment.getAddedBy().getId())); + record.put("date", new Timestamp(comment.getAddedAt().getTime())); + record.put("comment", comment.getText()); + comments.add(record); + } + return comments; + } + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + this.htc = new HumanTaskClient(); + try { + this.request = pQueryRequest; + // Long pid = pQueryRequest.getLong("PID"); + // Long tid = pQueryRequest.getLong("TID"); + Long workId = pQueryRequest.getLong("WORKID"); + + Response response = this.request.getResponse(); + response.put("comments", this.manageTask(workId)); + response.put("data", this.data); + } finally { + this.htc.close(); + } + return pQueryRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/TaskServerStatus.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/TaskServerStatus.java new file mode 100644 index 0000000..32c38b6 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/TaskServerStatus.java @@ -0,0 +1,39 @@ +/* + * + */ +package com.fp.bpmlib.query.task; + +import com.fp.base.persistence.util.job.ServiceManager; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +// TODO: Auto-generated Javadoc +/** + * Class TaskServerStatus encargada de. + * + * @author gfiallos + */ +public class TaskServerStatus extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Process. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response rs = pQueryRequest.getResponse(); + String code = (String) pQueryRequest.get("code"); + ServiceManager sm = new ServiceManager(); + + rs.put("TSStatus", sm.isRunning(code)); + return pQueryRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/package-info.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/package-info.java new file mode 100644 index 0000000..3cbd19f --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/query/task/package-info.java @@ -0,0 +1,4 @@ +/** + * Provee las clases para el manejo de consultas de tareas + */ +package com.fp.bpmlib.query.task; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/report/.svn/entries b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/report/.svn/entries new file mode 100644 index 0000000..a60d4e7 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/report/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/report +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +package-info.java +file + + + + +2022-07-28T03:40:45.973817Z +a41ddd0d40a07994f283dab400afe224 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +75 + +ExportFlows.java +file + + + + +2022-07-28T03:40:45.974817Z +4f8be2da596853767f7875a87f31aa7f +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +6155 + +DownloadFileQuery.java +file + + + + +2022-07-28T03:40:45.974817Z +528d069175529fb37ae6e0881b8029de +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1716 + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/report/.svn/text-base/DownloadFileQuery.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/report/.svn/text-base/DownloadFileQuery.java.svn-base new file mode 100644 index 0000000..733c325 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/report/.svn/text-base/DownloadFileQuery.java.svn-base @@ -0,0 +1,64 @@ +/* + * + */ +package com.fp.bpmlib.report; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +// TODO: Auto-generated Javadoc +/** + * Clase que devuelve en bytes un archivo. + * + * @author gfiallos + */ +public abstract class DownloadFileQuery extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** El valor de query request. */ + protected QueryRequest queryRequest; + + /** + * Metodo que devuelve en forma de bytes un archivo. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + this.queryRequest = pQueryRequest; + Response response = pQueryRequest.getResponse(); + response.put("file", this.getContent()); + response.put("extension", this.getExtension()); + response.put("contentType", this.getContentType()); + return pQueryRequest; + } + + /** + * Obtiene el valor de content. + * + * @return Valor de content + * @throws Exception la exception + */ + public abstract byte[] getContent() throws Exception; + + /** + * Obtiene el valor de extension. + * + * @return Valor de extension + * @throws Exception la exception + */ + public abstract String getExtension() throws Exception; + + /** + * Obtiene el valor de content type. + * + * @return Valor de content type + * @throws Exception la exception + */ + public abstract String getContentType() throws Exception; +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/report/.svn/text-base/ExportFlows.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/report/.svn/text-base/ExportFlows.java.svn-base new file mode 100644 index 0000000..66efd67 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/report/.svn/text-base/ExportFlows.java.svn-base @@ -0,0 +1,147 @@ +/* + * + */ +package com.fp.bpmlib.report; + +import java.io.ByteArrayOutputStream; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import org.hibernate.SQLQuery; +import org.hibernate.ScrollableResults; +import org.hibernate.Session; + +import com.fp.common.properties.PropertiesHandler; +import com.fp.excel.XLSXUtil; +import com.fp.persistence.commondb.PersistenceHelper; + +// TODO: Auto-generated Javadoc +/** + * Class ExportFlows encargada de. + * + * @author gfiallos + */ +public class ExportFlows extends DownloadFileQuery { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** Constante SQL. */ + private static final String SQL = "SELECT l.solicitudenumber, ( SELECT z.description FROM " + + " tgenebranch z WHERE z.branchcode=l.branchcode " + + " AND z.companycode=l.companycode) branch, ( SELECT z.description FROM " + + " tgeneoffice z WHERE z.officecode=l.officecode AND z.branchcode=l.branchcode " + + " AND z.companycode=l.companycode) office, l.terminalcode originterminal,l.usercode orginuser, ( SELECT " + + " z.description FROM tgenemodule z WHERE " + " z.modulecode=l.transactionmodule ) module, ( SELECT z.transactionmodule||'-'||z.transactioncode||'-'||z.transactionversion||' '||z.name FROM " + + " tgenetransaction z WHERE z.transactionmodule=l.transactionmodule " + " AND z.transactioncode=l.transactioncode " + + " AND z.transactionversion=l.transactionversion) origen ,a.activityname,a.sequence,a.usercode," + + " a.groupcode,a.created,a.started,a.completed,a.expectedtime/1000,0 ,a.response , ( SELECT z.name " + + " FROM tgenetransaction z WHERE z.transactionmodule=a.module " + + " AND z.transactioncode=a.transaction AND z.transactionversion=a.version) tarea FROM " + + " tbpmprocessinstance i LEFT OUTER JOIN tbpmactivities a ON a.journalid=i.journalid , tgenetransactionlog l " + + " WHERE l.journalid=i.journalid AND i.finalized='Y' " + " and i.creationdate between :init and :end"; + + /** Constante ORDER. */ + private static final String ORDER = " ORDER BY l.aditionaldata, a.created"; + + /** + * Obtiene el valor de content. + * + * @return Valor de content + * @throws Exception la exception + */ + @Override + public byte[] getContent() throws Exception { + //Session s = PersistenceHelper.getSession(); + //SQLQuery sql = s.createSQLQuery(ExportFlows.SQL + ExportFlows.ORDER); + //sql.setDate("init", this.queryRequest.getDate("creationdate")); + //sql.setDate("end", this.queryRequest.getDate("enddate")); + PropertiesHandler ph = new PropertiesHandler("bpmmessages"); + EntityManager em = PersistenceHelper.getEntityManager(); + Query qry = em.createNativeQuery(ExportFlows.SQL + ExportFlows.ORDER); + qry.setParameter("init", this.queryRequest.getDate("creationdate")); + qry.setParameter("end", this.queryRequest.getDate("enddate")); + + @SuppressWarnings("unchecked") + List results = qry.getResultList(); + + XLSXUtil xlsx = new XLSXUtil(); + + + + //ScrollableResults cursor = sql.scroll(); + try { + List label = new ArrayList(); + label.add(ph.getStringValue("lbl_description")); + label.add(ph.getStringValue("lbl_branch")); + label.add(ph.getStringValue("lbl_office")); + label.add(ph.getStringValue("lbl_terminal")); + label.add(ph.getStringValue("lbl_user")); + label.add(ph.getStringValue("lbl_module")); + label.add(ph.getStringValue("lbl_transflow")); + label.add(ph.getStringValue("lbl_activityname")); + label.add(ph.getStringValue("lbl_sequence")); + label.add(ph.getStringValue("lbl_userasigned")); + label.add(ph.getStringValue("lbl_groupAsign")); + label.add(ph.getStringValue("lbl_created")); + label.add(ph.getStringValue("lbl_started")); + label.add(ph.getStringValue("lbl_completed")); + label.add(ph.getStringValue("lbl_expectedtime")); + label.add(ph.getStringValue("lbl_duracion")); + label.add(ph.getStringValue("lbl_response")); + label.add(ph.getStringValue("lbl_task")); + xlsx.addRecord(label.toArray(), "H"); + for(Object object: results){ + Object[] obj = (Object[])object; + if(obj[12] instanceof Date && obj[13] instanceof Date){ + Calendar c1 =Calendar.getInstance(); + c1.setTime((Date)obj[12]); + Calendar c2 =Calendar.getInstance(); + c2.setTime((Date)obj[13]); + obj[15] = (c2.getTimeInMillis() - c1.getTimeInMillis())/1000; + } + xlsx.addRecord(obj,"B"); + } +// while (cursor.next()) { +// xlsx.addRecord(cursor.get()); +// } + } finally { + //cursor.close(); + } + ByteArrayOutputStream out = new ByteArrayOutputStream(); + try { + xlsx.save(out); + } finally { + out.close(); + } + return out.toByteArray(); + } + + /** + * Obtiene el valor de extension. + * + * @return Valor de extension + * @throws Exception la exception + */ + @Override + public String getExtension() throws Exception { + return "xlsx"; + } + + /** + * Obtiene el valor de content type. + * + * @return Valor de content type + * @throws Exception la exception + */ + @Override + public String getContentType() throws Exception { + return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/report/.svn/text-base/package-info.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/report/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..5510b96 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/report/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,4 @@ +/** + * Provee las clases para Reportes + */ +package com.fp.bpmlib.report; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/report/DownloadFileQuery.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/report/DownloadFileQuery.java new file mode 100644 index 0000000..733c325 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/report/DownloadFileQuery.java @@ -0,0 +1,64 @@ +/* + * + */ +package com.fp.bpmlib.report; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +// TODO: Auto-generated Javadoc +/** + * Clase que devuelve en bytes un archivo. + * + * @author gfiallos + */ +public abstract class DownloadFileQuery extends QueryRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** El valor de query request. */ + protected QueryRequest queryRequest; + + /** + * Metodo que devuelve en forma de bytes un archivo. + * + * @param pQueryRequest the query request + * @return query request + * @throws Exception la exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + this.queryRequest = pQueryRequest; + Response response = pQueryRequest.getResponse(); + response.put("file", this.getContent()); + response.put("extension", this.getExtension()); + response.put("contentType", this.getContentType()); + return pQueryRequest; + } + + /** + * Obtiene el valor de content. + * + * @return Valor de content + * @throws Exception la exception + */ + public abstract byte[] getContent() throws Exception; + + /** + * Obtiene el valor de extension. + * + * @return Valor de extension + * @throws Exception la exception + */ + public abstract String getExtension() throws Exception; + + /** + * Obtiene el valor de content type. + * + * @return Valor de content type + * @throws Exception la exception + */ + public abstract String getContentType() throws Exception; +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/report/ExportFlows.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/report/ExportFlows.java new file mode 100644 index 0000000..66efd67 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/report/ExportFlows.java @@ -0,0 +1,147 @@ +/* + * + */ +package com.fp.bpmlib.report; + +import java.io.ByteArrayOutputStream; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import org.hibernate.SQLQuery; +import org.hibernate.ScrollableResults; +import org.hibernate.Session; + +import com.fp.common.properties.PropertiesHandler; +import com.fp.excel.XLSXUtil; +import com.fp.persistence.commondb.PersistenceHelper; + +// TODO: Auto-generated Javadoc +/** + * Class ExportFlows encargada de. + * + * @author gfiallos + */ +public class ExportFlows extends DownloadFileQuery { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** Constante SQL. */ + private static final String SQL = "SELECT l.solicitudenumber, ( SELECT z.description FROM " + + " tgenebranch z WHERE z.branchcode=l.branchcode " + + " AND z.companycode=l.companycode) branch, ( SELECT z.description FROM " + + " tgeneoffice z WHERE z.officecode=l.officecode AND z.branchcode=l.branchcode " + + " AND z.companycode=l.companycode) office, l.terminalcode originterminal,l.usercode orginuser, ( SELECT " + + " z.description FROM tgenemodule z WHERE " + " z.modulecode=l.transactionmodule ) module, ( SELECT z.transactionmodule||'-'||z.transactioncode||'-'||z.transactionversion||' '||z.name FROM " + + " tgenetransaction z WHERE z.transactionmodule=l.transactionmodule " + " AND z.transactioncode=l.transactioncode " + + " AND z.transactionversion=l.transactionversion) origen ,a.activityname,a.sequence,a.usercode," + + " a.groupcode,a.created,a.started,a.completed,a.expectedtime/1000,0 ,a.response , ( SELECT z.name " + + " FROM tgenetransaction z WHERE z.transactionmodule=a.module " + + " AND z.transactioncode=a.transaction AND z.transactionversion=a.version) tarea FROM " + + " tbpmprocessinstance i LEFT OUTER JOIN tbpmactivities a ON a.journalid=i.journalid , tgenetransactionlog l " + + " WHERE l.journalid=i.journalid AND i.finalized='Y' " + " and i.creationdate between :init and :end"; + + /** Constante ORDER. */ + private static final String ORDER = " ORDER BY l.aditionaldata, a.created"; + + /** + * Obtiene el valor de content. + * + * @return Valor de content + * @throws Exception la exception + */ + @Override + public byte[] getContent() throws Exception { + //Session s = PersistenceHelper.getSession(); + //SQLQuery sql = s.createSQLQuery(ExportFlows.SQL + ExportFlows.ORDER); + //sql.setDate("init", this.queryRequest.getDate("creationdate")); + //sql.setDate("end", this.queryRequest.getDate("enddate")); + PropertiesHandler ph = new PropertiesHandler("bpmmessages"); + EntityManager em = PersistenceHelper.getEntityManager(); + Query qry = em.createNativeQuery(ExportFlows.SQL + ExportFlows.ORDER); + qry.setParameter("init", this.queryRequest.getDate("creationdate")); + qry.setParameter("end", this.queryRequest.getDate("enddate")); + + @SuppressWarnings("unchecked") + List results = qry.getResultList(); + + XLSXUtil xlsx = new XLSXUtil(); + + + + //ScrollableResults cursor = sql.scroll(); + try { + List label = new ArrayList(); + label.add(ph.getStringValue("lbl_description")); + label.add(ph.getStringValue("lbl_branch")); + label.add(ph.getStringValue("lbl_office")); + label.add(ph.getStringValue("lbl_terminal")); + label.add(ph.getStringValue("lbl_user")); + label.add(ph.getStringValue("lbl_module")); + label.add(ph.getStringValue("lbl_transflow")); + label.add(ph.getStringValue("lbl_activityname")); + label.add(ph.getStringValue("lbl_sequence")); + label.add(ph.getStringValue("lbl_userasigned")); + label.add(ph.getStringValue("lbl_groupAsign")); + label.add(ph.getStringValue("lbl_created")); + label.add(ph.getStringValue("lbl_started")); + label.add(ph.getStringValue("lbl_completed")); + label.add(ph.getStringValue("lbl_expectedtime")); + label.add(ph.getStringValue("lbl_duracion")); + label.add(ph.getStringValue("lbl_response")); + label.add(ph.getStringValue("lbl_task")); + xlsx.addRecord(label.toArray(), "H"); + for(Object object: results){ + Object[] obj = (Object[])object; + if(obj[12] instanceof Date && obj[13] instanceof Date){ + Calendar c1 =Calendar.getInstance(); + c1.setTime((Date)obj[12]); + Calendar c2 =Calendar.getInstance(); + c2.setTime((Date)obj[13]); + obj[15] = (c2.getTimeInMillis() - c1.getTimeInMillis())/1000; + } + xlsx.addRecord(obj,"B"); + } +// while (cursor.next()) { +// xlsx.addRecord(cursor.get()); +// } + } finally { + //cursor.close(); + } + ByteArrayOutputStream out = new ByteArrayOutputStream(); + try { + xlsx.save(out); + } finally { + out.close(); + } + return out.toByteArray(); + } + + /** + * Obtiene el valor de extension. + * + * @return Valor de extension + * @throws Exception la exception + */ + @Override + public String getExtension() throws Exception { + return "xlsx"; + } + + /** + * Obtiene el valor de content type. + * + * @return Valor de content type + * @throws Exception la exception + */ + @Override + public String getContentType() throws Exception { + return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/report/package-info.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/report/package-info.java new file mode 100644 index 0000000..5510b96 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/report/package-info.java @@ -0,0 +1,4 @@ +/** + * Provee las clases para Reportes + */ +package com.fp.bpmlib.report; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/.svn/entries b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/.svn/entries new file mode 100644 index 0000000..6fbb6c7 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/.svn/entries @@ -0,0 +1,170 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TaskUser.java +file + + + + +2022-07-28T03:40:45.828816Z +91728980ce91bc3c39ee57b19af7f251 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +4982 + +package-info.java +file + + + + +2022-07-28T03:40:45.828816Z +3d83b9c2b8b78a904ae6284d5c67ad74 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +114 + +MaiaWorkItemHandler.java +file + + + + +2022-07-28T03:40:45.828816Z +2570af9a004c38efe7869e3d802b8691 +2014-12-16T10:20:52.870795Z +3535 +gbenavides + + + + + + + + + + + + + + + + + + + + + +4824 + +TaskCleaner.java +file + + + + +2022-07-28T03:40:45.829816Z +e18a18c227a633e62b1cb5708ae57d1f +2014-10-29T05:04:38.445380Z +2082 +jvaca + + + + + + + + + + + + + + + + + + + + + +3293 + +util +dir + +client +dir + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/.svn/text-base/MaiaWorkItemHandler.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/.svn/text-base/MaiaWorkItemHandler.java.svn-base new file mode 100644 index 0000000..5200f09 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/.svn/text-base/MaiaWorkItemHandler.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.bpmlib.task; + +import java.util.Date; +import java.util.Map; + +import javax.naming.InitialContext; + +import org.jbpm.services.task.exception.PermissionDeniedException; +import org.jbpm.services.task.utils.OnErrorAction; +import org.jbpm.services.task.wih.AbstractHTWorkItemHandler; +import org.kie.api.runtime.KieSession; +import org.kie.api.runtime.manager.RuntimeEngine; +import org.kie.api.runtime.manager.RuntimeManager; +import org.kie.api.runtime.process.WorkItem; +import org.kie.api.runtime.process.WorkItemManager; +import org.kie.api.task.model.Task; +import org.kie.internal.runtime.manager.context.ProcessInstanceIdContext; +import org.kie.internal.task.api.InternalTaskService; +import org.kie.internal.task.api.model.ContentData; +import org.kie.internal.task.exception.TaskException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fp.bpmlib.ejb.local.JbpmBeanLocal; +import com.fp.bpmlib.query.monitor.FlowActivitySave; +import com.fp.simple.dto.TaskInfo; + +public class MaiaWorkItemHandler extends AbstractHTWorkItemHandler { + + private static final Logger logger = LoggerFactory.getLogger(MaiaWorkItemHandler.class); + private RuntimeManager runtimeManager; + + public RuntimeManager getRuntimeManager() { + return runtimeManager; + } + + public void setRuntimeManager(RuntimeManager runtimeManager) { + this.runtimeManager = runtimeManager; + } + + public MaiaWorkItemHandler() { + } + + @SuppressWarnings("unchecked") + private void fillRuntimeManager(WorkItem workItem) { + try { + JbpmBeanLocal local = (JbpmBeanLocal) new InitialContext().lookup("java:global/maiaear-2.1/bpmlib/jbpmbean"); + runtimeManager = local.getRuntimeManager(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @Override + public void executeWorkItem(WorkItem workItem, WorkItemManager manager) { + // JVC obtiene runtimemanager por base de conocimiento y adiciona fecha de vencimiento de la tarea. + this.fillRuntimeManager(workItem); + + RuntimeEngine runtime = runtimeManager.getRuntimeEngine(ProcessInstanceIdContext.get(workItem.getProcessInstanceId())); + KieSession ksessionById = runtime.getKieSession(); + + Task task = this.createTaskBasedOnWorkItemParams(ksessionById, workItem); + + ContentData content = this.createTaskContentBasedOnWorkItemParams(ksessionById, workItem); + try { + long taskId = ((InternalTaskService) runtime.getTaskService()).addTask(task, content); + if (this.isAutoClaim(workItem, task)) { + runtime.getTaskService().claim(taskId, (String) workItem.getParameter("SwimlaneActorId")); + } + // JVC crea un registro en TbpmTareas. + this.createTbpmActivities(taskId, workItem, task); + + } catch (Exception e) { + if (action.equals(OnErrorAction.ABORT)) { + manager.abortWorkItem(workItem.getId()); + } else if (action.equals(OnErrorAction.RETHROW)) { + if (e instanceof RuntimeException) { + throw (RuntimeException) e; + } else { + throw new RuntimeException(e); + } + } else if (action.equals(OnErrorAction.LOG)) { + StringBuilder logMsg = new StringBuilder(); + logMsg.append(new Date()).append(": Error when creating task on task server for work item id ").append(workItem.getId()); + logMsg.append(". Error reported by task server: ").append(e.getMessage()); + logger.error(logMsg.toString(), e); + // rethrow to cancel processing if the exception is not recoverable + if (!(e instanceof TaskException) || ((e instanceof TaskException) && !((TaskException) e).isRecoverable())) { + if (e instanceof RuntimeException) { + throw (RuntimeException) e; + } else { + throw new RuntimeException(e); + } + } + } + } + } + + + @SuppressWarnings("unchecked") + private void createTbpmActivities(long idtarea, WorkItem workItem, Task task) throws Exception { + Map mparam = (Map) workItem.getParameters().get("maia"); + TaskInfo taskInfo = (TaskInfo)workItem.getParameters().get("taskMetaData"); +// String usuario = task.getTaskData().getActualOwner() == null ? null : task.getTaskData().getActualOwner().getId();//usuario responsable + // crea tbpmtareas con los datos de la tarea. + FlowActivitySave.crearActivity(mparam, taskInfo,idtarea,task.getTaskData().getCreatedOn()); + // + } + + @Override + public void abortWorkItem(WorkItem workItem, WorkItemManager manager) { + RuntimeEngine runtime = runtimeManager.getRuntimeEngine(ProcessInstanceIdContext.get(workItem.getProcessInstanceId())); + Task task = runtime.getTaskService().getTaskByWorkItemId(workItem.getId()); + if (task != null) { + try { + runtime.getTaskService().exit(task.getId(), "Administrator"); + } catch (PermissionDeniedException e) { + logger.info(e.getMessage()); + } + } + + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/.svn/text-base/TaskCleaner.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/.svn/text-base/TaskCleaner.java.svn-base new file mode 100644 index 0000000..020c6ff --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/.svn/text-base/TaskCleaner.java.svn-base @@ -0,0 +1,97 @@ +/* + * + */ +package com.fp.bpmlib.task; + +import java.math.BigDecimal; +import java.util.List; + +import javax.naming.InitialContext; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.bpmlib.ejb.local.JbpmBeanLocal; +import com.fp.common.logger.APPLogger; + +// TODO: Auto-generated Javadoc +/** + * Class TaskCleaner encargada de. + * + * @author gfiallos + */ +public class TaskCleaner { + + /** El valor de em. */ + private EntityManager em; + + /** Constante TID. */ + private static final String TID = "tid"; + + /** + * Crea una nueva instancia de task cleaner. + * + * @throws Exception la exception + */ + public TaskCleaner() throws Exception { + JbpmBeanLocal local = (JbpmBeanLocal) new InitialContext().lookup("java:global/maiaear-2.1/bpmlib/jbpmbean"); + this.em = local.getEmf().createEntityManager(); + this.em.joinTransaction(); + + } + + /** + * Delete task. + * + * @param pTask the task + * @throws Exception la exception + */ + private void deleteTask(long pTask) throws Exception { + Query q = this.em.createNativeQuery("delete from PeopleAssignments_PotOwners where task_id= :tid"); + q.setParameter(TaskCleaner.TID, pTask); + q.executeUpdate(); + q = this.em.createNativeQuery("delete from I18NText where Task_Names_Id= :tid or Task_Subjects_Id= :tid or Task_Descriptions_Id= :tid "); + q.setParameter(TaskCleaner.TID, pTask); + q.executeUpdate(); + q = this.em.createNativeQuery("delete from task_comment where TaskData_Comments_Id= :tid"); + q.setParameter(TaskCleaner.TID, pTask); + q.executeUpdate(); + q = this.em.createNativeQuery("delete from PeopleAssignments_BAs where task_id= :tid"); + q.setParameter(TaskCleaner.TID, pTask); + q.executeUpdate(); + q = this.em.createNativeQuery("delete from Content where id in (select DOCUMENTCONTENTID from Task where id=:tid)"); + q.setParameter(TaskCleaner.TID, pTask); + q.executeUpdate(); + q = this.em.createNativeQuery("delete from Content where id in (select outputcontentid from Task where id=:tid)"); + q.setParameter(TaskCleaner.TID, pTask); + q.executeUpdate(); + q = this.em.createNativeQuery("delete from Task where id = :tid "); + q.setParameter(TaskCleaner.TID, pTask); + q.executeUpdate(); + } + + /** + * Delete tasks. + * + * @throws Exception la exception + */ + public void deleteTasks() throws Exception { + try { + Query q = this.em + .createNativeQuery("select id from Task t where not exists( select 1 from processinstanceinfo p where p.instanceid = t.processinstanceid)"); + @SuppressWarnings("unchecked") + List l = q.getResultList(); + for (BigDecimal id : l) { + Long idtarea = Long.valueOf(id.toString()); + this.deleteTask(idtarea); + } + } catch (Exception e) { + APPLogger.getLogger().error(e); + } finally { + if (em.isOpen()) { + // em.close(); + // TODO + } + } + + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/.svn/text-base/TaskUser.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/.svn/text-base/TaskUser.java.svn-base new file mode 100644 index 0000000..f431ab4 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/.svn/text-base/TaskUser.java.svn-base @@ -0,0 +1,145 @@ +/* + * + */ +package com.fp.bpmlib.task; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.jbpm.services.task.impl.model.UserImpl; +import org.kie.api.task.model.Group; +import org.kie.api.task.model.OrganizationalEntity; +import org.kie.api.task.model.User; +import org.kie.internal.task.api.UserInfo; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pbpm.gene.TbpmGroupsUsers; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +// TODO: Auto-generated Javadoc +/** + * Class TaskUser encargada de. + * + * @author gfiallos + */ +public class TaskUser implements UserInfo { + + /** + * Entrega el nombre de un uaurio. + * + * @param entity OBjeto que contiene datos de un usuario asociado a la ejecucion de una actividad. + * @return String + */ + @Override + public String getDisplayName(OrganizationalEntity entity) { + try { + this.prepareSession(); + TsafeUserDetail tsud = TsafeUserDetail.find(PersistenceHelper.getEntityManager(), entity.getId()); + TcustPersonDetailKey key = new TcustPersonDetailKey(tsud.getPk().getPersoncode(), FormatDates.getDefaultExpiryTimestamp()); + TcustPersonDetail pd = TcustPersonDetail.find(PersistenceHelper.getEntityManager(), key); + return pd.getName(); + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + PersistenceHelper.closeSession(); + } + + } + + /** + * Prepare session. + */ + private void prepareSession() { + SessionData s = new SessionData(); + s.setCompany(1); + ThreadFacade.setSaveRequest(s); + PersistenceManager persistenceManager = PersistenceManager.getInstanceTest(); + PersistenceHelper.setEntityManager(persistenceManager.createEntityManagerLocal()); + } + + /** + * Obtiene el valor de email for entity. + * + * @param entity the entity + * @return Valor de email for entity + */ + @Override + public String getEmailForEntity(OrganizationalEntity entity) { + try { + this.prepareSession(); + TsafeUserDetail tsud = TsafeUserDetail.find(PersistenceHelper.getEntityManager(), entity.getId()); + TcustPersonDetailKey key = new TcustPersonDetailKey(tsud.getPk().getPersoncode(), FormatDates.getDefaultExpiryTimestamp()); + TcustPersonDetail pd = TcustPersonDetail.find(PersistenceHelper.getEntityManager(), key); + + return pd.getLanguagecode(); + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + PersistenceHelper.closeSession(); + } + } + + /** + * Entrega el lenguaje preferido de un usuario. + * + * @param entity OBjeto que contiene datos de un usuario asociado a la ejecucion de una actividad. + * @return String + */ + @Override + public String getLanguageForEntity(OrganizationalEntity entity) { + + try { + this.prepareSession(); + TsafeUserDetail tsud = TsafeUserDetail.find(PersistenceHelper.getEntityManager(), entity.getId()); + return TcustPersonAddress.getEmail(PersistenceHelper.getEntityManager(), tsud.getPk().getPersoncode()); + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + PersistenceHelper.closeSession(); + } + } + + /** + * Obtiene el valor de members for group. + * + * @param group the group + * @return Valor de members for group + */ + @Override + public Iterator getMembersForGroup(Group group) { + List l = new ArrayList(); + try { + this.prepareSession(); + List ldata = TbpmGroupsUsers.find(PersistenceHelper.getEntityManager(), group.getId()); + for (TbpmGroupsUsers obj : ldata) { + User user = new UserImpl(obj.getPk().getUsercode()); + l.add(user); + } + } catch (Exception e) { + // TODO: handle exception + } finally { + PersistenceHelper.closeSession(); + } + return l.iterator(); + } + + /** + * Checks for email. + * + * @param group the group + * @return true, si es satisfactorio + */ + @Override + public boolean hasEmail(Group group) { + return false; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/.svn/text-base/package-info.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..7f7ce81 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,4 @@ +/** + * Provee los componentes necesarios para el manejo del Servidor de Tareas. + */ +package com.fp.bpmlib.task; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/MaiaWorkItemHandler.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/MaiaWorkItemHandler.java new file mode 100644 index 0000000..5200f09 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/MaiaWorkItemHandler.java @@ -0,0 +1,124 @@ +package com.fp.bpmlib.task; + +import java.util.Date; +import java.util.Map; + +import javax.naming.InitialContext; + +import org.jbpm.services.task.exception.PermissionDeniedException; +import org.jbpm.services.task.utils.OnErrorAction; +import org.jbpm.services.task.wih.AbstractHTWorkItemHandler; +import org.kie.api.runtime.KieSession; +import org.kie.api.runtime.manager.RuntimeEngine; +import org.kie.api.runtime.manager.RuntimeManager; +import org.kie.api.runtime.process.WorkItem; +import org.kie.api.runtime.process.WorkItemManager; +import org.kie.api.task.model.Task; +import org.kie.internal.runtime.manager.context.ProcessInstanceIdContext; +import org.kie.internal.task.api.InternalTaskService; +import org.kie.internal.task.api.model.ContentData; +import org.kie.internal.task.exception.TaskException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fp.bpmlib.ejb.local.JbpmBeanLocal; +import com.fp.bpmlib.query.monitor.FlowActivitySave; +import com.fp.simple.dto.TaskInfo; + +public class MaiaWorkItemHandler extends AbstractHTWorkItemHandler { + + private static final Logger logger = LoggerFactory.getLogger(MaiaWorkItemHandler.class); + private RuntimeManager runtimeManager; + + public RuntimeManager getRuntimeManager() { + return runtimeManager; + } + + public void setRuntimeManager(RuntimeManager runtimeManager) { + this.runtimeManager = runtimeManager; + } + + public MaiaWorkItemHandler() { + } + + @SuppressWarnings("unchecked") + private void fillRuntimeManager(WorkItem workItem) { + try { + JbpmBeanLocal local = (JbpmBeanLocal) new InitialContext().lookup("java:global/maiaear-2.1/bpmlib/jbpmbean"); + runtimeManager = local.getRuntimeManager(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @Override + public void executeWorkItem(WorkItem workItem, WorkItemManager manager) { + // JVC obtiene runtimemanager por base de conocimiento y adiciona fecha de vencimiento de la tarea. + this.fillRuntimeManager(workItem); + + RuntimeEngine runtime = runtimeManager.getRuntimeEngine(ProcessInstanceIdContext.get(workItem.getProcessInstanceId())); + KieSession ksessionById = runtime.getKieSession(); + + Task task = this.createTaskBasedOnWorkItemParams(ksessionById, workItem); + + ContentData content = this.createTaskContentBasedOnWorkItemParams(ksessionById, workItem); + try { + long taskId = ((InternalTaskService) runtime.getTaskService()).addTask(task, content); + if (this.isAutoClaim(workItem, task)) { + runtime.getTaskService().claim(taskId, (String) workItem.getParameter("SwimlaneActorId")); + } + // JVC crea un registro en TbpmTareas. + this.createTbpmActivities(taskId, workItem, task); + + } catch (Exception e) { + if (action.equals(OnErrorAction.ABORT)) { + manager.abortWorkItem(workItem.getId()); + } else if (action.equals(OnErrorAction.RETHROW)) { + if (e instanceof RuntimeException) { + throw (RuntimeException) e; + } else { + throw new RuntimeException(e); + } + } else if (action.equals(OnErrorAction.LOG)) { + StringBuilder logMsg = new StringBuilder(); + logMsg.append(new Date()).append(": Error when creating task on task server for work item id ").append(workItem.getId()); + logMsg.append(". Error reported by task server: ").append(e.getMessage()); + logger.error(logMsg.toString(), e); + // rethrow to cancel processing if the exception is not recoverable + if (!(e instanceof TaskException) || ((e instanceof TaskException) && !((TaskException) e).isRecoverable())) { + if (e instanceof RuntimeException) { + throw (RuntimeException) e; + } else { + throw new RuntimeException(e); + } + } + } + } + } + + + @SuppressWarnings("unchecked") + private void createTbpmActivities(long idtarea, WorkItem workItem, Task task) throws Exception { + Map mparam = (Map) workItem.getParameters().get("maia"); + TaskInfo taskInfo = (TaskInfo)workItem.getParameters().get("taskMetaData"); +// String usuario = task.getTaskData().getActualOwner() == null ? null : task.getTaskData().getActualOwner().getId();//usuario responsable + // crea tbpmtareas con los datos de la tarea. + FlowActivitySave.crearActivity(mparam, taskInfo,idtarea,task.getTaskData().getCreatedOn()); + // + } + + @Override + public void abortWorkItem(WorkItem workItem, WorkItemManager manager) { + RuntimeEngine runtime = runtimeManager.getRuntimeEngine(ProcessInstanceIdContext.get(workItem.getProcessInstanceId())); + Task task = runtime.getTaskService().getTaskByWorkItemId(workItem.getId()); + if (task != null) { + try { + runtime.getTaskService().exit(task.getId(), "Administrator"); + } catch (PermissionDeniedException e) { + logger.info(e.getMessage()); + } + } + + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/TaskCleaner.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/TaskCleaner.java new file mode 100644 index 0000000..020c6ff --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/TaskCleaner.java @@ -0,0 +1,97 @@ +/* + * + */ +package com.fp.bpmlib.task; + +import java.math.BigDecimal; +import java.util.List; + +import javax.naming.InitialContext; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.bpmlib.ejb.local.JbpmBeanLocal; +import com.fp.common.logger.APPLogger; + +// TODO: Auto-generated Javadoc +/** + * Class TaskCleaner encargada de. + * + * @author gfiallos + */ +public class TaskCleaner { + + /** El valor de em. */ + private EntityManager em; + + /** Constante TID. */ + private static final String TID = "tid"; + + /** + * Crea una nueva instancia de task cleaner. + * + * @throws Exception la exception + */ + public TaskCleaner() throws Exception { + JbpmBeanLocal local = (JbpmBeanLocal) new InitialContext().lookup("java:global/maiaear-2.1/bpmlib/jbpmbean"); + this.em = local.getEmf().createEntityManager(); + this.em.joinTransaction(); + + } + + /** + * Delete task. + * + * @param pTask the task + * @throws Exception la exception + */ + private void deleteTask(long pTask) throws Exception { + Query q = this.em.createNativeQuery("delete from PeopleAssignments_PotOwners where task_id= :tid"); + q.setParameter(TaskCleaner.TID, pTask); + q.executeUpdate(); + q = this.em.createNativeQuery("delete from I18NText where Task_Names_Id= :tid or Task_Subjects_Id= :tid or Task_Descriptions_Id= :tid "); + q.setParameter(TaskCleaner.TID, pTask); + q.executeUpdate(); + q = this.em.createNativeQuery("delete from task_comment where TaskData_Comments_Id= :tid"); + q.setParameter(TaskCleaner.TID, pTask); + q.executeUpdate(); + q = this.em.createNativeQuery("delete from PeopleAssignments_BAs where task_id= :tid"); + q.setParameter(TaskCleaner.TID, pTask); + q.executeUpdate(); + q = this.em.createNativeQuery("delete from Content where id in (select DOCUMENTCONTENTID from Task where id=:tid)"); + q.setParameter(TaskCleaner.TID, pTask); + q.executeUpdate(); + q = this.em.createNativeQuery("delete from Content where id in (select outputcontentid from Task where id=:tid)"); + q.setParameter(TaskCleaner.TID, pTask); + q.executeUpdate(); + q = this.em.createNativeQuery("delete from Task where id = :tid "); + q.setParameter(TaskCleaner.TID, pTask); + q.executeUpdate(); + } + + /** + * Delete tasks. + * + * @throws Exception la exception + */ + public void deleteTasks() throws Exception { + try { + Query q = this.em + .createNativeQuery("select id from Task t where not exists( select 1 from processinstanceinfo p where p.instanceid = t.processinstanceid)"); + @SuppressWarnings("unchecked") + List l = q.getResultList(); + for (BigDecimal id : l) { + Long idtarea = Long.valueOf(id.toString()); + this.deleteTask(idtarea); + } + } catch (Exception e) { + APPLogger.getLogger().error(e); + } finally { + if (em.isOpen()) { + // em.close(); + // TODO + } + } + + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/TaskUser.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/TaskUser.java new file mode 100644 index 0000000..f431ab4 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/TaskUser.java @@ -0,0 +1,145 @@ +/* + * + */ +package com.fp.bpmlib.task; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.jbpm.services.task.impl.model.UserImpl; +import org.kie.api.task.model.Group; +import org.kie.api.task.model.OrganizationalEntity; +import org.kie.api.task.model.User; +import org.kie.internal.task.api.UserInfo; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pbpm.gene.TbpmGroupsUsers; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +// TODO: Auto-generated Javadoc +/** + * Class TaskUser encargada de. + * + * @author gfiallos + */ +public class TaskUser implements UserInfo { + + /** + * Entrega el nombre de un uaurio. + * + * @param entity OBjeto que contiene datos de un usuario asociado a la ejecucion de una actividad. + * @return String + */ + @Override + public String getDisplayName(OrganizationalEntity entity) { + try { + this.prepareSession(); + TsafeUserDetail tsud = TsafeUserDetail.find(PersistenceHelper.getEntityManager(), entity.getId()); + TcustPersonDetailKey key = new TcustPersonDetailKey(tsud.getPk().getPersoncode(), FormatDates.getDefaultExpiryTimestamp()); + TcustPersonDetail pd = TcustPersonDetail.find(PersistenceHelper.getEntityManager(), key); + return pd.getName(); + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + PersistenceHelper.closeSession(); + } + + } + + /** + * Prepare session. + */ + private void prepareSession() { + SessionData s = new SessionData(); + s.setCompany(1); + ThreadFacade.setSaveRequest(s); + PersistenceManager persistenceManager = PersistenceManager.getInstanceTest(); + PersistenceHelper.setEntityManager(persistenceManager.createEntityManagerLocal()); + } + + /** + * Obtiene el valor de email for entity. + * + * @param entity the entity + * @return Valor de email for entity + */ + @Override + public String getEmailForEntity(OrganizationalEntity entity) { + try { + this.prepareSession(); + TsafeUserDetail tsud = TsafeUserDetail.find(PersistenceHelper.getEntityManager(), entity.getId()); + TcustPersonDetailKey key = new TcustPersonDetailKey(tsud.getPk().getPersoncode(), FormatDates.getDefaultExpiryTimestamp()); + TcustPersonDetail pd = TcustPersonDetail.find(PersistenceHelper.getEntityManager(), key); + + return pd.getLanguagecode(); + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + PersistenceHelper.closeSession(); + } + } + + /** + * Entrega el lenguaje preferido de un usuario. + * + * @param entity OBjeto que contiene datos de un usuario asociado a la ejecucion de una actividad. + * @return String + */ + @Override + public String getLanguageForEntity(OrganizationalEntity entity) { + + try { + this.prepareSession(); + TsafeUserDetail tsud = TsafeUserDetail.find(PersistenceHelper.getEntityManager(), entity.getId()); + return TcustPersonAddress.getEmail(PersistenceHelper.getEntityManager(), tsud.getPk().getPersoncode()); + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + PersistenceHelper.closeSession(); + } + } + + /** + * Obtiene el valor de members for group. + * + * @param group the group + * @return Valor de members for group + */ + @Override + public Iterator getMembersForGroup(Group group) { + List l = new ArrayList(); + try { + this.prepareSession(); + List ldata = TbpmGroupsUsers.find(PersistenceHelper.getEntityManager(), group.getId()); + for (TbpmGroupsUsers obj : ldata) { + User user = new UserImpl(obj.getPk().getUsercode()); + l.add(user); + } + } catch (Exception e) { + // TODO: handle exception + } finally { + PersistenceHelper.closeSession(); + } + return l.iterator(); + } + + /** + * Checks for email. + * + * @param group the group + * @return true, si es satisfactorio + */ + @Override + public boolean hasEmail(Group group) { + return false; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/.svn/entries b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/.svn/entries new file mode 100644 index 0000000..6a6be6a --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TaskUtil.java +file + + + + +2022-07-28T03:40:45.820816Z +cc600c82329240b3d3ddaa89255450fc +2014-11-28T11:45:00.880140Z +3185 +cpiedra + + + + + + + + + + + + + + + + + + + + + +14561 + +package-info.java +file + + + + +2022-07-28T03:40:45.820816Z +74c051d8efacfd0d9115c31e8b53b391 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +111 + +HumanTaskClient.java +file + + + + +2022-07-28T03:40:45.821816Z +e089d52d253c3dc0bf64ebbf50c31d3d +2014-12-17T13:06:41.233359Z +3580 +gbenavides + + + + + + + + + + + + + + + + + + + + + +20390 + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/.svn/text-base/HumanTaskClient.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/.svn/text-base/HumanTaskClient.java.svn-base new file mode 100644 index 0000000..11246d3 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/.svn/text-base/HumanTaskClient.java.svn-base @@ -0,0 +1,580 @@ +/* + * + */ +package com.fp.bpmlib.task.client; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.naming.InitialContext; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import org.jbpm.process.instance.event.listeners.TriggerRulesEventListener; +import org.jbpm.services.task.impl.model.CommentImpl; +import org.jbpm.services.task.impl.model.UserImpl; +import org.jbpm.services.task.lifecycle.listeners.BAMTaskEventListener; +import org.jbpm.services.task.lifecycle.listeners.TaskLifeCycleEventListener; +import org.jbpm.services.task.utils.ContentMarshallerHelper; +import org.kie.api.runtime.KieSession; +import org.kie.api.runtime.manager.RuntimeEngine; +import org.kie.api.runtime.manager.RuntimeManager; +import org.kie.api.task.TaskService; +import org.kie.api.task.model.Content; +import org.kie.api.task.model.Status; +import org.kie.api.task.model.Task; +import org.kie.api.task.model.TaskData; +import org.kie.api.task.model.TaskSummary; +import org.kie.internal.task.api.EventService; +import org.kie.internal.task.api.InternalTaskService; + +import com.fp.bpmlib.Common; +import com.fp.bpmlib.ProcessUtil; +import com.fp.bpmlib.ejb.local.JbpmBeanLocal; +import com.fp.bpmlib.query.monitor.FlowActivitySave; +import com.fp.bpmlib.task.MaiaWorkItemHandler; +import com.fp.common.helper.Constant; +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; +import com.fp.persistence.pbpm.gene.TbpmGroupsUsers; +import com.fp.simple.dto.TaskInfo; + +// +/** + * Class HumanTaskClient encargada de acceder al Servidor de Tareas. + * + * @author Jvaca + * @version 2.1 + */ +public class HumanTaskClient { + + /** El valor de language. */ + private String language = "en-UK"; + + private final TaskService taskService; + + private final KieSession kiesession; + + /** + * Crea una nueva instancia de human task client. + * + * @throws Exception la exception + */ + public HumanTaskClient() throws Exception { + JbpmBeanLocal local = (JbpmBeanLocal) new InitialContext().lookup("java:global/maiaear-2.1/bpmlib/jbpmbean"); + RuntimeManager manager = local.getRuntimeManager(); + RuntimeEngine runtime = manager.getRuntimeEngine(null); + kiesession = runtime.getKieSession(); + taskService = runtime.getTaskService(); + kiesession.addEventListener(new TriggerRulesEventListener(kiesession)); + kiesession.getWorkItemManager().registerWorkItemHandler("Human Task", new MaiaWorkItemHandler()); + this.addListeners(runtime); + } + + /** + * Adiciona listener, para el manejo del bam de tareas. + * + * @param engine + */ + @SuppressWarnings("unchecked") + private void addListeners(RuntimeEngine engine) { + EventService eventService = (EventService) engine.getTaskService(); + boolean hasBamEventListener = false; + for (TaskLifeCycleEventListener listener : eventService.getTaskEventListeners()) { + if (listener instanceof BAMTaskEventListener) { + hasBamEventListener = true; + break; + } + } + if (!hasBamEventListener) { + BAMTaskEventListener bamTaskEventListener = new BAMTaskEventListener(); + eventService.registerTaskEventListener(bamTaskEventListener); + } + } + + /** + * Activate task. + * + * @param pTask the task + * @param pUserId the user id + * @throws Exception la exception + */ + public void activateTask(long pTask, String pUserId) throws Exception { + taskService.activate(pTask, pUserId); + + } + + /** + * Claim task. + * + * @param pTask the task + * @param pUserId the user id + * @throws Exception la exception + */ + public void claimTask(long pTask, String pUserId) throws Exception { + taskService.claim(pTask, pUserId); + FlowActivitySave.actualizarActividadClaim(pTask, pUserId); + } + + /** + * Entrega lsita de grupos bpm al que pertenece el usuario. + * + * @param pUser Codigo de usuario a buscar los grupos a los que pertenece. + * @return List + * @throws Exception la exception + */ + public static List groupsByUser(String pUser) throws Exception { + List groups = TbpmGroupsUsers.findGroupsByUser(PersistenceHelper.getEntityManager(), pUser); + List data = new ArrayList(); + for (TbpmGroupsUsers tbpmGroupsUsers : groups) { + data.add(tbpmGroupsUsers.getPk().getGroupcode()); + } + return data; + } + + /** + * Close. + * + * @throws Exception la exception + */ + public void close() throws Exception { + // No hacer nada con JTA la session se cierra automaticamente. + } + + /** + * Complete task. + * + * @param pTask the task + * @param pJournalId the journal id + * @param data the data + * @param pResultado the resultado + * @param pObs the obs + * @throws Exception la exception + */ + public String completeTask(long pTask, String pJournalId, Map data, String pResultado, String pObs) throws Exception { + Task t = this.getTaskById(pTask); + TaskData td = t.getTaskData(); + this.addComment(pTask, td.getActualOwner().getId(), pObs); + Map input = this.getInputData(t); + TaskInfo ti = (TaskInfo) input.get(ProcessUtil.TASK_METADATA); + ti.setResponse(pResultado); + ti.setTaskId(pTask); + ti.setJournalId(pJournalId); + System.out.println(pObs); + if (ti.getUserId() == null && t.getTaskData().getActualOwner() != null) { + ti.setUserId(t.getTaskData().getActualOwner().getId()); + } + + // Las fechas para el monitor se toman de BamTaskSummary + // ti.setCreated(new Timestamp( td.getCreatedOn().getTime())); + // ti.setCompleted(FormatDates.getInstance().getDataBaseTimestamp()); + ti.getAditionalData().putAll(data); + taskService.complete(pTask, td.getActualOwner().getId(), input); + FlowActivitySave.actualizarActividadComplete(pTask, ti); + return ti.getTname(); + } + + /** + * Adiciona un comment. + * + * @param pTask the task + * @param pUserId the user id + * @param pComment the comment + * @throws Exception la exception + */ + public void addComment(long pTask, String pUserId, String pComment) throws Exception { + InternalTaskService its = (InternalTaskService) taskService; + CommentImpl comentario = new CommentImpl(); + comentario.setText(pComment); + comentario.setAddedAt(Common.getInstance().getCurrentDate()); + comentario.setAddedBy(new UserImpl(pUserId)); + its.addComment(pTask, comentario); + + } + + /** + * Delegate task. + * + * @param pTask the task + * @param pUserId the user id + * @param pTargetUserId the target user id + * @throws Exception la exception + */ + public void delegateTask(long pTask, String pUserId, String pTargetUserId) throws Exception { + taskService.delegate(pTask, pUserId, pTargetUserId); + FlowActivitySave.actualizarActividadDelegate(pTask, pTargetUserId); + } + + /** + * Obtiene el valor de assigned tasks. + * + * @return Valor de assigned tasks + * @throws Exception la exception + */ + public List getAssignedTasks() throws Exception { + return taskService.getTasksAssignedAsPotentialOwner(null, language); + } + + /** + * Obtiene el valor de assigned tasks. + * + * @param pUserId the user id + * @return Valor de assigned tasks + * @throws Exception la exception + */ + public List getAssignedTasks(String pUserId) throws Exception { + // this.client.getTasksAssignedAsPotentialOwner(pUserId, this.language, taskSummaryHandler); + return taskService.getTasksOwned(pUserId, language); + } + + /** + * Obtiene el valor de content by id. + * + * @param pId the id + * @return Valor de content by id + * @throws Exception la exception + */ + public Content getContentById(long pId) throws Exception { + return taskService.getContentById(pId); + } + + /** + * Obtiene el valor de input data. + * + * @param pTask the task + * @return Valor de input data + * @throws Exception la exception + */ + public Map getInputData(Task pTask) throws Exception { + Content c = this.getContentById(pTask.getTaskData().getDocumentContentId()); + return HumanTaskClient.getContenido(c); + } + + /** + * Obtiene el valor de output data. + * + * @param pTask the task + * @return Valor de output data + * @throws Exception la exception + */ + public Map getOutputData(Task pTask) throws Exception { + Content c = this.getContentById(pTask.getTaskData().getOutputContentId()); + return HumanTaskClient.getContenido(c); + } + + /** + * Entrega el contenido asociado al workitem. + * + * @param task Datos de la tarea + * @return Map + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static Map getContenido(Content content) throws Exception { + Map maia = new HashMap(); + Object obj = ContentMarshallerHelper.unmarshall(content.getContent(), null); + if (obj instanceof Map) { + maia = (Map) obj; + } + return maia; + } + + /** + * Obtiene el valor de input data. + * + * @param pTask the task + * @return Valor de input data + * @throws Exception la exception + */ + @SuppressWarnings(Constant.WARN_UNCHECKED) + @Deprecated + public Map getDatos(Content c) throws Exception { + if (c != null) { + // Esto funciona con jbm 5.4 + Object obj = ContentMarshallerHelper.unmarshall(c.getContent(), null); + if (obj != null) { + ByteArrayOutputStream bos = null; + ObjectOutputStream out = null; + try { + // return (Map) obj; + bos = new ByteArrayOutputStream(); + out = new ObjectOutputStream(bos); + out.writeObject(obj); + ObjectInputStream bin = new ObjectInputStream(new ByteArrayInputStream(bos.toByteArray())); + return (Map) bin.readObject(); + } finally { + bos.close(); + out.close(); + } + } + } + + ObjectInputStream bin = new ObjectInputStream(new ByteArrayInputStream(c.getContent())); + try { + return (Map) bin.readObject(); + } finally { + bin.close(); + } + } + + /** + * Obtiene el valor de task by id. + * + * @param pId the id + * @return Valor de task by id + * @throws Exception la exception + */ + public Task getTaskById(long pId) throws Exception { + return taskService.getTaskById(pId); + } + + /** + * Obtiene el valor de task by work item id. + * + * @param pWorkId the work id + * @return Valor de task by work item id + * @throws Exception la exception + */ + public Task getTaskByWorkItemId(long pWorkId) throws Exception { + return taskService.getTaskByWorkItemId(pWorkId); + } + + /** + * Obtiene el valor de task content input. + * + * @param taskSum the task sum + * @return Valor de task content input + */ + public Object getTaskContentInput(TaskSummary taskSum) { + ByteArrayInputStream bais = null; + ObjectInputStream is = null; + + Task task2 = taskService.getTaskById(taskSum.getId()); + TaskData taskData = task2.getTaskData(); + Content content = taskService.getContentById(taskData.getDocumentContentId()); + + try { + bais = new ByteArrayInputStream(content.getContent()); + is = new ObjectInputStream(bais); + Object obj = null; + + do { + obj = is.readObject(); + if (obj == null) { + break; + } + APPLogger.getLogger().debug("OBJECT: " + obj); + return obj; + } while (obj != null); + } catch (Exception e) { + APPLogger.getLogger().warn(e, e); + return null; + } finally { + try { + if (bais != null) { + bais.close(); + } + } catch (Exception e2) { + } + try { + if (is != null) { + is.close(); + } + } catch (Exception e2) { + } + } + return null; + } + + /** + * Obtiene el valor de task data. + * + * @param pTask the task + * @return Valor de task data + * @throws Exception la exception + */ + public TaskData getTaskData(long pTask) throws Exception { + Task task = this.getTaskById(pTask); + return task.getTaskData(); + } + + /** + * Obtiene el listado de tareas Asignadas. + * + * @param pUserCri the user cri + * @param pCriteria the criteria + * @param pPage the page + * @param pRecords the records + * @return Listado de tareas asignadas + * @throws Exception la exception + */ + public List getAsignedTasks(String pUserCri) throws Exception { + List lestatus = new ArrayList<>(); + List lresp = new ArrayList<>(); + lestatus.add(Status.Reserved); + lestatus.add(Status.InProgress); + List list; + try { + list = taskService.getTasksOwnedByStatus(pUserCri, lestatus, "en-UK"); + for (TaskSummary obj : list) { + Object o[] = new Object[2]; + Task task = this.getTaskById(obj.getId()); + Content c = this.getContentById(task.getTaskData().getDocumentContentId()); + o[0] = task; + o[1] = c; + lresp.add(o); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + return lresp; + } + + /** + * Obtiene el valor de unfinished tasks. + * + * @param pUserId the user id + * @param pCri the cri + * @return Valor de unfinished tasks + * @throws Exception la exception + */ + public List getUnfinishedTasksByUser(String pUserId) throws Exception { + List lestatus = new ArrayList<>(); + List lresp = new ArrayList<>(); + lestatus.add(Status.Reserved); + lestatus.add(Status.InProgress); + List list = taskService.getTasksOwnedByStatus(pUserId, lestatus, "en-UK"); + try { + list = taskService.getTasksOwnedByStatus(pUserId, lestatus, "en-UK"); + for (TaskSummary obj : list) { + Object o[] = new Object[2]; + Task task = this.getTaskById(obj.getId()); + Content c = this.getContentById(task.getTaskData().getDocumentContentId()); + o[0] = task; + o[1] = c; + lresp.add(o); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + return lresp; + + } + + /** + * JPQL JPQL_TASK_NOT_COMPLETEBYGROUP + */ + private static final String TAREAS_GRUPO = "select t, potentialOwners.id from TaskImpl t, OrganizationalEntityImpl potentialOwners " + + "where potentialOwners.id in (:groupIds) and potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and t.archived = 0 " + + "and t.taskData.actualOwner = null and t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended')"; + + /** + * Obtiene el valor de unfinished tasks por Grupo. + * + * @param pGroupId the user id + * @param pCri the cri + * @return Valor de unfinished tasks + * @throws Exception la exception + */ + @SuppressWarnings(Constant.WARN_UNCHECKED) + public List getTasksByGroup(String pGroupId, String pCri) throws Exception { + List ldatos = new ArrayList(); + EntityManager em = null; + try { + em = PersistenceManager.getInstance().getEntityManagerFactoryAuxiliar("org.jbpm.domain").createEntityManager(); + Query qry = em.createQuery(HumanTaskClient.TAREAS_GRUPO); + qry.setParameter("groupIds", pGroupId); + ldatos = qry.getResultList(); + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + if (em.isOpen()) { + em.close(); + } + } + return ldatos; + } + + /** + * Release task. + * + * @param pTask the task + * @param pUserId the user id + * @throws Exception la exception + */ + public void releaseTask(long pTask, String pUserId) throws Exception { + taskService.release(pTask, pUserId); + } + + /** + * Resume task. + * + * @param pTask the task + * @param pUserId the user id + * @throws Exception la exception + */ + public void resumeTask(long pTask, String pUserId) throws Exception { + taskService.resume(pTask, pUserId); + } + + /** + * Start task. + * + * @param pTask the task + * @throws Exception la exception + */ + public void startTask(long pTask) throws Exception { + Task task = this.getTaskById(pTask); + APPLogger.getLogger().debug("Starting task " + pTask); + Map input = this.getInputData(task); + // com.fp.bpmlib.Process p = this.findProcess(task.getTaskData(), snapshot); + // TaskInfo ti = (TaskInfo) input.get(ProcessUtil.TASK_METADATA); + // ti.setTaskId(pTask); + // ti.setStarted(FormatDates.getInstance().getDataBaseTimestamp()); + // ti.setCreated(new Timestamp(task.getTaskData().getCreatedOn().getTime())); + + // ProcessInstance processInstance = kiesession.getProcessInstance(task.getTaskData().getProcessInstanceId()); + // RuleFlowProcessInstance rfpi = (RuleFlowProcessInstance) processInstance; + // rfpi.setVariable(ProcessUtil.TASK_METADATA, ti); //actualiza datos en el contexto. + // InternalTaskService its = ((InternalTaskService) taskService); + // Elimina el content anterior y remplaza por un nuevo content. + // its.deleteContent(pTask, task.getTaskData().getDocumentContentId()); + // its.addContent(pTask, input); + + // ***** LA FECHA DE CREACION E INICIO SE TOMA DE LA BAMTASKSUMMARY PARA PRESENTAR EN EL MONITOR. + + taskService.start(pTask, task.getTaskData().getActualOwner().getId()); + FlowActivitySave.actualizarActividadStart(pTask); + APPLogger.getLogger().debug("Started task " + pTask); + } + + /** + * Stop task. + * + * @param pTask the task + * @param pUserId the user id + * @throws Exception la exception + */ + public void stopTask(long pTask, String pUserId) throws Exception { + taskService.stop(pTask, pUserId); + } + + /** + * Suspend task. + * + * @param pTask the task + * @param pUserId the user id + * @throws Exception la exception + */ + public void suspendTask(long pTask, String pUserId) throws Exception { + taskService.suspend(pTask, pUserId); + } + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/.svn/text-base/TaskUtil.java.netbeans-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/.svn/text-base/TaskUtil.java.netbeans-base new file mode 100644 index 0000000..1b769e2 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/.svn/text-base/TaskUtil.java.netbeans-base @@ -0,0 +1,476 @@ +/* + * + */ +package com.fp.bpmlib.task.client; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.kie.api.task.model.Comment; +import org.kie.api.task.model.Status; +import org.kie.api.task.model.Task; +import org.kie.api.task.model.TaskData; +import org.mvel2.PropertyAccessException; + +import com.fp.base.persistence.util.helper.MessageManager; +import com.fp.bpm.query.QueryProcessor; +import com.fp.bpmlib.BPMException; +import com.fp.bpmlib.ProcessUtil; +import com.fp.common.messages.ELEval; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.data.TransactionDTO; +import com.fp.dto.query.QueryRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.pbpm.gene.TbpmFieldTransactionMaping; +import com.fp.persistence.pbpm.gene.TbpmFieldTransactionOrigin; +import com.fp.persistence.pbpm.gene.TbpmRules; +import com.fp.persistence.pbpm.gene.TbpmRulesKey; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; +import com.fp.persistence.pgeneral.trans.TgeneTransactionKey; +import com.fp.simple.dto.Responses; +import com.fp.simple.dto.TaskInfo; + +// TODO: Auto-generated Javadoc +/** + * Class TaskUtil encargada del manejo de Tareas. + * + * @author Jvaca + */ +public class TaskUtil { + + /** Constante BPM_STATUS. */ + public static final String BPM_STATUS = "BPMStatus"; + + /** Constante BPM_DATA. */ + public static final String BPM_DATA = "BPMData"; + + /** Constante BPM_OBS. */ + public static final String BPM_OBS = "BPMObs"; + + /** Constante BPM_TID. */ + public static final String BPM_TID = "TID"; + + /** El valor de task. */ + private Task task; + + /** El valor de task data. */ + private TaskData taskData; + + /** El valor de htc. */ + private final HumanTaskClient htc; + + /** El valor de tid. */ + private long tid; + + /** El valor de taskname. */ + private long taskname; + + /** El valor de input. */ + private Map input = null; + + /** + * Crea una nueva instancia de TaskUtil. + * + * @throws Exception la exception + */ + private TaskUtil() throws Exception { + htc = new HumanTaskClient(); + } + + /** + * Crea una nueva instancia de TaskUtil. + * + * @throws Exception la exception + */ + public TaskUtil(Task task, HumanTaskClient htc) throws Exception { + this.htc = htc; + this.task = task; + this.tid = this.task.getId(); + taskData = task.getTaskData(); + } + + /** + * Entrega el valor de task. + * + * @return Valor de task + */ + public Task getTask() { + return task; + } + + /** + * Entrega el valor de taskData. + * + * @return Valor de taskData + */ + public TaskData getTaskData() { + return taskData; + } + + /** + * Entrega el valor de tid. + * + * @return Valor de tid + */ + public long getTid() { + return tid; + } + + /** + * Entrega el valor de: taskname + * + * @return long + */ + public long getTaskname() { + return taskname; + } + + /** + * Fija el valor de: taskname + * + * @param taskname + */ + public void setTaskname(long taskname) { + this.taskname = taskname; + } + + /** + * Crea una nueva instancia de task til. + * + * @param pTId the t id + * @throws Exception la exception + */ + public TaskUtil(long pTId) throws Exception { + this(); + tid = pTId; + task = htc.getTaskById(pTId); + taskData = task.getTaskData(); + } + + /** + * Close. + * + * @throws Exception la exception + */ + public void close() throws Exception { + htc.close(); + } + + /** + * Obtiene el valor de task info. + * + * @return Valor de task info + * @throws Exception la exception + */ + public TaskInfo getTaskInfo() throws Exception { + Map m = this.getActualData(); + Object obj = m.get(ProcessUtil.TASK_METADATA); + return (TaskInfo) obj; + } + + /** + * Obtiene el valor del juego de variables de MAIA. + * + * @return Valor de las variables MAIA + * @throws Exception la exception + */ + @SuppressWarnings("unchecked") + public Map getMaia() throws Exception { + Map m = this.getActualData(); + return (Map) m.get(ProcessUtil.DATA); + } + + /** + * Obtiene el Request. + * + * @return Request + * @throws Exception la exception + */ + public Request getRequest() throws Exception { + Map maia = this.getMaia(); + return (Request) maia.get(ProcessUtil.REQUEST); + } + + /** + * Obtiene el valor de actual data. + * + * @return Valor de actual data + * @throws Exception la exception + */ + public Map getActualData() throws Exception { + if (input != null) { + return input; + } + if (taskData.getStatus() == Status.Completed) { + input = htc.getOutputData(task); + } else { + input = htc.getInputData(task); + } + return input; + } + + /** + * Obtiene el valor de status. + * + * @return Valor de status + */ + public Status getStatus() { + return taskData.getStatus(); + } + + /** + * Obtiene el valor de work item id. + * + * @return Valor de work item id + */ + public long getWorkItemId() { + return taskData.getWorkItemId(); + } + + /** + * Obtiene el valor de comments. + * + * @return Valor de comments + * @throws Exception la exception + */ + public List getComments() throws Exception { + return taskData.getComments(); + } + + /** + * Complete. + * + * @param pJournalId the journal id + * @param data the data + * @param pResponse the response + * @param pObs the obs + * @throws Exception la exception + */ + public String complete(String pJournalId, Map data, Responses pResponse, String pObs) throws Exception { + try { + return htc.completeTask(tid, pJournalId, data, pResponse.getCode(), pObs.toUpperCase()); + } catch (Exception e) { + throw new BPMException("BPM502", "NO SE HA PODIDO COMPLETAR LA TAREA {0} ", e, tid); + } + } + + /** + * Start. + * + * @throws Exception la exception + */ + public void start() throws Exception { + try { + htc.startTask(tid); + } catch (Exception e) { + throw new BPMException("BPM501", "NO SE HA PODIDO INICIAR LA TAREA {0} ", e, tid); + } + } + + /** + * Claim. + * + * @param pUser the user + * @throws Exception la exception + */ + public void claim(String pUser) throws Exception { + try { + htc.claimTask(tid, pUser); + } catch (Exception e) { + throw new BPMException("BPM500", "NO SE HA PODIDO RESERVAR LA TAREA {0} PARA EL USUARIO {1}", e, tid, pUser); + } + } + + /** + * Comment. + * + * @param pUser the user + * @param pComment the comment + * @throws Exception la exception + */ + public void comment(String pUser, String pComment) throws Exception { + try { + htc.addComment(tid, pUser, pComment.toUpperCase()); + } catch (Exception e) { + throw new BPMException("BPM504", "NO SE HA PODIDO MODIFICAR LA TAREA {0} ", e, tid); + } + } + + /** + * Reasign. + * + * @param pUser the user + * @throws Exception la exception + */ + public void delegate(String pUser) throws Exception { + try { + htc.delegateTask(tid, taskData.getActualOwner().getId(), pUser); + } catch (Exception e) { + throw new BPMException("BPM504", "NO SE HA PODIDO MODIFICAR LA TAREA {0} ", e, tid); + } + } + + /** + * Obtiene el valor de subject. + * + * @return Valor de subject + * @throws Exception la exception + */ + public String getSubject() throws Exception { + String subject = ""; + Request req = this.getRequest(); + if (req.getSubject() == null) { + req.setSubject(MessageManager.getMessage(req)); + } + subject = req.getSubject(); + return subject; + } + + /** + * Obtiene la descripcion de la regla. + * + * @return descripcion de la regla + * @throws Exception la exception + */ + public String getRuleDescription() throws Exception { + Request req = this.getRequest(); + TaskInfo info = this.getTaskInfo(); + TbpmRulesKey rk = new TbpmRulesKey(info.getRuleCode(), req.getCompany()); + TbpmRules r = TbpmRules.find(PersistenceHelper.getEntityManager(), rk); + if (r != null) { + return " " + r.getDescription(); + } + return ""; + } + + /** + * Obtiene el valor de transaction. + * + * @return Valor de transaction + * @throws Exception la exception + */ + public TransactionDTO getTransaction() throws Exception { + TaskInfo info = this.getTaskInfo(); + return new TransactionDTO(info.getModule(), info.getTransaction(), info.getVersion()); + } + + /** + * Obtiene el valor de detail. + * + * @param pLanguage the language + * @return Valor de detail + * @throws Exception la exception + */ + public String getDetail(String pLanguage) throws Exception { + TaskInfo info = this.getTaskInfo(); + Integer messagecode = info.getMessageCode(); + if (messagecode == null) { + TbpmRulesKey k = new TbpmRulesKey(info.getRuleCode(), ThreadFacade.getSessionData().getCompany()); + TbpmRules r = TbpmRules.find(PersistenceHelper.getEntityManager(), k); + messagecode = r.getMessagecode(); + } + com.fp.bpmlib.messages.MessageManager msg = new com.fp.bpmlib.messages.MessageManager(messagecode, pLanguage, null); + msg.setValue(TaskUtil.BPM_DATA, this.getMaia()); + msg.setValue("request", this.getRequest()); + msg.setValue(ProcessUtil.TASK_METADATA, info); + return msg.getMessage(); + } + + /** + * Obtiene el valor de origin data. + * + * @return Valor de origin data + * @throws Exception la exception + */ + public Map getOriginData() throws Exception { + Map data = new HashMap(); + Request rq = this.getRequest(); + List l = TbpmFieldTransactionOrigin.find(PersistenceHelper.getEntityManager(), rq.getTransactionModule(), + rq.getTransactionCode(), rq.getTransactionVersion()); + for (TbpmFieldTransactionOrigin o : l) { + try { + data.put(o.getPk().getFieldname(), ELEval.eval(rq, o.getExpresionlanguage())); + } catch (PropertyAccessException e) { + continue; + } + } + return data; + } + + /** + * Obtiene el valor de destiny meta data. + * + * @return Valor de destiny meta data + * @throws Exception la exception + */ + public Map getDestinyMetaData() throws Exception { + Map data = new HashMap(); + TransactionDTO trn = this.getTransaction(); + List l = TbpmFieldTransactionMaping.find(PersistenceHelper.getEntityManager(), trn.getModule(), + trn.getTransaction(), trn.getVersion()); + for (TbpmFieldTransactionMaping o : l) { + data.put(o.getFieldscreen(), o.getPk().getFieldname()); + } + return data; + } + + /** + * Obtiene el valor de destiny data. + * + * @return Valor de destiny data + * @throws Exception la exception + */ + public Map getDestinyData() throws Exception { + Map data = new HashMap(); + Map origin = this.getOriginData(); + Map meta = this.getDestinyMetaData(); + for (Entry e : meta.entrySet()) { + data.put(e.getKey(), origin.get(e.getValue())); + } + TransactionDTO trn = this.getTransaction(); + TgeneTransactionKey tKey = new TgeneTransactionKey(trn.getModule(), trn.getTransaction(), trn.getVersion()); + TgeneTransaction trnData = TgeneTransaction.find(PersistenceHelper.getEntityManager(), tKey); + if (trnData != null && trnData.getQuerycode() != null) { + QueryProcessor qp = new QueryProcessor(); + QueryRequest qr = new QueryRequest(); + qr.setResponse(new Response(Response.RESPONSE_OK, "OK")); + qr.setTransactionModule(trn.getModule()); + qr.setTransactionCode(trn.getTransaction()); + qr.setTransactionVersion(trn.getVersion()); + qr.setTransactionModule(trn.getModule()); + for (Entry e : data.entrySet()) { + qr.put(e.getKey(), e.getValue()); + } + qr.addAddtionalInfo("queryalias", trnData.getQuerycode()); + qr.addAddtionalInfo("querytype", "P"); + qp.setQueryRequest(qr); + qp.processQueryByAlias(); + + for (Entry e : qr.getResponse().entrySet()) { + data.put(e.getKey(), e.getValue()); + } + } + return data; + } + + /** + * Entrega el map que almacena datos utilizados en el bpm. + * + * @param request Request a obtener el map de datos utilizados en el jbpm. + * @return Map + * @throws Exception la exception + */ + public static Map getBpmData(Request request) throws Exception { + @SuppressWarnings("unchecked") + Map mdata = (Map) request.get(TaskUtil.BPM_DATA); + if (mdata == null) { + mdata = new HashMap(); + request.put(TaskUtil.BPM_DATA, mdata); + } + return mdata; + } +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/.svn/text-base/TaskUtil.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/.svn/text-base/TaskUtil.java.svn-base new file mode 100644 index 0000000..1b769e2 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/.svn/text-base/TaskUtil.java.svn-base @@ -0,0 +1,476 @@ +/* + * + */ +package com.fp.bpmlib.task.client; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.kie.api.task.model.Comment; +import org.kie.api.task.model.Status; +import org.kie.api.task.model.Task; +import org.kie.api.task.model.TaskData; +import org.mvel2.PropertyAccessException; + +import com.fp.base.persistence.util.helper.MessageManager; +import com.fp.bpm.query.QueryProcessor; +import com.fp.bpmlib.BPMException; +import com.fp.bpmlib.ProcessUtil; +import com.fp.common.messages.ELEval; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.data.TransactionDTO; +import com.fp.dto.query.QueryRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.pbpm.gene.TbpmFieldTransactionMaping; +import com.fp.persistence.pbpm.gene.TbpmFieldTransactionOrigin; +import com.fp.persistence.pbpm.gene.TbpmRules; +import com.fp.persistence.pbpm.gene.TbpmRulesKey; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; +import com.fp.persistence.pgeneral.trans.TgeneTransactionKey; +import com.fp.simple.dto.Responses; +import com.fp.simple.dto.TaskInfo; + +// TODO: Auto-generated Javadoc +/** + * Class TaskUtil encargada del manejo de Tareas. + * + * @author Jvaca + */ +public class TaskUtil { + + /** Constante BPM_STATUS. */ + public static final String BPM_STATUS = "BPMStatus"; + + /** Constante BPM_DATA. */ + public static final String BPM_DATA = "BPMData"; + + /** Constante BPM_OBS. */ + public static final String BPM_OBS = "BPMObs"; + + /** Constante BPM_TID. */ + public static final String BPM_TID = "TID"; + + /** El valor de task. */ + private Task task; + + /** El valor de task data. */ + private TaskData taskData; + + /** El valor de htc. */ + private final HumanTaskClient htc; + + /** El valor de tid. */ + private long tid; + + /** El valor de taskname. */ + private long taskname; + + /** El valor de input. */ + private Map input = null; + + /** + * Crea una nueva instancia de TaskUtil. + * + * @throws Exception la exception + */ + private TaskUtil() throws Exception { + htc = new HumanTaskClient(); + } + + /** + * Crea una nueva instancia de TaskUtil. + * + * @throws Exception la exception + */ + public TaskUtil(Task task, HumanTaskClient htc) throws Exception { + this.htc = htc; + this.task = task; + this.tid = this.task.getId(); + taskData = task.getTaskData(); + } + + /** + * Entrega el valor de task. + * + * @return Valor de task + */ + public Task getTask() { + return task; + } + + /** + * Entrega el valor de taskData. + * + * @return Valor de taskData + */ + public TaskData getTaskData() { + return taskData; + } + + /** + * Entrega el valor de tid. + * + * @return Valor de tid + */ + public long getTid() { + return tid; + } + + /** + * Entrega el valor de: taskname + * + * @return long + */ + public long getTaskname() { + return taskname; + } + + /** + * Fija el valor de: taskname + * + * @param taskname + */ + public void setTaskname(long taskname) { + this.taskname = taskname; + } + + /** + * Crea una nueva instancia de task til. + * + * @param pTId the t id + * @throws Exception la exception + */ + public TaskUtil(long pTId) throws Exception { + this(); + tid = pTId; + task = htc.getTaskById(pTId); + taskData = task.getTaskData(); + } + + /** + * Close. + * + * @throws Exception la exception + */ + public void close() throws Exception { + htc.close(); + } + + /** + * Obtiene el valor de task info. + * + * @return Valor de task info + * @throws Exception la exception + */ + public TaskInfo getTaskInfo() throws Exception { + Map m = this.getActualData(); + Object obj = m.get(ProcessUtil.TASK_METADATA); + return (TaskInfo) obj; + } + + /** + * Obtiene el valor del juego de variables de MAIA. + * + * @return Valor de las variables MAIA + * @throws Exception la exception + */ + @SuppressWarnings("unchecked") + public Map getMaia() throws Exception { + Map m = this.getActualData(); + return (Map) m.get(ProcessUtil.DATA); + } + + /** + * Obtiene el Request. + * + * @return Request + * @throws Exception la exception + */ + public Request getRequest() throws Exception { + Map maia = this.getMaia(); + return (Request) maia.get(ProcessUtil.REQUEST); + } + + /** + * Obtiene el valor de actual data. + * + * @return Valor de actual data + * @throws Exception la exception + */ + public Map getActualData() throws Exception { + if (input != null) { + return input; + } + if (taskData.getStatus() == Status.Completed) { + input = htc.getOutputData(task); + } else { + input = htc.getInputData(task); + } + return input; + } + + /** + * Obtiene el valor de status. + * + * @return Valor de status + */ + public Status getStatus() { + return taskData.getStatus(); + } + + /** + * Obtiene el valor de work item id. + * + * @return Valor de work item id + */ + public long getWorkItemId() { + return taskData.getWorkItemId(); + } + + /** + * Obtiene el valor de comments. + * + * @return Valor de comments + * @throws Exception la exception + */ + public List getComments() throws Exception { + return taskData.getComments(); + } + + /** + * Complete. + * + * @param pJournalId the journal id + * @param data the data + * @param pResponse the response + * @param pObs the obs + * @throws Exception la exception + */ + public String complete(String pJournalId, Map data, Responses pResponse, String pObs) throws Exception { + try { + return htc.completeTask(tid, pJournalId, data, pResponse.getCode(), pObs.toUpperCase()); + } catch (Exception e) { + throw new BPMException("BPM502", "NO SE HA PODIDO COMPLETAR LA TAREA {0} ", e, tid); + } + } + + /** + * Start. + * + * @throws Exception la exception + */ + public void start() throws Exception { + try { + htc.startTask(tid); + } catch (Exception e) { + throw new BPMException("BPM501", "NO SE HA PODIDO INICIAR LA TAREA {0} ", e, tid); + } + } + + /** + * Claim. + * + * @param pUser the user + * @throws Exception la exception + */ + public void claim(String pUser) throws Exception { + try { + htc.claimTask(tid, pUser); + } catch (Exception e) { + throw new BPMException("BPM500", "NO SE HA PODIDO RESERVAR LA TAREA {0} PARA EL USUARIO {1}", e, tid, pUser); + } + } + + /** + * Comment. + * + * @param pUser the user + * @param pComment the comment + * @throws Exception la exception + */ + public void comment(String pUser, String pComment) throws Exception { + try { + htc.addComment(tid, pUser, pComment.toUpperCase()); + } catch (Exception e) { + throw new BPMException("BPM504", "NO SE HA PODIDO MODIFICAR LA TAREA {0} ", e, tid); + } + } + + /** + * Reasign. + * + * @param pUser the user + * @throws Exception la exception + */ + public void delegate(String pUser) throws Exception { + try { + htc.delegateTask(tid, taskData.getActualOwner().getId(), pUser); + } catch (Exception e) { + throw new BPMException("BPM504", "NO SE HA PODIDO MODIFICAR LA TAREA {0} ", e, tid); + } + } + + /** + * Obtiene el valor de subject. + * + * @return Valor de subject + * @throws Exception la exception + */ + public String getSubject() throws Exception { + String subject = ""; + Request req = this.getRequest(); + if (req.getSubject() == null) { + req.setSubject(MessageManager.getMessage(req)); + } + subject = req.getSubject(); + return subject; + } + + /** + * Obtiene la descripcion de la regla. + * + * @return descripcion de la regla + * @throws Exception la exception + */ + public String getRuleDescription() throws Exception { + Request req = this.getRequest(); + TaskInfo info = this.getTaskInfo(); + TbpmRulesKey rk = new TbpmRulesKey(info.getRuleCode(), req.getCompany()); + TbpmRules r = TbpmRules.find(PersistenceHelper.getEntityManager(), rk); + if (r != null) { + return " " + r.getDescription(); + } + return ""; + } + + /** + * Obtiene el valor de transaction. + * + * @return Valor de transaction + * @throws Exception la exception + */ + public TransactionDTO getTransaction() throws Exception { + TaskInfo info = this.getTaskInfo(); + return new TransactionDTO(info.getModule(), info.getTransaction(), info.getVersion()); + } + + /** + * Obtiene el valor de detail. + * + * @param pLanguage the language + * @return Valor de detail + * @throws Exception la exception + */ + public String getDetail(String pLanguage) throws Exception { + TaskInfo info = this.getTaskInfo(); + Integer messagecode = info.getMessageCode(); + if (messagecode == null) { + TbpmRulesKey k = new TbpmRulesKey(info.getRuleCode(), ThreadFacade.getSessionData().getCompany()); + TbpmRules r = TbpmRules.find(PersistenceHelper.getEntityManager(), k); + messagecode = r.getMessagecode(); + } + com.fp.bpmlib.messages.MessageManager msg = new com.fp.bpmlib.messages.MessageManager(messagecode, pLanguage, null); + msg.setValue(TaskUtil.BPM_DATA, this.getMaia()); + msg.setValue("request", this.getRequest()); + msg.setValue(ProcessUtil.TASK_METADATA, info); + return msg.getMessage(); + } + + /** + * Obtiene el valor de origin data. + * + * @return Valor de origin data + * @throws Exception la exception + */ + public Map getOriginData() throws Exception { + Map data = new HashMap(); + Request rq = this.getRequest(); + List l = TbpmFieldTransactionOrigin.find(PersistenceHelper.getEntityManager(), rq.getTransactionModule(), + rq.getTransactionCode(), rq.getTransactionVersion()); + for (TbpmFieldTransactionOrigin o : l) { + try { + data.put(o.getPk().getFieldname(), ELEval.eval(rq, o.getExpresionlanguage())); + } catch (PropertyAccessException e) { + continue; + } + } + return data; + } + + /** + * Obtiene el valor de destiny meta data. + * + * @return Valor de destiny meta data + * @throws Exception la exception + */ + public Map getDestinyMetaData() throws Exception { + Map data = new HashMap(); + TransactionDTO trn = this.getTransaction(); + List l = TbpmFieldTransactionMaping.find(PersistenceHelper.getEntityManager(), trn.getModule(), + trn.getTransaction(), trn.getVersion()); + for (TbpmFieldTransactionMaping o : l) { + data.put(o.getFieldscreen(), o.getPk().getFieldname()); + } + return data; + } + + /** + * Obtiene el valor de destiny data. + * + * @return Valor de destiny data + * @throws Exception la exception + */ + public Map getDestinyData() throws Exception { + Map data = new HashMap(); + Map origin = this.getOriginData(); + Map meta = this.getDestinyMetaData(); + for (Entry e : meta.entrySet()) { + data.put(e.getKey(), origin.get(e.getValue())); + } + TransactionDTO trn = this.getTransaction(); + TgeneTransactionKey tKey = new TgeneTransactionKey(trn.getModule(), trn.getTransaction(), trn.getVersion()); + TgeneTransaction trnData = TgeneTransaction.find(PersistenceHelper.getEntityManager(), tKey); + if (trnData != null && trnData.getQuerycode() != null) { + QueryProcessor qp = new QueryProcessor(); + QueryRequest qr = new QueryRequest(); + qr.setResponse(new Response(Response.RESPONSE_OK, "OK")); + qr.setTransactionModule(trn.getModule()); + qr.setTransactionCode(trn.getTransaction()); + qr.setTransactionVersion(trn.getVersion()); + qr.setTransactionModule(trn.getModule()); + for (Entry e : data.entrySet()) { + qr.put(e.getKey(), e.getValue()); + } + qr.addAddtionalInfo("queryalias", trnData.getQuerycode()); + qr.addAddtionalInfo("querytype", "P"); + qp.setQueryRequest(qr); + qp.processQueryByAlias(); + + for (Entry e : qr.getResponse().entrySet()) { + data.put(e.getKey(), e.getValue()); + } + } + return data; + } + + /** + * Entrega el map que almacena datos utilizados en el bpm. + * + * @param request Request a obtener el map de datos utilizados en el jbpm. + * @return Map + * @throws Exception la exception + */ + public static Map getBpmData(Request request) throws Exception { + @SuppressWarnings("unchecked") + Map mdata = (Map) request.get(TaskUtil.BPM_DATA); + if (mdata == null) { + mdata = new HashMap(); + request.put(TaskUtil.BPM_DATA, mdata); + } + return mdata; + } +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/.svn/text-base/package-info.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..c36e71e --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,4 @@ +/** + * Provee los componentes para el cliente del Servidor de Tareas. + */ +package com.fp.bpmlib.task.client; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/HumanTaskClient.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/HumanTaskClient.java new file mode 100644 index 0000000..11246d3 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/HumanTaskClient.java @@ -0,0 +1,580 @@ +/* + * + */ +package com.fp.bpmlib.task.client; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.naming.InitialContext; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import org.jbpm.process.instance.event.listeners.TriggerRulesEventListener; +import org.jbpm.services.task.impl.model.CommentImpl; +import org.jbpm.services.task.impl.model.UserImpl; +import org.jbpm.services.task.lifecycle.listeners.BAMTaskEventListener; +import org.jbpm.services.task.lifecycle.listeners.TaskLifeCycleEventListener; +import org.jbpm.services.task.utils.ContentMarshallerHelper; +import org.kie.api.runtime.KieSession; +import org.kie.api.runtime.manager.RuntimeEngine; +import org.kie.api.runtime.manager.RuntimeManager; +import org.kie.api.task.TaskService; +import org.kie.api.task.model.Content; +import org.kie.api.task.model.Status; +import org.kie.api.task.model.Task; +import org.kie.api.task.model.TaskData; +import org.kie.api.task.model.TaskSummary; +import org.kie.internal.task.api.EventService; +import org.kie.internal.task.api.InternalTaskService; + +import com.fp.bpmlib.Common; +import com.fp.bpmlib.ProcessUtil; +import com.fp.bpmlib.ejb.local.JbpmBeanLocal; +import com.fp.bpmlib.query.monitor.FlowActivitySave; +import com.fp.bpmlib.task.MaiaWorkItemHandler; +import com.fp.common.helper.Constant; +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; +import com.fp.persistence.pbpm.gene.TbpmGroupsUsers; +import com.fp.simple.dto.TaskInfo; + +// +/** + * Class HumanTaskClient encargada de acceder al Servidor de Tareas. + * + * @author Jvaca + * @version 2.1 + */ +public class HumanTaskClient { + + /** El valor de language. */ + private String language = "en-UK"; + + private final TaskService taskService; + + private final KieSession kiesession; + + /** + * Crea una nueva instancia de human task client. + * + * @throws Exception la exception + */ + public HumanTaskClient() throws Exception { + JbpmBeanLocal local = (JbpmBeanLocal) new InitialContext().lookup("java:global/maiaear-2.1/bpmlib/jbpmbean"); + RuntimeManager manager = local.getRuntimeManager(); + RuntimeEngine runtime = manager.getRuntimeEngine(null); + kiesession = runtime.getKieSession(); + taskService = runtime.getTaskService(); + kiesession.addEventListener(new TriggerRulesEventListener(kiesession)); + kiesession.getWorkItemManager().registerWorkItemHandler("Human Task", new MaiaWorkItemHandler()); + this.addListeners(runtime); + } + + /** + * Adiciona listener, para el manejo del bam de tareas. + * + * @param engine + */ + @SuppressWarnings("unchecked") + private void addListeners(RuntimeEngine engine) { + EventService eventService = (EventService) engine.getTaskService(); + boolean hasBamEventListener = false; + for (TaskLifeCycleEventListener listener : eventService.getTaskEventListeners()) { + if (listener instanceof BAMTaskEventListener) { + hasBamEventListener = true; + break; + } + } + if (!hasBamEventListener) { + BAMTaskEventListener bamTaskEventListener = new BAMTaskEventListener(); + eventService.registerTaskEventListener(bamTaskEventListener); + } + } + + /** + * Activate task. + * + * @param pTask the task + * @param pUserId the user id + * @throws Exception la exception + */ + public void activateTask(long pTask, String pUserId) throws Exception { + taskService.activate(pTask, pUserId); + + } + + /** + * Claim task. + * + * @param pTask the task + * @param pUserId the user id + * @throws Exception la exception + */ + public void claimTask(long pTask, String pUserId) throws Exception { + taskService.claim(pTask, pUserId); + FlowActivitySave.actualizarActividadClaim(pTask, pUserId); + } + + /** + * Entrega lsita de grupos bpm al que pertenece el usuario. + * + * @param pUser Codigo de usuario a buscar los grupos a los que pertenece. + * @return List + * @throws Exception la exception + */ + public static List groupsByUser(String pUser) throws Exception { + List groups = TbpmGroupsUsers.findGroupsByUser(PersistenceHelper.getEntityManager(), pUser); + List data = new ArrayList(); + for (TbpmGroupsUsers tbpmGroupsUsers : groups) { + data.add(tbpmGroupsUsers.getPk().getGroupcode()); + } + return data; + } + + /** + * Close. + * + * @throws Exception la exception + */ + public void close() throws Exception { + // No hacer nada con JTA la session se cierra automaticamente. + } + + /** + * Complete task. + * + * @param pTask the task + * @param pJournalId the journal id + * @param data the data + * @param pResultado the resultado + * @param pObs the obs + * @throws Exception la exception + */ + public String completeTask(long pTask, String pJournalId, Map data, String pResultado, String pObs) throws Exception { + Task t = this.getTaskById(pTask); + TaskData td = t.getTaskData(); + this.addComment(pTask, td.getActualOwner().getId(), pObs); + Map input = this.getInputData(t); + TaskInfo ti = (TaskInfo) input.get(ProcessUtil.TASK_METADATA); + ti.setResponse(pResultado); + ti.setTaskId(pTask); + ti.setJournalId(pJournalId); + System.out.println(pObs); + if (ti.getUserId() == null && t.getTaskData().getActualOwner() != null) { + ti.setUserId(t.getTaskData().getActualOwner().getId()); + } + + // Las fechas para el monitor se toman de BamTaskSummary + // ti.setCreated(new Timestamp( td.getCreatedOn().getTime())); + // ti.setCompleted(FormatDates.getInstance().getDataBaseTimestamp()); + ti.getAditionalData().putAll(data); + taskService.complete(pTask, td.getActualOwner().getId(), input); + FlowActivitySave.actualizarActividadComplete(pTask, ti); + return ti.getTname(); + } + + /** + * Adiciona un comment. + * + * @param pTask the task + * @param pUserId the user id + * @param pComment the comment + * @throws Exception la exception + */ + public void addComment(long pTask, String pUserId, String pComment) throws Exception { + InternalTaskService its = (InternalTaskService) taskService; + CommentImpl comentario = new CommentImpl(); + comentario.setText(pComment); + comentario.setAddedAt(Common.getInstance().getCurrentDate()); + comentario.setAddedBy(new UserImpl(pUserId)); + its.addComment(pTask, comentario); + + } + + /** + * Delegate task. + * + * @param pTask the task + * @param pUserId the user id + * @param pTargetUserId the target user id + * @throws Exception la exception + */ + public void delegateTask(long pTask, String pUserId, String pTargetUserId) throws Exception { + taskService.delegate(pTask, pUserId, pTargetUserId); + FlowActivitySave.actualizarActividadDelegate(pTask, pTargetUserId); + } + + /** + * Obtiene el valor de assigned tasks. + * + * @return Valor de assigned tasks + * @throws Exception la exception + */ + public List getAssignedTasks() throws Exception { + return taskService.getTasksAssignedAsPotentialOwner(null, language); + } + + /** + * Obtiene el valor de assigned tasks. + * + * @param pUserId the user id + * @return Valor de assigned tasks + * @throws Exception la exception + */ + public List getAssignedTasks(String pUserId) throws Exception { + // this.client.getTasksAssignedAsPotentialOwner(pUserId, this.language, taskSummaryHandler); + return taskService.getTasksOwned(pUserId, language); + } + + /** + * Obtiene el valor de content by id. + * + * @param pId the id + * @return Valor de content by id + * @throws Exception la exception + */ + public Content getContentById(long pId) throws Exception { + return taskService.getContentById(pId); + } + + /** + * Obtiene el valor de input data. + * + * @param pTask the task + * @return Valor de input data + * @throws Exception la exception + */ + public Map getInputData(Task pTask) throws Exception { + Content c = this.getContentById(pTask.getTaskData().getDocumentContentId()); + return HumanTaskClient.getContenido(c); + } + + /** + * Obtiene el valor de output data. + * + * @param pTask the task + * @return Valor de output data + * @throws Exception la exception + */ + public Map getOutputData(Task pTask) throws Exception { + Content c = this.getContentById(pTask.getTaskData().getOutputContentId()); + return HumanTaskClient.getContenido(c); + } + + /** + * Entrega el contenido asociado al workitem. + * + * @param task Datos de la tarea + * @return Map + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static Map getContenido(Content content) throws Exception { + Map maia = new HashMap(); + Object obj = ContentMarshallerHelper.unmarshall(content.getContent(), null); + if (obj instanceof Map) { + maia = (Map) obj; + } + return maia; + } + + /** + * Obtiene el valor de input data. + * + * @param pTask the task + * @return Valor de input data + * @throws Exception la exception + */ + @SuppressWarnings(Constant.WARN_UNCHECKED) + @Deprecated + public Map getDatos(Content c) throws Exception { + if (c != null) { + // Esto funciona con jbm 5.4 + Object obj = ContentMarshallerHelper.unmarshall(c.getContent(), null); + if (obj != null) { + ByteArrayOutputStream bos = null; + ObjectOutputStream out = null; + try { + // return (Map) obj; + bos = new ByteArrayOutputStream(); + out = new ObjectOutputStream(bos); + out.writeObject(obj); + ObjectInputStream bin = new ObjectInputStream(new ByteArrayInputStream(bos.toByteArray())); + return (Map) bin.readObject(); + } finally { + bos.close(); + out.close(); + } + } + } + + ObjectInputStream bin = new ObjectInputStream(new ByteArrayInputStream(c.getContent())); + try { + return (Map) bin.readObject(); + } finally { + bin.close(); + } + } + + /** + * Obtiene el valor de task by id. + * + * @param pId the id + * @return Valor de task by id + * @throws Exception la exception + */ + public Task getTaskById(long pId) throws Exception { + return taskService.getTaskById(pId); + } + + /** + * Obtiene el valor de task by work item id. + * + * @param pWorkId the work id + * @return Valor de task by work item id + * @throws Exception la exception + */ + public Task getTaskByWorkItemId(long pWorkId) throws Exception { + return taskService.getTaskByWorkItemId(pWorkId); + } + + /** + * Obtiene el valor de task content input. + * + * @param taskSum the task sum + * @return Valor de task content input + */ + public Object getTaskContentInput(TaskSummary taskSum) { + ByteArrayInputStream bais = null; + ObjectInputStream is = null; + + Task task2 = taskService.getTaskById(taskSum.getId()); + TaskData taskData = task2.getTaskData(); + Content content = taskService.getContentById(taskData.getDocumentContentId()); + + try { + bais = new ByteArrayInputStream(content.getContent()); + is = new ObjectInputStream(bais); + Object obj = null; + + do { + obj = is.readObject(); + if (obj == null) { + break; + } + APPLogger.getLogger().debug("OBJECT: " + obj); + return obj; + } while (obj != null); + } catch (Exception e) { + APPLogger.getLogger().warn(e, e); + return null; + } finally { + try { + if (bais != null) { + bais.close(); + } + } catch (Exception e2) { + } + try { + if (is != null) { + is.close(); + } + } catch (Exception e2) { + } + } + return null; + } + + /** + * Obtiene el valor de task data. + * + * @param pTask the task + * @return Valor de task data + * @throws Exception la exception + */ + public TaskData getTaskData(long pTask) throws Exception { + Task task = this.getTaskById(pTask); + return task.getTaskData(); + } + + /** + * Obtiene el listado de tareas Asignadas. + * + * @param pUserCri the user cri + * @param pCriteria the criteria + * @param pPage the page + * @param pRecords the records + * @return Listado de tareas asignadas + * @throws Exception la exception + */ + public List getAsignedTasks(String pUserCri) throws Exception { + List lestatus = new ArrayList<>(); + List lresp = new ArrayList<>(); + lestatus.add(Status.Reserved); + lestatus.add(Status.InProgress); + List list; + try { + list = taskService.getTasksOwnedByStatus(pUserCri, lestatus, "en-UK"); + for (TaskSummary obj : list) { + Object o[] = new Object[2]; + Task task = this.getTaskById(obj.getId()); + Content c = this.getContentById(task.getTaskData().getDocumentContentId()); + o[0] = task; + o[1] = c; + lresp.add(o); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + return lresp; + } + + /** + * Obtiene el valor de unfinished tasks. + * + * @param pUserId the user id + * @param pCri the cri + * @return Valor de unfinished tasks + * @throws Exception la exception + */ + public List getUnfinishedTasksByUser(String pUserId) throws Exception { + List lestatus = new ArrayList<>(); + List lresp = new ArrayList<>(); + lestatus.add(Status.Reserved); + lestatus.add(Status.InProgress); + List list = taskService.getTasksOwnedByStatus(pUserId, lestatus, "en-UK"); + try { + list = taskService.getTasksOwnedByStatus(pUserId, lestatus, "en-UK"); + for (TaskSummary obj : list) { + Object o[] = new Object[2]; + Task task = this.getTaskById(obj.getId()); + Content c = this.getContentById(task.getTaskData().getDocumentContentId()); + o[0] = task; + o[1] = c; + lresp.add(o); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + return lresp; + + } + + /** + * JPQL JPQL_TASK_NOT_COMPLETEBYGROUP + */ + private static final String TAREAS_GRUPO = "select t, potentialOwners.id from TaskImpl t, OrganizationalEntityImpl potentialOwners " + + "where potentialOwners.id in (:groupIds) and potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and t.archived = 0 " + + "and t.taskData.actualOwner = null and t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended')"; + + /** + * Obtiene el valor de unfinished tasks por Grupo. + * + * @param pGroupId the user id + * @param pCri the cri + * @return Valor de unfinished tasks + * @throws Exception la exception + */ + @SuppressWarnings(Constant.WARN_UNCHECKED) + public List getTasksByGroup(String pGroupId, String pCri) throws Exception { + List ldatos = new ArrayList(); + EntityManager em = null; + try { + em = PersistenceManager.getInstance().getEntityManagerFactoryAuxiliar("org.jbpm.domain").createEntityManager(); + Query qry = em.createQuery(HumanTaskClient.TAREAS_GRUPO); + qry.setParameter("groupIds", pGroupId); + ldatos = qry.getResultList(); + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + if (em.isOpen()) { + em.close(); + } + } + return ldatos; + } + + /** + * Release task. + * + * @param pTask the task + * @param pUserId the user id + * @throws Exception la exception + */ + public void releaseTask(long pTask, String pUserId) throws Exception { + taskService.release(pTask, pUserId); + } + + /** + * Resume task. + * + * @param pTask the task + * @param pUserId the user id + * @throws Exception la exception + */ + public void resumeTask(long pTask, String pUserId) throws Exception { + taskService.resume(pTask, pUserId); + } + + /** + * Start task. + * + * @param pTask the task + * @throws Exception la exception + */ + public void startTask(long pTask) throws Exception { + Task task = this.getTaskById(pTask); + APPLogger.getLogger().debug("Starting task " + pTask); + Map input = this.getInputData(task); + // com.fp.bpmlib.Process p = this.findProcess(task.getTaskData(), snapshot); + // TaskInfo ti = (TaskInfo) input.get(ProcessUtil.TASK_METADATA); + // ti.setTaskId(pTask); + // ti.setStarted(FormatDates.getInstance().getDataBaseTimestamp()); + // ti.setCreated(new Timestamp(task.getTaskData().getCreatedOn().getTime())); + + // ProcessInstance processInstance = kiesession.getProcessInstance(task.getTaskData().getProcessInstanceId()); + // RuleFlowProcessInstance rfpi = (RuleFlowProcessInstance) processInstance; + // rfpi.setVariable(ProcessUtil.TASK_METADATA, ti); //actualiza datos en el contexto. + // InternalTaskService its = ((InternalTaskService) taskService); + // Elimina el content anterior y remplaza por un nuevo content. + // its.deleteContent(pTask, task.getTaskData().getDocumentContentId()); + // its.addContent(pTask, input); + + // ***** LA FECHA DE CREACION E INICIO SE TOMA DE LA BAMTASKSUMMARY PARA PRESENTAR EN EL MONITOR. + + taskService.start(pTask, task.getTaskData().getActualOwner().getId()); + FlowActivitySave.actualizarActividadStart(pTask); + APPLogger.getLogger().debug("Started task " + pTask); + } + + /** + * Stop task. + * + * @param pTask the task + * @param pUserId the user id + * @throws Exception la exception + */ + public void stopTask(long pTask, String pUserId) throws Exception { + taskService.stop(pTask, pUserId); + } + + /** + * Suspend task. + * + * @param pTask the task + * @param pUserId the user id + * @throws Exception la exception + */ + public void suspendTask(long pTask, String pUserId) throws Exception { + taskService.suspend(pTask, pUserId); + } + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/TaskUtil.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/TaskUtil.java new file mode 100644 index 0000000..1b769e2 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/TaskUtil.java @@ -0,0 +1,476 @@ +/* + * + */ +package com.fp.bpmlib.task.client; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.kie.api.task.model.Comment; +import org.kie.api.task.model.Status; +import org.kie.api.task.model.Task; +import org.kie.api.task.model.TaskData; +import org.mvel2.PropertyAccessException; + +import com.fp.base.persistence.util.helper.MessageManager; +import com.fp.bpm.query.QueryProcessor; +import com.fp.bpmlib.BPMException; +import com.fp.bpmlib.ProcessUtil; +import com.fp.common.messages.ELEval; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.data.TransactionDTO; +import com.fp.dto.query.QueryRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.pbpm.gene.TbpmFieldTransactionMaping; +import com.fp.persistence.pbpm.gene.TbpmFieldTransactionOrigin; +import com.fp.persistence.pbpm.gene.TbpmRules; +import com.fp.persistence.pbpm.gene.TbpmRulesKey; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; +import com.fp.persistence.pgeneral.trans.TgeneTransactionKey; +import com.fp.simple.dto.Responses; +import com.fp.simple.dto.TaskInfo; + +// TODO: Auto-generated Javadoc +/** + * Class TaskUtil encargada del manejo de Tareas. + * + * @author Jvaca + */ +public class TaskUtil { + + /** Constante BPM_STATUS. */ + public static final String BPM_STATUS = "BPMStatus"; + + /** Constante BPM_DATA. */ + public static final String BPM_DATA = "BPMData"; + + /** Constante BPM_OBS. */ + public static final String BPM_OBS = "BPMObs"; + + /** Constante BPM_TID. */ + public static final String BPM_TID = "TID"; + + /** El valor de task. */ + private Task task; + + /** El valor de task data. */ + private TaskData taskData; + + /** El valor de htc. */ + private final HumanTaskClient htc; + + /** El valor de tid. */ + private long tid; + + /** El valor de taskname. */ + private long taskname; + + /** El valor de input. */ + private Map input = null; + + /** + * Crea una nueva instancia de TaskUtil. + * + * @throws Exception la exception + */ + private TaskUtil() throws Exception { + htc = new HumanTaskClient(); + } + + /** + * Crea una nueva instancia de TaskUtil. + * + * @throws Exception la exception + */ + public TaskUtil(Task task, HumanTaskClient htc) throws Exception { + this.htc = htc; + this.task = task; + this.tid = this.task.getId(); + taskData = task.getTaskData(); + } + + /** + * Entrega el valor de task. + * + * @return Valor de task + */ + public Task getTask() { + return task; + } + + /** + * Entrega el valor de taskData. + * + * @return Valor de taskData + */ + public TaskData getTaskData() { + return taskData; + } + + /** + * Entrega el valor de tid. + * + * @return Valor de tid + */ + public long getTid() { + return tid; + } + + /** + * Entrega el valor de: taskname + * + * @return long + */ + public long getTaskname() { + return taskname; + } + + /** + * Fija el valor de: taskname + * + * @param taskname + */ + public void setTaskname(long taskname) { + this.taskname = taskname; + } + + /** + * Crea una nueva instancia de task til. + * + * @param pTId the t id + * @throws Exception la exception + */ + public TaskUtil(long pTId) throws Exception { + this(); + tid = pTId; + task = htc.getTaskById(pTId); + taskData = task.getTaskData(); + } + + /** + * Close. + * + * @throws Exception la exception + */ + public void close() throws Exception { + htc.close(); + } + + /** + * Obtiene el valor de task info. + * + * @return Valor de task info + * @throws Exception la exception + */ + public TaskInfo getTaskInfo() throws Exception { + Map m = this.getActualData(); + Object obj = m.get(ProcessUtil.TASK_METADATA); + return (TaskInfo) obj; + } + + /** + * Obtiene el valor del juego de variables de MAIA. + * + * @return Valor de las variables MAIA + * @throws Exception la exception + */ + @SuppressWarnings("unchecked") + public Map getMaia() throws Exception { + Map m = this.getActualData(); + return (Map) m.get(ProcessUtil.DATA); + } + + /** + * Obtiene el Request. + * + * @return Request + * @throws Exception la exception + */ + public Request getRequest() throws Exception { + Map maia = this.getMaia(); + return (Request) maia.get(ProcessUtil.REQUEST); + } + + /** + * Obtiene el valor de actual data. + * + * @return Valor de actual data + * @throws Exception la exception + */ + public Map getActualData() throws Exception { + if (input != null) { + return input; + } + if (taskData.getStatus() == Status.Completed) { + input = htc.getOutputData(task); + } else { + input = htc.getInputData(task); + } + return input; + } + + /** + * Obtiene el valor de status. + * + * @return Valor de status + */ + public Status getStatus() { + return taskData.getStatus(); + } + + /** + * Obtiene el valor de work item id. + * + * @return Valor de work item id + */ + public long getWorkItemId() { + return taskData.getWorkItemId(); + } + + /** + * Obtiene el valor de comments. + * + * @return Valor de comments + * @throws Exception la exception + */ + public List getComments() throws Exception { + return taskData.getComments(); + } + + /** + * Complete. + * + * @param pJournalId the journal id + * @param data the data + * @param pResponse the response + * @param pObs the obs + * @throws Exception la exception + */ + public String complete(String pJournalId, Map data, Responses pResponse, String pObs) throws Exception { + try { + return htc.completeTask(tid, pJournalId, data, pResponse.getCode(), pObs.toUpperCase()); + } catch (Exception e) { + throw new BPMException("BPM502", "NO SE HA PODIDO COMPLETAR LA TAREA {0} ", e, tid); + } + } + + /** + * Start. + * + * @throws Exception la exception + */ + public void start() throws Exception { + try { + htc.startTask(tid); + } catch (Exception e) { + throw new BPMException("BPM501", "NO SE HA PODIDO INICIAR LA TAREA {0} ", e, tid); + } + } + + /** + * Claim. + * + * @param pUser the user + * @throws Exception la exception + */ + public void claim(String pUser) throws Exception { + try { + htc.claimTask(tid, pUser); + } catch (Exception e) { + throw new BPMException("BPM500", "NO SE HA PODIDO RESERVAR LA TAREA {0} PARA EL USUARIO {1}", e, tid, pUser); + } + } + + /** + * Comment. + * + * @param pUser the user + * @param pComment the comment + * @throws Exception la exception + */ + public void comment(String pUser, String pComment) throws Exception { + try { + htc.addComment(tid, pUser, pComment.toUpperCase()); + } catch (Exception e) { + throw new BPMException("BPM504", "NO SE HA PODIDO MODIFICAR LA TAREA {0} ", e, tid); + } + } + + /** + * Reasign. + * + * @param pUser the user + * @throws Exception la exception + */ + public void delegate(String pUser) throws Exception { + try { + htc.delegateTask(tid, taskData.getActualOwner().getId(), pUser); + } catch (Exception e) { + throw new BPMException("BPM504", "NO SE HA PODIDO MODIFICAR LA TAREA {0} ", e, tid); + } + } + + /** + * Obtiene el valor de subject. + * + * @return Valor de subject + * @throws Exception la exception + */ + public String getSubject() throws Exception { + String subject = ""; + Request req = this.getRequest(); + if (req.getSubject() == null) { + req.setSubject(MessageManager.getMessage(req)); + } + subject = req.getSubject(); + return subject; + } + + /** + * Obtiene la descripcion de la regla. + * + * @return descripcion de la regla + * @throws Exception la exception + */ + public String getRuleDescription() throws Exception { + Request req = this.getRequest(); + TaskInfo info = this.getTaskInfo(); + TbpmRulesKey rk = new TbpmRulesKey(info.getRuleCode(), req.getCompany()); + TbpmRules r = TbpmRules.find(PersistenceHelper.getEntityManager(), rk); + if (r != null) { + return " " + r.getDescription(); + } + return ""; + } + + /** + * Obtiene el valor de transaction. + * + * @return Valor de transaction + * @throws Exception la exception + */ + public TransactionDTO getTransaction() throws Exception { + TaskInfo info = this.getTaskInfo(); + return new TransactionDTO(info.getModule(), info.getTransaction(), info.getVersion()); + } + + /** + * Obtiene el valor de detail. + * + * @param pLanguage the language + * @return Valor de detail + * @throws Exception la exception + */ + public String getDetail(String pLanguage) throws Exception { + TaskInfo info = this.getTaskInfo(); + Integer messagecode = info.getMessageCode(); + if (messagecode == null) { + TbpmRulesKey k = new TbpmRulesKey(info.getRuleCode(), ThreadFacade.getSessionData().getCompany()); + TbpmRules r = TbpmRules.find(PersistenceHelper.getEntityManager(), k); + messagecode = r.getMessagecode(); + } + com.fp.bpmlib.messages.MessageManager msg = new com.fp.bpmlib.messages.MessageManager(messagecode, pLanguage, null); + msg.setValue(TaskUtil.BPM_DATA, this.getMaia()); + msg.setValue("request", this.getRequest()); + msg.setValue(ProcessUtil.TASK_METADATA, info); + return msg.getMessage(); + } + + /** + * Obtiene el valor de origin data. + * + * @return Valor de origin data + * @throws Exception la exception + */ + public Map getOriginData() throws Exception { + Map data = new HashMap(); + Request rq = this.getRequest(); + List l = TbpmFieldTransactionOrigin.find(PersistenceHelper.getEntityManager(), rq.getTransactionModule(), + rq.getTransactionCode(), rq.getTransactionVersion()); + for (TbpmFieldTransactionOrigin o : l) { + try { + data.put(o.getPk().getFieldname(), ELEval.eval(rq, o.getExpresionlanguage())); + } catch (PropertyAccessException e) { + continue; + } + } + return data; + } + + /** + * Obtiene el valor de destiny meta data. + * + * @return Valor de destiny meta data + * @throws Exception la exception + */ + public Map getDestinyMetaData() throws Exception { + Map data = new HashMap(); + TransactionDTO trn = this.getTransaction(); + List l = TbpmFieldTransactionMaping.find(PersistenceHelper.getEntityManager(), trn.getModule(), + trn.getTransaction(), trn.getVersion()); + for (TbpmFieldTransactionMaping o : l) { + data.put(o.getFieldscreen(), o.getPk().getFieldname()); + } + return data; + } + + /** + * Obtiene el valor de destiny data. + * + * @return Valor de destiny data + * @throws Exception la exception + */ + public Map getDestinyData() throws Exception { + Map data = new HashMap(); + Map origin = this.getOriginData(); + Map meta = this.getDestinyMetaData(); + for (Entry e : meta.entrySet()) { + data.put(e.getKey(), origin.get(e.getValue())); + } + TransactionDTO trn = this.getTransaction(); + TgeneTransactionKey tKey = new TgeneTransactionKey(trn.getModule(), trn.getTransaction(), trn.getVersion()); + TgeneTransaction trnData = TgeneTransaction.find(PersistenceHelper.getEntityManager(), tKey); + if (trnData != null && trnData.getQuerycode() != null) { + QueryProcessor qp = new QueryProcessor(); + QueryRequest qr = new QueryRequest(); + qr.setResponse(new Response(Response.RESPONSE_OK, "OK")); + qr.setTransactionModule(trn.getModule()); + qr.setTransactionCode(trn.getTransaction()); + qr.setTransactionVersion(trn.getVersion()); + qr.setTransactionModule(trn.getModule()); + for (Entry e : data.entrySet()) { + qr.put(e.getKey(), e.getValue()); + } + qr.addAddtionalInfo("queryalias", trnData.getQuerycode()); + qr.addAddtionalInfo("querytype", "P"); + qp.setQueryRequest(qr); + qp.processQueryByAlias(); + + for (Entry e : qr.getResponse().entrySet()) { + data.put(e.getKey(), e.getValue()); + } + } + return data; + } + + /** + * Entrega el map que almacena datos utilizados en el bpm. + * + * @param request Request a obtener el map de datos utilizados en el jbpm. + * @return Map + * @throws Exception la exception + */ + public static Map getBpmData(Request request) throws Exception { + @SuppressWarnings("unchecked") + Map mdata = (Map) request.get(TaskUtil.BPM_DATA); + if (mdata == null) { + mdata = new HashMap(); + request.put(TaskUtil.BPM_DATA, mdata); + } + return mdata; + } +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/package-info.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/package-info.java new file mode 100644 index 0000000..c36e71e --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/client/package-info.java @@ -0,0 +1,4 @@ +/** + * Provee los componentes para el cliente del Servidor de Tareas. + */ +package com.fp.bpmlib.task.client; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/package-info.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/package-info.java new file mode 100644 index 0000000..7f7ce81 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/package-info.java @@ -0,0 +1,4 @@ +/** + * Provee los componentes necesarios para el manejo del Servidor de Tareas. + */ +package com.fp.bpmlib.task; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/.svn/entries b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/.svn/entries new file mode 100644 index 0000000..f6e0b51 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/.svn/entries @@ -0,0 +1,198 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util +svn://172.17.26.185/COMACO + + + +2014-10-29T05:04:38.445380Z +2082 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +CustomIdentityProvider.java +file + + + + +2022-07-28T03:40:45.795816Z +c7d4a2ecb0224b7c596eb1e8759a0cf5 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +733 + +MaiaUserGroupCallback.java +file + + + + +2022-07-28T03:40:45.795816Z +9c83363057787c771b8f67dff1303fc2 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +1104 + +MaiaApplicationScopeProducer.java +file + + + + +2022-07-28T03:40:45.796816Z +390dbf2432e0fa15fae4c65f35734c35 +2014-10-29T05:04:38.445380Z +2082 +jvaca + + + + + + + + + + + + + + + + + + + + + +1820 + +CustomDeploymentService.java +file + + + + +2022-07-28T03:40:45.796816Z +2d39925f60ea91f32f21e7a3f3b00488 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +1170 + +SimpleWorkItemHandlerProducer.java +file + + + + +2022-07-28T03:40:45.796816Z +685a052ea11e7af655e5d9b48573d388 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +561 + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/.svn/text-base/CustomDeploymentService.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/.svn/text-base/CustomDeploymentService.java.svn-base new file mode 100644 index 0000000..39c7936 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/.svn/text-base/CustomDeploymentService.java.svn-base @@ -0,0 +1,40 @@ +package com.fp.bpmlib.task.util; + + +import java.util.Collection; + +import org.kie.api.runtime.manager.RuntimeManager; +import org.kie.internal.deployment.DeployedUnit; +import org.kie.internal.deployment.DeploymentService; +import org.kie.internal.deployment.DeploymentUnit; + +// plain CustomDeploymentService solves: +// Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [DeploymentService] +// with qualifiers [@Default] at injection point [[field] @Inject private +// org.jbpm.kie.services.impl.form.FormProviderServiceImpl.deploymentService] +// @ApplicationScoped +public class CustomDeploymentService implements DeploymentService { + + @Override + public void deploy(DeploymentUnit deploymentUnit) { + } + + @Override + public void undeploy(DeploymentUnit deploymentUnit) { + } + + @Override + public RuntimeManager getRuntimeManager(String s) { + return null; + } + + @Override + public DeployedUnit getDeployedUnit(String s) { + return null; + } + + @Override + public Collection getDeployedUnits() { + return null; + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/.svn/text-base/CustomIdentityProvider.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/.svn/text-base/CustomIdentityProvider.java.svn-base new file mode 100644 index 0000000..5887816 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/.svn/text-base/CustomIdentityProvider.java.svn-base @@ -0,0 +1,27 @@ +package com.fp.bpmlib.task.util; + + +import java.util.Collections; +import java.util.List; + +import org.jbpm.kie.services.api.IdentityProvider; + +// dummy CustomIdentityProvider solves: +// org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [IdentityProvider] +// with qualifiers [@Default] at injection point [[field] @Inject private +// org.jbpm.kie.services.impl.KModuleDeploymentService.identityProvider] +// @ApplicationScoped +public class CustomIdentityProvider implements IdentityProvider { + + @Override + public String getName() { + return "dummy"; + } + + @Override + public List getRoles() { + + return Collections.emptyList(); + } + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/.svn/text-base/MaiaApplicationScopeProducer.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/.svn/text-base/MaiaApplicationScopeProducer.java.svn-base new file mode 100644 index 0000000..c3dbe53 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/.svn/text-base/MaiaApplicationScopeProducer.java.svn-base @@ -0,0 +1,50 @@ +package com.fp.bpmlib.task.util; + +import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.inject.Produces; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import javax.persistence.PersistenceUnit; + +import org.kie.api.runtime.manager.RuntimeEnvironment; +import org.kie.api.runtime.manager.RuntimeEnvironmentBuilder; + +/** + * Necesita esta claese para que funcione el jbpm, internamente utiliza el EntiyManagerFactory. + * + * @author jorge + */ +@ApplicationScoped +public class MaiaApplicationScopeProducer { + + @PersistenceUnit(unitName = "org.jbpm.domain") + private EntityManagerFactory emf; + + @Produces + public EntityManagerFactory produceEntityManagerFactory() { + if (emf == null) { + emf = Persistence.createEntityManagerFactory("org.jbpm.domain"); + } + return emf; + } + + // @Produces + // @Singleton + // @PerProcessInstance + // @PerRequest + public RuntimeEnvironment produceEnvironment(EntityManagerFactory emf) { + + // RuntimeEnvironment environment = + // RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder().entityManagerFactory(emf) + // .userGroupCallback(usergroupCallback).addAsset(ResourceFactory.newClassPathResource("prueba.bpmn2"), + // ResourceType.BPMN2) + // .get(); + RuntimeEnvironmentBuilder builder = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder().entityManagerFactory(emf); + // builder.userGroupCallback(usergroupCallback); + // builder.registerableItemsFactory(factory); + // builder.addAsset(ResourceFactory.newClassPathResource("prueba.bpmn2"), ResourceType.BPMN2); + RuntimeEnvironment environment = builder.get(); + return environment; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/.svn/text-base/MaiaUserGroupCallback.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/.svn/text-base/MaiaUserGroupCallback.java.svn-base new file mode 100644 index 0000000..16261ab --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/.svn/text-base/MaiaUserGroupCallback.java.svn-base @@ -0,0 +1,39 @@ +package com.fp.bpmlib.task.util; + +import java.util.ArrayList; +import java.util.List; + +import javax.enterprise.inject.Alternative; + +import com.fp.bpmlib.task.client.HumanTaskClient; + +@Alternative +public class MaiaUserGroupCallback implements org.kie.internal.task.api.UserGroupCallback { + + public MaiaUserGroupCallback() { + } + + @Override + public boolean existsUser(String userId) { + return true; + // return userId.equals("jvaca") || userId.equals("john") || userId.equals("mary") || userId.equals("Administrator"); + } + + @Override + public boolean existsGroup(String groupId) { + return true; + // return groupId.equals("PM") || groupId.equals("HR"); + } + + @Override + public List getGroupsForUser(String userId, List groupIds, List allExistingGroupIds) { + List groups = new ArrayList<>(); + try { + groups = HumanTaskClient.groupsByUser(userId); + } catch (Exception e) { + // retorn la lista vacia. + } + + return groups; + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/.svn/text-base/SimpleWorkItemHandlerProducer.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/.svn/text-base/SimpleWorkItemHandlerProducer.java.svn-base new file mode 100644 index 0000000..5d8da12 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/.svn/text-base/SimpleWorkItemHandlerProducer.java.svn-base @@ -0,0 +1,16 @@ +package com.fp.bpmlib.task.util; + +import java.util.HashMap; +import java.util.Map; + +import org.kie.api.runtime.process.WorkItemHandler; +import org.kie.internal.runtime.manager.WorkItemHandlerProducer; + +public class SimpleWorkItemHandlerProducer implements WorkItemHandlerProducer { + + @Override + public Map getWorkItemHandlers(String s, Map stringObjectMap) { + // add any WorkItemHandlers that should be registered on the session + return new HashMap(); + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/CustomDeploymentService.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/CustomDeploymentService.java new file mode 100644 index 0000000..39c7936 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/CustomDeploymentService.java @@ -0,0 +1,40 @@ +package com.fp.bpmlib.task.util; + + +import java.util.Collection; + +import org.kie.api.runtime.manager.RuntimeManager; +import org.kie.internal.deployment.DeployedUnit; +import org.kie.internal.deployment.DeploymentService; +import org.kie.internal.deployment.DeploymentUnit; + +// plain CustomDeploymentService solves: +// Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [DeploymentService] +// with qualifiers [@Default] at injection point [[field] @Inject private +// org.jbpm.kie.services.impl.form.FormProviderServiceImpl.deploymentService] +// @ApplicationScoped +public class CustomDeploymentService implements DeploymentService { + + @Override + public void deploy(DeploymentUnit deploymentUnit) { + } + + @Override + public void undeploy(DeploymentUnit deploymentUnit) { + } + + @Override + public RuntimeManager getRuntimeManager(String s) { + return null; + } + + @Override + public DeployedUnit getDeployedUnit(String s) { + return null; + } + + @Override + public Collection getDeployedUnits() { + return null; + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/CustomIdentityProvider.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/CustomIdentityProvider.java new file mode 100644 index 0000000..5887816 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/CustomIdentityProvider.java @@ -0,0 +1,27 @@ +package com.fp.bpmlib.task.util; + + +import java.util.Collections; +import java.util.List; + +import org.jbpm.kie.services.api.IdentityProvider; + +// dummy CustomIdentityProvider solves: +// org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [IdentityProvider] +// with qualifiers [@Default] at injection point [[field] @Inject private +// org.jbpm.kie.services.impl.KModuleDeploymentService.identityProvider] +// @ApplicationScoped +public class CustomIdentityProvider implements IdentityProvider { + + @Override + public String getName() { + return "dummy"; + } + + @Override + public List getRoles() { + + return Collections.emptyList(); + } + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/MaiaApplicationScopeProducer.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/MaiaApplicationScopeProducer.java new file mode 100644 index 0000000..c3dbe53 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/MaiaApplicationScopeProducer.java @@ -0,0 +1,50 @@ +package com.fp.bpmlib.task.util; + +import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.inject.Produces; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import javax.persistence.PersistenceUnit; + +import org.kie.api.runtime.manager.RuntimeEnvironment; +import org.kie.api.runtime.manager.RuntimeEnvironmentBuilder; + +/** + * Necesita esta claese para que funcione el jbpm, internamente utiliza el EntiyManagerFactory. + * + * @author jorge + */ +@ApplicationScoped +public class MaiaApplicationScopeProducer { + + @PersistenceUnit(unitName = "org.jbpm.domain") + private EntityManagerFactory emf; + + @Produces + public EntityManagerFactory produceEntityManagerFactory() { + if (emf == null) { + emf = Persistence.createEntityManagerFactory("org.jbpm.domain"); + } + return emf; + } + + // @Produces + // @Singleton + // @PerProcessInstance + // @PerRequest + public RuntimeEnvironment produceEnvironment(EntityManagerFactory emf) { + + // RuntimeEnvironment environment = + // RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder().entityManagerFactory(emf) + // .userGroupCallback(usergroupCallback).addAsset(ResourceFactory.newClassPathResource("prueba.bpmn2"), + // ResourceType.BPMN2) + // .get(); + RuntimeEnvironmentBuilder builder = RuntimeEnvironmentBuilder.Factory.get().newDefaultBuilder().entityManagerFactory(emf); + // builder.userGroupCallback(usergroupCallback); + // builder.registerableItemsFactory(factory); + // builder.addAsset(ResourceFactory.newClassPathResource("prueba.bpmn2"), ResourceType.BPMN2); + RuntimeEnvironment environment = builder.get(); + return environment; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/MaiaUserGroupCallback.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/MaiaUserGroupCallback.java new file mode 100644 index 0000000..16261ab --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/MaiaUserGroupCallback.java @@ -0,0 +1,39 @@ +package com.fp.bpmlib.task.util; + +import java.util.ArrayList; +import java.util.List; + +import javax.enterprise.inject.Alternative; + +import com.fp.bpmlib.task.client.HumanTaskClient; + +@Alternative +public class MaiaUserGroupCallback implements org.kie.internal.task.api.UserGroupCallback { + + public MaiaUserGroupCallback() { + } + + @Override + public boolean existsUser(String userId) { + return true; + // return userId.equals("jvaca") || userId.equals("john") || userId.equals("mary") || userId.equals("Administrator"); + } + + @Override + public boolean existsGroup(String groupId) { + return true; + // return groupId.equals("PM") || groupId.equals("HR"); + } + + @Override + public List getGroupsForUser(String userId, List groupIds, List allExistingGroupIds) { + List groups = new ArrayList<>(); + try { + groups = HumanTaskClient.groupsByUser(userId); + } catch (Exception e) { + // retorn la lista vacia. + } + + return groups; + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/SimpleWorkItemHandlerProducer.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/SimpleWorkItemHandlerProducer.java new file mode 100644 index 0000000..5d8da12 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/task/util/SimpleWorkItemHandlerProducer.java @@ -0,0 +1,16 @@ +package com.fp.bpmlib.task.util; + +import java.util.HashMap; +import java.util.Map; + +import org.kie.api.runtime.process.WorkItemHandler; +import org.kie.internal.runtime.manager.WorkItemHandlerProducer; + +public class SimpleWorkItemHandlerProducer implements WorkItemHandlerProducer { + + @Override + public Map getWorkItemHandlers(String s, Map stringObjectMap) { + // add any WorkItemHandlers that should be registered on the session + return new HashMap(); + } +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/.svn/entries b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/.svn/entries new file mode 100644 index 0000000..554e402 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/.svn/entries @@ -0,0 +1,136 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +task +dir + +package-info.java +file + + + + +2022-07-28T03:40:45.687816Z +2dddc1cb1986b5141dd0ff95538780ee +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +113 + +PackageGetter.java +file + + + + +2022-07-28T03:40:45.687816Z +898bc69a8dc2df84d402bb8ca45e7478 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +3222 + +flow +dir + +RuleTrigger.java +file + + + + +2022-07-28T03:40:45.688816Z +4c4d7f214af02621c2a5ef9357a27ddc +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +991 + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/.svn/text-base/PackageGetter.java.netbeans-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/.svn/text-base/PackageGetter.java.netbeans-base new file mode 100644 index 0000000..9bc8d2e --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/.svn/text-base/PackageGetter.java.netbeans-base @@ -0,0 +1,103 @@ +/* + * + */ +package com.fp.bpmlib.transaction; + +import java.io.IOException; +import java.io.InputStream; +import java.net.Authenticator; +import java.net.PasswordAuthentication; +import java.net.URL; +import java.text.MessageFormat; +import java.util.List; + +import com.fp.bpmlib.db.BPMProperties; +import com.fp.common.files.StreamHelper; +import com.fp.common.logger.APPLogger; +import com.fp.common.properties.PropertiesHandler; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.pbpm.gene.TbpmRules; + +// TODO: Auto-generated Javadoc +/** + * Class PackageGetter encargada de. + * + * @author gfiallos + */ +public class PackageGetter extends TransactionRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pReq) throws Exception { + PropertiesHandler ph = BPMProperties.getInstance(); + List data = pReq.getBeans().get("TBPMRULES").getModifiedRecords(); + for (Object object : data) { + TbpmRules rule1 = (TbpmRules) object; + if (ph.getStringValue(BPMProperties.GUVNOR_SECURITY_BASIC_AUTHENTICATION).compareTo("enabled") == 0) { + Authenticator.setDefault(new GuvnorAuthenticator()); + } + String url = MessageFormat.format(ph.getStringValue(BPMProperties.GUVNOR_URL), rule1.getPackagename(), rule1.getSnapshot()); + URL udata = new URL(url); + InputStream ib = null; + try { + ib = udata.openStream(); + rule1.setContent(StreamHelper.streamToBytes(ib)); + pReq.getResponse().put("RELOAD", "OK"); + } catch (IOException e) { + APPLogger.getLogger().debug("IOError: " + e); + pReq.getResponse().put("RELOAD", "ERROR"); + } finally { + if(ib != null){ + ib.close(); + } + } + // InputStream ib = udata.openStream(); + // rule1.setContent(StreamHelper.streamToBytes(ib)); + } + return pReq; + } + + /** + * Reverse process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pReq) throws Exception { + return pReq; + } + +} + +/** + * Clase empleada para la autenticacin con Guvnor + * + * @author gfiallos + * + */ +class GuvnorAuthenticator extends Authenticator { + + @Override + protected PasswordAuthentication getPasswordAuthentication() { + try { + PropertiesHandler ph = BPMProperties.getInstance(); + return new PasswordAuthentication(ph.getStringValue(BPMProperties.GUVNOR_SECURITY_USERNAME), ph.getStringValue( + BPMProperties.GUVNOR_SECURITY_PASSWORD).toCharArray()); + } catch (Exception e) { + throw new RuntimeException(e); + } + + } +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/.svn/text-base/PackageGetter.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/.svn/text-base/PackageGetter.java.svn-base new file mode 100644 index 0000000..9bc8d2e --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/.svn/text-base/PackageGetter.java.svn-base @@ -0,0 +1,103 @@ +/* + * + */ +package com.fp.bpmlib.transaction; + +import java.io.IOException; +import java.io.InputStream; +import java.net.Authenticator; +import java.net.PasswordAuthentication; +import java.net.URL; +import java.text.MessageFormat; +import java.util.List; + +import com.fp.bpmlib.db.BPMProperties; +import com.fp.common.files.StreamHelper; +import com.fp.common.logger.APPLogger; +import com.fp.common.properties.PropertiesHandler; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.pbpm.gene.TbpmRules; + +// TODO: Auto-generated Javadoc +/** + * Class PackageGetter encargada de. + * + * @author gfiallos + */ +public class PackageGetter extends TransactionRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pReq) throws Exception { + PropertiesHandler ph = BPMProperties.getInstance(); + List data = pReq.getBeans().get("TBPMRULES").getModifiedRecords(); + for (Object object : data) { + TbpmRules rule1 = (TbpmRules) object; + if (ph.getStringValue(BPMProperties.GUVNOR_SECURITY_BASIC_AUTHENTICATION).compareTo("enabled") == 0) { + Authenticator.setDefault(new GuvnorAuthenticator()); + } + String url = MessageFormat.format(ph.getStringValue(BPMProperties.GUVNOR_URL), rule1.getPackagename(), rule1.getSnapshot()); + URL udata = new URL(url); + InputStream ib = null; + try { + ib = udata.openStream(); + rule1.setContent(StreamHelper.streamToBytes(ib)); + pReq.getResponse().put("RELOAD", "OK"); + } catch (IOException e) { + APPLogger.getLogger().debug("IOError: " + e); + pReq.getResponse().put("RELOAD", "ERROR"); + } finally { + if(ib != null){ + ib.close(); + } + } + // InputStream ib = udata.openStream(); + // rule1.setContent(StreamHelper.streamToBytes(ib)); + } + return pReq; + } + + /** + * Reverse process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pReq) throws Exception { + return pReq; + } + +} + +/** + * Clase empleada para la autenticacin con Guvnor + * + * @author gfiallos + * + */ +class GuvnorAuthenticator extends Authenticator { + + @Override + protected PasswordAuthentication getPasswordAuthentication() { + try { + PropertiesHandler ph = BPMProperties.getInstance(); + return new PasswordAuthentication(ph.getStringValue(BPMProperties.GUVNOR_SECURITY_USERNAME), ph.getStringValue( + BPMProperties.GUVNOR_SECURITY_PASSWORD).toCharArray()); + } catch (Exception e) { + throw new RuntimeException(e); + } + + } +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/.svn/text-base/RuleTrigger.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/.svn/text-base/RuleTrigger.java.svn-base new file mode 100644 index 0000000..8953b0c --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/.svn/text-base/RuleTrigger.java.svn-base @@ -0,0 +1,44 @@ +/* + * + */ +package com.fp.bpmlib.transaction; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Clase encargada de disparar reglas dada una petición de mantenimiento. + * + * @author gfiallos + */ +public class RuleTrigger extends TransactionRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pRequest the request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + + /** + * Reverse process. + * + * @param pRequest the request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/.svn/text-base/package-info.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..b9e0a7c --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,4 @@ +/** + * Provee los componentes para transacciones en modo mantenimiento. + */ +package com.fp.bpmlib.transaction; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/PackageGetter.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/PackageGetter.java new file mode 100644 index 0000000..9bc8d2e --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/PackageGetter.java @@ -0,0 +1,103 @@ +/* + * + */ +package com.fp.bpmlib.transaction; + +import java.io.IOException; +import java.io.InputStream; +import java.net.Authenticator; +import java.net.PasswordAuthentication; +import java.net.URL; +import java.text.MessageFormat; +import java.util.List; + +import com.fp.bpmlib.db.BPMProperties; +import com.fp.common.files.StreamHelper; +import com.fp.common.logger.APPLogger; +import com.fp.common.properties.PropertiesHandler; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.pbpm.gene.TbpmRules; + +// TODO: Auto-generated Javadoc +/** + * Class PackageGetter encargada de. + * + * @author gfiallos + */ +public class PackageGetter extends TransactionRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pReq) throws Exception { + PropertiesHandler ph = BPMProperties.getInstance(); + List data = pReq.getBeans().get("TBPMRULES").getModifiedRecords(); + for (Object object : data) { + TbpmRules rule1 = (TbpmRules) object; + if (ph.getStringValue(BPMProperties.GUVNOR_SECURITY_BASIC_AUTHENTICATION).compareTo("enabled") == 0) { + Authenticator.setDefault(new GuvnorAuthenticator()); + } + String url = MessageFormat.format(ph.getStringValue(BPMProperties.GUVNOR_URL), rule1.getPackagename(), rule1.getSnapshot()); + URL udata = new URL(url); + InputStream ib = null; + try { + ib = udata.openStream(); + rule1.setContent(StreamHelper.streamToBytes(ib)); + pReq.getResponse().put("RELOAD", "OK"); + } catch (IOException e) { + APPLogger.getLogger().debug("IOError: " + e); + pReq.getResponse().put("RELOAD", "ERROR"); + } finally { + if(ib != null){ + ib.close(); + } + } + // InputStream ib = udata.openStream(); + // rule1.setContent(StreamHelper.streamToBytes(ib)); + } + return pReq; + } + + /** + * Reverse process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pReq) throws Exception { + return pReq; + } + +} + +/** + * Clase empleada para la autenticacin con Guvnor + * + * @author gfiallos + * + */ +class GuvnorAuthenticator extends Authenticator { + + @Override + protected PasswordAuthentication getPasswordAuthentication() { + try { + PropertiesHandler ph = BPMProperties.getInstance(); + return new PasswordAuthentication(ph.getStringValue(BPMProperties.GUVNOR_SECURITY_USERNAME), ph.getStringValue( + BPMProperties.GUVNOR_SECURITY_PASSWORD).toCharArray()); + } catch (Exception e) { + throw new RuntimeException(e); + } + + } +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/RuleTrigger.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/RuleTrigger.java new file mode 100644 index 0000000..8953b0c --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/RuleTrigger.java @@ -0,0 +1,44 @@ +/* + * + */ +package com.fp.bpmlib.transaction; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Clase encargada de disparar reglas dada una petición de mantenimiento. + * + * @author gfiallos + */ +public class RuleTrigger extends TransactionRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pRequest the request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + + /** + * Reverse process. + * + * @param pRequest the request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/entries b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/entries new file mode 100644 index 0000000..8dcd6d0 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/entries @@ -0,0 +1,266 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +StartFlowNewOnly.java +file + + + + +2022-07-28T03:40:45.653816Z +a14717cf373ef720814d10b1ba5ab27b +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +734 + +package-info.java +file + + + + +2022-07-28T03:40:45.653816Z +8d8eee3fc97cac7a451e5eda3e61c9d5 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +106 + +StartFlow.java +file + + + + +2022-07-28T03:40:45.653816Z +e764d3aacdbf3aecaf517a293774a327 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1645 + +StartFlowEndNewOnly.java +file + + + + +2022-07-28T03:40:45.653816Z +a66ae6c838746a5efce9f88fc5aefa46 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +743 + +StartFlowMemoryNewOnly.java +file + + + + +2022-07-28T03:40:45.654816Z +027469b244324acf9b74509421e491f3 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +752 + +StartFlowEnd.java +file + + + + +2022-07-28T03:40:45.654816Z +e49b8d6e2f1b3a116d3e9bf0dbd7a873 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +846 + +StartFlowMemory.java +file + + + + +2022-07-28T03:40:45.654816Z +a0e2cb324b2ffb117edfe4fc2fe29137 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1419 + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/text-base/StartFlow.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/text-base/StartFlow.java.svn-base new file mode 100644 index 0000000..bd0807e --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/text-base/StartFlow.java.svn-base @@ -0,0 +1,64 @@ +/* + * + */ +package com.fp.bpmlib.transaction.flow; + +import com.fp.bpmlib.Flujo; +import com.fp.bpmlib.RegisterFlow; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; + +/** + * Class StartFlow encargada de. + * + * @author jvaca + * @version 2.1 + */ +public class StartFlow extends TransactionRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** El valor de completed. */ + protected boolean completed = false; + + /** El valor de p. */ + protected Flujo flujo; + + /** + * Normal process. + * + * @param pRequest the request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + try { + flujo = new Flujo(); + flujo.iniciar(this.flow, pRequest); + if (this.flujo.getProcessInstance().getState() != org.kie.api.runtime.process.ProcessInstance.STATE_COMPLETED) { + RegisterFlow rf = new RegisterFlow(this.flujo, pRequest); + rf.registerFlow(); + } else { + this.completed = true; + } + } finally { + //la session se cierra automaticamente al trabajar con JTA. + } + return pRequest; + } + + /** + * Reverse process. + * + * @param pRequest the request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/text-base/StartFlowEnd.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/text-base/StartFlowEnd.java.svn-base new file mode 100644 index 0000000..5ea5b8b --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/text-base/StartFlowEnd.java.svn-base @@ -0,0 +1,36 @@ +/* + * + */ +package com.fp.bpmlib.transaction.flow; + +import com.fp.bpmlib.BPMException; +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Class StartFlowEnd encargada de. + * + * @author gfiallos + */ +public class StartFlowEnd extends StartFlow { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pRequest the request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + SaveRequest sr = super.normalProcess(pRequest); + if (!this.completed) { + throw new BPMException("BPM-0006", "SE HA INICIADO UN FLUJO DE AUTORIZACION"); + } + return sr; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/text-base/StartFlowEndNewOnly.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/text-base/StartFlowEndNewOnly.java.svn-base new file mode 100644 index 0000000..fbcc7ac --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/text-base/StartFlowEndNewOnly.java.svn-base @@ -0,0 +1,35 @@ +/* + * + */ +package com.fp.bpmlib.transaction.flow; + +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Class StartFlowEndNewOnly encargada de. + * + * @author gfiallos + */ +public class StartFlowEndNewOnly extends StartFlowEnd { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pRequest the request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + if (!this.isNew(pRequest)) { + return pRequest; + } + return super.normalProcess(pRequest); + + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/text-base/StartFlowMemory.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/text-base/StartFlowMemory.java.svn-base new file mode 100644 index 0000000..d4a4321 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/text-base/StartFlowMemory.java.svn-base @@ -0,0 +1,56 @@ +/* + * + */ +package com.fp.bpmlib.transaction.flow; + +import org.kie.api.runtime.process.ProcessInstance; + +import com.fp.bpmlib.BPMException; +import com.fp.bpmlib.Flujo; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; + +/** + * Class StartFlowMemory encargada de. + * + * @author gfiallos + */ +public class StartFlowMemory extends TransactionRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pRequest the request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + Flujo flujo = new Flujo(); + try { + flujo.iniciar(this.flow, pRequest); + if (flujo.getProcessInstance().getState() != ProcessInstance.STATE_COMPLETED) { + throw new BPMException("BPM-0005", "EL FLUJO {0} NO ESTA FINALIZADO", flujo.getProcessInstance().getId()); + } + return pRequest; + } finally { + + } + } + + /** + * Reverse process. + * + * @param pRequest the request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/text-base/StartFlowMemoryNewOnly.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/text-base/StartFlowMemoryNewOnly.java.svn-base new file mode 100644 index 0000000..f8e1e12 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/text-base/StartFlowMemoryNewOnly.java.svn-base @@ -0,0 +1,35 @@ +/* + * + */ +package com.fp.bpmlib.transaction.flow; + +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Class StartFlowMemoryNewOnly encargada de. + * + * @author gfiallos + */ +public class StartFlowMemoryNewOnly extends StartFlowMemory { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pRequest the request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + + if (!this.isNew(pRequest)) { + return pRequest; + } + return super.normalProcess(pRequest); + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/text-base/StartFlowNewOnly.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/text-base/StartFlowNewOnly.java.svn-base new file mode 100644 index 0000000..52f67e2 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/text-base/StartFlowNewOnly.java.svn-base @@ -0,0 +1,35 @@ +/* + * + */ +package com.fp.bpmlib.transaction.flow; + +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Class StartFlowNewOnly encargada de. + * + * @author gfiallos + */ +public class StartFlowNewOnly extends StartFlow { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pRequest the request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + if (!this.isNew(pRequest)) { + return pRequest; + } + return super.normalProcess(pRequest); + + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/text-base/package-info.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..554b99f --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,4 @@ +/** + * Provee los componentes encargados de iniciar flujos. + */ +package com.fp.bpmlib.transaction.flow; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/StartFlow.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/StartFlow.java new file mode 100644 index 0000000..bd0807e --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/StartFlow.java @@ -0,0 +1,64 @@ +/* + * + */ +package com.fp.bpmlib.transaction.flow; + +import com.fp.bpmlib.Flujo; +import com.fp.bpmlib.RegisterFlow; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; + +/** + * Class StartFlow encargada de. + * + * @author jvaca + * @version 2.1 + */ +public class StartFlow extends TransactionRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** El valor de completed. */ + protected boolean completed = false; + + /** El valor de p. */ + protected Flujo flujo; + + /** + * Normal process. + * + * @param pRequest the request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + try { + flujo = new Flujo(); + flujo.iniciar(this.flow, pRequest); + if (this.flujo.getProcessInstance().getState() != org.kie.api.runtime.process.ProcessInstance.STATE_COMPLETED) { + RegisterFlow rf = new RegisterFlow(this.flujo, pRequest); + rf.registerFlow(); + } else { + this.completed = true; + } + } finally { + //la session se cierra automaticamente al trabajar con JTA. + } + return pRequest; + } + + /** + * Reverse process. + * + * @param pRequest the request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/StartFlowEnd.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/StartFlowEnd.java new file mode 100644 index 0000000..5ea5b8b --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/StartFlowEnd.java @@ -0,0 +1,36 @@ +/* + * + */ +package com.fp.bpmlib.transaction.flow; + +import com.fp.bpmlib.BPMException; +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Class StartFlowEnd encargada de. + * + * @author gfiallos + */ +public class StartFlowEnd extends StartFlow { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pRequest the request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + SaveRequest sr = super.normalProcess(pRequest); + if (!this.completed) { + throw new BPMException("BPM-0006", "SE HA INICIADO UN FLUJO DE AUTORIZACION"); + } + return sr; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/StartFlowEndNewOnly.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/StartFlowEndNewOnly.java new file mode 100644 index 0000000..fbcc7ac --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/StartFlowEndNewOnly.java @@ -0,0 +1,35 @@ +/* + * + */ +package com.fp.bpmlib.transaction.flow; + +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Class StartFlowEndNewOnly encargada de. + * + * @author gfiallos + */ +public class StartFlowEndNewOnly extends StartFlowEnd { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pRequest the request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + if (!this.isNew(pRequest)) { + return pRequest; + } + return super.normalProcess(pRequest); + + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/StartFlowMemory.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/StartFlowMemory.java new file mode 100644 index 0000000..d4a4321 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/StartFlowMemory.java @@ -0,0 +1,56 @@ +/* + * + */ +package com.fp.bpmlib.transaction.flow; + +import org.kie.api.runtime.process.ProcessInstance; + +import com.fp.bpmlib.BPMException; +import com.fp.bpmlib.Flujo; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; + +/** + * Class StartFlowMemory encargada de. + * + * @author gfiallos + */ +public class StartFlowMemory extends TransactionRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pRequest the request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + Flujo flujo = new Flujo(); + try { + flujo.iniciar(this.flow, pRequest); + if (flujo.getProcessInstance().getState() != ProcessInstance.STATE_COMPLETED) { + throw new BPMException("BPM-0005", "EL FLUJO {0} NO ESTA FINALIZADO", flujo.getProcessInstance().getId()); + } + return pRequest; + } finally { + + } + } + + /** + * Reverse process. + * + * @param pRequest the request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + +} \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/StartFlowMemoryNewOnly.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/StartFlowMemoryNewOnly.java new file mode 100644 index 0000000..f8e1e12 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/StartFlowMemoryNewOnly.java @@ -0,0 +1,35 @@ +/* + * + */ +package com.fp.bpmlib.transaction.flow; + +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Class StartFlowMemoryNewOnly encargada de. + * + * @author gfiallos + */ +public class StartFlowMemoryNewOnly extends StartFlowMemory { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pRequest the request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + + if (!this.isNew(pRequest)) { + return pRequest; + } + return super.normalProcess(pRequest); + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/StartFlowNewOnly.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/StartFlowNewOnly.java new file mode 100644 index 0000000..52f67e2 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/StartFlowNewOnly.java @@ -0,0 +1,35 @@ +/* + * + */ +package com.fp.bpmlib.transaction.flow; + +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Class StartFlowNewOnly encargada de. + * + * @author gfiallos + */ +public class StartFlowNewOnly extends StartFlow { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pRequest the request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + if (!this.isNew(pRequest)) { + return pRequest; + } + return super.normalProcess(pRequest); + + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/package-info.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/package-info.java new file mode 100644 index 0000000..554b99f --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/flow/package-info.java @@ -0,0 +1,4 @@ +/** + * Provee los componentes encargados de iniciar flujos. + */ +package com.fp.bpmlib.transaction.flow; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/package-info.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/package-info.java new file mode 100644 index 0000000..b9e0a7c --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/package-info.java @@ -0,0 +1,4 @@ +/** + * Provee los componentes para transacciones en modo mantenimiento. + */ +package com.fp.bpmlib.transaction; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/entries b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/entries new file mode 100644 index 0000000..3617ce6 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/entries @@ -0,0 +1,402 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +AddResource.java +file + + + + +2022-07-28T03:40:45.597815Z +fc0b10d27fe6f0be0bd545702ff02354 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1249 + +TaskStart.java +file + + + + +2022-07-28T03:40:45.597815Z +74ad4cd8f9a04987a99bcc7ff01af4e2 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1162 + +ServerManager.java +file + + + + +2022-07-28T03:40:45.598815Z +704747e6cc4d26d14d1320770948520c +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1470 + +package-info.java +file + + + + +2022-07-28T03:40:45.598815Z +49c7e25d881ed6227943b9e9647bb66b +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +108 + +TaskUpdater.java +file + + + + +2022-07-28T03:40:45.598815Z +9e090e950fb8a3d5f845c1f92f2cfb03 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1680 + +AddGroups.java +file + + + + +2022-07-28T03:40:45.598815Z +fffa2c663bed2c91e18f7033dd484db8 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1696 + +TaskClaim.java +file + + + + +2022-07-28T03:40:45.599815Z +9cce84308728789d7c59d6d81117dc31 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1176 + +TaskComments.java +file + + + + +2022-07-28T03:40:45.599815Z +057c53473df2fdd2ed22ed8035ad3180 +2014-10-17T05:12:41.195407Z +1664 +cpiedra + + + + + + + + + + + + + + + + + + + + + +1338 + +AddUsers.java +file + + + + +2022-07-28T03:40:45.599815Z +d13cfb52a64add6bd1a17795b39d7672 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1759 + +TaskComplete.java +file + + + + +2022-07-28T03:40:45.599815Z +afb9884ea7e440c6aa2c1190ee1522c0 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +2077 + +TaskDelegate.java +file + + + + +2022-07-28T03:40:45.600815Z +6ff2deab67063f7e257b2e19468b9642 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1185 + diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/AddGroups.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/AddGroups.java.svn-base new file mode 100644 index 0000000..dcb7f91 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/AddGroups.java.svn-base @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.bpmlib.transaction.task; + +import java.util.List; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.pbpm.gene.TbpmGroups; + +// TODO: Auto-generated Javadoc +/** + * Class AddGroups encargada de. + * + * @author BPTWPA + */ +public class AddGroups extends TransactionRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pSaveRequest the save request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + + List tbpmGroups = pSaveRequest.getSaveBeanModifiedRecords("TBPMGROUPS"); + if (tbpmGroups != null) { + for (Object objs : tbpmGroups) { + try { + TbpmGroups groups = (TbpmGroups) objs; + //TaskServerSingleton.getInstance().getDaemon().addGroup(groups.getPk().getGroupcode()); + } catch (Exception e) { + APPLogger.getLogger().warn(e, e); + } + } + } + return pSaveRequest; + } + + /** + * Reverse process. + * + * @param pSaveRequest the save request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/AddResource.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/AddResource.java.svn-base new file mode 100644 index 0000000..cbc840f --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/AddResource.java.svn-base @@ -0,0 +1,51 @@ +/* + * + */ +package com.fp.bpmlib.transaction.task; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Class AddResource encargada de. + * + * @author gfiallos + */ +public class AddResource extends TransactionRule { + + /** Constante serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pReq) throws Exception { + String type = (String) pReq.get("TYPE"); + String name = (String) pReq.get("NAME"); + if ("U".equals(type)) { + //TaskServerSingleton.getInstance().getDaemon().addUser(name); + } else { + //TaskServerSingleton.getInstance().getDaemon().addGroup(name); + } + return pReq; + } + + /** + * Reverse process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pReq) throws Exception { + return pReq; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/AddUsers.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/AddUsers.java.svn-base new file mode 100644 index 0000000..7430661 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/AddUsers.java.svn-base @@ -0,0 +1,62 @@ +/* + * + */ +package com.fp.bpmlib.transaction.task; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +// TODO: Auto-generated Javadoc +/** + * Class AddUsers encargada de. + * + * @author gfiallos + */ +public class AddUsers extends TransactionRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pSaveRequest the save request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) pSaveRequest.getSaveBeanModifiedObject("TSAFEUSERDETAIL"); + if (tsafeUserDetail == null) { + tsafeUserDetail = (TsafeUserDetail) pSaveRequest.getSaveBeanModifiedObject("USERDETAIL"); + } + if (tsafeUserDetail == null) { + return pSaveRequest; + } + String isuserbpm = tsafeUserDetail.getIsuserbpm(); + if (Constant.ifYes(isuserbpm)) { + try { + //TaskServerSingleton.getInstance().getDaemon().addUser(tsafeUserDetail.getPk().getUsercode()); + } catch (Exception e) { + // + } + } + return pSaveRequest; + } + + /** + * Reverse process. + * + * @param pSaveRequest the save request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + + return pSaveRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/ServerManager.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/ServerManager.java.svn-base new file mode 100644 index 0000000..aff4c43 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/ServerManager.java.svn-base @@ -0,0 +1,54 @@ +/* + * + */ +package com.fp.bpmlib.transaction.task; + +import com.fp.base.persistence.util.job.ServiceManager; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Clase ServerManager encargada de iniciar o detener el Servidor de Tareas. + * + * @author gfiallos + */ +public class ServerManager extends TransactionRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pSaveRequest the save request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + String status = (String) pSaveRequest.get("status"); + String code = (String) pSaveRequest.get("code"); + ServiceManager sm = new ServiceManager(); + if ("I".equals(status)) { + sm.startService(code); + } else { + sm.stopService(code); + } + pSaveRequest.getResponse().put("TSStatus", sm.isRunning(code)); + return pSaveRequest; + } + + /** + * Reverse process. + * + * @param pSaveRequest the save request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/TaskClaim.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/TaskClaim.java.svn-base new file mode 100644 index 0000000..987cb36 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/TaskClaim.java.svn-base @@ -0,0 +1,52 @@ +/* + * + */ +package com.fp.bpmlib.transaction.task; + +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Class TaskClaim encargada de. + * + * @author gfiallos + */ +public class TaskClaim extends TransactionRule { + + /** Constante serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pReq) throws Exception { + Long tid = pReq.getLong(TaskUtil.BPM_TID); + TaskUtil t = new TaskUtil(tid); + try { + t.claim(pReq.getUser()); + } finally { + t.close(); + } + return pReq; + } + + /** + * Reverse process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pReq) throws Exception { + return pReq; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/TaskComments.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/TaskComments.java.svn-base new file mode 100644 index 0000000..6d04d5c --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/TaskComments.java.svn-base @@ -0,0 +1,56 @@ +/* + * + */ +package com.fp.bpmlib.transaction.task; + +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Class TaskComplete encargada de completar tareas. + * + * @author gfiallos + */ +public class TaskComments extends TransactionRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pReq) throws Exception { + if (pReq.get(TaskUtil.BPM_TID) == null) { + return pReq; + } + long tid = pReq.getLong(TaskUtil.BPM_TID); + TaskUtil util = new TaskUtil(tid); + // util + try { + util.comment(pReq.getUser(), pReq.getString(TaskUtil.BPM_OBS)); + } finally { + util.close(); + } + return pReq; + } + + /** + * Reverse process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pReq) throws Exception { + return pReq; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/TaskComplete.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/TaskComplete.java.svn-base new file mode 100644 index 0000000..b9f6348 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/TaskComplete.java.svn-base @@ -0,0 +1,70 @@ +/* + * + */ +package com.fp.bpmlib.transaction.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.common.logger.APPLogger; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.simple.dto.Responses; + +// TODO: Auto-generated Javadoc +/** + * Class TaskComplete encargada de completar tareas. + * + * @author gfiallos + */ +public class TaskComplete extends TransactionRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pReq) throws Exception { + if (pReq.get(TaskUtil.BPM_TID) == null) { + return pReq; + } + // SaveProcessor.saveAndFlush(pReq); + long tid = pReq.getLong(TaskUtil.BPM_TID); + TaskUtil util = new TaskUtil(tid); + try { + @SuppressWarnings("unchecked") + Map data = (Map) pReq.get(TaskUtil.BPM_DATA); + APPLogger.getLogger().warn("Parametros a la Tarea " + data); + if (data == null) { + data = new HashMap(); + } + Responses resp = Responses.findResponse(pReq.getString(TaskUtil.BPM_STATUS)); + data.put("datosmail", pReq.get("datosmail") == null ? "" : pReq.get("datosmail")); + String taskname = util.complete(pReq.getJournalId(), data, resp, pReq.getString(TaskUtil.BPM_OBS)); + pReq.put("taskname", taskname); + } finally { + util.close(); + } + return pReq; + } + + /** + * Reverse process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pReq) throws Exception { + return pReq; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/TaskDelegate.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/TaskDelegate.java.svn-base new file mode 100644 index 0000000..496ce92 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/TaskDelegate.java.svn-base @@ -0,0 +1,52 @@ +/* + * + */ +package com.fp.bpmlib.transaction.task; + +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Class TaskDelegate encargada de. + * + * @author gfiallos + */ +public class TaskDelegate extends TransactionRule { + + /** Constante serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pReq) throws Exception { + Long tid = pReq.getLong(TaskUtil.BPM_TID); + TaskUtil t = new TaskUtil(tid); + try { + t.delegate(pReq.getUser()); + } finally { + t.close(); + } + return pReq; + } + + /** + * Reverse process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pReq) throws Exception { + return pReq; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/TaskStart.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/TaskStart.java.svn-base new file mode 100644 index 0000000..1ebec94 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/TaskStart.java.svn-base @@ -0,0 +1,52 @@ +/* + * + */ +package com.fp.bpmlib.transaction.task; + +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Class TaskStart encargada de. + * + * @author gfiallos + */ +public class TaskStart extends TransactionRule { + + /** Constante serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pReq) throws Exception { + Long tid = pReq.getLong(TaskUtil.BPM_TID); + TaskUtil t = new TaskUtil(tid); + try { + t.start(); + } finally { + t.close(); + } + return pReq; + } + + /** + * Reverse process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pReq) throws Exception { + return pReq; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/TaskUpdater.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/TaskUpdater.java.svn-base new file mode 100644 index 0000000..675d3b5 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/TaskUpdater.java.svn-base @@ -0,0 +1,67 @@ +/* + * + */ +package com.fp.bpmlib.transaction.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.simple.dto.Responses; + +// TODO: Auto-generated Javadoc +/** + * Class TaskUpdater encargada de. + * + * @author gfiallos + */ +public class TaskUpdater extends TransactionRule { + + /** Constante serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pReq) throws Exception { + String status = pReq.getString("STATUS"); + Long tid = pReq.getLong("TID"); + TaskUtil t = new TaskUtil(tid); + try { + switch (status.charAt(0)) { + case 'S': + t.start(); + break; + case 'C': + Map data = new HashMap(); + t.complete(pReq.getJournalId(), data, Responses.OK, "OBS"); + break; + default: + throw new Exception("Error " + status); + } + } finally { + t.close(); + } + return pReq; + } + + /** + * Reverse process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pReq) throws Exception { + return pReq; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/package-info.java.svn-base b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..5c42bff --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,4 @@ +/** + * Provee los comonentes para la manipulación de Tareas. + */ +package com.fp.bpmlib.transaction.task; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/AddGroups.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/AddGroups.java new file mode 100644 index 0000000..dcb7f91 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/AddGroups.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.bpmlib.transaction.task; + +import java.util.List; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.pbpm.gene.TbpmGroups; + +// TODO: Auto-generated Javadoc +/** + * Class AddGroups encargada de. + * + * @author BPTWPA + */ +public class AddGroups extends TransactionRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pSaveRequest the save request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + + List tbpmGroups = pSaveRequest.getSaveBeanModifiedRecords("TBPMGROUPS"); + if (tbpmGroups != null) { + for (Object objs : tbpmGroups) { + try { + TbpmGroups groups = (TbpmGroups) objs; + //TaskServerSingleton.getInstance().getDaemon().addGroup(groups.getPk().getGroupcode()); + } catch (Exception e) { + APPLogger.getLogger().warn(e, e); + } + } + } + return pSaveRequest; + } + + /** + * Reverse process. + * + * @param pSaveRequest the save request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/AddResource.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/AddResource.java new file mode 100644 index 0000000..cbc840f --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/AddResource.java @@ -0,0 +1,51 @@ +/* + * + */ +package com.fp.bpmlib.transaction.task; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Class AddResource encargada de. + * + * @author gfiallos + */ +public class AddResource extends TransactionRule { + + /** Constante serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pReq) throws Exception { + String type = (String) pReq.get("TYPE"); + String name = (String) pReq.get("NAME"); + if ("U".equals(type)) { + //TaskServerSingleton.getInstance().getDaemon().addUser(name); + } else { + //TaskServerSingleton.getInstance().getDaemon().addGroup(name); + } + return pReq; + } + + /** + * Reverse process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pReq) throws Exception { + return pReq; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/AddUsers.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/AddUsers.java new file mode 100644 index 0000000..7430661 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/AddUsers.java @@ -0,0 +1,62 @@ +/* + * + */ +package com.fp.bpmlib.transaction.task; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +// TODO: Auto-generated Javadoc +/** + * Class AddUsers encargada de. + * + * @author gfiallos + */ +public class AddUsers extends TransactionRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pSaveRequest the save request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) pSaveRequest.getSaveBeanModifiedObject("TSAFEUSERDETAIL"); + if (tsafeUserDetail == null) { + tsafeUserDetail = (TsafeUserDetail) pSaveRequest.getSaveBeanModifiedObject("USERDETAIL"); + } + if (tsafeUserDetail == null) { + return pSaveRequest; + } + String isuserbpm = tsafeUserDetail.getIsuserbpm(); + if (Constant.ifYes(isuserbpm)) { + try { + //TaskServerSingleton.getInstance().getDaemon().addUser(tsafeUserDetail.getPk().getUsercode()); + } catch (Exception e) { + // + } + } + return pSaveRequest; + } + + /** + * Reverse process. + * + * @param pSaveRequest the save request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + + return pSaveRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/ServerManager.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/ServerManager.java new file mode 100644 index 0000000..aff4c43 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/ServerManager.java @@ -0,0 +1,54 @@ +/* + * + */ +package com.fp.bpmlib.transaction.task; + +import com.fp.base.persistence.util.job.ServiceManager; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Clase ServerManager encargada de iniciar o detener el Servidor de Tareas. + * + * @author gfiallos + */ +public class ServerManager extends TransactionRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pSaveRequest the save request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + String status = (String) pSaveRequest.get("status"); + String code = (String) pSaveRequest.get("code"); + ServiceManager sm = new ServiceManager(); + if ("I".equals(status)) { + sm.startService(code); + } else { + sm.stopService(code); + } + pSaveRequest.getResponse().put("TSStatus", sm.isRunning(code)); + return pSaveRequest; + } + + /** + * Reverse process. + * + * @param pSaveRequest the save request + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/TaskClaim.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/TaskClaim.java new file mode 100644 index 0000000..987cb36 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/TaskClaim.java @@ -0,0 +1,52 @@ +/* + * + */ +package com.fp.bpmlib.transaction.task; + +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Class TaskClaim encargada de. + * + * @author gfiallos + */ +public class TaskClaim extends TransactionRule { + + /** Constante serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pReq) throws Exception { + Long tid = pReq.getLong(TaskUtil.BPM_TID); + TaskUtil t = new TaskUtil(tid); + try { + t.claim(pReq.getUser()); + } finally { + t.close(); + } + return pReq; + } + + /** + * Reverse process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pReq) throws Exception { + return pReq; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/TaskComments.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/TaskComments.java new file mode 100644 index 0000000..6d04d5c --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/TaskComments.java @@ -0,0 +1,56 @@ +/* + * + */ +package com.fp.bpmlib.transaction.task; + +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Class TaskComplete encargada de completar tareas. + * + * @author gfiallos + */ +public class TaskComments extends TransactionRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pReq) throws Exception { + if (pReq.get(TaskUtil.BPM_TID) == null) { + return pReq; + } + long tid = pReq.getLong(TaskUtil.BPM_TID); + TaskUtil util = new TaskUtil(tid); + // util + try { + util.comment(pReq.getUser(), pReq.getString(TaskUtil.BPM_OBS)); + } finally { + util.close(); + } + return pReq; + } + + /** + * Reverse process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pReq) throws Exception { + return pReq; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/TaskComplete.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/TaskComplete.java new file mode 100644 index 0000000..b9f6348 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/TaskComplete.java @@ -0,0 +1,70 @@ +/* + * + */ +package com.fp.bpmlib.transaction.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.common.logger.APPLogger; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.simple.dto.Responses; + +// TODO: Auto-generated Javadoc +/** + * Class TaskComplete encargada de completar tareas. + * + * @author gfiallos + */ +public class TaskComplete extends TransactionRule { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pReq) throws Exception { + if (pReq.get(TaskUtil.BPM_TID) == null) { + return pReq; + } + // SaveProcessor.saveAndFlush(pReq); + long tid = pReq.getLong(TaskUtil.BPM_TID); + TaskUtil util = new TaskUtil(tid); + try { + @SuppressWarnings("unchecked") + Map data = (Map) pReq.get(TaskUtil.BPM_DATA); + APPLogger.getLogger().warn("Parametros a la Tarea " + data); + if (data == null) { + data = new HashMap(); + } + Responses resp = Responses.findResponse(pReq.getString(TaskUtil.BPM_STATUS)); + data.put("datosmail", pReq.get("datosmail") == null ? "" : pReq.get("datosmail")); + String taskname = util.complete(pReq.getJournalId(), data, resp, pReq.getString(TaskUtil.BPM_OBS)); + pReq.put("taskname", taskname); + } finally { + util.close(); + } + return pReq; + } + + /** + * Reverse process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pReq) throws Exception { + return pReq; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/TaskDelegate.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/TaskDelegate.java new file mode 100644 index 0000000..496ce92 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/TaskDelegate.java @@ -0,0 +1,52 @@ +/* + * + */ +package com.fp.bpmlib.transaction.task; + +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Class TaskDelegate encargada de. + * + * @author gfiallos + */ +public class TaskDelegate extends TransactionRule { + + /** Constante serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pReq) throws Exception { + Long tid = pReq.getLong(TaskUtil.BPM_TID); + TaskUtil t = new TaskUtil(tid); + try { + t.delegate(pReq.getUser()); + } finally { + t.close(); + } + return pReq; + } + + /** + * Reverse process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pReq) throws Exception { + return pReq; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/TaskStart.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/TaskStart.java new file mode 100644 index 0000000..1ebec94 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/TaskStart.java @@ -0,0 +1,52 @@ +/* + * + */ +package com.fp.bpmlib.transaction.task; + +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Class TaskStart encargada de. + * + * @author gfiallos + */ +public class TaskStart extends TransactionRule { + + /** Constante serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pReq) throws Exception { + Long tid = pReq.getLong(TaskUtil.BPM_TID); + TaskUtil t = new TaskUtil(tid); + try { + t.start(); + } finally { + t.close(); + } + return pReq; + } + + /** + * Reverse process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pReq) throws Exception { + return pReq; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/TaskUpdater.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/TaskUpdater.java new file mode 100644 index 0000000..675d3b5 --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/TaskUpdater.java @@ -0,0 +1,67 @@ +/* + * + */ +package com.fp.bpmlib.transaction.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.simple.dto.Responses; + +// TODO: Auto-generated Javadoc +/** + * Class TaskUpdater encargada de. + * + * @author gfiallos + */ +public class TaskUpdater extends TransactionRule { + + /** Constante serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Normal process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pReq) throws Exception { + String status = pReq.getString("STATUS"); + Long tid = pReq.getLong("TID"); + TaskUtil t = new TaskUtil(tid); + try { + switch (status.charAt(0)) { + case 'S': + t.start(); + break; + case 'C': + Map data = new HashMap(); + t.complete(pReq.getJournalId(), data, Responses.OK, "OBS"); + break; + default: + throw new Exception("Error " + status); + } + } finally { + t.close(); + } + return pReq; + } + + /** + * Reverse process. + * + * @param pReq the req + * @return save request + * @throws Exception la exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pReq) throws Exception { + return pReq; + } + +} diff --git a/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/package-info.java b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/package-info.java new file mode 100644 index 0000000..5c42bff --- /dev/null +++ b/base/bpm/bpmlib/src/main/java/com/fp/bpmlib/transaction/task/package-info.java @@ -0,0 +1,4 @@ +/** + * Provee los comonentes para la manipulación de Tareas. + */ +package com.fp.bpmlib.transaction.task; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/.svn/entries b/base/bpm/bpmlib/src/main/resources/.svn/entries new file mode 100644 index 0000000..0c6f128 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/.svn/entries @@ -0,0 +1,170 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/resources +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ChangeSet.xml +file + + + + +2022-07-28T03:40:46.209818Z +598e270b1002d81ae85fa52176eb9c4e +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +456 + +bpmmessages.properties +file + + + + +2022-07-28T03:40:46.210818Z +6c4fee573c6282c868f85ea16f766f16 +2014-12-17T10:49:55.348577Z +3562 +gbenavides + + + + + + + + + + + + + + + + + + + + + +1103 + +flows.xml +file + + + + +2022-07-28T03:40:46.210818Z +0b8e78d19d8a4a41575a17f4e2a19a57 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +632 + +flows +dir + +rules +dir + +change-set.xml +file + + + + +2022-07-28T03:40:46.210818Z +0b8e78d19d8a4a41575a17f4e2a19a57 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +632 + diff --git a/base/bpm/bpmlib/src/main/resources/.svn/text-base/ChangeSet.xml.svn-base b/base/bpm/bpmlib/src/main/resources/.svn/text-base/ChangeSet.xml.svn-base new file mode 100644 index 0000000..c9cb3fa --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/.svn/text-base/ChangeSet.xml.svn-base @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/.svn/text-base/bpmmessages.properties.svn-base b/base/bpm/bpmlib/src/main/resources/.svn/text-base/bpmmessages.properties.svn-base new file mode 100644 index 0000000..8b79cc2 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/.svn/text-base/bpmmessages.properties.svn-base @@ -0,0 +1,31 @@ +BPM-0001=LA REGLA {0} NO PUDO SER ENCONTRADA +BPM-0002=LA REGLA {0} NO PUEDE SER EVALUADA CON {1} +BPM-0003=LA REGLA {0} NO ESTA DISPONIBLE +BPM-0004=LA INSTANCIA {0} NO ESTA DISPONIBLE O YA FUE FINALIZADA +BPM-0005=EL FLUJO {0} NO ESTA FINALIZADO +BPM-0006=SE HA INICIADO UN FLUJO DE AUTORIZACION +BPM-0007=EL SERVIDOR DE TAREAS YA SE ENCUENTRA INICIADO +BPM-0008=NO SE HA ENCONTRADO LA TAREA {0} +BPM-0009=NO SE HA PODIDO ESTABLECER LA CONEXION CON EL SERVIDOR {0}:{1} +BPM-0010=NO SE HA PODIDO INICIAR EL FLUJO +BPM-0011=NO SE HA PODIDO ENCONTRAR LA PLANTILLA {0} + +#Etiquetas reporte excel Exportar flujos +lbl_description=DESCRIPCI\u00d3N +lbl_branch=SUCURSAL +lbl_office=OFICINA +lbl_terminal=TERMINAL +lbl_user=USUARIO +lbl_module=MODULO +lbl_transflow=TRANSACCI\u00d3N ORIGINADORA DEL FLUJO +lbl_activityname=NOMBRE ACTIVIDAD +lbl_sequence=SECUENCIA +lbl_userasigned=USUARIO ASIGNADO +lbl_groupAsign=GRUPO ASIGNADO +lbl_created=CREACI\u00d3N +lbl_started=FECHA INICIO +lbl_completed=FECHA FIN +lbl_expectedtime=TIEMPO ESTIMADO +lbl_response=RESPUESTA +lbl_task=TAREA +lbl_duracion=DURACI\u00d3N \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/.svn/text-base/change-set.xml.svn-base b/base/bpm/bpmlib/src/main/resources/.svn/text-base/change-set.xml.svn-base new file mode 100644 index 0000000..eeedb65 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/.svn/text-base/change-set.xml.svn-base @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/.svn/text-base/flows.xml.svn-base b/base/bpm/bpmlib/src/main/resources/.svn/text-base/flows.xml.svn-base new file mode 100644 index 0000000..eeedb65 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/.svn/text-base/flows.xml.svn-base @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/ChangeSet.xml b/base/bpm/bpmlib/src/main/resources/ChangeSet.xml new file mode 100644 index 0000000..c9cb3fa --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/ChangeSet.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/bpmmessages.properties b/base/bpm/bpmlib/src/main/resources/bpmmessages.properties new file mode 100644 index 0000000..8b79cc2 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/bpmmessages.properties @@ -0,0 +1,31 @@ +BPM-0001=LA REGLA {0} NO PUDO SER ENCONTRADA +BPM-0002=LA REGLA {0} NO PUEDE SER EVALUADA CON {1} +BPM-0003=LA REGLA {0} NO ESTA DISPONIBLE +BPM-0004=LA INSTANCIA {0} NO ESTA DISPONIBLE O YA FUE FINALIZADA +BPM-0005=EL FLUJO {0} NO ESTA FINALIZADO +BPM-0006=SE HA INICIADO UN FLUJO DE AUTORIZACION +BPM-0007=EL SERVIDOR DE TAREAS YA SE ENCUENTRA INICIADO +BPM-0008=NO SE HA ENCONTRADO LA TAREA {0} +BPM-0009=NO SE HA PODIDO ESTABLECER LA CONEXION CON EL SERVIDOR {0}:{1} +BPM-0010=NO SE HA PODIDO INICIAR EL FLUJO +BPM-0011=NO SE HA PODIDO ENCONTRAR LA PLANTILLA {0} + +#Etiquetas reporte excel Exportar flujos +lbl_description=DESCRIPCI\u00d3N +lbl_branch=SUCURSAL +lbl_office=OFICINA +lbl_terminal=TERMINAL +lbl_user=USUARIO +lbl_module=MODULO +lbl_transflow=TRANSACCI\u00d3N ORIGINADORA DEL FLUJO +lbl_activityname=NOMBRE ACTIVIDAD +lbl_sequence=SECUENCIA +lbl_userasigned=USUARIO ASIGNADO +lbl_groupAsign=GRUPO ASIGNADO +lbl_created=CREACI\u00d3N +lbl_started=FECHA INICIO +lbl_completed=FECHA FIN +lbl_expectedtime=TIEMPO ESTIMADO +lbl_response=RESPUESTA +lbl_task=TAREA +lbl_duracion=DURACI\u00d3N \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/change-set.xml b/base/bpm/bpmlib/src/main/resources/change-set.xml new file mode 100644 index 0000000..eeedb65 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/change-set.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows.xml b/base/bpm/bpmlib/src/main/resources/flows.xml new file mode 100644 index 0000000..eeedb65 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/.svn/entries b/base/bpm/bpmlib/src/main/resources/flows/.svn/entries new file mode 100644 index 0000000..f27532c --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/.svn/entries @@ -0,0 +1,544 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/resources/flows +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +taskasign.bpmn +file + + + + +2022-07-28T03:40:46.148818Z +88652be2ed5e7aa3040105eb19e0e05b +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +19357 + +subproceso.bpmn +file + + + + +2022-07-28T03:40:46.147818Z +218e9dd7013fb9d731110fa5d271a325 +2014-11-11T11:23:50.860191Z +2627 +jvaca + + + + + + + + + + + + + + + + + + + + + +19831 + +casoprueba.bpmn +file + + + + +2022-07-28T03:40:46.147818Z +a2b34fbc373c9b2bd3664b7da01fc818 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +37745 + +testwpa.bpmn +file + + + + +2022-07-28T03:40:46.148818Z +c3d49ad9ea3936164b7e9e89b2bd808e +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +13734 + +catalogoprueba.bpmn +file + + + + +2022-07-28T03:40:46.148818Z +efc3794123ab5d6776609bab73b5b162 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +9698 + +final.bpmn +file + + + + +2022-07-28T03:40:46.148818Z +b6452da1ecdf93b959411c6849a9834a +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +17958 + +process.bpmn2 +file + + + + +2022-07-28T03:40:46.149818Z +2f24995c858a458a83e41bd3720ad91f +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +9511 + +testuno.bpmn +file + + + + +2022-07-28T03:40:46.149818Z +1328b7cc274131f40db86d019a1d9ac8 +2014-10-29T09:26:33.991927Z +2141 +jvaca + + + + + + + + + + + + + + + + + + + + + +20157 + +pviaticos.bpmn +file + + + + +2022-07-28T03:40:46.149818Z +fa96451c47bbf9567b7c29366b3eaf33 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +54069 + +finalwpa.bpmn +file + + + + +2022-07-28T03:40:46.149818Z +e2a063224cc2fb66b1415bd3d0d4d3cd +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +19080 + +comaco +dir + +nuevoProceso.bpmn2 +file + + + + +2022-07-28T03:40:46.150818Z +2fbf5ee695f79091d7db14a68c38acc6 +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +9516 + +prueba.bpmn +file + + + + +2022-07-28T03:40:46.150818Z +7a87b93edeb39bead7f5852de95ff4ab +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +3018 + +comacov2 +dir + +viaticosmanual.bpmn +file + + + + +2022-07-28T03:40:46.150818Z +0e1e45b88941975c0053c8220214ed87 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +39346 + +test.bpmn +file + + + + +2022-07-28T03:40:46.150818Z +e293f5530ffbf587afc01aa2ff4de0c6 +2014-11-11T11:23:50.860191Z +2627 +jvaca + + + + + + + + + + + + + + + + + + + + + +29782 + +viaticos.bpmn +file + + + + +2022-07-28T03:40:46.151818Z +a96a0342b1646cec75945d507fc6b6fd +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +135005 + diff --git a/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/casoprueba.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/casoprueba.bpmn.svn-base new file mode 100644 index 0000000..262944a --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/casoprueba.bpmn.svn-base @@ -0,0 +1,596 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + + System.out.println("DESEMBOLSO *****************************"); +taskMetaData=FlowUtil.createTaskInfo("13",514, 1,10,"ASIGNAROFICIAL",Kind.OK); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Desembolso",actualTask); + + + _31-_32 + _32-_18 + + + + + + + + _32_maiaInput + _32_taskMetaDataInput + + + _32_actualTaskOutput + _32_maiaOutput + _32_taskMetaDataOutput + + + + maia + _32_maiaInput + + + taskMetaData + _32_taskMetaDataInput + + + _32_actualTaskOutput + actualTask + + + _32_maiaOutput + maia + + + _32_taskMetaDataOutput + taskMetaData + + + + + + System.out.println(">>>>>>>>>>Valida Personas"); +taskMetaData=FlowUtil.createTaskInfo("13",518, 1,10,"VALIDAPERSONAS",Kind.OK); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Validar Personas",actualTask); +System.out.println(">>>>>>>Validar Personas>>>>"+taskMetaData.getResponse()); + + + _15-_5 + _5-_17 + + + + + + + + _5_maiaInput + _5_taskMetaDataInput + + + _5_actualTaskOutput + _5_maiaOutput + _5_taskMetaDataOutput + + + + maia + _5_maiaInput + + + taskMetaData + _5_taskMetaDataInput + + + _5_actualTaskOutput + actualTask + + + _5_maiaOutput + maia + + + _5_taskMetaDataOutput + taskMetaData + + + + _16-_12 + + + + _1-_15 + _15-_5 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + _5-_17 + _17-_19 + _17-_18 + + + _18-_16 + _16-_12 + FlowUtil.endFlow(kcontext); + + + _17-_19 + _19-_23 + _19-_25 + _19-_24 + + + _17-_18 + _31-_18 + _32-_18 + _27-_18 + _28-_18 + _26-_18 + _18-_16 + + + + + taskMetaDataVM=FlowUtil.createTaskInfo("13",499, 1,10,"VALIDAMONTO",Kind.OK_NO); +kcontext.setVariable("taskMetaDataVM",taskMetaDataVM); +System.out.println(">>>>>ValidaMonto "+taskMetaDataVM); + + + tasksMetaData.put("V.Monto",actualTaskVM); + + + _19-_23 + _23-_26 + + + + + + + + _23_maiaInput + _23_taskMetaDataInput + + + _23_actualTaskOutput + _23_maiaOutput + _23_taskMetaDataOutput + + + + maia + _23_maiaInput + + + taskMetaDataVM + _23_taskMetaDataInput + + + _23_actualTaskOutput + actualTaskVM + + + _23_maiaOutput + maia + + + _23_taskMetaDataOutput + taskMetaDataVM + + + + + + taskMetaDataVT=FlowUtil.createTaskInfo("13",510, 1,10,"VALIDATASA",Kind.OK_NO); +kcontext.setVariable("taskMetaDataVT",taskMetaDataVT); +System.out.println(">>>>>ValidaTasa "+taskMetaDataVT); + + + tasksMetaData.put("V.Tasa",actualTaskVT); + + + _19-_25 + _25-_27 + + + + + + + + _25_maiaInput + _25_taskMetaDataInput + + + _25_actualTaskOutput + _25_maiaOutput + _25_taskMetaDataOutput + + + + maia + _25_maiaInput + + + taskMetaDataVT + _25_taskMetaDataInput + + + _25_actualTaskOutput + actualTaskVT + + + _25_maiaOutput + maia + + + _25_taskMetaDataOutput + taskMetaDataVT + + + + + + taskMetaDataVP=FlowUtil.createTaskInfo("13",499, 1,10,"VALIDAPLAZO",Kind.OK_NO); +kcontext.setVariable("taskMetaDataVP",taskMetaDataVP); +System.out.println(">>>>>ValidaPlazo "+taskMetaDataVP); + + + tasksMetaData.put("V.Plazo",actualTaskVP); + + + _19-_24 + _24-_28 + + + + + + + + _24_maiaInput + _24_taskMetaDataInput + + + _24_actualTaskOutput + _24_maiaOutput + _24_taskMetaDataOutput + + + + maia + _24_maiaInput + + + taskMetaDataVP + _24_taskMetaDataInput + + + _24_actualTaskOutput + actualTaskVP + + + _24_maiaOutput + maia + + + _24_taskMetaDataOutput + taskMetaDataVP + + + + _25-_27 + _27-_18 + _27-_29 + + + _23-_26 + _26-_18 + _26-_29 + + + _26-_29 + _27-_29 + _28-_29 + _29-_30 + + + _24-_28 + _28-_18 + _28-_29 + + + _30-_31 + _31-_32 + _31-_18 + + + + + taskMetaData=FlowUtil.createTaskInfo("13",510, 1,10,"ASIGNARCOMITE",Kind.OK_NO); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Aprobacion",actualTask); +System.out.println("maia Aprobacion "+maia); +((java.util.Map)maia.get("request")).put("accountnumber",taskMetaData.getAditionalData().get("accountnumber")); + + + _29-_30 + _30-_31 + + + + + + + + _30_maiaInput + _30_taskMetaDataInput + + + _30_actualTaskOutput + _30_maiaOutput + _30_taskMetaDataOutput + + + + maia + _30_maiaInput + + + taskMetaData + _30_taskMetaDataInput + + + _30_actualTaskOutput + actualTask + + + _30_maiaOutput + maia + + + _30_taskMetaDataOutput + taskMetaData + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + return taskMetaData.getResponse().compareTo("D")==0; + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + return taskMetaDataVT.getResponse().compareTo("D")==0; + + + return taskMetaDataVP.getResponse().compareTo("D")==0; + + + return taskMetaDataVM.getResponse().compareTo("D")==0; + + + + + + + + return taskMetaDataVM.getResponse().compareTo("D")!=0; + + + return taskMetaDataVT.getResponse().compareTo("D")!=0; + + + return taskMetaDataVP.getResponse().compareTo("D")!=0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/catalogoprueba.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/catalogoprueba.bpmn.svn-base new file mode 100644 index 0000000..d5e5557 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/catalogoprueba.bpmn.svn-base @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + +System.out.println("INICIA FLUJO SCRPT ********************************"); + + + + + + System.out.println("ANTES LLAMAR A TASK INFO BY CLASS NAME"); +taskMetaData=FlowUtil.createTaskInfoByClassName("1",49, 1,5,null,1,"OK_NO"); +taskMetaData.setUserId("JVACA"); +taskMetaData.setAction("A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Llamar transaccion",actualTask); + + + SequenceFlow_2 + SequenceFlow_4 + + + + + + + + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + DataOutput_3 + actualTask + + + + + + SequenceFlow_4 + SequenceFlow_5 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/final.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/final.bpmn.svn-base new file mode 100644 index 0000000..2958d60 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/final.bpmn.svn-base @@ -0,0 +1,276 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + SequenceFlow_4 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("1",7002, 1,120, "Llamar Transaccion", 1, "OK_NO"); + +//FlowUtil.executeClass("paquete.clase", maia); // la clase puede hacer lo que necesite +//taskMetaData.setUserId((maia.get("userId")!=null)?""+maia.get("userId"):null); +//taskMetaData.setGroupId((maia.get("groupId")!=null)?""+maia.get("groupId"):null); +//para asignar a un grupo especifico +//taskMetaData.setGroupId("GERENCIA"); +taskMetaData.setUserId("1234"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Llamar Transaccion",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Llamar Transaccion + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("1",7002, 1,120, "Ejecutar transaccion", 1, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setUserId("1234"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ejecutar transaccion",actualTask); + + + SequenceFlow_3 + SequenceFlow_4 + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + + + + _DataInput_16 + + Ejecutar transaccion + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + _16-_12 + + + + _1-_15 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/finalwpa.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/finalwpa.bpmn.svn-base new file mode 100644 index 0000000..61b4c9e --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/finalwpa.bpmn.svn-base @@ -0,0 +1,296 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + System.out.println("SSSSSSSSSSSSs "+taskMetaData); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + SequenceFlow_4 + _16-_12 + if(taskMetaData.getResponse()==null){ + taskMetaData.setResponse("A"); +} +taskMetaData.updateData(maia); +kcontext.setVariable("maia",maia); +actualTask.add(taskMetaData); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("1",7002, 1,120, "Llamar Transaccion", 1, "OK_NO"); + +//FlowUtil.executeClass("paquete.clase", maia); // la clase puede hacer lo que necesite +//taskMetaData.setUserId((maia.get("userId")!=null)?""+maia.get("userId"):null); +//taskMetaData.setGroupId((maia.get("groupId")!=null)?""+maia.get("groupId"):null); +//para asignar a un grupo especifico +//taskMetaData.setGroupId("GERENCIA"); +taskMetaData.setUserId("1234"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Llamar Transaccion",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + DataOutput_1 + + + + maia + DataInput_11 + + + DataInput_26 + + Llamar Transaccion + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + DataOutput_1 + actualTask + + + + #{taskMetaData.userId} + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("1",7002, 1,120, "Ejecutar transaccion", 1, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setUserId("1234"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ejecutar transaccion",actualTask); + + + SequenceFlow_3 + SequenceFlow_4 + + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + DataOutput_2 + + + + _DataInput_16 + + Ejecutar transaccion + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + DataOutput_2 + actualTask + + + + #{taskMetaData.userId} + + + + + + _16-_12 + + + + _1-_15 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/nuevoProceso.bpmn2.svn-base b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/nuevoProceso.bpmn2.svn-base new file mode 100644 index 0000000..bd450f8 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/nuevoProceso.bpmn2.svn-base @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("1",7000, 1,5,"RULE",Kind.OK); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Llamar Transaccion",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + DataOutput_3 + actualTask + + + + + SequenceFlow_3 + SequenceFlow_4 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_4 + + + + SequenceFlow_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/process.bpmn2.svn-base b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/process.bpmn2.svn-base new file mode 100644 index 0000000..c645655 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/process.bpmn2.svn-base @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("actualTask",actualTask); +kcontext.setVariable("tasksMetaData",tasksMetaData); + + + + + + taskMetaData=FlowUtil.createTaskInfo("1",7001, 1,5,"RULE",Kind.OK); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Llamar Transaccion",actualTask); + + + SequenceFlow_2 + SequenceFlow_5 + + + + + + + + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + DataInput_1 + + + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + DataOutput_3 + actualTask + + + + SequenceFlow_6 + + + + + SequenceFlow_5 + SequenceFlow_6 + FlowUtil.endFlow(kcontext); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/prueba.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/prueba.bpmn.svn-base new file mode 100644 index 0000000..dec2fc8 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/prueba.bpmn.svn-base @@ -0,0 +1,39 @@ + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("HOLA MUNDo"); + + + SequenceFlow_2 + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/pviaticos.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/pviaticos.bpmn.svn-base new file mode 100644 index 0000000..2d29f18 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/pviaticos.bpmn.svn-base @@ -0,0 +1,727 @@ + + + + + + + + + + + + + + + + + + + SequenceFlow_2 + SequenceFlow_3 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + SequenceFlow_9 + SequenceFlow_13 + SequenceFlow_71 + + + + SequenceFlow_2 + + + + + SequenceFlow_13 + SequenceFlow_7 + SequenceFlow_67 + SequenceFlow_87 + + + + + SequenceFlow_67 + SequenceFlow_5 + + + SequenceFlow_87 + SequenceFlow_88 + + + + SequenceFlow_88 + SequenceFlow_4 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_4 + + + + SequenceFlow_1 + SequenceFlow_7 + SequenceFlow_102 + + + + SequenceFlow_62 + SequenceFlow_65 + SequenceFlow_66 + + + + SequenceFlow_28 + SequenceFlow_29 + SequenceFlow_77 + + + + + SequenceFlow_66 + SequenceFlow_28 + + + + SequenceFlow_79 + SequenceFlow_80 + SequenceFlow_81 + + + + SequenceFlow_77 + SequenceFlow_80 + + + + SequenceFlow_81 + SequenceFlow_12 + + + + SequenceFlow_29 + SequenceFlow_31 + + + + SequenceFlow_74 + SequenceFlow_75 + SequenceFlow_101 + SequenceFlow_76 + + + + SequenceFlow_31 + SequenceFlow_32 + SequenceFlow_33 + SequenceFlow_100 + + + + + SequenceFlow_32 + SequenceFlow_74 + + + + SequenceFlow_33 + SequenceFlow_75 + + + + SequenceFlow_76 + SequenceFlow_37 + + + + SequenceFlow_37 + + + + SequenceFlow_51 + SequenceFlow_79 + + + + SequenceFlow_38 + SequenceFlow_48 + + + + SequenceFlow_16 + SequenceFlow_38 + SequenceFlow_78 + + + + + SequenceFlow_12 + SequenceFlow_16 + SequenceFlow_45 + + + + + SequenceFlow_45 + SequenceFlow_50 + SequenceFlow_51 + + + + SequenceFlow_48 + SequenceFlow_50 + SequenceFlow_57 + + + + + SequenceFlow_58 + SequenceFlow_82 + + + + SequenceFlow_59 + SequenceFlow_83 + + + + SequenceFlow_78 + SequenceFlow_57 + SequenceFlow_58 + SequenceFlow_59 + + + + + SequenceFlow_82 + SequenceFlow_83 + SequenceFlow_84 + + + + SequenceFlow_84 + SequenceFlow_64 + + + + SequenceFlow_64 + + + + SequenceFlow_100 + SequenceFlow_101 + + + + + + SequenceFlow_102 + SequenceFlow_96 + SequenceFlow_97 + SequenceFlow_98 + + + + + SequenceFlow_98 + SequenceFlow_93 + + + + SequenceFlow_97 + SequenceFlow_99 + + + + SequenceFlow_24 + SequenceFlow_65 + + + + SequenceFlow_22 + SequenceFlow_62 + + + + SequenceFlow_93 + SequenceFlow_99 + SequenceFlow_22 + SequenceFlow_24 + + + + + SequenceFlow_72 + SequenceFlow_1 + + + + SequenceFlow_71 + SequenceFlow_72 + SequenceFlow_96 + + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("1",7001, 1,5,"com.fp.viaticos.task.AsiganrJefe","OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Llamar transaccion",actualTask); + + + SequenceFlow_3 + SequenceFlow_9 + + + + + SequenceFlow_5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/subproceso.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/subproceso.bpmn.svn-base new file mode 100644 index 0000000..9fbbd89 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/subproceso.bpmn.svn-base @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + + SequenceFlow_3 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "aprobar subproceso", 1, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setUserId("EOCAMPO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + List<Object> laux = new java.util.ArrayList(); +taskMetaData.updateData(maia); +laux.add(taskMetaData); +actualTask.add(taskMetaData); +kcontext.setVariable("actualTask",actualTask); +tasksMetaData.put("aprobar subproceso",laux); + + + SequenceFlow_2 + SequenceFlow_4 + + + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_5 + + + _DataInput_30 + _DataInput_31 + _DataInput_32 + _DataInput_33 + _DataInput_34 + _DataInput_35 + _DataInput_36 + + + DataOutput_1 + DataOutput_2 + DataOutput_5 + + + + + _DataInput_30 + + aprobar subproceso + _DataInput_30 + + + + _DataInput_31 + + + _DataInput_32 + + + _DataInput_33 + + + _DataInput_34 + + + _DataInput_35 + + + _DataInput_36 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + actualTask + DataInput_5 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + DataOutput_5 + actualTask + + + + #{taskMetaData.userId} + + + + + + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "aprobar subproceso dos", 1, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setUserId("EOCAMPO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + List<Object> laux = new java.util.ArrayList(); +taskMetaData.updateData(maia); +laux.add(taskMetaData); +actualTask.add(taskMetaData); +kcontext.setVariable("actualTask",actualTask); +tasksMetaData.put("aprobar subproceso dos",laux); + + + SequenceFlow_4 + SequenceFlow_3 + + + + + + + + + + + + + + + + DataInput_3 + DataInput_4 + DataInput_6 + + + _DataInput_58 + _DataInput_59 + _DataInput_60 + _DataInput_61 + _DataInput_62 + _DataInput_63 + _DataInput_64 + + + DataOutput_3 + DataOutput_4 + DataOutput_6 + + + + + _DataInput_58 + + aprobar subproceso dos + _DataInput_58 + + + + _DataInput_59 + + + _DataInput_60 + + + _DataInput_61 + + + _DataInput_62 + + + _DataInput_63 + + + _DataInput_64 + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + actualTask + DataInput_6 + + + DataOutput_3 + maia + + + DataOutput_4 + taskMetaData + + + DataOutput_6 + actualTask + + + + #{taskMetaData.userId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/taskasign.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/taskasign.bpmn.svn-base new file mode 100644 index 0000000..5b241a4 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/taskasign.bpmn.svn-base @@ -0,0 +1,298 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + _1-_11 + + + _13-_2 + + + + _5-_3 + _3-_8 + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + _3_SkippableInput + _3_TaskNameInput + _3_GroupIdInput + + + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_SkippableInput + + false + _3_SkippableInput + + + + _3_TaskNameInput + + #{maia.request.subject} + _3_TaskNameInput + + + + _3_GroupIdInput + + #{taskMetaData.groupId} + _3_GroupIdInput + + + + _3_taskMetaDataOutput + taskMetaData + + + + #{taskMetaData.userId} + + + + + _10-_4 + _4-_6 + FlowUtil.evalRule(taskMetaData.getRuleCode(), maia); +FlowUtil.executeClass(taskMetaData.getClassCode(), maia); +try{ +taskMetaData.setUserId((maia.get("userId")!=null)?""+maia.get("userId"):null); +}catch(Exception e){ +} +try{ +taskMetaData.setGroupId((maia.get("groupId")!=null)?""+maia.get("groupId"):null); +}catch(Exception e){ +} +taskMetaData.setAction((maia.get("action")!=null)?""+maia.get("action"):null); +try{ +if(maia.get("internalCode")!=null){ +taskMetaData.setInternalCode(maia.get("internalCode")); +} +}catch(Exception e){ +} +maia.remove("userId"); +maia.remove("ActorId"); +maia.remove("groupId"); +maia.remove("GroupId"); +maia.remove("action"); +maia.remove("internalCode"); + + + + _6-_5 + _5-_3 + + + _4-_6 + _6-_5 + _6-_7 + + + _6-_7 + _8-_7 + _7-_13 + + + _3-_8 + _8-_7 + _8-_9 + + + _8-_9 + _9-_12 + + + + + + + _11-_10 + _12-_10 + _10-_4 + + + _1-_11 + _11-_10 + mainTask=taskMetaData; +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + _9-_12 + _12-_10 + actualTask.add(taskMetaData); +taskMetaData=mainTask; + + + _7-_13 + _13-_2 + if(taskMetaData.getResponse()==null){ + taskMetaData.setResponse("A"); +} +taskMetaData.updateData(maia); +kcontext.setVariable("maia",maia); +actualTask.add(taskMetaData); + + + + + + return "A".equals(taskMetaData.getAction()); + + + + return !("A".equals(taskMetaData.getAction())); + + + return taskMetaData.getResponse().compareTo("R")!=0; + + + + return taskMetaData.getResponse().compareTo("R")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/test.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/test.bpmn.svn-base new file mode 100644 index 0000000..21c5a82 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/test.bpmn.svn-base @@ -0,0 +1,467 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "grupo", 1, "OK_NO"); +taskMetaData.setGroupId("GERENCIA"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("grupo",actualTask); + + + SequenceFlow_5 + SequenceFlow_3 + + + + + + + + + + + + + + DataInput_3 + DataInput_4 + + + _DataInput_44 + _DataInput_45 + _DataInput_46 + _DataInput_47 + _DataInput_48 + _DataInput_49 + _DataInput_50 + + + DataOutput_3 + DataOutput_4 + + + + + _DataInput_44 + + grupo + _DataInput_44 + + + + _DataInput_45 + + + _DataInput_46 + + + _DataInput_47 + + #{taskMetaData.groupId} + _DataInput_47 + + + + _DataInput_48 + + + _DataInput_49 + + + _DataInput_50 + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_3 + maia + + + DataOutput_4 + taskMetaData + + + + + + + + tasksMetaData.put("finalizar",actualTask); +System.out.println("Resultado subproceso "+actualTask); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("subproceso",actualTask); + + + + + + SequenceFlow_3 + SequenceFlow_6 + + + + + + + + + + DataInput_5 + DataInput_6 + DataInput_9 + + + DataOutput_5 + DataOutput_7 + DataOutput_8 + DataOutput_6 + + + + maia + DataInput_5 + + + tasksMetaData + DataInput_6 + + + actualTask + DataInput_9 + + + DataOutput_5 + maia + + + DataOutput_7 + tasksMetaData + + + DataOutput_8 + taskMetaData + + + DataOutput_6 + actualTask + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "prueba", 1, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setUserId("EOCAMPO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("prueba",actualTask); + + + SequenceFlow_2 + SequenceFlow_5 + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + + + _DataInput_30 + _DataInput_31 + _DataInput_32 + _DataInput_33 + _DataInput_34 + _DataInput_35 + _DataInput_36 + + + DataOutput_1 + DataOutput_2 + + + + + _DataInput_30 + + prueba + _DataInput_30 + + + + _DataInput_31 + + + _DataInput_32 + + + _DataInput_33 + + + _DataInput_34 + + + _DataInput_35 + + + _DataInput_36 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "aprobacion final", 1, "OK_NO"); +taskMetaData.setUserId("EOCAMPO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("aprobacion final",actualTask); + + + SequenceFlow_6 + SequenceFlow_7 + + + + + + + + + + + + DataInput_7 + DataInput_8 + DataInput_15 + + + _DataInput_170 + _DataInput_174 + _DataInput_175 + _DataInput_176 + + + DataOutput_9 + DataOutput_10 + + + + + _DataInput_170 + + aprobacion final + _DataInput_170 + + + + _DataInput_174 + + + _DataInput_175 + + + _DataInput_176 + + + maia + DataInput_7 + + + DataInput_8 + + + taskMetaData + DataInput_15 + + + DataOutput_9 + maia + + + DataOutput_10 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_7 + SequenceFlow_4 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_4 + + + + SequenceFlow_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/testuno.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/testuno.bpmn.svn-base new file mode 100644 index 0000000..61e8b12 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/testuno.bpmn.svn-base @@ -0,0 +1,308 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "pruebauno", 1, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setUserId("EOCAMPO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("pruebauno",actualTask); + + + SequenceFlow_2 + SequenceFlow_5 + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + + + _DataInput_30 + _DataInput_31 + _DataInput_32 + _DataInput_33 + _DataInput_34 + _DataInput_35 + _DataInput_36 + + + DataOutput_1 + DataOutput_2 + + + + + _DataInput_30 + + pruebauno + _DataInput_30 + + + + _DataInput_31 + + + _DataInput_32 + + + _DataInput_33 + + + _DataInput_34 + + + _DataInput_35 + + + _DataInput_36 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_1 + + + + SequenceFlow_3 + SequenceFlow_4 + FlowUtil.endFlow(kcontext); + + + + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "grupouno", 1, "OK_NO"); +taskMetaData.setGroupId("GERENCIA"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("grupouno",actualTask); + + + SequenceFlow_5 + SequenceFlow_6 + + + + + + + + + + + + + + DataInput_3 + DataInput_4 + + + _DataInput_44 + _DataInput_45 + _DataInput_46 + _DataInput_47 + _DataInput_48 + _DataInput_49 + _DataInput_50 + + + DataOutput_3 + DataOutput_4 + + + + + _DataInput_44 + + grupouno + _DataInput_44 + + + + _DataInput_45 + + + _DataInput_46 + + + _DataInput_47 + + #{taskMetaData.groupId} + _DataInput_47 + + + + _DataInput_48 + + + _DataInput_49 + + + _DataInput_50 + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_3 + maia + + + DataOutput_4 + taskMetaData + + + + + SequenceFlow_6 + SequenceFlow_3 + System.out.println("prueba script"); + + + + SequenceFlow_4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/testwpa.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/testwpa.bpmn.svn-base new file mode 100644 index 0000000..0bc495f --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/testwpa.bpmn.svn-base @@ -0,0 +1,292 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("17",23, 1,10,"WMP",Kind.OK); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Verifica1",actualTask); + + + + + + + + + + _17_maiaInput + _17_taskMetaDataInput + + + _17_actualTaskOutput + _17_maiaOutput + _17_taskMetaDataOutput + + + + maia + _17_maiaInput + + + taskMetaData + _17_taskMetaDataInput + + + _17_actualTaskOutput + actualTask + + + _17_maiaOutput + maia + + + _17_taskMetaDataOutput + taskMetaData + + + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("17",21, 1,10,"WMP",Kind.OK); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Verifica2",actualTask); + + + + + + + + + + _21_maiaInput + _21_taskMetaDataInput + + + _21_actualTaskOutput + _21_maiaOutput + _21_taskMetaDataOutput + + + + maia + _21_maiaInput + + + taskMetaData + _21_taskMetaDataInput + + + _21_actualTaskOutput + actualTask + + + _21_maiaOutput + maia + + + _21_taskMetaDataOutput + taskMetaData + + + + + + System.out.println(">>Inicia Flujo"); +taskMetaData=FlowUtil.createTaskInfo("17",22, 1,10,"WPA",Kind.OK); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Inicia Flujo",actualTask); +System.out.println(">>Inicia Flujo>>"+taskMetaData.getResponse()); + + + + + + + + + + _5_maiaInput + _5_taskMetaDataInput + + + _5_actualTaskOutput + _5_maiaOutput + _5_taskMetaDataOutput + + + + maia + _5_maiaInput + + + taskMetaData + _5_taskMetaDataInput + + + _5_actualTaskOutput + actualTask + + + _5_maiaOutput + maia + + + _5_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + System.out.println("AAAAA"+maia); +return (((String)maia.get("transaction")).compareTo("23")==0); + + + + System.out.println("BBBBB"+maia); +return (((String)maia.get("transaction")).compareTo("21")==0); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/viaticos.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/viaticos.bpmn.svn-base new file mode 100644 index 0000000..9ab160e --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/viaticos.bpmn.svn-base @@ -0,0 +1,1949 @@ + + + + + + + + + + + + + + + + + + + ScriptTask_8-ExclusiveGateway_4 + ScriptTask_9-ExclusiveGateway_4 + ExclusiveGateway_4-CallActivity_4 + + + ExclusiveGateway_3-ScriptTask_4 + ScriptTask_4-ExclusiveGateway_5 + maia.put("cusuariobpm", taskMetaData.getUserId()); +//enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefeyResponsableUnidad", maia, taskMetaData, 105 , 106); + + + ExclusiveGateway_3-ScriptTask_7 + ScriptTask_7-ParallelGateway_1 + maia.put("cusuariobpm", taskMetaData.getUserId()); +//enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefeyResponsableUnidad", maia, taskMetaData, 107 , 108); + + + CallActivity_1-ExclusiveGateway_2 + ExclusiveGateway_2-ScriptTask_3 + ExclusiveGateway_2-ScriptTask_8 + ExclusiveGateway_2-ScriptTask_6 + + + CallActivity_2-ExclusiveGateway_3 + ExclusiveGateway_3-ScriptTask_4 + ExclusiveGateway_3-ScriptTask_7 + ExclusiveGateway_3-ScriptTask_9 + + + ScriptTask_1-ExclusiveGateway_1 + ExclusiveGateway_8-ExclusiveGateway_1 + ExclusiveGateway_1-CallActivity_1 + + + StartEvent_1-ScriptTask_1 + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",21, 1,120,"com.fp.viaticos.task.AsignarJefe", "Autorizar jefe", 10, "OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +//enviar mail al jefe del empleado +FlowUtil.executeClass(taskMetaData.getClassCode(), maia); +String action = maia.get("action")!=null ?""+maia.get("action"):null; +if(action == null || action.equals("A") ){ + FlowUtil.mail("com.fp.viaticos.mail.Jefe", maia, taskMetaData, 101 , 102); +} + + + List old=(List)tasksMetaData.get("Autorizar jefe"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Autorizar jefe",old); + + + ExclusiveGateway_1-CallActivity_1 + CallActivity_1-ExclusiveGateway_2 + + + + + + + + CallActivity_1_maiaInput + CallActivity_1_taskMetaDataInput + + + CallActivity_1_actualTaskOutput + CallActivity_1_maiaOutput + CallActivity_1_taskMetaDataOutput + + + + maia + CallActivity_1_maiaInput + + + taskMetaData + CallActivity_1_taskMetaDataInput + + + CallActivity_1_actualTaskOutput + actualTask + + + CallActivity_1_maiaOutput + maia + + + CallActivity_1_taskMetaDataOutput + taskMetaData + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",22, 1,120,"com.fp.viaticos.task.AsignarSupervisior", "Autorizar supervisor", 10, "OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +//enviar mail al responsable de la unidad a la que pertenece del empleado + +FlowUtil.mail("com.fp.viaticos.mail.ResponsableUnidad", maia, taskMetaData, 101 , 102); + + + List old=(List)tasksMetaData.get("Autorizar supervisor"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Autorizar supervisor",old); + + + ScriptTask_6-CallActivity_2 + CallActivity_2-ExclusiveGateway_3 + + + + + + + + CallActivity_2_maiaInput + CallActivity_2_taskMetaDataInput + + + CallActivity_2_actualTaskOutput + CallActivity_2_maiaOutput + CallActivity_2_taskMetaDataOutput + + + + maia + CallActivity_2_maiaInput + + + taskMetaData + CallActivity_2_taskMetaDataInput + + + CallActivity_2_actualTaskOutput + actualTask + + + CallActivity_2_maiaOutput + maia + + + CallActivity_2_taskMetaDataOutput + taskMetaData + + + + ExclusiveGateway_5-ScriptTask_5 + ScriptTask_5-EndEvent_2 + FlowUtil.endFlow(kcontext); + + + ScriptTask_5-EndEvent_2 + + + + ScriptTask_4-ExclusiveGateway_5 + ScriptTask_3-ExclusiveGateway_5 + ExclusiveGateway_5-ScriptTask_5 + + + ExclusiveGateway_2-ScriptTask_3 + ScriptTask_3-ExclusiveGateway_5 + //enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefe", maia, taskMetaData, 105 , 106); + + + ExclusiveGateway_2-ScriptTask_8 + ScriptTask_8-ExclusiveGateway_4 + //enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefe", maia, taskMetaData, 103 , 104); + + + ScriptTask_7-ParallelGateway_1 + ParallelGateway_1-CallActivity_5 + ParallelGateway_1-CallActivity_3 + ParallelGateway_1-CallActivity_14 + + + ExclusiveGateway_3-ScriptTask_9 + ScriptTask_9-ExclusiveGateway_4 + maia.put("cusuariobpm", taskMetaData.getUserId()); +//enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefeyResponsableUnidad", maia, taskMetaData, 103 , 104); + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",30, 1,120,"com.fp.viaticos.task.AsignarTalentoHumano", "Confirmar talento humano", 12,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.TalentoHumano", maia, taskMetaData, 113 , 114); + + + List old=(List)tasksMetaData.get("Confimar talento humano"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confimar talento humano",old); + + + ParallelGateway_1-CallActivity_5 + CallActivity_5-ParallelGateway_2 + + + + + + + + CallActivity_5_maiaInput + CallActivity_5_taskMetaDataInput + + + CallActivity_5_actualTaskOutput + CallActivity_5_maiaOutput + CallActivity_5_taskMetaDataOutput + + + + maia + CallActivity_5_maiaInput + + + taskMetaData + CallActivity_5_taskMetaDataInput + + + CallActivity_5_actualTaskOutput + actualTask + + + CallActivity_5_maiaOutput + maia + + + CallActivity_5_taskMetaDataOutput + taskMetaData + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",29, 1,120,"com.fp.viaticos.task.AsignarTesoreria", "Confirmar tesorería", 12,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 113 , 114); + + + List old=(List)tasksMetaData.get("Confirmar tesorería"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar tesorería",old); + + + ParallelGateway_1-CallActivity_3 + CallActivity_3-ParallelGateway_2 + + + + + + + + CallActivity_3_maiaInput + CallActivity_3_taskMetaDataInput + + + CallActivity_3_actualTaskOutput + CallActivity_3_maiaOutput + CallActivity_3_taskMetaDataOutput + + + + maia + CallActivity_3_maiaInput + + + taskMetaData + CallActivity_3_taskMetaDataInput + + + CallActivity_3_actualTaskOutput + actualTask + + + CallActivity_3_maiaOutput + maia + + + CallActivity_3_taskMetaDataOutput + taskMetaData + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",31, 1,120,"com.fp.viaticos.task.AsignarEmpleado", "Confirmar comision SP", 13,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Empleado", maia, taskMetaData, 115 , 116); + + + List old=(List)tasksMetaData.get("Confirmar comision SP"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar comision SP",old); + + + ParallelGateway_2-CallActivity_6 + CallActivity_6-ExclusiveGateway_7 + + + + + + + + CallActivity_6_maiaInput + CallActivity_6_taskMetaDataInput + + + CallActivity_6_actualTaskOutput + CallActivity_6_maiaOutput + CallActivity_6_taskMetaDataOutput + + + + maia + CallActivity_6_maiaInput + + + taskMetaData + CallActivity_6_taskMetaDataInput + + + CallActivity_6_actualTaskOutput + actualTask + + + CallActivity_6_maiaOutput + maia + + + CallActivity_6_taskMetaDataOutput + taskMetaData + + + + CallActivity_14-ParallelGateway_2 + CallActivity_3-ParallelGateway_2 + CallActivity_5-ParallelGateway_2 + ParallelGateway_2-CallActivity_6 + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",33, 1,120,"com.fp.viaticos.task.AsignarContabilidad", "Reajustar contabilidad", 15,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Contabilidad", maia, taskMetaData, 119 , 120); + + + List old=(List)tasksMetaData.get("Reajustar contabilidad"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Reajustar contabilidad",old); + + + ParallelGateway_3-CallActivity_8 + CallActivity_8-ParallelGateway_4 + + + + + + + + CallActivity_8_maiaInput + CallActivity_8_taskMetaDataInput + + + CallActivity_8_actualTaskOutput + CallActivity_8_maiaOutput + CallActivity_8_taskMetaDataOutput + + + + maia + CallActivity_8_maiaInput + + + taskMetaData + CallActivity_8_taskMetaDataInput + + + CallActivity_8_actualTaskOutput + actualTask + + + CallActivity_8_maiaOutput + maia + + + CallActivity_8_taskMetaDataOutput + taskMetaData + + + + CallActivity_6-ExclusiveGateway_7 + ExclusiveGateway_7-CallActivity_7 + ExclusiveGateway_7-CallActivity_10 + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",34, 1,120,"com.fp.viaticos.task.AsignarTalentoHumano", "Reajustar talento humano", 15,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.TalentoHumano", maia, taskMetaData, 119 , 120); + + + List old=(List)tasksMetaData.get("Reajustar talento humano"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Reajustar talento humano",old); + + + ParallelGateway_3-CallActivity_9 + CallActivity_9-ParallelGateway_4 + + + + + + + + CallActivity_9_maiaInput + CallActivity_9_taskMetaDataInput + + + CallActivity_9_actualTaskOutput + CallActivity_9_maiaOutput + CallActivity_9_taskMetaDataOutput + + + + maia + CallActivity_9_maiaInput + + + taskMetaData + CallActivity_9_taskMetaDataInput + + + CallActivity_9_actualTaskOutput + actualTask + + + CallActivity_9_maiaOutput + maia + + + CallActivity_9_taskMetaDataOutput + taskMetaData + + + + CallActivity_7-ParallelGateway_3 + ParallelGateway_3-CallActivity_8 + ParallelGateway_3-CallActivity_9 + ParallelGateway_3-ScriptTask_12 + SequenceFlow_5 + SequenceFlow_7 + + + CallActivity_8-ParallelGateway_4 + CallActivity_9-ParallelGateway_4 + ScriptTask_12-ParallelGateway_4 + SequenceFlow_6 + SequenceFlow_8 + SequenceFlow_9 + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",50, 1,120,"com.fp.viaticos.task.AsignarTesoreria", "Confirmar movilización", 19,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 133 , 134); + + + List old=(List)tasksMetaData.get("Confirmar movilización"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Notificar movilización",old); + + + ParallelGateway_1-CallActivity_14 + CallActivity_14-ParallelGateway_2 + + + + + + + + CallActivity_14_maiaInput + CallActivity_14_taskMetaDataInput + + + CallActivity_14_actualTaskOutput + CallActivity_14_maiaOutput + CallActivity_14_taskMetaDataOutput + + + + maia + CallActivity_14_maiaInput + + + taskMetaData + CallActivity_14_taskMetaDataInput + + + CallActivity_14_actualTaskOutput + actualTask + + + CallActivity_14_maiaOutput + maia + + + CallActivity_14_taskMetaDataOutput + taskMetaData + + + + ExclusiveGateway_2-ScriptTask_6 + ScriptTask_6-CallActivity_2 + //enviar mail al jefe del empleado +FlowUtil.executeClass(taskMetaData.getClassCode(), maia); +String action = maia.get("action")!=null ?""+maia.get("action"):null; +//System.out.println("Se ingresa al nodo notificar SP :" + action); +if(action == null || action.equals("A") ){ + FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefe", maia, taskMetaData, 107 , 108); +} + + + StartEvent_1-ScriptTask_1 + ScriptTask_1-ExclusiveGateway_1 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + ScriptTask_10-EndEvent_4 + + + + ExclusiveGateway_8-ScriptTask_10 + ScriptTask_10-EndEvent_4 + FlowUtil.endFlow(kcontext); + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",24, 1,30,"com.fp.viaticos.task.AsignarEmpleado", "Modificar empleado", 11, "OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + List old=(List)tasksMetaData.get("Modificar empleado"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Modificar empleado",old); + + + ExclusiveGateway_4-CallActivity_4 + CallActivity_4-ExclusiveGateway_8 + + + + + + + + CallActivity_4_maiaInput + CallActivity_4_taskMetaDataInput + + + CallActivity_4_actualTaskOutput + CallActivity_4_maiaOutput + CallActivity_4_taskMetaDataOutput + + + + maia + CallActivity_4_maiaInput + + + taskMetaData + CallActivity_4_taskMetaDataInput + + + CallActivity_4_actualTaskOutput + actualTask + + + CallActivity_4_maiaOutput + maia + + + CallActivity_4_taskMetaDataOutput + taskMetaData + + + + CallActivity_4-ExclusiveGateway_8 + ExclusiveGateway_8-ExclusiveGateway_1 + ExclusiveGateway_8-ScriptTask_10 + + + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("M".equals(taskMetaData.getResponse())); + + + + return ("M".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + return ("D".equals(taskMetaData.getResponse())); + + + + return ("A".equals(taskMetaData.getResponse())); + + + + return ("A".equals(taskMetaData.getResponse())); + + + + return ("D".equals(taskMetaData.getResponse())); + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30", 23, 1, 120, "com.fp.viaticos.task.AsignarEmpleado", "Generar Informe SP", 16, "OK_NO"); +kcontext.setVariable("taskMetaData", taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Empleado", maia, taskMetaData, 123, 124); + + + List old=(List)tasksMetaData.get("Generar Informe SP"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Generar Informe SP",old); + + + ExclusiveGateway_7-CallActivity_10 + CallActivity_10-ExclusiveGateway_9 + + + + + + + + CallActivity_10_maiaInput + CallActivity_10_taskMetaDataInput + + + CallActivity_10_actualTaskOutput + CallActivity_10_maiaOutput + CallActivity_10_taskMetaDataOutput + + + + maia + CallActivity_10_maiaInput + + + taskMetaData + CallActivity_10_taskMetaDataInput + + + CallActivity_10_actualTaskOutput + actualTask + + + CallActivity_10_maiaOutput + maia + + + CallActivity_10_taskMetaDataOutput + taskMetaData + + + + + CallActivity_10-ExclusiveGateway_9 + CallActivity_13-ExclusiveGateway_9 + ExclusiveGateway_9-CallActivity_11 + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",25, 1,120,"com.fp.viaticos.task.AsignarJefeInforme", "Autorizar informe JI", 17,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +//enviar mail al jefe del empleado + +FlowUtil.executeClass(taskMetaData.getClassCode(), maia); +String action = maia.get("action")!=null ?""+maia.get("action"):null; +if(action == null || action.equals("A") ){ + FlowUtil.mail("com.fp.viaticos.mail.JefeInforme", maia, taskMetaData, 125 , 126); +} + + + List old=(List)tasksMetaData.get("Autorizar informe JI"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Autorizar informe JI",old); + + + ExclusiveGateway_9-CallActivity_11 + CallActivity_11-ExclusiveGateway_10 + + + + + + + + CallActivity_11_maiaInput + CallActivity_11_taskMetaDataInput + + + CallActivity_11_actualTaskOutput + CallActivity_11_maiaOutput + CallActivity_11_taskMetaDataOutput + + + + maia + CallActivity_11_maiaInput + + + taskMetaData + CallActivity_11_taskMetaDataInput + + + CallActivity_11_actualTaskOutput + actualTask + + + CallActivity_11_maiaOutput + maia + + + CallActivity_11_taskMetaDataOutput + taskMetaData + + + + + CallActivity_11-ExclusiveGateway_10 + ExclusiveGateway_10-ScriptTask_13 + ExclusiveGateway_10-ScriptTask_14 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("M".equals(taskMetaData.getResponse())); + + + ExclusiveGateway_10-ScriptTask_14 + ScriptTask_14-ExclusiveGateway_11 + //enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefeInforme", maia, taskMetaData, 127 , 128); + + + + ExclusiveGateway_10-ScriptTask_13 + ScriptTask_13-CallActivity_12 + //enviar mail al jefe del empleado +FlowUtil.executeClass(taskMetaData.getClassCode(), maia); +String action = maia.get("action")!=null ?""+maia.get("action"):null; +//System.out.println("Se ingresa al nodo notificar SP :" + action); +if(action == null || action.equals("A") ){ + FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefeInforme", maia, taskMetaData, 129, 130); +} + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",39, 1,120,"com.fp.viaticos.task.AsignarSupervisiorInforme", "Autorizar informe RU", 17,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +//enviar mail al responsable de la unidad a la que pertenece del empleado +FlowUtil.mail("com.fp.viaticos.mail.ResponsableUnidadInforme", maia, taskMetaData, 125 , 126); + + + List old=(List)tasksMetaData.get("Autorizar informe RU"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Autorizar informe RU",old); + + + ScriptTask_13-CallActivity_12 + CallActivity_12-ExclusiveGateway_6 + + + + + + + + CallActivity_12_maiaInput + CallActivity_12_taskMetaDataInput + + + CallActivity_12_actualTaskOutput + CallActivity_12_maiaOutput + CallActivity_12_taskMetaDataOutput + + + + maia + CallActivity_12_maiaInput + + + taskMetaData + CallActivity_12_taskMetaDataInput + + + CallActivity_12_actualTaskOutput + actualTask + + + CallActivity_12_maiaOutput + maia + + + CallActivity_12_taskMetaDataOutput + taskMetaData + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",35, 1,30,"com.fp.viaticos.task.AsignarEmpleado", "Modificar informe SP", 20,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + List old=(List)tasksMetaData.get("Modificar informe SP"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Modificar informe SP",old); + + + ExclusiveGateway_11-CallActivity_13 + CallActivity_13-ExclusiveGateway_9 + + + + + + + + CallActivity_13_maiaInput + CallActivity_13_taskMetaDataInput + + + CallActivity_13_actualTaskOutput + CallActivity_13_maiaOutput + CallActivity_13_taskMetaDataOutput + + + + maia + CallActivity_13_maiaInput + + + taskMetaData + CallActivity_13_taskMetaDataInput + + + CallActivity_13_actualTaskOutput + actualTask + + + CallActivity_13_maiaOutput + maia + + + CallActivity_13_taskMetaDataOutput + taskMetaData + + + + + ScriptTask_14-ExclusiveGateway_11 + ScriptTask_16-ExclusiveGateway_11 + ExclusiveGateway_11-CallActivity_13 + + + + CallActivity_12-ExclusiveGateway_6 + ExclusiveGateway_6-ScriptTask_16 + ExclusiveGateway_6-ScriptTask_15 + + + return ("M".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + ExclusiveGateway_6-ScriptTask_16 + ScriptTask_16-ExclusiveGateway_11 + maia.put("cusuariobpm", taskMetaData.getUserId()); +//enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefeyResponsableUnidadInforme", maia, taskMetaData, 127 , 128); + + + + ExclusiveGateway_6-ScriptTask_15 + ScriptTask_15-ParallelGateway_5 + maia.put("cusuariobpm", taskMetaData.getUserId()); +//enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefeyResponsableUnidadInforme", maia, taskMetaData, 129 , 130); + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",37, 1,120,"com.fp.viaticos.task.AsignarTalentoHumano","Confirmar informe TH", 18,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.TalentoHumano", maia, taskMetaData, 131 , 132); + + + List old=(List)tasksMetaData.get("Confirmar informe TH"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar informe TH",old); + + + ParallelGateway_5-CallActivity_16 + CallActivity_16-ParallelGateway_6 + + + + + + + + CallActivity_16_maiaInput + CallActivity_16_taskMetaDataInput + + + CallActivity_16_actualTaskOutput + CallActivity_16_maiaOutput + CallActivity_16_taskMetaDataOutput + + + + maia + CallActivity_16_maiaInput + + + taskMetaData + CallActivity_16_taskMetaDataInput + + + CallActivity_16_actualTaskOutput + actualTask + + + CallActivity_16_maiaOutput + maia + + + CallActivity_16_taskMetaDataOutput + taskMetaData + + + + + ScriptTask_15-ParallelGateway_5 + ParallelGateway_5-CallActivity_16 + ParallelGateway_5-CallActivity_15 + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",36, 1,120,"com.fp.viaticos.task.AsignarTesoreria","Confirmar informe tesoreria" ,18,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 131 , 132); + + + List old=(List)tasksMetaData.get("Confirmar informe tesoreria"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar informe tesoreria",old); + + + ParallelGateway_5-CallActivity_15 + CallActivity_15-ParallelGateway_6 + + + + + + + + CallActivity_15_maiaInput + CallActivity_15_taskMetaDataInput + + + CallActivity_15_actualTaskOutput + CallActivity_15_maiaOutput + CallActivity_15_taskMetaDataOutput + + + + maia + CallActivity_15_maiaInput + + + taskMetaData + CallActivity_15_taskMetaDataInput + + + CallActivity_15_actualTaskOutput + actualTask + + + CallActivity_15_maiaOutput + maia + + + CallActivity_15_taskMetaDataOutput + taskMetaData + + + + + CallActivity_16-ParallelGateway_6 + CallActivity_15-ParallelGateway_6 + SequenceFlow_10 + + + ParallelGateway_3-ScriptTask_12 + ScriptTask_12-ParallelGateway_4 + //enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefe", maia, taskMetaData, 121 , 122); + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30", 32, 1, 120, "com.fp.viaticos.task.AsignarJefeComision", "Confirmar jefe inmediato", 14, "OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +//enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.Jefe", maia, taskMetaData, 117 , 118); + + + List old=(List)tasksMetaData.get("Confirmar jefe inmediato"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar jefe inmediato",old); + + + ExclusiveGateway_7-CallActivity_7 + CallActivity_7-ParallelGateway_3 + + + + + + + + CallActivity_7_maiaInput + CallActivity_7_taskMetaDataInput + + + CallActivity_7_actualTaskOutput + CallActivity_7_maiaOutput + CallActivity_7_taskMetaDataOutput + + + + maia + CallActivity_7_maiaInput + + + taskMetaData + CallActivity_7_taskMetaDataInput + + + CallActivity_7_actualTaskOutput + actualTask + + + CallActivity_7_maiaOutput + maia + + + CallActivity_7_taskMetaDataOutput + taskMetaData + + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",52, 1,120,"com.fp.viaticos.task.AsignarTesoreria", "Reajustar tesorería", 15,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 119 , 120); + + + + + + List old=(List)tasksMetaData.get("Reajustar tesorería"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Reajustar tesorería",old); + + + SequenceFlow_5 + SequenceFlow_6 + + + + + + + + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + DataOutput_3 + actualTask + + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",53, 1,120,"com.fp.viaticos.task.AsignarTesoreria", "Reajustar Movilización", 15,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 119 , 120); + + + + + + List old=(List)tasksMetaData.get("Reajustar Movilización"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Reajustar Movilización",old); + + + SequenceFlow_7 + SequenceFlow_8 + + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_4 + DataOutput_5 + DataOutput_6 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_4 + maia + + + DataOutput_5 + taskMetaData + + + DataOutput_6 + actualTask + + + + + + ParallelGateway_4-ScriptTask_11 + ScriptTask_11-EndEvent_3 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_9 + ParallelGateway_4-ScriptTask_11 + FlowUtil.mail("com.fp.viaticos.mail.Empleado", maia, taskMetaData, 137, 138); + + + + ScriptTask_11-EndEvent_3 + + + + ParallelGateway_6-ScriptTask_2 + ScriptTask_2-EndEvent_1 + FlowUtil.endFlow(kcontext); + + + + + SequenceFlow_10 + ParallelGateway_6-ScriptTask_2 + FlowUtil.mail("com.fp.viaticos.mail.Empleado", maia, taskMetaData, 135, 136); + + + + ScriptTask_2-EndEvent_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/viaticosmanual.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/viaticosmanual.bpmn.svn-base new file mode 100644 index 0000000..6ad7c04 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/.svn/text-base/viaticosmanual.bpmn.svn-base @@ -0,0 +1,779 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",45, 1,120,"com.fp.viaticos.task.AsignarContabilidad", "Reajustar contabilidad", 15,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Contabilidad", maia, taskMetaData, 119 , 120); + + + List old=(List)tasksMetaData.get("Reajustar contabilidad"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Reajustar contabilidad",old); + + + + + + + + + + CallActivity_7_maiaInput + CallActivity_7_taskMetaDataInput + + + CallActivity_7_actualTaskOutput + CallActivity_7_maiaOutput + CallActivity_7_taskMetaDataOutput + + + + maia + CallActivity_7_maiaInput + + + taskMetaData + CallActivity_7_taskMetaDataInput + + + CallActivity_7_actualTaskOutput + actualTask + + + CallActivity_7_maiaOutput + maia + + + CallActivity_7_taskMetaDataOutput + taskMetaData + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",46, 1,120,"com.fp.viaticos.task.AsignarTalentoHumano", "Reajustar talento humano", 15,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.TalentoHumano", maia, taskMetaData, 119 , 120); + + + List old=(List)tasksMetaData.get("Reajustar talento humano"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Reajustar talento humano",old); + + + + + + + + + + CallActivity_8_maiaInput + CallActivity_8_taskMetaDataInput + + + CallActivity_8_actualTaskOutput + CallActivity_8_maiaOutput + CallActivity_8_taskMetaDataOutput + + + + maia + CallActivity_8_maiaInput + + + taskMetaData + CallActivity_8_taskMetaDataInput + + + CallActivity_8_actualTaskOutput + actualTask + + + CallActivity_8_maiaOutput + maia + + + CallActivity_8_taskMetaDataOutput + taskMetaData + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30", 41, 1, 120, "com.fp.viaticos.task.AsignarUsuarioIngresaSolicitud", "Generar Informe UI", 16, "OK_NO"); +kcontext.setVariable("taskMetaData", taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Empleado", maia, taskMetaData, 123, 124); + + + List old=(List)tasksMetaData.get("Generar Informe UI"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Generar Informe UI",old); + + + + + + + + + + CallActivity_5_maiaInput + CallActivity_5_taskMetaDataInput + + + CallActivity_5_actualTaskOutput + CallActivity_5_maiaOutput + CallActivity_5_taskMetaDataOutput + + + + maia + CallActivity_5_maiaInput + + + taskMetaData + CallActivity_5_taskMetaDataInput + + + CallActivity_5_actualTaskOutput + actualTask + + + CallActivity_5_maiaOutput + maia + + + CallActivity_5_taskMetaDataOutput + taskMetaData + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",44, 1,120,"com.fp.viaticos.task.AsignarTalentoHumano","Confirmar informe TH", 18,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.TalentoHumano", maia, taskMetaData, 131 , 132); + + + List old=(List)tasksMetaData.get("Confirmar informe TH"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar informe TH",old); + + + + + + + + + + CallActivity_10_maiaInput + CallActivity_10_taskMetaDataInput + + + CallActivity_10_actualTaskOutput + CallActivity_10_maiaOutput + CallActivity_10_taskMetaDataOutput + + + + maia + CallActivity_10_maiaInput + + + taskMetaData + CallActivity_10_taskMetaDataInput + + + CallActivity_10_actualTaskOutput + actualTask + + + CallActivity_10_maiaOutput + maia + + + CallActivity_10_taskMetaDataOutput + taskMetaData + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",42, 1,120,"com.fp.viaticos.task.AsignarTesoreria","Confirmar informe tesoreria" ,18,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 131 , 132); + + + List old=(List)tasksMetaData.get("Confirmar informe tesoreria"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar informe tesoreria",old); + + + + + + + + + + CallActivity_9_maiaInput + CallActivity_9_taskMetaDataInput + + + CallActivity_9_actualTaskOutput + CallActivity_9_maiaOutput + CallActivity_9_taskMetaDataOutput + + + + maia + CallActivity_9_maiaInput + + + taskMetaData + CallActivity_9_taskMetaDataInput + + + CallActivity_9_actualTaskOutput + actualTask + + + CallActivity_9_maiaOutput + maia + + + CallActivity_9_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",47, 1,120,"com.fp.viaticos.task.AsignarUsuarioIngresaSolicitud", "Confirmar comision UI", 13,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.UsaurioIngresoSolicitud", maia, taskMetaData, 115 , 116); + + + List old=(List)tasksMetaData.get("Confirmar comision UI"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar comision UI",old); + + + + + + + + + + CallActivity_4_maiaInput + CallActivity_4_taskMetaDataInput + + + CallActivity_4_actualTaskOutput + CallActivity_4_maiaOutput + CallActivity_4_taskMetaDataOutput + + + + maia + CallActivity_4_maiaInput + + + taskMetaData + CallActivity_4_taskMetaDataInput + + + CallActivity_4_actualTaskOutput + actualTask + + + CallActivity_4_maiaOutput + maia + + + CallActivity_4_taskMetaDataOutput + taskMetaData + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",43, 1,120,"com.fp.viaticos.task.AsignarTalentoHumano", "Confirmar talento humano", 12,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.TalentoHumano", maia, taskMetaData, 113 , 114); + + + List old=(List)tasksMetaData.get("Confirmar talento humano"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confimar talento humano",old); + + + + + + + + + + CallActivity_3_maiaInput + CallActivity_3_taskMetaDataInput + + + CallActivity_3_actualTaskOutput + CallActivity_3_maiaOutput + CallActivity_3_taskMetaDataOutput + + + + maia + CallActivity_3_maiaInput + + + taskMetaData + CallActivity_3_taskMetaDataInput + + + CallActivity_3_actualTaskOutput + actualTask + + + CallActivity_3_maiaOutput + maia + + + CallActivity_3_taskMetaDataOutput + taskMetaData + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",40, 1,120,"com.fp.viaticos.task.AsignarTesoreria", "Confirmar tesorería", 12,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 113 , 114); + + + List old=(List)tasksMetaData.get("Confirmar tesorería"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar tesorería",old); + + + + + + + + + + CallActivity_2_maiaInput + CallActivity_2_taskMetaDataInput + + + CallActivity_2_actualTaskOutput + CallActivity_2_maiaOutput + CallActivity_2_taskMetaDataOutput + + + + maia + CallActivity_2_maiaInput + + + taskMetaData + CallActivity_2_taskMetaDataInput + + + CallActivity_2_actualTaskOutput + actualTask + + + CallActivity_2_maiaOutput + maia + + + CallActivity_2_taskMetaDataOutput + taskMetaData + + + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",40, 1,120,"com.fp.viaticos.task.AsignarTesoreria", "Confirmar movilización", 19,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 133 , 134); + + + List old=(List)tasksMetaData.get("Confirmar movilización"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Notificar movilización",old); + + + + + + + + + + CallActivity_11_maiaInput + CallActivity_11_taskMetaDataInput + + + CallActivity_11_actualTaskOutput + CallActivity_11_maiaOutput + CallActivity_11_taskMetaDataOutput + + + + maia + CallActivity_11_maiaInput + + + taskMetaData + CallActivity_11_taskMetaDataInput + + + CallActivity_11_actualTaskOutput + actualTask + + + CallActivity_11_maiaOutput + maia + + + CallActivity_11_taskMetaDataOutput + taskMetaData + + + + + + + return ("D".equals(taskMetaData.getResponse())); + + + + + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/casoprueba.bpmn b/base/bpm/bpmlib/src/main/resources/flows/casoprueba.bpmn new file mode 100644 index 0000000..262944a --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/casoprueba.bpmn @@ -0,0 +1,596 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + + System.out.println("DESEMBOLSO *****************************"); +taskMetaData=FlowUtil.createTaskInfo("13",514, 1,10,"ASIGNAROFICIAL",Kind.OK); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Desembolso",actualTask); + + + _31-_32 + _32-_18 + + + + + + + + _32_maiaInput + _32_taskMetaDataInput + + + _32_actualTaskOutput + _32_maiaOutput + _32_taskMetaDataOutput + + + + maia + _32_maiaInput + + + taskMetaData + _32_taskMetaDataInput + + + _32_actualTaskOutput + actualTask + + + _32_maiaOutput + maia + + + _32_taskMetaDataOutput + taskMetaData + + + + + + System.out.println(">>>>>>>>>>Valida Personas"); +taskMetaData=FlowUtil.createTaskInfo("13",518, 1,10,"VALIDAPERSONAS",Kind.OK); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Validar Personas",actualTask); +System.out.println(">>>>>>>Validar Personas>>>>"+taskMetaData.getResponse()); + + + _15-_5 + _5-_17 + + + + + + + + _5_maiaInput + _5_taskMetaDataInput + + + _5_actualTaskOutput + _5_maiaOutput + _5_taskMetaDataOutput + + + + maia + _5_maiaInput + + + taskMetaData + _5_taskMetaDataInput + + + _5_actualTaskOutput + actualTask + + + _5_maiaOutput + maia + + + _5_taskMetaDataOutput + taskMetaData + + + + _16-_12 + + + + _1-_15 + _15-_5 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + _5-_17 + _17-_19 + _17-_18 + + + _18-_16 + _16-_12 + FlowUtil.endFlow(kcontext); + + + _17-_19 + _19-_23 + _19-_25 + _19-_24 + + + _17-_18 + _31-_18 + _32-_18 + _27-_18 + _28-_18 + _26-_18 + _18-_16 + + + + + taskMetaDataVM=FlowUtil.createTaskInfo("13",499, 1,10,"VALIDAMONTO",Kind.OK_NO); +kcontext.setVariable("taskMetaDataVM",taskMetaDataVM); +System.out.println(">>>>>ValidaMonto "+taskMetaDataVM); + + + tasksMetaData.put("V.Monto",actualTaskVM); + + + _19-_23 + _23-_26 + + + + + + + + _23_maiaInput + _23_taskMetaDataInput + + + _23_actualTaskOutput + _23_maiaOutput + _23_taskMetaDataOutput + + + + maia + _23_maiaInput + + + taskMetaDataVM + _23_taskMetaDataInput + + + _23_actualTaskOutput + actualTaskVM + + + _23_maiaOutput + maia + + + _23_taskMetaDataOutput + taskMetaDataVM + + + + + + taskMetaDataVT=FlowUtil.createTaskInfo("13",510, 1,10,"VALIDATASA",Kind.OK_NO); +kcontext.setVariable("taskMetaDataVT",taskMetaDataVT); +System.out.println(">>>>>ValidaTasa "+taskMetaDataVT); + + + tasksMetaData.put("V.Tasa",actualTaskVT); + + + _19-_25 + _25-_27 + + + + + + + + _25_maiaInput + _25_taskMetaDataInput + + + _25_actualTaskOutput + _25_maiaOutput + _25_taskMetaDataOutput + + + + maia + _25_maiaInput + + + taskMetaDataVT + _25_taskMetaDataInput + + + _25_actualTaskOutput + actualTaskVT + + + _25_maiaOutput + maia + + + _25_taskMetaDataOutput + taskMetaDataVT + + + + + + taskMetaDataVP=FlowUtil.createTaskInfo("13",499, 1,10,"VALIDAPLAZO",Kind.OK_NO); +kcontext.setVariable("taskMetaDataVP",taskMetaDataVP); +System.out.println(">>>>>ValidaPlazo "+taskMetaDataVP); + + + tasksMetaData.put("V.Plazo",actualTaskVP); + + + _19-_24 + _24-_28 + + + + + + + + _24_maiaInput + _24_taskMetaDataInput + + + _24_actualTaskOutput + _24_maiaOutput + _24_taskMetaDataOutput + + + + maia + _24_maiaInput + + + taskMetaDataVP + _24_taskMetaDataInput + + + _24_actualTaskOutput + actualTaskVP + + + _24_maiaOutput + maia + + + _24_taskMetaDataOutput + taskMetaDataVP + + + + _25-_27 + _27-_18 + _27-_29 + + + _23-_26 + _26-_18 + _26-_29 + + + _26-_29 + _27-_29 + _28-_29 + _29-_30 + + + _24-_28 + _28-_18 + _28-_29 + + + _30-_31 + _31-_32 + _31-_18 + + + + + taskMetaData=FlowUtil.createTaskInfo("13",510, 1,10,"ASIGNARCOMITE",Kind.OK_NO); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Aprobacion",actualTask); +System.out.println("maia Aprobacion "+maia); +((java.util.Map)maia.get("request")).put("accountnumber",taskMetaData.getAditionalData().get("accountnumber")); + + + _29-_30 + _30-_31 + + + + + + + + _30_maiaInput + _30_taskMetaDataInput + + + _30_actualTaskOutput + _30_maiaOutput + _30_taskMetaDataOutput + + + + maia + _30_maiaInput + + + taskMetaData + _30_taskMetaDataInput + + + _30_actualTaskOutput + actualTask + + + _30_maiaOutput + maia + + + _30_taskMetaDataOutput + taskMetaData + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + return taskMetaData.getResponse().compareTo("D")==0; + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + return taskMetaDataVT.getResponse().compareTo("D")==0; + + + return taskMetaDataVP.getResponse().compareTo("D")==0; + + + return taskMetaDataVM.getResponse().compareTo("D")==0; + + + + + + + + return taskMetaDataVM.getResponse().compareTo("D")!=0; + + + return taskMetaDataVT.getResponse().compareTo("D")!=0; + + + return taskMetaDataVP.getResponse().compareTo("D")!=0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/catalogoprueba.bpmn b/base/bpm/bpmlib/src/main/resources/flows/catalogoprueba.bpmn new file mode 100644 index 0000000..d5e5557 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/catalogoprueba.bpmn @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + +System.out.println("INICIA FLUJO SCRPT ********************************"); + + + + + + System.out.println("ANTES LLAMAR A TASK INFO BY CLASS NAME"); +taskMetaData=FlowUtil.createTaskInfoByClassName("1",49, 1,5,null,1,"OK_NO"); +taskMetaData.setUserId("JVACA"); +taskMetaData.setAction("A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Llamar transaccion",actualTask); + + + SequenceFlow_2 + SequenceFlow_4 + + + + + + + + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + DataOutput_3 + actualTask + + + + + + SequenceFlow_4 + SequenceFlow_5 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/entries b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/entries new file mode 100644 index 0000000..5d8a9dc --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/entries @@ -0,0 +1,980 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/resources/flows/comaco +svn://172.17.26.185/COMACO + + + +2022-04-19T02:35:58.553023Z +4666 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +CargaDeposito.bpmn +file + + + + +2022-07-28T03:40:46.078817Z +d4bbf291bed64cb441f6359792e9b98f +2015-07-09T13:27:13.603719Z +4186 +cpiedra + + + + + + + + + + + + + + + + + + + + + +21324 + +subproceso.bpmn +file + + + + +2022-07-28T03:40:46.078817Z +59134348d2a5e79a8202e1d6a2f7dd28 +2014-10-23T05:08:11.379458Z +1873 +cpiedra + + + + + + + + + + + + + + + + + + + + + +16015 + +notificacionAnulacionTramite.bpmn +file + + + + +2022-07-28T03:40:46.078817Z +eaf2878c62fb9c3000c7df664784ca00 +2014-10-01T11:23:26.871913Z +1291 +abenalcazar + + + + + + + + + + + + + + + + + + + + + +15282 + +EmisionDocumentoHabilitante.bpmn +file + + + + +2022-07-28T03:40:46.078817Z +cec619806acdb9ff16dbb5e38b3feb2e +2015-08-05T06:39:04.272674Z +4256 +cpiedra + + + + + + + + + + + + + + + + + + + + + +69681 + +solicitudFlow.bpmn +file + + + + +2022-07-28T03:40:46.079817Z +f6e8c56f25e34c73d208d1d76ce8b2da +2014-10-06T09:08:36.409627Z +1399 +fpazmino + + + + + + + + + + + + + + + + + + + + + +35248 + +EjecucionTramite.bpmn +file + + + + +2022-07-28T03:40:46.079817Z +f20614f90d6b59ae71d646110526901e +2014-12-16T11:36:21.254912Z +3542 +gbenavides + + + + + + + + + + + + + + + + + + + + + +53117 + +EjecucionImpresion.bpmn +file + + + + +2022-07-28T03:40:46.079817Z +6aa994bb999416fad406ba4cf052d754 +2014-12-10T03:17:02.288100Z +3388 +cpiedra + + + + + + + + + + + + + + + + + + + + + +18919 + +RecepcionArmas.bpmn +file + + + + +2022-07-28T03:40:46.080817Z +5bea11f17962339662f30c630ccebe01 +2015-02-20T10:59:33.469980Z +3829 +cpiedra + + + + + + + + + + + + + + + + + + + + + +14290 + +EjecucionDevolucion.bpmn +file + + + + +2022-07-28T03:40:46.080817Z +8a0d95507a455a3cfc831711865262c0 +2015-01-09T12:20:49.789804Z +3739 +cpiedra + + + + + + + + + + + + + + + + + + + + + +27300 + +EjecucionAutorizacion.bpmn +file + + + + +2022-07-28T03:40:46.080817Z +619ab78abcec0c6865bf9d880fcacfb5 +2015-08-05T06:39:04.272674Z +4256 +cpiedra + + + + + + + + + + + + + + + + + + + + + +46508 + +EjecucionInternacion.bpmn +file + + + + +2022-07-28T03:40:46.080817Z +356e480dcf8b8a4d7fb0a1e0cdca9081 +2014-12-16T11:36:21.254912Z +3542 +gbenavides + + + + + + + + + + + + + + + + + + + + + +22036 + +solicitud.bpmn +file + + + + +2022-07-28T03:40:46.081817Z +ed93cf5ba26db35f06f94d618ab70123 +2014-10-28T03:41:58.186218Z +2015 +ogarcia + + + + + + + + + + + + + + + + + + + + + +13855 + +BajaDestruccion.bpmn +file + + + + +2022-07-28T03:40:46.081817Z +7e10af4790e9b5c438dc306c8856c3d3 +2014-12-08T13:26:13.111197Z +3349 +cpiedra + + + + + + + + + + + + + + + + + + + + + +38199 + +autorizarDocumentoCarlos.bpmn +file + + + + +2022-07-28T03:40:46.081817Z +fa5cb75bbc88db785c4d967766fb9410 +2014-10-02T05:58:32.610486Z +1312 +cguzman + + + + + + + + + + + + + + + + + + + + + +19266 + +decomiso.bpmn +file + + + + +2022-07-28T03:40:46.081817Z +86852f9300b4d6a23abc1ef9b05646c9 +2014-10-18T04:43:17.366144Z +1701 +cpiedra + + + + + + + + + + + + + + + + + + + + + +14449 + +EjecutarInscripcion.bpmn +file + + + + +2022-07-28T03:40:46.082817Z +db738f83056d6379647062cc8429e578 +2014-12-16T11:36:21.254912Z +3542 +gbenavides + + + + + + + + + + + + + + + + + + + + + +21552 + +EjecucionPermiso.bpmn +file + + + + +2022-07-28T03:40:46.082817Z +f802055d0c4780334193c97847e0ef1b +2014-12-16T11:36:21.254912Z +3542 +gbenavides + + + + + + + + + + + + + + + + + + + + + +19771 + +solicitudCarlos.bpmn +file + + + + +2022-07-28T03:40:46.082817Z +e753b9f062c65d5c0e5aabb1d73798d2 +2014-09-25T12:54:24.371290Z +1147 +cguzman + + + + + + + + + + + + + + + + + + + + + +12501 + +EnvioArmas.bpmn +file + + + + +2022-07-28T03:40:46.082817Z +4c1fab010700446b940d3a4332b2bede +2016-03-18T20:02:28.170272Z +4515 +fpazmino + + + + + + + + + + + + + + + + + + + + + +23848 + +EjecucionApertura.bpmn +file + + + + +2022-07-28T03:40:46.083817Z +e7538d0b170249edc26d1e80ea1c3c77 +2014-12-16T11:36:21.254912Z +3542 +gbenavides + + + + + + + + + + + + + + + + + + + + + +21414 + +PlanificacionInspeccion.bpmn +file + + + + +2022-07-28T03:40:46.083817Z +005868a5f4df830d7ec2ad9045fa4518 +2014-12-10T03:17:02.288100Z +3388 +cpiedra + + + + + + + + + + + + + + + + + + + + + +34107 + +decomisarArmaCarlos.bpmn +file + + + + +2022-07-28T03:40:46.083817Z +e8178e6bea5e9f9f37e04a9a1145d130 +2014-10-02T05:59:00.140347Z +1313 +cguzman + + + + + + + + + + + + + + + + + + + + + +16232 + +EjecucionIncrementoArmas.bpmn +file + + + + +2022-07-28T03:40:46.083817Z +1f5d9b1acc18121e29ce46aa4d20b828 +2014-12-16T11:36:21.254912Z +3542 +gbenavides + + + + + + + + + + + + + + + + + + + + + +21186 + +EjecucionInspeccion.bpmn +file + + + + +2022-07-28T03:40:46.084817Z +f26d5b1e3030bcecd3fa74207a216cba +2015-08-05T06:39:04.272674Z +4256 +cpiedra + + + + + + + + + + + + + + + + + + + + + +16031 + +RecepcionSolicitudRequisitos.bpmn +file + + + + +2022-07-28T03:40:46.084817Z +95d2b5eb48991e4f77b12d55694040cc +2014-12-16T11:36:21.254912Z +3542 +gbenavides + + + + + + + + + + + + + + + + + + + + + +25518 + +RegistroDecomiso.bpmn +file + + + + +2022-07-28T03:40:46.084817Z +207cdd3f68f1445ba814981909a26f65 +2014-12-29T13:29:30.873199Z +3674 +cpiedra + + + + + + + + + + + + + + + + + + + + + +22501 + +EjecutarCertificados.bpmn +file + + + + +2022-07-28T03:40:46.084817Z +1e646e49616b0499a3a4566452706504 +2014-12-16T11:36:21.254912Z +3542 +gbenavides + + + + + + + + + + + + + + + + + + + + + +19188 + +EjecucionEmisionGuiaTransito.bpmn +file + + + + +2022-07-28T03:40:46.085817Z +b81b0c5aed8aa1e592d945d7711602d4 +2014-12-18T11:49:51.624673Z +3594 +gbenavides + + + + + + + + + + + + + + + + + + + + + +29364 + diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/BajaDestruccion.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/BajaDestruccion.bpmn.svn-base new file mode 100644 index 0000000..f74206d --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/BajaDestruccion.bpmn.svn-base @@ -0,0 +1,576 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + System.out.println("****Ingresa a preparar el flujo******"); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",55, 1,120, "Revisar reporte armas a destruccion", 20, "OK_NO"); + +//para asignar a un grupo especifico +maia.put("grupo","SUPERV_DECO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Revisar reporte armas a destruccion",actualTask); + + + SequenceFlow_2 + SequenceFlow_4 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Revisar reporte armas a destruccion + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",56, 1,120, "Aprobar reporte de armas a destruccion Jefe Dpto", 21, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setGroupId("JEFE_DEPARTAMENTO_ARMAS_"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Aprobar reporte de armas a destruccion Jefe Dpto",actualTask); + + + SequenceFlow_4 + SequenceFlow_6 + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + + + + _DataInput_16 + + Aprobar reporte de armas a destruccion Jefe Dpto + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_8 + + + + SequenceFlow_9 + SequenceFlow_11 + SequenceFlow_12 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + + + taskMetaData=FlowUtil.createTaskInfo("30",101, 1,120, "Firmar reporte", 23, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setGroupId("JEFE_COMANDO_CONJUNTO_"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar reporte",actualTask); + + + SequenceFlow_12 + SequenceFlow_13 + + + + + + + + + + + + + + DataInput_17 + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_21 + DataInput_22 + DataInput_23 + DataInput_24 + DataInput_25 + + + DataOutput_3 + DataOutput_5 + + + + DataInput_17 + + Firmar reporte + _DataInput_16 + + + + DataInput_18 + + + DataInput_19 + + + DataInput_20 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_21 + + + DataInput_22 + + + DataInput_23 + + + maia + DataInput_24 + + + taskMetaData + DataInput_25 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + SequenceFlow_11 + + + + + SequenceFlow_1 + + + + SequenceFlow_14 + SequenceFlow_1 + FlowUtil.endFlow(kcontext); + + + SequenceFlow_13 + SequenceFlow_14 + System.out.println("Pendiente ejecutar clase que actualiza el inventario"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarInventBajaDestrucc", maia); + + + + + + _1-_15 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",57, 1,120, "Aprobar reporte de armas a destruccion Jefe CC", 22, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setGroupId("JEFE_COMANDO_CONJUNTO_"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Aprobar reporte de armas a destruccion Jefe CC",actualTask); + + + SequenceFlow_7 + SequenceFlow_9 + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + DataInput_6 + DataInput_7 + DataInput_8 + DataInput_9 + DataInput_10 + + + DataOutput_1 + DataOutput_2 + + + + DataInput_1 + + Aprobar reporte de armas a destruccion Jefe CC + _DataInput_16 + + + + DataInput_2 + + + DataInput_3 + + + DataInput_4 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_6 + + + DataInput_7 + + + DataInput_8 + + + maia + DataInput_9 + + + taskMetaData + DataInput_10 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_6 + SequenceFlow_7 + SequenceFlow_8 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/CargaDeposito.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/CargaDeposito.bpmn.svn-base new file mode 100644 index 0000000..8686daf --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/CargaDeposito.bpmn.svn-base @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_11 + + + + SequenceFlow_10 + SequenceFlow_11 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_9 + SequenceFlow_10 + System.out.println("Ingresa a tarea de enviar el mail de Notificar inconsistencia deposito"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 17 , 18); + + + + _1-_15 + SequenceFlow_1 + System.out.println("Ingresa al flujo de carga deposito"); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",42, 1,120, "Validar transaccion de deposito", 24, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidaFlujoCargaDeposito", maia); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar transaccion de deposito",actualTask); + + + SequenceFlow_1 + SequenceFlow_6 + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + + + + _DataInput_16 + + Validar transaccion de deposito + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + _1-_15 + + + + + + //taskMetaData=FlowUtil.createTaskInfoByClassName("30",24, 1,30,"com.fp.viaticos.task.AsignarEmpleado", "Modificar empleado", 11, "OK_NO"); +//kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_2 + SequenceFlow_15 + + + + + + + DataInput_18 + DataInput_19 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_18 + + + taskMetaData + DataInput_19 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + + _16-_12 + + + + SequenceFlow_15 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_6 + SequenceFlow_9 + SequenceFlow_2 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionApertura.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionApertura.bpmn.svn-base new file mode 100644 index 0000000..bafc009 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionApertura.bpmn.svn-base @@ -0,0 +1,311 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar Info Agencias", 1, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar Info Agencias",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + + + + + + _DataInput_191 + _DataInput_192 + _DataInput_193 + _DataInput_194 + _DataInput_195 + _DataInput_196 + _DataInput_197 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_191 + + Validar Info Agencias + _DataInput_191 + + + + _DataInput_192 + + + _DataInput_193 + + + _DataInput_194 + + #{taskMetaData.groupId} + _DataInput_194 + + + + _DataInput_195 + + + _DataInput_196 + + + _DataInput_197 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + SequenceFlow_5 + SequenceFlow_6 + //FlowUtil.endFlow(kcontext); + + + SequenceFlow_6 + + + + + SequenceFlow_8 + SequenceFlow_9 + //FlowUtil.endFlow(kcontext); + + + SequenceFlow_9 + + + + + + + + + + + SequenceFlow_7 + SequenceFlow_8 + + + + + + + DataInput_5 + DataInput_6 + + + DataOutput_5 + DataOutput_6 + + + + maia + DataInput_5 + + + taskMetaData + DataInput_6 + + + DataOutput_5 + maia + + + DataOutput_6 + taskMetaData + + + + + SequenceFlow_4 + SequenceFlow_5 + System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + SequenceFlow_3 + SequenceFlow_4 + SequenceFlow_7 + + + System.out.println("Camino D"); +return ("D".equals(taskMetaData.getResponse())); + + + System.out.println("Camino A"); +return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionAutorizacion.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionAutorizacion.bpmn.svn-base new file mode 100644 index 0000000..b9809f4 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionAutorizacion.bpmn.svn-base @@ -0,0 +1,631 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + _1-_15 + SequenceFlow_1 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar tipo de Autorizacion", 1, "OK_NO"); +maia.put("grupo","SUPERV_INSP_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar tipo de Autorizacion",actualTask); + + + SequenceFlow_1 + SequenceFlow_12 + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + DataInput_5 + DataInput_6 + DataInput_12 + DataInput_7 + DataInput_8 + + + DataOutput_6 + DataOutput_7 + + + + DataInput_1 + + Validar tipo de Autorizacion + _DataInput_149 + + + + DataInput_2 + + + DataInput_3 + + + DataInput_4 + + #{taskMetaData.groupId} + _DataInput_152 + + + + DataInput_5 + + + DataInput_6 + + + DataInput_12 + + + maia + DataInput_7 + + + taskMetaData + DataInput_8 + + + DataOutput_6 + maia + + + DataOutput_7 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_16 + + + + SequenceFlow_12 + SequenceFlow_15 + SequenceFlow_7 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + Requiere Inspeccion + SequenceFlow_7 + SequenceFlow_13 + System.out.println("............................................................................................Autorizacion Previa de Importacion"); +FlowUtil.executeClass("com.fp.armas.task.ValAutorizacionPreviaImporta", maia); +if(taskMetaData ==null){ + taskMetaData = new com.fp.simple.dto.TaskInfo(); +} +taskMetaData.setResponse((maia.get("previaimportacion")!=null)?""+maia.get("previaimportacion"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_13 + SequenceFlow_19 + SequenceFlow_20 + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar tipo de Autorizacion VUE", 1, "OK_NO"); +taskMetaData.setGroupId("ANALISTA_VUE"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar tipo de Autorizacion VUE",actualTask); + + + SequenceFlow_19 + SequenceFlow_21 + + + + + + + + + + + + + + DataInput_14 + DataInput_15 + DataInput_16 + DataInput_17 + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_21 + DataInput_22 + + + DataOutput_1 + DataOutput_2 + + + + DataInput_14 + + Validar tipo de Autorizacion VUE + _DataInput_149 + + + + DataInput_15 + + + DataInput_16 + + + DataInput_17 + + #{taskMetaData.groupId} + _DataInput_152 + + + + DataInput_18 + + + DataInput_19 + + + DataInput_20 + + + maia + DataInput_21 + + + taskMetaData + DataInput_22 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_17 + SequenceFlow_2 + SequenceFlow_3 + + + return ("N".equals(taskMetaData.getResponse())); + + + return ("Y".equals(taskMetaData.getResponse())); + + + SequenceFlow_8 + _16-_12 + + + + Requiere Inspeccion + SequenceFlow_22 + SequenceFlow_17 + System.out.println(".............................................................................................Requiere Inspeccion :"); +FlowUtil.executeClass("com.fp.armas.task.RequiereInspeccion", maia); +if(taskMetaData ==null){ + taskMetaData = new com.fp.simple.dto.TaskInfo(); +} +taskMetaData.setResponse((maia.get("inspeccion")!=null)?""+maia.get("inspeccion"):null); +System.out.println(".............................................................................................Requiere Inspeccion :"+taskMetaData.getResponse()); +kcontext.setVariable("taskMetaData",taskMetaData); +System.out.println(".............................................................................................Requiere Inspeccion :"+taskMetaData.getResponse()); + + + + SequenceFlow_2 + SequenceFlow_9 + SequenceFlow_5 + + + + _16-_12 + + + + + + System.out.println("............................................................................................ Inspeccion :"); + + + System.out.println("............................................................................................ Inspeccion OK"); +FlowUtil.executeClass("com.fp.armas.task.ValidaInspeccion", maia); +if(taskMetaData ==null){ + taskMetaData = new com.fp.simple.dto.TaskInfo(); +} +taskMetaData.setResponse((maia.get("tramiteproceso")!=null)?""+maia.get("tramiteproceso"):null); +kcontext.setVariable("taskMetaData",taskMetaData); +System.out.println("..........................................................................................regreso... :"+taskMetaData.getResponse()); + + + SequenceFlow_3 + SequenceFlow_4 + + + + + + + DataInput_11 + DataInput_13 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + taskMetaData + DataInput_13 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + + SequenceFlow_11 + + + + + + + SequenceFlow_5 + SequenceFlow_8 + + + + + + + DataInput_9 + DataInput_10 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_9 + + + taskMetaData + DataInput_10 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + + SequenceFlow_10 + SequenceFlow_11 + + + + return ("D".equals(taskMetaData.getResponse())); + + + + SequenceFlow_20 + SequenceFlow_21 + SequenceFlow_22 + + + + SequenceFlow_4 + SequenceFlow_9 + SequenceFlow_10 + + + return ("Y".equals(taskMetaData.getResponse())); + + + return ("N".equals(taskMetaData.getResponse())); + + + SequenceFlow_15 + SequenceFlow_16 + System.out.println("............................................................................................ RECHAZA VALIDAR TIPO SOLICITUD:"); +System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones","Tramite Anulado en Validar Tipo De Autorizacion"+datosmail.get("observaciones")); +}else{ +maia.put("observaciones","Tramite Anulado en Validar Tipo De Autorizacion"); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionDevolucion.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionDevolucion.bpmn.svn-base new file mode 100644 index 0000000..37c9cb5 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionDevolucion.bpmn.svn-base @@ -0,0 +1,411 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_10 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + _1-_15 + + + + SequenceFlow_11 + SequenceFlow_5 + SequenceFlow_7 + + + + + taskMetaData=FlowUtil.createTaskInfo("30",32, 1,120, "Autorizar Devolucion",37, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +System.out.println("1..................."); +actualTask=new java.util.ArrayList(); +System.out.println("2..................."); +kcontext.setVariable("actualTask",actualTask); +System.out.println("3..................."); +actualTask.add(taskMetaData); +System.out.println("4..................."); +System.out.println("5..................."); +tasksMetaData.put("Autorizar Devolucion",actualTask); +System.out.println("6..................."); + + + SequenceFlow_5 + SequenceFlow_1 + + + + + + + + + + + + + + DataInput_13 + DataInput_14 + DataInput_15 + DataInput_16 + DataInput_17 + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_21 + + + DataOutput_1 + DataOutput_2 + + + + DataInput_13 + + Autorizar Devolucion + _DataInput_16 + + + + DataInput_14 + + + DataInput_15 + + + DataInput_16 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_17 + + + DataInput_18 + + + DataInput_19 + + + maia + DataInput_20 + + + taskMetaData + DataInput_21 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_7 + _16-_12 + System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + _16-_12 + + + + return ("D".equals(taskMetaData.getResponse())); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",29, 1,120, "Informacion Devolucion", 36, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","TEC_ALM_CENTRO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Informacion Devolucion",actualTask); + + + + SequenceFlow_10 + SequenceFlow_11 + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + DataInput_5 + DataInput_6 + DataInput_7 + DataInput_8 + DataInput_9 + + + DataOutput_3 + DataOutput_5 + + + + DataInput_1 + + Informacion Devolucion + _DataInput_16 + + + + DataInput_2 + + + DataInput_3 + + + DataInput_4 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_5 + + + DataInput_6 + + + DataInput_7 + + + maia + DataInput_8 + + + taskMetaData + DataInput_9 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_2 + SequenceFlow_6 + System.out.println("fin"); +//FlowUtil.endFlow(kcontext); +System.out.println("fin1"); + + + + SequenceFlow_6 + + + + + + + SequenceFlow_1 + SequenceFlow_2 + + + + + + + DataInput_10 + DataInput_11 + + + DataOutput_4 + DataOutput_6 + + + + maia + DataInput_10 + + + taskMetaData + DataInput_11 + + + DataOutput_4 + maia + + + DataOutput_6 + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionEmisionGuiaTransito.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionEmisionGuiaTransito.bpmn.svn-base new file mode 100644 index 0000000..7282524 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionEmisionGuiaTransito.bpmn.svn-base @@ -0,0 +1,422 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + _1-_15 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_1 + SequenceFlow_5 + SequenceFlow_13 + + + return ("D".equals(taskMetaData.getResponse())); + + + + + taskMetaData=FlowUtil.createTaskInfo("30",23, 1,120, "Validacion Inconsistencias Informacion Solicitud", 56, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validacion Inconsistencias Informacion Solicitud",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Validacion Inconsistencias Informacion Solicitud + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_5 + SequenceFlow_6 + System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,61); + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_13 + SequenceFlow_16 + System.out.println(" Verifica cantidad armamento "); +FlowUtil.executeClass("com.fp.armas.task.VerificarCantidadArmas", maia); +taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("requierecustodia")!=null)?""+maia.get("requierecustodia"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + SequenceFlow_16 + SequenceFlow_20 + SequenceFlow_24 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_20 + SequenceFlow_15 + SequenceFlow_22 + + + + + + System.out.println(" Genera Orden trabajo "); +taskMetaData=FlowUtil.createTaskInfo("30",27, 1,120, "Generar Orden Trabajo", 55, "OK_NO"); +maia.put("grupo","SUPERV_INSP_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Generar Orden Trabajo",actualTask); + + + SequenceFlow_24 + SequenceFlow_15 + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + + + DataOutput_11 + DataOutput_12 + + + + maia + DataInput_1 + + + DataInput_2 + + Generar Orden Trabajo + DataInput_26 + + + + DataInput_3 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_4 + + + DataOutput_11 + maia + + + DataOutput_12 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + System.out.println(" Documento Habilitante "); + + + + + + SequenceFlow_22 + SequenceFlow_23 + + + + + + + + DataInput_90 + DataInput_91 + + + DataOutput_19 + DataOutput_20 + DataOutput_21 + + + + maia + DataInput_90 + + + taskMetaData + DataInput_91 + + + DataOutput_19 + taskMetaData + + + DataOutput_20 + maia + + + DataOutput_21 + actualTask + + + + + SequenceFlow_23 + _16-_12 + //FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + SequenceFlow_6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionImpresion.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionImpresion.bpmn.svn-base new file mode 100644 index 0000000..bf0a471 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionImpresion.bpmn.svn-base @@ -0,0 +1,285 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + _1-_15 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",50, 1,120, "Validar Reimpresion", 32, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData=new java.util.HashMap(); +tasksMetaData.put("Validar Reimpresion",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Validar Reimpresion + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + _16-_12 + + + + + + System.out.println("Imprime documento"); +taskMetaData=FlowUtil.createTaskInfo("30",59, 1,120, "Imprimir Documento", 51, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +//tasksMetaData =new java.util.HashMap(); +tasksMetaData.put("Imprimir Documento",actualTask); + + + SequenceFlow_7 + SequenceFlow_5 + + + + + + + + + DataInput_22 + DataInput_23 + DataInput_24 + DataInput_25 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_22 + + + DataInput_23 + + Imprimir Documento + DataInput_26 + + + + DataInput_24 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_25 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_8 + + + + SequenceFlow_5 + _16-_12 + //FlowUtil.endFlow(kcontext); + + + + SequenceFlow_1 + SequenceFlow_7 + SequenceFlow_8 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionIncrementoArmas.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionIncrementoArmas.bpmn.svn-base new file mode 100644 index 0000000..035545b --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionIncrementoArmas.bpmn.svn-base @@ -0,0 +1,306 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("actualTask",actualTask); +kcontext.setVariable("tasksMetaData",tasksMetaData); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar la Informacion Armas", 59, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar la Informacion Armas",actualTask); + + + SequenceFlow_2 + SequenceFlow_6 + + + + + + + + + + + + + + _DataInput_184 + _DataInput_185 + _DataInput_186 + _DataInput_187 + _DataInput_188 + _DataInput_189 + _DataInput_190 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_184 + + Validar la Informacion Armas + _DataInput_184 + + + + _DataInput_185 + + + _DataInput_186 + + + _DataInput_187 + + #{taskMetaData.groupId} + _DataInput_187 + + + + _DataInput_188 + + + _DataInput_189 + + + _DataInput_190 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_10 + SequenceFlow_11 + System.out.println(" Anula Incremento de Armas: "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + SequenceFlow_11 + SequenceFlow_12 + + + + SequenceFlow_6 + SequenceFlow_7 + SequenceFlow_10 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_8 + SequenceFlow_9 + \ + + + + + + + + + + SequenceFlow_7 + SequenceFlow_8 + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_4 + DataOutput_5 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_4 + maia + + + DataOutput_5 + taskMetaData + + + + + + SequenceFlow_9 + + + + SequenceFlow_12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionInspeccion.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionInspeccion.bpmn.svn-base new file mode 100644 index 0000000..17b6a78 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionInspeccion.bpmn.svn-base @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + System.out.println(".............................................................................................Inspeccion..:"); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",31, 1,120, "Registrar Inspeccion", 54, "OK_NO"); +maia.put("grupo","INSP_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Registrar Inspeccion",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Registrar Inspeccion + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + _1-_15 + + + + + SequenceFlow_1 + SequenceFlow_5 + SequenceFlow_6 + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_5 + _16-_12 + System.out.println("............................................................................................SI........................ :"+taskMetaData.getResponse()); + + + + + _16-_12 + + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_7 + + + + FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + SequenceFlow_6 + SequenceFlow_7 + System.out.println("............................................................................................ NO:"); +System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones","Tramite Anulado en Registrar Inspeccion"+datosmail.get("observaciones")); +}else{ +maia.put("observaciones","Tramite Anulado en Registrar Inspeccion"); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); +System.out.println("..........................................................................................no... :"+taskMetaData.getResponse()); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionInternacion.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionInternacion.bpmn.svn-base new file mode 100644 index 0000000..9b46d24 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionInternacion.bpmn.svn-base @@ -0,0 +1,320 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("actualTask",actualTask); +kcontext.setVariable("tasksMetaData",tasksMetaData); + + + + SequenceFlow_11 + SequenceFlow_12 + + + SequenceFlow_12 + + + + + SequenceFlow_4 + SequenceFlow_7 + SequenceFlow_10 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + + + + + + + SequenceFlow_7 + SequenceFlow_8 + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_4 + DataOutput_5 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_4 + maia + + + DataOutput_5 + taskMetaData + + + + + SequenceFlow_8 + SequenceFlow_9 + + + + SequenceFlow_10 + SequenceFlow_11 + System.out.println("***SE ANULO EL TRAMITE***"); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar Info Armas", 1, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar Info Armas",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + + + + + + _DataInput_184 + _DataInput_185 + _DataInput_186 + _DataInput_187 + _DataInput_188 + _DataInput_189 + _DataInput_190 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_184 + + Validar Info Armas + _DataInput_184 + + + + _DataInput_185 + + + _DataInput_186 + + + _DataInput_187 + + #{taskMetaData.groupId} + _DataInput_187 + + + + _DataInput_188 + + + _DataInput_189 + + + _DataInput_190 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_3 + SequenceFlow_4 + System.out.println("***SE ANULO EL TRAMITE***"); + + + + + SequenceFlow_9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionPermiso.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionPermiso.bpmn.svn-base new file mode 100644 index 0000000..551ca9e --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionPermiso.bpmn.svn-base @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_1 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData =new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",24, 1,120, "Receptar Armas", 45, "OK_NO"); +maia.put("grupo","TEC_ALM_CENTRO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Receptar Armas",actualTask); + + + SequenceFlow_1 + SequenceFlow_16 + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_1 + + + DataInput_2 + + Receptar Armas + DataInput_26 + + + + DataInput_3 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_4 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + _1-_15 + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",28, 1,120, "Ingresa Ficha Tecnica Arma", 46, "OK_NO"); +maia.put("grupo","ANALISTA_TIRO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ingresa Ficha Tecnica Arma",actualTask); + + + SequenceFlow_16 + SequenceFlow_17 + + + + + + + + + DataInput_6 + DataInput_7 + DataInput_8 + DataInput_9 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_6 + + + DataInput_7 + + Ingresa Ficha Tecnica Arma + DataInput_26 + + + + DataInput_8 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_9 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + SequenceFlow_12 + SequenceFlow_13 + //FlowUtil.endFlow(kcontext); + + + + + + + + + SequenceFlow_17 + SequenceFlow_12 + + + + + + + + DataInput_39 + DataInput_40 + + + DataOutput_14 + DataOutput_15 + DataOutput_16 + + + + maia + DataInput_39 + + + taskMetaData + DataInput_40 + + + DataOutput_14 + actualTask + + + DataOutput_15 + maia + + + DataOutput_16 + taskMetaData + + + + + SequenceFlow_13 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionTramite.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionTramite.bpmn.svn-base new file mode 100644 index 0000000..074ddda --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecucionTramite.bpmn.svn-base @@ -0,0 +1,721 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_4 + System.out.println("***Ingresa a la tarea prepara flujo***"); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + _1-_15 + + + + + SequenceFlow_4 + SequenceFlow_5 + System.out.println("***Ingresa a la tarea evaluar tipo de documento***"); +FlowUtil.executeClass("com.fp.armas.task.TipoDocumento", maia); +// taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("tipodocumento")!=null)?""+maia.get("tipodocumento"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_5 + SequenceFlow_11 + SequenceFlow_13 + SequenceFlow_15 + SequenceFlow_17 + SequenceFlow_19 + SequenceFlow_21 + SequenceFlow_24 + SequenceFlow_26 + SequenceFlow_27 + SequenceFlow_29 + + + + + + + SequenceFlow_30 + SequenceFlow_9 + + + + + + + DataInput_15 + DataInput_16 + + + DataOutput_6 + DataOutput_7 + + + + maia + DataInput_15 + + + taskMetaData + DataInput_16 + + + DataOutput_6 + maia + + + DataOutput_7 + taskMetaData + + + + + return ("EA".equals(taskMetaData.getResponse())); + + + return ("EI".equals(taskMetaData.getResponse())); + + + return ("ET".equals(taskMetaData.getResponse())); + + + return ("EG".equals(taskMetaData.getResponse())); + + + SequenceFlow_9 + SequenceFlow_12 + SequenceFlow_14 + SequenceFlow_16 + SequenceFlow_18 + SequenceFlow_20 + SequenceFlow_22 + SequenceFlow_23 + SequenceFlow_25 + SequenceFlow_28 + SequenceFlow_10 + + + + SequenceFlow_10 + _16-_12 + //FlowUtil.endFlow(kcontext); + + + + return ("EC".equals(taskMetaData.getResponse())); + + + + + + + SequenceFlow_13 + SequenceFlow_14 + + + + + + + DataInput_19 + DataInput_20 + + + DataOutput_11 + DataOutput_12 + + + + maia + DataInput_19 + + + taskMetaData + DataInput_20 + + + DataOutput_11 + maia + + + DataOutput_12 + taskMetaData + + + + + + + + + SequenceFlow_11 + SequenceFlow_12 + + + + + + + DataInput_17 + DataInput_18 + + + DataOutput_9 + DataOutput_10 + + + + maia + DataInput_17 + + + taskMetaData + DataInput_18 + + + DataOutput_9 + maia + + + DataOutput_10 + taskMetaData + + + + + return ("ER".equals(taskMetaData.getResponse())); + + + return ("ED".equals(taskMetaData.getResponse())); + + + return ("ES".equals(taskMetaData.getResponse())); + + + return ("EN".equals(taskMetaData.getResponse())); + + + + + + + SequenceFlow_19 + SequenceFlow_20 + + + + + + + DataInput_25 + DataInput_27 + + + DataOutput_17 + DataOutput_18 + + + + maia + DataInput_25 + + + taskMetaData + DataInput_27 + + + DataOutput_17 + maia + + + DataOutput_18 + taskMetaData + + + + + + + + + SequenceFlow_26 + SequenceFlow_25 + + + + + + + DataInput_33 + DataInput_34 + + + DataOutput_23 + DataOutput_24 + + + + maia + DataInput_33 + + + taskMetaData + DataInput_34 + + + DataOutput_23 + maia + + + DataOutput_24 + taskMetaData + + + + + + + + + SequenceFlow_21 + SequenceFlow_22 + + + + + + + DataInput_28 + DataInput_30 + + + DataOutput_19 + DataOutput_20 + + + + maia + DataInput_28 + + + taskMetaData + DataInput_30 + + + DataOutput_19 + maia + + + DataOutput_20 + taskMetaData + + + + + + + + + SequenceFlow_15 + SequenceFlow_16 + + + + + + + DataInput_21 + DataInput_22 + + + DataOutput_13 + DataOutput_14 + + + + maia + DataInput_21 + + + taskMetaData + DataInput_22 + + + DataOutput_13 + maia + + + DataOutput_14 + taskMetaData + + + + + + + + + SequenceFlow_27 + SequenceFlow_28 + + + + + + + DataInput_35 + DataInput_36 + + + DataOutput_25 + DataOutput_26 + + + + maia + DataInput_35 + + + taskMetaData + DataInput_36 + + + DataOutput_25 + maia + + + DataOutput_26 + taskMetaData + + + + + + + + + SequenceFlow_24 + SequenceFlow_23 + + + + + + + DataInput_31 + DataInput_32 + + + DataOutput_21 + DataOutput_22 + + + + maia + DataInput_31 + + + taskMetaData + DataInput_32 + + + DataOutput_21 + maia + + + DataOutput_22 + taskMetaData + + + + + + + + + SequenceFlow_17 + SequenceFlow_18 + + + + + + + DataInput_23 + DataInput_24 + + + DataOutput_15 + DataOutput_16 + + + + maia + DataInput_23 + + + taskMetaData + DataInput_24 + + + DataOutput_15 + maia + + + DataOutput_16 + taskMetaData + + + + + SequenceFlow_29 + SequenceFlow_30 + System.out.println("***Ingresa a la tarea NOTIFICAR FECHA DE ENTRGA DE ARMAS***"); +//enviar mail de notificacion +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 39,40); + + + return ("EP".equals(taskMetaData.getResponse())); + + + + _16-_12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecutarCertificados.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecutarCertificados.bpmn.svn-base new file mode 100644 index 0000000..80c8276 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecutarCertificados.bpmn.svn-base @@ -0,0 +1,276 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + SequenceFlow_12 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + SequenceFlow_10 + + + + SequenceFlow_9 + SequenceFlow_10 + System.out.println("TramiteAnulado"); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ejecutar Certificados",actualTask); + + + SequenceFlow_8 + SequenceFlow_5 + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_3 + DataOutput_4 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_3 + maia + + + DataOutput_4 + taskMetaData + + + + + SequenceFlow_13 + SequenceFlow_8 + SequenceFlow_9 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_5 + SequenceFlow_6 + + + + SequenceFlow_1 + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Valida Informacion Certificado", 58, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Valida Informacion Certificado",actualTask); + + + SequenceFlow_12 + SequenceFlow_13 + + + + + + + + + DataInput_5 + DataInput_6 + DataInput_7 + DataInput_8 + + + DataOutput_5 + DataOutput_6 + + + + maia + DataInput_5 + + + DataInput_6 + + Valida Informacion Certificado + DataInput_26 + + + + DataInput_7 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_8 + + + DataOutput_5 + maia + + + DataOutput_6 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecutarInscripcion.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecutarInscripcion.bpmn.svn-base new file mode 100644 index 0000000..f4e4fcd --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EjecutarInscripcion.bpmn.svn-base @@ -0,0 +1,313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Valida Info Inscripcion", 1, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Valida Info Inscripcion",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + + + + + + _DataInput_149 + _DataInput_150 + _DataInput_151 + _DataInput_152 + _DataInput_153 + _DataInput_154 + _DataInput_155 + DataInput_2 + DataInput_3 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_149 + + Valida Info Inscripcion + _DataInput_149 + + + + _DataInput_150 + + + _DataInput_151 + + + _DataInput_152 + + #{taskMetaData.groupId} + _DataInput_152 + + + + _DataInput_153 + + + _DataInput_154 + + + _DataInput_155 + + + maia + DataInput_2 + + + taskMetaData + DataInput_3 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ejecutar Certificados",actualTask); + + + SequenceFlow_4 + SequenceFlow_5 + + + + + + + DataInput_4 + DataInput_5 + + + DataOutput_3 + DataOutput_4 + + + + maia + DataInput_4 + + + taskMetaData + DataInput_5 + + + DataOutput_3 + maia + + + DataOutput_4 + taskMetaData + + + + SequenceFlow_5 + SequenceFlow_6 + //FlowUtil.endFlow(kcontext); + + + + + SequenceFlow_7 + SequenceFlow_9 + System.out.println("***SE ANULO EL TRAMITE***"); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + SequenceFlow_9 + SequenceFlow_10 + //FlowUtil.endFlow(kcontext); + + + + SequenceFlow_10 + + + + + SequenceFlow_3 + SequenceFlow_4 + SequenceFlow_7 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EmisionDocumentoHabilitante.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EmisionDocumentoHabilitante.bpmn.svn-base new file mode 100644 index 0000000..8974da0 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EmisionDocumentoHabilitante.bpmn.svn-base @@ -0,0 +1,992 @@ + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_9 + SequenceFlow_1 + SequenceFlow_18 + + + return ("D".equals(taskMetaData.getResponse())); + + + + + taskMetaData=FlowUtil.createTaskInfo("30",102, 1,120, "Generar Reporte", 35, "OK_NO"); +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Generar Reporte",actualTask); + + + SequenceFlow_17 + SequenceFlow_20 + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_1 + + + DataInput_2 + + Generar Reporte + DataInput_26 + + + + DataInput_3 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_4 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + SequenceFlow_19 + SequenceFlow_17 + SequenceFlow_12 + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_1 + SequenceFlow_13 + System.out.println("ingresa a enviar el mail"); +//enviar mail de rechazo +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + SequenceFlow_18 + SequenceFlow_19 + FlowUtil.executeClass("com.fp.armas.task.FechaCaducidadEstadoArma", maia); +FlowUtil.executeClass("com.fp.armas.task.TramiteAprobado", maia); +FlowUtil.executeClass("com.fp.armas.task.TipoArchivoControl", maia); +FlowUtil.executeClass("com.fp.armas.task.FinalizarDocumentoHabilitante", maia); +taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.getAditionalData().put("datosmail", maia.get("datosmail")); +taskMetaData.setResponse((maia.get("tipoarchivo")!=null)?""+maia.get("tipoarchivo"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",101, 1,120, "Firmar Tramite Supervisor", 38, "OK_NO"); +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar Tramite Supervisor",actualTask); + + + SequenceFlow_20 + SequenceFlow_5 + + + + + + + + + + + + + + DataInput_21 + DataInput_22 + DataInput_23 + DataInput_24 + DataInput_25 + DataInput_27 + DataInput_28 + DataInput_30 + DataInput_31 + + + DataOutput_6 + DataOutput_7 + + + + DataInput_21 + + Firmar Tramite Supervisor + _DataInput_16 + + + + DataInput_22 + + + DataInput_23 + + + DataInput_24 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_25 + + + DataInput_27 + + + DataInput_28 + + + maia + DataInput_30 + + + taskMetaData + DataInput_31 + + + DataOutput_6 + maia + + + DataOutput_7 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("A".equals(taskMetaData.getResponse())); + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",35,1,120,null, "Notificar fecha de Emision", 6, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Notificar fecha de Emision",actualTask); + + + SequenceFlow_12 + SequenceFlow_11 + + + + + + + + + + + + + + DataInput_15 + DataInput_16 + DataInput_17 + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_32 + DataInput_33 + DataInput_34 + + + DataOutput_11 + DataOutput_12 + + + + DataInput_15 + + Notificar fecha de Emision + _DataInput_16 + + + + DataInput_16 + + + DataInput_17 + + + DataInput_18 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_19 + + + DataInput_20 + + + DataInput_32 + + + maia + DataInput_33 + + + taskMetaData + DataInput_34 + + + DataOutput_11 + maia + + + DataOutput_12 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_11 + SequenceFlow_3 + System.out.println("ingresa a enviar el mail si requiere tarjeta"); +//enviar mail de notificacion +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 4 ,5); + + + + SequenceFlow_3 + _16-_12 + //FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + SequenceFlow_13 + + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",108,1,120,null, "Notificar fecha de Emision Reporte", 6, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Notificar fecha de Emision Reporte",actualTask); + + + SequenceFlow_6 + SequenceFlow_10 + + + + + + + + + + + + + + DataInput_46 + DataInput_47 + DataInput_48 + DataInput_49 + DataInput_50 + DataInput_51 + DataInput_52 + DataInput_53 + DataInput_54 + + + DataOutput_9 + DataOutput_10 + + + + DataInput_46 + + Notificar fecha de Emision Reporte + _DataInput_16 + + + + DataInput_47 + + + DataInput_48 + + + DataInput_49 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_50 + + + DataInput_51 + + + DataInput_52 + + + maia + DataInput_53 + + + taskMetaData + DataInput_54 + + + DataOutput_9 + maia + + + DataOutput_10 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",109, 1,120, "Firmar Tramite Coordinador", 38, "OK_NO"); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar Tramite Coordinador",actualTask); + + + SequenceFlow_5 + SequenceFlow_6 + + + + + + + + + + + + + + DataInput_5 + DataInput_6 + DataInput_7 + DataInput_8 + DataInput_9 + DataInput_10 + DataInput_12 + DataInput_13 + DataInput_14 + + + DataOutput_13 + DataOutput_14 + + + + DataInput_5 + + Firmar Tramite Coordinador + _DataInput_16 + + + + DataInput_6 + + + DataInput_7 + + + DataInput_8 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_9 + + + DataInput_10 + + + DataInput_12 + + + maia + DataInput_13 + + + taskMetaData + DataInput_14 + + + DataOutput_13 + maia + + + DataOutput_14 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_10 + SequenceFlow_7 + System.out.println("ingresa a enviar el mail si requiere reporte"); +//enviar mail de notificacion +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 4 ,60); + + + + SequenceFlow_7 + SequenceFlow_22 + //FlowUtil.endFlow(kcontext); + + + + SequenceFlow_22 + + + + _1-_15 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + _1-_15 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",30, 1,120, "Revisar Tramite", 30, "OK_NO"); +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + System.out.println("............................................................................................ 1:"); +taskMetaData.updateData(maia); +System.out.println("............................................................................................ 2:"); +actualTask=new java.util.ArrayList(); +System.out.println("............................................................................................ 3:"); +kcontext.setVariable("actualTask",actualTask); +System.out.println("............................................................................................ 4:"); +actualTask.add(taskMetaData); +System.out.println("............................................................................................ 5:"); +tasksMetaData.put("Revisar Tramite",actualTask); +System.out.println("............................................................................................ 6:"); + + + SequenceFlow_2 + SequenceFlow_4 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Revisar Tramite + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + SequenceFlow_23 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",33, 1,120, "Autorizar Tramite", 31, "OK_NO"); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Autorizar Tramite",actualTask); + + + SequenceFlow_8 + SequenceFlow_9 + + + + + + + + + DataInput_200 + DataInput_201 + DataInput_202 + DataInput_203 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_200 + + + DataInput_201 + + Autorizar Tramite + DataInput_26 + + + + DataInput_202 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_203 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + SequenceFlow_4 + SequenceFlow_8 + SequenceFlow_14 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_14 + SequenceFlow_23 + System.out.println("............................................................................................ NO:"); +System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones","Tramite Anulado en Revisar Tramite"+datosmail.get("observaciones")); +}else{ +maia.put("observaciones","Tramite Anulado en Revisar Tramite"); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EnvioArmas.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EnvioArmas.bpmn.svn-base new file mode 100644 index 0000000..18f3ce7 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/EnvioArmas.bpmn.svn-base @@ -0,0 +1,354 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",58, 1,120, "Autorizar Acta Entrega", 33, "OK_NO"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarRutaArchivo", maia); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Autorizar Acta Entrega",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Autorizar Acta Entrega + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + _1-_15 + + + + SequenceFlow_1 + SequenceFlow_5 + SequenceFlow_9 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",94, 1,120, "Firmar Acta", 34, "OK_NO"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarRutaArchivo", maia); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar Acta",actualTask); + + + SequenceFlow_5 + SequenceFlow_10 + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + + + + _DataInput_16 + + Firmar Acta + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_9 + SequenceFlow_6 + System.out.println("Entra actualizar ruta"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarRutaArchivo", maia); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + + + SequenceFlow_4 + + + + SequenceFlow_6 + SequenceFlow_7 + System.out.println("Entra a rechazar ruta"); +FlowUtil.executeClass("com.fp.armas.task.RechazarActa", maia); + + + + SequenceFlow_7 + SequenceFlow_4 + FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/PlanificacionInspeccion.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/PlanificacionInspeccion.bpmn.svn-base new file mode 100644 index 0000000..d52e983 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/PlanificacionInspeccion.bpmn.svn-base @@ -0,0 +1,518 @@ + + + + + + + + + + + + + + + + + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",101, 1,120, "Firmar Plan", 50, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar Plan",actualTask); + + + SequenceFlow_6 + SequenceFlow_4 + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + + + + _DataInput_16 + + Firmar Plan + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + _16-_12 + + + + SequenceFlow_10 + SequenceFlow_11 + maia.put("respuesta","Y"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarPlanificacion", maia); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",105, 1,120, "Generar Reporte", 49, "OK_NO"); +//para asignar a un grupo especifico +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Generar Reporte",actualTask); + + + SequenceFlow_11 + SequenceFlow_6 + + + + + + + + + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_21 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_18 + + + DataInput_19 + + Generar Reporte + DataInput_26 + + + + DataInput_20 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_21 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_4 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_1 + SequenceFlow_8 + SequenceFlow_10 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_8 + SequenceFlow_13 + maia.put("respuesta","N"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarPlanificacion", maia); + + + + + taskMetaData=FlowUtil.createTaskInfo("30",106, 1,120, "Modificar Plan Inspeccion", 57, "OK_NO"); +//para asignar a un grupo especifico +maia.put("grupo","SUPERV_INSP_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Modificar Plan Inspeccion",actualTask); + + + SequenceFlow_13 + SequenceFlow_14 + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_1 + + + DataInput_2 + + Modificar Plan Inspeccion + DataInput_26 + + + + DataInput_3 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_4 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + _1-_15 + + + + _1-_15 + SequenceFlow_12 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_12 + SequenceFlow_14 + SequenceFlow_7 + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",104, 1,120, "Aprobar Plan Inspeccion", 48, "OK_NO"); +//para asignar a un grupo especifico +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Aprobar Plan Inspeccion",actualTask); + + + SequenceFlow_7 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Aprobar Plan Inspeccion + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/RecepcionArmas.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/RecepcionArmas.bpmn.svn-base new file mode 100644 index 0000000..2151c71 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/RecepcionArmas.bpmn.svn-base @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_4 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",101, 1,120, "Legalizar Acta", 29, "OK_NO"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarRutaArchivo", maia); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupoDecRecep", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Legalizar Acta",actualTask); + + + SequenceFlow_4 + SequenceFlow_5 + + + + + + + + + + + + + + _DataInput_30 + _DataInput_31 + _DataInput_32 + _DataInput_33 + _DataInput_34 + _DataInput_35 + _DataInput_36 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_30 + + Legalizar Acta + _DataInput_30 + + + + _DataInput_31 + + + _DataInput_32 + + + _DataInput_33 + + #{taskMetaData.groupId} + _DataInput_33 + + + + _DataInput_34 + + + _DataInput_35 + + + _DataInput_36 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_5 + SequenceFlow_1 + System.out.println("ingresa a Actualizar Inventario"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarInventario", maia); // la clase puede hacer lo que necesite +System.out.println("-- Actualizar Inventario"); + + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/RecepcionSolicitudRequisitos.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/RecepcionSolicitudRequisitos.bpmn.svn-base new file mode 100644 index 0000000..d61f725 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/RecepcionSolicitudRequisitos.bpmn.svn-base @@ -0,0 +1,360 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + SequenceFlow_18 + + + + SequenceFlow_25 + SequenceFlow_18 + FlowUtil.endFlow(kcontext); + + + + _1-_15 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_23 + SequenceFlow_10 + System.out.println("***Ingresa a la tarea generar valor a cancelar***"); +FlowUtil.executeClass("com.fp.armas.task.GenerarValorACancelar", maia); +//taskMetaData.getAditionalData().get("datosmail"); +//taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("BPMStatus")!=null)?""+maia.get("BPMStatus"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_19 + SequenceFlow_3 + System.out.println("Ingresa a tarea de enviar el mail de aceptacion de requisitos"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 10 , 11); + + + + + + + SequenceFlow_24 + SequenceFlow_25 + + + + + + + DataInput_40 + DataInput_41 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_40 + + + taskMetaData + DataInput_41 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + + + SequenceFlow_3 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",25, 1,120, "Revisar solicitud y documentos requeridos", 1, "OK_NO"); +//para asignar a un grupo especifico +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +kcontext.setVariable("taskMetaData",taskMetaData); +actualTask.add(taskMetaData); +tasksMetaData.put("Revisar solicitud y documentos requeridos",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Revisar solicitud y documentos requeridos + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_1 + SequenceFlow_7 + SequenceFlow_23 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + SequenceFlow_19 + SequenceFlow_24 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_5 + + + + SequenceFlow_7 + SequenceFlow_4 + //enviar mail al usuario indicando razones del rechazo +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 52 , 53); + + + + SequenceFlow_4 + SequenceFlow_5 + FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/RegistroDecomiso.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/RegistroDecomiso.bpmn.svn-base new file mode 100644 index 0000000..51e1f00 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/RegistroDecomiso.bpmn.svn-base @@ -0,0 +1,320 @@ + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_15 + + + + SequenceFlow_12 + SequenceFlow_16 + SequenceFlow_7 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("C".equals(taskMetaData.getResponse())); + + + SequenceFlow_16 + SequenceFlow_15 + //FlowUtil.endFlow(kcontext); + + + + SequenceFlow_3 + SequenceFlow_4 + //FlowUtil.endFlow(kcontext); + + + SequenceFlow_4 + + + + + SequenceFlow_23 + + + + SequenceFlow_23 + SequenceFlow_5 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_5 + SequenceFlow_6 + FlowUtil.executeClass("com.fp.armas.task.ValidacionDecomiso", maia); +taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("importacion")!=null)?""+maia.get("importacion"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + SequenceFlow_6 + SequenceFlow_2 + SequenceFlow_3 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_2 + SequenceFlow_12 + FlowUtil.executeClass("com.fp.armas.task.ObtieneCentroControl", maia); +taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("corganismo")!=null)?""+maia.get("corganismo"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_11 + + + + SequenceFlow_9 + SequenceFlow_11 + FlowUtil.endFlow(kcontext); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",60, 1,120, "Definir Sancion", 44, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Definir Sancion",actualTask); + + + SequenceFlow_7 + SequenceFlow_9 + + + + + + + + + + + + + + DataInput_43 + DataInput_44 + DataInput_45 + DataInput_46 + DataInput_47 + DataInput_48 + DataInput_49 + DataInput_50 + DataInput_51 + + + DataOutput_7 + DataOutput_10 + + + + DataInput_43 + + Definir Sancion + _DataInput_16 + + + + DataInput_44 + + + DataInput_45 + + + DataInput_46 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_47 + + + DataInput_48 + + + DataInput_49 + + + maia + DataInput_50 + + + taskMetaData + DataInput_51 + + + DataOutput_7 + maia + + + DataOutput_10 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/autorizarDocumentoCarlos.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/autorizarDocumentoCarlos.bpmn.svn-base new file mode 100644 index 0000000..4728c5e --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/autorizarDocumentoCarlos.bpmn.svn-base @@ -0,0 +1,287 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_5 + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_7 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",33,1,120,null, "Autorizar documento habilitante", 7, "OK_NO"); +System.out.println("Ingresa tarea---2-"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + System.out.println("Ingresa a la tarea 3"); +List old=(List)tasksMetaData.get("Autorizar documento habilitante"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Revisar solicitud y documentos requeridos",old); + + + SequenceFlow_8 + SequenceFlow_9 + + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_1 + taskMetaData + + + DataOutput_2 + maia + + + DataOutput_3 + actualTask + + + + SequenceFlow_7 + SequenceFlow_8 + System.out.println("Ingresa por el script"); + + + + SequenceFlow_9 + SequenceFlow_10 + SequenceFlow_11 + + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + SequenceFlow_1 + System.out.println("ingresa a enviar el mail"); +//enviar mail de rechazo +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + return ("A".equals(taskMetaData.getResponse())); + + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + + + System.out.println("fin"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",34, 1,120,null, "Visualizar tramite firma", 7, "OK_NO"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + + List old=(List)tasksMetaData.get("Visualizar tramite firma"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Aprobar tramite",old); + + + SequenceFlow_11 + SequenceFlow_5 + + + + + + + + DataInput_5 + DataInput_6 + + + DataOutput_4 + DataOutput_5 + DataOutput_6 + + + + maia + DataInput_5 + + + taskMetaData + DataInput_6 + + + DataOutput_4 + maia + + + DataOutput_5 + taskMetaData + + + DataOutput_6 + actualTask + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/decomisarArmaCarlos.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/decomisarArmaCarlos.bpmn.svn-base new file mode 100644 index 0000000..df1fcde --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/decomisarArmaCarlos.bpmn.svn-base @@ -0,0 +1,233 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_7 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",28,1,120,null, "Ficha Tecnica de Armas", 14, "OK_NO"); +System.out.println("Ingresa tarea---2-"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + System.out.println("Ingresa a la tarea 3"); +List old=(List)tasksMetaData.get("Ficha Tecnica de Armas"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Revisar solicitud y documentos requeridos",old); + + + SequenceFlow_8 + SequenceFlow_9 + + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_1 + taskMetaData + + + DataOutput_2 + maia + + + DataOutput_3 + actualTask + + + + SequenceFlow_7 + SequenceFlow_8 + System.out.println("Ingresa por el script"); + + + + SequenceFlow_9 + SequenceFlow_10 + SequenceFlow_3 + SequenceFlow_4 + + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + SequenceFlow_1 + System.out.println("ingresa a enviar el mail"); +//enviar mail de rechazo +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 15, 16); + + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + SequenceFlow_3 + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_4 + + + + return ("R".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/decomiso.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/decomiso.bpmn.svn-base new file mode 100644 index 0000000..cc77e11 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/decomiso.bpmn.svn-base @@ -0,0 +1,211 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_4 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + System.out.println("ingresa a LEGALIZAR EL ACTA"); +taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "Legalizar Acta", 1, "OK_NO"); + +//FlowUtil.executeClass("paquete.clase", maia); // la clase puede hacer lo que necesite +//taskMetaData.setUserId((maia.get("userId")!=null)?""+maia.get("userId"):null); +//taskMetaData.setGroupId((maia.get("groupId")!=null)?""+maia.get("groupId"):null); +//para asignar a un grupo especifico +taskMetaData.setGroupId("GERENCIA"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Legalizar Acta",actualTask); + + + SequenceFlow_4 + SequenceFlow_5 + + + + + + + + + + + + + + _DataInput_30 + _DataInput_31 + _DataInput_32 + _DataInput_33 + _DataInput_34 + _DataInput_35 + _DataInput_36 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_30 + + Legalizar Acta + _DataInput_30 + + + + _DataInput_31 + + + _DataInput_32 + + + _DataInput_33 + + #{taskMetaData.groupId} + _DataInput_33 + + + + _DataInput_34 + + + _DataInput_35 + + + _DataInput_36 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_5 + SequenceFlow_1 + System.out.println("ingresa a Actualizar Inventario"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarInventario", maia); // la clase puede hacer lo que necesite +System.out.println("-- Actualizar Inventario"); + + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/notificacionAnulacionTramite.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/notificacionAnulacionTramite.bpmn.svn-base new file mode 100644 index 0000000..4d78c1b --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/notificacionAnulacionTramite.bpmn.svn-base @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_7 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",23,1,120,null, "Notificacion de tramite anulado en la Solicitud de Guia de Libre Transito", 1, "OK_NO"); +System.out.println("Ingresa tarea---2-"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + System.out.println("Ingresa a la tarea 3"); +List old=(List)tasksMetaData.get("Notificacion de tramite anulado en la Solicitud de Guia de Libre Transito"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Revisar solicitud y documentos requeridos",old); + + + SequenceFlow_8 + SequenceFlow_9 + + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_1 + taskMetaData + + + DataOutput_2 + maia + + + DataOutput_3 + actualTask + + + + SequenceFlow_7 + SequenceFlow_8 + System.out.println("Ingresa por el script"); + + + + SequenceFlow_9 + SequenceFlow_10 + SequenceFlow_14 + + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + SequenceFlow_1 + System.out.println("ingresa a enviar el mail"); +//enviar mail de rechazo +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 13 , 12); + + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_14 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/solicitud.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/solicitud.bpmn.svn-base new file mode 100644 index 0000000..ea8f060 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/solicitud.bpmn.svn-base @@ -0,0 +1,280 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",25,1,120,null, "Revisar solicitud y documentos requeridos", 1, "OK_NO"); +System.out.println("Ingresa tarea---2-"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + System.out.println("Ingresa a la tarea 3"); +List old=(List)tasksMetaData.get("Revisar solicitud y documentos requeridos"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Revisar solicitud y documentos requeridos",old); + + + + + + + + + + CallActivity_2_maiaInput + CallActivity_2_taskMetaDataInput + + + CallActivity_2_actualTaskOutput + CallActivity_2_maiaOutput + CallActivity_2_taskMetaDataOutput + + + + maia + CallActivity_2_maiaInput + + + taskMetaData + CallActivity_2_taskMetaDataInput + + + CallActivity_2_actualTaskOutput + actualTask + + + CallActivity_2_maiaOutput + maia + + + CallActivity_2_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + System.out.println("fin"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",22, 1,120,null, "Aprobar tramite", 1, "OK_NO"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + List old=(List)tasksMetaData.get("Aprobar tramite"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Aprobar tramite",old); + + + + + + + + + + CallActivity_3_maiaInput + CallActivity_3_taskMetaDataInput + + + CallActivity_3_actualTaskOutput + CallActivity_3_maiaOutput + CallActivity_3_taskMetaDataOutput + + + + maia + CallActivity_3_maiaInput + + + taskMetaData + CallActivity_3_taskMetaDataInput + + + CallActivity_3_actualTaskOutput + actualTask + + + CallActivity_3_maiaOutput + maia + + + CallActivity_3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + return ("D".equals(taskMetaData.getResponse())); + + + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/solicitudCarlos.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/solicitudCarlos.bpmn.svn-base new file mode 100644 index 0000000..ca0b574 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/solicitudCarlos.bpmn.svn-base @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_7 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_7 + SequenceFlow_8 + System.out.println("Ingresa por el script"); + + + + SequenceFlow_4 + SequenceFlow_1 + System.out.println("ingresa a enviar el mail"); +//enviar mail de notificacion +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 4 ,5); + + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",35,1,120,null, "Notificar fecha de Emision", 6, "OK_NO"); +System.out.println("Ingresa tarea---2-"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + System.out.println("Ingresa a la tarea 3"); +List old=(List)tasksMetaData.get("Notificar fecha de Emision"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Notificar fecha de Emision",old); + + + SequenceFlow_8 + SequenceFlow_4 + + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_1 + taskMetaData + + + DataOutput_2 + maia + + + DataOutput_3 + actualTask + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/solicitudFlow.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/solicitudFlow.bpmn.svn-base new file mode 100644 index 0000000..7ef9d5e --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/solicitudFlow.bpmn.svn-base @@ -0,0 +1,525 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_4 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",25,1,120,null, "Revisar solicitud y documentos requeridos", 10, "OK_NO"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + System.out.println("Ingresa a la tarea 3"); +List old=(List)tasksMetaData.get("Revisar solicitud y documentos requeridos"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Revisar requisitos",old); + + + SequenceFlow_4 + SequenceFlow_9 + + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_1 + taskMetaData + + + DataOutput_2 + maia + + + DataOutput_3 + actualTask + + + + SequenceFlow_9 + SequenceFlow_10 + SequenceFlow_11 + + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + SequenceFlow_1 + System.out.println("ingresa a enviar el mail"); +//enviar mail al jefe del empleado +FlowUtil.mail("com.fp.armas.mail.SolicitanteDireccion", maia, taskMetaData, 27 , 26); + + + + + SequenceFlow_11 + SequenceFlow_3 + SequenceFlow_8 + + + return ("1".equals("1")); + + + SequenceFlow_3 + SequenceFlow_7 + System.out.println("ingresa a enviar el mail de aceptacion de requisitos"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.SolicitanteDireccion", maia, taskMetaData, 10 , 11); + + + + SequenceFlow_8 + SequenceFlow_21 + System.out.println("El valor del depósito es cero"); +FlowUtil.endFlow(kcontext); + + + return ("2".equals("1")); + + + + + System.out.println("fin"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",22, 1,120,null, "Aprobar tramite", 1, "OK_NO"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + + List old=(List)tasksMetaData.get("Aprobar tramite"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Aprobar tramite",old); + + + SequenceFlow_7 + SequenceFlow_15 + + + + + + + + DataInput_5 + DataInput_6 + + + DataOutput_4 + DataOutput_5 + DataOutput_6 + + + + maia + DataInput_5 + + + taskMetaData + DataInput_6 + + + DataOutput_4 + maia + + + DataOutput_5 + taskMetaData + + + DataOutput_6 + actualTask + + + + + + + System.out.println("fin"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",22, 1,120,null, "Aprobar tramite", 1, "OK_NO"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + + List old=(List)tasksMetaData.get("Aprobar tramite"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Aprobar tramite",old); + + + SequenceFlow_15 + SequenceFlow_16 + + + + + + + + DataInput_1 + DataInput_2 + + + DataOutput_7 + DataOutput_8 + DataOutput_9 + + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_7 + maia + + + DataOutput_8 + taskMetaData + + + DataOutput_9 + actualTask + + + + + SequenceFlow_17 + + + + System.out.println("El valor a cancelar generado es: "); + SequenceFlow_18 + SequenceFlow_17 + System.out.println("ingresa a enviar el mail de aceptacion de requisitos"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.SolicitanteDireccion", maia, taskMetaData, 10 , 11); + + + + SequenceFlow_16 + SequenceFlow_18 + SequenceFlow_19 + + + return ("1".equals("1")); + + + SequenceFlow_1 + SequenceFlow_2 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + return ("2".equals("1")); + + + + + System.out.println("fin"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",22, 1,120,null, "Aprobar tramite", 1, "OK_NO"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + + List old=(List)tasksMetaData.get("Aprobar tramite"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Aprobar tramite",old); + + + SequenceFlow_19 + SequenceFlow_21 + SequenceFlow_20 + + + + + + + + DataInput_7 + DataInput_8 + + + DataOutput_10 + DataOutput_11 + DataOutput_12 + + + + maia + DataInput_7 + + + taskMetaData + DataInput_8 + + + DataOutput_10 + maia + + + DataOutput_11 + taskMetaData + + + DataOutput_12 + actualTask + + + + + SequenceFlow_20 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/subproceso.bpmn.netbeans-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/subproceso.bpmn.netbeans-base new file mode 100644 index 0000000..54da02e --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/subproceso.bpmn.netbeans-base @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + _1-_15 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "Validar Reimpresion", 32, "OK_NO"); + +//FlowUtil.executeClass("paquete.clase", maia); // la clase puede hacer lo que necesite +//taskMetaData.setUserId((maia.get("userId")!=null)?""+maia.get("userId"):null); +//taskMetaData.setGroupId((maia.get("groupId")!=null)?""+maia.get("groupId"):null); +//para asignar a un grupo especifico +taskMetaData.setGroupId("GERENCIA"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar Reimpresion",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Validar Reimpresion + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + _16-_12 + + + + SequenceFlow_6 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_3 + SequenceFlow_6 + System.out.println("Ingresa por el script fin................................................"); +System.out.println("Ingresa por el script fin................................................"); +System.out.println("Ingresa por el script fin................................................"); +System.out.println("Ingresa por el script fin................................................"); +System.out.println("Ingresa por el script fin................................................"); +System.out.println("Ingresa por el script fin................................................"); + + + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Emision Documento Habilitante",actualTask); + + + SequenceFlow_1 + SequenceFlow_3 + + + + + + + DataInput_79 + DataInput_80 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_79 + + + taskMetaData + DataInput_80 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/subproceso.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/subproceso.bpmn.svn-base new file mode 100644 index 0000000..54da02e --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/.svn/text-base/subproceso.bpmn.svn-base @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + _1-_15 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "Validar Reimpresion", 32, "OK_NO"); + +//FlowUtil.executeClass("paquete.clase", maia); // la clase puede hacer lo que necesite +//taskMetaData.setUserId((maia.get("userId")!=null)?""+maia.get("userId"):null); +//taskMetaData.setGroupId((maia.get("groupId")!=null)?""+maia.get("groupId"):null); +//para asignar a un grupo especifico +taskMetaData.setGroupId("GERENCIA"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar Reimpresion",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Validar Reimpresion + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + _16-_12 + + + + SequenceFlow_6 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_3 + SequenceFlow_6 + System.out.println("Ingresa por el script fin................................................"); +System.out.println("Ingresa por el script fin................................................"); +System.out.println("Ingresa por el script fin................................................"); +System.out.println("Ingresa por el script fin................................................"); +System.out.println("Ingresa por el script fin................................................"); +System.out.println("Ingresa por el script fin................................................"); + + + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Emision Documento Habilitante",actualTask); + + + SequenceFlow_1 + SequenceFlow_3 + + + + + + + DataInput_79 + DataInput_80 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_79 + + + taskMetaData + DataInput_80 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/BajaDestruccion.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/BajaDestruccion.bpmn new file mode 100644 index 0000000..f74206d --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/BajaDestruccion.bpmn @@ -0,0 +1,576 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + System.out.println("****Ingresa a preparar el flujo******"); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",55, 1,120, "Revisar reporte armas a destruccion", 20, "OK_NO"); + +//para asignar a un grupo especifico +maia.put("grupo","SUPERV_DECO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Revisar reporte armas a destruccion",actualTask); + + + SequenceFlow_2 + SequenceFlow_4 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Revisar reporte armas a destruccion + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",56, 1,120, "Aprobar reporte de armas a destruccion Jefe Dpto", 21, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setGroupId("JEFE_DEPARTAMENTO_ARMAS_"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Aprobar reporte de armas a destruccion Jefe Dpto",actualTask); + + + SequenceFlow_4 + SequenceFlow_6 + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + + + + _DataInput_16 + + Aprobar reporte de armas a destruccion Jefe Dpto + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_8 + + + + SequenceFlow_9 + SequenceFlow_11 + SequenceFlow_12 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + + + taskMetaData=FlowUtil.createTaskInfo("30",101, 1,120, "Firmar reporte", 23, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setGroupId("JEFE_COMANDO_CONJUNTO_"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar reporte",actualTask); + + + SequenceFlow_12 + SequenceFlow_13 + + + + + + + + + + + + + + DataInput_17 + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_21 + DataInput_22 + DataInput_23 + DataInput_24 + DataInput_25 + + + DataOutput_3 + DataOutput_5 + + + + DataInput_17 + + Firmar reporte + _DataInput_16 + + + + DataInput_18 + + + DataInput_19 + + + DataInput_20 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_21 + + + DataInput_22 + + + DataInput_23 + + + maia + DataInput_24 + + + taskMetaData + DataInput_25 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + SequenceFlow_11 + + + + + SequenceFlow_1 + + + + SequenceFlow_14 + SequenceFlow_1 + FlowUtil.endFlow(kcontext); + + + SequenceFlow_13 + SequenceFlow_14 + System.out.println("Pendiente ejecutar clase que actualiza el inventario"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarInventBajaDestrucc", maia); + + + + + + _1-_15 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",57, 1,120, "Aprobar reporte de armas a destruccion Jefe CC", 22, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setGroupId("JEFE_COMANDO_CONJUNTO_"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Aprobar reporte de armas a destruccion Jefe CC",actualTask); + + + SequenceFlow_7 + SequenceFlow_9 + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + DataInput_6 + DataInput_7 + DataInput_8 + DataInput_9 + DataInput_10 + + + DataOutput_1 + DataOutput_2 + + + + DataInput_1 + + Aprobar reporte de armas a destruccion Jefe CC + _DataInput_16 + + + + DataInput_2 + + + DataInput_3 + + + DataInput_4 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_6 + + + DataInput_7 + + + DataInput_8 + + + maia + DataInput_9 + + + taskMetaData + DataInput_10 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_6 + SequenceFlow_7 + SequenceFlow_8 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/CargaDeposito.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/CargaDeposito.bpmn new file mode 100644 index 0000000..8686daf --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/CargaDeposito.bpmn @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_11 + + + + SequenceFlow_10 + SequenceFlow_11 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_9 + SequenceFlow_10 + System.out.println("Ingresa a tarea de enviar el mail de Notificar inconsistencia deposito"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 17 , 18); + + + + _1-_15 + SequenceFlow_1 + System.out.println("Ingresa al flujo de carga deposito"); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",42, 1,120, "Validar transaccion de deposito", 24, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidaFlujoCargaDeposito", maia); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar transaccion de deposito",actualTask); + + + SequenceFlow_1 + SequenceFlow_6 + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + + + + _DataInput_16 + + Validar transaccion de deposito + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + _1-_15 + + + + + + //taskMetaData=FlowUtil.createTaskInfoByClassName("30",24, 1,30,"com.fp.viaticos.task.AsignarEmpleado", "Modificar empleado", 11, "OK_NO"); +//kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_2 + SequenceFlow_15 + + + + + + + DataInput_18 + DataInput_19 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_18 + + + taskMetaData + DataInput_19 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + + _16-_12 + + + + SequenceFlow_15 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_6 + SequenceFlow_9 + SequenceFlow_2 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionApertura.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionApertura.bpmn new file mode 100644 index 0000000..bafc009 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionApertura.bpmn @@ -0,0 +1,311 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar Info Agencias", 1, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar Info Agencias",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + + + + + + _DataInput_191 + _DataInput_192 + _DataInput_193 + _DataInput_194 + _DataInput_195 + _DataInput_196 + _DataInput_197 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_191 + + Validar Info Agencias + _DataInput_191 + + + + _DataInput_192 + + + _DataInput_193 + + + _DataInput_194 + + #{taskMetaData.groupId} + _DataInput_194 + + + + _DataInput_195 + + + _DataInput_196 + + + _DataInput_197 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + SequenceFlow_5 + SequenceFlow_6 + //FlowUtil.endFlow(kcontext); + + + SequenceFlow_6 + + + + + SequenceFlow_8 + SequenceFlow_9 + //FlowUtil.endFlow(kcontext); + + + SequenceFlow_9 + + + + + + + + + + + SequenceFlow_7 + SequenceFlow_8 + + + + + + + DataInput_5 + DataInput_6 + + + DataOutput_5 + DataOutput_6 + + + + maia + DataInput_5 + + + taskMetaData + DataInput_6 + + + DataOutput_5 + maia + + + DataOutput_6 + taskMetaData + + + + + SequenceFlow_4 + SequenceFlow_5 + System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + SequenceFlow_3 + SequenceFlow_4 + SequenceFlow_7 + + + System.out.println("Camino D"); +return ("D".equals(taskMetaData.getResponse())); + + + System.out.println("Camino A"); +return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionAutorizacion.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionAutorizacion.bpmn new file mode 100644 index 0000000..b9809f4 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionAutorizacion.bpmn @@ -0,0 +1,631 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + _1-_15 + SequenceFlow_1 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar tipo de Autorizacion", 1, "OK_NO"); +maia.put("grupo","SUPERV_INSP_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar tipo de Autorizacion",actualTask); + + + SequenceFlow_1 + SequenceFlow_12 + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + DataInput_5 + DataInput_6 + DataInput_12 + DataInput_7 + DataInput_8 + + + DataOutput_6 + DataOutput_7 + + + + DataInput_1 + + Validar tipo de Autorizacion + _DataInput_149 + + + + DataInput_2 + + + DataInput_3 + + + DataInput_4 + + #{taskMetaData.groupId} + _DataInput_152 + + + + DataInput_5 + + + DataInput_6 + + + DataInput_12 + + + maia + DataInput_7 + + + taskMetaData + DataInput_8 + + + DataOutput_6 + maia + + + DataOutput_7 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_16 + + + + SequenceFlow_12 + SequenceFlow_15 + SequenceFlow_7 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + Requiere Inspeccion + SequenceFlow_7 + SequenceFlow_13 + System.out.println("............................................................................................Autorizacion Previa de Importacion"); +FlowUtil.executeClass("com.fp.armas.task.ValAutorizacionPreviaImporta", maia); +if(taskMetaData ==null){ + taskMetaData = new com.fp.simple.dto.TaskInfo(); +} +taskMetaData.setResponse((maia.get("previaimportacion")!=null)?""+maia.get("previaimportacion"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_13 + SequenceFlow_19 + SequenceFlow_20 + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar tipo de Autorizacion VUE", 1, "OK_NO"); +taskMetaData.setGroupId("ANALISTA_VUE"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar tipo de Autorizacion VUE",actualTask); + + + SequenceFlow_19 + SequenceFlow_21 + + + + + + + + + + + + + + DataInput_14 + DataInput_15 + DataInput_16 + DataInput_17 + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_21 + DataInput_22 + + + DataOutput_1 + DataOutput_2 + + + + DataInput_14 + + Validar tipo de Autorizacion VUE + _DataInput_149 + + + + DataInput_15 + + + DataInput_16 + + + DataInput_17 + + #{taskMetaData.groupId} + _DataInput_152 + + + + DataInput_18 + + + DataInput_19 + + + DataInput_20 + + + maia + DataInput_21 + + + taskMetaData + DataInput_22 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_17 + SequenceFlow_2 + SequenceFlow_3 + + + return ("N".equals(taskMetaData.getResponse())); + + + return ("Y".equals(taskMetaData.getResponse())); + + + SequenceFlow_8 + _16-_12 + + + + Requiere Inspeccion + SequenceFlow_22 + SequenceFlow_17 + System.out.println(".............................................................................................Requiere Inspeccion :"); +FlowUtil.executeClass("com.fp.armas.task.RequiereInspeccion", maia); +if(taskMetaData ==null){ + taskMetaData = new com.fp.simple.dto.TaskInfo(); +} +taskMetaData.setResponse((maia.get("inspeccion")!=null)?""+maia.get("inspeccion"):null); +System.out.println(".............................................................................................Requiere Inspeccion :"+taskMetaData.getResponse()); +kcontext.setVariable("taskMetaData",taskMetaData); +System.out.println(".............................................................................................Requiere Inspeccion :"+taskMetaData.getResponse()); + + + + SequenceFlow_2 + SequenceFlow_9 + SequenceFlow_5 + + + + _16-_12 + + + + + + System.out.println("............................................................................................ Inspeccion :"); + + + System.out.println("............................................................................................ Inspeccion OK"); +FlowUtil.executeClass("com.fp.armas.task.ValidaInspeccion", maia); +if(taskMetaData ==null){ + taskMetaData = new com.fp.simple.dto.TaskInfo(); +} +taskMetaData.setResponse((maia.get("tramiteproceso")!=null)?""+maia.get("tramiteproceso"):null); +kcontext.setVariable("taskMetaData",taskMetaData); +System.out.println("..........................................................................................regreso... :"+taskMetaData.getResponse()); + + + SequenceFlow_3 + SequenceFlow_4 + + + + + + + DataInput_11 + DataInput_13 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + taskMetaData + DataInput_13 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + + SequenceFlow_11 + + + + + + + SequenceFlow_5 + SequenceFlow_8 + + + + + + + DataInput_9 + DataInput_10 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_9 + + + taskMetaData + DataInput_10 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + + SequenceFlow_10 + SequenceFlow_11 + + + + return ("D".equals(taskMetaData.getResponse())); + + + + SequenceFlow_20 + SequenceFlow_21 + SequenceFlow_22 + + + + SequenceFlow_4 + SequenceFlow_9 + SequenceFlow_10 + + + return ("Y".equals(taskMetaData.getResponse())); + + + return ("N".equals(taskMetaData.getResponse())); + + + SequenceFlow_15 + SequenceFlow_16 + System.out.println("............................................................................................ RECHAZA VALIDAR TIPO SOLICITUD:"); +System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones","Tramite Anulado en Validar Tipo De Autorizacion"+datosmail.get("observaciones")); +}else{ +maia.put("observaciones","Tramite Anulado en Validar Tipo De Autorizacion"); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionDevolucion.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionDevolucion.bpmn new file mode 100644 index 0000000..37c9cb5 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionDevolucion.bpmn @@ -0,0 +1,411 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_10 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + _1-_15 + + + + SequenceFlow_11 + SequenceFlow_5 + SequenceFlow_7 + + + + + taskMetaData=FlowUtil.createTaskInfo("30",32, 1,120, "Autorizar Devolucion",37, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +System.out.println("1..................."); +actualTask=new java.util.ArrayList(); +System.out.println("2..................."); +kcontext.setVariable("actualTask",actualTask); +System.out.println("3..................."); +actualTask.add(taskMetaData); +System.out.println("4..................."); +System.out.println("5..................."); +tasksMetaData.put("Autorizar Devolucion",actualTask); +System.out.println("6..................."); + + + SequenceFlow_5 + SequenceFlow_1 + + + + + + + + + + + + + + DataInput_13 + DataInput_14 + DataInput_15 + DataInput_16 + DataInput_17 + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_21 + + + DataOutput_1 + DataOutput_2 + + + + DataInput_13 + + Autorizar Devolucion + _DataInput_16 + + + + DataInput_14 + + + DataInput_15 + + + DataInput_16 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_17 + + + DataInput_18 + + + DataInput_19 + + + maia + DataInput_20 + + + taskMetaData + DataInput_21 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_7 + _16-_12 + System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + _16-_12 + + + + return ("D".equals(taskMetaData.getResponse())); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",29, 1,120, "Informacion Devolucion", 36, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","TEC_ALM_CENTRO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Informacion Devolucion",actualTask); + + + + SequenceFlow_10 + SequenceFlow_11 + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + DataInput_5 + DataInput_6 + DataInput_7 + DataInput_8 + DataInput_9 + + + DataOutput_3 + DataOutput_5 + + + + DataInput_1 + + Informacion Devolucion + _DataInput_16 + + + + DataInput_2 + + + DataInput_3 + + + DataInput_4 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_5 + + + DataInput_6 + + + DataInput_7 + + + maia + DataInput_8 + + + taskMetaData + DataInput_9 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_2 + SequenceFlow_6 + System.out.println("fin"); +//FlowUtil.endFlow(kcontext); +System.out.println("fin1"); + + + + SequenceFlow_6 + + + + + + + SequenceFlow_1 + SequenceFlow_2 + + + + + + + DataInput_10 + DataInput_11 + + + DataOutput_4 + DataOutput_6 + + + + maia + DataInput_10 + + + taskMetaData + DataInput_11 + + + DataOutput_4 + maia + + + DataOutput_6 + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionEmisionGuiaTransito.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionEmisionGuiaTransito.bpmn new file mode 100644 index 0000000..7282524 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionEmisionGuiaTransito.bpmn @@ -0,0 +1,422 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + _1-_15 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_1 + SequenceFlow_5 + SequenceFlow_13 + + + return ("D".equals(taskMetaData.getResponse())); + + + + + taskMetaData=FlowUtil.createTaskInfo("30",23, 1,120, "Validacion Inconsistencias Informacion Solicitud", 56, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validacion Inconsistencias Informacion Solicitud",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Validacion Inconsistencias Informacion Solicitud + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_5 + SequenceFlow_6 + System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,61); + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_13 + SequenceFlow_16 + System.out.println(" Verifica cantidad armamento "); +FlowUtil.executeClass("com.fp.armas.task.VerificarCantidadArmas", maia); +taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("requierecustodia")!=null)?""+maia.get("requierecustodia"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + SequenceFlow_16 + SequenceFlow_20 + SequenceFlow_24 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_20 + SequenceFlow_15 + SequenceFlow_22 + + + + + + System.out.println(" Genera Orden trabajo "); +taskMetaData=FlowUtil.createTaskInfo("30",27, 1,120, "Generar Orden Trabajo", 55, "OK_NO"); +maia.put("grupo","SUPERV_INSP_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Generar Orden Trabajo",actualTask); + + + SequenceFlow_24 + SequenceFlow_15 + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + + + DataOutput_11 + DataOutput_12 + + + + maia + DataInput_1 + + + DataInput_2 + + Generar Orden Trabajo + DataInput_26 + + + + DataInput_3 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_4 + + + DataOutput_11 + maia + + + DataOutput_12 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + System.out.println(" Documento Habilitante "); + + + + + + SequenceFlow_22 + SequenceFlow_23 + + + + + + + + DataInput_90 + DataInput_91 + + + DataOutput_19 + DataOutput_20 + DataOutput_21 + + + + maia + DataInput_90 + + + taskMetaData + DataInput_91 + + + DataOutput_19 + taskMetaData + + + DataOutput_20 + maia + + + DataOutput_21 + actualTask + + + + + SequenceFlow_23 + _16-_12 + //FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + SequenceFlow_6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionImpresion.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionImpresion.bpmn new file mode 100644 index 0000000..bf0a471 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionImpresion.bpmn @@ -0,0 +1,285 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + _1-_15 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",50, 1,120, "Validar Reimpresion", 32, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData=new java.util.HashMap(); +tasksMetaData.put("Validar Reimpresion",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Validar Reimpresion + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + _16-_12 + + + + + + System.out.println("Imprime documento"); +taskMetaData=FlowUtil.createTaskInfo("30",59, 1,120, "Imprimir Documento", 51, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +//tasksMetaData =new java.util.HashMap(); +tasksMetaData.put("Imprimir Documento",actualTask); + + + SequenceFlow_7 + SequenceFlow_5 + + + + + + + + + DataInput_22 + DataInput_23 + DataInput_24 + DataInput_25 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_22 + + + DataInput_23 + + Imprimir Documento + DataInput_26 + + + + DataInput_24 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_25 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_8 + + + + SequenceFlow_5 + _16-_12 + //FlowUtil.endFlow(kcontext); + + + + SequenceFlow_1 + SequenceFlow_7 + SequenceFlow_8 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionIncrementoArmas.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionIncrementoArmas.bpmn new file mode 100644 index 0000000..035545b --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionIncrementoArmas.bpmn @@ -0,0 +1,306 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("actualTask",actualTask); +kcontext.setVariable("tasksMetaData",tasksMetaData); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar la Informacion Armas", 59, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar la Informacion Armas",actualTask); + + + SequenceFlow_2 + SequenceFlow_6 + + + + + + + + + + + + + + _DataInput_184 + _DataInput_185 + _DataInput_186 + _DataInput_187 + _DataInput_188 + _DataInput_189 + _DataInput_190 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_184 + + Validar la Informacion Armas + _DataInput_184 + + + + _DataInput_185 + + + _DataInput_186 + + + _DataInput_187 + + #{taskMetaData.groupId} + _DataInput_187 + + + + _DataInput_188 + + + _DataInput_189 + + + _DataInput_190 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_10 + SequenceFlow_11 + System.out.println(" Anula Incremento de Armas: "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + SequenceFlow_11 + SequenceFlow_12 + + + + SequenceFlow_6 + SequenceFlow_7 + SequenceFlow_10 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_8 + SequenceFlow_9 + \ + + + + + + + + + + SequenceFlow_7 + SequenceFlow_8 + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_4 + DataOutput_5 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_4 + maia + + + DataOutput_5 + taskMetaData + + + + + + SequenceFlow_9 + + + + SequenceFlow_12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionInspeccion.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionInspeccion.bpmn new file mode 100644 index 0000000..17b6a78 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionInspeccion.bpmn @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + System.out.println(".............................................................................................Inspeccion..:"); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",31, 1,120, "Registrar Inspeccion", 54, "OK_NO"); +maia.put("grupo","INSP_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Registrar Inspeccion",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Registrar Inspeccion + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + _1-_15 + + + + + SequenceFlow_1 + SequenceFlow_5 + SequenceFlow_6 + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_5 + _16-_12 + System.out.println("............................................................................................SI........................ :"+taskMetaData.getResponse()); + + + + + _16-_12 + + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_7 + + + + FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + SequenceFlow_6 + SequenceFlow_7 + System.out.println("............................................................................................ NO:"); +System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones","Tramite Anulado en Registrar Inspeccion"+datosmail.get("observaciones")); +}else{ +maia.put("observaciones","Tramite Anulado en Registrar Inspeccion"); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); +System.out.println("..........................................................................................no... :"+taskMetaData.getResponse()); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionInternacion.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionInternacion.bpmn new file mode 100644 index 0000000..9b46d24 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionInternacion.bpmn @@ -0,0 +1,320 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("actualTask",actualTask); +kcontext.setVariable("tasksMetaData",tasksMetaData); + + + + SequenceFlow_11 + SequenceFlow_12 + + + SequenceFlow_12 + + + + + SequenceFlow_4 + SequenceFlow_7 + SequenceFlow_10 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + + + + + + + SequenceFlow_7 + SequenceFlow_8 + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_4 + DataOutput_5 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_4 + maia + + + DataOutput_5 + taskMetaData + + + + + SequenceFlow_8 + SequenceFlow_9 + + + + SequenceFlow_10 + SequenceFlow_11 + System.out.println("***SE ANULO EL TRAMITE***"); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar Info Armas", 1, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar Info Armas",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + + + + + + _DataInput_184 + _DataInput_185 + _DataInput_186 + _DataInput_187 + _DataInput_188 + _DataInput_189 + _DataInput_190 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_184 + + Validar Info Armas + _DataInput_184 + + + + _DataInput_185 + + + _DataInput_186 + + + _DataInput_187 + + #{taskMetaData.groupId} + _DataInput_187 + + + + _DataInput_188 + + + _DataInput_189 + + + _DataInput_190 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_3 + SequenceFlow_4 + System.out.println("***SE ANULO EL TRAMITE***"); + + + + + SequenceFlow_9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionPermiso.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionPermiso.bpmn new file mode 100644 index 0000000..551ca9e --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionPermiso.bpmn @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_1 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData =new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",24, 1,120, "Receptar Armas", 45, "OK_NO"); +maia.put("grupo","TEC_ALM_CENTRO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Receptar Armas",actualTask); + + + SequenceFlow_1 + SequenceFlow_16 + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_1 + + + DataInput_2 + + Receptar Armas + DataInput_26 + + + + DataInput_3 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_4 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + _1-_15 + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",28, 1,120, "Ingresa Ficha Tecnica Arma", 46, "OK_NO"); +maia.put("grupo","ANALISTA_TIRO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ingresa Ficha Tecnica Arma",actualTask); + + + SequenceFlow_16 + SequenceFlow_17 + + + + + + + + + DataInput_6 + DataInput_7 + DataInput_8 + DataInput_9 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_6 + + + DataInput_7 + + Ingresa Ficha Tecnica Arma + DataInput_26 + + + + DataInput_8 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_9 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + SequenceFlow_12 + SequenceFlow_13 + //FlowUtil.endFlow(kcontext); + + + + + + + + + SequenceFlow_17 + SequenceFlow_12 + + + + + + + + DataInput_39 + DataInput_40 + + + DataOutput_14 + DataOutput_15 + DataOutput_16 + + + + maia + DataInput_39 + + + taskMetaData + DataInput_40 + + + DataOutput_14 + actualTask + + + DataOutput_15 + maia + + + DataOutput_16 + taskMetaData + + + + + SequenceFlow_13 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionTramite.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionTramite.bpmn new file mode 100644 index 0000000..074ddda --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecucionTramite.bpmn @@ -0,0 +1,721 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_4 + System.out.println("***Ingresa a la tarea prepara flujo***"); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + _1-_15 + + + + + SequenceFlow_4 + SequenceFlow_5 + System.out.println("***Ingresa a la tarea evaluar tipo de documento***"); +FlowUtil.executeClass("com.fp.armas.task.TipoDocumento", maia); +// taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("tipodocumento")!=null)?""+maia.get("tipodocumento"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_5 + SequenceFlow_11 + SequenceFlow_13 + SequenceFlow_15 + SequenceFlow_17 + SequenceFlow_19 + SequenceFlow_21 + SequenceFlow_24 + SequenceFlow_26 + SequenceFlow_27 + SequenceFlow_29 + + + + + + + SequenceFlow_30 + SequenceFlow_9 + + + + + + + DataInput_15 + DataInput_16 + + + DataOutput_6 + DataOutput_7 + + + + maia + DataInput_15 + + + taskMetaData + DataInput_16 + + + DataOutput_6 + maia + + + DataOutput_7 + taskMetaData + + + + + return ("EA".equals(taskMetaData.getResponse())); + + + return ("EI".equals(taskMetaData.getResponse())); + + + return ("ET".equals(taskMetaData.getResponse())); + + + return ("EG".equals(taskMetaData.getResponse())); + + + SequenceFlow_9 + SequenceFlow_12 + SequenceFlow_14 + SequenceFlow_16 + SequenceFlow_18 + SequenceFlow_20 + SequenceFlow_22 + SequenceFlow_23 + SequenceFlow_25 + SequenceFlow_28 + SequenceFlow_10 + + + + SequenceFlow_10 + _16-_12 + //FlowUtil.endFlow(kcontext); + + + + return ("EC".equals(taskMetaData.getResponse())); + + + + + + + SequenceFlow_13 + SequenceFlow_14 + + + + + + + DataInput_19 + DataInput_20 + + + DataOutput_11 + DataOutput_12 + + + + maia + DataInput_19 + + + taskMetaData + DataInput_20 + + + DataOutput_11 + maia + + + DataOutput_12 + taskMetaData + + + + + + + + + SequenceFlow_11 + SequenceFlow_12 + + + + + + + DataInput_17 + DataInput_18 + + + DataOutput_9 + DataOutput_10 + + + + maia + DataInput_17 + + + taskMetaData + DataInput_18 + + + DataOutput_9 + maia + + + DataOutput_10 + taskMetaData + + + + + return ("ER".equals(taskMetaData.getResponse())); + + + return ("ED".equals(taskMetaData.getResponse())); + + + return ("ES".equals(taskMetaData.getResponse())); + + + return ("EN".equals(taskMetaData.getResponse())); + + + + + + + SequenceFlow_19 + SequenceFlow_20 + + + + + + + DataInput_25 + DataInput_27 + + + DataOutput_17 + DataOutput_18 + + + + maia + DataInput_25 + + + taskMetaData + DataInput_27 + + + DataOutput_17 + maia + + + DataOutput_18 + taskMetaData + + + + + + + + + SequenceFlow_26 + SequenceFlow_25 + + + + + + + DataInput_33 + DataInput_34 + + + DataOutput_23 + DataOutput_24 + + + + maia + DataInput_33 + + + taskMetaData + DataInput_34 + + + DataOutput_23 + maia + + + DataOutput_24 + taskMetaData + + + + + + + + + SequenceFlow_21 + SequenceFlow_22 + + + + + + + DataInput_28 + DataInput_30 + + + DataOutput_19 + DataOutput_20 + + + + maia + DataInput_28 + + + taskMetaData + DataInput_30 + + + DataOutput_19 + maia + + + DataOutput_20 + taskMetaData + + + + + + + + + SequenceFlow_15 + SequenceFlow_16 + + + + + + + DataInput_21 + DataInput_22 + + + DataOutput_13 + DataOutput_14 + + + + maia + DataInput_21 + + + taskMetaData + DataInput_22 + + + DataOutput_13 + maia + + + DataOutput_14 + taskMetaData + + + + + + + + + SequenceFlow_27 + SequenceFlow_28 + + + + + + + DataInput_35 + DataInput_36 + + + DataOutput_25 + DataOutput_26 + + + + maia + DataInput_35 + + + taskMetaData + DataInput_36 + + + DataOutput_25 + maia + + + DataOutput_26 + taskMetaData + + + + + + + + + SequenceFlow_24 + SequenceFlow_23 + + + + + + + DataInput_31 + DataInput_32 + + + DataOutput_21 + DataOutput_22 + + + + maia + DataInput_31 + + + taskMetaData + DataInput_32 + + + DataOutput_21 + maia + + + DataOutput_22 + taskMetaData + + + + + + + + + SequenceFlow_17 + SequenceFlow_18 + + + + + + + DataInput_23 + DataInput_24 + + + DataOutput_15 + DataOutput_16 + + + + maia + DataInput_23 + + + taskMetaData + DataInput_24 + + + DataOutput_15 + maia + + + DataOutput_16 + taskMetaData + + + + + SequenceFlow_29 + SequenceFlow_30 + System.out.println("***Ingresa a la tarea NOTIFICAR FECHA DE ENTRGA DE ARMAS***"); +//enviar mail de notificacion +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 39,40); + + + return ("EP".equals(taskMetaData.getResponse())); + + + + _16-_12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecutarCertificados.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecutarCertificados.bpmn new file mode 100644 index 0000000..80c8276 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecutarCertificados.bpmn @@ -0,0 +1,276 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + SequenceFlow_12 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + SequenceFlow_10 + + + + SequenceFlow_9 + SequenceFlow_10 + System.out.println("TramiteAnulado"); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ejecutar Certificados",actualTask); + + + SequenceFlow_8 + SequenceFlow_5 + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_3 + DataOutput_4 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_3 + maia + + + DataOutput_4 + taskMetaData + + + + + SequenceFlow_13 + SequenceFlow_8 + SequenceFlow_9 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_5 + SequenceFlow_6 + + + + SequenceFlow_1 + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Valida Informacion Certificado", 58, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Valida Informacion Certificado",actualTask); + + + SequenceFlow_12 + SequenceFlow_13 + + + + + + + + + DataInput_5 + DataInput_6 + DataInput_7 + DataInput_8 + + + DataOutput_5 + DataOutput_6 + + + + maia + DataInput_5 + + + DataInput_6 + + Valida Informacion Certificado + DataInput_26 + + + + DataInput_7 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_8 + + + DataOutput_5 + maia + + + DataOutput_6 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecutarInscripcion.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecutarInscripcion.bpmn new file mode 100644 index 0000000..f4e4fcd --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/EjecutarInscripcion.bpmn @@ -0,0 +1,313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Valida Info Inscripcion", 1, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Valida Info Inscripcion",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + + + + + + _DataInput_149 + _DataInput_150 + _DataInput_151 + _DataInput_152 + _DataInput_153 + _DataInput_154 + _DataInput_155 + DataInput_2 + DataInput_3 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_149 + + Valida Info Inscripcion + _DataInput_149 + + + + _DataInput_150 + + + _DataInput_151 + + + _DataInput_152 + + #{taskMetaData.groupId} + _DataInput_152 + + + + _DataInput_153 + + + _DataInput_154 + + + _DataInput_155 + + + maia + DataInput_2 + + + taskMetaData + DataInput_3 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ejecutar Certificados",actualTask); + + + SequenceFlow_4 + SequenceFlow_5 + + + + + + + DataInput_4 + DataInput_5 + + + DataOutput_3 + DataOutput_4 + + + + maia + DataInput_4 + + + taskMetaData + DataInput_5 + + + DataOutput_3 + maia + + + DataOutput_4 + taskMetaData + + + + SequenceFlow_5 + SequenceFlow_6 + //FlowUtil.endFlow(kcontext); + + + + + SequenceFlow_7 + SequenceFlow_9 + System.out.println("***SE ANULO EL TRAMITE***"); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + SequenceFlow_9 + SequenceFlow_10 + //FlowUtil.endFlow(kcontext); + + + + SequenceFlow_10 + + + + + SequenceFlow_3 + SequenceFlow_4 + SequenceFlow_7 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/EmisionDocumentoHabilitante.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/EmisionDocumentoHabilitante.bpmn new file mode 100644 index 0000000..8974da0 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/EmisionDocumentoHabilitante.bpmn @@ -0,0 +1,992 @@ + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_9 + SequenceFlow_1 + SequenceFlow_18 + + + return ("D".equals(taskMetaData.getResponse())); + + + + + taskMetaData=FlowUtil.createTaskInfo("30",102, 1,120, "Generar Reporte", 35, "OK_NO"); +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Generar Reporte",actualTask); + + + SequenceFlow_17 + SequenceFlow_20 + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_1 + + + DataInput_2 + + Generar Reporte + DataInput_26 + + + + DataInput_3 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_4 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + SequenceFlow_19 + SequenceFlow_17 + SequenceFlow_12 + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_1 + SequenceFlow_13 + System.out.println("ingresa a enviar el mail"); +//enviar mail de rechazo +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + SequenceFlow_18 + SequenceFlow_19 + FlowUtil.executeClass("com.fp.armas.task.FechaCaducidadEstadoArma", maia); +FlowUtil.executeClass("com.fp.armas.task.TramiteAprobado", maia); +FlowUtil.executeClass("com.fp.armas.task.TipoArchivoControl", maia); +FlowUtil.executeClass("com.fp.armas.task.FinalizarDocumentoHabilitante", maia); +taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.getAditionalData().put("datosmail", maia.get("datosmail")); +taskMetaData.setResponse((maia.get("tipoarchivo")!=null)?""+maia.get("tipoarchivo"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",101, 1,120, "Firmar Tramite Supervisor", 38, "OK_NO"); +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar Tramite Supervisor",actualTask); + + + SequenceFlow_20 + SequenceFlow_5 + + + + + + + + + + + + + + DataInput_21 + DataInput_22 + DataInput_23 + DataInput_24 + DataInput_25 + DataInput_27 + DataInput_28 + DataInput_30 + DataInput_31 + + + DataOutput_6 + DataOutput_7 + + + + DataInput_21 + + Firmar Tramite Supervisor + _DataInput_16 + + + + DataInput_22 + + + DataInput_23 + + + DataInput_24 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_25 + + + DataInput_27 + + + DataInput_28 + + + maia + DataInput_30 + + + taskMetaData + DataInput_31 + + + DataOutput_6 + maia + + + DataOutput_7 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("A".equals(taskMetaData.getResponse())); + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",35,1,120,null, "Notificar fecha de Emision", 6, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Notificar fecha de Emision",actualTask); + + + SequenceFlow_12 + SequenceFlow_11 + + + + + + + + + + + + + + DataInput_15 + DataInput_16 + DataInput_17 + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_32 + DataInput_33 + DataInput_34 + + + DataOutput_11 + DataOutput_12 + + + + DataInput_15 + + Notificar fecha de Emision + _DataInput_16 + + + + DataInput_16 + + + DataInput_17 + + + DataInput_18 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_19 + + + DataInput_20 + + + DataInput_32 + + + maia + DataInput_33 + + + taskMetaData + DataInput_34 + + + DataOutput_11 + maia + + + DataOutput_12 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_11 + SequenceFlow_3 + System.out.println("ingresa a enviar el mail si requiere tarjeta"); +//enviar mail de notificacion +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 4 ,5); + + + + SequenceFlow_3 + _16-_12 + //FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + SequenceFlow_13 + + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",108,1,120,null, "Notificar fecha de Emision Reporte", 6, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Notificar fecha de Emision Reporte",actualTask); + + + SequenceFlow_6 + SequenceFlow_10 + + + + + + + + + + + + + + DataInput_46 + DataInput_47 + DataInput_48 + DataInput_49 + DataInput_50 + DataInput_51 + DataInput_52 + DataInput_53 + DataInput_54 + + + DataOutput_9 + DataOutput_10 + + + + DataInput_46 + + Notificar fecha de Emision Reporte + _DataInput_16 + + + + DataInput_47 + + + DataInput_48 + + + DataInput_49 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_50 + + + DataInput_51 + + + DataInput_52 + + + maia + DataInput_53 + + + taskMetaData + DataInput_54 + + + DataOutput_9 + maia + + + DataOutput_10 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",109, 1,120, "Firmar Tramite Coordinador", 38, "OK_NO"); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar Tramite Coordinador",actualTask); + + + SequenceFlow_5 + SequenceFlow_6 + + + + + + + + + + + + + + DataInput_5 + DataInput_6 + DataInput_7 + DataInput_8 + DataInput_9 + DataInput_10 + DataInput_12 + DataInput_13 + DataInput_14 + + + DataOutput_13 + DataOutput_14 + + + + DataInput_5 + + Firmar Tramite Coordinador + _DataInput_16 + + + + DataInput_6 + + + DataInput_7 + + + DataInput_8 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_9 + + + DataInput_10 + + + DataInput_12 + + + maia + DataInput_13 + + + taskMetaData + DataInput_14 + + + DataOutput_13 + maia + + + DataOutput_14 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_10 + SequenceFlow_7 + System.out.println("ingresa a enviar el mail si requiere reporte"); +//enviar mail de notificacion +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 4 ,60); + + + + SequenceFlow_7 + SequenceFlow_22 + //FlowUtil.endFlow(kcontext); + + + + SequenceFlow_22 + + + + _1-_15 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + _1-_15 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",30, 1,120, "Revisar Tramite", 30, "OK_NO"); +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + System.out.println("............................................................................................ 1:"); +taskMetaData.updateData(maia); +System.out.println("............................................................................................ 2:"); +actualTask=new java.util.ArrayList(); +System.out.println("............................................................................................ 3:"); +kcontext.setVariable("actualTask",actualTask); +System.out.println("............................................................................................ 4:"); +actualTask.add(taskMetaData); +System.out.println("............................................................................................ 5:"); +tasksMetaData.put("Revisar Tramite",actualTask); +System.out.println("............................................................................................ 6:"); + + + SequenceFlow_2 + SequenceFlow_4 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Revisar Tramite + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + SequenceFlow_23 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",33, 1,120, "Autorizar Tramite", 31, "OK_NO"); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Autorizar Tramite",actualTask); + + + SequenceFlow_8 + SequenceFlow_9 + + + + + + + + + DataInput_200 + DataInput_201 + DataInput_202 + DataInput_203 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_200 + + + DataInput_201 + + Autorizar Tramite + DataInput_26 + + + + DataInput_202 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_203 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + SequenceFlow_4 + SequenceFlow_8 + SequenceFlow_14 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_14 + SequenceFlow_23 + System.out.println("............................................................................................ NO:"); +System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones","Tramite Anulado en Revisar Tramite"+datosmail.get("observaciones")); +}else{ +maia.put("observaciones","Tramite Anulado en Revisar Tramite"); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/EnvioArmas.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/EnvioArmas.bpmn new file mode 100644 index 0000000..18f3ce7 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/EnvioArmas.bpmn @@ -0,0 +1,354 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",58, 1,120, "Autorizar Acta Entrega", 33, "OK_NO"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarRutaArchivo", maia); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Autorizar Acta Entrega",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Autorizar Acta Entrega + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + _1-_15 + + + + SequenceFlow_1 + SequenceFlow_5 + SequenceFlow_9 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",94, 1,120, "Firmar Acta", 34, "OK_NO"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarRutaArchivo", maia); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar Acta",actualTask); + + + SequenceFlow_5 + SequenceFlow_10 + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + + + + _DataInput_16 + + Firmar Acta + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_9 + SequenceFlow_6 + System.out.println("Entra actualizar ruta"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarRutaArchivo", maia); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + + + SequenceFlow_4 + + + + SequenceFlow_6 + SequenceFlow_7 + System.out.println("Entra a rechazar ruta"); +FlowUtil.executeClass("com.fp.armas.task.RechazarActa", maia); + + + + SequenceFlow_7 + SequenceFlow_4 + FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/PlanificacionInspeccion.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/PlanificacionInspeccion.bpmn new file mode 100644 index 0000000..d52e983 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/PlanificacionInspeccion.bpmn @@ -0,0 +1,518 @@ + + + + + + + + + + + + + + + + + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",101, 1,120, "Firmar Plan", 50, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar Plan",actualTask); + + + SequenceFlow_6 + SequenceFlow_4 + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + + + + _DataInput_16 + + Firmar Plan + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + _16-_12 + + + + SequenceFlow_10 + SequenceFlow_11 + maia.put("respuesta","Y"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarPlanificacion", maia); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",105, 1,120, "Generar Reporte", 49, "OK_NO"); +//para asignar a un grupo especifico +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Generar Reporte",actualTask); + + + SequenceFlow_11 + SequenceFlow_6 + + + + + + + + + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_21 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_18 + + + DataInput_19 + + Generar Reporte + DataInput_26 + + + + DataInput_20 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_21 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_4 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_1 + SequenceFlow_8 + SequenceFlow_10 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_8 + SequenceFlow_13 + maia.put("respuesta","N"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarPlanificacion", maia); + + + + + taskMetaData=FlowUtil.createTaskInfo("30",106, 1,120, "Modificar Plan Inspeccion", 57, "OK_NO"); +//para asignar a un grupo especifico +maia.put("grupo","SUPERV_INSP_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Modificar Plan Inspeccion",actualTask); + + + SequenceFlow_13 + SequenceFlow_14 + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_1 + + + DataInput_2 + + Modificar Plan Inspeccion + DataInput_26 + + + + DataInput_3 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_4 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + _1-_15 + + + + _1-_15 + SequenceFlow_12 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_12 + SequenceFlow_14 + SequenceFlow_7 + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",104, 1,120, "Aprobar Plan Inspeccion", 48, "OK_NO"); +//para asignar a un grupo especifico +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Aprobar Plan Inspeccion",actualTask); + + + SequenceFlow_7 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Aprobar Plan Inspeccion + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/RecepcionArmas.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/RecepcionArmas.bpmn new file mode 100644 index 0000000..2151c71 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/RecepcionArmas.bpmn @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_4 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",101, 1,120, "Legalizar Acta", 29, "OK_NO"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarRutaArchivo", maia); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupoDecRecep", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Legalizar Acta",actualTask); + + + SequenceFlow_4 + SequenceFlow_5 + + + + + + + + + + + + + + _DataInput_30 + _DataInput_31 + _DataInput_32 + _DataInput_33 + _DataInput_34 + _DataInput_35 + _DataInput_36 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_30 + + Legalizar Acta + _DataInput_30 + + + + _DataInput_31 + + + _DataInput_32 + + + _DataInput_33 + + #{taskMetaData.groupId} + _DataInput_33 + + + + _DataInput_34 + + + _DataInput_35 + + + _DataInput_36 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_5 + SequenceFlow_1 + System.out.println("ingresa a Actualizar Inventario"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarInventario", maia); // la clase puede hacer lo que necesite +System.out.println("-- Actualizar Inventario"); + + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/RecepcionSolicitudRequisitos.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/RecepcionSolicitudRequisitos.bpmn new file mode 100644 index 0000000..d61f725 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/RecepcionSolicitudRequisitos.bpmn @@ -0,0 +1,360 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + SequenceFlow_18 + + + + SequenceFlow_25 + SequenceFlow_18 + FlowUtil.endFlow(kcontext); + + + + _1-_15 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_23 + SequenceFlow_10 + System.out.println("***Ingresa a la tarea generar valor a cancelar***"); +FlowUtil.executeClass("com.fp.armas.task.GenerarValorACancelar", maia); +//taskMetaData.getAditionalData().get("datosmail"); +//taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("BPMStatus")!=null)?""+maia.get("BPMStatus"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_19 + SequenceFlow_3 + System.out.println("Ingresa a tarea de enviar el mail de aceptacion de requisitos"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 10 , 11); + + + + + + + SequenceFlow_24 + SequenceFlow_25 + + + + + + + DataInput_40 + DataInput_41 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_40 + + + taskMetaData + DataInput_41 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + + + SequenceFlow_3 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",25, 1,120, "Revisar solicitud y documentos requeridos", 1, "OK_NO"); +//para asignar a un grupo especifico +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +kcontext.setVariable("taskMetaData",taskMetaData); +actualTask.add(taskMetaData); +tasksMetaData.put("Revisar solicitud y documentos requeridos",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Revisar solicitud y documentos requeridos + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_1 + SequenceFlow_7 + SequenceFlow_23 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + SequenceFlow_19 + SequenceFlow_24 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_5 + + + + SequenceFlow_7 + SequenceFlow_4 + //enviar mail al usuario indicando razones del rechazo +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 52 , 53); + + + + SequenceFlow_4 + SequenceFlow_5 + FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/RegistroDecomiso.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/RegistroDecomiso.bpmn new file mode 100644 index 0000000..51e1f00 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/RegistroDecomiso.bpmn @@ -0,0 +1,320 @@ + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_15 + + + + SequenceFlow_12 + SequenceFlow_16 + SequenceFlow_7 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("C".equals(taskMetaData.getResponse())); + + + SequenceFlow_16 + SequenceFlow_15 + //FlowUtil.endFlow(kcontext); + + + + SequenceFlow_3 + SequenceFlow_4 + //FlowUtil.endFlow(kcontext); + + + SequenceFlow_4 + + + + + SequenceFlow_23 + + + + SequenceFlow_23 + SequenceFlow_5 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_5 + SequenceFlow_6 + FlowUtil.executeClass("com.fp.armas.task.ValidacionDecomiso", maia); +taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("importacion")!=null)?""+maia.get("importacion"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + SequenceFlow_6 + SequenceFlow_2 + SequenceFlow_3 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_2 + SequenceFlow_12 + FlowUtil.executeClass("com.fp.armas.task.ObtieneCentroControl", maia); +taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("corganismo")!=null)?""+maia.get("corganismo"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_11 + + + + SequenceFlow_9 + SequenceFlow_11 + FlowUtil.endFlow(kcontext); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",60, 1,120, "Definir Sancion", 44, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Definir Sancion",actualTask); + + + SequenceFlow_7 + SequenceFlow_9 + + + + + + + + + + + + + + DataInput_43 + DataInput_44 + DataInput_45 + DataInput_46 + DataInput_47 + DataInput_48 + DataInput_49 + DataInput_50 + DataInput_51 + + + DataOutput_7 + DataOutput_10 + + + + DataInput_43 + + Definir Sancion + _DataInput_16 + + + + DataInput_44 + + + DataInput_45 + + + DataInput_46 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_47 + + + DataInput_48 + + + DataInput_49 + + + maia + DataInput_50 + + + taskMetaData + DataInput_51 + + + DataOutput_7 + maia + + + DataOutput_10 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/autorizarDocumentoCarlos.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/autorizarDocumentoCarlos.bpmn new file mode 100644 index 0000000..4728c5e --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/autorizarDocumentoCarlos.bpmn @@ -0,0 +1,287 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_5 + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_7 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",33,1,120,null, "Autorizar documento habilitante", 7, "OK_NO"); +System.out.println("Ingresa tarea---2-"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + System.out.println("Ingresa a la tarea 3"); +List old=(List)tasksMetaData.get("Autorizar documento habilitante"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Revisar solicitud y documentos requeridos",old); + + + SequenceFlow_8 + SequenceFlow_9 + + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_1 + taskMetaData + + + DataOutput_2 + maia + + + DataOutput_3 + actualTask + + + + SequenceFlow_7 + SequenceFlow_8 + System.out.println("Ingresa por el script"); + + + + SequenceFlow_9 + SequenceFlow_10 + SequenceFlow_11 + + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + SequenceFlow_1 + System.out.println("ingresa a enviar el mail"); +//enviar mail de rechazo +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + return ("A".equals(taskMetaData.getResponse())); + + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + + + System.out.println("fin"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",34, 1,120,null, "Visualizar tramite firma", 7, "OK_NO"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + + List old=(List)tasksMetaData.get("Visualizar tramite firma"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Aprobar tramite",old); + + + SequenceFlow_11 + SequenceFlow_5 + + + + + + + + DataInput_5 + DataInput_6 + + + DataOutput_4 + DataOutput_5 + DataOutput_6 + + + + maia + DataInput_5 + + + taskMetaData + DataInput_6 + + + DataOutput_4 + maia + + + DataOutput_5 + taskMetaData + + + DataOutput_6 + actualTask + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/decomisarArmaCarlos.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/decomisarArmaCarlos.bpmn new file mode 100644 index 0000000..df1fcde --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/decomisarArmaCarlos.bpmn @@ -0,0 +1,233 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_7 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",28,1,120,null, "Ficha Tecnica de Armas", 14, "OK_NO"); +System.out.println("Ingresa tarea---2-"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + System.out.println("Ingresa a la tarea 3"); +List old=(List)tasksMetaData.get("Ficha Tecnica de Armas"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Revisar solicitud y documentos requeridos",old); + + + SequenceFlow_8 + SequenceFlow_9 + + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_1 + taskMetaData + + + DataOutput_2 + maia + + + DataOutput_3 + actualTask + + + + SequenceFlow_7 + SequenceFlow_8 + System.out.println("Ingresa por el script"); + + + + SequenceFlow_9 + SequenceFlow_10 + SequenceFlow_3 + SequenceFlow_4 + + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + SequenceFlow_1 + System.out.println("ingresa a enviar el mail"); +//enviar mail de rechazo +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 15, 16); + + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + SequenceFlow_3 + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_4 + + + + return ("R".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/decomiso.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/decomiso.bpmn new file mode 100644 index 0000000..cc77e11 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/decomiso.bpmn @@ -0,0 +1,211 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_4 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + System.out.println("ingresa a LEGALIZAR EL ACTA"); +taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "Legalizar Acta", 1, "OK_NO"); + +//FlowUtil.executeClass("paquete.clase", maia); // la clase puede hacer lo que necesite +//taskMetaData.setUserId((maia.get("userId")!=null)?""+maia.get("userId"):null); +//taskMetaData.setGroupId((maia.get("groupId")!=null)?""+maia.get("groupId"):null); +//para asignar a un grupo especifico +taskMetaData.setGroupId("GERENCIA"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Legalizar Acta",actualTask); + + + SequenceFlow_4 + SequenceFlow_5 + + + + + + + + + + + + + + _DataInput_30 + _DataInput_31 + _DataInput_32 + _DataInput_33 + _DataInput_34 + _DataInput_35 + _DataInput_36 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_30 + + Legalizar Acta + _DataInput_30 + + + + _DataInput_31 + + + _DataInput_32 + + + _DataInput_33 + + #{taskMetaData.groupId} + _DataInput_33 + + + + _DataInput_34 + + + _DataInput_35 + + + _DataInput_36 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_5 + SequenceFlow_1 + System.out.println("ingresa a Actualizar Inventario"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarInventario", maia); // la clase puede hacer lo que necesite +System.out.println("-- Actualizar Inventario"); + + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/notificacionAnulacionTramite.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/notificacionAnulacionTramite.bpmn new file mode 100644 index 0000000..4d78c1b --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/notificacionAnulacionTramite.bpmn @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_7 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",23,1,120,null, "Notificacion de tramite anulado en la Solicitud de Guia de Libre Transito", 1, "OK_NO"); +System.out.println("Ingresa tarea---2-"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + System.out.println("Ingresa a la tarea 3"); +List old=(List)tasksMetaData.get("Notificacion de tramite anulado en la Solicitud de Guia de Libre Transito"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Revisar solicitud y documentos requeridos",old); + + + SequenceFlow_8 + SequenceFlow_9 + + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_1 + taskMetaData + + + DataOutput_2 + maia + + + DataOutput_3 + actualTask + + + + SequenceFlow_7 + SequenceFlow_8 + System.out.println("Ingresa por el script"); + + + + SequenceFlow_9 + SequenceFlow_10 + SequenceFlow_14 + + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + SequenceFlow_1 + System.out.println("ingresa a enviar el mail"); +//enviar mail de rechazo +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 13 , 12); + + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_14 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/solicitud.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/solicitud.bpmn new file mode 100644 index 0000000..ea8f060 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/solicitud.bpmn @@ -0,0 +1,280 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",25,1,120,null, "Revisar solicitud y documentos requeridos", 1, "OK_NO"); +System.out.println("Ingresa tarea---2-"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + System.out.println("Ingresa a la tarea 3"); +List old=(List)tasksMetaData.get("Revisar solicitud y documentos requeridos"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Revisar solicitud y documentos requeridos",old); + + + + + + + + + + CallActivity_2_maiaInput + CallActivity_2_taskMetaDataInput + + + CallActivity_2_actualTaskOutput + CallActivity_2_maiaOutput + CallActivity_2_taskMetaDataOutput + + + + maia + CallActivity_2_maiaInput + + + taskMetaData + CallActivity_2_taskMetaDataInput + + + CallActivity_2_actualTaskOutput + actualTask + + + CallActivity_2_maiaOutput + maia + + + CallActivity_2_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + System.out.println("fin"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",22, 1,120,null, "Aprobar tramite", 1, "OK_NO"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + List old=(List)tasksMetaData.get("Aprobar tramite"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Aprobar tramite",old); + + + + + + + + + + CallActivity_3_maiaInput + CallActivity_3_taskMetaDataInput + + + CallActivity_3_actualTaskOutput + CallActivity_3_maiaOutput + CallActivity_3_taskMetaDataOutput + + + + maia + CallActivity_3_maiaInput + + + taskMetaData + CallActivity_3_taskMetaDataInput + + + CallActivity_3_actualTaskOutput + actualTask + + + CallActivity_3_maiaOutput + maia + + + CallActivity_3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + return ("D".equals(taskMetaData.getResponse())); + + + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/solicitudCarlos.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/solicitudCarlos.bpmn new file mode 100644 index 0000000..ca0b574 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/solicitudCarlos.bpmn @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_7 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_7 + SequenceFlow_8 + System.out.println("Ingresa por el script"); + + + + SequenceFlow_4 + SequenceFlow_1 + System.out.println("ingresa a enviar el mail"); +//enviar mail de notificacion +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 4 ,5); + + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",35,1,120,null, "Notificar fecha de Emision", 6, "OK_NO"); +System.out.println("Ingresa tarea---2-"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + System.out.println("Ingresa a la tarea 3"); +List old=(List)tasksMetaData.get("Notificar fecha de Emision"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Notificar fecha de Emision",old); + + + SequenceFlow_8 + SequenceFlow_4 + + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_1 + taskMetaData + + + DataOutput_2 + maia + + + DataOutput_3 + actualTask + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/solicitudFlow.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/solicitudFlow.bpmn new file mode 100644 index 0000000..7ef9d5e --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/solicitudFlow.bpmn @@ -0,0 +1,525 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_4 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",25,1,120,null, "Revisar solicitud y documentos requeridos", 10, "OK_NO"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + System.out.println("Ingresa a la tarea 3"); +List old=(List)tasksMetaData.get("Revisar solicitud y documentos requeridos"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Revisar requisitos",old); + + + SequenceFlow_4 + SequenceFlow_9 + + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_1 + taskMetaData + + + DataOutput_2 + maia + + + DataOutput_3 + actualTask + + + + SequenceFlow_9 + SequenceFlow_10 + SequenceFlow_11 + + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + SequenceFlow_1 + System.out.println("ingresa a enviar el mail"); +//enviar mail al jefe del empleado +FlowUtil.mail("com.fp.armas.mail.SolicitanteDireccion", maia, taskMetaData, 27 , 26); + + + + + SequenceFlow_11 + SequenceFlow_3 + SequenceFlow_8 + + + return ("1".equals("1")); + + + SequenceFlow_3 + SequenceFlow_7 + System.out.println("ingresa a enviar el mail de aceptacion de requisitos"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.SolicitanteDireccion", maia, taskMetaData, 10 , 11); + + + + SequenceFlow_8 + SequenceFlow_21 + System.out.println("El valor del depósito es cero"); +FlowUtil.endFlow(kcontext); + + + return ("2".equals("1")); + + + + + System.out.println("fin"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",22, 1,120,null, "Aprobar tramite", 1, "OK_NO"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + + List old=(List)tasksMetaData.get("Aprobar tramite"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Aprobar tramite",old); + + + SequenceFlow_7 + SequenceFlow_15 + + + + + + + + DataInput_5 + DataInput_6 + + + DataOutput_4 + DataOutput_5 + DataOutput_6 + + + + maia + DataInput_5 + + + taskMetaData + DataInput_6 + + + DataOutput_4 + maia + + + DataOutput_5 + taskMetaData + + + DataOutput_6 + actualTask + + + + + + + System.out.println("fin"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",22, 1,120,null, "Aprobar tramite", 1, "OK_NO"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + + List old=(List)tasksMetaData.get("Aprobar tramite"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Aprobar tramite",old); + + + SequenceFlow_15 + SequenceFlow_16 + + + + + + + + DataInput_1 + DataInput_2 + + + DataOutput_7 + DataOutput_8 + DataOutput_9 + + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_7 + maia + + + DataOutput_8 + taskMetaData + + + DataOutput_9 + actualTask + + + + + SequenceFlow_17 + + + + System.out.println("El valor a cancelar generado es: "); + SequenceFlow_18 + SequenceFlow_17 + System.out.println("ingresa a enviar el mail de aceptacion de requisitos"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.SolicitanteDireccion", maia, taskMetaData, 10 , 11); + + + + SequenceFlow_16 + SequenceFlow_18 + SequenceFlow_19 + + + return ("1".equals("1")); + + + SequenceFlow_1 + SequenceFlow_2 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + return ("2".equals("1")); + + + + + System.out.println("fin"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",22, 1,120,null, "Aprobar tramite", 1, "OK_NO"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + + List old=(List)tasksMetaData.get("Aprobar tramite"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Aprobar tramite",old); + + + SequenceFlow_19 + SequenceFlow_21 + SequenceFlow_20 + + + + + + + + DataInput_7 + DataInput_8 + + + DataOutput_10 + DataOutput_11 + DataOutput_12 + + + + maia + DataInput_7 + + + taskMetaData + DataInput_8 + + + DataOutput_10 + maia + + + DataOutput_11 + taskMetaData + + + DataOutput_12 + actualTask + + + + + SequenceFlow_20 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comaco/subproceso.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comaco/subproceso.bpmn new file mode 100644 index 0000000..54da02e --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comaco/subproceso.bpmn @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + _1-_15 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "Validar Reimpresion", 32, "OK_NO"); + +//FlowUtil.executeClass("paquete.clase", maia); // la clase puede hacer lo que necesite +//taskMetaData.setUserId((maia.get("userId")!=null)?""+maia.get("userId"):null); +//taskMetaData.setGroupId((maia.get("groupId")!=null)?""+maia.get("groupId"):null); +//para asignar a un grupo especifico +taskMetaData.setGroupId("GERENCIA"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar Reimpresion",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Validar Reimpresion + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + _16-_12 + + + + SequenceFlow_6 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_3 + SequenceFlow_6 + System.out.println("Ingresa por el script fin................................................"); +System.out.println("Ingresa por el script fin................................................"); +System.out.println("Ingresa por el script fin................................................"); +System.out.println("Ingresa por el script fin................................................"); +System.out.println("Ingresa por el script fin................................................"); +System.out.println("Ingresa por el script fin................................................"); + + + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Emision Documento Habilitante",actualTask); + + + SequenceFlow_1 + SequenceFlow_3 + + + + + + + DataInput_79 + DataInput_80 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_79 + + + taskMetaData + DataInput_80 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/entries b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/entries new file mode 100644 index 0000000..ad4d452 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/entries @@ -0,0 +1,572 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/resources/flows/comacov2 +svn://172.17.26.185/COMACO + + + +2021-05-14T20:45:18.333910Z +4635 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +EjecucionIncrementoArmasV2.bpmn +file + + + + +2022-07-28T03:40:46.114818Z +c47c488cc1063231a03fda8dc59e2b76 +2016-01-15T17:41:51.430820Z +4381 +fpazmino + + + + + + + + + + + + + + + + + + + + + +21346 + +RecepcionSolicitudRequisitosV2.bpmn +file + + + + +2022-07-28T03:40:46.115818Z +0bf4e3952e94f9af9aee77cf46e39a5b +2016-01-15T17:41:51.430820Z +4381 +fpazmino + + + + + + + + + + + + + + + + + + + + + +25654 + +EjecutarCertificadosV2.bpmn +file + + + + +2022-07-28T03:40:46.115818Z +a84a380532de23727b125e07f03a9529 +2016-01-15T17:41:51.430820Z +4381 +fpazmino + + + + + + + + + + + + + + + + + + + + + +19368 + +EjecucionEmisionGuiaTransitoV2.bpmn +file + + + + +2022-07-28T03:40:46.115818Z +25265ab114c88412594b8c1a5caf78cc +2016-01-15T17:41:51.430820Z +4381 +fpazmino + + + + + + + + + + + + + + + + + + + + + +29506 + +CargaDepositoV2.bpmn +file + + + + +2022-07-28T03:40:46.115818Z +018435476d28d29b72795f0a97b17fa9 +2016-01-15T17:41:51.430820Z +4381 +fpazmino + + + + + + + + + + + + + + + + + + + + + +21375 + +EjecucionCertificadoFiscalia.bpmn +file + + + + +2022-07-28T03:40:46.116818Z +315203bea35c38c4fd4b7bc7e8be2950 +2016-01-26T23:20:22.484117Z +4411 +fpazmino + + + + + + + + + + + + + + + + + + + + + +19652 + +EmisionDocumentoHabilitanteV2.bpmn +file + + + + +2022-07-28T03:40:46.116818Z +228e21e68460c8aa498cad8c1439c8b4 +2016-03-18T20:02:28.170272Z +4515 +fpazmino + + + + + + + + + + + + + + + + + + + + + +63748 + +EjecucionTramiteV2.bpmn +file + + + + +2022-07-28T03:40:46.116818Z +857b318090c2520de2a3423dd7a5693b +2016-01-15T17:41:51.430820Z +4381 +fpazmino + + + + + + + + + + + + + + + + + + + + + +53176 + +RecepcionArmasV2.bpmn +file + + + + +2022-07-28T03:40:46.117818Z +eff6f4f61c788db0d823c008043c1d99 +2016-04-19T16:55:08.864121Z +4538 +fpazmino + + + + + + + + + + + + + + + + + + + + + +25264 + +EjecucionDevolucionV2.bpmn +file + + + + +2022-07-28T03:40:46.117818Z +eaf9fd615ca123809928439d20ee5d37 +2016-01-15T17:41:51.430820Z +4381 +fpazmino + + + + + + + + + + + + + + + + + + + + + +27435 + +EjecucionAutorizacionV2.bpmn +file + + + + +2022-07-28T03:40:46.117818Z +16c66cb2b77e1a760abc74e754c91e66 +2016-01-15T17:41:51.430820Z +4381 +fpazmino + + + + + + + + + + + + + + + + + + + + + +46645 + +EjecucionInternacionV2.bpmn +file + + + + +2022-07-28T03:40:46.117818Z +08907c56eecc759399f3c9c27b4d5891 +2016-01-15T17:41:51.430820Z +4381 +fpazmino + + + + + + + + + + + + + + + + + + + + + +22216 + +EjecutarInscripcionV2.bpmn +file + + + + +2022-07-28T03:40:46.118818Z +f33fe3cfc2501dc176558e0127813b11 +2016-01-15T17:41:51.430820Z +4381 +fpazmino + + + + + + + + + + + + + + + + + + + + + +21731 + +EjecucionPermisoV2.bpmn +file + + + + +2022-07-28T03:40:46.118818Z +6afa42454332d5e59b53d29de753ea32 +2016-01-15T17:41:51.430820Z +4381 +fpazmino + + + + + + + + + + + + + + + + + + + + + +19875 + +EjecucionAperturaV2.bpmn +file + + + + +2022-07-28T03:40:46.118818Z +d0948bdbd9b994b4b44e4aa30a0c590b +2016-01-15T17:41:51.430820Z +4381 +fpazmino + + + + + + + + + + + + + + + + + + + + + +21569 + +TraspasoDominioV2.bpmn +file + + + + +2022-07-28T03:40:46.118818Z +b5e290fde81f7d36f2d9f38f71918531 +2021-05-14T20:45:18.333910Z +4635 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +18497 + diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/CargaDepositoV2.bpmn.netbeans-base b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/CargaDepositoV2.bpmn.netbeans-base new file mode 100644 index 0000000..aaedd28 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/CargaDepositoV2.bpmn.netbeans-base @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_11 + + + + SequenceFlow_10 + SequenceFlow_11 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_9 + SequenceFlow_10 + System.out.println("Ingresa a tarea de enviar el mail de Notificar inconsistencia deposito"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 17 , 18); + + + + _1-_15 + SequenceFlow_1 + System.out.println("..........................CARGA DEPOSITO V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",42, 1,120, "Validar transaccion de deposito", 24, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidaFlujoCargaDeposito", maia); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar transaccion de deposito",actualTask); + + + SequenceFlow_1 + SequenceFlow_6 + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + + + + _DataInput_16 + + Validar transaccion de deposito + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + _1-_15 + + + + + + //taskMetaData=FlowUtil.createTaskInfoByClassName("30",24, 1,30,"com.fp.viaticos.task.AsignarEmpleado", "Modificar empleado", 11, "OK_NO"); +//kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_2 + SequenceFlow_15 + + + + + + + DataInput_18 + DataInput_19 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_18 + + + taskMetaData + DataInput_19 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + + _16-_12 + + + + SequenceFlow_15 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_6 + SequenceFlow_9 + SequenceFlow_2 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/CargaDepositoV2.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/CargaDepositoV2.bpmn.svn-base new file mode 100644 index 0000000..aaedd28 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/CargaDepositoV2.bpmn.svn-base @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_11 + + + + SequenceFlow_10 + SequenceFlow_11 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_9 + SequenceFlow_10 + System.out.println("Ingresa a tarea de enviar el mail de Notificar inconsistencia deposito"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 17 , 18); + + + + _1-_15 + SequenceFlow_1 + System.out.println("..........................CARGA DEPOSITO V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",42, 1,120, "Validar transaccion de deposito", 24, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidaFlujoCargaDeposito", maia); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar transaccion de deposito",actualTask); + + + SequenceFlow_1 + SequenceFlow_6 + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + + + + _DataInput_16 + + Validar transaccion de deposito + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + _1-_15 + + + + + + //taskMetaData=FlowUtil.createTaskInfoByClassName("30",24, 1,30,"com.fp.viaticos.task.AsignarEmpleado", "Modificar empleado", 11, "OK_NO"); +//kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_2 + SequenceFlow_15 + + + + + + + DataInput_18 + DataInput_19 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_18 + + + taskMetaData + DataInput_19 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + + _16-_12 + + + + SequenceFlow_15 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_6 + SequenceFlow_9 + SequenceFlow_2 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionAperturaV2.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionAperturaV2.bpmn.svn-base new file mode 100644 index 0000000..477cfd4 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionAperturaV2.bpmn.svn-base @@ -0,0 +1,312 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("..........................EJECUCION APERTURA AGENCIA V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar Info Agencias", 1, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar Info Agencias",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + + + + + + _DataInput_191 + _DataInput_192 + _DataInput_193 + _DataInput_194 + _DataInput_195 + _DataInput_196 + _DataInput_197 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_191 + + Validar Info Agencias + _DataInput_191 + + + + _DataInput_192 + + + _DataInput_193 + + + _DataInput_194 + + #{taskMetaData.groupId} + _DataInput_194 + + + + _DataInput_195 + + + _DataInput_196 + + + _DataInput_197 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + SequenceFlow_5 + SequenceFlow_6 + //FlowUtil.endFlow(kcontext); + + + SequenceFlow_6 + + + + + SequenceFlow_8 + SequenceFlow_9 + //FlowUtil.endFlow(kcontext); + + + SequenceFlow_9 + + + + + + + + + + + SequenceFlow_7 + SequenceFlow_8 + + + + + + + DataInput_5 + DataInput_6 + + + DataOutput_5 + DataOutput_6 + + + + maia + DataInput_5 + + + taskMetaData + DataInput_6 + + + DataOutput_5 + maia + + + DataOutput_6 + taskMetaData + + + + + SequenceFlow_4 + SequenceFlow_5 + System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + SequenceFlow_3 + SequenceFlow_4 + SequenceFlow_7 + + + System.out.println("Camino D"); +return ("D".equals(taskMetaData.getResponse())); + + + System.out.println("Camino A"); +return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionAutorizacionV2.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionAutorizacionV2.bpmn.svn-base new file mode 100644 index 0000000..19dce39 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionAutorizacionV2.bpmn.svn-base @@ -0,0 +1,632 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + _1-_15 + SequenceFlow_1 + System.out.println("..........................EJECUCION AUTORIZACION V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar tipo de Autorizacion", 1, "OK_NO"); +maia.put("grupo","SUPERV_INSP_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar tipo de Autorizacion",actualTask); + + + SequenceFlow_1 + SequenceFlow_12 + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + DataInput_5 + DataInput_6 + DataInput_12 + DataInput_7 + DataInput_8 + + + DataOutput_6 + DataOutput_7 + + + + DataInput_1 + + Validar tipo de Autorizacion + _DataInput_149 + + + + DataInput_2 + + + DataInput_3 + + + DataInput_4 + + #{taskMetaData.groupId} + _DataInput_152 + + + + DataInput_5 + + + DataInput_6 + + + DataInput_12 + + + maia + DataInput_7 + + + taskMetaData + DataInput_8 + + + DataOutput_6 + maia + + + DataOutput_7 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_16 + + + + SequenceFlow_12 + SequenceFlow_15 + SequenceFlow_7 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + Requiere Inspeccion + SequenceFlow_7 + SequenceFlow_13 + System.out.println("............................................................................................Autorizacion Previa de Importacion"); +FlowUtil.executeClass("com.fp.armas.task.ValAutorizacionPreviaImporta", maia); +if(taskMetaData ==null){ + taskMetaData = new com.fp.simple.dto.TaskInfo(); +} +taskMetaData.setResponse((maia.get("previaimportacion")!=null)?""+maia.get("previaimportacion"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_13 + SequenceFlow_19 + SequenceFlow_20 + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar tipo de Autorizacion VUE", 1, "OK_NO"); +taskMetaData.setGroupId("ANALISTA_VUE"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar tipo de Autorizacion VUE",actualTask); + + + SequenceFlow_19 + SequenceFlow_21 + + + + + + + + + + + + + + DataInput_14 + DataInput_15 + DataInput_16 + DataInput_17 + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_21 + DataInput_22 + + + DataOutput_1 + DataOutput_2 + + + + DataInput_14 + + Validar tipo de Autorizacion VUE + _DataInput_149 + + + + DataInput_15 + + + DataInput_16 + + + DataInput_17 + + #{taskMetaData.groupId} + _DataInput_152 + + + + DataInput_18 + + + DataInput_19 + + + DataInput_20 + + + maia + DataInput_21 + + + taskMetaData + DataInput_22 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_17 + SequenceFlow_2 + SequenceFlow_3 + + + return ("N".equals(taskMetaData.getResponse())); + + + return ("Y".equals(taskMetaData.getResponse())); + + + SequenceFlow_8 + _16-_12 + + + + Requiere Inspeccion + SequenceFlow_22 + SequenceFlow_17 + System.out.println(".............................................................................................Requiere Inspeccion :"); +FlowUtil.executeClass("com.fp.armas.task.RequiereInspeccion", maia); +if(taskMetaData ==null){ + taskMetaData = new com.fp.simple.dto.TaskInfo(); +} +taskMetaData.setResponse((maia.get("inspeccion")!=null)?""+maia.get("inspeccion"):null); +System.out.println(".............................................................................................Requiere Inspeccion :"+taskMetaData.getResponse()); +kcontext.setVariable("taskMetaData",taskMetaData); +System.out.println(".............................................................................................Requiere Inspeccion :"+taskMetaData.getResponse()); + + + + SequenceFlow_2 + SequenceFlow_9 + SequenceFlow_5 + + + + _16-_12 + + + + + + System.out.println("............................................................................................ Inspeccion :"); + + + System.out.println("............................................................................................ Inspeccion OK"); +FlowUtil.executeClass("com.fp.armas.task.ValidaInspeccion", maia); +if(taskMetaData ==null){ + taskMetaData = new com.fp.simple.dto.TaskInfo(); +} +taskMetaData.setResponse((maia.get("tramiteproceso")!=null)?""+maia.get("tramiteproceso"):null); +kcontext.setVariable("taskMetaData",taskMetaData); +System.out.println("..........................................................................................regreso... :"+taskMetaData.getResponse()); + + + SequenceFlow_3 + SequenceFlow_4 + + + + + + + DataInput_11 + DataInput_13 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + taskMetaData + DataInput_13 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + + SequenceFlow_11 + + + + + + + SequenceFlow_5 + SequenceFlow_8 + + + + + + + DataInput_9 + DataInput_10 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_9 + + + taskMetaData + DataInput_10 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + + SequenceFlow_10 + SequenceFlow_11 + + + + return ("D".equals(taskMetaData.getResponse())); + + + + SequenceFlow_20 + SequenceFlow_21 + SequenceFlow_22 + + + + SequenceFlow_4 + SequenceFlow_9 + SequenceFlow_10 + + + return ("Y".equals(taskMetaData.getResponse())); + + + return ("N".equals(taskMetaData.getResponse())); + + + SequenceFlow_15 + SequenceFlow_16 + System.out.println("............................................................................................ RECHAZA VALIDAR TIPO SOLICITUD:"); +System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones","Tramite Anulado en Validar Tipo De Autorizacion"+datosmail.get("observaciones")); +}else{ +maia.put("observaciones","Tramite Anulado en Validar Tipo De Autorizacion"); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionCertificadoFiscalia.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionCertificadoFiscalia.bpmn.svn-base new file mode 100644 index 0000000..1d33f14 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionCertificadoFiscalia.bpmn.svn-base @@ -0,0 +1,292 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + System.out.println("..........................EJECUCION CERTIFICADO DE FISCALIA......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",153, 1,120, "Generar certificado fiscalia", 65, "OK_NO"); +maia.put("grupo","TEC_ALM_CENTRO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData=FlowUtil.createTaskInfo("30",153, 1,120, "Generar certificado fiscalia", 65, "OK_NO"); +//para asignar a un grupo especifico +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + SequenceFlow_2 + SequenceFlow_5 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Generar certificado fiscalia + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + _1-_15 + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",118, 1,120, "Firmar certificado fiscalia", 66, "OK_NO"); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar certificado fiscalia",actualTask); + + + SequenceFlow_5 + SequenceFlow_4 + + + + + + + + + + + + + + DataInput_17 + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_21 + DataInput_22 + DataInput_23 + DataInput_24 + DataInput_25 + + + DataOutput_3 + DataOutput_5 + + + + DataInput_17 + + Firmar certificado fiscalia + _DataInput_16 + + + + DataInput_18 + + + DataInput_19 + + + DataInput_20 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_21 + + + DataInput_22 + + + DataInput_23 + + + maia + DataInput_24 + + + taskMetaData + DataInput_25 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_4 + SequenceFlow_6 + System.out.println("..........................NOTIFICAR ENTREGA CERTIFICADO FISCALIA......................."); + + + + SequenceFlow_6 + SequenceFlow_1 + System.out.println("..........................FINALIZA CERTIFICADO DE FISCALIA......................."); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionDevolucionV2.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionDevolucionV2.bpmn.svn-base new file mode 100644 index 0000000..e7fb61d --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionDevolucionV2.bpmn.svn-base @@ -0,0 +1,412 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_10 + System.out.println("..........................EJECUCION DEVOLUCION V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + _1-_15 + + + + SequenceFlow_11 + SequenceFlow_5 + SequenceFlow_7 + + + + + taskMetaData=FlowUtil.createTaskInfo("30",32, 1,120, "Autorizar Devolucion",37, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +System.out.println("1..................."); +actualTask=new java.util.ArrayList(); +System.out.println("2..................."); +kcontext.setVariable("actualTask",actualTask); +System.out.println("3..................."); +actualTask.add(taskMetaData); +System.out.println("4..................."); +System.out.println("5..................."); +tasksMetaData.put("Autorizar Devolucion",actualTask); +System.out.println("6..................."); + + + SequenceFlow_5 + SequenceFlow_1 + + + + + + + + + + + + + + DataInput_13 + DataInput_14 + DataInput_15 + DataInput_16 + DataInput_17 + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_21 + + + DataOutput_1 + DataOutput_2 + + + + DataInput_13 + + Autorizar Devolucion + _DataInput_16 + + + + DataInput_14 + + + DataInput_15 + + + DataInput_16 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_17 + + + DataInput_18 + + + DataInput_19 + + + maia + DataInput_20 + + + taskMetaData + DataInput_21 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_7 + _16-_12 + System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + _16-_12 + + + + return ("D".equals(taskMetaData.getResponse())); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",29, 1,120, "Informacion Devolucion", 36, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","TEC_ALM_CENTRO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Informacion Devolucion",actualTask); + + + + SequenceFlow_10 + SequenceFlow_11 + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + DataInput_5 + DataInput_6 + DataInput_7 + DataInput_8 + DataInput_9 + + + DataOutput_3 + DataOutput_5 + + + + DataInput_1 + + Informacion Devolucion + _DataInput_16 + + + + DataInput_2 + + + DataInput_3 + + + DataInput_4 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_5 + + + DataInput_6 + + + DataInput_7 + + + maia + DataInput_8 + + + taskMetaData + DataInput_9 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_2 + SequenceFlow_6 + System.out.println("fin"); +//FlowUtil.endFlow(kcontext); +System.out.println("fin1"); + + + + SequenceFlow_6 + + + + + + + SequenceFlow_1 + SequenceFlow_2 + + + + + + + DataInput_10 + DataInput_11 + + + DataOutput_4 + DataOutput_6 + + + + maia + DataInput_10 + + + taskMetaData + DataInput_11 + + + DataOutput_4 + maia + + + DataOutput_6 + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionEmisionGuiaTransitoV2.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionEmisionGuiaTransitoV2.bpmn.svn-base new file mode 100644 index 0000000..f0b4a8c --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionEmisionGuiaTransitoV2.bpmn.svn-base @@ -0,0 +1,423 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + _1-_15 + SequenceFlow_2 + System.out.println("..........................EMISION GUIA LIBRE TRANSITO V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_1 + SequenceFlow_5 + SequenceFlow_13 + + + return ("D".equals(taskMetaData.getResponse())); + + + + + taskMetaData=FlowUtil.createTaskInfo("30",23, 1,120, "Validacion Inconsistencias Informacion Solicitud", 56, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validacion Inconsistencias Informacion Solicitud",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Validacion Inconsistencias Informacion Solicitud + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_5 + SequenceFlow_6 + System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,61); + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_13 + SequenceFlow_16 + System.out.println(" Verifica cantidad armamento "); +FlowUtil.executeClass("com.fp.armas.task.VerificarCantidadArmas", maia); +taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("requierecustodia")!=null)?""+maia.get("requierecustodia"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + SequenceFlow_16 + SequenceFlow_20 + SequenceFlow_24 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_20 + SequenceFlow_15 + SequenceFlow_22 + + + + + + System.out.println(" Genera Orden trabajo "); +taskMetaData=FlowUtil.createTaskInfo("30",27, 1,120, "Generar Orden Trabajo", 55, "OK_NO"); +maia.put("grupo","SUPERV_INSP_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Generar Orden Trabajo",actualTask); + + + SequenceFlow_24 + SequenceFlow_15 + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + + + DataOutput_11 + DataOutput_12 + + + + maia + DataInput_1 + + + DataInput_2 + + Generar Orden Trabajo + DataInput_26 + + + + DataInput_3 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_4 + + + DataOutput_11 + maia + + + DataOutput_12 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + System.out.println(" Documento Habilitante "); + + + + + + SequenceFlow_22 + SequenceFlow_23 + + + + + + + + DataInput_90 + DataInput_91 + + + DataOutput_19 + DataOutput_20 + DataOutput_21 + + + + maia + DataInput_90 + + + taskMetaData + DataInput_91 + + + DataOutput_19 + taskMetaData + + + DataOutput_20 + maia + + + DataOutput_21 + actualTask + + + + + SequenceFlow_23 + _16-_12 + //FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + SequenceFlow_6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionIncrementoArmasV2.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionIncrementoArmasV2.bpmn.svn-base new file mode 100644 index 0000000..45185af --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionIncrementoArmasV2.bpmn.svn-base @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("..........................EJECUCION INCREMENTO DE ARMAS V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("actualTask",actualTask); +kcontext.setVariable("tasksMetaData",tasksMetaData); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar la Informacion Armas", 59, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar la Informacion Armas",actualTask); + + + SequenceFlow_2 + SequenceFlow_6 + + + + + + + + + + + + + + _DataInput_184 + _DataInput_185 + _DataInput_186 + _DataInput_187 + _DataInput_188 + _DataInput_189 + _DataInput_190 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_184 + + Validar la Informacion Armas + _DataInput_184 + + + + _DataInput_185 + + + _DataInput_186 + + + _DataInput_187 + + #{taskMetaData.groupId} + _DataInput_187 + + + + _DataInput_188 + + + _DataInput_189 + + + _DataInput_190 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_10 + SequenceFlow_11 + System.out.println(" Anula Incremento de Armas: "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + SequenceFlow_11 + SequenceFlow_12 + + + + SequenceFlow_6 + SequenceFlow_7 + SequenceFlow_10 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_8 + SequenceFlow_9 + \ + + + + + + + + + + SequenceFlow_7 + SequenceFlow_8 + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_4 + DataOutput_5 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_4 + maia + + + DataOutput_5 + taskMetaData + + + + + + SequenceFlow_9 + + + + SequenceFlow_12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionInternacionV2.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionInternacionV2.bpmn.svn-base new file mode 100644 index 0000000..bef9887 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionInternacionV2.bpmn.svn-base @@ -0,0 +1,321 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("..........................EJECUCION INTERNACION V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("actualTask",actualTask); +kcontext.setVariable("tasksMetaData",tasksMetaData); + + + + SequenceFlow_11 + SequenceFlow_12 + + + SequenceFlow_12 + + + + + SequenceFlow_4 + SequenceFlow_7 + SequenceFlow_10 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + + + + + + + SequenceFlow_7 + SequenceFlow_8 + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_4 + DataOutput_5 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_4 + maia + + + DataOutput_5 + taskMetaData + + + + + SequenceFlow_8 + SequenceFlow_9 + + + + SequenceFlow_10 + SequenceFlow_11 + System.out.println("***SE ANULO EL TRAMITE***"); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar Info Armas", 1, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar Info Armas",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + + + + + + _DataInput_184 + _DataInput_185 + _DataInput_186 + _DataInput_187 + _DataInput_188 + _DataInput_189 + _DataInput_190 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_184 + + Validar Info Armas + _DataInput_184 + + + + _DataInput_185 + + + _DataInput_186 + + + _DataInput_187 + + #{taskMetaData.groupId} + _DataInput_187 + + + + _DataInput_188 + + + _DataInput_189 + + + _DataInput_190 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_3 + SequenceFlow_4 + System.out.println("***SE ANULO EL TRAMITE***"); + + + + + SequenceFlow_9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionPermisoV2.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionPermisoV2.bpmn.svn-base new file mode 100644 index 0000000..c547eb8 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionPermisoV2.bpmn.svn-base @@ -0,0 +1,308 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_1 + System.out.println("..........................EJECUCION PERMISO V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData =new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",24, 1,120, "Receptar Armas", 45, "OK_NO"); +maia.put("grupo","TEC_ALM_CENTRO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Receptar Armas",actualTask); + + + SequenceFlow_1 + SequenceFlow_16 + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_1 + + + DataInput_2 + + Receptar Armas + DataInput_26 + + + + DataInput_3 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_4 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + _1-_15 + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",28, 1,120, "Ingresa Ficha Tecnica Arma", 46, "OK_NO"); +maia.put("grupo","ANALISTA_TIRO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ingresa Ficha Tecnica Arma",actualTask); + + + SequenceFlow_16 + SequenceFlow_17 + + + + + + + + + DataInput_6 + DataInput_7 + DataInput_8 + DataInput_9 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_6 + + + DataInput_7 + + Ingresa Ficha Tecnica Arma + DataInput_26 + + + + DataInput_8 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_9 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + SequenceFlow_12 + SequenceFlow_13 + //FlowUtil.endFlow(kcontext); + + + + + + + + + SequenceFlow_17 + SequenceFlow_12 + + + + + + + + DataInput_39 + DataInput_40 + + + DataOutput_14 + DataOutput_15 + DataOutput_16 + + + + maia + DataInput_39 + + + taskMetaData + DataInput_40 + + + DataOutput_14 + actualTask + + + DataOutput_15 + maia + + + DataOutput_16 + taskMetaData + + + + + SequenceFlow_13 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionTramiteV2.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionTramiteV2.bpmn.svn-base new file mode 100644 index 0000000..30c6c0b --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecucionTramiteV2.bpmn.svn-base @@ -0,0 +1,721 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_4 + System.out.println("..........................EJECUCION TRAMITE V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + _1-_15 + + + + + SequenceFlow_4 + SequenceFlow_5 + System.out.println("***Ingresa a la tarea evaluar tipo de documento***"); +FlowUtil.executeClass("com.fp.armas.task.TipoDocumento", maia); +// taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("tipodocumento")!=null)?""+maia.get("tipodocumento"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_5 + SequenceFlow_11 + SequenceFlow_13 + SequenceFlow_15 + SequenceFlow_17 + SequenceFlow_19 + SequenceFlow_21 + SequenceFlow_24 + SequenceFlow_26 + SequenceFlow_27 + SequenceFlow_29 + + + + + + + SequenceFlow_30 + SequenceFlow_9 + + + + + + + DataInput_15 + DataInput_16 + + + DataOutput_6 + DataOutput_7 + + + + maia + DataInput_15 + + + taskMetaData + DataInput_16 + + + DataOutput_6 + maia + + + DataOutput_7 + taskMetaData + + + + + return ("EA".equals(taskMetaData.getResponse())); + + + return ("EI".equals(taskMetaData.getResponse())); + + + return ("ET".equals(taskMetaData.getResponse())); + + + return ("EG".equals(taskMetaData.getResponse())); + + + SequenceFlow_9 + SequenceFlow_12 + SequenceFlow_14 + SequenceFlow_16 + SequenceFlow_18 + SequenceFlow_20 + SequenceFlow_22 + SequenceFlow_23 + SequenceFlow_25 + SequenceFlow_28 + SequenceFlow_10 + + + + SequenceFlow_10 + _16-_12 + //FlowUtil.endFlow(kcontext); + + + + return ("EC".equals(taskMetaData.getResponse())); + + + + + + + SequenceFlow_13 + SequenceFlow_14 + + + + + + + DataInput_19 + DataInput_20 + + + DataOutput_11 + DataOutput_12 + + + + maia + DataInput_19 + + + taskMetaData + DataInput_20 + + + DataOutput_11 + maia + + + DataOutput_12 + taskMetaData + + + + + + + + + SequenceFlow_11 + SequenceFlow_12 + + + + + + + DataInput_17 + DataInput_18 + + + DataOutput_9 + DataOutput_10 + + + + maia + DataInput_17 + + + taskMetaData + DataInput_18 + + + DataOutput_9 + maia + + + DataOutput_10 + taskMetaData + + + + + return ("ER".equals(taskMetaData.getResponse())); + + + return ("ED".equals(taskMetaData.getResponse())); + + + return ("ES".equals(taskMetaData.getResponse())); + + + return ("EN".equals(taskMetaData.getResponse())); + + + + + + + SequenceFlow_19 + SequenceFlow_20 + + + + + + + DataInput_25 + DataInput_27 + + + DataOutput_17 + DataOutput_18 + + + + maia + DataInput_25 + + + taskMetaData + DataInput_27 + + + DataOutput_17 + maia + + + DataOutput_18 + taskMetaData + + + + + + + + + SequenceFlow_26 + SequenceFlow_25 + + + + + + + DataInput_33 + DataInput_34 + + + DataOutput_23 + DataOutput_24 + + + + maia + DataInput_33 + + + taskMetaData + DataInput_34 + + + DataOutput_23 + maia + + + DataOutput_24 + taskMetaData + + + + + + + + + SequenceFlow_21 + SequenceFlow_22 + + + + + + + DataInput_28 + DataInput_30 + + + DataOutput_19 + DataOutput_20 + + + + maia + DataInput_28 + + + taskMetaData + DataInput_30 + + + DataOutput_19 + maia + + + DataOutput_20 + taskMetaData + + + + + + + + + SequenceFlow_15 + SequenceFlow_16 + + + + + + + DataInput_21 + DataInput_22 + + + DataOutput_13 + DataOutput_14 + + + + maia + DataInput_21 + + + taskMetaData + DataInput_22 + + + DataOutput_13 + maia + + + DataOutput_14 + taskMetaData + + + + + + + + + SequenceFlow_27 + SequenceFlow_28 + + + + + + + DataInput_35 + DataInput_36 + + + DataOutput_25 + DataOutput_26 + + + + maia + DataInput_35 + + + taskMetaData + DataInput_36 + + + DataOutput_25 + maia + + + DataOutput_26 + taskMetaData + + + + + + + + + SequenceFlow_24 + SequenceFlow_23 + + + + + + + DataInput_31 + DataInput_32 + + + DataOutput_21 + DataOutput_22 + + + + maia + DataInput_31 + + + taskMetaData + DataInput_32 + + + DataOutput_21 + maia + + + DataOutput_22 + taskMetaData + + + + + + + + + SequenceFlow_17 + SequenceFlow_18 + + + + + + + DataInput_23 + DataInput_24 + + + DataOutput_15 + DataOutput_16 + + + + maia + DataInput_23 + + + taskMetaData + DataInput_24 + + + DataOutput_15 + maia + + + DataOutput_16 + taskMetaData + + + + + SequenceFlow_29 + SequenceFlow_30 + System.out.println("***Ingresa a la tarea NOTIFICAR FECHA DE ENTRGA DE ARMAS***"); +//enviar mail de notificacion +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 39,40); + + + return ("EP".equals(taskMetaData.getResponse())); + + + + _16-_12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecutarCertificadosV2.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecutarCertificadosV2.bpmn.svn-base new file mode 100644 index 0000000..7cd34a0 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecutarCertificadosV2.bpmn.svn-base @@ -0,0 +1,277 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + SequenceFlow_12 + System.out.println("..........................EJECUCION CERTIFICADO V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + SequenceFlow_10 + + + + SequenceFlow_9 + SequenceFlow_10 + System.out.println("TramiteAnulado"); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ejecutar Certificados",actualTask); + + + SequenceFlow_8 + SequenceFlow_5 + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_3 + DataOutput_4 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_3 + maia + + + DataOutput_4 + taskMetaData + + + + + SequenceFlow_13 + SequenceFlow_8 + SequenceFlow_9 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_5 + SequenceFlow_6 + + + + SequenceFlow_1 + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Valida Informacion Certificado", 58, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Valida Informacion Certificado",actualTask); + + + SequenceFlow_12 + SequenceFlow_13 + + + + + + + + + DataInput_5 + DataInput_6 + DataInput_7 + DataInput_8 + + + DataOutput_5 + DataOutput_6 + + + + maia + DataInput_5 + + + DataInput_6 + + Valida Informacion Certificado + DataInput_26 + + + + DataInput_7 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_8 + + + DataOutput_5 + maia + + + DataOutput_6 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecutarInscripcionV2.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecutarInscripcionV2.bpmn.svn-base new file mode 100644 index 0000000..ce3905b --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EjecutarInscripcionV2.bpmn.svn-base @@ -0,0 +1,314 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("..........................EJECUCION INSCRIPCION V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Valida Info Inscripcion", 1, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Valida Info Inscripcion",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + + + + + + _DataInput_149 + _DataInput_150 + _DataInput_151 + _DataInput_152 + _DataInput_153 + _DataInput_154 + _DataInput_155 + DataInput_2 + DataInput_3 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_149 + + Valida Info Inscripcion + _DataInput_149 + + + + _DataInput_150 + + + _DataInput_151 + + + _DataInput_152 + + #{taskMetaData.groupId} + _DataInput_152 + + + + _DataInput_153 + + + _DataInput_154 + + + _DataInput_155 + + + maia + DataInput_2 + + + taskMetaData + DataInput_3 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ejecutar Certificados",actualTask); + + + SequenceFlow_4 + SequenceFlow_5 + + + + + + + DataInput_4 + DataInput_5 + + + DataOutput_3 + DataOutput_4 + + + + maia + DataInput_4 + + + taskMetaData + DataInput_5 + + + DataOutput_3 + maia + + + DataOutput_4 + taskMetaData + + + + SequenceFlow_5 + SequenceFlow_6 + //FlowUtil.endFlow(kcontext); + + + + + SequenceFlow_7 + SequenceFlow_9 + System.out.println("***SE ANULO EL TRAMITE***"); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + SequenceFlow_9 + SequenceFlow_10 + //FlowUtil.endFlow(kcontext); + + + + SequenceFlow_10 + + + + + SequenceFlow_3 + SequenceFlow_4 + SequenceFlow_7 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EmisionDocumentoHabilitanteV2.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EmisionDocumentoHabilitanteV2.bpmn.svn-base new file mode 100644 index 0000000..93d09eb --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/EmisionDocumentoHabilitanteV2.bpmn.svn-base @@ -0,0 +1,892 @@ + + + + + + + + + + + + + + + + + + + + + + + + System.out.println("..........................NO REQUIERE TARJETA EDH V2......................."); +taskMetaData=FlowUtil.createTaskInfo("30",102, 1,120, "Generar Reporte", 35, "OK_NO"); +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Generar Reporte",actualTask); + + + SequenceFlow_17 + SequenceFlow_20 + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_1 + + + DataInput_2 + + Generar Reporte + DataInput_26 + + + + DataInput_3 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_4 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_25 + SequenceFlow_26 + SequenceFlow_5 + + + + + taskMetaData=FlowUtil.createTaskInfo("30",101, 1,120, "Firmar Tramite Supervisor", 38, "OK_NO"); +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar Tramite Supervisor",actualTask); + + + SequenceFlow_20 + SequenceFlow_25 + + + + + + + + + + + + + + DataInput_21 + DataInput_22 + DataInput_23 + DataInput_24 + DataInput_25 + DataInput_27 + DataInput_28 + DataInput_30 + DataInput_31 + + + DataOutput_6 + DataOutput_7 + + + + DataInput_21 + + Firmar Tramite Supervisor + _DataInput_16 + + + + DataInput_22 + + + DataInput_23 + + + DataInput_24 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_25 + + + DataInput_27 + + + DataInput_28 + + + maia + DataInput_30 + + + taskMetaData + DataInput_31 + + + DataOutput_6 + maia + + + DataOutput_7 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_6 + SequenceFlow_1 + SequenceFlow_28 + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_28 + SequenceFlow_29 + FlowUtil.executeClass("com.fp.armas.task.FechaCaducidadEstadoArma", maia); +FlowUtil.executeClass("com.fp.armas.task.TramiteAprobado", maia); +FlowUtil.executeClass("com.fp.armas.task.TipoArchivoControl", maia); +FlowUtil.executeClass("com.fp.armas.task.FinalizarDocumentoHabilitante", maia); +taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.getAditionalData().put("datosmail", maia.get("datosmail")); +taskMetaData.setResponse((maia.get("tipoarchivo")!=null)?""+maia.get("tipoarchivo"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + return ("A".equals(taskMetaData.getResponse())); + + + + SequenceFlow_29 + SequenceFlow_30 + SequenceFlow_35 + + + + + taskMetaData=FlowUtil.createTaskInfo("30",109, 1,120, "Firmar Tramite Coordinador", 38, "OK_NO"); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar Tramite Coordinador",actualTask); + + + SequenceFlow_30 + SequenceFlow_31 + + + + + + + + + + + + + + DataInput_5 + DataInput_6 + DataInput_7 + DataInput_8 + DataInput_9 + DataInput_10 + DataInput_12 + DataInput_13 + DataInput_14 + + + DataOutput_13 + DataOutput_14 + + + + DataInput_5 + + Firmar Tramite Coordinador + _DataInput_16 + + + + DataInput_6 + + + DataInput_7 + + + DataInput_8 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_9 + + + DataInput_10 + + + DataInput_12 + + + maia + DataInput_13 + + + taskMetaData + DataInput_14 + + + DataOutput_13 + maia + + + DataOutput_14 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("D".equals(taskMetaData.getResponse())); + + + + SequenceFlow_31 + SequenceFlow_32 + System.out.println("..........................VALIDAR CUSTODIO......................."); +FlowUtil.executeClass("com.fp.armas.task.ValidarCustodios", maia); +taskMetaData.getAditionalData().put("datosmail", maia.get("datosmail")); +taskMetaData.setResponse((maia.get("BPMStatus")!=null)?""+maia.get("BPMStatus"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_22 + + + + SequenceFlow_7 + SequenceFlow_22 + //FlowUtil.endFlow(kcontext); + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_32 + SequenceFlow_33 + SequenceFlow_34 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_23 + + + + SequenceFlow_15 + SequenceFlow_16 + FlowUtil.executeClass("com.fp.armas.task.TipoArchivoControl", maia); +taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.getAditionalData().put("datosmail", maia.get("datosmail")); +taskMetaData.setResponse((maia.get("tipoarchivo")!=null)?""+maia.get("tipoarchivo"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + _1-_15 + + + + SequenceFlow_9 + SequenceFlow_14 + SequenceFlow_15 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_16 + SequenceFlow_17 + SequenceFlow_26 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_33 + SequenceFlow_7 + System.out.println("................NOTIFICACION ENVIA MAIL ADJUNTO........."); +//enviar mail de notificacion + + + + + SequenceFlow_35 + SequenceFlow_34 + SequenceFlow_36 + + + + SequenceFlow_36 + SequenceFlow_3 + System.out.println("................NOTIFICACION PRESENTARSE AL CENTRO DE CONTROL........."); +//enviar mail de notificacion +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 4 ,5); + + + + SequenceFlow_3 + _16-_12 + //FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + _1-_15 + SequenceFlow_8 + System.out.println("..........................EMISION DOCUMENTO HABILITANTE V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + SequenceFlow_14 + SequenceFlow_23 + System.out.println("............................................................................................ NO:"); +System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones","Tramite Anulado en Revisar Tramite"+datosmail.get("observaciones")); +}else{ +maia.put("observaciones","Tramite Anulado en Revisar Tramite"); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + SequenceFlow_13 + + + + SequenceFlow_1 + SequenceFlow_13 + System.out.println("ingresa a enviar el mail"); +//enviar mail de rechazo +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",30, 1,120, "Autorizar Tramite Coordinador", 31, "OK_NO"); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + System.out.println("............................................................................................ 1:"); +taskMetaData.updateData(maia); +System.out.println("............................................................................................ 2:"); +actualTask=new java.util.ArrayList(); +System.out.println("............................................................................................ 3:"); +kcontext.setVariable("actualTask",actualTask); +System.out.println("............................................................................................ 4:"); +actualTask.add(taskMetaData); +System.out.println("............................................................................................ 5:"); +tasksMetaData.put("Revisar Tramite",actualTask); +System.out.println("............................................................................................ 6:"); + + + SequenceFlow_5 + SequenceFlow_6 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Revisar Tramite + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + System.out.println("..........................REVISAR TRAMITE EDH V2......................."); +taskMetaData=FlowUtil.createTaskInfo("30",33, 1,120, "Revisar Tramite Supervisor", 30, "OK_NO"); +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Autorizar Tramite",actualTask); + + + SequenceFlow_8 + SequenceFlow_9 + + + + + + + + + DataInput_200 + DataInput_201 + DataInput_202 + DataInput_203 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_200 + + + DataInput_201 + + Autorizar Tramite + DataInput_26 + + + + DataInput_202 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_203 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/RecepcionArmasV2.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/RecepcionArmasV2.bpmn.svn-base new file mode 100644 index 0000000..80ee14f --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/RecepcionArmasV2.bpmn.svn-base @@ -0,0 +1,371 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_8 + System.out.println("**************INICIA FLUJO RECEPCIÓN V2***************"); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_5 + SequenceFlow_9 + System.out.println("ingresa a Actualizar Inventario"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarInventario", maia); +FlowUtil.executeClass("com.fp.armas.task.AplicarSancion", maia); +taskMetaData.setResponse((maia.get("BPMStatus")!=null)?""+maia.get("BPMStatus"):null); +kcontext.setVariable("taskMetaData",taskMetaData); +System.out.println("-- Actualizar Inventario"); + + + + + taskMetaData=FlowUtil.createTaskInfo("30",94, 1,120, "Legalizar Acta", 29, "OK_NO"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarRutaArchivo", maia); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupoDecRecep", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Legalizar Acta",actualTask); + + + SequenceFlow_8 + SequenceFlow_5 + + + + + + + + + + + + + + _DataInput_30 + _DataInput_31 + _DataInput_32 + _DataInput_33 + _DataInput_34 + _DataInput_35 + _DataInput_36 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_30 + + Legalizar Acta + _DataInput_30 + + + + _DataInput_31 + + + _DataInput_32 + + + _DataInput_33 + + #{taskMetaData.groupId} + _DataInput_33 + + + + _DataInput_34 + + + _DataInput_35 + + + _DataInput_36 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + SequenceFlow_9 + SequenceFlow_10 + SequenceFlow_14 + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + SequenceFlow_2 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",60, 1,120, "Definir Sancion", 44, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Definir Sancion",actualTask); + + + SequenceFlow_14 + SequenceFlow_15 + + + + + + + + + + + + + + _DataInput_58 + _DataInput_59 + _DataInput_60 + _DataInput_61 + _DataInput_62 + _DataInput_63 + _DataInput_64 + DataInput_6 + DataInput_7 + + + DataOutput_6 + DataOutput_7 + + + + _DataInput_58 + + Definir Sancion + _DataInput_58 + + + + _DataInput_59 + + + _DataInput_60 + + + _DataInput_61 + + #{taskMetaData.groupId} + _DataInput_61 + + + + _DataInput_62 + + + _DataInput_63 + + + _DataInput_64 + + + maia + DataInput_6 + + + taskMetaData + DataInput_7 + + + DataOutput_6 + maia + + + DataOutput_7 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("A".equals(taskMetaData.getResponse())); + + + + SequenceFlow_15 + SequenceFlow_13 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_13 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/RecepcionSolicitudRequisitosV2.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/RecepcionSolicitudRequisitosV2.bpmn.svn-base new file mode 100644 index 0000000..25df9d5 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/RecepcionSolicitudRequisitosV2.bpmn.svn-base @@ -0,0 +1,361 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + SequenceFlow_18 + + + + SequenceFlow_25 + SequenceFlow_18 + FlowUtil.endFlow(kcontext); + + + + _1-_15 + SequenceFlow_2 + System.out.println("..........................FLUJO SOLICITUD V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_23 + SequenceFlow_10 + System.out.println("***Ingresa a la tarea generar valor a cancelar***"); +FlowUtil.executeClass("com.fp.armas.task.GenerarValorACancelar", maia); +//taskMetaData.getAditionalData().get("datosmail"); +//taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("BPMStatus")!=null)?""+maia.get("BPMStatus"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_19 + SequenceFlow_3 + System.out.println("Ingresa a tarea de enviar el mail de aceptacion de requisitos"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 10 , 11); + + + + + + + SequenceFlow_24 + SequenceFlow_25 + + + + + + + DataInput_40 + DataInput_41 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_40 + + + taskMetaData + DataInput_41 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + + + SequenceFlow_3 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",25, 1,120, "Revisar solicitud y documentos requeridos", 1, "OK_NO"); +//para asignar a un grupo especifico +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +kcontext.setVariable("taskMetaData",taskMetaData); +actualTask.add(taskMetaData); +tasksMetaData.put("Revisar solicitud y documentos requeridos",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Revisar solicitud y documentos requeridos + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_1 + SequenceFlow_7 + SequenceFlow_23 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + SequenceFlow_19 + SequenceFlow_24 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_5 + + + + SequenceFlow_7 + SequenceFlow_4 + //enviar mail al usuario indicando razones del rechazo +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 52 , 53); + + + + SequenceFlow_4 + SequenceFlow_5 + FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/TraspasoDominioV2.bpmn.svn-base b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/TraspasoDominioV2.bpmn.svn-base new file mode 100644 index 0000000..07aa941 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/.svn/text-base/TraspasoDominioV2.bpmn.svn-base @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + _1-_15 + SequenceFlow_1 + System.out.println("..........................TRASPASO DOMINIO V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",217, 1,120, "Validar transaccion de venta", 68, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","COORD_MILITAR_"); +System.out.println(maia.get("grupo")); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar armas venta",actualTask); + + + SequenceFlow_1 + SequenceFlow_5 + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + + + + _DataInput_16 + + Validar armas de venta + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + + #{taskMetaData.userId} + + + + + SequenceFlow_7 + SequenceFlow_2 + SequenceFlow_4 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_2 + _16-_12 + FlowUtil.executeClass("com.fp.armas.task.traspasodominio.TraspasoDominioAnula", maia); + +System.out.println("Ingresa a tarea de enviar el mail"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.PersonaDireccionVentaTemp", maia, taskMetaData, 69 , 70); + +FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + SequenceFlow_6 + + + + SequenceFlow_4 + SequenceFlow_6 + FlowUtil.executeClass("com.fp.armas.task.traspasodominio.TraspasoDominio", maia); + +System.out.println("Ingresa a tarea de enviar el mail--"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.PersonaDireccionVentaTemp", maia, taskMetaData, 69 , 70); + +FlowUtil.endFlow(kcontext); + + + + + SequenceFlow_5 + SequenceFlow_7 + System.out.println("*************"); +System.out.println(taskMetaData.getResponse()); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/CargaDepositoV2.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comacov2/CargaDepositoV2.bpmn new file mode 100644 index 0000000..aaedd28 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/CargaDepositoV2.bpmn @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_11 + + + + SequenceFlow_10 + SequenceFlow_11 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_9 + SequenceFlow_10 + System.out.println("Ingresa a tarea de enviar el mail de Notificar inconsistencia deposito"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 17 , 18); + + + + _1-_15 + SequenceFlow_1 + System.out.println("..........................CARGA DEPOSITO V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",42, 1,120, "Validar transaccion de deposito", 24, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidaFlujoCargaDeposito", maia); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar transaccion de deposito",actualTask); + + + SequenceFlow_1 + SequenceFlow_6 + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + + + + _DataInput_16 + + Validar transaccion de deposito + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + _1-_15 + + + + + + //taskMetaData=FlowUtil.createTaskInfoByClassName("30",24, 1,30,"com.fp.viaticos.task.AsignarEmpleado", "Modificar empleado", 11, "OK_NO"); +//kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_2 + SequenceFlow_15 + + + + + + + DataInput_18 + DataInput_19 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_18 + + + taskMetaData + DataInput_19 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + + _16-_12 + + + + SequenceFlow_15 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_6 + SequenceFlow_9 + SequenceFlow_2 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionAperturaV2.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionAperturaV2.bpmn new file mode 100644 index 0000000..477cfd4 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionAperturaV2.bpmn @@ -0,0 +1,312 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("..........................EJECUCION APERTURA AGENCIA V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar Info Agencias", 1, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar Info Agencias",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + + + + + + _DataInput_191 + _DataInput_192 + _DataInput_193 + _DataInput_194 + _DataInput_195 + _DataInput_196 + _DataInput_197 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_191 + + Validar Info Agencias + _DataInput_191 + + + + _DataInput_192 + + + _DataInput_193 + + + _DataInput_194 + + #{taskMetaData.groupId} + _DataInput_194 + + + + _DataInput_195 + + + _DataInput_196 + + + _DataInput_197 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + SequenceFlow_5 + SequenceFlow_6 + //FlowUtil.endFlow(kcontext); + + + SequenceFlow_6 + + + + + SequenceFlow_8 + SequenceFlow_9 + //FlowUtil.endFlow(kcontext); + + + SequenceFlow_9 + + + + + + + + + + + SequenceFlow_7 + SequenceFlow_8 + + + + + + + DataInput_5 + DataInput_6 + + + DataOutput_5 + DataOutput_6 + + + + maia + DataInput_5 + + + taskMetaData + DataInput_6 + + + DataOutput_5 + maia + + + DataOutput_6 + taskMetaData + + + + + SequenceFlow_4 + SequenceFlow_5 + System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + SequenceFlow_3 + SequenceFlow_4 + SequenceFlow_7 + + + System.out.println("Camino D"); +return ("D".equals(taskMetaData.getResponse())); + + + System.out.println("Camino A"); +return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionAutorizacionV2.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionAutorizacionV2.bpmn new file mode 100644 index 0000000..19dce39 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionAutorizacionV2.bpmn @@ -0,0 +1,632 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + _1-_15 + SequenceFlow_1 + System.out.println("..........................EJECUCION AUTORIZACION V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar tipo de Autorizacion", 1, "OK_NO"); +maia.put("grupo","SUPERV_INSP_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar tipo de Autorizacion",actualTask); + + + SequenceFlow_1 + SequenceFlow_12 + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + DataInput_5 + DataInput_6 + DataInput_12 + DataInput_7 + DataInput_8 + + + DataOutput_6 + DataOutput_7 + + + + DataInput_1 + + Validar tipo de Autorizacion + _DataInput_149 + + + + DataInput_2 + + + DataInput_3 + + + DataInput_4 + + #{taskMetaData.groupId} + _DataInput_152 + + + + DataInput_5 + + + DataInput_6 + + + DataInput_12 + + + maia + DataInput_7 + + + taskMetaData + DataInput_8 + + + DataOutput_6 + maia + + + DataOutput_7 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_16 + + + + SequenceFlow_12 + SequenceFlow_15 + SequenceFlow_7 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + Requiere Inspeccion + SequenceFlow_7 + SequenceFlow_13 + System.out.println("............................................................................................Autorizacion Previa de Importacion"); +FlowUtil.executeClass("com.fp.armas.task.ValAutorizacionPreviaImporta", maia); +if(taskMetaData ==null){ + taskMetaData = new com.fp.simple.dto.TaskInfo(); +} +taskMetaData.setResponse((maia.get("previaimportacion")!=null)?""+maia.get("previaimportacion"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_13 + SequenceFlow_19 + SequenceFlow_20 + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar tipo de Autorizacion VUE", 1, "OK_NO"); +taskMetaData.setGroupId("ANALISTA_VUE"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar tipo de Autorizacion VUE",actualTask); + + + SequenceFlow_19 + SequenceFlow_21 + + + + + + + + + + + + + + DataInput_14 + DataInput_15 + DataInput_16 + DataInput_17 + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_21 + DataInput_22 + + + DataOutput_1 + DataOutput_2 + + + + DataInput_14 + + Validar tipo de Autorizacion VUE + _DataInput_149 + + + + DataInput_15 + + + DataInput_16 + + + DataInput_17 + + #{taskMetaData.groupId} + _DataInput_152 + + + + DataInput_18 + + + DataInput_19 + + + DataInput_20 + + + maia + DataInput_21 + + + taskMetaData + DataInput_22 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_17 + SequenceFlow_2 + SequenceFlow_3 + + + return ("N".equals(taskMetaData.getResponse())); + + + return ("Y".equals(taskMetaData.getResponse())); + + + SequenceFlow_8 + _16-_12 + + + + Requiere Inspeccion + SequenceFlow_22 + SequenceFlow_17 + System.out.println(".............................................................................................Requiere Inspeccion :"); +FlowUtil.executeClass("com.fp.armas.task.RequiereInspeccion", maia); +if(taskMetaData ==null){ + taskMetaData = new com.fp.simple.dto.TaskInfo(); +} +taskMetaData.setResponse((maia.get("inspeccion")!=null)?""+maia.get("inspeccion"):null); +System.out.println(".............................................................................................Requiere Inspeccion :"+taskMetaData.getResponse()); +kcontext.setVariable("taskMetaData",taskMetaData); +System.out.println(".............................................................................................Requiere Inspeccion :"+taskMetaData.getResponse()); + + + + SequenceFlow_2 + SequenceFlow_9 + SequenceFlow_5 + + + + _16-_12 + + + + + + System.out.println("............................................................................................ Inspeccion :"); + + + System.out.println("............................................................................................ Inspeccion OK"); +FlowUtil.executeClass("com.fp.armas.task.ValidaInspeccion", maia); +if(taskMetaData ==null){ + taskMetaData = new com.fp.simple.dto.TaskInfo(); +} +taskMetaData.setResponse((maia.get("tramiteproceso")!=null)?""+maia.get("tramiteproceso"):null); +kcontext.setVariable("taskMetaData",taskMetaData); +System.out.println("..........................................................................................regreso... :"+taskMetaData.getResponse()); + + + SequenceFlow_3 + SequenceFlow_4 + + + + + + + DataInput_11 + DataInput_13 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + taskMetaData + DataInput_13 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + + SequenceFlow_11 + + + + + + + SequenceFlow_5 + SequenceFlow_8 + + + + + + + DataInput_9 + DataInput_10 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_9 + + + taskMetaData + DataInput_10 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + + SequenceFlow_10 + SequenceFlow_11 + + + + return ("D".equals(taskMetaData.getResponse())); + + + + SequenceFlow_20 + SequenceFlow_21 + SequenceFlow_22 + + + + SequenceFlow_4 + SequenceFlow_9 + SequenceFlow_10 + + + return ("Y".equals(taskMetaData.getResponse())); + + + return ("N".equals(taskMetaData.getResponse())); + + + SequenceFlow_15 + SequenceFlow_16 + System.out.println("............................................................................................ RECHAZA VALIDAR TIPO SOLICITUD:"); +System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones","Tramite Anulado en Validar Tipo De Autorizacion"+datosmail.get("observaciones")); +}else{ +maia.put("observaciones","Tramite Anulado en Validar Tipo De Autorizacion"); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionCertificadoFiscalia.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionCertificadoFiscalia.bpmn new file mode 100644 index 0000000..1d33f14 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionCertificadoFiscalia.bpmn @@ -0,0 +1,292 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + System.out.println("..........................EJECUCION CERTIFICADO DE FISCALIA......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",153, 1,120, "Generar certificado fiscalia", 65, "OK_NO"); +maia.put("grupo","TEC_ALM_CENTRO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData=FlowUtil.createTaskInfo("30",153, 1,120, "Generar certificado fiscalia", 65, "OK_NO"); +//para asignar a un grupo especifico +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + SequenceFlow_2 + SequenceFlow_5 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Generar certificado fiscalia + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + _1-_15 + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",118, 1,120, "Firmar certificado fiscalia", 66, "OK_NO"); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar certificado fiscalia",actualTask); + + + SequenceFlow_5 + SequenceFlow_4 + + + + + + + + + + + + + + DataInput_17 + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_21 + DataInput_22 + DataInput_23 + DataInput_24 + DataInput_25 + + + DataOutput_3 + DataOutput_5 + + + + DataInput_17 + + Firmar certificado fiscalia + _DataInput_16 + + + + DataInput_18 + + + DataInput_19 + + + DataInput_20 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_21 + + + DataInput_22 + + + DataInput_23 + + + maia + DataInput_24 + + + taskMetaData + DataInput_25 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_4 + SequenceFlow_6 + System.out.println("..........................NOTIFICAR ENTREGA CERTIFICADO FISCALIA......................."); + + + + SequenceFlow_6 + SequenceFlow_1 + System.out.println("..........................FINALIZA CERTIFICADO DE FISCALIA......................."); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionDevolucionV2.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionDevolucionV2.bpmn new file mode 100644 index 0000000..e7fb61d --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionDevolucionV2.bpmn @@ -0,0 +1,412 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_10 + System.out.println("..........................EJECUCION DEVOLUCION V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + _1-_15 + + + + SequenceFlow_11 + SequenceFlow_5 + SequenceFlow_7 + + + + + taskMetaData=FlowUtil.createTaskInfo("30",32, 1,120, "Autorizar Devolucion",37, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +System.out.println("1..................."); +actualTask=new java.util.ArrayList(); +System.out.println("2..................."); +kcontext.setVariable("actualTask",actualTask); +System.out.println("3..................."); +actualTask.add(taskMetaData); +System.out.println("4..................."); +System.out.println("5..................."); +tasksMetaData.put("Autorizar Devolucion",actualTask); +System.out.println("6..................."); + + + SequenceFlow_5 + SequenceFlow_1 + + + + + + + + + + + + + + DataInput_13 + DataInput_14 + DataInput_15 + DataInput_16 + DataInput_17 + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_21 + + + DataOutput_1 + DataOutput_2 + + + + DataInput_13 + + Autorizar Devolucion + _DataInput_16 + + + + DataInput_14 + + + DataInput_15 + + + DataInput_16 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_17 + + + DataInput_18 + + + DataInput_19 + + + maia + DataInput_20 + + + taskMetaData + DataInput_21 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_7 + _16-_12 + System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + _16-_12 + + + + return ("D".equals(taskMetaData.getResponse())); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",29, 1,120, "Informacion Devolucion", 36, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","TEC_ALM_CENTRO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Informacion Devolucion",actualTask); + + + + SequenceFlow_10 + SequenceFlow_11 + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + DataInput_5 + DataInput_6 + DataInput_7 + DataInput_8 + DataInput_9 + + + DataOutput_3 + DataOutput_5 + + + + DataInput_1 + + Informacion Devolucion + _DataInput_16 + + + + DataInput_2 + + + DataInput_3 + + + DataInput_4 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_5 + + + DataInput_6 + + + DataInput_7 + + + maia + DataInput_8 + + + taskMetaData + DataInput_9 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_2 + SequenceFlow_6 + System.out.println("fin"); +//FlowUtil.endFlow(kcontext); +System.out.println("fin1"); + + + + SequenceFlow_6 + + + + + + + SequenceFlow_1 + SequenceFlow_2 + + + + + + + DataInput_10 + DataInput_11 + + + DataOutput_4 + DataOutput_6 + + + + maia + DataInput_10 + + + taskMetaData + DataInput_11 + + + DataOutput_4 + maia + + + DataOutput_6 + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionEmisionGuiaTransitoV2.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionEmisionGuiaTransitoV2.bpmn new file mode 100644 index 0000000..f0b4a8c --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionEmisionGuiaTransitoV2.bpmn @@ -0,0 +1,423 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + _1-_15 + SequenceFlow_2 + System.out.println("..........................EMISION GUIA LIBRE TRANSITO V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_1 + SequenceFlow_5 + SequenceFlow_13 + + + return ("D".equals(taskMetaData.getResponse())); + + + + + taskMetaData=FlowUtil.createTaskInfo("30",23, 1,120, "Validacion Inconsistencias Informacion Solicitud", 56, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validacion Inconsistencias Informacion Solicitud",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Validacion Inconsistencias Informacion Solicitud + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_5 + SequenceFlow_6 + System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,61); + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_13 + SequenceFlow_16 + System.out.println(" Verifica cantidad armamento "); +FlowUtil.executeClass("com.fp.armas.task.VerificarCantidadArmas", maia); +taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("requierecustodia")!=null)?""+maia.get("requierecustodia"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + SequenceFlow_16 + SequenceFlow_20 + SequenceFlow_24 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_20 + SequenceFlow_15 + SequenceFlow_22 + + + + + + System.out.println(" Genera Orden trabajo "); +taskMetaData=FlowUtil.createTaskInfo("30",27, 1,120, "Generar Orden Trabajo", 55, "OK_NO"); +maia.put("grupo","SUPERV_INSP_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Generar Orden Trabajo",actualTask); + + + SequenceFlow_24 + SequenceFlow_15 + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + + + DataOutput_11 + DataOutput_12 + + + + maia + DataInput_1 + + + DataInput_2 + + Generar Orden Trabajo + DataInput_26 + + + + DataInput_3 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_4 + + + DataOutput_11 + maia + + + DataOutput_12 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + System.out.println(" Documento Habilitante "); + + + + + + SequenceFlow_22 + SequenceFlow_23 + + + + + + + + DataInput_90 + DataInput_91 + + + DataOutput_19 + DataOutput_20 + DataOutput_21 + + + + maia + DataInput_90 + + + taskMetaData + DataInput_91 + + + DataOutput_19 + taskMetaData + + + DataOutput_20 + maia + + + DataOutput_21 + actualTask + + + + + SequenceFlow_23 + _16-_12 + //FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + SequenceFlow_6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionIncrementoArmasV2.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionIncrementoArmasV2.bpmn new file mode 100644 index 0000000..45185af --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionIncrementoArmasV2.bpmn @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("..........................EJECUCION INCREMENTO DE ARMAS V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("actualTask",actualTask); +kcontext.setVariable("tasksMetaData",tasksMetaData); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar la Informacion Armas", 59, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar la Informacion Armas",actualTask); + + + SequenceFlow_2 + SequenceFlow_6 + + + + + + + + + + + + + + _DataInput_184 + _DataInput_185 + _DataInput_186 + _DataInput_187 + _DataInput_188 + _DataInput_189 + _DataInput_190 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_184 + + Validar la Informacion Armas + _DataInput_184 + + + + _DataInput_185 + + + _DataInput_186 + + + _DataInput_187 + + #{taskMetaData.groupId} + _DataInput_187 + + + + _DataInput_188 + + + _DataInput_189 + + + _DataInput_190 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_10 + SequenceFlow_11 + System.out.println(" Anula Incremento de Armas: "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + SequenceFlow_11 + SequenceFlow_12 + + + + SequenceFlow_6 + SequenceFlow_7 + SequenceFlow_10 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_8 + SequenceFlow_9 + \ + + + + + + + + + + SequenceFlow_7 + SequenceFlow_8 + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_4 + DataOutput_5 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_4 + maia + + + DataOutput_5 + taskMetaData + + + + + + SequenceFlow_9 + + + + SequenceFlow_12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionInternacionV2.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionInternacionV2.bpmn new file mode 100644 index 0000000..bef9887 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionInternacionV2.bpmn @@ -0,0 +1,321 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("..........................EJECUCION INTERNACION V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("actualTask",actualTask); +kcontext.setVariable("tasksMetaData",tasksMetaData); + + + + SequenceFlow_11 + SequenceFlow_12 + + + SequenceFlow_12 + + + + + SequenceFlow_4 + SequenceFlow_7 + SequenceFlow_10 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + + + + + + + SequenceFlow_7 + SequenceFlow_8 + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_4 + DataOutput_5 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_4 + maia + + + DataOutput_5 + taskMetaData + + + + + SequenceFlow_8 + SequenceFlow_9 + + + + SequenceFlow_10 + SequenceFlow_11 + System.out.println("***SE ANULO EL TRAMITE***"); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar Info Armas", 1, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar Info Armas",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + + + + + + _DataInput_184 + _DataInput_185 + _DataInput_186 + _DataInput_187 + _DataInput_188 + _DataInput_189 + _DataInput_190 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_184 + + Validar Info Armas + _DataInput_184 + + + + _DataInput_185 + + + _DataInput_186 + + + _DataInput_187 + + #{taskMetaData.groupId} + _DataInput_187 + + + + _DataInput_188 + + + _DataInput_189 + + + _DataInput_190 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_3 + SequenceFlow_4 + System.out.println("***SE ANULO EL TRAMITE***"); + + + + + SequenceFlow_9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionPermisoV2.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionPermisoV2.bpmn new file mode 100644 index 0000000..c547eb8 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionPermisoV2.bpmn @@ -0,0 +1,308 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_1 + System.out.println("..........................EJECUCION PERMISO V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData =new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",24, 1,120, "Receptar Armas", 45, "OK_NO"); +maia.put("grupo","TEC_ALM_CENTRO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Receptar Armas",actualTask); + + + SequenceFlow_1 + SequenceFlow_16 + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_1 + + + DataInput_2 + + Receptar Armas + DataInput_26 + + + + DataInput_3 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_4 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + _1-_15 + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",28, 1,120, "Ingresa Ficha Tecnica Arma", 46, "OK_NO"); +maia.put("grupo","ANALISTA_TIRO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ingresa Ficha Tecnica Arma",actualTask); + + + SequenceFlow_16 + SequenceFlow_17 + + + + + + + + + DataInput_6 + DataInput_7 + DataInput_8 + DataInput_9 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_6 + + + DataInput_7 + + Ingresa Ficha Tecnica Arma + DataInput_26 + + + + DataInput_8 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_9 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + SequenceFlow_12 + SequenceFlow_13 + //FlowUtil.endFlow(kcontext); + + + + + + + + + SequenceFlow_17 + SequenceFlow_12 + + + + + + + + DataInput_39 + DataInput_40 + + + DataOutput_14 + DataOutput_15 + DataOutput_16 + + + + maia + DataInput_39 + + + taskMetaData + DataInput_40 + + + DataOutput_14 + actualTask + + + DataOutput_15 + maia + + + DataOutput_16 + taskMetaData + + + + + SequenceFlow_13 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionTramiteV2.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionTramiteV2.bpmn new file mode 100644 index 0000000..30c6c0b --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecucionTramiteV2.bpmn @@ -0,0 +1,721 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_4 + System.out.println("..........................EJECUCION TRAMITE V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + _1-_15 + + + + + SequenceFlow_4 + SequenceFlow_5 + System.out.println("***Ingresa a la tarea evaluar tipo de documento***"); +FlowUtil.executeClass("com.fp.armas.task.TipoDocumento", maia); +// taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("tipodocumento")!=null)?""+maia.get("tipodocumento"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_5 + SequenceFlow_11 + SequenceFlow_13 + SequenceFlow_15 + SequenceFlow_17 + SequenceFlow_19 + SequenceFlow_21 + SequenceFlow_24 + SequenceFlow_26 + SequenceFlow_27 + SequenceFlow_29 + + + + + + + SequenceFlow_30 + SequenceFlow_9 + + + + + + + DataInput_15 + DataInput_16 + + + DataOutput_6 + DataOutput_7 + + + + maia + DataInput_15 + + + taskMetaData + DataInput_16 + + + DataOutput_6 + maia + + + DataOutput_7 + taskMetaData + + + + + return ("EA".equals(taskMetaData.getResponse())); + + + return ("EI".equals(taskMetaData.getResponse())); + + + return ("ET".equals(taskMetaData.getResponse())); + + + return ("EG".equals(taskMetaData.getResponse())); + + + SequenceFlow_9 + SequenceFlow_12 + SequenceFlow_14 + SequenceFlow_16 + SequenceFlow_18 + SequenceFlow_20 + SequenceFlow_22 + SequenceFlow_23 + SequenceFlow_25 + SequenceFlow_28 + SequenceFlow_10 + + + + SequenceFlow_10 + _16-_12 + //FlowUtil.endFlow(kcontext); + + + + return ("EC".equals(taskMetaData.getResponse())); + + + + + + + SequenceFlow_13 + SequenceFlow_14 + + + + + + + DataInput_19 + DataInput_20 + + + DataOutput_11 + DataOutput_12 + + + + maia + DataInput_19 + + + taskMetaData + DataInput_20 + + + DataOutput_11 + maia + + + DataOutput_12 + taskMetaData + + + + + + + + + SequenceFlow_11 + SequenceFlow_12 + + + + + + + DataInput_17 + DataInput_18 + + + DataOutput_9 + DataOutput_10 + + + + maia + DataInput_17 + + + taskMetaData + DataInput_18 + + + DataOutput_9 + maia + + + DataOutput_10 + taskMetaData + + + + + return ("ER".equals(taskMetaData.getResponse())); + + + return ("ED".equals(taskMetaData.getResponse())); + + + return ("ES".equals(taskMetaData.getResponse())); + + + return ("EN".equals(taskMetaData.getResponse())); + + + + + + + SequenceFlow_19 + SequenceFlow_20 + + + + + + + DataInput_25 + DataInput_27 + + + DataOutput_17 + DataOutput_18 + + + + maia + DataInput_25 + + + taskMetaData + DataInput_27 + + + DataOutput_17 + maia + + + DataOutput_18 + taskMetaData + + + + + + + + + SequenceFlow_26 + SequenceFlow_25 + + + + + + + DataInput_33 + DataInput_34 + + + DataOutput_23 + DataOutput_24 + + + + maia + DataInput_33 + + + taskMetaData + DataInput_34 + + + DataOutput_23 + maia + + + DataOutput_24 + taskMetaData + + + + + + + + + SequenceFlow_21 + SequenceFlow_22 + + + + + + + DataInput_28 + DataInput_30 + + + DataOutput_19 + DataOutput_20 + + + + maia + DataInput_28 + + + taskMetaData + DataInput_30 + + + DataOutput_19 + maia + + + DataOutput_20 + taskMetaData + + + + + + + + + SequenceFlow_15 + SequenceFlow_16 + + + + + + + DataInput_21 + DataInput_22 + + + DataOutput_13 + DataOutput_14 + + + + maia + DataInput_21 + + + taskMetaData + DataInput_22 + + + DataOutput_13 + maia + + + DataOutput_14 + taskMetaData + + + + + + + + + SequenceFlow_27 + SequenceFlow_28 + + + + + + + DataInput_35 + DataInput_36 + + + DataOutput_25 + DataOutput_26 + + + + maia + DataInput_35 + + + taskMetaData + DataInput_36 + + + DataOutput_25 + maia + + + DataOutput_26 + taskMetaData + + + + + + + + + SequenceFlow_24 + SequenceFlow_23 + + + + + + + DataInput_31 + DataInput_32 + + + DataOutput_21 + DataOutput_22 + + + + maia + DataInput_31 + + + taskMetaData + DataInput_32 + + + DataOutput_21 + maia + + + DataOutput_22 + taskMetaData + + + + + + + + + SequenceFlow_17 + SequenceFlow_18 + + + + + + + DataInput_23 + DataInput_24 + + + DataOutput_15 + DataOutput_16 + + + + maia + DataInput_23 + + + taskMetaData + DataInput_24 + + + DataOutput_15 + maia + + + DataOutput_16 + taskMetaData + + + + + SequenceFlow_29 + SequenceFlow_30 + System.out.println("***Ingresa a la tarea NOTIFICAR FECHA DE ENTRGA DE ARMAS***"); +//enviar mail de notificacion +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 39,40); + + + return ("EP".equals(taskMetaData.getResponse())); + + + + _16-_12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecutarCertificadosV2.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecutarCertificadosV2.bpmn new file mode 100644 index 0000000..7cd34a0 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecutarCertificadosV2.bpmn @@ -0,0 +1,277 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + SequenceFlow_12 + System.out.println("..........................EJECUCION CERTIFICADO V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + SequenceFlow_10 + + + + SequenceFlow_9 + SequenceFlow_10 + System.out.println("TramiteAnulado"); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ejecutar Certificados",actualTask); + + + SequenceFlow_8 + SequenceFlow_5 + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_3 + DataOutput_4 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_3 + maia + + + DataOutput_4 + taskMetaData + + + + + SequenceFlow_13 + SequenceFlow_8 + SequenceFlow_9 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_5 + SequenceFlow_6 + + + + SequenceFlow_1 + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Valida Informacion Certificado", 58, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Valida Informacion Certificado",actualTask); + + + SequenceFlow_12 + SequenceFlow_13 + + + + + + + + + DataInput_5 + DataInput_6 + DataInput_7 + DataInput_8 + + + DataOutput_5 + DataOutput_6 + + + + maia + DataInput_5 + + + DataInput_6 + + Valida Informacion Certificado + DataInput_26 + + + + DataInput_7 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_8 + + + DataOutput_5 + maia + + + DataOutput_6 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecutarInscripcionV2.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecutarInscripcionV2.bpmn new file mode 100644 index 0000000..ce3905b --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EjecutarInscripcionV2.bpmn @@ -0,0 +1,314 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("..........................EJECUCION INSCRIPCION V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Valida Info Inscripcion", 1, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Valida Info Inscripcion",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + + + + + + _DataInput_149 + _DataInput_150 + _DataInput_151 + _DataInput_152 + _DataInput_153 + _DataInput_154 + _DataInput_155 + DataInput_2 + DataInput_3 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_149 + + Valida Info Inscripcion + _DataInput_149 + + + + _DataInput_150 + + + _DataInput_151 + + + _DataInput_152 + + #{taskMetaData.groupId} + _DataInput_152 + + + + _DataInput_153 + + + _DataInput_154 + + + _DataInput_155 + + + maia + DataInput_2 + + + taskMetaData + DataInput_3 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ejecutar Certificados",actualTask); + + + SequenceFlow_4 + SequenceFlow_5 + + + + + + + DataInput_4 + DataInput_5 + + + DataOutput_3 + DataOutput_4 + + + + maia + DataInput_4 + + + taskMetaData + DataInput_5 + + + DataOutput_3 + maia + + + DataOutput_4 + taskMetaData + + + + SequenceFlow_5 + SequenceFlow_6 + //FlowUtil.endFlow(kcontext); + + + + + SequenceFlow_7 + SequenceFlow_9 + System.out.println("***SE ANULO EL TRAMITE***"); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + SequenceFlow_9 + SequenceFlow_10 + //FlowUtil.endFlow(kcontext); + + + + SequenceFlow_10 + + + + + SequenceFlow_3 + SequenceFlow_4 + SequenceFlow_7 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/EmisionDocumentoHabilitanteV2.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EmisionDocumentoHabilitanteV2.bpmn new file mode 100644 index 0000000..93d09eb --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/EmisionDocumentoHabilitanteV2.bpmn @@ -0,0 +1,892 @@ + + + + + + + + + + + + + + + + + + + + + + + + System.out.println("..........................NO REQUIERE TARJETA EDH V2......................."); +taskMetaData=FlowUtil.createTaskInfo("30",102, 1,120, "Generar Reporte", 35, "OK_NO"); +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Generar Reporte",actualTask); + + + SequenceFlow_17 + SequenceFlow_20 + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_1 + + + DataInput_2 + + Generar Reporte + DataInput_26 + + + + DataInput_3 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_4 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_25 + SequenceFlow_26 + SequenceFlow_5 + + + + + taskMetaData=FlowUtil.createTaskInfo("30",101, 1,120, "Firmar Tramite Supervisor", 38, "OK_NO"); +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar Tramite Supervisor",actualTask); + + + SequenceFlow_20 + SequenceFlow_25 + + + + + + + + + + + + + + DataInput_21 + DataInput_22 + DataInput_23 + DataInput_24 + DataInput_25 + DataInput_27 + DataInput_28 + DataInput_30 + DataInput_31 + + + DataOutput_6 + DataOutput_7 + + + + DataInput_21 + + Firmar Tramite Supervisor + _DataInput_16 + + + + DataInput_22 + + + DataInput_23 + + + DataInput_24 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_25 + + + DataInput_27 + + + DataInput_28 + + + maia + DataInput_30 + + + taskMetaData + DataInput_31 + + + DataOutput_6 + maia + + + DataOutput_7 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_6 + SequenceFlow_1 + SequenceFlow_28 + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_28 + SequenceFlow_29 + FlowUtil.executeClass("com.fp.armas.task.FechaCaducidadEstadoArma", maia); +FlowUtil.executeClass("com.fp.armas.task.TramiteAprobado", maia); +FlowUtil.executeClass("com.fp.armas.task.TipoArchivoControl", maia); +FlowUtil.executeClass("com.fp.armas.task.FinalizarDocumentoHabilitante", maia); +taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.getAditionalData().put("datosmail", maia.get("datosmail")); +taskMetaData.setResponse((maia.get("tipoarchivo")!=null)?""+maia.get("tipoarchivo"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + return ("A".equals(taskMetaData.getResponse())); + + + + SequenceFlow_29 + SequenceFlow_30 + SequenceFlow_35 + + + + + taskMetaData=FlowUtil.createTaskInfo("30",109, 1,120, "Firmar Tramite Coordinador", 38, "OK_NO"); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar Tramite Coordinador",actualTask); + + + SequenceFlow_30 + SequenceFlow_31 + + + + + + + + + + + + + + DataInput_5 + DataInput_6 + DataInput_7 + DataInput_8 + DataInput_9 + DataInput_10 + DataInput_12 + DataInput_13 + DataInput_14 + + + DataOutput_13 + DataOutput_14 + + + + DataInput_5 + + Firmar Tramite Coordinador + _DataInput_16 + + + + DataInput_6 + + + DataInput_7 + + + DataInput_8 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_9 + + + DataInput_10 + + + DataInput_12 + + + maia + DataInput_13 + + + taskMetaData + DataInput_14 + + + DataOutput_13 + maia + + + DataOutput_14 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("D".equals(taskMetaData.getResponse())); + + + + SequenceFlow_31 + SequenceFlow_32 + System.out.println("..........................VALIDAR CUSTODIO......................."); +FlowUtil.executeClass("com.fp.armas.task.ValidarCustodios", maia); +taskMetaData.getAditionalData().put("datosmail", maia.get("datosmail")); +taskMetaData.setResponse((maia.get("BPMStatus")!=null)?""+maia.get("BPMStatus"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_22 + + + + SequenceFlow_7 + SequenceFlow_22 + //FlowUtil.endFlow(kcontext); + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_32 + SequenceFlow_33 + SequenceFlow_34 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_23 + + + + SequenceFlow_15 + SequenceFlow_16 + FlowUtil.executeClass("com.fp.armas.task.TipoArchivoControl", maia); +taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.getAditionalData().put("datosmail", maia.get("datosmail")); +taskMetaData.setResponse((maia.get("tipoarchivo")!=null)?""+maia.get("tipoarchivo"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + _1-_15 + + + + SequenceFlow_9 + SequenceFlow_14 + SequenceFlow_15 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_16 + SequenceFlow_17 + SequenceFlow_26 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_33 + SequenceFlow_7 + System.out.println("................NOTIFICACION ENVIA MAIL ADJUNTO........."); +//enviar mail de notificacion + + + + + SequenceFlow_35 + SequenceFlow_34 + SequenceFlow_36 + + + + SequenceFlow_36 + SequenceFlow_3 + System.out.println("................NOTIFICACION PRESENTARSE AL CENTRO DE CONTROL........."); +//enviar mail de notificacion +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 4 ,5); + + + + SequenceFlow_3 + _16-_12 + //FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + _1-_15 + SequenceFlow_8 + System.out.println("..........................EMISION DOCUMENTO HABILITANTE V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + SequenceFlow_14 + SequenceFlow_23 + System.out.println("............................................................................................ NO:"); +System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones","Tramite Anulado en Revisar Tramite"+datosmail.get("observaciones")); +}else{ +maia.put("observaciones","Tramite Anulado en Revisar Tramite"); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + SequenceFlow_13 + + + + SequenceFlow_1 + SequenceFlow_13 + System.out.println("ingresa a enviar el mail"); +//enviar mail de rechazo +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",30, 1,120, "Autorizar Tramite Coordinador", 31, "OK_NO"); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + System.out.println("............................................................................................ 1:"); +taskMetaData.updateData(maia); +System.out.println("............................................................................................ 2:"); +actualTask=new java.util.ArrayList(); +System.out.println("............................................................................................ 3:"); +kcontext.setVariable("actualTask",actualTask); +System.out.println("............................................................................................ 4:"); +actualTask.add(taskMetaData); +System.out.println("............................................................................................ 5:"); +tasksMetaData.put("Revisar Tramite",actualTask); +System.out.println("............................................................................................ 6:"); + + + SequenceFlow_5 + SequenceFlow_6 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Revisar Tramite + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + System.out.println("..........................REVISAR TRAMITE EDH V2......................."); +taskMetaData=FlowUtil.createTaskInfo("30",33, 1,120, "Revisar Tramite Supervisor", 30, "OK_NO"); +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Autorizar Tramite",actualTask); + + + SequenceFlow_8 + SequenceFlow_9 + + + + + + + + + DataInput_200 + DataInput_201 + DataInput_202 + DataInput_203 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_200 + + + DataInput_201 + + Autorizar Tramite + DataInput_26 + + + + DataInput_202 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_203 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/RecepcionArmasV2.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comacov2/RecepcionArmasV2.bpmn new file mode 100644 index 0000000..80ee14f --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/RecepcionArmasV2.bpmn @@ -0,0 +1,371 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_8 + System.out.println("**************INICIA FLUJO RECEPCIÓN V2***************"); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_5 + SequenceFlow_9 + System.out.println("ingresa a Actualizar Inventario"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarInventario", maia); +FlowUtil.executeClass("com.fp.armas.task.AplicarSancion", maia); +taskMetaData.setResponse((maia.get("BPMStatus")!=null)?""+maia.get("BPMStatus"):null); +kcontext.setVariable("taskMetaData",taskMetaData); +System.out.println("-- Actualizar Inventario"); + + + + + taskMetaData=FlowUtil.createTaskInfo("30",94, 1,120, "Legalizar Acta", 29, "OK_NO"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarRutaArchivo", maia); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupoDecRecep", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Legalizar Acta",actualTask); + + + SequenceFlow_8 + SequenceFlow_5 + + + + + + + + + + + + + + _DataInput_30 + _DataInput_31 + _DataInput_32 + _DataInput_33 + _DataInput_34 + _DataInput_35 + _DataInput_36 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_30 + + Legalizar Acta + _DataInput_30 + + + + _DataInput_31 + + + _DataInput_32 + + + _DataInput_33 + + #{taskMetaData.groupId} + _DataInput_33 + + + + _DataInput_34 + + + _DataInput_35 + + + _DataInput_36 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + SequenceFlow_9 + SequenceFlow_10 + SequenceFlow_14 + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + SequenceFlow_2 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",60, 1,120, "Definir Sancion", 44, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Definir Sancion",actualTask); + + + SequenceFlow_14 + SequenceFlow_15 + + + + + + + + + + + + + + _DataInput_58 + _DataInput_59 + _DataInput_60 + _DataInput_61 + _DataInput_62 + _DataInput_63 + _DataInput_64 + DataInput_6 + DataInput_7 + + + DataOutput_6 + DataOutput_7 + + + + _DataInput_58 + + Definir Sancion + _DataInput_58 + + + + _DataInput_59 + + + _DataInput_60 + + + _DataInput_61 + + #{taskMetaData.groupId} + _DataInput_61 + + + + _DataInput_62 + + + _DataInput_63 + + + _DataInput_64 + + + maia + DataInput_6 + + + taskMetaData + DataInput_7 + + + DataOutput_6 + maia + + + DataOutput_7 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("A".equals(taskMetaData.getResponse())); + + + + SequenceFlow_15 + SequenceFlow_13 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_13 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/RecepcionSolicitudRequisitosV2.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comacov2/RecepcionSolicitudRequisitosV2.bpmn new file mode 100644 index 0000000..25df9d5 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/RecepcionSolicitudRequisitosV2.bpmn @@ -0,0 +1,361 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + SequenceFlow_18 + + + + SequenceFlow_25 + SequenceFlow_18 + FlowUtil.endFlow(kcontext); + + + + _1-_15 + SequenceFlow_2 + System.out.println("..........................FLUJO SOLICITUD V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_23 + SequenceFlow_10 + System.out.println("***Ingresa a la tarea generar valor a cancelar***"); +FlowUtil.executeClass("com.fp.armas.task.GenerarValorACancelar", maia); +//taskMetaData.getAditionalData().get("datosmail"); +//taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("BPMStatus")!=null)?""+maia.get("BPMStatus"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_19 + SequenceFlow_3 + System.out.println("Ingresa a tarea de enviar el mail de aceptacion de requisitos"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 10 , 11); + + + + + + + SequenceFlow_24 + SequenceFlow_25 + + + + + + + DataInput_40 + DataInput_41 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_40 + + + taskMetaData + DataInput_41 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + + + SequenceFlow_3 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",25, 1,120, "Revisar solicitud y documentos requeridos", 1, "OK_NO"); +//para asignar a un grupo especifico +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +kcontext.setVariable("taskMetaData",taskMetaData); +actualTask.add(taskMetaData); +tasksMetaData.put("Revisar solicitud y documentos requeridos",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Revisar solicitud y documentos requeridos + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_1 + SequenceFlow_7 + SequenceFlow_23 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + SequenceFlow_19 + SequenceFlow_24 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_5 + + + + SequenceFlow_7 + SequenceFlow_4 + //enviar mail al usuario indicando razones del rechazo +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 52 , 53); + + + + SequenceFlow_4 + SequenceFlow_5 + FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/comacov2/TraspasoDominioV2.bpmn b/base/bpm/bpmlib/src/main/resources/flows/comacov2/TraspasoDominioV2.bpmn new file mode 100644 index 0000000..07aa941 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/comacov2/TraspasoDominioV2.bpmn @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + _1-_15 + SequenceFlow_1 + System.out.println("..........................TRASPASO DOMINIO V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",217, 1,120, "Validar transaccion de venta", 68, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","COORD_MILITAR_"); +System.out.println(maia.get("grupo")); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar armas venta",actualTask); + + + SequenceFlow_1 + SequenceFlow_5 + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + + + + _DataInput_16 + + Validar armas de venta + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + + #{taskMetaData.userId} + + + + + SequenceFlow_7 + SequenceFlow_2 + SequenceFlow_4 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_2 + _16-_12 + FlowUtil.executeClass("com.fp.armas.task.traspasodominio.TraspasoDominioAnula", maia); + +System.out.println("Ingresa a tarea de enviar el mail"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.PersonaDireccionVentaTemp", maia, taskMetaData, 69 , 70); + +FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + SequenceFlow_6 + + + + SequenceFlow_4 + SequenceFlow_6 + FlowUtil.executeClass("com.fp.armas.task.traspasodominio.TraspasoDominio", maia); + +System.out.println("Ingresa a tarea de enviar el mail--"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.PersonaDireccionVentaTemp", maia, taskMetaData, 69 , 70); + +FlowUtil.endFlow(kcontext); + + + + + SequenceFlow_5 + SequenceFlow_7 + System.out.println("*************"); +System.out.println(taskMetaData.getResponse()); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/final.bpmn b/base/bpm/bpmlib/src/main/resources/flows/final.bpmn new file mode 100644 index 0000000..2958d60 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/final.bpmn @@ -0,0 +1,276 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + SequenceFlow_4 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("1",7002, 1,120, "Llamar Transaccion", 1, "OK_NO"); + +//FlowUtil.executeClass("paquete.clase", maia); // la clase puede hacer lo que necesite +//taskMetaData.setUserId((maia.get("userId")!=null)?""+maia.get("userId"):null); +//taskMetaData.setGroupId((maia.get("groupId")!=null)?""+maia.get("groupId"):null); +//para asignar a un grupo especifico +//taskMetaData.setGroupId("GERENCIA"); +taskMetaData.setUserId("1234"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Llamar Transaccion",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Llamar Transaccion + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("1",7002, 1,120, "Ejecutar transaccion", 1, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setUserId("1234"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ejecutar transaccion",actualTask); + + + SequenceFlow_3 + SequenceFlow_4 + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + + + + _DataInput_16 + + Ejecutar transaccion + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + _16-_12 + + + + _1-_15 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/finalwpa.bpmn b/base/bpm/bpmlib/src/main/resources/flows/finalwpa.bpmn new file mode 100644 index 0000000..61b4c9e --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/finalwpa.bpmn @@ -0,0 +1,296 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + System.out.println("SSSSSSSSSSSSs "+taskMetaData); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + SequenceFlow_4 + _16-_12 + if(taskMetaData.getResponse()==null){ + taskMetaData.setResponse("A"); +} +taskMetaData.updateData(maia); +kcontext.setVariable("maia",maia); +actualTask.add(taskMetaData); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("1",7002, 1,120, "Llamar Transaccion", 1, "OK_NO"); + +//FlowUtil.executeClass("paquete.clase", maia); // la clase puede hacer lo que necesite +//taskMetaData.setUserId((maia.get("userId")!=null)?""+maia.get("userId"):null); +//taskMetaData.setGroupId((maia.get("groupId")!=null)?""+maia.get("groupId"):null); +//para asignar a un grupo especifico +//taskMetaData.setGroupId("GERENCIA"); +taskMetaData.setUserId("1234"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Llamar Transaccion",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + DataOutput_1 + + + + maia + DataInput_11 + + + DataInput_26 + + Llamar Transaccion + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + DataOutput_1 + actualTask + + + + #{taskMetaData.userId} + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("1",7002, 1,120, "Ejecutar transaccion", 1, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setUserId("1234"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ejecutar transaccion",actualTask); + + + SequenceFlow_3 + SequenceFlow_4 + + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + DataOutput_2 + + + + _DataInput_16 + + Ejecutar transaccion + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + DataOutput_2 + actualTask + + + + #{taskMetaData.userId} + + + + + + _16-_12 + + + + _1-_15 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/nuevoProceso.bpmn2 b/base/bpm/bpmlib/src/main/resources/flows/nuevoProceso.bpmn2 new file mode 100644 index 0000000..bd450f8 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/nuevoProceso.bpmn2 @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("1",7000, 1,5,"RULE",Kind.OK); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Llamar Transaccion",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + DataOutput_3 + actualTask + + + + + SequenceFlow_3 + SequenceFlow_4 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_4 + + + + SequenceFlow_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/process.bpmn2 b/base/bpm/bpmlib/src/main/resources/flows/process.bpmn2 new file mode 100644 index 0000000..c645655 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/process.bpmn2 @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("actualTask",actualTask); +kcontext.setVariable("tasksMetaData",tasksMetaData); + + + + + + taskMetaData=FlowUtil.createTaskInfo("1",7001, 1,5,"RULE",Kind.OK); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Llamar Transaccion",actualTask); + + + SequenceFlow_2 + SequenceFlow_5 + + + + + + + + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + DataInput_1 + + + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + DataOutput_3 + actualTask + + + + SequenceFlow_6 + + + + + SequenceFlow_5 + SequenceFlow_6 + FlowUtil.endFlow(kcontext); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/prueba.bpmn b/base/bpm/bpmlib/src/main/resources/flows/prueba.bpmn new file mode 100644 index 0000000..dec2fc8 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/prueba.bpmn @@ -0,0 +1,39 @@ + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("HOLA MUNDo"); + + + SequenceFlow_2 + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/pviaticos.bpmn b/base/bpm/bpmlib/src/main/resources/flows/pviaticos.bpmn new file mode 100644 index 0000000..2d29f18 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/pviaticos.bpmn @@ -0,0 +1,727 @@ + + + + + + + + + + + + + + + + + + + SequenceFlow_2 + SequenceFlow_3 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + SequenceFlow_9 + SequenceFlow_13 + SequenceFlow_71 + + + + SequenceFlow_2 + + + + + SequenceFlow_13 + SequenceFlow_7 + SequenceFlow_67 + SequenceFlow_87 + + + + + SequenceFlow_67 + SequenceFlow_5 + + + SequenceFlow_87 + SequenceFlow_88 + + + + SequenceFlow_88 + SequenceFlow_4 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_4 + + + + SequenceFlow_1 + SequenceFlow_7 + SequenceFlow_102 + + + + SequenceFlow_62 + SequenceFlow_65 + SequenceFlow_66 + + + + SequenceFlow_28 + SequenceFlow_29 + SequenceFlow_77 + + + + + SequenceFlow_66 + SequenceFlow_28 + + + + SequenceFlow_79 + SequenceFlow_80 + SequenceFlow_81 + + + + SequenceFlow_77 + SequenceFlow_80 + + + + SequenceFlow_81 + SequenceFlow_12 + + + + SequenceFlow_29 + SequenceFlow_31 + + + + SequenceFlow_74 + SequenceFlow_75 + SequenceFlow_101 + SequenceFlow_76 + + + + SequenceFlow_31 + SequenceFlow_32 + SequenceFlow_33 + SequenceFlow_100 + + + + + SequenceFlow_32 + SequenceFlow_74 + + + + SequenceFlow_33 + SequenceFlow_75 + + + + SequenceFlow_76 + SequenceFlow_37 + + + + SequenceFlow_37 + + + + SequenceFlow_51 + SequenceFlow_79 + + + + SequenceFlow_38 + SequenceFlow_48 + + + + SequenceFlow_16 + SequenceFlow_38 + SequenceFlow_78 + + + + + SequenceFlow_12 + SequenceFlow_16 + SequenceFlow_45 + + + + + SequenceFlow_45 + SequenceFlow_50 + SequenceFlow_51 + + + + SequenceFlow_48 + SequenceFlow_50 + SequenceFlow_57 + + + + + SequenceFlow_58 + SequenceFlow_82 + + + + SequenceFlow_59 + SequenceFlow_83 + + + + SequenceFlow_78 + SequenceFlow_57 + SequenceFlow_58 + SequenceFlow_59 + + + + + SequenceFlow_82 + SequenceFlow_83 + SequenceFlow_84 + + + + SequenceFlow_84 + SequenceFlow_64 + + + + SequenceFlow_64 + + + + SequenceFlow_100 + SequenceFlow_101 + + + + + + SequenceFlow_102 + SequenceFlow_96 + SequenceFlow_97 + SequenceFlow_98 + + + + + SequenceFlow_98 + SequenceFlow_93 + + + + SequenceFlow_97 + SequenceFlow_99 + + + + SequenceFlow_24 + SequenceFlow_65 + + + + SequenceFlow_22 + SequenceFlow_62 + + + + SequenceFlow_93 + SequenceFlow_99 + SequenceFlow_22 + SequenceFlow_24 + + + + + SequenceFlow_72 + SequenceFlow_1 + + + + SequenceFlow_71 + SequenceFlow_72 + SequenceFlow_96 + + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("1",7001, 1,5,"com.fp.viaticos.task.AsiganrJefe","OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Llamar transaccion",actualTask); + + + SequenceFlow_3 + SequenceFlow_9 + + + + + SequenceFlow_5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/subproceso.bpmn b/base/bpm/bpmlib/src/main/resources/flows/subproceso.bpmn new file mode 100644 index 0000000..9fbbd89 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/subproceso.bpmn @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + + SequenceFlow_3 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "aprobar subproceso", 1, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setUserId("EOCAMPO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + List<Object> laux = new java.util.ArrayList(); +taskMetaData.updateData(maia); +laux.add(taskMetaData); +actualTask.add(taskMetaData); +kcontext.setVariable("actualTask",actualTask); +tasksMetaData.put("aprobar subproceso",laux); + + + SequenceFlow_2 + SequenceFlow_4 + + + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_5 + + + _DataInput_30 + _DataInput_31 + _DataInput_32 + _DataInput_33 + _DataInput_34 + _DataInput_35 + _DataInput_36 + + + DataOutput_1 + DataOutput_2 + DataOutput_5 + + + + + _DataInput_30 + + aprobar subproceso + _DataInput_30 + + + + _DataInput_31 + + + _DataInput_32 + + + _DataInput_33 + + + _DataInput_34 + + + _DataInput_35 + + + _DataInput_36 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + actualTask + DataInput_5 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + DataOutput_5 + actualTask + + + + #{taskMetaData.userId} + + + + + + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "aprobar subproceso dos", 1, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setUserId("EOCAMPO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + List<Object> laux = new java.util.ArrayList(); +taskMetaData.updateData(maia); +laux.add(taskMetaData); +actualTask.add(taskMetaData); +kcontext.setVariable("actualTask",actualTask); +tasksMetaData.put("aprobar subproceso dos",laux); + + + SequenceFlow_4 + SequenceFlow_3 + + + + + + + + + + + + + + + + DataInput_3 + DataInput_4 + DataInput_6 + + + _DataInput_58 + _DataInput_59 + _DataInput_60 + _DataInput_61 + _DataInput_62 + _DataInput_63 + _DataInput_64 + + + DataOutput_3 + DataOutput_4 + DataOutput_6 + + + + + _DataInput_58 + + aprobar subproceso dos + _DataInput_58 + + + + _DataInput_59 + + + _DataInput_60 + + + _DataInput_61 + + + _DataInput_62 + + + _DataInput_63 + + + _DataInput_64 + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + actualTask + DataInput_6 + + + DataOutput_3 + maia + + + DataOutput_4 + taskMetaData + + + DataOutput_6 + actualTask + + + + #{taskMetaData.userId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/taskasign.bpmn b/base/bpm/bpmlib/src/main/resources/flows/taskasign.bpmn new file mode 100644 index 0000000..5b241a4 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/taskasign.bpmn @@ -0,0 +1,298 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + _1-_11 + + + _13-_2 + + + + _5-_3 + _3-_8 + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + _3_SkippableInput + _3_TaskNameInput + _3_GroupIdInput + + + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_SkippableInput + + false + _3_SkippableInput + + + + _3_TaskNameInput + + #{maia.request.subject} + _3_TaskNameInput + + + + _3_GroupIdInput + + #{taskMetaData.groupId} + _3_GroupIdInput + + + + _3_taskMetaDataOutput + taskMetaData + + + + #{taskMetaData.userId} + + + + + _10-_4 + _4-_6 + FlowUtil.evalRule(taskMetaData.getRuleCode(), maia); +FlowUtil.executeClass(taskMetaData.getClassCode(), maia); +try{ +taskMetaData.setUserId((maia.get("userId")!=null)?""+maia.get("userId"):null); +}catch(Exception e){ +} +try{ +taskMetaData.setGroupId((maia.get("groupId")!=null)?""+maia.get("groupId"):null); +}catch(Exception e){ +} +taskMetaData.setAction((maia.get("action")!=null)?""+maia.get("action"):null); +try{ +if(maia.get("internalCode")!=null){ +taskMetaData.setInternalCode(maia.get("internalCode")); +} +}catch(Exception e){ +} +maia.remove("userId"); +maia.remove("ActorId"); +maia.remove("groupId"); +maia.remove("GroupId"); +maia.remove("action"); +maia.remove("internalCode"); + + + + _6-_5 + _5-_3 + + + _4-_6 + _6-_5 + _6-_7 + + + _6-_7 + _8-_7 + _7-_13 + + + _3-_8 + _8-_7 + _8-_9 + + + _8-_9 + _9-_12 + + + + + + + _11-_10 + _12-_10 + _10-_4 + + + _1-_11 + _11-_10 + mainTask=taskMetaData; +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + _9-_12 + _12-_10 + actualTask.add(taskMetaData); +taskMetaData=mainTask; + + + _7-_13 + _13-_2 + if(taskMetaData.getResponse()==null){ + taskMetaData.setResponse("A"); +} +taskMetaData.updateData(maia); +kcontext.setVariable("maia",maia); +actualTask.add(taskMetaData); + + + + + + return "A".equals(taskMetaData.getAction()); + + + + return !("A".equals(taskMetaData.getAction())); + + + return taskMetaData.getResponse().compareTo("R")!=0; + + + + return taskMetaData.getResponse().compareTo("R")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/test.bpmn b/base/bpm/bpmlib/src/main/resources/flows/test.bpmn new file mode 100644 index 0000000..21c5a82 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/test.bpmn @@ -0,0 +1,467 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "grupo", 1, "OK_NO"); +taskMetaData.setGroupId("GERENCIA"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("grupo",actualTask); + + + SequenceFlow_5 + SequenceFlow_3 + + + + + + + + + + + + + + DataInput_3 + DataInput_4 + + + _DataInput_44 + _DataInput_45 + _DataInput_46 + _DataInput_47 + _DataInput_48 + _DataInput_49 + _DataInput_50 + + + DataOutput_3 + DataOutput_4 + + + + + _DataInput_44 + + grupo + _DataInput_44 + + + + _DataInput_45 + + + _DataInput_46 + + + _DataInput_47 + + #{taskMetaData.groupId} + _DataInput_47 + + + + _DataInput_48 + + + _DataInput_49 + + + _DataInput_50 + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_3 + maia + + + DataOutput_4 + taskMetaData + + + + + + + + tasksMetaData.put("finalizar",actualTask); +System.out.println("Resultado subproceso "+actualTask); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("subproceso",actualTask); + + + + + + SequenceFlow_3 + SequenceFlow_6 + + + + + + + + + + DataInput_5 + DataInput_6 + DataInput_9 + + + DataOutput_5 + DataOutput_7 + DataOutput_8 + DataOutput_6 + + + + maia + DataInput_5 + + + tasksMetaData + DataInput_6 + + + actualTask + DataInput_9 + + + DataOutput_5 + maia + + + DataOutput_7 + tasksMetaData + + + DataOutput_8 + taskMetaData + + + DataOutput_6 + actualTask + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "prueba", 1, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setUserId("EOCAMPO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("prueba",actualTask); + + + SequenceFlow_2 + SequenceFlow_5 + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + + + _DataInput_30 + _DataInput_31 + _DataInput_32 + _DataInput_33 + _DataInput_34 + _DataInput_35 + _DataInput_36 + + + DataOutput_1 + DataOutput_2 + + + + + _DataInput_30 + + prueba + _DataInput_30 + + + + _DataInput_31 + + + _DataInput_32 + + + _DataInput_33 + + + _DataInput_34 + + + _DataInput_35 + + + _DataInput_36 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "aprobacion final", 1, "OK_NO"); +taskMetaData.setUserId("EOCAMPO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("aprobacion final",actualTask); + + + SequenceFlow_6 + SequenceFlow_7 + + + + + + + + + + + + DataInput_7 + DataInput_8 + DataInput_15 + + + _DataInput_170 + _DataInput_174 + _DataInput_175 + _DataInput_176 + + + DataOutput_9 + DataOutput_10 + + + + + _DataInput_170 + + aprobacion final + _DataInput_170 + + + + _DataInput_174 + + + _DataInput_175 + + + _DataInput_176 + + + maia + DataInput_7 + + + DataInput_8 + + + taskMetaData + DataInput_15 + + + DataOutput_9 + maia + + + DataOutput_10 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_7 + SequenceFlow_4 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_4 + + + + SequenceFlow_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/testuno.bpmn b/base/bpm/bpmlib/src/main/resources/flows/testuno.bpmn new file mode 100644 index 0000000..61e8b12 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/testuno.bpmn @@ -0,0 +1,308 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "pruebauno", 1, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setUserId("EOCAMPO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("pruebauno",actualTask); + + + SequenceFlow_2 + SequenceFlow_5 + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + + + _DataInput_30 + _DataInput_31 + _DataInput_32 + _DataInput_33 + _DataInput_34 + _DataInput_35 + _DataInput_36 + + + DataOutput_1 + DataOutput_2 + + + + + _DataInput_30 + + pruebauno + _DataInput_30 + + + + _DataInput_31 + + + _DataInput_32 + + + _DataInput_33 + + + _DataInput_34 + + + _DataInput_35 + + + _DataInput_36 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_1 + + + + SequenceFlow_3 + SequenceFlow_4 + FlowUtil.endFlow(kcontext); + + + + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "grupouno", 1, "OK_NO"); +taskMetaData.setGroupId("GERENCIA"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("grupouno",actualTask); + + + SequenceFlow_5 + SequenceFlow_6 + + + + + + + + + + + + + + DataInput_3 + DataInput_4 + + + _DataInput_44 + _DataInput_45 + _DataInput_46 + _DataInput_47 + _DataInput_48 + _DataInput_49 + _DataInput_50 + + + DataOutput_3 + DataOutput_4 + + + + + _DataInput_44 + + grupouno + _DataInput_44 + + + + _DataInput_45 + + + _DataInput_46 + + + _DataInput_47 + + #{taskMetaData.groupId} + _DataInput_47 + + + + _DataInput_48 + + + _DataInput_49 + + + _DataInput_50 + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_3 + maia + + + DataOutput_4 + taskMetaData + + + + + SequenceFlow_6 + SequenceFlow_3 + System.out.println("prueba script"); + + + + SequenceFlow_4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/testwpa.bpmn b/base/bpm/bpmlib/src/main/resources/flows/testwpa.bpmn new file mode 100644 index 0000000..0bc495f --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/testwpa.bpmn @@ -0,0 +1,292 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("17",23, 1,10,"WMP",Kind.OK); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Verifica1",actualTask); + + + + + + + + + + _17_maiaInput + _17_taskMetaDataInput + + + _17_actualTaskOutput + _17_maiaOutput + _17_taskMetaDataOutput + + + + maia + _17_maiaInput + + + taskMetaData + _17_taskMetaDataInput + + + _17_actualTaskOutput + actualTask + + + _17_maiaOutput + maia + + + _17_taskMetaDataOutput + taskMetaData + + + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("17",21, 1,10,"WMP",Kind.OK); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Verifica2",actualTask); + + + + + + + + + + _21_maiaInput + _21_taskMetaDataInput + + + _21_actualTaskOutput + _21_maiaOutput + _21_taskMetaDataOutput + + + + maia + _21_maiaInput + + + taskMetaData + _21_taskMetaDataInput + + + _21_actualTaskOutput + actualTask + + + _21_maiaOutput + maia + + + _21_taskMetaDataOutput + taskMetaData + + + + + + System.out.println(">>Inicia Flujo"); +taskMetaData=FlowUtil.createTaskInfo("17",22, 1,10,"WPA",Kind.OK); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Inicia Flujo",actualTask); +System.out.println(">>Inicia Flujo>>"+taskMetaData.getResponse()); + + + + + + + + + + _5_maiaInput + _5_taskMetaDataInput + + + _5_actualTaskOutput + _5_maiaOutput + _5_taskMetaDataOutput + + + + maia + _5_maiaInput + + + taskMetaData + _5_taskMetaDataInput + + + _5_actualTaskOutput + actualTask + + + _5_maiaOutput + maia + + + _5_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + System.out.println("AAAAA"+maia); +return (((String)maia.get("transaction")).compareTo("23")==0); + + + + System.out.println("BBBBB"+maia); +return (((String)maia.get("transaction")).compareTo("21")==0); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/viaticos.bpmn b/base/bpm/bpmlib/src/main/resources/flows/viaticos.bpmn new file mode 100644 index 0000000..9ab160e --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/viaticos.bpmn @@ -0,0 +1,1949 @@ + + + + + + + + + + + + + + + + + + + ScriptTask_8-ExclusiveGateway_4 + ScriptTask_9-ExclusiveGateway_4 + ExclusiveGateway_4-CallActivity_4 + + + ExclusiveGateway_3-ScriptTask_4 + ScriptTask_4-ExclusiveGateway_5 + maia.put("cusuariobpm", taskMetaData.getUserId()); +//enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefeyResponsableUnidad", maia, taskMetaData, 105 , 106); + + + ExclusiveGateway_3-ScriptTask_7 + ScriptTask_7-ParallelGateway_1 + maia.put("cusuariobpm", taskMetaData.getUserId()); +//enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefeyResponsableUnidad", maia, taskMetaData, 107 , 108); + + + CallActivity_1-ExclusiveGateway_2 + ExclusiveGateway_2-ScriptTask_3 + ExclusiveGateway_2-ScriptTask_8 + ExclusiveGateway_2-ScriptTask_6 + + + CallActivity_2-ExclusiveGateway_3 + ExclusiveGateway_3-ScriptTask_4 + ExclusiveGateway_3-ScriptTask_7 + ExclusiveGateway_3-ScriptTask_9 + + + ScriptTask_1-ExclusiveGateway_1 + ExclusiveGateway_8-ExclusiveGateway_1 + ExclusiveGateway_1-CallActivity_1 + + + StartEvent_1-ScriptTask_1 + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",21, 1,120,"com.fp.viaticos.task.AsignarJefe", "Autorizar jefe", 10, "OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +//enviar mail al jefe del empleado +FlowUtil.executeClass(taskMetaData.getClassCode(), maia); +String action = maia.get("action")!=null ?""+maia.get("action"):null; +if(action == null || action.equals("A") ){ + FlowUtil.mail("com.fp.viaticos.mail.Jefe", maia, taskMetaData, 101 , 102); +} + + + List old=(List)tasksMetaData.get("Autorizar jefe"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Autorizar jefe",old); + + + ExclusiveGateway_1-CallActivity_1 + CallActivity_1-ExclusiveGateway_2 + + + + + + + + CallActivity_1_maiaInput + CallActivity_1_taskMetaDataInput + + + CallActivity_1_actualTaskOutput + CallActivity_1_maiaOutput + CallActivity_1_taskMetaDataOutput + + + + maia + CallActivity_1_maiaInput + + + taskMetaData + CallActivity_1_taskMetaDataInput + + + CallActivity_1_actualTaskOutput + actualTask + + + CallActivity_1_maiaOutput + maia + + + CallActivity_1_taskMetaDataOutput + taskMetaData + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",22, 1,120,"com.fp.viaticos.task.AsignarSupervisior", "Autorizar supervisor", 10, "OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +//enviar mail al responsable de la unidad a la que pertenece del empleado + +FlowUtil.mail("com.fp.viaticos.mail.ResponsableUnidad", maia, taskMetaData, 101 , 102); + + + List old=(List)tasksMetaData.get("Autorizar supervisor"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Autorizar supervisor",old); + + + ScriptTask_6-CallActivity_2 + CallActivity_2-ExclusiveGateway_3 + + + + + + + + CallActivity_2_maiaInput + CallActivity_2_taskMetaDataInput + + + CallActivity_2_actualTaskOutput + CallActivity_2_maiaOutput + CallActivity_2_taskMetaDataOutput + + + + maia + CallActivity_2_maiaInput + + + taskMetaData + CallActivity_2_taskMetaDataInput + + + CallActivity_2_actualTaskOutput + actualTask + + + CallActivity_2_maiaOutput + maia + + + CallActivity_2_taskMetaDataOutput + taskMetaData + + + + ExclusiveGateway_5-ScriptTask_5 + ScriptTask_5-EndEvent_2 + FlowUtil.endFlow(kcontext); + + + ScriptTask_5-EndEvent_2 + + + + ScriptTask_4-ExclusiveGateway_5 + ScriptTask_3-ExclusiveGateway_5 + ExclusiveGateway_5-ScriptTask_5 + + + ExclusiveGateway_2-ScriptTask_3 + ScriptTask_3-ExclusiveGateway_5 + //enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefe", maia, taskMetaData, 105 , 106); + + + ExclusiveGateway_2-ScriptTask_8 + ScriptTask_8-ExclusiveGateway_4 + //enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefe", maia, taskMetaData, 103 , 104); + + + ScriptTask_7-ParallelGateway_1 + ParallelGateway_1-CallActivity_5 + ParallelGateway_1-CallActivity_3 + ParallelGateway_1-CallActivity_14 + + + ExclusiveGateway_3-ScriptTask_9 + ScriptTask_9-ExclusiveGateway_4 + maia.put("cusuariobpm", taskMetaData.getUserId()); +//enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefeyResponsableUnidad", maia, taskMetaData, 103 , 104); + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",30, 1,120,"com.fp.viaticos.task.AsignarTalentoHumano", "Confirmar talento humano", 12,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.TalentoHumano", maia, taskMetaData, 113 , 114); + + + List old=(List)tasksMetaData.get("Confimar talento humano"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confimar talento humano",old); + + + ParallelGateway_1-CallActivity_5 + CallActivity_5-ParallelGateway_2 + + + + + + + + CallActivity_5_maiaInput + CallActivity_5_taskMetaDataInput + + + CallActivity_5_actualTaskOutput + CallActivity_5_maiaOutput + CallActivity_5_taskMetaDataOutput + + + + maia + CallActivity_5_maiaInput + + + taskMetaData + CallActivity_5_taskMetaDataInput + + + CallActivity_5_actualTaskOutput + actualTask + + + CallActivity_5_maiaOutput + maia + + + CallActivity_5_taskMetaDataOutput + taskMetaData + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",29, 1,120,"com.fp.viaticos.task.AsignarTesoreria", "Confirmar tesorería", 12,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 113 , 114); + + + List old=(List)tasksMetaData.get("Confirmar tesorería"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar tesorería",old); + + + ParallelGateway_1-CallActivity_3 + CallActivity_3-ParallelGateway_2 + + + + + + + + CallActivity_3_maiaInput + CallActivity_3_taskMetaDataInput + + + CallActivity_3_actualTaskOutput + CallActivity_3_maiaOutput + CallActivity_3_taskMetaDataOutput + + + + maia + CallActivity_3_maiaInput + + + taskMetaData + CallActivity_3_taskMetaDataInput + + + CallActivity_3_actualTaskOutput + actualTask + + + CallActivity_3_maiaOutput + maia + + + CallActivity_3_taskMetaDataOutput + taskMetaData + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",31, 1,120,"com.fp.viaticos.task.AsignarEmpleado", "Confirmar comision SP", 13,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Empleado", maia, taskMetaData, 115 , 116); + + + List old=(List)tasksMetaData.get("Confirmar comision SP"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar comision SP",old); + + + ParallelGateway_2-CallActivity_6 + CallActivity_6-ExclusiveGateway_7 + + + + + + + + CallActivity_6_maiaInput + CallActivity_6_taskMetaDataInput + + + CallActivity_6_actualTaskOutput + CallActivity_6_maiaOutput + CallActivity_6_taskMetaDataOutput + + + + maia + CallActivity_6_maiaInput + + + taskMetaData + CallActivity_6_taskMetaDataInput + + + CallActivity_6_actualTaskOutput + actualTask + + + CallActivity_6_maiaOutput + maia + + + CallActivity_6_taskMetaDataOutput + taskMetaData + + + + CallActivity_14-ParallelGateway_2 + CallActivity_3-ParallelGateway_2 + CallActivity_5-ParallelGateway_2 + ParallelGateway_2-CallActivity_6 + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",33, 1,120,"com.fp.viaticos.task.AsignarContabilidad", "Reajustar contabilidad", 15,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Contabilidad", maia, taskMetaData, 119 , 120); + + + List old=(List)tasksMetaData.get("Reajustar contabilidad"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Reajustar contabilidad",old); + + + ParallelGateway_3-CallActivity_8 + CallActivity_8-ParallelGateway_4 + + + + + + + + CallActivity_8_maiaInput + CallActivity_8_taskMetaDataInput + + + CallActivity_8_actualTaskOutput + CallActivity_8_maiaOutput + CallActivity_8_taskMetaDataOutput + + + + maia + CallActivity_8_maiaInput + + + taskMetaData + CallActivity_8_taskMetaDataInput + + + CallActivity_8_actualTaskOutput + actualTask + + + CallActivity_8_maiaOutput + maia + + + CallActivity_8_taskMetaDataOutput + taskMetaData + + + + CallActivity_6-ExclusiveGateway_7 + ExclusiveGateway_7-CallActivity_7 + ExclusiveGateway_7-CallActivity_10 + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",34, 1,120,"com.fp.viaticos.task.AsignarTalentoHumano", "Reajustar talento humano", 15,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.TalentoHumano", maia, taskMetaData, 119 , 120); + + + List old=(List)tasksMetaData.get("Reajustar talento humano"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Reajustar talento humano",old); + + + ParallelGateway_3-CallActivity_9 + CallActivity_9-ParallelGateway_4 + + + + + + + + CallActivity_9_maiaInput + CallActivity_9_taskMetaDataInput + + + CallActivity_9_actualTaskOutput + CallActivity_9_maiaOutput + CallActivity_9_taskMetaDataOutput + + + + maia + CallActivity_9_maiaInput + + + taskMetaData + CallActivity_9_taskMetaDataInput + + + CallActivity_9_actualTaskOutput + actualTask + + + CallActivity_9_maiaOutput + maia + + + CallActivity_9_taskMetaDataOutput + taskMetaData + + + + CallActivity_7-ParallelGateway_3 + ParallelGateway_3-CallActivity_8 + ParallelGateway_3-CallActivity_9 + ParallelGateway_3-ScriptTask_12 + SequenceFlow_5 + SequenceFlow_7 + + + CallActivity_8-ParallelGateway_4 + CallActivity_9-ParallelGateway_4 + ScriptTask_12-ParallelGateway_4 + SequenceFlow_6 + SequenceFlow_8 + SequenceFlow_9 + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",50, 1,120,"com.fp.viaticos.task.AsignarTesoreria", "Confirmar movilización", 19,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 133 , 134); + + + List old=(List)tasksMetaData.get("Confirmar movilización"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Notificar movilización",old); + + + ParallelGateway_1-CallActivity_14 + CallActivity_14-ParallelGateway_2 + + + + + + + + CallActivity_14_maiaInput + CallActivity_14_taskMetaDataInput + + + CallActivity_14_actualTaskOutput + CallActivity_14_maiaOutput + CallActivity_14_taskMetaDataOutput + + + + maia + CallActivity_14_maiaInput + + + taskMetaData + CallActivity_14_taskMetaDataInput + + + CallActivity_14_actualTaskOutput + actualTask + + + CallActivity_14_maiaOutput + maia + + + CallActivity_14_taskMetaDataOutput + taskMetaData + + + + ExclusiveGateway_2-ScriptTask_6 + ScriptTask_6-CallActivity_2 + //enviar mail al jefe del empleado +FlowUtil.executeClass(taskMetaData.getClassCode(), maia); +String action = maia.get("action")!=null ?""+maia.get("action"):null; +//System.out.println("Se ingresa al nodo notificar SP :" + action); +if(action == null || action.equals("A") ){ + FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefe", maia, taskMetaData, 107 , 108); +} + + + StartEvent_1-ScriptTask_1 + ScriptTask_1-ExclusiveGateway_1 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + ScriptTask_10-EndEvent_4 + + + + ExclusiveGateway_8-ScriptTask_10 + ScriptTask_10-EndEvent_4 + FlowUtil.endFlow(kcontext); + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",24, 1,30,"com.fp.viaticos.task.AsignarEmpleado", "Modificar empleado", 11, "OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + List old=(List)tasksMetaData.get("Modificar empleado"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Modificar empleado",old); + + + ExclusiveGateway_4-CallActivity_4 + CallActivity_4-ExclusiveGateway_8 + + + + + + + + CallActivity_4_maiaInput + CallActivity_4_taskMetaDataInput + + + CallActivity_4_actualTaskOutput + CallActivity_4_maiaOutput + CallActivity_4_taskMetaDataOutput + + + + maia + CallActivity_4_maiaInput + + + taskMetaData + CallActivity_4_taskMetaDataInput + + + CallActivity_4_actualTaskOutput + actualTask + + + CallActivity_4_maiaOutput + maia + + + CallActivity_4_taskMetaDataOutput + taskMetaData + + + + CallActivity_4-ExclusiveGateway_8 + ExclusiveGateway_8-ExclusiveGateway_1 + ExclusiveGateway_8-ScriptTask_10 + + + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("M".equals(taskMetaData.getResponse())); + + + + return ("M".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + return ("D".equals(taskMetaData.getResponse())); + + + + return ("A".equals(taskMetaData.getResponse())); + + + + return ("A".equals(taskMetaData.getResponse())); + + + + return ("D".equals(taskMetaData.getResponse())); + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30", 23, 1, 120, "com.fp.viaticos.task.AsignarEmpleado", "Generar Informe SP", 16, "OK_NO"); +kcontext.setVariable("taskMetaData", taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Empleado", maia, taskMetaData, 123, 124); + + + List old=(List)tasksMetaData.get("Generar Informe SP"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Generar Informe SP",old); + + + ExclusiveGateway_7-CallActivity_10 + CallActivity_10-ExclusiveGateway_9 + + + + + + + + CallActivity_10_maiaInput + CallActivity_10_taskMetaDataInput + + + CallActivity_10_actualTaskOutput + CallActivity_10_maiaOutput + CallActivity_10_taskMetaDataOutput + + + + maia + CallActivity_10_maiaInput + + + taskMetaData + CallActivity_10_taskMetaDataInput + + + CallActivity_10_actualTaskOutput + actualTask + + + CallActivity_10_maiaOutput + maia + + + CallActivity_10_taskMetaDataOutput + taskMetaData + + + + + CallActivity_10-ExclusiveGateway_9 + CallActivity_13-ExclusiveGateway_9 + ExclusiveGateway_9-CallActivity_11 + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",25, 1,120,"com.fp.viaticos.task.AsignarJefeInforme", "Autorizar informe JI", 17,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +//enviar mail al jefe del empleado + +FlowUtil.executeClass(taskMetaData.getClassCode(), maia); +String action = maia.get("action")!=null ?""+maia.get("action"):null; +if(action == null || action.equals("A") ){ + FlowUtil.mail("com.fp.viaticos.mail.JefeInforme", maia, taskMetaData, 125 , 126); +} + + + List old=(List)tasksMetaData.get("Autorizar informe JI"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Autorizar informe JI",old); + + + ExclusiveGateway_9-CallActivity_11 + CallActivity_11-ExclusiveGateway_10 + + + + + + + + CallActivity_11_maiaInput + CallActivity_11_taskMetaDataInput + + + CallActivity_11_actualTaskOutput + CallActivity_11_maiaOutput + CallActivity_11_taskMetaDataOutput + + + + maia + CallActivity_11_maiaInput + + + taskMetaData + CallActivity_11_taskMetaDataInput + + + CallActivity_11_actualTaskOutput + actualTask + + + CallActivity_11_maiaOutput + maia + + + CallActivity_11_taskMetaDataOutput + taskMetaData + + + + + CallActivity_11-ExclusiveGateway_10 + ExclusiveGateway_10-ScriptTask_13 + ExclusiveGateway_10-ScriptTask_14 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("M".equals(taskMetaData.getResponse())); + + + ExclusiveGateway_10-ScriptTask_14 + ScriptTask_14-ExclusiveGateway_11 + //enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefeInforme", maia, taskMetaData, 127 , 128); + + + + ExclusiveGateway_10-ScriptTask_13 + ScriptTask_13-CallActivity_12 + //enviar mail al jefe del empleado +FlowUtil.executeClass(taskMetaData.getClassCode(), maia); +String action = maia.get("action")!=null ?""+maia.get("action"):null; +//System.out.println("Se ingresa al nodo notificar SP :" + action); +if(action == null || action.equals("A") ){ + FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefeInforme", maia, taskMetaData, 129, 130); +} + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",39, 1,120,"com.fp.viaticos.task.AsignarSupervisiorInforme", "Autorizar informe RU", 17,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +//enviar mail al responsable de la unidad a la que pertenece del empleado +FlowUtil.mail("com.fp.viaticos.mail.ResponsableUnidadInforme", maia, taskMetaData, 125 , 126); + + + List old=(List)tasksMetaData.get("Autorizar informe RU"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Autorizar informe RU",old); + + + ScriptTask_13-CallActivity_12 + CallActivity_12-ExclusiveGateway_6 + + + + + + + + CallActivity_12_maiaInput + CallActivity_12_taskMetaDataInput + + + CallActivity_12_actualTaskOutput + CallActivity_12_maiaOutput + CallActivity_12_taskMetaDataOutput + + + + maia + CallActivity_12_maiaInput + + + taskMetaData + CallActivity_12_taskMetaDataInput + + + CallActivity_12_actualTaskOutput + actualTask + + + CallActivity_12_maiaOutput + maia + + + CallActivity_12_taskMetaDataOutput + taskMetaData + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",35, 1,30,"com.fp.viaticos.task.AsignarEmpleado", "Modificar informe SP", 20,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + List old=(List)tasksMetaData.get("Modificar informe SP"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Modificar informe SP",old); + + + ExclusiveGateway_11-CallActivity_13 + CallActivity_13-ExclusiveGateway_9 + + + + + + + + CallActivity_13_maiaInput + CallActivity_13_taskMetaDataInput + + + CallActivity_13_actualTaskOutput + CallActivity_13_maiaOutput + CallActivity_13_taskMetaDataOutput + + + + maia + CallActivity_13_maiaInput + + + taskMetaData + CallActivity_13_taskMetaDataInput + + + CallActivity_13_actualTaskOutput + actualTask + + + CallActivity_13_maiaOutput + maia + + + CallActivity_13_taskMetaDataOutput + taskMetaData + + + + + ScriptTask_14-ExclusiveGateway_11 + ScriptTask_16-ExclusiveGateway_11 + ExclusiveGateway_11-CallActivity_13 + + + + CallActivity_12-ExclusiveGateway_6 + ExclusiveGateway_6-ScriptTask_16 + ExclusiveGateway_6-ScriptTask_15 + + + return ("M".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + ExclusiveGateway_6-ScriptTask_16 + ScriptTask_16-ExclusiveGateway_11 + maia.put("cusuariobpm", taskMetaData.getUserId()); +//enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefeyResponsableUnidadInforme", maia, taskMetaData, 127 , 128); + + + + ExclusiveGateway_6-ScriptTask_15 + ScriptTask_15-ParallelGateway_5 + maia.put("cusuariobpm", taskMetaData.getUserId()); +//enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefeyResponsableUnidadInforme", maia, taskMetaData, 129 , 130); + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",37, 1,120,"com.fp.viaticos.task.AsignarTalentoHumano","Confirmar informe TH", 18,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.TalentoHumano", maia, taskMetaData, 131 , 132); + + + List old=(List)tasksMetaData.get("Confirmar informe TH"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar informe TH",old); + + + ParallelGateway_5-CallActivity_16 + CallActivity_16-ParallelGateway_6 + + + + + + + + CallActivity_16_maiaInput + CallActivity_16_taskMetaDataInput + + + CallActivity_16_actualTaskOutput + CallActivity_16_maiaOutput + CallActivity_16_taskMetaDataOutput + + + + maia + CallActivity_16_maiaInput + + + taskMetaData + CallActivity_16_taskMetaDataInput + + + CallActivity_16_actualTaskOutput + actualTask + + + CallActivity_16_maiaOutput + maia + + + CallActivity_16_taskMetaDataOutput + taskMetaData + + + + + ScriptTask_15-ParallelGateway_5 + ParallelGateway_5-CallActivity_16 + ParallelGateway_5-CallActivity_15 + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",36, 1,120,"com.fp.viaticos.task.AsignarTesoreria","Confirmar informe tesoreria" ,18,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 131 , 132); + + + List old=(List)tasksMetaData.get("Confirmar informe tesoreria"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar informe tesoreria",old); + + + ParallelGateway_5-CallActivity_15 + CallActivity_15-ParallelGateway_6 + + + + + + + + CallActivity_15_maiaInput + CallActivity_15_taskMetaDataInput + + + CallActivity_15_actualTaskOutput + CallActivity_15_maiaOutput + CallActivity_15_taskMetaDataOutput + + + + maia + CallActivity_15_maiaInput + + + taskMetaData + CallActivity_15_taskMetaDataInput + + + CallActivity_15_actualTaskOutput + actualTask + + + CallActivity_15_maiaOutput + maia + + + CallActivity_15_taskMetaDataOutput + taskMetaData + + + + + CallActivity_16-ParallelGateway_6 + CallActivity_15-ParallelGateway_6 + SequenceFlow_10 + + + ParallelGateway_3-ScriptTask_12 + ScriptTask_12-ParallelGateway_4 + //enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefe", maia, taskMetaData, 121 , 122); + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30", 32, 1, 120, "com.fp.viaticos.task.AsignarJefeComision", "Confirmar jefe inmediato", 14, "OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +//enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.Jefe", maia, taskMetaData, 117 , 118); + + + List old=(List)tasksMetaData.get("Confirmar jefe inmediato"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar jefe inmediato",old); + + + ExclusiveGateway_7-CallActivity_7 + CallActivity_7-ParallelGateway_3 + + + + + + + + CallActivity_7_maiaInput + CallActivity_7_taskMetaDataInput + + + CallActivity_7_actualTaskOutput + CallActivity_7_maiaOutput + CallActivity_7_taskMetaDataOutput + + + + maia + CallActivity_7_maiaInput + + + taskMetaData + CallActivity_7_taskMetaDataInput + + + CallActivity_7_actualTaskOutput + actualTask + + + CallActivity_7_maiaOutput + maia + + + CallActivity_7_taskMetaDataOutput + taskMetaData + + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",52, 1,120,"com.fp.viaticos.task.AsignarTesoreria", "Reajustar tesorería", 15,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 119 , 120); + + + + + + List old=(List)tasksMetaData.get("Reajustar tesorería"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Reajustar tesorería",old); + + + SequenceFlow_5 + SequenceFlow_6 + + + + + + + + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + DataOutput_3 + actualTask + + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",53, 1,120,"com.fp.viaticos.task.AsignarTesoreria", "Reajustar Movilización", 15,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 119 , 120); + + + + + + List old=(List)tasksMetaData.get("Reajustar Movilización"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Reajustar Movilización",old); + + + SequenceFlow_7 + SequenceFlow_8 + + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_4 + DataOutput_5 + DataOutput_6 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_4 + maia + + + DataOutput_5 + taskMetaData + + + DataOutput_6 + actualTask + + + + + + ParallelGateway_4-ScriptTask_11 + ScriptTask_11-EndEvent_3 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_9 + ParallelGateway_4-ScriptTask_11 + FlowUtil.mail("com.fp.viaticos.mail.Empleado", maia, taskMetaData, 137, 138); + + + + ScriptTask_11-EndEvent_3 + + + + ParallelGateway_6-ScriptTask_2 + ScriptTask_2-EndEvent_1 + FlowUtil.endFlow(kcontext); + + + + + SequenceFlow_10 + ParallelGateway_6-ScriptTask_2 + FlowUtil.mail("com.fp.viaticos.mail.Empleado", maia, taskMetaData, 135, 136); + + + + ScriptTask_2-EndEvent_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/flows/viaticosmanual.bpmn b/base/bpm/bpmlib/src/main/resources/flows/viaticosmanual.bpmn new file mode 100644 index 0000000..6ad7c04 --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/flows/viaticosmanual.bpmn @@ -0,0 +1,779 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",45, 1,120,"com.fp.viaticos.task.AsignarContabilidad", "Reajustar contabilidad", 15,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Contabilidad", maia, taskMetaData, 119 , 120); + + + List old=(List)tasksMetaData.get("Reajustar contabilidad"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Reajustar contabilidad",old); + + + + + + + + + + CallActivity_7_maiaInput + CallActivity_7_taskMetaDataInput + + + CallActivity_7_actualTaskOutput + CallActivity_7_maiaOutput + CallActivity_7_taskMetaDataOutput + + + + maia + CallActivity_7_maiaInput + + + taskMetaData + CallActivity_7_taskMetaDataInput + + + CallActivity_7_actualTaskOutput + actualTask + + + CallActivity_7_maiaOutput + maia + + + CallActivity_7_taskMetaDataOutput + taskMetaData + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",46, 1,120,"com.fp.viaticos.task.AsignarTalentoHumano", "Reajustar talento humano", 15,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.TalentoHumano", maia, taskMetaData, 119 , 120); + + + List old=(List)tasksMetaData.get("Reajustar talento humano"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Reajustar talento humano",old); + + + + + + + + + + CallActivity_8_maiaInput + CallActivity_8_taskMetaDataInput + + + CallActivity_8_actualTaskOutput + CallActivity_8_maiaOutput + CallActivity_8_taskMetaDataOutput + + + + maia + CallActivity_8_maiaInput + + + taskMetaData + CallActivity_8_taskMetaDataInput + + + CallActivity_8_actualTaskOutput + actualTask + + + CallActivity_8_maiaOutput + maia + + + CallActivity_8_taskMetaDataOutput + taskMetaData + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30", 41, 1, 120, "com.fp.viaticos.task.AsignarUsuarioIngresaSolicitud", "Generar Informe UI", 16, "OK_NO"); +kcontext.setVariable("taskMetaData", taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Empleado", maia, taskMetaData, 123, 124); + + + List old=(List)tasksMetaData.get("Generar Informe UI"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Generar Informe UI",old); + + + + + + + + + + CallActivity_5_maiaInput + CallActivity_5_taskMetaDataInput + + + CallActivity_5_actualTaskOutput + CallActivity_5_maiaOutput + CallActivity_5_taskMetaDataOutput + + + + maia + CallActivity_5_maiaInput + + + taskMetaData + CallActivity_5_taskMetaDataInput + + + CallActivity_5_actualTaskOutput + actualTask + + + CallActivity_5_maiaOutput + maia + + + CallActivity_5_taskMetaDataOutput + taskMetaData + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",44, 1,120,"com.fp.viaticos.task.AsignarTalentoHumano","Confirmar informe TH", 18,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.TalentoHumano", maia, taskMetaData, 131 , 132); + + + List old=(List)tasksMetaData.get("Confirmar informe TH"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar informe TH",old); + + + + + + + + + + CallActivity_10_maiaInput + CallActivity_10_taskMetaDataInput + + + CallActivity_10_actualTaskOutput + CallActivity_10_maiaOutput + CallActivity_10_taskMetaDataOutput + + + + maia + CallActivity_10_maiaInput + + + taskMetaData + CallActivity_10_taskMetaDataInput + + + CallActivity_10_actualTaskOutput + actualTask + + + CallActivity_10_maiaOutput + maia + + + CallActivity_10_taskMetaDataOutput + taskMetaData + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",42, 1,120,"com.fp.viaticos.task.AsignarTesoreria","Confirmar informe tesoreria" ,18,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 131 , 132); + + + List old=(List)tasksMetaData.get("Confirmar informe tesoreria"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar informe tesoreria",old); + + + + + + + + + + CallActivity_9_maiaInput + CallActivity_9_taskMetaDataInput + + + CallActivity_9_actualTaskOutput + CallActivity_9_maiaOutput + CallActivity_9_taskMetaDataOutput + + + + maia + CallActivity_9_maiaInput + + + taskMetaData + CallActivity_9_taskMetaDataInput + + + CallActivity_9_actualTaskOutput + actualTask + + + CallActivity_9_maiaOutput + maia + + + CallActivity_9_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",47, 1,120,"com.fp.viaticos.task.AsignarUsuarioIngresaSolicitud", "Confirmar comision UI", 13,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.UsaurioIngresoSolicitud", maia, taskMetaData, 115 , 116); + + + List old=(List)tasksMetaData.get("Confirmar comision UI"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar comision UI",old); + + + + + + + + + + CallActivity_4_maiaInput + CallActivity_4_taskMetaDataInput + + + CallActivity_4_actualTaskOutput + CallActivity_4_maiaOutput + CallActivity_4_taskMetaDataOutput + + + + maia + CallActivity_4_maiaInput + + + taskMetaData + CallActivity_4_taskMetaDataInput + + + CallActivity_4_actualTaskOutput + actualTask + + + CallActivity_4_maiaOutput + maia + + + CallActivity_4_taskMetaDataOutput + taskMetaData + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",43, 1,120,"com.fp.viaticos.task.AsignarTalentoHumano", "Confirmar talento humano", 12,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.TalentoHumano", maia, taskMetaData, 113 , 114); + + + List old=(List)tasksMetaData.get("Confirmar talento humano"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confimar talento humano",old); + + + + + + + + + + CallActivity_3_maiaInput + CallActivity_3_taskMetaDataInput + + + CallActivity_3_actualTaskOutput + CallActivity_3_maiaOutput + CallActivity_3_taskMetaDataOutput + + + + maia + CallActivity_3_maiaInput + + + taskMetaData + CallActivity_3_taskMetaDataInput + + + CallActivity_3_actualTaskOutput + actualTask + + + CallActivity_3_maiaOutput + maia + + + CallActivity_3_taskMetaDataOutput + taskMetaData + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",40, 1,120,"com.fp.viaticos.task.AsignarTesoreria", "Confirmar tesorería", 12,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 113 , 114); + + + List old=(List)tasksMetaData.get("Confirmar tesorería"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar tesorería",old); + + + + + + + + + + CallActivity_2_maiaInput + CallActivity_2_taskMetaDataInput + + + CallActivity_2_actualTaskOutput + CallActivity_2_maiaOutput + CallActivity_2_taskMetaDataOutput + + + + maia + CallActivity_2_maiaInput + + + taskMetaData + CallActivity_2_taskMetaDataInput + + + CallActivity_2_actualTaskOutput + actualTask + + + CallActivity_2_maiaOutput + maia + + + CallActivity_2_taskMetaDataOutput + taskMetaData + + + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",40, 1,120,"com.fp.viaticos.task.AsignarTesoreria", "Confirmar movilización", 19,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 133 , 134); + + + List old=(List)tasksMetaData.get("Confirmar movilización"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Notificar movilización",old); + + + + + + + + + + CallActivity_11_maiaInput + CallActivity_11_taskMetaDataInput + + + CallActivity_11_actualTaskOutput + CallActivity_11_maiaOutput + CallActivity_11_taskMetaDataOutput + + + + maia + CallActivity_11_maiaInput + + + taskMetaData + CallActivity_11_taskMetaDataInput + + + CallActivity_11_actualTaskOutput + actualTask + + + CallActivity_11_maiaOutput + maia + + + CallActivity_11_taskMetaDataOutput + taskMetaData + + + + + + + return ("D".equals(taskMetaData.getResponse())); + + + + + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/src/main/resources/rules/.svn/entries b/base/bpm/bpmlib/src/main/resources/rules/.svn/entries new file mode 100644 index 0000000..53ce96d --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/rules/.svn/entries @@ -0,0 +1,368 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/main/resources/rules +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ASIGNAROFICIAL.xls +file + + + + +2022-07-28T03:40:46.189818Z +64c86e6090f809b4a267d86cfef6566c +2014-09-11T06:03:34.339088Z +654 +jvaca +has-props + + + + + + + + + + + + + + + + + + + + +20992 + +VALIDAPERSONAS.xls +file + + + + +2022-07-28T03:40:46.190818Z +f97de50bca8ede1218d30117e5649db5 +2014-09-11T06:03:34.339088Z +654 +jvaca +has-props + + + + + + + + + + + + + + + + + + + + +20992 + +rcatalogo.xls +file + + + + +2022-07-28T03:40:46.190818Z +bf092fb3706630ec280a2215dcf4400f +2014-09-11T06:03:34.339088Z +654 +jvaca +has-props + + + + + + + + + + + + + + + + + + + + +20992 + +gf.xls +file + + + + +2022-07-28T03:40:46.190818Z +0f767b860f18fa00f5bf08e61c0a464f +2014-09-11T06:03:34.339088Z +654 +jvaca +has-props + + + + + + + + + + + + + + + + + + + + +20992 + +VALIDAMONTO.xls +file + + + + +2022-07-28T03:40:46.191818Z +6a26eeac63572ce1bc6b7d1398bf8107 +2014-09-11T06:03:34.339088Z +654 +jvaca +has-props + + + + + + + + + + + + + + + + + + + + +8704 + +ASIGNARCOMITE.xls +file + + + + +2022-07-28T03:40:46.191818Z +c4de6ce23631b2e531c490c310b699d8 +2014-09-11T06:03:34.339088Z +654 +jvaca +has-props + + + + + + + + + + + + + + + + + + + + +7680 + +VALIDAPLAZO.xls +file + + + + +2022-07-28T03:40:46.191818Z +481930a6faa5bed3fa47f01ac176c0ef +2014-09-11T06:03:34.339088Z +654 +jvaca +has-props + + + + + + + + + + + + + + + + + + + + +8704 + +WPA.xls +file + + + + +2022-07-28T03:40:46.192818Z +836597177f0b924c5ac6d7b518a51e64 +2014-09-11T06:03:34.339088Z +654 +jvaca +has-props + + + + + + + + + + + + + + + + + + + + +21504 + +VALIDATASA.xls +file + + + + +2022-07-28T03:40:46.192818Z +cfd16d7bb09d5a6de96a867090339091 +2014-09-11T06:03:34.339088Z +654 +jvaca +has-props + + + + + + + + + + + + + + + + + + + + +8704 + +catalogo.xls +file + + + + +2022-07-28T03:40:46.192818Z +6956e144423169ff0bcc5b8395450dfe +2014-09-11T06:03:34.339088Z +654 +jvaca +has-props + + + + + + + + + + + + + + + + + + + + +20992 + diff --git a/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/ASIGNARCOMITE.xls.svn-base b/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/ASIGNARCOMITE.xls.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/ASIGNARCOMITE.xls.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/ASIGNAROFICIAL.xls.svn-base b/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/ASIGNAROFICIAL.xls.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/ASIGNAROFICIAL.xls.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/VALIDAMONTO.xls.svn-base b/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/VALIDAMONTO.xls.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/VALIDAMONTO.xls.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/VALIDAPERSONAS.xls.svn-base b/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/VALIDAPERSONAS.xls.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/VALIDAPERSONAS.xls.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/VALIDAPLAZO.xls.svn-base b/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/VALIDAPLAZO.xls.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/VALIDAPLAZO.xls.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/VALIDATASA.xls.svn-base b/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/VALIDATASA.xls.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/VALIDATASA.xls.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/WPA.xls.svn-base b/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/WPA.xls.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/WPA.xls.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/catalogo.xls.svn-base b/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/catalogo.xls.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/catalogo.xls.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/gf.xls.svn-base b/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/gf.xls.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/gf.xls.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/rcatalogo.xls.svn-base b/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/rcatalogo.xls.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/base/bpm/bpmlib/src/main/resources/rules/.svn/prop-base/rcatalogo.xls.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/ASIGNARCOMITE.xls.svn-base b/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/ASIGNARCOMITE.xls.svn-base new file mode 100644 index 0000000..35c18ba Binary files /dev/null and b/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/ASIGNARCOMITE.xls.svn-base differ diff --git a/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/ASIGNAROFICIAL.xls.svn-base b/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/ASIGNAROFICIAL.xls.svn-base new file mode 100644 index 0000000..a0712ec Binary files /dev/null and b/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/ASIGNAROFICIAL.xls.svn-base differ diff --git a/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/VALIDAMONTO.xls.svn-base b/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/VALIDAMONTO.xls.svn-base new file mode 100644 index 0000000..8164450 Binary files /dev/null and b/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/VALIDAMONTO.xls.svn-base differ diff --git a/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/VALIDAPERSONAS.xls.svn-base b/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/VALIDAPERSONAS.xls.svn-base new file mode 100644 index 0000000..f329c59 Binary files /dev/null and b/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/VALIDAPERSONAS.xls.svn-base differ diff --git a/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/VALIDAPLAZO.xls.svn-base b/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/VALIDAPLAZO.xls.svn-base new file mode 100644 index 0000000..4d2d847 Binary files /dev/null and b/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/VALIDAPLAZO.xls.svn-base differ diff --git a/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/VALIDATASA.xls.svn-base b/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/VALIDATASA.xls.svn-base new file mode 100644 index 0000000..e81c241 Binary files /dev/null and b/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/VALIDATASA.xls.svn-base differ diff --git a/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/WPA.xls.svn-base b/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/WPA.xls.svn-base new file mode 100644 index 0000000..d293142 Binary files /dev/null and b/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/WPA.xls.svn-base differ diff --git a/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/catalogo.xls.svn-base b/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/catalogo.xls.svn-base new file mode 100644 index 0000000..88160e2 Binary files /dev/null and b/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/catalogo.xls.svn-base differ diff --git a/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/gf.xls.svn-base b/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/gf.xls.svn-base new file mode 100644 index 0000000..6f58a9b Binary files /dev/null and b/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/gf.xls.svn-base differ diff --git a/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/rcatalogo.xls.svn-base b/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/rcatalogo.xls.svn-base new file mode 100644 index 0000000..fd31dd8 Binary files /dev/null and b/base/bpm/bpmlib/src/main/resources/rules/.svn/text-base/rcatalogo.xls.svn-base differ diff --git a/base/bpm/bpmlib/src/main/resources/rules/ASIGNARCOMITE.xls b/base/bpm/bpmlib/src/main/resources/rules/ASIGNARCOMITE.xls new file mode 100644 index 0000000..35c18ba Binary files /dev/null and b/base/bpm/bpmlib/src/main/resources/rules/ASIGNARCOMITE.xls differ diff --git a/base/bpm/bpmlib/src/main/resources/rules/ASIGNAROFICIAL.xls b/base/bpm/bpmlib/src/main/resources/rules/ASIGNAROFICIAL.xls new file mode 100644 index 0000000..a0712ec Binary files /dev/null and b/base/bpm/bpmlib/src/main/resources/rules/ASIGNAROFICIAL.xls differ diff --git a/base/bpm/bpmlib/src/main/resources/rules/VALIDAMONTO.xls b/base/bpm/bpmlib/src/main/resources/rules/VALIDAMONTO.xls new file mode 100644 index 0000000..8164450 Binary files /dev/null and b/base/bpm/bpmlib/src/main/resources/rules/VALIDAMONTO.xls differ diff --git a/base/bpm/bpmlib/src/main/resources/rules/VALIDAPERSONAS.xls b/base/bpm/bpmlib/src/main/resources/rules/VALIDAPERSONAS.xls new file mode 100644 index 0000000..f329c59 Binary files /dev/null and b/base/bpm/bpmlib/src/main/resources/rules/VALIDAPERSONAS.xls differ diff --git a/base/bpm/bpmlib/src/main/resources/rules/VALIDAPLAZO.xls b/base/bpm/bpmlib/src/main/resources/rules/VALIDAPLAZO.xls new file mode 100644 index 0000000..4d2d847 Binary files /dev/null and b/base/bpm/bpmlib/src/main/resources/rules/VALIDAPLAZO.xls differ diff --git a/base/bpm/bpmlib/src/main/resources/rules/VALIDATASA.xls b/base/bpm/bpmlib/src/main/resources/rules/VALIDATASA.xls new file mode 100644 index 0000000..e81c241 Binary files /dev/null and b/base/bpm/bpmlib/src/main/resources/rules/VALIDATASA.xls differ diff --git a/base/bpm/bpmlib/src/main/resources/rules/WPA.xls b/base/bpm/bpmlib/src/main/resources/rules/WPA.xls new file mode 100644 index 0000000..d293142 Binary files /dev/null and b/base/bpm/bpmlib/src/main/resources/rules/WPA.xls differ diff --git a/base/bpm/bpmlib/src/main/resources/rules/catalogo.xls b/base/bpm/bpmlib/src/main/resources/rules/catalogo.xls new file mode 100644 index 0000000..88160e2 Binary files /dev/null and b/base/bpm/bpmlib/src/main/resources/rules/catalogo.xls differ diff --git a/base/bpm/bpmlib/src/main/resources/rules/gf.xls b/base/bpm/bpmlib/src/main/resources/rules/gf.xls new file mode 100644 index 0000000..6f58a9b Binary files /dev/null and b/base/bpm/bpmlib/src/main/resources/rules/gf.xls differ diff --git a/base/bpm/bpmlib/src/main/resources/rules/rcatalogo.xls b/base/bpm/bpmlib/src/main/resources/rules/rcatalogo.xls new file mode 100644 index 0000000..fd31dd8 Binary files /dev/null and b/base/bpm/bpmlib/src/main/resources/rules/rcatalogo.xls differ diff --git a/base/bpm/bpmlib/src/test/.svn/entries b/base/bpm/bpmlib/src/test/.svn/entries new file mode 100644 index 0000000..b602903 --- /dev/null +++ b/base/bpm/bpmlib/src/test/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/test +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/bpm/bpmlib/src/test/java/.svn/entries b/base/bpm/bpmlib/src/test/java/.svn/entries new file mode 100644 index 0000000..5e2384a --- /dev/null +++ b/base/bpm/bpmlib/src/test/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/test/java +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + diff --git a/base/bpm/bpmlib/src/test/java/test/.svn/entries b/base/bpm/bpmlib/src/test/java/test/.svn/entries new file mode 100644 index 0000000..429a989 --- /dev/null +++ b/base/bpm/bpmlib/src/test/java/test/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/test/java/test +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/bpm/bpmlib/src/test/java/test/com/.svn/entries b/base/bpm/bpmlib/src/test/java/test/com/.svn/entries new file mode 100644 index 0000000..79fbbde --- /dev/null +++ b/base/bpm/bpmlib/src/test/java/test/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/test/java/test/com +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/bpm/bpmlib/src/test/java/test/com/fp/.svn/entries b/base/bpm/bpmlib/src/test/java/test/com/fp/.svn/entries new file mode 100644 index 0000000..c7108aa --- /dev/null +++ b/base/bpm/bpmlib/src/test/java/test/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/test/java/test/com/fp +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +bpmlib +dir + diff --git a/base/bpm/bpmlib/src/test/java/test/com/fp/bpmlib/.svn/entries b/base/bpm/bpmlib/src/test/java/test/com/fp/bpmlib/.svn/entries new file mode 100644 index 0000000..6243025 --- /dev/null +++ b/base/bpm/bpmlib/src/test/java/test/com/fp/bpmlib/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/test/java/test/com/fp/bpmlib +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +package-info.java +file + + + + +2022-07-28T03:40:45.269814Z +d5748f34e1544f20335de32a1b76e551 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +78 + diff --git a/base/bpm/bpmlib/src/test/java/test/com/fp/bpmlib/.svn/text-base/package-info.java.svn-base b/base/bpm/bpmlib/src/test/java/test/com/fp/bpmlib/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..d7e6b5b --- /dev/null +++ b/base/bpm/bpmlib/src/test/java/test/com/fp/bpmlib/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,4 @@ +/** + * Provee las clases de Pruebas de Unidad. + */ +package test.com.fp.bpmlib; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/test/java/test/com/fp/bpmlib/package-info.java b/base/bpm/bpmlib/src/test/java/test/com/fp/bpmlib/package-info.java new file mode 100644 index 0000000..d7e6b5b --- /dev/null +++ b/base/bpm/bpmlib/src/test/java/test/com/fp/bpmlib/package-info.java @@ -0,0 +1,4 @@ +/** + * Provee las clases de Pruebas de Unidad. + */ +package test.com.fp.bpmlib; \ No newline at end of file diff --git a/base/bpm/bpmlib/src/test/resources/.svn/entries b/base/bpm/bpmlib/src/test/resources/.svn/entries new file mode 100644 index 0000000..c24bab2 --- /dev/null +++ b/base/bpm/bpmlib/src/test/resources/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/bpmlib/src/test/resources +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/bpm/bpmlib/target/bpmlib-2.1.jar b/base/bpm/bpmlib/target/bpmlib-2.1.jar new file mode 100644 index 0000000..c8fe5b0 Binary files /dev/null and b/base/bpm/bpmlib/target/bpmlib-2.1.jar differ diff --git a/base/bpm/bpmlib/target/classes/ChangeSet.xml b/base/bpm/bpmlib/target/classes/ChangeSet.xml new file mode 100644 index 0000000..c9cb3fa --- /dev/null +++ b/base/bpm/bpmlib/target/classes/ChangeSet.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/bpmmessages.properties b/base/bpm/bpmlib/target/classes/bpmmessages.properties new file mode 100644 index 0000000..8b79cc2 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/bpmmessages.properties @@ -0,0 +1,31 @@ +BPM-0001=LA REGLA {0} NO PUDO SER ENCONTRADA +BPM-0002=LA REGLA {0} NO PUEDE SER EVALUADA CON {1} +BPM-0003=LA REGLA {0} NO ESTA DISPONIBLE +BPM-0004=LA INSTANCIA {0} NO ESTA DISPONIBLE O YA FUE FINALIZADA +BPM-0005=EL FLUJO {0} NO ESTA FINALIZADO +BPM-0006=SE HA INICIADO UN FLUJO DE AUTORIZACION +BPM-0007=EL SERVIDOR DE TAREAS YA SE ENCUENTRA INICIADO +BPM-0008=NO SE HA ENCONTRADO LA TAREA {0} +BPM-0009=NO SE HA PODIDO ESTABLECER LA CONEXION CON EL SERVIDOR {0}:{1} +BPM-0010=NO SE HA PODIDO INICIAR EL FLUJO +BPM-0011=NO SE HA PODIDO ENCONTRAR LA PLANTILLA {0} + +#Etiquetas reporte excel Exportar flujos +lbl_description=DESCRIPCI\u00d3N +lbl_branch=SUCURSAL +lbl_office=OFICINA +lbl_terminal=TERMINAL +lbl_user=USUARIO +lbl_module=MODULO +lbl_transflow=TRANSACCI\u00d3N ORIGINADORA DEL FLUJO +lbl_activityname=NOMBRE ACTIVIDAD +lbl_sequence=SECUENCIA +lbl_userasigned=USUARIO ASIGNADO +lbl_groupAsign=GRUPO ASIGNADO +lbl_created=CREACI\u00d3N +lbl_started=FECHA INICIO +lbl_completed=FECHA FIN +lbl_expectedtime=TIEMPO ESTIMADO +lbl_response=RESPUESTA +lbl_task=TAREA +lbl_duracion=DURACI\u00d3N \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/change-set.xml b/base/bpm/bpmlib/target/classes/change-set.xml new file mode 100644 index 0000000..eeedb65 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/change-set.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/Common.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/Common.class new file mode 100644 index 0000000..8c1c90a Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/Common.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/CustomSystemEventListener.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/CustomSystemEventListener.class new file mode 100644 index 0000000..299b0e5 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/CustomSystemEventListener.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/Flujo.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/Flujo.class new file mode 100644 index 0000000..88f3ba5 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/Flujo.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/ProcessUtil.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/ProcessUtil.class new file mode 100644 index 0000000..60cfe4a Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/ProcessUtil.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/RegisterFlow.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/RegisterFlow.class new file mode 100644 index 0000000..2cbc3d4 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/RegisterFlow.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/db/BPMProperties.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/db/BPMProperties.class new file mode 100644 index 0000000..70cadf1 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/db/BPMProperties.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/db/DataHelper.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/db/DataHelper.class new file mode 100644 index 0000000..bfc56da Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/db/DataHelper.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/ejb/JbpmBean.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/ejb/JbpmBean.class new file mode 100644 index 0000000..393dbf5 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/ejb/JbpmBean.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/ejb/LogMailBean.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/ejb/LogMailBean.class new file mode 100644 index 0000000..7a5dcb2 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/ejb/LogMailBean.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/ejb/local/JbpmBeanLocal.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/ejb/local/JbpmBeanLocal.class new file mode 100644 index 0000000..e93139f Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/ejb/local/JbpmBeanLocal.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/ejb/local/LogMailBeanLocal.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/ejb/local/LogMailBeanLocal.class new file mode 100644 index 0000000..ba11a7a Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/ejb/local/LogMailBeanLocal.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/flow/FlowUtil.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/flow/FlowUtil.class new file mode 100644 index 0000000..0c8a5a8 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/flow/FlowUtil.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/flow/Monitor.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/flow/Monitor.class new file mode 100644 index 0000000..8d7a10c Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/flow/Monitor.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/flow/RuleUtil.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/flow/RuleUtil.class new file mode 100644 index 0000000..a44d1b1 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/flow/RuleUtil.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/mail/MailCommand.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/mail/MailCommand.class new file mode 100644 index 0000000..df459f3 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/mail/MailCommand.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/mail/MailParameters.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/mail/MailParameters.class new file mode 100644 index 0000000..6455f5c Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/mail/MailParameters.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/mail/MailThread.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/mail/MailThread.class new file mode 100644 index 0000000..51160ff Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/mail/MailThread.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/mail/MailThreadWithAttachment.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/mail/MailThreadWithAttachment.class new file mode 100644 index 0000000..85105e7 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/mail/MailThreadWithAttachment.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/mail/Mailer.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/mail/Mailer.class new file mode 100644 index 0000000..dd4c234 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/mail/Mailer.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/messages/MessageManager.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/messages/MessageManager.class new file mode 100644 index 0000000..721399e Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/messages/MessageManager.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/EndedFlowDetail.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/EndedFlowDetail.class new file mode 100644 index 0000000..eabc8c4 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/EndedFlowDetail.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/EndedFlows.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/EndedFlows.class new file mode 100644 index 0000000..b8d7cb7 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/EndedFlows.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/EndedFlowsResults.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/EndedFlowsResults.class new file mode 100644 index 0000000..94abb6e Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/EndedFlowsResults.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/RuleTrigger.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/RuleTrigger.class new file mode 100644 index 0000000..f2c2013 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/RuleTrigger.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/TransactionLogResults.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/TransactionLogResults.class new file mode 100644 index 0000000..7766a43 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/TransactionLogResults.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/TransactionsLog.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/TransactionsLog.class new file mode 100644 index 0000000..ff52524 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/TransactionsLog.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/groups/UserLov.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/groups/UserLov.class new file mode 100644 index 0000000..04915f9 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/groups/UserLov.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/groups/UserToGroup.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/groups/UserToGroup.class new file mode 100644 index 0000000..b418cf2 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/groups/UserToGroup.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/inbox/TaskDetail.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/inbox/TaskDetail.class new file mode 100644 index 0000000..54269e0 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/inbox/TaskDetail.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/inbox/TransactionList.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/inbox/TransactionList.class new file mode 100644 index 0000000..5dd2687 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/inbox/TransactionList.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/inbox/TransactionListGroup.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/inbox/TransactionListGroup.class new file mode 100644 index 0000000..91947d6 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/inbox/TransactionListGroup.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/inbox/TransactionTasks.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/inbox/TransactionTasks.class new file mode 100644 index 0000000..e8ada00 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/inbox/TransactionTasks.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/inbox/TransactionTasksGroup.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/inbox/TransactionTasksGroup.class new file mode 100644 index 0000000..7cb15f2 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/inbox/TransactionTasksGroup.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/monitor/FlowActivitySave.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/monitor/FlowActivitySave.class new file mode 100644 index 0000000..dffb596 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/monitor/FlowActivitySave.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/monitor/FlowEnd.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/monitor/FlowEnd.class new file mode 100644 index 0000000..b406e7e Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/monitor/FlowEnd.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/monitor/FlowMonitor.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/monitor/FlowMonitor.class new file mode 100644 index 0000000..fcff6c4 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/monitor/FlowMonitor.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/rules/RefreshKnowledgeBase.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/rules/RefreshKnowledgeBase.class new file mode 100644 index 0000000..4befae2 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/rules/RefreshKnowledgeBase.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/rules/Rules.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/rules/Rules.class new file mode 100644 index 0000000..62f11af Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/rules/Rules.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/solicitud/EstadoSolicitudQuery.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/solicitud/EstadoSolicitudQuery.class new file mode 100644 index 0000000..3fed293 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/solicitud/EstadoSolicitudQuery.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/AsignedTasks.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/AsignedTasks.class new file mode 100644 index 0000000..e993b79 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/AsignedTasks.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/ClaimTask.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/ClaimTask.class new file mode 100644 index 0000000..66cdbab Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/ClaimTask.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/CompleteTask.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/CompleteTask.class new file mode 100644 index 0000000..89f9eb7 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/CompleteTask.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/StartTask.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/StartTask.class new file mode 100644 index 0000000..ba5d5ff Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/StartTask.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/TaskDetail.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/TaskDetail.class new file mode 100644 index 0000000..c4a4def Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/TaskDetail.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/TaskHistory.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/TaskHistory.class new file mode 100644 index 0000000..7f97168 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/TaskHistory.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/TaskPending.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/TaskPending.class new file mode 100644 index 0000000..7044906 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/TaskPending.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/TaskServerStatus.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/TaskServerStatus.class new file mode 100644 index 0000000..fa772eb Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/query/task/TaskServerStatus.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/report/DownloadFileQuery.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/report/DownloadFileQuery.class new file mode 100644 index 0000000..c03f709 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/report/DownloadFileQuery.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/report/ExportFlows.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/report/ExportFlows.class new file mode 100644 index 0000000..16d4985 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/report/ExportFlows.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/MaiaWorkItemHandler.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/MaiaWorkItemHandler.class new file mode 100644 index 0000000..b1f552e Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/MaiaWorkItemHandler.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/TaskCleaner.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/TaskCleaner.class new file mode 100644 index 0000000..a2ca535 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/TaskCleaner.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/TaskUser.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/TaskUser.class new file mode 100644 index 0000000..af73fcd Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/TaskUser.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/client/HumanTaskClient.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/client/HumanTaskClient.class new file mode 100644 index 0000000..d9d8535 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/client/HumanTaskClient.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/client/TaskUtil.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/client/TaskUtil.class new file mode 100644 index 0000000..4165e2f Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/client/TaskUtil.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/util/CustomDeploymentService.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/util/CustomDeploymentService.class new file mode 100644 index 0000000..1f54c3e Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/util/CustomDeploymentService.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/util/CustomIdentityProvider.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/util/CustomIdentityProvider.class new file mode 100644 index 0000000..34f0f08 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/util/CustomIdentityProvider.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/util/MaiaApplicationScopeProducer.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/util/MaiaApplicationScopeProducer.class new file mode 100644 index 0000000..36782c6 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/util/MaiaApplicationScopeProducer.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/util/MaiaUserGroupCallback.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/util/MaiaUserGroupCallback.class new file mode 100644 index 0000000..b77b733 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/util/MaiaUserGroupCallback.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/util/SimpleWorkItemHandlerProducer.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/util/SimpleWorkItemHandlerProducer.class new file mode 100644 index 0000000..130031e Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/task/util/SimpleWorkItemHandlerProducer.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/GuvnorAuthenticator.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/GuvnorAuthenticator.class new file mode 100644 index 0000000..88aa9c7 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/GuvnorAuthenticator.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/PackageGetter.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/PackageGetter.class new file mode 100644 index 0000000..3a901c9 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/PackageGetter.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/RuleTrigger.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/RuleTrigger.class new file mode 100644 index 0000000..8198843 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/RuleTrigger.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/flow/StartFlow.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/flow/StartFlow.class new file mode 100644 index 0000000..a2f953e Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/flow/StartFlow.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/flow/StartFlowEnd.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/flow/StartFlowEnd.class new file mode 100644 index 0000000..a69a060 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/flow/StartFlowEnd.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/flow/StartFlowEndNewOnly.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/flow/StartFlowEndNewOnly.class new file mode 100644 index 0000000..2252ab1 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/flow/StartFlowEndNewOnly.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/flow/StartFlowMemory.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/flow/StartFlowMemory.class new file mode 100644 index 0000000..d5f7ca7 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/flow/StartFlowMemory.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/flow/StartFlowMemoryNewOnly.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/flow/StartFlowMemoryNewOnly.class new file mode 100644 index 0000000..2aa2c77 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/flow/StartFlowMemoryNewOnly.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/flow/StartFlowNewOnly.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/flow/StartFlowNewOnly.class new file mode 100644 index 0000000..aa54c6a Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/flow/StartFlowNewOnly.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/AddGroups.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/AddGroups.class new file mode 100644 index 0000000..d290261 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/AddGroups.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/AddResource.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/AddResource.class new file mode 100644 index 0000000..338390a Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/AddResource.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/AddUsers.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/AddUsers.class new file mode 100644 index 0000000..1955a1a Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/AddUsers.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/ServerManager.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/ServerManager.class new file mode 100644 index 0000000..46e9496 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/ServerManager.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/TaskClaim.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/TaskClaim.class new file mode 100644 index 0000000..6cd8fda Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/TaskClaim.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/TaskComments.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/TaskComments.class new file mode 100644 index 0000000..b1f19ea Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/TaskComments.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/TaskComplete.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/TaskComplete.class new file mode 100644 index 0000000..e08cd1b Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/TaskComplete.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/TaskDelegate.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/TaskDelegate.class new file mode 100644 index 0000000..2aab56f Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/TaskDelegate.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/TaskStart.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/TaskStart.class new file mode 100644 index 0000000..5426172 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/TaskStart.class differ diff --git a/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/TaskUpdater.class b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/TaskUpdater.class new file mode 100644 index 0000000..d2482a0 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/com/fp/bpmlib/transaction/task/TaskUpdater.class differ diff --git a/base/bpm/bpmlib/target/classes/flows.xml b/base/bpm/bpmlib/target/classes/flows.xml new file mode 100644 index 0000000..eeedb65 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/casoprueba.bpmn b/base/bpm/bpmlib/target/classes/flows/casoprueba.bpmn new file mode 100644 index 0000000..262944a --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/casoprueba.bpmn @@ -0,0 +1,596 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + + System.out.println("DESEMBOLSO *****************************"); +taskMetaData=FlowUtil.createTaskInfo("13",514, 1,10,"ASIGNAROFICIAL",Kind.OK); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Desembolso",actualTask); + + + _31-_32 + _32-_18 + + + + + + + + _32_maiaInput + _32_taskMetaDataInput + + + _32_actualTaskOutput + _32_maiaOutput + _32_taskMetaDataOutput + + + + maia + _32_maiaInput + + + taskMetaData + _32_taskMetaDataInput + + + _32_actualTaskOutput + actualTask + + + _32_maiaOutput + maia + + + _32_taskMetaDataOutput + taskMetaData + + + + + + System.out.println(">>>>>>>>>>Valida Personas"); +taskMetaData=FlowUtil.createTaskInfo("13",518, 1,10,"VALIDAPERSONAS",Kind.OK); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Validar Personas",actualTask); +System.out.println(">>>>>>>Validar Personas>>>>"+taskMetaData.getResponse()); + + + _15-_5 + _5-_17 + + + + + + + + _5_maiaInput + _5_taskMetaDataInput + + + _5_actualTaskOutput + _5_maiaOutput + _5_taskMetaDataOutput + + + + maia + _5_maiaInput + + + taskMetaData + _5_taskMetaDataInput + + + _5_actualTaskOutput + actualTask + + + _5_maiaOutput + maia + + + _5_taskMetaDataOutput + taskMetaData + + + + _16-_12 + + + + _1-_15 + _15-_5 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + _5-_17 + _17-_19 + _17-_18 + + + _18-_16 + _16-_12 + FlowUtil.endFlow(kcontext); + + + _17-_19 + _19-_23 + _19-_25 + _19-_24 + + + _17-_18 + _31-_18 + _32-_18 + _27-_18 + _28-_18 + _26-_18 + _18-_16 + + + + + taskMetaDataVM=FlowUtil.createTaskInfo("13",499, 1,10,"VALIDAMONTO",Kind.OK_NO); +kcontext.setVariable("taskMetaDataVM",taskMetaDataVM); +System.out.println(">>>>>ValidaMonto "+taskMetaDataVM); + + + tasksMetaData.put("V.Monto",actualTaskVM); + + + _19-_23 + _23-_26 + + + + + + + + _23_maiaInput + _23_taskMetaDataInput + + + _23_actualTaskOutput + _23_maiaOutput + _23_taskMetaDataOutput + + + + maia + _23_maiaInput + + + taskMetaDataVM + _23_taskMetaDataInput + + + _23_actualTaskOutput + actualTaskVM + + + _23_maiaOutput + maia + + + _23_taskMetaDataOutput + taskMetaDataVM + + + + + + taskMetaDataVT=FlowUtil.createTaskInfo("13",510, 1,10,"VALIDATASA",Kind.OK_NO); +kcontext.setVariable("taskMetaDataVT",taskMetaDataVT); +System.out.println(">>>>>ValidaTasa "+taskMetaDataVT); + + + tasksMetaData.put("V.Tasa",actualTaskVT); + + + _19-_25 + _25-_27 + + + + + + + + _25_maiaInput + _25_taskMetaDataInput + + + _25_actualTaskOutput + _25_maiaOutput + _25_taskMetaDataOutput + + + + maia + _25_maiaInput + + + taskMetaDataVT + _25_taskMetaDataInput + + + _25_actualTaskOutput + actualTaskVT + + + _25_maiaOutput + maia + + + _25_taskMetaDataOutput + taskMetaDataVT + + + + + + taskMetaDataVP=FlowUtil.createTaskInfo("13",499, 1,10,"VALIDAPLAZO",Kind.OK_NO); +kcontext.setVariable("taskMetaDataVP",taskMetaDataVP); +System.out.println(">>>>>ValidaPlazo "+taskMetaDataVP); + + + tasksMetaData.put("V.Plazo",actualTaskVP); + + + _19-_24 + _24-_28 + + + + + + + + _24_maiaInput + _24_taskMetaDataInput + + + _24_actualTaskOutput + _24_maiaOutput + _24_taskMetaDataOutput + + + + maia + _24_maiaInput + + + taskMetaDataVP + _24_taskMetaDataInput + + + _24_actualTaskOutput + actualTaskVP + + + _24_maiaOutput + maia + + + _24_taskMetaDataOutput + taskMetaDataVP + + + + _25-_27 + _27-_18 + _27-_29 + + + _23-_26 + _26-_18 + _26-_29 + + + _26-_29 + _27-_29 + _28-_29 + _29-_30 + + + _24-_28 + _28-_18 + _28-_29 + + + _30-_31 + _31-_32 + _31-_18 + + + + + taskMetaData=FlowUtil.createTaskInfo("13",510, 1,10,"ASIGNARCOMITE",Kind.OK_NO); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Aprobacion",actualTask); +System.out.println("maia Aprobacion "+maia); +((java.util.Map)maia.get("request")).put("accountnumber",taskMetaData.getAditionalData().get("accountnumber")); + + + _29-_30 + _30-_31 + + + + + + + + _30_maiaInput + _30_taskMetaDataInput + + + _30_actualTaskOutput + _30_maiaOutput + _30_taskMetaDataOutput + + + + maia + _30_maiaInput + + + taskMetaData + _30_taskMetaDataInput + + + _30_actualTaskOutput + actualTask + + + _30_maiaOutput + maia + + + _30_taskMetaDataOutput + taskMetaData + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + return taskMetaData.getResponse().compareTo("D")==0; + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + return taskMetaDataVT.getResponse().compareTo("D")==0; + + + return taskMetaDataVP.getResponse().compareTo("D")==0; + + + return taskMetaDataVM.getResponse().compareTo("D")==0; + + + + + + + + return taskMetaDataVM.getResponse().compareTo("D")!=0; + + + return taskMetaDataVT.getResponse().compareTo("D")!=0; + + + return taskMetaDataVP.getResponse().compareTo("D")!=0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/catalogoprueba.bpmn b/base/bpm/bpmlib/target/classes/flows/catalogoprueba.bpmn new file mode 100644 index 0000000..d5e5557 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/catalogoprueba.bpmn @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + +System.out.println("INICIA FLUJO SCRPT ********************************"); + + + + + + System.out.println("ANTES LLAMAR A TASK INFO BY CLASS NAME"); +taskMetaData=FlowUtil.createTaskInfoByClassName("1",49, 1,5,null,1,"OK_NO"); +taskMetaData.setUserId("JVACA"); +taskMetaData.setAction("A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Llamar transaccion",actualTask); + + + SequenceFlow_2 + SequenceFlow_4 + + + + + + + + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + DataOutput_3 + actualTask + + + + + + SequenceFlow_4 + SequenceFlow_5 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/BajaDestruccion.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/BajaDestruccion.bpmn new file mode 100644 index 0000000..f74206d --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/BajaDestruccion.bpmn @@ -0,0 +1,576 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + System.out.println("****Ingresa a preparar el flujo******"); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",55, 1,120, "Revisar reporte armas a destruccion", 20, "OK_NO"); + +//para asignar a un grupo especifico +maia.put("grupo","SUPERV_DECO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Revisar reporte armas a destruccion",actualTask); + + + SequenceFlow_2 + SequenceFlow_4 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Revisar reporte armas a destruccion + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",56, 1,120, "Aprobar reporte de armas a destruccion Jefe Dpto", 21, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setGroupId("JEFE_DEPARTAMENTO_ARMAS_"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Aprobar reporte de armas a destruccion Jefe Dpto",actualTask); + + + SequenceFlow_4 + SequenceFlow_6 + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + + + + _DataInput_16 + + Aprobar reporte de armas a destruccion Jefe Dpto + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_8 + + + + SequenceFlow_9 + SequenceFlow_11 + SequenceFlow_12 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + + + taskMetaData=FlowUtil.createTaskInfo("30",101, 1,120, "Firmar reporte", 23, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setGroupId("JEFE_COMANDO_CONJUNTO_"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar reporte",actualTask); + + + SequenceFlow_12 + SequenceFlow_13 + + + + + + + + + + + + + + DataInput_17 + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_21 + DataInput_22 + DataInput_23 + DataInput_24 + DataInput_25 + + + DataOutput_3 + DataOutput_5 + + + + DataInput_17 + + Firmar reporte + _DataInput_16 + + + + DataInput_18 + + + DataInput_19 + + + DataInput_20 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_21 + + + DataInput_22 + + + DataInput_23 + + + maia + DataInput_24 + + + taskMetaData + DataInput_25 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + SequenceFlow_11 + + + + + SequenceFlow_1 + + + + SequenceFlow_14 + SequenceFlow_1 + FlowUtil.endFlow(kcontext); + + + SequenceFlow_13 + SequenceFlow_14 + System.out.println("Pendiente ejecutar clase que actualiza el inventario"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarInventBajaDestrucc", maia); + + + + + + _1-_15 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",57, 1,120, "Aprobar reporte de armas a destruccion Jefe CC", 22, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setGroupId("JEFE_COMANDO_CONJUNTO_"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Aprobar reporte de armas a destruccion Jefe CC",actualTask); + + + SequenceFlow_7 + SequenceFlow_9 + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + DataInput_6 + DataInput_7 + DataInput_8 + DataInput_9 + DataInput_10 + + + DataOutput_1 + DataOutput_2 + + + + DataInput_1 + + Aprobar reporte de armas a destruccion Jefe CC + _DataInput_16 + + + + DataInput_2 + + + DataInput_3 + + + DataInput_4 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_6 + + + DataInput_7 + + + DataInput_8 + + + maia + DataInput_9 + + + taskMetaData + DataInput_10 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_6 + SequenceFlow_7 + SequenceFlow_8 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/CargaDeposito.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/CargaDeposito.bpmn new file mode 100644 index 0000000..8686daf --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/CargaDeposito.bpmn @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_11 + + + + SequenceFlow_10 + SequenceFlow_11 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_9 + SequenceFlow_10 + System.out.println("Ingresa a tarea de enviar el mail de Notificar inconsistencia deposito"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 17 , 18); + + + + _1-_15 + SequenceFlow_1 + System.out.println("Ingresa al flujo de carga deposito"); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",42, 1,120, "Validar transaccion de deposito", 24, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidaFlujoCargaDeposito", maia); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar transaccion de deposito",actualTask); + + + SequenceFlow_1 + SequenceFlow_6 + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + + + + _DataInput_16 + + Validar transaccion de deposito + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + _1-_15 + + + + + + //taskMetaData=FlowUtil.createTaskInfoByClassName("30",24, 1,30,"com.fp.viaticos.task.AsignarEmpleado", "Modificar empleado", 11, "OK_NO"); +//kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_2 + SequenceFlow_15 + + + + + + + DataInput_18 + DataInput_19 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_18 + + + taskMetaData + DataInput_19 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + + _16-_12 + + + + SequenceFlow_15 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_6 + SequenceFlow_9 + SequenceFlow_2 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionApertura.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionApertura.bpmn new file mode 100644 index 0000000..bafc009 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionApertura.bpmn @@ -0,0 +1,311 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar Info Agencias", 1, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar Info Agencias",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + + + + + + _DataInput_191 + _DataInput_192 + _DataInput_193 + _DataInput_194 + _DataInput_195 + _DataInput_196 + _DataInput_197 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_191 + + Validar Info Agencias + _DataInput_191 + + + + _DataInput_192 + + + _DataInput_193 + + + _DataInput_194 + + #{taskMetaData.groupId} + _DataInput_194 + + + + _DataInput_195 + + + _DataInput_196 + + + _DataInput_197 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + SequenceFlow_5 + SequenceFlow_6 + //FlowUtil.endFlow(kcontext); + + + SequenceFlow_6 + + + + + SequenceFlow_8 + SequenceFlow_9 + //FlowUtil.endFlow(kcontext); + + + SequenceFlow_9 + + + + + + + + + + + SequenceFlow_7 + SequenceFlow_8 + + + + + + + DataInput_5 + DataInput_6 + + + DataOutput_5 + DataOutput_6 + + + + maia + DataInput_5 + + + taskMetaData + DataInput_6 + + + DataOutput_5 + maia + + + DataOutput_6 + taskMetaData + + + + + SequenceFlow_4 + SequenceFlow_5 + System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + SequenceFlow_3 + SequenceFlow_4 + SequenceFlow_7 + + + System.out.println("Camino D"); +return ("D".equals(taskMetaData.getResponse())); + + + System.out.println("Camino A"); +return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionAutorizacion.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionAutorizacion.bpmn new file mode 100644 index 0000000..b9809f4 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionAutorizacion.bpmn @@ -0,0 +1,631 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + _1-_15 + SequenceFlow_1 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar tipo de Autorizacion", 1, "OK_NO"); +maia.put("grupo","SUPERV_INSP_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar tipo de Autorizacion",actualTask); + + + SequenceFlow_1 + SequenceFlow_12 + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + DataInput_5 + DataInput_6 + DataInput_12 + DataInput_7 + DataInput_8 + + + DataOutput_6 + DataOutput_7 + + + + DataInput_1 + + Validar tipo de Autorizacion + _DataInput_149 + + + + DataInput_2 + + + DataInput_3 + + + DataInput_4 + + #{taskMetaData.groupId} + _DataInput_152 + + + + DataInput_5 + + + DataInput_6 + + + DataInput_12 + + + maia + DataInput_7 + + + taskMetaData + DataInput_8 + + + DataOutput_6 + maia + + + DataOutput_7 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_16 + + + + SequenceFlow_12 + SequenceFlow_15 + SequenceFlow_7 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + Requiere Inspeccion + SequenceFlow_7 + SequenceFlow_13 + System.out.println("............................................................................................Autorizacion Previa de Importacion"); +FlowUtil.executeClass("com.fp.armas.task.ValAutorizacionPreviaImporta", maia); +if(taskMetaData ==null){ + taskMetaData = new com.fp.simple.dto.TaskInfo(); +} +taskMetaData.setResponse((maia.get("previaimportacion")!=null)?""+maia.get("previaimportacion"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_13 + SequenceFlow_19 + SequenceFlow_20 + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar tipo de Autorizacion VUE", 1, "OK_NO"); +taskMetaData.setGroupId("ANALISTA_VUE"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar tipo de Autorizacion VUE",actualTask); + + + SequenceFlow_19 + SequenceFlow_21 + + + + + + + + + + + + + + DataInput_14 + DataInput_15 + DataInput_16 + DataInput_17 + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_21 + DataInput_22 + + + DataOutput_1 + DataOutput_2 + + + + DataInput_14 + + Validar tipo de Autorizacion VUE + _DataInput_149 + + + + DataInput_15 + + + DataInput_16 + + + DataInput_17 + + #{taskMetaData.groupId} + _DataInput_152 + + + + DataInput_18 + + + DataInput_19 + + + DataInput_20 + + + maia + DataInput_21 + + + taskMetaData + DataInput_22 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_17 + SequenceFlow_2 + SequenceFlow_3 + + + return ("N".equals(taskMetaData.getResponse())); + + + return ("Y".equals(taskMetaData.getResponse())); + + + SequenceFlow_8 + _16-_12 + + + + Requiere Inspeccion + SequenceFlow_22 + SequenceFlow_17 + System.out.println(".............................................................................................Requiere Inspeccion :"); +FlowUtil.executeClass("com.fp.armas.task.RequiereInspeccion", maia); +if(taskMetaData ==null){ + taskMetaData = new com.fp.simple.dto.TaskInfo(); +} +taskMetaData.setResponse((maia.get("inspeccion")!=null)?""+maia.get("inspeccion"):null); +System.out.println(".............................................................................................Requiere Inspeccion :"+taskMetaData.getResponse()); +kcontext.setVariable("taskMetaData",taskMetaData); +System.out.println(".............................................................................................Requiere Inspeccion :"+taskMetaData.getResponse()); + + + + SequenceFlow_2 + SequenceFlow_9 + SequenceFlow_5 + + + + _16-_12 + + + + + + System.out.println("............................................................................................ Inspeccion :"); + + + System.out.println("............................................................................................ Inspeccion OK"); +FlowUtil.executeClass("com.fp.armas.task.ValidaInspeccion", maia); +if(taskMetaData ==null){ + taskMetaData = new com.fp.simple.dto.TaskInfo(); +} +taskMetaData.setResponse((maia.get("tramiteproceso")!=null)?""+maia.get("tramiteproceso"):null); +kcontext.setVariable("taskMetaData",taskMetaData); +System.out.println("..........................................................................................regreso... :"+taskMetaData.getResponse()); + + + SequenceFlow_3 + SequenceFlow_4 + + + + + + + DataInput_11 + DataInput_13 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + taskMetaData + DataInput_13 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + + SequenceFlow_11 + + + + + + + SequenceFlow_5 + SequenceFlow_8 + + + + + + + DataInput_9 + DataInput_10 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_9 + + + taskMetaData + DataInput_10 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + + SequenceFlow_10 + SequenceFlow_11 + + + + return ("D".equals(taskMetaData.getResponse())); + + + + SequenceFlow_20 + SequenceFlow_21 + SequenceFlow_22 + + + + SequenceFlow_4 + SequenceFlow_9 + SequenceFlow_10 + + + return ("Y".equals(taskMetaData.getResponse())); + + + return ("N".equals(taskMetaData.getResponse())); + + + SequenceFlow_15 + SequenceFlow_16 + System.out.println("............................................................................................ RECHAZA VALIDAR TIPO SOLICITUD:"); +System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones","Tramite Anulado en Validar Tipo De Autorizacion"+datosmail.get("observaciones")); +}else{ +maia.put("observaciones","Tramite Anulado en Validar Tipo De Autorizacion"); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionDevolucion.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionDevolucion.bpmn new file mode 100644 index 0000000..37c9cb5 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionDevolucion.bpmn @@ -0,0 +1,411 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_10 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + _1-_15 + + + + SequenceFlow_11 + SequenceFlow_5 + SequenceFlow_7 + + + + + taskMetaData=FlowUtil.createTaskInfo("30",32, 1,120, "Autorizar Devolucion",37, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +System.out.println("1..................."); +actualTask=new java.util.ArrayList(); +System.out.println("2..................."); +kcontext.setVariable("actualTask",actualTask); +System.out.println("3..................."); +actualTask.add(taskMetaData); +System.out.println("4..................."); +System.out.println("5..................."); +tasksMetaData.put("Autorizar Devolucion",actualTask); +System.out.println("6..................."); + + + SequenceFlow_5 + SequenceFlow_1 + + + + + + + + + + + + + + DataInput_13 + DataInput_14 + DataInput_15 + DataInput_16 + DataInput_17 + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_21 + + + DataOutput_1 + DataOutput_2 + + + + DataInput_13 + + Autorizar Devolucion + _DataInput_16 + + + + DataInput_14 + + + DataInput_15 + + + DataInput_16 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_17 + + + DataInput_18 + + + DataInput_19 + + + maia + DataInput_20 + + + taskMetaData + DataInput_21 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_7 + _16-_12 + System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + _16-_12 + + + + return ("D".equals(taskMetaData.getResponse())); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",29, 1,120, "Informacion Devolucion", 36, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","TEC_ALM_CENTRO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Informacion Devolucion",actualTask); + + + + SequenceFlow_10 + SequenceFlow_11 + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + DataInput_5 + DataInput_6 + DataInput_7 + DataInput_8 + DataInput_9 + + + DataOutput_3 + DataOutput_5 + + + + DataInput_1 + + Informacion Devolucion + _DataInput_16 + + + + DataInput_2 + + + DataInput_3 + + + DataInput_4 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_5 + + + DataInput_6 + + + DataInput_7 + + + maia + DataInput_8 + + + taskMetaData + DataInput_9 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_2 + SequenceFlow_6 + System.out.println("fin"); +//FlowUtil.endFlow(kcontext); +System.out.println("fin1"); + + + + SequenceFlow_6 + + + + + + + SequenceFlow_1 + SequenceFlow_2 + + + + + + + DataInput_10 + DataInput_11 + + + DataOutput_4 + DataOutput_6 + + + + maia + DataInput_10 + + + taskMetaData + DataInput_11 + + + DataOutput_4 + maia + + + DataOutput_6 + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionEmisionGuiaTransito.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionEmisionGuiaTransito.bpmn new file mode 100644 index 0000000..7282524 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionEmisionGuiaTransito.bpmn @@ -0,0 +1,422 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + _1-_15 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_1 + SequenceFlow_5 + SequenceFlow_13 + + + return ("D".equals(taskMetaData.getResponse())); + + + + + taskMetaData=FlowUtil.createTaskInfo("30",23, 1,120, "Validacion Inconsistencias Informacion Solicitud", 56, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validacion Inconsistencias Informacion Solicitud",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Validacion Inconsistencias Informacion Solicitud + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_5 + SequenceFlow_6 + System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,61); + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_13 + SequenceFlow_16 + System.out.println(" Verifica cantidad armamento "); +FlowUtil.executeClass("com.fp.armas.task.VerificarCantidadArmas", maia); +taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("requierecustodia")!=null)?""+maia.get("requierecustodia"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + SequenceFlow_16 + SequenceFlow_20 + SequenceFlow_24 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_20 + SequenceFlow_15 + SequenceFlow_22 + + + + + + System.out.println(" Genera Orden trabajo "); +taskMetaData=FlowUtil.createTaskInfo("30",27, 1,120, "Generar Orden Trabajo", 55, "OK_NO"); +maia.put("grupo","SUPERV_INSP_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Generar Orden Trabajo",actualTask); + + + SequenceFlow_24 + SequenceFlow_15 + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + + + DataOutput_11 + DataOutput_12 + + + + maia + DataInput_1 + + + DataInput_2 + + Generar Orden Trabajo + DataInput_26 + + + + DataInput_3 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_4 + + + DataOutput_11 + maia + + + DataOutput_12 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + System.out.println(" Documento Habilitante "); + + + + + + SequenceFlow_22 + SequenceFlow_23 + + + + + + + + DataInput_90 + DataInput_91 + + + DataOutput_19 + DataOutput_20 + DataOutput_21 + + + + maia + DataInput_90 + + + taskMetaData + DataInput_91 + + + DataOutput_19 + taskMetaData + + + DataOutput_20 + maia + + + DataOutput_21 + actualTask + + + + + SequenceFlow_23 + _16-_12 + //FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + SequenceFlow_6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionImpresion.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionImpresion.bpmn new file mode 100644 index 0000000..bf0a471 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionImpresion.bpmn @@ -0,0 +1,285 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + _1-_15 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",50, 1,120, "Validar Reimpresion", 32, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData=new java.util.HashMap(); +tasksMetaData.put("Validar Reimpresion",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Validar Reimpresion + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + _16-_12 + + + + + + System.out.println("Imprime documento"); +taskMetaData=FlowUtil.createTaskInfo("30",59, 1,120, "Imprimir Documento", 51, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +//tasksMetaData =new java.util.HashMap(); +tasksMetaData.put("Imprimir Documento",actualTask); + + + SequenceFlow_7 + SequenceFlow_5 + + + + + + + + + DataInput_22 + DataInput_23 + DataInput_24 + DataInput_25 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_22 + + + DataInput_23 + + Imprimir Documento + DataInput_26 + + + + DataInput_24 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_25 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_8 + + + + SequenceFlow_5 + _16-_12 + //FlowUtil.endFlow(kcontext); + + + + SequenceFlow_1 + SequenceFlow_7 + SequenceFlow_8 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionIncrementoArmas.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionIncrementoArmas.bpmn new file mode 100644 index 0000000..035545b --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionIncrementoArmas.bpmn @@ -0,0 +1,306 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("actualTask",actualTask); +kcontext.setVariable("tasksMetaData",tasksMetaData); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar la Informacion Armas", 59, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar la Informacion Armas",actualTask); + + + SequenceFlow_2 + SequenceFlow_6 + + + + + + + + + + + + + + _DataInput_184 + _DataInput_185 + _DataInput_186 + _DataInput_187 + _DataInput_188 + _DataInput_189 + _DataInput_190 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_184 + + Validar la Informacion Armas + _DataInput_184 + + + + _DataInput_185 + + + _DataInput_186 + + + _DataInput_187 + + #{taskMetaData.groupId} + _DataInput_187 + + + + _DataInput_188 + + + _DataInput_189 + + + _DataInput_190 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_10 + SequenceFlow_11 + System.out.println(" Anula Incremento de Armas: "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + SequenceFlow_11 + SequenceFlow_12 + + + + SequenceFlow_6 + SequenceFlow_7 + SequenceFlow_10 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_8 + SequenceFlow_9 + \ + + + + + + + + + + SequenceFlow_7 + SequenceFlow_8 + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_4 + DataOutput_5 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_4 + maia + + + DataOutput_5 + taskMetaData + + + + + + SequenceFlow_9 + + + + SequenceFlow_12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionInspeccion.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionInspeccion.bpmn new file mode 100644 index 0000000..17b6a78 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionInspeccion.bpmn @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + System.out.println(".............................................................................................Inspeccion..:"); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",31, 1,120, "Registrar Inspeccion", 54, "OK_NO"); +maia.put("grupo","INSP_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Registrar Inspeccion",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Registrar Inspeccion + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + _1-_15 + + + + + SequenceFlow_1 + SequenceFlow_5 + SequenceFlow_6 + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_5 + _16-_12 + System.out.println("............................................................................................SI........................ :"+taskMetaData.getResponse()); + + + + + _16-_12 + + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_7 + + + + FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + SequenceFlow_6 + SequenceFlow_7 + System.out.println("............................................................................................ NO:"); +System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones","Tramite Anulado en Registrar Inspeccion"+datosmail.get("observaciones")); +}else{ +maia.put("observaciones","Tramite Anulado en Registrar Inspeccion"); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); +System.out.println("..........................................................................................no... :"+taskMetaData.getResponse()); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionInternacion.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionInternacion.bpmn new file mode 100644 index 0000000..9b46d24 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionInternacion.bpmn @@ -0,0 +1,320 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("actualTask",actualTask); +kcontext.setVariable("tasksMetaData",tasksMetaData); + + + + SequenceFlow_11 + SequenceFlow_12 + + + SequenceFlow_12 + + + + + SequenceFlow_4 + SequenceFlow_7 + SequenceFlow_10 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + + + + + + + SequenceFlow_7 + SequenceFlow_8 + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_4 + DataOutput_5 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_4 + maia + + + DataOutput_5 + taskMetaData + + + + + SequenceFlow_8 + SequenceFlow_9 + + + + SequenceFlow_10 + SequenceFlow_11 + System.out.println("***SE ANULO EL TRAMITE***"); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar Info Armas", 1, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar Info Armas",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + + + + + + _DataInput_184 + _DataInput_185 + _DataInput_186 + _DataInput_187 + _DataInput_188 + _DataInput_189 + _DataInput_190 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_184 + + Validar Info Armas + _DataInput_184 + + + + _DataInput_185 + + + _DataInput_186 + + + _DataInput_187 + + #{taskMetaData.groupId} + _DataInput_187 + + + + _DataInput_188 + + + _DataInput_189 + + + _DataInput_190 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_3 + SequenceFlow_4 + System.out.println("***SE ANULO EL TRAMITE***"); + + + + + SequenceFlow_9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionPermiso.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionPermiso.bpmn new file mode 100644 index 0000000..551ca9e --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionPermiso.bpmn @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_1 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData =new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",24, 1,120, "Receptar Armas", 45, "OK_NO"); +maia.put("grupo","TEC_ALM_CENTRO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Receptar Armas",actualTask); + + + SequenceFlow_1 + SequenceFlow_16 + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_1 + + + DataInput_2 + + Receptar Armas + DataInput_26 + + + + DataInput_3 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_4 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + _1-_15 + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",28, 1,120, "Ingresa Ficha Tecnica Arma", 46, "OK_NO"); +maia.put("grupo","ANALISTA_TIRO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ingresa Ficha Tecnica Arma",actualTask); + + + SequenceFlow_16 + SequenceFlow_17 + + + + + + + + + DataInput_6 + DataInput_7 + DataInput_8 + DataInput_9 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_6 + + + DataInput_7 + + Ingresa Ficha Tecnica Arma + DataInput_26 + + + + DataInput_8 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_9 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + SequenceFlow_12 + SequenceFlow_13 + //FlowUtil.endFlow(kcontext); + + + + + + + + + SequenceFlow_17 + SequenceFlow_12 + + + + + + + + DataInput_39 + DataInput_40 + + + DataOutput_14 + DataOutput_15 + DataOutput_16 + + + + maia + DataInput_39 + + + taskMetaData + DataInput_40 + + + DataOutput_14 + actualTask + + + DataOutput_15 + maia + + + DataOutput_16 + taskMetaData + + + + + SequenceFlow_13 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionTramite.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionTramite.bpmn new file mode 100644 index 0000000..074ddda --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/EjecucionTramite.bpmn @@ -0,0 +1,721 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_4 + System.out.println("***Ingresa a la tarea prepara flujo***"); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + _1-_15 + + + + + SequenceFlow_4 + SequenceFlow_5 + System.out.println("***Ingresa a la tarea evaluar tipo de documento***"); +FlowUtil.executeClass("com.fp.armas.task.TipoDocumento", maia); +// taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("tipodocumento")!=null)?""+maia.get("tipodocumento"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_5 + SequenceFlow_11 + SequenceFlow_13 + SequenceFlow_15 + SequenceFlow_17 + SequenceFlow_19 + SequenceFlow_21 + SequenceFlow_24 + SequenceFlow_26 + SequenceFlow_27 + SequenceFlow_29 + + + + + + + SequenceFlow_30 + SequenceFlow_9 + + + + + + + DataInput_15 + DataInput_16 + + + DataOutput_6 + DataOutput_7 + + + + maia + DataInput_15 + + + taskMetaData + DataInput_16 + + + DataOutput_6 + maia + + + DataOutput_7 + taskMetaData + + + + + return ("EA".equals(taskMetaData.getResponse())); + + + return ("EI".equals(taskMetaData.getResponse())); + + + return ("ET".equals(taskMetaData.getResponse())); + + + return ("EG".equals(taskMetaData.getResponse())); + + + SequenceFlow_9 + SequenceFlow_12 + SequenceFlow_14 + SequenceFlow_16 + SequenceFlow_18 + SequenceFlow_20 + SequenceFlow_22 + SequenceFlow_23 + SequenceFlow_25 + SequenceFlow_28 + SequenceFlow_10 + + + + SequenceFlow_10 + _16-_12 + //FlowUtil.endFlow(kcontext); + + + + return ("EC".equals(taskMetaData.getResponse())); + + + + + + + SequenceFlow_13 + SequenceFlow_14 + + + + + + + DataInput_19 + DataInput_20 + + + DataOutput_11 + DataOutput_12 + + + + maia + DataInput_19 + + + taskMetaData + DataInput_20 + + + DataOutput_11 + maia + + + DataOutput_12 + taskMetaData + + + + + + + + + SequenceFlow_11 + SequenceFlow_12 + + + + + + + DataInput_17 + DataInput_18 + + + DataOutput_9 + DataOutput_10 + + + + maia + DataInput_17 + + + taskMetaData + DataInput_18 + + + DataOutput_9 + maia + + + DataOutput_10 + taskMetaData + + + + + return ("ER".equals(taskMetaData.getResponse())); + + + return ("ED".equals(taskMetaData.getResponse())); + + + return ("ES".equals(taskMetaData.getResponse())); + + + return ("EN".equals(taskMetaData.getResponse())); + + + + + + + SequenceFlow_19 + SequenceFlow_20 + + + + + + + DataInput_25 + DataInput_27 + + + DataOutput_17 + DataOutput_18 + + + + maia + DataInput_25 + + + taskMetaData + DataInput_27 + + + DataOutput_17 + maia + + + DataOutput_18 + taskMetaData + + + + + + + + + SequenceFlow_26 + SequenceFlow_25 + + + + + + + DataInput_33 + DataInput_34 + + + DataOutput_23 + DataOutput_24 + + + + maia + DataInput_33 + + + taskMetaData + DataInput_34 + + + DataOutput_23 + maia + + + DataOutput_24 + taskMetaData + + + + + + + + + SequenceFlow_21 + SequenceFlow_22 + + + + + + + DataInput_28 + DataInput_30 + + + DataOutput_19 + DataOutput_20 + + + + maia + DataInput_28 + + + taskMetaData + DataInput_30 + + + DataOutput_19 + maia + + + DataOutput_20 + taskMetaData + + + + + + + + + SequenceFlow_15 + SequenceFlow_16 + + + + + + + DataInput_21 + DataInput_22 + + + DataOutput_13 + DataOutput_14 + + + + maia + DataInput_21 + + + taskMetaData + DataInput_22 + + + DataOutput_13 + maia + + + DataOutput_14 + taskMetaData + + + + + + + + + SequenceFlow_27 + SequenceFlow_28 + + + + + + + DataInput_35 + DataInput_36 + + + DataOutput_25 + DataOutput_26 + + + + maia + DataInput_35 + + + taskMetaData + DataInput_36 + + + DataOutput_25 + maia + + + DataOutput_26 + taskMetaData + + + + + + + + + SequenceFlow_24 + SequenceFlow_23 + + + + + + + DataInput_31 + DataInput_32 + + + DataOutput_21 + DataOutput_22 + + + + maia + DataInput_31 + + + taskMetaData + DataInput_32 + + + DataOutput_21 + maia + + + DataOutput_22 + taskMetaData + + + + + + + + + SequenceFlow_17 + SequenceFlow_18 + + + + + + + DataInput_23 + DataInput_24 + + + DataOutput_15 + DataOutput_16 + + + + maia + DataInput_23 + + + taskMetaData + DataInput_24 + + + DataOutput_15 + maia + + + DataOutput_16 + taskMetaData + + + + + SequenceFlow_29 + SequenceFlow_30 + System.out.println("***Ingresa a la tarea NOTIFICAR FECHA DE ENTRGA DE ARMAS***"); +//enviar mail de notificacion +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 39,40); + + + return ("EP".equals(taskMetaData.getResponse())); + + + + _16-_12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/EjecutarCertificados.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/EjecutarCertificados.bpmn new file mode 100644 index 0000000..80c8276 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/EjecutarCertificados.bpmn @@ -0,0 +1,276 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + SequenceFlow_12 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + SequenceFlow_10 + + + + SequenceFlow_9 + SequenceFlow_10 + System.out.println("TramiteAnulado"); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ejecutar Certificados",actualTask); + + + SequenceFlow_8 + SequenceFlow_5 + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_3 + DataOutput_4 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_3 + maia + + + DataOutput_4 + taskMetaData + + + + + SequenceFlow_13 + SequenceFlow_8 + SequenceFlow_9 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_5 + SequenceFlow_6 + + + + SequenceFlow_1 + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Valida Informacion Certificado", 58, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Valida Informacion Certificado",actualTask); + + + SequenceFlow_12 + SequenceFlow_13 + + + + + + + + + DataInput_5 + DataInput_6 + DataInput_7 + DataInput_8 + + + DataOutput_5 + DataOutput_6 + + + + maia + DataInput_5 + + + DataInput_6 + + Valida Informacion Certificado + DataInput_26 + + + + DataInput_7 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_8 + + + DataOutput_5 + maia + + + DataOutput_6 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/EjecutarInscripcion.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/EjecutarInscripcion.bpmn new file mode 100644 index 0000000..f4e4fcd --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/EjecutarInscripcion.bpmn @@ -0,0 +1,313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Valida Info Inscripcion", 1, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Valida Info Inscripcion",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + + + + + + _DataInput_149 + _DataInput_150 + _DataInput_151 + _DataInput_152 + _DataInput_153 + _DataInput_154 + _DataInput_155 + DataInput_2 + DataInput_3 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_149 + + Valida Info Inscripcion + _DataInput_149 + + + + _DataInput_150 + + + _DataInput_151 + + + _DataInput_152 + + #{taskMetaData.groupId} + _DataInput_152 + + + + _DataInput_153 + + + _DataInput_154 + + + _DataInput_155 + + + maia + DataInput_2 + + + taskMetaData + DataInput_3 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ejecutar Certificados",actualTask); + + + SequenceFlow_4 + SequenceFlow_5 + + + + + + + DataInput_4 + DataInput_5 + + + DataOutput_3 + DataOutput_4 + + + + maia + DataInput_4 + + + taskMetaData + DataInput_5 + + + DataOutput_3 + maia + + + DataOutput_4 + taskMetaData + + + + SequenceFlow_5 + SequenceFlow_6 + //FlowUtil.endFlow(kcontext); + + + + + SequenceFlow_7 + SequenceFlow_9 + System.out.println("***SE ANULO EL TRAMITE***"); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + SequenceFlow_9 + SequenceFlow_10 + //FlowUtil.endFlow(kcontext); + + + + SequenceFlow_10 + + + + + SequenceFlow_3 + SequenceFlow_4 + SequenceFlow_7 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/EmisionDocumentoHabilitante.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/EmisionDocumentoHabilitante.bpmn new file mode 100644 index 0000000..8974da0 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/EmisionDocumentoHabilitante.bpmn @@ -0,0 +1,992 @@ + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_9 + SequenceFlow_1 + SequenceFlow_18 + + + return ("D".equals(taskMetaData.getResponse())); + + + + + taskMetaData=FlowUtil.createTaskInfo("30",102, 1,120, "Generar Reporte", 35, "OK_NO"); +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Generar Reporte",actualTask); + + + SequenceFlow_17 + SequenceFlow_20 + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_1 + + + DataInput_2 + + Generar Reporte + DataInput_26 + + + + DataInput_3 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_4 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + SequenceFlow_19 + SequenceFlow_17 + SequenceFlow_12 + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_1 + SequenceFlow_13 + System.out.println("ingresa a enviar el mail"); +//enviar mail de rechazo +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + SequenceFlow_18 + SequenceFlow_19 + FlowUtil.executeClass("com.fp.armas.task.FechaCaducidadEstadoArma", maia); +FlowUtil.executeClass("com.fp.armas.task.TramiteAprobado", maia); +FlowUtil.executeClass("com.fp.armas.task.TipoArchivoControl", maia); +FlowUtil.executeClass("com.fp.armas.task.FinalizarDocumentoHabilitante", maia); +taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.getAditionalData().put("datosmail", maia.get("datosmail")); +taskMetaData.setResponse((maia.get("tipoarchivo")!=null)?""+maia.get("tipoarchivo"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",101, 1,120, "Firmar Tramite Supervisor", 38, "OK_NO"); +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar Tramite Supervisor",actualTask); + + + SequenceFlow_20 + SequenceFlow_5 + + + + + + + + + + + + + + DataInput_21 + DataInput_22 + DataInput_23 + DataInput_24 + DataInput_25 + DataInput_27 + DataInput_28 + DataInput_30 + DataInput_31 + + + DataOutput_6 + DataOutput_7 + + + + DataInput_21 + + Firmar Tramite Supervisor + _DataInput_16 + + + + DataInput_22 + + + DataInput_23 + + + DataInput_24 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_25 + + + DataInput_27 + + + DataInput_28 + + + maia + DataInput_30 + + + taskMetaData + DataInput_31 + + + DataOutput_6 + maia + + + DataOutput_7 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("A".equals(taskMetaData.getResponse())); + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",35,1,120,null, "Notificar fecha de Emision", 6, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Notificar fecha de Emision",actualTask); + + + SequenceFlow_12 + SequenceFlow_11 + + + + + + + + + + + + + + DataInput_15 + DataInput_16 + DataInput_17 + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_32 + DataInput_33 + DataInput_34 + + + DataOutput_11 + DataOutput_12 + + + + DataInput_15 + + Notificar fecha de Emision + _DataInput_16 + + + + DataInput_16 + + + DataInput_17 + + + DataInput_18 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_19 + + + DataInput_20 + + + DataInput_32 + + + maia + DataInput_33 + + + taskMetaData + DataInput_34 + + + DataOutput_11 + maia + + + DataOutput_12 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_11 + SequenceFlow_3 + System.out.println("ingresa a enviar el mail si requiere tarjeta"); +//enviar mail de notificacion +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 4 ,5); + + + + SequenceFlow_3 + _16-_12 + //FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + SequenceFlow_13 + + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",108,1,120,null, "Notificar fecha de Emision Reporte", 6, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Notificar fecha de Emision Reporte",actualTask); + + + SequenceFlow_6 + SequenceFlow_10 + + + + + + + + + + + + + + DataInput_46 + DataInput_47 + DataInput_48 + DataInput_49 + DataInput_50 + DataInput_51 + DataInput_52 + DataInput_53 + DataInput_54 + + + DataOutput_9 + DataOutput_10 + + + + DataInput_46 + + Notificar fecha de Emision Reporte + _DataInput_16 + + + + DataInput_47 + + + DataInput_48 + + + DataInput_49 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_50 + + + DataInput_51 + + + DataInput_52 + + + maia + DataInput_53 + + + taskMetaData + DataInput_54 + + + DataOutput_9 + maia + + + DataOutput_10 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",109, 1,120, "Firmar Tramite Coordinador", 38, "OK_NO"); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar Tramite Coordinador",actualTask); + + + SequenceFlow_5 + SequenceFlow_6 + + + + + + + + + + + + + + DataInput_5 + DataInput_6 + DataInput_7 + DataInput_8 + DataInput_9 + DataInput_10 + DataInput_12 + DataInput_13 + DataInput_14 + + + DataOutput_13 + DataOutput_14 + + + + DataInput_5 + + Firmar Tramite Coordinador + _DataInput_16 + + + + DataInput_6 + + + DataInput_7 + + + DataInput_8 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_9 + + + DataInput_10 + + + DataInput_12 + + + maia + DataInput_13 + + + taskMetaData + DataInput_14 + + + DataOutput_13 + maia + + + DataOutput_14 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_10 + SequenceFlow_7 + System.out.println("ingresa a enviar el mail si requiere reporte"); +//enviar mail de notificacion +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 4 ,60); + + + + SequenceFlow_7 + SequenceFlow_22 + //FlowUtil.endFlow(kcontext); + + + + SequenceFlow_22 + + + + _1-_15 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + _1-_15 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",30, 1,120, "Revisar Tramite", 30, "OK_NO"); +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + System.out.println("............................................................................................ 1:"); +taskMetaData.updateData(maia); +System.out.println("............................................................................................ 2:"); +actualTask=new java.util.ArrayList(); +System.out.println("............................................................................................ 3:"); +kcontext.setVariable("actualTask",actualTask); +System.out.println("............................................................................................ 4:"); +actualTask.add(taskMetaData); +System.out.println("............................................................................................ 5:"); +tasksMetaData.put("Revisar Tramite",actualTask); +System.out.println("............................................................................................ 6:"); + + + SequenceFlow_2 + SequenceFlow_4 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Revisar Tramite + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + SequenceFlow_23 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",33, 1,120, "Autorizar Tramite", 31, "OK_NO"); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Autorizar Tramite",actualTask); + + + SequenceFlow_8 + SequenceFlow_9 + + + + + + + + + DataInput_200 + DataInput_201 + DataInput_202 + DataInput_203 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_200 + + + DataInput_201 + + Autorizar Tramite + DataInput_26 + + + + DataInput_202 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_203 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + SequenceFlow_4 + SequenceFlow_8 + SequenceFlow_14 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_14 + SequenceFlow_23 + System.out.println("............................................................................................ NO:"); +System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones","Tramite Anulado en Revisar Tramite"+datosmail.get("observaciones")); +}else{ +maia.put("observaciones","Tramite Anulado en Revisar Tramite"); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/EnvioArmas.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/EnvioArmas.bpmn new file mode 100644 index 0000000..18f3ce7 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/EnvioArmas.bpmn @@ -0,0 +1,354 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",58, 1,120, "Autorizar Acta Entrega", 33, "OK_NO"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarRutaArchivo", maia); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Autorizar Acta Entrega",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Autorizar Acta Entrega + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + _1-_15 + + + + SequenceFlow_1 + SequenceFlow_5 + SequenceFlow_9 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",94, 1,120, "Firmar Acta", 34, "OK_NO"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarRutaArchivo", maia); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar Acta",actualTask); + + + SequenceFlow_5 + SequenceFlow_10 + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + + + + _DataInput_16 + + Firmar Acta + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_9 + SequenceFlow_6 + System.out.println("Entra actualizar ruta"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarRutaArchivo", maia); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + + + SequenceFlow_4 + + + + SequenceFlow_6 + SequenceFlow_7 + System.out.println("Entra a rechazar ruta"); +FlowUtil.executeClass("com.fp.armas.task.RechazarActa", maia); + + + + SequenceFlow_7 + SequenceFlow_4 + FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/PlanificacionInspeccion.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/PlanificacionInspeccion.bpmn new file mode 100644 index 0000000..d52e983 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/PlanificacionInspeccion.bpmn @@ -0,0 +1,518 @@ + + + + + + + + + + + + + + + + + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",101, 1,120, "Firmar Plan", 50, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar Plan",actualTask); + + + SequenceFlow_6 + SequenceFlow_4 + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + + + + _DataInput_16 + + Firmar Plan + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + _16-_12 + + + + SequenceFlow_10 + SequenceFlow_11 + maia.put("respuesta","Y"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarPlanificacion", maia); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",105, 1,120, "Generar Reporte", 49, "OK_NO"); +//para asignar a un grupo especifico +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Generar Reporte",actualTask); + + + SequenceFlow_11 + SequenceFlow_6 + + + + + + + + + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_21 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_18 + + + DataInput_19 + + Generar Reporte + DataInput_26 + + + + DataInput_20 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_21 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_4 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_1 + SequenceFlow_8 + SequenceFlow_10 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_8 + SequenceFlow_13 + maia.put("respuesta","N"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarPlanificacion", maia); + + + + + taskMetaData=FlowUtil.createTaskInfo("30",106, 1,120, "Modificar Plan Inspeccion", 57, "OK_NO"); +//para asignar a un grupo especifico +maia.put("grupo","SUPERV_INSP_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Modificar Plan Inspeccion",actualTask); + + + SequenceFlow_13 + SequenceFlow_14 + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_1 + + + DataInput_2 + + Modificar Plan Inspeccion + DataInput_26 + + + + DataInput_3 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_4 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + _1-_15 + + + + _1-_15 + SequenceFlow_12 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_12 + SequenceFlow_14 + SequenceFlow_7 + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",104, 1,120, "Aprobar Plan Inspeccion", 48, "OK_NO"); +//para asignar a un grupo especifico +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Aprobar Plan Inspeccion",actualTask); + + + SequenceFlow_7 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Aprobar Plan Inspeccion + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/RecepcionArmas.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/RecepcionArmas.bpmn new file mode 100644 index 0000000..2151c71 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/RecepcionArmas.bpmn @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_4 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",101, 1,120, "Legalizar Acta", 29, "OK_NO"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarRutaArchivo", maia); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupoDecRecep", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Legalizar Acta",actualTask); + + + SequenceFlow_4 + SequenceFlow_5 + + + + + + + + + + + + + + _DataInput_30 + _DataInput_31 + _DataInput_32 + _DataInput_33 + _DataInput_34 + _DataInput_35 + _DataInput_36 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_30 + + Legalizar Acta + _DataInput_30 + + + + _DataInput_31 + + + _DataInput_32 + + + _DataInput_33 + + #{taskMetaData.groupId} + _DataInput_33 + + + + _DataInput_34 + + + _DataInput_35 + + + _DataInput_36 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_5 + SequenceFlow_1 + System.out.println("ingresa a Actualizar Inventario"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarInventario", maia); // la clase puede hacer lo que necesite +System.out.println("-- Actualizar Inventario"); + + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/RecepcionSolicitudRequisitos.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/RecepcionSolicitudRequisitos.bpmn new file mode 100644 index 0000000..d61f725 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/RecepcionSolicitudRequisitos.bpmn @@ -0,0 +1,360 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + SequenceFlow_18 + + + + SequenceFlow_25 + SequenceFlow_18 + FlowUtil.endFlow(kcontext); + + + + _1-_15 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_23 + SequenceFlow_10 + System.out.println("***Ingresa a la tarea generar valor a cancelar***"); +FlowUtil.executeClass("com.fp.armas.task.GenerarValorACancelar", maia); +//taskMetaData.getAditionalData().get("datosmail"); +//taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("BPMStatus")!=null)?""+maia.get("BPMStatus"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_19 + SequenceFlow_3 + System.out.println("Ingresa a tarea de enviar el mail de aceptacion de requisitos"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 10 , 11); + + + + + + + SequenceFlow_24 + SequenceFlow_25 + + + + + + + DataInput_40 + DataInput_41 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_40 + + + taskMetaData + DataInput_41 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + + + SequenceFlow_3 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",25, 1,120, "Revisar solicitud y documentos requeridos", 1, "OK_NO"); +//para asignar a un grupo especifico +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +kcontext.setVariable("taskMetaData",taskMetaData); +actualTask.add(taskMetaData); +tasksMetaData.put("Revisar solicitud y documentos requeridos",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Revisar solicitud y documentos requeridos + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_1 + SequenceFlow_7 + SequenceFlow_23 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + SequenceFlow_19 + SequenceFlow_24 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_5 + + + + SequenceFlow_7 + SequenceFlow_4 + //enviar mail al usuario indicando razones del rechazo +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 52 , 53); + + + + SequenceFlow_4 + SequenceFlow_5 + FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/RegistroDecomiso.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/RegistroDecomiso.bpmn new file mode 100644 index 0000000..51e1f00 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/RegistroDecomiso.bpmn @@ -0,0 +1,320 @@ + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_15 + + + + SequenceFlow_12 + SequenceFlow_16 + SequenceFlow_7 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("C".equals(taskMetaData.getResponse())); + + + SequenceFlow_16 + SequenceFlow_15 + //FlowUtil.endFlow(kcontext); + + + + SequenceFlow_3 + SequenceFlow_4 + //FlowUtil.endFlow(kcontext); + + + SequenceFlow_4 + + + + + SequenceFlow_23 + + + + SequenceFlow_23 + SequenceFlow_5 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_5 + SequenceFlow_6 + FlowUtil.executeClass("com.fp.armas.task.ValidacionDecomiso", maia); +taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("importacion")!=null)?""+maia.get("importacion"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + SequenceFlow_6 + SequenceFlow_2 + SequenceFlow_3 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_2 + SequenceFlow_12 + FlowUtil.executeClass("com.fp.armas.task.ObtieneCentroControl", maia); +taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("corganismo")!=null)?""+maia.get("corganismo"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_11 + + + + SequenceFlow_9 + SequenceFlow_11 + FlowUtil.endFlow(kcontext); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",60, 1,120, "Definir Sancion", 44, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Definir Sancion",actualTask); + + + SequenceFlow_7 + SequenceFlow_9 + + + + + + + + + + + + + + DataInput_43 + DataInput_44 + DataInput_45 + DataInput_46 + DataInput_47 + DataInput_48 + DataInput_49 + DataInput_50 + DataInput_51 + + + DataOutput_7 + DataOutput_10 + + + + DataInput_43 + + Definir Sancion + _DataInput_16 + + + + DataInput_44 + + + DataInput_45 + + + DataInput_46 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_47 + + + DataInput_48 + + + DataInput_49 + + + maia + DataInput_50 + + + taskMetaData + DataInput_51 + + + DataOutput_7 + maia + + + DataOutput_10 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/autorizarDocumentoCarlos.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/autorizarDocumentoCarlos.bpmn new file mode 100644 index 0000000..4728c5e --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/autorizarDocumentoCarlos.bpmn @@ -0,0 +1,287 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_5 + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_7 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",33,1,120,null, "Autorizar documento habilitante", 7, "OK_NO"); +System.out.println("Ingresa tarea---2-"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + System.out.println("Ingresa a la tarea 3"); +List old=(List)tasksMetaData.get("Autorizar documento habilitante"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Revisar solicitud y documentos requeridos",old); + + + SequenceFlow_8 + SequenceFlow_9 + + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_1 + taskMetaData + + + DataOutput_2 + maia + + + DataOutput_3 + actualTask + + + + SequenceFlow_7 + SequenceFlow_8 + System.out.println("Ingresa por el script"); + + + + SequenceFlow_9 + SequenceFlow_10 + SequenceFlow_11 + + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + SequenceFlow_1 + System.out.println("ingresa a enviar el mail"); +//enviar mail de rechazo +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + return ("A".equals(taskMetaData.getResponse())); + + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + + + System.out.println("fin"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",34, 1,120,null, "Visualizar tramite firma", 7, "OK_NO"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + + List old=(List)tasksMetaData.get("Visualizar tramite firma"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Aprobar tramite",old); + + + SequenceFlow_11 + SequenceFlow_5 + + + + + + + + DataInput_5 + DataInput_6 + + + DataOutput_4 + DataOutput_5 + DataOutput_6 + + + + maia + DataInput_5 + + + taskMetaData + DataInput_6 + + + DataOutput_4 + maia + + + DataOutput_5 + taskMetaData + + + DataOutput_6 + actualTask + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/decomisarArmaCarlos.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/decomisarArmaCarlos.bpmn new file mode 100644 index 0000000..df1fcde --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/decomisarArmaCarlos.bpmn @@ -0,0 +1,233 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_7 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",28,1,120,null, "Ficha Tecnica de Armas", 14, "OK_NO"); +System.out.println("Ingresa tarea---2-"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + System.out.println("Ingresa a la tarea 3"); +List old=(List)tasksMetaData.get("Ficha Tecnica de Armas"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Revisar solicitud y documentos requeridos",old); + + + SequenceFlow_8 + SequenceFlow_9 + + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_1 + taskMetaData + + + DataOutput_2 + maia + + + DataOutput_3 + actualTask + + + + SequenceFlow_7 + SequenceFlow_8 + System.out.println("Ingresa por el script"); + + + + SequenceFlow_9 + SequenceFlow_10 + SequenceFlow_3 + SequenceFlow_4 + + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + SequenceFlow_1 + System.out.println("ingresa a enviar el mail"); +//enviar mail de rechazo +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 15, 16); + + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + SequenceFlow_3 + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_4 + + + + return ("R".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/decomiso.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/decomiso.bpmn new file mode 100644 index 0000000..cc77e11 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/decomiso.bpmn @@ -0,0 +1,211 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_4 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + System.out.println("ingresa a LEGALIZAR EL ACTA"); +taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "Legalizar Acta", 1, "OK_NO"); + +//FlowUtil.executeClass("paquete.clase", maia); // la clase puede hacer lo que necesite +//taskMetaData.setUserId((maia.get("userId")!=null)?""+maia.get("userId"):null); +//taskMetaData.setGroupId((maia.get("groupId")!=null)?""+maia.get("groupId"):null); +//para asignar a un grupo especifico +taskMetaData.setGroupId("GERENCIA"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Legalizar Acta",actualTask); + + + SequenceFlow_4 + SequenceFlow_5 + + + + + + + + + + + + + + _DataInput_30 + _DataInput_31 + _DataInput_32 + _DataInput_33 + _DataInput_34 + _DataInput_35 + _DataInput_36 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_30 + + Legalizar Acta + _DataInput_30 + + + + _DataInput_31 + + + _DataInput_32 + + + _DataInput_33 + + #{taskMetaData.groupId} + _DataInput_33 + + + + _DataInput_34 + + + _DataInput_35 + + + _DataInput_36 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_5 + SequenceFlow_1 + System.out.println("ingresa a Actualizar Inventario"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarInventario", maia); // la clase puede hacer lo que necesite +System.out.println("-- Actualizar Inventario"); + + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/notificacionAnulacionTramite.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/notificacionAnulacionTramite.bpmn new file mode 100644 index 0000000..4d78c1b --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/notificacionAnulacionTramite.bpmn @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_7 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",23,1,120,null, "Notificacion de tramite anulado en la Solicitud de Guia de Libre Transito", 1, "OK_NO"); +System.out.println("Ingresa tarea---2-"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + System.out.println("Ingresa a la tarea 3"); +List old=(List)tasksMetaData.get("Notificacion de tramite anulado en la Solicitud de Guia de Libre Transito"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Revisar solicitud y documentos requeridos",old); + + + SequenceFlow_8 + SequenceFlow_9 + + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_1 + taskMetaData + + + DataOutput_2 + maia + + + DataOutput_3 + actualTask + + + + SequenceFlow_7 + SequenceFlow_8 + System.out.println("Ingresa por el script"); + + + + SequenceFlow_9 + SequenceFlow_10 + SequenceFlow_14 + + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + SequenceFlow_1 + System.out.println("ingresa a enviar el mail"); +//enviar mail de rechazo +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 13 , 12); + + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_14 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/solicitud.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/solicitud.bpmn new file mode 100644 index 0000000..ea8f060 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/solicitud.bpmn @@ -0,0 +1,280 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",25,1,120,null, "Revisar solicitud y documentos requeridos", 1, "OK_NO"); +System.out.println("Ingresa tarea---2-"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + System.out.println("Ingresa a la tarea 3"); +List old=(List)tasksMetaData.get("Revisar solicitud y documentos requeridos"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Revisar solicitud y documentos requeridos",old); + + + + + + + + + + CallActivity_2_maiaInput + CallActivity_2_taskMetaDataInput + + + CallActivity_2_actualTaskOutput + CallActivity_2_maiaOutput + CallActivity_2_taskMetaDataOutput + + + + maia + CallActivity_2_maiaInput + + + taskMetaData + CallActivity_2_taskMetaDataInput + + + CallActivity_2_actualTaskOutput + actualTask + + + CallActivity_2_maiaOutput + maia + + + CallActivity_2_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + System.out.println("fin"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",22, 1,120,null, "Aprobar tramite", 1, "OK_NO"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + List old=(List)tasksMetaData.get("Aprobar tramite"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Aprobar tramite",old); + + + + + + + + + + CallActivity_3_maiaInput + CallActivity_3_taskMetaDataInput + + + CallActivity_3_actualTaskOutput + CallActivity_3_maiaOutput + CallActivity_3_taskMetaDataOutput + + + + maia + CallActivity_3_maiaInput + + + taskMetaData + CallActivity_3_taskMetaDataInput + + + CallActivity_3_actualTaskOutput + actualTask + + + CallActivity_3_maiaOutput + maia + + + CallActivity_3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + return ("D".equals(taskMetaData.getResponse())); + + + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/solicitudCarlos.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/solicitudCarlos.bpmn new file mode 100644 index 0000000..ca0b574 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/solicitudCarlos.bpmn @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_7 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_7 + SequenceFlow_8 + System.out.println("Ingresa por el script"); + + + + SequenceFlow_4 + SequenceFlow_1 + System.out.println("ingresa a enviar el mail"); +//enviar mail de notificacion +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 4 ,5); + + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",35,1,120,null, "Notificar fecha de Emision", 6, "OK_NO"); +System.out.println("Ingresa tarea---2-"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + System.out.println("Ingresa a la tarea 3"); +List old=(List)tasksMetaData.get("Notificar fecha de Emision"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Notificar fecha de Emision",old); + + + SequenceFlow_8 + SequenceFlow_4 + + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_1 + taskMetaData + + + DataOutput_2 + maia + + + DataOutput_3 + actualTask + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/solicitudFlow.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/solicitudFlow.bpmn new file mode 100644 index 0000000..7ef9d5e --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/solicitudFlow.bpmn @@ -0,0 +1,525 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_4 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + System.out.println("Ingresa tarea----"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",25,1,120,null, "Revisar solicitud y documentos requeridos", 10, "OK_NO"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + System.out.println("Ingresa a la tarea 3"); +List old=(List)tasksMetaData.get("Revisar solicitud y documentos requeridos"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Revisar requisitos",old); + + + SequenceFlow_4 + SequenceFlow_9 + + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_1 + taskMetaData + + + DataOutput_2 + maia + + + DataOutput_3 + actualTask + + + + SequenceFlow_9 + SequenceFlow_10 + SequenceFlow_11 + + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + SequenceFlow_1 + System.out.println("ingresa a enviar el mail"); +//enviar mail al jefe del empleado +FlowUtil.mail("com.fp.armas.mail.SolicitanteDireccion", maia, taskMetaData, 27 , 26); + + + + + SequenceFlow_11 + SequenceFlow_3 + SequenceFlow_8 + + + return ("1".equals("1")); + + + SequenceFlow_3 + SequenceFlow_7 + System.out.println("ingresa a enviar el mail de aceptacion de requisitos"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.SolicitanteDireccion", maia, taskMetaData, 10 , 11); + + + + SequenceFlow_8 + SequenceFlow_21 + System.out.println("El valor del depósito es cero"); +FlowUtil.endFlow(kcontext); + + + return ("2".equals("1")); + + + + + System.out.println("fin"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",22, 1,120,null, "Aprobar tramite", 1, "OK_NO"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + + List old=(List)tasksMetaData.get("Aprobar tramite"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Aprobar tramite",old); + + + SequenceFlow_7 + SequenceFlow_15 + + + + + + + + DataInput_5 + DataInput_6 + + + DataOutput_4 + DataOutput_5 + DataOutput_6 + + + + maia + DataInput_5 + + + taskMetaData + DataInput_6 + + + DataOutput_4 + maia + + + DataOutput_5 + taskMetaData + + + DataOutput_6 + actualTask + + + + + + + System.out.println("fin"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",22, 1,120,null, "Aprobar tramite", 1, "OK_NO"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + + List old=(List)tasksMetaData.get("Aprobar tramite"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Aprobar tramite",old); + + + SequenceFlow_15 + SequenceFlow_16 + + + + + + + + DataInput_1 + DataInput_2 + + + DataOutput_7 + DataOutput_8 + DataOutput_9 + + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_7 + maia + + + DataOutput_8 + taskMetaData + + + DataOutput_9 + actualTask + + + + + SequenceFlow_17 + + + + System.out.println("El valor a cancelar generado es: "); + SequenceFlow_18 + SequenceFlow_17 + System.out.println("ingresa a enviar el mail de aceptacion de requisitos"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.SolicitanteDireccion", maia, taskMetaData, 10 , 11); + + + + SequenceFlow_16 + SequenceFlow_18 + SequenceFlow_19 + + + return ("1".equals("1")); + + + SequenceFlow_1 + SequenceFlow_2 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + return ("2".equals("1")); + + + + + System.out.println("fin"); +taskMetaData=FlowUtil.createTaskInfoByClassName("30",22, 1,120,null, "Aprobar tramite", 1, "OK_NO"); +maia.put("userId","ADMIN"); +maia.put("action","A"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + + List old=(List)tasksMetaData.get("Aprobar tramite"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Aprobar tramite",old); + + + SequenceFlow_19 + SequenceFlow_21 + SequenceFlow_20 + + + + + + + + DataInput_7 + DataInput_8 + + + DataOutput_10 + DataOutput_11 + DataOutput_12 + + + + maia + DataInput_7 + + + taskMetaData + DataInput_8 + + + DataOutput_10 + maia + + + DataOutput_11 + taskMetaData + + + DataOutput_12 + actualTask + + + + + SequenceFlow_20 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comaco/subproceso.bpmn b/base/bpm/bpmlib/target/classes/flows/comaco/subproceso.bpmn new file mode 100644 index 0000000..54da02e --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comaco/subproceso.bpmn @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + _1-_15 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "Validar Reimpresion", 32, "OK_NO"); + +//FlowUtil.executeClass("paquete.clase", maia); // la clase puede hacer lo que necesite +//taskMetaData.setUserId((maia.get("userId")!=null)?""+maia.get("userId"):null); +//taskMetaData.setGroupId((maia.get("groupId")!=null)?""+maia.get("groupId"):null); +//para asignar a un grupo especifico +taskMetaData.setGroupId("GERENCIA"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar Reimpresion",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Validar Reimpresion + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + _16-_12 + + + + SequenceFlow_6 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_3 + SequenceFlow_6 + System.out.println("Ingresa por el script fin................................................"); +System.out.println("Ingresa por el script fin................................................"); +System.out.println("Ingresa por el script fin................................................"); +System.out.println("Ingresa por el script fin................................................"); +System.out.println("Ingresa por el script fin................................................"); +System.out.println("Ingresa por el script fin................................................"); + + + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Emision Documento Habilitante",actualTask); + + + SequenceFlow_1 + SequenceFlow_3 + + + + + + + DataInput_79 + DataInput_80 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_79 + + + taskMetaData + DataInput_80 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comacov2/CargaDepositoV2.bpmn b/base/bpm/bpmlib/target/classes/flows/comacov2/CargaDepositoV2.bpmn new file mode 100644 index 0000000..aaedd28 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comacov2/CargaDepositoV2.bpmn @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_11 + + + + SequenceFlow_10 + SequenceFlow_11 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_9 + SequenceFlow_10 + System.out.println("Ingresa a tarea de enviar el mail de Notificar inconsistencia deposito"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 17 , 18); + + + + _1-_15 + SequenceFlow_1 + System.out.println("..........................CARGA DEPOSITO V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",42, 1,120, "Validar transaccion de deposito", 24, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidaFlujoCargaDeposito", maia); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar transaccion de deposito",actualTask); + + + SequenceFlow_1 + SequenceFlow_6 + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + + + + _DataInput_16 + + Validar transaccion de deposito + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + _1-_15 + + + + + + //taskMetaData=FlowUtil.createTaskInfoByClassName("30",24, 1,30,"com.fp.viaticos.task.AsignarEmpleado", "Modificar empleado", 11, "OK_NO"); +//kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_2 + SequenceFlow_15 + + + + + + + DataInput_18 + DataInput_19 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_18 + + + taskMetaData + DataInput_19 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + + _16-_12 + + + + SequenceFlow_15 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_6 + SequenceFlow_9 + SequenceFlow_2 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionAperturaV2.bpmn b/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionAperturaV2.bpmn new file mode 100644 index 0000000..477cfd4 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionAperturaV2.bpmn @@ -0,0 +1,312 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("..........................EJECUCION APERTURA AGENCIA V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar Info Agencias", 1, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar Info Agencias",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + + + + + + _DataInput_191 + _DataInput_192 + _DataInput_193 + _DataInput_194 + _DataInput_195 + _DataInput_196 + _DataInput_197 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_191 + + Validar Info Agencias + _DataInput_191 + + + + _DataInput_192 + + + _DataInput_193 + + + _DataInput_194 + + #{taskMetaData.groupId} + _DataInput_194 + + + + _DataInput_195 + + + _DataInput_196 + + + _DataInput_197 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + SequenceFlow_5 + SequenceFlow_6 + //FlowUtil.endFlow(kcontext); + + + SequenceFlow_6 + + + + + SequenceFlow_8 + SequenceFlow_9 + //FlowUtil.endFlow(kcontext); + + + SequenceFlow_9 + + + + + + + + + + + SequenceFlow_7 + SequenceFlow_8 + + + + + + + DataInput_5 + DataInput_6 + + + DataOutput_5 + DataOutput_6 + + + + maia + DataInput_5 + + + taskMetaData + DataInput_6 + + + DataOutput_5 + maia + + + DataOutput_6 + taskMetaData + + + + + SequenceFlow_4 + SequenceFlow_5 + System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + SequenceFlow_3 + SequenceFlow_4 + SequenceFlow_7 + + + System.out.println("Camino D"); +return ("D".equals(taskMetaData.getResponse())); + + + System.out.println("Camino A"); +return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionAutorizacionV2.bpmn b/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionAutorizacionV2.bpmn new file mode 100644 index 0000000..19dce39 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionAutorizacionV2.bpmn @@ -0,0 +1,632 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + _1-_15 + SequenceFlow_1 + System.out.println("..........................EJECUCION AUTORIZACION V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar tipo de Autorizacion", 1, "OK_NO"); +maia.put("grupo","SUPERV_INSP_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar tipo de Autorizacion",actualTask); + + + SequenceFlow_1 + SequenceFlow_12 + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + DataInput_5 + DataInput_6 + DataInput_12 + DataInput_7 + DataInput_8 + + + DataOutput_6 + DataOutput_7 + + + + DataInput_1 + + Validar tipo de Autorizacion + _DataInput_149 + + + + DataInput_2 + + + DataInput_3 + + + DataInput_4 + + #{taskMetaData.groupId} + _DataInput_152 + + + + DataInput_5 + + + DataInput_6 + + + DataInput_12 + + + maia + DataInput_7 + + + taskMetaData + DataInput_8 + + + DataOutput_6 + maia + + + DataOutput_7 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_16 + + + + SequenceFlow_12 + SequenceFlow_15 + SequenceFlow_7 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + Requiere Inspeccion + SequenceFlow_7 + SequenceFlow_13 + System.out.println("............................................................................................Autorizacion Previa de Importacion"); +FlowUtil.executeClass("com.fp.armas.task.ValAutorizacionPreviaImporta", maia); +if(taskMetaData ==null){ + taskMetaData = new com.fp.simple.dto.TaskInfo(); +} +taskMetaData.setResponse((maia.get("previaimportacion")!=null)?""+maia.get("previaimportacion"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_13 + SequenceFlow_19 + SequenceFlow_20 + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar tipo de Autorizacion VUE", 1, "OK_NO"); +taskMetaData.setGroupId("ANALISTA_VUE"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar tipo de Autorizacion VUE",actualTask); + + + SequenceFlow_19 + SequenceFlow_21 + + + + + + + + + + + + + + DataInput_14 + DataInput_15 + DataInput_16 + DataInput_17 + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_21 + DataInput_22 + + + DataOutput_1 + DataOutput_2 + + + + DataInput_14 + + Validar tipo de Autorizacion VUE + _DataInput_149 + + + + DataInput_15 + + + DataInput_16 + + + DataInput_17 + + #{taskMetaData.groupId} + _DataInput_152 + + + + DataInput_18 + + + DataInput_19 + + + DataInput_20 + + + maia + DataInput_21 + + + taskMetaData + DataInput_22 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_17 + SequenceFlow_2 + SequenceFlow_3 + + + return ("N".equals(taskMetaData.getResponse())); + + + return ("Y".equals(taskMetaData.getResponse())); + + + SequenceFlow_8 + _16-_12 + + + + Requiere Inspeccion + SequenceFlow_22 + SequenceFlow_17 + System.out.println(".............................................................................................Requiere Inspeccion :"); +FlowUtil.executeClass("com.fp.armas.task.RequiereInspeccion", maia); +if(taskMetaData ==null){ + taskMetaData = new com.fp.simple.dto.TaskInfo(); +} +taskMetaData.setResponse((maia.get("inspeccion")!=null)?""+maia.get("inspeccion"):null); +System.out.println(".............................................................................................Requiere Inspeccion :"+taskMetaData.getResponse()); +kcontext.setVariable("taskMetaData",taskMetaData); +System.out.println(".............................................................................................Requiere Inspeccion :"+taskMetaData.getResponse()); + + + + SequenceFlow_2 + SequenceFlow_9 + SequenceFlow_5 + + + + _16-_12 + + + + + + System.out.println("............................................................................................ Inspeccion :"); + + + System.out.println("............................................................................................ Inspeccion OK"); +FlowUtil.executeClass("com.fp.armas.task.ValidaInspeccion", maia); +if(taskMetaData ==null){ + taskMetaData = new com.fp.simple.dto.TaskInfo(); +} +taskMetaData.setResponse((maia.get("tramiteproceso")!=null)?""+maia.get("tramiteproceso"):null); +kcontext.setVariable("taskMetaData",taskMetaData); +System.out.println("..........................................................................................regreso... :"+taskMetaData.getResponse()); + + + SequenceFlow_3 + SequenceFlow_4 + + + + + + + DataInput_11 + DataInput_13 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + taskMetaData + DataInput_13 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + + SequenceFlow_11 + + + + + + + SequenceFlow_5 + SequenceFlow_8 + + + + + + + DataInput_9 + DataInput_10 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_9 + + + taskMetaData + DataInput_10 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + + SequenceFlow_10 + SequenceFlow_11 + + + + return ("D".equals(taskMetaData.getResponse())); + + + + SequenceFlow_20 + SequenceFlow_21 + SequenceFlow_22 + + + + SequenceFlow_4 + SequenceFlow_9 + SequenceFlow_10 + + + return ("Y".equals(taskMetaData.getResponse())); + + + return ("N".equals(taskMetaData.getResponse())); + + + SequenceFlow_15 + SequenceFlow_16 + System.out.println("............................................................................................ RECHAZA VALIDAR TIPO SOLICITUD:"); +System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones","Tramite Anulado en Validar Tipo De Autorizacion"+datosmail.get("observaciones")); +}else{ +maia.put("observaciones","Tramite Anulado en Validar Tipo De Autorizacion"); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionCertificadoFiscalia.bpmn b/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionCertificadoFiscalia.bpmn new file mode 100644 index 0000000..1d33f14 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionCertificadoFiscalia.bpmn @@ -0,0 +1,292 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + System.out.println("..........................EJECUCION CERTIFICADO DE FISCALIA......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",153, 1,120, "Generar certificado fiscalia", 65, "OK_NO"); +maia.put("grupo","TEC_ALM_CENTRO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData=FlowUtil.createTaskInfo("30",153, 1,120, "Generar certificado fiscalia", 65, "OK_NO"); +//para asignar a un grupo especifico +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + SequenceFlow_2 + SequenceFlow_5 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Generar certificado fiscalia + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + _1-_15 + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",118, 1,120, "Firmar certificado fiscalia", 66, "OK_NO"); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar certificado fiscalia",actualTask); + + + SequenceFlow_5 + SequenceFlow_4 + + + + + + + + + + + + + + DataInput_17 + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_21 + DataInput_22 + DataInput_23 + DataInput_24 + DataInput_25 + + + DataOutput_3 + DataOutput_5 + + + + DataInput_17 + + Firmar certificado fiscalia + _DataInput_16 + + + + DataInput_18 + + + DataInput_19 + + + DataInput_20 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_21 + + + DataInput_22 + + + DataInput_23 + + + maia + DataInput_24 + + + taskMetaData + DataInput_25 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_4 + SequenceFlow_6 + System.out.println("..........................NOTIFICAR ENTREGA CERTIFICADO FISCALIA......................."); + + + + SequenceFlow_6 + SequenceFlow_1 + System.out.println("..........................FINALIZA CERTIFICADO DE FISCALIA......................."); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionDevolucionV2.bpmn b/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionDevolucionV2.bpmn new file mode 100644 index 0000000..e7fb61d --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionDevolucionV2.bpmn @@ -0,0 +1,412 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_10 + System.out.println("..........................EJECUCION DEVOLUCION V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + _1-_15 + + + + SequenceFlow_11 + SequenceFlow_5 + SequenceFlow_7 + + + + + taskMetaData=FlowUtil.createTaskInfo("30",32, 1,120, "Autorizar Devolucion",37, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +System.out.println("1..................."); +actualTask=new java.util.ArrayList(); +System.out.println("2..................."); +kcontext.setVariable("actualTask",actualTask); +System.out.println("3..................."); +actualTask.add(taskMetaData); +System.out.println("4..................."); +System.out.println("5..................."); +tasksMetaData.put("Autorizar Devolucion",actualTask); +System.out.println("6..................."); + + + SequenceFlow_5 + SequenceFlow_1 + + + + + + + + + + + + + + DataInput_13 + DataInput_14 + DataInput_15 + DataInput_16 + DataInput_17 + DataInput_18 + DataInput_19 + DataInput_20 + DataInput_21 + + + DataOutput_1 + DataOutput_2 + + + + DataInput_13 + + Autorizar Devolucion + _DataInput_16 + + + + DataInput_14 + + + DataInput_15 + + + DataInput_16 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_17 + + + DataInput_18 + + + DataInput_19 + + + maia + DataInput_20 + + + taskMetaData + DataInput_21 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_7 + _16-_12 + System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + _16-_12 + + + + return ("D".equals(taskMetaData.getResponse())); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",29, 1,120, "Informacion Devolucion", 36, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","TEC_ALM_CENTRO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Informacion Devolucion",actualTask); + + + + SequenceFlow_10 + SequenceFlow_11 + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + DataInput_5 + DataInput_6 + DataInput_7 + DataInput_8 + DataInput_9 + + + DataOutput_3 + DataOutput_5 + + + + DataInput_1 + + Informacion Devolucion + _DataInput_16 + + + + DataInput_2 + + + DataInput_3 + + + DataInput_4 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_5 + + + DataInput_6 + + + DataInput_7 + + + maia + DataInput_8 + + + taskMetaData + DataInput_9 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_2 + SequenceFlow_6 + System.out.println("fin"); +//FlowUtil.endFlow(kcontext); +System.out.println("fin1"); + + + + SequenceFlow_6 + + + + + + + SequenceFlow_1 + SequenceFlow_2 + + + + + + + DataInput_10 + DataInput_11 + + + DataOutput_4 + DataOutput_6 + + + + maia + DataInput_10 + + + taskMetaData + DataInput_11 + + + DataOutput_4 + maia + + + DataOutput_6 + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionEmisionGuiaTransitoV2.bpmn b/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionEmisionGuiaTransitoV2.bpmn new file mode 100644 index 0000000..f0b4a8c --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionEmisionGuiaTransitoV2.bpmn @@ -0,0 +1,423 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + _1-_15 + SequenceFlow_2 + System.out.println("..........................EMISION GUIA LIBRE TRANSITO V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_1 + SequenceFlow_5 + SequenceFlow_13 + + + return ("D".equals(taskMetaData.getResponse())); + + + + + taskMetaData=FlowUtil.createTaskInfo("30",23, 1,120, "Validacion Inconsistencias Informacion Solicitud", 56, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validacion Inconsistencias Informacion Solicitud",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Validacion Inconsistencias Informacion Solicitud + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_5 + SequenceFlow_6 + System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,61); + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_13 + SequenceFlow_16 + System.out.println(" Verifica cantidad armamento "); +FlowUtil.executeClass("com.fp.armas.task.VerificarCantidadArmas", maia); +taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("requierecustodia")!=null)?""+maia.get("requierecustodia"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + SequenceFlow_16 + SequenceFlow_20 + SequenceFlow_24 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_20 + SequenceFlow_15 + SequenceFlow_22 + + + + + + System.out.println(" Genera Orden trabajo "); +taskMetaData=FlowUtil.createTaskInfo("30",27, 1,120, "Generar Orden Trabajo", 55, "OK_NO"); +maia.put("grupo","SUPERV_INSP_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Generar Orden Trabajo",actualTask); + + + SequenceFlow_24 + SequenceFlow_15 + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + + + DataOutput_11 + DataOutput_12 + + + + maia + DataInput_1 + + + DataInput_2 + + Generar Orden Trabajo + DataInput_26 + + + + DataInput_3 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_4 + + + DataOutput_11 + maia + + + DataOutput_12 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + System.out.println(" Documento Habilitante "); + + + + + + SequenceFlow_22 + SequenceFlow_23 + + + + + + + + DataInput_90 + DataInput_91 + + + DataOutput_19 + DataOutput_20 + DataOutput_21 + + + + maia + DataInput_90 + + + taskMetaData + DataInput_91 + + + DataOutput_19 + taskMetaData + + + DataOutput_20 + maia + + + DataOutput_21 + actualTask + + + + + SequenceFlow_23 + _16-_12 + //FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + SequenceFlow_6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionIncrementoArmasV2.bpmn b/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionIncrementoArmasV2.bpmn new file mode 100644 index 0000000..45185af --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionIncrementoArmasV2.bpmn @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("..........................EJECUCION INCREMENTO DE ARMAS V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("actualTask",actualTask); +kcontext.setVariable("tasksMetaData",tasksMetaData); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar la Informacion Armas", 59, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar la Informacion Armas",actualTask); + + + SequenceFlow_2 + SequenceFlow_6 + + + + + + + + + + + + + + _DataInput_184 + _DataInput_185 + _DataInput_186 + _DataInput_187 + _DataInput_188 + _DataInput_189 + _DataInput_190 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_184 + + Validar la Informacion Armas + _DataInput_184 + + + + _DataInput_185 + + + _DataInput_186 + + + _DataInput_187 + + #{taskMetaData.groupId} + _DataInput_187 + + + + _DataInput_188 + + + _DataInput_189 + + + _DataInput_190 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_10 + SequenceFlow_11 + System.out.println(" Anula Incremento de Armas: "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + SequenceFlow_11 + SequenceFlow_12 + + + + SequenceFlow_6 + SequenceFlow_7 + SequenceFlow_10 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_8 + SequenceFlow_9 + \ + + + + + + + + + + SequenceFlow_7 + SequenceFlow_8 + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_4 + DataOutput_5 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_4 + maia + + + DataOutput_5 + taskMetaData + + + + + + SequenceFlow_9 + + + + SequenceFlow_12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionInternacionV2.bpmn b/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionInternacionV2.bpmn new file mode 100644 index 0000000..bef9887 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionInternacionV2.bpmn @@ -0,0 +1,321 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("..........................EJECUCION INTERNACION V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("actualTask",actualTask); +kcontext.setVariable("tasksMetaData",tasksMetaData); + + + + SequenceFlow_11 + SequenceFlow_12 + + + SequenceFlow_12 + + + + + SequenceFlow_4 + SequenceFlow_7 + SequenceFlow_10 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + + + + + + + SequenceFlow_7 + SequenceFlow_8 + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_4 + DataOutput_5 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_4 + maia + + + DataOutput_5 + taskMetaData + + + + + SequenceFlow_8 + SequenceFlow_9 + + + + SequenceFlow_10 + SequenceFlow_11 + System.out.println("***SE ANULO EL TRAMITE***"); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Validar Info Armas", 1, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar Info Armas",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + + + + + + _DataInput_184 + _DataInput_185 + _DataInput_186 + _DataInput_187 + _DataInput_188 + _DataInput_189 + _DataInput_190 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_184 + + Validar Info Armas + _DataInput_184 + + + + _DataInput_185 + + + _DataInput_186 + + + _DataInput_187 + + #{taskMetaData.groupId} + _DataInput_187 + + + + _DataInput_188 + + + _DataInput_189 + + + _DataInput_190 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_3 + SequenceFlow_4 + System.out.println("***SE ANULO EL TRAMITE***"); + + + + + SequenceFlow_9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionPermisoV2.bpmn b/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionPermisoV2.bpmn new file mode 100644 index 0000000..c547eb8 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionPermisoV2.bpmn @@ -0,0 +1,308 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_1 + System.out.println("..........................EJECUCION PERMISO V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData =new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",24, 1,120, "Receptar Armas", 45, "OK_NO"); +maia.put("grupo","TEC_ALM_CENTRO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Receptar Armas",actualTask); + + + SequenceFlow_1 + SequenceFlow_16 + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_1 + + + DataInput_2 + + Receptar Armas + DataInput_26 + + + + DataInput_3 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_4 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + _1-_15 + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",28, 1,120, "Ingresa Ficha Tecnica Arma", 46, "OK_NO"); +maia.put("grupo","ANALISTA_TIRO_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ingresa Ficha Tecnica Arma",actualTask); + + + SequenceFlow_16 + SequenceFlow_17 + + + + + + + + + DataInput_6 + DataInput_7 + DataInput_8 + DataInput_9 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_6 + + + DataInput_7 + + Ingresa Ficha Tecnica Arma + DataInput_26 + + + + DataInput_8 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_9 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + SequenceFlow_12 + SequenceFlow_13 + //FlowUtil.endFlow(kcontext); + + + + + + + + + SequenceFlow_17 + SequenceFlow_12 + + + + + + + + DataInput_39 + DataInput_40 + + + DataOutput_14 + DataOutput_15 + DataOutput_16 + + + + maia + DataInput_39 + + + taskMetaData + DataInput_40 + + + DataOutput_14 + actualTask + + + DataOutput_15 + maia + + + DataOutput_16 + taskMetaData + + + + + SequenceFlow_13 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionTramiteV2.bpmn b/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionTramiteV2.bpmn new file mode 100644 index 0000000..30c6c0b --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comacov2/EjecucionTramiteV2.bpmn @@ -0,0 +1,721 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_4 + System.out.println("..........................EJECUCION TRAMITE V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + _1-_15 + + + + + SequenceFlow_4 + SequenceFlow_5 + System.out.println("***Ingresa a la tarea evaluar tipo de documento***"); +FlowUtil.executeClass("com.fp.armas.task.TipoDocumento", maia); +// taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("tipodocumento")!=null)?""+maia.get("tipodocumento"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_5 + SequenceFlow_11 + SequenceFlow_13 + SequenceFlow_15 + SequenceFlow_17 + SequenceFlow_19 + SequenceFlow_21 + SequenceFlow_24 + SequenceFlow_26 + SequenceFlow_27 + SequenceFlow_29 + + + + + + + SequenceFlow_30 + SequenceFlow_9 + + + + + + + DataInput_15 + DataInput_16 + + + DataOutput_6 + DataOutput_7 + + + + maia + DataInput_15 + + + taskMetaData + DataInput_16 + + + DataOutput_6 + maia + + + DataOutput_7 + taskMetaData + + + + + return ("EA".equals(taskMetaData.getResponse())); + + + return ("EI".equals(taskMetaData.getResponse())); + + + return ("ET".equals(taskMetaData.getResponse())); + + + return ("EG".equals(taskMetaData.getResponse())); + + + SequenceFlow_9 + SequenceFlow_12 + SequenceFlow_14 + SequenceFlow_16 + SequenceFlow_18 + SequenceFlow_20 + SequenceFlow_22 + SequenceFlow_23 + SequenceFlow_25 + SequenceFlow_28 + SequenceFlow_10 + + + + SequenceFlow_10 + _16-_12 + //FlowUtil.endFlow(kcontext); + + + + return ("EC".equals(taskMetaData.getResponse())); + + + + + + + SequenceFlow_13 + SequenceFlow_14 + + + + + + + DataInput_19 + DataInput_20 + + + DataOutput_11 + DataOutput_12 + + + + maia + DataInput_19 + + + taskMetaData + DataInput_20 + + + DataOutput_11 + maia + + + DataOutput_12 + taskMetaData + + + + + + + + + SequenceFlow_11 + SequenceFlow_12 + + + + + + + DataInput_17 + DataInput_18 + + + DataOutput_9 + DataOutput_10 + + + + maia + DataInput_17 + + + taskMetaData + DataInput_18 + + + DataOutput_9 + maia + + + DataOutput_10 + taskMetaData + + + + + return ("ER".equals(taskMetaData.getResponse())); + + + return ("ED".equals(taskMetaData.getResponse())); + + + return ("ES".equals(taskMetaData.getResponse())); + + + return ("EN".equals(taskMetaData.getResponse())); + + + + + + + SequenceFlow_19 + SequenceFlow_20 + + + + + + + DataInput_25 + DataInput_27 + + + DataOutput_17 + DataOutput_18 + + + + maia + DataInput_25 + + + taskMetaData + DataInput_27 + + + DataOutput_17 + maia + + + DataOutput_18 + taskMetaData + + + + + + + + + SequenceFlow_26 + SequenceFlow_25 + + + + + + + DataInput_33 + DataInput_34 + + + DataOutput_23 + DataOutput_24 + + + + maia + DataInput_33 + + + taskMetaData + DataInput_34 + + + DataOutput_23 + maia + + + DataOutput_24 + taskMetaData + + + + + + + + + SequenceFlow_21 + SequenceFlow_22 + + + + + + + DataInput_28 + DataInput_30 + + + DataOutput_19 + DataOutput_20 + + + + maia + DataInput_28 + + + taskMetaData + DataInput_30 + + + DataOutput_19 + maia + + + DataOutput_20 + taskMetaData + + + + + + + + + SequenceFlow_15 + SequenceFlow_16 + + + + + + + DataInput_21 + DataInput_22 + + + DataOutput_13 + DataOutput_14 + + + + maia + DataInput_21 + + + taskMetaData + DataInput_22 + + + DataOutput_13 + maia + + + DataOutput_14 + taskMetaData + + + + + + + + + SequenceFlow_27 + SequenceFlow_28 + + + + + + + DataInput_35 + DataInput_36 + + + DataOutput_25 + DataOutput_26 + + + + maia + DataInput_35 + + + taskMetaData + DataInput_36 + + + DataOutput_25 + maia + + + DataOutput_26 + taskMetaData + + + + + + + + + SequenceFlow_24 + SequenceFlow_23 + + + + + + + DataInput_31 + DataInput_32 + + + DataOutput_21 + DataOutput_22 + + + + maia + DataInput_31 + + + taskMetaData + DataInput_32 + + + DataOutput_21 + maia + + + DataOutput_22 + taskMetaData + + + + + + + + + SequenceFlow_17 + SequenceFlow_18 + + + + + + + DataInput_23 + DataInput_24 + + + DataOutput_15 + DataOutput_16 + + + + maia + DataInput_23 + + + taskMetaData + DataInput_24 + + + DataOutput_15 + maia + + + DataOutput_16 + taskMetaData + + + + + SequenceFlow_29 + SequenceFlow_30 + System.out.println("***Ingresa a la tarea NOTIFICAR FECHA DE ENTRGA DE ARMAS***"); +//enviar mail de notificacion +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 39,40); + + + return ("EP".equals(taskMetaData.getResponse())); + + + + _16-_12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comacov2/EjecutarCertificadosV2.bpmn b/base/bpm/bpmlib/target/classes/flows/comacov2/EjecutarCertificadosV2.bpmn new file mode 100644 index 0000000..7cd34a0 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comacov2/EjecutarCertificadosV2.bpmn @@ -0,0 +1,277 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + SequenceFlow_12 + System.out.println("..........................EJECUCION CERTIFICADO V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + SequenceFlow_10 + + + + SequenceFlow_9 + SequenceFlow_10 + System.out.println("TramiteAnulado"); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ejecutar Certificados",actualTask); + + + SequenceFlow_8 + SequenceFlow_5 + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_3 + DataOutput_4 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_3 + maia + + + DataOutput_4 + taskMetaData + + + + + SequenceFlow_13 + SequenceFlow_8 + SequenceFlow_9 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_5 + SequenceFlow_6 + + + + SequenceFlow_1 + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Valida Informacion Certificado", 58, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Valida Informacion Certificado",actualTask); + + + SequenceFlow_12 + SequenceFlow_13 + + + + + + + + + DataInput_5 + DataInput_6 + DataInput_7 + DataInput_8 + + + DataOutput_5 + DataOutput_6 + + + + maia + DataInput_5 + + + DataInput_6 + + Valida Informacion Certificado + DataInput_26 + + + + DataInput_7 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_8 + + + DataOutput_5 + maia + + + DataOutput_6 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comacov2/EjecutarInscripcionV2.bpmn b/base/bpm/bpmlib/target/classes/flows/comacov2/EjecutarInscripcionV2.bpmn new file mode 100644 index 0000000..ce3905b --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comacov2/EjecutarInscripcionV2.bpmn @@ -0,0 +1,314 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("..........................EJECUCION INSCRIPCION V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",61, 1,120, "Valida Info Inscripcion", 1, "OK_NO"); +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Valida Info Inscripcion",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + + + + + + _DataInput_149 + _DataInput_150 + _DataInput_151 + _DataInput_152 + _DataInput_153 + _DataInput_154 + _DataInput_155 + DataInput_2 + DataInput_3 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_149 + + Valida Info Inscripcion + _DataInput_149 + + + + _DataInput_150 + + + _DataInput_151 + + + _DataInput_152 + + #{taskMetaData.groupId} + _DataInput_152 + + + + _DataInput_153 + + + _DataInput_154 + + + _DataInput_155 + + + maia + DataInput_2 + + + taskMetaData + DataInput_3 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ejecutar Certificados",actualTask); + + + SequenceFlow_4 + SequenceFlow_5 + + + + + + + DataInput_4 + DataInput_5 + + + DataOutput_3 + DataOutput_4 + + + + maia + DataInput_4 + + + taskMetaData + DataInput_5 + + + DataOutput_3 + maia + + + DataOutput_4 + taskMetaData + + + + SequenceFlow_5 + SequenceFlow_6 + //FlowUtil.endFlow(kcontext); + + + + + SequenceFlow_7 + SequenceFlow_9 + System.out.println("***SE ANULO EL TRAMITE***"); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones",datosmail.get("observaciones")); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + SequenceFlow_9 + SequenceFlow_10 + //FlowUtil.endFlow(kcontext); + + + + SequenceFlow_10 + + + + + SequenceFlow_3 + SequenceFlow_4 + SequenceFlow_7 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comacov2/EmisionDocumentoHabilitanteV2.bpmn b/base/bpm/bpmlib/target/classes/flows/comacov2/EmisionDocumentoHabilitanteV2.bpmn new file mode 100644 index 0000000..93d09eb --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comacov2/EmisionDocumentoHabilitanteV2.bpmn @@ -0,0 +1,892 @@ + + + + + + + + + + + + + + + + + + + + + + + + System.out.println("..........................NO REQUIERE TARJETA EDH V2......................."); +taskMetaData=FlowUtil.createTaskInfo("30",102, 1,120, "Generar Reporte", 35, "OK_NO"); +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Generar Reporte",actualTask); + + + SequenceFlow_17 + SequenceFlow_20 + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_3 + DataInput_4 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_1 + + + DataInput_2 + + Generar Reporte + DataInput_26 + + + + DataInput_3 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_4 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_25 + SequenceFlow_26 + SequenceFlow_5 + + + + + taskMetaData=FlowUtil.createTaskInfo("30",101, 1,120, "Firmar Tramite Supervisor", 38, "OK_NO"); +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar Tramite Supervisor",actualTask); + + + SequenceFlow_20 + SequenceFlow_25 + + + + + + + + + + + + + + DataInput_21 + DataInput_22 + DataInput_23 + DataInput_24 + DataInput_25 + DataInput_27 + DataInput_28 + DataInput_30 + DataInput_31 + + + DataOutput_6 + DataOutput_7 + + + + DataInput_21 + + Firmar Tramite Supervisor + _DataInput_16 + + + + DataInput_22 + + + DataInput_23 + + + DataInput_24 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_25 + + + DataInput_27 + + + DataInput_28 + + + maia + DataInput_30 + + + taskMetaData + DataInput_31 + + + DataOutput_6 + maia + + + DataOutput_7 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_6 + SequenceFlow_1 + SequenceFlow_28 + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_28 + SequenceFlow_29 + FlowUtil.executeClass("com.fp.armas.task.FechaCaducidadEstadoArma", maia); +FlowUtil.executeClass("com.fp.armas.task.TramiteAprobado", maia); +FlowUtil.executeClass("com.fp.armas.task.TipoArchivoControl", maia); +FlowUtil.executeClass("com.fp.armas.task.FinalizarDocumentoHabilitante", maia); +taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.getAditionalData().put("datosmail", maia.get("datosmail")); +taskMetaData.setResponse((maia.get("tipoarchivo")!=null)?""+maia.get("tipoarchivo"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + return ("A".equals(taskMetaData.getResponse())); + + + + SequenceFlow_29 + SequenceFlow_30 + SequenceFlow_35 + + + + + taskMetaData=FlowUtil.createTaskInfo("30",109, 1,120, "Firmar Tramite Coordinador", 38, "OK_NO"); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Firmar Tramite Coordinador",actualTask); + + + SequenceFlow_30 + SequenceFlow_31 + + + + + + + + + + + + + + DataInput_5 + DataInput_6 + DataInput_7 + DataInput_8 + DataInput_9 + DataInput_10 + DataInput_12 + DataInput_13 + DataInput_14 + + + DataOutput_13 + DataOutput_14 + + + + DataInput_5 + + Firmar Tramite Coordinador + _DataInput_16 + + + + DataInput_6 + + + DataInput_7 + + + DataInput_8 + + #{taskMetaData.groupId} + _DataInput_19 + + + + DataInput_9 + + + DataInput_10 + + + DataInput_12 + + + maia + DataInput_13 + + + taskMetaData + DataInput_14 + + + DataOutput_13 + maia + + + DataOutput_14 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("D".equals(taskMetaData.getResponse())); + + + + SequenceFlow_31 + SequenceFlow_32 + System.out.println("..........................VALIDAR CUSTODIO......................."); +FlowUtil.executeClass("com.fp.armas.task.ValidarCustodios", maia); +taskMetaData.getAditionalData().put("datosmail", maia.get("datosmail")); +taskMetaData.setResponse((maia.get("BPMStatus")!=null)?""+maia.get("BPMStatus"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_22 + + + + SequenceFlow_7 + SequenceFlow_22 + //FlowUtil.endFlow(kcontext); + + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_32 + SequenceFlow_33 + SequenceFlow_34 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_23 + + + + SequenceFlow_15 + SequenceFlow_16 + FlowUtil.executeClass("com.fp.armas.task.TipoArchivoControl", maia); +taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.getAditionalData().put("datosmail", maia.get("datosmail")); +taskMetaData.setResponse((maia.get("tipoarchivo")!=null)?""+maia.get("tipoarchivo"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + _1-_15 + + + + SequenceFlow_9 + SequenceFlow_14 + SequenceFlow_15 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_16 + SequenceFlow_17 + SequenceFlow_26 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_33 + SequenceFlow_7 + System.out.println("................NOTIFICACION ENVIA MAIL ADJUNTO........."); +//enviar mail de notificacion + + + + + SequenceFlow_35 + SequenceFlow_34 + SequenceFlow_36 + + + + SequenceFlow_36 + SequenceFlow_3 + System.out.println("................NOTIFICACION PRESENTARSE AL CENTRO DE CONTROL........."); +//enviar mail de notificacion +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 4 ,5); + + + + SequenceFlow_3 + _16-_12 + //FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + _1-_15 + SequenceFlow_8 + System.out.println("..........................EMISION DOCUMENTO HABILITANTE V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + SequenceFlow_14 + SequenceFlow_23 + System.out.println("............................................................................................ NO:"); +System.out.println(" Anula "+taskMetaData.getAditionalData()); +if(taskMetaData.getAditionalData()!=null && taskMetaData.getAditionalData().get("datosmail")!=null){ + Map<String,Object>datosmail = (Map<String,Object>)taskMetaData.getAditionalData().get("datosmail"); + maia.put("observaciones","Tramite Anulado en Revisar Tramite"+datosmail.get("observaciones")); +}else{ +maia.put("observaciones","Tramite Anulado en Revisar Tramite"); +} +FlowUtil.executeClass("com.fp.armas.task.TramiteAnulado", maia); +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + SequenceFlow_13 + + + + SequenceFlow_1 + SequenceFlow_13 + System.out.println("ingresa a enviar el mail"); +//enviar mail de rechazo +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 8 ,9); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",30, 1,120, "Autorizar Tramite Coordinador", 31, "OK_NO"); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + System.out.println("............................................................................................ 1:"); +taskMetaData.updateData(maia); +System.out.println("............................................................................................ 2:"); +actualTask=new java.util.ArrayList(); +System.out.println("............................................................................................ 3:"); +kcontext.setVariable("actualTask",actualTask); +System.out.println("............................................................................................ 4:"); +actualTask.add(taskMetaData); +System.out.println("............................................................................................ 5:"); +tasksMetaData.put("Revisar Tramite",actualTask); +System.out.println("............................................................................................ 6:"); + + + SequenceFlow_5 + SequenceFlow_6 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Revisar Tramite + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + System.out.println("..........................REVISAR TRAMITE EDH V2......................."); +taskMetaData=FlowUtil.createTaskInfo("30",33, 1,120, "Revisar Tramite Supervisor", 30, "OK_NO"); +maia.put("grupo","SUPERV_REG_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Autorizar Tramite",actualTask); + + + SequenceFlow_8 + SequenceFlow_9 + + + + + + + + + DataInput_200 + DataInput_201 + DataInput_202 + DataInput_203 + + + DataOutput_1 + DataOutput_2 + + + + maia + DataInput_200 + + + DataInput_201 + + Autorizar Tramite + DataInput_26 + + + + DataInput_202 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_203 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comacov2/RecepcionArmasV2.bpmn b/base/bpm/bpmlib/target/classes/flows/comacov2/RecepcionArmasV2.bpmn new file mode 100644 index 0000000..80ee14f --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comacov2/RecepcionArmasV2.bpmn @@ -0,0 +1,371 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_6 + + + + SequenceFlow_6 + SequenceFlow_8 + System.out.println("**************INICIA FLUJO RECEPCIÓN V2***************"); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_5 + SequenceFlow_9 + System.out.println("ingresa a Actualizar Inventario"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarInventario", maia); +FlowUtil.executeClass("com.fp.armas.task.AplicarSancion", maia); +taskMetaData.setResponse((maia.get("BPMStatus")!=null)?""+maia.get("BPMStatus"):null); +kcontext.setVariable("taskMetaData",taskMetaData); +System.out.println("-- Actualizar Inventario"); + + + + + taskMetaData=FlowUtil.createTaskInfo("30",94, 1,120, "Legalizar Acta", 29, "OK_NO"); +FlowUtil.executeClass("com.fp.armas.task.ActualizarRutaArchivo", maia); +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupoDecRecep", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Legalizar Acta",actualTask); + + + SequenceFlow_8 + SequenceFlow_5 + + + + + + + + + + + + + + _DataInput_30 + _DataInput_31 + _DataInput_32 + _DataInput_33 + _DataInput_34 + _DataInput_35 + _DataInput_36 + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + + + + _DataInput_30 + + Legalizar Acta + _DataInput_30 + + + + _DataInput_31 + + + _DataInput_32 + + + _DataInput_33 + + #{taskMetaData.groupId} + _DataInput_33 + + + + _DataInput_34 + + + _DataInput_35 + + + _DataInput_36 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + SequenceFlow_9 + SequenceFlow_10 + SequenceFlow_14 + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + SequenceFlow_2 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_2 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",60, 1,120, "Definir Sancion", 44, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","COORD_MILITAR_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Definir Sancion",actualTask); + + + SequenceFlow_14 + SequenceFlow_15 + + + + + + + + + + + + + + _DataInput_58 + _DataInput_59 + _DataInput_60 + _DataInput_61 + _DataInput_62 + _DataInput_63 + _DataInput_64 + DataInput_6 + DataInput_7 + + + DataOutput_6 + DataOutput_7 + + + + _DataInput_58 + + Definir Sancion + _DataInput_58 + + + + _DataInput_59 + + + _DataInput_60 + + + _DataInput_61 + + #{taskMetaData.groupId} + _DataInput_61 + + + + _DataInput_62 + + + _DataInput_63 + + + _DataInput_64 + + + maia + DataInput_6 + + + taskMetaData + DataInput_7 + + + DataOutput_6 + maia + + + DataOutput_7 + taskMetaData + + + + #{taskMetaData.userId} + + + + + return ("A".equals(taskMetaData.getResponse())); + + + + SequenceFlow_15 + SequenceFlow_13 + System.out.println("sale del flujo"); +FlowUtil.endFlow(kcontext); + + + + SequenceFlow_13 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comacov2/RecepcionSolicitudRequisitosV2.bpmn b/base/bpm/bpmlib/target/classes/flows/comacov2/RecepcionSolicitudRequisitosV2.bpmn new file mode 100644 index 0000000..25df9d5 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comacov2/RecepcionSolicitudRequisitosV2.bpmn @@ -0,0 +1,361 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + SequenceFlow_18 + + + + SequenceFlow_25 + SequenceFlow_18 + FlowUtil.endFlow(kcontext); + + + + _1-_15 + SequenceFlow_2 + System.out.println("..........................FLUJO SOLICITUD V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + SequenceFlow_23 + SequenceFlow_10 + System.out.println("***Ingresa a la tarea generar valor a cancelar***"); +FlowUtil.executeClass("com.fp.armas.task.GenerarValorACancelar", maia); +//taskMetaData.getAditionalData().get("datosmail"); +//taskMetaData = new com.fp.simple.dto.TaskInfo(); +taskMetaData.setResponse((maia.get("BPMStatus")!=null)?""+maia.get("BPMStatus"):null); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + SequenceFlow_19 + SequenceFlow_3 + System.out.println("Ingresa a tarea de enviar el mail de aceptacion de requisitos"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 10 , 11); + + + + + + + SequenceFlow_24 + SequenceFlow_25 + + + + + + + DataInput_40 + DataInput_41 + + + DataOutput_3 + DataOutput_5 + + + + maia + DataInput_40 + + + taskMetaData + DataInput_41 + + + DataOutput_3 + maia + + + DataOutput_5 + taskMetaData + + + + + + SequenceFlow_3 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",25, 1,120, "Revisar solicitud y documentos requeridos", 1, "OK_NO"); +//para asignar a un grupo especifico +maia.put("grupo","ANALISTA_DOC_"); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +kcontext.setVariable("taskMetaData",taskMetaData); +actualTask.add(taskMetaData); +tasksMetaData.put("Revisar solicitud y documentos requeridos",actualTask); + + + SequenceFlow_2 + SequenceFlow_1 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Revisar solicitud y documentos requeridos + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_1 + SequenceFlow_7 + SequenceFlow_23 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_10 + SequenceFlow_19 + SequenceFlow_24 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("D".equals(taskMetaData.getResponse())); + + + SequenceFlow_5 + + + + SequenceFlow_7 + SequenceFlow_4 + //enviar mail al usuario indicando razones del rechazo +FlowUtil.mail("com.fp.armas.mail.PersonaDireccion", maia, taskMetaData, 52 , 53); + + + + SequenceFlow_4 + SequenceFlow_5 + FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/comacov2/TraspasoDominioV2.bpmn b/base/bpm/bpmlib/target/classes/flows/comacov2/TraspasoDominioV2.bpmn new file mode 100644 index 0000000..07aa941 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/comacov2/TraspasoDominioV2.bpmn @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + + + + _1-_15 + SequenceFlow_1 + System.out.println("..........................TRASPASO DOMINIO V2......................."); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",217, 1,120, "Validar transaccion de venta", 68, "OK_NO"); +//para asignar a un usuario especifico +maia.put("grupo","COORD_MILITAR_"); +System.out.println(maia.get("grupo")); +FlowUtil.executeClass("com.fp.armas.task.ValidacionGrupo", maia); +taskMetaData.setGroupId(""+maia.get("grupo")); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Validar armas venta",actualTask); + + + SequenceFlow_1 + SequenceFlow_5 + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + + + + _DataInput_16 + + Validar armas de venta + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + + #{taskMetaData.userId} + + + + + SequenceFlow_7 + SequenceFlow_2 + SequenceFlow_4 + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + SequenceFlow_2 + _16-_12 + FlowUtil.executeClass("com.fp.armas.task.traspasodominio.TraspasoDominioAnula", maia); + +System.out.println("Ingresa a tarea de enviar el mail"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.PersonaDireccionVentaTemp", maia, taskMetaData, 69 , 70); + +FlowUtil.endFlow(kcontext); + + + + _16-_12 + + + + SequenceFlow_6 + + + + SequenceFlow_4 + SequenceFlow_6 + FlowUtil.executeClass("com.fp.armas.task.traspasodominio.TraspasoDominio", maia); + +System.out.println("Ingresa a tarea de enviar el mail--"); +//enviar mail al usuario dueño de la solicitud +FlowUtil.mail("com.fp.armas.mail.PersonaDireccionVentaTemp", maia, taskMetaData, 69 , 70); + +FlowUtil.endFlow(kcontext); + + + + + SequenceFlow_5 + SequenceFlow_7 + System.out.println("*************"); +System.out.println(taskMetaData.getResponse()); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/final.bpmn b/base/bpm/bpmlib/target/classes/flows/final.bpmn new file mode 100644 index 0000000..2958d60 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/final.bpmn @@ -0,0 +1,276 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + SequenceFlow_4 + _16-_12 + FlowUtil.endFlow(kcontext); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("1",7002, 1,120, "Llamar Transaccion", 1, "OK_NO"); + +//FlowUtil.executeClass("paquete.clase", maia); // la clase puede hacer lo que necesite +//taskMetaData.setUserId((maia.get("userId")!=null)?""+maia.get("userId"):null); +//taskMetaData.setGroupId((maia.get("groupId")!=null)?""+maia.get("groupId"):null); +//para asignar a un grupo especifico +//taskMetaData.setGroupId("GERENCIA"); +taskMetaData.setUserId("1234"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Llamar Transaccion",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + + + + maia + DataInput_11 + + + DataInput_26 + + Llamar Transaccion + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("1",7002, 1,120, "Ejecutar transaccion", 1, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setUserId("1234"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ejecutar transaccion",actualTask); + + + SequenceFlow_3 + SequenceFlow_4 + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + + + + _DataInput_16 + + Ejecutar transaccion + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + _16-_12 + + + + _1-_15 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/finalwpa.bpmn b/base/bpm/bpmlib/target/classes/flows/finalwpa.bpmn new file mode 100644 index 0000000..61b4c9e --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/finalwpa.bpmn @@ -0,0 +1,296 @@ + + + + + + + + + + + + + + + + + + + + + + _1-_15 + SequenceFlow_2 + System.out.println("SSSSSSSSSSSSs "+taskMetaData); +maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("tasksMetaData",tasksMetaData); +kcontext.setVariable("actualTask",actualTask); + + + SequenceFlow_4 + _16-_12 + if(taskMetaData.getResponse()==null){ + taskMetaData.setResponse("A"); +} +taskMetaData.updateData(maia); +kcontext.setVariable("maia",maia); +actualTask.add(taskMetaData); + + + + + + + taskMetaData=FlowUtil.createTaskInfo("1",7002, 1,120, "Llamar Transaccion", 1, "OK_NO"); + +//FlowUtil.executeClass("paquete.clase", maia); // la clase puede hacer lo que necesite +//taskMetaData.setUserId((maia.get("userId")!=null)?""+maia.get("userId"):null); +//taskMetaData.setGroupId((maia.get("groupId")!=null)?""+maia.get("groupId"):null); +//para asignar a un grupo especifico +//taskMetaData.setGroupId("GERENCIA"); +taskMetaData.setUserId("1234"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Llamar Transaccion",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + + DataInput_11 + DataInput_26 + DataInput_29 + DataInput_83 + + + DataOutput_4 + DataOutput_8 + DataOutput_1 + + + + maia + DataInput_11 + + + DataInput_26 + + Llamar Transaccion + DataInput_26 + + + + DataInput_29 + + #{taskMetaData.groupId} + DataInput_29 + + + + taskMetaData + DataInput_83 + + + DataOutput_4 + maia + + + DataOutput_8 + taskMetaData + + + DataOutput_1 + actualTask + + + + #{taskMetaData.userId} + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("1",7002, 1,120, "Ejecutar transaccion", 1, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setUserId("1234"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("Ejecutar transaccion",actualTask); + + + SequenceFlow_3 + SequenceFlow_4 + + + + + + + + + + + + + + + _DataInput_16 + _DataInput_17 + _DataInput_18 + _DataInput_19 + _DataInput_20 + _DataInput_21 + _DataInput_22 + DataInput_5 + DataInput_84 + + + DataOutput_6 + DataOutput_9 + DataOutput_2 + + + + _DataInput_16 + + Ejecutar transaccion + _DataInput_16 + + + + _DataInput_17 + + + _DataInput_18 + + + _DataInput_19 + + #{taskMetaData.groupId} + _DataInput_19 + + + + _DataInput_20 + + + _DataInput_21 + + + _DataInput_22 + + + maia + DataInput_5 + + + taskMetaData + DataInput_84 + + + DataOutput_6 + maia + + + DataOutput_9 + taskMetaData + + + DataOutput_2 + actualTask + + + + #{taskMetaData.userId} + + + + + + _16-_12 + + + + _1-_15 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/nuevoProceso.bpmn2 b/base/bpm/bpmlib/target/classes/flows/nuevoProceso.bpmn2 new file mode 100644 index 0000000..bd450f8 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/nuevoProceso.bpmn2 @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("1",7000, 1,5,"RULE",Kind.OK); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Llamar Transaccion",actualTask); + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + DataOutput_3 + actualTask + + + + + SequenceFlow_3 + SequenceFlow_4 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_4 + + + + SequenceFlow_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/process.bpmn2 b/base/bpm/bpmlib/target/classes/flows/process.bpmn2 new file mode 100644 index 0000000..c645655 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/process.bpmn2 @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +tasksMetaData=new java.util.HashMap(); +kcontext.setVariable("actualTask",actualTask); +kcontext.setVariable("tasksMetaData",tasksMetaData); + + + + + + taskMetaData=FlowUtil.createTaskInfo("1",7001, 1,5,"RULE",Kind.OK); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Llamar Transaccion",actualTask); + + + SequenceFlow_2 + SequenceFlow_5 + + + + + + + + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + DataInput_1 + + + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + DataOutput_3 + actualTask + + + + SequenceFlow_6 + + + + + SequenceFlow_5 + SequenceFlow_6 + FlowUtil.endFlow(kcontext); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/prueba.bpmn b/base/bpm/bpmlib/target/classes/flows/prueba.bpmn new file mode 100644 index 0000000..dec2fc8 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/prueba.bpmn @@ -0,0 +1,39 @@ + + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + System.out.println("HOLA MUNDo"); + + + SequenceFlow_2 + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/pviaticos.bpmn b/base/bpm/bpmlib/target/classes/flows/pviaticos.bpmn new file mode 100644 index 0000000..2d29f18 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/pviaticos.bpmn @@ -0,0 +1,727 @@ + + + + + + + + + + + + + + + + + + + SequenceFlow_2 + SequenceFlow_3 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + SequenceFlow_9 + SequenceFlow_13 + SequenceFlow_71 + + + + SequenceFlow_2 + + + + + SequenceFlow_13 + SequenceFlow_7 + SequenceFlow_67 + SequenceFlow_87 + + + + + SequenceFlow_67 + SequenceFlow_5 + + + SequenceFlow_87 + SequenceFlow_88 + + + + SequenceFlow_88 + SequenceFlow_4 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_4 + + + + SequenceFlow_1 + SequenceFlow_7 + SequenceFlow_102 + + + + SequenceFlow_62 + SequenceFlow_65 + SequenceFlow_66 + + + + SequenceFlow_28 + SequenceFlow_29 + SequenceFlow_77 + + + + + SequenceFlow_66 + SequenceFlow_28 + + + + SequenceFlow_79 + SequenceFlow_80 + SequenceFlow_81 + + + + SequenceFlow_77 + SequenceFlow_80 + + + + SequenceFlow_81 + SequenceFlow_12 + + + + SequenceFlow_29 + SequenceFlow_31 + + + + SequenceFlow_74 + SequenceFlow_75 + SequenceFlow_101 + SequenceFlow_76 + + + + SequenceFlow_31 + SequenceFlow_32 + SequenceFlow_33 + SequenceFlow_100 + + + + + SequenceFlow_32 + SequenceFlow_74 + + + + SequenceFlow_33 + SequenceFlow_75 + + + + SequenceFlow_76 + SequenceFlow_37 + + + + SequenceFlow_37 + + + + SequenceFlow_51 + SequenceFlow_79 + + + + SequenceFlow_38 + SequenceFlow_48 + + + + SequenceFlow_16 + SequenceFlow_38 + SequenceFlow_78 + + + + + SequenceFlow_12 + SequenceFlow_16 + SequenceFlow_45 + + + + + SequenceFlow_45 + SequenceFlow_50 + SequenceFlow_51 + + + + SequenceFlow_48 + SequenceFlow_50 + SequenceFlow_57 + + + + + SequenceFlow_58 + SequenceFlow_82 + + + + SequenceFlow_59 + SequenceFlow_83 + + + + SequenceFlow_78 + SequenceFlow_57 + SequenceFlow_58 + SequenceFlow_59 + + + + + SequenceFlow_82 + SequenceFlow_83 + SequenceFlow_84 + + + + SequenceFlow_84 + SequenceFlow_64 + + + + SequenceFlow_64 + + + + SequenceFlow_100 + SequenceFlow_101 + + + + + + SequenceFlow_102 + SequenceFlow_96 + SequenceFlow_97 + SequenceFlow_98 + + + + + SequenceFlow_98 + SequenceFlow_93 + + + + SequenceFlow_97 + SequenceFlow_99 + + + + SequenceFlow_24 + SequenceFlow_65 + + + + SequenceFlow_22 + SequenceFlow_62 + + + + SequenceFlow_93 + SequenceFlow_99 + SequenceFlow_22 + SequenceFlow_24 + + + + + SequenceFlow_72 + SequenceFlow_1 + + + + SequenceFlow_71 + SequenceFlow_72 + SequenceFlow_96 + + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("1",7001, 1,5,"com.fp.viaticos.task.AsiganrJefe","OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Llamar transaccion",actualTask); + + + SequenceFlow_3 + SequenceFlow_9 + + + + + SequenceFlow_5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/subproceso.bpmn b/base/bpm/bpmlib/target/classes/flows/subproceso.bpmn new file mode 100644 index 0000000..9fbbd89 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/subproceso.bpmn @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1 + + + + SequenceFlow_3 + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "aprobar subproceso", 1, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setUserId("EOCAMPO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + + List<Object> laux = new java.util.ArrayList(); +taskMetaData.updateData(maia); +laux.add(taskMetaData); +actualTask.add(taskMetaData); +kcontext.setVariable("actualTask",actualTask); +tasksMetaData.put("aprobar subproceso",laux); + + + SequenceFlow_2 + SequenceFlow_4 + + + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + DataInput_5 + + + _DataInput_30 + _DataInput_31 + _DataInput_32 + _DataInput_33 + _DataInput_34 + _DataInput_35 + _DataInput_36 + + + DataOutput_1 + DataOutput_2 + DataOutput_5 + + + + + _DataInput_30 + + aprobar subproceso + _DataInput_30 + + + + _DataInput_31 + + + _DataInput_32 + + + _DataInput_33 + + + _DataInput_34 + + + _DataInput_35 + + + _DataInput_36 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + actualTask + DataInput_5 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + DataOutput_5 + actualTask + + + + #{taskMetaData.userId} + + + + + + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "aprobar subproceso dos", 1, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setUserId("EOCAMPO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + List<Object> laux = new java.util.ArrayList(); +taskMetaData.updateData(maia); +laux.add(taskMetaData); +actualTask.add(taskMetaData); +kcontext.setVariable("actualTask",actualTask); +tasksMetaData.put("aprobar subproceso dos",laux); + + + SequenceFlow_4 + SequenceFlow_3 + + + + + + + + + + + + + + + + DataInput_3 + DataInput_4 + DataInput_6 + + + _DataInput_58 + _DataInput_59 + _DataInput_60 + _DataInput_61 + _DataInput_62 + _DataInput_63 + _DataInput_64 + + + DataOutput_3 + DataOutput_4 + DataOutput_6 + + + + + _DataInput_58 + + aprobar subproceso dos + _DataInput_58 + + + + _DataInput_59 + + + _DataInput_60 + + + _DataInput_61 + + + _DataInput_62 + + + _DataInput_63 + + + _DataInput_64 + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + actualTask + DataInput_6 + + + DataOutput_3 + maia + + + DataOutput_4 + taskMetaData + + + DataOutput_6 + actualTask + + + + #{taskMetaData.userId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/taskasign.bpmn b/base/bpm/bpmlib/target/classes/flows/taskasign.bpmn new file mode 100644 index 0000000..5b241a4 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/taskasign.bpmn @@ -0,0 +1,298 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + _1-_11 + + + _13-_2 + + + + _5-_3 + _3-_8 + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + _3_SkippableInput + _3_TaskNameInput + _3_GroupIdInput + + + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_SkippableInput + + false + _3_SkippableInput + + + + _3_TaskNameInput + + #{maia.request.subject} + _3_TaskNameInput + + + + _3_GroupIdInput + + #{taskMetaData.groupId} + _3_GroupIdInput + + + + _3_taskMetaDataOutput + taskMetaData + + + + #{taskMetaData.userId} + + + + + _10-_4 + _4-_6 + FlowUtil.evalRule(taskMetaData.getRuleCode(), maia); +FlowUtil.executeClass(taskMetaData.getClassCode(), maia); +try{ +taskMetaData.setUserId((maia.get("userId")!=null)?""+maia.get("userId"):null); +}catch(Exception e){ +} +try{ +taskMetaData.setGroupId((maia.get("groupId")!=null)?""+maia.get("groupId"):null); +}catch(Exception e){ +} +taskMetaData.setAction((maia.get("action")!=null)?""+maia.get("action"):null); +try{ +if(maia.get("internalCode")!=null){ +taskMetaData.setInternalCode(maia.get("internalCode")); +} +}catch(Exception e){ +} +maia.remove("userId"); +maia.remove("ActorId"); +maia.remove("groupId"); +maia.remove("GroupId"); +maia.remove("action"); +maia.remove("internalCode"); + + + + _6-_5 + _5-_3 + + + _4-_6 + _6-_5 + _6-_7 + + + _6-_7 + _8-_7 + _7-_13 + + + _3-_8 + _8-_7 + _8-_9 + + + _8-_9 + _9-_12 + + + + + + + _11-_10 + _12-_10 + _10-_4 + + + _1-_11 + _11-_10 + mainTask=taskMetaData; +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + _9-_12 + _12-_10 + actualTask.add(taskMetaData); +taskMetaData=mainTask; + + + _7-_13 + _13-_2 + if(taskMetaData.getResponse()==null){ + taskMetaData.setResponse("A"); +} +taskMetaData.updateData(maia); +kcontext.setVariable("maia",maia); +actualTask.add(taskMetaData); + + + + + + return "A".equals(taskMetaData.getAction()); + + + + return !("A".equals(taskMetaData.getAction())); + + + return taskMetaData.getResponse().compareTo("R")!=0; + + + + return taskMetaData.getResponse().compareTo("R")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/test.bpmn b/base/bpm/bpmlib/target/classes/flows/test.bpmn new file mode 100644 index 0000000..21c5a82 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/test.bpmn @@ -0,0 +1,467 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "grupo", 1, "OK_NO"); +taskMetaData.setGroupId("GERENCIA"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("grupo",actualTask); + + + SequenceFlow_5 + SequenceFlow_3 + + + + + + + + + + + + + + DataInput_3 + DataInput_4 + + + _DataInput_44 + _DataInput_45 + _DataInput_46 + _DataInput_47 + _DataInput_48 + _DataInput_49 + _DataInput_50 + + + DataOutput_3 + DataOutput_4 + + + + + _DataInput_44 + + grupo + _DataInput_44 + + + + _DataInput_45 + + + _DataInput_46 + + + _DataInput_47 + + #{taskMetaData.groupId} + _DataInput_47 + + + + _DataInput_48 + + + _DataInput_49 + + + _DataInput_50 + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_3 + maia + + + DataOutput_4 + taskMetaData + + + + + + + + tasksMetaData.put("finalizar",actualTask); +System.out.println("Resultado subproceso "+actualTask); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("subproceso",actualTask); + + + + + + SequenceFlow_3 + SequenceFlow_6 + + + + + + + + + + DataInput_5 + DataInput_6 + DataInput_9 + + + DataOutput_5 + DataOutput_7 + DataOutput_8 + DataOutput_6 + + + + maia + DataInput_5 + + + tasksMetaData + DataInput_6 + + + actualTask + DataInput_9 + + + DataOutput_5 + maia + + + DataOutput_7 + tasksMetaData + + + DataOutput_8 + taskMetaData + + + DataOutput_6 + actualTask + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "prueba", 1, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setUserId("EOCAMPO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("prueba",actualTask); + + + SequenceFlow_2 + SequenceFlow_5 + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + + + _DataInput_30 + _DataInput_31 + _DataInput_32 + _DataInput_33 + _DataInput_34 + _DataInput_35 + _DataInput_36 + + + DataOutput_1 + DataOutput_2 + + + + + _DataInput_30 + + prueba + _DataInput_30 + + + + _DataInput_31 + + + _DataInput_32 + + + _DataInput_33 + + + _DataInput_34 + + + _DataInput_35 + + + _DataInput_36 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "aprobacion final", 1, "OK_NO"); +taskMetaData.setUserId("EOCAMPO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("aprobacion final",actualTask); + + + SequenceFlow_6 + SequenceFlow_7 + + + + + + + + + + + + DataInput_7 + DataInput_8 + DataInput_15 + + + _DataInput_170 + _DataInput_174 + _DataInput_175 + _DataInput_176 + + + DataOutput_9 + DataOutput_10 + + + + + _DataInput_170 + + aprobacion final + _DataInput_170 + + + + _DataInput_174 + + + _DataInput_175 + + + _DataInput_176 + + + maia + DataInput_7 + + + DataInput_8 + + + taskMetaData + DataInput_15 + + + DataOutput_9 + maia + + + DataOutput_10 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_7 + SequenceFlow_4 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_4 + + + + SequenceFlow_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/testuno.bpmn b/base/bpm/bpmlib/target/classes/flows/testuno.bpmn new file mode 100644 index 0000000..61e8b12 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/testuno.bpmn @@ -0,0 +1,308 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "pruebauno", 1, "OK_NO"); +//para asignar a un usuario especifico +taskMetaData.setUserId("EOCAMPO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("pruebauno",actualTask); + + + SequenceFlow_2 + SequenceFlow_5 + + + + + + + + + + + + + + DataInput_1 + DataInput_2 + + + _DataInput_30 + _DataInput_31 + _DataInput_32 + _DataInput_33 + _DataInput_34 + _DataInput_35 + _DataInput_36 + + + DataOutput_1 + DataOutput_2 + + + + + _DataInput_30 + + pruebauno + _DataInput_30 + + + + _DataInput_31 + + + _DataInput_32 + + + _DataInput_33 + + + _DataInput_34 + + + _DataInput_35 + + + _DataInput_36 + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + + #{taskMetaData.userId} + + + + + + SequenceFlow_1 + + + + SequenceFlow_3 + SequenceFlow_4 + FlowUtil.endFlow(kcontext); + + + + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + SequenceFlow_1 + SequenceFlow_2 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + + + + taskMetaData=FlowUtil.createTaskInfo("30",98, 1,120, "grupouno", 1, "OK_NO"); +taskMetaData.setGroupId("GERENCIA"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + taskMetaData.updateData(maia); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); +actualTask.add(taskMetaData); +tasksMetaData.put("grupouno",actualTask); + + + SequenceFlow_5 + SequenceFlow_6 + + + + + + + + + + + + + + DataInput_3 + DataInput_4 + + + _DataInput_44 + _DataInput_45 + _DataInput_46 + _DataInput_47 + _DataInput_48 + _DataInput_49 + _DataInput_50 + + + DataOutput_3 + DataOutput_4 + + + + + _DataInput_44 + + grupouno + _DataInput_44 + + + + _DataInput_45 + + + _DataInput_46 + + + _DataInput_47 + + #{taskMetaData.groupId} + _DataInput_47 + + + + _DataInput_48 + + + _DataInput_49 + + + _DataInput_50 + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_3 + maia + + + DataOutput_4 + taskMetaData + + + + + SequenceFlow_6 + SequenceFlow_3 + System.out.println("prueba script"); + + + + SequenceFlow_4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/testwpa.bpmn b/base/bpm/bpmlib/target/classes/flows/testwpa.bpmn new file mode 100644 index 0000000..0bc495f --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/testwpa.bpmn @@ -0,0 +1,292 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("17",23, 1,10,"WMP",Kind.OK); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Verifica1",actualTask); + + + + + + + + + + _17_maiaInput + _17_taskMetaDataInput + + + _17_actualTaskOutput + _17_maiaOutput + _17_taskMetaDataOutput + + + + maia + _17_maiaInput + + + taskMetaData + _17_taskMetaDataInput + + + _17_actualTaskOutput + actualTask + + + _17_maiaOutput + maia + + + _17_taskMetaDataOutput + taskMetaData + + + + + + + + + + taskMetaData=FlowUtil.createTaskInfo("17",21, 1,10,"WMP",Kind.OK); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Verifica2",actualTask); + + + + + + + + + + _21_maiaInput + _21_taskMetaDataInput + + + _21_actualTaskOutput + _21_maiaOutput + _21_taskMetaDataOutput + + + + maia + _21_maiaInput + + + taskMetaData + _21_taskMetaDataInput + + + _21_actualTaskOutput + actualTask + + + _21_maiaOutput + maia + + + _21_taskMetaDataOutput + taskMetaData + + + + + + System.out.println(">>Inicia Flujo"); +taskMetaData=FlowUtil.createTaskInfo("17",22, 1,10,"WPA",Kind.OK); +kcontext.setVariable("taskMetaData",taskMetaData); + + + tasksMetaData.put("Inicia Flujo",actualTask); +System.out.println(">>Inicia Flujo>>"+taskMetaData.getResponse()); + + + + + + + + + + _5_maiaInput + _5_taskMetaDataInput + + + _5_actualTaskOutput + _5_maiaOutput + _5_taskMetaDataOutput + + + + maia + _5_maiaInput + + + taskMetaData + _5_taskMetaDataInput + + + _5_actualTaskOutput + actualTask + + + _5_maiaOutput + maia + + + _5_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + System.out.println("AAAAA"+maia); +return (((String)maia.get("transaction")).compareTo("23")==0); + + + + System.out.println("BBBBB"+maia); +return (((String)maia.get("transaction")).compareTo("21")==0); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/viaticos.bpmn b/base/bpm/bpmlib/target/classes/flows/viaticos.bpmn new file mode 100644 index 0000000..9ab160e --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/viaticos.bpmn @@ -0,0 +1,1949 @@ + + + + + + + + + + + + + + + + + + + ScriptTask_8-ExclusiveGateway_4 + ScriptTask_9-ExclusiveGateway_4 + ExclusiveGateway_4-CallActivity_4 + + + ExclusiveGateway_3-ScriptTask_4 + ScriptTask_4-ExclusiveGateway_5 + maia.put("cusuariobpm", taskMetaData.getUserId()); +//enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefeyResponsableUnidad", maia, taskMetaData, 105 , 106); + + + ExclusiveGateway_3-ScriptTask_7 + ScriptTask_7-ParallelGateway_1 + maia.put("cusuariobpm", taskMetaData.getUserId()); +//enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefeyResponsableUnidad", maia, taskMetaData, 107 , 108); + + + CallActivity_1-ExclusiveGateway_2 + ExclusiveGateway_2-ScriptTask_3 + ExclusiveGateway_2-ScriptTask_8 + ExclusiveGateway_2-ScriptTask_6 + + + CallActivity_2-ExclusiveGateway_3 + ExclusiveGateway_3-ScriptTask_4 + ExclusiveGateway_3-ScriptTask_7 + ExclusiveGateway_3-ScriptTask_9 + + + ScriptTask_1-ExclusiveGateway_1 + ExclusiveGateway_8-ExclusiveGateway_1 + ExclusiveGateway_1-CallActivity_1 + + + StartEvent_1-ScriptTask_1 + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",21, 1,120,"com.fp.viaticos.task.AsignarJefe", "Autorizar jefe", 10, "OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +//enviar mail al jefe del empleado +FlowUtil.executeClass(taskMetaData.getClassCode(), maia); +String action = maia.get("action")!=null ?""+maia.get("action"):null; +if(action == null || action.equals("A") ){ + FlowUtil.mail("com.fp.viaticos.mail.Jefe", maia, taskMetaData, 101 , 102); +} + + + List old=(List)tasksMetaData.get("Autorizar jefe"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Autorizar jefe",old); + + + ExclusiveGateway_1-CallActivity_1 + CallActivity_1-ExclusiveGateway_2 + + + + + + + + CallActivity_1_maiaInput + CallActivity_1_taskMetaDataInput + + + CallActivity_1_actualTaskOutput + CallActivity_1_maiaOutput + CallActivity_1_taskMetaDataOutput + + + + maia + CallActivity_1_maiaInput + + + taskMetaData + CallActivity_1_taskMetaDataInput + + + CallActivity_1_actualTaskOutput + actualTask + + + CallActivity_1_maiaOutput + maia + + + CallActivity_1_taskMetaDataOutput + taskMetaData + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",22, 1,120,"com.fp.viaticos.task.AsignarSupervisior", "Autorizar supervisor", 10, "OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +//enviar mail al responsable de la unidad a la que pertenece del empleado + +FlowUtil.mail("com.fp.viaticos.mail.ResponsableUnidad", maia, taskMetaData, 101 , 102); + + + List old=(List)tasksMetaData.get("Autorizar supervisor"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Autorizar supervisor",old); + + + ScriptTask_6-CallActivity_2 + CallActivity_2-ExclusiveGateway_3 + + + + + + + + CallActivity_2_maiaInput + CallActivity_2_taskMetaDataInput + + + CallActivity_2_actualTaskOutput + CallActivity_2_maiaOutput + CallActivity_2_taskMetaDataOutput + + + + maia + CallActivity_2_maiaInput + + + taskMetaData + CallActivity_2_taskMetaDataInput + + + CallActivity_2_actualTaskOutput + actualTask + + + CallActivity_2_maiaOutput + maia + + + CallActivity_2_taskMetaDataOutput + taskMetaData + + + + ExclusiveGateway_5-ScriptTask_5 + ScriptTask_5-EndEvent_2 + FlowUtil.endFlow(kcontext); + + + ScriptTask_5-EndEvent_2 + + + + ScriptTask_4-ExclusiveGateway_5 + ScriptTask_3-ExclusiveGateway_5 + ExclusiveGateway_5-ScriptTask_5 + + + ExclusiveGateway_2-ScriptTask_3 + ScriptTask_3-ExclusiveGateway_5 + //enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefe", maia, taskMetaData, 105 , 106); + + + ExclusiveGateway_2-ScriptTask_8 + ScriptTask_8-ExclusiveGateway_4 + //enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefe", maia, taskMetaData, 103 , 104); + + + ScriptTask_7-ParallelGateway_1 + ParallelGateway_1-CallActivity_5 + ParallelGateway_1-CallActivity_3 + ParallelGateway_1-CallActivity_14 + + + ExclusiveGateway_3-ScriptTask_9 + ScriptTask_9-ExclusiveGateway_4 + maia.put("cusuariobpm", taskMetaData.getUserId()); +//enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefeyResponsableUnidad", maia, taskMetaData, 103 , 104); + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",30, 1,120,"com.fp.viaticos.task.AsignarTalentoHumano", "Confirmar talento humano", 12,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.TalentoHumano", maia, taskMetaData, 113 , 114); + + + List old=(List)tasksMetaData.get("Confimar talento humano"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confimar talento humano",old); + + + ParallelGateway_1-CallActivity_5 + CallActivity_5-ParallelGateway_2 + + + + + + + + CallActivity_5_maiaInput + CallActivity_5_taskMetaDataInput + + + CallActivity_5_actualTaskOutput + CallActivity_5_maiaOutput + CallActivity_5_taskMetaDataOutput + + + + maia + CallActivity_5_maiaInput + + + taskMetaData + CallActivity_5_taskMetaDataInput + + + CallActivity_5_actualTaskOutput + actualTask + + + CallActivity_5_maiaOutput + maia + + + CallActivity_5_taskMetaDataOutput + taskMetaData + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",29, 1,120,"com.fp.viaticos.task.AsignarTesoreria", "Confirmar tesorería", 12,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 113 , 114); + + + List old=(List)tasksMetaData.get("Confirmar tesorería"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar tesorería",old); + + + ParallelGateway_1-CallActivity_3 + CallActivity_3-ParallelGateway_2 + + + + + + + + CallActivity_3_maiaInput + CallActivity_3_taskMetaDataInput + + + CallActivity_3_actualTaskOutput + CallActivity_3_maiaOutput + CallActivity_3_taskMetaDataOutput + + + + maia + CallActivity_3_maiaInput + + + taskMetaData + CallActivity_3_taskMetaDataInput + + + CallActivity_3_actualTaskOutput + actualTask + + + CallActivity_3_maiaOutput + maia + + + CallActivity_3_taskMetaDataOutput + taskMetaData + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",31, 1,120,"com.fp.viaticos.task.AsignarEmpleado", "Confirmar comision SP", 13,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Empleado", maia, taskMetaData, 115 , 116); + + + List old=(List)tasksMetaData.get("Confirmar comision SP"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar comision SP",old); + + + ParallelGateway_2-CallActivity_6 + CallActivity_6-ExclusiveGateway_7 + + + + + + + + CallActivity_6_maiaInput + CallActivity_6_taskMetaDataInput + + + CallActivity_6_actualTaskOutput + CallActivity_6_maiaOutput + CallActivity_6_taskMetaDataOutput + + + + maia + CallActivity_6_maiaInput + + + taskMetaData + CallActivity_6_taskMetaDataInput + + + CallActivity_6_actualTaskOutput + actualTask + + + CallActivity_6_maiaOutput + maia + + + CallActivity_6_taskMetaDataOutput + taskMetaData + + + + CallActivity_14-ParallelGateway_2 + CallActivity_3-ParallelGateway_2 + CallActivity_5-ParallelGateway_2 + ParallelGateway_2-CallActivity_6 + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",33, 1,120,"com.fp.viaticos.task.AsignarContabilidad", "Reajustar contabilidad", 15,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Contabilidad", maia, taskMetaData, 119 , 120); + + + List old=(List)tasksMetaData.get("Reajustar contabilidad"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Reajustar contabilidad",old); + + + ParallelGateway_3-CallActivity_8 + CallActivity_8-ParallelGateway_4 + + + + + + + + CallActivity_8_maiaInput + CallActivity_8_taskMetaDataInput + + + CallActivity_8_actualTaskOutput + CallActivity_8_maiaOutput + CallActivity_8_taskMetaDataOutput + + + + maia + CallActivity_8_maiaInput + + + taskMetaData + CallActivity_8_taskMetaDataInput + + + CallActivity_8_actualTaskOutput + actualTask + + + CallActivity_8_maiaOutput + maia + + + CallActivity_8_taskMetaDataOutput + taskMetaData + + + + CallActivity_6-ExclusiveGateway_7 + ExclusiveGateway_7-CallActivity_7 + ExclusiveGateway_7-CallActivity_10 + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",34, 1,120,"com.fp.viaticos.task.AsignarTalentoHumano", "Reajustar talento humano", 15,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.TalentoHumano", maia, taskMetaData, 119 , 120); + + + List old=(List)tasksMetaData.get("Reajustar talento humano"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Reajustar talento humano",old); + + + ParallelGateway_3-CallActivity_9 + CallActivity_9-ParallelGateway_4 + + + + + + + + CallActivity_9_maiaInput + CallActivity_9_taskMetaDataInput + + + CallActivity_9_actualTaskOutput + CallActivity_9_maiaOutput + CallActivity_9_taskMetaDataOutput + + + + maia + CallActivity_9_maiaInput + + + taskMetaData + CallActivity_9_taskMetaDataInput + + + CallActivity_9_actualTaskOutput + actualTask + + + CallActivity_9_maiaOutput + maia + + + CallActivity_9_taskMetaDataOutput + taskMetaData + + + + CallActivity_7-ParallelGateway_3 + ParallelGateway_3-CallActivity_8 + ParallelGateway_3-CallActivity_9 + ParallelGateway_3-ScriptTask_12 + SequenceFlow_5 + SequenceFlow_7 + + + CallActivity_8-ParallelGateway_4 + CallActivity_9-ParallelGateway_4 + ScriptTask_12-ParallelGateway_4 + SequenceFlow_6 + SequenceFlow_8 + SequenceFlow_9 + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",50, 1,120,"com.fp.viaticos.task.AsignarTesoreria", "Confirmar movilización", 19,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 133 , 134); + + + List old=(List)tasksMetaData.get("Confirmar movilización"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Notificar movilización",old); + + + ParallelGateway_1-CallActivity_14 + CallActivity_14-ParallelGateway_2 + + + + + + + + CallActivity_14_maiaInput + CallActivity_14_taskMetaDataInput + + + CallActivity_14_actualTaskOutput + CallActivity_14_maiaOutput + CallActivity_14_taskMetaDataOutput + + + + maia + CallActivity_14_maiaInput + + + taskMetaData + CallActivity_14_taskMetaDataInput + + + CallActivity_14_actualTaskOutput + actualTask + + + CallActivity_14_maiaOutput + maia + + + CallActivity_14_taskMetaDataOutput + taskMetaData + + + + ExclusiveGateway_2-ScriptTask_6 + ScriptTask_6-CallActivity_2 + //enviar mail al jefe del empleado +FlowUtil.executeClass(taskMetaData.getClassCode(), maia); +String action = maia.get("action")!=null ?""+maia.get("action"):null; +//System.out.println("Se ingresa al nodo notificar SP :" + action); +if(action == null || action.equals("A") ){ + FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefe", maia, taskMetaData, 107 , 108); +} + + + StartEvent_1-ScriptTask_1 + ScriptTask_1-ExclusiveGateway_1 + maia.put("PID",kcontext.getProcessInstance().getId()); +actualTask=new java.util.ArrayList(); +kcontext.setVariable("actualTask",actualTask); + + + ScriptTask_10-EndEvent_4 + + + + ExclusiveGateway_8-ScriptTask_10 + ScriptTask_10-EndEvent_4 + FlowUtil.endFlow(kcontext); + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",24, 1,30,"com.fp.viaticos.task.AsignarEmpleado", "Modificar empleado", 11, "OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + List old=(List)tasksMetaData.get("Modificar empleado"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Modificar empleado",old); + + + ExclusiveGateway_4-CallActivity_4 + CallActivity_4-ExclusiveGateway_8 + + + + + + + + CallActivity_4_maiaInput + CallActivity_4_taskMetaDataInput + + + CallActivity_4_actualTaskOutput + CallActivity_4_maiaOutput + CallActivity_4_taskMetaDataOutput + + + + maia + CallActivity_4_maiaInput + + + taskMetaData + CallActivity_4_taskMetaDataInput + + + CallActivity_4_actualTaskOutput + actualTask + + + CallActivity_4_maiaOutput + maia + + + CallActivity_4_taskMetaDataOutput + taskMetaData + + + + CallActivity_4-ExclusiveGateway_8 + ExclusiveGateway_8-ExclusiveGateway_1 + ExclusiveGateway_8-ScriptTask_10 + + + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + return ("D".equals(taskMetaData.getResponse())); + + + return ("M".equals(taskMetaData.getResponse())); + + + + return ("M".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + return ("D".equals(taskMetaData.getResponse())); + + + + return ("A".equals(taskMetaData.getResponse())); + + + + return ("A".equals(taskMetaData.getResponse())); + + + + return ("D".equals(taskMetaData.getResponse())); + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30", 23, 1, 120, "com.fp.viaticos.task.AsignarEmpleado", "Generar Informe SP", 16, "OK_NO"); +kcontext.setVariable("taskMetaData", taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Empleado", maia, taskMetaData, 123, 124); + + + List old=(List)tasksMetaData.get("Generar Informe SP"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Generar Informe SP",old); + + + ExclusiveGateway_7-CallActivity_10 + CallActivity_10-ExclusiveGateway_9 + + + + + + + + CallActivity_10_maiaInput + CallActivity_10_taskMetaDataInput + + + CallActivity_10_actualTaskOutput + CallActivity_10_maiaOutput + CallActivity_10_taskMetaDataOutput + + + + maia + CallActivity_10_maiaInput + + + taskMetaData + CallActivity_10_taskMetaDataInput + + + CallActivity_10_actualTaskOutput + actualTask + + + CallActivity_10_maiaOutput + maia + + + CallActivity_10_taskMetaDataOutput + taskMetaData + + + + + CallActivity_10-ExclusiveGateway_9 + CallActivity_13-ExclusiveGateway_9 + ExclusiveGateway_9-CallActivity_11 + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",25, 1,120,"com.fp.viaticos.task.AsignarJefeInforme", "Autorizar informe JI", 17,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +//enviar mail al jefe del empleado + +FlowUtil.executeClass(taskMetaData.getClassCode(), maia); +String action = maia.get("action")!=null ?""+maia.get("action"):null; +if(action == null || action.equals("A") ){ + FlowUtil.mail("com.fp.viaticos.mail.JefeInforme", maia, taskMetaData, 125 , 126); +} + + + List old=(List)tasksMetaData.get("Autorizar informe JI"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Autorizar informe JI",old); + + + ExclusiveGateway_9-CallActivity_11 + CallActivity_11-ExclusiveGateway_10 + + + + + + + + CallActivity_11_maiaInput + CallActivity_11_taskMetaDataInput + + + CallActivity_11_actualTaskOutput + CallActivity_11_maiaOutput + CallActivity_11_taskMetaDataOutput + + + + maia + CallActivity_11_maiaInput + + + taskMetaData + CallActivity_11_taskMetaDataInput + + + CallActivity_11_actualTaskOutput + actualTask + + + CallActivity_11_maiaOutput + maia + + + CallActivity_11_taskMetaDataOutput + taskMetaData + + + + + CallActivity_11-ExclusiveGateway_10 + ExclusiveGateway_10-ScriptTask_13 + ExclusiveGateway_10-ScriptTask_14 + + + return ("A".equals(taskMetaData.getResponse())); + + + return ("M".equals(taskMetaData.getResponse())); + + + ExclusiveGateway_10-ScriptTask_14 + ScriptTask_14-ExclusiveGateway_11 + //enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefeInforme", maia, taskMetaData, 127 , 128); + + + + ExclusiveGateway_10-ScriptTask_13 + ScriptTask_13-CallActivity_12 + //enviar mail al jefe del empleado +FlowUtil.executeClass(taskMetaData.getClassCode(), maia); +String action = maia.get("action")!=null ?""+maia.get("action"):null; +//System.out.println("Se ingresa al nodo notificar SP :" + action); +if(action == null || action.equals("A") ){ + FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefeInforme", maia, taskMetaData, 129, 130); +} + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",39, 1,120,"com.fp.viaticos.task.AsignarSupervisiorInforme", "Autorizar informe RU", 17,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +//enviar mail al responsable de la unidad a la que pertenece del empleado +FlowUtil.mail("com.fp.viaticos.mail.ResponsableUnidadInforme", maia, taskMetaData, 125 , 126); + + + List old=(List)tasksMetaData.get("Autorizar informe RU"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Autorizar informe RU",old); + + + ScriptTask_13-CallActivity_12 + CallActivity_12-ExclusiveGateway_6 + + + + + + + + CallActivity_12_maiaInput + CallActivity_12_taskMetaDataInput + + + CallActivity_12_actualTaskOutput + CallActivity_12_maiaOutput + CallActivity_12_taskMetaDataOutput + + + + maia + CallActivity_12_maiaInput + + + taskMetaData + CallActivity_12_taskMetaDataInput + + + CallActivity_12_actualTaskOutput + actualTask + + + CallActivity_12_maiaOutput + maia + + + CallActivity_12_taskMetaDataOutput + taskMetaData + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",35, 1,30,"com.fp.viaticos.task.AsignarEmpleado", "Modificar informe SP", 20,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); + + + List old=(List)tasksMetaData.get("Modificar informe SP"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Modificar informe SP",old); + + + ExclusiveGateway_11-CallActivity_13 + CallActivity_13-ExclusiveGateway_9 + + + + + + + + CallActivity_13_maiaInput + CallActivity_13_taskMetaDataInput + + + CallActivity_13_actualTaskOutput + CallActivity_13_maiaOutput + CallActivity_13_taskMetaDataOutput + + + + maia + CallActivity_13_maiaInput + + + taskMetaData + CallActivity_13_taskMetaDataInput + + + CallActivity_13_actualTaskOutput + actualTask + + + CallActivity_13_maiaOutput + maia + + + CallActivity_13_taskMetaDataOutput + taskMetaData + + + + + ScriptTask_14-ExclusiveGateway_11 + ScriptTask_16-ExclusiveGateway_11 + ExclusiveGateway_11-CallActivity_13 + + + + CallActivity_12-ExclusiveGateway_6 + ExclusiveGateway_6-ScriptTask_16 + ExclusiveGateway_6-ScriptTask_15 + + + return ("M".equals(taskMetaData.getResponse())); + + + return ("A".equals(taskMetaData.getResponse())); + + + ExclusiveGateway_6-ScriptTask_16 + ScriptTask_16-ExclusiveGateway_11 + maia.put("cusuariobpm", taskMetaData.getUserId()); +//enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefeyResponsableUnidadInforme", maia, taskMetaData, 127 , 128); + + + + ExclusiveGateway_6-ScriptTask_15 + ScriptTask_15-ParallelGateway_5 + maia.put("cusuariobpm", taskMetaData.getUserId()); +//enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefeyResponsableUnidadInforme", maia, taskMetaData, 129 , 130); + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",37, 1,120,"com.fp.viaticos.task.AsignarTalentoHumano","Confirmar informe TH", 18,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.TalentoHumano", maia, taskMetaData, 131 , 132); + + + List old=(List)tasksMetaData.get("Confirmar informe TH"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar informe TH",old); + + + ParallelGateway_5-CallActivity_16 + CallActivity_16-ParallelGateway_6 + + + + + + + + CallActivity_16_maiaInput + CallActivity_16_taskMetaDataInput + + + CallActivity_16_actualTaskOutput + CallActivity_16_maiaOutput + CallActivity_16_taskMetaDataOutput + + + + maia + CallActivity_16_maiaInput + + + taskMetaData + CallActivity_16_taskMetaDataInput + + + CallActivity_16_actualTaskOutput + actualTask + + + CallActivity_16_maiaOutput + maia + + + CallActivity_16_taskMetaDataOutput + taskMetaData + + + + + ScriptTask_15-ParallelGateway_5 + ParallelGateway_5-CallActivity_16 + ParallelGateway_5-CallActivity_15 + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",36, 1,120,"com.fp.viaticos.task.AsignarTesoreria","Confirmar informe tesoreria" ,18,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 131 , 132); + + + List old=(List)tasksMetaData.get("Confirmar informe tesoreria"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar informe tesoreria",old); + + + ParallelGateway_5-CallActivity_15 + CallActivity_15-ParallelGateway_6 + + + + + + + + CallActivity_15_maiaInput + CallActivity_15_taskMetaDataInput + + + CallActivity_15_actualTaskOutput + CallActivity_15_maiaOutput + CallActivity_15_taskMetaDataOutput + + + + maia + CallActivity_15_maiaInput + + + taskMetaData + CallActivity_15_taskMetaDataInput + + + CallActivity_15_actualTaskOutput + actualTask + + + CallActivity_15_maiaOutput + maia + + + CallActivity_15_taskMetaDataOutput + taskMetaData + + + + + CallActivity_16-ParallelGateway_6 + CallActivity_15-ParallelGateway_6 + SequenceFlow_10 + + + ParallelGateway_3-ScriptTask_12 + ScriptTask_12-ParallelGateway_4 + //enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.EmpleadoyJefe", maia, taskMetaData, 121 , 122); + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30", 32, 1, 120, "com.fp.viaticos.task.AsignarJefeComision", "Confirmar jefe inmediato", 14, "OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +//enviar mail al jefe del empleado +FlowUtil.mail("com.fp.viaticos.mail.Jefe", maia, taskMetaData, 117 , 118); + + + List old=(List)tasksMetaData.get("Confirmar jefe inmediato"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar jefe inmediato",old); + + + ExclusiveGateway_7-CallActivity_7 + CallActivity_7-ParallelGateway_3 + + + + + + + + CallActivity_7_maiaInput + CallActivity_7_taskMetaDataInput + + + CallActivity_7_actualTaskOutput + CallActivity_7_maiaOutput + CallActivity_7_taskMetaDataOutput + + + + maia + CallActivity_7_maiaInput + + + taskMetaData + CallActivity_7_taskMetaDataInput + + + CallActivity_7_actualTaskOutput + actualTask + + + CallActivity_7_maiaOutput + maia + + + CallActivity_7_taskMetaDataOutput + taskMetaData + + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",52, 1,120,"com.fp.viaticos.task.AsignarTesoreria", "Reajustar tesorería", 15,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 119 , 120); + + + + + + List old=(List)tasksMetaData.get("Reajustar tesorería"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Reajustar tesorería",old); + + + SequenceFlow_5 + SequenceFlow_6 + + + + + + + + DataInput_1 + DataInput_2 + + + DataOutput_1 + DataOutput_2 + DataOutput_3 + + + + maia + DataInput_1 + + + taskMetaData + DataInput_2 + + + DataOutput_1 + maia + + + DataOutput_2 + taskMetaData + + + DataOutput_3 + actualTask + + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",53, 1,120,"com.fp.viaticos.task.AsignarTesoreria", "Reajustar Movilización", 15,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 119 , 120); + + + + + + List old=(List)tasksMetaData.get("Reajustar Movilización"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Reajustar Movilización",old); + + + SequenceFlow_7 + SequenceFlow_8 + + + + + + + + DataInput_3 + DataInput_4 + + + DataOutput_4 + DataOutput_5 + DataOutput_6 + + + + maia + DataInput_3 + + + taskMetaData + DataInput_4 + + + DataOutput_4 + maia + + + DataOutput_5 + taskMetaData + + + DataOutput_6 + actualTask + + + + + + ParallelGateway_4-ScriptTask_11 + ScriptTask_11-EndEvent_3 + FlowUtil.endFlow(kcontext); + + + + SequenceFlow_9 + ParallelGateway_4-ScriptTask_11 + FlowUtil.mail("com.fp.viaticos.mail.Empleado", maia, taskMetaData, 137, 138); + + + + ScriptTask_11-EndEvent_3 + + + + ParallelGateway_6-ScriptTask_2 + ScriptTask_2-EndEvent_1 + FlowUtil.endFlow(kcontext); + + + + + SequenceFlow_10 + ParallelGateway_6-ScriptTask_2 + FlowUtil.mail("com.fp.viaticos.mail.Empleado", maia, taskMetaData, 135, 136); + + + + ScriptTask_2-EndEvent_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/flows/viaticosmanual.bpmn b/base/bpm/bpmlib/target/classes/flows/viaticosmanual.bpmn new file mode 100644 index 0000000..6ad7c04 --- /dev/null +++ b/base/bpm/bpmlib/target/classes/flows/viaticosmanual.bpmn @@ -0,0 +1,779 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",45, 1,120,"com.fp.viaticos.task.AsignarContabilidad", "Reajustar contabilidad", 15,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Contabilidad", maia, taskMetaData, 119 , 120); + + + List old=(List)tasksMetaData.get("Reajustar contabilidad"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Reajustar contabilidad",old); + + + + + + + + + + CallActivity_7_maiaInput + CallActivity_7_taskMetaDataInput + + + CallActivity_7_actualTaskOutput + CallActivity_7_maiaOutput + CallActivity_7_taskMetaDataOutput + + + + maia + CallActivity_7_maiaInput + + + taskMetaData + CallActivity_7_taskMetaDataInput + + + CallActivity_7_actualTaskOutput + actualTask + + + CallActivity_7_maiaOutput + maia + + + CallActivity_7_taskMetaDataOutput + taskMetaData + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",46, 1,120,"com.fp.viaticos.task.AsignarTalentoHumano", "Reajustar talento humano", 15,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.TalentoHumano", maia, taskMetaData, 119 , 120); + + + List old=(List)tasksMetaData.get("Reajustar talento humano"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Reajustar talento humano",old); + + + + + + + + + + CallActivity_8_maiaInput + CallActivity_8_taskMetaDataInput + + + CallActivity_8_actualTaskOutput + CallActivity_8_maiaOutput + CallActivity_8_taskMetaDataOutput + + + + maia + CallActivity_8_maiaInput + + + taskMetaData + CallActivity_8_taskMetaDataInput + + + CallActivity_8_actualTaskOutput + actualTask + + + CallActivity_8_maiaOutput + maia + + + CallActivity_8_taskMetaDataOutput + taskMetaData + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30", 41, 1, 120, "com.fp.viaticos.task.AsignarUsuarioIngresaSolicitud", "Generar Informe UI", 16, "OK_NO"); +kcontext.setVariable("taskMetaData", taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Empleado", maia, taskMetaData, 123, 124); + + + List old=(List)tasksMetaData.get("Generar Informe UI"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Generar Informe UI",old); + + + + + + + + + + CallActivity_5_maiaInput + CallActivity_5_taskMetaDataInput + + + CallActivity_5_actualTaskOutput + CallActivity_5_maiaOutput + CallActivity_5_taskMetaDataOutput + + + + maia + CallActivity_5_maiaInput + + + taskMetaData + CallActivity_5_taskMetaDataInput + + + CallActivity_5_actualTaskOutput + actualTask + + + CallActivity_5_maiaOutput + maia + + + CallActivity_5_taskMetaDataOutput + taskMetaData + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",44, 1,120,"com.fp.viaticos.task.AsignarTalentoHumano","Confirmar informe TH", 18,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.TalentoHumano", maia, taskMetaData, 131 , 132); + + + List old=(List)tasksMetaData.get("Confirmar informe TH"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar informe TH",old); + + + + + + + + + + CallActivity_10_maiaInput + CallActivity_10_taskMetaDataInput + + + CallActivity_10_actualTaskOutput + CallActivity_10_maiaOutput + CallActivity_10_taskMetaDataOutput + + + + maia + CallActivity_10_maiaInput + + + taskMetaData + CallActivity_10_taskMetaDataInput + + + CallActivity_10_actualTaskOutput + actualTask + + + CallActivity_10_maiaOutput + maia + + + CallActivity_10_taskMetaDataOutput + taskMetaData + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",42, 1,120,"com.fp.viaticos.task.AsignarTesoreria","Confirmar informe tesoreria" ,18,"OK_NO"); +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 131 , 132); + + + List old=(List)tasksMetaData.get("Confirmar informe tesoreria"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar informe tesoreria",old); + + + + + + + + + + CallActivity_9_maiaInput + CallActivity_9_taskMetaDataInput + + + CallActivity_9_actualTaskOutput + CallActivity_9_maiaOutput + CallActivity_9_taskMetaDataOutput + + + + maia + CallActivity_9_maiaInput + + + taskMetaData + CallActivity_9_taskMetaDataInput + + + CallActivity_9_actualTaskOutput + actualTask + + + CallActivity_9_maiaOutput + maia + + + CallActivity_9_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",47, 1,120,"com.fp.viaticos.task.AsignarUsuarioIngresaSolicitud", "Confirmar comision UI", 13,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.UsaurioIngresoSolicitud", maia, taskMetaData, 115 , 116); + + + List old=(List)tasksMetaData.get("Confirmar comision UI"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar comision UI",old); + + + + + + + + + + CallActivity_4_maiaInput + CallActivity_4_taskMetaDataInput + + + CallActivity_4_actualTaskOutput + CallActivity_4_maiaOutput + CallActivity_4_taskMetaDataOutput + + + + maia + CallActivity_4_maiaInput + + + taskMetaData + CallActivity_4_taskMetaDataInput + + + CallActivity_4_actualTaskOutput + actualTask + + + CallActivity_4_maiaOutput + maia + + + CallActivity_4_taskMetaDataOutput + taskMetaData + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",43, 1,120,"com.fp.viaticos.task.AsignarTalentoHumano", "Confirmar talento humano", 12,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.TalentoHumano", maia, taskMetaData, 113 , 114); + + + List old=(List)tasksMetaData.get("Confirmar talento humano"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confimar talento humano",old); + + + + + + + + + + CallActivity_3_maiaInput + CallActivity_3_taskMetaDataInput + + + CallActivity_3_actualTaskOutput + CallActivity_3_maiaOutput + CallActivity_3_taskMetaDataOutput + + + + maia + CallActivity_3_maiaInput + + + taskMetaData + CallActivity_3_taskMetaDataInput + + + CallActivity_3_actualTaskOutput + actualTask + + + CallActivity_3_maiaOutput + maia + + + CallActivity_3_taskMetaDataOutput + taskMetaData + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",40, 1,120,"com.fp.viaticos.task.AsignarTesoreria", "Confirmar tesorería", 12,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 113 , 114); + + + List old=(List)tasksMetaData.get("Confirmar tesorería"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Confirmar tesorería",old); + + + + + + + + + + CallActivity_2_maiaInput + CallActivity_2_taskMetaDataInput + + + CallActivity_2_actualTaskOutput + CallActivity_2_maiaOutput + CallActivity_2_taskMetaDataOutput + + + + maia + CallActivity_2_maiaInput + + + taskMetaData + CallActivity_2_taskMetaDataInput + + + CallActivity_2_actualTaskOutput + actualTask + + + CallActivity_2_maiaOutput + maia + + + CallActivity_2_taskMetaDataOutput + taskMetaData + + + + + + + + + taskMetaData=FlowUtil.createTaskInfoByClassName("30",40, 1,120,"com.fp.viaticos.task.AsignarTesoreria", "Confirmar movilización", 19,"OK_NO"); + +kcontext.setVariable("taskMetaData",taskMetaData); +FlowUtil.mail("com.fp.viaticos.mail.Tesoreria", maia, taskMetaData, 133 , 134); + + + List old=(List)tasksMetaData.get("Confirmar movilización"); +if(old!=null){ + old.addAll(actualTask); +}else{ + old=actualTask; +} +tasksMetaData.put("Notificar movilización",old); + + + + + + + + + + CallActivity_11_maiaInput + CallActivity_11_taskMetaDataInput + + + CallActivity_11_actualTaskOutput + CallActivity_11_maiaOutput + CallActivity_11_taskMetaDataOutput + + + + maia + CallActivity_11_maiaInput + + + taskMetaData + CallActivity_11_taskMetaDataInput + + + CallActivity_11_actualTaskOutput + actualTask + + + CallActivity_11_maiaOutput + maia + + + CallActivity_11_taskMetaDataOutput + taskMetaData + + + + + + + return ("D".equals(taskMetaData.getResponse())); + + + + + + + return ("A".equals(taskMetaData.getResponse())); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/bpmlib/target/classes/rules/ASIGNARCOMITE.xls b/base/bpm/bpmlib/target/classes/rules/ASIGNARCOMITE.xls new file mode 100644 index 0000000..35c18ba Binary files /dev/null and b/base/bpm/bpmlib/target/classes/rules/ASIGNARCOMITE.xls differ diff --git a/base/bpm/bpmlib/target/classes/rules/ASIGNAROFICIAL.xls b/base/bpm/bpmlib/target/classes/rules/ASIGNAROFICIAL.xls new file mode 100644 index 0000000..a0712ec Binary files /dev/null and b/base/bpm/bpmlib/target/classes/rules/ASIGNAROFICIAL.xls differ diff --git a/base/bpm/bpmlib/target/classes/rules/VALIDAMONTO.xls b/base/bpm/bpmlib/target/classes/rules/VALIDAMONTO.xls new file mode 100644 index 0000000..8164450 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/rules/VALIDAMONTO.xls differ diff --git a/base/bpm/bpmlib/target/classes/rules/VALIDAPERSONAS.xls b/base/bpm/bpmlib/target/classes/rules/VALIDAPERSONAS.xls new file mode 100644 index 0000000..f329c59 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/rules/VALIDAPERSONAS.xls differ diff --git a/base/bpm/bpmlib/target/classes/rules/VALIDAPLAZO.xls b/base/bpm/bpmlib/target/classes/rules/VALIDAPLAZO.xls new file mode 100644 index 0000000..4d2d847 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/rules/VALIDAPLAZO.xls differ diff --git a/base/bpm/bpmlib/target/classes/rules/VALIDATASA.xls b/base/bpm/bpmlib/target/classes/rules/VALIDATASA.xls new file mode 100644 index 0000000..e81c241 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/rules/VALIDATASA.xls differ diff --git a/base/bpm/bpmlib/target/classes/rules/WPA.xls b/base/bpm/bpmlib/target/classes/rules/WPA.xls new file mode 100644 index 0000000..d293142 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/rules/WPA.xls differ diff --git a/base/bpm/bpmlib/target/classes/rules/catalogo.xls b/base/bpm/bpmlib/target/classes/rules/catalogo.xls new file mode 100644 index 0000000..88160e2 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/rules/catalogo.xls differ diff --git a/base/bpm/bpmlib/target/classes/rules/gf.xls b/base/bpm/bpmlib/target/classes/rules/gf.xls new file mode 100644 index 0000000..6f58a9b Binary files /dev/null and b/base/bpm/bpmlib/target/classes/rules/gf.xls differ diff --git a/base/bpm/bpmlib/target/classes/rules/rcatalogo.xls b/base/bpm/bpmlib/target/classes/rules/rcatalogo.xls new file mode 100644 index 0000000..fd31dd8 Binary files /dev/null and b/base/bpm/bpmlib/target/classes/rules/rcatalogo.xls differ diff --git a/base/bpm/bpmlib/target/maven-archiver/pom.properties b/base/bpm/bpmlib/target/maven-archiver/pom.properties new file mode 100644 index 0000000..7070fc1 --- /dev/null +++ b/base/bpm/bpmlib/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:53:00 ECT 2022 +version=2.1 +groupId=com.fp.base.bpm +artifactId=bpmlib diff --git a/base/bpm/flows/.svn/entries b/base/bpm/flows/.svn/entries new file mode 100644 index 0000000..e810a3f --- /dev/null +++ b/base/bpm/flows/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/flows +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:46.952821Z +79411681aec3ded81f046795774a5d7f +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +584 + diff --git a/base/bpm/flows/.svn/text-base/pom.xml.svn-base b/base/bpm/flows/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..dc6d328 --- /dev/null +++ b/base/bpm/flows/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,18 @@ + + + + bpm + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.bpm + flows + fp Platform - Flujos + 2.1 + + + diff --git a/base/bpm/flows/pom.xml b/base/bpm/flows/pom.xml new file mode 100644 index 0000000..dc6d328 --- /dev/null +++ b/base/bpm/flows/pom.xml @@ -0,0 +1,18 @@ + + + + bpm + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.bpm + flows + fp Platform - Flujos + 2.1 + + + diff --git a/base/bpm/flows/src/.svn/entries b/base/bpm/flows/src/.svn/entries new file mode 100644 index 0000000..85b42df --- /dev/null +++ b/base/bpm/flows/src/.svn/entries @@ -0,0 +1,37 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/flows/src +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +config +dir + +flows +dir + +rules +dir + diff --git a/base/bpm/flows/src/config/.svn/entries b/base/bpm/flows/src/config/.svn/entries new file mode 100644 index 0000000..f2240f3 --- /dev/null +++ b/base/bpm/flows/src/config/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/flows/src/config +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +jbpm-ds.xml +file + + + + +2022-07-28T03:40:46.503819Z +2c34623868439ed209e211aea2c786bf +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +1296 + diff --git a/base/bpm/flows/src/config/.svn/text-base/jbpm-ds.xml.svn-base b/base/bpm/flows/src/config/.svn/text-base/jbpm-ds.xml.svn-base new file mode 100644 index 0000000..b50131f --- /dev/null +++ b/base/bpm/flows/src/config/.svn/text-base/jbpm-ds.xml.svn-base @@ -0,0 +1,33 @@ + + + + jdbc/JBPM + false + jdbc:oracle:thin:@127.0.0.1:1521:test + oracle.jdbc.driver.OracleDriver + jbpm5 + jbpm5 + 5 + 20 + 80 + 0 + + Oracle + + + + jdbc/TASKS + false + jdbc:oracle:thin:@127.0.0.1:1521:test + oracle.jdbc.driver.OracleDriver + jbpm5 + jbpm5 + 5 + 20 + 80 + 0 + + Oracle + + + diff --git a/base/bpm/flows/src/config/jbpm-ds.xml b/base/bpm/flows/src/config/jbpm-ds.xml new file mode 100644 index 0000000..b50131f --- /dev/null +++ b/base/bpm/flows/src/config/jbpm-ds.xml @@ -0,0 +1,33 @@ + + + + jdbc/JBPM + false + jdbc:oracle:thin:@127.0.0.1:1521:test + oracle.jdbc.driver.OracleDriver + jbpm5 + jbpm5 + 5 + 20 + 80 + 0 + + Oracle + + + + jdbc/TASKS + false + jdbc:oracle:thin:@127.0.0.1:1521:test + oracle.jdbc.driver.OracleDriver + jbpm5 + jbpm5 + 5 + 20 + 80 + 0 + + Oracle + + + diff --git a/base/bpm/flows/src/flows/.svn/entries b/base/bpm/flows/src/flows/.svn/entries new file mode 100644 index 0000000..be69cc7 --- /dev/null +++ b/base/bpm/flows/src/flows/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/flows/src/flows +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +flows +dir + diff --git a/base/bpm/flows/src/flows/flows/.svn/entries b/base/bpm/flows/src/flows/flows/.svn/entries new file mode 100644 index 0000000..b751ad3 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/entries @@ -0,0 +1,980 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/flows/src/flows/flows +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +casoprueba.bpmn +file + + + + +2022-07-28T03:40:46.556819Z +d8147f312f22ba2618afd7e63174583f +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +26777 + +taskasign.bpmn +file + + + + +2022-07-28T03:40:46.555819Z +131050a2f023ed5f3f05c17eb9860469 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +12158 + +aprobacioncredito.bpmn +file + + + + +2022-07-28T03:40:46.556819Z +e6916a8850c0e25f95e9c997a8a40e0a +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +50730 + +testwpa.bpmn +file + + + + +2022-07-28T03:40:46.556819Z +950988d1e27bd8600fa3d0c183f85136 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +13394 + +nomenclatura.bpmn +file + + + + +2022-07-28T03:40:46.556819Z +7b4ad5e6700e0cbf90b64bebf4ef0b45 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +2366 + +flow5.bpmn +file + + + + +2022-07-28T03:40:46.557820Z +ecf6cc93ceec3748166558cde56cf428 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +9779 + +instrumnovacion.bpmn +file + + + + +2022-07-28T03:40:46.557820Z +5aafb9cac4c95100501d9e7271ca1f6e +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +32591 + +calificacionnovacion.bpmn +file + + + + +2022-07-28T03:40:46.557820Z +741aa9e951d9ff929adb0c71f2e7bee5 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +45218 + +basic1.bpmn +file + + + + +2022-07-28T03:40:46.557820Z +8a30d0f3393457fc99567423f6c58f19 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +6301 + +levantamientopargar.bpmn +file + + + + +2022-07-28T03:40:46.558820Z +f5707c35019414b05e5d5a2590e4fffd +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +41097 + +calificacion.bpmn +file + + + + +2022-07-28T03:40:46.558820Z +5b2adb9d0fe353199e103c2764ae7f1e +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +79081 + +flinal.bpmn +file + + + + +2022-07-28T03:40:46.559820Z +8313047f9f5533e8e5f23ce26ad088dc +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +6074 + +ampliacionperiodogracia.bpmn +file + + + + +2022-07-28T03:40:46.558820Z +201e357e195f37ec1353677ea852f630 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +39550 + +Looping.bpmn +file + + + + +2022-07-28T03:40:46.559820Z +c8864e87aea81d6f609d5d6a7256c31b +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +4987 + +credit.bpmn +file + + + + +2022-07-28T03:40:46.559820Z +83a5bce80d8df2ac9f6d69513313a99f +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +10717 + +constituciongarantias.bpmn +file + + + + +2022-07-28T03:40:46.559820Z +691d34402015a457c108cc1c323fc94d +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +93700 + +aprobacioncreditonova.bpmn +file + + + + +2022-07-28T03:40:46.560820Z +ed2a6f84f24e0f56d29e6e43dc67326c +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +32411 + +mapaBEV.bpmn +file + + + + +2022-07-28T03:40:46.560820Z +ecd3208ccad8dd317406aa347819e812 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +6059 + +precalificacion.bpmn +file + + + + +2022-07-28T03:40:46.560820Z +72e1bd741698c5117d17f9e668b30d8e +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +50683 + +matrizevaluacion.bpmn +file + + + + +2022-07-28T03:40:46.560820Z +51ef8865819025bf3b0e5cb1d3aff355 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +16440 + +n1.bpmn +file + + + + +2022-07-28T03:40:46.561820Z +7b01b05f074866f8eb434c8ab22df168 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +2296 + +levantamientodefgar.bpmn +file + + + + +2022-07-28T03:40:46.561820Z +6095ec9bd566453305b6ab18a6674e2a +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +32497 + +n2.bpmn +file + + + + +2022-07-28T03:40:46.561820Z +c512315805d1fa8c67e4567b049d0fb6 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +4277 + +test.bpmn +file + + + + +2022-07-28T03:40:46.561820Z +76bcd546c38cca941863302e852b5bf3 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +11981 + +n3.bpmn +file + + + + +2022-07-28T03:40:46.562820Z +f9a8b12c1b7889c6755db867f207e462 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +2646 + +basic.bpmn +file + + + + +2022-07-28T03:40:46.562820Z +359915363406443eb39c5f6c125ab883 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +6999 + +n4.bpmn +file + + + + +2022-07-28T03:40:46.562820Z +0a9977145864a973cd15e76d91586f26 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +3867 + +seguimientoycontrol.bpmn +file + + + + +2022-07-28T03:40:46.562820Z +446fab0a022ddcd8fd883fa30c0db714 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +73478 + diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/Looping.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/Looping.bpmn.svn-base new file mode 100644 index 0000000..fa00a54 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/Looping.bpmn.svn-base @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + return Long.valueOf(""+i) < Long.valueOf(""+count); + + + + + + return true; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/ampliacionperiodogracia.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/ampliacionperiodogracia.bpmn.svn-base new file mode 100644 index 0000000..6e7cfea --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/ampliacionperiodogracia.bpmn.svn-base @@ -0,0 +1,897 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + + + _3_actualTaskOutput + _3_maiaOutput + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_actualTaskOutput + actualTask + + + _3_maiaOutput + maia + + + _3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _110_maiaInput + _110_taskMetaDataInput + + + _110_actualTaskOutput + _110_maiaOutput + _110_taskMetaDataOutput + + + + maia + _110_maiaInput + + + taskMetaData + _110_taskMetaDataInput + + + _110_actualTaskOutput + actualTask + + + _110_maiaOutput + maia + + + _110_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _76_maiaInput + _76_taskMetaDataInput + + + _76_actualTaskOutput + _76_maiaOutput + _76_taskMetaDataOutput + + + + maia + _76_maiaInput + + + taskMetaData + _76_taskMetaDataInput + + + _76_actualTaskOutput + actualTask + + + _76_maiaOutput + maia + + + _76_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _111_maiaInput + _111_taskMetaDataInput + + + _111_actualTaskOutput + _111_maiaOutput + _111_taskMetaDataOutput + + + + maia + _111_maiaInput + + + taskMetaData + _111_taskMetaDataInput + + + _111_actualTaskOutput + actualTask + + + _111_maiaOutput + maia + + + _111_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + _10_maiaInput + _10_taskMetaDataInput + + + _10_actualTaskOutput + _10_maiaOutput + _10_taskMetaDataOutput + + + + maia + _10_maiaInput + + + taskMetaData + _10_taskMetaDataInput + + + _10_actualTaskOutput + actualTask + + + _10_maiaOutput + maia + + + _10_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + _12_maiaInput + _12_taskMetaDataInput + + + _12_actualTaskOutput + _12_maiaOutput + _12_taskMetaDataOutput + + + + maia + _12_maiaInput + + + taskMetaData + _12_taskMetaDataInput + + + _12_actualTaskOutput + actualTask + + + _12_maiaOutput + maia + + + _12_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _85_maiaInput + _85_taskMetaDataInput + + + _85_actualTaskOutput + _85_maiaOutput + _85_taskMetaDataOutput + + + + maia + _85_maiaInput + + + taskMetaData + _85_taskMetaDataInput + + + _85_actualTaskOutput + actualTask + + + _85_maiaOutput + maia + + + _85_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + _53_maiaInput + _53_taskMetaDataInput + + + _53_actualTaskOutput + _53_maiaOutput + _53_taskMetaDataOutput + + + + maia + _53_maiaInput + + + taskMetaData + _53_taskMetaDataInput + + + _53_actualTaskOutput + actualTask + + + _53_maiaOutput + maia + + + _53_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _112_maiaInput + _112_taskMetaDataInput + + + _112_actualTaskOutput + _112_maiaOutput + _112_taskMetaDataOutput + + + + maia + _112_maiaInput + + + taskMetaData + _112_taskMetaDataInput + + + _112_actualTaskOutput + actualTask + + + _112_maiaOutput + maia + + + _112_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _52_maiaInput + _52_taskMetaDataInput + + + _52_actualTaskOutput + _52_maiaOutput + _52_taskMetaDataOutput + + + + maia + _52_maiaInput + + + taskMetaData + _52_taskMetaDataInput + + + _52_actualTaskOutput + actualTask + + + _52_maiaOutput + maia + + + _52_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _31_maiaInput + _31_taskMetaDataInput + + + _31_actualTaskOutput + _31_maiaOutput + _31_taskMetaDataOutput + + + + maia + _31_maiaInput + + + taskMetaData + _31_taskMetaDataInput + + + _31_actualTaskOutput + actualTask + + + _31_maiaOutput + maia + + + _31_taskMetaDataOutput + taskMetaData + + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/aprobacioncredito.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/aprobacioncredito.bpmn.svn-base new file mode 100644 index 0000000..3f06553 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/aprobacioncredito.bpmn.svn-base @@ -0,0 +1,1136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + + + _3_actualTaskOutput + _3_maiaOutput + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_actualTaskOutput + actualTask + + + _3_maiaOutput + maia + + + _3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _76_maiaInput + _76_taskMetaDataInput + + + _76_actualTaskOutput + _76_maiaOutput + _76_taskMetaDataOutput + + + + maia + _76_maiaInput + + + taskMetaData + _76_taskMetaDataInput + + + _76_actualTaskOutput + actualTask + + + _76_maiaOutput + maia + + + _76_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _77_maiaInput + _77_taskMetaDataInput + + + _77_actualTaskOutput + _77_maiaOutput + _77_taskMetaDataOutput + + + + maia + _77_maiaInput + + + taskMetaData + _77_taskMetaDataInput + + + _77_actualTaskOutput + actualTask + + + _77_maiaOutput + maia + + + _77_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _10_maiaInput + _10_taskMetaDataInput + + + _10_actualTaskOutput + _10_maiaOutput + _10_taskMetaDataOutput + + + + maia + _10_maiaInput + + + taskMetaData + _10_taskMetaDataInput + + + _10_actualTaskOutput + actualTask + + + _10_maiaOutput + maia + + + _10_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + _12_maiaInput + _12_taskMetaDataInput + + + _12_actualTaskOutput + _12_maiaOutput + _12_taskMetaDataOutput + + + + maia + _12_maiaInput + + + taskMetaData + _12_taskMetaDataInput + + + _12_actualTaskOutput + actualTask + + + _12_maiaOutput + maia + + + _12_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _73_maiaInput + _73_taskMetaDataInput + + + _73_actualTaskOutput + _73_maiaOutput + _73_taskMetaDataOutput + + + + maia + _73_maiaInput + + + taskMetaData + _73_taskMetaDataInput + + + _73_actualTaskOutput + actualTask + + + _73_maiaOutput + maia + + + _73_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _74_maiaInput + _74_taskMetaDataInput + + + _74_actualTaskOutput + _74_maiaOutput + _74_taskMetaDataOutput + + + + maia + _74_maiaInput + + + taskMetaData + _74_taskMetaDataInput + + + _74_actualTaskOutput + actualTask + + + _74_maiaOutput + maia + + + _74_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _85_maiaInput + _85_taskMetaDataInput + + + _85_actualTaskOutput + _85_maiaOutput + _85_taskMetaDataOutput + + + + maia + _85_maiaInput + + + taskMetaData + _85_taskMetaDataInput + + + _85_actualTaskOutput + actualTask + + + _85_maiaOutput + maia + + + _85_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _28_maiaInput + _28_taskMetaDataInput + + + _28_actualTaskOutput + _28_maiaOutput + _28_taskMetaDataOutput + + + + maia + _28_maiaInput + + + taskMetaData + _28_taskMetaDataInput + + + _28_actualTaskOutput + actualTask + + + _28_maiaOutput + maia + + + _28_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + _31_maiaInput + _31_taskMetaDataInput + + + _31_actualTaskOutput + _31_maiaOutput + _31_taskMetaDataOutput + + + + maia + _31_maiaInput + + + taskMetaData + _31_taskMetaDataInput + + + _31_actualTaskOutput + actualTask + + + _31_maiaOutput + maia + + + _31_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + _54_maiaInput + _54_taskMetaDataInput + + + _54_actualTaskOutput + _54_maiaOutput + _54_taskMetaDataOutput + + + + maia + _54_maiaInput + + + taskMetaData + _54_taskMetaDataInput + + + _54_actualTaskOutput + actualTask + + + _54_maiaOutput + maia + + + _54_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _53_maiaInput + _53_taskMetaDataInput + + + _53_actualTaskOutput + _53_maiaOutput + _53_taskMetaDataOutput + + + + maia + _53_maiaInput + + + taskMetaData + _53_taskMetaDataInput + + + _53_actualTaskOutput + actualTask + + + _53_maiaOutput + maia + + + _53_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _52_maiaInput + _52_taskMetaDataInput + + + _52_actualTaskOutput + _52_maiaOutput + _52_taskMetaDataOutput + + + + maia + _52_maiaInput + + + taskMetaData + _52_taskMetaDataInput + + + _52_actualTaskOutput + actualTask + + + _52_maiaOutput + maia + + + _52_taskMetaDataOutput + taskMetaData + + + + + + + + + return ((String)maia.get("RECEIVER")).compareTo("C")==0; + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + return ((String)maia.get("midbonus")).compareTo("N")==0; + + + + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + return ((String)maia.get("midbonus")).compareTo("N")!=0; + + + + return ((String)maia.get("RECEIVER")).compareTo("D")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/aprobacioncreditonova.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/aprobacioncreditonova.bpmn.svn-base new file mode 100644 index 0000000..28493f9 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/aprobacioncreditonova.bpmn.svn-base @@ -0,0 +1,728 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + + + _3_actualTaskOutput + _3_maiaOutput + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_actualTaskOutput + actualTask + + + _3_maiaOutput + maia + + + _3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _76_maiaInput + _76_taskMetaDataInput + + + _76_actualTaskOutput + _76_maiaOutput + _76_taskMetaDataOutput + + + + maia + _76_maiaInput + + + taskMetaData + _76_taskMetaDataInput + + + _76_actualTaskOutput + actualTask + + + _76_maiaOutput + maia + + + _76_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + _10_maiaInput + _10_taskMetaDataInput + + + _10_actualTaskOutput + _10_maiaOutput + _10_taskMetaDataOutput + + + + maia + _10_maiaInput + + + taskMetaData + _10_taskMetaDataInput + + + _10_actualTaskOutput + actualTask + + + _10_maiaOutput + maia + + + _10_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + _12_maiaInput + _12_taskMetaDataInput + + + _12_actualTaskOutput + _12_maiaOutput + _12_taskMetaDataOutput + + + + maia + _12_maiaInput + + + taskMetaData + _12_taskMetaDataInput + + + _12_actualTaskOutput + actualTask + + + _12_maiaOutput + maia + + + _12_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + _85_maiaInput + _85_taskMetaDataInput + + + _85_actualTaskOutput + _85_maiaOutput + _85_taskMetaDataOutput + + + + maia + _85_maiaInput + + + taskMetaData + _85_taskMetaDataInput + + + _85_actualTaskOutput + actualTask + + + _85_maiaOutput + maia + + + _85_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + _53_maiaInput + _53_taskMetaDataInput + + + _53_actualTaskOutput + _53_maiaOutput + _53_taskMetaDataOutput + + + + maia + _53_maiaInput + + + taskMetaData + _53_taskMetaDataInput + + + _53_actualTaskOutput + actualTask + + + _53_maiaOutput + maia + + + _53_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _52_maiaInput + _52_taskMetaDataInput + + + _52_actualTaskOutput + _52_maiaOutput + _52_taskMetaDataOutput + + + + maia + _52_maiaInput + + + taskMetaData + _52_taskMetaDataInput + + + _52_actualTaskOutput + actualTask + + + _52_maiaOutput + maia + + + _52_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + _31_maiaInput + _31_taskMetaDataInput + + + _31_actualTaskOutput + _31_maiaOutput + _31_taskMetaDataOutput + + + + maia + _31_maiaInput + + + taskMetaData + _31_taskMetaDataInput + + + _31_actualTaskOutput + actualTask + + + _31_maiaOutput + maia + + + _31_taskMetaDataOutput + taskMetaData + + + + + + + + return ((String)maia.get("RECEIVER")).compareTo("C")==0; + + + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + + + + + + + + + + return ((String)maia.get("RECEIVER")).compareTo("D")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/basic.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/basic.bpmn.svn-base new file mode 100644 index 0000000..eca0e92 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/basic.bpmn.svn-base @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _5_maiaInput + _5_taskMetaDataInput + + + _5_actualTaskOutput + _5_maiaOutput + _5_taskMetaDataOutput + + + + maia + _5_maiaInput + + + taskMetaData + _5_taskMetaDataInput + + + _5_actualTaskOutput + actualTask + + + _5_maiaOutput + maia + + + _5_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/basic1.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/basic1.bpmn.svn-base new file mode 100644 index 0000000..c9909ea --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/basic1.bpmn.svn-base @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _5_maiaInput + _5_taskMetaDataInput + + + _5_actualTaskOutput + _5_maiaOutput + _5_taskMetaDataOutput + + + + maia + _5_maiaInput + + + taskMetaData + _5_taskMetaDataInput + + + _5_actualTaskOutput + actualTask + + + _5_maiaOutput + maia + + + _5_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/calificacion.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/calificacion.bpmn.svn-base new file mode 100644 index 0000000..586ee01 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/calificacion.bpmn.svn-base @@ -0,0 +1,1790 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _69_maiaInput + _69_taskMetaDataInput + + + _69_actualTaskOutput + _69_maiaOutput + _69_taskMetaDataOutput + + + + maia + _69_maiaInput + + + taskMetaData + _69_taskMetaDataInput + + + _69_actualTaskOutput + actualTask + + + _69_maiaOutput + maia + + + _69_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + _71_maiaInput + _71_taskMetaDataInput + + + _71_actualTaskOutput + _71_maiaOutput + _71_taskMetaDataOutput + + + + maia + _71_maiaInput + + + taskMetaData + _71_taskMetaDataInput + + + _71_actualTaskOutput + actualTask + + + _71_maiaOutput + maia + + + _71_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + + + _3_actualTaskOutput + _3_maiaOutput + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_actualTaskOutput + actualTask + + + _3_maiaOutput + maia + + + _3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + _76_maiaInput + _76_taskMetaDataInput + + + _76_actualTaskOutput + _76_maiaOutput + _76_taskMetaDataOutput + + + + maia + _76_maiaInput + + + taskMetaData + _76_taskMetaDataInput + + + _76_actualTaskOutput + actualTask + + + _76_maiaOutput + maia + + + _76_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + _77_maiaInput + _77_taskMetaDataInput + + + _77_actualTaskOutput + _77_maiaOutput + _77_taskMetaDataOutput + + + + maia + _77_maiaInput + + + taskMetaData + _77_taskMetaDataInput + + + _77_actualTaskOutput + actualTask + + + _77_maiaOutput + maia + + + _77_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _78_maiaInput + _78_taskMetaDataInput + + + _78_actualTaskOutput + _78_maiaOutput + _78_taskMetaDataOutput + + + + maia + _78_maiaInput + + + taskMetaData + _78_taskMetaDataInput + + + _78_actualTaskOutput + actualTask + + + _78_maiaOutput + maia + + + _78_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _10_maiaInput + _10_taskMetaDataInput + + + _10_actualTaskOutput + _10_maiaOutput + _10_taskMetaDataOutput + + + + maia + _10_maiaInput + + + taskMetaData + _10_taskMetaDataInput + + + _10_actualTaskOutput + actualTask + + + _10_maiaOutput + maia + + + _10_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + _72_maiaInput + _72_taskMetaDataInput + + + _72_actualTaskOutput + _72_maiaOutput + _72_taskMetaDataOutput + + + + maia + _72_maiaInput + + + taskMetaData + _72_taskMetaDataInput + + + _72_actualTaskOutput + actualTask + + + _72_maiaOutput + maia + + + _72_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _12_maiaInput + _12_taskMetaDataInput + + + _12_actualTaskOutput + _12_maiaOutput + _12_taskMetaDataOutput + + + + maia + _12_maiaInput + + + taskMetaData + _12_taskMetaDataInput + + + _12_actualTaskOutput + actualTask + + + _12_maiaOutput + maia + + + _12_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _73_maiaInput + _73_taskMetaDataInput + + + _73_actualTaskOutput + _73_maiaOutput + _73_taskMetaDataOutput + + + + maia + _73_maiaInput + + + taskMetaData + _73_taskMetaDataInput + + + _73_actualTaskOutput + actualTask + + + _73_maiaOutput + maia + + + _73_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _74_maiaInput + _74_taskMetaDataInput + + + _74_actualTaskOutput + _74_maiaOutput + _74_taskMetaDataOutput + + + + maia + _74_maiaInput + + + taskMetaData + _74_taskMetaDataInput + + + _74_actualTaskOutput + actualTask + + + _74_maiaOutput + maia + + + _74_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + _16_maiaInput + _16_taskMetaDataInput + + + _16_actualTaskOutput + _16_maiaOutput + _16_taskMetaDataOutput + + + + maia + _16_maiaInput + + + taskMetaData + _16_taskMetaDataInput + + + _16_actualTaskOutput + actualTask + + + _16_maiaOutput + maia + + + _16_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _18_maiaInput + _18_taskMetaDataInput + + + _18_actualTaskOutput + _18_maiaOutput + _18_taskMetaDataOutput + + + + maia + _18_maiaInput + + + taskMetaData + _18_taskMetaDataInput + + + _18_actualTaskOutput + actualTask + + + _18_maiaOutput + maia + + + _18_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + _23_maiaInput + _23_taskMetaDataInput + + + _23_actualTaskOutput + _23_maiaOutput + _23_taskMetaDataOutput + + + + maia + _23_maiaInput + + + taskMetaData + _23_taskMetaDataInput + + + _23_actualTaskOutput + actualTask + + + _23_maiaOutput + maia + + + _23_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _22_maiaInput + _22_taskMetaDataInput + + + _22_actualTaskOutput + _22_maiaOutput + _22_taskMetaDataOutput + + + + maia + _22_maiaInput + + + taskMetaData + _22_taskMetaDataInput + + + _22_actualTaskOutput + actualTask + + + _22_maiaOutput + maia + + + _22_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _29_maiaInput + _29_taskMetaDataInput + + + _29_actualTaskOutput + _29_maiaOutput + _29_taskMetaDataOutput + + + + maia + _29_maiaInput + + + taskMetaData + _29_taskMetaDataInput + + + _29_actualTaskOutput + actualTask + + + _29_maiaOutput + maia + + + _29_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _28_maiaInput + _28_taskMetaDataInput + + + _28_actualTaskOutput + _28_maiaOutput + _28_taskMetaDataOutput + + + + maia + _28_maiaInput + + + taskMetaData + _28_taskMetaDataInput + + + _28_actualTaskOutput + actualTask + + + _28_maiaOutput + maia + + + _28_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _31_maiaInput + _31_taskMetaDataInput + + + _31_actualTaskOutput + _31_maiaOutput + _31_taskMetaDataOutput + + + + maia + _31_maiaInput + + + taskMetaData + _31_taskMetaDataInput + + + _31_actualTaskOutput + actualTask + + + _31_maiaOutput + maia + + + _31_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _30_maiaInput + _30_taskMetaDataInput + + + _30_actualTaskOutput + _30_maiaOutput + _30_taskMetaDataOutput + + + + maia + _30_maiaInput + + + taskMetaData + _30_taskMetaDataInput + + + _30_actualTaskOutput + actualTask + + + _30_maiaOutput + maia + + + _30_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + _54_maiaInput + _54_taskMetaDataInput + + + _54_actualTaskOutput + _54_maiaOutput + _54_taskMetaDataOutput + + + + maia + _54_maiaInput + + + taskMetaData + _54_taskMetaDataInput + + + _54_actualTaskOutput + actualTask + + + _54_maiaOutput + maia + + + _54_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _53_maiaInput + _53_taskMetaDataInput + + + _53_actualTaskOutput + _53_maiaOutput + _53_taskMetaDataOutput + + + + maia + _53_maiaInput + + + taskMetaData + _53_taskMetaDataInput + + + _53_actualTaskOutput + actualTask + + + _53_maiaOutput + maia + + + _53_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _52_maiaInput + _52_taskMetaDataInput + + + _52_actualTaskOutput + _52_maiaOutput + _52_taskMetaDataOutput + + + + maia + _52_maiaInput + + + taskMetaData + _52_taskMetaDataInput + + + _52_actualTaskOutput + actualTask + + + _52_maiaOutput + maia + + + _52_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _57_maiaInput + _57_taskMetaDataInput + + + _57_actualTaskOutput + _57_maiaOutput + _57_taskMetaDataOutput + + + + maia + _57_maiaInput + + + taskMetaData + _57_taskMetaDataInput + + + _57_actualTaskOutput + actualTask + + + _57_maiaOutput + maia + + + _57_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + return ((String)maia.get("REQ_REC_OBS")).compareTo("Y")!=0; + + + + + + + + + + + + return ((String)maia.get("proyectoviable")).compareTo("N")==0; + + + return ((String)maia.get("proyectoviable")).compareTo("N")!=0; + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + return ((String)maia.get("REQ_REC_OBS")).compareTo("Y")==0; + + + + + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/calificacionnovacion.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/calificacionnovacion.bpmn.svn-base new file mode 100644 index 0000000..36e76ce --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/calificacionnovacion.bpmn.svn-base @@ -0,0 +1,1033 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _69_maiaInput + _69_taskMetaDataInput + + + _69_actualTaskOutput + _69_maiaOutput + _69_taskMetaDataOutput + + + + maia + _69_maiaInput + + + taskMetaData + _69_taskMetaDataInput + + + _69_actualTaskOutput + actualTask + + + _69_maiaOutput + maia + + + _69_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + + + _3_actualTaskOutput + _3_maiaOutput + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_actualTaskOutput + actualTask + + + _3_maiaOutput + maia + + + _3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _71_maiaInput + _71_taskMetaDataInput + + + _71_actualTaskOutput + _71_maiaOutput + _71_taskMetaDataOutput + + + + maia + _71_maiaInput + + + taskMetaData + _71_taskMetaDataInput + + + _71_actualTaskOutput + actualTask + + + _71_maiaOutput + maia + + + _71_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _76_maiaInput + _76_taskMetaDataInput + + + _76_actualTaskOutput + _76_maiaOutput + _76_taskMetaDataOutput + + + + maia + _76_maiaInput + + + taskMetaData + _76_taskMetaDataInput + + + _76_actualTaskOutput + actualTask + + + _76_maiaOutput + maia + + + _76_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _77_maiaInput + _77_taskMetaDataInput + + + _77_actualTaskOutput + _77_maiaOutput + _77_taskMetaDataOutput + + + + maia + _77_maiaInput + + + taskMetaData + _77_taskMetaDataInput + + + _77_actualTaskOutput + actualTask + + + _77_maiaOutput + maia + + + _77_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _78_maiaInput + _78_taskMetaDataInput + + + _78_actualTaskOutput + _78_maiaOutput + _78_taskMetaDataOutput + + + + maia + _78_maiaInput + + + taskMetaData + _78_taskMetaDataInput + + + _78_actualTaskOutput + actualTask + + + _78_maiaOutput + maia + + + _78_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _72_maiaInput + _72_taskMetaDataInput + + + _72_actualTaskOutput + _72_maiaOutput + _72_taskMetaDataOutput + + + + maia + _72_maiaInput + + + taskMetaData + _72_taskMetaDataInput + + + _72_actualTaskOutput + actualTask + + + _72_maiaOutput + maia + + + _72_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _73_maiaInput + _73_taskMetaDataInput + + + _73_actualTaskOutput + _73_maiaOutput + _73_taskMetaDataOutput + + + + maia + _73_maiaInput + + + taskMetaData + _73_taskMetaDataInput + + + _73_actualTaskOutput + actualTask + + + _73_maiaOutput + maia + + + _73_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _74_maiaInput + _74_taskMetaDataInput + + + _74_actualTaskOutput + _74_maiaOutput + _74_taskMetaDataOutput + + + + maia + _74_maiaInput + + + taskMetaData + _74_taskMetaDataInput + + + _74_actualTaskOutput + actualTask + + + _74_maiaOutput + maia + + + _74_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + _82_maiaInput + _82_taskMetaDataInput + + + _82_actualTaskOutput + _82_maiaOutput + _82_taskMetaDataOutput + + + + maia + _82_maiaInput + + + taskMetaData + _82_taskMetaDataInput + + + _82_actualTaskOutput + actualTask + + + _82_maiaOutput + maia + + + _82_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _29_maiaInput + _29_taskMetaDataInput + + + _29_actualTaskOutput + _29_maiaOutput + _29_taskMetaDataOutput + + + + maia + _29_maiaInput + + + taskMetaData + _29_taskMetaDataInput + + + _29_actualTaskOutput + actualTask + + + _29_maiaOutput + maia + + + _29_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + _52_maiaInput + _52_taskMetaDataInput + + + _52_actualTaskOutput + _52_maiaOutput + _52_taskMetaDataOutput + + + + maia + _52_maiaInput + + + taskMetaData + _52_taskMetaDataInput + + + _52_actualTaskOutput + actualTask + + + _52_maiaOutput + maia + + + _52_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _57_maiaInput + _57_taskMetaDataInput + + + _57_actualTaskOutput + _57_maiaOutput + _57_taskMetaDataOutput + + + + maia + _57_maiaInput + + + taskMetaData + _57_taskMetaDataInput + + + _57_actualTaskOutput + actualTask + + + _57_maiaOutput + maia + + + _57_taskMetaDataOutput + taskMetaData + + + + + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + return ((String)maia.get("FINANCIALTYPE")).compareTo("R")==0; + + + + return ((String)maia.get("FINANCIALTYPE")).compareTo("F")==0; + + + + + + + + + + + + + + + + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/casoprueba.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/casoprueba.bpmn.svn-base new file mode 100644 index 0000000..f6b393a --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/casoprueba.bpmn.svn-base @@ -0,0 +1,560 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _32_maiaInput + _32_taskMetaDataInput + + + _32_actualTaskOutput + _32_maiaOutput + _32_taskMetaDataOutput + + + + maia + _32_maiaInput + + + taskMetaData + _32_taskMetaDataInput + + + _32_actualTaskOutput + actualTask + + + _32_maiaOutput + maia + + + _32_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _5_maiaInput + _5_taskMetaDataInput + + + _5_actualTaskOutput + _5_maiaOutput + _5_taskMetaDataOutput + + + + maia + _5_maiaInput + + + taskMetaData + _5_taskMetaDataInput + + + _5_actualTaskOutput + actualTask + + + _5_maiaOutput + maia + + + _5_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _23_maiaInput + _23_taskMetaDataInput + + + _23_actualTaskOutput + _23_maiaOutput + _23_taskMetaDataOutput + + + + maia + _23_maiaInput + + + taskMetaDataVM + _23_taskMetaDataInput + + + _23_actualTaskOutput + actualTaskVM + + + _23_maiaOutput + maia + + + _23_taskMetaDataOutput + taskMetaDataVM + + + + + + + + + + + + + + + + + + + _25_maiaInput + _25_taskMetaDataInput + + + _25_actualTaskOutput + _25_maiaOutput + _25_taskMetaDataOutput + + + + maia + _25_maiaInput + + + taskMetaDataVT + _25_taskMetaDataInput + + + _25_actualTaskOutput + actualTaskVT + + + _25_maiaOutput + maia + + + _25_taskMetaDataOutput + taskMetaDataVT + + + + + + + + + + + + + + + + + + + _24_maiaInput + _24_taskMetaDataInput + + + _24_actualTaskOutput + _24_maiaOutput + _24_taskMetaDataOutput + + + + maia + _24_maiaInput + + + taskMetaDataVP + _24_taskMetaDataInput + + + _24_actualTaskOutput + actualTaskVP + + + _24_maiaOutput + maia + + + _24_taskMetaDataOutput + taskMetaDataVP + + + + + + + + + + + + + + + + + + + + + + + + _30_maiaInput + _30_taskMetaDataInput + + + _30_actualTaskOutput + _30_maiaOutput + _30_taskMetaDataOutput + + + + maia + _30_maiaInput + + + taskMetaData + _30_taskMetaDataInput + + + _30_actualTaskOutput + actualTask + + + _30_maiaOutput + maia + + + _30_taskMetaDataOutput + taskMetaData + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + return taskMetaData.getResponse().compareTo("D")==0; + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + return taskMetaDataVT.getResponse().compareTo("D")==0; + + + return taskMetaDataVP.getResponse().compareTo("D")==0; + + + return taskMetaDataVM.getResponse().compareTo("D")==0; + + + + + + + + return taskMetaDataVM.getResponse().compareTo("D")!=0; + + + return taskMetaDataVT.getResponse().compareTo("D")!=0; + + + return taskMetaDataVP.getResponse().compareTo("D")!=0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/constituciongarantias.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/constituciongarantias.bpmn.svn-base new file mode 100644 index 0000000..8e89899 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/constituciongarantias.bpmn.svn-base @@ -0,0 +1,2074 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + _10_maiaInput + _10_taskMetaDataInput + + + _10_actualTaskOutput + _10_maiaOutput + _10_taskMetaDataOutput + + + + maia + _10_maiaInput + + + taskMetaData + _10_taskMetaDataInput + + + _10_actualTaskOutput + actualTask + + + _10_maiaOutput + maia + + + _10_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + _12_maiaInput + _12_taskMetaDataInput + + + _12_actualTaskOutput + _12_maiaOutput + _12_taskMetaDataOutput + + + + maia + _12_maiaInput + + + taskMetaData + _12_taskMetaDataInput + + + _12_actualTaskOutput + actualTask + + + _12_maiaOutput + maia + + + _12_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + _134_maiaInput + _134_taskMetaDataInput + + + _134_actualTaskOutput + _134_maiaOutput + _134_taskMetaDataOutput + + + + maia + _134_maiaInput + + + taskMetaData + _134_taskMetaDataInput + + + _134_actualTaskOutput + actualTask + + + _134_maiaOutput + maia + + + _134_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _28_maiaInput + _28_taskMetaDataInput + + + _28_actualTaskOutput + _28_maiaOutput + _28_taskMetaDataOutput + + + + maia + _28_maiaInput + + + taskMetaData + _28_taskMetaDataInput + + + _28_actualTaskOutput + actualTask + + + _28_maiaOutput + maia + + + _28_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _31_maiaInput + _31_taskMetaDataInput + + + _31_actualTaskOutput + _31_maiaOutput + _31_taskMetaDataOutput + + + + maia + _31_maiaInput + + + taskMetaData + _31_taskMetaDataInput + + + _31_actualTaskOutput + actualTask + + + _31_maiaOutput + maia + + + _31_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _54_maiaInput + _54_taskMetaDataInput + + + _54_actualTaskOutput + _54_maiaOutput + _54_taskMetaDataOutput + + + + maia + _54_maiaInput + + + taskMetaData + _54_taskMetaDataInput + + + _54_actualTaskOutput + actualTask + + + _54_maiaOutput + maia + + + _54_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _53_maiaInput + _53_taskMetaDataInput + + + _53_actualTaskOutput + _53_maiaOutput + _53_taskMetaDataOutput + + + + maia + _53_maiaInput + + + taskMetaData + _53_taskMetaDataInput + + + _53_actualTaskOutput + actualTask + + + _53_maiaOutput + maia + + + _53_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _76_maiaInput + _76_taskMetaDataInput + + + _76_actualTaskOutput + _76_maiaOutput + _76_taskMetaDataOutput + + + + maia + _76_maiaInput + + + taskMetaData + _76_taskMetaDataInput + + + _76_actualTaskOutput + actualTask + + + _76_maiaOutput + maia + + + _76_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _77_maiaInput + _77_taskMetaDataInput + + + _77_actualTaskOutput + _77_maiaOutput + _77_taskMetaDataOutput + + + + maia + _77_maiaInput + + + taskMetaData + _77_taskMetaDataInput + + + _77_actualTaskOutput + actualTask + + + _77_maiaOutput + maia + + + _77_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + _73_maiaInput + _73_taskMetaDataInput + + + _73_actualTaskOutput + _73_maiaOutput + _73_taskMetaDataOutput + + + + maia + _73_maiaInput + + + taskMetaData + _73_taskMetaDataInput + + + _73_actualTaskOutput + actualTask + + + _73_maiaOutput + maia + + + _73_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _74_maiaInput + _74_taskMetaDataInput + + + _74_actualTaskOutput + _74_maiaOutput + _74_taskMetaDataOutput + + + + maia + _74_maiaInput + + + taskMetaData + _74_taskMetaDataInput + + + _74_actualTaskOutput + actualTask + + + _74_maiaOutput + maia + + + _74_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _85_maiaInput + _85_taskMetaDataInput + + + _85_actualTaskOutput + _85_maiaOutput + _85_taskMetaDataOutput + + + + maia + _85_maiaInput + + + taskMetaData + _85_taskMetaDataInput + + + _85_actualTaskOutput + actualTask + + + _85_maiaOutput + maia + + + _85_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _102_maiaInput + _102_taskMetaDataInput + + + _102_actualTaskOutput + _102_maiaOutput + _102_taskMetaDataOutput + + + + maia + _102_maiaInput + + + taskMetaData + _102_taskMetaDataInput + + + _102_actualTaskOutput + actualTask + + + _102_maiaOutput + maia + + + _102_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _100_maiaInput + _100_taskMetaDataInput + + + _100_actualTaskOutput + _100_maiaOutput + _100_taskMetaDataOutput + + + + maia + _100_maiaInput + + + taskMetaData + _100_taskMetaDataInput + + + _100_actualTaskOutput + actualTask + + + _100_maiaOutput + maia + + + _100_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _101_maiaInput + _101_taskMetaDataInput + + + _101_actualTaskOutput + _101_maiaOutput + _101_taskMetaDataOutput + + + + maia + _101_maiaInput + + + taskMetaData + _101_taskMetaDataInput + + + _101_actualTaskOutput + actualTask + + + _101_maiaOutput + maia + + + _101_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _99_maiaInput + _99_taskMetaDataInput + + + _99_actualTaskOutput + _99_maiaOutput + _99_taskMetaDataOutput + + + + maia + _99_maiaInput + + + taskMetaData + _99_taskMetaDataInput + + + _99_actualTaskOutput + actualTask + + + _99_maiaOutput + maia + + + _99_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _110_maiaInput + _110_taskMetaDataInput + + + _110_actualTaskOutput + _110_maiaOutput + _110_taskMetaDataOutput + + + + maia + _110_maiaInput + + + taskMetaData + _110_taskMetaDataInput + + + _110_actualTaskOutput + actualTask + + + _110_maiaOutput + maia + + + _110_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _111_maiaInput + _111_taskMetaDataInput + + + _111_actualTaskOutput + _111_maiaOutput + _111_taskMetaDataOutput + + + + maia + _111_maiaInput + + + taskMetaData + _111_taskMetaDataInput + + + _111_actualTaskOutput + actualTask + + + _111_maiaOutput + maia + + + _111_taskMetaDataOutput + taskMetaDat + + + + + + + + + + + + + + + + + + + _108_maiaInput + _108_taskMetaDataInput + + + _108_actualTaskOutput + _108_maiaOutput + _108_taskMetaDataOutput + + + + maia + _108_maiaInput + + + taskMetaData + _108_taskMetaDataInput + + + _108_actualTaskOutput + actualTask + + + _108_maiaOutput + maia + + + _108_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _109_maiaInput + _109_taskMetaDataInput + + + _109_actualTaskOutput + _109_maiaOutput + _109_taskMetaDataOutput + + + + maia + _109_maiaInput + + + taskMetaData + _109_taskMetaDataInput + + + _109_actualTaskOutput + actualTask + + + _109_maiaOutput + maia + + + _109_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + _105_maiaInput + _105_taskMetaDataInput + + + _105_actualTaskOutput + _105_maiaOutput + _105_taskMetaDataOutput + + + + maia + _105_maiaInput + + + taskMetaData + _105_taskMetaDataInput + + + _105_actualTaskOutput + actualTask + + + _105_maiaOutput + maia + + + _105_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _117_maiaInput + _117_taskMetaDataInput + + + _117_actualTaskOutput + _117_maiaOutput + _117_taskMetaDataOutput + + + + maia + _117_maiaInput + + + taskMetaData + _117_taskMetaDataInput + + + _117_actualTaskOutput + actualTask + + + _117_maiaOutput + maia + + + _117_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + _114_maiaInput + _114_taskMetaDataInput + + + _114_actualTaskOutput + _114_maiaOutput + _114_taskMetaDataOutput + + + + maia + _114_maiaInput + + + taskMetaData + _114_taskMetaDataInput + + + _114_actualTaskOutput + actualTask + + + _114_maiaOutput + maia + + + _114_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _112_maiaInput + _112_taskMetaDataInput + + + _112_actualTaskOutput + _112_maiaOutput + _112_taskMetaDataOutput + + + + maia + _112_maiaInput + + + taskMetaData + _112_taskMetaDataInput + + + _112_actualTaskOutput + actualTask + + + _112_maiaOutput + maia + + + _112_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _125_maiaInput + _125_taskMetaDataInput + + + _125_actualTaskOutput + _125_maiaOutput + _125_taskMetaDataOutput + + + + maia + _125_maiaInput + + + taskMetaData + _125_taskMetaDataInput + + + _125_actualTaskOutput + actualTask + + + _125_maiaOutput + maia + + + _125_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _123_maiaInput + _123_taskMetaDataInput + + + _123_actualTaskOutput + _123_maiaOutput + _123_taskMetaDataOutput + + + + maia + _123_maiaInput + + + taskMetaData + _123_taskMetaDataInput + + + _123_actualTaskOutput + actualTask + + + _123_maiaOutput + maia + + + _123_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _121_maiaInput + _121_taskMetaDataInput + + + _121_actualTaskOutput + _121_maiaOutput + _121_taskMetaDataOutput + + + + maia + _121_maiaInput + + + taskMetaData + _121_taskMetaDataInput + + + _121_actualTaskOutput + actualTask + + + _121_maiaOutput + maia + + + _121_taskMetaDataOutput + taskMetaData + + + + + + + + return ((String)maia.get("outlay")).compareTo("Y")==0; + + + + return ((String)maia.get("RECEIVER")).compareTo("C")==0; + + + return ((String)maia.get("tipogarantia")).compareTo("H")==0; + + + + + return ((String)maia.get("tipogarantia")).compareTo("H")==0; + + + return ((String)maia.get("tipograntia")).compareTo("H")!=0; + + + + return ((String)maia.get("outlay")).compareTo("N")==0; + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + + + + + + + + + + + return ((String)maia.get("mantienegarantia")).compareTo("N")==0; + + + return ((String)maia.get("mantienegarantia")).compareTo("N")!=0; + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + + + return ((String)maia.get("tipogarantia")).compareTo("H")!=0; + + + return ((String)maia.get("mantienegarantia")).compareTo("N")!=0; + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + return ((String)maia.get("mantienegarantia")).compareTo("N")==0; + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + return taskMetaData.getResponse().compareTo("D")==0; + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + + return ((String)maia.get("RECEIVER")).compareTo("C")!=0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/credit.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/credit.bpmn.svn-base new file mode 100644 index 0000000..d69ddc9 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/credit.bpmn.svn-base @@ -0,0 +1,267 @@ + + + + + + + + + + + + + + + + + + + + + + + + _5_countInput + _5_usuarioInput + _5_mInput + + + + + + maia.count + _5_countInput + + + maia.usuario + _5_usuarioInput + + + maia + _5_mInput + + + + + + + + + _6_countInput + _6_usuarioInput + _6_mInput + + + + + + maia.count + _6_countInput + + + maia.usuario + _6_usuarioInput + + + maia + _6_mInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + return maia.get("teller.required")!=null; + + + + + + + + + + + return maia.get("teller.required")==null; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/flinal.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/flinal.bpmn.svn-base new file mode 100644 index 0000000..26eb22e --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/flinal.bpmn.svn-base @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _5_maiaInput + _5_taskMetaDataInput + + + _5_actualTaskOutput + _5_maiaOutput + _5_taskMetaDataOutput + + + + maia + _5_maiaInput + + + taskMetaData + _5_taskMetaDataInput + + + _5_actualTaskOutput + actualTask + + + _5_maiaOutput + maia + + + _5_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/flow5.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/flow5.bpmn.svn-base new file mode 100644 index 0000000..8cfe5c7 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/flow5.bpmn.svn-base @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _A6E2F6C3-A1D2-4D92-BADD-480A070A0975_CommentInput + _A6E2F6C3-A1D2-4D92-BADD-480A070A0975_TaskNameInput + _A6E2F6C3-A1D2-4D92-BADD-480A070A0975_ContentInput + + + + + + _A6E2F6C3-A1D2-4D92-BADD-480A070A0975_CommentInput + + Prueba + _A6E2F6C3-A1D2-4D92-BADD-480A070A0975_CommentInput + + + + _A6E2F6C3-A1D2-4D92-BADD-480A070A0975_TaskNameInput + + Prueba + + _A6E2F6C3-A1D2-4D92-BADD-480A070A0975_TaskNameInput + + + + _A6E2F6C3-A1D2-4D92-BADD-480A070A0975_ContentInput + + Esta es una tarea + _A6E2F6C3-A1D2-4D92-BADD-480A070A0975_ContentInput + + + + + #{m.userId} + + + + + + + + + + + + + + + + + _10_countInput + + + _10_iOutput + + + + count + _10_countInput + + + _10_iOutput + i + + + + + + + + + + + return resultado.compareTo("OK")==0; + + + + + + + return resultado.compareTo("NO")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/instrumnovacion.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/instrumnovacion.bpmn.svn-base new file mode 100644 index 0000000..e494e77 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/instrumnovacion.bpmn.svn-base @@ -0,0 +1,744 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + + + _3_actualTaskOutput + _3_maiaOutput + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_actualTaskOutput + actualTask + + + _3_maiaOutput + maia + + + _3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _76_maiaInput + _76_taskMetaDataInput + + + _76_actualTaskOutput + _76_maiaOutput + _76_taskMetaDataOutput + + + + maia + _76_maiaInput + + + taskMetaData + _76_taskMetaDataInput + + + _76_actualTaskOutput + actualTask + + + _76_maiaOutput + maia + + + _76_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _77_maiaInput + _77_taskMetaDataInput + + + _77_actualTaskOutput + _77_maiaOutput + _77_taskMetaDataOutput + + + + maia + _77_maiaInput + + + taskMetaData + _77_taskMetaDataInput + + + _77_actualTaskOutput + actualTask + + + _77_maiaOutput + maia + + + _77_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _10_maiaInput + _10_taskMetaDataInput + + + _10_actualTaskOutput + _10_maiaOutput + _10_taskMetaDataOutput + + + + maia + _10_maiaInput + + + taskMetaData + _10_taskMetaDataInput + + + _10_actualTaskOutput + actualTask + + + _10_maiaOutput + maia + + + _10_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _12_maiaInput + _12_taskMetaDataInput + + + _12_actualTaskOutput + _12_maiaOutput + _12_taskMetaDataOutput + + + + maia + _12_maiaInput + + + taskMetaData + _12_taskMetaDataInput + + + _12_actualTaskOutput + actualTask + + + _12_maiaOutput + maia + + + _12_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _74_maiaInput + _74_taskMetaDataInput + + + _74_actualTaskOutput + _74_maiaOutput + _74_taskMetaDataOutput + + + + maia + _74_maiaInput + + + taskMetaData + _74_taskMetaDataInput + + + _74_actualTaskOutput + actualTask + + + _74_maiaOutput + maia + + + _74_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _85_maiaInput + _85_taskMetaDataInput + + + _85_actualTaskOutput + _85_maiaOutput + _85_taskMetaDataOutput + + + + maia + _85_maiaInput + + + taskMetaData + _85_taskMetaDataInput + + + _85_actualTaskOutput + actualTask + + + _85_maiaOutput + maia + + + _85_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _53_maiaInput + _53_taskMetaDataInput + + + _53_actualTaskOutput + _53_maiaOutput + _53_taskMetaDataOutput + + + + maia + _53_maiaInput + + + taskMetaData + _53_taskMetaDataInput + + + _53_actualTaskOutput + actualTask + + + _53_maiaOutput + maia + + + _53_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _52_maiaInput + _52_taskMetaDataInput + + + _52_actualTaskOutput + _52_maiaOutput + _52_taskMetaDataOutput + + + + maia + _52_maiaInput + + + taskMetaData + _52_taskMetaDataInput + + + _52_actualTaskOutput + actualTask + + + _52_maiaOutput + maia + + + _52_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + return ((String)maia.get("FINANCIALTYPE")).compareTo("F")==0; + + + + + + + + + return ((String)maia.get("FINANCIALTYPE")).compareTo("R")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/levantamientodefgar.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/levantamientodefgar.bpmn.svn-base new file mode 100644 index 0000000..c3ccd90 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/levantamientodefgar.bpmn.svn-base @@ -0,0 +1,753 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + + + _3_actualTaskOutput + _3_maiaOutput + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_actualTaskOutput + actualTask + + + _3_maiaOutput + maia + + + _3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _76_maiaInput + _76_taskMetaDataInput + + + _76_actualTaskOutput + _76_maiaOutput + _76_taskMetaDataOutput + + + + maia + _76_maiaInput + + + taskMetaData + _76_taskMetaDataInput + + + _76_actualTaskOutput + actualTask + + + _76_maiaOutput + maia + + + _76_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _77_maiaInput + _77_taskMetaDataInput + + + _77_actualTaskOutput + _77_maiaOutput + _77_taskMetaDataOutput + + + + maia + _77_maiaInput + + + taskMetaData + _77_taskMetaDataInput + + + _77_actualTaskOutput + actualTask + + + _77_maiaOutput + maia + + + _77_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _10_maiaInput + _10_taskMetaDataInput + + + _10_actualTaskOutput + _10_maiaOutput + _10_taskMetaDataOutput + + + + maia + _10_maiaInput + + + taskMetaData + _10_taskMetaDataInput + + + _10_actualTaskOutput + actualTask + + + _10_maiaOutput + maia + + + _10_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _12_maiaInput + _12_taskMetaDataInput + + + _12_actualTaskOutput + _12_maiaOutput + _12_taskMetaDataOutput + + + + maia + _12_maiaInput + + + taskMetaData + _12_taskMetaDataInput + + + _12_actualTaskOutput + actualTask + + + _12_maiaOutput + maia + + + _12_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _73_maiaInput + _73_taskMetaDataInput + + + _73_actualTaskOutput + _73_maiaOutput + _73_taskMetaDataOutput + + + + maia + _73_maiaInput + + + taskMetaData + _73_taskMetaDataInput + + + _73_actualTaskOutput + actualTask + + + _73_maiaOutput + maia + + + _73_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _74_maiaInput + _74_taskMetaDataInput + + + _74_actualTaskOutput + _74_maiaOutput + _74_taskMetaDataOutput + + + + maia + _74_maiaInput + + + taskMetaData + _74_taskMetaDataInput + + + _74_actualTaskOutput + actualTask + + + _74_maiaOutput + maia + + + _74_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _85_maiaInput + _85_taskMetaDataInput + + + _85_actualTaskOutput + _85_maiaOutput + _85_taskMetaDataOutput + + + + maia + _85_maiaInput + + + taskMetaData + _85_taskMetaDataInput + + + _85_actualTaskOutput + actualTask + + + _85_maiaOutput + maia + + + _85_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _53_maiaInput + _53_taskMetaDataInput + + + _53_actualTaskOutput + _53_maiaOutput + _53_taskMetaDataOutput + + + + maia + _53_maiaInput + + + taskMetaData + _53_taskMetaDataInput + + + _53_actualTaskOutput + actualTask + + + _53_maiaOutput + maia + + + _53_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _52_maiaInput + _52_taskMetaDataInput + + + _52_actualTaskOutput + _52_maiaOutput + _52_taskMetaDataOutput + + + + maia + _52_maiaInput + + + taskMetaData + _52_taskMetaDataInput + + + _52_actualTaskOutput + actualTask + + + _52_maiaOutput + maia + + + _52_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/levantamientopargar.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/levantamientopargar.bpmn.svn-base new file mode 100644 index 0000000..b87b973 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/levantamientopargar.bpmn.svn-base @@ -0,0 +1,937 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + + + _3_actualTaskOutput + _3_maiaOutput + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_actualTaskOutput + actualTask + + + _3_maiaOutput + maia + + + _3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + _76_maiaInput + _76_taskMetaDataInput + + + _76_actualTaskOutput + _76_maiaOutput + _76_taskMetaDataOutput + + + + maia + _76_maiaInput + + + taskMetaData + _76_taskMetaDataInput + + + _76_actualTaskOutput + actualTask + + + _76_maiaOutput + maia + + + _76_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _77_maiaInput + _77_taskMetaDataInput + + + _77_actualTaskOutput + _77_maiaOutput + _77_taskMetaDataOutput + + + + maia + _77_maiaInput + + + taskMetaData + _77_taskMetaDataInput + + + _77_actualTaskOutput + actualTask + + + _77_maiaOutput + maia + + + _77_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _10_maiaInput + _10_taskMetaDataInput + + + _10_actualTaskOutput + _10_maiaOutput + _10_taskMetaDataOutput + + + + maia + _10_maiaInput + + + taskMetaData + _10_taskMetaDataInput + + + _10_actualTaskOutput + actualTask + + + _10_maiaOutput + maia + + + _10_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _12_maiaInput + _12_taskMetaDataInput + + + _12_actualTaskOutput + _12_maiaOutput + _12_taskMetaDataOutput + + + + maia + _12_maiaInput + + + taskMetaData + _12_taskMetaDataInput + + + _12_actualTaskOutput + actualTask + + + _12_maiaOutput + maia + + + _12_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _73_maiaInput + _73_taskMetaDataInput + + + _73_actualTaskOutput + _73_maiaOutput + _73_taskMetaDataOutput + + + + maia + _73_maiaInput + + + taskMetaData + _73_taskMetaDataInput + + + _73_actualTaskOutput + actualTask + + + _73_maiaOutput + maia + + + _73_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _74_maiaInput + _74_taskMetaDataInput + + + _74_actualTaskOutput + _74_maiaOutput + _74_taskMetaDataOutput + + + + maia + _74_maiaInput + + + taskMetaData + _74_taskMetaDataInput + + + _74_actualTaskOutput + actualTask + + + _74_maiaOutput + maia + + + _74_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _53_maiaInput + _53_taskMetaDataInput + + + _53_actualTaskOutput + _53_maiaOutput + _53_taskMetaDataOutput + + + + maia + _53_maiaInput + + + taskMetaData + _53_taskMetaDataInput + + + _53_actualTaskOutput + actualTask + + + _53_maiaOutput + maia + + + _53_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _52_maiaInput + _52_taskMetaDataInput + + + _52_actualTaskOutput + _52_maiaOutput + _52_taskMetaDataOutput + + + + maia + _52_maiaInput + + + taskMetaData + _52_taskMetaDataInput + + + _52_actualTaskOutput + actualTask + + + _52_maiaOutput + maia + + + _52_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _93_maiaInput + _93_taskMetaDataInput + + + _93_actualTaskOutput + _93_maiaOutput + _93_taskMetaDataOutput + + + + maia + _93_maiaInput + + + taskMetaData + _93_taskMetaDataInput + + + _93_actualTaskOutput + actualTask + + + _93_maiaOutput + maia + + + _93_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _95_maiaInput + _95_taskMetaDataInput + + + _95_actualTaskOutput + _95_maiaOutput + _95_taskMetaDataOutput + + + + maia + _95_maiaInput + + + taskMetaData + _95_taskMetaDataInput + + + _95_actualTaskOutput + actualTask + + + _95_maiaOutput + maia + + + _95_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _94_maiaInput + _94_taskMetaDataInput + + + _94_actualTaskOutput + _94_maiaOutput + _94_taskMetaDataOutput + + + + maia + _94_maiaInput + + + taskMetaData + _94_taskMetaDataInput + + + _94_actualTaskOutput + actualTask + + + _94_maiaOutput + maia + + + _94_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/mapaBEV.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/mapaBEV.bpmn.svn-base new file mode 100644 index 0000000..20d52f2 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/mapaBEV.bpmn.svn-base @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + _2_tasksMetaDataInput + _2_maiaInput + + + _2_responseOutput + _2_tasksMetaDataOutput + _2_maiaOutput + + + + tasksMetaData + _2_tasksMetaDataInput + + + maia + _2_maiaInput + + + _2_responseOutput + response + + + _2_tasksMetaDataOutput + tasksMetaData + + + _2_maiaOutput + maia + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/matrizevaluacion.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/matrizevaluacion.bpmn.svn-base new file mode 100644 index 0000000..bc7d19f --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/matrizevaluacion.bpmn.svn-base @@ -0,0 +1,364 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + + + _3_actualTaskOutput + _3_maiaOutput + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_actualTaskOutput + actualTask + + + _3_maiaOutput + maia + + + _3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _23_maiaInput + _23_taskMetaDataInput + + + _23_actualTaskOutput + _23_maiaOutput + _23_taskMetaDataOutput + + + + maia + _23_maiaInput + + + taskMetaData + _23_taskMetaDataInput + + + _23_actualTaskOutput + actualTask + + + _23_maiaOutput + maia + + + _23_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _42_maiaInput + _42_taskMetaDataInput + + + _42_actualTaskOutput + _42_maiaOutput + _42_taskMetaDataOutput + + + + maia + _42_maiaInput + + + taskMetaData + _42_taskMetaDataInput + + + _42_actualTaskOutput + actualTask + + + _42_maiaOutput + maia + + + _42_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + _10_maiaInput + _10_taskMetaDataInput + + + _10_actualTaskOutput + _10_maiaOutput + _10_taskMetaDataOutput + + + + maia + _10_maiaInput + + + taskMetaData + _10_taskMetaDataInput + + + _10_actualTaskOutput + actualTask + + + _10_maiaOutput + maia + + + _10_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/n1.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/n1.bpmn.svn-base new file mode 100644 index 0000000..267b738 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/n1.bpmn.svn-base @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/n2.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/n2.bpmn.svn-base new file mode 100644 index 0000000..f161a5e --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/n2.bpmn.svn-base @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + return type.compareTo("N")==0; + + + return type.compareTo("N")!=0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/n3.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/n3.bpmn.svn-base new file mode 100644 index 0000000..d806499 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/n3.bpmn.svn-base @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/n4.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/n4.bpmn.svn-base new file mode 100644 index 0000000..570afc3 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/n4.bpmn.svn-base @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/nomenclatura.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/nomenclatura.bpmn.svn-base new file mode 100644 index 0000000..ded9f7c --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/nomenclatura.bpmn.svn-base @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/precalificacion.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/precalificacion.bpmn.svn-base new file mode 100644 index 0000000..b97a7c5 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/precalificacion.bpmn.svn-base @@ -0,0 +1,1097 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + + + _3_actualTaskOutput + _3_maiaOutput + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_actualTaskOutput + actualTask + + + _3_maiaOutput + maia + + + _3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + _10_maiaInput + _10_taskMetaDataInput + + + _10_actualTaskOutput + _10_maiaOutput + _10_taskMetaDataOutput + + + + maia + _10_maiaInput + + + taskMetaData + _10_taskMetaDataInput + + + _10_actualTaskOutput + actualTask + + + _10_maiaOutput + maia + + + _10_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _12_maiaInput + _12_taskMetaDataInput + + + _12_actualTaskOutput + _12_maiaOutput + _12_taskMetaDataOutput + + + + maia + _12_maiaInput + + + taskMetaData + _12_taskMetaDataInput + + + _12_actualTaskOutput + actualTask + + + _12_maiaOutput + maia + + + _12_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + _16_maiaInput + _16_taskMetaDataInput + + + _16_actualTaskOutput + _16_maiaOutput + _16_taskMetaDataOutput + + + + maia + _16_maiaInput + + + taskMetaData + _16_taskMetaDataInput + + + _16_actualTaskOutput + actualTask + + + _16_maiaOutput + maia + + + _16_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + _18_tasksMetaDataInput + _18_maiaInput + + + _18_actualTaskOutput + _18_maiaOutput + _18_taskMetaDataOutput + + + + tasksMetaData + _18_tasksMetaDataInput + + + maia + _18_maiaInput + + + _18_actualTaskOutput + actualTask + + + _18_maiaOutput + maia + + + _18_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _23_maiaInput + _23_taskMetaDataInput + + + _23_actualTaskOutput + _23_maiaOutput + _23_taskMetaDataOutput + + + + maia + _23_maiaInput + + + taskMetaData + _23_taskMetaDataInput + + + _23_actualTaskOutput + actualTask + + + _23_maiaOutput + maia + + + _23_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _22_maiaInput + _22_taskMetaDataInput + + + _22_actualTaskOutput + _22_maiaOutput + _22_taskMetaDataOutput + + + + maia + _22_maiaInput + + + taskMetaData + _22_taskMetaDataInput + + + _22_actualTaskOutput + actualTask + + + _22_maiaOutput + maia + + + _22_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + _29_maiaInput + _29_taskMetaDataInput + + + _29_actualTaskOutput + _29_maiaOutput + _29_taskMetaDataOutput + + + + maia + _29_maiaInput + + + taskMetaData + _29_taskMetaDataInput + + + _29_actualTaskOutput + actualTask + + + _29_maiaOutput + maia + + + _29_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _28_maiaInput + _28_taskMetaDataInput + + + _28_actualTaskOutput + _28_maiaOutput + _28_taskMetaDataOutput + + + + maia + _28_maiaInput + + + taskMetaData + _28_taskMetaDataInput + + + _28_actualTaskOutput + actualTask + + + _28_maiaOutput + maia + + + _28_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _31_maiaInput + _31_taskMetaDataInput + + + _31_actualTaskOutput + _31_maiaOutput + _31_taskMetaDataOutput + + + + maia + _31_maiaInput + + + taskMetaData + _31_taskMetaDataInput + + + _31_actualTaskOutput + actualTask + + + _31_maiaOutput + maia + + + _31_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _30_maiaInput + _30_taskMetaDataInput + + + _30_actualTaskOutput + _30_maiaOutput + _30_taskMetaDataOutput + + + + maia + _30_maiaInput + + + taskMetaData + _30_taskMetaDataInput + + + _30_actualTaskOutput + actualTask + + + _30_maiaOutput + maia + + + _30_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _52_maiaInput + _52_taskMetaDataInput + + + _52_actualTaskOutput + _52_maiaOutput + _52_taskMetaDataOutput + + + + maia + _52_maiaInput + + + taskMetaData + _52_taskMetaDataInput + + + _52_actualTaskOutput + actualTask + + + _52_maiaOutput + maia + + + _52_taskMetaDataOutput + taskMetaData + + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + return ((String)maia.get("REQ_REC_OBS")).compareTo("Y")!=0; + + + + + + + + return ((String)maia.get("lettertype")).compareTo("O")==0; + + + return ((String)maia.get("lettertype")).compareTo("N")==0; + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + return ((String)maia.get("lettertype")).compareTo("O")==0; + + + + + return ((String)maia.get("midbonus")).compareTo("N")!=0; + + + return ((String)maia.get("lettertype")).compareTo("I")==0; + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + return ((String)maia.get("REQ_REV_OBS")).compareTo("Y")==0; + + + + + return ((String)maia.get("REQ_REV_OBS")).compareTo("Y")!=0; + + + + return ((String)maia.get("REQ_REC_OBS")).compareTo("Y")==0; + + + + + + + + + + + return ((String)maia.get("lettertype")).compareTo("O")!=0; + + + + return ((String)maia.get("midbonus")).compareTo("N")==0; + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/seguimientoycontrol.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/seguimientoycontrol.bpmn.svn-base new file mode 100644 index 0000000..97c6535 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/seguimientoycontrol.bpmn.svn-base @@ -0,0 +1,1632 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _70_maiaInput + _70_taskMetaDataInput + + + _70_actualTaskOutput + _70_maiaOutput + _70_taskMetaDataOutput + + + + maia + _70_maiaInput + + + taskMetaData + _70_taskMetaDataInput + + + _70_actualTaskOutput + actualTask + + + _70_maiaOutput + maia + + + _70_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + + + _3_actualTaskOutput + _3_maiaOutput + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_actualTaskOutput + actualTask + + + _3_maiaOutput + maia + + + _3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _71_maiaInput + _71_taskMetaDataInput + + + _71_actualTaskOutput + _71_maiaOutput + _71_taskMetaDataOutput + + + + maia + _71_maiaInput + + + taskMetaData + _71_taskMetaDataInput + + + _71_actualTaskOutput + actualTask + + + _71_maiaOutput + maia + + + _71_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + _64_maiaInput + _64_taskMetaDataInput + + + _64_actualTaskOutput + _64_maiaOutput + _64_taskMetaDataOutput + + + + maia + _64_maiaInput + + + taskMetaData + _64_taskMetaDataInput + + + _64_actualTaskOutput + actualTask + + + _64_maiaOutput + maia + + + _64_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _65_maiaInput + _65_taskMetaDataInput + + + _65_actualTaskOutput + _65_maiaOutput + _65_taskMetaDataOutput + + + + maia + _65_maiaInput + + + taskMetaData + _65_taskMetaDataInput + + + _65_actualTaskOutput + actualTask + + + _65_maiaOutput + maia + + + _65_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _66_maiaInput + _66_taskMetaDataInput + + + _66_actualTaskOutput + _66_maiaOutput + _66_taskMetaDataOutput + + + + maia + _66_maiaInput + + + taskMetaData + _66_taskMetaDataInput + + + _66_actualTaskOutput + actualTask + + + _66_maiaOutput + maia + + + _66_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + _10_maiaInput + _10_taskMetaDataInput + + + _10_actualTaskOutput + _10_maiaOutput + _10_taskMetaDataOutput + + + + maia + _10_maiaInput + + + taskMetaData + _10_taskMetaDataInput + + + _10_actualTaskOutput + actualTask + + + _10_maiaOutput + maia + + + _10_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _72_maiaInput + _72_taskMetaDataInput + + + _72_actualTaskOutput + _72_maiaOutput + _72_taskMetaDataOutput + + + + maia + _72_maiaInput + + + taskMetaData + _72_taskMetaDataInput + + + _72_actualTaskOutput + actualTask + + + _72_maiaOutput + maia + + + _72_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _12_maiaInput + _12_taskMetaDataInput + + + _12_actualTaskOutput + _12_maiaOutput + _12_taskMetaDataOutput + + + + maia + _12_maiaInput + + + taskMetaData + _12_taskMetaDataInput + + + _12_actualTaskOutput + actualTask + + + _12_maiaOutput + maia + + + _12_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + _75_maiaInput + _75_taskMetaDataInput + + + _75_actualTaskOutput + _75_maiaOutput + _75_taskMetaDataOutput + + + + maia + _75_maiaInput + + + taskMetaData + _75_taskMetaDataInput + + + _75_actualTaskOutput + actualTask + + + _75_maiaOutput + maia + + + _75_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _16_maiaInput + _16_taskMetaDataInput + + + _16_actualTaskOutput + _16_maiaOutput + _16_taskMetaDataOutput + + + + maia + _16_maiaInput + + + taskMetaData + _16_taskMetaDataInput + + + _16_actualTaskOutput + actualTask + + + _16_maiaOutput + maia + + + _16_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + _18_tasksMetaDataInput + _18_maiaInput + + + _18_actualTaskOutput + _18_maiaOutput + _18_taskMetaDataOutput + + + + tasksMetaData + _18_tasksMetaDataInput + + + maia + _18_maiaInput + + + _18_actualTaskOutput + actualTask + + + _18_maiaOutput + maia + + + _18_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + _23_maiaInput + _23_taskMetaDataInput + + + _23_actualTaskOutput + _23_maiaOutput + _23_taskMetaDataOutput + + + + maia + _23_maiaInput + + + taskMetaData + _23_taskMetaDataInput + + + _23_actualTaskOutput + actualTask + + + _23_maiaOutput + maia + + + _23_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _22_maiaInput + _22_taskMetaDataInput + + + _22_actualTaskOutput + _22_maiaOutput + _22_taskMetaDataOutput + + + + maia + _22_maiaInput + + + taskMetaData + _22_taskMetaDataInput + + + _22_actualTaskOutput + actualTask + + + _22_maiaOutput + maia + + + _22_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _29_maiaInput + _29_taskMetaDataInput + + + _29_actualTaskOutput + _29_maiaOutput + _29_taskMetaDataOutput + + + + maia + _29_maiaInput + + + taskMetaData + _29_taskMetaDataInput + + + _29_actualTaskOutput + actualTask + + + _29_maiaOutput + maia + + + _29_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _28_maiaInput + _28_taskMetaDataInput + + + _28_actualTaskOutput + _28_maiaOutput + _28_taskMetaDataOutput + + + + maia + _28_maiaInput + + + taskMetaData + _28_taskMetaDataInput + + + _28_actualTaskOutput + actualTask + + + _28_maiaOutput + maia + + + _28_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + _31_maiaInput + _31_taskMetaDataInput + + + _31_actualTaskOutput + _31_maiaOutput + _31_taskMetaDataOutput + + + + maia + _31_maiaInput + + + taskMetaData + _31_taskMetaDataInput + + + _31_actualTaskOutput + actualTask + + + _31_maiaOutput + maia + + + _31_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _30_maiaInput + _30_taskMetaDataInput + + + _30_actualTaskOutput + _30_maiaOutput + _30_taskMetaDataOutput + + + + maia + _30_maiaInput + + + taskMetaData + _30_taskMetaDataInput + + + _30_actualTaskOutput + actualTask + + + _30_maiaOutput + maia + + + _30_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _52_maiaInput + _52_taskMetaDataInput + + + _52_actualTaskOutput + _52_maiaOutput + _52_taskMetaDataOutput + + + + maia + _52_maiaInput + + + taskMetaData + _52_taskMetaDataInput + + + _52_actualTaskOutput + actualTask + + + _52_maiaOutput + maia + + + _52_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + _60_maiaInput + _60_taskMetaDataInput + + + _60_actualTaskOutput + _60_maiaOutput + _60_taskMetaDataOutput + + + + maia + _60_maiaInput + + + taskMetaData + _60_taskMetaDataInput + + + _60_actualTaskOutput + actualTask + + + _60_maiaOutput + maia + + + _60_taskMetaDataOutput + taskMetaData + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + + + return ((String)maia.get("CONSTRUCCION")).compareTo("Y")!=0; + + + + + return ((String)maia.get("NOVACIONOK")).compareTo("Y")==0; + + + + + + return ((String)maia.get("NOVACIONOK")).compareTo("N")==0; + + + + return ((String)maia.get("CALIFICA")).compareTo("N")==0; + + + return ((String)maia.get("PLAZOFIN")).compareTo("Y")!=0; + + + return ((String)maia.get("CONSTRUCCION")).compareTo("Y")==0; + + + return ((String)maia.get("DESVIACION")).compareTo("Y")==0; + + + return ((String)maia.get("RETRASO")).compareTo("Y")==0; + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + + + return ((String)maia.get("PLAZOFIN")).compareTo("Y")==0; + + + + + return ((String)maia.get("OBRACONCLUIDA")).compareTo("Y")==0; + + + return ((String)maia.get("DECISION")).compareTo("G")==0; + + + + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + return ((String)maia.get("DECISION")).compareTo("N")==0; + + + + + + + + + + + + return ((String)maia.get("DESVIACION")).compareTo("Y")!=0; + + + + + + + return ((String)maia.get("OBRACONCLUIDA")).compareTo("N")==0; + + + + + + + + return ((String)maia.get("CALIFICA")).compareTo("Y")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/taskasign.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/taskasign.bpmn.svn-base new file mode 100644 index 0000000..15eccd6 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/taskasign.bpmn.svn-base @@ -0,0 +1,279 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + _3_SkippableInput + _3_TaskNameInput + _3_GroupIdInput + + + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_SkippableInput + + false + _3_SkippableInput + + + + _3_TaskNameInput + + #{maia.request.subject} + _3_TaskNameInput + + + + _3_GroupIdInput + + #{taskMetaData.groupId} + _3_GroupIdInput + + + + _3_taskMetaDataOutput + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + return "A".equals(taskMetaData.getAction()); + + + + return !("A".equals(taskMetaData.getAction())); + + + return taskMetaData.getResponse().compareTo("R")!=0; + + + + return taskMetaData.getResponse().compareTo("R")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/test.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/test.bpmn.svn-base new file mode 100644 index 0000000..7d6dbef --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/test.bpmn.svn-base @@ -0,0 +1,267 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + _3_SkippableInput + _3_TaskNameInput + _3_GroupIdInput + + + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_SkippableInput + + false + _3_SkippableInput + + + + _3_TaskNameInput + + #{maia.request.subject} + _3_TaskNameInput + + + + _3_GroupIdInput + + #{taskMetaData.groupId} + _3_GroupIdInput + + + + _3_taskMetaDataOutput + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + return "A".equals(taskMetaData.getAction()); + + + + return !("A".equals(taskMetaData.getAction())); + + + return taskMetaData.getResponse().compareTo("R")!=0; + + + + return taskMetaData.getResponse().compareTo("R")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/.svn/text-base/testwpa.bpmn.svn-base b/base/bpm/flows/src/flows/flows/.svn/text-base/testwpa.bpmn.svn-base new file mode 100644 index 0000000..e17e776 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/.svn/text-base/testwpa.bpmn.svn-base @@ -0,0 +1,292 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _17_maiaInput + _17_taskMetaDataInput + + + _17_actualTaskOutput + _17_maiaOutput + _17_taskMetaDataOutput + + + + maia + _17_maiaInput + + + taskMetaData + _17_taskMetaDataInput + + + _17_actualTaskOutput + actualTask + + + _17_maiaOutput + maia + + + _17_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + _21_maiaInput + _21_taskMetaDataInput + + + _21_actualTaskOutput + _21_maiaOutput + _21_taskMetaDataOutput + + + + maia + _21_maiaInput + + + taskMetaData + _21_taskMetaDataInput + + + _21_actualTaskOutput + actualTask + + + _21_maiaOutput + maia + + + _21_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _5_maiaInput + _5_taskMetaDataInput + + + _5_actualTaskOutput + _5_maiaOutput + _5_taskMetaDataOutput + + + + maia + _5_maiaInput + + + taskMetaData + _5_taskMetaDataInput + + + _5_actualTaskOutput + actualTask + + + _5_maiaOutput + maia + + + _5_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + System.out.println("AAAAA"+maia); +return (((String)maia.get("transaction")).compareTo("23")==0); + + + + System.out.println("BBBBB"+maia); +return (((String)maia.get("transaction")).compareTo("21")==0); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/Looping.bpmn b/base/bpm/flows/src/flows/flows/Looping.bpmn new file mode 100644 index 0000000..fa00a54 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/Looping.bpmn @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + return Long.valueOf(""+i) < Long.valueOf(""+count); + + + + + + return true; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/ampliacionperiodogracia.bpmn b/base/bpm/flows/src/flows/flows/ampliacionperiodogracia.bpmn new file mode 100644 index 0000000..6e7cfea --- /dev/null +++ b/base/bpm/flows/src/flows/flows/ampliacionperiodogracia.bpmn @@ -0,0 +1,897 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + + + _3_actualTaskOutput + _3_maiaOutput + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_actualTaskOutput + actualTask + + + _3_maiaOutput + maia + + + _3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _110_maiaInput + _110_taskMetaDataInput + + + _110_actualTaskOutput + _110_maiaOutput + _110_taskMetaDataOutput + + + + maia + _110_maiaInput + + + taskMetaData + _110_taskMetaDataInput + + + _110_actualTaskOutput + actualTask + + + _110_maiaOutput + maia + + + _110_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _76_maiaInput + _76_taskMetaDataInput + + + _76_actualTaskOutput + _76_maiaOutput + _76_taskMetaDataOutput + + + + maia + _76_maiaInput + + + taskMetaData + _76_taskMetaDataInput + + + _76_actualTaskOutput + actualTask + + + _76_maiaOutput + maia + + + _76_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _111_maiaInput + _111_taskMetaDataInput + + + _111_actualTaskOutput + _111_maiaOutput + _111_taskMetaDataOutput + + + + maia + _111_maiaInput + + + taskMetaData + _111_taskMetaDataInput + + + _111_actualTaskOutput + actualTask + + + _111_maiaOutput + maia + + + _111_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + _10_maiaInput + _10_taskMetaDataInput + + + _10_actualTaskOutput + _10_maiaOutput + _10_taskMetaDataOutput + + + + maia + _10_maiaInput + + + taskMetaData + _10_taskMetaDataInput + + + _10_actualTaskOutput + actualTask + + + _10_maiaOutput + maia + + + _10_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + _12_maiaInput + _12_taskMetaDataInput + + + _12_actualTaskOutput + _12_maiaOutput + _12_taskMetaDataOutput + + + + maia + _12_maiaInput + + + taskMetaData + _12_taskMetaDataInput + + + _12_actualTaskOutput + actualTask + + + _12_maiaOutput + maia + + + _12_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _85_maiaInput + _85_taskMetaDataInput + + + _85_actualTaskOutput + _85_maiaOutput + _85_taskMetaDataOutput + + + + maia + _85_maiaInput + + + taskMetaData + _85_taskMetaDataInput + + + _85_actualTaskOutput + actualTask + + + _85_maiaOutput + maia + + + _85_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + _53_maiaInput + _53_taskMetaDataInput + + + _53_actualTaskOutput + _53_maiaOutput + _53_taskMetaDataOutput + + + + maia + _53_maiaInput + + + taskMetaData + _53_taskMetaDataInput + + + _53_actualTaskOutput + actualTask + + + _53_maiaOutput + maia + + + _53_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _112_maiaInput + _112_taskMetaDataInput + + + _112_actualTaskOutput + _112_maiaOutput + _112_taskMetaDataOutput + + + + maia + _112_maiaInput + + + taskMetaData + _112_taskMetaDataInput + + + _112_actualTaskOutput + actualTask + + + _112_maiaOutput + maia + + + _112_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _52_maiaInput + _52_taskMetaDataInput + + + _52_actualTaskOutput + _52_maiaOutput + _52_taskMetaDataOutput + + + + maia + _52_maiaInput + + + taskMetaData + _52_taskMetaDataInput + + + _52_actualTaskOutput + actualTask + + + _52_maiaOutput + maia + + + _52_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _31_maiaInput + _31_taskMetaDataInput + + + _31_actualTaskOutput + _31_maiaOutput + _31_taskMetaDataOutput + + + + maia + _31_maiaInput + + + taskMetaData + _31_taskMetaDataInput + + + _31_actualTaskOutput + actualTask + + + _31_maiaOutput + maia + + + _31_taskMetaDataOutput + taskMetaData + + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/aprobacioncredito.bpmn b/base/bpm/flows/src/flows/flows/aprobacioncredito.bpmn new file mode 100644 index 0000000..3f06553 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/aprobacioncredito.bpmn @@ -0,0 +1,1136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + + + _3_actualTaskOutput + _3_maiaOutput + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_actualTaskOutput + actualTask + + + _3_maiaOutput + maia + + + _3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _76_maiaInput + _76_taskMetaDataInput + + + _76_actualTaskOutput + _76_maiaOutput + _76_taskMetaDataOutput + + + + maia + _76_maiaInput + + + taskMetaData + _76_taskMetaDataInput + + + _76_actualTaskOutput + actualTask + + + _76_maiaOutput + maia + + + _76_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _77_maiaInput + _77_taskMetaDataInput + + + _77_actualTaskOutput + _77_maiaOutput + _77_taskMetaDataOutput + + + + maia + _77_maiaInput + + + taskMetaData + _77_taskMetaDataInput + + + _77_actualTaskOutput + actualTask + + + _77_maiaOutput + maia + + + _77_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _10_maiaInput + _10_taskMetaDataInput + + + _10_actualTaskOutput + _10_maiaOutput + _10_taskMetaDataOutput + + + + maia + _10_maiaInput + + + taskMetaData + _10_taskMetaDataInput + + + _10_actualTaskOutput + actualTask + + + _10_maiaOutput + maia + + + _10_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + _12_maiaInput + _12_taskMetaDataInput + + + _12_actualTaskOutput + _12_maiaOutput + _12_taskMetaDataOutput + + + + maia + _12_maiaInput + + + taskMetaData + _12_taskMetaDataInput + + + _12_actualTaskOutput + actualTask + + + _12_maiaOutput + maia + + + _12_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _73_maiaInput + _73_taskMetaDataInput + + + _73_actualTaskOutput + _73_maiaOutput + _73_taskMetaDataOutput + + + + maia + _73_maiaInput + + + taskMetaData + _73_taskMetaDataInput + + + _73_actualTaskOutput + actualTask + + + _73_maiaOutput + maia + + + _73_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _74_maiaInput + _74_taskMetaDataInput + + + _74_actualTaskOutput + _74_maiaOutput + _74_taskMetaDataOutput + + + + maia + _74_maiaInput + + + taskMetaData + _74_taskMetaDataInput + + + _74_actualTaskOutput + actualTask + + + _74_maiaOutput + maia + + + _74_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _85_maiaInput + _85_taskMetaDataInput + + + _85_actualTaskOutput + _85_maiaOutput + _85_taskMetaDataOutput + + + + maia + _85_maiaInput + + + taskMetaData + _85_taskMetaDataInput + + + _85_actualTaskOutput + actualTask + + + _85_maiaOutput + maia + + + _85_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _28_maiaInput + _28_taskMetaDataInput + + + _28_actualTaskOutput + _28_maiaOutput + _28_taskMetaDataOutput + + + + maia + _28_maiaInput + + + taskMetaData + _28_taskMetaDataInput + + + _28_actualTaskOutput + actualTask + + + _28_maiaOutput + maia + + + _28_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + _31_maiaInput + _31_taskMetaDataInput + + + _31_actualTaskOutput + _31_maiaOutput + _31_taskMetaDataOutput + + + + maia + _31_maiaInput + + + taskMetaData + _31_taskMetaDataInput + + + _31_actualTaskOutput + actualTask + + + _31_maiaOutput + maia + + + _31_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + _54_maiaInput + _54_taskMetaDataInput + + + _54_actualTaskOutput + _54_maiaOutput + _54_taskMetaDataOutput + + + + maia + _54_maiaInput + + + taskMetaData + _54_taskMetaDataInput + + + _54_actualTaskOutput + actualTask + + + _54_maiaOutput + maia + + + _54_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _53_maiaInput + _53_taskMetaDataInput + + + _53_actualTaskOutput + _53_maiaOutput + _53_taskMetaDataOutput + + + + maia + _53_maiaInput + + + taskMetaData + _53_taskMetaDataInput + + + _53_actualTaskOutput + actualTask + + + _53_maiaOutput + maia + + + _53_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _52_maiaInput + _52_taskMetaDataInput + + + _52_actualTaskOutput + _52_maiaOutput + _52_taskMetaDataOutput + + + + maia + _52_maiaInput + + + taskMetaData + _52_taskMetaDataInput + + + _52_actualTaskOutput + actualTask + + + _52_maiaOutput + maia + + + _52_taskMetaDataOutput + taskMetaData + + + + + + + + + return ((String)maia.get("RECEIVER")).compareTo("C")==0; + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + return ((String)maia.get("midbonus")).compareTo("N")==0; + + + + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + return ((String)maia.get("midbonus")).compareTo("N")!=0; + + + + return ((String)maia.get("RECEIVER")).compareTo("D")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/aprobacioncreditonova.bpmn b/base/bpm/flows/src/flows/flows/aprobacioncreditonova.bpmn new file mode 100644 index 0000000..28493f9 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/aprobacioncreditonova.bpmn @@ -0,0 +1,728 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + + + _3_actualTaskOutput + _3_maiaOutput + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_actualTaskOutput + actualTask + + + _3_maiaOutput + maia + + + _3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _76_maiaInput + _76_taskMetaDataInput + + + _76_actualTaskOutput + _76_maiaOutput + _76_taskMetaDataOutput + + + + maia + _76_maiaInput + + + taskMetaData + _76_taskMetaDataInput + + + _76_actualTaskOutput + actualTask + + + _76_maiaOutput + maia + + + _76_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + _10_maiaInput + _10_taskMetaDataInput + + + _10_actualTaskOutput + _10_maiaOutput + _10_taskMetaDataOutput + + + + maia + _10_maiaInput + + + taskMetaData + _10_taskMetaDataInput + + + _10_actualTaskOutput + actualTask + + + _10_maiaOutput + maia + + + _10_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + _12_maiaInput + _12_taskMetaDataInput + + + _12_actualTaskOutput + _12_maiaOutput + _12_taskMetaDataOutput + + + + maia + _12_maiaInput + + + taskMetaData + _12_taskMetaDataInput + + + _12_actualTaskOutput + actualTask + + + _12_maiaOutput + maia + + + _12_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + _85_maiaInput + _85_taskMetaDataInput + + + _85_actualTaskOutput + _85_maiaOutput + _85_taskMetaDataOutput + + + + maia + _85_maiaInput + + + taskMetaData + _85_taskMetaDataInput + + + _85_actualTaskOutput + actualTask + + + _85_maiaOutput + maia + + + _85_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + _53_maiaInput + _53_taskMetaDataInput + + + _53_actualTaskOutput + _53_maiaOutput + _53_taskMetaDataOutput + + + + maia + _53_maiaInput + + + taskMetaData + _53_taskMetaDataInput + + + _53_actualTaskOutput + actualTask + + + _53_maiaOutput + maia + + + _53_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _52_maiaInput + _52_taskMetaDataInput + + + _52_actualTaskOutput + _52_maiaOutput + _52_taskMetaDataOutput + + + + maia + _52_maiaInput + + + taskMetaData + _52_taskMetaDataInput + + + _52_actualTaskOutput + actualTask + + + _52_maiaOutput + maia + + + _52_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + _31_maiaInput + _31_taskMetaDataInput + + + _31_actualTaskOutput + _31_maiaOutput + _31_taskMetaDataOutput + + + + maia + _31_maiaInput + + + taskMetaData + _31_taskMetaDataInput + + + _31_actualTaskOutput + actualTask + + + _31_maiaOutput + maia + + + _31_taskMetaDataOutput + taskMetaData + + + + + + + + return ((String)maia.get("RECEIVER")).compareTo("C")==0; + + + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + + + + + + + + + + return ((String)maia.get("RECEIVER")).compareTo("D")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/basic.bpmn b/base/bpm/flows/src/flows/flows/basic.bpmn new file mode 100644 index 0000000..eca0e92 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/basic.bpmn @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _5_maiaInput + _5_taskMetaDataInput + + + _5_actualTaskOutput + _5_maiaOutput + _5_taskMetaDataOutput + + + + maia + _5_maiaInput + + + taskMetaData + _5_taskMetaDataInput + + + _5_actualTaskOutput + actualTask + + + _5_maiaOutput + maia + + + _5_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/basic1.bpmn b/base/bpm/flows/src/flows/flows/basic1.bpmn new file mode 100644 index 0000000..c9909ea --- /dev/null +++ b/base/bpm/flows/src/flows/flows/basic1.bpmn @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _5_maiaInput + _5_taskMetaDataInput + + + _5_actualTaskOutput + _5_maiaOutput + _5_taskMetaDataOutput + + + + maia + _5_maiaInput + + + taskMetaData + _5_taskMetaDataInput + + + _5_actualTaskOutput + actualTask + + + _5_maiaOutput + maia + + + _5_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/base/bpm/flows/src/flows/flows/calificacion.bpmn b/base/bpm/flows/src/flows/flows/calificacion.bpmn new file mode 100644 index 0000000..586ee01 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/calificacion.bpmn @@ -0,0 +1,1790 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _69_maiaInput + _69_taskMetaDataInput + + + _69_actualTaskOutput + _69_maiaOutput + _69_taskMetaDataOutput + + + + maia + _69_maiaInput + + + taskMetaData + _69_taskMetaDataInput + + + _69_actualTaskOutput + actualTask + + + _69_maiaOutput + maia + + + _69_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + _71_maiaInput + _71_taskMetaDataInput + + + _71_actualTaskOutput + _71_maiaOutput + _71_taskMetaDataOutput + + + + maia + _71_maiaInput + + + taskMetaData + _71_taskMetaDataInput + + + _71_actualTaskOutput + actualTask + + + _71_maiaOutput + maia + + + _71_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + + + _3_actualTaskOutput + _3_maiaOutput + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_actualTaskOutput + actualTask + + + _3_maiaOutput + maia + + + _3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + _76_maiaInput + _76_taskMetaDataInput + + + _76_actualTaskOutput + _76_maiaOutput + _76_taskMetaDataOutput + + + + maia + _76_maiaInput + + + taskMetaData + _76_taskMetaDataInput + + + _76_actualTaskOutput + actualTask + + + _76_maiaOutput + maia + + + _76_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + _77_maiaInput + _77_taskMetaDataInput + + + _77_actualTaskOutput + _77_maiaOutput + _77_taskMetaDataOutput + + + + maia + _77_maiaInput + + + taskMetaData + _77_taskMetaDataInput + + + _77_actualTaskOutput + actualTask + + + _77_maiaOutput + maia + + + _77_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _78_maiaInput + _78_taskMetaDataInput + + + _78_actualTaskOutput + _78_maiaOutput + _78_taskMetaDataOutput + + + + maia + _78_maiaInput + + + taskMetaData + _78_taskMetaDataInput + + + _78_actualTaskOutput + actualTask + + + _78_maiaOutput + maia + + + _78_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _10_maiaInput + _10_taskMetaDataInput + + + _10_actualTaskOutput + _10_maiaOutput + _10_taskMetaDataOutput + + + + maia + _10_maiaInput + + + taskMetaData + _10_taskMetaDataInput + + + _10_actualTaskOutput + actualTask + + + _10_maiaOutput + maia + + + _10_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + _72_maiaInput + _72_taskMetaDataInput + + + _72_actualTaskOutput + _72_maiaOutput + _72_taskMetaDataOutput + + + + maia + _72_maiaInput + + + taskMetaData + _72_taskMetaDataInput + + + _72_actualTaskOutput + actualTask + + + _72_maiaOutput + maia + + + _72_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _12_maiaInput + _12_taskMetaDataInput + + + _12_actualTaskOutput + _12_maiaOutput + _12_taskMetaDataOutput + + + + maia + _12_maiaInput + + + taskMetaData + _12_taskMetaDataInput + + + _12_actualTaskOutput + actualTask + + + _12_maiaOutput + maia + + + _12_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _73_maiaInput + _73_taskMetaDataInput + + + _73_actualTaskOutput + _73_maiaOutput + _73_taskMetaDataOutput + + + + maia + _73_maiaInput + + + taskMetaData + _73_taskMetaDataInput + + + _73_actualTaskOutput + actualTask + + + _73_maiaOutput + maia + + + _73_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _74_maiaInput + _74_taskMetaDataInput + + + _74_actualTaskOutput + _74_maiaOutput + _74_taskMetaDataOutput + + + + maia + _74_maiaInput + + + taskMetaData + _74_taskMetaDataInput + + + _74_actualTaskOutput + actualTask + + + _74_maiaOutput + maia + + + _74_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + _16_maiaInput + _16_taskMetaDataInput + + + _16_actualTaskOutput + _16_maiaOutput + _16_taskMetaDataOutput + + + + maia + _16_maiaInput + + + taskMetaData + _16_taskMetaDataInput + + + _16_actualTaskOutput + actualTask + + + _16_maiaOutput + maia + + + _16_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _18_maiaInput + _18_taskMetaDataInput + + + _18_actualTaskOutput + _18_maiaOutput + _18_taskMetaDataOutput + + + + maia + _18_maiaInput + + + taskMetaData + _18_taskMetaDataInput + + + _18_actualTaskOutput + actualTask + + + _18_maiaOutput + maia + + + _18_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + _23_maiaInput + _23_taskMetaDataInput + + + _23_actualTaskOutput + _23_maiaOutput + _23_taskMetaDataOutput + + + + maia + _23_maiaInput + + + taskMetaData + _23_taskMetaDataInput + + + _23_actualTaskOutput + actualTask + + + _23_maiaOutput + maia + + + _23_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _22_maiaInput + _22_taskMetaDataInput + + + _22_actualTaskOutput + _22_maiaOutput + _22_taskMetaDataOutput + + + + maia + _22_maiaInput + + + taskMetaData + _22_taskMetaDataInput + + + _22_actualTaskOutput + actualTask + + + _22_maiaOutput + maia + + + _22_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _29_maiaInput + _29_taskMetaDataInput + + + _29_actualTaskOutput + _29_maiaOutput + _29_taskMetaDataOutput + + + + maia + _29_maiaInput + + + taskMetaData + _29_taskMetaDataInput + + + _29_actualTaskOutput + actualTask + + + _29_maiaOutput + maia + + + _29_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _28_maiaInput + _28_taskMetaDataInput + + + _28_actualTaskOutput + _28_maiaOutput + _28_taskMetaDataOutput + + + + maia + _28_maiaInput + + + taskMetaData + _28_taskMetaDataInput + + + _28_actualTaskOutput + actualTask + + + _28_maiaOutput + maia + + + _28_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _31_maiaInput + _31_taskMetaDataInput + + + _31_actualTaskOutput + _31_maiaOutput + _31_taskMetaDataOutput + + + + maia + _31_maiaInput + + + taskMetaData + _31_taskMetaDataInput + + + _31_actualTaskOutput + actualTask + + + _31_maiaOutput + maia + + + _31_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _30_maiaInput + _30_taskMetaDataInput + + + _30_actualTaskOutput + _30_maiaOutput + _30_taskMetaDataOutput + + + + maia + _30_maiaInput + + + taskMetaData + _30_taskMetaDataInput + + + _30_actualTaskOutput + actualTask + + + _30_maiaOutput + maia + + + _30_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + _54_maiaInput + _54_taskMetaDataInput + + + _54_actualTaskOutput + _54_maiaOutput + _54_taskMetaDataOutput + + + + maia + _54_maiaInput + + + taskMetaData + _54_taskMetaDataInput + + + _54_actualTaskOutput + actualTask + + + _54_maiaOutput + maia + + + _54_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _53_maiaInput + _53_taskMetaDataInput + + + _53_actualTaskOutput + _53_maiaOutput + _53_taskMetaDataOutput + + + + maia + _53_maiaInput + + + taskMetaData + _53_taskMetaDataInput + + + _53_actualTaskOutput + actualTask + + + _53_maiaOutput + maia + + + _53_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _52_maiaInput + _52_taskMetaDataInput + + + _52_actualTaskOutput + _52_maiaOutput + _52_taskMetaDataOutput + + + + maia + _52_maiaInput + + + taskMetaData + _52_taskMetaDataInput + + + _52_actualTaskOutput + actualTask + + + _52_maiaOutput + maia + + + _52_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _57_maiaInput + _57_taskMetaDataInput + + + _57_actualTaskOutput + _57_maiaOutput + _57_taskMetaDataOutput + + + + maia + _57_maiaInput + + + taskMetaData + _57_taskMetaDataInput + + + _57_actualTaskOutput + actualTask + + + _57_maiaOutput + maia + + + _57_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + return ((String)maia.get("REQ_REC_OBS")).compareTo("Y")!=0; + + + + + + + + + + + + return ((String)maia.get("proyectoviable")).compareTo("N")==0; + + + return ((String)maia.get("proyectoviable")).compareTo("N")!=0; + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + return ((String)maia.get("REQ_REC_OBS")).compareTo("Y")==0; + + + + + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/calificacionnovacion.bpmn b/base/bpm/flows/src/flows/flows/calificacionnovacion.bpmn new file mode 100644 index 0000000..36e76ce --- /dev/null +++ b/base/bpm/flows/src/flows/flows/calificacionnovacion.bpmn @@ -0,0 +1,1033 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _69_maiaInput + _69_taskMetaDataInput + + + _69_actualTaskOutput + _69_maiaOutput + _69_taskMetaDataOutput + + + + maia + _69_maiaInput + + + taskMetaData + _69_taskMetaDataInput + + + _69_actualTaskOutput + actualTask + + + _69_maiaOutput + maia + + + _69_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + + + _3_actualTaskOutput + _3_maiaOutput + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_actualTaskOutput + actualTask + + + _3_maiaOutput + maia + + + _3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _71_maiaInput + _71_taskMetaDataInput + + + _71_actualTaskOutput + _71_maiaOutput + _71_taskMetaDataOutput + + + + maia + _71_maiaInput + + + taskMetaData + _71_taskMetaDataInput + + + _71_actualTaskOutput + actualTask + + + _71_maiaOutput + maia + + + _71_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _76_maiaInput + _76_taskMetaDataInput + + + _76_actualTaskOutput + _76_maiaOutput + _76_taskMetaDataOutput + + + + maia + _76_maiaInput + + + taskMetaData + _76_taskMetaDataInput + + + _76_actualTaskOutput + actualTask + + + _76_maiaOutput + maia + + + _76_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _77_maiaInput + _77_taskMetaDataInput + + + _77_actualTaskOutput + _77_maiaOutput + _77_taskMetaDataOutput + + + + maia + _77_maiaInput + + + taskMetaData + _77_taskMetaDataInput + + + _77_actualTaskOutput + actualTask + + + _77_maiaOutput + maia + + + _77_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _78_maiaInput + _78_taskMetaDataInput + + + _78_actualTaskOutput + _78_maiaOutput + _78_taskMetaDataOutput + + + + maia + _78_maiaInput + + + taskMetaData + _78_taskMetaDataInput + + + _78_actualTaskOutput + actualTask + + + _78_maiaOutput + maia + + + _78_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _72_maiaInput + _72_taskMetaDataInput + + + _72_actualTaskOutput + _72_maiaOutput + _72_taskMetaDataOutput + + + + maia + _72_maiaInput + + + taskMetaData + _72_taskMetaDataInput + + + _72_actualTaskOutput + actualTask + + + _72_maiaOutput + maia + + + _72_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _73_maiaInput + _73_taskMetaDataInput + + + _73_actualTaskOutput + _73_maiaOutput + _73_taskMetaDataOutput + + + + maia + _73_maiaInput + + + taskMetaData + _73_taskMetaDataInput + + + _73_actualTaskOutput + actualTask + + + _73_maiaOutput + maia + + + _73_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _74_maiaInput + _74_taskMetaDataInput + + + _74_actualTaskOutput + _74_maiaOutput + _74_taskMetaDataOutput + + + + maia + _74_maiaInput + + + taskMetaData + _74_taskMetaDataInput + + + _74_actualTaskOutput + actualTask + + + _74_maiaOutput + maia + + + _74_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + _82_maiaInput + _82_taskMetaDataInput + + + _82_actualTaskOutput + _82_maiaOutput + _82_taskMetaDataOutput + + + + maia + _82_maiaInput + + + taskMetaData + _82_taskMetaDataInput + + + _82_actualTaskOutput + actualTask + + + _82_maiaOutput + maia + + + _82_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _29_maiaInput + _29_taskMetaDataInput + + + _29_actualTaskOutput + _29_maiaOutput + _29_taskMetaDataOutput + + + + maia + _29_maiaInput + + + taskMetaData + _29_taskMetaDataInput + + + _29_actualTaskOutput + actualTask + + + _29_maiaOutput + maia + + + _29_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + _52_maiaInput + _52_taskMetaDataInput + + + _52_actualTaskOutput + _52_maiaOutput + _52_taskMetaDataOutput + + + + maia + _52_maiaInput + + + taskMetaData + _52_taskMetaDataInput + + + _52_actualTaskOutput + actualTask + + + _52_maiaOutput + maia + + + _52_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _57_maiaInput + _57_taskMetaDataInput + + + _57_actualTaskOutput + _57_maiaOutput + _57_taskMetaDataOutput + + + + maia + _57_maiaInput + + + taskMetaData + _57_taskMetaDataInput + + + _57_actualTaskOutput + actualTask + + + _57_maiaOutput + maia + + + _57_taskMetaDataOutput + taskMetaData + + + + + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + return ((String)maia.get("FINANCIALTYPE")).compareTo("R")==0; + + + + return ((String)maia.get("FINANCIALTYPE")).compareTo("F")==0; + + + + + + + + + + + + + + + + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/casoprueba.bpmn b/base/bpm/flows/src/flows/flows/casoprueba.bpmn new file mode 100644 index 0000000..f6b393a --- /dev/null +++ b/base/bpm/flows/src/flows/flows/casoprueba.bpmn @@ -0,0 +1,560 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _32_maiaInput + _32_taskMetaDataInput + + + _32_actualTaskOutput + _32_maiaOutput + _32_taskMetaDataOutput + + + + maia + _32_maiaInput + + + taskMetaData + _32_taskMetaDataInput + + + _32_actualTaskOutput + actualTask + + + _32_maiaOutput + maia + + + _32_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _5_maiaInput + _5_taskMetaDataInput + + + _5_actualTaskOutput + _5_maiaOutput + _5_taskMetaDataOutput + + + + maia + _5_maiaInput + + + taskMetaData + _5_taskMetaDataInput + + + _5_actualTaskOutput + actualTask + + + _5_maiaOutput + maia + + + _5_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _23_maiaInput + _23_taskMetaDataInput + + + _23_actualTaskOutput + _23_maiaOutput + _23_taskMetaDataOutput + + + + maia + _23_maiaInput + + + taskMetaDataVM + _23_taskMetaDataInput + + + _23_actualTaskOutput + actualTaskVM + + + _23_maiaOutput + maia + + + _23_taskMetaDataOutput + taskMetaDataVM + + + + + + + + + + + + + + + + + + + _25_maiaInput + _25_taskMetaDataInput + + + _25_actualTaskOutput + _25_maiaOutput + _25_taskMetaDataOutput + + + + maia + _25_maiaInput + + + taskMetaDataVT + _25_taskMetaDataInput + + + _25_actualTaskOutput + actualTaskVT + + + _25_maiaOutput + maia + + + _25_taskMetaDataOutput + taskMetaDataVT + + + + + + + + + + + + + + + + + + + _24_maiaInput + _24_taskMetaDataInput + + + _24_actualTaskOutput + _24_maiaOutput + _24_taskMetaDataOutput + + + + maia + _24_maiaInput + + + taskMetaDataVP + _24_taskMetaDataInput + + + _24_actualTaskOutput + actualTaskVP + + + _24_maiaOutput + maia + + + _24_taskMetaDataOutput + taskMetaDataVP + + + + + + + + + + + + + + + + + + + + + + + + _30_maiaInput + _30_taskMetaDataInput + + + _30_actualTaskOutput + _30_maiaOutput + _30_taskMetaDataOutput + + + + maia + _30_maiaInput + + + taskMetaData + _30_taskMetaDataInput + + + _30_actualTaskOutput + actualTask + + + _30_maiaOutput + maia + + + _30_taskMetaDataOutput + taskMetaData + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + return taskMetaData.getResponse().compareTo("D")==0; + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + return taskMetaDataVT.getResponse().compareTo("D")==0; + + + return taskMetaDataVP.getResponse().compareTo("D")==0; + + + return taskMetaDataVM.getResponse().compareTo("D")==0; + + + + + + + + return taskMetaDataVM.getResponse().compareTo("D")!=0; + + + return taskMetaDataVT.getResponse().compareTo("D")!=0; + + + return taskMetaDataVP.getResponse().compareTo("D")!=0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/constituciongarantias.bpmn b/base/bpm/flows/src/flows/flows/constituciongarantias.bpmn new file mode 100644 index 0000000..8e89899 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/constituciongarantias.bpmn @@ -0,0 +1,2074 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + _10_maiaInput + _10_taskMetaDataInput + + + _10_actualTaskOutput + _10_maiaOutput + _10_taskMetaDataOutput + + + + maia + _10_maiaInput + + + taskMetaData + _10_taskMetaDataInput + + + _10_actualTaskOutput + actualTask + + + _10_maiaOutput + maia + + + _10_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + _12_maiaInput + _12_taskMetaDataInput + + + _12_actualTaskOutput + _12_maiaOutput + _12_taskMetaDataOutput + + + + maia + _12_maiaInput + + + taskMetaData + _12_taskMetaDataInput + + + _12_actualTaskOutput + actualTask + + + _12_maiaOutput + maia + + + _12_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + _134_maiaInput + _134_taskMetaDataInput + + + _134_actualTaskOutput + _134_maiaOutput + _134_taskMetaDataOutput + + + + maia + _134_maiaInput + + + taskMetaData + _134_taskMetaDataInput + + + _134_actualTaskOutput + actualTask + + + _134_maiaOutput + maia + + + _134_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _28_maiaInput + _28_taskMetaDataInput + + + _28_actualTaskOutput + _28_maiaOutput + _28_taskMetaDataOutput + + + + maia + _28_maiaInput + + + taskMetaData + _28_taskMetaDataInput + + + _28_actualTaskOutput + actualTask + + + _28_maiaOutput + maia + + + _28_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _31_maiaInput + _31_taskMetaDataInput + + + _31_actualTaskOutput + _31_maiaOutput + _31_taskMetaDataOutput + + + + maia + _31_maiaInput + + + taskMetaData + _31_taskMetaDataInput + + + _31_actualTaskOutput + actualTask + + + _31_maiaOutput + maia + + + _31_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _54_maiaInput + _54_taskMetaDataInput + + + _54_actualTaskOutput + _54_maiaOutput + _54_taskMetaDataOutput + + + + maia + _54_maiaInput + + + taskMetaData + _54_taskMetaDataInput + + + _54_actualTaskOutput + actualTask + + + _54_maiaOutput + maia + + + _54_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _53_maiaInput + _53_taskMetaDataInput + + + _53_actualTaskOutput + _53_maiaOutput + _53_taskMetaDataOutput + + + + maia + _53_maiaInput + + + taskMetaData + _53_taskMetaDataInput + + + _53_actualTaskOutput + actualTask + + + _53_maiaOutput + maia + + + _53_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _76_maiaInput + _76_taskMetaDataInput + + + _76_actualTaskOutput + _76_maiaOutput + _76_taskMetaDataOutput + + + + maia + _76_maiaInput + + + taskMetaData + _76_taskMetaDataInput + + + _76_actualTaskOutput + actualTask + + + _76_maiaOutput + maia + + + _76_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _77_maiaInput + _77_taskMetaDataInput + + + _77_actualTaskOutput + _77_maiaOutput + _77_taskMetaDataOutput + + + + maia + _77_maiaInput + + + taskMetaData + _77_taskMetaDataInput + + + _77_actualTaskOutput + actualTask + + + _77_maiaOutput + maia + + + _77_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + _73_maiaInput + _73_taskMetaDataInput + + + _73_actualTaskOutput + _73_maiaOutput + _73_taskMetaDataOutput + + + + maia + _73_maiaInput + + + taskMetaData + _73_taskMetaDataInput + + + _73_actualTaskOutput + actualTask + + + _73_maiaOutput + maia + + + _73_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _74_maiaInput + _74_taskMetaDataInput + + + _74_actualTaskOutput + _74_maiaOutput + _74_taskMetaDataOutput + + + + maia + _74_maiaInput + + + taskMetaData + _74_taskMetaDataInput + + + _74_actualTaskOutput + actualTask + + + _74_maiaOutput + maia + + + _74_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _85_maiaInput + _85_taskMetaDataInput + + + _85_actualTaskOutput + _85_maiaOutput + _85_taskMetaDataOutput + + + + maia + _85_maiaInput + + + taskMetaData + _85_taskMetaDataInput + + + _85_actualTaskOutput + actualTask + + + _85_maiaOutput + maia + + + _85_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _102_maiaInput + _102_taskMetaDataInput + + + _102_actualTaskOutput + _102_maiaOutput + _102_taskMetaDataOutput + + + + maia + _102_maiaInput + + + taskMetaData + _102_taskMetaDataInput + + + _102_actualTaskOutput + actualTask + + + _102_maiaOutput + maia + + + _102_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _100_maiaInput + _100_taskMetaDataInput + + + _100_actualTaskOutput + _100_maiaOutput + _100_taskMetaDataOutput + + + + maia + _100_maiaInput + + + taskMetaData + _100_taskMetaDataInput + + + _100_actualTaskOutput + actualTask + + + _100_maiaOutput + maia + + + _100_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _101_maiaInput + _101_taskMetaDataInput + + + _101_actualTaskOutput + _101_maiaOutput + _101_taskMetaDataOutput + + + + maia + _101_maiaInput + + + taskMetaData + _101_taskMetaDataInput + + + _101_actualTaskOutput + actualTask + + + _101_maiaOutput + maia + + + _101_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _99_maiaInput + _99_taskMetaDataInput + + + _99_actualTaskOutput + _99_maiaOutput + _99_taskMetaDataOutput + + + + maia + _99_maiaInput + + + taskMetaData + _99_taskMetaDataInput + + + _99_actualTaskOutput + actualTask + + + _99_maiaOutput + maia + + + _99_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _110_maiaInput + _110_taskMetaDataInput + + + _110_actualTaskOutput + _110_maiaOutput + _110_taskMetaDataOutput + + + + maia + _110_maiaInput + + + taskMetaData + _110_taskMetaDataInput + + + _110_actualTaskOutput + actualTask + + + _110_maiaOutput + maia + + + _110_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _111_maiaInput + _111_taskMetaDataInput + + + _111_actualTaskOutput + _111_maiaOutput + _111_taskMetaDataOutput + + + + maia + _111_maiaInput + + + taskMetaData + _111_taskMetaDataInput + + + _111_actualTaskOutput + actualTask + + + _111_maiaOutput + maia + + + _111_taskMetaDataOutput + taskMetaDat + + + + + + + + + + + + + + + + + + + _108_maiaInput + _108_taskMetaDataInput + + + _108_actualTaskOutput + _108_maiaOutput + _108_taskMetaDataOutput + + + + maia + _108_maiaInput + + + taskMetaData + _108_taskMetaDataInput + + + _108_actualTaskOutput + actualTask + + + _108_maiaOutput + maia + + + _108_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _109_maiaInput + _109_taskMetaDataInput + + + _109_actualTaskOutput + _109_maiaOutput + _109_taskMetaDataOutput + + + + maia + _109_maiaInput + + + taskMetaData + _109_taskMetaDataInput + + + _109_actualTaskOutput + actualTask + + + _109_maiaOutput + maia + + + _109_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + _105_maiaInput + _105_taskMetaDataInput + + + _105_actualTaskOutput + _105_maiaOutput + _105_taskMetaDataOutput + + + + maia + _105_maiaInput + + + taskMetaData + _105_taskMetaDataInput + + + _105_actualTaskOutput + actualTask + + + _105_maiaOutput + maia + + + _105_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _117_maiaInput + _117_taskMetaDataInput + + + _117_actualTaskOutput + _117_maiaOutput + _117_taskMetaDataOutput + + + + maia + _117_maiaInput + + + taskMetaData + _117_taskMetaDataInput + + + _117_actualTaskOutput + actualTask + + + _117_maiaOutput + maia + + + _117_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + _114_maiaInput + _114_taskMetaDataInput + + + _114_actualTaskOutput + _114_maiaOutput + _114_taskMetaDataOutput + + + + maia + _114_maiaInput + + + taskMetaData + _114_taskMetaDataInput + + + _114_actualTaskOutput + actualTask + + + _114_maiaOutput + maia + + + _114_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _112_maiaInput + _112_taskMetaDataInput + + + _112_actualTaskOutput + _112_maiaOutput + _112_taskMetaDataOutput + + + + maia + _112_maiaInput + + + taskMetaData + _112_taskMetaDataInput + + + _112_actualTaskOutput + actualTask + + + _112_maiaOutput + maia + + + _112_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _125_maiaInput + _125_taskMetaDataInput + + + _125_actualTaskOutput + _125_maiaOutput + _125_taskMetaDataOutput + + + + maia + _125_maiaInput + + + taskMetaData + _125_taskMetaDataInput + + + _125_actualTaskOutput + actualTask + + + _125_maiaOutput + maia + + + _125_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _123_maiaInput + _123_taskMetaDataInput + + + _123_actualTaskOutput + _123_maiaOutput + _123_taskMetaDataOutput + + + + maia + _123_maiaInput + + + taskMetaData + _123_taskMetaDataInput + + + _123_actualTaskOutput + actualTask + + + _123_maiaOutput + maia + + + _123_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _121_maiaInput + _121_taskMetaDataInput + + + _121_actualTaskOutput + _121_maiaOutput + _121_taskMetaDataOutput + + + + maia + _121_maiaInput + + + taskMetaData + _121_taskMetaDataInput + + + _121_actualTaskOutput + actualTask + + + _121_maiaOutput + maia + + + _121_taskMetaDataOutput + taskMetaData + + + + + + + + return ((String)maia.get("outlay")).compareTo("Y")==0; + + + + return ((String)maia.get("RECEIVER")).compareTo("C")==0; + + + return ((String)maia.get("tipogarantia")).compareTo("H")==0; + + + + + return ((String)maia.get("tipogarantia")).compareTo("H")==0; + + + return ((String)maia.get("tipograntia")).compareTo("H")!=0; + + + + return ((String)maia.get("outlay")).compareTo("N")==0; + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + + + + + + + + + + + return ((String)maia.get("mantienegarantia")).compareTo("N")==0; + + + return ((String)maia.get("mantienegarantia")).compareTo("N")!=0; + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + + + return ((String)maia.get("tipogarantia")).compareTo("H")!=0; + + + return ((String)maia.get("mantienegarantia")).compareTo("N")!=0; + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + return ((String)maia.get("mantienegarantia")).compareTo("N")==0; + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + return taskMetaData.getResponse().compareTo("D")==0; + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + + return ((String)maia.get("RECEIVER")).compareTo("C")!=0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/credit.bpmn b/base/bpm/flows/src/flows/flows/credit.bpmn new file mode 100644 index 0000000..d69ddc9 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/credit.bpmn @@ -0,0 +1,267 @@ + + + + + + + + + + + + + + + + + + + + + + + + _5_countInput + _5_usuarioInput + _5_mInput + + + + + + maia.count + _5_countInput + + + maia.usuario + _5_usuarioInput + + + maia + _5_mInput + + + + + + + + + _6_countInput + _6_usuarioInput + _6_mInput + + + + + + maia.count + _6_countInput + + + maia.usuario + _6_usuarioInput + + + maia + _6_mInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + return maia.get("teller.required")!=null; + + + + + + + + + + + return maia.get("teller.required")==null; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/flinal.bpmn b/base/bpm/flows/src/flows/flows/flinal.bpmn new file mode 100644 index 0000000..26eb22e --- /dev/null +++ b/base/bpm/flows/src/flows/flows/flinal.bpmn @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _5_maiaInput + _5_taskMetaDataInput + + + _5_actualTaskOutput + _5_maiaOutput + _5_taskMetaDataOutput + + + + maia + _5_maiaInput + + + taskMetaData + _5_taskMetaDataInput + + + _5_actualTaskOutput + actualTask + + + _5_maiaOutput + maia + + + _5_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/flow5.bpmn b/base/bpm/flows/src/flows/flows/flow5.bpmn new file mode 100644 index 0000000..8cfe5c7 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/flow5.bpmn @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _A6E2F6C3-A1D2-4D92-BADD-480A070A0975_CommentInput + _A6E2F6C3-A1D2-4D92-BADD-480A070A0975_TaskNameInput + _A6E2F6C3-A1D2-4D92-BADD-480A070A0975_ContentInput + + + + + + _A6E2F6C3-A1D2-4D92-BADD-480A070A0975_CommentInput + + Prueba + _A6E2F6C3-A1D2-4D92-BADD-480A070A0975_CommentInput + + + + _A6E2F6C3-A1D2-4D92-BADD-480A070A0975_TaskNameInput + + Prueba + + _A6E2F6C3-A1D2-4D92-BADD-480A070A0975_TaskNameInput + + + + _A6E2F6C3-A1D2-4D92-BADD-480A070A0975_ContentInput + + Esta es una tarea + _A6E2F6C3-A1D2-4D92-BADD-480A070A0975_ContentInput + + + + + #{m.userId} + + + + + + + + + + + + + + + + + _10_countInput + + + _10_iOutput + + + + count + _10_countInput + + + _10_iOutput + i + + + + + + + + + + + return resultado.compareTo("OK")==0; + + + + + + + return resultado.compareTo("NO")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/instrumnovacion.bpmn b/base/bpm/flows/src/flows/flows/instrumnovacion.bpmn new file mode 100644 index 0000000..e494e77 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/instrumnovacion.bpmn @@ -0,0 +1,744 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + + + _3_actualTaskOutput + _3_maiaOutput + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_actualTaskOutput + actualTask + + + _3_maiaOutput + maia + + + _3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _76_maiaInput + _76_taskMetaDataInput + + + _76_actualTaskOutput + _76_maiaOutput + _76_taskMetaDataOutput + + + + maia + _76_maiaInput + + + taskMetaData + _76_taskMetaDataInput + + + _76_actualTaskOutput + actualTask + + + _76_maiaOutput + maia + + + _76_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _77_maiaInput + _77_taskMetaDataInput + + + _77_actualTaskOutput + _77_maiaOutput + _77_taskMetaDataOutput + + + + maia + _77_maiaInput + + + taskMetaData + _77_taskMetaDataInput + + + _77_actualTaskOutput + actualTask + + + _77_maiaOutput + maia + + + _77_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _10_maiaInput + _10_taskMetaDataInput + + + _10_actualTaskOutput + _10_maiaOutput + _10_taskMetaDataOutput + + + + maia + _10_maiaInput + + + taskMetaData + _10_taskMetaDataInput + + + _10_actualTaskOutput + actualTask + + + _10_maiaOutput + maia + + + _10_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _12_maiaInput + _12_taskMetaDataInput + + + _12_actualTaskOutput + _12_maiaOutput + _12_taskMetaDataOutput + + + + maia + _12_maiaInput + + + taskMetaData + _12_taskMetaDataInput + + + _12_actualTaskOutput + actualTask + + + _12_maiaOutput + maia + + + _12_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _74_maiaInput + _74_taskMetaDataInput + + + _74_actualTaskOutput + _74_maiaOutput + _74_taskMetaDataOutput + + + + maia + _74_maiaInput + + + taskMetaData + _74_taskMetaDataInput + + + _74_actualTaskOutput + actualTask + + + _74_maiaOutput + maia + + + _74_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _85_maiaInput + _85_taskMetaDataInput + + + _85_actualTaskOutput + _85_maiaOutput + _85_taskMetaDataOutput + + + + maia + _85_maiaInput + + + taskMetaData + _85_taskMetaDataInput + + + _85_actualTaskOutput + actualTask + + + _85_maiaOutput + maia + + + _85_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _53_maiaInput + _53_taskMetaDataInput + + + _53_actualTaskOutput + _53_maiaOutput + _53_taskMetaDataOutput + + + + maia + _53_maiaInput + + + taskMetaData + _53_taskMetaDataInput + + + _53_actualTaskOutput + actualTask + + + _53_maiaOutput + maia + + + _53_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _52_maiaInput + _52_taskMetaDataInput + + + _52_actualTaskOutput + _52_maiaOutput + _52_taskMetaDataOutput + + + + maia + _52_maiaInput + + + taskMetaData + _52_taskMetaDataInput + + + _52_actualTaskOutput + actualTask + + + _52_maiaOutput + maia + + + _52_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + return ((String)maia.get("FINANCIALTYPE")).compareTo("F")==0; + + + + + + + + + return ((String)maia.get("FINANCIALTYPE")).compareTo("R")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/levantamientodefgar.bpmn b/base/bpm/flows/src/flows/flows/levantamientodefgar.bpmn new file mode 100644 index 0000000..c3ccd90 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/levantamientodefgar.bpmn @@ -0,0 +1,753 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + + + _3_actualTaskOutput + _3_maiaOutput + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_actualTaskOutput + actualTask + + + _3_maiaOutput + maia + + + _3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _76_maiaInput + _76_taskMetaDataInput + + + _76_actualTaskOutput + _76_maiaOutput + _76_taskMetaDataOutput + + + + maia + _76_maiaInput + + + taskMetaData + _76_taskMetaDataInput + + + _76_actualTaskOutput + actualTask + + + _76_maiaOutput + maia + + + _76_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _77_maiaInput + _77_taskMetaDataInput + + + _77_actualTaskOutput + _77_maiaOutput + _77_taskMetaDataOutput + + + + maia + _77_maiaInput + + + taskMetaData + _77_taskMetaDataInput + + + _77_actualTaskOutput + actualTask + + + _77_maiaOutput + maia + + + _77_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _10_maiaInput + _10_taskMetaDataInput + + + _10_actualTaskOutput + _10_maiaOutput + _10_taskMetaDataOutput + + + + maia + _10_maiaInput + + + taskMetaData + _10_taskMetaDataInput + + + _10_actualTaskOutput + actualTask + + + _10_maiaOutput + maia + + + _10_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _12_maiaInput + _12_taskMetaDataInput + + + _12_actualTaskOutput + _12_maiaOutput + _12_taskMetaDataOutput + + + + maia + _12_maiaInput + + + taskMetaData + _12_taskMetaDataInput + + + _12_actualTaskOutput + actualTask + + + _12_maiaOutput + maia + + + _12_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _73_maiaInput + _73_taskMetaDataInput + + + _73_actualTaskOutput + _73_maiaOutput + _73_taskMetaDataOutput + + + + maia + _73_maiaInput + + + taskMetaData + _73_taskMetaDataInput + + + _73_actualTaskOutput + actualTask + + + _73_maiaOutput + maia + + + _73_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _74_maiaInput + _74_taskMetaDataInput + + + _74_actualTaskOutput + _74_maiaOutput + _74_taskMetaDataOutput + + + + maia + _74_maiaInput + + + taskMetaData + _74_taskMetaDataInput + + + _74_actualTaskOutput + actualTask + + + _74_maiaOutput + maia + + + _74_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _85_maiaInput + _85_taskMetaDataInput + + + _85_actualTaskOutput + _85_maiaOutput + _85_taskMetaDataOutput + + + + maia + _85_maiaInput + + + taskMetaData + _85_taskMetaDataInput + + + _85_actualTaskOutput + actualTask + + + _85_maiaOutput + maia + + + _85_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _53_maiaInput + _53_taskMetaDataInput + + + _53_actualTaskOutput + _53_maiaOutput + _53_taskMetaDataOutput + + + + maia + _53_maiaInput + + + taskMetaData + _53_taskMetaDataInput + + + _53_actualTaskOutput + actualTask + + + _53_maiaOutput + maia + + + _53_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _52_maiaInput + _52_taskMetaDataInput + + + _52_actualTaskOutput + _52_maiaOutput + _52_taskMetaDataOutput + + + + maia + _52_maiaInput + + + taskMetaData + _52_taskMetaDataInput + + + _52_actualTaskOutput + actualTask + + + _52_maiaOutput + maia + + + _52_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/levantamientopargar.bpmn b/base/bpm/flows/src/flows/flows/levantamientopargar.bpmn new file mode 100644 index 0000000..b87b973 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/levantamientopargar.bpmn @@ -0,0 +1,937 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + + + _3_actualTaskOutput + _3_maiaOutput + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_actualTaskOutput + actualTask + + + _3_maiaOutput + maia + + + _3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + _76_maiaInput + _76_taskMetaDataInput + + + _76_actualTaskOutput + _76_maiaOutput + _76_taskMetaDataOutput + + + + maia + _76_maiaInput + + + taskMetaData + _76_taskMetaDataInput + + + _76_actualTaskOutput + actualTask + + + _76_maiaOutput + maia + + + _76_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _77_maiaInput + _77_taskMetaDataInput + + + _77_actualTaskOutput + _77_maiaOutput + _77_taskMetaDataOutput + + + + maia + _77_maiaInput + + + taskMetaData + _77_taskMetaDataInput + + + _77_actualTaskOutput + actualTask + + + _77_maiaOutput + maia + + + _77_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _10_maiaInput + _10_taskMetaDataInput + + + _10_actualTaskOutput + _10_maiaOutput + _10_taskMetaDataOutput + + + + maia + _10_maiaInput + + + taskMetaData + _10_taskMetaDataInput + + + _10_actualTaskOutput + actualTask + + + _10_maiaOutput + maia + + + _10_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _12_maiaInput + _12_taskMetaDataInput + + + _12_actualTaskOutput + _12_maiaOutput + _12_taskMetaDataOutput + + + + maia + _12_maiaInput + + + taskMetaData + _12_taskMetaDataInput + + + _12_actualTaskOutput + actualTask + + + _12_maiaOutput + maia + + + _12_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _73_maiaInput + _73_taskMetaDataInput + + + _73_actualTaskOutput + _73_maiaOutput + _73_taskMetaDataOutput + + + + maia + _73_maiaInput + + + taskMetaData + _73_taskMetaDataInput + + + _73_actualTaskOutput + actualTask + + + _73_maiaOutput + maia + + + _73_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _74_maiaInput + _74_taskMetaDataInput + + + _74_actualTaskOutput + _74_maiaOutput + _74_taskMetaDataOutput + + + + maia + _74_maiaInput + + + taskMetaData + _74_taskMetaDataInput + + + _74_actualTaskOutput + actualTask + + + _74_maiaOutput + maia + + + _74_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _53_maiaInput + _53_taskMetaDataInput + + + _53_actualTaskOutput + _53_maiaOutput + _53_taskMetaDataOutput + + + + maia + _53_maiaInput + + + taskMetaData + _53_taskMetaDataInput + + + _53_actualTaskOutput + actualTask + + + _53_maiaOutput + maia + + + _53_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _52_maiaInput + _52_taskMetaDataInput + + + _52_actualTaskOutput + _52_maiaOutput + _52_taskMetaDataOutput + + + + maia + _52_maiaInput + + + taskMetaData + _52_taskMetaDataInput + + + _52_actualTaskOutput + actualTask + + + _52_maiaOutput + maia + + + _52_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _93_maiaInput + _93_taskMetaDataInput + + + _93_actualTaskOutput + _93_maiaOutput + _93_taskMetaDataOutput + + + + maia + _93_maiaInput + + + taskMetaData + _93_taskMetaDataInput + + + _93_actualTaskOutput + actualTask + + + _93_maiaOutput + maia + + + _93_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _95_maiaInput + _95_taskMetaDataInput + + + _95_actualTaskOutput + _95_maiaOutput + _95_taskMetaDataOutput + + + + maia + _95_maiaInput + + + taskMetaData + _95_taskMetaDataInput + + + _95_actualTaskOutput + actualTask + + + _95_maiaOutput + maia + + + _95_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _94_maiaInput + _94_taskMetaDataInput + + + _94_actualTaskOutput + _94_maiaOutput + _94_taskMetaDataOutput + + + + maia + _94_maiaInput + + + taskMetaData + _94_taskMetaDataInput + + + _94_actualTaskOutput + actualTask + + + _94_maiaOutput + maia + + + _94_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/mapaBEV.bpmn b/base/bpm/flows/src/flows/flows/mapaBEV.bpmn new file mode 100644 index 0000000..20d52f2 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/mapaBEV.bpmn @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + _2_tasksMetaDataInput + _2_maiaInput + + + _2_responseOutput + _2_tasksMetaDataOutput + _2_maiaOutput + + + + tasksMetaData + _2_tasksMetaDataInput + + + maia + _2_maiaInput + + + _2_responseOutput + response + + + _2_tasksMetaDataOutput + tasksMetaData + + + _2_maiaOutput + maia + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/matrizevaluacion.bpmn b/base/bpm/flows/src/flows/flows/matrizevaluacion.bpmn new file mode 100644 index 0000000..bc7d19f --- /dev/null +++ b/base/bpm/flows/src/flows/flows/matrizevaluacion.bpmn @@ -0,0 +1,364 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + + + _3_actualTaskOutput + _3_maiaOutput + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_actualTaskOutput + actualTask + + + _3_maiaOutput + maia + + + _3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _23_maiaInput + _23_taskMetaDataInput + + + _23_actualTaskOutput + _23_maiaOutput + _23_taskMetaDataOutput + + + + maia + _23_maiaInput + + + taskMetaData + _23_taskMetaDataInput + + + _23_actualTaskOutput + actualTask + + + _23_maiaOutput + maia + + + _23_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _42_maiaInput + _42_taskMetaDataInput + + + _42_actualTaskOutput + _42_maiaOutput + _42_taskMetaDataOutput + + + + maia + _42_maiaInput + + + taskMetaData + _42_taskMetaDataInput + + + _42_actualTaskOutput + actualTask + + + _42_maiaOutput + maia + + + _42_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + _10_maiaInput + _10_taskMetaDataInput + + + _10_actualTaskOutput + _10_maiaOutput + _10_taskMetaDataOutput + + + + maia + _10_maiaInput + + + taskMetaData + _10_taskMetaDataInput + + + _10_actualTaskOutput + actualTask + + + _10_maiaOutput + maia + + + _10_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/n1.bpmn b/base/bpm/flows/src/flows/flows/n1.bpmn new file mode 100644 index 0000000..267b738 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/n1.bpmn @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/n2.bpmn b/base/bpm/flows/src/flows/flows/n2.bpmn new file mode 100644 index 0000000..f161a5e --- /dev/null +++ b/base/bpm/flows/src/flows/flows/n2.bpmn @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + return type.compareTo("N")==0; + + + return type.compareTo("N")!=0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/n3.bpmn b/base/bpm/flows/src/flows/flows/n3.bpmn new file mode 100644 index 0000000..d806499 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/n3.bpmn @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/n4.bpmn b/base/bpm/flows/src/flows/flows/n4.bpmn new file mode 100644 index 0000000..570afc3 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/n4.bpmn @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/nomenclatura.bpmn b/base/bpm/flows/src/flows/flows/nomenclatura.bpmn new file mode 100644 index 0000000..ded9f7c --- /dev/null +++ b/base/bpm/flows/src/flows/flows/nomenclatura.bpmn @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/precalificacion.bpmn b/base/bpm/flows/src/flows/flows/precalificacion.bpmn new file mode 100644 index 0000000..b97a7c5 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/precalificacion.bpmn @@ -0,0 +1,1097 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + + + _3_actualTaskOutput + _3_maiaOutput + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_actualTaskOutput + actualTask + + + _3_maiaOutput + maia + + + _3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + _10_maiaInput + _10_taskMetaDataInput + + + _10_actualTaskOutput + _10_maiaOutput + _10_taskMetaDataOutput + + + + maia + _10_maiaInput + + + taskMetaData + _10_taskMetaDataInput + + + _10_actualTaskOutput + actualTask + + + _10_maiaOutput + maia + + + _10_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _12_maiaInput + _12_taskMetaDataInput + + + _12_actualTaskOutput + _12_maiaOutput + _12_taskMetaDataOutput + + + + maia + _12_maiaInput + + + taskMetaData + _12_taskMetaDataInput + + + _12_actualTaskOutput + actualTask + + + _12_maiaOutput + maia + + + _12_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + _16_maiaInput + _16_taskMetaDataInput + + + _16_actualTaskOutput + _16_maiaOutput + _16_taskMetaDataOutput + + + + maia + _16_maiaInput + + + taskMetaData + _16_taskMetaDataInput + + + _16_actualTaskOutput + actualTask + + + _16_maiaOutput + maia + + + _16_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + _18_tasksMetaDataInput + _18_maiaInput + + + _18_actualTaskOutput + _18_maiaOutput + _18_taskMetaDataOutput + + + + tasksMetaData + _18_tasksMetaDataInput + + + maia + _18_maiaInput + + + _18_actualTaskOutput + actualTask + + + _18_maiaOutput + maia + + + _18_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _23_maiaInput + _23_taskMetaDataInput + + + _23_actualTaskOutput + _23_maiaOutput + _23_taskMetaDataOutput + + + + maia + _23_maiaInput + + + taskMetaData + _23_taskMetaDataInput + + + _23_actualTaskOutput + actualTask + + + _23_maiaOutput + maia + + + _23_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _22_maiaInput + _22_taskMetaDataInput + + + _22_actualTaskOutput + _22_maiaOutput + _22_taskMetaDataOutput + + + + maia + _22_maiaInput + + + taskMetaData + _22_taskMetaDataInput + + + _22_actualTaskOutput + actualTask + + + _22_maiaOutput + maia + + + _22_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + _29_maiaInput + _29_taskMetaDataInput + + + _29_actualTaskOutput + _29_maiaOutput + _29_taskMetaDataOutput + + + + maia + _29_maiaInput + + + taskMetaData + _29_taskMetaDataInput + + + _29_actualTaskOutput + actualTask + + + _29_maiaOutput + maia + + + _29_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _28_maiaInput + _28_taskMetaDataInput + + + _28_actualTaskOutput + _28_maiaOutput + _28_taskMetaDataOutput + + + + maia + _28_maiaInput + + + taskMetaData + _28_taskMetaDataInput + + + _28_actualTaskOutput + actualTask + + + _28_maiaOutput + maia + + + _28_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _31_maiaInput + _31_taskMetaDataInput + + + _31_actualTaskOutput + _31_maiaOutput + _31_taskMetaDataOutput + + + + maia + _31_maiaInput + + + taskMetaData + _31_taskMetaDataInput + + + _31_actualTaskOutput + actualTask + + + _31_maiaOutput + maia + + + _31_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _30_maiaInput + _30_taskMetaDataInput + + + _30_actualTaskOutput + _30_maiaOutput + _30_taskMetaDataOutput + + + + maia + _30_maiaInput + + + taskMetaData + _30_taskMetaDataInput + + + _30_actualTaskOutput + actualTask + + + _30_maiaOutput + maia + + + _30_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _52_maiaInput + _52_taskMetaDataInput + + + _52_actualTaskOutput + _52_maiaOutput + _52_taskMetaDataOutput + + + + maia + _52_maiaInput + + + taskMetaData + _52_taskMetaDataInput + + + _52_actualTaskOutput + actualTask + + + _52_maiaOutput + maia + + + _52_taskMetaDataOutput + taskMetaData + + + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + return ((String)maia.get("REQ_REC_OBS")).compareTo("Y")!=0; + + + + + + + + return ((String)maia.get("lettertype")).compareTo("O")==0; + + + return ((String)maia.get("lettertype")).compareTo("N")==0; + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + return ((String)maia.get("lettertype")).compareTo("O")==0; + + + + + return ((String)maia.get("midbonus")).compareTo("N")!=0; + + + return ((String)maia.get("lettertype")).compareTo("I")==0; + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + return ((String)maia.get("REQ_REV_OBS")).compareTo("Y")==0; + + + + + return ((String)maia.get("REQ_REV_OBS")).compareTo("Y")!=0; + + + + return ((String)maia.get("REQ_REC_OBS")).compareTo("Y")==0; + + + + + + + + + + + return ((String)maia.get("lettertype")).compareTo("O")!=0; + + + + return ((String)maia.get("midbonus")).compareTo("N")==0; + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/seguimientoycontrol.bpmn b/base/bpm/flows/src/flows/flows/seguimientoycontrol.bpmn new file mode 100644 index 0000000..97c6535 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/seguimientoycontrol.bpmn @@ -0,0 +1,1632 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _70_maiaInput + _70_taskMetaDataInput + + + _70_actualTaskOutput + _70_maiaOutput + _70_taskMetaDataOutput + + + + maia + _70_maiaInput + + + taskMetaData + _70_taskMetaDataInput + + + _70_actualTaskOutput + actualTask + + + _70_maiaOutput + maia + + + _70_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + + + _3_actualTaskOutput + _3_maiaOutput + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_actualTaskOutput + actualTask + + + _3_maiaOutput + maia + + + _3_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _71_maiaInput + _71_taskMetaDataInput + + + _71_actualTaskOutput + _71_maiaOutput + _71_taskMetaDataOutput + + + + maia + _71_maiaInput + + + taskMetaData + _71_taskMetaDataInput + + + _71_actualTaskOutput + actualTask + + + _71_maiaOutput + maia + + + _71_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _4_maiaInput + _4_taskMetaDataInput + + + _4_actualTaskOutput + _4_maiaOutput + _4_taskMetaDataOutput + + + + maia + _4_maiaInput + + + taskMetaData + _4_taskMetaDataInput + + + _4_actualTaskOutput + actualTask + + + _4_maiaOutput + maia + + + _4_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + _64_maiaInput + _64_taskMetaDataInput + + + _64_actualTaskOutput + _64_maiaOutput + _64_taskMetaDataOutput + + + + maia + _64_maiaInput + + + taskMetaData + _64_taskMetaDataInput + + + _64_actualTaskOutput + actualTask + + + _64_maiaOutput + maia + + + _64_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _65_maiaInput + _65_taskMetaDataInput + + + _65_actualTaskOutput + _65_maiaOutput + _65_taskMetaDataOutput + + + + maia + _65_maiaInput + + + taskMetaData + _65_taskMetaDataInput + + + _65_actualTaskOutput + actualTask + + + _65_maiaOutput + maia + + + _65_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _66_maiaInput + _66_taskMetaDataInput + + + _66_actualTaskOutput + _66_maiaOutput + _66_taskMetaDataOutput + + + + maia + _66_maiaInput + + + taskMetaData + _66_taskMetaDataInput + + + _66_actualTaskOutput + actualTask + + + _66_maiaOutput + maia + + + _66_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + _10_maiaInput + _10_taskMetaDataInput + + + _10_actualTaskOutput + _10_maiaOutput + _10_taskMetaDataOutput + + + + maia + _10_maiaInput + + + taskMetaData + _10_taskMetaDataInput + + + _10_actualTaskOutput + actualTask + + + _10_maiaOutput + maia + + + _10_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _72_maiaInput + _72_taskMetaDataInput + + + _72_actualTaskOutput + _72_maiaOutput + _72_taskMetaDataOutput + + + + maia + _72_maiaInput + + + taskMetaData + _72_taskMetaDataInput + + + _72_actualTaskOutput + actualTask + + + _72_maiaOutput + maia + + + _72_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _12_maiaInput + _12_taskMetaDataInput + + + _12_actualTaskOutput + _12_maiaOutput + _12_taskMetaDataOutput + + + + maia + _12_maiaInput + + + taskMetaData + _12_taskMetaDataInput + + + _12_actualTaskOutput + actualTask + + + _12_maiaOutput + maia + + + _12_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + _75_maiaInput + _75_taskMetaDataInput + + + _75_actualTaskOutput + _75_maiaOutput + _75_taskMetaDataOutput + + + + maia + _75_maiaInput + + + taskMetaData + _75_taskMetaDataInput + + + _75_actualTaskOutput + actualTask + + + _75_maiaOutput + maia + + + _75_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _16_maiaInput + _16_taskMetaDataInput + + + _16_actualTaskOutput + _16_maiaOutput + _16_taskMetaDataOutput + + + + maia + _16_maiaInput + + + taskMetaData + _16_taskMetaDataInput + + + _16_actualTaskOutput + actualTask + + + _16_maiaOutput + maia + + + _16_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + _18_tasksMetaDataInput + _18_maiaInput + + + _18_actualTaskOutput + _18_maiaOutput + _18_taskMetaDataOutput + + + + tasksMetaData + _18_tasksMetaDataInput + + + maia + _18_maiaInput + + + _18_actualTaskOutput + actualTask + + + _18_maiaOutput + maia + + + _18_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + _23_maiaInput + _23_taskMetaDataInput + + + _23_actualTaskOutput + _23_maiaOutput + _23_taskMetaDataOutput + + + + maia + _23_maiaInput + + + taskMetaData + _23_taskMetaDataInput + + + _23_actualTaskOutput + actualTask + + + _23_maiaOutput + maia + + + _23_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _22_maiaInput + _22_taskMetaDataInput + + + _22_actualTaskOutput + _22_maiaOutput + _22_taskMetaDataOutput + + + + maia + _22_maiaInput + + + taskMetaData + _22_taskMetaDataInput + + + _22_actualTaskOutput + actualTask + + + _22_maiaOutput + maia + + + _22_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _29_maiaInput + _29_taskMetaDataInput + + + _29_actualTaskOutput + _29_maiaOutput + _29_taskMetaDataOutput + + + + maia + _29_maiaInput + + + taskMetaData + _29_taskMetaDataInput + + + _29_actualTaskOutput + actualTask + + + _29_maiaOutput + maia + + + _29_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _28_maiaInput + _28_taskMetaDataInput + + + _28_actualTaskOutput + _28_maiaOutput + _28_taskMetaDataOutput + + + + maia + _28_maiaInput + + + taskMetaData + _28_taskMetaDataInput + + + _28_actualTaskOutput + actualTask + + + _28_maiaOutput + maia + + + _28_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + _31_maiaInput + _31_taskMetaDataInput + + + _31_actualTaskOutput + _31_maiaOutput + _31_taskMetaDataOutput + + + + maia + _31_maiaInput + + + taskMetaData + _31_taskMetaDataInput + + + _31_actualTaskOutput + actualTask + + + _31_maiaOutput + maia + + + _31_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + _30_maiaInput + _30_taskMetaDataInput + + + _30_actualTaskOutput + _30_maiaOutput + _30_taskMetaDataOutput + + + + maia + _30_maiaInput + + + taskMetaData + _30_taskMetaDataInput + + + _30_actualTaskOutput + actualTask + + + _30_maiaOutput + maia + + + _30_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _52_maiaInput + _52_taskMetaDataInput + + + _52_actualTaskOutput + _52_maiaOutput + _52_taskMetaDataOutput + + + + maia + _52_maiaInput + + + taskMetaData + _52_taskMetaDataInput + + + _52_actualTaskOutput + actualTask + + + _52_maiaOutput + maia + + + _52_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + _60_maiaInput + _60_taskMetaDataInput + + + _60_actualTaskOutput + _60_maiaOutput + _60_taskMetaDataOutput + + + + maia + _60_maiaInput + + + taskMetaData + _60_taskMetaDataInput + + + _60_actualTaskOutput + actualTask + + + _60_maiaOutput + maia + + + _60_taskMetaDataOutput + taskMetaData + + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + + + return ((String)maia.get("CONSTRUCCION")).compareTo("Y")!=0; + + + + + return ((String)maia.get("NOVACIONOK")).compareTo("Y")==0; + + + + + + return ((String)maia.get("NOVACIONOK")).compareTo("N")==0; + + + + return ((String)maia.get("CALIFICA")).compareTo("N")==0; + + + return ((String)maia.get("PLAZOFIN")).compareTo("Y")!=0; + + + return ((String)maia.get("CONSTRUCCION")).compareTo("Y")==0; + + + return ((String)maia.get("DESVIACION")).compareTo("Y")==0; + + + return ((String)maia.get("RETRASO")).compareTo("Y")==0; + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + + + return taskMetaData.getResponse().compareTo("D")!=0; + + + + + + + + return ((String)maia.get("PLAZOFIN")).compareTo("Y")==0; + + + + + return ((String)maia.get("OBRACONCLUIDA")).compareTo("Y")==0; + + + return ((String)maia.get("DECISION")).compareTo("G")==0; + + + + + + + + return taskMetaData.getResponse().compareTo("D")==0; + + + return ((String)maia.get("DECISION")).compareTo("N")==0; + + + + + + + + + + + + return ((String)maia.get("DESVIACION")).compareTo("Y")!=0; + + + + + + + return ((String)maia.get("OBRACONCLUIDA")).compareTo("N")==0; + + + + + + + + return ((String)maia.get("CALIFICA")).compareTo("Y")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/taskasign.bpmn b/base/bpm/flows/src/flows/flows/taskasign.bpmn new file mode 100644 index 0000000..15eccd6 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/taskasign.bpmn @@ -0,0 +1,279 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + _3_SkippableInput + _3_TaskNameInput + _3_GroupIdInput + + + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_SkippableInput + + false + _3_SkippableInput + + + + _3_TaskNameInput + + #{maia.request.subject} + _3_TaskNameInput + + + + _3_GroupIdInput + + #{taskMetaData.groupId} + _3_GroupIdInput + + + + _3_taskMetaDataOutput + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + return "A".equals(taskMetaData.getAction()); + + + + return !("A".equals(taskMetaData.getAction())); + + + return taskMetaData.getResponse().compareTo("R")!=0; + + + + return taskMetaData.getResponse().compareTo("R")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/test.bpmn b/base/bpm/flows/src/flows/flows/test.bpmn new file mode 100644 index 0000000..7d6dbef --- /dev/null +++ b/base/bpm/flows/src/flows/flows/test.bpmn @@ -0,0 +1,267 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _3_maiaInput + _3_taskMetaDataInput + _3_SkippableInput + _3_TaskNameInput + _3_GroupIdInput + + + _3_taskMetaDataOutput + + + + maia + _3_maiaInput + + + taskMetaData + _3_taskMetaDataInput + + + _3_SkippableInput + + false + _3_SkippableInput + + + + _3_TaskNameInput + + #{maia.request.subject} + _3_TaskNameInput + + + + _3_GroupIdInput + + #{taskMetaData.groupId} + _3_GroupIdInput + + + + _3_taskMetaDataOutput + taskMetaData + + + + #{taskMetaData.userId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + return "A".equals(taskMetaData.getAction()); + + + + return !("A".equals(taskMetaData.getAction())); + + + return taskMetaData.getResponse().compareTo("R")!=0; + + + + return taskMetaData.getResponse().compareTo("R")==0; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/flows/flows/testwpa.bpmn b/base/bpm/flows/src/flows/flows/testwpa.bpmn new file mode 100644 index 0000000..e17e776 --- /dev/null +++ b/base/bpm/flows/src/flows/flows/testwpa.bpmn @@ -0,0 +1,292 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _17_maiaInput + _17_taskMetaDataInput + + + _17_actualTaskOutput + _17_maiaOutput + _17_taskMetaDataOutput + + + + maia + _17_maiaInput + + + taskMetaData + _17_taskMetaDataInput + + + _17_actualTaskOutput + actualTask + + + _17_maiaOutput + maia + + + _17_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + + + + _21_maiaInput + _21_taskMetaDataInput + + + _21_actualTaskOutput + _21_maiaOutput + _21_taskMetaDataOutput + + + + maia + _21_maiaInput + + + taskMetaData + _21_taskMetaDataInput + + + _21_actualTaskOutput + actualTask + + + _21_maiaOutput + maia + + + _21_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + + + + + + + + _5_maiaInput + _5_taskMetaDataInput + + + _5_actualTaskOutput + _5_maiaOutput + _5_taskMetaDataOutput + + + + maia + _5_maiaInput + + + taskMetaData + _5_taskMetaDataInput + + + _5_actualTaskOutput + actualTask + + + _5_maiaOutput + maia + + + _5_taskMetaDataOutput + taskMetaData + + + + + + + + + + + + + System.out.println("AAAAA"+maia); +return (((String)maia.get("transaction")).compareTo("23")==0); + + + + System.out.println("BBBBB"+maia); +return (((String)maia.get("transaction")).compareTo("21")==0); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/base/bpm/flows/src/rules/.svn/entries b/base/bpm/flows/src/rules/.svn/entries new file mode 100644 index 0000000..9660435 --- /dev/null +++ b/base/bpm/flows/src/rules/.svn/entries @@ -0,0 +1,117 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/flows/src/rules +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TEST1 +dir + +gf.xls +file + + + + +2022-07-28T03:40:46.933821Z +865ae85b003dd151e0eabeb8dc0f47a7 +2014-09-11T06:03:34.339088Z +654 +jvaca +has-props + + + + + + + + + + + + + + + + + + + + +7680 + +ASIGNARCOMITE +dir + +VALIDAPLAZO +dir + +VALIDAPERSONA +dir + +VALIDATASA +dir + +ASIGNAROFICIAL +dir + +WPA.xls +file + + + + +2022-07-28T03:40:46.933821Z +b5ddbb0be429d39c4afb2f429bc9fd92 +2014-09-11T06:03:34.339088Z +654 +jvaca +has-props + + + + + + + + + + + + + + + + + + + + +7680 + +VALIDAMONTO +dir + diff --git a/base/bpm/flows/src/rules/.svn/prop-base/WPA.xls.svn-base b/base/bpm/flows/src/rules/.svn/prop-base/WPA.xls.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/base/bpm/flows/src/rules/.svn/prop-base/WPA.xls.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/base/bpm/flows/src/rules/.svn/prop-base/gf.xls.svn-base b/base/bpm/flows/src/rules/.svn/prop-base/gf.xls.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/base/bpm/flows/src/rules/.svn/prop-base/gf.xls.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/base/bpm/flows/src/rules/.svn/text-base/WPA.xls.svn-base b/base/bpm/flows/src/rules/.svn/text-base/WPA.xls.svn-base new file mode 100644 index 0000000..7029a8f Binary files /dev/null and b/base/bpm/flows/src/rules/.svn/text-base/WPA.xls.svn-base differ diff --git a/base/bpm/flows/src/rules/.svn/text-base/gf.xls.svn-base b/base/bpm/flows/src/rules/.svn/text-base/gf.xls.svn-base new file mode 100644 index 0000000..094df63 Binary files /dev/null and b/base/bpm/flows/src/rules/.svn/text-base/gf.xls.svn-base differ diff --git a/base/bpm/flows/src/rules/ASIGNARCOMITE/.svn/entries b/base/bpm/flows/src/rules/ASIGNARCOMITE/.svn/entries new file mode 100644 index 0000000..c0310a7 --- /dev/null +++ b/base/bpm/flows/src/rules/ASIGNARCOMITE/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/flows/src/rules/ASIGNARCOMITE +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +asign.xls +file + + + + +2022-07-28T03:40:46.868821Z +5cd9041b5e5b17d7b4112cafea8b63b0 +2014-09-11T06:03:34.339088Z +654 +jvaca +has-props + + + + + + + + + + + + + + + + + + + + +11776 + diff --git a/base/bpm/flows/src/rules/ASIGNARCOMITE/.svn/prop-base/asign.xls.svn-base b/base/bpm/flows/src/rules/ASIGNARCOMITE/.svn/prop-base/asign.xls.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/base/bpm/flows/src/rules/ASIGNARCOMITE/.svn/prop-base/asign.xls.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/base/bpm/flows/src/rules/ASIGNARCOMITE/.svn/text-base/asign.xls.svn-base b/base/bpm/flows/src/rules/ASIGNARCOMITE/.svn/text-base/asign.xls.svn-base new file mode 100644 index 0000000..cfef665 Binary files /dev/null and b/base/bpm/flows/src/rules/ASIGNARCOMITE/.svn/text-base/asign.xls.svn-base differ diff --git a/base/bpm/flows/src/rules/ASIGNARCOMITE/asign.xls b/base/bpm/flows/src/rules/ASIGNARCOMITE/asign.xls new file mode 100644 index 0000000..cfef665 Binary files /dev/null and b/base/bpm/flows/src/rules/ASIGNARCOMITE/asign.xls differ diff --git a/base/bpm/flows/src/rules/ASIGNAROFICIAL/.svn/entries b/base/bpm/flows/src/rules/ASIGNAROFICIAL/.svn/entries new file mode 100644 index 0000000..260e83c --- /dev/null +++ b/base/bpm/flows/src/rules/ASIGNAROFICIAL/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/flows/src/rules/ASIGNAROFICIAL +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +asign.xls +file + + + + +2022-07-28T03:40:46.917821Z +4b717b1530d10d022fcd71afd5d6ddf3 +2014-09-11T06:03:34.339088Z +654 +jvaca +has-props + + + + + + + + + + + + + + + + + + + + +7680 + diff --git a/base/bpm/flows/src/rules/ASIGNAROFICIAL/.svn/prop-base/asign.xls.svn-base b/base/bpm/flows/src/rules/ASIGNAROFICIAL/.svn/prop-base/asign.xls.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/base/bpm/flows/src/rules/ASIGNAROFICIAL/.svn/prop-base/asign.xls.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/base/bpm/flows/src/rules/ASIGNAROFICIAL/.svn/text-base/asign.xls.svn-base b/base/bpm/flows/src/rules/ASIGNAROFICIAL/.svn/text-base/asign.xls.svn-base new file mode 100644 index 0000000..caa783f Binary files /dev/null and b/base/bpm/flows/src/rules/ASIGNAROFICIAL/.svn/text-base/asign.xls.svn-base differ diff --git a/base/bpm/flows/src/rules/ASIGNAROFICIAL/asign.xls b/base/bpm/flows/src/rules/ASIGNAROFICIAL/asign.xls new file mode 100644 index 0000000..caa783f Binary files /dev/null and b/base/bpm/flows/src/rules/ASIGNAROFICIAL/asign.xls differ diff --git a/base/bpm/flows/src/rules/TEST1/.svn/entries b/base/bpm/flows/src/rules/TEST1/.svn/entries new file mode 100644 index 0000000..04303d4 --- /dev/null +++ b/base/bpm/flows/src/rules/TEST1/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/flows/src/rules/TEST1 +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +asign.xls +file + + + + +2022-07-28T03:40:46.861821Z +b5c694da29c990d538717e6ecb77ff68 +2014-09-11T06:03:34.339088Z +654 +jvaca +has-props + + + + + + + + + + + + + + + + + + + + +39424 + diff --git a/base/bpm/flows/src/rules/TEST1/.svn/prop-base/asign.xls.svn-base b/base/bpm/flows/src/rules/TEST1/.svn/prop-base/asign.xls.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/base/bpm/flows/src/rules/TEST1/.svn/prop-base/asign.xls.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/base/bpm/flows/src/rules/TEST1/.svn/text-base/asign.xls.svn-base b/base/bpm/flows/src/rules/TEST1/.svn/text-base/asign.xls.svn-base new file mode 100644 index 0000000..be6a60f Binary files /dev/null and b/base/bpm/flows/src/rules/TEST1/.svn/text-base/asign.xls.svn-base differ diff --git a/base/bpm/flows/src/rules/TEST1/asign.xls b/base/bpm/flows/src/rules/TEST1/asign.xls new file mode 100644 index 0000000..be6a60f Binary files /dev/null and b/base/bpm/flows/src/rules/TEST1/asign.xls differ diff --git a/base/bpm/flows/src/rules/VALIDAMONTO/.svn/entries b/base/bpm/flows/src/rules/VALIDAMONTO/.svn/entries new file mode 100644 index 0000000..5437d51 --- /dev/null +++ b/base/bpm/flows/src/rules/VALIDAMONTO/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/flows/src/rules/VALIDAMONTO +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +asign.xls +file + + + + +2022-07-28T03:40:46.926821Z +23c99ef0cbf631799c554c16fa15ec2f +2014-09-11T06:03:34.339088Z +654 +jvaca +has-props + + + + + + + + + + + + + + + + + + + + +13824 + diff --git a/base/bpm/flows/src/rules/VALIDAMONTO/.svn/prop-base/asign.xls.svn-base b/base/bpm/flows/src/rules/VALIDAMONTO/.svn/prop-base/asign.xls.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/base/bpm/flows/src/rules/VALIDAMONTO/.svn/prop-base/asign.xls.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/base/bpm/flows/src/rules/VALIDAMONTO/.svn/text-base/asign.xls.svn-base b/base/bpm/flows/src/rules/VALIDAMONTO/.svn/text-base/asign.xls.svn-base new file mode 100644 index 0000000..a023325 Binary files /dev/null and b/base/bpm/flows/src/rules/VALIDAMONTO/.svn/text-base/asign.xls.svn-base differ diff --git a/base/bpm/flows/src/rules/VALIDAMONTO/asign.xls b/base/bpm/flows/src/rules/VALIDAMONTO/asign.xls new file mode 100644 index 0000000..a023325 Binary files /dev/null and b/base/bpm/flows/src/rules/VALIDAMONTO/asign.xls differ diff --git a/base/bpm/flows/src/rules/VALIDAPERSONA/.svn/entries b/base/bpm/flows/src/rules/VALIDAPERSONA/.svn/entries new file mode 100644 index 0000000..4ee9394 --- /dev/null +++ b/base/bpm/flows/src/rules/VALIDAPERSONA/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/flows/src/rules/VALIDAPERSONA +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +asign.xls +file + + + + +2022-07-28T03:40:46.895821Z +ddaeb5c1bdb550d690063392d1c395d4 +2014-09-11T06:03:34.339088Z +654 +jvaca +has-props + + + + + + + + + + + + + + + + + + + + +20992 + diff --git a/base/bpm/flows/src/rules/VALIDAPERSONA/.svn/prop-base/asign.xls.svn-base b/base/bpm/flows/src/rules/VALIDAPERSONA/.svn/prop-base/asign.xls.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/base/bpm/flows/src/rules/VALIDAPERSONA/.svn/prop-base/asign.xls.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/base/bpm/flows/src/rules/VALIDAPERSONA/.svn/text-base/asign.xls.svn-base b/base/bpm/flows/src/rules/VALIDAPERSONA/.svn/text-base/asign.xls.svn-base new file mode 100644 index 0000000..2987fc7 Binary files /dev/null and b/base/bpm/flows/src/rules/VALIDAPERSONA/.svn/text-base/asign.xls.svn-base differ diff --git a/base/bpm/flows/src/rules/VALIDAPERSONA/asign.xls b/base/bpm/flows/src/rules/VALIDAPERSONA/asign.xls new file mode 100644 index 0000000..2987fc7 Binary files /dev/null and b/base/bpm/flows/src/rules/VALIDAPERSONA/asign.xls differ diff --git a/base/bpm/flows/src/rules/VALIDAPLAZO/.svn/entries b/base/bpm/flows/src/rules/VALIDAPLAZO/.svn/entries new file mode 100644 index 0000000..c6b997c --- /dev/null +++ b/base/bpm/flows/src/rules/VALIDAPLAZO/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/flows/src/rules/VALIDAPLAZO +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +asign.xls +file + + + + +2022-07-28T03:40:46.877821Z +c1fe2864c18ccc31b1ba3c8270ed0299 +2014-09-11T06:03:34.339088Z +654 +jvaca +has-props + + + + + + + + + + + + + + + + + + + + +9216 + diff --git a/base/bpm/flows/src/rules/VALIDAPLAZO/.svn/prop-base/asign.xls.svn-base b/base/bpm/flows/src/rules/VALIDAPLAZO/.svn/prop-base/asign.xls.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/base/bpm/flows/src/rules/VALIDAPLAZO/.svn/prop-base/asign.xls.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/base/bpm/flows/src/rules/VALIDAPLAZO/.svn/text-base/asign.xls.svn-base b/base/bpm/flows/src/rules/VALIDAPLAZO/.svn/text-base/asign.xls.svn-base new file mode 100644 index 0000000..fa0c9db Binary files /dev/null and b/base/bpm/flows/src/rules/VALIDAPLAZO/.svn/text-base/asign.xls.svn-base differ diff --git a/base/bpm/flows/src/rules/VALIDAPLAZO/asign.xls b/base/bpm/flows/src/rules/VALIDAPLAZO/asign.xls new file mode 100644 index 0000000..fa0c9db Binary files /dev/null and b/base/bpm/flows/src/rules/VALIDAPLAZO/asign.xls differ diff --git a/base/bpm/flows/src/rules/VALIDATASA/.svn/entries b/base/bpm/flows/src/rules/VALIDATASA/.svn/entries new file mode 100644 index 0000000..759c208 --- /dev/null +++ b/base/bpm/flows/src/rules/VALIDATASA/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/flows/src/rules/VALIDATASA +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +asign.xls +file + + + + +2022-07-28T03:40:46.903821Z +3526ede324ab74519d69a23583a2b7c8 +2014-09-11T06:03:34.339088Z +654 +jvaca +has-props + + + + + + + + + + + + + + + + + + + + +8704 + diff --git a/base/bpm/flows/src/rules/VALIDATASA/.svn/prop-base/asign.xls.svn-base b/base/bpm/flows/src/rules/VALIDATASA/.svn/prop-base/asign.xls.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/base/bpm/flows/src/rules/VALIDATASA/.svn/prop-base/asign.xls.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/base/bpm/flows/src/rules/VALIDATASA/.svn/text-base/asign.xls.svn-base b/base/bpm/flows/src/rules/VALIDATASA/.svn/text-base/asign.xls.svn-base new file mode 100644 index 0000000..0cbca81 Binary files /dev/null and b/base/bpm/flows/src/rules/VALIDATASA/.svn/text-base/asign.xls.svn-base differ diff --git a/base/bpm/flows/src/rules/VALIDATASA/asign.xls b/base/bpm/flows/src/rules/VALIDATASA/asign.xls new file mode 100644 index 0000000..0cbca81 Binary files /dev/null and b/base/bpm/flows/src/rules/VALIDATASA/asign.xls differ diff --git a/base/bpm/flows/src/rules/WPA.xls b/base/bpm/flows/src/rules/WPA.xls new file mode 100644 index 0000000..7029a8f Binary files /dev/null and b/base/bpm/flows/src/rules/WPA.xls differ diff --git a/base/bpm/flows/src/rules/gf.xls b/base/bpm/flows/src/rules/gf.xls new file mode 100644 index 0000000..094df63 Binary files /dev/null and b/base/bpm/flows/src/rules/gf.xls differ diff --git a/base/bpm/pom.xml b/base/bpm/pom.xml new file mode 100644 index 0000000..2537b32 --- /dev/null +++ b/base/bpm/pom.xml @@ -0,0 +1,22 @@ + + + + base + com.fp + 2.1 + + 4.0.0 + com.fp.base + bpm + bpm-jbpm + 2.1 + pom + BPM + + bpmlib + simple + + diff --git a/base/bpm/simple/.pmd b/base/bpm/simple/.pmd new file mode 100644 index 0000000..adb6f50 --- /dev/null +++ b/base/bpm/simple/.pmd @@ -0,0 +1,613 @@ + + + false + .ruleset + + + LooseCoupling + Type Resolution Rules + + + CloneMethodMustImplementCloneable + Type Resolution Rules + + + UnusedImports + Type Resolution Rules + + + IfStmtsMustUseBraces + Braces Rules + + + WhileLoopsMustUseBraces + Braces Rules + + + IfElseStmtsMustUseBraces + Braces Rules + + + ForLoopsMustUseBraces + Braces Rules + + + UseSingleton + Design Rules + + + SimplifyBooleanReturns + Design Rules + + + SimplifyBooleanExpressions + Design Rules + + + SwitchStmtsShouldHaveDefault + Design Rules + + + AvoidDeeplyNestedIfStmts + Design Rules + + + SwitchDensity + Design Rules + + + AccessorClassGeneration + Design Rules + + + FinalFieldCouldBeStatic + Design Rules + + + CloseResource + Design Rules + + + NonStaticInitializer + Design Rules + + + DefaultLabelNotLastInSwitchStmt + Design Rules + + + NonCaseLabelInSwitchStatement + Design Rules + + + OptimizableToArrayCall + Design Rules + + + BadComparison + Design Rules + + + EqualsNull + Design Rules + + + InstantiationToGetClass + Design Rules + + + IdempotentOperations + Design Rules + + + AvoidProtectedFieldInFinalClass + Design Rules + + + MissingStaticMethodInNonInstantiatableClass + Design Rules + + + MissingBreakInSwitch + Design Rules + + + UseNotifyAllInsteadOfNotify + Design Rules + + + AvoidInstanceofChecksInCatchClause + Design Rules + + + AbstractClassWithoutAbstractMethod + Design Rules + + + SimplifyConditional + Design Rules + + + CompareObjectsWithEquals + Design Rules + + + PositionLiteralsFirstInComparisons + Design Rules + + + UnnecessaryLocalBeforeReturn + Design Rules + + + NonThreadSafeSingleton + Design Rules + + + UncommentedEmptyMethod + Design Rules + + + AvoidConstantsInterface + Design Rules + + + UnsynchronizedStaticDateFormatter + Design Rules + + + PreserveStackTrace + Design Rules + + + UseCollectionIsEmpty + Design Rules + + + ClassWithOnlyPrivateConstructorsShouldBeFinal + Design Rules + + + EmptyMethodInAbstractClassShouldBeAbstract + Design Rules + + + SingularField + Design Rules + + + ReturnEmptyArrayRatherThanNull + Design Rules + + + AbstractClassWithoutAnyMethod + Design Rules + + + TooFewBranchesForASwitchStatement + Design Rules + + + UnusedPrivateField + Unused Code Rules + + + UnusedLocalVariable + Unused Code Rules + + + UnusedPrivateMethod + Unused Code Rules + + + UnusedFormalParameter + Unused Code Rules + + + MoreThanOneLogger + Java Logging Rules + + + LoggerIsNotStaticFinal + Java Logging Rules + + + SystemPrintln + Java Logging Rules + + + AvoidPrintStackTrace + Java Logging Rules + + + AvoidDuplicateLiterals + String and StringBuffer Rules + + + StringToString + String and StringBuffer Rules + + + InefficientStringBuffering + String and StringBuffer Rules + + + UnnecessaryCaseChange + String and StringBuffer Rules + + + UseStringBufferLength + String and StringBuffer Rules + + + AppendCharacterWithChar + String and StringBuffer Rules + + + ConsecutiveLiteralAppends + String and StringBuffer Rules + + + UseIndexOfChar + String and StringBuffer Rules + + + InefficientEmptyStringCheck + String and StringBuffer Rules + + + InsufficientStringBufferDeclaration + String and StringBuffer Rules + + + UselessStringValueOf + String and StringBuffer Rules + + + StringBufferInstantiationWithChar + String and StringBuffer Rules + + + UseEqualsToCompareStrings + String and StringBuffer Rules + + + AvoidStringBufferField + String and StringBuffer Rules + + + ReplaceVectorWithList + Migration Rules + + + ReplaceHashtableWithMap + Migration Rules + + + ReplaceEnumerationWithIterator + Migration Rules + + + AvoidEnumAsIdentifier + Migration Rules + + + AvoidAssertAsIdentifier + Migration Rules + + + IntegerInstantiation + Migration Rules + + + ByteInstantiation + Migration Rules + + + ShortInstantiation + Migration Rules + + + LongInstantiation + Migration Rules + + + JUnit4TestShouldUseBeforeAnnotation + Migration Rules + + + JUnit4TestShouldUseAfterAnnotation + Migration Rules + + + JUnit4TestShouldUseTestAnnotation + Migration Rules + + + JUnit4SuitesShouldUseSuiteAnnotation + Migration Rules + + + JUnitUseExpected + Migration Rules + + + EmptyIfStmt + Basic Rules + + + EmptyWhileStmt + Basic Rules + + + EmptyTryBlock + Basic Rules + + + EmptyFinallyBlock + Basic Rules + + + EmptySwitchStatements + Basic Rules + + + JumbledIncrementer + Basic Rules + + + ForLoopShouldBeWhileLoop + Basic Rules + + + UnnecessaryConversionTemporary + Basic Rules + + + OverrideBothEqualsAndHashcode + Basic Rules + + + DoubleCheckedLocking + Basic Rules + + + ReturnFromFinallyBlock + Basic Rules + + + EmptySynchronizedBlock + Basic Rules + + + UnnecessaryReturn + Basic Rules + + + EmptyStaticInitializer + Basic Rules + + + UnconditionalIfStatement + Basic Rules + + + EmptyStatementNotInLoop + Basic Rules + + + BooleanInstantiation + Basic Rules + + + UnnecessaryFinalModifier + Basic Rules + + + CollapsibleIfStatements + Basic Rules + + + UselessOverridingMethod + Basic Rules + + + ClassCastExceptionWithToArray + Basic Rules + + + AvoidDecimalLiteralsInBigDecimalConstructor + Basic Rules + + + UselessOperationOnImmutable + Basic Rules + + + MisplacedNullCheck + Basic Rules + + + UnusedNullCheckInEquals + Basic Rules + + + AvoidThreadGroup + Basic Rules + + + BrokenNullCheck + Basic Rules + + + AvoidUsingOctalValues + Basic Rules + + + AvoidUsingHardCodedIP + Basic Rules + + + CheckResultSet + Basic Rules + + + AvoidMultipleUnaryOperators + Basic Rules + + + EmptyInitializer + Basic Rules + + + LooseCoupling + Type Resolution Rules + + + UnusedImports + Type Resolution Rules + + + UnnecessaryConstructor + Controversial Rules + + + UnusedModifier + Controversial Rules + + + AssignmentInOperand + Controversial Rules + + + AtLeastOneConstructor + Controversial Rules + + + DontImportSun + Controversial Rules + + + SuspiciousOctalEscape + Controversial Rules + + + DefaultPackage + Controversial Rules + + + BooleanInversion + Controversial Rules + + + AvoidFinalLocalVariable + Controversial Rules + + + AvoidUsingShortType + Controversial Rules + + + AvoidUsingVolatile + Controversial Rules + + + AvoidUsingNativeCode + Controversial Rules + + + AvoidAccessibilityAlteration + Controversial Rules + + + DoNotCallGarbageCollectionExplicitly + Controversial Rules + + + VariableNamingConventions + Naming Rules + + + MethodNamingConventions + Naming Rules + + + ClassNamingConventions + Naming Rules + + + AvoidDollarSigns + Naming Rules + + + MethodWithSameNameAsEnclosingClass + Naming Rules + + + SuspiciousHashcodeMethodName + Naming Rules + + + SuspiciousConstantFieldName + Naming Rules + + + SuspiciousEqualsMethodName + Naming Rules + + + AvoidFieldNameMatchingTypeName + Naming Rules + + + AvoidFieldNameMatchingMethodName + Naming Rules + + + NoPackage + Naming Rules + + + PackageCase + Naming Rules + + + MisleadingVariableName + Naming Rules + + + BooleanGetMethodName + Naming Rules + + + NPathComplexity + Code Size Rules + + + ExcessiveMethodLength + Code Size Rules + + + CyclomaticComplexity + Code Size Rules + + + NcssMethodCount + Code Size Rules + + + NcssTypeCount + Code Size Rules + + + NcssConstructorCount + Code Size Rules + + + CloneMethodMustImplementCloneable + Type Resolution Rules + + + false + true + diff --git a/base/bpm/simple/.svn/dir-prop-base b/base/bpm/simple/.svn/dir-prop-base new file mode 100644 index 0000000..3e2a6f2 --- /dev/null +++ b/base/bpm/simple/.svn/dir-prop-base @@ -0,0 +1,9 @@ +K 10 +svn:ignore +V 37 +.classpath +.project +.settings +target + +END diff --git a/base/bpm/simple/.svn/entries b/base/bpm/simple/.svn/entries new file mode 100644 index 0000000..d195796 --- /dev/null +++ b/base/bpm/simple/.svn/entries @@ -0,0 +1,99 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/simple +svn://172.17.26.185/COMACO + + + +2014-09-11T07:10:36.966828Z +671 +jvaca +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:46.470819Z +76af5adb7d2e55ad10731f25fcea27ae +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +766 + +.pmd +file + + + + +2022-07-28T03:40:46.470819Z +a9dbba58778935cb0547c1124c02ee10 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +19385 + diff --git a/base/bpm/simple/.svn/text-base/.pmd.svn-base b/base/bpm/simple/.svn/text-base/.pmd.svn-base new file mode 100644 index 0000000..adb6f50 --- /dev/null +++ b/base/bpm/simple/.svn/text-base/.pmd.svn-base @@ -0,0 +1,613 @@ + + + false + .ruleset + + + LooseCoupling + Type Resolution Rules + + + CloneMethodMustImplementCloneable + Type Resolution Rules + + + UnusedImports + Type Resolution Rules + + + IfStmtsMustUseBraces + Braces Rules + + + WhileLoopsMustUseBraces + Braces Rules + + + IfElseStmtsMustUseBraces + Braces Rules + + + ForLoopsMustUseBraces + Braces Rules + + + UseSingleton + Design Rules + + + SimplifyBooleanReturns + Design Rules + + + SimplifyBooleanExpressions + Design Rules + + + SwitchStmtsShouldHaveDefault + Design Rules + + + AvoidDeeplyNestedIfStmts + Design Rules + + + SwitchDensity + Design Rules + + + AccessorClassGeneration + Design Rules + + + FinalFieldCouldBeStatic + Design Rules + + + CloseResource + Design Rules + + + NonStaticInitializer + Design Rules + + + DefaultLabelNotLastInSwitchStmt + Design Rules + + + NonCaseLabelInSwitchStatement + Design Rules + + + OptimizableToArrayCall + Design Rules + + + BadComparison + Design Rules + + + EqualsNull + Design Rules + + + InstantiationToGetClass + Design Rules + + + IdempotentOperations + Design Rules + + + AvoidProtectedFieldInFinalClass + Design Rules + + + MissingStaticMethodInNonInstantiatableClass + Design Rules + + + MissingBreakInSwitch + Design Rules + + + UseNotifyAllInsteadOfNotify + Design Rules + + + AvoidInstanceofChecksInCatchClause + Design Rules + + + AbstractClassWithoutAbstractMethod + Design Rules + + + SimplifyConditional + Design Rules + + + CompareObjectsWithEquals + Design Rules + + + PositionLiteralsFirstInComparisons + Design Rules + + + UnnecessaryLocalBeforeReturn + Design Rules + + + NonThreadSafeSingleton + Design Rules + + + UncommentedEmptyMethod + Design Rules + + + AvoidConstantsInterface + Design Rules + + + UnsynchronizedStaticDateFormatter + Design Rules + + + PreserveStackTrace + Design Rules + + + UseCollectionIsEmpty + Design Rules + + + ClassWithOnlyPrivateConstructorsShouldBeFinal + Design Rules + + + EmptyMethodInAbstractClassShouldBeAbstract + Design Rules + + + SingularField + Design Rules + + + ReturnEmptyArrayRatherThanNull + Design Rules + + + AbstractClassWithoutAnyMethod + Design Rules + + + TooFewBranchesForASwitchStatement + Design Rules + + + UnusedPrivateField + Unused Code Rules + + + UnusedLocalVariable + Unused Code Rules + + + UnusedPrivateMethod + Unused Code Rules + + + UnusedFormalParameter + Unused Code Rules + + + MoreThanOneLogger + Java Logging Rules + + + LoggerIsNotStaticFinal + Java Logging Rules + + + SystemPrintln + Java Logging Rules + + + AvoidPrintStackTrace + Java Logging Rules + + + AvoidDuplicateLiterals + String and StringBuffer Rules + + + StringToString + String and StringBuffer Rules + + + InefficientStringBuffering + String and StringBuffer Rules + + + UnnecessaryCaseChange + String and StringBuffer Rules + + + UseStringBufferLength + String and StringBuffer Rules + + + AppendCharacterWithChar + String and StringBuffer Rules + + + ConsecutiveLiteralAppends + String and StringBuffer Rules + + + UseIndexOfChar + String and StringBuffer Rules + + + InefficientEmptyStringCheck + String and StringBuffer Rules + + + InsufficientStringBufferDeclaration + String and StringBuffer Rules + + + UselessStringValueOf + String and StringBuffer Rules + + + StringBufferInstantiationWithChar + String and StringBuffer Rules + + + UseEqualsToCompareStrings + String and StringBuffer Rules + + + AvoidStringBufferField + String and StringBuffer Rules + + + ReplaceVectorWithList + Migration Rules + + + ReplaceHashtableWithMap + Migration Rules + + + ReplaceEnumerationWithIterator + Migration Rules + + + AvoidEnumAsIdentifier + Migration Rules + + + AvoidAssertAsIdentifier + Migration Rules + + + IntegerInstantiation + Migration Rules + + + ByteInstantiation + Migration Rules + + + ShortInstantiation + Migration Rules + + + LongInstantiation + Migration Rules + + + JUnit4TestShouldUseBeforeAnnotation + Migration Rules + + + JUnit4TestShouldUseAfterAnnotation + Migration Rules + + + JUnit4TestShouldUseTestAnnotation + Migration Rules + + + JUnit4SuitesShouldUseSuiteAnnotation + Migration Rules + + + JUnitUseExpected + Migration Rules + + + EmptyIfStmt + Basic Rules + + + EmptyWhileStmt + Basic Rules + + + EmptyTryBlock + Basic Rules + + + EmptyFinallyBlock + Basic Rules + + + EmptySwitchStatements + Basic Rules + + + JumbledIncrementer + Basic Rules + + + ForLoopShouldBeWhileLoop + Basic Rules + + + UnnecessaryConversionTemporary + Basic Rules + + + OverrideBothEqualsAndHashcode + Basic Rules + + + DoubleCheckedLocking + Basic Rules + + + ReturnFromFinallyBlock + Basic Rules + + + EmptySynchronizedBlock + Basic Rules + + + UnnecessaryReturn + Basic Rules + + + EmptyStaticInitializer + Basic Rules + + + UnconditionalIfStatement + Basic Rules + + + EmptyStatementNotInLoop + Basic Rules + + + BooleanInstantiation + Basic Rules + + + UnnecessaryFinalModifier + Basic Rules + + + CollapsibleIfStatements + Basic Rules + + + UselessOverridingMethod + Basic Rules + + + ClassCastExceptionWithToArray + Basic Rules + + + AvoidDecimalLiteralsInBigDecimalConstructor + Basic Rules + + + UselessOperationOnImmutable + Basic Rules + + + MisplacedNullCheck + Basic Rules + + + UnusedNullCheckInEquals + Basic Rules + + + AvoidThreadGroup + Basic Rules + + + BrokenNullCheck + Basic Rules + + + AvoidUsingOctalValues + Basic Rules + + + AvoidUsingHardCodedIP + Basic Rules + + + CheckResultSet + Basic Rules + + + AvoidMultipleUnaryOperators + Basic Rules + + + EmptyInitializer + Basic Rules + + + LooseCoupling + Type Resolution Rules + + + UnusedImports + Type Resolution Rules + + + UnnecessaryConstructor + Controversial Rules + + + UnusedModifier + Controversial Rules + + + AssignmentInOperand + Controversial Rules + + + AtLeastOneConstructor + Controversial Rules + + + DontImportSun + Controversial Rules + + + SuspiciousOctalEscape + Controversial Rules + + + DefaultPackage + Controversial Rules + + + BooleanInversion + Controversial Rules + + + AvoidFinalLocalVariable + Controversial Rules + + + AvoidUsingShortType + Controversial Rules + + + AvoidUsingVolatile + Controversial Rules + + + AvoidUsingNativeCode + Controversial Rules + + + AvoidAccessibilityAlteration + Controversial Rules + + + DoNotCallGarbageCollectionExplicitly + Controversial Rules + + + VariableNamingConventions + Naming Rules + + + MethodNamingConventions + Naming Rules + + + ClassNamingConventions + Naming Rules + + + AvoidDollarSigns + Naming Rules + + + MethodWithSameNameAsEnclosingClass + Naming Rules + + + SuspiciousHashcodeMethodName + Naming Rules + + + SuspiciousConstantFieldName + Naming Rules + + + SuspiciousEqualsMethodName + Naming Rules + + + AvoidFieldNameMatchingTypeName + Naming Rules + + + AvoidFieldNameMatchingMethodName + Naming Rules + + + NoPackage + Naming Rules + + + PackageCase + Naming Rules + + + MisleadingVariableName + Naming Rules + + + BooleanGetMethodName + Naming Rules + + + NPathComplexity + Code Size Rules + + + ExcessiveMethodLength + Code Size Rules + + + CyclomaticComplexity + Code Size Rules + + + NcssMethodCount + Code Size Rules + + + NcssTypeCount + Code Size Rules + + + NcssConstructorCount + Code Size Rules + + + CloneMethodMustImplementCloneable + Type Resolution Rules + + + false + true + diff --git a/base/bpm/simple/.svn/text-base/pom.xml.svn-base b/base/bpm/simple/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..49f94a0 --- /dev/null +++ b/base/bpm/simple/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,22 @@ + + + + bpm + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.bpm + simple + fp Platform - Simple - destinado a ser llamado desde Guvnor + + + com.fp.base.dto + dto + ${project.version} + + + diff --git a/base/bpm/simple/pom.xml b/base/bpm/simple/pom.xml new file mode 100644 index 0000000..49f94a0 --- /dev/null +++ b/base/bpm/simple/pom.xml @@ -0,0 +1,22 @@ + + + + bpm + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.bpm + simple + fp Platform - Simple - destinado a ser llamado desde Guvnor + + + com.fp.base.dto + dto + ${project.version} + + + diff --git a/base/bpm/simple/src/.svn/entries b/base/bpm/simple/src/.svn/entries new file mode 100644 index 0000000..6201c51 --- /dev/null +++ b/base/bpm/simple/src/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/simple/src +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +main +dir + diff --git a/base/bpm/simple/src/main/.svn/entries b/base/bpm/simple/src/main/.svn/entries new file mode 100644 index 0000000..8181c23 --- /dev/null +++ b/base/bpm/simple/src/main/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/simple/src/main +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + diff --git a/base/bpm/simple/src/main/java/.svn/entries b/base/bpm/simple/src/main/java/.svn/entries new file mode 100644 index 0000000..0ba06db --- /dev/null +++ b/base/bpm/simple/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/simple/src/main/java +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/bpm/simple/src/main/java/com/.svn/entries b/base/bpm/simple/src/main/java/com/.svn/entries new file mode 100644 index 0000000..70a1c17 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/simple/src/main/java/com +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/bpm/simple/src/main/java/com/fp/.svn/entries b/base/bpm/simple/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..f389328 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/simple/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +simple +dir + diff --git a/base/bpm/simple/src/main/java/com/fp/simple/.svn/entries b/base/bpm/simple/src/main/java/com/fp/simple/.svn/entries new file mode 100644 index 0000000..6aa4501 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/.svn/entries @@ -0,0 +1,43 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/simple/src/main/java/com/fp/simple +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +dto +dir + +flow +dir + +maia +dir + +action +dir + diff --git a/base/bpm/simple/src/main/java/com/fp/simple/action/.svn/entries b/base/bpm/simple/src/main/java/com/fp/simple/action/.svn/entries new file mode 100644 index 0000000..b8ab0e1 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/action/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/simple/src/main/java/com/fp/simple/action +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TaskAction.java +file + + + + +2022-07-28T03:40:46.413819Z +7ef474dc8ee4a9a908def632d1fed303 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +649 + diff --git a/base/bpm/simple/src/main/java/com/fp/simple/action/.svn/text-base/TaskAction.java.svn-base b/base/bpm/simple/src/main/java/com/fp/simple/action/.svn/text-base/TaskAction.java.svn-base new file mode 100644 index 0000000..427aca3 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/action/.svn/text-base/TaskAction.java.svn-base @@ -0,0 +1,19 @@ +package com.fp.simple.action; + +/** + * Accion a extender en las clases encargadas de obtener codigos de usuarios o grupos de responsables de ejecutar tareas + * de un flujo de trabajo. + * + * @version 2.1 + */ +public abstract class TaskAction { + + /** + * Metodo que se encarga de obtener el usaurio o grupo responsable de la ejecucion de una tarea, el usuario o grupo + * se tiene que fijar en el request. + * + * @param pParam Request con el que se ejecuta una transaccion al cual se asocia un usuario o grupo. + * @throws Exception + */ + public abstract void assignOwner(Object pParam) throws Exception; +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/action/TaskAction.java b/base/bpm/simple/src/main/java/com/fp/simple/action/TaskAction.java new file mode 100644 index 0000000..427aca3 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/action/TaskAction.java @@ -0,0 +1,19 @@ +package com.fp.simple.action; + +/** + * Accion a extender en las clases encargadas de obtener codigos de usuarios o grupos de responsables de ejecutar tareas + * de un flujo de trabajo. + * + * @version 2.1 + */ +public abstract class TaskAction { + + /** + * Metodo que se encarga de obtener el usaurio o grupo responsable de la ejecucion de una tarea, el usuario o grupo + * se tiene que fijar en el request. + * + * @param pParam Request con el que se ejecuta una transaccion al cual se asocia un usuario o grupo. + * @throws Exception + */ + public abstract void assignOwner(Object pParam) throws Exception; +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/dto/.svn/entries b/base/bpm/simple/src/main/java/com/fp/simple/dto/.svn/entries new file mode 100644 index 0000000..d30f5f5 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/dto/.svn/entries @@ -0,0 +1,167 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/simple/src/main/java/com/fp/simple/dto +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +metadata +dir + +Responses.java +file + + + + +2022-07-28T03:40:46.381819Z +06f29a0b32ac0440504b08e5addaf3dc +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +1082 + +package-info.java +file + + + + +2022-07-28T03:40:46.381819Z +ad1a29df6ca6b98279817ba40b9248c5 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +89 + +Kind.java +file + + + + +2022-07-28T03:40:46.381819Z +6ad7843254ac3ec51c513736a5766e14 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +378 + +TaskInfo.java +file + + + + +2022-07-28T03:40:46.381819Z +21885844fc7c82461494cd5ab446f7eb +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +13066 + diff --git a/base/bpm/simple/src/main/java/com/fp/simple/dto/.svn/text-base/Kind.java.svn-base b/base/bpm/simple/src/main/java/com/fp/simple/dto/.svn/text-base/Kind.java.svn-base new file mode 100644 index 0000000..7d6653b --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/dto/.svn/text-base/Kind.java.svn-base @@ -0,0 +1,22 @@ +/* + * + */ +package com.fp.simple.dto; + +// TODO: Auto-generated Javadoc +/** + * Enum Kind encargada de definir el comportamiento de una Tarea dentro de la Agenda. + * + * @author gfiallos + */ +public enum Kind { + + /** Simplemente dar paso. */ + OK, + + /** Autorización requerida. */ + OK_NO, + + /** Autrización requerida con opción a revisión. */ + OK_NO_REVIEW; +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/dto/.svn/text-base/Responses.java.svn-base b/base/bpm/simple/src/main/java/com/fp/simple/dto/.svn/text-base/Responses.java.svn-base new file mode 100644 index 0000000..b5382d0 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/dto/.svn/text-base/Responses.java.svn-base @@ -0,0 +1,58 @@ +/* + * + */ +package com.fp.simple.dto; + +// TODO: Auto-generated Javadoc +/** + * Enum Responses encargada de. + * + * @author gfiallos + */ +public enum Responses { + + /** El valor de OK. */ + OK("A"), + /** El valor de NO. */ + NO("D"), + /** El valor de NO. */ + MOD("M"), + /** El valor de REVIEW. */ + REVIEW("R"); + + /** El valor de code. */ + private String code; + + /** + * Crea una nueva instancia de responses. + * + * @param pCode the code + */ + private Responses(String pCode) { + code = pCode; + } + + /** + * Entrega el valor de code. + * + * @return Valor de code + */ + public String getCode() { + return code; + } + + /** + * Find response. + * + * @param pCode the code + * @return responses + */ + public static Responses findResponse(String pCode) { + for (Responses resp : Responses.values()) { + if (resp.getCode().compareTo(pCode) == 0) { + return resp; + } + } + throw new RuntimeException(pCode + " NO SOPORTADO"); + } +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/dto/.svn/text-base/TaskInfo.java.svn-base b/base/bpm/simple/src/main/java/com/fp/simple/dto/.svn/text-base/TaskInfo.java.svn-base new file mode 100644 index 0000000..c3951cd --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/dto/.svn/text-base/TaskInfo.java.svn-base @@ -0,0 +1,599 @@ +/* + * + */ +package com.fp.simple.dto; + +import java.io.Serializable; +import java.sql.Timestamp; +import java.text.DecimalFormat; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + +// TODO: Auto-generated Javadoc +/** + * Class TaskInfo encargada de. + * + * @author gfiallos + */ +public class TaskInfo implements Serializable { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** El valor de action. */ + private String action; + + /** El valor de aditional data. */ + private Map aditionalData = new HashMap(); + + /** El valor de company. */ + private Integer company; + + /** El valor de completed. */ + private Timestamp completed; + + /** El valor de created. */ + private Timestamp created; + + /** El valor de expected time. */ + private long expectedTime; + + /** El valor de group id. */ + private String groupId; + + /** El valor de journal id. */ + private String journalId; + + /** El valor de module. */ + private String module; + + /** El valor de response. */ + private String response; + + /** El valor de rule code. */ + private String ruleCode; + + /** El valor de rule code default. */ + private String ruleCodeDefault; + + /** El valor de started. */ + private Timestamp started; + + /** El valor de task id. */ + private long taskId; + + /** Nombre de la tarea. */ + private String tname; + + /** El valor de transaction. */ + private Integer transaction; + + /** El valor de user id. */ + private String userId; + + /** El valor de version. */ + private Integer version; + + /** El valor de internal code. */ + private Object internalCode; + + /** + * Paquete clase a ejecutar, se utiliza para obtener el codigo de usuario o grupo responsable de ejecutar uana tarea + */ + private String classCode; + + /** + * Codigo de mensaje asociado a la tarea se utiliza para presentar en el agenda del usuario. + */ + private Integer messageCode; + + /** + * Entrega el valor de internalCode. + * + * @return Valor de internalCode + */ + public Object getInternalCode() { + return internalCode; + } + + /** + * Fija un nuevo valor en internalCode. + * + * @param pInternalCode nuevo valor para internalCode + */ + public void setInternalCode(Object pInternalCode) { + internalCode = pInternalCode; + } + + /** El valor de kind. */ + private Kind kind; + + /** + * Entrega el valor de kind. + * + * @return Valor de kind + */ + public Kind getKind() { + return kind; + } + + /** + * Fija un nuevo valor en kind. + * + * @param pKind nuevo valor para kind + */ + public void setKind(Kind pKind) { + kind = pKind; + } + + /** + * Obtiene el valor de action. + * + * @return Valor de action + */ + public String getAction() { + return action; + } + + /** + * Entrega el valor de aditionalData. + * + * @return Valor de aditionalData + */ + public Map getAditionalData() { + return aditionalData; + } + + /** + * Entrega el valor de company. + * + * @return Valor de company + */ + public Integer getCompany() { + return company; + } + + /** + * Entrega el valor de completed. + * + * @return Valor de completed + */ + public Timestamp getCompleted() { + return completed; + } + + /** + * Entrega el valor de created. + * + * @return Valor de created + */ + public Timestamp getCreated() { + return created; + } + + /** + * Entrega el valor de spectedTime. + * + * @return Valor de spectedTime + */ + public long getExpectedTime() { + return expectedTime; + } + + /** + * Obtiene el valor de group id. + * + * @return Valor de group id + */ + public String getGroupId() { + return groupId; + } + + /** + * Entrega el valor de journalId. + * + * @return Valor de journalId + */ + public String getJournalId() { + return journalId; + } + + /** + * Entrega el valor de module. + * + * @return Valor de module + */ + public String getModule() { + return module; + } + + /** + * Obtiene el valor de response. + * + * @return Valor de response + */ + public String getResponse() { + return response; + } + + /** + * Entrega el valor de ruleCode. + * + * @return Valor de ruleCode + */ + public String getRuleCode() { + return ruleCode; + } + + /** + * Entrega el valor de ruleCodeDefault. + * + * @return Valor de ruleCodeDefault + */ + public String getRuleCodeDefault() { + return ruleCodeDefault; + } + + /** + * Entrega el valor de started. + * + * @return Valor de started + */ + public Timestamp getStarted() { + return started; + } + + /** + * Entrega el valor de taskId. + * + * @return Valor de taskId + */ + public long getTaskId() { + return taskId; + } + + /** + * Entrega el valor de transaction. + * + * @return Valor de transaction + */ + public Integer getTransaction() { + return transaction; + } + + /** + * Obtiene el valor de user id. + * + * @return Valor de user id + */ + public String getUserId() { + return userId; + } + + /** + * Entrega el valor de version. + * + * @return Valor de version + */ + public Integer getVersion() { + return version; + } + + /** + * Fija el valor de action. + * + * @param pAction the new el valor de action + */ + public void setAction(String pAction) { + action = pAction; + } + + /** + * Fija un nuevo valor en aditionalData. + * + * @param pAditionalData the new el valor de aditional data + */ + public void setAditionalData(Map pAditionalData) { + aditionalData = pAditionalData; + } + + /** + * Fija un nuevo valor en company. + * + * @param pCompany the new el valor de company + */ + public void setCompany(Integer pCompany) { + company = pCompany; + } + + /** + * Fija un nuevo valor en completed. + * + * @param pCompleted the new el valor de completed + */ + public void setCompleted(Timestamp pCompleted) { + completed = pCompleted; + } + + /** + * Fija un nuevo valor en created. + * + * @param pCreated the new el valor de created + */ + public void setCreated(Timestamp pCreated) { + created = pCreated; + } + + /** + * Fija un nuevo valor en spectedTime. + * + * @param pSpectedTime the new el valor de expected time + */ + public void setExpectedTime(long pSpectedTime) { + expectedTime = pSpectedTime; + } + + /** + * Fija el valor de group id. + * + * @param pGroupId the new el valor de group id + */ + public void setGroupId(String pGroupId) { + groupId = pGroupId; + } + + /** + * Fija un nuevo valor en journalId. + * + * @param pJournalId the new el valor de journal id + */ + public void setJournalId(String pJournalId) { + journalId = pJournalId; + } + + /** + * Fija un nuevo valor en module + * + * @param pModule nuevo valor para module + */ + public void setModule(String pModule) { + module = pModule; + } + + /** + * Fija el valor de response. + * + * @param pResponse the new el valor de response + */ + public void setResponse(String pResponse) { + response = pResponse; + } + + /** + * Fija un nuevo valor en ruleCode. + * + * @param pRuleCode the new el valor de rule code + */ + public void setRuleCode(String pRuleCode) { + ruleCode = pRuleCode; + } + + /** + * Fija un nuevo valor en ruleCodeDefault. + * + * @param pRuleCodeDefault the new el valor de rule code default + */ + public void setRuleCodeDefault(String pRuleCodeDefault) { + ruleCodeDefault = pRuleCodeDefault; + } + + /** + * Fija un nuevo valor en started. + * + * @param pStarted the new el valor de started + */ + public void setStarted(Timestamp pStarted) { + started = pStarted; + } + + /** + * Fija un nuevo valor en taskId. + * + * @param pTaskId the new el valor de task id + */ + public void setTaskId(long pTaskId) { + taskId = pTaskId; + } + + /** + * Entrega el valor de: tname + * + * @return String + */ + public String getTname() { + return tname; + } + + /** + * Fija el valor de: tname + * + * @param tname + */ + public void setTname(String tname) { + this.tname = tname; + } + + /** + * Fija un nuevo valor en transaction. + * + * @param pTransaction the new el valor de transaction + */ + public void setTransaction(Integer pTransaction) { + transaction = pTransaction; + } + + /** + * Fija el valor de user id. + * + * @param pUserId the new el valor de user id + */ + public void setUserId(String pUserId) { + userId = pUserId; + } + + /** + * Fija un nuevo valor en version. + * + * @param pVersion the new el valor de version + */ + public void setVersion(Integer pVersion) { + version = pVersion; + } + + /** + * Obtiene el valor de real time. + * + * @param pTime the time + * @return Valor de real time + * @throws Exception la exception + */ + public long getRealTime(long pTime) throws Exception { + if (created == null) { + return 0L; + } + long lcreated = created.getTime(); + long lcompleted = lcreated; + if (completed != null) { + + lcompleted = completed.getTime(); + } else { + lcompleted = pTime; // System.currentTimeMillis(); + } + return lcompleted - lcreated; + } + + /** + * Obtiene el valor de real time. + * + * @return Valor de real time + * @throws Exception la exception + */ + public long getRealTime() throws Exception { + if (created == null) { + return 0L; + } + long lcreated = created.getTime(); + long lcompleted = lcreated; + if (completed != null) { + + lcompleted = completed.getTime(); + } else { + lcompleted = System.currentTimeMillis(); + } + return lcompleted - lcreated; + } + + /** + * Convert. + * + * @param pTime the time + * @return string + * @throws Exception la exception + */ + protected String convert(Long pTime) throws Exception { + DecimalFormat df = new DecimalFormat("00"); + return df.format(Double.valueOf(pTime / 60000).intValue()) + ":" + df.format(pTime % 60); + } + + /** + * Obtiene el valor de real time string. + * + * @param pTime the time + * @return Valor de real time string + * @throws Exception la exception + */ + public String getRealTimeString(long pTime) throws Exception { + return this.convert(this.getRealTime(pTime)); + } + + /** + * Obtiene el valor de real time string. + * + * @return Valor de real time string + * @throws Exception la exception + */ + public String getRealTimeString() throws Exception { + return this.convert(this.getRealTime()); + } + + /** + * Obtiene el valor de expected time string. + * + * @return Valor de expected time string + * @throws Exception la exception + */ + public String getExpectedTimeString() throws Exception { + return this.convert(this.getExpectedTime()); + } + + /** + * Entrega el valor de: classCode + * + * @return String + */ + public String getClassCode() { + return classCode; + } + + /** + * Fija el valor de: classCode + * + * @param classCode + */ + public void setClassCode(String classCode) { + this.classCode = classCode; + } + + /** + * Entrega el valor de: messageCode + * + * @return Integer + */ + public Integer getMessageCode() { + return messageCode; + } + + /** + * Fija el valor de: messageCode + * + * @param messageCode + */ + public void setMessageCode(Integer messageCode) { + this.messageCode = messageCode; + } + + /** + * Update data. + * + * @param pData the data + */ + public void updateData(Map pData) { + for (Entry e : aditionalData.entrySet()) { + pData.put("" + e.getKey(), e.getValue()); + } + } + + /** + * To string. + * + * @return string + */ + @Override + public String toString() { + return "TaskInfo [taskid=" + taskId + ", tname=" + tname + ", action=" + action + ", aditionalData=" + aditionalData + ", module=" + module + + ", response=" + response + ", ruleCode=" + ruleCode + ", expectedTime=" + expectedTime + ", transaction=" + transaction + + ", userId=" + userId + ", version=" + version + "]"; + } + +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/dto/.svn/text-base/package-info.java.svn-base b/base/bpm/simple/src/main/java/com/fp/simple/dto/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..19f37ad --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/dto/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,4 @@ +/** + * Provee las clases de transporte de datos de Tareas. + */ +package com.fp.simple.dto; \ No newline at end of file diff --git a/base/bpm/simple/src/main/java/com/fp/simple/dto/Kind.java b/base/bpm/simple/src/main/java/com/fp/simple/dto/Kind.java new file mode 100644 index 0000000..7d6653b --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/dto/Kind.java @@ -0,0 +1,22 @@ +/* + * + */ +package com.fp.simple.dto; + +// TODO: Auto-generated Javadoc +/** + * Enum Kind encargada de definir el comportamiento de una Tarea dentro de la Agenda. + * + * @author gfiallos + */ +public enum Kind { + + /** Simplemente dar paso. */ + OK, + + /** Autorización requerida. */ + OK_NO, + + /** Autrización requerida con opción a revisión. */ + OK_NO_REVIEW; +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/dto/Responses.java b/base/bpm/simple/src/main/java/com/fp/simple/dto/Responses.java new file mode 100644 index 0000000..b5382d0 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/dto/Responses.java @@ -0,0 +1,58 @@ +/* + * + */ +package com.fp.simple.dto; + +// TODO: Auto-generated Javadoc +/** + * Enum Responses encargada de. + * + * @author gfiallos + */ +public enum Responses { + + /** El valor de OK. */ + OK("A"), + /** El valor de NO. */ + NO("D"), + /** El valor de NO. */ + MOD("M"), + /** El valor de REVIEW. */ + REVIEW("R"); + + /** El valor de code. */ + private String code; + + /** + * Crea una nueva instancia de responses. + * + * @param pCode the code + */ + private Responses(String pCode) { + code = pCode; + } + + /** + * Entrega el valor de code. + * + * @return Valor de code + */ + public String getCode() { + return code; + } + + /** + * Find response. + * + * @param pCode the code + * @return responses + */ + public static Responses findResponse(String pCode) { + for (Responses resp : Responses.values()) { + if (resp.getCode().compareTo(pCode) == 0) { + return resp; + } + } + throw new RuntimeException(pCode + " NO SOPORTADO"); + } +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/dto/TaskInfo.java b/base/bpm/simple/src/main/java/com/fp/simple/dto/TaskInfo.java new file mode 100644 index 0000000..c3951cd --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/dto/TaskInfo.java @@ -0,0 +1,599 @@ +/* + * + */ +package com.fp.simple.dto; + +import java.io.Serializable; +import java.sql.Timestamp; +import java.text.DecimalFormat; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + +// TODO: Auto-generated Javadoc +/** + * Class TaskInfo encargada de. + * + * @author gfiallos + */ +public class TaskInfo implements Serializable { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** El valor de action. */ + private String action; + + /** El valor de aditional data. */ + private Map aditionalData = new HashMap(); + + /** El valor de company. */ + private Integer company; + + /** El valor de completed. */ + private Timestamp completed; + + /** El valor de created. */ + private Timestamp created; + + /** El valor de expected time. */ + private long expectedTime; + + /** El valor de group id. */ + private String groupId; + + /** El valor de journal id. */ + private String journalId; + + /** El valor de module. */ + private String module; + + /** El valor de response. */ + private String response; + + /** El valor de rule code. */ + private String ruleCode; + + /** El valor de rule code default. */ + private String ruleCodeDefault; + + /** El valor de started. */ + private Timestamp started; + + /** El valor de task id. */ + private long taskId; + + /** Nombre de la tarea. */ + private String tname; + + /** El valor de transaction. */ + private Integer transaction; + + /** El valor de user id. */ + private String userId; + + /** El valor de version. */ + private Integer version; + + /** El valor de internal code. */ + private Object internalCode; + + /** + * Paquete clase a ejecutar, se utiliza para obtener el codigo de usuario o grupo responsable de ejecutar uana tarea + */ + private String classCode; + + /** + * Codigo de mensaje asociado a la tarea se utiliza para presentar en el agenda del usuario. + */ + private Integer messageCode; + + /** + * Entrega el valor de internalCode. + * + * @return Valor de internalCode + */ + public Object getInternalCode() { + return internalCode; + } + + /** + * Fija un nuevo valor en internalCode. + * + * @param pInternalCode nuevo valor para internalCode + */ + public void setInternalCode(Object pInternalCode) { + internalCode = pInternalCode; + } + + /** El valor de kind. */ + private Kind kind; + + /** + * Entrega el valor de kind. + * + * @return Valor de kind + */ + public Kind getKind() { + return kind; + } + + /** + * Fija un nuevo valor en kind. + * + * @param pKind nuevo valor para kind + */ + public void setKind(Kind pKind) { + kind = pKind; + } + + /** + * Obtiene el valor de action. + * + * @return Valor de action + */ + public String getAction() { + return action; + } + + /** + * Entrega el valor de aditionalData. + * + * @return Valor de aditionalData + */ + public Map getAditionalData() { + return aditionalData; + } + + /** + * Entrega el valor de company. + * + * @return Valor de company + */ + public Integer getCompany() { + return company; + } + + /** + * Entrega el valor de completed. + * + * @return Valor de completed + */ + public Timestamp getCompleted() { + return completed; + } + + /** + * Entrega el valor de created. + * + * @return Valor de created + */ + public Timestamp getCreated() { + return created; + } + + /** + * Entrega el valor de spectedTime. + * + * @return Valor de spectedTime + */ + public long getExpectedTime() { + return expectedTime; + } + + /** + * Obtiene el valor de group id. + * + * @return Valor de group id + */ + public String getGroupId() { + return groupId; + } + + /** + * Entrega el valor de journalId. + * + * @return Valor de journalId + */ + public String getJournalId() { + return journalId; + } + + /** + * Entrega el valor de module. + * + * @return Valor de module + */ + public String getModule() { + return module; + } + + /** + * Obtiene el valor de response. + * + * @return Valor de response + */ + public String getResponse() { + return response; + } + + /** + * Entrega el valor de ruleCode. + * + * @return Valor de ruleCode + */ + public String getRuleCode() { + return ruleCode; + } + + /** + * Entrega el valor de ruleCodeDefault. + * + * @return Valor de ruleCodeDefault + */ + public String getRuleCodeDefault() { + return ruleCodeDefault; + } + + /** + * Entrega el valor de started. + * + * @return Valor de started + */ + public Timestamp getStarted() { + return started; + } + + /** + * Entrega el valor de taskId. + * + * @return Valor de taskId + */ + public long getTaskId() { + return taskId; + } + + /** + * Entrega el valor de transaction. + * + * @return Valor de transaction + */ + public Integer getTransaction() { + return transaction; + } + + /** + * Obtiene el valor de user id. + * + * @return Valor de user id + */ + public String getUserId() { + return userId; + } + + /** + * Entrega el valor de version. + * + * @return Valor de version + */ + public Integer getVersion() { + return version; + } + + /** + * Fija el valor de action. + * + * @param pAction the new el valor de action + */ + public void setAction(String pAction) { + action = pAction; + } + + /** + * Fija un nuevo valor en aditionalData. + * + * @param pAditionalData the new el valor de aditional data + */ + public void setAditionalData(Map pAditionalData) { + aditionalData = pAditionalData; + } + + /** + * Fija un nuevo valor en company. + * + * @param pCompany the new el valor de company + */ + public void setCompany(Integer pCompany) { + company = pCompany; + } + + /** + * Fija un nuevo valor en completed. + * + * @param pCompleted the new el valor de completed + */ + public void setCompleted(Timestamp pCompleted) { + completed = pCompleted; + } + + /** + * Fija un nuevo valor en created. + * + * @param pCreated the new el valor de created + */ + public void setCreated(Timestamp pCreated) { + created = pCreated; + } + + /** + * Fija un nuevo valor en spectedTime. + * + * @param pSpectedTime the new el valor de expected time + */ + public void setExpectedTime(long pSpectedTime) { + expectedTime = pSpectedTime; + } + + /** + * Fija el valor de group id. + * + * @param pGroupId the new el valor de group id + */ + public void setGroupId(String pGroupId) { + groupId = pGroupId; + } + + /** + * Fija un nuevo valor en journalId. + * + * @param pJournalId the new el valor de journal id + */ + public void setJournalId(String pJournalId) { + journalId = pJournalId; + } + + /** + * Fija un nuevo valor en module + * + * @param pModule nuevo valor para module + */ + public void setModule(String pModule) { + module = pModule; + } + + /** + * Fija el valor de response. + * + * @param pResponse the new el valor de response + */ + public void setResponse(String pResponse) { + response = pResponse; + } + + /** + * Fija un nuevo valor en ruleCode. + * + * @param pRuleCode the new el valor de rule code + */ + public void setRuleCode(String pRuleCode) { + ruleCode = pRuleCode; + } + + /** + * Fija un nuevo valor en ruleCodeDefault. + * + * @param pRuleCodeDefault the new el valor de rule code default + */ + public void setRuleCodeDefault(String pRuleCodeDefault) { + ruleCodeDefault = pRuleCodeDefault; + } + + /** + * Fija un nuevo valor en started. + * + * @param pStarted the new el valor de started + */ + public void setStarted(Timestamp pStarted) { + started = pStarted; + } + + /** + * Fija un nuevo valor en taskId. + * + * @param pTaskId the new el valor de task id + */ + public void setTaskId(long pTaskId) { + taskId = pTaskId; + } + + /** + * Entrega el valor de: tname + * + * @return String + */ + public String getTname() { + return tname; + } + + /** + * Fija el valor de: tname + * + * @param tname + */ + public void setTname(String tname) { + this.tname = tname; + } + + /** + * Fija un nuevo valor en transaction. + * + * @param pTransaction the new el valor de transaction + */ + public void setTransaction(Integer pTransaction) { + transaction = pTransaction; + } + + /** + * Fija el valor de user id. + * + * @param pUserId the new el valor de user id + */ + public void setUserId(String pUserId) { + userId = pUserId; + } + + /** + * Fija un nuevo valor en version. + * + * @param pVersion the new el valor de version + */ + public void setVersion(Integer pVersion) { + version = pVersion; + } + + /** + * Obtiene el valor de real time. + * + * @param pTime the time + * @return Valor de real time + * @throws Exception la exception + */ + public long getRealTime(long pTime) throws Exception { + if (created == null) { + return 0L; + } + long lcreated = created.getTime(); + long lcompleted = lcreated; + if (completed != null) { + + lcompleted = completed.getTime(); + } else { + lcompleted = pTime; // System.currentTimeMillis(); + } + return lcompleted - lcreated; + } + + /** + * Obtiene el valor de real time. + * + * @return Valor de real time + * @throws Exception la exception + */ + public long getRealTime() throws Exception { + if (created == null) { + return 0L; + } + long lcreated = created.getTime(); + long lcompleted = lcreated; + if (completed != null) { + + lcompleted = completed.getTime(); + } else { + lcompleted = System.currentTimeMillis(); + } + return lcompleted - lcreated; + } + + /** + * Convert. + * + * @param pTime the time + * @return string + * @throws Exception la exception + */ + protected String convert(Long pTime) throws Exception { + DecimalFormat df = new DecimalFormat("00"); + return df.format(Double.valueOf(pTime / 60000).intValue()) + ":" + df.format(pTime % 60); + } + + /** + * Obtiene el valor de real time string. + * + * @param pTime the time + * @return Valor de real time string + * @throws Exception la exception + */ + public String getRealTimeString(long pTime) throws Exception { + return this.convert(this.getRealTime(pTime)); + } + + /** + * Obtiene el valor de real time string. + * + * @return Valor de real time string + * @throws Exception la exception + */ + public String getRealTimeString() throws Exception { + return this.convert(this.getRealTime()); + } + + /** + * Obtiene el valor de expected time string. + * + * @return Valor de expected time string + * @throws Exception la exception + */ + public String getExpectedTimeString() throws Exception { + return this.convert(this.getExpectedTime()); + } + + /** + * Entrega el valor de: classCode + * + * @return String + */ + public String getClassCode() { + return classCode; + } + + /** + * Fija el valor de: classCode + * + * @param classCode + */ + public void setClassCode(String classCode) { + this.classCode = classCode; + } + + /** + * Entrega el valor de: messageCode + * + * @return Integer + */ + public Integer getMessageCode() { + return messageCode; + } + + /** + * Fija el valor de: messageCode + * + * @param messageCode + */ + public void setMessageCode(Integer messageCode) { + this.messageCode = messageCode; + } + + /** + * Update data. + * + * @param pData the data + */ + public void updateData(Map pData) { + for (Entry e : aditionalData.entrySet()) { + pData.put("" + e.getKey(), e.getValue()); + } + } + + /** + * To string. + * + * @return string + */ + @Override + public String toString() { + return "TaskInfo [taskid=" + taskId + ", tname=" + tname + ", action=" + action + ", aditionalData=" + aditionalData + ", module=" + module + + ", response=" + response + ", ruleCode=" + ruleCode + ", expectedTime=" + expectedTime + ", transaction=" + transaction + + ", userId=" + userId + ", version=" + version + "]"; + } + +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/dto/metadata/.svn/entries b/base/bpm/simple/src/main/java/com/fp/simple/dto/metadata/.svn/entries new file mode 100644 index 0000000..5673867 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/dto/metadata/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/simple/src/main/java/com/fp/simple/dto/metadata +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ProcessInstanceMeta.java +file + + + + +2022-07-28T03:40:46.374819Z +a67f2768fff108016fa90c410114d009 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +6980 + diff --git a/base/bpm/simple/src/main/java/com/fp/simple/dto/metadata/.svn/text-base/ProcessInstanceMeta.java.svn-base b/base/bpm/simple/src/main/java/com/fp/simple/dto/metadata/.svn/text-base/ProcessInstanceMeta.java.svn-base new file mode 100644 index 0000000..85b3d92 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/dto/metadata/.svn/text-base/ProcessInstanceMeta.java.svn-base @@ -0,0 +1,327 @@ +package com.fp.simple.dto.metadata; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import com.fp.dto.AbstractDataTransport; + +/** + * Class ProcessInstanceMeta encargada de. + * + * @author gfiallos + */ +public class ProcessInstanceMeta extends AbstractDataTransport { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** El valor de activity. */ + private String activity; + + /** El valor de h. */ + private Integer h; + + /** El valor de name. */ + private String name; + + /** El valor de pMetaId. */ + private Long pmetaid; + + /** El valor de pid. */ + private long pid; + + /** El valor de sub. */ + private List sub = new ArrayList(); + + /** El valor de type. */ + private String type; + + /** El valor de variables. */ + private Map variables = new HashMap(); + + /** El valor de version. */ + private String version; + + /** El valor de w. */ + private Integer w; + + /** El valor de work item. */ + private long workItem; + + /** El valor de x. */ + private Integer x; + + /** El valor de y. */ + private Integer y; + + /** + * Crea una nueva instancia de process instance meta. + * + * @param pPID the pID + */ + public ProcessInstanceMeta(long pPID) { + this.pid = pPID; + } + + /** + * Clona la entidad TgeneAccount + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + ProcessInstanceMeta p = (ProcessInstanceMeta) this.clone(); + return p; + } + + /** + * Adiciona un sub process. + * + * @param pSub the sub + */ + public void addSubProcess(ProcessInstanceMeta pSub) { + this.sub.add(pSub); + } + + /** + * Entrega el valor de activity. + * + * @return Valor de activity + */ + public String getActivity() { + return this.activity; + } + + /** + * Entrega el valor de h. + * + * @return Valor de h + */ + public Integer getH() { + return this.h; + } + + /** + * Entrega el valor de name. + * + * @return Valor de name + */ + public String getName() { + return this.name; + } + + + /** + * Entrega el valor de: pmetaid + * @return Long + */ + public Long getPmetaid() { + return this.pmetaid; + } + + /** + * Fija el valor de: pmetaid + * @param pmetaid Valor a fijar en el atributo + */ + public void setPmetaid(Long pmetaid) { + this.pmetaid = pmetaid; + } + + /** + * Entrega el valor de pid. + * + * @return Valor de pid + */ + public long getPid() { + return this.pid; + } + + /** + * Entrega el valor de sub. + * + * @return Valor de sub + */ + public List getSub() { + return this.sub; + } + + /** + * Entrega el valor de type. + * + * @return Valor de type + */ + public String getType() { + return this.type; + } + + /** + * Entrega el valor de variables. + * + * @return Valor de variables + */ + public Map getVariables() { + return this.variables; + } + + /** + * Entrega el valor de version. + * + * @return Valor de version + */ + public String getVersion() { + return this.version; + } + + /** + * Entrega el valor de w. + * + * @return Valor de w + */ + public Integer getW() { + return this.w; + } + + /** + * Entrega el valor de workItem. + * + * @return Valor de workItem + */ + public long getWorkItem() { + return this.workItem; + } + + /** + * Entrega el valor de x. + * + * @return Valor de x + */ + public Integer getX() { + return this.x; + } + + /** + * Entrega el valor de y. + * + * @return Valor de y + */ + public Integer getY() { + return this.y; + } + + /** + * Fija un nuevo valor en activity. + * + * @param pActivity the new el valor de activity + */ + public void setActivity(String pActivity) { + this.activity = pActivity; + } + + /** + * Fija un nuevo valor en h. + * + * @param pH es el valor nuevo de h + */ + public void setH(Integer pH) { + this.h = pH; + } + + /** + * Fija un nuevo valor en name. + * + * @param pName es el valor nuevo de name + */ + public void setName(String pName) { + this.name = pName; + } + + /** + * Fija un nuevo valor en type. + * + * @param pType es el valor nuevo de type + */ + public void setType(String pType) { + this.type = pType; + } + + /** + * Fija un nuevo valor en version. + * + * @param pVersion the new el valor de version + */ + public void setVersion(String pVersion) { + this.version = pVersion; + } + + /** + * Fija un nuevo valor en w. + * + * @param pW es el valor nuevo de w + */ + public void setW(Integer pW) { + this.w = pW; + } + + /** + * Fija un nuevo valor en workItem. + * + * @param pWorkItem the new el valor de work item + */ + public void setWorkItem(long pWorkItem) { + this.workItem = pWorkItem; + } + + /** + * Fija un nuevo valor en x. + * + * @param pX the new el valor de x + */ + public void setX(Integer pX) { + this.x = pX; + } + + /** + * Fija un nuevo valor en y. + * + * @param pY the new el valor de y + */ + public void setY(Integer pY) { + this.y = pY; + } + + /** + * To string. + * + * @return string + */ + @Override + public String toString() { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + pw.printf("[%s-%s(%s)-%s] (%d,%d) [%d,%d]", this.name, this.version, this.activity, this.pid, this.x, this.y, this.w, this.h); + if (!this.variables.isEmpty()) { + pw.println(); + pw.println("vars:"); + for (Entry var : this.variables.entrySet()) { + pw.println(); + pw.printf("%s=%s", var.getKey(), var.getValue()); + } + } + if (this.workItem != 0) { + pw.println(); + pw.printf("WorkItem %s", this.workItem); + } + for (ProcessInstanceMeta pim : this.sub) { + pw.println(); + pw.printf("%s", pim); + } + pw.close(); + return sw.toString(); + } + +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/dto/metadata/ProcessInstanceMeta.java b/base/bpm/simple/src/main/java/com/fp/simple/dto/metadata/ProcessInstanceMeta.java new file mode 100644 index 0000000..85b3d92 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/dto/metadata/ProcessInstanceMeta.java @@ -0,0 +1,327 @@ +package com.fp.simple.dto.metadata; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import com.fp.dto.AbstractDataTransport; + +/** + * Class ProcessInstanceMeta encargada de. + * + * @author gfiallos + */ +public class ProcessInstanceMeta extends AbstractDataTransport { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** El valor de activity. */ + private String activity; + + /** El valor de h. */ + private Integer h; + + /** El valor de name. */ + private String name; + + /** El valor de pMetaId. */ + private Long pmetaid; + + /** El valor de pid. */ + private long pid; + + /** El valor de sub. */ + private List sub = new ArrayList(); + + /** El valor de type. */ + private String type; + + /** El valor de variables. */ + private Map variables = new HashMap(); + + /** El valor de version. */ + private String version; + + /** El valor de w. */ + private Integer w; + + /** El valor de work item. */ + private long workItem; + + /** El valor de x. */ + private Integer x; + + /** El valor de y. */ + private Integer y; + + /** + * Crea una nueva instancia de process instance meta. + * + * @param pPID the pID + */ + public ProcessInstanceMeta(long pPID) { + this.pid = pPID; + } + + /** + * Clona la entidad TgeneAccount + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + ProcessInstanceMeta p = (ProcessInstanceMeta) this.clone(); + return p; + } + + /** + * Adiciona un sub process. + * + * @param pSub the sub + */ + public void addSubProcess(ProcessInstanceMeta pSub) { + this.sub.add(pSub); + } + + /** + * Entrega el valor de activity. + * + * @return Valor de activity + */ + public String getActivity() { + return this.activity; + } + + /** + * Entrega el valor de h. + * + * @return Valor de h + */ + public Integer getH() { + return this.h; + } + + /** + * Entrega el valor de name. + * + * @return Valor de name + */ + public String getName() { + return this.name; + } + + + /** + * Entrega el valor de: pmetaid + * @return Long + */ + public Long getPmetaid() { + return this.pmetaid; + } + + /** + * Fija el valor de: pmetaid + * @param pmetaid Valor a fijar en el atributo + */ + public void setPmetaid(Long pmetaid) { + this.pmetaid = pmetaid; + } + + /** + * Entrega el valor de pid. + * + * @return Valor de pid + */ + public long getPid() { + return this.pid; + } + + /** + * Entrega el valor de sub. + * + * @return Valor de sub + */ + public List getSub() { + return this.sub; + } + + /** + * Entrega el valor de type. + * + * @return Valor de type + */ + public String getType() { + return this.type; + } + + /** + * Entrega el valor de variables. + * + * @return Valor de variables + */ + public Map getVariables() { + return this.variables; + } + + /** + * Entrega el valor de version. + * + * @return Valor de version + */ + public String getVersion() { + return this.version; + } + + /** + * Entrega el valor de w. + * + * @return Valor de w + */ + public Integer getW() { + return this.w; + } + + /** + * Entrega el valor de workItem. + * + * @return Valor de workItem + */ + public long getWorkItem() { + return this.workItem; + } + + /** + * Entrega el valor de x. + * + * @return Valor de x + */ + public Integer getX() { + return this.x; + } + + /** + * Entrega el valor de y. + * + * @return Valor de y + */ + public Integer getY() { + return this.y; + } + + /** + * Fija un nuevo valor en activity. + * + * @param pActivity the new el valor de activity + */ + public void setActivity(String pActivity) { + this.activity = pActivity; + } + + /** + * Fija un nuevo valor en h. + * + * @param pH es el valor nuevo de h + */ + public void setH(Integer pH) { + this.h = pH; + } + + /** + * Fija un nuevo valor en name. + * + * @param pName es el valor nuevo de name + */ + public void setName(String pName) { + this.name = pName; + } + + /** + * Fija un nuevo valor en type. + * + * @param pType es el valor nuevo de type + */ + public void setType(String pType) { + this.type = pType; + } + + /** + * Fija un nuevo valor en version. + * + * @param pVersion the new el valor de version + */ + public void setVersion(String pVersion) { + this.version = pVersion; + } + + /** + * Fija un nuevo valor en w. + * + * @param pW es el valor nuevo de w + */ + public void setW(Integer pW) { + this.w = pW; + } + + /** + * Fija un nuevo valor en workItem. + * + * @param pWorkItem the new el valor de work item + */ + public void setWorkItem(long pWorkItem) { + this.workItem = pWorkItem; + } + + /** + * Fija un nuevo valor en x. + * + * @param pX the new el valor de x + */ + public void setX(Integer pX) { + this.x = pX; + } + + /** + * Fija un nuevo valor en y. + * + * @param pY the new el valor de y + */ + public void setY(Integer pY) { + this.y = pY; + } + + /** + * To string. + * + * @return string + */ + @Override + public String toString() { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + pw.printf("[%s-%s(%s)-%s] (%d,%d) [%d,%d]", this.name, this.version, this.activity, this.pid, this.x, this.y, this.w, this.h); + if (!this.variables.isEmpty()) { + pw.println(); + pw.println("vars:"); + for (Entry var : this.variables.entrySet()) { + pw.println(); + pw.printf("%s=%s", var.getKey(), var.getValue()); + } + } + if (this.workItem != 0) { + pw.println(); + pw.printf("WorkItem %s", this.workItem); + } + for (ProcessInstanceMeta pim : this.sub) { + pw.println(); + pw.printf("%s", pim); + } + pw.close(); + return sw.toString(); + } + +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/dto/package-info.java b/base/bpm/simple/src/main/java/com/fp/simple/dto/package-info.java new file mode 100644 index 0000000..19f37ad --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/dto/package-info.java @@ -0,0 +1,4 @@ +/** + * Provee las clases de transporte de datos de Tareas. + */ +package com.fp.simple.dto; \ No newline at end of file diff --git a/base/bpm/simple/src/main/java/com/fp/simple/flow/.svn/entries b/base/bpm/simple/src/main/java/com/fp/simple/flow/.svn/entries new file mode 100644 index 0000000..140cb31 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/flow/.svn/entries @@ -0,0 +1,164 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/simple/src/main/java/com/fp/simple/flow +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +Asign.java +file + + + + +2022-07-28T03:40:46.391819Z +e41f3c11fb21b0bdd3de9dd5141199ea +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +605 + +package-info.java +file + + + + +2022-07-28T03:40:46.392819Z +adc209f376a74f6a73cfd47fdb90c399 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +91 + +DataMap.java +file + + + + +2022-07-28T03:40:46.392819Z +4f2f6ca62c8faa6555fbe1bd46cfde4f +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +800 + +FlowClass.java +file + + + + +2022-07-28T03:40:46.392819Z +027fda38790ac667fad75658af0825eb +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +292 + diff --git a/base/bpm/simple/src/main/java/com/fp/simple/flow/.svn/text-base/Asign.java.svn-base b/base/bpm/simple/src/main/java/com/fp/simple/flow/.svn/text-base/Asign.java.svn-base new file mode 100644 index 0000000..227766c --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/flow/.svn/text-base/Asign.java.svn-base @@ -0,0 +1,39 @@ +/* + * + */ +package com.fp.simple.flow; + +import java.io.Serializable; + +import com.fp.dto.Request; + +// TODO: Auto-generated Javadoc +/** + * Interface Asign encargada de. + * + * @author gfiallos + */ +public interface Asign extends Serializable { + + /** + * Obtiene el valor de id. + * + * @return Valor de id + */ + String getId(); + + /** + * Verfica si el group. + * + * @return true, Si es group + */ + boolean isGroup(); + + /** + * Fija el valor de request. + * + * @param pRequest es el valor nuevo de request + */ + void setRequest(Request pRequest); + +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/flow/.svn/text-base/DataMap.java.svn-base b/base/bpm/simple/src/main/java/com/fp/simple/flow/.svn/text-base/DataMap.java.svn-base new file mode 100644 index 0000000..80fb8a6 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/flow/.svn/text-base/DataMap.java.svn-base @@ -0,0 +1,36 @@ +/* + * + */ +package com.fp.simple.flow; + +import java.io.Serializable; +import java.util.HashMap; + +// TODO: Auto-generated Javadoc +/** + * Class DataMap encargada de. + * + * @author gfiallos + */ +public class DataMap extends HashMap implements Serializable { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Obtiene el valor de. + * + * @param pKey the key + * @return object + */ + @Override + public Object get(Object pKey) { + Object val = super.get(pKey); + String key = (String) pKey; + if ((val == null) && (key.compareTo("userId") != 0) && (key.compareTo("groupId") != 0)) { + throw new RuntimeException("NO SE HA ENCONTRADO LA VARIABLE " + pKey); + } + return val; + } + +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/flow/.svn/text-base/FlowClass.java.svn-base b/base/bpm/simple/src/main/java/com/fp/simple/flow/.svn/text-base/FlowClass.java.svn-base new file mode 100644 index 0000000..b37bef8 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/flow/.svn/text-base/FlowClass.java.svn-base @@ -0,0 +1,20 @@ +/* + * + */ +package com.fp.simple.flow; + +// TODO: Auto-generated Javadoc +/** + * Interface FlowClass encargada de. + * + * @author gfiallos + */ +public interface FlowClass { + + /** + * Process. + * + * @throws Exception la exception + */ + void process() throws Exception; +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/flow/.svn/text-base/package-info.java.svn-base b/base/bpm/simple/src/main/java/com/fp/simple/flow/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..1bbceed --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/flow/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,4 @@ +/** + * Provee las clases de transporte de datos para Tareas + */ +package com.fp.simple.flow; \ No newline at end of file diff --git a/base/bpm/simple/src/main/java/com/fp/simple/flow/Asign.java b/base/bpm/simple/src/main/java/com/fp/simple/flow/Asign.java new file mode 100644 index 0000000..227766c --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/flow/Asign.java @@ -0,0 +1,39 @@ +/* + * + */ +package com.fp.simple.flow; + +import java.io.Serializable; + +import com.fp.dto.Request; + +// TODO: Auto-generated Javadoc +/** + * Interface Asign encargada de. + * + * @author gfiallos + */ +public interface Asign extends Serializable { + + /** + * Obtiene el valor de id. + * + * @return Valor de id + */ + String getId(); + + /** + * Verfica si el group. + * + * @return true, Si es group + */ + boolean isGroup(); + + /** + * Fija el valor de request. + * + * @param pRequest es el valor nuevo de request + */ + void setRequest(Request pRequest); + +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/flow/DataMap.java b/base/bpm/simple/src/main/java/com/fp/simple/flow/DataMap.java new file mode 100644 index 0000000..80fb8a6 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/flow/DataMap.java @@ -0,0 +1,36 @@ +/* + * + */ +package com.fp.simple.flow; + +import java.io.Serializable; +import java.util.HashMap; + +// TODO: Auto-generated Javadoc +/** + * Class DataMap encargada de. + * + * @author gfiallos + */ +public class DataMap extends HashMap implements Serializable { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Obtiene el valor de. + * + * @param pKey the key + * @return object + */ + @Override + public Object get(Object pKey) { + Object val = super.get(pKey); + String key = (String) pKey; + if ((val == null) && (key.compareTo("userId") != 0) && (key.compareTo("groupId") != 0)) { + throw new RuntimeException("NO SE HA ENCONTRADO LA VARIABLE " + pKey); + } + return val; + } + +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/flow/FlowClass.java b/base/bpm/simple/src/main/java/com/fp/simple/flow/FlowClass.java new file mode 100644 index 0000000..b37bef8 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/flow/FlowClass.java @@ -0,0 +1,20 @@ +/* + * + */ +package com.fp.simple.flow; + +// TODO: Auto-generated Javadoc +/** + * Interface FlowClass encargada de. + * + * @author gfiallos + */ +public interface FlowClass { + + /** + * Process. + * + * @throws Exception la exception + */ + void process() throws Exception; +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/flow/package-info.java b/base/bpm/simple/src/main/java/com/fp/simple/flow/package-info.java new file mode 100644 index 0000000..1bbceed --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/flow/package-info.java @@ -0,0 +1,4 @@ +/** + * Provee las clases de transporte de datos para Tareas + */ +package com.fp.simple.flow; \ No newline at end of file diff --git a/base/bpm/simple/src/main/java/com/fp/simple/maia/.svn/entries b/base/bpm/simple/src/main/java/com/fp/simple/maia/.svn/entries new file mode 100644 index 0000000..6c8a0e9 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/maia/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/simple/src/main/java/com/fp/simple/maia +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +MailRecipientGroup.java +file + + + + +2022-07-28T03:40:46.406819Z +eafb1a69350cad0cdf50d01ca7081125 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +701 + +MailRecipient.java +file + + + + +2022-07-28T03:40:46.406819Z +52544403804740cde85114f44172a825 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +576 + diff --git a/base/bpm/simple/src/main/java/com/fp/simple/maia/.svn/text-base/MailRecipient.java.svn-base b/base/bpm/simple/src/main/java/com/fp/simple/maia/.svn/text-base/MailRecipient.java.svn-base new file mode 100644 index 0000000..3094417 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/maia/.svn/text-base/MailRecipient.java.svn-base @@ -0,0 +1,21 @@ +package com.fp.simple.maia; + +import java.util.Map; + +/** + * Clase a extender en las clases encargadas de obtener direcciones email a las cuales se enva notificaciones de flujos + * de trabajo.. + * + * @version 2.1 + */ +public abstract class MailRecipient { + + /** + * Metodo que busca y entraga direcciones email a las cuales se envia notificaciones. + * + * @param pParam Request con el que se ejecuta una transaccion. + * @throws Exception + */ + public abstract Map getEmailAddress(Object pParam) throws Exception; + +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/maia/.svn/text-base/MailRecipientGroup.java.svn-base b/base/bpm/simple/src/main/java/com/fp/simple/maia/.svn/text-base/MailRecipientGroup.java.svn-base new file mode 100644 index 0000000..76fb7c6 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/maia/.svn/text-base/MailRecipientGroup.java.svn-base @@ -0,0 +1,21 @@ +package com.fp.simple.maia; + +import java.util.Map; + +/** + * Accion a extender en las clases encargadas de obtener direcciones email asociadas a un grupo bpm, el email puede + * estar en un esquemas de terceros en este caso la clase respectiva es la que se encarga de obtener la lista de emails. + * + * @version 2.1 + */ +public abstract class MailRecipientGroup { + + /** + * Metodo que busca y entraga direcciones email a las cuales se envia notificaciones . + * + * @param pParam Request con el que se ejecuta una transaccion. + * @throws Exception + */ + public abstract Map getEmailAddress(Object pParam, String pGroupCode) throws Exception; + +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/maia/MailRecipient.java b/base/bpm/simple/src/main/java/com/fp/simple/maia/MailRecipient.java new file mode 100644 index 0000000..3094417 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/maia/MailRecipient.java @@ -0,0 +1,21 @@ +package com.fp.simple.maia; + +import java.util.Map; + +/** + * Clase a extender en las clases encargadas de obtener direcciones email a las cuales se enva notificaciones de flujos + * de trabajo.. + * + * @version 2.1 + */ +public abstract class MailRecipient { + + /** + * Metodo que busca y entraga direcciones email a las cuales se envia notificaciones. + * + * @param pParam Request con el que se ejecuta una transaccion. + * @throws Exception + */ + public abstract Map getEmailAddress(Object pParam) throws Exception; + +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/maia/MailRecipientGroup.java b/base/bpm/simple/src/main/java/com/fp/simple/maia/MailRecipientGroup.java new file mode 100644 index 0000000..76fb7c6 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/maia/MailRecipientGroup.java @@ -0,0 +1,21 @@ +package com.fp.simple.maia; + +import java.util.Map; + +/** + * Accion a extender en las clases encargadas de obtener direcciones email asociadas a un grupo bpm, el email puede + * estar en un esquemas de terceros en este caso la clase respectiva es la que se encarga de obtener la lista de emails. + * + * @version 2.1 + */ +public abstract class MailRecipientGroup { + + /** + * Metodo que busca y entraga direcciones email a las cuales se envia notificaciones . + * + * @param pParam Request con el que se ejecuta una transaccion. + * @throws Exception + */ + public abstract Map getEmailAddress(Object pParam, String pGroupCode) throws Exception; + +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/test/.svn/entries b/base/bpm/simple/src/main/java/com/fp/simple/test/.svn/entries new file mode 100644 index 0000000..ee66190 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/test/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/bpm/simple/src/main/java/com/fp/simple/test +svn://172.17.26.185/COMACO + + + +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +RequestTester.java +file + + + + +2022-07-28T03:40:46.362819Z +3761ec6f3f284b693e24c79f9bb0a780 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +2743 + +package-info.java +file + + + + +2022-07-28T03:40:46.362819Z +0b3f51dd0d9676474cf5aa5553aef732 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +91 + +RuleTester.java +file + + + + +2022-07-28T03:40:46.362819Z +0dc993d0d204e07bef0f33347a9e69a6 +2014-09-11T06:03:34.339088Z +654 +jvaca + + + + + + + + + + + + + + + + + + + + + +2401 + diff --git a/base/bpm/simple/src/main/java/com/fp/simple/test/.svn/text-base/RequestTester.java.svn-base b/base/bpm/simple/src/main/java/com/fp/simple/test/.svn/text-base/RequestTester.java.svn-base new file mode 100644 index 0000000..9c3acfe --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/test/.svn/text-base/RequestTester.java.svn-base @@ -0,0 +1,141 @@ +/* + * + */ +package com.fp.simple.test; + +import java.math.BigDecimal; + +import com.fp.dto.Response; +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Class RequestTester encargada de. + * + * @author gfiallos + */ +public class RequestTester extends SaveRequest { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Crea una nueva instancia de request tester. + */ + public RequestTester() { + super.setResponse(new Response(Response.RESPONSE_OK, "")); + } + + /** + * Change branch. + * + * @param pBranch the branch + */ + public void changeBranch(Integer pBranch) { + this.setBranchCode(pBranch); + } + + /** + * Change officer. + * + * @param pOfficer the officer + */ + public void changeOfficer(String pOfficer) { + this.put("officer", pOfficer); + } + + /** + * Change ammount. + * + * @param pAmount the amount + */ + public void changeAmmount(BigDecimal pAmount) { + this.put("amount", pAmount); + } + + /** + * Change rate. + * + * @param pRate the rate + */ + public void changeRate(BigDecimal pRate) { + this.put("rate", pRate); + } + + /** + * Change term. + * + * @param pTerm the term + */ + public void changeTerm(Integer pTerm) { + this.put("term", pTerm); + } + + /** + * Obtiene el valor de action. + * + * @return Valor de action + */ + public String getAction() { + return (String) super.get("action"); + } + + /** + * Obtiene el valor de internal code. + * + * @return Valor de internal code + */ + public String getInternalCode() { + return (String) super.get("internalCode"); + + } + + /** + * Obtiene el valor de group id. + * + * @return Valor de group id + */ + public String getGroupId() { + return (String) super.get("groupId"); + + } + + /** + * Obtiene el valor de user id. + * + * @return Valor de user id + */ + public String getUserId() { + return (String) super.get("userId"); + } + + /** + * Change value. + * + * @param pValue the value + */ + public void changeValue(String pValue) { + String[] val = pValue.split(","); + this.put(val[0], val[1]); + } + + /** + * Adiciona un rule parameter value. + * + * @param pValue the value + */ + public void addRuleParameterValue(String pValue) { + String[] val = pValue.split(","); + this.addRuleParameter(val[0], val[1]); + } + + /** + * Obtiene el valor de rule data. + * + * @return Valor de rule data + */ + public String getRuleData() { + return "" + this.ruleParameters; + } + +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/test/.svn/text-base/RuleTester.java.svn-base b/base/bpm/simple/src/main/java/com/fp/simple/test/.svn/text-base/RuleTester.java.svn-base new file mode 100644 index 0000000..4fdab5e --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/test/.svn/text-base/RuleTester.java.svn-base @@ -0,0 +1,124 @@ +/* + * + */ +package com.fp.simple.test; + +import java.math.BigDecimal; +import java.util.HashMap; + +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Class RuleTester encargada de. + * + * @author gfiallos + */ +public class RuleTester extends HashMap { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + /** El valor de sr. */ + private SaveRequest sr; + + /** + * Crea una nueva instancia de rule tester. + */ + public RuleTester() { + this.sr = new SaveRequest(); + super.put("request", this.sr); + } + + /** + * Change branch. + * + * @param pBranch the branch + */ + public void changeBranch(Integer pBranch) { + this.sr.setBranchCode(pBranch); + } + + /** + * Change officer. + * + * @param pOfficer the officer + */ + public void changeOfficer(String pOfficer) { + this.sr.put("officer", pOfficer); + } + + /** + * Change ammount. + * + * @param pAmount the amount + */ + public void changeAmmount(BigDecimal pAmount) { + this.sr.put("amount", pAmount); + } + + /** + * Change rate. + * + * @param pRate the rate + */ + public void changeRate(BigDecimal pRate) { + this.sr.put("rate", pRate); + } + + /** + * Change term. + * + * @param pTerm the term + */ + public void changeTerm(Integer pTerm) { + this.sr.put("term", pTerm); + } + + /** + * Obtiene el valor de action. + * + * @return Valor de action + */ + public String getAction() { + return (String) super.get("action"); + } + + /** + * Obtiene el valor de internal code. + * + * @return Valor de internal code + */ + public String getInternalCode() { + return (String) super.get("internalCode"); + + } + + /** + * Obtiene el valor de group id. + * + * @return Valor de group id + */ + public String getGroupId() { + return (String) super.get("groupId"); + + } + + /** + * Obtiene el valor de user id. + * + * @return Valor de user id + */ + public String getUserId() { + return (String) super.get("userId"); + } + + /** + * Change value. + * + * @param pValue the value + */ + public void changeValue(String pValue) { + String[] val = pValue.split(","); + this.sr.put(val[0], val[1]); + } +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/test/.svn/text-base/package-info.java.svn-base b/base/bpm/simple/src/main/java/com/fp/simple/test/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..4980227 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/test/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,4 @@ +/** + * Provee clases para ser utilizadas en Casos de Prueba + */ +package com.fp.simple.test; \ No newline at end of file diff --git a/base/bpm/simple/src/main/java/com/fp/simple/test/RequestTester.java b/base/bpm/simple/src/main/java/com/fp/simple/test/RequestTester.java new file mode 100644 index 0000000..9c3acfe --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/test/RequestTester.java @@ -0,0 +1,141 @@ +/* + * + */ +package com.fp.simple.test; + +import java.math.BigDecimal; + +import com.fp.dto.Response; +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Class RequestTester encargada de. + * + * @author gfiallos + */ +public class RequestTester extends SaveRequest { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Crea una nueva instancia de request tester. + */ + public RequestTester() { + super.setResponse(new Response(Response.RESPONSE_OK, "")); + } + + /** + * Change branch. + * + * @param pBranch the branch + */ + public void changeBranch(Integer pBranch) { + this.setBranchCode(pBranch); + } + + /** + * Change officer. + * + * @param pOfficer the officer + */ + public void changeOfficer(String pOfficer) { + this.put("officer", pOfficer); + } + + /** + * Change ammount. + * + * @param pAmount the amount + */ + public void changeAmmount(BigDecimal pAmount) { + this.put("amount", pAmount); + } + + /** + * Change rate. + * + * @param pRate the rate + */ + public void changeRate(BigDecimal pRate) { + this.put("rate", pRate); + } + + /** + * Change term. + * + * @param pTerm the term + */ + public void changeTerm(Integer pTerm) { + this.put("term", pTerm); + } + + /** + * Obtiene el valor de action. + * + * @return Valor de action + */ + public String getAction() { + return (String) super.get("action"); + } + + /** + * Obtiene el valor de internal code. + * + * @return Valor de internal code + */ + public String getInternalCode() { + return (String) super.get("internalCode"); + + } + + /** + * Obtiene el valor de group id. + * + * @return Valor de group id + */ + public String getGroupId() { + return (String) super.get("groupId"); + + } + + /** + * Obtiene el valor de user id. + * + * @return Valor de user id + */ + public String getUserId() { + return (String) super.get("userId"); + } + + /** + * Change value. + * + * @param pValue the value + */ + public void changeValue(String pValue) { + String[] val = pValue.split(","); + this.put(val[0], val[1]); + } + + /** + * Adiciona un rule parameter value. + * + * @param pValue the value + */ + public void addRuleParameterValue(String pValue) { + String[] val = pValue.split(","); + this.addRuleParameter(val[0], val[1]); + } + + /** + * Obtiene el valor de rule data. + * + * @return Valor de rule data + */ + public String getRuleData() { + return "" + this.ruleParameters; + } + +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/test/RuleTester.java b/base/bpm/simple/src/main/java/com/fp/simple/test/RuleTester.java new file mode 100644 index 0000000..4fdab5e --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/test/RuleTester.java @@ -0,0 +1,124 @@ +/* + * + */ +package com.fp.simple.test; + +import java.math.BigDecimal; +import java.util.HashMap; + +import com.fp.dto.save.SaveRequest; + +// TODO: Auto-generated Javadoc +/** + * Class RuleTester encargada de. + * + * @author gfiallos + */ +public class RuleTester extends HashMap { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + /** El valor de sr. */ + private SaveRequest sr; + + /** + * Crea una nueva instancia de rule tester. + */ + public RuleTester() { + this.sr = new SaveRequest(); + super.put("request", this.sr); + } + + /** + * Change branch. + * + * @param pBranch the branch + */ + public void changeBranch(Integer pBranch) { + this.sr.setBranchCode(pBranch); + } + + /** + * Change officer. + * + * @param pOfficer the officer + */ + public void changeOfficer(String pOfficer) { + this.sr.put("officer", pOfficer); + } + + /** + * Change ammount. + * + * @param pAmount the amount + */ + public void changeAmmount(BigDecimal pAmount) { + this.sr.put("amount", pAmount); + } + + /** + * Change rate. + * + * @param pRate the rate + */ + public void changeRate(BigDecimal pRate) { + this.sr.put("rate", pRate); + } + + /** + * Change term. + * + * @param pTerm the term + */ + public void changeTerm(Integer pTerm) { + this.sr.put("term", pTerm); + } + + /** + * Obtiene el valor de action. + * + * @return Valor de action + */ + public String getAction() { + return (String) super.get("action"); + } + + /** + * Obtiene el valor de internal code. + * + * @return Valor de internal code + */ + public String getInternalCode() { + return (String) super.get("internalCode"); + + } + + /** + * Obtiene el valor de group id. + * + * @return Valor de group id + */ + public String getGroupId() { + return (String) super.get("groupId"); + + } + + /** + * Obtiene el valor de user id. + * + * @return Valor de user id + */ + public String getUserId() { + return (String) super.get("userId"); + } + + /** + * Change value. + * + * @param pValue the value + */ + public void changeValue(String pValue) { + String[] val = pValue.split(","); + this.sr.put(val[0], val[1]); + } +} diff --git a/base/bpm/simple/src/main/java/com/fp/simple/test/package-info.java b/base/bpm/simple/src/main/java/com/fp/simple/test/package-info.java new file mode 100644 index 0000000..4980227 --- /dev/null +++ b/base/bpm/simple/src/main/java/com/fp/simple/test/package-info.java @@ -0,0 +1,4 @@ +/** + * Provee clases para ser utilizadas en Casos de Prueba + */ +package com.fp.simple.test; \ No newline at end of file diff --git a/base/bpm/simple/target/classes/com/fp/simple/action/TaskAction.class b/base/bpm/simple/target/classes/com/fp/simple/action/TaskAction.class new file mode 100644 index 0000000..b78532a Binary files /dev/null and b/base/bpm/simple/target/classes/com/fp/simple/action/TaskAction.class differ diff --git a/base/bpm/simple/target/classes/com/fp/simple/dto/Kind.class b/base/bpm/simple/target/classes/com/fp/simple/dto/Kind.class new file mode 100644 index 0000000..74bd95f Binary files /dev/null and b/base/bpm/simple/target/classes/com/fp/simple/dto/Kind.class differ diff --git a/base/bpm/simple/target/classes/com/fp/simple/dto/Responses.class b/base/bpm/simple/target/classes/com/fp/simple/dto/Responses.class new file mode 100644 index 0000000..bd6c062 Binary files /dev/null and b/base/bpm/simple/target/classes/com/fp/simple/dto/Responses.class differ diff --git a/base/bpm/simple/target/classes/com/fp/simple/dto/TaskInfo.class b/base/bpm/simple/target/classes/com/fp/simple/dto/TaskInfo.class new file mode 100644 index 0000000..4fc3377 Binary files /dev/null and b/base/bpm/simple/target/classes/com/fp/simple/dto/TaskInfo.class differ diff --git a/base/bpm/simple/target/classes/com/fp/simple/dto/metadata/ProcessInstanceMeta.class b/base/bpm/simple/target/classes/com/fp/simple/dto/metadata/ProcessInstanceMeta.class new file mode 100644 index 0000000..90d2678 Binary files /dev/null and b/base/bpm/simple/target/classes/com/fp/simple/dto/metadata/ProcessInstanceMeta.class differ diff --git a/base/bpm/simple/target/classes/com/fp/simple/flow/Asign.class b/base/bpm/simple/target/classes/com/fp/simple/flow/Asign.class new file mode 100644 index 0000000..39b440d Binary files /dev/null and b/base/bpm/simple/target/classes/com/fp/simple/flow/Asign.class differ diff --git a/base/bpm/simple/target/classes/com/fp/simple/flow/DataMap.class b/base/bpm/simple/target/classes/com/fp/simple/flow/DataMap.class new file mode 100644 index 0000000..c49701b Binary files /dev/null and b/base/bpm/simple/target/classes/com/fp/simple/flow/DataMap.class differ diff --git a/base/bpm/simple/target/classes/com/fp/simple/flow/FlowClass.class b/base/bpm/simple/target/classes/com/fp/simple/flow/FlowClass.class new file mode 100644 index 0000000..852145c Binary files /dev/null and b/base/bpm/simple/target/classes/com/fp/simple/flow/FlowClass.class differ diff --git a/base/bpm/simple/target/classes/com/fp/simple/maia/MailRecipient.class b/base/bpm/simple/target/classes/com/fp/simple/maia/MailRecipient.class new file mode 100644 index 0000000..4fc587f Binary files /dev/null and b/base/bpm/simple/target/classes/com/fp/simple/maia/MailRecipient.class differ diff --git a/base/bpm/simple/target/classes/com/fp/simple/maia/MailRecipientGroup.class b/base/bpm/simple/target/classes/com/fp/simple/maia/MailRecipientGroup.class new file mode 100644 index 0000000..72cb540 Binary files /dev/null and b/base/bpm/simple/target/classes/com/fp/simple/maia/MailRecipientGroup.class differ diff --git a/base/bpm/simple/target/classes/com/fp/simple/test/RequestTester.class b/base/bpm/simple/target/classes/com/fp/simple/test/RequestTester.class new file mode 100644 index 0000000..436f975 Binary files /dev/null and b/base/bpm/simple/target/classes/com/fp/simple/test/RequestTester.class differ diff --git a/base/bpm/simple/target/classes/com/fp/simple/test/RuleTester.class b/base/bpm/simple/target/classes/com/fp/simple/test/RuleTester.class new file mode 100644 index 0000000..f30d72e Binary files /dev/null and b/base/bpm/simple/target/classes/com/fp/simple/test/RuleTester.class differ diff --git a/base/bpm/simple/target/maven-archiver/pom.properties b/base/bpm/simple/target/maven-archiver/pom.properties new file mode 100644 index 0000000..e649b31 --- /dev/null +++ b/base/bpm/simple/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:52:54 ECT 2022 +version=2.1 +groupId=com.fp.base.bpm +artifactId=simple diff --git a/base/bpm/simple/target/simple-2.1.jar b/base/bpm/simple/target/simple-2.1.jar new file mode 100644 index 0000000..adaee9f Binary files /dev/null and b/base/bpm/simple/target/simple-2.1.jar differ diff --git a/base/business/.svn/entries b/base/business/.svn/entries new file mode 100644 index 0000000..f89615c --- /dev/null +++ b/base/business/.svn/entries @@ -0,0 +1,80 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business +svn://172.17.26.185/COMACO + + + +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +log +dir + +viaticos +dir + +armas +dir + +person +dir + +pom.xml +file + + + + +2022-07-28T03:40:44.742812Z +2eff88580bfedfcf91ea3b0de105a811 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2484 + +report +dir + +general +dir + diff --git a/base/business/.svn/text-base/pom.xml.svn-base b/base/business/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..83970b0 --- /dev/null +++ b/base/business/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,72 @@ + + + + base + com.fp + 2.1 + + 4.0.0 + com.fp.base + business + flipbean + 2.1 + pom + Financial Lifecycle Process + + general + person + report + log + viaticos + armas + + + + com.fp.base.dto + dto + 2.1 + provided + + + com.fp.base.dto + common + 2.1 + provided + + + com.fp.base.persistence + util + 2.1 + provided + + + log4j + log4j + provided + + + com.fp.base.core + bpm + 2.1 + provided + + + + org.jboss.spec.javax.ejb + jboss-ejb-api_3.1_spec + + + org.hibernate + hibernate-core + + + org.hibernate + hibernate-entitymanager + + + org.jbpm + jbpm-human-task-core + provided + + + \ No newline at end of file diff --git a/base/business/armas/.svn/dir-prop-base b/base/business/armas/.svn/dir-prop-base new file mode 100644 index 0000000..3e2a6f2 --- /dev/null +++ b/base/business/armas/.svn/dir-prop-base @@ -0,0 +1,9 @@ +K 10 +svn:ignore +V 37 +.classpath +.project +.settings +target + +END diff --git a/base/business/armas/.svn/entries b/base/business/armas/.svn/entries new file mode 100644 index 0000000..4e87847 --- /dev/null +++ b/base/business/armas/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas +svn://172.17.26.185/COMACO + + + +2022-04-19T02:27:53.431385Z +4665 +usermaia1 +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:41.525798Z +f63dde71d47e1eaef4e5f6fd3e71fd67 +2020-01-15T23:43:01.067085Z +4623 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1365 + diff --git a/base/business/armas/.svn/text-base/pom.xml.svn-base b/base/business/armas/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..81f8bfe --- /dev/null +++ b/base/business/armas/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,48 @@ + + + 4.0.0 + + com.fp.base + business + 2.1 + + com.fp.base.business + armas + armas + + + + com.fp.base.persistence + parmas + 2.1 + + + com.fp.base.core + bpm + 2.1 + + + com.fp.base.bpm + simple + 2.1 + + + com.fp.base + sessionbeans + 2.1 + + + com.fp.base.persistence + pbpm + 2.1 + + + + org.apache.commons + commons-lang3 + 3.1 + + + + diff --git a/base/business/armas/pom.xml b/base/business/armas/pom.xml new file mode 100644 index 0000000..81f8bfe --- /dev/null +++ b/base/business/armas/pom.xml @@ -0,0 +1,48 @@ + + + 4.0.0 + + com.fp.base + business + 2.1 + + com.fp.base.business + armas + armas + + + + com.fp.base.persistence + parmas + 2.1 + + + com.fp.base.core + bpm + 2.1 + + + com.fp.base.bpm + simple + 2.1 + + + com.fp.base + sessionbeans + 2.1 + + + com.fp.base.persistence + pbpm + 2.1 + + + + org.apache.commons + commons-lang3 + 3.1 + + + + diff --git a/base/business/armas/src/.svn/entries b/base/business/armas/src/.svn/entries new file mode 100644 index 0000000..37aa28f --- /dev/null +++ b/base/business/armas/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src +svn://172.17.26.185/COMACO + + + +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/base/business/armas/src/main/.svn/entries b/base/business/armas/src/main/.svn/entries new file mode 100644 index 0000000..21b429e --- /dev/null +++ b/base/business/armas/src/main/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main +svn://172.17.26.185/COMACO + + + +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + diff --git a/base/business/armas/src/main/java/.svn/entries b/base/business/armas/src/main/java/.svn/entries new file mode 100644 index 0000000..46ca7a6 --- /dev/null +++ b/base/business/armas/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java +svn://172.17.26.185/COMACO + + + +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/business/armas/src/main/java/com/.svn/entries b/base/business/armas/src/main/java/com/.svn/entries new file mode 100644 index 0000000..80e5d19 --- /dev/null +++ b/base/business/armas/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com +svn://172.17.26.185/COMACO + + + +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/business/armas/src/main/java/com/fp/.svn/entries b/base/business/armas/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..2584964 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +armas +dir + diff --git a/base/business/armas/src/main/java/com/fp/armas/.svn/entries b/base/business/armas/src/main/java/com/fp/armas/.svn/entries new file mode 100644 index 0000000..5992238 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/.svn/entries @@ -0,0 +1,37 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com/fp/armas +svn://172.17.26.185/COMACO + + + +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +mail +dir + +task +dir + +rules +dir + diff --git a/base/business/armas/src/main/java/com/fp/armas/mail/.svn/entries b/base/business/armas/src/main/java/com/fp/armas/mail/.svn/entries new file mode 100644 index 0000000..51778de --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/mail/.svn/entries @@ -0,0 +1,164 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com/fp/armas/mail +svn://172.17.26.185/COMACO + + + +2021-05-14T20:43:26.035487Z +4634 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ScheduleNotificacionCliente.java +file + + + + +2022-07-28T03:40:40.568794Z +a4668e62abd2723ed479fa51a4756b15 +2021-05-14T20:43:26.035487Z +4634 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +10060 + +PersonaDireccion.java +file + + + + +2022-07-28T03:40:40.569794Z +b8f4ff9c8bce8de8d994ef9df64a8a4d +2014-11-26T11:39:13.942947Z +3105 +cpiedra + + + + + + + + + + + + + + + + + + + + + +2565 + +PersonaDireccionVentaTemp.java +file + + + + +2022-07-28T03:40:40.569794Z +b89342d76769d34c653790894105fde6 +2021-05-14T20:43:26.035487Z +4634 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +4132 + +SolicitanteDireccion.java +file + + + + +2022-07-28T03:40:40.569794Z +d39b249e595184d36252b9010aba9ad1 +2014-10-27T05:50:22.203219Z +1969 +fpazmino + + + + + + + + + + + + + + + + + + + + + +2145 + diff --git a/base/business/armas/src/main/java/com/fp/armas/mail/.svn/text-base/PersonaDireccion.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/mail/.svn/text-base/PersonaDireccion.java.svn-base new file mode 100644 index 0000000..7aefbae --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/mail/.svn/text-base/PersonaDireccion.java.svn-base @@ -0,0 +1,57 @@ +package com.fp.armas.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.simple.maia.MailRecipient; + +/** + * Clase que se encarga de objener el email de una persona. + * + * @version 2.1 + */ +public class PersonaDireccion extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + List lemail = new ArrayList(); + Map mresp = new HashMap(); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return mresp; + } + String solicitud = (String) mrequest.get("csolicitud"); + TgeneParameters parameters= TgeneParameters.find(PersistenceHelper.getEntityManager(), new TgeneParametersKey("CODIGO.MAIL", 1)); + TarmSolicitud tarmsolicitud=PersistenceHelper.getEntityManager() + .createQuery("select o from TarmSolicitud o where o.pk=:solicitud",TarmSolicitud.class).setParameter("solicitud", solicitud).getSingleResult(); + // TcustPersonAddressKey + List lpersonadress= PersistenceHelper.getEntityManager().createQuery("select o from TcustPersonAddress o where o.pk.personcode=:personcode " + + " and o.addresstypecatalog=:addresstypecatalog" + + " and o.pk.dateto=:dateto",TcustPersonAddress.class) + .setParameter("personcode", tarmsolicitud.getPersoncode()) + .setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()) + .setParameter("addresstypecatalog", parameters.getTextvalue()).getResultList(); + + // adiciona email. + for(TcustPersonAddress addres:lpersonadress){ + lemail.add(addres.getAddress()); + } + mresp.put("lemail", lemail); + return mresp; + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/mail/.svn/text-base/PersonaDireccionVentaTemp.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/mail/.svn/text-base/PersonaDireccionVentaTemp.java.svn-base new file mode 100644 index 0000000..4919b3a --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/mail/.svn/text-base/PersonaDireccionVentaTemp.java.svn-base @@ -0,0 +1,88 @@ +package com.fp.armas.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmVentaArmaTem; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.simple.maia.MailRecipient; + +/** + * Clase que se encarga de objener el email de una persona. + * + * @version 2.1 + */ +public class PersonaDireccionVentaTemp extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + List lemail = new ArrayList(); + Map mresp = new HashMap(); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + System.out.println("addres---1. "+mrequest.get("csolicitud")); + if (mrequest.get("csolicitud") == null) { + mresp.put("lemail", lemail); + return mresp; + } + try { + String solicitud = (String) mrequest.get("csolicitud"); + System.out.println("addres---2. "); + EntityManager em=PersistenceHelper.getEntityManager(); + System.out.println("addres---3. "); + TarmArmas arma= TarmArmas.find( em, solicitud); + System.out.println("addres---4. "+arma); + Listlistaventa= em.createQuery("select p from TarmVentaArmaTem p where p.carma=:carma and p.estado=:estado") + .setParameter("carma", arma.getPk()) + .setParameter("estado", "PENDIENTE") + .getResultList(); + System.out.println("addres---5. "+listaventa); + TarmRegistroArmas registro = TarmRegistroArmas.find(em, arma.getCregistro()); + System.out.println("addres---6. "+listaventa); + TgeneParameters parameters= TgeneParameters.find(em, new TgeneParametersKey("CODIGO.MAIL", 1)); + System.out.println("addres---7. "+listaventa); + if(listaventa!=null && listaventa.size()>0){ + System.out.println("addres---8. "+listaventa.size()); + // TcustPersonAddressKey + List lpersonadress= em.createQuery("select o from TcustPersonAddress o where o.pk.personcode=:personcode " + + " and o.addresstypecatalog=:addresstypecatalog" + + " and o.pk.dateto=:dateto",TcustPersonAddress.class) + .setParameter("personcode", registro.getPersoncode()) + .setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()) + .setParameter("addresstypecatalog", parameters.getTextvalue()).getResultList(); + System.out.println("addres---9. "+lpersonadress); + // adiciona email. + for(TcustPersonAddress addres:lpersonadress){ + System.out.println("addres--10-"+addres); + if(addres!=null && addres.getAddress()!=null && addres.getAddress().contains("@")){ + lemail.add(addres.getAddress()); + System.out.println("addres--10.1-"+addres.getAddress()); + } + } + System.out.println("addres--11-"); + } + } catch (Exception e) { + System.out.println("erro-----------12-"); + e.printStackTrace(); + } + System.out.println("sale-----------13-"); + mresp.put("lemail", lemail); + return mresp; + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/mail/.svn/text-base/ScheduleNotificacionCliente.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/mail/.svn/text-base/ScheduleNotificacionCliente.java.svn-base new file mode 100644 index 0000000..53d5d3d --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/mail/.svn/text-base/ScheduleNotificacionCliente.java.svn-base @@ -0,0 +1,245 @@ +package com.fp.armas.mail; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.annotation.PostConstruct; +import javax.ejb.Schedule; +import javax.ejb.Stateless; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; + +import org.jboss.logging.Logger; + +import com.fp.common.logger.APPLogger; +import com.fp.mail.Mail; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +@Stateless(name="scheduleNotificacionCliente") +public class ScheduleNotificacionCliente { + private final Logger LOG = Logger.getLogger(ScheduleNotificacionCliente.class.getName()); + + + private EntityManagerFactory emf; + @PostConstruct + private final void crearManager() { + try { + if (emf == null) { + Map configOverrides = new HashMap(); + configOverrides.put("hibernate.ejb.cfgfile", "hibernateFlipMapping.cfg.xml"); + emf = Persistence.createEntityManagerFactory("local1" , configOverrides); + } + SessionData sessionData = new SessionData(); + sessionData.setCompany(1); + sessionData.setIsEjb(Boolean.FALSE); + ThreadFacade.setSaveRequest(sessionData); + } catch (Exception e) { + APPLogger.getLogger().error(e); + } + } + + + /** + * Envo de correo MAIL. Con un mes antes de caducar el permiso enviar un correo al usuario informndole + */ + @SuppressWarnings("deprecation") + @Schedule(dayOfWeek="Sat" ,hour="7", minute="20", persistent=false) + public void automaticaNotificacion(){ + LOG.info("-----------------------NOTIFICACION MENSAJE DE ALERTA UNA VEZ CADUCADO EL PERMISO DE ARMAS.****"); + try { + EntityManager entityManager=emf.createEntityManager(); + + Date fechaLimite = new Date(); + fechaLimite.setDate(fechaLimite.getDay()-8); + LOG.info("fecha"+ fechaLimite); + Date fechaActual = new Date(); + fechaActual.setMonth(fechaLimite.getMonth()+1); + StringBuilder sql = new StringBuilder( + "select " + + " dh.personcode," + + + " (select cat.description from TgeneCatalogDetail cat " + + " where cat.pk.catalog = (select tr.tipoautorizacion from TarmTramite tr WHERE tr.pk=dh.ctramite) " + + " and cat.pk.catalogcode='TIPOAUTORIZACION') as TIPOAUTORIZACION," + + + " (select cat.description from TgeneCatalogDetail cat " + + " where cat.pk.catalog= (select tr.usoactividad from TarmTramite tr WHERE tr.pk=dh.ctramite)" + + " and cat.pk.catalogcode='USOACTIVIDAD') as USOACTIVIDAD " + + + " from TarmDocumentoHabilitante dh where dh.ctramite in ( " + + " select tr.pk from TarmTramite tr where tr.tipoautorizacioncodigo='TIPOAUTORIZACION' and tr.tipoautorizacion in (6,1)) " + + " and dh.fechaexpiracion is not null and dh.estado ='APR'" + + " and dh.fechaexpiracion > :fechaLimite and dh.fechaexpiracion < :fechaActual" + + ); + + LOG.info("Consulta"); + ListlistPersonas = entityManager.createQuery(sql.toString(),Object[].class) + .setParameter("fechaLimite", fechaLimite) + .setParameter("fechaActual", fechaActual) + .getResultList(); + LOG.info("Consulta 2:: "+listPersonas); + if(listPersonas!= null){ + LOG.info("Tamanio listPersonas "+listPersonas.size()); + //Datos para el envio de correo + StringBuilder sqlParametros = new StringBuilder("select t from TgeneParameters t where t.pk.code in :codigosmail "); + ListlistaCodigos = new ArrayList<>(); + listaCodigos.add("ASUNTO.NOTIFICACION.SCHEDULE"); + listaCodigos.add("CUERPO.NOTIFICACION.SCHEDULE"); + listaCodigos.add("CORRDES.NOTIFICACION.SCHEDULE"); + listaCodigos.add("CORRCOP.NOTIFICACION.SCHEDULE"); + + listaCodigos.add("MAIL.FROM"); + listaCodigos.add("MAIL.SMTP.SERVER"); + listaCodigos.add("MAIL.SMTP.PORT"); + listaCodigos.add("MAIL.SMTP.USER"); + listaCodigos.add("MAIL.SMTP.PASSWORD"); + listaCodigos.add("MAIL.SMTP.AUTH"); + listaCodigos.add("MAIL.SMTPS"); + + ListlistaParametrosMail = entityManager.createQuery(sqlParametros.toString(),TgeneParameters.class) + .setParameter("codigosmail", listaCodigos).getResultList(); + + String asunto=valorTexto(listaParametrosMail, "ASUNTO.NOTIFICACION.SCHEDULE"); + String cuerpo=valorTexto(listaParametrosMail, "CUERPO.NOTIFICACION.SCHEDULE");; + String correodesde=valorTexto(listaParametrosMail, "CORRDES.NOTIFICACION.SCHEDULE"); + String correoCC[]=valorTexto(listaParametrosMail, "CORRCOP.NOTIFICACION.SCHEDULE").split(","); + + String MAIL_FROM=valorTexto(listaParametrosMail, "MAIL.FROM"); + String MAIL_SMTP_SERVER=valorTexto(listaParametrosMail, "MAIL.SMTP.SERVER"); + int MAIL_SMTP_PORT=valorNumber(listaParametrosMail, "MAIL.SMTP.PORT"); + String MAIL_SMTP_USER=valorTexto(listaParametrosMail, "MAIL.SMTP.USER"); + String MAIL_SMTP_PASSWORD=valorTexto(listaParametrosMail, "MAIL.SMTP.PASSWORD"); + Boolean MAIL_SMTP_AUTH=Boolean.valueOf(valorTexto(listaParametrosMail, "MAIL.SMTP.AUTH")); + Boolean MAIL_SMTPS=Boolean.valueOf(valorTexto(listaParametrosMail, "MAIL.SMTPS")); + + MapmapaPersonaCuerpo= new HashMap(); + for (Object[] item : listPersonas) { + if(mapaPersonaCuerpo.get(item[0].toString())!=null){ + String cuerpoMensaje =" "+(item[1]!=null?item[1].toString():"")+" "+(item[2]!=null?item[2].toString():""); + mapaPersonaCuerpo.put(item[0].toString(), (mapaPersonaCuerpo.get(item[0].toString())+", "+cuerpoMensaje)); + }else{ + String cuerpoMensaje =" "+(item[1]!=null?item[1].toString():"")+" "+(item[2]!=null?item[2].toString():""); + mapaPersonaCuerpo.put(item[0].toString(), cuerpoMensaje); + } + + } + + + for (Entry entry : mapaPersonaCuerpo.entrySet()) { + StringBuilder sqlInformacion = new StringBuilder( + "select p.address from TcustPersonAddress p where p.pk.personcode=:personcode " + + " and p.address is not null " + + " and p.addresstypecatalog=3"); + List listaDirecciones =entityManager.createQuery(sqlInformacion.toString(),String.class) + .setParameter("personcode", Integer.valueOf(entry.getKey())) + .getResultList(); + LOG.info("ListaDirecciones "+listaDirecciones); + if(listaDirecciones!= null && listaDirecciones.size()>0){ + LOG.info("Tamanio listaDirecciones "+listaDirecciones.size()); + List remover = new ArrayList(); + for (String itemcorreo : listaDirecciones) { + if(!itemcorreo.contains("@")){ + remover.add(itemcorreo); + } + } + listaDirecciones.removeAll(remover); + if(listaDirecciones!= null && listaDirecciones.size()>0){ + LOG.info("Envio "+listaDirecciones.size()); + String cuerpoFinal = cuerpo +" "+entry.getValue(); + envioCorreoCambio(MAIL_FROM, MAIL_SMTP_SERVER,MAIL_SMTP_PORT, + MAIL_SMTP_USER,MAIL_SMTP_PASSWORD,MAIL_SMTP_AUTH,MAIL_SMTPS, + listaDirecciones.get(0),asunto,cuerpoFinal,correoCC[0],correodesde); + + //String [] arrayCorreos= new String[listaDirecciones.size()]; + //arrayCorreos=listaDirecciones.toArray(arrayCorreos); + } + } + } + } + + } catch(Exception e){ + LOG.info("Error: "+e.getMessage()); + e.printStackTrace(); + } catch (Throwable e) { + LOG.info("Error: "+e.getMessage()); + e.printStackTrace(); + } + } + + private String valorTexto(ListlistaParametrosMail, String codigo){ + for (TgeneParameters item : listaParametrosMail) { + if(codigo.trim().equals(item.getPk().getCode().trim())){ + return item.getTextvalue(); + } + } + return ""; + } + + private int valorNumber(ListlistaParametrosMail, String codigo){ + for (TgeneParameters item : listaParametrosMail) { + if(codigo.trim().equals(item.getPk().getCode().trim())){ + return item.getNumbervalue().intValue(); + } + } + return 0; + } + /** + * Envía el correo de cambio de email + * @throws Exception + */ + private void envioCorreoCambio(String MAIL_FROM, String MAIL_SMTP_SERVER,int MAIL_SMTP_PORT, + String MAIL_SMTP_USER,String MAIL_SMTP_PASSWORD,Boolean MAIL_SMTP_AUTH,Boolean MAIL_SMTPS, + String correos,String asunto,String cuerpo,String correoCC,String correodesde) { + try { + Mail m = new Mail(); + m.config(MAIL_FROM,MAIL_SMTP_SERVER,MAIL_SMTP_PORT, MAIL_SMTP_USER, MAIL_SMTP_PASSWORD, MAIL_SMTP_AUTH, MAIL_SMTPS); + m.setTo(correos); + m.setCc(correoCC); + m.setSubject(asunto); + m.setCont(cuerpo); + m.setContentMessageType("text/html"); + m.send(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /* + private void envioMail(String[] correos,String asunto,String cuerpo,String correoCC[],String correodesde) throws Exception{ + try { + LOG.info("INGREA A ENVIAR MAIL"); + LOG.info("correos: "+correos); + LOG.info("asunto: "+asunto); + LOG.info("correoCC: "+correoCC); + LOG.info("correodesde: "+correodesde); + EnvioCorreoDTO envioCorreo = new EnvioCorreoDTO(); + envioCorreo.setCorreoDesde(correodesde); + envioCorreo.setCorreoPara(correos);//new String[]{correos} + envioCorreo.setCorreoCC(correoCC); + envioCorreo.setAsunto(asunto); + envioCorreo.setMensajeHTML(cuerpo); + EnvioMail envioMail = EnvioMailFactory.getInstancia(); + LOG.info("envioMail.envioMail(envioCorreo)"); + envioMail.envioMail(envioCorreo); + LOG.info("FIN Envio de mail"); + } catch (Exception e) { + e.printStackTrace(); + throw new Exception(e); + }catch (Throwable e) { + e.printStackTrace(); + } + } + */ + + public EntityManagerFactory getEmf() { + return emf; + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/mail/.svn/text-base/SolicitanteDireccion.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/mail/.svn/text-base/SolicitanteDireccion.java.svn-base new file mode 100644 index 0000000..8a371d9 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/mail/.svn/text-base/SolicitanteDireccion.java.svn-base @@ -0,0 +1,50 @@ +package com.fp.armas.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.simple.maia.MailRecipient; + +/** + * Clase que se encarga de objener el email de una persona. + * + * @version 2.1 + */ +public class SolicitanteDireccion extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + List lemail = new ArrayList(); + Map mresp = new HashMap(); +// HashMap m = (HashMap) pParam; +// Map mrequest = (Map) m.get("request"); +// if (mrequest.get("csolicitud") == null) { +// return mresp; +// } +// String solicitud = (String) mrequest.get("csolicitud"); +// TarmSolicitud tarmsolicitud=PersistenceHelper.getEntityManager() +// .createQuery("select o from TarmSolicitud o where o.pk=:solicitud",TarmSolicitud.class).setParameter("solicitud", solicitud).getSingleResult(); +// // TcustPersonAddressKey +// List lpersonadress= PersistenceHelper.getEntityManager().createQuery("select o from TcustPersonAddress o where o.pk.personcode=:personcode " +// + " and o.addresstypecatalog=3" +// + " and o.pk.dateto=(select max(dt.pk.dateto) from TcustPersonAddress dt where dt.pk.personcode=:personcode2)",TcustPersonAddress.class) +// .setParameter("personcode", tarmsolicitud.getPersoncode()) +// .setParameter("personcode2", tarmsolicitud.getPersoncode()).getResultList(); +// +// // adiciona email. +// for(TcustPersonAddress addres:lpersonadress){ +// lemail.add(addres.getAddress()); +// } + lemail.add("fpazmino@bupartech.com"); + mresp.put("lemail", lemail); + return mresp; + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/mail/PersonaDireccion.java b/base/business/armas/src/main/java/com/fp/armas/mail/PersonaDireccion.java new file mode 100644 index 0000000..7aefbae --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/mail/PersonaDireccion.java @@ -0,0 +1,57 @@ +package com.fp.armas.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.simple.maia.MailRecipient; + +/** + * Clase que se encarga de objener el email de una persona. + * + * @version 2.1 + */ +public class PersonaDireccion extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + List lemail = new ArrayList(); + Map mresp = new HashMap(); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return mresp; + } + String solicitud = (String) mrequest.get("csolicitud"); + TgeneParameters parameters= TgeneParameters.find(PersistenceHelper.getEntityManager(), new TgeneParametersKey("CODIGO.MAIL", 1)); + TarmSolicitud tarmsolicitud=PersistenceHelper.getEntityManager() + .createQuery("select o from TarmSolicitud o where o.pk=:solicitud",TarmSolicitud.class).setParameter("solicitud", solicitud).getSingleResult(); + // TcustPersonAddressKey + List lpersonadress= PersistenceHelper.getEntityManager().createQuery("select o from TcustPersonAddress o where o.pk.personcode=:personcode " + + " and o.addresstypecatalog=:addresstypecatalog" + + " and o.pk.dateto=:dateto",TcustPersonAddress.class) + .setParameter("personcode", tarmsolicitud.getPersoncode()) + .setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()) + .setParameter("addresstypecatalog", parameters.getTextvalue()).getResultList(); + + // adiciona email. + for(TcustPersonAddress addres:lpersonadress){ + lemail.add(addres.getAddress()); + } + mresp.put("lemail", lemail); + return mresp; + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/mail/PersonaDireccionVentaTemp.java b/base/business/armas/src/main/java/com/fp/armas/mail/PersonaDireccionVentaTemp.java new file mode 100644 index 0000000..4919b3a --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/mail/PersonaDireccionVentaTemp.java @@ -0,0 +1,88 @@ +package com.fp.armas.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmVentaArmaTem; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.simple.maia.MailRecipient; + +/** + * Clase que se encarga de objener el email de una persona. + * + * @version 2.1 + */ +public class PersonaDireccionVentaTemp extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + List lemail = new ArrayList(); + Map mresp = new HashMap(); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + System.out.println("addres---1. "+mrequest.get("csolicitud")); + if (mrequest.get("csolicitud") == null) { + mresp.put("lemail", lemail); + return mresp; + } + try { + String solicitud = (String) mrequest.get("csolicitud"); + System.out.println("addres---2. "); + EntityManager em=PersistenceHelper.getEntityManager(); + System.out.println("addres---3. "); + TarmArmas arma= TarmArmas.find( em, solicitud); + System.out.println("addres---4. "+arma); + Listlistaventa= em.createQuery("select p from TarmVentaArmaTem p where p.carma=:carma and p.estado=:estado") + .setParameter("carma", arma.getPk()) + .setParameter("estado", "PENDIENTE") + .getResultList(); + System.out.println("addres---5. "+listaventa); + TarmRegistroArmas registro = TarmRegistroArmas.find(em, arma.getCregistro()); + System.out.println("addres---6. "+listaventa); + TgeneParameters parameters= TgeneParameters.find(em, new TgeneParametersKey("CODIGO.MAIL", 1)); + System.out.println("addres---7. "+listaventa); + if(listaventa!=null && listaventa.size()>0){ + System.out.println("addres---8. "+listaventa.size()); + // TcustPersonAddressKey + List lpersonadress= em.createQuery("select o from TcustPersonAddress o where o.pk.personcode=:personcode " + + " and o.addresstypecatalog=:addresstypecatalog" + + " and o.pk.dateto=:dateto",TcustPersonAddress.class) + .setParameter("personcode", registro.getPersoncode()) + .setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()) + .setParameter("addresstypecatalog", parameters.getTextvalue()).getResultList(); + System.out.println("addres---9. "+lpersonadress); + // adiciona email. + for(TcustPersonAddress addres:lpersonadress){ + System.out.println("addres--10-"+addres); + if(addres!=null && addres.getAddress()!=null && addres.getAddress().contains("@")){ + lemail.add(addres.getAddress()); + System.out.println("addres--10.1-"+addres.getAddress()); + } + } + System.out.println("addres--11-"); + } + } catch (Exception e) { + System.out.println("erro-----------12-"); + e.printStackTrace(); + } + System.out.println("sale-----------13-"); + mresp.put("lemail", lemail); + return mresp; + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/mail/ScheduleNotificacionCliente.java b/base/business/armas/src/main/java/com/fp/armas/mail/ScheduleNotificacionCliente.java new file mode 100644 index 0000000..53d5d3d --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/mail/ScheduleNotificacionCliente.java @@ -0,0 +1,245 @@ +package com.fp.armas.mail; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.annotation.PostConstruct; +import javax.ejb.Schedule; +import javax.ejb.Stateless; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; + +import org.jboss.logging.Logger; + +import com.fp.common.logger.APPLogger; +import com.fp.mail.Mail; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +@Stateless(name="scheduleNotificacionCliente") +public class ScheduleNotificacionCliente { + private final Logger LOG = Logger.getLogger(ScheduleNotificacionCliente.class.getName()); + + + private EntityManagerFactory emf; + @PostConstruct + private final void crearManager() { + try { + if (emf == null) { + Map configOverrides = new HashMap(); + configOverrides.put("hibernate.ejb.cfgfile", "hibernateFlipMapping.cfg.xml"); + emf = Persistence.createEntityManagerFactory("local1" , configOverrides); + } + SessionData sessionData = new SessionData(); + sessionData.setCompany(1); + sessionData.setIsEjb(Boolean.FALSE); + ThreadFacade.setSaveRequest(sessionData); + } catch (Exception e) { + APPLogger.getLogger().error(e); + } + } + + + /** + * Envo de correo MAIL. Con un mes antes de caducar el permiso enviar un correo al usuario informndole + */ + @SuppressWarnings("deprecation") + @Schedule(dayOfWeek="Sat" ,hour="7", minute="20", persistent=false) + public void automaticaNotificacion(){ + LOG.info("-----------------------NOTIFICACION MENSAJE DE ALERTA UNA VEZ CADUCADO EL PERMISO DE ARMAS.****"); + try { + EntityManager entityManager=emf.createEntityManager(); + + Date fechaLimite = new Date(); + fechaLimite.setDate(fechaLimite.getDay()-8); + LOG.info("fecha"+ fechaLimite); + Date fechaActual = new Date(); + fechaActual.setMonth(fechaLimite.getMonth()+1); + StringBuilder sql = new StringBuilder( + "select " + + " dh.personcode," + + + " (select cat.description from TgeneCatalogDetail cat " + + " where cat.pk.catalog = (select tr.tipoautorizacion from TarmTramite tr WHERE tr.pk=dh.ctramite) " + + " and cat.pk.catalogcode='TIPOAUTORIZACION') as TIPOAUTORIZACION," + + + " (select cat.description from TgeneCatalogDetail cat " + + " where cat.pk.catalog= (select tr.usoactividad from TarmTramite tr WHERE tr.pk=dh.ctramite)" + + " and cat.pk.catalogcode='USOACTIVIDAD') as USOACTIVIDAD " + + + " from TarmDocumentoHabilitante dh where dh.ctramite in ( " + + " select tr.pk from TarmTramite tr where tr.tipoautorizacioncodigo='TIPOAUTORIZACION' and tr.tipoautorizacion in (6,1)) " + + " and dh.fechaexpiracion is not null and dh.estado ='APR'" + + " and dh.fechaexpiracion > :fechaLimite and dh.fechaexpiracion < :fechaActual" + + ); + + LOG.info("Consulta"); + ListlistPersonas = entityManager.createQuery(sql.toString(),Object[].class) + .setParameter("fechaLimite", fechaLimite) + .setParameter("fechaActual", fechaActual) + .getResultList(); + LOG.info("Consulta 2:: "+listPersonas); + if(listPersonas!= null){ + LOG.info("Tamanio listPersonas "+listPersonas.size()); + //Datos para el envio de correo + StringBuilder sqlParametros = new StringBuilder("select t from TgeneParameters t where t.pk.code in :codigosmail "); + ListlistaCodigos = new ArrayList<>(); + listaCodigos.add("ASUNTO.NOTIFICACION.SCHEDULE"); + listaCodigos.add("CUERPO.NOTIFICACION.SCHEDULE"); + listaCodigos.add("CORRDES.NOTIFICACION.SCHEDULE"); + listaCodigos.add("CORRCOP.NOTIFICACION.SCHEDULE"); + + listaCodigos.add("MAIL.FROM"); + listaCodigos.add("MAIL.SMTP.SERVER"); + listaCodigos.add("MAIL.SMTP.PORT"); + listaCodigos.add("MAIL.SMTP.USER"); + listaCodigos.add("MAIL.SMTP.PASSWORD"); + listaCodigos.add("MAIL.SMTP.AUTH"); + listaCodigos.add("MAIL.SMTPS"); + + ListlistaParametrosMail = entityManager.createQuery(sqlParametros.toString(),TgeneParameters.class) + .setParameter("codigosmail", listaCodigos).getResultList(); + + String asunto=valorTexto(listaParametrosMail, "ASUNTO.NOTIFICACION.SCHEDULE"); + String cuerpo=valorTexto(listaParametrosMail, "CUERPO.NOTIFICACION.SCHEDULE");; + String correodesde=valorTexto(listaParametrosMail, "CORRDES.NOTIFICACION.SCHEDULE"); + String correoCC[]=valorTexto(listaParametrosMail, "CORRCOP.NOTIFICACION.SCHEDULE").split(","); + + String MAIL_FROM=valorTexto(listaParametrosMail, "MAIL.FROM"); + String MAIL_SMTP_SERVER=valorTexto(listaParametrosMail, "MAIL.SMTP.SERVER"); + int MAIL_SMTP_PORT=valorNumber(listaParametrosMail, "MAIL.SMTP.PORT"); + String MAIL_SMTP_USER=valorTexto(listaParametrosMail, "MAIL.SMTP.USER"); + String MAIL_SMTP_PASSWORD=valorTexto(listaParametrosMail, "MAIL.SMTP.PASSWORD"); + Boolean MAIL_SMTP_AUTH=Boolean.valueOf(valorTexto(listaParametrosMail, "MAIL.SMTP.AUTH")); + Boolean MAIL_SMTPS=Boolean.valueOf(valorTexto(listaParametrosMail, "MAIL.SMTPS")); + + MapmapaPersonaCuerpo= new HashMap(); + for (Object[] item : listPersonas) { + if(mapaPersonaCuerpo.get(item[0].toString())!=null){ + String cuerpoMensaje =" "+(item[1]!=null?item[1].toString():"")+" "+(item[2]!=null?item[2].toString():""); + mapaPersonaCuerpo.put(item[0].toString(), (mapaPersonaCuerpo.get(item[0].toString())+", "+cuerpoMensaje)); + }else{ + String cuerpoMensaje =" "+(item[1]!=null?item[1].toString():"")+" "+(item[2]!=null?item[2].toString():""); + mapaPersonaCuerpo.put(item[0].toString(), cuerpoMensaje); + } + + } + + + for (Entry entry : mapaPersonaCuerpo.entrySet()) { + StringBuilder sqlInformacion = new StringBuilder( + "select p.address from TcustPersonAddress p where p.pk.personcode=:personcode " + + " and p.address is not null " + + " and p.addresstypecatalog=3"); + List listaDirecciones =entityManager.createQuery(sqlInformacion.toString(),String.class) + .setParameter("personcode", Integer.valueOf(entry.getKey())) + .getResultList(); + LOG.info("ListaDirecciones "+listaDirecciones); + if(listaDirecciones!= null && listaDirecciones.size()>0){ + LOG.info("Tamanio listaDirecciones "+listaDirecciones.size()); + List remover = new ArrayList(); + for (String itemcorreo : listaDirecciones) { + if(!itemcorreo.contains("@")){ + remover.add(itemcorreo); + } + } + listaDirecciones.removeAll(remover); + if(listaDirecciones!= null && listaDirecciones.size()>0){ + LOG.info("Envio "+listaDirecciones.size()); + String cuerpoFinal = cuerpo +" "+entry.getValue(); + envioCorreoCambio(MAIL_FROM, MAIL_SMTP_SERVER,MAIL_SMTP_PORT, + MAIL_SMTP_USER,MAIL_SMTP_PASSWORD,MAIL_SMTP_AUTH,MAIL_SMTPS, + listaDirecciones.get(0),asunto,cuerpoFinal,correoCC[0],correodesde); + + //String [] arrayCorreos= new String[listaDirecciones.size()]; + //arrayCorreos=listaDirecciones.toArray(arrayCorreos); + } + } + } + } + + } catch(Exception e){ + LOG.info("Error: "+e.getMessage()); + e.printStackTrace(); + } catch (Throwable e) { + LOG.info("Error: "+e.getMessage()); + e.printStackTrace(); + } + } + + private String valorTexto(ListlistaParametrosMail, String codigo){ + for (TgeneParameters item : listaParametrosMail) { + if(codigo.trim().equals(item.getPk().getCode().trim())){ + return item.getTextvalue(); + } + } + return ""; + } + + private int valorNumber(ListlistaParametrosMail, String codigo){ + for (TgeneParameters item : listaParametrosMail) { + if(codigo.trim().equals(item.getPk().getCode().trim())){ + return item.getNumbervalue().intValue(); + } + } + return 0; + } + /** + * Envía el correo de cambio de email + * @throws Exception + */ + private void envioCorreoCambio(String MAIL_FROM, String MAIL_SMTP_SERVER,int MAIL_SMTP_PORT, + String MAIL_SMTP_USER,String MAIL_SMTP_PASSWORD,Boolean MAIL_SMTP_AUTH,Boolean MAIL_SMTPS, + String correos,String asunto,String cuerpo,String correoCC,String correodesde) { + try { + Mail m = new Mail(); + m.config(MAIL_FROM,MAIL_SMTP_SERVER,MAIL_SMTP_PORT, MAIL_SMTP_USER, MAIL_SMTP_PASSWORD, MAIL_SMTP_AUTH, MAIL_SMTPS); + m.setTo(correos); + m.setCc(correoCC); + m.setSubject(asunto); + m.setCont(cuerpo); + m.setContentMessageType("text/html"); + m.send(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /* + private void envioMail(String[] correos,String asunto,String cuerpo,String correoCC[],String correodesde) throws Exception{ + try { + LOG.info("INGREA A ENVIAR MAIL"); + LOG.info("correos: "+correos); + LOG.info("asunto: "+asunto); + LOG.info("correoCC: "+correoCC); + LOG.info("correodesde: "+correodesde); + EnvioCorreoDTO envioCorreo = new EnvioCorreoDTO(); + envioCorreo.setCorreoDesde(correodesde); + envioCorreo.setCorreoPara(correos);//new String[]{correos} + envioCorreo.setCorreoCC(correoCC); + envioCorreo.setAsunto(asunto); + envioCorreo.setMensajeHTML(cuerpo); + EnvioMail envioMail = EnvioMailFactory.getInstancia(); + LOG.info("envioMail.envioMail(envioCorreo)"); + envioMail.envioMail(envioCorreo); + LOG.info("FIN Envio de mail"); + } catch (Exception e) { + e.printStackTrace(); + throw new Exception(e); + }catch (Throwable e) { + e.printStackTrace(); + } + } + */ + + public EntityManagerFactory getEmf() { + return emf; + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/mail/SolicitanteDireccion.java b/base/business/armas/src/main/java/com/fp/armas/mail/SolicitanteDireccion.java new file mode 100644 index 0000000..8a371d9 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/mail/SolicitanteDireccion.java @@ -0,0 +1,50 @@ +package com.fp.armas.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.simple.maia.MailRecipient; + +/** + * Clase que se encarga de objener el email de una persona. + * + * @version 2.1 + */ +public class SolicitanteDireccion extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + List lemail = new ArrayList(); + Map mresp = new HashMap(); +// HashMap m = (HashMap) pParam; +// Map mrequest = (Map) m.get("request"); +// if (mrequest.get("csolicitud") == null) { +// return mresp; +// } +// String solicitud = (String) mrequest.get("csolicitud"); +// TarmSolicitud tarmsolicitud=PersistenceHelper.getEntityManager() +// .createQuery("select o from TarmSolicitud o where o.pk=:solicitud",TarmSolicitud.class).setParameter("solicitud", solicitud).getSingleResult(); +// // TcustPersonAddressKey +// List lpersonadress= PersistenceHelper.getEntityManager().createQuery("select o from TcustPersonAddress o where o.pk.personcode=:personcode " +// + " and o.addresstypecatalog=3" +// + " and o.pk.dateto=(select max(dt.pk.dateto) from TcustPersonAddress dt where dt.pk.personcode=:personcode2)",TcustPersonAddress.class) +// .setParameter("personcode", tarmsolicitud.getPersoncode()) +// .setParameter("personcode2", tarmsolicitud.getPersoncode()).getResultList(); +// +// // adiciona email. +// for(TcustPersonAddress addres:lpersonadress){ +// lemail.add(addres.getAddress()); +// } + lemail.add("fpazmino@bupartech.com"); + mresp.put("lemail", lemail); + return mresp; + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/.svn/entries b/base/business/armas/src/main/java/com/fp/armas/rules/.svn/entries new file mode 100644 index 0000000..6e6b710 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/.svn/entries @@ -0,0 +1,37 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com/fp/armas/rules +svn://172.17.26.185/COMACO + + + +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +query +dir + +exception +dir + +save +dir + diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/exception/.svn/entries b/base/business/armas/src/main/java/com/fp/armas/rules/exception/.svn/entries new file mode 100644 index 0000000..5ca5aa7 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/exception/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com/fp/armas/rules/exception +svn://172.17.26.185/COMACO + + + +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ControlArmasException.java +file + + + + +2022-07-28T03:40:40.976795Z +c4dc1a279b73a9ad49210bf21389965b +2022-04-19T02:27:53.431385Z +4665 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1001 + diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/exception/.svn/prop-base/ControlArmasException.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/exception/.svn/prop-base/ControlArmasException.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/exception/.svn/prop-base/ControlArmasException.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/exception/.svn/text-base/ControlArmasException.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/exception/.svn/text-base/ControlArmasException.java.svn-base new file mode 100644 index 0000000..ce03a71 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/exception/.svn/text-base/ControlArmasException.java.svn-base @@ -0,0 +1,38 @@ +package com.fp.armas.rules.exception; + +import com.fp.common.exception.APPException; + +/** + * Excepción que se encarga de manejar los errores dentro de la aplicación de control de armas + * @author dcruz + * + */ +public class ControlArmasException extends APPException { + + private static final long serialVersionUID = 1L; + + /** + * Constructor control de armas + * @param code code codigo del mensaje + * @param message mensaje + * @param pParameters parámetros del mensaje + */ + public ControlArmasException(String code, String message, + Object... pParameters) { + super(code, message, pParameters); + } + + /** + * Constructor control de armas + * @param code codigo del mensaje + * @param message mensaje + * @param pCause causa + * @param pParameters parámetros del mensaje + */ + public ControlArmasException(String code, String message, Exception pCause, + Object... pParameters) { + super(code, message, pCause, pParameters); + } + + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/exception/ControlArmasException.java b/base/business/armas/src/main/java/com/fp/armas/rules/exception/ControlArmasException.java new file mode 100644 index 0000000..ce03a71 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/exception/ControlArmasException.java @@ -0,0 +1,38 @@ +package com.fp.armas.rules.exception; + +import com.fp.common.exception.APPException; + +/** + * Excepción que se encarga de manejar los errores dentro de la aplicación de control de armas + * @author dcruz + * + */ +public class ControlArmasException extends APPException { + + private static final long serialVersionUID = 1L; + + /** + * Constructor control de armas + * @param code code codigo del mensaje + * @param message mensaje + * @param pParameters parámetros del mensaje + */ + public ControlArmasException(String code, String message, + Object... pParameters) { + super(code, message, pParameters); + } + + /** + * Constructor control de armas + * @param code codigo del mensaje + * @param message mensaje + * @param pCause causa + * @param pParameters parámetros del mensaje + */ + public ControlArmasException(String code, String message, Exception pCause, + Object... pParameters) { + super(code, message, pCause, pParameters); + } + + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/.svn/entries b/base/business/armas/src/main/java/com/fp/armas/rules/query/.svn/entries new file mode 100644 index 0000000..ade2152 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/.svn/entries @@ -0,0 +1,43 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com/fp/armas/rules/query +svn://172.17.26.185/COMACO + + + +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +solicitud +dir + +documentos +dir + +webservices +dir + +ordenTrabajoCustodios +dir + +general +dir + diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/documentos/.svn/entries b/base/business/armas/src/main/java/com/fp/armas/rules/query/documentos/.svn/entries new file mode 100644 index 0000000..6ea9924 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/documentos/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com/fp/armas/rules/query/documentos +svn://172.17.26.185/COMACO + + + +2014-09-04T10:43:50.446675Z +526 +ogarcia + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +DocumentoQuery.java +file + + + + +2022-07-28T03:40:40.760794Z +761317aad5581b72c339a4a19b0ef939 +2014-09-04T10:43:50.446675Z +526 +ogarcia + + + + + + + + + + + + + + + + + + + + + +1227 + diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/documentos/.svn/text-base/DocumentoQuery.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/documentos/.svn/text-base/DocumentoQuery.java.svn-base new file mode 100644 index 0000000..8a123e8 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/documentos/.svn/text-base/DocumentoQuery.java.svn-base @@ -0,0 +1,39 @@ +package com.fp.armas.rules.query.documentos; + +import java.sql.Date; +import java.util.Calendar; +import java.util.List; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.sessionbeans.helper.Sequence; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; + +public class DocumentoQuery extends QueryRule{ + + private static final long serialVersionUID = 1L; + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + try { + //Obteniendo los documentos que no han expirado + java.util.Date fechaActual=Calendar.getInstance().getTime(); + Calendar c=Calendar.getInstance(); + c.setTime(fechaActual); + Date sFechaActual=new Date(c.getTimeInMillis()); + + List documentos=PersistenceHelper.getEntityManager().createQuery("select d from TarmSolicitudDocumento d") + /*.setParameter("fechaExpiracion", sFechaActual)*/.getResultList(); + + pQueryRequest.put("documentos", documentos); + + } catch (Exception e) { + throw e; + } + + return pQueryRequest; + } + + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/documentos/DocumentoQuery.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/documentos/DocumentoQuery.java new file mode 100644 index 0000000..8a123e8 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/documentos/DocumentoQuery.java @@ -0,0 +1,39 @@ +package com.fp.armas.rules.query.documentos; + +import java.sql.Date; +import java.util.Calendar; +import java.util.List; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.sessionbeans.helper.Sequence; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; + +public class DocumentoQuery extends QueryRule{ + + private static final long serialVersionUID = 1L; + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + try { + //Obteniendo los documentos que no han expirado + java.util.Date fechaActual=Calendar.getInstance().getTime(); + Calendar c=Calendar.getInstance(); + c.setTime(fechaActual); + Date sFechaActual=new Date(c.getTimeInMillis()); + + List documentos=PersistenceHelper.getEntityManager().createQuery("select d from TarmSolicitudDocumento d") + /*.setParameter("fechaExpiracion", sFechaActual)*/.getResultList(); + + pQueryRequest.put("documentos", documentos); + + } catch (Exception e) { + throw e; + } + + return pQueryRequest; + } + + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/general/.svn/entries b/base/business/armas/src/main/java/com/fp/armas/rules/query/general/.svn/entries new file mode 100644 index 0000000..39b0d8c --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/general/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com/fp/armas/rules/query/general +svn://172.17.26.185/COMACO + + + +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ArmasQuery.java +file + + + + +2022-07-28T03:40:40.909795Z +3f59b5c56dfad483d1ea0b72d35e910b +2022-04-19T02:27:53.431385Z +4665 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +3659 + diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/general/.svn/prop-base/ArmasQuery.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/general/.svn/prop-base/ArmasQuery.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/general/.svn/prop-base/ArmasQuery.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/general/.svn/text-base/ArmasQuery.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/general/.svn/text-base/ArmasQuery.java.svn-base new file mode 100644 index 0000000..9b9e07a --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/general/.svn/text-base/ArmasQuery.java.svn-base @@ -0,0 +1,58 @@ +package com.fp.armas.rules.query.general; + +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; + +/** + * Clase que obtiene los datos completos del arma + * @author dcruz + * + */ +public class ArmasQuery extends QueryRule { + + private static final long serialVersionUID = 1L; + + /** + * Completa datos del arma + */ + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + QueryJsf query = new QueryJsf(); + query.execute(pRequest); + List armasList = (List) pRequest.getResponse().get("ARMAS"); + this.managedResponse(armasList); + return pRequest; + } + + /** + * Agrega metadata adicional de las armas para mostrar en las consultas + * @param armasList + * @throws Exception + * @throws CommondbException + */ + private void managedResponse(List armasList) throws CommondbException, Exception{ + for (TarmArmas armas : armasList) { + //agrego los datos de + TgeneCatalogDetail clase= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(armas.getModifiedData().get("cclase") != null ? armas.getModifiedData().get("cclase").toString() : "", armas.getModifiedData().get("cclasecodigo") != null ? armas.getModifiedData().get("cclasecodigo").toString() : "")); + armas.modifiedData.put("clase", clase != null ? clase.getDescription():null); + TgeneCatalogDetail tipoArma= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(armas.getModifiedData().get("ctipoarmaexplosivo") != null ? armas.getModifiedData().get("ctipoarmaexplosivo").toString() : "", armas.getModifiedData().get("ctipoarmaexplosivocodigo") != null ? armas.getModifiedData().get("ctipoarmaexplosivocodigo").toString() : "")); + armas.modifiedData.put("tipoarmaexplosivo", tipoArma != null ? tipoArma.getDescription():null); + TgeneCatalogDetail unidadMedida= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(armas.getModifiedData().get("cunidadmedidapeso") != null ? armas.getModifiedData().get("cunidadmedidapeso").toString():"", armas.getModifiedData().get("cunidadmedidapesocodigo") != null ? armas.getModifiedData().get("cunidadmedidapesocodigo").toString() : "")); + armas.modifiedData.put("unidadmedidapeso", unidadMedida != null ? unidadMedida.getDescription():null); + TgeneCatalogDetail calibre= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(armas.getModifiedData().get("ccalibre") != null ? armas.getModifiedData().get("ccalibre").toString() : "", armas.getModifiedData().get("ccalibrecodigo") != null ? armas.getModifiedData().get("ccalibrecodigo").toString() : "")); + armas.modifiedData.put("calibre", calibre != null ? calibre.getDescription() : null); + TgeneCatalogDetail longitud= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(armas.getModifiedData().get("clongitud") != null ? armas.getModifiedData().get("clongitud").toString() : "", armas.getModifiedData().get("clongitudcodigo") != null ? armas.getModifiedData().get("clongitudcodigo").toString() : "")); + armas.modifiedData.put("longitud", longitud != null ? longitud.getDescription() : null); + } + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/general/ArmasQuery.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/general/ArmasQuery.java new file mode 100644 index 0000000..9b9e07a --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/general/ArmasQuery.java @@ -0,0 +1,58 @@ +package com.fp.armas.rules.query.general; + +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; + +/** + * Clase que obtiene los datos completos del arma + * @author dcruz + * + */ +public class ArmasQuery extends QueryRule { + + private static final long serialVersionUID = 1L; + + /** + * Completa datos del arma + */ + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + QueryJsf query = new QueryJsf(); + query.execute(pRequest); + List armasList = (List) pRequest.getResponse().get("ARMAS"); + this.managedResponse(armasList); + return pRequest; + } + + /** + * Agrega metadata adicional de las armas para mostrar en las consultas + * @param armasList + * @throws Exception + * @throws CommondbException + */ + private void managedResponse(List armasList) throws CommondbException, Exception{ + for (TarmArmas armas : armasList) { + //agrego los datos de + TgeneCatalogDetail clase= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(armas.getModifiedData().get("cclase") != null ? armas.getModifiedData().get("cclase").toString() : "", armas.getModifiedData().get("cclasecodigo") != null ? armas.getModifiedData().get("cclasecodigo").toString() : "")); + armas.modifiedData.put("clase", clase != null ? clase.getDescription():null); + TgeneCatalogDetail tipoArma= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(armas.getModifiedData().get("ctipoarmaexplosivo") != null ? armas.getModifiedData().get("ctipoarmaexplosivo").toString() : "", armas.getModifiedData().get("ctipoarmaexplosivocodigo") != null ? armas.getModifiedData().get("ctipoarmaexplosivocodigo").toString() : "")); + armas.modifiedData.put("tipoarmaexplosivo", tipoArma != null ? tipoArma.getDescription():null); + TgeneCatalogDetail unidadMedida= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(armas.getModifiedData().get("cunidadmedidapeso") != null ? armas.getModifiedData().get("cunidadmedidapeso").toString():"", armas.getModifiedData().get("cunidadmedidapesocodigo") != null ? armas.getModifiedData().get("cunidadmedidapesocodigo").toString() : "")); + armas.modifiedData.put("unidadmedidapeso", unidadMedida != null ? unidadMedida.getDescription():null); + TgeneCatalogDetail calibre= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(armas.getModifiedData().get("ccalibre") != null ? armas.getModifiedData().get("ccalibre").toString() : "", armas.getModifiedData().get("ccalibrecodigo") != null ? armas.getModifiedData().get("ccalibrecodigo").toString() : "")); + armas.modifiedData.put("calibre", calibre != null ? calibre.getDescription() : null); + TgeneCatalogDetail longitud= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(armas.getModifiedData().get("clongitud") != null ? armas.getModifiedData().get("clongitud").toString() : "", armas.getModifiedData().get("clongitudcodigo") != null ? armas.getModifiedData().get("clongitudcodigo").toString() : "")); + armas.modifiedData.put("longitud", longitud != null ? longitud.getDescription() : null); + } + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/ordenTrabajoCustodios/.svn/entries b/base/business/armas/src/main/java/com/fp/armas/rules/query/ordenTrabajoCustodios/.svn/entries new file mode 100644 index 0000000..5484a07 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/ordenTrabajoCustodios/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com/fp/armas/rules/query/ordenTrabajoCustodios +svn://172.17.26.185/COMACO + + + +2015-06-23T07:14:38.225355Z +4126 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +OrdenTrabajoQuery.java +file + + + + +2022-07-28T03:40:40.876795Z +4638dce4ba0199d3dd55c858b199e47e +2015-06-23T07:14:38.225355Z +4126 +cpiedra + + + + + + + + + + + + + + + + + + + + + +772 + diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/ordenTrabajoCustodios/.svn/text-base/OrdenTrabajoQuery.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/ordenTrabajoCustodios/.svn/text-base/OrdenTrabajoQuery.java.svn-base new file mode 100644 index 0000000..93d6718 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/ordenTrabajoCustodios/.svn/text-base/OrdenTrabajoQuery.java.svn-base @@ -0,0 +1,27 @@ +package com.fp.armas.rules.query.ordenTrabajoCustodios; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.sessionbeans.helper.Sequence; + +public class OrdenTrabajoQuery extends QueryRule { + + /** + * + */ + private static final long serialVersionUID = 1L; + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + + //Obteniendo y reservando el numero de la orden de trabajo + Sequence sequence = new Sequence(); + Integer nextValue = Integer.valueOf(sequence.getNextValue("CORDENTRABAJO").toString()); + pQueryRequest.getResponse().put("SECUENCIALSOLORDENTRABAJO", nextValue); + + return pQueryRequest; + } + + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/ordenTrabajoCustodios/OrdenTrabajoQuery.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/ordenTrabajoCustodios/OrdenTrabajoQuery.java new file mode 100644 index 0000000..93d6718 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/ordenTrabajoCustodios/OrdenTrabajoQuery.java @@ -0,0 +1,27 @@ +package com.fp.armas.rules.query.ordenTrabajoCustodios; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.sessionbeans.helper.Sequence; + +public class OrdenTrabajoQuery extends QueryRule { + + /** + * + */ + private static final long serialVersionUID = 1L; + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + + //Obteniendo y reservando el numero de la orden de trabajo + Sequence sequence = new Sequence(); + Integer nextValue = Integer.valueOf(sequence.getNextValue("CORDENTRABAJO").toString()); + pQueryRequest.getResponse().put("SECUENCIALSOLORDENTRABAJO", nextValue); + + return pQueryRequest; + } + + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/entries b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/entries new file mode 100644 index 0000000..5f28a98 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/entries @@ -0,0 +1,334 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud +svn://172.17.26.185/COMACO + + + +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +CashManagementQuery.java +file + + + + +2022-07-28T03:40:40.727794Z +57f59ff46c249555153896e6d045ebf3 +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +3153 + +VerificarArmaQuery.java +file + + + + +2022-07-28T03:40:40.727794Z +b184f76624e164669dab1b533490138c +2016-03-31T17:34:13.451294Z +4529 +cvasquez + + + + + + + + + + + + + + + + + + + + + +5862 + +VerificarInfoCertificado.java +file + + + + +2022-07-28T03:40:40.727794Z +0afaf51a197976bafc6ce2d461640c42 +2014-11-10T12:57:00.965141Z +2551 +dlopez + + + + + + + + + + + + + + + + + + + + + +543 + +CertificadoFiscaliaSecuencial.java +file + + + + +2022-07-28T03:40:40.727794Z +23e08b65d4334dfa7cdc5531a3948f57 +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1169 + +CompletaDatosInspeccionPlan.java +file + + + + +2022-07-28T03:40:40.728794Z +83bc44691f785e26636509c11d71535a +2014-11-13T08:16:14.195795Z +2704 +cpiedra + + + + + + + + + + + + + + + + + + + + + +7725 + +ArmasXPersonaQuery.java +file + + + + +2022-07-28T03:40:40.728794Z +fcf65a7a14046b4201053b33cb1a4b6a +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +5461 + +SolicitudSecuencial.java +file + + + + +2022-07-28T03:40:40.728794Z +e961fafdabc120dfe72b85d36b416fc6 +2022-04-19T02:27:53.431385Z +4665 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1099 + +CompletaInfoVerificarDocumentos.java +file + + + + +2022-07-28T03:40:40.728794Z +719c734163d750e46bf233e9793aa60a +2014-11-05T23:57:29.788107Z +2377 +dlopez + + + + + + + + + + + + + + + + + + + + + +1675 + +CashHistoricoSecuencial.java +file + + + + +2022-07-28T03:40:40.729794Z +3ed0c0c66385d605d4a4645a7e9563ea +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1023 + diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/prop-base/SolicitudSecuencial.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/prop-base/SolicitudSecuencial.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/prop-base/SolicitudSecuencial.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/ArmasXPersonaQuery.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/ArmasXPersonaQuery.java.svn-base new file mode 100644 index 0000000..9204d2d --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/ArmasXPersonaQuery.java.svn-base @@ -0,0 +1,109 @@ +package com.fp.armas.rules.query.solicitud; + +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; + +/** + * Clase que obtiene los datos completos del arma que estan asignadas a una persona o + * proveedor + * @author C.P + * + */ +public class ArmasXPersonaQuery extends QueryRule { + + + private static final long serialVersionUID = 1L; + + /** + * Completa datos del arma + */ + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + QueryJsf query = new QueryJsf(); + query.execute(pRequest); + TgeneParametersKey key = new TgeneParametersKey(); + key.setCode("COD.REGISTRADO.ESTADO");//codigo del arma en REG + key.setCompanycode(1); + TgeneParameters parametro=TgeneParameters.find(PersistenceHelper.getEntityManager(),key); + + List registroarmasList = (List) pRequest.getResponse().get("TREGISTROARMAS"); + String serielote=""; + if(pRequest.get("serielote")!=null && pRequest.get("serielote").toString().length()>0){ + serielote= " and o.lote='"+(String)pRequest.get("serielote")+"'"; + } + + String codigoReg=null; + for(TarmRegistroArmas registro:registroarmasList){ + if(codigoReg==null){ + codigoReg="o.cregistro="+registro.getPk(); + }else{ + codigoReg+=" or o.cregistro="+registro.getPk(); + } + } + if(codigoReg!=null){ + //select con los codigos del registro que tenga una persona, por la fecha maxima por registro por el explosivos, cajas, filtramos si ya esta en la tabla tardecomiso arma + //y que esten en estado reg + List armasList =PersistenceHelper.getEntityManager().createQuery("Select o from TarmArmas o where ("+codigoReg+" )" + + " and o.estado IN ('APTA','DEV','AUTO','REG') " + + " and o.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where o.codigoarma=ta.codigoarma and o.cregistro=ta.cregistro)" + + " and o.pk NOT IN (select dec.carma from TarmDecomisoArma dec where dec.estado= 'CUSTEM')" + + serielote).getResultList(); + + this.managedResponse(armasList); + pRequest.getResponse().put("ARMASLIST", armasList); + } + + return pRequest; + } + + /** + * Agrega metadata adicional de las armas para mostrar en las consultas + * @param armasList + * @throws Exception + * @throws CommondbException + */ + private void managedResponse(List armasList) throws CommondbException, Exception{ + for (TarmArmas armas : armasList) { + + TarmTipoArmaExplosivo explisivo= TarmTipoArmaExplosivo.find(PersistenceHelper.getEntityManager(),armas.getCtipoarmaexplosivo()); + + TgeneCatalogDetail clase= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), + new TgeneCatalogDetailKey(explisivo.getClase()!= null ? explisivo.getClase():"", explisivo.getClasecodigo() != null ? explisivo.getClasecodigo() : "")); + armas.modifiedData.put("clase", clase != null ? clase.getDescription():null); + + TgeneCatalogDetail tipoArma= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), + new TgeneCatalogDetailKey(explisivo.getTipoarmaexplosivo() != null ? explisivo.getTipoarmaexplosivo() : "", explisivo.getTipoarmaexplosivocodigo()!= null ? explisivo.getTipoarmaexplosivocodigo(): "")); + armas.modifiedData.put("tipoarmaexplosivo", tipoArma != null ? tipoArma.getDescription():null); + + TgeneCatalogDetail unidadMedida= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), + new TgeneCatalogDetailKey(explisivo.getUnidadmedidapeso() != null ? explisivo.getUnidadmedidapeso():"", explisivo.getUnidadmedidapesocodigo() != null ? explisivo.getUnidadmedidapesocodigo() : "")); + armas.modifiedData.put("unidadmedidapeso", unidadMedida != null ? unidadMedida.getDescription():null); + + TgeneCatalogDetail calibre= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), + new TgeneCatalogDetailKey(explisivo.getCalibre() != null ? explisivo.getCalibre() : "", explisivo.getCalibrecodigo() != null ? explisivo.getCalibrecodigo() : "")); + armas.modifiedData.put("calibre", calibre != null ? calibre.getDescription() : null); + + TgeneCatalogDetail longitud= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), + new TgeneCatalogDetailKey(explisivo.getLongitud() != null ? explisivo.getLongitud() : "", explisivo.getLongitudcodigo() != null ? explisivo.getLongitudcodigo() : "")); + armas.modifiedData.put("longitud", longitud != null ? longitud.getDescription() : null); + + TgeneCatalogDetail marca= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), + new TgeneCatalogDetailKey(armas.getMarca() != null ? armas.getMarca() : "", armas.getMarcacodigo() != null ? armas.getMarcacodigo() : "")); + armas.modifiedData.put("marca", marca != null ? marca.getDescription():null); + } + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/CashHistoricoSecuencial.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/CashHistoricoSecuencial.java.svn-base new file mode 100644 index 0000000..a0c9c16 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/CashHistoricoSecuencial.java.svn-base @@ -0,0 +1,31 @@ +package com.fp.armas.rules.query.solicitud; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Genera un número secuencial de historico cash management + * @author Christian Pazmino + * + */ +public class CashHistoricoSecuencial extends QueryRule { + + private static final long serialVersionUID = 1L; + + /** + * Obtiene el secuencial de la solicitud y lo reserva para posteriores validaciones + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + // TODO Auto-generated method stub + System.out.println("Ingresa al secuencial de historico cash management"); + Sequence sequence = new Sequence(); + Integer nextValue = Integer.valueOf(sequence.getNextValue("CCASHHISTORY").toString()); + pQueryRequest.getResponse().put("CASHHISTORICOSEQUENCE", StringUtils.leftPad(String.valueOf(nextValue), 6, '0')); + return pQueryRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/CashManagementQuery.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/CashManagementQuery.java.svn-base new file mode 100644 index 0000000..de0da03 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/CashManagementQuery.java.svn-base @@ -0,0 +1,65 @@ +package com.fp.armas.rules.query.solicitud; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Query; + +import com.fp.bpm.query.QueryJsf; +import com.fp.common.helper.Constant; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.CashManagementDTO; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; + +/** + * Clase que obtiene los datos del reporte de cash management + * @author Christian Pazmino + * + */ +public class CashManagementQuery extends QueryRule { + + + private static final long serialVersionUID = 1L; + + String sql ="select 'CO' AS codigoServicio, sol.numerosolicitud as contrato, 'USD' AS moneda, " + + "soltra.valorapagar AS valorapagar, 'REC' AS formaCobro, '' as tipoCuenta, '' as numeroCuenta, " + + "tipaut.description as referencia, (case perdet.identificationcatalog when 'CED' then 'C' WHEN 'RUC' THEN 'R' WHEN 'PAS' THEN 'P' ELSE 'N' END) as tipoIDCliente, " + + "perdet.identification as numeroIDCliente, perdet.name as nombreCliente,'1' as baseImponible, sol.csolicitud as csolicitud " + + "from tarmsolicitud sol inner join tarmsolicitudtramite soltra on sol.csolicitud = soltra.csolicitud " + + "left join tcustpersondetail perdet on sol.personcode = perdet.personcode and perdet.dateto = to_date('2999-12-31', 'YYYY-MM-DD') " + + "left join tarmtramite tra on tra.ctramite = sol.ctramite " + + "left join tgenecatalogdetail tipaut on tra.tipoautorizacion = tipaut.catalog and tra.tipoautorizacioncodigo = tipaut.catalogcode " + + "where soltra.INCASHREPORT is null and soltra.numerocomprobante is null and soltra.estadotramite='REG' and soltra.valorapagar>0 " + + "and trunc(sol.fverificarequisitos) >= to_date(':fechaInicialStr','DD/MM/RRRR') and trunc(sol.fverificarequisitos) <= to_date(':fechaFinalStr','DD/MM/RRRR')"; + + /** + * Completa datos del arma + */ + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + String fechaInicialStr = pRequest.get("fechaInicialStr").toString(); + String fechaFinalStr = pRequest.get("fechaFinalStr").toString(); + sql=sql.replace(":fechaInicialStr", fechaInicialStr); + sql=sql.replace(":fechaFinalStr", fechaFinalStr); + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(sql); + //qry.setParameter("fechaInicialStr", fechaInicialStr); + //qry.setParameter("fechaFinalStr", fechaFinalStr); + List lCashManagement = qry.getResultList(); + pRequest.getResponse().put("CASHMANAGEMENTLIST", lCashManagement); + return pRequest; + } + + + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/CertificadoFiscaliaSecuencial.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/CertificadoFiscaliaSecuencial.java.svn-base new file mode 100644 index 0000000..90b3d08 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/CertificadoFiscaliaSecuencial.java.svn-base @@ -0,0 +1,36 @@ +package com.fp.armas.rules.query.solicitud; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Genera un número secuencial del certificado de fiscalia + * @author Manuel Cepeda + * + */ +public class CertificadoFiscaliaSecuencial extends QueryRule { + + /** + * prefijo base certificado fiscalia + */ + private static final String PRESOL_BASE = "FIS"; + + private static final long serialVersionUID = 5722213865460295851L; + + /** + * Obtiene el secuencial del certificado de la fiscalia y lo reserva para posteriores validaciones + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + // TODO Auto-generated method stub + System.out.println("Ingresa al secuencial armas"); + Sequence sequence = new Sequence(); + Integer nextValue = Integer.valueOf(sequence.getNextValue("CERTIFICADOFISCALIA").toString()); + pQueryRequest.getResponse().put("SECUENCIALCERTIFICADOFISCAL", PRESOL_BASE+"-"+StringUtils.leftPad(String.valueOf(nextValue), 10, '0')); + return pQueryRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/CompletaDatosInspeccionPlan.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/CompletaDatosInspeccionPlan.java.svn-base new file mode 100644 index 0000000..dcbd5e3 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/CompletaDatosInspeccionPlan.java.svn-base @@ -0,0 +1,175 @@ +package com.fp.armas.rules.query.solicitud; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; + +@SuppressWarnings("serial") +public class CompletaDatosInspeccionPlan extends QueryRule{ + + private EntityManager em = null; + private String jpqlPersona = "select p.pk.personcode, " + + "(select c.description from TgeneCatalogDetail c where c.pk.catalog = p.identificationcatalog and c.pk.catalogcode = p.identificationcatalogcode) as tipodoc, " + + " p.identification," + + " p.name," + + " p.legalrepresentidentification," + + " p.legalrepresent" + + " from TcustPersonDetail p " + + " where p.pk.personcode = :personcode and p.pk.dateto = :dateto"; + private String jpqlPersonaDireccion = "select p.addresstypecatalog, " + + " p.address, " + + " p.remark, " + + " (select o.description from TgeneProvince o where o.pk.countrycode='EC' and o.pk.provincecode=p.provincecode) as provincia," + + " (select o.description from TgeneCanton o where o.pk.countrycode='EC' and o.pk.provincecode=p.provincecode and o.pk.cantoncode=p.cantoncode) as canton," + + " (select o.description from TgeneCity o where o.pk.countrycode='EC' and o.pk.provincecode=p.provincecode and o.pk.cantoncode=p.cantoncode and o.pk.citycode=p.citycode) as ciudad," + + " (select o.description from TgeneParroquia o where o.pk.countrycode='EC' and o.pk.provincecode=p.provincecode and o.pk.cantoncode=p.cantoncode and o.pk.parroquiacode=p.parroquiacode) as parroquia" + + " from TcustPersonAddress p " + + " where p.pk.personcode = :personcode and p.pk.dateto = :dateto"; + + Map persona = new HashMap(); + private String codigoPhoneFijo; + private String codigoPhoneCelular; + private String codigoMail; + private String codigoOficina; + @Override + public QueryRequest process(QueryRequest pQueyRequest) throws Exception { + QueryJsf query = new QueryJsf(); + query.execute(pQueyRequest); + em = PersistenceHelper.getEntityManager(); + TcustPersonDetail personDetailResp = (TcustPersonDetail)pQueyRequest.getResponse().get("REGINSPECPLANINO"); + completarResponsable(personDetailResp); + Integer personCodePropietario=Integer.parseInt(pQueyRequest.get("personcodepropietario").toString()); + String ccentrocontrol =pQueyRequest.get("ccentrocontrol").toString(); + //propietario 1 + dataPerson(personCodePropietario); + direccion(personCodePropietario); + telefonoPropietario(personCodePropietario); + pQueyRequest.getResponse().put("PERSONAPROPIETARIO", persona); + return pQueyRequest; + } + + private void dataPerson(Integer personcode) throws Exception{ + Query qry = this.em.createQuery(this.jpqlPersona); + qry.setParameter("personcode", personcode); + qry.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + Object[] objeto = (Object[])qry.getSingleResult(); + if(objeto!=null){ + persona.put("personcode", objeto[0]); + persona.put("tipoidentificacion", objeto[1]); + persona.put("identification", objeto[2]); + persona.put("name", objeto[3]); + persona.put("legalrepresentidentification", objeto[4]); + persona.put("legalrepresent", objeto[5]); + } + } + @SuppressWarnings("unchecked") + public void direccion(Integer personcode) throws Exception{ + codigoMail=codigoParameter("CODIGO.MAIL"); + Query qry2 = this.em.createQuery(this.jpqlPersonaDireccion); + qry2.setParameter("personcode", personcode); + qry2.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List ldirecciones = qry2.getResultList(); + + for(Object direc:ldirecciones){ + Object[] objeto=(Object[])direc; + //correo + if(objeto[0]!=null && objeto[0].equals(codigoMail)){ + if(objeto[1]!=null){ + persona.put("mail", objeto[1]); + } + }else{ + if(objeto[1]!=null){ + persona.put("address", objeto[1]); + } + + if(objeto[2]!=null){ + persona.put("remark", objeto[2]); + } + if(objeto[3]!=null){ + persona.put("provincia", objeto[3]); + } + if(objeto[4]!=null){ + persona.put("canton", objeto[4]); + } + if(objeto[5]!=null){ + persona.put("ciudad", objeto[5]); + } + if(objeto[6]!=null){ + persona.put("parroquia", objeto[6]); + } + } + } + } + + @SuppressWarnings("unchecked") + private void telefonoPropietario(Integer personcode) throws Exception{ + List phones =em.createQuery("select o from TcustPersonPhone o" + + " where o.pk.personcode=:personcode and o.pk.dateto=:dateto order by o.phonetypecatalog asc") + .setParameter("personcode", personcode) + .setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()) + .getResultList(); + for(TcustPersonPhone tel:phones){ + persona.put("telefono", tel.getPhonenumber()); + break; + } + } + + + @SuppressWarnings("unchecked") + private void completarResponsable(TcustPersonDetail tcustPersonDetail) throws Exception{ + codigoPhoneFijo=codigoParameter("CODIGO.PHONE.FIJO"); + codigoPhoneCelular=codigoParameter("CODIGO.PHONE.CELULAR"); + List phones =em.createQuery("select o from TcustPersonPhone o" + + " where o.pk.personcode=:personcode and o.pk.dateto=:dateto") + .setParameter("personcode", tcustPersonDetail.getPk().getPersoncode()) + .setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()) + .getResultList(); + for(TcustPersonPhone telefono:phones){ + if(telefono.getPhonetypecatalog().equals(codigoPhoneFijo)){ // CODIGO.PHONE.FIJO + tcustPersonDetail.getModifiedData().put("fijo", telefono.getPhonenumber()); + }else if(telefono.getPhonetypecatalog().equals(codigoPhoneCelular)){// CODIGO.PHONE.CELULAR + tcustPersonDetail.getModifiedData().put("celular", telefono.getPhonenumber()); + } + } + + //mail + List maill =em.createQuery("select o from TcustPersonAddress o" + + " where o.pk.personcode=:personcode and o.pk.dateto=:dateto and o.addresstypecatalog=:addresstypecatalog") + .setParameter("personcode", tcustPersonDetail.getPk().getPersoncode()) + .setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()) + .setParameter("addresstypecatalog", codigoMail) + .getResultList(); + for(TcustPersonAddress mail:maill){ + if(mail.getAddress()!=null){ + tcustPersonDetail.getModifiedData().put("mail", mail.getAddress()); + break; + } + } + + } + + private void centroControl(String ccentrocontrol, QueryRequest sr, String tipo) throws Exception{ + TarmCentroControl centroControl= TarmCentroControl.find(this.em,ccentrocontrol); + sr.getResponse().put("CENTROCONTROL", centroControl); + } + + private String codigoParameter(String codigo) throws Exception{ + TgeneParameters parameter= TgeneParameters.find(this.em, new TgeneParametersKey(codigo, 1)); + return parameter.getTextvalue(); + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/CompletaInfoVerificarDocumentos.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/CompletaInfoVerificarDocumentos.java.svn-base new file mode 100644 index 0000000..083de52 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/CompletaInfoVerificarDocumentos.java.svn-base @@ -0,0 +1,45 @@ +package com.fp.armas.rules.query.solicitud; + +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.gene.TgeneProvinceKey; + +public class CompletaInfoVerificarDocumentos extends QueryRule{ + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + QueryJsf qry = new QueryJsf(); + qry.execute(pQueryRequest); + + List datos = (List)pQueryRequest.getResponse().get("VERIFICARDOCUMENTOS");//VERIFICARDOCUMENTOS + if(datos!=null){ + for(Object dato : datos){ + TarmSolicitudDocumento sol = (TarmSolicitudDocumento)dato; + String centroControl =(String)sol.modifiedData.get("ccentrocontrol"); + if(centroControl != null){ + TarmCentroControl cControl = TarmCentroControl.find(PersistenceHelper.getEntityManager(), centroControl); + if(cControl != null){ + TgeneProvinceKey key = new TgeneProvinceKey(); + key.setCountrycode(cControl.getCountrycode()); + key.setProvincecode(cControl.getProvincecode()); + TgeneProvince province = TgeneProvince.find(PersistenceHelper.getEntityManager(), key); + sol.modifiedData.put("ubicaciondesc", province.getDescription()); + } + } + + + } + } + return pQueryRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/SolicitudSecuencial.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/SolicitudSecuencial.java.svn-base new file mode 100644 index 0000000..7f8f536 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/SolicitudSecuencial.java.svn-base @@ -0,0 +1,36 @@ +package com.fp.armas.rules.query.solicitud; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Genera un número secuencial de solicitud + * @author dcruz + * + */ +public class SolicitudSecuencial extends QueryRule { + + /** + * prefijo base solicitud + */ + private static final String PRESOL_BASE = "SOL"; + + private static final long serialVersionUID = 5722213865460295851L; + + /** + * Obtiene el secuencial de la solicitud y lo reserva para posteriores validaciones + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + // TODO Auto-generated method stub + System.out.println("Ingresa al secuencial armas"); + Sequence sequence = new Sequence(); + Integer nextValue = Integer.valueOf(sequence.getNextValue("CNUMEROSOLICITUD").toString()); + pQueryRequest.getResponse().put("SECUENCIALSOLICITUD", PRESOL_BASE+"-"+StringUtils.leftPad(String.valueOf(nextValue), 10, '0')); + return pQueryRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/VerificarArmaQuery.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/VerificarArmaQuery.java.svn-base new file mode 100644 index 0000000..2a1daf8 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/VerificarArmaQuery.java.svn-base @@ -0,0 +1,142 @@ +package com.fp.armas.rules.query.solicitud; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +/** + * + * @author Norge Dominguez Cand + * + */ +public class VerificarArmaQuery extends QueryRule { + + private static final String CODIGO_DIAS_DECOMISO = "DIASDECOMISO"; + private static final String CODIGO_RECL = "CODIGO.RECL"; + private static final String CODIGO_ABAN = "CODIGO.ABAN"; + private static final String CODIGO_ENTV = "CODIGO.ENTV"; + private static final String CODIGO_INCAUTADA = "CODIGO.INCAUTADA"; + private static final String CODIGO_DECOMISADA = "CODIGO.DECOMISADA"; + private static final long serialVersionUID = 8055423288586131089L; + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + //Obtener valores + String centroControl = (String) pRequest.get("centroControl"); + String numeroDecomiso = (String) pRequest.get("numeroDecomiso"); + String numeroserie = (String) pRequest.get("numeroserie"); + String fechacorte = (String) pRequest.get("fechacorte"); + + String codigoDecomiso = codigos(CODIGO_DECOMISADA);// DECOMISO + String codigoIncautacion = codigos(CODIGO_INCAUTADA);// INCAUTACION + String codigoEntVol = codigos(CODIGO_ENTV);// ENTREGA VOLUNTARIA + String codigoAbandono = codigos(CODIGO_ABAN);// ABANDONO + String codigoReclamo = codigos(CODIGO_RECL);// RECLAMO + String codigoDiasDecomiso = codigos(CODIGO_DIAS_DECOMISO);// DIAS DECOMISO + if ( fechacorte == null || fechacorte.isEmpty() ) { + fechacorte = new Date().toString(); + } + + //Se filtra por centrocontrol, estados, bodega + StringBuffer bufferFiltro = new StringBuffer(); + + //Filtro por estados, fecha, enBodega + bufferFiltro.append("select t.* from tarmdecomisoarma t join tarmdecomiso td on t.cdecomiso = td.cdecomiso join tarmarmas ta on t.carma = ta.carma " + + "where trunc(t.fdecomiso) <= TO_DATE('"+fechacorte+"','yyyy-mm-dd') and abs(TRUNC(TO_DATE('"+fechacorte+"','yyyy-mm-dd')) - TRUNC(t.fdecomiso))>= "+codigoDiasDecomiso); + bufferFiltro.append(" and (t.estado='"+codigoDecomiso+"' or t.estado='"+codigoIncautacion+"' or t.estado='"+codigoEntVol+"' or t.estado='"+codigoAbandono+"' or t.estado='"+codigoReclamo+"') and t.enbodega= 'Y'"); + + + if(numeroDecomiso!=null && !numeroDecomiso.isEmpty()){ + + bufferFiltro.append(" and td.numerotransaccion ='"+numeroDecomiso+"'"); + } + + if(numeroserie!=null && !numeroserie.isEmpty()){ + + bufferFiltro.append(" and ta.lote ='"+numeroserie+"'"); + } + + //Filtro para la tabla decomiso + StringBuffer bufferDecomiso = new StringBuffer(); + bufferDecomiso.append(bufferFiltro); + bufferDecomiso.append(" and t.cdecomisoarmatransaccion is null and t.cdecarmtranrecepcion is null and t.coperaciontransaccion is null and td.ccentrocontrol = '" + centroControl + "'"); + + List cdecomisos = PersistenceHelper.getEntityManager().createNativeQuery(bufferDecomiso.toString(), TarmDecomisoArma.class).getResultList(); + + //Filtro para la tabla decomiso + StringBuffer bufferOperacion = new StringBuffer(); + bufferOperacion.append(bufferFiltro); + int intWhere = bufferOperacion.indexOf("where"); + bufferOperacion.insert(intWhere, "join tarmdecomisoarmatransaccion tt on t.cdecomisoarmatransaccion = tt.cdecomisoarmatransaccion " + + "join tarmtransaccionarmabodega tb on t.carma = tb.carma and t.cdecomisoarmatransaccion = tb.cdecomisoarmatransaccion "); + + bufferOperacion.append(" and tt.estadofirma = 'Y' and t.coperaciontransaccion = 'RECEPCION' and tb.ccentrocontroldestino = '" + centroControl + "'"); + + List operaciontransacciones = (List)PersistenceHelper.getEntityManager().createNativeQuery(bufferOperacion.toString(), TarmDecomisoArma.class).getResultList(); + + List tarmdecomisoarmas = new ArrayList(); + //Add toda la collection con filtro de decomisos + tarmdecomisoarmas.addAll(cdecomisos); + //Add toda la collection con filtro de operacion + tarmdecomisoarmas.addAll(operaciontransacciones); + + pRequest.getResponse().put("RPRTEDESTRUCCIONDEARMAS", tarmdecomisoarmas); + return pRequest; + } + + /** + * Metodo para obtener los codigos + */ + private String codigos(String parametro) { + String codigo = null; + TgeneParameters tgeneParameters; + try { + tgeneParameters = TgeneParameters.find( + PersistenceHelper.getEntityManager(), new TgeneParametersKey( + parametro, new Integer(1))); + if (tgeneParameters == null || tgeneParameters.getTextvalue() == null) { + codigo = codigosTemp(parametro); + } else { + codigo = tgeneParameters.getTextvalue(); + } + + } catch (Exception e) { + return codigosTemp(parametro); + } + + return codigo; + } + + /** + * En caso de no poder acceder a la base se asigna codigo temporal + * + * @param parametro + * @return + * @throws Exception + */ + private String codigosTemp(String parametro) { + String codigoTemp = null; + if (CODIGO_DECOMISADA.equals(parametro)) { + codigoTemp = "DEC"; + } else if (CODIGO_INCAUTADA.equals(parametro)) { + codigoTemp = "INC"; + } else if (CODIGO_ENTV.equals(parametro)) { + codigoTemp = "ENTR"; + } else if (CODIGO_ABAN.equals(parametro)) { + codigoTemp = "ABA"; + } else if (CODIGO_RECL.equals(parametro)) { + codigoTemp = "RECL"; + } else if (CODIGO_DIAS_DECOMISO.equals(parametro)) { + codigoTemp = "0"; + } + return codigoTemp; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/VerificarInfoCertificado.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/VerificarInfoCertificado.java.svn-base new file mode 100644 index 0000000..9b55760 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/.svn/text-base/VerificarInfoCertificado.java.svn-base @@ -0,0 +1,20 @@ +package com.fp.armas.rules.query.solicitud; + +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +public class VerificarInfoCertificado extends QueryRule{ + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + QueryJsf qry = new QueryJsf(); + qry.execute(pQueryRequest); + + List datos = (List)pQueryRequest.getResponse().get("VERIFICARINFORMACIONCERTIFICADO"); + return pQueryRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/ArmasXPersonaQuery.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/ArmasXPersonaQuery.java new file mode 100644 index 0000000..9204d2d --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/ArmasXPersonaQuery.java @@ -0,0 +1,109 @@ +package com.fp.armas.rules.query.solicitud; + +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; + +/** + * Clase que obtiene los datos completos del arma que estan asignadas a una persona o + * proveedor + * @author C.P + * + */ +public class ArmasXPersonaQuery extends QueryRule { + + + private static final long serialVersionUID = 1L; + + /** + * Completa datos del arma + */ + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + QueryJsf query = new QueryJsf(); + query.execute(pRequest); + TgeneParametersKey key = new TgeneParametersKey(); + key.setCode("COD.REGISTRADO.ESTADO");//codigo del arma en REG + key.setCompanycode(1); + TgeneParameters parametro=TgeneParameters.find(PersistenceHelper.getEntityManager(),key); + + List registroarmasList = (List) pRequest.getResponse().get("TREGISTROARMAS"); + String serielote=""; + if(pRequest.get("serielote")!=null && pRequest.get("serielote").toString().length()>0){ + serielote= " and o.lote='"+(String)pRequest.get("serielote")+"'"; + } + + String codigoReg=null; + for(TarmRegistroArmas registro:registroarmasList){ + if(codigoReg==null){ + codigoReg="o.cregistro="+registro.getPk(); + }else{ + codigoReg+=" or o.cregistro="+registro.getPk(); + } + } + if(codigoReg!=null){ + //select con los codigos del registro que tenga una persona, por la fecha maxima por registro por el explosivos, cajas, filtramos si ya esta en la tabla tardecomiso arma + //y que esten en estado reg + List armasList =PersistenceHelper.getEntityManager().createQuery("Select o from TarmArmas o where ("+codigoReg+" )" + + " and o.estado IN ('APTA','DEV','AUTO','REG') " + + " and o.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where o.codigoarma=ta.codigoarma and o.cregistro=ta.cregistro)" + + " and o.pk NOT IN (select dec.carma from TarmDecomisoArma dec where dec.estado= 'CUSTEM')" + + serielote).getResultList(); + + this.managedResponse(armasList); + pRequest.getResponse().put("ARMASLIST", armasList); + } + + return pRequest; + } + + /** + * Agrega metadata adicional de las armas para mostrar en las consultas + * @param armasList + * @throws Exception + * @throws CommondbException + */ + private void managedResponse(List armasList) throws CommondbException, Exception{ + for (TarmArmas armas : armasList) { + + TarmTipoArmaExplosivo explisivo= TarmTipoArmaExplosivo.find(PersistenceHelper.getEntityManager(),armas.getCtipoarmaexplosivo()); + + TgeneCatalogDetail clase= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), + new TgeneCatalogDetailKey(explisivo.getClase()!= null ? explisivo.getClase():"", explisivo.getClasecodigo() != null ? explisivo.getClasecodigo() : "")); + armas.modifiedData.put("clase", clase != null ? clase.getDescription():null); + + TgeneCatalogDetail tipoArma= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), + new TgeneCatalogDetailKey(explisivo.getTipoarmaexplosivo() != null ? explisivo.getTipoarmaexplosivo() : "", explisivo.getTipoarmaexplosivocodigo()!= null ? explisivo.getTipoarmaexplosivocodigo(): "")); + armas.modifiedData.put("tipoarmaexplosivo", tipoArma != null ? tipoArma.getDescription():null); + + TgeneCatalogDetail unidadMedida= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), + new TgeneCatalogDetailKey(explisivo.getUnidadmedidapeso() != null ? explisivo.getUnidadmedidapeso():"", explisivo.getUnidadmedidapesocodigo() != null ? explisivo.getUnidadmedidapesocodigo() : "")); + armas.modifiedData.put("unidadmedidapeso", unidadMedida != null ? unidadMedida.getDescription():null); + + TgeneCatalogDetail calibre= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), + new TgeneCatalogDetailKey(explisivo.getCalibre() != null ? explisivo.getCalibre() : "", explisivo.getCalibrecodigo() != null ? explisivo.getCalibrecodigo() : "")); + armas.modifiedData.put("calibre", calibre != null ? calibre.getDescription() : null); + + TgeneCatalogDetail longitud= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), + new TgeneCatalogDetailKey(explisivo.getLongitud() != null ? explisivo.getLongitud() : "", explisivo.getLongitudcodigo() != null ? explisivo.getLongitudcodigo() : "")); + armas.modifiedData.put("longitud", longitud != null ? longitud.getDescription() : null); + + TgeneCatalogDetail marca= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), + new TgeneCatalogDetailKey(armas.getMarca() != null ? armas.getMarca() : "", armas.getMarcacodigo() != null ? armas.getMarcacodigo() : "")); + armas.modifiedData.put("marca", marca != null ? marca.getDescription():null); + } + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/CashHistoricoSecuencial.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/CashHistoricoSecuencial.java new file mode 100644 index 0000000..a0c9c16 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/CashHistoricoSecuencial.java @@ -0,0 +1,31 @@ +package com.fp.armas.rules.query.solicitud; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Genera un número secuencial de historico cash management + * @author Christian Pazmino + * + */ +public class CashHistoricoSecuencial extends QueryRule { + + private static final long serialVersionUID = 1L; + + /** + * Obtiene el secuencial de la solicitud y lo reserva para posteriores validaciones + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + // TODO Auto-generated method stub + System.out.println("Ingresa al secuencial de historico cash management"); + Sequence sequence = new Sequence(); + Integer nextValue = Integer.valueOf(sequence.getNextValue("CCASHHISTORY").toString()); + pQueryRequest.getResponse().put("CASHHISTORICOSEQUENCE", StringUtils.leftPad(String.valueOf(nextValue), 6, '0')); + return pQueryRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/CashManagementQuery.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/CashManagementQuery.java new file mode 100644 index 0000000..d4c9f74 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/CashManagementQuery.java @@ -0,0 +1,65 @@ +package com.fp.armas.rules.query.solicitud; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Query; + +import com.fp.bpm.query.QueryJsf; +import com.fp.common.helper.Constant; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.CashManagementDTO; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; + +/** + * Clase que obtiene los datos del reporte de cash management + * @author Christian Pazmino + * + */ +public class CashManagementQuery extends QueryRule { + + + private static final long serialVersionUID = 1L; + + String sql ="select 'CO' AS codigoServicio, sol.numerosolicitud as contrato, 'USD' AS moneda, " + + "soltra.valorapagar AS valorapagar, 'REC' AS formaCobro, '' as tipoCuenta, '' as numeroCuenta, " + + "tipaut.description as referencia, (case perdet.identificationcatalog when 'CED' then 'C' WHEN 'RUC' THEN 'R' WHEN 'PAS' THEN 'P' ELSE 'N' END) as tipoIDCliente, " + + "perdet.identification as numeroIDCliente, perdet.name as nombreCliente,'1' as baseImponible, sol.csolicitud as csolicitud " + + "from tarmsolicitud sol inner join tarmsolicitudtramite soltra on sol.csolicitud = soltra.csolicitud " + + "left join tcustpersondetail perdet on sol.personcode = perdet.personcode and perdet.dateto = to_date('2999-12-31', 'YYYY-MM-DD') " + + "left join tarmtramite tra on tra.ctramite = sol.ctramite " + + "left join tgenecatalogdetail tipaut on tra.tipoautorizacion = tipaut.catalog and tra.tipoautorizacioncodigo = tipaut.catalogcode " + + "where soltra.INCASHREPORT is null and soltra.numerocomprobante is null and soltra.estadotramite='REG' and soltra.valorapagar>0 " + + "and sol.fverificarequisitos >= to_date(':fechaInicialStr','DD/MM/RRRR') and sol.fverificarequisitos <= to_date(':fechaFinalStr','DD/MM/RRRR')"; + + /** + * Completa datos del arma + */ + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + String fechaInicialStr = pRequest.get("fechaInicialStr").toString(); + String fechaFinalStr = pRequest.get("fechaFinalStr").toString(); + sql=sql.replace(":fechaInicialStr", fechaInicialStr); + sql=sql.replace(":fechaFinalStr", fechaFinalStr); + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(sql); + //qry.setParameter("fechaInicialStr", fechaInicialStr); + //qry.setParameter("fechaFinalStr", fechaFinalStr); + List lCashManagement = qry.getResultList(); + pRequest.getResponse().put("CASHMANAGEMENTLIST", lCashManagement); + return pRequest; + } + + + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/CertificadoFiscaliaSecuencial.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/CertificadoFiscaliaSecuencial.java new file mode 100644 index 0000000..90b3d08 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/CertificadoFiscaliaSecuencial.java @@ -0,0 +1,36 @@ +package com.fp.armas.rules.query.solicitud; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Genera un número secuencial del certificado de fiscalia + * @author Manuel Cepeda + * + */ +public class CertificadoFiscaliaSecuencial extends QueryRule { + + /** + * prefijo base certificado fiscalia + */ + private static final String PRESOL_BASE = "FIS"; + + private static final long serialVersionUID = 5722213865460295851L; + + /** + * Obtiene el secuencial del certificado de la fiscalia y lo reserva para posteriores validaciones + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + // TODO Auto-generated method stub + System.out.println("Ingresa al secuencial armas"); + Sequence sequence = new Sequence(); + Integer nextValue = Integer.valueOf(sequence.getNextValue("CERTIFICADOFISCALIA").toString()); + pQueryRequest.getResponse().put("SECUENCIALCERTIFICADOFISCAL", PRESOL_BASE+"-"+StringUtils.leftPad(String.valueOf(nextValue), 10, '0')); + return pQueryRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/CompletaDatosInspeccionPlan.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/CompletaDatosInspeccionPlan.java new file mode 100644 index 0000000..dcbd5e3 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/CompletaDatosInspeccionPlan.java @@ -0,0 +1,175 @@ +package com.fp.armas.rules.query.solicitud; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; + +@SuppressWarnings("serial") +public class CompletaDatosInspeccionPlan extends QueryRule{ + + private EntityManager em = null; + private String jpqlPersona = "select p.pk.personcode, " + + "(select c.description from TgeneCatalogDetail c where c.pk.catalog = p.identificationcatalog and c.pk.catalogcode = p.identificationcatalogcode) as tipodoc, " + + " p.identification," + + " p.name," + + " p.legalrepresentidentification," + + " p.legalrepresent" + + " from TcustPersonDetail p " + + " where p.pk.personcode = :personcode and p.pk.dateto = :dateto"; + private String jpqlPersonaDireccion = "select p.addresstypecatalog, " + + " p.address, " + + " p.remark, " + + " (select o.description from TgeneProvince o where o.pk.countrycode='EC' and o.pk.provincecode=p.provincecode) as provincia," + + " (select o.description from TgeneCanton o where o.pk.countrycode='EC' and o.pk.provincecode=p.provincecode and o.pk.cantoncode=p.cantoncode) as canton," + + " (select o.description from TgeneCity o where o.pk.countrycode='EC' and o.pk.provincecode=p.provincecode and o.pk.cantoncode=p.cantoncode and o.pk.citycode=p.citycode) as ciudad," + + " (select o.description from TgeneParroquia o where o.pk.countrycode='EC' and o.pk.provincecode=p.provincecode and o.pk.cantoncode=p.cantoncode and o.pk.parroquiacode=p.parroquiacode) as parroquia" + + " from TcustPersonAddress p " + + " where p.pk.personcode = :personcode and p.pk.dateto = :dateto"; + + Map persona = new HashMap(); + private String codigoPhoneFijo; + private String codigoPhoneCelular; + private String codigoMail; + private String codigoOficina; + @Override + public QueryRequest process(QueryRequest pQueyRequest) throws Exception { + QueryJsf query = new QueryJsf(); + query.execute(pQueyRequest); + em = PersistenceHelper.getEntityManager(); + TcustPersonDetail personDetailResp = (TcustPersonDetail)pQueyRequest.getResponse().get("REGINSPECPLANINO"); + completarResponsable(personDetailResp); + Integer personCodePropietario=Integer.parseInt(pQueyRequest.get("personcodepropietario").toString()); + String ccentrocontrol =pQueyRequest.get("ccentrocontrol").toString(); + //propietario 1 + dataPerson(personCodePropietario); + direccion(personCodePropietario); + telefonoPropietario(personCodePropietario); + pQueyRequest.getResponse().put("PERSONAPROPIETARIO", persona); + return pQueyRequest; + } + + private void dataPerson(Integer personcode) throws Exception{ + Query qry = this.em.createQuery(this.jpqlPersona); + qry.setParameter("personcode", personcode); + qry.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + Object[] objeto = (Object[])qry.getSingleResult(); + if(objeto!=null){ + persona.put("personcode", objeto[0]); + persona.put("tipoidentificacion", objeto[1]); + persona.put("identification", objeto[2]); + persona.put("name", objeto[3]); + persona.put("legalrepresentidentification", objeto[4]); + persona.put("legalrepresent", objeto[5]); + } + } + @SuppressWarnings("unchecked") + public void direccion(Integer personcode) throws Exception{ + codigoMail=codigoParameter("CODIGO.MAIL"); + Query qry2 = this.em.createQuery(this.jpqlPersonaDireccion); + qry2.setParameter("personcode", personcode); + qry2.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List ldirecciones = qry2.getResultList(); + + for(Object direc:ldirecciones){ + Object[] objeto=(Object[])direc; + //correo + if(objeto[0]!=null && objeto[0].equals(codigoMail)){ + if(objeto[1]!=null){ + persona.put("mail", objeto[1]); + } + }else{ + if(objeto[1]!=null){ + persona.put("address", objeto[1]); + } + + if(objeto[2]!=null){ + persona.put("remark", objeto[2]); + } + if(objeto[3]!=null){ + persona.put("provincia", objeto[3]); + } + if(objeto[4]!=null){ + persona.put("canton", objeto[4]); + } + if(objeto[5]!=null){ + persona.put("ciudad", objeto[5]); + } + if(objeto[6]!=null){ + persona.put("parroquia", objeto[6]); + } + } + } + } + + @SuppressWarnings("unchecked") + private void telefonoPropietario(Integer personcode) throws Exception{ + List phones =em.createQuery("select o from TcustPersonPhone o" + + " where o.pk.personcode=:personcode and o.pk.dateto=:dateto order by o.phonetypecatalog asc") + .setParameter("personcode", personcode) + .setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()) + .getResultList(); + for(TcustPersonPhone tel:phones){ + persona.put("telefono", tel.getPhonenumber()); + break; + } + } + + + @SuppressWarnings("unchecked") + private void completarResponsable(TcustPersonDetail tcustPersonDetail) throws Exception{ + codigoPhoneFijo=codigoParameter("CODIGO.PHONE.FIJO"); + codigoPhoneCelular=codigoParameter("CODIGO.PHONE.CELULAR"); + List phones =em.createQuery("select o from TcustPersonPhone o" + + " where o.pk.personcode=:personcode and o.pk.dateto=:dateto") + .setParameter("personcode", tcustPersonDetail.getPk().getPersoncode()) + .setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()) + .getResultList(); + for(TcustPersonPhone telefono:phones){ + if(telefono.getPhonetypecatalog().equals(codigoPhoneFijo)){ // CODIGO.PHONE.FIJO + tcustPersonDetail.getModifiedData().put("fijo", telefono.getPhonenumber()); + }else if(telefono.getPhonetypecatalog().equals(codigoPhoneCelular)){// CODIGO.PHONE.CELULAR + tcustPersonDetail.getModifiedData().put("celular", telefono.getPhonenumber()); + } + } + + //mail + List maill =em.createQuery("select o from TcustPersonAddress o" + + " where o.pk.personcode=:personcode and o.pk.dateto=:dateto and o.addresstypecatalog=:addresstypecatalog") + .setParameter("personcode", tcustPersonDetail.getPk().getPersoncode()) + .setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()) + .setParameter("addresstypecatalog", codigoMail) + .getResultList(); + for(TcustPersonAddress mail:maill){ + if(mail.getAddress()!=null){ + tcustPersonDetail.getModifiedData().put("mail", mail.getAddress()); + break; + } + } + + } + + private void centroControl(String ccentrocontrol, QueryRequest sr, String tipo) throws Exception{ + TarmCentroControl centroControl= TarmCentroControl.find(this.em,ccentrocontrol); + sr.getResponse().put("CENTROCONTROL", centroControl); + } + + private String codigoParameter(String codigo) throws Exception{ + TgeneParameters parameter= TgeneParameters.find(this.em, new TgeneParametersKey(codigo, 1)); + return parameter.getTextvalue(); + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/CompletaInfoVerificarDocumentos.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/CompletaInfoVerificarDocumentos.java new file mode 100644 index 0000000..083de52 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/CompletaInfoVerificarDocumentos.java @@ -0,0 +1,45 @@ +package com.fp.armas.rules.query.solicitud; + +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.gene.TgeneProvinceKey; + +public class CompletaInfoVerificarDocumentos extends QueryRule{ + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + QueryJsf qry = new QueryJsf(); + qry.execute(pQueryRequest); + + List datos = (List)pQueryRequest.getResponse().get("VERIFICARDOCUMENTOS");//VERIFICARDOCUMENTOS + if(datos!=null){ + for(Object dato : datos){ + TarmSolicitudDocumento sol = (TarmSolicitudDocumento)dato; + String centroControl =(String)sol.modifiedData.get("ccentrocontrol"); + if(centroControl != null){ + TarmCentroControl cControl = TarmCentroControl.find(PersistenceHelper.getEntityManager(), centroControl); + if(cControl != null){ + TgeneProvinceKey key = new TgeneProvinceKey(); + key.setCountrycode(cControl.getCountrycode()); + key.setProvincecode(cControl.getProvincecode()); + TgeneProvince province = TgeneProvince.find(PersistenceHelper.getEntityManager(), key); + sol.modifiedData.put("ubicaciondesc", province.getDescription()); + } + } + + + } + } + return pQueryRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/ScheduleXMLSolicitud.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/ScheduleXMLSolicitud.java new file mode 100644 index 0000000..6f30bee --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/ScheduleXMLSolicitud.java @@ -0,0 +1,536 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package com.fp.armas.rules.query.solicitud; + +import com.fp.armas.mail.ScheduleNotificacionCliente; +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCityKey; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneSolicitude; +import com.fp.sessionbeans.helper.Sequence; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.PostConstruct; +import javax.ejb.Schedule; +import javax.ejb.Singleton; +import javax.ejb.Startup; +import javax.ejb.Stateless; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import javax.persistence.Query; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import org.jboss.logging.Logger; +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/** + * + * @author developer2 + */ +@Singleton +@Startup +public class ScheduleXMLSolicitud { + + private final Logger LOG = Logger.getLogger(ScheduleNotificacionCliente.class.getName()); + + private EntityManagerFactory emf; + + @PostConstruct + private final void crearManager() { + try { + if (emf == null) { + Map configOverrides = new HashMap(); + configOverrides.put("hibernate.ejb.cfgfile", "hibernateFlipMapping.cfg.xml"); + emf = Persistence.createEntityManagerFactory("local1", configOverrides); + } + SessionData sessionData = new SessionData(); + sessionData.setCompany(1); + sessionData.setIsEjb(Boolean.FALSE); + ThreadFacade.setSaveRequest(sessionData); + } catch (Exception e) { + APPLogger.getLogger().error(e); + } + } + + /** + * ======================== GENERAR EL XML ============================== + */ + public void crearAgregarHijo(Document doc, Element padre, String nombreElemento, String textoElemento) { + Element hijo = crearElemento(doc, nombreElemento, textoElemento); + agregarHijoPadre(doc, padre, hijo); + } + + public void crearAtributo(Document doc, Element elemento, String nombreAtributo, String valorAtributo) { + Attr attr = doc.createAttribute(nombreAtributo); + attr.setValue(valorAtributo); + elemento.setAttributeNode(attr); + } + + public void crearAgregarHijoAtributo(Document doc, Element padre, String nombreElemento, String textoElemento, String nombreAtributo, String textoAtributo) { + Element hijo = crearElemento(doc, nombreElemento, textoElemento); + crearAtributo(doc, hijo, nombreAtributo, textoAtributo); + agregarHijoPadre(doc, padre, hijo); + } + + public Element crearElemento(Document doc, String nombreElemento, String textoElemento) { + Element elemento1 = doc.createElement(nombreElemento); + elemento1.setTextContent(textoElemento); + return elemento1; + } + + public Element crearElementoSinTexto(Document doc, String nombreElemento) { + Element elemento1 = doc.createElement(nombreElemento); + return elemento1; + } + + public void agregarHijoPadre(Document doc, Element padre, Element hijo) { + padre.appendChild(hijo); + + } + + /** + * ======================================== GENERAR ESTRUCTURA XML =========== + */ + public String sacarFactura(Object[] facturaObj, String rucComaco, String sequ, + File carpetaBase, TgeneParameters custodio) throws Exception { + String noDisponible = ""; + /** + * ============================ NO ESTATICAS ===============0 + */ + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); + + //Elemento raz + Document doc = docBuilder.newDocument(); + Element factura = doc.createElement("factura"); + doc.appendChild(factura); + crearAgregarHijo(doc, factura, "ruc", rucComaco); + crearAgregarHijo(doc, factura, "secuencia", sequ); + String serie = facturaObj[25] != null ? facturaObj[25].toString().replace("-", "") : noDisponible; + + crearAgregarHijo(doc, factura, "serie", serie); + + //Fecha de emision + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + String fechaEmision = sdf.format(Calendar.getInstance().getTime()); + crearAgregarHijo(doc, factura, "fecha", fechaEmision); + + /** + * ============================= DATOS DE PERSONA + */ + String tipoDocumento = facturaObj[7] != null ? facturaObj[7].toString() : noDisponible; + String nombre = facturaObj[9] != null ? facturaObj[9].toString() : noDisponible; + String identificacion = facturaObj[10] != null ? facturaObj[10].toString() : noDisponible; + crearAgregarHijo(doc, factura, "tipoIdComprador", tipoDocumento); + crearAgregarHijo(doc, factura, "razonSocialComprador", nombre); + crearAgregarHijo(doc, factura, "identificacionComprador", identificacion); + + /** + * Direccion + */ + String direccionDomicilio = facturaObj[11] != null ? facturaObj[11].toString() : noDisponible; + String mail = facturaObj[12] != null ? + facturaObj[12].toString().contains(",") + ? facturaObj[12].toString().split(",")[0].trim() + : facturaObj[12].toString().trim() : noDisponible; + String valorAPagar = facturaObj[6] != null ? facturaObj[6].toString() : noDisponible; + crearAgregarHijo(doc, factura, "direccionComprador", direccionDomicilio); + crearAgregarHijo(doc, factura, "totalSinImpuestos", valorAPagar.toString()); + crearAgregarHijo(doc, factura, "totalDescuento", "0.00"); + /** + * ================== impuestoTotal ================ + */ + String impuesto = "IVA"; + int porcentajeDescuento = 0; + + Double descuento = 0.00; + Element impuestoTotal = crearElementoSinTexto(doc, "impuestoTotal"); + Element totalImpuesto1 = crearElementoSinTexto(doc, "totalImpuesto"); + Element totalImpuesto2 = crearElementoSinTexto(doc, "totalImpuesto"); + + crearAgregarHijo(doc, totalImpuesto1, "codigo", impuesto); + crearAgregarHijo(doc, totalImpuesto1, "Porcentaje", porcentajeDescuento + ""); + crearAgregarHijo(doc, totalImpuesto1, "baseImponible", valorAPagar); + + + crearAgregarHijo(doc, totalImpuesto2, "codigo", impuesto); + crearAgregarHijo(doc, totalImpuesto2, "Porcentaje", "12"); + crearAgregarHijo(doc, totalImpuesto2, "baseImponible", "0.00"); + agregarHijoPadre(doc, impuestoTotal, totalImpuesto1); + agregarHijoPadre(doc, impuestoTotal, totalImpuesto2); + agregarHijoPadre(doc, factura, impuestoTotal); + crearAgregarHijo(doc, factura, "totalFactura", valorAPagar); + /** + * ========================= Detalles ================================ + */ + + // aun no estoy seguro de esos datos + String []servicio = facturaObj[23] != null ? facturaObj[23].toString().split("-"): null; + String codigoPrincipal = servicio != null ? servicio[0].toString() : ""; /**===> IMPORTANTE REVISAR*/ + String descripcion = servicio != null ? servicio[1].toString() : "";/**===> IMPORTANTE REVISAR*/ + int cantidad = 1; + Double precioUnitario = Double.isNaN(Double.valueOf(facturaObj[4].toString()))? 0.00 : Double.valueOf(facturaObj[4].toString()); + Double precioTotalSinImpuestos = precioUnitario * cantidad; + Element detalles = crearElementoSinTexto(doc, "detalles"); + Element detalle1 = crearElementoSinTexto(doc, "detalle"); + crearAgregarHijo(doc, detalle1, "codigoPrincipal", codigoPrincipal); + crearAgregarHijo(doc, detalle1, "descripcion", descripcion); + crearAgregarHijo(doc, detalle1, "cantidad", cantidad + ""); + crearAgregarHijo(doc, detalle1, "precioUnitario", precioUnitario.toString()); + crearAgregarHijo(doc, detalle1, "descuento", "0.00"); + crearAgregarHijo(doc, detalle1, "precioTotalSinImpuesto", precioTotalSinImpuestos.toString()); + + Element impuestoItem = crearElementoSinTexto(doc, "impuestoItem"); + Element impueste = crearElementoSinTexto(doc, "impuesto"); + + /** + * ==== impuesto item == + */ + crearAgregarHijo(doc, impueste, "impuesto", impuesto); + crearAgregarHijo(doc, impueste, "Porcentaje", porcentajeDescuento + ""); + crearAgregarHijo(doc, impueste, "baseImponible", precioTotalSinImpuestos + ""); + agregarHijoPadre(doc, impuestoItem, impueste); + agregarHijoPadre(doc, detalle1, impuestoItem); + agregarHijoPadre(doc, detalles, detalle1); + + /** + * custodios + */ + if (facturaObj[5] != null && !Double.isNaN(Double.valueOf(facturaObj[5].toString())) && Double.valueOf(facturaObj[5].toString())>0) { + Element detalle2 = crearElementoSinTexto(doc, "detalle"); + String codigoPrincipal2 = custodio.getNumbervalue().toString().contains(".") + ? custodio.getNumbervalue().toString().split("\\.")[0] : custodio.getNumbervalue().toString() ; + int numeroDias = facturaObj[26] != null ? Integer.parseInt(facturaObj[26].toString()): 1; + int numeroCustodios = facturaObj[24] != null ? Integer.parseInt(facturaObj[24].toString()): 1; + String descripcion2 = String.format(custodio.getTextvalue(), numeroDias); + Double precioUnitario2 = Double.parseDouble(facturaObj[5].toString()) / numeroCustodios; /**debido a que en la base antes no se detallaba el numero de custodios*/ + Double precioTotalSinImpuestos2 = Double.parseDouble(facturaObj[5].toString()); + + crearAgregarHijo(doc, detalle2, "codigoPrincipal", codigoPrincipal2); + crearAgregarHijo(doc, detalle2, "descripcion", descripcion2); + crearAgregarHijo(doc, detalle2, "cantidad", numeroCustodios + ""); + crearAgregarHijo(doc, detalle2, "precioUnitario", precioUnitario2.toString()); + crearAgregarHijo(doc, detalle2, "descuento", "0.00"); + crearAgregarHijo(doc, detalle2, "precioTotalSinImpuesto", precioTotalSinImpuestos2.toString()); + + Element impuestoItem2 = crearElementoSinTexto(doc, "impuestoItem"); + Element impueste2 = crearElementoSinTexto(doc, "impuesto"); + crearAgregarHijo(doc, impueste2, "impuesto", impuesto); + crearAgregarHijo(doc, impueste2, "Porcentaje", porcentajeDescuento + ""); + crearAgregarHijo(doc, impueste2, "baseImponible", precioTotalSinImpuestos2.toString()); + agregarHijoPadre(doc, impuestoItem2, impueste2); + agregarHijoPadre(doc, detalle2, impuestoItem2); + agregarHijoPadre(doc, detalles, detalle2); + } + agregarHijoPadre(doc, factura, detalles); + + /** + * ========================= Pagos ================================ + */ + Element pagos = crearElementoSinTexto(doc, "pagos"); + + Element pago = crearElementoSinTexto(doc, "pago"); + String formaPago = "EF"; + /** + * de momento, tocaria ver los nemonicos a futuro para pago con tarjeta + */ + String totalPagar = valorAPagar; + crearAgregarHijo(doc, pago, "formaPago", formaPago); + crearAgregarHijo(doc, pago, "total", totalPagar); + agregarHijoPadre(doc, pagos, pago); + agregarHijoPadre(doc, factura, pagos); + /** + * ========================= INFOAdicional ======================== + */ + String telefonoFijo = facturaObj[22] != null ? facturaObj[22].toString() : noDisponible; + if (telefonoFijo.contains("-")) { + telefonoFijo = telefonoFijo.split("-")[1]; + } + + String ciudad = facturaObj[21] != null ? facturaObj[21].toString() : noDisponible; + + Element infoAdicional = crearElementoSinTexto(doc, "infoAdicional"); + crearAgregarHijoAtributo(doc, infoAdicional, "campoAdicional", mail, "nombre", "Mail"); + crearAgregarHijoAtributo(doc, infoAdicional, "campoAdicional", telefonoFijo, "nombre", "Telefono"); + crearAgregarHijoAtributo(doc, infoAdicional, "campoAdicional", ciudad, "nombre", "Ciudad"); + agregarHijoPadre(doc, factura, infoAdicional); + + //Se escribe el contenido del XML en un archivo + TransformerFactory transformerFactory = TransformerFactory.newInstance(); + Transformer transformer = transformerFactory.newTransformer(); + DOMSource source = new DOMSource(doc); + /** + * String path = carpetaBase.getAbsolutePath(); if(!path.endsWith("/")){ + * path = path.concat("/"); + } + */ + //path=path.concat(String.format("Factura-%s.xml", solicitud.getNumerosolicitud())); + File facturaFile = new File(carpetaBase, String.format("%s.xml", facturaObj[1].toString())); + StreamResult result = new StreamResult(facturaFile); + transformer.transform(source, result); + return facturaFile.getAbsolutePath(); + } + + /**Leer el archivo de la factura */ + + public String obtenerContenidoArchivo(String archivo) throws FileNotFoundException, IOException { + StringBuilder sb = new StringBuilder(); + FileReader f = new FileReader(archivo); + String cadena; + BufferedReader b = new BufferedReader(f); + while((cadena = b.readLine())!=null) { + sb.append(cadena.concat("\n")); + } + b.close(); + return sb.toString(); + } + + public TgeneParameters obtenerParametroSQL(String code, StringBuilder sql, EntityManager entityManager){ + List lstPath = entityManager.createQuery(sql.toString(), TgeneParameters.class) + .setParameter("code", code) + .setParameter("companycode", 1) + .getResultList(); + return lstPath.get(0); + } + @Schedule(second = "1", minute = "1,10,20,30,40,50", hour = "*", persistent = false) + public void generarXMLs() { + try { + StringBuilder comandoParametro = new StringBuilder("select t from TgeneParameters t WHERE t.pk.code = :code AND t.pk.companycode = :companycode "); + EntityManager entityManager = emf.createEntityManager(); + + + TgeneParameters tParameter = obtenerParametroSQL("PATHFACTURASXML", comandoParametro, entityManager); + + String folderPath = tParameter.getTextvalue(); + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy HHmmss"); + String fechaActual = sdf.format(Calendar.getInstance().getTime()).replace(" ", "_"); + folderPath = folderPath.concat(fechaActual).concat("/"); + + //TgeneParameters sequence = obtenerParametroSQL("SECUENCIAFACTURA", comandoParametro, entityManager); + TgeneParameters rucComaco = obtenerParametroSQL("RUCCOMACO", comandoParametro, entityManager); + TgeneParameters custodio = obtenerParametroSQL("CUSTODIOSFACTURA", comandoParametro, entityManager); + StringBuilder strSolicitud = new StringBuilder( + "SELECT t.CSOLICITUD, t.NUMEROSOLICITUD, p.PERSONCODE FROM TARMSOLICITUD t\n" + + "LEFT JOIN TARMSOLICITUDTRAMITE t2 \n" + + "ON t.CSOLICITUD = t2.CSOLICITUD \n" + + "LEFT JOIN TCUSTPERSONDETAIL p \n" + + "ON t.PERSONCODE = p.PERSONCODE \n" + + "AND p.DATETO = TO_DATE('2999-12-31','YYYY-MM-DD') \n" + + "WHERE t2.ESTADOTRAMITE = 'APB' and\n" + + "t2.valorapagar is not null and t2.valorapagar > 0\n" + + "limit 105 \n" + + ); + List lstSolicitudesPersona = entityManager.createNativeQuery(strSolicitud.toString()) + .getResultList(); + //Sequence sequencia = new Sequence(); + //Integer nextValue = sequence.getNumbervalue().intValue(); //Integer.valueOf(sequencia.getNextValue("FACTSEQ").toString()); + //Integer acum = Integer.parseInt(sequence.getTextvalue()); + Integer perCodigo = null; + String cSolicitud = null; + List lstNumAdd = null; + List lstNumAddC = null; + /** + * ================================ query para cada ves que saca una + * factura + */ + StringBuilder queryAddNumTel = new StringBuilder("SELECT MIN(pho.ADDRESSNUMBER) AS menor FROM TCUSTPERSONPHONE pho \n" + + "WHERE pho.PHONETYPECATALOG = :phonetype \n" + + "AND pho.PERSONCODE = :pcode \n" + + "AND pho.DATETO = TO_DATE('2999-12-31','YYYY-MM-DD')" + ); + StringBuilder queryAddNumAddres = new StringBuilder( + "SELECT MIN(t.ADDRESSNUMBER) FROM TCUSTPERSONADDRESS t WHERE t.ADDRESSTYPECATALOG = :type\n" + + "AND t.DATETO = TO_DATE('2999-12-31','YYYY-MM-DD')\n" + + "AND t.PERSONCODE = :pcode" + ); + Integer minAddTel = null; + Integer minadddir = null; + BigDecimal bg = null; + BigDecimal bg2 = null; + String pTel = "\n"; + String ddir = "\n"; + File carpetaBase = new File(folderPath); + carpetaBase.mkdirs(); + Query q = null; + StringBuilder insertAuditoria = new StringBuilder("INSERT INTO TARMINVOICEHISTORY\n" + + "(ID, USERCODE, REGISTRATIONDATE, CSOLICITUD, SOLICITUDNUMBER, TRAMITENUMBER, PATHFILE, CONTENTFILE)\n" + + "VALUES(:id, :usercode, (select now()), :csolicitud, :solicitudnumber, :tramitenumber, :pathfile, :content)" + ); + + int id = 0; + List lstFilaId = new ArrayList<>(); + String pathFactura = null; + for (Object[] solicitudesPers : lstSolicitudesPersona) { + cSolicitud = solicitudesPers[0].toString(); + if (solicitudesPers[2] != null) { + perCodigo = Integer.parseInt(solicitudesPers[2].toString()); + + bg = (BigDecimal) entityManager.createNativeQuery(queryAddNumTel.toString()) + .setParameter("phonetype", "1") + .setParameter("pcode", perCodigo) + .getSingleResult(); + //String n = lstNumAdd.get(0)[0].toString(); + if (bg != null) { + pTel = "AND ph.ADDRESSNUMBER = :teladdnum \n"; + minAddTel = bg.intValue(); + } + + /** + * para las direcciones + */ + bg2 = (BigDecimal) entityManager.createNativeQuery(queryAddNumAddres.toString()) + .setParameter("type", "3") + .setParameter("pcode", perCodigo) + .getSingleResult(); + if (bg2 != null) { + ddir = "AND pc.ADDRESSNUMBER=:diraddnum \n"; + minadddir = bg2.intValue(); + } + + StringBuilder strFacturas = new StringBuilder("SELECT s.CSOLICITUD, s.NUMEROSOLICITUD, st.ESTADOTRAMITE,\n" + + "s.CCENTROCONTROL, st.VALORTRAMITEARMAS,st.VALORCUSTODIOS, st.VALORAPAGAR,p.IDENTIFICATIONCATALOG, \n" + + "p.PERSONCODE,p.NAME, p.IDENTIFICATION,pd.ADDRESS AS DIRECCION,pc.ADDRESS AS CORREO, t.CTRAMITE,\n" + + "c.\"catalog\" AS AUTORIZACIONID, c.CATALOGCODE AS AUTORIZACIONCODE,c.DESCRIPTION AS AUTORIZACION, \n" + + "ca.\"catalog\" AS CATEGORIAID, ca.CATALOGCODE AS CATEGORIACODE, ca.DESCRIPTION AS CATEGORIA, \n" + + "ci.CITYCODE, ci.DESCRIPTION AS CIUDAD, ph.PHONENUMBER, t.SERVICIO, s.NUMEROCUSTODIOS, \n" + + "cc.PUNTOFACTURACION, s.NUMERODIASCUSTODIOS, cc.SECUENCIAFACTURACION \n" + + "FROM TARMSOLICITUDTRAMITE st \n" + + "LEFT JOIN TARMSOLICITUD s \n" + + "ON s.CSOLICITUD = st.CSOLICITUD \n" + + "LEFT JOIN TCUSTPERSONDETAIL p \n" + + "ON p.PERSONCODE = s.PERSONCODE\n" + + "AND p.DATETO = TO_DATE('2999-12-31','YYYY-MM-DD') \n" + + "LEFT JOIN TCUSTPERSONADDRESS pc\n" + + "ON p.PERSONCODE = pc.PERSONCODE\n" + + "AND pc.ADDRESSTYPECATALOG = '3' \n" + + ddir + + "AND pc.DATETO = TO_DATE('2999-12-31','YYYY-MM-DD') \n" + + "LEFT JOIN TCUSTPERSONADDRESS pd \n" + + "ON p.PERSONCODE = pd.PERSONCODE \n" + + "AND pd.ADDRESSTYPECATALOG = '1' \n" + + "AND pd.PRINCIPAL = 'Y' \n" + + "AND pd.DATETO = TO_DATE('2999-12-31','YYYY-MM-DD') \n" + + "LEFT JOIN TARMTRAMITE t \n" + + "ON s.CTRAMITE = t.CTRAMITE \n" + + "LEFT JOIN TGENECATALOGDETAIL c \n" + + "ON t.TIPOAUTORIZACION = c.\"catalog\" AND c.CATALOGCODE = 'TIPOAUTORIZACION'\n" + + "LEFT JOIN TGENECATALOGDETAIL ca\n" + + "ON t.CATEGORIA = ca.\"catalog\" AND ca.CATALOGCODE = 'CATEGORIA'\n" + + "LEFT JOIN TGENECITY ci\n" + + "ON pd.CITYCODE = ci.CITYCODE\n" + + "LEFT JOIN TCUSTPERSONPHONE ph \n" + + "ON p.PERSONCODE = ph.PERSONCODE AND ph.PHONETYPECATALOG = '1'\n " + + pTel + + "AND ph.DATETO = TO_DATE('2999-12-31','YYYY-MM-DD') \n"+ + "LEFT JOIN TARMCENTROCONTROL cc ON \n" + + "cc.CCENTROCONTROL = s.CCENTROCONTROL \n" + + "AND cc.DATETO = TO_DATE('2999-12-31','YYYY-MM-DD') \n" + + "WHERE \n" + + "s.CSOLICITUD = :csolicitud " + ); + + //List lstFacts = entityManager.createNativeQuery(strFacturas.toString(),Object[].class).getResultList(); + List lstFacturas = entityManager.createNativeQuery(strFacturas.toString()) + .setParameter("diraddnum", minadddir) + .setParameter("teladdnum", minAddTel) + .setParameter("csolicitud", cSolicitud) + .getResultList(); + + String numeroSec = null; + String formato = "%09d"; + //Sequence sequencia = new Sequence(); + Integer secFacturacion = null; + StringBuilder sUpdate = new StringBuilder("UPDATE TARMCENTROCONTROL SET SECUENCIAFACTURACION=:numero WHERE CCENTROCONTROL=:ccentro AND DATETO = TO_DATE('2999-12-31','YYYY-MM-DD') "); + String codigoCentro = null; + + for (Object[] factura : lstFacturas) { + codigoCentro= factura[3].toString(); + secFacturacion = Integer.parseInt(factura[27].toString()); + numeroSec = String.format(formato, secFacturacion); + pathFactura = sacarFactura(factura, rucComaco.getTextvalue(), numeroSec, carpetaBase, custodio); + secFacturacion++; + q = entityManager.createNativeQuery(sUpdate.toString()) + .setParameter("numero", secFacturacion) + .setParameter("ccentro", codigoCentro); + q.executeUpdate(); + try { + id = obtenerIdAuditoria(entityManager, lstFilaId, id); + guardarAuditoriaXML(q, entityManager, insertAuditoria.toString(), id, "BATCH", cSolicitud, + factura[1]!= null ? factura[1].toString() : null, + null, pathFactura, obtenerContenidoArchivo(pathFactura)); + } catch (Exception e) { + System.out.println("Error al insertar auditoria de xml "+e.toString()); + } + + } + } + + } + + + } catch (Exception ex) { + System.out.println("Error al guardar el parametro >>>> " + ex.toString()); + ex.printStackTrace(); + } + + } + + public int obtenerIdAuditoria(EntityManager entityManager, List fila, int id){ + fila = entityManager.createNativeQuery("SELECT COUNT(t.ID) AS CANTIDAD,MAX(t.ID) AS MAXIMO FROM TARMINVOICEHISTORY t ").getResultList(); + for (Object[] objects : fila) { + if(Integer.parseInt(objects[0].toString()) > 0){ + id = Integer.parseInt(objects[1].toString()) + 1; + } + } + return id; + } + + public void guardarAuditoriaXML(Query q, EntityManager entityManager, String sUpdate, + int id, String usercode, String csolicitud, String solicitudnumber, String tramitenumber, String pathfile, + String content){ + q = entityManager.createNativeQuery(sUpdate) + .setParameter("id", id) + .setParameter("usercode", usercode) + .setParameter("csolicitud", csolicitud) + .setParameter("solicitudnumber", solicitudnumber) + .setParameter("tramitenumber", tramitenumber) + .setParameter("pathfile", pathfile) + .setParameter("content", content); + q.executeUpdate(); + + + + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/SolicitudSecuencial.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/SolicitudSecuencial.java new file mode 100644 index 0000000..7f8f536 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/SolicitudSecuencial.java @@ -0,0 +1,36 @@ +package com.fp.armas.rules.query.solicitud; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Genera un número secuencial de solicitud + * @author dcruz + * + */ +public class SolicitudSecuencial extends QueryRule { + + /** + * prefijo base solicitud + */ + private static final String PRESOL_BASE = "SOL"; + + private static final long serialVersionUID = 5722213865460295851L; + + /** + * Obtiene el secuencial de la solicitud y lo reserva para posteriores validaciones + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + // TODO Auto-generated method stub + System.out.println("Ingresa al secuencial armas"); + Sequence sequence = new Sequence(); + Integer nextValue = Integer.valueOf(sequence.getNextValue("CNUMEROSOLICITUD").toString()); + pQueryRequest.getResponse().put("SECUENCIALSOLICITUD", PRESOL_BASE+"-"+StringUtils.leftPad(String.valueOf(nextValue), 10, '0')); + return pQueryRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/VerificarArmaQuery.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/VerificarArmaQuery.java new file mode 100644 index 0000000..d00c7ba --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/VerificarArmaQuery.java @@ -0,0 +1,142 @@ +package com.fp.armas.rules.query.solicitud; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +/** + * + * @author Norge Dominguez Cand + * + */ +public class VerificarArmaQuery extends QueryRule { + + private static final String CODIGO_DIAS_DECOMISO = "DIASDECOMISO"; + private static final String CODIGO_RECL = "CODIGO.RECL"; + private static final String CODIGO_ABAN = "CODIGO.ABAN"; + private static final String CODIGO_ENTV = "CODIGO.ENTV"; + private static final String CODIGO_INCAUTADA = "CODIGO.INCAUTADA"; + private static final String CODIGO_DECOMISADA = "CODIGO.DECOMISADA"; + private static final long serialVersionUID = 8055423288586131089L; + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + //Obtener valores + String centroControl = (String) pRequest.get("centroControl"); + String numeroDecomiso = (String) pRequest.get("numeroDecomiso"); + String numeroserie = (String) pRequest.get("numeroserie"); + String fechacorte = (String) pRequest.get("fechacorte"); + + String codigoDecomiso = codigos(CODIGO_DECOMISADA);// DECOMISO + String codigoIncautacion = codigos(CODIGO_INCAUTADA);// INCAUTACION + String codigoEntVol = codigos(CODIGO_ENTV);// ENTREGA VOLUNTARIA + String codigoAbandono = codigos(CODIGO_ABAN);// ABANDONO + String codigoReclamo = codigos(CODIGO_RECL);// RECLAMO + String codigoDiasDecomiso = codigos(CODIGO_DIAS_DECOMISO);// DIAS DECOMISO + if ( fechacorte == null || fechacorte.isEmpty() ) { + fechacorte = new Date().toString(); + } + + //Se filtra por centrocontrol, estados, bodega + StringBuffer bufferFiltro = new StringBuffer(); + + //Filtro por estados, fecha, enBodega + bufferFiltro.append("select t.* from tarmdecomisoarma t join tarmdecomiso td on t.cdecomiso = td.cdecomiso join tarmarmas ta on t.carma = ta.carma " + + "where t.fdecomiso <= TO_DATE('"+fechacorte+"','yyyy-mm-dd') and abs(TO_DATE('"+fechacorte+"','yyyy-mm-dd') - t.fdecomiso)>= "+codigoDiasDecomiso); + bufferFiltro.append(" and (t.estado='"+codigoDecomiso+"' or t.estado='"+codigoIncautacion+"' or t.estado='"+codigoEntVol+"' or t.estado='"+codigoAbandono+"' or t.estado='"+codigoReclamo+"') and t.enbodega= 'Y'"); + + + if(numeroDecomiso!=null && !numeroDecomiso.isEmpty()){ + + bufferFiltro.append(" and td.numerotransaccion ='"+numeroDecomiso+"'"); + } + + if(numeroserie!=null && !numeroserie.isEmpty()){ + + bufferFiltro.append(" and ta.lote ='"+numeroserie+"'"); + } + + //Filtro para la tabla decomiso + StringBuffer bufferDecomiso = new StringBuffer(); + bufferDecomiso.append(bufferFiltro); + bufferDecomiso.append(" and t.cdecomisoarmatransaccion is null and t.cdecarmtranrecepcion is null and t.coperaciontransaccion is null and td.ccentrocontrol = '" + centroControl + "'"); + + List cdecomisos = PersistenceHelper.getEntityManager().createNativeQuery(bufferDecomiso.toString(), TarmDecomisoArma.class).getResultList(); + + //Filtro para la tabla decomiso + StringBuffer bufferOperacion = new StringBuffer(); + bufferOperacion.append(bufferFiltro); + int intWhere = bufferOperacion.indexOf("where"); + bufferOperacion.insert(intWhere, "join tarmdecomisoarmatransaccion tt on t.cdecomisoarmatransaccion = tt.cdecomisoarmatransaccion " + + "join tarmtransaccionarmabodega tb on t.carma = tb.carma and t.cdecomisoarmatransaccion = tb.cdecomisoarmatransaccion "); + + bufferOperacion.append(" and tt.estadofirma = 'Y' and t.coperaciontransaccion = 'RECEPCION' and tb.ccentrocontroldestino = '" + centroControl + "'"); + + List operaciontransacciones = (List)PersistenceHelper.getEntityManager().createNativeQuery(bufferOperacion.toString(), TarmDecomisoArma.class).getResultList(); + + List tarmdecomisoarmas = new ArrayList(); + //Add toda la collection con filtro de decomisos + tarmdecomisoarmas.addAll(cdecomisos); + //Add toda la collection con filtro de operacion + tarmdecomisoarmas.addAll(operaciontransacciones); + + pRequest.getResponse().put("RPRTEDESTRUCCIONDEARMAS", tarmdecomisoarmas); + return pRequest; + } + + /** + * Metodo para obtener los codigos + */ + private String codigos(String parametro) { + String codigo = null; + TgeneParameters tgeneParameters; + try { + tgeneParameters = TgeneParameters.find( + PersistenceHelper.getEntityManager(), new TgeneParametersKey( + parametro, new Integer(1))); + if (tgeneParameters == null || tgeneParameters.getTextvalue() == null) { + codigo = codigosTemp(parametro); + } else { + codigo = tgeneParameters.getTextvalue(); + } + + } catch (Exception e) { + return codigosTemp(parametro); + } + + return codigo; + } + + /** + * En caso de no poder acceder a la base se asigna codigo temporal + * + * @param parametro + * @return + * @throws Exception + */ + private String codigosTemp(String parametro) { + String codigoTemp = null; + if (CODIGO_DECOMISADA.equals(parametro)) { + codigoTemp = "DEC"; + } else if (CODIGO_INCAUTADA.equals(parametro)) { + codigoTemp = "INC"; + } else if (CODIGO_ENTV.equals(parametro)) { + codigoTemp = "ENTR"; + } else if (CODIGO_ABAN.equals(parametro)) { + codigoTemp = "ABA"; + } else if (CODIGO_RECL.equals(parametro)) { + codigoTemp = "RECL"; + } else if (CODIGO_DIAS_DECOMISO.equals(parametro)) { + codigoTemp = "0"; + } + return codigoTemp; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/VerificarInfoCertificado.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/VerificarInfoCertificado.java new file mode 100644 index 0000000..9b55760 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/solicitud/VerificarInfoCertificado.java @@ -0,0 +1,20 @@ +package com.fp.armas.rules.query.solicitud; + +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +public class VerificarInfoCertificado extends QueryRule{ + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + QueryJsf qry = new QueryJsf(); + qry.execute(pQueryRequest); + + List datos = (List)pQueryRequest.getResponse().get("VERIFICARINFORMACIONCERTIFICADO"); + return pQueryRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/entries b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/entries new file mode 100644 index 0000000..46bcc19 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/entries @@ -0,0 +1,303 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices +svn://172.17.26.185/COMACO + + + +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ArmasId.java +file + + + + +2022-07-28T03:40:40.855795Z +fc652378e8b1a27bb30342eca1d8a7cb +2022-04-19T02:27:53.431385Z +4665 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +4033 + +ConsultaLogin.java +file + + + + +2022-07-28T03:40:40.856795Z +d52d689d89091134a09f3f47112f17a9 +2022-04-19T02:27:53.431385Z +4665 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +2548 + +DatosPerson.java +file + + + + +2022-07-28T03:40:40.856795Z +a4782384ebf3dcb2eef5d25c3f29aece +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +16978 + +ColaImpresion.java +file + + + + +2022-07-28T03:40:40.856795Z +ac2592306a55bf5cbe4ecec8aff5827e +2022-04-19T02:27:53.431385Z +4665 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +5318 + +ImagenPersona.java +file + + + + +2022-07-28T03:40:40.857795Z +b7b7ceb194a5f59cb8a2e0e24eb30fea +2022-04-19T02:27:53.431385Z +4665 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +2087 + +ConsultaImpresionProceso.java +file + + + + +2022-07-28T03:40:40.857795Z +02defc46ed4e7902073d4fd50982d4a2 +2022-04-19T02:27:53.431385Z +4665 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +3166 + +JefeCentroImpresion.java +file + + + + +2022-07-28T03:40:40.858795Z +c1db5c471a605b88924a076be311442e +2022-04-19T02:27:53.431385Z +4665 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +3937 + +ConsultaXpathDocumento.java +file + + + + +2022-07-28T03:40:40.858795Z +4aef6f5ea579cb9cd3508aeee4603266 +2022-04-19T02:27:53.431385Z +4665 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1591 + +util +dir + diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/prop-base/ArmasId.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/prop-base/ArmasId.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/prop-base/ArmasId.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/prop-base/ColaImpresion.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/prop-base/ColaImpresion.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/prop-base/ColaImpresion.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/prop-base/ConsultaImpresionProceso.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/prop-base/ConsultaImpresionProceso.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/prop-base/ConsultaImpresionProceso.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/prop-base/ConsultaLogin.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/prop-base/ConsultaLogin.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/prop-base/ConsultaLogin.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/prop-base/ConsultaXpathDocumento.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/prop-base/ConsultaXpathDocumento.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/prop-base/ConsultaXpathDocumento.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/prop-base/ImagenPersona.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/prop-base/ImagenPersona.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/prop-base/ImagenPersona.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/prop-base/JefeCentroImpresion.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/prop-base/JefeCentroImpresion.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/prop-base/JefeCentroImpresion.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/ArmasId.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/ArmasId.java.svn-base new file mode 100644 index 0000000..cc1b536 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/ArmasId.java.svn-base @@ -0,0 +1,68 @@ +package com.fp.armas.rules.query.webservices; + +import com.fp.armas.rules.query.webservices.util.ArmaUtil; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.parmas.dto.ws.ArmaDto; + +/** + * Clase que realiza el m&ecaute;todo para obtener el arma a través de su id + * @author dcruz + * + */ +public class ArmasId extends QueryRule { + + private static final long serialVersionUID = 1L; + + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + ArmaDto armaDto = null; + try { + String carma = (String) pRequest.get("codigoarma"); + if(carma!=null && !carma.isEmpty()){ + armaDto = ArmaUtil.getInstancia().obtenerArmaId(carma); + + } + String ctag = (String) pRequest.get("codigotag"); + if(ctag!=null && !ctag.isEmpty()){ + armaDto = ArmaUtil.getInstancia().obtenerArmaIdPorTag(ctag); + + } + pRequest.getResponse().put("ARMASWS", armaDto!=null?armaDto:null); + return pRequest; + } catch (Throwable e) { + throw new Exception(e); + } + } + +// /** +// * Completa los datos del arma encontrada +// * @param armaDto dto de arma +// * @param tarmArmas objeto tipo {@link TarmArmas} +// * @throws CommondbException +// * @throws Exception +// */ +// private ArmaDto completaArma(ArmaDto armaDto, TarmArmas tarmArmas) throws CommondbException, Exception{ +// armaDto = new ArmaDto(); +// armaDto.setIdArma(tarmArmas.getPk()); +// armaDto.setCantidad(tarmArmas.getCantidad()); +// armaDto.setSerie(tarmArmas.getLote()); +// TgeneCatalogDetail estado = TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tarmArmas.getEstado() != null ? tarmArmas.getEstado() : "", tarmArmas.getEstadocodigo() != null ? tarmArmas.getEstadocodigo() : "")); +// armaDto.setEstado(estado != null ? estado.getDescription() : ""); +// TarmTipoArmaExplosivo tipoArmaExplosivo = TarmTipoArmaExplosivo.find(PersistenceHelper.getEntityManager(), tarmArmas.getCtipoarmaexplosivo()); +// if(tipoArmaExplosivo != null){ +// TgeneCatalogDetail clase= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getClase() != null ? tipoArmaExplosivo.getClase() : "", tipoArmaExplosivo.getClasecodigo() != null ? tipoArmaExplosivo.getClasecodigo() : "")); +// armaDto.setClase(clase != null ? clase.getDescription():null); +// TgeneCatalogDetail tipoArma= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getTipoarmaexplosivo() != null ? tipoArmaExplosivo.getTipoarmaexplosivo() : "", tipoArmaExplosivo.getTipoarmaexplosivocodigo() != null ? tipoArmaExplosivo.getTipoarmaexplosivocodigo() : "")); +// armaDto.setTipo(tipoArma != null ? tipoArma.getDescription():null); +// TgeneCatalogDetail unidadMedida= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getUnidadmedidapeso() != null ? tipoArmaExplosivo.getUnidadmedidapeso():"", tipoArmaExplosivo.getUnidadmedidapesocodigo() != null ? tipoArmaExplosivo.getUnidadmedidapesocodigo() : "")); +// armaDto.setUnidadMedidaPeso(unidadMedida != null ? unidadMedida.getDescription():null); +// TgeneCatalogDetail calibre= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getCalibre() != null ? tipoArmaExplosivo.getCalibre() : "", tipoArmaExplosivo.getCalibrecodigo() != null ? tipoArmaExplosivo.getCalibrecodigo() : "")); +// armaDto.setCalibre(calibre != null ? calibre.getDescription() : null); +// TgeneCatalogDetail longitud= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getLongitud() != null ? tipoArmaExplosivo.getLongitud() : "", tipoArmaExplosivo.getLongitudcodigo() != null ? tipoArmaExplosivo.getLongitudcodigo() : "")); +// armaDto.setLongitud(longitud != null ? longitud.getDescription() : null); +// } +// return armaDto; +// } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/ColaImpresion.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/ColaImpresion.java.svn-base new file mode 100644 index 0000000..dcf9d0c --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/ColaImpresion.java.svn-base @@ -0,0 +1,103 @@ +package com.fp.armas.rules.query.webservices; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Query; + +import com.fp.armas.rules.query.webservices.util.ColaImpresionUtil; +import com.fp.common.logger.APPLogger; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.dto.ws.ColaImpresionDto; +import com.fp.persistence.parmas.inte.TarmColadeImpresion; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Componente que realiza la búsquedas de los datos de impresión de un usuario + * @author dcruz + * + */ +public class ColaImpresion extends QueryRule{ + + private static final long serialVersionUID = -3993166768741911054L; + private static final String QUERY_USUARIO_ID = "SELECT o FROM TsafeUserDetail o WHERE o.pk.usercode=:usercode AND o.pk.dateto=:dateto"; + private static final String QUERY_COLA_IMPRESION = "SELECT o.* FROM TarmColadeImpresion o " + + "left join tarmdocumentohabilitante i on o.cdocumento = i.cdocumento " + + "left join tarmsolicitud k on i.csolicitud = k.csolicitud " + + "WHERE o.estadoimpresion=:estado and i.ccentrocontrol = :ccentrocontrol and coalesce(k.estado,'APB') IN ('APB','FIN')"; + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + Query query; + List lcolaImpresion = null; + try { + String estado = (String) pRequest.get("estado"); + String usercode = (String) pRequest.get("usercode"); + System.out.println("estado..."+estado); + System.out.println("usercode..."+usercode); + query = PersistenceHelper.getEntityManager().createQuery(QUERY_USUARIO_ID); + query.setParameter("usercode", usercode); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List ltsafeUserDetails = query.getResultList(); + TsafeUserDetail tsafeUserDetail; + if(ltsafeUserDetails != null && !ltsafeUserDetails.isEmpty()){ + tsafeUserDetail = ltsafeUserDetails.iterator().next(); + }else{ + return pRequest; + } + //centro control + query=PersistenceHelper.getEntityManager().createQuery("select o from TarmCentroControl o" + + " where o.pk=(select p.ccentrocontrol from TarmCentroControlJur p " + + " where p.provincecode=(select pr.provincecode from TcustPersonAddress pr " + + " where pr.pk.personcode=:personcode and" + + " pr.pk.dateto=:dateto and" + + " pr.principal='Y' and" + + " pr.pk.addressnumber=(select max(q.pk.addressnumber) from TcustPersonAddress q " + + " where q.pk.personcode=:personcode and" + + " q.pk.dateto=:dateto and" + + " q.principal='Y')))"); + query.setParameter("personcode", tsafeUserDetail.getPk().getPersoncode()); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List tarmCentroControls = query.getResultList(); + TarmCentroControl tarmCentroControl; + if(tarmCentroControls != null && !tarmCentroControls.isEmpty()){ + tarmCentroControl = tarmCentroControls.iterator().next(); + }else{ + return pRequest; + } + System.out.println("QUERY COLA IMPRESION: "+QUERY_COLA_IMPRESION); + query = PersistenceHelper.getEntityManager().createNativeQuery(QUERY_COLA_IMPRESION); + query.setParameter("estado", estado); + query.setParameter("ccentrocontrol", tarmCentroControl.getPk()); + + List coladeImpresionList = new ArrayList(); + List ltarmColadeImpresionsTMP = query.getResultList(); + for(Object[]tmp:ltarmColadeImpresionsTMP){ + TarmColadeImpresion colaImpresionObj = new TarmColadeImpresion(); + colaImpresionObj.setPk(tmp[3].toString()); + colaImpresionObj.setEstadoimpresion(tmp[1].toString()); + colaImpresionObj.setFechaimpresion((Timestamp) tmp[4]); + colaImpresionObj.setEstadoimpresioncode(tmp[2].toString()); + colaImpresionObj.setCdocumento(((BigDecimal) tmp[0]).longValue()); + colaImpresionObj.setFecharegistro(new Date(((Timestamp) tmp[5]).getTime())); + if (tmp[6] != null) + colaImpresionObj.setCodigotarjeta(tmp[6].toString()); + coladeImpresionList.add(colaImpresionObj); + } + lcolaImpresion = ColaImpresionUtil.getInstancia().completaColaImpresion(coladeImpresionList, tsafeUserDetail.getPk().getPersoncode(), tsafeUserDetail.getPk().getUsercode()); + pRequest.getResponse().put("COLAIMPRESION", lcolaImpresion); + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + return pRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/ConsultaImpresionProceso.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/ConsultaImpresionProceso.java.svn-base new file mode 100644 index 0000000..7ab3cc0 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/ConsultaImpresionProceso.java.svn-base @@ -0,0 +1,72 @@ +package com.fp.armas.rules.query.webservices; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Query; + +import org.joda.time.DateTime; + +import com.fp.armas.rules.query.webservices.util.ColaImpresionUtil; +import com.fp.common.logger.APPLogger; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.dto.ws.ColaImpresionDto; +import com.fp.persistence.parmas.inte.TarmColadeImpresion; + +/** + * Consulta los datos de impresión del proceso + * @author dcruz + * + */ +public class ConsultaImpresionProceso extends QueryRule { + + private static final long serialVersionUID = -7675701723545274414L; + public static final String QUERY_COLA_SOLICITUD = "SELECT o.* FROM TarmColadeImpresion o WHERE o.estadoimpresion='PIMPR' and o.cdocumento " + + "IN ((SELECT i.cdocumento FROM TarmDocumentoHabilitante i WHERE i.csolicitud IN (SELECT c.CSOLICITUD FROM TarmSolicitud c " + + "WHERE c.estado IN ('APB','FIN') and c.numerosolicitud=:numerosolicitud)) UNION (SELECT SD.cdocumento FROM tarmsolicituddocumento SD WHERE sd.csolicitud " + + "IN (SELECT c.CSOLICITUD FROM TarmSolicitud c WHERE c.estado IN ('APB','FIN') and c.numerosolicitud=:numerosolicitud)))"; + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + // TODO Auto-generated method stub + List lcolaImpresion = null; + try { + + String codigosolicitud = (String) pRequest.get("CODIGOSOLICITUD"); + System.out.println("codigosolicitud.."+codigosolicitud); + System.out.println(QUERY_COLA_SOLICITUD); + Query query = PersistenceHelper.getEntityManager().createNativeQuery(QUERY_COLA_SOLICITUD); + query.setParameter("numerosolicitud", codigosolicitud); + + List ltarmColadeImpresions = new ArrayList(); + List ltarmColadeImpresionsTMP = query.getResultList(); + + for(Object[]tmp:ltarmColadeImpresionsTMP){ + TarmColadeImpresion colaImpresionObj = new TarmColadeImpresion(); + colaImpresionObj.setPk(tmp[3].toString()); + colaImpresionObj.setEstadoimpresion(tmp[1].toString()); + colaImpresionObj.setFechaimpresion((Timestamp) tmp[4]); + colaImpresionObj.setEstadoimpresioncode(tmp[2].toString()); + colaImpresionObj.setCdocumento(((BigDecimal) tmp[0]).longValue()); + colaImpresionObj.setFecharegistro(new Date(((Timestamp) tmp[5]).getTime())); + if (tmp[6] != null) + colaImpresionObj.setCodigotarjeta(tmp[6].toString()); + ltarmColadeImpresions.add(colaImpresionObj); + } + + lcolaImpresion = ColaImpresionUtil.getInstancia().completaColaImpresion(ltarmColadeImpresions); + pRequest.getResponse().put("COLAIMPRESION", lcolaImpresion); + pRequest.getResponse().put("COLAIMPRESION", lcolaImpresion); + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + return pRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/ConsultaLogin.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/ConsultaLogin.java.svn-base new file mode 100644 index 0000000..6c72ea5 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/ConsultaLogin.java.svn-base @@ -0,0 +1,62 @@ +package com.fp.armas.rules.query.webservices; + +import java.util.List; + +import javax.persistence.Query; + +import com.fp.armas.rules.query.webservices.util.PersonaUtil; +import com.fp.common.logger.APPLogger; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Servicio que retorna un 0 si existe el login, 1 si es incorrecto + * @author dcruz + * + */ +public class ConsultaLogin extends QueryRule { + + private static final long serialVersionUID = -1758582166779180497L; + private static final String QUERY_USER = "SELECT o FROM TsafeUserDetail o WHERE o.pk.usercode=:usercode AND o.pk.dateto=:dateto"; + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + try { + String usercode = (String) pRequest.get("USERCODE"); + String password = (String) pRequest.get("PASSWORD"); + if(password != null){//Servicio consulta login password + StringBuilder sb = new StringBuilder(QUERY_USER); + sb.append(" AND o.password=:password"); + Query query = PersistenceHelper.getEntityManager().createQuery(sb.toString()); + query.setParameter("usercode", usercode); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + query.setParameter("password", password); + List ltsafeUserDetails = query.getResultList(); + if(ltsafeUserDetails != null && !ltsafeUserDetails.isEmpty()){ + TsafeUserDetail tsafeUserDetail = ltsafeUserDetails.iterator().next(); + String localidad = PersonaUtil.getInstancia().obtenerLocacionPersona(tsafeUserDetail.getPk().getPersoncode()); + pRequest.getResponse().put("RESPUESTA", localidad.toString()); + } + } else {//Servicio consulta login + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_USER); + query.setParameter("usercode", usercode); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List ltsafeUserDetails = query.getResultList(); + if(ltsafeUserDetails != null && !ltsafeUserDetails.isEmpty()){ + pRequest.getResponse().put("RESPUESTA", "0"); + }else{ + pRequest.getResponse().put("RESPUESTA", "1"); + } + } + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + pRequest.getResponse().put("RESPUESTA", "2"); + } + return pRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/ConsultaXpathDocumento.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/ConsultaXpathDocumento.java.svn-base new file mode 100644 index 0000000..adf07a4 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/ConsultaXpathDocumento.java.svn-base @@ -0,0 +1,43 @@ +package com.fp.armas.rules.query.webservices; + +import static com.fp.armas.rules.query.webservices.util.ColaImpresionUtil.QUERY_SOLICITUD_NUM; + +import java.util.List; + +import javax.persistence.Query; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmSolicitud; + +/** + * Consulta el xpath del documento habilitante y dicho xpath + * @author dcruz + * + */ +public class ConsultaXpathDocumento extends QueryRule { + + private static final long serialVersionUID = 7391996435678161968L; + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + String numerosolicitud = (String) pRequest.get("NUMEROSOLICITUD"); + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_SOLICITUD_NUM); + query.setParameter("numerosolicitud", numerosolicitud); + List ltarmSolicitud = query.getResultList(); + if(ltarmSolicitud != null && !ltarmSolicitud.isEmpty()){ + TarmSolicitud tarmSolicitud = ltarmSolicitud.iterator().next(); + Query queryDoc = PersistenceHelper.createQuery("SELECT o.xpath FROM TarmDocumentoHabilitante o WHERE o.csolicitud=:csolicitud "); + queryDoc.setParameter("csolicitud", tarmSolicitud.getPk()); + List lxpath = queryDoc.getResultList(); + if(lxpath != null && !lxpath.isEmpty()){ + String xpath = lxpath.iterator().next(); + pRequest.getResponse().put("XPATHDOCUMENTOSOLICITUD", xpath); + } + } + return pRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/DatosPerson.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/DatosPerson.java.svn-base new file mode 100644 index 0000000..5cbb615 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/DatosPerson.java.svn-base @@ -0,0 +1,292 @@ +package com.fp.armas.rules.query.webservices; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Query; + +import com.fp.armas.rules.query.webservices.util.InstitucionSnapEnum; +import com.fp.common.logger.APPLogger; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.dto.ws.DatosSnapDto; +import com.fp.persistence.parmas.dto.ws.InfoGuardiaDto; +import com.fp.persistence.parmas.dto.ws.TramiteDto; +import com.fp.persistence.parmas.dto.ws.DatosArmaDto; +import com.fp.persistence.parmas.eval.TarmEvaluacion; +import com.fp.persistence.parmas.soli.TarmArmaPruebas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmGuardias; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +/** + * Componente que realiza la búsquedas de los datos de necesarios para el WS de la SNAP + * @author Manuel Cepeda + * + */ +public class DatosPerson extends QueryRule{ + + private static final long serialVersionUID = -3993166768741911053L; + + /** + * Permite obtener todos los datos necesarios para el WS de SNAP + * @param QueryRequest pRequest + * @return QueryRequest + */ + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + Query query; + + try { + DatosSnapDto personaSnapDto = new DatosSnapDto(); + + query = PersistenceHelper.getEntityManager().createQuery("select p from TgeneParameters p where pk.code= :code and pk.companycode=:companycode"); + query.setParameter("code", "PATH.ALFRESCO.ARCHIVOS"); + query.setParameter("companycode", 1); + List lparametros = query.getResultList(); + if(lparametros != null && !lparametros.isEmpty()){ + personaSnapDto.setxPathLocation(lparametros.get(0).getTextvalue()); + } + + String identificacion = (String) pRequest.get("identificacion"); + String institucion = (String) pRequest.get("institucion"); + String serie = (String) pRequest.get("serie"); + query = PersistenceHelper.getEntityManager().createQuery("select pd from TcustPersonDetail pd where pd.identification= :identification and pd.pk.dateto=:dateto order by DATETO DESC"); + query.setParameter("identification", identificacion); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List ltsafeUserDetails = query.getResultList(); + if(ltsafeUserDetails != null && !ltsafeUserDetails.isEmpty()){ + personaSnapDto.setCodigoPersona(ltsafeUserDetails.get(0).getPk().getPersoncode()); + personaSnapDto.setRazonSocial(ltsafeUserDetails.get(0).getName()); + } + + //direccion principal + query=PersistenceHelper.getEntityManager().createQuery("select pa from TcustPersonAddress pa where pa.pk.personcode=:personcode and pa.pk.dateto=:dateto and pa.principal='Y'"); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List lcustPersonAddress = query.getResultList(); + if(lcustPersonAddress != null && !lcustPersonAddress.isEmpty()){ + personaSnapDto.setDireccion(lcustPersonAddress.get(0).getAddress()); + } + + //email + query=PersistenceHelper.getEntityManager().createQuery("select pa from TcustPersonAddress pa where pa.pk.personcode=:personcode and pa.pk.dateto=:dateto and pa.addresstypecatalog=3"); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List lcustPersonEmail = query.getResultList(); + if(lcustPersonEmail != null && !lcustPersonEmail.isEmpty()){ + personaSnapDto.setEmail(lcustPersonEmail.get(0).getAddress()); + } + + //telefono + query=PersistenceHelper.getEntityManager().createQuery("select pp from TcustPersonPhone pp where pp.pk.personcode=:personcode and pp.pk.dateto=:dateto and pp.phonetypecatalog=1"); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List lcustPersonTelefono = query.getResultList(); + if(lcustPersonTelefono != null && !lcustPersonTelefono.isEmpty()){ + personaSnapDto.setTelefonoFijo(lcustPersonTelefono.get(0).getPhonenumber()); + } + + //celular + query=PersistenceHelper.getEntityManager().createQuery("select pp from TcustPersonPhone pp where pp.pk.personcode=:personcode and pp.pk.dateto=:dateto and pp.phonetypecatalog=2"); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List lcustPersonCelular = query.getResultList(); + if(lcustPersonCelular != null && !lcustPersonCelular.isEmpty()){ + personaSnapDto.setTelefonoCelular(lcustPersonCelular.get(0).getPhonenumber()); + } + + //test psocilogico + query=PersistenceHelper.getEntityManager().createQuery("select te from TarmEvaluacion te where te.personcode=:personcode and te.tipoevaluacion = 'PSICOLOGICA' order by te.fechaexpiracion desc"); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + List listaEvaluacion = query.getResultList(); + if(listaEvaluacion != null && !listaEvaluacion.isEmpty() && institucion.equals(InstitucionSnapEnum.COPS.getNombre())){ + personaSnapDto.setTestPsicologico(listaEvaluacion.get(0).getInformexpath()); + } + + //tramites + List listaTramitesHabilitantes = new ArrayList<>(); + query=PersistenceHelper.getEntityManager().createQuery("select dh from TarmDocumentoHabilitante dh where dh.pk.personcode=:personcode and dh.ctramite in(73, 179) order by dh.fechaexpiracion desc"); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + List listaTramiteCM = query.getResultList(); + if(listaTramiteCM != null && !listaTramiteCM.isEmpty()){ + listaTramitesHabilitantes.add(listaTramiteCM.get(0)); + } + + query=PersistenceHelper.getEntityManager().createQuery("select dh from TarmDocumentoHabilitante dh where dh.pk.personcode=:personcode and dh.ctramite in(74, 180) order by dh.fechaexpiracion desc"); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + List listaTramiteMA = query.getResultList(); + if(listaTramiteMA != null && !listaTramiteMA.isEmpty()){ + listaTramitesHabilitantes.add(listaTramiteMA.get(0)); + } + + query=PersistenceHelper.getEntityManager().createQuery("select dh from TarmDocumentoHabilitante dh where dh.pk.personcode=:personcode and dh.ctramite in(76, 182) order by dh.fechaexpiracion desc"); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + List listaTramiteSP = query.getResultList(); + if(listaTramiteSP != null && !listaTramiteSP.isEmpty()){ + listaTramitesHabilitantes.add(listaTramiteSP.get(0)); + } + + List listaTramites = new ArrayList<>(); + if(listaTramitesHabilitantes != null && !listaTramitesHabilitantes.isEmpty()){ + for(TarmDocumentoHabilitante tramitesHabilitantes: listaTramitesHabilitantes){ + TramiteDto tramiteDto = new TramiteDto(); + tramiteDto.setTramite(tramitesHabilitantes.getCtramite().toString()); + tramiteDto.setFechaEmision(tramitesHabilitantes.getFechaemision()); + tramiteDto.setFechaExpiracion(tramitesHabilitantes.getFechaexpiracion()); + + //informacion del tramite + query=PersistenceHelper.getEntityManager().createQuery("select CONCAT(tt.description, ' - ', ta.description, ' - ', ca.description, ' - ', ua.description) from TarmTramite t," + + " TgeneCatalogDetail tt, TgeneCatalogDetail ta, TgeneCatalogDetail ca, TgeneCatalogDetail ua " + + " where tt.pk.catalog = t.tipotramite and tt.pk.catalogcode = t.tipotramitecodigo" + + " and ta.pk.catalog = t.tipoautorizacion and ta.pk.catalogcode = t.tipoautorizacioncodigo" + + " and ca.pk.catalog = t.categoria and ca.pk.catalogcode = t.categoriacodigo" + + " and ua.pk.catalog = t.usoactividad and ua.pk.catalogcode = t.usoactividadcodigo" + + " and t.pk = :ctramite"); + query.setParameter("ctramite", tramitesHabilitantes.getCtramite()); + + List tramiteDescripcion = query.getResultList(); + if(tramiteDescripcion != null && !tramiteDescripcion.isEmpty()){ + tramiteDto.setNumeroDocumento(tramiteDescripcion.get(0).toString()); + } + listaTramites.add(tramiteDto); + } + } + personaSnapDto.setListaTramites(listaTramites); + + if(institucion.equals(InstitucionSnapEnum.CRIMINALISTICA.getNombre()) || institucion.equals(InstitucionSnapEnum.COPS.getNombre()) || institucion.equals(InstitucionSnapEnum.FISCALIA_GENERAL.getNombre())){ + if("RUC".equals(ltsafeUserDetails.get(0).getIdentificationcatalog())){ + query=PersistenceHelper.getEntityManager().createQuery("select g from TarmGuardias g where g.cempresa=:personcode"); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + List listaGuardias = query.getResultList(); + if(listaGuardias != null && !listaGuardias.isEmpty()){ + List listaInfoGuardias = new ArrayList<>(); + for(TarmGuardias tarmGuardias : listaGuardias){ + InfoGuardiaDto infoGuardiaDto = new InfoGuardiaDto(); + infoGuardiaDto.setEstado(tarmGuardias.getEstado()); + + query=PersistenceHelper.getEntityManager().createQuery("select pd from TcustPersonDetail pd where pd.pk.personcode=:personcode"); + query.setParameter("personcode", tarmGuardias.getPk()); + List listaPeson = query.getResultList(); + if(listaPeson != null && !listaPeson.isEmpty()){ + infoGuardiaDto.setNombre(listaPeson.get(0).getName()); + } + listaInfoGuardias.add(infoGuardiaDto); + } + personaSnapDto.setListaGuardias(listaInfoGuardias); + } + }else{ + query=PersistenceHelper.getEntityManager().createQuery("select g from TarmGuardias g where g.pk=:personcode"); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + List listaPersonaGuardia = query.getResultList(); + if(listaPersonaGuardia != null && !listaPersonaGuardia.isEmpty() && listaPersonaGuardia.get(0).getCempresa() != null){ + List listaInfoGuardias = new ArrayList<>(); + InfoGuardiaDto infoGuardiaDto = new InfoGuardiaDto(); + infoGuardiaDto.setEstado(listaPersonaGuardia.get(0).getEstado()); + + query=PersistenceHelper.getEntityManager().createQuery("select pd from TcustPersonDetail pd where pd.pk.personcode=:personcode"); + query.setParameter("personcode", listaPersonaGuardia.get(0).getCempresa()); + List listaEmpresa = query.getResultList(); + if(listaEmpresa != null && !listaEmpresa.isEmpty()){ + infoGuardiaDto.setEmpresa(listaEmpresa.get(0).getName()); + } + listaInfoGuardias.add(infoGuardiaDto); + personaSnapDto.setListaGuardias(listaInfoGuardias); + } + + } + + //datos del arma + query=PersistenceHelper.getEntityManager().createQuery("select ta from TarmArmas ta, TarmRegistroArmas regarm, TcustPersonDetail pd " + + " where ta.cregistro = regarm.pk and pd.pk.personcode = regarm.personcode and pd.pk.dateto = :dateto" + + " and ta.lote = :lote and ta.ctipoarmaexplosivo in (select te.pk from TarmTipoArmaExplosivo te where te.clase = '0010000001')" + + " and pd.pk.personcode = :personcode"); + query.setParameter("lote", serie); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + List listaArma = query.getResultList(); + if(listaArma != null && !listaArma.isEmpty()){ + List listaDatosArma = new ArrayList<>(); + for(TarmArmas tarmArmas : listaArma){ + DatosArmaDto datosArmaDto = new DatosArmaDto(); + datosArmaDto.setLote(tarmArmas.getLote()); + datosArmaDto.setTipoFabricacion(tarmArmas.getTipofabricacion()); + + //marca + query=PersistenceHelper.getEntityManager().createQuery("select cat from TgeneCatalogDetail cat, TarmArmas arm " + + "where cat.pk.catalog = arm.marca and cat.pk.catalogcode = arm.marcacodigo and arm.pk = :carma"); + query.setParameter("carma", tarmArmas.getPk()); + List listaCatalogoMarca = query.getResultList(); + if(listaCatalogoMarca != null && !listaCatalogoMarca.isEmpty()){ + datosArmaDto.setMarca(listaCatalogoMarca.get(0).getDescription()); + } + + //datosArmaDto.setMarca(tarmArmas.getMarca()); + datosArmaDto.setModelo(tarmArmas.getModelo()); + datosArmaDto.setEstadoArma(tarmArmas.getEstado()); + + query=PersistenceHelper.getEntityManager().createQuery("select a from TarmArmaPruebas a where a.personcode = :personcode and a.carma = :carma"); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + query.setParameter("carma", tarmArmas.getPk()); + List listaArmaPrueba = query.getResultList(); + if(listaArmaPrueba != null && !listaArmaPrueba.isEmpty()){ + if(institucion.equals(InstitucionSnapEnum.CRIMINALISTICA.getNombre())){ + datosArmaDto.setImagenImpronta(listaArmaPrueba.get(0).getXpathimpronta()); + datosArmaDto.setImagenArma(listaArmaPrueba.get(0).getXpathfotografia()); + } + datosArmaDto.setFichaTecnicaArma(listaArmaPrueba.get(0).getXpathfichatecarmas()); + } + + //clase + query=PersistenceHelper.getEntityManager().createQuery("select cat from TarmTipoArmaExplosivo tae, TgeneCatalogDetail cat, TarmArmas arm where cat.pk.catalog = tae.clase and cat.pk.catalogcode = tae.clasecodigo" + + " and tae.pk = arm.ctipoarmaexplosivo and tae.pk = :ctipoarmaexplosivo and arm.pk = :carma"); + query.setParameter("ctipoarmaexplosivo", tarmArmas.getCtipoarmaexplosivo()); + query.setParameter("carma", tarmArmas.getPk()); + List listaCatalogoClase = query.getResultList(); + if(listaCatalogoClase != null && !listaCatalogoClase.isEmpty()){ + datosArmaDto.setDescripcionClase(listaCatalogoClase.get(0).getDescription()); + } + + //tipo + query=PersistenceHelper.getEntityManager().createQuery("select cat from TarmTipoArmaExplosivo tae, TgeneCatalogDetail cat, TarmArmas arm where cat.pk.catalog = tae.tipoarmaexplosivo and cat.pk.catalogcode = tae.tipoarmaexplosivocodigo" + + " and tae.pk = arm.ctipoarmaexplosivo and tae.pk = :ctipoarmaexplosivo and arm.pk = :carma"); + query.setParameter("ctipoarmaexplosivo", tarmArmas.getCtipoarmaexplosivo()); + query.setParameter("carma", tarmArmas.getPk()); + List listaCatalogoTipo = query.getResultList(); + if(listaCatalogoTipo != null && !listaCatalogoTipo.isEmpty()){ + datosArmaDto.setDescripcionTipo(listaCatalogoTipo.get(0).getDescription()); + } + + //calibre + query=PersistenceHelper.getEntityManager().createQuery("select cat from TarmTipoArmaExplosivo tae, TgeneCatalogDetail cat, TarmArmas arm where cat.pk.catalog = tae.calibre and cat.pk.catalogcode = tae.calibrecodigo" + + " and tae.pk = arm.ctipoarmaexplosivo and tae.pk = :ctipoarmaexplosivo and arm.pk = :carma"); + query.setParameter("ctipoarmaexplosivo", tarmArmas.getCtipoarmaexplosivo()); + query.setParameter("carma", tarmArmas.getPk()); + List listaCatalogoCalibre = query.getResultList(); + if(listaCatalogoCalibre != null && !listaCatalogoCalibre.isEmpty()){ + datosArmaDto.setCalibre(listaCatalogoCalibre.get(0).getDescription()); + } + listaDatosArma.add(datosArmaDto); + } + personaSnapDto.setListaDatosArma(listaDatosArma); + } + } + + + + pRequest.getResponse().put("DATOSPERSONSNAP", personaSnapDto); + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + return pRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/ImagenPersona.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/ImagenPersona.java.svn-base new file mode 100644 index 0000000..74e301f --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/ImagenPersona.java.svn-base @@ -0,0 +1,48 @@ +package com.fp.armas.rules.query.webservices; + +import java.util.List; + +import javax.persistence.Query; + +import com.fp.armas.rules.query.webservices.util.PersonaUtil; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.dto.ws.ImagenDto; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; + +/** + * Componente que retorna la foto o logo de una persona sea esta natural o jurídica + * @author dcruz + * + */ +public class ImagenPersona extends QueryRule { + + private static final long serialVersionUID = -1019985182946646396L; + public static final String QUERY_PERSONA_IDENT = "SELECT o FROM TcustPersonDetail o WHERE o.identification = :identification AND o.pk.dateto=:dateto"; + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + try { + System.out.println("Query ImagenPersona...................................................................."); + String numeroidentificacion = (String) pRequest.get("NUMEROIDENTIFICACION"); + System.out.println(QUERY_PERSONA_IDENT+".........."+numeroidentificacion+" ..... "+FormatDates.getDefaultExpiryTimestamp()); + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_PERSONA_IDENT); + query.setParameter("identification", numeroidentificacion); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List ltcustPersonDetails = query.getResultList(); + System.out.println("tamanio ......."+ltcustPersonDetails.size()); + if(ltcustPersonDetails != null && !ltcustPersonDetails.isEmpty()){ + TcustPersonDetail tcustPersonDetail = ltcustPersonDetails.iterator().next(); + ImagenDto imagen = PersonaUtil.getInstancia().obtenerImagen(tcustPersonDetail.getPk().getPersoncode()); + pRequest.getResponse().put("IMAGENPERSONA", imagen); + } + } catch (Throwable e) { + + } + return pRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/JefeCentroImpresion.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/JefeCentroImpresion.java.svn-base new file mode 100644 index 0000000..a3c236e --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/.svn/text-base/JefeCentroImpresion.java.svn-base @@ -0,0 +1,71 @@ +package com.fp.armas.rules.query.webservices; + + +import java.util.List; + +import javax.persistence.Query; + +import com.fp.armas.rules.query.webservices.util.CatalogoUtil; +import com.fp.armas.rules.query.webservices.util.PersonaUtil; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.dto.ws.JefeCentroControlDto; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; + +public class JefeCentroImpresion extends QueryRule { + + private static final long serialVersionUID = 8341638596202085693L; + private static final String QUERY_DOCUMENTO_NUM = "SELECT o FROM TarmDocumentoHabilitante o WHERE o.numerodocumento=:numerodocumento"; + private static final String QUERY_SOLICITUD_DOCUMENTO_NUM = "SELECT sd.csolicitud FROM tarmsolicituddocumento sd WHERE sd.cdocumento=:cDocumento and " + + " sd.csolicitud = (SELECT max(sd2.csolicitud) FROM tarmsolicituddocumento sd2 inner join tarmsolicitud sol on sol.csolicitud = sd2.csolicitud " + + " WHERE sd2.cdocumento=:cDocumento and sol.estado!='ANU')"; + /** + * Busca el jefe del centro de control de la solicitud asociada al documento expedido + */ + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + try { + JefeCentroControlDto jefeCentroControl = null; + String numerodocumento = (String) pRequest.get("NUMERODOCUMENTO"); + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_DOCUMENTO_NUM); + query.setParameter("numerodocumento", numerodocumento); + List ltarmDocumentoHabilitantes = query.getResultList(); + if(ltarmDocumentoHabilitantes != null && !ltarmDocumentoHabilitantes.isEmpty()){ + TarmDocumentoHabilitante documentoHabilitante = ltarmDocumentoHabilitantes.iterator().next(); + TarmSolicitud solicitud = null; + if(documentoHabilitante.getCsolicitud() != null){ + solicitud = TarmSolicitud.find(PersistenceHelper.getEntityManager(), documentoHabilitante.getCsolicitud()); + }else{ + Query querySolicitud = PersistenceHelper.getEntityManager().createNativeQuery(QUERY_SOLICITUD_DOCUMENTO_NUM); + querySolicitud.setParameter("cDocumento", documentoHabilitante.getPk()); + String codigoSolicitud = querySolicitud.getSingleResult().toString(); + if(codigoSolicitud!=null){ + solicitud = TarmSolicitud.find(PersistenceHelper.getEntityManager(),codigoSolicitud); + } + } + if(solicitud != null && solicitud.getCcentrocontrol() != null){ + TarmCentroControl tarmCentroControl = TarmCentroControl.find(PersistenceHelper.getEntityManager(), solicitud.getCcentrocontrol()); + TcustPersonDetail tcustPersonDetail = TcustPersonDetail.find(PersistenceHelper.getEntityManager(), new TcustPersonDetailKey(tarmCentroControl.getPersoncode(), FormatDates.getDefaultExpiryTimestamp())); + jefeCentroControl = new JefeCentroControlDto(); + jefeCentroControl.setNombre(tcustPersonDetail.getName()); + jefeCentroControl.setFirma(tcustPersonDetail.getSign()); + jefeCentroControl.setUbicacion(PersonaUtil.getInstancia().obtenerLocacionPersona(tcustPersonDetail.getPk().getPersoncode())); + jefeCentroControl.setRangoJefe(CatalogoUtil.getInstancia().getDescripcion(tarmCentroControl.getGrado(), tarmCentroControl.getGradocodigo())); + pRequest.getResponse().put("JEFECENTRO", jefeCentroControl); + } + } + } catch (Throwable e) { + throw new Exception(e); + } + return pRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/ArmasId.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/ArmasId.java new file mode 100644 index 0000000..cc1b536 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/ArmasId.java @@ -0,0 +1,68 @@ +package com.fp.armas.rules.query.webservices; + +import com.fp.armas.rules.query.webservices.util.ArmaUtil; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.parmas.dto.ws.ArmaDto; + +/** + * Clase que realiza el m&ecaute;todo para obtener el arma a través de su id + * @author dcruz + * + */ +public class ArmasId extends QueryRule { + + private static final long serialVersionUID = 1L; + + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + ArmaDto armaDto = null; + try { + String carma = (String) pRequest.get("codigoarma"); + if(carma!=null && !carma.isEmpty()){ + armaDto = ArmaUtil.getInstancia().obtenerArmaId(carma); + + } + String ctag = (String) pRequest.get("codigotag"); + if(ctag!=null && !ctag.isEmpty()){ + armaDto = ArmaUtil.getInstancia().obtenerArmaIdPorTag(ctag); + + } + pRequest.getResponse().put("ARMASWS", armaDto!=null?armaDto:null); + return pRequest; + } catch (Throwable e) { + throw new Exception(e); + } + } + +// /** +// * Completa los datos del arma encontrada +// * @param armaDto dto de arma +// * @param tarmArmas objeto tipo {@link TarmArmas} +// * @throws CommondbException +// * @throws Exception +// */ +// private ArmaDto completaArma(ArmaDto armaDto, TarmArmas tarmArmas) throws CommondbException, Exception{ +// armaDto = new ArmaDto(); +// armaDto.setIdArma(tarmArmas.getPk()); +// armaDto.setCantidad(tarmArmas.getCantidad()); +// armaDto.setSerie(tarmArmas.getLote()); +// TgeneCatalogDetail estado = TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tarmArmas.getEstado() != null ? tarmArmas.getEstado() : "", tarmArmas.getEstadocodigo() != null ? tarmArmas.getEstadocodigo() : "")); +// armaDto.setEstado(estado != null ? estado.getDescription() : ""); +// TarmTipoArmaExplosivo tipoArmaExplosivo = TarmTipoArmaExplosivo.find(PersistenceHelper.getEntityManager(), tarmArmas.getCtipoarmaexplosivo()); +// if(tipoArmaExplosivo != null){ +// TgeneCatalogDetail clase= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getClase() != null ? tipoArmaExplosivo.getClase() : "", tipoArmaExplosivo.getClasecodigo() != null ? tipoArmaExplosivo.getClasecodigo() : "")); +// armaDto.setClase(clase != null ? clase.getDescription():null); +// TgeneCatalogDetail tipoArma= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getTipoarmaexplosivo() != null ? tipoArmaExplosivo.getTipoarmaexplosivo() : "", tipoArmaExplosivo.getTipoarmaexplosivocodigo() != null ? tipoArmaExplosivo.getTipoarmaexplosivocodigo() : "")); +// armaDto.setTipo(tipoArma != null ? tipoArma.getDescription():null); +// TgeneCatalogDetail unidadMedida= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getUnidadmedidapeso() != null ? tipoArmaExplosivo.getUnidadmedidapeso():"", tipoArmaExplosivo.getUnidadmedidapesocodigo() != null ? tipoArmaExplosivo.getUnidadmedidapesocodigo() : "")); +// armaDto.setUnidadMedidaPeso(unidadMedida != null ? unidadMedida.getDescription():null); +// TgeneCatalogDetail calibre= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getCalibre() != null ? tipoArmaExplosivo.getCalibre() : "", tipoArmaExplosivo.getCalibrecodigo() != null ? tipoArmaExplosivo.getCalibrecodigo() : "")); +// armaDto.setCalibre(calibre != null ? calibre.getDescription() : null); +// TgeneCatalogDetail longitud= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getLongitud() != null ? tipoArmaExplosivo.getLongitud() : "", tipoArmaExplosivo.getLongitudcodigo() != null ? tipoArmaExplosivo.getLongitudcodigo() : "")); +// armaDto.setLongitud(longitud != null ? longitud.getDescription() : null); +// } +// return armaDto; +// } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/ColaImpresion.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/ColaImpresion.java new file mode 100644 index 0000000..dcf9d0c --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/ColaImpresion.java @@ -0,0 +1,103 @@ +package com.fp.armas.rules.query.webservices; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Query; + +import com.fp.armas.rules.query.webservices.util.ColaImpresionUtil; +import com.fp.common.logger.APPLogger; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.dto.ws.ColaImpresionDto; +import com.fp.persistence.parmas.inte.TarmColadeImpresion; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Componente que realiza la búsquedas de los datos de impresión de un usuario + * @author dcruz + * + */ +public class ColaImpresion extends QueryRule{ + + private static final long serialVersionUID = -3993166768741911054L; + private static final String QUERY_USUARIO_ID = "SELECT o FROM TsafeUserDetail o WHERE o.pk.usercode=:usercode AND o.pk.dateto=:dateto"; + private static final String QUERY_COLA_IMPRESION = "SELECT o.* FROM TarmColadeImpresion o " + + "left join tarmdocumentohabilitante i on o.cdocumento = i.cdocumento " + + "left join tarmsolicitud k on i.csolicitud = k.csolicitud " + + "WHERE o.estadoimpresion=:estado and i.ccentrocontrol = :ccentrocontrol and coalesce(k.estado,'APB') IN ('APB','FIN')"; + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + Query query; + List lcolaImpresion = null; + try { + String estado = (String) pRequest.get("estado"); + String usercode = (String) pRequest.get("usercode"); + System.out.println("estado..."+estado); + System.out.println("usercode..."+usercode); + query = PersistenceHelper.getEntityManager().createQuery(QUERY_USUARIO_ID); + query.setParameter("usercode", usercode); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List ltsafeUserDetails = query.getResultList(); + TsafeUserDetail tsafeUserDetail; + if(ltsafeUserDetails != null && !ltsafeUserDetails.isEmpty()){ + tsafeUserDetail = ltsafeUserDetails.iterator().next(); + }else{ + return pRequest; + } + //centro control + query=PersistenceHelper.getEntityManager().createQuery("select o from TarmCentroControl o" + + " where o.pk=(select p.ccentrocontrol from TarmCentroControlJur p " + + " where p.provincecode=(select pr.provincecode from TcustPersonAddress pr " + + " where pr.pk.personcode=:personcode and" + + " pr.pk.dateto=:dateto and" + + " pr.principal='Y' and" + + " pr.pk.addressnumber=(select max(q.pk.addressnumber) from TcustPersonAddress q " + + " where q.pk.personcode=:personcode and" + + " q.pk.dateto=:dateto and" + + " q.principal='Y')))"); + query.setParameter("personcode", tsafeUserDetail.getPk().getPersoncode()); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List tarmCentroControls = query.getResultList(); + TarmCentroControl tarmCentroControl; + if(tarmCentroControls != null && !tarmCentroControls.isEmpty()){ + tarmCentroControl = tarmCentroControls.iterator().next(); + }else{ + return pRequest; + } + System.out.println("QUERY COLA IMPRESION: "+QUERY_COLA_IMPRESION); + query = PersistenceHelper.getEntityManager().createNativeQuery(QUERY_COLA_IMPRESION); + query.setParameter("estado", estado); + query.setParameter("ccentrocontrol", tarmCentroControl.getPk()); + + List coladeImpresionList = new ArrayList(); + List ltarmColadeImpresionsTMP = query.getResultList(); + for(Object[]tmp:ltarmColadeImpresionsTMP){ + TarmColadeImpresion colaImpresionObj = new TarmColadeImpresion(); + colaImpresionObj.setPk(tmp[3].toString()); + colaImpresionObj.setEstadoimpresion(tmp[1].toString()); + colaImpresionObj.setFechaimpresion((Timestamp) tmp[4]); + colaImpresionObj.setEstadoimpresioncode(tmp[2].toString()); + colaImpresionObj.setCdocumento(((BigDecimal) tmp[0]).longValue()); + colaImpresionObj.setFecharegistro(new Date(((Timestamp) tmp[5]).getTime())); + if (tmp[6] != null) + colaImpresionObj.setCodigotarjeta(tmp[6].toString()); + coladeImpresionList.add(colaImpresionObj); + } + lcolaImpresion = ColaImpresionUtil.getInstancia().completaColaImpresion(coladeImpresionList, tsafeUserDetail.getPk().getPersoncode(), tsafeUserDetail.getPk().getUsercode()); + pRequest.getResponse().put("COLAIMPRESION", lcolaImpresion); + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + return pRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/ConsultaImpresionProceso.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/ConsultaImpresionProceso.java new file mode 100644 index 0000000..7ab3cc0 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/ConsultaImpresionProceso.java @@ -0,0 +1,72 @@ +package com.fp.armas.rules.query.webservices; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Query; + +import org.joda.time.DateTime; + +import com.fp.armas.rules.query.webservices.util.ColaImpresionUtil; +import com.fp.common.logger.APPLogger; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.dto.ws.ColaImpresionDto; +import com.fp.persistence.parmas.inte.TarmColadeImpresion; + +/** + * Consulta los datos de impresión del proceso + * @author dcruz + * + */ +public class ConsultaImpresionProceso extends QueryRule { + + private static final long serialVersionUID = -7675701723545274414L; + public static final String QUERY_COLA_SOLICITUD = "SELECT o.* FROM TarmColadeImpresion o WHERE o.estadoimpresion='PIMPR' and o.cdocumento " + + "IN ((SELECT i.cdocumento FROM TarmDocumentoHabilitante i WHERE i.csolicitud IN (SELECT c.CSOLICITUD FROM TarmSolicitud c " + + "WHERE c.estado IN ('APB','FIN') and c.numerosolicitud=:numerosolicitud)) UNION (SELECT SD.cdocumento FROM tarmsolicituddocumento SD WHERE sd.csolicitud " + + "IN (SELECT c.CSOLICITUD FROM TarmSolicitud c WHERE c.estado IN ('APB','FIN') and c.numerosolicitud=:numerosolicitud)))"; + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + // TODO Auto-generated method stub + List lcolaImpresion = null; + try { + + String codigosolicitud = (String) pRequest.get("CODIGOSOLICITUD"); + System.out.println("codigosolicitud.."+codigosolicitud); + System.out.println(QUERY_COLA_SOLICITUD); + Query query = PersistenceHelper.getEntityManager().createNativeQuery(QUERY_COLA_SOLICITUD); + query.setParameter("numerosolicitud", codigosolicitud); + + List ltarmColadeImpresions = new ArrayList(); + List ltarmColadeImpresionsTMP = query.getResultList(); + + for(Object[]tmp:ltarmColadeImpresionsTMP){ + TarmColadeImpresion colaImpresionObj = new TarmColadeImpresion(); + colaImpresionObj.setPk(tmp[3].toString()); + colaImpresionObj.setEstadoimpresion(tmp[1].toString()); + colaImpresionObj.setFechaimpresion((Timestamp) tmp[4]); + colaImpresionObj.setEstadoimpresioncode(tmp[2].toString()); + colaImpresionObj.setCdocumento(((BigDecimal) tmp[0]).longValue()); + colaImpresionObj.setFecharegistro(new Date(((Timestamp) tmp[5]).getTime())); + if (tmp[6] != null) + colaImpresionObj.setCodigotarjeta(tmp[6].toString()); + ltarmColadeImpresions.add(colaImpresionObj); + } + + lcolaImpresion = ColaImpresionUtil.getInstancia().completaColaImpresion(ltarmColadeImpresions); + pRequest.getResponse().put("COLAIMPRESION", lcolaImpresion); + pRequest.getResponse().put("COLAIMPRESION", lcolaImpresion); + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + return pRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/ConsultaLogin.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/ConsultaLogin.java new file mode 100644 index 0000000..6c72ea5 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/ConsultaLogin.java @@ -0,0 +1,62 @@ +package com.fp.armas.rules.query.webservices; + +import java.util.List; + +import javax.persistence.Query; + +import com.fp.armas.rules.query.webservices.util.PersonaUtil; +import com.fp.common.logger.APPLogger; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Servicio que retorna un 0 si existe el login, 1 si es incorrecto + * @author dcruz + * + */ +public class ConsultaLogin extends QueryRule { + + private static final long serialVersionUID = -1758582166779180497L; + private static final String QUERY_USER = "SELECT o FROM TsafeUserDetail o WHERE o.pk.usercode=:usercode AND o.pk.dateto=:dateto"; + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + try { + String usercode = (String) pRequest.get("USERCODE"); + String password = (String) pRequest.get("PASSWORD"); + if(password != null){//Servicio consulta login password + StringBuilder sb = new StringBuilder(QUERY_USER); + sb.append(" AND o.password=:password"); + Query query = PersistenceHelper.getEntityManager().createQuery(sb.toString()); + query.setParameter("usercode", usercode); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + query.setParameter("password", password); + List ltsafeUserDetails = query.getResultList(); + if(ltsafeUserDetails != null && !ltsafeUserDetails.isEmpty()){ + TsafeUserDetail tsafeUserDetail = ltsafeUserDetails.iterator().next(); + String localidad = PersonaUtil.getInstancia().obtenerLocacionPersona(tsafeUserDetail.getPk().getPersoncode()); + pRequest.getResponse().put("RESPUESTA", localidad.toString()); + } + } else {//Servicio consulta login + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_USER); + query.setParameter("usercode", usercode); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List ltsafeUserDetails = query.getResultList(); + if(ltsafeUserDetails != null && !ltsafeUserDetails.isEmpty()){ + pRequest.getResponse().put("RESPUESTA", "0"); + }else{ + pRequest.getResponse().put("RESPUESTA", "1"); + } + } + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + pRequest.getResponse().put("RESPUESTA", "2"); + } + return pRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/ConsultaXpathDocumento.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/ConsultaXpathDocumento.java new file mode 100644 index 0000000..adf07a4 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/ConsultaXpathDocumento.java @@ -0,0 +1,43 @@ +package com.fp.armas.rules.query.webservices; + +import static com.fp.armas.rules.query.webservices.util.ColaImpresionUtil.QUERY_SOLICITUD_NUM; + +import java.util.List; + +import javax.persistence.Query; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmSolicitud; + +/** + * Consulta el xpath del documento habilitante y dicho xpath + * @author dcruz + * + */ +public class ConsultaXpathDocumento extends QueryRule { + + private static final long serialVersionUID = 7391996435678161968L; + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + String numerosolicitud = (String) pRequest.get("NUMEROSOLICITUD"); + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_SOLICITUD_NUM); + query.setParameter("numerosolicitud", numerosolicitud); + List ltarmSolicitud = query.getResultList(); + if(ltarmSolicitud != null && !ltarmSolicitud.isEmpty()){ + TarmSolicitud tarmSolicitud = ltarmSolicitud.iterator().next(); + Query queryDoc = PersistenceHelper.createQuery("SELECT o.xpath FROM TarmDocumentoHabilitante o WHERE o.csolicitud=:csolicitud "); + queryDoc.setParameter("csolicitud", tarmSolicitud.getPk()); + List lxpath = queryDoc.getResultList(); + if(lxpath != null && !lxpath.isEmpty()){ + String xpath = lxpath.iterator().next(); + pRequest.getResponse().put("XPATHDOCUMENTOSOLICITUD", xpath); + } + } + return pRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/DatosPerson.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/DatosPerson.java new file mode 100644 index 0000000..5cbb615 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/DatosPerson.java @@ -0,0 +1,292 @@ +package com.fp.armas.rules.query.webservices; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Query; + +import com.fp.armas.rules.query.webservices.util.InstitucionSnapEnum; +import com.fp.common.logger.APPLogger; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.dto.ws.DatosSnapDto; +import com.fp.persistence.parmas.dto.ws.InfoGuardiaDto; +import com.fp.persistence.parmas.dto.ws.TramiteDto; +import com.fp.persistence.parmas.dto.ws.DatosArmaDto; +import com.fp.persistence.parmas.eval.TarmEvaluacion; +import com.fp.persistence.parmas.soli.TarmArmaPruebas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmGuardias; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +/** + * Componente que realiza la búsquedas de los datos de necesarios para el WS de la SNAP + * @author Manuel Cepeda + * + */ +public class DatosPerson extends QueryRule{ + + private static final long serialVersionUID = -3993166768741911053L; + + /** + * Permite obtener todos los datos necesarios para el WS de SNAP + * @param QueryRequest pRequest + * @return QueryRequest + */ + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + Query query; + + try { + DatosSnapDto personaSnapDto = new DatosSnapDto(); + + query = PersistenceHelper.getEntityManager().createQuery("select p from TgeneParameters p where pk.code= :code and pk.companycode=:companycode"); + query.setParameter("code", "PATH.ALFRESCO.ARCHIVOS"); + query.setParameter("companycode", 1); + List lparametros = query.getResultList(); + if(lparametros != null && !lparametros.isEmpty()){ + personaSnapDto.setxPathLocation(lparametros.get(0).getTextvalue()); + } + + String identificacion = (String) pRequest.get("identificacion"); + String institucion = (String) pRequest.get("institucion"); + String serie = (String) pRequest.get("serie"); + query = PersistenceHelper.getEntityManager().createQuery("select pd from TcustPersonDetail pd where pd.identification= :identification and pd.pk.dateto=:dateto order by DATETO DESC"); + query.setParameter("identification", identificacion); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List ltsafeUserDetails = query.getResultList(); + if(ltsafeUserDetails != null && !ltsafeUserDetails.isEmpty()){ + personaSnapDto.setCodigoPersona(ltsafeUserDetails.get(0).getPk().getPersoncode()); + personaSnapDto.setRazonSocial(ltsafeUserDetails.get(0).getName()); + } + + //direccion principal + query=PersistenceHelper.getEntityManager().createQuery("select pa from TcustPersonAddress pa where pa.pk.personcode=:personcode and pa.pk.dateto=:dateto and pa.principal='Y'"); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List lcustPersonAddress = query.getResultList(); + if(lcustPersonAddress != null && !lcustPersonAddress.isEmpty()){ + personaSnapDto.setDireccion(lcustPersonAddress.get(0).getAddress()); + } + + //email + query=PersistenceHelper.getEntityManager().createQuery("select pa from TcustPersonAddress pa where pa.pk.personcode=:personcode and pa.pk.dateto=:dateto and pa.addresstypecatalog=3"); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List lcustPersonEmail = query.getResultList(); + if(lcustPersonEmail != null && !lcustPersonEmail.isEmpty()){ + personaSnapDto.setEmail(lcustPersonEmail.get(0).getAddress()); + } + + //telefono + query=PersistenceHelper.getEntityManager().createQuery("select pp from TcustPersonPhone pp where pp.pk.personcode=:personcode and pp.pk.dateto=:dateto and pp.phonetypecatalog=1"); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List lcustPersonTelefono = query.getResultList(); + if(lcustPersonTelefono != null && !lcustPersonTelefono.isEmpty()){ + personaSnapDto.setTelefonoFijo(lcustPersonTelefono.get(0).getPhonenumber()); + } + + //celular + query=PersistenceHelper.getEntityManager().createQuery("select pp from TcustPersonPhone pp where pp.pk.personcode=:personcode and pp.pk.dateto=:dateto and pp.phonetypecatalog=2"); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List lcustPersonCelular = query.getResultList(); + if(lcustPersonCelular != null && !lcustPersonCelular.isEmpty()){ + personaSnapDto.setTelefonoCelular(lcustPersonCelular.get(0).getPhonenumber()); + } + + //test psocilogico + query=PersistenceHelper.getEntityManager().createQuery("select te from TarmEvaluacion te where te.personcode=:personcode and te.tipoevaluacion = 'PSICOLOGICA' order by te.fechaexpiracion desc"); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + List listaEvaluacion = query.getResultList(); + if(listaEvaluacion != null && !listaEvaluacion.isEmpty() && institucion.equals(InstitucionSnapEnum.COPS.getNombre())){ + personaSnapDto.setTestPsicologico(listaEvaluacion.get(0).getInformexpath()); + } + + //tramites + List listaTramitesHabilitantes = new ArrayList<>(); + query=PersistenceHelper.getEntityManager().createQuery("select dh from TarmDocumentoHabilitante dh where dh.pk.personcode=:personcode and dh.ctramite in(73, 179) order by dh.fechaexpiracion desc"); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + List listaTramiteCM = query.getResultList(); + if(listaTramiteCM != null && !listaTramiteCM.isEmpty()){ + listaTramitesHabilitantes.add(listaTramiteCM.get(0)); + } + + query=PersistenceHelper.getEntityManager().createQuery("select dh from TarmDocumentoHabilitante dh where dh.pk.personcode=:personcode and dh.ctramite in(74, 180) order by dh.fechaexpiracion desc"); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + List listaTramiteMA = query.getResultList(); + if(listaTramiteMA != null && !listaTramiteMA.isEmpty()){ + listaTramitesHabilitantes.add(listaTramiteMA.get(0)); + } + + query=PersistenceHelper.getEntityManager().createQuery("select dh from TarmDocumentoHabilitante dh where dh.pk.personcode=:personcode and dh.ctramite in(76, 182) order by dh.fechaexpiracion desc"); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + List listaTramiteSP = query.getResultList(); + if(listaTramiteSP != null && !listaTramiteSP.isEmpty()){ + listaTramitesHabilitantes.add(listaTramiteSP.get(0)); + } + + List listaTramites = new ArrayList<>(); + if(listaTramitesHabilitantes != null && !listaTramitesHabilitantes.isEmpty()){ + for(TarmDocumentoHabilitante tramitesHabilitantes: listaTramitesHabilitantes){ + TramiteDto tramiteDto = new TramiteDto(); + tramiteDto.setTramite(tramitesHabilitantes.getCtramite().toString()); + tramiteDto.setFechaEmision(tramitesHabilitantes.getFechaemision()); + tramiteDto.setFechaExpiracion(tramitesHabilitantes.getFechaexpiracion()); + + //informacion del tramite + query=PersistenceHelper.getEntityManager().createQuery("select CONCAT(tt.description, ' - ', ta.description, ' - ', ca.description, ' - ', ua.description) from TarmTramite t," + + " TgeneCatalogDetail tt, TgeneCatalogDetail ta, TgeneCatalogDetail ca, TgeneCatalogDetail ua " + + " where tt.pk.catalog = t.tipotramite and tt.pk.catalogcode = t.tipotramitecodigo" + + " and ta.pk.catalog = t.tipoautorizacion and ta.pk.catalogcode = t.tipoautorizacioncodigo" + + " and ca.pk.catalog = t.categoria and ca.pk.catalogcode = t.categoriacodigo" + + " and ua.pk.catalog = t.usoactividad and ua.pk.catalogcode = t.usoactividadcodigo" + + " and t.pk = :ctramite"); + query.setParameter("ctramite", tramitesHabilitantes.getCtramite()); + + List tramiteDescripcion = query.getResultList(); + if(tramiteDescripcion != null && !tramiteDescripcion.isEmpty()){ + tramiteDto.setNumeroDocumento(tramiteDescripcion.get(0).toString()); + } + listaTramites.add(tramiteDto); + } + } + personaSnapDto.setListaTramites(listaTramites); + + if(institucion.equals(InstitucionSnapEnum.CRIMINALISTICA.getNombre()) || institucion.equals(InstitucionSnapEnum.COPS.getNombre()) || institucion.equals(InstitucionSnapEnum.FISCALIA_GENERAL.getNombre())){ + if("RUC".equals(ltsafeUserDetails.get(0).getIdentificationcatalog())){ + query=PersistenceHelper.getEntityManager().createQuery("select g from TarmGuardias g where g.cempresa=:personcode"); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + List listaGuardias = query.getResultList(); + if(listaGuardias != null && !listaGuardias.isEmpty()){ + List listaInfoGuardias = new ArrayList<>(); + for(TarmGuardias tarmGuardias : listaGuardias){ + InfoGuardiaDto infoGuardiaDto = new InfoGuardiaDto(); + infoGuardiaDto.setEstado(tarmGuardias.getEstado()); + + query=PersistenceHelper.getEntityManager().createQuery("select pd from TcustPersonDetail pd where pd.pk.personcode=:personcode"); + query.setParameter("personcode", tarmGuardias.getPk()); + List listaPeson = query.getResultList(); + if(listaPeson != null && !listaPeson.isEmpty()){ + infoGuardiaDto.setNombre(listaPeson.get(0).getName()); + } + listaInfoGuardias.add(infoGuardiaDto); + } + personaSnapDto.setListaGuardias(listaInfoGuardias); + } + }else{ + query=PersistenceHelper.getEntityManager().createQuery("select g from TarmGuardias g where g.pk=:personcode"); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + List listaPersonaGuardia = query.getResultList(); + if(listaPersonaGuardia != null && !listaPersonaGuardia.isEmpty() && listaPersonaGuardia.get(0).getCempresa() != null){ + List listaInfoGuardias = new ArrayList<>(); + InfoGuardiaDto infoGuardiaDto = new InfoGuardiaDto(); + infoGuardiaDto.setEstado(listaPersonaGuardia.get(0).getEstado()); + + query=PersistenceHelper.getEntityManager().createQuery("select pd from TcustPersonDetail pd where pd.pk.personcode=:personcode"); + query.setParameter("personcode", listaPersonaGuardia.get(0).getCempresa()); + List listaEmpresa = query.getResultList(); + if(listaEmpresa != null && !listaEmpresa.isEmpty()){ + infoGuardiaDto.setEmpresa(listaEmpresa.get(0).getName()); + } + listaInfoGuardias.add(infoGuardiaDto); + personaSnapDto.setListaGuardias(listaInfoGuardias); + } + + } + + //datos del arma + query=PersistenceHelper.getEntityManager().createQuery("select ta from TarmArmas ta, TarmRegistroArmas regarm, TcustPersonDetail pd " + + " where ta.cregistro = regarm.pk and pd.pk.personcode = regarm.personcode and pd.pk.dateto = :dateto" + + " and ta.lote = :lote and ta.ctipoarmaexplosivo in (select te.pk from TarmTipoArmaExplosivo te where te.clase = '0010000001')" + + " and pd.pk.personcode = :personcode"); + query.setParameter("lote", serie); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + List listaArma = query.getResultList(); + if(listaArma != null && !listaArma.isEmpty()){ + List listaDatosArma = new ArrayList<>(); + for(TarmArmas tarmArmas : listaArma){ + DatosArmaDto datosArmaDto = new DatosArmaDto(); + datosArmaDto.setLote(tarmArmas.getLote()); + datosArmaDto.setTipoFabricacion(tarmArmas.getTipofabricacion()); + + //marca + query=PersistenceHelper.getEntityManager().createQuery("select cat from TgeneCatalogDetail cat, TarmArmas arm " + + "where cat.pk.catalog = arm.marca and cat.pk.catalogcode = arm.marcacodigo and arm.pk = :carma"); + query.setParameter("carma", tarmArmas.getPk()); + List listaCatalogoMarca = query.getResultList(); + if(listaCatalogoMarca != null && !listaCatalogoMarca.isEmpty()){ + datosArmaDto.setMarca(listaCatalogoMarca.get(0).getDescription()); + } + + //datosArmaDto.setMarca(tarmArmas.getMarca()); + datosArmaDto.setModelo(tarmArmas.getModelo()); + datosArmaDto.setEstadoArma(tarmArmas.getEstado()); + + query=PersistenceHelper.getEntityManager().createQuery("select a from TarmArmaPruebas a where a.personcode = :personcode and a.carma = :carma"); + query.setParameter("personcode", ltsafeUserDetails.get(0).getPk().getPersoncode()); + query.setParameter("carma", tarmArmas.getPk()); + List listaArmaPrueba = query.getResultList(); + if(listaArmaPrueba != null && !listaArmaPrueba.isEmpty()){ + if(institucion.equals(InstitucionSnapEnum.CRIMINALISTICA.getNombre())){ + datosArmaDto.setImagenImpronta(listaArmaPrueba.get(0).getXpathimpronta()); + datosArmaDto.setImagenArma(listaArmaPrueba.get(0).getXpathfotografia()); + } + datosArmaDto.setFichaTecnicaArma(listaArmaPrueba.get(0).getXpathfichatecarmas()); + } + + //clase + query=PersistenceHelper.getEntityManager().createQuery("select cat from TarmTipoArmaExplosivo tae, TgeneCatalogDetail cat, TarmArmas arm where cat.pk.catalog = tae.clase and cat.pk.catalogcode = tae.clasecodigo" + + " and tae.pk = arm.ctipoarmaexplosivo and tae.pk = :ctipoarmaexplosivo and arm.pk = :carma"); + query.setParameter("ctipoarmaexplosivo", tarmArmas.getCtipoarmaexplosivo()); + query.setParameter("carma", tarmArmas.getPk()); + List listaCatalogoClase = query.getResultList(); + if(listaCatalogoClase != null && !listaCatalogoClase.isEmpty()){ + datosArmaDto.setDescripcionClase(listaCatalogoClase.get(0).getDescription()); + } + + //tipo + query=PersistenceHelper.getEntityManager().createQuery("select cat from TarmTipoArmaExplosivo tae, TgeneCatalogDetail cat, TarmArmas arm where cat.pk.catalog = tae.tipoarmaexplosivo and cat.pk.catalogcode = tae.tipoarmaexplosivocodigo" + + " and tae.pk = arm.ctipoarmaexplosivo and tae.pk = :ctipoarmaexplosivo and arm.pk = :carma"); + query.setParameter("ctipoarmaexplosivo", tarmArmas.getCtipoarmaexplosivo()); + query.setParameter("carma", tarmArmas.getPk()); + List listaCatalogoTipo = query.getResultList(); + if(listaCatalogoTipo != null && !listaCatalogoTipo.isEmpty()){ + datosArmaDto.setDescripcionTipo(listaCatalogoTipo.get(0).getDescription()); + } + + //calibre + query=PersistenceHelper.getEntityManager().createQuery("select cat from TarmTipoArmaExplosivo tae, TgeneCatalogDetail cat, TarmArmas arm where cat.pk.catalog = tae.calibre and cat.pk.catalogcode = tae.calibrecodigo" + + " and tae.pk = arm.ctipoarmaexplosivo and tae.pk = :ctipoarmaexplosivo and arm.pk = :carma"); + query.setParameter("ctipoarmaexplosivo", tarmArmas.getCtipoarmaexplosivo()); + query.setParameter("carma", tarmArmas.getPk()); + List listaCatalogoCalibre = query.getResultList(); + if(listaCatalogoCalibre != null && !listaCatalogoCalibre.isEmpty()){ + datosArmaDto.setCalibre(listaCatalogoCalibre.get(0).getDescription()); + } + listaDatosArma.add(datosArmaDto); + } + personaSnapDto.setListaDatosArma(listaDatosArma); + } + } + + + + pRequest.getResponse().put("DATOSPERSONSNAP", personaSnapDto); + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + return pRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/ImagenPersona.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/ImagenPersona.java new file mode 100644 index 0000000..74e301f --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/ImagenPersona.java @@ -0,0 +1,48 @@ +package com.fp.armas.rules.query.webservices; + +import java.util.List; + +import javax.persistence.Query; + +import com.fp.armas.rules.query.webservices.util.PersonaUtil; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.dto.ws.ImagenDto; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; + +/** + * Componente que retorna la foto o logo de una persona sea esta natural o jurídica + * @author dcruz + * + */ +public class ImagenPersona extends QueryRule { + + private static final long serialVersionUID = -1019985182946646396L; + public static final String QUERY_PERSONA_IDENT = "SELECT o FROM TcustPersonDetail o WHERE o.identification = :identification AND o.pk.dateto=:dateto"; + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + try { + System.out.println("Query ImagenPersona...................................................................."); + String numeroidentificacion = (String) pRequest.get("NUMEROIDENTIFICACION"); + System.out.println(QUERY_PERSONA_IDENT+".........."+numeroidentificacion+" ..... "+FormatDates.getDefaultExpiryTimestamp()); + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_PERSONA_IDENT); + query.setParameter("identification", numeroidentificacion); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List ltcustPersonDetails = query.getResultList(); + System.out.println("tamanio ......."+ltcustPersonDetails.size()); + if(ltcustPersonDetails != null && !ltcustPersonDetails.isEmpty()){ + TcustPersonDetail tcustPersonDetail = ltcustPersonDetails.iterator().next(); + ImagenDto imagen = PersonaUtil.getInstancia().obtenerImagen(tcustPersonDetail.getPk().getPersoncode()); + pRequest.getResponse().put("IMAGENPERSONA", imagen); + } + } catch (Throwable e) { + + } + return pRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/JefeCentroImpresion.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/JefeCentroImpresion.java new file mode 100644 index 0000000..a3c236e --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/JefeCentroImpresion.java @@ -0,0 +1,71 @@ +package com.fp.armas.rules.query.webservices; + + +import java.util.List; + +import javax.persistence.Query; + +import com.fp.armas.rules.query.webservices.util.CatalogoUtil; +import com.fp.armas.rules.query.webservices.util.PersonaUtil; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.dto.ws.JefeCentroControlDto; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; + +public class JefeCentroImpresion extends QueryRule { + + private static final long serialVersionUID = 8341638596202085693L; + private static final String QUERY_DOCUMENTO_NUM = "SELECT o FROM TarmDocumentoHabilitante o WHERE o.numerodocumento=:numerodocumento"; + private static final String QUERY_SOLICITUD_DOCUMENTO_NUM = "SELECT sd.csolicitud FROM tarmsolicituddocumento sd WHERE sd.cdocumento=:cDocumento and " + + " sd.csolicitud = (SELECT max(sd2.csolicitud) FROM tarmsolicituddocumento sd2 inner join tarmsolicitud sol on sol.csolicitud = sd2.csolicitud " + + " WHERE sd2.cdocumento=:cDocumento and sol.estado!='ANU')"; + /** + * Busca el jefe del centro de control de la solicitud asociada al documento expedido + */ + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pRequest) throws Exception { + try { + JefeCentroControlDto jefeCentroControl = null; + String numerodocumento = (String) pRequest.get("NUMERODOCUMENTO"); + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_DOCUMENTO_NUM); + query.setParameter("numerodocumento", numerodocumento); + List ltarmDocumentoHabilitantes = query.getResultList(); + if(ltarmDocumentoHabilitantes != null && !ltarmDocumentoHabilitantes.isEmpty()){ + TarmDocumentoHabilitante documentoHabilitante = ltarmDocumentoHabilitantes.iterator().next(); + TarmSolicitud solicitud = null; + if(documentoHabilitante.getCsolicitud() != null){ + solicitud = TarmSolicitud.find(PersistenceHelper.getEntityManager(), documentoHabilitante.getCsolicitud()); + }else{ + Query querySolicitud = PersistenceHelper.getEntityManager().createNativeQuery(QUERY_SOLICITUD_DOCUMENTO_NUM); + querySolicitud.setParameter("cDocumento", documentoHabilitante.getPk()); + String codigoSolicitud = querySolicitud.getSingleResult().toString(); + if(codigoSolicitud!=null){ + solicitud = TarmSolicitud.find(PersistenceHelper.getEntityManager(),codigoSolicitud); + } + } + if(solicitud != null && solicitud.getCcentrocontrol() != null){ + TarmCentroControl tarmCentroControl = TarmCentroControl.find(PersistenceHelper.getEntityManager(), solicitud.getCcentrocontrol()); + TcustPersonDetail tcustPersonDetail = TcustPersonDetail.find(PersistenceHelper.getEntityManager(), new TcustPersonDetailKey(tarmCentroControl.getPersoncode(), FormatDates.getDefaultExpiryTimestamp())); + jefeCentroControl = new JefeCentroControlDto(); + jefeCentroControl.setNombre(tcustPersonDetail.getName()); + jefeCentroControl.setFirma(tcustPersonDetail.getSign()); + jefeCentroControl.setUbicacion(PersonaUtil.getInstancia().obtenerLocacionPersona(tcustPersonDetail.getPk().getPersoncode())); + jefeCentroControl.setRangoJefe(CatalogoUtil.getInstancia().getDescripcion(tarmCentroControl.getGrado(), tarmCentroControl.getGradocodigo())); + pRequest.getResponse().put("JEFECENTRO", jefeCentroControl); + } + } + } catch (Throwable e) { + throw new Exception(e); + } + return pRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/entries b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/entries new file mode 100644 index 0000000..7ee5b67 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/entries @@ -0,0 +1,198 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util +svn://172.17.26.185/COMACO + + + +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +InstitucionSnapEnum.java +file + + + + +2022-07-28T03:40:40.817795Z +59ee7510f4d097e3ec827c87a9eedc78 +2015-12-15T14:36:46.935255Z +4349 +mcepeda + + + + + + + + + + + + + + + + + + + + + +599 + +ColaImpresionUtil.java +file + + + + +2022-07-28T03:40:40.817795Z +5012c5ef0fec56136177932661c65765 +2022-04-19T02:27:53.431385Z +4665 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +14544 + +PersonaUtil.java +file + + + + +2022-07-28T03:40:40.818795Z +e1d4122f4a21dcce902d0f1fe18eadb0 +2022-04-19T02:27:53.431385Z +4665 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +10580 + +CatalogoUtil.java +file + + + + +2022-07-28T03:40:40.818795Z +00dae6801f766acdbea85b34af15bfdc +2022-04-19T02:27:53.431385Z +4665 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +2061 + +ArmaUtil.java +file + + + + +2022-07-28T03:40:40.818795Z +6cc7f9861ed81269d58672391154a6d2 +2022-04-19T02:27:53.431385Z +4665 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +9019 + diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/prop-base/ArmaUtil.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/prop-base/ArmaUtil.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/prop-base/ArmaUtil.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/prop-base/CatalogoUtil.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/prop-base/CatalogoUtil.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/prop-base/CatalogoUtil.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/prop-base/ColaImpresionUtil.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/prop-base/ColaImpresionUtil.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/prop-base/ColaImpresionUtil.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/prop-base/PersonaUtil.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/prop-base/PersonaUtil.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/prop-base/PersonaUtil.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/text-base/ArmaUtil.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/text-base/ArmaUtil.java.svn-base new file mode 100644 index 0000000..f67bdc2 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/text-base/ArmaUtil.java.svn-base @@ -0,0 +1,162 @@ +package com.fp.armas.rules.query.webservices.util; + +import java.util.List; + +import javax.persistence.Query; + +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.dto.ws.ArmaDto; +import com.fp.persistence.parmas.inte.TarmTagArma; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; + +/** + * Clase de funcionalidades que trabajan con {@link ArmaDto} + * @author dcruz + * + */ +public class ArmaUtil { + + private static ArmaUtil INSTANCIA = new ArmaUtil(); + private static final String QUERY_ARMA_TAG = "SELECT o FROM TarmTagArma o WHERE o.pk.carma=:carma"; + private static final String QUERY_ARMA_TAG_ARMA = "SELECT o FROM TarmTagArma o WHERE o.pk.ctag=:ctag"; + + private ArmaUtil(){} + + public static ArmaUtil getInstancia() { + return INSTANCIA; + } + + public ArmaDto obtenerArmaId(String carma) { + ArmaDto arma = null; + try { + TarmArmas tarmArmas = PersistenceHelper.getEntityManager().find(TarmArmas.class, carma); + if(tarmArmas != null){ + arma = new ArmaDto(); + arma.setIdArma(tarmArmas.getPk()); + arma.setCantidad(tarmArmas.getCantidad()); + arma.setSerie(tarmArmas.getLote()); + if(tarmArmas.getMarca()!=null && tarmArmas.getMarcacodigo()!=null){ + TgeneCatalogDetail marca=TgeneCatalogDetail. + find(PersistenceHelper.getEntityManager(),new TgeneCatalogDetailKey(tarmArmas.getMarca(), tarmArmas.getMarcacodigo())); + if(marca!=null){ + arma.setMarca(marca.getDescription()); + } + } + + arma.setModelo(tarmArmas.getModelo()); + TgeneCatalogDetail estado; + + estado = TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tarmArmas.getEstado() != null ? tarmArmas.getEstado() : "", tarmArmas.getEstadocodigo() != null ? tarmArmas.getEstadocodigo() : "")); + arma.setEstado(estado != null ? estado.getDescription() : ""); + arma.setTagAsociado(obtenerTag(arma.getIdArma())); + TarmTipoArmaExplosivo tipoArmaExplosivo = TarmTipoArmaExplosivo.find(PersistenceHelper.getEntityManager(), tarmArmas.getCtipoarmaexplosivo()); + if(tipoArmaExplosivo != null){ + TgeneCatalogDetail clase= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getClase() != null ? tipoArmaExplosivo.getClase() : "", tipoArmaExplosivo.getClasecodigo() != null ? tipoArmaExplosivo.getClasecodigo() : "")); + arma.setClase(clase != null ? clase.getDescription():null); + TgeneCatalogDetail tipoArma= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getTipoarmaexplosivo() != null ? tipoArmaExplosivo.getTipoarmaexplosivo() : "", tipoArmaExplosivo.getTipoarmaexplosivocodigo() != null ? tipoArmaExplosivo.getTipoarmaexplosivocodigo() : "")); + arma.setTipo(tipoArma != null ? tipoArma.getDescription():null); + TgeneCatalogDetail unidadMedida= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getUnidadmedidapeso() != null ? tipoArmaExplosivo.getUnidadmedidapeso():"", tipoArmaExplosivo.getUnidadmedidapesocodigo() != null ? tipoArmaExplosivo.getUnidadmedidapesocodigo() : "")); + arma.setUnidadMedidaPeso(unidadMedida != null ? unidadMedida.getDescription():null); + TgeneCatalogDetail calibre= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getCalibre() != null ? tipoArmaExplosivo.getCalibre() : "", tipoArmaExplosivo.getCalibrecodigo() != null ? tipoArmaExplosivo.getCalibrecodigo() : "")); + arma.setCalibre(calibre != null ? calibre.getDescription() : null); + TgeneCatalogDetail longitud= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getLongitud() != null ? tipoArmaExplosivo.getLongitud() : "", tipoArmaExplosivo.getLongitudcodigo() != null ? tipoArmaExplosivo.getLongitudcodigo() : "")); + arma.setLongitud(longitud != null ? longitud.getDescription() : null); + } + return arma; + } + } catch (Exception e) { + APPLogger.getLogger().error(e); + } + return null; + } + /** + * Obtiene el ArmaDto por el codigo del tag + * @param ctag codigo del tag + * @return ArmaDto + */ + public ArmaDto obtenerArmaIdPorTag(String ctag) { + ArmaDto arma = null; + try { + String carma = obtenerTagPorId(ctag); + if(carma!=null && !carma.isEmpty()){ + TarmArmas tarmArmas = PersistenceHelper.getEntityManager().find(TarmArmas.class, carma); + if(tarmArmas != null){ + arma = new ArmaDto(); + arma.setIdArma(tarmArmas.getPk()); + arma.setCantidad(tarmArmas.getCantidad()); + arma.setSerie(tarmArmas.getLote()); + if(tarmArmas.getMarca()!=null && tarmArmas.getMarcacodigo()!=null){ + TgeneCatalogDetail marca=TgeneCatalogDetail. + find(PersistenceHelper.getEntityManager(),new TgeneCatalogDetailKey(tarmArmas.getMarca(), tarmArmas.getMarcacodigo())); + if(marca!=null){ + arma.setMarca(marca.getDescription()); + } + } + + arma.setModelo(tarmArmas.getModelo()); + TgeneCatalogDetail estado; + + estado = TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tarmArmas.getEstado() != null ? tarmArmas.getEstado() : "", tarmArmas.getEstadocodigo() != null ? tarmArmas.getEstadocodigo() : "")); + arma.setEstado(estado != null ? estado.getDescription() : ""); + arma.setTagAsociado(ctag); + TarmTipoArmaExplosivo tipoArmaExplosivo = TarmTipoArmaExplosivo.find(PersistenceHelper.getEntityManager(), tarmArmas.getCtipoarmaexplosivo()); + if(tipoArmaExplosivo != null){ + TgeneCatalogDetail clase= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getClase() != null ? tipoArmaExplosivo.getClase() : "", tipoArmaExplosivo.getClasecodigo() != null ? tipoArmaExplosivo.getClasecodigo() : "")); + arma.setClase(clase != null ? clase.getDescription():null); + TgeneCatalogDetail tipoArma= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getTipoarmaexplosivo() != null ? tipoArmaExplosivo.getTipoarmaexplosivo() : "", tipoArmaExplosivo.getTipoarmaexplosivocodigo() != null ? tipoArmaExplosivo.getTipoarmaexplosivocodigo() : "")); + arma.setTipo(tipoArma != null ? tipoArma.getDescription():null); + TgeneCatalogDetail unidadMedida= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getUnidadmedidapeso() != null ? tipoArmaExplosivo.getUnidadmedidapeso():"", tipoArmaExplosivo.getUnidadmedidapesocodigo() != null ? tipoArmaExplosivo.getUnidadmedidapesocodigo() : "")); + arma.setUnidadMedidaPeso(unidadMedida != null ? unidadMedida.getDescription():null); + TgeneCatalogDetail calibre= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getCalibre() != null ? tipoArmaExplosivo.getCalibre() : "", tipoArmaExplosivo.getCalibrecodigo() != null ? tipoArmaExplosivo.getCalibrecodigo() : "")); + arma.setCalibre(calibre != null ? calibre.getDescription() : null); + TgeneCatalogDetail longitud= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getLongitud() != null ? tipoArmaExplosivo.getLongitud() : "", tipoArmaExplosivo.getLongitudcodigo() != null ? tipoArmaExplosivo.getLongitudcodigo() : "")); + arma.setLongitud(longitud != null ? longitud.getDescription() : null); + } + return arma; + } + } + + } catch (Exception e) { + APPLogger.getLogger().error(e); + } + return null; + } + + /** + * Retorna el tag del arma asociado + * @param carma + * @return + */ + @SuppressWarnings("unchecked") + public String obtenerTag(String carma) { + String tagArma = null; + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_ARMA_TAG); + query.setParameter("carma", carma); + List lTarmTagArmas = query.getResultList(); + if(lTarmTagArmas != null && !lTarmTagArmas.isEmpty()){ + tagArma = lTarmTagArmas.iterator().next().getPk().getCtag(); + } + return tagArma; + } + + /** + * Retorna el carma asociado al tag + * @param ctag + * @return + */ + @SuppressWarnings("unchecked") + public String obtenerTagPorId(String ctag) { + String tagArma = null; + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_ARMA_TAG_ARMA); + query.setParameter("ctag", ctag); + List lTarmTagArmas = query.getResultList(); + if(lTarmTagArmas != null && !lTarmTagArmas.isEmpty()){ + tagArma = lTarmTagArmas.iterator().next().getPk().getCarma(); + } + return tagArma; + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/text-base/CatalogoUtil.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/text-base/CatalogoUtil.java.svn-base new file mode 100644 index 0000000..55dae4f --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/text-base/CatalogoUtil.java.svn-base @@ -0,0 +1,66 @@ +package com.fp.armas.rules.query.webservices.util; + +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; + +public class CatalogoUtil { + + private static CatalogoUtil INSTANCIA = new CatalogoUtil(); + + private CatalogoUtil(){} + + /** + * Retorna una instancia de la clase + * @return + */ + public static CatalogoUtil getInstancia() { + return INSTANCIA; + } + + /** + * Retorna la descripción del catálogo + * @param catalogo + * @param catalogocodigo + * @return + */ + public String getDescripcion(String catalogo, String catalogocodigo) { + String descripcion = null; + try { + if(catalogo != null && catalogocodigo != null){ + TgeneCatalogDetail tgeneCatalogDetail = TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(catalogo, catalogocodigo)); + if(tgeneCatalogDetail != null){ + descripcion = tgeneCatalogDetail.getDescription(); + } + } + } catch (CommondbException e) { + APPLogger.getLogger("WEBSERVICES").error(e.getMessage(), e); + } catch (Exception e) { + APPLogger.getLogger("WEBSERVICES").error(e.getMessage(), e); + } + return descripcion; + } + + /** + * Devuelve el legalcode del catálogo + * @param catalogo + * @param catalogocodigo + * @return + */ + public String getLegalCode(String catalogo, String catalogocodigo) { + String legalcode = null; + try { + if(catalogo != null && catalogocodigo != null){ + TgeneCatalogDetail tgeneCatalogDetail = TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(catalogo, catalogocodigo)); + if(tgeneCatalogDetail != null){ + legalcode = tgeneCatalogDetail.getLegalcode(); + } + } + } catch (Throwable e) { + APPLogger.getLogger("WEBSERVICES").error(e.getMessage(), e); + } + return legalcode; + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/text-base/ColaImpresionUtil.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/text-base/ColaImpresionUtil.java.svn-base new file mode 100644 index 0000000..9f1f2bc --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/text-base/ColaImpresionUtil.java.svn-base @@ -0,0 +1,288 @@ +package com.fp.armas.rules.query.webservices.util; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Query; + +import com.fp.common.helper.Constant; +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.parmas.dto.ws.ArmaDto; +import com.fp.persistence.parmas.dto.ws.ColaImpresionDto; +import com.fp.persistence.parmas.dto.ws.DocumentoDto; +import com.fp.persistence.parmas.dto.ws.PersonaDto; +import com.fp.persistence.parmas.inte.TarmColadeImpresion; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmaPruebas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; + +public class ColaImpresionUtil { + + public static final String QUERY_SOLICITUD_NUM = "SELECT o FROM TarmSolicitud o WHERE o.numerosolicitud=:numerosolicitud"; + private static ColaImpresionUtil INSTANCIA = new ColaImpresionUtil(); + + private ColaImpresionUtil(){} + + public static ColaImpresionUtil getInstancia() { + return INSTANCIA; + } + + /** + * Método en el que se completa la información que se va a exponer en el web service + * @param coladeImpresionList una lista de {@link TarmColadeImpresion} + * @param personcode código de la persona + * @param usercode código del usuario + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List completaColaImpresion(List coladeImpresionList, Integer personcode, String usercode) throws Exception{ + List lcolaImpresion = null; + if(coladeImpresionList != null && !coladeImpresionList.isEmpty()){ + lcolaImpresion = new ArrayList(); + for (TarmColadeImpresion tarmColadeImpresion : coladeImpresionList) { + ColaImpresionDto colaImpresion = new ColaImpresionDto(); + colaImpresion.setIdImpresion(tarmColadeImpresion.getPk()); + colaImpresion.setFechaImpresion(tarmColadeImpresion.getFechaimpresion()); + colaImpresion.setFechaRegistro(new Timestamp(tarmColadeImpresion.getFecharegistro().getTime())); + + TarmDocumentoHabilitante documento = TarmDocumentoHabilitante.find(PersistenceHelper.getEntityManager(), tarmColadeImpresion.getCdocumento()); + PersonaDto personaDto = PersonaUtil.getInstancia().obtenerPersonaPorId(documento.getPersoncode(), usercode); + colaImpresion.setPersona(personaDto); + colaImpresion.setDocumento(obtenerDocumentoId(tarmColadeImpresion.getCdocumento(), personaDto)); + + List pruebas=null; + List pruebasRealizadasAlArma=null; + if(colaImpresion.getDocumento()!=null && colaImpresion.getDocumento().getCarma()!=null){ + StringBuilder sql = new StringBuilder("select o from TarmArmaPruebas o where o.pk=(select max(p.pk) from TarmArmaPruebas p where p.carma='"+colaImpresion.getDocumento().getCarma()+"' and p.apruebaevaluacion='Y')"); + System.out.println("sql....."+sql); + pruebas=PersistenceHelper.getEntityManager().createQuery(sql.toString()).getResultList(); + // Se valida si existe alguna prueba de registro balistico para el arma + StringBuilder sql2 = new StringBuilder("select o from TarmArmaPruebas o where o.carma='"+colaImpresion.getDocumento().getCarma()+"'"); + pruebasRealizadasAlArma=PersistenceHelper.getEntityManager().createQuery(sql2.toString()).getResultList(); + } + + if(pruebas!=null && pruebas.size()>0){ + //ingresa el arma + ArmaDto arma=ArmaUtil.getInstancia().obtenerArmaId(colaImpresion.getDocumento().getCarma()); + colaImpresion.setArma(arma); + colaImpresion.setEsAutorizacion(verificaTipoTramite(colaImpresion.getDocumento().getNumeroSolicitud())); + lcolaImpresion.add(colaImpresion); + }else if(pruebas!=null && pruebas.size()==0 && pruebasRealizadasAlArma.isEmpty()){ + // Usado para los datos migrados que no fueron ingresados por solicitud y no tienen prueba de registro balistico + ArmaDto arma=ArmaUtil.getInstancia().obtenerArmaId(colaImpresion.getDocumento().getCarma()); + if(arma!=null && arma.getIdArma()!=null){ + colaImpresion.setArma(arma); + colaImpresion.setEsAutorizacion(verificaTipoTramite(colaImpresion.getDocumento().getNumeroSolicitud())); + lcolaImpresion.add(colaImpresion); + } + + }else if(colaImpresion.getDocumento().getCarma()==null || colaImpresion.getDocumento().getCarma().trim().length()==0){ + colaImpresion.setArma(null); + System.out.println("numsilicitud.1....."+colaImpresion.getDocumento().getNumeroSolicitud()); + colaImpresion.setEsAutorizacion(verificaTipoTramite(colaImpresion.getDocumento().getNumeroSolicitud())); + lcolaImpresion.add(colaImpresion); + } + } + } + return lcolaImpresion; + } + + /** + * Devuelve la cola de impresión con los datos completos + * @param coladeImpresionList + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List completaColaImpresion(List coladeImpresionList) throws Exception { + List lcolaImpresion = null; + if(coladeImpresionList != null && !coladeImpresionList.isEmpty()){ + lcolaImpresion = new ArrayList(); + for (TarmColadeImpresion tarmColadeImpresion : coladeImpresionList) { + TarmDocumentoHabilitante tarmDocumentoHabilitante = PersistenceHelper.getEntityManager().find(TarmDocumentoHabilitante.class, tarmColadeImpresion.getCdocumento()); + if(tarmDocumentoHabilitante != null){ + ColaImpresionDto colaImpresion = new ColaImpresionDto(); + colaImpresion.setIdImpresion(tarmColadeImpresion.getPk()); + colaImpresion.setFechaImpresion(tarmColadeImpresion.getFechaimpresion()); + colaImpresion.setFechaRegistro(new Timestamp(tarmColadeImpresion.getFecharegistro().getTime())); + PersonaDto personaDto = PersonaUtil.getInstancia().obtenerPersonaPorId(tarmDocumentoHabilitante.getPersoncode(), null); + colaImpresion.setPersona(personaDto); + colaImpresion.setDocumento(obtenerDocumentoId(tarmColadeImpresion.getCdocumento(), personaDto)); + + List pruebas=null; + List pruebasRealizadasAlArma=null; + if(colaImpresion.getDocumento()!=null && colaImpresion.getDocumento().getCarma()!=null){ + StringBuilder sql = new StringBuilder("select o from TarmArmaPruebas o where o.pk=(select max(p.pk) from TarmArmaPruebas p where p.carma='"+colaImpresion.getDocumento().getCarma()+"' and p.apruebaevaluacion='Y')"); +// System.out.println("sql....."+sql); + pruebas=PersistenceHelper.getEntityManager().createQuery(sql.toString()).getResultList(); + // Se valida si existe alguna prueba de registro balistico para el arma + StringBuilder sql2 = new StringBuilder("select o from TarmArmaPruebas o where o.carma='"+colaImpresion.getDocumento().getCarma()+"'"); + pruebasRealizadasAlArma=PersistenceHelper.getEntityManager().createQuery(sql2.toString()).getResultList(); + } + + if(pruebas!=null && pruebas.size()>0){ + colaImpresion.setArma(ArmaUtil.getInstancia().obtenerArmaId(colaImpresion.getDocumento().getCarma())); + colaImpresion.setEsAutorizacion(verificaTipoTramite(colaImpresion.getDocumento().getNumeroSolicitud())); + lcolaImpresion.add(colaImpresion); + }else if(pruebas!=null && pruebas.size()==0 && pruebasRealizadasAlArma.isEmpty()){ + // Usado para los datos migrados que no fueron ingresados por solicitud y no tienen prueba de registro balistico + ArmaDto arma=ArmaUtil.getInstancia().obtenerArmaId(colaImpresion.getDocumento().getCarma()); + if(arma!=null && arma.getIdArma()!=null){ + colaImpresion.setArma(arma); + colaImpresion.setEsAutorizacion(verificaTipoTramite(colaImpresion.getDocumento().getNumeroSolicitud())); + lcolaImpresion.add(colaImpresion); + } + + }else if(colaImpresion.getDocumento().getCarma()==null || colaImpresion.getDocumento().getCarma().trim().length()==0){ + colaImpresion.setArma(null); +// System.out.println("numsilicitud.2....."+colaImpresion.getDocumento().getNumeroSolicitud()); + colaImpresion.setEsAutorizacion(verificaTipoTramite(colaImpresion.getDocumento().getNumeroSolicitud())); + lcolaImpresion.add(colaImpresion); + } + } + } + } + return lcolaImpresion; + } + + /** + * Devuelve un documento en base al id enviado + * @param codigoDocumento + * @param personaDto + * @return DocumentoDto + */ + public DocumentoDto obtenerDocumentoId(Long codigoDocumento, PersonaDto personaDto){ + DocumentoDto documento = null; + TarmDocumentoHabilitante tarmDocumentoHabilitante = PersistenceHelper.getEntityManager().find(TarmDocumentoHabilitante.class, codigoDocumento); + if(tarmDocumentoHabilitante != null){ + documento = new DocumentoDto(); + documento.setCodigoDocumento(tarmDocumentoHabilitante.getPk()); + documento.setFechaEmision(tarmDocumentoHabilitante.getFechaemision()); + documento.setFechaExpiracion(tarmDocumentoHabilitante.getFechaexpiracion()); + documento.setNumeroDocumento(tarmDocumentoHabilitante.getNumerodocumento()); + if(tarmDocumentoHabilitante.getCsolicitud()!=null){ + procesaDatosTramite(documento, tarmDocumentoHabilitante.getCsolicitud()); + } + else{ + String querySolicitud = "select max(csolicitud) from tarmsolicituddocumento where cdocumento = '"+codigoDocumento.toString()+"'"; + String codigosolicitud = PersistenceHelper.getEntityManager().createNativeQuery(querySolicitud).getSingleResult().toString(); + if(codigosolicitud!=null){ + procesaDatosTramite(documento, codigosolicitud); + } + } + documento.setCarma(tarmDocumentoHabilitante.getCarma()); + if(tarmDocumentoHabilitante.getCtramite() != null){//buscamos datos del tramite + try { + TarmTramite tarmTramite = TarmTramite.find(PersistenceHelper.getEntityManager(), tarmDocumentoHabilitante.getCtramite()); + if(tarmTramite != null){ + documento.setTipoTramite(CatalogoUtil.getInstancia().getDescripcion(tarmTramite.getTipotramite(), tarmTramite.getTipotramitecodigo())); + documento.setTramite(CatalogoUtil.getInstancia().getDescripcion(tarmTramite.getTipoautorizacion(), tarmTramite.getTipoautorizacioncodigo())); + documento.setCategoria(CatalogoUtil.getInstancia().getDescripcion(tarmTramite.getCategoria(), tarmTramite.getCategoriacodigo())); + documento.setUsoActividad(CatalogoUtil.getInstancia().getDescripcion(tarmTramite.getUsoactividad(), tarmTramite.getUsoactividadcodigo())); + documento.setEsFechaExpiracion(tarmTramite.getValidaFechaExpiracion()); + documento.setDescripcion(tarmTramite.getVisualizarPorFechaExpiracion()); + documento.setDescripcion1(buscarJuri(CatalogoUtil.getInstancia().getDescripcion(tarmTramite.getJurisdiccion(), tarmTramite.getJurisdiccioncode()), personaDto)); + + documento.setDescripcion2(tarmTramite.getPie()); + } + } catch (CommondbException e) { + } catch (Exception e) { + } + } + } + return documento; + } + + /** + * Devuelve la jurisdiccion con el valor de la misma, sea direccion con la + * respectiva direccion de la persona que le emiten el carnet. + * + * @param descripcion + * @param personaDto + * @return String + */ + private String buscarJuri(String descripcion, PersonaDto personaDto) { + StringBuilder srtDescrip = new StringBuilder(); + srtDescrip.append(descripcion); + if (!descripcion.equals("ECUADOR")) { + srtDescrip.append(": "); + if (descripcion.equals("PROVINCIA")) { + srtDescrip.append(personaDto.getProvincia()); + } else if (descripcion.equals("CANTN")) { + srtDescrip.append(personaDto.getCanton()); + } else if (descripcion.equals("PARROQUIA")) { + srtDescrip.append(personaDto.getParroquia()); + } else if (descripcion.equals("DIRECCIN")) { + srtDescrip.append(personaDto.getDireccion()); + } + } + + return srtDescrip.toString(); + } + +// public String getNumeroSolicitud(String csolicitud) { +// String numerosolicitud = null; +// TarmSolicitud tarmSolicitud; +// try { +// tarmSolicitud = TarmSolicitud.find(PersistenceHelper.getEntityManager(), csolicitud); +// if(tarmSolicitud != null){ +// numerosolicitud = tarmSolicitud.getNumerosolicitud(); +// } +// } catch (Exception e) { +// APPLogger.getLogger().error(e.getMessage(), e); +// } +// +// return numerosolicitud; +// } + + /** + * Verifica si es o no autorización + * @param numerosolicitud + * @return + * @throws Exception + * @throws CommondbException + */ + @SuppressWarnings("unchecked") + public String verificaTipoTramite(String numerosolicitud) throws CommondbException, Exception { + String tipoTramite = null; + if(numerosolicitud != null){ + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_SOLICITUD_NUM); + query.setParameter("numerosolicitud", numerosolicitud); + List ltarmSolicitud = query.getResultList(); + if(ltarmSolicitud != null && !ltarmSolicitud.isEmpty()){ + TarmSolicitud tarmSolicitud = ltarmSolicitud.iterator().next(); + TarmTramite tarmTramite = TarmTramite.find(PersistenceHelper.getEntityManager(), tarmSolicitud.getCtramite()); + if(tarmTramite.getTipoautorizacion().equals("1") && tarmTramite.getTipoautorizacioncodigo().equals("TIPOAUTORIZACION")){ + tipoTramite = Constant.STR_Y; + } else if(tarmTramite.getTipoautorizacion().equals("6") && tarmTramite.getTipoautorizacioncodigo().equals("TIPOAUTORIZACION")){ + tipoTramite = Constant.STR_N; + } + } + } + return tipoTramite; + } + + /** + * Procesa datos del trámite y completa la información + * @param documento + * @param csolicitud + */ + private void procesaDatosTramite(DocumentoDto documento, String csolicitud){ + TarmSolicitud tarmSolicitud; + try { + tarmSolicitud = TarmSolicitud.find(PersistenceHelper.getEntityManager(), csolicitud); + if(tarmSolicitud != null){ + documento.setNumeroSolicitud(tarmSolicitud.getNumerosolicitud()); + documento.setEstadoTramite(CatalogoUtil.getInstancia().getDescripcion(tarmSolicitud.getEstado(), tarmSolicitud.getEstadocodigo())); + } + } catch (Exception e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/text-base/InstitucionSnapEnum.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/text-base/InstitucionSnapEnum.java.svn-base new file mode 100644 index 0000000..bc0803f --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/text-base/InstitucionSnapEnum.java.svn-base @@ -0,0 +1,32 @@ +package com.fp.armas.rules.query.webservices.util; + +/** + * Enum con los codigos de la institucion consumidoras del WS que expone informacion de las armas + * @author user + * + */ +public enum InstitucionSnapEnum { + + CRIMINALISTICA("CRIMINALISTICA"), + MINISTERIO_MINAS("MINERIA"), + COPS("COPS"), + FISCALIA_GENERAL("FGE"); + + private String nombre; + + private InstitucionSnapEnum(String nombre) { + this.nombre = nombre; + } + + /** + * @return the nombre + */ + public String getNombre() { + return nombre; + } + + @Override + public String toString() { + return this.nombre; + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/text-base/PersonaUtil.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/text-base/PersonaUtil.java.svn-base new file mode 100644 index 0000000..013cf21 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/.svn/text-base/PersonaUtil.java.svn-base @@ -0,0 +1,235 @@ +package com.fp.armas.rules.query.webservices.util; + +import java.util.List; + +import javax.persistence.Query; + +import com.fp.common.helper.Constant; +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.dto.ws.ImagenDto; +import com.fp.persistence.parmas.dto.ws.PersonaDto; +import com.fp.persistence.pcustomer.company.TcustCompany; +import com.fp.persistence.pcustomer.company.TcustCompanyKey; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.people.TcustPeople; +import com.fp.persistence.pcustomer.people.TcustPeopleKey; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.image.TgeneFilesDetailKey; + +/** + * Clase utilitaria que colocará los datos de la persona + * @author dcruz + * + */ +public class PersonaUtil { + /** + * Consulta propia de la persona + */ + private static final String QUERY_PERSONA = "SELECT o FROM TcustPersonDetail o WHERE o.pk.personcode=:personcode AND o.pk.dateto=:dateto"; + private static final String QUERY_DIRECCION_PRINCIPAL="SELECT o FROM TcustPersonAddress o WHERE o.pk.personcode=:personcode AND o.pk.dateto=:dateto AND o.principal=:principal"; + private static final String QUERY_PROVINCIA = "SELECT o.description FROM TgeneProvince o WHERE o.pk.countrycode=:countrycode AND o.pk.provincecode=:provincecode"; + private static final String QUERY_CANTON = "SELECT o.description FROM TgeneCanton o WHERE o.pk.countrycode=:countrycode AND o.pk.provincecode=:provincecode AND o.pk.cantoncode=:cantoncode"; + private static final String QUERY_PARROQUIA = "SELECT o.description FROM TgeneParroquia o WHERE o.pk.countrycode=:countrycode AND o.pk.provincecode=:provincecode AND o.pk.cantoncode=:cantoncode AND o.pk.parroquiacode=:parroquiacode"; + private static final String QUERY_TELEFONO = "SELECT o.phonenumber FROM TcustPersonPhone o WHERE o.pk.personcode=:personcode AND o.addressnumber=:addressnumber"; + private static PersonaUtil INSTANCIA = new PersonaUtil(); + + private PersonaUtil(){} + + public static PersonaUtil getInstancia() { + return INSTANCIA; + } + + /** + * Obtiene todos los datos de la persona a enviar en a través del web service + * @param personCode + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public PersonaDto obtenerPersonaPorId(Integer personcode, String usercode) throws Exception{ + PersonaDto persona = null; + if(personcode == null){ + return persona; + } + TcustPersonDetail tcustPersonDetail = null; + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_PERSONA); + query.setParameter("personcode", personcode); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List lpersonDetail = query.getResultList(); + if(lpersonDetail != null && !lpersonDetail.isEmpty()){ + persona = new PersonaDto(); + tcustPersonDetail = lpersonDetail.get(0); + persona.setCodigoPersona(tcustPersonDetail.getPk().getPersoncode()); + persona.setCodigoUsuario(usercode); + persona.setTipoIdentificacion(tcustPersonDetail.getIdentificationcatalog()); + persona.setIdentificacion(tcustPersonDetail.getIdentification()); + persona.setNombre(tcustPersonDetail.getName()); + persona.setRepresentanteLegal(tcustPersonDetail.getLegalrepresent()); + //Obtenemos la direccion principal de la persona + TcustPersonAddress tcustPersonAddress = obtieneDireccionPrincipal(personcode); + persona.setDireccion(tcustPersonAddress.getAddress()); + persona.setProvincia(obtenerProvincia(tcustPersonAddress.getProvincecode())); + persona.setCanton(obtenerCanton(tcustPersonAddress.getProvincecode(), tcustPersonAddress.getCantoncode())); + persona.setParroquia(obtenerParroquia(tcustPersonAddress.getProvincecode(), tcustPersonAddress.getCantoncode(), tcustPersonAddress.getParroquiacode())); + persona.setTelefono(obtenerNumeroTelefono(tcustPersonAddress.getPk().getPersoncode(), tcustPersonAddress.getPk().getAddressnumber())); + if(tcustPersonDetail.getMilitarygrade() != null && tcustPersonDetail.getMilitarygradecode() != null){ + persona.setGrado(CatalogoUtil.getInstancia().getLegalCode(tcustPersonDetail.getMilitarygrade(), tcustPersonDetail.getMilitarygradecode())); + } + } + return persona; + } + + /** + * Obtiene la dirección principal de la persona + * @param personcode + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public TcustPersonAddress obtieneDireccionPrincipal(Integer personcode) throws Exception { + TcustPersonAddress tcustPersonAddress = null; + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_DIRECCION_PRINCIPAL); + query.setParameter("personcode", personcode); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + query.setParameter("principal", Constant.STR_Y); + List ltcustPersonAddresses = query.getResultList(); + if(ltcustPersonAddresses != null && !ltcustPersonAddresses.isEmpty()){ + tcustPersonAddress = ltcustPersonAddresses.iterator().next(); + } + return tcustPersonAddress; + } + + /** + * Obtiene la descripción de la provincia + * @param provincecode + * @return + */ + @SuppressWarnings("unchecked") + public String obtenerProvincia(String provincecode) { + String provincia = null; + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_PROVINCIA); + query.setParameter("countrycode", "EC"); + query.setParameter("provincecode", provincecode); + List lprovincias = query.getResultList(); + if(lprovincias != null && !lprovincias.isEmpty()){ + provincia = lprovincias.iterator().next(); + } + return provincia; + } + + /** + * Obtiene la descripción del cantón + * @param provincecode + * @param cantoncode + * @return + */ + @SuppressWarnings("unchecked") + public String obtenerCanton(String provincecode, String cantoncode) { + String canton = null; + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_CANTON); + query.setParameter("countrycode", "EC"); + query.setParameter("provincecode", provincecode); + query.setParameter("cantoncode", cantoncode); + List lcanton = query.getResultList(); + if(lcanton != null && !lcanton.isEmpty()){ + canton = lcanton.iterator().next(); + } + return canton; + } + + /** + * Obtiene la descrición de la parroquia + * @param provincecode + * @param cantoncode + * @param parroquiacode + * @return + */ + @SuppressWarnings("unchecked") + public String obtenerParroquia(String provincecode, String cantoncode, String parroquiacode) { + String parroquia = null; + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_PARROQUIA); + query.setParameter("countrycode", "EC"); + query.setParameter("provincecode", provincecode); + query.setParameter("cantoncode", cantoncode); + query.setParameter("parroquiacode", parroquiacode); + List lparroquia = query.getResultList(); + if(lparroquia != null && !lparroquia.isEmpty()){ + parroquia = lparroquia.iterator().next(); + } + return parroquia; + } + + /** + * Obtiene el teléfono segun la dirección asociada + * @param personcode + * @param addressnumber + * @return + */ + @SuppressWarnings("unchecked") + public String obtenerNumeroTelefono(Integer personcode, Integer addressnumber) { + String telefono = null; + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_TELEFONO); + query.setParameter("personcode", personcode); + query.setParameter("addressnumber", addressnumber); + List ltelefono = query.getResultList(); + if(ltelefono != null && !ltelefono.isEmpty()){ + telefono = ltelefono.iterator().next(); + } + return telefono; + } + + /** + * Retorna la localización de donde se encuentra la persona + * @param personcode + * @return + */ + public String obtenerLocacionPersona(Integer personcode) { + StringBuffer sb = new StringBuffer(); + try { + TcustPersonAddress tcustPersonAddress = obtieneDireccionPrincipal(personcode); + sb.append(tcustPersonAddress.getProvincecode()).append(",").append(obtenerProvincia(tcustPersonAddress.getProvincecode())).append("/"); + sb.append(tcustPersonAddress.getCantoncode()).append(",").append(obtenerCanton(tcustPersonAddress.getProvincecode(), tcustPersonAddress.getCantoncode())).append("/"); + sb.append(tcustPersonAddress.getParroquiacode()).append(",").append(obtenerParroquia(tcustPersonAddress.getProvincecode(), tcustPersonAddress.getCantoncode(), tcustPersonAddress.getParroquiacode())); + } catch (CommondbException e) { + } catch (Exception e) { + } + return sb.toString(); + } + + /** + * Retorna la foto o el logo de la persona si es que esta existe + * @param personcode + * @return + */ + public ImagenDto obtenerImagen(Integer personcode) { + System.out.println("ImagenDto obtenerImagen......-----------"+personcode); + ImagenDto imagenDto = null; + TgeneFilesDetail tgeneFilesDetail = null; + try { + TcustCompany tcustCompany = TcustCompany.find(PersistenceHelper.getEntityManager(), new TcustCompanyKey(personcode, FormatDates.getDefaultExpiryTimestamp())); + if(tcustCompany != null){ + tgeneFilesDetail = TgeneFilesDetail.find(PersistenceHelper.getEntityManager(), new TgeneFilesDetailKey(tcustCompany.getLogo(), FormatDates.getDefaultExpiryTimestamp())); + } else{ + TcustPeople tcustPeople = TcustPeople.find(PersistenceHelper.getEntityManager(), new TcustPeopleKey(personcode, FormatDates.getDefaultExpiryTimestamp())); + if(tcustPeople != null){ + tgeneFilesDetail = TgeneFilesDetail.find(PersistenceHelper.getEntityManager(), new TgeneFilesDetailKey(tcustPeople.getPhotocode(), FormatDates.getDefaultExpiryTimestamp())); + } + } + if(tgeneFilesDetail != null){ + imagenDto = new ImagenDto(); + imagenDto.setCodigoImagen(tgeneFilesDetail.getPk().getCode()); + imagenDto.setExtension(tgeneFilesDetail.getExtension()); + imagenDto.setImagen(tgeneFilesDetail.getImage()); + imagenDto.setTamanioImagen(tgeneFilesDetail.getImagesize()); + imagenDto.setTipoContenido(tgeneFilesDetail.getContenttype()); + } + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + return imagenDto; + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/ArmaUtil.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/ArmaUtil.java new file mode 100644 index 0000000..f67bdc2 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/ArmaUtil.java @@ -0,0 +1,162 @@ +package com.fp.armas.rules.query.webservices.util; + +import java.util.List; + +import javax.persistence.Query; + +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.dto.ws.ArmaDto; +import com.fp.persistence.parmas.inte.TarmTagArma; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; + +/** + * Clase de funcionalidades que trabajan con {@link ArmaDto} + * @author dcruz + * + */ +public class ArmaUtil { + + private static ArmaUtil INSTANCIA = new ArmaUtil(); + private static final String QUERY_ARMA_TAG = "SELECT o FROM TarmTagArma o WHERE o.pk.carma=:carma"; + private static final String QUERY_ARMA_TAG_ARMA = "SELECT o FROM TarmTagArma o WHERE o.pk.ctag=:ctag"; + + private ArmaUtil(){} + + public static ArmaUtil getInstancia() { + return INSTANCIA; + } + + public ArmaDto obtenerArmaId(String carma) { + ArmaDto arma = null; + try { + TarmArmas tarmArmas = PersistenceHelper.getEntityManager().find(TarmArmas.class, carma); + if(tarmArmas != null){ + arma = new ArmaDto(); + arma.setIdArma(tarmArmas.getPk()); + arma.setCantidad(tarmArmas.getCantidad()); + arma.setSerie(tarmArmas.getLote()); + if(tarmArmas.getMarca()!=null && tarmArmas.getMarcacodigo()!=null){ + TgeneCatalogDetail marca=TgeneCatalogDetail. + find(PersistenceHelper.getEntityManager(),new TgeneCatalogDetailKey(tarmArmas.getMarca(), tarmArmas.getMarcacodigo())); + if(marca!=null){ + arma.setMarca(marca.getDescription()); + } + } + + arma.setModelo(tarmArmas.getModelo()); + TgeneCatalogDetail estado; + + estado = TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tarmArmas.getEstado() != null ? tarmArmas.getEstado() : "", tarmArmas.getEstadocodigo() != null ? tarmArmas.getEstadocodigo() : "")); + arma.setEstado(estado != null ? estado.getDescription() : ""); + arma.setTagAsociado(obtenerTag(arma.getIdArma())); + TarmTipoArmaExplosivo tipoArmaExplosivo = TarmTipoArmaExplosivo.find(PersistenceHelper.getEntityManager(), tarmArmas.getCtipoarmaexplosivo()); + if(tipoArmaExplosivo != null){ + TgeneCatalogDetail clase= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getClase() != null ? tipoArmaExplosivo.getClase() : "", tipoArmaExplosivo.getClasecodigo() != null ? tipoArmaExplosivo.getClasecodigo() : "")); + arma.setClase(clase != null ? clase.getDescription():null); + TgeneCatalogDetail tipoArma= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getTipoarmaexplosivo() != null ? tipoArmaExplosivo.getTipoarmaexplosivo() : "", tipoArmaExplosivo.getTipoarmaexplosivocodigo() != null ? tipoArmaExplosivo.getTipoarmaexplosivocodigo() : "")); + arma.setTipo(tipoArma != null ? tipoArma.getDescription():null); + TgeneCatalogDetail unidadMedida= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getUnidadmedidapeso() != null ? tipoArmaExplosivo.getUnidadmedidapeso():"", tipoArmaExplosivo.getUnidadmedidapesocodigo() != null ? tipoArmaExplosivo.getUnidadmedidapesocodigo() : "")); + arma.setUnidadMedidaPeso(unidadMedida != null ? unidadMedida.getDescription():null); + TgeneCatalogDetail calibre= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getCalibre() != null ? tipoArmaExplosivo.getCalibre() : "", tipoArmaExplosivo.getCalibrecodigo() != null ? tipoArmaExplosivo.getCalibrecodigo() : "")); + arma.setCalibre(calibre != null ? calibre.getDescription() : null); + TgeneCatalogDetail longitud= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getLongitud() != null ? tipoArmaExplosivo.getLongitud() : "", tipoArmaExplosivo.getLongitudcodigo() != null ? tipoArmaExplosivo.getLongitudcodigo() : "")); + arma.setLongitud(longitud != null ? longitud.getDescription() : null); + } + return arma; + } + } catch (Exception e) { + APPLogger.getLogger().error(e); + } + return null; + } + /** + * Obtiene el ArmaDto por el codigo del tag + * @param ctag codigo del tag + * @return ArmaDto + */ + public ArmaDto obtenerArmaIdPorTag(String ctag) { + ArmaDto arma = null; + try { + String carma = obtenerTagPorId(ctag); + if(carma!=null && !carma.isEmpty()){ + TarmArmas tarmArmas = PersistenceHelper.getEntityManager().find(TarmArmas.class, carma); + if(tarmArmas != null){ + arma = new ArmaDto(); + arma.setIdArma(tarmArmas.getPk()); + arma.setCantidad(tarmArmas.getCantidad()); + arma.setSerie(tarmArmas.getLote()); + if(tarmArmas.getMarca()!=null && tarmArmas.getMarcacodigo()!=null){ + TgeneCatalogDetail marca=TgeneCatalogDetail. + find(PersistenceHelper.getEntityManager(),new TgeneCatalogDetailKey(tarmArmas.getMarca(), tarmArmas.getMarcacodigo())); + if(marca!=null){ + arma.setMarca(marca.getDescription()); + } + } + + arma.setModelo(tarmArmas.getModelo()); + TgeneCatalogDetail estado; + + estado = TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tarmArmas.getEstado() != null ? tarmArmas.getEstado() : "", tarmArmas.getEstadocodigo() != null ? tarmArmas.getEstadocodigo() : "")); + arma.setEstado(estado != null ? estado.getDescription() : ""); + arma.setTagAsociado(ctag); + TarmTipoArmaExplosivo tipoArmaExplosivo = TarmTipoArmaExplosivo.find(PersistenceHelper.getEntityManager(), tarmArmas.getCtipoarmaexplosivo()); + if(tipoArmaExplosivo != null){ + TgeneCatalogDetail clase= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getClase() != null ? tipoArmaExplosivo.getClase() : "", tipoArmaExplosivo.getClasecodigo() != null ? tipoArmaExplosivo.getClasecodigo() : "")); + arma.setClase(clase != null ? clase.getDescription():null); + TgeneCatalogDetail tipoArma= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getTipoarmaexplosivo() != null ? tipoArmaExplosivo.getTipoarmaexplosivo() : "", tipoArmaExplosivo.getTipoarmaexplosivocodigo() != null ? tipoArmaExplosivo.getTipoarmaexplosivocodigo() : "")); + arma.setTipo(tipoArma != null ? tipoArma.getDescription():null); + TgeneCatalogDetail unidadMedida= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getUnidadmedidapeso() != null ? tipoArmaExplosivo.getUnidadmedidapeso():"", tipoArmaExplosivo.getUnidadmedidapesocodigo() != null ? tipoArmaExplosivo.getUnidadmedidapesocodigo() : "")); + arma.setUnidadMedidaPeso(unidadMedida != null ? unidadMedida.getDescription():null); + TgeneCatalogDetail calibre= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getCalibre() != null ? tipoArmaExplosivo.getCalibre() : "", tipoArmaExplosivo.getCalibrecodigo() != null ? tipoArmaExplosivo.getCalibrecodigo() : "")); + arma.setCalibre(calibre != null ? calibre.getDescription() : null); + TgeneCatalogDetail longitud= TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(tipoArmaExplosivo.getLongitud() != null ? tipoArmaExplosivo.getLongitud() : "", tipoArmaExplosivo.getLongitudcodigo() != null ? tipoArmaExplosivo.getLongitudcodigo() : "")); + arma.setLongitud(longitud != null ? longitud.getDescription() : null); + } + return arma; + } + } + + } catch (Exception e) { + APPLogger.getLogger().error(e); + } + return null; + } + + /** + * Retorna el tag del arma asociado + * @param carma + * @return + */ + @SuppressWarnings("unchecked") + public String obtenerTag(String carma) { + String tagArma = null; + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_ARMA_TAG); + query.setParameter("carma", carma); + List lTarmTagArmas = query.getResultList(); + if(lTarmTagArmas != null && !lTarmTagArmas.isEmpty()){ + tagArma = lTarmTagArmas.iterator().next().getPk().getCtag(); + } + return tagArma; + } + + /** + * Retorna el carma asociado al tag + * @param ctag + * @return + */ + @SuppressWarnings("unchecked") + public String obtenerTagPorId(String ctag) { + String tagArma = null; + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_ARMA_TAG_ARMA); + query.setParameter("ctag", ctag); + List lTarmTagArmas = query.getResultList(); + if(lTarmTagArmas != null && !lTarmTagArmas.isEmpty()){ + tagArma = lTarmTagArmas.iterator().next().getPk().getCarma(); + } + return tagArma; + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/CatalogoUtil.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/CatalogoUtil.java new file mode 100644 index 0000000..55dae4f --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/CatalogoUtil.java @@ -0,0 +1,66 @@ +package com.fp.armas.rules.query.webservices.util; + +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; + +public class CatalogoUtil { + + private static CatalogoUtil INSTANCIA = new CatalogoUtil(); + + private CatalogoUtil(){} + + /** + * Retorna una instancia de la clase + * @return + */ + public static CatalogoUtil getInstancia() { + return INSTANCIA; + } + + /** + * Retorna la descripción del catálogo + * @param catalogo + * @param catalogocodigo + * @return + */ + public String getDescripcion(String catalogo, String catalogocodigo) { + String descripcion = null; + try { + if(catalogo != null && catalogocodigo != null){ + TgeneCatalogDetail tgeneCatalogDetail = TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(catalogo, catalogocodigo)); + if(tgeneCatalogDetail != null){ + descripcion = tgeneCatalogDetail.getDescription(); + } + } + } catch (CommondbException e) { + APPLogger.getLogger("WEBSERVICES").error(e.getMessage(), e); + } catch (Exception e) { + APPLogger.getLogger("WEBSERVICES").error(e.getMessage(), e); + } + return descripcion; + } + + /** + * Devuelve el legalcode del catálogo + * @param catalogo + * @param catalogocodigo + * @return + */ + public String getLegalCode(String catalogo, String catalogocodigo) { + String legalcode = null; + try { + if(catalogo != null && catalogocodigo != null){ + TgeneCatalogDetail tgeneCatalogDetail = TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), new TgeneCatalogDetailKey(catalogo, catalogocodigo)); + if(tgeneCatalogDetail != null){ + legalcode = tgeneCatalogDetail.getLegalcode(); + } + } + } catch (Throwable e) { + APPLogger.getLogger("WEBSERVICES").error(e.getMessage(), e); + } + return legalcode; + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/ColaImpresionUtil.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/ColaImpresionUtil.java new file mode 100644 index 0000000..9f1f2bc --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/ColaImpresionUtil.java @@ -0,0 +1,288 @@ +package com.fp.armas.rules.query.webservices.util; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Query; + +import com.fp.common.helper.Constant; +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.parmas.dto.ws.ArmaDto; +import com.fp.persistence.parmas.dto.ws.ColaImpresionDto; +import com.fp.persistence.parmas.dto.ws.DocumentoDto; +import com.fp.persistence.parmas.dto.ws.PersonaDto; +import com.fp.persistence.parmas.inte.TarmColadeImpresion; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmaPruebas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; + +public class ColaImpresionUtil { + + public static final String QUERY_SOLICITUD_NUM = "SELECT o FROM TarmSolicitud o WHERE o.numerosolicitud=:numerosolicitud"; + private static ColaImpresionUtil INSTANCIA = new ColaImpresionUtil(); + + private ColaImpresionUtil(){} + + public static ColaImpresionUtil getInstancia() { + return INSTANCIA; + } + + /** + * Método en el que se completa la información que se va a exponer en el web service + * @param coladeImpresionList una lista de {@link TarmColadeImpresion} + * @param personcode código de la persona + * @param usercode código del usuario + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List completaColaImpresion(List coladeImpresionList, Integer personcode, String usercode) throws Exception{ + List lcolaImpresion = null; + if(coladeImpresionList != null && !coladeImpresionList.isEmpty()){ + lcolaImpresion = new ArrayList(); + for (TarmColadeImpresion tarmColadeImpresion : coladeImpresionList) { + ColaImpresionDto colaImpresion = new ColaImpresionDto(); + colaImpresion.setIdImpresion(tarmColadeImpresion.getPk()); + colaImpresion.setFechaImpresion(tarmColadeImpresion.getFechaimpresion()); + colaImpresion.setFechaRegistro(new Timestamp(tarmColadeImpresion.getFecharegistro().getTime())); + + TarmDocumentoHabilitante documento = TarmDocumentoHabilitante.find(PersistenceHelper.getEntityManager(), tarmColadeImpresion.getCdocumento()); + PersonaDto personaDto = PersonaUtil.getInstancia().obtenerPersonaPorId(documento.getPersoncode(), usercode); + colaImpresion.setPersona(personaDto); + colaImpresion.setDocumento(obtenerDocumentoId(tarmColadeImpresion.getCdocumento(), personaDto)); + + List pruebas=null; + List pruebasRealizadasAlArma=null; + if(colaImpresion.getDocumento()!=null && colaImpresion.getDocumento().getCarma()!=null){ + StringBuilder sql = new StringBuilder("select o from TarmArmaPruebas o where o.pk=(select max(p.pk) from TarmArmaPruebas p where p.carma='"+colaImpresion.getDocumento().getCarma()+"' and p.apruebaevaluacion='Y')"); + System.out.println("sql....."+sql); + pruebas=PersistenceHelper.getEntityManager().createQuery(sql.toString()).getResultList(); + // Se valida si existe alguna prueba de registro balistico para el arma + StringBuilder sql2 = new StringBuilder("select o from TarmArmaPruebas o where o.carma='"+colaImpresion.getDocumento().getCarma()+"'"); + pruebasRealizadasAlArma=PersistenceHelper.getEntityManager().createQuery(sql2.toString()).getResultList(); + } + + if(pruebas!=null && pruebas.size()>0){ + //ingresa el arma + ArmaDto arma=ArmaUtil.getInstancia().obtenerArmaId(colaImpresion.getDocumento().getCarma()); + colaImpresion.setArma(arma); + colaImpresion.setEsAutorizacion(verificaTipoTramite(colaImpresion.getDocumento().getNumeroSolicitud())); + lcolaImpresion.add(colaImpresion); + }else if(pruebas!=null && pruebas.size()==0 && pruebasRealizadasAlArma.isEmpty()){ + // Usado para los datos migrados que no fueron ingresados por solicitud y no tienen prueba de registro balistico + ArmaDto arma=ArmaUtil.getInstancia().obtenerArmaId(colaImpresion.getDocumento().getCarma()); + if(arma!=null && arma.getIdArma()!=null){ + colaImpresion.setArma(arma); + colaImpresion.setEsAutorizacion(verificaTipoTramite(colaImpresion.getDocumento().getNumeroSolicitud())); + lcolaImpresion.add(colaImpresion); + } + + }else if(colaImpresion.getDocumento().getCarma()==null || colaImpresion.getDocumento().getCarma().trim().length()==0){ + colaImpresion.setArma(null); + System.out.println("numsilicitud.1....."+colaImpresion.getDocumento().getNumeroSolicitud()); + colaImpresion.setEsAutorizacion(verificaTipoTramite(colaImpresion.getDocumento().getNumeroSolicitud())); + lcolaImpresion.add(colaImpresion); + } + } + } + return lcolaImpresion; + } + + /** + * Devuelve la cola de impresión con los datos completos + * @param coladeImpresionList + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List completaColaImpresion(List coladeImpresionList) throws Exception { + List lcolaImpresion = null; + if(coladeImpresionList != null && !coladeImpresionList.isEmpty()){ + lcolaImpresion = new ArrayList(); + for (TarmColadeImpresion tarmColadeImpresion : coladeImpresionList) { + TarmDocumentoHabilitante tarmDocumentoHabilitante = PersistenceHelper.getEntityManager().find(TarmDocumentoHabilitante.class, tarmColadeImpresion.getCdocumento()); + if(tarmDocumentoHabilitante != null){ + ColaImpresionDto colaImpresion = new ColaImpresionDto(); + colaImpresion.setIdImpresion(tarmColadeImpresion.getPk()); + colaImpresion.setFechaImpresion(tarmColadeImpresion.getFechaimpresion()); + colaImpresion.setFechaRegistro(new Timestamp(tarmColadeImpresion.getFecharegistro().getTime())); + PersonaDto personaDto = PersonaUtil.getInstancia().obtenerPersonaPorId(tarmDocumentoHabilitante.getPersoncode(), null); + colaImpresion.setPersona(personaDto); + colaImpresion.setDocumento(obtenerDocumentoId(tarmColadeImpresion.getCdocumento(), personaDto)); + + List pruebas=null; + List pruebasRealizadasAlArma=null; + if(colaImpresion.getDocumento()!=null && colaImpresion.getDocumento().getCarma()!=null){ + StringBuilder sql = new StringBuilder("select o from TarmArmaPruebas o where o.pk=(select max(p.pk) from TarmArmaPruebas p where p.carma='"+colaImpresion.getDocumento().getCarma()+"' and p.apruebaevaluacion='Y')"); +// System.out.println("sql....."+sql); + pruebas=PersistenceHelper.getEntityManager().createQuery(sql.toString()).getResultList(); + // Se valida si existe alguna prueba de registro balistico para el arma + StringBuilder sql2 = new StringBuilder("select o from TarmArmaPruebas o where o.carma='"+colaImpresion.getDocumento().getCarma()+"'"); + pruebasRealizadasAlArma=PersistenceHelper.getEntityManager().createQuery(sql2.toString()).getResultList(); + } + + if(pruebas!=null && pruebas.size()>0){ + colaImpresion.setArma(ArmaUtil.getInstancia().obtenerArmaId(colaImpresion.getDocumento().getCarma())); + colaImpresion.setEsAutorizacion(verificaTipoTramite(colaImpresion.getDocumento().getNumeroSolicitud())); + lcolaImpresion.add(colaImpresion); + }else if(pruebas!=null && pruebas.size()==0 && pruebasRealizadasAlArma.isEmpty()){ + // Usado para los datos migrados que no fueron ingresados por solicitud y no tienen prueba de registro balistico + ArmaDto arma=ArmaUtil.getInstancia().obtenerArmaId(colaImpresion.getDocumento().getCarma()); + if(arma!=null && arma.getIdArma()!=null){ + colaImpresion.setArma(arma); + colaImpresion.setEsAutorizacion(verificaTipoTramite(colaImpresion.getDocumento().getNumeroSolicitud())); + lcolaImpresion.add(colaImpresion); + } + + }else if(colaImpresion.getDocumento().getCarma()==null || colaImpresion.getDocumento().getCarma().trim().length()==0){ + colaImpresion.setArma(null); +// System.out.println("numsilicitud.2....."+colaImpresion.getDocumento().getNumeroSolicitud()); + colaImpresion.setEsAutorizacion(verificaTipoTramite(colaImpresion.getDocumento().getNumeroSolicitud())); + lcolaImpresion.add(colaImpresion); + } + } + } + } + return lcolaImpresion; + } + + /** + * Devuelve un documento en base al id enviado + * @param codigoDocumento + * @param personaDto + * @return DocumentoDto + */ + public DocumentoDto obtenerDocumentoId(Long codigoDocumento, PersonaDto personaDto){ + DocumentoDto documento = null; + TarmDocumentoHabilitante tarmDocumentoHabilitante = PersistenceHelper.getEntityManager().find(TarmDocumentoHabilitante.class, codigoDocumento); + if(tarmDocumentoHabilitante != null){ + documento = new DocumentoDto(); + documento.setCodigoDocumento(tarmDocumentoHabilitante.getPk()); + documento.setFechaEmision(tarmDocumentoHabilitante.getFechaemision()); + documento.setFechaExpiracion(tarmDocumentoHabilitante.getFechaexpiracion()); + documento.setNumeroDocumento(tarmDocumentoHabilitante.getNumerodocumento()); + if(tarmDocumentoHabilitante.getCsolicitud()!=null){ + procesaDatosTramite(documento, tarmDocumentoHabilitante.getCsolicitud()); + } + else{ + String querySolicitud = "select max(csolicitud) from tarmsolicituddocumento where cdocumento = '"+codigoDocumento.toString()+"'"; + String codigosolicitud = PersistenceHelper.getEntityManager().createNativeQuery(querySolicitud).getSingleResult().toString(); + if(codigosolicitud!=null){ + procesaDatosTramite(documento, codigosolicitud); + } + } + documento.setCarma(tarmDocumentoHabilitante.getCarma()); + if(tarmDocumentoHabilitante.getCtramite() != null){//buscamos datos del tramite + try { + TarmTramite tarmTramite = TarmTramite.find(PersistenceHelper.getEntityManager(), tarmDocumentoHabilitante.getCtramite()); + if(tarmTramite != null){ + documento.setTipoTramite(CatalogoUtil.getInstancia().getDescripcion(tarmTramite.getTipotramite(), tarmTramite.getTipotramitecodigo())); + documento.setTramite(CatalogoUtil.getInstancia().getDescripcion(tarmTramite.getTipoautorizacion(), tarmTramite.getTipoautorizacioncodigo())); + documento.setCategoria(CatalogoUtil.getInstancia().getDescripcion(tarmTramite.getCategoria(), tarmTramite.getCategoriacodigo())); + documento.setUsoActividad(CatalogoUtil.getInstancia().getDescripcion(tarmTramite.getUsoactividad(), tarmTramite.getUsoactividadcodigo())); + documento.setEsFechaExpiracion(tarmTramite.getValidaFechaExpiracion()); + documento.setDescripcion(tarmTramite.getVisualizarPorFechaExpiracion()); + documento.setDescripcion1(buscarJuri(CatalogoUtil.getInstancia().getDescripcion(tarmTramite.getJurisdiccion(), tarmTramite.getJurisdiccioncode()), personaDto)); + + documento.setDescripcion2(tarmTramite.getPie()); + } + } catch (CommondbException e) { + } catch (Exception e) { + } + } + } + return documento; + } + + /** + * Devuelve la jurisdiccion con el valor de la misma, sea direccion con la + * respectiva direccion de la persona que le emiten el carnet. + * + * @param descripcion + * @param personaDto + * @return String + */ + private String buscarJuri(String descripcion, PersonaDto personaDto) { + StringBuilder srtDescrip = new StringBuilder(); + srtDescrip.append(descripcion); + if (!descripcion.equals("ECUADOR")) { + srtDescrip.append(": "); + if (descripcion.equals("PROVINCIA")) { + srtDescrip.append(personaDto.getProvincia()); + } else if (descripcion.equals("CANTN")) { + srtDescrip.append(personaDto.getCanton()); + } else if (descripcion.equals("PARROQUIA")) { + srtDescrip.append(personaDto.getParroquia()); + } else if (descripcion.equals("DIRECCIN")) { + srtDescrip.append(personaDto.getDireccion()); + } + } + + return srtDescrip.toString(); + } + +// public String getNumeroSolicitud(String csolicitud) { +// String numerosolicitud = null; +// TarmSolicitud tarmSolicitud; +// try { +// tarmSolicitud = TarmSolicitud.find(PersistenceHelper.getEntityManager(), csolicitud); +// if(tarmSolicitud != null){ +// numerosolicitud = tarmSolicitud.getNumerosolicitud(); +// } +// } catch (Exception e) { +// APPLogger.getLogger().error(e.getMessage(), e); +// } +// +// return numerosolicitud; +// } + + /** + * Verifica si es o no autorización + * @param numerosolicitud + * @return + * @throws Exception + * @throws CommondbException + */ + @SuppressWarnings("unchecked") + public String verificaTipoTramite(String numerosolicitud) throws CommondbException, Exception { + String tipoTramite = null; + if(numerosolicitud != null){ + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_SOLICITUD_NUM); + query.setParameter("numerosolicitud", numerosolicitud); + List ltarmSolicitud = query.getResultList(); + if(ltarmSolicitud != null && !ltarmSolicitud.isEmpty()){ + TarmSolicitud tarmSolicitud = ltarmSolicitud.iterator().next(); + TarmTramite tarmTramite = TarmTramite.find(PersistenceHelper.getEntityManager(), tarmSolicitud.getCtramite()); + if(tarmTramite.getTipoautorizacion().equals("1") && tarmTramite.getTipoautorizacioncodigo().equals("TIPOAUTORIZACION")){ + tipoTramite = Constant.STR_Y; + } else if(tarmTramite.getTipoautorizacion().equals("6") && tarmTramite.getTipoautorizacioncodigo().equals("TIPOAUTORIZACION")){ + tipoTramite = Constant.STR_N; + } + } + } + return tipoTramite; + } + + /** + * Procesa datos del trámite y completa la información + * @param documento + * @param csolicitud + */ + private void procesaDatosTramite(DocumentoDto documento, String csolicitud){ + TarmSolicitud tarmSolicitud; + try { + tarmSolicitud = TarmSolicitud.find(PersistenceHelper.getEntityManager(), csolicitud); + if(tarmSolicitud != null){ + documento.setNumeroSolicitud(tarmSolicitud.getNumerosolicitud()); + documento.setEstadoTramite(CatalogoUtil.getInstancia().getDescripcion(tarmSolicitud.getEstado(), tarmSolicitud.getEstadocodigo())); + } + } catch (Exception e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/InstitucionSnapEnum.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/InstitucionSnapEnum.java new file mode 100644 index 0000000..bc0803f --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/InstitucionSnapEnum.java @@ -0,0 +1,32 @@ +package com.fp.armas.rules.query.webservices.util; + +/** + * Enum con los codigos de la institucion consumidoras del WS que expone informacion de las armas + * @author user + * + */ +public enum InstitucionSnapEnum { + + CRIMINALISTICA("CRIMINALISTICA"), + MINISTERIO_MINAS("MINERIA"), + COPS("COPS"), + FISCALIA_GENERAL("FGE"); + + private String nombre; + + private InstitucionSnapEnum(String nombre) { + this.nombre = nombre; + } + + /** + * @return the nombre + */ + public String getNombre() { + return nombre; + } + + @Override + public String toString() { + return this.nombre; + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/PersonaUtil.java b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/PersonaUtil.java new file mode 100644 index 0000000..013cf21 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/query/webservices/util/PersonaUtil.java @@ -0,0 +1,235 @@ +package com.fp.armas.rules.query.webservices.util; + +import java.util.List; + +import javax.persistence.Query; + +import com.fp.common.helper.Constant; +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.dto.ws.ImagenDto; +import com.fp.persistence.parmas.dto.ws.PersonaDto; +import com.fp.persistence.pcustomer.company.TcustCompany; +import com.fp.persistence.pcustomer.company.TcustCompanyKey; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.people.TcustPeople; +import com.fp.persistence.pcustomer.people.TcustPeopleKey; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.image.TgeneFilesDetailKey; + +/** + * Clase utilitaria que colocará los datos de la persona + * @author dcruz + * + */ +public class PersonaUtil { + /** + * Consulta propia de la persona + */ + private static final String QUERY_PERSONA = "SELECT o FROM TcustPersonDetail o WHERE o.pk.personcode=:personcode AND o.pk.dateto=:dateto"; + private static final String QUERY_DIRECCION_PRINCIPAL="SELECT o FROM TcustPersonAddress o WHERE o.pk.personcode=:personcode AND o.pk.dateto=:dateto AND o.principal=:principal"; + private static final String QUERY_PROVINCIA = "SELECT o.description FROM TgeneProvince o WHERE o.pk.countrycode=:countrycode AND o.pk.provincecode=:provincecode"; + private static final String QUERY_CANTON = "SELECT o.description FROM TgeneCanton o WHERE o.pk.countrycode=:countrycode AND o.pk.provincecode=:provincecode AND o.pk.cantoncode=:cantoncode"; + private static final String QUERY_PARROQUIA = "SELECT o.description FROM TgeneParroquia o WHERE o.pk.countrycode=:countrycode AND o.pk.provincecode=:provincecode AND o.pk.cantoncode=:cantoncode AND o.pk.parroquiacode=:parroquiacode"; + private static final String QUERY_TELEFONO = "SELECT o.phonenumber FROM TcustPersonPhone o WHERE o.pk.personcode=:personcode AND o.addressnumber=:addressnumber"; + private static PersonaUtil INSTANCIA = new PersonaUtil(); + + private PersonaUtil(){} + + public static PersonaUtil getInstancia() { + return INSTANCIA; + } + + /** + * Obtiene todos los datos de la persona a enviar en a través del web service + * @param personCode + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public PersonaDto obtenerPersonaPorId(Integer personcode, String usercode) throws Exception{ + PersonaDto persona = null; + if(personcode == null){ + return persona; + } + TcustPersonDetail tcustPersonDetail = null; + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_PERSONA); + query.setParameter("personcode", personcode); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List lpersonDetail = query.getResultList(); + if(lpersonDetail != null && !lpersonDetail.isEmpty()){ + persona = new PersonaDto(); + tcustPersonDetail = lpersonDetail.get(0); + persona.setCodigoPersona(tcustPersonDetail.getPk().getPersoncode()); + persona.setCodigoUsuario(usercode); + persona.setTipoIdentificacion(tcustPersonDetail.getIdentificationcatalog()); + persona.setIdentificacion(tcustPersonDetail.getIdentification()); + persona.setNombre(tcustPersonDetail.getName()); + persona.setRepresentanteLegal(tcustPersonDetail.getLegalrepresent()); + //Obtenemos la direccion principal de la persona + TcustPersonAddress tcustPersonAddress = obtieneDireccionPrincipal(personcode); + persona.setDireccion(tcustPersonAddress.getAddress()); + persona.setProvincia(obtenerProvincia(tcustPersonAddress.getProvincecode())); + persona.setCanton(obtenerCanton(tcustPersonAddress.getProvincecode(), tcustPersonAddress.getCantoncode())); + persona.setParroquia(obtenerParroquia(tcustPersonAddress.getProvincecode(), tcustPersonAddress.getCantoncode(), tcustPersonAddress.getParroquiacode())); + persona.setTelefono(obtenerNumeroTelefono(tcustPersonAddress.getPk().getPersoncode(), tcustPersonAddress.getPk().getAddressnumber())); + if(tcustPersonDetail.getMilitarygrade() != null && tcustPersonDetail.getMilitarygradecode() != null){ + persona.setGrado(CatalogoUtil.getInstancia().getLegalCode(tcustPersonDetail.getMilitarygrade(), tcustPersonDetail.getMilitarygradecode())); + } + } + return persona; + } + + /** + * Obtiene la dirección principal de la persona + * @param personcode + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public TcustPersonAddress obtieneDireccionPrincipal(Integer personcode) throws Exception { + TcustPersonAddress tcustPersonAddress = null; + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_DIRECCION_PRINCIPAL); + query.setParameter("personcode", personcode); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + query.setParameter("principal", Constant.STR_Y); + List ltcustPersonAddresses = query.getResultList(); + if(ltcustPersonAddresses != null && !ltcustPersonAddresses.isEmpty()){ + tcustPersonAddress = ltcustPersonAddresses.iterator().next(); + } + return tcustPersonAddress; + } + + /** + * Obtiene la descripción de la provincia + * @param provincecode + * @return + */ + @SuppressWarnings("unchecked") + public String obtenerProvincia(String provincecode) { + String provincia = null; + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_PROVINCIA); + query.setParameter("countrycode", "EC"); + query.setParameter("provincecode", provincecode); + List lprovincias = query.getResultList(); + if(lprovincias != null && !lprovincias.isEmpty()){ + provincia = lprovincias.iterator().next(); + } + return provincia; + } + + /** + * Obtiene la descripción del cantón + * @param provincecode + * @param cantoncode + * @return + */ + @SuppressWarnings("unchecked") + public String obtenerCanton(String provincecode, String cantoncode) { + String canton = null; + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_CANTON); + query.setParameter("countrycode", "EC"); + query.setParameter("provincecode", provincecode); + query.setParameter("cantoncode", cantoncode); + List lcanton = query.getResultList(); + if(lcanton != null && !lcanton.isEmpty()){ + canton = lcanton.iterator().next(); + } + return canton; + } + + /** + * Obtiene la descrición de la parroquia + * @param provincecode + * @param cantoncode + * @param parroquiacode + * @return + */ + @SuppressWarnings("unchecked") + public String obtenerParroquia(String provincecode, String cantoncode, String parroquiacode) { + String parroquia = null; + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_PARROQUIA); + query.setParameter("countrycode", "EC"); + query.setParameter("provincecode", provincecode); + query.setParameter("cantoncode", cantoncode); + query.setParameter("parroquiacode", parroquiacode); + List lparroquia = query.getResultList(); + if(lparroquia != null && !lparroquia.isEmpty()){ + parroquia = lparroquia.iterator().next(); + } + return parroquia; + } + + /** + * Obtiene el teléfono segun la dirección asociada + * @param personcode + * @param addressnumber + * @return + */ + @SuppressWarnings("unchecked") + public String obtenerNumeroTelefono(Integer personcode, Integer addressnumber) { + String telefono = null; + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_TELEFONO); + query.setParameter("personcode", personcode); + query.setParameter("addressnumber", addressnumber); + List ltelefono = query.getResultList(); + if(ltelefono != null && !ltelefono.isEmpty()){ + telefono = ltelefono.iterator().next(); + } + return telefono; + } + + /** + * Retorna la localización de donde se encuentra la persona + * @param personcode + * @return + */ + public String obtenerLocacionPersona(Integer personcode) { + StringBuffer sb = new StringBuffer(); + try { + TcustPersonAddress tcustPersonAddress = obtieneDireccionPrincipal(personcode); + sb.append(tcustPersonAddress.getProvincecode()).append(",").append(obtenerProvincia(tcustPersonAddress.getProvincecode())).append("/"); + sb.append(tcustPersonAddress.getCantoncode()).append(",").append(obtenerCanton(tcustPersonAddress.getProvincecode(), tcustPersonAddress.getCantoncode())).append("/"); + sb.append(tcustPersonAddress.getParroquiacode()).append(",").append(obtenerParroquia(tcustPersonAddress.getProvincecode(), tcustPersonAddress.getCantoncode(), tcustPersonAddress.getParroquiacode())); + } catch (CommondbException e) { + } catch (Exception e) { + } + return sb.toString(); + } + + /** + * Retorna la foto o el logo de la persona si es que esta existe + * @param personcode + * @return + */ + public ImagenDto obtenerImagen(Integer personcode) { + System.out.println("ImagenDto obtenerImagen......-----------"+personcode); + ImagenDto imagenDto = null; + TgeneFilesDetail tgeneFilesDetail = null; + try { + TcustCompany tcustCompany = TcustCompany.find(PersistenceHelper.getEntityManager(), new TcustCompanyKey(personcode, FormatDates.getDefaultExpiryTimestamp())); + if(tcustCompany != null){ + tgeneFilesDetail = TgeneFilesDetail.find(PersistenceHelper.getEntityManager(), new TgeneFilesDetailKey(tcustCompany.getLogo(), FormatDates.getDefaultExpiryTimestamp())); + } else{ + TcustPeople tcustPeople = TcustPeople.find(PersistenceHelper.getEntityManager(), new TcustPeopleKey(personcode, FormatDates.getDefaultExpiryTimestamp())); + if(tcustPeople != null){ + tgeneFilesDetail = TgeneFilesDetail.find(PersistenceHelper.getEntityManager(), new TgeneFilesDetailKey(tcustPeople.getPhotocode(), FormatDates.getDefaultExpiryTimestamp())); + } + } + if(tgeneFilesDetail != null){ + imagenDto = new ImagenDto(); + imagenDto.setCodigoImagen(tgeneFilesDetail.getPk().getCode()); + imagenDto.setExtension(tgeneFilesDetail.getExtension()); + imagenDto.setImagen(tgeneFilesDetail.getImage()); + imagenDto.setTamanioImagen(tgeneFilesDetail.getImagesize()); + imagenDto.setTipoContenido(tgeneFilesDetail.getContenttype()); + } + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + return imagenDto; + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/.svn/entries b/base/business/armas/src/main/java/com/fp/armas/rules/save/.svn/entries new file mode 100644 index 0000000..f09a86c --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/.svn/entries @@ -0,0 +1,52 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com/fp/armas/rules/save +svn://172.17.26.185/COMACO + + + +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +solicitud +dir + +funcionalidad +dir + +pcustomer +dir + +webservices +dir + +armas +dir + +calificacion +dir + +solicitudimportacion +dir + +inspeccion +dir + diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/entries b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/entries new file mode 100644 index 0000000..3b9350a --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com/fp/armas/rules/save/armas +svn://172.17.26.185/COMACO + + + +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ImporteArma.java +file + + + + +2022-07-28T03:40:41.135796Z +571c657afd378b7a95b893eb6be40884 +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +4916 + +ImporteArmaExcel.java +file + + + + +2022-07-28T03:40:41.135796Z +ebbecf68c151f43682e852acf274b4d2 +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1780 + +ReporteArmasDecomisadas.java +file + + + + +2022-07-28T03:40:41.135796Z +8115bb6b6e3d3a1efb333e502bd8ba26 +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +2444 + +ArmasRegistro.java +file + + + + +2022-07-28T03:40:41.135796Z +0be77ed991c0829b0d1a2f8e8d0ffabc +2022-04-19T02:27:53.431385Z +4665 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +4235 + +AuxCodigoArma.java +file + + + + +2022-07-28T03:40:41.136796Z +68531e0c6b88bc4a2f997706d01dfb2e +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1015 + +CambiarUsuarioArma.java +file + + + + +2022-07-28T03:40:41.136796Z +2be4342681d01f093c0b0c5bb9e2fe66 +2022-04-19T02:27:53.431385Z +4665 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +3384 + diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/prop-base/ArmasRegistro.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/prop-base/ArmasRegistro.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/prop-base/ArmasRegistro.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/prop-base/CambiarUsuarioArma.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/prop-base/CambiarUsuarioArma.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/prop-base/CambiarUsuarioArma.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/text-base/ArmasRegistro.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/text-base/ArmasRegistro.java.svn-base new file mode 100644 index 0000000..c5a9a73 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/text-base/ArmasRegistro.java.svn-base @@ -0,0 +1,113 @@ +package com.fp.armas.rules.save.armas; + +import java.sql.Date; +import java.util.List; + +import javax.persistence.Query; + +import com.fp.armas.rules.exception.ControlArmasException; +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Registra las armas y el registro de armas + * @author dcruz + * + */ +public class ArmasRegistro extends TransactionRule { + + private static final long serialVersionUID = 1L; + private static final String QUERY_PERSONA_ID = "SELECT o FROM TcustPersonDetail o WHERE o.identification=:identification AND o.pk.dateto=:dateto"; + + @SuppressWarnings("unchecked") + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if(pSaveRequest.get("eseliminacion") == null || !Constant.ifYes(pSaveRequest.get("eseliminacion").toString())){ + TarmRegistroArmas registro = (TarmRegistroArmas) pSaveRequest.getSaveBeanModifiedObject("TREGISTROARMAS"); + if(registro != null){ + if(registro.isIsnew()){ + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_PERSONA_ID); + query.setParameter("identification", pSaveRequest.get("NUMDOC").toString()); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List ltcustPersonDetail = query.getResultList(); + if(ltcustPersonDetail != null && !ltcustPersonDetail.isEmpty()){ + TcustPersonDetail tcustPersonDetail = ltcustPersonDetail.iterator().next(); + registro.setPersoncode(tcustPersonDetail.getPk().getPersoncode()); + } else{ + throw new ControlArmasException("ARM-001", "La datos de la persona ingresada no existen, por favor crear primero la persona "); + } + registro.setPk(getCodigoRegistro()); + registro.setTiporegistrocodigo("TIPOREGISTRO"); + registro.setFcreacion(new Date(System.currentTimeMillis())); + } + List armasList = pSaveRequest.getSaveBeanModifiedRecords("ARMAS"); + for (Object object : armasList) { + TarmArmas arma = (TarmArmas) object; + arma.setCregistro(registro.getPk()); + if(arma.getColor() != null){ + arma.setColorcodigo("COLOR"); + } + if(arma.getTipofabricacion() != null){ + arma.setTipofabricacioncodigo("TIPOFABRICACION"); + } + if(arma.getUnidadmedidacantidad() != null){ + arma.setUnidadmedidacantidadcodigo("UNIDADMEDIDA"); + } + + if(arma.isIsnew()){ + arma.setPk(this.getCodigoArma()); + arma.setFecharegistro(new Date(System.currentTimeMillis())); + arma.setCodigoarma(arma.getPk()); + } + //arma.setIsnew(Boolean.TRUE); + } + }else{ + List armasList = pSaveRequest.getSaveBeanModifiedRecords("ARMAS"); + for (Object object : armasList) { + TarmArmas arma = (TarmArmas) object; + if(arma.getColor() != null){ + arma.setColorcodigo("COLOR"); + } + if(arma.getTipofabricacion() != null){ + arma.setTipofabricacioncodigo("TIPOFABRICACION"); + } + if(arma.getUnidadmedidacantidad() != null){ + arma.setUnidadmedidacantidadcodigo("UNIDADMEDIDA"); + } + if(arma.isIsnew()){ + arma.setIsnew(Boolean.TRUE); + arma.setPk(this.getCodigoArma()); + arma.setFecharegistro(new Date(System.currentTimeMillis())); + arma.setCodigoarma(arma.getPk()); + } + } + } + } + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + private Long getCodigoRegistro() throws Exception{ + Sequence sequence = new Sequence(); + Long cregistro = sequence.getNextValue("CREGISTRO").longValue(); + return cregistro; + } + + private String getCodigoArma() throws Exception{ + Sequence sequence = new Sequence(); + String carma = sequence.getNextValue("CARMA").toString(); + return carma; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/text-base/AuxCodigoArma.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/text-base/AuxCodigoArma.java.svn-base new file mode 100644 index 0000000..1c907ce --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/text-base/AuxCodigoArma.java.svn-base @@ -0,0 +1,37 @@ +package com.fp.armas.rules.save.armas; + +import java.util.List; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.sessionbeans.helper.Sequence; + +public class AuxCodigoArma extends TransactionRule { + + private static final long serialVersionUID = -7465655492847129136L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + //lista de armas + List listArmas = pSaveRequest.getSaveBeanModifiedRecords("AUXARMAS"); + for (Object object : listArmas) { + TarmArmas arma = (TarmArmas)object; + arma.setPk(getCodigoArma()); + } + + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + + + private String getCodigoArma() throws Exception{ + Sequence sequence = new Sequence(); + String carma = sequence.getNextValue("CARMA").toString(); + return carma; + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/text-base/CambiarUsuarioArma.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/text-base/CambiarUsuarioArma.java.svn-base new file mode 100644 index 0000000..ff93da8 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/text-base/CambiarUsuarioArma.java.svn-base @@ -0,0 +1,81 @@ +package com.fp.armas.rules.save.armas; + +import java.sql.Date; + +import javax.persistence.EntityManager; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.sessionbeans.helper.Sequence; + +public class CambiarUsuarioArma extends TransactionRule { + + private static final long serialVersionUID = -7465655492847129136L; + + /** + * Cambio el estado del arma y genero un nuevo registro para una nueva persona + */ + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + EntityManager entityManager = PersistenceHelper.getEntityManager(); + TarmArmas arma = (TarmArmas) pRequest.get("ARMAACTUAL"); + TcustPersonDetail persona = (TcustPersonDetail) pRequest.get("NUEVAPERSONA"); + TarmRegistroArmas registroActual = TarmRegistroArmas.find(entityManager, arma.getCregistro()); + //arma antigua genera un registro a cambio de propietario + arma.setPk(getCodigoArma()); + String estadoArmaAnterior=arma.getEstado(); + arma.setEstado("CDP");//CAMBIO DE PROPIETARIO + arma.setEstadocodigo("ESTADOARMA"); + arma.setFecharegistro(new Date(new java.util.Date().getTime())); + entityManager.persist(arma); + //registro de la nueva cabecera del propietario + TarmRegistroArmas registroArmas = new TarmRegistroArmas(); + registroArmas.setPk(getCodigoRegistro()); + registroArmas.setFcreacion(new Date(System.currentTimeMillis())); + registroArmas.setAeropuertopuerto(registroActual.getAeropuertopuerto()); + registroArmas.setDui(registroActual.getDui()); + registroArmas.setFechasolicitud(registroActual.getFechasolicitud()); + registroArmas.setPersoncode(persona.getPk().getPersoncode()); + registroArmas.setFabricante(registroActual.getFabricante()); + registroArmas.setPaisorigen(registroActual.getPaisorigen()); + registroArmas.setTiporegistro("CDP");//CAMBIO DE PROPIETARIO + registroArmas.setTiporegistrocodigo(registroActual.getTiporegistrocodigo()); + registroArmas.setTramite(registroActual.getTramite()); + registroArmas.setSolicitudnum(registroActual.getSolicitudnum()); + registroArmas.setTotalfob(registroActual.getTotalfob()); + entityManager.persist(registroArmas); + //regisro de la nueva arma con el nuevo propietario + TarmArmas armaNueva = (TarmArmas) arma.cloneMe(); + armaNueva.setPk(getCodigoArma()); + entityManager.detach(armaNueva); + armaNueva.setEstado(estadoArmaAnterior);//se mantiene el mismo estado del arma + armaNueva.setFecharegistro(new Date(new java.util.Date().getTime())); + armaNueva.setCregistro(registroArmas.getPk()); + //armaNueva.setCodigoarma(armaNueva.getPk()); + entityManager.persist(armaNueva); + + return pRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + + private Long getCodigoRegistro() throws Exception{ + Sequence sequence = new Sequence(); + Long cregistro = sequence.getNextValue("CREGISTRO").longValue(); + return cregistro; + } + + private String getCodigoArma() throws Exception{ + Sequence sequence = new Sequence(); + String carma = sequence.getNextValue("CARMA").toString(); + return carma; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/text-base/ImporteArma.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/text-base/ImporteArma.java.svn-base new file mode 100644 index 0000000..a4a3ca8 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/text-base/ImporteArma.java.svn-base @@ -0,0 +1,119 @@ +package com.fp.armas.rules.save.armas; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.sessionbeans.helper.Sequence; + +public class ImporteArma extends TransactionRule { + + private static final long serialVersionUID = -7465655492847129136L; + + /** + * Armas Decomisadas + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + //EntityManager entityManager = PersistenceHelper.getEntityManager(); + //lista de armas + List listArmas = pSaveRequest.getSaveBeanModifiedRecords("ARMASIMPORTE"); + //cabecera del arma + TarmRegistroArmas registroArmas = (TarmRegistroArmas) pSaveRequest.getSaveBeanModifiedObject("TREGISTROARMAS"); + //detalle del decomiso + List tarmDecomisoArma = (List)pSaveRequest.getSaveBeanModifiedRecords("TARMDECOMISOARMA");//seteado en el decomiso + if(tarmDecomisoArma==null){ + tarmDecomisoArma=new ArrayList<>(); + } + // TarmArmas arma = (TarmArmas) pSaveRequest.get("ARMAACTUAL"); + registroArmas.setPk(getCodigoRegistro()); + registroArmas.setFcreacion(new Date(System.currentTimeMillis())); + + //DECOMISO + //se inserta el DECOMISO cabecera + TarmDecomiso decomiso=(TarmDecomiso)pSaveRequest.getSaveBeanModifiedObject("IMPORTEDECOMISO"); + decomiso.setPk(Long.parseLong(getCodigo("CDECOMISO"))); + decomiso.setNumerotransaccion(getNumeroTransaccion(decomiso.getTipoproceso(), decomiso.getPk().toString())); + + for (Object object : listArmas) { + TarmArmas armaNueva = (TarmArmas)object; + armaNueva.setPk(getCodigoArma()); + armaNueva.setFecharegistro(new Date(new java.util.Date().getTime())); + armaNueva.setCregistro(registroArmas.getPk()); + armaNueva.setCodigoarma(armaNueva.getPk()); + + //seteo del detalle del DECOMISOARMA y a que arma se le hace el decomiso + TarmDecomisoArma decomisoArma= new TarmDecomisoArma(); + decomisoArma.setCarma( armaNueva.getPk()); + //estadoarma es igual que el estado del arma + decomisoArma.setEstado(armaNueva.getEstado()); + decomisoArma.setEstadocode(armaNueva.getEstadocodigo()); + //motivo del decomiso + decomisoArma.setMotivodecomiso(armaNueva.getModifiedData().get("motivocatalogo").toString());//motivo + decomisoArma.setMotivodecomisocodigo(armaNueva.getModifiedData().get("motivocatalogocode").toString());//1 + //observacion + decomisoArma.setObservacion(armaNueva.getModifiedData().get("observaciondecomiso").toString()); + //cantidad + decomisoArma.setCantidad(new BigDecimal(armaNueva.getModifiedData().get("cantidad").toString()));//cantidad + //unidad del arma o material explosivo + + decomisoArma.setUnidadmedida(armaNueva.getUnidadmedidacantidad());//unidad de medida + decomisoArma.setUnidadmedidacode(armaNueva.getUnidadmedidacantidadcodigo());//3 + //fecha del decomiso arma la actual + java.util.Date fechaRecepcion=(java.util.Date)armaNueva.getModifiedData().get("fechaRecepcion"); + decomisoArma.setFdecomiso(new Timestamp(fechaRecepcion.getTime())); + //codigo del decomiso + decomisoArma.setPk(getCodigo("CDECOMISOARMA")); + //codigo del decomiso + decomisoArma.setCdecomiso(decomiso.getPk()); + //en bodega + decomisoArma.setEnbodega("Y"); + tarmDecomisoArma.add(decomisoArma); + } + + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + + private Long getCodigoRegistro() throws Exception{ + Sequence sequence = new Sequence(); + Long cregistro = sequence.getNextValue("CREGISTRO").longValue(); + return cregistro; + } + + private String getCodigoArma() throws Exception{ + Sequence sequence = new Sequence(); + String carma = sequence.getNextValue("CARMA").toString(); + return carma; + } + /** + * Metodo que devuelve la secuencia del codigo + * @param codigoSec + * @return String + * @throws Exception + */ + private String getCodigo(String codigoSec) throws Exception { + Sequence sequence = new Sequence(); + String solcitud = sequence.getNextValue(codigoSec).toString(); + return solcitud; + } + + private String getNumeroTransaccion(String prefijo,String secuencia){ + System.out.println("Ingresa al secuencial armas"); + return prefijo+"-"+StringUtils.leftPad(secuencia, 9, '0'); + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/text-base/ImporteArmaExcel.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/text-base/ImporteArmaExcel.java.svn-base new file mode 100644 index 0000000..59a2e05 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/text-base/ImporteArmaExcel.java.svn-base @@ -0,0 +1,56 @@ +package com.fp.armas.rules.save.armas; + +import java.sql.Date; +import java.util.List; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.sessionbeans.helper.Sequence; + +public class ImporteArmaExcel extends TransactionRule { + + private static final long serialVersionUID = -7465655492847129136L; + + /** + * Armas a Registrar + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + //lista de armas + List listArmas = pSaveRequest.getSaveBeanModifiedRecords("ARMASIMPORTEEXCEL"); + //cabecera del arma + TarmRegistroArmas registroArmas = (TarmRegistroArmas) pSaveRequest.getSaveBeanModifiedObject("TREGISTROARMAS"); + registroArmas.setPk(getCodigoRegistro()); + registroArmas.setFcreacion(new Date(System.currentTimeMillis())); + + for (Object object : listArmas) { + TarmArmas armaNueva = (TarmArmas)object; + armaNueva.setPk(getCodigoArma()); + armaNueva.setFecharegistro(new Date(new java.util.Date().getTime())); + armaNueva.setCregistro(registroArmas.getPk()); + armaNueva.setCodigoarma(armaNueva.getPk()); + + } + + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + + private Long getCodigoRegistro() throws Exception{ + Sequence sequence = new Sequence(); + Long cregistro = sequence.getNextValue("CREGISTRO").longValue(); + return cregistro; + } + + private String getCodigoArma() throws Exception{ + Sequence sequence = new Sequence(); + String carma = sequence.getNextValue("CARMA").toString(); + return carma; + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/text-base/ReporteArmasDecomisadas.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/text-base/ReporteArmasDecomisadas.java.svn-base new file mode 100644 index 0000000..a16da54 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/.svn/text-base/ReporteArmasDecomisadas.java.svn-base @@ -0,0 +1,67 @@ +package com.fp.armas.rules.save.armas; + +import java.util.List; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.parmas.soli.TarmCabRepDestruirArmas; +import com.fp.persistence.parmas.soli.TarmDetRepDestruirArmas; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Registra las armas y el registro de armas + * @author Christian Pazmino + * + */ +public class ReporteArmasDecomisadas extends TransactionRule { + + private static final long serialVersionUID = 1L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (this.isNew(pSaveRequest)) { + return pSaveRequest; + } + + + TarmCabRepDestruirArmas cabeceraReporteObj = (TarmCabRepDestruirArmas)pSaveRequest.getSaveBeanModifiedObject("CABREPORTEDESTRUIRARMAS"); + if(cabeceraReporteObj != null){ + cabeceraReporteObj.setPk(getCodigoReporte()); + pSaveRequest.put("creporte", cabeceraReporteObj.getPk()); + String nombreReporte="BAJ-"+cabeceraReporteObj.getPk()+".pdf"; + pSaveRequest.getResponse().put("creporte", cabeceraReporteObj.getPk()); + cabeceraReporteObj.setXpath(cabeceraReporteObj.getXpath()+"/cm:"+nombreReporte); + pSaveRequest.put("xpath", cabeceraReporteObj.getXpath()); + pSaveRequest.getResponse().put("nombreReporte", nombreReporte); + + pSaveRequest.getResponse().put("creporte", cabeceraReporteObj.getPk()); + pSaveRequest.getResponse().put("xpath", cabeceraReporteObj.getXpath()); + + List armasReporteLst = pSaveRequest.getSaveBeanModifiedRecords("DETREPORTEDESTRUIRARMAS"); + for (Object arma : armasReporteLst) { + TarmDetRepDestruirArmas armaObj = (TarmDetRepDestruirArmas)arma; + armaObj.setPk(getCodigoDetReporte()); + armaObj.setCreporte(cabeceraReporteObj.getPk()); + } + } + + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + private Integer getCodigoReporte() throws Exception{ + Sequence sequence = new Sequence(); + Integer creporte = sequence.getNextValue("TARMREPORTEDESTRUIRARMAS").intValue(); + return creporte; + } + + private Integer getCodigoDetReporte() throws Exception{ + Sequence sequence = new Sequence(); + Integer carma = sequence.getNextValue("TARMDETREPORTEDESTRUIRARMAS").intValue(); + return carma; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/ArmasRegistro.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/ArmasRegistro.java new file mode 100644 index 0000000..c5a9a73 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/ArmasRegistro.java @@ -0,0 +1,113 @@ +package com.fp.armas.rules.save.armas; + +import java.sql.Date; +import java.util.List; + +import javax.persistence.Query; + +import com.fp.armas.rules.exception.ControlArmasException; +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Registra las armas y el registro de armas + * @author dcruz + * + */ +public class ArmasRegistro extends TransactionRule { + + private static final long serialVersionUID = 1L; + private static final String QUERY_PERSONA_ID = "SELECT o FROM TcustPersonDetail o WHERE o.identification=:identification AND o.pk.dateto=:dateto"; + + @SuppressWarnings("unchecked") + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if(pSaveRequest.get("eseliminacion") == null || !Constant.ifYes(pSaveRequest.get("eseliminacion").toString())){ + TarmRegistroArmas registro = (TarmRegistroArmas) pSaveRequest.getSaveBeanModifiedObject("TREGISTROARMAS"); + if(registro != null){ + if(registro.isIsnew()){ + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_PERSONA_ID); + query.setParameter("identification", pSaveRequest.get("NUMDOC").toString()); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + List ltcustPersonDetail = query.getResultList(); + if(ltcustPersonDetail != null && !ltcustPersonDetail.isEmpty()){ + TcustPersonDetail tcustPersonDetail = ltcustPersonDetail.iterator().next(); + registro.setPersoncode(tcustPersonDetail.getPk().getPersoncode()); + } else{ + throw new ControlArmasException("ARM-001", "La datos de la persona ingresada no existen, por favor crear primero la persona "); + } + registro.setPk(getCodigoRegistro()); + registro.setTiporegistrocodigo("TIPOREGISTRO"); + registro.setFcreacion(new Date(System.currentTimeMillis())); + } + List armasList = pSaveRequest.getSaveBeanModifiedRecords("ARMAS"); + for (Object object : armasList) { + TarmArmas arma = (TarmArmas) object; + arma.setCregistro(registro.getPk()); + if(arma.getColor() != null){ + arma.setColorcodigo("COLOR"); + } + if(arma.getTipofabricacion() != null){ + arma.setTipofabricacioncodigo("TIPOFABRICACION"); + } + if(arma.getUnidadmedidacantidad() != null){ + arma.setUnidadmedidacantidadcodigo("UNIDADMEDIDA"); + } + + if(arma.isIsnew()){ + arma.setPk(this.getCodigoArma()); + arma.setFecharegistro(new Date(System.currentTimeMillis())); + arma.setCodigoarma(arma.getPk()); + } + //arma.setIsnew(Boolean.TRUE); + } + }else{ + List armasList = pSaveRequest.getSaveBeanModifiedRecords("ARMAS"); + for (Object object : armasList) { + TarmArmas arma = (TarmArmas) object; + if(arma.getColor() != null){ + arma.setColorcodigo("COLOR"); + } + if(arma.getTipofabricacion() != null){ + arma.setTipofabricacioncodigo("TIPOFABRICACION"); + } + if(arma.getUnidadmedidacantidad() != null){ + arma.setUnidadmedidacantidadcodigo("UNIDADMEDIDA"); + } + if(arma.isIsnew()){ + arma.setIsnew(Boolean.TRUE); + arma.setPk(this.getCodigoArma()); + arma.setFecharegistro(new Date(System.currentTimeMillis())); + arma.setCodigoarma(arma.getPk()); + } + } + } + } + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + private Long getCodigoRegistro() throws Exception{ + Sequence sequence = new Sequence(); + Long cregistro = sequence.getNextValue("CREGISTRO").longValue(); + return cregistro; + } + + private String getCodigoArma() throws Exception{ + Sequence sequence = new Sequence(); + String carma = sequence.getNextValue("CARMA").toString(); + return carma; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/AuxCodigoArma.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/AuxCodigoArma.java new file mode 100644 index 0000000..1c907ce --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/AuxCodigoArma.java @@ -0,0 +1,37 @@ +package com.fp.armas.rules.save.armas; + +import java.util.List; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.sessionbeans.helper.Sequence; + +public class AuxCodigoArma extends TransactionRule { + + private static final long serialVersionUID = -7465655492847129136L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + //lista de armas + List listArmas = pSaveRequest.getSaveBeanModifiedRecords("AUXARMAS"); + for (Object object : listArmas) { + TarmArmas arma = (TarmArmas)object; + arma.setPk(getCodigoArma()); + } + + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + + + private String getCodigoArma() throws Exception{ + Sequence sequence = new Sequence(); + String carma = sequence.getNextValue("CARMA").toString(); + return carma; + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/CambiarUsuarioArma.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/CambiarUsuarioArma.java new file mode 100644 index 0000000..ff93da8 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/CambiarUsuarioArma.java @@ -0,0 +1,81 @@ +package com.fp.armas.rules.save.armas; + +import java.sql.Date; + +import javax.persistence.EntityManager; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.sessionbeans.helper.Sequence; + +public class CambiarUsuarioArma extends TransactionRule { + + private static final long serialVersionUID = -7465655492847129136L; + + /** + * Cambio el estado del arma y genero un nuevo registro para una nueva persona + */ + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + EntityManager entityManager = PersistenceHelper.getEntityManager(); + TarmArmas arma = (TarmArmas) pRequest.get("ARMAACTUAL"); + TcustPersonDetail persona = (TcustPersonDetail) pRequest.get("NUEVAPERSONA"); + TarmRegistroArmas registroActual = TarmRegistroArmas.find(entityManager, arma.getCregistro()); + //arma antigua genera un registro a cambio de propietario + arma.setPk(getCodigoArma()); + String estadoArmaAnterior=arma.getEstado(); + arma.setEstado("CDP");//CAMBIO DE PROPIETARIO + arma.setEstadocodigo("ESTADOARMA"); + arma.setFecharegistro(new Date(new java.util.Date().getTime())); + entityManager.persist(arma); + //registro de la nueva cabecera del propietario + TarmRegistroArmas registroArmas = new TarmRegistroArmas(); + registroArmas.setPk(getCodigoRegistro()); + registroArmas.setFcreacion(new Date(System.currentTimeMillis())); + registroArmas.setAeropuertopuerto(registroActual.getAeropuertopuerto()); + registroArmas.setDui(registroActual.getDui()); + registroArmas.setFechasolicitud(registroActual.getFechasolicitud()); + registroArmas.setPersoncode(persona.getPk().getPersoncode()); + registroArmas.setFabricante(registroActual.getFabricante()); + registroArmas.setPaisorigen(registroActual.getPaisorigen()); + registroArmas.setTiporegistro("CDP");//CAMBIO DE PROPIETARIO + registroArmas.setTiporegistrocodigo(registroActual.getTiporegistrocodigo()); + registroArmas.setTramite(registroActual.getTramite()); + registroArmas.setSolicitudnum(registroActual.getSolicitudnum()); + registroArmas.setTotalfob(registroActual.getTotalfob()); + entityManager.persist(registroArmas); + //regisro de la nueva arma con el nuevo propietario + TarmArmas armaNueva = (TarmArmas) arma.cloneMe(); + armaNueva.setPk(getCodigoArma()); + entityManager.detach(armaNueva); + armaNueva.setEstado(estadoArmaAnterior);//se mantiene el mismo estado del arma + armaNueva.setFecharegistro(new Date(new java.util.Date().getTime())); + armaNueva.setCregistro(registroArmas.getPk()); + //armaNueva.setCodigoarma(armaNueva.getPk()); + entityManager.persist(armaNueva); + + return pRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + + private Long getCodigoRegistro() throws Exception{ + Sequence sequence = new Sequence(); + Long cregistro = sequence.getNextValue("CREGISTRO").longValue(); + return cregistro; + } + + private String getCodigoArma() throws Exception{ + Sequence sequence = new Sequence(); + String carma = sequence.getNextValue("CARMA").toString(); + return carma; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/ImporteArma.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/ImporteArma.java new file mode 100644 index 0000000..a4a3ca8 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/ImporteArma.java @@ -0,0 +1,119 @@ +package com.fp.armas.rules.save.armas; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.sessionbeans.helper.Sequence; + +public class ImporteArma extends TransactionRule { + + private static final long serialVersionUID = -7465655492847129136L; + + /** + * Armas Decomisadas + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + //EntityManager entityManager = PersistenceHelper.getEntityManager(); + //lista de armas + List listArmas = pSaveRequest.getSaveBeanModifiedRecords("ARMASIMPORTE"); + //cabecera del arma + TarmRegistroArmas registroArmas = (TarmRegistroArmas) pSaveRequest.getSaveBeanModifiedObject("TREGISTROARMAS"); + //detalle del decomiso + List tarmDecomisoArma = (List)pSaveRequest.getSaveBeanModifiedRecords("TARMDECOMISOARMA");//seteado en el decomiso + if(tarmDecomisoArma==null){ + tarmDecomisoArma=new ArrayList<>(); + } + // TarmArmas arma = (TarmArmas) pSaveRequest.get("ARMAACTUAL"); + registroArmas.setPk(getCodigoRegistro()); + registroArmas.setFcreacion(new Date(System.currentTimeMillis())); + + //DECOMISO + //se inserta el DECOMISO cabecera + TarmDecomiso decomiso=(TarmDecomiso)pSaveRequest.getSaveBeanModifiedObject("IMPORTEDECOMISO"); + decomiso.setPk(Long.parseLong(getCodigo("CDECOMISO"))); + decomiso.setNumerotransaccion(getNumeroTransaccion(decomiso.getTipoproceso(), decomiso.getPk().toString())); + + for (Object object : listArmas) { + TarmArmas armaNueva = (TarmArmas)object; + armaNueva.setPk(getCodigoArma()); + armaNueva.setFecharegistro(new Date(new java.util.Date().getTime())); + armaNueva.setCregistro(registroArmas.getPk()); + armaNueva.setCodigoarma(armaNueva.getPk()); + + //seteo del detalle del DECOMISOARMA y a que arma se le hace el decomiso + TarmDecomisoArma decomisoArma= new TarmDecomisoArma(); + decomisoArma.setCarma( armaNueva.getPk()); + //estadoarma es igual que el estado del arma + decomisoArma.setEstado(armaNueva.getEstado()); + decomisoArma.setEstadocode(armaNueva.getEstadocodigo()); + //motivo del decomiso + decomisoArma.setMotivodecomiso(armaNueva.getModifiedData().get("motivocatalogo").toString());//motivo + decomisoArma.setMotivodecomisocodigo(armaNueva.getModifiedData().get("motivocatalogocode").toString());//1 + //observacion + decomisoArma.setObservacion(armaNueva.getModifiedData().get("observaciondecomiso").toString()); + //cantidad + decomisoArma.setCantidad(new BigDecimal(armaNueva.getModifiedData().get("cantidad").toString()));//cantidad + //unidad del arma o material explosivo + + decomisoArma.setUnidadmedida(armaNueva.getUnidadmedidacantidad());//unidad de medida + decomisoArma.setUnidadmedidacode(armaNueva.getUnidadmedidacantidadcodigo());//3 + //fecha del decomiso arma la actual + java.util.Date fechaRecepcion=(java.util.Date)armaNueva.getModifiedData().get("fechaRecepcion"); + decomisoArma.setFdecomiso(new Timestamp(fechaRecepcion.getTime())); + //codigo del decomiso + decomisoArma.setPk(getCodigo("CDECOMISOARMA")); + //codigo del decomiso + decomisoArma.setCdecomiso(decomiso.getPk()); + //en bodega + decomisoArma.setEnbodega("Y"); + tarmDecomisoArma.add(decomisoArma); + } + + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + + private Long getCodigoRegistro() throws Exception{ + Sequence sequence = new Sequence(); + Long cregistro = sequence.getNextValue("CREGISTRO").longValue(); + return cregistro; + } + + private String getCodigoArma() throws Exception{ + Sequence sequence = new Sequence(); + String carma = sequence.getNextValue("CARMA").toString(); + return carma; + } + /** + * Metodo que devuelve la secuencia del codigo + * @param codigoSec + * @return String + * @throws Exception + */ + private String getCodigo(String codigoSec) throws Exception { + Sequence sequence = new Sequence(); + String solcitud = sequence.getNextValue(codigoSec).toString(); + return solcitud; + } + + private String getNumeroTransaccion(String prefijo,String secuencia){ + System.out.println("Ingresa al secuencial armas"); + return prefijo+"-"+StringUtils.leftPad(secuencia, 9, '0'); + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/ImporteArmaExcel.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/ImporteArmaExcel.java new file mode 100644 index 0000000..59a2e05 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/ImporteArmaExcel.java @@ -0,0 +1,56 @@ +package com.fp.armas.rules.save.armas; + +import java.sql.Date; +import java.util.List; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.sessionbeans.helper.Sequence; + +public class ImporteArmaExcel extends TransactionRule { + + private static final long serialVersionUID = -7465655492847129136L; + + /** + * Armas a Registrar + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + //lista de armas + List listArmas = pSaveRequest.getSaveBeanModifiedRecords("ARMASIMPORTEEXCEL"); + //cabecera del arma + TarmRegistroArmas registroArmas = (TarmRegistroArmas) pSaveRequest.getSaveBeanModifiedObject("TREGISTROARMAS"); + registroArmas.setPk(getCodigoRegistro()); + registroArmas.setFcreacion(new Date(System.currentTimeMillis())); + + for (Object object : listArmas) { + TarmArmas armaNueva = (TarmArmas)object; + armaNueva.setPk(getCodigoArma()); + armaNueva.setFecharegistro(new Date(new java.util.Date().getTime())); + armaNueva.setCregistro(registroArmas.getPk()); + armaNueva.setCodigoarma(armaNueva.getPk()); + + } + + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + + private Long getCodigoRegistro() throws Exception{ + Sequence sequence = new Sequence(); + Long cregistro = sequence.getNextValue("CREGISTRO").longValue(); + return cregistro; + } + + private String getCodigoArma() throws Exception{ + Sequence sequence = new Sequence(); + String carma = sequence.getNextValue("CARMA").toString(); + return carma; + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/ReporteArmasDecomisadas.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/ReporteArmasDecomisadas.java new file mode 100644 index 0000000..a16da54 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/armas/ReporteArmasDecomisadas.java @@ -0,0 +1,67 @@ +package com.fp.armas.rules.save.armas; + +import java.util.List; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.parmas.soli.TarmCabRepDestruirArmas; +import com.fp.persistence.parmas.soli.TarmDetRepDestruirArmas; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Registra las armas y el registro de armas + * @author Christian Pazmino + * + */ +public class ReporteArmasDecomisadas extends TransactionRule { + + private static final long serialVersionUID = 1L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (this.isNew(pSaveRequest)) { + return pSaveRequest; + } + + + TarmCabRepDestruirArmas cabeceraReporteObj = (TarmCabRepDestruirArmas)pSaveRequest.getSaveBeanModifiedObject("CABREPORTEDESTRUIRARMAS"); + if(cabeceraReporteObj != null){ + cabeceraReporteObj.setPk(getCodigoReporte()); + pSaveRequest.put("creporte", cabeceraReporteObj.getPk()); + String nombreReporte="BAJ-"+cabeceraReporteObj.getPk()+".pdf"; + pSaveRequest.getResponse().put("creporte", cabeceraReporteObj.getPk()); + cabeceraReporteObj.setXpath(cabeceraReporteObj.getXpath()+"/cm:"+nombreReporte); + pSaveRequest.put("xpath", cabeceraReporteObj.getXpath()); + pSaveRequest.getResponse().put("nombreReporte", nombreReporte); + + pSaveRequest.getResponse().put("creporte", cabeceraReporteObj.getPk()); + pSaveRequest.getResponse().put("xpath", cabeceraReporteObj.getXpath()); + + List armasReporteLst = pSaveRequest.getSaveBeanModifiedRecords("DETREPORTEDESTRUIRARMAS"); + for (Object arma : armasReporteLst) { + TarmDetRepDestruirArmas armaObj = (TarmDetRepDestruirArmas)arma; + armaObj.setPk(getCodigoDetReporte()); + armaObj.setCreporte(cabeceraReporteObj.getPk()); + } + } + + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + private Integer getCodigoReporte() throws Exception{ + Sequence sequence = new Sequence(); + Integer creporte = sequence.getNextValue("TARMREPORTEDESTRUIRARMAS").intValue(); + return creporte; + } + + private Integer getCodigoDetReporte() throws Exception{ + Sequence sequence = new Sequence(); + Integer carma = sequence.getNextValue("TARMDETREPORTEDESTRUIRARMAS").intValue(); + return carma; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/calificacion/.svn/entries b/base/business/armas/src/main/java/com/fp/armas/rules/save/calificacion/.svn/entries new file mode 100644 index 0000000..bdcf17c --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/calificacion/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com/fp/armas/rules/save/calificacion +svn://172.17.26.185/COMACO + + + +2017-02-08T23:29:01.922022Z +4571 +jespinosa + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +EvaluacionPsicologica.java +file + + + + +2022-07-28T03:40:41.165796Z +94dadb7a653e217468b33cba176f44b6 +2015-06-29T11:47:44.122339Z +4154 +fpazmino + + + + + + + + + + + + + + + + + + + + + +2569 + +Calificacion.java +file + + + + +2022-07-28T03:40:41.165796Z +4ef9df3d388039ed2884ec270d3236f7 +2015-06-29T11:47:44.122339Z +4154 +fpazmino + + + + + + + + + + + + + + + + + + + + + +3959 + +EvaluarGuardia.java +file + + + + +2022-07-28T03:40:41.165796Z +0746eba3bd6c5f9e676e6fd02f38519f +2017-02-08T23:29:01.922022Z +4571 +jespinosa + + + + + + + + + + + + + + + + + + + + + +4183 + diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/calificacion/.svn/text-base/Calificacion.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/calificacion/.svn/text-base/Calificacion.java.svn-base new file mode 100644 index 0000000..564d5bc --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/calificacion/.svn/text-base/Calificacion.java.svn-base @@ -0,0 +1,144 @@ +package com.fp.armas.rules.save.calificacion; + + + + +import java.util.Date; +import java.util.List; + +import org.apache.commons.validator.Msg; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.eval.TarmDetallePreguntas; +import com.fp.persistence.parmas.eval.TarmEvaluacion; +import com.fp.sessionbeans.helper.Sequence; + + +/** + * @author Andres Cevallos + * Clase que califica una evaluacion + */ +public class Calificacion extends TransactionRule { + + /** + * + */ + private static final long serialVersionUID = 1L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + TarmEvaluacion registroArma = (TarmEvaluacion) pSaveRequest.getSaveBeanModifiedObject("EVALUACION"); + List levaluacionDetalle = (List)pSaveRequest.getSaveBeanModifiedRecords("DETALLEPREGUNTAS"); + float respuestas=0; + float preguntas=0; + float porcentaje=0; + if(levaluacionDetalle==null || levaluacionDetalle.isEmpty()){ + TarmDetallePreguntas detalle=(TarmDetallePreguntas)pSaveRequest.getSaveBeanModifiedObject("DETALLEPREGUNTAS"); + levaluacionDetalle.add(detalle); + } + + + if (registroArma == null) { + + return pSaveRequest; + } + + if(registroArma.getPk()==null) + { + registroArma.setPk(getCodigoEvaluacion().toString()); + porcentaje = (float) registroArma.getModifiedData().get("aprobacion"); + + } + + for(Object deta : levaluacionDetalle){ + TarmDetallePreguntas detalle = (TarmDetallePreguntas) deta; + String valor= detalle.getModifiedData().get("valor").toString(); + if(valor.equals("Y")) + { + respuestas++; + } + preguntas++; + + } + + if(preguntas!=0){ + if((100*respuestas/preguntas)>=porcentaje){ + registroArma.setResultado("APROBADO"); + registroArma.setResultadocodigo("RESULTADO"); + Date fechaexpiracion=new Date(); + fechaexpiracion.setYear(fechaexpiracion.getYear()+2); + registroArma.setFechaexpiracion(new java.sql.Date(fechaexpiracion.getTime())); + pSaveRequest.getResponse().put("result", "APR"); + + } + else{ + registroArma.setResultado("REPROBADO"); + registroArma.setResultadocodigo("RESULTADO"); + registroArma.setFechapreox(null); + registroArma.setFechaexpiracion(null); + pSaveRequest.getResponse().put("result", "REP"); + } + PersistenceHelper.getEntityManager().persist(registroArma); + } + System.out.println("Respuestas Correctas "+respuestas+"de "+preguntas+" preguntas"); + + for(Object deta : levaluacionDetalle){ + TarmDetallePreguntas detalle = (TarmDetallePreguntas) deta; + + detalle.setPk(getCodigoDetallePreguntas()); + detalle.setCevaluacion(registroArma.getPk()); + + PersistenceHelper.getEntityManager().persist(detalle); + } + + + PersistenceHelper.getEntityManager().flush(); + + return pSaveRequest; + + + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + + + + return pSaveRequest; + } + + + + /** + * Metodo que devuelve la secuencia de una evaluacion. + * + * @return Codigo del nuevo cliente. + * @throws Exception + */ + private Long getCodigoEvaluacion() throws Exception { + Sequence sequence = new Sequence(); + Long codigo = sequence.getNextValue("CEVALUACION").longValue(); + + return codigo; + + } + + /** + * Mtodo que devuelve el detalle de las preguntas + * @return + * @throws Exception + */ + private String getCodigoDetallePreguntas() throws Exception { + Sequence sequence = new Sequence(); + String codigo = sequence.getNextValue("CDETALLEPREGUNTAS").toString(); + + return codigo; + + } + + + + +} \ No newline at end of file diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/calificacion/.svn/text-base/EvaluacionPsicologica.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/calificacion/.svn/text-base/EvaluacionPsicologica.java.svn-base new file mode 100644 index 0000000..46e8513 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/calificacion/.svn/text-base/EvaluacionPsicologica.java.svn-base @@ -0,0 +1,103 @@ +package com.fp.armas.rules.save.calificacion; + + + + +import java.util.List; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.eval.TarmDetallePreguntas; +import com.fp.persistence.parmas.eval.TarmEvaluacion; +import com.fp.persistence.parmas.soli.TarmGuardias; +import com.fp.sessionbeans.helper.Sequence; + + +/** + * @author Andres Cevallos + * Clase que ingresa un registro de evaluacin psicolgica y la registra + */ + +public class EvaluacionPsicologica extends TransactionRule { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /* (non-Javadoc) + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + // TarmEvaluacion registroArma = (TarmEvaluacion) pSaveRequest.getSaveBeanModifiedObject("EVALUACION"); + List levaluacion = (List)pSaveRequest.getSaveBeanModifiedRecords("EVALUACION"); + TarmGuardias guardia = (TarmGuardias) pSaveRequest.getSaveBeanModifiedObject("GUARDIAS"); + if(levaluacion==null || levaluacion.isEmpty()){ + TarmEvaluacion evaluacion = (TarmEvaluacion) pSaveRequest.getSaveBeanModifiedObject("EVALUACION"); + if (evaluacion == null) { + + return pSaveRequest; + } + levaluacion.add(evaluacion); + } + + + + + for(Object deta : levaluacion){ + TarmEvaluacion detalle = (TarmEvaluacion) deta; + if(detalle.getResultado().equalsIgnoreCase("REPROBADO")){ + detalle.setFechaexpiracion(null); + detalle.setFechapreox(null); + } + if(detalle.getPk()==null) + detalle.setPk(getCodigoPreguntas()); + + + + } + /* if(guardia!=null) + PersistenceHelper.getEntityManager().persist(guardia); + + */ + + + return pSaveRequest; + + + } + + /* (non-Javadoc) + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + + + + return pSaveRequest; + } + + + + + + /** + * Obtiene el codigo de la evaluacion + * @return + * @throws Exception + */ + private String getCodigoPreguntas() throws Exception { + Sequence sequence = new Sequence(); + String codigo = sequence.getNextValue("CEVALUACION").toString(); + + return codigo; + + } + + + + +} \ No newline at end of file diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/calificacion/.svn/text-base/EvaluarGuardia.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/calificacion/.svn/text-base/EvaluarGuardia.java.svn-base new file mode 100644 index 0000000..4c55ee9 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/calificacion/.svn/text-base/EvaluarGuardia.java.svn-base @@ -0,0 +1,115 @@ +package com.fp.armas.rules.save.calificacion; + + + + +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.armas.rules.save.funcionalidad.Movimiento; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.eval.TarmDetallePreguntas; +import com.fp.persistence.parmas.eval.TarmEvaluacion; +import com.fp.persistence.parmas.param.TarmComercianteCupo; +import com.fp.persistence.parmas.soli.TarmGuardias; +import com.fp.sessionbeans.helper.Sequence; + + +/** + * @author Andres Cevallos + * Clase que daclara apto o no apto a un guardia dependiendo de su evaluacion + */ +public class EvaluarGuardia extends TransactionRule { + + + private static final String JPQL_GUARDIAS = "from TarmGuardias tag" + " where tag.pk = :personcode"; + private static final String JPQL_EVALUACION= "from TarmEvaluacion tev where tev.personcode = :personcode and tev.resultado='APROBADO' and tev.tipoevaluacion = :tipoevaluacion"; + + /** + * + */ + private static final long serialVersionUID = 1L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + // TarmEvaluacion registroArma = (TarmEvaluacion) pSaveRequest.getSaveBeanModifiedObject("EVALUACION"); + List levaluacion = (List)pSaveRequest.getSaveBeanModifiedRecords("EVALUACION"); + + if(levaluacion==null || levaluacion.isEmpty()){ + TarmEvaluacion evaluacion = (TarmEvaluacion) pSaveRequest.getSaveBeanModifiedObject("EVALUACION"); + if (evaluacion == null) { + + return pSaveRequest; + } + levaluacion.add(evaluacion); + } + + for(Object deta : levaluacion){ + TarmEvaluacion detalle = (TarmEvaluacion) deta; + List lpsicologicas = findEvaluacion(PersistenceHelper.getEntityManager(), detalle.getPersoncode(), "PSICOLOGICA"); + if(lpsicologicas == null || lpsicologicas.isEmpty()){ + throw new Exception("DEBE REGISTRAR EL TEST PSICOL\u00d3GICO PRIMERO"); + } + //validacion en caso de ser guardia + List guardiasList=findGuardia(PersistenceHelper.getEntityManager(), detalle.getPersoncode()); + TarmGuardias guardia=null; + if(guardiasList!=null && guardiasList.size()>0){ + guardia=guardiasList.get(0); + guardia.setIsnew(false); + List lconocimientos = findEvaluacion(PersistenceHelper.getEntityManager(), detalle.getPersoncode(), "CONOCIMIENTO"); + if(lpsicologicas!=null && !lpsicologicas.isEmpty() && ((lconocimientos!=null && !lconocimientos.isEmpty()) || detalle.getResultado().equalsIgnoreCase("APROBADO"))){ + guardia.setEstado("APT"); + } + else{ + guardia.setEstado("NAPT"); + } + if(!guardia.isnew){ + PersistenceHelper.getEntityManager().merge(guardia); + }else{ + PersistenceHelper.getEntityManager().persist(guardia); + } + } + } + PersistenceHelper.getEntityManager().flush(); + return pSaveRequest; + } + + public static List findGuardia(EntityManager pEntityManager, Integer personcodigo) throws Exception { + + Query qry = pEntityManager.createQuery(EvaluarGuardia.JPQL_GUARDIAS); + qry.setParameter("personcode", personcodigo); + return qry.getResultList(); + } + + public static List findEvaluacion(EntityManager pEntityManager, Integer personcodigo, String tipoevaluacion) throws Exception { + + Query qry = pEntityManager.createQuery(EvaluarGuardia.JPQL_EVALUACION); + qry.setParameter("personcode", personcodigo); + qry.setParameter("tipoevaluacion", tipoevaluacion); + + return qry.getResultList(); + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + + + + + private String getCodigoPreguntas() throws Exception { + Sequence sequence = new Sequence(); + String codigo = sequence.getNextValue("CEVALUACION").toString(); + return codigo; + } + + + + +} \ No newline at end of file diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/calificacion/Calificacion.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/calificacion/Calificacion.java new file mode 100644 index 0000000..564d5bc --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/calificacion/Calificacion.java @@ -0,0 +1,144 @@ +package com.fp.armas.rules.save.calificacion; + + + + +import java.util.Date; +import java.util.List; + +import org.apache.commons.validator.Msg; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.eval.TarmDetallePreguntas; +import com.fp.persistence.parmas.eval.TarmEvaluacion; +import com.fp.sessionbeans.helper.Sequence; + + +/** + * @author Andres Cevallos + * Clase que califica una evaluacion + */ +public class Calificacion extends TransactionRule { + + /** + * + */ + private static final long serialVersionUID = 1L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + TarmEvaluacion registroArma = (TarmEvaluacion) pSaveRequest.getSaveBeanModifiedObject("EVALUACION"); + List levaluacionDetalle = (List)pSaveRequest.getSaveBeanModifiedRecords("DETALLEPREGUNTAS"); + float respuestas=0; + float preguntas=0; + float porcentaje=0; + if(levaluacionDetalle==null || levaluacionDetalle.isEmpty()){ + TarmDetallePreguntas detalle=(TarmDetallePreguntas)pSaveRequest.getSaveBeanModifiedObject("DETALLEPREGUNTAS"); + levaluacionDetalle.add(detalle); + } + + + if (registroArma == null) { + + return pSaveRequest; + } + + if(registroArma.getPk()==null) + { + registroArma.setPk(getCodigoEvaluacion().toString()); + porcentaje = (float) registroArma.getModifiedData().get("aprobacion"); + + } + + for(Object deta : levaluacionDetalle){ + TarmDetallePreguntas detalle = (TarmDetallePreguntas) deta; + String valor= detalle.getModifiedData().get("valor").toString(); + if(valor.equals("Y")) + { + respuestas++; + } + preguntas++; + + } + + if(preguntas!=0){ + if((100*respuestas/preguntas)>=porcentaje){ + registroArma.setResultado("APROBADO"); + registroArma.setResultadocodigo("RESULTADO"); + Date fechaexpiracion=new Date(); + fechaexpiracion.setYear(fechaexpiracion.getYear()+2); + registroArma.setFechaexpiracion(new java.sql.Date(fechaexpiracion.getTime())); + pSaveRequest.getResponse().put("result", "APR"); + + } + else{ + registroArma.setResultado("REPROBADO"); + registroArma.setResultadocodigo("RESULTADO"); + registroArma.setFechapreox(null); + registroArma.setFechaexpiracion(null); + pSaveRequest.getResponse().put("result", "REP"); + } + PersistenceHelper.getEntityManager().persist(registroArma); + } + System.out.println("Respuestas Correctas "+respuestas+"de "+preguntas+" preguntas"); + + for(Object deta : levaluacionDetalle){ + TarmDetallePreguntas detalle = (TarmDetallePreguntas) deta; + + detalle.setPk(getCodigoDetallePreguntas()); + detalle.setCevaluacion(registroArma.getPk()); + + PersistenceHelper.getEntityManager().persist(detalle); + } + + + PersistenceHelper.getEntityManager().flush(); + + return pSaveRequest; + + + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + + + + return pSaveRequest; + } + + + + /** + * Metodo que devuelve la secuencia de una evaluacion. + * + * @return Codigo del nuevo cliente. + * @throws Exception + */ + private Long getCodigoEvaluacion() throws Exception { + Sequence sequence = new Sequence(); + Long codigo = sequence.getNextValue("CEVALUACION").longValue(); + + return codigo; + + } + + /** + * Mtodo que devuelve el detalle de las preguntas + * @return + * @throws Exception + */ + private String getCodigoDetallePreguntas() throws Exception { + Sequence sequence = new Sequence(); + String codigo = sequence.getNextValue("CDETALLEPREGUNTAS").toString(); + + return codigo; + + } + + + + +} \ No newline at end of file diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/calificacion/EvaluacionPsicologica.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/calificacion/EvaluacionPsicologica.java new file mode 100644 index 0000000..46e8513 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/calificacion/EvaluacionPsicologica.java @@ -0,0 +1,103 @@ +package com.fp.armas.rules.save.calificacion; + + + + +import java.util.List; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.eval.TarmDetallePreguntas; +import com.fp.persistence.parmas.eval.TarmEvaluacion; +import com.fp.persistence.parmas.soli.TarmGuardias; +import com.fp.sessionbeans.helper.Sequence; + + +/** + * @author Andres Cevallos + * Clase que ingresa un registro de evaluacin psicolgica y la registra + */ + +public class EvaluacionPsicologica extends TransactionRule { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /* (non-Javadoc) + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + // TarmEvaluacion registroArma = (TarmEvaluacion) pSaveRequest.getSaveBeanModifiedObject("EVALUACION"); + List levaluacion = (List)pSaveRequest.getSaveBeanModifiedRecords("EVALUACION"); + TarmGuardias guardia = (TarmGuardias) pSaveRequest.getSaveBeanModifiedObject("GUARDIAS"); + if(levaluacion==null || levaluacion.isEmpty()){ + TarmEvaluacion evaluacion = (TarmEvaluacion) pSaveRequest.getSaveBeanModifiedObject("EVALUACION"); + if (evaluacion == null) { + + return pSaveRequest; + } + levaluacion.add(evaluacion); + } + + + + + for(Object deta : levaluacion){ + TarmEvaluacion detalle = (TarmEvaluacion) deta; + if(detalle.getResultado().equalsIgnoreCase("REPROBADO")){ + detalle.setFechaexpiracion(null); + detalle.setFechapreox(null); + } + if(detalle.getPk()==null) + detalle.setPk(getCodigoPreguntas()); + + + + } + /* if(guardia!=null) + PersistenceHelper.getEntityManager().persist(guardia); + + */ + + + return pSaveRequest; + + + } + + /* (non-Javadoc) + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + + + + return pSaveRequest; + } + + + + + + /** + * Obtiene el codigo de la evaluacion + * @return + * @throws Exception + */ + private String getCodigoPreguntas() throws Exception { + Sequence sequence = new Sequence(); + String codigo = sequence.getNextValue("CEVALUACION").toString(); + + return codigo; + + } + + + + +} \ No newline at end of file diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/calificacion/EvaluarGuardia.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/calificacion/EvaluarGuardia.java new file mode 100644 index 0000000..4c55ee9 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/calificacion/EvaluarGuardia.java @@ -0,0 +1,115 @@ +package com.fp.armas.rules.save.calificacion; + + + + +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.armas.rules.save.funcionalidad.Movimiento; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.eval.TarmDetallePreguntas; +import com.fp.persistence.parmas.eval.TarmEvaluacion; +import com.fp.persistence.parmas.param.TarmComercianteCupo; +import com.fp.persistence.parmas.soli.TarmGuardias; +import com.fp.sessionbeans.helper.Sequence; + + +/** + * @author Andres Cevallos + * Clase que daclara apto o no apto a un guardia dependiendo de su evaluacion + */ +public class EvaluarGuardia extends TransactionRule { + + + private static final String JPQL_GUARDIAS = "from TarmGuardias tag" + " where tag.pk = :personcode"; + private static final String JPQL_EVALUACION= "from TarmEvaluacion tev where tev.personcode = :personcode and tev.resultado='APROBADO' and tev.tipoevaluacion = :tipoevaluacion"; + + /** + * + */ + private static final long serialVersionUID = 1L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + // TarmEvaluacion registroArma = (TarmEvaluacion) pSaveRequest.getSaveBeanModifiedObject("EVALUACION"); + List levaluacion = (List)pSaveRequest.getSaveBeanModifiedRecords("EVALUACION"); + + if(levaluacion==null || levaluacion.isEmpty()){ + TarmEvaluacion evaluacion = (TarmEvaluacion) pSaveRequest.getSaveBeanModifiedObject("EVALUACION"); + if (evaluacion == null) { + + return pSaveRequest; + } + levaluacion.add(evaluacion); + } + + for(Object deta : levaluacion){ + TarmEvaluacion detalle = (TarmEvaluacion) deta; + List lpsicologicas = findEvaluacion(PersistenceHelper.getEntityManager(), detalle.getPersoncode(), "PSICOLOGICA"); + if(lpsicologicas == null || lpsicologicas.isEmpty()){ + throw new Exception("DEBE REGISTRAR EL TEST PSICOL\u00d3GICO PRIMERO"); + } + //validacion en caso de ser guardia + List guardiasList=findGuardia(PersistenceHelper.getEntityManager(), detalle.getPersoncode()); + TarmGuardias guardia=null; + if(guardiasList!=null && guardiasList.size()>0){ + guardia=guardiasList.get(0); + guardia.setIsnew(false); + List lconocimientos = findEvaluacion(PersistenceHelper.getEntityManager(), detalle.getPersoncode(), "CONOCIMIENTO"); + if(lpsicologicas!=null && !lpsicologicas.isEmpty() && ((lconocimientos!=null && !lconocimientos.isEmpty()) || detalle.getResultado().equalsIgnoreCase("APROBADO"))){ + guardia.setEstado("APT"); + } + else{ + guardia.setEstado("NAPT"); + } + if(!guardia.isnew){ + PersistenceHelper.getEntityManager().merge(guardia); + }else{ + PersistenceHelper.getEntityManager().persist(guardia); + } + } + } + PersistenceHelper.getEntityManager().flush(); + return pSaveRequest; + } + + public static List findGuardia(EntityManager pEntityManager, Integer personcodigo) throws Exception { + + Query qry = pEntityManager.createQuery(EvaluarGuardia.JPQL_GUARDIAS); + qry.setParameter("personcode", personcodigo); + return qry.getResultList(); + } + + public static List findEvaluacion(EntityManager pEntityManager, Integer personcodigo, String tipoevaluacion) throws Exception { + + Query qry = pEntityManager.createQuery(EvaluarGuardia.JPQL_EVALUACION); + qry.setParameter("personcode", personcodigo); + qry.setParameter("tipoevaluacion", tipoevaluacion); + + return qry.getResultList(); + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + + + + + private String getCodigoPreguntas() throws Exception { + Sequence sequence = new Sequence(); + String codigo = sequence.getNextValue("CEVALUACION").toString(); + return codigo; + } + + + + +} \ No newline at end of file diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/funcionalidad/.svn/entries b/base/business/armas/src/main/java/com/fp/armas/rules/save/funcionalidad/.svn/entries new file mode 100644 index 0000000..fd76fb9 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/funcionalidad/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com/fp/armas/rules/save/funcionalidad +svn://172.17.26.185/COMACO + + + +2021-05-14T20:43:26.035487Z +4634 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +VentasVariasArmasMovimiento.java +file + + + + +2022-07-28T03:40:41.056796Z +5966eafe27f795758913c41e17c3d18c +2021-05-14T20:43:26.035487Z +4634 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +18894 + +Movimiento.java +file + + + + +2022-07-28T03:40:41.056796Z +7ff47e3c08099cb40eb1681aa160de69 +2021-05-14T20:43:26.035487Z +4634 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +18085 + +Sancionar.java +file + + + + +2022-07-28T03:40:41.056796Z +a280a6890d19ec46f469ac5bbee9b7e7 +2015-01-16T05:37:05.335772Z +3758 +cpiedra + + + + + + + + + + + + + + + + + + + + + +5637 + diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/funcionalidad/.svn/text-base/Movimiento.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/funcionalidad/.svn/text-base/Movimiento.java.svn-base new file mode 100644 index 0000000..b2a9254 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/funcionalidad/.svn/text-base/Movimiento.java.svn-base @@ -0,0 +1,355 @@ +package com.fp.armas.rules.save.funcionalidad; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Date; +import java.util.List; + +import javax.persistence.EntityManager; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.fun.TarmMovimientoArmas; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.parmas.fun.TarmVentaArmaTem; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Persiste las armas vendidas y los registros en caso de que sea venta + * @author Andres Cevallos + * + */ +public class Movimiento extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /* (non-Javadoc) + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + //Objetos que vienen llenos + TarmArmas arma = (TarmArmas) pSaveRequest.getSaveBeanModifiedObject("VENTAARMAS"); + TarmMovimientoArmas tarmMovimientoArmas=(TarmMovimientoArmas) pSaveRequest.getSaveBeanModifiedObject("MOVIMIENTO"); + if(pSaveRequest.getSaveBeanModifiedObject("VENTAARMATEMPORAL") !=null ){ + TarmVentaArmaTem venta=(TarmVentaArmaTem)pSaveRequest.getSaveBeanModifiedObject("VENTAARMATEMPORAL") ; + venta.setPk(getCodigoVentaArmaTemp()); + } + if(arma==null || (arma.getEstadoventa()!=null && arma.getEstadoventa().equals("PENVEN"))){ + return pSaveRequest; + } + + //se llenan + TarmRegistroArmas registroArmaComprador= new TarmRegistroArmas(); + ListregistroArmaCompradorList = (List)pSaveRequest.getSaveBeanModifiedRecords("TREGISTROARMAS"); + ListarmaList = (List)pSaveRequest.getSaveBeanModifiedRecords("VENTAARMAS"); + ListtotalPersonaList = (List)pSaveRequest.getSaveBeanModifiedRecords("VENTATOTALPERSONA"); + + tarmMovimientoArmas.setPk(getCodigoMovimiento()); + //Si es venta + if(tarmMovimientoArmas.getTipomovimiento().equals("VENT")){//---------------------------------------------------------------------------------------------------------------------------------- + //1 se genera un registro de arma con lo que se vende + TarmArmas armaVende= (TarmArmas)arma.cloneMe(); + armaVende.setPk(getCodigoArmas()); + armaVende.setEstado("VEND"); + armaVende.setFecharegistro(new java.sql.Date(new Date().getTime())); + if(armaVende.getCantidad()!=null && armaVende.getCantidad()>0 && armaVende.getValorAux()>0 ){ + armaVende.setCantidad(armaVende.getValorAux()); + } + if(armaVende.getPeso()!=null && armaVende.getPeso().compareTo(new BigDecimal(0))>0 && + armaVende.getPesoAux()!=null && armaVende.getPesoAux().compareTo(new BigDecimal(0))>0){ + armaVende.setPeso(armaVende.getPesoAux()); + } + //2. se genera un registro de arma con lo q queda en REG + TarmArmas armaQueda= (TarmArmas)arma.cloneMe(); + armaQueda.setPk(getCodigoArmas()); + armaQueda.setEstado("REG"); + armaQueda.setFecharegistro(new java.sql.Date(new Date().getTime())); + Integer cantidadQueda=0; + BigDecimal pesoQueda=new BigDecimal(0); + if(armaQueda.getCantidad()!=null && armaQueda.getCantidad()>0 && armaQueda.getValorAux()>0 ){ + cantidadQueda=armaQueda.getCantidad()-armaQueda.getValorAux(); + armaQueda.setCantidad(cantidadQueda); + } + if(armaQueda.getPeso()!=null && armaQueda.getPeso().compareTo(new BigDecimal(0))>0 && + armaQueda.getPesoAux()!=null && armaQueda.getPesoAux().compareTo(new BigDecimal(0))>0){ + pesoQueda=armaQueda.getPeso().subtract(armaQueda.getPesoAux()); + armaQueda.setPeso(pesoQueda); + } + //3.Nuevo TarmRegistroArma del nuevo propietario + registroArmaComprador.setPk(getCodigoRegistro()); + registroArmaComprador.setPersoncode(tarmMovimientoArmas.getPersoncodecomprador()); + registroArmaComprador.setTiporegistro(tarmMovimientoArmas.getTipomovimiento()); + registroArmaComprador.setTiporegistrocodigo("TIPOREGISTRO"); + registroArmaComprador.setFcreacion( new java.sql.Date(new Date().getTime())); + + //4.Nuevo registro Arma con el uevo propietario + TarmArmas armaNuevoPropietario= (TarmArmas)arma.cloneMe(); + armaNuevoPropietario.setPk(getCodigoArmas()); + armaNuevoPropietario.setCregistro(registroArmaComprador.getPk()); + armaNuevoPropietario.setEstado("REG"); + armaNuevoPropietario.setFecharegistro(new java.sql.Date(new Date().getTime())); + if(armaNuevoPropietario.getCantidad()!=null && armaNuevoPropietario.getCantidad()>0 && armaNuevoPropietario.getValorAux()>0 ){ + armaNuevoPropietario.setCantidad(armaNuevoPropietario.getValorAux()); + } + if(armaNuevoPropietario.getPeso()!=null && armaNuevoPropietario.getPeso().compareTo(new BigDecimal(0))>0 && + armaNuevoPropietario.getPesoAux()!=null && armaNuevoPropietario.getPesoAux().compareTo(new BigDecimal(0))>0){ + armaNuevoPropietario.setPeso(armaNuevoPropietario.getPesoAux()); + } + //5. Se genera un registro TarmTotalPersona del que vende + TarmTotalPersona totalPersonaVendedor =totalPersona(em,arma.getCtipoarmaexplosivo(),tarmMovimientoArmas.getPersoncodevendedor()); + totalPersonaVendedor.setCarma(arma.getPk()); + totalPersonaVendedor.setIngresoegreso("EGR"); + totalPersonaVendedor.setFecha(new Timestamp(new Date().getTime())); + + if(arma.getCantidad()!=null && arma.getCantidad()>0 && arma.getValorAux()>0 ){ + totalPersonaVendedor.setCantidadmovimiento(new BigDecimal(arma.getValorAux())); + if(totalPersonaVendedor.getTotal()==null){ + totalPersonaVendedor.setTotal(new BigDecimal(arma.getCantidad())); + } + } + if(arma.getPeso()!=null && arma.getPeso().compareTo(new BigDecimal(0))>0 && + arma.getPesoAux()!=null && arma.getPesoAux().compareTo(new BigDecimal(0))>0){ + totalPersonaVendedor.setCantidadmovimiento(arma.getPesoAux()); + if(totalPersonaVendedor.getTotal()==null){ + totalPersonaVendedor.setTotal(arma.getPeso()); + } + } + totalPersonaVendedor.setCmovimiento(tarmMovimientoArmas.getPk()); + totalPersonaVendedor.setSaldoanterior(totalPersonaVendedor.getTotal()); + totalPersonaVendedor.setTotal(totalPersonaVendedor.getTotal().subtract(totalPersonaVendedor.getCantidadmovimiento())); + totalPersonaVendedor.setPk(getCtotal()); + //6. Se genera un registro de ING para el comprador + TarmTotalPersona totalPersonaComprador =totalPersona(em,arma.getCtipoarmaexplosivo(),tarmMovimientoArmas.getPersoncodecomprador()); + totalPersonaComprador.setCarma(arma.getPk()); + totalPersonaComprador.setIngresoegreso("ING"); + totalPersonaComprador.setFecha(new Timestamp(new Date().getTime())); + + if(arma.getCantidad()!=null && arma.getCantidad()>0 && arma.getValorAux()>0 ){ + totalPersonaComprador.setCantidadmovimiento(new BigDecimal(arma.getValorAux())); + if(totalPersonaComprador.getTotal()==null){ + totalPersonaComprador.setTotal(new BigDecimal(0)); + } + } + if(arma.getPeso()!=null && arma.getPeso().compareTo(new BigDecimal(0))>0 && + arma.getPesoAux()!=null && arma.getPesoAux().compareTo(new BigDecimal(0))>0){ + totalPersonaComprador.setCantidadmovimiento(arma.getPesoAux()); + if(totalPersonaComprador.getTotal()==null){ + totalPersonaComprador.setTotal(new BigDecimal(0)); + } + } + totalPersonaComprador.setCmovimiento(tarmMovimientoArmas.getPk()); + totalPersonaComprador.setSaldoanterior(totalPersonaComprador.getTotal()); + totalPersonaComprador.setTotal(totalPersonaComprador.getTotal().add(totalPersonaComprador.getCantidadmovimiento())); + totalPersonaComprador.setPk(getCtotal()); + //registroarmas + registroArmaCompradorList.add(registroArmaComprador); + //se aniade las armas + armaList.add(armaVende);//VEND + armaList.add(armaQueda);//REG + armaList.add(armaNuevoPropietario);//REG + //los registros del total de persona + totalPersonaList.add(totalPersonaVendedor); + totalPersonaList.add(totalPersonaComprador); + arma=null; + }else if(tarmMovimientoArmas.getTipomovimiento().equals("CONS") || tarmMovimientoArmas.getTipomovimiento().equals("MATP") + || tarmMovimientoArmas.getTipomovimiento().equals("MAT")){//------------------------------------------------------------------------------------------------------------------------------- + System.out.println("tipo de movimiento consumidor......"+tarmMovimientoArmas.getTipomovimiento()); + if(tarmMovimientoArmas.getTipomovimiento().equals("MATP")){ + tarmMovimientoArmas.setTipomovimiento("MAT"); + } + + //1 se genera un registro de arma o explosivo de lo que se consume en estado CONS + TarmArmas armaVende= (TarmArmas)arma.cloneMe(); + armaVende.setPk(getCodigoArmas()); + //armaVende.setEstado("CONS"); + armaVende.setEstado(tarmMovimientoArmas.getTipomovimiento()); + if(tarmMovimientoArmas.getTipomovimiento().equals("MAT")){ + armaVende.setEstado("MATP"); + } + armaVende.setFecharegistro(new java.sql.Date(new Date().getTime())); + if(armaVende.getCantidad()!=null && armaVende.getCantidad()>0 && armaVende.getValorAux()>0 ){ + armaVende.setCantidad(armaVende.getValorAux()); + } + if(armaVende.getPeso()!=null && armaVende.getPeso().compareTo(new BigDecimal(0))>0 && + armaVende.getPesoAux()!=null && armaVende.getPesoAux().compareTo(new BigDecimal(0))>0){ + armaVende.setPeso(armaVende.getPesoAux()); + } + //2. se genera un registro de arma o explosivo con lo q queda en REG + TarmArmas armaQueda= (TarmArmas)arma.cloneMe(); + armaQueda.setPk(getCodigoArmas()); + armaQueda.setEstado("REG"); + armaQueda.setFecharegistro(new java.sql.Date(new Date().getTime())); + Integer cantidadQueda=0; + BigDecimal pesoQueda=new BigDecimal(0); + if(armaQueda.getCantidad()!=null && armaQueda.getCantidad()>0 && armaQueda.getValorAux()>0 ){ + cantidadQueda=armaQueda.getCantidad()-armaQueda.getValorAux(); + armaQueda.setCantidad(cantidadQueda); + } + if(armaQueda.getPeso()!=null && armaQueda.getPeso().compareTo(new BigDecimal(0))>0 && + armaQueda.getPesoAux()!=null && armaQueda.getPesoAux().compareTo(new BigDecimal(0))>0){ + pesoQueda=armaQueda.getPeso().subtract(armaQueda.getPesoAux()); + armaQueda.setPeso(pesoQueda); + } + //3. Se genera un registro TarmTotalPersona del que esta consumiendo se resta + TarmTotalPersona totalPersonaVendedor =totalPersona(em,arma.getCtipoarmaexplosivo(),tarmMovimientoArmas.getPersoncodevendedor()); + totalPersonaVendedor.setCarma(arma.getPk()); + totalPersonaVendedor.setIngresoegreso("EGR"); + totalPersonaVendedor.setFecha(new Timestamp(new Date().getTime())); + + if(arma.getCantidad()!=null && arma.getCantidad()>0 && arma.getValorAux()>0 ){ + totalPersonaVendedor.setCantidadmovimiento(new BigDecimal(arma.getValorAux())); + if(totalPersonaVendedor.getTotal()==null){ + totalPersonaVendedor.setTotal(new BigDecimal(arma.getCantidad())); + } + } + if(arma.getPeso()!=null && arma.getPeso().compareTo(new BigDecimal(0))>0 && + arma.getPesoAux()!=null && arma.getPesoAux().compareTo(new BigDecimal(0))>0){ + totalPersonaVendedor.setCantidadmovimiento(arma.getPesoAux()); + if(totalPersonaVendedor.getTotal()==null){ + totalPersonaVendedor.setTotal(arma.getPeso()); + } + } + totalPersonaVendedor.setCmovimiento(tarmMovimientoArmas.getPk()); + totalPersonaVendedor.setSaldoanterior(totalPersonaVendedor.getTotal()); + totalPersonaVendedor.setTotal(totalPersonaVendedor.getTotal().subtract(totalPersonaVendedor.getCantidadmovimiento())); + totalPersonaVendedor.setPk(getCtotal()); + + //se aniade las armas + armaList.add(armaVende);//CONS arma que consume + armaList.add(armaQueda);//REG lo que queda + //los registros del total de persona + totalPersonaList.add(totalPersonaVendedor);//total que le queda + arma=null; + }else if(tarmMovimientoArmas.getTipomovimiento().equals("TRASL")){//-------------------------------------------------------------------------------------------------------------------- + //1. se genera un registro de arma con lo q queda en REG + TarmArmas armaQueda= (TarmArmas)arma.cloneMe(); + armaQueda.setPk(getCodigoArmas()); + armaQueda.setEstado("REG"); + armaQueda.setFecharegistro(new java.sql.Date(new Date().getTime())); + Integer cantidadQueda=0; + BigDecimal pesoQueda=new BigDecimal(0); + if(armaQueda.getCantidad()!=null && armaQueda.getCantidad()>0 && armaQueda.getValorAux()>0 ){ + cantidadQueda=armaQueda.getCantidad()-armaQueda.getValorAux(); + armaQueda.setCantidad(cantidadQueda); + } + if(armaQueda.getPeso()!=null && armaQueda.getPeso().compareTo(new BigDecimal(0))>0 && + armaQueda.getPesoAux()!=null && armaQueda.getPesoAux().compareTo(new BigDecimal(0))>0){ + pesoQueda=armaQueda.getPeso().subtract(armaQueda.getPesoAux()); + armaQueda.setPeso(pesoQueda); + } + //2.Nuevo TarmRegistroArma del nuevo propietario QUE SERIA LA MISMA PERSONA SE DIVIDE el explosivo + registroArmaComprador.setPk(getCodigoRegistro()); + registroArmaComprador.setPersoncode(tarmMovimientoArmas.getPersoncodevendedor()); + registroArmaComprador.setTiporegistro(tarmMovimientoArmas.getTipomovimiento()); + registroArmaComprador.setTiporegistrocodigo("TIPOREGISTRO"); + registroArmaComprador.setFcreacion( new java.sql.Date(new Date().getTime())); + + //4.Nuevo registro Arma con el uevo propietario + TarmArmas armaNuevoPropietario= (TarmArmas)arma.cloneMe(); + armaNuevoPropietario.setPk(getCodigoArmas()); + armaNuevoPropietario.setCregistro(registroArmaComprador.getPk()); + armaNuevoPropietario.setEstado("REG"); + armaNuevoPropietario.setFecharegistro(new java.sql.Date(new Date().getTime())); + if(armaNuevoPropietario.getCantidad()!=null && armaNuevoPropietario.getCantidad()>0 && armaNuevoPropietario.getValorAux()>0 ){ + armaNuevoPropietario.setCantidad(armaNuevoPropietario.getValorAux()); + } + if(armaNuevoPropietario.getPeso()!=null && armaNuevoPropietario.getPeso().compareTo(new BigDecimal(0))>0 && + armaNuevoPropietario.getPesoAux()!=null && armaNuevoPropietario.getPesoAux().compareTo(new BigDecimal(0))>0){ + armaNuevoPropietario.setPeso(armaNuevoPropietario.getPesoAux()); + } + //registroarmas + registroArmaCompradorList.add(registroArmaComprador); + //se aniade las armas + armaList.add(armaQueda);//REG se divide el explosivo + armaList.add(armaNuevoPropietario);//REG + arma=null; + } + return pSaveRequest; + } + + public TarmTotalPersona totalPersona(EntityManager em,String ctipoarmaexplosivo,Integer personcodigo) throws Exception{ + TarmTipoArmaExplosivo armaExplosivo= TarmTipoArmaExplosivo.find(em,ctipoarmaexplosivo); + + String sql ="select t from TarmTotalPersona t where t.clase='"+armaExplosivo.getClase()+"' and t.tipoarmaexplosivo='"+armaExplosivo.getTipoarmaexplosivo()+"' and t.unidadmedidapeso='"+armaExplosivo.getUnidadmedidapeso()+"' " + + " and t.personcodigo="+personcodigo+" and t.fecha =(select max(t1.fecha) from TarmTotalPersona t1" + + " where t1.clase='"+armaExplosivo.getClase()+"' and t1.tipoarmaexplosivo='"+armaExplosivo.getTipoarmaexplosivo()+"' and t1.unidadmedidapeso='"+armaExplosivo.getUnidadmedidapeso()+"' " + + " and t1.personcodigo="+personcodigo+")"; + System.out.println("query totalPersoan....:"+sql); + ListtarmTotalPersonas= em.createQuery(sql,TarmTotalPersona.class).getResultList(); + if(tarmTotalPersonas!=null && tarmTotalPersonas.size()>0){ + return tarmTotalPersonas.get(0); + }else{ + TarmTotalPersona totalPersona= new TarmTotalPersona(); + totalPersona.setClase(armaExplosivo.getClase()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(armaExplosivo.getTipoarmaexplosivo()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setUnidadmedidapeso(armaExplosivo.getUnidadmedidapeso()); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setPersoncodigo(personcodigo); + totalPersona.setTotal(null); + totalPersona.setSaldoanterior(new BigDecimal(0)); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + return totalPersona; + } + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + return arg0; + } + + /** + * Metodo que devuelve la secuencia de un cliente. + * @return Codigo del nuevo cliente. + * @throws Exception + */ + private Long getCodigoRegistro() throws Exception { + Sequence sequence = new Sequence(); + Long codigo = sequence.getNextValue("CREGISTRO").longValue(); + return codigo; + } + + private Integer getCodigoVentaArmaTemp() throws Exception { + Sequence sequence = new Sequence(); + Integer codigo = sequence.getNextValue("TARMVENTAARMATEM").intValue(); + return codigo; + } + /** + * Obtiene el secuencial de Armas + * @return + * @throws Exception + */ + private String getCodigoArmas() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CARMA").toString(); + return codigoArma; + } + + /** + * Obtiene el secuencial de movimientos + * @return + * @throws Exception + */ + private String getCodigoMovimiento() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CMOVIMIENTO").toString(); + return codigoArma; + } + + private String getCtotal() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CTOTAL").toString(); + return codigoArma; + } +} + + + + diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/funcionalidad/.svn/text-base/Sancionar.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/funcionalidad/.svn/text-base/Sancionar.java.svn-base new file mode 100644 index 0000000..13fc568 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/funcionalidad/.svn/text-base/Sancionar.java.svn-base @@ -0,0 +1,141 @@ +package com.fp.armas.rules.save.funcionalidad; + + + + +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmTipoSancion; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmSancionDecomiso; +import com.fp.persistence.parmas.soli.TarmSancionRecomendacion; +import com.fp.sessionbeans.helper.Sequence; + + +/** + * @author Andres Cevallos + * Clase que ingresa un registro de evaluacin psicolgica y la registra + */ +/** + * @author Andres Cevallos + * + */ +public class Sancionar extends TransactionRule { + String numerosancion; + /** + * Se gestiona el estado del arma y el estado del documento habilitante + */ + private static final long serialVersionUID = 1L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + /*if (this.isNew(pSaveRequest)) { + return pSaveRequest; + }*/ + // 1 SETEO DE LOS AMPOS PARA LA SANCION TarmSancionDecomiso * + List lsanciondecomiso =(List) pSaveRequest.getSaveBeanModifiedRecords("SANCIONDECOMISO"); + // 2 RECOMENDACIONES * + List lrecomendacion = (List)pSaveRequest.getSaveBeanModifiedRecords("SANCIONRECOMENDACION"); + //3 TarmArmas Nuevo registro con el nuevo estado + List larmas = (List)pSaveRequest.getSaveBeanModifiedRecords("ARMAS"); + // 4 TarmDecomisoArma actualiza el estado + List larmasDecomisadas = (List)pSaveRequest.getSaveBeanModifiedRecords("TARMDECOMISOARMA"); + + if(lsanciondecomiso!=null && !lsanciondecomiso.isEmpty()){ + TarmSancionDecomiso sanciondecomiso = (TarmSancionDecomiso) lsanciondecomiso.get(0); + //Genera el codigo compuesto de sancion + sanciondecomiso.getPk().setCsanciondecomiso(getCodigoSancion()); + numerosancion=sanciondecomiso.getPk().getCsanciondecomiso(); + sanciondecomiso.setNoresolucion("ENV"+"-"+StringUtils.leftPad(numerosancion, 9, '0')); + //recorremos las recomendaciones + if(lrecomendacion!=null && !lrecomendacion.isEmpty()){//lrecomendacion + for(Object recomendacion : lrecomendacion){ + TarmSancionRecomendacion recomendacionObj= (TarmSancionRecomendacion) recomendacion; + recomendacionObj.setPk(getCodigoRecomendacion()); + recomendacionObj.setCsanciondecomiso(sanciondecomiso.getPk().getCsanciondecomiso()); + recomendacionObj.setCdecomiso(sanciondecomiso.getPk().getCdecomiso()); + } + } + //Registro del arma sancionada TarmArma + TarmArmas armaSancionObj=(TarmArmas) sanciondecomiso.getModifiedData().get("arma"); + armaSancionObj.setIsnew(true); + armaSancionObj.setFecharegistro(new java.sql.Date(new Date().getDate())); + armaSancionObj.setPk(getCodigoArmas()); + //VALIDAMOS EL TIPO DE SANCION + TarmTipoSancion tipoSancionObj = TarmTipoSancion.find(PersistenceHelper.getEntityManager(), sanciondecomiso.getCtiposancion()); + if(tipoSancionObj!=null){ + System.out.println("sancion ...."+tipoSancionObj.getSancion()); + if(tipoSancionObj.getSancion().equals("1")){ + // CUANDO LA SANCION ESCOGIDA ES UNA CANCELACION DE PERMISO + armaSancionObj.setEstado("CANC"); + armaSancionObj.setEstadocodigo("ESTADOARMA"); + armaSancionObj.setFecharegistro(new java.sql.Date(new Date().getTime())); + }else if(tipoSancionObj.getSancion().equals("2")){ + // CUANDO LA SANCION ESCOGIDA ES UNA SUSPENCION DE PERMISO + armaSancionObj.setEstado("SUSP"); + armaSancionObj.setEstadocodigo("ESTADOARMA"); + armaSancionObj.setFecharegistro(new java.sql.Date(new Date().getTime())); + }else if(tipoSancionObj.getSancion().equals("SANCIONSINDOC")){ + //cuando no tiene documento para sancionar se le deja en estado incautado + armaSancionObj.setEstado("INC"); + armaSancionObj.setEstadocodigo("ESTADOARMA"); + armaSancionObj.setFecharegistro(new java.sql.Date(new Date().getTime())); + }else{ + throw new Exception("SANCI\u00d3N NO ENCONTRADA : "+tipoSancionObj.getSancion()); + } + }else{ + throw new Exception("TIPO DE SANCI\u00d3N NO ENCONTRADA"); + } + larmas.add(armaSancionObj); + //Registro del armaDECOMISO TarmDecomisoArma + TarmDecomisoArma tarmDecomisoArma = (TarmDecomisoArma) armaSancionObj.getModifiedData().get("decomisoArma"); + tarmDecomisoArma.setEstado(armaSancionObj.getEstado()); + larmasDecomisadas.add(tarmDecomisoArma); + } + return pSaveRequest; + } + + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + + /** + * Obtiene el codigo de la evaluacion + * @return + * @throws Exception + */ + private String getCodigoRecomendacion() throws Exception { + Sequence sequence = new Sequence(); + String codigo = sequence.getNextValue("CSANCIONRECOMENDACION").toString(); + return codigo; + + } + + + private String getCodigoSancion() throws Exception { + Sequence sequence = new Sequence(); + String codigo = sequence.getNextValue("CSANCIONDECOMISO").toString(); + return codigo; + + } + + private String getCodigoArmas() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CARMA").toString(); + return codigoArma; + + } + + + +} \ No newline at end of file diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/funcionalidad/.svn/text-base/VentasVariasArmasMovimiento.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/funcionalidad/.svn/text-base/VentasVariasArmasMovimiento.java.svn-base new file mode 100644 index 0000000..ddb1071 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/funcionalidad/.svn/text-base/VentasVariasArmasMovimiento.java.svn-base @@ -0,0 +1,363 @@ +package com.fp.armas.rules.save.funcionalidad; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.EntityManager; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.fun.TarmMovimientoArmas; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Persiste las armas vendidas y los registros en caso de que sea venta + * @author + * + */ +public class VentasVariasArmasMovimiento extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /* (non-Javadoc) + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + + TarmMovimientoArmas tarmMovimientoArmas=(TarmMovimientoArmas)pSaveRequest.get("tarmMovimientoArmas"); + ListtarmMovimientoArmasList = (List)pSaveRequest.getSaveBeanModifiedRecords("MOVIMIENTO"); + ListregistroArmaCompradorList = (List)pSaveRequest.getSaveBeanModifiedRecords("TREGISTROARMAS"); + ListarmaList = new ArrayList<>(); + ListtotalPersonaList = (List)pSaveRequest.getSaveBeanModifiedRecords("VENTATOTALPERSONA"); + //recorremos la lista de armas + List armas = (List)pSaveRequest.getSaveBeanModifiedRecords("VENTAVARIASARMAS"); + if(armas.size()==0){ + TarmArmas armar=(TarmArmas)pSaveRequest.getSaveBeanModifiedObject("VENTAVARIASARMAS"); + armas.add(armar); + } + for (Object item : armas) { + TarmArmas arma =(TarmArmas)item; + //clonar movimiento por arma + TarmMovimientoArmas tarmMovimientoArmasclon=(TarmMovimientoArmas) tarmMovimientoArmas.cloneMe(); + tarmMovimientoArmasclon.setCarma(arma.getPk()); + tarmMovimientoArmasclon.setPk(getCodigoMovimiento()); + //se llenan + TarmRegistroArmas registroArmaComprador= new TarmRegistroArmas(); + //TODO + llenarDatosVentaArmas(tarmMovimientoArmasclon,arma,registroArmaComprador,registroArmaCompradorList,armaList,totalPersonaList,em); + + tarmMovimientoArmasList.add(tarmMovimientoArmasclon); + } + armas.addAll(armaList); + return pSaveRequest; + } + + private void llenarDatosVentaArmas(TarmMovimientoArmas tarmMovimientoArmas,TarmArmas arma, + TarmRegistroArmas registroArmaComprador,ListregistroArmaCompradorList, + ListarmaList,ListtotalPersonaList,EntityManager em) throws Exception{ + //Si es venta + if(tarmMovimientoArmas.getTipomovimiento().equals("VENT")){//---------------------------------------------------------------------------------------------------------------------------------- + //1 se genera un registro de arma con lo que se vende + TarmArmas armaVende= (TarmArmas)arma.cloneMe(); + armaVende.setPk(getCodigoArmas()); + armaVende.setEstado("VEND"); + armaVende.setFecharegistro(new java.sql.Date(new Date().getTime())); + if(armaVende.getCantidad()!=null && armaVende.getCantidad()>0 && armaVende.getValorAux()>0 ){ + armaVende.setCantidad(armaVende.getValorAux()); + } + if(armaVende.getPeso()!=null && armaVende.getPeso().compareTo(new BigDecimal(0))>0 && + armaVende.getPesoAux()!=null && armaVende.getPesoAux().compareTo(new BigDecimal(0))>0){ + armaVende.setPeso(armaVende.getPesoAux()); + } + //2. se genera un registro de arma con lo q queda en REG + TarmArmas armaQueda= (TarmArmas)arma.cloneMe(); + armaQueda.setPk(getCodigoArmas()); + armaQueda.setEstado("REG"); + armaQueda.setFecharegistro(new java.sql.Date(new Date().getTime())); + Integer cantidadQueda=0; + BigDecimal pesoQueda=new BigDecimal(0); + if(armaQueda.getCantidad()!=null && armaQueda.getCantidad()>0 && armaQueda.getValorAux()>0 ){ + cantidadQueda=armaQueda.getCantidad()-armaQueda.getValorAux(); + armaQueda.setCantidad(cantidadQueda); + } + if(armaQueda.getPeso()!=null && armaQueda.getPeso().compareTo(new BigDecimal(0))>0 && + armaQueda.getPesoAux()!=null && armaQueda.getPesoAux().compareTo(new BigDecimal(0))>0){ + pesoQueda=armaQueda.getPeso().subtract(armaQueda.getPesoAux()); + armaQueda.setPeso(pesoQueda); + } + //3.Nuevo TarmRegistroArma del nuevo propietario + registroArmaComprador.setPk(getCodigoRegistro()); + registroArmaComprador.setPersoncode(tarmMovimientoArmas.getPersoncodecomprador()); + registroArmaComprador.setTiporegistro(tarmMovimientoArmas.getTipomovimiento()); + registroArmaComprador.setTiporegistrocodigo("TIPOREGISTRO"); + registroArmaComprador.setFcreacion( new java.sql.Date(new Date().getTime())); + + //4.Nuevo registro Arma con el uevo propietario + TarmArmas armaNuevoPropietario= (TarmArmas)arma.cloneMe(); + armaNuevoPropietario.setPk(getCodigoArmas()); + armaNuevoPropietario.setCregistro(registroArmaComprador.getPk()); + armaNuevoPropietario.setEstado("REG"); + armaNuevoPropietario.setFecharegistro(new java.sql.Date(new Date().getTime())); + if(armaNuevoPropietario.getCantidad()!=null && armaNuevoPropietario.getCantidad()>0 && armaNuevoPropietario.getValorAux()>0 ){ + armaNuevoPropietario.setCantidad(armaNuevoPropietario.getValorAux()); + } + if(armaNuevoPropietario.getPeso()!=null && armaNuevoPropietario.getPeso().compareTo(new BigDecimal(0))>0 && + armaNuevoPropietario.getPesoAux()!=null && armaNuevoPropietario.getPesoAux().compareTo(new BigDecimal(0))>0){ + armaNuevoPropietario.setPeso(armaNuevoPropietario.getPesoAux()); + } + //5. Se genera un registro TarmTotalPersona del que vende + TarmTotalPersona totalPersonaVendedor =totalPersona(em,arma.getCtipoarmaexplosivo(),tarmMovimientoArmas.getPersoncodevendedor()); + totalPersonaVendedor.setCarma(arma.getPk()); + totalPersonaVendedor.setIngresoegreso("EGR"); + totalPersonaVendedor.setFecha(new Timestamp(new Date().getTime())); + + if(arma.getCantidad()!=null && arma.getCantidad()>0 && arma.getValorAux()>0 ){ + totalPersonaVendedor.setCantidadmovimiento(new BigDecimal(arma.getValorAux())); + if(totalPersonaVendedor.getTotal()==null){ + totalPersonaVendedor.setTotal(new BigDecimal(arma.getCantidad())); + } + } + if(arma.getPeso()!=null && arma.getPeso().compareTo(new BigDecimal(0))>0 && + arma.getPesoAux()!=null && arma.getPesoAux().compareTo(new BigDecimal(0))>0){ + totalPersonaVendedor.setCantidadmovimiento(arma.getPesoAux()); + if(totalPersonaVendedor.getTotal()==null){ + totalPersonaVendedor.setTotal(arma.getPeso()); + } + } + totalPersonaVendedor.setCmovimiento(tarmMovimientoArmas.getPk()); + totalPersonaVendedor.setSaldoanterior(totalPersonaVendedor.getTotal()); + totalPersonaVendedor.setTotal(totalPersonaVendedor.getTotal().subtract(totalPersonaVendedor.getCantidadmovimiento())); + totalPersonaVendedor.setPk(getCtotal()); + //6. Se genera un registro de ING para el comprador + TarmTotalPersona totalPersonaComprador =totalPersona(em,arma.getCtipoarmaexplosivo(),tarmMovimientoArmas.getPersoncodecomprador()); + totalPersonaComprador.setCarma(arma.getPk()); + totalPersonaComprador.setIngresoegreso("ING"); + totalPersonaComprador.setFecha(new Timestamp(new Date().getTime())); + + if(arma.getCantidad()!=null && arma.getCantidad()>0 && arma.getValorAux()>0 ){ + totalPersonaComprador.setCantidadmovimiento(new BigDecimal(arma.getValorAux())); + if(totalPersonaComprador.getTotal()==null){ + totalPersonaComprador.setTotal(new BigDecimal(0)); + } + } + if(arma.getPeso()!=null && arma.getPeso().compareTo(new BigDecimal(0))>0 && + arma.getPesoAux()!=null && arma.getPesoAux().compareTo(new BigDecimal(0))>0){ + totalPersonaComprador.setCantidadmovimiento(arma.getPesoAux()); + if(totalPersonaComprador.getTotal()==null){ + totalPersonaComprador.setTotal(new BigDecimal(0)); + } + } + totalPersonaComprador.setCmovimiento(tarmMovimientoArmas.getPk()); + totalPersonaComprador.setSaldoanterior(totalPersonaComprador.getTotal()); + totalPersonaComprador.setTotal(totalPersonaComprador.getTotal().add(totalPersonaComprador.getCantidadmovimiento())); + totalPersonaComprador.setPk(getCtotal()); + //registroarmas + registroArmaCompradorList.add(registroArmaComprador); + //se aniade las armas + armaList.add(armaVende);//VEND + armaList.add(armaQueda);//REG + armaList.add(armaNuevoPropietario);//REG + //los registros del total de persona + totalPersonaList.add(totalPersonaVendedor); + totalPersonaList.add(totalPersonaComprador); + arma=null; + }else if(tarmMovimientoArmas.getTipomovimiento().equals("CONS") || tarmMovimientoArmas.getTipomovimiento().equals("MATP") + || tarmMovimientoArmas.getTipomovimiento().equals("MAT")){//------------------------------------------------------------------------------------------------------------------------------- + System.out.println("tipo de movimiento consumidor......"+tarmMovimientoArmas.getTipomovimiento()); + if(tarmMovimientoArmas.getTipomovimiento().equals("MATP")){ + tarmMovimientoArmas.setTipomovimiento("MAT"); + } + + //1 se genera un registro de arma o explosivo de lo que se consume en estado CONS + TarmArmas armaVende= (TarmArmas)arma.cloneMe(); + armaVende.setPk(getCodigoArmas()); + //armaVende.setEstado("CONS"); + armaVende.setEstado(tarmMovimientoArmas.getTipomovimiento()); + if(tarmMovimientoArmas.getTipomovimiento().equals("MAT")){ + armaVende.setEstado("MATP"); + } + armaVende.setFecharegistro(new java.sql.Date(new Date().getTime())); + if(armaVende.getCantidad()!=null && armaVende.getCantidad()>0 && armaVende.getValorAux()>0 ){ + armaVende.setCantidad(armaVende.getValorAux()); + } + if(armaVende.getPeso()!=null && armaVende.getPeso().compareTo(new BigDecimal(0))>0 && + armaVende.getPesoAux()!=null && armaVende.getPesoAux().compareTo(new BigDecimal(0))>0){ + armaVende.setPeso(armaVende.getPesoAux()); + } + //2. se genera un registro de arma o explosivo con lo q queda en REG + TarmArmas armaQueda= (TarmArmas)arma.cloneMe(); + armaQueda.setPk(getCodigoArmas()); + armaQueda.setEstado("REG"); + armaQueda.setFecharegistro(new java.sql.Date(new Date().getTime())); + Integer cantidadQueda=0; + BigDecimal pesoQueda=new BigDecimal(0); + if(armaQueda.getCantidad()!=null && armaQueda.getCantidad()>0 && armaQueda.getValorAux()>0 ){ + cantidadQueda=armaQueda.getCantidad()-armaQueda.getValorAux(); + armaQueda.setCantidad(cantidadQueda); + } + if(armaQueda.getPeso()!=null && armaQueda.getPeso().compareTo(new BigDecimal(0))>0 && + armaQueda.getPesoAux()!=null && armaQueda.getPesoAux().compareTo(new BigDecimal(0))>0){ + pesoQueda=armaQueda.getPeso().subtract(armaQueda.getPesoAux()); + armaQueda.setPeso(pesoQueda); + } + //3. Se genera un registro TarmTotalPersona del que esta consumiendo se resta + TarmTotalPersona totalPersonaVendedor =totalPersona(em,arma.getCtipoarmaexplosivo(),tarmMovimientoArmas.getPersoncodevendedor()); + totalPersonaVendedor.setCarma(arma.getPk()); + totalPersonaVendedor.setIngresoegreso("EGR"); + totalPersonaVendedor.setFecha(new Timestamp(new Date().getTime())); + + if(arma.getCantidad()!=null && arma.getCantidad()>0 && arma.getValorAux()>0 ){ + totalPersonaVendedor.setCantidadmovimiento(new BigDecimal(arma.getValorAux())); + if(totalPersonaVendedor.getTotal()==null){ + totalPersonaVendedor.setTotal(new BigDecimal(arma.getCantidad())); + } + } + if(arma.getPeso()!=null && arma.getPeso().compareTo(new BigDecimal(0))>0 && + arma.getPesoAux()!=null && arma.getPesoAux().compareTo(new BigDecimal(0))>0){ + totalPersonaVendedor.setCantidadmovimiento(arma.getPesoAux()); + if(totalPersonaVendedor.getTotal()==null){ + totalPersonaVendedor.setTotal(arma.getPeso()); + } + } + totalPersonaVendedor.setCmovimiento(tarmMovimientoArmas.getPk()); + totalPersonaVendedor.setSaldoanterior(totalPersonaVendedor.getTotal()); + totalPersonaVendedor.setTotal(totalPersonaVendedor.getTotal().subtract(totalPersonaVendedor.getCantidadmovimiento())); + totalPersonaVendedor.setPk(getCtotal()); + + //se aniade las armas + armaList.add(armaVende);//CONS arma que consume + armaList.add(armaQueda);//REG lo que queda + //los registros del total de persona + totalPersonaList.add(totalPersonaVendedor);//total que le queda + arma=null; + }else if(tarmMovimientoArmas.getTipomovimiento().equals("TRASL")){//-------------------------------------------------------------------------------------------------------------------- + //1. se genera un registro de arma con lo q queda en REG + TarmArmas armaQueda= (TarmArmas)arma.cloneMe(); + armaQueda.setPk(getCodigoArmas()); + armaQueda.setEstado("REG"); + armaQueda.setFecharegistro(new java.sql.Date(new Date().getTime())); + Integer cantidadQueda=0; + BigDecimal pesoQueda=new BigDecimal(0); + if(armaQueda.getCantidad()!=null && armaQueda.getCantidad()>0 && armaQueda.getValorAux()>0 ){ + cantidadQueda=armaQueda.getCantidad()-armaQueda.getValorAux(); + armaQueda.setCantidad(cantidadQueda); + } + if(armaQueda.getPeso()!=null && armaQueda.getPeso().compareTo(new BigDecimal(0))>0 && + armaQueda.getPesoAux()!=null && armaQueda.getPesoAux().compareTo(new BigDecimal(0))>0){ + pesoQueda=armaQueda.getPeso().subtract(armaQueda.getPesoAux()); + armaQueda.setPeso(pesoQueda); + } + //2.Nuevo TarmRegistroArma del nuevo propietario QUE SERIA LA MISMA PERSONA SE DIVIDE el explosivo + registroArmaComprador.setPk(getCodigoRegistro()); + registroArmaComprador.setPersoncode(tarmMovimientoArmas.getPersoncodevendedor()); + registroArmaComprador.setTiporegistro(tarmMovimientoArmas.getTipomovimiento()); + registroArmaComprador.setTiporegistrocodigo("TIPOREGISTRO"); + registroArmaComprador.setFcreacion( new java.sql.Date(new Date().getTime())); + + //4.Nuevo registro Arma con el uevo propietario + TarmArmas armaNuevoPropietario= (TarmArmas)arma.cloneMe(); + armaNuevoPropietario.setPk(getCodigoArmas()); + armaNuevoPropietario.setCregistro(registroArmaComprador.getPk()); + armaNuevoPropietario.setEstado("REG"); + armaNuevoPropietario.setFecharegistro(new java.sql.Date(new Date().getTime())); + if(armaNuevoPropietario.getCantidad()!=null && armaNuevoPropietario.getCantidad()>0 && armaNuevoPropietario.getValorAux()>0 ){ + armaNuevoPropietario.setCantidad(armaNuevoPropietario.getValorAux()); + } + if(armaNuevoPropietario.getPeso()!=null && armaNuevoPropietario.getPeso().compareTo(new BigDecimal(0))>0 && + armaNuevoPropietario.getPesoAux()!=null && armaNuevoPropietario.getPesoAux().compareTo(new BigDecimal(0))>0){ + armaNuevoPropietario.setPeso(armaNuevoPropietario.getPesoAux()); + } + //registroarmas + registroArmaCompradorList.add(registroArmaComprador); + //se aniade las armas + armaList.add(armaQueda);//REG se divide el explosivo + armaList.add(armaNuevoPropietario);//REG + arma=null; + } + } + + public TarmTotalPersona totalPersona(EntityManager em,String ctipoarmaexplosivo,Integer personcodigo) throws Exception{ + TarmTipoArmaExplosivo armaExplosivo= TarmTipoArmaExplosivo.find(em,ctipoarmaexplosivo); + + String sql ="select t from TarmTotalPersona t where t.clase='"+armaExplosivo.getClase()+"' and t.tipoarmaexplosivo='"+armaExplosivo.getTipoarmaexplosivo()+"' and t.unidadmedidapeso='"+armaExplosivo.getUnidadmedidapeso()+"' " + + " and t.personcodigo="+personcodigo+" and t.fecha =(select max(t1.fecha) from TarmTotalPersona t1" + + " where t1.clase='"+armaExplosivo.getClase()+"' and t1.tipoarmaexplosivo='"+armaExplosivo.getTipoarmaexplosivo()+"' and t1.unidadmedidapeso='"+armaExplosivo.getUnidadmedidapeso()+"' " + + " and t1.personcodigo="+personcodigo+")"; + System.out.println("query totalPersoan....:"+sql); + ListtarmTotalPersonas= em.createQuery(sql,TarmTotalPersona.class).getResultList(); + if(tarmTotalPersonas!=null && tarmTotalPersonas.size()>0){ + return tarmTotalPersonas.get(0); + }else{ + TarmTotalPersona totalPersona= new TarmTotalPersona(); + totalPersona.setClase(armaExplosivo.getClase()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(armaExplosivo.getTipoarmaexplosivo()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setUnidadmedidapeso(armaExplosivo.getUnidadmedidapeso()); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setPersoncodigo(personcodigo); + totalPersona.setTotal(null); + totalPersona.setSaldoanterior(new BigDecimal(0)); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + return totalPersona; + } + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + return arg0; + } + + /** + * Metodo que devuelve la secuencia de un cliente. + * @return Codigo del nuevo cliente. + * @throws Exception + */ + private Long getCodigoRegistro() throws Exception { + Sequence sequence = new Sequence(); + Long codigo = sequence.getNextValue("CREGISTRO").longValue(); + return codigo; + } + + /** + * Obtiene el secuencial de Armas + * @return + * @throws Exception + */ + private String getCodigoArmas() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CARMA").toString(); + return codigoArma; + } + + /** + * Obtiene el secuencial de movimientos + * @return + * @throws Exception + */ + private String getCodigoMovimiento() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CMOVIMIENTO").toString(); + return codigoArma; + } + + private String getCtotal() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CTOTAL").toString(); + return codigoArma; + } +} + + + + diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/funcionalidad/Movimiento.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/funcionalidad/Movimiento.java new file mode 100644 index 0000000..b2a9254 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/funcionalidad/Movimiento.java @@ -0,0 +1,355 @@ +package com.fp.armas.rules.save.funcionalidad; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Date; +import java.util.List; + +import javax.persistence.EntityManager; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.fun.TarmMovimientoArmas; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.parmas.fun.TarmVentaArmaTem; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Persiste las armas vendidas y los registros en caso de que sea venta + * @author Andres Cevallos + * + */ +public class Movimiento extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /* (non-Javadoc) + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + //Objetos que vienen llenos + TarmArmas arma = (TarmArmas) pSaveRequest.getSaveBeanModifiedObject("VENTAARMAS"); + TarmMovimientoArmas tarmMovimientoArmas=(TarmMovimientoArmas) pSaveRequest.getSaveBeanModifiedObject("MOVIMIENTO"); + if(pSaveRequest.getSaveBeanModifiedObject("VENTAARMATEMPORAL") !=null ){ + TarmVentaArmaTem venta=(TarmVentaArmaTem)pSaveRequest.getSaveBeanModifiedObject("VENTAARMATEMPORAL") ; + venta.setPk(getCodigoVentaArmaTemp()); + } + if(arma==null || (arma.getEstadoventa()!=null && arma.getEstadoventa().equals("PENVEN"))){ + return pSaveRequest; + } + + //se llenan + TarmRegistroArmas registroArmaComprador= new TarmRegistroArmas(); + ListregistroArmaCompradorList = (List)pSaveRequest.getSaveBeanModifiedRecords("TREGISTROARMAS"); + ListarmaList = (List)pSaveRequest.getSaveBeanModifiedRecords("VENTAARMAS"); + ListtotalPersonaList = (List)pSaveRequest.getSaveBeanModifiedRecords("VENTATOTALPERSONA"); + + tarmMovimientoArmas.setPk(getCodigoMovimiento()); + //Si es venta + if(tarmMovimientoArmas.getTipomovimiento().equals("VENT")){//---------------------------------------------------------------------------------------------------------------------------------- + //1 se genera un registro de arma con lo que se vende + TarmArmas armaVende= (TarmArmas)arma.cloneMe(); + armaVende.setPk(getCodigoArmas()); + armaVende.setEstado("VEND"); + armaVende.setFecharegistro(new java.sql.Date(new Date().getTime())); + if(armaVende.getCantidad()!=null && armaVende.getCantidad()>0 && armaVende.getValorAux()>0 ){ + armaVende.setCantidad(armaVende.getValorAux()); + } + if(armaVende.getPeso()!=null && armaVende.getPeso().compareTo(new BigDecimal(0))>0 && + armaVende.getPesoAux()!=null && armaVende.getPesoAux().compareTo(new BigDecimal(0))>0){ + armaVende.setPeso(armaVende.getPesoAux()); + } + //2. se genera un registro de arma con lo q queda en REG + TarmArmas armaQueda= (TarmArmas)arma.cloneMe(); + armaQueda.setPk(getCodigoArmas()); + armaQueda.setEstado("REG"); + armaQueda.setFecharegistro(new java.sql.Date(new Date().getTime())); + Integer cantidadQueda=0; + BigDecimal pesoQueda=new BigDecimal(0); + if(armaQueda.getCantidad()!=null && armaQueda.getCantidad()>0 && armaQueda.getValorAux()>0 ){ + cantidadQueda=armaQueda.getCantidad()-armaQueda.getValorAux(); + armaQueda.setCantidad(cantidadQueda); + } + if(armaQueda.getPeso()!=null && armaQueda.getPeso().compareTo(new BigDecimal(0))>0 && + armaQueda.getPesoAux()!=null && armaQueda.getPesoAux().compareTo(new BigDecimal(0))>0){ + pesoQueda=armaQueda.getPeso().subtract(armaQueda.getPesoAux()); + armaQueda.setPeso(pesoQueda); + } + //3.Nuevo TarmRegistroArma del nuevo propietario + registroArmaComprador.setPk(getCodigoRegistro()); + registroArmaComprador.setPersoncode(tarmMovimientoArmas.getPersoncodecomprador()); + registroArmaComprador.setTiporegistro(tarmMovimientoArmas.getTipomovimiento()); + registroArmaComprador.setTiporegistrocodigo("TIPOREGISTRO"); + registroArmaComprador.setFcreacion( new java.sql.Date(new Date().getTime())); + + //4.Nuevo registro Arma con el uevo propietario + TarmArmas armaNuevoPropietario= (TarmArmas)arma.cloneMe(); + armaNuevoPropietario.setPk(getCodigoArmas()); + armaNuevoPropietario.setCregistro(registroArmaComprador.getPk()); + armaNuevoPropietario.setEstado("REG"); + armaNuevoPropietario.setFecharegistro(new java.sql.Date(new Date().getTime())); + if(armaNuevoPropietario.getCantidad()!=null && armaNuevoPropietario.getCantidad()>0 && armaNuevoPropietario.getValorAux()>0 ){ + armaNuevoPropietario.setCantidad(armaNuevoPropietario.getValorAux()); + } + if(armaNuevoPropietario.getPeso()!=null && armaNuevoPropietario.getPeso().compareTo(new BigDecimal(0))>0 && + armaNuevoPropietario.getPesoAux()!=null && armaNuevoPropietario.getPesoAux().compareTo(new BigDecimal(0))>0){ + armaNuevoPropietario.setPeso(armaNuevoPropietario.getPesoAux()); + } + //5. Se genera un registro TarmTotalPersona del que vende + TarmTotalPersona totalPersonaVendedor =totalPersona(em,arma.getCtipoarmaexplosivo(),tarmMovimientoArmas.getPersoncodevendedor()); + totalPersonaVendedor.setCarma(arma.getPk()); + totalPersonaVendedor.setIngresoegreso("EGR"); + totalPersonaVendedor.setFecha(new Timestamp(new Date().getTime())); + + if(arma.getCantidad()!=null && arma.getCantidad()>0 && arma.getValorAux()>0 ){ + totalPersonaVendedor.setCantidadmovimiento(new BigDecimal(arma.getValorAux())); + if(totalPersonaVendedor.getTotal()==null){ + totalPersonaVendedor.setTotal(new BigDecimal(arma.getCantidad())); + } + } + if(arma.getPeso()!=null && arma.getPeso().compareTo(new BigDecimal(0))>0 && + arma.getPesoAux()!=null && arma.getPesoAux().compareTo(new BigDecimal(0))>0){ + totalPersonaVendedor.setCantidadmovimiento(arma.getPesoAux()); + if(totalPersonaVendedor.getTotal()==null){ + totalPersonaVendedor.setTotal(arma.getPeso()); + } + } + totalPersonaVendedor.setCmovimiento(tarmMovimientoArmas.getPk()); + totalPersonaVendedor.setSaldoanterior(totalPersonaVendedor.getTotal()); + totalPersonaVendedor.setTotal(totalPersonaVendedor.getTotal().subtract(totalPersonaVendedor.getCantidadmovimiento())); + totalPersonaVendedor.setPk(getCtotal()); + //6. Se genera un registro de ING para el comprador + TarmTotalPersona totalPersonaComprador =totalPersona(em,arma.getCtipoarmaexplosivo(),tarmMovimientoArmas.getPersoncodecomprador()); + totalPersonaComprador.setCarma(arma.getPk()); + totalPersonaComprador.setIngresoegreso("ING"); + totalPersonaComprador.setFecha(new Timestamp(new Date().getTime())); + + if(arma.getCantidad()!=null && arma.getCantidad()>0 && arma.getValorAux()>0 ){ + totalPersonaComprador.setCantidadmovimiento(new BigDecimal(arma.getValorAux())); + if(totalPersonaComprador.getTotal()==null){ + totalPersonaComprador.setTotal(new BigDecimal(0)); + } + } + if(arma.getPeso()!=null && arma.getPeso().compareTo(new BigDecimal(0))>0 && + arma.getPesoAux()!=null && arma.getPesoAux().compareTo(new BigDecimal(0))>0){ + totalPersonaComprador.setCantidadmovimiento(arma.getPesoAux()); + if(totalPersonaComprador.getTotal()==null){ + totalPersonaComprador.setTotal(new BigDecimal(0)); + } + } + totalPersonaComprador.setCmovimiento(tarmMovimientoArmas.getPk()); + totalPersonaComprador.setSaldoanterior(totalPersonaComprador.getTotal()); + totalPersonaComprador.setTotal(totalPersonaComprador.getTotal().add(totalPersonaComprador.getCantidadmovimiento())); + totalPersonaComprador.setPk(getCtotal()); + //registroarmas + registroArmaCompradorList.add(registroArmaComprador); + //se aniade las armas + armaList.add(armaVende);//VEND + armaList.add(armaQueda);//REG + armaList.add(armaNuevoPropietario);//REG + //los registros del total de persona + totalPersonaList.add(totalPersonaVendedor); + totalPersonaList.add(totalPersonaComprador); + arma=null; + }else if(tarmMovimientoArmas.getTipomovimiento().equals("CONS") || tarmMovimientoArmas.getTipomovimiento().equals("MATP") + || tarmMovimientoArmas.getTipomovimiento().equals("MAT")){//------------------------------------------------------------------------------------------------------------------------------- + System.out.println("tipo de movimiento consumidor......"+tarmMovimientoArmas.getTipomovimiento()); + if(tarmMovimientoArmas.getTipomovimiento().equals("MATP")){ + tarmMovimientoArmas.setTipomovimiento("MAT"); + } + + //1 se genera un registro de arma o explosivo de lo que se consume en estado CONS + TarmArmas armaVende= (TarmArmas)arma.cloneMe(); + armaVende.setPk(getCodigoArmas()); + //armaVende.setEstado("CONS"); + armaVende.setEstado(tarmMovimientoArmas.getTipomovimiento()); + if(tarmMovimientoArmas.getTipomovimiento().equals("MAT")){ + armaVende.setEstado("MATP"); + } + armaVende.setFecharegistro(new java.sql.Date(new Date().getTime())); + if(armaVende.getCantidad()!=null && armaVende.getCantidad()>0 && armaVende.getValorAux()>0 ){ + armaVende.setCantidad(armaVende.getValorAux()); + } + if(armaVende.getPeso()!=null && armaVende.getPeso().compareTo(new BigDecimal(0))>0 && + armaVende.getPesoAux()!=null && armaVende.getPesoAux().compareTo(new BigDecimal(0))>0){ + armaVende.setPeso(armaVende.getPesoAux()); + } + //2. se genera un registro de arma o explosivo con lo q queda en REG + TarmArmas armaQueda= (TarmArmas)arma.cloneMe(); + armaQueda.setPk(getCodigoArmas()); + armaQueda.setEstado("REG"); + armaQueda.setFecharegistro(new java.sql.Date(new Date().getTime())); + Integer cantidadQueda=0; + BigDecimal pesoQueda=new BigDecimal(0); + if(armaQueda.getCantidad()!=null && armaQueda.getCantidad()>0 && armaQueda.getValorAux()>0 ){ + cantidadQueda=armaQueda.getCantidad()-armaQueda.getValorAux(); + armaQueda.setCantidad(cantidadQueda); + } + if(armaQueda.getPeso()!=null && armaQueda.getPeso().compareTo(new BigDecimal(0))>0 && + armaQueda.getPesoAux()!=null && armaQueda.getPesoAux().compareTo(new BigDecimal(0))>0){ + pesoQueda=armaQueda.getPeso().subtract(armaQueda.getPesoAux()); + armaQueda.setPeso(pesoQueda); + } + //3. Se genera un registro TarmTotalPersona del que esta consumiendo se resta + TarmTotalPersona totalPersonaVendedor =totalPersona(em,arma.getCtipoarmaexplosivo(),tarmMovimientoArmas.getPersoncodevendedor()); + totalPersonaVendedor.setCarma(arma.getPk()); + totalPersonaVendedor.setIngresoegreso("EGR"); + totalPersonaVendedor.setFecha(new Timestamp(new Date().getTime())); + + if(arma.getCantidad()!=null && arma.getCantidad()>0 && arma.getValorAux()>0 ){ + totalPersonaVendedor.setCantidadmovimiento(new BigDecimal(arma.getValorAux())); + if(totalPersonaVendedor.getTotal()==null){ + totalPersonaVendedor.setTotal(new BigDecimal(arma.getCantidad())); + } + } + if(arma.getPeso()!=null && arma.getPeso().compareTo(new BigDecimal(0))>0 && + arma.getPesoAux()!=null && arma.getPesoAux().compareTo(new BigDecimal(0))>0){ + totalPersonaVendedor.setCantidadmovimiento(arma.getPesoAux()); + if(totalPersonaVendedor.getTotal()==null){ + totalPersonaVendedor.setTotal(arma.getPeso()); + } + } + totalPersonaVendedor.setCmovimiento(tarmMovimientoArmas.getPk()); + totalPersonaVendedor.setSaldoanterior(totalPersonaVendedor.getTotal()); + totalPersonaVendedor.setTotal(totalPersonaVendedor.getTotal().subtract(totalPersonaVendedor.getCantidadmovimiento())); + totalPersonaVendedor.setPk(getCtotal()); + + //se aniade las armas + armaList.add(armaVende);//CONS arma que consume + armaList.add(armaQueda);//REG lo que queda + //los registros del total de persona + totalPersonaList.add(totalPersonaVendedor);//total que le queda + arma=null; + }else if(tarmMovimientoArmas.getTipomovimiento().equals("TRASL")){//-------------------------------------------------------------------------------------------------------------------- + //1. se genera un registro de arma con lo q queda en REG + TarmArmas armaQueda= (TarmArmas)arma.cloneMe(); + armaQueda.setPk(getCodigoArmas()); + armaQueda.setEstado("REG"); + armaQueda.setFecharegistro(new java.sql.Date(new Date().getTime())); + Integer cantidadQueda=0; + BigDecimal pesoQueda=new BigDecimal(0); + if(armaQueda.getCantidad()!=null && armaQueda.getCantidad()>0 && armaQueda.getValorAux()>0 ){ + cantidadQueda=armaQueda.getCantidad()-armaQueda.getValorAux(); + armaQueda.setCantidad(cantidadQueda); + } + if(armaQueda.getPeso()!=null && armaQueda.getPeso().compareTo(new BigDecimal(0))>0 && + armaQueda.getPesoAux()!=null && armaQueda.getPesoAux().compareTo(new BigDecimal(0))>0){ + pesoQueda=armaQueda.getPeso().subtract(armaQueda.getPesoAux()); + armaQueda.setPeso(pesoQueda); + } + //2.Nuevo TarmRegistroArma del nuevo propietario QUE SERIA LA MISMA PERSONA SE DIVIDE el explosivo + registroArmaComprador.setPk(getCodigoRegistro()); + registroArmaComprador.setPersoncode(tarmMovimientoArmas.getPersoncodevendedor()); + registroArmaComprador.setTiporegistro(tarmMovimientoArmas.getTipomovimiento()); + registroArmaComprador.setTiporegistrocodigo("TIPOREGISTRO"); + registroArmaComprador.setFcreacion( new java.sql.Date(new Date().getTime())); + + //4.Nuevo registro Arma con el uevo propietario + TarmArmas armaNuevoPropietario= (TarmArmas)arma.cloneMe(); + armaNuevoPropietario.setPk(getCodigoArmas()); + armaNuevoPropietario.setCregistro(registroArmaComprador.getPk()); + armaNuevoPropietario.setEstado("REG"); + armaNuevoPropietario.setFecharegistro(new java.sql.Date(new Date().getTime())); + if(armaNuevoPropietario.getCantidad()!=null && armaNuevoPropietario.getCantidad()>0 && armaNuevoPropietario.getValorAux()>0 ){ + armaNuevoPropietario.setCantidad(armaNuevoPropietario.getValorAux()); + } + if(armaNuevoPropietario.getPeso()!=null && armaNuevoPropietario.getPeso().compareTo(new BigDecimal(0))>0 && + armaNuevoPropietario.getPesoAux()!=null && armaNuevoPropietario.getPesoAux().compareTo(new BigDecimal(0))>0){ + armaNuevoPropietario.setPeso(armaNuevoPropietario.getPesoAux()); + } + //registroarmas + registroArmaCompradorList.add(registroArmaComprador); + //se aniade las armas + armaList.add(armaQueda);//REG se divide el explosivo + armaList.add(armaNuevoPropietario);//REG + arma=null; + } + return pSaveRequest; + } + + public TarmTotalPersona totalPersona(EntityManager em,String ctipoarmaexplosivo,Integer personcodigo) throws Exception{ + TarmTipoArmaExplosivo armaExplosivo= TarmTipoArmaExplosivo.find(em,ctipoarmaexplosivo); + + String sql ="select t from TarmTotalPersona t where t.clase='"+armaExplosivo.getClase()+"' and t.tipoarmaexplosivo='"+armaExplosivo.getTipoarmaexplosivo()+"' and t.unidadmedidapeso='"+armaExplosivo.getUnidadmedidapeso()+"' " + + " and t.personcodigo="+personcodigo+" and t.fecha =(select max(t1.fecha) from TarmTotalPersona t1" + + " where t1.clase='"+armaExplosivo.getClase()+"' and t1.tipoarmaexplosivo='"+armaExplosivo.getTipoarmaexplosivo()+"' and t1.unidadmedidapeso='"+armaExplosivo.getUnidadmedidapeso()+"' " + + " and t1.personcodigo="+personcodigo+")"; + System.out.println("query totalPersoan....:"+sql); + ListtarmTotalPersonas= em.createQuery(sql,TarmTotalPersona.class).getResultList(); + if(tarmTotalPersonas!=null && tarmTotalPersonas.size()>0){ + return tarmTotalPersonas.get(0); + }else{ + TarmTotalPersona totalPersona= new TarmTotalPersona(); + totalPersona.setClase(armaExplosivo.getClase()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(armaExplosivo.getTipoarmaexplosivo()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setUnidadmedidapeso(armaExplosivo.getUnidadmedidapeso()); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setPersoncodigo(personcodigo); + totalPersona.setTotal(null); + totalPersona.setSaldoanterior(new BigDecimal(0)); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + return totalPersona; + } + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + return arg0; + } + + /** + * Metodo que devuelve la secuencia de un cliente. + * @return Codigo del nuevo cliente. + * @throws Exception + */ + private Long getCodigoRegistro() throws Exception { + Sequence sequence = new Sequence(); + Long codigo = sequence.getNextValue("CREGISTRO").longValue(); + return codigo; + } + + private Integer getCodigoVentaArmaTemp() throws Exception { + Sequence sequence = new Sequence(); + Integer codigo = sequence.getNextValue("TARMVENTAARMATEM").intValue(); + return codigo; + } + /** + * Obtiene el secuencial de Armas + * @return + * @throws Exception + */ + private String getCodigoArmas() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CARMA").toString(); + return codigoArma; + } + + /** + * Obtiene el secuencial de movimientos + * @return + * @throws Exception + */ + private String getCodigoMovimiento() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CMOVIMIENTO").toString(); + return codigoArma; + } + + private String getCtotal() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CTOTAL").toString(); + return codigoArma; + } +} + + + + diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/funcionalidad/Sancionar.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/funcionalidad/Sancionar.java new file mode 100644 index 0000000..13fc568 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/funcionalidad/Sancionar.java @@ -0,0 +1,141 @@ +package com.fp.armas.rules.save.funcionalidad; + + + + +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmTipoSancion; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmSancionDecomiso; +import com.fp.persistence.parmas.soli.TarmSancionRecomendacion; +import com.fp.sessionbeans.helper.Sequence; + + +/** + * @author Andres Cevallos + * Clase que ingresa un registro de evaluacin psicolgica y la registra + */ +/** + * @author Andres Cevallos + * + */ +public class Sancionar extends TransactionRule { + String numerosancion; + /** + * Se gestiona el estado del arma y el estado del documento habilitante + */ + private static final long serialVersionUID = 1L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + /*if (this.isNew(pSaveRequest)) { + return pSaveRequest; + }*/ + // 1 SETEO DE LOS AMPOS PARA LA SANCION TarmSancionDecomiso * + List lsanciondecomiso =(List) pSaveRequest.getSaveBeanModifiedRecords("SANCIONDECOMISO"); + // 2 RECOMENDACIONES * + List lrecomendacion = (List)pSaveRequest.getSaveBeanModifiedRecords("SANCIONRECOMENDACION"); + //3 TarmArmas Nuevo registro con el nuevo estado + List larmas = (List)pSaveRequest.getSaveBeanModifiedRecords("ARMAS"); + // 4 TarmDecomisoArma actualiza el estado + List larmasDecomisadas = (List)pSaveRequest.getSaveBeanModifiedRecords("TARMDECOMISOARMA"); + + if(lsanciondecomiso!=null && !lsanciondecomiso.isEmpty()){ + TarmSancionDecomiso sanciondecomiso = (TarmSancionDecomiso) lsanciondecomiso.get(0); + //Genera el codigo compuesto de sancion + sanciondecomiso.getPk().setCsanciondecomiso(getCodigoSancion()); + numerosancion=sanciondecomiso.getPk().getCsanciondecomiso(); + sanciondecomiso.setNoresolucion("ENV"+"-"+StringUtils.leftPad(numerosancion, 9, '0')); + //recorremos las recomendaciones + if(lrecomendacion!=null && !lrecomendacion.isEmpty()){//lrecomendacion + for(Object recomendacion : lrecomendacion){ + TarmSancionRecomendacion recomendacionObj= (TarmSancionRecomendacion) recomendacion; + recomendacionObj.setPk(getCodigoRecomendacion()); + recomendacionObj.setCsanciondecomiso(sanciondecomiso.getPk().getCsanciondecomiso()); + recomendacionObj.setCdecomiso(sanciondecomiso.getPk().getCdecomiso()); + } + } + //Registro del arma sancionada TarmArma + TarmArmas armaSancionObj=(TarmArmas) sanciondecomiso.getModifiedData().get("arma"); + armaSancionObj.setIsnew(true); + armaSancionObj.setFecharegistro(new java.sql.Date(new Date().getDate())); + armaSancionObj.setPk(getCodigoArmas()); + //VALIDAMOS EL TIPO DE SANCION + TarmTipoSancion tipoSancionObj = TarmTipoSancion.find(PersistenceHelper.getEntityManager(), sanciondecomiso.getCtiposancion()); + if(tipoSancionObj!=null){ + System.out.println("sancion ...."+tipoSancionObj.getSancion()); + if(tipoSancionObj.getSancion().equals("1")){ + // CUANDO LA SANCION ESCOGIDA ES UNA CANCELACION DE PERMISO + armaSancionObj.setEstado("CANC"); + armaSancionObj.setEstadocodigo("ESTADOARMA"); + armaSancionObj.setFecharegistro(new java.sql.Date(new Date().getTime())); + }else if(tipoSancionObj.getSancion().equals("2")){ + // CUANDO LA SANCION ESCOGIDA ES UNA SUSPENCION DE PERMISO + armaSancionObj.setEstado("SUSP"); + armaSancionObj.setEstadocodigo("ESTADOARMA"); + armaSancionObj.setFecharegistro(new java.sql.Date(new Date().getTime())); + }else if(tipoSancionObj.getSancion().equals("SANCIONSINDOC")){ + //cuando no tiene documento para sancionar se le deja en estado incautado + armaSancionObj.setEstado("INC"); + armaSancionObj.setEstadocodigo("ESTADOARMA"); + armaSancionObj.setFecharegistro(new java.sql.Date(new Date().getTime())); + }else{ + throw new Exception("SANCI\u00d3N NO ENCONTRADA : "+tipoSancionObj.getSancion()); + } + }else{ + throw new Exception("TIPO DE SANCI\u00d3N NO ENCONTRADA"); + } + larmas.add(armaSancionObj); + //Registro del armaDECOMISO TarmDecomisoArma + TarmDecomisoArma tarmDecomisoArma = (TarmDecomisoArma) armaSancionObj.getModifiedData().get("decomisoArma"); + tarmDecomisoArma.setEstado(armaSancionObj.getEstado()); + larmasDecomisadas.add(tarmDecomisoArma); + } + return pSaveRequest; + } + + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + + /** + * Obtiene el codigo de la evaluacion + * @return + * @throws Exception + */ + private String getCodigoRecomendacion() throws Exception { + Sequence sequence = new Sequence(); + String codigo = sequence.getNextValue("CSANCIONRECOMENDACION").toString(); + return codigo; + + } + + + private String getCodigoSancion() throws Exception { + Sequence sequence = new Sequence(); + String codigo = sequence.getNextValue("CSANCIONDECOMISO").toString(); + return codigo; + + } + + private String getCodigoArmas() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CARMA").toString(); + return codigoArma; + + } + + + +} \ No newline at end of file diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/funcionalidad/VentasVariasArmasMovimiento.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/funcionalidad/VentasVariasArmasMovimiento.java new file mode 100644 index 0000000..ddb1071 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/funcionalidad/VentasVariasArmasMovimiento.java @@ -0,0 +1,363 @@ +package com.fp.armas.rules.save.funcionalidad; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.EntityManager; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.fun.TarmMovimientoArmas; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Persiste las armas vendidas y los registros en caso de que sea venta + * @author + * + */ +public class VentasVariasArmasMovimiento extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /* (non-Javadoc) + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + + TarmMovimientoArmas tarmMovimientoArmas=(TarmMovimientoArmas)pSaveRequest.get("tarmMovimientoArmas"); + ListtarmMovimientoArmasList = (List)pSaveRequest.getSaveBeanModifiedRecords("MOVIMIENTO"); + ListregistroArmaCompradorList = (List)pSaveRequest.getSaveBeanModifiedRecords("TREGISTROARMAS"); + ListarmaList = new ArrayList<>(); + ListtotalPersonaList = (List)pSaveRequest.getSaveBeanModifiedRecords("VENTATOTALPERSONA"); + //recorremos la lista de armas + List armas = (List)pSaveRequest.getSaveBeanModifiedRecords("VENTAVARIASARMAS"); + if(armas.size()==0){ + TarmArmas armar=(TarmArmas)pSaveRequest.getSaveBeanModifiedObject("VENTAVARIASARMAS"); + armas.add(armar); + } + for (Object item : armas) { + TarmArmas arma =(TarmArmas)item; + //clonar movimiento por arma + TarmMovimientoArmas tarmMovimientoArmasclon=(TarmMovimientoArmas) tarmMovimientoArmas.cloneMe(); + tarmMovimientoArmasclon.setCarma(arma.getPk()); + tarmMovimientoArmasclon.setPk(getCodigoMovimiento()); + //se llenan + TarmRegistroArmas registroArmaComprador= new TarmRegistroArmas(); + //TODO + llenarDatosVentaArmas(tarmMovimientoArmasclon,arma,registroArmaComprador,registroArmaCompradorList,armaList,totalPersonaList,em); + + tarmMovimientoArmasList.add(tarmMovimientoArmasclon); + } + armas.addAll(armaList); + return pSaveRequest; + } + + private void llenarDatosVentaArmas(TarmMovimientoArmas tarmMovimientoArmas,TarmArmas arma, + TarmRegistroArmas registroArmaComprador,ListregistroArmaCompradorList, + ListarmaList,ListtotalPersonaList,EntityManager em) throws Exception{ + //Si es venta + if(tarmMovimientoArmas.getTipomovimiento().equals("VENT")){//---------------------------------------------------------------------------------------------------------------------------------- + //1 se genera un registro de arma con lo que se vende + TarmArmas armaVende= (TarmArmas)arma.cloneMe(); + armaVende.setPk(getCodigoArmas()); + armaVende.setEstado("VEND"); + armaVende.setFecharegistro(new java.sql.Date(new Date().getTime())); + if(armaVende.getCantidad()!=null && armaVende.getCantidad()>0 && armaVende.getValorAux()>0 ){ + armaVende.setCantidad(armaVende.getValorAux()); + } + if(armaVende.getPeso()!=null && armaVende.getPeso().compareTo(new BigDecimal(0))>0 && + armaVende.getPesoAux()!=null && armaVende.getPesoAux().compareTo(new BigDecimal(0))>0){ + armaVende.setPeso(armaVende.getPesoAux()); + } + //2. se genera un registro de arma con lo q queda en REG + TarmArmas armaQueda= (TarmArmas)arma.cloneMe(); + armaQueda.setPk(getCodigoArmas()); + armaQueda.setEstado("REG"); + armaQueda.setFecharegistro(new java.sql.Date(new Date().getTime())); + Integer cantidadQueda=0; + BigDecimal pesoQueda=new BigDecimal(0); + if(armaQueda.getCantidad()!=null && armaQueda.getCantidad()>0 && armaQueda.getValorAux()>0 ){ + cantidadQueda=armaQueda.getCantidad()-armaQueda.getValorAux(); + armaQueda.setCantidad(cantidadQueda); + } + if(armaQueda.getPeso()!=null && armaQueda.getPeso().compareTo(new BigDecimal(0))>0 && + armaQueda.getPesoAux()!=null && armaQueda.getPesoAux().compareTo(new BigDecimal(0))>0){ + pesoQueda=armaQueda.getPeso().subtract(armaQueda.getPesoAux()); + armaQueda.setPeso(pesoQueda); + } + //3.Nuevo TarmRegistroArma del nuevo propietario + registroArmaComprador.setPk(getCodigoRegistro()); + registroArmaComprador.setPersoncode(tarmMovimientoArmas.getPersoncodecomprador()); + registroArmaComprador.setTiporegistro(tarmMovimientoArmas.getTipomovimiento()); + registroArmaComprador.setTiporegistrocodigo("TIPOREGISTRO"); + registroArmaComprador.setFcreacion( new java.sql.Date(new Date().getTime())); + + //4.Nuevo registro Arma con el uevo propietario + TarmArmas armaNuevoPropietario= (TarmArmas)arma.cloneMe(); + armaNuevoPropietario.setPk(getCodigoArmas()); + armaNuevoPropietario.setCregistro(registroArmaComprador.getPk()); + armaNuevoPropietario.setEstado("REG"); + armaNuevoPropietario.setFecharegistro(new java.sql.Date(new Date().getTime())); + if(armaNuevoPropietario.getCantidad()!=null && armaNuevoPropietario.getCantidad()>0 && armaNuevoPropietario.getValorAux()>0 ){ + armaNuevoPropietario.setCantidad(armaNuevoPropietario.getValorAux()); + } + if(armaNuevoPropietario.getPeso()!=null && armaNuevoPropietario.getPeso().compareTo(new BigDecimal(0))>0 && + armaNuevoPropietario.getPesoAux()!=null && armaNuevoPropietario.getPesoAux().compareTo(new BigDecimal(0))>0){ + armaNuevoPropietario.setPeso(armaNuevoPropietario.getPesoAux()); + } + //5. Se genera un registro TarmTotalPersona del que vende + TarmTotalPersona totalPersonaVendedor =totalPersona(em,arma.getCtipoarmaexplosivo(),tarmMovimientoArmas.getPersoncodevendedor()); + totalPersonaVendedor.setCarma(arma.getPk()); + totalPersonaVendedor.setIngresoegreso("EGR"); + totalPersonaVendedor.setFecha(new Timestamp(new Date().getTime())); + + if(arma.getCantidad()!=null && arma.getCantidad()>0 && arma.getValorAux()>0 ){ + totalPersonaVendedor.setCantidadmovimiento(new BigDecimal(arma.getValorAux())); + if(totalPersonaVendedor.getTotal()==null){ + totalPersonaVendedor.setTotal(new BigDecimal(arma.getCantidad())); + } + } + if(arma.getPeso()!=null && arma.getPeso().compareTo(new BigDecimal(0))>0 && + arma.getPesoAux()!=null && arma.getPesoAux().compareTo(new BigDecimal(0))>0){ + totalPersonaVendedor.setCantidadmovimiento(arma.getPesoAux()); + if(totalPersonaVendedor.getTotal()==null){ + totalPersonaVendedor.setTotal(arma.getPeso()); + } + } + totalPersonaVendedor.setCmovimiento(tarmMovimientoArmas.getPk()); + totalPersonaVendedor.setSaldoanterior(totalPersonaVendedor.getTotal()); + totalPersonaVendedor.setTotal(totalPersonaVendedor.getTotal().subtract(totalPersonaVendedor.getCantidadmovimiento())); + totalPersonaVendedor.setPk(getCtotal()); + //6. Se genera un registro de ING para el comprador + TarmTotalPersona totalPersonaComprador =totalPersona(em,arma.getCtipoarmaexplosivo(),tarmMovimientoArmas.getPersoncodecomprador()); + totalPersonaComprador.setCarma(arma.getPk()); + totalPersonaComprador.setIngresoegreso("ING"); + totalPersonaComprador.setFecha(new Timestamp(new Date().getTime())); + + if(arma.getCantidad()!=null && arma.getCantidad()>0 && arma.getValorAux()>0 ){ + totalPersonaComprador.setCantidadmovimiento(new BigDecimal(arma.getValorAux())); + if(totalPersonaComprador.getTotal()==null){ + totalPersonaComprador.setTotal(new BigDecimal(0)); + } + } + if(arma.getPeso()!=null && arma.getPeso().compareTo(new BigDecimal(0))>0 && + arma.getPesoAux()!=null && arma.getPesoAux().compareTo(new BigDecimal(0))>0){ + totalPersonaComprador.setCantidadmovimiento(arma.getPesoAux()); + if(totalPersonaComprador.getTotal()==null){ + totalPersonaComprador.setTotal(new BigDecimal(0)); + } + } + totalPersonaComprador.setCmovimiento(tarmMovimientoArmas.getPk()); + totalPersonaComprador.setSaldoanterior(totalPersonaComprador.getTotal()); + totalPersonaComprador.setTotal(totalPersonaComprador.getTotal().add(totalPersonaComprador.getCantidadmovimiento())); + totalPersonaComprador.setPk(getCtotal()); + //registroarmas + registroArmaCompradorList.add(registroArmaComprador); + //se aniade las armas + armaList.add(armaVende);//VEND + armaList.add(armaQueda);//REG + armaList.add(armaNuevoPropietario);//REG + //los registros del total de persona + totalPersonaList.add(totalPersonaVendedor); + totalPersonaList.add(totalPersonaComprador); + arma=null; + }else if(tarmMovimientoArmas.getTipomovimiento().equals("CONS") || tarmMovimientoArmas.getTipomovimiento().equals("MATP") + || tarmMovimientoArmas.getTipomovimiento().equals("MAT")){//------------------------------------------------------------------------------------------------------------------------------- + System.out.println("tipo de movimiento consumidor......"+tarmMovimientoArmas.getTipomovimiento()); + if(tarmMovimientoArmas.getTipomovimiento().equals("MATP")){ + tarmMovimientoArmas.setTipomovimiento("MAT"); + } + + //1 se genera un registro de arma o explosivo de lo que se consume en estado CONS + TarmArmas armaVende= (TarmArmas)arma.cloneMe(); + armaVende.setPk(getCodigoArmas()); + //armaVende.setEstado("CONS"); + armaVende.setEstado(tarmMovimientoArmas.getTipomovimiento()); + if(tarmMovimientoArmas.getTipomovimiento().equals("MAT")){ + armaVende.setEstado("MATP"); + } + armaVende.setFecharegistro(new java.sql.Date(new Date().getTime())); + if(armaVende.getCantidad()!=null && armaVende.getCantidad()>0 && armaVende.getValorAux()>0 ){ + armaVende.setCantidad(armaVende.getValorAux()); + } + if(armaVende.getPeso()!=null && armaVende.getPeso().compareTo(new BigDecimal(0))>0 && + armaVende.getPesoAux()!=null && armaVende.getPesoAux().compareTo(new BigDecimal(0))>0){ + armaVende.setPeso(armaVende.getPesoAux()); + } + //2. se genera un registro de arma o explosivo con lo q queda en REG + TarmArmas armaQueda= (TarmArmas)arma.cloneMe(); + armaQueda.setPk(getCodigoArmas()); + armaQueda.setEstado("REG"); + armaQueda.setFecharegistro(new java.sql.Date(new Date().getTime())); + Integer cantidadQueda=0; + BigDecimal pesoQueda=new BigDecimal(0); + if(armaQueda.getCantidad()!=null && armaQueda.getCantidad()>0 && armaQueda.getValorAux()>0 ){ + cantidadQueda=armaQueda.getCantidad()-armaQueda.getValorAux(); + armaQueda.setCantidad(cantidadQueda); + } + if(armaQueda.getPeso()!=null && armaQueda.getPeso().compareTo(new BigDecimal(0))>0 && + armaQueda.getPesoAux()!=null && armaQueda.getPesoAux().compareTo(new BigDecimal(0))>0){ + pesoQueda=armaQueda.getPeso().subtract(armaQueda.getPesoAux()); + armaQueda.setPeso(pesoQueda); + } + //3. Se genera un registro TarmTotalPersona del que esta consumiendo se resta + TarmTotalPersona totalPersonaVendedor =totalPersona(em,arma.getCtipoarmaexplosivo(),tarmMovimientoArmas.getPersoncodevendedor()); + totalPersonaVendedor.setCarma(arma.getPk()); + totalPersonaVendedor.setIngresoegreso("EGR"); + totalPersonaVendedor.setFecha(new Timestamp(new Date().getTime())); + + if(arma.getCantidad()!=null && arma.getCantidad()>0 && arma.getValorAux()>0 ){ + totalPersonaVendedor.setCantidadmovimiento(new BigDecimal(arma.getValorAux())); + if(totalPersonaVendedor.getTotal()==null){ + totalPersonaVendedor.setTotal(new BigDecimal(arma.getCantidad())); + } + } + if(arma.getPeso()!=null && arma.getPeso().compareTo(new BigDecimal(0))>0 && + arma.getPesoAux()!=null && arma.getPesoAux().compareTo(new BigDecimal(0))>0){ + totalPersonaVendedor.setCantidadmovimiento(arma.getPesoAux()); + if(totalPersonaVendedor.getTotal()==null){ + totalPersonaVendedor.setTotal(arma.getPeso()); + } + } + totalPersonaVendedor.setCmovimiento(tarmMovimientoArmas.getPk()); + totalPersonaVendedor.setSaldoanterior(totalPersonaVendedor.getTotal()); + totalPersonaVendedor.setTotal(totalPersonaVendedor.getTotal().subtract(totalPersonaVendedor.getCantidadmovimiento())); + totalPersonaVendedor.setPk(getCtotal()); + + //se aniade las armas + armaList.add(armaVende);//CONS arma que consume + armaList.add(armaQueda);//REG lo que queda + //los registros del total de persona + totalPersonaList.add(totalPersonaVendedor);//total que le queda + arma=null; + }else if(tarmMovimientoArmas.getTipomovimiento().equals("TRASL")){//-------------------------------------------------------------------------------------------------------------------- + //1. se genera un registro de arma con lo q queda en REG + TarmArmas armaQueda= (TarmArmas)arma.cloneMe(); + armaQueda.setPk(getCodigoArmas()); + armaQueda.setEstado("REG"); + armaQueda.setFecharegistro(new java.sql.Date(new Date().getTime())); + Integer cantidadQueda=0; + BigDecimal pesoQueda=new BigDecimal(0); + if(armaQueda.getCantidad()!=null && armaQueda.getCantidad()>0 && armaQueda.getValorAux()>0 ){ + cantidadQueda=armaQueda.getCantidad()-armaQueda.getValorAux(); + armaQueda.setCantidad(cantidadQueda); + } + if(armaQueda.getPeso()!=null && armaQueda.getPeso().compareTo(new BigDecimal(0))>0 && + armaQueda.getPesoAux()!=null && armaQueda.getPesoAux().compareTo(new BigDecimal(0))>0){ + pesoQueda=armaQueda.getPeso().subtract(armaQueda.getPesoAux()); + armaQueda.setPeso(pesoQueda); + } + //2.Nuevo TarmRegistroArma del nuevo propietario QUE SERIA LA MISMA PERSONA SE DIVIDE el explosivo + registroArmaComprador.setPk(getCodigoRegistro()); + registroArmaComprador.setPersoncode(tarmMovimientoArmas.getPersoncodevendedor()); + registroArmaComprador.setTiporegistro(tarmMovimientoArmas.getTipomovimiento()); + registroArmaComprador.setTiporegistrocodigo("TIPOREGISTRO"); + registroArmaComprador.setFcreacion( new java.sql.Date(new Date().getTime())); + + //4.Nuevo registro Arma con el uevo propietario + TarmArmas armaNuevoPropietario= (TarmArmas)arma.cloneMe(); + armaNuevoPropietario.setPk(getCodigoArmas()); + armaNuevoPropietario.setCregistro(registroArmaComprador.getPk()); + armaNuevoPropietario.setEstado("REG"); + armaNuevoPropietario.setFecharegistro(new java.sql.Date(new Date().getTime())); + if(armaNuevoPropietario.getCantidad()!=null && armaNuevoPropietario.getCantidad()>0 && armaNuevoPropietario.getValorAux()>0 ){ + armaNuevoPropietario.setCantidad(armaNuevoPropietario.getValorAux()); + } + if(armaNuevoPropietario.getPeso()!=null && armaNuevoPropietario.getPeso().compareTo(new BigDecimal(0))>0 && + armaNuevoPropietario.getPesoAux()!=null && armaNuevoPropietario.getPesoAux().compareTo(new BigDecimal(0))>0){ + armaNuevoPropietario.setPeso(armaNuevoPropietario.getPesoAux()); + } + //registroarmas + registroArmaCompradorList.add(registroArmaComprador); + //se aniade las armas + armaList.add(armaQueda);//REG se divide el explosivo + armaList.add(armaNuevoPropietario);//REG + arma=null; + } + } + + public TarmTotalPersona totalPersona(EntityManager em,String ctipoarmaexplosivo,Integer personcodigo) throws Exception{ + TarmTipoArmaExplosivo armaExplosivo= TarmTipoArmaExplosivo.find(em,ctipoarmaexplosivo); + + String sql ="select t from TarmTotalPersona t where t.clase='"+armaExplosivo.getClase()+"' and t.tipoarmaexplosivo='"+armaExplosivo.getTipoarmaexplosivo()+"' and t.unidadmedidapeso='"+armaExplosivo.getUnidadmedidapeso()+"' " + + " and t.personcodigo="+personcodigo+" and t.fecha =(select max(t1.fecha) from TarmTotalPersona t1" + + " where t1.clase='"+armaExplosivo.getClase()+"' and t1.tipoarmaexplosivo='"+armaExplosivo.getTipoarmaexplosivo()+"' and t1.unidadmedidapeso='"+armaExplosivo.getUnidadmedidapeso()+"' " + + " and t1.personcodigo="+personcodigo+")"; + System.out.println("query totalPersoan....:"+sql); + ListtarmTotalPersonas= em.createQuery(sql,TarmTotalPersona.class).getResultList(); + if(tarmTotalPersonas!=null && tarmTotalPersonas.size()>0){ + return tarmTotalPersonas.get(0); + }else{ + TarmTotalPersona totalPersona= new TarmTotalPersona(); + totalPersona.setClase(armaExplosivo.getClase()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(armaExplosivo.getTipoarmaexplosivo()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setUnidadmedidapeso(armaExplosivo.getUnidadmedidapeso()); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setPersoncodigo(personcodigo); + totalPersona.setTotal(null); + totalPersona.setSaldoanterior(new BigDecimal(0)); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + return totalPersona; + } + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + return arg0; + } + + /** + * Metodo que devuelve la secuencia de un cliente. + * @return Codigo del nuevo cliente. + * @throws Exception + */ + private Long getCodigoRegistro() throws Exception { + Sequence sequence = new Sequence(); + Long codigo = sequence.getNextValue("CREGISTRO").longValue(); + return codigo; + } + + /** + * Obtiene el secuencial de Armas + * @return + * @throws Exception + */ + private String getCodigoArmas() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CARMA").toString(); + return codigoArma; + } + + /** + * Obtiene el secuencial de movimientos + * @return + * @throws Exception + */ + private String getCodigoMovimiento() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CMOVIMIENTO").toString(); + return codigoArma; + } + + private String getCtotal() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CTOTAL").toString(); + return codigoArma; + } +} + + + + diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/inspeccion/.svn/entries b/base/business/armas/src/main/java/com/fp/armas/rules/save/inspeccion/.svn/entries new file mode 100644 index 0000000..34e16e9 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/inspeccion/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com/fp/armas/rules/save/inspeccion +svn://172.17.26.185/COMACO + + + +2015-06-23T07:14:38.225355Z +4126 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ModificarPlanificacionInspeccionSave.java +file + + + + +2022-07-28T03:40:41.237796Z +c2199df493c2f9e829a430a8fcc53eb0 +2014-11-18T10:14:48.923978Z +2917 +ogarcia + + + + + + + + + + + + + + + + + + + + + +1435 + +PlanificacionInspeccionSave.java +file + + + + +2022-07-28T03:40:41.237796Z +4b10307a3898b82ee5c96e4ca8a45e08 +2015-06-23T07:14:38.225355Z +4126 +cpiedra + + + + + + + + + + + + + + + + + + + + + +2303 + diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/inspeccion/.svn/text-base/ModificarPlanificacionInspeccionSave.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/inspeccion/.svn/text-base/ModificarPlanificacionInspeccionSave.java.svn-base new file mode 100644 index 0000000..65c85f2 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/inspeccion/.svn/text-base/ModificarPlanificacionInspeccionSave.java.svn-base @@ -0,0 +1,46 @@ +package com.fp.armas.rules.save.inspeccion; + +import java.util.ArrayList; +import java.util.List; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.ins.TarmPlanificacionInspeccion; +import com.fp.persistence.parmas.ins.TarmPlanificacionTramite; +import com.fp.persistence.pcustomer.company.TcustCompany; +import com.fp.sessionbeans.helper.Sequence; + +public class ModificarPlanificacionInspeccionSave extends TransactionRule { + + private static final long serialVersionUID = 1L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + try { + @SuppressWarnings({"unchecked" }) + List inspecciones=(ArrayList)pSaveRequest.get("INSPECCIONES"); + + //Persistieno las inspecciones + for (TarmPlanificacionTramite inspeccion : inspecciones) { + inspeccion=(TarmPlanificacionTramite)PersistenceHelper.getEntityManager().merge(inspeccion); + PersistenceHelper.getEntityManager().persist(inspeccion); + } + + PersistenceHelper.getEntityManager().flush(); + + } catch (Exception e) { + return pSaveRequest; + } + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + + return arg0; + } + + + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/inspeccion/.svn/text-base/PlanificacionInspeccionSave.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/inspeccion/.svn/text-base/PlanificacionInspeccionSave.java.svn-base new file mode 100644 index 0000000..9e1cb8b --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/inspeccion/.svn/text-base/PlanificacionInspeccionSave.java.svn-base @@ -0,0 +1,67 @@ +package com.fp.armas.rules.save.inspeccion; + +import java.util.ArrayList; +import java.util.List; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.ins.TarmPlanificacionInspeccion; +import com.fp.persistence.parmas.ins.TarmPlanificacionTramite; +import com.fp.sessionbeans.helper.Sequence; + +public class PlanificacionInspeccionSave extends TransactionRule { + + private static final long serialVersionUID = 1L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + try { + TarmPlanificacionInspeccion planificacion=(TarmPlanificacionInspeccion)pSaveRequest.get("PLANIFICACION"); + + @SuppressWarnings({"unchecked" }) + List inspecciones=(ArrayList)pSaveRequest.get("INSPECCIONES"); + + //Persistiendo la planificacion + String cplanificacion = null; + Sequence sequence = new Sequence(); + Integer valor=Integer.valueOf(sequence.getNextValue("CPLANIFICACION").toString()); + if(valor!=null){ + cplanificacion=valor.toString(); + planificacion.setPk(Long.parseLong(cplanificacion)); + PersistenceHelper.getEntityManager().persist(planificacion); + } + + pSaveRequest.getResponse().put("CPLANIFICACION", planificacion.getPk()); + + //Persistieno las inspecciones + for (TarmPlanificacionTramite inspeccion : inspecciones) { + inspeccion.setCplanificacion(planificacion.getPk()); + + String cplanificaciontramite = null; + sequence = new Sequence(); + valor=Integer.valueOf(sequence.getNextValue("CPLANIFICACIONTRAMITE").toString()); + if(valor!=null){ + cplanificaciontramite=valor.toString(); + inspeccion.setPk(Long.parseLong(cplanificaciontramite)); + PersistenceHelper.getEntityManager().persist(inspeccion); + } + } + + PersistenceHelper.getEntityManager().flush(); + + } catch (Exception e) { + return pSaveRequest; + } + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + + return arg0; + } + + + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/inspeccion/ModificarPlanificacionInspeccionSave.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/inspeccion/ModificarPlanificacionInspeccionSave.java new file mode 100644 index 0000000..65c85f2 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/inspeccion/ModificarPlanificacionInspeccionSave.java @@ -0,0 +1,46 @@ +package com.fp.armas.rules.save.inspeccion; + +import java.util.ArrayList; +import java.util.List; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.ins.TarmPlanificacionInspeccion; +import com.fp.persistence.parmas.ins.TarmPlanificacionTramite; +import com.fp.persistence.pcustomer.company.TcustCompany; +import com.fp.sessionbeans.helper.Sequence; + +public class ModificarPlanificacionInspeccionSave extends TransactionRule { + + private static final long serialVersionUID = 1L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + try { + @SuppressWarnings({"unchecked" }) + List inspecciones=(ArrayList)pSaveRequest.get("INSPECCIONES"); + + //Persistieno las inspecciones + for (TarmPlanificacionTramite inspeccion : inspecciones) { + inspeccion=(TarmPlanificacionTramite)PersistenceHelper.getEntityManager().merge(inspeccion); + PersistenceHelper.getEntityManager().persist(inspeccion); + } + + PersistenceHelper.getEntityManager().flush(); + + } catch (Exception e) { + return pSaveRequest; + } + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + + return arg0; + } + + + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/inspeccion/PlanificacionInspeccionSave.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/inspeccion/PlanificacionInspeccionSave.java new file mode 100644 index 0000000..9e1cb8b --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/inspeccion/PlanificacionInspeccionSave.java @@ -0,0 +1,67 @@ +package com.fp.armas.rules.save.inspeccion; + +import java.util.ArrayList; +import java.util.List; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.ins.TarmPlanificacionInspeccion; +import com.fp.persistence.parmas.ins.TarmPlanificacionTramite; +import com.fp.sessionbeans.helper.Sequence; + +public class PlanificacionInspeccionSave extends TransactionRule { + + private static final long serialVersionUID = 1L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + try { + TarmPlanificacionInspeccion planificacion=(TarmPlanificacionInspeccion)pSaveRequest.get("PLANIFICACION"); + + @SuppressWarnings({"unchecked" }) + List inspecciones=(ArrayList)pSaveRequest.get("INSPECCIONES"); + + //Persistiendo la planificacion + String cplanificacion = null; + Sequence sequence = new Sequence(); + Integer valor=Integer.valueOf(sequence.getNextValue("CPLANIFICACION").toString()); + if(valor!=null){ + cplanificacion=valor.toString(); + planificacion.setPk(Long.parseLong(cplanificacion)); + PersistenceHelper.getEntityManager().persist(planificacion); + } + + pSaveRequest.getResponse().put("CPLANIFICACION", planificacion.getPk()); + + //Persistieno las inspecciones + for (TarmPlanificacionTramite inspeccion : inspecciones) { + inspeccion.setCplanificacion(planificacion.getPk()); + + String cplanificaciontramite = null; + sequence = new Sequence(); + valor=Integer.valueOf(sequence.getNextValue("CPLANIFICACIONTRAMITE").toString()); + if(valor!=null){ + cplanificaciontramite=valor.toString(); + inspeccion.setPk(Long.parseLong(cplanificaciontramite)); + PersistenceHelper.getEntityManager().persist(inspeccion); + } + } + + PersistenceHelper.getEntityManager().flush(); + + } catch (Exception e) { + return pSaveRequest; + } + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + + return arg0; + } + + + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/pcustomer/.svn/entries b/base/business/armas/src/main/java/com/fp/armas/rules/save/pcustomer/.svn/entries new file mode 100644 index 0000000..ae0d78d --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/pcustomer/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com/fp/armas/rules/save/pcustomer +svn://172.17.26.185/COMACO + + + +2014-11-11T05:47:16.298444Z +2586 +ogarcia + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +PeopleFastSave.java +file + + + + +2022-07-28T03:40:41.077796Z +96140636517d8fd8e8234cfb97137e01 +2014-11-11T05:47:16.298444Z +2586 +ogarcia + + + + + + + + + + + + + + + + + + + + + +5792 + diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/pcustomer/.svn/text-base/PeopleFastSave.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/pcustomer/.svn/text-base/PeopleFastSave.java.svn-base new file mode 100644 index 0000000..de683b5 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/pcustomer/.svn/text-base/PeopleFastSave.java.svn-base @@ -0,0 +1,138 @@ +package com.fp.armas.rules.save.pcustomer; + +import java.sql.Date; +import java.sql.Timestamp; +import java.util.Calendar; + +import org.apache.velocity.texen.util.FileUtil; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.image.TgeneFiles; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.image.TgeneFilesDetailKey; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import com.fp.sessionbeans.helper.Sequence; + +public class PeopleFastSave extends TransactionRule { + private static final long serialVersionUID = 1L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + try { + /* + TcustPersonDetail d=(TcustPersonDetail)pSaveRequest.get("DETALLESPERSONA"); + TcustPersonDetail personaBD=PersistenceHelper.getEntityManager().find(TcustPersonDetail.class, d.getPk()); + byte[] photo=(byte[])pSaveRequest.get("PHOTO"); + String extension=pSaveRequest.get("EXTENSION").toString(); + TsafeUserDetail usuario=(TsafeUserDetail)pSaveRequest.get("USUARIO"); + + //Seteando los campos + personaBD.setActivitycode(d.getActivitycode()); + personaBD.setBranchcode(d.getBranchcode()); + personaBD.setClienttypecatalog(d.getClienttypecatalog()); + personaBD.setClienttypecatalogcode(d.getClienttypecatalogcode()); + personaBD.setCompanycode(d.getCompanycode()); + personaBD.setDateexpidentification(d.getDateexpidentification()); + personaBD.setDatefrom(d.getDatefrom()); + personaBD.setEconomicsectorcatalog(d.getEconomicsectorcatalog()); + personaBD.setEconomicsectorcatalogcode(d.getEconomicsectorcatalogcode()); + personaBD.setIdentification(d.getIdentification()); + personaBD.setIdentificationcatalog(d.getIdentificationcatalog()); + personaBD.setIdentificationcatalogcode(d.getIdentificationcatalogcode()); + personaBD.setIngressuser(d.getIngressuser()); + personaBD.setInnerscore(d.getInnerscore()); + personaBD.setIsmigrated(d.getIsmigrated()); + personaBD.setLanguagecode(d.getLanguagecode()); + personaBD.setLegalrepresent(d.getLegalrepresent()); + personaBD.setLegalrepresentidentification(d.getLegalrepresentidentification()); + personaBD.setMilitarygrade(d.getMilitarygrade()); + personaBD.setMilitarygradecode(d.getMilitarygradecode()); + personaBD.setModifyuser(d.getModifyuser()); + personaBD.setName(d.getName()); + personaBD.setNickname(d.getNickname()); + personaBD.setOfficecode(d.getOfficecode()); + personaBD.setParthnernumber(d.getParthnernumber()); + personaBD.setPersontypecatalog(d.getPersontypecatalog()); + personaBD.setPersontypecatalogcode(d.getPersontypecatalogcode()); + + personaBD.setRecordversion(d.getRecordversion()); + personaBD.setRegisterdate(d.getRegisterdate()); + personaBD.setSbsemployee(d.getSbsemployee()); + personaBD.setSbsusercode(d.getSbsusercode()); + personaBD.setSign(d.getSign()); + personaBD.setTaxexempt(d.getTaxexempt()); + //personaBD.setPicture(d.getPicture()); + + //Asginando la foto + if(photo!=null){ + + //Creando un nuevo archivo + TgeneFilesDetail archivoActual=new TgeneFilesDetail(); + + //Caso de que exista un arhivo anterior + if(personaBD.getPhoto()!=null){ + + TgeneFilesDetail archivoAnterior=PersistenceHelper.getEntityManager().find(TgeneFilesDetail.class, personaBD.getPhoto()); + archivoAnterior.getPk().setDateto(new java.sql.Timestamp(Calendar.getInstance().getTimeInMillis())); + PersistenceHelper.getEntityManager().persist(archivoAnterior); + + archivoActual.setPk(archivoAnterior.getPk()); + archivoActual.setDatefrom(archivoAnterior.getDatefrom()); + archivoActual.setIngressuser(archivoAnterior.getIngressuser()); + } + + //Creando un nuevo TEGENEFILES + Sequence sequence = new Sequence(); + Integer code=sequence.getNextValue("CODE"); + TgeneFiles file=new TgeneFiles(); + file.setPk(code); + //PersistenceHelper.getEntityManager().persist(file); + + //Creando el pk del TGENEFILEDETAIL + TgeneFilesDetailKey pk=new TgeneFilesDetailKey(); + + pk.setCode(code); + + Calendar calendario=Calendar.getInstance(); + calendario.set(Calendar.MONTH, Calendar.DECEMBER); + calendario.set(Calendar.DAY_OF_MONTH, 31); + calendario.set(Calendar.YEAR, 2999); + + pk.setDateto(new Timestamp(calendario.getTimeInMillis())); + archivoActual.setPk(pk); + + archivoActual.setImage(photo); + archivoActual.setExtension(extension); + archivoActual.setImagesize(photo.length); + archivoActual.setCapturedate(new Date(Calendar.getInstance().getTimeInMillis())); + archivoActual.setModifyuser(usuario.getPk().getUsercode()); + archivoActual.setDescription("Foto de la persona"); + archivoActual.setContenttype("image/"+extension.substring(1,extension.length())); + + //PersistenceHelper.getEntityManager().persist(archivoActual); + } + + if(personaBD.getPk()!=null && personaBD.getPk().getPersoncode()!=null){ + personaBD=PersistenceHelper.getEntityManager().merge(personaBD); + PersistenceHelper.getEntityManager().persist(personaBD); + } + + PersistenceHelper.getEntityManager().flush(); + */ + + } catch (Exception e) { + return pSaveRequest; + } + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + + return arg0; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/pcustomer/PeopleFastSave.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/pcustomer/PeopleFastSave.java new file mode 100644 index 0000000..de683b5 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/pcustomer/PeopleFastSave.java @@ -0,0 +1,138 @@ +package com.fp.armas.rules.save.pcustomer; + +import java.sql.Date; +import java.sql.Timestamp; +import java.util.Calendar; + +import org.apache.velocity.texen.util.FileUtil; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.image.TgeneFiles; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.image.TgeneFilesDetailKey; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import com.fp.sessionbeans.helper.Sequence; + +public class PeopleFastSave extends TransactionRule { + private static final long serialVersionUID = 1L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + try { + /* + TcustPersonDetail d=(TcustPersonDetail)pSaveRequest.get("DETALLESPERSONA"); + TcustPersonDetail personaBD=PersistenceHelper.getEntityManager().find(TcustPersonDetail.class, d.getPk()); + byte[] photo=(byte[])pSaveRequest.get("PHOTO"); + String extension=pSaveRequest.get("EXTENSION").toString(); + TsafeUserDetail usuario=(TsafeUserDetail)pSaveRequest.get("USUARIO"); + + //Seteando los campos + personaBD.setActivitycode(d.getActivitycode()); + personaBD.setBranchcode(d.getBranchcode()); + personaBD.setClienttypecatalog(d.getClienttypecatalog()); + personaBD.setClienttypecatalogcode(d.getClienttypecatalogcode()); + personaBD.setCompanycode(d.getCompanycode()); + personaBD.setDateexpidentification(d.getDateexpidentification()); + personaBD.setDatefrom(d.getDatefrom()); + personaBD.setEconomicsectorcatalog(d.getEconomicsectorcatalog()); + personaBD.setEconomicsectorcatalogcode(d.getEconomicsectorcatalogcode()); + personaBD.setIdentification(d.getIdentification()); + personaBD.setIdentificationcatalog(d.getIdentificationcatalog()); + personaBD.setIdentificationcatalogcode(d.getIdentificationcatalogcode()); + personaBD.setIngressuser(d.getIngressuser()); + personaBD.setInnerscore(d.getInnerscore()); + personaBD.setIsmigrated(d.getIsmigrated()); + personaBD.setLanguagecode(d.getLanguagecode()); + personaBD.setLegalrepresent(d.getLegalrepresent()); + personaBD.setLegalrepresentidentification(d.getLegalrepresentidentification()); + personaBD.setMilitarygrade(d.getMilitarygrade()); + personaBD.setMilitarygradecode(d.getMilitarygradecode()); + personaBD.setModifyuser(d.getModifyuser()); + personaBD.setName(d.getName()); + personaBD.setNickname(d.getNickname()); + personaBD.setOfficecode(d.getOfficecode()); + personaBD.setParthnernumber(d.getParthnernumber()); + personaBD.setPersontypecatalog(d.getPersontypecatalog()); + personaBD.setPersontypecatalogcode(d.getPersontypecatalogcode()); + + personaBD.setRecordversion(d.getRecordversion()); + personaBD.setRegisterdate(d.getRegisterdate()); + personaBD.setSbsemployee(d.getSbsemployee()); + personaBD.setSbsusercode(d.getSbsusercode()); + personaBD.setSign(d.getSign()); + personaBD.setTaxexempt(d.getTaxexempt()); + //personaBD.setPicture(d.getPicture()); + + //Asginando la foto + if(photo!=null){ + + //Creando un nuevo archivo + TgeneFilesDetail archivoActual=new TgeneFilesDetail(); + + //Caso de que exista un arhivo anterior + if(personaBD.getPhoto()!=null){ + + TgeneFilesDetail archivoAnterior=PersistenceHelper.getEntityManager().find(TgeneFilesDetail.class, personaBD.getPhoto()); + archivoAnterior.getPk().setDateto(new java.sql.Timestamp(Calendar.getInstance().getTimeInMillis())); + PersistenceHelper.getEntityManager().persist(archivoAnterior); + + archivoActual.setPk(archivoAnterior.getPk()); + archivoActual.setDatefrom(archivoAnterior.getDatefrom()); + archivoActual.setIngressuser(archivoAnterior.getIngressuser()); + } + + //Creando un nuevo TEGENEFILES + Sequence sequence = new Sequence(); + Integer code=sequence.getNextValue("CODE"); + TgeneFiles file=new TgeneFiles(); + file.setPk(code); + //PersistenceHelper.getEntityManager().persist(file); + + //Creando el pk del TGENEFILEDETAIL + TgeneFilesDetailKey pk=new TgeneFilesDetailKey(); + + pk.setCode(code); + + Calendar calendario=Calendar.getInstance(); + calendario.set(Calendar.MONTH, Calendar.DECEMBER); + calendario.set(Calendar.DAY_OF_MONTH, 31); + calendario.set(Calendar.YEAR, 2999); + + pk.setDateto(new Timestamp(calendario.getTimeInMillis())); + archivoActual.setPk(pk); + + archivoActual.setImage(photo); + archivoActual.setExtension(extension); + archivoActual.setImagesize(photo.length); + archivoActual.setCapturedate(new Date(Calendar.getInstance().getTimeInMillis())); + archivoActual.setModifyuser(usuario.getPk().getUsercode()); + archivoActual.setDescription("Foto de la persona"); + archivoActual.setContenttype("image/"+extension.substring(1,extension.length())); + + //PersistenceHelper.getEntityManager().persist(archivoActual); + } + + if(personaBD.getPk()!=null && personaBD.getPk().getPersoncode()!=null){ + personaBD=PersistenceHelper.getEntityManager().merge(personaBD); + PersistenceHelper.getEntityManager().persist(personaBD); + } + + PersistenceHelper.getEntityManager().flush(); + */ + + } catch (Exception e) { + return pSaveRequest; + } + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + + return arg0; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/entries b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/entries new file mode 100644 index 0000000..13b3d21 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/entries @@ -0,0 +1,368 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud +svn://172.17.26.185/COMACO + + + +2016-07-01T13:24:36.603167Z +4547 +cvasquez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +CustodiaTemporal.java +file + + + + +2022-07-28T03:40:41.017796Z +26116a90d24990a88b4950858f082c0e +2015-06-23T07:14:38.225355Z +4126 +cpiedra + + + + + + + + + + + + + + + + + + + + + +6028 + +Solicitud.java +file + + + + +2022-07-28T03:40:41.017796Z +63e7cefb52074a3ad84e8a1f7bc188c3 +2015-06-23T07:14:38.225355Z +4126 +cpiedra + + + + + + + + + + + + + + + + + + + + + +2823 + +DecomisoMaterial.java +file + + + + +2022-07-28T03:40:41.018796Z +b35a80cd7fe98273e0d04e6e2a3f75dd +2016-07-01T13:24:36.603167Z +4547 +cvasquez + + + + + + + + + + + + + + + + + + + + + +9701 + +DocumentoHabilitanteTransaccion.java +file + + + + +2022-07-28T03:40:41.018796Z +0d54221d9f743ae1c45ed92801c5d629 +2015-06-23T07:14:38.225355Z +4126 +cpiedra + + + + + + + + + + + + + + + + + + + + + +3957 + +Requisitos.java +file + + + + +2022-07-28T03:40:41.018796Z +6234666983a14bc9a9e2ad50a5820a48 +2014-09-24T09:46:43.157106Z +1092 +dcruz + + + + + + + + + + + + + + + + + + + + + +3580 + +DecomisoArmaTransaccion.java +file + + + + +2022-07-28T03:40:41.018796Z +8fbf2cd532ca37d32170d359d3a4a02f +2015-06-23T07:14:38.225355Z +4126 +cpiedra + + + + + + + + + + + + + + + + + + + + + +3764 + +OrdenTrabajoSave.java +file + + + + +2022-07-28T03:40:41.019796Z +860f4fb4bc8ed2f6d21dd09a2e75a9c2 +2014-09-01T07:37:02.533952Z +424 +ogarcia + + + + + + + + + + + + + + + + + + + + + +1936 + +RegistroInspeccion.java +file + + + + +2022-07-28T03:40:41.019796Z +500720b98eda3ef1cbc61aef4628b5a4 +2015-06-23T07:14:38.225355Z +4126 +cpiedra + + + + + + + + + + + + + + + + + + + + + +3022 + +ActualizaReimpresion.java +file + + + + +2022-07-28T03:40:41.019796Z +0b0fd18df3e882b335804c95aaafec67 +2014-11-17T04:31:46.121907Z +2855 +cguzman + + + + + + + + + + + + + + + + + + + + + +1839 + +DecomisoArmaRecepcion.java +file + + + + +2022-07-28T03:40:41.019796Z +df205d4336e74532298b8ebca47e451b +2015-06-23T07:14:38.225355Z +4126 +cpiedra + + + + + + + + + + + + + + + + + + + + + +6060 + diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/ActualizaReimpresion.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/ActualizaReimpresion.java.svn-base new file mode 100644 index 0000000..1f452ec --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/ActualizaReimpresion.java.svn-base @@ -0,0 +1,57 @@ +package com.fp.armas.rules.save.solicitud; + +import java.util.List; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitanteDetall; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; + +/** + * Clase que se encarga de actualizar el campo de Reimpresion para la tabla TarmDocumentoHabilitante. + * + * @author C.P. + * @version 2.1 + */ +public class ActualizaReimpresion extends TransactionRule{ + + /** + * + */ + private static final long serialVersionUID = 2006952557483529297L; + + @Override + public SaveRequest normalProcess(SaveRequest sRequest) throws Exception { + List listSolDocumento = (List)sRequest.getSaveBeanModifiedRecords("VERIFICARDOCUMENTOS"); + if(listSolDocumento!=null && !listSolDocumento.isEmpty()){ + for(Object obj:listSolDocumento){ + TarmSolicitudDocumento sol = (TarmSolicitudDocumento)obj; + if(sol.getChkimpresion().equals("Y")){ + TarmDocumentoHabilitante dh = new TarmDocumentoHabilitante(); + dh.setPk(sol.getPk().getCdocumento()); + TarmDocumentoHabilitante doc = TarmDocumentoHabilitante.find(PersistenceHelper.getEntityManager(), dh.getPk()); + if(doc.getCuentareimpresion()!=null){ + doc.setCuentareimpresion(doc.getCuentareimpresion()+1); + }else { + doc.setCuentareimpresion(1); + } + sRequest.putSaveBean("TARMDOCUMENTOHABILITANTE", doc); + } + + + } + + } + return sRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/CustodiaTemporal.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/CustodiaTemporal.java.svn-base new file mode 100644 index 0000000..eff3523 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/CustodiaTemporal.java.svn-base @@ -0,0 +1,150 @@ +package com.fp.armas.rules.save.solicitud; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.List; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.data.SaveData; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmCustodiaTemporal; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Clase que se encarga de completar informacin para realizar una custodia temporal. + * + * @author C.P. + * @version 2.1 + */ +public class CustodiaTemporal extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + List armaList = (List)pSaveRequest.getSaveBeanModifiedRecords("ARMAS"); + List custodiaTemporalList = (List)pSaveRequest.getSaveBeanModifiedRecords("CUSTODIATEM"); + //tabla del detalle de la custodia + List tarmDecomisoArma = (List)pSaveRequest.getSaveBeanModifiedRecords("TARMDECOMISOARMA"); + + //registramos el arma y si ya existe le cambiamos de estado + for(Object obj:armaList){ + TarmArmas arma=(TarmArmas)obj; + //creamos el arma + arma.setPk(getCodigo("CARMA")); + if(tarmDecomisoArma!=null && tarmDecomisoArma.size()>0){ + TarmDecomisoArma decomisoArma= (TarmDecomisoArma)tarmDecomisoArma.get(0); + decomisoArma.setCarma( arma.getPk()); + }else{ + //seteo del detalle del decomiso y a que arma se le hace el decomiso + TarmDecomisoArma decomisoArma= new TarmDecomisoArma(); + decomisoArma.setCarma( arma.getPk()); + decomisoArma.setObservacion(arma.getModifiedData().get("observacion").toString()); + //unidad de medida + decomisoArma.setUnidadmedida(arma.getUnidadmedidacantidad());//unidad de medida + decomisoArma.setUnidadmedidacode(arma.getUnidadmedidacantidadcodigo());//3 + //estado igual al del arma + decomisoArma.setEstado(arma.getEstado()); + decomisoArma.setEstadocode(arma.getEstadocodigo()); + //cantidad + if(arma.getCantidad()!=null){ + decomisoArma.setCantidad(new BigDecimal(arma.getCantidad())); + } + //estados anteriores + if(arma.getModifiedData().get("estadoanterior")!=null){ + decomisoArma.setEstadoanterior(arma.getModifiedData().get("estadoanterior").toString()); + } + decomisoArma.setFdecomiso((new Timestamp(new java.util.Date().getTime()))); + //codigo del arma + decomisoArma.setCarma(arma.getPk()); + tarmDecomisoArma.add(decomisoArma); + } + } + TarmCustodiaTemporal custodiaTem=null; + if(custodiaTemporalList!=null && custodiaTemporalList.size()>0){ + //seteo de los codigos de la custodia temporal + for(Object obj:custodiaTemporalList){ + custodiaTem=(TarmCustodiaTemporal)obj; + custodiaTem.setPk(getCodigo("CCUSTEMP")); + custodiaTem.setNotransaccion(getNumeroTransaccion(custodiaTem.getTiporegistro(), custodiaTem.getPk().toString())); + pSaveRequest.getResponse().put("numerotransaccion",custodiaTem.getNotransaccion()); + } + } + + //se inserta el detalle del decomiso + for(Object obj:tarmDecomisoArma){ + TarmDecomisoArma decomisoArma=(TarmDecomisoArma)obj; + if(custodiaTem!=null){ + decomisoArma.setCcustemp(custodiaTem.getPk());//codigo del arma + } + decomisoArma.setPk(getCodigo("CDECOMISOARMA")); + + } + return pSaveRequest; + } + + /** + * Metodo que devuelve la secuencia que le pertenece a una nueva persona. + * + * @return Codigo de la nueva persona. + * @throws Exception + */ + protected Integer getPersonCode() throws Exception { + Sequence sequence = new Sequence(); + Integer personcode = Integer.valueOf(sequence.getNextValue("PERSONCODE").toString()); + SaveData.getMap().put("PERSONCODE", personcode.toString()); + return personcode; + } + + /** + * Completa el codigo de la persona en la tabla TcustPersonDetail + * + * @param tcustPersonDetail Objeto que posee el registro a guardar en la tabla TcustPersonDetail. + * @param personcode Codigo de la nueva persona a ser guardada. + * @throws Exception + */ + protected void completePersonDetail(TcustPersonDetail tcustPersonDetail, Integer personcode) throws Exception { + TcustPersonDetailKey tcustPersonDetailKey = new TcustPersonDetailKey(); + tcustPersonDetailKey.setPersoncode(personcode); + tcustPersonDetail.setPk(tcustPersonDetailKey); + } + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + /** + * Metodo que devuelve la secuencia del codigo + * @param codigoSec + * @return String + * @throws Exception + */ + private String getCodigo(String codigoSec) throws Exception { + Sequence sequence = new Sequence(); + Integer solcitud = Integer.valueOf(sequence.getNextValue(codigoSec).toString()); + return solcitud.toString(); + } + /** + * Genera el numero de transaccion para la custodia + */ + private String getNumeroTransaccion(String prefijo,String secuencia){ + return prefijo+"-"+StringUtils.leftPad(secuencia, 6, '0'); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/DecomisoArmaRecepcion.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/DecomisoArmaRecepcion.java.svn-base new file mode 100644 index 0000000..92a3919 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/DecomisoArmaRecepcion.java.svn-base @@ -0,0 +1,143 @@ +package com.fp.armas.rules.save.solicitud; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmBodega; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.parmas.soli.TarmTransaccionArmaBodega; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.sessionbeans.helper.Sequence; + +public class DecomisoArmaRecepcion extends TransactionRule { + + /** + * + */ + private static final long serialVersionUID = -1840770563013500407L; + + @SuppressWarnings("unchecked") + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + + TarmDecomisoArmaTransaccion decomisoArmaTransaccion=(TarmDecomisoArmaTransaccion) pSaveRequest.getSaveBeanModifiedObject("DECOMISOARMATRANSACCION"); + //para las transacciones de la bodega + List transaccionArmaBodegas=(List) pSaveRequest.getSaveBeanModifiedRecords("TRANSACCIONARMABODEGA"); + List bodegas=(List) pSaveRequest.getSaveBeanModifiedRecords("BODEGA"); + + if(decomisoArmaTransaccion==null){ + return pSaveRequest; + } + + if(transaccionArmaBodegas==null){ + transaccionArmaBodegas= new ArrayList<>(); + } + if(bodegas==null){ + bodegas=new ArrayList<>(); + } + + TgeneParametersKey pKey= new TgeneParametersKey(); + pKey.setCode("CODIGO.RECEPCION"); + pKey.setCompanycode(1); + TgeneParameters parametro =TgeneParameters.find(PersistenceHelper.getEntityManager(), pKey); + + String prefijo=pSaveRequest.get("prefijo").toString(); + Calendar cal=Calendar.getInstance(); + java.sql.Date fechaRegistro=new java.sql.Date(cal.getTimeInMillis()); + //GENERA EL CODIGO PARA NUMERO DE TRANSACCION + //Long codigoGenerado = Long.parseLong(getCodigo("DECARMTRANRECECCION")); + + decomisoArmaTransaccion.setPk(Long.parseLong(getCodigo("CDECOMISOARMATRANSACCION"))); + decomisoArmaTransaccion.setFtransaccion(fechaRegistro); + decomisoArmaTransaccion.setNumerotransaccion( getNumeroTransaccion(prefijo,decomisoArmaTransaccion.getPk().toString())); + + //actualizacion del decomiso cabecera el centro control destino + TarmDecomiso decomiso=(TarmDecomiso)pSaveRequest.getSaveBeanModifiedObject("DECOMISO"); + + + TarmDecomisoArma decomisoArma=(TarmDecomisoArma)pSaveRequest.getSaveBeanModifiedObject("DECOMARMTRANRECECCION"); + List lDecomisoArma = (List)pSaveRequest.getSaveBeanModifiedRecords("DECOMARMTRANRECECCION"); + + if(lDecomisoArma.isEmpty()){ + lDecomisoArma.add(decomisoArma); + } + + for (Object object : lDecomisoArma) { + TarmDecomisoArma c=(TarmDecomisoArma)object; + if(c.getModifiedData().get("seleccion").equals(Boolean.TRUE)){ + String centroControl=null; + //bodega de origen por envio + if(c.getCdecomisoarmatransaccion()!=null && c.getCdecomisoarmatransaccion()>0){ + TarmDecomisoArmaTransaccion transa= TarmDecomisoArmaTransaccion.find(PersistenceHelper.getEntityManager(), c.getCdecomisoarmatransaccion()); + centroControl=transa.getCcentrocontrol(); + }else{ + centroControl=c.getModifiedData().get("ccentrocontrol").toString(); + } + c.setCdecarmtranrecepcion(decomisoArmaTransaccion.getPk()); + //transaccion del arma + TarmTransaccionArmaBodega tarmTransaccionArmaBodega = new TarmTransaccionArmaBodega(); + tarmTransaccionArmaBodega.setPk(Long.parseLong(getCodigo("CTRANARMBODEGA"))); + tarmTransaccionArmaBodega.setCdecomisoarmatransaccion(decomisoArmaTransaccion.getPk()); + tarmTransaccionArmaBodega.setCcentrocontrolorigen(centroControl); + tarmTransaccionArmaBodega.setCcentrocontroldestino(decomisoArmaTransaccion.getCcentrocontrol()); + tarmTransaccionArmaBodega.setCarma(c.getCarma()); + tarmTransaccionArmaBodega.setOperacioncode("OPERACIONDECOMISO"); + tarmTransaccionArmaBodega.setOperacion(parametro.getTextvalue()); + tarmTransaccionArmaBodega.setFecha(new Timestamp(new Date().getTime())); + transaccionArmaBodegas.add(tarmTransaccionArmaBodega); + //bodega actualiza o inserta + TarmBodega bodega=null; + List bodegal=PersistenceHelper.getEntityManager() + .createQuery("select o from TarmBodega o where o.carma=:carma") + .setParameter("carma", c.getCarma()) + .getResultList(); + if(bodegal!=null && bodegal.size()>0){ + bodega=bodegal.get(0); + } + if(bodega==null){ + bodega= new TarmBodega(); + bodega.setPk(Long.parseLong(getCodigo("CBODEGA"))); + } + bodega.setCarma(c.getCarma()); + bodega.setCcentrocontrol(decomisoArmaTransaccion.getCcentrocontrol()); + bodegas.add(bodega); + //actualiza la cab del decomiso centro conttrol destino + decomiso=TarmDecomiso.find(PersistenceHelper.getEntityManager(), c.getCdecomiso()); + decomiso.setCcentrocontroldestino(decomisoArmaTransaccion.getCcentrocontrol()); + } + } + pSaveRequest.getResponse().put("numerotransaccionrecep", decomisoArmaTransaccion.getNumerotransaccion()); + return pSaveRequest; + } + + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + // TODO Auto-generated method stub + return null; + } + + private String getCodigo(String codigoSec) throws Exception { + Sequence sequence = new Sequence(); + Integer solcitud = Integer.valueOf(sequence.getNextValue(codigoSec).toString()); + return solcitud.toString(); + } + + private String getNumeroTransaccion(String prefijo,String secuencia){ + System.out.println("Ingresa al secuencial"); + return prefijo+"-"+StringUtils.leftPad(secuencia, 9, '0'); + } + + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/DecomisoArmaTransaccion.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/DecomisoArmaTransaccion.java.svn-base new file mode 100644 index 0000000..6638fdf --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/DecomisoArmaTransaccion.java.svn-base @@ -0,0 +1,107 @@ +package com.fp.armas.rules.save.solicitud; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.parmas.soli.TarmBodega; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.parmas.soli.TarmTransaccionArmaBodega; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Transaccion rule para decomiso de arma + * @author Carlos Guzman + * + */ +public class DecomisoArmaTransaccion extends TransactionRule { + + /** + * + */ + private static final long serialVersionUID = -1840770563013500407L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + + TarmDecomisoArmaTransaccion decomisoArmaTransaccion=(TarmDecomisoArmaTransaccion) pSaveRequest.getSaveBeanModifiedObject("DECOMISOARMATRANSACCION"); + if(decomisoArmaTransaccion==null){ + return pSaveRequest; + } + Calendar cal=Calendar.getInstance(); + java.sql.Date fechaRegistro=new java.sql.Date(cal.getTimeInMillis()); + Long codigoGenerado = Long.parseLong(getCodigo("CDECOMISOARMATRANSACCION")); + + decomisoArmaTransaccion.setPk(codigoGenerado); + decomisoArmaTransaccion.setFtransaccion(fechaRegistro); + decomisoArmaTransaccion.setNumerotransaccion( getNumeroTransaccion("ENV",codigoGenerado.toString())); + TarmDecomisoArma decomisoArma=(TarmDecomisoArma)pSaveRequest.getSaveBeanModifiedObject("RPRTEDESTRUCCIONDEARMAS"); + List lDecomisoArma = (List)pSaveRequest.getSaveBeanModifiedRecords("RPRTEDESTRUCCIONDEARMAS"); + List lArmaBodega=(List)pSaveRequest.getSaveBeanModifiedRecords("TRANSACCIONARMABODEGA"); + List lBodega=(List)pSaveRequest.getSaveBeanModifiedRecords("BODEGA"); + + if(lDecomisoArma.isEmpty()){ + lDecomisoArma.add(decomisoArma); + } + + for (Object object : lDecomisoArma) { + TarmDecomisoArma c=(TarmDecomisoArma)object; + + if(c.getModifiedData().get("seleccion").equals(Boolean.TRUE)){ + c.setCdecomisoarmatransaccion(codigoGenerado); + } + } + + for (Object object : lArmaBodega) { + TarmTransaccionArmaBodega c=(TarmTransaccionArmaBodega)object; + c.setPk(Long.parseLong(getCodigo("CTRANARMBODEGA"))); + c.setCdecomisoarmatransaccion(codigoGenerado); + c.setOperacion("ENVIO"); + c.setOperacioncode("OPERACIONDECOMISO"); + c.setFecha(new java.sql.Timestamp((new Date()).getTime())); + } + + for (Object object : lBodega) { + TarmBodega c=(TarmBodega)object; + c.setPk(Long.parseLong(getCodigo("CBODEGA"))); + } + + return pSaveRequest; + } + + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + // TODO Auto-generated method stub + return null; + } + + /** + * Metodo para obtener el numero de secuencia de la base de datos + * @param codigoSec nombre del campo de la secuencia + * @return la secuencia generada + * @throws Exception + */ + private String getCodigo(String codigoSec) throws Exception { + Sequence sequence = new Sequence(); + Integer codigo = Integer.valueOf(sequence.getNextValue(codigoSec).toString()); + return codigo.toString(); + } + + /** + * Metodo que arma el numero de la transaccion + * @param prefijo prefijo a usarse pata el numero a generarse + * @param secuencia numero de secuencia + * @return el numero de documento generado + */ + private String getNumeroTransaccion(String prefijo,String secuencia){ + return prefijo+"-"+StringUtils.leftPad(secuencia, 9, '0'); + } + + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/DecomisoMaterial.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/DecomisoMaterial.java.svn-base new file mode 100644 index 0000000..14740e5 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/DecomisoMaterial.java.svn-base @@ -0,0 +1,220 @@ +package com.fp.armas.rules.save.solicitud; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.data.SaveData; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.pcustomer.gene.TcustPerson; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pcustomer.gene.TcustPersonPhoneKey; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Clase que se encarga de completar informacin de una solicitud de control de armas. + * + * @author C.P. + * @version 2.1 + */ +public class DecomisoMaterial extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (this.isNew(pSaveRequest)) { + return pSaveRequest; + } + //decomiso + if((List)pSaveRequest.getSaveBeanModifiedRecords("DECOMISO") == null || ((TarmDecomiso)((List)pSaveRequest.getSaveBeanModifiedRecords("DECOMISO")).get(0)).getPk()!=null){ + return pSaveRequest; + } + //personas a crear + List personDetailList = (List)pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONDETAIL"); + //registro del arma + List registroArmaList = (List)pSaveRequest.getSaveBeanModifiedRecords("TREGISTROARMAS");//seteado en el arma + //arma a decomisar + List armaList = (List)pSaveRequest.getSaveBeanModifiedRecords("ARMAS"); + + //detalle del decomiso + List tarmDecomisoArma = (List)pSaveRequest.getSaveBeanModifiedRecords("TARMDECOMISOARMA");//seteado en el decomiso + //telefono + List personPhoneList = (List)pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONPHONE"); + //TREGISTROARMAS + TcustPersonDetail personDetailPortador= null; + for(Object obj:personDetailList){ + TcustPersonDetail personaDetail=(TcustPersonDetail)obj; + if(personaDetail.getPk()==null || personaDetail.getPk().getPersoncode()==null){ + TcustPerson persona=new TcustPerson(); + persona.setPk(getPersonCode()); + //insertamos la persona + PersistenceHelper.getEntityManager().persist(persona); + completePersonDetail(personaDetail, persona.getPk()); + personaDetail.getPk().setDateto(FormatDates.getDefaultExpiryTimestamp()); + //inserta el detalle + PersistenceHelper.getEntityManager().persist(personaDetail); + } + personDetailPortador=personaDetail; + if(personPhoneList!=null){ + for(Object objPhone:personPhoneList){ + TcustPersonPhone telefono=(TcustPersonPhone)objPhone; + telefono.setPk(new TcustPersonPhoneKey()); + telefono.getPk().setPhonesequence(1); + telefono.getPk().setDateto(FormatDates.getDefaultExpiryTimestamp()); + telefono.getPk().setPersoncode(personDetailPortador.getPk().getPersoncode()); + } + } + } + + //DECOMISO + TarmDecomiso decomiso=null; + //se inserta el DECOMISO cabecera + for(Object obj:(List)pSaveRequest.getSaveBeanModifiedRecords("DECOMISO")){ + decomiso=(TarmDecomiso)obj; + if(personDetailPortador!=null && personDetailPortador.getPk()!=null && personDetailPortador.getPk().getPersoncode()!=null){ + decomiso.setPersoncode(personDetailPortador.getPk().getPersoncode()); + } + decomiso.setPk(Long.parseLong(getCodigo("CDECOMISO"))); + decomiso.setNumerotransaccion(getNumeroTransaccion(decomiso.getTipoproceso(), decomiso.getPk().toString())); + } + + //registramos el arma y si ya existe le cambiamos de estado + for(Object obj:armaList){ + TarmArmas arma=(TarmArmas)obj; + TarmRegistroArmas registroArma=null; + if(arma.getUnidadmedidacantidad()==null || arma.getUnidadmedidacantidad().trim().length()==0){ + arma.setUnidadmedidacantidad(arma.getModifiedData().get("unidadmedidadesc").toString()); + } + //creamos el arma + arma.setPk(getCodigo("CARMA")); + //SI ES NUEVA CREA + if(arma.getCodigoarma()==null || arma.getCodigoarma().trim().length()==0){ + arma.setCodigoarma(arma.getPk()); + } + //REGISTRO ARMA + if(arma.getModifiedData().get("personcode")!=null && arma.getModifiedData().get("tiporegistro")!=null){ + registroArma=new TarmRegistroArmas(); + //PK + registroArma.setPk(Long.parseLong(getCodigo("CREGISTRO"))); + //personcode + registroArma.setPersoncode(Integer.parseInt(arma.getModifiedData().get("personcode").toString())); + registroArma.setTiporegistro(arma.getModifiedData().get("tiporegistro").toString()); + registroArma.setTiporegistrocodigo(arma.getModifiedData().get("tiporegistrocode").toString()); + //pais de origen + registroArma.setPaisorigen(arma.getModifiedData().get("paisorigen").toString()); + //fecha de creacion + registroArma.setFcreacion(new java.sql.Date(new Date().getTime())); + registroArmaList.add(registroArma); + } + + //validamos el pk de REGISTROARMA + if(registroArma!=null && registroArma.getPk()!=null){ + arma.setCregistro(registroArma.getPk()); + } + //seteo del detalle del DECOMISOARMA y a que arma se le hace el decomiso + TarmDecomisoArma decomisoArma= new TarmDecomisoArma(); + decomisoArma.setCarma( arma.getPk()); + //estadoarma es igual que el estado del arma + decomisoArma.setEstado(arma.getEstado()); + decomisoArma.setEstadocode(arma.getEstadocodigo()); + //motivo del decomiso + decomisoArma.setMotivodecomiso(arma.getModifiedData().get("motivocatalogo").toString());//motivo + decomisoArma.setMotivodecomisocodigo(arma.getModifiedData().get("motivocatalogocode").toString());//1 + //observacion + decomisoArma.setObservacion(arma.getModifiedData().get("observaciondecomiso").toString()); + //cantidad + decomisoArma.setCantidad(new BigDecimal(arma.getModifiedData().get("cantidad").toString()));//cantidad + //unidad del arma o material explosivo + + decomisoArma.setUnidadmedida(arma.getUnidadmedidacantidad());//unidad de medida + decomisoArma.setUnidadmedidacode(arma.getUnidadmedidacantidadcodigo());//3 + //fecha del decomiso arma la actual + decomisoArma.setFdecomiso(new Timestamp(new java.util.Date().getTime())); + //codigo del decomiso + decomisoArma.setPk(getCodigo("CDECOMISOARMA")); + //codigo del decomiso + decomisoArma.setCdecomiso(decomiso.getPk()); + //en bodega + decomisoArma.setEnbodega("Y"); + tarmDecomisoArma.add(decomisoArma); + } + + + pSaveRequest.getResponse().put("numerotransaccion",decomiso.getNumerotransaccion()); + //datos para el flujo + pSaveRequest.getResponse().put("cdecomiso", decomiso.getPk()); + + return pSaveRequest; + } + + /** + * Metodo que devuelve la secuencia que le pertenece a una nueva persona. + * + * @return Codigo de la nueva persona. + * @throws Exception + */ + protected Integer getPersonCode() throws Exception { + Sequence sequence = new Sequence(); + Integer personcode = Integer.valueOf(sequence.getNextValue("PERSONCODE").toString()); + SaveData.getMap().put("PERSONCODE", personcode.toString()); + return personcode; + } + + /** + * Completa el codigo de la persona en la tabla TcustPersonDetail + * + * @param tcustPersonDetail Objeto que posee el registro a guardar en la tabla TcustPersonDetail. + * @param personcode Codigo de la nueva persona a ser guardada. + * @throws Exception + */ + protected void completePersonDetail(TcustPersonDetail tcustPersonDetail, Integer personcode) throws Exception { + TcustPersonDetailKey tcustPersonDetailKey = new TcustPersonDetailKey(); + tcustPersonDetailKey.setPersoncode(personcode); + tcustPersonDetail.setPk(tcustPersonDetailKey); + } + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + /** + * Metodo que devuelve la secuencia del codigo + * @param codigoSec + * @return String + * @throws Exception + */ + private String getCodigo(String codigoSec) throws Exception { + Sequence sequence = new Sequence(); + String solcitud = sequence.getNextValue(codigoSec).toString(); + return solcitud; + } + + private String getNumeroTransaccion(String prefijo,String secuencia){ + System.out.println("Ingresa al secuencial armas"); + return prefijo+"-"+StringUtils.leftPad(secuencia, 9, '0'); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/DocumentoHabilitanteTransaccion.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/DocumentoHabilitanteTransaccion.java.svn-base new file mode 100644 index 0000000..1734606 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/DocumentoHabilitanteTransaccion.java.svn-base @@ -0,0 +1,108 @@ +package com.fp.armas.rules.save.solicitud; + +import java.util.List; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.parmas.inte.TarmColadeImpresion; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitanteDetall; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Clase transaction rule para registrar el documento habilitante + * @author Carlos Guzman + * + */ +public class DocumentoHabilitanteTransaccion extends TransactionRule { + + /** + * + */ + private static final long serialVersionUID = -1840770563013500407L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + + TarmDocumentoHabilitante documentoHabilitante=(TarmDocumentoHabilitante) pSaveRequest.getSaveBeanModifiedObject("DOCUMENTOHABILITANTE"); + if(documentoHabilitante==null){ + return pSaveRequest; + } + + TarmColadeImpresion colaImpresion=(TarmColadeImpresion)pSaveRequest.getSaveBeanModifiedObject("BODEGA"); + + + Long codigoGenerado = Long.parseLong(getCodigo("TARMDOCUMENTOHABILITANTE")); + + documentoHabilitante.setPk(codigoGenerado); + documentoHabilitante.setNumerodocumento(getNumeroTransaccion("DOC",codigoGenerado.toString())); + + if(colaImpresion!=null){ + colaImpresion.setPk(getCodigo("TARMCOLADEIMPRESION")); + colaImpresion.setCdocumento(codigoGenerado); + } + + TarmDocumentoHabilitanteDetall documentohabilitanteDetall=(TarmDocumentoHabilitanteDetall)pSaveRequest.getSaveBeanModifiedObject("DOCUMENTOHABILITANTEDETAIL"); + List lDocumentohabilitanteDetall = null; + if(documentohabilitanteDetall==null){ + lDocumentohabilitanteDetall = (List)pSaveRequest.getSaveBeanModifiedRecords("DOCUMENTOHABILITANTEDETAIL"); + } + if(documentohabilitanteDetall!=null || (documentohabilitanteDetall==null && lDocumentohabilitanteDetall!=null)){ + //lDocumentohabilitanteDetall = (List)pSaveRequest.getSaveBeanModifiedRecords("DOCUMENTOHABILITANTEDETAIL"); + if(documentohabilitanteDetall!=null && (lDocumentohabilitanteDetall == null ||lDocumentohabilitanteDetall.size()==0)){ + documentohabilitanteDetall.setPk(getCodigo("CODIGODETALLE")); + documentohabilitanteDetall.setCdocumento(codigoGenerado); + } + else{ + if(lDocumentohabilitanteDetall!=null && lDocumentohabilitanteDetall.isEmpty() && documentohabilitanteDetall!=null){ + lDocumentohabilitanteDetall.add(documentohabilitanteDetall); + } + if(lDocumentohabilitanteDetall!=null && !lDocumentohabilitanteDetall.isEmpty()){ + + for (Object object : lDocumentohabilitanteDetall) { + TarmDocumentoHabilitanteDetall c=(TarmDocumentoHabilitanteDetall)object; + c.setPk(getCodigo("CODIGODETALLE")); + c.setCdocumento(codigoGenerado); + } + } + + } + } + + + return pSaveRequest; + } + + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + // TODO Auto-generated method stub + return null; + } + + /** + * Metodo para obtener el numero de secuencia de la base de datos + * @param codigoSec nombre del campo de la secuencia + * @return la secuencia generada + * @throws Exception + */ + private String getCodigo(String codigoSec) throws Exception { + Sequence sequence = new Sequence(); + Integer documento = Integer.valueOf(sequence.getNextValue(codigoSec).toString()); + return documento.toString(); + } + + /** + * Metodo que arma el numero de la transaccion + * @param prefijo prefijo a usarse pata el numero a generarse + * @param secuencia numero de secuencia + * @return el numero de documento generado + */ + private String getNumeroTransaccion(String prefijo,String secuencia){ + return prefijo+"-"+StringUtils.leftPad(secuencia, 9, '0'); + } + + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/OrdenTrabajoSave.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/OrdenTrabajoSave.java.svn-base new file mode 100644 index 0000000..9c0c718 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/OrdenTrabajoSave.java.svn-base @@ -0,0 +1,58 @@ +package com.fp.armas.rules.save.solicitud; + +import java.util.List; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.fun.TarmSolicitudImportacion; +import com.fp.persistence.parmas.soli.TarmOrdenTrabajo; +import com.fp.persistence.parmas.soli.TarmOrdenTrabajoCustodios; +import com.fp.sessionbeans.helper.Sequence; + +public class OrdenTrabajoSave extends TransactionRule { + + /** + * + */ + private static final long serialVersionUID = 1L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + + TarmOrdenTrabajo ordenTrabajo=(TarmOrdenTrabajo) pSaveRequest.getSaveBeanModifiedObject("ORDENTRABAJOCONTROLLER"); + if(ordenTrabajo==null){ + return pSaveRequest; + } + + TarmOrdenTrabajoCustodios custodio=(TarmOrdenTrabajoCustodios)pSaveRequest.getSaveBeanModifiedObject("CUSTODIOSCONTROLLER");; + List lcustodios = (List)pSaveRequest.getSaveBeanModifiedRecords("CUSTODIOSCONTROLLER"); + + if(lcustodios.isEmpty()){ + lcustodios.add(custodio); + } + + //PersistenceHelper.getEntityManager().merge(ordenTrabajo); + PersistenceHelper.getEntityManager().persist(ordenTrabajo); + for (Object object : lcustodios) { + TarmOrdenTrabajoCustodios c=(TarmOrdenTrabajoCustodios)object; + + //Sequence sequence = new Sequence(); + //String codigoCustodio = sequence.getNextValue("CORDENTRABAJOCUSTODIOS").toString(); + + //c.setPk(Long.parseLong(codigoCustodio)); + c.setCordentrabajo(ordenTrabajo.getPk()); + PersistenceHelper.getEntityManager().persist(c); + } + PersistenceHelper.getEntityManager().flush(); + + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/RegistroInspeccion.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/RegistroInspeccion.java.svn-base new file mode 100644 index 0000000..259b983 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/RegistroInspeccion.java.svn-base @@ -0,0 +1,83 @@ +package com.fp.armas.rules.save.solicitud; + +import java.util.List; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmInspeccion; +import com.fp.persistence.parmas.soli.TarmInspeccionArchivo; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Clase que se encarga de completar información de una solicitud de control de armas. + * + * @author C.P. + * @version 2.1 + */ +public class RegistroInspeccion extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + List inspeccion = (List)pSaveRequest.getSaveBeanModifiedRecords("INSPECCION"); + if(inspeccion!=null){ + List archivoList = (List)pSaveRequest.getSaveBeanModifiedRecords("INSPECCIONARCHIVO"); + TarmInspeccion tarmInspeccion = (TarmInspeccion)inspeccion.get(0); + tarmInspeccion.setPk(Long.valueOf(getCodigoSolicitud())); + tarmInspeccion.setNumordentrabajo(getNumeroTransaccion("TRA",tarmInspeccion.getPk().toString())); + PersistenceHelper.getEntityManager().persist(tarmInspeccion); + if(archivoList!=null && archivoList.size()>0){ + for(Object obj:archivoList){ + TarmInspeccionArchivo archivo=(TarmInspeccionArchivo)obj; + archivo.setCinspeccion(tarmInspeccion.getPk()); + PersistenceHelper.getEntityManager().persist(archivo); + } + } + PersistenceHelper.getEntityManager().flush(); + pSaveRequest.getResponse().put("numerotrabajo", tarmInspeccion.getNumordentrabajo()); + } + + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + /** + * Metodo que devuelve la secuencia de una solicitud de viaticos. + * + * @return Codigo de la nueva solicitud de viaticos. + * @throws Exception + */ + private String getCodigoSolicitud() throws Exception { + Sequence sequence = new Sequence(); + Integer solcitud = Integer.valueOf(sequence.getNextValue("CINSPECCION").toString()); + return solcitud.toString(); + } + + /** + * Metodo para generar el numero de trabajo + * @param prefijo + * @param secuencia + * @return String + */ + private String getNumeroTransaccion(String prefijo,String secuencia){ + return prefijo+"-"+StringUtils.leftPad(secuencia, 9, '0'); + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/Requisitos.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/Requisitos.java.svn-base new file mode 100644 index 0000000..ce91bae --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/Requisitos.java.svn-base @@ -0,0 +1,95 @@ +package com.fp.armas.rules.save.solicitud; + +import java.util.List; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.parmas.soli.TarmSolicitudAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.parmas.soli.TarmSolicitudGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitos; + +/** + * Clase que se encarga de completar información de requisitos de una solicitud de tramites. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class Requisitos extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /** + * Almacena toda la información correspondiente a la solicitud + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (Constant.ifYes((String) pSaveRequest.get("isnew")) || pSaveRequest.get("csolicitud") == null) { + return pSaveRequest; + } + String codSolicitud = (String) pSaveRequest.get("csolicitud"); + List lintegrantes = pSaveRequest.getSaveBeanModifiedRecords("REQUISITOPORTIPOTRAMITE"); + if (lintegrantes != null && !lintegrantes.isEmpty()) { + for (Object object : lintegrantes) { + TarmSolicitudRequisitos obj = (TarmSolicitudRequisitos) object; + if (obj.getPk().getCsolicitud() == null) { + obj.getPk().setCsolicitud(codSolicitud); + } + } + } + + List lguardias = pSaveRequest.getSaveBeanModifiedRecords("SOLICITUDGUARDIAS"); + if(lguardias != null && !lguardias.isEmpty()){ + for (Object object : lguardias) { + TarmSolicitudGuardias obj = (TarmSolicitudGuardias) object; + if (obj.getPk().getCsolicitud() == null) { + obj.getPk().setCsolicitud(codSolicitud); + } + } + } + + List larmas = pSaveRequest.getSaveBeanModifiedRecords("RECEPCIONARMAS"); + if(larmas != null && !larmas.isEmpty()){ + for (Object object : larmas) { + TarmSolicitudArmas obj = (TarmSolicitudArmas) object; + if (obj.getPk().getCsolicitud() == null) { + obj.getPk().setCsolicitud(codSolicitud); + } + } + } + + List lagencias = pSaveRequest.getSaveBeanModifiedRecords("SOLICITUDAGENCIA"); + if(lagencias != null && !lagencias.isEmpty()){ + for (Object object : lagencias) { + TarmSolicitudAgenciaSucursal obj = (TarmSolicitudAgenciaSucursal) object; + if(obj.getPk().getCsolicitud() == null){ + obj.getPk().setCsolicitud(codSolicitud); + } + } + } + + List ldocumentos = pSaveRequest.getSaveBeanModifiedRecords("DOCUMENTOSCONTROLLER"); + if(ldocumentos != null && !ldocumentos.isEmpty()){ + for (Object object : ldocumentos) { + TarmSolicitudDocumento obj = (TarmSolicitudDocumento) object; + if(obj.getPk().getCsolicitud() == null){ + obj.getPk().setCsolicitud(codSolicitud); + } + } + } + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/Solicitud.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/Solicitud.java.svn-base new file mode 100644 index 0000000..5c9daf0 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/.svn/text-base/Solicitud.java.svn-base @@ -0,0 +1,74 @@ +package com.fp.armas.rules.save.solicitud; + +import java.sql.Date; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Clase que se encarga de completar información de una solicitud de control de armas. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class Solicitud extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /** + * Genera el secuencial de la solicitud completa datos generales de la solicitud en su creacion + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (Constant.ifYes((String) pSaveRequest.get("isnew")) || pSaveRequest.get("csolicitud") != null) { + return pSaveRequest; + } + String codSolicitud = null; + TarmSolicitud tarmsolicitud = (TarmSolicitud) pSaveRequest.getSaveBeanModifiedObject("SOLICITUD"); + if (tarmsolicitud == null) { + return pSaveRequest; + } + codSolicitud = tarmsolicitud.getPk(); + if (codSolicitud == null) { + codSolicitud = this.getCodigoSolicitud(); + tarmsolicitud.setPk(codSolicitud); + tarmsolicitud.setFreal(FormatDates.getInstance().getDataBaseTimestamp()); + tarmsolicitud.setEstado("REG"); + tarmsolicitud.setEstadocodigo("ESTADOSOLICITUD"); + tarmsolicitud.setOrigenadquisicioncodigo("ORIGENADQUISICION"); + String freal = FormatDates.getInstance().getTransportDateFormat().format(tarmsolicitud.getFreal()); + Date f = new Date(FormatDates.getInstance().getTransportDateFormat().parse(freal).getTime()); + tarmsolicitud.setFregistro(f); + pSaveRequest.getResponse().put("csolicitud", codSolicitud); + pSaveRequest.put("csolicitud", codSolicitud); + } + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + /** + * Metodo que devuelve la secuencia de una solicitud de viaticos. + * + * @return Codigo de la nueva solicitud de viaticos. + * @throws Exception + */ + private String getCodigoSolicitud() throws Exception { + Sequence sequence = new Sequence(); + Integer solcitud = Integer.valueOf(sequence.getNextValue("SOLICTUDCONTROLARMAS").toString()); + return solcitud.toString(); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/ActualizaReimpresion.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/ActualizaReimpresion.java new file mode 100644 index 0000000..1f452ec --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/ActualizaReimpresion.java @@ -0,0 +1,57 @@ +package com.fp.armas.rules.save.solicitud; + +import java.util.List; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitanteDetall; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; + +/** + * Clase que se encarga de actualizar el campo de Reimpresion para la tabla TarmDocumentoHabilitante. + * + * @author C.P. + * @version 2.1 + */ +public class ActualizaReimpresion extends TransactionRule{ + + /** + * + */ + private static final long serialVersionUID = 2006952557483529297L; + + @Override + public SaveRequest normalProcess(SaveRequest sRequest) throws Exception { + List listSolDocumento = (List)sRequest.getSaveBeanModifiedRecords("VERIFICARDOCUMENTOS"); + if(listSolDocumento!=null && !listSolDocumento.isEmpty()){ + for(Object obj:listSolDocumento){ + TarmSolicitudDocumento sol = (TarmSolicitudDocumento)obj; + if(sol.getChkimpresion().equals("Y")){ + TarmDocumentoHabilitante dh = new TarmDocumentoHabilitante(); + dh.setPk(sol.getPk().getCdocumento()); + TarmDocumentoHabilitante doc = TarmDocumentoHabilitante.find(PersistenceHelper.getEntityManager(), dh.getPk()); + if(doc.getCuentareimpresion()!=null){ + doc.setCuentareimpresion(doc.getCuentareimpresion()+1); + }else { + doc.setCuentareimpresion(1); + } + sRequest.putSaveBean("TARMDOCUMENTOHABILITANTE", doc); + } + + + } + + } + return sRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/CustodiaTemporal.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/CustodiaTemporal.java new file mode 100644 index 0000000..eff3523 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/CustodiaTemporal.java @@ -0,0 +1,150 @@ +package com.fp.armas.rules.save.solicitud; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.List; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.data.SaveData; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmCustodiaTemporal; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Clase que se encarga de completar informacin para realizar una custodia temporal. + * + * @author C.P. + * @version 2.1 + */ +public class CustodiaTemporal extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + List armaList = (List)pSaveRequest.getSaveBeanModifiedRecords("ARMAS"); + List custodiaTemporalList = (List)pSaveRequest.getSaveBeanModifiedRecords("CUSTODIATEM"); + //tabla del detalle de la custodia + List tarmDecomisoArma = (List)pSaveRequest.getSaveBeanModifiedRecords("TARMDECOMISOARMA"); + + //registramos el arma y si ya existe le cambiamos de estado + for(Object obj:armaList){ + TarmArmas arma=(TarmArmas)obj; + //creamos el arma + arma.setPk(getCodigo("CARMA")); + if(tarmDecomisoArma!=null && tarmDecomisoArma.size()>0){ + TarmDecomisoArma decomisoArma= (TarmDecomisoArma)tarmDecomisoArma.get(0); + decomisoArma.setCarma( arma.getPk()); + }else{ + //seteo del detalle del decomiso y a que arma se le hace el decomiso + TarmDecomisoArma decomisoArma= new TarmDecomisoArma(); + decomisoArma.setCarma( arma.getPk()); + decomisoArma.setObservacion(arma.getModifiedData().get("observacion").toString()); + //unidad de medida + decomisoArma.setUnidadmedida(arma.getUnidadmedidacantidad());//unidad de medida + decomisoArma.setUnidadmedidacode(arma.getUnidadmedidacantidadcodigo());//3 + //estado igual al del arma + decomisoArma.setEstado(arma.getEstado()); + decomisoArma.setEstadocode(arma.getEstadocodigo()); + //cantidad + if(arma.getCantidad()!=null){ + decomisoArma.setCantidad(new BigDecimal(arma.getCantidad())); + } + //estados anteriores + if(arma.getModifiedData().get("estadoanterior")!=null){ + decomisoArma.setEstadoanterior(arma.getModifiedData().get("estadoanterior").toString()); + } + decomisoArma.setFdecomiso((new Timestamp(new java.util.Date().getTime()))); + //codigo del arma + decomisoArma.setCarma(arma.getPk()); + tarmDecomisoArma.add(decomisoArma); + } + } + TarmCustodiaTemporal custodiaTem=null; + if(custodiaTemporalList!=null && custodiaTemporalList.size()>0){ + //seteo de los codigos de la custodia temporal + for(Object obj:custodiaTemporalList){ + custodiaTem=(TarmCustodiaTemporal)obj; + custodiaTem.setPk(getCodigo("CCUSTEMP")); + custodiaTem.setNotransaccion(getNumeroTransaccion(custodiaTem.getTiporegistro(), custodiaTem.getPk().toString())); + pSaveRequest.getResponse().put("numerotransaccion",custodiaTem.getNotransaccion()); + } + } + + //se inserta el detalle del decomiso + for(Object obj:tarmDecomisoArma){ + TarmDecomisoArma decomisoArma=(TarmDecomisoArma)obj; + if(custodiaTem!=null){ + decomisoArma.setCcustemp(custodiaTem.getPk());//codigo del arma + } + decomisoArma.setPk(getCodigo("CDECOMISOARMA")); + + } + return pSaveRequest; + } + + /** + * Metodo que devuelve la secuencia que le pertenece a una nueva persona. + * + * @return Codigo de la nueva persona. + * @throws Exception + */ + protected Integer getPersonCode() throws Exception { + Sequence sequence = new Sequence(); + Integer personcode = Integer.valueOf(sequence.getNextValue("PERSONCODE").toString()); + SaveData.getMap().put("PERSONCODE", personcode.toString()); + return personcode; + } + + /** + * Completa el codigo de la persona en la tabla TcustPersonDetail + * + * @param tcustPersonDetail Objeto que posee el registro a guardar en la tabla TcustPersonDetail. + * @param personcode Codigo de la nueva persona a ser guardada. + * @throws Exception + */ + protected void completePersonDetail(TcustPersonDetail tcustPersonDetail, Integer personcode) throws Exception { + TcustPersonDetailKey tcustPersonDetailKey = new TcustPersonDetailKey(); + tcustPersonDetailKey.setPersoncode(personcode); + tcustPersonDetail.setPk(tcustPersonDetailKey); + } + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + /** + * Metodo que devuelve la secuencia del codigo + * @param codigoSec + * @return String + * @throws Exception + */ + private String getCodigo(String codigoSec) throws Exception { + Sequence sequence = new Sequence(); + Integer solcitud = Integer.valueOf(sequence.getNextValue(codigoSec).toString()); + return solcitud.toString(); + } + /** + * Genera el numero de transaccion para la custodia + */ + private String getNumeroTransaccion(String prefijo,String secuencia){ + return prefijo+"-"+StringUtils.leftPad(secuencia, 6, '0'); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/DecomisoArmaRecepcion.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/DecomisoArmaRecepcion.java new file mode 100644 index 0000000..92a3919 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/DecomisoArmaRecepcion.java @@ -0,0 +1,143 @@ +package com.fp.armas.rules.save.solicitud; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmBodega; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.parmas.soli.TarmTransaccionArmaBodega; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.sessionbeans.helper.Sequence; + +public class DecomisoArmaRecepcion extends TransactionRule { + + /** + * + */ + private static final long serialVersionUID = -1840770563013500407L; + + @SuppressWarnings("unchecked") + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + + TarmDecomisoArmaTransaccion decomisoArmaTransaccion=(TarmDecomisoArmaTransaccion) pSaveRequest.getSaveBeanModifiedObject("DECOMISOARMATRANSACCION"); + //para las transacciones de la bodega + List transaccionArmaBodegas=(List) pSaveRequest.getSaveBeanModifiedRecords("TRANSACCIONARMABODEGA"); + List bodegas=(List) pSaveRequest.getSaveBeanModifiedRecords("BODEGA"); + + if(decomisoArmaTransaccion==null){ + return pSaveRequest; + } + + if(transaccionArmaBodegas==null){ + transaccionArmaBodegas= new ArrayList<>(); + } + if(bodegas==null){ + bodegas=new ArrayList<>(); + } + + TgeneParametersKey pKey= new TgeneParametersKey(); + pKey.setCode("CODIGO.RECEPCION"); + pKey.setCompanycode(1); + TgeneParameters parametro =TgeneParameters.find(PersistenceHelper.getEntityManager(), pKey); + + String prefijo=pSaveRequest.get("prefijo").toString(); + Calendar cal=Calendar.getInstance(); + java.sql.Date fechaRegistro=new java.sql.Date(cal.getTimeInMillis()); + //GENERA EL CODIGO PARA NUMERO DE TRANSACCION + //Long codigoGenerado = Long.parseLong(getCodigo("DECARMTRANRECECCION")); + + decomisoArmaTransaccion.setPk(Long.parseLong(getCodigo("CDECOMISOARMATRANSACCION"))); + decomisoArmaTransaccion.setFtransaccion(fechaRegistro); + decomisoArmaTransaccion.setNumerotransaccion( getNumeroTransaccion(prefijo,decomisoArmaTransaccion.getPk().toString())); + + //actualizacion del decomiso cabecera el centro control destino + TarmDecomiso decomiso=(TarmDecomiso)pSaveRequest.getSaveBeanModifiedObject("DECOMISO"); + + + TarmDecomisoArma decomisoArma=(TarmDecomisoArma)pSaveRequest.getSaveBeanModifiedObject("DECOMARMTRANRECECCION"); + List lDecomisoArma = (List)pSaveRequest.getSaveBeanModifiedRecords("DECOMARMTRANRECECCION"); + + if(lDecomisoArma.isEmpty()){ + lDecomisoArma.add(decomisoArma); + } + + for (Object object : lDecomisoArma) { + TarmDecomisoArma c=(TarmDecomisoArma)object; + if(c.getModifiedData().get("seleccion").equals(Boolean.TRUE)){ + String centroControl=null; + //bodega de origen por envio + if(c.getCdecomisoarmatransaccion()!=null && c.getCdecomisoarmatransaccion()>0){ + TarmDecomisoArmaTransaccion transa= TarmDecomisoArmaTransaccion.find(PersistenceHelper.getEntityManager(), c.getCdecomisoarmatransaccion()); + centroControl=transa.getCcentrocontrol(); + }else{ + centroControl=c.getModifiedData().get("ccentrocontrol").toString(); + } + c.setCdecarmtranrecepcion(decomisoArmaTransaccion.getPk()); + //transaccion del arma + TarmTransaccionArmaBodega tarmTransaccionArmaBodega = new TarmTransaccionArmaBodega(); + tarmTransaccionArmaBodega.setPk(Long.parseLong(getCodigo("CTRANARMBODEGA"))); + tarmTransaccionArmaBodega.setCdecomisoarmatransaccion(decomisoArmaTransaccion.getPk()); + tarmTransaccionArmaBodega.setCcentrocontrolorigen(centroControl); + tarmTransaccionArmaBodega.setCcentrocontroldestino(decomisoArmaTransaccion.getCcentrocontrol()); + tarmTransaccionArmaBodega.setCarma(c.getCarma()); + tarmTransaccionArmaBodega.setOperacioncode("OPERACIONDECOMISO"); + tarmTransaccionArmaBodega.setOperacion(parametro.getTextvalue()); + tarmTransaccionArmaBodega.setFecha(new Timestamp(new Date().getTime())); + transaccionArmaBodegas.add(tarmTransaccionArmaBodega); + //bodega actualiza o inserta + TarmBodega bodega=null; + List bodegal=PersistenceHelper.getEntityManager() + .createQuery("select o from TarmBodega o where o.carma=:carma") + .setParameter("carma", c.getCarma()) + .getResultList(); + if(bodegal!=null && bodegal.size()>0){ + bodega=bodegal.get(0); + } + if(bodega==null){ + bodega= new TarmBodega(); + bodega.setPk(Long.parseLong(getCodigo("CBODEGA"))); + } + bodega.setCarma(c.getCarma()); + bodega.setCcentrocontrol(decomisoArmaTransaccion.getCcentrocontrol()); + bodegas.add(bodega); + //actualiza la cab del decomiso centro conttrol destino + decomiso=TarmDecomiso.find(PersistenceHelper.getEntityManager(), c.getCdecomiso()); + decomiso.setCcentrocontroldestino(decomisoArmaTransaccion.getCcentrocontrol()); + } + } + pSaveRequest.getResponse().put("numerotransaccionrecep", decomisoArmaTransaccion.getNumerotransaccion()); + return pSaveRequest; + } + + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + // TODO Auto-generated method stub + return null; + } + + private String getCodigo(String codigoSec) throws Exception { + Sequence sequence = new Sequence(); + Integer solcitud = Integer.valueOf(sequence.getNextValue(codigoSec).toString()); + return solcitud.toString(); + } + + private String getNumeroTransaccion(String prefijo,String secuencia){ + System.out.println("Ingresa al secuencial"); + return prefijo+"-"+StringUtils.leftPad(secuencia, 9, '0'); + } + + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/DecomisoArmaTransaccion.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/DecomisoArmaTransaccion.java new file mode 100644 index 0000000..6638fdf --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/DecomisoArmaTransaccion.java @@ -0,0 +1,107 @@ +package com.fp.armas.rules.save.solicitud; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.parmas.soli.TarmBodega; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.parmas.soli.TarmTransaccionArmaBodega; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Transaccion rule para decomiso de arma + * @author Carlos Guzman + * + */ +public class DecomisoArmaTransaccion extends TransactionRule { + + /** + * + */ + private static final long serialVersionUID = -1840770563013500407L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + + TarmDecomisoArmaTransaccion decomisoArmaTransaccion=(TarmDecomisoArmaTransaccion) pSaveRequest.getSaveBeanModifiedObject("DECOMISOARMATRANSACCION"); + if(decomisoArmaTransaccion==null){ + return pSaveRequest; + } + Calendar cal=Calendar.getInstance(); + java.sql.Date fechaRegistro=new java.sql.Date(cal.getTimeInMillis()); + Long codigoGenerado = Long.parseLong(getCodigo("CDECOMISOARMATRANSACCION")); + + decomisoArmaTransaccion.setPk(codigoGenerado); + decomisoArmaTransaccion.setFtransaccion(fechaRegistro); + decomisoArmaTransaccion.setNumerotransaccion( getNumeroTransaccion("ENV",codigoGenerado.toString())); + TarmDecomisoArma decomisoArma=(TarmDecomisoArma)pSaveRequest.getSaveBeanModifiedObject("RPRTEDESTRUCCIONDEARMAS"); + List lDecomisoArma = (List)pSaveRequest.getSaveBeanModifiedRecords("RPRTEDESTRUCCIONDEARMAS"); + List lArmaBodega=(List)pSaveRequest.getSaveBeanModifiedRecords("TRANSACCIONARMABODEGA"); + List lBodega=(List)pSaveRequest.getSaveBeanModifiedRecords("BODEGA"); + + if(lDecomisoArma.isEmpty()){ + lDecomisoArma.add(decomisoArma); + } + + for (Object object : lDecomisoArma) { + TarmDecomisoArma c=(TarmDecomisoArma)object; + + if(c.getModifiedData().get("seleccion").equals(Boolean.TRUE)){ + c.setCdecomisoarmatransaccion(codigoGenerado); + } + } + + for (Object object : lArmaBodega) { + TarmTransaccionArmaBodega c=(TarmTransaccionArmaBodega)object; + c.setPk(Long.parseLong(getCodigo("CTRANARMBODEGA"))); + c.setCdecomisoarmatransaccion(codigoGenerado); + c.setOperacion("ENVIO"); + c.setOperacioncode("OPERACIONDECOMISO"); + c.setFecha(new java.sql.Timestamp((new Date()).getTime())); + } + + for (Object object : lBodega) { + TarmBodega c=(TarmBodega)object; + c.setPk(Long.parseLong(getCodigo("CBODEGA"))); + } + + return pSaveRequest; + } + + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + // TODO Auto-generated method stub + return null; + } + + /** + * Metodo para obtener el numero de secuencia de la base de datos + * @param codigoSec nombre del campo de la secuencia + * @return la secuencia generada + * @throws Exception + */ + private String getCodigo(String codigoSec) throws Exception { + Sequence sequence = new Sequence(); + Integer codigo = Integer.valueOf(sequence.getNextValue(codigoSec).toString()); + return codigo.toString(); + } + + /** + * Metodo que arma el numero de la transaccion + * @param prefijo prefijo a usarse pata el numero a generarse + * @param secuencia numero de secuencia + * @return el numero de documento generado + */ + private String getNumeroTransaccion(String prefijo,String secuencia){ + return prefijo+"-"+StringUtils.leftPad(secuencia, 9, '0'); + } + + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/DecomisoMaterial.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/DecomisoMaterial.java new file mode 100644 index 0000000..14740e5 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/DecomisoMaterial.java @@ -0,0 +1,220 @@ +package com.fp.armas.rules.save.solicitud; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.data.SaveData; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.pcustomer.gene.TcustPerson; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pcustomer.gene.TcustPersonPhoneKey; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Clase que se encarga de completar informacin de una solicitud de control de armas. + * + * @author C.P. + * @version 2.1 + */ +public class DecomisoMaterial extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (this.isNew(pSaveRequest)) { + return pSaveRequest; + } + //decomiso + if((List)pSaveRequest.getSaveBeanModifiedRecords("DECOMISO") == null || ((TarmDecomiso)((List)pSaveRequest.getSaveBeanModifiedRecords("DECOMISO")).get(0)).getPk()!=null){ + return pSaveRequest; + } + //personas a crear + List personDetailList = (List)pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONDETAIL"); + //registro del arma + List registroArmaList = (List)pSaveRequest.getSaveBeanModifiedRecords("TREGISTROARMAS");//seteado en el arma + //arma a decomisar + List armaList = (List)pSaveRequest.getSaveBeanModifiedRecords("ARMAS"); + + //detalle del decomiso + List tarmDecomisoArma = (List)pSaveRequest.getSaveBeanModifiedRecords("TARMDECOMISOARMA");//seteado en el decomiso + //telefono + List personPhoneList = (List)pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONPHONE"); + //TREGISTROARMAS + TcustPersonDetail personDetailPortador= null; + for(Object obj:personDetailList){ + TcustPersonDetail personaDetail=(TcustPersonDetail)obj; + if(personaDetail.getPk()==null || personaDetail.getPk().getPersoncode()==null){ + TcustPerson persona=new TcustPerson(); + persona.setPk(getPersonCode()); + //insertamos la persona + PersistenceHelper.getEntityManager().persist(persona); + completePersonDetail(personaDetail, persona.getPk()); + personaDetail.getPk().setDateto(FormatDates.getDefaultExpiryTimestamp()); + //inserta el detalle + PersistenceHelper.getEntityManager().persist(personaDetail); + } + personDetailPortador=personaDetail; + if(personPhoneList!=null){ + for(Object objPhone:personPhoneList){ + TcustPersonPhone telefono=(TcustPersonPhone)objPhone; + telefono.setPk(new TcustPersonPhoneKey()); + telefono.getPk().setPhonesequence(1); + telefono.getPk().setDateto(FormatDates.getDefaultExpiryTimestamp()); + telefono.getPk().setPersoncode(personDetailPortador.getPk().getPersoncode()); + } + } + } + + //DECOMISO + TarmDecomiso decomiso=null; + //se inserta el DECOMISO cabecera + for(Object obj:(List)pSaveRequest.getSaveBeanModifiedRecords("DECOMISO")){ + decomiso=(TarmDecomiso)obj; + if(personDetailPortador!=null && personDetailPortador.getPk()!=null && personDetailPortador.getPk().getPersoncode()!=null){ + decomiso.setPersoncode(personDetailPortador.getPk().getPersoncode()); + } + decomiso.setPk(Long.parseLong(getCodigo("CDECOMISO"))); + decomiso.setNumerotransaccion(getNumeroTransaccion(decomiso.getTipoproceso(), decomiso.getPk().toString())); + } + + //registramos el arma y si ya existe le cambiamos de estado + for(Object obj:armaList){ + TarmArmas arma=(TarmArmas)obj; + TarmRegistroArmas registroArma=null; + if(arma.getUnidadmedidacantidad()==null || arma.getUnidadmedidacantidad().trim().length()==0){ + arma.setUnidadmedidacantidad(arma.getModifiedData().get("unidadmedidadesc").toString()); + } + //creamos el arma + arma.setPk(getCodigo("CARMA")); + //SI ES NUEVA CREA + if(arma.getCodigoarma()==null || arma.getCodigoarma().trim().length()==0){ + arma.setCodigoarma(arma.getPk()); + } + //REGISTRO ARMA + if(arma.getModifiedData().get("personcode")!=null && arma.getModifiedData().get("tiporegistro")!=null){ + registroArma=new TarmRegistroArmas(); + //PK + registroArma.setPk(Long.parseLong(getCodigo("CREGISTRO"))); + //personcode + registroArma.setPersoncode(Integer.parseInt(arma.getModifiedData().get("personcode").toString())); + registroArma.setTiporegistro(arma.getModifiedData().get("tiporegistro").toString()); + registroArma.setTiporegistrocodigo(arma.getModifiedData().get("tiporegistrocode").toString()); + //pais de origen + registroArma.setPaisorigen(arma.getModifiedData().get("paisorigen").toString()); + //fecha de creacion + registroArma.setFcreacion(new java.sql.Date(new Date().getTime())); + registroArmaList.add(registroArma); + } + + //validamos el pk de REGISTROARMA + if(registroArma!=null && registroArma.getPk()!=null){ + arma.setCregistro(registroArma.getPk()); + } + //seteo del detalle del DECOMISOARMA y a que arma se le hace el decomiso + TarmDecomisoArma decomisoArma= new TarmDecomisoArma(); + decomisoArma.setCarma( arma.getPk()); + //estadoarma es igual que el estado del arma + decomisoArma.setEstado(arma.getEstado()); + decomisoArma.setEstadocode(arma.getEstadocodigo()); + //motivo del decomiso + decomisoArma.setMotivodecomiso(arma.getModifiedData().get("motivocatalogo").toString());//motivo + decomisoArma.setMotivodecomisocodigo(arma.getModifiedData().get("motivocatalogocode").toString());//1 + //observacion + decomisoArma.setObservacion(arma.getModifiedData().get("observaciondecomiso").toString()); + //cantidad + decomisoArma.setCantidad(new BigDecimal(arma.getModifiedData().get("cantidad").toString()));//cantidad + //unidad del arma o material explosivo + + decomisoArma.setUnidadmedida(arma.getUnidadmedidacantidad());//unidad de medida + decomisoArma.setUnidadmedidacode(arma.getUnidadmedidacantidadcodigo());//3 + //fecha del decomiso arma la actual + decomisoArma.setFdecomiso(new Timestamp(new java.util.Date().getTime())); + //codigo del decomiso + decomisoArma.setPk(getCodigo("CDECOMISOARMA")); + //codigo del decomiso + decomisoArma.setCdecomiso(decomiso.getPk()); + //en bodega + decomisoArma.setEnbodega("Y"); + tarmDecomisoArma.add(decomisoArma); + } + + + pSaveRequest.getResponse().put("numerotransaccion",decomiso.getNumerotransaccion()); + //datos para el flujo + pSaveRequest.getResponse().put("cdecomiso", decomiso.getPk()); + + return pSaveRequest; + } + + /** + * Metodo que devuelve la secuencia que le pertenece a una nueva persona. + * + * @return Codigo de la nueva persona. + * @throws Exception + */ + protected Integer getPersonCode() throws Exception { + Sequence sequence = new Sequence(); + Integer personcode = Integer.valueOf(sequence.getNextValue("PERSONCODE").toString()); + SaveData.getMap().put("PERSONCODE", personcode.toString()); + return personcode; + } + + /** + * Completa el codigo de la persona en la tabla TcustPersonDetail + * + * @param tcustPersonDetail Objeto que posee el registro a guardar en la tabla TcustPersonDetail. + * @param personcode Codigo de la nueva persona a ser guardada. + * @throws Exception + */ + protected void completePersonDetail(TcustPersonDetail tcustPersonDetail, Integer personcode) throws Exception { + TcustPersonDetailKey tcustPersonDetailKey = new TcustPersonDetailKey(); + tcustPersonDetailKey.setPersoncode(personcode); + tcustPersonDetail.setPk(tcustPersonDetailKey); + } + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + /** + * Metodo que devuelve la secuencia del codigo + * @param codigoSec + * @return String + * @throws Exception + */ + private String getCodigo(String codigoSec) throws Exception { + Sequence sequence = new Sequence(); + String solcitud = sequence.getNextValue(codigoSec).toString(); + return solcitud; + } + + private String getNumeroTransaccion(String prefijo,String secuencia){ + System.out.println("Ingresa al secuencial armas"); + return prefijo+"-"+StringUtils.leftPad(secuencia, 9, '0'); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/DocumentoHabilitanteTransaccion.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/DocumentoHabilitanteTransaccion.java new file mode 100644 index 0000000..1734606 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/DocumentoHabilitanteTransaccion.java @@ -0,0 +1,108 @@ +package com.fp.armas.rules.save.solicitud; + +import java.util.List; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.parmas.inte.TarmColadeImpresion; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitanteDetall; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Clase transaction rule para registrar el documento habilitante + * @author Carlos Guzman + * + */ +public class DocumentoHabilitanteTransaccion extends TransactionRule { + + /** + * + */ + private static final long serialVersionUID = -1840770563013500407L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + + TarmDocumentoHabilitante documentoHabilitante=(TarmDocumentoHabilitante) pSaveRequest.getSaveBeanModifiedObject("DOCUMENTOHABILITANTE"); + if(documentoHabilitante==null){ + return pSaveRequest; + } + + TarmColadeImpresion colaImpresion=(TarmColadeImpresion)pSaveRequest.getSaveBeanModifiedObject("BODEGA"); + + + Long codigoGenerado = Long.parseLong(getCodigo("TARMDOCUMENTOHABILITANTE")); + + documentoHabilitante.setPk(codigoGenerado); + documentoHabilitante.setNumerodocumento(getNumeroTransaccion("DOC",codigoGenerado.toString())); + + if(colaImpresion!=null){ + colaImpresion.setPk(getCodigo("TARMCOLADEIMPRESION")); + colaImpresion.setCdocumento(codigoGenerado); + } + + TarmDocumentoHabilitanteDetall documentohabilitanteDetall=(TarmDocumentoHabilitanteDetall)pSaveRequest.getSaveBeanModifiedObject("DOCUMENTOHABILITANTEDETAIL"); + List lDocumentohabilitanteDetall = null; + if(documentohabilitanteDetall==null){ + lDocumentohabilitanteDetall = (List)pSaveRequest.getSaveBeanModifiedRecords("DOCUMENTOHABILITANTEDETAIL"); + } + if(documentohabilitanteDetall!=null || (documentohabilitanteDetall==null && lDocumentohabilitanteDetall!=null)){ + //lDocumentohabilitanteDetall = (List)pSaveRequest.getSaveBeanModifiedRecords("DOCUMENTOHABILITANTEDETAIL"); + if(documentohabilitanteDetall!=null && (lDocumentohabilitanteDetall == null ||lDocumentohabilitanteDetall.size()==0)){ + documentohabilitanteDetall.setPk(getCodigo("CODIGODETALLE")); + documentohabilitanteDetall.setCdocumento(codigoGenerado); + } + else{ + if(lDocumentohabilitanteDetall!=null && lDocumentohabilitanteDetall.isEmpty() && documentohabilitanteDetall!=null){ + lDocumentohabilitanteDetall.add(documentohabilitanteDetall); + } + if(lDocumentohabilitanteDetall!=null && !lDocumentohabilitanteDetall.isEmpty()){ + + for (Object object : lDocumentohabilitanteDetall) { + TarmDocumentoHabilitanteDetall c=(TarmDocumentoHabilitanteDetall)object; + c.setPk(getCodigo("CODIGODETALLE")); + c.setCdocumento(codigoGenerado); + } + } + + } + } + + + return pSaveRequest; + } + + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + // TODO Auto-generated method stub + return null; + } + + /** + * Metodo para obtener el numero de secuencia de la base de datos + * @param codigoSec nombre del campo de la secuencia + * @return la secuencia generada + * @throws Exception + */ + private String getCodigo(String codigoSec) throws Exception { + Sequence sequence = new Sequence(); + Integer documento = Integer.valueOf(sequence.getNextValue(codigoSec).toString()); + return documento.toString(); + } + + /** + * Metodo que arma el numero de la transaccion + * @param prefijo prefijo a usarse pata el numero a generarse + * @param secuencia numero de secuencia + * @return el numero de documento generado + */ + private String getNumeroTransaccion(String prefijo,String secuencia){ + return prefijo+"-"+StringUtils.leftPad(secuencia, 9, '0'); + } + + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/OrdenTrabajoSave.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/OrdenTrabajoSave.java new file mode 100644 index 0000000..9c0c718 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/OrdenTrabajoSave.java @@ -0,0 +1,58 @@ +package com.fp.armas.rules.save.solicitud; + +import java.util.List; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.fun.TarmSolicitudImportacion; +import com.fp.persistence.parmas.soli.TarmOrdenTrabajo; +import com.fp.persistence.parmas.soli.TarmOrdenTrabajoCustodios; +import com.fp.sessionbeans.helper.Sequence; + +public class OrdenTrabajoSave extends TransactionRule { + + /** + * + */ + private static final long serialVersionUID = 1L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + + TarmOrdenTrabajo ordenTrabajo=(TarmOrdenTrabajo) pSaveRequest.getSaveBeanModifiedObject("ORDENTRABAJOCONTROLLER"); + if(ordenTrabajo==null){ + return pSaveRequest; + } + + TarmOrdenTrabajoCustodios custodio=(TarmOrdenTrabajoCustodios)pSaveRequest.getSaveBeanModifiedObject("CUSTODIOSCONTROLLER");; + List lcustodios = (List)pSaveRequest.getSaveBeanModifiedRecords("CUSTODIOSCONTROLLER"); + + if(lcustodios.isEmpty()){ + lcustodios.add(custodio); + } + + //PersistenceHelper.getEntityManager().merge(ordenTrabajo); + PersistenceHelper.getEntityManager().persist(ordenTrabajo); + for (Object object : lcustodios) { + TarmOrdenTrabajoCustodios c=(TarmOrdenTrabajoCustodios)object; + + //Sequence sequence = new Sequence(); + //String codigoCustodio = sequence.getNextValue("CORDENTRABAJOCUSTODIOS").toString(); + + //c.setPk(Long.parseLong(codigoCustodio)); + c.setCordentrabajo(ordenTrabajo.getPk()); + PersistenceHelper.getEntityManager().persist(c); + } + PersistenceHelper.getEntityManager().flush(); + + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/RegistroInspeccion.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/RegistroInspeccion.java new file mode 100644 index 0000000..259b983 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/RegistroInspeccion.java @@ -0,0 +1,83 @@ +package com.fp.armas.rules.save.solicitud; + +import java.util.List; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmInspeccion; +import com.fp.persistence.parmas.soli.TarmInspeccionArchivo; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Clase que se encarga de completar información de una solicitud de control de armas. + * + * @author C.P. + * @version 2.1 + */ +public class RegistroInspeccion extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + List inspeccion = (List)pSaveRequest.getSaveBeanModifiedRecords("INSPECCION"); + if(inspeccion!=null){ + List archivoList = (List)pSaveRequest.getSaveBeanModifiedRecords("INSPECCIONARCHIVO"); + TarmInspeccion tarmInspeccion = (TarmInspeccion)inspeccion.get(0); + tarmInspeccion.setPk(Long.valueOf(getCodigoSolicitud())); + tarmInspeccion.setNumordentrabajo(getNumeroTransaccion("TRA",tarmInspeccion.getPk().toString())); + PersistenceHelper.getEntityManager().persist(tarmInspeccion); + if(archivoList!=null && archivoList.size()>0){ + for(Object obj:archivoList){ + TarmInspeccionArchivo archivo=(TarmInspeccionArchivo)obj; + archivo.setCinspeccion(tarmInspeccion.getPk()); + PersistenceHelper.getEntityManager().persist(archivo); + } + } + PersistenceHelper.getEntityManager().flush(); + pSaveRequest.getResponse().put("numerotrabajo", tarmInspeccion.getNumordentrabajo()); + } + + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + /** + * Metodo que devuelve la secuencia de una solicitud de viaticos. + * + * @return Codigo de la nueva solicitud de viaticos. + * @throws Exception + */ + private String getCodigoSolicitud() throws Exception { + Sequence sequence = new Sequence(); + Integer solcitud = Integer.valueOf(sequence.getNextValue("CINSPECCION").toString()); + return solcitud.toString(); + } + + /** + * Metodo para generar el numero de trabajo + * @param prefijo + * @param secuencia + * @return String + */ + private String getNumeroTransaccion(String prefijo,String secuencia){ + return prefijo+"-"+StringUtils.leftPad(secuencia, 9, '0'); + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/Requisitos.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/Requisitos.java new file mode 100644 index 0000000..ce91bae --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/Requisitos.java @@ -0,0 +1,95 @@ +package com.fp.armas.rules.save.solicitud; + +import java.util.List; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.parmas.soli.TarmSolicitudAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.parmas.soli.TarmSolicitudGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitos; + +/** + * Clase que se encarga de completar información de requisitos de una solicitud de tramites. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class Requisitos extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /** + * Almacena toda la información correspondiente a la solicitud + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (Constant.ifYes((String) pSaveRequest.get("isnew")) || pSaveRequest.get("csolicitud") == null) { + return pSaveRequest; + } + String codSolicitud = (String) pSaveRequest.get("csolicitud"); + List lintegrantes = pSaveRequest.getSaveBeanModifiedRecords("REQUISITOPORTIPOTRAMITE"); + if (lintegrantes != null && !lintegrantes.isEmpty()) { + for (Object object : lintegrantes) { + TarmSolicitudRequisitos obj = (TarmSolicitudRequisitos) object; + if (obj.getPk().getCsolicitud() == null) { + obj.getPk().setCsolicitud(codSolicitud); + } + } + } + + List lguardias = pSaveRequest.getSaveBeanModifiedRecords("SOLICITUDGUARDIAS"); + if(lguardias != null && !lguardias.isEmpty()){ + for (Object object : lguardias) { + TarmSolicitudGuardias obj = (TarmSolicitudGuardias) object; + if (obj.getPk().getCsolicitud() == null) { + obj.getPk().setCsolicitud(codSolicitud); + } + } + } + + List larmas = pSaveRequest.getSaveBeanModifiedRecords("RECEPCIONARMAS"); + if(larmas != null && !larmas.isEmpty()){ + for (Object object : larmas) { + TarmSolicitudArmas obj = (TarmSolicitudArmas) object; + if (obj.getPk().getCsolicitud() == null) { + obj.getPk().setCsolicitud(codSolicitud); + } + } + } + + List lagencias = pSaveRequest.getSaveBeanModifiedRecords("SOLICITUDAGENCIA"); + if(lagencias != null && !lagencias.isEmpty()){ + for (Object object : lagencias) { + TarmSolicitudAgenciaSucursal obj = (TarmSolicitudAgenciaSucursal) object; + if(obj.getPk().getCsolicitud() == null){ + obj.getPk().setCsolicitud(codSolicitud); + } + } + } + + List ldocumentos = pSaveRequest.getSaveBeanModifiedRecords("DOCUMENTOSCONTROLLER"); + if(ldocumentos != null && !ldocumentos.isEmpty()){ + for (Object object : ldocumentos) { + TarmSolicitudDocumento obj = (TarmSolicitudDocumento) object; + if(obj.getPk().getCsolicitud() == null){ + obj.getPk().setCsolicitud(codSolicitud); + } + } + } + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/Solicitud.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/Solicitud.java new file mode 100644 index 0000000..646c0de --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitud/Solicitud.java @@ -0,0 +1,75 @@ +package com.fp.armas.rules.save.solicitud; + +import java.sql.Date; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Clase que se encarga de completar información de una solicitud de control de armas. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class Solicitud extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /** + * Genera el secuencial de la solicitud completa datos generales de la solicitud en su creacion + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (Constant.ifYes((String) pSaveRequest.get("isnew")) || pSaveRequest.get("csolicitud") != null) { + return pSaveRequest; + } + String codSolicitud = null; + TarmSolicitud tarmsolicitud = (TarmSolicitud) pSaveRequest.getSaveBeanModifiedObject("SOLICITUD"); + if (tarmsolicitud == null) { + return pSaveRequest; + } + codSolicitud = tarmsolicitud.getPk(); + if (codSolicitud == null) { + codSolicitud = this.getCodigoSolicitud(); + tarmsolicitud.setPk(codSolicitud); + tarmsolicitud.setFreal(FormatDates.getInstance().getDataBaseTimestamp()); + tarmsolicitud.setEstado("REG"); + tarmsolicitud.setEstadocodigo("ESTADOSOLICITUD"); + tarmsolicitud.setOrigenadquisicioncodigo("ORIGENADQUISICION"); + //tarmsolicitud.setTipopagocodigo("TIPOPAGOSOLICITUD"); + String freal = FormatDates.getInstance().getTransportDateFormat().format(tarmsolicitud.getFreal()); + Date f = new Date(FormatDates.getInstance().getTransportDateFormat().parse(freal).getTime()); + tarmsolicitud.setFregistro(f); + pSaveRequest.getResponse().put("csolicitud", codSolicitud); + pSaveRequest.put("csolicitud", codSolicitud); + } + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + /** + * Metodo que devuelve la secuencia de una solicitud de viaticos. + * + * @return Codigo de la nueva solicitud de viaticos. + * @throws Exception + */ + private String getCodigoSolicitud() throws Exception { + Sequence sequence = new Sequence(); + Integer solcitud = Integer.valueOf(sequence.getNextValue("SOLICTUDCONTROLARMAS").toString()); + return solcitud.toString(); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/.svn/entries b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/.svn/entries new file mode 100644 index 0000000..e7b4f06 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion +svn://172.17.26.185/COMACO + + + +2021-05-14T20:43:26.035487Z +4634 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +Inventarios.java +file + + + + +2022-07-28T03:40:41.210796Z +75bfba955b209ed54fd7292212b42280 +2016-04-11T16:59:25.761122Z +4533 +fpazmino + + + + + + + + + + + + + + + + + + + + + +14721 + +PreviaImportacionDesgloce.java +file + + + + +2022-07-28T03:40:41.210796Z +02cd33cc0d2cc6da09bdba94e7d9b7ce +2016-03-11T17:33:35.846808Z +4496 +fpazmino + + + + + + + + + + + + + + + + + + + + + +16412 + +SolicitudImportacion.java +file + + + + +2022-07-28T03:40:41.210796Z +35cf095908d1c7c3fdf30f370786454f +2015-06-27T13:42:18.237444Z +4143 +fpazmino + + + + + + + + + + + + + + + + + + + + + +11688 + +IngresoInventario.java +file + + + + +2022-07-28T03:40:41.211796Z +4e0d408d81535601904d4793e3c9df09 +2015-09-16T09:16:33.704663Z +4278 +fpazmino + + + + + + + + + + + + + + + + + + + + + +11701 + +CompletarDesaduanizacion.java +file + + + + +2022-07-28T03:40:41.211796Z +77302d814b60e8930d90e44c56c827f6 +2016-01-20T16:57:50.208221Z +4389 +fpazmino + + + + + + + + + + + + + + + + + + + + + +4968 + +ImportacionProduccion.java +file + + + + +2022-07-28T03:40:41.211796Z +5170fbe4ed5600da688a13233737290f +2021-05-14T20:43:26.035487Z +4634 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +15229 + diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/.svn/text-base/CompletarDesaduanizacion.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/.svn/text-base/CompletarDesaduanizacion.java.svn-base new file mode 100644 index 0000000..fb290aa --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/.svn/text-base/CompletarDesaduanizacion.java.svn-base @@ -0,0 +1,130 @@ +package com.fp.armas.rules.save.solicitudimportacion; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.armas.rules.exception.ControlArmasException; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.parmas.param.TarmComercianteCupo; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Ingresa un registro y actualiza la tabla de cupos + * @author Andres Cevallos + * + */ +public class CompletarDesaduanizacion extends TransactionRule { + + + private static final long serialVersionUID = 1L; + private static final String JPQL_ARMASDELTRAMITESINLOTE = "FROM TarmArmas ARM WHERE " + + "ARM.pk IN (select SA.pk.carma from TarmSolicitudArmas SA WHERE SA.pk.csolicitud = :csolicitud) AND ARM.lote IS NULL"; + + private static final String JPQL_TRAMITEACTUAL = "FROM TarmSolicitudTramite t WHERE t.pk.csolicitud = :noSolicitud"; + + private static final String JPQL_LOTEDUPLICADO = "FROM TarmArmas ARM WHERE ARM.pk IN " + + "(select SA.pk.carma from TarmSolicitudArmas SA WHERE SA.pk.csolicitud = :csolicitud) AND ARM.lote = :lote"; + + + /* (non-Javadoc) + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + @SuppressWarnings("unchecked") + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { +// try { + Boolean requiereDesgloce = (Boolean) pSaveRequest.get("REQUIEREDESGLOCE"); + if(!requiereDesgloce){ + System.out.println("*****COMPLETAR LA DESADUANIZACION*****"); + EntityManager em=PersistenceHelper.getEntityManager(); + ListarmasLst=(List)pSaveRequest.getSaveBeanModifiedRecords("DESADUANIZACION"); + String noSolicitud=pSaveRequest.get("noSolicitud").toString(); + TarmSolicitudTramite solicitudTramiteObj = consultaTramiteActual(em, noSolicitud); + Boolean validaDuplicados = Boolean.FALSE; + for(Object armaTmp:armasLst){ + TarmArmas arma=(TarmArmas)armaTmp; + TarmArmas armaDuplicada = consultaLoteDuplicado(em, noSolicitud, arma.getLote()); + if(armaDuplicada!=null){ + throw new ControlArmasException("ARM-0001", "EL LOTE {0} SE ENCUENTRA DUPLICADO.", armaDuplicada.getLote()); + } + } + + for(Object armaTmp:armasLst){ + TarmArmas arma=(TarmArmas)armaTmp; + em.merge(arma); + } + em.flush(); + if(solicitudTramiteObj!=null){ + if(!existeArmasConLotePendienteIngreso(em, solicitudTramiteObj.getPk().getCsolicitud())){ + solicitudTramiteObj.setEstadotramite("FIN"); + em.merge(solicitudTramiteObj); + em.flush(); + } + } + } +// } catch (Exception e) { +// return pSaveRequest; +// // TODO: handle exception +// } + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + + return arg0; + } + + public Boolean existeArmasConLotePendienteIngreso(EntityManager pEntityManager,String csolicitud){ + Boolean resultado = Boolean.FALSE; + Query qry = pEntityManager.createQuery(CompletarDesaduanizacion.JPQL_ARMASDELTRAMITESINLOTE); + qry.setParameter("csolicitud", csolicitud); + ListarmasPendientesLst = qry.getResultList(); + + if(armasPendientesLst!=null && !armasPendientesLst.isEmpty()){ + resultado = Boolean.TRUE; + } + return resultado; + } + public TarmSolicitudTramite consultaTramiteActual(EntityManager pEntityManager,String noSolicitud){ + Query qry = pEntityManager.createQuery(CompletarDesaduanizacion.JPQL_TRAMITEACTUAL); + qry.setParameter("noSolicitud", noSolicitud); + ListsolicitudTramiteLst = qry.getResultList(); + + if(solicitudTramiteLst!=null && !solicitudTramiteLst.isEmpty()){ + return solicitudTramiteLst.get(0); + } + else{ + return null; + } + } + + public TarmArmas consultaLoteDuplicado(EntityManager pEntityManager,String csolicitud, String lote){ + Query qry = pEntityManager.createQuery(CompletarDesaduanizacion.JPQL_LOTEDUPLICADO); + qry.setParameter("csolicitud", csolicitud); + qry.setParameter("lote", lote); + ListarmasConLoteDuplicadoLst = qry.getResultList(); + + if(armasConLoteDuplicadoLst!=null && !armasConLoteDuplicadoLst.isEmpty()){ + return armasConLoteDuplicadoLst.get(0); + } + else{ + return null; + } + } +} \ No newline at end of file diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/.svn/text-base/ImportacionProduccion.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/.svn/text-base/ImportacionProduccion.java.svn-base new file mode 100644 index 0000000..dbf63a0 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/.svn/text-base/ImportacionProduccion.java.svn-base @@ -0,0 +1,337 @@ +package com.fp.armas.rules.save.solicitudimportacion; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.fun.TarmCargaDetalle; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Realiza el mantenimiento de totales y maestro detalle del ingreso + * @author fpazmino + * + */ +public class ImportacionProduccion extends TransactionRule { + + + private static final long serialVersionUID = 1L; + private static final String JPQL_TIPOARMAEXPLOSIVO = "from TarmTipoArmaExplosivo tae" + " where tae.pk = :pk"; + private static final String JPQL_DIRECCION_PRINCIPAL="from TcustPersonAddress o WHERE o.pk.personcode=:personcode AND o.pk.dateto=:dateto AND o.principal=:principal"; + private static final String JPQL_ULTIMO_TOTAL_PERSONA = "from TarmTotalPersona o where o.personcodigo=:personcode AND o.clase=:clase AND o.tipoarmaexplosivo=:tipoarmaexplosivo AND o.unidadmedidapeso=:unidadmedidapeso AND o.fecha = (Select max(tp.fecha) from TarmTotalPersona tp where tp.personcodigo=:personcode AND tp.clase=:clase AND tp.tipoarmaexplosivo=:tipoarmaexplosivo AND tp.unidadmedidapeso=:unidadmedidapeso)"; + + + /* (non-Javadoc) + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + @SuppressWarnings("unchecked") + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + try { + System.out.println("INGRESA A INGRESO DE REGISTRO DE PRODUCCION O IMPORTACION"); + List listaArmas=(ArrayList)pSaveRequest.get("LISTAARMAS"); + List listaArmasEliminadas=(ArrayList)pSaveRequest.get("LISTAARMASELIMINADAS"); + String tipoRegistro = pSaveRequest.get("TIPOREGISTRO").toString(); + TarmRegistroArmas registroArmas=(TarmRegistroArmas)pSaveRequest.get("REGISTRO"); + String personCode=pSaveRequest.get("PERSONCODE").toString(); + Boolean esNuevaImportacion=(Boolean) pSaveRequest.get("ESNUEVAIMPORTACION"); + EntityManager pEntityManager=PersistenceHelper.getEntityManager(); + if(registroArmas.isnew){ + generarRegistroArmas(pEntityManager,registroArmas,tipoRegistro); + } + System.out.println("tipoRegistro" + tipoRegistro); + System.out.println("cantidad armas" + listaArmas.size()); + System.out.println("registroArmas" + registroArmas.getPk()); + // Registramos la carga + TarmCarga carga = (TarmCarga)pSaveRequest.get("TARMCARGA"); +// if(tipoRegistro.equals("PRO") || (tipoRegistro.equals("IMP") && esNuevaImportacion)){ + if(carga.isnew){ + if(tipoRegistro.equals("PRO")){ + carga.setTipocarga("PRO"); + }else if(tipoRegistro.equals("IMP")){ + carga.setTipocarga("IMP"); + } + carga.setAucp(registroArmas.getSolicitudnum()); + carga.setEsdesaduanizado("N"); + carga.setFecha(new Timestamp(new Date().getTime())); + carga.setPersoncode(Integer.valueOf(personCode)); + carga.setCregistro(registroArmas.getPk()); + carga.setPk(getCodigoCarga()); + pEntityManager.persist(carga); + pEntityManager.flush(); + } +// else{ +// carga=(TarmCarga)pSaveRequest.get("TARMCARGA"); +// } + TcustPersonAddress direccionPrincipal = obtenerDireccionPrincipal(Integer.valueOf(personCode)); + // Fecha de registro comun a todas las armas ingresadas + java.sql.Date fechaRegistro = new java.sql.Date(new Date().getTime()); + for(TarmArmas armasObj : listaArmas){ + TarmTipoArmaExplosivo tipoArmaExplosivoObj = findTipoArmaExpByCTipoArmaExp(pEntityManager, armasObj.getCtipoarmaexplosivo()); + if(armasObj.isnew){ + armasObj = generarArma(pEntityManager,registroArmas, armasObj, direccionPrincipal, tipoRegistro, armasObj.getCantidad(), fechaRegistro); + } + else{ + pEntityManager.merge(armasObj); + } + System.out.println("1.tipoRegistro:"+tipoRegistro); + System.out.println("2. armasObj.isnew:"+armasObj.isnew); + // Afectacion en la tabla de totales en el caso de registro de produccion + if(tipoRegistro.equals("PRO")|| armasObj.isnew){ + System.out.println("3.actualizarTotalPersona"); +// new BigDecimal(getCantidad()):armasObj.getPeso()) + BigDecimal cantidadPeso = BigDecimal.ZERO; + TgeneCatalogDetailKey pkUnidades = new TgeneCatalogDetailKey(); + pkUnidades.setCatalog(tipoArmaExplosivoObj.getUnidadmedidapeso()); + pkUnidades.setCatalogcode(tipoArmaExplosivoObj.getUnidadmedidapesocodigo()); + TgeneCatalogDetail unidadesCatalog = TgeneCatalogDetail.find(pEntityManager, pkUnidades); + if(unidadesCatalog!=null && unidadesCatalog.getLegalcode().equals("CANTIDAD")){ + cantidadPeso = new BigDecimal(armasObj.getCantidad()); + }else{ + cantidadPeso = armasObj.getPeso(); + } + actualizarTotalPersona(pEntityManager, tipoArmaExplosivoObj, personCode, cantidadPeso); + } + // Registramos el detalle de la carga + if(armasObj.isnew){ + TarmCargaDetalle cargaDetalle = new TarmCargaDetalle(); + cargaDetalle.setPk(getCodigoCargaDetalle()); + cargaDetalle.setCarma(armasObj.getPk()); + cargaDetalle.setCcarga(carga.getPk()); + pEntityManager.persist(cargaDetalle); + } + + } + + for(TarmArmas armasObj : listaArmasEliminadas){ + // Borra registro de la tabla TarmCargaDetalle + Query q = pEntityManager.createQuery("delete from TarmCargaDetalle where ccarga= :ccarga and carma= :carma"); + q.setParameter("ccarga", carga.getPk()); + q.setParameter("carma", armasObj.getPk()); + q.executeUpdate(); + // Borra registro de la tabla TarmCargaDetalle + TarmArmas armaAEliminarse = TarmArmas.find(pEntityManager, armasObj.getPk()); + pEntityManager.remove(armaAEliminarse); + } + } catch (Exception e) { + return pSaveRequest; + // TODO: handle exception + } + return pSaveRequest; + } + + public void generarRegistroArmas(EntityManager pEntityManager, TarmRegistroArmas registroArmas, String tipoRegistro){ + try { + Sequence sequence = new Sequence(); + String cRegistro = sequence.getNextValue("CREGISTRO").toString(); + registroArmas.setPk(Long.parseLong(cRegistro)); + pEntityManager.persist(registroArmas); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public TarmArmas generarArma(EntityManager pEntityManager, TarmRegistroArmas registroArmas, TarmArmas armaParam, TcustPersonAddress direccionPrincipal, String tipoRegistro, Integer cantidad, java.sql.Date fechaRegistro){ + try { + TarmArmas arma = (TarmArmas) armaParam.cloneMe(); + // Setear el estado del arma + if(tipoRegistro.equals("IMP")){ + arma.setEstado("IMPO"); + }else if(tipoRegistro.equals("PRO")){ + arma.setEstado("REG"); + } + arma.setCregistro(registroArmas.getPk()); + arma.setCantidad(cantidad); + String carma = getCodigoArmas(); + arma.setPk(carma); + arma.setCodigoarma(carma); + + // Poner datos de la Ubicacion del arma + if(direccionPrincipal!=null){ + arma.setCountrycode(direccionPrincipal.getCountrycode()); + arma.setProvincecode(direccionPrincipal.getProvincecode()); + arma.setCantoncode(direccionPrincipal.getCantoncode()); + arma.setParroquiacode(direccionPrincipal.getParroquiacode()); + arma.setCitycode(direccionPrincipal.getCitycode()); + arma.setDireccion(direccionPrincipal.getAddress()); + } + arma.setColorcodigo("COLOR"); + arma.setUnidadmedidacantidadcodigo("UNIDADMEDIDA"); + arma.setFecharegistro(fechaRegistro); + arma.setCpaisorigen(registroArmas.getPaisorigen()); + pEntityManager.persist(arma); + return arma; + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return null; + } + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + + return arg0; + } + + /** + * Encuentra una lista de tipo de armas y explosivos + * @param pEntityManager + * @param pk + * @return + * @throws Exception + */ + public static TarmTipoArmaExplosivo findTipoArmaExpByCTipoArmaExp(EntityManager pEntityManager, String pk) throws Exception { + Query qry = pEntityManager.createQuery(ImportacionProduccion.JPQL_TIPOARMAEXPLOSIVO); + qry.setParameter("pk", pk); + ListresultList = qry.getResultList(); + if(resultList!=null && resultList.size()>0){ + return (TarmTipoArmaExplosivo) qry.getResultList().get(0); + }else{ + return null; + } + } + + /** + * Actualizar tabla TarmTotalPersona + * @param pEntityManager + * @param EntityManager pEntityManager, TarmTipoArmaExplosivo tipoArmaExplosivo, String personcode, BigDecimal cantidadPeso + * @return void + * @throws Exception + */ + public void actualizarTotalPersona(EntityManager pEntityManager, TarmTipoArmaExplosivo tipoArmaExplosivo, String personcode, BigDecimal cantidadPeso) throws Exception { + Query qry = pEntityManager.createQuery(ImportacionProduccion.JPQL_ULTIMO_TOTAL_PERSONA); + qry.setParameter("personcode", Integer.valueOf(personcode)); + qry.setParameter("clase", tipoArmaExplosivo.getClase()); + qry.setParameter("tipoarmaexplosivo", tipoArmaExplosivo.getTipoarmaexplosivo()); + qry.setParameter("unidadmedidapeso", tipoArmaExplosivo.getUnidadmedidapeso()); + ListresultList = qry.getResultList(); + String cTotalPersona = getCodigoTotalPersona(); + if(resultList!=null && resultList.size()>0){ + TarmTotalPersona totalPersonaAnterior = resultList.get(0); + // Actualiza la tabla de totales cuando existen datos anteriores + TarmTotalPersona totalPersona = new TarmTotalPersona(); + totalPersona.setClase(tipoArmaExplosivo.getClase()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(tipoArmaExplosivo.getTipoarmaexplosivo()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setUnidadmedidapeso(tipoArmaExplosivo.getUnidadmedidapeso()); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setPersoncodigo(Integer.valueOf(personcode)); + totalPersona.setSaldoanterior(totalPersonaAnterior.getTotal()); + totalPersona.setCantidadmovimiento(cantidadPeso); + totalPersona.setTotal(totalPersonaAnterior.getTotal().add(cantidadPeso)); + totalPersona.setFecha(new Timestamp(new Date().getTime())); + totalPersona.setIngresoegreso("ING"); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + totalPersona.setPk(cTotalPersona); + pEntityManager.detach(totalPersona); + pEntityManager.persist(totalPersona); + System.out.println("Saldoanterior,"+totalPersona.getSaldoanterior()+",Cantidadmovimiento,"+totalPersona.getCantidadmovimiento()+",Total,"+totalPersona.getTotal()+",fecha,"+totalPersona.getFecha()); + }else{ + // Actualiza la tabla de totales cuando NO existen datos anteriores + TarmTotalPersona totalPersona = new TarmTotalPersona(); + totalPersona.setClase(tipoArmaExplosivo.getClase()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(tipoArmaExplosivo.getTipoarmaexplosivo()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setUnidadmedidapeso(tipoArmaExplosivo.getUnidadmedidapeso()); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setPersoncodigo(Integer.valueOf(personcode)); + totalPersona.setSaldoanterior(BigDecimal.ZERO); + totalPersona.setCantidadmovimiento(cantidadPeso); + totalPersona.setTotal(cantidadPeso); + totalPersona.setFecha(new Timestamp(new Date().getTime())); + totalPersona.setIngresoegreso("ING"); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + totalPersona.setPk(cTotalPersona); + pEntityManager.persist(totalPersona); + System.out.println("Saldoanterior,"+totalPersona.getSaldoanterior()+",Cantidadmovimiento,"+totalPersona.getCantidadmovimiento()+",Total,"+totalPersona.getTotal()+",fecha,"+totalPersona.getFecha()); + } + } + + /** + * Obtiene la dirección principal de la persona + * @param personcode + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public TcustPersonAddress obtenerDireccionPrincipal(Integer personcode) throws Exception { + TcustPersonAddress tcustPersonAddress = null; + Query query = PersistenceHelper.getEntityManager().createQuery(JPQL_DIRECCION_PRINCIPAL); + query.setParameter("personcode", personcode); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + query.setParameter("principal", Constant.STR_Y); + List ltcustPersonAddresses = query.getResultList(); + if(ltcustPersonAddresses != null && !ltcustPersonAddresses.isEmpty()){ + tcustPersonAddress = ltcustPersonAddresses.iterator().next(); + } + return tcustPersonAddress; + } + + /** + * Metodo que devuelve el codigo de un arma + * @return + * @throws Exception + */ + private String getCodigoArmas() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CARMA").toString(); + return codigoArma; + } + + /** + * Metodo que devuelve el codigo de un totalpersona + * @return + * @throws Exception + */ + private String getCodigoTotalPersona() throws Exception { + Sequence sequence = new Sequence(); + String cTotalPersona = sequence.getNextValue("TARMTOTALPERSONA").toString(); + return cTotalPersona; + } + + /** + * Metodo que devuelve el codigo de una carga + * @return + * @throws Exception + */ + private String getCodigoCarga() throws Exception { + Sequence sequence = new Sequence(); + String cCarga = sequence.getNextValue("CARGA").toString(); + return cCarga; + } + + /** + * Metodo que devuelve el codigo de una carga detalle + * @return + * @throws Exception + */ + private String getCodigoCargaDetalle() throws Exception { + Sequence sequence = new Sequence(); + String cCarga = sequence.getNextValue("CARGADETALLE").toString(); + return cCarga; + } + + +} \ No newline at end of file diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/.svn/text-base/IngresoInventario.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/.svn/text-base/IngresoInventario.java.svn-base new file mode 100644 index 0000000..9c3c69b --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/.svn/text-base/IngresoInventario.java.svn-base @@ -0,0 +1,299 @@ +package com.fp.armas.rules.save.solicitudimportacion; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.parmas.param.TarmComercianteCupo; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Ingresa un registro y actualiza la tabla de cupos + * @author Andres Cevallos + * + */ +public class IngresoInventario extends TransactionRule { + + + private static final long serialVersionUID = 1L; + private static final String JPQL_TIPOARMAEXPLOSIVO = "from TarmTipoArmaExplosivo tae" + " where tae.pk = :pk"; + private static final String JPQL_COMERCIANTECUPO = "from TarmComercianteCupo tcc" + " where tcc.personcodigo = :personcodigo and tcc.clase = :clasecodigo and tcc.tipoarmaexplosivo=:tipoarmaexplosivo and tcc.tiporegistro=:tiporegistro"; + private static final String JPQL_CATALOG = "from TgeneCatalogDetail tgd"+" where tgd.pk.catalog= :catalog and tgd.pk.catalogcode= :catalogcode"; + + + /* (non-Javadoc) + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + @SuppressWarnings("unchecked") + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + try { + System.out.println("INGRESA DE INVENTARIO"); + //EntityManager em=PersistenceHelper.getEntityManager(); + List listaArmas=(ArrayList)pSaveRequest.get("LISTAARMAS"); + List listaTotales=(ArrayList)pSaveRequest.get("LISTATOTALES"); + TarmRegistroArmas registro=(TarmRegistroArmas)pSaveRequest.get("REGISTRO"); + registro.setTiporegistro("CARINV"); + List registroarmasL=(List) pSaveRequest.getSaveBeanModifiedRecords("TREGISTROARMAS"); + List tarmArmasL=(List) pSaveRequest.getSaveBeanModifiedRecords("ARMAS"); + List tarmTotalPersonaL=(List) pSaveRequest.getSaveBeanModifiedRecords("TOTALCONTROLLER"); + if(registroarmasL==null){ + registroarmasL= new ArrayList<>(); + } + if(tarmArmasL==null){ + tarmArmasL= new ArrayList<>(); + } + if(tarmTotalPersonaL==null){ + tarmTotalPersonaL= new ArrayList<>(); + } + + //Persistiendo el registro + String cregistro = null; + Sequence sequence = new Sequence(); + Integer valorRegistro=Integer.valueOf(sequence.getNextValue("CREGISTRO").toString()); + if(valorRegistro!=null){ + cregistro=valorRegistro.toString(); + registro.setPk(Long.parseLong(cregistro)); + registroarmasL.add(registro); + //em.persist(registro); + } + + //Persistiendo la lista de armas + for (TarmArmas arma : listaArmas) { + arma.setCregistro(Long.parseLong(cregistro)); + if(arma.isnew){ + String carma = null; + sequence = new Sequence(); + String valor=sequence.getNextValue("CARMA").toString(); + if(valor!=null){ + carma=valor.toString(); + arma.setPk(carma); + arma.setCodigoarma(arma.getPk()); + //arma.setUnidadmedidacantidad("Unidad"); + tarmArmasL.add(arma); + //em.persist(arma); + } + }else{ + TarmArmas armaBD=new TarmArmas(); + armaBD=PersistenceHelper.getEntityManager().find(TarmArmas.class, arma.getPk()); + armaBD.setCantidad(arma.getCantidad()); + armaBD.setCantoncode(arma.getCantoncode()); + armaBD.setCitycode(arma.getCitycode()); + armaBD.setCodigoarma(arma.getCodigoarma()); + armaBD.setColor(arma.getColor()); + armaBD.setColorcodigo(arma.getColorcodigo()); + armaBD.setCountrycode(arma.getCountrycode()); + armaBD.setCpaisorigen(arma.getCpaisorigen()); + armaBD.setCregistro(arma.getCregistro()); + armaBD.setCtipoarmaexplosivo(arma.getCtipoarmaexplosivo()); + armaBD.setDireccion(arma.getDireccion()); + armaBD.setEstado(arma.getEstado()); + armaBD.setEstadocodigo(arma.getEstadocodigo()); + armaBD.setFecharegistro(arma.getFecharegistro()); + armaBD.setFemisionpermiso(arma.getFemisionpermiso()); + armaBD.setLote(arma.getLote()); + armaBD.setMarca(arma.getMarca()); + armaBD.setMarcacodigo(arma.getMarcacodigo()); + armaBD.setModelo(arma.getModelo()); + armaBD.setNemonicoarma(arma.getNemonicoarma()); + armaBD.setParroquiacode(arma.getParroquiacode()); + armaBD.setPeso(arma.getPeso()); + armaBD.setPesoAux(arma.getPesoAux()); + armaBD.setPk(arma.getPk()); + armaBD.setProvincecode(arma.getProvincecode()); + armaBD.setRecordversion(arma.getRecordversion()); + armaBD.setSeriecanon(arma.getSeriecanon()); + armaBD.setTipofabricacion(arma.getTipofabricacion()); + armaBD.setUnidadmedidacantidad(arma.getUnidadmedidacantidad()); + armaBD.setUnidadmedidacantidadcodigo(arma.getUnidadmedidacantidadcodigo()); + armaBD.setValorAux(arma.getValorAux()); + armaBD.setCodigoarma(arma.getPk()); + //em.persist(armaBD); + tarmArmasL.add(arma); + } + } + + //Persistiendo la lista de totales + for (TarmTotalPersona total : listaTotales) { + if(total.isnew){ + String ctotal = null; + sequence = new Sequence(); + Integer valor=Integer.valueOf(sequence.getNextValue("CTOTAL").toString()); + if(valor!=null){ + ctotal=valor.toString(); + total.setPk(ctotal); + //total.setUnidadmedidapeso("Unidad"); + System.out.println(total); + tarmTotalPersonaL.add(total); +// em.persist(total); +// em.flush(); + } + }else{ + TarmTotalPersona totalBD=new TarmTotalPersona(); + totalBD=PersistenceHelper.getEntityManager().find(TarmTotalPersona.class, total.getPk()); + totalBD.setClase(total.getClase()); + totalBD.setClasecodigo(total.getClasecodigo()); + totalBD.setCarma(total.getCarma()); + totalBD.setFecha(total.getFecha()); + totalBD.setPersoncodigo(total.getPersoncodigo()); + totalBD.setPk(total.getPk()); + totalBD.setRecordversion(total.getRecordversion()); + totalBD.setSaldoanterior(total.getSaldoanterior()); + totalBD.setTipoarmaexplosivo(total.getTipoarmaexplosivo()); + totalBD.setTipoarmaexplosivocodigo(total.getTipoarmaexplosivocodigo()); + totalBD.setTotal(total.getTotal()); + totalBD.setUnidadmedidapeso(total.getUnidadmedidapeso()); + totalBD.setUnidadmedidapesocodigo(total.getUnidadmedidapesocodigo()); + tarmTotalPersonaL.add(total); + //em.persist(totalBD); + } + } + // em.flush(); + } catch (Exception e) { + return pSaveRequest; + // TODO: handle exception + } + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + + return arg0; + } + + + /** + * Actualiza la tabla de totales + * @param tipoarmaexplosivo + * @param valor + * @param personcode + * @return + */ + public TarmTotalPersona cargarDatos(TarmTipoArmaExplosivo tipoarmaexplosivo,BigDecimal valor,Integer personcode) + { + TarmTotalPersona totalArma = new TarmTotalPersona(); + totalArma.setClase(tipoarmaexplosivo.getClase()); + totalArma.setClasecodigo(tipoarmaexplosivo.getClasecodigo()); + totalArma.setFecha(new Timestamp(new Date().getTime())); + totalArma.setTipoarmaexplosivo(tipoarmaexplosivo.getTipoarmaexplosivo()); + totalArma.setTipoarmaexplosivocodigo(tipoarmaexplosivo.getTipoarmaexplosivocodigo()); + totalArma.setPersoncodigo(personcode); + totalArma.setSaldoanterior(BigDecimal.ZERO); + totalArma.setTotal(valor); + totalArma.setUnidadmedidapeso(tipoarmaexplosivo.getUnidadmedidapeso()); + totalArma.setUnidadmedidapesocodigo(tipoarmaexplosivo.getUnidadmedidapesocodigo()); + return totalArma; + + } + + /** + * Actualiza la tabla de totales cuando existen datos anteriores + * @param tipoarmaexplosivo + * @param valor + * @param personcode + * @param saldo + * @return + */ + public TarmTotalPersona cargarDatosAnterior(TarmTipoArmaExplosivo tipoarmaexplosivo,BigDecimal valor,Integer personcode,BigDecimal saldo) + { + BigDecimal total = new BigDecimal(0); + total = total.add(valor); + total = total.add(saldo); + TarmTotalPersona totalArma = new TarmTotalPersona(); + totalArma.setClase(tipoarmaexplosivo.getClase()); + totalArma.setClasecodigo(tipoarmaexplosivo.getClasecodigo()); + totalArma.setFecha(new Timestamp(new Date().getTime())); + totalArma.setTipoarmaexplosivo(tipoarmaexplosivo.getTipoarmaexplosivo()); + totalArma.setTipoarmaexplosivocodigo(tipoarmaexplosivo.getTipoarmaexplosivocodigo()); + totalArma.setPersoncodigo(personcode); + totalArma.setSaldoanterior(saldo); + totalArma.setTotal(total); + totalArma.setUnidadmedidapeso(tipoarmaexplosivo.getUnidadmedidapeso()); + totalArma.setUnidadmedidapesocodigo(tipoarmaexplosivo.getUnidadmedidapesocodigo()); + return totalArma; + } + + /** + * Encuentra el cupo por cliente + * @param pEntityManager + * @param personcodigo + * @param clasecodigo + * @param tipoarmaexplosivo + * @param tiporegistro + * @return + * @throws Exception + */ + public static List findCupo(EntityManager pEntityManager, Integer personcodigo, String clasecodigo, String tipoarmaexplosivo, String tiporegistro) throws Exception { + + Query qry = pEntityManager.createQuery(IngresoInventario.JPQL_COMERCIANTECUPO); + qry.setParameter("personcodigo", personcodigo); + qry.setParameter("clasecodigo", clasecodigo); + qry.setParameter("tipoarmaexplosivo", tipoarmaexplosivo); + qry.setParameter("tiporegistro", tiporegistro); + return qry.getResultList(); + } + + /** + * Encuentra una lista de tipo de armas y explosivos + * @param pEntityManager + * @param pk + * @return + * @throws Exception + */ + public static List findByClase(EntityManager pEntityManager, String pk) throws Exception { + Query qry = pEntityManager.createQuery(IngresoInventario.JPQL_TIPOARMAEXPLOSIVO); + qry.setParameter("pk", pk); + return qry.getResultList(); + } + + public static List find(EntityManager pEntityManager, String catalog, String catalogcode) throws Exception { + Query qry = pEntityManager.createQuery(IngresoInventario.JPQL_CATALOG); + + qry.setParameter("catalog", catalog); + qry.setParameter("catalogcode", catalogcode); + return qry.getResultList(); + } + /** + * Mtodo que devuelve la secuencia de un cliente. + * + * @return Codigo del nuevo cliente. + * @throws Exception + */ + private Long getCodigoSolicitud() throws Exception { + Sequence sequence = new Sequence(); + Long codigo = sequence.getNextValue("CREGISTRO").longValue(); + + return codigo; + + } + + + /** + * Mtodo que devuelve el codigo de un arma + * @return + * @throws Exception + */ + private String getCodigoArmas() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CARMA").toString(); + + return codigoArma; + + } + + +} \ No newline at end of file diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/.svn/text-base/Inventarios.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/.svn/text-base/Inventarios.java.svn-base new file mode 100644 index 0000000..a311df5 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/.svn/text-base/Inventarios.java.svn-base @@ -0,0 +1,326 @@ +package com.fp.armas.rules.save.solicitudimportacion; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.fun.TarmCargaDetalle; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Realiza el mantenimiento de totales y maestro detalle del ingreso + * @author fpazmino + * + */ +public class Inventarios extends TransactionRule { + + + private static final long serialVersionUID = 1L; + private static final String JPQL_TIPOARMAEXPLOSIVO = "from TarmTipoArmaExplosivo tae" + " where tae.pk = :pk"; + private static final String JPQL_DIRECCION_PRINCIPAL="from TcustPersonAddress o WHERE o.pk.personcode=:personcode AND o.pk.dateto=:dateto AND o.principal=:principal"; + private static final String JPQL_ULTIMO_TOTAL_PERSONA = "from TarmTotalPersona o where o.personcodigo=:personcode AND o.clase=:clase AND o.tipoarmaexplosivo=:tipoarmaexplosivo AND o.unidadmedidapeso=:unidadmedidapeso AND o.fecha = (Select max(tp.fecha) from TarmTotalPersona tp where tp.personcodigo=:personcode AND tp.clase=:clase AND tp.tipoarmaexplosivo=:tipoarmaexplosivo AND tp.unidadmedidapeso=:unidadmedidapeso)"; + + /* (non-Javadoc) + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + @SuppressWarnings("unchecked") + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + try { + System.out.println("INGRESA A INGRESO DE INVENTARIOS"); + List listaArmas=(ArrayList)pSaveRequest.get("LISTAARMAS"); + List listaArmasEliminadas=(ArrayList)pSaveRequest.get("LISTAARMASELIMINADAS"); + String tipoRegistro = pSaveRequest.get("TIPOREGISTRO").toString(); + TarmRegistroArmas registroArmas=(TarmRegistroArmas)pSaveRequest.get("REGISTRO"); + String personCode=pSaveRequest.get("PERSONCODE").toString(); +// Boolean esNuevaImportacion=(Boolean) pSaveRequest.get("ESNUEVAIMPORTACION"); + EntityManager pEntityManager=PersistenceHelper.getEntityManager(); + if(registroArmas.isnew){ + generarRegistroArmas(pEntityManager,registroArmas,tipoRegistro); + } + System.out.println("tipoRegistro" + tipoRegistro); + System.out.println("cantidad armas" + listaArmas.size()); + System.out.println("registroArmas" + registroArmas.getPk()); + // Registramos la carga + TarmCarga carga = (TarmCarga)pSaveRequest.get("TARMCARGA"); + if(carga.isnew){ + carga.setTipocarga("INV"); + carga.setAucp(registroArmas.getSolicitudnum()); + carga.setEsdesaduanizado("N"); + carga.setFecha(new Timestamp(new Date().getTime())); + carga.setPersoncode(Integer.valueOf(personCode)); + carga.setCregistro(registroArmas.getPk()); + carga.setPk(getCodigoCarga()); + pEntityManager.persist(carga); + pEntityManager.flush(); + } + TcustPersonAddress direccionPrincipal = obtenerDireccionPrincipal(Integer.valueOf(personCode)); + // Fecha de registro comun a todas las armas ingresadas + java.sql.Date fechaRegistro = new java.sql.Date(new Date().getTime()); + for(TarmArmas armasObj : listaArmas){ + TarmTipoArmaExplosivo tipoArmaExplosivoObj = findTipoArmaExpByCTipoArmaExp(pEntityManager, armasObj.getCtipoarmaexplosivo()); + if(armasObj.isnew){ + armasObj = generarArma(pEntityManager,registroArmas, armasObj, direccionPrincipal, tipoRegistro, armasObj.getCantidad(), fechaRegistro); + } + else{ + pEntityManager.merge(armasObj); + } + // Afectacion en la tabla de totales en el caso de registro de produccion + if(tipoRegistro.equals("PRO")){ +// new BigDecimal(getCantidad()):armasObj.getPeso()) + BigDecimal cantidadPeso = BigDecimal.ZERO; + TgeneCatalogDetailKey unidadPK= new TgeneCatalogDetailKey(); + unidadPK.setCatalog(tipoArmaExplosivoObj.getUnidadmedidapeso()); + unidadPK.setCatalogcode(tipoArmaExplosivoObj.getUnidadmedidapesocodigo()); + TgeneCatalogDetail unidadesCatalog = TgeneCatalogDetail.find(pEntityManager, unidadPK); + if(unidadesCatalog!=null && unidadesCatalog.getLegalcode().equals("CANTIDAD")){ + cantidadPeso = new BigDecimal(armasObj.getCantidad()); + }else{ + cantidadPeso = armasObj.getPeso(); + } + actualizarTotalPersona(pEntityManager, tipoArmaExplosivoObj, personCode, cantidadPeso); + } + // Registramos el detalle de la carga + if(armasObj.isnew){ + TarmCargaDetalle cargaDetalle = new TarmCargaDetalle(); + cargaDetalle.setPk(getCodigoCargaDetalle()); + cargaDetalle.setCarma(armasObj.getPk()); + cargaDetalle.setCcarga(carga.getPk()); + pEntityManager.persist(cargaDetalle); + } + + } + + for(TarmArmas armasObj : listaArmasEliminadas){ + // Borra registro de la tabla TarmCargaDetalle + Query q = pEntityManager.createQuery("delete from TarmCargaDetalle where ccarga= :ccarga and carma= :carma"); + q.setParameter("ccarga", carga.getPk()); + q.setParameter("carma", armasObj.getPk()); + q.executeUpdate(); + // Borra registro de la tabla TarmCargaDetalle + TarmArmas armaAEliminarse = TarmArmas.find(pEntityManager, armasObj.getPk()); + pEntityManager.remove(armaAEliminarse); + } + } catch (Exception e) { + return pSaveRequest; + // TODO: handle exception + } + return pSaveRequest; + } + + public void generarRegistroArmas(EntityManager pEntityManager, TarmRegistroArmas registroArmas, String tipoRegistro){ + try { + Sequence sequence = new Sequence(); + String cRegistro = sequence.getNextValue("CREGISTRO").toString(); + registroArmas.setPk(Long.parseLong(cRegistro)); + registroArmas.setTiporegistro("CARINV"); + pEntityManager.persist(registroArmas); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public TarmArmas generarArma(EntityManager pEntityManager, TarmRegistroArmas registroArmas, TarmArmas armaParam, TcustPersonAddress direccionPrincipal, String tipoRegistro, Integer cantidad, java.sql.Date fechaRegistro){ + try { + TarmArmas arma = (TarmArmas) armaParam.cloneMe(); + // Setear el estado del arma + if(tipoRegistro.equals("IMP")){ + arma.setEstado("IMPO"); + }else if(tipoRegistro.equals("PRO")){ + arma.setEstado("REG"); + } + arma.setCregistro(registroArmas.getPk()); + arma.setCantidad(cantidad); + String carma = getCodigoArmas(); + arma.setPk(carma); + arma.setCodigoarma(carma); + + // Poner datos de la Ubicacion del arma + if(direccionPrincipal!=null){ + arma.setCountrycode(direccionPrincipal.getCountrycode()); + arma.setProvincecode(direccionPrincipal.getProvincecode()); + arma.setCantoncode(direccionPrincipal.getCantoncode()); + arma.setParroquiacode(direccionPrincipal.getParroquiacode()); + arma.setCitycode(direccionPrincipal.getCitycode()); + arma.setDireccion(direccionPrincipal.getAddress()); + } + arma.setColorcodigo("COLOR"); + arma.setUnidadmedidacantidadcodigo("UNIDADMEDIDA"); + arma.setFecharegistro(fechaRegistro); + arma.setCpaisorigen(registroArmas.getPaisorigen()); + pEntityManager.persist(arma); + return arma; + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return null; + } + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + + return arg0; + } + + /** + * Encuentra una lista de tipo de armas y explosivos + * @param pEntityManager + * @param pk + * @return + * @throws Exception + */ + public static TarmTipoArmaExplosivo findTipoArmaExpByCTipoArmaExp(EntityManager pEntityManager, String pk) throws Exception { + Query qry = pEntityManager.createQuery(Inventarios.JPQL_TIPOARMAEXPLOSIVO); + qry.setParameter("pk", pk); + ListresultList = qry.getResultList(); + if(resultList!=null && resultList.size()>0){ + return (TarmTipoArmaExplosivo) qry.getResultList().get(0); + }else{ + return null; + } + } + + /** + * Actualizar tabla TarmTotalPersona + * @param pEntityManager + * @param EntityManager pEntityManager, TarmTipoArmaExplosivo tipoArmaExplosivo, String personcode, BigDecimal cantidadPeso + * @return void + * @throws Exception + */ + public void actualizarTotalPersona(EntityManager pEntityManager, TarmTipoArmaExplosivo tipoArmaExplosivo, String personcode, BigDecimal cantidadPeso) throws Exception { + Query qry = pEntityManager.createQuery(Inventarios.JPQL_ULTIMO_TOTAL_PERSONA); + qry.setParameter("personcode", Integer.valueOf(personcode)); + qry.setParameter("clase", tipoArmaExplosivo.getClase()); + qry.setParameter("tipoarmaexplosivo", tipoArmaExplosivo.getTipoarmaexplosivo()); + qry.setParameter("unidadmedidapeso", tipoArmaExplosivo.getUnidadmedidapeso()); + ListresultList = qry.getResultList(); + String cTotalPersona = getCodigoTotalPersona(); + if(resultList!=null && resultList.size()>0){ + TarmTotalPersona totalPersonaAnterior = resultList.get(0); + // Actualiza la tabla de totales cuando existen datos anteriores + TarmTotalPersona totalPersona = new TarmTotalPersona(); + totalPersona.setClase(tipoArmaExplosivo.getClase()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(tipoArmaExplosivo.getTipoarmaexplosivo()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setUnidadmedidapeso(tipoArmaExplosivo.getUnidadmedidapeso()); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setPersoncodigo(Integer.valueOf(personcode)); + totalPersona.setSaldoanterior(totalPersonaAnterior.getTotal()); + totalPersona.setCantidadmovimiento(cantidadPeso); + totalPersona.setTotal(totalPersonaAnterior.getTotal().add(cantidadPeso)); + totalPersona.setFecha(new Timestamp(new Date().getTime())); + totalPersona.setIngresoegreso("ING"); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + totalPersona.setPk(cTotalPersona); + pEntityManager.detach(totalPersona); + pEntityManager.persist(totalPersona); + System.out.println("Saldoanterior,"+totalPersona.getSaldoanterior()+",Cantidadmovimiento,"+totalPersona.getCantidadmovimiento()+",Total,"+totalPersona.getTotal()+",fecha,"+totalPersona.getFecha()); + }else{ + // Actualiza la tabla de totales cuando NO existen datos anteriores + TarmTotalPersona totalPersona = new TarmTotalPersona(); + totalPersona.setClase(tipoArmaExplosivo.getClase()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(tipoArmaExplosivo.getTipoarmaexplosivo()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setUnidadmedidapeso(tipoArmaExplosivo.getUnidadmedidapeso()); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setPersoncodigo(Integer.valueOf(personcode)); + totalPersona.setSaldoanterior(BigDecimal.ZERO); + totalPersona.setCantidadmovimiento(cantidadPeso); + totalPersona.setTotal(cantidadPeso); + totalPersona.setFecha(new Timestamp(new Date().getTime())); + totalPersona.setIngresoegreso("ING"); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + totalPersona.setPk(cTotalPersona); + pEntityManager.persist(totalPersona); + System.out.println("Saldoanterior,"+totalPersona.getSaldoanterior()+",Cantidadmovimiento,"+totalPersona.getCantidadmovimiento()+",Total,"+totalPersona.getTotal()+",fecha,"+totalPersona.getFecha()); + } + } + + /** + * Obtiene la dirección principal de la persona + * @param personcode + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public TcustPersonAddress obtenerDireccionPrincipal(Integer personcode) throws Exception { + TcustPersonAddress tcustPersonAddress = null; + Query query = PersistenceHelper.getEntityManager().createQuery(JPQL_DIRECCION_PRINCIPAL); + query.setParameter("personcode", personcode); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + query.setParameter("principal", Constant.STR_Y); + List ltcustPersonAddresses = query.getResultList(); + if(ltcustPersonAddresses != null && !ltcustPersonAddresses.isEmpty()){ + tcustPersonAddress = ltcustPersonAddresses.iterator().next(); + } + return tcustPersonAddress; + } + + /** + * Metodo que devuelve el codigo de un arma + * @return + * @throws Exception + */ + private String getCodigoArmas() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CARMA").toString(); + return codigoArma; + } + + /** + * Metodo que devuelve el codigo de un totalpersona + * @return + * @throws Exception + */ + private String getCodigoTotalPersona() throws Exception { + Sequence sequence = new Sequence(); + String cTotalPersona = sequence.getNextValue("TARMTOTALPERSONA").toString(); + return cTotalPersona; + } + + /** + * Metodo que devuelve el codigo de una carga + * @return + * @throws Exception + */ + private String getCodigoCarga() throws Exception { + Sequence sequence = new Sequence(); + String cCarga = sequence.getNextValue("CARGA").toString(); + return cCarga; + } + + /** + * Metodo que devuelve el codigo de una carga detalle + * @return + * @throws Exception + */ + private String getCodigoCargaDetalle() throws Exception { + Sequence sequence = new Sequence(); + String cCarga = sequence.getNextValue("CARGADETALLE").toString(); + return cCarga; + } + + +} \ No newline at end of file diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/.svn/text-base/PreviaImportacionDesgloce.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/.svn/text-base/PreviaImportacionDesgloce.java.svn-base new file mode 100644 index 0000000..8bd4c6c --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/.svn/text-base/PreviaImportacionDesgloce.java.svn-base @@ -0,0 +1,359 @@ +package com.fp.armas.rules.save.solicitudimportacion; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Date; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.fun.TarmCargaDetalle; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudArmasKey; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Realiza el mantenimiento de totales y maestro detalle del ingreso + * @author fpazmino + * + */ +public class PreviaImportacionDesgloce extends TransactionRule { + + + private static final long serialVersionUID = 1L; + private static final String JPQL_TIPOARMAEXPLOSIVO = "from TarmTipoArmaExplosivo tae" + " where tae.pk = :pk"; + private static final String JPQL_DIRECCION_PRINCIPAL="from TcustPersonAddress o WHERE o.pk.personcode=:personcode AND o.pk.dateto=:dateto AND o.principal=:principal"; + private static final String JPQL_ULTIMO_TOTAL_PERSONA = "from TarmTotalPersona o where o.personcodigo=:personcode AND o.clase=:clase AND o.tipoarmaexplosivo=:tipoarmaexplosivo AND o.unidadmedidapeso=:unidadmedidapeso AND o.fecha = (Select max(tp.fecha) from TarmTotalPersona tp where tp.personcodigo=:personcode AND tp.clase=:clase AND tp.tipoarmaexplosivo=:tipoarmaexplosivo AND tp.unidadmedidapeso=:unidadmedidapeso)"; + private static final String JPQL_ARMAS_CARGA_IMPORTACION = "from TarmArmas arm WHERE arm.pk in (Select cd.carma from TarmCargaDetalle cd where cd.ccarga = (Select c.pk from TarmCarga c where c.aucp=:aucp))"; + private static final String JPQL_CARGA = "from TarmCarga c WHERE c.aucp=:aucp"; + + /** + * Completa desgloce de las armas de fuego y armas no letales. Afecta totales. + */ + @Override + @SuppressWarnings("unchecked") + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + try { + System.out.println("INGRESA A DESGLOCE DESADUANIZACION"); + Boolean requiereDesgloce = (Boolean) pSaveRequest.get("REQUIEREDESGLOCE"); + if(requiereDesgloce){ + EntityManager pEntityManager=PersistenceHelper.getEntityManager(); + TarmSolicitud solicitud = (TarmSolicitud) pSaveRequest.get("SOLICITUD"); + String aucp = solicitud.getAucp(); + List listaArmas=consultarArmasPorAucp(pEntityManager, aucp); + String personcode = solicitud.getPersoncode().toString(); + // Actualiza el estado de desaduanizacion + TarmCarga carga = actualizarEstadoCarga(pEntityManager, aucp); + // Desglozar armas + for(TarmArmas armasObj : listaArmas){ + TarmTipoArmaExplosivo tipoArmaExplosivoObj = findTipoArmaExpByCTipoArmaExp(pEntityManager, armasObj.getCtipoarmaexplosivo()); + Integer cantidadArmas = armasObj.getCantidad(); + // Afectacion en la tabla de totales + actualizarTotalPersona(pEntityManager, tipoArmaExplosivoObj, personcode, new BigDecimal(cantidadArmas)); + // 0010000001 ARMA DE FUEGO, 0010000008 ARMAS NO LETALES + if((tipoArmaExplosivoObj.getClase().equals("0010000001") || tipoArmaExplosivoObj.getClase().equals("0010000008")) && armasObj.getCantidad()>1){ + // Grabamos 1 registro un total de N veces segun determine la cantidad + for(int i=0; i consultarArmasPorAucp(EntityManager pEntityManager, String aucp) throws Exception { + Query qry = pEntityManager.createQuery(PreviaImportacionDesgloce.JPQL_ARMAS_CARGA_IMPORTACION); + qry.setParameter("aucp", aucp); + ListresultList = qry.getResultList(); + if(resultList!=null && resultList.size()>0){ + return (List) qry.getResultList(); + }else{ + return null; + } + } + + /** + * Encuentra una lista de articulos por codigo de importacion (aucp) + * @param pEntityManager + * @param aucp + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static TarmCarga actualizarEstadoCarga(EntityManager pEntityManager, String aucp) throws Exception { + Query qry = pEntityManager.createQuery(PreviaImportacionDesgloce.JPQL_CARGA); + qry.setParameter("aucp", aucp); + ListresultList = qry.getResultList(); + TarmCarga carga = null; + if(resultList!=null && resultList.size()>0){ + carga = resultList.get(0); + carga.setEsdesaduanizado("S"); + pEntityManager.merge(carga); + } + return carga; + } + + + /** + * Encuentra una lista de tipo de armas y explosivos + * @param pEntityManager + * @param pk + * @return + * @throws Exception + */ + public static TarmTipoArmaExplosivo findTipoArmaExpByCTipoArmaExp(EntityManager pEntityManager, String pk) throws Exception { + Query qry = pEntityManager.createQuery(PreviaImportacionDesgloce.JPQL_TIPOARMAEXPLOSIVO); + qry.setParameter("pk", pk); + ListresultList = qry.getResultList(); + if(resultList!=null && resultList.size()>0){ + return (TarmTipoArmaExplosivo) qry.getResultList().get(0); + }else{ + return null; + } + } + + /** + * Actualizar tabla TarmTotalPersona + * @param pEntityManager + * @param EntityManager pEntityManager, TarmTipoArmaExplosivo tipoArmaExplosivo, String personcode, BigDecimal cantidadPeso + * @return void + * @throws Exception + */ + public void actualizarTotalPersona(EntityManager pEntityManager, TarmTipoArmaExplosivo tipoArmaExplosivo, String personcode, BigDecimal cantidadPeso) throws Exception { + Query qry = pEntityManager.createQuery(PreviaImportacionDesgloce.JPQL_ULTIMO_TOTAL_PERSONA); + qry.setParameter("personcode", Integer.valueOf(personcode)); + qry.setParameter("clase", tipoArmaExplosivo.getClase()); + qry.setParameter("tipoarmaexplosivo", tipoArmaExplosivo.getTipoarmaexplosivo()); + qry.setParameter("unidadmedidapeso", tipoArmaExplosivo.getUnidadmedidapeso()); + ListresultList = qry.getResultList(); + String cTotalPersona = getCodigoTotalPersona(); + if(resultList!=null && resultList.size()>0){ + TarmTotalPersona totalPersonaAnterior = resultList.get(0); + // Actualiza la tabla de totales cuando existen datos anteriores + TarmTotalPersona totalPersona = new TarmTotalPersona(); + totalPersona.setClase(tipoArmaExplosivo.getClase()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(tipoArmaExplosivo.getTipoarmaexplosivo()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setUnidadmedidapeso(tipoArmaExplosivo.getUnidadmedidapeso()); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setPersoncodigo(Integer.valueOf(personcode)); + totalPersona.setSaldoanterior(totalPersonaAnterior.getTotal()); + totalPersona.setCantidadmovimiento(cantidadPeso); + totalPersona.setTotal(totalPersonaAnterior.getTotal().add(cantidadPeso)); + totalPersona.setFecha(new Timestamp(new Date().getTime())); + totalPersona.setIngresoegreso("ING"); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + totalPersona.setPk(cTotalPersona); + pEntityManager.detach(totalPersona); + pEntityManager.persist(totalPersona); + System.out.println("Saldoanterior,"+totalPersona.getSaldoanterior()+",Cantidadmovimiento,"+totalPersona.getCantidadmovimiento()+",Total,"+totalPersona.getTotal()+",fecha,"+totalPersona.getFecha()); + }else{ + // Actualiza la tabla de totales cuando NO existen datos anteriores + TarmTotalPersona totalPersona = new TarmTotalPersona(); + totalPersona.setClase(tipoArmaExplosivo.getClase()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(tipoArmaExplosivo.getTipoarmaexplosivo()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setUnidadmedidapeso(tipoArmaExplosivo.getUnidadmedidapeso()); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setPersoncodigo(Integer.valueOf(personcode)); + totalPersona.setSaldoanterior(BigDecimal.ZERO); + totalPersona.setCantidadmovimiento(cantidadPeso); + totalPersona.setTotal(cantidadPeso); + totalPersona.setFecha(new Timestamp(new Date().getTime())); + totalPersona.setIngresoegreso("ING"); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + totalPersona.setPk(cTotalPersona); + pEntityManager.persist(totalPersona); + System.out.println("Saldoanterior,"+totalPersona.getSaldoanterior()+",Cantidadmovimiento,"+totalPersona.getCantidadmovimiento()+",Total,"+totalPersona.getTotal()+",fecha,"+totalPersona.getFecha()); + } + } + + /** + * Obtiene la dirección principal de la persona + * @param personcode + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public TcustPersonAddress obtenerDireccionPrincipal(Integer personcode) throws Exception { + TcustPersonAddress tcustPersonAddress = null; + Query query = PersistenceHelper.getEntityManager().createQuery(JPQL_DIRECCION_PRINCIPAL); + query.setParameter("personcode", personcode); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + query.setParameter("principal", Constant.STR_Y); + List ltcustPersonAddresses = query.getResultList(); + if(ltcustPersonAddresses != null && !ltcustPersonAddresses.isEmpty()){ + tcustPersonAddress = ltcustPersonAddresses.iterator().next(); + } + return tcustPersonAddress; + } + + /** + * Metodo que devuelve el codigo de un arma + * @return + * @throws Exception + */ + private String getCodigoArmas() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CARMA").toString(); + return codigoArma; + } + + /** + * Metodo que devuelve el codigo de un totalpersona + * @return + * @throws Exception + */ + private String getCodigoTotalPersona() throws Exception { + Sequence sequence = new Sequence(); + String cTotalPersona = sequence.getNextValue("TARMTOTALPERSONA").toString(); + return cTotalPersona; + } + + /** + * Metodo que devuelve el codigo de una carga detalle + * @return + * @throws Exception + */ + private String getCodigoCargaDetalle() throws Exception { + Sequence sequence = new Sequence(); + String cCarga = sequence.getNextValue("CARGADETALLE").toString(); + return cCarga; + } + + +} \ No newline at end of file diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/.svn/text-base/SolicitudImportacion.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/.svn/text-base/SolicitudImportacion.java.svn-base new file mode 100644 index 0000000..1b14207 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/.svn/text-base/SolicitudImportacion.java.svn-base @@ -0,0 +1,299 @@ +package com.fp.armas.rules.save.solicitudimportacion; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.parmas.param.TarmComercianteCupo; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Ingresa un registro y actualiza la tabla de cupos + * @author Andres Cevallos + * + */ +public class SolicitudImportacion extends TransactionRule { + + + private static final long serialVersionUID = 1L; + private static final String JPQL_TIPOARMAEXPLOSIVO = "from TarmTipoArmaExplosivo tae" + " where tae.pk = :pk"; + private static final String JPQL_COMERCIANTECUPO = "from TarmComercianteCupo tcc" + " where tcc.personcodigo = :personcodigo and tcc.clase = :clasecodigo and tcc.tipoarmaexplosivo=:tipoarmaexplosivo and tcc.tiporegistro=:tiporegistro"; + private static final String JPQL_CATALOG = "from TgeneCatalogDetail tgd"+" where tgd.pk.catalog= :catalog and tgd.pk.catalogcode= :catalogcode"; + + + /* (non-Javadoc) + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + @SuppressWarnings("unchecked") + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + try { + System.out.println("INGRESA A SOLICITUD IMPORTACION"); + //EntityManager em=PersistenceHelper.getEntityManager(); + List listaArmas=(ArrayList)pSaveRequest.get("LISTAARMAS"); + List listaTotales=(ArrayList)pSaveRequest.get("LISTATOTALES"); + TarmRegistroArmas registro=(TarmRegistroArmas)pSaveRequest.get("REGISTRO"); + + List registroarmasL=(List) pSaveRequest.getSaveBeanModifiedRecords("TREGISTROARMAS"); + List tarmArmasL=(List) pSaveRequest.getSaveBeanModifiedRecords("ARMAS"); + List tarmTotalPersonaL=(List) pSaveRequest.getSaveBeanModifiedRecords("TOTALCONTROLLER"); + if(registroarmasL==null){ + registroarmasL= new ArrayList<>(); + } + if(tarmArmasL==null){ + tarmArmasL= new ArrayList<>(); + } + if(tarmTotalPersonaL==null){ + tarmTotalPersonaL= new ArrayList<>(); + } + + //Persistiendo el registro + String cregistro = null; + Sequence sequence = new Sequence(); + Integer valorRegistro=Integer.valueOf(sequence.getNextValue("CREGISTRO").toString()); + if(valorRegistro!=null){ + cregistro=valorRegistro.toString(); + registro.setPk(Long.parseLong(cregistro)); + registroarmasL.add(registro); + //em.persist(registro); + } + + //Persistiendo la lista de armas + for (TarmArmas arma : listaArmas) { + arma.setCregistro(Long.parseLong(cregistro)); + if(arma.isnew){ + String carma = null; + sequence = new Sequence(); + String valor=sequence.getNextValue("CARMA").toString(); + if(valor!=null){ + carma=valor.toString(); + arma.setPk(carma); + arma.setCodigoarma(arma.getPk()); + //arma.setUnidadmedidacantidad("Unidad"); + tarmArmasL.add(arma); + //em.persist(arma); + } + }else{ + TarmArmas armaBD=new TarmArmas(); + armaBD=PersistenceHelper.getEntityManager().find(TarmArmas.class, arma.getPk()); + armaBD.setCantidad(arma.getCantidad()); + armaBD.setCantoncode(arma.getCantoncode()); + armaBD.setCitycode(arma.getCitycode()); + armaBD.setCodigoarma(arma.getCodigoarma()); + armaBD.setColor(arma.getColor()); + armaBD.setColorcodigo(arma.getColorcodigo()); + armaBD.setCountrycode(arma.getCountrycode()); + armaBD.setCpaisorigen(arma.getCpaisorigen()); + armaBD.setCregistro(arma.getCregistro()); + armaBD.setCtipoarmaexplosivo(arma.getCtipoarmaexplosivo()); + armaBD.setDireccion(arma.getDireccion()); + armaBD.setEstado(arma.getEstado()); + armaBD.setEstadocodigo(arma.getEstadocodigo()); + armaBD.setFecharegistro(arma.getFecharegistro()); + armaBD.setFemisionpermiso(arma.getFemisionpermiso()); + armaBD.setLote(arma.getLote()); + armaBD.setMarca(arma.getMarca()); + armaBD.setMarcacodigo(arma.getMarcacodigo()); + armaBD.setModelo(arma.getModelo()); + armaBD.setNemonicoarma(arma.getNemonicoarma()); + armaBD.setParroquiacode(arma.getParroquiacode()); + armaBD.setPeso(arma.getPeso()); + armaBD.setPesoAux(arma.getPesoAux()); + armaBD.setPk(arma.getPk()); + armaBD.setProvincecode(arma.getProvincecode()); + armaBD.setRecordversion(arma.getRecordversion()); + armaBD.setSeriecanon(arma.getSeriecanon()); + armaBD.setTipofabricacion(arma.getTipofabricacion()); + armaBD.setUnidadmedidacantidad(arma.getUnidadmedidacantidad()); + armaBD.setUnidadmedidacantidadcodigo(arma.getUnidadmedidacantidadcodigo()); + armaBD.setValorAux(arma.getValorAux()); + armaBD.setCodigoarma(arma.getPk()); + //em.persist(armaBD); + tarmArmasL.add(arma); + } + } + + //Persistiendo la lista de totales + for (TarmTotalPersona total : listaTotales) { + if(total.isnew){ + String ctotal = null; + sequence = new Sequence(); + Integer valor=Integer.valueOf(sequence.getNextValue("CTOTAL").toString()); + if(valor!=null){ + ctotal=valor.toString(); + total.setPk(ctotal); + //total.setUnidadmedidapeso("Unidad"); + System.out.println(total); + tarmTotalPersonaL.add(total); +// em.persist(total); +// em.flush(); + } + }else{ + TarmTotalPersona totalBD=new TarmTotalPersona(); + totalBD=PersistenceHelper.getEntityManager().find(TarmTotalPersona.class, total.getPk()); + totalBD.setClase(total.getClase()); + totalBD.setClasecodigo(total.getClasecodigo()); + totalBD.setCarma(total.getCarma()); + totalBD.setFecha(total.getFecha()); + totalBD.setPersoncodigo(total.getPersoncodigo()); + totalBD.setPk(total.getPk()); + totalBD.setRecordversion(total.getRecordversion()); + totalBD.setSaldoanterior(total.getSaldoanterior()); + totalBD.setTipoarmaexplosivo(total.getTipoarmaexplosivo()); + totalBD.setTipoarmaexplosivocodigo(total.getTipoarmaexplosivocodigo()); + totalBD.setTotal(total.getTotal()); + totalBD.setUnidadmedidapeso(total.getUnidadmedidapeso()); + totalBD.setUnidadmedidapesocodigo(total.getUnidadmedidapesocodigo()); + tarmTotalPersonaL.add(total); + //em.persist(totalBD); + } + } + // em.flush(); + } catch (Exception e) { + return pSaveRequest; + // TODO: handle exception + } + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + + return arg0; + } + + + /** + * Actualiza la tabla de totales + * @param tipoarmaexplosivo + * @param valor + * @param personcode + * @return + */ + public TarmTotalPersona cargarDatos(TarmTipoArmaExplosivo tipoarmaexplosivo,BigDecimal valor,Integer personcode) + { + TarmTotalPersona totalArma = new TarmTotalPersona(); + totalArma.setClase(tipoarmaexplosivo.getClase()); + totalArma.setClasecodigo(tipoarmaexplosivo.getClasecodigo()); + totalArma.setFecha(new Timestamp(new Date().getTime())); + totalArma.setTipoarmaexplosivo(tipoarmaexplosivo.getTipoarmaexplosivo()); + totalArma.setTipoarmaexplosivocodigo(tipoarmaexplosivo.getTipoarmaexplosivocodigo()); + totalArma.setPersoncodigo(personcode); + totalArma.setSaldoanterior(BigDecimal.ZERO); + totalArma.setTotal(valor); + totalArma.setUnidadmedidapeso(tipoarmaexplosivo.getUnidadmedidapeso()); + totalArma.setUnidadmedidapesocodigo(tipoarmaexplosivo.getUnidadmedidapesocodigo()); + return totalArma; + + } + + /** + * Actualiza la tabla de totales cuando existen datos anteriores + * @param tipoarmaexplosivo + * @param valor + * @param personcode + * @param saldo + * @return + */ + public TarmTotalPersona cargarDatosAnterior(TarmTipoArmaExplosivo tipoarmaexplosivo,BigDecimal valor,Integer personcode,BigDecimal saldo) + { + BigDecimal total = new BigDecimal(0); + total = total.add(valor); + total = total.add(saldo); + TarmTotalPersona totalArma = new TarmTotalPersona(); + totalArma.setClase(tipoarmaexplosivo.getClase()); + totalArma.setClasecodigo(tipoarmaexplosivo.getClasecodigo()); + totalArma.setFecha(new Timestamp(new Date().getTime())); + totalArma.setTipoarmaexplosivo(tipoarmaexplosivo.getTipoarmaexplosivo()); + totalArma.setTipoarmaexplosivocodigo(tipoarmaexplosivo.getTipoarmaexplosivocodigo()); + totalArma.setPersoncodigo(personcode); + totalArma.setSaldoanterior(saldo); + totalArma.setTotal(total); + totalArma.setUnidadmedidapeso(tipoarmaexplosivo.getUnidadmedidapeso()); + totalArma.setUnidadmedidapesocodigo(tipoarmaexplosivo.getUnidadmedidapesocodigo()); + return totalArma; + } + + /** + * Encuentra el cupo por cliente + * @param pEntityManager + * @param personcodigo + * @param clasecodigo + * @param tipoarmaexplosivo + * @param tiporegistro + * @return + * @throws Exception + */ + public static List findCupo(EntityManager pEntityManager, Integer personcodigo, String clasecodigo, String tipoarmaexplosivo, String tiporegistro) throws Exception { + + Query qry = pEntityManager.createQuery(SolicitudImportacion.JPQL_COMERCIANTECUPO); + qry.setParameter("personcodigo", personcodigo); + qry.setParameter("clasecodigo", clasecodigo); + qry.setParameter("tipoarmaexplosivo", tipoarmaexplosivo); + qry.setParameter("tiporegistro", tiporegistro); + return qry.getResultList(); + } + + /** + * Encuentra una lista de tipo de armas y explosivos + * @param pEntityManager + * @param pk + * @return + * @throws Exception + */ + public static List findByClase(EntityManager pEntityManager, String pk) throws Exception { + Query qry = pEntityManager.createQuery(SolicitudImportacion.JPQL_TIPOARMAEXPLOSIVO); + qry.setParameter("pk", pk); + return qry.getResultList(); + } + + public static List find(EntityManager pEntityManager, String catalog, String catalogcode) throws Exception { + Query qry = pEntityManager.createQuery(SolicitudImportacion.JPQL_CATALOG); + + qry.setParameter("catalog", catalog); + qry.setParameter("catalogcode", catalogcode); + return qry.getResultList(); + } + /** + * Mtodo que devuelve la secuencia de un cliente. + * + * @return Codigo del nuevo cliente. + * @throws Exception + */ + private Long getCodigoSolicitud() throws Exception { + Sequence sequence = new Sequence(); + Long codigo = sequence.getNextValue("CREGISTRO").longValue(); + + return codigo; + + } + + + /** + * Mtodo que devuelve el codigo de un arma + * @return + * @throws Exception + */ + private String getCodigoArmas() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CARMA").toString(); + + return codigoArma; + + } + + +} \ No newline at end of file diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/CompletarDesaduanizacion.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/CompletarDesaduanizacion.java new file mode 100644 index 0000000..fb290aa --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/CompletarDesaduanizacion.java @@ -0,0 +1,130 @@ +package com.fp.armas.rules.save.solicitudimportacion; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.armas.rules.exception.ControlArmasException; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.parmas.param.TarmComercianteCupo; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Ingresa un registro y actualiza la tabla de cupos + * @author Andres Cevallos + * + */ +public class CompletarDesaduanizacion extends TransactionRule { + + + private static final long serialVersionUID = 1L; + private static final String JPQL_ARMASDELTRAMITESINLOTE = "FROM TarmArmas ARM WHERE " + + "ARM.pk IN (select SA.pk.carma from TarmSolicitudArmas SA WHERE SA.pk.csolicitud = :csolicitud) AND ARM.lote IS NULL"; + + private static final String JPQL_TRAMITEACTUAL = "FROM TarmSolicitudTramite t WHERE t.pk.csolicitud = :noSolicitud"; + + private static final String JPQL_LOTEDUPLICADO = "FROM TarmArmas ARM WHERE ARM.pk IN " + + "(select SA.pk.carma from TarmSolicitudArmas SA WHERE SA.pk.csolicitud = :csolicitud) AND ARM.lote = :lote"; + + + /* (non-Javadoc) + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + @SuppressWarnings("unchecked") + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { +// try { + Boolean requiereDesgloce = (Boolean) pSaveRequest.get("REQUIEREDESGLOCE"); + if(!requiereDesgloce){ + System.out.println("*****COMPLETAR LA DESADUANIZACION*****"); + EntityManager em=PersistenceHelper.getEntityManager(); + ListarmasLst=(List)pSaveRequest.getSaveBeanModifiedRecords("DESADUANIZACION"); + String noSolicitud=pSaveRequest.get("noSolicitud").toString(); + TarmSolicitudTramite solicitudTramiteObj = consultaTramiteActual(em, noSolicitud); + Boolean validaDuplicados = Boolean.FALSE; + for(Object armaTmp:armasLst){ + TarmArmas arma=(TarmArmas)armaTmp; + TarmArmas armaDuplicada = consultaLoteDuplicado(em, noSolicitud, arma.getLote()); + if(armaDuplicada!=null){ + throw new ControlArmasException("ARM-0001", "EL LOTE {0} SE ENCUENTRA DUPLICADO.", armaDuplicada.getLote()); + } + } + + for(Object armaTmp:armasLst){ + TarmArmas arma=(TarmArmas)armaTmp; + em.merge(arma); + } + em.flush(); + if(solicitudTramiteObj!=null){ + if(!existeArmasConLotePendienteIngreso(em, solicitudTramiteObj.getPk().getCsolicitud())){ + solicitudTramiteObj.setEstadotramite("FIN"); + em.merge(solicitudTramiteObj); + em.flush(); + } + } + } +// } catch (Exception e) { +// return pSaveRequest; +// // TODO: handle exception +// } + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + + return arg0; + } + + public Boolean existeArmasConLotePendienteIngreso(EntityManager pEntityManager,String csolicitud){ + Boolean resultado = Boolean.FALSE; + Query qry = pEntityManager.createQuery(CompletarDesaduanizacion.JPQL_ARMASDELTRAMITESINLOTE); + qry.setParameter("csolicitud", csolicitud); + ListarmasPendientesLst = qry.getResultList(); + + if(armasPendientesLst!=null && !armasPendientesLst.isEmpty()){ + resultado = Boolean.TRUE; + } + return resultado; + } + public TarmSolicitudTramite consultaTramiteActual(EntityManager pEntityManager,String noSolicitud){ + Query qry = pEntityManager.createQuery(CompletarDesaduanizacion.JPQL_TRAMITEACTUAL); + qry.setParameter("noSolicitud", noSolicitud); + ListsolicitudTramiteLst = qry.getResultList(); + + if(solicitudTramiteLst!=null && !solicitudTramiteLst.isEmpty()){ + return solicitudTramiteLst.get(0); + } + else{ + return null; + } + } + + public TarmArmas consultaLoteDuplicado(EntityManager pEntityManager,String csolicitud, String lote){ + Query qry = pEntityManager.createQuery(CompletarDesaduanizacion.JPQL_LOTEDUPLICADO); + qry.setParameter("csolicitud", csolicitud); + qry.setParameter("lote", lote); + ListarmasConLoteDuplicadoLst = qry.getResultList(); + + if(armasConLoteDuplicadoLst!=null && !armasConLoteDuplicadoLst.isEmpty()){ + return armasConLoteDuplicadoLst.get(0); + } + else{ + return null; + } + } +} \ No newline at end of file diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/ImportacionProduccion.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/ImportacionProduccion.java new file mode 100644 index 0000000..dbf63a0 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/ImportacionProduccion.java @@ -0,0 +1,337 @@ +package com.fp.armas.rules.save.solicitudimportacion; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.fun.TarmCargaDetalle; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Realiza el mantenimiento de totales y maestro detalle del ingreso + * @author fpazmino + * + */ +public class ImportacionProduccion extends TransactionRule { + + + private static final long serialVersionUID = 1L; + private static final String JPQL_TIPOARMAEXPLOSIVO = "from TarmTipoArmaExplosivo tae" + " where tae.pk = :pk"; + private static final String JPQL_DIRECCION_PRINCIPAL="from TcustPersonAddress o WHERE o.pk.personcode=:personcode AND o.pk.dateto=:dateto AND o.principal=:principal"; + private static final String JPQL_ULTIMO_TOTAL_PERSONA = "from TarmTotalPersona o where o.personcodigo=:personcode AND o.clase=:clase AND o.tipoarmaexplosivo=:tipoarmaexplosivo AND o.unidadmedidapeso=:unidadmedidapeso AND o.fecha = (Select max(tp.fecha) from TarmTotalPersona tp where tp.personcodigo=:personcode AND tp.clase=:clase AND tp.tipoarmaexplosivo=:tipoarmaexplosivo AND tp.unidadmedidapeso=:unidadmedidapeso)"; + + + /* (non-Javadoc) + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + @SuppressWarnings("unchecked") + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + try { + System.out.println("INGRESA A INGRESO DE REGISTRO DE PRODUCCION O IMPORTACION"); + List listaArmas=(ArrayList)pSaveRequest.get("LISTAARMAS"); + List listaArmasEliminadas=(ArrayList)pSaveRequest.get("LISTAARMASELIMINADAS"); + String tipoRegistro = pSaveRequest.get("TIPOREGISTRO").toString(); + TarmRegistroArmas registroArmas=(TarmRegistroArmas)pSaveRequest.get("REGISTRO"); + String personCode=pSaveRequest.get("PERSONCODE").toString(); + Boolean esNuevaImportacion=(Boolean) pSaveRequest.get("ESNUEVAIMPORTACION"); + EntityManager pEntityManager=PersistenceHelper.getEntityManager(); + if(registroArmas.isnew){ + generarRegistroArmas(pEntityManager,registroArmas,tipoRegistro); + } + System.out.println("tipoRegistro" + tipoRegistro); + System.out.println("cantidad armas" + listaArmas.size()); + System.out.println("registroArmas" + registroArmas.getPk()); + // Registramos la carga + TarmCarga carga = (TarmCarga)pSaveRequest.get("TARMCARGA"); +// if(tipoRegistro.equals("PRO") || (tipoRegistro.equals("IMP") && esNuevaImportacion)){ + if(carga.isnew){ + if(tipoRegistro.equals("PRO")){ + carga.setTipocarga("PRO"); + }else if(tipoRegistro.equals("IMP")){ + carga.setTipocarga("IMP"); + } + carga.setAucp(registroArmas.getSolicitudnum()); + carga.setEsdesaduanizado("N"); + carga.setFecha(new Timestamp(new Date().getTime())); + carga.setPersoncode(Integer.valueOf(personCode)); + carga.setCregistro(registroArmas.getPk()); + carga.setPk(getCodigoCarga()); + pEntityManager.persist(carga); + pEntityManager.flush(); + } +// else{ +// carga=(TarmCarga)pSaveRequest.get("TARMCARGA"); +// } + TcustPersonAddress direccionPrincipal = obtenerDireccionPrincipal(Integer.valueOf(personCode)); + // Fecha de registro comun a todas las armas ingresadas + java.sql.Date fechaRegistro = new java.sql.Date(new Date().getTime()); + for(TarmArmas armasObj : listaArmas){ + TarmTipoArmaExplosivo tipoArmaExplosivoObj = findTipoArmaExpByCTipoArmaExp(pEntityManager, armasObj.getCtipoarmaexplosivo()); + if(armasObj.isnew){ + armasObj = generarArma(pEntityManager,registroArmas, armasObj, direccionPrincipal, tipoRegistro, armasObj.getCantidad(), fechaRegistro); + } + else{ + pEntityManager.merge(armasObj); + } + System.out.println("1.tipoRegistro:"+tipoRegistro); + System.out.println("2. armasObj.isnew:"+armasObj.isnew); + // Afectacion en la tabla de totales en el caso de registro de produccion + if(tipoRegistro.equals("PRO")|| armasObj.isnew){ + System.out.println("3.actualizarTotalPersona"); +// new BigDecimal(getCantidad()):armasObj.getPeso()) + BigDecimal cantidadPeso = BigDecimal.ZERO; + TgeneCatalogDetailKey pkUnidades = new TgeneCatalogDetailKey(); + pkUnidades.setCatalog(tipoArmaExplosivoObj.getUnidadmedidapeso()); + pkUnidades.setCatalogcode(tipoArmaExplosivoObj.getUnidadmedidapesocodigo()); + TgeneCatalogDetail unidadesCatalog = TgeneCatalogDetail.find(pEntityManager, pkUnidades); + if(unidadesCatalog!=null && unidadesCatalog.getLegalcode().equals("CANTIDAD")){ + cantidadPeso = new BigDecimal(armasObj.getCantidad()); + }else{ + cantidadPeso = armasObj.getPeso(); + } + actualizarTotalPersona(pEntityManager, tipoArmaExplosivoObj, personCode, cantidadPeso); + } + // Registramos el detalle de la carga + if(armasObj.isnew){ + TarmCargaDetalle cargaDetalle = new TarmCargaDetalle(); + cargaDetalle.setPk(getCodigoCargaDetalle()); + cargaDetalle.setCarma(armasObj.getPk()); + cargaDetalle.setCcarga(carga.getPk()); + pEntityManager.persist(cargaDetalle); + } + + } + + for(TarmArmas armasObj : listaArmasEliminadas){ + // Borra registro de la tabla TarmCargaDetalle + Query q = pEntityManager.createQuery("delete from TarmCargaDetalle where ccarga= :ccarga and carma= :carma"); + q.setParameter("ccarga", carga.getPk()); + q.setParameter("carma", armasObj.getPk()); + q.executeUpdate(); + // Borra registro de la tabla TarmCargaDetalle + TarmArmas armaAEliminarse = TarmArmas.find(pEntityManager, armasObj.getPk()); + pEntityManager.remove(armaAEliminarse); + } + } catch (Exception e) { + return pSaveRequest; + // TODO: handle exception + } + return pSaveRequest; + } + + public void generarRegistroArmas(EntityManager pEntityManager, TarmRegistroArmas registroArmas, String tipoRegistro){ + try { + Sequence sequence = new Sequence(); + String cRegistro = sequence.getNextValue("CREGISTRO").toString(); + registroArmas.setPk(Long.parseLong(cRegistro)); + pEntityManager.persist(registroArmas); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public TarmArmas generarArma(EntityManager pEntityManager, TarmRegistroArmas registroArmas, TarmArmas armaParam, TcustPersonAddress direccionPrincipal, String tipoRegistro, Integer cantidad, java.sql.Date fechaRegistro){ + try { + TarmArmas arma = (TarmArmas) armaParam.cloneMe(); + // Setear el estado del arma + if(tipoRegistro.equals("IMP")){ + arma.setEstado("IMPO"); + }else if(tipoRegistro.equals("PRO")){ + arma.setEstado("REG"); + } + arma.setCregistro(registroArmas.getPk()); + arma.setCantidad(cantidad); + String carma = getCodigoArmas(); + arma.setPk(carma); + arma.setCodigoarma(carma); + + // Poner datos de la Ubicacion del arma + if(direccionPrincipal!=null){ + arma.setCountrycode(direccionPrincipal.getCountrycode()); + arma.setProvincecode(direccionPrincipal.getProvincecode()); + arma.setCantoncode(direccionPrincipal.getCantoncode()); + arma.setParroquiacode(direccionPrincipal.getParroquiacode()); + arma.setCitycode(direccionPrincipal.getCitycode()); + arma.setDireccion(direccionPrincipal.getAddress()); + } + arma.setColorcodigo("COLOR"); + arma.setUnidadmedidacantidadcodigo("UNIDADMEDIDA"); + arma.setFecharegistro(fechaRegistro); + arma.setCpaisorigen(registroArmas.getPaisorigen()); + pEntityManager.persist(arma); + return arma; + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return null; + } + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + + return arg0; + } + + /** + * Encuentra una lista de tipo de armas y explosivos + * @param pEntityManager + * @param pk + * @return + * @throws Exception + */ + public static TarmTipoArmaExplosivo findTipoArmaExpByCTipoArmaExp(EntityManager pEntityManager, String pk) throws Exception { + Query qry = pEntityManager.createQuery(ImportacionProduccion.JPQL_TIPOARMAEXPLOSIVO); + qry.setParameter("pk", pk); + ListresultList = qry.getResultList(); + if(resultList!=null && resultList.size()>0){ + return (TarmTipoArmaExplosivo) qry.getResultList().get(0); + }else{ + return null; + } + } + + /** + * Actualizar tabla TarmTotalPersona + * @param pEntityManager + * @param EntityManager pEntityManager, TarmTipoArmaExplosivo tipoArmaExplosivo, String personcode, BigDecimal cantidadPeso + * @return void + * @throws Exception + */ + public void actualizarTotalPersona(EntityManager pEntityManager, TarmTipoArmaExplosivo tipoArmaExplosivo, String personcode, BigDecimal cantidadPeso) throws Exception { + Query qry = pEntityManager.createQuery(ImportacionProduccion.JPQL_ULTIMO_TOTAL_PERSONA); + qry.setParameter("personcode", Integer.valueOf(personcode)); + qry.setParameter("clase", tipoArmaExplosivo.getClase()); + qry.setParameter("tipoarmaexplosivo", tipoArmaExplosivo.getTipoarmaexplosivo()); + qry.setParameter("unidadmedidapeso", tipoArmaExplosivo.getUnidadmedidapeso()); + ListresultList = qry.getResultList(); + String cTotalPersona = getCodigoTotalPersona(); + if(resultList!=null && resultList.size()>0){ + TarmTotalPersona totalPersonaAnterior = resultList.get(0); + // Actualiza la tabla de totales cuando existen datos anteriores + TarmTotalPersona totalPersona = new TarmTotalPersona(); + totalPersona.setClase(tipoArmaExplosivo.getClase()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(tipoArmaExplosivo.getTipoarmaexplosivo()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setUnidadmedidapeso(tipoArmaExplosivo.getUnidadmedidapeso()); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setPersoncodigo(Integer.valueOf(personcode)); + totalPersona.setSaldoanterior(totalPersonaAnterior.getTotal()); + totalPersona.setCantidadmovimiento(cantidadPeso); + totalPersona.setTotal(totalPersonaAnterior.getTotal().add(cantidadPeso)); + totalPersona.setFecha(new Timestamp(new Date().getTime())); + totalPersona.setIngresoegreso("ING"); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + totalPersona.setPk(cTotalPersona); + pEntityManager.detach(totalPersona); + pEntityManager.persist(totalPersona); + System.out.println("Saldoanterior,"+totalPersona.getSaldoanterior()+",Cantidadmovimiento,"+totalPersona.getCantidadmovimiento()+",Total,"+totalPersona.getTotal()+",fecha,"+totalPersona.getFecha()); + }else{ + // Actualiza la tabla de totales cuando NO existen datos anteriores + TarmTotalPersona totalPersona = new TarmTotalPersona(); + totalPersona.setClase(tipoArmaExplosivo.getClase()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(tipoArmaExplosivo.getTipoarmaexplosivo()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setUnidadmedidapeso(tipoArmaExplosivo.getUnidadmedidapeso()); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setPersoncodigo(Integer.valueOf(personcode)); + totalPersona.setSaldoanterior(BigDecimal.ZERO); + totalPersona.setCantidadmovimiento(cantidadPeso); + totalPersona.setTotal(cantidadPeso); + totalPersona.setFecha(new Timestamp(new Date().getTime())); + totalPersona.setIngresoegreso("ING"); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + totalPersona.setPk(cTotalPersona); + pEntityManager.persist(totalPersona); + System.out.println("Saldoanterior,"+totalPersona.getSaldoanterior()+",Cantidadmovimiento,"+totalPersona.getCantidadmovimiento()+",Total,"+totalPersona.getTotal()+",fecha,"+totalPersona.getFecha()); + } + } + + /** + * Obtiene la dirección principal de la persona + * @param personcode + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public TcustPersonAddress obtenerDireccionPrincipal(Integer personcode) throws Exception { + TcustPersonAddress tcustPersonAddress = null; + Query query = PersistenceHelper.getEntityManager().createQuery(JPQL_DIRECCION_PRINCIPAL); + query.setParameter("personcode", personcode); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + query.setParameter("principal", Constant.STR_Y); + List ltcustPersonAddresses = query.getResultList(); + if(ltcustPersonAddresses != null && !ltcustPersonAddresses.isEmpty()){ + tcustPersonAddress = ltcustPersonAddresses.iterator().next(); + } + return tcustPersonAddress; + } + + /** + * Metodo que devuelve el codigo de un arma + * @return + * @throws Exception + */ + private String getCodigoArmas() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CARMA").toString(); + return codigoArma; + } + + /** + * Metodo que devuelve el codigo de un totalpersona + * @return + * @throws Exception + */ + private String getCodigoTotalPersona() throws Exception { + Sequence sequence = new Sequence(); + String cTotalPersona = sequence.getNextValue("TARMTOTALPERSONA").toString(); + return cTotalPersona; + } + + /** + * Metodo que devuelve el codigo de una carga + * @return + * @throws Exception + */ + private String getCodigoCarga() throws Exception { + Sequence sequence = new Sequence(); + String cCarga = sequence.getNextValue("CARGA").toString(); + return cCarga; + } + + /** + * Metodo que devuelve el codigo de una carga detalle + * @return + * @throws Exception + */ + private String getCodigoCargaDetalle() throws Exception { + Sequence sequence = new Sequence(); + String cCarga = sequence.getNextValue("CARGADETALLE").toString(); + return cCarga; + } + + +} \ No newline at end of file diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/IngresoInventario.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/IngresoInventario.java new file mode 100644 index 0000000..9c3c69b --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/IngresoInventario.java @@ -0,0 +1,299 @@ +package com.fp.armas.rules.save.solicitudimportacion; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.parmas.param.TarmComercianteCupo; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Ingresa un registro y actualiza la tabla de cupos + * @author Andres Cevallos + * + */ +public class IngresoInventario extends TransactionRule { + + + private static final long serialVersionUID = 1L; + private static final String JPQL_TIPOARMAEXPLOSIVO = "from TarmTipoArmaExplosivo tae" + " where tae.pk = :pk"; + private static final String JPQL_COMERCIANTECUPO = "from TarmComercianteCupo tcc" + " where tcc.personcodigo = :personcodigo and tcc.clase = :clasecodigo and tcc.tipoarmaexplosivo=:tipoarmaexplosivo and tcc.tiporegistro=:tiporegistro"; + private static final String JPQL_CATALOG = "from TgeneCatalogDetail tgd"+" where tgd.pk.catalog= :catalog and tgd.pk.catalogcode= :catalogcode"; + + + /* (non-Javadoc) + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + @SuppressWarnings("unchecked") + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + try { + System.out.println("INGRESA DE INVENTARIO"); + //EntityManager em=PersistenceHelper.getEntityManager(); + List listaArmas=(ArrayList)pSaveRequest.get("LISTAARMAS"); + List listaTotales=(ArrayList)pSaveRequest.get("LISTATOTALES"); + TarmRegistroArmas registro=(TarmRegistroArmas)pSaveRequest.get("REGISTRO"); + registro.setTiporegistro("CARINV"); + List registroarmasL=(List) pSaveRequest.getSaveBeanModifiedRecords("TREGISTROARMAS"); + List tarmArmasL=(List) pSaveRequest.getSaveBeanModifiedRecords("ARMAS"); + List tarmTotalPersonaL=(List) pSaveRequest.getSaveBeanModifiedRecords("TOTALCONTROLLER"); + if(registroarmasL==null){ + registroarmasL= new ArrayList<>(); + } + if(tarmArmasL==null){ + tarmArmasL= new ArrayList<>(); + } + if(tarmTotalPersonaL==null){ + tarmTotalPersonaL= new ArrayList<>(); + } + + //Persistiendo el registro + String cregistro = null; + Sequence sequence = new Sequence(); + Integer valorRegistro=Integer.valueOf(sequence.getNextValue("CREGISTRO").toString()); + if(valorRegistro!=null){ + cregistro=valorRegistro.toString(); + registro.setPk(Long.parseLong(cregistro)); + registroarmasL.add(registro); + //em.persist(registro); + } + + //Persistiendo la lista de armas + for (TarmArmas arma : listaArmas) { + arma.setCregistro(Long.parseLong(cregistro)); + if(arma.isnew){ + String carma = null; + sequence = new Sequence(); + String valor=sequence.getNextValue("CARMA").toString(); + if(valor!=null){ + carma=valor.toString(); + arma.setPk(carma); + arma.setCodigoarma(arma.getPk()); + //arma.setUnidadmedidacantidad("Unidad"); + tarmArmasL.add(arma); + //em.persist(arma); + } + }else{ + TarmArmas armaBD=new TarmArmas(); + armaBD=PersistenceHelper.getEntityManager().find(TarmArmas.class, arma.getPk()); + armaBD.setCantidad(arma.getCantidad()); + armaBD.setCantoncode(arma.getCantoncode()); + armaBD.setCitycode(arma.getCitycode()); + armaBD.setCodigoarma(arma.getCodigoarma()); + armaBD.setColor(arma.getColor()); + armaBD.setColorcodigo(arma.getColorcodigo()); + armaBD.setCountrycode(arma.getCountrycode()); + armaBD.setCpaisorigen(arma.getCpaisorigen()); + armaBD.setCregistro(arma.getCregistro()); + armaBD.setCtipoarmaexplosivo(arma.getCtipoarmaexplosivo()); + armaBD.setDireccion(arma.getDireccion()); + armaBD.setEstado(arma.getEstado()); + armaBD.setEstadocodigo(arma.getEstadocodigo()); + armaBD.setFecharegistro(arma.getFecharegistro()); + armaBD.setFemisionpermiso(arma.getFemisionpermiso()); + armaBD.setLote(arma.getLote()); + armaBD.setMarca(arma.getMarca()); + armaBD.setMarcacodigo(arma.getMarcacodigo()); + armaBD.setModelo(arma.getModelo()); + armaBD.setNemonicoarma(arma.getNemonicoarma()); + armaBD.setParroquiacode(arma.getParroquiacode()); + armaBD.setPeso(arma.getPeso()); + armaBD.setPesoAux(arma.getPesoAux()); + armaBD.setPk(arma.getPk()); + armaBD.setProvincecode(arma.getProvincecode()); + armaBD.setRecordversion(arma.getRecordversion()); + armaBD.setSeriecanon(arma.getSeriecanon()); + armaBD.setTipofabricacion(arma.getTipofabricacion()); + armaBD.setUnidadmedidacantidad(arma.getUnidadmedidacantidad()); + armaBD.setUnidadmedidacantidadcodigo(arma.getUnidadmedidacantidadcodigo()); + armaBD.setValorAux(arma.getValorAux()); + armaBD.setCodigoarma(arma.getPk()); + //em.persist(armaBD); + tarmArmasL.add(arma); + } + } + + //Persistiendo la lista de totales + for (TarmTotalPersona total : listaTotales) { + if(total.isnew){ + String ctotal = null; + sequence = new Sequence(); + Integer valor=Integer.valueOf(sequence.getNextValue("CTOTAL").toString()); + if(valor!=null){ + ctotal=valor.toString(); + total.setPk(ctotal); + //total.setUnidadmedidapeso("Unidad"); + System.out.println(total); + tarmTotalPersonaL.add(total); +// em.persist(total); +// em.flush(); + } + }else{ + TarmTotalPersona totalBD=new TarmTotalPersona(); + totalBD=PersistenceHelper.getEntityManager().find(TarmTotalPersona.class, total.getPk()); + totalBD.setClase(total.getClase()); + totalBD.setClasecodigo(total.getClasecodigo()); + totalBD.setCarma(total.getCarma()); + totalBD.setFecha(total.getFecha()); + totalBD.setPersoncodigo(total.getPersoncodigo()); + totalBD.setPk(total.getPk()); + totalBD.setRecordversion(total.getRecordversion()); + totalBD.setSaldoanterior(total.getSaldoanterior()); + totalBD.setTipoarmaexplosivo(total.getTipoarmaexplosivo()); + totalBD.setTipoarmaexplosivocodigo(total.getTipoarmaexplosivocodigo()); + totalBD.setTotal(total.getTotal()); + totalBD.setUnidadmedidapeso(total.getUnidadmedidapeso()); + totalBD.setUnidadmedidapesocodigo(total.getUnidadmedidapesocodigo()); + tarmTotalPersonaL.add(total); + //em.persist(totalBD); + } + } + // em.flush(); + } catch (Exception e) { + return pSaveRequest; + // TODO: handle exception + } + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + + return arg0; + } + + + /** + * Actualiza la tabla de totales + * @param tipoarmaexplosivo + * @param valor + * @param personcode + * @return + */ + public TarmTotalPersona cargarDatos(TarmTipoArmaExplosivo tipoarmaexplosivo,BigDecimal valor,Integer personcode) + { + TarmTotalPersona totalArma = new TarmTotalPersona(); + totalArma.setClase(tipoarmaexplosivo.getClase()); + totalArma.setClasecodigo(tipoarmaexplosivo.getClasecodigo()); + totalArma.setFecha(new Timestamp(new Date().getTime())); + totalArma.setTipoarmaexplosivo(tipoarmaexplosivo.getTipoarmaexplosivo()); + totalArma.setTipoarmaexplosivocodigo(tipoarmaexplosivo.getTipoarmaexplosivocodigo()); + totalArma.setPersoncodigo(personcode); + totalArma.setSaldoanterior(BigDecimal.ZERO); + totalArma.setTotal(valor); + totalArma.setUnidadmedidapeso(tipoarmaexplosivo.getUnidadmedidapeso()); + totalArma.setUnidadmedidapesocodigo(tipoarmaexplosivo.getUnidadmedidapesocodigo()); + return totalArma; + + } + + /** + * Actualiza la tabla de totales cuando existen datos anteriores + * @param tipoarmaexplosivo + * @param valor + * @param personcode + * @param saldo + * @return + */ + public TarmTotalPersona cargarDatosAnterior(TarmTipoArmaExplosivo tipoarmaexplosivo,BigDecimal valor,Integer personcode,BigDecimal saldo) + { + BigDecimal total = new BigDecimal(0); + total = total.add(valor); + total = total.add(saldo); + TarmTotalPersona totalArma = new TarmTotalPersona(); + totalArma.setClase(tipoarmaexplosivo.getClase()); + totalArma.setClasecodigo(tipoarmaexplosivo.getClasecodigo()); + totalArma.setFecha(new Timestamp(new Date().getTime())); + totalArma.setTipoarmaexplosivo(tipoarmaexplosivo.getTipoarmaexplosivo()); + totalArma.setTipoarmaexplosivocodigo(tipoarmaexplosivo.getTipoarmaexplosivocodigo()); + totalArma.setPersoncodigo(personcode); + totalArma.setSaldoanterior(saldo); + totalArma.setTotal(total); + totalArma.setUnidadmedidapeso(tipoarmaexplosivo.getUnidadmedidapeso()); + totalArma.setUnidadmedidapesocodigo(tipoarmaexplosivo.getUnidadmedidapesocodigo()); + return totalArma; + } + + /** + * Encuentra el cupo por cliente + * @param pEntityManager + * @param personcodigo + * @param clasecodigo + * @param tipoarmaexplosivo + * @param tiporegistro + * @return + * @throws Exception + */ + public static List findCupo(EntityManager pEntityManager, Integer personcodigo, String clasecodigo, String tipoarmaexplosivo, String tiporegistro) throws Exception { + + Query qry = pEntityManager.createQuery(IngresoInventario.JPQL_COMERCIANTECUPO); + qry.setParameter("personcodigo", personcodigo); + qry.setParameter("clasecodigo", clasecodigo); + qry.setParameter("tipoarmaexplosivo", tipoarmaexplosivo); + qry.setParameter("tiporegistro", tiporegistro); + return qry.getResultList(); + } + + /** + * Encuentra una lista de tipo de armas y explosivos + * @param pEntityManager + * @param pk + * @return + * @throws Exception + */ + public static List findByClase(EntityManager pEntityManager, String pk) throws Exception { + Query qry = pEntityManager.createQuery(IngresoInventario.JPQL_TIPOARMAEXPLOSIVO); + qry.setParameter("pk", pk); + return qry.getResultList(); + } + + public static List find(EntityManager pEntityManager, String catalog, String catalogcode) throws Exception { + Query qry = pEntityManager.createQuery(IngresoInventario.JPQL_CATALOG); + + qry.setParameter("catalog", catalog); + qry.setParameter("catalogcode", catalogcode); + return qry.getResultList(); + } + /** + * Mtodo que devuelve la secuencia de un cliente. + * + * @return Codigo del nuevo cliente. + * @throws Exception + */ + private Long getCodigoSolicitud() throws Exception { + Sequence sequence = new Sequence(); + Long codigo = sequence.getNextValue("CREGISTRO").longValue(); + + return codigo; + + } + + + /** + * Mtodo que devuelve el codigo de un arma + * @return + * @throws Exception + */ + private String getCodigoArmas() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CARMA").toString(); + + return codigoArma; + + } + + +} \ No newline at end of file diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/Inventarios.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/Inventarios.java new file mode 100644 index 0000000..a311df5 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/Inventarios.java @@ -0,0 +1,326 @@ +package com.fp.armas.rules.save.solicitudimportacion; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.fun.TarmCargaDetalle; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Realiza el mantenimiento de totales y maestro detalle del ingreso + * @author fpazmino + * + */ +public class Inventarios extends TransactionRule { + + + private static final long serialVersionUID = 1L; + private static final String JPQL_TIPOARMAEXPLOSIVO = "from TarmTipoArmaExplosivo tae" + " where tae.pk = :pk"; + private static final String JPQL_DIRECCION_PRINCIPAL="from TcustPersonAddress o WHERE o.pk.personcode=:personcode AND o.pk.dateto=:dateto AND o.principal=:principal"; + private static final String JPQL_ULTIMO_TOTAL_PERSONA = "from TarmTotalPersona o where o.personcodigo=:personcode AND o.clase=:clase AND o.tipoarmaexplosivo=:tipoarmaexplosivo AND o.unidadmedidapeso=:unidadmedidapeso AND o.fecha = (Select max(tp.fecha) from TarmTotalPersona tp where tp.personcodigo=:personcode AND tp.clase=:clase AND tp.tipoarmaexplosivo=:tipoarmaexplosivo AND tp.unidadmedidapeso=:unidadmedidapeso)"; + + /* (non-Javadoc) + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + @SuppressWarnings("unchecked") + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + try { + System.out.println("INGRESA A INGRESO DE INVENTARIOS"); + List listaArmas=(ArrayList)pSaveRequest.get("LISTAARMAS"); + List listaArmasEliminadas=(ArrayList)pSaveRequest.get("LISTAARMASELIMINADAS"); + String tipoRegistro = pSaveRequest.get("TIPOREGISTRO").toString(); + TarmRegistroArmas registroArmas=(TarmRegistroArmas)pSaveRequest.get("REGISTRO"); + String personCode=pSaveRequest.get("PERSONCODE").toString(); +// Boolean esNuevaImportacion=(Boolean) pSaveRequest.get("ESNUEVAIMPORTACION"); + EntityManager pEntityManager=PersistenceHelper.getEntityManager(); + if(registroArmas.isnew){ + generarRegistroArmas(pEntityManager,registroArmas,tipoRegistro); + } + System.out.println("tipoRegistro" + tipoRegistro); + System.out.println("cantidad armas" + listaArmas.size()); + System.out.println("registroArmas" + registroArmas.getPk()); + // Registramos la carga + TarmCarga carga = (TarmCarga)pSaveRequest.get("TARMCARGA"); + if(carga.isnew){ + carga.setTipocarga("INV"); + carga.setAucp(registroArmas.getSolicitudnum()); + carga.setEsdesaduanizado("N"); + carga.setFecha(new Timestamp(new Date().getTime())); + carga.setPersoncode(Integer.valueOf(personCode)); + carga.setCregistro(registroArmas.getPk()); + carga.setPk(getCodigoCarga()); + pEntityManager.persist(carga); + pEntityManager.flush(); + } + TcustPersonAddress direccionPrincipal = obtenerDireccionPrincipal(Integer.valueOf(personCode)); + // Fecha de registro comun a todas las armas ingresadas + java.sql.Date fechaRegistro = new java.sql.Date(new Date().getTime()); + for(TarmArmas armasObj : listaArmas){ + TarmTipoArmaExplosivo tipoArmaExplosivoObj = findTipoArmaExpByCTipoArmaExp(pEntityManager, armasObj.getCtipoarmaexplosivo()); + if(armasObj.isnew){ + armasObj = generarArma(pEntityManager,registroArmas, armasObj, direccionPrincipal, tipoRegistro, armasObj.getCantidad(), fechaRegistro); + } + else{ + pEntityManager.merge(armasObj); + } + // Afectacion en la tabla de totales en el caso de registro de produccion + if(tipoRegistro.equals("PRO")){ +// new BigDecimal(getCantidad()):armasObj.getPeso()) + BigDecimal cantidadPeso = BigDecimal.ZERO; + TgeneCatalogDetailKey unidadPK= new TgeneCatalogDetailKey(); + unidadPK.setCatalog(tipoArmaExplosivoObj.getUnidadmedidapeso()); + unidadPK.setCatalogcode(tipoArmaExplosivoObj.getUnidadmedidapesocodigo()); + TgeneCatalogDetail unidadesCatalog = TgeneCatalogDetail.find(pEntityManager, unidadPK); + if(unidadesCatalog!=null && unidadesCatalog.getLegalcode().equals("CANTIDAD")){ + cantidadPeso = new BigDecimal(armasObj.getCantidad()); + }else{ + cantidadPeso = armasObj.getPeso(); + } + actualizarTotalPersona(pEntityManager, tipoArmaExplosivoObj, personCode, cantidadPeso); + } + // Registramos el detalle de la carga + if(armasObj.isnew){ + TarmCargaDetalle cargaDetalle = new TarmCargaDetalle(); + cargaDetalle.setPk(getCodigoCargaDetalle()); + cargaDetalle.setCarma(armasObj.getPk()); + cargaDetalle.setCcarga(carga.getPk()); + pEntityManager.persist(cargaDetalle); + } + + } + + for(TarmArmas armasObj : listaArmasEliminadas){ + // Borra registro de la tabla TarmCargaDetalle + Query q = pEntityManager.createQuery("delete from TarmCargaDetalle where ccarga= :ccarga and carma= :carma"); + q.setParameter("ccarga", carga.getPk()); + q.setParameter("carma", armasObj.getPk()); + q.executeUpdate(); + // Borra registro de la tabla TarmCargaDetalle + TarmArmas armaAEliminarse = TarmArmas.find(pEntityManager, armasObj.getPk()); + pEntityManager.remove(armaAEliminarse); + } + } catch (Exception e) { + return pSaveRequest; + // TODO: handle exception + } + return pSaveRequest; + } + + public void generarRegistroArmas(EntityManager pEntityManager, TarmRegistroArmas registroArmas, String tipoRegistro){ + try { + Sequence sequence = new Sequence(); + String cRegistro = sequence.getNextValue("CREGISTRO").toString(); + registroArmas.setPk(Long.parseLong(cRegistro)); + registroArmas.setTiporegistro("CARINV"); + pEntityManager.persist(registroArmas); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public TarmArmas generarArma(EntityManager pEntityManager, TarmRegistroArmas registroArmas, TarmArmas armaParam, TcustPersonAddress direccionPrincipal, String tipoRegistro, Integer cantidad, java.sql.Date fechaRegistro){ + try { + TarmArmas arma = (TarmArmas) armaParam.cloneMe(); + // Setear el estado del arma + if(tipoRegistro.equals("IMP")){ + arma.setEstado("IMPO"); + }else if(tipoRegistro.equals("PRO")){ + arma.setEstado("REG"); + } + arma.setCregistro(registroArmas.getPk()); + arma.setCantidad(cantidad); + String carma = getCodigoArmas(); + arma.setPk(carma); + arma.setCodigoarma(carma); + + // Poner datos de la Ubicacion del arma + if(direccionPrincipal!=null){ + arma.setCountrycode(direccionPrincipal.getCountrycode()); + arma.setProvincecode(direccionPrincipal.getProvincecode()); + arma.setCantoncode(direccionPrincipal.getCantoncode()); + arma.setParroquiacode(direccionPrincipal.getParroquiacode()); + arma.setCitycode(direccionPrincipal.getCitycode()); + arma.setDireccion(direccionPrincipal.getAddress()); + } + arma.setColorcodigo("COLOR"); + arma.setUnidadmedidacantidadcodigo("UNIDADMEDIDA"); + arma.setFecharegistro(fechaRegistro); + arma.setCpaisorigen(registroArmas.getPaisorigen()); + pEntityManager.persist(arma); + return arma; + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return null; + } + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + + return arg0; + } + + /** + * Encuentra una lista de tipo de armas y explosivos + * @param pEntityManager + * @param pk + * @return + * @throws Exception + */ + public static TarmTipoArmaExplosivo findTipoArmaExpByCTipoArmaExp(EntityManager pEntityManager, String pk) throws Exception { + Query qry = pEntityManager.createQuery(Inventarios.JPQL_TIPOARMAEXPLOSIVO); + qry.setParameter("pk", pk); + ListresultList = qry.getResultList(); + if(resultList!=null && resultList.size()>0){ + return (TarmTipoArmaExplosivo) qry.getResultList().get(0); + }else{ + return null; + } + } + + /** + * Actualizar tabla TarmTotalPersona + * @param pEntityManager + * @param EntityManager pEntityManager, TarmTipoArmaExplosivo tipoArmaExplosivo, String personcode, BigDecimal cantidadPeso + * @return void + * @throws Exception + */ + public void actualizarTotalPersona(EntityManager pEntityManager, TarmTipoArmaExplosivo tipoArmaExplosivo, String personcode, BigDecimal cantidadPeso) throws Exception { + Query qry = pEntityManager.createQuery(Inventarios.JPQL_ULTIMO_TOTAL_PERSONA); + qry.setParameter("personcode", Integer.valueOf(personcode)); + qry.setParameter("clase", tipoArmaExplosivo.getClase()); + qry.setParameter("tipoarmaexplosivo", tipoArmaExplosivo.getTipoarmaexplosivo()); + qry.setParameter("unidadmedidapeso", tipoArmaExplosivo.getUnidadmedidapeso()); + ListresultList = qry.getResultList(); + String cTotalPersona = getCodigoTotalPersona(); + if(resultList!=null && resultList.size()>0){ + TarmTotalPersona totalPersonaAnterior = resultList.get(0); + // Actualiza la tabla de totales cuando existen datos anteriores + TarmTotalPersona totalPersona = new TarmTotalPersona(); + totalPersona.setClase(tipoArmaExplosivo.getClase()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(tipoArmaExplosivo.getTipoarmaexplosivo()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setUnidadmedidapeso(tipoArmaExplosivo.getUnidadmedidapeso()); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setPersoncodigo(Integer.valueOf(personcode)); + totalPersona.setSaldoanterior(totalPersonaAnterior.getTotal()); + totalPersona.setCantidadmovimiento(cantidadPeso); + totalPersona.setTotal(totalPersonaAnterior.getTotal().add(cantidadPeso)); + totalPersona.setFecha(new Timestamp(new Date().getTime())); + totalPersona.setIngresoegreso("ING"); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + totalPersona.setPk(cTotalPersona); + pEntityManager.detach(totalPersona); + pEntityManager.persist(totalPersona); + System.out.println("Saldoanterior,"+totalPersona.getSaldoanterior()+",Cantidadmovimiento,"+totalPersona.getCantidadmovimiento()+",Total,"+totalPersona.getTotal()+",fecha,"+totalPersona.getFecha()); + }else{ + // Actualiza la tabla de totales cuando NO existen datos anteriores + TarmTotalPersona totalPersona = new TarmTotalPersona(); + totalPersona.setClase(tipoArmaExplosivo.getClase()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(tipoArmaExplosivo.getTipoarmaexplosivo()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setUnidadmedidapeso(tipoArmaExplosivo.getUnidadmedidapeso()); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setPersoncodigo(Integer.valueOf(personcode)); + totalPersona.setSaldoanterior(BigDecimal.ZERO); + totalPersona.setCantidadmovimiento(cantidadPeso); + totalPersona.setTotal(cantidadPeso); + totalPersona.setFecha(new Timestamp(new Date().getTime())); + totalPersona.setIngresoegreso("ING"); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + totalPersona.setPk(cTotalPersona); + pEntityManager.persist(totalPersona); + System.out.println("Saldoanterior,"+totalPersona.getSaldoanterior()+",Cantidadmovimiento,"+totalPersona.getCantidadmovimiento()+",Total,"+totalPersona.getTotal()+",fecha,"+totalPersona.getFecha()); + } + } + + /** + * Obtiene la dirección principal de la persona + * @param personcode + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public TcustPersonAddress obtenerDireccionPrincipal(Integer personcode) throws Exception { + TcustPersonAddress tcustPersonAddress = null; + Query query = PersistenceHelper.getEntityManager().createQuery(JPQL_DIRECCION_PRINCIPAL); + query.setParameter("personcode", personcode); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + query.setParameter("principal", Constant.STR_Y); + List ltcustPersonAddresses = query.getResultList(); + if(ltcustPersonAddresses != null && !ltcustPersonAddresses.isEmpty()){ + tcustPersonAddress = ltcustPersonAddresses.iterator().next(); + } + return tcustPersonAddress; + } + + /** + * Metodo que devuelve el codigo de un arma + * @return + * @throws Exception + */ + private String getCodigoArmas() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CARMA").toString(); + return codigoArma; + } + + /** + * Metodo que devuelve el codigo de un totalpersona + * @return + * @throws Exception + */ + private String getCodigoTotalPersona() throws Exception { + Sequence sequence = new Sequence(); + String cTotalPersona = sequence.getNextValue("TARMTOTALPERSONA").toString(); + return cTotalPersona; + } + + /** + * Metodo que devuelve el codigo de una carga + * @return + * @throws Exception + */ + private String getCodigoCarga() throws Exception { + Sequence sequence = new Sequence(); + String cCarga = sequence.getNextValue("CARGA").toString(); + return cCarga; + } + + /** + * Metodo que devuelve el codigo de una carga detalle + * @return + * @throws Exception + */ + private String getCodigoCargaDetalle() throws Exception { + Sequence sequence = new Sequence(); + String cCarga = sequence.getNextValue("CARGADETALLE").toString(); + return cCarga; + } + + +} \ No newline at end of file diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/PreviaImportacionDesgloce.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/PreviaImportacionDesgloce.java new file mode 100644 index 0000000..8bd4c6c --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/PreviaImportacionDesgloce.java @@ -0,0 +1,359 @@ +package com.fp.armas.rules.save.solicitudimportacion; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Date; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.fun.TarmCargaDetalle; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudArmasKey; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Realiza el mantenimiento de totales y maestro detalle del ingreso + * @author fpazmino + * + */ +public class PreviaImportacionDesgloce extends TransactionRule { + + + private static final long serialVersionUID = 1L; + private static final String JPQL_TIPOARMAEXPLOSIVO = "from TarmTipoArmaExplosivo tae" + " where tae.pk = :pk"; + private static final String JPQL_DIRECCION_PRINCIPAL="from TcustPersonAddress o WHERE o.pk.personcode=:personcode AND o.pk.dateto=:dateto AND o.principal=:principal"; + private static final String JPQL_ULTIMO_TOTAL_PERSONA = "from TarmTotalPersona o where o.personcodigo=:personcode AND o.clase=:clase AND o.tipoarmaexplosivo=:tipoarmaexplosivo AND o.unidadmedidapeso=:unidadmedidapeso AND o.fecha = (Select max(tp.fecha) from TarmTotalPersona tp where tp.personcodigo=:personcode AND tp.clase=:clase AND tp.tipoarmaexplosivo=:tipoarmaexplosivo AND tp.unidadmedidapeso=:unidadmedidapeso)"; + private static final String JPQL_ARMAS_CARGA_IMPORTACION = "from TarmArmas arm WHERE arm.pk in (Select cd.carma from TarmCargaDetalle cd where cd.ccarga = (Select c.pk from TarmCarga c where c.aucp=:aucp))"; + private static final String JPQL_CARGA = "from TarmCarga c WHERE c.aucp=:aucp"; + + /** + * Completa desgloce de las armas de fuego y armas no letales. Afecta totales. + */ + @Override + @SuppressWarnings("unchecked") + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + try { + System.out.println("INGRESA A DESGLOCE DESADUANIZACION"); + Boolean requiereDesgloce = (Boolean) pSaveRequest.get("REQUIEREDESGLOCE"); + if(requiereDesgloce){ + EntityManager pEntityManager=PersistenceHelper.getEntityManager(); + TarmSolicitud solicitud = (TarmSolicitud) pSaveRequest.get("SOLICITUD"); + String aucp = solicitud.getAucp(); + List listaArmas=consultarArmasPorAucp(pEntityManager, aucp); + String personcode = solicitud.getPersoncode().toString(); + // Actualiza el estado de desaduanizacion + TarmCarga carga = actualizarEstadoCarga(pEntityManager, aucp); + // Desglozar armas + for(TarmArmas armasObj : listaArmas){ + TarmTipoArmaExplosivo tipoArmaExplosivoObj = findTipoArmaExpByCTipoArmaExp(pEntityManager, armasObj.getCtipoarmaexplosivo()); + Integer cantidadArmas = armasObj.getCantidad(); + // Afectacion en la tabla de totales + actualizarTotalPersona(pEntityManager, tipoArmaExplosivoObj, personcode, new BigDecimal(cantidadArmas)); + // 0010000001 ARMA DE FUEGO, 0010000008 ARMAS NO LETALES + if((tipoArmaExplosivoObj.getClase().equals("0010000001") || tipoArmaExplosivoObj.getClase().equals("0010000008")) && armasObj.getCantidad()>1){ + // Grabamos 1 registro un total de N veces segun determine la cantidad + for(int i=0; i consultarArmasPorAucp(EntityManager pEntityManager, String aucp) throws Exception { + Query qry = pEntityManager.createQuery(PreviaImportacionDesgloce.JPQL_ARMAS_CARGA_IMPORTACION); + qry.setParameter("aucp", aucp); + ListresultList = qry.getResultList(); + if(resultList!=null && resultList.size()>0){ + return (List) qry.getResultList(); + }else{ + return null; + } + } + + /** + * Encuentra una lista de articulos por codigo de importacion (aucp) + * @param pEntityManager + * @param aucp + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static TarmCarga actualizarEstadoCarga(EntityManager pEntityManager, String aucp) throws Exception { + Query qry = pEntityManager.createQuery(PreviaImportacionDesgloce.JPQL_CARGA); + qry.setParameter("aucp", aucp); + ListresultList = qry.getResultList(); + TarmCarga carga = null; + if(resultList!=null && resultList.size()>0){ + carga = resultList.get(0); + carga.setEsdesaduanizado("S"); + pEntityManager.merge(carga); + } + return carga; + } + + + /** + * Encuentra una lista de tipo de armas y explosivos + * @param pEntityManager + * @param pk + * @return + * @throws Exception + */ + public static TarmTipoArmaExplosivo findTipoArmaExpByCTipoArmaExp(EntityManager pEntityManager, String pk) throws Exception { + Query qry = pEntityManager.createQuery(PreviaImportacionDesgloce.JPQL_TIPOARMAEXPLOSIVO); + qry.setParameter("pk", pk); + ListresultList = qry.getResultList(); + if(resultList!=null && resultList.size()>0){ + return (TarmTipoArmaExplosivo) qry.getResultList().get(0); + }else{ + return null; + } + } + + /** + * Actualizar tabla TarmTotalPersona + * @param pEntityManager + * @param EntityManager pEntityManager, TarmTipoArmaExplosivo tipoArmaExplosivo, String personcode, BigDecimal cantidadPeso + * @return void + * @throws Exception + */ + public void actualizarTotalPersona(EntityManager pEntityManager, TarmTipoArmaExplosivo tipoArmaExplosivo, String personcode, BigDecimal cantidadPeso) throws Exception { + Query qry = pEntityManager.createQuery(PreviaImportacionDesgloce.JPQL_ULTIMO_TOTAL_PERSONA); + qry.setParameter("personcode", Integer.valueOf(personcode)); + qry.setParameter("clase", tipoArmaExplosivo.getClase()); + qry.setParameter("tipoarmaexplosivo", tipoArmaExplosivo.getTipoarmaexplosivo()); + qry.setParameter("unidadmedidapeso", tipoArmaExplosivo.getUnidadmedidapeso()); + ListresultList = qry.getResultList(); + String cTotalPersona = getCodigoTotalPersona(); + if(resultList!=null && resultList.size()>0){ + TarmTotalPersona totalPersonaAnterior = resultList.get(0); + // Actualiza la tabla de totales cuando existen datos anteriores + TarmTotalPersona totalPersona = new TarmTotalPersona(); + totalPersona.setClase(tipoArmaExplosivo.getClase()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(tipoArmaExplosivo.getTipoarmaexplosivo()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setUnidadmedidapeso(tipoArmaExplosivo.getUnidadmedidapeso()); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setPersoncodigo(Integer.valueOf(personcode)); + totalPersona.setSaldoanterior(totalPersonaAnterior.getTotal()); + totalPersona.setCantidadmovimiento(cantidadPeso); + totalPersona.setTotal(totalPersonaAnterior.getTotal().add(cantidadPeso)); + totalPersona.setFecha(new Timestamp(new Date().getTime())); + totalPersona.setIngresoegreso("ING"); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + totalPersona.setPk(cTotalPersona); + pEntityManager.detach(totalPersona); + pEntityManager.persist(totalPersona); + System.out.println("Saldoanterior,"+totalPersona.getSaldoanterior()+",Cantidadmovimiento,"+totalPersona.getCantidadmovimiento()+",Total,"+totalPersona.getTotal()+",fecha,"+totalPersona.getFecha()); + }else{ + // Actualiza la tabla de totales cuando NO existen datos anteriores + TarmTotalPersona totalPersona = new TarmTotalPersona(); + totalPersona.setClase(tipoArmaExplosivo.getClase()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(tipoArmaExplosivo.getTipoarmaexplosivo()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setUnidadmedidapeso(tipoArmaExplosivo.getUnidadmedidapeso()); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setPersoncodigo(Integer.valueOf(personcode)); + totalPersona.setSaldoanterior(BigDecimal.ZERO); + totalPersona.setCantidadmovimiento(cantidadPeso); + totalPersona.setTotal(cantidadPeso); + totalPersona.setFecha(new Timestamp(new Date().getTime())); + totalPersona.setIngresoegreso("ING"); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + totalPersona.setPk(cTotalPersona); + pEntityManager.persist(totalPersona); + System.out.println("Saldoanterior,"+totalPersona.getSaldoanterior()+",Cantidadmovimiento,"+totalPersona.getCantidadmovimiento()+",Total,"+totalPersona.getTotal()+",fecha,"+totalPersona.getFecha()); + } + } + + /** + * Obtiene la dirección principal de la persona + * @param personcode + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public TcustPersonAddress obtenerDireccionPrincipal(Integer personcode) throws Exception { + TcustPersonAddress tcustPersonAddress = null; + Query query = PersistenceHelper.getEntityManager().createQuery(JPQL_DIRECCION_PRINCIPAL); + query.setParameter("personcode", personcode); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + query.setParameter("principal", Constant.STR_Y); + List ltcustPersonAddresses = query.getResultList(); + if(ltcustPersonAddresses != null && !ltcustPersonAddresses.isEmpty()){ + tcustPersonAddress = ltcustPersonAddresses.iterator().next(); + } + return tcustPersonAddress; + } + + /** + * Metodo que devuelve el codigo de un arma + * @return + * @throws Exception + */ + private String getCodigoArmas() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CARMA").toString(); + return codigoArma; + } + + /** + * Metodo que devuelve el codigo de un totalpersona + * @return + * @throws Exception + */ + private String getCodigoTotalPersona() throws Exception { + Sequence sequence = new Sequence(); + String cTotalPersona = sequence.getNextValue("TARMTOTALPERSONA").toString(); + return cTotalPersona; + } + + /** + * Metodo que devuelve el codigo de una carga detalle + * @return + * @throws Exception + */ + private String getCodigoCargaDetalle() throws Exception { + Sequence sequence = new Sequence(); + String cCarga = sequence.getNextValue("CARGADETALLE").toString(); + return cCarga; + } + + +} \ No newline at end of file diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/SolicitudImportacion.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/SolicitudImportacion.java new file mode 100644 index 0000000..1b14207 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/solicitudimportacion/SolicitudImportacion.java @@ -0,0 +1,299 @@ +package com.fp.armas.rules.save.solicitudimportacion; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.parmas.param.TarmComercianteCupo; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Ingresa un registro y actualiza la tabla de cupos + * @author Andres Cevallos + * + */ +public class SolicitudImportacion extends TransactionRule { + + + private static final long serialVersionUID = 1L; + private static final String JPQL_TIPOARMAEXPLOSIVO = "from TarmTipoArmaExplosivo tae" + " where tae.pk = :pk"; + private static final String JPQL_COMERCIANTECUPO = "from TarmComercianteCupo tcc" + " where tcc.personcodigo = :personcodigo and tcc.clase = :clasecodigo and tcc.tipoarmaexplosivo=:tipoarmaexplosivo and tcc.tiporegistro=:tiporegistro"; + private static final String JPQL_CATALOG = "from TgeneCatalogDetail tgd"+" where tgd.pk.catalog= :catalog and tgd.pk.catalogcode= :catalogcode"; + + + /* (non-Javadoc) + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + @SuppressWarnings("unchecked") + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + try { + System.out.println("INGRESA A SOLICITUD IMPORTACION"); + //EntityManager em=PersistenceHelper.getEntityManager(); + List listaArmas=(ArrayList)pSaveRequest.get("LISTAARMAS"); + List listaTotales=(ArrayList)pSaveRequest.get("LISTATOTALES"); + TarmRegistroArmas registro=(TarmRegistroArmas)pSaveRequest.get("REGISTRO"); + + List registroarmasL=(List) pSaveRequest.getSaveBeanModifiedRecords("TREGISTROARMAS"); + List tarmArmasL=(List) pSaveRequest.getSaveBeanModifiedRecords("ARMAS"); + List tarmTotalPersonaL=(List) pSaveRequest.getSaveBeanModifiedRecords("TOTALCONTROLLER"); + if(registroarmasL==null){ + registroarmasL= new ArrayList<>(); + } + if(tarmArmasL==null){ + tarmArmasL= new ArrayList<>(); + } + if(tarmTotalPersonaL==null){ + tarmTotalPersonaL= new ArrayList<>(); + } + + //Persistiendo el registro + String cregistro = null; + Sequence sequence = new Sequence(); + Integer valorRegistro=Integer.valueOf(sequence.getNextValue("CREGISTRO").toString()); + if(valorRegistro!=null){ + cregistro=valorRegistro.toString(); + registro.setPk(Long.parseLong(cregistro)); + registroarmasL.add(registro); + //em.persist(registro); + } + + //Persistiendo la lista de armas + for (TarmArmas arma : listaArmas) { + arma.setCregistro(Long.parseLong(cregistro)); + if(arma.isnew){ + String carma = null; + sequence = new Sequence(); + String valor=sequence.getNextValue("CARMA").toString(); + if(valor!=null){ + carma=valor.toString(); + arma.setPk(carma); + arma.setCodigoarma(arma.getPk()); + //arma.setUnidadmedidacantidad("Unidad"); + tarmArmasL.add(arma); + //em.persist(arma); + } + }else{ + TarmArmas armaBD=new TarmArmas(); + armaBD=PersistenceHelper.getEntityManager().find(TarmArmas.class, arma.getPk()); + armaBD.setCantidad(arma.getCantidad()); + armaBD.setCantoncode(arma.getCantoncode()); + armaBD.setCitycode(arma.getCitycode()); + armaBD.setCodigoarma(arma.getCodigoarma()); + armaBD.setColor(arma.getColor()); + armaBD.setColorcodigo(arma.getColorcodigo()); + armaBD.setCountrycode(arma.getCountrycode()); + armaBD.setCpaisorigen(arma.getCpaisorigen()); + armaBD.setCregistro(arma.getCregistro()); + armaBD.setCtipoarmaexplosivo(arma.getCtipoarmaexplosivo()); + armaBD.setDireccion(arma.getDireccion()); + armaBD.setEstado(arma.getEstado()); + armaBD.setEstadocodigo(arma.getEstadocodigo()); + armaBD.setFecharegistro(arma.getFecharegistro()); + armaBD.setFemisionpermiso(arma.getFemisionpermiso()); + armaBD.setLote(arma.getLote()); + armaBD.setMarca(arma.getMarca()); + armaBD.setMarcacodigo(arma.getMarcacodigo()); + armaBD.setModelo(arma.getModelo()); + armaBD.setNemonicoarma(arma.getNemonicoarma()); + armaBD.setParroquiacode(arma.getParroquiacode()); + armaBD.setPeso(arma.getPeso()); + armaBD.setPesoAux(arma.getPesoAux()); + armaBD.setPk(arma.getPk()); + armaBD.setProvincecode(arma.getProvincecode()); + armaBD.setRecordversion(arma.getRecordversion()); + armaBD.setSeriecanon(arma.getSeriecanon()); + armaBD.setTipofabricacion(arma.getTipofabricacion()); + armaBD.setUnidadmedidacantidad(arma.getUnidadmedidacantidad()); + armaBD.setUnidadmedidacantidadcodigo(arma.getUnidadmedidacantidadcodigo()); + armaBD.setValorAux(arma.getValorAux()); + armaBD.setCodigoarma(arma.getPk()); + //em.persist(armaBD); + tarmArmasL.add(arma); + } + } + + //Persistiendo la lista de totales + for (TarmTotalPersona total : listaTotales) { + if(total.isnew){ + String ctotal = null; + sequence = new Sequence(); + Integer valor=Integer.valueOf(sequence.getNextValue("CTOTAL").toString()); + if(valor!=null){ + ctotal=valor.toString(); + total.setPk(ctotal); + //total.setUnidadmedidapeso("Unidad"); + System.out.println(total); + tarmTotalPersonaL.add(total); +// em.persist(total); +// em.flush(); + } + }else{ + TarmTotalPersona totalBD=new TarmTotalPersona(); + totalBD=PersistenceHelper.getEntityManager().find(TarmTotalPersona.class, total.getPk()); + totalBD.setClase(total.getClase()); + totalBD.setClasecodigo(total.getClasecodigo()); + totalBD.setCarma(total.getCarma()); + totalBD.setFecha(total.getFecha()); + totalBD.setPersoncodigo(total.getPersoncodigo()); + totalBD.setPk(total.getPk()); + totalBD.setRecordversion(total.getRecordversion()); + totalBD.setSaldoanterior(total.getSaldoanterior()); + totalBD.setTipoarmaexplosivo(total.getTipoarmaexplosivo()); + totalBD.setTipoarmaexplosivocodigo(total.getTipoarmaexplosivocodigo()); + totalBD.setTotal(total.getTotal()); + totalBD.setUnidadmedidapeso(total.getUnidadmedidapeso()); + totalBD.setUnidadmedidapesocodigo(total.getUnidadmedidapesocodigo()); + tarmTotalPersonaL.add(total); + //em.persist(totalBD); + } + } + // em.flush(); + } catch (Exception e) { + return pSaveRequest; + // TODO: handle exception + } + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + + return arg0; + } + + + /** + * Actualiza la tabla de totales + * @param tipoarmaexplosivo + * @param valor + * @param personcode + * @return + */ + public TarmTotalPersona cargarDatos(TarmTipoArmaExplosivo tipoarmaexplosivo,BigDecimal valor,Integer personcode) + { + TarmTotalPersona totalArma = new TarmTotalPersona(); + totalArma.setClase(tipoarmaexplosivo.getClase()); + totalArma.setClasecodigo(tipoarmaexplosivo.getClasecodigo()); + totalArma.setFecha(new Timestamp(new Date().getTime())); + totalArma.setTipoarmaexplosivo(tipoarmaexplosivo.getTipoarmaexplosivo()); + totalArma.setTipoarmaexplosivocodigo(tipoarmaexplosivo.getTipoarmaexplosivocodigo()); + totalArma.setPersoncodigo(personcode); + totalArma.setSaldoanterior(BigDecimal.ZERO); + totalArma.setTotal(valor); + totalArma.setUnidadmedidapeso(tipoarmaexplosivo.getUnidadmedidapeso()); + totalArma.setUnidadmedidapesocodigo(tipoarmaexplosivo.getUnidadmedidapesocodigo()); + return totalArma; + + } + + /** + * Actualiza la tabla de totales cuando existen datos anteriores + * @param tipoarmaexplosivo + * @param valor + * @param personcode + * @param saldo + * @return + */ + public TarmTotalPersona cargarDatosAnterior(TarmTipoArmaExplosivo tipoarmaexplosivo,BigDecimal valor,Integer personcode,BigDecimal saldo) + { + BigDecimal total = new BigDecimal(0); + total = total.add(valor); + total = total.add(saldo); + TarmTotalPersona totalArma = new TarmTotalPersona(); + totalArma.setClase(tipoarmaexplosivo.getClase()); + totalArma.setClasecodigo(tipoarmaexplosivo.getClasecodigo()); + totalArma.setFecha(new Timestamp(new Date().getTime())); + totalArma.setTipoarmaexplosivo(tipoarmaexplosivo.getTipoarmaexplosivo()); + totalArma.setTipoarmaexplosivocodigo(tipoarmaexplosivo.getTipoarmaexplosivocodigo()); + totalArma.setPersoncodigo(personcode); + totalArma.setSaldoanterior(saldo); + totalArma.setTotal(total); + totalArma.setUnidadmedidapeso(tipoarmaexplosivo.getUnidadmedidapeso()); + totalArma.setUnidadmedidapesocodigo(tipoarmaexplosivo.getUnidadmedidapesocodigo()); + return totalArma; + } + + /** + * Encuentra el cupo por cliente + * @param pEntityManager + * @param personcodigo + * @param clasecodigo + * @param tipoarmaexplosivo + * @param tiporegistro + * @return + * @throws Exception + */ + public static List findCupo(EntityManager pEntityManager, Integer personcodigo, String clasecodigo, String tipoarmaexplosivo, String tiporegistro) throws Exception { + + Query qry = pEntityManager.createQuery(SolicitudImportacion.JPQL_COMERCIANTECUPO); + qry.setParameter("personcodigo", personcodigo); + qry.setParameter("clasecodigo", clasecodigo); + qry.setParameter("tipoarmaexplosivo", tipoarmaexplosivo); + qry.setParameter("tiporegistro", tiporegistro); + return qry.getResultList(); + } + + /** + * Encuentra una lista de tipo de armas y explosivos + * @param pEntityManager + * @param pk + * @return + * @throws Exception + */ + public static List findByClase(EntityManager pEntityManager, String pk) throws Exception { + Query qry = pEntityManager.createQuery(SolicitudImportacion.JPQL_TIPOARMAEXPLOSIVO); + qry.setParameter("pk", pk); + return qry.getResultList(); + } + + public static List find(EntityManager pEntityManager, String catalog, String catalogcode) throws Exception { + Query qry = pEntityManager.createQuery(SolicitudImportacion.JPQL_CATALOG); + + qry.setParameter("catalog", catalog); + qry.setParameter("catalogcode", catalogcode); + return qry.getResultList(); + } + /** + * Mtodo que devuelve la secuencia de un cliente. + * + * @return Codigo del nuevo cliente. + * @throws Exception + */ + private Long getCodigoSolicitud() throws Exception { + Sequence sequence = new Sequence(); + Long codigo = sequence.getNextValue("CREGISTRO").longValue(); + + return codigo; + + } + + + /** + * Mtodo que devuelve el codigo de un arma + * @return + * @throws Exception + */ + private String getCodigoArmas() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CARMA").toString(); + + return codigoArma; + + } + + +} \ No newline at end of file diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/entries b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/entries new file mode 100644 index 0000000..277746b --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/entries @@ -0,0 +1,198 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices +svn://172.17.26.185/COMACO + + + +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +DocumentoDatos.java +file + + + + +2022-07-28T03:40:41.100796Z +affbb31998fcf90550244cc2e2c48811 +2022-04-19T02:27:53.431385Z +4665 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +8893 + +IngresaLectura.java +file + + + + +2022-07-28T03:40:41.100796Z +27a584ae2c30e90e7bae9228d916d96d +2022-04-19T02:27:53.431385Z +4665 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +5101 + +DesvinculaTagArma.java +file + + + + +2022-07-28T03:40:41.100796Z +5143940a528b1e5758ef9e7af62f3a35 +2022-04-19T02:27:53.431385Z +4665 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +2181 + +DocumentoHabilitanteDatos.java +file + + + + +2022-07-28T03:40:41.101796Z +08b5d2c4add6ce9c40925167f055c9e4 +2022-04-19T02:27:53.431385Z +4665 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +4934 + +VinculaTagArma.java +file + + + + +2022-07-28T03:40:41.101796Z +f11588f5dfa9fef9aa69c32ec9c0134b +2022-04-19T02:27:53.431385Z +4665 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +2336 + diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/prop-base/DesvinculaTagArma.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/prop-base/DesvinculaTagArma.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/prop-base/DesvinculaTagArma.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/prop-base/DocumentoDatos.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/prop-base/DocumentoDatos.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/prop-base/DocumentoDatos.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/prop-base/IngresaLectura.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/prop-base/IngresaLectura.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/prop-base/IngresaLectura.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/prop-base/VinculaTagArma.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/prop-base/VinculaTagArma.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/prop-base/VinculaTagArma.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/text-base/DesvinculaTagArma.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/text-base/DesvinculaTagArma.java.svn-base new file mode 100644 index 0000000..c18793b --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/text-base/DesvinculaTagArma.java.svn-base @@ -0,0 +1,63 @@ +package com.fp.armas.rules.save.webservices; + +import java.util.List; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.inte.TarmLecturaDetalle; +import com.fp.persistence.parmas.inte.TarmTagArma; +import com.fp.persistence.parmas.inte.TarmTagArmaKey; + +/** + * Desvinculo el arma de un tag determinado, respondo con estado de la petición + * @author dcruz + * + */ +public class DesvinculaTagArma extends TransactionRule { + + private static final long serialVersionUID = -2755388437487909747L; + + /** + * Env&iaucte;o una respuesta 0 correcto, 1 no existe el arma a desvincular, 2 ocurrió un error + */ + @SuppressWarnings("unchecked") + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + String respuesta = "0"; + try { + String carma = (String) pRequest.get("CODIGOARMA"); + String tagArma = (String) pRequest.get("CODIGOTAG"); + TarmTagArma tarmTagArma = PersistenceHelper.getEntityManager().find(TarmTagArma.class, new TarmTagArmaKey(carma, tagArma)); + if(tarmTagArma == null){ + respuesta = "1"; + } else{ + List lecturaDetalles=PersistenceHelper.getEntityManager(). + createQuery("select o from TarmLecturaDetalle o where o.pk.codigotag='"+tarmTagArma.getPk().getCtag()+"'").getResultList(); + PersistenceHelper.getEntityManager().remove(tarmTagArma); + PersistenceHelper.getEntityManager().flush(); + + if(lecturaDetalles!=null && lecturaDetalles.size()>0){ + for(TarmLecturaDetalle detalleLectura:lecturaDetalles){ + PersistenceHelper.getEntityManager().remove(detalleLectura); + PersistenceHelper.getEntityManager().flush(); + } + } + respuesta = "0"; + } + + } catch (Throwable e) { + respuesta = "2"; + APPLogger.getLogger().error(e.getMessage(), e); + } + pRequest.getResponse().put("RESPONSESTATUS", respuesta); + return pRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/text-base/DocumentoDatos.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/text-base/DocumentoDatos.java.svn-base new file mode 100644 index 0000000..6be1d55 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/text-base/DocumentoDatos.java.svn-base @@ -0,0 +1,177 @@ +package com.fp.armas.rules.save.webservices; + +import static com.fp.armas.rules.query.webservices.ConsultaImpresionProceso.QUERY_COLA_SOLICITUD; + +import java.sql.Timestamp; +import java.util.Date; +import java.util.List; + +import javax.persistence.Query; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.inte.TarmColadeImpresion; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.pcustomer.company.TcustCompany; +import com.fp.persistence.pcustomer.company.TcustCompanyKey; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; +import com.fp.persistence.pcustomer.people.TcustPeople; +import com.fp.persistence.pcustomer.people.TcustPeopleKey; +import com.fp.persistence.pgeneral.image.TgeneFiles; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.image.TgeneFilesDetailKey; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Actualiza los datos del documento habilitante enviado + * @author dcruz + * + */ +public class DocumentoDatos extends TransactionRule { + + private static final long serialVersionUID = -951465699701916612L; + public static final String SQLDOCUMENTOCOLAIMPRESION="SELECT o FROM TarmColadeImpresion o" + + " WHERE o.cdocumento IN (SELECT i.pk FROM TarmDocumentoHabilitante i " + + " WHERE i.numerodocumento =:numerodocumento)"; + + /** + * Actualizamos fecha de impresión en la cola de impresion encontrada, actualizamos la foto de la persona o el logo de la companía según sea el caso + */ + @SuppressWarnings("unchecked") + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + System.out.println(".........ACTUALIZA LOS DATOS DEL TARMCOLADEIMPRESION..................."); + String respuesta = "0"; + try { + byte[] foto = (byte[]) pRequest.get("FOTO"); + String numerosolicitud = (String) pRequest.get("CODIGOSOLICITUD");//numero de solicitud + String codigotarjeta = (String) pRequest.get("CODIGOTARJETA"); + Date fechaimpresion = (Date) pRequest.get("FECHAIMPRESION"); + // + System.out.println(SQLDOCUMENTOCOLAIMPRESION+" "+numerosolicitud); + + Query query = PersistenceHelper.getEntityManager().createQuery(SQLDOCUMENTOCOLAIMPRESION); + query.setParameter("numerodocumento", numerosolicitud); + + List ltarmcoladeimpresion = query.getResultList(); + if(ltarmcoladeimpresion != null && !ltarmcoladeimpresion.isEmpty()){//siempre que es un permiso para imprimir en la cola de impresion recupera uno + TarmColadeImpresion coladeImpresion = ltarmcoladeimpresion.iterator().next(); + coladeImpresion.setFechaimpresion(new Timestamp(fechaimpresion.getTime())); + coladeImpresion.setCodigotarjeta(codigotarjeta); + coladeImpresion.setEstadoimpresion("IMPR"); + PersistenceHelper.getEntityManager().merge(coladeImpresion); + System.out.println("ACTIALIZA LA COLA DE IMPRESION.."); + TarmDocumentoHabilitante documentoHabilitante = TarmDocumentoHabilitante.find(PersistenceHelper.getEntityManager(), coladeImpresion.getCdocumento()); + TarmSolicitud solicitud = TarmSolicitud.find(PersistenceHelper.getEntityManager(), documentoHabilitante.getCsolicitud()); + TcustPersonDetail personDetail = TcustPersonDetail.find(PersistenceHelper.getEntityManager(), new TcustPersonDetailKey(solicitud.getPersoncode(), FormatDates.getDefaultExpiryTimestamp())); + TgeneFilesDetail fotoLogo = obtenerFoto(personDetail); + + if(fotoLogo.getPk() == null){// es un registro nuevo + TcustCompany company = null; + TcustPeople people = null; + if(fotoLogo.getModifiedData().get("DATOASOCIADO") != null && fotoLogo.getModifiedData().get("DATOASOCIADO") instanceof TcustCompany){ + company = (TcustCompany) fotoLogo.getModifiedData().get("DATOASOCIADO"); + } else if(fotoLogo.getModifiedData().get("DATOASOCIADO") != null && fotoLogo.getModifiedData().get("DATOASOCIADO") instanceof TcustPeople){ + people = (TcustPeople) fotoLogo.getModifiedData().get("DATOASOCIADO"); + } + TgeneFiles tgeneFiles = new TgeneFiles(getCode()); + PersistenceHelper.getEntityManager().persist(tgeneFiles); + fotoLogo.setPk(new TgeneFilesDetailKey(tgeneFiles.getPk(), FormatDates.getDefaultExpiryTimestamp())); + fotoLogo.setDatefrom(new Timestamp(System.currentTimeMillis())); + fotoLogo.setName("FOTO"); + fotoLogo.setCapturedate(new java.sql.Date(System.currentTimeMillis())); + fotoLogo.setContenttype("image/jpeg"); + fotoLogo.setDescription("LOGO EMPRESA"); + fotoLogo.setImage(foto); + fotoLogo.setExtension("jpg"); + fotoLogo.setImagesize(foto.length); + PersistenceHelper.getEntityManager().persist(fotoLogo); + System.out.println("INSERTA LA FOTO....."); + //Actualizo en la persona o la compania segun sea el caso + if(company != null){ + company.setLogo(tgeneFiles.getPk()); + PersistenceHelper.getEntityManager().merge(company); + } else if(people != null){ + people.setPhotocode(tgeneFiles.getPk()); + PersistenceHelper.getEntityManager().merge(people); + } + } else{//actualizo el registro anterior y genero el historial + TgeneFilesDetail tgeneFilesDetail = new TgeneFilesDetail(new TgeneFilesDetailKey(fotoLogo.getPk().getCode(), new Timestamp(System.currentTimeMillis()))); + tgeneFilesDetail.setDatefrom(fotoLogo.getDatefrom()); + tgeneFilesDetail.setName(fotoLogo.getName()); + tgeneFilesDetail.setCapturedate(fotoLogo.getCapturedate()); + tgeneFilesDetail.setContenttype(fotoLogo.getContenttype()); + tgeneFilesDetail.setDescription(fotoLogo.getDescription()); + tgeneFilesDetail.setImage(fotoLogo.getImage()); + tgeneFilesDetail.setExtension(fotoLogo.getExtension()); + tgeneFilesDetail.setImagesize(fotoLogo.getImagesize()); + PersistenceHelper.getEntityManager().persist(tgeneFilesDetail); + fotoLogo.setImage(foto); + fotoLogo.setImagesize(foto.length); + PersistenceHelper.getEntityManager().merge(fotoLogo); + System.out.println("ACTUALIZA LA FOTO....."); + } + PersistenceHelper.getEntityManager().flush(); + } + } catch (Throwable e) { + respuesta = "2"; + APPLogger.getLogger().error(e.getMessage(), e); + } + pRequest.getResponse().put("RESPONSESTATUS", respuesta); + return pRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + + /** + * Retorna la foto de la persona si es que esta existe + * @param personDetail + * @return El detalle del achivo imagen que se ha guardado, o un archivo vacío sin pk para que pueda ser guardado en la base de datos + * @throws CommondbException + * @throws Exception + */ + private TgeneFilesDetail obtenerFoto(TcustPersonDetail personDetail) throws CommondbException, Exception{ + TcustCompany company = null; + TcustPeople people = null; + TgeneFilesDetail result = null; + switch(personDetail.getIdentification().length()){ + case 13: + company = TcustCompany.find(PersistenceHelper.getEntityManager(), new TcustCompanyKey(personDetail.getPk().getPersoncode(), FormatDates.getDefaultExpiryTimestamp())); + break; + default: + people = TcustPeople.find(PersistenceHelper.getEntityManager(), new TcustPeopleKey(personDetail.getPk().getPersoncode(), FormatDates.getDefaultExpiryTimestamp())); + break; + } + if(company != null){ + result = TgeneFilesDetail.find(PersistenceHelper.getEntityManager(), new TgeneFilesDetailKey(company.getLogo(), FormatDates.getDefaultExpiryTimestamp())); +// result.getModifiedData().put("DATOASOCIADO", company); + } else if(people != null){ + result = TgeneFilesDetail.find(PersistenceHelper.getEntityManager(), new TgeneFilesDetailKey(people.getPhotocode(), FormatDates.getDefaultExpiryTimestamp())); +// result.getModifiedData().put("DATOASOCIADO", people); + } + if(result == null){ + result = new TgeneFilesDetail(); + } + result.getModifiedData().put("DATOASOCIADO", company != null ? company : people); + return result; + } + + /** + * Retorna el secuencial para ingresar en la tabla {@link TgeneFiles} + * @return + * @throws Exception + */ + private Integer getCode() throws Exception{ + Sequence secuenciaCode = new Sequence(); + return Integer.valueOf(secuenciaCode.getNextValue("CODE").toString()); + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/text-base/DocumentoHabilitanteDatos.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/text-base/DocumentoHabilitanteDatos.java.svn-base new file mode 100644 index 0000000..adc62bc --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/text-base/DocumentoHabilitanteDatos.java.svn-base @@ -0,0 +1,126 @@ +package com.fp.armas.rules.save.webservices; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.persistence.Query; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Actualiza los datos del documento habilitante enviado + * @author ndominguez + * + */ +public class DocumentoHabilitanteDatos extends TransactionRule { + + private static final long serialVersionUID = -951465699701916612L; + public static final String QUERY_SOLICITUD_NUM = "SELECT o FROM TarmSolicitud o WHERE o.numerosolicitud=:numerosolicitud"; + @SuppressWarnings("unchecked") + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + System.out.println(".........ACTUALIZA LOS DATOS DEL TARMDOCUMENTOHABILITANTE..................."); + String respuesta = "0"; + try { + String numerosolicitud = (String) pRequest.get("NUMEROSOLICITUD"); + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_SOLICITUD_NUM); + query.setParameter("numerosolicitud", numerosolicitud); + List ltarmSolicitud = query.getResultList(); + if ( ltarmSolicitud != null && !ltarmSolicitud.isEmpty() ) { + TarmSolicitud tarmSolicitud = ltarmSolicitud.iterator().next(); + Query queryDoc = PersistenceHelper.createQuery("SELECT o FROM TarmDocumentoHabilitante o WHERE o.csolicitud=:csolicitud "); + queryDoc.setParameter("csolicitud", tarmSolicitud.getPk()); + List documentoHabilitantes = queryDoc.getResultList(); + if(documentoHabilitantes != null && !documentoHabilitantes.isEmpty()){ + TarmDocumentoHabilitante documentoHabilitante = documentoHabilitantes.iterator().next(); + String fileName = null; + try { + //Se valida que no tenga caracteres especiales + fileName = caractersEspeciales(documentoHabilitante.getNumerodocumento()); + } catch (Exception e) { + respuesta = "2"; + APPLogger.getLogger().error(e.getMessage(), e); + } + if (fileName != null) { + String xpathdocumento = getRutaDocumentoSolBase(documentoHabilitante.getFechaemision(), numerosolicitud, fileName); + documentoHabilitante.setXpath(xpathdocumento); + PersistenceHelper.getEntityManager().merge(documentoHabilitante); + PersistenceHelper.getEntityManager().flush(); + pRequest.getResponse().put("XPATHDOCUMENTOSOLICITUD", documentoHabilitante.getXpath()); + } else { + respuesta = "1"; + } + } else { + respuesta = "1"; + } + } else { + respuesta = "1"; + } + } catch (Throwable e) { + respuesta = "2"; + APPLogger.getLogger().error(e.getMessage(), e); + } + pRequest.getResponse().put("RESPONSESTATUS", respuesta); + return pRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + + /** + * Método que revisa si una cadena tiene caracteres especiales + * @param nombre + * @return + * @throws Exception + */ + public static String caractersEspeciales(String nombre) throws Exception{ + List caracteresEsp=TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(),"CARACTERESPECIAL"); + for(TgeneCatalogDetail caract:caracteresEsp){ + if(nombre.contains(caract.getPk().getCatalog())){ + return null; + } + } + String numero="1234567890"; + if(numero.contains(nombre.substring(0, 1))){ + return null; + } + if(nombre!=null && nombre.trim().contains(" ")){ + return null; + } + if(nombre.length()<9){ + nombre="DOCUMENTO-"+nombre; + } + return nombre; + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + private String getRutaDocumentoSolBase(Date fechaEmision, String numerosolicitud, String numerodocumento) { + StringBuilder ruta = null; + if (fechaEmision != null && numerosolicitud != null + && numerodocumento != null) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(fechaEmision); + ruta = new StringBuilder("cm:Solicitud"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + ruta = ruta.append("/cm:").append(numerosolicitud); + ruta = ruta.append("/cm:").append(numerodocumento+".pdf"); + } + return ruta != null ? ruta.toString() : null; + } + + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/text-base/IngresaLectura.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/text-base/IngresaLectura.java.svn-base new file mode 100644 index 0000000..6bcb92d --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/text-base/IngresaLectura.java.svn-base @@ -0,0 +1,127 @@ +package com.fp.armas.rules.save.webservices; + +import java.sql.Timestamp; +import java.util.Date; +import java.util.List; + +import javax.persistence.Query; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.inte.TarmLectura; +import com.fp.persistence.parmas.inte.TarmLecturaDetalle; +import com.fp.persistence.parmas.inte.TarmLecturaDetalleKey; +import com.fp.persistence.parmas.inte.TarmTagArma; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Componente en donde se ingresa las lecturas que provienen del hand held + * @author dcruz + * + */ +public class IngresaLectura extends TransactionRule { + + private static final long serialVersionUID = 8760785038997324400L; + + private static final String QUERY_TAG_ARMA = "SELECT o FROM TarmTagArma o WHERE o.ctag=:codigotag"; + + /** + * Método en el cual se inserta los registros de los dispositivos leidos en la hand held + */ + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + System.out.println("INGRESA A GUARDAR EL TAG........................"+pRequest); + String tagsleidos = (String) pRequest.get("TAGSLECTURA"); + Date fechalectura = (Date) pRequest.get("FECHALECTURA"); + String locacionlectura = (String) pRequest.get("LOCACIONLECTURA"); + String idportal = (String) pRequest.get("IDPORTAL"); + String tipooperacion = (String) pRequest.get("TIPOOPERACION"); + String[] tagleidosArray=null; + if(tagsleidos.contains(",")){ + tagleidosArray = tagsleidos.split(","); + }else{ + tagleidosArray = tagsleidos.split("/"); + } + String direccion = locacionlectura; + guardaLectura(tagleidosArray, fechalectura, direccion, idportal, tipooperacion); + return pRequest; + } + + /** + * Método en el cual guardamos los datos leíidos desde el hand held + * @param tagleidos array de tag leídos del hand held + * @param fechaLectura la fecha en la que se realizó la lectura + * @param countrycode código de país + * @param provincecode código de provincia + * @param cantoncode código de cantón + * @param parroquiacode código de parroquia + * @param idportal id del portal de donde se capturó la lectura + * @param tipooperacion tipo de operació de la lectura si es hand held o si es portal + * @throws Exception + */ + private void guardaLectura(String[] tagleidos, Date fechaLectura, String direccion, String idportal, String tipooperacion) throws Exception{ + TarmLectura tarmLectura = new TarmLectura(); + tarmLectura.setPk(getCodigoLectura()); + tarmLectura.setFecha(new Timestamp(fechaLectura.getTime())); + + System.out.println("direccion ......................."+direccion); + System.out.println(direccion.contains(",")); + if(direccion.contains(",")){ + String[] direccionArray = direccion.split(","); + String provincecode = direccionArray[0]; + tarmLectura.setProvincecode(provincecode); + } + +// tarmLectura.setCountrycode(countrycode); +// tarmLectura.setProvincecode(provincecode); +// tarmLectura.setCantoncode(cantoncode); +// tarmLectura.setParroquiacode(parroquiacode); + tarmLectura.setIdportal(idportal); + tarmLectura.setTipolectura(tipooperacion); + tarmLectura.setTipolecturacode("TIPOLECTURA"); + tarmLectura.setDireccion(direccion); + PersistenceHelper.getEntityManager().persist(tarmLectura); + for (String tag : tagleidos) { +// String carma = getCodigoArmadeTag(tag); + TarmLecturaDetalle tarmLecturaDetalle = new TarmLecturaDetalle(new TarmLecturaDetalleKey(tarmLectura.getPk(), tag)); +// tarmLecturaDetalle.set + PersistenceHelper.getEntityManager().persist(tarmLecturaDetalle); + } + PersistenceHelper.getEntityManager().flush(); + } + + /** + * Retorna el codigo del arma asociada al tag desde TarmTagArma + * @param codigotag + * @return el código del arma relacionada con el tag + */ + @SuppressWarnings("unchecked") + private String getCodigoArmadeTag(String codigotag) throws Exception{ + //tanto el tag como el arma deben estar relacionados entre si, no se puede producir el caso en que un tag este relacionado con mas de un arma y viceversa + String codigoarma = null; + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_TAG_ARMA); + query.setParameter("codigotag", codigotag); + List ltarmTagArmas = query.getResultList(); + if(ltarmTagArmas != null && !ltarmTagArmas.isEmpty()){ + codigoarma = ltarmTagArmas.iterator().next().getPk().getCarma(); + } + return codigoarma; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + + /** + * Retorna el codódigo secuencial de la pk de la tabla {@link TarmLectura} + * @return la secuencia de la tabla {@link TarmLectura} + * @throws Exception + */ + public Long getCodigoLectura() throws Exception { + Sequence sequence = new Sequence(); + return sequence.getNextValue("CLECTURA").longValue(); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/text-base/VinculaTagArma.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/text-base/VinculaTagArma.java.svn-base new file mode 100644 index 0000000..509f8fd --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/.svn/text-base/VinculaTagArma.java.svn-base @@ -0,0 +1,66 @@ +package com.fp.armas.rules.save.webservices; + +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Query; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.inte.TarmTagArma; +import com.fp.persistence.parmas.inte.TarmTagArmaKey; + +/** + * Vinculo un arma con un tag, respondo con un mensaje de validación para mostrar el estado de la petición + * @author dcruz + * + */ +public class VinculaTagArma extends TransactionRule { + + private static final long serialVersionUID = 7380264973023057406L; + private static final String QUERY_TAGARMA = "SELECT o FROM TarmTagArma o WHERE o.pk.carma=:carma"; + + /** + * Respondo con 0 es correcto, 1 el arma ya esta registrada con otro tag, 2 el arma ya ha sido registrada, 3 existió un error + */ + @SuppressWarnings("unchecked") + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + String respuesta; + try { + String carma = (String) pRequest.get("CODIGOARMA"); + String tagArma = (String) pRequest.get("CODIGOTAG"); + TarmTagArma tarmTagArma = PersistenceHelper.getEntityManager().find(TarmTagArma.class, new TarmTagArmaKey(carma, tagArma)); + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_TAGARMA); + query.setParameter("carma", carma); + List ltarmTagArmas = query.getResultList(); + if(tarmTagArma != null){ + respuesta = "2"; + } else if(!ltarmTagArmas.isEmpty()){ + respuesta = "1"; + } else{ + TarmTagArma ptagArma = new TarmTagArma(new TarmTagArmaKey(carma, tagArma)); + ptagArma.setFecha(new Timestamp(System.currentTimeMillis())); + PersistenceHelper.getEntityManager().persist(ptagArma); + PersistenceHelper.getEntityManager().flush(); + respuesta = "0"; + } + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + respuesta = "3"; + } + pRequest.getResponse().put("RESPONSESTATUS", respuesta); + return pRequest; + } + + /** + * Método que se realiza al hacer rollback la transacción + */ + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/DesvinculaTagArma.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/DesvinculaTagArma.java new file mode 100644 index 0000000..c18793b --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/DesvinculaTagArma.java @@ -0,0 +1,63 @@ +package com.fp.armas.rules.save.webservices; + +import java.util.List; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.inte.TarmLecturaDetalle; +import com.fp.persistence.parmas.inte.TarmTagArma; +import com.fp.persistence.parmas.inte.TarmTagArmaKey; + +/** + * Desvinculo el arma de un tag determinado, respondo con estado de la petición + * @author dcruz + * + */ +public class DesvinculaTagArma extends TransactionRule { + + private static final long serialVersionUID = -2755388437487909747L; + + /** + * Env&iaucte;o una respuesta 0 correcto, 1 no existe el arma a desvincular, 2 ocurrió un error + */ + @SuppressWarnings("unchecked") + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + String respuesta = "0"; + try { + String carma = (String) pRequest.get("CODIGOARMA"); + String tagArma = (String) pRequest.get("CODIGOTAG"); + TarmTagArma tarmTagArma = PersistenceHelper.getEntityManager().find(TarmTagArma.class, new TarmTagArmaKey(carma, tagArma)); + if(tarmTagArma == null){ + respuesta = "1"; + } else{ + List lecturaDetalles=PersistenceHelper.getEntityManager(). + createQuery("select o from TarmLecturaDetalle o where o.pk.codigotag='"+tarmTagArma.getPk().getCtag()+"'").getResultList(); + PersistenceHelper.getEntityManager().remove(tarmTagArma); + PersistenceHelper.getEntityManager().flush(); + + if(lecturaDetalles!=null && lecturaDetalles.size()>0){ + for(TarmLecturaDetalle detalleLectura:lecturaDetalles){ + PersistenceHelper.getEntityManager().remove(detalleLectura); + PersistenceHelper.getEntityManager().flush(); + } + } + respuesta = "0"; + } + + } catch (Throwable e) { + respuesta = "2"; + APPLogger.getLogger().error(e.getMessage(), e); + } + pRequest.getResponse().put("RESPONSESTATUS", respuesta); + return pRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/DocumentoDatos.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/DocumentoDatos.java new file mode 100644 index 0000000..6be1d55 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/DocumentoDatos.java @@ -0,0 +1,177 @@ +package com.fp.armas.rules.save.webservices; + +import static com.fp.armas.rules.query.webservices.ConsultaImpresionProceso.QUERY_COLA_SOLICITUD; + +import java.sql.Timestamp; +import java.util.Date; +import java.util.List; + +import javax.persistence.Query; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.inte.TarmColadeImpresion; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.pcustomer.company.TcustCompany; +import com.fp.persistence.pcustomer.company.TcustCompanyKey; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; +import com.fp.persistence.pcustomer.people.TcustPeople; +import com.fp.persistence.pcustomer.people.TcustPeopleKey; +import com.fp.persistence.pgeneral.image.TgeneFiles; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.image.TgeneFilesDetailKey; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Actualiza los datos del documento habilitante enviado + * @author dcruz + * + */ +public class DocumentoDatos extends TransactionRule { + + private static final long serialVersionUID = -951465699701916612L; + public static final String SQLDOCUMENTOCOLAIMPRESION="SELECT o FROM TarmColadeImpresion o" + + " WHERE o.cdocumento IN (SELECT i.pk FROM TarmDocumentoHabilitante i " + + " WHERE i.numerodocumento =:numerodocumento)"; + + /** + * Actualizamos fecha de impresión en la cola de impresion encontrada, actualizamos la foto de la persona o el logo de la companía según sea el caso + */ + @SuppressWarnings("unchecked") + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + System.out.println(".........ACTUALIZA LOS DATOS DEL TARMCOLADEIMPRESION..................."); + String respuesta = "0"; + try { + byte[] foto = (byte[]) pRequest.get("FOTO"); + String numerosolicitud = (String) pRequest.get("CODIGOSOLICITUD");//numero de solicitud + String codigotarjeta = (String) pRequest.get("CODIGOTARJETA"); + Date fechaimpresion = (Date) pRequest.get("FECHAIMPRESION"); + // + System.out.println(SQLDOCUMENTOCOLAIMPRESION+" "+numerosolicitud); + + Query query = PersistenceHelper.getEntityManager().createQuery(SQLDOCUMENTOCOLAIMPRESION); + query.setParameter("numerodocumento", numerosolicitud); + + List ltarmcoladeimpresion = query.getResultList(); + if(ltarmcoladeimpresion != null && !ltarmcoladeimpresion.isEmpty()){//siempre que es un permiso para imprimir en la cola de impresion recupera uno + TarmColadeImpresion coladeImpresion = ltarmcoladeimpresion.iterator().next(); + coladeImpresion.setFechaimpresion(new Timestamp(fechaimpresion.getTime())); + coladeImpresion.setCodigotarjeta(codigotarjeta); + coladeImpresion.setEstadoimpresion("IMPR"); + PersistenceHelper.getEntityManager().merge(coladeImpresion); + System.out.println("ACTIALIZA LA COLA DE IMPRESION.."); + TarmDocumentoHabilitante documentoHabilitante = TarmDocumentoHabilitante.find(PersistenceHelper.getEntityManager(), coladeImpresion.getCdocumento()); + TarmSolicitud solicitud = TarmSolicitud.find(PersistenceHelper.getEntityManager(), documentoHabilitante.getCsolicitud()); + TcustPersonDetail personDetail = TcustPersonDetail.find(PersistenceHelper.getEntityManager(), new TcustPersonDetailKey(solicitud.getPersoncode(), FormatDates.getDefaultExpiryTimestamp())); + TgeneFilesDetail fotoLogo = obtenerFoto(personDetail); + + if(fotoLogo.getPk() == null){// es un registro nuevo + TcustCompany company = null; + TcustPeople people = null; + if(fotoLogo.getModifiedData().get("DATOASOCIADO") != null && fotoLogo.getModifiedData().get("DATOASOCIADO") instanceof TcustCompany){ + company = (TcustCompany) fotoLogo.getModifiedData().get("DATOASOCIADO"); + } else if(fotoLogo.getModifiedData().get("DATOASOCIADO") != null && fotoLogo.getModifiedData().get("DATOASOCIADO") instanceof TcustPeople){ + people = (TcustPeople) fotoLogo.getModifiedData().get("DATOASOCIADO"); + } + TgeneFiles tgeneFiles = new TgeneFiles(getCode()); + PersistenceHelper.getEntityManager().persist(tgeneFiles); + fotoLogo.setPk(new TgeneFilesDetailKey(tgeneFiles.getPk(), FormatDates.getDefaultExpiryTimestamp())); + fotoLogo.setDatefrom(new Timestamp(System.currentTimeMillis())); + fotoLogo.setName("FOTO"); + fotoLogo.setCapturedate(new java.sql.Date(System.currentTimeMillis())); + fotoLogo.setContenttype("image/jpeg"); + fotoLogo.setDescription("LOGO EMPRESA"); + fotoLogo.setImage(foto); + fotoLogo.setExtension("jpg"); + fotoLogo.setImagesize(foto.length); + PersistenceHelper.getEntityManager().persist(fotoLogo); + System.out.println("INSERTA LA FOTO....."); + //Actualizo en la persona o la compania segun sea el caso + if(company != null){ + company.setLogo(tgeneFiles.getPk()); + PersistenceHelper.getEntityManager().merge(company); + } else if(people != null){ + people.setPhotocode(tgeneFiles.getPk()); + PersistenceHelper.getEntityManager().merge(people); + } + } else{//actualizo el registro anterior y genero el historial + TgeneFilesDetail tgeneFilesDetail = new TgeneFilesDetail(new TgeneFilesDetailKey(fotoLogo.getPk().getCode(), new Timestamp(System.currentTimeMillis()))); + tgeneFilesDetail.setDatefrom(fotoLogo.getDatefrom()); + tgeneFilesDetail.setName(fotoLogo.getName()); + tgeneFilesDetail.setCapturedate(fotoLogo.getCapturedate()); + tgeneFilesDetail.setContenttype(fotoLogo.getContenttype()); + tgeneFilesDetail.setDescription(fotoLogo.getDescription()); + tgeneFilesDetail.setImage(fotoLogo.getImage()); + tgeneFilesDetail.setExtension(fotoLogo.getExtension()); + tgeneFilesDetail.setImagesize(fotoLogo.getImagesize()); + PersistenceHelper.getEntityManager().persist(tgeneFilesDetail); + fotoLogo.setImage(foto); + fotoLogo.setImagesize(foto.length); + PersistenceHelper.getEntityManager().merge(fotoLogo); + System.out.println("ACTUALIZA LA FOTO....."); + } + PersistenceHelper.getEntityManager().flush(); + } + } catch (Throwable e) { + respuesta = "2"; + APPLogger.getLogger().error(e.getMessage(), e); + } + pRequest.getResponse().put("RESPONSESTATUS", respuesta); + return pRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + + /** + * Retorna la foto de la persona si es que esta existe + * @param personDetail + * @return El detalle del achivo imagen que se ha guardado, o un archivo vacío sin pk para que pueda ser guardado en la base de datos + * @throws CommondbException + * @throws Exception + */ + private TgeneFilesDetail obtenerFoto(TcustPersonDetail personDetail) throws CommondbException, Exception{ + TcustCompany company = null; + TcustPeople people = null; + TgeneFilesDetail result = null; + switch(personDetail.getIdentification().length()){ + case 13: + company = TcustCompany.find(PersistenceHelper.getEntityManager(), new TcustCompanyKey(personDetail.getPk().getPersoncode(), FormatDates.getDefaultExpiryTimestamp())); + break; + default: + people = TcustPeople.find(PersistenceHelper.getEntityManager(), new TcustPeopleKey(personDetail.getPk().getPersoncode(), FormatDates.getDefaultExpiryTimestamp())); + break; + } + if(company != null){ + result = TgeneFilesDetail.find(PersistenceHelper.getEntityManager(), new TgeneFilesDetailKey(company.getLogo(), FormatDates.getDefaultExpiryTimestamp())); +// result.getModifiedData().put("DATOASOCIADO", company); + } else if(people != null){ + result = TgeneFilesDetail.find(PersistenceHelper.getEntityManager(), new TgeneFilesDetailKey(people.getPhotocode(), FormatDates.getDefaultExpiryTimestamp())); +// result.getModifiedData().put("DATOASOCIADO", people); + } + if(result == null){ + result = new TgeneFilesDetail(); + } + result.getModifiedData().put("DATOASOCIADO", company != null ? company : people); + return result; + } + + /** + * Retorna el secuencial para ingresar en la tabla {@link TgeneFiles} + * @return + * @throws Exception + */ + private Integer getCode() throws Exception{ + Sequence secuenciaCode = new Sequence(); + return Integer.valueOf(secuenciaCode.getNextValue("CODE").toString()); + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/DocumentoHabilitanteDatos.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/DocumentoHabilitanteDatos.java new file mode 100644 index 0000000..adc62bc --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/DocumentoHabilitanteDatos.java @@ -0,0 +1,126 @@ +package com.fp.armas.rules.save.webservices; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.persistence.Query; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Actualiza los datos del documento habilitante enviado + * @author ndominguez + * + */ +public class DocumentoHabilitanteDatos extends TransactionRule { + + private static final long serialVersionUID = -951465699701916612L; + public static final String QUERY_SOLICITUD_NUM = "SELECT o FROM TarmSolicitud o WHERE o.numerosolicitud=:numerosolicitud"; + @SuppressWarnings("unchecked") + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + System.out.println(".........ACTUALIZA LOS DATOS DEL TARMDOCUMENTOHABILITANTE..................."); + String respuesta = "0"; + try { + String numerosolicitud = (String) pRequest.get("NUMEROSOLICITUD"); + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_SOLICITUD_NUM); + query.setParameter("numerosolicitud", numerosolicitud); + List ltarmSolicitud = query.getResultList(); + if ( ltarmSolicitud != null && !ltarmSolicitud.isEmpty() ) { + TarmSolicitud tarmSolicitud = ltarmSolicitud.iterator().next(); + Query queryDoc = PersistenceHelper.createQuery("SELECT o FROM TarmDocumentoHabilitante o WHERE o.csolicitud=:csolicitud "); + queryDoc.setParameter("csolicitud", tarmSolicitud.getPk()); + List documentoHabilitantes = queryDoc.getResultList(); + if(documentoHabilitantes != null && !documentoHabilitantes.isEmpty()){ + TarmDocumentoHabilitante documentoHabilitante = documentoHabilitantes.iterator().next(); + String fileName = null; + try { + //Se valida que no tenga caracteres especiales + fileName = caractersEspeciales(documentoHabilitante.getNumerodocumento()); + } catch (Exception e) { + respuesta = "2"; + APPLogger.getLogger().error(e.getMessage(), e); + } + if (fileName != null) { + String xpathdocumento = getRutaDocumentoSolBase(documentoHabilitante.getFechaemision(), numerosolicitud, fileName); + documentoHabilitante.setXpath(xpathdocumento); + PersistenceHelper.getEntityManager().merge(documentoHabilitante); + PersistenceHelper.getEntityManager().flush(); + pRequest.getResponse().put("XPATHDOCUMENTOSOLICITUD", documentoHabilitante.getXpath()); + } else { + respuesta = "1"; + } + } else { + respuesta = "1"; + } + } else { + respuesta = "1"; + } + } catch (Throwable e) { + respuesta = "2"; + APPLogger.getLogger().error(e.getMessage(), e); + } + pRequest.getResponse().put("RESPONSESTATUS", respuesta); + return pRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + + /** + * Método que revisa si una cadena tiene caracteres especiales + * @param nombre + * @return + * @throws Exception + */ + public static String caractersEspeciales(String nombre) throws Exception{ + List caracteresEsp=TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(),"CARACTERESPECIAL"); + for(TgeneCatalogDetail caract:caracteresEsp){ + if(nombre.contains(caract.getPk().getCatalog())){ + return null; + } + } + String numero="1234567890"; + if(numero.contains(nombre.substring(0, 1))){ + return null; + } + if(nombre!=null && nombre.trim().contains(" ")){ + return null; + } + if(nombre.length()<9){ + nombre="DOCUMENTO-"+nombre; + } + return nombre; + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + private String getRutaDocumentoSolBase(Date fechaEmision, String numerosolicitud, String numerodocumento) { + StringBuilder ruta = null; + if (fechaEmision != null && numerosolicitud != null + && numerodocumento != null) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(fechaEmision); + ruta = new StringBuilder("cm:Solicitud"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + ruta = ruta.append("/cm:").append(numerosolicitud); + ruta = ruta.append("/cm:").append(numerodocumento+".pdf"); + } + return ruta != null ? ruta.toString() : null; + } + + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/IngresaLectura.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/IngresaLectura.java new file mode 100644 index 0000000..6bcb92d --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/IngresaLectura.java @@ -0,0 +1,127 @@ +package com.fp.armas.rules.save.webservices; + +import java.sql.Timestamp; +import java.util.Date; +import java.util.List; + +import javax.persistence.Query; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.inte.TarmLectura; +import com.fp.persistence.parmas.inte.TarmLecturaDetalle; +import com.fp.persistence.parmas.inte.TarmLecturaDetalleKey; +import com.fp.persistence.parmas.inte.TarmTagArma; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Componente en donde se ingresa las lecturas que provienen del hand held + * @author dcruz + * + */ +public class IngresaLectura extends TransactionRule { + + private static final long serialVersionUID = 8760785038997324400L; + + private static final String QUERY_TAG_ARMA = "SELECT o FROM TarmTagArma o WHERE o.ctag=:codigotag"; + + /** + * Método en el cual se inserta los registros de los dispositivos leidos en la hand held + */ + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + System.out.println("INGRESA A GUARDAR EL TAG........................"+pRequest); + String tagsleidos = (String) pRequest.get("TAGSLECTURA"); + Date fechalectura = (Date) pRequest.get("FECHALECTURA"); + String locacionlectura = (String) pRequest.get("LOCACIONLECTURA"); + String idportal = (String) pRequest.get("IDPORTAL"); + String tipooperacion = (String) pRequest.get("TIPOOPERACION"); + String[] tagleidosArray=null; + if(tagsleidos.contains(",")){ + tagleidosArray = tagsleidos.split(","); + }else{ + tagleidosArray = tagsleidos.split("/"); + } + String direccion = locacionlectura; + guardaLectura(tagleidosArray, fechalectura, direccion, idportal, tipooperacion); + return pRequest; + } + + /** + * Método en el cual guardamos los datos leíidos desde el hand held + * @param tagleidos array de tag leídos del hand held + * @param fechaLectura la fecha en la que se realizó la lectura + * @param countrycode código de país + * @param provincecode código de provincia + * @param cantoncode código de cantón + * @param parroquiacode código de parroquia + * @param idportal id del portal de donde se capturó la lectura + * @param tipooperacion tipo de operació de la lectura si es hand held o si es portal + * @throws Exception + */ + private void guardaLectura(String[] tagleidos, Date fechaLectura, String direccion, String idportal, String tipooperacion) throws Exception{ + TarmLectura tarmLectura = new TarmLectura(); + tarmLectura.setPk(getCodigoLectura()); + tarmLectura.setFecha(new Timestamp(fechaLectura.getTime())); + + System.out.println("direccion ......................."+direccion); + System.out.println(direccion.contains(",")); + if(direccion.contains(",")){ + String[] direccionArray = direccion.split(","); + String provincecode = direccionArray[0]; + tarmLectura.setProvincecode(provincecode); + } + +// tarmLectura.setCountrycode(countrycode); +// tarmLectura.setProvincecode(provincecode); +// tarmLectura.setCantoncode(cantoncode); +// tarmLectura.setParroquiacode(parroquiacode); + tarmLectura.setIdportal(idportal); + tarmLectura.setTipolectura(tipooperacion); + tarmLectura.setTipolecturacode("TIPOLECTURA"); + tarmLectura.setDireccion(direccion); + PersistenceHelper.getEntityManager().persist(tarmLectura); + for (String tag : tagleidos) { +// String carma = getCodigoArmadeTag(tag); + TarmLecturaDetalle tarmLecturaDetalle = new TarmLecturaDetalle(new TarmLecturaDetalleKey(tarmLectura.getPk(), tag)); +// tarmLecturaDetalle.set + PersistenceHelper.getEntityManager().persist(tarmLecturaDetalle); + } + PersistenceHelper.getEntityManager().flush(); + } + + /** + * Retorna el codigo del arma asociada al tag desde TarmTagArma + * @param codigotag + * @return el código del arma relacionada con el tag + */ + @SuppressWarnings("unchecked") + private String getCodigoArmadeTag(String codigotag) throws Exception{ + //tanto el tag como el arma deben estar relacionados entre si, no se puede producir el caso en que un tag este relacionado con mas de un arma y viceversa + String codigoarma = null; + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_TAG_ARMA); + query.setParameter("codigotag", codigotag); + List ltarmTagArmas = query.getResultList(); + if(ltarmTagArmas != null && !ltarmTagArmas.isEmpty()){ + codigoarma = ltarmTagArmas.iterator().next().getPk().getCarma(); + } + return codigoarma; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + + /** + * Retorna el codódigo secuencial de la pk de la tabla {@link TarmLectura} + * @return la secuencia de la tabla {@link TarmLectura} + * @throws Exception + */ + public Long getCodigoLectura() throws Exception { + Sequence sequence = new Sequence(); + return sequence.getNextValue("CLECTURA").longValue(); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/VinculaTagArma.java b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/VinculaTagArma.java new file mode 100644 index 0000000..509f8fd --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/rules/save/webservices/VinculaTagArma.java @@ -0,0 +1,66 @@ +package com.fp.armas.rules.save.webservices; + +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Query; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.inte.TarmTagArma; +import com.fp.persistence.parmas.inte.TarmTagArmaKey; + +/** + * Vinculo un arma con un tag, respondo con un mensaje de validación para mostrar el estado de la petición + * @author dcruz + * + */ +public class VinculaTagArma extends TransactionRule { + + private static final long serialVersionUID = 7380264973023057406L; + private static final String QUERY_TAGARMA = "SELECT o FROM TarmTagArma o WHERE o.pk.carma=:carma"; + + /** + * Respondo con 0 es correcto, 1 el arma ya esta registrada con otro tag, 2 el arma ya ha sido registrada, 3 existió un error + */ + @SuppressWarnings("unchecked") + @Override + public SaveRequest normalProcess(SaveRequest pRequest) throws Exception { + String respuesta; + try { + String carma = (String) pRequest.get("CODIGOARMA"); + String tagArma = (String) pRequest.get("CODIGOTAG"); + TarmTagArma tarmTagArma = PersistenceHelper.getEntityManager().find(TarmTagArma.class, new TarmTagArmaKey(carma, tagArma)); + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_TAGARMA); + query.setParameter("carma", carma); + List ltarmTagArmas = query.getResultList(); + if(tarmTagArma != null){ + respuesta = "2"; + } else if(!ltarmTagArmas.isEmpty()){ + respuesta = "1"; + } else{ + TarmTagArma ptagArma = new TarmTagArma(new TarmTagArmaKey(carma, tagArma)); + ptagArma.setFecha(new Timestamp(System.currentTimeMillis())); + PersistenceHelper.getEntityManager().persist(ptagArma); + PersistenceHelper.getEntityManager().flush(); + respuesta = "0"; + } + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + respuesta = "3"; + } + pRequest.getResponse().put("RESPONSESTATUS", respuesta); + return pRequest; + } + + /** + * Método que se realiza al hacer rollback la transacción + */ + @Override + public SaveRequest reverseProcess(SaveRequest pRequest) throws Exception { + return pRequest; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/entries b/base/business/armas/src/main/java/com/fp/armas/task/.svn/entries new file mode 100644 index 0000000..b2b4b1b --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/entries @@ -0,0 +1,915 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com/fp/armas/task +svn://172.17.26.185/COMACO + + + +2021-05-14T20:43:26.035487Z +4634 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ValidarUnidadInstitucion.java +file + + + + +2022-07-28T03:40:40.664794Z +0404a6fd3c976a417f9898c4f149ae63 +2016-03-18T20:00:59.044078Z +4514 +fpazmino + + + + + + + + + + + + + + + + + + + + + +2308 + +ObtieneCentroControl.java +file + + + + +2022-07-28T03:40:40.665794Z +4d1e7566fac06e39962905bd94c0cde2 +2014-12-08T13:24:01.459631Z +3348 +cpiedra + + + + + + + + + + + + + + + + + + + + + +2084 + +FinalizarDocumentoHabilitante.java +file + + + + +2022-07-28T03:40:40.665794Z +ebd9a793608d8fc023afc4c1ca81d2ca +2015-03-25T04:26:25.168873Z +3966 +cpiedra + + + + + + + + + + + + + + + + + + + + + +2731 + +EmitirComprobanteCaja.java +file + + + + +2022-07-28T03:40:40.665794Z +18a020b985d20e039d6652932ab62657 +2014-10-27T10:07:51.561737Z +2001 +fpazmino + + + + + + + + + + + + + + + + + + + + + +5205 + +ValidaFlujoCargaDeposito.java +file + + + + +2022-07-28T03:40:40.665794Z +510292a6a8037b438266b3faa80e31b9 +2015-07-09T13:24:12.990058Z +4185 +cpiedra + + + + + + + + + + + + + + + + + + + + + +1872 + +ActualizarRutaArchivo.java +file + + + + +2022-07-28T03:40:40.666794Z +4f2d11867531b19f4b81d98bca11bb44 +2015-03-25T04:26:25.168873Z +3966 +cpiedra + + + + + + + + + + + + + + + + + + + + + +1510 + +TramiteAnulado.java +file + + + + +2022-07-28T03:40:40.666794Z +3e6ab76765acddb065906b91910ac9d7 +2014-12-16T10:23:44.143875Z +3539 +cpiedra + + + + + + + + + + + + + + + + + + + + + +2042 + +ValidaInspeccion.java +file + + + + +2022-07-28T03:40:40.666794Z +4e7a89a729b258a7776efca3d20bd002 +2014-12-09T06:02:23.952318Z +3359 +cpiedra + + + + + + + + + + + + + + + + + + + + + +1940 + +ObtienerCategoriaTramite.java +file + + + + +2022-07-28T03:40:40.666794Z +0da9170258f44f9bd9d6cabdaece26fd +2014-10-27T11:24:57.428689Z +2003 +cpiedra + + + + + + + + + + + + + + + + + + + + + +2701 + +TramiteAprobado.java +file + + + + +2022-07-28T03:40:40.667794Z +e600dafbaf154ce093dbc8cbe8392886 +2014-12-16T10:23:44.143875Z +3539 +cpiedra + + + + + + + + + + + + + + + + + + + + + +1937 + +ValAutorizacionPreviaImporta.java +file + + + + +2022-07-28T03:40:40.667794Z +6b15254778b96f59e89b9e076a8b64bb +2014-12-23T07:57:08.583476Z +3637 +cpiedra + + + + + + + + + + + + + + + + + + + + + +1948 + +ActualizarPlanificacion.java +file + + + + +2022-07-28T03:40:40.667794Z +12c126df1943ea9b89cf9420a3267b7f +2014-11-14T09:15:57.327220Z +2795 +cpiedra + + + + + + + + + + + + + + + + + + + + + +1442 + +ValidarCustodios.java +file + + + + +2022-07-28T03:40:40.667794Z +e4577bcb0b58d25c72eef116498e8704 +2016-02-02T22:27:59.965868Z +4425 +fpazmino + + + + + + + + + + + + + + + + + + + + + +2182 + +ValidacionGrupoDecRecep.java +file + + + + +2022-07-28T03:40:40.668794Z +09d5477a78107a43fc855c047fbb9d18 +2015-02-20T10:59:05.489563Z +3828 +cpiedra + + + + + + + + + + + + + + + + + + + + + +4013 + +GenerarValorACancelar.java +file + + + + +2022-07-28T03:40:40.668794Z +e0aaf03234b876a2cae8f8c593d0ecff +2014-10-27T05:50:22.203219Z +1969 +fpazmino + + + + + + + + + + + + + + + + + + + + + +1340 + +AplicarSancion.java +file + + + + +2022-07-28T03:40:40.668794Z +88c4584e74b27c1eee157cbdcb601bfc +2016-02-18T13:54:57.622129Z +4460 +cvasquez + + + + + + + + + + + + + + + + + + + + + +3185 + +ValidacionGrupo.java +file + + + + +2022-07-28T03:40:40.668794Z +e0e1feffe1f4ae8d3ae48c4a03026ba6 +2015-01-29T14:23:08.770684Z +3821 +cpiedra + + + + + + + + + + + + + + + + + + + + + +3177 + +VerificarCantidadArmas.java +file + + + + +2022-07-28T03:40:40.669794Z +d6261b69245c7250ed1e0e474251a7e9 +2015-06-13T05:26:41.265293Z +4100 +cpiedra + + + + + + + + + + + + + + + + + + + + + +2109 + +TipoArchivoControl.java +file + + + + +2022-07-28T03:40:40.669794Z +af01edaebc03f54020c9407a86857588 +2016-01-15T17:41:51.430820Z +4381 +fpazmino + + + + + + + + + + + + + + + + + + + + + +2293 + +RechazarActa.java +file + + + + +2022-07-28T03:40:40.669794Z +ab98bfc57feacb01aa37a512a7ef00b0 +2016-04-21T22:25:32.078933Z +4540 +cvasquez + + + + + + + + + + + + + + + + + + + + + +2459 + +TipoDocumento.java +file + + + + +2022-07-28T03:40:40.669794Z +bf2b7d590b6cc7123dd638c31ca7be07 +2014-11-20T05:23:08.199256Z +2993 +cpiedra + + + + + + + + + + + + + + + + + + + + + +2072 + +FechaCaducidadEstadoArma.java +file + + + + +2022-07-28T03:40:40.670794Z +5b42868a9a8e48834bc7a60af2e9d425 +2021-05-14T20:43:26.035487Z +4634 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +4296 + +traspasodominio +dir + +RequiereInspeccion.java +file + + + + +2022-07-28T03:40:40.670794Z +621079d172c164bde5c82c6ee9eef795 +2014-12-02T14:45:29.324656Z +3253 +cpiedra + + + + + + + + + + + + + + + + + + + + + +2030 + +ValidacionDecomiso.java +file + + + + +2022-07-28T03:40:40.670794Z +aea8c72566d4717ba5f31e25b67bb3d9 +2014-12-24T06:15:00.581851Z +3644 +cpiedra + + + + + + + + + + + + + + + + + + + + + +1623 + +ActualizarInventario.java +file + + + + +2022-07-28T03:40:40.671794Z +10f4d511efb8c802493ad54957546218 +2014-10-18T06:57:50.144647Z +1703 +cpiedra + + + + + + + + + + + + + + + + + + + + + +2461 + +ActualizarInventBajaDestrucc.java +file + + + + +2022-07-28T03:40:40.671794Z +27dd348a6a99152ccd976996ce0d9bfb +2015-06-27T13:42:18.237444Z +4143 +fpazmino + + + + + + + + + + + + + + + + + + + + + +6809 + diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ActualizarInventBajaDestrucc.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ActualizarInventBajaDestrucc.java.svn-base new file mode 100644 index 0000000..ce6faaf --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ActualizarInventBajaDestrucc.java.svn-base @@ -0,0 +1,142 @@ +package com.fp.armas.task; + +import java.sql.Timestamp; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmBodega; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDetRepDestruirArmas; +import com.fp.persistence.parmas.soli.TarmTransaccionArmaBodega; +import com.fp.sessionbeans.helper.Sequence; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de empleado asociado a la solicitud en el request campo userId, para asignar + * una tarea. + * + * @version 2.1 + */ +public class ActualizarInventBajaDestrucc extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + EntityManager em=PersistenceHelper.getEntityManager(); + System.out.println("Rutina que actualiza el inventario despues de que se ha autorizado destruir armas"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("creporte") == null) { + return; + } + Integer creporte=Integer.parseInt(mrequest.get("creporte").toString()); + + //lista de las armas decomisadas que se encuentran en el reporte + List tarmDetRepDestruirArmasList= em. + createQuery("select t from TarmDetRepDestruirArmas t where t.creporte=:creporte") + .setParameter("creporte", creporte) + .getResultList(); + //Se recorre la lista de las armas del reporte de destruccion + for(TarmDetRepDestruirArmas detArmaObj:tarmDetRepDestruirArmasList){ + //Actualizo el estado del registro tarmDecomisoArma + + TarmDecomisoArma decomisoArmaObj = (TarmDecomisoArma) em.createQuery("select t from TarmDecomisoArma t where t.pk=:pk") + .setParameter("pk", detArmaObj.getCdecomisoarma()) + .getResultList().get(0); + decomisoArmaObj.setEstado("DEST"); + em.merge(decomisoArmaObj); + //Actualizo el estado del registro tarmArma + TarmArmas armaObjAnterior = (TarmArmas) em.createQuery("select t from TarmArmas t where t.pk=:pk") + .setParameter("pk", decomisoArmaObj.getCarma()) + .getResultList().get(0); + TarmArmas armaObj = new TarmArmas(); + armaObj.setCantidad(armaObjAnterior.getCantidad()); + armaObj.setCantoncode(armaObjAnterior.getCantoncode()); + armaObj.setCitycode(armaObjAnterior.getCitycode()); + armaObj.setCodigoarma(armaObjAnterior.getCodigoarma()); + armaObj.setColor(armaObjAnterior.getColor()); + armaObj.setColorcodigo(armaObjAnterior.getColorcodigo()); + armaObj.setCountrycode(armaObjAnterior.getCountrycode()); + armaObj.setCpaisorigen(armaObjAnterior.getCpaisorigen()); + armaObj.setCregistro(armaObjAnterior.getCregistro()); + armaObj.setCtipoarmaexplosivo(armaObjAnterior.getCtipoarmaexplosivo()); + armaObj.setDireccion(armaObjAnterior.getDireccion()); + armaObj.setEstado("DEST"); + armaObj.setEstadocodigo("ESTADOARMA"); +// Timestamp timeStamp = new Timestamp(System.currentTimeMillis()); +// armaObj.setFecharegistro(timeStamp); + armaObj.setFemisionpermiso(armaObjAnterior.getFemisionpermiso()); + armaObj.setLote(armaObjAnterior.getLote()); + armaObj.setMarca(armaObjAnterior.getMarca()); + armaObj.setMarcacodigo(armaObjAnterior.getMarcacodigo()); + armaObj.setModelo(armaObjAnterior.getModelo()); + armaObj.setNemonicoarma(armaObjAnterior.getNemonicoarma()); + armaObj.setParroquiacode(armaObjAnterior.getParroquiacode()); + armaObj.setPeso(armaObjAnterior.getPeso()); + armaObj.setPesoAux(armaObjAnterior.getPesoAux()); + armaObj.setProvincecode(armaObjAnterior.getProvincecode()); + armaObj.setSeriecanon(armaObjAnterior.getSeriecanon()); + armaObj.setTipofabricacion(armaObjAnterior.getTipofabricacion()); + armaObj.setTipofabricacioncodigo(armaObjAnterior.getTipofabricacioncodigo()); + armaObj.setUnidadmedidacantidad(armaObjAnterior.getUnidadmedidacantidad()); + armaObj.setUnidadmedidacantidadcodigo(armaObjAnterior.getUnidadmedidacantidadcodigo()); + armaObj.setValorAux(armaObjAnterior.getValorAux()); + armaObj.setPk(getCodigoArma().toString()); + em.persist(armaObj); + + // Actualizar en TARMBODEGA el centro de control para el arma destruida + TarmBodega bodegaArmaObj = (TarmBodega) em.createQuery("select t from TarmBodega t where t.carma=:carma") + .setParameter("carma", decomisoArmaObj.getCarma()) + .getResultList().get(0); + if(bodegaArmaObj!=null){ + bodegaArmaObj.setCcentrocontrol(null); + em.merge(decomisoArmaObj); + }else{ + TarmBodega bodegaObj = new TarmBodega(); + bodegaObj.setPk(getCodigoBodega()); + bodegaObj.setCarma(decomisoArmaObj.getCarma()); + em.persist(bodegaObj); + } + // Inserta registro en transaccion Arma Bodega + TarmTransaccionArmaBodega tranArmaBodegaObj = new TarmTransaccionArmaBodega(); + tranArmaBodegaObj.setPk(getCTransArmaBodega()); + tranArmaBodegaObj.setCarma(decomisoArmaObj.getCarma()); + tranArmaBodegaObj.setOperacion("DESTRUCCION"); + tranArmaBodegaObj.setOperacioncode("OPERACIONDECOMISO"); + tranArmaBodegaObj.setCcentrocontrolorigen("DPTOARMASPICH"); + tranArmaBodegaObj.setFecha(new Timestamp(new Date().getTime())); + em.persist(tranArmaBodegaObj); + } + em.flush(); + } + + private String getCodigoArma() throws Exception{ + Sequence sequence = new Sequence(); + String carma = sequence.getNextValue("CARMA").toString(); + return carma; + } + + private Long getCodigoBodega() throws Exception{ + Sequence sequence = new Sequence(); + Integer cbodega = sequence.getNextValue("CBODEGA").intValue(); + return new Long(cbodega); + } + + private Long getCTransArmaBodega() throws Exception{ + Sequence sequence = new Sequence(); + Integer cTransArmaBodega = sequence.getNextValue("CTRANARMBODEGA").intValue(); + return new Long(cTransArmaBodega); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ActualizarInventario.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ActualizarInventario.java.svn-base new file mode 100644 index 0000000..3192bbd --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ActualizarInventario.java.svn-base @@ -0,0 +1,54 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de empleado asociado a la solicitud en el request campo userId, para asignar + * una tarea. + * + * @version 2.1 + */ +public class ActualizarInventario extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + + System.out.println("ingresa a actualizar a la clase"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("numerotransaccion") == null) { + return; + } + Long numeroTransacion=Long.parseLong(mrequest.get("numerotransaccion").toString()); + //datos de la transaccion + TarmDecomisoArmaTransaccion tarmDecomisoArmaTransaccion=TarmDecomisoArmaTransaccion.find(PersistenceHelper.getEntityManager(), numeroTransacion); + //lista de las armas decomisadas por el codigo de recepcion + List tarmDecomisoArmaTransaccionList= PersistenceHelper.getEntityManager(). + createQuery("select o from TarmDecomisoArma o where o.cdecarmtranrecepcion=:cdecarmtranrecepcion") + .setParameter("cdecarmtranrecepcion", numeroTransacion) + .getResultList(); + //se recorre la lista de las armas decomisadas + for(TarmDecomisoArma decomisoArma:tarmDecomisoArmaTransaccionList){ + //se busca l tabla de decomiso para actualizar el campo del centro de control que esta recibiendo las armas + TarmDecomiso decomiso= TarmDecomiso.find(PersistenceHelper.getEntityManager(), decomisoArma.getCdecomiso()); + decomiso.setCcentrocontroldestino(tarmDecomisoArmaTransaccion.getCcentrocontrol()); + PersistenceHelper.getEntityManager().merge(decomiso); + } + PersistenceHelper.getEntityManager().flush(); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ActualizarPlanificacion.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ActualizarPlanificacion.java.svn-base new file mode 100644 index 0000000..08374cd --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ActualizarPlanificacion.java.svn-base @@ -0,0 +1,41 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.ins.TarmPlanificacionInspeccion; +import com.fp.simple.action.TaskAction; + +/** + * Clase para actualizar la planificacion + * una tarea. + * + * @version 2.1 + */ +public class ActualizarPlanificacion extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + + System.out.println("ingresa a actualizar a la clase"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("cplanificacion") == null) { + return; + } + Long numeroTransacion=Long.parseLong(mrequest.get("cplanificacion").toString()); + TarmPlanificacionInspeccion planificacionInspeccion= TarmPlanificacionInspeccion.find(PersistenceHelper.getEntityManager(), numeroTransacion); + planificacionInspeccion.setAprobada(m.get("respuesta").toString()); + PersistenceHelper.getEntityManager().merge(planificacionInspeccion); + //datos de la transaccion + PersistenceHelper.getEntityManager().flush(); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ActualizarRutaArchivo.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ActualizarRutaArchivo.java.svn-base new file mode 100644 index 0000000..cf304f1 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ActualizarRutaArchivo.java.svn-base @@ -0,0 +1,43 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.simple.action.TaskAction; + +/** + * C.P + * Clase para actulaizar la ruta del archivo + * + * @version 2.1 + */ +public class ActualizarRutaArchivo extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("numerotransaccion") == null) { + return; + } + Long numeroTransacion=Long.parseLong(mrequest.get("numerotransaccion").toString()); + //datos de la transaccion + TarmDecomisoArmaTransaccion tarmDecomisoArmaTransaccion=TarmDecomisoArmaTransaccion.find(PersistenceHelper.getEntityManager(), numeroTransacion); + if(mrequest.get("xpath")!=null){ + tarmDecomisoArmaTransaccion.setXpath(mrequest.get("xpath").toString()); + tarmDecomisoArmaTransaccion.setEstadoflujo("ENV"); + } + PersistenceHelper.getEntityManager().merge(tarmDecomisoArmaTransaccion); + PersistenceHelper.getEntityManager().flush(); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/AplicarSancion.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/AplicarSancion.java.svn-base new file mode 100644 index 0000000..848b24b --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/AplicarSancion.java.svn-base @@ -0,0 +1,71 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el valor de deposito para la solicitud + * @author Christian Pazmino + * @version 2.1 + */ +public class AplicarSancion extends TaskAction { + + /* + * (non-Javadoc) + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + System.out.println("Rutina que determina si es un CENTRO DE CONTROL y hay al menos un arma en estado RECLAMADO"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("numerotransaccion") == null) { + return; + } + // DETERMINA SI SE DEBE O NO APLICAR LA SANCION + Boolean aplicarSancionBLN = Boolean.FALSE; + EntityManager em = PersistenceHelper.getEntityManager(); + TarmDecomisoArmaTransaccion decomisoArmaTransaccionObj = TarmDecomisoArmaTransaccion.find(PersistenceHelper.getEntityManager(), Long.parseLong(mrequest.get("numerotransaccion").toString())); + if(decomisoArmaTransaccionObj!=null){ + TarmCentroControl centroControlObj = TarmCentroControl.find(em, decomisoArmaTransaccionObj.getCcentrocontrol()); + if(centroControlObj!=null){ + TgeneCatalogDetailKey pk = new TgeneCatalogDetailKey(centroControlObj.getNombreinstitucion(), centroControlObj.getNombreinstitucioncodigo()); + TgeneCatalogDetail unidadCD = TgeneCatalogDetail.find(em, pk); + // SI ES UN DEPARTAMENTO DE CONTROL DE ARMAS, Y ES UN CENTRO DE CONTROL DE ARMAS + if(centroControlObj.getInstitucion().equals("1")&& unidadCD.getDescription().contains("CENTRO CONTROL DE ARMAS")){ + Long numeroTransacion=Long.parseLong(mrequest.get("numerotransaccion").toString()); + //lista de las armas decomisadas por el codigo de recepcion + List lArmasRecibidas= em.createQuery("select o from TarmDecomisoArma o where o.cdecarmtranrecepcion=:cdecarmtranrecepcion") + .setParameter("cdecarmtranrecepcion", numeroTransacion).getResultList(); + + for(TarmDecomisoArma decomisoArma:lArmasRecibidas){ + if("RECL".equals(decomisoArma.getEstado())){ + aplicarSancionBLN = Boolean.TRUE; + break; + } + } + } + } + } + if(aplicarSancionBLN){ + m.put("BPMStatus","A"); + } + else{ + m.put("BPMStatus","D"); + } + + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/EmitirComprobanteCaja.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/EmitirComprobanteCaja.java.svn-base new file mode 100644 index 0000000..4f3bd28 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/EmitirComprobanteCaja.java.svn-base @@ -0,0 +1,103 @@ +package com.fp.armas.task; + +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDetRepDestruirArmas; +import com.fp.sessionbeans.helper.Sequence; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de empleado asociado a la solicitud en el request campo userId, para asignar + * una tarea. + * + * @version 2.1 + */ +public class EmitirComprobanteCaja extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + + System.out.println("**** Emitir Comprobante De Caja ****"); +// HashMap m = (HashMap) pParam; +// Map mrequest = (Map) m.get("request"); +// if (mrequest.get("creporte") == null) { +// return; +// } +// Integer creporte=Integer.parseInt(mrequest.get("creporte").toString()); +// +// //lista de las armas decomisadas que se encuentran en el reporte +// List tarmDetRepDestruirArmasList= PersistenceHelper.getEntityManager(). +// createQuery("select t from TarmDetRepDestruirArmas t where t.creporte=:creporte") +// .setParameter("creporte", creporte) +// .getResultList(); +// //Se recorre la lista de las armas del reporte de destruccion +// for(TarmDetRepDestruirArmas detArmaObj:tarmDetRepDestruirArmasList){ +// //Actualizo el estado del registro tarmDecomisoArma +// +// TarmDecomisoArma decomisoArmaObj = (TarmDecomisoArma) PersistenceHelper.getEntityManager().createQuery("select t from TarmDecomisoArma t where t.pk=:pk") +// .setParameter("pk", detArmaObj.getCdecomisoarma()) +// .getResultList().get(0); +// decomisoArmaObj.setEstado("DEST"); +// PersistenceHelper.getEntityManager().merge(decomisoArmaObj); +// //Actualizo el estado del registro tarmArma +// TarmArmas armaObjAnterior = (TarmArmas) PersistenceHelper.getEntityManager().createQuery("select t from TarmArmas t where t.pk=:pk") +// .setParameter("pk", decomisoArmaObj.getCarma()) +// .getResultList().get(0); +// TarmArmas armaObj = new TarmArmas(); +// armaObj.setCantidad(armaObjAnterior.getCantidad()); +// armaObj.setCantoncode(armaObjAnterior.getCantoncode()); +// armaObj.setCitycode(armaObjAnterior.getCitycode()); +// armaObj.setCodigoarma(armaObjAnterior.getCodigoarma()); +// armaObj.setColor(armaObjAnterior.getColor()); +// armaObj.setColorcodigo(armaObjAnterior.getColorcodigo()); +// armaObj.setCountrycode(armaObjAnterior.getCountrycode()); +// armaObj.setCpaisorigen(armaObjAnterior.getCpaisorigen()); +// armaObj.setCregistro(armaObjAnterior.getCregistro()); +// armaObj.setCtipoarmaexplosivo(armaObjAnterior.getCtipoarmaexplosivo()); +// armaObj.setDireccion(armaObjAnterior.getDireccion()); +// armaObj.setEstado("DEST"); +// armaObj.setEstadocodigo("ESTADOARMA"); +//// Timestamp timeStamp = new Timestamp(System.currentTimeMillis()); +//// armaObj.setFecharegistro(timeStamp); +// armaObj.setFemisionpermiso(armaObjAnterior.getFemisionpermiso()); +// armaObj.setLote(armaObjAnterior.getLote()); +// armaObj.setMarca(armaObjAnterior.getMarca()); +// armaObj.setMarcacodigo(armaObjAnterior.getMarcacodigo()); +// armaObj.setModelo(armaObjAnterior.getModelo()); +// armaObj.setNemonicoarma(armaObjAnterior.getNemonicoarma()); +// armaObj.setParroquiacode(armaObjAnterior.getParroquiacode()); +// armaObj.setPeso(armaObjAnterior.getPeso()); +// armaObj.setPesoAux(armaObjAnterior.getPesoAux()); +// armaObj.setProvincecode(armaObjAnterior.getProvincecode()); +// armaObj.setSeriecanon(armaObjAnterior.getSeriecanon()); +// armaObj.setTipofabricacion(armaObjAnterior.getTipofabricacion()); +// armaObj.setTipofabricacioncodigo(armaObjAnterior.getTipofabricacioncodigo()); +// armaObj.setUnidadmedidacantidad(armaObjAnterior.getUnidadmedidacantidad()); +// armaObj.setUnidadmedidacantidadcodigo(armaObjAnterior.getUnidadmedidacantidadcodigo()); +// armaObj.setValorAux(armaObjAnterior.getValorAux()); +// armaObj.setPk(getCodigoArma().toString()); +// PersistenceHelper.getEntityManager().persist(armaObj); +// } +// PersistenceHelper.getEntityManager().flush(); + } + +// private Integer getCodigoArma() throws Exception{ +// Sequence sequence = new Sequence(); +// Integer carma = sequence.getNextValue("CARMA").intValue(); +// return carma; +// } + + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/FechaCaducidadEstadoArma.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/FechaCaducidadEstadoArma.java.svn-base new file mode 100644 index 0000000..aa74366 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/FechaCaducidadEstadoArma.java.svn-base @@ -0,0 +1,93 @@ +package com.fp.armas.task; + +import java.sql.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.inte.TarmColadeImpresion; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudTramiteKey; +import com.fp.sessionbeans.helper.Sequence; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo del tipo de archivo + * + * @version 2.1 + */ +public class FechaCaducidadEstadoArma extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + System.out.println("SOLICITUD : "+mrequest.get("csolicitud")); + System.out.println("NUMERO DE TRANSACCION: "+mrequest.get("numerotransaccion")); + if (mrequest.get("csolicitud") == null || mrequest.get("numerotransaccion") == null) { + return; + } + EntityManager em = PersistenceHelper.getEntityManager(); + TarmSolicitudTramiteKey codigoSolicitudKey = new TarmSolicitudTramiteKey(); + codigoSolicitudKey.setCsolicitud(mrequest.get("csolicitud").toString()); + codigoSolicitudKey.setCtramite(Long.valueOf(mrequest.get("numerotransaccion").toString())); + TarmSolicitudTramite solicitudTramite=TarmSolicitudTramite.find(em, codigoSolicitudKey); + + TarmTramite tramite = TarmTramite.find(em, solicitudTramite.getPk().getCtramite()); + if(!tramite.getTipoautorizacion().equals("6")){// diferente 6 TIPOAUTORIZACION 0 PERMISO + return; + } + + System.out.println("select o from TarmDocumentoHabilitante o where o.csolicitud=:csolicitud" + mrequest.get("csolicitud").toString()); + List documentoHab= em.createQuery("select o from TarmDocumentoHabilitante o where o.csolicitud=:csolicitud",TarmDocumentoHabilitante.class) + .setParameter("csolicitud", mrequest.get("csolicitud").toString()). + getResultList(); + System.out.println("............................"+documentoHab.size()); + + List tarmArmas = em. + createQuery("select o from TarmArmas o where o.pk in (select p.pk.carma from TarmSolicitudArmas p where p.pk.csolicitud=:csolicitud)",TarmArmas.class) + .setParameter("csolicitud",mrequest.get("csolicitud").toString()) + .getResultList(); + System.out.println("............................"+tarmArmas.size()); + + for (TarmDocumentoHabilitante itemDocHab : documentoHab) { + StringBuilder sqlColaImpresion= new StringBuilder("select c from TarmColadeImpresion c where c.cdocumento ="+itemDocHab.getPk()); + ListlistaColaImpresion= em.createQuery(sqlColaImpresion.toString(),TarmColadeImpresion.class).getResultList(); + if(listaColaImpresion!=null && listaColaImpresion.size()>0){ + for (TarmColadeImpresion itemColaImp : listaColaImpresion) { + itemColaImp.setEstadoimpresion("PIMPR"); + itemColaImp.setEstadoimpresioncode("ESTADOIMPRESION"); + em.merge(itemColaImp); + em.flush(); + } + } + } + + for(TarmArmas arma:tarmArmas){ + arma.setPk(this.getCodigoArma()); + arma.setFechacaducidad(documentoHab.get(0).getFechaexpiracion()); + arma.setFecharegistro(new Date(System.currentTimeMillis())); + em.clear(); + em.persist(arma); + em.flush(); + } + } + + private String getCodigoArma() throws Exception{ + Sequence sequence = new Sequence(); + String carma = sequence.getNextValue("CARMA").toString(); + return carma; + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/FinalizarDocumentoHabilitante.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/FinalizarDocumentoHabilitante.java.svn-base new file mode 100644 index 0000000..94a09e3 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/FinalizarDocumentoHabilitante.java.svn-base @@ -0,0 +1,59 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.simple.action.TaskAction; + +public class FinalizarDocumentoHabilitante extends TaskAction { + + private EntityManager em; + + private static final String QUERY_DOCUMENTOS_ACTUALIZAR = "SELECT p from TarmDocumentoHabilitante p where p.ctramite in (SELECT o.ctramitepadre FROM TarmTramite o WHERE o.pk=:codigotramite) and p.estado <> 'FIN' order by p.fechaemision desc"; + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null && mrequest.get("numerotransaccion") == null) { //mrequest.get("numerotransaccion") + return; + } + em=PersistenceHelper.getEntityManager(); + //String csolicitud = (String)mrequest.get("csolicitud"); + Long ctramite = (Long)mrequest.get("numerotransaccion"); + + //TarmSolicitudTramiteKey codigoSolicitudKey = new TarmSolicitudTramiteKey(csolicitud, ctramite); + //TarmSolicitudTramite solicitudTramite=TarmSolicitudTramite.find(em, codigoSolicitudKey); + TarmDocumentoHabilitante documentoHabilitante= getCodigoDocumentoHabilitanteFinalizar(ctramite); +// if(documentoHabilitante!=null){ +// documentoHabilitante.setEstado("FIN"); +// em.merge(documentoHabilitante); +// em.flush(); +// } + } + + private TarmDocumentoHabilitante getCodigoDocumentoHabilitanteFinalizar(Long codigotramite) throws Exception{ + //tanto el tag como el arma deben estar relacionados entre si, no se puede producir el caso en que un tag este relacionado con mas de un arma y viceversa + TarmDocumentoHabilitante codigoDocumentohabilitanteActualizar = null; + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_DOCUMENTOS_ACTUALIZAR); + query.setParameter("codigotramite", codigotramite); + List ltDocumentosHabilitantesSeleccionados = query.getResultList(); + if(ltDocumentosHabilitantesSeleccionados != null && !ltDocumentosHabilitantesSeleccionados.isEmpty()){ + codigoDocumentohabilitanteActualizar = ltDocumentosHabilitantesSeleccionados.get(0); + } + return codigoDocumentohabilitanteActualizar; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/GenerarValorACancelar.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/GenerarValorACancelar.java.svn-base new file mode 100644 index 0000000..9caac29 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/GenerarValorACancelar.java.svn-base @@ -0,0 +1,44 @@ +package com.fp.armas.task; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; + +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el valor de deposito para la solicitud + * @author Christian Pazmino + * @version 2.1 + */ +public class GenerarValorACancelar extends TaskAction { + + /* + * (non-Javadoc) + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + System.out.println("Rutina que genera el valor de deposito"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return; + } + Mapdatosmail = (Map) m.get("datosmail"); + BigDecimal costoTramite = new BigDecimal("0"); + if(datosmail!=null && datosmail.get("costoTramite")!=null){ + costoTramite = (BigDecimal) datosmail.get("costoTramite"); + } + + if(costoTramite.compareTo(new BigDecimal("0"))!=0){ + m.put("BPMStatus","A"); + } + else{ + m.put("BPMStatus","D"); + } + + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ObtieneCentroControl.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ObtieneCentroControl.java.svn-base new file mode 100644 index 0000000..d8e7b1b --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ObtieneCentroControl.java.svn-base @@ -0,0 +1,52 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de empleado asociado a la solicitud en el request campo userId, para asignar + * una tarea. + * + * @version 2.1 + */ +public class ObtieneCentroControl extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + + System.out.println("ingresa a actualizar a la clase"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + + if (mrequest.get("ccentrocontrol") == null) { + return; + } + String codigoCentroControl=mrequest.get("ccentrocontrol").toString(); + //datos del decomiso + //consulta del centro de control + TarmCentroControl centroControl=TarmCentroControl.find(PersistenceHelper.getEntityManager(), codigoCentroControl); + //lista de las armas decomisadas por el codigo de recepcion + TgeneCatalogDetail tgeneCatalogDetail = PersistenceHelper.getEntityManager(). + createQuery("select o from TgeneCatalogDetail o where o.pk.catalog=:catalog and o.pk.catalogcode=:catalogcode",TgeneCatalogDetail.class) + .setParameter("catalog", centroControl.getInstitucion()) + .setParameter("catalogcode", centroControl.getInstituciontipo()) + .getSingleResult(); + if(!tgeneCatalogDetail.getLegalcode().equals("C")){ + m.put("corganismo","D"); + return; + } + m.put("corganismo",tgeneCatalogDetail.getLegalcode()); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ObtienerCategoriaTramite.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ObtienerCategoriaTramite.java.svn-base new file mode 100644 index 0000000..a1ae5cd --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ObtienerCategoriaTramite.java.svn-base @@ -0,0 +1,65 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de empleado asociado a la solicitud en el request campo userId, para asignar + * una tarea. + * + * @version 2.1 + */ +public class ObtienerCategoriaTramite extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + + System.out.println("csolicitud"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + + if (mrequest.get("csolicitud") == null) { + return; + } + TgeneParametersKey key= new TgeneParametersKey(); + key.setCode("CODIGO.CATEGORIA.IMPORTADOR"); + key.setCompanycode(1); + TgeneParameters parameters= TgeneParameters.find(PersistenceHelper.getEntityManager(), key); + String csolicitud=mrequest.get("csolicitud").toString(); + //datos del decomiso + //consulta del centro de control + TarmSolicitud solicitud=TarmSolicitud.find(PersistenceHelper.getEntityManager(), csolicitud); + //lista de las armas decomisadas por el codigo de recepcion + TarmTramite tarmTramite = PersistenceHelper.getEntityManager(). + createQuery("select o from TarmTramite o where o.pk=:ctramite",TarmTramite.class) + .setParameter("ctramite", solicitud.getCtramite()) + .getSingleResult(); + TgeneCatalogDetailKey pKey= new TgeneCatalogDetailKey(); + pKey.setCatalog(tarmTramite.getCategoria()); + pKey.setCatalogcode(tarmTramite.getCategoriacodigo()); + TgeneCatalogDetail catalogDetail=TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), pKey); + if(catalogDetail.getPk().getCatalog().equals(parameters.getTextvalue())){ + m.put("importacion","A"); + }else{ + m.put("importacion","D"); + } + + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/RechazarActa.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/RechazarActa.java.svn-base new file mode 100644 index 0000000..8872430 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/RechazarActa.java.svn-base @@ -0,0 +1,67 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmBodega; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de setear a nulos aquellas armas que recibieron asignacion de codigos + * + */ +public class RechazarActa extends TaskAction { + private static String SQL = "select o from TarmBodega o where o.pk in (select max(t.pk) from TarmBodega t where t.carma=:ccarma and t.ccentrocontrol=:ccentrocontrol) order by o.carma"; + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + Long numeroTransacion=Long.parseLong(mrequest.get("numerotransaccion").toString()); + if (numeroTransacion == null) { + return; + } + + List lstDecomisoArma = PersistenceHelper.getEntityManager(). + createQuery("select o from TarmDecomisoArma o where o.cdecomisoarmatransaccion=:decomiso",TarmDecomisoArma.class) + .setParameter("decomiso", numeroTransacion).getResultList(); + + for(TarmDecomisoArma decomisoArma:lstDecomisoArma){ + bodegaEliminar(numeroTransacion, decomisoArma.getCarma()); + decomisoArma.setCdecomisoarmatransaccion(null); + PersistenceHelper.saveOrUpdate(decomisoArma); + + } + + } + + /** + * @param ccentrocontrol + * @param decomisoArma + */ + private void bodegaEliminar(Long numeroTransacion, + String carma) throws Exception { + TarmDecomisoArmaTransaccion tarmDecomisoArmaTransaccion = TarmDecomisoArmaTransaccion + .find(PersistenceHelper.getEntityManager(), numeroTransacion); + + String ccentrocontrol = tarmDecomisoArmaTransaccion.getCcentrocontrol(); + TarmBodega tarmBodegas = (TarmBodega) PersistenceHelper + .getEntityManager().createQuery(SQL) + .setParameter("ccentrocontrol", ccentrocontrol) + .setParameter("ccarma", carma) + .getSingleResult(); + PersistenceHelper.getEntityManager().remove(tarmBodegas); + PersistenceHelper.getEntityManager().flush(); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/RequiereInspeccion.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/RequiereInspeccion.java.svn-base new file mode 100644 index 0000000..e928854 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/RequiereInspeccion.java.svn-base @@ -0,0 +1,55 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.armas.rules.exception.ControlArmasException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudTramiteKey; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de anular el tramite + * c.p + * @version 2.1 + */ +public class RequiereInspeccion extends TaskAction { + + private EntityManager em; + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null && mrequest.get("numerotransaccion") == null) { //mrequest.get("numerotransaccion") + return; + } + em=PersistenceHelper.getEntityManager(); + String csolicitud = (String)mrequest.get("csolicitud"); + Long ctramite = (Long)mrequest.get("numerotransaccion"); + + TarmTramite tramite=TarmTramite.find(em, ctramite); + System.out.println("Requiere Inspeccion :"+tramite.getRequiereinspeccion()); + if(tramite.getRequiereinspeccion()!=null){ + m.put("inspeccion",tramite.getRequiereinspeccion()); + }else{ + m.put("inspeccion","N"); + } + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/TipoArchivoControl.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/TipoArchivoControl.java.svn-base new file mode 100644 index 0000000..a5695f7 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/TipoArchivoControl.java.svn-base @@ -0,0 +1,52 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudTramiteKey; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo del tipo de archivo + * + * @version 2.1 + */ +public class TipoArchivoControl extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + + if (mrequest.get("csolicitud") == null || mrequest.get("numerotransaccion") == null) { + return; + } + + TarmSolicitudTramiteKey codigoSolicitudKey = new TarmSolicitudTramiteKey(); + codigoSolicitudKey.setCsolicitud(mrequest.get("csolicitud").toString()); + codigoSolicitudKey.setCtramite(Long.valueOf(mrequest.get("numerotransaccion").toString())); + + TarmSolicitudTramite solicitudTramite=TarmSolicitudTramite.find(PersistenceHelper.getEntityManager(), codigoSolicitudKey); + TarmTramite tramite = TarmTramite.find(PersistenceHelper.getEntityManager(), solicitudTramite.getPk().getCtramite()); + + TgeneCatalogDetail tgeneCatalogDetail = PersistenceHelper.getEntityManager(). + createQuery("select o from TgeneCatalogDetail o where o.pk.catalog=:catalog and o.pk.catalogcode=:catalogcode",TgeneCatalogDetail.class) + .setParameter("catalog", tramite.getTipoarchivo()) + .setParameter("catalogcode", tramite.getTipoarchivocodigo()) + .getSingleResult(); + String resultado = "REPORTE".equalsIgnoreCase(tgeneCatalogDetail.getDescription())?"D":"CARNET".equalsIgnoreCase(tgeneCatalogDetail.getDescription())?"A":""; + m.put("BPMStatus",resultado); + m.put("tipoarchivo",resultado); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/TipoDocumento.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/TipoDocumento.java.svn-base new file mode 100644 index 0000000..c41a3bc --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/TipoDocumento.java.svn-base @@ -0,0 +1,53 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.armas.rules.exception.ControlArmasException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudTramiteKey; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo del tipo de archivo + * + * @version 2.1 + */ +public class TipoDocumento extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + + if (mrequest.get("csolicitud") == null && mrequest.get("numerotransaccion") == null) { //mrequest.get("numerotransaccion") + return; + } +// if (mrequest.get("csolicitud") != null) { +// m.put("tipodocumento","EC"); +// return; +// } + String csolicitud = (String)mrequest.get("csolicitud"); + Long ctramite = (Long)mrequest.get("numerotransaccion"); + + TarmSolicitudTramiteKey codigoSolicitudKey = new TarmSolicitudTramiteKey(csolicitud, ctramite); + TarmSolicitudTramite solicitudTramite=TarmSolicitudTramite.find(PersistenceHelper.getEntityManager(), codigoSolicitudKey); + + TarmTramite tramite = TarmTramite.find(PersistenceHelper.getEntityManager(), ctramite); + + if(tramite.getFlujotramite()==null){ + throw new ControlArmasException("ARM-0001", "TIPO DE TRAMITE {0} NO ENCONTRADO", solicitudTramite.getNumerotramite()); + } + m.put("tipodocumento",tramite.getFlujotramite());//EC + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/TramiteAnulado.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/TramiteAnulado.java.svn-base new file mode 100644 index 0000000..1f1fcbb --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/TramiteAnulado.java.svn-base @@ -0,0 +1,54 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudTramiteKey; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de anular el tramite + * c.p + * @version 2.1 + */ +public class TramiteAnulado extends TaskAction { + + private EntityManager em; + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null && mrequest.get("numerotransaccion") == null) { //mrequest.get("numerotransaccion") + return; + } + em=PersistenceHelper.getEntityManager(); + String csolicitud = (String)mrequest.get("csolicitud"); + Long ctramite = (Long)mrequest.get("numerotransaccion"); + + TarmSolicitudTramiteKey codigoSolicitudKey = new TarmSolicitudTramiteKey(csolicitud, ctramite); + TarmSolicitudTramite solicitudTramite=TarmSolicitudTramite.find(em, codigoSolicitudKey); + + TgeneParameters parametro=TgeneParameters.find(em, new TgeneParametersKey("CODIGO.ANULADO", 1)); + solicitudTramite.setEstadotramite(parametro.getTextvalue()); + solicitudTramite.setEstadotramitecodigo("ESTADOSOLICITUD"); + if(m.get("observaciones")!=null){ + solicitudTramite.setObservacionnovedad(m.get("observaciones").toString()); + } + em.merge(solicitudTramite); + + em.flush(); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/TramiteAprobado.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/TramiteAprobado.java.svn-base new file mode 100644 index 0000000..b0e9cf8 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/TramiteAprobado.java.svn-base @@ -0,0 +1,51 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudTramiteKey; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de cambiar el estado del tramite a aprobado el tramite + * c.p + * @version 2.1 + */ +public class TramiteAprobado extends TaskAction { + + private EntityManager em; + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null && mrequest.get("numerotransaccion") == null) { //mrequest.get("numerotransaccion") + return; + } + em=PersistenceHelper.getEntityManager(); + String csolicitud = (String)mrequest.get("csolicitud"); + Long ctramite = (Long)mrequest.get("numerotransaccion"); + + TarmSolicitudTramiteKey codigoSolicitudKey = new TarmSolicitudTramiteKey(csolicitud, ctramite); + TarmSolicitudTramite solicitudTramite=TarmSolicitudTramite.find(em, codigoSolicitudKey); + + TgeneParameters parametro=TgeneParameters.find(em, new TgeneParametersKey("ACEPTADO", 1));//APB + solicitudTramite.setEstadotramite(parametro.getTextvalue()); + solicitudTramite.setEstadotramitecodigo("ESTADOSOLICITUD"); + em.merge(solicitudTramite); + + em.flush(); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValAutorizacionPreviaImporta.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValAutorizacionPreviaImporta.java.svn-base new file mode 100644 index 0000000..1d55840 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValAutorizacionPreviaImporta.java.svn-base @@ -0,0 +1,47 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de validar si el tramite es Autorizacion y Categoria sea PreviaImportacion + * + * @version 2.1 + */ +public class ValAutorizacionPreviaImporta extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + + System.out.println("csolicitud"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + + if (mrequest.get("csolicitud") == null && mrequest.get("numerotransaccion") == null) { + return; + } + Long ctramite = (Long)mrequest.get("numerotransaccion"); + TgeneParameters paramTramAutorizacion = TgeneParameters.find(PersistenceHelper.getEntityManager(), new TgeneParametersKey("CODIGO.TRAMITE.AUTORIZACION", 1)); + TgeneParameters paramCategPreciaImpor = TgeneParameters.find(PersistenceHelper.getEntityManager(), new TgeneParametersKey("CODIGO.CATEG.PREVIAIMPORTA", 1)); + //Consulta del tramite + TarmTramite tarmTramite = TarmTramite.find(PersistenceHelper.getEntityManager(), ctramite); + if(tarmTramite.getTipoautorizacion().equals(paramTramAutorizacion.getTextvalue()) && tarmTramite.getCategoria().equals(paramCategPreciaImpor.getTextvalue())){ + m.put("previaimportacion","A"); + }else{ + m.put("previaimportacion","D"); + } + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValidaFlujoCargaDeposito.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValidaFlujoCargaDeposito.java.svn-base new file mode 100644 index 0000000..9dbef0b --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValidaFlujoCargaDeposito.java.svn-base @@ -0,0 +1,52 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudTramiteKey; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de anular el tramite + * c.p + * @version 2.1 + */ +public class ValidaFlujoCargaDeposito extends TaskAction { + + private EntityManager em; + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + System.out.println("Inicia el flujo...."); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + System.out.println("Inicia el flujo.."+mrequest.get("csolicitud")); + if (mrequest.get("csolicitud") == null && mrequest.get("numerotransaccion") == null) { //mrequest.get("numerotransaccion") + return; + } + em=PersistenceHelper.getEntityManager(); + String csolicitud = (String)mrequest.get("csolicitud"); + Long ctramite = (Long)mrequest.get("numerotransaccion"); + + TarmSolicitudTramiteKey codigoSolicitudKey = new TarmSolicitudTramiteKey(csolicitud, ctramite); + TarmSolicitudTramite solicitudTramite=TarmSolicitudTramite.find(em, codigoSolicitudKey); + + solicitudTramite.setInicioFlujo("INICIA EL FLUJO CARGA DEPOSITO"); + + em.merge(solicitudTramite); + + em.flush(); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValidaInspeccion.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValidaInspeccion.java.svn-base new file mode 100644 index 0000000..388bae5 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValidaInspeccion.java.svn-base @@ -0,0 +1,52 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmInspeccion; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de validar si la inspeccion aprueba o niega el tramite + * c.p + * @version 2.1 + */ +public class ValidaInspeccion extends TaskAction { + + private EntityManager em; + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null && mrequest.get("numerotransaccion") == null) { //mrequest.get("numerotransaccion") + return; + } + em=PersistenceHelper.getEntityManager(); + String csolicitud = (String)mrequest.get("csolicitud"); + Long ctramite = (Long)mrequest.get("numerotransaccion"); + + List inspeccionsList=em.createQuery("select o from TarmInspeccion o where o.csolicitud=:csolicitud and o.ctramite=:ctramite order by o.pk desc ") + .setParameter("csolicitud", csolicitud) + .setParameter("ctramite", ctramite) + .getResultList(); + System.out.println("Requiere Inspeccion :"+inspeccionsList); + if(inspeccionsList!=null && inspeccionsList.size()>0){ + if(inspeccionsList.get(0).getTramiteproceso()!=null ){ + m.put("tramiteproceso",inspeccionsList.get(0).getTramiteproceso()); + }else{ + m.put("tramiteproceso","N"); + } + } + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValidacionDecomiso.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValidacionDecomiso.java.svn-base new file mode 100644 index 0000000..c3d6726 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValidacionDecomiso.java.svn-base @@ -0,0 +1,48 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de validar si es decoiso o incautacion + * + * @version 2.1 + */ +public class ValidacionDecomiso extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + + System.out.println("cdecomiso"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + + if (mrequest.get("cdecomiso") == null) { + return; + } + + Long cdecomiso=Long.parseLong(mrequest.get("cdecomiso").toString()); + TarmDecomiso decomiso=TarmDecomiso.find(PersistenceHelper.getEntityManager(), cdecomiso); + //CODIGO DEL DECOMISO DEL TIPO DE REGISTRO + TgeneParameters parameters= TgeneParameters.find(PersistenceHelper.getEntityManager(), new TgeneParametersKey("CODIGO.TIPOREGISTRO.DECOMISO", 1)); + if(decomiso.getTipoproceso().equals(parameters.getTextvalue())){ + m.put("importacion","A"); + }else{ + m.put("importacion","D"); + } + + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValidacionGrupo.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValidacionGrupo.java.svn-base new file mode 100644 index 0000000..2e8ca37 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValidacionGrupo.java.svn-base @@ -0,0 +1,74 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; + +import org.apache.commons.lang.StringUtils; + +import com.fp.armas.rules.exception.ControlArmasException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pbpm.gene.TbpmGroups; +import com.fp.persistence.pbpm.gene.TbpmGroupsKey; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.gene.TgeneProvinceKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de buscar el grupo para asignar la tarea + * una tarea. + * + * @version 2.1 + */ +public class ValidacionGrupo extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + EntityManager em=PersistenceHelper.getEntityManager(); + System.out.println("Ingresa a validar el grupo"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("cprovincia") == null) { + m.put("grupo",null); + throw new ControlArmasException("BPM-0014", "SIN PROVINCIA", ""); + } + String cprovince=mrequest.get("cprovincia").toString(); + TgeneProvince province= TgeneProvince.find(em, new TgeneProvinceKey("EC", cprovince)); + + if(province!=null && province.getPk()!=null){ + System.out.println(" PROVINCIA "+obtieneNombreLimpio(province.getDescription())); + //se setea al grupo asignado + m.put("grupo",m.get("grupo")+obtieneNombreLimpio(province.getDescription())); + TbpmGroups groups= TbpmGroups.find(em, new TbpmGroupsKey(m.get("grupo").toString(), 1)); + if(groups!=null && groups.getPk()!=null ){ + System.out.println("...................GRUPO . "+m.get("grupo")); + System.out.println("csolicitud "+mrequest.get("csolicitud")); + System.out.println("cdecomiso "+mrequest.get("cdecomiso")); + }else{ + m.put("grupo",null); + throw new ControlArmasException("BPM-0012", "NO EXISTE EL GRUPO {0}", m.get("grupo")); + // throw new Exception("NO EXISTE EL GRUPO "+m.get("grupo")) ; + } + }else{ + throw new ControlArmasException("BPM-0013", "NO TIENE CENTRO DE CONTROL ASIGNADO LA PROVINCIA {0}", cprovince); + } + } + + /* Reemplazo un string los caracteres en blanco y reemplazo caracteres especiales + * @param toConvert + * @return la cadena convertida + */ + private String obtieneNombreLimpio(String toConvert){ + return StringUtils.replaceEach(StringUtils.deleteWhitespace(toConvert), + new String[]{"\u00e1","\u00e9","\u00ed","\u00f3","\u00fa","\u00c1","\u00c9","\u00cd","\u00d3","\u00da","\u00F1","\u00d1"}, + new String[]{"a","e","i","o","u","A","E","I","O","U","n","N"}); + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValidacionGrupoDecRecep.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValidacionGrupoDecRecep.java.svn-base new file mode 100644 index 0000000..833c863 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValidacionGrupoDecRecep.java.svn-base @@ -0,0 +1,87 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import javax.persistence.EntityManager; + +import org.apache.commons.lang.StringUtils; + +import com.fp.armas.rules.exception.ControlArmasException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pbpm.gene.TbpmGroups; +import com.fp.persistence.pbpm.gene.TbpmGroupsKey; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.gene.TgeneProvinceKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de buscar el grupo para asignar la tarea + * una tarea. + * + * @version 2.1 + */ +public class ValidacionGrupoDecRecep extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + EntityManager em=PersistenceHelper.getEntityManager(); + System.out.println("Ingresa a validar el grupo recepcion"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("cprovincia") == null) { + m.put("grupo",null); + throw new ControlArmasException("BPM-0014", "SIN PROVINCIA", ""); + } + String cprovince=mrequest.get("cprovincia").toString(); + + TgeneParameters paramDepartamentoControl=TgeneParameters.find(em, new TgeneParametersKey("CODIGO.DEPT.CONTROL", 1));//DPCA + System.out.println("Parametro codigo del departamento "+paramDepartamentoControl.getTextvalue()+ " codigo de la provincia"+cprovince); + if(cprovince.equals(paramDepartamentoControl.getTextvalue())){ + //maia.put("grupo","TEC_ALM_CENTRO_"); + m.put("grupo","JEFE_DEPARTAMENTO_ARMAS_"); + System.out.println("...................GRUPO . "+m.get("grupo")); + System.out.println("csolicitud "+mrequest.get("csolicitud")); + System.out.println("cdecomiso "+mrequest.get("cdecomiso")); + return; + } + + TgeneProvince province= TgeneProvince.find(em, new TgeneProvinceKey("EC", cprovince)); + + if(province!=null && province.getPk()!=null){ + System.out.println(" PROVINCIA "+obtieneNombreLimpio(province.getDescription())); + //se setea al grupo asignado + m.put("grupo",m.get("grupo")+obtieneNombreLimpio(province.getDescription())); + TbpmGroups groups= TbpmGroups.find(em, new TbpmGroupsKey(m.get("grupo").toString(), 1)); + if(groups!=null && groups.getPk()!=null ){ + System.out.println("...................GRUPO . "+m.get("grupo")); + System.out.println("csolicitud "+mrequest.get("csolicitud")); + System.out.println("cdecomiso "+mrequest.get("cdecomiso")); + }else{ + m.put("grupo",null); + throw new ControlArmasException("BPM-0012", "NO EXISTE EL GRUPO {0}", m.get("grupo")); + // throw new Exception("NO EXISTE EL GRUPO "+m.get("grupo")) ; + } + }else{ + throw new ControlArmasException("BPM-0013", "NO TIENE CENTRO DE CONTROL ASIGNADO LA PROVINCIA {0}", cprovince); + } + } + + /* Reemplazo un string los caracteres en blanco y reemplazo caracteres especiales + * @param toConvert + * @return la cadena convertida + */ + private String obtieneNombreLimpio(String toConvert){ + return StringUtils.replaceEach(StringUtils.deleteWhitespace(toConvert), + new String[]{"\u00e1","\u00e9","\u00ed","\u00f3","\u00fa","\u00c1","\u00c9","\u00cd","\u00d3","\u00da","\u00F1","\u00d1"}, + new String[]{"a","e","i","o","u","A","E","I","O","U","n","N"}); + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValidarCustodios.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValidarCustodios.java.svn-base new file mode 100644 index 0000000..3dcf588 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValidarCustodios.java.svn-base @@ -0,0 +1,63 @@ +package com.fp.armas.task; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudTramiteKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de validar numero de custodios + * @author Christian Pazmino + * @version 2.1 + */ +public class ValidarCustodios extends TaskAction { + private EntityManager em; + /* + * (non-Javadoc) + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + System.out.println("Rutina para validar custodios..."); + em=PersistenceHelper.getEntityManager(); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + String csolicitud = ""; + if (mrequest.get("csolicitud") == null) { + return; + } + else{ + csolicitud=mrequest.get("csolicitud").toString(); + TarmSolicitud solicitud = TarmSolicitud.find(em, csolicitud); + solicitud.setEstado("FIN"); + em.merge(solicitud); + Long ctramite = solicitud.getCtramite(); + TarmSolicitudTramiteKey codigoSolicitudKey = new TarmSolicitudTramiteKey(csolicitud, ctramite); + TarmSolicitudTramite solicitudTramite=TarmSolicitudTramite.find(em, codigoSolicitudKey); + solicitudTramite.setEstadotramite("FIN"); + em.merge(solicitudTramite); + BigDecimal numeroCustodios = new BigDecimal("0"); + if(solicitud.getNumerocustodios()!=null){ + numeroCustodios = new BigDecimal(solicitud.getNumerocustodios()); + } + if(numeroCustodios.compareTo(new BigDecimal("0"))!=0){ + m.put("BPMStatus","A"); + } + else{ + m.put("BPMStatus","D"); + } + + + } + + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValidarUnidadInstitucion.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValidarUnidadInstitucion.java.svn-base new file mode 100644 index 0000000..e079cf5 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/ValidarUnidadInstitucion.java.svn-base @@ -0,0 +1,57 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el valor de deposito para la solicitud + * @author Christian Pazmino + * @version 2.1 + */ +public class ValidarUnidadInstitucion extends TaskAction { + + /* + * (non-Javadoc) + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + System.out.println("Rutina que determina si es un CENTRO DE CONTROL DE ARMAS"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("numerotransaccion") == null) { + return; + } + // DETERMINA SI ES CENTRO DE CONTROL SE DEBE CONTINUAR EL FLUJO O TERMINAR SI ES OTRA INSTITUCION + Boolean esCentroControlArmas = Boolean.FALSE; + EntityManager em = PersistenceHelper.getEntityManager(); + TarmDecomisoArmaTransaccion decomisoArmaTransaccionObj = TarmDecomisoArmaTransaccion.find(PersistenceHelper.getEntityManager(), Long.parseLong(mrequest.get("numerotransaccion").toString())); + if(decomisoArmaTransaccionObj!=null){ + TarmCentroControl centroControlObj = TarmCentroControl.find(em, decomisoArmaTransaccionObj.getCcentrocontrol()); + // SI ES UN DEPARTAMENTO DE CONTROL DE ARMAS + if(centroControlObj!=null && centroControlObj.getInstitucion()!=null && centroControlObj.getInstitucion().equals("1")){ + esCentroControlArmas = Boolean.TRUE; + } + } + if(esCentroControlArmas){ + m.put("BPMStatus","A"); + } + else{ + m.put("BPMStatus","D"); + } + + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/VerificarCantidadArmas.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/VerificarCantidadArmas.java.svn-base new file mode 100644 index 0000000..7496a4b --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/.svn/text-base/VerificarCantidadArmas.java.svn-base @@ -0,0 +1,54 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de empleado asociado a la solicitud en el request campo userId, para asignar + * una tarea. + * + * @version 2.1 + */ +public class VerificarCantidadArmas extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + + System.out.println("csolicitud"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + + if (mrequest.get("csolicitud") == null) { + return; + } + String csolicitud=mrequest.get("csolicitud").toString(); + //datos armas atadas a una solicitud + List solicituds = PersistenceHelper.getEntityManager(). + createQuery("select o from TarmSolicitud o where o.pk=:csolicitud",TarmSolicitud.class) + .setParameter("csolicitud", csolicitud) + .getResultList(); + //TgeneParameters parametro = TgeneParameters.find(PersistenceHelper.getEntityManager(), new TgeneParametersKey("NUMERO.ARMAS.FLUJO", 1)); + if(solicituds!=null && solicituds.size()>0 && + solicituds.get(0).getNumerocustodios()!=null && solicituds.get(0).getNumerocustodios()>0){//armas.size()>Integer.parseInt(parametro.getNumbervalue().toString()) + m.put("requierecustodia","A"); + }else{ + m.put("requierecustodia","D"); + } + + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/ActualizarInventBajaDestrucc.java b/base/business/armas/src/main/java/com/fp/armas/task/ActualizarInventBajaDestrucc.java new file mode 100644 index 0000000..ce6faaf --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/ActualizarInventBajaDestrucc.java @@ -0,0 +1,142 @@ +package com.fp.armas.task; + +import java.sql.Timestamp; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmBodega; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDetRepDestruirArmas; +import com.fp.persistence.parmas.soli.TarmTransaccionArmaBodega; +import com.fp.sessionbeans.helper.Sequence; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de empleado asociado a la solicitud en el request campo userId, para asignar + * una tarea. + * + * @version 2.1 + */ +public class ActualizarInventBajaDestrucc extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + EntityManager em=PersistenceHelper.getEntityManager(); + System.out.println("Rutina que actualiza el inventario despues de que se ha autorizado destruir armas"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("creporte") == null) { + return; + } + Integer creporte=Integer.parseInt(mrequest.get("creporte").toString()); + + //lista de las armas decomisadas que se encuentran en el reporte + List tarmDetRepDestruirArmasList= em. + createQuery("select t from TarmDetRepDestruirArmas t where t.creporte=:creporte") + .setParameter("creporte", creporte) + .getResultList(); + //Se recorre la lista de las armas del reporte de destruccion + for(TarmDetRepDestruirArmas detArmaObj:tarmDetRepDestruirArmasList){ + //Actualizo el estado del registro tarmDecomisoArma + + TarmDecomisoArma decomisoArmaObj = (TarmDecomisoArma) em.createQuery("select t from TarmDecomisoArma t where t.pk=:pk") + .setParameter("pk", detArmaObj.getCdecomisoarma()) + .getResultList().get(0); + decomisoArmaObj.setEstado("DEST"); + em.merge(decomisoArmaObj); + //Actualizo el estado del registro tarmArma + TarmArmas armaObjAnterior = (TarmArmas) em.createQuery("select t from TarmArmas t where t.pk=:pk") + .setParameter("pk", decomisoArmaObj.getCarma()) + .getResultList().get(0); + TarmArmas armaObj = new TarmArmas(); + armaObj.setCantidad(armaObjAnterior.getCantidad()); + armaObj.setCantoncode(armaObjAnterior.getCantoncode()); + armaObj.setCitycode(armaObjAnterior.getCitycode()); + armaObj.setCodigoarma(armaObjAnterior.getCodigoarma()); + armaObj.setColor(armaObjAnterior.getColor()); + armaObj.setColorcodigo(armaObjAnterior.getColorcodigo()); + armaObj.setCountrycode(armaObjAnterior.getCountrycode()); + armaObj.setCpaisorigen(armaObjAnterior.getCpaisorigen()); + armaObj.setCregistro(armaObjAnterior.getCregistro()); + armaObj.setCtipoarmaexplosivo(armaObjAnterior.getCtipoarmaexplosivo()); + armaObj.setDireccion(armaObjAnterior.getDireccion()); + armaObj.setEstado("DEST"); + armaObj.setEstadocodigo("ESTADOARMA"); +// Timestamp timeStamp = new Timestamp(System.currentTimeMillis()); +// armaObj.setFecharegistro(timeStamp); + armaObj.setFemisionpermiso(armaObjAnterior.getFemisionpermiso()); + armaObj.setLote(armaObjAnterior.getLote()); + armaObj.setMarca(armaObjAnterior.getMarca()); + armaObj.setMarcacodigo(armaObjAnterior.getMarcacodigo()); + armaObj.setModelo(armaObjAnterior.getModelo()); + armaObj.setNemonicoarma(armaObjAnterior.getNemonicoarma()); + armaObj.setParroquiacode(armaObjAnterior.getParroquiacode()); + armaObj.setPeso(armaObjAnterior.getPeso()); + armaObj.setPesoAux(armaObjAnterior.getPesoAux()); + armaObj.setProvincecode(armaObjAnterior.getProvincecode()); + armaObj.setSeriecanon(armaObjAnterior.getSeriecanon()); + armaObj.setTipofabricacion(armaObjAnterior.getTipofabricacion()); + armaObj.setTipofabricacioncodigo(armaObjAnterior.getTipofabricacioncodigo()); + armaObj.setUnidadmedidacantidad(armaObjAnterior.getUnidadmedidacantidad()); + armaObj.setUnidadmedidacantidadcodigo(armaObjAnterior.getUnidadmedidacantidadcodigo()); + armaObj.setValorAux(armaObjAnterior.getValorAux()); + armaObj.setPk(getCodigoArma().toString()); + em.persist(armaObj); + + // Actualizar en TARMBODEGA el centro de control para el arma destruida + TarmBodega bodegaArmaObj = (TarmBodega) em.createQuery("select t from TarmBodega t where t.carma=:carma") + .setParameter("carma", decomisoArmaObj.getCarma()) + .getResultList().get(0); + if(bodegaArmaObj!=null){ + bodegaArmaObj.setCcentrocontrol(null); + em.merge(decomisoArmaObj); + }else{ + TarmBodega bodegaObj = new TarmBodega(); + bodegaObj.setPk(getCodigoBodega()); + bodegaObj.setCarma(decomisoArmaObj.getCarma()); + em.persist(bodegaObj); + } + // Inserta registro en transaccion Arma Bodega + TarmTransaccionArmaBodega tranArmaBodegaObj = new TarmTransaccionArmaBodega(); + tranArmaBodegaObj.setPk(getCTransArmaBodega()); + tranArmaBodegaObj.setCarma(decomisoArmaObj.getCarma()); + tranArmaBodegaObj.setOperacion("DESTRUCCION"); + tranArmaBodegaObj.setOperacioncode("OPERACIONDECOMISO"); + tranArmaBodegaObj.setCcentrocontrolorigen("DPTOARMASPICH"); + tranArmaBodegaObj.setFecha(new Timestamp(new Date().getTime())); + em.persist(tranArmaBodegaObj); + } + em.flush(); + } + + private String getCodigoArma() throws Exception{ + Sequence sequence = new Sequence(); + String carma = sequence.getNextValue("CARMA").toString(); + return carma; + } + + private Long getCodigoBodega() throws Exception{ + Sequence sequence = new Sequence(); + Integer cbodega = sequence.getNextValue("CBODEGA").intValue(); + return new Long(cbodega); + } + + private Long getCTransArmaBodega() throws Exception{ + Sequence sequence = new Sequence(); + Integer cTransArmaBodega = sequence.getNextValue("CTRANARMBODEGA").intValue(); + return new Long(cTransArmaBodega); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/ActualizarInventario.java b/base/business/armas/src/main/java/com/fp/armas/task/ActualizarInventario.java new file mode 100644 index 0000000..3192bbd --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/ActualizarInventario.java @@ -0,0 +1,54 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de empleado asociado a la solicitud en el request campo userId, para asignar + * una tarea. + * + * @version 2.1 + */ +public class ActualizarInventario extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + + System.out.println("ingresa a actualizar a la clase"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("numerotransaccion") == null) { + return; + } + Long numeroTransacion=Long.parseLong(mrequest.get("numerotransaccion").toString()); + //datos de la transaccion + TarmDecomisoArmaTransaccion tarmDecomisoArmaTransaccion=TarmDecomisoArmaTransaccion.find(PersistenceHelper.getEntityManager(), numeroTransacion); + //lista de las armas decomisadas por el codigo de recepcion + List tarmDecomisoArmaTransaccionList= PersistenceHelper.getEntityManager(). + createQuery("select o from TarmDecomisoArma o where o.cdecarmtranrecepcion=:cdecarmtranrecepcion") + .setParameter("cdecarmtranrecepcion", numeroTransacion) + .getResultList(); + //se recorre la lista de las armas decomisadas + for(TarmDecomisoArma decomisoArma:tarmDecomisoArmaTransaccionList){ + //se busca l tabla de decomiso para actualizar el campo del centro de control que esta recibiendo las armas + TarmDecomiso decomiso= TarmDecomiso.find(PersistenceHelper.getEntityManager(), decomisoArma.getCdecomiso()); + decomiso.setCcentrocontroldestino(tarmDecomisoArmaTransaccion.getCcentrocontrol()); + PersistenceHelper.getEntityManager().merge(decomiso); + } + PersistenceHelper.getEntityManager().flush(); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/ActualizarPlanificacion.java b/base/business/armas/src/main/java/com/fp/armas/task/ActualizarPlanificacion.java new file mode 100644 index 0000000..08374cd --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/ActualizarPlanificacion.java @@ -0,0 +1,41 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.ins.TarmPlanificacionInspeccion; +import com.fp.simple.action.TaskAction; + +/** + * Clase para actualizar la planificacion + * una tarea. + * + * @version 2.1 + */ +public class ActualizarPlanificacion extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + + System.out.println("ingresa a actualizar a la clase"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("cplanificacion") == null) { + return; + } + Long numeroTransacion=Long.parseLong(mrequest.get("cplanificacion").toString()); + TarmPlanificacionInspeccion planificacionInspeccion= TarmPlanificacionInspeccion.find(PersistenceHelper.getEntityManager(), numeroTransacion); + planificacionInspeccion.setAprobada(m.get("respuesta").toString()); + PersistenceHelper.getEntityManager().merge(planificacionInspeccion); + //datos de la transaccion + PersistenceHelper.getEntityManager().flush(); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/ActualizarRutaArchivo.java b/base/business/armas/src/main/java/com/fp/armas/task/ActualizarRutaArchivo.java new file mode 100644 index 0000000..cf304f1 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/ActualizarRutaArchivo.java @@ -0,0 +1,43 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.simple.action.TaskAction; + +/** + * C.P + * Clase para actulaizar la ruta del archivo + * + * @version 2.1 + */ +public class ActualizarRutaArchivo extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("numerotransaccion") == null) { + return; + } + Long numeroTransacion=Long.parseLong(mrequest.get("numerotransaccion").toString()); + //datos de la transaccion + TarmDecomisoArmaTransaccion tarmDecomisoArmaTransaccion=TarmDecomisoArmaTransaccion.find(PersistenceHelper.getEntityManager(), numeroTransacion); + if(mrequest.get("xpath")!=null){ + tarmDecomisoArmaTransaccion.setXpath(mrequest.get("xpath").toString()); + tarmDecomisoArmaTransaccion.setEstadoflujo("ENV"); + } + PersistenceHelper.getEntityManager().merge(tarmDecomisoArmaTransaccion); + PersistenceHelper.getEntityManager().flush(); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/AplicarSancion.java b/base/business/armas/src/main/java/com/fp/armas/task/AplicarSancion.java new file mode 100644 index 0000000..848b24b --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/AplicarSancion.java @@ -0,0 +1,71 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el valor de deposito para la solicitud + * @author Christian Pazmino + * @version 2.1 + */ +public class AplicarSancion extends TaskAction { + + /* + * (non-Javadoc) + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + System.out.println("Rutina que determina si es un CENTRO DE CONTROL y hay al menos un arma en estado RECLAMADO"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("numerotransaccion") == null) { + return; + } + // DETERMINA SI SE DEBE O NO APLICAR LA SANCION + Boolean aplicarSancionBLN = Boolean.FALSE; + EntityManager em = PersistenceHelper.getEntityManager(); + TarmDecomisoArmaTransaccion decomisoArmaTransaccionObj = TarmDecomisoArmaTransaccion.find(PersistenceHelper.getEntityManager(), Long.parseLong(mrequest.get("numerotransaccion").toString())); + if(decomisoArmaTransaccionObj!=null){ + TarmCentroControl centroControlObj = TarmCentroControl.find(em, decomisoArmaTransaccionObj.getCcentrocontrol()); + if(centroControlObj!=null){ + TgeneCatalogDetailKey pk = new TgeneCatalogDetailKey(centroControlObj.getNombreinstitucion(), centroControlObj.getNombreinstitucioncodigo()); + TgeneCatalogDetail unidadCD = TgeneCatalogDetail.find(em, pk); + // SI ES UN DEPARTAMENTO DE CONTROL DE ARMAS, Y ES UN CENTRO DE CONTROL DE ARMAS + if(centroControlObj.getInstitucion().equals("1")&& unidadCD.getDescription().contains("CENTRO CONTROL DE ARMAS")){ + Long numeroTransacion=Long.parseLong(mrequest.get("numerotransaccion").toString()); + //lista de las armas decomisadas por el codigo de recepcion + List lArmasRecibidas= em.createQuery("select o from TarmDecomisoArma o where o.cdecarmtranrecepcion=:cdecarmtranrecepcion") + .setParameter("cdecarmtranrecepcion", numeroTransacion).getResultList(); + + for(TarmDecomisoArma decomisoArma:lArmasRecibidas){ + if("RECL".equals(decomisoArma.getEstado())){ + aplicarSancionBLN = Boolean.TRUE; + break; + } + } + } + } + } + if(aplicarSancionBLN){ + m.put("BPMStatus","A"); + } + else{ + m.put("BPMStatus","D"); + } + + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/EmitirComprobanteCaja.java b/base/business/armas/src/main/java/com/fp/armas/task/EmitirComprobanteCaja.java new file mode 100644 index 0000000..4f3bd28 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/EmitirComprobanteCaja.java @@ -0,0 +1,103 @@ +package com.fp.armas.task; + +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDetRepDestruirArmas; +import com.fp.sessionbeans.helper.Sequence; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de empleado asociado a la solicitud en el request campo userId, para asignar + * una tarea. + * + * @version 2.1 + */ +public class EmitirComprobanteCaja extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + + System.out.println("**** Emitir Comprobante De Caja ****"); +// HashMap m = (HashMap) pParam; +// Map mrequest = (Map) m.get("request"); +// if (mrequest.get("creporte") == null) { +// return; +// } +// Integer creporte=Integer.parseInt(mrequest.get("creporte").toString()); +// +// //lista de las armas decomisadas que se encuentran en el reporte +// List tarmDetRepDestruirArmasList= PersistenceHelper.getEntityManager(). +// createQuery("select t from TarmDetRepDestruirArmas t where t.creporte=:creporte") +// .setParameter("creporte", creporte) +// .getResultList(); +// //Se recorre la lista de las armas del reporte de destruccion +// for(TarmDetRepDestruirArmas detArmaObj:tarmDetRepDestruirArmasList){ +// //Actualizo el estado del registro tarmDecomisoArma +// +// TarmDecomisoArma decomisoArmaObj = (TarmDecomisoArma) PersistenceHelper.getEntityManager().createQuery("select t from TarmDecomisoArma t where t.pk=:pk") +// .setParameter("pk", detArmaObj.getCdecomisoarma()) +// .getResultList().get(0); +// decomisoArmaObj.setEstado("DEST"); +// PersistenceHelper.getEntityManager().merge(decomisoArmaObj); +// //Actualizo el estado del registro tarmArma +// TarmArmas armaObjAnterior = (TarmArmas) PersistenceHelper.getEntityManager().createQuery("select t from TarmArmas t where t.pk=:pk") +// .setParameter("pk", decomisoArmaObj.getCarma()) +// .getResultList().get(0); +// TarmArmas armaObj = new TarmArmas(); +// armaObj.setCantidad(armaObjAnterior.getCantidad()); +// armaObj.setCantoncode(armaObjAnterior.getCantoncode()); +// armaObj.setCitycode(armaObjAnterior.getCitycode()); +// armaObj.setCodigoarma(armaObjAnterior.getCodigoarma()); +// armaObj.setColor(armaObjAnterior.getColor()); +// armaObj.setColorcodigo(armaObjAnterior.getColorcodigo()); +// armaObj.setCountrycode(armaObjAnterior.getCountrycode()); +// armaObj.setCpaisorigen(armaObjAnterior.getCpaisorigen()); +// armaObj.setCregistro(armaObjAnterior.getCregistro()); +// armaObj.setCtipoarmaexplosivo(armaObjAnterior.getCtipoarmaexplosivo()); +// armaObj.setDireccion(armaObjAnterior.getDireccion()); +// armaObj.setEstado("DEST"); +// armaObj.setEstadocodigo("ESTADOARMA"); +//// Timestamp timeStamp = new Timestamp(System.currentTimeMillis()); +//// armaObj.setFecharegistro(timeStamp); +// armaObj.setFemisionpermiso(armaObjAnterior.getFemisionpermiso()); +// armaObj.setLote(armaObjAnterior.getLote()); +// armaObj.setMarca(armaObjAnterior.getMarca()); +// armaObj.setMarcacodigo(armaObjAnterior.getMarcacodigo()); +// armaObj.setModelo(armaObjAnterior.getModelo()); +// armaObj.setNemonicoarma(armaObjAnterior.getNemonicoarma()); +// armaObj.setParroquiacode(armaObjAnterior.getParroquiacode()); +// armaObj.setPeso(armaObjAnterior.getPeso()); +// armaObj.setPesoAux(armaObjAnterior.getPesoAux()); +// armaObj.setProvincecode(armaObjAnterior.getProvincecode()); +// armaObj.setSeriecanon(armaObjAnterior.getSeriecanon()); +// armaObj.setTipofabricacion(armaObjAnterior.getTipofabricacion()); +// armaObj.setTipofabricacioncodigo(armaObjAnterior.getTipofabricacioncodigo()); +// armaObj.setUnidadmedidacantidad(armaObjAnterior.getUnidadmedidacantidad()); +// armaObj.setUnidadmedidacantidadcodigo(armaObjAnterior.getUnidadmedidacantidadcodigo()); +// armaObj.setValorAux(armaObjAnterior.getValorAux()); +// armaObj.setPk(getCodigoArma().toString()); +// PersistenceHelper.getEntityManager().persist(armaObj); +// } +// PersistenceHelper.getEntityManager().flush(); + } + +// private Integer getCodigoArma() throws Exception{ +// Sequence sequence = new Sequence(); +// Integer carma = sequence.getNextValue("CARMA").intValue(); +// return carma; +// } + + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/FechaCaducidadEstadoArma.java b/base/business/armas/src/main/java/com/fp/armas/task/FechaCaducidadEstadoArma.java new file mode 100644 index 0000000..aa74366 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/FechaCaducidadEstadoArma.java @@ -0,0 +1,93 @@ +package com.fp.armas.task; + +import java.sql.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.inte.TarmColadeImpresion; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudTramiteKey; +import com.fp.sessionbeans.helper.Sequence; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo del tipo de archivo + * + * @version 2.1 + */ +public class FechaCaducidadEstadoArma extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + System.out.println("SOLICITUD : "+mrequest.get("csolicitud")); + System.out.println("NUMERO DE TRANSACCION: "+mrequest.get("numerotransaccion")); + if (mrequest.get("csolicitud") == null || mrequest.get("numerotransaccion") == null) { + return; + } + EntityManager em = PersistenceHelper.getEntityManager(); + TarmSolicitudTramiteKey codigoSolicitudKey = new TarmSolicitudTramiteKey(); + codigoSolicitudKey.setCsolicitud(mrequest.get("csolicitud").toString()); + codigoSolicitudKey.setCtramite(Long.valueOf(mrequest.get("numerotransaccion").toString())); + TarmSolicitudTramite solicitudTramite=TarmSolicitudTramite.find(em, codigoSolicitudKey); + + TarmTramite tramite = TarmTramite.find(em, solicitudTramite.getPk().getCtramite()); + if(!tramite.getTipoautorizacion().equals("6")){// diferente 6 TIPOAUTORIZACION 0 PERMISO + return; + } + + System.out.println("select o from TarmDocumentoHabilitante o where o.csolicitud=:csolicitud" + mrequest.get("csolicitud").toString()); + List documentoHab= em.createQuery("select o from TarmDocumentoHabilitante o where o.csolicitud=:csolicitud",TarmDocumentoHabilitante.class) + .setParameter("csolicitud", mrequest.get("csolicitud").toString()). + getResultList(); + System.out.println("............................"+documentoHab.size()); + + List tarmArmas = em. + createQuery("select o from TarmArmas o where o.pk in (select p.pk.carma from TarmSolicitudArmas p where p.pk.csolicitud=:csolicitud)",TarmArmas.class) + .setParameter("csolicitud",mrequest.get("csolicitud").toString()) + .getResultList(); + System.out.println("............................"+tarmArmas.size()); + + for (TarmDocumentoHabilitante itemDocHab : documentoHab) { + StringBuilder sqlColaImpresion= new StringBuilder("select c from TarmColadeImpresion c where c.cdocumento ="+itemDocHab.getPk()); + ListlistaColaImpresion= em.createQuery(sqlColaImpresion.toString(),TarmColadeImpresion.class).getResultList(); + if(listaColaImpresion!=null && listaColaImpresion.size()>0){ + for (TarmColadeImpresion itemColaImp : listaColaImpresion) { + itemColaImp.setEstadoimpresion("PIMPR"); + itemColaImp.setEstadoimpresioncode("ESTADOIMPRESION"); + em.merge(itemColaImp); + em.flush(); + } + } + } + + for(TarmArmas arma:tarmArmas){ + arma.setPk(this.getCodigoArma()); + arma.setFechacaducidad(documentoHab.get(0).getFechaexpiracion()); + arma.setFecharegistro(new Date(System.currentTimeMillis())); + em.clear(); + em.persist(arma); + em.flush(); + } + } + + private String getCodigoArma() throws Exception{ + Sequence sequence = new Sequence(); + String carma = sequence.getNextValue("CARMA").toString(); + return carma; + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/FinalizarDocumentoHabilitante.java b/base/business/armas/src/main/java/com/fp/armas/task/FinalizarDocumentoHabilitante.java new file mode 100644 index 0000000..94a09e3 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/FinalizarDocumentoHabilitante.java @@ -0,0 +1,59 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.simple.action.TaskAction; + +public class FinalizarDocumentoHabilitante extends TaskAction { + + private EntityManager em; + + private static final String QUERY_DOCUMENTOS_ACTUALIZAR = "SELECT p from TarmDocumentoHabilitante p where p.ctramite in (SELECT o.ctramitepadre FROM TarmTramite o WHERE o.pk=:codigotramite) and p.estado <> 'FIN' order by p.fechaemision desc"; + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null && mrequest.get("numerotransaccion") == null) { //mrequest.get("numerotransaccion") + return; + } + em=PersistenceHelper.getEntityManager(); + //String csolicitud = (String)mrequest.get("csolicitud"); + Long ctramite = (Long)mrequest.get("numerotransaccion"); + + //TarmSolicitudTramiteKey codigoSolicitudKey = new TarmSolicitudTramiteKey(csolicitud, ctramite); + //TarmSolicitudTramite solicitudTramite=TarmSolicitudTramite.find(em, codigoSolicitudKey); + TarmDocumentoHabilitante documentoHabilitante= getCodigoDocumentoHabilitanteFinalizar(ctramite); +// if(documentoHabilitante!=null){ +// documentoHabilitante.setEstado("FIN"); +// em.merge(documentoHabilitante); +// em.flush(); +// } + } + + private TarmDocumentoHabilitante getCodigoDocumentoHabilitanteFinalizar(Long codigotramite) throws Exception{ + //tanto el tag como el arma deben estar relacionados entre si, no se puede producir el caso en que un tag este relacionado con mas de un arma y viceversa + TarmDocumentoHabilitante codigoDocumentohabilitanteActualizar = null; + Query query = PersistenceHelper.getEntityManager().createQuery(QUERY_DOCUMENTOS_ACTUALIZAR); + query.setParameter("codigotramite", codigotramite); + List ltDocumentosHabilitantesSeleccionados = query.getResultList(); + if(ltDocumentosHabilitantesSeleccionados != null && !ltDocumentosHabilitantesSeleccionados.isEmpty()){ + codigoDocumentohabilitanteActualizar = ltDocumentosHabilitantesSeleccionados.get(0); + } + return codigoDocumentohabilitanteActualizar; + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/GenerarValorACancelar.java b/base/business/armas/src/main/java/com/fp/armas/task/GenerarValorACancelar.java new file mode 100644 index 0000000..9caac29 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/GenerarValorACancelar.java @@ -0,0 +1,44 @@ +package com.fp.armas.task; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; + +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el valor de deposito para la solicitud + * @author Christian Pazmino + * @version 2.1 + */ +public class GenerarValorACancelar extends TaskAction { + + /* + * (non-Javadoc) + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + System.out.println("Rutina que genera el valor de deposito"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return; + } + Mapdatosmail = (Map) m.get("datosmail"); + BigDecimal costoTramite = new BigDecimal("0"); + if(datosmail!=null && datosmail.get("costoTramite")!=null){ + costoTramite = (BigDecimal) datosmail.get("costoTramite"); + } + + if(costoTramite.compareTo(new BigDecimal("0"))!=0){ + m.put("BPMStatus","A"); + } + else{ + m.put("BPMStatus","D"); + } + + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/ObtieneCentroControl.java b/base/business/armas/src/main/java/com/fp/armas/task/ObtieneCentroControl.java new file mode 100644 index 0000000..d8e7b1b --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/ObtieneCentroControl.java @@ -0,0 +1,52 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de empleado asociado a la solicitud en el request campo userId, para asignar + * una tarea. + * + * @version 2.1 + */ +public class ObtieneCentroControl extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + + System.out.println("ingresa a actualizar a la clase"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + + if (mrequest.get("ccentrocontrol") == null) { + return; + } + String codigoCentroControl=mrequest.get("ccentrocontrol").toString(); + //datos del decomiso + //consulta del centro de control + TarmCentroControl centroControl=TarmCentroControl.find(PersistenceHelper.getEntityManager(), codigoCentroControl); + //lista de las armas decomisadas por el codigo de recepcion + TgeneCatalogDetail tgeneCatalogDetail = PersistenceHelper.getEntityManager(). + createQuery("select o from TgeneCatalogDetail o where o.pk.catalog=:catalog and o.pk.catalogcode=:catalogcode",TgeneCatalogDetail.class) + .setParameter("catalog", centroControl.getInstitucion()) + .setParameter("catalogcode", centroControl.getInstituciontipo()) + .getSingleResult(); + if(!tgeneCatalogDetail.getLegalcode().equals("C")){ + m.put("corganismo","D"); + return; + } + m.put("corganismo",tgeneCatalogDetail.getLegalcode()); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/ObtienerCategoriaTramite.java b/base/business/armas/src/main/java/com/fp/armas/task/ObtienerCategoriaTramite.java new file mode 100644 index 0000000..a1ae5cd --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/ObtienerCategoriaTramite.java @@ -0,0 +1,65 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de empleado asociado a la solicitud en el request campo userId, para asignar + * una tarea. + * + * @version 2.1 + */ +public class ObtienerCategoriaTramite extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + + System.out.println("csolicitud"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + + if (mrequest.get("csolicitud") == null) { + return; + } + TgeneParametersKey key= new TgeneParametersKey(); + key.setCode("CODIGO.CATEGORIA.IMPORTADOR"); + key.setCompanycode(1); + TgeneParameters parameters= TgeneParameters.find(PersistenceHelper.getEntityManager(), key); + String csolicitud=mrequest.get("csolicitud").toString(); + //datos del decomiso + //consulta del centro de control + TarmSolicitud solicitud=TarmSolicitud.find(PersistenceHelper.getEntityManager(), csolicitud); + //lista de las armas decomisadas por el codigo de recepcion + TarmTramite tarmTramite = PersistenceHelper.getEntityManager(). + createQuery("select o from TarmTramite o where o.pk=:ctramite",TarmTramite.class) + .setParameter("ctramite", solicitud.getCtramite()) + .getSingleResult(); + TgeneCatalogDetailKey pKey= new TgeneCatalogDetailKey(); + pKey.setCatalog(tarmTramite.getCategoria()); + pKey.setCatalogcode(tarmTramite.getCategoriacodigo()); + TgeneCatalogDetail catalogDetail=TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), pKey); + if(catalogDetail.getPk().getCatalog().equals(parameters.getTextvalue())){ + m.put("importacion","A"); + }else{ + m.put("importacion","D"); + } + + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/RechazarActa.java b/base/business/armas/src/main/java/com/fp/armas/task/RechazarActa.java new file mode 100644 index 0000000..8872430 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/RechazarActa.java @@ -0,0 +1,67 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmBodega; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de setear a nulos aquellas armas que recibieron asignacion de codigos + * + */ +public class RechazarActa extends TaskAction { + private static String SQL = "select o from TarmBodega o where o.pk in (select max(t.pk) from TarmBodega t where t.carma=:ccarma and t.ccentrocontrol=:ccentrocontrol) order by o.carma"; + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + Long numeroTransacion=Long.parseLong(mrequest.get("numerotransaccion").toString()); + if (numeroTransacion == null) { + return; + } + + List lstDecomisoArma = PersistenceHelper.getEntityManager(). + createQuery("select o from TarmDecomisoArma o where o.cdecomisoarmatransaccion=:decomiso",TarmDecomisoArma.class) + .setParameter("decomiso", numeroTransacion).getResultList(); + + for(TarmDecomisoArma decomisoArma:lstDecomisoArma){ + bodegaEliminar(numeroTransacion, decomisoArma.getCarma()); + decomisoArma.setCdecomisoarmatransaccion(null); + PersistenceHelper.saveOrUpdate(decomisoArma); + + } + + } + + /** + * @param ccentrocontrol + * @param decomisoArma + */ + private void bodegaEliminar(Long numeroTransacion, + String carma) throws Exception { + TarmDecomisoArmaTransaccion tarmDecomisoArmaTransaccion = TarmDecomisoArmaTransaccion + .find(PersistenceHelper.getEntityManager(), numeroTransacion); + + String ccentrocontrol = tarmDecomisoArmaTransaccion.getCcentrocontrol(); + TarmBodega tarmBodegas = (TarmBodega) PersistenceHelper + .getEntityManager().createQuery(SQL) + .setParameter("ccentrocontrol", ccentrocontrol) + .setParameter("ccarma", carma) + .getSingleResult(); + PersistenceHelper.getEntityManager().remove(tarmBodegas); + PersistenceHelper.getEntityManager().flush(); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/RequiereInspeccion.java b/base/business/armas/src/main/java/com/fp/armas/task/RequiereInspeccion.java new file mode 100644 index 0000000..e928854 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/RequiereInspeccion.java @@ -0,0 +1,55 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.armas.rules.exception.ControlArmasException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudTramiteKey; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de anular el tramite + * c.p + * @version 2.1 + */ +public class RequiereInspeccion extends TaskAction { + + private EntityManager em; + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null && mrequest.get("numerotransaccion") == null) { //mrequest.get("numerotransaccion") + return; + } + em=PersistenceHelper.getEntityManager(); + String csolicitud = (String)mrequest.get("csolicitud"); + Long ctramite = (Long)mrequest.get("numerotransaccion"); + + TarmTramite tramite=TarmTramite.find(em, ctramite); + System.out.println("Requiere Inspeccion :"+tramite.getRequiereinspeccion()); + if(tramite.getRequiereinspeccion()!=null){ + m.put("inspeccion",tramite.getRequiereinspeccion()); + }else{ + m.put("inspeccion","N"); + } + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/TipoArchivoControl.java b/base/business/armas/src/main/java/com/fp/armas/task/TipoArchivoControl.java new file mode 100644 index 0000000..a5695f7 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/TipoArchivoControl.java @@ -0,0 +1,52 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudTramiteKey; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo del tipo de archivo + * + * @version 2.1 + */ +public class TipoArchivoControl extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + + if (mrequest.get("csolicitud") == null || mrequest.get("numerotransaccion") == null) { + return; + } + + TarmSolicitudTramiteKey codigoSolicitudKey = new TarmSolicitudTramiteKey(); + codigoSolicitudKey.setCsolicitud(mrequest.get("csolicitud").toString()); + codigoSolicitudKey.setCtramite(Long.valueOf(mrequest.get("numerotransaccion").toString())); + + TarmSolicitudTramite solicitudTramite=TarmSolicitudTramite.find(PersistenceHelper.getEntityManager(), codigoSolicitudKey); + TarmTramite tramite = TarmTramite.find(PersistenceHelper.getEntityManager(), solicitudTramite.getPk().getCtramite()); + + TgeneCatalogDetail tgeneCatalogDetail = PersistenceHelper.getEntityManager(). + createQuery("select o from TgeneCatalogDetail o where o.pk.catalog=:catalog and o.pk.catalogcode=:catalogcode",TgeneCatalogDetail.class) + .setParameter("catalog", tramite.getTipoarchivo()) + .setParameter("catalogcode", tramite.getTipoarchivocodigo()) + .getSingleResult(); + String resultado = "REPORTE".equalsIgnoreCase(tgeneCatalogDetail.getDescription())?"D":"CARNET".equalsIgnoreCase(tgeneCatalogDetail.getDescription())?"A":""; + m.put("BPMStatus",resultado); + m.put("tipoarchivo",resultado); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/TipoDocumento.java b/base/business/armas/src/main/java/com/fp/armas/task/TipoDocumento.java new file mode 100644 index 0000000..c41a3bc --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/TipoDocumento.java @@ -0,0 +1,53 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.armas.rules.exception.ControlArmasException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudTramiteKey; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo del tipo de archivo + * + * @version 2.1 + */ +public class TipoDocumento extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + + if (mrequest.get("csolicitud") == null && mrequest.get("numerotransaccion") == null) { //mrequest.get("numerotransaccion") + return; + } +// if (mrequest.get("csolicitud") != null) { +// m.put("tipodocumento","EC"); +// return; +// } + String csolicitud = (String)mrequest.get("csolicitud"); + Long ctramite = (Long)mrequest.get("numerotransaccion"); + + TarmSolicitudTramiteKey codigoSolicitudKey = new TarmSolicitudTramiteKey(csolicitud, ctramite); + TarmSolicitudTramite solicitudTramite=TarmSolicitudTramite.find(PersistenceHelper.getEntityManager(), codigoSolicitudKey); + + TarmTramite tramite = TarmTramite.find(PersistenceHelper.getEntityManager(), ctramite); + + if(tramite.getFlujotramite()==null){ + throw new ControlArmasException("ARM-0001", "TIPO DE TRAMITE {0} NO ENCONTRADO", solicitudTramite.getNumerotramite()); + } + m.put("tipodocumento",tramite.getFlujotramite());//EC + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/TramiteAnulado.java b/base/business/armas/src/main/java/com/fp/armas/task/TramiteAnulado.java new file mode 100644 index 0000000..1f1fcbb --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/TramiteAnulado.java @@ -0,0 +1,54 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudTramiteKey; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de anular el tramite + * c.p + * @version 2.1 + */ +public class TramiteAnulado extends TaskAction { + + private EntityManager em; + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null && mrequest.get("numerotransaccion") == null) { //mrequest.get("numerotransaccion") + return; + } + em=PersistenceHelper.getEntityManager(); + String csolicitud = (String)mrequest.get("csolicitud"); + Long ctramite = (Long)mrequest.get("numerotransaccion"); + + TarmSolicitudTramiteKey codigoSolicitudKey = new TarmSolicitudTramiteKey(csolicitud, ctramite); + TarmSolicitudTramite solicitudTramite=TarmSolicitudTramite.find(em, codigoSolicitudKey); + + TgeneParameters parametro=TgeneParameters.find(em, new TgeneParametersKey("CODIGO.ANULADO", 1)); + solicitudTramite.setEstadotramite(parametro.getTextvalue()); + solicitudTramite.setEstadotramitecodigo("ESTADOSOLICITUD"); + if(m.get("observaciones")!=null){ + solicitudTramite.setObservacionnovedad(m.get("observaciones").toString()); + } + em.merge(solicitudTramite); + + em.flush(); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/TramiteAprobado.java b/base/business/armas/src/main/java/com/fp/armas/task/TramiteAprobado.java new file mode 100644 index 0000000..b0e9cf8 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/TramiteAprobado.java @@ -0,0 +1,51 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudTramiteKey; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de cambiar el estado del tramite a aprobado el tramite + * c.p + * @version 2.1 + */ +public class TramiteAprobado extends TaskAction { + + private EntityManager em; + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null && mrequest.get("numerotransaccion") == null) { //mrequest.get("numerotransaccion") + return; + } + em=PersistenceHelper.getEntityManager(); + String csolicitud = (String)mrequest.get("csolicitud"); + Long ctramite = (Long)mrequest.get("numerotransaccion"); + + TarmSolicitudTramiteKey codigoSolicitudKey = new TarmSolicitudTramiteKey(csolicitud, ctramite); + TarmSolicitudTramite solicitudTramite=TarmSolicitudTramite.find(em, codigoSolicitudKey); + + TgeneParameters parametro=TgeneParameters.find(em, new TgeneParametersKey("ACEPTADO", 1));//APB + solicitudTramite.setEstadotramite(parametro.getTextvalue()); + solicitudTramite.setEstadotramitecodigo("ESTADOSOLICITUD"); + em.merge(solicitudTramite); + + em.flush(); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/ValAutorizacionPreviaImporta.java b/base/business/armas/src/main/java/com/fp/armas/task/ValAutorizacionPreviaImporta.java new file mode 100644 index 0000000..1d55840 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/ValAutorizacionPreviaImporta.java @@ -0,0 +1,47 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de validar si el tramite es Autorizacion y Categoria sea PreviaImportacion + * + * @version 2.1 + */ +public class ValAutorizacionPreviaImporta extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + + System.out.println("csolicitud"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + + if (mrequest.get("csolicitud") == null && mrequest.get("numerotransaccion") == null) { + return; + } + Long ctramite = (Long)mrequest.get("numerotransaccion"); + TgeneParameters paramTramAutorizacion = TgeneParameters.find(PersistenceHelper.getEntityManager(), new TgeneParametersKey("CODIGO.TRAMITE.AUTORIZACION", 1)); + TgeneParameters paramCategPreciaImpor = TgeneParameters.find(PersistenceHelper.getEntityManager(), new TgeneParametersKey("CODIGO.CATEG.PREVIAIMPORTA", 1)); + //Consulta del tramite + TarmTramite tarmTramite = TarmTramite.find(PersistenceHelper.getEntityManager(), ctramite); + if(tarmTramite.getTipoautorizacion().equals(paramTramAutorizacion.getTextvalue()) && tarmTramite.getCategoria().equals(paramCategPreciaImpor.getTextvalue())){ + m.put("previaimportacion","A"); + }else{ + m.put("previaimportacion","D"); + } + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/ValidaFlujoCargaDeposito.java b/base/business/armas/src/main/java/com/fp/armas/task/ValidaFlujoCargaDeposito.java new file mode 100644 index 0000000..9dbef0b --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/ValidaFlujoCargaDeposito.java @@ -0,0 +1,52 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudTramiteKey; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de anular el tramite + * c.p + * @version 2.1 + */ +public class ValidaFlujoCargaDeposito extends TaskAction { + + private EntityManager em; + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + System.out.println("Inicia el flujo...."); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + System.out.println("Inicia el flujo.."+mrequest.get("csolicitud")); + if (mrequest.get("csolicitud") == null && mrequest.get("numerotransaccion") == null) { //mrequest.get("numerotransaccion") + return; + } + em=PersistenceHelper.getEntityManager(); + String csolicitud = (String)mrequest.get("csolicitud"); + Long ctramite = (Long)mrequest.get("numerotransaccion"); + + TarmSolicitudTramiteKey codigoSolicitudKey = new TarmSolicitudTramiteKey(csolicitud, ctramite); + TarmSolicitudTramite solicitudTramite=TarmSolicitudTramite.find(em, codigoSolicitudKey); + + solicitudTramite.setInicioFlujo("INICIA EL FLUJO CARGA DEPOSITO"); + + em.merge(solicitudTramite); + + em.flush(); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/ValidaInspeccion.java b/base/business/armas/src/main/java/com/fp/armas/task/ValidaInspeccion.java new file mode 100644 index 0000000..388bae5 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/ValidaInspeccion.java @@ -0,0 +1,52 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmInspeccion; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de validar si la inspeccion aprueba o niega el tramite + * c.p + * @version 2.1 + */ +public class ValidaInspeccion extends TaskAction { + + private EntityManager em; + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null && mrequest.get("numerotransaccion") == null) { //mrequest.get("numerotransaccion") + return; + } + em=PersistenceHelper.getEntityManager(); + String csolicitud = (String)mrequest.get("csolicitud"); + Long ctramite = (Long)mrequest.get("numerotransaccion"); + + List inspeccionsList=em.createQuery("select o from TarmInspeccion o where o.csolicitud=:csolicitud and o.ctramite=:ctramite order by o.pk desc ") + .setParameter("csolicitud", csolicitud) + .setParameter("ctramite", ctramite) + .getResultList(); + System.out.println("Requiere Inspeccion :"+inspeccionsList); + if(inspeccionsList!=null && inspeccionsList.size()>0){ + if(inspeccionsList.get(0).getTramiteproceso()!=null ){ + m.put("tramiteproceso",inspeccionsList.get(0).getTramiteproceso()); + }else{ + m.put("tramiteproceso","N"); + } + } + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/ValidacionDecomiso.java b/base/business/armas/src/main/java/com/fp/armas/task/ValidacionDecomiso.java new file mode 100644 index 0000000..c3d6726 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/ValidacionDecomiso.java @@ -0,0 +1,48 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de validar si es decoiso o incautacion + * + * @version 2.1 + */ +public class ValidacionDecomiso extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + + System.out.println("cdecomiso"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + + if (mrequest.get("cdecomiso") == null) { + return; + } + + Long cdecomiso=Long.parseLong(mrequest.get("cdecomiso").toString()); + TarmDecomiso decomiso=TarmDecomiso.find(PersistenceHelper.getEntityManager(), cdecomiso); + //CODIGO DEL DECOMISO DEL TIPO DE REGISTRO + TgeneParameters parameters= TgeneParameters.find(PersistenceHelper.getEntityManager(), new TgeneParametersKey("CODIGO.TIPOREGISTRO.DECOMISO", 1)); + if(decomiso.getTipoproceso().equals(parameters.getTextvalue())){ + m.put("importacion","A"); + }else{ + m.put("importacion","D"); + } + + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/ValidacionGrupo.java b/base/business/armas/src/main/java/com/fp/armas/task/ValidacionGrupo.java new file mode 100644 index 0000000..2e8ca37 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/ValidacionGrupo.java @@ -0,0 +1,74 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; + +import org.apache.commons.lang.StringUtils; + +import com.fp.armas.rules.exception.ControlArmasException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pbpm.gene.TbpmGroups; +import com.fp.persistence.pbpm.gene.TbpmGroupsKey; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.gene.TgeneProvinceKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de buscar el grupo para asignar la tarea + * una tarea. + * + * @version 2.1 + */ +public class ValidacionGrupo extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + EntityManager em=PersistenceHelper.getEntityManager(); + System.out.println("Ingresa a validar el grupo"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("cprovincia") == null) { + m.put("grupo",null); + throw new ControlArmasException("BPM-0014", "SIN PROVINCIA", ""); + } + String cprovince=mrequest.get("cprovincia").toString(); + TgeneProvince province= TgeneProvince.find(em, new TgeneProvinceKey("EC", cprovince)); + + if(province!=null && province.getPk()!=null){ + System.out.println(" PROVINCIA "+obtieneNombreLimpio(province.getDescription())); + //se setea al grupo asignado + m.put("grupo",m.get("grupo")+obtieneNombreLimpio(province.getDescription())); + TbpmGroups groups= TbpmGroups.find(em, new TbpmGroupsKey(m.get("grupo").toString(), 1)); + if(groups!=null && groups.getPk()!=null ){ + System.out.println("...................GRUPO . "+m.get("grupo")); + System.out.println("csolicitud "+mrequest.get("csolicitud")); + System.out.println("cdecomiso "+mrequest.get("cdecomiso")); + }else{ + m.put("grupo",null); + throw new ControlArmasException("BPM-0012", "NO EXISTE EL GRUPO {0}", m.get("grupo")); + // throw new Exception("NO EXISTE EL GRUPO "+m.get("grupo")) ; + } + }else{ + throw new ControlArmasException("BPM-0013", "NO TIENE CENTRO DE CONTROL ASIGNADO LA PROVINCIA {0}", cprovince); + } + } + + /* Reemplazo un string los caracteres en blanco y reemplazo caracteres especiales + * @param toConvert + * @return la cadena convertida + */ + private String obtieneNombreLimpio(String toConvert){ + return StringUtils.replaceEach(StringUtils.deleteWhitespace(toConvert), + new String[]{"\u00e1","\u00e9","\u00ed","\u00f3","\u00fa","\u00c1","\u00c9","\u00cd","\u00d3","\u00da","\u00F1","\u00d1"}, + new String[]{"a","e","i","o","u","A","E","I","O","U","n","N"}); + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/ValidacionGrupoDecRecep.java b/base/business/armas/src/main/java/com/fp/armas/task/ValidacionGrupoDecRecep.java new file mode 100644 index 0000000..833c863 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/ValidacionGrupoDecRecep.java @@ -0,0 +1,87 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.Map; + +import javax.persistence.EntityManager; + +import org.apache.commons.lang.StringUtils; + +import com.fp.armas.rules.exception.ControlArmasException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pbpm.gene.TbpmGroups; +import com.fp.persistence.pbpm.gene.TbpmGroupsKey; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.gene.TgeneProvinceKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de buscar el grupo para asignar la tarea + * una tarea. + * + * @version 2.1 + */ +public class ValidacionGrupoDecRecep extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + EntityManager em=PersistenceHelper.getEntityManager(); + System.out.println("Ingresa a validar el grupo recepcion"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("cprovincia") == null) { + m.put("grupo",null); + throw new ControlArmasException("BPM-0014", "SIN PROVINCIA", ""); + } + String cprovince=mrequest.get("cprovincia").toString(); + + TgeneParameters paramDepartamentoControl=TgeneParameters.find(em, new TgeneParametersKey("CODIGO.DEPT.CONTROL", 1));//DPCA + System.out.println("Parametro codigo del departamento "+paramDepartamentoControl.getTextvalue()+ " codigo de la provincia"+cprovince); + if(cprovince.equals(paramDepartamentoControl.getTextvalue())){ + //maia.put("grupo","TEC_ALM_CENTRO_"); + m.put("grupo","JEFE_DEPARTAMENTO_ARMAS_"); + System.out.println("...................GRUPO . "+m.get("grupo")); + System.out.println("csolicitud "+mrequest.get("csolicitud")); + System.out.println("cdecomiso "+mrequest.get("cdecomiso")); + return; + } + + TgeneProvince province= TgeneProvince.find(em, new TgeneProvinceKey("EC", cprovince)); + + if(province!=null && province.getPk()!=null){ + System.out.println(" PROVINCIA "+obtieneNombreLimpio(province.getDescription())); + //se setea al grupo asignado + m.put("grupo",m.get("grupo")+obtieneNombreLimpio(province.getDescription())); + TbpmGroups groups= TbpmGroups.find(em, new TbpmGroupsKey(m.get("grupo").toString(), 1)); + if(groups!=null && groups.getPk()!=null ){ + System.out.println("...................GRUPO . "+m.get("grupo")); + System.out.println("csolicitud "+mrequest.get("csolicitud")); + System.out.println("cdecomiso "+mrequest.get("cdecomiso")); + }else{ + m.put("grupo",null); + throw new ControlArmasException("BPM-0012", "NO EXISTE EL GRUPO {0}", m.get("grupo")); + // throw new Exception("NO EXISTE EL GRUPO "+m.get("grupo")) ; + } + }else{ + throw new ControlArmasException("BPM-0013", "NO TIENE CENTRO DE CONTROL ASIGNADO LA PROVINCIA {0}", cprovince); + } + } + + /* Reemplazo un string los caracteres en blanco y reemplazo caracteres especiales + * @param toConvert + * @return la cadena convertida + */ + private String obtieneNombreLimpio(String toConvert){ + return StringUtils.replaceEach(StringUtils.deleteWhitespace(toConvert), + new String[]{"\u00e1","\u00e9","\u00ed","\u00f3","\u00fa","\u00c1","\u00c9","\u00cd","\u00d3","\u00da","\u00F1","\u00d1"}, + new String[]{"a","e","i","o","u","A","E","I","O","U","n","N"}); + } +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/ValidarCustodios.java b/base/business/armas/src/main/java/com/fp/armas/task/ValidarCustodios.java new file mode 100644 index 0000000..3dcf588 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/ValidarCustodios.java @@ -0,0 +1,63 @@ +package com.fp.armas.task; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudTramiteKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de validar numero de custodios + * @author Christian Pazmino + * @version 2.1 + */ +public class ValidarCustodios extends TaskAction { + private EntityManager em; + /* + * (non-Javadoc) + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + System.out.println("Rutina para validar custodios..."); + em=PersistenceHelper.getEntityManager(); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + String csolicitud = ""; + if (mrequest.get("csolicitud") == null) { + return; + } + else{ + csolicitud=mrequest.get("csolicitud").toString(); + TarmSolicitud solicitud = TarmSolicitud.find(em, csolicitud); + solicitud.setEstado("FIN"); + em.merge(solicitud); + Long ctramite = solicitud.getCtramite(); + TarmSolicitudTramiteKey codigoSolicitudKey = new TarmSolicitudTramiteKey(csolicitud, ctramite); + TarmSolicitudTramite solicitudTramite=TarmSolicitudTramite.find(em, codigoSolicitudKey); + solicitudTramite.setEstadotramite("FIN"); + em.merge(solicitudTramite); + BigDecimal numeroCustodios = new BigDecimal("0"); + if(solicitud.getNumerocustodios()!=null){ + numeroCustodios = new BigDecimal(solicitud.getNumerocustodios()); + } + if(numeroCustodios.compareTo(new BigDecimal("0"))!=0){ + m.put("BPMStatus","A"); + } + else{ + m.put("BPMStatus","D"); + } + + + } + + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/ValidarUnidadInstitucion.java b/base/business/armas/src/main/java/com/fp/armas/task/ValidarUnidadInstitucion.java new file mode 100644 index 0000000..e079cf5 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/ValidarUnidadInstitucion.java @@ -0,0 +1,57 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el valor de deposito para la solicitud + * @author Christian Pazmino + * @version 2.1 + */ +public class ValidarUnidadInstitucion extends TaskAction { + + /* + * (non-Javadoc) + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + System.out.println("Rutina que determina si es un CENTRO DE CONTROL DE ARMAS"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("numerotransaccion") == null) { + return; + } + // DETERMINA SI ES CENTRO DE CONTROL SE DEBE CONTINUAR EL FLUJO O TERMINAR SI ES OTRA INSTITUCION + Boolean esCentroControlArmas = Boolean.FALSE; + EntityManager em = PersistenceHelper.getEntityManager(); + TarmDecomisoArmaTransaccion decomisoArmaTransaccionObj = TarmDecomisoArmaTransaccion.find(PersistenceHelper.getEntityManager(), Long.parseLong(mrequest.get("numerotransaccion").toString())); + if(decomisoArmaTransaccionObj!=null){ + TarmCentroControl centroControlObj = TarmCentroControl.find(em, decomisoArmaTransaccionObj.getCcentrocontrol()); + // SI ES UN DEPARTAMENTO DE CONTROL DE ARMAS + if(centroControlObj!=null && centroControlObj.getInstitucion()!=null && centroControlObj.getInstitucion().equals("1")){ + esCentroControlArmas = Boolean.TRUE; + } + } + if(esCentroControlArmas){ + m.put("BPMStatus","A"); + } + else{ + m.put("BPMStatus","D"); + } + + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/VerificarCantidadArmas.java b/base/business/armas/src/main/java/com/fp/armas/task/VerificarCantidadArmas.java new file mode 100644 index 0000000..7496a4b --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/VerificarCantidadArmas.java @@ -0,0 +1,54 @@ +package com.fp.armas.task; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de empleado asociado a la solicitud en el request campo userId, para asignar + * una tarea. + * + * @version 2.1 + */ +public class VerificarCantidadArmas extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + + System.out.println("csolicitud"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + + if (mrequest.get("csolicitud") == null) { + return; + } + String csolicitud=mrequest.get("csolicitud").toString(); + //datos armas atadas a una solicitud + List solicituds = PersistenceHelper.getEntityManager(). + createQuery("select o from TarmSolicitud o where o.pk=:csolicitud",TarmSolicitud.class) + .setParameter("csolicitud", csolicitud) + .getResultList(); + //TgeneParameters parametro = TgeneParameters.find(PersistenceHelper.getEntityManager(), new TgeneParametersKey("NUMERO.ARMAS.FLUJO", 1)); + if(solicituds!=null && solicituds.size()>0 && + solicituds.get(0).getNumerocustodios()!=null && solicituds.get(0).getNumerocustodios()>0){//armas.size()>Integer.parseInt(parametro.getNumbervalue().toString()) + m.put("requierecustodia","A"); + }else{ + m.put("requierecustodia","D"); + } + + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/traspasodominio/.svn/entries b/base/business/armas/src/main/java/com/fp/armas/task/traspasodominio/.svn/entries new file mode 100644 index 0000000..5d34525 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/traspasodominio/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/main/java/com/fp/armas/task/traspasodominio +svn://172.17.26.185/COMACO + + + +2021-05-14T20:43:26.035487Z +4634 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TraspasoDominio.java +file + + + + +2022-07-28T03:40:40.646794Z +9004700dcde294d3906b4fc89246e95f +2021-05-14T20:43:26.035487Z +4634 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +10486 + +TraspasoDominioAnula.java +file + + + + +2022-07-28T03:40:40.646794Z +7a7a98de8e37369f4d940ebfc616ff54 +2021-05-14T20:43:26.035487Z +4634 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1738 + diff --git a/base/business/armas/src/main/java/com/fp/armas/task/traspasodominio/.svn/text-base/TraspasoDominio.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/traspasodominio/.svn/text-base/TraspasoDominio.java.svn-base new file mode 100644 index 0000000..99ab201 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/traspasodominio/.svn/text-base/TraspasoDominio.java.svn-base @@ -0,0 +1,209 @@ +package com.fp.armas.task.traspasodominio; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.armas.rules.exception.ControlArmasException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.fun.TarmMovimientoArmas; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.parmas.fun.TarmVentaArmaTem; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.sessionbeans.helper.Sequence; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de buscar el grupo para asignar la tarea + * una tarea. + * + * @version 2.1 + */ +public class TraspasoDominio extends TaskAction { + + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings({ "unchecked", "deprecation" }) + @Override + public void assignOwner(Object pParam) throws Exception { + EntityManager em=PersistenceHelper.getEntityManager(); + System.out.println("Ingresa a traspaso dominio"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + m.put("grupo",null); + throw new ControlArmasException("BPM-0014", "SIN CODIGO", ""); + } + String csolicitud=mrequest.get("csolicitud").toString(); + TarmArmas arma= TarmArmas.find(em, csolicitud); + Listlistaventa= em.createQuery("select p from TarmVentaArmaTem p where p.carma=:carma and p.estado=:estado") + .setParameter("carma", arma.getPk()) + .setParameter("estado", "PENDIENTE") + .getResultList(); + for (TarmVentaArmaTem item : listaventa) { + item.setEstado("APROBADO"); + em.merge(item); + } + arma.setEstadoventa(null); + TarmRegistroArmas registro = TarmRegistroArmas.find(em, arma.getCregistro()); + + //1nuevo TarmRegistroArma del nuevo propietario + TarmRegistroArmas registroArmaComprador= new TarmRegistroArmas(); + registroArmaComprador.setPk(getCodigoRegistro()); + registroArmaComprador.setPersoncode(listaventa.get(0).getPersoncodigo()); + registroArmaComprador.setTiporegistro("VENT"); + registroArmaComprador.setTiporegistrocodigo("TIPOREGISTRO"); + registroArmaComprador.setFcreacion( new java.sql.Date(new Date().getTime())); + em.persist(registroArmaComprador); + //2 + TarmMovimientoArmas tarmMovimientoArmas=new TarmMovimientoArmas(); + tarmMovimientoArmas.setPk(getCodigoMovimiento()); + tarmMovimientoArmas.setCarma(arma.getPk()); + tarmMovimientoArmas.setFactura(listaventa.get(0).getFactura()); + tarmMovimientoArmas.setNoregistro(listaventa.get(0).getNoregistra()); + tarmMovimientoArmas.setFecha(new Timestamp(new Date().getTime())); + tarmMovimientoArmas.setPersoncodecomprador(listaventa.get(0).getPersoncodigo()); + tarmMovimientoArmas.setPersoncodevendedor(registro.getPersoncode()); + tarmMovimientoArmas.setTipomovimientocodigo("TIPOMOVIMIENTO"); + tarmMovimientoArmas.setTipomovimiento("VENT"); + tarmMovimientoArmas.setJustificacion(listaventa.get(0).getJustificacion()); + em.persist(tarmMovimientoArmas);em.flush(); + + //3 Se genera un registro TarmTotalPersona del que vende + TarmTotalPersona totalPersonaVendedor =totalPersona(em,arma.getCtipoarmaexplosivo(),tarmMovimientoArmas.getPersoncodevendedor()); + totalPersonaVendedor.setCarma(arma.getPk()); + totalPersonaVendedor.setIngresoegreso("EGR"); + totalPersonaVendedor.setFecha(new Timestamp(new Date().getTime())); + + //if(arma.getCantidad()!=null && arma.getCantidad()>0 && arma.getValorAux()>0 ){ + totalPersonaVendedor.setCantidadmovimiento(new BigDecimal(arma.getCantidad())); + if(totalPersonaVendedor.getTotal()==null){ + totalPersonaVendedor.setTotal(new BigDecimal(arma.getCantidad())); + } + //} +// if(arma.getPeso()!=null && arma.getPeso().compareTo(new BigDecimal(0))>0 && +// arma.getPesoAux()!=null && arma.getPesoAux().compareTo(new BigDecimal(0))>0){ +// totalPersonaVendedor.setCantidadmovimiento(arma.getPesoAux()); +// if(totalPersonaVendedor.getTotal()==null){ +// totalPersonaVendedor.setTotal(arma.getPeso()); +// } +// } + totalPersonaVendedor.setCmovimiento(tarmMovimientoArmas.getPk()); + totalPersonaVendedor.setSaldoanterior(totalPersonaVendedor.getTotal()); + totalPersonaVendedor.setTotal(totalPersonaVendedor.getTotal().subtract(totalPersonaVendedor.getCantidadmovimiento())); + totalPersonaVendedor.setPk(getCtotal()); + em.merge(totalPersonaVendedor);em.flush(); + + //3.1. Se genera un registro de ING para el comprador + TarmTotalPersona totalPersonaComprador =totalPersona(em,arma.getCtipoarmaexplosivo(),tarmMovimientoArmas.getPersoncodecomprador()); + totalPersonaComprador.setCarma(arma.getPk()); + totalPersonaComprador.setIngresoegreso("ING"); + Date fechaActual1=new Date(); + fechaActual1.setSeconds(fechaActual1.getSeconds()+2); + totalPersonaComprador.setFecha(new Timestamp(fechaActual1.getTime())); + totalPersonaComprador.setCantidadmovimiento(new BigDecimal(arma.getCantidad())); + if(totalPersonaComprador.getTotal()==null){ + totalPersonaComprador.setTotal(new BigDecimal(0)); + } + + totalPersonaComprador.setCmovimiento(tarmMovimientoArmas.getPk()); + totalPersonaComprador.setSaldoanterior(totalPersonaComprador.getTotal()); + totalPersonaComprador.setTotal(totalPersonaComprador.getTotal().add(totalPersonaComprador.getCantidadmovimiento())); + totalPersonaComprador.setPk(getCtotal()); + em.merge(totalPersonaComprador); + + + //4 se genera un registro de arma con lo que se vende + TarmArmas armaVende= (TarmArmas)arma.cloneMe(); + armaVende.setPk(getCodigoArmas()); + armaVende.setEstado("VEND"); + armaVende.setFecharegistro(new java.sql.Date(new Date().getTime())); + if(armaVende.getCantidad()!=null && armaVende.getCantidad()>0 && armaVende.getValorAux()>0 ){ + armaVende.setCantidad(armaVende.getValorAux()); + } + if(armaVende.getPeso()!=null && armaVende.getPeso().compareTo(new BigDecimal(0))>0 && + armaVende.getPesoAux()!=null && armaVende.getPesoAux().compareTo(new BigDecimal(0))>0){ + armaVende.setPeso(armaVende.getPesoAux()); + } + em.persist(armaVende); + + //4.1 Nuevo registro Arma con el nuevo propietario + TarmArmas armaNuevoPropietario= (TarmArmas)arma.cloneMe(); + armaNuevoPropietario.setPk(getCodigoArmas()); + armaNuevoPropietario.setCregistro(registroArmaComprador.getPk()); + armaNuevoPropietario.setEstado("REG"); + Date fechaActual=new Date(); + fechaActual.setSeconds(fechaActual.getSeconds()+2); + armaNuevoPropietario.setFecharegistro(new java.sql.Date(fechaActual.getTime())); + if(armaNuevoPropietario.getCantidad()!=null && armaNuevoPropietario.getCantidad()>0 && armaNuevoPropietario.getValorAux()>0 ){ + armaNuevoPropietario.setCantidad(armaNuevoPropietario.getValorAux()); + } + if(armaNuevoPropietario.getPeso()!=null && armaNuevoPropietario.getPeso().compareTo(new BigDecimal(0))>0 && + armaNuevoPropietario.getPesoAux()!=null && armaNuevoPropietario.getPesoAux().compareTo(new BigDecimal(0))>0){ + armaNuevoPropietario.setPeso(armaNuevoPropietario.getPesoAux()); + } + em.persist(armaNuevoPropietario); + + } + + private String getCodigoArmas() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CARMA").toString(); + return codigoArma; + } + private Long getCodigoRegistro() throws Exception { + Sequence sequence = new Sequence(); + Long codigo = sequence.getNextValue("CREGISTRO").longValue(); + return codigo; + } + private String getCodigoMovimiento() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CMOVIMIENTO").toString(); + return codigoArma; + } + private String getCtotal() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CTOTAL").toString(); + return codigoArma; + } + public TarmTotalPersona totalPersona(EntityManager em,String ctipoarmaexplosivo,Integer personcodigo) throws Exception{ + TarmTipoArmaExplosivo armaExplosivo= TarmTipoArmaExplosivo.find(em,ctipoarmaexplosivo); + + String sql ="select t from TarmTotalPersona t where t.clase='"+armaExplosivo.getClase()+"' and t.tipoarmaexplosivo='"+armaExplosivo.getTipoarmaexplosivo()+"' and t.unidadmedidapeso='"+armaExplosivo.getUnidadmedidapeso()+"' " + + " and t.personcodigo="+personcodigo+" and t.fecha =(select max(t1.fecha) from TarmTotalPersona t1" + + " where t1.clase='"+armaExplosivo.getClase()+"' and t1.tipoarmaexplosivo='"+armaExplosivo.getTipoarmaexplosivo()+"' and t1.unidadmedidapeso='"+armaExplosivo.getUnidadmedidapeso()+"' " + + " and t1.personcodigo="+personcodigo+")"; + System.out.println("query totalPersoan....:"+sql); + ListtarmTotalPersonas= em.createQuery(sql,TarmTotalPersona.class).getResultList(); + if(tarmTotalPersonas!=null && tarmTotalPersonas.size()>0){ + TarmTotalPersona total=(TarmTotalPersona)tarmTotalPersonas.get(0).cloneMe(); + total.setPk(null); + return total; + }else{ + TarmTotalPersona totalPersona= new TarmTotalPersona(); + totalPersona.setClase(armaExplosivo.getClase()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(armaExplosivo.getTipoarmaexplosivo()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setUnidadmedidapeso(armaExplosivo.getUnidadmedidapeso()); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setPersoncodigo(personcodigo); + totalPersona.setTotal(null); + totalPersona.setSaldoanterior(new BigDecimal(0)); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + return totalPersona; + } + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/traspasodominio/.svn/text-base/TraspasoDominioAnula.java.svn-base b/base/business/armas/src/main/java/com/fp/armas/task/traspasodominio/.svn/text-base/TraspasoDominioAnula.java.svn-base new file mode 100644 index 0000000..04a315d --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/traspasodominio/.svn/text-base/TraspasoDominioAnula.java.svn-base @@ -0,0 +1,51 @@ +package com.fp.armas.task.traspasodominio; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.armas.rules.exception.ControlArmasException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.fun.TarmVentaArmaTem; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.simple.action.TaskAction; + +/** + * + * @version 2.1 + */ +public class TraspasoDominioAnula extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + EntityManager em=PersistenceHelper.getEntityManager(); + System.out.println("Ingresa a traspaso dominio"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + m.put("grupo",null); + throw new ControlArmasException("BPM-0014", "SIN CODIGO", ""); + } + String csolicitud=mrequest.get("csolicitud").toString(); + TarmArmas arma= TarmArmas.find(em, csolicitud); + Listlistaventa= em.createQuery("select p from TarmVentaArmaTem p where p.carma=:carma and p.estado=:estado") + .setParameter("carma", arma.getPk()) + .setParameter("estado", "PENDIENTE") + .getResultList(); + for (TarmVentaArmaTem item : listaventa) { + item.setEstado("RECHAZADO"); + em.merge(item); + } + arma.setEstadoventa(null); + em.merge(arma); + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/traspasodominio/TraspasoDominio.java b/base/business/armas/src/main/java/com/fp/armas/task/traspasodominio/TraspasoDominio.java new file mode 100644 index 0000000..99ab201 --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/traspasodominio/TraspasoDominio.java @@ -0,0 +1,209 @@ +package com.fp.armas.task.traspasodominio; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.armas.rules.exception.ControlArmasException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.fun.TarmMovimientoArmas; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.parmas.fun.TarmVentaArmaTem; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.sessionbeans.helper.Sequence; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de buscar el grupo para asignar la tarea + * una tarea. + * + * @version 2.1 + */ +public class TraspasoDominio extends TaskAction { + + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings({ "unchecked", "deprecation" }) + @Override + public void assignOwner(Object pParam) throws Exception { + EntityManager em=PersistenceHelper.getEntityManager(); + System.out.println("Ingresa a traspaso dominio"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + m.put("grupo",null); + throw new ControlArmasException("BPM-0014", "SIN CODIGO", ""); + } + String csolicitud=mrequest.get("csolicitud").toString(); + TarmArmas arma= TarmArmas.find(em, csolicitud); + Listlistaventa= em.createQuery("select p from TarmVentaArmaTem p where p.carma=:carma and p.estado=:estado") + .setParameter("carma", arma.getPk()) + .setParameter("estado", "PENDIENTE") + .getResultList(); + for (TarmVentaArmaTem item : listaventa) { + item.setEstado("APROBADO"); + em.merge(item); + } + arma.setEstadoventa(null); + TarmRegistroArmas registro = TarmRegistroArmas.find(em, arma.getCregistro()); + + //1nuevo TarmRegistroArma del nuevo propietario + TarmRegistroArmas registroArmaComprador= new TarmRegistroArmas(); + registroArmaComprador.setPk(getCodigoRegistro()); + registroArmaComprador.setPersoncode(listaventa.get(0).getPersoncodigo()); + registroArmaComprador.setTiporegistro("VENT"); + registroArmaComprador.setTiporegistrocodigo("TIPOREGISTRO"); + registroArmaComprador.setFcreacion( new java.sql.Date(new Date().getTime())); + em.persist(registroArmaComprador); + //2 + TarmMovimientoArmas tarmMovimientoArmas=new TarmMovimientoArmas(); + tarmMovimientoArmas.setPk(getCodigoMovimiento()); + tarmMovimientoArmas.setCarma(arma.getPk()); + tarmMovimientoArmas.setFactura(listaventa.get(0).getFactura()); + tarmMovimientoArmas.setNoregistro(listaventa.get(0).getNoregistra()); + tarmMovimientoArmas.setFecha(new Timestamp(new Date().getTime())); + tarmMovimientoArmas.setPersoncodecomprador(listaventa.get(0).getPersoncodigo()); + tarmMovimientoArmas.setPersoncodevendedor(registro.getPersoncode()); + tarmMovimientoArmas.setTipomovimientocodigo("TIPOMOVIMIENTO"); + tarmMovimientoArmas.setTipomovimiento("VENT"); + tarmMovimientoArmas.setJustificacion(listaventa.get(0).getJustificacion()); + em.persist(tarmMovimientoArmas);em.flush(); + + //3 Se genera un registro TarmTotalPersona del que vende + TarmTotalPersona totalPersonaVendedor =totalPersona(em,arma.getCtipoarmaexplosivo(),tarmMovimientoArmas.getPersoncodevendedor()); + totalPersonaVendedor.setCarma(arma.getPk()); + totalPersonaVendedor.setIngresoegreso("EGR"); + totalPersonaVendedor.setFecha(new Timestamp(new Date().getTime())); + + //if(arma.getCantidad()!=null && arma.getCantidad()>0 && arma.getValorAux()>0 ){ + totalPersonaVendedor.setCantidadmovimiento(new BigDecimal(arma.getCantidad())); + if(totalPersonaVendedor.getTotal()==null){ + totalPersonaVendedor.setTotal(new BigDecimal(arma.getCantidad())); + } + //} +// if(arma.getPeso()!=null && arma.getPeso().compareTo(new BigDecimal(0))>0 && +// arma.getPesoAux()!=null && arma.getPesoAux().compareTo(new BigDecimal(0))>0){ +// totalPersonaVendedor.setCantidadmovimiento(arma.getPesoAux()); +// if(totalPersonaVendedor.getTotal()==null){ +// totalPersonaVendedor.setTotal(arma.getPeso()); +// } +// } + totalPersonaVendedor.setCmovimiento(tarmMovimientoArmas.getPk()); + totalPersonaVendedor.setSaldoanterior(totalPersonaVendedor.getTotal()); + totalPersonaVendedor.setTotal(totalPersonaVendedor.getTotal().subtract(totalPersonaVendedor.getCantidadmovimiento())); + totalPersonaVendedor.setPk(getCtotal()); + em.merge(totalPersonaVendedor);em.flush(); + + //3.1. Se genera un registro de ING para el comprador + TarmTotalPersona totalPersonaComprador =totalPersona(em,arma.getCtipoarmaexplosivo(),tarmMovimientoArmas.getPersoncodecomprador()); + totalPersonaComprador.setCarma(arma.getPk()); + totalPersonaComprador.setIngresoegreso("ING"); + Date fechaActual1=new Date(); + fechaActual1.setSeconds(fechaActual1.getSeconds()+2); + totalPersonaComprador.setFecha(new Timestamp(fechaActual1.getTime())); + totalPersonaComprador.setCantidadmovimiento(new BigDecimal(arma.getCantidad())); + if(totalPersonaComprador.getTotal()==null){ + totalPersonaComprador.setTotal(new BigDecimal(0)); + } + + totalPersonaComprador.setCmovimiento(tarmMovimientoArmas.getPk()); + totalPersonaComprador.setSaldoanterior(totalPersonaComprador.getTotal()); + totalPersonaComprador.setTotal(totalPersonaComprador.getTotal().add(totalPersonaComprador.getCantidadmovimiento())); + totalPersonaComprador.setPk(getCtotal()); + em.merge(totalPersonaComprador); + + + //4 se genera un registro de arma con lo que se vende + TarmArmas armaVende= (TarmArmas)arma.cloneMe(); + armaVende.setPk(getCodigoArmas()); + armaVende.setEstado("VEND"); + armaVende.setFecharegistro(new java.sql.Date(new Date().getTime())); + if(armaVende.getCantidad()!=null && armaVende.getCantidad()>0 && armaVende.getValorAux()>0 ){ + armaVende.setCantidad(armaVende.getValorAux()); + } + if(armaVende.getPeso()!=null && armaVende.getPeso().compareTo(new BigDecimal(0))>0 && + armaVende.getPesoAux()!=null && armaVende.getPesoAux().compareTo(new BigDecimal(0))>0){ + armaVende.setPeso(armaVende.getPesoAux()); + } + em.persist(armaVende); + + //4.1 Nuevo registro Arma con el nuevo propietario + TarmArmas armaNuevoPropietario= (TarmArmas)arma.cloneMe(); + armaNuevoPropietario.setPk(getCodigoArmas()); + armaNuevoPropietario.setCregistro(registroArmaComprador.getPk()); + armaNuevoPropietario.setEstado("REG"); + Date fechaActual=new Date(); + fechaActual.setSeconds(fechaActual.getSeconds()+2); + armaNuevoPropietario.setFecharegistro(new java.sql.Date(fechaActual.getTime())); + if(armaNuevoPropietario.getCantidad()!=null && armaNuevoPropietario.getCantidad()>0 && armaNuevoPropietario.getValorAux()>0 ){ + armaNuevoPropietario.setCantidad(armaNuevoPropietario.getValorAux()); + } + if(armaNuevoPropietario.getPeso()!=null && armaNuevoPropietario.getPeso().compareTo(new BigDecimal(0))>0 && + armaNuevoPropietario.getPesoAux()!=null && armaNuevoPropietario.getPesoAux().compareTo(new BigDecimal(0))>0){ + armaNuevoPropietario.setPeso(armaNuevoPropietario.getPesoAux()); + } + em.persist(armaNuevoPropietario); + + } + + private String getCodigoArmas() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CARMA").toString(); + return codigoArma; + } + private Long getCodigoRegistro() throws Exception { + Sequence sequence = new Sequence(); + Long codigo = sequence.getNextValue("CREGISTRO").longValue(); + return codigo; + } + private String getCodigoMovimiento() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CMOVIMIENTO").toString(); + return codigoArma; + } + private String getCtotal() throws Exception { + Sequence sequence = new Sequence(); + String codigoArma = sequence.getNextValue("CTOTAL").toString(); + return codigoArma; + } + public TarmTotalPersona totalPersona(EntityManager em,String ctipoarmaexplosivo,Integer personcodigo) throws Exception{ + TarmTipoArmaExplosivo armaExplosivo= TarmTipoArmaExplosivo.find(em,ctipoarmaexplosivo); + + String sql ="select t from TarmTotalPersona t where t.clase='"+armaExplosivo.getClase()+"' and t.tipoarmaexplosivo='"+armaExplosivo.getTipoarmaexplosivo()+"' and t.unidadmedidapeso='"+armaExplosivo.getUnidadmedidapeso()+"' " + + " and t.personcodigo="+personcodigo+" and t.fecha =(select max(t1.fecha) from TarmTotalPersona t1" + + " where t1.clase='"+armaExplosivo.getClase()+"' and t1.tipoarmaexplosivo='"+armaExplosivo.getTipoarmaexplosivo()+"' and t1.unidadmedidapeso='"+armaExplosivo.getUnidadmedidapeso()+"' " + + " and t1.personcodigo="+personcodigo+")"; + System.out.println("query totalPersoan....:"+sql); + ListtarmTotalPersonas= em.createQuery(sql,TarmTotalPersona.class).getResultList(); + if(tarmTotalPersonas!=null && tarmTotalPersonas.size()>0){ + TarmTotalPersona total=(TarmTotalPersona)tarmTotalPersonas.get(0).cloneMe(); + total.setPk(null); + return total; + }else{ + TarmTotalPersona totalPersona= new TarmTotalPersona(); + totalPersona.setClase(armaExplosivo.getClase()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(armaExplosivo.getTipoarmaexplosivo()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setUnidadmedidapeso(armaExplosivo.getUnidadmedidapeso()); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setPersoncodigo(personcodigo); + totalPersona.setTotal(null); + totalPersona.setSaldoanterior(new BigDecimal(0)); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + return totalPersona; + } + } + +} diff --git a/base/business/armas/src/main/java/com/fp/armas/task/traspasodominio/TraspasoDominioAnula.java b/base/business/armas/src/main/java/com/fp/armas/task/traspasodominio/TraspasoDominioAnula.java new file mode 100644 index 0000000..04a315d --- /dev/null +++ b/base/business/armas/src/main/java/com/fp/armas/task/traspasodominio/TraspasoDominioAnula.java @@ -0,0 +1,51 @@ +package com.fp.armas.task.traspasodominio; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; + +import com.fp.armas.rules.exception.ControlArmasException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.fun.TarmVentaArmaTem; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.simple.action.TaskAction; + +/** + * + * @version 2.1 + */ +public class TraspasoDominioAnula extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + EntityManager em=PersistenceHelper.getEntityManager(); + System.out.println("Ingresa a traspaso dominio"); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + m.put("grupo",null); + throw new ControlArmasException("BPM-0014", "SIN CODIGO", ""); + } + String csolicitud=mrequest.get("csolicitud").toString(); + TarmArmas arma= TarmArmas.find(em, csolicitud); + Listlistaventa= em.createQuery("select p from TarmVentaArmaTem p where p.carma=:carma and p.estado=:estado") + .setParameter("carma", arma.getPk()) + .setParameter("estado", "PENDIENTE") + .getResultList(); + for (TarmVentaArmaTem item : listaventa) { + item.setEstado("RECHAZADO"); + em.merge(item); + } + arma.setEstadoventa(null); + em.merge(arma); + } + +} diff --git a/base/business/armas/src/test/.svn/entries b/base/business/armas/src/test/.svn/entries new file mode 100644 index 0000000..fc8c7bd --- /dev/null +++ b/base/business/armas/src/test/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + diff --git a/base/business/armas/src/test/java/.svn/entries b/base/business/armas/src/test/java/.svn/entries new file mode 100644 index 0000000..b7f60cc --- /dev/null +++ b/base/business/armas/src/test/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/test/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/business/armas/src/test/java/com/.svn/entries b/base/business/armas/src/test/java/com/.svn/entries new file mode 100644 index 0000000..b77c720 --- /dev/null +++ b/base/business/armas/src/test/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/test/java/com +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/business/armas/src/test/java/com/fp/.svn/entries b/base/business/armas/src/test/java/com/fp/.svn/entries new file mode 100644 index 0000000..f1ca8b7 --- /dev/null +++ b/base/business/armas/src/test/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/test/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +base +dir + diff --git a/base/business/armas/src/test/java/com/fp/base/.svn/entries b/base/business/armas/src/test/java/com/fp/base/.svn/entries new file mode 100644 index 0000000..e46be4c --- /dev/null +++ b/base/business/armas/src/test/java/com/fp/base/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/test/java/com/fp/base +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +business +dir + diff --git a/base/business/armas/src/test/java/com/fp/base/business/.svn/entries b/base/business/armas/src/test/java/com/fp/base/business/.svn/entries new file mode 100644 index 0000000..22dd0de --- /dev/null +++ b/base/business/armas/src/test/java/com/fp/base/business/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/armas/src/test/java/com/fp/base/business +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/business/armas/target/armas-2.1.jar b/base/business/armas/target/armas-2.1.jar new file mode 100644 index 0000000..259f704 Binary files /dev/null and b/base/business/armas/target/armas-2.1.jar differ diff --git a/base/business/armas/target/classes/com/fp/armas/mail/PersonaDireccion.class b/base/business/armas/target/classes/com/fp/armas/mail/PersonaDireccion.class new file mode 100644 index 0000000..155c8d4 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/mail/PersonaDireccion.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/mail/PersonaDireccionVentaTemp.class b/base/business/armas/target/classes/com/fp/armas/mail/PersonaDireccionVentaTemp.class new file mode 100644 index 0000000..acc69cd Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/mail/PersonaDireccionVentaTemp.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/mail/ScheduleNotificacionCliente.class b/base/business/armas/target/classes/com/fp/armas/mail/ScheduleNotificacionCliente.class new file mode 100644 index 0000000..f7c86e7 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/mail/ScheduleNotificacionCliente.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/mail/SolicitanteDireccion.class b/base/business/armas/target/classes/com/fp/armas/mail/SolicitanteDireccion.class new file mode 100644 index 0000000..373e7bb Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/mail/SolicitanteDireccion.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/exception/ControlArmasException.class b/base/business/armas/target/classes/com/fp/armas/rules/exception/ControlArmasException.class new file mode 100644 index 0000000..70da159 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/exception/ControlArmasException.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/documentos/DocumentoQuery.class b/base/business/armas/target/classes/com/fp/armas/rules/query/documentos/DocumentoQuery.class new file mode 100644 index 0000000..d46f245 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/documentos/DocumentoQuery.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/general/ArmasQuery.class b/base/business/armas/target/classes/com/fp/armas/rules/query/general/ArmasQuery.class new file mode 100644 index 0000000..67afddd Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/general/ArmasQuery.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/ordenTrabajoCustodios/OrdenTrabajoQuery.class b/base/business/armas/target/classes/com/fp/armas/rules/query/ordenTrabajoCustodios/OrdenTrabajoQuery.class new file mode 100644 index 0000000..2803686 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/ordenTrabajoCustodios/OrdenTrabajoQuery.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/ArmasXPersonaQuery.class b/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/ArmasXPersonaQuery.class new file mode 100644 index 0000000..a3b45cf Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/ArmasXPersonaQuery.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/CashHistoricoSecuencial.class b/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/CashHistoricoSecuencial.class new file mode 100644 index 0000000..83b0c50 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/CashHistoricoSecuencial.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/CashManagementQuery.class b/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/CashManagementQuery.class new file mode 100644 index 0000000..85ebd0b Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/CashManagementQuery.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/CertificadoFiscaliaSecuencial.class b/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/CertificadoFiscaliaSecuencial.class new file mode 100644 index 0000000..59cfc31 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/CertificadoFiscaliaSecuencial.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/CompletaDatosInspeccionPlan.class b/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/CompletaDatosInspeccionPlan.class new file mode 100644 index 0000000..3bade01 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/CompletaDatosInspeccionPlan.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/CompletaInfoVerificarDocumentos.class b/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/CompletaInfoVerificarDocumentos.class new file mode 100644 index 0000000..161e1c1 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/CompletaInfoVerificarDocumentos.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/ScheduleXMLSolicitud.class b/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/ScheduleXMLSolicitud.class new file mode 100644 index 0000000..5725a92 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/ScheduleXMLSolicitud.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/SolicitudSecuencial.class b/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/SolicitudSecuencial.class new file mode 100644 index 0000000..1bbeecb Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/SolicitudSecuencial.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/VerificarArmaQuery.class b/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/VerificarArmaQuery.class new file mode 100644 index 0000000..bf20123 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/VerificarArmaQuery.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/VerificarInfoCertificado.class b/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/VerificarInfoCertificado.class new file mode 100644 index 0000000..8bc2e16 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/solicitud/VerificarInfoCertificado.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/ArmasId.class b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/ArmasId.class new file mode 100644 index 0000000..bd89ac9 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/ArmasId.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/ColaImpresion.class b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/ColaImpresion.class new file mode 100644 index 0000000..a03a1e7 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/ColaImpresion.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/ConsultaImpresionProceso.class b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/ConsultaImpresionProceso.class new file mode 100644 index 0000000..e9cd1b9 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/ConsultaImpresionProceso.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/ConsultaLogin.class b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/ConsultaLogin.class new file mode 100644 index 0000000..e20a757 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/ConsultaLogin.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/ConsultaXpathDocumento.class b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/ConsultaXpathDocumento.class new file mode 100644 index 0000000..e4319a6 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/ConsultaXpathDocumento.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/DatosPerson.class b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/DatosPerson.class new file mode 100644 index 0000000..2c6c903 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/DatosPerson.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/ImagenPersona.class b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/ImagenPersona.class new file mode 100644 index 0000000..1914ac9 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/ImagenPersona.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/JefeCentroImpresion.class b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/JefeCentroImpresion.class new file mode 100644 index 0000000..426c88a Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/JefeCentroImpresion.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/util/ArmaUtil.class b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/util/ArmaUtil.class new file mode 100644 index 0000000..3fd80d3 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/util/ArmaUtil.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/util/CatalogoUtil.class b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/util/CatalogoUtil.class new file mode 100644 index 0000000..bfb5cd4 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/util/CatalogoUtil.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/util/ColaImpresionUtil.class b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/util/ColaImpresionUtil.class new file mode 100644 index 0000000..2ba6db0 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/util/ColaImpresionUtil.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/util/InstitucionSnapEnum.class b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/util/InstitucionSnapEnum.class new file mode 100644 index 0000000..a95f79f Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/util/InstitucionSnapEnum.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/util/PersonaUtil.class b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/util/PersonaUtil.class new file mode 100644 index 0000000..884f4d3 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/query/webservices/util/PersonaUtil.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/armas/ArmasRegistro.class b/base/business/armas/target/classes/com/fp/armas/rules/save/armas/ArmasRegistro.class new file mode 100644 index 0000000..2fc246c Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/armas/ArmasRegistro.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/armas/AuxCodigoArma.class b/base/business/armas/target/classes/com/fp/armas/rules/save/armas/AuxCodigoArma.class new file mode 100644 index 0000000..7d3d9bc Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/armas/AuxCodigoArma.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/armas/CambiarUsuarioArma.class b/base/business/armas/target/classes/com/fp/armas/rules/save/armas/CambiarUsuarioArma.class new file mode 100644 index 0000000..7e79858 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/armas/CambiarUsuarioArma.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/armas/ImporteArma.class b/base/business/armas/target/classes/com/fp/armas/rules/save/armas/ImporteArma.class new file mode 100644 index 0000000..c0eb1a2 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/armas/ImporteArma.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/armas/ImporteArmaExcel.class b/base/business/armas/target/classes/com/fp/armas/rules/save/armas/ImporteArmaExcel.class new file mode 100644 index 0000000..4afd352 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/armas/ImporteArmaExcel.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/armas/ReporteArmasDecomisadas.class b/base/business/armas/target/classes/com/fp/armas/rules/save/armas/ReporteArmasDecomisadas.class new file mode 100644 index 0000000..87b3027 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/armas/ReporteArmasDecomisadas.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/calificacion/Calificacion.class b/base/business/armas/target/classes/com/fp/armas/rules/save/calificacion/Calificacion.class new file mode 100644 index 0000000..b13f374 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/calificacion/Calificacion.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/calificacion/EvaluacionPsicologica.class b/base/business/armas/target/classes/com/fp/armas/rules/save/calificacion/EvaluacionPsicologica.class new file mode 100644 index 0000000..c742000 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/calificacion/EvaluacionPsicologica.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/calificacion/EvaluarGuardia.class b/base/business/armas/target/classes/com/fp/armas/rules/save/calificacion/EvaluarGuardia.class new file mode 100644 index 0000000..2d5f835 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/calificacion/EvaluarGuardia.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/funcionalidad/Movimiento.class b/base/business/armas/target/classes/com/fp/armas/rules/save/funcionalidad/Movimiento.class new file mode 100644 index 0000000..427ab36 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/funcionalidad/Movimiento.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/funcionalidad/Sancionar.class b/base/business/armas/target/classes/com/fp/armas/rules/save/funcionalidad/Sancionar.class new file mode 100644 index 0000000..3bb654d Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/funcionalidad/Sancionar.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/funcionalidad/VentasVariasArmasMovimiento.class b/base/business/armas/target/classes/com/fp/armas/rules/save/funcionalidad/VentasVariasArmasMovimiento.class new file mode 100644 index 0000000..943cf2b Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/funcionalidad/VentasVariasArmasMovimiento.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/inspeccion/ModificarPlanificacionInspeccionSave.class b/base/business/armas/target/classes/com/fp/armas/rules/save/inspeccion/ModificarPlanificacionInspeccionSave.class new file mode 100644 index 0000000..8c18d06 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/inspeccion/ModificarPlanificacionInspeccionSave.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/inspeccion/PlanificacionInspeccionSave.class b/base/business/armas/target/classes/com/fp/armas/rules/save/inspeccion/PlanificacionInspeccionSave.class new file mode 100644 index 0000000..72724a5 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/inspeccion/PlanificacionInspeccionSave.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/pcustomer/PeopleFastSave.class b/base/business/armas/target/classes/com/fp/armas/rules/save/pcustomer/PeopleFastSave.class new file mode 100644 index 0000000..055b670 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/pcustomer/PeopleFastSave.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/ActualizaReimpresion.class b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/ActualizaReimpresion.class new file mode 100644 index 0000000..63de617 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/ActualizaReimpresion.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/CustodiaTemporal.class b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/CustodiaTemporal.class new file mode 100644 index 0000000..dfd527e Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/CustodiaTemporal.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/DecomisoArmaRecepcion.class b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/DecomisoArmaRecepcion.class new file mode 100644 index 0000000..3ae4323 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/DecomisoArmaRecepcion.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/DecomisoArmaTransaccion.class b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/DecomisoArmaTransaccion.class new file mode 100644 index 0000000..d60d081 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/DecomisoArmaTransaccion.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/DecomisoMaterial.class b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/DecomisoMaterial.class new file mode 100644 index 0000000..7f3d828 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/DecomisoMaterial.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/DocumentoHabilitanteTransaccion.class b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/DocumentoHabilitanteTransaccion.class new file mode 100644 index 0000000..ed4d459 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/DocumentoHabilitanteTransaccion.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/OrdenTrabajoSave.class b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/OrdenTrabajoSave.class new file mode 100644 index 0000000..3495acc Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/OrdenTrabajoSave.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/RegistroInspeccion.class b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/RegistroInspeccion.class new file mode 100644 index 0000000..ffb4c30 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/RegistroInspeccion.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/Requisitos.class b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/Requisitos.class new file mode 100644 index 0000000..e25895f Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/Requisitos.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/Solicitud.class b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/Solicitud.class new file mode 100644 index 0000000..d0724e1 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitud/Solicitud.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/solicitudimportacion/CompletarDesaduanizacion.class b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitudimportacion/CompletarDesaduanizacion.class new file mode 100644 index 0000000..d710bf6 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitudimportacion/CompletarDesaduanizacion.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/solicitudimportacion/ImportacionProduccion.class b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitudimportacion/ImportacionProduccion.class new file mode 100644 index 0000000..8a16077 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitudimportacion/ImportacionProduccion.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/solicitudimportacion/IngresoInventario.class b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitudimportacion/IngresoInventario.class new file mode 100644 index 0000000..293ab2c Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitudimportacion/IngresoInventario.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/solicitudimportacion/Inventarios.class b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitudimportacion/Inventarios.class new file mode 100644 index 0000000..f8a1cc7 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitudimportacion/Inventarios.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/solicitudimportacion/PreviaImportacionDesgloce.class b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitudimportacion/PreviaImportacionDesgloce.class new file mode 100644 index 0000000..6b033a2 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitudimportacion/PreviaImportacionDesgloce.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/solicitudimportacion/SolicitudImportacion.class b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitudimportacion/SolicitudImportacion.class new file mode 100644 index 0000000..cee8887 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/solicitudimportacion/SolicitudImportacion.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/webservices/DesvinculaTagArma.class b/base/business/armas/target/classes/com/fp/armas/rules/save/webservices/DesvinculaTagArma.class new file mode 100644 index 0000000..1958edf Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/webservices/DesvinculaTagArma.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/webservices/DocumentoDatos.class b/base/business/armas/target/classes/com/fp/armas/rules/save/webservices/DocumentoDatos.class new file mode 100644 index 0000000..73a3cb8 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/webservices/DocumentoDatos.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/webservices/DocumentoHabilitanteDatos.class b/base/business/armas/target/classes/com/fp/armas/rules/save/webservices/DocumentoHabilitanteDatos.class new file mode 100644 index 0000000..d35f6e3 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/webservices/DocumentoHabilitanteDatos.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/webservices/IngresaLectura.class b/base/business/armas/target/classes/com/fp/armas/rules/save/webservices/IngresaLectura.class new file mode 100644 index 0000000..6bf7338 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/webservices/IngresaLectura.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/rules/save/webservices/VinculaTagArma.class b/base/business/armas/target/classes/com/fp/armas/rules/save/webservices/VinculaTagArma.class new file mode 100644 index 0000000..5ab94e8 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/rules/save/webservices/VinculaTagArma.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/ActualizarInventBajaDestrucc.class b/base/business/armas/target/classes/com/fp/armas/task/ActualizarInventBajaDestrucc.class new file mode 100644 index 0000000..c18c95e Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/ActualizarInventBajaDestrucc.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/ActualizarInventario.class b/base/business/armas/target/classes/com/fp/armas/task/ActualizarInventario.class new file mode 100644 index 0000000..67998a4 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/ActualizarInventario.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/ActualizarPlanificacion.class b/base/business/armas/target/classes/com/fp/armas/task/ActualizarPlanificacion.class new file mode 100644 index 0000000..83fc115 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/ActualizarPlanificacion.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/ActualizarRutaArchivo.class b/base/business/armas/target/classes/com/fp/armas/task/ActualizarRutaArchivo.class new file mode 100644 index 0000000..b25857b Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/ActualizarRutaArchivo.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/AplicarSancion.class b/base/business/armas/target/classes/com/fp/armas/task/AplicarSancion.class new file mode 100644 index 0000000..2dc6f7f Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/AplicarSancion.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/EmitirComprobanteCaja.class b/base/business/armas/target/classes/com/fp/armas/task/EmitirComprobanteCaja.class new file mode 100644 index 0000000..7a63847 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/EmitirComprobanteCaja.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/FechaCaducidadEstadoArma.class b/base/business/armas/target/classes/com/fp/armas/task/FechaCaducidadEstadoArma.class new file mode 100644 index 0000000..76e37aa Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/FechaCaducidadEstadoArma.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/FinalizarDocumentoHabilitante.class b/base/business/armas/target/classes/com/fp/armas/task/FinalizarDocumentoHabilitante.class new file mode 100644 index 0000000..32efd76 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/FinalizarDocumentoHabilitante.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/GenerarValorACancelar.class b/base/business/armas/target/classes/com/fp/armas/task/GenerarValorACancelar.class new file mode 100644 index 0000000..67437a7 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/GenerarValorACancelar.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/ObtieneCentroControl.class b/base/business/armas/target/classes/com/fp/armas/task/ObtieneCentroControl.class new file mode 100644 index 0000000..856542b Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/ObtieneCentroControl.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/ObtienerCategoriaTramite.class b/base/business/armas/target/classes/com/fp/armas/task/ObtienerCategoriaTramite.class new file mode 100644 index 0000000..e09a158 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/ObtienerCategoriaTramite.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/RechazarActa.class b/base/business/armas/target/classes/com/fp/armas/task/RechazarActa.class new file mode 100644 index 0000000..c306fcc Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/RechazarActa.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/RequiereInspeccion.class b/base/business/armas/target/classes/com/fp/armas/task/RequiereInspeccion.class new file mode 100644 index 0000000..4ba7589 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/RequiereInspeccion.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/TipoArchivoControl.class b/base/business/armas/target/classes/com/fp/armas/task/TipoArchivoControl.class new file mode 100644 index 0000000..bb0b8b2 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/TipoArchivoControl.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/TipoDocumento.class b/base/business/armas/target/classes/com/fp/armas/task/TipoDocumento.class new file mode 100644 index 0000000..9d2d512 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/TipoDocumento.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/TramiteAnulado.class b/base/business/armas/target/classes/com/fp/armas/task/TramiteAnulado.class new file mode 100644 index 0000000..b3a11a1 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/TramiteAnulado.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/TramiteAprobado.class b/base/business/armas/target/classes/com/fp/armas/task/TramiteAprobado.class new file mode 100644 index 0000000..d70959c Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/TramiteAprobado.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/ValAutorizacionPreviaImporta.class b/base/business/armas/target/classes/com/fp/armas/task/ValAutorizacionPreviaImporta.class new file mode 100644 index 0000000..973a08c Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/ValAutorizacionPreviaImporta.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/ValidaFlujoCargaDeposito.class b/base/business/armas/target/classes/com/fp/armas/task/ValidaFlujoCargaDeposito.class new file mode 100644 index 0000000..b5a93e7 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/ValidaFlujoCargaDeposito.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/ValidaInspeccion.class b/base/business/armas/target/classes/com/fp/armas/task/ValidaInspeccion.class new file mode 100644 index 0000000..46198ea Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/ValidaInspeccion.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/ValidacionDecomiso.class b/base/business/armas/target/classes/com/fp/armas/task/ValidacionDecomiso.class new file mode 100644 index 0000000..a4bab65 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/ValidacionDecomiso.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/ValidacionGrupo.class b/base/business/armas/target/classes/com/fp/armas/task/ValidacionGrupo.class new file mode 100644 index 0000000..9d0365e Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/ValidacionGrupo.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/ValidacionGrupoDecRecep.class b/base/business/armas/target/classes/com/fp/armas/task/ValidacionGrupoDecRecep.class new file mode 100644 index 0000000..7c3ec67 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/ValidacionGrupoDecRecep.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/ValidarCustodios.class b/base/business/armas/target/classes/com/fp/armas/task/ValidarCustodios.class new file mode 100644 index 0000000..db4d00e Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/ValidarCustodios.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/ValidarUnidadInstitucion.class b/base/business/armas/target/classes/com/fp/armas/task/ValidarUnidadInstitucion.class new file mode 100644 index 0000000..771dc2c Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/ValidarUnidadInstitucion.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/VerificarCantidadArmas.class b/base/business/armas/target/classes/com/fp/armas/task/VerificarCantidadArmas.class new file mode 100644 index 0000000..5022c32 Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/VerificarCantidadArmas.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/traspasodominio/TraspasoDominio.class b/base/business/armas/target/classes/com/fp/armas/task/traspasodominio/TraspasoDominio.class new file mode 100644 index 0000000..f377f8d Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/traspasodominio/TraspasoDominio.class differ diff --git a/base/business/armas/target/classes/com/fp/armas/task/traspasodominio/TraspasoDominioAnula.class b/base/business/armas/target/classes/com/fp/armas/task/traspasodominio/TraspasoDominioAnula.class new file mode 100644 index 0000000..70a176e Binary files /dev/null and b/base/business/armas/target/classes/com/fp/armas/task/traspasodominio/TraspasoDominioAnula.class differ diff --git a/base/business/armas/target/maven-archiver/pom.properties b/base/business/armas/target/maven-archiver/pom.properties new file mode 100644 index 0000000..8fc7e29 --- /dev/null +++ b/base/business/armas/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:53:21 ECT 2022 +version=2.1 +groupId=com.fp.base.business +artifactId=armas diff --git a/base/business/general/.svn/dir-prop-base b/base/business/general/.svn/dir-prop-base new file mode 100644 index 0000000..3e2a6f2 --- /dev/null +++ b/base/business/general/.svn/dir-prop-base @@ -0,0 +1,9 @@ +K 10 +svn:ignore +V 37 +.classpath +.project +.settings +target + +END diff --git a/base/business/general/.svn/entries b/base/business/general/.svn/entries new file mode 100644 index 0000000..dc8bad0 --- /dev/null +++ b/base/business/general/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general +svn://172.17.26.185/COMACO + + + +2021-08-26T17:51:29.138509Z +4639 +usermaia1 +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:44.709812Z +d02ec7e8d99f8e48b344919ea74aca64 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1787 + diff --git a/base/business/general/.svn/text-base/pom.xml.svn-base b/base/business/general/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..540e64b --- /dev/null +++ b/base/business/general/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,53 @@ + + + + business + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.business + general + general + + + com.fp.base.business + person + 2.1 + + + com.fp.base.persistence + pgeneral + 2.1 + + + com.fp.base + sessionbeans + 2.1 + + + quartz + quartz + 1.5.2-brew + provided + + + com.fp.base.bpm + bpmlib + 2.1 + + + com.fp.base.bpm + simple + 2.1 + + + + + diff --git a/base/business/general/pom.xml b/base/business/general/pom.xml new file mode 100644 index 0000000..540e64b --- /dev/null +++ b/base/business/general/pom.xml @@ -0,0 +1,53 @@ + + + + business + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.business + general + general + + + com.fp.base.business + person + 2.1 + + + com.fp.base.persistence + pgeneral + 2.1 + + + com.fp.base + sessionbeans + 2.1 + + + quartz + quartz + 1.5.2-brew + provided + + + com.fp.base.bpm + bpmlib + 2.1 + + + com.fp.base.bpm + simple + 2.1 + + + + + diff --git a/base/business/general/src/.svn/entries b/base/business/general/src/.svn/entries new file mode 100644 index 0000000..cd45d5b --- /dev/null +++ b/base/business/general/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src +svn://172.17.26.185/COMACO + + + +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/base/business/general/src/main/.svn/entries b/base/business/general/src/main/.svn/entries new file mode 100644 index 0000000..5020924 --- /dev/null +++ b/base/business/general/src/main/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main +svn://172.17.26.185/COMACO + + + +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/business/general/src/main/java/.svn/entries b/base/business/general/src/main/java/.svn/entries new file mode 100644 index 0000000..53fda76 --- /dev/null +++ b/base/business/general/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java +svn://172.17.26.185/COMACO + + + +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/business/general/src/main/java/com/.svn/entries b/base/business/general/src/main/java/com/.svn/entries new file mode 100644 index 0000000..fe7a46d --- /dev/null +++ b/base/business/general/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com +svn://172.17.26.185/COMACO + + + +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/business/general/src/main/java/com/fp/.svn/entries b/base/business/general/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..12e77bf --- /dev/null +++ b/base/business/general/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +general +dir + diff --git a/base/business/general/src/main/java/com/fp/general/.svn/entries b/base/business/general/src/main/java/com/fp/general/.svn/entries new file mode 100644 index 0000000..8733576 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/.svn/entries @@ -0,0 +1,64 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general +svn://172.17.26.185/COMACO + + + +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +helper +dir + +keygen +dir + +application +dir + +db +dir + +security +dir + +rules +dir + +score +dir + +exception +dir + +rates +dir + +record +dir + +scheduler +dir + +templates +dir + diff --git a/base/business/general/src/main/java/com/fp/general/application/.svn/entries b/base/business/general/src/main/java/com/fp/general/application/.svn/entries new file mode 100644 index 0000000..da3f462 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/application/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/application +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +OfficerDescription.java +file + + + + +2022-07-28T03:40:43.328806Z +bba1e2ab895cb0df78b061a8c8c21380 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1186 + +ClientApproval.java +file + + + + +2022-07-28T03:40:43.328806Z +907ec788d08406b4394c87e68d5e7322 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3997 + diff --git a/base/business/general/src/main/java/com/fp/general/application/.svn/text-base/ClientApproval.java.svn-base b/base/business/general/src/main/java/com/fp/general/application/.svn/text-base/ClientApproval.java.svn-base new file mode 100644 index 0000000..dcd63f7 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/application/.svn/text-base/ClientApproval.java.svn-base @@ -0,0 +1,113 @@ +package com.fp.general.application; + +import java.util.List; + +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.common.helper.BeanManager; +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.auth.TgeneSolicitudeClientdata; +import com.fp.simple.dto.Responses; + +/** + * Calse que valida que este revisado los datos de clientes. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class ClientApproval extends TransactionRule { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + List ldata = pSaveRequest.getSaveBeanModifiedRecords("TGENESOLICITUDECLIENTDATA"); + if ((ldata == null) || ldata.isEmpty()) { + return pSaveRequest; + } + TgeneSolicitudeClientdata client = (TgeneSolicitudeClientdata) ldata.get(0); + List ldatabasedata = TgeneSolicitudeClientdata.find(PersistenceHelper.getEntityManager(), client.getPk() + .getSolicitudnumber(), client.getPk().getSolicitudsequence()); + if ((pSaveRequest.get(TaskUtil.BPM_TID) != null) && this.validate(ldata, ldatabasedata)) { + pSaveRequest.put(TaskUtil.BPM_STATUS, Responses.OK.getCode()); + } else { + pSaveRequest.put(TaskUtil.BPM_STATUS, null); + pSaveRequest.put(TaskUtil.BPM_TID, null); + } + return pSaveRequest; + } + + /** + * Verifica que los datos de de cleintes esten aprobados. + * + * @param ldata Datos de aprobacion que llegan en el request. + * @param ldatabasedata Datos de aprobacion que almacenados en la base de datos. + * @return boolean + * @throws Exception + */ + private boolean validate(List ldata, List ldatabasedata) throws Exception { + if (!this.validateData(ldata)) { + return false; + } + for (TgeneSolicitudeClientdata obj : ldatabasedata) { + if (!this.validateByRecord(obj, ldata)) { + return false; + } + } + return true; + } + + /** + * Valida que la informacion que llega en el request este aprobada, si no esta aprobada retorna false. + * + * @param ldata Datos de aprobacion que llegan en el request. + * @return boolean + * @throws Exception + */ + private boolean validateData(List ldata) throws Exception { + for (Object object : ldata) { + if (!Constant.ifYes(((TgeneSolicitudeClientdata) object).getChecked())) { + return false; + } + } + return true; + } + + /** + * Valida que el registro de verificacion de datos de clientes este aprobado, sea en los datos que llegan en el + * request o este haya sido aprobado con anterioridad. + * + * @param client Datos de la base a verificar que el registro este aprobado. + * @param ldata Lista de datos de aprobacion que llegan en el request. + * @return boolean. + * @throws Exception + */ + private boolean validateByRecord(TgeneSolicitudeClientdata client, List ldata) throws Exception { + for (Object object : ldata) { + TgeneSolicitudeClientdata obj = (TgeneSolicitudeClientdata) object; + if (BeanManager.compareObject(client.getPk(), obj.getPk())) { + return true; + } + } + if (Constant.ifYes(client.getChecked())) { + return true; + } + return false; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/application/.svn/text-base/OfficerDescription.java.svn-base b/base/business/general/src/main/java/com/fp/general/application/.svn/text-base/OfficerDescription.java.svn-base new file mode 100644 index 0000000..6e2c458 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/application/.svn/text-base/OfficerDescription.java.svn-base @@ -0,0 +1,32 @@ +package com.fp.general.application; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.gene.TgeneSolicitude; + +/** + * Clase que se encarga de obtener la descripcin del oficial de la solicitud. + * + * @author Andres E. Carpio + * @version 1.0 + */ +public class OfficerDescription extends QueryRule { + /** Constante SQL. */ + private final static String SQL = "select name from TcustPersonDetail where personcode=(select personcode from TsafeUser where usercode=:userCode)"; + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + TgeneSolicitude tgeneSolicitude = (TgeneSolicitude) response.get("TGENESOLICITUDE"); + + javax.persistence.Query qry = PersistenceHelper.createNativeQuery(OfficerDescription.SQL); + qry.setParameter("userCode", tgeneSolicitude.getOfficer()); + + tgeneSolicitude.addAddtionalInfo("officerdescription", qry.getResultList()); + + return pQueryRequest; + + } +} diff --git a/base/business/general/src/main/java/com/fp/general/application/ClientApproval.java b/base/business/general/src/main/java/com/fp/general/application/ClientApproval.java new file mode 100644 index 0000000..dcd63f7 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/application/ClientApproval.java @@ -0,0 +1,113 @@ +package com.fp.general.application; + +import java.util.List; + +import com.fp.bpmlib.task.client.TaskUtil; +import com.fp.common.helper.BeanManager; +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.auth.TgeneSolicitudeClientdata; +import com.fp.simple.dto.Responses; + +/** + * Calse que valida que este revisado los datos de clientes. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class ClientApproval extends TransactionRule { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + List ldata = pSaveRequest.getSaveBeanModifiedRecords("TGENESOLICITUDECLIENTDATA"); + if ((ldata == null) || ldata.isEmpty()) { + return pSaveRequest; + } + TgeneSolicitudeClientdata client = (TgeneSolicitudeClientdata) ldata.get(0); + List ldatabasedata = TgeneSolicitudeClientdata.find(PersistenceHelper.getEntityManager(), client.getPk() + .getSolicitudnumber(), client.getPk().getSolicitudsequence()); + if ((pSaveRequest.get(TaskUtil.BPM_TID) != null) && this.validate(ldata, ldatabasedata)) { + pSaveRequest.put(TaskUtil.BPM_STATUS, Responses.OK.getCode()); + } else { + pSaveRequest.put(TaskUtil.BPM_STATUS, null); + pSaveRequest.put(TaskUtil.BPM_TID, null); + } + return pSaveRequest; + } + + /** + * Verifica que los datos de de cleintes esten aprobados. + * + * @param ldata Datos de aprobacion que llegan en el request. + * @param ldatabasedata Datos de aprobacion que almacenados en la base de datos. + * @return boolean + * @throws Exception + */ + private boolean validate(List ldata, List ldatabasedata) throws Exception { + if (!this.validateData(ldata)) { + return false; + } + for (TgeneSolicitudeClientdata obj : ldatabasedata) { + if (!this.validateByRecord(obj, ldata)) { + return false; + } + } + return true; + } + + /** + * Valida que la informacion que llega en el request este aprobada, si no esta aprobada retorna false. + * + * @param ldata Datos de aprobacion que llegan en el request. + * @return boolean + * @throws Exception + */ + private boolean validateData(List ldata) throws Exception { + for (Object object : ldata) { + if (!Constant.ifYes(((TgeneSolicitudeClientdata) object).getChecked())) { + return false; + } + } + return true; + } + + /** + * Valida que el registro de verificacion de datos de clientes este aprobado, sea en los datos que llegan en el + * request o este haya sido aprobado con anterioridad. + * + * @param client Datos de la base a verificar que el registro este aprobado. + * @param ldata Lista de datos de aprobacion que llegan en el request. + * @return boolean. + * @throws Exception + */ + private boolean validateByRecord(TgeneSolicitudeClientdata client, List ldata) throws Exception { + for (Object object : ldata) { + TgeneSolicitudeClientdata obj = (TgeneSolicitudeClientdata) object; + if (BeanManager.compareObject(client.getPk(), obj.getPk())) { + return true; + } + } + if (Constant.ifYes(client.getChecked())) { + return true; + } + return false; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/application/OfficerDescription.java b/base/business/general/src/main/java/com/fp/general/application/OfficerDescription.java new file mode 100644 index 0000000..6e2c458 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/application/OfficerDescription.java @@ -0,0 +1,32 @@ +package com.fp.general.application; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.gene.TgeneSolicitude; + +/** + * Clase que se encarga de obtener la descripcin del oficial de la solicitud. + * + * @author Andres E. Carpio + * @version 1.0 + */ +public class OfficerDescription extends QueryRule { + /** Constante SQL. */ + private final static String SQL = "select name from TcustPersonDetail where personcode=(select personcode from TsafeUser where usercode=:userCode)"; + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + TgeneSolicitude tgeneSolicitude = (TgeneSolicitude) response.get("TGENESOLICITUDE"); + + javax.persistence.Query qry = PersistenceHelper.createNativeQuery(OfficerDescription.SQL); + qry.setParameter("userCode", tgeneSolicitude.getOfficer()); + + tgeneSolicitude.addAddtionalInfo("officerdescription", qry.getResultList()); + + return pQueryRequest; + + } +} diff --git a/base/business/general/src/main/java/com/fp/general/db/.svn/entries b/base/business/general/src/main/java/com/fp/general/db/.svn/entries new file mode 100644 index 0000000..4695857 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/db/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/db +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +DataHelper.java +file + + + + +2022-07-28T03:40:43.361806Z +297d9391100f75c79dee906906b90bfb +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +19512 + diff --git a/base/business/general/src/main/java/com/fp/general/db/.svn/text-base/DataHelper.java.svn-base b/base/business/general/src/main/java/com/fp/general/db/.svn/text-base/DataHelper.java.svn-base new file mode 100644 index 0000000..87c4a27 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/db/.svn/text-base/DataHelper.java.svn-base @@ -0,0 +1,473 @@ +package com.fp.general.db; + +import java.sql.Date; +import java.sql.Timestamp; +import java.util.List; +import java.util.Map; + +import com.fp.common.helper.CalculationBase; +import com.fp.common.helper.Constant; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.cache.CacheManager; +import com.fp.persistence.commondb.helper.APPDates; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.acco.TgeneAccount; +import com.fp.persistence.pgeneral.acco.TgeneAccountStatus; +import com.fp.persistence.pgeneral.acco.TgeneAccountStatusKey; +import com.fp.persistence.pgeneral.auth.TgeneSolicitudeClientdata; +import com.fp.persistence.pgeneral.auth.TgeneSolicitudeExceptions; +import com.fp.persistence.pgeneral.charge.TgeneCharges; +import com.fp.persistence.pgeneral.charge.TgeneSubProductCharges; +import com.fp.persistence.pgeneral.gene.TgeneBranch; +import com.fp.persistence.pgeneral.gene.TgeneSolicitude; +import com.fp.persistence.pgeneral.gene.TgeneSolicitudeRelationship; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevel; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelDesc; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelTran; +import com.fp.persistence.pgeneral.menu.TgeneMenuProfile; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevel; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelDesc; +import com.fp.persistence.pgeneral.product.TgeneModule; +import com.fp.persistence.pgeneral.product.TgeneProduct; +import com.fp.persistence.pgeneral.product.TgeneSubProduct; +import com.fp.persistence.pgeneral.product.TgeneSubprodClientData; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserProfile; +import com.fp.persistence.pgeneral.score.TgenePercentScore; +import com.fp.persistence.pgeneral.score.TgenePercentScoreKey; +import com.fp.persistence.pgeneral.score.TgeneScoreRank; + +/** + * Clase utilitaria que maneje sql y hql utiliada en el proyecto general. + * + * @author Jorge Vaca + * @version 2.1 + */ +public final class DataHelper { + + /** Almacena una instancia de DataHelper. */ + private static DataHelper cache; + + /** + * Entrega una instancia de DataHelper. + * + * @return DataHelper + */ + public static DataHelper getInstance() { + if (DataHelper.cache != null) { + return DataHelper.cache; + } + synchronized (DataHelper.class) { + if (DataHelper.cache == null) { + DataHelper.cache = new DataHelper(); + } + } + return DataHelper.cache; + } + + /** + * Metodo que entrega datos de una sucursal definidos en TgeneBranch. + * + * @param pBranch Codigo de sucursal. + * @param pCompany Compania a la que pertenece la cuenta. + * @return TgeneBranch + * @throws Exception + */ + public TgeneBranch getTgeneBranch(Integer pBranch, Integer pCompany) throws Exception { + return TgeneBranch.find(PersistenceHelper.getEntityManager(), pBranch, pCompany); + } + + /** + * Metodo que entrega datos de TgeneMenuProfile. + * + * @param pProfile Codigo de perfil del usuario. + * @return TgeneMenuProfile + * @throws Exception + */ + public TgeneMenuProfile getTgeneMenuProfile(String pProfile) throws Exception { + return TgeneMenuProfile.findByCodePerfilUsuario(PersistenceHelper.getEntityManager(), pProfile); + } + + /** + * Metodo que entrega descripcion del primer nivel del menu. + * + * @param pmenucode Codigo de menu. + * @param pLevel Codigo de nivel. + * @param planguagecode Codigo de lenguaje del usuario. + * @return TgeneMenuLevelDesc + * @throws Exception + */ + public TgeneMenuLevelDesc getTgeneMenuLevelDesc(Integer pmenucode, Integer pLevel, String planguagecode) throws Exception { + return TgeneMenuLevelDesc.find(PersistenceHelper.getEntityManager(), pmenucode, pLevel, planguagecode); + } + + /** + * Metodo que entrega la definicion del primer nivel del menu. + * + * @param pMenucode Codigo de menu. + * @return List + * @throws Exception + */ + public List getTgeneMenuLevel(Integer pMenucode) throws Exception { + return TgeneMenuLevel.findByMenuCode(PersistenceHelper.getEntityManager(), pMenucode); + } + + /** + * Metodo que entrega uns lista de definicion del menu de segundo nivel. + * + * @param pMenucode Codigo de menu. + * @param pLevel Codigo del primer nivel. + * @return List + * @throws Exception + */ + public List getTgeneMenuSuLevels(Integer pMenucode, Integer pLevel) throws Exception { + return TgeneMenuSubLevel.find(PersistenceHelper.getEntityManager(), pMenucode, pLevel); + } + + /** + * Metodo que emtrega la descripcion de un subnivel del menu. + * + * @param pmenucode Codigo de menu. + * @param pLevel Codigo de nivel de menu. + * @param pSublevel Codigo de subnivel de menu. + * @param planguagecode Codigo de lenguaje. + * @return TgeneMenuSubLevelDesc + * @throws Exception + */ + public TgeneMenuSubLevelDesc getTgeneMenuSubLevelDesc(Integer pmenucode, Integer pLevel, Integer pSublevel, String planguagecode) + throws Exception { + return TgeneMenuSubLevelDesc.find(PersistenceHelper.getEntityManager(), pmenucode, pLevel, pSublevel, planguagecode); + } + + /** + * Metodo que entrega transacciones asociadas al codigo de menu y codigo de nivel. + * + * @param pMenucode Codigo de menu. + * @param pLevel Codigo de Nivel. + * @return List + * @throws Exception + */ + public List getTgeneMenuLevelTran(Integer pMenucode, Integer pLevel) throws Exception { + return TgeneMenuLevelTran.findByCodeMenuNivel(PersistenceHelper.getEntityManager(), pMenucode, pLevel); + } + + /** + * Metodo que obtiene datos del perfil del usuario. + * + * @param pusercode Codigo de usuario. + * @return TsafeUserProfile + * @throws Exception + */ + public List getTsafeUserProfile(String pusercode) throws Exception { + return TsafeUserProfile.find(PersistenceHelper.getEntityManager(), pusercode); + } + + /** + * Metodo que obtiene datos de un registro del modulo. + * + * @param pModulecode Codigo de modulo a obtener datos de la base. + * @return TgeneModule + * @throws Exception + */ + public TgeneModule getTgeneModule(String pModulecode) throws Exception { + return TgeneModule.find(PersistenceHelper.getEntityManager(), pModulecode); + } + + /** + * Metodo que obtiene datos de un registro del producto. + * + * @param pModulecode Codigo de modulo a obtener datos de la base. + * @param pProductcode Codigo de producto a obtener datos de la base. + * @return TgeneProduct + * @throws Exception + */ + public TgeneProduct getTgeneProduct(String pModulecode, String pProductcode) throws Exception { + return TgeneProduct.find(PersistenceHelper.getEntityManager(), pModulecode, pProductcode); + } + + /** + * Metodo que obtiene datos de un registro del subproducto. + * + * @param pModulecode Codigo de modulo a obtener datos de la base. + * @param pProductcode Codigo de producto a obtener datos de la base. + * @param pSubproductcode Codigo de subproducto a obtener datos de la base. + * @return TgeneSubProduct + * @throws Exception + */ + public TgeneSubProduct getTgeneSubProduct(String pModulecode, String pProductcode, String pSubproductcode) throws Exception { + return TgeneSubProduct.find(PersistenceHelper.getEntityManager(), pModulecode, pProductcode, pSubproductcode); + } + + /** + * Metodo que devuelve un registro de la tabla TGENEACCOUNT + * + * @param account Numero de la cuenta + * @param company Compania a la que pertenece la cuenta + * @param dateto Fecha de vigencia de la tarjeta + * @return + */ + public TgeneAccount getTgeneAccount(String account, Integer company, Timestamp dateto) throws Exception { + return TgeneAccount.findByFechaVigenciaTarjeta(PersistenceHelper.getEntityManager(), account, company, dateto); + } + + /** + * Entrega una lista de excepciones de solicitud. + * + * @param pSolicitudenumber Numero de solicitud. + * @param pSolicitudesequence Secuencia interna de la solicitud. + * @return List + * @throws Exception + */ + public List getTgeneSolicitudeExceptions(String pSolicitudenumber, Integer pSolicitudesequence) throws Exception { + return TgeneSolicitudeExceptions.findBySolicitudeNumber(PersistenceHelper.getEntityManager(), pSolicitudenumber, pSolicitudesequence); + } + + /** + * Metodo que entrega una lista de datos requeridos de clientes por producto. + * + * @param pModuleCode Codigo de modulo. + * @param pProductCode Codigo de producto. + * @param pSubproductCode Codigo de subproducto. + * @param pPersontype Tipo de persona. + * @return List + * @throws Exception + */ + public List getTgeneSubprodClientData(String pModuleCode, String pProductCode, String pSubproductCode, + String pPersontype, String pRelationshipcode) throws Exception { + return TgeneSubprodClientData.findByProduct(PersistenceHelper.getEntityManager(), pModuleCode, pProductCode, pSubproductCode, pPersontype, + pRelationshipcode); + } + + /** + * Metodo que entrega una lista de datos activos requeridos de clientes por producto. + * + * @param pModuleCode Codigo de modulo. + * @param pProductCode Codigo de producto. + * @param pSubproductCode Codigo de subproducto. + * @param pPersontype Tipo de persona. + * @return List + * @throws Exception + */ + public List getTgeneSubprodClientDataActive(String pModuleCode, String pProductCode, String pSubproductCode, + String pPersontype, String pRelationshipcode) throws Exception { + return TgeneSubprodClientData.findByProductActive(PersistenceHelper.getEntityManager(), pModuleCode, pProductCode, pSubproductCode, + pPersontype, pRelationshipcode); + } + + /** + * Entrega una lista de clientes relacionados a la solicitud. + * + * @param pSolicitudenumber Numero de solicitud. + * @param pSolicitudesequence Secuencia interna de la solicitud. + * @return List + * @throws Exception + */ + public List getTgeneSolicitudeRelationship(String pSolicitudenumber, Integer pSolicitudesequence) throws Exception { + return TgeneSolicitudeRelationship.findBySolicitudeNumber(PersistenceHelper.getEntityManager(), pSolicitudenumber, pSolicitudesequence); + } + + /** + * Metodo que devuelve un objeto de tipo TgeneSolicitudeClientdata + * + * @param solicitudnumber + * @param solicitudsequence + * @param title + * @param personcode + * @return + * @throws Exception + */ + public TgeneSolicitudeClientdata getTgeneSolicitudeClientdata(String solicitudnumber, Integer solicitudsequence, String title, Integer personcode) + throws Exception { + return TgeneSolicitudeClientdata.find(PersistenceHelper.getEntityManager(), solicitudnumber, solicitudsequence, title, personcode); + } + + /** + * Metodo que devuelve un objeto de tipo TgeneSolicitude + * + * @param solicitudnumber + * @param solicitudsequence + * @return + * @throws Exception + */ + public TgeneSolicitude getTgeneSolicitude(String solicitudnumber, Integer solicitudsequence) throws Exception { + return TgeneSolicitude.find(PersistenceHelper.getEntityManager(), solicitudnumber, solicitudsequence); + } + + /** + * Metodo que devuelve un objeto de tipo TgeneSubprodClientData + * + * @param modulecode + * @param productcode + * @param subproductcode + * @param persontype + * @param relationshipcode + * @param title + * @return + * @throws Exception + */ + public TgeneSubprodClientData getTgeneSubprodClientData(String modulecode, String productcode, String subproductcode, String persontype, + String relationshipcode, String title) throws Exception { + return TgeneSubprodClientData.find(PersistenceHelper.getEntityManager(), modulecode, productcode, subproductcode, persontype, + relationshipcode, title); + } + + /** + * Metodo que obtiene datos de un registro del subproducto. + * + * @param pModulecode Codigo de modulo a obtener datos de la base. + * @param pProductcode Codigo de producto a obtener datos de la base. + * @param pSubproductcode Codigo de subproducto a obtener datos de la base. + * @return TgeneSubProduct + * @throws Exception + */ + public TsafeUserDetail getTsafeUserDetail(String usercode) throws Exception { + return TsafeUserDetail.findByUserCode(PersistenceHelper.getEntityManager(), usercode); + } + + /** + * Entrega un objeto con la calificacion a asociar a un prestamo, dado el tipo de credito, estatus operativo y el + * numero de dias de vencida una operacion. + * + * @param pCreditType Codigo de tipo de credito Consumo, Comercial. + * @param pOperationStatus Cordo de estatus de operacion, Original, restructurada + * @param pModuleCode Modulo al que pertenece el estado operativo. + * @param processdate Fecha en la cual se realiza la calificacion. + * @param expirationdate Fecha desde la cual esta vencido el credito. + * @return TgeneScoreRank + * @throws Exception + */ + public TgeneScoreRank getTgeneScoreRank(String pCreditType, String pOperationStatus, String pModuleCode, Date processdate, Date expirationdate) + throws Exception { + APPDates datefrom = null; + APPDates dateto = null; + int days = 0; // Si la fvencimiento esta en el futuro, indica que el prestamo tiene la mejor calificacion. + if (processdate.compareTo(expirationdate) >= 0) { + dateto = new APPDates(processdate); + datefrom = new APPDates(expirationdate); + dateto.setBase(CalculationBase.B365365); + days = dateto.substract(datefrom); + } + + TgeneScoreRank obj = null; + + List ldata = this.getTgeneScoreRank(pCreditType, pOperationStatus, pModuleCode); + + if ((ldata == null) || ldata.isEmpty()) { + return obj; + } + obj = ldata.get(0); + for (TgeneScoreRank object : ldata) { + if ((days >= object.getDaysfrom()) && (days <= object.getDaysto())) { + obj = object; + break; + } + } + return obj; + } + + /** + * Entrega una lista con la calificacion a asociar a un prestamo, dado el tipo de credito, estatus operativo y el + * numero de dias de vencida una operacion. + * + * @param pCreditType Codigo de tipo de credito Consumo, Comercial. + * @param pOperationStatus Cordo de estatus de operacion, Original, restructurada + * @param pModuleCode Modulo al que pertenece el estado operativo. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List getTgeneScoreRank(String pCreditType, String pOperationStatus, String pModuleCode) throws Exception { + List ldata = null; + String key = pCreditType + pOperationStatus + pModuleCode; + CacheManager cm = CacheManager.getInstance(); + ldata = (List) cm.getData("TgeneScoreRank", key); + if (ldata == null) { + Map mTgeneScoreRank = cm.getMapDefinition("TgeneScoreRank"); + ldata = TgeneScoreRank.find(PersistenceHelper.getEntityManager(), pCreditType, pOperationStatus, pModuleCode); + mTgeneScoreRank.put(key, ldata); + cm.putData("TgeneScoreRank", mTgeneScoreRank); + } + return ldata; + } + + /** + * Entrega un objeto con el porcentaje de provision de acuerdo a la calificacion tipo de credito. + * + * @param pScoreScode Codigo de calificacion de cartera. A,B,C,D + * @param pCreditType Codigo de tipo de credito, Consumo, COmercial. + * @return TgenePercentScore + * @throws Exception + */ + public TgenePercentScore getTgenePercentScore(String pScoreScode, String pCreditType) throws Exception { + TgenePercentScore obj = null; + String key = pScoreScode + pCreditType; + CacheManager cm = CacheManager.getInstance(); + obj = (TgenePercentScore) cm.getData("TgenePercentScore", key); + if (obj == null) { + Map mTgenePercentScore = cm.getMapDefinition("TgenePercentScore"); + TgenePercentScoreKey k = new TgenePercentScoreKey(pScoreScode, pCreditType, FormatDates.getDefaultExpiryTimestamp()); + obj = TgenePercentScore.find(PersistenceHelper.getEntityManager(), k); + mTgenePercentScore.put(key, obj); + cm.putData("TgenePercentScore", mTgenePercentScore); + } + return obj; + } + + /** + * Entrega una lista de cargos por subproducto. + * + * @param pSolicitudenumber Numero de solicitud. + * @param pSolicitudesequence Secuencia interna de la solicitud. + * @return List + * @throws Exception + */ + public List getTgeneSubProductChargesByCompany(Integer pCompany) throws Exception { + return TgeneSubProductCharges.findByCompany(PersistenceHelper.getEntityManager(), pCompany); + } + + /** + * Entrega una lista de cargos por modulo. + * + * @param pModuleCode + * @return + * @throws Exception + */ + public List getTgeneSubProductChargesByModule(String pModuleCode) throws Exception { + return TgeneSubProductCharges.findByModule(PersistenceHelper.getEntityManager(), pModuleCode); + } + + /** + * Entrega una lista de cargos por modulo. + * + * @param pModuleCode + * @return + * @throws Exception + */ + public List getTgeneChargesByModule(String pModuleCode) throws Exception { + return TgeneCharges.findByModule(PersistenceHelper.getEntityManager(), pModuleCode); + } + + /** + * Metodo que entrega la descripcion del status de una garantia + * + * @param pModuleCode + * @param pStatuscode + * @return + * @throws Exception + */ + public TgeneAccountStatus getTgeneAccountStatus(String pModuleCode, String pStatuscode) throws Exception { + TgeneAccountStatus obj = null; + String key = pModuleCode + Constant.SEPARATOR + pStatuscode; + CacheManager cm = CacheManager.getInstance(); + obj = (TgeneAccountStatus) cm.getData("TgeneAccountStatus", key); + if (obj == null) { + Map mTgeneAccountStatus = cm.getMapDefinition("TgeneAccountStatus"); + TgeneAccountStatusKey keyp = new TgeneAccountStatusKey(pModuleCode, pStatuscode); + obj = TgeneAccountStatus.find(PersistenceHelper.getEntityManager(), keyp); + mTgeneAccountStatus.put(key, obj); + cm.putData("TgeneAccountStatus", (Object) mTgeneAccountStatus); + } + return obj; + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/db/DataHelper.java b/base/business/general/src/main/java/com/fp/general/db/DataHelper.java new file mode 100644 index 0000000..87c4a27 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/db/DataHelper.java @@ -0,0 +1,473 @@ +package com.fp.general.db; + +import java.sql.Date; +import java.sql.Timestamp; +import java.util.List; +import java.util.Map; + +import com.fp.common.helper.CalculationBase; +import com.fp.common.helper.Constant; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.cache.CacheManager; +import com.fp.persistence.commondb.helper.APPDates; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.acco.TgeneAccount; +import com.fp.persistence.pgeneral.acco.TgeneAccountStatus; +import com.fp.persistence.pgeneral.acco.TgeneAccountStatusKey; +import com.fp.persistence.pgeneral.auth.TgeneSolicitudeClientdata; +import com.fp.persistence.pgeneral.auth.TgeneSolicitudeExceptions; +import com.fp.persistence.pgeneral.charge.TgeneCharges; +import com.fp.persistence.pgeneral.charge.TgeneSubProductCharges; +import com.fp.persistence.pgeneral.gene.TgeneBranch; +import com.fp.persistence.pgeneral.gene.TgeneSolicitude; +import com.fp.persistence.pgeneral.gene.TgeneSolicitudeRelationship; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevel; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelDesc; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelTran; +import com.fp.persistence.pgeneral.menu.TgeneMenuProfile; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevel; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelDesc; +import com.fp.persistence.pgeneral.product.TgeneModule; +import com.fp.persistence.pgeneral.product.TgeneProduct; +import com.fp.persistence.pgeneral.product.TgeneSubProduct; +import com.fp.persistence.pgeneral.product.TgeneSubprodClientData; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserProfile; +import com.fp.persistence.pgeneral.score.TgenePercentScore; +import com.fp.persistence.pgeneral.score.TgenePercentScoreKey; +import com.fp.persistence.pgeneral.score.TgeneScoreRank; + +/** + * Clase utilitaria que maneje sql y hql utiliada en el proyecto general. + * + * @author Jorge Vaca + * @version 2.1 + */ +public final class DataHelper { + + /** Almacena una instancia de DataHelper. */ + private static DataHelper cache; + + /** + * Entrega una instancia de DataHelper. + * + * @return DataHelper + */ + public static DataHelper getInstance() { + if (DataHelper.cache != null) { + return DataHelper.cache; + } + synchronized (DataHelper.class) { + if (DataHelper.cache == null) { + DataHelper.cache = new DataHelper(); + } + } + return DataHelper.cache; + } + + /** + * Metodo que entrega datos de una sucursal definidos en TgeneBranch. + * + * @param pBranch Codigo de sucursal. + * @param pCompany Compania a la que pertenece la cuenta. + * @return TgeneBranch + * @throws Exception + */ + public TgeneBranch getTgeneBranch(Integer pBranch, Integer pCompany) throws Exception { + return TgeneBranch.find(PersistenceHelper.getEntityManager(), pBranch, pCompany); + } + + /** + * Metodo que entrega datos de TgeneMenuProfile. + * + * @param pProfile Codigo de perfil del usuario. + * @return TgeneMenuProfile + * @throws Exception + */ + public TgeneMenuProfile getTgeneMenuProfile(String pProfile) throws Exception { + return TgeneMenuProfile.findByCodePerfilUsuario(PersistenceHelper.getEntityManager(), pProfile); + } + + /** + * Metodo que entrega descripcion del primer nivel del menu. + * + * @param pmenucode Codigo de menu. + * @param pLevel Codigo de nivel. + * @param planguagecode Codigo de lenguaje del usuario. + * @return TgeneMenuLevelDesc + * @throws Exception + */ + public TgeneMenuLevelDesc getTgeneMenuLevelDesc(Integer pmenucode, Integer pLevel, String planguagecode) throws Exception { + return TgeneMenuLevelDesc.find(PersistenceHelper.getEntityManager(), pmenucode, pLevel, planguagecode); + } + + /** + * Metodo que entrega la definicion del primer nivel del menu. + * + * @param pMenucode Codigo de menu. + * @return List + * @throws Exception + */ + public List getTgeneMenuLevel(Integer pMenucode) throws Exception { + return TgeneMenuLevel.findByMenuCode(PersistenceHelper.getEntityManager(), pMenucode); + } + + /** + * Metodo que entrega uns lista de definicion del menu de segundo nivel. + * + * @param pMenucode Codigo de menu. + * @param pLevel Codigo del primer nivel. + * @return List + * @throws Exception + */ + public List getTgeneMenuSuLevels(Integer pMenucode, Integer pLevel) throws Exception { + return TgeneMenuSubLevel.find(PersistenceHelper.getEntityManager(), pMenucode, pLevel); + } + + /** + * Metodo que emtrega la descripcion de un subnivel del menu. + * + * @param pmenucode Codigo de menu. + * @param pLevel Codigo de nivel de menu. + * @param pSublevel Codigo de subnivel de menu. + * @param planguagecode Codigo de lenguaje. + * @return TgeneMenuSubLevelDesc + * @throws Exception + */ + public TgeneMenuSubLevelDesc getTgeneMenuSubLevelDesc(Integer pmenucode, Integer pLevel, Integer pSublevel, String planguagecode) + throws Exception { + return TgeneMenuSubLevelDesc.find(PersistenceHelper.getEntityManager(), pmenucode, pLevel, pSublevel, planguagecode); + } + + /** + * Metodo que entrega transacciones asociadas al codigo de menu y codigo de nivel. + * + * @param pMenucode Codigo de menu. + * @param pLevel Codigo de Nivel. + * @return List + * @throws Exception + */ + public List getTgeneMenuLevelTran(Integer pMenucode, Integer pLevel) throws Exception { + return TgeneMenuLevelTran.findByCodeMenuNivel(PersistenceHelper.getEntityManager(), pMenucode, pLevel); + } + + /** + * Metodo que obtiene datos del perfil del usuario. + * + * @param pusercode Codigo de usuario. + * @return TsafeUserProfile + * @throws Exception + */ + public List getTsafeUserProfile(String pusercode) throws Exception { + return TsafeUserProfile.find(PersistenceHelper.getEntityManager(), pusercode); + } + + /** + * Metodo que obtiene datos de un registro del modulo. + * + * @param pModulecode Codigo de modulo a obtener datos de la base. + * @return TgeneModule + * @throws Exception + */ + public TgeneModule getTgeneModule(String pModulecode) throws Exception { + return TgeneModule.find(PersistenceHelper.getEntityManager(), pModulecode); + } + + /** + * Metodo que obtiene datos de un registro del producto. + * + * @param pModulecode Codigo de modulo a obtener datos de la base. + * @param pProductcode Codigo de producto a obtener datos de la base. + * @return TgeneProduct + * @throws Exception + */ + public TgeneProduct getTgeneProduct(String pModulecode, String pProductcode) throws Exception { + return TgeneProduct.find(PersistenceHelper.getEntityManager(), pModulecode, pProductcode); + } + + /** + * Metodo que obtiene datos de un registro del subproducto. + * + * @param pModulecode Codigo de modulo a obtener datos de la base. + * @param pProductcode Codigo de producto a obtener datos de la base. + * @param pSubproductcode Codigo de subproducto a obtener datos de la base. + * @return TgeneSubProduct + * @throws Exception + */ + public TgeneSubProduct getTgeneSubProduct(String pModulecode, String pProductcode, String pSubproductcode) throws Exception { + return TgeneSubProduct.find(PersistenceHelper.getEntityManager(), pModulecode, pProductcode, pSubproductcode); + } + + /** + * Metodo que devuelve un registro de la tabla TGENEACCOUNT + * + * @param account Numero de la cuenta + * @param company Compania a la que pertenece la cuenta + * @param dateto Fecha de vigencia de la tarjeta + * @return + */ + public TgeneAccount getTgeneAccount(String account, Integer company, Timestamp dateto) throws Exception { + return TgeneAccount.findByFechaVigenciaTarjeta(PersistenceHelper.getEntityManager(), account, company, dateto); + } + + /** + * Entrega una lista de excepciones de solicitud. + * + * @param pSolicitudenumber Numero de solicitud. + * @param pSolicitudesequence Secuencia interna de la solicitud. + * @return List + * @throws Exception + */ + public List getTgeneSolicitudeExceptions(String pSolicitudenumber, Integer pSolicitudesequence) throws Exception { + return TgeneSolicitudeExceptions.findBySolicitudeNumber(PersistenceHelper.getEntityManager(), pSolicitudenumber, pSolicitudesequence); + } + + /** + * Metodo que entrega una lista de datos requeridos de clientes por producto. + * + * @param pModuleCode Codigo de modulo. + * @param pProductCode Codigo de producto. + * @param pSubproductCode Codigo de subproducto. + * @param pPersontype Tipo de persona. + * @return List + * @throws Exception + */ + public List getTgeneSubprodClientData(String pModuleCode, String pProductCode, String pSubproductCode, + String pPersontype, String pRelationshipcode) throws Exception { + return TgeneSubprodClientData.findByProduct(PersistenceHelper.getEntityManager(), pModuleCode, pProductCode, pSubproductCode, pPersontype, + pRelationshipcode); + } + + /** + * Metodo que entrega una lista de datos activos requeridos de clientes por producto. + * + * @param pModuleCode Codigo de modulo. + * @param pProductCode Codigo de producto. + * @param pSubproductCode Codigo de subproducto. + * @param pPersontype Tipo de persona. + * @return List + * @throws Exception + */ + public List getTgeneSubprodClientDataActive(String pModuleCode, String pProductCode, String pSubproductCode, + String pPersontype, String pRelationshipcode) throws Exception { + return TgeneSubprodClientData.findByProductActive(PersistenceHelper.getEntityManager(), pModuleCode, pProductCode, pSubproductCode, + pPersontype, pRelationshipcode); + } + + /** + * Entrega una lista de clientes relacionados a la solicitud. + * + * @param pSolicitudenumber Numero de solicitud. + * @param pSolicitudesequence Secuencia interna de la solicitud. + * @return List + * @throws Exception + */ + public List getTgeneSolicitudeRelationship(String pSolicitudenumber, Integer pSolicitudesequence) throws Exception { + return TgeneSolicitudeRelationship.findBySolicitudeNumber(PersistenceHelper.getEntityManager(), pSolicitudenumber, pSolicitudesequence); + } + + /** + * Metodo que devuelve un objeto de tipo TgeneSolicitudeClientdata + * + * @param solicitudnumber + * @param solicitudsequence + * @param title + * @param personcode + * @return + * @throws Exception + */ + public TgeneSolicitudeClientdata getTgeneSolicitudeClientdata(String solicitudnumber, Integer solicitudsequence, String title, Integer personcode) + throws Exception { + return TgeneSolicitudeClientdata.find(PersistenceHelper.getEntityManager(), solicitudnumber, solicitudsequence, title, personcode); + } + + /** + * Metodo que devuelve un objeto de tipo TgeneSolicitude + * + * @param solicitudnumber + * @param solicitudsequence + * @return + * @throws Exception + */ + public TgeneSolicitude getTgeneSolicitude(String solicitudnumber, Integer solicitudsequence) throws Exception { + return TgeneSolicitude.find(PersistenceHelper.getEntityManager(), solicitudnumber, solicitudsequence); + } + + /** + * Metodo que devuelve un objeto de tipo TgeneSubprodClientData + * + * @param modulecode + * @param productcode + * @param subproductcode + * @param persontype + * @param relationshipcode + * @param title + * @return + * @throws Exception + */ + public TgeneSubprodClientData getTgeneSubprodClientData(String modulecode, String productcode, String subproductcode, String persontype, + String relationshipcode, String title) throws Exception { + return TgeneSubprodClientData.find(PersistenceHelper.getEntityManager(), modulecode, productcode, subproductcode, persontype, + relationshipcode, title); + } + + /** + * Metodo que obtiene datos de un registro del subproducto. + * + * @param pModulecode Codigo de modulo a obtener datos de la base. + * @param pProductcode Codigo de producto a obtener datos de la base. + * @param pSubproductcode Codigo de subproducto a obtener datos de la base. + * @return TgeneSubProduct + * @throws Exception + */ + public TsafeUserDetail getTsafeUserDetail(String usercode) throws Exception { + return TsafeUserDetail.findByUserCode(PersistenceHelper.getEntityManager(), usercode); + } + + /** + * Entrega un objeto con la calificacion a asociar a un prestamo, dado el tipo de credito, estatus operativo y el + * numero de dias de vencida una operacion. + * + * @param pCreditType Codigo de tipo de credito Consumo, Comercial. + * @param pOperationStatus Cordo de estatus de operacion, Original, restructurada + * @param pModuleCode Modulo al que pertenece el estado operativo. + * @param processdate Fecha en la cual se realiza la calificacion. + * @param expirationdate Fecha desde la cual esta vencido el credito. + * @return TgeneScoreRank + * @throws Exception + */ + public TgeneScoreRank getTgeneScoreRank(String pCreditType, String pOperationStatus, String pModuleCode, Date processdate, Date expirationdate) + throws Exception { + APPDates datefrom = null; + APPDates dateto = null; + int days = 0; // Si la fvencimiento esta en el futuro, indica que el prestamo tiene la mejor calificacion. + if (processdate.compareTo(expirationdate) >= 0) { + dateto = new APPDates(processdate); + datefrom = new APPDates(expirationdate); + dateto.setBase(CalculationBase.B365365); + days = dateto.substract(datefrom); + } + + TgeneScoreRank obj = null; + + List ldata = this.getTgeneScoreRank(pCreditType, pOperationStatus, pModuleCode); + + if ((ldata == null) || ldata.isEmpty()) { + return obj; + } + obj = ldata.get(0); + for (TgeneScoreRank object : ldata) { + if ((days >= object.getDaysfrom()) && (days <= object.getDaysto())) { + obj = object; + break; + } + } + return obj; + } + + /** + * Entrega una lista con la calificacion a asociar a un prestamo, dado el tipo de credito, estatus operativo y el + * numero de dias de vencida una operacion. + * + * @param pCreditType Codigo de tipo de credito Consumo, Comercial. + * @param pOperationStatus Cordo de estatus de operacion, Original, restructurada + * @param pModuleCode Modulo al que pertenece el estado operativo. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List getTgeneScoreRank(String pCreditType, String pOperationStatus, String pModuleCode) throws Exception { + List ldata = null; + String key = pCreditType + pOperationStatus + pModuleCode; + CacheManager cm = CacheManager.getInstance(); + ldata = (List) cm.getData("TgeneScoreRank", key); + if (ldata == null) { + Map mTgeneScoreRank = cm.getMapDefinition("TgeneScoreRank"); + ldata = TgeneScoreRank.find(PersistenceHelper.getEntityManager(), pCreditType, pOperationStatus, pModuleCode); + mTgeneScoreRank.put(key, ldata); + cm.putData("TgeneScoreRank", mTgeneScoreRank); + } + return ldata; + } + + /** + * Entrega un objeto con el porcentaje de provision de acuerdo a la calificacion tipo de credito. + * + * @param pScoreScode Codigo de calificacion de cartera. A,B,C,D + * @param pCreditType Codigo de tipo de credito, Consumo, COmercial. + * @return TgenePercentScore + * @throws Exception + */ + public TgenePercentScore getTgenePercentScore(String pScoreScode, String pCreditType) throws Exception { + TgenePercentScore obj = null; + String key = pScoreScode + pCreditType; + CacheManager cm = CacheManager.getInstance(); + obj = (TgenePercentScore) cm.getData("TgenePercentScore", key); + if (obj == null) { + Map mTgenePercentScore = cm.getMapDefinition("TgenePercentScore"); + TgenePercentScoreKey k = new TgenePercentScoreKey(pScoreScode, pCreditType, FormatDates.getDefaultExpiryTimestamp()); + obj = TgenePercentScore.find(PersistenceHelper.getEntityManager(), k); + mTgenePercentScore.put(key, obj); + cm.putData("TgenePercentScore", mTgenePercentScore); + } + return obj; + } + + /** + * Entrega una lista de cargos por subproducto. + * + * @param pSolicitudenumber Numero de solicitud. + * @param pSolicitudesequence Secuencia interna de la solicitud. + * @return List + * @throws Exception + */ + public List getTgeneSubProductChargesByCompany(Integer pCompany) throws Exception { + return TgeneSubProductCharges.findByCompany(PersistenceHelper.getEntityManager(), pCompany); + } + + /** + * Entrega una lista de cargos por modulo. + * + * @param pModuleCode + * @return + * @throws Exception + */ + public List getTgeneSubProductChargesByModule(String pModuleCode) throws Exception { + return TgeneSubProductCharges.findByModule(PersistenceHelper.getEntityManager(), pModuleCode); + } + + /** + * Entrega una lista de cargos por modulo. + * + * @param pModuleCode + * @return + * @throws Exception + */ + public List getTgeneChargesByModule(String pModuleCode) throws Exception { + return TgeneCharges.findByModule(PersistenceHelper.getEntityManager(), pModuleCode); + } + + /** + * Metodo que entrega la descripcion del status de una garantia + * + * @param pModuleCode + * @param pStatuscode + * @return + * @throws Exception + */ + public TgeneAccountStatus getTgeneAccountStatus(String pModuleCode, String pStatuscode) throws Exception { + TgeneAccountStatus obj = null; + String key = pModuleCode + Constant.SEPARATOR + pStatuscode; + CacheManager cm = CacheManager.getInstance(); + obj = (TgeneAccountStatus) cm.getData("TgeneAccountStatus", key); + if (obj == null) { + Map mTgeneAccountStatus = cm.getMapDefinition("TgeneAccountStatus"); + TgeneAccountStatusKey keyp = new TgeneAccountStatusKey(pModuleCode, pStatuscode); + obj = TgeneAccountStatus.find(PersistenceHelper.getEntityManager(), keyp); + mTgeneAccountStatus.put(key, obj); + cm.putData("TgeneAccountStatus", (Object) mTgeneAccountStatus); + } + return obj; + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/exception/.svn/entries b/base/business/general/src/main/java/com/fp/general/exception/.svn/entries new file mode 100644 index 0000000..d9a3531 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/exception/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/exception +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ExceptionMessage.java +file + + + + +2022-07-28T03:40:44.085809Z +eccc8bfacf4086cc14c4851fce764443 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +831 + diff --git a/base/business/general/src/main/java/com/fp/general/exception/.svn/text-base/ExceptionMessage.java.svn-base b/base/business/general/src/main/java/com/fp/general/exception/.svn/text-base/ExceptionMessage.java.svn-base new file mode 100644 index 0000000..0e783e2 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/exception/.svn/text-base/ExceptionMessage.java.svn-base @@ -0,0 +1,26 @@ +package com.fp.general.exception; + +import com.fp.common.exception.AbstractExceptionMessage; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.result.TgeneResults; + +/** + * Clase encargada de entregar la descripcion de un mensaje aplicativo. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class ExceptionMessage extends AbstractExceptionMessage { + + /* + * (non-Javadoc) + * + * @see com.fp.common.exception.AbstractExceptionMessage#getMessage(java.lang.String, java.lang.String) + */ + @Override + public String getMessage(String aplicationcode, String language) throws Exception { + TgeneResults result = TgeneResults.find(PersistenceHelper.getEntityManager(), aplicationcode, language); + return result.getDescription(); + } + +} \ No newline at end of file diff --git a/base/business/general/src/main/java/com/fp/general/exception/ExceptionMessage.java b/base/business/general/src/main/java/com/fp/general/exception/ExceptionMessage.java new file mode 100644 index 0000000..0e783e2 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/exception/ExceptionMessage.java @@ -0,0 +1,26 @@ +package com.fp.general.exception; + +import com.fp.common.exception.AbstractExceptionMessage; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.result.TgeneResults; + +/** + * Clase encargada de entregar la descripcion de un mensaje aplicativo. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class ExceptionMessage extends AbstractExceptionMessage { + + /* + * (non-Javadoc) + * + * @see com.fp.common.exception.AbstractExceptionMessage#getMessage(java.lang.String, java.lang.String) + */ + @Override + public String getMessage(String aplicationcode, String language) throws Exception { + TgeneResults result = TgeneResults.find(PersistenceHelper.getEntityManager(), aplicationcode, language); + return result.getDescription(); + } + +} \ No newline at end of file diff --git a/base/business/general/src/main/java/com/fp/general/helper/.svn/entries b/base/business/general/src/main/java/com/fp/general/helper/.svn/entries new file mode 100644 index 0000000..e2b4364 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/helper/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/helper +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +MenuHelper.java +file + + + + +2022-07-28T03:40:43.221805Z +a0bffd8af3e164ba15aa068dc6c6a11b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8495 + +AccountNumber.java +file + + + + +2022-07-28T03:40:43.221805Z +8b2d173817ed55cf10074ce501e1ff91 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9243 + +StringHelper.java +file + + + + +2022-07-28T03:40:43.221805Z +0b147918abcb07b306415f4d418745e5 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +18748 + +PropertiesHelper.java +file + + + + +2022-07-28T03:40:43.221805Z +e747e2d252ecfc43369c563c75af0262 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5365 + +SolicitudeNumber.java +file + + + + +2022-07-28T03:40:43.222805Z +89557b63e2e46244592cda491c5524fd +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3130 + +ArrayHelper.java +file + + + + +2022-07-28T03:40:43.222805Z +f0f5486ed0e723f62387b6fc4f92900f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +10589 + diff --git a/base/business/general/src/main/java/com/fp/general/helper/.svn/text-base/AccountNumber.java.svn-base b/base/business/general/src/main/java/com/fp/general/helper/.svn/text-base/AccountNumber.java.svn-base new file mode 100644 index 0000000..8324100 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/helper/.svn/text-base/AccountNumber.java.svn-base @@ -0,0 +1,195 @@ +package com.fp.general.helper; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.common.exception.CommonException; +import com.fp.dto.data.SaveData; +import com.fp.dto.rules.TransactionRule; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.acco.TgeneAccoNumStructure; +import com.fp.persistence.pgeneral.acco.TgeneAccountSequence; +import com.fp.persistence.pgeneral.acco.TgeneAccountSequenceKey; +import com.fp.persistence.pgeneral.acco.TgeneSequStructDetail; +import com.fp.persistence.pgeneral.acco.TgeneSequentialModule; + +/** + * Clase que se encarga de entregar el nuemro de cuenta asociado a un susbistema.
+ * La secuencia de cuenta se puede definir por modulo, producto, subproducto, branch, oficina y compania + * La estructura de numero de cuenta esta definida en la tabla TGENEACCONUMSTRUCTURE + * La estructura de secuencia esta definida en TGENESEQUSTRUCT Y TGENESEQUSTRUCTDETAIL + * La relacion entre el modulo y el secuencial esta definida en la tabla TGENESEQUENTIALMODULE + * La tabla TGENEACCOUNTSEQUENCE contiene el ultimo secuencial utilizado, sino existe un registro en esta tabla el sistema lo + * crea automaticamente + * Cuando se llama a la rutina esta se ejecuta en una session de base de datos diferente, obtiene el numero de cuenta y + * graba el registro en la base de datos, con el fin de no tener bloqueos cuando se realiza multiples autalizacions de + * cuenta. + * + * @author Jorge Vaca + * @version 2.1 + */ +public abstract class AccountNumber extends TransactionRule { + + /** + * Map en el cual se almacenan los parametros que llegan al metodo que obtien la cuenta, para posteriormente + * utilizarlo en la generacion del numero de cuenta. + */ + private Map mparam = new HashMap(); + + /** Numero de caracteres de la secuencia de la cuenta. */ + private Integer sequencelength = 0; + + /** + * Metodo que entrega el numero de cuenta a crear. + * + * @param pModule Codigo de modulo. + * @param pProduct Codigo de producto. + * @param pSubproduct Codigo de subproducto. + * @param pBranch Codigo de sucursal. + * @param pOffice Codigo de oficina. + * @param pCompany Codigo de compania. + * @return String + * @throws Exception + */ + public String getAccount(String pModule, String pProduct, String pSubproduct, Integer pBranch, Integer pOffice, Integer pCompany) + throws Exception { + this.parametersToMap(pModule, pProduct, pSubproduct, pBranch, pOffice, pCompany); + String accountnumber = ""; + try { + List ldata = TgeneAccoNumStructure.find(PersistenceHelper.getEntityManager(), pModule); + if (ldata.size() == 0) { + throw new GeneralException("GENE-0039", "ESTRUCTURA DE NUMERO DE CUENTA NO DEFINIDA EN TGENEACCONUMSTRUCTURE MODULO: {0}", pModule); + } + for (TgeneAccoNumStructure obj : ldata) { + if (obj.getPk().getStructureaccountcatalog().compareTo("SEQUENCE") == 0) { + this.sequencelength = obj.getSizefield(); + String sec = this.process(pModule, pProduct, pSubproduct, pBranch, pOffice, pCompany); + accountnumber = accountnumber + sec; + continue; + } + String data = this.mparam.get(obj.getPk().getStructureaccountcatalog()).toString(); + accountnumber = accountnumber + this.completeDataLeft(data, obj.getSizefield(), "0"); + } + if (this.sequencelength == 0) { + throw new GeneralException("GENE-0036", "NUMERO DE CARACTERES DEL SECUENCIAL NO DEFINIDO EN TGENEACCONUMSTRUCTURE MODULO: {0}", pModule); + } + SaveData.getMap().put("ACCOUNT", accountnumber); + return accountnumber; + } catch (Exception e) { + throw e; + } + } + + /** + * Metodo que obtiene la secuencia de cuenta por modulo. + * + * @param pModule Codigo de modulo. + * @param pProduct Codigo de producto. + * @param pSubproduct Codigo de subproducto. + * @param pBranch Codigo de sucursal. + * @param pOffice Codigo de oficina. + * @param pCompany Codigo de compania. + * @return String + * @throws Exception + */ + private String process(String pModule, String pProduct, String pSubproduct, Integer pBranch, Integer pOffice, Integer pCompany) throws Exception { + TgeneAccountSequence tgas = null; + try { + tgas = TgeneAccountSequence.findWithhold(PersistenceHelper.getEntityManager(), pModule, pProduct, pSubproduct, pBranch, + pOffice, pCompany); + } catch (CommonException e) { + if (e.getCode().compareTo("CORE-0025") == 0) { + TgeneSequentialModule sequByModule = TgeneSequentialModule.find(PersistenceHelper.getEntityManager(), pModule); + if (sequByModule == null) { + throw new GeneralException("GENE-0037", "ESTRUCTURA DE SECUENCIAL NO DEFINIDA EN TGENESEQUENTIALMODULE MODULO: {0}", pModule); + } + TgeneAccountSequence accountSequence = new TgeneAccountSequence(); + Integer sequence = Integer.valueOf(TgeneAccountSequence.getAmountSequences(PersistenceHelper.getEntityManager(), pModule)); + sequence++; + TgeneAccountSequenceKey accountSequenceKey = new TgeneAccountSequenceKey(pModule,sequence.toString()); + accountSequence.setPk(accountSequenceKey); + accountSequence.setSequentialnumber("0"); + List sequStruct = TgeneSequStructDetail.find(PersistenceHelper.getEntityManager(), sequByModule.getSequcode()); + if (sequStruct.size() == 0) { + throw new GeneralException("GENE-0038", "ESTRUCTURA DE SECUENCIAL NO DEFINIDA EN TGENESEQUESTRUCTDETAIL MODULO: {0}", pModule); + } + for (TgeneSequStructDetail obj : sequStruct) { + if (obj.getPk().getStructureaccountcatalog().compareTo("PRODUCT") == 0) { + accountSequence.setProductcode(pProduct); + } + if (obj.getPk().getStructureaccountcatalog().compareTo("SUBPRODUCT") == 0) { + accountSequence.setSubproductcode(pSubproduct); + } + if (obj.getPk().getStructureaccountcatalog().compareTo("COMPANY") == 0) { + accountSequence.setCompanycode(pCompany); + } + if (obj.getPk().getStructureaccountcatalog().compareTo("BRANCH") == 0) { + accountSequence.setBranchcode(pBranch); + } + if (obj.getPk().getStructureaccountcatalog().compareTo("OFFICE") == 0) { + accountSequence.setOfficecode(pOffice); + } + } + PersistenceHelper.saveOrUpdate(accountSequence); + tgas = accountSequence; + } + } + Integer sec = Integer.valueOf(tgas.getSequentialnumber()); + sec++; + tgas.setSequentialnumber(sec.toString()); + PersistenceHelper.saveOrUpdate(tgas); + + return this.completeDataLeft(sec.toString(), this.sequencelength, "0"); + } + + /** + * Metodo que completa o rellena los valores con la longitud exacta hacia el aldo izquierdo + * + * @param data Valor a completar caracteres. + * @param longitud Longitud total del caracteres. + * @param fillcharacter Caracter de relleno. + * @return String + */ + public String completeDataLeft(String data, int longitud, String fillcharacter) { + if (data == null) { + data = ""; + } + if (longitud == 0) { + return data; + } + if (data.length() > longitud) { + data = data.substring(0, longitud); + return data; + } + int newlongitud = longitud - data.length(); + for (int i = 0; i < newlongitud; i++) { + data = fillcharacter + data; + } + + return data; + } + + /** + * Metodo que crea un map con los parametros de entrada, para luego generar el numero de cuenta. + * + * @param pModule Codigo de modulo. + * @param pProduct Codigo de producto. + * @param pSubproduct Codigo de subproducto. + * @param pBranch Codigo de sucursal. + * @param pOffice Codigo de oficina. + * @param pCompany Codigo de compania. + * @throws Exception + */ + private void parametersToMap(String pModule, String pProduct, String pSubproduct, Integer pBranch, Integer pOffice, Integer pCompany) + throws Exception { + this.mparam.put("MODULE", pModule); + this.mparam.put("PRODUCT", pProduct); + this.mparam.put("SUBPRODUCT", pSubproduct); + this.mparam.put("BRANCH", pBranch); + this.mparam.put("OFFICE", pOffice); + this.mparam.put("COMPANY", pCompany); + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/helper/.svn/text-base/ArrayHelper.java.svn-base b/base/business/general/src/main/java/com/fp/general/helper/.svn/text-base/ArrayHelper.java.svn-base new file mode 100644 index 0000000..5529aae --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/helper/.svn/text-base/ArrayHelper.java.svn-base @@ -0,0 +1,436 @@ +package com.fp.general.helper; + +import java.lang.reflect.Array; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import org.hibernate.LockMode; +import org.hibernate.LockOptions; +import org.hibernate.type.Type; + +public final class ArrayHelper +{ + + public static final boolean TRUE[] = { + true + }; + public static final boolean FALSE[] = { + false + }; + public static final String EMPTY_STRING_ARRAY[] = new String[0]; + public static final int EMPTY_INT_ARRAY[] = new int[0]; + public static final boolean EMPTY_BOOLEAN_ARRAY[] = new boolean[0]; + public static final Class EMPTY_CLASS_ARRAY[] = new Class[0]; + public static final Object EMPTY_OBJECT_ARRAY[] = new Object[0]; + public static final Type EMPTY_TYPE_ARRAY[] = new Type[0]; + private static int SEED = 23; + private static int PRIME_NUMER = 37; + + public static int indexOf(Object array[], Object object) + { + for(int i = 0; i < array.length; i++) + { + if(array[i].equals(object)) + { + return i; + } + } + + return -1; + } + + public static String[] toStringArray(Object objects[]) + { + int length = objects.length; + String result[] = new String[length]; + for(int i = 0; i < length; i++) + { + result[i] = objects[i].toString(); + } + + return result; + } + + public static String[] fillArray(String value, int length) + { + String result[] = new String[length]; + Arrays.fill(result, value); + return result; + } + + public static int[] fillArray(int value, int length) + { + int result[] = new int[length]; + Arrays.fill(result, value); + return result; + } + + public static LockMode[] fillArray(LockMode lockMode, int length) + { + LockMode array[] = new LockMode[length]; + Arrays.fill(array, lockMode); + return array; + } + + public static LockOptions[] fillArray(LockOptions lockOptions, int length) + { + LockOptions array[] = new LockOptions[length]; + Arrays.fill(array, lockOptions); + return array; + } + + public static String[] toStringArray(Collection coll) + { + return (String[])coll.toArray(new String[coll.size()]); + } + + public static String[][] to2DStringArray(Collection coll) + { + return (String[][])coll.toArray(new String[coll.size()][]); + } + + public static int[][] to2DIntArray(Collection coll) + { + return (int[][])coll.toArray(new int[coll.size()][]); + } + + public static Type[] toTypeArray(Collection coll) + { + return (Type[])coll.toArray(new Type[coll.size()]); + } + + public static int[] toIntArray(Collection coll) + { + Iterator iter = coll.iterator(); + int arr[] = new int[coll.size()]; + int i = 0; + while(iter.hasNext()) + { + arr[i++] = ((Integer)iter.next()).intValue(); + } + return arr; + } + + public static boolean[] toBooleanArray(Collection coll) + { + Iterator iter = coll.iterator(); + boolean arr[] = new boolean[coll.size()]; + int i = 0; + while(iter.hasNext()) + { + arr[i++] = ((Boolean)iter.next()).booleanValue(); + } + return arr; + } + + public static Object[] typecast(Object array[], Object to[]) + { + return Arrays.asList(array).toArray(to); + } + + public static List toList(Object array) + { + if(array instanceof Object[]) + { + return Arrays.asList((Object[])array); + } + int size = Array.getLength(array); + ArrayList list = new ArrayList(size); + for(int i = 0; i < size; i++) + { + list.add(Array.get(array, i)); + } + + return list; + } + + public static String[] slice(String strings[], int begin, int length) + { + String result[] = new String[length]; + System.arraycopy(strings, begin, result, 0, length); + return result; + } + + public static Object[] slice(Object objects[], int begin, int length) + { + Object result[] = new Object[length]; + System.arraycopy(((objects)), begin, ((result)), 0, length); + return result; + } + + public static List toList(Iterator iter) + { + List list = new ArrayList(); + for(; iter.hasNext(); list.add(iter.next())) { } + return list; + } + + public static String[] join(String x[], String y[]) + { + String result[] = new String[x.length + y.length]; + System.arraycopy(x, 0, result, 0, x.length); + System.arraycopy(y, 0, result, x.length, y.length); + return result; + } + + public static String[] join(String x[], String y[], boolean use[]) + { + String result[] = new String[x.length + countTrue(use)]; + System.arraycopy(x, 0, result, 0, x.length); + int k = x.length; + for(int i = 0; i < y.length; i++) + { + if(use[i]) + { + result[k++] = y[i]; + } + } + + return result; + } + + public static int[] join(int x[], int y[]) + { + int result[] = new int[x.length + y.length]; + System.arraycopy(x, 0, result, 0, x.length); + System.arraycopy(y, 0, result, x.length, y.length); + return result; + } + + private ArrayHelper() + { + } + + public static String toString(Object array[]) + { + StringBuffer sb = new StringBuffer(); + sb.append("["); + for(int i = 0; i < array.length; i++) + { + sb.append(array[i]); + if(i < array.length - 1) + { + sb.append(","); + } + } + + sb.append("]"); + return sb.toString(); + } + + public static boolean isAllNegative(int array[]) + { + for(int i = 0; i < array.length; i++) + { + if(array[i] >= 0) + { + return false; + } + } + + return true; + } + + public static boolean isAllTrue(boolean array[]) + { + for(int i = 0; i < array.length; i++) + { + if(!array[i]) + { + return false; + } + } + + return true; + } + + public static int countTrue(boolean array[]) + { + int result = 0; + for(int i = 0; i < array.length; i++) + { + if(array[i]) + { + result++; + } + } + + return result; + } + + public static boolean isAllFalse(boolean array[]) + { + for(int i = 0; i < array.length; i++) + { + if(array[i]) + { + return false; + } + } + + return true; + } + + public static void addAll(Collection collection, Object array[]) + { + collection.addAll(Arrays.asList(array)); + } + + public static int[] getBatchSizes(int maxBatchSize) + { + int batchSize = maxBatchSize; + int n; + for(n = 1; batchSize > 1; n++) + { + batchSize = getNextBatchSize(batchSize); + } + + int result[] = new int[n]; + batchSize = maxBatchSize; + for(int i = 0; i < n; i++) + { + result[i] = batchSize; + batchSize = getNextBatchSize(batchSize); + } + + return result; + } + + private static int getNextBatchSize(int batchSize) + { + if(batchSize <= 10) + { + return batchSize - 1; + } + if(batchSize / 2 < 10) + { + return 10; + } else + { + return batchSize / 2; + } + } + + public static int hash(Object array[]) + { + int length = array.length; + int seed = SEED; + for(int index = 0; index < length; index++) + { + seed = hash(seed, array[index] != null ? array[index].hashCode() : 0); + } + + return seed; + } + + public static int hash(char array[]) + { + int length = array.length; + int seed = SEED; + for(int index = 0; index < length; index++) + { + seed = hash(seed, array[index]); + } + + return seed; + } + + public static int hash(byte bytes[]) + { + int length = bytes.length; + int seed = SEED; + for(int index = 0; index < length; index++) + { + seed = hash(seed, bytes[index]); + } + + return seed; + } + + private static int hash(int seed, int i) + { + return PRIME_NUMER * seed + i; + } + + public static boolean isEquals(Object o1[], Object o2[]) + { + if(o1 == o2) + { + return true; + } + if(o1 == null || o2 == null) + { + return false; + } + int length = o1.length; + if(length != o2.length) + { + return false; + } + for(int index = 0; index < length; index++) + { + if(!o1[index].equals(o2[index])) + { + return false; + } + } + + return true; + } + + public static boolean isEquals(char o1[], char o2[]) + { + if(o1 == o2) + { + return true; + } + if(o1 == null || o2 == null) + { + return false; + } + int length = o1.length; + if(length != o2.length) + { + return false; + } + for(int index = 0; index < length; index++) + { + if(o1[index] != o2[index]) + { + return false; + } + } + + return true; + } + + public static boolean isEquals(byte b1[], byte b2[]) + { + if(b1 == b2) + { + return true; + } + if(b1 == null || b2 == null) + { + return false; + } + int length = b1.length; + if(length != b2.length) + { + return false; + } + for(int index = 0; index < length; index++) + { + if(b1[index] != b2[index]) + { + return false; + } + } + + return true; + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/helper/.svn/text-base/MenuHelper.java.svn-base b/base/business/general/src/main/java/com/fp/general/helper/.svn/text-base/MenuHelper.java.svn-base new file mode 100644 index 0000000..2740649 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/helper/.svn/text-base/MenuHelper.java.svn-base @@ -0,0 +1,200 @@ +package com.fp.general.helper; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.SQLQuery; +import org.hibernate.ScrollableResults; + +import com.fp.common.helper.BeanManager; +import com.fp.common.helper.Constant; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelDesc; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelDesc; + +/** + * Clase utilitaria del menu. + * + * @author Jorge Vaca + * @version 2.1 + */ +public abstract class MenuHelper extends QueryRule { + + /** + * Recore el resultset y adiciona transacciones al grupo. + * + * @param pMenuGroupDesc Objeto que contien el codigo de menu y el grupo de menu, a buscar transacciones a asociar + * al grupo de menu. + * @return List + * @throws Exception + */ + protected List completTransactionByLevel(TgeneMenuLevelDesc pMenuLevelDesc, String languagecode) throws Exception { + ScrollableResults rSet = this.getTransactions(pMenuLevelDesc); + List lData = new ArrayList(); + try { + while (rSet.next()) { + Object[] obj = rSet.get(); + Map m = this.completetransactiondata(obj, languagecode); + lData.add(m); + } + return lData; + } finally { + rSet.close(); + } + + } + + /** + * Recore el resultset y adiciona transacciones al grupo. + * + * @param pMenuSubLevelDesc Objeto que contien el codigo de menu y el grupo de menu, a buscar transacciones a + * asociar al grupo de menu. + * @param mLevel Datos del nivel padre del menu. + * @throws Exception + */ + protected void completTransactionBySubLevel(TgeneMenuSubLevelDesc pMenuSubLevelDesc, Map mLevel, String languagecode) + throws Exception { + ScrollableResults rSet = this.getTransactions(pMenuSubLevelDesc); + List> lData = new ArrayList>(); + try { + while (rSet.next()) { + Object[] obj = rSet.get(); + Map m = this.completetransactiondata(obj, languagecode); + lData.add(m); + } + mLevel.put("items", lData); + } finally { + rSet.close(); + } + } + + /** + * Metodo que completa datos del menu por transaccion. + * + * @param pTgeneMenuGroupTran Transaccion a completar datos del menu. + * @throws Exception + */ + protected Map completetransactiondata(Object[] pObject, String languagecode) throws Exception { + Map m = new HashMap(); + String module = (String) pObject[0]; + Integer transaction = BeanManager.convertObject(pObject[1], Integer.class); + Integer version = BeanManager.convertObject(pObject[2], Integer.class); + String page = (String) pObject[3]; + String autoquery = (String) pObject[4]; + String title = (String) pObject[5]; + String signature = (String) pObject[6]; + String queryagain = (String) pObject[7]; + String jsfp = (String) pObject[8]; + m.put("t", Constant.capitalize(title)); + m.put("p", page); + m.put("a", autoquery); + m.put("m", module); + m.put("tr", transaction); + m.put("v", version); + m.put("f", signature); + m.put("qa", queryagain); + m.put("jsfp", jsfp); + m.put("sg", this.existGlosary(module, transaction, version, languagecode)); + return m; + } + + /** + * Sentencia que entrega las transacciones asociadas al grupo del menu. + */ + private static final String SQL = " select t.TRANSACTIONMODULE, t.TRANSACTIONCODE, t.TRANSACTIONVERSION, t.PAGE, t.AUTOQUERY, t.NAME, t.SIGNATURE, t.QUERYAGAIN, t.JSFPAGE " + + " from TGENEMENULEVELTRAN tm,TGENETRANSACTION t " + + " where tm.TRANSACTIONMODULE = t.TRANSACTIONMODULE " + + " and tm.TRANSACTIONCODE = t.TRANSACTIONCODE " + + " and tm.TRANSACTIONVERSION = t.TRANSACTIONVERSION " + + " and tm.LEVELCODE = :levelcode " + " and tm.MENUCODE = :menucode " + " order by tm.PRESENTATIONORDER"; + + /** + * Entrega un resultset con las transacciones a adicionar al menu. + * + * @param pMenuGroupDesc Objeto que contien el codigo de menu y el grupo de menu, a buscar transacciones a asociar + * al grupo de menu. + * @return ScrollableResults + * @throws Exception + */ + protected ScrollableResults getTransactions(TgeneMenuLevelDesc pMenuLevelDesc) throws Exception { + ScrollableResults rSet = null; + SQLQuery qry = PersistenceHelper.getSession().createSQLQuery(MenuHelper.SQL); + qry.setInteger("levelcode", pMenuLevelDesc.getPk().getLevelcode()); + qry.setInteger("menucode", pMenuLevelDesc.getPk().getMenucode()); + rSet = qry.scroll(); + return rSet; + } + + /** + * Sentencia que entrega las transacciones asociadas al grupo del menu. + */ + private static final String SQL_SUBLEVEL = " select t.TRANSACTIONMODULE, t.TRANSACTIONCODE, t.TRANSACTIONVERSION,t.PAGE, t.AUTOQUERY, t.NAME, t.SIGNATURE, t.QUERYAGAIN, t.JSFPAGE " + + " from TGENEMENUSUBLEVELTRAN tm, TGENETRANSACTION t " + + " where tm.TRANSACTIONMODULE = t.TRANSACTIONMODULE " + + " and tm.TRANSACTIONCODE = t.TRANSACTIONCODE " + + " and tm.TRANSACTIONVERSION = t.TRANSACTIONVERSION " + + " and tm.LEVELCODE = :levelcode " + + " and tm.SUBLEVEL = :sublevel " + + " and tm.MENUCODE = :menucode " + + " order by tm.PRESENTATIONORDER"; + + /** + * Entrega un resultset con las transacciones a adicionar al menu. + * + * @param pMenuGroupDesc Objeto que contien el codigo de menu y el grupo de menu, a buscar transacciones a asociar + * al grupo de menu. + * @return ScrollableResults + * @throws Exception + */ + protected ScrollableResults getTransactions(TgeneMenuSubLevelDesc pMenuSubLevelDesc) throws Exception { + ScrollableResults rSet = null; + SQLQuery qry = PersistenceHelper.getSession().createSQLQuery(MenuHelper.SQL_SUBLEVEL); + qry.setInteger("levelcode", pMenuSubLevelDesc.getPk().getLevelcode()); + qry.setInteger("sublevel", pMenuSubLevelDesc.getPk().getSublevel()); + qry.setInteger("menucode", pMenuSubLevelDesc.getPk().getMenucode()); + rSet = qry.scroll(); + return rSet; + } + + /** + * Sentencia para saber si existe un glosaio disponible para la transaccion + */ + private static final String HQL = "SELECT count(*) FROM TGENETRANSACTIONGLOSARY" + " where TRANSACTIONMODULE = :transactionmodule" + + " and TRANSACTIONCODE = :transactioncode" + " and TRANSACTIONVERSION = :transactionversion" + " and LANGUAGECODE= :languagecode"; + + /** + * Metodo que devuelve Y o N si existe glosario en una transaccion + * + * @param module Modulo de la transaccion + * @param transaction Codigo de transaccion + * @param version Version de la transaccion + * @param languagecode Lenguaje a utilizar + * @return + * @throws Exception + */ + private String existGlosary(String module, Integer transaction, Integer version, String languagecode) throws Exception { + SQLQuery qry = PersistenceHelper.getSession().createSQLQuery(HQL); + qry.setString("transactionmodule", module); + qry.setInteger("transactioncode", transaction); + qry.setInteger("transactionversion", version); + qry.setString("languagecode", languagecode); + Object result = qry.uniqueResult(); + String returnValue = "N"; + if (result instanceof Integer) { + Integer numero = (Integer) result; + if (numero > 0) { + returnValue = "Y"; + } + } else if (result instanceof BigDecimal) { + Integer numero = ((BigDecimal) result).intValue(); + if (numero > 0) { + returnValue = "Y"; + } + } + return returnValue; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/helper/.svn/text-base/PropertiesHelper.java.svn-base b/base/business/general/src/main/java/com/fp/general/helper/.svn/text-base/PropertiesHelper.java.svn-base new file mode 100644 index 0000000..d959547 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/helper/.svn/text-base/PropertiesHelper.java.svn-base @@ -0,0 +1,182 @@ +package com.fp.general.helper; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Properties; +import java.util.StringTokenizer; + + + + +//Referenced classes of package org.hibernate.util: +// StringHelper, ArrayHelper + +public final class PropertiesHelper +{ + + private static final String PLACEHOLDER_START = "${"; + + private PropertiesHelper() + { + } + + public static String getString(String propertyName, Properties properties, String defaultValue) + { + String value = extractPropertyValue(propertyName, properties); + return value != null ? value : defaultValue; + } + + public static String extractPropertyValue(String propertyName, Properties properties) + { + String value = properties.getProperty(propertyName); + if(value == null) + { + return null; + } + value = value.trim(); + if(StringHelper.isEmpty(value)) + { + return null; + } else + { + return value; + } + } + + public static boolean getBoolean(String propertyName, Properties properties) + { + return getBoolean(propertyName, properties, false); + } + + public static boolean getBoolean(String propertyName, Properties properties, boolean defaultValue) + { + String value = extractPropertyValue(propertyName, properties); + return value != null ? Boolean.valueOf(value).booleanValue() : defaultValue; + } + + public static int getInt(String propertyName, Properties properties, int defaultValue) + { + String value = extractPropertyValue(propertyName, properties); + return value != null ? Integer.parseInt(value) : defaultValue; + } + + public static Integer getInteger(String propertyName, Properties properties) + { + String value = extractPropertyValue(propertyName, properties); + return value != null ? Integer.valueOf(value) : null; + } + + public static Map toMap(String propertyName, String delim, Properties properties) + { + Map map = new HashMap(); + String value = extractPropertyValue(propertyName, properties); + if(value != null) + { + for(StringTokenizer tokens = new StringTokenizer(value, delim); tokens.hasMoreTokens(); map.put(tokens.nextToken(), tokens.hasMoreElements() ? ((Object) (tokens.nextToken())) : "")) { } + } + return map; + } + + public static String[] toStringArray(String propertyName, String delim, Properties properties) + { + return toStringArray(extractPropertyValue(propertyName, properties), delim); + } + + public static String[] toStringArray(String stringForm, String delim) + { + if(stringForm != null) + { + return StringHelper.split(delim, stringForm); + } else + { + return ArrayHelper.EMPTY_STRING_ARRAY; + } + } + + public static Properties maskOut(Properties props, String key) + { + Properties clone = (Properties)props.clone(); + if(clone.get(key) != null) + { + clone.setProperty(key, "****"); + } + return clone; + } + + public static void resolvePlaceHolders(Properties properties) + { + Iterator itr = properties.entrySet().iterator(); + do + { + if(!itr.hasNext()) + { + break; + } + java.util.Map.Entry entry = (java.util.Map.Entry)itr.next(); + Object value = entry.getValue(); + if(value != null && String.class.isInstance(value)) + { + String resolved = resolvePlaceHolder((String)value); + if(!value.equals(resolved)) + { + if(resolved == null) + { + itr.remove(); + } else + { + entry.setValue(resolved); + } + } + } + } while(true); + } + + public static String resolvePlaceHolder(String property) + { + if(property.indexOf("${") < 0) + { + return property; + } + StringBuffer buff = new StringBuffer(); + char chars[] = property.toCharArray(); + for(int pos = 0; pos < chars.length; pos++) + { + if(chars[pos] == '$' && chars[pos + 1] == '{') + { + String systemPropertyName = ""; + int x; + for(x = pos + 2; x < chars.length && chars[x] != '}'; x++) + { + systemPropertyName = (new StringBuilder()).append(systemPropertyName).append(chars[x]).toString(); + if(x == chars.length - 1) + { + throw new IllegalArgumentException((new StringBuilder()).append("unmatched placeholder start [").append(property).append("]").toString()); + } + } + + String systemProperty = extractFromSystem(systemPropertyName); + buff.append(systemProperty != null ? systemProperty : ""); + pos = x + 1; + if(pos >= chars.length) + { + break; + } + } + buff.append(chars[pos]); + } + + String rtn = buff.toString(); + return StringHelper.isEmpty(rtn) ? null : rtn; + } + + + private static String extractFromSystem(String systemPropertyName) { + try { + return System.getProperty( systemPropertyName ); + } + catch( Throwable t ) { + return null; + } + } +} diff --git a/base/business/general/src/main/java/com/fp/general/helper/.svn/text-base/SolicitudeNumber.java.svn-base b/base/business/general/src/main/java/com/fp/general/helper/.svn/text-base/SolicitudeNumber.java.svn-base new file mode 100644 index 0000000..ab4b615 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/helper/.svn/text-base/SolicitudeNumber.java.svn-base @@ -0,0 +1,70 @@ +package com.fp.general.helper; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.HqlStatement; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.gene.TgeneUserSolicitudeNumber; +import com.fp.persistence.pgeneral.safe.TsafeUser; + +/** + * Clase que entrega la secuencia de solicitud a utilizar por usuario. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class SolicitudeNumber extends QueryRule { + + /** + * Metodo que entrega el numero de solicitud, para el usuario. + * + * @param pQueryRequest Datos del request. + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + try { + TgeneUserSolicitudeNumber solicitudnumber = this.getTgeneUserSolicitudeNumber(pQueryRequest.getUser()); + if (pQueryRequest.getInternalUserCode() == null) { + TsafeUser user = com.fp.base.persistence.util.db.DataHelper.getInstance().getTsafeUser(pQueryRequest.getUser()); + pQueryRequest.setInternalUserCode(user.getInternalcode()); + } + String sol = pQueryRequest.getInternalUserCode() + solicitudnumber.getSolicitudnumber(); + response.put("solicitudenumber", sol); + solicitudnumber = PersistenceHelper.getEntityManager().merge(solicitudnumber); + + return pQueryRequest; + } catch (Exception e) { + throw e; + } + } + + /** + * Metodo que entrega la secuencia de solicitud a utilizar, esta se define por usuario.
+ * Si no existe un registro en la tabla crea uno, si existe suma 1 a la secuencia de la solicitud. + * + * @param pUserCode Codigo de usuario a obtener el numero de solicitud. + * @return TgeneUserSolicitudeNumber + * @throws Exception + */ + protected TgeneUserSolicitudeNumber getTgeneUserSolicitudeNumber(String pUserCode) throws Exception { + TgeneUserSolicitudeNumber tgeneUserSolicitudeNumber = null; + HqlStatement hql = new HqlStatement(SolicitudeNumber.HQL); + hql.setString("usercode", pUserCode); + tgeneUserSolicitudeNumber = (TgeneUserSolicitudeNumber) hql.getObject(); + if (tgeneUserSolicitudeNumber == null) { + tgeneUserSolicitudeNumber = new TgeneUserSolicitudeNumber(); + tgeneUserSolicitudeNumber.setPk(pUserCode); + tgeneUserSolicitudeNumber.setSolicitudnumber("0"); + } + Integer sec = Integer.valueOf(tgeneUserSolicitudeNumber.getSolicitudnumber()); + sec++; + tgeneUserSolicitudeNumber.setSolicitudnumber(sec.toString()); + return tgeneUserSolicitudeNumber; + } + + /** Sentencia que obtiene un registro de TgeneUserSolicitudeNumber con la secuencia de solicitud por usuario. */ + private static final String HQL = "from com.fp.persistence.pgeneral.gene.TgeneUserSolicitudeNumber t " + " where t.pk = :usercode "; +} diff --git a/base/business/general/src/main/java/com/fp/general/helper/.svn/text-base/StringHelper.java.svn-base b/base/business/general/src/main/java/com/fp/general/helper/.svn/text-base/StringHelper.java.svn-base new file mode 100644 index 0000000..79d0d30 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/helper/.svn/text-base/StringHelper.java.svn-base @@ -0,0 +1,639 @@ +package com.fp.general.helper; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.StringTokenizer; + +import org.hibernate.dialect.Dialect; + + +// Referenced classes of package org.hibernate.util: +// ArrayHelper + +public final class StringHelper +{ + + private static final int ALIAS_TRUNCATE_LENGTH = 10; + public static final String WHITESPACE = " \n\r\f\t"; + + private StringHelper() + { + } + + public static int lastIndexOfLetter(String string) + { + for(int i = 0; i < string.length(); i++) + { + char character = string.charAt(i); + if(!Character.isLetter(character)) + { + return i - 1; + } + } + + return string.length() - 1; + } + + public static String join(String seperator, String strings[]) + { + int length = strings.length; + if(length == 0) + { + return ""; + } + StringBuffer buf = (new StringBuffer(length * strings[0].length())).append(strings[0]); + for(int i = 1; i < length; i++) + { + buf.append(seperator).append(strings[i]); + } + + return buf.toString(); + } + + public static String join(String seperator, Iterator objects) + { + StringBuffer buf = new StringBuffer(); + if(objects.hasNext()) + { + buf.append(objects.next()); + } + for(; objects.hasNext(); buf.append(seperator).append(objects.next())) { } + return buf.toString(); + } + + public static String[] add(String x[], String sep, String y[]) + { + String result[] = new String[x.length]; + for(int i = 0; i < x.length; i++) + { + result[i] = (new StringBuilder()).append(x[i]).append(sep).append(y[i]).toString(); + } + + return result; + } + + public static String repeat(String string, int times) + { + StringBuffer buf = new StringBuffer(string.length() * times); + for(int i = 0; i < times; i++) + { + buf.append(string); + } + + return buf.toString(); + } + + public static String repeat(char character, int times) + { + char buffer[] = new char[times]; + Arrays.fill(buffer, character); + return new String(buffer); + } + + public static String replace(String template, String placeholder, String replacement) + { + return replace(template, placeholder, replacement, false); + } + + public static String[] replace(String templates[], String placeholder, String replacement) + { + String result[] = new String[templates.length]; + for(int i = 0; i < templates.length; i++) + { + result[i] = replace(templates[i], placeholder, replacement); + } + + return result; + } + + public static String replace(String template, String placeholder, String replacement, boolean wholeWords) + { + return replace(template, placeholder, replacement, wholeWords, false); + } + + public static String replace(String template, String placeholder, String replacement, boolean wholeWords, boolean encloseInParensIfNecessary) + { + if(template == null) + { + return template; + } + int loc = template.indexOf(placeholder); + if(loc < 0) + { + return template; + } else + { + String beforePlaceholder = template.substring(0, loc); + String afterPlaceholder = template.substring(loc + placeholder.length()); + return replace(beforePlaceholder, afterPlaceholder, placeholder, replacement, wholeWords, encloseInParensIfNecessary); + } + } + + public static String replace(String beforePlaceholder, String afterPlaceholder, String placeholder, String replacement, boolean wholeWords, boolean encloseInParensIfNecessary) + { + boolean actuallyReplace = !wholeWords || afterPlaceholder.length() == 0 || !Character.isJavaIdentifierPart(afterPlaceholder.charAt(0)); + boolean encloseInParens = actuallyReplace && encloseInParensIfNecessary && getLastNonWhitespaceCharacter(beforePlaceholder) != '(' && getFirstNonWhitespaceCharacter(afterPlaceholder) != ')'; + StringBuilder buf = new StringBuilder(beforePlaceholder); + if(encloseInParens) + { + buf.append('('); + } + buf.append(actuallyReplace ? replacement : placeholder); + if(encloseInParens) + { + buf.append(')'); + } + buf.append(replace(afterPlaceholder, placeholder, replacement, wholeWords, encloseInParensIfNecessary)); + return buf.toString(); + } + + public static char getLastNonWhitespaceCharacter(String str) + { + if(str != null && str.length() > 0) + { + for(int i = str.length() - 1; i >= 0; i--) + { + char ch = str.charAt(i); + if(!Character.isWhitespace(ch)) + { + return ch; + } + } + + } + return '\0'; + } + + public static char getFirstNonWhitespaceCharacter(String str) + { + if(str != null && str.length() > 0) + { + for(int i = 0; i < str.length(); i++) + { + char ch = str.charAt(i); + if(!Character.isWhitespace(ch)) + { + return ch; + } + } + + } + return '\0'; + } + + public static String replaceOnce(String template, String placeholder, String replacement) + { + if(template == null) + { + return template; + } + int loc = template.indexOf(placeholder); + if(loc < 0) + { + return template; + } else + { + return template.substring(0, loc) + replacement + template.substring(loc + placeholder.length()); + } + } + + public static String[] split(String seperators, String list) + { + return split(seperators, list, false); + } + + public static String[] split(String seperators, String list, boolean include) + { + StringTokenizer tokens = new StringTokenizer(list, seperators, include); + String result[] = new String[tokens.countTokens()]; + int i = 0; + while(tokens.hasMoreTokens()) + { + result[i++] = tokens.nextToken(); + } + return result; + } + + public static String unqualify(String qualifiedName) + { + int loc = qualifiedName.lastIndexOf("."); + return loc >= 0 ? qualifiedName.substring(qualifiedName.lastIndexOf(".") + 1) : qualifiedName; + } + + public static String qualifier(String qualifiedName) + { + int loc = qualifiedName.lastIndexOf("."); + return loc >= 0 ? qualifiedName.substring(0, loc) : ""; + } + + public static String collapse(String name) + { + if(name == null) + { + return null; + } + int breakPoint = name.lastIndexOf('.'); + if(breakPoint < 0) + { + return name; + } else + { + return (new StringBuilder()).append(collapseQualifier(name.substring(0, breakPoint), true)).append(name.substring(breakPoint)).toString(); + } + } + + public static String collapseQualifier(String qualifier, boolean includeDots) + { + StringTokenizer tokenizer = new StringTokenizer(qualifier, "."); + String collapsed; + for(collapsed = Character.toString(tokenizer.nextToken().charAt(0)); tokenizer.hasMoreTokens(); collapsed = (new StringBuilder()).append(collapsed).append(tokenizer.nextToken().charAt(0)).toString()) + { + if(includeDots) + { + collapsed = (new StringBuilder()).append(collapsed).append('.').toString(); + } + } + + return collapsed; + } + + public static String partiallyUnqualify(String name, String qualifierBase) + { + if(name == null || !name.startsWith(qualifierBase)) + { + return name; + } else + { + return name.substring(qualifierBase.length() + 1); + } + } + + public static String collapseQualifierBase(String name, String qualifierBase) + { + if(name == null || !name.startsWith(qualifierBase)) + { + return collapse(name); + } else + { + return (new StringBuilder()).append(collapseQualifier(qualifierBase, true)).append(name.substring(qualifierBase.length())).toString(); + } + } + + public static String[] suffix(String columns[], String suffix) + { + if(suffix == null) + { + return columns; + } + String qualified[] = new String[columns.length]; + for(int i = 0; i < columns.length; i++) + { + qualified[i] = suffix(columns[i], suffix); + } + + return qualified; + } + + private static String suffix(String name, String suffix) + { + return suffix != null ? (new StringBuilder()).append(name).append(suffix).toString() : name; + } + + public static String root(String qualifiedName) + { + int loc = qualifiedName.indexOf("."); + return loc >= 0 ? qualifiedName.substring(0, loc) : qualifiedName; + } + + public static String unroot(String qualifiedName) + { + int loc = qualifiedName.indexOf("."); + return loc >= 0 ? qualifiedName.substring(loc + 1, qualifiedName.length()) : qualifiedName; + } + + public static boolean booleanValue(String tfString) + { + String trimmed = tfString.trim().toLowerCase(); + return trimmed.equals("true") || trimmed.equals("t"); + } + + public static String toString(Object array[]) + { + int len = array.length; + if(len == 0) + { + return ""; + } + StringBuffer buf = new StringBuffer(len * 12); + for(int i = 0; i < len - 1; i++) + { + buf.append(array[i]).append(", "); + } + + return buf.append(array[len - 1]).toString(); + } + + public static String[] multiply(String string, Iterator placeholders, Iterator replacements) + { + String result[]; + for(result = (new String[] { + string +}); placeholders.hasNext(); result = multiply(result, (String)placeholders.next(), (String[])replacements.next())) { } + return result; + } + + private static String[] multiply(String strings[], String placeholder, String replacements[]) + { + String results[] = new String[replacements.length * strings.length]; + int n = 0; + for(int i = 0; i < replacements.length; i++) + { + for(int j = 0; j < strings.length; j++) + { + results[n++] = replaceOnce(strings[j], placeholder, replacements[i]); + } + + } + + return results; + } + + public static int countUnquoted(String string, char character) + { + if('\'' == character) + { + throw new IllegalArgumentException("Unquoted count of quotes is invalid"); + } + if(string == null) + { + return 0; + } + int count = 0; + int stringLength = string.length(); + boolean inQuote = false; + for(int indx = 0; indx < stringLength; indx++) + { + char c = string.charAt(indx); + if(inQuote) + { + if('\'' == c) + { + inQuote = false; + } + continue; + } + if('\'' == c) + { + inQuote = true; + continue; + } + if(c == character) + { + count++; + } + } + + return count; + } + + public static int[] locateUnquoted(String string, char character) + { + if('\'' == character) + { + throw new IllegalArgumentException("Unquoted count of quotes is invalid"); + } + if(string == null) + { + return new int[0]; + } + ArrayList locations = new ArrayList(20); + int stringLength = string.length(); + boolean inQuote = false; + for(int indx = 0; indx < stringLength; indx++) + { + char c = string.charAt(indx); + if(inQuote) + { + if('\'' == c) + { + inQuote = false; + } + continue; + } + if('\'' == c) + { + inQuote = true; + continue; + } + if(c == character) + { + locations.add(new Integer(indx)); + } + } + + return ArrayHelper.toIntArray(locations); + } + + public static boolean isNotEmpty(String string) + { + return string != null && string.length() > 0; + } + + public static boolean isEmpty(String string) + { + return string == null || string.length() == 0; + } + + public static String qualify(String prefix, String name) + { + if(name == null || prefix == null) + { + throw new NullPointerException(); + } else + { + return (new StringBuffer(prefix.length() + name.length() + 1)).append(prefix).append('.').append(name).toString(); + } + } + + public static String[] qualify(String prefix, String names[]) + { + if(prefix == null) + { + return names; + } + int len = names.length; + String qualified[] = new String[len]; + for(int i = 0; i < len; i++) + { + qualified[i] = qualify(prefix, names[i]); + } + + return qualified; + } + + public static int firstIndexOfChar(String sqlString, String string, int startindex) + { + int matchAt = -1; + for(int i = 0; i < string.length(); i++) + { + int curMatch = sqlString.indexOf(string.charAt(i), startindex); + if(curMatch < 0) + { + continue; + } + if(matchAt == -1) + { + matchAt = curMatch; + } else + { + matchAt = Math.min(matchAt, curMatch); + } + } + + return matchAt; + } + + public static String truncate(String string, int length) + { + if(string.length() <= length) + { + return string; + } else + { + return string.substring(0, length); + } + } + + public static String generateAlias(String description) + { + return (new StringBuilder()).append(generateAliasRoot(description)).append('_').toString(); + } + + public static String generateAlias(String description, int unique) + { + return (new StringBuilder()).append(generateAliasRoot(description)).append(Integer.toString(unique)).append('_').toString(); + } + + private static String generateAliasRoot(String description) + { + String result = truncate(unqualifyEntityName(description), 10).toLowerCase().replace('/', '_').replace('$', '_'); + result = cleanAlias(result); + if(Character.isDigit(result.charAt(result.length() - 1))) + { + return (new StringBuilder()).append(result).append("x").toString(); + } else + { + return result; + } + } + + private static String cleanAlias(String alias) + { + char chars[] = alias.toCharArray(); + if(!Character.isLetter(chars[0])) + { + for(int i = 1; i < chars.length; i++) + { + if(Character.isLetter(chars[i])) + { + return alias.substring(i); + } + } + + } + return alias; + } + + public static String unqualifyEntityName(String entityName) + { + String result = unqualify(entityName); + int slashPos = result.indexOf('/'); + if(slashPos > 0) + { + result = result.substring(0, slashPos - 1); + } + return result; + } + + public static String toUpperCase(String str) + { + return str != null ? str.toUpperCase() : null; + } + + public static String toLowerCase(String str) + { + return str != null ? str.toLowerCase() : null; + } + + public static String moveAndToBeginning(String filter) + { + if(filter.trim().length() > 0) + { + filter = (new StringBuilder()).append(filter).append(" and ").toString(); + if(filter.startsWith(" and ")) + { + filter = filter.substring(4); + } + } + return filter; + } + + public static boolean isQuoted(String name) + { + return name != null && name.length() != 0 && name.charAt(0) == '`' && name.charAt(name.length() - 1) == '`'; + } + + public static String quote(String name) + { + if(name == null || name.length() == 0 || isQuoted(name)) + { + return name; + } else + { + return (new StringBuffer(name.length() + 2)).append('`').append(name).append('`').toString(); + } + } + + public static String unquote(String name) + { + if(isQuoted(name)) + { + return name.substring(1, name.length() - 1); + } else + { + return name; + } + } + + public static boolean isQuoted(String name, Dialect dialect) + { + return name != null && name.length() != 0 && (name.charAt(0) == '`' && name.charAt(name.length() - 1) == '`' || name.charAt(0) == dialect.openQuote() && name.charAt(name.length() - 1) == dialect.closeQuote()); + } + + public static String unquote(String name, Dialect dialect) + { + if(isQuoted(name, dialect)) + { + return name.substring(1, name.length() - 1); + } else + { + return name; + } + } + + public static String[] unquote(String names[], Dialect dialect) + { + if(names == null) + { + return null; + } + String unquoted[] = new String[names.length]; + for(int i = 0; i < names.length; i++) + { + unquoted[i] = unquote(names[i], dialect); + } + + return unquoted; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/helper/AccountNumber.java b/base/business/general/src/main/java/com/fp/general/helper/AccountNumber.java new file mode 100644 index 0000000..8324100 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/helper/AccountNumber.java @@ -0,0 +1,195 @@ +package com.fp.general.helper; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.common.exception.CommonException; +import com.fp.dto.data.SaveData; +import com.fp.dto.rules.TransactionRule; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.acco.TgeneAccoNumStructure; +import com.fp.persistence.pgeneral.acco.TgeneAccountSequence; +import com.fp.persistence.pgeneral.acco.TgeneAccountSequenceKey; +import com.fp.persistence.pgeneral.acco.TgeneSequStructDetail; +import com.fp.persistence.pgeneral.acco.TgeneSequentialModule; + +/** + * Clase que se encarga de entregar el nuemro de cuenta asociado a un susbistema.
+ * La secuencia de cuenta se puede definir por modulo, producto, subproducto, branch, oficina y compania + * La estructura de numero de cuenta esta definida en la tabla TGENEACCONUMSTRUCTURE + * La estructura de secuencia esta definida en TGENESEQUSTRUCT Y TGENESEQUSTRUCTDETAIL + * La relacion entre el modulo y el secuencial esta definida en la tabla TGENESEQUENTIALMODULE + * La tabla TGENEACCOUNTSEQUENCE contiene el ultimo secuencial utilizado, sino existe un registro en esta tabla el sistema lo + * crea automaticamente + * Cuando se llama a la rutina esta se ejecuta en una session de base de datos diferente, obtiene el numero de cuenta y + * graba el registro en la base de datos, con el fin de no tener bloqueos cuando se realiza multiples autalizacions de + * cuenta. + * + * @author Jorge Vaca + * @version 2.1 + */ +public abstract class AccountNumber extends TransactionRule { + + /** + * Map en el cual se almacenan los parametros que llegan al metodo que obtien la cuenta, para posteriormente + * utilizarlo en la generacion del numero de cuenta. + */ + private Map mparam = new HashMap(); + + /** Numero de caracteres de la secuencia de la cuenta. */ + private Integer sequencelength = 0; + + /** + * Metodo que entrega el numero de cuenta a crear. + * + * @param pModule Codigo de modulo. + * @param pProduct Codigo de producto. + * @param pSubproduct Codigo de subproducto. + * @param pBranch Codigo de sucursal. + * @param pOffice Codigo de oficina. + * @param pCompany Codigo de compania. + * @return String + * @throws Exception + */ + public String getAccount(String pModule, String pProduct, String pSubproduct, Integer pBranch, Integer pOffice, Integer pCompany) + throws Exception { + this.parametersToMap(pModule, pProduct, pSubproduct, pBranch, pOffice, pCompany); + String accountnumber = ""; + try { + List ldata = TgeneAccoNumStructure.find(PersistenceHelper.getEntityManager(), pModule); + if (ldata.size() == 0) { + throw new GeneralException("GENE-0039", "ESTRUCTURA DE NUMERO DE CUENTA NO DEFINIDA EN TGENEACCONUMSTRUCTURE MODULO: {0}", pModule); + } + for (TgeneAccoNumStructure obj : ldata) { + if (obj.getPk().getStructureaccountcatalog().compareTo("SEQUENCE") == 0) { + this.sequencelength = obj.getSizefield(); + String sec = this.process(pModule, pProduct, pSubproduct, pBranch, pOffice, pCompany); + accountnumber = accountnumber + sec; + continue; + } + String data = this.mparam.get(obj.getPk().getStructureaccountcatalog()).toString(); + accountnumber = accountnumber + this.completeDataLeft(data, obj.getSizefield(), "0"); + } + if (this.sequencelength == 0) { + throw new GeneralException("GENE-0036", "NUMERO DE CARACTERES DEL SECUENCIAL NO DEFINIDO EN TGENEACCONUMSTRUCTURE MODULO: {0}", pModule); + } + SaveData.getMap().put("ACCOUNT", accountnumber); + return accountnumber; + } catch (Exception e) { + throw e; + } + } + + /** + * Metodo que obtiene la secuencia de cuenta por modulo. + * + * @param pModule Codigo de modulo. + * @param pProduct Codigo de producto. + * @param pSubproduct Codigo de subproducto. + * @param pBranch Codigo de sucursal. + * @param pOffice Codigo de oficina. + * @param pCompany Codigo de compania. + * @return String + * @throws Exception + */ + private String process(String pModule, String pProduct, String pSubproduct, Integer pBranch, Integer pOffice, Integer pCompany) throws Exception { + TgeneAccountSequence tgas = null; + try { + tgas = TgeneAccountSequence.findWithhold(PersistenceHelper.getEntityManager(), pModule, pProduct, pSubproduct, pBranch, + pOffice, pCompany); + } catch (CommonException e) { + if (e.getCode().compareTo("CORE-0025") == 0) { + TgeneSequentialModule sequByModule = TgeneSequentialModule.find(PersistenceHelper.getEntityManager(), pModule); + if (sequByModule == null) { + throw new GeneralException("GENE-0037", "ESTRUCTURA DE SECUENCIAL NO DEFINIDA EN TGENESEQUENTIALMODULE MODULO: {0}", pModule); + } + TgeneAccountSequence accountSequence = new TgeneAccountSequence(); + Integer sequence = Integer.valueOf(TgeneAccountSequence.getAmountSequences(PersistenceHelper.getEntityManager(), pModule)); + sequence++; + TgeneAccountSequenceKey accountSequenceKey = new TgeneAccountSequenceKey(pModule,sequence.toString()); + accountSequence.setPk(accountSequenceKey); + accountSequence.setSequentialnumber("0"); + List sequStruct = TgeneSequStructDetail.find(PersistenceHelper.getEntityManager(), sequByModule.getSequcode()); + if (sequStruct.size() == 0) { + throw new GeneralException("GENE-0038", "ESTRUCTURA DE SECUENCIAL NO DEFINIDA EN TGENESEQUESTRUCTDETAIL MODULO: {0}", pModule); + } + for (TgeneSequStructDetail obj : sequStruct) { + if (obj.getPk().getStructureaccountcatalog().compareTo("PRODUCT") == 0) { + accountSequence.setProductcode(pProduct); + } + if (obj.getPk().getStructureaccountcatalog().compareTo("SUBPRODUCT") == 0) { + accountSequence.setSubproductcode(pSubproduct); + } + if (obj.getPk().getStructureaccountcatalog().compareTo("COMPANY") == 0) { + accountSequence.setCompanycode(pCompany); + } + if (obj.getPk().getStructureaccountcatalog().compareTo("BRANCH") == 0) { + accountSequence.setBranchcode(pBranch); + } + if (obj.getPk().getStructureaccountcatalog().compareTo("OFFICE") == 0) { + accountSequence.setOfficecode(pOffice); + } + } + PersistenceHelper.saveOrUpdate(accountSequence); + tgas = accountSequence; + } + } + Integer sec = Integer.valueOf(tgas.getSequentialnumber()); + sec++; + tgas.setSequentialnumber(sec.toString()); + PersistenceHelper.saveOrUpdate(tgas); + + return this.completeDataLeft(sec.toString(), this.sequencelength, "0"); + } + + /** + * Metodo que completa o rellena los valores con la longitud exacta hacia el aldo izquierdo + * + * @param data Valor a completar caracteres. + * @param longitud Longitud total del caracteres. + * @param fillcharacter Caracter de relleno. + * @return String + */ + public String completeDataLeft(String data, int longitud, String fillcharacter) { + if (data == null) { + data = ""; + } + if (longitud == 0) { + return data; + } + if (data.length() > longitud) { + data = data.substring(0, longitud); + return data; + } + int newlongitud = longitud - data.length(); + for (int i = 0; i < newlongitud; i++) { + data = fillcharacter + data; + } + + return data; + } + + /** + * Metodo que crea un map con los parametros de entrada, para luego generar el numero de cuenta. + * + * @param pModule Codigo de modulo. + * @param pProduct Codigo de producto. + * @param pSubproduct Codigo de subproducto. + * @param pBranch Codigo de sucursal. + * @param pOffice Codigo de oficina. + * @param pCompany Codigo de compania. + * @throws Exception + */ + private void parametersToMap(String pModule, String pProduct, String pSubproduct, Integer pBranch, Integer pOffice, Integer pCompany) + throws Exception { + this.mparam.put("MODULE", pModule); + this.mparam.put("PRODUCT", pProduct); + this.mparam.put("SUBPRODUCT", pSubproduct); + this.mparam.put("BRANCH", pBranch); + this.mparam.put("OFFICE", pOffice); + this.mparam.put("COMPANY", pCompany); + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/helper/ArrayHelper.java b/base/business/general/src/main/java/com/fp/general/helper/ArrayHelper.java new file mode 100644 index 0000000..5529aae --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/helper/ArrayHelper.java @@ -0,0 +1,436 @@ +package com.fp.general.helper; + +import java.lang.reflect.Array; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import org.hibernate.LockMode; +import org.hibernate.LockOptions; +import org.hibernate.type.Type; + +public final class ArrayHelper +{ + + public static final boolean TRUE[] = { + true + }; + public static final boolean FALSE[] = { + false + }; + public static final String EMPTY_STRING_ARRAY[] = new String[0]; + public static final int EMPTY_INT_ARRAY[] = new int[0]; + public static final boolean EMPTY_BOOLEAN_ARRAY[] = new boolean[0]; + public static final Class EMPTY_CLASS_ARRAY[] = new Class[0]; + public static final Object EMPTY_OBJECT_ARRAY[] = new Object[0]; + public static final Type EMPTY_TYPE_ARRAY[] = new Type[0]; + private static int SEED = 23; + private static int PRIME_NUMER = 37; + + public static int indexOf(Object array[], Object object) + { + for(int i = 0; i < array.length; i++) + { + if(array[i].equals(object)) + { + return i; + } + } + + return -1; + } + + public static String[] toStringArray(Object objects[]) + { + int length = objects.length; + String result[] = new String[length]; + for(int i = 0; i < length; i++) + { + result[i] = objects[i].toString(); + } + + return result; + } + + public static String[] fillArray(String value, int length) + { + String result[] = new String[length]; + Arrays.fill(result, value); + return result; + } + + public static int[] fillArray(int value, int length) + { + int result[] = new int[length]; + Arrays.fill(result, value); + return result; + } + + public static LockMode[] fillArray(LockMode lockMode, int length) + { + LockMode array[] = new LockMode[length]; + Arrays.fill(array, lockMode); + return array; + } + + public static LockOptions[] fillArray(LockOptions lockOptions, int length) + { + LockOptions array[] = new LockOptions[length]; + Arrays.fill(array, lockOptions); + return array; + } + + public static String[] toStringArray(Collection coll) + { + return (String[])coll.toArray(new String[coll.size()]); + } + + public static String[][] to2DStringArray(Collection coll) + { + return (String[][])coll.toArray(new String[coll.size()][]); + } + + public static int[][] to2DIntArray(Collection coll) + { + return (int[][])coll.toArray(new int[coll.size()][]); + } + + public static Type[] toTypeArray(Collection coll) + { + return (Type[])coll.toArray(new Type[coll.size()]); + } + + public static int[] toIntArray(Collection coll) + { + Iterator iter = coll.iterator(); + int arr[] = new int[coll.size()]; + int i = 0; + while(iter.hasNext()) + { + arr[i++] = ((Integer)iter.next()).intValue(); + } + return arr; + } + + public static boolean[] toBooleanArray(Collection coll) + { + Iterator iter = coll.iterator(); + boolean arr[] = new boolean[coll.size()]; + int i = 0; + while(iter.hasNext()) + { + arr[i++] = ((Boolean)iter.next()).booleanValue(); + } + return arr; + } + + public static Object[] typecast(Object array[], Object to[]) + { + return Arrays.asList(array).toArray(to); + } + + public static List toList(Object array) + { + if(array instanceof Object[]) + { + return Arrays.asList((Object[])array); + } + int size = Array.getLength(array); + ArrayList list = new ArrayList(size); + for(int i = 0; i < size; i++) + { + list.add(Array.get(array, i)); + } + + return list; + } + + public static String[] slice(String strings[], int begin, int length) + { + String result[] = new String[length]; + System.arraycopy(strings, begin, result, 0, length); + return result; + } + + public static Object[] slice(Object objects[], int begin, int length) + { + Object result[] = new Object[length]; + System.arraycopy(((objects)), begin, ((result)), 0, length); + return result; + } + + public static List toList(Iterator iter) + { + List list = new ArrayList(); + for(; iter.hasNext(); list.add(iter.next())) { } + return list; + } + + public static String[] join(String x[], String y[]) + { + String result[] = new String[x.length + y.length]; + System.arraycopy(x, 0, result, 0, x.length); + System.arraycopy(y, 0, result, x.length, y.length); + return result; + } + + public static String[] join(String x[], String y[], boolean use[]) + { + String result[] = new String[x.length + countTrue(use)]; + System.arraycopy(x, 0, result, 0, x.length); + int k = x.length; + for(int i = 0; i < y.length; i++) + { + if(use[i]) + { + result[k++] = y[i]; + } + } + + return result; + } + + public static int[] join(int x[], int y[]) + { + int result[] = new int[x.length + y.length]; + System.arraycopy(x, 0, result, 0, x.length); + System.arraycopy(y, 0, result, x.length, y.length); + return result; + } + + private ArrayHelper() + { + } + + public static String toString(Object array[]) + { + StringBuffer sb = new StringBuffer(); + sb.append("["); + for(int i = 0; i < array.length; i++) + { + sb.append(array[i]); + if(i < array.length - 1) + { + sb.append(","); + } + } + + sb.append("]"); + return sb.toString(); + } + + public static boolean isAllNegative(int array[]) + { + for(int i = 0; i < array.length; i++) + { + if(array[i] >= 0) + { + return false; + } + } + + return true; + } + + public static boolean isAllTrue(boolean array[]) + { + for(int i = 0; i < array.length; i++) + { + if(!array[i]) + { + return false; + } + } + + return true; + } + + public static int countTrue(boolean array[]) + { + int result = 0; + for(int i = 0; i < array.length; i++) + { + if(array[i]) + { + result++; + } + } + + return result; + } + + public static boolean isAllFalse(boolean array[]) + { + for(int i = 0; i < array.length; i++) + { + if(array[i]) + { + return false; + } + } + + return true; + } + + public static void addAll(Collection collection, Object array[]) + { + collection.addAll(Arrays.asList(array)); + } + + public static int[] getBatchSizes(int maxBatchSize) + { + int batchSize = maxBatchSize; + int n; + for(n = 1; batchSize > 1; n++) + { + batchSize = getNextBatchSize(batchSize); + } + + int result[] = new int[n]; + batchSize = maxBatchSize; + for(int i = 0; i < n; i++) + { + result[i] = batchSize; + batchSize = getNextBatchSize(batchSize); + } + + return result; + } + + private static int getNextBatchSize(int batchSize) + { + if(batchSize <= 10) + { + return batchSize - 1; + } + if(batchSize / 2 < 10) + { + return 10; + } else + { + return batchSize / 2; + } + } + + public static int hash(Object array[]) + { + int length = array.length; + int seed = SEED; + for(int index = 0; index < length; index++) + { + seed = hash(seed, array[index] != null ? array[index].hashCode() : 0); + } + + return seed; + } + + public static int hash(char array[]) + { + int length = array.length; + int seed = SEED; + for(int index = 0; index < length; index++) + { + seed = hash(seed, array[index]); + } + + return seed; + } + + public static int hash(byte bytes[]) + { + int length = bytes.length; + int seed = SEED; + for(int index = 0; index < length; index++) + { + seed = hash(seed, bytes[index]); + } + + return seed; + } + + private static int hash(int seed, int i) + { + return PRIME_NUMER * seed + i; + } + + public static boolean isEquals(Object o1[], Object o2[]) + { + if(o1 == o2) + { + return true; + } + if(o1 == null || o2 == null) + { + return false; + } + int length = o1.length; + if(length != o2.length) + { + return false; + } + for(int index = 0; index < length; index++) + { + if(!o1[index].equals(o2[index])) + { + return false; + } + } + + return true; + } + + public static boolean isEquals(char o1[], char o2[]) + { + if(o1 == o2) + { + return true; + } + if(o1 == null || o2 == null) + { + return false; + } + int length = o1.length; + if(length != o2.length) + { + return false; + } + for(int index = 0; index < length; index++) + { + if(o1[index] != o2[index]) + { + return false; + } + } + + return true; + } + + public static boolean isEquals(byte b1[], byte b2[]) + { + if(b1 == b2) + { + return true; + } + if(b1 == null || b2 == null) + { + return false; + } + int length = b1.length; + if(length != b2.length) + { + return false; + } + for(int index = 0; index < length; index++) + { + if(b1[index] != b2[index]) + { + return false; + } + } + + return true; + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/helper/MenuHelper.java b/base/business/general/src/main/java/com/fp/general/helper/MenuHelper.java new file mode 100644 index 0000000..2740649 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/helper/MenuHelper.java @@ -0,0 +1,200 @@ +package com.fp.general.helper; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.SQLQuery; +import org.hibernate.ScrollableResults; + +import com.fp.common.helper.BeanManager; +import com.fp.common.helper.Constant; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelDesc; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelDesc; + +/** + * Clase utilitaria del menu. + * + * @author Jorge Vaca + * @version 2.1 + */ +public abstract class MenuHelper extends QueryRule { + + /** + * Recore el resultset y adiciona transacciones al grupo. + * + * @param pMenuGroupDesc Objeto que contien el codigo de menu y el grupo de menu, a buscar transacciones a asociar + * al grupo de menu. + * @return List + * @throws Exception + */ + protected List completTransactionByLevel(TgeneMenuLevelDesc pMenuLevelDesc, String languagecode) throws Exception { + ScrollableResults rSet = this.getTransactions(pMenuLevelDesc); + List lData = new ArrayList(); + try { + while (rSet.next()) { + Object[] obj = rSet.get(); + Map m = this.completetransactiondata(obj, languagecode); + lData.add(m); + } + return lData; + } finally { + rSet.close(); + } + + } + + /** + * Recore el resultset y adiciona transacciones al grupo. + * + * @param pMenuSubLevelDesc Objeto que contien el codigo de menu y el grupo de menu, a buscar transacciones a + * asociar al grupo de menu. + * @param mLevel Datos del nivel padre del menu. + * @throws Exception + */ + protected void completTransactionBySubLevel(TgeneMenuSubLevelDesc pMenuSubLevelDesc, Map mLevel, String languagecode) + throws Exception { + ScrollableResults rSet = this.getTransactions(pMenuSubLevelDesc); + List> lData = new ArrayList>(); + try { + while (rSet.next()) { + Object[] obj = rSet.get(); + Map m = this.completetransactiondata(obj, languagecode); + lData.add(m); + } + mLevel.put("items", lData); + } finally { + rSet.close(); + } + } + + /** + * Metodo que completa datos del menu por transaccion. + * + * @param pTgeneMenuGroupTran Transaccion a completar datos del menu. + * @throws Exception + */ + protected Map completetransactiondata(Object[] pObject, String languagecode) throws Exception { + Map m = new HashMap(); + String module = (String) pObject[0]; + Integer transaction = BeanManager.convertObject(pObject[1], Integer.class); + Integer version = BeanManager.convertObject(pObject[2], Integer.class); + String page = (String) pObject[3]; + String autoquery = (String) pObject[4]; + String title = (String) pObject[5]; + String signature = (String) pObject[6]; + String queryagain = (String) pObject[7]; + String jsfp = (String) pObject[8]; + m.put("t", Constant.capitalize(title)); + m.put("p", page); + m.put("a", autoquery); + m.put("m", module); + m.put("tr", transaction); + m.put("v", version); + m.put("f", signature); + m.put("qa", queryagain); + m.put("jsfp", jsfp); + m.put("sg", this.existGlosary(module, transaction, version, languagecode)); + return m; + } + + /** + * Sentencia que entrega las transacciones asociadas al grupo del menu. + */ + private static final String SQL = " select t.TRANSACTIONMODULE, t.TRANSACTIONCODE, t.TRANSACTIONVERSION, t.PAGE, t.AUTOQUERY, t.NAME, t.SIGNATURE, t.QUERYAGAIN, t.JSFPAGE " + + " from TGENEMENULEVELTRAN tm,TGENETRANSACTION t " + + " where tm.TRANSACTIONMODULE = t.TRANSACTIONMODULE " + + " and tm.TRANSACTIONCODE = t.TRANSACTIONCODE " + + " and tm.TRANSACTIONVERSION = t.TRANSACTIONVERSION " + + " and tm.LEVELCODE = :levelcode " + " and tm.MENUCODE = :menucode " + " order by tm.PRESENTATIONORDER"; + + /** + * Entrega un resultset con las transacciones a adicionar al menu. + * + * @param pMenuGroupDesc Objeto que contien el codigo de menu y el grupo de menu, a buscar transacciones a asociar + * al grupo de menu. + * @return ScrollableResults + * @throws Exception + */ + protected ScrollableResults getTransactions(TgeneMenuLevelDesc pMenuLevelDesc) throws Exception { + ScrollableResults rSet = null; + SQLQuery qry = PersistenceHelper.getSession().createSQLQuery(MenuHelper.SQL); + qry.setInteger("levelcode", pMenuLevelDesc.getPk().getLevelcode()); + qry.setInteger("menucode", pMenuLevelDesc.getPk().getMenucode()); + rSet = qry.scroll(); + return rSet; + } + + /** + * Sentencia que entrega las transacciones asociadas al grupo del menu. + */ + private static final String SQL_SUBLEVEL = " select t.TRANSACTIONMODULE, t.TRANSACTIONCODE, t.TRANSACTIONVERSION,t.PAGE, t.AUTOQUERY, t.NAME, t.SIGNATURE, t.QUERYAGAIN, t.JSFPAGE " + + " from TGENEMENUSUBLEVELTRAN tm, TGENETRANSACTION t " + + " where tm.TRANSACTIONMODULE = t.TRANSACTIONMODULE " + + " and tm.TRANSACTIONCODE = t.TRANSACTIONCODE " + + " and tm.TRANSACTIONVERSION = t.TRANSACTIONVERSION " + + " and tm.LEVELCODE = :levelcode " + + " and tm.SUBLEVEL = :sublevel " + + " and tm.MENUCODE = :menucode " + + " order by tm.PRESENTATIONORDER"; + + /** + * Entrega un resultset con las transacciones a adicionar al menu. + * + * @param pMenuGroupDesc Objeto que contien el codigo de menu y el grupo de menu, a buscar transacciones a asociar + * al grupo de menu. + * @return ScrollableResults + * @throws Exception + */ + protected ScrollableResults getTransactions(TgeneMenuSubLevelDesc pMenuSubLevelDesc) throws Exception { + ScrollableResults rSet = null; + SQLQuery qry = PersistenceHelper.getSession().createSQLQuery(MenuHelper.SQL_SUBLEVEL); + qry.setInteger("levelcode", pMenuSubLevelDesc.getPk().getLevelcode()); + qry.setInteger("sublevel", pMenuSubLevelDesc.getPk().getSublevel()); + qry.setInteger("menucode", pMenuSubLevelDesc.getPk().getMenucode()); + rSet = qry.scroll(); + return rSet; + } + + /** + * Sentencia para saber si existe un glosaio disponible para la transaccion + */ + private static final String HQL = "SELECT count(*) FROM TGENETRANSACTIONGLOSARY" + " where TRANSACTIONMODULE = :transactionmodule" + + " and TRANSACTIONCODE = :transactioncode" + " and TRANSACTIONVERSION = :transactionversion" + " and LANGUAGECODE= :languagecode"; + + /** + * Metodo que devuelve Y o N si existe glosario en una transaccion + * + * @param module Modulo de la transaccion + * @param transaction Codigo de transaccion + * @param version Version de la transaccion + * @param languagecode Lenguaje a utilizar + * @return + * @throws Exception + */ + private String existGlosary(String module, Integer transaction, Integer version, String languagecode) throws Exception { + SQLQuery qry = PersistenceHelper.getSession().createSQLQuery(HQL); + qry.setString("transactionmodule", module); + qry.setInteger("transactioncode", transaction); + qry.setInteger("transactionversion", version); + qry.setString("languagecode", languagecode); + Object result = qry.uniqueResult(); + String returnValue = "N"; + if (result instanceof Integer) { + Integer numero = (Integer) result; + if (numero > 0) { + returnValue = "Y"; + } + } else if (result instanceof BigDecimal) { + Integer numero = ((BigDecimal) result).intValue(); + if (numero > 0) { + returnValue = "Y"; + } + } + return returnValue; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/helper/PropertiesHelper.java b/base/business/general/src/main/java/com/fp/general/helper/PropertiesHelper.java new file mode 100644 index 0000000..d959547 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/helper/PropertiesHelper.java @@ -0,0 +1,182 @@ +package com.fp.general.helper; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Properties; +import java.util.StringTokenizer; + + + + +//Referenced classes of package org.hibernate.util: +// StringHelper, ArrayHelper + +public final class PropertiesHelper +{ + + private static final String PLACEHOLDER_START = "${"; + + private PropertiesHelper() + { + } + + public static String getString(String propertyName, Properties properties, String defaultValue) + { + String value = extractPropertyValue(propertyName, properties); + return value != null ? value : defaultValue; + } + + public static String extractPropertyValue(String propertyName, Properties properties) + { + String value = properties.getProperty(propertyName); + if(value == null) + { + return null; + } + value = value.trim(); + if(StringHelper.isEmpty(value)) + { + return null; + } else + { + return value; + } + } + + public static boolean getBoolean(String propertyName, Properties properties) + { + return getBoolean(propertyName, properties, false); + } + + public static boolean getBoolean(String propertyName, Properties properties, boolean defaultValue) + { + String value = extractPropertyValue(propertyName, properties); + return value != null ? Boolean.valueOf(value).booleanValue() : defaultValue; + } + + public static int getInt(String propertyName, Properties properties, int defaultValue) + { + String value = extractPropertyValue(propertyName, properties); + return value != null ? Integer.parseInt(value) : defaultValue; + } + + public static Integer getInteger(String propertyName, Properties properties) + { + String value = extractPropertyValue(propertyName, properties); + return value != null ? Integer.valueOf(value) : null; + } + + public static Map toMap(String propertyName, String delim, Properties properties) + { + Map map = new HashMap(); + String value = extractPropertyValue(propertyName, properties); + if(value != null) + { + for(StringTokenizer tokens = new StringTokenizer(value, delim); tokens.hasMoreTokens(); map.put(tokens.nextToken(), tokens.hasMoreElements() ? ((Object) (tokens.nextToken())) : "")) { } + } + return map; + } + + public static String[] toStringArray(String propertyName, String delim, Properties properties) + { + return toStringArray(extractPropertyValue(propertyName, properties), delim); + } + + public static String[] toStringArray(String stringForm, String delim) + { + if(stringForm != null) + { + return StringHelper.split(delim, stringForm); + } else + { + return ArrayHelper.EMPTY_STRING_ARRAY; + } + } + + public static Properties maskOut(Properties props, String key) + { + Properties clone = (Properties)props.clone(); + if(clone.get(key) != null) + { + clone.setProperty(key, "****"); + } + return clone; + } + + public static void resolvePlaceHolders(Properties properties) + { + Iterator itr = properties.entrySet().iterator(); + do + { + if(!itr.hasNext()) + { + break; + } + java.util.Map.Entry entry = (java.util.Map.Entry)itr.next(); + Object value = entry.getValue(); + if(value != null && String.class.isInstance(value)) + { + String resolved = resolvePlaceHolder((String)value); + if(!value.equals(resolved)) + { + if(resolved == null) + { + itr.remove(); + } else + { + entry.setValue(resolved); + } + } + } + } while(true); + } + + public static String resolvePlaceHolder(String property) + { + if(property.indexOf("${") < 0) + { + return property; + } + StringBuffer buff = new StringBuffer(); + char chars[] = property.toCharArray(); + for(int pos = 0; pos < chars.length; pos++) + { + if(chars[pos] == '$' && chars[pos + 1] == '{') + { + String systemPropertyName = ""; + int x; + for(x = pos + 2; x < chars.length && chars[x] != '}'; x++) + { + systemPropertyName = (new StringBuilder()).append(systemPropertyName).append(chars[x]).toString(); + if(x == chars.length - 1) + { + throw new IllegalArgumentException((new StringBuilder()).append("unmatched placeholder start [").append(property).append("]").toString()); + } + } + + String systemProperty = extractFromSystem(systemPropertyName); + buff.append(systemProperty != null ? systemProperty : ""); + pos = x + 1; + if(pos >= chars.length) + { + break; + } + } + buff.append(chars[pos]); + } + + String rtn = buff.toString(); + return StringHelper.isEmpty(rtn) ? null : rtn; + } + + + private static String extractFromSystem(String systemPropertyName) { + try { + return System.getProperty( systemPropertyName ); + } + catch( Throwable t ) { + return null; + } + } +} diff --git a/base/business/general/src/main/java/com/fp/general/helper/SolicitudeNumber.java b/base/business/general/src/main/java/com/fp/general/helper/SolicitudeNumber.java new file mode 100644 index 0000000..ab4b615 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/helper/SolicitudeNumber.java @@ -0,0 +1,70 @@ +package com.fp.general.helper; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.HqlStatement; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.gene.TgeneUserSolicitudeNumber; +import com.fp.persistence.pgeneral.safe.TsafeUser; + +/** + * Clase que entrega la secuencia de solicitud a utilizar por usuario. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class SolicitudeNumber extends QueryRule { + + /** + * Metodo que entrega el numero de solicitud, para el usuario. + * + * @param pQueryRequest Datos del request. + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + try { + TgeneUserSolicitudeNumber solicitudnumber = this.getTgeneUserSolicitudeNumber(pQueryRequest.getUser()); + if (pQueryRequest.getInternalUserCode() == null) { + TsafeUser user = com.fp.base.persistence.util.db.DataHelper.getInstance().getTsafeUser(pQueryRequest.getUser()); + pQueryRequest.setInternalUserCode(user.getInternalcode()); + } + String sol = pQueryRequest.getInternalUserCode() + solicitudnumber.getSolicitudnumber(); + response.put("solicitudenumber", sol); + solicitudnumber = PersistenceHelper.getEntityManager().merge(solicitudnumber); + + return pQueryRequest; + } catch (Exception e) { + throw e; + } + } + + /** + * Metodo que entrega la secuencia de solicitud a utilizar, esta se define por usuario.
+ * Si no existe un registro en la tabla crea uno, si existe suma 1 a la secuencia de la solicitud. + * + * @param pUserCode Codigo de usuario a obtener el numero de solicitud. + * @return TgeneUserSolicitudeNumber + * @throws Exception + */ + protected TgeneUserSolicitudeNumber getTgeneUserSolicitudeNumber(String pUserCode) throws Exception { + TgeneUserSolicitudeNumber tgeneUserSolicitudeNumber = null; + HqlStatement hql = new HqlStatement(SolicitudeNumber.HQL); + hql.setString("usercode", pUserCode); + tgeneUserSolicitudeNumber = (TgeneUserSolicitudeNumber) hql.getObject(); + if (tgeneUserSolicitudeNumber == null) { + tgeneUserSolicitudeNumber = new TgeneUserSolicitudeNumber(); + tgeneUserSolicitudeNumber.setPk(pUserCode); + tgeneUserSolicitudeNumber.setSolicitudnumber("0"); + } + Integer sec = Integer.valueOf(tgeneUserSolicitudeNumber.getSolicitudnumber()); + sec++; + tgeneUserSolicitudeNumber.setSolicitudnumber(sec.toString()); + return tgeneUserSolicitudeNumber; + } + + /** Sentencia que obtiene un registro de TgeneUserSolicitudeNumber con la secuencia de solicitud por usuario. */ + private static final String HQL = "from com.fp.persistence.pgeneral.gene.TgeneUserSolicitudeNumber t " + " where t.pk = :usercode "; +} diff --git a/base/business/general/src/main/java/com/fp/general/helper/StringHelper.java b/base/business/general/src/main/java/com/fp/general/helper/StringHelper.java new file mode 100644 index 0000000..79d0d30 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/helper/StringHelper.java @@ -0,0 +1,639 @@ +package com.fp.general.helper; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.StringTokenizer; + +import org.hibernate.dialect.Dialect; + + +// Referenced classes of package org.hibernate.util: +// ArrayHelper + +public final class StringHelper +{ + + private static final int ALIAS_TRUNCATE_LENGTH = 10; + public static final String WHITESPACE = " \n\r\f\t"; + + private StringHelper() + { + } + + public static int lastIndexOfLetter(String string) + { + for(int i = 0; i < string.length(); i++) + { + char character = string.charAt(i); + if(!Character.isLetter(character)) + { + return i - 1; + } + } + + return string.length() - 1; + } + + public static String join(String seperator, String strings[]) + { + int length = strings.length; + if(length == 0) + { + return ""; + } + StringBuffer buf = (new StringBuffer(length * strings[0].length())).append(strings[0]); + for(int i = 1; i < length; i++) + { + buf.append(seperator).append(strings[i]); + } + + return buf.toString(); + } + + public static String join(String seperator, Iterator objects) + { + StringBuffer buf = new StringBuffer(); + if(objects.hasNext()) + { + buf.append(objects.next()); + } + for(; objects.hasNext(); buf.append(seperator).append(objects.next())) { } + return buf.toString(); + } + + public static String[] add(String x[], String sep, String y[]) + { + String result[] = new String[x.length]; + for(int i = 0; i < x.length; i++) + { + result[i] = (new StringBuilder()).append(x[i]).append(sep).append(y[i]).toString(); + } + + return result; + } + + public static String repeat(String string, int times) + { + StringBuffer buf = new StringBuffer(string.length() * times); + for(int i = 0; i < times; i++) + { + buf.append(string); + } + + return buf.toString(); + } + + public static String repeat(char character, int times) + { + char buffer[] = new char[times]; + Arrays.fill(buffer, character); + return new String(buffer); + } + + public static String replace(String template, String placeholder, String replacement) + { + return replace(template, placeholder, replacement, false); + } + + public static String[] replace(String templates[], String placeholder, String replacement) + { + String result[] = new String[templates.length]; + for(int i = 0; i < templates.length; i++) + { + result[i] = replace(templates[i], placeholder, replacement); + } + + return result; + } + + public static String replace(String template, String placeholder, String replacement, boolean wholeWords) + { + return replace(template, placeholder, replacement, wholeWords, false); + } + + public static String replace(String template, String placeholder, String replacement, boolean wholeWords, boolean encloseInParensIfNecessary) + { + if(template == null) + { + return template; + } + int loc = template.indexOf(placeholder); + if(loc < 0) + { + return template; + } else + { + String beforePlaceholder = template.substring(0, loc); + String afterPlaceholder = template.substring(loc + placeholder.length()); + return replace(beforePlaceholder, afterPlaceholder, placeholder, replacement, wholeWords, encloseInParensIfNecessary); + } + } + + public static String replace(String beforePlaceholder, String afterPlaceholder, String placeholder, String replacement, boolean wholeWords, boolean encloseInParensIfNecessary) + { + boolean actuallyReplace = !wholeWords || afterPlaceholder.length() == 0 || !Character.isJavaIdentifierPart(afterPlaceholder.charAt(0)); + boolean encloseInParens = actuallyReplace && encloseInParensIfNecessary && getLastNonWhitespaceCharacter(beforePlaceholder) != '(' && getFirstNonWhitespaceCharacter(afterPlaceholder) != ')'; + StringBuilder buf = new StringBuilder(beforePlaceholder); + if(encloseInParens) + { + buf.append('('); + } + buf.append(actuallyReplace ? replacement : placeholder); + if(encloseInParens) + { + buf.append(')'); + } + buf.append(replace(afterPlaceholder, placeholder, replacement, wholeWords, encloseInParensIfNecessary)); + return buf.toString(); + } + + public static char getLastNonWhitespaceCharacter(String str) + { + if(str != null && str.length() > 0) + { + for(int i = str.length() - 1; i >= 0; i--) + { + char ch = str.charAt(i); + if(!Character.isWhitespace(ch)) + { + return ch; + } + } + + } + return '\0'; + } + + public static char getFirstNonWhitespaceCharacter(String str) + { + if(str != null && str.length() > 0) + { + for(int i = 0; i < str.length(); i++) + { + char ch = str.charAt(i); + if(!Character.isWhitespace(ch)) + { + return ch; + } + } + + } + return '\0'; + } + + public static String replaceOnce(String template, String placeholder, String replacement) + { + if(template == null) + { + return template; + } + int loc = template.indexOf(placeholder); + if(loc < 0) + { + return template; + } else + { + return template.substring(0, loc) + replacement + template.substring(loc + placeholder.length()); + } + } + + public static String[] split(String seperators, String list) + { + return split(seperators, list, false); + } + + public static String[] split(String seperators, String list, boolean include) + { + StringTokenizer tokens = new StringTokenizer(list, seperators, include); + String result[] = new String[tokens.countTokens()]; + int i = 0; + while(tokens.hasMoreTokens()) + { + result[i++] = tokens.nextToken(); + } + return result; + } + + public static String unqualify(String qualifiedName) + { + int loc = qualifiedName.lastIndexOf("."); + return loc >= 0 ? qualifiedName.substring(qualifiedName.lastIndexOf(".") + 1) : qualifiedName; + } + + public static String qualifier(String qualifiedName) + { + int loc = qualifiedName.lastIndexOf("."); + return loc >= 0 ? qualifiedName.substring(0, loc) : ""; + } + + public static String collapse(String name) + { + if(name == null) + { + return null; + } + int breakPoint = name.lastIndexOf('.'); + if(breakPoint < 0) + { + return name; + } else + { + return (new StringBuilder()).append(collapseQualifier(name.substring(0, breakPoint), true)).append(name.substring(breakPoint)).toString(); + } + } + + public static String collapseQualifier(String qualifier, boolean includeDots) + { + StringTokenizer tokenizer = new StringTokenizer(qualifier, "."); + String collapsed; + for(collapsed = Character.toString(tokenizer.nextToken().charAt(0)); tokenizer.hasMoreTokens(); collapsed = (new StringBuilder()).append(collapsed).append(tokenizer.nextToken().charAt(0)).toString()) + { + if(includeDots) + { + collapsed = (new StringBuilder()).append(collapsed).append('.').toString(); + } + } + + return collapsed; + } + + public static String partiallyUnqualify(String name, String qualifierBase) + { + if(name == null || !name.startsWith(qualifierBase)) + { + return name; + } else + { + return name.substring(qualifierBase.length() + 1); + } + } + + public static String collapseQualifierBase(String name, String qualifierBase) + { + if(name == null || !name.startsWith(qualifierBase)) + { + return collapse(name); + } else + { + return (new StringBuilder()).append(collapseQualifier(qualifierBase, true)).append(name.substring(qualifierBase.length())).toString(); + } + } + + public static String[] suffix(String columns[], String suffix) + { + if(suffix == null) + { + return columns; + } + String qualified[] = new String[columns.length]; + for(int i = 0; i < columns.length; i++) + { + qualified[i] = suffix(columns[i], suffix); + } + + return qualified; + } + + private static String suffix(String name, String suffix) + { + return suffix != null ? (new StringBuilder()).append(name).append(suffix).toString() : name; + } + + public static String root(String qualifiedName) + { + int loc = qualifiedName.indexOf("."); + return loc >= 0 ? qualifiedName.substring(0, loc) : qualifiedName; + } + + public static String unroot(String qualifiedName) + { + int loc = qualifiedName.indexOf("."); + return loc >= 0 ? qualifiedName.substring(loc + 1, qualifiedName.length()) : qualifiedName; + } + + public static boolean booleanValue(String tfString) + { + String trimmed = tfString.trim().toLowerCase(); + return trimmed.equals("true") || trimmed.equals("t"); + } + + public static String toString(Object array[]) + { + int len = array.length; + if(len == 0) + { + return ""; + } + StringBuffer buf = new StringBuffer(len * 12); + for(int i = 0; i < len - 1; i++) + { + buf.append(array[i]).append(", "); + } + + return buf.append(array[len - 1]).toString(); + } + + public static String[] multiply(String string, Iterator placeholders, Iterator replacements) + { + String result[]; + for(result = (new String[] { + string +}); placeholders.hasNext(); result = multiply(result, (String)placeholders.next(), (String[])replacements.next())) { } + return result; + } + + private static String[] multiply(String strings[], String placeholder, String replacements[]) + { + String results[] = new String[replacements.length * strings.length]; + int n = 0; + for(int i = 0; i < replacements.length; i++) + { + for(int j = 0; j < strings.length; j++) + { + results[n++] = replaceOnce(strings[j], placeholder, replacements[i]); + } + + } + + return results; + } + + public static int countUnquoted(String string, char character) + { + if('\'' == character) + { + throw new IllegalArgumentException("Unquoted count of quotes is invalid"); + } + if(string == null) + { + return 0; + } + int count = 0; + int stringLength = string.length(); + boolean inQuote = false; + for(int indx = 0; indx < stringLength; indx++) + { + char c = string.charAt(indx); + if(inQuote) + { + if('\'' == c) + { + inQuote = false; + } + continue; + } + if('\'' == c) + { + inQuote = true; + continue; + } + if(c == character) + { + count++; + } + } + + return count; + } + + public static int[] locateUnquoted(String string, char character) + { + if('\'' == character) + { + throw new IllegalArgumentException("Unquoted count of quotes is invalid"); + } + if(string == null) + { + return new int[0]; + } + ArrayList locations = new ArrayList(20); + int stringLength = string.length(); + boolean inQuote = false; + for(int indx = 0; indx < stringLength; indx++) + { + char c = string.charAt(indx); + if(inQuote) + { + if('\'' == c) + { + inQuote = false; + } + continue; + } + if('\'' == c) + { + inQuote = true; + continue; + } + if(c == character) + { + locations.add(new Integer(indx)); + } + } + + return ArrayHelper.toIntArray(locations); + } + + public static boolean isNotEmpty(String string) + { + return string != null && string.length() > 0; + } + + public static boolean isEmpty(String string) + { + return string == null || string.length() == 0; + } + + public static String qualify(String prefix, String name) + { + if(name == null || prefix == null) + { + throw new NullPointerException(); + } else + { + return (new StringBuffer(prefix.length() + name.length() + 1)).append(prefix).append('.').append(name).toString(); + } + } + + public static String[] qualify(String prefix, String names[]) + { + if(prefix == null) + { + return names; + } + int len = names.length; + String qualified[] = new String[len]; + for(int i = 0; i < len; i++) + { + qualified[i] = qualify(prefix, names[i]); + } + + return qualified; + } + + public static int firstIndexOfChar(String sqlString, String string, int startindex) + { + int matchAt = -1; + for(int i = 0; i < string.length(); i++) + { + int curMatch = sqlString.indexOf(string.charAt(i), startindex); + if(curMatch < 0) + { + continue; + } + if(matchAt == -1) + { + matchAt = curMatch; + } else + { + matchAt = Math.min(matchAt, curMatch); + } + } + + return matchAt; + } + + public static String truncate(String string, int length) + { + if(string.length() <= length) + { + return string; + } else + { + return string.substring(0, length); + } + } + + public static String generateAlias(String description) + { + return (new StringBuilder()).append(generateAliasRoot(description)).append('_').toString(); + } + + public static String generateAlias(String description, int unique) + { + return (new StringBuilder()).append(generateAliasRoot(description)).append(Integer.toString(unique)).append('_').toString(); + } + + private static String generateAliasRoot(String description) + { + String result = truncate(unqualifyEntityName(description), 10).toLowerCase().replace('/', '_').replace('$', '_'); + result = cleanAlias(result); + if(Character.isDigit(result.charAt(result.length() - 1))) + { + return (new StringBuilder()).append(result).append("x").toString(); + } else + { + return result; + } + } + + private static String cleanAlias(String alias) + { + char chars[] = alias.toCharArray(); + if(!Character.isLetter(chars[0])) + { + for(int i = 1; i < chars.length; i++) + { + if(Character.isLetter(chars[i])) + { + return alias.substring(i); + } + } + + } + return alias; + } + + public static String unqualifyEntityName(String entityName) + { + String result = unqualify(entityName); + int slashPos = result.indexOf('/'); + if(slashPos > 0) + { + result = result.substring(0, slashPos - 1); + } + return result; + } + + public static String toUpperCase(String str) + { + return str != null ? str.toUpperCase() : null; + } + + public static String toLowerCase(String str) + { + return str != null ? str.toLowerCase() : null; + } + + public static String moveAndToBeginning(String filter) + { + if(filter.trim().length() > 0) + { + filter = (new StringBuilder()).append(filter).append(" and ").toString(); + if(filter.startsWith(" and ")) + { + filter = filter.substring(4); + } + } + return filter; + } + + public static boolean isQuoted(String name) + { + return name != null && name.length() != 0 && name.charAt(0) == '`' && name.charAt(name.length() - 1) == '`'; + } + + public static String quote(String name) + { + if(name == null || name.length() == 0 || isQuoted(name)) + { + return name; + } else + { + return (new StringBuffer(name.length() + 2)).append('`').append(name).append('`').toString(); + } + } + + public static String unquote(String name) + { + if(isQuoted(name)) + { + return name.substring(1, name.length() - 1); + } else + { + return name; + } + } + + public static boolean isQuoted(String name, Dialect dialect) + { + return name != null && name.length() != 0 && (name.charAt(0) == '`' && name.charAt(name.length() - 1) == '`' || name.charAt(0) == dialect.openQuote() && name.charAt(name.length() - 1) == dialect.closeQuote()); + } + + public static String unquote(String name, Dialect dialect) + { + if(isQuoted(name, dialect)) + { + return name.substring(1, name.length() - 1); + } else + { + return name; + } + } + + public static String[] unquote(String names[], Dialect dialect) + { + if(names == null) + { + return null; + } + String unquoted[] = new String[names.length]; + for(int i = 0; i < names.length; i++) + { + unquoted[i] = unquote(names[i], dialect); + } + + return unquoted; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/keygen/.svn/entries b/base/business/general/src/main/java/com/fp/general/keygen/.svn/entries new file mode 100644 index 0000000..aeca068 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/keygen/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/keygen +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +SequenceKey.java +file + + + + +2022-07-28T03:40:43.280805Z +70eb06f67cdae668e5f44614a4e13fd3 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2228 + +AbstractKeyGen.java +file + + + + +2022-07-28T03:40:43.281805Z +f6bc3c771dd626c94c7393567c321830 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +421 + +SubSequenceKey.java +file + + + + +2022-07-28T03:40:43.281805Z +8b6588e08d051ed1f947d8d950e22b74 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3122 + diff --git a/base/business/general/src/main/java/com/fp/general/keygen/.svn/text-base/AbstractKeyGen.java.svn-base b/base/business/general/src/main/java/com/fp/general/keygen/.svn/text-base/AbstractKeyGen.java.svn-base new file mode 100644 index 0000000..2343c0c --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/keygen/.svn/text-base/AbstractKeyGen.java.svn-base @@ -0,0 +1,14 @@ +package com.fp.general.keygen; + +import org.apache.commons.lang.StringUtils; + +public abstract class AbstractKeyGen { + protected boolean isString(Class pType) { + return pType.getName().compareTo(String.class.getName()) == 0; + } + + protected String fill(String pValue, String pFill, Integer pLength) { + String val = pValue; + return StringUtils.leftPad(val, pLength, pFill.charAt(0)); + } +} diff --git a/base/business/general/src/main/java/com/fp/general/keygen/.svn/text-base/SequenceKey.java.svn-base b/base/business/general/src/main/java/com/fp/general/keygen/.svn/text-base/SequenceKey.java.svn-base new file mode 100644 index 0000000..8931188 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/keygen/.svn/text-base/SequenceKey.java.svn-base @@ -0,0 +1,66 @@ +package com.fp.general.keygen; + +import java.io.Serializable; +import java.util.Properties; + +import org.hibernate.HibernateException; +import org.hibernate.MappingException; +import org.hibernate.dialect.Dialect; +import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.id.Configurable; +import org.hibernate.id.IdentifierGenerator; +import org.hibernate.type.Type; + +import com.fp.common.helper.BeanManager; +import com.fp.general.helper.PropertiesHelper; +import com.fp.sessionbeans.helper.Sequence; + +public class SequenceKey extends AbstractKeyGen implements IdentifierGenerator, Configurable { + public static final String SEQUENCE_NAME = "name"; + + public static final String TYPE = "type"; + + public static final String FILL = "fill"; + + public static final String LENGTH = "length"; + + private String sequenceName = null; + + private String fill = null; + + private Integer length = null; + + private Class type = null; + + @Override + public Serializable generate(SessionImplementor session, Object object) throws HibernateException { + try { + Sequence s = new Sequence(); + Serializable val = (Serializable) BeanManager.convertObject(s.getNextValue(this.sequenceName), this.type); + if (this.isString(this.type) && (this.fill != null)) { + val = this.fill((String) val, this.fill, this.length); + } + return val; + } catch (Exception e) { + throw new HibernateException(e); + } + } + + @Override + public void configure(Type pType, Properties pParams, Dialect pD) throws MappingException { + this.sequenceName = PropertiesHelper.getString(SequenceKey.SEQUENCE_NAME, pParams, null); + try { + this.fill = PropertiesHelper.getString(SequenceKey.FILL, pParams, null); + this.length = PropertiesHelper.getInteger(SequenceKey.LENGTH, pParams); + } catch (Exception e) { + this.fill = null; + this.length = null; + } + try { + this.type = Class.forName(PropertiesHelper.getString(SequenceKey.TYPE, pParams, null)); + } catch (ClassNotFoundException e) { + throw new MappingException(e); + } + } + +} \ No newline at end of file diff --git a/base/business/general/src/main/java/com/fp/general/keygen/.svn/text-base/SubSequenceKey.java.svn-base b/base/business/general/src/main/java/com/fp/general/keygen/.svn/text-base/SubSequenceKey.java.svn-base new file mode 100644 index 0000000..f2321e9 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/keygen/.svn/text-base/SubSequenceKey.java.svn-base @@ -0,0 +1,86 @@ +package com.fp.general.keygen; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import org.hibernate.HibernateException; +import org.hibernate.MappingException; +import org.hibernate.dialect.Dialect; +import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.id.Configurable; +import org.hibernate.id.IdentifierGenerator; +import org.hibernate.type.Type; + +import com.fp.common.helper.BeanManager; +import com.fp.general.helper.PropertiesHelper; +import com.fp.persistence.commondb.PersistenceHelper; + +public class SubSequenceKey extends AbstractKeyGen implements IdentifierGenerator, Configurable { + public static final String SQL = "sql"; + + public static final String TYPE = "type"; + + public static final String PARAM = "param"; + + public static final String FIELD = "field"; + + private String sql = null; + + private String field = null; + + private Class type = null; + + private final List> param = new ArrayList>(); + + @Override + public Serializable generate(SessionImplementor session, Object object) throws HibernateException { + try { + EntityManager em = PersistenceHelper.getEntityManager(); + em.flush(); + Query q = em.createNativeQuery(this.sql); + for (Map p : this.param) { + q.setParameter(p.get("NAME"), BeanManager.getBeanAttributeValue(object, p.get("FIELD"))); + } + Object pk = BeanManager.getBeanAttributeValue(object, "pk"); + Object val = BeanManager.convertObject(q.getSingleResult(), this.type); + BeanManager.setBeanAttributeValue(pk, this.field, val); + return (Serializable) pk; + } catch (Exception e) { + throw new HibernateException(e); + } + } + + @Override + public void configure(Type pType, Properties pParams, Dialect pD) throws MappingException { + this.sql = PropertiesHelper.getString(SubSequenceKey.SQL, pParams, null).toUpperCase(); + this.field = PropertiesHelper.getString(SubSequenceKey.FIELD, pParams, null); + try { + this.type = Class.forName(PropertiesHelper.getString(SubSequenceKey.TYPE, pParams, null)); + } catch (ClassNotFoundException e) { + throw new MappingException(e); + } + try { + String sParam = PropertiesHelper.getString(SubSequenceKey.PARAM, pParams, null); + if (sParam != null) { + String[] aParam = sParam.split(";"); + for (String val : aParam) { + String[] aVal = val.split(","); + Map m = new HashMap(); + m.put("NAME", aVal[0].toUpperCase()); + m.put("FIELD", aVal[1]); + this.param.add(m); + } + } + } catch (Exception e) { + throw new MappingException(e); + } + } + +} \ No newline at end of file diff --git a/base/business/general/src/main/java/com/fp/general/keygen/AbstractKeyGen.java b/base/business/general/src/main/java/com/fp/general/keygen/AbstractKeyGen.java new file mode 100644 index 0000000..2343c0c --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/keygen/AbstractKeyGen.java @@ -0,0 +1,14 @@ +package com.fp.general.keygen; + +import org.apache.commons.lang.StringUtils; + +public abstract class AbstractKeyGen { + protected boolean isString(Class pType) { + return pType.getName().compareTo(String.class.getName()) == 0; + } + + protected String fill(String pValue, String pFill, Integer pLength) { + String val = pValue; + return StringUtils.leftPad(val, pLength, pFill.charAt(0)); + } +} diff --git a/base/business/general/src/main/java/com/fp/general/keygen/SequenceKey.java b/base/business/general/src/main/java/com/fp/general/keygen/SequenceKey.java new file mode 100644 index 0000000..8931188 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/keygen/SequenceKey.java @@ -0,0 +1,66 @@ +package com.fp.general.keygen; + +import java.io.Serializable; +import java.util.Properties; + +import org.hibernate.HibernateException; +import org.hibernate.MappingException; +import org.hibernate.dialect.Dialect; +import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.id.Configurable; +import org.hibernate.id.IdentifierGenerator; +import org.hibernate.type.Type; + +import com.fp.common.helper.BeanManager; +import com.fp.general.helper.PropertiesHelper; +import com.fp.sessionbeans.helper.Sequence; + +public class SequenceKey extends AbstractKeyGen implements IdentifierGenerator, Configurable { + public static final String SEQUENCE_NAME = "name"; + + public static final String TYPE = "type"; + + public static final String FILL = "fill"; + + public static final String LENGTH = "length"; + + private String sequenceName = null; + + private String fill = null; + + private Integer length = null; + + private Class type = null; + + @Override + public Serializable generate(SessionImplementor session, Object object) throws HibernateException { + try { + Sequence s = new Sequence(); + Serializable val = (Serializable) BeanManager.convertObject(s.getNextValue(this.sequenceName), this.type); + if (this.isString(this.type) && (this.fill != null)) { + val = this.fill((String) val, this.fill, this.length); + } + return val; + } catch (Exception e) { + throw new HibernateException(e); + } + } + + @Override + public void configure(Type pType, Properties pParams, Dialect pD) throws MappingException { + this.sequenceName = PropertiesHelper.getString(SequenceKey.SEQUENCE_NAME, pParams, null); + try { + this.fill = PropertiesHelper.getString(SequenceKey.FILL, pParams, null); + this.length = PropertiesHelper.getInteger(SequenceKey.LENGTH, pParams); + } catch (Exception e) { + this.fill = null; + this.length = null; + } + try { + this.type = Class.forName(PropertiesHelper.getString(SequenceKey.TYPE, pParams, null)); + } catch (ClassNotFoundException e) { + throw new MappingException(e); + } + } + +} \ No newline at end of file diff --git a/base/business/general/src/main/java/com/fp/general/keygen/SubSequenceKey.java b/base/business/general/src/main/java/com/fp/general/keygen/SubSequenceKey.java new file mode 100644 index 0000000..f2321e9 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/keygen/SubSequenceKey.java @@ -0,0 +1,86 @@ +package com.fp.general.keygen; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import org.hibernate.HibernateException; +import org.hibernate.MappingException; +import org.hibernate.dialect.Dialect; +import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.id.Configurable; +import org.hibernate.id.IdentifierGenerator; +import org.hibernate.type.Type; + +import com.fp.common.helper.BeanManager; +import com.fp.general.helper.PropertiesHelper; +import com.fp.persistence.commondb.PersistenceHelper; + +public class SubSequenceKey extends AbstractKeyGen implements IdentifierGenerator, Configurable { + public static final String SQL = "sql"; + + public static final String TYPE = "type"; + + public static final String PARAM = "param"; + + public static final String FIELD = "field"; + + private String sql = null; + + private String field = null; + + private Class type = null; + + private final List> param = new ArrayList>(); + + @Override + public Serializable generate(SessionImplementor session, Object object) throws HibernateException { + try { + EntityManager em = PersistenceHelper.getEntityManager(); + em.flush(); + Query q = em.createNativeQuery(this.sql); + for (Map p : this.param) { + q.setParameter(p.get("NAME"), BeanManager.getBeanAttributeValue(object, p.get("FIELD"))); + } + Object pk = BeanManager.getBeanAttributeValue(object, "pk"); + Object val = BeanManager.convertObject(q.getSingleResult(), this.type); + BeanManager.setBeanAttributeValue(pk, this.field, val); + return (Serializable) pk; + } catch (Exception e) { + throw new HibernateException(e); + } + } + + @Override + public void configure(Type pType, Properties pParams, Dialect pD) throws MappingException { + this.sql = PropertiesHelper.getString(SubSequenceKey.SQL, pParams, null).toUpperCase(); + this.field = PropertiesHelper.getString(SubSequenceKey.FIELD, pParams, null); + try { + this.type = Class.forName(PropertiesHelper.getString(SubSequenceKey.TYPE, pParams, null)); + } catch (ClassNotFoundException e) { + throw new MappingException(e); + } + try { + String sParam = PropertiesHelper.getString(SubSequenceKey.PARAM, pParams, null); + if (sParam != null) { + String[] aParam = sParam.split(";"); + for (String val : aParam) { + String[] aVal = val.split(","); + Map m = new HashMap(); + m.put("NAME", aVal[0].toUpperCase()); + m.put("FIELD", aVal[1]); + this.param.add(m); + } + } + } catch (Exception e) { + throw new MappingException(e); + } + } + +} \ No newline at end of file diff --git a/base/business/general/src/main/java/com/fp/general/rates/.svn/entries b/base/business/general/src/main/java/com/fp/general/rates/.svn/entries new file mode 100644 index 0000000..bc9930d --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rates/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/rates +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +rules +dir + diff --git a/base/business/general/src/main/java/com/fp/general/rates/rules/.svn/entries b/base/business/general/src/main/java/com/fp/general/rates/rules/.svn/entries new file mode 100644 index 0000000..7a385fa --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rates/rules/.svn/entries @@ -0,0 +1,99 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/rates/rules +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +query +dir + +ValidateRates.java +file + + + + +2022-07-28T03:40:44.201809Z +664f4b1144484bd0957d217918dfaec5 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6019 + +VerifyOverlapSubProductRatesAmount.java +file + + + + +2022-07-28T03:40:44.201809Z +fa76b5dabdf9658af232149a7b17f6c7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6828 + diff --git a/base/business/general/src/main/java/com/fp/general/rates/rules/.svn/text-base/ValidateRates.java.svn-base b/base/business/general/src/main/java/com/fp/general/rates/rules/.svn/text-base/ValidateRates.java.svn-base new file mode 100644 index 0000000..a3f6874 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rates/rules/.svn/text-base/ValidateRates.java.svn-base @@ -0,0 +1,145 @@ +package com.fp.general.rates.rules; + +import java.sql.Date; +import java.util.List; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.APPDates; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.product.rate.TgeneBaseRateDetail; + +@SuppressWarnings("serial") +public class ValidateRates extends TransactionRule { + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + String currencycode = pSaveRequest.get("currencycode").toString(); + String baseratecatalog = pSaveRequest.get("baseratecatalog").toString(); + String baseratecatalogcode = pSaveRequest.get("baseratecatalogcode").toString(); + Integer company = pSaveRequest.getCompany(); + + List lRatesMod = pSaveRequest.getSaveBeanModifiedRecords("TGENEBASERATEDETAIL"); + List lRatesDel = pSaveRequest.getSaveBeanDeletedRecords("TGENEBASERATEDETAIL"); + List lRatesDB = TgeneBaseRateDetail.find(PersistenceHelper.getEntityManager(), currencycode, baseratecatalog, + baseratecatalogcode); + + TgeneAccountingDateBranch d = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch(company, 0); + + this.validateDeleted(lRatesDel, lRatesDB, d.getWorkingdate()); + this.validateModified(lRatesMod, lRatesDB, d.getWorkingdate()); + + List lRatesFinal = Constant.getFinalList(lRatesDB, Constant.convertList(lRatesMod, TgeneBaseRateDetail.class), + Constant.convertList(lRatesDel, TgeneBaseRateDetail.class)); + + // Validar traslape de fechas + for (int i = 0; i < lRatesFinal.size(); i++) { + TgeneBaseRateDetail ratedetail = lRatesFinal.get(i); + this.validateOverlap(ratedetail, i + 1, lRatesFinal); + } + + return pSaveRequest; + } + + /** + * Valida que no se borren registros vigentes y pasados + * + * @param lRatesDel + * @param lRatesDB + * @param wdate + * @throws Exception + */ + private void validateDeleted(List lRatesDel, List lRatesDB, Date wdate) throws Exception { + if (lRatesDel != null) { + for (Object obj : lRatesDel) { + TgeneBaseRateDetail ratedetaildel = (TgeneBaseRateDetail) obj; + TgeneBaseRateDetail ratedetailbase = Constant.isInList(lRatesDB, ratedetaildel); + if (ratedetailbase != null) { + int result = this.getDateRange(ratedetailbase.getValidityrate(), ratedetailbase.getExpirationdate(), wdate); + if (result <= 0) { + throw new GeneralException("GENE-0045", "NO SE PUEDE ELIMINAR TASAS CON FECHA VIGENTE O VENCIDA"); + } + } + } + } + } + + /** + * Valida que solo se ingresen tasas con fechas futuras + * + * @param lRatesMod + * @param lRatesDB + * @param wdate + * @throws Exception + */ + private void validateModified(List lRatesMod, List lRatesDB, Date wdate) throws Exception { + if (lRatesMod != null) { + for (Object obj : lRatesMod) { + TgeneBaseRateDetail ratedetailmod = (TgeneBaseRateDetail) obj; + TgeneBaseRateDetail ratedetailbase = Constant.isInList(lRatesDB, ratedetailmod); + if ((ratedetailbase == null) || Constant.ifYes((String) ratedetailmod.get("isnew"))) { + int result = this.getDateRange(ratedetailmod.getValidityrate(), ratedetailmod.getExpirationdate(), wdate); + if (result <= 0) { + throw new GeneralException("GENE-0046", "SOLO SE PUEDE INGRESAR TASAS CON FECHA FUTURAS"); + } + } + } + } + } + + /** + * Valida que no se translapen las fechas de las tasas + * + * @param ratedetail + * @param searchIndex + * @param lRatesFinal + * @return + * @throws Exception + */ + private void validateOverlap(TgeneBaseRateDetail ratedetail, int searchIndex, List lRatesFinal) throws Exception { + for (int i = searchIndex; i < lRatesFinal.size(); i++) { + TgeneBaseRateDetail ratedetailfinal = lRatesFinal.get(i); + if (ratedetail.equalsWithoutRateSequence(ratedetailfinal)) { + int result = this.getDateRange(ratedetail.getValidityrate(), ratedetail.getExpirationdate(), ratedetailfinal.getValidityrate()); + if (result == 0) { + throw new GeneralException("GENE-0047", "EXISTE CRUCE DE FECHAS"); + } + } + } + } + + /** + * Retorna 0 si el parametro actualdate esta dentro del rango, 1 si el rango es > que actualdate, -1 si el rango es + * menor que actualdate + * + * @param initdate + * @param enddate + * @param actualdate + * @return + * @throws Exception + */ + private int getDateRange(Date initdate, Date enddate, Date actualdate) throws Exception { + APPDates init = new APPDates(initdate); + APPDates end = new APPDates(enddate); + APPDates now = new APPDates(actualdate); + + if (init.compareTo(now) > 0) { + return 1; + } else if ((now.compareTo(init) >= 0) && (now.compareTo(end) <= 0)) { + return 0; + } + // else if (end.compareTo(now) < 0) { + // return -1; + // } + return -1; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/rates/rules/.svn/text-base/VerifyOverlapSubProductRatesAmount.java.svn-base b/base/business/general/src/main/java/com/fp/general/rates/rules/.svn/text-base/VerifyOverlapSubProductRatesAmount.java.svn-base new file mode 100644 index 0000000..f501e24 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rates/rules/.svn/text-base/VerifyOverlapSubProductRatesAmount.java.svn-base @@ -0,0 +1,142 @@ +package com.fp.general.rates.rules; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.product.rate.TgeneSubProductRate; + +/** + * Clase que se encarga de verificar traslape en montos de los cargos. + * + * @author Angel Merchan. + * @version 2.1 + * + */ +@SuppressWarnings("serial") +public class VerifyOverlapSubProductRatesAmount extends TransactionRule { + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (pSaveRequest.getSaveBean("TGENESUBPRODUCTRATE") != null) { + this.validateTgeneSubProductRates(pSaveRequest); + } + + return pSaveRequest; + } + + private void validateTgeneSubProductRates(SaveRequest pSaveRequest) throws Exception { + String modulecode = pSaveRequest.get("modulecode").toString(); + String productcode = pSaveRequest.get("productcode").toString(); + String subproductcode = pSaveRequest.get("subproductcode").toString(); + String currencycode = pSaveRequest.get("currencycode").toString(); + Integer company = pSaveRequest.getCompany(); + + List lSubProductRatesgesModified = pSaveRequest.getSaveBeanModifiedRecords("TGENESUBPRODUCTRATE"); + List lSubProductRatesDeleted = pSaveRequest.getSaveBeanDeletedRecords("TGENESUBPRODUCTRATE"); + List listSubProductRatesDatabase = TgeneSubProductRate.find(PersistenceHelper.getEntityManager(), modulecode, + productcode, subproductcode, currencycode, company); + List listSubProductRatesFinal = new ArrayList(); + + listSubProductRatesFinal = Constant.getFinalList(listSubProductRatesDatabase, + Constant.convertList(lSubProductRatesgesModified, TgeneSubProductRate.class), + Constant.convertList(lSubProductRatesDeleted, TgeneSubProductRate.class)); + + // Validar traslape de plazo + for (int i = 0; i < listSubProductRatesFinal.size(); i++) { + TgeneSubProductRate prodratesfinal = listSubProductRatesFinal.get(i); + this.validateOverlapTerm(prodratesfinal, i + 1, listSubProductRatesFinal); + } + + // Validar traslape de monto por plazo + for (int i = 0; i < listSubProductRatesFinal.size(); i++) { + TgeneSubProductRate prodratesfinal = listSubProductRatesFinal.get(i); + this.validateOverlapAmountByTerm(prodratesfinal, i + 1, listSubProductRatesFinal); + } + } + + /** + * + * @param prodratesfinal + * @param index + * @param listSubProductRateFinal + * @throws Exception + */ + private void validateOverlapTerm(TgeneSubProductRate prodratesfinal, int index, List listSubProductRateFinal) + throws Exception { + Integer minterm = prodratesfinal.getMinterm(); + Integer maxterm = prodratesfinal.getMaxterm(); + + if (minterm.compareTo(maxterm) >= 0) { + throw new GeneralException("GENE-0050", "EL TRMINO MNIMO DEBE SER MENOR AL TRMINO MXIMO EN {0}", "[CARGOS POR TASAS]"); + } + + for (int i = index; i < listSubProductRateFinal.size(); i++) { + TgeneSubProductRate prodrates = listSubProductRateFinal.get(i); + + if (prodratesfinal.equalsWithoutSequence(prodrates)) { + Integer mintermcmp = prodrates.getMinterm(); + Integer maxtermcmp = prodrates.getMaxterm(); + + if ((minterm.compareTo(mintermcmp) == 0) && (maxterm.compareTo(maxtermcmp) == 0)) { + prodrates = null; + continue; + } else if ((minterm.compareTo(maxtermcmp) == 0) || (maxterm.compareTo(mintermcmp) == 0) || (minterm.compareTo(mintermcmp) == 0) + || (maxterm.compareTo(maxtermcmp) == 0) || ((minterm.compareTo(mintermcmp) > 0) && (maxterm.compareTo(maxtermcmp) < 0)) + || ((minterm.compareTo(mintermcmp) < 0) && (maxterm.compareTo(maxtermcmp) > 0))) { + throw new GeneralException("GENE-0051", "LOS TRMINOS PARA EL TIPO DE BALANCE {0} SE SOBREPONEN EN {1}", prodratesfinal.getPk() + .getInterestbalancetype(), "[TASAS POR SUBPRODUCTO]"); + } + } + prodrates = null; + } + } + + /** + * Metodo que verifica el traslape de montos de un cargo + * + * @param prodchargesfinal + * @param index + * @param listSubProductChargesFinal + * @throws Exception + */ + private void validateOverlapAmountByTerm(TgeneSubProductRate prodratesfinal, int index, List listSubProductRateFinal) + throws Exception { + BigDecimal minamount = prodratesfinal.getMinamount(); + BigDecimal maxamount = prodratesfinal.getMaxamount(); + + if (minamount.compareTo(maxamount) >= 0) { + throw new GeneralException("GENE-0040", "EL MONTO MNIMO DEBE SER MENOR AL MONTO MXIMO EN {0}", "[TASAS POR SUBPRODUCTO]"); + } + + for (int i = index; i < listSubProductRateFinal.size(); i++) { + TgeneSubProductRate prodrates = listSubProductRateFinal.get(i); + + if (prodratesfinal.equalsWithoutSequence(prodrates) && (prodratesfinal.getMinterm().compareTo(prodrates.getMinterm()) == 0) + && (prodratesfinal.getMaxterm().compareTo(prodrates.getMaxterm()) == 0)) { + BigDecimal minamountcmp = prodrates.getMinamount(); + BigDecimal maxamountcmp = prodrates.getMaxamount(); + + if (((minamount.compareTo(maxamountcmp) <= 0) && (minamount.compareTo(minamountcmp) >= 0)) + || ((minamount.compareTo(minamountcmp) >= 0) && (maxamount.compareTo(maxamountcmp) <= 0)) + || ((minamount.compareTo(minamountcmp) <= 0) && (maxamount.compareTo(maxamountcmp) >= 0)) + || ((maxamount.compareTo(minamountcmp) >= 0) && (maxamount.compareTo(maxamountcmp) <= 0))) { + throw new GeneralException("GENE-0041", "LOS VALORES PARA EL TIPO DE BALANCE {0} SE SOBREPONEN EN {1}", prodratesfinal.getPk() + .getInterestbalancetype(), "[TASAS POR SUBPRODUCTO]"); + } + } + prodrates = null; + } + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/rates/rules/ValidateRates.java b/base/business/general/src/main/java/com/fp/general/rates/rules/ValidateRates.java new file mode 100644 index 0000000..a3f6874 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rates/rules/ValidateRates.java @@ -0,0 +1,145 @@ +package com.fp.general.rates.rules; + +import java.sql.Date; +import java.util.List; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.APPDates; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.product.rate.TgeneBaseRateDetail; + +@SuppressWarnings("serial") +public class ValidateRates extends TransactionRule { + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + String currencycode = pSaveRequest.get("currencycode").toString(); + String baseratecatalog = pSaveRequest.get("baseratecatalog").toString(); + String baseratecatalogcode = pSaveRequest.get("baseratecatalogcode").toString(); + Integer company = pSaveRequest.getCompany(); + + List lRatesMod = pSaveRequest.getSaveBeanModifiedRecords("TGENEBASERATEDETAIL"); + List lRatesDel = pSaveRequest.getSaveBeanDeletedRecords("TGENEBASERATEDETAIL"); + List lRatesDB = TgeneBaseRateDetail.find(PersistenceHelper.getEntityManager(), currencycode, baseratecatalog, + baseratecatalogcode); + + TgeneAccountingDateBranch d = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch(company, 0); + + this.validateDeleted(lRatesDel, lRatesDB, d.getWorkingdate()); + this.validateModified(lRatesMod, lRatesDB, d.getWorkingdate()); + + List lRatesFinal = Constant.getFinalList(lRatesDB, Constant.convertList(lRatesMod, TgeneBaseRateDetail.class), + Constant.convertList(lRatesDel, TgeneBaseRateDetail.class)); + + // Validar traslape de fechas + for (int i = 0; i < lRatesFinal.size(); i++) { + TgeneBaseRateDetail ratedetail = lRatesFinal.get(i); + this.validateOverlap(ratedetail, i + 1, lRatesFinal); + } + + return pSaveRequest; + } + + /** + * Valida que no se borren registros vigentes y pasados + * + * @param lRatesDel + * @param lRatesDB + * @param wdate + * @throws Exception + */ + private void validateDeleted(List lRatesDel, List lRatesDB, Date wdate) throws Exception { + if (lRatesDel != null) { + for (Object obj : lRatesDel) { + TgeneBaseRateDetail ratedetaildel = (TgeneBaseRateDetail) obj; + TgeneBaseRateDetail ratedetailbase = Constant.isInList(lRatesDB, ratedetaildel); + if (ratedetailbase != null) { + int result = this.getDateRange(ratedetailbase.getValidityrate(), ratedetailbase.getExpirationdate(), wdate); + if (result <= 0) { + throw new GeneralException("GENE-0045", "NO SE PUEDE ELIMINAR TASAS CON FECHA VIGENTE O VENCIDA"); + } + } + } + } + } + + /** + * Valida que solo se ingresen tasas con fechas futuras + * + * @param lRatesMod + * @param lRatesDB + * @param wdate + * @throws Exception + */ + private void validateModified(List lRatesMod, List lRatesDB, Date wdate) throws Exception { + if (lRatesMod != null) { + for (Object obj : lRatesMod) { + TgeneBaseRateDetail ratedetailmod = (TgeneBaseRateDetail) obj; + TgeneBaseRateDetail ratedetailbase = Constant.isInList(lRatesDB, ratedetailmod); + if ((ratedetailbase == null) || Constant.ifYes((String) ratedetailmod.get("isnew"))) { + int result = this.getDateRange(ratedetailmod.getValidityrate(), ratedetailmod.getExpirationdate(), wdate); + if (result <= 0) { + throw new GeneralException("GENE-0046", "SOLO SE PUEDE INGRESAR TASAS CON FECHA FUTURAS"); + } + } + } + } + } + + /** + * Valida que no se translapen las fechas de las tasas + * + * @param ratedetail + * @param searchIndex + * @param lRatesFinal + * @return + * @throws Exception + */ + private void validateOverlap(TgeneBaseRateDetail ratedetail, int searchIndex, List lRatesFinal) throws Exception { + for (int i = searchIndex; i < lRatesFinal.size(); i++) { + TgeneBaseRateDetail ratedetailfinal = lRatesFinal.get(i); + if (ratedetail.equalsWithoutRateSequence(ratedetailfinal)) { + int result = this.getDateRange(ratedetail.getValidityrate(), ratedetail.getExpirationdate(), ratedetailfinal.getValidityrate()); + if (result == 0) { + throw new GeneralException("GENE-0047", "EXISTE CRUCE DE FECHAS"); + } + } + } + } + + /** + * Retorna 0 si el parametro actualdate esta dentro del rango, 1 si el rango es > que actualdate, -1 si el rango es + * menor que actualdate + * + * @param initdate + * @param enddate + * @param actualdate + * @return + * @throws Exception + */ + private int getDateRange(Date initdate, Date enddate, Date actualdate) throws Exception { + APPDates init = new APPDates(initdate); + APPDates end = new APPDates(enddate); + APPDates now = new APPDates(actualdate); + + if (init.compareTo(now) > 0) { + return 1; + } else if ((now.compareTo(init) >= 0) && (now.compareTo(end) <= 0)) { + return 0; + } + // else if (end.compareTo(now) < 0) { + // return -1; + // } + return -1; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/rates/rules/VerifyOverlapSubProductRatesAmount.java b/base/business/general/src/main/java/com/fp/general/rates/rules/VerifyOverlapSubProductRatesAmount.java new file mode 100644 index 0000000..f501e24 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rates/rules/VerifyOverlapSubProductRatesAmount.java @@ -0,0 +1,142 @@ +package com.fp.general.rates.rules; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.product.rate.TgeneSubProductRate; + +/** + * Clase que se encarga de verificar traslape en montos de los cargos. + * + * @author Angel Merchan. + * @version 2.1 + * + */ +@SuppressWarnings("serial") +public class VerifyOverlapSubProductRatesAmount extends TransactionRule { + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (pSaveRequest.getSaveBean("TGENESUBPRODUCTRATE") != null) { + this.validateTgeneSubProductRates(pSaveRequest); + } + + return pSaveRequest; + } + + private void validateTgeneSubProductRates(SaveRequest pSaveRequest) throws Exception { + String modulecode = pSaveRequest.get("modulecode").toString(); + String productcode = pSaveRequest.get("productcode").toString(); + String subproductcode = pSaveRequest.get("subproductcode").toString(); + String currencycode = pSaveRequest.get("currencycode").toString(); + Integer company = pSaveRequest.getCompany(); + + List lSubProductRatesgesModified = pSaveRequest.getSaveBeanModifiedRecords("TGENESUBPRODUCTRATE"); + List lSubProductRatesDeleted = pSaveRequest.getSaveBeanDeletedRecords("TGENESUBPRODUCTRATE"); + List listSubProductRatesDatabase = TgeneSubProductRate.find(PersistenceHelper.getEntityManager(), modulecode, + productcode, subproductcode, currencycode, company); + List listSubProductRatesFinal = new ArrayList(); + + listSubProductRatesFinal = Constant.getFinalList(listSubProductRatesDatabase, + Constant.convertList(lSubProductRatesgesModified, TgeneSubProductRate.class), + Constant.convertList(lSubProductRatesDeleted, TgeneSubProductRate.class)); + + // Validar traslape de plazo + for (int i = 0; i < listSubProductRatesFinal.size(); i++) { + TgeneSubProductRate prodratesfinal = listSubProductRatesFinal.get(i); + this.validateOverlapTerm(prodratesfinal, i + 1, listSubProductRatesFinal); + } + + // Validar traslape de monto por plazo + for (int i = 0; i < listSubProductRatesFinal.size(); i++) { + TgeneSubProductRate prodratesfinal = listSubProductRatesFinal.get(i); + this.validateOverlapAmountByTerm(prodratesfinal, i + 1, listSubProductRatesFinal); + } + } + + /** + * + * @param prodratesfinal + * @param index + * @param listSubProductRateFinal + * @throws Exception + */ + private void validateOverlapTerm(TgeneSubProductRate prodratesfinal, int index, List listSubProductRateFinal) + throws Exception { + Integer minterm = prodratesfinal.getMinterm(); + Integer maxterm = prodratesfinal.getMaxterm(); + + if (minterm.compareTo(maxterm) >= 0) { + throw new GeneralException("GENE-0050", "EL TRMINO MNIMO DEBE SER MENOR AL TRMINO MXIMO EN {0}", "[CARGOS POR TASAS]"); + } + + for (int i = index; i < listSubProductRateFinal.size(); i++) { + TgeneSubProductRate prodrates = listSubProductRateFinal.get(i); + + if (prodratesfinal.equalsWithoutSequence(prodrates)) { + Integer mintermcmp = prodrates.getMinterm(); + Integer maxtermcmp = prodrates.getMaxterm(); + + if ((minterm.compareTo(mintermcmp) == 0) && (maxterm.compareTo(maxtermcmp) == 0)) { + prodrates = null; + continue; + } else if ((minterm.compareTo(maxtermcmp) == 0) || (maxterm.compareTo(mintermcmp) == 0) || (minterm.compareTo(mintermcmp) == 0) + || (maxterm.compareTo(maxtermcmp) == 0) || ((minterm.compareTo(mintermcmp) > 0) && (maxterm.compareTo(maxtermcmp) < 0)) + || ((minterm.compareTo(mintermcmp) < 0) && (maxterm.compareTo(maxtermcmp) > 0))) { + throw new GeneralException("GENE-0051", "LOS TRMINOS PARA EL TIPO DE BALANCE {0} SE SOBREPONEN EN {1}", prodratesfinal.getPk() + .getInterestbalancetype(), "[TASAS POR SUBPRODUCTO]"); + } + } + prodrates = null; + } + } + + /** + * Metodo que verifica el traslape de montos de un cargo + * + * @param prodchargesfinal + * @param index + * @param listSubProductChargesFinal + * @throws Exception + */ + private void validateOverlapAmountByTerm(TgeneSubProductRate prodratesfinal, int index, List listSubProductRateFinal) + throws Exception { + BigDecimal minamount = prodratesfinal.getMinamount(); + BigDecimal maxamount = prodratesfinal.getMaxamount(); + + if (minamount.compareTo(maxamount) >= 0) { + throw new GeneralException("GENE-0040", "EL MONTO MNIMO DEBE SER MENOR AL MONTO MXIMO EN {0}", "[TASAS POR SUBPRODUCTO]"); + } + + for (int i = index; i < listSubProductRateFinal.size(); i++) { + TgeneSubProductRate prodrates = listSubProductRateFinal.get(i); + + if (prodratesfinal.equalsWithoutSequence(prodrates) && (prodratesfinal.getMinterm().compareTo(prodrates.getMinterm()) == 0) + && (prodratesfinal.getMaxterm().compareTo(prodrates.getMaxterm()) == 0)) { + BigDecimal minamountcmp = prodrates.getMinamount(); + BigDecimal maxamountcmp = prodrates.getMaxamount(); + + if (((minamount.compareTo(maxamountcmp) <= 0) && (minamount.compareTo(minamountcmp) >= 0)) + || ((minamount.compareTo(minamountcmp) >= 0) && (maxamount.compareTo(maxamountcmp) <= 0)) + || ((minamount.compareTo(minamountcmp) <= 0) && (maxamount.compareTo(maxamountcmp) >= 0)) + || ((maxamount.compareTo(minamountcmp) >= 0) && (maxamount.compareTo(maxamountcmp) <= 0))) { + throw new GeneralException("GENE-0041", "LOS VALORES PARA EL TIPO DE BALANCE {0} SE SOBREPONEN EN {1}", prodratesfinal.getPk() + .getInterestbalancetype(), "[TASAS POR SUBPRODUCTO]"); + } + } + prodrates = null; + } + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/rates/rules/query/.svn/entries b/base/business/general/src/main/java/com/fp/general/rates/rules/query/.svn/entries new file mode 100644 index 0000000..29ddd01 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rates/rules/query/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/rates/rules/query +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +code +dir + diff --git a/base/business/general/src/main/java/com/fp/general/rates/rules/query/code/.svn/entries b/base/business/general/src/main/java/com/fp/general/rates/rules/query/code/.svn/entries new file mode 100644 index 0000000..599d779 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rates/rules/query/code/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/rates/rules/query/code +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +RatesDetail.java +file + + + + +2022-07-28T03:40:44.135809Z +603bb7b93b61365d8a775db20ce5d0a8 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1563 + diff --git a/base/business/general/src/main/java/com/fp/general/rates/rules/query/code/.svn/text-base/RatesDetail.java.svn-base b/base/business/general/src/main/java/com/fp/general/rates/rules/query/code/.svn/text-base/RatesDetail.java.svn-base new file mode 100644 index 0000000..4ddc390 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rates/rules/query/code/.svn/text-base/RatesDetail.java.svn-base @@ -0,0 +1,36 @@ +package com.fp.general.rates.rules.query.code; + +import java.util.List; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.product.rate.TgeneBaseRateDetail; +import com.fp.persistence.pgeneral.product.rate.TgeneBaseRateDetailKey; + +public class RatesDetail extends QueryRule { + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + String currencycode = pQueryRequest.get("currencycode").toString(); + String baseratecatalog = pQueryRequest.get("baseratecatalog").toString(); + String baseratecatalogcode = pQueryRequest.get("baseratecatalogcode").toString(); + Integer company = pQueryRequest.getCompany(); + + TgeneAccountingDateBranch d = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch(company, 0); + + List lratedetail = TgeneBaseRateDetail.findVigents(PersistenceHelper.getEntityManager(), currencycode, baseratecatalog, + baseratecatalogcode, d.getWorkingdate()); + + if (lratedetail.isEmpty()) { + lratedetail.add(new TgeneBaseRateDetail(new TgeneBaseRateDetailKey(), null, null, null)); + } + + Response response = pQueryRequest.getResponse(); + response.put("TGENEBASERATEDETAIL", lratedetail); + + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rates/rules/query/code/RatesDetail.java b/base/business/general/src/main/java/com/fp/general/rates/rules/query/code/RatesDetail.java new file mode 100644 index 0000000..4ddc390 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rates/rules/query/code/RatesDetail.java @@ -0,0 +1,36 @@ +package com.fp.general.rates.rules.query.code; + +import java.util.List; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.product.rate.TgeneBaseRateDetail; +import com.fp.persistence.pgeneral.product.rate.TgeneBaseRateDetailKey; + +public class RatesDetail extends QueryRule { + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + String currencycode = pQueryRequest.get("currencycode").toString(); + String baseratecatalog = pQueryRequest.get("baseratecatalog").toString(); + String baseratecatalogcode = pQueryRequest.get("baseratecatalogcode").toString(); + Integer company = pQueryRequest.getCompany(); + + TgeneAccountingDateBranch d = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch(company, 0); + + List lratedetail = TgeneBaseRateDetail.findVigents(PersistenceHelper.getEntityManager(), currencycode, baseratecatalog, + baseratecatalogcode, d.getWorkingdate()); + + if (lratedetail.isEmpty()) { + lratedetail.add(new TgeneBaseRateDetail(new TgeneBaseRateDetailKey(), null, null, null)); + } + + Response response = pQueryRequest.getResponse(); + response.put("TGENEBASERATEDETAIL", lratedetail); + + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/record/.svn/entries b/base/business/general/src/main/java/com/fp/general/record/.svn/entries new file mode 100644 index 0000000..dde1899 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/record/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/record +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ParserRecord.java +file + + + + +2022-07-28T03:40:44.255810Z +e314741ba1ff42613ddda735204f570d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9344 + +FieldData.java +file + + + + +2022-07-28T03:40:44.256810Z +4e763718632486fc6794fcc45761e529 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3106 + +Record.java +file + + + + +2022-07-28T03:40:44.256810Z +a1c0d90304754d6e31ffd6b68ec10465 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1476 + diff --git a/base/business/general/src/main/java/com/fp/general/record/.svn/text-base/FieldData.java.svn-base b/base/business/general/src/main/java/com/fp/general/record/.svn/text-base/FieldData.java.svn-base new file mode 100644 index 0000000..f627640 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/record/.svn/text-base/FieldData.java.svn-base @@ -0,0 +1,137 @@ +package com.fp.general.record; + +import java.lang.reflect.Field; + +/** + * Clase para el manejo de los campos del registro + * @author Jorge Vaca. + * @version 2.1 + */ +public class FieldData { + /* + * Numero de registro del cual se obtiene el valor + */ + private Integer fieldNumber; + /* + * Variable que contiene el valor del campo + */ + private Object value; + /* + * Variable que contiene si el valor del campo es correcto + */ + private boolean valid = true; + /* + * Variable que contiene el mensaje de error + */ + private String errorMessage; + + /** + * Variable que contiene el nombre del atributo de la clase a convertir + */ + private String attribute; + + /** + * Metodo que devuelve el numero de campo del registro + * @return + */ + public Integer getFieldNumber() { + return fieldNumber; + } + + /** + * Metodo que asigna el numero de campo del registro + * @param fieldNumber + */ + public void setFieldNumber(Integer fieldNumber) { + this.fieldNumber = fieldNumber; + } + + /** + * Metodo que indica si el valor del campo es correcto + * @return + */ + public boolean isValid() { + return valid; + } + + /** + * Metodo que asigna si un campo es correcto o no + * @param valid + */ + public void setValid(boolean valid) { + this.valid = valid; + } + + /** + * Metodo que devuelve el valor del campo + * @return + */ + public Object getValue() { + return value; + } + + /** + * Metodo que asigna el valor del campo + * @param value + */ + public void setValue(Object value) { + this.value = value; + } + + /** + * Mensaje de error + * @return + */ + public String getErrorMessage() { + return errorMessage; + } + + /** + * Metodo que asigna el mensaje de error + * @param errorMessage + */ + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + + /** + * Metodo que devuelve el nombre del atributo de la clase que se va a convertir + * @return + */ + public String getAttribute() { + return attribute; + } + + /** + * Metodo que asigna el nombre del atributo de la clase a la cual se va a convertir + * @param attribute + */ + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + +} diff --git a/base/business/general/src/main/java/com/fp/general/record/.svn/text-base/ParserRecord.java.svn-base b/base/business/general/src/main/java/com/fp/general/record/.svn/text-base/ParserRecord.java.svn-base new file mode 100644 index 0000000..0980d13 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/record/.svn/text-base/ParserRecord.java.svn-base @@ -0,0 +1,211 @@ +package com.fp.general.record; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.common.helper.Constant; +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.msg.TgeneMessageStructure; +import com.fp.persistence.pgeneral.msg.TgeneMessageStructureData; +import com.fp.persistence.pgeneral.msg.TgeneMessageStructureHeader; +import com.fp.telered.exception.TeleredException; + +/** + * Clase que se encarga de parsear un registro. + * @author Jorge Vaca. + * @version 2.1 + */ +public class ParserRecord { + + private ParserRecord () {} + + /** + * Metodo que llena los datos del record + * @param inString Cadena de busqueda + * @param structurecode Codigo de estructura del archivo. + * @return Record + * @throws Exception + */ + public static Record read(String inString, TgeneMessageStructure ms,boolean isheader,Integer recordnumber) throws Exception { + Record record = new Record(); + if (isheader) { + readheader(inString, record, ms,recordnumber); + } + readdata(inString, record, ms ,recordnumber); + return record; + } + + /** + * Metodo que completa un Record, con la definicion de TACHSTRUCTURE, considera tipos de registro 6 y 7. + * @param inString Datos en formato nacha. + * @param record Registro a completar data. + * @param ms Definicion de tipo de estructura. + * @throws Exception + */ + private static void readheader(String inString, Record record, TgeneMessageStructure ms,Integer recordnumber) throws Exception { + Map map = new HashMap(); + //Crea un bean persistente en la base. + record.setHibernateBean(ms.getHeaderclass()); + //Obtiene la estructura de campos para el tipo de ach. + List ldata = getTgeneMessageStructureHeader(ms.getPk()); + for (TgeneMessageStructureHeader obj : ldata) { + FieldData field = new FieldData(); + Integer fieldnumber = obj.getPk().getCode(); + field.setAttribute(obj.getAttribute()); + field.setFieldNumber(fieldnumber); + Object valueAux = null; + try { + valueAux = getValue(inString, obj,obj.getAttribute(),recordnumber); + } catch (Exception ex) { + APPLogger.getLogger().error(ex.getLocalizedMessage()); + field.setErrorMessage(ex.getMessage()); + field.setValid(false); + } + if (Constant.ifYes(obj.getRequired()) && valueAux == null ) { + field.setValid(false); + } + field.setValue(valueAux); + map.put(fieldnumber, field); + } + record.setFieldMap(map); + } + + /** + * Metodo que arma los datos de la tabla TACHFILESSTRUCTURE, considera tipos de registo 1,5,8,9 + * @param inString Datos en formato nacha. + * @param record Record a completar datos. + * @param ms Definicion de tipo de estructura. + * @throws Exception + */ + private static void readdata(String inString, Record record,TgeneMessageStructure ms,Integer recordnumber) throws Exception { + Map map = new HashMap(); + //Crea un bean persistente en la base. + record.setHibernateBean(ms.getDetailclass()); + List ldata = getTgeneMessageStructureData(ms.getPk()); + for (TgeneMessageStructureData obj : ldata) { + FieldData field = new FieldData(); + Integer fieldnumber = obj.getPk().getCode(); + field.setAttribute(obj.getAttribute()); + field.setFieldNumber(fieldnumber); + Object valueAux = null; + if(obj.getAttribute().compareTo("cardacctnbr") ==0){ + valueAux = null; + } + try { + valueAux = getValue(inString,obj,obj.getAttribute(),recordnumber); + } catch (TeleredException ex) { + throw ex; + }catch (Exception ex) { + field.setErrorMessage(ex.getMessage()); + field.setValid(false); + } + field.setValue(valueAux); + if (Constant.ifYes(obj.getRequired()) && valueAux == null ) { + field.setValid(false); + } + map.put(fieldnumber, field); + if(Constant.ifYes(obj.getRequired()) && valueAux == null){ + throw new TeleredException("GENE-0031", "VALOR REQUERIDO PARA EL CAMPO: {0} NUMERO DE REGISTRO: {1}", + obj.getAttribute(),recordnumber + 1); + } + } + record.setFieldMap(map); + } + + /** + * Entrega el valor de un campo dada la estructura de un tipo de registro definida en TgeneMessageStructureHeader. + * @param inString Datos un registro.. + * @param structure Datos de definicion de estructura de un campo. + * @return Object + * @throws Exception + */ + private static Object getValue(String inString,TgeneMessageStructureHeader structure,String atributo,Integer numeroregistro) throws Exception { + return getValue(inString, + structure.getInitposition(), structure.getEndposition(), + structure.getDecimalnumber(), structure.getDatatype(),atributo,numeroregistro); + } + + /** + * Entrega el valor de un campo dada la estructura de un tipo de registro definida en TgeneMessageStructureData. + * @param inString Datos un registro.. + * @param fileStructure Datos de definicion de estructura de un campo. + * @return Object + * @throws Exception + */ + private static Object getValue(String inString,TgeneMessageStructureData structure,String atributo,Integer numeroregistro) throws Exception { + return getValue(inString, + structure.getInitposition(), structure.getEndposition(), + structure.getDecimalnumber(), structure.getDatatype(),atributo,numeroregistro); + } + + /** + * Metodo que devuelve el valor del campo de un regsitro + * @param inString Cadena donde se va a buscar el campo + * @param initPosition Posicion inicial del campo + * @param endPosition Posicion final del campo + * @param decimalnumber Numero de decimales + * @param datatype Tipo de dato del campo + * @param formatdate Formato para fecha + * @param formattime Formato para tiempo + * @return Object + * @throws Exception + */ + private static Object getValue(String inString, int initPosition, + int endPosition, Integer decimalnumber, String datatype,String atributo,Integer numeroregistro) + throws Exception { + String value = inString.substring(--initPosition, endPosition); + if (value.compareTo("") == 0 || value == null) { + //la validacion del campo requerido se realiza en la parte que llama al metodo que obtiene el valor. + return null; + } + Object auxValue = value; + try { + if (datatype.toUpperCase().compareTo("STRING") == 0) { + auxValue = value; + } else if (datatype.toUpperCase().compareTo("INTEGER") == 0) { + value = value.trim(); + if (decimalnumber != null && decimalnumber > 0) { + String number = value.substring(0, value.length() - decimalnumber) + + "." + + value.substring(value.length() - decimalnumber, value.length()); + auxValue = new BigDecimal(number); + } else { + auxValue = Integer.valueOf(value); + } + }else if(datatype.toUpperCase().compareTo("LONG") == 0){ + auxValue = Long.valueOf(value.trim()); + }else if(datatype.toUpperCase().compareTo("BIGDECIMAL") == 0){ + auxValue = new BigDecimal(value.trim()); + } + } catch (NumberFormatException ex) { + throw new TeleredException("GENE-0032", "TIPO DE DATO: {0} PARA EL CAMPO: {1} NO SE PUEDE TRANSFORMAR VALOR: {2} REGISTRO {3}", + datatype,atributo,value,numeroregistro + 1); + } + return auxValue; + } + + + + /** + * Enterga una lista de definicion de campos de cabecera de un archivo. + * @param pStructureCode Codigo de estructura. + * @return List + * @throws Exception + */ + private static List getTgeneMessageStructureHeader(String pStructureCode) throws Exception { + return TgeneMessageStructureHeader.find(PersistenceHelper.getEntityManager(), pStructureCode); + } + + /** + * Enterga una lista de definicion de campos de datos de un archivo. + * @param pStructureCode Codigo de estructura. + * @return List + * @throws Exception + */ + private static List getTgeneMessageStructureData(String pStructureCode) throws Exception { + return TgeneMessageStructureData.find(PersistenceHelper.getEntityManager(), pStructureCode); + } +} diff --git a/base/business/general/src/main/java/com/fp/general/record/.svn/text-base/Record.java.svn-base b/base/business/general/src/main/java/com/fp/general/record/.svn/text-base/Record.java.svn-base new file mode 100644 index 0000000..38cabee --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/record/.svn/text-base/Record.java.svn-base @@ -0,0 +1,62 @@ +package com.fp.general.record; + +import java.util.Map; + +import com.fp.dto.hb.HibernateBean; + +/** + * Clase que representa un registro de 94 bytes en formato nacha + * @author Jorge Vaca. + * @version 2.1 + */ +public class Record { + + /* + * Variable que contiene el valor de los campos del registro + */ + private Map fieldMap; + /** + * Variable que contiene el nombre de la clase + */ + private HibernateBean hibernateBean; + + + /** + * Metodo que devuelve los campos del registro + * @return + */ + public Map getFieldMap() { + return fieldMap; + } + + /** + * Metodo que asigna los campos del registro + * @param fieldMap + */ + public void setFieldMap(Map fieldMap) { + this.fieldMap = fieldMap; + } + + /** + * Metodo que devuelve la clase que se utilizara para el mapeo de datos + * @return + */ + public HibernateBean getHibernateBean() { + return hibernateBean; + } + + /** + * Metodo que asigna la clase para el mapeo de datos + * @param className + */ + public void setHibernateBean(String pBeanname) throws Exception{ + if(pBeanname == null){ + return; + } + HibernateBean bean = (HibernateBean)Class.forName(pBeanname).newInstance(); + HibernateBean bean1 = (HibernateBean)bean.createInstance(); + hibernateBean = bean1; + } + + +} diff --git a/base/business/general/src/main/java/com/fp/general/record/FieldData.java b/base/business/general/src/main/java/com/fp/general/record/FieldData.java new file mode 100644 index 0000000..f627640 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/record/FieldData.java @@ -0,0 +1,137 @@ +package com.fp.general.record; + +import java.lang.reflect.Field; + +/** + * Clase para el manejo de los campos del registro + * @author Jorge Vaca. + * @version 2.1 + */ +public class FieldData { + /* + * Numero de registro del cual se obtiene el valor + */ + private Integer fieldNumber; + /* + * Variable que contiene el valor del campo + */ + private Object value; + /* + * Variable que contiene si el valor del campo es correcto + */ + private boolean valid = true; + /* + * Variable que contiene el mensaje de error + */ + private String errorMessage; + + /** + * Variable que contiene el nombre del atributo de la clase a convertir + */ + private String attribute; + + /** + * Metodo que devuelve el numero de campo del registro + * @return + */ + public Integer getFieldNumber() { + return fieldNumber; + } + + /** + * Metodo que asigna el numero de campo del registro + * @param fieldNumber + */ + public void setFieldNumber(Integer fieldNumber) { + this.fieldNumber = fieldNumber; + } + + /** + * Metodo que indica si el valor del campo es correcto + * @return + */ + public boolean isValid() { + return valid; + } + + /** + * Metodo que asigna si un campo es correcto o no + * @param valid + */ + public void setValid(boolean valid) { + this.valid = valid; + } + + /** + * Metodo que devuelve el valor del campo + * @return + */ + public Object getValue() { + return value; + } + + /** + * Metodo que asigna el valor del campo + * @param value + */ + public void setValue(Object value) { + this.value = value; + } + + /** + * Mensaje de error + * @return + */ + public String getErrorMessage() { + return errorMessage; + } + + /** + * Metodo que asigna el mensaje de error + * @param errorMessage + */ + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + + /** + * Metodo que devuelve el nombre del atributo de la clase que se va a convertir + * @return + */ + public String getAttribute() { + return attribute; + } + + /** + * Metodo que asigna el nombre del atributo de la clase a la cual se va a convertir + * @param attribute + */ + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + +} diff --git a/base/business/general/src/main/java/com/fp/general/record/ParserRecord.java b/base/business/general/src/main/java/com/fp/general/record/ParserRecord.java new file mode 100644 index 0000000..0980d13 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/record/ParserRecord.java @@ -0,0 +1,211 @@ +package com.fp.general.record; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.common.helper.Constant; +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.msg.TgeneMessageStructure; +import com.fp.persistence.pgeneral.msg.TgeneMessageStructureData; +import com.fp.persistence.pgeneral.msg.TgeneMessageStructureHeader; +import com.fp.telered.exception.TeleredException; + +/** + * Clase que se encarga de parsear un registro. + * @author Jorge Vaca. + * @version 2.1 + */ +public class ParserRecord { + + private ParserRecord () {} + + /** + * Metodo que llena los datos del record + * @param inString Cadena de busqueda + * @param structurecode Codigo de estructura del archivo. + * @return Record + * @throws Exception + */ + public static Record read(String inString, TgeneMessageStructure ms,boolean isheader,Integer recordnumber) throws Exception { + Record record = new Record(); + if (isheader) { + readheader(inString, record, ms,recordnumber); + } + readdata(inString, record, ms ,recordnumber); + return record; + } + + /** + * Metodo que completa un Record, con la definicion de TACHSTRUCTURE, considera tipos de registro 6 y 7. + * @param inString Datos en formato nacha. + * @param record Registro a completar data. + * @param ms Definicion de tipo de estructura. + * @throws Exception + */ + private static void readheader(String inString, Record record, TgeneMessageStructure ms,Integer recordnumber) throws Exception { + Map map = new HashMap(); + //Crea un bean persistente en la base. + record.setHibernateBean(ms.getHeaderclass()); + //Obtiene la estructura de campos para el tipo de ach. + List ldata = getTgeneMessageStructureHeader(ms.getPk()); + for (TgeneMessageStructureHeader obj : ldata) { + FieldData field = new FieldData(); + Integer fieldnumber = obj.getPk().getCode(); + field.setAttribute(obj.getAttribute()); + field.setFieldNumber(fieldnumber); + Object valueAux = null; + try { + valueAux = getValue(inString, obj,obj.getAttribute(),recordnumber); + } catch (Exception ex) { + APPLogger.getLogger().error(ex.getLocalizedMessage()); + field.setErrorMessage(ex.getMessage()); + field.setValid(false); + } + if (Constant.ifYes(obj.getRequired()) && valueAux == null ) { + field.setValid(false); + } + field.setValue(valueAux); + map.put(fieldnumber, field); + } + record.setFieldMap(map); + } + + /** + * Metodo que arma los datos de la tabla TACHFILESSTRUCTURE, considera tipos de registo 1,5,8,9 + * @param inString Datos en formato nacha. + * @param record Record a completar datos. + * @param ms Definicion de tipo de estructura. + * @throws Exception + */ + private static void readdata(String inString, Record record,TgeneMessageStructure ms,Integer recordnumber) throws Exception { + Map map = new HashMap(); + //Crea un bean persistente en la base. + record.setHibernateBean(ms.getDetailclass()); + List ldata = getTgeneMessageStructureData(ms.getPk()); + for (TgeneMessageStructureData obj : ldata) { + FieldData field = new FieldData(); + Integer fieldnumber = obj.getPk().getCode(); + field.setAttribute(obj.getAttribute()); + field.setFieldNumber(fieldnumber); + Object valueAux = null; + if(obj.getAttribute().compareTo("cardacctnbr") ==0){ + valueAux = null; + } + try { + valueAux = getValue(inString,obj,obj.getAttribute(),recordnumber); + } catch (TeleredException ex) { + throw ex; + }catch (Exception ex) { + field.setErrorMessage(ex.getMessage()); + field.setValid(false); + } + field.setValue(valueAux); + if (Constant.ifYes(obj.getRequired()) && valueAux == null ) { + field.setValid(false); + } + map.put(fieldnumber, field); + if(Constant.ifYes(obj.getRequired()) && valueAux == null){ + throw new TeleredException("GENE-0031", "VALOR REQUERIDO PARA EL CAMPO: {0} NUMERO DE REGISTRO: {1}", + obj.getAttribute(),recordnumber + 1); + } + } + record.setFieldMap(map); + } + + /** + * Entrega el valor de un campo dada la estructura de un tipo de registro definida en TgeneMessageStructureHeader. + * @param inString Datos un registro.. + * @param structure Datos de definicion de estructura de un campo. + * @return Object + * @throws Exception + */ + private static Object getValue(String inString,TgeneMessageStructureHeader structure,String atributo,Integer numeroregistro) throws Exception { + return getValue(inString, + structure.getInitposition(), structure.getEndposition(), + structure.getDecimalnumber(), structure.getDatatype(),atributo,numeroregistro); + } + + /** + * Entrega el valor de un campo dada la estructura de un tipo de registro definida en TgeneMessageStructureData. + * @param inString Datos un registro.. + * @param fileStructure Datos de definicion de estructura de un campo. + * @return Object + * @throws Exception + */ + private static Object getValue(String inString,TgeneMessageStructureData structure,String atributo,Integer numeroregistro) throws Exception { + return getValue(inString, + structure.getInitposition(), structure.getEndposition(), + structure.getDecimalnumber(), structure.getDatatype(),atributo,numeroregistro); + } + + /** + * Metodo que devuelve el valor del campo de un regsitro + * @param inString Cadena donde se va a buscar el campo + * @param initPosition Posicion inicial del campo + * @param endPosition Posicion final del campo + * @param decimalnumber Numero de decimales + * @param datatype Tipo de dato del campo + * @param formatdate Formato para fecha + * @param formattime Formato para tiempo + * @return Object + * @throws Exception + */ + private static Object getValue(String inString, int initPosition, + int endPosition, Integer decimalnumber, String datatype,String atributo,Integer numeroregistro) + throws Exception { + String value = inString.substring(--initPosition, endPosition); + if (value.compareTo("") == 0 || value == null) { + //la validacion del campo requerido se realiza en la parte que llama al metodo que obtiene el valor. + return null; + } + Object auxValue = value; + try { + if (datatype.toUpperCase().compareTo("STRING") == 0) { + auxValue = value; + } else if (datatype.toUpperCase().compareTo("INTEGER") == 0) { + value = value.trim(); + if (decimalnumber != null && decimalnumber > 0) { + String number = value.substring(0, value.length() - decimalnumber) + + "." + + value.substring(value.length() - decimalnumber, value.length()); + auxValue = new BigDecimal(number); + } else { + auxValue = Integer.valueOf(value); + } + }else if(datatype.toUpperCase().compareTo("LONG") == 0){ + auxValue = Long.valueOf(value.trim()); + }else if(datatype.toUpperCase().compareTo("BIGDECIMAL") == 0){ + auxValue = new BigDecimal(value.trim()); + } + } catch (NumberFormatException ex) { + throw new TeleredException("GENE-0032", "TIPO DE DATO: {0} PARA EL CAMPO: {1} NO SE PUEDE TRANSFORMAR VALOR: {2} REGISTRO {3}", + datatype,atributo,value,numeroregistro + 1); + } + return auxValue; + } + + + + /** + * Enterga una lista de definicion de campos de cabecera de un archivo. + * @param pStructureCode Codigo de estructura. + * @return List + * @throws Exception + */ + private static List getTgeneMessageStructureHeader(String pStructureCode) throws Exception { + return TgeneMessageStructureHeader.find(PersistenceHelper.getEntityManager(), pStructureCode); + } + + /** + * Enterga una lista de definicion de campos de datos de un archivo. + * @param pStructureCode Codigo de estructura. + * @return List + * @throws Exception + */ + private static List getTgeneMessageStructureData(String pStructureCode) throws Exception { + return TgeneMessageStructureData.find(PersistenceHelper.getEntityManager(), pStructureCode); + } +} diff --git a/base/business/general/src/main/java/com/fp/general/record/Record.java b/base/business/general/src/main/java/com/fp/general/record/Record.java new file mode 100644 index 0000000..38cabee --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/record/Record.java @@ -0,0 +1,62 @@ +package com.fp.general.record; + +import java.util.Map; + +import com.fp.dto.hb.HibernateBean; + +/** + * Clase que representa un registro de 94 bytes en formato nacha + * @author Jorge Vaca. + * @version 2.1 + */ +public class Record { + + /* + * Variable que contiene el valor de los campos del registro + */ + private Map fieldMap; + /** + * Variable que contiene el nombre de la clase + */ + private HibernateBean hibernateBean; + + + /** + * Metodo que devuelve los campos del registro + * @return + */ + public Map getFieldMap() { + return fieldMap; + } + + /** + * Metodo que asigna los campos del registro + * @param fieldMap + */ + public void setFieldMap(Map fieldMap) { + this.fieldMap = fieldMap; + } + + /** + * Metodo que devuelve la clase que se utilizara para el mapeo de datos + * @return + */ + public HibernateBean getHibernateBean() { + return hibernateBean; + } + + /** + * Metodo que asigna la clase para el mapeo de datos + * @param className + */ + public void setHibernateBean(String pBeanname) throws Exception{ + if(pBeanname == null){ + return; + } + HibernateBean bean = (HibernateBean)Class.forName(pBeanname).newInstance(); + HibernateBean bean1 = (HibernateBean)bean.createInstance(); + hibernateBean = bean1; + } + + +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/.svn/entries b/base/business/general/src/main/java/com/fp/general/rules/.svn/entries new file mode 100644 index 0000000..7cfaf3f --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/.svn/entries @@ -0,0 +1,71 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/rules +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +SubProductcurrencyDesc.java +file + + + + +2022-07-28T03:40:43.947808Z +2b5e3929da963278ff4df8649dd2c719 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2154 + +query +dir + +save +dir + +scheduler +dir + diff --git a/base/business/general/src/main/java/com/fp/general/rules/.svn/text-base/SubProductcurrencyDesc.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/.svn/text-base/SubProductcurrencyDesc.java.svn-base new file mode 100644 index 0000000..104e1fb --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/.svn/text-base/SubProductcurrencyDesc.java.svn-base @@ -0,0 +1,52 @@ +package com.fp.general.rules; + +import java.util.List; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.product.TgeneSubProductCurrency; + +/** + * Clase que se encarga de completar descripcion del modulo, producto, y subproducto, dado un codigo de query alias. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class SubProductcurrencyDesc extends QueryRule { + + /** + * Metodo que completa descripciones de modulo, producto y sub producto. + */ + @Override + @SuppressWarnings("unchecked") + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List lobjects = (List) response.get("TGENESUBPRODUCTCURRENCY"); + if (lobjects == null) { + return pQueryRequest; + } + for (Object obj : lobjects) { + TgeneSubProductCurrency subprod = (TgeneSubProductCurrency) obj; + if (subprod.getPk().getModulecode() == null) { + continue; + } + // module descripion + subprod.addAddtionalInfo("moduledesc", GeneralDescriptions.getModuledesc(subprod.getPk().getModulecode())); + // product description + subprod.addAddtionalInfo("productdesc", + GeneralDescriptions.getProductdesc(subprod.getPk().getModulecode(), subprod.getPk().getProductcode())); + // subproduct description + subprod.addAddtionalInfo("subproductdesc", GeneralDescriptions.getSubProductdesc(subprod.getPk().getModulecode(), subprod.getPk() + .getProductcode(), subprod.getPk().getSubproductcode())); + // currency description + subprod.addAddtionalInfo("currencydesc", GeneralDescriptions.getCurrencydesc(subprod.getPk().getCurrencycode())); + } + return pQueryRequest; + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/SubProductcurrencyDesc.java b/base/business/general/src/main/java/com/fp/general/rules/SubProductcurrencyDesc.java new file mode 100644 index 0000000..104e1fb --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/SubProductcurrencyDesc.java @@ -0,0 +1,52 @@ +package com.fp.general.rules; + +import java.util.List; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.product.TgeneSubProductCurrency; + +/** + * Clase que se encarga de completar descripcion del modulo, producto, y subproducto, dado un codigo de query alias. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class SubProductcurrencyDesc extends QueryRule { + + /** + * Metodo que completa descripciones de modulo, producto y sub producto. + */ + @Override + @SuppressWarnings("unchecked") + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List lobjects = (List) response.get("TGENESUBPRODUCTCURRENCY"); + if (lobjects == null) { + return pQueryRequest; + } + for (Object obj : lobjects) { + TgeneSubProductCurrency subprod = (TgeneSubProductCurrency) obj; + if (subprod.getPk().getModulecode() == null) { + continue; + } + // module descripion + subprod.addAddtionalInfo("moduledesc", GeneralDescriptions.getModuledesc(subprod.getPk().getModulecode())); + // product description + subprod.addAddtionalInfo("productdesc", + GeneralDescriptions.getProductdesc(subprod.getPk().getModulecode(), subprod.getPk().getProductcode())); + // subproduct description + subprod.addAddtionalInfo("subproductdesc", GeneralDescriptions.getSubProductdesc(subprod.getPk().getModulecode(), subprod.getPk() + .getProductcode(), subprod.getPk().getSubproductcode())); + // currency description + subprod.addAddtionalInfo("currencydesc", GeneralDescriptions.getCurrencydesc(subprod.getPk().getCurrencycode())); + } + return pQueryRequest; + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/.svn/entries b/base/business/general/src/main/java/com/fp/general/rules/query/.svn/entries new file mode 100644 index 0000000..3539249 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/.svn/entries @@ -0,0 +1,340 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/rules/query +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +BalanceTypeProvision.java +file + + + + +2022-07-28T03:40:43.770807Z +7f120590969c7b7619a3337e188ca633 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4155 + +CompleteTransactionSubLevel.java +file + + + + +2022-07-28T03:40:43.770807Z +f789f0f46e8b80cb516ae83a110cc0d7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1758 + +ExecuteSQL.java +file + + + + +2022-07-28T03:40:43.771807Z +ca5d642e5497a34d49852ee2b7425731 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1381 + +CompleteTransactionLevel.java +file + + + + +2022-07-28T03:40:43.771807Z +910853fbeaa0a635ba19b824b86476ef +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1687 + +trans +dir + +PrincipalInstallRates.java +file + + + + +2022-07-28T03:40:43.771807Z +966ca874e623680d5aefc23b211017a4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2567 + +LovTransactionEvent.java +file + + + + +2022-07-28T03:40:43.771807Z +9c0c63ccbc00b38884ded3553958edeb +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1840 + +code +dir + +CompleteMaturation.java +file + + + + +2022-07-28T03:40:43.772807Z +31de769950d5ad26e74e66f222070931 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2594 + +CompleteTransactionMixPages.java +file + + + + +2022-07-28T03:40:43.772807Z +4ce07d837ab4c43858e1c3a4a708553b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1848 + +LovOfficer.java +file + + + + +2022-07-28T03:40:43.772807Z +beae8cd84978b98e4ff8bea9f9283f7f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1640 + diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/BalanceTypeProvision.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/BalanceTypeProvision.java.svn-base new file mode 100644 index 0000000..6dcb153 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/BalanceTypeProvision.java.svn-base @@ -0,0 +1,103 @@ +package com.fp.general.rules.query; + +import com.fp.common.helper.BeanManager; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.dto.Response; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.hibernate.SQLQuery; +import org.hibernate.ScrollableResults; + +/** + * Clase que se encarga de armar los tipos de balance por modulo y provicion + * @author scastillo + */ +public class BalanceTypeProvision extends QueryRule { + + /** + * Proceso que devuevelve los tipos de balance en el response + * @param pQueryRequest + * @return + * @throws Exception + */ + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + QueryBean queryBeanDebit = (QueryBean) pQueryRequest.get("BALANCETYPEPROVITION"); + String modulecode = (String) BeanManager.convertObject(queryBeanDebit.getCriteriaValue("modulecode"), String.class); + String isprovision = (String) BeanManager.convertObject(queryBeanDebit.getCriteriaValue("isprovision"), String.class); + List> data = getBalanceType(modulecode, isprovision); + response.put("BALANCETYPEPROVITION", data); + return pQueryRequest; + } + + /** + * Mtodo que ejecuta el query y los asigna en un map a todo los tipos de saldo + * @param module + * @param isprovision + * @return + * @throws Exception + */ + private List> getBalanceType(String module, String isprovision) throws Exception { + ScrollableResults scrollableResults = null; + SQLQuery qry = PersistenceHelper.getSession().createSQLQuery(obtainSelect(module, isprovision)); + scrollableResults = qry.scroll(); + List> balancetype = new ArrayList>(); + try { + while (scrollableResults.next()) { + Object[] object = scrollableResults.get(); + Map map = new HashMap(); + String pk_balancetype = (String) object[0]; + String pk_balancegroup = (String) object[1]; + String description = (String) object[2]; + String balancecategory = (String) object[3]; + String modulecode = (String) object[4]; + map.put("pk_balancetype", pk_balancetype); + map.put("pk_balancegroup", pk_balancegroup); + map.put("description", description); + map.put("balancecategory", balancecategory); + map.put("modulecode", modulecode); + balancetype.add(map); + } + } finally { + scrollableResults.close(); + } + return balancetype; + } + + /** + * Metodo que arma el select a ejecutar para obtener los tipos de balance + * @param module + * @param isprovision + * @return + */ + private String obtainSelect(String module, String isprovision) { + String filtermodule = ""; + if (module != null) { + filtermodule = " where tgbt.MODULECODE = '" + module + "' and"; + } + String filterprovision = ")"; + if (isprovision != null) { + filterprovision = " and tgbtd.ISPROVISON = '" + isprovision + "')"; + } + String sentencia = + "select tgbt.BALANCETYPE," + + " tgbt.BALANCEGROUP," + + " tgbt.DESCRIPTION," + + " tgbt.BALANCECATEGORY," + + " tgbt.MODULECODE" + + " from TGENEBALANCETYPE tgbt" + + filtermodule + + " exists (select 1" + + " from TGENEBALANCETYPEDETAIL tgbtd" + + " where tgbt.BALANCETYPE = tgbtd.BALANCETYPE" + + " and tgbt.BALANCEGROUP = tgbtd.BALANCEGROUP" + + filterprovision + + " order by tgbt.BALANCETYPE"; + return sentencia; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/CompleteMaturation.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/CompleteMaturation.java.svn-base new file mode 100644 index 0000000..be26308 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/CompleteMaturation.java.svn-base @@ -0,0 +1,61 @@ +package com.fp.general.rules.query; + +import java.util.List; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.transf.TgeneMaturation; + +/** + * Clase que se encarga de completar la descripcion de los items de la tabla TgeneMaturation + * + * @author scastillo + * @version 2.1 + */ +public class CompleteMaturation extends QueryRule { + + /** + * Mtodo que completa las descripciones de la tabla TgeneMaturation + * + * @param pQueryRequest + * @return + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List lobjects = (List) response.get("TGENEMATURATION"); + if (lobjects == null) { + return pQueryRequest; + } + for (Object obj : lobjects) { + TgeneMaturation tgeneMaturation = (TgeneMaturation) obj; + if ((tgeneMaturation.getTransactionmodule() != null) && (tgeneMaturation.getTransactioncode() != null) + && (tgeneMaturation.getTransactionversion() != null)) { + if (tgeneMaturation.getDebititem() != null) { + tgeneMaturation.addAddtionalInfo("debititemdesc", GeneralDescriptions.getTransactionItemdesc( + tgeneMaturation.getTransactionmodule(), tgeneMaturation.getTransactioncode(), tgeneMaturation.getTransactionversion(), + tgeneMaturation.getDebititem())); + } else { + tgeneMaturation.addAddtionalInfo("debititemdesc", null); + } + if (tgeneMaturation.getCredititem() != null) { + tgeneMaturation.addAddtionalInfo("credititemdesc", GeneralDescriptions.getTransactionItemdesc( + tgeneMaturation.getTransactionmodule(), tgeneMaturation.getTransactioncode(), tgeneMaturation.getTransactionversion(), + tgeneMaturation.getCredititem())); + } else { + tgeneMaturation.addAddtionalInfo("credititemdesc", null); + } + } else { + tgeneMaturation.addAddtionalInfo("debititemdesc", null); + tgeneMaturation.addAddtionalInfo("credititemdesc", null); + } + } + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/CompleteTransactionLevel.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/CompleteTransactionLevel.java.svn-base new file mode 100644 index 0000000..33c9bea --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/CompleteTransactionLevel.java.svn-base @@ -0,0 +1,44 @@ +package com.fp.general.rules.query; + +import java.util.List; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelTran; + +/** + * Clase que completa el nombre de la transaccion en niveles + * + * @author scastillo + */ +public class CompleteTransactionLevel extends QueryRule { + + /** + * Metodo que completa el nombre de la transaccion + * + * @param pQueryRequest + * @return + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List lobjects = (List) response.get("TGENEMENULEVELTRAN"); + for (Object obj : lobjects) { + TgeneMenuLevelTran tgeneMenuLevelTran = (TgeneMenuLevelTran) obj; + if ((tgeneMenuLevelTran.getPk().getTransactionmodule() != null) && (tgeneMenuLevelTran.getPk().getTransactioncode() != null) + && (tgeneMenuLevelTran.getPk().getTransactionversion() != null)) { + tgeneMenuLevelTran.addAddtionalInfo("name", GeneralDescriptions.getTransactiondesc(tgeneMenuLevelTran.getPk().getTransactionmodule(), + tgeneMenuLevelTran.getPk().getTransactioncode(), tgeneMenuLevelTran.getPk().getTransactionversion())); + } else { + tgeneMenuLevelTran.addAddtionalInfo("name", null); + } + } + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/CompleteTransactionMixPages.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/CompleteTransactionMixPages.java.svn-base new file mode 100644 index 0000000..003077c --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/CompleteTransactionMixPages.java.svn-base @@ -0,0 +1,45 @@ +package com.fp.general.rules.query; + +import java.util.List; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.gene.TgeneTransactionMixPages; + +/** + * Clase que se encarga de completar el nombre de la transaccion par la definicion de las paginas en caja multiple + * + * @author scastillo + */ +public class CompleteTransactionMixPages extends QueryRule { + + /** + * Metodo que completa el nombre de la transaccion + * + * @param pQueryRequest + * @return + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List lobjects = (List) response.get("TGENETRANSACTIONMIXPAGES"); + for (Object obj : lobjects) { + TgeneTransactionMixPages tgeneTransactionMixPages = (TgeneTransactionMixPages) obj; + if ((tgeneTransactionMixPages.getPk().getTransactionmodule() != null) && (tgeneTransactionMixPages.getPk().getTransactioncode() != null) + && (tgeneTransactionMixPages.getPk().getTransactionversion() != null)) { + tgeneTransactionMixPages.addAddtionalInfo("name", GeneralDescriptions.getTransactiondesc(tgeneTransactionMixPages.getPk() + .getTransactionmodule(), tgeneTransactionMixPages.getPk().getTransactioncode(), tgeneTransactionMixPages.getPk() + .getTransactionversion())); + } else { + tgeneTransactionMixPages.addAddtionalInfo("name", null); + } + } + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/CompleteTransactionSubLevel.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/CompleteTransactionSubLevel.java.svn-base new file mode 100644 index 0000000..3babf98 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/CompleteTransactionSubLevel.java.svn-base @@ -0,0 +1,45 @@ +package com.fp.general.rules.query; + +import java.util.List; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelTran; + +/** + * Clase que completa el nombre de la transaccion en subniveles + * + * @author scastillo + */ +public class CompleteTransactionSubLevel extends QueryRule { + + /** + * Metodo que completa el nombre de la transaccion + * + * @param pQueryRequest + * @return + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List lobjects = (List) response.get("TGENEMENUSUBLEVELTRAN"); + for (Object obj : lobjects) { + TgeneMenuSubLevelTran tgeneMenuSubLevelTran = (TgeneMenuSubLevelTran) obj; + if ((tgeneMenuSubLevelTran.getPk().getTransactionmodule() != null) && (tgeneMenuSubLevelTran.getPk().getTransactioncode() != null) + && (tgeneMenuSubLevelTran.getPk().getTransactionversion() != null)) { + tgeneMenuSubLevelTran.addAddtionalInfo("name", GeneralDescriptions.getTransactiondesc(tgeneMenuSubLevelTran.getPk() + .getTransactionmodule(), tgeneMenuSubLevelTran.getPk().getTransactioncode(), tgeneMenuSubLevelTran.getPk() + .getTransactionversion())); + } else { + tgeneMenuSubLevelTran.addAddtionalInfo("name", null); + } + } + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/ExecuteSQL.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/ExecuteSQL.java.svn-base new file mode 100644 index 0000000..8264fb2 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/ExecuteSQL.java.svn-base @@ -0,0 +1,42 @@ +package com.fp.general.rules.query; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import org.hibernate.SQLQuery; +import org.hibernate.ScrollableResults; +import java.util.ArrayList; +import java.util.List; + +/** + * Clase que se encarga de ejecutar un query que se enva desde la parte web + * @author scastillo + */ +public class ExecuteSQL extends QueryRule { + + /** + * + * @param pQueryRequest + * @return + * @throws Exception + */ + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + String sql = (String) pQueryRequest.get("sql"); + String isUniqueResult = (String) pQueryRequest.get("isUniqueResult"); + SQLQuery qry = PersistenceHelper.getSession().createSQLQuery(sql); + if (isUniqueResult.equals("Y")) { + Object data = qry.uniqueResult(); + response.put("result", data); + } else { + ScrollableResults scrollableResults = qry.scroll(); + List lObject = new ArrayList(); + while (scrollableResults.next()) { + lObject.add(scrollableResults.get()); + } + response.put("result", lObject); + } + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/LovOfficer.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/LovOfficer.java.svn-base new file mode 100644 index 0000000..a60cd7f --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/LovOfficer.java.svn-base @@ -0,0 +1,44 @@ +package com.fp.general.rules.query; + +import java.util.List; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.pgeneral.gene.TgeneOfficer; +import com.fp.persistence.pgeneral.safe.TsafeUser; + +/** + * Metodo que completa el nombre del usuario oficial de cuenta. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class LovOfficer extends QueryRule { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.QueryRule#process(com.fp.dto.query.QueryRequest) + */ + @Override + @SuppressWarnings("unchecked") + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List lobjects = (List) response.get("TGENEOFFICER"); + for (Object obj : lobjects) { + TgeneOfficer officer = (TgeneOfficer) obj; + if (officer.getPk().getModulecode() == null) { + throw new GeneralException("GENE-0033", "OFICIAL DE CUENTA NO DEFINIDO PARA EL PRODUCTO EN TGENEOFFICER"); + } + TsafeUser user = com.fp.base.persistence.util.db.DataHelper.getInstance().getTsafeUser(officer.getPk().getUsercode()); + officer.addAddtionalInfo("name", GeneralDescriptions.getPersonname(user.getPersoncode())); + } + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/LovTransactionEvent.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/LovTransactionEvent.java.svn-base new file mode 100644 index 0000000..b48e1b3 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/LovTransactionEvent.java.svn-base @@ -0,0 +1,47 @@ +package com.fp.general.rules.query; + +import java.util.List; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.trans.TgeneTransactionEvent; + +/** + * Clase para completar el nombre de la transaccion por eventos + * + * @author scastillo + */ +public class LovTransactionEvent extends QueryRule { + + /** + * Proceso que se encarga de completar el nombre de la transaccion + * + * @param pQueryRequest + * @return + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List lobjects = (List) response.get("TGENETRANSACTIONEVENT"); + for (Object obj : lobjects) { + TgeneTransactionEvent tgeneTransactionEvent = (TgeneTransactionEvent) obj; + if (tgeneTransactionEvent.getTransactionmodule() != null) { + tgeneTransactionEvent.addAddtionalInfo( + "name", + GeneralDescriptions.getTransactiondesc(tgeneTransactionEvent.getTransactionmodule(), + tgeneTransactionEvent.getTransactioncode(), tgeneTransactionEvent.getTransactionversion())); + tgeneTransactionEvent.addAddtionalInfo("moduledesc", GeneralDescriptions.getModuledesc(tgeneTransactionEvent.getTransactionmodule())); + } else { + tgeneTransactionEvent.addAddtionalInfo("name", null); + tgeneTransactionEvent.addAddtionalInfo("moduledesc", null); + } + } + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/PrincipalInstallRates.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/PrincipalInstallRates.java.svn-base new file mode 100644 index 0000000..65976b9 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/.svn/text-base/PrincipalInstallRates.java.svn-base @@ -0,0 +1,70 @@ +package com.fp.general.rules.query; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.persistence.Query; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; + +public class PrincipalInstallRates extends QueryRule { + + private String module = null; + private String product = null; + private String subproduct = null; + private String currency = null; + /** + * + */ + private static final long serialVersionUID = 1L; + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + this.module = pQueryRequest.get("modulecode").toString(); + this.product = pQueryRequest.get("productcode").toString(); + this.subproduct = pQueryRequest.get("subproductcode").toString(); + this.currency = pQueryRequest.get("currencycode").toString(); + + List> list = new ArrayList>(); + list = fillMap(); + response.put("LOVTGENESUBPRODUCTINSTALLRATES", list); + return pQueryRequest; + } + + private List> fillMap() throws Exception { + List> lresp = new ArrayList>(); + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(SQL); + //qry.setParameter("", ""); + List ldata = qry.getResultList(); + if(ldata.isEmpty()){ + return lresp; + } + for (Object object : ldata) { + Object[] items = (Object[]) object; + Map m = new HashMap(); + m.put("btype", items[0].toString()); + m.put("bgroup", items[1].toString()); + m.put("desc", items[2].toString()); + lresp.add(m); + } + return lresp; + } + + + + + private static final String SQL = + "select unique ir.principalbalancetype, ir.principalbalancegroup, bt.description "+ + "from TGENESUBPRODUCTINSTALLRATES ir, TGENEBALANCETYPE bt "+ + "where ir.principalbalancetype = bt.balancetype and "+ + "ir.principalbalancegroup = bt.balancegroup and "+ + "ir.modulecode=8 and ir.productcode=1 and " + + "ir.subproductcode=1 and ir.currencycode='USD' "; + + +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/BalanceTypeProvision.java b/base/business/general/src/main/java/com/fp/general/rules/query/BalanceTypeProvision.java new file mode 100644 index 0000000..6dcb153 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/BalanceTypeProvision.java @@ -0,0 +1,103 @@ +package com.fp.general.rules.query; + +import com.fp.common.helper.BeanManager; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.dto.Response; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.hibernate.SQLQuery; +import org.hibernate.ScrollableResults; + +/** + * Clase que se encarga de armar los tipos de balance por modulo y provicion + * @author scastillo + */ +public class BalanceTypeProvision extends QueryRule { + + /** + * Proceso que devuevelve los tipos de balance en el response + * @param pQueryRequest + * @return + * @throws Exception + */ + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + QueryBean queryBeanDebit = (QueryBean) pQueryRequest.get("BALANCETYPEPROVITION"); + String modulecode = (String) BeanManager.convertObject(queryBeanDebit.getCriteriaValue("modulecode"), String.class); + String isprovision = (String) BeanManager.convertObject(queryBeanDebit.getCriteriaValue("isprovision"), String.class); + List> data = getBalanceType(modulecode, isprovision); + response.put("BALANCETYPEPROVITION", data); + return pQueryRequest; + } + + /** + * Mtodo que ejecuta el query y los asigna en un map a todo los tipos de saldo + * @param module + * @param isprovision + * @return + * @throws Exception + */ + private List> getBalanceType(String module, String isprovision) throws Exception { + ScrollableResults scrollableResults = null; + SQLQuery qry = PersistenceHelper.getSession().createSQLQuery(obtainSelect(module, isprovision)); + scrollableResults = qry.scroll(); + List> balancetype = new ArrayList>(); + try { + while (scrollableResults.next()) { + Object[] object = scrollableResults.get(); + Map map = new HashMap(); + String pk_balancetype = (String) object[0]; + String pk_balancegroup = (String) object[1]; + String description = (String) object[2]; + String balancecategory = (String) object[3]; + String modulecode = (String) object[4]; + map.put("pk_balancetype", pk_balancetype); + map.put("pk_balancegroup", pk_balancegroup); + map.put("description", description); + map.put("balancecategory", balancecategory); + map.put("modulecode", modulecode); + balancetype.add(map); + } + } finally { + scrollableResults.close(); + } + return balancetype; + } + + /** + * Metodo que arma el select a ejecutar para obtener los tipos de balance + * @param module + * @param isprovision + * @return + */ + private String obtainSelect(String module, String isprovision) { + String filtermodule = ""; + if (module != null) { + filtermodule = " where tgbt.MODULECODE = '" + module + "' and"; + } + String filterprovision = ")"; + if (isprovision != null) { + filterprovision = " and tgbtd.ISPROVISON = '" + isprovision + "')"; + } + String sentencia = + "select tgbt.BALANCETYPE," + + " tgbt.BALANCEGROUP," + + " tgbt.DESCRIPTION," + + " tgbt.BALANCECATEGORY," + + " tgbt.MODULECODE" + + " from TGENEBALANCETYPE tgbt" + + filtermodule + + " exists (select 1" + + " from TGENEBALANCETYPEDETAIL tgbtd" + + " where tgbt.BALANCETYPE = tgbtd.BALANCETYPE" + + " and tgbt.BALANCEGROUP = tgbtd.BALANCEGROUP" + + filterprovision + + " order by tgbt.BALANCETYPE"; + return sentencia; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/CompleteMaturation.java b/base/business/general/src/main/java/com/fp/general/rules/query/CompleteMaturation.java new file mode 100644 index 0000000..be26308 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/CompleteMaturation.java @@ -0,0 +1,61 @@ +package com.fp.general.rules.query; + +import java.util.List; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.transf.TgeneMaturation; + +/** + * Clase que se encarga de completar la descripcion de los items de la tabla TgeneMaturation + * + * @author scastillo + * @version 2.1 + */ +public class CompleteMaturation extends QueryRule { + + /** + * Mtodo que completa las descripciones de la tabla TgeneMaturation + * + * @param pQueryRequest + * @return + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List lobjects = (List) response.get("TGENEMATURATION"); + if (lobjects == null) { + return pQueryRequest; + } + for (Object obj : lobjects) { + TgeneMaturation tgeneMaturation = (TgeneMaturation) obj; + if ((tgeneMaturation.getTransactionmodule() != null) && (tgeneMaturation.getTransactioncode() != null) + && (tgeneMaturation.getTransactionversion() != null)) { + if (tgeneMaturation.getDebititem() != null) { + tgeneMaturation.addAddtionalInfo("debititemdesc", GeneralDescriptions.getTransactionItemdesc( + tgeneMaturation.getTransactionmodule(), tgeneMaturation.getTransactioncode(), tgeneMaturation.getTransactionversion(), + tgeneMaturation.getDebititem())); + } else { + tgeneMaturation.addAddtionalInfo("debititemdesc", null); + } + if (tgeneMaturation.getCredititem() != null) { + tgeneMaturation.addAddtionalInfo("credititemdesc", GeneralDescriptions.getTransactionItemdesc( + tgeneMaturation.getTransactionmodule(), tgeneMaturation.getTransactioncode(), tgeneMaturation.getTransactionversion(), + tgeneMaturation.getCredititem())); + } else { + tgeneMaturation.addAddtionalInfo("credititemdesc", null); + } + } else { + tgeneMaturation.addAddtionalInfo("debititemdesc", null); + tgeneMaturation.addAddtionalInfo("credititemdesc", null); + } + } + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/CompleteTransactionLevel.java b/base/business/general/src/main/java/com/fp/general/rules/query/CompleteTransactionLevel.java new file mode 100644 index 0000000..33c9bea --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/CompleteTransactionLevel.java @@ -0,0 +1,44 @@ +package com.fp.general.rules.query; + +import java.util.List; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelTran; + +/** + * Clase que completa el nombre de la transaccion en niveles + * + * @author scastillo + */ +public class CompleteTransactionLevel extends QueryRule { + + /** + * Metodo que completa el nombre de la transaccion + * + * @param pQueryRequest + * @return + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List lobjects = (List) response.get("TGENEMENULEVELTRAN"); + for (Object obj : lobjects) { + TgeneMenuLevelTran tgeneMenuLevelTran = (TgeneMenuLevelTran) obj; + if ((tgeneMenuLevelTran.getPk().getTransactionmodule() != null) && (tgeneMenuLevelTran.getPk().getTransactioncode() != null) + && (tgeneMenuLevelTran.getPk().getTransactionversion() != null)) { + tgeneMenuLevelTran.addAddtionalInfo("name", GeneralDescriptions.getTransactiondesc(tgeneMenuLevelTran.getPk().getTransactionmodule(), + tgeneMenuLevelTran.getPk().getTransactioncode(), tgeneMenuLevelTran.getPk().getTransactionversion())); + } else { + tgeneMenuLevelTran.addAddtionalInfo("name", null); + } + } + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/CompleteTransactionMixPages.java b/base/business/general/src/main/java/com/fp/general/rules/query/CompleteTransactionMixPages.java new file mode 100644 index 0000000..003077c --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/CompleteTransactionMixPages.java @@ -0,0 +1,45 @@ +package com.fp.general.rules.query; + +import java.util.List; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.gene.TgeneTransactionMixPages; + +/** + * Clase que se encarga de completar el nombre de la transaccion par la definicion de las paginas en caja multiple + * + * @author scastillo + */ +public class CompleteTransactionMixPages extends QueryRule { + + /** + * Metodo que completa el nombre de la transaccion + * + * @param pQueryRequest + * @return + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List lobjects = (List) response.get("TGENETRANSACTIONMIXPAGES"); + for (Object obj : lobjects) { + TgeneTransactionMixPages tgeneTransactionMixPages = (TgeneTransactionMixPages) obj; + if ((tgeneTransactionMixPages.getPk().getTransactionmodule() != null) && (tgeneTransactionMixPages.getPk().getTransactioncode() != null) + && (tgeneTransactionMixPages.getPk().getTransactionversion() != null)) { + tgeneTransactionMixPages.addAddtionalInfo("name", GeneralDescriptions.getTransactiondesc(tgeneTransactionMixPages.getPk() + .getTransactionmodule(), tgeneTransactionMixPages.getPk().getTransactioncode(), tgeneTransactionMixPages.getPk() + .getTransactionversion())); + } else { + tgeneTransactionMixPages.addAddtionalInfo("name", null); + } + } + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/CompleteTransactionSubLevel.java b/base/business/general/src/main/java/com/fp/general/rules/query/CompleteTransactionSubLevel.java new file mode 100644 index 0000000..3babf98 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/CompleteTransactionSubLevel.java @@ -0,0 +1,45 @@ +package com.fp.general.rules.query; + +import java.util.List; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelTran; + +/** + * Clase que completa el nombre de la transaccion en subniveles + * + * @author scastillo + */ +public class CompleteTransactionSubLevel extends QueryRule { + + /** + * Metodo que completa el nombre de la transaccion + * + * @param pQueryRequest + * @return + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List lobjects = (List) response.get("TGENEMENUSUBLEVELTRAN"); + for (Object obj : lobjects) { + TgeneMenuSubLevelTran tgeneMenuSubLevelTran = (TgeneMenuSubLevelTran) obj; + if ((tgeneMenuSubLevelTran.getPk().getTransactionmodule() != null) && (tgeneMenuSubLevelTran.getPk().getTransactioncode() != null) + && (tgeneMenuSubLevelTran.getPk().getTransactionversion() != null)) { + tgeneMenuSubLevelTran.addAddtionalInfo("name", GeneralDescriptions.getTransactiondesc(tgeneMenuSubLevelTran.getPk() + .getTransactionmodule(), tgeneMenuSubLevelTran.getPk().getTransactioncode(), tgeneMenuSubLevelTran.getPk() + .getTransactionversion())); + } else { + tgeneMenuSubLevelTran.addAddtionalInfo("name", null); + } + } + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/ExecuteSQL.java b/base/business/general/src/main/java/com/fp/general/rules/query/ExecuteSQL.java new file mode 100644 index 0000000..8264fb2 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/ExecuteSQL.java @@ -0,0 +1,42 @@ +package com.fp.general.rules.query; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import org.hibernate.SQLQuery; +import org.hibernate.ScrollableResults; +import java.util.ArrayList; +import java.util.List; + +/** + * Clase que se encarga de ejecutar un query que se enva desde la parte web + * @author scastillo + */ +public class ExecuteSQL extends QueryRule { + + /** + * + * @param pQueryRequest + * @return + * @throws Exception + */ + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + String sql = (String) pQueryRequest.get("sql"); + String isUniqueResult = (String) pQueryRequest.get("isUniqueResult"); + SQLQuery qry = PersistenceHelper.getSession().createSQLQuery(sql); + if (isUniqueResult.equals("Y")) { + Object data = qry.uniqueResult(); + response.put("result", data); + } else { + ScrollableResults scrollableResults = qry.scroll(); + List lObject = new ArrayList(); + while (scrollableResults.next()) { + lObject.add(scrollableResults.get()); + } + response.put("result", lObject); + } + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/LovOfficer.java b/base/business/general/src/main/java/com/fp/general/rules/query/LovOfficer.java new file mode 100644 index 0000000..a60cd7f --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/LovOfficer.java @@ -0,0 +1,44 @@ +package com.fp.general.rules.query; + +import java.util.List; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.pgeneral.gene.TgeneOfficer; +import com.fp.persistence.pgeneral.safe.TsafeUser; + +/** + * Metodo que completa el nombre del usuario oficial de cuenta. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class LovOfficer extends QueryRule { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.QueryRule#process(com.fp.dto.query.QueryRequest) + */ + @Override + @SuppressWarnings("unchecked") + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List lobjects = (List) response.get("TGENEOFFICER"); + for (Object obj : lobjects) { + TgeneOfficer officer = (TgeneOfficer) obj; + if (officer.getPk().getModulecode() == null) { + throw new GeneralException("GENE-0033", "OFICIAL DE CUENTA NO DEFINIDO PARA EL PRODUCTO EN TGENEOFFICER"); + } + TsafeUser user = com.fp.base.persistence.util.db.DataHelper.getInstance().getTsafeUser(officer.getPk().getUsercode()); + officer.addAddtionalInfo("name", GeneralDescriptions.getPersonname(user.getPersoncode())); + } + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/LovTransactionEvent.java b/base/business/general/src/main/java/com/fp/general/rules/query/LovTransactionEvent.java new file mode 100644 index 0000000..b48e1b3 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/LovTransactionEvent.java @@ -0,0 +1,47 @@ +package com.fp.general.rules.query; + +import java.util.List; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.trans.TgeneTransactionEvent; + +/** + * Clase para completar el nombre de la transaccion por eventos + * + * @author scastillo + */ +public class LovTransactionEvent extends QueryRule { + + /** + * Proceso que se encarga de completar el nombre de la transaccion + * + * @param pQueryRequest + * @return + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List lobjects = (List) response.get("TGENETRANSACTIONEVENT"); + for (Object obj : lobjects) { + TgeneTransactionEvent tgeneTransactionEvent = (TgeneTransactionEvent) obj; + if (tgeneTransactionEvent.getTransactionmodule() != null) { + tgeneTransactionEvent.addAddtionalInfo( + "name", + GeneralDescriptions.getTransactiondesc(tgeneTransactionEvent.getTransactionmodule(), + tgeneTransactionEvent.getTransactioncode(), tgeneTransactionEvent.getTransactionversion())); + tgeneTransactionEvent.addAddtionalInfo("moduledesc", GeneralDescriptions.getModuledesc(tgeneTransactionEvent.getTransactionmodule())); + } else { + tgeneTransactionEvent.addAddtionalInfo("name", null); + tgeneTransactionEvent.addAddtionalInfo("moduledesc", null); + } + } + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/PrincipalInstallRates.java b/base/business/general/src/main/java/com/fp/general/rules/query/PrincipalInstallRates.java new file mode 100644 index 0000000..65976b9 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/PrincipalInstallRates.java @@ -0,0 +1,70 @@ +package com.fp.general.rules.query; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.persistence.Query; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; + +public class PrincipalInstallRates extends QueryRule { + + private String module = null; + private String product = null; + private String subproduct = null; + private String currency = null; + /** + * + */ + private static final long serialVersionUID = 1L; + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + this.module = pQueryRequest.get("modulecode").toString(); + this.product = pQueryRequest.get("productcode").toString(); + this.subproduct = pQueryRequest.get("subproductcode").toString(); + this.currency = pQueryRequest.get("currencycode").toString(); + + List> list = new ArrayList>(); + list = fillMap(); + response.put("LOVTGENESUBPRODUCTINSTALLRATES", list); + return pQueryRequest; + } + + private List> fillMap() throws Exception { + List> lresp = new ArrayList>(); + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(SQL); + //qry.setParameter("", ""); + List ldata = qry.getResultList(); + if(ldata.isEmpty()){ + return lresp; + } + for (Object object : ldata) { + Object[] items = (Object[]) object; + Map m = new HashMap(); + m.put("btype", items[0].toString()); + m.put("bgroup", items[1].toString()); + m.put("desc", items[2].toString()); + lresp.add(m); + } + return lresp; + } + + + + + private static final String SQL = + "select unique ir.principalbalancetype, ir.principalbalancegroup, bt.description "+ + "from TGENESUBPRODUCTINSTALLRATES ir, TGENEBALANCETYPE bt "+ + "where ir.principalbalancetype = bt.balancetype and "+ + "ir.principalbalancegroup = bt.balancegroup and "+ + "ir.modulecode=8 and ir.productcode=1 and " + + "ir.subproductcode=1 and ir.currencycode='USD' "; + + +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/entries b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/entries new file mode 100644 index 0000000..ba2e413 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/entries @@ -0,0 +1,436 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/rules/query/code +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +LovCustomer.java +file + + + + +2022-07-28T03:40:43.713807Z +9020765d8cb9a5530b6247c106103be2 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3714 + +DataBaseFile.java +file + + + + +2022-07-28T03:40:43.713807Z +d0f25b95f1a5a367e50cac63a35d05f2 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1914 + +ModuleDesc.java +file + + + + +2022-07-28T03:40:43.714807Z +030c56c40d348d4a101f05282ee28d47 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1634 + +InfoDataFile.java +file + + + + +2022-07-28T03:40:43.714807Z +1042afa85e4b7a901667d965de8c8ada +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1559 + +CriteriaValidator.java +file + + + + +2022-07-28T03:40:43.714807Z +ba61237fb33baec0757dd8613d4a519e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +786 + +DaysAccountingDate.java +file + + + + +2022-07-28T03:40:43.714807Z +4be4d9f7122c923349f5566c79f58ff9 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4372 + +SubProductDesc.java +file + + + + +2022-07-28T03:40:43.715807Z +60963fca7e9b1c9c0c4214c63a4f7554 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1959 + +HeaderSolicitude.java +file + + + + +2022-07-28T03:40:43.715807Z +d61f98af99479dab12243127a0aa9b98 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2605 + +LovAccount.java +file + + + + +2022-07-28T03:40:43.715807Z +b9a1513eeeeb5ebcc4abd0561bb8376b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3882 + +LovCustomerMulti.java +file + + + + +2022-07-28T03:40:43.715807Z +ec0a13f82f12907f32092e850581f521 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4282 + +LovOfficial.java +file + + + + +2022-07-28T03:40:43.716807Z +65d7e036fa8e6eeb73735d9c77332aea +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3034 + +VerifyClientData.java +file + + + + +2022-07-28T03:40:43.716807Z +e59c96d3802c0b89e97d6b75d0b454e7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4943 + diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/CriteriaValidator.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/CriteriaValidator.java.svn-base new file mode 100644 index 0000000..3152243 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/CriteriaValidator.java.svn-base @@ -0,0 +1,25 @@ +package com.fp.general.rules.query.code; + +import java.util.List; + +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; + +public class CriteriaValidator { + + public static String[] validatePercentage(QueryBean qb) { + String resp[] = new String[2]; + resp[0] = "0"; + List lcriteria = qb.getCriteria(); + for (QueryCriteria obj : lcriteria) { + if ((obj.getProperty() != null) && (obj.getValue() != null) && (obj.getOperation() != null)) { + if (obj.getValue().toString().compareTo("%") == 0) { + resp[1] = (String) obj.getValue(); + return resp; + } + } + } + resp[0] = "1"; + return resp; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/DataBaseFile.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/DataBaseFile.java.svn-base new file mode 100644 index 0000000..58658b1 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/DataBaseFile.java.svn-base @@ -0,0 +1,52 @@ +package com.fp.general.rules.query.code; + +import java.sql.Timestamp; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.image.TgeneFilesDetailKey; + +/** + * Clase que devuelve en bytes un archivo + * + * @author scastillo + */ +public class DataBaseFile extends QueryRule { + + /** + * Metodo que devuelve en forma de bytes un archivo + * + * @param pQueryRequest + * @return + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Integer code = (Integer) pQueryRequest.get("code"); + Timestamp dateto = null; + if (pQueryRequest.get("dateto") != null) { + dateto = Timestamp.valueOf((String) pQueryRequest.get("dateto")); + } else { + dateto = FormatDates.getDefaultExpiryTimestamp(); + } + TgeneFilesDetailKey tgeneFilesDetailKey = new TgeneFilesDetailKey(code, dateto); + TgeneFilesDetail tgeneFilesDetail = (TgeneFilesDetail) PersistenceHelper.getSession().get(TgeneFilesDetail.class, tgeneFilesDetailKey); + if (tgeneFilesDetail != null) { + response.put("file", tgeneFilesDetail.getImage()); + response.put("extension", tgeneFilesDetail.getExtension()); + response.put("contentType", tgeneFilesDetail.getContenttype()); + response.put("name", tgeneFilesDetail.getName()); + } else { + response.put("file", null); + response.put("extension", null); + response.put("contentType", null); + response.put("name", null); + } + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/DaysAccountingDate.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/DaysAccountingDate.java.svn-base new file mode 100644 index 0000000..e9c1000 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/DaysAccountingDate.java.svn-base @@ -0,0 +1,126 @@ +package com.fp.general.rules.query.code; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.hibernate.SQLQuery; +import org.hibernate.ScrollableResults; + +/** + * Clase que se encarga de armar la estructura para la grilla para la generacin de fechas contables + * @author scastillo + */ +public class DaysAccountingDate extends QueryRule { + + private static final String SQL = + "select TGC.LEGALCODE, TGC.DESCRIPTION" + + " from TGENECATALOGDETAIL TGC" + + " where TGC.CATALOGCODE = 'DAYS'" + + " order BY TGC.CATALOG"; + + /** + * Metodo que se encarga de armar el map + * @param queryRequest + * @return + * @throws Exception + */ + public QueryRequest process(QueryRequest queryRequest) throws Exception { + Response response = queryRequest.getResponse(); + response.put("branchcodemin", this.getBranchMin(queryRequest.getCompany())); + response.put("branchcodemax", this.getBranchMax(queryRequest.getCompany())); + response.put("LISTACCOUNTINDATE", this.getDays()); + return queryRequest; + } + + /** + * Metodo que arma la estructura para situarla en el datagrid + * @return + * @throws Exception + */ + private List> getDays() throws Exception { + ScrollableResults rSet = null; + List> ldata = new ArrayList>(); + try { + rSet = this.executeQuery(); + while (rSet.next()) { + Object[] obj = rSet.get(); + Map mData = new HashMap(); + mData.put("transportBeanClass", null); + mData.put("day", obj[0]); + mData.put("daydesc", obj[1]); + mData.put("accounting", "N"); + mData.put("teller", "N"); + ldata.add(mData); + } + } finally { + if (rSet != null) { + rSet.close(); + } + } + return ldata; + } + + /** + * Metodo que ejecuta para obtener los dias + * @param pQueryRequest + * @return + * @throws Exception + */ + private ScrollableResults executeQuery() throws Exception { + ScrollableResults rSet = null; + SQLQuery sql = PersistenceHelper.getSession().createSQLQuery(SQL); + rSet = sql.scroll(); + return rSet; + } + private static String SQL_BRANCH_MIN = + "select min(BRANCHCODE) value" + + " from TGENEBRANCH" + + " where COMPANYCODE = :companycode"; + + /** + * Metodo que devuelve el codigo de sucursal menor + * @param companycode + * @return + * @throws Exception + */ + private Integer getBranchMin(Integer companycode) throws Exception { + SQLQuery sql = PersistenceHelper.getSession().createSQLQuery(SQL_BRANCH_MIN); + sql.setParameter("companycode", companycode); + sql.addScalar("value", new org.hibernate.type.IntegerType()); + Integer value = (Integer) sql.uniqueResult(); + if (value == null) { + throw new GeneralException("GENE-0018", "SUCURSALES NO DEFINIDAS PARA LA COMPANIA: {0}", companycode); + } + return value; + } + /** + Sentencia SQL que devuelve la sucursal mayor + */ + private static String SQL_BRANCH_MAX = + "select max(BRANCHCODE) value" + + " from TGENEBRANCH" + + " where COMPANYCODE = :companycode"; + + /** + * Metodo que devuelve el codigo de sucursal maxima + * @param companycode + * @return + * @throws Exception + */ + private Integer getBranchMax(Integer companycode) throws Exception { + SQLQuery sql = PersistenceHelper.getSession().createSQLQuery(SQL_BRANCH_MAX); + sql.setParameter("companycode", companycode); + sql.addScalar("value", new org.hibernate.type.IntegerType()); + Integer value = (Integer) sql.uniqueResult(); + if (value == null) { + throw new GeneralException("GENE-0018", "SUCURSALES NO DEFINIDAS PARA LA COMPANIA: {0}", companycode); + } + return value; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/HeaderSolicitude.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/HeaderSolicitude.java.svn-base new file mode 100644 index 0000000..b4d4460 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/HeaderSolicitude.java.svn-base @@ -0,0 +1,49 @@ +package com.fp.general.rules.query.code; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.general.db.DataHelper; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.pgeneral.gene.TgeneSolicitude; + +/** + * Clase que se encarge de completar los datos de cabecera de una solicitud + * + * @author scastillo + */ +public class HeaderSolicitude extends QueryRule { + + String solicitudnumber; + Integer solicitudsequence; + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + this.solicitudnumber = (String) pQueryRequest.get("solicitudnumber"); + this.solicitudsequence = (Integer) pQueryRequest.get("solicitudsequence"); + TgeneSolicitude tgeneSolicitude = DataHelper.getInstance().getTgeneSolicitude(this.solicitudnumber, this.solicitudsequence); + if ((tgeneSolicitude == null) || (tgeneSolicitude.getModulecode().compareTo(pQueryRequest.getTransactionModule()) != 0)) { + throw new GeneralException("GENE-0049", "SOLICITUD NO EXISTE"); + } + if (tgeneSolicitude != null && tgeneSolicitude.getStatuscode().compareTo("COM") == 0) { + /*TgeneSolicitudeStatusKey tgeneSolicitudeStatusKey = new TgeneSolicitudeStatusKey(tgeneSolicitude.getModulecode(), + tgeneSolicitude.getStatuscode()); + TgeneSolicitudeStatus tgeneSolicitudeStatus = TgeneSolicitudeStatus.find(PersistenceHelper.getEntityManager(), + tgeneSolicitudeStatusKey); + throw new GeneralException("GENE-0046", "SOLICITUD EN ESTADO {0}", tgeneSolicitudeStatus.getDescription());*/ + throw new GeneralException("GENE-0049", "SOLICITUD NO EXISTE"); + } + response.put("m", tgeneSolicitude.getModulecode()); + response.put("md", GeneralDescriptions.getModuledesc(tgeneSolicitude.getModulecode())); + response.put("p", tgeneSolicitude.getProductcode()); + response.put("pd", GeneralDescriptions.getProductdesc(tgeneSolicitude.getModulecode(), + tgeneSolicitude.getProductcode())); + response.put("s", tgeneSolicitude.getSubproductcode()); + response.put("sd", GeneralDescriptions.getSubProductdesc(tgeneSolicitude.getModulecode(), + tgeneSolicitude.getProductcode(), tgeneSolicitude.getSubproductcode())); + response.put("c", tgeneSolicitude.getCurrencycode()); + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/InfoDataFile.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/InfoDataFile.java.svn-base new file mode 100644 index 0000000..1c9a207 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/InfoDataFile.java.svn-base @@ -0,0 +1,43 @@ +package com.fp.general.rules.query.code; + +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Clase que se encarga de enviar la fecha de creacion y de vigencia de la firma + * @author scastillo + */ +public class InfoDataFile extends QueryRule { + + /** + * Metodo que envia la informacion de fechas del archivo + * @param pQueryRequest + * @return + * @throws Exception + */ + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query query = new Query(); + query.process(pQueryRequest); + List> infoImage = new ArrayList>(); + List dataImage = (List) response.get("TGENEFILESDETAIL"); + for (Object obj : dataImage) { + TgeneFilesDetail tgeneFilesDetail = (TgeneFilesDetail) obj; + Map map = new HashMap(); + map.put("datefrom", tgeneFilesDetail.getDatefrom().toString()); + map.put("dateto", tgeneFilesDetail.getPk().getDateto().toString()); + infoImage.add(map); + } + response.remove("TGENEFILESDETAIL"); + response.put("TGENEFILESDETAIL", infoImage); + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/LovAccount.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/LovAccount.java.svn-base new file mode 100644 index 0000000..2175fa8 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/LovAccount.java.svn-base @@ -0,0 +1,103 @@ +package com.fp.general.rules.query.code; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.bpm.query.Query; +import com.fp.core.exception.CoreException; +import com.fp.dto.Response; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.acco.TgeneAccount; + +/** + * Clase que se encarga de obtener una lista de cuentas, que se utiliza en el lov de cuentas en las paginas. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class LovAccount extends QueryRule { + + /** + * Versin de la Clase + */ + private static final long serialVersionUID = 1L; + + /** Tabla */ + private static final String TGENEACCOUNT = "TGENEACCOUNT"; + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.QueryRule#process(com.fp.dto.query.QueryRequest) + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query query = new Query(); + query.process(pQueryRequest); + this.fillResponse(response, pQueryRequest); + return pQueryRequest; + } + + /** + * Metodo que construye la respuesta del lov de cuentas. + * + * @param pResponse Objeto que contiene los objetos de respuesta. + * @param pQueryRequest Peticion + * @throws Exception + */ + private void fillResponse(Response pResponse, QueryRequest pQueryRequest) throws Exception { + List> lresp = new ArrayList>(); + @SuppressWarnings("unchecked") + List lQuota = (List) pResponse.get(LovAccount.TGENEACCOUNT); + for (Object object : lQuota) { + TgeneAccount obj = (TgeneAccount) object; + Map m = new HashMap(); + if (obj.getPk().getAccount() == null) { + QueryBean qb = pQueryRequest.getBeans().get(LovAccount.TGENEACCOUNT); + if ((qb.getCriteriaValue("pk.account") != null) && (qb.getCriteriaValue("pk.company") != null) && !qb.isNotin("pk.account")) { + throw new CoreException("CORE-0007", "CUENTA NO EXISTE: {0} COMPANIA {1}", qb.getCriteriaValue("pk.account"), + qb.getCriteriaValue("pk.company")); + } + break; + } + m.put("pk_account", obj.getPk().getAccount()); + m.put("accountname", obj.getAccountname()); + m.put("currencycode", obj.getCurrencycode()); + m.put("pk_company", obj.getPk().getCompany()); + m.put("personcode", obj.getPersoncode()); + m.put("modulecode", obj.getModulecode()); + m.put("productcode", obj.getProductcode()); + m.put("subproductcode", obj.getSubproductcode()); + m.put("statuscode", obj.getAccountstatuscode()); + lresp.add(m); + } + this.checkData(lresp); + pResponse.remove(LovAccount.TGENEACCOUNT); + pResponse.put(LovAccount.TGENEACCOUNT, lresp); + } + + /** + * Verifica y completa la estructura en el caso que la tabla no tenga datos + * + * @param lresp + */ + private void checkData(List> lresp) { + if (lresp.isEmpty()) { + Map m = new HashMap(); + m.put("pk_account", null); + m.put("accountname", null); + m.put("currencycode", null); + m.put("pk_company", null); + m.put("personcode", null); + m.put("modulecode", null); + m.put("productcode", null); + m.put("subproductcode", null); + lresp.add(m); + } + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/LovCustomer.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/LovCustomer.java.svn-base new file mode 100644 index 0000000..7a62211 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/LovCustomer.java.svn-base @@ -0,0 +1,91 @@ +package com.fp.general.rules.query.code; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.common.helper.Constant; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.GeneralQuery; +import com.fp.persistence.commondb.PersistenceHelper; + +/** + * Clase que se encarga de enviar solo los datos necesarios del cliente + * + * @author scastillo + */ +@SuppressWarnings("serial") +public class LovCustomer extends QueryRule { + + /** + * JPQL que obtiene informacion de personas + */ + private static final String JPQL_CUSTOMER = "select t.personcode, persontypecatalog,identification,name," + + " (select cd.description from TgeneCatalogDetail cd " + " where cd.catalogcode = t.identificationcatalogcode " + + " and cd.catalog = t.identificationcatalog " + " ) as identificationdesc, " + + " (select photocode from TcustPeople tp" + " where tp.personcode = t.personcode " + + " and tp.dateto = t.dateto " + " ) as photocode " + " from TcustPersonDetail t " + " where t.dateto = :dateto "; + + /** + * Metodo que construye la respuesta solo con los datos necesarios + * + * @param pQueryRequest QueryRequest + * @return pQueryRequest QueryRequest + * @throws Exception + */ + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + QueryBean qb = (QueryBean) pQueryRequest.get("TCUSTPERSONDETAILLOV"); + + String[] resp = CriteriaValidator.validatePercentage(qb); + if (resp[0].compareTo("0") == 0) { + throw new GeneralException("GENE-0043", "EL CRITERIO DE BSQUEDA --> {0} NO ES SUFICIENTE", resp[1]); + } + + Map mcriteria = new HashMap(); + + StringBuilder jpql = new StringBuilder(); + jpql.append(LovCustomer.JPQL_CUSTOMER); + GeneralQuery.addParameters(qb, jpql, mcriteria, true); + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(String.valueOf(jpql)); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + GeneralQuery.setParameters(qb, mcriteria, qry); + List ldata = qry.getResultList(); + + List> lfinal = new ArrayList>(); + if ((ldata != null) && (!ldata.isEmpty())) { + for (Object[] obj : ldata) { + Map m = new HashMap(); + m.put("pk_personcode", obj[0]); + m.put("persontypecatalog", obj[1]); + m.put("identification", obj[2]); + m.put("name", obj[3]); + m.put("identificationdesc", obj[4]); + m.put("photocode", obj[5]); + lfinal.add(m); + } + } else { + if (qb.getPage() == 1) { + Map m = new HashMap(); + m.put("pk_personcode", null); + m.put("persontypecatalog", null); + m.put("identification", null); + m.put("name", null); + m.put("identificationdesc", null); + m.put("photocode", null); + lfinal.add(m); + } + } + + pQueryRequest.getResponse().put("TCUSTPERSONDETAILLOV", lfinal); + + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/LovCustomerMulti.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/LovCustomerMulti.java.svn-base new file mode 100644 index 0000000..734bf30 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/LovCustomerMulti.java.svn-base @@ -0,0 +1,105 @@ +package com.fp.general.rules.query.code; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.common.helper.Constant; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.GeneralQuery; +import com.fp.persistence.commondb.PersistenceHelper; + +/** + * Clase que se encarga de enviar los datos necesarios de clientes + * + * @author jarias + * + */ +public class LovCustomerMulti extends QueryRule { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * JPQL que obtiene informacion de personas + */ + private static final String JPQL_CUSTOMER = "select t.personcode, persontypecatalog,identification,name," + + " (select cd.description from TgeneCatalogDetail cd " + " where cd.catalogcode = t.identificationcatalogcode " + + " and cd.catalog = t.identificationcatalog " + " ) as identificationdesc, " + + " (select photocode from TcustPeople tp" + " where tp.personcode = t.personcode " + + " and tp.dateto = t.dateto " + " ) as photocode " + " from TcustPersonDetail t " + " where t.dateto = :dateto "; + + /** + * Metodo que construye la respuesta solo con los datos necesarios + * + * @param pQueryRequest QueryRequest + * @return pQueryRequest QueryRequest + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + // TODO Auto-generated method stub + QueryBean qb = (QueryBean) pQueryRequest.get("TCUSTPERSONDETAILLOVMULTI"); + List> lfinalresult = new ArrayList>(); + lfinalresult = this.resultPersons(qb); + pQueryRequest.getResponse().put("TCUSTPERSONDETAILLOVMULTI", lfinalresult); + return pQueryRequest; + } + + /** + * Mtodo que retorna la busqueda de las personas + * + * @param qb QueryBean + * @return lfinal lista que contiene los clienets consultados + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List> resultPersons(QueryBean qb) throws Exception { + String[] resp = CriteriaValidator.validatePercentage(qb); + if (resp[0].compareTo("0") == 0) { + throw new GeneralException("GENE-0043", "EL CRITERIO DE BSQUEDA --> {0} NO ES SUFICIENTE", resp[1]); + } + List> lfinal = new ArrayList>(); + Map mcriteria = new HashMap(); + StringBuilder jpql = new StringBuilder(); + jpql.append(LovCustomerMulti.JPQL_CUSTOMER); + GeneralQuery.addParameters(qb, jpql, mcriteria, true); + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(String.valueOf(jpql)); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + GeneralQuery.setParameters(qb, mcriteria, qry); + List ldata = qry.getResultList(); + + if ((ldata != null) && (!ldata.isEmpty())) { + for (Object[] obj : ldata) { + Map m = new HashMap(); + m.put("pk_personcode", obj[0]); + m.put("persontypecatalog", obj[1]); + m.put("identification", obj[2]); + m.put("name", obj[3]); + m.put("identificationdesc", obj[4]); + m.put("photocode", obj[5]); + lfinal.add(m); + } + } else { + if (qb.getPage() == 1) { + Map m = new HashMap(); + m.put("pk_personcode", null); + m.put("persontypecatalog", null); + m.put("identification", null); + m.put("name", null); + m.put("identificationdesc", null); + m.put("photocode", null); + lfinal.add(m); + } + } + return lfinal; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/LovOfficial.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/LovOfficial.java.svn-base new file mode 100644 index 0000000..9a5eda8 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/LovOfficial.java.svn-base @@ -0,0 +1,71 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.general.rules.query.code; + +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.GeneralQuery; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.persistence.Query; + +/** + * + * @author BPTWPA + */ +public class LovOfficial extends QueryRule { + + private static final long serialVersionUID = 1L; + /** + * JPQL que presenta los funcionarions del BEV + */ + private static final String JPQL_OFFICIAL = "from TcustPersonDetail t " + + "where t.pk.personcode in (" + + "select f.pk.personcode " + + "from TcustPeopleJob f " + + "where f.employerpersoncode = :bevcode " + + "and f.pk.dateto = :datetojob " + + "and f.departuredate = null)"; + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + StringBuilder jpql = new StringBuilder(); + QueryBean qb = (QueryBean) pQueryRequest.get("OFFICIALLOV"); + Map mcriteria = new HashMap(); + TgeneParametersKey tgeneParametersKey = new TgeneParametersKey("BEVCODE", Integer.valueOf(pQueryRequest.get("COMPANY").toString())); + TgeneParameters tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), tgeneParametersKey); + if (tgeneParameters.getNumbervalue() == null) { + return pQueryRequest; + } + jpql.append(LovOfficial.JPQL_OFFICIAL); + GeneralQuery.addParameters(qb, jpql, mcriteria); + Query qry = PersistenceHelper.getEntityManager().createQuery(String.valueOf(jpql)); + qry.setParameter("datetojob", FormatDates.getDefaultExpiryTimestamp()); + qry.setParameter("bevcode", Integer.valueOf(tgeneParameters.getNumbervalue().intValue())); + GeneralQuery.setParameters(qb, mcriteria, qry); + List ldata = qry.getResultList(); + if (!ldata.isEmpty()) { + List> lresp = new ArrayList>(); + for (TcustPersonDetail obj : ldata) { + Map m = new HashMap(); + m.put("pk.personcode", obj.getPk().getPersoncode()); + m.put("pk.dateto", obj.getPk().getDateto()); + m.put("identification", obj.getIdentification()); + m.put("name", obj.getName()); + lresp.add(m); + } + pQueryRequest.getResponse().put("OFFICIALLOV", lresp); + } + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/ModuleDesc.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/ModuleDesc.java.svn-base new file mode 100644 index 0000000..8fc1a14 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/ModuleDesc.java.svn-base @@ -0,0 +1,46 @@ +package com.fp.general.rules.query.code; + +import java.util.List; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.installment.TgeneInstallmentType; + +/** + * Clase que se encarga de completar la descripcion del modulo, dado su codigo. + * + * @author Wilson Sigcho + * @version 2.1 + */ +public class ModuleDesc extends QueryRule { + + /** + * Metodo que agrega la descripcion de un modulo, dado su codigo en una consulta requerida. + * + * @param pQueryRequest Objeto que posee la consulta requerida. + * @return pQueryRequest + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List lobjects = (List) response.get("TGENEINSTALLMENTTYPE"); + if (lobjects == null) { + return pQueryRequest; + } + for (Object obj : lobjects) { + TgeneInstallmentType tgeneInstallmentType = (TgeneInstallmentType) obj; + if (tgeneInstallmentType.getPk().getModulecode() != null) { + tgeneInstallmentType.addAddtionalInfo("moduledesc", GeneralDescriptions.getModuledesc(tgeneInstallmentType.getPk().getModulecode())); + } else { + tgeneInstallmentType.addAddtionalInfo("moduledesc", null); + } + } + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/SubProductDesc.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/SubProductDesc.java.svn-base new file mode 100644 index 0000000..d459c13 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/SubProductDesc.java.svn-base @@ -0,0 +1,49 @@ +package com.fp.general.rules.query.code; + +import java.util.List; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.product.TgeneSubProduct; + +/** + * Clase que se encarga de completar descripcion del modulo, producto, y subproducto, dado un codigo de query alias. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class SubProductDesc extends QueryRule { + + /** + * Metodo que completa descripciones de modulo, producto y sub producto. + */ + @Override + @SuppressWarnings("unchecked") + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List lobjects = (List) response.get("TGENESUBPRODUCT"); + if (lobjects == null) { + return pQueryRequest; + } + for (Object obj : lobjects) { + TgeneSubProduct subprod = (TgeneSubProduct) obj; + if (subprod.getPk().getModulecode() == null) { + continue; + } + // module descripion + subprod.addAddtionalInfo("moduledesc", GeneralDescriptions.getModuledesc(subprod.getPk().getModulecode())); + // product description + subprod.addAddtionalInfo("productdesc", + GeneralDescriptions.getProductdesc(subprod.getPk().getModulecode(), subprod.getPk().getProductcode())); + // subproduct description + subprod.addAddtionalInfo("subproductdesc", GeneralDescriptions.getSubProductdesc(subprod.getPk().getModulecode(), subprod.getPk() + .getProductcode(), subprod.getPk().getSubproductcode())); + } + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/VerifyClientData.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/VerifyClientData.java.svn-base new file mode 100644 index 0000000..bc32bd4 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/.svn/text-base/VerifyClientData.java.svn-base @@ -0,0 +1,128 @@ +package com.fp.general.rules.query.code; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.SQLQuery; +import org.hibernate.ScrollableResults; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.general.db.DataHelper; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.auth.TgeneSolicitudeClientdata; + +/** + * Clase que se encarga de consultar los valores para verificar los clientes de una solicitud + * + * @author scastillo + */ +public class VerifyClientData extends QueryRule { + + String transactionmodule; + + Integer transactioncode; + + String solicitudnumber; + + Integer solicitudsequence; + + Integer personcode; + + String module; + + String productcode; + + String subproductcode; + + String persontype; + + String relationshipcode; + + /** + * Sentencia SQL para obtener los datos de la pgina a cargar + */ + private static final String SQL = "select tgt.TITLE t, tgt.PAGE p, tgt.QUERYFUNCTION q, tgt.SAVEFUNCTION s" + " from TGENETRANSACTIONPAGES tgt" + + " where tgt.TRANSACTIONMODULE = :transactionmodule" + " and tgt.TRANSACTIONCODE = :transactioncode and tgt.ACTIVE='Y' " + + " and tgt.TITLE in (select tgs.title" + " from TGENESOLICITUDECLIENTDATA tgs" + + " where tgs.SOLICITUDNUMBER = :solicitudnumber" + + " and tgs.SOLICITUDSEQUENCE = :solicitudsequence" + " and tgs.PERSONCODE = :personcode)"; + + /** + * Metodo que se encarga de + * + * @param pQueryRequest + * @return + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + this.transactionmodule = (String) pQueryRequest.get("transactionmodule"); + this.transactioncode = (Integer) pQueryRequest.get("transactioncode"); + this.solicitudnumber = (String) pQueryRequest.get("solicitudnumber"); + this.solicitudsequence = (Integer) pQueryRequest.get("solicitudsequence"); + this.personcode = (Integer) pQueryRequest.get("personcode"); + this.module = (String) pQueryRequest.get("module"); + this.productcode = (String) pQueryRequest.get("productcode"); + this.subproductcode = (String) pQueryRequest.get("subproductcode"); + this.persontype = (String) pQueryRequest.get("persontype"); + this.relationshipcode = (String) pQueryRequest.get("relationshipcode"); + response.put("transactions", this.getTransactionInfo()); + return pQueryRequest; + } + + /** + * Metodo que ejecuta la sentencia sql para obtener los datos de la base de datos + * + * @param pQueryRequest + * @return + * @throws Exception + */ + private ScrollableResults executeQuery() throws Exception { + ScrollableResults rSet = null; + SQLQuery sql = PersistenceHelper.getSession().createSQLQuery(VerifyClientData.SQL); + sql.setString("transactionmodule", this.transactionmodule); + sql.setInteger("transactioncode", this.transactioncode); + sql.setString("solicitudnumber", this.solicitudnumber); + sql.setInteger("solicitudsequence", this.solicitudsequence); + sql.setInteger("personcode", this.personcode); + rSet = sql.scroll(); + return rSet; + } + + /** + * Metodo que se encarga de armar la estructura para la verificacion de clientes + * + * @return + * @throws Exception + */ + private List> getTransactionInfo() throws Exception { + ScrollableResults rSet = null; + List> ldata = new ArrayList>(); + try { + rSet = this.executeQuery(); + while (rSet.next()) { + Object[] obj = rSet.get(); + Map mData = new HashMap(); + mData.put("t", obj[0]);// titulo + mData.put("p", obj[1]);// pagina + mData.put("q", obj[2]);// funcion query + mData.put("s", obj[3]);// funcion save + TgeneSolicitudeClientdata tgeneSolicitudeClientdata = DataHelper.getInstance().getTgeneSolicitudeClientdata(this.solicitudnumber, + this.solicitudsequence, (String) obj[0], this.personcode); + mData.put("r", tgeneSolicitudeClientdata.getRecordversion());// Record version + mData.put("c", tgeneSolicitudeClientdata.getChecked());// Checked + mData.put("o", tgeneSolicitudeClientdata.getPresentationorder());// Orden + mData.put("m", "N"); + ldata.add(mData); + } + } finally { + rSet.close(); + } + return ldata; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/CriteriaValidator.java b/base/business/general/src/main/java/com/fp/general/rules/query/code/CriteriaValidator.java new file mode 100644 index 0000000..3152243 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/CriteriaValidator.java @@ -0,0 +1,25 @@ +package com.fp.general.rules.query.code; + +import java.util.List; + +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; + +public class CriteriaValidator { + + public static String[] validatePercentage(QueryBean qb) { + String resp[] = new String[2]; + resp[0] = "0"; + List lcriteria = qb.getCriteria(); + for (QueryCriteria obj : lcriteria) { + if ((obj.getProperty() != null) && (obj.getValue() != null) && (obj.getOperation() != null)) { + if (obj.getValue().toString().compareTo("%") == 0) { + resp[1] = (String) obj.getValue(); + return resp; + } + } + } + resp[0] = "1"; + return resp; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/DataBaseFile.java b/base/business/general/src/main/java/com/fp/general/rules/query/code/DataBaseFile.java new file mode 100644 index 0000000..58658b1 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/DataBaseFile.java @@ -0,0 +1,52 @@ +package com.fp.general.rules.query.code; + +import java.sql.Timestamp; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.image.TgeneFilesDetailKey; + +/** + * Clase que devuelve en bytes un archivo + * + * @author scastillo + */ +public class DataBaseFile extends QueryRule { + + /** + * Metodo que devuelve en forma de bytes un archivo + * + * @param pQueryRequest + * @return + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Integer code = (Integer) pQueryRequest.get("code"); + Timestamp dateto = null; + if (pQueryRequest.get("dateto") != null) { + dateto = Timestamp.valueOf((String) pQueryRequest.get("dateto")); + } else { + dateto = FormatDates.getDefaultExpiryTimestamp(); + } + TgeneFilesDetailKey tgeneFilesDetailKey = new TgeneFilesDetailKey(code, dateto); + TgeneFilesDetail tgeneFilesDetail = (TgeneFilesDetail) PersistenceHelper.getSession().get(TgeneFilesDetail.class, tgeneFilesDetailKey); + if (tgeneFilesDetail != null) { + response.put("file", tgeneFilesDetail.getImage()); + response.put("extension", tgeneFilesDetail.getExtension()); + response.put("contentType", tgeneFilesDetail.getContenttype()); + response.put("name", tgeneFilesDetail.getName()); + } else { + response.put("file", null); + response.put("extension", null); + response.put("contentType", null); + response.put("name", null); + } + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/DaysAccountingDate.java b/base/business/general/src/main/java/com/fp/general/rules/query/code/DaysAccountingDate.java new file mode 100644 index 0000000..e9c1000 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/DaysAccountingDate.java @@ -0,0 +1,126 @@ +package com.fp.general.rules.query.code; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.hibernate.SQLQuery; +import org.hibernate.ScrollableResults; + +/** + * Clase que se encarga de armar la estructura para la grilla para la generacin de fechas contables + * @author scastillo + */ +public class DaysAccountingDate extends QueryRule { + + private static final String SQL = + "select TGC.LEGALCODE, TGC.DESCRIPTION" + + " from TGENECATALOGDETAIL TGC" + + " where TGC.CATALOGCODE = 'DAYS'" + + " order BY TGC.CATALOG"; + + /** + * Metodo que se encarga de armar el map + * @param queryRequest + * @return + * @throws Exception + */ + public QueryRequest process(QueryRequest queryRequest) throws Exception { + Response response = queryRequest.getResponse(); + response.put("branchcodemin", this.getBranchMin(queryRequest.getCompany())); + response.put("branchcodemax", this.getBranchMax(queryRequest.getCompany())); + response.put("LISTACCOUNTINDATE", this.getDays()); + return queryRequest; + } + + /** + * Metodo que arma la estructura para situarla en el datagrid + * @return + * @throws Exception + */ + private List> getDays() throws Exception { + ScrollableResults rSet = null; + List> ldata = new ArrayList>(); + try { + rSet = this.executeQuery(); + while (rSet.next()) { + Object[] obj = rSet.get(); + Map mData = new HashMap(); + mData.put("transportBeanClass", null); + mData.put("day", obj[0]); + mData.put("daydesc", obj[1]); + mData.put("accounting", "N"); + mData.put("teller", "N"); + ldata.add(mData); + } + } finally { + if (rSet != null) { + rSet.close(); + } + } + return ldata; + } + + /** + * Metodo que ejecuta para obtener los dias + * @param pQueryRequest + * @return + * @throws Exception + */ + private ScrollableResults executeQuery() throws Exception { + ScrollableResults rSet = null; + SQLQuery sql = PersistenceHelper.getSession().createSQLQuery(SQL); + rSet = sql.scroll(); + return rSet; + } + private static String SQL_BRANCH_MIN = + "select min(BRANCHCODE) value" + + " from TGENEBRANCH" + + " where COMPANYCODE = :companycode"; + + /** + * Metodo que devuelve el codigo de sucursal menor + * @param companycode + * @return + * @throws Exception + */ + private Integer getBranchMin(Integer companycode) throws Exception { + SQLQuery sql = PersistenceHelper.getSession().createSQLQuery(SQL_BRANCH_MIN); + sql.setParameter("companycode", companycode); + sql.addScalar("value", new org.hibernate.type.IntegerType()); + Integer value = (Integer) sql.uniqueResult(); + if (value == null) { + throw new GeneralException("GENE-0018", "SUCURSALES NO DEFINIDAS PARA LA COMPANIA: {0}", companycode); + } + return value; + } + /** + Sentencia SQL que devuelve la sucursal mayor + */ + private static String SQL_BRANCH_MAX = + "select max(BRANCHCODE) value" + + " from TGENEBRANCH" + + " where COMPANYCODE = :companycode"; + + /** + * Metodo que devuelve el codigo de sucursal maxima + * @param companycode + * @return + * @throws Exception + */ + private Integer getBranchMax(Integer companycode) throws Exception { + SQLQuery sql = PersistenceHelper.getSession().createSQLQuery(SQL_BRANCH_MAX); + sql.setParameter("companycode", companycode); + sql.addScalar("value", new org.hibernate.type.IntegerType()); + Integer value = (Integer) sql.uniqueResult(); + if (value == null) { + throw new GeneralException("GENE-0018", "SUCURSALES NO DEFINIDAS PARA LA COMPANIA: {0}", companycode); + } + return value; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/HeaderSolicitude.java b/base/business/general/src/main/java/com/fp/general/rules/query/code/HeaderSolicitude.java new file mode 100644 index 0000000..b4d4460 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/HeaderSolicitude.java @@ -0,0 +1,49 @@ +package com.fp.general.rules.query.code; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.general.db.DataHelper; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.pgeneral.gene.TgeneSolicitude; + +/** + * Clase que se encarge de completar los datos de cabecera de una solicitud + * + * @author scastillo + */ +public class HeaderSolicitude extends QueryRule { + + String solicitudnumber; + Integer solicitudsequence; + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + this.solicitudnumber = (String) pQueryRequest.get("solicitudnumber"); + this.solicitudsequence = (Integer) pQueryRequest.get("solicitudsequence"); + TgeneSolicitude tgeneSolicitude = DataHelper.getInstance().getTgeneSolicitude(this.solicitudnumber, this.solicitudsequence); + if ((tgeneSolicitude == null) || (tgeneSolicitude.getModulecode().compareTo(pQueryRequest.getTransactionModule()) != 0)) { + throw new GeneralException("GENE-0049", "SOLICITUD NO EXISTE"); + } + if (tgeneSolicitude != null && tgeneSolicitude.getStatuscode().compareTo("COM") == 0) { + /*TgeneSolicitudeStatusKey tgeneSolicitudeStatusKey = new TgeneSolicitudeStatusKey(tgeneSolicitude.getModulecode(), + tgeneSolicitude.getStatuscode()); + TgeneSolicitudeStatus tgeneSolicitudeStatus = TgeneSolicitudeStatus.find(PersistenceHelper.getEntityManager(), + tgeneSolicitudeStatusKey); + throw new GeneralException("GENE-0046", "SOLICITUD EN ESTADO {0}", tgeneSolicitudeStatus.getDescription());*/ + throw new GeneralException("GENE-0049", "SOLICITUD NO EXISTE"); + } + response.put("m", tgeneSolicitude.getModulecode()); + response.put("md", GeneralDescriptions.getModuledesc(tgeneSolicitude.getModulecode())); + response.put("p", tgeneSolicitude.getProductcode()); + response.put("pd", GeneralDescriptions.getProductdesc(tgeneSolicitude.getModulecode(), + tgeneSolicitude.getProductcode())); + response.put("s", tgeneSolicitude.getSubproductcode()); + response.put("sd", GeneralDescriptions.getSubProductdesc(tgeneSolicitude.getModulecode(), + tgeneSolicitude.getProductcode(), tgeneSolicitude.getSubproductcode())); + response.put("c", tgeneSolicitude.getCurrencycode()); + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/InfoDataFile.java b/base/business/general/src/main/java/com/fp/general/rules/query/code/InfoDataFile.java new file mode 100644 index 0000000..1c9a207 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/InfoDataFile.java @@ -0,0 +1,43 @@ +package com.fp.general.rules.query.code; + +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Clase que se encarga de enviar la fecha de creacion y de vigencia de la firma + * @author scastillo + */ +public class InfoDataFile extends QueryRule { + + /** + * Metodo que envia la informacion de fechas del archivo + * @param pQueryRequest + * @return + * @throws Exception + */ + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query query = new Query(); + query.process(pQueryRequest); + List> infoImage = new ArrayList>(); + List dataImage = (List) response.get("TGENEFILESDETAIL"); + for (Object obj : dataImage) { + TgeneFilesDetail tgeneFilesDetail = (TgeneFilesDetail) obj; + Map map = new HashMap(); + map.put("datefrom", tgeneFilesDetail.getDatefrom().toString()); + map.put("dateto", tgeneFilesDetail.getPk().getDateto().toString()); + infoImage.add(map); + } + response.remove("TGENEFILESDETAIL"); + response.put("TGENEFILESDETAIL", infoImage); + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/LovAccount.java b/base/business/general/src/main/java/com/fp/general/rules/query/code/LovAccount.java new file mode 100644 index 0000000..2175fa8 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/LovAccount.java @@ -0,0 +1,103 @@ +package com.fp.general.rules.query.code; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.bpm.query.Query; +import com.fp.core.exception.CoreException; +import com.fp.dto.Response; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.acco.TgeneAccount; + +/** + * Clase que se encarga de obtener una lista de cuentas, que se utiliza en el lov de cuentas en las paginas. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class LovAccount extends QueryRule { + + /** + * Versin de la Clase + */ + private static final long serialVersionUID = 1L; + + /** Tabla */ + private static final String TGENEACCOUNT = "TGENEACCOUNT"; + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.QueryRule#process(com.fp.dto.query.QueryRequest) + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query query = new Query(); + query.process(pQueryRequest); + this.fillResponse(response, pQueryRequest); + return pQueryRequest; + } + + /** + * Metodo que construye la respuesta del lov de cuentas. + * + * @param pResponse Objeto que contiene los objetos de respuesta. + * @param pQueryRequest Peticion + * @throws Exception + */ + private void fillResponse(Response pResponse, QueryRequest pQueryRequest) throws Exception { + List> lresp = new ArrayList>(); + @SuppressWarnings("unchecked") + List lQuota = (List) pResponse.get(LovAccount.TGENEACCOUNT); + for (Object object : lQuota) { + TgeneAccount obj = (TgeneAccount) object; + Map m = new HashMap(); + if (obj.getPk().getAccount() == null) { + QueryBean qb = pQueryRequest.getBeans().get(LovAccount.TGENEACCOUNT); + if ((qb.getCriteriaValue("pk.account") != null) && (qb.getCriteriaValue("pk.company") != null) && !qb.isNotin("pk.account")) { + throw new CoreException("CORE-0007", "CUENTA NO EXISTE: {0} COMPANIA {1}", qb.getCriteriaValue("pk.account"), + qb.getCriteriaValue("pk.company")); + } + break; + } + m.put("pk_account", obj.getPk().getAccount()); + m.put("accountname", obj.getAccountname()); + m.put("currencycode", obj.getCurrencycode()); + m.put("pk_company", obj.getPk().getCompany()); + m.put("personcode", obj.getPersoncode()); + m.put("modulecode", obj.getModulecode()); + m.put("productcode", obj.getProductcode()); + m.put("subproductcode", obj.getSubproductcode()); + m.put("statuscode", obj.getAccountstatuscode()); + lresp.add(m); + } + this.checkData(lresp); + pResponse.remove(LovAccount.TGENEACCOUNT); + pResponse.put(LovAccount.TGENEACCOUNT, lresp); + } + + /** + * Verifica y completa la estructura en el caso que la tabla no tenga datos + * + * @param lresp + */ + private void checkData(List> lresp) { + if (lresp.isEmpty()) { + Map m = new HashMap(); + m.put("pk_account", null); + m.put("accountname", null); + m.put("currencycode", null); + m.put("pk_company", null); + m.put("personcode", null); + m.put("modulecode", null); + m.put("productcode", null); + m.put("subproductcode", null); + lresp.add(m); + } + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/LovCustomer.java b/base/business/general/src/main/java/com/fp/general/rules/query/code/LovCustomer.java new file mode 100644 index 0000000..7a62211 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/LovCustomer.java @@ -0,0 +1,91 @@ +package com.fp.general.rules.query.code; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.common.helper.Constant; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.GeneralQuery; +import com.fp.persistence.commondb.PersistenceHelper; + +/** + * Clase que se encarga de enviar solo los datos necesarios del cliente + * + * @author scastillo + */ +@SuppressWarnings("serial") +public class LovCustomer extends QueryRule { + + /** + * JPQL que obtiene informacion de personas + */ + private static final String JPQL_CUSTOMER = "select t.personcode, persontypecatalog,identification,name," + + " (select cd.description from TgeneCatalogDetail cd " + " where cd.catalogcode = t.identificationcatalogcode " + + " and cd.catalog = t.identificationcatalog " + " ) as identificationdesc, " + + " (select photocode from TcustPeople tp" + " where tp.personcode = t.personcode " + + " and tp.dateto = t.dateto " + " ) as photocode " + " from TcustPersonDetail t " + " where t.dateto = :dateto "; + + /** + * Metodo que construye la respuesta solo con los datos necesarios + * + * @param pQueryRequest QueryRequest + * @return pQueryRequest QueryRequest + * @throws Exception + */ + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + QueryBean qb = (QueryBean) pQueryRequest.get("TCUSTPERSONDETAILLOV"); + + String[] resp = CriteriaValidator.validatePercentage(qb); + if (resp[0].compareTo("0") == 0) { + throw new GeneralException("GENE-0043", "EL CRITERIO DE BSQUEDA --> {0} NO ES SUFICIENTE", resp[1]); + } + + Map mcriteria = new HashMap(); + + StringBuilder jpql = new StringBuilder(); + jpql.append(LovCustomer.JPQL_CUSTOMER); + GeneralQuery.addParameters(qb, jpql, mcriteria, true); + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(String.valueOf(jpql)); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + GeneralQuery.setParameters(qb, mcriteria, qry); + List ldata = qry.getResultList(); + + List> lfinal = new ArrayList>(); + if ((ldata != null) && (!ldata.isEmpty())) { + for (Object[] obj : ldata) { + Map m = new HashMap(); + m.put("pk_personcode", obj[0]); + m.put("persontypecatalog", obj[1]); + m.put("identification", obj[2]); + m.put("name", obj[3]); + m.put("identificationdesc", obj[4]); + m.put("photocode", obj[5]); + lfinal.add(m); + } + } else { + if (qb.getPage() == 1) { + Map m = new HashMap(); + m.put("pk_personcode", null); + m.put("persontypecatalog", null); + m.put("identification", null); + m.put("name", null); + m.put("identificationdesc", null); + m.put("photocode", null); + lfinal.add(m); + } + } + + pQueryRequest.getResponse().put("TCUSTPERSONDETAILLOV", lfinal); + + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/LovCustomerMulti.java b/base/business/general/src/main/java/com/fp/general/rules/query/code/LovCustomerMulti.java new file mode 100644 index 0000000..734bf30 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/LovCustomerMulti.java @@ -0,0 +1,105 @@ +package com.fp.general.rules.query.code; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.common.helper.Constant; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.GeneralQuery; +import com.fp.persistence.commondb.PersistenceHelper; + +/** + * Clase que se encarga de enviar los datos necesarios de clientes + * + * @author jarias + * + */ +public class LovCustomerMulti extends QueryRule { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * JPQL que obtiene informacion de personas + */ + private static final String JPQL_CUSTOMER = "select t.personcode, persontypecatalog,identification,name," + + " (select cd.description from TgeneCatalogDetail cd " + " where cd.catalogcode = t.identificationcatalogcode " + + " and cd.catalog = t.identificationcatalog " + " ) as identificationdesc, " + + " (select photocode from TcustPeople tp" + " where tp.personcode = t.personcode " + + " and tp.dateto = t.dateto " + " ) as photocode " + " from TcustPersonDetail t " + " where t.dateto = :dateto "; + + /** + * Metodo que construye la respuesta solo con los datos necesarios + * + * @param pQueryRequest QueryRequest + * @return pQueryRequest QueryRequest + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + // TODO Auto-generated method stub + QueryBean qb = (QueryBean) pQueryRequest.get("TCUSTPERSONDETAILLOVMULTI"); + List> lfinalresult = new ArrayList>(); + lfinalresult = this.resultPersons(qb); + pQueryRequest.getResponse().put("TCUSTPERSONDETAILLOVMULTI", lfinalresult); + return pQueryRequest; + } + + /** + * Mtodo que retorna la busqueda de las personas + * + * @param qb QueryBean + * @return lfinal lista que contiene los clienets consultados + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List> resultPersons(QueryBean qb) throws Exception { + String[] resp = CriteriaValidator.validatePercentage(qb); + if (resp[0].compareTo("0") == 0) { + throw new GeneralException("GENE-0043", "EL CRITERIO DE BSQUEDA --> {0} NO ES SUFICIENTE", resp[1]); + } + List> lfinal = new ArrayList>(); + Map mcriteria = new HashMap(); + StringBuilder jpql = new StringBuilder(); + jpql.append(LovCustomerMulti.JPQL_CUSTOMER); + GeneralQuery.addParameters(qb, jpql, mcriteria, true); + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(String.valueOf(jpql)); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + GeneralQuery.setParameters(qb, mcriteria, qry); + List ldata = qry.getResultList(); + + if ((ldata != null) && (!ldata.isEmpty())) { + for (Object[] obj : ldata) { + Map m = new HashMap(); + m.put("pk_personcode", obj[0]); + m.put("persontypecatalog", obj[1]); + m.put("identification", obj[2]); + m.put("name", obj[3]); + m.put("identificationdesc", obj[4]); + m.put("photocode", obj[5]); + lfinal.add(m); + } + } else { + if (qb.getPage() == 1) { + Map m = new HashMap(); + m.put("pk_personcode", null); + m.put("persontypecatalog", null); + m.put("identification", null); + m.put("name", null); + m.put("identificationdesc", null); + m.put("photocode", null); + lfinal.add(m); + } + } + return lfinal; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/LovOfficial.java b/base/business/general/src/main/java/com/fp/general/rules/query/code/LovOfficial.java new file mode 100644 index 0000000..9a5eda8 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/LovOfficial.java @@ -0,0 +1,71 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.general.rules.query.code; + +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.GeneralQuery; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.persistence.Query; + +/** + * + * @author BPTWPA + */ +public class LovOfficial extends QueryRule { + + private static final long serialVersionUID = 1L; + /** + * JPQL que presenta los funcionarions del BEV + */ + private static final String JPQL_OFFICIAL = "from TcustPersonDetail t " + + "where t.pk.personcode in (" + + "select f.pk.personcode " + + "from TcustPeopleJob f " + + "where f.employerpersoncode = :bevcode " + + "and f.pk.dateto = :datetojob " + + "and f.departuredate = null)"; + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + StringBuilder jpql = new StringBuilder(); + QueryBean qb = (QueryBean) pQueryRequest.get("OFFICIALLOV"); + Map mcriteria = new HashMap(); + TgeneParametersKey tgeneParametersKey = new TgeneParametersKey("BEVCODE", Integer.valueOf(pQueryRequest.get("COMPANY").toString())); + TgeneParameters tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), tgeneParametersKey); + if (tgeneParameters.getNumbervalue() == null) { + return pQueryRequest; + } + jpql.append(LovOfficial.JPQL_OFFICIAL); + GeneralQuery.addParameters(qb, jpql, mcriteria); + Query qry = PersistenceHelper.getEntityManager().createQuery(String.valueOf(jpql)); + qry.setParameter("datetojob", FormatDates.getDefaultExpiryTimestamp()); + qry.setParameter("bevcode", Integer.valueOf(tgeneParameters.getNumbervalue().intValue())); + GeneralQuery.setParameters(qb, mcriteria, qry); + List ldata = qry.getResultList(); + if (!ldata.isEmpty()) { + List> lresp = new ArrayList>(); + for (TcustPersonDetail obj : ldata) { + Map m = new HashMap(); + m.put("pk.personcode", obj.getPk().getPersoncode()); + m.put("pk.dateto", obj.getPk().getDateto()); + m.put("identification", obj.getIdentification()); + m.put("name", obj.getName()); + lresp.add(m); + } + pQueryRequest.getResponse().put("OFFICIALLOV", lresp); + } + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/ModuleDesc.java b/base/business/general/src/main/java/com/fp/general/rules/query/code/ModuleDesc.java new file mode 100644 index 0000000..8fc1a14 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/ModuleDesc.java @@ -0,0 +1,46 @@ +package com.fp.general.rules.query.code; + +import java.util.List; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.installment.TgeneInstallmentType; + +/** + * Clase que se encarga de completar la descripcion del modulo, dado su codigo. + * + * @author Wilson Sigcho + * @version 2.1 + */ +public class ModuleDesc extends QueryRule { + + /** + * Metodo que agrega la descripcion de un modulo, dado su codigo en una consulta requerida. + * + * @param pQueryRequest Objeto que posee la consulta requerida. + * @return pQueryRequest + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List lobjects = (List) response.get("TGENEINSTALLMENTTYPE"); + if (lobjects == null) { + return pQueryRequest; + } + for (Object obj : lobjects) { + TgeneInstallmentType tgeneInstallmentType = (TgeneInstallmentType) obj; + if (tgeneInstallmentType.getPk().getModulecode() != null) { + tgeneInstallmentType.addAddtionalInfo("moduledesc", GeneralDescriptions.getModuledesc(tgeneInstallmentType.getPk().getModulecode())); + } else { + tgeneInstallmentType.addAddtionalInfo("moduledesc", null); + } + } + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/SubProductDesc.java b/base/business/general/src/main/java/com/fp/general/rules/query/code/SubProductDesc.java new file mode 100644 index 0000000..d459c13 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/SubProductDesc.java @@ -0,0 +1,49 @@ +package com.fp.general.rules.query.code; + +import java.util.List; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.product.TgeneSubProduct; + +/** + * Clase que se encarga de completar descripcion del modulo, producto, y subproducto, dado un codigo de query alias. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class SubProductDesc extends QueryRule { + + /** + * Metodo que completa descripciones de modulo, producto y sub producto. + */ + @Override + @SuppressWarnings("unchecked") + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List lobjects = (List) response.get("TGENESUBPRODUCT"); + if (lobjects == null) { + return pQueryRequest; + } + for (Object obj : lobjects) { + TgeneSubProduct subprod = (TgeneSubProduct) obj; + if (subprod.getPk().getModulecode() == null) { + continue; + } + // module descripion + subprod.addAddtionalInfo("moduledesc", GeneralDescriptions.getModuledesc(subprod.getPk().getModulecode())); + // product description + subprod.addAddtionalInfo("productdesc", + GeneralDescriptions.getProductdesc(subprod.getPk().getModulecode(), subprod.getPk().getProductcode())); + // subproduct description + subprod.addAddtionalInfo("subproductdesc", GeneralDescriptions.getSubProductdesc(subprod.getPk().getModulecode(), subprod.getPk() + .getProductcode(), subprod.getPk().getSubproductcode())); + } + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/code/VerifyClientData.java b/base/business/general/src/main/java/com/fp/general/rules/query/code/VerifyClientData.java new file mode 100644 index 0000000..bc32bd4 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/code/VerifyClientData.java @@ -0,0 +1,128 @@ +package com.fp.general.rules.query.code; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.SQLQuery; +import org.hibernate.ScrollableResults; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.general.db.DataHelper; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.auth.TgeneSolicitudeClientdata; + +/** + * Clase que se encarga de consultar los valores para verificar los clientes de una solicitud + * + * @author scastillo + */ +public class VerifyClientData extends QueryRule { + + String transactionmodule; + + Integer transactioncode; + + String solicitudnumber; + + Integer solicitudsequence; + + Integer personcode; + + String module; + + String productcode; + + String subproductcode; + + String persontype; + + String relationshipcode; + + /** + * Sentencia SQL para obtener los datos de la pgina a cargar + */ + private static final String SQL = "select tgt.TITLE t, tgt.PAGE p, tgt.QUERYFUNCTION q, tgt.SAVEFUNCTION s" + " from TGENETRANSACTIONPAGES tgt" + + " where tgt.TRANSACTIONMODULE = :transactionmodule" + " and tgt.TRANSACTIONCODE = :transactioncode and tgt.ACTIVE='Y' " + + " and tgt.TITLE in (select tgs.title" + " from TGENESOLICITUDECLIENTDATA tgs" + + " where tgs.SOLICITUDNUMBER = :solicitudnumber" + + " and tgs.SOLICITUDSEQUENCE = :solicitudsequence" + " and tgs.PERSONCODE = :personcode)"; + + /** + * Metodo que se encarga de + * + * @param pQueryRequest + * @return + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + this.transactionmodule = (String) pQueryRequest.get("transactionmodule"); + this.transactioncode = (Integer) pQueryRequest.get("transactioncode"); + this.solicitudnumber = (String) pQueryRequest.get("solicitudnumber"); + this.solicitudsequence = (Integer) pQueryRequest.get("solicitudsequence"); + this.personcode = (Integer) pQueryRequest.get("personcode"); + this.module = (String) pQueryRequest.get("module"); + this.productcode = (String) pQueryRequest.get("productcode"); + this.subproductcode = (String) pQueryRequest.get("subproductcode"); + this.persontype = (String) pQueryRequest.get("persontype"); + this.relationshipcode = (String) pQueryRequest.get("relationshipcode"); + response.put("transactions", this.getTransactionInfo()); + return pQueryRequest; + } + + /** + * Metodo que ejecuta la sentencia sql para obtener los datos de la base de datos + * + * @param pQueryRequest + * @return + * @throws Exception + */ + private ScrollableResults executeQuery() throws Exception { + ScrollableResults rSet = null; + SQLQuery sql = PersistenceHelper.getSession().createSQLQuery(VerifyClientData.SQL); + sql.setString("transactionmodule", this.transactionmodule); + sql.setInteger("transactioncode", this.transactioncode); + sql.setString("solicitudnumber", this.solicitudnumber); + sql.setInteger("solicitudsequence", this.solicitudsequence); + sql.setInteger("personcode", this.personcode); + rSet = sql.scroll(); + return rSet; + } + + /** + * Metodo que se encarga de armar la estructura para la verificacion de clientes + * + * @return + * @throws Exception + */ + private List> getTransactionInfo() throws Exception { + ScrollableResults rSet = null; + List> ldata = new ArrayList>(); + try { + rSet = this.executeQuery(); + while (rSet.next()) { + Object[] obj = rSet.get(); + Map mData = new HashMap(); + mData.put("t", obj[0]);// titulo + mData.put("p", obj[1]);// pagina + mData.put("q", obj[2]);// funcion query + mData.put("s", obj[3]);// funcion save + TgeneSolicitudeClientdata tgeneSolicitudeClientdata = DataHelper.getInstance().getTgeneSolicitudeClientdata(this.solicitudnumber, + this.solicitudsequence, (String) obj[0], this.personcode); + mData.put("r", tgeneSolicitudeClientdata.getRecordversion());// Record version + mData.put("c", tgeneSolicitudeClientdata.getChecked());// Checked + mData.put("o", tgeneSolicitudeClientdata.getPresentationorder());// Orden + mData.put("m", "N"); + ldata.add(mData); + } + } finally { + rSet.close(); + } + return ldata; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/trans/.svn/entries b/base/business/general/src/main/java/com/fp/general/rules/query/trans/.svn/entries new file mode 100644 index 0000000..024d156 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/trans/.svn/entries @@ -0,0 +1,99 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/rules/query/trans +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +panel +dir + +ObtainTechnicalPatrimony.java +file + + + + +2022-07-28T03:40:43.643807Z +6914dc9be49f7854754d519f630579c8 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5217 + +ProductsByClient.java +file + + + + +2022-07-28T03:40:43.643807Z +21b77829579fdbbcc52f1bdce1fe15d0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9978 + diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/trans/.svn/text-base/ObtainTechnicalPatrimony.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/trans/.svn/text-base/ObtainTechnicalPatrimony.java.svn-base new file mode 100644 index 0000000..c102f77 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/trans/.svn/text-base/ObtainTechnicalPatrimony.java.svn-base @@ -0,0 +1,114 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.general.rules.query.trans; + +import java.sql.Date; +import java.util.List; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import com.fp.common.helper.Constant; +import com.fp.dto.Response; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pcustomer.balance.TcustPersonBalance; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; + +/** + *Clase que genera el patrimonio tecnico de una persona dado su codigo + * @author hinga + */ +public class ObtainTechnicalPatrimony extends QueryRule { + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + com.fp.bpm.query.Query query = new com.fp.bpm.query.Query(); + query.process(pQueryRequest); + QueryBean queryBean = (QueryBean) pQueryRequest.get("TCUSTPERSONDETAIL"); + TcustPersonDetail tcustPersonDetail = (TcustPersonDetail) response.get("TCUSTPERSONDETAIL"); + Integer personcode = Integer.valueOf(queryBean.getCriteriaValue("pk.personcode").toString()); + TcustPersonBalance tcustPersonBalance = this.getBalancePerPerson(personcode); + if (tcustPersonBalance != null) { + Object patri = this.getPatrimony(personcode, tcustPersonBalance.getPk().getBalancedate(), tcustPersonBalance.getPk().getBalancecatalog()); + tcustPersonDetail.addAddtionalInfo("patrimony", patri); + } else { + tcustPersonDetail.addAddtionalInfo("patrimony", 0); + } + + return pQueryRequest; + } + /** Sentencia que devuelve el balance dado el cdigo de persona.*/ + public static final String JPQL_BALANCE_PER_PERSON = "from TcustPersonBalance p where p.pk.personcode = :personcode " + + "and p.statuscatalog = '1' " + + "and p.pk.dateto = :dateto " + + "and p.pk.balancedate = (select max(c.pk.balancedate) from TcustPersonBalance c where c.pk.personcode = p.pk.personcode and c.statuscatalog = '1' and p.pk.dateto = c.pk.dateto)"; + + /** + * Metodo que entrega un balance dado un codigo de persona. + * @param personcode Codigo de la persona + * @return TcustPersonBalance + */ + public TcustPersonBalance getBalancePerPerson(Integer personcode) throws Exception { + TcustPersonBalance tcustPersonBalance = null; + Query qry = PersistenceHelper.getEntityManager().createQuery(ObtainTechnicalPatrimony.JPQL_BALANCE_PER_PERSON); + qry.setParameter("personcode", personcode); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + List tBalance = qry.getResultList(); + if (!tBalance.isEmpty()) { + tcustPersonBalance = (TcustPersonBalance)tBalance.get(0); + } + return tcustPersonBalance; + } + + /**Sentencia que devuelve el patrimonio tcnico del ltimo balance del tipo BG */ + public static final String HQL_TECHNICAL_PATRIMONY_BG = "select sum(t.valueaccount) " + + "from TcustBalanceFinancial t" + + " where t.pk.personcode = :pPersonCode " + + "and t.pk.dateto = :pDateto " + + "and t.pk.balancecatalog = :pBalancecatalog " + + "and t.pk.balancecatalogcode = 'BALANCETYPE' " + + "and t.pk.accountcode in ('51','52','53','54','55','56','57','58') " + + "and t.pk.balancedate = :pBalancedate"; + + /**Sentencia que devuelve el patrimonio tcnico del ltimo balance del tipo IFI */ + public static final String HQL_TECHNICAL_PATRIMONY_IFIS = "select t.valueaccount " + + "from TcustBalanceFinancial t " + + "where t.pk.personcode = :pPersonCode " + + "and t.pk.dateto = :pDateto " + + "and t.pk.balancecatalog = :pBalancecatalog " + + "and t.pk.balancecatalogcode = 'BALANCETYPE' " + + "and t.pk.accountcode = '3' " + + "and t.pk.balancedate = :pBalancedate"; + + /** + * + * @param personcode Cdigo de la persona + * @param balanceDate Date balanceDate + * @return Object + * @throws Exception + */ + public Object getPatrimony(Integer personcode, Date balanceDate, String balanceCatalog) throws Exception { + Query qry = null; + Object obj = null; + if (balanceCatalog.compareTo("BG") == 0) { + qry = PersistenceHelper.getEntityManager().createQuery(ObtainTechnicalPatrimony.HQL_TECHNICAL_PATRIMONY_BG); + } else if (balanceCatalog.compareTo("BG(IFIS)") == 0) { + qry = PersistenceHelper.getEntityManager().createQuery(ObtainTechnicalPatrimony.HQL_TECHNICAL_PATRIMONY_IFIS); + } + qry.setParameter("pPersonCode", personcode); + qry.setParameter("pDateto", Constant.getDefaultExpiryTimestamp()); + qry.setParameter("pBalancecatalog", balanceCatalog); + qry.setParameter("pBalancedate", balanceDate); + try { + obj = qry.getSingleResult(); + } catch (NoResultException e) { + } + return obj; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/trans/.svn/text-base/ProductsByClient.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/trans/.svn/text-base/ProductsByClient.java.svn-base new file mode 100644 index 0000000..23e2ba4 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/trans/.svn/text-base/ProductsByClient.java.svn-base @@ -0,0 +1,218 @@ +package com.fp.general.rules.query.trans; + +import com.fp.common.helper.Constant; +import com.fp.persistence.pgeneral.product.TgeneProduct; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; +import com.fp.persistence.pgeneral.acco.TgeneAccount; +import com.fp.persistence.pgeneral.acco.TgeneAccountStatus; +import com.fp.persistence.pgeneral.acco.TgeneAccountStatusKey; +import com.fp.persistence.pgeneral.gene.TgeneBranch; +import com.fp.persistence.pgeneral.gene.TgeneBranchKey; +import com.fp.persistence.pgeneral.gene.TgeneCurrency; +import com.fp.persistence.pgeneral.gene.TgeneOffice; +import com.fp.persistence.pgeneral.gene.TgeneOfficeKey; +import com.fp.persistence.pgeneral.product.TgeneModule; +import com.fp.persistence.pgeneral.product.TgeneProductKey; +import com.fp.persistence.pgeneral.product.TgeneSubProduct; +import com.fp.persistence.pgeneral.product.TgeneSubProductKey; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import javax.persistence.Query; + +public class ProductsByClient extends QueryRule { + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + QueryBean queryBean = (QueryBean) pQueryRequest.get("TCUSTPERSONDETAIL"); + Integer personcode = Integer.valueOf(queryBean.getCriteriaValue("pk.personcode").toString()); + List ldata = TgeneAccount.find(PersistenceHelper.getEntityManager(), pQueryRequest.getCompany(), personcode); + this.fillResponse(response, pQueryRequest.getUser(), ldata); + return pQueryRequest; + } + + private void fillResponse(Response response, String usercode, List ldata) throws Exception { + List> lresult = new ArrayList>(); + for (TgeneAccount obj : ldata) { + Map m = this.processBYAccount(obj, usercode); + lresult.add(m); + } + response.put("datos", lresult); + } + + private Map processBYAccount(TgeneAccount tgeneAccount, String usercode) throws Exception { + Map m = new HashMap(); + m.put("branch", this.getBranchName(tgeneAccount)); //nombre de la sucursal + m.put("office", this.getOfficeName(tgeneAccount)); //nombre de la oficiana + m.put("descmodule", this.getModuleName(tgeneAccount)); //nombre del mdulo + m.put("product", this.getProductName(tgeneAccount)); //nombre del producto + m.put("subproduct", this.getSubProductName(tgeneAccount)); //nombre del subproducto + m.put("currency", this.getCurrencyName(tgeneAccount)); //nombre de la moneda + m.put("executive", this.getExecutiveName(tgeneAccount, usercode)); //nombre del ejecutivo + m.put("operation", tgeneAccount.getPk().getAccount()); //nmeo de operacin + m.put("operationstatus", tgeneAccount.getAccountstatuscode()); //cdigo de estado de operacin + TgeneAccountStatusKey tgeneAccountStatusKey = new TgeneAccountStatusKey(tgeneAccount.getModulecode(), tgeneAccount.getAccountstatuscode()); + TgeneAccountStatus tgeneAccountStatus = TgeneAccountStatus.find(PersistenceHelper.getEntityManager(), tgeneAccountStatusKey); + m.put("operationdesc", tgeneAccountStatus.getDescription()); //cdigo de estado de operacin + m.put("account", tgeneAccount.getPk().getAccount()); //numero de cuenta + m.put("company", tgeneAccount.getPk().getCompany()); //numero de compania + m.put("module", tgeneAccount.getModulecode()); //numero de mdulo + return m; + } + + /** + * Metodo que entrega el nombre de la sucursal a la que pertenece la cuenta. + * + * @param tgeneAccount Datos generales de la cuenta. + * @return String + * @throws Exception + */ + private String getBranchName(TgeneAccount tgeneAccount) throws Exception { + String branch = ""; + if (tgeneAccount.getBranchcode() != null && tgeneAccount.getPk().getCompany() != null) { + TgeneBranchKey key = new TgeneBranchKey(tgeneAccount.getBranchcode(), tgeneAccount.getPk().getCompany()); + if (key != null) { + TgeneBranch b = TgeneBranch.find(PersistenceHelper.getEntityManager(), key); + branch = b.getDescription(); + } + } + return branch; + } + + /** + * Metodo que entrega el nombre de la oficina a la que pertenece la cuenta. + * + * @param tgeneAccount Datos generales de la cuenta. + * @return String + * @throws Exception + */ + private String getOfficeName(TgeneAccount tgeneAccount) throws Exception { + String office = ""; + if (tgeneAccount.getOfficecode() != null && tgeneAccount.getBranchcode() != null && tgeneAccount.getPk().getCompany() != null) { + TgeneOfficeKey key = new TgeneOfficeKey(tgeneAccount.getOfficecode(), tgeneAccount.getBranchcode(), tgeneAccount.getPk().getCompany()); + if (key != null) { + TgeneOffice o = TgeneOffice.find(PersistenceHelper.getEntityManager(), key); + office = o.getDescription(); + } + } + return office; + } + + /** + * Metodo que entrega el nombre del mdulo a la que pertenece la cuenta. + * + * @param tgeneAccount Datos generales de la cuenta. + * @return String + * @throws Exception + */ + private String getModuleName(TgeneAccount tgeneAccount) throws Exception { + String modul = ""; + if (tgeneAccount.getModulecode() != null) { + TgeneModule mo = TgeneModule.find(PersistenceHelper.getEntityManager(), tgeneAccount.getModulecode()); + modul = mo.getDescription(); + } + return modul; + } + + /** + * Metodo que entrega el nombre del producto a la que pertenece la cuenta. + * + * @param tgeneAccount Datos generales de la cuenta. + * @return String + * @throws Exception + */ + private String getProductName(TgeneAccount tgeneAccount) throws Exception { + String product = ""; + if (tgeneAccount.getModulecode() != null && tgeneAccount.getProductcode() != null) { + TgeneProductKey key = new TgeneProductKey(tgeneAccount.getModulecode(), tgeneAccount.getProductcode()); + if (key != null) { + TgeneProduct p = TgeneProduct.find(PersistenceHelper.getEntityManager(), key); + product = p.getDescription(); + } + } + return product; + } + + /** + * Metodo que entrega el nombre del subproducto a la que pertenece la + * cuenta. + * + * @param tgeneAccount Datos generales de la cuenta. + * @return String + * @throws Exception + */ + private String getSubProductName(TgeneAccount tgeneAccount) throws Exception { + String subprod = ""; + if (tgeneAccount.getModulecode() != null && tgeneAccount.getProductcode() != null && tgeneAccount.getSubproductcode() != null) { + TgeneSubProductKey key = new TgeneSubProductKey(tgeneAccount.getModulecode(), tgeneAccount.getProductcode(), tgeneAccount.getSubproductcode()); + if (key != null) { + TgeneSubProduct sp = TgeneSubProduct.find(PersistenceHelper.getEntityManager(), key); + subprod = sp.getDescription(); + } + } + return subprod; + } + + /** + * Metodo que entrega el nombre de la moneda a la que pertenece la cuenta. + * + * @param tgeneAccount Datos generales de la cuenta. + * @return String + * @throws Exception + */ + private String getCurrencyName(TgeneAccount tgeneAccount) throws Exception { + String curre = ""; + if (tgeneAccount.getCurrencycode() != null) { + TgeneCurrency c = TgeneCurrency.find(PersistenceHelper.getEntityManager(), tgeneAccount.getCurrencycode()); + curre = c.getDescription(); + } + return curre; + } + + /** + * Metodo que entrega el nombre del ejecutivo a la que pertenece la cuenta. + * + * @param tgeneAccount Datos generales de la cuenta. + * @param response + * @return + * @throws Exception + */ + private String getExecutiveName(TgeneAccount tgeneAccount, String usercode) throws Exception { + TsafeUserDetail ud = null; + String nombExecuti = ""; + String sql = "from TsafeUserDetail t" + + " where t.pk.usercode = :usercode" + + " and t.pk.personcode = :personcode" + + " and t.pk.dateto = :dateto" + + " and t.officecode = :officecode"; + if (usercode != null && tgeneAccount.getPersoncode() != null && tgeneAccount.getOfficecode() != null) { + Query qry = PersistenceHelper.getEntityManager().createQuery(sql); + qry.setParameter("usercode", usercode); + qry.setParameter("personcode", tgeneAccount.getPersoncode()); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + qry.setParameter("officecode", tgeneAccount.getOfficecode()); + List obj = qry.getResultList(); + if (obj.size() > 0) { + ud = (TsafeUserDetail) obj.get(0); + } + if (ud != null) { + TcustPersonDetailKey personKey = new TcustPersonDetailKey(ud.getPk().getPersoncode(), Constant.getDefaultExpiryTimestamp()); + if (personKey != null) { + TcustPersonDetail ex = TcustPersonDetail.find(PersistenceHelper.getEntityManager(), personKey); + nombExecuti = ex.getName(); + } + } + } + return nombExecuti; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/trans/ObtainTechnicalPatrimony.java b/base/business/general/src/main/java/com/fp/general/rules/query/trans/ObtainTechnicalPatrimony.java new file mode 100644 index 0000000..c102f77 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/trans/ObtainTechnicalPatrimony.java @@ -0,0 +1,114 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.general.rules.query.trans; + +import java.sql.Date; +import java.util.List; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import com.fp.common.helper.Constant; +import com.fp.dto.Response; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pcustomer.balance.TcustPersonBalance; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; + +/** + *Clase que genera el patrimonio tecnico de una persona dado su codigo + * @author hinga + */ +public class ObtainTechnicalPatrimony extends QueryRule { + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + com.fp.bpm.query.Query query = new com.fp.bpm.query.Query(); + query.process(pQueryRequest); + QueryBean queryBean = (QueryBean) pQueryRequest.get("TCUSTPERSONDETAIL"); + TcustPersonDetail tcustPersonDetail = (TcustPersonDetail) response.get("TCUSTPERSONDETAIL"); + Integer personcode = Integer.valueOf(queryBean.getCriteriaValue("pk.personcode").toString()); + TcustPersonBalance tcustPersonBalance = this.getBalancePerPerson(personcode); + if (tcustPersonBalance != null) { + Object patri = this.getPatrimony(personcode, tcustPersonBalance.getPk().getBalancedate(), tcustPersonBalance.getPk().getBalancecatalog()); + tcustPersonDetail.addAddtionalInfo("patrimony", patri); + } else { + tcustPersonDetail.addAddtionalInfo("patrimony", 0); + } + + return pQueryRequest; + } + /** Sentencia que devuelve el balance dado el cdigo de persona.*/ + public static final String JPQL_BALANCE_PER_PERSON = "from TcustPersonBalance p where p.pk.personcode = :personcode " + + "and p.statuscatalog = '1' " + + "and p.pk.dateto = :dateto " + + "and p.pk.balancedate = (select max(c.pk.balancedate) from TcustPersonBalance c where c.pk.personcode = p.pk.personcode and c.statuscatalog = '1' and p.pk.dateto = c.pk.dateto)"; + + /** + * Metodo que entrega un balance dado un codigo de persona. + * @param personcode Codigo de la persona + * @return TcustPersonBalance + */ + public TcustPersonBalance getBalancePerPerson(Integer personcode) throws Exception { + TcustPersonBalance tcustPersonBalance = null; + Query qry = PersistenceHelper.getEntityManager().createQuery(ObtainTechnicalPatrimony.JPQL_BALANCE_PER_PERSON); + qry.setParameter("personcode", personcode); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + List tBalance = qry.getResultList(); + if (!tBalance.isEmpty()) { + tcustPersonBalance = (TcustPersonBalance)tBalance.get(0); + } + return tcustPersonBalance; + } + + /**Sentencia que devuelve el patrimonio tcnico del ltimo balance del tipo BG */ + public static final String HQL_TECHNICAL_PATRIMONY_BG = "select sum(t.valueaccount) " + + "from TcustBalanceFinancial t" + + " where t.pk.personcode = :pPersonCode " + + "and t.pk.dateto = :pDateto " + + "and t.pk.balancecatalog = :pBalancecatalog " + + "and t.pk.balancecatalogcode = 'BALANCETYPE' " + + "and t.pk.accountcode in ('51','52','53','54','55','56','57','58') " + + "and t.pk.balancedate = :pBalancedate"; + + /**Sentencia que devuelve el patrimonio tcnico del ltimo balance del tipo IFI */ + public static final String HQL_TECHNICAL_PATRIMONY_IFIS = "select t.valueaccount " + + "from TcustBalanceFinancial t " + + "where t.pk.personcode = :pPersonCode " + + "and t.pk.dateto = :pDateto " + + "and t.pk.balancecatalog = :pBalancecatalog " + + "and t.pk.balancecatalogcode = 'BALANCETYPE' " + + "and t.pk.accountcode = '3' " + + "and t.pk.balancedate = :pBalancedate"; + + /** + * + * @param personcode Cdigo de la persona + * @param balanceDate Date balanceDate + * @return Object + * @throws Exception + */ + public Object getPatrimony(Integer personcode, Date balanceDate, String balanceCatalog) throws Exception { + Query qry = null; + Object obj = null; + if (balanceCatalog.compareTo("BG") == 0) { + qry = PersistenceHelper.getEntityManager().createQuery(ObtainTechnicalPatrimony.HQL_TECHNICAL_PATRIMONY_BG); + } else if (balanceCatalog.compareTo("BG(IFIS)") == 0) { + qry = PersistenceHelper.getEntityManager().createQuery(ObtainTechnicalPatrimony.HQL_TECHNICAL_PATRIMONY_IFIS); + } + qry.setParameter("pPersonCode", personcode); + qry.setParameter("pDateto", Constant.getDefaultExpiryTimestamp()); + qry.setParameter("pBalancecatalog", balanceCatalog); + qry.setParameter("pBalancedate", balanceDate); + try { + obj = qry.getSingleResult(); + } catch (NoResultException e) { + } + return obj; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/trans/ProductsByClient.java b/base/business/general/src/main/java/com/fp/general/rules/query/trans/ProductsByClient.java new file mode 100644 index 0000000..23e2ba4 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/trans/ProductsByClient.java @@ -0,0 +1,218 @@ +package com.fp.general.rules.query.trans; + +import com.fp.common.helper.Constant; +import com.fp.persistence.pgeneral.product.TgeneProduct; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; +import com.fp.persistence.pgeneral.acco.TgeneAccount; +import com.fp.persistence.pgeneral.acco.TgeneAccountStatus; +import com.fp.persistence.pgeneral.acco.TgeneAccountStatusKey; +import com.fp.persistence.pgeneral.gene.TgeneBranch; +import com.fp.persistence.pgeneral.gene.TgeneBranchKey; +import com.fp.persistence.pgeneral.gene.TgeneCurrency; +import com.fp.persistence.pgeneral.gene.TgeneOffice; +import com.fp.persistence.pgeneral.gene.TgeneOfficeKey; +import com.fp.persistence.pgeneral.product.TgeneModule; +import com.fp.persistence.pgeneral.product.TgeneProductKey; +import com.fp.persistence.pgeneral.product.TgeneSubProduct; +import com.fp.persistence.pgeneral.product.TgeneSubProductKey; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import javax.persistence.Query; + +public class ProductsByClient extends QueryRule { + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + QueryBean queryBean = (QueryBean) pQueryRequest.get("TCUSTPERSONDETAIL"); + Integer personcode = Integer.valueOf(queryBean.getCriteriaValue("pk.personcode").toString()); + List ldata = TgeneAccount.find(PersistenceHelper.getEntityManager(), pQueryRequest.getCompany(), personcode); + this.fillResponse(response, pQueryRequest.getUser(), ldata); + return pQueryRequest; + } + + private void fillResponse(Response response, String usercode, List ldata) throws Exception { + List> lresult = new ArrayList>(); + for (TgeneAccount obj : ldata) { + Map m = this.processBYAccount(obj, usercode); + lresult.add(m); + } + response.put("datos", lresult); + } + + private Map processBYAccount(TgeneAccount tgeneAccount, String usercode) throws Exception { + Map m = new HashMap(); + m.put("branch", this.getBranchName(tgeneAccount)); //nombre de la sucursal + m.put("office", this.getOfficeName(tgeneAccount)); //nombre de la oficiana + m.put("descmodule", this.getModuleName(tgeneAccount)); //nombre del mdulo + m.put("product", this.getProductName(tgeneAccount)); //nombre del producto + m.put("subproduct", this.getSubProductName(tgeneAccount)); //nombre del subproducto + m.put("currency", this.getCurrencyName(tgeneAccount)); //nombre de la moneda + m.put("executive", this.getExecutiveName(tgeneAccount, usercode)); //nombre del ejecutivo + m.put("operation", tgeneAccount.getPk().getAccount()); //nmeo de operacin + m.put("operationstatus", tgeneAccount.getAccountstatuscode()); //cdigo de estado de operacin + TgeneAccountStatusKey tgeneAccountStatusKey = new TgeneAccountStatusKey(tgeneAccount.getModulecode(), tgeneAccount.getAccountstatuscode()); + TgeneAccountStatus tgeneAccountStatus = TgeneAccountStatus.find(PersistenceHelper.getEntityManager(), tgeneAccountStatusKey); + m.put("operationdesc", tgeneAccountStatus.getDescription()); //cdigo de estado de operacin + m.put("account", tgeneAccount.getPk().getAccount()); //numero de cuenta + m.put("company", tgeneAccount.getPk().getCompany()); //numero de compania + m.put("module", tgeneAccount.getModulecode()); //numero de mdulo + return m; + } + + /** + * Metodo que entrega el nombre de la sucursal a la que pertenece la cuenta. + * + * @param tgeneAccount Datos generales de la cuenta. + * @return String + * @throws Exception + */ + private String getBranchName(TgeneAccount tgeneAccount) throws Exception { + String branch = ""; + if (tgeneAccount.getBranchcode() != null && tgeneAccount.getPk().getCompany() != null) { + TgeneBranchKey key = new TgeneBranchKey(tgeneAccount.getBranchcode(), tgeneAccount.getPk().getCompany()); + if (key != null) { + TgeneBranch b = TgeneBranch.find(PersistenceHelper.getEntityManager(), key); + branch = b.getDescription(); + } + } + return branch; + } + + /** + * Metodo que entrega el nombre de la oficina a la que pertenece la cuenta. + * + * @param tgeneAccount Datos generales de la cuenta. + * @return String + * @throws Exception + */ + private String getOfficeName(TgeneAccount tgeneAccount) throws Exception { + String office = ""; + if (tgeneAccount.getOfficecode() != null && tgeneAccount.getBranchcode() != null && tgeneAccount.getPk().getCompany() != null) { + TgeneOfficeKey key = new TgeneOfficeKey(tgeneAccount.getOfficecode(), tgeneAccount.getBranchcode(), tgeneAccount.getPk().getCompany()); + if (key != null) { + TgeneOffice o = TgeneOffice.find(PersistenceHelper.getEntityManager(), key); + office = o.getDescription(); + } + } + return office; + } + + /** + * Metodo que entrega el nombre del mdulo a la que pertenece la cuenta. + * + * @param tgeneAccount Datos generales de la cuenta. + * @return String + * @throws Exception + */ + private String getModuleName(TgeneAccount tgeneAccount) throws Exception { + String modul = ""; + if (tgeneAccount.getModulecode() != null) { + TgeneModule mo = TgeneModule.find(PersistenceHelper.getEntityManager(), tgeneAccount.getModulecode()); + modul = mo.getDescription(); + } + return modul; + } + + /** + * Metodo que entrega el nombre del producto a la que pertenece la cuenta. + * + * @param tgeneAccount Datos generales de la cuenta. + * @return String + * @throws Exception + */ + private String getProductName(TgeneAccount tgeneAccount) throws Exception { + String product = ""; + if (tgeneAccount.getModulecode() != null && tgeneAccount.getProductcode() != null) { + TgeneProductKey key = new TgeneProductKey(tgeneAccount.getModulecode(), tgeneAccount.getProductcode()); + if (key != null) { + TgeneProduct p = TgeneProduct.find(PersistenceHelper.getEntityManager(), key); + product = p.getDescription(); + } + } + return product; + } + + /** + * Metodo que entrega el nombre del subproducto a la que pertenece la + * cuenta. + * + * @param tgeneAccount Datos generales de la cuenta. + * @return String + * @throws Exception + */ + private String getSubProductName(TgeneAccount tgeneAccount) throws Exception { + String subprod = ""; + if (tgeneAccount.getModulecode() != null && tgeneAccount.getProductcode() != null && tgeneAccount.getSubproductcode() != null) { + TgeneSubProductKey key = new TgeneSubProductKey(tgeneAccount.getModulecode(), tgeneAccount.getProductcode(), tgeneAccount.getSubproductcode()); + if (key != null) { + TgeneSubProduct sp = TgeneSubProduct.find(PersistenceHelper.getEntityManager(), key); + subprod = sp.getDescription(); + } + } + return subprod; + } + + /** + * Metodo que entrega el nombre de la moneda a la que pertenece la cuenta. + * + * @param tgeneAccount Datos generales de la cuenta. + * @return String + * @throws Exception + */ + private String getCurrencyName(TgeneAccount tgeneAccount) throws Exception { + String curre = ""; + if (tgeneAccount.getCurrencycode() != null) { + TgeneCurrency c = TgeneCurrency.find(PersistenceHelper.getEntityManager(), tgeneAccount.getCurrencycode()); + curre = c.getDescription(); + } + return curre; + } + + /** + * Metodo que entrega el nombre del ejecutivo a la que pertenece la cuenta. + * + * @param tgeneAccount Datos generales de la cuenta. + * @param response + * @return + * @throws Exception + */ + private String getExecutiveName(TgeneAccount tgeneAccount, String usercode) throws Exception { + TsafeUserDetail ud = null; + String nombExecuti = ""; + String sql = "from TsafeUserDetail t" + + " where t.pk.usercode = :usercode" + + " and t.pk.personcode = :personcode" + + " and t.pk.dateto = :dateto" + + " and t.officecode = :officecode"; + if (usercode != null && tgeneAccount.getPersoncode() != null && tgeneAccount.getOfficecode() != null) { + Query qry = PersistenceHelper.getEntityManager().createQuery(sql); + qry.setParameter("usercode", usercode); + qry.setParameter("personcode", tgeneAccount.getPersoncode()); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + qry.setParameter("officecode", tgeneAccount.getOfficecode()); + List obj = qry.getResultList(); + if (obj.size() > 0) { + ud = (TsafeUserDetail) obj.get(0); + } + if (ud != null) { + TcustPersonDetailKey personKey = new TcustPersonDetailKey(ud.getPk().getPersoncode(), Constant.getDefaultExpiryTimestamp()); + if (personKey != null) { + TcustPersonDetail ex = TcustPersonDetail.find(PersistenceHelper.getEntityManager(), personKey); + nombExecuti = ex.getName(); + } + } + } + return nombExecuti; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/trans/panel/.svn/entries b/base/business/general/src/main/java/com/fp/general/rules/query/trans/panel/.svn/entries new file mode 100644 index 0000000..0e6e09c --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/trans/panel/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/rules/query/trans/panel +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ProductPanels.java +file + + + + +2022-07-28T03:40:43.595807Z +ae77e26adc1543b87249730dac05f34d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3960 + +TransactionPanels.java +file + + + + +2022-07-28T03:40:43.595807Z +a65a123f8ad4a283c89c00d3aefd6edc +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4054 + diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/trans/panel/.svn/text-base/ProductPanels.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/trans/panel/.svn/text-base/ProductPanels.java.svn-base new file mode 100644 index 0000000..6468f88 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/trans/panel/.svn/text-base/ProductPanels.java.svn-base @@ -0,0 +1,90 @@ +package com.fp.general.rules.query.trans.panel; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.common.helper.BeanManager; +import com.fp.persistence.commondb.HqlStatement; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.page.TgeneSubproductPages; + +/** + * Clase que se encarga de entregar una lista con las paginas a contruir paneles dinamicamente + * en la pantalla por subproducto. + * @author Jorge Vaca + * @version 2.1 + */ +public class ProductPanels extends QueryRule { + + /** + * Metodo que obtiene saldos promedio de una cuenta a la vista. + * @param pQueryRequest Datos de entrada de la consulta. + */ + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + List> lData = this.fillData(pQueryRequest); + response.put("PRODUCTPANELS", lData); + return pQueryRequest; + } + + /** + * Metodo que llena una lista con las paginas asociadas a un producto, transaccion. + * @param pQueryRequest Datos del request. + * @return List> + * @throws Exception + */ + private List> fillData(QueryRequest pQueryRequest) throws Exception { + List> lData = new ArrayList>(); + List lPages = this.getTgeneSubproductPages(pQueryRequest); + for (TgeneSubproductPages tgeneSubproductPages : lPages) { + Map m = new HashMap(); + m.put("cod", tgeneSubproductPages.getPk().getSequence()); + m.put("t", tgeneSubproductPages.getTitle()); + m.put("p", tgeneSubproductPages.getPage()); + m.put("q", tgeneSubproductPages.getQueryfunction()); + m.put("s", tgeneSubproductPages.getSavefunction()); + m.put("d", "N"); + m.put("down", tgeneSubproductPages.getAutodownload()); + lData.add(m); + } + lPages = null; + return lData; + } + + /** + * Metodo que entrega una lista de paginas a asociar en paneles en paginas. + * @param pQueryRequest Datos del request. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + private List getTgeneSubproductPages(QueryRequest pQueryRequest) throws Exception { + List lData = null; + HqlStatement hql = new HqlStatement(HQL); + hql.setString("module", (String) BeanManager.convertObject(pQueryRequest.get("module"), String.class)); + hql.setString("product", (String) BeanManager.convertObject(pQueryRequest.get("product"), String.class)); + hql.setString("subproduct", (String) BeanManager.convertObject(pQueryRequest.get("subproduct"), String.class)); + hql.setString("tmodule", pQueryRequest.getTransactionModule()); + hql.setInteger("tcode", pQueryRequest.getTransactionCode()); + hql.setInteger("tversion", pQueryRequest.getTransactionVersion()); + lData = hql.execute().getResultList(); + return lData; + } + /** + * Sentencia que entrega las paginas asociadas a un modulo, producto tipo. + */ + private static final String HQL = + " from TgeneSubproductPages t " + + " where t.pk.modulecode = :module " + + " and t.pk.productcode = :product " + + " and t.pk.subproductcode = :subproduct " + + " and t.pk.transactionmodule = :tmodule " + + " and t.pk.transactioncode = :tcode " + + " and t.pk.transactionversion = :tversion " + + " and coalesce(t.active,'N') = 'Y' " + + " order by t.presentationorder "; +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/trans/panel/.svn/text-base/TransactionPanels.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/query/trans/panel/.svn/text-base/TransactionPanels.java.svn-base new file mode 100644 index 0000000..63f5bfe --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/trans/panel/.svn/text-base/TransactionPanels.java.svn-base @@ -0,0 +1,98 @@ +package com.fp.general.rules.query.trans.panel; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.HqlStatement; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.page.TgeneTransactionPages; + +/** + * Clase que se encarga de entregar una lista con las paginas a contruir paneles dinamicamente + * en la pantalla. + * @author Jorge Vaca + * @version 2.1 + */ +public class TransactionPanels extends QueryRule { + + private String filterTitle; + + /** + * Metodo que obtiene saldos promedio de una cuenta a la vista. + * @param pQueryRequest Datos de entrada de la consulta. + */ + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + this.filterTitle = (String) pQueryRequest.get("filterTitle"); + List> lData = this.fillData(pQueryRequest); + response.put("TRANSPANELS", lData); + return pQueryRequest; + } + + /** + * Metodo que llena una lista de paginas asociadas a una transaccion. + * @param pQueryRequest Datos del request. + * @return List> + * @throws Exception + */ + private List> fillData(QueryRequest pQueryRequest) throws Exception { + List> lData = new ArrayList>(); + List lPages = this.getTgeneTransactionPages(pQueryRequest.getTransactionModule(), + pQueryRequest.getTransactionCode(), pQueryRequest.getTransactionVersion()); + for (TgeneTransactionPages tgeneTransactionPages : lPages) { + Map m = new HashMap(); + m.put("cod", tgeneTransactionPages.getPk().getSequence()); + m.put("t", tgeneTransactionPages.getTitle()); + m.put("p", tgeneTransactionPages.getPage()); + m.put("q", tgeneTransactionPages.getQueryfunction()); + m.put("s", tgeneTransactionPages.getSavefunction()); + m.put("d", "N"); + m.put("down", tgeneTransactionPages.getAutodownload()); + lData.add(m); + } + lPages = null; + return lData; + } + + /** + * Metodo que entrega una lista de paginas a asociar en paneles en paginas. + * @param pModule Codigo de modulo. + * @param pTransaction Codigo de transaccion. + * @param pVersion Version de la transaccion. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + private List getTgeneTransactionPages(String pModule, Integer pTransaction, Integer pVersion) throws Exception { + List lData = null; + String sentence = null; + if (this.filterTitle != null) { + sentence = HQL_HEADER + " and title " + this.filterTitle + " " + HQL_FOOTER; + } else { + sentence = HQL_HEADER + HQL_FOOTER; + } + HqlStatement hql = new HqlStatement(sentence); + hql.setString("module", pModule); + hql.setInteger("transaction", pTransaction); + hql.setInteger("version", pVersion); + lData = hql.execute().getResultList(); + return lData; + } + /** + * Sentencia cabecera que entrega las paginas asociadas a una transaccion. + */ + private static final String HQL_HEADER = + " from TgeneTransactionPages t " + + " where t.pk.transactionmodule = :module" + + " and t.pk.transactioncode = :transaction" + + " and t.pk.transactionversion = :version" + + " and coalesce(t.active,'N') = 'Y'"; + /** + * Sentencia cabecera que entrega las paginas asociadas a una transaccion. + */ + private static final String HQL_FOOTER = " order by t.presentationorder "; +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/trans/panel/ProductPanels.java b/base/business/general/src/main/java/com/fp/general/rules/query/trans/panel/ProductPanels.java new file mode 100644 index 0000000..6468f88 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/trans/panel/ProductPanels.java @@ -0,0 +1,90 @@ +package com.fp.general.rules.query.trans.panel; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.common.helper.BeanManager; +import com.fp.persistence.commondb.HqlStatement; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.page.TgeneSubproductPages; + +/** + * Clase que se encarga de entregar una lista con las paginas a contruir paneles dinamicamente + * en la pantalla por subproducto. + * @author Jorge Vaca + * @version 2.1 + */ +public class ProductPanels extends QueryRule { + + /** + * Metodo que obtiene saldos promedio de una cuenta a la vista. + * @param pQueryRequest Datos de entrada de la consulta. + */ + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + List> lData = this.fillData(pQueryRequest); + response.put("PRODUCTPANELS", lData); + return pQueryRequest; + } + + /** + * Metodo que llena una lista con las paginas asociadas a un producto, transaccion. + * @param pQueryRequest Datos del request. + * @return List> + * @throws Exception + */ + private List> fillData(QueryRequest pQueryRequest) throws Exception { + List> lData = new ArrayList>(); + List lPages = this.getTgeneSubproductPages(pQueryRequest); + for (TgeneSubproductPages tgeneSubproductPages : lPages) { + Map m = new HashMap(); + m.put("cod", tgeneSubproductPages.getPk().getSequence()); + m.put("t", tgeneSubproductPages.getTitle()); + m.put("p", tgeneSubproductPages.getPage()); + m.put("q", tgeneSubproductPages.getQueryfunction()); + m.put("s", tgeneSubproductPages.getSavefunction()); + m.put("d", "N"); + m.put("down", tgeneSubproductPages.getAutodownload()); + lData.add(m); + } + lPages = null; + return lData; + } + + /** + * Metodo que entrega una lista de paginas a asociar en paneles en paginas. + * @param pQueryRequest Datos del request. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + private List getTgeneSubproductPages(QueryRequest pQueryRequest) throws Exception { + List lData = null; + HqlStatement hql = new HqlStatement(HQL); + hql.setString("module", (String) BeanManager.convertObject(pQueryRequest.get("module"), String.class)); + hql.setString("product", (String) BeanManager.convertObject(pQueryRequest.get("product"), String.class)); + hql.setString("subproduct", (String) BeanManager.convertObject(pQueryRequest.get("subproduct"), String.class)); + hql.setString("tmodule", pQueryRequest.getTransactionModule()); + hql.setInteger("tcode", pQueryRequest.getTransactionCode()); + hql.setInteger("tversion", pQueryRequest.getTransactionVersion()); + lData = hql.execute().getResultList(); + return lData; + } + /** + * Sentencia que entrega las paginas asociadas a un modulo, producto tipo. + */ + private static final String HQL = + " from TgeneSubproductPages t " + + " where t.pk.modulecode = :module " + + " and t.pk.productcode = :product " + + " and t.pk.subproductcode = :subproduct " + + " and t.pk.transactionmodule = :tmodule " + + " and t.pk.transactioncode = :tcode " + + " and t.pk.transactionversion = :tversion " + + " and coalesce(t.active,'N') = 'Y' " + + " order by t.presentationorder "; +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/query/trans/panel/TransactionPanels.java b/base/business/general/src/main/java/com/fp/general/rules/query/trans/panel/TransactionPanels.java new file mode 100644 index 0000000..63f5bfe --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/query/trans/panel/TransactionPanels.java @@ -0,0 +1,98 @@ +package com.fp.general.rules.query.trans.panel; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.HqlStatement; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pgeneral.page.TgeneTransactionPages; + +/** + * Clase que se encarga de entregar una lista con las paginas a contruir paneles dinamicamente + * en la pantalla. + * @author Jorge Vaca + * @version 2.1 + */ +public class TransactionPanels extends QueryRule { + + private String filterTitle; + + /** + * Metodo que obtiene saldos promedio de una cuenta a la vista. + * @param pQueryRequest Datos de entrada de la consulta. + */ + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + this.filterTitle = (String) pQueryRequest.get("filterTitle"); + List> lData = this.fillData(pQueryRequest); + response.put("TRANSPANELS", lData); + return pQueryRequest; + } + + /** + * Metodo que llena una lista de paginas asociadas a una transaccion. + * @param pQueryRequest Datos del request. + * @return List> + * @throws Exception + */ + private List> fillData(QueryRequest pQueryRequest) throws Exception { + List> lData = new ArrayList>(); + List lPages = this.getTgeneTransactionPages(pQueryRequest.getTransactionModule(), + pQueryRequest.getTransactionCode(), pQueryRequest.getTransactionVersion()); + for (TgeneTransactionPages tgeneTransactionPages : lPages) { + Map m = new HashMap(); + m.put("cod", tgeneTransactionPages.getPk().getSequence()); + m.put("t", tgeneTransactionPages.getTitle()); + m.put("p", tgeneTransactionPages.getPage()); + m.put("q", tgeneTransactionPages.getQueryfunction()); + m.put("s", tgeneTransactionPages.getSavefunction()); + m.put("d", "N"); + m.put("down", tgeneTransactionPages.getAutodownload()); + lData.add(m); + } + lPages = null; + return lData; + } + + /** + * Metodo que entrega una lista de paginas a asociar en paneles en paginas. + * @param pModule Codigo de modulo. + * @param pTransaction Codigo de transaccion. + * @param pVersion Version de la transaccion. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + private List getTgeneTransactionPages(String pModule, Integer pTransaction, Integer pVersion) throws Exception { + List lData = null; + String sentence = null; + if (this.filterTitle != null) { + sentence = HQL_HEADER + " and title " + this.filterTitle + " " + HQL_FOOTER; + } else { + sentence = HQL_HEADER + HQL_FOOTER; + } + HqlStatement hql = new HqlStatement(sentence); + hql.setString("module", pModule); + hql.setInteger("transaction", pTransaction); + hql.setInteger("version", pVersion); + lData = hql.execute().getResultList(); + return lData; + } + /** + * Sentencia cabecera que entrega las paginas asociadas a una transaccion. + */ + private static final String HQL_HEADER = + " from TgeneTransactionPages t " + + " where t.pk.transactionmodule = :module" + + " and t.pk.transactioncode = :transaction" + + " and t.pk.transactionversion = :version" + + " and coalesce(t.active,'N') = 'Y'"; + /** + * Sentencia cabecera que entrega las paginas asociadas a una transaccion. + */ + private static final String HQL_FOOTER = " order by t.presentationorder "; +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/save/.svn/entries b/base/business/general/src/main/java/com/fp/general/rules/save/.svn/entries new file mode 100644 index 0000000..284d722 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/save/.svn/entries @@ -0,0 +1,198 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/rules/save +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +EraseCache.java +file + + + + +2022-07-28T03:40:43.809808Z +5e34dec69c661645009bc939ac191c19 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +709 + +GenerateAccountingDate.java +file + + + + +2022-07-28T03:40:43.809808Z +35e280ca2323628d39819d26ea97dcba +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +11173 + +VerifyOverlapSubProductChargesAmount.java +file + + + + +2022-07-28T03:40:43.810808Z +69ed2fc64cf822064ae6d61fc74dde9b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4410 + +ChangeAccountingDate.java +file + + + + +2022-07-28T03:40:43.810808Z +0c00a8af3b4e48287790b5a8cc0b82c5 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4860 + +VerifyOverlapChargesAmount.java +file + + + + +2022-07-28T03:40:43.810808Z +929badca50f9dba601d61343f81a1801 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3766 + diff --git a/base/business/general/src/main/java/com/fp/general/rules/save/.svn/text-base/ChangeAccountingDate.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/save/.svn/text-base/ChangeAccountingDate.java.svn-base new file mode 100644 index 0000000..29331ae --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/save/.svn/text-base/ChangeAccountingDate.java.svn-base @@ -0,0 +1,132 @@ +package com.fp.general.rules.save; + +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.HashMap; +import java.util.Map; + +import com.fp.common.helper.CalculationBase; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.db.DataHelper; +import com.fp.persistence.commondb.helper.APPDates; +import com.fp.persistence.pgeneral.date.TgeneAccountingDate; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateKey; + +/** + * Calse que se encarga de cambiar la fecha contable de la aplicacion. + * @author Jorge Vaca. + * @version 2.1 + * + */ +public class ChangeAccountingDate extends TransactionRule{ + + /* (non-Javadoc) + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + TgeneAccountingDateBranch ad = DataHelper.getInstance().getTgeneAccountingDateBranch(pSaveRequest.getCompany(), 0); + //Fecha contable anterior + this.fillPrevious(ad); + APPDates d = new APPDates(ad.getRealdate(),CalculationBase.B365365); + boolean aux = true; + while (aux) { + aux = this.fillAccountingdate(ad, pSaveRequest.getCompany(), d); + } + //Proxima Fecha contable + this.fillNext(ad, d, pSaveRequest.getCompany()); + PersistenceHelper.saveOrUpdate(ad); + this.fillResponse(pSaveRequest, ad); + return pSaveRequest; + } + + /** + * Fija la fecha contable anterior. + * @param ad Objeto que contiene los datos actuales de la fecha contable. + * @throws Exception + */ + private void fillPrevious(TgeneAccountingDateBranch ad) throws Exception { + if(ad.getRealdate().compareTo(ad.getAccountingdate()) < 0){ + ad.setPreviousaccountingdate(ad.getPreviousaccountingdate()); + }else{ + ad.setPreviousaccountingdate(ad.getAccountingdate()); + } + } + + /** + * Fija la proxima fecha cobtable. + * @param ad Objeto que contiene la proxima fecha contable. + * @param d Rerefencia al objeto AppDates + * @param pCompany Codigo de compania. + * @throws Exception + */ + private void fillNext(TgeneAccountingDateBranch ad,APPDates d,Integer pCompany) throws Exception { + d = new APPDates(ad.getAccountingdate(),CalculationBase.B365365); + d.addField(Calendar.DAY_OF_YEAR, 1); + TgeneAccountingDate cal = this.getTgeneAccountingDate(0, pCompany, d.getDate()); + ad.setNextaccountingdate(cal.getAccountingdate()); + } + + /** + * Metodo que fija la fecha contable. + * @param ad Objeto que contiene la proxima fecha contable. + * @param pCompany Codigo de compania. + * @param d Rerefencia al objeto AppDates + * @return boolean + * @throws Exception + */ + private boolean fillAccountingdate(TgeneAccountingDateBranch ad,Integer pCompany,APPDates d ) throws Exception { + boolean aux = true; + d.addField(Calendar.DAY_OF_YEAR, 1); + TgeneAccountingDate cal = this.getTgeneAccountingDate(0, pCompany, d.getDate()); + ad.setAccountingdate(cal.getAccountingdate()); + ad.setWorkingdate(cal.getWorkingdate()); + ad.setRealdate(cal.getPk().getRealdate()); + if(ad.getWorkingdate().compareTo(ad.getAccountingdate()) == 0 ){ + if(ad.getWorkingdate().compareTo(ad.getRealdate()) == 0){ + aux = false; + } + }else{ + aux = false; + } + // + return aux; + } + + private TgeneAccountingDate getTgeneAccountingDate(Integer pBranch, Integer pCompany,Date pDate) throws Exception { + TgeneAccountingDateKey key = new TgeneAccountingDateKey(0,pCompany,pDate); + TgeneAccountingDate cal = TgeneAccountingDate.find(PersistenceHelper.getEntityManager(), key); + if(cal == null){ + SimpleDateFormat fd = new SimpleDateFormat("dd-MM-yyyy"); + throw new GeneralException("GENE-0024","CALENDARIO NO DEFINIDO EN TGENEACCOUNTINGDATE PARA LA FECHA: {0} ", fd.format(pDate)); + } + return cal; + } + + /** + * Arma la respuesta con las fechas resultanrtes. + * @param pSaveRequest Datos del request original. + * @param ad Objeto que contiene la proxima fecha contable. + * @throws Exception + */ + private void fillResponse(SaveRequest pSaveRequest,TgeneAccountingDateBranch ad) throws Exception { + Map m = new HashMap(); + m.put("realdate", ad.getRealdate()); + m.put("workdate", ad.getWorkingdate()); + m.put("accodate", ad.getAccountingdate()); + pSaveRequest.getResponse().put("NEXTDATE", m); + } + /* (non-Javadoc) + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + // No tiene reverso + return pSaveRequest; + } + + +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/save/.svn/text-base/EraseCache.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/save/.svn/text-base/EraseCache.java.svn-base new file mode 100644 index 0000000..a34f1a2 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/save/.svn/text-base/EraseCache.java.svn-base @@ -0,0 +1,28 @@ +package com.fp.general.rules.save; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.cache.CacheManager; + +/** + * Clase que borra la cach de la aplicacin + * + * @author amerchan + * @version 2.1 + */ +public class EraseCache extends TransactionRule { + + private static final long serialVersionUID = 1L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + CacheManager.getInstance().cleanAll(); + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/save/.svn/text-base/GenerateAccountingDate.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/save/.svn/text-base/GenerateAccountingDate.java.svn-base new file mode 100644 index 0000000..37caa42 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/save/.svn/text-base/GenerateAccountingDate.java.svn-base @@ -0,0 +1,290 @@ +package com.fp.general.rules.save; + +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.common.helper.CalculationBase; +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.db.DataHelper; +import com.fp.persistence.commondb.helper.APPDates; +import com.fp.persistence.pgeneral.date.TgeneAccountingDate; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateKey; +import com.fp.persistence.pgeneral.date.TgeneNotAccountingDay; +import com.fp.persistence.pgeneral.gene.TgeneBranch; +import com.fp.persistence.pgeneral.gene.TgeneBranchKey; + +/** + * Clase que se encarga de generar las fechas contables para un tiempo + * determinado + * + * @author scastillo + * @version 2.1 + */ +public class GenerateAccountingDate extends TransactionRule { + + /** + * Map que contiene los datos del request de los dias contables y no + * contables + */ + private Map> mdays = new HashMap>(); + /** + * Lista de dias no contables por mes. + */ + private List lnotaccountingdays; + /** + * Fecha de inicio de generacion del calendario. + */ + private Date initdatedate; + /** + * Fecha de finalizacion de genercion del calendario. + */ + private Date enddate; + + /** + * Metodo que genra las fechas contables + * + * @param saveRequest Datos del request original. + * @return SaveRequest + * @throws Exception + */ + public SaveRequest normalProcess(SaveRequest saveRequest) throws Exception { + this.fillMapDay(saveRequest); + lnotaccountingdays = TgeneNotAccountingDay.findAll(PersistenceHelper.getEntityManager()); + enddate = (Date) saveRequest.get("enddate"); + this.processBranches(saveRequest); + return saveRequest; + } + + /** + * Metodo que genera fechas contables para la sucursal oficina de proceso. + * + * @param saveRequest Datos del request original. + * @throws Exception + */ + private void processBranches(SaveRequest saveRequest) throws Exception { + Integer init = Integer.parseInt(saveRequest.get("branchcodemin").toString()); + Integer end = Integer.parseInt(saveRequest.get("branchcodemax").toString()); + while (init <= end) { + TgeneBranchKey tgeneBranchKey = new TgeneBranchKey(init, saveRequest.getCompany()); + TgeneBranch tgeneBranch = TgeneBranch.find(PersistenceHelper.getEntityManager(), tgeneBranchKey); + if (tgeneBranch != null) { + //Obtiene la fecha de inicio por cada sucursal + initdatedate = (Date) saveRequest.get("initdate"); + this.delete(init, saveRequest.getCompany()); + this.validateDatesByBranch(init, saveRequest.getCompany()); + this.processByDate(saveRequest, init); + } + init++; + } + } + + private void processByDate(SaveRequest saveRequest, Integer pBranch) throws Exception { + APPDates d = new APPDates(initdatedate, CalculationBase.B365365); + while (initdatedate.compareTo(enddate) <= 0) { + this.generateCalendar(saveRequest, pBranch, d); + d.addField(Calendar.DAY_OF_YEAR, 1); + initdatedate = d.getDate(); + } + } + + /** + * + * @param saveRequest Datos del request original. + * @param pBranch Codigo de sucursal a generar la fecha contable. + * @param d Fecha real con la cual se obtiene la fecha de trabajo y la + * contable. + * @throws Exception + */ + private void generateCalendar(SaveRequest saveRequest, Integer pBranch, APPDates d) throws Exception { + Map m = this.mdays.get(d.getField(Calendar.DAY_OF_WEEK)); + TgeneAccountingDateKey key = new TgeneAccountingDateKey(); + key.setCompanycode(saveRequest.getCompany()); + key.setBranchcode(pBranch); + key.setRealdate(d.getDate()); + TgeneAccountingDate obj = new TgeneAccountingDate(); + obj.setPk(key); + obj.setAccountingdate(this.getDate(d, "accounting", m)); + obj.setWorkingdate(this.getDate(d, "working", m)); + PersistenceHelper.save(obj); + } + + /** + * Entrega la fecha contable para una fecha real. + * + * @param d Fecha real con la cual se obtien la fecha de trabajo y la fecha + * contable. + * @param fieldname Nombre del campo, working o accounting + * @param m Map que contien indica si la fecha es laborable y/o contable. + * @return Date + * @throws Exception + */ + private Date getDate(APPDates d, String fieldname, Map m) throws Exception { + if (m.get(fieldname)) { + if (fieldname.compareTo("working") == 0) { + return d.getDate(); + } else if (this.validateDayOfTheMonth(d)) { + //Si es fecha contable verifica que el dia dentro del mes sea contable. + return d.getDate(); + } + } + APPDates daux = new APPDates(d.getDate(), CalculationBase.B365365); + int day = d.getField(Calendar.DAY_OF_WEEK); + boolean cont = true; + while (cont) { + day++; + if (day == 8) { + day = 1; + } + daux.addField(Calendar.DAY_OF_YEAR, 1); + if (fieldname.compareTo("accounting") == 0 && !this.validateDayOfTheMonth(daux)) { + //Si el dia es no contable continua + continue; + } + if (this.mdays.get(day).get(fieldname)) { + cont = false; + } + } + return daux.getDate(); + } + + /** + * Valida si el dia es contable dentro del mes, ejemplo 1 de enero no es + * contable. + * + * @param d Fecha verificar si el dia es contable. + * @return boolean + * @throws Exception + */ + private boolean validateDayOfTheMonth(APPDates d) throws Exception { + boolean isaccounting = true; + String mes = String.valueOf(d.getField(Calendar.MONTH)); + if (mes.length() == 1) { + mes = "0" + mes; + } + for (TgeneNotAccountingDay obj : lnotaccountingdays) { + if (obj.getPk().getCatalog().compareTo(mes) != 0) { + continue; + } + int day = d.getField(Calendar.DAY_OF_MONTH); + if (obj.getPk().getDay().compareTo(day) == 0) { + isaccounting = false; + break; + } + } + return isaccounting; + } + + @SuppressWarnings("unchecked") + private void fillMapDay(SaveRequest saveRequest) throws Exception { + List lobj = saveRequest.getSaveBeanModifiedRecords("LISTACCOUNTINDATE"); + if(lobj == null || lobj.isEmpty()){ + lobj = (List)saveRequest.get("LISTACCOUNTINDATE"); + } + boolean isworking = false; + boolean isaccounting = false; + + for (Object object : lobj) { + Map m = (Map) object; + Integer day = Integer.parseInt(m.get("day").toString()); + String working = m.get("teller").toString(); + String accounting = m.get("accounting").toString(); + Map maux = new HashMap(); + maux.put("working", Constant.ifYes(working)); + maux.put("accounting", Constant.ifYes(accounting)); + mdays.put(day, maux); + if(!isworking){ + isworking = Constant.ifYes(working); + } + if(!isaccounting){ + isaccounting = Constant.ifYes(accounting); + } + } + if(!isaccounting || !isworking){ + throw new GeneralException("GENE-0052", "INGRESE AL MENOS UN DA CONATBLE Y DE TRABAJO PARA GENERAR EL CALENDARIO"); + } + } + + /** + * Sentencia que se encarga de eliminar el calendario de fechas por sucursal + */ + private static String DEL = "delete from TgeneAccountingDate t " + + " where t.pk.branchcode = :branch " + + " and t.pk.companycode = :company " + + " and t.pk.realdate >= :datefrom "; + + /** + * Elimna fechas del calendario por sucursal y mayor a la fecha a regenerar + * el calendario. + * + * @param pBracnch Codigo de sucursal. + * @param pCompany Codigo de compania. + * @throws Exception + */ + private void delete(Integer pBracnch, Integer pCompany) throws Exception { + Query qry = PersistenceHelper.getEntityManager().createQuery(DEL); + qry.setParameter("branch", pBracnch); + qry.setParameter("company", pCompany); + qry.setParameter("datefrom", this.initdatedate); + qry.executeUpdate(); + } + /** + * Sentencia que se encarga de eliminar el calendario de fechas por sucursal + */ + private static String SQL_VAL = "select max(t.pk.realdate) from TgeneAccountingDate t " + + " where t.pk.branchcode = :branch " + + " and t.pk.companycode = :company " + + " and t.pk.realdate < :datefrom "; + + /** + * Valida que en la generacion de del calendario no exista huecos de fechas + * realres. + * + * @param pBracnch Codigo de sucursal. + * @param pCompany Codigo de compania. + * @throws Exception + */ + private void validateDatesByBranch(Integer pBracnch, Integer pCompany) throws Exception { + Query qry = PersistenceHelper.getEntityManager().createQuery(SQL_VAL); + qry.setParameter("branch", pBracnch); + qry.setParameter("company", pCompany); + qry.setParameter("datefrom", this.initdatedate); + Date d = (Date) qry.getSingleResult(); + if (d == null) { + return; + } + APPDates appd = new APPDates(d, CalculationBase.B365365); + appd.addField(Calendar.DAY_OF_YEAR, 1); + if (appd.getDate().compareTo(initdatedate) < 0) { + SimpleDateFormat fd = new SimpleDateFormat("dd-MM-yyyy"); + throw new GeneralException("GENE-0019", "EL CALENDARIO NO PUEDE DEJAR HUECOS PARA LA SUCURSAL: {0} FCONTABLE ANTERIOR: {1}", pBracnch, fd.format(d)); + } + TgeneAccountingDateBranch ad = DataHelper.getInstance().getTgeneAccountingDateBranch(pCompany, 0); + if (ad.getRealdate().compareTo(initdatedate) > 0) { + throw new GeneralException("GENE-0020", "FECHA DE INICIO PARA GENERAR CALENDARIO NO PUEDE SER MENOR A: {0}", + ad.getRealdate()); + } + } + + /** + * Metodo que se ejecuta en modo reverso + * + * @param saveRequest + * @return SaveRequest + * @throws Exception + */ + public SaveRequest reverseProcess(SaveRequest saveRequest) throws Exception { + //En este caso no hacer nada no existen reversos. + return saveRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/save/.svn/text-base/VerifyOverlapChargesAmount.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/save/.svn/text-base/VerifyOverlapChargesAmount.java.svn-base new file mode 100644 index 0000000..843512f --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/save/.svn/text-base/VerifyOverlapChargesAmount.java.svn-base @@ -0,0 +1,91 @@ +package com.fp.general.rules.save; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.db.DataHelper; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.pgeneral.charge.TgeneCharges; + +/** + * Clase que se encarga de verificar traslape en montos de los cargos. + * + * @author Angel Merchan. + * @version 2.1 + * + */ +@SuppressWarnings("serial") +public class VerifyOverlapChargesAmount extends TransactionRule { + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (pSaveRequest.getSaveBean("TGENECHARGES") != null) { + this.validateTgeneCharges(pSaveRequest); + } + + return pSaveRequest; + } + + private void validateTgeneCharges(SaveRequest pSaveRequest) throws Exception { + String modulecode = pSaveRequest.get("modulecode").toString(); + List lChargesModified = pSaveRequest.getSaveBeanModifiedRecords("TGENECHARGES"); + List lChargesDeleted = pSaveRequest.getSaveBeanDeletedRecords("TGENECHARGES"); + List lChargesDatabase = DataHelper.getInstance().getTgeneChargesByModule(modulecode); + + List lChargesFinal = new ArrayList(); + + lChargesFinal = Constant.getFinalList(lChargesDatabase, Constant.convertList(lChargesModified, TgeneCharges.class), + Constant.convertList(lChargesDeleted, TgeneCharges.class)); + + for (int i = 0; i < lChargesFinal.size(); i++) { + TgeneCharges prodchargesfinal = lChargesFinal.get(i); + this.validateOverlapCharges(prodchargesfinal, i + 1, lChargesFinal); + } + } + + /** + * Metodo que verifica el traslape de montos de un cargo + * + * @param prodchargesfinal + * @param index + * @param listSubProductChargesFinal + * @throws Exception + */ + private void validateOverlapCharges(TgeneCharges chargesfinal, int index, List lChargesFinal) throws Exception { + BigDecimal minamount = chargesfinal.getMinamount(); + BigDecimal maxamount = chargesfinal.getMaxamount(); + + if (minamount.compareTo(maxamount) >= 0) { + throw new GeneralException("GENE-0040", "EL MONTO MNIMO DEBE SER MENOR AL MONTO MXIMO EN {0}", "[CARGOS GENERALES]"); + } + + for (int i = index; i < lChargesFinal.size(); i++) { + TgeneCharges prodcharges = lChargesFinal.get(i); + + if (chargesfinal.equalsWithoutSequence(prodcharges)) { + + BigDecimal minamountcmp = prodcharges.getMinamount(); + BigDecimal maxamountcmp = prodcharges.getMaxamount(); + + if (((minamount.compareTo(maxamountcmp) <= 0) && (minamount.compareTo(minamountcmp) >= 0)) + || ((minamount.compareTo(minamountcmp) >= 0) && (maxamount.compareTo(maxamountcmp) <= 0)) + || ((minamount.compareTo(minamountcmp) <= 0) && (maxamount.compareTo(maxamountcmp) >= 0)) + || ((maxamount.compareTo(minamountcmp) >= 0) && (maxamount.compareTo(maxamountcmp) <= 0))) { + throw new GeneralException("GENE-0041", "LOS VALORES PARA EL TIPO DE BALANCE {0} SE SOBREPONEN EN {1}", chargesfinal.getPk() + .getBalancetype(), "[CARGOS GENERALES]"); + } + } + prodcharges = null; + } + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/save/.svn/text-base/VerifyOverlapSubProductChargesAmount.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/save/.svn/text-base/VerifyOverlapSubProductChargesAmount.java.svn-base new file mode 100644 index 0000000..4a1d730 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/save/.svn/text-base/VerifyOverlapSubProductChargesAmount.java.svn-base @@ -0,0 +1,95 @@ +package com.fp.general.rules.save; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.charge.TgeneSubProductCharges; + +/** + * Clase que se encarga de verificar traslape en montos de los cargos. + * + * @author Angel Merchan. + * @version 2.1 + * + */ +@SuppressWarnings("serial") +public class VerifyOverlapSubProductChargesAmount extends TransactionRule { + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (pSaveRequest.getSaveBean("TGENESUBPRODUCTCHARGES") != null) { + this.validateTgeneSubProductCharges(pSaveRequest); + } + + return pSaveRequest; + } + + private void validateTgeneSubProductCharges(SaveRequest pSaveRequest) throws Exception { + String modulecode = pSaveRequest.get("modulecode").toString(); + String productcode = pSaveRequest.get("productcode").toString(); + String subproductcode = pSaveRequest.get("subproductcode").toString(); + + List lSubProductChargesModified = pSaveRequest.getSaveBeanModifiedRecords("TGENESUBPRODUCTCHARGES"); + List lSubProductChargesDeleted = pSaveRequest.getSaveBeanDeletedRecords("TGENESUBPRODUCTCHARGES"); + List listSubProductChargesDatabase = TgeneSubProductCharges.find(PersistenceHelper.getEntityManager(), modulecode, + productcode, subproductcode); + List listSubProductChargesFinal = new ArrayList(); + + listSubProductChargesFinal = Constant.getFinalList(listSubProductChargesDatabase, + Constant.convertList(lSubProductChargesModified, TgeneSubProductCharges.class), + Constant.convertList(lSubProductChargesDeleted, TgeneSubProductCharges.class)); + + for (int i = 0; i < listSubProductChargesFinal.size(); i++) { + TgeneSubProductCharges prodchargesfinal = listSubProductChargesFinal.get(i); + this.validateOverlapSubProductCharges(prodchargesfinal, i + 1, listSubProductChargesFinal); + } + } + + /** + * Metodo que verifica el traslape de montos de un cargo + * + * @param prodchargesfinal + * @param index + * @param listSubProductChargesFinal + * @throws Exception + */ + private void validateOverlapSubProductCharges(TgeneSubProductCharges prodchargesfinal, int index, + List listSubProductChargesFinal) throws Exception { + BigDecimal minamount = prodchargesfinal.getMinamount(); + BigDecimal maxamount = prodchargesfinal.getMaxamount(); + + if (minamount.compareTo(maxamount) >= 0) { + throw new GeneralException("GENE-0040", "EL MONTO MNIMO DEBE SER MENOR AL MONTO MXIMO EN {0}", "[CARGOS POR SUBPRODUCTO]"); + } + + for (int i = index; i < listSubProductChargesFinal.size(); i++) { + TgeneSubProductCharges prodcharges = listSubProductChargesFinal.get(i); + + if (prodchargesfinal.equalsWithoutSequence(prodcharges)) { + BigDecimal minamountcmp = prodcharges.getMinamount(); + BigDecimal maxamountcmp = prodcharges.getMaxamount(); + + if (((minamount.compareTo(maxamountcmp) <= 0) && (minamount.compareTo(minamountcmp) >= 0)) + || ((minamount.compareTo(minamountcmp) >= 0) && (maxamount.compareTo(maxamountcmp) <= 0)) + || ((minamount.compareTo(minamountcmp) <= 0) && (maxamount.compareTo(maxamountcmp) >= 0)) + || ((maxamount.compareTo(minamountcmp) >= 0) && (maxamount.compareTo(maxamountcmp) <= 0))) { + throw new GeneralException("GENE-0041", "LOS VALORES PARA EL TIPO DE BALANCE {0} SE SOBREPONEN EN {1}", prodchargesfinal.getPk() + .getBalancetype(), "[CARGOS POR SUBPRODUCTO]"); + } + } + prodcharges = null; + } + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/save/ChangeAccountingDate.java b/base/business/general/src/main/java/com/fp/general/rules/save/ChangeAccountingDate.java new file mode 100644 index 0000000..29331ae --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/save/ChangeAccountingDate.java @@ -0,0 +1,132 @@ +package com.fp.general.rules.save; + +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.HashMap; +import java.util.Map; + +import com.fp.common.helper.CalculationBase; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.db.DataHelper; +import com.fp.persistence.commondb.helper.APPDates; +import com.fp.persistence.pgeneral.date.TgeneAccountingDate; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateKey; + +/** + * Calse que se encarga de cambiar la fecha contable de la aplicacion. + * @author Jorge Vaca. + * @version 2.1 + * + */ +public class ChangeAccountingDate extends TransactionRule{ + + /* (non-Javadoc) + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + TgeneAccountingDateBranch ad = DataHelper.getInstance().getTgeneAccountingDateBranch(pSaveRequest.getCompany(), 0); + //Fecha contable anterior + this.fillPrevious(ad); + APPDates d = new APPDates(ad.getRealdate(),CalculationBase.B365365); + boolean aux = true; + while (aux) { + aux = this.fillAccountingdate(ad, pSaveRequest.getCompany(), d); + } + //Proxima Fecha contable + this.fillNext(ad, d, pSaveRequest.getCompany()); + PersistenceHelper.saveOrUpdate(ad); + this.fillResponse(pSaveRequest, ad); + return pSaveRequest; + } + + /** + * Fija la fecha contable anterior. + * @param ad Objeto que contiene los datos actuales de la fecha contable. + * @throws Exception + */ + private void fillPrevious(TgeneAccountingDateBranch ad) throws Exception { + if(ad.getRealdate().compareTo(ad.getAccountingdate()) < 0){ + ad.setPreviousaccountingdate(ad.getPreviousaccountingdate()); + }else{ + ad.setPreviousaccountingdate(ad.getAccountingdate()); + } + } + + /** + * Fija la proxima fecha cobtable. + * @param ad Objeto que contiene la proxima fecha contable. + * @param d Rerefencia al objeto AppDates + * @param pCompany Codigo de compania. + * @throws Exception + */ + private void fillNext(TgeneAccountingDateBranch ad,APPDates d,Integer pCompany) throws Exception { + d = new APPDates(ad.getAccountingdate(),CalculationBase.B365365); + d.addField(Calendar.DAY_OF_YEAR, 1); + TgeneAccountingDate cal = this.getTgeneAccountingDate(0, pCompany, d.getDate()); + ad.setNextaccountingdate(cal.getAccountingdate()); + } + + /** + * Metodo que fija la fecha contable. + * @param ad Objeto que contiene la proxima fecha contable. + * @param pCompany Codigo de compania. + * @param d Rerefencia al objeto AppDates + * @return boolean + * @throws Exception + */ + private boolean fillAccountingdate(TgeneAccountingDateBranch ad,Integer pCompany,APPDates d ) throws Exception { + boolean aux = true; + d.addField(Calendar.DAY_OF_YEAR, 1); + TgeneAccountingDate cal = this.getTgeneAccountingDate(0, pCompany, d.getDate()); + ad.setAccountingdate(cal.getAccountingdate()); + ad.setWorkingdate(cal.getWorkingdate()); + ad.setRealdate(cal.getPk().getRealdate()); + if(ad.getWorkingdate().compareTo(ad.getAccountingdate()) == 0 ){ + if(ad.getWorkingdate().compareTo(ad.getRealdate()) == 0){ + aux = false; + } + }else{ + aux = false; + } + // + return aux; + } + + private TgeneAccountingDate getTgeneAccountingDate(Integer pBranch, Integer pCompany,Date pDate) throws Exception { + TgeneAccountingDateKey key = new TgeneAccountingDateKey(0,pCompany,pDate); + TgeneAccountingDate cal = TgeneAccountingDate.find(PersistenceHelper.getEntityManager(), key); + if(cal == null){ + SimpleDateFormat fd = new SimpleDateFormat("dd-MM-yyyy"); + throw new GeneralException("GENE-0024","CALENDARIO NO DEFINIDO EN TGENEACCOUNTINGDATE PARA LA FECHA: {0} ", fd.format(pDate)); + } + return cal; + } + + /** + * Arma la respuesta con las fechas resultanrtes. + * @param pSaveRequest Datos del request original. + * @param ad Objeto que contiene la proxima fecha contable. + * @throws Exception + */ + private void fillResponse(SaveRequest pSaveRequest,TgeneAccountingDateBranch ad) throws Exception { + Map m = new HashMap(); + m.put("realdate", ad.getRealdate()); + m.put("workdate", ad.getWorkingdate()); + m.put("accodate", ad.getAccountingdate()); + pSaveRequest.getResponse().put("NEXTDATE", m); + } + /* (non-Javadoc) + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + // No tiene reverso + return pSaveRequest; + } + + +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/save/EraseCache.java b/base/business/general/src/main/java/com/fp/general/rules/save/EraseCache.java new file mode 100644 index 0000000..a34f1a2 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/save/EraseCache.java @@ -0,0 +1,28 @@ +package com.fp.general.rules.save; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.cache.CacheManager; + +/** + * Clase que borra la cach de la aplicacin + * + * @author amerchan + * @version 2.1 + */ +public class EraseCache extends TransactionRule { + + private static final long serialVersionUID = 1L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + CacheManager.getInstance().cleanAll(); + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/save/GenerateAccountingDate.java b/base/business/general/src/main/java/com/fp/general/rules/save/GenerateAccountingDate.java new file mode 100644 index 0000000..37caa42 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/save/GenerateAccountingDate.java @@ -0,0 +1,290 @@ +package com.fp.general.rules.save; + +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.common.helper.CalculationBase; +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.db.DataHelper; +import com.fp.persistence.commondb.helper.APPDates; +import com.fp.persistence.pgeneral.date.TgeneAccountingDate; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateKey; +import com.fp.persistence.pgeneral.date.TgeneNotAccountingDay; +import com.fp.persistence.pgeneral.gene.TgeneBranch; +import com.fp.persistence.pgeneral.gene.TgeneBranchKey; + +/** + * Clase que se encarga de generar las fechas contables para un tiempo + * determinado + * + * @author scastillo + * @version 2.1 + */ +public class GenerateAccountingDate extends TransactionRule { + + /** + * Map que contiene los datos del request de los dias contables y no + * contables + */ + private Map> mdays = new HashMap>(); + /** + * Lista de dias no contables por mes. + */ + private List lnotaccountingdays; + /** + * Fecha de inicio de generacion del calendario. + */ + private Date initdatedate; + /** + * Fecha de finalizacion de genercion del calendario. + */ + private Date enddate; + + /** + * Metodo que genra las fechas contables + * + * @param saveRequest Datos del request original. + * @return SaveRequest + * @throws Exception + */ + public SaveRequest normalProcess(SaveRequest saveRequest) throws Exception { + this.fillMapDay(saveRequest); + lnotaccountingdays = TgeneNotAccountingDay.findAll(PersistenceHelper.getEntityManager()); + enddate = (Date) saveRequest.get("enddate"); + this.processBranches(saveRequest); + return saveRequest; + } + + /** + * Metodo que genera fechas contables para la sucursal oficina de proceso. + * + * @param saveRequest Datos del request original. + * @throws Exception + */ + private void processBranches(SaveRequest saveRequest) throws Exception { + Integer init = Integer.parseInt(saveRequest.get("branchcodemin").toString()); + Integer end = Integer.parseInt(saveRequest.get("branchcodemax").toString()); + while (init <= end) { + TgeneBranchKey tgeneBranchKey = new TgeneBranchKey(init, saveRequest.getCompany()); + TgeneBranch tgeneBranch = TgeneBranch.find(PersistenceHelper.getEntityManager(), tgeneBranchKey); + if (tgeneBranch != null) { + //Obtiene la fecha de inicio por cada sucursal + initdatedate = (Date) saveRequest.get("initdate"); + this.delete(init, saveRequest.getCompany()); + this.validateDatesByBranch(init, saveRequest.getCompany()); + this.processByDate(saveRequest, init); + } + init++; + } + } + + private void processByDate(SaveRequest saveRequest, Integer pBranch) throws Exception { + APPDates d = new APPDates(initdatedate, CalculationBase.B365365); + while (initdatedate.compareTo(enddate) <= 0) { + this.generateCalendar(saveRequest, pBranch, d); + d.addField(Calendar.DAY_OF_YEAR, 1); + initdatedate = d.getDate(); + } + } + + /** + * + * @param saveRequest Datos del request original. + * @param pBranch Codigo de sucursal a generar la fecha contable. + * @param d Fecha real con la cual se obtiene la fecha de trabajo y la + * contable. + * @throws Exception + */ + private void generateCalendar(SaveRequest saveRequest, Integer pBranch, APPDates d) throws Exception { + Map m = this.mdays.get(d.getField(Calendar.DAY_OF_WEEK)); + TgeneAccountingDateKey key = new TgeneAccountingDateKey(); + key.setCompanycode(saveRequest.getCompany()); + key.setBranchcode(pBranch); + key.setRealdate(d.getDate()); + TgeneAccountingDate obj = new TgeneAccountingDate(); + obj.setPk(key); + obj.setAccountingdate(this.getDate(d, "accounting", m)); + obj.setWorkingdate(this.getDate(d, "working", m)); + PersistenceHelper.save(obj); + } + + /** + * Entrega la fecha contable para una fecha real. + * + * @param d Fecha real con la cual se obtien la fecha de trabajo y la fecha + * contable. + * @param fieldname Nombre del campo, working o accounting + * @param m Map que contien indica si la fecha es laborable y/o contable. + * @return Date + * @throws Exception + */ + private Date getDate(APPDates d, String fieldname, Map m) throws Exception { + if (m.get(fieldname)) { + if (fieldname.compareTo("working") == 0) { + return d.getDate(); + } else if (this.validateDayOfTheMonth(d)) { + //Si es fecha contable verifica que el dia dentro del mes sea contable. + return d.getDate(); + } + } + APPDates daux = new APPDates(d.getDate(), CalculationBase.B365365); + int day = d.getField(Calendar.DAY_OF_WEEK); + boolean cont = true; + while (cont) { + day++; + if (day == 8) { + day = 1; + } + daux.addField(Calendar.DAY_OF_YEAR, 1); + if (fieldname.compareTo("accounting") == 0 && !this.validateDayOfTheMonth(daux)) { + //Si el dia es no contable continua + continue; + } + if (this.mdays.get(day).get(fieldname)) { + cont = false; + } + } + return daux.getDate(); + } + + /** + * Valida si el dia es contable dentro del mes, ejemplo 1 de enero no es + * contable. + * + * @param d Fecha verificar si el dia es contable. + * @return boolean + * @throws Exception + */ + private boolean validateDayOfTheMonth(APPDates d) throws Exception { + boolean isaccounting = true; + String mes = String.valueOf(d.getField(Calendar.MONTH)); + if (mes.length() == 1) { + mes = "0" + mes; + } + for (TgeneNotAccountingDay obj : lnotaccountingdays) { + if (obj.getPk().getCatalog().compareTo(mes) != 0) { + continue; + } + int day = d.getField(Calendar.DAY_OF_MONTH); + if (obj.getPk().getDay().compareTo(day) == 0) { + isaccounting = false; + break; + } + } + return isaccounting; + } + + @SuppressWarnings("unchecked") + private void fillMapDay(SaveRequest saveRequest) throws Exception { + List lobj = saveRequest.getSaveBeanModifiedRecords("LISTACCOUNTINDATE"); + if(lobj == null || lobj.isEmpty()){ + lobj = (List)saveRequest.get("LISTACCOUNTINDATE"); + } + boolean isworking = false; + boolean isaccounting = false; + + for (Object object : lobj) { + Map m = (Map) object; + Integer day = Integer.parseInt(m.get("day").toString()); + String working = m.get("teller").toString(); + String accounting = m.get("accounting").toString(); + Map maux = new HashMap(); + maux.put("working", Constant.ifYes(working)); + maux.put("accounting", Constant.ifYes(accounting)); + mdays.put(day, maux); + if(!isworking){ + isworking = Constant.ifYes(working); + } + if(!isaccounting){ + isaccounting = Constant.ifYes(accounting); + } + } + if(!isaccounting || !isworking){ + throw new GeneralException("GENE-0052", "INGRESE AL MENOS UN DA CONATBLE Y DE TRABAJO PARA GENERAR EL CALENDARIO"); + } + } + + /** + * Sentencia que se encarga de eliminar el calendario de fechas por sucursal + */ + private static String DEL = "delete from TgeneAccountingDate t " + + " where t.pk.branchcode = :branch " + + " and t.pk.companycode = :company " + + " and t.pk.realdate >= :datefrom "; + + /** + * Elimna fechas del calendario por sucursal y mayor a la fecha a regenerar + * el calendario. + * + * @param pBracnch Codigo de sucursal. + * @param pCompany Codigo de compania. + * @throws Exception + */ + private void delete(Integer pBracnch, Integer pCompany) throws Exception { + Query qry = PersistenceHelper.getEntityManager().createQuery(DEL); + qry.setParameter("branch", pBracnch); + qry.setParameter("company", pCompany); + qry.setParameter("datefrom", this.initdatedate); + qry.executeUpdate(); + } + /** + * Sentencia que se encarga de eliminar el calendario de fechas por sucursal + */ + private static String SQL_VAL = "select max(t.pk.realdate) from TgeneAccountingDate t " + + " where t.pk.branchcode = :branch " + + " and t.pk.companycode = :company " + + " and t.pk.realdate < :datefrom "; + + /** + * Valida que en la generacion de del calendario no exista huecos de fechas + * realres. + * + * @param pBracnch Codigo de sucursal. + * @param pCompany Codigo de compania. + * @throws Exception + */ + private void validateDatesByBranch(Integer pBracnch, Integer pCompany) throws Exception { + Query qry = PersistenceHelper.getEntityManager().createQuery(SQL_VAL); + qry.setParameter("branch", pBracnch); + qry.setParameter("company", pCompany); + qry.setParameter("datefrom", this.initdatedate); + Date d = (Date) qry.getSingleResult(); + if (d == null) { + return; + } + APPDates appd = new APPDates(d, CalculationBase.B365365); + appd.addField(Calendar.DAY_OF_YEAR, 1); + if (appd.getDate().compareTo(initdatedate) < 0) { + SimpleDateFormat fd = new SimpleDateFormat("dd-MM-yyyy"); + throw new GeneralException("GENE-0019", "EL CALENDARIO NO PUEDE DEJAR HUECOS PARA LA SUCURSAL: {0} FCONTABLE ANTERIOR: {1}", pBracnch, fd.format(d)); + } + TgeneAccountingDateBranch ad = DataHelper.getInstance().getTgeneAccountingDateBranch(pCompany, 0); + if (ad.getRealdate().compareTo(initdatedate) > 0) { + throw new GeneralException("GENE-0020", "FECHA DE INICIO PARA GENERAR CALENDARIO NO PUEDE SER MENOR A: {0}", + ad.getRealdate()); + } + } + + /** + * Metodo que se ejecuta en modo reverso + * + * @param saveRequest + * @return SaveRequest + * @throws Exception + */ + public SaveRequest reverseProcess(SaveRequest saveRequest) throws Exception { + //En este caso no hacer nada no existen reversos. + return saveRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/save/VerifyOverlapChargesAmount.java b/base/business/general/src/main/java/com/fp/general/rules/save/VerifyOverlapChargesAmount.java new file mode 100644 index 0000000..843512f --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/save/VerifyOverlapChargesAmount.java @@ -0,0 +1,91 @@ +package com.fp.general.rules.save; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.db.DataHelper; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.pgeneral.charge.TgeneCharges; + +/** + * Clase que se encarga de verificar traslape en montos de los cargos. + * + * @author Angel Merchan. + * @version 2.1 + * + */ +@SuppressWarnings("serial") +public class VerifyOverlapChargesAmount extends TransactionRule { + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (pSaveRequest.getSaveBean("TGENECHARGES") != null) { + this.validateTgeneCharges(pSaveRequest); + } + + return pSaveRequest; + } + + private void validateTgeneCharges(SaveRequest pSaveRequest) throws Exception { + String modulecode = pSaveRequest.get("modulecode").toString(); + List lChargesModified = pSaveRequest.getSaveBeanModifiedRecords("TGENECHARGES"); + List lChargesDeleted = pSaveRequest.getSaveBeanDeletedRecords("TGENECHARGES"); + List lChargesDatabase = DataHelper.getInstance().getTgeneChargesByModule(modulecode); + + List lChargesFinal = new ArrayList(); + + lChargesFinal = Constant.getFinalList(lChargesDatabase, Constant.convertList(lChargesModified, TgeneCharges.class), + Constant.convertList(lChargesDeleted, TgeneCharges.class)); + + for (int i = 0; i < lChargesFinal.size(); i++) { + TgeneCharges prodchargesfinal = lChargesFinal.get(i); + this.validateOverlapCharges(prodchargesfinal, i + 1, lChargesFinal); + } + } + + /** + * Metodo que verifica el traslape de montos de un cargo + * + * @param prodchargesfinal + * @param index + * @param listSubProductChargesFinal + * @throws Exception + */ + private void validateOverlapCharges(TgeneCharges chargesfinal, int index, List lChargesFinal) throws Exception { + BigDecimal minamount = chargesfinal.getMinamount(); + BigDecimal maxamount = chargesfinal.getMaxamount(); + + if (minamount.compareTo(maxamount) >= 0) { + throw new GeneralException("GENE-0040", "EL MONTO MNIMO DEBE SER MENOR AL MONTO MXIMO EN {0}", "[CARGOS GENERALES]"); + } + + for (int i = index; i < lChargesFinal.size(); i++) { + TgeneCharges prodcharges = lChargesFinal.get(i); + + if (chargesfinal.equalsWithoutSequence(prodcharges)) { + + BigDecimal minamountcmp = prodcharges.getMinamount(); + BigDecimal maxamountcmp = prodcharges.getMaxamount(); + + if (((minamount.compareTo(maxamountcmp) <= 0) && (minamount.compareTo(minamountcmp) >= 0)) + || ((minamount.compareTo(minamountcmp) >= 0) && (maxamount.compareTo(maxamountcmp) <= 0)) + || ((minamount.compareTo(minamountcmp) <= 0) && (maxamount.compareTo(maxamountcmp) >= 0)) + || ((maxamount.compareTo(minamountcmp) >= 0) && (maxamount.compareTo(maxamountcmp) <= 0))) { + throw new GeneralException("GENE-0041", "LOS VALORES PARA EL TIPO DE BALANCE {0} SE SOBREPONEN EN {1}", chargesfinal.getPk() + .getBalancetype(), "[CARGOS GENERALES]"); + } + } + prodcharges = null; + } + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/save/VerifyOverlapSubProductChargesAmount.java b/base/business/general/src/main/java/com/fp/general/rules/save/VerifyOverlapSubProductChargesAmount.java new file mode 100644 index 0000000..4a1d730 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/save/VerifyOverlapSubProductChargesAmount.java @@ -0,0 +1,95 @@ +package com.fp.general.rules.save; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.charge.TgeneSubProductCharges; + +/** + * Clase que se encarga de verificar traslape en montos de los cargos. + * + * @author Angel Merchan. + * @version 2.1 + * + */ +@SuppressWarnings("serial") +public class VerifyOverlapSubProductChargesAmount extends TransactionRule { + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (pSaveRequest.getSaveBean("TGENESUBPRODUCTCHARGES") != null) { + this.validateTgeneSubProductCharges(pSaveRequest); + } + + return pSaveRequest; + } + + private void validateTgeneSubProductCharges(SaveRequest pSaveRequest) throws Exception { + String modulecode = pSaveRequest.get("modulecode").toString(); + String productcode = pSaveRequest.get("productcode").toString(); + String subproductcode = pSaveRequest.get("subproductcode").toString(); + + List lSubProductChargesModified = pSaveRequest.getSaveBeanModifiedRecords("TGENESUBPRODUCTCHARGES"); + List lSubProductChargesDeleted = pSaveRequest.getSaveBeanDeletedRecords("TGENESUBPRODUCTCHARGES"); + List listSubProductChargesDatabase = TgeneSubProductCharges.find(PersistenceHelper.getEntityManager(), modulecode, + productcode, subproductcode); + List listSubProductChargesFinal = new ArrayList(); + + listSubProductChargesFinal = Constant.getFinalList(listSubProductChargesDatabase, + Constant.convertList(lSubProductChargesModified, TgeneSubProductCharges.class), + Constant.convertList(lSubProductChargesDeleted, TgeneSubProductCharges.class)); + + for (int i = 0; i < listSubProductChargesFinal.size(); i++) { + TgeneSubProductCharges prodchargesfinal = listSubProductChargesFinal.get(i); + this.validateOverlapSubProductCharges(prodchargesfinal, i + 1, listSubProductChargesFinal); + } + } + + /** + * Metodo que verifica el traslape de montos de un cargo + * + * @param prodchargesfinal + * @param index + * @param listSubProductChargesFinal + * @throws Exception + */ + private void validateOverlapSubProductCharges(TgeneSubProductCharges prodchargesfinal, int index, + List listSubProductChargesFinal) throws Exception { + BigDecimal minamount = prodchargesfinal.getMinamount(); + BigDecimal maxamount = prodchargesfinal.getMaxamount(); + + if (minamount.compareTo(maxamount) >= 0) { + throw new GeneralException("GENE-0040", "EL MONTO MNIMO DEBE SER MENOR AL MONTO MXIMO EN {0}", "[CARGOS POR SUBPRODUCTO]"); + } + + for (int i = index; i < listSubProductChargesFinal.size(); i++) { + TgeneSubProductCharges prodcharges = listSubProductChargesFinal.get(i); + + if (prodchargesfinal.equalsWithoutSequence(prodcharges)) { + BigDecimal minamountcmp = prodcharges.getMinamount(); + BigDecimal maxamountcmp = prodcharges.getMaxamount(); + + if (((minamount.compareTo(maxamountcmp) <= 0) && (minamount.compareTo(minamountcmp) >= 0)) + || ((minamount.compareTo(minamountcmp) >= 0) && (maxamount.compareTo(maxamountcmp) <= 0)) + || ((minamount.compareTo(minamountcmp) <= 0) && (maxamount.compareTo(maxamountcmp) >= 0)) + || ((maxamount.compareTo(minamountcmp) >= 0) && (maxamount.compareTo(maxamountcmp) <= 0))) { + throw new GeneralException("GENE-0041", "LOS VALORES PARA EL TIPO DE BALANCE {0} SE SOBREPONEN EN {1}", prodchargesfinal.getPk() + .getBalancetype(), "[CARGOS POR SUBPRODUCTO]"); + } + } + prodcharges = null; + } + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/scheduler/.svn/entries b/base/business/general/src/main/java/com/fp/general/rules/scheduler/.svn/entries new file mode 100644 index 0000000..0ee97f4 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/scheduler/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/rules/scheduler +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ChangeScheduleAccountingdate.java +file + + + + +2022-07-28T03:40:43.885808Z +18e455ff689cddb25b83c52a98d6ed25 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +864 + diff --git a/base/business/general/src/main/java/com/fp/general/rules/scheduler/.svn/text-base/ChangeScheduleAccountingdate.java.svn-base b/base/business/general/src/main/java/com/fp/general/rules/scheduler/.svn/text-base/ChangeScheduleAccountingdate.java.svn-base new file mode 100644 index 0000000..991aee6 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/scheduler/.svn/text-base/ChangeScheduleAccountingdate.java.svn-base @@ -0,0 +1,29 @@ +package com.fp.general.rules.scheduler; + +import com.fp.dto.Response; +import com.fp.dto.rules.ScheduleRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.rules.save.ChangeAccountingDate; + +/** + * Clase que se encarga de ejecutar automaticamente transaccion de cambio de fecha contable. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class ChangeScheduleAccountingdate implements ScheduleRule { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.ScheduleRule#execute(com.fp.dto.save.SaveRequest) + */ + @Override + public void execute(SaveRequest pSaveRequest) throws Exception { + Response res = new Response(Response.RESPONSE_OK, "OK"); + pSaveRequest.setResponse(res); + ChangeAccountingDate cad = new ChangeAccountingDate(); + cad.normalProcess(pSaveRequest); + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/rules/scheduler/ChangeScheduleAccountingdate.java b/base/business/general/src/main/java/com/fp/general/rules/scheduler/ChangeScheduleAccountingdate.java new file mode 100644 index 0000000..991aee6 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/rules/scheduler/ChangeScheduleAccountingdate.java @@ -0,0 +1,29 @@ +package com.fp.general.rules.scheduler; + +import com.fp.dto.Response; +import com.fp.dto.rules.ScheduleRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.rules.save.ChangeAccountingDate; + +/** + * Clase que se encarga de ejecutar automaticamente transaccion de cambio de fecha contable. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class ChangeScheduleAccountingdate implements ScheduleRule { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.ScheduleRule#execute(com.fp.dto.save.SaveRequest) + */ + @Override + public void execute(SaveRequest pSaveRequest) throws Exception { + Response res = new Response(Response.RESPONSE_OK, "OK"); + pSaveRequest.setResponse(res); + ChangeAccountingDate cad = new ChangeAccountingDate(); + cad.normalProcess(pSaveRequest); + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/scheduler/.svn/entries b/base/business/general/src/main/java/com/fp/general/scheduler/.svn/entries new file mode 100644 index 0000000..6a1bc57 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/scheduler/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/scheduler +svn://172.17.26.185/COMACO + + + +2014-09-11T06:56:07.548916Z +662 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +MiaScheduler.java +file + + + + +2022-07-28T03:40:44.287810Z +2cb6c966730bd3283cd5969cdcd3bfb0 +2014-09-11T06:56:07.548916Z +662 +jvaca + + + + + + + + + + + + + + + + + + + + + +3453 + +SchedulerJob.java +file + + + + +2022-07-28T03:40:44.287810Z +060ca3c7c2c25c32bd6eafde20c37331 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6910 + diff --git a/base/business/general/src/main/java/com/fp/general/scheduler/.svn/text-base/MiaScheduler.java.svn-base b/base/business/general/src/main/java/com/fp/general/scheduler/.svn/text-base/MiaScheduler.java.svn-base new file mode 100644 index 0000000..b25bc60 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/scheduler/.svn/text-base/MiaScheduler.java.svn-base @@ -0,0 +1,94 @@ +package com.fp.general.scheduler; + +import java.util.List; + +import org.quartz.CronTrigger; +import org.quartz.JobDataMap; +import org.quartz.JobDetail; +import org.quartz.Scheduler; +import org.quartz.SchedulerFactory; +import org.quartz.impl.StdSchedulerFactory; + +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.pgeneral.schedule.TgeneScheduleEvent; +import com.fp.persistence.pgeneral.schedule.TgeneScheduleParameters; + +/** + * Clase que se encarga de ejecutar tareas calendarizadas, que se parametrizan en TgeneSchdeleEven. + * @author Jorge Vaca + * @version 2.1 + */ +public class MiaScheduler { + + private MiaScheduler cahce; + private Scheduler scheduler; + + public void init() { + try { + SchedulerFactory sfact = new StdSchedulerFactory(); + scheduler = sfact.getScheduler(); + scheduler.start(); + //Obtine lista de eventos a procesar. + List ldata = TgeneScheduleEvent.find(PersistenceHelper.getEntityManager()); + if(ldata == null || ldata.isEmpty()){ + return; + } + TgeneScheduleParameters params = TgeneScheduleParameters.find(PersistenceHelper.getEntityManager(), + ThreadFacade.getSessionData().getCompany()); + if(params == null){ + throw new GeneralException("GENE-0034", "PARAMETROS PARA EJECUTAR TAREAS CALENDARIZADAS NO DEFINIDOS EN TGENSCHEDULEPARAMETERS", ThreadFacade.getSessionData().getCompany()); + } + //Calendariza tareas por evento. + for (TgeneScheduleEvent obj : ldata) { + //Va dentro del for para crear un nuevo JobDataMap de parametros por cada ejecucion. + JobDataMap jdm = this.fillMap(params); + this.processByEvent(obj,jdm); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Metodo que define tareas calendarizadas, de acuerdo a la definicion del evento. + * @param event Objeto que contien caracteristicas de ejecucion de un evento. + * @param jdm Map con parametros que se asocian a la tarea calendarizada. + * @throws Exception + */ + private void processByEvent(TgeneScheduleEvent event,JobDataMap jdm) throws Exception { + jdm.put("evento", event.getPk()); + //crea un jobdetail + JobDetail jd = new JobDetail(event.getPk(),event.getPk(), SchedulerJob.class); + jd.setJobDataMap(jdm); + //crea el cron segundos minutos horas diames mes diasemana + //CronTrigger ct = new CronTrigger(event.getPk(),event.getPk(), "0 05 15 ? * 2-6"); + String cron = ""+event.getExesecond()+" "+event.getExeminute()+" "+event.getExehour()+" ? * "+event.getBeginweekday()+"-"+event.getEndweekday(); + CronTrigger ct = new CronTrigger(event.getPk(),event.getPk(), cron); + scheduler.scheduleJob(jd, ct); + } + + /** + * Crea un map con los datos de parametros de ejecucion de una tarea automatica. + * @param params Parametros de ejecucion de tareas automaticas. + * @return JobDataMap + * @throws Exception + */ + private JobDataMap fillMap(TgeneScheduleParameters params) throws Exception { + JobDataMap jdm = new JobDataMap(); + jdm.put("cia", params.getPk()); + jdm.put("suc", params.getBranchcode()); + jdm.put("ofi", params.getOfficecode()); + jdm.put("area", params.getAreacode()); + jdm.put("ter", params.getTerminalcode()); + jdm.put("can", params.getChannelcode()); + jdm.put("usu", params.getUsercode()); + return jdm; + } + + public void detenerJob() throws Exception{ + scheduler.shutdown(); + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/scheduler/.svn/text-base/SchedulerJob.java.svn-base b/base/business/general/src/main/java/com/fp/general/scheduler/.svn/text-base/SchedulerJob.java.svn-base new file mode 100644 index 0000000..a622007 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/scheduler/.svn/text-base/SchedulerJob.java.svn-base @@ -0,0 +1,161 @@ +package com.fp.general.scheduler; + +import org.quartz.Job; +import org.quartz.JobDataMap; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + +import com.fp.common.exception.CommonException; +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.logger.APPLogger; +import com.fp.dto.rules.ScheduleRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.NestedSave; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.schedule.TgeneScheduleLog; +import com.fp.persistence.pgeneral.schedule.TgeneScheduleLogKey; +import com.fp.persistence.pgeneral.schedule.TgeneScheduleProcess; + +/** + * Clase que se encarga de ejecutar tareas calendarizadas, que se parametrizan en TgeneSchdeleEven. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class SchedulerJob implements Job { + + /* + * (non-Javadoc) + * + * @see org.quartz.Job#execute(org.quartz.JobExecutionContext) + */ + @Override + public void execute(JobExecutionContext context) throws JobExecutionException { + TgeneScheduleLog log = null; + Integer cia = null; + try { + JobDataMap jdm = context.getJobDetail().getJobDataMap(); + String event = jdm.getString("evento"); + APPLogger.getLogger().error("INICIA EJECUCION DE TAREA " + event); + // compania para obtener el entity manager + SessionData s = new SessionData(); + cia = jdm.getInt("cia"); + s.setCompany(cia); + + ThreadFacade.setSaveRequest(s); + PersistenceHelper.setEntityManager(PersistenceManager.getInstance().createEntityManagerLocal()); + PersistenceHelper.beginNewTransaction(); + // ejecuta la tarea calendarizada. + TgeneScheduleProcess process = TgeneScheduleProcess.find(PersistenceHelper.getEntityManager(), event); + SaveRequest saveRequest = this.fillSaveRequest(jdm, process); + // Fija resultado de ejecucion de la tarea + log = this.createTgeneScheduleLog(event, saveRequest); + this.processByRule(process, jdm, saveRequest); + PersistenceHelper.save(log); + PersistenceHelper.commitNewTransaction(); + } catch (Exception e) { + PersistenceHelper.rollbackNewTransaction(); + this.saveError(cia, e, log); + } finally { + PersistenceHelper.closeSession(); + } + } + + /** + * Metodo que se encarga de grabar el error que se genera en la ejecucion de la tarea calendarizada. + * + * @param exception Excepcion que contiene el error presentado. + * @throws Exception + */ + private void saveError(Integer cia, Exception exeption, TgeneScheduleLog log) { + try { + ExceptionHandler eh = new ExceptionHandler(exeption, "es"); + if (eh.getCode().length() > 20) { + log.setResultcode(eh.getCode().substring(0, 19)); + } else { + log.setResultcode(eh.getCode()); + } + if (eh.getUserMessage().length() > 399) { + log.setResultmessage(eh.getUserMessage().substring(0, 399)); + } else { + log.setResultmessage(eh.getUserMessage()); + } + new NestedSave(cia, log); + } catch (Exception e) { + APPLogger.getLogger().error(e, e); + } + + } + + /** + * Crea una instancia de TgeneScheduleLog, que almacena el resultado de la tarea calendarizada. + * + * @param pEvent codigo de evento de la tarea calendarizada. + * @param saveRequest Objeto que contiene el request de entrada de ejecucion de la tarea. + * @return TgeneScheduleLog + * @throws Exception + */ + private TgeneScheduleLog createTgeneScheduleLog(String pEvent, SaveRequest saveRequest) throws Exception { + TgeneScheduleLogKey key = new TgeneScheduleLogKey(); + key.setEventcode(pEvent); + key.setRealdate(FormatDates.getInstance().getDataBaseTimestamp()); + TgeneScheduleLog log = new TgeneScheduleLog(key); + TgeneAccountingDateBranch date = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + saveRequest.getCompany(), 0); + log.setProcessdate(date.getAccountingdate()); + log.setUsercode(saveRequest.getUser()); + log.setResultcode("0"); + log.setResultmessage("TRANSACCION REALIZADA CORRECTAMENTE"); + return log; + } + + /** + * Metodo encargado de ejecutar reglas de procesos calendarizados. + * + * @param pProcess Objeto que contiene la regla a ejecutar. + * @throws Exception + */ + private void processByRule(TgeneScheduleProcess pProcess, JobDataMap jdm, SaveRequest saveRequest) throws Exception { + ScheduleRule rule = null; + try { + rule = (ScheduleRule) Class.forName(pProcess.getProcesscode()).newInstance(); + } catch (ClassNotFoundException e) { + throw new CommonException("COMMON-0006", "REGLA {0} A EJECUTAR NO DEFINIDO MODULE: {1} TRANS: {2} VERSION {3}", + pProcess.getProcesscode(), e, saveRequest.getTransactionModule(), saveRequest.getTransactionCode(), + saveRequest.getTransactionVersion()); + } catch (ClassCastException e) { + throw new CommonException("COMMON-0007", "REGLA {0} A EJECUTAR MODULE: {1} TRANS: {2} VERSION {3} NO IMPLEMENTA {4}", e, + pProcess.getProcesscode(), saveRequest.getTransactionModule(), saveRequest.getTransactionCode(), + saveRequest.getTransactionVersion(), ScheduleRule.class.getName()); + } + rule.execute(saveRequest); + } + + /** + * Arma y entrega un objeto SaveRequest, utilizado en la ejecucion de transacciones. + * + * @param jdm Map con parametros necesarios para ejecutar una tarea calendarizada. + * @param process + * @return SaveRequest + * @throws Exception + */ + private SaveRequest fillSaveRequest(JobDataMap jdm, TgeneScheduleProcess process) throws Exception { + SaveRequest sq = new SaveRequest(); + sq.setCompany(jdm.getInt("cia")); + sq.setBranchCode(jdm.getInt("suc")); + sq.setOfficeCode(jdm.getInt("ofi")); + sq.setTerminalCode(jdm.getString("ter")); + sq.setChannelCode(jdm.getString("can")); + sq.setUser(jdm.getString("usu")); + sq.setTransactionModule(process.getTransactionmodule()); + sq.setTransactionCode(process.getTransactioncode()); + sq.setTransactionVersion(process.getTransactionversion()); + return sq; + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/scheduler/MiaScheduler.java b/base/business/general/src/main/java/com/fp/general/scheduler/MiaScheduler.java new file mode 100644 index 0000000..b25bc60 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/scheduler/MiaScheduler.java @@ -0,0 +1,94 @@ +package com.fp.general.scheduler; + +import java.util.List; + +import org.quartz.CronTrigger; +import org.quartz.JobDataMap; +import org.quartz.JobDetail; +import org.quartz.Scheduler; +import org.quartz.SchedulerFactory; +import org.quartz.impl.StdSchedulerFactory; + +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.pgeneral.schedule.TgeneScheduleEvent; +import com.fp.persistence.pgeneral.schedule.TgeneScheduleParameters; + +/** + * Clase que se encarga de ejecutar tareas calendarizadas, que se parametrizan en TgeneSchdeleEven. + * @author Jorge Vaca + * @version 2.1 + */ +public class MiaScheduler { + + private MiaScheduler cahce; + private Scheduler scheduler; + + public void init() { + try { + SchedulerFactory sfact = new StdSchedulerFactory(); + scheduler = sfact.getScheduler(); + scheduler.start(); + //Obtine lista de eventos a procesar. + List ldata = TgeneScheduleEvent.find(PersistenceHelper.getEntityManager()); + if(ldata == null || ldata.isEmpty()){ + return; + } + TgeneScheduleParameters params = TgeneScheduleParameters.find(PersistenceHelper.getEntityManager(), + ThreadFacade.getSessionData().getCompany()); + if(params == null){ + throw new GeneralException("GENE-0034", "PARAMETROS PARA EJECUTAR TAREAS CALENDARIZADAS NO DEFINIDOS EN TGENSCHEDULEPARAMETERS", ThreadFacade.getSessionData().getCompany()); + } + //Calendariza tareas por evento. + for (TgeneScheduleEvent obj : ldata) { + //Va dentro del for para crear un nuevo JobDataMap de parametros por cada ejecucion. + JobDataMap jdm = this.fillMap(params); + this.processByEvent(obj,jdm); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Metodo que define tareas calendarizadas, de acuerdo a la definicion del evento. + * @param event Objeto que contien caracteristicas de ejecucion de un evento. + * @param jdm Map con parametros que se asocian a la tarea calendarizada. + * @throws Exception + */ + private void processByEvent(TgeneScheduleEvent event,JobDataMap jdm) throws Exception { + jdm.put("evento", event.getPk()); + //crea un jobdetail + JobDetail jd = new JobDetail(event.getPk(),event.getPk(), SchedulerJob.class); + jd.setJobDataMap(jdm); + //crea el cron segundos minutos horas diames mes diasemana + //CronTrigger ct = new CronTrigger(event.getPk(),event.getPk(), "0 05 15 ? * 2-6"); + String cron = ""+event.getExesecond()+" "+event.getExeminute()+" "+event.getExehour()+" ? * "+event.getBeginweekday()+"-"+event.getEndweekday(); + CronTrigger ct = new CronTrigger(event.getPk(),event.getPk(), cron); + scheduler.scheduleJob(jd, ct); + } + + /** + * Crea un map con los datos de parametros de ejecucion de una tarea automatica. + * @param params Parametros de ejecucion de tareas automaticas. + * @return JobDataMap + * @throws Exception + */ + private JobDataMap fillMap(TgeneScheduleParameters params) throws Exception { + JobDataMap jdm = new JobDataMap(); + jdm.put("cia", params.getPk()); + jdm.put("suc", params.getBranchcode()); + jdm.put("ofi", params.getOfficecode()); + jdm.put("area", params.getAreacode()); + jdm.put("ter", params.getTerminalcode()); + jdm.put("can", params.getChannelcode()); + jdm.put("usu", params.getUsercode()); + return jdm; + } + + public void detenerJob() throws Exception{ + scheduler.shutdown(); + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/scheduler/SchedulerJob.java b/base/business/general/src/main/java/com/fp/general/scheduler/SchedulerJob.java new file mode 100644 index 0000000..a622007 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/scheduler/SchedulerJob.java @@ -0,0 +1,161 @@ +package com.fp.general.scheduler; + +import org.quartz.Job; +import org.quartz.JobDataMap; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + +import com.fp.common.exception.CommonException; +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.logger.APPLogger; +import com.fp.dto.rules.ScheduleRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.NestedSave; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.schedule.TgeneScheduleLog; +import com.fp.persistence.pgeneral.schedule.TgeneScheduleLogKey; +import com.fp.persistence.pgeneral.schedule.TgeneScheduleProcess; + +/** + * Clase que se encarga de ejecutar tareas calendarizadas, que se parametrizan en TgeneSchdeleEven. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class SchedulerJob implements Job { + + /* + * (non-Javadoc) + * + * @see org.quartz.Job#execute(org.quartz.JobExecutionContext) + */ + @Override + public void execute(JobExecutionContext context) throws JobExecutionException { + TgeneScheduleLog log = null; + Integer cia = null; + try { + JobDataMap jdm = context.getJobDetail().getJobDataMap(); + String event = jdm.getString("evento"); + APPLogger.getLogger().error("INICIA EJECUCION DE TAREA " + event); + // compania para obtener el entity manager + SessionData s = new SessionData(); + cia = jdm.getInt("cia"); + s.setCompany(cia); + + ThreadFacade.setSaveRequest(s); + PersistenceHelper.setEntityManager(PersistenceManager.getInstance().createEntityManagerLocal()); + PersistenceHelper.beginNewTransaction(); + // ejecuta la tarea calendarizada. + TgeneScheduleProcess process = TgeneScheduleProcess.find(PersistenceHelper.getEntityManager(), event); + SaveRequest saveRequest = this.fillSaveRequest(jdm, process); + // Fija resultado de ejecucion de la tarea + log = this.createTgeneScheduleLog(event, saveRequest); + this.processByRule(process, jdm, saveRequest); + PersistenceHelper.save(log); + PersistenceHelper.commitNewTransaction(); + } catch (Exception e) { + PersistenceHelper.rollbackNewTransaction(); + this.saveError(cia, e, log); + } finally { + PersistenceHelper.closeSession(); + } + } + + /** + * Metodo que se encarga de grabar el error que se genera en la ejecucion de la tarea calendarizada. + * + * @param exception Excepcion que contiene el error presentado. + * @throws Exception + */ + private void saveError(Integer cia, Exception exeption, TgeneScheduleLog log) { + try { + ExceptionHandler eh = new ExceptionHandler(exeption, "es"); + if (eh.getCode().length() > 20) { + log.setResultcode(eh.getCode().substring(0, 19)); + } else { + log.setResultcode(eh.getCode()); + } + if (eh.getUserMessage().length() > 399) { + log.setResultmessage(eh.getUserMessage().substring(0, 399)); + } else { + log.setResultmessage(eh.getUserMessage()); + } + new NestedSave(cia, log); + } catch (Exception e) { + APPLogger.getLogger().error(e, e); + } + + } + + /** + * Crea una instancia de TgeneScheduleLog, que almacena el resultado de la tarea calendarizada. + * + * @param pEvent codigo de evento de la tarea calendarizada. + * @param saveRequest Objeto que contiene el request de entrada de ejecucion de la tarea. + * @return TgeneScheduleLog + * @throws Exception + */ + private TgeneScheduleLog createTgeneScheduleLog(String pEvent, SaveRequest saveRequest) throws Exception { + TgeneScheduleLogKey key = new TgeneScheduleLogKey(); + key.setEventcode(pEvent); + key.setRealdate(FormatDates.getInstance().getDataBaseTimestamp()); + TgeneScheduleLog log = new TgeneScheduleLog(key); + TgeneAccountingDateBranch date = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + saveRequest.getCompany(), 0); + log.setProcessdate(date.getAccountingdate()); + log.setUsercode(saveRequest.getUser()); + log.setResultcode("0"); + log.setResultmessage("TRANSACCION REALIZADA CORRECTAMENTE"); + return log; + } + + /** + * Metodo encargado de ejecutar reglas de procesos calendarizados. + * + * @param pProcess Objeto que contiene la regla a ejecutar. + * @throws Exception + */ + private void processByRule(TgeneScheduleProcess pProcess, JobDataMap jdm, SaveRequest saveRequest) throws Exception { + ScheduleRule rule = null; + try { + rule = (ScheduleRule) Class.forName(pProcess.getProcesscode()).newInstance(); + } catch (ClassNotFoundException e) { + throw new CommonException("COMMON-0006", "REGLA {0} A EJECUTAR NO DEFINIDO MODULE: {1} TRANS: {2} VERSION {3}", + pProcess.getProcesscode(), e, saveRequest.getTransactionModule(), saveRequest.getTransactionCode(), + saveRequest.getTransactionVersion()); + } catch (ClassCastException e) { + throw new CommonException("COMMON-0007", "REGLA {0} A EJECUTAR MODULE: {1} TRANS: {2} VERSION {3} NO IMPLEMENTA {4}", e, + pProcess.getProcesscode(), saveRequest.getTransactionModule(), saveRequest.getTransactionCode(), + saveRequest.getTransactionVersion(), ScheduleRule.class.getName()); + } + rule.execute(saveRequest); + } + + /** + * Arma y entrega un objeto SaveRequest, utilizado en la ejecucion de transacciones. + * + * @param jdm Map con parametros necesarios para ejecutar una tarea calendarizada. + * @param process + * @return SaveRequest + * @throws Exception + */ + private SaveRequest fillSaveRequest(JobDataMap jdm, TgeneScheduleProcess process) throws Exception { + SaveRequest sq = new SaveRequest(); + sq.setCompany(jdm.getInt("cia")); + sq.setBranchCode(jdm.getInt("suc")); + sq.setOfficeCode(jdm.getInt("ofi")); + sq.setTerminalCode(jdm.getString("ter")); + sq.setChannelCode(jdm.getString("can")); + sq.setUser(jdm.getString("usu")); + sq.setTransactionModule(process.getTransactionmodule()); + sq.setTransactionCode(process.getTransactioncode()); + sq.setTransactionVersion(process.getTransactionversion()); + return sq; + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/score/.svn/entries b/base/business/general/src/main/java/com/fp/general/score/.svn/entries new file mode 100644 index 0000000..e4b4855 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/score/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/score +svn://172.17.26.185/COMACO + + + +2015-06-23T07:19:44.493659Z +4130 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +save +dir + diff --git a/base/business/general/src/main/java/com/fp/general/score/save/.svn/entries b/base/business/general/src/main/java/com/fp/general/score/save/.svn/entries new file mode 100644 index 0000000..bebaf78 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/score/save/.svn/entries @@ -0,0 +1,198 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/score/save +svn://172.17.26.185/COMACO + + + +2015-06-23T07:19:44.493659Z +4130 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +UploadLineScoreThread.java +file + + + + +2022-07-28T03:40:43.988808Z +1badfe39e6a7a840325fcab89029a4dd +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7987 + +SafeScoreHeaderDetail.java +file + + + + +2022-07-28T03:40:43.988808Z +788ab83be4b7c910f2d9979887bfe27c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2187 + +UploadFileScoreThread.java +file + + + + +2022-07-28T03:40:43.988808Z +214e0b7cc5701c36e3f29e2624875ea4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +10619 + +SafeFileScore.java +file + + + + +2022-07-28T03:40:43.988808Z +d697bbe885c7126512273e2a9a3476e9 +2015-06-23T07:19:44.493659Z +4130 +cpiedra + + + + + + + + + + + + + + + + + + + + + +4515 + +FileScore.java +file + + + + +2022-07-28T03:40:43.989808Z +8ec5885ba20fef957f79449e45855fb9 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7212 + diff --git a/base/business/general/src/main/java/com/fp/general/score/save/.svn/text-base/FileScore.java.svn-base b/base/business/general/src/main/java/com/fp/general/score/save/.svn/text-base/FileScore.java.svn-base new file mode 100644 index 0000000..4d3ec0a --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/score/save/.svn/text-base/FileScore.java.svn-base @@ -0,0 +1,138 @@ +package com.fp.general.score.save; + +import com.fp.dto.save.SaveRequest; +import com.fp.excel.ExcelToMap; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.score.TgeneScoreAdjustment; +import com.fp.persistence.pgeneral.score.TgeneScoreAdjustmentKey; +import com.fp.persistence.pgeneral.score.TgeneScoreHeader; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.image.TgeneFilesDetailKey; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.sql.Timestamp; +/** + * Clase que graba la data recibida de Excel en la tabla TGENESCOREADJUSTMENT + * + * @author BPTWPA + */ +public class FileScore { + + /** + * Mtodo que graba en la base de datos las calificaciones de cartera subidas en excel + * + * @param tgeneScoreHeader Objeto TgeneScoreHeader + * @param excelMap Mapa obtenido del archivo de excel + * @throws Exception + */ + public List loadScore(TgeneScoreHeader tgeneScoreHeader, SaveRequest sr, Integer filecode) throws Exception { + List lTgeneScoreAdjustment = new ArrayList(); + Map mapExcel = null; + TgeneFilesDetail filesDetail = TgeneFilesDetail.find(PersistenceHelper.getEntityManager(), new TgeneFilesDetailKey(filecode, + FormatDates.getDefaultExpiryTimestamp())); + if (tgeneScoreHeader != null && filesDetail != null) { + if (filesDetail.getExtension().equals("xls") || filesDetail.getExtension().equals("xlsx")) { + ExcelToMap excelMap = new ExcelToMap(filesDetail.getImage(), filesDetail.getExtension()); + mapExcel = excelMap.getExcelMap(); + if (mapExcel != null || !mapExcel.isEmpty()) { + Integer rows = (mapExcel.size() / 8)-1; + for (int i = 1; i <= rows ; i++) { + TgeneScoreAdjustment tgeneScoreAdjustment = new TgeneScoreAdjustment(); + TgeneScoreAdjustmentKey key = new TgeneScoreAdjustmentKey(); + for (int j = 0; j < 8; j++) { + String parameter = i + ":" + j; + Object value = null; + switch (j) { + case 0: //COMPANIA + if(!(tgeneScoreHeader.getPk().getScoredate().compareTo((Date) mapExcel.get(parameter)) == 0)){ + throw new GeneralException("GENE-0043", "LA FECHA DEL ARCHIVO NO CONCUERDA CON LA SELECCIONADA"); + } + + this.contentParameter(parameter, mapExcel); + key.setScoredate(new Timestamp(tgeneScoreHeader.getPk().getScoredate().getTime())); + + break; + case 1: //CUENTA + this.contentParameter(parameter, mapExcel); + value = mapExcel.get(parameter); + key.setAccount(String.valueOf(value)); + tgeneScoreAdjustment.setPk(key); + break; + case 2: //MODULO + this.contentParameter(parameter, mapExcel); + value = mapExcel.get(parameter); + tgeneScoreAdjustment.setModulecode(String.valueOf(value)); + break; + case 3: //PRODUCTO + this.contentParameter(parameter, mapExcel); + value = mapExcel.get(parameter); + tgeneScoreAdjustment.setProductcode(String.valueOf(value)); + break; + case 4: //SUBPRODUCTO + this.contentParameter(parameter, mapExcel); + value = mapExcel.get(parameter); + tgeneScoreAdjustment.setSubproductcode(String.valueOf(value)); + break; + case 5: //MONEDA + this.contentParameter(parameter, mapExcel); + value = mapExcel.get(parameter); + tgeneScoreAdjustment.setCurrencycode(String.valueOf(value)); + break; + case 6: //PORCENTAJE PROVISION + this.contentParameter(parameter, mapExcel); + value = mapExcel.get(parameter); + tgeneScoreAdjustment.setManualprovisionpercent(new BigDecimal(value.getClass().getSimpleName().equals("BigDecimal") ? String.valueOf(value) : "0")); + break; + case 7: //TIPO AJUSTE, JOURNAL ID + this.contentParameter(parameter, mapExcel); + this.verifyFile(parameter, mapExcel); + value = mapExcel.get(parameter); + tgeneScoreAdjustment.setAdjustmenttype(String.valueOf(value)); + tgeneScoreAdjustment.setJournalid(sr.getJournalId()); + break; + default: + break; + } + } + lTgeneScoreAdjustment.add(tgeneScoreAdjustment); + } + } + } else { + throw new GeneralException("GENE-0043", "El ARCHIVO NO ES EL CORRECTO - CALIFICACION CARTERA"); + } + } + + return lTgeneScoreAdjustment; + } + + /** + * Mtodo que valida que el valor que viene en el archivo sea el correcto + * @param parameter + * @param mapExcel + * @throws Exception + */ + private void contentParameter(String parameter, Map mapExcel) throws Exception { + if (!mapExcel.containsKey(parameter)) { + throw new GeneralException("GENE-0044", "PARMETRO NO ENCONTRADO"); + } + } + + /** + * Mtodo que valida que el archivo sea el correcto + * @param parameter + * @param mapExcel + * @throws Exception + */ + private void verifyFile(String parameter, Map mapExcel) throws Exception { + this.contentParameter(parameter, mapExcel); + String value = (String) mapExcel.get(parameter); //Object + if (!(String.valueOf(value).compareTo("F") == 0)) { + throw new GeneralException("GENE-0043", "El ARCHIVO NO ES EL CORRECTO - CALIFICACION CARTERA"); + } + } +} diff --git a/base/business/general/src/main/java/com/fp/general/score/save/.svn/text-base/SafeFileScore.java.svn-base b/base/business/general/src/main/java/com/fp/general/score/save/.svn/text-base/SafeFileScore.java.svn-base new file mode 100644 index 0000000..3c4ef10 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/score/save/.svn/text-base/SafeFileScore.java.svn-base @@ -0,0 +1,103 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.general.score.save; + +import com.fp.dto.helper.FileHelper; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.image.TgeneFiles; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.image.TgeneFilesDetailKey; +import com.fp.sessionbeans.helper.Sequence; +import java.util.List; + +/** + * Clase que sube un archivo + * @author pgalindo + */ +public class SafeFileScore extends TransactionRule { + + @Override + public SaveRequest normalProcess(SaveRequest sr) throws Exception { + TgeneFilesDetail filesDetail = null; + Integer filecode = null; + String xlsfile = sr.getString("xlsFile"); + if (xlsfile.compareTo("YES") == 0) { + List fileItem = (List) sr.get("file"); + if ((fileItem == null || !fileItem.isEmpty())) { + String code = sr.getString("filecode"); + filecode = ((code.compareTo("") == 0) ? null : Integer.valueOf(code)); + if (filecode == null) { + filesDetail = this.createImage(sr, fileItem); + filecode = filesDetail.getPk().getCode(); + } else { + filecode = sr.getInteger("filecode"); + filesDetail = this.upDateImage(sr, fileItem, filecode); + filecode = filesDetail.getPk().getCode(); + } + sr.getResponse().put("codes", "[" + filecode + "]"); + } + } + return sr; + } + + @Override + public SaveRequest reverseProcess(SaveRequest sr) throws Exception { + return sr; + } + + /** + * Metodo que crea un nuevo registro en la tabla TGENEFILESDETAIL + * @param pSaveRequest + * @param imageItem + * @return TgeneFilesDetail + * @throws Exception + */ + private TgeneFilesDetail createImage(SaveRequest pSaveRequest, List imageItem) throws Exception { + Sequence sequence = new Sequence(); + Integer filecode = Integer.valueOf(sequence.getNextValue("FILECODE").toString()); + TgeneFiles tgeneFiles = new TgeneFiles(filecode); + PersistenceHelper.save(tgeneFiles); + TgeneFilesDetailKey tgeneFilesDetailKey = new TgeneFilesDetailKey(filecode, FormatDates.getDefaultExpiryTimestamp()); + TgeneFilesDetail tgeneFilesDetail = new TgeneFilesDetail(); + tgeneFilesDetail.setPk(tgeneFilesDetailKey); + tgeneFilesDetail.setImage(imageItem.get(0).getImage()); + tgeneFilesDetail.setCapturedate(FormatDates.getInstance().getDataBaseDate()); + tgeneFilesDetail.setImagesize(Integer.parseInt(String.valueOf(imageItem.get(0).getSize()))); + tgeneFilesDetail.setIngressuser(pSaveRequest.getUser()); + tgeneFilesDetail.setExtension(imageItem.get(0).getExtension()); + PersistenceHelper.save(tgeneFilesDetail); + return tgeneFilesDetail; + } + + /** + * Metodo que actualiza el registro de la tabla TGENEFILESDETAIL + * @param pSaveRequest + * @param imageItem + * @param imagecode + * @return + * @throws Exception + */ + private TgeneFilesDetail upDateImage(SaveRequest pSaveRequest, List imageItem, Integer imagecode) throws Exception { + TgeneFilesDetail tgeneFilesDetail = null; + TgeneFiles tgeneFiles = TgeneFiles.find(PersistenceHelper.getEntityManager(), imagecode); + if (tgeneFiles != null) { + TgeneFilesDetailKey filesDetailKey = new TgeneFilesDetailKey(tgeneFiles.getPk(), FormatDates.getDefaultExpiryTimestamp()); + + tgeneFilesDetail = TgeneFilesDetail.find(PersistenceHelper.getEntityManager(), filesDetailKey); + if (tgeneFilesDetail != null) { + tgeneFilesDetail.setImage(imageItem.get(0).getImage()); + tgeneFilesDetail.setCapturedate(FormatDates.getInstance().getDataBaseDate()); + tgeneFilesDetail.setImagesize(Integer.parseInt(String.valueOf(imageItem.get(0).getSize()))); + tgeneFilesDetail.setModifyuser(pSaveRequest.getUser()); + tgeneFilesDetail.setExtension(imageItem.get(0).getExtension()); + PersistenceHelper.update(tgeneFilesDetail); + } + } + return tgeneFilesDetail; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/score/save/.svn/text-base/SafeScoreHeaderDetail.java.svn-base b/base/business/general/src/main/java/com/fp/general/score/save/.svn/text-base/SafeScoreHeaderDetail.java.svn-base new file mode 100644 index 0000000..c6dbd2a --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/score/save/.svn/text-base/SafeScoreHeaderDetail.java.svn-base @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.general.score.save; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.pgeneral.score.TgeneScoreAdjustment; +import com.fp.persistence.pgeneral.score.TgeneScoreHeader; +import com.fp.persistence.pgeneral.score.TgeneScoreHeaderKey; +import java.sql.Date; +import java.util.List; + +/** + * + * @author pgalindo + */ +public class SafeScoreHeaderDetail extends TransactionRule { + + @Override + public SaveRequest normalProcess(SaveRequest sr) throws Exception { + TgeneScoreHeader scoreHeader = null; + List lTgeneScoreAdjustment = null; + FileScore scoreAdjustment = new FileScore(); + String xlsfile = sr.getString("xlsFile"); + //String pk = (String) sr.get("pk_scoredate"); + //APPDates date = new APPDates(pk); + if (xlsfile.compareTo("NO") == 0) { + Date scoredate = sr.getDate("scoredate"); + Integer company = sr.getInteger("companycode"); + Integer filecode = sr.getInteger("filecode"); + + scoreHeader = this.saveHeader(scoredate, company, filecode); + lTgeneScoreAdjustment = scoreAdjustment.loadScore(scoreHeader, sr, filecode); + sr.putSaveBean("TGENESCOREHEADER", scoreHeader, 1); + sr.putSaveBean("TGENESCOREADJUSTMENT", lTgeneScoreAdjustment, 2); + // GRABAR CALIFICACION MANUAL + } + return sr; + } + + @Override + public SaveRequest reverseProcess(SaveRequest sr) throws Exception { + return sr; + } + + /** + * Metodo que graba la cabecera de la tabla de calificacion + * @param sr + * @return + * @throws Exception + */ + private TgeneScoreHeader saveHeader(Date scoredate, Integer companycode, Integer filecode) throws Exception { + TgeneScoreHeader tgeneScoreHeader = new TgeneScoreHeader(); + tgeneScoreHeader.setPk(new TgeneScoreHeaderKey(scoredate, companycode)); + tgeneScoreHeader.setFilecode(filecode); //PGA + tgeneScoreHeader.setTabulated("N"); + return tgeneScoreHeader; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/score/save/.svn/text-base/UploadFileScoreThread.java.svn-base b/base/business/general/src/main/java/com/fp/general/score/save/.svn/text-base/UploadFileScoreThread.java.svn-base new file mode 100644 index 0000000..b225c2c --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/score/save/.svn/text-base/UploadFileScoreThread.java.svn-base @@ -0,0 +1,259 @@ +package com.fp.general.score.save; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.sql.Date; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import org.apache.commons.lang.StringUtils; + +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.logger.APPLogger; +import com.fp.dto.save.SaveRequest; +import com.fp.loan.exception.LoanException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.score.TgeneScoreAdjustment; +//import com.fp.persistence.ploan.acco.TloanPaymentBankProcess; + +/** + * Clase que se encarga de procesar un archivo con informacin de pagos de crditos procedente de una canal de + * recaudacin + * + * @author Omar Villanueva + * @version 2.1 + */ +public class UploadFileScoreThread extends Thread { + + private final Integer company; + + /* Arvhivo a procesar */ + private final File file; + + /* Institucin financiera a la que pertenece el archivo */ + private final String bank; + + /* Directorio destino para el archivo luego de procesarlo */ + private final StringBuilder targetPath; + + /* + * Map para los formatos de nombres de archivos de las instituciones financieras parametrizadas en + * TLOANPAYMENTACCOBANK + */ + private final Map mFileName; + + /* + * Map para los numeros de hilos que se puede procesar en paralelo por cada una de las instituciones financieras + * parametrizadas en TLOANPAYMENTACCOBANK + */ + private final Map mThreads; + + /* String para almacenar el log de errores en la carga de los archivos para mostrar al usuario en el front end */ + private final StringBuilder sbLog; + + /* Separador de linea */ + private final String new_line = System.getProperty("line.separator"); + + private final SaveRequest sr; + + + + /** + * Constructor + * + * @param company + * @param file + * @param bank + * @param targetPath + * @param mFileName + * @param mThreads + * @param sbLog + */ + public UploadFileScoreThread(Integer company, File file, String bank, StringBuilder targetPath, Map mFileName, + Map mThreads, StringBuilder sbLog, SaveRequest sr) { + super(); + this.company = company; + this.file = file; + this.bank = bank; + this.targetPath = targetPath; + this.mFileName = mFileName; + this.mThreads = mThreads; + this.sbLog = sbLog; + this.sr=sr; + } + + @Override + public void run() { + // boolean success = true; + try { + SessionData s = new SessionData(); + s.setCompany(company); + ThreadFacade.setSaveRequest(s); + PersistenceHelper.setEntityManager(PersistenceManager.getInstance().createEntityManagerLocal()); + PersistenceHelper.beginNewTransaction(); + /* Procesar archivo */ + process(); + PersistenceHelper.commitNewTransaction(); + /* Mover el archivo si la carga fue exitosa */ + moveFile(); + } catch (Exception e) { + // success = false; + PersistenceHelper.rollbackNewTransaction(); + ExceptionHandler eh = new ExceptionHandler(e, "es"); + APPLogger.getLogger().error("codigo ==>" + eh.getCode()); + APPLogger.getLogger().error("user ==>" + eh.getUserMessage()); + APPLogger.getLogger().error("technical ==>" + eh.getTechnicalMessage()); + APPLogger.getLogger().error("stacktrace ==>" + eh.getStackTrace()); + } finally { + PersistenceHelper.closeSession(); + } + // /* Mover el archivo si la carga fue exitosa */ + // if (success) { + // try { + // moveFile(); + // } catch (Exception e) { + // e.printStackTrace(); + // } + // } + } + + /** + * Mtodo que procesa el archivo. Carga la data en la tabla TGENESCOREADJUSTMENT(---TLOANPAYMENTBANKPROCESS). Lanza un hilo por cada linea + * que contiene el arvhivo. Se pueden lanzar varios hilos en paralelo. El numero mximo de hilos esta determinado + * por el parametro threads fijado en la tabla TLOANPAYMENTACCOBANK + * + * @throws Exception + */ + private void process() throws Exception { + /* Verificar si el archivo ya fue cargado anteriormente */ + //String fileExist = TloanPaymentBankProcess.find(PersistenceHelper.getEntityManager(), company, file.getName()); + String fileExist = TgeneScoreAdjustment.find(PersistenceHelper.getEntityManager(), company, file.getName()); + + if (fileExist != null) { + sbLog.append(new LoanException("LOAN-0049", "EL ARCHIVO: {0} YA FUE CARGADO ANTERIORMENTE", file.getName()).getMessage()) + .append(new_line); + throw new LoanException("LOAN-0049", "EL ARCHIVO: {0} YA FUE CARGADO ANTERIORMENTE", file.getName()); + } + /* Verificar si el numero de hilos esta definido */ + if (mThreads.get(bank) == null || mThreads.get(bank).compareTo(0) <= 0) { + /* Agrega el mensaje al log de errores */ + sbLog.append( + new LoanException("LOAN-0041", "NUMERO DE HILOS NO DEFINIDO EN TLOANPAYMENTACCOBANK PARA INSTITUCION FINANCIERA: {0}", bank) + .getMessage()).append(new_line); + throw new LoanException("LOAN-0041", "NUMERO DE HILOS NO DEFINIDO EN TLOANPAYMENTACCOBANK PARA INSTITUCION FINANCIERA: {0}", bank); + } + ExecutorService pool = Executors.newFixedThreadPool(mThreads.get(bank)); + /* Obtener la fecha de pago del archivo a procesar */ + Date paymentDate = getDateFromFile(); + try { + BufferedReader input = new BufferedReader(new FileReader(file)); + try { + String line = null; + int sequence = 0; + Timestamp realDate = FormatDates.getInstance().getDataBaseTimestamp(); + while ((line = input.readLine()) != null) { + sequence++; + /* Se lanza un hilo por cada linea del archivo que se debe procesar */ + UploadLineScoreThread ult = new UploadLineScoreThread(company, file, bank, line, sequence, realDate, paymentDate, sr); + pool.execute(ult); + } + } catch (IOException ioe) { + throw ioe; + } finally { + input.close(); + } + } catch (IOException ioe) { + throw ioe; + } + pool.shutdown(); + boolean isfinish = pool.isTerminated(); + while (!isfinish) { + isfinish = pool.isTerminated(); + Thread.sleep(600); + } + } + + /** + * Mtodo que obtiene la fecha desde el arvhivo proporcionado por el canal de recaudacin. Esta es la fecha de pago + * de la cuota del crdito + * + * @return + * @throws Exception + */ + private Date getDateFromFile() throws Exception { + Date date = null; + String fileName = StringUtils.remove(mFileName.get(bank), '-'); + int positionDate = fileName.indexOf("ddMM"); + /* Procesa archivos que contengan el formato ddMM */ + if (positionDate < 0) { + /* Agrega el mensaje al log de errores */ + sbLog.append( + new LoanException("LOAN-0038", "FECHA INCORRECTAMENTE DEFINIDA EN TLOANPAYMENTACCOBANK PARA INSTITUCIN FINANCIERA: {0}", bank) + .getMessage()).append(new_line); + throw new LoanException("LOAN-0038", "FECHA INCORRECTAMENTE DEFINIDA EN TLOANPAYMENTACCOBANK PARA INSTITUCIN FINANCIERA: {0}", bank); + } + if (bank.compareTo("SP") == 0) { + String formatDate = mFileName.get(bank).substring(positionDate, positionDate + 10); + String strDate = file.getName().trim().substring(positionDate, positionDate + 10); + date = getDateByFormat(strDate, formatDate); + } + + return date; + } + + /** + * Mtodo que devuelve la fecha segn el formato requerido + * + * @param pStrDate + * @param pFormat + * @return + * @throws Exception + */ + private Date getDateByFormat(String pStrDate, String pFormat) throws Exception { + Date date = null; + try { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pFormat); + date = new Date(simpleDateFormat.parse(pStrDate).getTime()); + } catch (Exception e) { + /* Agrega el mensaje al log de errores */ + sbLog.append( + new LoanException( + "LOAN-0050", + "EL FORMATO DE FECHA DEL ARCHIVO: {0} NO COINCIDE CON EL DEFINIDO EN TLOANPAYMENTACCOBANK PARA INSTITUCIN FINANCIERA: {1}", + file.getName(), bank).getMessage()).append(new_line); + throw new LoanException("LOAN-0050", + "EL FORMATO DE FECHA DEL ARCHIVO: {0} NO COINCIDE CON EL DEFINIDO EN TLOANPAYMENTACCOBANK PARA INSTITUCIN FINANCIERA: {1}", + file.getName(), bank); + } + + return date; + } + + /** + * Mtodo que mueve el archivo ya procesado al directorio destino + * + * @throws Exception + */ + private void moveFile() throws Exception { + /* Directorio destino */ + File targetDir = new File(targetPath.toString()); + + /* Mover el archivo al nuevo directorio */ + boolean success = file.renameTo(new File(targetDir, file.getName())); + if (!success) { + /* Agrega el mensaje al log de errores */ + sbLog.append(new LoanException("LOAN-0040", "EL ARCHIVO {0} ESTA SIENDO USADO POR OTRO PROCESO", file.getName()).getMessage()).append( + new_line); + throw new LoanException("LOAN-0040", "EL ARCHIVO {0} ESTA SIENDO USADO POR OTRO PROCESO", file.getName()); + } + } +} diff --git a/base/business/general/src/main/java/com/fp/general/score/save/.svn/text-base/UploadLineScoreThread.java.svn-base b/base/business/general/src/main/java/com/fp/general/score/save/.svn/text-base/UploadLineScoreThread.java.svn-base new file mode 100644 index 0000000..8006fa9 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/score/save/.svn/text-base/UploadLineScoreThread.java.svn-base @@ -0,0 +1,232 @@ +package com.fp.general.score.save; + +import java.io.File; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; + +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.helper.BeanManager; +import com.fp.common.logger.APPLogger; +import com.fp.dto.save.SaveRequest; +import com.fp.loan.exception.LoanException; +import com.fp.persistence.commondb.NestedSave; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.pgeneral.score.TgeneScoreAdjustment; +import com.fp.persistence.pgeneral.score.TgeneScoreAdjustmentKey; +import com.fp.persistence.pgeneral.score.TgeneScoreFileIssues; +import com.fp.persistence.pgeneral.score.TgeneScoreFileIssuesKey; +import com.fp.persistence.pgeneral.score.TgeneScoreHeader; +import com.fp.persistence.pgeneral.score.TgeneScoreHeaderKey; + + +/** + * Clase que se encarga de procesar una linea de archivo con informacin de pagos de crditos procedente de una canal de + * recaudacin + * + * @author Omar Villanueva + * @version 2.1 + */ +public class UploadLineScoreThread extends Thread { + + private final Integer company; + + /* Arvhivo a procesar */ + private final File file; + + /* Institucin financiera a la que pertenece el archivo */ + // private final String bank; + + /* Nmero de Operacin */ + private final String account; + + /* Linea del archivo a procesar */ + private final String line; + + /* Nmero de linea que se esta procesando */ + private final int sequence; + + private final Timestamp realDate; + + /* Fecha de pago de la cuota del crdito */ + //private final Date paymentDate; + + /* Fecha de calififacin */ + private final Date scoreDate; + + private final SaveRequest sr; + + /** + * Constructor + * + * @param company + * @param file + * @param account + * @param line + * @param sequence + * @param realDate + * @param scoreDate + */ + public UploadLineScoreThread(Integer company, File file, String account, String line, int sequence, Timestamp realDate, Date scoreDate, SaveRequest sr) { + super(); + this.company = company; + this.file = file; + this.account = account; + this.line = line; + this.sequence = sequence; + this.realDate = realDate; + this.scoreDate = scoreDate; + this.sr=sr; + } + + @Override + public void run() { + try { + SessionData s = new SessionData(); + s.setCompany(company); + ThreadFacade.setSaveRequest(s); + PersistenceHelper.setEntityManager(PersistenceManager.getInstance().createEntityManagerLocal()); + PersistenceHelper.beginNewTransaction(); + /* Procesar la linea de archivo */ + process(); + PersistenceHelper.commitNewTransaction(); + } catch (Exception e) { + PersistenceHelper.rollbackNewTransaction(); + ExceptionHandler eh = new ExceptionHandler(e, "es"); + APPLogger.getLogger().error("codigo ==>" + eh.getCode()); + APPLogger.getLogger().error("user ==>" + eh.getUserMessage()); + APPLogger.getLogger().error("technical ==>" + eh.getTechnicalMessage()); + APPLogger.getLogger().error("stacktrace ==>" + eh.getStackTrace()); + try { + /* Guarda en TLOANPAYMENTBANKISSUES informacin de las lineas con problemas */ + LogUploadIssues(eh); + } catch (Exception e1) { + e1.printStackTrace(); + } + } finally { + PersistenceHelper.closeSession(); + } + } + + /** + * Mtodo que procesa la linea de archivo. Carga la data en la tabla TLOANPAYMENTBANKPROCESS + * + * @throws Exception + */ + private void process() throws Exception { + processSP(); + processHeader(); + } + + /** + * Mtodo que procesa las lineas de archivos + * + * @throws Exception + */ + private void processSP() throws Exception { + String data[] = line.split("\t"); + //TGENESCOREADJUSTMENT + TgeneScoreAdjustmentKey key1 = new TgeneScoreAdjustmentKey(); + key1.setAccount(data[1].trim()); + key1.setCompanycode(company); + key1.setDateto(realDate); + key1.setScoredate(new Timestamp (getDateByFormat(data[0].trim(), "dd/MM/yyyy").getTime())); + + TgeneScoreAdjustment tgsa = new TgeneScoreAdjustment(); + tgsa.setPk(key1); + tgsa.setAdjustmenttype("F"); + tgsa.setCurrencycode(data[5].trim()); + tgsa.setDatefrom(realDate); + tgsa.setJournalid(sr.getJournalId()); + tgsa.setManualprovisionpercent(new BigDecimal(data[6].trim())); + tgsa.setModulecode(data[2].trim()); + tgsa.setProductcode(data[3].trim()); + tgsa.setSubproductcode(data[4].trim()); + tgsa.setFilename(file.getName()); + tgsa.setStatus("C"); // ESTADO CARGADO + + PersistenceHelper.save(tgsa); + } + + + /** + * Mtodo que ingresa cabecera en tabla: TGENESCOREHEADER + * + * @throws Exception + */ + private void processHeader() throws Exception { + String data[] = line.split("\t"); + TgeneScoreHeader scoreHeader = new TgeneScoreHeader(); + TgeneScoreHeaderKey scoreHeaderKey = new TgeneScoreHeaderKey(); + + scoreHeaderKey.setCompanycode(company); + scoreHeaderKey.setScoredate(getDateByFormat(data[0].trim(), "dd/MM/yyyy")); + scoreHeader.setPk(scoreHeaderKey); + scoreHeader.setFilecode(300); + scoreHeader.setTabulated("N"); + + PersistenceHelper.saveOrUpdate(scoreHeader); + } + + + /** + * Mtodo que devuelve la fecha segn el formato requerido + * + * @param pStrDate + * @param pFormat + * @return + * @throws Exception + */ + private Date getDateByFormat(String pStrDate, String pFormat) throws Exception { + Date date = null; + try { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pFormat); + date = new Date(simpleDateFormat.parse(pStrDate).getTime()); + } catch (Exception e) { + throw new LoanException("LOAN-0038", "FECHA INCORRECTAMENTE DEFINIDA EN TLOANPAYMENTACCOBANK PARA INSTITUCIN FINANCIERA: {0}", account); + } + + return date; + + } + + /** + * Mtodo que guarda un log de las lineas de archivos que no pueden ser procesadas en la tabla + * TGENESCOREFILEISSUES + * + * @param eh + * @throws Exception + * @throws Exception + */ + private void LogUploadIssues(ExceptionHandler eh) throws Exception { + TgeneScoreFileIssuesKey key1 = new TgeneScoreFileIssuesKey(); + key1.setLinenumber(sequence); + key1.setAccount(account); + key1.setCompany(company); + key1.setFilename(file.getName()); + key1.setUploaddate(realDate); + + TgeneScoreFileIssues scoreIssue = new TgeneScoreFileIssues(); + scoreIssue.setPk(key1); + scoreIssue.setLinecontent(line); + + + if (eh.getUserMessage().length() > 100) { + scoreIssue.setUsermessage(eh.getUserMessage().substring(0, 100)); + } else { + scoreIssue.setUsermessage(eh.getUserMessage()); + } + if (eh.getTechnicalMessage().length() > 500) { + scoreIssue.setTechnicalmessage(eh.getTechnicalMessage().substring(0, 500)); + } else { + scoreIssue.setTechnicalmessage(eh.getTechnicalMessage()); + } + + new NestedSave(company, scoreIssue).start(); + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/score/save/FileScore.java b/base/business/general/src/main/java/com/fp/general/score/save/FileScore.java new file mode 100644 index 0000000..4d3ec0a --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/score/save/FileScore.java @@ -0,0 +1,138 @@ +package com.fp.general.score.save; + +import com.fp.dto.save.SaveRequest; +import com.fp.excel.ExcelToMap; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.score.TgeneScoreAdjustment; +import com.fp.persistence.pgeneral.score.TgeneScoreAdjustmentKey; +import com.fp.persistence.pgeneral.score.TgeneScoreHeader; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.image.TgeneFilesDetailKey; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.sql.Timestamp; +/** + * Clase que graba la data recibida de Excel en la tabla TGENESCOREADJUSTMENT + * + * @author BPTWPA + */ +public class FileScore { + + /** + * Mtodo que graba en la base de datos las calificaciones de cartera subidas en excel + * + * @param tgeneScoreHeader Objeto TgeneScoreHeader + * @param excelMap Mapa obtenido del archivo de excel + * @throws Exception + */ + public List loadScore(TgeneScoreHeader tgeneScoreHeader, SaveRequest sr, Integer filecode) throws Exception { + List lTgeneScoreAdjustment = new ArrayList(); + Map mapExcel = null; + TgeneFilesDetail filesDetail = TgeneFilesDetail.find(PersistenceHelper.getEntityManager(), new TgeneFilesDetailKey(filecode, + FormatDates.getDefaultExpiryTimestamp())); + if (tgeneScoreHeader != null && filesDetail != null) { + if (filesDetail.getExtension().equals("xls") || filesDetail.getExtension().equals("xlsx")) { + ExcelToMap excelMap = new ExcelToMap(filesDetail.getImage(), filesDetail.getExtension()); + mapExcel = excelMap.getExcelMap(); + if (mapExcel != null || !mapExcel.isEmpty()) { + Integer rows = (mapExcel.size() / 8)-1; + for (int i = 1; i <= rows ; i++) { + TgeneScoreAdjustment tgeneScoreAdjustment = new TgeneScoreAdjustment(); + TgeneScoreAdjustmentKey key = new TgeneScoreAdjustmentKey(); + for (int j = 0; j < 8; j++) { + String parameter = i + ":" + j; + Object value = null; + switch (j) { + case 0: //COMPANIA + if(!(tgeneScoreHeader.getPk().getScoredate().compareTo((Date) mapExcel.get(parameter)) == 0)){ + throw new GeneralException("GENE-0043", "LA FECHA DEL ARCHIVO NO CONCUERDA CON LA SELECCIONADA"); + } + + this.contentParameter(parameter, mapExcel); + key.setScoredate(new Timestamp(tgeneScoreHeader.getPk().getScoredate().getTime())); + + break; + case 1: //CUENTA + this.contentParameter(parameter, mapExcel); + value = mapExcel.get(parameter); + key.setAccount(String.valueOf(value)); + tgeneScoreAdjustment.setPk(key); + break; + case 2: //MODULO + this.contentParameter(parameter, mapExcel); + value = mapExcel.get(parameter); + tgeneScoreAdjustment.setModulecode(String.valueOf(value)); + break; + case 3: //PRODUCTO + this.contentParameter(parameter, mapExcel); + value = mapExcel.get(parameter); + tgeneScoreAdjustment.setProductcode(String.valueOf(value)); + break; + case 4: //SUBPRODUCTO + this.contentParameter(parameter, mapExcel); + value = mapExcel.get(parameter); + tgeneScoreAdjustment.setSubproductcode(String.valueOf(value)); + break; + case 5: //MONEDA + this.contentParameter(parameter, mapExcel); + value = mapExcel.get(parameter); + tgeneScoreAdjustment.setCurrencycode(String.valueOf(value)); + break; + case 6: //PORCENTAJE PROVISION + this.contentParameter(parameter, mapExcel); + value = mapExcel.get(parameter); + tgeneScoreAdjustment.setManualprovisionpercent(new BigDecimal(value.getClass().getSimpleName().equals("BigDecimal") ? String.valueOf(value) : "0")); + break; + case 7: //TIPO AJUSTE, JOURNAL ID + this.contentParameter(parameter, mapExcel); + this.verifyFile(parameter, mapExcel); + value = mapExcel.get(parameter); + tgeneScoreAdjustment.setAdjustmenttype(String.valueOf(value)); + tgeneScoreAdjustment.setJournalid(sr.getJournalId()); + break; + default: + break; + } + } + lTgeneScoreAdjustment.add(tgeneScoreAdjustment); + } + } + } else { + throw new GeneralException("GENE-0043", "El ARCHIVO NO ES EL CORRECTO - CALIFICACION CARTERA"); + } + } + + return lTgeneScoreAdjustment; + } + + /** + * Mtodo que valida que el valor que viene en el archivo sea el correcto + * @param parameter + * @param mapExcel + * @throws Exception + */ + private void contentParameter(String parameter, Map mapExcel) throws Exception { + if (!mapExcel.containsKey(parameter)) { + throw new GeneralException("GENE-0044", "PARMETRO NO ENCONTRADO"); + } + } + + /** + * Mtodo que valida que el archivo sea el correcto + * @param parameter + * @param mapExcel + * @throws Exception + */ + private void verifyFile(String parameter, Map mapExcel) throws Exception { + this.contentParameter(parameter, mapExcel); + String value = (String) mapExcel.get(parameter); //Object + if (!(String.valueOf(value).compareTo("F") == 0)) { + throw new GeneralException("GENE-0043", "El ARCHIVO NO ES EL CORRECTO - CALIFICACION CARTERA"); + } + } +} diff --git a/base/business/general/src/main/java/com/fp/general/score/save/SafeFileScore.java b/base/business/general/src/main/java/com/fp/general/score/save/SafeFileScore.java new file mode 100644 index 0000000..3c4ef10 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/score/save/SafeFileScore.java @@ -0,0 +1,103 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.general.score.save; + +import com.fp.dto.helper.FileHelper; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.image.TgeneFiles; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.image.TgeneFilesDetailKey; +import com.fp.sessionbeans.helper.Sequence; +import java.util.List; + +/** + * Clase que sube un archivo + * @author pgalindo + */ +public class SafeFileScore extends TransactionRule { + + @Override + public SaveRequest normalProcess(SaveRequest sr) throws Exception { + TgeneFilesDetail filesDetail = null; + Integer filecode = null; + String xlsfile = sr.getString("xlsFile"); + if (xlsfile.compareTo("YES") == 0) { + List fileItem = (List) sr.get("file"); + if ((fileItem == null || !fileItem.isEmpty())) { + String code = sr.getString("filecode"); + filecode = ((code.compareTo("") == 0) ? null : Integer.valueOf(code)); + if (filecode == null) { + filesDetail = this.createImage(sr, fileItem); + filecode = filesDetail.getPk().getCode(); + } else { + filecode = sr.getInteger("filecode"); + filesDetail = this.upDateImage(sr, fileItem, filecode); + filecode = filesDetail.getPk().getCode(); + } + sr.getResponse().put("codes", "[" + filecode + "]"); + } + } + return sr; + } + + @Override + public SaveRequest reverseProcess(SaveRequest sr) throws Exception { + return sr; + } + + /** + * Metodo que crea un nuevo registro en la tabla TGENEFILESDETAIL + * @param pSaveRequest + * @param imageItem + * @return TgeneFilesDetail + * @throws Exception + */ + private TgeneFilesDetail createImage(SaveRequest pSaveRequest, List imageItem) throws Exception { + Sequence sequence = new Sequence(); + Integer filecode = Integer.valueOf(sequence.getNextValue("FILECODE").toString()); + TgeneFiles tgeneFiles = new TgeneFiles(filecode); + PersistenceHelper.save(tgeneFiles); + TgeneFilesDetailKey tgeneFilesDetailKey = new TgeneFilesDetailKey(filecode, FormatDates.getDefaultExpiryTimestamp()); + TgeneFilesDetail tgeneFilesDetail = new TgeneFilesDetail(); + tgeneFilesDetail.setPk(tgeneFilesDetailKey); + tgeneFilesDetail.setImage(imageItem.get(0).getImage()); + tgeneFilesDetail.setCapturedate(FormatDates.getInstance().getDataBaseDate()); + tgeneFilesDetail.setImagesize(Integer.parseInt(String.valueOf(imageItem.get(0).getSize()))); + tgeneFilesDetail.setIngressuser(pSaveRequest.getUser()); + tgeneFilesDetail.setExtension(imageItem.get(0).getExtension()); + PersistenceHelper.save(tgeneFilesDetail); + return tgeneFilesDetail; + } + + /** + * Metodo que actualiza el registro de la tabla TGENEFILESDETAIL + * @param pSaveRequest + * @param imageItem + * @param imagecode + * @return + * @throws Exception + */ + private TgeneFilesDetail upDateImage(SaveRequest pSaveRequest, List imageItem, Integer imagecode) throws Exception { + TgeneFilesDetail tgeneFilesDetail = null; + TgeneFiles tgeneFiles = TgeneFiles.find(PersistenceHelper.getEntityManager(), imagecode); + if (tgeneFiles != null) { + TgeneFilesDetailKey filesDetailKey = new TgeneFilesDetailKey(tgeneFiles.getPk(), FormatDates.getDefaultExpiryTimestamp()); + + tgeneFilesDetail = TgeneFilesDetail.find(PersistenceHelper.getEntityManager(), filesDetailKey); + if (tgeneFilesDetail != null) { + tgeneFilesDetail.setImage(imageItem.get(0).getImage()); + tgeneFilesDetail.setCapturedate(FormatDates.getInstance().getDataBaseDate()); + tgeneFilesDetail.setImagesize(Integer.parseInt(String.valueOf(imageItem.get(0).getSize()))); + tgeneFilesDetail.setModifyuser(pSaveRequest.getUser()); + tgeneFilesDetail.setExtension(imageItem.get(0).getExtension()); + PersistenceHelper.update(tgeneFilesDetail); + } + } + return tgeneFilesDetail; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/score/save/SafeScoreHeaderDetail.java b/base/business/general/src/main/java/com/fp/general/score/save/SafeScoreHeaderDetail.java new file mode 100644 index 0000000..c6dbd2a --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/score/save/SafeScoreHeaderDetail.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.general.score.save; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.pgeneral.score.TgeneScoreAdjustment; +import com.fp.persistence.pgeneral.score.TgeneScoreHeader; +import com.fp.persistence.pgeneral.score.TgeneScoreHeaderKey; +import java.sql.Date; +import java.util.List; + +/** + * + * @author pgalindo + */ +public class SafeScoreHeaderDetail extends TransactionRule { + + @Override + public SaveRequest normalProcess(SaveRequest sr) throws Exception { + TgeneScoreHeader scoreHeader = null; + List lTgeneScoreAdjustment = null; + FileScore scoreAdjustment = new FileScore(); + String xlsfile = sr.getString("xlsFile"); + //String pk = (String) sr.get("pk_scoredate"); + //APPDates date = new APPDates(pk); + if (xlsfile.compareTo("NO") == 0) { + Date scoredate = sr.getDate("scoredate"); + Integer company = sr.getInteger("companycode"); + Integer filecode = sr.getInteger("filecode"); + + scoreHeader = this.saveHeader(scoredate, company, filecode); + lTgeneScoreAdjustment = scoreAdjustment.loadScore(scoreHeader, sr, filecode); + sr.putSaveBean("TGENESCOREHEADER", scoreHeader, 1); + sr.putSaveBean("TGENESCOREADJUSTMENT", lTgeneScoreAdjustment, 2); + // GRABAR CALIFICACION MANUAL + } + return sr; + } + + @Override + public SaveRequest reverseProcess(SaveRequest sr) throws Exception { + return sr; + } + + /** + * Metodo que graba la cabecera de la tabla de calificacion + * @param sr + * @return + * @throws Exception + */ + private TgeneScoreHeader saveHeader(Date scoredate, Integer companycode, Integer filecode) throws Exception { + TgeneScoreHeader tgeneScoreHeader = new TgeneScoreHeader(); + tgeneScoreHeader.setPk(new TgeneScoreHeaderKey(scoredate, companycode)); + tgeneScoreHeader.setFilecode(filecode); //PGA + tgeneScoreHeader.setTabulated("N"); + return tgeneScoreHeader; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/score/save/UploadFileScoreThread.java b/base/business/general/src/main/java/com/fp/general/score/save/UploadFileScoreThread.java new file mode 100644 index 0000000..b225c2c --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/score/save/UploadFileScoreThread.java @@ -0,0 +1,259 @@ +package com.fp.general.score.save; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.sql.Date; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import org.apache.commons.lang.StringUtils; + +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.logger.APPLogger; +import com.fp.dto.save.SaveRequest; +import com.fp.loan.exception.LoanException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.score.TgeneScoreAdjustment; +//import com.fp.persistence.ploan.acco.TloanPaymentBankProcess; + +/** + * Clase que se encarga de procesar un archivo con informacin de pagos de crditos procedente de una canal de + * recaudacin + * + * @author Omar Villanueva + * @version 2.1 + */ +public class UploadFileScoreThread extends Thread { + + private final Integer company; + + /* Arvhivo a procesar */ + private final File file; + + /* Institucin financiera a la que pertenece el archivo */ + private final String bank; + + /* Directorio destino para el archivo luego de procesarlo */ + private final StringBuilder targetPath; + + /* + * Map para los formatos de nombres de archivos de las instituciones financieras parametrizadas en + * TLOANPAYMENTACCOBANK + */ + private final Map mFileName; + + /* + * Map para los numeros de hilos que se puede procesar en paralelo por cada una de las instituciones financieras + * parametrizadas en TLOANPAYMENTACCOBANK + */ + private final Map mThreads; + + /* String para almacenar el log de errores en la carga de los archivos para mostrar al usuario en el front end */ + private final StringBuilder sbLog; + + /* Separador de linea */ + private final String new_line = System.getProperty("line.separator"); + + private final SaveRequest sr; + + + + /** + * Constructor + * + * @param company + * @param file + * @param bank + * @param targetPath + * @param mFileName + * @param mThreads + * @param sbLog + */ + public UploadFileScoreThread(Integer company, File file, String bank, StringBuilder targetPath, Map mFileName, + Map mThreads, StringBuilder sbLog, SaveRequest sr) { + super(); + this.company = company; + this.file = file; + this.bank = bank; + this.targetPath = targetPath; + this.mFileName = mFileName; + this.mThreads = mThreads; + this.sbLog = sbLog; + this.sr=sr; + } + + @Override + public void run() { + // boolean success = true; + try { + SessionData s = new SessionData(); + s.setCompany(company); + ThreadFacade.setSaveRequest(s); + PersistenceHelper.setEntityManager(PersistenceManager.getInstance().createEntityManagerLocal()); + PersistenceHelper.beginNewTransaction(); + /* Procesar archivo */ + process(); + PersistenceHelper.commitNewTransaction(); + /* Mover el archivo si la carga fue exitosa */ + moveFile(); + } catch (Exception e) { + // success = false; + PersistenceHelper.rollbackNewTransaction(); + ExceptionHandler eh = new ExceptionHandler(e, "es"); + APPLogger.getLogger().error("codigo ==>" + eh.getCode()); + APPLogger.getLogger().error("user ==>" + eh.getUserMessage()); + APPLogger.getLogger().error("technical ==>" + eh.getTechnicalMessage()); + APPLogger.getLogger().error("stacktrace ==>" + eh.getStackTrace()); + } finally { + PersistenceHelper.closeSession(); + } + // /* Mover el archivo si la carga fue exitosa */ + // if (success) { + // try { + // moveFile(); + // } catch (Exception e) { + // e.printStackTrace(); + // } + // } + } + + /** + * Mtodo que procesa el archivo. Carga la data en la tabla TGENESCOREADJUSTMENT(---TLOANPAYMENTBANKPROCESS). Lanza un hilo por cada linea + * que contiene el arvhivo. Se pueden lanzar varios hilos en paralelo. El numero mximo de hilos esta determinado + * por el parametro threads fijado en la tabla TLOANPAYMENTACCOBANK + * + * @throws Exception + */ + private void process() throws Exception { + /* Verificar si el archivo ya fue cargado anteriormente */ + //String fileExist = TloanPaymentBankProcess.find(PersistenceHelper.getEntityManager(), company, file.getName()); + String fileExist = TgeneScoreAdjustment.find(PersistenceHelper.getEntityManager(), company, file.getName()); + + if (fileExist != null) { + sbLog.append(new LoanException("LOAN-0049", "EL ARCHIVO: {0} YA FUE CARGADO ANTERIORMENTE", file.getName()).getMessage()) + .append(new_line); + throw new LoanException("LOAN-0049", "EL ARCHIVO: {0} YA FUE CARGADO ANTERIORMENTE", file.getName()); + } + /* Verificar si el numero de hilos esta definido */ + if (mThreads.get(bank) == null || mThreads.get(bank).compareTo(0) <= 0) { + /* Agrega el mensaje al log de errores */ + sbLog.append( + new LoanException("LOAN-0041", "NUMERO DE HILOS NO DEFINIDO EN TLOANPAYMENTACCOBANK PARA INSTITUCION FINANCIERA: {0}", bank) + .getMessage()).append(new_line); + throw new LoanException("LOAN-0041", "NUMERO DE HILOS NO DEFINIDO EN TLOANPAYMENTACCOBANK PARA INSTITUCION FINANCIERA: {0}", bank); + } + ExecutorService pool = Executors.newFixedThreadPool(mThreads.get(bank)); + /* Obtener la fecha de pago del archivo a procesar */ + Date paymentDate = getDateFromFile(); + try { + BufferedReader input = new BufferedReader(new FileReader(file)); + try { + String line = null; + int sequence = 0; + Timestamp realDate = FormatDates.getInstance().getDataBaseTimestamp(); + while ((line = input.readLine()) != null) { + sequence++; + /* Se lanza un hilo por cada linea del archivo que se debe procesar */ + UploadLineScoreThread ult = new UploadLineScoreThread(company, file, bank, line, sequence, realDate, paymentDate, sr); + pool.execute(ult); + } + } catch (IOException ioe) { + throw ioe; + } finally { + input.close(); + } + } catch (IOException ioe) { + throw ioe; + } + pool.shutdown(); + boolean isfinish = pool.isTerminated(); + while (!isfinish) { + isfinish = pool.isTerminated(); + Thread.sleep(600); + } + } + + /** + * Mtodo que obtiene la fecha desde el arvhivo proporcionado por el canal de recaudacin. Esta es la fecha de pago + * de la cuota del crdito + * + * @return + * @throws Exception + */ + private Date getDateFromFile() throws Exception { + Date date = null; + String fileName = StringUtils.remove(mFileName.get(bank), '-'); + int positionDate = fileName.indexOf("ddMM"); + /* Procesa archivos que contengan el formato ddMM */ + if (positionDate < 0) { + /* Agrega el mensaje al log de errores */ + sbLog.append( + new LoanException("LOAN-0038", "FECHA INCORRECTAMENTE DEFINIDA EN TLOANPAYMENTACCOBANK PARA INSTITUCIN FINANCIERA: {0}", bank) + .getMessage()).append(new_line); + throw new LoanException("LOAN-0038", "FECHA INCORRECTAMENTE DEFINIDA EN TLOANPAYMENTACCOBANK PARA INSTITUCIN FINANCIERA: {0}", bank); + } + if (bank.compareTo("SP") == 0) { + String formatDate = mFileName.get(bank).substring(positionDate, positionDate + 10); + String strDate = file.getName().trim().substring(positionDate, positionDate + 10); + date = getDateByFormat(strDate, formatDate); + } + + return date; + } + + /** + * Mtodo que devuelve la fecha segn el formato requerido + * + * @param pStrDate + * @param pFormat + * @return + * @throws Exception + */ + private Date getDateByFormat(String pStrDate, String pFormat) throws Exception { + Date date = null; + try { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pFormat); + date = new Date(simpleDateFormat.parse(pStrDate).getTime()); + } catch (Exception e) { + /* Agrega el mensaje al log de errores */ + sbLog.append( + new LoanException( + "LOAN-0050", + "EL FORMATO DE FECHA DEL ARCHIVO: {0} NO COINCIDE CON EL DEFINIDO EN TLOANPAYMENTACCOBANK PARA INSTITUCIN FINANCIERA: {1}", + file.getName(), bank).getMessage()).append(new_line); + throw new LoanException("LOAN-0050", + "EL FORMATO DE FECHA DEL ARCHIVO: {0} NO COINCIDE CON EL DEFINIDO EN TLOANPAYMENTACCOBANK PARA INSTITUCIN FINANCIERA: {1}", + file.getName(), bank); + } + + return date; + } + + /** + * Mtodo que mueve el archivo ya procesado al directorio destino + * + * @throws Exception + */ + private void moveFile() throws Exception { + /* Directorio destino */ + File targetDir = new File(targetPath.toString()); + + /* Mover el archivo al nuevo directorio */ + boolean success = file.renameTo(new File(targetDir, file.getName())); + if (!success) { + /* Agrega el mensaje al log de errores */ + sbLog.append(new LoanException("LOAN-0040", "EL ARCHIVO {0} ESTA SIENDO USADO POR OTRO PROCESO", file.getName()).getMessage()).append( + new_line); + throw new LoanException("LOAN-0040", "EL ARCHIVO {0} ESTA SIENDO USADO POR OTRO PROCESO", file.getName()); + } + } +} diff --git a/base/business/general/src/main/java/com/fp/general/score/save/UploadLineScoreThread.java b/base/business/general/src/main/java/com/fp/general/score/save/UploadLineScoreThread.java new file mode 100644 index 0000000..8006fa9 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/score/save/UploadLineScoreThread.java @@ -0,0 +1,232 @@ +package com.fp.general.score.save; + +import java.io.File; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; + +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.helper.BeanManager; +import com.fp.common.logger.APPLogger; +import com.fp.dto.save.SaveRequest; +import com.fp.loan.exception.LoanException; +import com.fp.persistence.commondb.NestedSave; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.pgeneral.score.TgeneScoreAdjustment; +import com.fp.persistence.pgeneral.score.TgeneScoreAdjustmentKey; +import com.fp.persistence.pgeneral.score.TgeneScoreFileIssues; +import com.fp.persistence.pgeneral.score.TgeneScoreFileIssuesKey; +import com.fp.persistence.pgeneral.score.TgeneScoreHeader; +import com.fp.persistence.pgeneral.score.TgeneScoreHeaderKey; + + +/** + * Clase que se encarga de procesar una linea de archivo con informacin de pagos de crditos procedente de una canal de + * recaudacin + * + * @author Omar Villanueva + * @version 2.1 + */ +public class UploadLineScoreThread extends Thread { + + private final Integer company; + + /* Arvhivo a procesar */ + private final File file; + + /* Institucin financiera a la que pertenece el archivo */ + // private final String bank; + + /* Nmero de Operacin */ + private final String account; + + /* Linea del archivo a procesar */ + private final String line; + + /* Nmero de linea que se esta procesando */ + private final int sequence; + + private final Timestamp realDate; + + /* Fecha de pago de la cuota del crdito */ + //private final Date paymentDate; + + /* Fecha de calififacin */ + private final Date scoreDate; + + private final SaveRequest sr; + + /** + * Constructor + * + * @param company + * @param file + * @param account + * @param line + * @param sequence + * @param realDate + * @param scoreDate + */ + public UploadLineScoreThread(Integer company, File file, String account, String line, int sequence, Timestamp realDate, Date scoreDate, SaveRequest sr) { + super(); + this.company = company; + this.file = file; + this.account = account; + this.line = line; + this.sequence = sequence; + this.realDate = realDate; + this.scoreDate = scoreDate; + this.sr=sr; + } + + @Override + public void run() { + try { + SessionData s = new SessionData(); + s.setCompany(company); + ThreadFacade.setSaveRequest(s); + PersistenceHelper.setEntityManager(PersistenceManager.getInstance().createEntityManagerLocal()); + PersistenceHelper.beginNewTransaction(); + /* Procesar la linea de archivo */ + process(); + PersistenceHelper.commitNewTransaction(); + } catch (Exception e) { + PersistenceHelper.rollbackNewTransaction(); + ExceptionHandler eh = new ExceptionHandler(e, "es"); + APPLogger.getLogger().error("codigo ==>" + eh.getCode()); + APPLogger.getLogger().error("user ==>" + eh.getUserMessage()); + APPLogger.getLogger().error("technical ==>" + eh.getTechnicalMessage()); + APPLogger.getLogger().error("stacktrace ==>" + eh.getStackTrace()); + try { + /* Guarda en TLOANPAYMENTBANKISSUES informacin de las lineas con problemas */ + LogUploadIssues(eh); + } catch (Exception e1) { + e1.printStackTrace(); + } + } finally { + PersistenceHelper.closeSession(); + } + } + + /** + * Mtodo que procesa la linea de archivo. Carga la data en la tabla TLOANPAYMENTBANKPROCESS + * + * @throws Exception + */ + private void process() throws Exception { + processSP(); + processHeader(); + } + + /** + * Mtodo que procesa las lineas de archivos + * + * @throws Exception + */ + private void processSP() throws Exception { + String data[] = line.split("\t"); + //TGENESCOREADJUSTMENT + TgeneScoreAdjustmentKey key1 = new TgeneScoreAdjustmentKey(); + key1.setAccount(data[1].trim()); + key1.setCompanycode(company); + key1.setDateto(realDate); + key1.setScoredate(new Timestamp (getDateByFormat(data[0].trim(), "dd/MM/yyyy").getTime())); + + TgeneScoreAdjustment tgsa = new TgeneScoreAdjustment(); + tgsa.setPk(key1); + tgsa.setAdjustmenttype("F"); + tgsa.setCurrencycode(data[5].trim()); + tgsa.setDatefrom(realDate); + tgsa.setJournalid(sr.getJournalId()); + tgsa.setManualprovisionpercent(new BigDecimal(data[6].trim())); + tgsa.setModulecode(data[2].trim()); + tgsa.setProductcode(data[3].trim()); + tgsa.setSubproductcode(data[4].trim()); + tgsa.setFilename(file.getName()); + tgsa.setStatus("C"); // ESTADO CARGADO + + PersistenceHelper.save(tgsa); + } + + + /** + * Mtodo que ingresa cabecera en tabla: TGENESCOREHEADER + * + * @throws Exception + */ + private void processHeader() throws Exception { + String data[] = line.split("\t"); + TgeneScoreHeader scoreHeader = new TgeneScoreHeader(); + TgeneScoreHeaderKey scoreHeaderKey = new TgeneScoreHeaderKey(); + + scoreHeaderKey.setCompanycode(company); + scoreHeaderKey.setScoredate(getDateByFormat(data[0].trim(), "dd/MM/yyyy")); + scoreHeader.setPk(scoreHeaderKey); + scoreHeader.setFilecode(300); + scoreHeader.setTabulated("N"); + + PersistenceHelper.saveOrUpdate(scoreHeader); + } + + + /** + * Mtodo que devuelve la fecha segn el formato requerido + * + * @param pStrDate + * @param pFormat + * @return + * @throws Exception + */ + private Date getDateByFormat(String pStrDate, String pFormat) throws Exception { + Date date = null; + try { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pFormat); + date = new Date(simpleDateFormat.parse(pStrDate).getTime()); + } catch (Exception e) { + throw new LoanException("LOAN-0038", "FECHA INCORRECTAMENTE DEFINIDA EN TLOANPAYMENTACCOBANK PARA INSTITUCIN FINANCIERA: {0}", account); + } + + return date; + + } + + /** + * Mtodo que guarda un log de las lineas de archivos que no pueden ser procesadas en la tabla + * TGENESCOREFILEISSUES + * + * @param eh + * @throws Exception + * @throws Exception + */ + private void LogUploadIssues(ExceptionHandler eh) throws Exception { + TgeneScoreFileIssuesKey key1 = new TgeneScoreFileIssuesKey(); + key1.setLinenumber(sequence); + key1.setAccount(account); + key1.setCompany(company); + key1.setFilename(file.getName()); + key1.setUploaddate(realDate); + + TgeneScoreFileIssues scoreIssue = new TgeneScoreFileIssues(); + scoreIssue.setPk(key1); + scoreIssue.setLinecontent(line); + + + if (eh.getUserMessage().length() > 100) { + scoreIssue.setUsermessage(eh.getUserMessage().substring(0, 100)); + } else { + scoreIssue.setUsermessage(eh.getUserMessage()); + } + if (eh.getTechnicalMessage().length() > 500) { + scoreIssue.setTechnicalmessage(eh.getTechnicalMessage().substring(0, 500)); + } else { + scoreIssue.setTechnicalmessage(eh.getTechnicalMessage()); + } + + new NestedSave(company, scoreIssue).start(); + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/security/.svn/entries b/base/business/general/src/main/java/com/fp/general/security/.svn/entries new file mode 100644 index 0000000..22b79ca --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/security +svn://172.17.26.185/COMACO + + + +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +rules +dir + diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/.svn/entries b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/entries new file mode 100644 index 0000000..c5133e8 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/entries @@ -0,0 +1,371 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/security/rules +svn://172.17.26.185/COMACO + + + +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +MaintenanceUser.java +file + + + + +2022-07-28T03:40:43.512806Z +8c58b617fd3938c6aa6416dff8a3c3b9 +2015-02-20T11:00:27.488662Z +3830 +cpiedra + + + + + + + + + + + + + + + + + + + + + +4406 + +Menu.java +file + + + + +2022-07-28T03:40:43.512806Z +b60579d988bb4020fa905c7fbe45dab7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6068 + +UserLogonCas.java +file + + + + +2022-07-28T03:40:43.513806Z +b878f13492dce81c586082295040d85c +2015-06-23T07:19:44.493659Z +4130 +cpiedra + + + + + + + + + + + + + + + + + + + + + +28880 + +query +dir + +CloseAllSessions.java +file + + + + +2022-07-28T03:40:43.513806Z +048932395558f4dd86c57d128c4c6073 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2121 + +Company.java +file + + + + +2022-07-28T03:40:43.513806Z +010c308c88e72ae16ff12234a86d8dfb +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7691 + +Politics.java +file + + + + +2022-07-28T03:40:43.513806Z +da5899d7c8430abace94257b7a2bc2c4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9804 + +MaintenanceMenu.java +file + + + + +2022-07-28T03:40:43.514806Z +dfaca120b04a35ecb6aeac0f54cb353c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8796 + +CloseSession.java +file + + + + +2022-07-28T03:40:43.514806Z +66a75880fc7e624b7c7e6da8ba0fc894 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1399 + +CreateInternalCodeUser.java +file + + + + +2022-07-28T03:40:43.514806Z +383b61bea8dec814fdbd5805e10b936a +2015-09-10T07:09:12.780369Z +4277 +fpazmino + + + + + + + + + + + + + + + + + + + + + +3476 + +UserLogon.java +file + + + + +2022-07-28T03:40:43.514806Z +f0aced2c6ba46316e10d590157cbe4e5 +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +30721 + diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/CloseAllSessions.java.netbeans-base b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/CloseAllSessions.java.netbeans-base new file mode 100644 index 0000000..f9013a9 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/CloseAllSessions.java.netbeans-base @@ -0,0 +1,63 @@ +package com.fp.general.security.rules; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; + +/** + * Clase que cierra todas las conexiones abiertas en el servidor + * @author scastillo + */ +public class CloseAllSessions { + + /** + * Almacena una instancia de CloseAllSessions. + */ + private static CloseAllSessions cache; + + /** + * Entrega una instancia de CloseAllSessions. + * @return DataHelper + */ + public static CloseAllSessions getInstance() { + if (cache != null) { + return cache; + } + synchronized (CloseAllSessions.class) { + if (cache == null) { + cache = new CloseAllSessions(); + } + } + return cache; + } + /** + * Sentencia SQL que caduca las sesiones + */ + private static final String SQL = + "update TsafeUserSession set pk.dateto = :dateto where pk.dateto = :datetofilter and webserverip = :webserverip"; + + /** + * Metodo que cierra las sesiones abiertas en el servidor + * @param host + * @throws Exception + */ + public void expireSessions(String host) throws Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + try { + Query query = em.createQuery(SQL); + query.setParameter("dateto", FormatDates.getInstance().getDataBaseTimestamp(em)); + query.setParameter("datetofilter", FormatDates.getDefaultExpiryTimestamp()); + query.setParameter("webserverip", host); + query.executeUpdate(); + } catch (Exception e) { + ExceptionHandler eh = new ExceptionHandler(e, "es"); + APPLogger.getLogger().error("User Message:==>\n" + eh.getUserMessage()); + APPLogger.getLogger().error("Tech Message:==>\n" + eh.getTechnicalMessage()); + APPLogger.getLogger().error("Stack Message:==>\n" + eh.getStackTrace()); + } + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/CloseAllSessions.java.svn-base b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/CloseAllSessions.java.svn-base new file mode 100644 index 0000000..f9013a9 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/CloseAllSessions.java.svn-base @@ -0,0 +1,63 @@ +package com.fp.general.security.rules; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; + +/** + * Clase que cierra todas las conexiones abiertas en el servidor + * @author scastillo + */ +public class CloseAllSessions { + + /** + * Almacena una instancia de CloseAllSessions. + */ + private static CloseAllSessions cache; + + /** + * Entrega una instancia de CloseAllSessions. + * @return DataHelper + */ + public static CloseAllSessions getInstance() { + if (cache != null) { + return cache; + } + synchronized (CloseAllSessions.class) { + if (cache == null) { + cache = new CloseAllSessions(); + } + } + return cache; + } + /** + * Sentencia SQL que caduca las sesiones + */ + private static final String SQL = + "update TsafeUserSession set pk.dateto = :dateto where pk.dateto = :datetofilter and webserverip = :webserverip"; + + /** + * Metodo que cierra las sesiones abiertas en el servidor + * @param host + * @throws Exception + */ + public void expireSessions(String host) throws Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + try { + Query query = em.createQuery(SQL); + query.setParameter("dateto", FormatDates.getInstance().getDataBaseTimestamp(em)); + query.setParameter("datetofilter", FormatDates.getDefaultExpiryTimestamp()); + query.setParameter("webserverip", host); + query.executeUpdate(); + } catch (Exception e) { + ExceptionHandler eh = new ExceptionHandler(e, "es"); + APPLogger.getLogger().error("User Message:==>\n" + eh.getUserMessage()); + APPLogger.getLogger().error("Tech Message:==>\n" + eh.getTechnicalMessage()); + APPLogger.getLogger().error("Stack Message:==>\n" + eh.getStackTrace()); + } + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/CloseSession.java.svn-base b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/CloseSession.java.svn-base new file mode 100644 index 0000000..f075bcd --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/CloseSession.java.svn-base @@ -0,0 +1,41 @@ +package com.fp.general.security.rules; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.safe.TsafeUserSession; +import com.fp.persistence.pgeneral.safe.TsafeUserSessionKey; + +/** + * Clase que se encarga de caducar un registro + * @author scastillo + */ +public class CloseSession extends TransactionRule { + + /** + * Metodo que caduca el registro vigente del inicio de sesion + * @param pSaveRequest + * @return + * @throws Exception + */ + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + String usercode = pSaveRequest.getUser(); + TsafeUserSessionKey tsafeUserSessionKey = new TsafeUserSessionKey(usercode, FormatDates.getDefaultExpiryTimestamp()); + TsafeUserSession tsafeUserSession = TsafeUserSession.find(PersistenceHelper.getEntityManager(), tsafeUserSessionKey); + if (tsafeUserSession != null) { + PersistenceHelper.expire(tsafeUserSession); + } + return pSaveRequest; + } + + /** + * Metodo q ue se ejecuta en modo reverso + * @param pSaveRequest + * @return + * @throws Exception + */ + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/Company.java.netbeans-base b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/Company.java.netbeans-base new file mode 100644 index 0000000..58f04e2 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/Company.java.netbeans-base @@ -0,0 +1,193 @@ +package com.fp.general.security.rules; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.SQLQuery; +import org.hibernate.ScrollMode; +import org.hibernate.ScrollableResults; + +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; + +/** + * Clase que devuelve las companias + * + * @author scastillo + */ +public class Company extends QueryRule { + + private static final String SQL = + "select tgc.COMPANYCODE value," + + " (select tcp.NAME" + + " from TCUSTPERSONDETAIL tcp" + + " where tcp.PERSONCODE = tgc.PERSONCODE" + + " and tcp.DATETO = :dateto) label" + + " from TGENECOMPANY tgc" + + " where tgc.ACTIVE = :active"; + + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + try { + if(pQueryRequest.isJsf()){ + response.put("CIAS", this.getCompanyJsf()); + }else{ + response.put("T", this.getCompany()); + } + + + } catch (Exception e) { + ExceptionHandler eh = new ExceptionHandler(e, "es"); + APPLogger.getLogger().error("User Message:==>\n" + eh.getUserMessage()); + APPLogger.getLogger().error("Tech Message:==>\n" + eh.getTechnicalMessage()); + APPLogger.getLogger().error("Stack Message:==>\n" + eh.getStackTrace()); + } + + return pQueryRequest; + } + + /** + * Metodo que asigna la data de companias en un map + * @return + * @throws Exception + */ + private List> getCompany() throws Exception { + ScrollableResults rSet = null; + List> ldata = new ArrayList>(); + try { + rSet = this.executeQuery(); + while (rSet.next()) { + Object[] obj = rSet.get(); + Map mData = new HashMap(); + Integer company = (Integer) obj[0]; + String companyname = (String) obj[1]; + mData.put("value", company); + mData.put("label", companyname); + TgeneParametersKey tgeneParametersKey = new TgeneParametersKey("JSVERSION", company); + TgeneParameters tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), + tgeneParametersKey); + if (tgeneParameters != null && tgeneParameters.getNumbervalue() != null) { + mData.put("vd", tgeneParameters.getNumbervalue().intValue()); + } else { + mData.put("vd", 0); + } + tgeneParametersKey = new TgeneParametersKey("LOGO", company); + tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), + tgeneParametersKey); + if (tgeneParameters != null && tgeneParameters.getTextvalue() != null) { + mData.put("lo", tgeneParameters.getTextvalue()); + } else { + mData.put("lo", "images/company/default.gif"); + } + tgeneParametersKey = new TgeneParametersKey("FORMATDATE", company); + tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), + tgeneParametersKey); + if (tgeneParameters != null && tgeneParameters.getTextvalue() != null) { + mData.put("fd", tgeneParameters.getTextvalue()); + } else { + mData.put("fd", "yyyy-MM-dd"); + } + tgeneParametersKey = new TgeneParametersKey("IMGFONDO", company); + tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), + tgeneParametersKey); + if (tgeneParameters != null && tgeneParameters.getTextvalue() != null) { + mData.put("fi", tgeneParameters.getTextvalue()); + } else { + mData.put("fi", null); + } + tgeneParametersKey = new TgeneParametersKey("TOPMENU", company); + tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), + tgeneParametersKey); + if (tgeneParameters != null && tgeneParameters.getTextvalue() != null + && tgeneParameters.getTextvalue().compareTo("Y") == 0) { + mData.put("tm", "Y"); + } else { + mData.put("tm", "N"); + } + tgeneParametersKey = new TgeneParametersKey("TIMEOUT", (Integer) obj[0]); + tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), + tgeneParametersKey); + if (tgeneParameters != null && tgeneParameters.getNumbervalue() != null) { + mData.put("to", tgeneParameters.getNumbervalue().intValue()); + } else { + mData.put("to", 600); + } + //Se adiciona todos los parametros por compania + ldata.add(mData); + } + } finally { + if (rSet != null ) { + try { + rSet.close(); + } catch (Exception e) { + //Si el rset esta cerrado no hacer nada. + } + + } + } + return ldata; + } + + /** + * Metodo que asigna la data de companias en un map + * @return + * @throws Exception + */ + private List> getCompanyJsf() throws Exception { + ScrollableResults rSet = null; + List> ldata = new ArrayList>(); + try { + rSet = this.executeQuery(); + while (rSet.next()) { + Object[] obj = rSet.get(); + Map mData = new HashMap(); + Integer company = (Integer) obj[0]; + String companyname = (String) obj[1]; + mData.put("company", company); + mData.put("name", companyname); + //Se adiciona todos los parametros por compania + ldata.add(mData); + } + } finally { + if (rSet != null ) { + try { + rSet.close(); + } catch (Exception e) { + //Si el rset esta cerrado no hacer nada. + } + + } + } + return ldata; + } + + + + /** + * Metodo que ejecuta el query para obtener el codigo y nombre de las companias + * + * @param pQueryRequest + * @return + * @throws Exception + */ + private ScrollableResults executeQuery() throws Exception { + ScrollableResults rSet = null; + SQLQuery sql = PersistenceHelper.getSession().createSQLQuery(Company.SQL); + sql.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + sql.setParameter("active", "Y"); + sql.addScalar("value", new org.hibernate.type.IntegerType()); + sql.addScalar("label", new org.hibernate.type.StringType()); + + rSet = sql.scroll(ScrollMode.FORWARD_ONLY); + return rSet; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/Company.java.svn-base b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/Company.java.svn-base new file mode 100644 index 0000000..58f04e2 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/Company.java.svn-base @@ -0,0 +1,193 @@ +package com.fp.general.security.rules; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.SQLQuery; +import org.hibernate.ScrollMode; +import org.hibernate.ScrollableResults; + +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; + +/** + * Clase que devuelve las companias + * + * @author scastillo + */ +public class Company extends QueryRule { + + private static final String SQL = + "select tgc.COMPANYCODE value," + + " (select tcp.NAME" + + " from TCUSTPERSONDETAIL tcp" + + " where tcp.PERSONCODE = tgc.PERSONCODE" + + " and tcp.DATETO = :dateto) label" + + " from TGENECOMPANY tgc" + + " where tgc.ACTIVE = :active"; + + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + try { + if(pQueryRequest.isJsf()){ + response.put("CIAS", this.getCompanyJsf()); + }else{ + response.put("T", this.getCompany()); + } + + + } catch (Exception e) { + ExceptionHandler eh = new ExceptionHandler(e, "es"); + APPLogger.getLogger().error("User Message:==>\n" + eh.getUserMessage()); + APPLogger.getLogger().error("Tech Message:==>\n" + eh.getTechnicalMessage()); + APPLogger.getLogger().error("Stack Message:==>\n" + eh.getStackTrace()); + } + + return pQueryRequest; + } + + /** + * Metodo que asigna la data de companias en un map + * @return + * @throws Exception + */ + private List> getCompany() throws Exception { + ScrollableResults rSet = null; + List> ldata = new ArrayList>(); + try { + rSet = this.executeQuery(); + while (rSet.next()) { + Object[] obj = rSet.get(); + Map mData = new HashMap(); + Integer company = (Integer) obj[0]; + String companyname = (String) obj[1]; + mData.put("value", company); + mData.put("label", companyname); + TgeneParametersKey tgeneParametersKey = new TgeneParametersKey("JSVERSION", company); + TgeneParameters tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), + tgeneParametersKey); + if (tgeneParameters != null && tgeneParameters.getNumbervalue() != null) { + mData.put("vd", tgeneParameters.getNumbervalue().intValue()); + } else { + mData.put("vd", 0); + } + tgeneParametersKey = new TgeneParametersKey("LOGO", company); + tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), + tgeneParametersKey); + if (tgeneParameters != null && tgeneParameters.getTextvalue() != null) { + mData.put("lo", tgeneParameters.getTextvalue()); + } else { + mData.put("lo", "images/company/default.gif"); + } + tgeneParametersKey = new TgeneParametersKey("FORMATDATE", company); + tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), + tgeneParametersKey); + if (tgeneParameters != null && tgeneParameters.getTextvalue() != null) { + mData.put("fd", tgeneParameters.getTextvalue()); + } else { + mData.put("fd", "yyyy-MM-dd"); + } + tgeneParametersKey = new TgeneParametersKey("IMGFONDO", company); + tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), + tgeneParametersKey); + if (tgeneParameters != null && tgeneParameters.getTextvalue() != null) { + mData.put("fi", tgeneParameters.getTextvalue()); + } else { + mData.put("fi", null); + } + tgeneParametersKey = new TgeneParametersKey("TOPMENU", company); + tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), + tgeneParametersKey); + if (tgeneParameters != null && tgeneParameters.getTextvalue() != null + && tgeneParameters.getTextvalue().compareTo("Y") == 0) { + mData.put("tm", "Y"); + } else { + mData.put("tm", "N"); + } + tgeneParametersKey = new TgeneParametersKey("TIMEOUT", (Integer) obj[0]); + tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), + tgeneParametersKey); + if (tgeneParameters != null && tgeneParameters.getNumbervalue() != null) { + mData.put("to", tgeneParameters.getNumbervalue().intValue()); + } else { + mData.put("to", 600); + } + //Se adiciona todos los parametros por compania + ldata.add(mData); + } + } finally { + if (rSet != null ) { + try { + rSet.close(); + } catch (Exception e) { + //Si el rset esta cerrado no hacer nada. + } + + } + } + return ldata; + } + + /** + * Metodo que asigna la data de companias en un map + * @return + * @throws Exception + */ + private List> getCompanyJsf() throws Exception { + ScrollableResults rSet = null; + List> ldata = new ArrayList>(); + try { + rSet = this.executeQuery(); + while (rSet.next()) { + Object[] obj = rSet.get(); + Map mData = new HashMap(); + Integer company = (Integer) obj[0]; + String companyname = (String) obj[1]; + mData.put("company", company); + mData.put("name", companyname); + //Se adiciona todos los parametros por compania + ldata.add(mData); + } + } finally { + if (rSet != null ) { + try { + rSet.close(); + } catch (Exception e) { + //Si el rset esta cerrado no hacer nada. + } + + } + } + return ldata; + } + + + + /** + * Metodo que ejecuta el query para obtener el codigo y nombre de las companias + * + * @param pQueryRequest + * @return + * @throws Exception + */ + private ScrollableResults executeQuery() throws Exception { + ScrollableResults rSet = null; + SQLQuery sql = PersistenceHelper.getSession().createSQLQuery(Company.SQL); + sql.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + sql.setParameter("active", "Y"); + sql.addScalar("value", new org.hibernate.type.IntegerType()); + sql.addScalar("label", new org.hibernate.type.StringType()); + + rSet = sql.scroll(ScrollMode.FORWARD_ONLY); + return rSet; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/CreateInternalCodeUser.java.svn-base b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/CreateInternalCodeUser.java.svn-base new file mode 100644 index 0000000..1a4c100 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/CreateInternalCodeUser.java.svn-base @@ -0,0 +1,99 @@ +package com.fp.general.security.rules; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.safe.TsafeUser; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Clase que se encuentra del manejo + * @author scastillo + */ +public class CreateInternalCodeUser extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /** + * Metodo que se encarga de completar el codigo interno eln la creacion de usuarios + * @param pSaveRequest + * @return + * @throws Exception + */ + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + // Si la pantalla es diferente de tx 1 120 , se procede a validar creacion de usuarios + if(!pSaveRequest.get("PANTALLA").toString().equalsIgnoreCase("USUARIOSPERFIL_MOD1_TX120")){ + if( !pSaveRequest.isJsf()){ + TsafeUser tsafeUser = (TsafeUser) pSaveRequest.getSaveBeanModifiedObject("TSAFEUSER"); + this.validateuser(tsafeUser.getPk().trim(), tsafeUser.getCompanycode()); + tsafeUser.setInternalcode(getInternalCode()); + }else{ + this.proessjsf(pSaveRequest); + } + } + return pSaveRequest; + } + + private void proessjsf(SaveRequest pSaveRequest) throws Exception { + TsafeUserDetail ud = (TsafeUserDetail) pSaveRequest.getSaveBeanModifiedObject("USERDETAIL"); + if(ud == null){ + return; + } + this.validateuser(ud.getPk().getUsercode(), ud.getCompanycode()); + TsafeUser tsu = new TsafeUser(ud.getPk().getUsercode()); + tsu.setPersoncode(ud.getPk().getPersoncode()); + tsu.setCompanycode(ud.getCompanycode()); + tsu.setInternalcode(getInternalCode()); + pSaveRequest.putSaveBean("TSAFEUSER", tsu, 1); + } + + private void validateuser(String usercode, Integer company) throws Exception { + String code = this.findUser(usercode, company); + if(code!=null){ + throw new GeneralException("GENE-0042", "CDIGO DE USUARIO YA EXISTE: {0}", code); + } + } + + /** + * Metodo que se ejecuta en modo reverso + * @param pSaveRequest + * @return + * @throws Exception + */ + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + /** + * Metodo que obtiene el numero correspondiente para el codigo interno del usuario + * @return + * @throws Exception + */ + private Integer getInternalCode() throws Exception { + Sequence sequence = new Sequence(); + return Integer.valueOf(sequence.getNextValue("INTERNALCODE").toString()); + } + private static String JPQL_USER ="select t.pk from TsafeUser t where t.pk = :usercode " + + " and t.companycode = :company"; + + private String findUser(String usercode,Integer company) throws Exception{ + String code; + Query qry = PersistenceHelper.getEntityManager().createQuery(JPQL_USER); + qry.setParameter("usercode", usercode); + qry.setParameter("company", company); + try { + code = (String)qry.getSingleResult(); + } catch (NoResultException e) { + return code =null; + } + return code; + } + + + +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/MaintenanceMenu.java.svn-base b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/MaintenanceMenu.java.svn-base new file mode 100644 index 0000000..6cd31da --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/MaintenanceMenu.java.svn-base @@ -0,0 +1,192 @@ +package com.fp.general.security.rules; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveBean; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevel; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelDesc; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelKey; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevel; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelDesc; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelKey; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Query; + +/** + * Clase que se encarga de del mantenimiento de menu para que se vuelva mas simple su manejo + * @author scastillo + */ +public class MaintenanceMenu extends TransactionRule { + + /** + * Metodo que se ejecuta en modo normal + * @param pSaveRequest + * @return + * @throws Exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + List lmodifyMenuLevel = pSaveRequest.getSaveBeanModifiedRecords("TGENEMENULEVELDESC"); + this.completeMenuLevel(pSaveRequest, lmodifyMenuLevel); + + List ldeleteMenuLevel = pSaveRequest.getSaveBeanDeletedRecords("TGENEMENULEVELDESC"); + this.deleteMenuLevel(pSaveRequest, ldeleteMenuLevel); + List lmodifyMenuSubLevel = pSaveRequest.getSaveBeanModifiedRecords("TGENEMENUSUBLEVELDESC"); + this.completeMenuSubLevel(pSaveRequest, lmodifyMenuSubLevel); + + List ldeleteMenuSubLevel = pSaveRequest.getSaveBeanDeletedRecords("TGENEMENUSUBLEVELDESC"); + this.deleteMenuSubLevel(pSaveRequest, ldeleteMenuSubLevel); + return pSaveRequest; + } + + /** + * Metodo que se encarga de verificar los datos cuando estos son eliminados + * @param pSaveRequest + * @param lmodifyMenuLevel + * @throws Exception + */ + private void completeMenuLevel(SaveRequest pSaveRequest, List lmodifyMenuLevel) throws Exception { + if (lmodifyMenuLevel != null) { + List lTgeneMenuLevel = new ArrayList(); + for (int i = 0; i < lmodifyMenuLevel.size(); i++) { + TgeneMenuLevelDesc tgeneMenuLevelDesc = (TgeneMenuLevelDesc) lmodifyMenuLevel.get(i); + Integer presentationorder = new Integer(tgeneMenuLevelDesc.get("presentationorder").toString()); + + TgeneMenuLevelKey TgeneMenuLevelKey = new TgeneMenuLevelKey(); + TgeneMenuLevelKey.setMenucode(tgeneMenuLevelDesc.getPk().getMenucode()); + TgeneMenuLevelKey.setLevelcode(tgeneMenuLevelDesc.getPk().getLevelcode()); + TgeneMenuLevel tgeneMenuLevel = TgeneMenuLevel.find(PersistenceHelper.getEntityManager(), TgeneMenuLevelKey); + if (tgeneMenuLevel == null) { + tgeneMenuLevel = new TgeneMenuLevel(); + tgeneMenuLevel.setPk(TgeneMenuLevelKey); + tgeneMenuLevel.setHavesublevel("Y"); + tgeneMenuLevel.setPresentationorder(presentationorder); + lTgeneMenuLevel.add(tgeneMenuLevel); + } else { + if (tgeneMenuLevel.getPresentationorder() != presentationorder) { + tgeneMenuLevel.setPresentationorder(presentationorder); + lTgeneMenuLevel.add(tgeneMenuLevel); + } + } + } + if (lTgeneMenuLevel.size() > 0) { + pSaveRequest.putSaveBean("TGENEMENULEVEL", lTgeneMenuLevel, 1); + } + } + } + + /** + * + * @param pSaveRequest + * @param ldeleteMenuLevel + * @throws Exception + */ + private void deleteMenuLevel(SaveRequest pSaveRequest, List ldeleteMenuLevel) throws Exception { + if(ldeleteMenuLevel == null){ + return; + } + List ldeleterecors = new ArrayList(); + for (int i = 0; i < ldeleteMenuLevel.size(); i++) { + TgeneMenuLevelDesc tgeneMenuLevelDesc = (TgeneMenuLevelDesc) ldeleteMenuLevel.get(i); + TgeneMenuLevelKey TgeneMenuLevelKey = new TgeneMenuLevelKey(); + TgeneMenuLevelKey.setMenucode(tgeneMenuLevelDesc.getPk().getMenucode()); + TgeneMenuLevelKey.setLevelcode(tgeneMenuLevelDesc.getPk().getLevelcode()); + TgeneMenuLevel tgeneMenuLevel = TgeneMenuLevel.find(PersistenceHelper.getEntityManager(), TgeneMenuLevelKey); + if (tgeneMenuLevel != null) { + ldeleterecors.add(tgeneMenuLevel); + } + } + if(!ldeleterecors.isEmpty()){ + SaveBean sb = (SaveBean)pSaveRequest.get("TGENEMENULEVEL"); + if(sb!=null){ + sb.setDeletedRecords(ldeleterecors); + } + } + } + + /** + * Metodo que completa y modificalos datos para subniveles + * @param pSaveRequest + * @param lmodifyMenuSubLevel + * @throws Exception + */ + private void completeMenuSubLevel(SaveRequest pSaveRequest, List lmodifyMenuSubLevel) throws Exception { + if (lmodifyMenuSubLevel != null) { + List lTgeneMenuSubLevel = new ArrayList(); + for (int i = 0; i < lmodifyMenuSubLevel.size(); i++) { + TgeneMenuSubLevelDesc tgeneMenuSubLevelDesc = (TgeneMenuSubLevelDesc) lmodifyMenuSubLevel.get(i); + Integer presentationorder = new Integer(tgeneMenuSubLevelDesc.get("presentationorder").toString()); + TgeneMenuSubLevelKey tgeneMenuSubLevelKey = new TgeneMenuSubLevelKey(); + tgeneMenuSubLevelKey.setMenucode(tgeneMenuSubLevelDesc.getPk().getMenucode()); + tgeneMenuSubLevelKey.setLevelcode(tgeneMenuSubLevelDesc.getPk().getLevelcode()); + tgeneMenuSubLevelKey.setSublevel(tgeneMenuSubLevelDesc.getPk().getSublevel()); + TgeneMenuSubLevel tgeneMenuSubLevel = TgeneMenuSubLevel.find(PersistenceHelper.getEntityManager(), tgeneMenuSubLevelKey); + if (tgeneMenuSubLevel == null) { + tgeneMenuSubLevel = new TgeneMenuSubLevel(); + tgeneMenuSubLevel.setPk(tgeneMenuSubLevelKey); + tgeneMenuSubLevel.setPresentationorder(presentationorder); + lTgeneMenuSubLevel.add(tgeneMenuSubLevel); + } else { + if (tgeneMenuSubLevel.getPresentationorder() != presentationorder) { + tgeneMenuSubLevel.setPresentationorder(presentationorder); + lTgeneMenuSubLevel.add(tgeneMenuSubLevel); + } + } + } + if (lTgeneMenuSubLevel.size() > 0) { + pSaveRequest.putSaveBean("TGENEMENUSUBLEVEL", lTgeneMenuSubLevel, 1); + } + } + } + + /** + * + * @param pSaveRequest + * @param ldeleteMenuLevel + * @throws Exception + */ + private void deleteMenuSubLevel(SaveRequest pSaveRequest, List ldeleteMenuSubLevel) throws Exception { + if(ldeleteMenuSubLevel == null){ + return; + } + List ldeleterecors = new ArrayList(); + for (int i = 0; i < ldeleteMenuSubLevel.size(); i++) { + TgeneMenuSubLevelDesc tgeneMenuSubLevelDesc = (TgeneMenuSubLevelDesc) ldeleteMenuSubLevel.get(i); + TgeneMenuSubLevelKey TgeneMenuSubLevelKey = new TgeneMenuSubLevelKey(); + TgeneMenuSubLevelKey.setMenucode(tgeneMenuSubLevelDesc.getPk().getMenucode()); + TgeneMenuSubLevelKey.setLevelcode(tgeneMenuSubLevelDesc.getPk().getLevelcode()); + TgeneMenuSubLevelKey.setSublevel(tgeneMenuSubLevelDesc.getPk().getSublevel()); + TgeneMenuSubLevel tgeneMenuSubLevel = TgeneMenuSubLevel.find(PersistenceHelper.getEntityManager(), TgeneMenuSubLevelKey); + PersistenceHelper.delete(tgeneMenuSubLevelDesc); + if (tgeneMenuSubLevel != null) { + PersistenceHelper.delete(tgeneMenuSubLevel); + //ldeleterecors.add(tgeneMenuSubLevel); + } + } + SaveBean sb = (SaveBean)pSaveRequest.get("TGENEMENUSUBLEVELDESC"); + if(sb!=null){ + sb.setDeletedRecords(new ArrayList<>()); + } + //if(!ldeleterecors.isEmpty()){ + // SaveBean sb = (SaveBean)pSaveRequest.get("TGENEMENUSUBLEVEL"); + // if(sb!=null){ + // sb.setDeletedRecords(ldeleterecors); + // } + //} + } + + /** + * Metodo que se ejecuta en modo reverso + * @param pSaveRequest + * @return + * @throws Exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/MaintenanceUser.java.svn-base b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/MaintenanceUser.java.svn-base new file mode 100644 index 0000000..e6658ea --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/MaintenanceUser.java.svn-base @@ -0,0 +1,96 @@ +package com.fp.general.security.rules; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pbpm.gene.TbpmGroupsUsers; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetailKey; +import com.fp.persistence.pgeneral.safe.TsafeUserSession; +import com.fp.persistence.pgeneral.safe.TsafeUserSessionKey; +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +/** + * Clase que se va de encargar cuando se activa un usuario de eliminarlo de la tabla tsafeusersession para que se pueda loguear + * @author scastillo + */ +public class MaintenanceUser extends TransactionRule { + + /** + * Metodo que busca si estael usuario logueado lo eliminar de la sesion + * @param sr + * @return + * @throws Exception + */ + @Override + public SaveRequest normalProcess(SaveRequest sr) throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) sr.getSaveBeanModifiedObject("TSAFEUSERDETAIL"); + if (tsafeUserDetail == null) { + tsafeUserDetail = (TsafeUserDetail) sr.getSaveBeanModifiedObject("USERDETAIL"); + } + if (tsafeUserDetail == null) { + return sr; + } + String task = (String) tsafeUserDetail.get("task"); + String isuserbpm = tsafeUserDetail.getIsuserbpm(); + String usercode = tsafeUserDetail.getPk().getUsercode(); + TsafeUserDetailKey tsafeUserDetailKey = new TsafeUserDetailKey(); + tsafeUserDetailKey.setDateto(FormatDates.getDefaultExpiryTimestamp()); + tsafeUserDetailKey.setPersoncode(tsafeUserDetail.getPk().getPersoncode()); + tsafeUserDetailKey.setUsercode(tsafeUserDetail.getPk().getUsercode()); + TsafeUserDetail tsafeUserDetailPreview = TsafeUserDetail.find(PersistenceHelper.getEntityManager(), tsafeUserDetailKey); + if (tsafeUserDetailPreview != null && tsafeUserDetailPreview.getUserstatuscatalog().compareTo("BLQ") == 0 + && tsafeUserDetail.getUserstatuscatalog().compareTo("ACT") == 0) { +// TsafeUserSessionKey tsafeUserSessionKey = new TsafeUserSessionKey(); +// tsafeUserSessionKey.setDateto(FormatDates.getDefaultExpiryTimestamp()); +// tsafeUserSessionKey.setUsercode(tsafeUserDetail.getPk().getUsercode()); +// TsafeUserSession tsafeUserSession = TsafeUserSession.find(PersistenceHelper.getEntityManager(), tsafeUserSessionKey); +// if (tsafeUserSession != null) { +// Query qry = PersistenceHelper.getEntityManager().createQuery("update TsafeUserSession set pk.dateto=:expiration where pk.dateto = :dateto and pk.usercode = :usercode"); +// qry.setParameter("expiration", FormatDates.getInstance().getDataBaseTimestamp()); +// qry.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); +// qry.setParameter("usercode", tsafeUserSession.getPk().getUsercode()); +// qry.executeUpdate(); +// } + } + this.verifyUserGroup(task, isuserbpm, usercode); + return sr; + } + + /** + * Modo que se ejecuta en modo reverso + * @param sr + * @return + * @throws Exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest sr) throws Exception { + return sr; + } + + /** + * Verifica si el usuario del bpm a sido eliminado, lo elimina del grupo. + * @param task + * @param isuserbpm + * @param usercode + * @throws Exception + */ + private void verifyUserGroup(String task, String isuserbpm, String usercode) throws Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + + if (task!=null && task.compareTo("NOTASK") == 0 && isuserbpm.compareTo("N") == 0) { + Query qry = em.createQuery("from TbpmGroupsUsers g where g.pk.usercode = :code"); + qry.setParameter("code", usercode); + @SuppressWarnings("unchecked") + List objs = (List)qry.getResultList(); + if(!objs.isEmpty()){ + for(TbpmGroupsUsers tbpmGroupsUsers: objs){ + PersistenceHelper.delete(tbpmGroupsUsers); + } + } + } + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/Menu.java.svn-base b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/Menu.java.svn-base new file mode 100644 index 0000000..d92fa8f --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/Menu.java.svn-base @@ -0,0 +1,136 @@ +package com.fp.general.security.rules; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.common.helper.Constant; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.general.db.DataHelper; +import com.fp.general.exception.GeneralException; +import com.fp.general.helper.MenuHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevel; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelDesc; +import com.fp.persistence.pgeneral.menu.TgeneMenuProfile; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevel; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelDesc; + +/** + * Clase que se encarga de armar y entregar el menu, asociado a un perfil. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class Menu extends MenuHelper { + + /** Map que contiene los datos del menu. */ + private final Map rootmenu = new HashMap(); + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.QueryRule#process(com.fp.dto.query.QueryRequest) + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + String profile = pQueryRequest.getProfile(); + String language = pQueryRequest.getLanguage(); + TgeneMenuProfile menuprofile = DataHelper.getInstance().getTgeneMenuProfile(profile); + if (menuprofile != null) { + List lMenuLevel = DataHelper.getInstance().getTgeneMenuLevel(menuprofile.getMenucode()); + List> lLevels = new ArrayList>(); + for (TgeneMenuLevel obj : lMenuLevel) { + this.completeLevel(obj, lLevels, language); + } + rootmenu.put("items", lLevels); + rootmenu.put("label", "t"); + response.put("rootmenu", rootmenu); + } else { + throw new GeneralException("GENE-0017", "EL PERFIL {0} NO TIENE ASOCIADO UN MENU", profile); + } + return pQueryRequest; + } + + /** + * Metodo que completa datos del grupo de menu. + * + * @param pTgeneMenuGroup Definicion de grupo de menu. + * @param pGroup Grupo de menu a completar datos. + * @param languagecode Codigo de lenguage. + * @return boolean + * @throws Exception + */ + private boolean completeLevel(TgeneMenuLevel pTgeneMenuLevel, List> lLevels, String languagecode) throws Exception { + TgeneMenuLevelDesc tgeneMenuLevelDesc = DataHelper.getInstance().getTgeneMenuLevelDesc(pTgeneMenuLevel.getPk().getMenucode(), + pTgeneMenuLevel.getPk().getLevelcode(), languagecode); + if (tgeneMenuLevelDesc != null) { + String labelMenu = tgeneMenuLevelDesc.getDescription(); + if (labelMenu == null) { + labelMenu = "ETIQUETA DE MENU NO DEFINIDA"; + } + Map mlevel = new HashMap(); + mlevel.put("t", Constant.capitalize(labelMenu)); + mlevel.put("sl", Constant.ifYes(pTgeneMenuLevel.getHavesublevel()) == true ? "Y" : "N"); + List lData = super.completTransactionByLevel(tgeneMenuLevelDesc, languagecode); + if (Constant.ifYes(pTgeneMenuLevel.getHavesublevel())) { + this.fillSubLevel(pTgeneMenuLevel, lData, languagecode); + } + mlevel.put("items", lData); + lLevels.add(mlevel); + } + return true; + } + + /** + * Metodo que se encarga de construir ya dicionar el segundo nivel del menu. + * + * @param pTgeneMenuLevel Datos del segundo nivel del menu. + * @param lData Lista que contiene los datos del primer nivel del menu, al cual se adiciona los datos del segundo + * nivel del menu. + * @param languagecode Codigo de lenguaje del usuario. + * @throws Exception + */ + private void fillSubLevel(TgeneMenuLevel pTgeneMenuLevel, List lData, String languagecode) throws Exception { + List lSubLevel = DataHelper.getInstance().getTgeneMenuSuLevels(pTgeneMenuLevel.getPk().getMenucode(), + pTgeneMenuLevel.getPk().getLevelcode()); + if (lSubLevel == null) { + return; + } + for (TgeneMenuSubLevel obj : lSubLevel) { + Map mLevel = new HashMap(); + this.completeSubLevel(obj, mLevel, languagecode); + if (!mLevel.isEmpty()) { + lData.add(mLevel); + } else { + APPLogger.getLogger().debug( + "\nETIQUETA DE SUBNIVEL NO DEFINIDA\n\tmenucode=" + obj.getPk().getMenucode() + ";\n\tlevelcode=" + + obj.getPk().getLevelcode() + ";\n\tsublevelcode=" + obj.getPk().getSublevel() + ";\n\tlanguage=" + languagecode); + } + } + } + + /** + * Metodo que completa datos del segundo nivel del menu. + * + * @param pMenuSubLevel Datos del segundo nivel del menu. + * @param mLevel Map que contiene informacion de todas las opciones del segundo nivel del menu. + * @param languagecode Codigo de lenguaje del usuario. + * @throws Exception + */ + private void completeSubLevel(TgeneMenuSubLevel pMenuSubLevel, Map mLevel, String languagecode) throws Exception { + TgeneMenuSubLevelDesc subleveldesc = DataHelper.getInstance().getTgeneMenuSubLevelDesc(pMenuSubLevel.getPk().getMenucode(), + pMenuSubLevel.getPk().getLevelcode(), pMenuSubLevel.getPk().getSublevel(), languagecode); + if (subleveldesc != null) { + String labelMenu = subleveldesc.getDescription(); + if (labelMenu == null) { + labelMenu = "ETIQUETA DE MENU NO DEFINIDA"; + } + mLevel.put("t", Constant.capitalize(labelMenu)); + super.completTransactionBySubLevel(subleveldesc, mLevel, languagecode); + } + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/Politics.java.svn-base b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/Politics.java.svn-base new file mode 100644 index 0000000..50fbe2b --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/Politics.java.svn-base @@ -0,0 +1,264 @@ +package com.fp.general.security.rules; + +import java.util.List; + +import com.fp.common.base64.Base64Input; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.safe.TsafePassword; +import com.fp.persistence.pgeneral.safe.TsafePasswordKey; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetailKey; + +/** + * Clase que se encarga de validar la politica de seguridad definida en TsafePassword. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class Politics extends TransactionRule { + + /***/ + private static final String UPPER = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + + private static final String LOWER = "abcdefghijklmnopqrstuvwxyz"; + + private static final String NUMBERS = "0123456789"; + + /** Tabla que almnacena politica de seguridad del password. */ + private TsafePassword tsafePassword = null; + + private Integer numeric = 0; + + private Integer upper = 0; + + private Integer lower = 0; + + private Integer special = 0; + + /** + * Metodo que caduca el registro vigente del inicio de sesion + * + * @param pSaveRequest Datos del request original. + * @return SaveRequest + * @throws Exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + TsafeUserDetail tsafeUserDetailForm = (TsafeUserDetail) pSaveRequest.getSaveBeanModifiedObject("TSAFEUSERDETAIL"); + TsafeUserDetailKey tsafeUserDetailKey = new TsafeUserDetailKey(tsafeUserDetailForm.getPk().getUsercode(), tsafeUserDetailForm.getPk() + .getPersoncode(), FormatDates.getDefaultExpiryTimestamp()); + TsafeUserDetail tsafeUserDetail = TsafeUserDetail.find(PersistenceHelper.getEntityManager(), tsafeUserDetailKey); + TsafePasswordKey key = new TsafePasswordKey(pSaveRequest.getCompany(), pSaveRequest.getChannelCode()); + this.tsafePassword = TsafePassword.find(PersistenceHelper.getEntityManager(), key); + String value = tsafeUserDetailForm.get("origination").toString(); + String oldpassword = tsafeUserDetailForm.get("oldpassword").toString(); + String passindatabase = tsafeUserDetail.getPassword(); + if(pSaveRequest.isJsf()){ + passindatabase = ((TsafeUserDetail)tsafeUserDetailForm.get("ORIGINALBEAN")).getPassword(); + value = tsafeUserDetailForm.get("newpassword").toString(); + } + + if ((oldpassword != null) && (oldpassword.compareTo("") != 0) && (passindatabase.compareTo(oldpassword) != 0)) { + throw new GeneralException("GENE-0025", "CONTRASEA ANTERIOR INCORRECTA"); + } + // Valida politica de seguridad + this.validate(value, pSaveRequest.isJsf()); + // Valida que no se repitan los ultimos n passwords + this.validateNotrepeated(tsafeUserDetailForm, tsafeUserDetailForm.get("origination").toString() ); + return pSaveRequest; + } + + /** + * Metodo que valida la politica de seguridad del password. + * + * @param value Password en base 64. + * @throws Exception + */ + private void validate(String value, boolean isjsf) throws Exception { + // OBTIENE EL PASSWORD EN CARACTER + if(!isjsf){ + value = Base64Input.decodificar(value); + } + this.validateLength(value); + for (int i = 0; i < value.length(); i++) { + String c = value.substring(i, i + 1); + this.compute(c); + } + this.validateNumbers(); + this.validateUppercase(); + this.validateLowercase(); + this.validateSpecial(); + + } + + /** + * Metodo que valida la longitud del password. + * + * @param value Datos de la clave a validar. + * @return boolean + * @throws Exception + */ + private void validateLength(String value) throws Exception { + if ((this.tsafePassword.getMinlength() != null) && (value.length() < this.tsafePassword.getMinlength())) { + throw new GeneralException("GENE-0030", "LA LONGITUD MNIMA DE LA CONTRASEA DEBE SER DE {0} CARACTERES", this.tsafePassword.getMinlength()); + } + } + + /** + * Metodo que valida numeros minimos en el password. + * + * @throws Exception + */ + private void validateNumbers() throws Exception { + if ((this.tsafePassword.getMinnumber() != null) && (this.tsafePassword.getMinnumber() > 0) + && (this.tsafePassword.getMinnumber() > this.numeric)) { + throw new GeneralException("GENE-0029", "LA CONTRASEA DEBE TENER POR LO MENOS {0} NMEROS", this.tsafePassword.getMinnumber()); + } + } + + /** + * Metodo que valida letras mayusculas minimas en el password. + * + * @throws Exception + */ + private void validateUppercase() throws Exception { + if ((this.tsafePassword.getMinuppercase() != null) && (this.tsafePassword.getMinuppercase() > 0) + && (this.tsafePassword.getMinuppercase() > this.upper)) { + throw new GeneralException("GENE-0028", "LA CONTRASEA DEBE TENER POR LO MENOS {0} LETRAS MAYSCULAS", this.tsafePassword.getMinuppercase()); + } + } + + /** + * Metodo que valida letras minusculas minimas en el password. + * + * @throws Exception + */ + private void validateLowercase() throws Exception { + if ((this.tsafePassword.getMinlowercase() != null) && (this.tsafePassword.getMinlowercase() > 0) + && (this.tsafePassword.getMinlowercase() > this.lower)) { + throw new GeneralException("GENE-0026", "LA CONTRASEA DEBE TENER POR LO MENOS {0} LETRAS MINSCULAS", this.tsafePassword.getMinlowercase()); + } + } + + /** + * Metodo que valida los caracteres especiales. + * + * @throws Exception + */ + private void validateSpecial() throws Exception { + if ((this.tsafePassword.getMinspecialcharacters() != null) && (this.tsafePassword.getMinspecialcharacters() > 0) + && (this.tsafePassword.getMinspecialcharacters() > this.special)) { + throw new GeneralException("GENE-0027", "LA CONTRASEA DEBE TENER POR LO MENOS {0} CARACTERES ESPECIALES", + this.tsafePassword.getMinspecialcharacters()); + } + } + + /** + * Valida que el password no se repita en las ultimas n veces. + * + * @param obj Datos del nuevo password. + * @throws Exception + */ + private void validateNotrepeated(TsafeUserDetail useerdetail, String passindatabase) throws Exception { + if ((this.tsafePassword.getMinnotrepeated() == null) || (this.tsafePassword.getMinnotrepeated().compareTo(0) == 0)) { + return; + } + List ldata = TsafeUserDetail.find(PersistenceHelper.getEntityManager(), useerdetail.getPk().getUsercode(), + this.tsafePassword.getMinnotrepeated()); + if ((ldata == null) || ldata.isEmpty()) { + return; + } + + for (TsafeUserDetail obj : ldata) { + if(obj.get("ORIGINALBEAN") != null){ + continue; + } + PersistenceHelper.detatch(obj); + if (obj.getPassword().compareTo(passindatabase) == 0) { + throw new GeneralException("GENE-0022", "NO PUEDE REPETIR LAS LTIMAS: {0} CONTRASEAS", this.tsafePassword.getMinnotrepeated()); + } + } + } + + /** + * Metodo que se encarga de acumular, numeros, mayusculas y/o minusculas. + * + * @param c Datoa a verificar. + * @throws Exception + */ + private void compute(String c) throws Exception { + if (this.isNumber(c)) { + this.numeric++; + return; + } + if (this.isUppercase(c)) { + this.upper++; + return; + } + if (this.isLowercase(c)) { + this.lower++; + return; + } + // Si no es numero, mayuscula o minuscula es un caractwer especial + this.special++; + } + + /** + * Metdo que verifica si el caracter es un numero. + * + * @param value Dato a verificar si es un numero + * @return boolean + * @throws Exception + */ + private boolean isNumber(String value) throws Exception { + if (Politics.NUMBERS.indexOf(value) >= 0) { + return true; + } + return false; + } + + /** + * Metdo que verifica si el caracter es una mayuscula, incluye tildes. + * + * @param value Dato a verificar si es una mayuscula + * @return boolean + * @throws Exception + */ + private boolean isUppercase(String value) throws Exception { + if (Politics.UPPER.indexOf(value) >= 0) { + return true; + } + return false; + } + + /** + * Metdo que verifica si el caracter es una minuscula incluye tildes. + * + * @param value Dato a verificar si es una minuscula + * @return boolean + * @throws Exception + */ + private boolean isLowercase(String value) throws Exception { + if (Politics.LOWER.indexOf(value) >= 0) { + return true; + } + return false; + } + + /** + * Metodo que se ejecuta en modo reverso + * + * @param pSaveRequest + * @return SaveRequest + * @throws Exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/UserLogon.java.svn-base b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/UserLogon.java.svn-base new file mode 100644 index 0000000..9f9efdf --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/UserLogon.java.svn-base @@ -0,0 +1,601 @@ +package com.fp.general.security.rules; + +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpm.query.Query; +import com.fp.common.helper.CalculationBase; +import com.fp.dto.data.SaveData; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.general.db.DataHelper; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.NestedSave; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.APPDates; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.gene.TgeneArea; +import com.fp.persistence.pgeneral.gene.TgeneAreaKey; +import com.fp.persistence.pgeneral.gene.TgeneBranch; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; +import com.fp.persistence.pgeneral.gene.TgeneChannels; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCityKey; +import com.fp.persistence.pgeneral.gene.TgeneCompany; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneLabel; +import com.fp.persistence.pgeneral.gene.TgeneOffice; +import com.fp.persistence.pgeneral.gene.TgeneOfficeKey; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.gene.TgeneProvinceKey; +import com.fp.persistence.pgeneral.safe.TsafeJavaScript; +import com.fp.persistence.pgeneral.safe.TsafePassword; +import com.fp.persistence.pgeneral.safe.TsafePasswordKey; +import com.fp.persistence.pgeneral.safe.TsafeProfile; +import com.fp.persistence.pgeneral.safe.TsafeTerminal; +import com.fp.persistence.pgeneral.safe.TsafeTerminalKey; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserProfile; +import com.fp.persistence.pgeneral.safe.TsafeUserSession; +import com.fp.persistence.pgeneral.safe.TsafeUserSessionKey; +import com.fp.persistence.pgeneral.safe.TsafeUserSessionLog; +import com.fp.persistence.pgeneral.safe.TsafeUserSessionLogKey; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Clase que se encargara del ingreso a la aplicacion + * + * @author scastillo + * @version 2.1 + */ +public class UserLogon extends QueryRule { + + private static final long serialVersionUID = 1L; + + private static SimpleDateFormat simpleDateFormatCreateTime = new SimpleDateFormat("HH:mm:ss"); + + private TsafePassword tsafePassword; + + private boolean isjsf; + + /** + * Metodo que ejecuta el proceso + * + * @param pQueryRequest + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + isjsf = pQueryRequest.isJsf(); + TsafeUserDetail userdetail = this.getTsafeUserDetail(pQueryRequest); + + String terminal = (String) pQueryRequest.get("ip"); + String host = (String) pQueryRequest.get("host"); + String jsessionid = (String) pQueryRequest.get("jsessionid"); + String usercode = (String) pQueryRequest.get("login"); + if (userdetail == null) { + this.writeLog(pQueryRequest, usercode, terminal, jsessionid, host, "GENE-0011", "USUARIO NO EXISTE"); + throw new GeneralException("GENE-0011", "USUARIO NO EXISTE"); + } + if (userdetail.getUserstatuscatalog().compareTo("ACT") != 0) { + TgeneCatalogDetailKey tgeneCatalogDetailKey = new TgeneCatalogDetailKey(userdetail.getUserstatuscatalog(), + userdetail.getUserstatuscatalogcode()); + TgeneCatalogDetail tgeneCatalogDetail = TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), tgeneCatalogDetailKey); + this.writeLog(pQueryRequest, userdetail, "GENE-0010", "EL USUARIO " + userdetail.getPk().getUsercode() + " SE ENCUENTRA " + + tgeneCatalogDetail.getDescription()); + throw new GeneralException("GENE-0010", "EL USUARIO {0} SE ENCUENTRA {1}", userdetail.getPk().getUsercode(), + tgeneCatalogDetail.getDescription()); + } + TsafeTerminal tsafeTerminal = null; + // userdetail.getTerminalcode() + if ((userdetail.getBranchfromterminal() != null) && (userdetail.getBranchfromterminal().compareTo("Y") == 0) + && (userdetail.getTerminalcode() != null)) { + TsafeTerminalKey tsafeTerminalKey = new TsafeTerminalKey(userdetail.getTerminalcode(), userdetail.getCompanycode()); + TsafeTerminal tsafeTerminalAux = TsafeTerminal.find(PersistenceHelper.getEntityManager(), tsafeTerminalKey); + if (tsafeTerminalAux == null) { + this.writeLog(pQueryRequest, userdetail, "CORE-0002", "TERMINAL " + terminal + " NO DEFINIDO EN TSAFETERMINAL"); + throw new GeneralException("CORE-0002", "TERMINAL {0} NO DEFINIDO EN TSAFETERMINAL", terminal); + } else { + tsafeTerminal = tsafeTerminalAux; + terminal = tsafeTerminalAux.getIpaddress(); + } + } + if (tsafeTerminal == null) { + tsafeTerminal = TsafeTerminal.find(PersistenceHelper.getEntityManager(), userdetail.getCompanycode(), terminal); + } + if ((userdetail.getBranchfromterminal() != null) && (userdetail.getBranchfromterminal().compareTo("Y") == 0)) { + if (tsafeTerminal == null) { + this.writeLog(pQueryRequest, userdetail, "CORE-0002", "TERMINAL " + terminal + " NO DEFINIDO EN TSAFETERMINAL"); + throw new GeneralException("CORE-0002", "TERMINAL {0} NO DEFINIDO EN TSAFETERMINAL", terminal); + } else if ((tsafeTerminal != null) && (userdetail.getTerminalcode() != null)) { + TsafeTerminalKey tsafeTerminalKey = new TsafeTerminalKey(userdetail.getTerminalcode(), userdetail.getCompanycode()); + TsafeTerminal tsafeTerminalaux = TsafeTerminal.find(PersistenceHelper.getEntityManager(), tsafeTerminalKey); + if ((tsafeTerminalaux != null) && (tsafeTerminalaux.getIpaddress() != null) + && (tsafeTerminalaux.getIpaddress().compareTo(terminal) != 0)) { + this.writeLog(pQueryRequest, userdetail, "CORE-0056", "LA IP " + terminal + " NO SE ENCUENTRA AUTORIZADA PARA EL USUARIO " + + userdetail.getPk().getUsercode()); + throw new GeneralException("CORE-0056", "LA IP {0} NO SE ENCUENTRA AUTORIZADA PARA EL USUARIO {1}", terminal, userdetail.getPk() + .getUsercode()); + } + } + if (userdetail.getBranchcode().compareTo(tsafeTerminal.getBranchcode()) != 0) { + throw new GeneralException("CORE-0064", "EL TERMINAL {0} ASOCIADO AL USUARIO SE ENCUENTRA EN OTRA SUCURSAL {1}"); + } + if (userdetail.getOfficecode().compareTo(tsafeTerminal.getOfficecode()) != 0) { + throw new GeneralException("CORE-0065", "EL TERMINAL {0} ASOCIADO AL USUARIO SE ENCUENTRA EN OTRA OFICINA {1}"); + } + if (userdetail.getAreacode().compareTo(tsafeTerminal.getAreacode()) != 0) { + throw new GeneralException("CORE-0066", "EL TERMINAL {0} ASOCIADO AL USUARIO SE ENCUENTRA EN OTRA REA {1}"); + } + } + if ((tsafeTerminal != null) && (tsafeTerminal.getSliptprinter() != null)) { + userdetail.addAddtionalInfo("spn", tsafeTerminal.getSliptprinter()); + } else { + userdetail.addAddtionalInfo("spn", null); + } + TsafePasswordKey key = new TsafePasswordKey(pQueryRequest.getCompany(), userdetail.getChannelcode()); + this.tsafePassword = TsafePassword.find(PersistenceHelper.getEntityManager(), key); + if (this.tsafePassword == null) { + this.writeLog(pQueryRequest, userdetail, "GENE-0023", "POLITICA DE SEGURIDAD NO DEFINIDA"); + throw new GeneralException("GENE-0023", "POLITICA DE SEGURIDAD NO DEFINIDA"); + } + if (!this.validatePassword(userdetail, pQueryRequest, terminal, jsessionid, host)) { + return pQueryRequest; + } + this.completeLocation(userdetail); + this.completeAreaName(userdetail); + this.completeCompanyName(userdetail); + this.completeChannelName(userdetail); + this.completeBranchName(userdetail, pQueryRequest, terminal); + this.completeOfficeName(userdetail); + this.completeProfile(userdetail); + this.completeDates(userdetail); + if (!pQueryRequest.isJsf()) { + this.completeJavaScript(userdetail); + this.completeInternazionalization(userdetail); + } + //datos de usuario de la sbs + TcustPersonDetail tcp = TcustPersonDetail.find(PersistenceHelper.getEntityManager(), userdetail.getPk().getPersoncode()); + userdetail.addAddtionalInfo("sbsemployee", tcp.getSbsemployee()); + userdetail.addAddtionalInfo("sbsusercode", tcp.getSbsusercode()); + + this.createSession(userdetail, pQueryRequest, terminal, jsessionid, host); + //guarda la aceptacion de terminos + System.out.println("0 terminos :: "+pQueryRequest.get("terminos")); + if(pQueryRequest.get("terminos")!=null && !pQueryRequest.get("terminos").toString().trim().isEmpty()){ + //guarda + System.out.println("1 "+pQueryRequest.get("aceptaterminos")); + String acepta=pQueryRequest.get("aceptaterminos").toString(); + System.out.println("2 "+pQueryRequest.get("identificacionterminos")); + String identificacion=pQueryRequest.get("identificacionterminos").toString(); + System.out.println("3 "+pQueryRequest.get("documentoterminos")); + String documento=pQueryRequest.get("documentoterminos").toString(); + this.saveTerminos(acepta,identificacion,documento); + } + return pQueryRequest; + } + + private void saveTerminos(String acepta,String identificacion,String documento) throws Exception { + StringBuilder sql = new StringBuilder("INSERT INTO TARMTERMINOS(CTERMINOS,ACEPTA,IDENTIFICACION,FECHAREGISTRO,DOCUMENTO)" + + " VALUES ((select nvl ( max(CTERMINOS)+1, 1) as ass from TARMTERMINOS)," + + ":acepta,:identificacion,sysdate,:documento) "); + System.out.println("va a ejecutar"); + PersistenceHelper.getEntityManager().createNativeQuery(sql.toString()) + .setParameter("acepta", acepta) + .setParameter("identificacion", identificacion) + .setParameter("documento", documento) + .executeUpdate(); + System.out.println("Ejecuta"); + } + + private TsafeUserDetail getTsafeUserDetail(QueryRequest pQueryRequest) throws Exception { + TsafeUserDetail userdetail = null; + if (!pQueryRequest.isJsf()) { + Query qry = new Query(); + PersistenceHelper.getEntityManager().clear(); + qry.process(pQueryRequest); + userdetail = (TsafeUserDetail) pQueryRequest.getResponse().get("TSAFEUSERDETAIL"); + } else { + userdetail = TsafeUserDetail.find(PersistenceHelper.getEntityManager(), pQueryRequest.getUser()); + pQueryRequest.getResponse().put("TSAFEUSERDETAIL", userdetail); + } + return userdetail; + } + + /** + * Metodo que agrega el nombre de la sucursal y la ip del cleinte en el detail + * + * @param pUserdetail + * @param pQueryRequest + * @param terminal + * @throws Exception + */ + private void completeBranchName(TsafeUserDetail pUserdetail, QueryRequest pQueryRequest, String terminal) throws Exception { + TgeneBranch branch = DataHelper.getInstance().getTgeneBranch(pUserdetail.getBranchcode(), pUserdetail.getCompanycode()); + pUserdetail.addAddtionalInfo("bn", branch.getDescription()); + pUserdetail.addAddtionalInfo("ip", terminal); + } + + /** + * Metodo que agrega la descripcin del area del usuario + * + * @param pUserdetail + * @throws Exception + */ + private void completeAreaName(TsafeUserDetail pUserdetail) throws Exception { + TgeneAreaKey tgeneAreaKey = new TgeneAreaKey(pUserdetail.getCompanycode(), pUserdetail.getAreacode()); + TgeneArea tgeneArea = (TgeneArea) PersistenceHelper.getSession().get(TgeneArea.class, tgeneAreaKey); + pUserdetail.addAddtionalInfo("an", tgeneArea.getDescripction()); + } + + /** + * Metodo que agrega el nombre de la compania + * + * @param pUserdetail + * @throws Exception + */ + private void completeCompanyName(TsafeUserDetail pUserdetail) throws Exception { + TgeneCompany tgeneCompany = (TgeneCompany) PersistenceHelper.getSession().get(TgeneCompany.class, pUserdetail.getCompanycode()); + pUserdetail.addAddtionalInfo("cn", GeneralDescriptions.getPersonname(tgeneCompany.getPersoncode())); + } + + /** + * Metodo que agrega la descripcion del canal del usuario + * + * @param pUserdetail + * @throws Exception + */ + private void completeChannelName(TsafeUserDetail pUserdetail) throws Exception { + TgeneChannels tgeneChannels = (TgeneChannels) PersistenceHelper.getSession().get(TgeneChannels.class, pUserdetail.getChannelcode()); + pUserdetail.addAddtionalInfo("chn", tgeneChannels.getDescription()); + } + + /** + * Metodo que agrega la oficina en el detail + * + * @param pUserdetail + * @throws Exception + */ + private void completeOfficeName(TsafeUserDetail pUserdetail) throws Exception { + TgeneOfficeKey tgeneOfficeKey = new TgeneOfficeKey(pUserdetail.getOfficecode(), pUserdetail.getBranchcode(), pUserdetail.getCompanycode()); + TgeneOffice office = TgeneOffice.find(PersistenceHelper.getEntityManager(), tgeneOfficeKey); + pUserdetail.addAddtionalInfo("on", office.getDescription()); + } + + /** + * Metodo que completa la fecha contable y de trabajao + * + * @param pUserdetail + * @throws Exception + */ + private void completeDates(TsafeUserDetail pUserdetail) throws Exception { + TgeneAccountingDateBranch tgeneAccountingDateBranch = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pUserdetail.getCompanycode(), 0); + String hour = UserLogon.simpleDateFormatCreateTime.format(FormatDates.getInstance().getDataBaseTimestamp()); + pUserdetail.addAddtionalInfo("wt", hour); + if (tgeneAccountingDateBranch == null) { + pUserdetail.addAddtionalInfo("ad", null); + pUserdetail.addAddtionalInfo("wd", null); + } else { + pUserdetail.addAddtionalInfo("ad", tgeneAccountingDateBranch.getAccountingdate()); + pUserdetail.addAddtionalInfo("wd", tgeneAccountingDateBranch.getWorkingdate()); + } + } + + /** + * Metodo para completar datos de ubicacion del usuario + * + * @param pUserdetail + * @throws Exception + */ + private void completeLocation(TsafeUserDetail pUserdetail) throws Exception { + if ((pUserdetail.getBranchcode() != null) && (pUserdetail.getCompanycode() != null) && (pUserdetail.getOfficecode() != null)) { + TgeneOfficeKey tgeneOfficeKey = new TgeneOfficeKey(pUserdetail.getOfficecode(), pUserdetail.getBranchcode(), pUserdetail.getCompanycode()); + TgeneOffice tgeneOffice = TgeneOffice.find(PersistenceHelper.getEntityManager(), tgeneOfficeKey); + pUserdetail.addAddtionalInfo("address", tgeneOffice.getAddress()); + pUserdetail.addAddtionalInfo("citycode", tgeneOffice.getCitycode()); + if (tgeneOffice.getCountrycode() != null) { + + TgeneCountry tgeneCountry = TgeneCountry.find(PersistenceHelper.getEntityManager(), tgeneOffice.getCountrycode()); + pUserdetail.addAddtionalInfo("countrycode", tgeneCountry.getPk()); + pUserdetail.addAddtionalInfo("countryname", tgeneCountry.getDescription()); + } else { + pUserdetail.addAddtionalInfo("countrycode", null); + pUserdetail.addAddtionalInfo("countryname", null); + } + if ((tgeneOffice.getCountrycode() != null) && (tgeneOffice.getProvincecode() != null)) { + TgeneProvinceKey tgeneProvinceKey = new TgeneProvinceKey(tgeneOffice.getCountrycode(), tgeneOffice.getProvincecode()); + TgeneProvince tgeneProvince = TgeneProvince.find(PersistenceHelper.getEntityManager(), tgeneProvinceKey); + pUserdetail.addAddtionalInfo("provincecode", tgeneProvince.getPk().getProvincecode()); + pUserdetail.addAddtionalInfo("provincename", tgeneProvince.getDescription()); + } else { + pUserdetail.addAddtionalInfo("provincecode", null); + pUserdetail.addAddtionalInfo("provincename", null); + } + if ((tgeneOffice.getCountrycode() != null) && (tgeneOffice.getProvincecode() != null) && (tgeneOffice.getCantoncode() != null) + && (tgeneOffice.getCitycode() != null)) { + TgeneCityKey tgeneCityKey = new TgeneCityKey(tgeneOffice.getCountrycode(), tgeneOffice.getProvincecode(), + tgeneOffice.getCantoncode(), tgeneOffice.getCitycode()); + TgeneCity tgeneCity = TgeneCity.find(PersistenceHelper.getEntityManager(), tgeneCityKey); + pUserdetail.addAddtionalInfo("cityname", tgeneCity.getDescription()); + } else { + pUserdetail.addAddtionalInfo("cityname", null); + } + pUserdetail.addAddtionalInfo("username", GeneralDescriptions.getUsername(pUserdetail.getPk().getUsercode())); + } else { + pUserdetail.addAddtionalInfo("address", null); + pUserdetail.addAddtionalInfo("citycode", null); + pUserdetail.addAddtionalInfo("cityname", null); + pUserdetail.addAddtionalInfo("countrycode", null); + pUserdetail.addAddtionalInfo("countryname", null); + pUserdetail.addAddtionalInfo("provincecode", null); + pUserdetail.addAddtionalInfo("provincename", null); + pUserdetail.addAddtionalInfo("username", null); + } + } + + /** + * Metodo que completa el perfile del usuario + * + * @param pUserdetail + * @throws Exception + */ + private void completeProfile(TsafeUserDetail pUserdetail) throws Exception { + List profile = DataHelper.getInstance().getTsafeUserProfile(pUserdetail.getPk().getUsercode()); + if (this.isjsf) { + pUserdetail.addAddtionalInfo("lprofile", profile); + for (TsafeUserProfile tsafeUserProfile : profile) { + TsafeProfile tsafeProfile = TsafeProfile.find(PersistenceHelper.getEntityManager(), tsafeUserProfile.getPk().getProfilecode()); + tsafeUserProfile.addAddtionalInfo("nprofile", tsafeProfile.getDescription()); + } + return; + } + String profileData = ""; + String profileDataDesc = ""; + + for (int i = 0; i < profile.size(); i++) { + if (i > 0) { + profileData += "."; + profileDataDesc += "."; + } + profileData += profile.get(i).getPk().getProfilecode(); + TsafeProfile tsafeProfile = TsafeProfile.find(PersistenceHelper.getEntityManager(), profile.get(i).getPk().getProfilecode()); + profileDataDesc += tsafeProfile.getDescription(); + } + pUserdetail.addAddtionalInfo("profile", profileData); + pUserdetail.addAddtionalInfo("profiledesc", profileDataDesc); + } + + /** + * Metodo que verifica si el password ingresado es correcto + * + * @param pUserdetail + * @param pQueryRequest + * @throws Exception + */ + private boolean validatePassword(TsafeUserDetail pUserdetail, QueryRequest pQueryRequest, String terminal, String jsessionid, String host) + throws Exception { + String passwd = (String) pQueryRequest.get("itemValue"); + // Valida que el password no este expirado + this.validateExpiration(pUserdetail, pQueryRequest); + if (passwd.compareTo(pUserdetail.getPassword()) != 0) { + boolean maxintentos = this.increaseTryNumber(pUserdetail, pQueryRequest, terminal, jsessionid, host); + if (maxintentos) { + return false; + } + this.writeLog(pQueryRequest, pUserdetail, "GENE-0003", "USUARIO O PASSWORD INCORRECTO"); + pQueryRequest.getResponse().setResponseCode("GENE-0003"); + pQueryRequest.getResponse().setResponseUserMessage("USUARIO O PASSWORD INCORRECTO"); + return false; + } + return true; + } + + /** + * Metodo que verifica si el password ingresado es correcto + * + * @param pUserdetail + * @param pQueryRequest + * @throws Exception + */ + private void validateExpiration(TsafeUserDetail pUserdetail, QueryRequest pQueryRequest) throws Exception { + // Valida que el password no este expirado + if ((this.tsafePassword.getValiditydays() != null) && (this.tsafePassword.getValiditydays() > 0)) { + APPDates appd = new APPDates(pUserdetail.getDatefrom().toString().substring(0, 10), CalculationBase.B365365); + TgeneAccountingDateBranch db = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pQueryRequest.getCompany(), 0); + APPDates appd1 = new APPDates(db.getWorkingdate(), CalculationBase.B365365); + if (appd1.compareTo(appd) >= 0) { + Integer days = appd1.substract(appd); + if (days.compareTo(this.tsafePassword.getValiditydays()) > 0) { + throw new GeneralException("GENE-0023", "CONTRASEA EXPIRADA"); + } + days = days + this.tsafePassword.getMessagedays(); + if (days.compareTo(this.tsafePassword.getValiditydays()) >= 0) { + days = days - this.tsafePassword.getMessagedays(); + days = this.tsafePassword.getValiditydays() - days; + pUserdetail.addAddtionalInfo("dpwd", days); + } + } + } + } + + /** + * Metodo que completa la internacionalizacion dentro de la aplicacion + * + * @param pUserdetail + * @throws Exception + */ + private void completeInternazionalization(TsafeUserDetail pUserdetail) throws Exception { + List lTgeneLabel = TgeneLabel.getTgeneLabel(PersistenceHelper.getEntityManager(), pUserdetail.getLanguagecode(), + pUserdetail.getChannelcode()); + Map map = new HashMap(); + for (int i = 0; i < lTgeneLabel.size(); i++) { + TgeneLabel tgeneLabel = lTgeneLabel.get(i); + map.put(tgeneLabel.getPk().getLabel(), tgeneLabel.getDescription()); + } + pUserdetail.put("i18n", map); + } + + /** + * Metodo que completa los javascript + * + * @param pUserdetail + * @throws Exception + */ + private void completeJavaScript(TsafeUserDetail pUserdetail) throws Exception { + List tsafeJavaScript = TsafeJavaScript.find(PersistenceHelper.getEntityManager(), pUserdetail.getCompanycode(), + pUserdetail.getChannelcode()); + pUserdetail.put("js", tsafeJavaScript); + } + + /** + * Metodo que crea la sesion cuando no existe una + * + * @param pUserdetail + * @param pQueryRequest + * @param terminal + * @param jsessionid + * @param host + * @throws Exception + */ + private void createSession(TsafeUserDetail pUserdetail, QueryRequest pQueryRequest, String terminal, String jsessionid, String host) + throws Exception { + TsafeUserSessionKey tsafeUserSessionKey = new TsafeUserSessionKey(pUserdetail.getPk().getUsercode(), FormatDates.getInstance().getDataBaseTimestamp()); + TsafeUserSession tsafeUserSession = TsafeUserSession.find(PersistenceHelper.getEntityManager(), tsafeUserSessionKey); + PersistenceHelper.detatch(tsafeUserSession); + if (tsafeUserSession == null) { + tsafeUserSession = new TsafeUserSession(); + tsafeUserSession.setDatefrom(FormatDates.getInstance().getDataBaseTimestamp()); + tsafeUserSession.setPk(tsafeUserSessionKey); + tsafeUserSession.setTrynumber(1); + tsafeUserSession.setSessionid(jsessionid); + tsafeUserSession.setTerminalcode(terminal); + tsafeUserSession.setWebserverip(host); + this.saveObject(tsafeUserSession); + } else { + if (tsafeUserSession.getTerminalcode().compareTo(terminal) == 0) { + tsafeUserSession.setDatefrom(FormatDates.getInstance().getDataBaseTimestamp()); + this.saveObject(tsafeUserSession); + } else { + this.writeLog(pQueryRequest, pUserdetail, "GENE-0009", "EL USUARIO " + pUserdetail.getPk().getUsercode() + + " SE ENCUENTRA TRABAJANDO EN EL TERMINAL " + tsafeUserSession.getTerminalcode()); + throw new GeneralException("GENE-0009", "EL USUARIO {0} SE ENCUENTRA TRABAJANDO EN EL TERMINAL {1}", pUserdetail.getPk() + .getUsercode(), tsafeUserSession.getTerminalcode()); + } + } + } + + /** + * Metodo que incrementa el numero de intentos + * + * @param pUserdetail + * @param pQueryRequest + * @param terminal + * @param jsessionid + * @param host + * @return + * @throws Exception + */ + private boolean increaseTryNumber(TsafeUserDetail pUserdetail, QueryRequest pQueryRequest, String terminal, String jsessionid, String host) + throws Exception { + TsafeUserSessionKey tsafeUserSessionKey = new TsafeUserSessionKey(pUserdetail.getPk().getUsercode(), FormatDates.getDefaultExpiryTimestamp()); + TsafeUserSession tsafeUserSession = TsafeUserSession.find(PersistenceHelper.getEntityManager(), tsafeUserSessionKey); + if (tsafeUserSession != null) { + TsafeUserSession tsafeUserSessionAux = (TsafeUserSession) tsafeUserSession.cloneMe(); + tsafeUserSessionAux.getPk().setDateto(FormatDates.getInstance().getDataBaseTimestamp()); + this.saveObject(tsafeUserSessionAux); + tsafeUserSession.setTrynumber(tsafeUserSession.getTrynumber() + 1); + this.saveObject(tsafeUserSession); + + if ((this.tsafePassword.getIntentnumber() != null) && (tsafeUserSession.getTrynumber() >= this.tsafePassword.getIntentnumber())) { + pUserdetail.setUserstatuscatalog("BLQ"); + this.saveObject(pUserdetail); + pQueryRequest.getResponse().setResponseCode("GENE-0007"); + pQueryRequest.getResponse().setResponseUserMessage( + MessageFormat.format("EL USUARIO {0} HA SIDO BLOQUEADO POR INGRESO DE CLAVE ERRONEA", pUserdetail.getPk().getUsercode())); + return true; + } + } else { + this.createSession(pUserdetail, pQueryRequest, terminal, jsessionid, host); + } + return false; + } + + /** + * Mtodo que guarda los datos en la tabla + * + * @param object + * @throws Exception + */ + private void saveObject(Object object) throws Exception { + PersistenceHelper.getEntityManager().merge(object); + } + + /** + * + * @param pQueryRequest + * @param usercode + * @param terminal + * @param jsessionid + * @param host + * @param errorCode + * @param messageError + * @throws Exception + */ + private void writeLog(QueryRequest pQueryRequest, String usercode, String terminal, String jsessionid, String host, String errorCode, + String messageError) throws Exception { + TgeneAccountingDateBranch tgeneAccountingDateBranch = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pQueryRequest.getCompany(), 0); + TsafeUserSessionLogKey tsafeUserSessionLogKey = new TsafeUserSessionLogKey(tgeneAccountingDateBranch.getAccountingdate(), + getSequenceLoginLog(), pQueryRequest.getCompany()); + TsafeUserSessionLog tsafeUserSessionLog = new TsafeUserSessionLog(tsafeUserSessionLogKey, usercode, terminal, jsessionid, host, FormatDates + .getInstance().getDataBaseTimestamp(PersistenceHelper.getEntityManager()), errorCode, messageError); + NestedSave nestedSave = new NestedSave(pQueryRequest.getCompany(), tsafeUserSessionLog); + nestedSave.start(); + } + + /** + * + * @param pQueryRequest + * @param tsafeUserDetail + * @param errorCode + * @param messageError + * @throws Exception + */ + private void writeLog(QueryRequest pQueryRequest, TsafeUserDetail tsafeUserDetail, String errorCode, String messageError) throws Exception { + TgeneAccountingDateBranch tgeneAccountingDateBranch = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pQueryRequest.getCompany(), 0); + String terminal = (String) pQueryRequest.get("ip"); + String host = (String) pQueryRequest.get("host"); + String jsessionid = (String) pQueryRequest.get("jsessionid"); + TsafeUserSessionLogKey tsafeUserSessionLogKey = new TsafeUserSessionLogKey(tgeneAccountingDateBranch.getAccountingdate(), + getSequenceLoginLog(), pQueryRequest.getCompany()); + TsafeUserSessionLog tsafeUserSessionLog = new TsafeUserSessionLog(tsafeUserSessionLogKey, tsafeUserDetail.getPk().getUsercode(), terminal, + jsessionid, host, FormatDates.getInstance().getDataBaseTimestamp(PersistenceHelper.getEntityManager()), errorCode, messageError); + tsafeUserSessionLog.setBranchcode(tsafeUserDetail.getBranchcode()); + tsafeUserSessionLog.setOfficecode(tsafeUserDetail.getOfficecode()); + NestedSave nestedSave = new NestedSave(pQueryRequest.getCompany(), tsafeUserSessionLog); + nestedSave.start(); + } + + /** + * Metodo que entrega la secuencia para gurdar los logs + * + * @return + * @throws Exception + */ + private Integer getSequenceLoginLog() throws Exception { + Sequence sequence = new Sequence(); + Integer loginsequnce = Integer.valueOf(sequence.getNextValue("LOGINLOG").toString()); + SaveData.getMap().put("LOGINLOG", loginsequnce.toString()); + return loginsequnce; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/UserLogonCas.java.svn-base b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/UserLogonCas.java.svn-base new file mode 100644 index 0000000..5fee983 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/.svn/text-base/UserLogonCas.java.svn-base @@ -0,0 +1,569 @@ +package com.fp.general.security.rules; + +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpm.query.Query; +import com.fp.common.helper.CalculationBase; +import com.fp.dto.data.SaveData; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.general.db.DataHelper; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.NestedSave; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.APPDates; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.gene.TgeneArea; +import com.fp.persistence.pgeneral.gene.TgeneAreaKey; +import com.fp.persistence.pgeneral.gene.TgeneBranch; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; +import com.fp.persistence.pgeneral.gene.TgeneChannels; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCityKey; +import com.fp.persistence.pgeneral.gene.TgeneCompany; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneLabel; +import com.fp.persistence.pgeneral.gene.TgeneOffice; +import com.fp.persistence.pgeneral.gene.TgeneOfficeKey; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.gene.TgeneProvinceKey; +import com.fp.persistence.pgeneral.safe.TsafeJavaScript; +import com.fp.persistence.pgeneral.safe.TsafePassword; +import com.fp.persistence.pgeneral.safe.TsafePasswordKey; +import com.fp.persistence.pgeneral.safe.TsafeProfile; +import com.fp.persistence.pgeneral.safe.TsafeTerminal; +import com.fp.persistence.pgeneral.safe.TsafeTerminalKey; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserProfile; +import com.fp.persistence.pgeneral.safe.TsafeUserSession; +import com.fp.persistence.pgeneral.safe.TsafeUserSessionKey; +import com.fp.persistence.pgeneral.safe.TsafeUserSessionLog; +import com.fp.persistence.pgeneral.safe.TsafeUserSessionLogKey; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Clase que se encargara del ingreso a la aplicacion + * + * @author scastillo + * @version 2.1 + */ +public class UserLogonCas extends QueryRule { + + private static final long serialVersionUID = 1L; + + private static SimpleDateFormat simpleDateFormatCreateTime = new SimpleDateFormat("HH:mm:ss"); + + private TsafePassword tsafePassword; + + private boolean isjsf; + + /** + * Metodo que ejecuta el proceso + * + * @param pQueryRequest + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + this.isjsf = pQueryRequest.isJsf(); + TsafeUserDetail userdetail = this.getTsafeUserDetail(pQueryRequest); + + String terminal = (String) pQueryRequest.get("ip"); + String host = (String) pQueryRequest.get("host"); + String jsessionid = (String) pQueryRequest.get("jsessionid"); + String usercode = (String) pQueryRequest.get("login"); + if (userdetail == null) { + this.writeLog(pQueryRequest, usercode, terminal, jsessionid, host, "GENE-0011", "USUARIO NO EXISTE"); + throw new GeneralException("GENE-0011", "USUARIO NO EXISTE"); + } + if (userdetail.getUserstatuscatalog().compareTo("ACT") != 0) { + TgeneCatalogDetailKey tgeneCatalogDetailKey = new TgeneCatalogDetailKey(userdetail.getUserstatuscatalog(), + userdetail.getUserstatuscatalogcode()); + TgeneCatalogDetail tgeneCatalogDetail = TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), tgeneCatalogDetailKey); + this.writeLog(pQueryRequest, userdetail, "GENE-0010", "EL USUARIO " + userdetail.getPk().getUsercode() + " SE ENCUENTRA " + + tgeneCatalogDetail.getDescription()); + throw new GeneralException("GENE-0010", "EL USUARIO {0} SE ENCUENTRA {1}", userdetail.getPk().getUsercode(), + tgeneCatalogDetail.getDescription()); + } + TsafeTerminal tsafeTerminal = null; + // userdetail.getTerminalcode() + if ((userdetail.getBranchfromterminal() != null) && (userdetail.getBranchfromterminal().compareTo("Y") == 0) + && (userdetail.getTerminalcode() != null)) { + TsafeTerminalKey tsafeTerminalKey = new TsafeTerminalKey(userdetail.getTerminalcode(), userdetail.getCompanycode()); + TsafeTerminal tsafeTerminalAux = TsafeTerminal.find(PersistenceHelper.getEntityManager(), tsafeTerminalKey); + if (tsafeTerminalAux == null) { + this.writeLog(pQueryRequest, userdetail, "CORE-0002", "TERMINAL " + terminal + " NO DEFINIDO EN TSAFETERMINAL"); + throw new GeneralException("CORE-0002", "TERMINAL {0} NO DEFINIDO EN TSAFETERMINAL", terminal); + } else { + tsafeTerminal = tsafeTerminalAux; + terminal = tsafeTerminalAux.getIpaddress(); + } + } + if (tsafeTerminal == null) { + tsafeTerminal = TsafeTerminal.find(PersistenceHelper.getEntityManager(), userdetail.getCompanycode(), terminal); + } + if ((userdetail.getBranchfromterminal() != null) && (userdetail.getBranchfromterminal().compareTo("Y") == 0)) { + if (tsafeTerminal == null) { + this.writeLog(pQueryRequest, userdetail, "CORE-0002", "TERMINAL " + terminal + " NO DEFINIDO EN TSAFETERMINAL"); + throw new GeneralException("CORE-0002", "TERMINAL {0} NO DEFINIDO EN TSAFETERMINAL", terminal); + } else if ((tsafeTerminal != null) && (userdetail.getTerminalcode() != null)) { + TsafeTerminalKey tsafeTerminalKey = new TsafeTerminalKey(userdetail.getTerminalcode(), userdetail.getCompanycode()); + TsafeTerminal tsafeTerminalaux = TsafeTerminal.find(PersistenceHelper.getEntityManager(), tsafeTerminalKey); + if ((tsafeTerminalaux != null) && (tsafeTerminalaux.getIpaddress() != null) + && (tsafeTerminalaux.getIpaddress().compareTo(terminal) != 0)) { + this.writeLog(pQueryRequest, userdetail, "CORE-0056", "LA IP " + terminal + " NO SE ENCUENTRA AUTORIZADA PARA EL USUARIO " + + userdetail.getPk().getUsercode()); + throw new GeneralException("CORE-0056", "LA IP {0} NO SE ENCUENTRA AUTORIZADA PARA EL USUARIO {1}", terminal, userdetail.getPk() + .getUsercode()); + } + } + if (userdetail.getBranchcode().compareTo(tsafeTerminal.getBranchcode()) != 0) { + throw new GeneralException("CORE-0064", "EL TERMINAL {0} ASOCIADO AL USUARIO SE ENCUENTRA EN OTRA SUCURSAL {1}"); + } + if (userdetail.getOfficecode().compareTo(tsafeTerminal.getOfficecode()) != 0) { + throw new GeneralException("CORE-0065", "EL TERMINAL {0} ASOCIADO AL USUARIO SE ENCUENTRA EN OTRA OFICINA {1}"); + } + if (userdetail.getAreacode().compareTo(tsafeTerminal.getAreacode()) != 0) { + throw new GeneralException("CORE-0066", "EL TERMINAL {0} ASOCIADO AL USUARIO SE ENCUENTRA EN OTRA REA {1}"); + } + } + if ((tsafeTerminal != null) && (tsafeTerminal.getSliptprinter() != null)) { + userdetail.addAddtionalInfo("spn", tsafeTerminal.getSliptprinter()); + } else { + userdetail.addAddtionalInfo("spn", null); + } + TsafePasswordKey key = new TsafePasswordKey(pQueryRequest.getCompany(), userdetail.getChannelcode()); + this.tsafePassword = TsafePassword.find(PersistenceHelper.getEntityManager(), key); + + this.completeLocation(userdetail); + this.completeAreaName(userdetail); + this.completeCompanyName(userdetail); + this.completeChannelName(userdetail); + this.completeBranchName(userdetail, pQueryRequest, terminal); + this.completeOfficeName(userdetail); + this.completeProfile(userdetail); + this.completeDates(userdetail); + if (!pQueryRequest.isJsf()) { + this.completeJavaScript(userdetail); + this.completeInternazionalization(userdetail); + } + //datos de usuario de la sbs + TcustPersonDetail tcp = TcustPersonDetail.find(PersistenceHelper.getEntityManager(), userdetail.getPk().getPersoncode()); + userdetail.addAddtionalInfo("sbsemployee", tcp.getSbsemployee()); + userdetail.addAddtionalInfo("sbsusercode", tcp.getSbsusercode()); + // this.createSession(userdetail, pQueryRequest, terminal, jsessionid, host); + return pQueryRequest; + } + + private TsafeUserDetail getTsafeUserDetail(QueryRequest pQueryRequest) throws Exception { + TsafeUserDetail userdetail = null; + if (!pQueryRequest.isJsf()) { + Query qry = new Query(); + PersistenceHelper.getEntityManager().clear(); + qry.process(pQueryRequest); + userdetail = (TsafeUserDetail) pQueryRequest.getResponse().get("TSAFEUSERDETAIL"); + } else { + userdetail = TsafeUserDetail.find(PersistenceHelper.getEntityManager(), pQueryRequest.get("login").toString()); + pQueryRequest.getResponse().put("TSAFEUSERDETAIL", userdetail); + } + return userdetail; + } + + /** + * Metodo que agrega el nombre de la sucursal y la ip del cleinte en el detail + * + * @param pUserdetail + * @param pQueryRequest + * @param terminal + * @throws Exception + */ + private void completeBranchName(TsafeUserDetail pUserdetail, QueryRequest pQueryRequest, String terminal) throws Exception { + TgeneBranch branch = DataHelper.getInstance().getTgeneBranch(pUserdetail.getBranchcode(), pUserdetail.getCompanycode()); + pUserdetail.addAddtionalInfo("bn", branch.getDescription()); + pUserdetail.addAddtionalInfo("ip", terminal); + } + + /** + * Metodo que agrega la descripcin del area del usuario + * + * @param pUserdetail + * @throws Exception + */ + private void completeAreaName(TsafeUserDetail pUserdetail) throws Exception { + TgeneAreaKey tgeneAreaKey = new TgeneAreaKey(pUserdetail.getCompanycode(), pUserdetail.getAreacode()); + TgeneArea tgeneArea = (TgeneArea) PersistenceHelper.getSession().get(TgeneArea.class, tgeneAreaKey); + pUserdetail.addAddtionalInfo("an", tgeneArea.getDescripction()); + } + + /** + * Metodo que agrega el nombre de la compania + * + * @param pUserdetail + * @throws Exception + */ + private void completeCompanyName(TsafeUserDetail pUserdetail) throws Exception { + TgeneCompany tgeneCompany = (TgeneCompany) PersistenceHelper.getSession().get(TgeneCompany.class, pUserdetail.getCompanycode()); + pUserdetail.addAddtionalInfo("cn", GeneralDescriptions.getPersonname(tgeneCompany.getPersoncode())); + } + + /** + * Metodo que agrega la descripcion del canal del usuario + * + * @param pUserdetail + * @throws Exception + */ + private void completeChannelName(TsafeUserDetail pUserdetail) throws Exception { + TgeneChannels tgeneChannels = (TgeneChannels) PersistenceHelper.getSession().get(TgeneChannels.class, pUserdetail.getChannelcode()); + pUserdetail.addAddtionalInfo("chn", tgeneChannels.getDescription()); + } + + /** + * Metodo que agrega la oficina en el detail + * + * @param pUserdetail + * @throws Exception + */ + private void completeOfficeName(TsafeUserDetail pUserdetail) throws Exception { + TgeneOfficeKey tgeneOfficeKey = new TgeneOfficeKey(pUserdetail.getOfficecode(), pUserdetail.getBranchcode(), pUserdetail.getCompanycode()); + TgeneOffice office = TgeneOffice.find(PersistenceHelper.getEntityManager(), tgeneOfficeKey); + pUserdetail.addAddtionalInfo("on", office.getDescription()); + } + + /** + * Metodo que completa la fecha contable y de trabajao + * + * @param pUserdetail + * @throws Exception + */ + private void completeDates(TsafeUserDetail pUserdetail) throws Exception { + TgeneAccountingDateBranch tgeneAccountingDateBranch = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pUserdetail.getCompanycode(), 0); + String hour = UserLogonCas.simpleDateFormatCreateTime.format(FormatDates.getInstance().getDataBaseTimestamp()); + pUserdetail.addAddtionalInfo("wt", hour); + if (tgeneAccountingDateBranch == null) { + pUserdetail.addAddtionalInfo("ad", null); + pUserdetail.addAddtionalInfo("wd", null); + } else { + pUserdetail.addAddtionalInfo("ad", tgeneAccountingDateBranch.getAccountingdate()); + pUserdetail.addAddtionalInfo("wd", tgeneAccountingDateBranch.getWorkingdate()); + } + } + + /** + * Metodo para completar datos de ubicacion del usuario + * + * @param pUserdetail + * @throws Exception + */ + private void completeLocation(TsafeUserDetail pUserdetail) throws Exception { + if ((pUserdetail.getBranchcode() != null) && (pUserdetail.getCompanycode() != null) && (pUserdetail.getOfficecode() != null)) { + TgeneOfficeKey tgeneOfficeKey = new TgeneOfficeKey(pUserdetail.getOfficecode(), pUserdetail.getBranchcode(), pUserdetail.getCompanycode()); + TgeneOffice tgeneOffice = TgeneOffice.find(PersistenceHelper.getEntityManager(), tgeneOfficeKey); + pUserdetail.addAddtionalInfo("address", tgeneOffice.getAddress()); + pUserdetail.addAddtionalInfo("citycode", tgeneOffice.getCitycode()); + if (tgeneOffice.getCountrycode() != null) { + + TgeneCountry tgeneCountry = TgeneCountry.find(PersistenceHelper.getEntityManager(), tgeneOffice.getCountrycode()); + pUserdetail.addAddtionalInfo("countrycode", tgeneCountry.getPk()); + pUserdetail.addAddtionalInfo("countryname", tgeneCountry.getDescription()); + } else { + pUserdetail.addAddtionalInfo("countrycode", null); + pUserdetail.addAddtionalInfo("countryname", null); + } + if ((tgeneOffice.getCountrycode() != null) && (tgeneOffice.getProvincecode() != null)) { + TgeneProvinceKey tgeneProvinceKey = new TgeneProvinceKey(tgeneOffice.getCountrycode(), tgeneOffice.getProvincecode()); + TgeneProvince tgeneProvince = TgeneProvince.find(PersistenceHelper.getEntityManager(), tgeneProvinceKey); + pUserdetail.addAddtionalInfo("provincecode", tgeneProvince.getPk().getProvincecode()); + pUserdetail.addAddtionalInfo("provincename", tgeneProvince.getDescription()); + } else { + pUserdetail.addAddtionalInfo("provincecode", null); + pUserdetail.addAddtionalInfo("provincename", null); + } + if ((tgeneOffice.getCountrycode() != null) && (tgeneOffice.getProvincecode() != null) && (tgeneOffice.getCantoncode() != null) + && (tgeneOffice.getCitycode() != null)) { + TgeneCityKey tgeneCityKey = new TgeneCityKey(tgeneOffice.getCountrycode(), tgeneOffice.getProvincecode(), + tgeneOffice.getCantoncode(), tgeneOffice.getCitycode()); + TgeneCity tgeneCity = TgeneCity.find(PersistenceHelper.getEntityManager(), tgeneCityKey); + pUserdetail.addAddtionalInfo("cityname", tgeneCity.getDescription()); + } else { + pUserdetail.addAddtionalInfo("cityname", null); + } + pUserdetail.addAddtionalInfo("username", GeneralDescriptions.getUsername(pUserdetail.getPk().getUsercode())); + } else { + pUserdetail.addAddtionalInfo("address", null); + pUserdetail.addAddtionalInfo("citycode", null); + pUserdetail.addAddtionalInfo("cityname", null); + pUserdetail.addAddtionalInfo("countrycode", null); + pUserdetail.addAddtionalInfo("countryname", null); + pUserdetail.addAddtionalInfo("provincecode", null); + pUserdetail.addAddtionalInfo("provincename", null); + pUserdetail.addAddtionalInfo("username", null); + } + } + + /** + * Metodo que completa el perfile del usuario + * + * @param pUserdetail + * @throws Exception + */ + private void completeProfile(TsafeUserDetail pUserdetail) throws Exception { + List profile = DataHelper.getInstance().getTsafeUserProfile(pUserdetail.getPk().getUsercode()); + if (this.isjsf) { + pUserdetail.addAddtionalInfo("lprofile", profile); + for (TsafeUserProfile tsafeUserProfile : profile) { + TsafeProfile tsafeProfile = TsafeProfile.find(PersistenceHelper.getEntityManager(), tsafeUserProfile.getPk().getProfilecode()); + tsafeUserProfile.addAddtionalInfo("nprofile", tsafeProfile.getDescription()); + } + return; + } + String profileData = ""; + String profileDataDesc = ""; + + for (int i = 0; i < profile.size(); i++) { + if (i > 0) { + profileData += "."; + profileDataDesc += "."; + } + profileData += profile.get(i).getPk().getProfilecode(); + TsafeProfile tsafeProfile = TsafeProfile.find(PersistenceHelper.getEntityManager(), profile.get(i).getPk().getProfilecode()); + profileDataDesc += tsafeProfile.getDescription(); + } + pUserdetail.addAddtionalInfo("profile", profileData); + pUserdetail.addAddtionalInfo("profiledesc", profileDataDesc); + } + + /** + * Metodo que verifica si el password ingresado es correcto + * + * @param pUserdetail + * @param pQueryRequest + * @throws Exception + */ + private boolean validatePassword(TsafeUserDetail pUserdetail, QueryRequest pQueryRequest, String terminal, String jsessionid, String host) + throws Exception { + String passwd = (String) pQueryRequest.get("itemValue"); + // Valida que el password no este expirado + this.validateExpiration(pUserdetail, pQueryRequest); + if (passwd.compareTo(pUserdetail.getPassword()) != 0) { + boolean maxintentos = this.increaseTryNumber(pUserdetail, pQueryRequest, terminal, jsessionid, host); + if (maxintentos) { + return false; + } + this.writeLog(pQueryRequest, pUserdetail, "GENE-0003", "USUARIO O PASSWORD INCORRECTO"); + pQueryRequest.getResponse().setResponseCode("GENE-0003"); + pQueryRequest.getResponse().setResponseUserMessage("USUARIO O PASSWORD INCORRECTO"); + return false; + } + return true; + } + + /** + * Metodo que verifica si el password ingresado es correcto + * + * @param pUserdetail + * @param pQueryRequest + * @throws Exception + */ + private void validateExpiration(TsafeUserDetail pUserdetail, QueryRequest pQueryRequest) throws Exception { + // Valida que el password no este expirado + if ((this.tsafePassword.getValiditydays() != null) && (this.tsafePassword.getValiditydays() > 0)) { + APPDates appd = new APPDates(pUserdetail.getDatefrom().toString().substring(0, 10), CalculationBase.B365365); + TgeneAccountingDateBranch db = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pQueryRequest.getCompany(), 0); + APPDates appd1 = new APPDates(db.getWorkingdate(), CalculationBase.B365365); + if (appd1.compareTo(appd) >= 0) { + Integer days = appd1.substract(appd); + if (days.compareTo(this.tsafePassword.getValiditydays()) > 0) { + throw new GeneralException("GENE-0023", "CONTRASEA EXPIRADA"); + } + days = days + this.tsafePassword.getMessagedays(); + if (days.compareTo(this.tsafePassword.getValiditydays()) >= 0) { + days = days - this.tsafePassword.getMessagedays(); + days = this.tsafePassword.getValiditydays() - days; + pUserdetail.addAddtionalInfo("dpwd", days); + } + } + } + } + + /** + * Metodo que completa la internacionalizacion dentro de la aplicacion + * + * @param pUserdetail + * @throws Exception + */ + private void completeInternazionalization(TsafeUserDetail pUserdetail) throws Exception { + List lTgeneLabel = TgeneLabel.getTgeneLabel(PersistenceHelper.getEntityManager(), pUserdetail.getLanguagecode(), + pUserdetail.getChannelcode()); + Map map = new HashMap(); + for (int i = 0; i < lTgeneLabel.size(); i++) { + TgeneLabel tgeneLabel = lTgeneLabel.get(i); + map.put(tgeneLabel.getPk().getLabel(), tgeneLabel.getDescription()); + } + pUserdetail.put("i18n", map); + } + + /** + * Metodo que completa los javascript + * + * @param pUserdetail + * @throws Exception + */ + private void completeJavaScript(TsafeUserDetail pUserdetail) throws Exception { + List tsafeJavaScript = TsafeJavaScript.find(PersistenceHelper.getEntityManager(), pUserdetail.getCompanycode(), + pUserdetail.getChannelcode()); + pUserdetail.put("js", tsafeJavaScript); + } + + /** + * Metodo que crea la sesion cuando no existe una + * + * @param pUserdetail + * @param pQueryRequest + * @param terminal + * @param jsessionid + * @param host + * @throws Exception + */ + private void createSession(TsafeUserDetail pUserdetail, QueryRequest pQueryRequest, String terminal, String jsessionid, String host) + throws Exception { + TsafeUserSessionKey tsafeUserSessionKey = new TsafeUserSessionKey(pUserdetail.getPk().getUsercode(), FormatDates.getDefaultExpiryTimestamp()); + TsafeUserSession tsafeUserSession = TsafeUserSession.find(PersistenceHelper.getEntityManager(), tsafeUserSessionKey); + PersistenceHelper.detatch(tsafeUserSession); + if (tsafeUserSession == null) { + tsafeUserSession = new TsafeUserSession(); + tsafeUserSession.setDatefrom(FormatDates.getInstance().getDataBaseTimestamp()); + tsafeUserSession.setPk(tsafeUserSessionKey); + tsafeUserSession.setTrynumber(1); + tsafeUserSession.setSessionid(jsessionid); + tsafeUserSession.setTerminalcode(terminal); + tsafeUserSession.setWebserverip(host); + this.saveObject(tsafeUserSession); + } else { + if (tsafeUserSession.getTerminalcode().compareTo(terminal) == 0) { + tsafeUserSession.setDatefrom(FormatDates.getInstance().getDataBaseTimestamp()); + this.saveObject(tsafeUserSession); + } else { + this.writeLog(pQueryRequest, pUserdetail, "GENE-0009", "EL USUARIO " + pUserdetail.getPk().getUsercode() + + " SE ENCUENTRA TRABAJANDO EN EL TERMINAL " + tsafeUserSession.getTerminalcode()); + throw new GeneralException("GENE-0009", "EL USUARIO {0} SE ENCUENTRA TRABAJANDO EN EL TERMINAL {1}", pUserdetail.getPk() + .getUsercode(), tsafeUserSession.getTerminalcode()); + } + } + } + + /** + * Metodo que incrementa el numero de intentos + * + * @param pUserdetail + * @param pQueryRequest + * @param terminal + * @param jsessionid + * @param host + * @return + * @throws Exception + */ + private boolean increaseTryNumber(TsafeUserDetail pUserdetail, QueryRequest pQueryRequest, String terminal, String jsessionid, String host) + throws Exception { + TsafeUserSessionKey tsafeUserSessionKey = new TsafeUserSessionKey(pUserdetail.getPk().getUsercode(), FormatDates.getDefaultExpiryTimestamp()); + TsafeUserSession tsafeUserSession = TsafeUserSession.find(PersistenceHelper.getEntityManager(), tsafeUserSessionKey); + if (tsafeUserSession != null) { + TsafeUserSession tsafeUserSessionAux = (TsafeUserSession) tsafeUserSession.cloneMe(); + tsafeUserSessionAux.getPk().setDateto(FormatDates.getInstance().getDataBaseTimestamp()); + this.saveObject(tsafeUserSessionAux); + tsafeUserSession.setTrynumber(tsafeUserSession.getTrynumber() + 1); + this.saveObject(tsafeUserSession); + + if ((this.tsafePassword.getIntentnumber() != null) && (tsafeUserSession.getTrynumber() >= this.tsafePassword.getIntentnumber())) { + pUserdetail.setUserstatuscatalog("BLQ"); + this.saveObject(pUserdetail); + pQueryRequest.getResponse().setResponseCode("GENE-0007"); + pQueryRequest.getResponse().setResponseUserMessage( + MessageFormat.format("EL USUARIO {0} HA SIDO BLOQUEADO POR INGRESO DE CLAVE ERRONEA", pUserdetail.getPk().getUsercode())); + return true; + } + } else { + this.createSession(pUserdetail, pQueryRequest, terminal, jsessionid, host); + } + return false; + } + + /** + * Mtodo que guarda los datos en la tabla + * + * @param object + * @throws Exception + */ + private void saveObject(Object object) throws Exception { + PersistenceHelper.getEntityManager().merge(object); + } + + /** + * + * @param pQueryRequest + * @param usercode + * @param terminal + * @param jsessionid + * @param host + * @param errorCode + * @param messageError + * @throws Exception + */ + private void writeLog(QueryRequest pQueryRequest, String usercode, String terminal, String jsessionid, String host, String errorCode, + String messageError) throws Exception { + TgeneAccountingDateBranch tgeneAccountingDateBranch = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pQueryRequest.getCompany(), 0); + TsafeUserSessionLogKey tsafeUserSessionLogKey = new TsafeUserSessionLogKey(tgeneAccountingDateBranch.getAccountingdate(), + this.getSequenceLoginLog(), pQueryRequest.getCompany()); + TsafeUserSessionLog tsafeUserSessionLog = new TsafeUserSessionLog(tsafeUserSessionLogKey, usercode, terminal, jsessionid, host, FormatDates + .getInstance().getDataBaseTimestamp(PersistenceHelper.getEntityManager()), errorCode, messageError); + NestedSave nestedSave = new NestedSave(pQueryRequest.getCompany(), tsafeUserSessionLog); + nestedSave.start(); + } + + /** + * + * @param pQueryRequest + * @param tsafeUserDetail + * @param errorCode + * @param messageError + * @throws Exception + */ + private void writeLog(QueryRequest pQueryRequest, TsafeUserDetail tsafeUserDetail, String errorCode, String messageError) throws Exception { + TgeneAccountingDateBranch tgeneAccountingDateBranch = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pQueryRequest.getCompany(), 0); + String terminal = (String) pQueryRequest.get("ip"); + String host = (String) pQueryRequest.get("host"); + String jsessionid = (String) pQueryRequest.get("jsessionid"); + TsafeUserSessionLogKey tsafeUserSessionLogKey = new TsafeUserSessionLogKey(tgeneAccountingDateBranch.getAccountingdate(), + this.getSequenceLoginLog(), pQueryRequest.getCompany()); + TsafeUserSessionLog tsafeUserSessionLog = new TsafeUserSessionLog(tsafeUserSessionLogKey, tsafeUserDetail.getPk().getUsercode(), terminal, + jsessionid, host, FormatDates.getInstance().getDataBaseTimestamp(PersistenceHelper.getEntityManager()), errorCode, messageError); + tsafeUserSessionLog.setBranchcode(tsafeUserDetail.getBranchcode()); + tsafeUserSessionLog.setOfficecode(tsafeUserDetail.getOfficecode()); + NestedSave nestedSave = new NestedSave(pQueryRequest.getCompany(), tsafeUserSessionLog); + nestedSave.start(); + } + + /** + * Metodo que entrega la secuencia para gurdar los logs + * + * @return + * @throws Exception + */ + private Integer getSequenceLoginLog() throws Exception { + Sequence sequence = new Sequence(); + Integer loginsequnce = Integer.valueOf(sequence.getNextValue("LOGINLOG").toString()); + SaveData.getMap().put("LOGINLOG", loginsequnce.toString()); + return loginsequnce; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/CloseAllSessions.java b/base/business/general/src/main/java/com/fp/general/security/rules/CloseAllSessions.java new file mode 100644 index 0000000..f9013a9 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/CloseAllSessions.java @@ -0,0 +1,63 @@ +package com.fp.general.security.rules; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; + +/** + * Clase que cierra todas las conexiones abiertas en el servidor + * @author scastillo + */ +public class CloseAllSessions { + + /** + * Almacena una instancia de CloseAllSessions. + */ + private static CloseAllSessions cache; + + /** + * Entrega una instancia de CloseAllSessions. + * @return DataHelper + */ + public static CloseAllSessions getInstance() { + if (cache != null) { + return cache; + } + synchronized (CloseAllSessions.class) { + if (cache == null) { + cache = new CloseAllSessions(); + } + } + return cache; + } + /** + * Sentencia SQL que caduca las sesiones + */ + private static final String SQL = + "update TsafeUserSession set pk.dateto = :dateto where pk.dateto = :datetofilter and webserverip = :webserverip"; + + /** + * Metodo que cierra las sesiones abiertas en el servidor + * @param host + * @throws Exception + */ + public void expireSessions(String host) throws Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + try { + Query query = em.createQuery(SQL); + query.setParameter("dateto", FormatDates.getInstance().getDataBaseTimestamp(em)); + query.setParameter("datetofilter", FormatDates.getDefaultExpiryTimestamp()); + query.setParameter("webserverip", host); + query.executeUpdate(); + } catch (Exception e) { + ExceptionHandler eh = new ExceptionHandler(e, "es"); + APPLogger.getLogger().error("User Message:==>\n" + eh.getUserMessage()); + APPLogger.getLogger().error("Tech Message:==>\n" + eh.getTechnicalMessage()); + APPLogger.getLogger().error("Stack Message:==>\n" + eh.getStackTrace()); + } + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/CloseSession.java b/base/business/general/src/main/java/com/fp/general/security/rules/CloseSession.java new file mode 100644 index 0000000..f075bcd --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/CloseSession.java @@ -0,0 +1,41 @@ +package com.fp.general.security.rules; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.safe.TsafeUserSession; +import com.fp.persistence.pgeneral.safe.TsafeUserSessionKey; + +/** + * Clase que se encarga de caducar un registro + * @author scastillo + */ +public class CloseSession extends TransactionRule { + + /** + * Metodo que caduca el registro vigente del inicio de sesion + * @param pSaveRequest + * @return + * @throws Exception + */ + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + String usercode = pSaveRequest.getUser(); + TsafeUserSessionKey tsafeUserSessionKey = new TsafeUserSessionKey(usercode, FormatDates.getDefaultExpiryTimestamp()); + TsafeUserSession tsafeUserSession = TsafeUserSession.find(PersistenceHelper.getEntityManager(), tsafeUserSessionKey); + if (tsafeUserSession != null) { + PersistenceHelper.expire(tsafeUserSession); + } + return pSaveRequest; + } + + /** + * Metodo q ue se ejecuta en modo reverso + * @param pSaveRequest + * @return + * @throws Exception + */ + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/Company.java b/base/business/general/src/main/java/com/fp/general/security/rules/Company.java new file mode 100644 index 0000000..58f04e2 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/Company.java @@ -0,0 +1,193 @@ +package com.fp.general.security.rules; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.SQLQuery; +import org.hibernate.ScrollMode; +import org.hibernate.ScrollableResults; + +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; + +/** + * Clase que devuelve las companias + * + * @author scastillo + */ +public class Company extends QueryRule { + + private static final String SQL = + "select tgc.COMPANYCODE value," + + " (select tcp.NAME" + + " from TCUSTPERSONDETAIL tcp" + + " where tcp.PERSONCODE = tgc.PERSONCODE" + + " and tcp.DATETO = :dateto) label" + + " from TGENECOMPANY tgc" + + " where tgc.ACTIVE = :active"; + + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + try { + if(pQueryRequest.isJsf()){ + response.put("CIAS", this.getCompanyJsf()); + }else{ + response.put("T", this.getCompany()); + } + + + } catch (Exception e) { + ExceptionHandler eh = new ExceptionHandler(e, "es"); + APPLogger.getLogger().error("User Message:==>\n" + eh.getUserMessage()); + APPLogger.getLogger().error("Tech Message:==>\n" + eh.getTechnicalMessage()); + APPLogger.getLogger().error("Stack Message:==>\n" + eh.getStackTrace()); + } + + return pQueryRequest; + } + + /** + * Metodo que asigna la data de companias en un map + * @return + * @throws Exception + */ + private List> getCompany() throws Exception { + ScrollableResults rSet = null; + List> ldata = new ArrayList>(); + try { + rSet = this.executeQuery(); + while (rSet.next()) { + Object[] obj = rSet.get(); + Map mData = new HashMap(); + Integer company = (Integer) obj[0]; + String companyname = (String) obj[1]; + mData.put("value", company); + mData.put("label", companyname); + TgeneParametersKey tgeneParametersKey = new TgeneParametersKey("JSVERSION", company); + TgeneParameters tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), + tgeneParametersKey); + if (tgeneParameters != null && tgeneParameters.getNumbervalue() != null) { + mData.put("vd", tgeneParameters.getNumbervalue().intValue()); + } else { + mData.put("vd", 0); + } + tgeneParametersKey = new TgeneParametersKey("LOGO", company); + tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), + tgeneParametersKey); + if (tgeneParameters != null && tgeneParameters.getTextvalue() != null) { + mData.put("lo", tgeneParameters.getTextvalue()); + } else { + mData.put("lo", "images/company/default.gif"); + } + tgeneParametersKey = new TgeneParametersKey("FORMATDATE", company); + tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), + tgeneParametersKey); + if (tgeneParameters != null && tgeneParameters.getTextvalue() != null) { + mData.put("fd", tgeneParameters.getTextvalue()); + } else { + mData.put("fd", "yyyy-MM-dd"); + } + tgeneParametersKey = new TgeneParametersKey("IMGFONDO", company); + tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), + tgeneParametersKey); + if (tgeneParameters != null && tgeneParameters.getTextvalue() != null) { + mData.put("fi", tgeneParameters.getTextvalue()); + } else { + mData.put("fi", null); + } + tgeneParametersKey = new TgeneParametersKey("TOPMENU", company); + tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), + tgeneParametersKey); + if (tgeneParameters != null && tgeneParameters.getTextvalue() != null + && tgeneParameters.getTextvalue().compareTo("Y") == 0) { + mData.put("tm", "Y"); + } else { + mData.put("tm", "N"); + } + tgeneParametersKey = new TgeneParametersKey("TIMEOUT", (Integer) obj[0]); + tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), + tgeneParametersKey); + if (tgeneParameters != null && tgeneParameters.getNumbervalue() != null) { + mData.put("to", tgeneParameters.getNumbervalue().intValue()); + } else { + mData.put("to", 600); + } + //Se adiciona todos los parametros por compania + ldata.add(mData); + } + } finally { + if (rSet != null ) { + try { + rSet.close(); + } catch (Exception e) { + //Si el rset esta cerrado no hacer nada. + } + + } + } + return ldata; + } + + /** + * Metodo que asigna la data de companias en un map + * @return + * @throws Exception + */ + private List> getCompanyJsf() throws Exception { + ScrollableResults rSet = null; + List> ldata = new ArrayList>(); + try { + rSet = this.executeQuery(); + while (rSet.next()) { + Object[] obj = rSet.get(); + Map mData = new HashMap(); + Integer company = (Integer) obj[0]; + String companyname = (String) obj[1]; + mData.put("company", company); + mData.put("name", companyname); + //Se adiciona todos los parametros por compania + ldata.add(mData); + } + } finally { + if (rSet != null ) { + try { + rSet.close(); + } catch (Exception e) { + //Si el rset esta cerrado no hacer nada. + } + + } + } + return ldata; + } + + + + /** + * Metodo que ejecuta el query para obtener el codigo y nombre de las companias + * + * @param pQueryRequest + * @return + * @throws Exception + */ + private ScrollableResults executeQuery() throws Exception { + ScrollableResults rSet = null; + SQLQuery sql = PersistenceHelper.getSession().createSQLQuery(Company.SQL); + sql.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + sql.setParameter("active", "Y"); + sql.addScalar("value", new org.hibernate.type.IntegerType()); + sql.addScalar("label", new org.hibernate.type.StringType()); + + rSet = sql.scroll(ScrollMode.FORWARD_ONLY); + return rSet; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/CreateInternalCodeUser.java b/base/business/general/src/main/java/com/fp/general/security/rules/CreateInternalCodeUser.java new file mode 100644 index 0000000..1a4c100 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/CreateInternalCodeUser.java @@ -0,0 +1,99 @@ +package com.fp.general.security.rules; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.safe.TsafeUser; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Clase que se encuentra del manejo + * @author scastillo + */ +public class CreateInternalCodeUser extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /** + * Metodo que se encarga de completar el codigo interno eln la creacion de usuarios + * @param pSaveRequest + * @return + * @throws Exception + */ + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + // Si la pantalla es diferente de tx 1 120 , se procede a validar creacion de usuarios + if(!pSaveRequest.get("PANTALLA").toString().equalsIgnoreCase("USUARIOSPERFIL_MOD1_TX120")){ + if( !pSaveRequest.isJsf()){ + TsafeUser tsafeUser = (TsafeUser) pSaveRequest.getSaveBeanModifiedObject("TSAFEUSER"); + this.validateuser(tsafeUser.getPk().trim(), tsafeUser.getCompanycode()); + tsafeUser.setInternalcode(getInternalCode()); + }else{ + this.proessjsf(pSaveRequest); + } + } + return pSaveRequest; + } + + private void proessjsf(SaveRequest pSaveRequest) throws Exception { + TsafeUserDetail ud = (TsafeUserDetail) pSaveRequest.getSaveBeanModifiedObject("USERDETAIL"); + if(ud == null){ + return; + } + this.validateuser(ud.getPk().getUsercode(), ud.getCompanycode()); + TsafeUser tsu = new TsafeUser(ud.getPk().getUsercode()); + tsu.setPersoncode(ud.getPk().getPersoncode()); + tsu.setCompanycode(ud.getCompanycode()); + tsu.setInternalcode(getInternalCode()); + pSaveRequest.putSaveBean("TSAFEUSER", tsu, 1); + } + + private void validateuser(String usercode, Integer company) throws Exception { + String code = this.findUser(usercode, company); + if(code!=null){ + throw new GeneralException("GENE-0042", "CDIGO DE USUARIO YA EXISTE: {0}", code); + } + } + + /** + * Metodo que se ejecuta en modo reverso + * @param pSaveRequest + * @return + * @throws Exception + */ + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + /** + * Metodo que obtiene el numero correspondiente para el codigo interno del usuario + * @return + * @throws Exception + */ + private Integer getInternalCode() throws Exception { + Sequence sequence = new Sequence(); + return Integer.valueOf(sequence.getNextValue("INTERNALCODE").toString()); + } + private static String JPQL_USER ="select t.pk from TsafeUser t where t.pk = :usercode " + + " and t.companycode = :company"; + + private String findUser(String usercode,Integer company) throws Exception{ + String code; + Query qry = PersistenceHelper.getEntityManager().createQuery(JPQL_USER); + qry.setParameter("usercode", usercode); + qry.setParameter("company", company); + try { + code = (String)qry.getSingleResult(); + } catch (NoResultException e) { + return code =null; + } + return code; + } + + + +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/MaintenanceMenu.java b/base/business/general/src/main/java/com/fp/general/security/rules/MaintenanceMenu.java new file mode 100644 index 0000000..6cd31da --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/MaintenanceMenu.java @@ -0,0 +1,192 @@ +package com.fp.general.security.rules; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveBean; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevel; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelDesc; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelKey; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevel; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelDesc; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelKey; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Query; + +/** + * Clase que se encarga de del mantenimiento de menu para que se vuelva mas simple su manejo + * @author scastillo + */ +public class MaintenanceMenu extends TransactionRule { + + /** + * Metodo que se ejecuta en modo normal + * @param pSaveRequest + * @return + * @throws Exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + List lmodifyMenuLevel = pSaveRequest.getSaveBeanModifiedRecords("TGENEMENULEVELDESC"); + this.completeMenuLevel(pSaveRequest, lmodifyMenuLevel); + + List ldeleteMenuLevel = pSaveRequest.getSaveBeanDeletedRecords("TGENEMENULEVELDESC"); + this.deleteMenuLevel(pSaveRequest, ldeleteMenuLevel); + List lmodifyMenuSubLevel = pSaveRequest.getSaveBeanModifiedRecords("TGENEMENUSUBLEVELDESC"); + this.completeMenuSubLevel(pSaveRequest, lmodifyMenuSubLevel); + + List ldeleteMenuSubLevel = pSaveRequest.getSaveBeanDeletedRecords("TGENEMENUSUBLEVELDESC"); + this.deleteMenuSubLevel(pSaveRequest, ldeleteMenuSubLevel); + return pSaveRequest; + } + + /** + * Metodo que se encarga de verificar los datos cuando estos son eliminados + * @param pSaveRequest + * @param lmodifyMenuLevel + * @throws Exception + */ + private void completeMenuLevel(SaveRequest pSaveRequest, List lmodifyMenuLevel) throws Exception { + if (lmodifyMenuLevel != null) { + List lTgeneMenuLevel = new ArrayList(); + for (int i = 0; i < lmodifyMenuLevel.size(); i++) { + TgeneMenuLevelDesc tgeneMenuLevelDesc = (TgeneMenuLevelDesc) lmodifyMenuLevel.get(i); + Integer presentationorder = new Integer(tgeneMenuLevelDesc.get("presentationorder").toString()); + + TgeneMenuLevelKey TgeneMenuLevelKey = new TgeneMenuLevelKey(); + TgeneMenuLevelKey.setMenucode(tgeneMenuLevelDesc.getPk().getMenucode()); + TgeneMenuLevelKey.setLevelcode(tgeneMenuLevelDesc.getPk().getLevelcode()); + TgeneMenuLevel tgeneMenuLevel = TgeneMenuLevel.find(PersistenceHelper.getEntityManager(), TgeneMenuLevelKey); + if (tgeneMenuLevel == null) { + tgeneMenuLevel = new TgeneMenuLevel(); + tgeneMenuLevel.setPk(TgeneMenuLevelKey); + tgeneMenuLevel.setHavesublevel("Y"); + tgeneMenuLevel.setPresentationorder(presentationorder); + lTgeneMenuLevel.add(tgeneMenuLevel); + } else { + if (tgeneMenuLevel.getPresentationorder() != presentationorder) { + tgeneMenuLevel.setPresentationorder(presentationorder); + lTgeneMenuLevel.add(tgeneMenuLevel); + } + } + } + if (lTgeneMenuLevel.size() > 0) { + pSaveRequest.putSaveBean("TGENEMENULEVEL", lTgeneMenuLevel, 1); + } + } + } + + /** + * + * @param pSaveRequest + * @param ldeleteMenuLevel + * @throws Exception + */ + private void deleteMenuLevel(SaveRequest pSaveRequest, List ldeleteMenuLevel) throws Exception { + if(ldeleteMenuLevel == null){ + return; + } + List ldeleterecors = new ArrayList(); + for (int i = 0; i < ldeleteMenuLevel.size(); i++) { + TgeneMenuLevelDesc tgeneMenuLevelDesc = (TgeneMenuLevelDesc) ldeleteMenuLevel.get(i); + TgeneMenuLevelKey TgeneMenuLevelKey = new TgeneMenuLevelKey(); + TgeneMenuLevelKey.setMenucode(tgeneMenuLevelDesc.getPk().getMenucode()); + TgeneMenuLevelKey.setLevelcode(tgeneMenuLevelDesc.getPk().getLevelcode()); + TgeneMenuLevel tgeneMenuLevel = TgeneMenuLevel.find(PersistenceHelper.getEntityManager(), TgeneMenuLevelKey); + if (tgeneMenuLevel != null) { + ldeleterecors.add(tgeneMenuLevel); + } + } + if(!ldeleterecors.isEmpty()){ + SaveBean sb = (SaveBean)pSaveRequest.get("TGENEMENULEVEL"); + if(sb!=null){ + sb.setDeletedRecords(ldeleterecors); + } + } + } + + /** + * Metodo que completa y modificalos datos para subniveles + * @param pSaveRequest + * @param lmodifyMenuSubLevel + * @throws Exception + */ + private void completeMenuSubLevel(SaveRequest pSaveRequest, List lmodifyMenuSubLevel) throws Exception { + if (lmodifyMenuSubLevel != null) { + List lTgeneMenuSubLevel = new ArrayList(); + for (int i = 0; i < lmodifyMenuSubLevel.size(); i++) { + TgeneMenuSubLevelDesc tgeneMenuSubLevelDesc = (TgeneMenuSubLevelDesc) lmodifyMenuSubLevel.get(i); + Integer presentationorder = new Integer(tgeneMenuSubLevelDesc.get("presentationorder").toString()); + TgeneMenuSubLevelKey tgeneMenuSubLevelKey = new TgeneMenuSubLevelKey(); + tgeneMenuSubLevelKey.setMenucode(tgeneMenuSubLevelDesc.getPk().getMenucode()); + tgeneMenuSubLevelKey.setLevelcode(tgeneMenuSubLevelDesc.getPk().getLevelcode()); + tgeneMenuSubLevelKey.setSublevel(tgeneMenuSubLevelDesc.getPk().getSublevel()); + TgeneMenuSubLevel tgeneMenuSubLevel = TgeneMenuSubLevel.find(PersistenceHelper.getEntityManager(), tgeneMenuSubLevelKey); + if (tgeneMenuSubLevel == null) { + tgeneMenuSubLevel = new TgeneMenuSubLevel(); + tgeneMenuSubLevel.setPk(tgeneMenuSubLevelKey); + tgeneMenuSubLevel.setPresentationorder(presentationorder); + lTgeneMenuSubLevel.add(tgeneMenuSubLevel); + } else { + if (tgeneMenuSubLevel.getPresentationorder() != presentationorder) { + tgeneMenuSubLevel.setPresentationorder(presentationorder); + lTgeneMenuSubLevel.add(tgeneMenuSubLevel); + } + } + } + if (lTgeneMenuSubLevel.size() > 0) { + pSaveRequest.putSaveBean("TGENEMENUSUBLEVEL", lTgeneMenuSubLevel, 1); + } + } + } + + /** + * + * @param pSaveRequest + * @param ldeleteMenuLevel + * @throws Exception + */ + private void deleteMenuSubLevel(SaveRequest pSaveRequest, List ldeleteMenuSubLevel) throws Exception { + if(ldeleteMenuSubLevel == null){ + return; + } + List ldeleterecors = new ArrayList(); + for (int i = 0; i < ldeleteMenuSubLevel.size(); i++) { + TgeneMenuSubLevelDesc tgeneMenuSubLevelDesc = (TgeneMenuSubLevelDesc) ldeleteMenuSubLevel.get(i); + TgeneMenuSubLevelKey TgeneMenuSubLevelKey = new TgeneMenuSubLevelKey(); + TgeneMenuSubLevelKey.setMenucode(tgeneMenuSubLevelDesc.getPk().getMenucode()); + TgeneMenuSubLevelKey.setLevelcode(tgeneMenuSubLevelDesc.getPk().getLevelcode()); + TgeneMenuSubLevelKey.setSublevel(tgeneMenuSubLevelDesc.getPk().getSublevel()); + TgeneMenuSubLevel tgeneMenuSubLevel = TgeneMenuSubLevel.find(PersistenceHelper.getEntityManager(), TgeneMenuSubLevelKey); + PersistenceHelper.delete(tgeneMenuSubLevelDesc); + if (tgeneMenuSubLevel != null) { + PersistenceHelper.delete(tgeneMenuSubLevel); + //ldeleterecors.add(tgeneMenuSubLevel); + } + } + SaveBean sb = (SaveBean)pSaveRequest.get("TGENEMENUSUBLEVELDESC"); + if(sb!=null){ + sb.setDeletedRecords(new ArrayList<>()); + } + //if(!ldeleterecors.isEmpty()){ + // SaveBean sb = (SaveBean)pSaveRequest.get("TGENEMENUSUBLEVEL"); + // if(sb!=null){ + // sb.setDeletedRecords(ldeleterecors); + // } + //} + } + + /** + * Metodo que se ejecuta en modo reverso + * @param pSaveRequest + * @return + * @throws Exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/MaintenanceUser.java b/base/business/general/src/main/java/com/fp/general/security/rules/MaintenanceUser.java new file mode 100644 index 0000000..e6658ea --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/MaintenanceUser.java @@ -0,0 +1,96 @@ +package com.fp.general.security.rules; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pbpm.gene.TbpmGroupsUsers; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetailKey; +import com.fp.persistence.pgeneral.safe.TsafeUserSession; +import com.fp.persistence.pgeneral.safe.TsafeUserSessionKey; +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +/** + * Clase que se va de encargar cuando se activa un usuario de eliminarlo de la tabla tsafeusersession para que se pueda loguear + * @author scastillo + */ +public class MaintenanceUser extends TransactionRule { + + /** + * Metodo que busca si estael usuario logueado lo eliminar de la sesion + * @param sr + * @return + * @throws Exception + */ + @Override + public SaveRequest normalProcess(SaveRequest sr) throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) sr.getSaveBeanModifiedObject("TSAFEUSERDETAIL"); + if (tsafeUserDetail == null) { + tsafeUserDetail = (TsafeUserDetail) sr.getSaveBeanModifiedObject("USERDETAIL"); + } + if (tsafeUserDetail == null) { + return sr; + } + String task = (String) tsafeUserDetail.get("task"); + String isuserbpm = tsafeUserDetail.getIsuserbpm(); + String usercode = tsafeUserDetail.getPk().getUsercode(); + TsafeUserDetailKey tsafeUserDetailKey = new TsafeUserDetailKey(); + tsafeUserDetailKey.setDateto(FormatDates.getDefaultExpiryTimestamp()); + tsafeUserDetailKey.setPersoncode(tsafeUserDetail.getPk().getPersoncode()); + tsafeUserDetailKey.setUsercode(tsafeUserDetail.getPk().getUsercode()); + TsafeUserDetail tsafeUserDetailPreview = TsafeUserDetail.find(PersistenceHelper.getEntityManager(), tsafeUserDetailKey); + if (tsafeUserDetailPreview != null && tsafeUserDetailPreview.getUserstatuscatalog().compareTo("BLQ") == 0 + && tsafeUserDetail.getUserstatuscatalog().compareTo("ACT") == 0) { +// TsafeUserSessionKey tsafeUserSessionKey = new TsafeUserSessionKey(); +// tsafeUserSessionKey.setDateto(FormatDates.getDefaultExpiryTimestamp()); +// tsafeUserSessionKey.setUsercode(tsafeUserDetail.getPk().getUsercode()); +// TsafeUserSession tsafeUserSession = TsafeUserSession.find(PersistenceHelper.getEntityManager(), tsafeUserSessionKey); +// if (tsafeUserSession != null) { +// Query qry = PersistenceHelper.getEntityManager().createQuery("update TsafeUserSession set pk.dateto=:expiration where pk.dateto = :dateto and pk.usercode = :usercode"); +// qry.setParameter("expiration", FormatDates.getInstance().getDataBaseTimestamp()); +// qry.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); +// qry.setParameter("usercode", tsafeUserSession.getPk().getUsercode()); +// qry.executeUpdate(); +// } + } + this.verifyUserGroup(task, isuserbpm, usercode); + return sr; + } + + /** + * Modo que se ejecuta en modo reverso + * @param sr + * @return + * @throws Exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest sr) throws Exception { + return sr; + } + + /** + * Verifica si el usuario del bpm a sido eliminado, lo elimina del grupo. + * @param task + * @param isuserbpm + * @param usercode + * @throws Exception + */ + private void verifyUserGroup(String task, String isuserbpm, String usercode) throws Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + + if (task!=null && task.compareTo("NOTASK") == 0 && isuserbpm.compareTo("N") == 0) { + Query qry = em.createQuery("from TbpmGroupsUsers g where g.pk.usercode = :code"); + qry.setParameter("code", usercode); + @SuppressWarnings("unchecked") + List objs = (List)qry.getResultList(); + if(!objs.isEmpty()){ + for(TbpmGroupsUsers tbpmGroupsUsers: objs){ + PersistenceHelper.delete(tbpmGroupsUsers); + } + } + } + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/Menu.java b/base/business/general/src/main/java/com/fp/general/security/rules/Menu.java new file mode 100644 index 0000000..d92fa8f --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/Menu.java @@ -0,0 +1,136 @@ +package com.fp.general.security.rules; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.common.helper.Constant; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.general.db.DataHelper; +import com.fp.general.exception.GeneralException; +import com.fp.general.helper.MenuHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevel; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelDesc; +import com.fp.persistence.pgeneral.menu.TgeneMenuProfile; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevel; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelDesc; + +/** + * Clase que se encarga de armar y entregar el menu, asociado a un perfil. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class Menu extends MenuHelper { + + /** Map que contiene los datos del menu. */ + private final Map rootmenu = new HashMap(); + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.QueryRule#process(com.fp.dto.query.QueryRequest) + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + String profile = pQueryRequest.getProfile(); + String language = pQueryRequest.getLanguage(); + TgeneMenuProfile menuprofile = DataHelper.getInstance().getTgeneMenuProfile(profile); + if (menuprofile != null) { + List lMenuLevel = DataHelper.getInstance().getTgeneMenuLevel(menuprofile.getMenucode()); + List> lLevels = new ArrayList>(); + for (TgeneMenuLevel obj : lMenuLevel) { + this.completeLevel(obj, lLevels, language); + } + rootmenu.put("items", lLevels); + rootmenu.put("label", "t"); + response.put("rootmenu", rootmenu); + } else { + throw new GeneralException("GENE-0017", "EL PERFIL {0} NO TIENE ASOCIADO UN MENU", profile); + } + return pQueryRequest; + } + + /** + * Metodo que completa datos del grupo de menu. + * + * @param pTgeneMenuGroup Definicion de grupo de menu. + * @param pGroup Grupo de menu a completar datos. + * @param languagecode Codigo de lenguage. + * @return boolean + * @throws Exception + */ + private boolean completeLevel(TgeneMenuLevel pTgeneMenuLevel, List> lLevels, String languagecode) throws Exception { + TgeneMenuLevelDesc tgeneMenuLevelDesc = DataHelper.getInstance().getTgeneMenuLevelDesc(pTgeneMenuLevel.getPk().getMenucode(), + pTgeneMenuLevel.getPk().getLevelcode(), languagecode); + if (tgeneMenuLevelDesc != null) { + String labelMenu = tgeneMenuLevelDesc.getDescription(); + if (labelMenu == null) { + labelMenu = "ETIQUETA DE MENU NO DEFINIDA"; + } + Map mlevel = new HashMap(); + mlevel.put("t", Constant.capitalize(labelMenu)); + mlevel.put("sl", Constant.ifYes(pTgeneMenuLevel.getHavesublevel()) == true ? "Y" : "N"); + List lData = super.completTransactionByLevel(tgeneMenuLevelDesc, languagecode); + if (Constant.ifYes(pTgeneMenuLevel.getHavesublevel())) { + this.fillSubLevel(pTgeneMenuLevel, lData, languagecode); + } + mlevel.put("items", lData); + lLevels.add(mlevel); + } + return true; + } + + /** + * Metodo que se encarga de construir ya dicionar el segundo nivel del menu. + * + * @param pTgeneMenuLevel Datos del segundo nivel del menu. + * @param lData Lista que contiene los datos del primer nivel del menu, al cual se adiciona los datos del segundo + * nivel del menu. + * @param languagecode Codigo de lenguaje del usuario. + * @throws Exception + */ + private void fillSubLevel(TgeneMenuLevel pTgeneMenuLevel, List lData, String languagecode) throws Exception { + List lSubLevel = DataHelper.getInstance().getTgeneMenuSuLevels(pTgeneMenuLevel.getPk().getMenucode(), + pTgeneMenuLevel.getPk().getLevelcode()); + if (lSubLevel == null) { + return; + } + for (TgeneMenuSubLevel obj : lSubLevel) { + Map mLevel = new HashMap(); + this.completeSubLevel(obj, mLevel, languagecode); + if (!mLevel.isEmpty()) { + lData.add(mLevel); + } else { + APPLogger.getLogger().debug( + "\nETIQUETA DE SUBNIVEL NO DEFINIDA\n\tmenucode=" + obj.getPk().getMenucode() + ";\n\tlevelcode=" + + obj.getPk().getLevelcode() + ";\n\tsublevelcode=" + obj.getPk().getSublevel() + ";\n\tlanguage=" + languagecode); + } + } + } + + /** + * Metodo que completa datos del segundo nivel del menu. + * + * @param pMenuSubLevel Datos del segundo nivel del menu. + * @param mLevel Map que contiene informacion de todas las opciones del segundo nivel del menu. + * @param languagecode Codigo de lenguaje del usuario. + * @throws Exception + */ + private void completeSubLevel(TgeneMenuSubLevel pMenuSubLevel, Map mLevel, String languagecode) throws Exception { + TgeneMenuSubLevelDesc subleveldesc = DataHelper.getInstance().getTgeneMenuSubLevelDesc(pMenuSubLevel.getPk().getMenucode(), + pMenuSubLevel.getPk().getLevelcode(), pMenuSubLevel.getPk().getSublevel(), languagecode); + if (subleveldesc != null) { + String labelMenu = subleveldesc.getDescription(); + if (labelMenu == null) { + labelMenu = "ETIQUETA DE MENU NO DEFINIDA"; + } + mLevel.put("t", Constant.capitalize(labelMenu)); + super.completTransactionBySubLevel(subleveldesc, mLevel, languagecode); + } + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/Politics.java b/base/business/general/src/main/java/com/fp/general/security/rules/Politics.java new file mode 100644 index 0000000..50fbe2b --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/Politics.java @@ -0,0 +1,264 @@ +package com.fp.general.security.rules; + +import java.util.List; + +import com.fp.common.base64.Base64Input; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.safe.TsafePassword; +import com.fp.persistence.pgeneral.safe.TsafePasswordKey; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetailKey; + +/** + * Clase que se encarga de validar la politica de seguridad definida en TsafePassword. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class Politics extends TransactionRule { + + /***/ + private static final String UPPER = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + + private static final String LOWER = "abcdefghijklmnopqrstuvwxyz"; + + private static final String NUMBERS = "0123456789"; + + /** Tabla que almnacena politica de seguridad del password. */ + private TsafePassword tsafePassword = null; + + private Integer numeric = 0; + + private Integer upper = 0; + + private Integer lower = 0; + + private Integer special = 0; + + /** + * Metodo que caduca el registro vigente del inicio de sesion + * + * @param pSaveRequest Datos del request original. + * @return SaveRequest + * @throws Exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + TsafeUserDetail tsafeUserDetailForm = (TsafeUserDetail) pSaveRequest.getSaveBeanModifiedObject("TSAFEUSERDETAIL"); + TsafeUserDetailKey tsafeUserDetailKey = new TsafeUserDetailKey(tsafeUserDetailForm.getPk().getUsercode(), tsafeUserDetailForm.getPk() + .getPersoncode(), FormatDates.getDefaultExpiryTimestamp()); + TsafeUserDetail tsafeUserDetail = TsafeUserDetail.find(PersistenceHelper.getEntityManager(), tsafeUserDetailKey); + TsafePasswordKey key = new TsafePasswordKey(pSaveRequest.getCompany(), pSaveRequest.getChannelCode()); + this.tsafePassword = TsafePassword.find(PersistenceHelper.getEntityManager(), key); + String value = tsafeUserDetailForm.get("origination").toString(); + String oldpassword = tsafeUserDetailForm.get("oldpassword").toString(); + String passindatabase = tsafeUserDetail.getPassword(); + if(pSaveRequest.isJsf()){ + passindatabase = ((TsafeUserDetail)tsafeUserDetailForm.get("ORIGINALBEAN")).getPassword(); + value = tsafeUserDetailForm.get("newpassword").toString(); + } + + if ((oldpassword != null) && (oldpassword.compareTo("") != 0) && (passindatabase.compareTo(oldpassword) != 0)) { + throw new GeneralException("GENE-0025", "CONTRASEA ANTERIOR INCORRECTA"); + } + // Valida politica de seguridad + this.validate(value, pSaveRequest.isJsf()); + // Valida que no se repitan los ultimos n passwords + this.validateNotrepeated(tsafeUserDetailForm, tsafeUserDetailForm.get("origination").toString() ); + return pSaveRequest; + } + + /** + * Metodo que valida la politica de seguridad del password. + * + * @param value Password en base 64. + * @throws Exception + */ + private void validate(String value, boolean isjsf) throws Exception { + // OBTIENE EL PASSWORD EN CARACTER + if(!isjsf){ + value = Base64Input.decodificar(value); + } + this.validateLength(value); + for (int i = 0; i < value.length(); i++) { + String c = value.substring(i, i + 1); + this.compute(c); + } + this.validateNumbers(); + this.validateUppercase(); + this.validateLowercase(); + this.validateSpecial(); + + } + + /** + * Metodo que valida la longitud del password. + * + * @param value Datos de la clave a validar. + * @return boolean + * @throws Exception + */ + private void validateLength(String value) throws Exception { + if ((this.tsafePassword.getMinlength() != null) && (value.length() < this.tsafePassword.getMinlength())) { + throw new GeneralException("GENE-0030", "LA LONGITUD MNIMA DE LA CONTRASEA DEBE SER DE {0} CARACTERES", this.tsafePassword.getMinlength()); + } + } + + /** + * Metodo que valida numeros minimos en el password. + * + * @throws Exception + */ + private void validateNumbers() throws Exception { + if ((this.tsafePassword.getMinnumber() != null) && (this.tsafePassword.getMinnumber() > 0) + && (this.tsafePassword.getMinnumber() > this.numeric)) { + throw new GeneralException("GENE-0029", "LA CONTRASEA DEBE TENER POR LO MENOS {0} NMEROS", this.tsafePassword.getMinnumber()); + } + } + + /** + * Metodo que valida letras mayusculas minimas en el password. + * + * @throws Exception + */ + private void validateUppercase() throws Exception { + if ((this.tsafePassword.getMinuppercase() != null) && (this.tsafePassword.getMinuppercase() > 0) + && (this.tsafePassword.getMinuppercase() > this.upper)) { + throw new GeneralException("GENE-0028", "LA CONTRASEA DEBE TENER POR LO MENOS {0} LETRAS MAYSCULAS", this.tsafePassword.getMinuppercase()); + } + } + + /** + * Metodo que valida letras minusculas minimas en el password. + * + * @throws Exception + */ + private void validateLowercase() throws Exception { + if ((this.tsafePassword.getMinlowercase() != null) && (this.tsafePassword.getMinlowercase() > 0) + && (this.tsafePassword.getMinlowercase() > this.lower)) { + throw new GeneralException("GENE-0026", "LA CONTRASEA DEBE TENER POR LO MENOS {0} LETRAS MINSCULAS", this.tsafePassword.getMinlowercase()); + } + } + + /** + * Metodo que valida los caracteres especiales. + * + * @throws Exception + */ + private void validateSpecial() throws Exception { + if ((this.tsafePassword.getMinspecialcharacters() != null) && (this.tsafePassword.getMinspecialcharacters() > 0) + && (this.tsafePassword.getMinspecialcharacters() > this.special)) { + throw new GeneralException("GENE-0027", "LA CONTRASEA DEBE TENER POR LO MENOS {0} CARACTERES ESPECIALES", + this.tsafePassword.getMinspecialcharacters()); + } + } + + /** + * Valida que el password no se repita en las ultimas n veces. + * + * @param obj Datos del nuevo password. + * @throws Exception + */ + private void validateNotrepeated(TsafeUserDetail useerdetail, String passindatabase) throws Exception { + if ((this.tsafePassword.getMinnotrepeated() == null) || (this.tsafePassword.getMinnotrepeated().compareTo(0) == 0)) { + return; + } + List ldata = TsafeUserDetail.find(PersistenceHelper.getEntityManager(), useerdetail.getPk().getUsercode(), + this.tsafePassword.getMinnotrepeated()); + if ((ldata == null) || ldata.isEmpty()) { + return; + } + + for (TsafeUserDetail obj : ldata) { + if(obj.get("ORIGINALBEAN") != null){ + continue; + } + PersistenceHelper.detatch(obj); + if (obj.getPassword().compareTo(passindatabase) == 0) { + throw new GeneralException("GENE-0022", "NO PUEDE REPETIR LAS LTIMAS: {0} CONTRASEAS", this.tsafePassword.getMinnotrepeated()); + } + } + } + + /** + * Metodo que se encarga de acumular, numeros, mayusculas y/o minusculas. + * + * @param c Datoa a verificar. + * @throws Exception + */ + private void compute(String c) throws Exception { + if (this.isNumber(c)) { + this.numeric++; + return; + } + if (this.isUppercase(c)) { + this.upper++; + return; + } + if (this.isLowercase(c)) { + this.lower++; + return; + } + // Si no es numero, mayuscula o minuscula es un caractwer especial + this.special++; + } + + /** + * Metdo que verifica si el caracter es un numero. + * + * @param value Dato a verificar si es un numero + * @return boolean + * @throws Exception + */ + private boolean isNumber(String value) throws Exception { + if (Politics.NUMBERS.indexOf(value) >= 0) { + return true; + } + return false; + } + + /** + * Metdo que verifica si el caracter es una mayuscula, incluye tildes. + * + * @param value Dato a verificar si es una mayuscula + * @return boolean + * @throws Exception + */ + private boolean isUppercase(String value) throws Exception { + if (Politics.UPPER.indexOf(value) >= 0) { + return true; + } + return false; + } + + /** + * Metdo que verifica si el caracter es una minuscula incluye tildes. + * + * @param value Dato a verificar si es una minuscula + * @return boolean + * @throws Exception + */ + private boolean isLowercase(String value) throws Exception { + if (Politics.LOWER.indexOf(value) >= 0) { + return true; + } + return false; + } + + /** + * Metodo que se ejecuta en modo reverso + * + * @param pSaveRequest + * @return SaveRequest + * @throws Exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/UserLogon.java b/base/business/general/src/main/java/com/fp/general/security/rules/UserLogon.java new file mode 100644 index 0000000..4fee0a9 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/UserLogon.java @@ -0,0 +1,601 @@ +package com.fp.general.security.rules; + +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpm.query.Query; +import com.fp.common.helper.CalculationBase; +import com.fp.dto.data.SaveData; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.general.db.DataHelper; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.NestedSave; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.APPDates; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.gene.TgeneArea; +import com.fp.persistence.pgeneral.gene.TgeneAreaKey; +import com.fp.persistence.pgeneral.gene.TgeneBranch; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; +import com.fp.persistence.pgeneral.gene.TgeneChannels; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCityKey; +import com.fp.persistence.pgeneral.gene.TgeneCompany; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneLabel; +import com.fp.persistence.pgeneral.gene.TgeneOffice; +import com.fp.persistence.pgeneral.gene.TgeneOfficeKey; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.gene.TgeneProvinceKey; +import com.fp.persistence.pgeneral.safe.TsafeJavaScript; +import com.fp.persistence.pgeneral.safe.TsafePassword; +import com.fp.persistence.pgeneral.safe.TsafePasswordKey; +import com.fp.persistence.pgeneral.safe.TsafeProfile; +import com.fp.persistence.pgeneral.safe.TsafeTerminal; +import com.fp.persistence.pgeneral.safe.TsafeTerminalKey; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserProfile; +import com.fp.persistence.pgeneral.safe.TsafeUserSession; +import com.fp.persistence.pgeneral.safe.TsafeUserSessionKey; +import com.fp.persistence.pgeneral.safe.TsafeUserSessionLog; +import com.fp.persistence.pgeneral.safe.TsafeUserSessionLogKey; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Clase que se encargara del ingreso a la aplicacion + * + * @author scastillo + * @version 2.1 + */ +public class UserLogon extends QueryRule { + + private static final long serialVersionUID = 1L; + + private static SimpleDateFormat simpleDateFormatCreateTime = new SimpleDateFormat("HH:mm:ss"); + + private TsafePassword tsafePassword; + + private boolean isjsf; + + /** + * Metodo que ejecuta el proceso + * + * @param pQueryRequest + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + isjsf = pQueryRequest.isJsf(); + TsafeUserDetail userdetail = this.getTsafeUserDetail(pQueryRequest); + + String terminal = (String) pQueryRequest.get("ip"); + String host = (String) pQueryRequest.get("host"); + String jsessionid = (String) pQueryRequest.get("jsessionid"); + String usercode = (String) pQueryRequest.get("login"); + if (userdetail == null) { + this.writeLog(pQueryRequest, usercode, terminal, jsessionid, host, "GENE-0011", "USUARIO NO EXISTE"); + throw new GeneralException("GENE-0011", "USUARIO NO EXISTE"); + } + if (userdetail.getUserstatuscatalog().compareTo("ACT") != 0) { + TgeneCatalogDetailKey tgeneCatalogDetailKey = new TgeneCatalogDetailKey(userdetail.getUserstatuscatalog(), + userdetail.getUserstatuscatalogcode()); + TgeneCatalogDetail tgeneCatalogDetail = TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), tgeneCatalogDetailKey); + this.writeLog(pQueryRequest, userdetail, "GENE-0010", "EL USUARIO " + userdetail.getPk().getUsercode() + " SE ENCUENTRA " + + tgeneCatalogDetail.getDescription()); + throw new GeneralException("GENE-0010", "EL USUARIO {0} SE ENCUENTRA {1}", userdetail.getPk().getUsercode(), + tgeneCatalogDetail.getDescription()); + } + TsafeTerminal tsafeTerminal = null; + // userdetail.getTerminalcode() + if ((userdetail.getBranchfromterminal() != null) && (userdetail.getBranchfromterminal().compareTo("Y") == 0) + && (userdetail.getTerminalcode() != null)) { + TsafeTerminalKey tsafeTerminalKey = new TsafeTerminalKey(userdetail.getTerminalcode(), userdetail.getCompanycode()); + TsafeTerminal tsafeTerminalAux = TsafeTerminal.find(PersistenceHelper.getEntityManager(), tsafeTerminalKey); + if (tsafeTerminalAux == null) { + this.writeLog(pQueryRequest, userdetail, "CORE-0002", "TERMINAL " + terminal + " NO DEFINIDO EN TSAFETERMINAL"); + throw new GeneralException("CORE-0002", "TERMINAL {0} NO DEFINIDO EN TSAFETERMINAL", terminal); + } else { + tsafeTerminal = tsafeTerminalAux; + terminal = tsafeTerminalAux.getIpaddress(); + } + } + if (tsafeTerminal == null) { + tsafeTerminal = TsafeTerminal.find(PersistenceHelper.getEntityManager(), userdetail.getCompanycode(), terminal); + } + if ((userdetail.getBranchfromterminal() != null) && (userdetail.getBranchfromterminal().compareTo("Y") == 0)) { + if (tsafeTerminal == null) { + this.writeLog(pQueryRequest, userdetail, "CORE-0002", "TERMINAL " + terminal + " NO DEFINIDO EN TSAFETERMINAL"); + throw new GeneralException("CORE-0002", "TERMINAL {0} NO DEFINIDO EN TSAFETERMINAL", terminal); + } else if ((tsafeTerminal != null) && (userdetail.getTerminalcode() != null)) { + TsafeTerminalKey tsafeTerminalKey = new TsafeTerminalKey(userdetail.getTerminalcode(), userdetail.getCompanycode()); + TsafeTerminal tsafeTerminalaux = TsafeTerminal.find(PersistenceHelper.getEntityManager(), tsafeTerminalKey); + if ((tsafeTerminalaux != null) && (tsafeTerminalaux.getIpaddress() != null) + && (tsafeTerminalaux.getIpaddress().compareTo(terminal) != 0)) { + this.writeLog(pQueryRequest, userdetail, "CORE-0056", "LA IP " + terminal + " NO SE ENCUENTRA AUTORIZADA PARA EL USUARIO " + + userdetail.getPk().getUsercode()); + throw new GeneralException("CORE-0056", "LA IP {0} NO SE ENCUENTRA AUTORIZADA PARA EL USUARIO {1}", terminal, userdetail.getPk() + .getUsercode()); + } + } + if (userdetail.getBranchcode().compareTo(tsafeTerminal.getBranchcode()) != 0) { + throw new GeneralException("CORE-0064", "EL TERMINAL {0} ASOCIADO AL USUARIO SE ENCUENTRA EN OTRA SUCURSAL {1}"); + } + if (userdetail.getOfficecode().compareTo(tsafeTerminal.getOfficecode()) != 0) { + throw new GeneralException("CORE-0065", "EL TERMINAL {0} ASOCIADO AL USUARIO SE ENCUENTRA EN OTRA OFICINA {1}"); + } + if (userdetail.getAreacode().compareTo(tsafeTerminal.getAreacode()) != 0) { + throw new GeneralException("CORE-0066", "EL TERMINAL {0} ASOCIADO AL USUARIO SE ENCUENTRA EN OTRA REA {1}"); + } + } + if ((tsafeTerminal != null) && (tsafeTerminal.getSliptprinter() != null)) { + userdetail.addAddtionalInfo("spn", tsafeTerminal.getSliptprinter()); + } else { + userdetail.addAddtionalInfo("spn", null); + } + TsafePasswordKey key = new TsafePasswordKey(pQueryRequest.getCompany(), userdetail.getChannelcode()); + this.tsafePassword = TsafePassword.find(PersistenceHelper.getEntityManager(), key); + if (this.tsafePassword == null) { + this.writeLog(pQueryRequest, userdetail, "GENE-0023", "POLITICA DE SEGURIDAD NO DEFINIDA"); + throw new GeneralException("GENE-0023", "POLITICA DE SEGURIDAD NO DEFINIDA"); + } + if (!this.validatePassword(userdetail, pQueryRequest, terminal, jsessionid, host)) { + return pQueryRequest; + } + this.completeLocation(userdetail); + this.completeAreaName(userdetail); + this.completeCompanyName(userdetail); + this.completeChannelName(userdetail); + this.completeBranchName(userdetail, pQueryRequest, terminal); + this.completeOfficeName(userdetail); + this.completeProfile(userdetail); + this.completeDates(userdetail); + if (!pQueryRequest.isJsf()) { + this.completeJavaScript(userdetail); + this.completeInternazionalization(userdetail); + } + //datos de usuario de la sbs + TcustPersonDetail tcp = TcustPersonDetail.find(PersistenceHelper.getEntityManager(), userdetail.getPk().getPersoncode()); + userdetail.addAddtionalInfo("sbsemployee", tcp.getSbsemployee()); + userdetail.addAddtionalInfo("sbsusercode", tcp.getSbsusercode()); + + this.createSession(userdetail, pQueryRequest, terminal, jsessionid, host); + //guarda la aceptacion de terminos + System.out.println("0 terminos :: "+pQueryRequest.get("terminos")); + if(pQueryRequest.get("terminos")!=null && !pQueryRequest.get("terminos").toString().trim().isEmpty()){ + //guarda + System.out.println("1 "+pQueryRequest.get("aceptaterminos")); + String acepta=pQueryRequest.get("aceptaterminos").toString(); + System.out.println("2 "+pQueryRequest.get("identificacionterminos")); + String identificacion=pQueryRequest.get("identificacionterminos").toString(); + System.out.println("3 "+pQueryRequest.get("documentoterminos")); + String documento=pQueryRequest.get("documentoterminos").toString(); + this.saveTerminos(acepta,identificacion,documento); + } + return pQueryRequest; + } + + private void saveTerminos(String acepta,String identificacion,String documento) throws Exception { + StringBuilder sql = new StringBuilder("INSERT INTO TARMTERMINOS(CTERMINOS,ACEPTA,IDENTIFICACION,FECHAREGISTRO,DOCUMENTO)" + + " VALUES ((select coalesce( max(CTERMINOS)+1, 1) as ass from TARMTERMINOS)," + + ":acepta,:identificacion,(select now()),:documento) "); + System.out.println("va a ejecutar"); + PersistenceHelper.getEntityManager().createNativeQuery(sql.toString()) + .setParameter("acepta", acepta) + .setParameter("identificacion", identificacion) + .setParameter("documento", documento) + .executeUpdate(); + System.out.println("Ejecuta"); + } + + private TsafeUserDetail getTsafeUserDetail(QueryRequest pQueryRequest) throws Exception { + TsafeUserDetail userdetail = null; + if (!pQueryRequest.isJsf()) { + Query qry = new Query(); + PersistenceHelper.getEntityManager().clear(); + qry.process(pQueryRequest); + userdetail = (TsafeUserDetail) pQueryRequest.getResponse().get("TSAFEUSERDETAIL"); + } else { + userdetail = TsafeUserDetail.find(PersistenceHelper.getEntityManager(), pQueryRequest.getUser()); + pQueryRequest.getResponse().put("TSAFEUSERDETAIL", userdetail); + } + return userdetail; + } + + /** + * Metodo que agrega el nombre de la sucursal y la ip del cleinte en el detail + * + * @param pUserdetail + * @param pQueryRequest + * @param terminal + * @throws Exception + */ + private void completeBranchName(TsafeUserDetail pUserdetail, QueryRequest pQueryRequest, String terminal) throws Exception { + TgeneBranch branch = DataHelper.getInstance().getTgeneBranch(pUserdetail.getBranchcode(), pUserdetail.getCompanycode()); + pUserdetail.addAddtionalInfo("bn", branch.getDescription()); + pUserdetail.addAddtionalInfo("ip", terminal); + } + + /** + * Metodo que agrega la descripcin del area del usuario + * + * @param pUserdetail + * @throws Exception + */ + private void completeAreaName(TsafeUserDetail pUserdetail) throws Exception { + TgeneAreaKey tgeneAreaKey = new TgeneAreaKey(pUserdetail.getCompanycode(), pUserdetail.getAreacode()); + TgeneArea tgeneArea = (TgeneArea) PersistenceHelper.getSession().get(TgeneArea.class, tgeneAreaKey); + pUserdetail.addAddtionalInfo("an", tgeneArea.getDescripction()); + } + + /** + * Metodo que agrega el nombre de la compania + * + * @param pUserdetail + * @throws Exception + */ + private void completeCompanyName(TsafeUserDetail pUserdetail) throws Exception { + TgeneCompany tgeneCompany = (TgeneCompany) PersistenceHelper.getSession().get(TgeneCompany.class, pUserdetail.getCompanycode()); + pUserdetail.addAddtionalInfo("cn", GeneralDescriptions.getPersonname(tgeneCompany.getPersoncode())); + } + + /** + * Metodo que agrega la descripcion del canal del usuario + * + * @param pUserdetail + * @throws Exception + */ + private void completeChannelName(TsafeUserDetail pUserdetail) throws Exception { + TgeneChannels tgeneChannels = (TgeneChannels) PersistenceHelper.getSession().get(TgeneChannels.class, pUserdetail.getChannelcode()); + pUserdetail.addAddtionalInfo("chn", tgeneChannels.getDescription()); + } + + /** + * Metodo que agrega la oficina en el detail + * + * @param pUserdetail + * @throws Exception + */ + private void completeOfficeName(TsafeUserDetail pUserdetail) throws Exception { + TgeneOfficeKey tgeneOfficeKey = new TgeneOfficeKey(pUserdetail.getOfficecode(), pUserdetail.getBranchcode(), pUserdetail.getCompanycode()); + TgeneOffice office = TgeneOffice.find(PersistenceHelper.getEntityManager(), tgeneOfficeKey); + pUserdetail.addAddtionalInfo("on", office.getDescription()); + } + + /** + * Metodo que completa la fecha contable y de trabajao + * + * @param pUserdetail + * @throws Exception + */ + private void completeDates(TsafeUserDetail pUserdetail) throws Exception { + TgeneAccountingDateBranch tgeneAccountingDateBranch = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pUserdetail.getCompanycode(), 0); + String hour = UserLogon.simpleDateFormatCreateTime.format(FormatDates.getInstance().getDataBaseTimestamp()); + pUserdetail.addAddtionalInfo("wt", hour); + if (tgeneAccountingDateBranch == null) { + pUserdetail.addAddtionalInfo("ad", null); + pUserdetail.addAddtionalInfo("wd", null); + } else { + pUserdetail.addAddtionalInfo("ad", tgeneAccountingDateBranch.getAccountingdate()); + pUserdetail.addAddtionalInfo("wd", tgeneAccountingDateBranch.getWorkingdate()); + } + } + + /** + * Metodo para completar datos de ubicacion del usuario + * + * @param pUserdetail + * @throws Exception + */ + private void completeLocation(TsafeUserDetail pUserdetail) throws Exception { + if ((pUserdetail.getBranchcode() != null) && (pUserdetail.getCompanycode() != null) && (pUserdetail.getOfficecode() != null)) { + TgeneOfficeKey tgeneOfficeKey = new TgeneOfficeKey(pUserdetail.getOfficecode(), pUserdetail.getBranchcode(), pUserdetail.getCompanycode()); + TgeneOffice tgeneOffice = TgeneOffice.find(PersistenceHelper.getEntityManager(), tgeneOfficeKey); + pUserdetail.addAddtionalInfo("address", tgeneOffice.getAddress()); + pUserdetail.addAddtionalInfo("citycode", tgeneOffice.getCitycode()); + if (tgeneOffice.getCountrycode() != null) { + + TgeneCountry tgeneCountry = TgeneCountry.find(PersistenceHelper.getEntityManager(), tgeneOffice.getCountrycode()); + pUserdetail.addAddtionalInfo("countrycode", tgeneCountry.getPk()); + pUserdetail.addAddtionalInfo("countryname", tgeneCountry.getDescription()); + } else { + pUserdetail.addAddtionalInfo("countrycode", null); + pUserdetail.addAddtionalInfo("countryname", null); + } + if ((tgeneOffice.getCountrycode() != null) && (tgeneOffice.getProvincecode() != null)) { + TgeneProvinceKey tgeneProvinceKey = new TgeneProvinceKey(tgeneOffice.getCountrycode(), tgeneOffice.getProvincecode()); + TgeneProvince tgeneProvince = TgeneProvince.find(PersistenceHelper.getEntityManager(), tgeneProvinceKey); + pUserdetail.addAddtionalInfo("provincecode", tgeneProvince.getPk().getProvincecode()); + pUserdetail.addAddtionalInfo("provincename", tgeneProvince.getDescription()); + } else { + pUserdetail.addAddtionalInfo("provincecode", null); + pUserdetail.addAddtionalInfo("provincename", null); + } + if ((tgeneOffice.getCountrycode() != null) && (tgeneOffice.getProvincecode() != null) && (tgeneOffice.getCantoncode() != null) + && (tgeneOffice.getCitycode() != null)) { + TgeneCityKey tgeneCityKey = new TgeneCityKey(tgeneOffice.getCountrycode(), tgeneOffice.getProvincecode(), + tgeneOffice.getCantoncode(), tgeneOffice.getCitycode()); + TgeneCity tgeneCity = TgeneCity.find(PersistenceHelper.getEntityManager(), tgeneCityKey); + pUserdetail.addAddtionalInfo("cityname", tgeneCity.getDescription()); + } else { + pUserdetail.addAddtionalInfo("cityname", null); + } + pUserdetail.addAddtionalInfo("username", GeneralDescriptions.getUsername(pUserdetail.getPk().getUsercode())); + } else { + pUserdetail.addAddtionalInfo("address", null); + pUserdetail.addAddtionalInfo("citycode", null); + pUserdetail.addAddtionalInfo("cityname", null); + pUserdetail.addAddtionalInfo("countrycode", null); + pUserdetail.addAddtionalInfo("countryname", null); + pUserdetail.addAddtionalInfo("provincecode", null); + pUserdetail.addAddtionalInfo("provincename", null); + pUserdetail.addAddtionalInfo("username", null); + } + } + + /** + * Metodo que completa el perfile del usuario + * + * @param pUserdetail + * @throws Exception + */ + private void completeProfile(TsafeUserDetail pUserdetail) throws Exception { + List profile = DataHelper.getInstance().getTsafeUserProfile(pUserdetail.getPk().getUsercode()); + if (this.isjsf) { + pUserdetail.addAddtionalInfo("lprofile", profile); + for (TsafeUserProfile tsafeUserProfile : profile) { + TsafeProfile tsafeProfile = TsafeProfile.find(PersistenceHelper.getEntityManager(), tsafeUserProfile.getPk().getProfilecode()); + tsafeUserProfile.addAddtionalInfo("nprofile", tsafeProfile.getDescription()); + } + return; + } + String profileData = ""; + String profileDataDesc = ""; + + for (int i = 0; i < profile.size(); i++) { + if (i > 0) { + profileData += "."; + profileDataDesc += "."; + } + profileData += profile.get(i).getPk().getProfilecode(); + TsafeProfile tsafeProfile = TsafeProfile.find(PersistenceHelper.getEntityManager(), profile.get(i).getPk().getProfilecode()); + profileDataDesc += tsafeProfile.getDescription(); + } + pUserdetail.addAddtionalInfo("profile", profileData); + pUserdetail.addAddtionalInfo("profiledesc", profileDataDesc); + } + + /** + * Metodo que verifica si el password ingresado es correcto + * + * @param pUserdetail + * @param pQueryRequest + * @throws Exception + */ + private boolean validatePassword(TsafeUserDetail pUserdetail, QueryRequest pQueryRequest, String terminal, String jsessionid, String host) + throws Exception { + String passwd = (String) pQueryRequest.get("itemValue"); + // Valida que el password no este expirado + this.validateExpiration(pUserdetail, pQueryRequest); + if (passwd.compareTo(pUserdetail.getPassword()) != 0) { + boolean maxintentos = this.increaseTryNumber(pUserdetail, pQueryRequest, terminal, jsessionid, host); + if (maxintentos) { + return false; + } + this.writeLog(pQueryRequest, pUserdetail, "GENE-0003", "USUARIO O PASSWORD INCORRECTO"); + pQueryRequest.getResponse().setResponseCode("GENE-0003"); + pQueryRequest.getResponse().setResponseUserMessage("USUARIO O PASSWORD INCORRECTO"); + return false; + } + return true; + } + + /** + * Metodo que verifica si el password ingresado es correcto + * + * @param pUserdetail + * @param pQueryRequest + * @throws Exception + */ + private void validateExpiration(TsafeUserDetail pUserdetail, QueryRequest pQueryRequest) throws Exception { + // Valida que el password no este expirado + if ((this.tsafePassword.getValiditydays() != null) && (this.tsafePassword.getValiditydays() > 0)) { + APPDates appd = new APPDates(pUserdetail.getDatefrom().toString().substring(0, 10), CalculationBase.B365365); + TgeneAccountingDateBranch db = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pQueryRequest.getCompany(), 0); + APPDates appd1 = new APPDates(db.getWorkingdate(), CalculationBase.B365365); + if (appd1.compareTo(appd) >= 0) { + Integer days = appd1.substract(appd); + if (days.compareTo(this.tsafePassword.getValiditydays()) > 0) { + throw new GeneralException("GENE-0023", "CONTRASEA EXPIRADA"); + } + days = days + this.tsafePassword.getMessagedays(); + if (days.compareTo(this.tsafePassword.getValiditydays()) >= 0) { + days = days - this.tsafePassword.getMessagedays(); + days = this.tsafePassword.getValiditydays() - days; + pUserdetail.addAddtionalInfo("dpwd", days); + } + } + } + } + + /** + * Metodo que completa la internacionalizacion dentro de la aplicacion + * + * @param pUserdetail + * @throws Exception + */ + private void completeInternazionalization(TsafeUserDetail pUserdetail) throws Exception { + List lTgeneLabel = TgeneLabel.getTgeneLabel(PersistenceHelper.getEntityManager(), pUserdetail.getLanguagecode(), + pUserdetail.getChannelcode()); + Map map = new HashMap(); + for (int i = 0; i < lTgeneLabel.size(); i++) { + TgeneLabel tgeneLabel = lTgeneLabel.get(i); + map.put(tgeneLabel.getPk().getLabel(), tgeneLabel.getDescription()); + } + pUserdetail.put("i18n", map); + } + + /** + * Metodo que completa los javascript + * + * @param pUserdetail + * @throws Exception + */ + private void completeJavaScript(TsafeUserDetail pUserdetail) throws Exception { + List tsafeJavaScript = TsafeJavaScript.find(PersistenceHelper.getEntityManager(), pUserdetail.getCompanycode(), + pUserdetail.getChannelcode()); + pUserdetail.put("js", tsafeJavaScript); + } + + /** + * Metodo que crea la sesion cuando no existe una + * + * @param pUserdetail + * @param pQueryRequest + * @param terminal + * @param jsessionid + * @param host + * @throws Exception + */ + private void createSession(TsafeUserDetail pUserdetail, QueryRequest pQueryRequest, String terminal, String jsessionid, String host) + throws Exception { + TsafeUserSessionKey tsafeUserSessionKey = new TsafeUserSessionKey(pUserdetail.getPk().getUsercode(), FormatDates.getInstance().getDataBaseTimestamp()); + TsafeUserSession tsafeUserSession = TsafeUserSession.find(PersistenceHelper.getEntityManager(), tsafeUserSessionKey); + PersistenceHelper.detatch(tsafeUserSession); + if (tsafeUserSession == null) { + tsafeUserSession = new TsafeUserSession(); + tsafeUserSession.setDatefrom(FormatDates.getInstance().getDataBaseTimestamp()); + tsafeUserSession.setPk(tsafeUserSessionKey); + tsafeUserSession.setTrynumber(1); + tsafeUserSession.setSessionid(jsessionid); + tsafeUserSession.setTerminalcode(terminal); + tsafeUserSession.setWebserverip(host); + this.saveObject(tsafeUserSession); + } else { + if (tsafeUserSession.getTerminalcode().compareTo(terminal) == 0) { + tsafeUserSession.setDatefrom(FormatDates.getInstance().getDataBaseTimestamp()); + this.saveObject(tsafeUserSession); + } else { + this.writeLog(pQueryRequest, pUserdetail, "GENE-0009", "EL USUARIO " + pUserdetail.getPk().getUsercode() + + " SE ENCUENTRA TRABAJANDO EN EL TERMINAL " + tsafeUserSession.getTerminalcode()); + throw new GeneralException("GENE-0009", "EL USUARIO {0} SE ENCUENTRA TRABAJANDO EN EL TERMINAL {1}", pUserdetail.getPk() + .getUsercode(), tsafeUserSession.getTerminalcode()); + } + } + } + + /** + * Metodo que incrementa el numero de intentos + * + * @param pUserdetail + * @param pQueryRequest + * @param terminal + * @param jsessionid + * @param host + * @return + * @throws Exception + */ + private boolean increaseTryNumber(TsafeUserDetail pUserdetail, QueryRequest pQueryRequest, String terminal, String jsessionid, String host) + throws Exception { + TsafeUserSessionKey tsafeUserSessionKey = new TsafeUserSessionKey(pUserdetail.getPk().getUsercode(), FormatDates.getDefaultExpiryTimestamp()); + TsafeUserSession tsafeUserSession = TsafeUserSession.find(PersistenceHelper.getEntityManager(), tsafeUserSessionKey); + if (tsafeUserSession != null) { + TsafeUserSession tsafeUserSessionAux = (TsafeUserSession) tsafeUserSession.cloneMe(); + tsafeUserSessionAux.getPk().setDateto(FormatDates.getInstance().getDataBaseTimestamp()); + this.saveObject(tsafeUserSessionAux); + tsafeUserSession.setTrynumber(tsafeUserSession.getTrynumber() + 1); + this.saveObject(tsafeUserSession); + + if ((this.tsafePassword.getIntentnumber() != null) && (tsafeUserSession.getTrynumber() >= this.tsafePassword.getIntentnumber())) { + pUserdetail.setUserstatuscatalog("BLQ"); + this.saveObject(pUserdetail); + pQueryRequest.getResponse().setResponseCode("GENE-0007"); + pQueryRequest.getResponse().setResponseUserMessage( + MessageFormat.format("EL USUARIO {0} HA SIDO BLOQUEADO POR INGRESO DE CLAVE ERRONEA", pUserdetail.getPk().getUsercode())); + return true; + } + } else { + this.createSession(pUserdetail, pQueryRequest, terminal, jsessionid, host); + } + return false; + } + + /** + * Mtodo que guarda los datos en la tabla + * + * @param object + * @throws Exception + */ + private void saveObject(Object object) throws Exception { + PersistenceHelper.getEntityManager().merge(object); + } + + /** + * + * @param pQueryRequest + * @param usercode + * @param terminal + * @param jsessionid + * @param host + * @param errorCode + * @param messageError + * @throws Exception + */ + private void writeLog(QueryRequest pQueryRequest, String usercode, String terminal, String jsessionid, String host, String errorCode, + String messageError) throws Exception { + TgeneAccountingDateBranch tgeneAccountingDateBranch = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pQueryRequest.getCompany(), 0); + TsafeUserSessionLogKey tsafeUserSessionLogKey = new TsafeUserSessionLogKey(tgeneAccountingDateBranch.getAccountingdate(), + getSequenceLoginLog(), pQueryRequest.getCompany()); + TsafeUserSessionLog tsafeUserSessionLog = new TsafeUserSessionLog(tsafeUserSessionLogKey, usercode, terminal, jsessionid, host, FormatDates + .getInstance().getDataBaseTimestamp(PersistenceHelper.getEntityManager()), errorCode, messageError); + NestedSave nestedSave = new NestedSave(pQueryRequest.getCompany(), tsafeUserSessionLog); + nestedSave.start(); + } + + /** + * + * @param pQueryRequest + * @param tsafeUserDetail + * @param errorCode + * @param messageError + * @throws Exception + */ + private void writeLog(QueryRequest pQueryRequest, TsafeUserDetail tsafeUserDetail, String errorCode, String messageError) throws Exception { + TgeneAccountingDateBranch tgeneAccountingDateBranch = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pQueryRequest.getCompany(), 0); + String terminal = (String) pQueryRequest.get("ip"); + String host = (String) pQueryRequest.get("host"); + String jsessionid = (String) pQueryRequest.get("jsessionid"); + TsafeUserSessionLogKey tsafeUserSessionLogKey = new TsafeUserSessionLogKey(tgeneAccountingDateBranch.getAccountingdate(), + getSequenceLoginLog(), pQueryRequest.getCompany()); + TsafeUserSessionLog tsafeUserSessionLog = new TsafeUserSessionLog(tsafeUserSessionLogKey, tsafeUserDetail.getPk().getUsercode(), terminal, + jsessionid, host, FormatDates.getInstance().getDataBaseTimestamp(PersistenceHelper.getEntityManager()), errorCode, messageError); + tsafeUserSessionLog.setBranchcode(tsafeUserDetail.getBranchcode()); + tsafeUserSessionLog.setOfficecode(tsafeUserDetail.getOfficecode()); + NestedSave nestedSave = new NestedSave(pQueryRequest.getCompany(), tsafeUserSessionLog); + nestedSave.start(); + } + + /** + * Metodo que entrega la secuencia para gurdar los logs + * + * @return + * @throws Exception + */ + private Integer getSequenceLoginLog() throws Exception { + Sequence sequence = new Sequence(); + Integer loginsequnce = Integer.valueOf(sequence.getNextValue("LOGINLOG").toString()); + SaveData.getMap().put("LOGINLOG", loginsequnce.toString()); + return loginsequnce; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/UserLogonCas.java b/base/business/general/src/main/java/com/fp/general/security/rules/UserLogonCas.java new file mode 100644 index 0000000..5fee983 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/UserLogonCas.java @@ -0,0 +1,569 @@ +package com.fp.general.security.rules; + +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.base.persistence.util.helper.GeneralDescriptions; +import com.fp.bpm.query.Query; +import com.fp.common.helper.CalculationBase; +import com.fp.dto.data.SaveData; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.general.db.DataHelper; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.NestedSave; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.APPDates; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.gene.TgeneArea; +import com.fp.persistence.pgeneral.gene.TgeneAreaKey; +import com.fp.persistence.pgeneral.gene.TgeneBranch; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; +import com.fp.persistence.pgeneral.gene.TgeneChannels; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCityKey; +import com.fp.persistence.pgeneral.gene.TgeneCompany; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneLabel; +import com.fp.persistence.pgeneral.gene.TgeneOffice; +import com.fp.persistence.pgeneral.gene.TgeneOfficeKey; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.gene.TgeneProvinceKey; +import com.fp.persistence.pgeneral.safe.TsafeJavaScript; +import com.fp.persistence.pgeneral.safe.TsafePassword; +import com.fp.persistence.pgeneral.safe.TsafePasswordKey; +import com.fp.persistence.pgeneral.safe.TsafeProfile; +import com.fp.persistence.pgeneral.safe.TsafeTerminal; +import com.fp.persistence.pgeneral.safe.TsafeTerminalKey; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserProfile; +import com.fp.persistence.pgeneral.safe.TsafeUserSession; +import com.fp.persistence.pgeneral.safe.TsafeUserSessionKey; +import com.fp.persistence.pgeneral.safe.TsafeUserSessionLog; +import com.fp.persistence.pgeneral.safe.TsafeUserSessionLogKey; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Clase que se encargara del ingreso a la aplicacion + * + * @author scastillo + * @version 2.1 + */ +public class UserLogonCas extends QueryRule { + + private static final long serialVersionUID = 1L; + + private static SimpleDateFormat simpleDateFormatCreateTime = new SimpleDateFormat("HH:mm:ss"); + + private TsafePassword tsafePassword; + + private boolean isjsf; + + /** + * Metodo que ejecuta el proceso + * + * @param pQueryRequest + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + this.isjsf = pQueryRequest.isJsf(); + TsafeUserDetail userdetail = this.getTsafeUserDetail(pQueryRequest); + + String terminal = (String) pQueryRequest.get("ip"); + String host = (String) pQueryRequest.get("host"); + String jsessionid = (String) pQueryRequest.get("jsessionid"); + String usercode = (String) pQueryRequest.get("login"); + if (userdetail == null) { + this.writeLog(pQueryRequest, usercode, terminal, jsessionid, host, "GENE-0011", "USUARIO NO EXISTE"); + throw new GeneralException("GENE-0011", "USUARIO NO EXISTE"); + } + if (userdetail.getUserstatuscatalog().compareTo("ACT") != 0) { + TgeneCatalogDetailKey tgeneCatalogDetailKey = new TgeneCatalogDetailKey(userdetail.getUserstatuscatalog(), + userdetail.getUserstatuscatalogcode()); + TgeneCatalogDetail tgeneCatalogDetail = TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), tgeneCatalogDetailKey); + this.writeLog(pQueryRequest, userdetail, "GENE-0010", "EL USUARIO " + userdetail.getPk().getUsercode() + " SE ENCUENTRA " + + tgeneCatalogDetail.getDescription()); + throw new GeneralException("GENE-0010", "EL USUARIO {0} SE ENCUENTRA {1}", userdetail.getPk().getUsercode(), + tgeneCatalogDetail.getDescription()); + } + TsafeTerminal tsafeTerminal = null; + // userdetail.getTerminalcode() + if ((userdetail.getBranchfromterminal() != null) && (userdetail.getBranchfromterminal().compareTo("Y") == 0) + && (userdetail.getTerminalcode() != null)) { + TsafeTerminalKey tsafeTerminalKey = new TsafeTerminalKey(userdetail.getTerminalcode(), userdetail.getCompanycode()); + TsafeTerminal tsafeTerminalAux = TsafeTerminal.find(PersistenceHelper.getEntityManager(), tsafeTerminalKey); + if (tsafeTerminalAux == null) { + this.writeLog(pQueryRequest, userdetail, "CORE-0002", "TERMINAL " + terminal + " NO DEFINIDO EN TSAFETERMINAL"); + throw new GeneralException("CORE-0002", "TERMINAL {0} NO DEFINIDO EN TSAFETERMINAL", terminal); + } else { + tsafeTerminal = tsafeTerminalAux; + terminal = tsafeTerminalAux.getIpaddress(); + } + } + if (tsafeTerminal == null) { + tsafeTerminal = TsafeTerminal.find(PersistenceHelper.getEntityManager(), userdetail.getCompanycode(), terminal); + } + if ((userdetail.getBranchfromterminal() != null) && (userdetail.getBranchfromterminal().compareTo("Y") == 0)) { + if (tsafeTerminal == null) { + this.writeLog(pQueryRequest, userdetail, "CORE-0002", "TERMINAL " + terminal + " NO DEFINIDO EN TSAFETERMINAL"); + throw new GeneralException("CORE-0002", "TERMINAL {0} NO DEFINIDO EN TSAFETERMINAL", terminal); + } else if ((tsafeTerminal != null) && (userdetail.getTerminalcode() != null)) { + TsafeTerminalKey tsafeTerminalKey = new TsafeTerminalKey(userdetail.getTerminalcode(), userdetail.getCompanycode()); + TsafeTerminal tsafeTerminalaux = TsafeTerminal.find(PersistenceHelper.getEntityManager(), tsafeTerminalKey); + if ((tsafeTerminalaux != null) && (tsafeTerminalaux.getIpaddress() != null) + && (tsafeTerminalaux.getIpaddress().compareTo(terminal) != 0)) { + this.writeLog(pQueryRequest, userdetail, "CORE-0056", "LA IP " + terminal + " NO SE ENCUENTRA AUTORIZADA PARA EL USUARIO " + + userdetail.getPk().getUsercode()); + throw new GeneralException("CORE-0056", "LA IP {0} NO SE ENCUENTRA AUTORIZADA PARA EL USUARIO {1}", terminal, userdetail.getPk() + .getUsercode()); + } + } + if (userdetail.getBranchcode().compareTo(tsafeTerminal.getBranchcode()) != 0) { + throw new GeneralException("CORE-0064", "EL TERMINAL {0} ASOCIADO AL USUARIO SE ENCUENTRA EN OTRA SUCURSAL {1}"); + } + if (userdetail.getOfficecode().compareTo(tsafeTerminal.getOfficecode()) != 0) { + throw new GeneralException("CORE-0065", "EL TERMINAL {0} ASOCIADO AL USUARIO SE ENCUENTRA EN OTRA OFICINA {1}"); + } + if (userdetail.getAreacode().compareTo(tsafeTerminal.getAreacode()) != 0) { + throw new GeneralException("CORE-0066", "EL TERMINAL {0} ASOCIADO AL USUARIO SE ENCUENTRA EN OTRA REA {1}"); + } + } + if ((tsafeTerminal != null) && (tsafeTerminal.getSliptprinter() != null)) { + userdetail.addAddtionalInfo("spn", tsafeTerminal.getSliptprinter()); + } else { + userdetail.addAddtionalInfo("spn", null); + } + TsafePasswordKey key = new TsafePasswordKey(pQueryRequest.getCompany(), userdetail.getChannelcode()); + this.tsafePassword = TsafePassword.find(PersistenceHelper.getEntityManager(), key); + + this.completeLocation(userdetail); + this.completeAreaName(userdetail); + this.completeCompanyName(userdetail); + this.completeChannelName(userdetail); + this.completeBranchName(userdetail, pQueryRequest, terminal); + this.completeOfficeName(userdetail); + this.completeProfile(userdetail); + this.completeDates(userdetail); + if (!pQueryRequest.isJsf()) { + this.completeJavaScript(userdetail); + this.completeInternazionalization(userdetail); + } + //datos de usuario de la sbs + TcustPersonDetail tcp = TcustPersonDetail.find(PersistenceHelper.getEntityManager(), userdetail.getPk().getPersoncode()); + userdetail.addAddtionalInfo("sbsemployee", tcp.getSbsemployee()); + userdetail.addAddtionalInfo("sbsusercode", tcp.getSbsusercode()); + // this.createSession(userdetail, pQueryRequest, terminal, jsessionid, host); + return pQueryRequest; + } + + private TsafeUserDetail getTsafeUserDetail(QueryRequest pQueryRequest) throws Exception { + TsafeUserDetail userdetail = null; + if (!pQueryRequest.isJsf()) { + Query qry = new Query(); + PersistenceHelper.getEntityManager().clear(); + qry.process(pQueryRequest); + userdetail = (TsafeUserDetail) pQueryRequest.getResponse().get("TSAFEUSERDETAIL"); + } else { + userdetail = TsafeUserDetail.find(PersistenceHelper.getEntityManager(), pQueryRequest.get("login").toString()); + pQueryRequest.getResponse().put("TSAFEUSERDETAIL", userdetail); + } + return userdetail; + } + + /** + * Metodo que agrega el nombre de la sucursal y la ip del cleinte en el detail + * + * @param pUserdetail + * @param pQueryRequest + * @param terminal + * @throws Exception + */ + private void completeBranchName(TsafeUserDetail pUserdetail, QueryRequest pQueryRequest, String terminal) throws Exception { + TgeneBranch branch = DataHelper.getInstance().getTgeneBranch(pUserdetail.getBranchcode(), pUserdetail.getCompanycode()); + pUserdetail.addAddtionalInfo("bn", branch.getDescription()); + pUserdetail.addAddtionalInfo("ip", terminal); + } + + /** + * Metodo que agrega la descripcin del area del usuario + * + * @param pUserdetail + * @throws Exception + */ + private void completeAreaName(TsafeUserDetail pUserdetail) throws Exception { + TgeneAreaKey tgeneAreaKey = new TgeneAreaKey(pUserdetail.getCompanycode(), pUserdetail.getAreacode()); + TgeneArea tgeneArea = (TgeneArea) PersistenceHelper.getSession().get(TgeneArea.class, tgeneAreaKey); + pUserdetail.addAddtionalInfo("an", tgeneArea.getDescripction()); + } + + /** + * Metodo que agrega el nombre de la compania + * + * @param pUserdetail + * @throws Exception + */ + private void completeCompanyName(TsafeUserDetail pUserdetail) throws Exception { + TgeneCompany tgeneCompany = (TgeneCompany) PersistenceHelper.getSession().get(TgeneCompany.class, pUserdetail.getCompanycode()); + pUserdetail.addAddtionalInfo("cn", GeneralDescriptions.getPersonname(tgeneCompany.getPersoncode())); + } + + /** + * Metodo que agrega la descripcion del canal del usuario + * + * @param pUserdetail + * @throws Exception + */ + private void completeChannelName(TsafeUserDetail pUserdetail) throws Exception { + TgeneChannels tgeneChannels = (TgeneChannels) PersistenceHelper.getSession().get(TgeneChannels.class, pUserdetail.getChannelcode()); + pUserdetail.addAddtionalInfo("chn", tgeneChannels.getDescription()); + } + + /** + * Metodo que agrega la oficina en el detail + * + * @param pUserdetail + * @throws Exception + */ + private void completeOfficeName(TsafeUserDetail pUserdetail) throws Exception { + TgeneOfficeKey tgeneOfficeKey = new TgeneOfficeKey(pUserdetail.getOfficecode(), pUserdetail.getBranchcode(), pUserdetail.getCompanycode()); + TgeneOffice office = TgeneOffice.find(PersistenceHelper.getEntityManager(), tgeneOfficeKey); + pUserdetail.addAddtionalInfo("on", office.getDescription()); + } + + /** + * Metodo que completa la fecha contable y de trabajao + * + * @param pUserdetail + * @throws Exception + */ + private void completeDates(TsafeUserDetail pUserdetail) throws Exception { + TgeneAccountingDateBranch tgeneAccountingDateBranch = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pUserdetail.getCompanycode(), 0); + String hour = UserLogonCas.simpleDateFormatCreateTime.format(FormatDates.getInstance().getDataBaseTimestamp()); + pUserdetail.addAddtionalInfo("wt", hour); + if (tgeneAccountingDateBranch == null) { + pUserdetail.addAddtionalInfo("ad", null); + pUserdetail.addAddtionalInfo("wd", null); + } else { + pUserdetail.addAddtionalInfo("ad", tgeneAccountingDateBranch.getAccountingdate()); + pUserdetail.addAddtionalInfo("wd", tgeneAccountingDateBranch.getWorkingdate()); + } + } + + /** + * Metodo para completar datos de ubicacion del usuario + * + * @param pUserdetail + * @throws Exception + */ + private void completeLocation(TsafeUserDetail pUserdetail) throws Exception { + if ((pUserdetail.getBranchcode() != null) && (pUserdetail.getCompanycode() != null) && (pUserdetail.getOfficecode() != null)) { + TgeneOfficeKey tgeneOfficeKey = new TgeneOfficeKey(pUserdetail.getOfficecode(), pUserdetail.getBranchcode(), pUserdetail.getCompanycode()); + TgeneOffice tgeneOffice = TgeneOffice.find(PersistenceHelper.getEntityManager(), tgeneOfficeKey); + pUserdetail.addAddtionalInfo("address", tgeneOffice.getAddress()); + pUserdetail.addAddtionalInfo("citycode", tgeneOffice.getCitycode()); + if (tgeneOffice.getCountrycode() != null) { + + TgeneCountry tgeneCountry = TgeneCountry.find(PersistenceHelper.getEntityManager(), tgeneOffice.getCountrycode()); + pUserdetail.addAddtionalInfo("countrycode", tgeneCountry.getPk()); + pUserdetail.addAddtionalInfo("countryname", tgeneCountry.getDescription()); + } else { + pUserdetail.addAddtionalInfo("countrycode", null); + pUserdetail.addAddtionalInfo("countryname", null); + } + if ((tgeneOffice.getCountrycode() != null) && (tgeneOffice.getProvincecode() != null)) { + TgeneProvinceKey tgeneProvinceKey = new TgeneProvinceKey(tgeneOffice.getCountrycode(), tgeneOffice.getProvincecode()); + TgeneProvince tgeneProvince = TgeneProvince.find(PersistenceHelper.getEntityManager(), tgeneProvinceKey); + pUserdetail.addAddtionalInfo("provincecode", tgeneProvince.getPk().getProvincecode()); + pUserdetail.addAddtionalInfo("provincename", tgeneProvince.getDescription()); + } else { + pUserdetail.addAddtionalInfo("provincecode", null); + pUserdetail.addAddtionalInfo("provincename", null); + } + if ((tgeneOffice.getCountrycode() != null) && (tgeneOffice.getProvincecode() != null) && (tgeneOffice.getCantoncode() != null) + && (tgeneOffice.getCitycode() != null)) { + TgeneCityKey tgeneCityKey = new TgeneCityKey(tgeneOffice.getCountrycode(), tgeneOffice.getProvincecode(), + tgeneOffice.getCantoncode(), tgeneOffice.getCitycode()); + TgeneCity tgeneCity = TgeneCity.find(PersistenceHelper.getEntityManager(), tgeneCityKey); + pUserdetail.addAddtionalInfo("cityname", tgeneCity.getDescription()); + } else { + pUserdetail.addAddtionalInfo("cityname", null); + } + pUserdetail.addAddtionalInfo("username", GeneralDescriptions.getUsername(pUserdetail.getPk().getUsercode())); + } else { + pUserdetail.addAddtionalInfo("address", null); + pUserdetail.addAddtionalInfo("citycode", null); + pUserdetail.addAddtionalInfo("cityname", null); + pUserdetail.addAddtionalInfo("countrycode", null); + pUserdetail.addAddtionalInfo("countryname", null); + pUserdetail.addAddtionalInfo("provincecode", null); + pUserdetail.addAddtionalInfo("provincename", null); + pUserdetail.addAddtionalInfo("username", null); + } + } + + /** + * Metodo que completa el perfile del usuario + * + * @param pUserdetail + * @throws Exception + */ + private void completeProfile(TsafeUserDetail pUserdetail) throws Exception { + List profile = DataHelper.getInstance().getTsafeUserProfile(pUserdetail.getPk().getUsercode()); + if (this.isjsf) { + pUserdetail.addAddtionalInfo("lprofile", profile); + for (TsafeUserProfile tsafeUserProfile : profile) { + TsafeProfile tsafeProfile = TsafeProfile.find(PersistenceHelper.getEntityManager(), tsafeUserProfile.getPk().getProfilecode()); + tsafeUserProfile.addAddtionalInfo("nprofile", tsafeProfile.getDescription()); + } + return; + } + String profileData = ""; + String profileDataDesc = ""; + + for (int i = 0; i < profile.size(); i++) { + if (i > 0) { + profileData += "."; + profileDataDesc += "."; + } + profileData += profile.get(i).getPk().getProfilecode(); + TsafeProfile tsafeProfile = TsafeProfile.find(PersistenceHelper.getEntityManager(), profile.get(i).getPk().getProfilecode()); + profileDataDesc += tsafeProfile.getDescription(); + } + pUserdetail.addAddtionalInfo("profile", profileData); + pUserdetail.addAddtionalInfo("profiledesc", profileDataDesc); + } + + /** + * Metodo que verifica si el password ingresado es correcto + * + * @param pUserdetail + * @param pQueryRequest + * @throws Exception + */ + private boolean validatePassword(TsafeUserDetail pUserdetail, QueryRequest pQueryRequest, String terminal, String jsessionid, String host) + throws Exception { + String passwd = (String) pQueryRequest.get("itemValue"); + // Valida que el password no este expirado + this.validateExpiration(pUserdetail, pQueryRequest); + if (passwd.compareTo(pUserdetail.getPassword()) != 0) { + boolean maxintentos = this.increaseTryNumber(pUserdetail, pQueryRequest, terminal, jsessionid, host); + if (maxintentos) { + return false; + } + this.writeLog(pQueryRequest, pUserdetail, "GENE-0003", "USUARIO O PASSWORD INCORRECTO"); + pQueryRequest.getResponse().setResponseCode("GENE-0003"); + pQueryRequest.getResponse().setResponseUserMessage("USUARIO O PASSWORD INCORRECTO"); + return false; + } + return true; + } + + /** + * Metodo que verifica si el password ingresado es correcto + * + * @param pUserdetail + * @param pQueryRequest + * @throws Exception + */ + private void validateExpiration(TsafeUserDetail pUserdetail, QueryRequest pQueryRequest) throws Exception { + // Valida que el password no este expirado + if ((this.tsafePassword.getValiditydays() != null) && (this.tsafePassword.getValiditydays() > 0)) { + APPDates appd = new APPDates(pUserdetail.getDatefrom().toString().substring(0, 10), CalculationBase.B365365); + TgeneAccountingDateBranch db = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pQueryRequest.getCompany(), 0); + APPDates appd1 = new APPDates(db.getWorkingdate(), CalculationBase.B365365); + if (appd1.compareTo(appd) >= 0) { + Integer days = appd1.substract(appd); + if (days.compareTo(this.tsafePassword.getValiditydays()) > 0) { + throw new GeneralException("GENE-0023", "CONTRASEA EXPIRADA"); + } + days = days + this.tsafePassword.getMessagedays(); + if (days.compareTo(this.tsafePassword.getValiditydays()) >= 0) { + days = days - this.tsafePassword.getMessagedays(); + days = this.tsafePassword.getValiditydays() - days; + pUserdetail.addAddtionalInfo("dpwd", days); + } + } + } + } + + /** + * Metodo que completa la internacionalizacion dentro de la aplicacion + * + * @param pUserdetail + * @throws Exception + */ + private void completeInternazionalization(TsafeUserDetail pUserdetail) throws Exception { + List lTgeneLabel = TgeneLabel.getTgeneLabel(PersistenceHelper.getEntityManager(), pUserdetail.getLanguagecode(), + pUserdetail.getChannelcode()); + Map map = new HashMap(); + for (int i = 0; i < lTgeneLabel.size(); i++) { + TgeneLabel tgeneLabel = lTgeneLabel.get(i); + map.put(tgeneLabel.getPk().getLabel(), tgeneLabel.getDescription()); + } + pUserdetail.put("i18n", map); + } + + /** + * Metodo que completa los javascript + * + * @param pUserdetail + * @throws Exception + */ + private void completeJavaScript(TsafeUserDetail pUserdetail) throws Exception { + List tsafeJavaScript = TsafeJavaScript.find(PersistenceHelper.getEntityManager(), pUserdetail.getCompanycode(), + pUserdetail.getChannelcode()); + pUserdetail.put("js", tsafeJavaScript); + } + + /** + * Metodo que crea la sesion cuando no existe una + * + * @param pUserdetail + * @param pQueryRequest + * @param terminal + * @param jsessionid + * @param host + * @throws Exception + */ + private void createSession(TsafeUserDetail pUserdetail, QueryRequest pQueryRequest, String terminal, String jsessionid, String host) + throws Exception { + TsafeUserSessionKey tsafeUserSessionKey = new TsafeUserSessionKey(pUserdetail.getPk().getUsercode(), FormatDates.getDefaultExpiryTimestamp()); + TsafeUserSession tsafeUserSession = TsafeUserSession.find(PersistenceHelper.getEntityManager(), tsafeUserSessionKey); + PersistenceHelper.detatch(tsafeUserSession); + if (tsafeUserSession == null) { + tsafeUserSession = new TsafeUserSession(); + tsafeUserSession.setDatefrom(FormatDates.getInstance().getDataBaseTimestamp()); + tsafeUserSession.setPk(tsafeUserSessionKey); + tsafeUserSession.setTrynumber(1); + tsafeUserSession.setSessionid(jsessionid); + tsafeUserSession.setTerminalcode(terminal); + tsafeUserSession.setWebserverip(host); + this.saveObject(tsafeUserSession); + } else { + if (tsafeUserSession.getTerminalcode().compareTo(terminal) == 0) { + tsafeUserSession.setDatefrom(FormatDates.getInstance().getDataBaseTimestamp()); + this.saveObject(tsafeUserSession); + } else { + this.writeLog(pQueryRequest, pUserdetail, "GENE-0009", "EL USUARIO " + pUserdetail.getPk().getUsercode() + + " SE ENCUENTRA TRABAJANDO EN EL TERMINAL " + tsafeUserSession.getTerminalcode()); + throw new GeneralException("GENE-0009", "EL USUARIO {0} SE ENCUENTRA TRABAJANDO EN EL TERMINAL {1}", pUserdetail.getPk() + .getUsercode(), tsafeUserSession.getTerminalcode()); + } + } + } + + /** + * Metodo que incrementa el numero de intentos + * + * @param pUserdetail + * @param pQueryRequest + * @param terminal + * @param jsessionid + * @param host + * @return + * @throws Exception + */ + private boolean increaseTryNumber(TsafeUserDetail pUserdetail, QueryRequest pQueryRequest, String terminal, String jsessionid, String host) + throws Exception { + TsafeUserSessionKey tsafeUserSessionKey = new TsafeUserSessionKey(pUserdetail.getPk().getUsercode(), FormatDates.getDefaultExpiryTimestamp()); + TsafeUserSession tsafeUserSession = TsafeUserSession.find(PersistenceHelper.getEntityManager(), tsafeUserSessionKey); + if (tsafeUserSession != null) { + TsafeUserSession tsafeUserSessionAux = (TsafeUserSession) tsafeUserSession.cloneMe(); + tsafeUserSessionAux.getPk().setDateto(FormatDates.getInstance().getDataBaseTimestamp()); + this.saveObject(tsafeUserSessionAux); + tsafeUserSession.setTrynumber(tsafeUserSession.getTrynumber() + 1); + this.saveObject(tsafeUserSession); + + if ((this.tsafePassword.getIntentnumber() != null) && (tsafeUserSession.getTrynumber() >= this.tsafePassword.getIntentnumber())) { + pUserdetail.setUserstatuscatalog("BLQ"); + this.saveObject(pUserdetail); + pQueryRequest.getResponse().setResponseCode("GENE-0007"); + pQueryRequest.getResponse().setResponseUserMessage( + MessageFormat.format("EL USUARIO {0} HA SIDO BLOQUEADO POR INGRESO DE CLAVE ERRONEA", pUserdetail.getPk().getUsercode())); + return true; + } + } else { + this.createSession(pUserdetail, pQueryRequest, terminal, jsessionid, host); + } + return false; + } + + /** + * Mtodo que guarda los datos en la tabla + * + * @param object + * @throws Exception + */ + private void saveObject(Object object) throws Exception { + PersistenceHelper.getEntityManager().merge(object); + } + + /** + * + * @param pQueryRequest + * @param usercode + * @param terminal + * @param jsessionid + * @param host + * @param errorCode + * @param messageError + * @throws Exception + */ + private void writeLog(QueryRequest pQueryRequest, String usercode, String terminal, String jsessionid, String host, String errorCode, + String messageError) throws Exception { + TgeneAccountingDateBranch tgeneAccountingDateBranch = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pQueryRequest.getCompany(), 0); + TsafeUserSessionLogKey tsafeUserSessionLogKey = new TsafeUserSessionLogKey(tgeneAccountingDateBranch.getAccountingdate(), + this.getSequenceLoginLog(), pQueryRequest.getCompany()); + TsafeUserSessionLog tsafeUserSessionLog = new TsafeUserSessionLog(tsafeUserSessionLogKey, usercode, terminal, jsessionid, host, FormatDates + .getInstance().getDataBaseTimestamp(PersistenceHelper.getEntityManager()), errorCode, messageError); + NestedSave nestedSave = new NestedSave(pQueryRequest.getCompany(), tsafeUserSessionLog); + nestedSave.start(); + } + + /** + * + * @param pQueryRequest + * @param tsafeUserDetail + * @param errorCode + * @param messageError + * @throws Exception + */ + private void writeLog(QueryRequest pQueryRequest, TsafeUserDetail tsafeUserDetail, String errorCode, String messageError) throws Exception { + TgeneAccountingDateBranch tgeneAccountingDateBranch = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pQueryRequest.getCompany(), 0); + String terminal = (String) pQueryRequest.get("ip"); + String host = (String) pQueryRequest.get("host"); + String jsessionid = (String) pQueryRequest.get("jsessionid"); + TsafeUserSessionLogKey tsafeUserSessionLogKey = new TsafeUserSessionLogKey(tgeneAccountingDateBranch.getAccountingdate(), + this.getSequenceLoginLog(), pQueryRequest.getCompany()); + TsafeUserSessionLog tsafeUserSessionLog = new TsafeUserSessionLog(tsafeUserSessionLogKey, tsafeUserDetail.getPk().getUsercode(), terminal, + jsessionid, host, FormatDates.getInstance().getDataBaseTimestamp(PersistenceHelper.getEntityManager()), errorCode, messageError); + tsafeUserSessionLog.setBranchcode(tsafeUserDetail.getBranchcode()); + tsafeUserSessionLog.setOfficecode(tsafeUserDetail.getOfficecode()); + NestedSave nestedSave = new NestedSave(pQueryRequest.getCompany(), tsafeUserSessionLog); + nestedSave.start(); + } + + /** + * Metodo que entrega la secuencia para gurdar los logs + * + * @return + * @throws Exception + */ + private Integer getSequenceLoginLog() throws Exception { + Sequence sequence = new Sequence(); + Integer loginsequnce = Integer.valueOf(sequence.getNextValue("LOGINLOG").toString()); + SaveData.getMap().put("LOGINLOG", loginsequnce.toString()); + return loginsequnce; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/query/.svn/entries b/base/business/general/src/main/java/com/fp/general/security/rules/query/.svn/entries new file mode 100644 index 0000000..1cd9eca --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/query/.svn/entries @@ -0,0 +1,99 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/security/rules/query +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +CompleteAudit.java +file + + + + +2022-07-28T03:40:43.476806Z +c1c903124111e4080d2dfae339243fbb +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3951 + +code +dir + +QueryAudit.java +file + + + + +2022-07-28T03:40:43.476806Z +42ff18cf31ad70fc50ad16b81b81907c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7431 + diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/query/.svn/text-base/CompleteAudit.java.svn-base b/base/business/general/src/main/java/com/fp/general/security/rules/query/.svn/text-base/CompleteAudit.java.svn-base new file mode 100644 index 0000000..5be8beb --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/query/.svn/text-base/CompleteAudit.java.svn-base @@ -0,0 +1,92 @@ +package com.fp.general.security.rules.query; + +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; +import com.fp.persistence.pgeneral.acco.TgeneAccount; +import com.fp.persistence.pgeneral.acco.TgeneAccountKey; +import com.fp.persistence.pgeneral.gene.TgeneSolicitude; +import com.fp.persistence.pgeneral.gene.TgeneSolicitudeKey; +import com.fp.persistence.pgeneral.safe.TsafeAudit; +import com.fp.persistence.pgeneral.safe.TsafeAuditInsDel; +import java.util.List; + +/** + * Clase que se encarga de completar datos como el nombre de cliente o nobre de + * cuanta o prestamo + * + * @author scastillo + */ +public class CompleteAudit extends QueryRule { + + private static final String name = "name"; + + /** + * Metodo que se encarga de completar datos como el nombre de cliente nombre + * de prestamo o cuenta + * + * @param qr + * @return + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest qr) throws Exception { + Response response = qr.getResponse(); + Query query = new Query(); + query.process(qr); + List lTsafeAudit = (List) response.get("TSAFEAUDIT"); + if (lTsafeAudit != null) { + for (Object obj : lTsafeAudit) { + TsafeAudit tsafeAudit = (TsafeAudit) obj; + if (tsafeAudit.getPersoncode() != null) { + TcustPersonDetailKey tcustPersonDetailKey = + new TcustPersonDetailKey( + tsafeAudit.getPersoncode(), + FormatDates.getDefaultExpiryTimestamp()); + TcustPersonDetail tcustPersonDetail = TcustPersonDetail.find( + PersistenceHelper.getEntityManager(), + tcustPersonDetailKey); + if (tcustPersonDetail != null) { + tsafeAudit.addAddtionalInfo(name, + tcustPersonDetail.getName()); + } else { + tsafeAudit.addAddtionalInfo(name, null); + } + } else if (tsafeAudit.getSolicitudenumber() != null) { + TgeneSolicitudeKey tgeneSolicitudeKey = + new TgeneSolicitudeKey(); + TgeneSolicitude tgeneSolicitude = TgeneSolicitude.find( + PersistenceHelper.getEntityManager(), + tgeneSolicitudeKey); + if (tgeneSolicitude != null) { + tsafeAudit.addAddtionalInfo(name, + tgeneSolicitude.getAccountname()); + } else { + tsafeAudit.addAddtionalInfo(name, null); + } + } else if (tsafeAudit.getAccount() != null) { + TgeneAccountKey tgeneAccountKey = new TgeneAccountKey( + tsafeAudit.getAccount(), qr.getCompany(), + FormatDates.getDefaultExpiryTimestamp()); + TgeneAccount tgeneAccount = TgeneAccount.find( + PersistenceHelper.getEntityManager(), + tgeneAccountKey); + if (tgeneAccount != null) { + tsafeAudit.addAddtionalInfo(name, + tgeneAccount.getAccountname()); + } else { + tsafeAudit.addAddtionalInfo(name, null); + } + } else { + tsafeAudit.addAddtionalInfo(name, null); + } + } + } + return qr; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/query/.svn/text-base/QueryAudit.java.svn-base b/base/business/general/src/main/java/com/fp/general/security/rules/query/.svn/text-base/QueryAudit.java.svn-base new file mode 100644 index 0000000..6a2d018 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/query/.svn/text-base/QueryAudit.java.svn-base @@ -0,0 +1,165 @@ +package com.fp.general.security.rules.query; + +import java.sql.Date; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.GeneralQuery; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.APPDates; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.safe.TsafeAuditInsDel; +import com.fp.persistence.pgeneral.safe.TsafeAuditInsDelKey; + +/** + * Clase que consulta los datos de la tabla TSAFEAUDITINSDEL + * + * @author BPTWPA + * + */ +public class QueryAudit extends QueryRule { + + private static final long serialVersionUID = 1L; + //SQL nativo para realizar la consulta + private static final String SQL_AUDIT = "select t.changedate, t.tablename, t.realdate, t.terminalcode, " + + "t.usercode, t.isinsert, t.account, t.solicitudenumber, t.personcode, " + + "(select p.name from tcustpersondetail p where p.personcode=t.personcode " + + "and p.dateto = :datetoperson) as name, " + + "(select o.description from tgeneoffice o where o.officecode=t.officecode " + + "and o.branchcode=t.branchcode and o.companycode=t.companycode) as officedesc, " + + "(select b.description from tgenebranch b where b.branchcode=t.branchcode and " + + "b.companycode=t.companycode) as branchdesc, " + + "t.transactionmodule, t.transactioncode, t.transactionversion, " + + "(select r.name from tgenetransaction r where r.transactionmodule=t.transactionmodule " + + "and r.transactioncode=t.transactioncode and r.transactionversion=t.transactionversion) as transactiondesc " + + ", t.partitiondb " + + "from TSAFEAUDITINSDEL t " + + "where t.changedate=t.changedate "; + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + StringBuilder sql = new StringBuilder(); + List listResp = new ArrayList(); + QueryBean qb = (QueryBean) pQueryRequest.get("TSAFEAUDITINSDEL"); + List lcriteria = qb.getCriteria(); + sql.append(QueryAudit.SQL_AUDIT); + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(QueryAudit.addSimpleCriteria(sql, lcriteria, qb)); + QueryAudit.setSimpleParameters(qry, qb.getCriteria()); + qry.setParameter("datetoperson", FormatDates.getDefaultExpiryTimestamp()); + qry.setFirstResult((qb.getPage() - 1) * qb.getPageSize()); + qry.setMaxResults(qb.getPageSize()); + @SuppressWarnings("unchecked") + List list = qry.getResultList(); + if (!list.isEmpty()) { + for (Object oj : list) { + Map mapResp = new HashMap(); + Object[] obj = (Object[]) oj; + mapResp.put("pk_changedate", obj[0]); + mapResp.put("pk_tablename", obj[1]); + mapResp.put("pk_realdate", obj[2]); + mapResp.put("terminalcode", obj[3]); + mapResp.put("usercode", obj[4]); + mapResp.put("isinsert", ((String.valueOf(obj[5]).compareTo("Y") == 0) ? "INSERT" : "DELETE")); + mapResp.put("account", obj[6]); + mapResp.put("solicitudenumber", obj[7]); + mapResp.put("personcode", obj[8]); + mapResp.put("name", obj[9]); + mapResp.put("officedesc", obj[10]); + mapResp.put("branchdesc", obj[11]); + mapResp.put("transactiondesc", "(" + String.valueOf(obj[12]) + "-" + String.valueOf(obj[13]) + ") " + String.valueOf(obj[15])); + mapResp.put("recvalue", this.recValueAudit(obj[0], obj[1], obj[16], obj[2])); + listResp.add(mapResp); + } + } + pQueryRequest.getResponse().put("TSAFEAUDITINSDEL", listResp); + return pQueryRequest; + } + + /** + * Metodo que agrega los parametros de una consulta sql + * + * @param sql Creado + * @param lcriteria Criterios de consulta + * @return String del jpql + */ + private static String addSimpleCriteria(StringBuilder sql, List lcriteria, QueryBean qb) { + for (QueryCriteria obj : lcriteria) { + if (obj.getValue() != null) { + if (obj.getProperty().compareTo("enddate") == 0) { + sql.append(" and ").append(obj.getOperation()).append(":").append(obj.getProperty()); + } else { + sql.append(" and ").append(obj.getProperty()).append(" ").append(obj.getOperation()).append(" :").append(obj.getProperty().replace(".", "")); + } + } + } + boolean first = true; + for (QueryCriteria order : qb.getOrder(true)) { + if (first) { + sql.append(" ORDER BY "); + } else { + sql.append(" asc, "); + } + sql.append(order.getProperty()); + first = false; + } + return String.valueOf(sql); + } + + /** + * Metodo que setea los parametros para la consulta + * + * @param qry Query + * @param lcriteria Criterios de consluta + * @throws Exception + */ + private static void setSimpleParameters(Query qry, List lcriteria) throws Exception { + for (QueryCriteria obj : lcriteria) { + if (obj.getValue() != null) { + if (obj.getProperty().replace(".", "").compareTo("tpkchangedate") == 0 || obj.getProperty().compareTo("enddate") == 0) { + APPDates date = new APPDates(obj.getValue().toString()); + qry.setParameter(obj.getProperty().replace(".", ""), date.getDate()); + } else if ((obj.getProperty().replace(".", "").compareTo("ttransactioncode") == 0) || (obj.getProperty().replace(".", "").compareTo("tpersoncode") == 0)) { + qry.setParameter(obj.getProperty().replace(".", ""), Integer.valueOf(obj.getValue().toString())); + } else { + qry.setParameter(obj.getProperty().replace(".", ""), obj.getValue()); + } + } + } + } + + /** + * Metodo que consulta el atributo recvalue del objeto TsafeAuditInsDel + * + * @param changedate + * @param tablename + * @param partitiondb + * @param realdate + * @return recvalue + * @throws Exception + */ + private String recValueAudit(Object changedate, Object tablename, Object partitiondb, Object realdate) throws Exception { + String recvalue = ""; + Date change = (Date) changedate; + Timestamp real = (Timestamp) realdate; + String table = (String) tablename; + String partition = (String) partitiondb; + TsafeAuditInsDel tsafeAuditInsDel = TsafeAuditInsDel.find(PersistenceHelper.getEntityManager(), + new TsafeAuditInsDelKey(change, table, partition, real)); + if (tsafeAuditInsDel != null) { + recvalue = tsafeAuditInsDel.getRecvalue().substring(0, 110); + } else { + recvalue = ""; + } + return recvalue; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/query/CompleteAudit.java b/base/business/general/src/main/java/com/fp/general/security/rules/query/CompleteAudit.java new file mode 100644 index 0000000..5be8beb --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/query/CompleteAudit.java @@ -0,0 +1,92 @@ +package com.fp.general.security.rules.query; + +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; +import com.fp.persistence.pgeneral.acco.TgeneAccount; +import com.fp.persistence.pgeneral.acco.TgeneAccountKey; +import com.fp.persistence.pgeneral.gene.TgeneSolicitude; +import com.fp.persistence.pgeneral.gene.TgeneSolicitudeKey; +import com.fp.persistence.pgeneral.safe.TsafeAudit; +import com.fp.persistence.pgeneral.safe.TsafeAuditInsDel; +import java.util.List; + +/** + * Clase que se encarga de completar datos como el nombre de cliente o nobre de + * cuanta o prestamo + * + * @author scastillo + */ +public class CompleteAudit extends QueryRule { + + private static final String name = "name"; + + /** + * Metodo que se encarga de completar datos como el nombre de cliente nombre + * de prestamo o cuenta + * + * @param qr + * @return + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest qr) throws Exception { + Response response = qr.getResponse(); + Query query = new Query(); + query.process(qr); + List lTsafeAudit = (List) response.get("TSAFEAUDIT"); + if (lTsafeAudit != null) { + for (Object obj : lTsafeAudit) { + TsafeAudit tsafeAudit = (TsafeAudit) obj; + if (tsafeAudit.getPersoncode() != null) { + TcustPersonDetailKey tcustPersonDetailKey = + new TcustPersonDetailKey( + tsafeAudit.getPersoncode(), + FormatDates.getDefaultExpiryTimestamp()); + TcustPersonDetail tcustPersonDetail = TcustPersonDetail.find( + PersistenceHelper.getEntityManager(), + tcustPersonDetailKey); + if (tcustPersonDetail != null) { + tsafeAudit.addAddtionalInfo(name, + tcustPersonDetail.getName()); + } else { + tsafeAudit.addAddtionalInfo(name, null); + } + } else if (tsafeAudit.getSolicitudenumber() != null) { + TgeneSolicitudeKey tgeneSolicitudeKey = + new TgeneSolicitudeKey(); + TgeneSolicitude tgeneSolicitude = TgeneSolicitude.find( + PersistenceHelper.getEntityManager(), + tgeneSolicitudeKey); + if (tgeneSolicitude != null) { + tsafeAudit.addAddtionalInfo(name, + tgeneSolicitude.getAccountname()); + } else { + tsafeAudit.addAddtionalInfo(name, null); + } + } else if (tsafeAudit.getAccount() != null) { + TgeneAccountKey tgeneAccountKey = new TgeneAccountKey( + tsafeAudit.getAccount(), qr.getCompany(), + FormatDates.getDefaultExpiryTimestamp()); + TgeneAccount tgeneAccount = TgeneAccount.find( + PersistenceHelper.getEntityManager(), + tgeneAccountKey); + if (tgeneAccount != null) { + tsafeAudit.addAddtionalInfo(name, + tgeneAccount.getAccountname()); + } else { + tsafeAudit.addAddtionalInfo(name, null); + } + } else { + tsafeAudit.addAddtionalInfo(name, null); + } + } + } + return qr; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/query/QueryAudit.java b/base/business/general/src/main/java/com/fp/general/security/rules/query/QueryAudit.java new file mode 100644 index 0000000..6a2d018 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/query/QueryAudit.java @@ -0,0 +1,165 @@ +package com.fp.general.security.rules.query; + +import java.sql.Date; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.GeneralQuery; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.APPDates; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.safe.TsafeAuditInsDel; +import com.fp.persistence.pgeneral.safe.TsafeAuditInsDelKey; + +/** + * Clase que consulta los datos de la tabla TSAFEAUDITINSDEL + * + * @author BPTWPA + * + */ +public class QueryAudit extends QueryRule { + + private static final long serialVersionUID = 1L; + //SQL nativo para realizar la consulta + private static final String SQL_AUDIT = "select t.changedate, t.tablename, t.realdate, t.terminalcode, " + + "t.usercode, t.isinsert, t.account, t.solicitudenumber, t.personcode, " + + "(select p.name from tcustpersondetail p where p.personcode=t.personcode " + + "and p.dateto = :datetoperson) as name, " + + "(select o.description from tgeneoffice o where o.officecode=t.officecode " + + "and o.branchcode=t.branchcode and o.companycode=t.companycode) as officedesc, " + + "(select b.description from tgenebranch b where b.branchcode=t.branchcode and " + + "b.companycode=t.companycode) as branchdesc, " + + "t.transactionmodule, t.transactioncode, t.transactionversion, " + + "(select r.name from tgenetransaction r where r.transactionmodule=t.transactionmodule " + + "and r.transactioncode=t.transactioncode and r.transactionversion=t.transactionversion) as transactiondesc " + + ", t.partitiondb " + + "from TSAFEAUDITINSDEL t " + + "where t.changedate=t.changedate "; + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + StringBuilder sql = new StringBuilder(); + List listResp = new ArrayList(); + QueryBean qb = (QueryBean) pQueryRequest.get("TSAFEAUDITINSDEL"); + List lcriteria = qb.getCriteria(); + sql.append(QueryAudit.SQL_AUDIT); + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(QueryAudit.addSimpleCriteria(sql, lcriteria, qb)); + QueryAudit.setSimpleParameters(qry, qb.getCriteria()); + qry.setParameter("datetoperson", FormatDates.getDefaultExpiryTimestamp()); + qry.setFirstResult((qb.getPage() - 1) * qb.getPageSize()); + qry.setMaxResults(qb.getPageSize()); + @SuppressWarnings("unchecked") + List list = qry.getResultList(); + if (!list.isEmpty()) { + for (Object oj : list) { + Map mapResp = new HashMap(); + Object[] obj = (Object[]) oj; + mapResp.put("pk_changedate", obj[0]); + mapResp.put("pk_tablename", obj[1]); + mapResp.put("pk_realdate", obj[2]); + mapResp.put("terminalcode", obj[3]); + mapResp.put("usercode", obj[4]); + mapResp.put("isinsert", ((String.valueOf(obj[5]).compareTo("Y") == 0) ? "INSERT" : "DELETE")); + mapResp.put("account", obj[6]); + mapResp.put("solicitudenumber", obj[7]); + mapResp.put("personcode", obj[8]); + mapResp.put("name", obj[9]); + mapResp.put("officedesc", obj[10]); + mapResp.put("branchdesc", obj[11]); + mapResp.put("transactiondesc", "(" + String.valueOf(obj[12]) + "-" + String.valueOf(obj[13]) + ") " + String.valueOf(obj[15])); + mapResp.put("recvalue", this.recValueAudit(obj[0], obj[1], obj[16], obj[2])); + listResp.add(mapResp); + } + } + pQueryRequest.getResponse().put("TSAFEAUDITINSDEL", listResp); + return pQueryRequest; + } + + /** + * Metodo que agrega los parametros de una consulta sql + * + * @param sql Creado + * @param lcriteria Criterios de consulta + * @return String del jpql + */ + private static String addSimpleCriteria(StringBuilder sql, List lcriteria, QueryBean qb) { + for (QueryCriteria obj : lcriteria) { + if (obj.getValue() != null) { + if (obj.getProperty().compareTo("enddate") == 0) { + sql.append(" and ").append(obj.getOperation()).append(":").append(obj.getProperty()); + } else { + sql.append(" and ").append(obj.getProperty()).append(" ").append(obj.getOperation()).append(" :").append(obj.getProperty().replace(".", "")); + } + } + } + boolean first = true; + for (QueryCriteria order : qb.getOrder(true)) { + if (first) { + sql.append(" ORDER BY "); + } else { + sql.append(" asc, "); + } + sql.append(order.getProperty()); + first = false; + } + return String.valueOf(sql); + } + + /** + * Metodo que setea los parametros para la consulta + * + * @param qry Query + * @param lcriteria Criterios de consluta + * @throws Exception + */ + private static void setSimpleParameters(Query qry, List lcriteria) throws Exception { + for (QueryCriteria obj : lcriteria) { + if (obj.getValue() != null) { + if (obj.getProperty().replace(".", "").compareTo("tpkchangedate") == 0 || obj.getProperty().compareTo("enddate") == 0) { + APPDates date = new APPDates(obj.getValue().toString()); + qry.setParameter(obj.getProperty().replace(".", ""), date.getDate()); + } else if ((obj.getProperty().replace(".", "").compareTo("ttransactioncode") == 0) || (obj.getProperty().replace(".", "").compareTo("tpersoncode") == 0)) { + qry.setParameter(obj.getProperty().replace(".", ""), Integer.valueOf(obj.getValue().toString())); + } else { + qry.setParameter(obj.getProperty().replace(".", ""), obj.getValue()); + } + } + } + } + + /** + * Metodo que consulta el atributo recvalue del objeto TsafeAuditInsDel + * + * @param changedate + * @param tablename + * @param partitiondb + * @param realdate + * @return recvalue + * @throws Exception + */ + private String recValueAudit(Object changedate, Object tablename, Object partitiondb, Object realdate) throws Exception { + String recvalue = ""; + Date change = (Date) changedate; + Timestamp real = (Timestamp) realdate; + String table = (String) tablename; + String partition = (String) partitiondb; + TsafeAuditInsDel tsafeAuditInsDel = TsafeAuditInsDel.find(PersistenceHelper.getEntityManager(), + new TsafeAuditInsDelKey(change, table, partition, real)); + if (tsafeAuditInsDel != null) { + recvalue = tsafeAuditInsDel.getRecvalue().substring(0, 110); + } else { + recvalue = ""; + } + return recvalue; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/query/code/.svn/entries b/base/business/general/src/main/java/com/fp/general/security/rules/query/code/.svn/entries new file mode 100644 index 0000000..95a7436 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/query/code/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/security/rules/query/code +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +SearchUser.java +file + + + + +2022-07-28T03:40:43.429806Z +8aa673cc2125dfeb4a28e1c3e51c2bca +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1964 + +TransactionSearch.java +file + + + + +2022-07-28T03:40:43.429806Z +03cc001dcfb0e2fa7b156c0ce8045a4f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3683 + diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/query/code/.svn/text-base/SearchUser.java.svn-base b/base/business/general/src/main/java/com/fp/general/security/rules/query/code/.svn/text-base/SearchUser.java.svn-base new file mode 100644 index 0000000..437110b --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/query/code/.svn/text-base/SearchUser.java.svn-base @@ -0,0 +1,57 @@ +package com.fp.general.security.rules.query.code; + +import java.util.List; + +import com.fp.bpm.query.Query; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +/** + * + * @author scastillo + */ +public class SearchUser extends QueryRule { + + /** + * Metodo que ejecuta la consulta dado el nombre del cliente + * + * @param pQueryRequest + * @return + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + if (pQueryRequest.isJsf()) { + this.searchjsf(pQueryRequest); + return pQueryRequest; + } + QueryBean queryBean = (QueryBean) pQueryRequest.get("TSAFEUSERDETAILLOV"); + List criterios = queryBean.getCriteria(); + for (int i = 0; i < criterios.size(); i++) { + QueryCriteria queryCriteria = criterios.get(i); + String propiedad = queryCriteria.getProperty(); + if ((propiedad.compareTo("pk.personcode") == 0) && (queryCriteria.getValue() != null)) { + String operador = "="; + queryCriteria.setOperation("in"); + String valor = (String) queryCriteria.getValue(); + if (valor.indexOf("%") >= 0) { + operador = "like"; + } + queryCriteria + .setValue("select s.pk.personcode from com.fp.persistence.pcustomer.gene.TcustPersonDetail s where s.pk.dateto=t.pk.dateto and s.name " + + operador + " '" + valor + "'"); + } + } + Query query = new Query(); + query.process(pQueryRequest); + return pQueryRequest; + } + + private void searchjsf(QueryRequest pQueryRequest) throws Exception { + DtoQuery dto = pQueryRequest.getQueryTables().get("USERLOV"); + + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/query/code/.svn/text-base/TransactionSearch.java.svn-base b/base/business/general/src/main/java/com/fp/general/security/rules/query/code/.svn/text-base/TransactionSearch.java.svn-base new file mode 100644 index 0000000..4510038 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/query/code/.svn/text-base/TransactionSearch.java.svn-base @@ -0,0 +1,86 @@ +package com.fp.general.security.rules.query.code; + +import com.fp.common.helper.Constant; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; +import com.fp.persistence.pgeneral.trans.TgeneTransactionKey; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import org.hibernate.SQLQuery; + +/** + * Clase que se encarga de devolver los datos de transacció + * + * @author scastillo + */ +public class TransactionSearch extends QueryRule { + + private final String lbl = "transaction"; + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + String label = (String) pQueryRequest.get("label"); + TgeneTransactionKey tgeneTransactionKey = new TgeneTransactionKey(pQueryRequest.getTransactionModule(), + pQueryRequest.getTransactionCode(), pQueryRequest.getTransactionVersion()); + TgeneTransaction tgeneTransaction = TgeneTransaction.find(PersistenceHelper.getEntityManager(), tgeneTransactionKey); + Map m = null; + if (tgeneTransaction != null) { + m = new HashMap(); + m.put("t", tgeneTransaction.getName()); + m.put("p", tgeneTransaction.getPage()); + m.put("a", tgeneTransaction.getAutoquery()); + m.put("m", tgeneTransaction.getPk().getTransactionmodule()); + m.put("tr", tgeneTransaction.getPk().getTransactioncode()); + m.put("v", tgeneTransaction.getPk().getTransactionversion()); + m.put("f", tgeneTransaction.getSignature()); + m.put("qa", tgeneTransaction.getQueryagain()); + m.put("sg", this.existGlosary(pQueryRequest.getTransactionModule(), pQueryRequest.getTransactionCode(), + pQueryRequest.getTransactionVersion(), pQueryRequest.getLanguage())); + } + pQueryRequest.getResponse().put(lbl, m); + return pQueryRequest; + } + /** + * Sentencia para saber si existe un glosaio disponible para la transaccion + */ + private static final String HQL = "SELECT count(*) FROM TGENETRANSACTIONGLOSARY" + + " where TRANSACTIONMODULE = :transactionmodule" + + " and TRANSACTIONCODE = :transactioncode" + + " and TRANSACTIONVERSION = :transactionversion" + + " and LANGUAGECODE= :languagecode"; + + /** + * Metodo que devuelve Y o N si existe glosario en una transaccion + * + * @param module Modulo de la transaccion + * @param transaction Codigo de transaccion + * @param version Version de la transaccion + * @param languagecode Lenguaje a utilizar + * @return + * @throws Exception + */ + private String existGlosary(String module, Integer transaction, Integer version, String languagecode) throws Exception { + SQLQuery qry = PersistenceHelper.getSession().createSQLQuery(HQL); + qry.setString("transactionmodule", module); + qry.setInteger("transactioncode", transaction); + qry.setInteger("transactionversion", version); + qry.setString("languagecode", languagecode); + Object result = qry.uniqueResult(); + String returnValue = "N"; + if (result instanceof Integer) { + Integer numero = (Integer) result; + if (numero > 0) { + returnValue = "Y"; + } + } else if (result instanceof BigDecimal) { + Integer numero = ((BigDecimal) result).intValue(); + if (numero > 0) { + returnValue = "Y"; + } + } + return returnValue; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/query/code/SearchUser.java b/base/business/general/src/main/java/com/fp/general/security/rules/query/code/SearchUser.java new file mode 100644 index 0000000..437110b --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/query/code/SearchUser.java @@ -0,0 +1,57 @@ +package com.fp.general.security.rules.query.code; + +import java.util.List; + +import com.fp.bpm.query.Query; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +/** + * + * @author scastillo + */ +public class SearchUser extends QueryRule { + + /** + * Metodo que ejecuta la consulta dado el nombre del cliente + * + * @param pQueryRequest + * @return + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + if (pQueryRequest.isJsf()) { + this.searchjsf(pQueryRequest); + return pQueryRequest; + } + QueryBean queryBean = (QueryBean) pQueryRequest.get("TSAFEUSERDETAILLOV"); + List criterios = queryBean.getCriteria(); + for (int i = 0; i < criterios.size(); i++) { + QueryCriteria queryCriteria = criterios.get(i); + String propiedad = queryCriteria.getProperty(); + if ((propiedad.compareTo("pk.personcode") == 0) && (queryCriteria.getValue() != null)) { + String operador = "="; + queryCriteria.setOperation("in"); + String valor = (String) queryCriteria.getValue(); + if (valor.indexOf("%") >= 0) { + operador = "like"; + } + queryCriteria + .setValue("select s.pk.personcode from com.fp.persistence.pcustomer.gene.TcustPersonDetail s where s.pk.dateto=t.pk.dateto and s.name " + + operador + " '" + valor + "'"); + } + } + Query query = new Query(); + query.process(pQueryRequest); + return pQueryRequest; + } + + private void searchjsf(QueryRequest pQueryRequest) throws Exception { + DtoQuery dto = pQueryRequest.getQueryTables().get("USERLOV"); + + } +} diff --git a/base/business/general/src/main/java/com/fp/general/security/rules/query/code/TransactionSearch.java b/base/business/general/src/main/java/com/fp/general/security/rules/query/code/TransactionSearch.java new file mode 100644 index 0000000..4510038 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/security/rules/query/code/TransactionSearch.java @@ -0,0 +1,86 @@ +package com.fp.general.security.rules.query.code; + +import com.fp.common.helper.Constant; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; +import com.fp.persistence.pgeneral.trans.TgeneTransactionKey; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import org.hibernate.SQLQuery; + +/** + * Clase que se encarga de devolver los datos de transacció + * + * @author scastillo + */ +public class TransactionSearch extends QueryRule { + + private final String lbl = "transaction"; + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + String label = (String) pQueryRequest.get("label"); + TgeneTransactionKey tgeneTransactionKey = new TgeneTransactionKey(pQueryRequest.getTransactionModule(), + pQueryRequest.getTransactionCode(), pQueryRequest.getTransactionVersion()); + TgeneTransaction tgeneTransaction = TgeneTransaction.find(PersistenceHelper.getEntityManager(), tgeneTransactionKey); + Map m = null; + if (tgeneTransaction != null) { + m = new HashMap(); + m.put("t", tgeneTransaction.getName()); + m.put("p", tgeneTransaction.getPage()); + m.put("a", tgeneTransaction.getAutoquery()); + m.put("m", tgeneTransaction.getPk().getTransactionmodule()); + m.put("tr", tgeneTransaction.getPk().getTransactioncode()); + m.put("v", tgeneTransaction.getPk().getTransactionversion()); + m.put("f", tgeneTransaction.getSignature()); + m.put("qa", tgeneTransaction.getQueryagain()); + m.put("sg", this.existGlosary(pQueryRequest.getTransactionModule(), pQueryRequest.getTransactionCode(), + pQueryRequest.getTransactionVersion(), pQueryRequest.getLanguage())); + } + pQueryRequest.getResponse().put(lbl, m); + return pQueryRequest; + } + /** + * Sentencia para saber si existe un glosaio disponible para la transaccion + */ + private static final String HQL = "SELECT count(*) FROM TGENETRANSACTIONGLOSARY" + + " where TRANSACTIONMODULE = :transactionmodule" + + " and TRANSACTIONCODE = :transactioncode" + + " and TRANSACTIONVERSION = :transactionversion" + + " and LANGUAGECODE= :languagecode"; + + /** + * Metodo que devuelve Y o N si existe glosario en una transaccion + * + * @param module Modulo de la transaccion + * @param transaction Codigo de transaccion + * @param version Version de la transaccion + * @param languagecode Lenguaje a utilizar + * @return + * @throws Exception + */ + private String existGlosary(String module, Integer transaction, Integer version, String languagecode) throws Exception { + SQLQuery qry = PersistenceHelper.getSession().createSQLQuery(HQL); + qry.setString("transactionmodule", module); + qry.setInteger("transactioncode", transaction); + qry.setInteger("transactionversion", version); + qry.setString("languagecode", languagecode); + Object result = qry.uniqueResult(); + String returnValue = "N"; + if (result instanceof Integer) { + Integer numero = (Integer) result; + if (numero > 0) { + returnValue = "Y"; + } + } else if (result instanceof BigDecimal) { + Integer numero = ((BigDecimal) result).intValue(); + if (numero > 0) { + returnValue = "Y"; + } + } + return returnValue; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/templates/.svn/entries b/base/business/general/src/main/java/com/fp/general/templates/.svn/entries new file mode 100644 index 0000000..d155239 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/templates/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/templates +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +query +dir + +save +dir + diff --git a/base/business/general/src/main/java/com/fp/general/templates/query/.svn/entries b/base/business/general/src/main/java/com/fp/general/templates/query/.svn/entries new file mode 100644 index 0000000..73fe1a3 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/templates/query/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/templates/query +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +QueryTemplatesDesc.java +file + + + + +2022-07-28T03:40:44.348810Z +fb6d9dc26e666e86810ede8e492ac72e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3845 + +QueryTemplates.java +file + + + + +2022-07-28T03:40:44.348810Z +afb08e4f1e97b3d1723b77fb8e8050ad +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1143 + diff --git a/base/business/general/src/main/java/com/fp/general/templates/query/.svn/text-base/QueryTemplates.java.svn-base b/base/business/general/src/main/java/com/fp/general/templates/query/.svn/text-base/QueryTemplates.java.svn-base new file mode 100644 index 0000000..fc5cb87 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/templates/query/.svn/text-base/QueryTemplates.java.svn-base @@ -0,0 +1,29 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.general.templates.query; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDesc; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDescKey; + +/** + * + * @author BPTWPA + */ +public class QueryTemplates extends QueryRule{ + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Integer code = Integer.valueOf(pQueryRequest.getString("code")); + String languaje=pQueryRequest.getString("languaje"); + TgeneMessageTemplatesDesc templates = TgeneMessageTemplatesDesc.find(PersistenceHelper.getEntityManager(), + (new TgeneMessageTemplatesDescKey(code, languaje))); + pQueryRequest.getResponse().put("description", (templates==null)?"":templates.getDescription()); + pQueryRequest.getResponse().put("template", (templates==null)?"":templates.getTemplate()); + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/templates/query/.svn/text-base/QueryTemplatesDesc.java.svn-base b/base/business/general/src/main/java/com/fp/general/templates/query/.svn/text-base/QueryTemplatesDesc.java.svn-base new file mode 100644 index 0000000..c069ecb --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/templates/query/.svn/text-base/QueryTemplatesDesc.java.svn-base @@ -0,0 +1,97 @@ +package com.fp.general.templates.query; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; + +/** + *Clase para presentar las plantillas ingresadas + * @author BPTWPA + */ +public class QueryTemplatesDesc extends QueryRule { + + private static final long serialVersionUID = 1L; + private static final String JPQL_TEMPLATES = "select d.pk.code, t.description, d.pk.languagecode, d.description " + + "from TgeneMessageTemplatesDesc d, TgeneMessageTemplates t " + + "where d.pk.code=t.pk "; + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + StringBuilder jpql = new StringBuilder(); + List> listResp = new ArrayList>(); + Response response = pQueryRequest.getResponse(); + QueryBean qb = (QueryBean) pQueryRequest.get("TGENEMESSAGETEMPLATEDESC"); + List lcriteria = qb.getCriteria(); + EntityManager em = PersistenceHelper.getEntityManager(); + jpql.append(QueryTemplatesDesc.JPQL_TEMPLATES); + Query qry = em.createQuery(QueryTemplatesDesc.addSimpleCriteriaJPQL(jpql, lcriteria, qb)); + QueryTemplatesDesc.setSimpleParametersJPQL(qry, lcriteria); + qry.setFirstResult((qb.getPage() - 1) * qb.getPageSize()); + qry.setMaxResults(qb.getPageSize()); + @SuppressWarnings("unchecked") + List list = qry.getResultList(); + if (!list.isEmpty()) { + for (Object oj : list) { + Map mapResp = new HashMap(); + Object[] obj = (Object[]) oj; + mapResp.put("pk_code", obj[0]); + mapResp.put("descmessage", obj[1]); + mapResp.put("pk_languagecode", obj[2]); + mapResp.put("description", obj[3]); + mapResp.put("template", null); + listResp.add(mapResp); + } + } + response.put("TGENEMESSAGETEMPLATEDESC", listResp); + return pQueryRequest; + } + + /** + * Metodo que agrega los parametros de una consulta jpql + * @param jpql Creado + * @param lcriteria Criterios de consulta + * @return String del jpql + */ + public static String addSimpleCriteriaJPQL(StringBuilder jpql, List lcriteria, QueryBean qb) { + for (QueryCriteria obj : lcriteria) { + if (obj.getValue() != null) { + jpql.append(" and ").append(obj.getProperty()).append(" ").append(obj.getOperation()).append(" :").append(obj.getProperty().replace(".", "")); + } + } + boolean first = true; + for (QueryCriteria order : qb.getOrder(true)) { + if (first) { + jpql.append(" ORDER BY "); + } else { + jpql.append(" asc, "); + } + jpql.append(order.getProperty()); + first = false; + } + return String.valueOf(jpql); + } + + /** + * Metodo que setea los parametros para la consulta + * @param qry Query + * @param lcriteria Criterios de consluta + */ + public static void setSimpleParametersJPQL(Query qry, List lcriteria) { + for (QueryCriteria obj : lcriteria) { + if (obj.getValue() != null) { + qry.setParameter(obj.getProperty().replace(".", ""), ((obj.getProperty().replace(".", "").compareTo("dpkcode") == 0) ? Integer.valueOf(obj.getValue().toString()) : obj.getValue())); + } + } + } +} \ No newline at end of file diff --git a/base/business/general/src/main/java/com/fp/general/templates/query/QueryTemplates.java b/base/business/general/src/main/java/com/fp/general/templates/query/QueryTemplates.java new file mode 100644 index 0000000..fc5cb87 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/templates/query/QueryTemplates.java @@ -0,0 +1,29 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.general.templates.query; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDesc; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDescKey; + +/** + * + * @author BPTWPA + */ +public class QueryTemplates extends QueryRule{ + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Integer code = Integer.valueOf(pQueryRequest.getString("code")); + String languaje=pQueryRequest.getString("languaje"); + TgeneMessageTemplatesDesc templates = TgeneMessageTemplatesDesc.find(PersistenceHelper.getEntityManager(), + (new TgeneMessageTemplatesDescKey(code, languaje))); + pQueryRequest.getResponse().put("description", (templates==null)?"":templates.getDescription()); + pQueryRequest.getResponse().put("template", (templates==null)?"":templates.getTemplate()); + return pQueryRequest; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/templates/query/QueryTemplatesDesc.java b/base/business/general/src/main/java/com/fp/general/templates/query/QueryTemplatesDesc.java new file mode 100644 index 0000000..c069ecb --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/templates/query/QueryTemplatesDesc.java @@ -0,0 +1,97 @@ +package com.fp.general.templates.query; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; + +/** + *Clase para presentar las plantillas ingresadas + * @author BPTWPA + */ +public class QueryTemplatesDesc extends QueryRule { + + private static final long serialVersionUID = 1L; + private static final String JPQL_TEMPLATES = "select d.pk.code, t.description, d.pk.languagecode, d.description " + + "from TgeneMessageTemplatesDesc d, TgeneMessageTemplates t " + + "where d.pk.code=t.pk "; + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + StringBuilder jpql = new StringBuilder(); + List> listResp = new ArrayList>(); + Response response = pQueryRequest.getResponse(); + QueryBean qb = (QueryBean) pQueryRequest.get("TGENEMESSAGETEMPLATEDESC"); + List lcriteria = qb.getCriteria(); + EntityManager em = PersistenceHelper.getEntityManager(); + jpql.append(QueryTemplatesDesc.JPQL_TEMPLATES); + Query qry = em.createQuery(QueryTemplatesDesc.addSimpleCriteriaJPQL(jpql, lcriteria, qb)); + QueryTemplatesDesc.setSimpleParametersJPQL(qry, lcriteria); + qry.setFirstResult((qb.getPage() - 1) * qb.getPageSize()); + qry.setMaxResults(qb.getPageSize()); + @SuppressWarnings("unchecked") + List list = qry.getResultList(); + if (!list.isEmpty()) { + for (Object oj : list) { + Map mapResp = new HashMap(); + Object[] obj = (Object[]) oj; + mapResp.put("pk_code", obj[0]); + mapResp.put("descmessage", obj[1]); + mapResp.put("pk_languagecode", obj[2]); + mapResp.put("description", obj[3]); + mapResp.put("template", null); + listResp.add(mapResp); + } + } + response.put("TGENEMESSAGETEMPLATEDESC", listResp); + return pQueryRequest; + } + + /** + * Metodo que agrega los parametros de una consulta jpql + * @param jpql Creado + * @param lcriteria Criterios de consulta + * @return String del jpql + */ + public static String addSimpleCriteriaJPQL(StringBuilder jpql, List lcriteria, QueryBean qb) { + for (QueryCriteria obj : lcriteria) { + if (obj.getValue() != null) { + jpql.append(" and ").append(obj.getProperty()).append(" ").append(obj.getOperation()).append(" :").append(obj.getProperty().replace(".", "")); + } + } + boolean first = true; + for (QueryCriteria order : qb.getOrder(true)) { + if (first) { + jpql.append(" ORDER BY "); + } else { + jpql.append(" asc, "); + } + jpql.append(order.getProperty()); + first = false; + } + return String.valueOf(jpql); + } + + /** + * Metodo que setea los parametros para la consulta + * @param qry Query + * @param lcriteria Criterios de consluta + */ + public static void setSimpleParametersJPQL(Query qry, List lcriteria) { + for (QueryCriteria obj : lcriteria) { + if (obj.getValue() != null) { + qry.setParameter(obj.getProperty().replace(".", ""), ((obj.getProperty().replace(".", "").compareTo("dpkcode") == 0) ? Integer.valueOf(obj.getValue().toString()) : obj.getValue())); + } + } + } +} \ No newline at end of file diff --git a/base/business/general/src/main/java/com/fp/general/templates/save/.svn/entries b/base/business/general/src/main/java/com/fp/general/templates/save/.svn/entries new file mode 100644 index 0000000..bd2b80b --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/templates/save/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/java/com/fp/general/templates/save +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +SaveTemplatesDesc.java +file + + + + +2022-07-28T03:40:44.395810Z +6bac5c7566a53c4c3c9f18cc6abf4f60 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2854 + diff --git a/base/business/general/src/main/java/com/fp/general/templates/save/.svn/text-base/SaveTemplatesDesc.java.svn-base b/base/business/general/src/main/java/com/fp/general/templates/save/.svn/text-base/SaveTemplatesDesc.java.svn-base new file mode 100644 index 0000000..2e84788 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/templates/save/.svn/text-base/SaveTemplatesDesc.java.svn-base @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.general.templates.save; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDesc; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDescKey; +import java.util.List; + +/** + * + * @author BPTWPA + */ +public class SaveTemplatesDesc extends TransactionRule { + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if(pSaveRequest.isJsf()){ + return pSaveRequest; + } + Integer code = pSaveRequest.getInteger("code"); + String languaje =pSaveRequest.getString("languaje"); + String description=pSaveRequest.getString("description"); + String template=pSaveRequest.getString("template"); + String remove=pSaveRequest.getString("remove"); + + TgeneMessageTemplatesDesc templatesDesc=TgeneMessageTemplatesDesc.find( + PersistenceHelper.getEntityManager(), new TgeneMessageTemplatesDescKey(code, languaje)); + if(remove!=null && remove.compareTo("remove")==0){ + PersistenceHelper.delete(templatesDesc); + }else{ + if(templatesDesc!=null){ + templatesDesc.setDescription(description); + templatesDesc.setTemplate(this.replaceCharacter(template)); + PersistenceHelper.update(templatesDesc); + }else{ + TgeneMessageTemplatesDesc templates= new TgeneMessageTemplatesDesc(); + templates.setPk(new TgeneMessageTemplatesDescKey(code, languaje)); + templates.setDescription(description); + templates.setTemplate(template); + PersistenceHelper.save(templates); + } + } + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + private String replaceCharacter(String content){ + content = content.replaceAll("","Ñ"); + content = content.replaceAll("","ñ"); + content = content.replaceAll("","Á"); + content = content.replaceAll("","É"); + content = content.replaceAll("","Í"); + content = content.replaceAll("","Ó"); + content = content.replaceAll("","Ú"); + content = content.replaceAll("","á"); + content = content.replaceAll("","é"); + content = content.replaceAll("","í"); + content = content.replaceAll("","ó"); + content = content.replaceAll("","ú"); + return content; + } +} diff --git a/base/business/general/src/main/java/com/fp/general/templates/save/SaveTemplatesDesc.java b/base/business/general/src/main/java/com/fp/general/templates/save/SaveTemplatesDesc.java new file mode 100644 index 0000000..2e84788 --- /dev/null +++ b/base/business/general/src/main/java/com/fp/general/templates/save/SaveTemplatesDesc.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.general.templates.save; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDesc; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDescKey; +import java.util.List; + +/** + * + * @author BPTWPA + */ +public class SaveTemplatesDesc extends TransactionRule { + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if(pSaveRequest.isJsf()){ + return pSaveRequest; + } + Integer code = pSaveRequest.getInteger("code"); + String languaje =pSaveRequest.getString("languaje"); + String description=pSaveRequest.getString("description"); + String template=pSaveRequest.getString("template"); + String remove=pSaveRequest.getString("remove"); + + TgeneMessageTemplatesDesc templatesDesc=TgeneMessageTemplatesDesc.find( + PersistenceHelper.getEntityManager(), new TgeneMessageTemplatesDescKey(code, languaje)); + if(remove!=null && remove.compareTo("remove")==0){ + PersistenceHelper.delete(templatesDesc); + }else{ + if(templatesDesc!=null){ + templatesDesc.setDescription(description); + templatesDesc.setTemplate(this.replaceCharacter(template)); + PersistenceHelper.update(templatesDesc); + }else{ + TgeneMessageTemplatesDesc templates= new TgeneMessageTemplatesDesc(); + templates.setPk(new TgeneMessageTemplatesDescKey(code, languaje)); + templates.setDescription(description); + templates.setTemplate(template); + PersistenceHelper.save(templates); + } + } + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + private String replaceCharacter(String content){ + content = content.replaceAll("","Ñ"); + content = content.replaceAll("","ñ"); + content = content.replaceAll("","Á"); + content = content.replaceAll("","É"); + content = content.replaceAll("","Í"); + content = content.replaceAll("","Ó"); + content = content.replaceAll("","Ú"); + content = content.replaceAll("","á"); + content = content.replaceAll("","é"); + content = content.replaceAll("","í"); + content = content.replaceAll("","ó"); + content = content.replaceAll("","ú"); + return content; + } +} diff --git a/base/business/general/src/main/resources/.svn/entries b/base/business/general/src/main/resources/.svn/entries new file mode 100644 index 0000000..08c0516 --- /dev/null +++ b/base/business/general/src/main/resources/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/main/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +generalmessages_es.properties +file + + + + +2022-07-28T03:40:44.603811Z +84f967238e8de816c901cc137e3a0356 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2881 + diff --git a/base/business/general/src/main/resources/.svn/text-base/generalmessages_es.properties.svn-base b/base/business/general/src/main/resources/.svn/text-base/generalmessages_es.properties.svn-base new file mode 100644 index 0000000..b4c6a25 --- /dev/null +++ b/base/business/general/src/main/resources/.svn/text-base/generalmessages_es.properties.svn-base @@ -0,0 +1,43 @@ +GENE-0001=SUCURSAL NO DEFINIDA EN TGENEBRANCH: BRANCH:{0} COMPANY:{1} +GENE-0002=OFICINA NO DEFINIDA EN TGENEOFFICE: OFFICE:{0} BRANCH:{1} COMPANY:{2} +GENE-0003=USUARIO O PASSWORD INCORRECTO +GENE-0004=NIVEL DE MENU NO DEFINIDOS EN TEGNEMENULEVEL +GENE-0005=NIVEL DE MENU NO DEFINIDOS EN TEGNEMENUSUBLEVEL +GENE-0006=SEMILLA DE LA SECUENCIA NO DEFINA EN TGENESEQUENCES, CODIGO: {0} +GENE-0007=EL USUARIO {0} HA SIDO BLOQUEADO POR INGRESO DE CLAVE ERRONEA +GENE-0008=EL NUMERO DE INTENTOS HA SOBREPASADO EL PERMITIDO +GENE-0009=EL USUARIO {0} SE ENCUENTRA TRABAJANDO EN EL TERMINAL {1} +GENE-0010=EL USUARIO {0} SE ENCUENTRA {1} +GENE-0011=EL USUARIO NO EXISTE +GENE-0012=REPORTE NO DEFINIDO PARA EL MODULO: {0}, TRANSACCION: {1}, VERSION {2} +GENE-0013=PATH PARA REPORTES NO DEFINIDO EN LA COMPANIA {0}, PARAMETRO {1} +GENE-0014=PATH PARA SUBREPORTES NO DEFINIDO EN LA COMPANIA {0}, PARAMETRO {1} +GENE-0015=REPORTE {0} NO DISPONIBLE +GENE-0016=SE PRESENTO EL SIGUIENTE ERROR {0} AL GENERAR EL REPORTE +GENE-0017=EL PERFIL {0} NO TIENE ASOCIADO UN MENU +GENE-0018=SUCURSALES NO DEFINIDAS PARA LA COMPANIA: {0} +GENE-0019=EL CALENDARIO NO PUEDE DEJAR HUECOS PARA LA SUCURSAL: {0} FCONTABLE ANTERIOR: {1} +GENE-0020=FECHA DE INICIO PARA GENERAR CALENDARIO NO PUEDE SER MENOR A: {0} +GENE-0021=LA CONTRASEA NO CUMPLE CON LA POLITICA DE SEGURIDAD +GENE-0022=NO PUEDE REPETIR LAS LTIMAS: {0} CONTRASEAS +GENE-0023=CONTRASEA EXPIRADA +GENE-0024=CALENDARIO NO DEFINIDO EN TGENEACCOUNTINGDATE PARA LA FECHA :{0} +GENE-0025=CONTRASEA ANTERIOR INCORRECTA +GENE-0026=LA CONTRASEA DEBE TENER POR LO MENOS {0} LETRAS MINSCULAS +GENE-0027=LA CONTRASEA DEBE TENER POR LO MENOS {0} CARACTERES ESPECIALES +GENE-0028=LA CONTRASEA DEBE TENER POR LO MENOS {0} LETRAS MAYSCULAS +GENE-0029=LA CONTRASEA DEBE TENER POR LO MENOS {0} NMEROS +GENE-0030=LA LONGITUD MNIMA DE LA CONTRASEA DEBE SER DE {0} CARACTERES +GENE-0031=VALOR REQUERIDO PARA EL CAMPO: {0} NMERO DE REGISTRO: {1} +GENE-0032=TIPO DE DATO: {0} PARA EL CAMPO: {1} NO SE PUEDE TRANSFORMAR VALOR: {2} REGISTRO {3} +GENE-0033=OFICIAL DE CUENTA NO DEFINIDO PARA EL PRODUCTO EN TGENEOFFICER +GENE-0034=PARMETROS PARA EJECUTAR TAREAS CALENDARIZADAS NO DEFINIDOS EN TGENSCHEDULEPARAMETERS +GENE-0035=USUARIO: {0} NO DEFINIDO EN TSAFEUSERDETAIL +GENE-0036=NMERO DE CARACTERES DEL SECUENCIAL NO DEFINIDO EN TGENEACCONUMSTRUCTURE MODULO: {0} +GENE-0037=ESTRUCTURA DE SECUENCIAL NO DEFINIDA EN TGENESEQUENTIALMODULE MODULO: {0} +GENE-0038=ESTRUCTURA DE SECUENCIAL NO DEFINIDA EN TGENESEQUESTRUCTDETAIL MODULO: {0} +GENE-0039=ESTRUCTURA DE NMERO DE CUENTA NO DEFINIDA EN TGENEACCONUMSTRUCTURE MDULO: {0} +GENE-0040=EL MONTO MNIMO DEBE SER MAYOR AL MONTO MXIMO +GENE-0041=LOS VALORES PARA EL TIPO DE BALANCE {0} SE SOBREPONEN +GENE-0042=CDIGO DE USUARIO YA EXISTE: {0} +GENE-0043=:EL CRITERIO DE BSQUEDA --> {0} NO ES SUFICIENTE \ No newline at end of file diff --git a/base/business/general/src/main/resources/generalmessages_es.properties b/base/business/general/src/main/resources/generalmessages_es.properties new file mode 100644 index 0000000..b4c6a25 --- /dev/null +++ b/base/business/general/src/main/resources/generalmessages_es.properties @@ -0,0 +1,43 @@ +GENE-0001=SUCURSAL NO DEFINIDA EN TGENEBRANCH: BRANCH:{0} COMPANY:{1} +GENE-0002=OFICINA NO DEFINIDA EN TGENEOFFICE: OFFICE:{0} BRANCH:{1} COMPANY:{2} +GENE-0003=USUARIO O PASSWORD INCORRECTO +GENE-0004=NIVEL DE MENU NO DEFINIDOS EN TEGNEMENULEVEL +GENE-0005=NIVEL DE MENU NO DEFINIDOS EN TEGNEMENUSUBLEVEL +GENE-0006=SEMILLA DE LA SECUENCIA NO DEFINA EN TGENESEQUENCES, CODIGO: {0} +GENE-0007=EL USUARIO {0} HA SIDO BLOQUEADO POR INGRESO DE CLAVE ERRONEA +GENE-0008=EL NUMERO DE INTENTOS HA SOBREPASADO EL PERMITIDO +GENE-0009=EL USUARIO {0} SE ENCUENTRA TRABAJANDO EN EL TERMINAL {1} +GENE-0010=EL USUARIO {0} SE ENCUENTRA {1} +GENE-0011=EL USUARIO NO EXISTE +GENE-0012=REPORTE NO DEFINIDO PARA EL MODULO: {0}, TRANSACCION: {1}, VERSION {2} +GENE-0013=PATH PARA REPORTES NO DEFINIDO EN LA COMPANIA {0}, PARAMETRO {1} +GENE-0014=PATH PARA SUBREPORTES NO DEFINIDO EN LA COMPANIA {0}, PARAMETRO {1} +GENE-0015=REPORTE {0} NO DISPONIBLE +GENE-0016=SE PRESENTO EL SIGUIENTE ERROR {0} AL GENERAR EL REPORTE +GENE-0017=EL PERFIL {0} NO TIENE ASOCIADO UN MENU +GENE-0018=SUCURSALES NO DEFINIDAS PARA LA COMPANIA: {0} +GENE-0019=EL CALENDARIO NO PUEDE DEJAR HUECOS PARA LA SUCURSAL: {0} FCONTABLE ANTERIOR: {1} +GENE-0020=FECHA DE INICIO PARA GENERAR CALENDARIO NO PUEDE SER MENOR A: {0} +GENE-0021=LA CONTRASEA NO CUMPLE CON LA POLITICA DE SEGURIDAD +GENE-0022=NO PUEDE REPETIR LAS LTIMAS: {0} CONTRASEAS +GENE-0023=CONTRASEA EXPIRADA +GENE-0024=CALENDARIO NO DEFINIDO EN TGENEACCOUNTINGDATE PARA LA FECHA :{0} +GENE-0025=CONTRASEA ANTERIOR INCORRECTA +GENE-0026=LA CONTRASEA DEBE TENER POR LO MENOS {0} LETRAS MINSCULAS +GENE-0027=LA CONTRASEA DEBE TENER POR LO MENOS {0} CARACTERES ESPECIALES +GENE-0028=LA CONTRASEA DEBE TENER POR LO MENOS {0} LETRAS MAYSCULAS +GENE-0029=LA CONTRASEA DEBE TENER POR LO MENOS {0} NMEROS +GENE-0030=LA LONGITUD MNIMA DE LA CONTRASEA DEBE SER DE {0} CARACTERES +GENE-0031=VALOR REQUERIDO PARA EL CAMPO: {0} NMERO DE REGISTRO: {1} +GENE-0032=TIPO DE DATO: {0} PARA EL CAMPO: {1} NO SE PUEDE TRANSFORMAR VALOR: {2} REGISTRO {3} +GENE-0033=OFICIAL DE CUENTA NO DEFINIDO PARA EL PRODUCTO EN TGENEOFFICER +GENE-0034=PARMETROS PARA EJECUTAR TAREAS CALENDARIZADAS NO DEFINIDOS EN TGENSCHEDULEPARAMETERS +GENE-0035=USUARIO: {0} NO DEFINIDO EN TSAFEUSERDETAIL +GENE-0036=NMERO DE CARACTERES DEL SECUENCIAL NO DEFINIDO EN TGENEACCONUMSTRUCTURE MODULO: {0} +GENE-0037=ESTRUCTURA DE SECUENCIAL NO DEFINIDA EN TGENESEQUENTIALMODULE MODULO: {0} +GENE-0038=ESTRUCTURA DE SECUENCIAL NO DEFINIDA EN TGENESEQUESTRUCTDETAIL MODULO: {0} +GENE-0039=ESTRUCTURA DE NMERO DE CUENTA NO DEFINIDA EN TGENEACCONUMSTRUCTURE MDULO: {0} +GENE-0040=EL MONTO MNIMO DEBE SER MAYOR AL MONTO MXIMO +GENE-0041=LOS VALORES PARA EL TIPO DE BALANCE {0} SE SOBREPONEN +GENE-0042=CDIGO DE USUARIO YA EXISTE: {0} +GENE-0043=:EL CRITERIO DE BSQUEDA --> {0} NO ES SUFICIENTE \ No newline at end of file diff --git a/base/business/general/src/test/.svn/entries b/base/business/general/src/test/.svn/entries new file mode 100644 index 0000000..7b99b85 --- /dev/null +++ b/base/business/general/src/test/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/business/general/src/test/java/.svn/entries b/base/business/general/src/test/java/.svn/entries new file mode 100644 index 0000000..50b4aa0 --- /dev/null +++ b/base/business/general/src/test/java/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/test/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/business/general/src/test/resources/.svn/entries b/base/business/general/src/test/resources/.svn/entries new file mode 100644 index 0000000..c839458 --- /dev/null +++ b/base/business/general/src/test/resources/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/general/src/test/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/business/general/target/classes/com/fp/general/application/ClientApproval.class b/base/business/general/target/classes/com/fp/general/application/ClientApproval.class new file mode 100644 index 0000000..2b4e6d2 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/application/ClientApproval.class differ diff --git a/base/business/general/target/classes/com/fp/general/application/OfficerDescription.class b/base/business/general/target/classes/com/fp/general/application/OfficerDescription.class new file mode 100644 index 0000000..4a11238 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/application/OfficerDescription.class differ diff --git a/base/business/general/target/classes/com/fp/general/db/DataHelper.class b/base/business/general/target/classes/com/fp/general/db/DataHelper.class new file mode 100644 index 0000000..a4aad5e Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/db/DataHelper.class differ diff --git a/base/business/general/target/classes/com/fp/general/exception/ExceptionMessage.class b/base/business/general/target/classes/com/fp/general/exception/ExceptionMessage.class new file mode 100644 index 0000000..18ce21d Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/exception/ExceptionMessage.class differ diff --git a/base/business/general/target/classes/com/fp/general/helper/AccountNumber.class b/base/business/general/target/classes/com/fp/general/helper/AccountNumber.class new file mode 100644 index 0000000..c853875 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/helper/AccountNumber.class differ diff --git a/base/business/general/target/classes/com/fp/general/helper/ArrayHelper.class b/base/business/general/target/classes/com/fp/general/helper/ArrayHelper.class new file mode 100644 index 0000000..0c3b1ae Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/helper/ArrayHelper.class differ diff --git a/base/business/general/target/classes/com/fp/general/helper/MenuHelper.class b/base/business/general/target/classes/com/fp/general/helper/MenuHelper.class new file mode 100644 index 0000000..4d170ed Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/helper/MenuHelper.class differ diff --git a/base/business/general/target/classes/com/fp/general/helper/PropertiesHelper.class b/base/business/general/target/classes/com/fp/general/helper/PropertiesHelper.class new file mode 100644 index 0000000..eeb52eb Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/helper/PropertiesHelper.class differ diff --git a/base/business/general/target/classes/com/fp/general/helper/SolicitudeNumber.class b/base/business/general/target/classes/com/fp/general/helper/SolicitudeNumber.class new file mode 100644 index 0000000..ffe1dee Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/helper/SolicitudeNumber.class differ diff --git a/base/business/general/target/classes/com/fp/general/helper/StringHelper.class b/base/business/general/target/classes/com/fp/general/helper/StringHelper.class new file mode 100644 index 0000000..0017bd1 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/helper/StringHelper.class differ diff --git a/base/business/general/target/classes/com/fp/general/keygen/AbstractKeyGen.class b/base/business/general/target/classes/com/fp/general/keygen/AbstractKeyGen.class new file mode 100644 index 0000000..c25d2b7 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/keygen/AbstractKeyGen.class differ diff --git a/base/business/general/target/classes/com/fp/general/keygen/SequenceKey.class b/base/business/general/target/classes/com/fp/general/keygen/SequenceKey.class new file mode 100644 index 0000000..00e9698 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/keygen/SequenceKey.class differ diff --git a/base/business/general/target/classes/com/fp/general/keygen/SubSequenceKey.class b/base/business/general/target/classes/com/fp/general/keygen/SubSequenceKey.class new file mode 100644 index 0000000..54c6a01 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/keygen/SubSequenceKey.class differ diff --git a/base/business/general/target/classes/com/fp/general/rates/rules/ValidateRates.class b/base/business/general/target/classes/com/fp/general/rates/rules/ValidateRates.class new file mode 100644 index 0000000..e670cf8 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rates/rules/ValidateRates.class differ diff --git a/base/business/general/target/classes/com/fp/general/rates/rules/VerifyOverlapSubProductRatesAmount.class b/base/business/general/target/classes/com/fp/general/rates/rules/VerifyOverlapSubProductRatesAmount.class new file mode 100644 index 0000000..8291e93 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rates/rules/VerifyOverlapSubProductRatesAmount.class differ diff --git a/base/business/general/target/classes/com/fp/general/rates/rules/query/code/RatesDetail.class b/base/business/general/target/classes/com/fp/general/rates/rules/query/code/RatesDetail.class new file mode 100644 index 0000000..8d674a0 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rates/rules/query/code/RatesDetail.class differ diff --git a/base/business/general/target/classes/com/fp/general/record/FieldData.class b/base/business/general/target/classes/com/fp/general/record/FieldData.class new file mode 100644 index 0000000..bd6beb7 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/record/FieldData.class differ diff --git a/base/business/general/target/classes/com/fp/general/record/ParserRecord.class b/base/business/general/target/classes/com/fp/general/record/ParserRecord.class new file mode 100644 index 0000000..7d74d1b Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/record/ParserRecord.class differ diff --git a/base/business/general/target/classes/com/fp/general/record/Record.class b/base/business/general/target/classes/com/fp/general/record/Record.class new file mode 100644 index 0000000..a72bc09 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/record/Record.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/SubProductcurrencyDesc.class b/base/business/general/target/classes/com/fp/general/rules/SubProductcurrencyDesc.class new file mode 100644 index 0000000..fde20b3 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/SubProductcurrencyDesc.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/BalanceTypeProvision.class b/base/business/general/target/classes/com/fp/general/rules/query/BalanceTypeProvision.class new file mode 100644 index 0000000..3e75c53 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/BalanceTypeProvision.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/CompleteMaturation.class b/base/business/general/target/classes/com/fp/general/rules/query/CompleteMaturation.class new file mode 100644 index 0000000..194c974 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/CompleteMaturation.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/CompleteTransactionLevel.class b/base/business/general/target/classes/com/fp/general/rules/query/CompleteTransactionLevel.class new file mode 100644 index 0000000..29dc7a0 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/CompleteTransactionLevel.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/CompleteTransactionMixPages.class b/base/business/general/target/classes/com/fp/general/rules/query/CompleteTransactionMixPages.class new file mode 100644 index 0000000..76b03fd Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/CompleteTransactionMixPages.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/CompleteTransactionSubLevel.class b/base/business/general/target/classes/com/fp/general/rules/query/CompleteTransactionSubLevel.class new file mode 100644 index 0000000..8d8f9cc Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/CompleteTransactionSubLevel.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/ExecuteSQL.class b/base/business/general/target/classes/com/fp/general/rules/query/ExecuteSQL.class new file mode 100644 index 0000000..72dbdd3 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/ExecuteSQL.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/LovOfficer.class b/base/business/general/target/classes/com/fp/general/rules/query/LovOfficer.class new file mode 100644 index 0000000..d39b09a Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/LovOfficer.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/LovTransactionEvent.class b/base/business/general/target/classes/com/fp/general/rules/query/LovTransactionEvent.class new file mode 100644 index 0000000..f0db6aa Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/LovTransactionEvent.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/PrincipalInstallRates.class b/base/business/general/target/classes/com/fp/general/rules/query/PrincipalInstallRates.class new file mode 100644 index 0000000..3d40de5 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/PrincipalInstallRates.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/code/CriteriaValidator.class b/base/business/general/target/classes/com/fp/general/rules/query/code/CriteriaValidator.class new file mode 100644 index 0000000..2fb4938 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/code/CriteriaValidator.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/code/DataBaseFile.class b/base/business/general/target/classes/com/fp/general/rules/query/code/DataBaseFile.class new file mode 100644 index 0000000..2c0ad1a Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/code/DataBaseFile.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/code/DaysAccountingDate.class b/base/business/general/target/classes/com/fp/general/rules/query/code/DaysAccountingDate.class new file mode 100644 index 0000000..6d5a808 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/code/DaysAccountingDate.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/code/HeaderSolicitude.class b/base/business/general/target/classes/com/fp/general/rules/query/code/HeaderSolicitude.class new file mode 100644 index 0000000..cb4bc49 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/code/HeaderSolicitude.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/code/InfoDataFile.class b/base/business/general/target/classes/com/fp/general/rules/query/code/InfoDataFile.class new file mode 100644 index 0000000..35f4a0f Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/code/InfoDataFile.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/code/LovAccount.class b/base/business/general/target/classes/com/fp/general/rules/query/code/LovAccount.class new file mode 100644 index 0000000..10472cc Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/code/LovAccount.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/code/LovCustomer.class b/base/business/general/target/classes/com/fp/general/rules/query/code/LovCustomer.class new file mode 100644 index 0000000..1a7e0a8 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/code/LovCustomer.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/code/LovCustomerMulti.class b/base/business/general/target/classes/com/fp/general/rules/query/code/LovCustomerMulti.class new file mode 100644 index 0000000..00219b4 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/code/LovCustomerMulti.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/code/LovOfficial.class b/base/business/general/target/classes/com/fp/general/rules/query/code/LovOfficial.class new file mode 100644 index 0000000..eb04198 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/code/LovOfficial.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/code/ModuleDesc.class b/base/business/general/target/classes/com/fp/general/rules/query/code/ModuleDesc.class new file mode 100644 index 0000000..9b199a2 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/code/ModuleDesc.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/code/SubProductDesc.class b/base/business/general/target/classes/com/fp/general/rules/query/code/SubProductDesc.class new file mode 100644 index 0000000..2a7a62f Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/code/SubProductDesc.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/code/VerifyClientData.class b/base/business/general/target/classes/com/fp/general/rules/query/code/VerifyClientData.class new file mode 100644 index 0000000..5f15b8d Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/code/VerifyClientData.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/trans/ObtainTechnicalPatrimony.class b/base/business/general/target/classes/com/fp/general/rules/query/trans/ObtainTechnicalPatrimony.class new file mode 100644 index 0000000..122400c Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/trans/ObtainTechnicalPatrimony.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/trans/ProductsByClient.class b/base/business/general/target/classes/com/fp/general/rules/query/trans/ProductsByClient.class new file mode 100644 index 0000000..193883c Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/trans/ProductsByClient.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/trans/panel/ProductPanels.class b/base/business/general/target/classes/com/fp/general/rules/query/trans/panel/ProductPanels.class new file mode 100644 index 0000000..bc2ee15 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/trans/panel/ProductPanels.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/query/trans/panel/TransactionPanels.class b/base/business/general/target/classes/com/fp/general/rules/query/trans/panel/TransactionPanels.class new file mode 100644 index 0000000..4852d26 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/query/trans/panel/TransactionPanels.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/save/ChangeAccountingDate.class b/base/business/general/target/classes/com/fp/general/rules/save/ChangeAccountingDate.class new file mode 100644 index 0000000..3fa7c0f Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/save/ChangeAccountingDate.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/save/EraseCache.class b/base/business/general/target/classes/com/fp/general/rules/save/EraseCache.class new file mode 100644 index 0000000..6510ed9 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/save/EraseCache.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/save/GenerateAccountingDate.class b/base/business/general/target/classes/com/fp/general/rules/save/GenerateAccountingDate.class new file mode 100644 index 0000000..642200f Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/save/GenerateAccountingDate.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/save/VerifyOverlapChargesAmount.class b/base/business/general/target/classes/com/fp/general/rules/save/VerifyOverlapChargesAmount.class new file mode 100644 index 0000000..d8181b4 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/save/VerifyOverlapChargesAmount.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/save/VerifyOverlapSubProductChargesAmount.class b/base/business/general/target/classes/com/fp/general/rules/save/VerifyOverlapSubProductChargesAmount.class new file mode 100644 index 0000000..cd9be24 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/save/VerifyOverlapSubProductChargesAmount.class differ diff --git a/base/business/general/target/classes/com/fp/general/rules/scheduler/ChangeScheduleAccountingdate.class b/base/business/general/target/classes/com/fp/general/rules/scheduler/ChangeScheduleAccountingdate.class new file mode 100644 index 0000000..b8353b0 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/rules/scheduler/ChangeScheduleAccountingdate.class differ diff --git a/base/business/general/target/classes/com/fp/general/scheduler/MiaScheduler.class b/base/business/general/target/classes/com/fp/general/scheduler/MiaScheduler.class new file mode 100644 index 0000000..3f35861 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/scheduler/MiaScheduler.class differ diff --git a/base/business/general/target/classes/com/fp/general/scheduler/SchedulerJob.class b/base/business/general/target/classes/com/fp/general/scheduler/SchedulerJob.class new file mode 100644 index 0000000..f2c5018 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/scheduler/SchedulerJob.class differ diff --git a/base/business/general/target/classes/com/fp/general/score/save/FileScore.class b/base/business/general/target/classes/com/fp/general/score/save/FileScore.class new file mode 100644 index 0000000..ca141e8 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/score/save/FileScore.class differ diff --git a/base/business/general/target/classes/com/fp/general/score/save/SafeFileScore.class b/base/business/general/target/classes/com/fp/general/score/save/SafeFileScore.class new file mode 100644 index 0000000..67272b0 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/score/save/SafeFileScore.class differ diff --git a/base/business/general/target/classes/com/fp/general/score/save/SafeScoreHeaderDetail.class b/base/business/general/target/classes/com/fp/general/score/save/SafeScoreHeaderDetail.class new file mode 100644 index 0000000..3753701 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/score/save/SafeScoreHeaderDetail.class differ diff --git a/base/business/general/target/classes/com/fp/general/score/save/UploadFileScoreThread.class b/base/business/general/target/classes/com/fp/general/score/save/UploadFileScoreThread.class new file mode 100644 index 0000000..188312a Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/score/save/UploadFileScoreThread.class differ diff --git a/base/business/general/target/classes/com/fp/general/score/save/UploadLineScoreThread.class b/base/business/general/target/classes/com/fp/general/score/save/UploadLineScoreThread.class new file mode 100644 index 0000000..d9f6ed9 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/score/save/UploadLineScoreThread.class differ diff --git a/base/business/general/target/classes/com/fp/general/security/rules/CloseAllSessions.class b/base/business/general/target/classes/com/fp/general/security/rules/CloseAllSessions.class new file mode 100644 index 0000000..42cddeb Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/security/rules/CloseAllSessions.class differ diff --git a/base/business/general/target/classes/com/fp/general/security/rules/CloseSession.class b/base/business/general/target/classes/com/fp/general/security/rules/CloseSession.class new file mode 100644 index 0000000..82ecb30 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/security/rules/CloseSession.class differ diff --git a/base/business/general/target/classes/com/fp/general/security/rules/Company.class b/base/business/general/target/classes/com/fp/general/security/rules/Company.class new file mode 100644 index 0000000..e75028a Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/security/rules/Company.class differ diff --git a/base/business/general/target/classes/com/fp/general/security/rules/CreateInternalCodeUser.class b/base/business/general/target/classes/com/fp/general/security/rules/CreateInternalCodeUser.class new file mode 100644 index 0000000..aa38a06 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/security/rules/CreateInternalCodeUser.class differ diff --git a/base/business/general/target/classes/com/fp/general/security/rules/MaintenanceMenu.class b/base/business/general/target/classes/com/fp/general/security/rules/MaintenanceMenu.class new file mode 100644 index 0000000..a6067da Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/security/rules/MaintenanceMenu.class differ diff --git a/base/business/general/target/classes/com/fp/general/security/rules/MaintenanceUser.class b/base/business/general/target/classes/com/fp/general/security/rules/MaintenanceUser.class new file mode 100644 index 0000000..06192e1 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/security/rules/MaintenanceUser.class differ diff --git a/base/business/general/target/classes/com/fp/general/security/rules/Menu.class b/base/business/general/target/classes/com/fp/general/security/rules/Menu.class new file mode 100644 index 0000000..4e57167 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/security/rules/Menu.class differ diff --git a/base/business/general/target/classes/com/fp/general/security/rules/Politics.class b/base/business/general/target/classes/com/fp/general/security/rules/Politics.class new file mode 100644 index 0000000..c96ab76 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/security/rules/Politics.class differ diff --git a/base/business/general/target/classes/com/fp/general/security/rules/UserLogon.class b/base/business/general/target/classes/com/fp/general/security/rules/UserLogon.class new file mode 100644 index 0000000..a8c00f9 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/security/rules/UserLogon.class differ diff --git a/base/business/general/target/classes/com/fp/general/security/rules/UserLogonCas.class b/base/business/general/target/classes/com/fp/general/security/rules/UserLogonCas.class new file mode 100644 index 0000000..aac2479 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/security/rules/UserLogonCas.class differ diff --git a/base/business/general/target/classes/com/fp/general/security/rules/query/CompleteAudit.class b/base/business/general/target/classes/com/fp/general/security/rules/query/CompleteAudit.class new file mode 100644 index 0000000..5a28b23 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/security/rules/query/CompleteAudit.class differ diff --git a/base/business/general/target/classes/com/fp/general/security/rules/query/QueryAudit.class b/base/business/general/target/classes/com/fp/general/security/rules/query/QueryAudit.class new file mode 100644 index 0000000..c1b48f0 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/security/rules/query/QueryAudit.class differ diff --git a/base/business/general/target/classes/com/fp/general/security/rules/query/code/SearchUser.class b/base/business/general/target/classes/com/fp/general/security/rules/query/code/SearchUser.class new file mode 100644 index 0000000..27029ce Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/security/rules/query/code/SearchUser.class differ diff --git a/base/business/general/target/classes/com/fp/general/security/rules/query/code/TransactionSearch.class b/base/business/general/target/classes/com/fp/general/security/rules/query/code/TransactionSearch.class new file mode 100644 index 0000000..9b8ed84 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/security/rules/query/code/TransactionSearch.class differ diff --git a/base/business/general/target/classes/com/fp/general/templates/query/QueryTemplates.class b/base/business/general/target/classes/com/fp/general/templates/query/QueryTemplates.class new file mode 100644 index 0000000..1974232 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/templates/query/QueryTemplates.class differ diff --git a/base/business/general/target/classes/com/fp/general/templates/query/QueryTemplatesDesc.class b/base/business/general/target/classes/com/fp/general/templates/query/QueryTemplatesDesc.class new file mode 100644 index 0000000..db47d19 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/templates/query/QueryTemplatesDesc.class differ diff --git a/base/business/general/target/classes/com/fp/general/templates/save/SaveTemplatesDesc.class b/base/business/general/target/classes/com/fp/general/templates/save/SaveTemplatesDesc.class new file mode 100644 index 0000000..5c0cf26 Binary files /dev/null and b/base/business/general/target/classes/com/fp/general/templates/save/SaveTemplatesDesc.class differ diff --git a/base/business/general/target/classes/generalmessages_es.properties b/base/business/general/target/classes/generalmessages_es.properties new file mode 100644 index 0000000..b4c6a25 --- /dev/null +++ b/base/business/general/target/classes/generalmessages_es.properties @@ -0,0 +1,43 @@ +GENE-0001=SUCURSAL NO DEFINIDA EN TGENEBRANCH: BRANCH:{0} COMPANY:{1} +GENE-0002=OFICINA NO DEFINIDA EN TGENEOFFICE: OFFICE:{0} BRANCH:{1} COMPANY:{2} +GENE-0003=USUARIO O PASSWORD INCORRECTO +GENE-0004=NIVEL DE MENU NO DEFINIDOS EN TEGNEMENULEVEL +GENE-0005=NIVEL DE MENU NO DEFINIDOS EN TEGNEMENUSUBLEVEL +GENE-0006=SEMILLA DE LA SECUENCIA NO DEFINA EN TGENESEQUENCES, CODIGO: {0} +GENE-0007=EL USUARIO {0} HA SIDO BLOQUEADO POR INGRESO DE CLAVE ERRONEA +GENE-0008=EL NUMERO DE INTENTOS HA SOBREPASADO EL PERMITIDO +GENE-0009=EL USUARIO {0} SE ENCUENTRA TRABAJANDO EN EL TERMINAL {1} +GENE-0010=EL USUARIO {0} SE ENCUENTRA {1} +GENE-0011=EL USUARIO NO EXISTE +GENE-0012=REPORTE NO DEFINIDO PARA EL MODULO: {0}, TRANSACCION: {1}, VERSION {2} +GENE-0013=PATH PARA REPORTES NO DEFINIDO EN LA COMPANIA {0}, PARAMETRO {1} +GENE-0014=PATH PARA SUBREPORTES NO DEFINIDO EN LA COMPANIA {0}, PARAMETRO {1} +GENE-0015=REPORTE {0} NO DISPONIBLE +GENE-0016=SE PRESENTO EL SIGUIENTE ERROR {0} AL GENERAR EL REPORTE +GENE-0017=EL PERFIL {0} NO TIENE ASOCIADO UN MENU +GENE-0018=SUCURSALES NO DEFINIDAS PARA LA COMPANIA: {0} +GENE-0019=EL CALENDARIO NO PUEDE DEJAR HUECOS PARA LA SUCURSAL: {0} FCONTABLE ANTERIOR: {1} +GENE-0020=FECHA DE INICIO PARA GENERAR CALENDARIO NO PUEDE SER MENOR A: {0} +GENE-0021=LA CONTRASEA NO CUMPLE CON LA POLITICA DE SEGURIDAD +GENE-0022=NO PUEDE REPETIR LAS LTIMAS: {0} CONTRASEAS +GENE-0023=CONTRASEA EXPIRADA +GENE-0024=CALENDARIO NO DEFINIDO EN TGENEACCOUNTINGDATE PARA LA FECHA :{0} +GENE-0025=CONTRASEA ANTERIOR INCORRECTA +GENE-0026=LA CONTRASEA DEBE TENER POR LO MENOS {0} LETRAS MINSCULAS +GENE-0027=LA CONTRASEA DEBE TENER POR LO MENOS {0} CARACTERES ESPECIALES +GENE-0028=LA CONTRASEA DEBE TENER POR LO MENOS {0} LETRAS MAYSCULAS +GENE-0029=LA CONTRASEA DEBE TENER POR LO MENOS {0} NMEROS +GENE-0030=LA LONGITUD MNIMA DE LA CONTRASEA DEBE SER DE {0} CARACTERES +GENE-0031=VALOR REQUERIDO PARA EL CAMPO: {0} NMERO DE REGISTRO: {1} +GENE-0032=TIPO DE DATO: {0} PARA EL CAMPO: {1} NO SE PUEDE TRANSFORMAR VALOR: {2} REGISTRO {3} +GENE-0033=OFICIAL DE CUENTA NO DEFINIDO PARA EL PRODUCTO EN TGENEOFFICER +GENE-0034=PARMETROS PARA EJECUTAR TAREAS CALENDARIZADAS NO DEFINIDOS EN TGENSCHEDULEPARAMETERS +GENE-0035=USUARIO: {0} NO DEFINIDO EN TSAFEUSERDETAIL +GENE-0036=NMERO DE CARACTERES DEL SECUENCIAL NO DEFINIDO EN TGENEACCONUMSTRUCTURE MODULO: {0} +GENE-0037=ESTRUCTURA DE SECUENCIAL NO DEFINIDA EN TGENESEQUENTIALMODULE MODULO: {0} +GENE-0038=ESTRUCTURA DE SECUENCIAL NO DEFINIDA EN TGENESEQUESTRUCTDETAIL MODULO: {0} +GENE-0039=ESTRUCTURA DE NMERO DE CUENTA NO DEFINIDA EN TGENEACCONUMSTRUCTURE MDULO: {0} +GENE-0040=EL MONTO MNIMO DEBE SER MAYOR AL MONTO MXIMO +GENE-0041=LOS VALORES PARA EL TIPO DE BALANCE {0} SE SOBREPONEN +GENE-0042=CDIGO DE USUARIO YA EXISTE: {0} +GENE-0043=:EL CRITERIO DE BSQUEDA --> {0} NO ES SUFICIENTE \ No newline at end of file diff --git a/base/business/general/target/general-2.1.jar b/base/business/general/target/general-2.1.jar new file mode 100644 index 0000000..253fd90 Binary files /dev/null and b/base/business/general/target/general-2.1.jar differ diff --git a/base/business/general/target/maven-archiver/pom.properties b/base/business/general/target/maven-archiver/pom.properties new file mode 100644 index 0000000..7a02702 --- /dev/null +++ b/base/business/general/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:53:15 ECT 2022 +version=2.1 +groupId=com.fp.base.business +artifactId=general diff --git a/base/business/log/.svn/dir-prop-base b/base/business/log/.svn/dir-prop-base new file mode 100644 index 0000000..40820ff --- /dev/null +++ b/base/business/log/.svn/dir-prop-base @@ -0,0 +1,6 @@ +K 10 +svn:ignore +V 7 +target + +END diff --git a/base/business/log/.svn/entries b/base/business/log/.svn/entries new file mode 100644 index 0000000..c076d8e --- /dev/null +++ b/base/business/log/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/log +svn://172.17.26.185/COMACO + + + +2014-10-17T05:32:00.734115Z +1669 +jvaca +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:39.054787Z +50d3060ccf5010c2e325cdc0d13d7f83 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +806 + diff --git a/base/business/log/.svn/text-base/pom.xml.svn-base b/base/business/log/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..336a20c --- /dev/null +++ b/base/business/log/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,22 @@ + + + + business + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.business + log + log + + + com.fp.base.persistence + plog + ${project.version} + + + diff --git a/base/business/log/pom.xml b/base/business/log/pom.xml new file mode 100644 index 0000000..336a20c --- /dev/null +++ b/base/business/log/pom.xml @@ -0,0 +1,22 @@ + + + + business + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.business + log + log + + + com.fp.base.persistence + plog + ${project.version} + + + diff --git a/base/business/log/src/.svn/entries b/base/business/log/src/.svn/entries new file mode 100644 index 0000000..cbb90f0 --- /dev/null +++ b/base/business/log/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/log/src +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/base/business/log/src/main/.svn/entries b/base/business/log/src/main/.svn/entries new file mode 100644 index 0000000..3add472 --- /dev/null +++ b/base/business/log/src/main/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/log/src/main +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/business/log/src/main/java/.svn/entries b/base/business/log/src/main/java/.svn/entries new file mode 100644 index 0000000..0690b47 --- /dev/null +++ b/base/business/log/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/log/src/main/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/business/log/src/main/java/com/.svn/entries b/base/business/log/src/main/java/com/.svn/entries new file mode 100644 index 0000000..8a02c4b --- /dev/null +++ b/base/business/log/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/log/src/main/java/com +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/business/log/src/main/java/com/fp/.svn/entries b/base/business/log/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..352c429 --- /dev/null +++ b/base/business/log/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/log/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +log +dir + diff --git a/base/business/log/src/main/java/com/fp/log/.svn/entries b/base/business/log/src/main/java/com/fp/log/.svn/entries new file mode 100644 index 0000000..f5c7134 --- /dev/null +++ b/base/business/log/src/main/java/com/fp/log/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/log/src/main/java/com/fp/log +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +package-info.java +file + + + + +2022-07-28T03:40:38.850786Z +2023f75ebf300c037dd4c5aeed1151cd +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +69 + +LogBook.java +file + + + + +2022-07-28T03:40:38.850786Z +963fa36082a102f999a7995b33c9f6f5 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5828 + diff --git a/base/business/log/src/main/java/com/fp/log/.svn/text-base/LogBook.java.svn-base b/base/business/log/src/main/java/com/fp/log/.svn/text-base/LogBook.java.svn-base new file mode 100644 index 0000000..c0e1df7 --- /dev/null +++ b/base/business/log/src/main/java/com/fp/log/.svn/text-base/LogBook.java.svn-base @@ -0,0 +1,188 @@ +package com.fp.log; + +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.NoSuchElementException; + +import org.apache.log4j.Logger; + +import com.fp.base.persistence.util.helper.MessageManager; +import com.fp.common.helper.BeanManager; +import com.fp.dto.Request; +import com.fp.dto.hb.HibernateBean; +import com.fp.persistence.commondb.NestedSave; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.plog.log.TlogHeader; +import com.fp.persistence.plog.log.TlogLoad; +import com.fp.persistence.plog.log.TlogLoadError; +import com.fp.persistence.plog.log.TlogLoadErrorKey; +import com.fp.persistence.plog.log.TlogLoadKey; + +// TODO: Auto-generated Javadoc +/** + * The Class LogBook. + */ +public class LogBook { + private static final Logger LOG = Logger.getLogger(LogBook.class); + + /** The request. */ + private Request request; + + /** The header. */ + private TlogHeader header; + + /** The process. */ + private HashMap process = new HashMap(); + + /** The process error. */ + private HashMap processError = new HashMap(); + + /** The process count. */ + private long processCount = 0; + + /** + * Instantiates a new log book. + * + * @param pRequest the request + * @throws Exception the exception + */ + public LogBook(Request pRequest) throws Exception { + this.request = pRequest; + this.manageHeader(); + } + + /** + * Manage header. + * + * @throws Exception the exception + */ + protected void manageHeader() throws Exception { + this.header = new TlogHeader(this.request.getJournalId(), this.request.getTransactionModule(), this.request.getTransactionCode(), + this.request.getTransactionVersion()); + this.header.setUsercode(this.request.getUser()); + this.header.setCompanycode(this.request.getCompany()); + this.header.setOfficecode(this.request.getOfficeCode()); + this.header.setBranchcode(this.request.getBranchCode()); + this.header.setRealdate(FormatDates.getInstance().getDataBaseTimestamp()); + this.header.setAccountingdate(BeanManager.convertObject(this.request.get("accountingdate"), Timestamp.class)); + this.header.setAditionaldata(MessageManager.getMessage(this.request)); + this.save(this.header, false); + } + + /** + * Save. + * + * @param pBean the bean + * @throws Exception the exception + */ + protected void save(HibernateBean pBean, boolean update) throws Exception { + NestedSave ns = new NestedSave(this.request.getCompany(), update, pBean); + LogBook.LOG.info(pBean); + ns.start(); + ns.join(); + } + + /** + * Adds the process. + * + * @param pData the data + * @param pId the id + * @return the long + * @throws Exception the exception + */ + public Long addProcess(String pData, String pId) throws Exception { + long id = ++this.processCount; + TlogLoadKey lk = new TlogLoadKey(this.request.getJournalId(), id); + TlogLoad l = new TlogLoad(lk); + l.setAditionaldata(pData); + l.setLoadid(pId); + l.setStatus("P");// P en proceso, E error, S sucessfull + this.save(l, false); + this.process.put(id, l); + return id; + } + + /** + * Destroy process. + * + * @param pId the id + * @throws Exception the exception + */ + private void destroyProcess(Long pId) throws Exception { + this.process.remove(pId); + this.processError.remove(pId); + } + + /** + * End process. + * + * @param pId the id + * @throws Exception the exception + */ + public void endProcess(Long pId) throws Exception { + TlogLoad load = this.process.get(pId); + if (load == null) { + throw new NoSuchElementException(); + } + load.setStatus("S"); + this.save(load, true); + this.destroyProcess(pId); + } + + public void addDetailError(Long pId, String pData) throws Exception { + this.addDetailError(pId, pData, null, null); + } + + /** + * Adds the detail error. + * + * @param pId the id + * @param pData the data + * @param pResultCode the result code + * @param pIdentifier the identifier + * @throws Exception the exception + */ + public void addDetailError(Long pId, String pData, String pResultCode, String pIdentifier) throws Exception { + Integer errorsequence = this.processError.get(pId); + errorsequence = (errorsequence == null) ? 0 : errorsequence; + TlogLoadErrorKey llk = new TlogLoadErrorKey(this.request.getJournalId(), pId, errorsequence); + this.processError.put(pId, ++errorsequence); + TlogLoadError ll = new TlogLoadError(llk); + ll.setMessage(pData); + ll.setResultcode(pResultCode); + ll.setIdentifier(pIdentifier); + this.save(ll, false); + } + + /** + * Error process. + * + * @param pId the id + * @throws Exception the exception + */ + public void errorProcess(Long pId) throws Exception { + TlogLoad load = this.process.get(pId); + if (load == null) { + throw new NoSuchElementException(); + } + load.setStatus("E"); + this.save(load, true); + this.destroyProcess(pId); + } + + /** + * The main method. + * + * @param args the arguments + * @throws Exception the exception + */ + public static void main(String[] args) throws Exception { + LogBook l = new LogBook(null); + Long id = l.addProcess("aSDFGHJ", "ASDFGHJK"); + l.addDetailError(id, "asdfgh", "12", "123"); + l.addDetailError(id, "asdfgh", "12", "123"); + l.addDetailError(id, "asdfgh", "12", "123"); + l.endProcess(id); + l.errorProcess(id); + } +} diff --git a/base/business/log/src/main/java/com/fp/log/.svn/text-base/package-info.java.svn-base b/base/business/log/src/main/java/com/fp/log/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..6173017 --- /dev/null +++ b/base/business/log/src/main/java/com/fp/log/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,4 @@ +/** + * Clases para el control de la Bitcora. + */ +package com.fp.log; \ No newline at end of file diff --git a/base/business/log/src/main/java/com/fp/log/LogBook.java b/base/business/log/src/main/java/com/fp/log/LogBook.java new file mode 100644 index 0000000..c0e1df7 --- /dev/null +++ b/base/business/log/src/main/java/com/fp/log/LogBook.java @@ -0,0 +1,188 @@ +package com.fp.log; + +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.NoSuchElementException; + +import org.apache.log4j.Logger; + +import com.fp.base.persistence.util.helper.MessageManager; +import com.fp.common.helper.BeanManager; +import com.fp.dto.Request; +import com.fp.dto.hb.HibernateBean; +import com.fp.persistence.commondb.NestedSave; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.plog.log.TlogHeader; +import com.fp.persistence.plog.log.TlogLoad; +import com.fp.persistence.plog.log.TlogLoadError; +import com.fp.persistence.plog.log.TlogLoadErrorKey; +import com.fp.persistence.plog.log.TlogLoadKey; + +// TODO: Auto-generated Javadoc +/** + * The Class LogBook. + */ +public class LogBook { + private static final Logger LOG = Logger.getLogger(LogBook.class); + + /** The request. */ + private Request request; + + /** The header. */ + private TlogHeader header; + + /** The process. */ + private HashMap process = new HashMap(); + + /** The process error. */ + private HashMap processError = new HashMap(); + + /** The process count. */ + private long processCount = 0; + + /** + * Instantiates a new log book. + * + * @param pRequest the request + * @throws Exception the exception + */ + public LogBook(Request pRequest) throws Exception { + this.request = pRequest; + this.manageHeader(); + } + + /** + * Manage header. + * + * @throws Exception the exception + */ + protected void manageHeader() throws Exception { + this.header = new TlogHeader(this.request.getJournalId(), this.request.getTransactionModule(), this.request.getTransactionCode(), + this.request.getTransactionVersion()); + this.header.setUsercode(this.request.getUser()); + this.header.setCompanycode(this.request.getCompany()); + this.header.setOfficecode(this.request.getOfficeCode()); + this.header.setBranchcode(this.request.getBranchCode()); + this.header.setRealdate(FormatDates.getInstance().getDataBaseTimestamp()); + this.header.setAccountingdate(BeanManager.convertObject(this.request.get("accountingdate"), Timestamp.class)); + this.header.setAditionaldata(MessageManager.getMessage(this.request)); + this.save(this.header, false); + } + + /** + * Save. + * + * @param pBean the bean + * @throws Exception the exception + */ + protected void save(HibernateBean pBean, boolean update) throws Exception { + NestedSave ns = new NestedSave(this.request.getCompany(), update, pBean); + LogBook.LOG.info(pBean); + ns.start(); + ns.join(); + } + + /** + * Adds the process. + * + * @param pData the data + * @param pId the id + * @return the long + * @throws Exception the exception + */ + public Long addProcess(String pData, String pId) throws Exception { + long id = ++this.processCount; + TlogLoadKey lk = new TlogLoadKey(this.request.getJournalId(), id); + TlogLoad l = new TlogLoad(lk); + l.setAditionaldata(pData); + l.setLoadid(pId); + l.setStatus("P");// P en proceso, E error, S sucessfull + this.save(l, false); + this.process.put(id, l); + return id; + } + + /** + * Destroy process. + * + * @param pId the id + * @throws Exception the exception + */ + private void destroyProcess(Long pId) throws Exception { + this.process.remove(pId); + this.processError.remove(pId); + } + + /** + * End process. + * + * @param pId the id + * @throws Exception the exception + */ + public void endProcess(Long pId) throws Exception { + TlogLoad load = this.process.get(pId); + if (load == null) { + throw new NoSuchElementException(); + } + load.setStatus("S"); + this.save(load, true); + this.destroyProcess(pId); + } + + public void addDetailError(Long pId, String pData) throws Exception { + this.addDetailError(pId, pData, null, null); + } + + /** + * Adds the detail error. + * + * @param pId the id + * @param pData the data + * @param pResultCode the result code + * @param pIdentifier the identifier + * @throws Exception the exception + */ + public void addDetailError(Long pId, String pData, String pResultCode, String pIdentifier) throws Exception { + Integer errorsequence = this.processError.get(pId); + errorsequence = (errorsequence == null) ? 0 : errorsequence; + TlogLoadErrorKey llk = new TlogLoadErrorKey(this.request.getJournalId(), pId, errorsequence); + this.processError.put(pId, ++errorsequence); + TlogLoadError ll = new TlogLoadError(llk); + ll.setMessage(pData); + ll.setResultcode(pResultCode); + ll.setIdentifier(pIdentifier); + this.save(ll, false); + } + + /** + * Error process. + * + * @param pId the id + * @throws Exception the exception + */ + public void errorProcess(Long pId) throws Exception { + TlogLoad load = this.process.get(pId); + if (load == null) { + throw new NoSuchElementException(); + } + load.setStatus("E"); + this.save(load, true); + this.destroyProcess(pId); + } + + /** + * The main method. + * + * @param args the arguments + * @throws Exception the exception + */ + public static void main(String[] args) throws Exception { + LogBook l = new LogBook(null); + Long id = l.addProcess("aSDFGHJ", "ASDFGHJK"); + l.addDetailError(id, "asdfgh", "12", "123"); + l.addDetailError(id, "asdfgh", "12", "123"); + l.addDetailError(id, "asdfgh", "12", "123"); + l.endProcess(id); + l.errorProcess(id); + } +} diff --git a/base/business/log/src/main/java/com/fp/log/package-info.java b/base/business/log/src/main/java/com/fp/log/package-info.java new file mode 100644 index 0000000..6173017 --- /dev/null +++ b/base/business/log/src/main/java/com/fp/log/package-info.java @@ -0,0 +1,4 @@ +/** + * Clases para el control de la Bitcora. + */ +package com.fp.log; \ No newline at end of file diff --git a/base/business/log/src/main/resources/.svn/entries b/base/business/log/src/main/resources/.svn/entries new file mode 100644 index 0000000..3e185de --- /dev/null +++ b/base/business/log/src/main/resources/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/log/src/main/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/business/log/src/test/.svn/entries b/base/business/log/src/test/.svn/entries new file mode 100644 index 0000000..75922c4 --- /dev/null +++ b/base/business/log/src/test/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/log/src/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/business/log/src/test/java/.svn/entries b/base/business/log/src/test/java/.svn/entries new file mode 100644 index 0000000..fb15760 --- /dev/null +++ b/base/business/log/src/test/java/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/log/src/test/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/business/log/src/test/resources/.svn/entries b/base/business/log/src/test/resources/.svn/entries new file mode 100644 index 0000000..ce7dd28 --- /dev/null +++ b/base/business/log/src/test/resources/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/log/src/test/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/business/log/target/classes/com/fp/log/LogBook.class b/base/business/log/target/classes/com/fp/log/LogBook.class new file mode 100644 index 0000000..eef0a3d Binary files /dev/null and b/base/business/log/target/classes/com/fp/log/LogBook.class differ diff --git a/base/business/log/target/log-2.1.jar b/base/business/log/target/log-2.1.jar new file mode 100644 index 0000000..d340d38 Binary files /dev/null and b/base/business/log/target/log-2.1.jar differ diff --git a/base/business/log/target/maven-archiver/pom.properties b/base/business/log/target/maven-archiver/pom.properties new file mode 100644 index 0000000..24fd476 --- /dev/null +++ b/base/business/log/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:53:17 ECT 2022 +version=2.1 +groupId=com.fp.base.business +artifactId=log diff --git a/base/business/person/.svn/dir-prop-base b/base/business/person/.svn/dir-prop-base new file mode 100644 index 0000000..40820ff --- /dev/null +++ b/base/business/person/.svn/dir-prop-base @@ -0,0 +1,6 @@ +K 10 +svn:ignore +V 7 +target + +END diff --git a/base/business/person/.svn/entries b/base/business/person/.svn/entries new file mode 100644 index 0000000..ed533dd --- /dev/null +++ b/base/business/person/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/person +svn://172.17.26.185/COMACO + + + +2015-09-21T11:33:05.809667Z +4285 +fpazmino +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:42.250801Z +87ffb06b9ed4952d853875d72bf4f063 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1121 + diff --git a/base/business/person/.svn/text-base/pom.xml.svn-base b/base/business/person/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..b0c610d --- /dev/null +++ b/base/business/person/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,32 @@ + + + + business + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.business + person + person + + + com.fp.base.persistence + pcustomer + 2.1 + + + + com.fp.base + sessionbeans + 2.1 + + + \ No newline at end of file diff --git a/base/business/person/pom.xml b/base/business/person/pom.xml new file mode 100644 index 0000000..b0c610d --- /dev/null +++ b/base/business/person/pom.xml @@ -0,0 +1,32 @@ + + + + business + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.business + person + person + + + com.fp.base.persistence + pcustomer + 2.1 + + + + com.fp.base + sessionbeans + 2.1 + + + \ No newline at end of file diff --git a/base/business/person/src/.svn/entries b/base/business/person/src/.svn/entries new file mode 100644 index 0000000..6bd74c2 --- /dev/null +++ b/base/business/person/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/person/src +svn://172.17.26.185/COMACO + + + +2015-09-21T11:33:05.809667Z +4285 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/base/business/person/src/main/.svn/entries b/base/business/person/src/main/.svn/entries new file mode 100644 index 0000000..4222e6c --- /dev/null +++ b/base/business/person/src/main/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/person/src/main +svn://172.17.26.185/COMACO + + + +2015-09-21T11:33:05.809667Z +4285 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/business/person/src/main/java/.svn/entries b/base/business/person/src/main/java/.svn/entries new file mode 100644 index 0000000..581d640 --- /dev/null +++ b/base/business/person/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/person/src/main/java +svn://172.17.26.185/COMACO + + + +2015-09-21T11:33:05.809667Z +4285 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/business/person/src/main/java/com/.svn/entries b/base/business/person/src/main/java/com/.svn/entries new file mode 100644 index 0000000..650ea88 --- /dev/null +++ b/base/business/person/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/person/src/main/java/com +svn://172.17.26.185/COMACO + + + +2015-09-21T11:33:05.809667Z +4285 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/business/person/src/main/java/com/fp/.svn/entries b/base/business/person/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..a8f3657 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/person/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2015-09-21T11:33:05.809667Z +4285 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +person +dir + diff --git a/base/business/person/src/main/java/com/fp/person/.svn/entries b/base/business/person/src/main/java/com/fp/person/.svn/entries new file mode 100644 index 0000000..705d2cc --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/.svn/entries @@ -0,0 +1,37 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/person/src/main/java/com/fp/person +svn://172.17.26.185/COMACO + + + +2015-09-21T11:33:05.809667Z +4285 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +db +dir + +validate +dir + +rules +dir + diff --git a/base/business/person/src/main/java/com/fp/person/db/.svn/entries b/base/business/person/src/main/java/com/fp/person/db/.svn/entries new file mode 100644 index 0000000..f2878f1 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/db/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/person/src/main/java/com/fp/person/db +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +DataHelper.java +file + + + + +2022-07-28T03:40:41.729799Z +b2ca79463acd416301c3a4d4f3bc8bc8 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5936 + diff --git a/base/business/person/src/main/java/com/fp/person/db/.svn/text-base/DataHelper.java.svn-base b/base/business/person/src/main/java/com/fp/person/db/.svn/text-base/DataHelper.java.svn-base new file mode 100644 index 0000000..7201733 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/db/.svn/text-base/DataHelper.java.svn-base @@ -0,0 +1,149 @@ +package com.fp.person.db; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCantonKey; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCityKey; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneParroquiaKey; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.gene.TgeneProvinceKey; + +/** + * Clase utilitaria que maneje sql y hql utiliada en el proyecto person. + * @author Jorge Vaca + * @version 2.1 + */ +public class DataHelper { + + /**Almacena una instancia de DataHelper.*/ + private static DataHelper cache; + + /** + * Entrega una instancia de DataHelper. + * @return DataHelper + */ + public static DataHelper getInstance() { + if (cache != null) { + return cache; + } + synchronized (DataHelper.class) { + if (cache == null) { + cache = new DataHelper(); + } + } + return cache; + } + + /** + * Metodo que entrega datos de una sucursal definidos en TgeneBranch. + * @param pBranch Codigo de sucursal. + * @param pCompany Compania a la que pertenece la cuenta. + * @return TgeneBranch + * @throws Exception + */ + public TcustPersonDetail getTcustPersonDetail(Integer pPersonCode) throws Exception { + return TcustPersonDetail.find(PersistenceHelper.getEntityManager(), pPersonCode); + } + + + + /** + * Metodo que entrega datos de una Direccion definida en TcustPersonAddress. + * @param personcode Codigo de la persona a quien pertenece la Direccion. + * @param addressnumber Numero de la direccion. + * @return tcustPersonAddress + * @throws Exception + */ + public TcustPersonAddress getTcustPersonAddress(Integer personcode, Integer addressnumber) throws Exception { + return TcustPersonAddress.findByPersonCode(PersistenceHelper.getEntityManager(), personcode, addressnumber); + } + + + + /** + * Metodo que entrega datos de un Pais definido en TgeneCountry. + * @param countrycode Codigo que identfica el Pais. + * @return tgeneCountry + * @throws Exception + */ + public TgeneCountry getTgeneCountry(String countrycode) throws Exception { + TgeneCountry tgeneCountry = null; + tgeneCountry = (TgeneCountry) PersistenceHelper.getSession().get(TgeneCountry.class, countrycode); + return tgeneCountry; + } + + + + /** + * Metodo que entrega datos de una Provincia definida en TgeneProvince. + * @param countrycode Codigo del pais al cual pertenece la Provincia. + * @param provincecode Codigo que identfica la Provincia. + * @return tgeneProvince + * @throws Exception + */ + public TgeneProvince getTgeneProvince(String countrycode, String provincecode) throws Exception { + TgeneProvinceKey tgeneProvinceKey = new TgeneProvinceKey(countrycode, provincecode); + TgeneProvince tgeneProvince = null; + tgeneProvince = (TgeneProvince) PersistenceHelper.getSession().get(TgeneProvince.class, tgeneProvinceKey); + return tgeneProvince; + } + + + + /** + * Metodo que devuelve un objeto de tipo TgeneCanton + * @param countrycode Codigo de pais + * @param provincecode Codigo provincia + * @param cantoncode Codigo canton + * @return + * @throws Exception + */ + public TgeneCanton getTgeneCanton(String countrycode, String provincecode, String cantoncode) throws Exception { + TgeneCantonKey tgeneCantonKey = new TgeneCantonKey(countrycode, provincecode, cantoncode); + TgeneCanton tgeneCanton = null; + tgeneCanton = (TgeneCanton) PersistenceHelper.getSession().get(TgeneCanton.class, tgeneCantonKey); + return tgeneCanton; + } + + + + /** + * Metodo que entrega datos de una Ciudad definida en TgeneCity. + * @param countrycode Codigo del pais al cual perteneces la Ciudad. + * @param provincecode Codigo de la provincia al cual pertenece la Ciudad. + * @param cantoncode Codigo del canton de la ciudad + * @param citycode Codigo que identfica la Ciudad. + * @return tgeneCity + * @throws Exception + */ + public TgeneCity getTgeneCity(String countrycode, String provincecode, String cantoncode, String citycode) throws Exception { + TgeneCityKey tgeneCityKey = new TgeneCityKey(countrycode, provincecode, cantoncode, citycode); + TgeneCity tgeneCity = null; + tgeneCity = (TgeneCity) PersistenceHelper.getSession().get(TgeneCity.class, tgeneCityKey); + return tgeneCity; + } + + + + /** + * Metodo que entrega datos de una Parroquia definida en TgeneParroquia. + * @param countrycode Codigo del pais al cual perteneces la Ciudad. + * @param provincecode Codigo de la provincia al cual pertenece la Ciudad. + * @param cantoncode Codigo del canton de la ciudad + * @param parroquiacode Codigo que identfica a la parroquia. + * @return tgeneCity + * @throws Exception + */ + public TgeneParroquia getTgeneParroquia(String countrycode, String provincecode, String cantoncode, String parroquiacode) throws Exception { + TgeneParroquiaKey tgeneParroquiaKey = new TgeneParroquiaKey(countrycode, provincecode, cantoncode, parroquiacode); + TgeneParroquia tgeneParroquia = null; + tgeneParroquia = (TgeneParroquia) PersistenceHelper.getSession().get(TgeneParroquia.class, tgeneParroquiaKey); + return tgeneParroquia; + } + +} diff --git a/base/business/person/src/main/java/com/fp/person/db/DataHelper.java b/base/business/person/src/main/java/com/fp/person/db/DataHelper.java new file mode 100644 index 0000000..7201733 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/db/DataHelper.java @@ -0,0 +1,149 @@ +package com.fp.person.db; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCantonKey; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCityKey; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneParroquiaKey; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.gene.TgeneProvinceKey; + +/** + * Clase utilitaria que maneje sql y hql utiliada en el proyecto person. + * @author Jorge Vaca + * @version 2.1 + */ +public class DataHelper { + + /**Almacena una instancia de DataHelper.*/ + private static DataHelper cache; + + /** + * Entrega una instancia de DataHelper. + * @return DataHelper + */ + public static DataHelper getInstance() { + if (cache != null) { + return cache; + } + synchronized (DataHelper.class) { + if (cache == null) { + cache = new DataHelper(); + } + } + return cache; + } + + /** + * Metodo que entrega datos de una sucursal definidos en TgeneBranch. + * @param pBranch Codigo de sucursal. + * @param pCompany Compania a la que pertenece la cuenta. + * @return TgeneBranch + * @throws Exception + */ + public TcustPersonDetail getTcustPersonDetail(Integer pPersonCode) throws Exception { + return TcustPersonDetail.find(PersistenceHelper.getEntityManager(), pPersonCode); + } + + + + /** + * Metodo que entrega datos de una Direccion definida en TcustPersonAddress. + * @param personcode Codigo de la persona a quien pertenece la Direccion. + * @param addressnumber Numero de la direccion. + * @return tcustPersonAddress + * @throws Exception + */ + public TcustPersonAddress getTcustPersonAddress(Integer personcode, Integer addressnumber) throws Exception { + return TcustPersonAddress.findByPersonCode(PersistenceHelper.getEntityManager(), personcode, addressnumber); + } + + + + /** + * Metodo que entrega datos de un Pais definido en TgeneCountry. + * @param countrycode Codigo que identfica el Pais. + * @return tgeneCountry + * @throws Exception + */ + public TgeneCountry getTgeneCountry(String countrycode) throws Exception { + TgeneCountry tgeneCountry = null; + tgeneCountry = (TgeneCountry) PersistenceHelper.getSession().get(TgeneCountry.class, countrycode); + return tgeneCountry; + } + + + + /** + * Metodo que entrega datos de una Provincia definida en TgeneProvince. + * @param countrycode Codigo del pais al cual pertenece la Provincia. + * @param provincecode Codigo que identfica la Provincia. + * @return tgeneProvince + * @throws Exception + */ + public TgeneProvince getTgeneProvince(String countrycode, String provincecode) throws Exception { + TgeneProvinceKey tgeneProvinceKey = new TgeneProvinceKey(countrycode, provincecode); + TgeneProvince tgeneProvince = null; + tgeneProvince = (TgeneProvince) PersistenceHelper.getSession().get(TgeneProvince.class, tgeneProvinceKey); + return tgeneProvince; + } + + + + /** + * Metodo que devuelve un objeto de tipo TgeneCanton + * @param countrycode Codigo de pais + * @param provincecode Codigo provincia + * @param cantoncode Codigo canton + * @return + * @throws Exception + */ + public TgeneCanton getTgeneCanton(String countrycode, String provincecode, String cantoncode) throws Exception { + TgeneCantonKey tgeneCantonKey = new TgeneCantonKey(countrycode, provincecode, cantoncode); + TgeneCanton tgeneCanton = null; + tgeneCanton = (TgeneCanton) PersistenceHelper.getSession().get(TgeneCanton.class, tgeneCantonKey); + return tgeneCanton; + } + + + + /** + * Metodo que entrega datos de una Ciudad definida en TgeneCity. + * @param countrycode Codigo del pais al cual perteneces la Ciudad. + * @param provincecode Codigo de la provincia al cual pertenece la Ciudad. + * @param cantoncode Codigo del canton de la ciudad + * @param citycode Codigo que identfica la Ciudad. + * @return tgeneCity + * @throws Exception + */ + public TgeneCity getTgeneCity(String countrycode, String provincecode, String cantoncode, String citycode) throws Exception { + TgeneCityKey tgeneCityKey = new TgeneCityKey(countrycode, provincecode, cantoncode, citycode); + TgeneCity tgeneCity = null; + tgeneCity = (TgeneCity) PersistenceHelper.getSession().get(TgeneCity.class, tgeneCityKey); + return tgeneCity; + } + + + + /** + * Metodo que entrega datos de una Parroquia definida en TgeneParroquia. + * @param countrycode Codigo del pais al cual perteneces la Ciudad. + * @param provincecode Codigo de la provincia al cual pertenece la Ciudad. + * @param cantoncode Codigo del canton de la ciudad + * @param parroquiacode Codigo que identfica a la parroquia. + * @return tgeneCity + * @throws Exception + */ + public TgeneParroquia getTgeneParroquia(String countrycode, String provincecode, String cantoncode, String parroquiacode) throws Exception { + TgeneParroquiaKey tgeneParroquiaKey = new TgeneParroquiaKey(countrycode, provincecode, cantoncode, parroquiacode); + TgeneParroquia tgeneParroquia = null; + tgeneParroquia = (TgeneParroquia) PersistenceHelper.getSession().get(TgeneParroquia.class, tgeneParroquiaKey); + return tgeneParroquia; + } + +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/.svn/entries b/base/business/person/src/main/java/com/fp/person/rules/.svn/entries new file mode 100644 index 0000000..7a61463 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/person/src/main/java/com/fp/person/rules +svn://172.17.26.185/COMACO + + + +2015-09-21T11:33:05.809667Z +4285 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +query +dir + +save +dir + diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/.svn/entries b/base/business/person/src/main/java/com/fp/person/rules/query/.svn/entries new file mode 100644 index 0000000..7159c09 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/.svn/entries @@ -0,0 +1,201 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/person/src/main/java/com/fp/person/rules/query +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +CountryProvinceCity.java +file + + + + +2022-07-28T03:40:41.891799Z +0d7ba27d46c86a724e51d73166005ebf +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +12029 + +PhonesPerClient.java +file + + + + +2022-07-28T03:40:41.891799Z +b1f63666bf7614074cbe969141d67e41 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1792 + +DirectionFull.java +file + + + + +2022-07-28T03:40:41.891799Z +ac92e1cd3f51cb59d78dde1bf2efed95 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3246 + +PersonName.java +file + + + + +2022-07-28T03:40:41.891799Z +343fc2a94556fbcd533d2376610c4aa6 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +11672 + +ActivityEconomic.java +file + + + + +2022-07-28T03:40:41.892799Z +e95b2bc109983448531a408f46539cf9 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5493 + +code +dir + diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/.svn/text-base/ActivityEconomic.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/query/.svn/text-base/ActivityEconomic.java.svn-base new file mode 100644 index 0000000..dbd71c7 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/.svn/text-base/ActivityEconomic.java.svn-base @@ -0,0 +1,120 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.person.rules.query; + +import com.fp.bpm.query.Query; +import com.fp.common.helper.CalculationBase; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.APPDates; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TgeneActivity; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; + +/** + * Clase que retorna la descripcion del sector de la actividad econmica + * + * @author jarias + */ +public class ActivityEconomic extends QueryRule { + + private String activitycodedesc = "activitycodedesc"; + private String segmentcode = "segmentcode"; + private String segmentcatalogdesc = "segmentcatalogdesc"; + private String expirationdateinfo = "expirationdateinfo"; + + /** + * Metodo que agrega la descripcion de la actividad economica, el sectoy y descripcion del sector asociadas a una + * persona, cuando una consulta es requerida. Adems verifica la validz de la informacin del cliente. + * + * @param pQueryRequest + * @return pQueryRequest + * @throws Exception + */ + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query query = new Query(); + query.process(pQueryRequest); + Object people = (Object) response.get("TCUSTPERSONDETAIL"); + completeSector(people); + expirationInfo(people, pQueryRequest); + return pQueryRequest; + } + + /** + * Metodo que completa la descripcion de la actividad el sector y la descripcin del sector + * + * @param detail + * @throws Exception + */ + private void completeSector(Object detail) throws Exception { + if (detail == null) { + return; + } + TcustPersonDetail cusDetail = (TcustPersonDetail) detail; + if (cusDetail.getActivitycode() != null) { + TgeneActivity activity = TgeneActivity.find(PersistenceHelper.getEntityManager(), cusDetail.getActivitycode()); + if (activity != null) { + cusDetail.addAddtionalInfo(activitycodedesc, activity.getDescription()); + cusDetail.addAddtionalInfo(segmentcode, activity.getSegmenttypecatalog()); + TgeneCatalogDetailKey catalogDetailKey = new TgeneCatalogDetailKey(activity.getSegmenttypecatalog(), "SEGMENTTYPE"); + TgeneCatalogDetail detailcatalog = TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), catalogDetailKey); + if (detailcatalog != null) { + cusDetail.addAddtionalInfo(segmentcatalogdesc, detailcatalog.getDescription()); + } else { + cusDetail.addAddtionalInfo(segmentcatalogdesc, null); + } + } else { + cusDetail.addAddtionalInfo(activitycodedesc, null); + cusDetail.addAddtionalInfo(segmentcode, null); + } + } else { + cusDetail.addAddtionalInfo(activitycodedesc, null); + cusDetail.addAddtionalInfo(segmentcode, null); + cusDetail.addAddtionalInfo(segmentcatalogdesc, null); + } + + } + + /** + * Mtodo que verifica la validez de la informacin del cliente segun la ultima actualizacin + * + * @param tcustPerson + * @param pQueryRequest + * @throws Exception + */ + private void expirationInfo(Object tcustPerson, QueryRequest pQueryRequest) throws Exception { + TcustPersonDetail tcustPersonDetail = (TcustPersonDetail) tcustPerson; + if (tcustPersonDetail == null) { + return; + } + if (tcustPersonDetail.getPk().getPersoncode() != null) { + TgeneParametersKey tgeneParametersKey = new TgeneParametersKey("EXPIRATIONDATE", tcustPersonDetail.getCompanycode()); + TgeneParameters tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), tgeneParametersKey); + if (tgeneParameters.getNumbervalue() != null) { + APPDates fechaVigenteRegistro = new APPDates(tcustPersonDetail.getDatefrom().toString().substring(0, 10), CalculationBase.B365365); + TgeneAccountingDateBranch db = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pQueryRequest.getCompany(), 0); + APPDates fechaActual = new APPDates(db.getWorkingdate(), CalculationBase.B365365); + if (fechaActual.compareTo(fechaVigenteRegistro) >= 0) { + Integer days = fechaActual.substract(fechaVigenteRegistro); + if (days > tgeneParameters.getNumbervalue().intValue()) { + tcustPersonDetail.addAddtionalInfo(expirationdateinfo, "Y"); + } else { + tcustPersonDetail.addAddtionalInfo(expirationdateinfo, "N"); + } + } else { + tcustPersonDetail.addAddtionalInfo(expirationdateinfo, "N"); + } + } + } + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/.svn/text-base/CountryProvinceCity.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/query/.svn/text-base/CountryProvinceCity.java.svn-base new file mode 100644 index 0000000..d9de51f --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/.svn/text-base/CountryProvinceCity.java.svn-base @@ -0,0 +1,202 @@ +package com.fp.person.rules.query; + +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.people.TcustPeople; +import com.fp.persistence.pcustomer.people.TcustPeopleRealAssets; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.person.db.DataHelper; +import java.util.List; + +/** + * Clase que se encarga de completar el nombre de pais, provincia y ciudad asociados a una persona. + * @author Wilson Sigcho + * @version 2.1 + */ +public class CountryProvinceCity extends QueryRule { // NOPMD by jorge on 12/10/10 22:28 + + private String country = "countrydesc"; + private String province = "provincedesc"; + private String canton = "cantondesc"; + private String city = "citydesc"; + private String parroquia = "parroquiadesc"; + private String nacionality ="nacionalitydesc"; + + /** + * Metodo que agrega el nombre de pais, provincia y cuidad asociadas a una persona, cuando una consulta es requerida. + * @param pQueryRequest Objeto que posee la consulta requerida. + * @return pQueryRequest + * @throws Exception + */ + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + Object people = (Object) response.get("TCUSTPEOPLE"); + List address = (List) response.get("TCUSTPERSONADDRESS"); + List realassets = (List) response.get("TCUSTPEOPLEREALASSETS"); + this.completePeople(people); + this.completeAddress(address); + this.completeRealAssets(realassets); + return pQueryRequest; + } + + /** + * Metodo que se encraga de completar el nombre de pais, provincia, cuidad y parroquia de nacimiento de una persona. + * @param detail Objeto que posee un registro consultado en la tabla TcustPeople. + * @throws Exception + */ + private void completePeople(Object detail) throws Exception { // NOPMD by jorge on 12/10/10 22:27 + if (detail == null) { + return; + } + TcustPeople tcustPeople = (TcustPeople) detail; + if (tcustPeople.getBirthcountrycode() != null) { + TgeneCountry tgeneCountry = DataHelper.getInstance().getTgeneCountry(tcustPeople.getBirthcountrycode()); + tcustPeople.addAddtionalInfo(country, tgeneCountry.getDescription()); + } else { + tcustPeople.addAddtionalInfo(country, null); + } + if (tcustPeople.getBirthcountrycode() != null && tcustPeople.getBirthprovincecode() != null) { + TgeneProvince tgeneProvince = DataHelper.getInstance().getTgeneProvince(tcustPeople.getBirthcountrycode(), tcustPeople.getBirthprovincecode()); + tcustPeople.addAddtionalInfo(province, tgeneProvince.getDescription()); + } else { + tcustPeople.addAddtionalInfo(province, null); + } + if (tcustPeople.getBirthcountrycode() != null && tcustPeople.getBirthprovincecode() != null && tcustPeople.getBirthcantoncode() != null) { + TgeneCanton tgeneCanton = DataHelper.getInstance().getTgeneCanton(tcustPeople.getBirthcountrycode(), + tcustPeople.getBirthprovincecode(), tcustPeople.getBirthcantoncode()); + tcustPeople.addAddtionalInfo(canton, tgeneCanton.getDescription()); + } else { + tcustPeople.addAddtionalInfo(canton, null); + } + if (tcustPeople.getBirthcountrycode() != null && tcustPeople.getBirthprovincecode() != null + && tcustPeople.getBirthcantoncode() != null && tcustPeople.getBirthcitycode() != null) { + TgeneCity tgeneCity = DataHelper.getInstance().getTgeneCity(tcustPeople.getBirthcountrycode(), + tcustPeople.getBirthprovincecode(), tcustPeople.getBirthcantoncode(), tcustPeople.getBirthcitycode()); + tcustPeople.addAddtionalInfo(city, tgeneCity.getDescription()); + } else { + tcustPeople.addAddtionalInfo(city, null); + } + if (tcustPeople.getBirthcountrycode() != null && tcustPeople.getBirthprovincecode() != null + && tcustPeople.getBirthcantoncode() != null && tcustPeople.getBirthparroquiacode() != null) { + TgeneParroquia tgeneParroquia = DataHelper.getInstance().getTgeneParroquia(tcustPeople.getBirthcountrycode(), + tcustPeople.getBirthprovincecode(), tcustPeople.getBirthcantoncode(), tcustPeople.getBirthparroquiacode()); + tcustPeople.addAddtionalInfo(parroquia, tgeneParroquia.getDescription()); + } else { + tcustPeople.addAddtionalInfo(parroquia, null); + } + if (tcustPeople.getNacionality() != null) { + TgeneCountry tgeneCountry = DataHelper.getInstance().getTgeneCountry(tcustPeople.getNacionality()); + tcustPeople.addAddtionalInfo(nacionality, tgeneCountry.getCitizenship()); + } else { + tcustPeople.addAddtionalInfo(nacionality, null); + } + } + + /** + * Metodo que se encraga de completar el nombre de pais, provincia y cuidad asociados a direcciones de una persona. + * @param lDetail Objeto que posee una lista de los registros consultados en la tabla TcustPersonAddress. + * @throws Exception + */ + private void completeAddress(List lDetail) throws Exception { // NOPMD by jorge on 12/10/10 22:27 + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPersonAddress tcustPersonAddress = (TcustPersonAddress) object; + if (tcustPersonAddress.getCountrycode() != null) { + TgeneCountry tgeneCountry = DataHelper.getInstance().getTgeneCountry(tcustPersonAddress.getCountrycode()); + tcustPersonAddress.addAddtionalInfo(country, tgeneCountry.getDescription()); + } else { + tcustPersonAddress.addAddtionalInfo(country, null); + } + if (tcustPersonAddress.getCountrycode() != null && tcustPersonAddress.getProvincecode() != null) { + TgeneProvince tgeneProvince = DataHelper.getInstance().getTgeneProvince(tcustPersonAddress.getCountrycode(), + tcustPersonAddress.getProvincecode()); + tcustPersonAddress.addAddtionalInfo(province, tgeneProvince.getDescription()); + } else { + tcustPersonAddress.addAddtionalInfo(province, null); + } + if (tcustPersonAddress.getCountrycode() != null && tcustPersonAddress.getProvincecode() != null + && tcustPersonAddress.getCantoncode() != null) { + TgeneCanton tgeneCanton = DataHelper.getInstance().getTgeneCanton(tcustPersonAddress.getCountrycode(), + tcustPersonAddress.getProvincecode(), tcustPersonAddress.getCantoncode()); + tcustPersonAddress.addAddtionalInfo(canton, tgeneCanton.getDescription()); + } else { + tcustPersonAddress.addAddtionalInfo(canton, null); + } + if (tcustPersonAddress.getCountrycode() != null && tcustPersonAddress.getProvincecode() != null + && tcustPersonAddress.getCantoncode() != null && tcustPersonAddress.getCitycode() != null) { + TgeneCity tgeneCity = DataHelper.getInstance().getTgeneCity(tcustPersonAddress.getCountrycode(), tcustPersonAddress.getProvincecode(), tcustPersonAddress.getCantoncode(), tcustPersonAddress.getCitycode()); + tcustPersonAddress.addAddtionalInfo(city, tgeneCity.getDescription()); + } else { + tcustPersonAddress.addAddtionalInfo(city, null); + } + } + } + + /** + * Metodo que se encraga de completar el nombre de pais, provincia, parroquia y cuidad de inmuebles asociados a una persona. + * @param lDetail Objeto que posee una lista de los registros consultados en la tabla TcustPeopleRealAssets. + * @throws Exception + */ + private void completeRealAssets(List lDetail) throws Exception { // NOPMD by jorge on 12/10/10 22:27 + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleRealAssets tcustPeopleRealAssets = (TcustPeopleRealAssets) object; + if (tcustPeopleRealAssets.getCountrycode() != null) { + TgeneCountry tgeneCountry = DataHelper.getInstance().getTgeneCountry(tcustPeopleRealAssets.getCountrycode()); + tcustPeopleRealAssets.addAddtionalInfo(country, tgeneCountry.getDescription()); + } else { + tcustPeopleRealAssets.addAddtionalInfo(country, null); + } + if (tcustPeopleRealAssets.getCountrycode() != null && tcustPeopleRealAssets.getProvincecode() != null) { + TgeneProvince tgeneProvince = DataHelper.getInstance().getTgeneProvince(tcustPeopleRealAssets.getCountrycode(), tcustPeopleRealAssets.getProvincecode()); + tcustPeopleRealAssets.addAddtionalInfo(province, tgeneProvince.getDescription()); + } else { + tcustPeopleRealAssets.addAddtionalInfo(province, null); + } + if (tcustPeopleRealAssets.getCountrycode() != null && tcustPeopleRealAssets.getProvincecode() != null + && tcustPeopleRealAssets.getCantoncode() != null) { + TgeneCanton tgeneCanton = DataHelper.getInstance().getTgeneCanton(tcustPeopleRealAssets.getCountrycode(), + tcustPeopleRealAssets.getProvincecode(), tcustPeopleRealAssets.getCantoncode()); + tcustPeopleRealAssets.addAddtionalInfo(canton, tgeneCanton.getDescription()); + } else { + tcustPeopleRealAssets.addAddtionalInfo(canton, null); + } + if (tcustPeopleRealAssets.getCountrycode() != null && tcustPeopleRealAssets.getProvincecode() != null + && tcustPeopleRealAssets.getCantoncode() != null && tcustPeopleRealAssets.getCitycode() != null) { + TgeneCity tgeneCity = DataHelper.getInstance().getTgeneCity(tcustPeopleRealAssets.getCountrycode(), + tcustPeopleRealAssets.getProvincecode(), tcustPeopleRealAssets.getCantoncode(), tcustPeopleRealAssets.getCitycode()); + tcustPeopleRealAssets.addAddtionalInfo(city, tgeneCity.getDescription()); + } else { + tcustPeopleRealAssets.addAddtionalInfo(city, null); + } + if (tcustPeopleRealAssets.getCountrycode() != null && tcustPeopleRealAssets.getProvincecode() != null + && tcustPeopleRealAssets.getCantoncode() != null && tcustPeopleRealAssets.getParroquiacode() != null) { + TgeneParroquia tgeneParroquia = DataHelper.getInstance().getTgeneParroquia(tcustPeopleRealAssets.getCountrycode(), + tcustPeopleRealAssets.getProvincecode(), tcustPeopleRealAssets.getCantoncode(), tcustPeopleRealAssets.getParroquiacode()); + tcustPeopleRealAssets.addAddtionalInfo(parroquia, tgeneParroquia.getDescription()); + } else { + tcustPeopleRealAssets.addAddtionalInfo(parroquia, null); + } + if (tcustPeopleRealAssets.getMortgagepersoncode() != null) { + TcustPersonDetail tcustPersonDetail = DataHelper.getInstance().getTcustPersonDetail(tcustPeopleRealAssets.getMortgagepersoncode()); + tcustPeopleRealAssets.addAddtionalInfo("name", tcustPersonDetail.getName()); + } else { + tcustPeopleRealAssets.addAddtionalInfo("name", null); + } + } + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/.svn/text-base/DirectionFull.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/query/.svn/text-base/DirectionFull.java.svn-base new file mode 100644 index 0000000..20803ad --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/.svn/text-base/DirectionFull.java.svn-base @@ -0,0 +1,91 @@ +package com.fp.person.rules.query; + +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import java.util.List; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; + +/** + * + * @author hinga + */ +public class DirectionFull extends QueryRule { + + private String addressaux = "addressaux"; + + /** + * Metodo que entrega la direccion completa (concatenado) + * + * @param pQueryRequest Objeto que posee la consulta requerida. + * @return + * @throws Exception + */ + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List lovDirect = (List) response.get("TCUSTPERSONADDRESSLOVFULL"); + this.completeAddressJob(lovDirect); + if (lovDirect == null || (lovDirect != null && lovDirect.isEmpty())) { + return pQueryRequest; + } + return pQueryRequest; + } + + /** + * Metodo q se encarga de concatenar la direccion en un solo campo + * + * @param lovDirection objeto que posee una lista de registros consultados + * de tcustPersonAddress + * @throws Exception + */ + protected void completeAddressJob(List lovDirection) throws Exception { + + for (Object addre : lovDirection) { + TcustPersonAddress tcustPersonAddress = (TcustPersonAddress) addre; + tcustPersonAddress.addAddtionalInfo(addressaux, DirectionFull.getFullAddress(tcustPersonAddress)); + } + } + + /** + * Metodo que se encarga de armar la direccion dada la direccion + * + * @param tcustPersonAddress + * @return + */ + public static String getFullAddress(TcustPersonAddress tcustPersonAddress) { + if (tcustPersonAddress == null) { + return null; + } else if (tcustPersonAddress.getAddresstypecatalog() != null + && tcustPersonAddress.getAddresstypecatalog().compareTo("3") == 0) { + return tcustPersonAddress.getAddress(); + } else { + String newaddress = ""; + if (tcustPersonAddress.getAddress() != null) { + newaddress += tcustPersonAddress.getAddress(); + } + if (tcustPersonAddress.getStreetnumber() != null) { + newaddress += " " + tcustPersonAddress.getStreetnumber(); + } + if(tcustPersonAddress.getDepartment()!=null) + { + newaddress +=" ("+tcustPersonAddress.getDepartment()+")"; + } + if (tcustPersonAddress.getStreet() != null) { + newaddress += " " + tcustPersonAddress.getStreet(); + } + if (tcustPersonAddress.getUrbanization() != null) { + newaddress += " /" + tcustPersonAddress.getUrbanization(); + } + if (tcustPersonAddress.getRemark() != null) { + newaddress += ", " + tcustPersonAddress.getRemark() ; + } + if (newaddress.compareTo("") == 0) { + newaddress = null; + } + return newaddress; + } + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/.svn/text-base/PersonName.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/query/.svn/text-base/PersonName.java.svn-base new file mode 100644 index 0000000..df820ef --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/.svn/text-base/PersonName.java.svn-base @@ -0,0 +1,264 @@ +package com.fp.person.rules.query; + +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.company.TcustFamiliarlLink; +import com.fp.persistence.pcustomer.company.TcustLegalLink; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonAddressKey; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.people.TcustPeopleJob; +import com.fp.persistence.pcustomer.people.TcustPeopleOtherAssets; +import com.fp.persistence.pcustomer.people.TcustPeopleTradereferences; +import com.fp.persistence.pcustomer.people.TcustPeopleVehicle; +import com.fp.persistence.pgeneral.gene.TgeneAccountRelationship; +import com.fp.persistence.pgeneral.gene.TgeneCompany; +import com.fp.persistence.pgeneral.gene.TgeneSolicitudeRelationship; +import com.fp.person.db.DataHelper; +import java.util.List; + +/** + * Clase que se encarga de completar el nombre de una persona. + * + * @author Wilson Sigcho + * @version 2.1 + */ +public class PersonName extends QueryRule { + + private String name = "name"; + private String expiratedesignation = "expiratedesignation"; + + /** + * Metodo que agrega el nombre de una persona, cuando una consulta es requerida. + * + * @param pQueryRequest Objeto que posee la consulta requerida. + * @return pQueryRequest + * @throws Exception + */ + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List legallink = (List) response.get("TCUSTLEGALLINK"); + List familiarlink = (List) response.get("TCUSTFAMILIARLLINK"); + List genecompany = (List) response.get("TGENECOMPANYLOV"); + List jobs = (List) response.get("TCUSTPEOPLEJOB"); + List vehicles = (List) response.get("TCUSTPEOPLEVEHICLE"); + List otherassets = (List) response.get("TCUSTPEOPLEOTHERASSETS"); + List tradereferences = (List) response.get("TCUSTPEOPLETRADEREFERENCES"); + List relationship = (List) response.get("TGENESOLICITUDERELATIONSHIP"); + List accountrelationship = (List) response.get("TGENEACCOUNTRELATIONSHIP"); + this.completeLegalLink(legallink); + this.completeFamiliarlLink(familiarlink); + this.completeGeneCompany(genecompany); + this.completeJob(jobs); + this.completeVehicles(vehicles); + this.completeOtherAssets(otherassets); + this.completeTradeReferences(tradereferences); + this.completeSolicitudeRealtionShip(relationship); + this.completeAccountRelationShip(accountrelationship); + return pQueryRequest; + } + + /** + * Metodo que se encraga de completar el nombre de una persona, en la tabla TcustLegalLink. + * + * @param lDetail Objeto que posee una lista de los registros consultados en la tabla TcustLegalLink. + * @throws Exception + */ + private void completeLegalLink(List lDetail) throws Exception { + if (lDetail == null) { + return; + } + for (Object obj : lDetail) { + TcustLegalLink tcustLegalLink = (TcustLegalLink) obj; + if (tcustLegalLink.getPk().getLinkpersoncode() != null) { + TcustPersonDetail tcustPersonDetail = DataHelper.getInstance().getTcustPersonDetail(tcustLegalLink.getPk().getLinkpersoncode()); + tcustLegalLink.addAddtionalInfo(name, tcustPersonDetail.getName()); + } else { + tcustLegalLink.addAddtionalInfo(name, null); + } + } + } + + /** + * Metodo que se encraga de completar el nombre de una persona, en la tabla TcustFamiliarlLink. + * + * @param lDetail Objeto que posee una lista de los registros consultados en la tabla TcustFamiliarlLink. + * @throws Exception + */ + private void completeFamiliarlLink(List lDetail) throws Exception { + if (lDetail == null) { + return; + } + for (Object obj : lDetail) { + TcustFamiliarlLink tcustFamiliarlLink = (TcustFamiliarlLink) obj; + if (tcustFamiliarlLink.getPk().getLinkpersoncode() != null) { + TcustPersonDetail tcustPersonDetail = DataHelper.getInstance().getTcustPersonDetail(tcustFamiliarlLink.getPk().getLinkpersoncode()); + tcustFamiliarlLink.addAddtionalInfo(name, tcustPersonDetail.getName()); + } else { + tcustFamiliarlLink.addAddtionalInfo(name, null); + } + } + } + + /** + * Metodo que se encraga de completar el nombre de una persona, en la tabla TgeneCompany. + * + * @param lDetail Objeto que posee una lista de los registros consultados en la tabla TgeneCompany. + * @throws Exception + */ + private void completeGeneCompany(List lDetail) throws Exception { + if (lDetail == null) { + return; + } + for (Object obj : lDetail) { + TgeneCompany tgeneCompany = (TgeneCompany) obj; + if (tgeneCompany.getPersoncode() != null) { + TcustPersonDetail tcustPersonDetail = DataHelper.getInstance().getTcustPersonDetail(tgeneCompany.getPersoncode()); + tgeneCompany.addAddtionalInfo(name, tcustPersonDetail.getName()); + } else { + tgeneCompany.addAddtionalInfo(name, null); + } + } + } + + /** + * Metodo que se encarga de completar el nombre del deunio de la empresa + * + * @param lDetail + * @throws Exception + */ + private void completeJob(List lDetail) throws Exception { + if (lDetail == null) { + return; + } + for (Object obj : lDetail) { + TcustPeopleJob tcustPeopleJob = (TcustPeopleJob) obj; + if (tcustPeopleJob != null) { + if (tcustPeopleJob.getPk().getPersoncode() != null) { + TcustPersonDetail tcustPersonDetail = DataHelper.getInstance().getTcustPersonDetail(tcustPeopleJob.getPk().getPersoncode()); + tcustPeopleJob.addAddtionalInfo(name, tcustPersonDetail.getName()); + } else { + tcustPeopleJob.addAddtionalInfo(name, null); + } + if (tcustPeopleJob.getPk().getPersoncode() != null && tcustPeopleJob.getAddress() != null) { + TcustPersonAddressKey tcustPersonAddressKey = new TcustPersonAddressKey(tcustPeopleJob.getPk().getPersoncode(), tcustPeopleJob.getAddress(), FormatDates.getDefaultExpiryTimestamp()); + TcustPersonAddress tcustPersonAddress = TcustPersonAddress.find(PersistenceHelper.getEntityManager(), tcustPersonAddressKey); + tcustPeopleJob.addAddtionalInfo("addressaux", DirectionFull.getFullAddress(tcustPersonAddress)); + } else { + tcustPeopleJob.addAddtionalInfo("addressaux", null); + } + } + } + } + + /** + * Metodo que se encarga de completar el nombre del beneficiario de la prenda del vehiculo + * + * @param lDetail + * @throws Exception + */ + private void completeVehicles(List lDetail) throws Exception { + if (lDetail == null) { + return; + } + for (Object obj : lDetail) { + TcustPeopleVehicle tcustPeopleVehicle = (TcustPeopleVehicle) obj; + if (tcustPeopleVehicle.getPledgedpersoncode() != null) { + TcustPersonDetail tcustPersonDetail = DataHelper.getInstance().getTcustPersonDetail(tcustPeopleVehicle.getPledgedpersoncode()); + tcustPeopleVehicle.addAddtionalInfo(name, tcustPersonDetail.getName()); + } else { + tcustPeopleVehicle.addAddtionalInfo(name, null); + } + } + } + + /** + * Metodo que se encarga de completar el nombre del beneficiario de la prenda del vehiculo + * + * @param lDetail + * @throws Exception + */ + private void completeOtherAssets(List lDetail) throws Exception { + if (lDetail == null) { + return; + } + for (Object obj : lDetail) { + TcustPeopleOtherAssets tcustPeopleOtherAssets = (TcustPeopleOtherAssets) obj; + if (tcustPeopleOtherAssets.getMortgagepersoncode() != null) { + TcustPersonDetail tcustPersonDetail = DataHelper.getInstance().getTcustPersonDetail(tcustPeopleOtherAssets.getMortgagepersoncode()); + tcustPeopleOtherAssets.addAddtionalInfo(name, tcustPersonDetail.getName()); + } else { + tcustPeopleOtherAssets.addAddtionalInfo(name, null); + } + } + } + + /** + * Metodo que se encarga de completar el nombre del vendedor en referencias comerciales + * + * @param lDetail + * @throws Exception + */ + private void completeTradeReferences(List lDetail) throws Exception { + if (lDetail == null) { + return; + } + for (Object obj : lDetail) { + TcustPeopleTradereferences tcustPeopleTradereferences = (TcustPeopleTradereferences) obj; + if (tcustPeopleTradereferences.getTradepersoncode() != null) { + TcustPersonDetail tcustPersonDetail = DataHelper.getInstance().getTcustPersonDetail(tcustPeopleTradereferences.getTradepersoncode()); + tcustPeopleTradereferences.addAddtionalInfo(name, tcustPersonDetail.getName()); + } else { + tcustPeopleTradereferences.addAddtionalInfo(name, null); + } + } + } + + /** + * Metodo que completa el nombre de la tabla tgenesolicituderelationship + * + * @param lDetail + * @throws Exception + */ + private void completeSolicitudeRealtionShip(List lDetail) throws Exception { + if (lDetail == null) { + return; + } + for (Object obj : lDetail) { + TgeneSolicitudeRelationship tgeneSolicitudeRelationship = (TgeneSolicitudeRelationship) obj; + if (tgeneSolicitudeRelationship.getPk().getPersoncode() != null) { + TcustPersonDetail tcustPersonDetail = DataHelper.getInstance().getTcustPersonDetail(tgeneSolicitudeRelationship.getPk().getPersoncode()); + tgeneSolicitudeRelationship.addAddtionalInfo(name, tcustPersonDetail.getName()); + } else { + tgeneSolicitudeRelationship.addAddtionalInfo(name, null); + } + } + } + + /** + * Metodo que completa el nombre de la tabla tgeneaccountrelationship + * + * @param lDetail + * @throws Exception + */ + private void completeAccountRelationShip(List lDetail) throws Exception { + if (lDetail == null) { + return; + } + for (Object obj : lDetail) { + TgeneAccountRelationship tgeneAccountRelationship = (TgeneAccountRelationship) obj; + if (tgeneAccountRelationship.getPk().getPersoncode() != null) { + TcustPersonDetail tcustPersonDetail = DataHelper.getInstance().getTcustPersonDetail(tgeneAccountRelationship.getPk().getPersoncode()); + tgeneAccountRelationship.addAddtionalInfo(name, tcustPersonDetail.getName()); + } else { + tgeneAccountRelationship.addAddtionalInfo(name, null); + } + } + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/.svn/text-base/PhonesPerClient.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/query/.svn/text-base/PhonesPerClient.java.svn-base new file mode 100644 index 0000000..068172e --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/.svn/text-base/PhonesPerClient.java.svn-base @@ -0,0 +1,45 @@ +package com.fp.person.rules.query; + +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.person.db.DataHelper; +import java.util.List; + +/** + * Clase que se encarga de completar la direccion del telefono. + * @author Wilson Sigcho + * @version 2.1 + */ +public class PhonesPerClient extends QueryRule { + + /** + * Metodo que agrega la direccion asociada a un telefono, cuando una consulta es requerida. + * @param pQueryRequest Objeto que posee la consulta requerida. + * @return pQueryRequest + * @throws Exception + */ + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List lobjects = (List) response.get("TCUSTPERSONPHONELOV"); + if (lobjects == null) { + return pQueryRequest; + } + for (Object obj : lobjects) { + TcustPersonPhone tcustPersonPhone = (TcustPersonPhone) obj; + if (tcustPersonPhone.getPk().getPersoncode() != null + && tcustPersonPhone.getAddressnumber() != null) { + TcustPersonAddress tcustPersonAddress = DataHelper.getInstance().getTcustPersonAddress(tcustPersonPhone.getPk().getPersoncode(), tcustPersonPhone.getAddressnumber()); + tcustPersonPhone.addAddtionalInfo("addressdesc", tcustPersonAddress.getAddress()); + } else { + tcustPersonPhone.addAddtionalInfo("addressdesc", null); + } + } + return pQueryRequest; + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/ActivityEconomic.java b/base/business/person/src/main/java/com/fp/person/rules/query/ActivityEconomic.java new file mode 100644 index 0000000..dbd71c7 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/ActivityEconomic.java @@ -0,0 +1,120 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.person.rules.query; + +import com.fp.bpm.query.Query; +import com.fp.common.helper.CalculationBase; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.APPDates; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TgeneActivity; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailKey; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; + +/** + * Clase que retorna la descripcion del sector de la actividad econmica + * + * @author jarias + */ +public class ActivityEconomic extends QueryRule { + + private String activitycodedesc = "activitycodedesc"; + private String segmentcode = "segmentcode"; + private String segmentcatalogdesc = "segmentcatalogdesc"; + private String expirationdateinfo = "expirationdateinfo"; + + /** + * Metodo que agrega la descripcion de la actividad economica, el sectoy y descripcion del sector asociadas a una + * persona, cuando una consulta es requerida. Adems verifica la validz de la informacin del cliente. + * + * @param pQueryRequest + * @return pQueryRequest + * @throws Exception + */ + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query query = new Query(); + query.process(pQueryRequest); + Object people = (Object) response.get("TCUSTPERSONDETAIL"); + completeSector(people); + expirationInfo(people, pQueryRequest); + return pQueryRequest; + } + + /** + * Metodo que completa la descripcion de la actividad el sector y la descripcin del sector + * + * @param detail + * @throws Exception + */ + private void completeSector(Object detail) throws Exception { + if (detail == null) { + return; + } + TcustPersonDetail cusDetail = (TcustPersonDetail) detail; + if (cusDetail.getActivitycode() != null) { + TgeneActivity activity = TgeneActivity.find(PersistenceHelper.getEntityManager(), cusDetail.getActivitycode()); + if (activity != null) { + cusDetail.addAddtionalInfo(activitycodedesc, activity.getDescription()); + cusDetail.addAddtionalInfo(segmentcode, activity.getSegmenttypecatalog()); + TgeneCatalogDetailKey catalogDetailKey = new TgeneCatalogDetailKey(activity.getSegmenttypecatalog(), "SEGMENTTYPE"); + TgeneCatalogDetail detailcatalog = TgeneCatalogDetail.find(PersistenceHelper.getEntityManager(), catalogDetailKey); + if (detailcatalog != null) { + cusDetail.addAddtionalInfo(segmentcatalogdesc, detailcatalog.getDescription()); + } else { + cusDetail.addAddtionalInfo(segmentcatalogdesc, null); + } + } else { + cusDetail.addAddtionalInfo(activitycodedesc, null); + cusDetail.addAddtionalInfo(segmentcode, null); + } + } else { + cusDetail.addAddtionalInfo(activitycodedesc, null); + cusDetail.addAddtionalInfo(segmentcode, null); + cusDetail.addAddtionalInfo(segmentcatalogdesc, null); + } + + } + + /** + * Mtodo que verifica la validez de la informacin del cliente segun la ultima actualizacin + * + * @param tcustPerson + * @param pQueryRequest + * @throws Exception + */ + private void expirationInfo(Object tcustPerson, QueryRequest pQueryRequest) throws Exception { + TcustPersonDetail tcustPersonDetail = (TcustPersonDetail) tcustPerson; + if (tcustPersonDetail == null) { + return; + } + if (tcustPersonDetail.getPk().getPersoncode() != null) { + TgeneParametersKey tgeneParametersKey = new TgeneParametersKey("EXPIRATIONDATE", tcustPersonDetail.getCompanycode()); + TgeneParameters tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), tgeneParametersKey); + if (tgeneParameters.getNumbervalue() != null) { + APPDates fechaVigenteRegistro = new APPDates(tcustPersonDetail.getDatefrom().toString().substring(0, 10), CalculationBase.B365365); + TgeneAccountingDateBranch db = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pQueryRequest.getCompany(), 0); + APPDates fechaActual = new APPDates(db.getWorkingdate(), CalculationBase.B365365); + if (fechaActual.compareTo(fechaVigenteRegistro) >= 0) { + Integer days = fechaActual.substract(fechaVigenteRegistro); + if (days > tgeneParameters.getNumbervalue().intValue()) { + tcustPersonDetail.addAddtionalInfo(expirationdateinfo, "Y"); + } else { + tcustPersonDetail.addAddtionalInfo(expirationdateinfo, "N"); + } + } else { + tcustPersonDetail.addAddtionalInfo(expirationdateinfo, "N"); + } + } + } + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/CountryProvinceCity.java b/base/business/person/src/main/java/com/fp/person/rules/query/CountryProvinceCity.java new file mode 100644 index 0000000..d9de51f --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/CountryProvinceCity.java @@ -0,0 +1,202 @@ +package com.fp.person.rules.query; + +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.people.TcustPeople; +import com.fp.persistence.pcustomer.people.TcustPeopleRealAssets; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.person.db.DataHelper; +import java.util.List; + +/** + * Clase que se encarga de completar el nombre de pais, provincia y ciudad asociados a una persona. + * @author Wilson Sigcho + * @version 2.1 + */ +public class CountryProvinceCity extends QueryRule { // NOPMD by jorge on 12/10/10 22:28 + + private String country = "countrydesc"; + private String province = "provincedesc"; + private String canton = "cantondesc"; + private String city = "citydesc"; + private String parroquia = "parroquiadesc"; + private String nacionality ="nacionalitydesc"; + + /** + * Metodo que agrega el nombre de pais, provincia y cuidad asociadas a una persona, cuando una consulta es requerida. + * @param pQueryRequest Objeto que posee la consulta requerida. + * @return pQueryRequest + * @throws Exception + */ + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + Object people = (Object) response.get("TCUSTPEOPLE"); + List address = (List) response.get("TCUSTPERSONADDRESS"); + List realassets = (List) response.get("TCUSTPEOPLEREALASSETS"); + this.completePeople(people); + this.completeAddress(address); + this.completeRealAssets(realassets); + return pQueryRequest; + } + + /** + * Metodo que se encraga de completar el nombre de pais, provincia, cuidad y parroquia de nacimiento de una persona. + * @param detail Objeto que posee un registro consultado en la tabla TcustPeople. + * @throws Exception + */ + private void completePeople(Object detail) throws Exception { // NOPMD by jorge on 12/10/10 22:27 + if (detail == null) { + return; + } + TcustPeople tcustPeople = (TcustPeople) detail; + if (tcustPeople.getBirthcountrycode() != null) { + TgeneCountry tgeneCountry = DataHelper.getInstance().getTgeneCountry(tcustPeople.getBirthcountrycode()); + tcustPeople.addAddtionalInfo(country, tgeneCountry.getDescription()); + } else { + tcustPeople.addAddtionalInfo(country, null); + } + if (tcustPeople.getBirthcountrycode() != null && tcustPeople.getBirthprovincecode() != null) { + TgeneProvince tgeneProvince = DataHelper.getInstance().getTgeneProvince(tcustPeople.getBirthcountrycode(), tcustPeople.getBirthprovincecode()); + tcustPeople.addAddtionalInfo(province, tgeneProvince.getDescription()); + } else { + tcustPeople.addAddtionalInfo(province, null); + } + if (tcustPeople.getBirthcountrycode() != null && tcustPeople.getBirthprovincecode() != null && tcustPeople.getBirthcantoncode() != null) { + TgeneCanton tgeneCanton = DataHelper.getInstance().getTgeneCanton(tcustPeople.getBirthcountrycode(), + tcustPeople.getBirthprovincecode(), tcustPeople.getBirthcantoncode()); + tcustPeople.addAddtionalInfo(canton, tgeneCanton.getDescription()); + } else { + tcustPeople.addAddtionalInfo(canton, null); + } + if (tcustPeople.getBirthcountrycode() != null && tcustPeople.getBirthprovincecode() != null + && tcustPeople.getBirthcantoncode() != null && tcustPeople.getBirthcitycode() != null) { + TgeneCity tgeneCity = DataHelper.getInstance().getTgeneCity(tcustPeople.getBirthcountrycode(), + tcustPeople.getBirthprovincecode(), tcustPeople.getBirthcantoncode(), tcustPeople.getBirthcitycode()); + tcustPeople.addAddtionalInfo(city, tgeneCity.getDescription()); + } else { + tcustPeople.addAddtionalInfo(city, null); + } + if (tcustPeople.getBirthcountrycode() != null && tcustPeople.getBirthprovincecode() != null + && tcustPeople.getBirthcantoncode() != null && tcustPeople.getBirthparroquiacode() != null) { + TgeneParroquia tgeneParroquia = DataHelper.getInstance().getTgeneParroquia(tcustPeople.getBirthcountrycode(), + tcustPeople.getBirthprovincecode(), tcustPeople.getBirthcantoncode(), tcustPeople.getBirthparroquiacode()); + tcustPeople.addAddtionalInfo(parroquia, tgeneParroquia.getDescription()); + } else { + tcustPeople.addAddtionalInfo(parroquia, null); + } + if (tcustPeople.getNacionality() != null) { + TgeneCountry tgeneCountry = DataHelper.getInstance().getTgeneCountry(tcustPeople.getNacionality()); + tcustPeople.addAddtionalInfo(nacionality, tgeneCountry.getCitizenship()); + } else { + tcustPeople.addAddtionalInfo(nacionality, null); + } + } + + /** + * Metodo que se encraga de completar el nombre de pais, provincia y cuidad asociados a direcciones de una persona. + * @param lDetail Objeto que posee una lista de los registros consultados en la tabla TcustPersonAddress. + * @throws Exception + */ + private void completeAddress(List lDetail) throws Exception { // NOPMD by jorge on 12/10/10 22:27 + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPersonAddress tcustPersonAddress = (TcustPersonAddress) object; + if (tcustPersonAddress.getCountrycode() != null) { + TgeneCountry tgeneCountry = DataHelper.getInstance().getTgeneCountry(tcustPersonAddress.getCountrycode()); + tcustPersonAddress.addAddtionalInfo(country, tgeneCountry.getDescription()); + } else { + tcustPersonAddress.addAddtionalInfo(country, null); + } + if (tcustPersonAddress.getCountrycode() != null && tcustPersonAddress.getProvincecode() != null) { + TgeneProvince tgeneProvince = DataHelper.getInstance().getTgeneProvince(tcustPersonAddress.getCountrycode(), + tcustPersonAddress.getProvincecode()); + tcustPersonAddress.addAddtionalInfo(province, tgeneProvince.getDescription()); + } else { + tcustPersonAddress.addAddtionalInfo(province, null); + } + if (tcustPersonAddress.getCountrycode() != null && tcustPersonAddress.getProvincecode() != null + && tcustPersonAddress.getCantoncode() != null) { + TgeneCanton tgeneCanton = DataHelper.getInstance().getTgeneCanton(tcustPersonAddress.getCountrycode(), + tcustPersonAddress.getProvincecode(), tcustPersonAddress.getCantoncode()); + tcustPersonAddress.addAddtionalInfo(canton, tgeneCanton.getDescription()); + } else { + tcustPersonAddress.addAddtionalInfo(canton, null); + } + if (tcustPersonAddress.getCountrycode() != null && tcustPersonAddress.getProvincecode() != null + && tcustPersonAddress.getCantoncode() != null && tcustPersonAddress.getCitycode() != null) { + TgeneCity tgeneCity = DataHelper.getInstance().getTgeneCity(tcustPersonAddress.getCountrycode(), tcustPersonAddress.getProvincecode(), tcustPersonAddress.getCantoncode(), tcustPersonAddress.getCitycode()); + tcustPersonAddress.addAddtionalInfo(city, tgeneCity.getDescription()); + } else { + tcustPersonAddress.addAddtionalInfo(city, null); + } + } + } + + /** + * Metodo que se encraga de completar el nombre de pais, provincia, parroquia y cuidad de inmuebles asociados a una persona. + * @param lDetail Objeto que posee una lista de los registros consultados en la tabla TcustPeopleRealAssets. + * @throws Exception + */ + private void completeRealAssets(List lDetail) throws Exception { // NOPMD by jorge on 12/10/10 22:27 + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleRealAssets tcustPeopleRealAssets = (TcustPeopleRealAssets) object; + if (tcustPeopleRealAssets.getCountrycode() != null) { + TgeneCountry tgeneCountry = DataHelper.getInstance().getTgeneCountry(tcustPeopleRealAssets.getCountrycode()); + tcustPeopleRealAssets.addAddtionalInfo(country, tgeneCountry.getDescription()); + } else { + tcustPeopleRealAssets.addAddtionalInfo(country, null); + } + if (tcustPeopleRealAssets.getCountrycode() != null && tcustPeopleRealAssets.getProvincecode() != null) { + TgeneProvince tgeneProvince = DataHelper.getInstance().getTgeneProvince(tcustPeopleRealAssets.getCountrycode(), tcustPeopleRealAssets.getProvincecode()); + tcustPeopleRealAssets.addAddtionalInfo(province, tgeneProvince.getDescription()); + } else { + tcustPeopleRealAssets.addAddtionalInfo(province, null); + } + if (tcustPeopleRealAssets.getCountrycode() != null && tcustPeopleRealAssets.getProvincecode() != null + && tcustPeopleRealAssets.getCantoncode() != null) { + TgeneCanton tgeneCanton = DataHelper.getInstance().getTgeneCanton(tcustPeopleRealAssets.getCountrycode(), + tcustPeopleRealAssets.getProvincecode(), tcustPeopleRealAssets.getCantoncode()); + tcustPeopleRealAssets.addAddtionalInfo(canton, tgeneCanton.getDescription()); + } else { + tcustPeopleRealAssets.addAddtionalInfo(canton, null); + } + if (tcustPeopleRealAssets.getCountrycode() != null && tcustPeopleRealAssets.getProvincecode() != null + && tcustPeopleRealAssets.getCantoncode() != null && tcustPeopleRealAssets.getCitycode() != null) { + TgeneCity tgeneCity = DataHelper.getInstance().getTgeneCity(tcustPeopleRealAssets.getCountrycode(), + tcustPeopleRealAssets.getProvincecode(), tcustPeopleRealAssets.getCantoncode(), tcustPeopleRealAssets.getCitycode()); + tcustPeopleRealAssets.addAddtionalInfo(city, tgeneCity.getDescription()); + } else { + tcustPeopleRealAssets.addAddtionalInfo(city, null); + } + if (tcustPeopleRealAssets.getCountrycode() != null && tcustPeopleRealAssets.getProvincecode() != null + && tcustPeopleRealAssets.getCantoncode() != null && tcustPeopleRealAssets.getParroquiacode() != null) { + TgeneParroquia tgeneParroquia = DataHelper.getInstance().getTgeneParroquia(tcustPeopleRealAssets.getCountrycode(), + tcustPeopleRealAssets.getProvincecode(), tcustPeopleRealAssets.getCantoncode(), tcustPeopleRealAssets.getParroquiacode()); + tcustPeopleRealAssets.addAddtionalInfo(parroquia, tgeneParroquia.getDescription()); + } else { + tcustPeopleRealAssets.addAddtionalInfo(parroquia, null); + } + if (tcustPeopleRealAssets.getMortgagepersoncode() != null) { + TcustPersonDetail tcustPersonDetail = DataHelper.getInstance().getTcustPersonDetail(tcustPeopleRealAssets.getMortgagepersoncode()); + tcustPeopleRealAssets.addAddtionalInfo("name", tcustPersonDetail.getName()); + } else { + tcustPeopleRealAssets.addAddtionalInfo("name", null); + } + } + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/DirectionFull.java b/base/business/person/src/main/java/com/fp/person/rules/query/DirectionFull.java new file mode 100644 index 0000000..20803ad --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/DirectionFull.java @@ -0,0 +1,91 @@ +package com.fp.person.rules.query; + +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import java.util.List; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; + +/** + * + * @author hinga + */ +public class DirectionFull extends QueryRule { + + private String addressaux = "addressaux"; + + /** + * Metodo que entrega la direccion completa (concatenado) + * + * @param pQueryRequest Objeto que posee la consulta requerida. + * @return + * @throws Exception + */ + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List lovDirect = (List) response.get("TCUSTPERSONADDRESSLOVFULL"); + this.completeAddressJob(lovDirect); + if (lovDirect == null || (lovDirect != null && lovDirect.isEmpty())) { + return pQueryRequest; + } + return pQueryRequest; + } + + /** + * Metodo q se encarga de concatenar la direccion en un solo campo + * + * @param lovDirection objeto que posee una lista de registros consultados + * de tcustPersonAddress + * @throws Exception + */ + protected void completeAddressJob(List lovDirection) throws Exception { + + for (Object addre : lovDirection) { + TcustPersonAddress tcustPersonAddress = (TcustPersonAddress) addre; + tcustPersonAddress.addAddtionalInfo(addressaux, DirectionFull.getFullAddress(tcustPersonAddress)); + } + } + + /** + * Metodo que se encarga de armar la direccion dada la direccion + * + * @param tcustPersonAddress + * @return + */ + public static String getFullAddress(TcustPersonAddress tcustPersonAddress) { + if (tcustPersonAddress == null) { + return null; + } else if (tcustPersonAddress.getAddresstypecatalog() != null + && tcustPersonAddress.getAddresstypecatalog().compareTo("3") == 0) { + return tcustPersonAddress.getAddress(); + } else { + String newaddress = ""; + if (tcustPersonAddress.getAddress() != null) { + newaddress += tcustPersonAddress.getAddress(); + } + if (tcustPersonAddress.getStreetnumber() != null) { + newaddress += " " + tcustPersonAddress.getStreetnumber(); + } + if(tcustPersonAddress.getDepartment()!=null) + { + newaddress +=" ("+tcustPersonAddress.getDepartment()+")"; + } + if (tcustPersonAddress.getStreet() != null) { + newaddress += " " + tcustPersonAddress.getStreet(); + } + if (tcustPersonAddress.getUrbanization() != null) { + newaddress += " /" + tcustPersonAddress.getUrbanization(); + } + if (tcustPersonAddress.getRemark() != null) { + newaddress += ", " + tcustPersonAddress.getRemark() ; + } + if (newaddress.compareTo("") == 0) { + newaddress = null; + } + return newaddress; + } + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/PersonName.java b/base/business/person/src/main/java/com/fp/person/rules/query/PersonName.java new file mode 100644 index 0000000..df820ef --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/PersonName.java @@ -0,0 +1,264 @@ +package com.fp.person.rules.query; + +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.company.TcustFamiliarlLink; +import com.fp.persistence.pcustomer.company.TcustLegalLink; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonAddressKey; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.people.TcustPeopleJob; +import com.fp.persistence.pcustomer.people.TcustPeopleOtherAssets; +import com.fp.persistence.pcustomer.people.TcustPeopleTradereferences; +import com.fp.persistence.pcustomer.people.TcustPeopleVehicle; +import com.fp.persistence.pgeneral.gene.TgeneAccountRelationship; +import com.fp.persistence.pgeneral.gene.TgeneCompany; +import com.fp.persistence.pgeneral.gene.TgeneSolicitudeRelationship; +import com.fp.person.db.DataHelper; +import java.util.List; + +/** + * Clase que se encarga de completar el nombre de una persona. + * + * @author Wilson Sigcho + * @version 2.1 + */ +public class PersonName extends QueryRule { + + private String name = "name"; + private String expiratedesignation = "expiratedesignation"; + + /** + * Metodo que agrega el nombre de una persona, cuando una consulta es requerida. + * + * @param pQueryRequest Objeto que posee la consulta requerida. + * @return pQueryRequest + * @throws Exception + */ + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List legallink = (List) response.get("TCUSTLEGALLINK"); + List familiarlink = (List) response.get("TCUSTFAMILIARLLINK"); + List genecompany = (List) response.get("TGENECOMPANYLOV"); + List jobs = (List) response.get("TCUSTPEOPLEJOB"); + List vehicles = (List) response.get("TCUSTPEOPLEVEHICLE"); + List otherassets = (List) response.get("TCUSTPEOPLEOTHERASSETS"); + List tradereferences = (List) response.get("TCUSTPEOPLETRADEREFERENCES"); + List relationship = (List) response.get("TGENESOLICITUDERELATIONSHIP"); + List accountrelationship = (List) response.get("TGENEACCOUNTRELATIONSHIP"); + this.completeLegalLink(legallink); + this.completeFamiliarlLink(familiarlink); + this.completeGeneCompany(genecompany); + this.completeJob(jobs); + this.completeVehicles(vehicles); + this.completeOtherAssets(otherassets); + this.completeTradeReferences(tradereferences); + this.completeSolicitudeRealtionShip(relationship); + this.completeAccountRelationShip(accountrelationship); + return pQueryRequest; + } + + /** + * Metodo que se encraga de completar el nombre de una persona, en la tabla TcustLegalLink. + * + * @param lDetail Objeto que posee una lista de los registros consultados en la tabla TcustLegalLink. + * @throws Exception + */ + private void completeLegalLink(List lDetail) throws Exception { + if (lDetail == null) { + return; + } + for (Object obj : lDetail) { + TcustLegalLink tcustLegalLink = (TcustLegalLink) obj; + if (tcustLegalLink.getPk().getLinkpersoncode() != null) { + TcustPersonDetail tcustPersonDetail = DataHelper.getInstance().getTcustPersonDetail(tcustLegalLink.getPk().getLinkpersoncode()); + tcustLegalLink.addAddtionalInfo(name, tcustPersonDetail.getName()); + } else { + tcustLegalLink.addAddtionalInfo(name, null); + } + } + } + + /** + * Metodo que se encraga de completar el nombre de una persona, en la tabla TcustFamiliarlLink. + * + * @param lDetail Objeto que posee una lista de los registros consultados en la tabla TcustFamiliarlLink. + * @throws Exception + */ + private void completeFamiliarlLink(List lDetail) throws Exception { + if (lDetail == null) { + return; + } + for (Object obj : lDetail) { + TcustFamiliarlLink tcustFamiliarlLink = (TcustFamiliarlLink) obj; + if (tcustFamiliarlLink.getPk().getLinkpersoncode() != null) { + TcustPersonDetail tcustPersonDetail = DataHelper.getInstance().getTcustPersonDetail(tcustFamiliarlLink.getPk().getLinkpersoncode()); + tcustFamiliarlLink.addAddtionalInfo(name, tcustPersonDetail.getName()); + } else { + tcustFamiliarlLink.addAddtionalInfo(name, null); + } + } + } + + /** + * Metodo que se encraga de completar el nombre de una persona, en la tabla TgeneCompany. + * + * @param lDetail Objeto que posee una lista de los registros consultados en la tabla TgeneCompany. + * @throws Exception + */ + private void completeGeneCompany(List lDetail) throws Exception { + if (lDetail == null) { + return; + } + for (Object obj : lDetail) { + TgeneCompany tgeneCompany = (TgeneCompany) obj; + if (tgeneCompany.getPersoncode() != null) { + TcustPersonDetail tcustPersonDetail = DataHelper.getInstance().getTcustPersonDetail(tgeneCompany.getPersoncode()); + tgeneCompany.addAddtionalInfo(name, tcustPersonDetail.getName()); + } else { + tgeneCompany.addAddtionalInfo(name, null); + } + } + } + + /** + * Metodo que se encarga de completar el nombre del deunio de la empresa + * + * @param lDetail + * @throws Exception + */ + private void completeJob(List lDetail) throws Exception { + if (lDetail == null) { + return; + } + for (Object obj : lDetail) { + TcustPeopleJob tcustPeopleJob = (TcustPeopleJob) obj; + if (tcustPeopleJob != null) { + if (tcustPeopleJob.getPk().getPersoncode() != null) { + TcustPersonDetail tcustPersonDetail = DataHelper.getInstance().getTcustPersonDetail(tcustPeopleJob.getPk().getPersoncode()); + tcustPeopleJob.addAddtionalInfo(name, tcustPersonDetail.getName()); + } else { + tcustPeopleJob.addAddtionalInfo(name, null); + } + if (tcustPeopleJob.getPk().getPersoncode() != null && tcustPeopleJob.getAddress() != null) { + TcustPersonAddressKey tcustPersonAddressKey = new TcustPersonAddressKey(tcustPeopleJob.getPk().getPersoncode(), tcustPeopleJob.getAddress(), FormatDates.getDefaultExpiryTimestamp()); + TcustPersonAddress tcustPersonAddress = TcustPersonAddress.find(PersistenceHelper.getEntityManager(), tcustPersonAddressKey); + tcustPeopleJob.addAddtionalInfo("addressaux", DirectionFull.getFullAddress(tcustPersonAddress)); + } else { + tcustPeopleJob.addAddtionalInfo("addressaux", null); + } + } + } + } + + /** + * Metodo que se encarga de completar el nombre del beneficiario de la prenda del vehiculo + * + * @param lDetail + * @throws Exception + */ + private void completeVehicles(List lDetail) throws Exception { + if (lDetail == null) { + return; + } + for (Object obj : lDetail) { + TcustPeopleVehicle tcustPeopleVehicle = (TcustPeopleVehicle) obj; + if (tcustPeopleVehicle.getPledgedpersoncode() != null) { + TcustPersonDetail tcustPersonDetail = DataHelper.getInstance().getTcustPersonDetail(tcustPeopleVehicle.getPledgedpersoncode()); + tcustPeopleVehicle.addAddtionalInfo(name, tcustPersonDetail.getName()); + } else { + tcustPeopleVehicle.addAddtionalInfo(name, null); + } + } + } + + /** + * Metodo que se encarga de completar el nombre del beneficiario de la prenda del vehiculo + * + * @param lDetail + * @throws Exception + */ + private void completeOtherAssets(List lDetail) throws Exception { + if (lDetail == null) { + return; + } + for (Object obj : lDetail) { + TcustPeopleOtherAssets tcustPeopleOtherAssets = (TcustPeopleOtherAssets) obj; + if (tcustPeopleOtherAssets.getMortgagepersoncode() != null) { + TcustPersonDetail tcustPersonDetail = DataHelper.getInstance().getTcustPersonDetail(tcustPeopleOtherAssets.getMortgagepersoncode()); + tcustPeopleOtherAssets.addAddtionalInfo(name, tcustPersonDetail.getName()); + } else { + tcustPeopleOtherAssets.addAddtionalInfo(name, null); + } + } + } + + /** + * Metodo que se encarga de completar el nombre del vendedor en referencias comerciales + * + * @param lDetail + * @throws Exception + */ + private void completeTradeReferences(List lDetail) throws Exception { + if (lDetail == null) { + return; + } + for (Object obj : lDetail) { + TcustPeopleTradereferences tcustPeopleTradereferences = (TcustPeopleTradereferences) obj; + if (tcustPeopleTradereferences.getTradepersoncode() != null) { + TcustPersonDetail tcustPersonDetail = DataHelper.getInstance().getTcustPersonDetail(tcustPeopleTradereferences.getTradepersoncode()); + tcustPeopleTradereferences.addAddtionalInfo(name, tcustPersonDetail.getName()); + } else { + tcustPeopleTradereferences.addAddtionalInfo(name, null); + } + } + } + + /** + * Metodo que completa el nombre de la tabla tgenesolicituderelationship + * + * @param lDetail + * @throws Exception + */ + private void completeSolicitudeRealtionShip(List lDetail) throws Exception { + if (lDetail == null) { + return; + } + for (Object obj : lDetail) { + TgeneSolicitudeRelationship tgeneSolicitudeRelationship = (TgeneSolicitudeRelationship) obj; + if (tgeneSolicitudeRelationship.getPk().getPersoncode() != null) { + TcustPersonDetail tcustPersonDetail = DataHelper.getInstance().getTcustPersonDetail(tgeneSolicitudeRelationship.getPk().getPersoncode()); + tgeneSolicitudeRelationship.addAddtionalInfo(name, tcustPersonDetail.getName()); + } else { + tgeneSolicitudeRelationship.addAddtionalInfo(name, null); + } + } + } + + /** + * Metodo que completa el nombre de la tabla tgeneaccountrelationship + * + * @param lDetail + * @throws Exception + */ + private void completeAccountRelationShip(List lDetail) throws Exception { + if (lDetail == null) { + return; + } + for (Object obj : lDetail) { + TgeneAccountRelationship tgeneAccountRelationship = (TgeneAccountRelationship) obj; + if (tgeneAccountRelationship.getPk().getPersoncode() != null) { + TcustPersonDetail tcustPersonDetail = DataHelper.getInstance().getTcustPersonDetail(tgeneAccountRelationship.getPk().getPersoncode()); + tgeneAccountRelationship.addAddtionalInfo(name, tcustPersonDetail.getName()); + } else { + tgeneAccountRelationship.addAddtionalInfo(name, null); + } + } + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/PhonesPerClient.java b/base/business/person/src/main/java/com/fp/person/rules/query/PhonesPerClient.java new file mode 100644 index 0000000..068172e --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/PhonesPerClient.java @@ -0,0 +1,45 @@ +package com.fp.person.rules.query; + +import com.fp.bpm.query.Query; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.person.db.DataHelper; +import java.util.List; + +/** + * Clase que se encarga de completar la direccion del telefono. + * @author Wilson Sigcho + * @version 2.1 + */ +public class PhonesPerClient extends QueryRule { + + /** + * Metodo que agrega la direccion asociada a un telefono, cuando una consulta es requerida. + * @param pQueryRequest Objeto que posee la consulta requerida. + * @return pQueryRequest + * @throws Exception + */ + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + Query qry = new Query(); + qry.process(pQueryRequest); + List lobjects = (List) response.get("TCUSTPERSONPHONELOV"); + if (lobjects == null) { + return pQueryRequest; + } + for (Object obj : lobjects) { + TcustPersonPhone tcustPersonPhone = (TcustPersonPhone) obj; + if (tcustPersonPhone.getPk().getPersoncode() != null + && tcustPersonPhone.getAddressnumber() != null) { + TcustPersonAddress tcustPersonAddress = DataHelper.getInstance().getTcustPersonAddress(tcustPersonPhone.getPk().getPersoncode(), tcustPersonPhone.getAddressnumber()); + tcustPersonPhone.addAddtionalInfo("addressdesc", tcustPersonAddress.getAddress()); + } else { + tcustPersonPhone.addAddtionalInfo("addressdesc", null); + } + } + return pQueryRequest; + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/code/.svn/entries b/base/business/person/src/main/java/com/fp/person/rules/query/code/.svn/entries new file mode 100644 index 0000000..b3e72b0 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/code/.svn/entries @@ -0,0 +1,201 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/person/src/main/java/com/fp/person/rules/query/code +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +PercentageStockholder.java +file + + + + +2022-07-28T03:40:41.859799Z +eec19d6342c8151836c12949d7ebf8c5 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1244 + +ValidationAddress.java +file + + + + +2022-07-28T03:40:41.859799Z +2a8c15992d4d2a67b72ed3cca69e1164 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4112 + +LovFinancialInstitutions.java +file + + + + +2022-07-28T03:40:41.859799Z +319b0c0dad4fb0c2dba8ceff514d68bc +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2004 + +VerifyManagers.java +file + + + + +2022-07-28T03:40:41.859799Z +53eb64182dea080621ed25db1edb239d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3824 + +sbs +dir + +AddressSequence.java +file + + + + +2022-07-28T03:40:41.860799Z +769eb4d664a1b72fadfe3832580eb66c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1397 + diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/code/.svn/text-base/AddressSequence.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/query/code/.svn/text-base/AddressSequence.java.svn-base new file mode 100644 index 0000000..250f1cd --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/code/.svn/text-base/AddressSequence.java.svn-base @@ -0,0 +1,40 @@ +package com.fp.person.rules.query.code; + +import java.math.BigDecimal; + +import javax.persistence.Query; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; + +/** + * Clase que se encarga de consultar la secuencia correspondiente al usuario + * + * @author scastillo + */ +public class AddressSequence extends QueryRule { + + @Override + public QueryRequest process(QueryRequest qr) throws Exception { + Integer personcode = null; + Object personcodeObj = qr.get("personcode"); + if (personcodeObj instanceof Integer) { + personcode = qr.getInteger("personcode"); + } else if (personcodeObj instanceof String) { + personcode = Integer.valueOf(qr.getString("personcode")); + } + Query qry = PersistenceHelper.getEntityManager().createQuery( + "select coalesce(max(tcpa.pk.addressnumber), 0) from TcustPersonAddress tcpa where tcpa.pk.personcode = :personcode"); + qry.setParameter("personcode", personcode); + Object test = qry.getSingleResult(); + Integer result = null; + if (test instanceof Integer) { + result = (Integer) test; + } else if (test instanceof BigDecimal) { + result = ((BigDecimal) test).intValueExact(); + } + qr.getResponse().put("result", test); + return qr; + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/code/.svn/text-base/LovFinancialInstitutions.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/query/code/.svn/text-base/LovFinancialInstitutions.java.svn-base new file mode 100644 index 0000000..df182ce --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/code/.svn/text-base/LovFinancialInstitutions.java.svn-base @@ -0,0 +1,57 @@ +package com.fp.person.rules.query.code; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.common.helper.Constant; +import com.fp.dto.Response; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.GeneralQuery; +import com.fp.persistence.commondb.PersistenceHelper; +import javax.persistence.Query; + +/** + * Clase que realiza la consulta las instituciones financieras y enva los datos + * necesarios para el lov de Instituciones + * + * @author wpatio + */ +public class LovFinancialInstitutions extends QueryRule { + + @Override + public QueryRequest process(QueryRequest qr) throws Exception { + Response response = qr.getResponse(); + QueryBean qb = (QueryBean) qr.get("TCUSTFINANCIALINSTITUTIONSLOV"); + Map mcriteria = new HashMap(); + StringBuilder jpql = new StringBuilder(); + jpql.append("select t.personcode,t.name from TcustPersonDetail t where t.personcode in (select f.personcode from TcustFinancialInstitutions f) and t.dateto = :dateto"); + GeneralQuery.addParameters(qb, jpql, mcriteria,true); + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(String.valueOf(jpql)); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + GeneralQuery.setParameters(qb, mcriteria, qry); + List ldata = qry.getResultList(); + List> lresp = new ArrayList>(); + if ((ldata != null) && (!ldata.isEmpty())) { + for (Object obj[] : ldata) { + Map m = new HashMap(); + m.put("pk_personcode", obj[0]); + m.put("name", obj[1]); + lresp.add(m); + } + } else { + if(qb.getPage()==1){ + Map m = new HashMap(); + m.put("pk_personcode", null); + m.put("name", null); + lresp.add(m); + } + } + + response.put("TCUSTFINANCIALINSTITUTIONSLOV", lresp); + return qr; + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/code/.svn/text-base/PercentageStockholder.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/query/code/.svn/text-base/PercentageStockholder.java.svn-base new file mode 100644 index 0000000..2f14c39 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/code/.svn/text-base/PercentageStockholder.java.svn-base @@ -0,0 +1,36 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.person.rules.query.code; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pcustomer.company.TcustCompanyManagers; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.List; + +/** + * Clase que devuelve porcentaje de participacion de participacion de accionistas + * @author hinga + */ + +public class PercentageStockholder extends QueryRule { + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response= pQueryRequest.getResponse(); + Integer codPerson=(Integer) pQueryRequest.get("PERSONCODE"); + List tcustCompanyManagers= TcustCompanyManagers.find(PersistenceHelper.getEntityManager(), codPerson); + BigDecimal perc=new BigDecimal(0); + for(TcustCompanyManagers obj:tcustCompanyManagers){ + if(obj.getParticipation()!=null) + perc= perc.add(obj.getParticipation()); + } + response.put("PERCENTAGE", perc); + return pQueryRequest; + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/code/.svn/text-base/ValidationAddress.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/query/code/.svn/text-base/ValidationAddress.java.svn-base new file mode 100644 index 0000000..acc1609 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/code/.svn/text-base/ValidationAddress.java.svn-base @@ -0,0 +1,101 @@ +package com.fp.person.rules.query.code; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Query; + +import com.fp.common.helper.Constant; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; + +/** + * Clase que verifica si las direcciones se encuentran referenciadas en las tablas de TcustPeopleJob y + * TcustCompanyBranch + * + * @author JARIAS + * + */ +public class ValidationAddress extends QueryRule { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Metodo que consulta los datos de manera normal segun el query enviado + */ + @Override + public QueryRequest process(QueryRequest qr) throws Exception { + // TODO Auto-generated method stub + List result = null; + List resultBranch = null; + Integer personcode = null; + Object objpersoncode = qr.get("personcode"); + if (objpersoncode instanceof String) { + personcode = Integer.parseInt(objpersoncode.toString()); + } else if (objpersoncode instanceof String) { + personcode = (Integer) objpersoncode; + } + + Integer addressnumber = (Integer) qr.get("addressnumber"); + result = this.ValidateAddressJob(personcode, addressnumber); + resultBranch = this.ValidateAddressBranch(personcode, addressnumber); + if (((result != null) && (!result.isEmpty())) || ((resultBranch != null) && (!resultBranch.isEmpty()))) { + throw new GeneralException("CUST-0010", "NO SE PUEDE ELIMINAR LA DIRECCIN PORQUE SE ENCUENTRA ASOCIADA"); + } + return qr; + + } + + /** + * Metodo que consulta si la direccion esta refernciada en la tabla TcustPeopleJob + * + * @param personcode codigo de la persona duea de la direccion + * @param addressnumber codigo de la direccion a consultar + * @return numberAddress retorna el codigo de la direccion si esta refenciado si es igual a 0 no existe referencia + */ + private List ValidateAddressJob(Integer personcode, Integer addressnumber) throws Exception { + List numberAddress = new ArrayList(); + Query qry = PersistenceHelper.getEntityManager().createQuery(ValidationAddress.JPQLJOB); + qry.setParameter("personcode", personcode); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + qry.setParameter("addressnumber", addressnumber); + return numberAddress = qry.getResultList(); + + } + + /** + * Metodo que consulta si la direccion se encuentra referenciado en la tabla TcustCompanyBranch + * + * @param personcode codigo de la persona duea de la direccion + * @param addressnumber codigo de la direccion a consultar + * @return numberAddress la lista es diferente de null si existe referencia + * @throws Exception + */ + private List ValidateAddressBranch(Integer personcode, Integer addressnumber) throws Exception { + List addressBranch = new ArrayList(); + Query qry = PersistenceHelper.getEntityManager().createQuery(ValidationAddress.JPQLBRANCH); + qry.setParameter("personcode", personcode); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + qry.setParameter("addressnumber", addressnumber); + return addressBranch = qry.getResultList(); + + } + + /** + * Sentecia para consulta en la TcustPeopleJob + */ + private static final String JPQLJOB = "select t.address from TcustPeopleJob t where t.pk.personcode=:personcode" + + " and t.pk.dateto=:dateto and t.address=:addressnumber"; + + /** + * Sentencia para consultar en la TcustCompanyBranch + */ + private static final String JPQLBRANCH = "select t.addressnumber from TcustCompanyBranch t where t.pk.personcode=:personcode " + + " and t.pk.dateto=:dateto and t.addressnumber=:addressnumber"; + +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/code/.svn/text-base/VerifyManagers.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/query/code/.svn/text-base/VerifyManagers.java.svn-base new file mode 100644 index 0000000..d63c663 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/code/.svn/text-base/VerifyManagers.java.svn-base @@ -0,0 +1,78 @@ +package com.fp.person.rules.query.code; + +import com.fp.bpm.query.Query; +import com.fp.common.helper.CalculationBase; +import com.fp.dto.Response; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.APPDates; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.company.TcustCompanyManagers; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.gene.TgeneLabel; +import com.fp.persistence.pgeneral.gene.TgeneLabelKey; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * Clase que se va a encargar de verificar si los accionistas o directivos ya caducaron su fecha de expiracion + * + * @author scastillo + */ +public class VerifyManagers extends QueryRule { + + private static final String JPQL = "from TcustCompanyManagers t" + + " where t.pk.personcode = :personcode" + + " and t.pk.dateto = :dateto" + + " and t.expirationdate < :expirationdate"; + + /** + * Metodo que consulta los datos normalemente segn elq uery enviado + * + * @param pQueryRequest + * @return + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + QueryBean queryBean = (QueryBean) pQueryRequest.get("TCUSTCOMPANYMANAGERS"); + List lqueryCriteria = queryBean.getCriteria(); + QueryCriteria queryCriteria = lqueryCriteria.get(0); + Integer personcode = new Integer(String.valueOf(queryCriteria.getValue())); + TgeneAccountingDateBranch tgadb = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch(pQueryRequest.getCompany(), 0); + APPDates workDate = new APPDates(tgadb.getWorkingdate(), CalculationBase.B365365); + javax.persistence.Query query = PersistenceHelper.getEntityManager().createQuery(String.valueOf(JPQL)); + query.setParameter("personcode", personcode); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + query.setParameter("expirationdate", workDate.getDate()); + List ldata = query.getResultList(); + if (!ldata.isEmpty()) { + TgeneLabelKey tgeneLabelKey = new TgeneLabelKey("msg056", pQueryRequest.getLanguage(), pQueryRequest.getChannelCode()); + TgeneLabel tgeneLabel = TgeneLabel.find(PersistenceHelper.getEntityManager(), tgeneLabelKey); + String mensaje = tgeneLabel.getDescription()+":
"; + int contador = 1; + for (TcustCompanyManagers tcustCompanyManagers : ldata) { + Integer personCodeManager = tcustCompanyManagers.getPk().getManagerpersoncode(); + TcustPersonDetailKey tcustPersonDetailKey = new TcustPersonDetailKey(personCodeManager, FormatDates.getDefaultExpiryTimestamp()); + TcustPersonDetail tcustPersonDetail = TcustPersonDetail.find(PersistenceHelper.getEntityManager(), tcustPersonDetailKey); + String nombre = tcustPersonDetail.getName(); + mensaje += ""+contador+".- "+nombre+"
"; + contador++; + } + contador--; + if(mensaje.compareTo(tgeneLabel.getDescription()+":
") != 0){ + response.put("mensaje", mensaje); + } + } + Query qry = new Query(); + qry.process(pQueryRequest); + return pQueryRequest; + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/code/AddressSequence.java b/base/business/person/src/main/java/com/fp/person/rules/query/code/AddressSequence.java new file mode 100644 index 0000000..250f1cd --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/code/AddressSequence.java @@ -0,0 +1,40 @@ +package com.fp.person.rules.query.code; + +import java.math.BigDecimal; + +import javax.persistence.Query; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; + +/** + * Clase que se encarga de consultar la secuencia correspondiente al usuario + * + * @author scastillo + */ +public class AddressSequence extends QueryRule { + + @Override + public QueryRequest process(QueryRequest qr) throws Exception { + Integer personcode = null; + Object personcodeObj = qr.get("personcode"); + if (personcodeObj instanceof Integer) { + personcode = qr.getInteger("personcode"); + } else if (personcodeObj instanceof String) { + personcode = Integer.valueOf(qr.getString("personcode")); + } + Query qry = PersistenceHelper.getEntityManager().createQuery( + "select coalesce(max(tcpa.pk.addressnumber), 0) from TcustPersonAddress tcpa where tcpa.pk.personcode = :personcode"); + qry.setParameter("personcode", personcode); + Object test = qry.getSingleResult(); + Integer result = null; + if (test instanceof Integer) { + result = (Integer) test; + } else if (test instanceof BigDecimal) { + result = ((BigDecimal) test).intValueExact(); + } + qr.getResponse().put("result", test); + return qr; + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/code/LovFinancialInstitutions.java b/base/business/person/src/main/java/com/fp/person/rules/query/code/LovFinancialInstitutions.java new file mode 100644 index 0000000..df182ce --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/code/LovFinancialInstitutions.java @@ -0,0 +1,57 @@ +package com.fp.person.rules.query.code; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.common.helper.Constant; +import com.fp.dto.Response; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.GeneralQuery; +import com.fp.persistence.commondb.PersistenceHelper; +import javax.persistence.Query; + +/** + * Clase que realiza la consulta las instituciones financieras y enva los datos + * necesarios para el lov de Instituciones + * + * @author wpatio + */ +public class LovFinancialInstitutions extends QueryRule { + + @Override + public QueryRequest process(QueryRequest qr) throws Exception { + Response response = qr.getResponse(); + QueryBean qb = (QueryBean) qr.get("TCUSTFINANCIALINSTITUTIONSLOV"); + Map mcriteria = new HashMap(); + StringBuilder jpql = new StringBuilder(); + jpql.append("select t.personcode,t.name from TcustPersonDetail t where t.personcode in (select f.personcode from TcustFinancialInstitutions f) and t.dateto = :dateto"); + GeneralQuery.addParameters(qb, jpql, mcriteria,true); + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(String.valueOf(jpql)); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + GeneralQuery.setParameters(qb, mcriteria, qry); + List ldata = qry.getResultList(); + List> lresp = new ArrayList>(); + if ((ldata != null) && (!ldata.isEmpty())) { + for (Object obj[] : ldata) { + Map m = new HashMap(); + m.put("pk_personcode", obj[0]); + m.put("name", obj[1]); + lresp.add(m); + } + } else { + if(qb.getPage()==1){ + Map m = new HashMap(); + m.put("pk_personcode", null); + m.put("name", null); + lresp.add(m); + } + } + + response.put("TCUSTFINANCIALINSTITUTIONSLOV", lresp); + return qr; + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/code/PercentageStockholder.java b/base/business/person/src/main/java/com/fp/person/rules/query/code/PercentageStockholder.java new file mode 100644 index 0000000..2f14c39 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/code/PercentageStockholder.java @@ -0,0 +1,36 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.person.rules.query.code; + +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pcustomer.company.TcustCompanyManagers; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.List; + +/** + * Clase que devuelve porcentaje de participacion de participacion de accionistas + * @author hinga + */ + +public class PercentageStockholder extends QueryRule { + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response= pQueryRequest.getResponse(); + Integer codPerson=(Integer) pQueryRequest.get("PERSONCODE"); + List tcustCompanyManagers= TcustCompanyManagers.find(PersistenceHelper.getEntityManager(), codPerson); + BigDecimal perc=new BigDecimal(0); + for(TcustCompanyManagers obj:tcustCompanyManagers){ + if(obj.getParticipation()!=null) + perc= perc.add(obj.getParticipation()); + } + response.put("PERCENTAGE", perc); + return pQueryRequest; + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/code/ValidationAddress.java b/base/business/person/src/main/java/com/fp/person/rules/query/code/ValidationAddress.java new file mode 100644 index 0000000..acc1609 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/code/ValidationAddress.java @@ -0,0 +1,101 @@ +package com.fp.person.rules.query.code; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Query; + +import com.fp.common.helper.Constant; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; + +/** + * Clase que verifica si las direcciones se encuentran referenciadas en las tablas de TcustPeopleJob y + * TcustCompanyBranch + * + * @author JARIAS + * + */ +public class ValidationAddress extends QueryRule { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Metodo que consulta los datos de manera normal segun el query enviado + */ + @Override + public QueryRequest process(QueryRequest qr) throws Exception { + // TODO Auto-generated method stub + List result = null; + List resultBranch = null; + Integer personcode = null; + Object objpersoncode = qr.get("personcode"); + if (objpersoncode instanceof String) { + personcode = Integer.parseInt(objpersoncode.toString()); + } else if (objpersoncode instanceof String) { + personcode = (Integer) objpersoncode; + } + + Integer addressnumber = (Integer) qr.get("addressnumber"); + result = this.ValidateAddressJob(personcode, addressnumber); + resultBranch = this.ValidateAddressBranch(personcode, addressnumber); + if (((result != null) && (!result.isEmpty())) || ((resultBranch != null) && (!resultBranch.isEmpty()))) { + throw new GeneralException("CUST-0010", "NO SE PUEDE ELIMINAR LA DIRECCIN PORQUE SE ENCUENTRA ASOCIADA"); + } + return qr; + + } + + /** + * Metodo que consulta si la direccion esta refernciada en la tabla TcustPeopleJob + * + * @param personcode codigo de la persona duea de la direccion + * @param addressnumber codigo de la direccion a consultar + * @return numberAddress retorna el codigo de la direccion si esta refenciado si es igual a 0 no existe referencia + */ + private List ValidateAddressJob(Integer personcode, Integer addressnumber) throws Exception { + List numberAddress = new ArrayList(); + Query qry = PersistenceHelper.getEntityManager().createQuery(ValidationAddress.JPQLJOB); + qry.setParameter("personcode", personcode); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + qry.setParameter("addressnumber", addressnumber); + return numberAddress = qry.getResultList(); + + } + + /** + * Metodo que consulta si la direccion se encuentra referenciado en la tabla TcustCompanyBranch + * + * @param personcode codigo de la persona duea de la direccion + * @param addressnumber codigo de la direccion a consultar + * @return numberAddress la lista es diferente de null si existe referencia + * @throws Exception + */ + private List ValidateAddressBranch(Integer personcode, Integer addressnumber) throws Exception { + List addressBranch = new ArrayList(); + Query qry = PersistenceHelper.getEntityManager().createQuery(ValidationAddress.JPQLBRANCH); + qry.setParameter("personcode", personcode); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + qry.setParameter("addressnumber", addressnumber); + return addressBranch = qry.getResultList(); + + } + + /** + * Sentecia para consulta en la TcustPeopleJob + */ + private static final String JPQLJOB = "select t.address from TcustPeopleJob t where t.pk.personcode=:personcode" + + " and t.pk.dateto=:dateto and t.address=:addressnumber"; + + /** + * Sentencia para consultar en la TcustCompanyBranch + */ + private static final String JPQLBRANCH = "select t.addressnumber from TcustCompanyBranch t where t.pk.personcode=:personcode " + + " and t.pk.dateto=:dateto and t.addressnumber=:addressnumber"; + +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/code/VerifyManagers.java b/base/business/person/src/main/java/com/fp/person/rules/query/code/VerifyManagers.java new file mode 100644 index 0000000..d63c663 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/code/VerifyManagers.java @@ -0,0 +1,78 @@ +package com.fp.person.rules.query.code; + +import com.fp.bpm.query.Query; +import com.fp.common.helper.CalculationBase; +import com.fp.dto.Response; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.APPDates; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.company.TcustCompanyManagers; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.gene.TgeneLabel; +import com.fp.persistence.pgeneral.gene.TgeneLabelKey; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * Clase que se va a encargar de verificar si los accionistas o directivos ya caducaron su fecha de expiracion + * + * @author scastillo + */ +public class VerifyManagers extends QueryRule { + + private static final String JPQL = "from TcustCompanyManagers t" + + " where t.pk.personcode = :personcode" + + " and t.pk.dateto = :dateto" + + " and t.expirationdate < :expirationdate"; + + /** + * Metodo que consulta los datos normalemente segn elq uery enviado + * + * @param pQueryRequest + * @return + * @throws Exception + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + Response response = pQueryRequest.getResponse(); + QueryBean queryBean = (QueryBean) pQueryRequest.get("TCUSTCOMPANYMANAGERS"); + List lqueryCriteria = queryBean.getCriteria(); + QueryCriteria queryCriteria = lqueryCriteria.get(0); + Integer personcode = new Integer(String.valueOf(queryCriteria.getValue())); + TgeneAccountingDateBranch tgadb = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch(pQueryRequest.getCompany(), 0); + APPDates workDate = new APPDates(tgadb.getWorkingdate(), CalculationBase.B365365); + javax.persistence.Query query = PersistenceHelper.getEntityManager().createQuery(String.valueOf(JPQL)); + query.setParameter("personcode", personcode); + query.setParameter("dateto", FormatDates.getDefaultExpiryTimestamp()); + query.setParameter("expirationdate", workDate.getDate()); + List ldata = query.getResultList(); + if (!ldata.isEmpty()) { + TgeneLabelKey tgeneLabelKey = new TgeneLabelKey("msg056", pQueryRequest.getLanguage(), pQueryRequest.getChannelCode()); + TgeneLabel tgeneLabel = TgeneLabel.find(PersistenceHelper.getEntityManager(), tgeneLabelKey); + String mensaje = tgeneLabel.getDescription()+":
"; + int contador = 1; + for (TcustCompanyManagers tcustCompanyManagers : ldata) { + Integer personCodeManager = tcustCompanyManagers.getPk().getManagerpersoncode(); + TcustPersonDetailKey tcustPersonDetailKey = new TcustPersonDetailKey(personCodeManager, FormatDates.getDefaultExpiryTimestamp()); + TcustPersonDetail tcustPersonDetail = TcustPersonDetail.find(PersistenceHelper.getEntityManager(), tcustPersonDetailKey); + String nombre = tcustPersonDetail.getName(); + mensaje += ""+contador+".- "+nombre+"
"; + contador++; + } + contador--; + if(mensaje.compareTo(tgeneLabel.getDescription()+":
") != 0){ + response.put("mensaje", mensaje); + } + } + Query qry = new Query(); + qry.process(pQueryRequest); + return pQueryRequest; + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/code/sbs/.svn/entries b/base/business/person/src/main/java/com/fp/person/rules/query/code/sbs/.svn/entries new file mode 100644 index 0000000..f4f1349 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/code/sbs/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/person/src/main/java/com/fp/person/rules/query/code/sbs +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +EmployeeLov.java +file + + + + +2022-07-28T03:40:41.825799Z +daab6cafd6ac62a29303969dd205edf7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1423 + diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/code/sbs/.svn/text-base/EmployeeLov.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/query/code/sbs/.svn/text-base/EmployeeLov.java.svn-base new file mode 100644 index 0000000..0de2191 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/code/sbs/.svn/text-base/EmployeeLov.java.svn-base @@ -0,0 +1,46 @@ +package com.fp.person.rules.query.code.sbs; + +import java.util.List; + +import javax.persistence.Query; + +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.GeneralQuery; +import com.fp.persistence.commondb.PersistenceHelper; + +/** + * Clase que se encarga de obtener una lista de empleados de la sbs. + * @author Jorge Vaca. + * @version 2.1 + */ +/** + * @author jorge + * + */ +public class EmployeeLov extends QueryRule { + + /** + * Version por default de la clase. + */ + private static final long serialVersionUID = 1L; + + + /* (non-Javadoc) + * @see com.fp.dto.rules.QueryRule#process(com.fp.dto.query.QueryRequest) + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + StringBuilder jpql = new StringBuilder(400); + jpql.append("select t.cod_emp, t.apellido, t.nombre, t.portal_user, t.num_cedula from vwempleados t where 1=1 "); + DtoQuery dto = pQueryRequest.getQueryTables().get("EMPLOYEESBS"); + GeneralQuery.addParametersJSF(jpql, dto); + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(jpql.toString()); + GeneralQuery.setParametersNative(jpql, dto, qry); + List lemployee = qry.getResultList(); + pQueryRequest.getResponse().put("EMPLOYEESBS", lemployee); + return pQueryRequest; + } + +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/query/code/sbs/EmployeeLov.java b/base/business/person/src/main/java/com/fp/person/rules/query/code/sbs/EmployeeLov.java new file mode 100644 index 0000000..0de2191 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/query/code/sbs/EmployeeLov.java @@ -0,0 +1,46 @@ +package com.fp.person.rules.query.code.sbs; + +import java.util.List; + +import javax.persistence.Query; + +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.GeneralQuery; +import com.fp.persistence.commondb.PersistenceHelper; + +/** + * Clase que se encarga de obtener una lista de empleados de la sbs. + * @author Jorge Vaca. + * @version 2.1 + */ +/** + * @author jorge + * + */ +public class EmployeeLov extends QueryRule { + + /** + * Version por default de la clase. + */ + private static final long serialVersionUID = 1L; + + + /* (non-Javadoc) + * @see com.fp.dto.rules.QueryRule#process(com.fp.dto.query.QueryRequest) + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + StringBuilder jpql = new StringBuilder(400); + jpql.append("select t.cod_emp, t.apellido, t.nombre, t.portal_user, t.num_cedula from vwempleados t where 1=1 "); + DtoQuery dto = pQueryRequest.getQueryTables().get("EMPLOYEESBS"); + GeneralQuery.addParametersJSF(jpql, dto); + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(jpql.toString()); + GeneralQuery.setParametersNative(jpql, dto, qry); + List lemployee = qry.getResultList(); + pQueryRequest.getResponse().put("EMPLOYEESBS", lemployee); + return pQueryRequest; + } + +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/.svn/entries b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/entries new file mode 100644 index 0000000..1cccbcf --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/entries @@ -0,0 +1,470 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/person/src/main/java/com/fp/person/rules/save +svn://172.17.26.185/COMACO + + + +2015-09-21T11:33:05.809667Z +4285 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +LogoImage.java +file + + + + +2022-07-28T03:40:41.945800Z +6b446b1a2380d1942785f28d778b0506 +2015-09-21T11:33:05.809667Z +4285 +fpazmino + + + + + + + + + + + + + + + + + + + + + +5403 + +VerifyInConsep.java +file + + + + +2022-07-28T03:40:41.945800Z +941f1ed09e305bfebed294bf01e4dbb7 +2015-06-23T07:16:13.584450Z +4127 +cpiedra + + + + + + + + + + + + + + + + + + + + + +13021 + +FinancialSituation.java +file + + + + +2022-07-28T03:40:41.945800Z +dabf0adbd5c69f7dc2023fe8eac6c7dd +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8675 + +CompleteHistoryActivity.java +file + + + + +2022-07-28T03:40:41.945800Z +e752041da35a492234a6e18988fe4561 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1525 + +CompletePersonAndCompany.java +file + + + + +2022-07-28T03:40:41.946800Z +f795c99f2d519865934e84bbdcd4cc4e +2015-08-03T04:11:30.569720Z +4244 +fpazmino + + + + + + + + + + + + + + + + + + + + + +12448 + +PersonImage.java +file + + + + +2022-07-28T03:40:41.946800Z +07d1ba90b62a65159f00c1bd1bfa022f +2015-06-23T07:16:13.584450Z +4127 +cpiedra + + + + + + + + + + + + + + + + + + + + + +5164 + +CompleteCompanyCode.java +file + + + + +2022-07-28T03:40:41.946800Z +63858d084ac2c5768f05ac3393cbd5ee +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +20017 + +CompletePersonCode.java +file + + + + +2022-07-28T03:40:41.946800Z +dbb3b9db440973156dd021d3ca2470e5 +2015-08-03T04:11:30.569720Z +4244 +fpazmino + + + + + + + + + + + + + + + + + + + + + +19533 + +VerifyInConsepCompany.java +file + + + + +2022-07-28T03:40:41.947800Z +e317dafdc83d648509e674cf8319830b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4245 + +VerifyInConsepPerson.java +file + + + + +2022-07-28T03:40:41.947800Z +10145ba61e4f88859bd81adc1a5fbed2 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3291 + +PersonBalanceFile.java +file + + + + +2022-07-28T03:40:41.947800Z +04ecdcfc8c4f7a477dc82a595e7d3638 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3830 + +ValidateAddressPhones.java +file + + + + +2022-07-28T03:40:41.947800Z +fd7d9313f92303bb64b69d6aa80d7632 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2740 + +JuridicalPerson.java +file + + + + +2022-07-28T03:40:41.948800Z +58a09d755f3a9f4ec2a3650bb24a3877 +2015-09-21T11:33:05.809667Z +4285 +fpazmino + + + + + + + + + + + + + + + + + + + + + +5669 + diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/CompleteCompanyCode.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/CompleteCompanyCode.java.svn-base new file mode 100644 index 0000000..199e9fa --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/CompleteCompanyCode.java.svn-base @@ -0,0 +1,402 @@ +package com.fp.person.rules.save; + +import java.util.List; + +import com.fp.dto.Response; +import com.fp.dto.save.SaveBean; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.pcustomer.balance.TcustPersonBalance; +import com.fp.persistence.pcustomer.company.TcustCompany; +import com.fp.persistence.pcustomer.company.TcustCompanyBranch; +import com.fp.persistence.pcustomer.company.TcustCompanyBranchKey; +import com.fp.persistence.pcustomer.company.TcustCompanyClient; +import com.fp.persistence.pcustomer.company.TcustCompanyClientKey; +import com.fp.persistence.pcustomer.company.TcustCompanyFinancial; +import com.fp.persistence.pcustomer.company.TcustCompanyFinancialKey; +import com.fp.persistence.pcustomer.company.TcustCompanyKey; +import com.fp.persistence.pcustomer.company.TcustCompanyManagers; +import com.fp.persistence.pcustomer.company.TcustCompanyManagersKey; +import com.fp.persistence.pcustomer.company.TcustCompanyProducts; +import com.fp.persistence.pcustomer.company.TcustCompanyProductsKey; +import com.fp.persistence.pcustomer.company.TcustCompanyProvider; +import com.fp.persistence.pcustomer.company.TcustCompanyProviderKey; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.people.TcustPeopleAssociation; +import com.fp.persistence.pcustomer.people.TcustPeopleAssociationKey; +import com.fp.persistence.pcustomer.people.TcustPeopleFixedIncome; +import com.fp.persistence.pcustomer.people.TcustPeopleFixedIncomeKey; +import com.fp.persistence.pcustomer.people.TcustPeopleLoan; +import com.fp.persistence.pcustomer.people.TcustPeopleLoanKey; +import com.fp.persistence.pcustomer.people.TcustPeopleOtherAssets; +import com.fp.persistence.pcustomer.people.TcustPeopleOtherAssetsKey; +import com.fp.persistence.pcustomer.people.TcustPeopleRealAssets; +import com.fp.persistence.pcustomer.people.TcustPeopleRealAssetsKey; +import com.fp.persistence.pcustomer.people.TcustPeopleVehicle; +import com.fp.persistence.pcustomer.people.TcustPeopleVehicleKey; + +/** + * + * Clase se encarga de completar el codigo para una nueva persona juridica. + * + * @author Wilson Sigcho + * @version 2.1 + */ +public class CompleteCompanyCode extends CompletePersonAndCompany { + + /** + * Metodo que se encarga de completar el codigo de compania para su creacion cuando un save es requerido. + * + * @param pSaveRequest Objeto que posee el save requerido. + * @return SaveRequest + * @throws Exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + TcustPersonDetail tcustPersonDetail = (TcustPersonDetail) pSaveRequest.getSaveBeanModifiedObject("TCUSTPERSONDETAIL"); + TcustCompany tcustCompany = (TcustCompany) pSaveRequest.getSaveBeanModifiedObject("TCUSTCOMPANY"); + TcustCompanyFinancial tcustCompanyFinancial = (TcustCompanyFinancial) pSaveRequest.getSaveBeanModifiedObject("TCUSTCOMPANYFINANCIAL"); +// TcustPersonBalance tcustPersonBalance = (TcustPersonBalance) pSaveRequest.getSaveBeanModifiedObject("TCUSTPERSONBALANCE"); + SaveBean sbTcustPersonBalance = (SaveBean) pSaveRequest.get("com.fp.persistence.pcustomer.balance.TcustPersonBalance"); + TcustPersonBalance tcustPersonBalance=null; + if(sbTcustPersonBalance!=null) + tcustPersonBalance = (TcustPersonBalance) sbTcustPersonBalance.getModifiedObject(); + List tcustPersonAddress = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONADDRESS"); + List tcustPersonPhone = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONPHONE"); + List bankreference = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONBANKREFERENCE"); + List personalreference = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONPERSONALREFERENCE"); + List products = pSaveRequest.getSaveBeanModifiedRecords("TCUSTCOMPANYPRODUCTS"); + List managers = pSaveRequest.getSaveBeanModifiedRecords("TCUSTCOMPANYMANAGERS"); + List branch = pSaveRequest.getSaveBeanModifiedRecords("TCUSTCOMPANYBRANCH"); + List provider = pSaveRequest.getSaveBeanModifiedRecords("TCUSTCOMPANYPROVIDER"); + List client = pSaveRequest.getSaveBeanModifiedRecords("TCUSTCOMPANYCLIENT"); + List loan = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLELOAN"); + List vehicles = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEVEHICLE"); + List otherassets = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEOTHERASSETS"); + List realassets = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEREALASSETS"); + List fixedincome = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEFIXEDINCOME"); + List association = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEASSOCIATION"); + // List balancefinancial = pSaveRequest.getSaveBeanModifiedRecords("TCUSTBALANCEFINANCIAL"); + // List fileItem = (List) pSaveRequest.get("file"); + if ((tcustPersonDetail != null) && (tcustPersonDetail.getPk().getPersoncode() == null)) { + Integer personcode = this.getPersonCode(); + this.createPerson(pSaveRequest, personcode); + this.completePersonDetail(pSaveRequest, tcustPersonDetail, personcode); + this.completeCompany(tcustCompany, personcode,pSaveRequest); + this.completeFinancial(tcustCompanyFinancial, personcode); + this.completeAddress(tcustPersonAddress, personcode); + this.completePhone(tcustPersonPhone, personcode); + this.completeBankReference(bankreference, personcode); + this.completePersonalReference(personalreference, personcode); + this.completeProducts(products, personcode); + this.completeManagers(managers, personcode); + this.completeBranch(branch, personcode); + this.completeProvider(provider, personcode); + this.completeClient(client, personcode); + this.completeLoan(loan, personcode); + this.completeVehicles(vehicles, personcode); + this.completeOtherAssets(otherassets, personcode); + this.completeRealAssets(realassets, personcode); + this.completeFixedIncome(fixedincome, personcode); + this.completeAssociation(association, personcode); + this.completeBalance(tcustPersonBalance, personcode, pSaveRequest); + Response response = pSaveRequest.getResponse(); + response.put("personcode", personcode); + response.put("personname", tcustPersonDetail.getName()); + } + this.completeAditionalInfo(pSaveRequest, tcustPersonDetail); + this.balanceCode(tcustPersonBalance, pSaveRequest); + return pSaveRequest; + } + + /** + * Metodo que me permmite revertir el proceso. + * + * @param pSaveRequest Objeto que posee el save requerido. + * @return pSaveRequest + * @throws Exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + /** + * Completa el codigo de la nueva persona juridica en la tabla TcustCompany. + * + * @param tcustCompany Objeto que posee el registro a guardar en la tabla TcustCompany. + * @param personcode Codigo de la nueva persona juridica a ser guardada. + * @throws Exception + */ + private void completeCompany(TcustCompany tcustCompany, Integer personcode,SaveRequest pSaverequest) throws Exception { + TcustCompanyKey tcustCompanyKey = new TcustCompanyKey(); + tcustCompanyKey.setPersoncode(personcode); + if(tcustCompany==null){ + TcustCompany tcusCompanyPros = new TcustCompany(); + tcusCompanyPros.setPk(tcustCompanyKey); + tcusCompanyPros.setIngressuser(pSaverequest.getUser()); + pSaverequest.getResponse().remove("TCUSTCOMPANY"); + pSaverequest.putSaveBean("TCUSTCOMPANY", tcusCompanyPros, 2); + + }else{ + tcustCompany.setPk(tcustCompanyKey); + tcustCompany.setIngressuser(pSaverequest.getUser()); + } + + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustCompanyManagers + * + * @param lDetail Objeto que posee una lista de los registros a guardar en la tabla TcustCompanyManagers. + * @param personcode Codigo de la nueva persona juridica a ser guardada. + * @throws Exception + */ + private void completeManagers(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustCompanyManagers tcustCompanyManagers = (TcustCompanyManagers) object; + if ((tcustCompanyManagers != null) && (tcustCompanyManagers.getPk().getPersoncode() == null)) { + TcustCompanyManagersKey tcustCompanyManagersKey = tcustCompanyManagers.getPk(); + tcustCompanyManagersKey.setPersoncode(personcode); + tcustCompanyManagers.setPk(tcustCompanyManagersKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustCompanyBranch + * + * @param lDetail Objeto que posee una lista de los registros a guardar en la tabla TcustCompanyBranch. + * @param personcode Codigo de la nueva persona juridica a ser guardada. + * @throws Exception + */ + private void completeBranch(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustCompanyBranch tcustCompanyBranch = (TcustCompanyBranch) object; + if ((tcustCompanyBranch != null) && (tcustCompanyBranch.getPk().getPersoncode() == null)) { + TcustCompanyBranchKey tcustCompanyBranchKey = new TcustCompanyBranchKey(); + tcustCompanyBranchKey.setPersoncode(personcode); + tcustCompanyBranchKey.setBranchsequence(tcustCompanyBranch.getPk().getBranchsequence()); + tcustCompanyBranch.setPk(tcustCompanyBranchKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustCompanyProducts + * + * @param lDetail Objeto que posee una lista de los registros a guardar en la tabla TcustCompanyProducts. + * @param personcode Codigo de la nueva persona juridica a ser guardada. + * @throws Exception + */ + private void completeProducts(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustCompanyProducts tcustCompanyProducts = (TcustCompanyProducts) object; + if ((tcustCompanyProducts != null) && (tcustCompanyProducts.getPk().getPersoncode() == null)) { + TcustCompanyProductsKey tcustCompanyProductsKey = new TcustCompanyProductsKey(); + tcustCompanyProductsKey.setPersoncode(personcode); + tcustCompanyProductsKey.setProductsequence(tcustCompanyProducts.getPk().getProductsequence()); + tcustCompanyProducts.setPk(tcustCompanyProductsKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustCompanyProvider + * + * @param lDetail Objeto que posee una lista de los registros a guardar en la tabla TcustCompanyProvider. + * @param personcode Codigo de la nueva persona juridica a ser guardada. + * @throws Exception + */ + private void completeProvider(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustCompanyProvider tcustCompanyProvider = (TcustCompanyProvider) object; + if ((tcustCompanyProvider != null) && (tcustCompanyProvider.getPk().getPersoncode() == null)) { + TcustCompanyProviderKey tcustCompanyProviderKey = new TcustCompanyProviderKey(); + tcustCompanyProviderKey.setPersoncode(personcode); + tcustCompanyProviderKey.setProvidersequence(tcustCompanyProvider.getPk().getProvidersequence()); + tcustCompanyProvider.setPk(tcustCompanyProviderKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustCompanyClient + * + * @param lDetail Objeto que posee una lista de los registros a guardar en la tabla TcustCompanyClient. + * @param personcode Codigo de la nueva persona juridica a ser guardada. + * @throws Exception + */ + private void completeClient(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustCompanyClient tcustCompanyClient = (TcustCompanyClient) object; + if ((tcustCompanyClient != null) && (tcustCompanyClient.getPk().getPersoncode() == null)) { + TcustCompanyClientKey tcustCompanyClientKey = new TcustCompanyClientKey(); + tcustCompanyClientKey.setPersoncode(personcode); + tcustCompanyClientKey.setClientsequence(tcustCompanyClient.getPk().getClientsequence()); + tcustCompanyClient.setPk(tcustCompanyClientKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustCompanyFinancial + * + * @param lDetail Objeto que posee una lista de los registros a guardar en la tabla TcustCompanyFinancial. + * @param personcode Codigo de la nueva persona juridica a ser guardada. + * @throws Exception + */ + private void completeFinancial(TcustCompanyFinancial tcustCompanyFinancial, Integer personcode) throws Exception { + if ((tcustCompanyFinancial != null) && (tcustCompanyFinancial.getPk().getPersoncode() == null)) { + TcustCompanyFinancialKey tcustCompanyFinancialKey = new TcustCompanyFinancialKey(); + tcustCompanyFinancialKey.setPersoncode(personcode); + tcustCompanyFinancial.setPk(tcustCompanyFinancialKey); + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustPeopleLoan + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeLoan(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleLoan tcustPeopleLoan = (TcustPeopleLoan) object; + if ((tcustPeopleLoan != null) && (tcustPeopleLoan.getPk().getPersoncode() == null)) { + TcustPeopleLoanKey tcustPeopleLoanKey = new TcustPeopleLoanKey(); + tcustPeopleLoanKey.setPersoncode(personcode); + tcustPeopleLoanKey.setLoansequence(tcustPeopleLoan.getPk().getLoansequence()); + tcustPeopleLoan.setPk(tcustPeopleLoanKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustPeopleVehicle + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeVehicles(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleVehicle tcustPeopleVehicle = (TcustPeopleVehicle) object; + if ((tcustPeopleVehicle != null) && (tcustPeopleVehicle.getPk().getPersoncode() == null)) { + TcustPeopleVehicleKey tcustPeopleVehicleKey = new TcustPeopleVehicleKey(); + tcustPeopleVehicleKey.setPersoncode(personcode); + tcustPeopleVehicleKey.setVehiclesequence(tcustPeopleVehicle.getPk().getVehiclesequence()); + tcustPeopleVehicle.setPk(tcustPeopleVehicleKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustPeopleOtherAssets + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeOtherAssets(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleOtherAssets tcustPeopleOtherAssets = (TcustPeopleOtherAssets) object; + if ((tcustPeopleOtherAssets != null) && (tcustPeopleOtherAssets.getPk().getPersoncode() == null)) { + TcustPeopleOtherAssetsKey tcustPeopleOtherAssetsKey = new TcustPeopleOtherAssetsKey(); + tcustPeopleOtherAssetsKey.setPersoncode(personcode); + tcustPeopleOtherAssetsKey.setAssetssequence(tcustPeopleOtherAssets.getPk().getAssetssequence()); + tcustPeopleOtherAssets.setPk(tcustPeopleOtherAssetsKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustPeopleRealAssets + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeRealAssets(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleRealAssets tcustPeopleRealAssets = (TcustPeopleRealAssets) object; + if ((tcustPeopleRealAssets != null) && (tcustPeopleRealAssets.getPk().getPersoncode() == null)) { + TcustPeopleRealAssetsKey tcustPeopleRealAssetsKey = new TcustPeopleRealAssetsKey(); + tcustPeopleRealAssetsKey.setPersoncode(personcode); + tcustPeopleRealAssetsKey.setAssetssequence(tcustPeopleRealAssets.getPk().getAssetssequence()); + tcustPeopleRealAssets.setPk(tcustPeopleRealAssetsKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustPeopleFixedIncome + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeFixedIncome(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleFixedIncome tcustPeopleFixedIncome = (TcustPeopleFixedIncome) object; + if ((tcustPeopleFixedIncome != null) && (tcustPeopleFixedIncome.getPk().getPersoncode() == null)) { + TcustPeopleFixedIncomeKey tcustPeopleFixedIncomeKey = new TcustPeopleFixedIncomeKey(); + tcustPeopleFixedIncomeKey.setPersoncode(personcode); + tcustPeopleFixedIncomeKey.setFixedincomesequence(tcustPeopleFixedIncome.getPk().getFixedincomesequence()); + tcustPeopleFixedIncome.setPk(tcustPeopleFixedIncomeKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustPeopleAssociation + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeAssociation(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleAssociation tcustPeopleAssociation = (TcustPeopleAssociation) object; + if ((tcustPeopleAssociation != null) && (tcustPeopleAssociation.getPk().getPersoncode() == null)) { + TcustPeopleAssociationKey tcustPeopleAssociationKey = new TcustPeopleAssociationKey(); + tcustPeopleAssociationKey.setPersoncode(personcode); + tcustPeopleAssociationKey.setAssociationsequence(tcustPeopleAssociation.getPk().getAssociationsequence()); + tcustPeopleAssociation.setPk(tcustPeopleAssociationKey); + } + } + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/CompleteHistoryActivity.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/CompleteHistoryActivity.java.svn-base new file mode 100644 index 0000000..3faf143 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/CompleteHistoryActivity.java.svn-base @@ -0,0 +1,45 @@ +package com.fp.person.rules.save; + +import com.fp.dto.save.SaveBean; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.gene.TgeneActivity; +import java.sql.Timestamp; +import java.util.List; + +/** + * Clase que se encarga de de incluir la fecha en que un registro fue modificado + * @author scastillo + */ +public class CompleteHistoryActivity extends CompletePersonAndCompany { + + /** + * Metodo que verifica si existe o no una fecha de modificacion + * @param pSaveRequest + * @return + * @throws Exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + SaveBean test = (SaveBean) pSaveRequest.get("com.fp.persistence.pcustomer.gene.TgeneActivity"); + List data = test.getModifiedRecords(); + Timestamp modifyDate = FormatDates.getInstance().getDataBaseTimestamp(); + for (int i = 0; i < data.size(); i++) { + TgeneActivity tgeneActivity = (TgeneActivity) data.get(i); + tgeneActivity.setModifyuser(pSaveRequest.getUser()); + tgeneActivity.setModifydate(modifyDate); + } + return pSaveRequest; + } + + /** + * Metodo que se ejecuta en modo reverso + * @param pSaveRequest + * @return + * @throws Exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + throw new UnsupportedOperationException("Not supported yet."); + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/CompletePersonAndCompany.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/CompletePersonAndCompany.java.svn-base new file mode 100644 index 0000000..866d761 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/CompletePersonAndCompany.java.svn-base @@ -0,0 +1,272 @@ +package com.fp.person.rules.save; + +import java.sql.Date; +import java.util.List; + +import javax.persistence.EntityManager; + +import com.fp.dto.data.SaveData; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.balance.TcustBalance; +import com.fp.persistence.pcustomer.balance.TcustBalanceKey; +import com.fp.persistence.pcustomer.balance.TcustPersonBalance; +import com.fp.persistence.pcustomer.balance.TcustPersonBalanceKey; +import com.fp.persistence.pcustomer.gene.TcustPerson; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonAddressKey; +import com.fp.persistence.pcustomer.gene.TcustPersonBankReference; +import com.fp.persistence.pcustomer.gene.TcustPersonBankReferenceKey; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; +import com.fp.persistence.pcustomer.gene.TcustPersonPersonalReference; +import com.fp.persistence.pcustomer.gene.TcustPersonPersonalReferenceKey; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pcustomer.gene.TcustPersonPhoneKey; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Clase padre que se encarga de completar el personcode cuando se crea una nueva persona: juridica o natural + * + * @author Wilson Sigcho + * @version 2.1 + */ +@SuppressWarnings("serial") +public abstract class CompletePersonAndCompany extends TransactionRule { + + /** + * Metodo que devuelve la secuencia que le pertenece a una nueva persona. + * + * @return Codigo de la nueva persona. + * @throws Exception + */ + protected Integer getPersonCode() throws Exception { + Sequence sequence = new Sequence(); + Integer personcode = Integer.valueOf(sequence.getNextValue("PERSONCODE").toString()); + SaveData.getMap().put("PERSONCODE", personcode.toString()); + return personcode; + } + + /** + * Metodo que devuelve el internalcode que le pertenece a una nueva persona. + * + * @return Codigo de la nueva persona. + * @throws Exception + */ + protected Integer getInternalCode() throws Exception { + Sequence sequence = new Sequence(); + Integer internalcode = Integer.valueOf(sequence.getNextValue("INTERNALCODE").toString()); + return internalcode; + } + + /** + * Metodo que crea un objeto de la clase TcustPerson + * + * @param saveRequest Objeto que posee el save requerido. + * @param personcode Codigo de la nueva persona. + * @throws Exception + */ + protected void createPerson(SaveRequest saveRequest, Integer personcode) throws Exception { + TcustPerson tcustPerson = new TcustPerson(); + tcustPerson.setPk(personcode); + EntityManager entityManager = PersistenceHelper.getEntityManager(); + entityManager.persist(tcustPerson); +// saveRequest.putSaveBean("TCUSTPERSON", tcustPerson, 1); + } + + /** + * Completa el codigo de la persona en la tabla TcustPersonDetail + * + * @param tcustPersonDetail Objeto que posee el registro a guardar en la tabla TcustPersonDetail. + * @param personcode Codigo de la nueva persona a ser guardada. + * @throws Exception + */ + protected void completePersonDetail(SaveRequest pSaveRequest, TcustPersonDetail tcustPersonDetail, Integer personcode) throws Exception { + TcustPersonDetailKey tcustPersonDetailKey = new TcustPersonDetailKey(); + tcustPersonDetailKey.setPersoncode(personcode); + tcustPersonDetail.setPk(tcustPersonDetailKey); + } + + /** + * Metodo que completa informaci�n faltante + * + * @param pSaveRequest + * @param tcustPersonDetail + */ + protected void completeAditionalInfo(SaveRequest pSaveRequest, TcustPersonDetail tcustPersonDetail) { + if (tcustPersonDetail != null) { + if (tcustPersonDetail.getBranchcode() != null) { + return; + } + tcustPersonDetail.setCompanycode(pSaveRequest.getCompany()); + tcustPersonDetail.setBranchcode(pSaveRequest.getBranchCode()); + tcustPersonDetail.setOfficecode(pSaveRequest.getOfficeCode()); + tcustPersonDetail.setIngressuser(pSaveRequest.getUser()); + tcustPersonDetail.setRegisterdate((Date) pSaveRequest.get("accountingdate")); + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustPersonAddress + * + * @param lDetail + * @param personcode + * @throws Exception + */ + protected void completeAddress(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPersonAddress tcustPersonAddress = (TcustPersonAddress) object; + if ((tcustPersonAddress != null) && (tcustPersonAddress.getPk().getPersoncode() == null)) { + TcustPersonAddressKey tcustPersonAddressKey = new TcustPersonAddressKey(); + tcustPersonAddressKey.setAddressnumber(tcustPersonAddress.getPk().getAddressnumber()); + tcustPersonAddressKey.setPersoncode(personcode); + tcustPersonAddress.setPk(tcustPersonAddressKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustPersonPhone + * + * @param lDetail + * @param personcode + * @throws Exception + */ + protected void completePhone(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPersonPhone tcustPersonPhone = (TcustPersonPhone) object; + if ((tcustPersonPhone != null) && (tcustPersonPhone.getPk().getPersoncode() == null)) { + TcustPersonPhoneKey tcustPersonPhoneKey = new TcustPersonPhoneKey(); + tcustPersonPhoneKey.setPersoncode(personcode); + tcustPersonPhoneKey.setPhonesequence(tcustPersonPhone.getPk().getPhonesequence()); + tcustPersonPhone.setPk(tcustPersonPhoneKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustPersonBankReference + * + * @param lDetail + * @param personcode + * @throws Exception + */ + protected void completeBankReference(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPersonBankReference tcustPersonBankReference = (TcustPersonBankReference) object; + if ((tcustPersonBankReference != null) && (tcustPersonBankReference.getPk().getPersoncode() == null)) { + TcustPersonBankReferenceKey tcustPersonBankReferenceKey = new TcustPersonBankReferenceKey(); + tcustPersonBankReferenceKey.setPersoncode(personcode); + tcustPersonBankReferenceKey.setReferencesequence(tcustPersonBankReference.getPk().getReferencesequence()); + tcustPersonBankReference.setPk(tcustPersonBankReferenceKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustPersonPersonalReference + * + * @param lDetail + * @param personcode + * @throws Exception + */ + protected void completePersonalReference(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPersonPersonalReference tcustPersonPersonalReference = (TcustPersonPersonalReference) object; + if ((tcustPersonPersonalReference != null) && (tcustPersonPersonalReference.getPk().getPersoncode() == null)) { + TcustPersonPersonalReferenceKey tcustPersonPersonalReferenceKey = new TcustPersonPersonalReferenceKey(); + tcustPersonPersonalReferenceKey.setPersoncode(personcode); + tcustPersonPersonalReferenceKey.setReferencesequence(tcustPersonPersonalReference.getPk().getReferencesequence()); + tcustPersonPersonalReference.setPk(tcustPersonPersonalReferenceKey); + } + } + } + + /** + * Metodo que crea un objeto TcustBalance + * + * @param saveRequest Objeto que posee el save requerido. + * @param personcode Codigo de la persona. + * @param balancedate Fecha de balance de la nueva persona. + * @throws Exception + */ + protected void createBalance(Integer personcode, Date balancedate, SaveRequest saveRequest) throws Exception { + TcustBalanceKey tcustBalanceKey = new TcustBalanceKey(); + tcustBalanceKey.setPersoncode(personcode); + tcustBalanceKey.setBalancedate(balancedate); + TcustBalance tcustBalance = new TcustBalance(tcustBalanceKey); + PersistenceHelper.save(tcustBalance); +// saveRequest.putSaveBean("TCUSTBALANCE", tcustBalance, 1); + } + + /** + * + * @param tcustPersonBalance + * @param personcode + * @param saveRequest + * @throws Exception + */ + protected void completeBalance(TcustPersonBalance tcustPersonBalance, Integer personcode, SaveRequest saveRequest) throws Exception { + if (tcustPersonBalance == null) { + return; + } + if ((tcustPersonBalance != null) && (tcustPersonBalance.getPk().getPersoncode() == null)) { + TcustBalanceKey tcustBalanceKey = new TcustBalanceKey(personcode, tcustPersonBalance.getPk().getBalancedate()); + TcustBalance tcustBalance = TcustBalance.find(PersistenceHelper.getEntityManager(), tcustBalanceKey); + if (tcustBalance == null) { + this.createBalance(personcode, tcustPersonBalance.getPk().getBalancedate(), saveRequest); + } + TcustPersonBalanceKey tcustPersonBalanceKey = new TcustPersonBalanceKey(); + tcustPersonBalanceKey.setPersoncode(personcode); + tcustPersonBalanceKey.setBalancedate(tcustPersonBalance.getPk().getBalancedate()); + tcustPersonBalance.setPk(tcustPersonBalanceKey); + } + } + + /** + * Metodo que verifica el codigo de balance caso contrario lo crea + * + * @param personbalance Lista de objetos de TcustBalancePerson + * @param pSaveRequest Objeto SaveRequest + * @throws Exception + */ + protected void balanceCode(TcustPersonBalance tcustPersonBalance, SaveRequest pSaveRequest) throws Exception { + FinancialSituation financialSituation = new FinancialSituation(); + if (tcustPersonBalance == null) { + return; + } + TcustPersonBalanceKey tcustPersonBalanceKey = new TcustPersonBalanceKey(tcustPersonBalance.getPk().getPersoncode(), tcustPersonBalance + .getPk().getBalancedate(), tcustPersonBalance.getPk().getBalancecatalog(), tcustPersonBalance.getPk().getBalancecatalogcode(), + FormatDates.getDefaultExpiryTimestamp()); + TcustPersonBalance tcustPersonBalanceAux = TcustPersonBalance.find(PersistenceHelper.getEntityManager(), tcustPersonBalanceKey); + if ((tcustPersonBalanceAux != null) && (tcustPersonBalance.getPk().getDateto() == null) && (tcustPersonBalance.getDatefrom() == null) + && (tcustPersonBalance.getRecordversion() == null)) { + tcustPersonBalance.getPk().setDateto(FormatDates.getDefaultExpiryTimestamp()); + tcustPersonBalance.setRecordversion(tcustPersonBalanceAux.getRecordversion()); + } + TcustBalanceKey tcustBalanceKey = new TcustBalanceKey(tcustPersonBalance.getPk().getPersoncode(), tcustPersonBalance.getPk().getBalancedate()); + TcustBalance tcustBalance = TcustBalance.find(PersistenceHelper.getEntityManager(), tcustBalanceKey); + if (tcustBalance == null) { + this.createBalance(tcustPersonBalance.getPk().getPersoncode(), tcustPersonBalance.getPk().getBalancedate(), pSaveRequest); + } + // List listBalanceFinancial = + financialSituation.completeFinancialSituation(tcustPersonBalance, pSaveRequest); + // if (!listBalanceFinancial.isEmpty()) { + // pSaveRequest.putSaveBean("TCUSTBALANCEFINANCIAL", listBalanceFinancial, 5); + // } + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/CompletePersonCode.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/CompletePersonCode.java.svn-base new file mode 100644 index 0000000..d6b467b --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/CompletePersonCode.java.svn-base @@ -0,0 +1,468 @@ +package com.fp.person.rules.save; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import javax.persistence.EntityManager; + +import com.fp.dto.Response; +import com.fp.dto.save.SaveBean; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.balance.TcustPersonBalance; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonAddressKey; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pcustomer.people.TcustPeople; +import com.fp.persistence.pcustomer.people.TcustPeopleAditionalData; +import com.fp.persistence.pcustomer.people.TcustPeopleAssociation; +import com.fp.persistence.pcustomer.people.TcustPeopleAssociationKey; +import com.fp.persistence.pcustomer.people.TcustPeopleExpenses; +import com.fp.persistence.pcustomer.people.TcustPeopleExpensesKey; +import com.fp.persistence.pcustomer.people.TcustPeopleFixedIncome; +import com.fp.persistence.pcustomer.people.TcustPeopleFixedIncomeKey; +import com.fp.persistence.pcustomer.people.TcustPeopleIncome; +import com.fp.persistence.pcustomer.people.TcustPeopleIncomeKey; +import com.fp.persistence.pcustomer.people.TcustPeopleJob; +import com.fp.persistence.pcustomer.people.TcustPeopleJobKey; +import com.fp.persistence.pcustomer.people.TcustPeopleKey; +import com.fp.persistence.pcustomer.people.TcustPeopleLoan; +import com.fp.persistence.pcustomer.people.TcustPeopleLoanKey; +import com.fp.persistence.pcustomer.people.TcustPeopleOtherAssets; +import com.fp.persistence.pcustomer.people.TcustPeopleOtherAssetsKey; +import com.fp.persistence.pcustomer.people.TcustPeopleRealAssets; +import com.fp.persistence.pcustomer.people.TcustPeopleRealAssetsKey; +import com.fp.persistence.pcustomer.people.TcustPeopleTradereferences; +import com.fp.persistence.pcustomer.people.TcustPeopleTradereferencesKey; +import com.fp.persistence.pcustomer.people.TcustPeopleVehicle; +import com.fp.persistence.pcustomer.people.TcustPeopleVehicleKey; +import com.fp.persistence.pgeneral.safe.TsafeUser; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetailKey; +import com.fp.person.validate.ValidateIdentification; + +/** + * Clase que se encarga de completar el personcode cuando se crea una nueva + * persona natural + * + * @author Santiago Castillo + * @version 2.1 + */ +public class CompletePersonCode extends CompletePersonAndCompany { + + /** + * Metodo que se encarga de completar el codigo de persona para su creacion + * cuando un save es requerido. + * + * @param pSaveRequest + * @return + * @throws Exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + try { + TcustPersonDetail tcustPersonDetail = (TcustPersonDetail) pSaveRequest.getSaveBeanModifiedObject("TCUSTPERSONDETAIL"); + TcustPeople tcustPeople = (TcustPeople) pSaveRequest.getSaveBeanModifiedObject("TCUSTPEOPLE"); + + if (tcustPersonDetail != null) { + switch (tcustPersonDetail.getIdentificationcatalog()) { + case "CED": + if (!ValidateIdentification.cedula(tcustPersonDetail.getIdentification())) { + throw new GeneralException("CUST-0013", "CDULA NO VLIDA"); + } + break; + case "RUC": + if (!ValidateIdentification.ruc(tcustPersonDetail.getIdentification())) { + throw new GeneralException("CUST-0014", "RUC NO VLIDO"); + } + break; + } + } + + //TcustPersonBalance tcustPersonBalance = (TcustPersonBalance) pSaveRequest.getSaveBeanModifiedObject("TCUSTPERSONBALANCE"); + SaveBean sbTcustPersonBalance = (SaveBean) pSaveRequest.get("com.fp.persistence.pcustomer.balance.TcustPersonBalance"); + TcustPersonBalance tcustPersonBalance = null; + if (sbTcustPersonBalance != null) { + tcustPersonBalance = (TcustPersonBalance) sbTcustPersonBalance.getModifiedObject(); + } + Object aditionalData = pSaveRequest.getSaveBeanModifiedObject("TCUSTPEOPLEADITIONALDATA"); + List tcustPersonAddress = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONADDRESS"); + if(tcustPersonAddress==null || tcustPersonAddress.size()==0){ + Object adress= pSaveRequest.getSaveBeanModifiedObject("TCUSTPERSONADDRESS"); + if(adress!=null){ + tcustPersonAddress.add(adress); + } + } + + List tcustPersonPhone = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONPHONE"); + if(tcustPersonPhone==null || tcustPersonPhone.size()==0){ + Object phone= pSaveRequest.getSaveBeanModifiedObject("TCUSTPERSONPHONE"); + if(phone!=null){ + tcustPersonPhone.add(phone); + } + } + List income = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEINCOME"); + List expenses = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEEXPENSES"); + List job = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEJOB"); + List vehicles = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEVEHICLE"); + List otherassets = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEOTHERASSETS"); + List realassets = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEREALASSETS"); + List tradereferences = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLETRADEREFERENCES"); + List bankreference = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONBANKREFERENCE"); + List personalreference = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONPERSONALREFERENCE"); + List loan = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLELOAN"); + List fixedincome = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEFIXEDINCOME"); + List association = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEASSOCIATION"); + if ((tcustPersonDetail != null) && (tcustPersonDetail.getPk().getPersoncode() == null)) { + Integer personcode = this.getPersonCode(); + this.createPerson(pSaveRequest, personcode); + this.completePersonDetail(pSaveRequest, tcustPersonDetail, personcode); + if (tcustPeople != null) { + this.completePeople(pSaveRequest, tcustPeople, personcode); + } + this.completeAddress(tcustPersonAddress, personcode); + this.completePhone(tcustPersonPhone, personcode); + + this.completeVehicles(vehicles, personcode); + this.completeOtherAssets(otherassets, personcode); + this.completeRealAssets(realassets, personcode); + this.completeIncome(income, personcode); + this.completeExpenses(expenses, personcode); + this.completeJob(job, personcode); + this.completeTradeReferences(tradereferences, personcode); + this.completeBankReference(bankreference, personcode); + this.completePersonalReference(personalreference, personcode); + this.completeLoan(loan, personcode); + this.completeAditionalData(aditionalData, personcode); + this.completeFixedIncome(fixedincome, personcode); + this.completeAssociation(association, personcode); + this.completeBalance(tcustPersonBalance, personcode, pSaveRequest); + Response response = pSaveRequest.getResponse(); + response.put("personcode", personcode); + response.put("personname", tcustPersonDetail.getName()); + + // Creacion de usuario del sistema + EntityManager entityManager = PersistenceHelper.getEntityManager(); + + Integer internalcode = getInternalCode(); + TsafeUser userObj = new TsafeUser(); + userObj.setPk(tcustPersonDetail.getIdentification()); + userObj.setPersoncode(personcode); + userObj.setCompanycode(1); + userObj.setInternalcode(internalcode); + entityManager.persist(userObj); + + // Creacion de usuario DETALLE del sistema + TsafeUserDetailKey userDetailKeyObj = new TsafeUserDetailKey(); + userDetailKeyObj.setDateto(FormatDates.getDefaultExpiryTimestamp()); + userDetailKeyObj.setPersoncode(personcode); + userDetailKeyObj.setUsercode(tcustPersonDetail.getIdentification()); + TsafeUserDetail userDetailObj = new TsafeUserDetail(); + userDetailObj.setPk(userDetailKeyObj); + userDetailObj.setRecordversion(0); + userDetailObj.setDatefrom(new Timestamp(System.currentTimeMillis())); + userDetailObj.setUserstatuscatalog("ACT"); + userDetailObj.setUserstatuscatalogcode("USERSTATUS"); + userDetailObj.setCompanycode(1); + userDetailObj.setAreacode(1); + userDetailObj.setOfficecode(1); + userDetailObj.setBranchcode(1); + userDetailObj.setChannelcode("BRC"); + userDetailObj.setLanguagecode("ES"); + userDetailObj.setNickname(tcustPersonDetail.getIdentification()); + userDetailObj.setPassword("7c4a8d09ca3762af61e59520943dc26494f8941b"); + userDetailObj.setChangepassword("Y"); + userDetailObj.setIngressuser("ADMIN"); + userDetailObj.setActivateuser("ADMIN"); + userDetailObj.setIsuserbpm("Y"); + entityManager.persist(userDetailObj); + + } + this.completeAditionalInfo(pSaveRequest, tcustPersonDetail); + this.balanceCode(tcustPersonBalance, pSaveRequest); + + } catch (Exception e) { + return pSaveRequest; + } + return pSaveRequest; + } + + /** + * Metodo para reversos + * + * @param pSaveRequest + * @return + * @throws Exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + /** + * Completa el codigo de la persona en la tabla TcustPeople + * + * @param tcustPeople + * @param personcode + * @throws Exception + */ + private void completePeople(SaveRequest pSaverequest, TcustPeople tcustPeople, Integer personcode) throws Exception { + TcustPeopleKey tcustPeopleKey = new TcustPeopleKey(); + tcustPeopleKey.setPersoncode(personcode); + tcustPeople.setPk(tcustPeopleKey); + tcustPeople.setIngressusercode(pSaverequest.getUser()); + } + + /** + * Metodo que se encarga de completar el personcode en la tabla + * Tcustpeoplejob + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeJob(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleJob tcustPeopleJob = (TcustPeopleJob) object; + if ((tcustPeopleJob != null) && (tcustPeopleJob.getPk().getPersoncode() == null)) { + TcustPeopleJobKey tcustPeopleJobKey = new TcustPeopleJobKey(); + tcustPeopleJobKey.setPersoncode(personcode); + tcustPeopleJobKey.setJobsequence(tcustPeopleJob.getPk().getJobsequence()); + tcustPeopleJob.setPk(tcustPeopleJobKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla + * TcustPeopleVehicle + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeVehicles(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleVehicle tcustPeopleVehicle = (TcustPeopleVehicle) object; + if ((tcustPeopleVehicle != null) && (tcustPeopleVehicle.getPk().getPersoncode() == null)) { + TcustPeopleVehicleKey tcustPeopleVehicleKey = new TcustPeopleVehicleKey(); + tcustPeopleVehicleKey.setPersoncode(personcode); + tcustPeopleVehicleKey.setVehiclesequence(tcustPeopleVehicle.getPk().getVehiclesequence()); + tcustPeopleVehicle.setPk(tcustPeopleVehicleKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla + * TcustPeopleOtherAssets + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeOtherAssets(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleOtherAssets tcustPeopleOtherAssets = (TcustPeopleOtherAssets) object; + if ((tcustPeopleOtherAssets != null) && (tcustPeopleOtherAssets.getPk().getPersoncode() == null)) { + TcustPeopleOtherAssetsKey tcustPeopleOtherAssetsKey = new TcustPeopleOtherAssetsKey(); + tcustPeopleOtherAssetsKey.setPersoncode(personcode); + tcustPeopleOtherAssetsKey.setAssetssequence(tcustPeopleOtherAssets.getPk().getAssetssequence()); + tcustPeopleOtherAssets.setPk(tcustPeopleOtherAssetsKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla + * TcustPeopleRealAssets + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeRealAssets(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleRealAssets tcustPeopleRealAssets = (TcustPeopleRealAssets) object; + if ((tcustPeopleRealAssets != null) && (tcustPeopleRealAssets.getPk().getPersoncode() == null)) { + TcustPeopleRealAssetsKey tcustPeopleRealAssetsKey = new TcustPeopleRealAssetsKey(); + tcustPeopleRealAssetsKey.setPersoncode(personcode); + tcustPeopleRealAssetsKey.setAssetssequence(tcustPeopleRealAssets.getPk().getAssetssequence()); + tcustPeopleRealAssets.setPk(tcustPeopleRealAssetsKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla + * TcustPeopleTradeReferences + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeTradeReferences(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleTradereferences tcustPeopleTradereferences = (TcustPeopleTradereferences) object; + if ((tcustPeopleTradereferences != null) && (tcustPeopleTradereferences.getPk().getPersoncode() == null)) { + TcustPeopleTradereferencesKey tcustPeopleTradereferencesKey = new TcustPeopleTradereferencesKey(); + tcustPeopleTradereferencesKey.setPersoncode(personcode); + tcustPeopleTradereferencesKey.setTradesequence(tcustPeopleTradereferences.getPk().getTradesequence()); + tcustPeopleTradereferences.setPk(tcustPeopleTradereferencesKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla + * TcustPeopleIncome + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeIncome(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleIncome tcustPeopleIncome = (TcustPeopleIncome) object; + if ((tcustPeopleIncome != null) && (tcustPeopleIncome.getPk().getPersoncode() == null)) { + TcustPeopleIncomeKey tcustPeopleIncomeKey = new TcustPeopleIncomeKey(); + tcustPeopleIncomeKey.setPersoncode(personcode); + tcustPeopleIncomeKey.setIncomesequence(tcustPeopleIncome.getPk().getIncomesequence()); + tcustPeopleIncome.setPk(tcustPeopleIncomeKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla + * TcustPeopleExpenses + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeExpenses(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleExpenses tcustPeopleExpenses = (TcustPeopleExpenses) object; + if ((tcustPeopleExpenses != null) && (tcustPeopleExpenses.getPk().getPersoncode() == null)) { + TcustPeopleExpensesKey tcustPeopleExpensesKey = new TcustPeopleExpensesKey(); + tcustPeopleExpensesKey.setPersoncode(personcode); + tcustPeopleExpensesKey.setExpensesequence(tcustPeopleExpenses.getPk().getExpensesequence()); + tcustPeopleExpenses.setPk(tcustPeopleExpensesKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla + * TcustPeopleLoan + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeLoan(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleLoan tcustPeopleLoan = (TcustPeopleLoan) object; + if ((tcustPeopleLoan != null) && (tcustPeopleLoan.getPk().getPersoncode() == null)) { + TcustPeopleLoanKey tcustPeopleLoanKey = new TcustPeopleLoanKey(); + tcustPeopleLoanKey.setPersoncode(personcode); + tcustPeopleLoanKey.setLoansequence(tcustPeopleLoan.getPk().getLoansequence()); + tcustPeopleLoan.setPk(tcustPeopleLoanKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla + * TcustPeopleAditionalData + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeAditionalData(Object lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + TcustPeopleAditionalData tcustPeopleAditionalData = (TcustPeopleAditionalData) lDetail; + if ((tcustPeopleAditionalData != null) && (tcustPeopleAditionalData.getPk().getPersoncode() == null)) { + tcustPeopleAditionalData.getPk().setPersoncode(personcode); + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla + * TcustPeopleFixedIncome + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeFixedIncome(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleFixedIncome tcustPeopleFixedIncome = (TcustPeopleFixedIncome) object; + if ((tcustPeopleFixedIncome != null) && (tcustPeopleFixedIncome.getPk().getPersoncode() == null)) { + TcustPeopleFixedIncomeKey tcustPeopleFixedIncomeKey = new TcustPeopleFixedIncomeKey(); + tcustPeopleFixedIncomeKey.setPersoncode(personcode); + tcustPeopleFixedIncomeKey.setFixedincomesequence(tcustPeopleFixedIncome.getPk().getFixedincomesequence()); + tcustPeopleFixedIncome.setPk(tcustPeopleFixedIncomeKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla + * TcustPeopleAssociation + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeAssociation(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleAssociation tcustPeopleAssociation = (TcustPeopleAssociation) object; + if ((tcustPeopleAssociation != null) && (tcustPeopleAssociation.getPk().getPersoncode() == null)) { + TcustPeopleAssociationKey tcustPeopleAssociationKey = new TcustPeopleAssociationKey(); + tcustPeopleAssociationKey.setPersoncode(personcode); + tcustPeopleAssociationKey.setAssociationsequence(tcustPeopleAssociation.getPk().getAssociationsequence()); + tcustPeopleAssociation.setPk(tcustPeopleAssociationKey); + } + } + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/FinancialSituation.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/FinancialSituation.java.svn-base new file mode 100644 index 0000000..64828e4 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/FinancialSituation.java.svn-base @@ -0,0 +1,145 @@ +package com.fp.person.rules.save; + +import java.math.BigDecimal; +import java.sql.Date; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.save.SaveRequest; +import com.fp.excel.ExcelToMap; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.balance.TcustBalanceAccount; +import com.fp.persistence.pcustomer.balance.TcustBalanceFinancial; +import com.fp.persistence.pcustomer.balance.TcustBalanceFinancialKey; +import com.fp.persistence.pcustomer.balance.TcustPersonBalance; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.image.TgeneFilesDetailKey; + +/** + * Clase que graba la data recibida de Excel en la tabla TcustBalanceFinancial + * + * @author BPTWPA + */ +public class FinancialSituation { + + /** + * M�todo que graba en la base de datos las cuentas del balance subido en excel + * + * @param tcustPersonBalance Objeto TcustPersonBalance + * @param excelMap Mapa obtenido del archivo de excel + * @throws Exception + */ + // public List completeFinancialSituation(TcustPersonBalance tcustPersonBalance, SaveRequest + // pSaveRequest) throws Exception { + public void completeFinancialSituation(TcustPersonBalance tcustPersonBalance, SaveRequest pSaveRequest) throws Exception { + // List lTcustBalanceFinancial = new ArrayList(); + boolean isNew= (Boolean) pSaveRequest.get("nuevo"); + Map mapExcel; + if (tcustPersonBalance == null) { + return;// lTcustBalanceFinancial; + } + TgeneFilesDetailKey tgeneFilesDetailKey = new TgeneFilesDetailKey(tcustPersonBalance.getCode(), FormatDates.getDefaultExpiryTimestamp()); + TgeneFilesDetail tgeneFilesDetail = TgeneFilesDetail.find(PersistenceHelper.getEntityManager(), tgeneFilesDetailKey); + if (tgeneFilesDetail == null) { + return;// lTcustBalanceFinancial; + } + if (tgeneFilesDetail.getExtension().equals("xls") || tgeneFilesDetail.getExtension().equals("xlsx")) { + APPLogger.getLogger().error("2"); + ExcelToMap excelMap = new ExcelToMap(tgeneFilesDetail.getImage(), tgeneFilesDetail.getExtension()); + mapExcel = excelMap.getExcelMap(); + APPLogger.getLogger().error("3"); + if ((mapExcel == null) || mapExcel.isEmpty()) { + throw new GeneralException("CUST-0009","ARCHIVO NO CUMPLE CON FORMATO REQUERIDO"); + } + APPLogger.getLogger().error("3.1"); + + if(!isNew) + this.update(tcustPersonBalance.getPk().getPersoncode(), tcustPersonBalance.getPk().getBalancedate(), tcustPersonBalance.getPk() + .getBalancecatalog(), tcustPersonBalance.getPk().getBalancecatalogcode()); + if (tcustPersonBalance.getPk().getBalancecatalog().compareTo("BG") == 0) { + APPLogger.getLogger().error("3.2"); + Integer rows = mapExcel.size() / 4; + if (!String.valueOf(mapExcel.get("1:0")).equals("") ||!String.valueOf(mapExcel.get("0:1")).equals("ACTIVOS")) { + throw new GeneralException("CUST-0004", "El ARCHIVO NO ES EL CORRECTO - BG"); + } + APPLogger.getLogger().error("3.3"); + for (int i = 1; i <= rows; i++) { + TcustBalanceFinancial tcustBalanceFinancial = new TcustBalanceFinancial(); + String parameter = i + ":3"; + if (mapExcel.containsKey(parameter)) { + TcustBalanceAccount tcustBalanceAccount = TcustBalanceAccount.findPerParameter(PersistenceHelper.getEntityManager(), + parameter); + if (tcustBalanceAccount != null) { + Object value = mapExcel.get(parameter); + TcustBalanceFinancialKey tcustBalanceFinancialKey = new TcustBalanceFinancialKey(); + tcustBalanceFinancialKey.setPersoncode(tcustPersonBalance.getPk().getPersoncode()); + tcustBalanceFinancialKey.setBalancedate(tcustPersonBalance.getPk().getBalancedate()); + tcustBalanceFinancialKey.setBalancecatalog(tcustPersonBalance.getPk().getBalancecatalog()); + tcustBalanceFinancialKey.setBalancecatalogcode(tcustPersonBalance.getPk().getBalancecatalogcode()); + tcustBalanceFinancialKey.setDateto(FormatDates.getDefaultExpiryTimestamp()); + tcustBalanceFinancialKey.setAccountcode(tcustBalanceAccount.getPk().getAccountcode()); + tcustBalanceFinancial.setPk(tcustBalanceFinancialKey); + tcustBalanceFinancial.setValueaccount(new BigDecimal(value.getClass().getSimpleName().equals("BigDecimal") ? String + .valueOf(value) : "0")); + tcustBalanceFinancial.setIngressuser(pSaveRequest.getUser()); + PersistenceHelper.save(tcustBalanceFinancial); + // lTcustBalanceFinancial.add(tcustBalanceFinancial); + + } + } + } + APPLogger.getLogger().error("3.2"); + } else { + APPLogger.getLogger().error("3.4"); + Integer rows = mapExcel.size() / 3; + if (String.valueOf(mapExcel.get("1:0")).equals("") ||!String.valueOf(mapExcel.get("0:1")).equals("Nombre de la Cuenta")) { + throw new GeneralException("CUST-0005", "El ARCHIVO NO ES EL CORRECTO - BG(IFIS)"); + } + for (int i = 1; i <= rows; i++) { + TcustBalanceFinancial tcustBalanceFinancial = new TcustBalanceFinancial(); + String keyCode = i + ":0"; + String keyValue = i + ":2"; + if (mapExcel.containsKey(keyCode) && mapExcel.containsKey(keyValue)) { + Object code = mapExcel.get(keyCode); + Object value = mapExcel.get(keyValue); + TcustBalanceFinancialKey tcustBalanceFinancialKey = new TcustBalanceFinancialKey(); + tcustBalanceFinancialKey.setPersoncode(tcustPersonBalance.getPk().getPersoncode()); + tcustBalanceFinancialKey.setBalancedate(tcustPersonBalance.getPk().getBalancedate()); + tcustBalanceFinancialKey.setBalancecatalog(tcustPersonBalance.getPk().getBalancecatalog()); + tcustBalanceFinancialKey.setBalancecatalogcode(tcustPersonBalance.getPk().getBalancecatalogcode()); + tcustBalanceFinancialKey.setDateto(FormatDates.getDefaultExpiryTimestamp()); + tcustBalanceFinancialKey.setAccountcode(String.valueOf(code)); + tcustBalanceFinancial.setPk(tcustBalanceFinancialKey); + tcustBalanceFinancial.setValueaccount(new BigDecimal(value.getClass().getSimpleName().equals("BigDecimal") ? String + .valueOf(value) : "0")); + tcustBalanceFinancial.setIngressuser(pSaveRequest.getUser()); + PersistenceHelper.save(tcustBalanceFinancial); + // lTcustBalanceFinancial.add(tcustBalanceFinancial); + } + } + APPLogger.getLogger().error("3.5"); + } + } else { + throw new GeneralException("CUST-0006", "EXTENSIN INCORRECTA DEL ARCHIVO"); + } + APPLogger.getLogger().error("4"); + // return lTcustBalanceFinancial; + } + + private void update(Integer pPerson, Date pDate, String pCatalog, String pCatalogCode) throws Exception { + String sql = "update TCUSTBALANCEFINANCIAL set dateto=:dateto where PERSONCODE=:PERSON and BALANCEDATE=:date" + + " and BALANCECATALOG=:TYPE and BALANCECATALOGCODE=:TYPECODE and dateto=:vig"; + Query q = PersistenceHelper.createNativeQuery(sql); + q.setParameter("dateto", FormatDates.getInstance().getDataBaseTimestamp()); + q.setParameter("PERSON", pPerson); + q.setParameter("date", pDate); + q.setParameter("TYPE", pCatalog); + q.setParameter("TYPECODE", pCatalogCode); + q.setParameter("vig", FormatDates.getDefaultExpiryTimestamp()); + q.executeUpdate(); + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/JuridicalPerson.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/JuridicalPerson.java.svn-base new file mode 100644 index 0000000..2f56e04 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/JuridicalPerson.java.svn-base @@ -0,0 +1,137 @@ +package com.fp.person.rules.save; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.joda.time.DateTime; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.company.TcustCompany; +import com.fp.persistence.pcustomer.company.TcustCompanyKey; +import com.fp.persistence.pcustomer.gene.TcustPerson; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonAddressKey; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pcustomer.gene.TcustPersonPhoneKey; +import com.fp.sessionbeans.helper.Sequence; + +public class JuridicalPerson extends TransactionRule { + + private static final long serialVersionUID = 1L; + + @SuppressWarnings("unchecked") + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + try { + TcustPersonDetail detallesPersona=(TcustPersonDetail)pSaveRequest.get("PERSON"); + TcustCompany company=(TcustCompany)pSaveRequest.get("COMPANY"); + List direcciones=(List)pSaveRequest.get("ADDRESSES"); + List telefonos=(List)pSaveRequest.get("PHONES"); + + //Persistiendo el TCUSTPERSON + TcustPersonDetailKey pkDetallesPersona=new TcustPersonDetailKey(); + + Calendar calendarioDateto=Calendar.getInstance(); + calendarioDateto.set(Calendar.YEAR, 2999); + calendarioDateto.set(Calendar.MONTH, Calendar.DECEMBER); + calendarioDateto.set(Calendar.DAY_OF_MONTH,31); + calendarioDateto.set(Calendar.MILLISECOND, 0); + calendarioDateto.set(Calendar.SECOND, 0); + calendarioDateto.set(Calendar.MINUTE, 0); + calendarioDateto.set(Calendar.HOUR, 0); + + //Caso en que la persona es nueva + if(detallesPersona.isnew && (detallesPersona.getPk()==null || detallesPersona.getPk().getPersoncode()==null)){ + Sequence sequence = new Sequence(); + Integer personcode=Integer.valueOf(sequence.getNextValue("PERSONCODE").toString()); + TcustPerson persona=new TcustPerson(); + if(personcode!=null){ + persona.setPk(personcode); + pkDetallesPersona.setPersoncode(personcode); + //PersistenceHelper.getEntityManager().persist(persona); + } + + pkDetallesPersona.setDateto(FormatDates.getDefaultExpiryTimestamp()); + detallesPersona.setPk(pkDetallesPersona); + }else{ + pkDetallesPersona=detallesPersona.getPk(); + } + + //Persistiendo el TCUSTPERSONDETAIL + if(!detallesPersona.isnew){ + detallesPersona=(TcustPersonDetail)PersistenceHelper.getEntityManager().merge(detallesPersona); + } + //PersistenceHelper.getEntityManager().persist(detallesPersona); + + //Persistiendo el TCUSTCOMPANY + //Caso en que la compannia es nueva + // if(company.isnew && (company.getPk()==null || company.getPk().getPersoncode()==null)){ + TcustCompanyKey pkJuridica=new TcustCompanyKey(); + // pkJuridica.setDateto(new Timestamp(calendarioDateto.getTimeInMillis())); + pkJuridica.setDateto(FormatDates.getDefaultExpiryTimestamp()); + pkJuridica.setPersoncode(pkDetallesPersona.getPersoncode()); + company.setPk(pkJuridica); + // } + +/* if(!company.isnew){ + company=(TcustCompany)PersistenceHelper.getEntityManager().merge(company); + }*/ + // PersistenceHelper.getEntityManager().persist(company); + + //Persistiendo las direcciones + for (TcustPersonAddress direccion : direcciones) { + if(direccion.getPk()!=null && direccion.getPk().getAddressnumber()!=null && direccion.getPk().getPersoncode()!=null && direccion.getPk().getDateto()!=null){ + direccion=PersistenceHelper.getEntityManager().merge(direccion); + //PersistenceHelper.getEntityManager().persist(direccion); + }else{ + TcustPersonAddressKey pkDireccion=new TcustPersonAddressKey(); + pkDireccion.setPersoncode(pkDetallesPersona.getPersoncode()); + pkDireccion.setDateto(FormatDates.getDefaultExpiryTimestamp()); + + direccion.setPk(pkDireccion); + direccion.setDatefrom(new Timestamp(Calendar.getInstance().getTimeInMillis())); + PersistenceHelper.getEntityManager().persist(direccion); + } + } + + //Persistiendo los telefonos + for (TcustPersonPhone telefono : telefonos) { + if(telefono.getPk()!=null && telefono.getPk().getPersoncode()!=null){ + telefono=PersistenceHelper.getEntityManager().merge(telefono); + //PersistenceHelper.getEntityManager().persist(telefono); + }else{ + TcustPersonPhoneKey pkTelefono=new TcustPersonPhoneKey(); + pkTelefono.setPersoncode(pkDetallesPersona.getPersoncode()); + pkTelefono.setDateto(FormatDates.getDefaultExpiryTimestamp()); + + telefono.setPk(pkTelefono); + telefono.setDatefrom(new Timestamp(Calendar.getInstance().getTimeInMillis())); + PersistenceHelper.getEntityManager().persist(telefono); + } + } + + // PersistenceHelper.getEntityManager().flush(); + + } catch (Exception e) { + return pSaveRequest; + } + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + + return arg0; + } + + + +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/LogoImage.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/LogoImage.java.svn-base new file mode 100644 index 0000000..b21c3a0 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/LogoImage.java.svn-base @@ -0,0 +1,108 @@ +package com.fp.person.rules.save; + +import com.fp.dto.helper.FileHelper; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.company.TcustCompany; +import com.fp.persistence.pcustomer.company.TcustCompanyKey; +import com.fp.persistence.pgeneral.image.TgeneFiles; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.image.TgeneFilesDetailKey; +import java.sql.Timestamp; +import java.util.List; + +/** + * Clase que se encarga de agregar o modificar los logos de una empresa + * + * @author scastillo + */ +public class LogoImage extends TransactionRule { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Metodo que genera el numero de sequencia de imagenes para el logo de + * empresas + * + * @param sr + * @return + * @throws Exception + */ + @Override + public SaveRequest normalProcess(SaveRequest sr) throws Exception { + Integer personcode = (Integer) sr.get("pk_personcode"); + Integer logocode = (Integer) sr.get("logocode"); + List fileItem = (List) sr.get("file"); + if (fileItem!=null && !fileItem.isEmpty() && fileItem.size() == 1) { + if(fileItem.get(0).getExtension() != null){ + if (fileItem.get(0).getExtension().toLowerCase().compareTo("jpg") == 0 + || fileItem.get(0).getExtension().toLowerCase().compareTo("gif") == 0 + || fileItem.get(0).getExtension().toLowerCase().compareTo("png") == 0) { + int contador = 1; + if (logocode == null) { + logocode = PersonImage.getFileCode(); + TgeneFiles tgeneFiles = new TgeneFiles(); + tgeneFiles.setPk(logocode); + sr.putSaveBean("TGENEFILES", tgeneFiles, (contador++)); + } + TgeneFilesDetailKey tgeneFilesDetailKey = new TgeneFilesDetailKey(); + tgeneFilesDetailKey.setCode(logocode); + Timestamp fechaactual = FormatDates.getInstance().getDataBaseTimestamp(); + TgeneFilesDetail tgeneFilesDetail = TgeneFilesDetail.find( + PersistenceHelper.getEntityManager(), + tgeneFilesDetailKey); + if (tgeneFilesDetail == null) { + tgeneFilesDetail = new TgeneFilesDetail(); + tgeneFilesDetail.setPk(tgeneFilesDetailKey); + tgeneFilesDetail.setImage(fileItem.get(0).getImage()); + tgeneFilesDetail.setCapturedate(FormatDates.getInstance().getDataBaseDate()); + tgeneFilesDetail.setImagesize(Integer.parseInt(String.valueOf(fileItem.get(0).getSize()))); + tgeneFilesDetail.setIngressuser(sr.getUser()); + tgeneFilesDetail.setExtension(fileItem.get(0).getExtension()); + tgeneFilesDetail.setContenttype(fileItem.get(0).getContentType()); + tgeneFilesDetail.setName(fileItem.get(0).getName()); + } else { + tgeneFilesDetail.setImage(fileItem.get(0).getImage()); + tgeneFilesDetail.setCapturedate(FormatDates.getInstance().getDataBaseDate()); + tgeneFilesDetail.setImagesize(Integer.parseInt(String.valueOf(fileItem.get(0).getSize()))); + tgeneFilesDetail.setDatefrom(fechaactual); + tgeneFilesDetail.setModifyuser(sr.getUser()); + tgeneFilesDetail.setContenttype(fileItem.get(0).getContentType()); + tgeneFilesDetail.setName(fileItem.get(0).getName()); + PersistenceHelper.getEntityManager().detach( + tgeneFilesDetail); + } + sr.putSaveBean("TGENEFILESDETAIL", tgeneFilesDetail, + (contador++)); + TcustCompanyKey tcustCompanyKey = new TcustCompanyKey(); + tcustCompanyKey.setPersoncode(personcode); + tcustCompanyKey.setDateto(FormatDates.getDefaultExpiryTimestamp()); + TcustCompany tcustCompany = TcustCompany.find( + PersistenceHelper.getEntityManager(), tcustCompanyKey); + tcustCompany.setModifyuser(sr.getUser()); + tcustCompany.setPicture(fileItem.get(0).getImage()); + tcustCompany.setLogo(logocode); + tcustCompany.setDatefrom(fechaactual); + PersistenceHelper.getEntityManager().detach(tcustCompany); + sr.putSaveBean("TCUSTCOMPANY", tcustCompany, (contador++)); + } else { + throw new GeneralException("CUST-0007", "Los tipos de archivos permitidos son jpg, gif y png"); + } + } + } + sr.getResponse().put("codes", "[" + logocode + "]"); + return sr; + } + + @Override + public SaveRequest reverseProcess(SaveRequest sr) throws Exception { + return sr; + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/PersonBalanceFile.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/PersonBalanceFile.java.svn-base new file mode 100644 index 0000000..d6be719 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/PersonBalanceFile.java.svn-base @@ -0,0 +1,79 @@ +package com.fp.person.rules.save; + +import java.util.List; + +import javax.persistence.EntityManager; + +import com.fp.dto.helper.FileHelper; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.image.TgeneFiles; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.image.TgeneFilesDetailKey; + +/** + * Clase que se encarga de guardar los datos de la situacin financiera de + * personas y subir un archive a la DB + * + * @author BPTWPA + */ +public class PersonBalanceFile extends TransactionRule { + + /** + * Mtodo que recibe datos para registrar la informacion en la DB + * + * @param pSaveRequest Recibe un objeto SaveRequest + * @return pSaveRequest Retorna un objeto SaveRequest + * @throws Exception + */ + @SuppressWarnings("unchecked") + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + String balancefile = (String) pSaveRequest.get("balancefile"); + List fileItem = (List) pSaveRequest.get("file"); + if (fileItem == null || balancefile == null || fileItem.isEmpty()) { + return pSaveRequest; + } + if (balancefile != null && balancefile.compareTo("excelfile") == 0) { + Integer filecode = PersonImage.getFileCode(); + TgeneFiles tgeneFiles = TgeneFiles.find(PersistenceHelper.getEntityManager(), filecode); + if (tgeneFiles == null) { + tgeneFiles = new TgeneFiles(filecode); + pSaveRequest.putSaveBean("TGENEFILES", tgeneFiles, 1); + } + TgeneFilesDetailKey tgeneFilesDetailKey = new TgeneFilesDetailKey(filecode, FormatDates.getDefaultExpiryTimestamp()); + TgeneFilesDetail tgeneFilesDetail = TgeneFilesDetail.find(PersistenceHelper.getEntityManager(), tgeneFilesDetailKey); + if (tgeneFilesDetail == null) { + tgeneFilesDetail = new TgeneFilesDetail(); + tgeneFilesDetail.setPk(tgeneFilesDetailKey); + tgeneFilesDetail.setImage(fileItem.get(0).getImage()); + tgeneFilesDetail.setCapturedate(FormatDates.getInstance().getDataBaseDate()); + tgeneFilesDetail.setImagesize(Integer.parseInt(String.valueOf(fileItem.get(0).getSize()))); + tgeneFilesDetail.setIngressuser(pSaveRequest.getUser()); + tgeneFilesDetail.setExtension(fileItem.get(0).getExtension()); + tgeneFilesDetail.setContenttype(fileItem.get(0).getContentType()); + tgeneFilesDetail.setName(fileItem.get(0).getName()); + } else { + tgeneFilesDetail.setImage(fileItem.get(0).getImage()); + tgeneFilesDetail.setCapturedate(FormatDates.getInstance().getDataBaseDate()); + tgeneFilesDetail.setImagesize(Integer.parseInt(String.valueOf(fileItem.get(0).getSize()))); + tgeneFilesDetail.setDatefrom(FormatDates.getInstance().getDataBaseTimestamp()); + tgeneFilesDetail.setModifyuser(pSaveRequest.getUser()); + tgeneFilesDetail.setContenttype(fileItem.get(0).getContentType()); + tgeneFilesDetail.setName(fileItem.get(0).getName()); + EntityManager em = PersistenceHelper.getEntityManager(); + em.detach(tgeneFilesDetail); + } + pSaveRequest.putSaveBean("TGENEFILESDETAIL", tgeneFilesDetail, 2); + pSaveRequest.getResponse().put("codes", "[" + filecode + "]"); + } + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/PersonImage.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/PersonImage.java.svn-base new file mode 100644 index 0000000..82ecf26 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/PersonImage.java.svn-base @@ -0,0 +1,137 @@ +package com.fp.person.rules.save; + +import java.util.List; + +import com.fp.dto.helper.FileHelper; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.people.TcustPeople; +import com.fp.persistence.pcustomer.people.TcustPeopleKey; +import com.fp.persistence.pgeneral.image.TgeneFiles; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.image.TgeneFilesDetailKey; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Clase que se encarga de subir a la BDD la imagen y asociar la foto y firma + * del cliente + * + * @author scastillo + */ +public class PersonImage extends TransactionRule { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Metodo que agrega una imagen en la base de datos + * + * @param pSaveRequest + * @return + * @throws Exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + Integer personcode = (Integer) pSaveRequest.get("pk_personcode"); + Integer photocode = (Integer) pSaveRequest.get("photocode"); + Integer signaturecode = (Integer) pSaveRequest.get("signaturecode"); + List fileItem = (List) pSaveRequest.get("file"); + if (fileItem.isEmpty() || fileItem.size() != 2) { + return pSaveRequest; + } + TcustPeople tcustPeople=null; + //TcustPeopleKey tcustPeopleKey = new TcustPeopleKey(personcode,FormatDates.getDefaultExpiryTimestamp()); + tcustPeople = (TcustPeople) pSaveRequest.getSaveBeanModifiedObject("TCUSTPEOPLE"); + if(tcustPeople==null){ + TcustPeopleKey tcustPeopleKey = new TcustPeopleKey(personcode,FormatDates.getDefaultExpiryTimestamp()); + tcustPeople = TcustPeople.find(PersistenceHelper.getEntityManager(), tcustPeopleKey); + } + photocode = this.buildImageCode(photocode, fileItem.get(0),pSaveRequest); + signaturecode = this.buildImageCode(signaturecode, fileItem.get(1), pSaveRequest); + if (tcustPeople!=null && tcustPeople.getPhotocode() == null && photocode != null) { + tcustPeople.setPhotocode(photocode); + tcustPeople.setModifyusercode(pSaveRequest.getUser()); + } + if (tcustPeople!=null && tcustPeople.getSignaturecode() == null && signaturecode != null) { + tcustPeople.setSignaturecode(signaturecode); + tcustPeople.setModifyusercode(pSaveRequest.getUser()); + } + + pSaveRequest.getResponse().put("codes", "["+ photocode + "," + signaturecode + "]"); + return pSaveRequest; + } + + /** + * Metodo que se ejecuta en modo reverso + * + * @param pSaveRequest + * @return + * @throws Exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) + throws Exception { + return pSaveRequest; + } + + /** + * Metodo que devuelve la secuencia que le pertenece a una nueva imagen. + * + * @return Codigo de la nueva persona. + * @throws Exception + */ + public static Integer getFileCode() throws Exception { + Sequence sequence = new Sequence(); + return Integer.valueOf(sequence.getNextValue("FILECODE").toString()); + } + + /** + * Metodo que se encarga de construir la imagen + * + * @param photocode + * @param fileItem + * @param saveRequest + * @throws Exception + */ + private Integer buildImageCode(Integer photocode, FileHelper fileItem, + SaveRequest saveRequest) throws Exception { + if (!fileItem.getName().equals("")) { + if (fileItem.getExtension().toLowerCase().compareTo("jpg") == 0 + || fileItem.getExtension().toLowerCase().compareTo("gif") == 0 + || fileItem.getExtension().toLowerCase().compareTo("png") == 0) { + if (photocode == null) { + photocode = getFileCode(); + TgeneFiles tgeneFiles = new TgeneFiles(photocode); + PersistenceHelper.save(tgeneFiles); + } + TgeneFilesDetailKey tgeneFilesDetailKey = new TgeneFilesDetailKey(photocode, FormatDates.getDefaultExpiryTimestamp()); + TgeneFilesDetail tgeneFilesDetail = TgeneFilesDetail.find(PersistenceHelper.getEntityManager(),tgeneFilesDetailKey); + if (tgeneFilesDetail == null) { + tgeneFilesDetail = new TgeneFilesDetail(tgeneFilesDetailKey); + tgeneFilesDetail.setImage(fileItem.getImage()); + tgeneFilesDetail.setCapturedate(FormatDates.getInstance().getDataBaseDate()); + tgeneFilesDetail.setImagesize(Integer.parseInt(String.valueOf(fileItem.getSize()))); + tgeneFilesDetail.setIngressuser(saveRequest.getUser()); + tgeneFilesDetail.setExtension(fileItem.getExtension()); + PersistenceHelper.save(tgeneFilesDetail); + } else { + tgeneFilesDetail.setImage(fileItem.getImage()); + tgeneFilesDetail.setCapturedate(FormatDates.getInstance().getDataBaseDate()); + tgeneFilesDetail.setImagesize(Integer.parseInt(String.valueOf(fileItem.getSize()))); + tgeneFilesDetail.setModifyuser(saveRequest.getUser()); + tgeneFilesDetail.setExtension(fileItem.getExtension()); + PersistenceHelper.saveOrUpdate(tgeneFilesDetail); + } + } else { + throw new GeneralException("CUST-0007", + "LOS TIPOS DE ARCHIVOS PERMITIDOS SON JPG, GIF Y PNG"); + } + } + return photocode; + } +} \ No newline at end of file diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/ValidateAddressPhones.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/ValidateAddressPhones.java.svn-base new file mode 100644 index 0000000..e986e8e --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/ValidateAddressPhones.java.svn-base @@ -0,0 +1,60 @@ +package com.fp.person.rules.save; + +import java.util.List; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; + +public class ValidateAddressPhones extends TransactionRule { + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + Integer personcode = null; + Object objpersoncode = pSaveRequest.get("personcode"); + if (objpersoncode instanceof String) { + personcode = Integer.parseInt(objpersoncode.toString()); + } else if (objpersoncode instanceof String) { + personcode = (Integer) objpersoncode; + } + + if ((pSaveRequest.get("TCUSTPERSONADDRESS") == null) && (pSaveRequest.get("TCUSTPERSONPHONE") == null)) { + return pSaveRequest; + } + + List laddressdel = pSaveRequest.getSaveBeanDeletedRecords("TCUSTPERSONADDRESS"); + List laddressmod = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONADDRESS"); + List laddressbase = TcustPersonAddress.findByPersonCode(PersistenceHelper.getEntityManager(), personcode); + + List laddressFinal = Constant.getFinalList(laddressbase, Constant.convertList(laddressmod, TcustPersonAddress.class), + Constant.convertList(laddressdel, TcustPersonAddress.class)); + + if ((laddressFinal == null) || laddressFinal.isEmpty()) { + throw new GeneralException("CUST-0011", "SE NECESITA INGRESAR UNA DIRECCIN"); + } + + List lphonesdel = pSaveRequest.getSaveBeanDeletedRecords("TCUSTPERSONPHONE"); + List lphonesmod = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONPHONE"); + List lphonebase = TcustPersonPhone.findPhones(PersistenceHelper.getEntityManager(), personcode, + Constant.getDefaultExpiryTimestamp()); + + List lphoneFinal = Constant.getFinalList(lphonebase, Constant.convertList(lphonesmod, TcustPersonPhone.class), + Constant.convertList(lphonesdel, TcustPersonPhone.class)); + + if ((lphoneFinal == null) || lphoneFinal.isEmpty()) { + throw new GeneralException("CUST-0012", "NECESITA UN REGISTRO TELEFNICO"); + } + + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/VerifyInConsep.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/VerifyInConsep.java.svn-base new file mode 100644 index 0000000..b3d741d --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/VerifyInConsep.java.svn-base @@ -0,0 +1,242 @@ +package com.fp.person.rules.save; + +import com.fp.common.helper.Constant; +import com.fp.dto.Response; +import com.fp.dto.data.SaveData; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.NestedSave; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; +import com.fp.persistence.pcustomer.people.TcustPeople; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.gene.OptmListaNegra; +import com.fp.persistence.pgeneral.gene.TgeneConsepLog; +import com.fp.sessionbeans.helper.Sequence; +import java.sql.Timestamp; +import java.util.List; + +/** + * + * @author hinga + */ +public abstract class VerifyInConsep extends TransactionRule { + + /** + * Metodo q busca personas que se encuentre en la lista de CONSEP y guarda auditoria de la misma + * + * @param pSaveRequest Objeto que almacena referencia a las tablas de que intervienen en el proceso con sus datos. + * @param ldata lista de objetos OptmListaNegra + * @param personId Identificacin de la persona. + * @throws Exception + */ + protected void fillConsep(SaveRequest pSaveRequest, List ldata, String personId, String firsname, String middlename, String lastname, String surename, String transaction, boolean continueSave) throws Exception { + Response resp = pSaveRequest.getResponse(); + TgeneAccountingDateBranch db = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pSaveRequest.getCompany(), 0); + Timestamp datenow = new Timestamp(db.getWorkingdate().getTime()); + Integer cod = this.getLogId(); + resp.setResponseCode("TIME-0016"); + boolean verifysindicado = false; + String saveorupdate = "N"; + if (ldata != null && !ldata.isEmpty()) { + String message = ""; + for (OptmListaNegra obj : ldata) { + if (message.compareTo("") != 0) { + message += "
"; + } + message += "(" + obj.getNombre() + " " + obj.getApellido() + ") " + "SE ENCUENTRA REGISTRADA EN LA TABLA DE CONSEP - "; + if (obj.getId_tiplisneg() == 1) { + verifysindicado = true; + saveorupdate = "N"; + message += "SINDICADO"; + } else if (obj.getId_tiplisneg() == 2 && "YES".equals((String) pSaveRequest.get("lisnegcontinue"))) { + saveorupdate = "S"; + message += "HOMNIMO"; + } else { + message += "HOMNIMO"; + } + pSaveRequest.putSaveBean("TGENECONSEP", obj); + } + for (OptmListaNegra obj : ldata) { + this.saveConsepLog(pSaveRequest, obj, personId, firsname, middlename, lastname, surename, cod, transaction, datenow, saveorupdate); + cod = cod + 1; + } + if (verifysindicado && transaction.equals("N")) { + if (!continueSave) { + throw new GeneralException("CUST-0002", "
" + message + "
NO SE PUEDE REGISTRAR EL CLIENTE"); + } + } else if (verifysindicado && transaction.equals("U")) { + resp.setResponseUserMessage(message); + } else { + if ("YES".equals((String) pSaveRequest.get("lisnegcontinue"))) { + resp.setResponseUserMessage(message); + } else { + if (!continueSave) { + throw new GeneralException("CUST-0003", "
" + message + "
NO SE REGISTRO EL CLIENTE"); + } + } + } + } else { + pSaveRequest.putSaveBean("TGENECONSEP", null); + TgeneConsepLog tgeneConsepLog = new TgeneConsepLog(); + tgeneConsepLog.setPk(cod); + tgeneConsepLog.setIdentificacion(personId); + tgeneConsepLog.setNombre_prim(firsname); + tgeneConsepLog.setNombre_seg(middlename); + tgeneConsepLog.setApellido_prim(lastname); + tgeneConsepLog.setApellido_seg(surename); + tgeneConsepLog.setId_listanegra("0"); + tgeneConsepLog.setId_tiplisneg(0L); + tgeneConsepLog.setFec_ing_lisneg(null); + tgeneConsepLog.setUsuario_cod(pSaveRequest.getUser()); + tgeneConsepLog.setFec_transaccion(datenow);//FormatDates.getInstance().getDataBaseTimestamp() + tgeneConsepLog.setTerminal(pSaveRequest.getTerminalCode()); + tgeneConsepLog.setTransaccion(transaction); + if ("N".equals(transaction)) { + tgeneConsepLog.setCreacion_cli("S"); + tgeneConsepLog.setActualizacion_cli("N"); + } else { + tgeneConsepLog.setCreacion_cli("N"); + tgeneConsepLog.setActualizacion_cli("S"); + } + tgeneConsepLog.setConstancia_consep("N"); + //Envia el bean a la base de datos en una session independiente + NestedSave nestedSave = new NestedSave(pSaveRequest.getCompany(), tgeneConsepLog); + nestedSave.start(); + //sb.join(); NO HABILITAR Espera a la ejecuciond el hijo. + resp.setResponseUserMessage("LA PERSONA NO SE ENCUENTRA REGISTRADA EN LA TABLA DEL CONSEP"); + } + } + + /** + * Metodo que guarda auditoria de los registros de CONSEP + * + * @param pSaveRequest + * @param optmListaNegra + * @param identificationConsep + * @param firsname + * @param middlename + * @param lastname + * @param surename + * @param cod + * @param transac + * @param datenow + * @param saveorupdate + * @throws Exception + */ + private void saveConsepLog(SaveRequest pSaveRequest, OptmListaNegra optmListaNegra, String identificationConsep, String firsname, + String middlename, String lastname, String surename, Integer cod, String transac, Timestamp datenow, String saveorupdate) throws Exception { + TgeneConsepLog tgeneConsepLog = new TgeneConsepLog(); + tgeneConsepLog.setPk(cod); + tgeneConsepLog.setIdentificacion(identificationConsep); + tgeneConsepLog.setNombre_prim(firsname); + tgeneConsepLog.setNombre_seg(middlename); + tgeneConsepLog.setApellido_prim(lastname); + tgeneConsepLog.setApellido_seg(surename); + tgeneConsepLog.setId_listanegra(optmListaNegra.getPk()); + tgeneConsepLog.setId_tiplisneg(optmListaNegra.getId_tiplisneg()); + tgeneConsepLog.setFec_ing_lisneg(optmListaNegra.getFec_ing_lisneg()); + tgeneConsepLog.setUsuario_cod((String) pSaveRequest.get("user")); + tgeneConsepLog.setFec_transaccion(datenow);//FormatDates.getInstance().getDataBaseTimestamp() + tgeneConsepLog.setTerminal((String) pSaveRequest.get("terminalCode")); + tgeneConsepLog.setTransaccion(transac); + if ("N".equals(transac)) { + tgeneConsepLog.setCreacion_cli(saveorupdate); + tgeneConsepLog.setActualizacion_cli("N"); + } else { + tgeneConsepLog.setCreacion_cli("N"); + tgeneConsepLog.setActualizacion_cli("S"); + } + tgeneConsepLog.setConstancia_consep("S"); + NestedSave nestedSave = new NestedSave(pSaveRequest.getCompany(), tgeneConsepLog); + nestedSave.start(); + } + + /** + * Metodo que verifica que si cambian la identificación no se encuentre SINDICADA + * + * @param tcustPeople + * @param pSaveRequest + * @param identificationConsep + * @throws Exception + */ + protected void verifyChangeIdentificationPeople(TcustPeople tcustPeople, SaveRequest pSaveRequest, String identificationConsep) throws Exception { + if (tcustPeople != null) { + TcustPersonDetail tcustPersonDetailUpdate = (TcustPersonDetail) pSaveRequest.getSaveBeanModifiedObject("TCUSTPERSONDETAIL"); + if (tcustPersonDetailUpdate != null && tcustPersonDetailUpdate.getIdentification() != null) { + TcustPersonDetailKey tcustPersonDetailKey = new TcustPersonDetailKey((Integer) pSaveRequest.get("personcode"), Constant.getDefaultExpiryTimestamp()); + TcustPersonDetail tcustPersonDetail = TcustPersonDetail.find(PersistenceHelper.getEntityManager(), tcustPersonDetailKey); + if (tcustPersonDetail != null && tcustPersonDetail.getIdentification() != null + && tcustPersonDetailUpdate.getIdentification().compareTo(tcustPersonDetail.getIdentification()) != 0) { + List ldata = OptmListaNegra.find(PersistenceHelper.getEntityManager(), identificationConsep); + if (ldata != null && !ldata.isEmpty()) { + Integer cod = this.getLogId(); + TgeneAccountingDateBranch db = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pSaveRequest.getCompany(), 0); + Timestamp datenow = new Timestamp(db.getWorkingdate().getTime()); + for (int i = 0; i < ldata.size(); i++) { + OptmListaNegra optmListaNegra = ldata.get(i); + if (optmListaNegra != null) { + if (optmListaNegra.getId_tiplisneg() != null && String.valueOf(optmListaNegra.getId_tiplisneg()).compareTo("1") == 0) { + this.saveConsepLog(pSaveRequest, optmListaNegra, identificationConsep, tcustPeople.getFirstname(), tcustPeople.getMiddlename(), + tcustPeople.getLastname(), tcustPeople.getSurename(), cod, "U", datenow, null); + throw new GeneralException("CUST-0008", "NO SE PUEDE CAMBIAR LA IDENTIFICACIN YA QUE ESTA SE ENCUENTRA COMO SINDICADA"); + } + } + } + } + } + } + } + } + + /** + * Metodo para grabar auditoria de personas juridicas en cambio de identificacion si esta como SINDICADA + * + * @param pSaveRequest + * @param identificationConsep + * @throws Exception + */ + protected void verifyChangeIdentificationPeople(SaveRequest pSaveRequest, String identificationConsep) throws Exception { + TcustPersonDetail tcustPersonDetailUpdate = (TcustPersonDetail) pSaveRequest.getSaveBeanModifiedObject("TCUSTPERSONDETAIL"); + if (tcustPersonDetailUpdate != null && tcustPersonDetailUpdate.getIdentification() != null) { + TcustPersonDetailKey tcustPersonDetailKey = new TcustPersonDetailKey((Integer) pSaveRequest.get("personcode"), Constant.getDefaultExpiryTimestamp()); + TcustPersonDetail tcustPersonDetail = TcustPersonDetail.find(PersistenceHelper.getEntityManager(), tcustPersonDetailKey); + if (tcustPersonDetail != null && tcustPersonDetail.getIdentification() != null + && tcustPersonDetailUpdate.getIdentification().compareTo(tcustPersonDetail.getIdentification()) != 0) { + List ldata = OptmListaNegra.find(PersistenceHelper.getEntityManager(), identificationConsep); + if (ldata != null && !ldata.isEmpty()) { + Integer cod = this.getLogId(); + TgeneAccountingDateBranch db = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pSaveRequest.getCompany(), 0); + Timestamp datenow = new Timestamp(db.getWorkingdate().getTime()); + for (int i = 0; i < ldata.size(); i++) { + OptmListaNegra optmListaNegra = ldata.get(i); + if (optmListaNegra != null) { + if (optmListaNegra.getId_tiplisneg() != null && String.valueOf(optmListaNegra.getId_tiplisneg()).compareTo("1") == 0) { + this.saveConsepLog(pSaveRequest, optmListaNegra, identificationConsep, tcustPersonDetail.getName(), null, + null, null, cod, "U", datenow, null); + throw new GeneralException("CUST-0008", "NO SE PUEDE CAMBIAR LA IDENTIFICACIN YA QUE ESTA SE ENCUENTRA COMO SINDICADA"); + } + } + } + } + } + } + } + + /** + * Metodoq ue obtiene la secuencia para guardar los logs + * + * @return + * @throws Exception + */ + protected Integer getLogId() throws Exception { + Sequence sequence = new Sequence(); + Integer personcode = Integer.valueOf(sequence.getNextValue("LOGCONSEP").toString()); + return personcode; + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/VerifyInConsepCompany.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/VerifyInConsepCompany.java.svn-base new file mode 100644 index 0000000..2f3c12b --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/VerifyInConsepCompany.java.svn-base @@ -0,0 +1,87 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.person.rules.save; + +import com.fp.common.helper.Constant; +import com.fp.dto.save.SaveBean; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pcustomer.company.TcustCompany; +import com.fp.persistence.pcustomer.company.TcustCompanyKey; +import com.fp.persistence.pcustomer.company.TcustCompanyManagers; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.OptmListaNegra; +import java.util.List; + +/** + * Clase que verifica si la compania se encuentra registrada en el CONSEP + * + * @author hinga + */ +public class VerifyInConsepCompany extends VerifyInConsep { + + /** + * Ejecuta la transaccion en modo normal.
Verifica que la persona que se intenta regidtrar se encuentra o no en + * la lista negra (CONSEP). + * + * @param pSaveRequest Objeto que almacena referencia a las tablas de que intervienen en el proceso con sus datos. + * @throws Exception + * @return pSaveRequest Objeto que almacena referencia a las tablas de que intervienen en el proceso con sus datos. + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + String firsname = null, transaction = null, identificationConsep = null; + identificationConsep = (String) pSaveRequest.get("identification"); + if (pSaveRequest.get("personcode") != null) { + this.verifyChangeIdentificationPeople(pSaveRequest, identificationConsep); + } + SaveBean saveBean = (SaveBean) pSaveRequest.get("TCUSTCOMPANYMANAGERS"); + if (saveBean != null) { + List lTcustCompanyManagers = saveBean.getModifiedRecords(); + for (int i = 0; i < lTcustCompanyManagers.size(); i++) { + TcustCompanyManagers tcustCompanyManagers = (TcustCompanyManagers) lTcustCompanyManagers.get(i); + if (tcustCompanyManagers.getPk() != null && tcustCompanyManagers.getPk().getManagerpersoncode() != null) { + TcustPersonDetail tcustPersonDetail = TcustPersonDetail.find(PersistenceHelper.getEntityManager(), + tcustCompanyManagers.getPk().getManagerpersoncode()); + if (tcustPersonDetail != null && tcustPersonDetail.getIdentification() != null) { + List ldata = OptmListaNegra.find(PersistenceHelper.getEntityManager(), tcustPersonDetail.getIdentification()); + String typeItem; + String isnew = (String) tcustCompanyManagers.get("isnew"); + if (isnew != null && isnew.compareTo("Y") == 0) { + typeItem = "N"; + } else { + typeItem = "U"; + } + if (identificationConsep.compareTo(tcustPersonDetail.getIdentification()) != 0) { + this.fillConsep(pSaveRequest, ldata, tcustPersonDetail.getIdentification(), tcustPersonDetail.getName(), null, null, null, typeItem, true); + } + } + } + } + } + if (pSaveRequest.get("personcode") == null || "".equals(((Integer) pSaveRequest.get("personcode")).toString())) { + transaction = "N"; + } else { + transaction = "U"; + } + firsname = (String) pSaveRequest.get("socialreason"); + if (identificationConsep != null) { + List ldata = OptmListaNegra.find(PersistenceHelper.getEntityManager(), identificationConsep); + this.fillConsep(pSaveRequest, ldata, identificationConsep, firsname, null, null, null, transaction, false); + } + return pSaveRequest; + } + + /** + * Ejecuta la transaccion en modo reverso.
+ * + * @param pSaveRequest Objeto que almacena referencia a las tablas de que intervienen en el proceso con sus datos. + * @throws Exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/VerifyInConsepPerson.java.svn-base b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/VerifyInConsepPerson.java.svn-base new file mode 100644 index 0000000..22eba58 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/.svn/text-base/VerifyInConsepPerson.java.svn-base @@ -0,0 +1,75 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.person.rules.save; + +import com.fp.common.helper.Constant; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pcustomer.people.TcustPeople; +import com.fp.persistence.pcustomer.people.TcustPeopleKey; +import com.fp.persistence.pgeneral.gene.OptmListaNegra; +import java.util.List; + +/** + * Clase que verifica si la persona se encuentra registrada en el CONSEP + * + * @author hinga + */ +public class VerifyInConsepPerson extends VerifyInConsep { + + /** + * Ejecuta la transaccion en modo normal.
Verifica que la persona que se intenta registrar se encuentra o no en + * la lista negra (CONSEP). + * + * @param pSaveRequest Objeto que almacena referencia a las tablas de que intervienen en el proceso con sus datos. + * @throws Exception + * @return pSaveRequest Objeto que almacena referencia a las tablas de que intervienen en el proceso con sus datos. + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + String firsname = null, middlename = null, lastname = null, surename = null, transaction = null, identificationConsep = null; + String balancefile = (String) pSaveRequest.get("balancefile"); + if (balancefile != null && balancefile.compareTo("excelfile") == 0) { + return pSaveRequest; + } + identificationConsep = (String) pSaveRequest.get("identification"); + TcustPeople tcustPeople = null; + + if (pSaveRequest.get("personcode") == null || pSaveRequest.get("personcode").equals("")) { + tcustPeople = (TcustPeople) pSaveRequest.getSaveBeanModifiedObject("TCUSTPEOPLE"); + transaction = "N"; + } else { + TcustPeopleKey key = new TcustPeopleKey(new Integer((String)pSaveRequest.get("personcode")), Constant.getDefaultExpiryTimestamp()); + tcustPeople = TcustPeople.find(PersistenceHelper.getEntityManager(), key); + transaction = "U"; + } + if(tcustPeople == null){ + tcustPeople = (TcustPeople) pSaveRequest.getSaveBeanModifiedObject("TCUSTPEOPLE"); + } + if(transaction.compareTo("U") == 0){ + this.verifyChangeIdentificationPeople(tcustPeople, pSaveRequest, identificationConsep); + } + firsname = tcustPeople.getFirstname(); + middlename = tcustPeople.getMiddlename(); + lastname = tcustPeople.getLastname(); + surename = tcustPeople.getSurename(); + if (identificationConsep != null) { + List ldata = OptmListaNegra.find(PersistenceHelper.getEntityManager(), identificationConsep); + this.fillConsep(pSaveRequest, ldata, identificationConsep, firsname, middlename, lastname, surename, transaction, false); + } + return pSaveRequest; + } + + /** + * Ejecuta la transaccion en modo reverso.
+ * + * @param pSaveRequest Objeto que almacena referencia a las tablas de que intervienen en el proceso con sus datos. + * @throws Exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/CompleteCompanyCode.java b/base/business/person/src/main/java/com/fp/person/rules/save/CompleteCompanyCode.java new file mode 100644 index 0000000..199e9fa --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/CompleteCompanyCode.java @@ -0,0 +1,402 @@ +package com.fp.person.rules.save; + +import java.util.List; + +import com.fp.dto.Response; +import com.fp.dto.save.SaveBean; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.pcustomer.balance.TcustPersonBalance; +import com.fp.persistence.pcustomer.company.TcustCompany; +import com.fp.persistence.pcustomer.company.TcustCompanyBranch; +import com.fp.persistence.pcustomer.company.TcustCompanyBranchKey; +import com.fp.persistence.pcustomer.company.TcustCompanyClient; +import com.fp.persistence.pcustomer.company.TcustCompanyClientKey; +import com.fp.persistence.pcustomer.company.TcustCompanyFinancial; +import com.fp.persistence.pcustomer.company.TcustCompanyFinancialKey; +import com.fp.persistence.pcustomer.company.TcustCompanyKey; +import com.fp.persistence.pcustomer.company.TcustCompanyManagers; +import com.fp.persistence.pcustomer.company.TcustCompanyManagersKey; +import com.fp.persistence.pcustomer.company.TcustCompanyProducts; +import com.fp.persistence.pcustomer.company.TcustCompanyProductsKey; +import com.fp.persistence.pcustomer.company.TcustCompanyProvider; +import com.fp.persistence.pcustomer.company.TcustCompanyProviderKey; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.people.TcustPeopleAssociation; +import com.fp.persistence.pcustomer.people.TcustPeopleAssociationKey; +import com.fp.persistence.pcustomer.people.TcustPeopleFixedIncome; +import com.fp.persistence.pcustomer.people.TcustPeopleFixedIncomeKey; +import com.fp.persistence.pcustomer.people.TcustPeopleLoan; +import com.fp.persistence.pcustomer.people.TcustPeopleLoanKey; +import com.fp.persistence.pcustomer.people.TcustPeopleOtherAssets; +import com.fp.persistence.pcustomer.people.TcustPeopleOtherAssetsKey; +import com.fp.persistence.pcustomer.people.TcustPeopleRealAssets; +import com.fp.persistence.pcustomer.people.TcustPeopleRealAssetsKey; +import com.fp.persistence.pcustomer.people.TcustPeopleVehicle; +import com.fp.persistence.pcustomer.people.TcustPeopleVehicleKey; + +/** + * + * Clase se encarga de completar el codigo para una nueva persona juridica. + * + * @author Wilson Sigcho + * @version 2.1 + */ +public class CompleteCompanyCode extends CompletePersonAndCompany { + + /** + * Metodo que se encarga de completar el codigo de compania para su creacion cuando un save es requerido. + * + * @param pSaveRequest Objeto que posee el save requerido. + * @return SaveRequest + * @throws Exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + TcustPersonDetail tcustPersonDetail = (TcustPersonDetail) pSaveRequest.getSaveBeanModifiedObject("TCUSTPERSONDETAIL"); + TcustCompany tcustCompany = (TcustCompany) pSaveRequest.getSaveBeanModifiedObject("TCUSTCOMPANY"); + TcustCompanyFinancial tcustCompanyFinancial = (TcustCompanyFinancial) pSaveRequest.getSaveBeanModifiedObject("TCUSTCOMPANYFINANCIAL"); +// TcustPersonBalance tcustPersonBalance = (TcustPersonBalance) pSaveRequest.getSaveBeanModifiedObject("TCUSTPERSONBALANCE"); + SaveBean sbTcustPersonBalance = (SaveBean) pSaveRequest.get("com.fp.persistence.pcustomer.balance.TcustPersonBalance"); + TcustPersonBalance tcustPersonBalance=null; + if(sbTcustPersonBalance!=null) + tcustPersonBalance = (TcustPersonBalance) sbTcustPersonBalance.getModifiedObject(); + List tcustPersonAddress = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONADDRESS"); + List tcustPersonPhone = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONPHONE"); + List bankreference = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONBANKREFERENCE"); + List personalreference = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONPERSONALREFERENCE"); + List products = pSaveRequest.getSaveBeanModifiedRecords("TCUSTCOMPANYPRODUCTS"); + List managers = pSaveRequest.getSaveBeanModifiedRecords("TCUSTCOMPANYMANAGERS"); + List branch = pSaveRequest.getSaveBeanModifiedRecords("TCUSTCOMPANYBRANCH"); + List provider = pSaveRequest.getSaveBeanModifiedRecords("TCUSTCOMPANYPROVIDER"); + List client = pSaveRequest.getSaveBeanModifiedRecords("TCUSTCOMPANYCLIENT"); + List loan = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLELOAN"); + List vehicles = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEVEHICLE"); + List otherassets = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEOTHERASSETS"); + List realassets = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEREALASSETS"); + List fixedincome = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEFIXEDINCOME"); + List association = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEASSOCIATION"); + // List balancefinancial = pSaveRequest.getSaveBeanModifiedRecords("TCUSTBALANCEFINANCIAL"); + // List fileItem = (List) pSaveRequest.get("file"); + if ((tcustPersonDetail != null) && (tcustPersonDetail.getPk().getPersoncode() == null)) { + Integer personcode = this.getPersonCode(); + this.createPerson(pSaveRequest, personcode); + this.completePersonDetail(pSaveRequest, tcustPersonDetail, personcode); + this.completeCompany(tcustCompany, personcode,pSaveRequest); + this.completeFinancial(tcustCompanyFinancial, personcode); + this.completeAddress(tcustPersonAddress, personcode); + this.completePhone(tcustPersonPhone, personcode); + this.completeBankReference(bankreference, personcode); + this.completePersonalReference(personalreference, personcode); + this.completeProducts(products, personcode); + this.completeManagers(managers, personcode); + this.completeBranch(branch, personcode); + this.completeProvider(provider, personcode); + this.completeClient(client, personcode); + this.completeLoan(loan, personcode); + this.completeVehicles(vehicles, personcode); + this.completeOtherAssets(otherassets, personcode); + this.completeRealAssets(realassets, personcode); + this.completeFixedIncome(fixedincome, personcode); + this.completeAssociation(association, personcode); + this.completeBalance(tcustPersonBalance, personcode, pSaveRequest); + Response response = pSaveRequest.getResponse(); + response.put("personcode", personcode); + response.put("personname", tcustPersonDetail.getName()); + } + this.completeAditionalInfo(pSaveRequest, tcustPersonDetail); + this.balanceCode(tcustPersonBalance, pSaveRequest); + return pSaveRequest; + } + + /** + * Metodo que me permmite revertir el proceso. + * + * @param pSaveRequest Objeto que posee el save requerido. + * @return pSaveRequest + * @throws Exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + /** + * Completa el codigo de la nueva persona juridica en la tabla TcustCompany. + * + * @param tcustCompany Objeto que posee el registro a guardar en la tabla TcustCompany. + * @param personcode Codigo de la nueva persona juridica a ser guardada. + * @throws Exception + */ + private void completeCompany(TcustCompany tcustCompany, Integer personcode,SaveRequest pSaverequest) throws Exception { + TcustCompanyKey tcustCompanyKey = new TcustCompanyKey(); + tcustCompanyKey.setPersoncode(personcode); + if(tcustCompany==null){ + TcustCompany tcusCompanyPros = new TcustCompany(); + tcusCompanyPros.setPk(tcustCompanyKey); + tcusCompanyPros.setIngressuser(pSaverequest.getUser()); + pSaverequest.getResponse().remove("TCUSTCOMPANY"); + pSaverequest.putSaveBean("TCUSTCOMPANY", tcusCompanyPros, 2); + + }else{ + tcustCompany.setPk(tcustCompanyKey); + tcustCompany.setIngressuser(pSaverequest.getUser()); + } + + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustCompanyManagers + * + * @param lDetail Objeto que posee una lista de los registros a guardar en la tabla TcustCompanyManagers. + * @param personcode Codigo de la nueva persona juridica a ser guardada. + * @throws Exception + */ + private void completeManagers(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustCompanyManagers tcustCompanyManagers = (TcustCompanyManagers) object; + if ((tcustCompanyManagers != null) && (tcustCompanyManagers.getPk().getPersoncode() == null)) { + TcustCompanyManagersKey tcustCompanyManagersKey = tcustCompanyManagers.getPk(); + tcustCompanyManagersKey.setPersoncode(personcode); + tcustCompanyManagers.setPk(tcustCompanyManagersKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustCompanyBranch + * + * @param lDetail Objeto que posee una lista de los registros a guardar en la tabla TcustCompanyBranch. + * @param personcode Codigo de la nueva persona juridica a ser guardada. + * @throws Exception + */ + private void completeBranch(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustCompanyBranch tcustCompanyBranch = (TcustCompanyBranch) object; + if ((tcustCompanyBranch != null) && (tcustCompanyBranch.getPk().getPersoncode() == null)) { + TcustCompanyBranchKey tcustCompanyBranchKey = new TcustCompanyBranchKey(); + tcustCompanyBranchKey.setPersoncode(personcode); + tcustCompanyBranchKey.setBranchsequence(tcustCompanyBranch.getPk().getBranchsequence()); + tcustCompanyBranch.setPk(tcustCompanyBranchKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustCompanyProducts + * + * @param lDetail Objeto que posee una lista de los registros a guardar en la tabla TcustCompanyProducts. + * @param personcode Codigo de la nueva persona juridica a ser guardada. + * @throws Exception + */ + private void completeProducts(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustCompanyProducts tcustCompanyProducts = (TcustCompanyProducts) object; + if ((tcustCompanyProducts != null) && (tcustCompanyProducts.getPk().getPersoncode() == null)) { + TcustCompanyProductsKey tcustCompanyProductsKey = new TcustCompanyProductsKey(); + tcustCompanyProductsKey.setPersoncode(personcode); + tcustCompanyProductsKey.setProductsequence(tcustCompanyProducts.getPk().getProductsequence()); + tcustCompanyProducts.setPk(tcustCompanyProductsKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustCompanyProvider + * + * @param lDetail Objeto que posee una lista de los registros a guardar en la tabla TcustCompanyProvider. + * @param personcode Codigo de la nueva persona juridica a ser guardada. + * @throws Exception + */ + private void completeProvider(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustCompanyProvider tcustCompanyProvider = (TcustCompanyProvider) object; + if ((tcustCompanyProvider != null) && (tcustCompanyProvider.getPk().getPersoncode() == null)) { + TcustCompanyProviderKey tcustCompanyProviderKey = new TcustCompanyProviderKey(); + tcustCompanyProviderKey.setPersoncode(personcode); + tcustCompanyProviderKey.setProvidersequence(tcustCompanyProvider.getPk().getProvidersequence()); + tcustCompanyProvider.setPk(tcustCompanyProviderKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustCompanyClient + * + * @param lDetail Objeto que posee una lista de los registros a guardar en la tabla TcustCompanyClient. + * @param personcode Codigo de la nueva persona juridica a ser guardada. + * @throws Exception + */ + private void completeClient(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustCompanyClient tcustCompanyClient = (TcustCompanyClient) object; + if ((tcustCompanyClient != null) && (tcustCompanyClient.getPk().getPersoncode() == null)) { + TcustCompanyClientKey tcustCompanyClientKey = new TcustCompanyClientKey(); + tcustCompanyClientKey.setPersoncode(personcode); + tcustCompanyClientKey.setClientsequence(tcustCompanyClient.getPk().getClientsequence()); + tcustCompanyClient.setPk(tcustCompanyClientKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustCompanyFinancial + * + * @param lDetail Objeto que posee una lista de los registros a guardar en la tabla TcustCompanyFinancial. + * @param personcode Codigo de la nueva persona juridica a ser guardada. + * @throws Exception + */ + private void completeFinancial(TcustCompanyFinancial tcustCompanyFinancial, Integer personcode) throws Exception { + if ((tcustCompanyFinancial != null) && (tcustCompanyFinancial.getPk().getPersoncode() == null)) { + TcustCompanyFinancialKey tcustCompanyFinancialKey = new TcustCompanyFinancialKey(); + tcustCompanyFinancialKey.setPersoncode(personcode); + tcustCompanyFinancial.setPk(tcustCompanyFinancialKey); + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustPeopleLoan + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeLoan(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleLoan tcustPeopleLoan = (TcustPeopleLoan) object; + if ((tcustPeopleLoan != null) && (tcustPeopleLoan.getPk().getPersoncode() == null)) { + TcustPeopleLoanKey tcustPeopleLoanKey = new TcustPeopleLoanKey(); + tcustPeopleLoanKey.setPersoncode(personcode); + tcustPeopleLoanKey.setLoansequence(tcustPeopleLoan.getPk().getLoansequence()); + tcustPeopleLoan.setPk(tcustPeopleLoanKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustPeopleVehicle + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeVehicles(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleVehicle tcustPeopleVehicle = (TcustPeopleVehicle) object; + if ((tcustPeopleVehicle != null) && (tcustPeopleVehicle.getPk().getPersoncode() == null)) { + TcustPeopleVehicleKey tcustPeopleVehicleKey = new TcustPeopleVehicleKey(); + tcustPeopleVehicleKey.setPersoncode(personcode); + tcustPeopleVehicleKey.setVehiclesequence(tcustPeopleVehicle.getPk().getVehiclesequence()); + tcustPeopleVehicle.setPk(tcustPeopleVehicleKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustPeopleOtherAssets + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeOtherAssets(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleOtherAssets tcustPeopleOtherAssets = (TcustPeopleOtherAssets) object; + if ((tcustPeopleOtherAssets != null) && (tcustPeopleOtherAssets.getPk().getPersoncode() == null)) { + TcustPeopleOtherAssetsKey tcustPeopleOtherAssetsKey = new TcustPeopleOtherAssetsKey(); + tcustPeopleOtherAssetsKey.setPersoncode(personcode); + tcustPeopleOtherAssetsKey.setAssetssequence(tcustPeopleOtherAssets.getPk().getAssetssequence()); + tcustPeopleOtherAssets.setPk(tcustPeopleOtherAssetsKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustPeopleRealAssets + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeRealAssets(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleRealAssets tcustPeopleRealAssets = (TcustPeopleRealAssets) object; + if ((tcustPeopleRealAssets != null) && (tcustPeopleRealAssets.getPk().getPersoncode() == null)) { + TcustPeopleRealAssetsKey tcustPeopleRealAssetsKey = new TcustPeopleRealAssetsKey(); + tcustPeopleRealAssetsKey.setPersoncode(personcode); + tcustPeopleRealAssetsKey.setAssetssequence(tcustPeopleRealAssets.getPk().getAssetssequence()); + tcustPeopleRealAssets.setPk(tcustPeopleRealAssetsKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustPeopleFixedIncome + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeFixedIncome(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleFixedIncome tcustPeopleFixedIncome = (TcustPeopleFixedIncome) object; + if ((tcustPeopleFixedIncome != null) && (tcustPeopleFixedIncome.getPk().getPersoncode() == null)) { + TcustPeopleFixedIncomeKey tcustPeopleFixedIncomeKey = new TcustPeopleFixedIncomeKey(); + tcustPeopleFixedIncomeKey.setPersoncode(personcode); + tcustPeopleFixedIncomeKey.setFixedincomesequence(tcustPeopleFixedIncome.getPk().getFixedincomesequence()); + tcustPeopleFixedIncome.setPk(tcustPeopleFixedIncomeKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustPeopleAssociation + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeAssociation(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleAssociation tcustPeopleAssociation = (TcustPeopleAssociation) object; + if ((tcustPeopleAssociation != null) && (tcustPeopleAssociation.getPk().getPersoncode() == null)) { + TcustPeopleAssociationKey tcustPeopleAssociationKey = new TcustPeopleAssociationKey(); + tcustPeopleAssociationKey.setPersoncode(personcode); + tcustPeopleAssociationKey.setAssociationsequence(tcustPeopleAssociation.getPk().getAssociationsequence()); + tcustPeopleAssociation.setPk(tcustPeopleAssociationKey); + } + } + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/CompleteHistoryActivity.java b/base/business/person/src/main/java/com/fp/person/rules/save/CompleteHistoryActivity.java new file mode 100644 index 0000000..3faf143 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/CompleteHistoryActivity.java @@ -0,0 +1,45 @@ +package com.fp.person.rules.save; + +import com.fp.dto.save.SaveBean; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.gene.TgeneActivity; +import java.sql.Timestamp; +import java.util.List; + +/** + * Clase que se encarga de de incluir la fecha en que un registro fue modificado + * @author scastillo + */ +public class CompleteHistoryActivity extends CompletePersonAndCompany { + + /** + * Metodo que verifica si existe o no una fecha de modificacion + * @param pSaveRequest + * @return + * @throws Exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + SaveBean test = (SaveBean) pSaveRequest.get("com.fp.persistence.pcustomer.gene.TgeneActivity"); + List data = test.getModifiedRecords(); + Timestamp modifyDate = FormatDates.getInstance().getDataBaseTimestamp(); + for (int i = 0; i < data.size(); i++) { + TgeneActivity tgeneActivity = (TgeneActivity) data.get(i); + tgeneActivity.setModifyuser(pSaveRequest.getUser()); + tgeneActivity.setModifydate(modifyDate); + } + return pSaveRequest; + } + + /** + * Metodo que se ejecuta en modo reverso + * @param pSaveRequest + * @return + * @throws Exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + throw new UnsupportedOperationException("Not supported yet."); + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/CompletePersonAndCompany.java b/base/business/person/src/main/java/com/fp/person/rules/save/CompletePersonAndCompany.java new file mode 100644 index 0000000..866d761 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/CompletePersonAndCompany.java @@ -0,0 +1,272 @@ +package com.fp.person.rules.save; + +import java.sql.Date; +import java.util.List; + +import javax.persistence.EntityManager; + +import com.fp.dto.data.SaveData; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.balance.TcustBalance; +import com.fp.persistence.pcustomer.balance.TcustBalanceKey; +import com.fp.persistence.pcustomer.balance.TcustPersonBalance; +import com.fp.persistence.pcustomer.balance.TcustPersonBalanceKey; +import com.fp.persistence.pcustomer.gene.TcustPerson; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonAddressKey; +import com.fp.persistence.pcustomer.gene.TcustPersonBankReference; +import com.fp.persistence.pcustomer.gene.TcustPersonBankReferenceKey; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; +import com.fp.persistence.pcustomer.gene.TcustPersonPersonalReference; +import com.fp.persistence.pcustomer.gene.TcustPersonPersonalReferenceKey; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pcustomer.gene.TcustPersonPhoneKey; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Clase padre que se encarga de completar el personcode cuando se crea una nueva persona: juridica o natural + * + * @author Wilson Sigcho + * @version 2.1 + */ +@SuppressWarnings("serial") +public abstract class CompletePersonAndCompany extends TransactionRule { + + /** + * Metodo que devuelve la secuencia que le pertenece a una nueva persona. + * + * @return Codigo de la nueva persona. + * @throws Exception + */ + protected Integer getPersonCode() throws Exception { + Sequence sequence = new Sequence(); + Integer personcode = Integer.valueOf(sequence.getNextValue("PERSONCODE").toString()); + SaveData.getMap().put("PERSONCODE", personcode.toString()); + return personcode; + } + + /** + * Metodo que devuelve el internalcode que le pertenece a una nueva persona. + * + * @return Codigo de la nueva persona. + * @throws Exception + */ + protected Integer getInternalCode() throws Exception { + Sequence sequence = new Sequence(); + Integer internalcode = Integer.valueOf(sequence.getNextValue("INTERNALCODE").toString()); + return internalcode; + } + + /** + * Metodo que crea un objeto de la clase TcustPerson + * + * @param saveRequest Objeto que posee el save requerido. + * @param personcode Codigo de la nueva persona. + * @throws Exception + */ + protected void createPerson(SaveRequest saveRequest, Integer personcode) throws Exception { + TcustPerson tcustPerson = new TcustPerson(); + tcustPerson.setPk(personcode); + EntityManager entityManager = PersistenceHelper.getEntityManager(); + entityManager.persist(tcustPerson); +// saveRequest.putSaveBean("TCUSTPERSON", tcustPerson, 1); + } + + /** + * Completa el codigo de la persona en la tabla TcustPersonDetail + * + * @param tcustPersonDetail Objeto que posee el registro a guardar en la tabla TcustPersonDetail. + * @param personcode Codigo de la nueva persona a ser guardada. + * @throws Exception + */ + protected void completePersonDetail(SaveRequest pSaveRequest, TcustPersonDetail tcustPersonDetail, Integer personcode) throws Exception { + TcustPersonDetailKey tcustPersonDetailKey = new TcustPersonDetailKey(); + tcustPersonDetailKey.setPersoncode(personcode); + tcustPersonDetail.setPk(tcustPersonDetailKey); + } + + /** + * Metodo que completa informaci�n faltante + * + * @param pSaveRequest + * @param tcustPersonDetail + */ + protected void completeAditionalInfo(SaveRequest pSaveRequest, TcustPersonDetail tcustPersonDetail) { + if (tcustPersonDetail != null) { + if (tcustPersonDetail.getBranchcode() != null) { + return; + } + tcustPersonDetail.setCompanycode(pSaveRequest.getCompany()); + tcustPersonDetail.setBranchcode(pSaveRequest.getBranchCode()); + tcustPersonDetail.setOfficecode(pSaveRequest.getOfficeCode()); + tcustPersonDetail.setIngressuser(pSaveRequest.getUser()); + tcustPersonDetail.setRegisterdate((Date) pSaveRequest.get("accountingdate")); + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustPersonAddress + * + * @param lDetail + * @param personcode + * @throws Exception + */ + protected void completeAddress(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPersonAddress tcustPersonAddress = (TcustPersonAddress) object; + if ((tcustPersonAddress != null) && (tcustPersonAddress.getPk().getPersoncode() == null)) { + TcustPersonAddressKey tcustPersonAddressKey = new TcustPersonAddressKey(); + tcustPersonAddressKey.setAddressnumber(tcustPersonAddress.getPk().getAddressnumber()); + tcustPersonAddressKey.setPersoncode(personcode); + tcustPersonAddress.setPk(tcustPersonAddressKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustPersonPhone + * + * @param lDetail + * @param personcode + * @throws Exception + */ + protected void completePhone(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPersonPhone tcustPersonPhone = (TcustPersonPhone) object; + if ((tcustPersonPhone != null) && (tcustPersonPhone.getPk().getPersoncode() == null)) { + TcustPersonPhoneKey tcustPersonPhoneKey = new TcustPersonPhoneKey(); + tcustPersonPhoneKey.setPersoncode(personcode); + tcustPersonPhoneKey.setPhonesequence(tcustPersonPhone.getPk().getPhonesequence()); + tcustPersonPhone.setPk(tcustPersonPhoneKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustPersonBankReference + * + * @param lDetail + * @param personcode + * @throws Exception + */ + protected void completeBankReference(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPersonBankReference tcustPersonBankReference = (TcustPersonBankReference) object; + if ((tcustPersonBankReference != null) && (tcustPersonBankReference.getPk().getPersoncode() == null)) { + TcustPersonBankReferenceKey tcustPersonBankReferenceKey = new TcustPersonBankReferenceKey(); + tcustPersonBankReferenceKey.setPersoncode(personcode); + tcustPersonBankReferenceKey.setReferencesequence(tcustPersonBankReference.getPk().getReferencesequence()); + tcustPersonBankReference.setPk(tcustPersonBankReferenceKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla TcustPersonPersonalReference + * + * @param lDetail + * @param personcode + * @throws Exception + */ + protected void completePersonalReference(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPersonPersonalReference tcustPersonPersonalReference = (TcustPersonPersonalReference) object; + if ((tcustPersonPersonalReference != null) && (tcustPersonPersonalReference.getPk().getPersoncode() == null)) { + TcustPersonPersonalReferenceKey tcustPersonPersonalReferenceKey = new TcustPersonPersonalReferenceKey(); + tcustPersonPersonalReferenceKey.setPersoncode(personcode); + tcustPersonPersonalReferenceKey.setReferencesequence(tcustPersonPersonalReference.getPk().getReferencesequence()); + tcustPersonPersonalReference.setPk(tcustPersonPersonalReferenceKey); + } + } + } + + /** + * Metodo que crea un objeto TcustBalance + * + * @param saveRequest Objeto que posee el save requerido. + * @param personcode Codigo de la persona. + * @param balancedate Fecha de balance de la nueva persona. + * @throws Exception + */ + protected void createBalance(Integer personcode, Date balancedate, SaveRequest saveRequest) throws Exception { + TcustBalanceKey tcustBalanceKey = new TcustBalanceKey(); + tcustBalanceKey.setPersoncode(personcode); + tcustBalanceKey.setBalancedate(balancedate); + TcustBalance tcustBalance = new TcustBalance(tcustBalanceKey); + PersistenceHelper.save(tcustBalance); +// saveRequest.putSaveBean("TCUSTBALANCE", tcustBalance, 1); + } + + /** + * + * @param tcustPersonBalance + * @param personcode + * @param saveRequest + * @throws Exception + */ + protected void completeBalance(TcustPersonBalance tcustPersonBalance, Integer personcode, SaveRequest saveRequest) throws Exception { + if (tcustPersonBalance == null) { + return; + } + if ((tcustPersonBalance != null) && (tcustPersonBalance.getPk().getPersoncode() == null)) { + TcustBalanceKey tcustBalanceKey = new TcustBalanceKey(personcode, tcustPersonBalance.getPk().getBalancedate()); + TcustBalance tcustBalance = TcustBalance.find(PersistenceHelper.getEntityManager(), tcustBalanceKey); + if (tcustBalance == null) { + this.createBalance(personcode, tcustPersonBalance.getPk().getBalancedate(), saveRequest); + } + TcustPersonBalanceKey tcustPersonBalanceKey = new TcustPersonBalanceKey(); + tcustPersonBalanceKey.setPersoncode(personcode); + tcustPersonBalanceKey.setBalancedate(tcustPersonBalance.getPk().getBalancedate()); + tcustPersonBalance.setPk(tcustPersonBalanceKey); + } + } + + /** + * Metodo que verifica el codigo de balance caso contrario lo crea + * + * @param personbalance Lista de objetos de TcustBalancePerson + * @param pSaveRequest Objeto SaveRequest + * @throws Exception + */ + protected void balanceCode(TcustPersonBalance tcustPersonBalance, SaveRequest pSaveRequest) throws Exception { + FinancialSituation financialSituation = new FinancialSituation(); + if (tcustPersonBalance == null) { + return; + } + TcustPersonBalanceKey tcustPersonBalanceKey = new TcustPersonBalanceKey(tcustPersonBalance.getPk().getPersoncode(), tcustPersonBalance + .getPk().getBalancedate(), tcustPersonBalance.getPk().getBalancecatalog(), tcustPersonBalance.getPk().getBalancecatalogcode(), + FormatDates.getDefaultExpiryTimestamp()); + TcustPersonBalance tcustPersonBalanceAux = TcustPersonBalance.find(PersistenceHelper.getEntityManager(), tcustPersonBalanceKey); + if ((tcustPersonBalanceAux != null) && (tcustPersonBalance.getPk().getDateto() == null) && (tcustPersonBalance.getDatefrom() == null) + && (tcustPersonBalance.getRecordversion() == null)) { + tcustPersonBalance.getPk().setDateto(FormatDates.getDefaultExpiryTimestamp()); + tcustPersonBalance.setRecordversion(tcustPersonBalanceAux.getRecordversion()); + } + TcustBalanceKey tcustBalanceKey = new TcustBalanceKey(tcustPersonBalance.getPk().getPersoncode(), tcustPersonBalance.getPk().getBalancedate()); + TcustBalance tcustBalance = TcustBalance.find(PersistenceHelper.getEntityManager(), tcustBalanceKey); + if (tcustBalance == null) { + this.createBalance(tcustPersonBalance.getPk().getPersoncode(), tcustPersonBalance.getPk().getBalancedate(), pSaveRequest); + } + // List listBalanceFinancial = + financialSituation.completeFinancialSituation(tcustPersonBalance, pSaveRequest); + // if (!listBalanceFinancial.isEmpty()) { + // pSaveRequest.putSaveBean("TCUSTBALANCEFINANCIAL", listBalanceFinancial, 5); + // } + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/CompletePersonCode.java b/base/business/person/src/main/java/com/fp/person/rules/save/CompletePersonCode.java new file mode 100644 index 0000000..d6b467b --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/CompletePersonCode.java @@ -0,0 +1,468 @@ +package com.fp.person.rules.save; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import javax.persistence.EntityManager; + +import com.fp.dto.Response; +import com.fp.dto.save.SaveBean; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.balance.TcustPersonBalance; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonAddressKey; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pcustomer.people.TcustPeople; +import com.fp.persistence.pcustomer.people.TcustPeopleAditionalData; +import com.fp.persistence.pcustomer.people.TcustPeopleAssociation; +import com.fp.persistence.pcustomer.people.TcustPeopleAssociationKey; +import com.fp.persistence.pcustomer.people.TcustPeopleExpenses; +import com.fp.persistence.pcustomer.people.TcustPeopleExpensesKey; +import com.fp.persistence.pcustomer.people.TcustPeopleFixedIncome; +import com.fp.persistence.pcustomer.people.TcustPeopleFixedIncomeKey; +import com.fp.persistence.pcustomer.people.TcustPeopleIncome; +import com.fp.persistence.pcustomer.people.TcustPeopleIncomeKey; +import com.fp.persistence.pcustomer.people.TcustPeopleJob; +import com.fp.persistence.pcustomer.people.TcustPeopleJobKey; +import com.fp.persistence.pcustomer.people.TcustPeopleKey; +import com.fp.persistence.pcustomer.people.TcustPeopleLoan; +import com.fp.persistence.pcustomer.people.TcustPeopleLoanKey; +import com.fp.persistence.pcustomer.people.TcustPeopleOtherAssets; +import com.fp.persistence.pcustomer.people.TcustPeopleOtherAssetsKey; +import com.fp.persistence.pcustomer.people.TcustPeopleRealAssets; +import com.fp.persistence.pcustomer.people.TcustPeopleRealAssetsKey; +import com.fp.persistence.pcustomer.people.TcustPeopleTradereferences; +import com.fp.persistence.pcustomer.people.TcustPeopleTradereferencesKey; +import com.fp.persistence.pcustomer.people.TcustPeopleVehicle; +import com.fp.persistence.pcustomer.people.TcustPeopleVehicleKey; +import com.fp.persistence.pgeneral.safe.TsafeUser; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetailKey; +import com.fp.person.validate.ValidateIdentification; + +/** + * Clase que se encarga de completar el personcode cuando se crea una nueva + * persona natural + * + * @author Santiago Castillo + * @version 2.1 + */ +public class CompletePersonCode extends CompletePersonAndCompany { + + /** + * Metodo que se encarga de completar el codigo de persona para su creacion + * cuando un save es requerido. + * + * @param pSaveRequest + * @return + * @throws Exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + try { + TcustPersonDetail tcustPersonDetail = (TcustPersonDetail) pSaveRequest.getSaveBeanModifiedObject("TCUSTPERSONDETAIL"); + TcustPeople tcustPeople = (TcustPeople) pSaveRequest.getSaveBeanModifiedObject("TCUSTPEOPLE"); + + if (tcustPersonDetail != null) { + switch (tcustPersonDetail.getIdentificationcatalog()) { + case "CED": + if (!ValidateIdentification.cedula(tcustPersonDetail.getIdentification())) { + throw new GeneralException("CUST-0013", "CDULA NO VLIDA"); + } + break; + case "RUC": + if (!ValidateIdentification.ruc(tcustPersonDetail.getIdentification())) { + throw new GeneralException("CUST-0014", "RUC NO VLIDO"); + } + break; + } + } + + //TcustPersonBalance tcustPersonBalance = (TcustPersonBalance) pSaveRequest.getSaveBeanModifiedObject("TCUSTPERSONBALANCE"); + SaveBean sbTcustPersonBalance = (SaveBean) pSaveRequest.get("com.fp.persistence.pcustomer.balance.TcustPersonBalance"); + TcustPersonBalance tcustPersonBalance = null; + if (sbTcustPersonBalance != null) { + tcustPersonBalance = (TcustPersonBalance) sbTcustPersonBalance.getModifiedObject(); + } + Object aditionalData = pSaveRequest.getSaveBeanModifiedObject("TCUSTPEOPLEADITIONALDATA"); + List tcustPersonAddress = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONADDRESS"); + if(tcustPersonAddress==null || tcustPersonAddress.size()==0){ + Object adress= pSaveRequest.getSaveBeanModifiedObject("TCUSTPERSONADDRESS"); + if(adress!=null){ + tcustPersonAddress.add(adress); + } + } + + List tcustPersonPhone = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONPHONE"); + if(tcustPersonPhone==null || tcustPersonPhone.size()==0){ + Object phone= pSaveRequest.getSaveBeanModifiedObject("TCUSTPERSONPHONE"); + if(phone!=null){ + tcustPersonPhone.add(phone); + } + } + List income = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEINCOME"); + List expenses = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEEXPENSES"); + List job = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEJOB"); + List vehicles = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEVEHICLE"); + List otherassets = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEOTHERASSETS"); + List realassets = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEREALASSETS"); + List tradereferences = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLETRADEREFERENCES"); + List bankreference = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONBANKREFERENCE"); + List personalreference = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONPERSONALREFERENCE"); + List loan = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLELOAN"); + List fixedincome = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEFIXEDINCOME"); + List association = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPEOPLEASSOCIATION"); + if ((tcustPersonDetail != null) && (tcustPersonDetail.getPk().getPersoncode() == null)) { + Integer personcode = this.getPersonCode(); + this.createPerson(pSaveRequest, personcode); + this.completePersonDetail(pSaveRequest, tcustPersonDetail, personcode); + if (tcustPeople != null) { + this.completePeople(pSaveRequest, tcustPeople, personcode); + } + this.completeAddress(tcustPersonAddress, personcode); + this.completePhone(tcustPersonPhone, personcode); + + this.completeVehicles(vehicles, personcode); + this.completeOtherAssets(otherassets, personcode); + this.completeRealAssets(realassets, personcode); + this.completeIncome(income, personcode); + this.completeExpenses(expenses, personcode); + this.completeJob(job, personcode); + this.completeTradeReferences(tradereferences, personcode); + this.completeBankReference(bankreference, personcode); + this.completePersonalReference(personalreference, personcode); + this.completeLoan(loan, personcode); + this.completeAditionalData(aditionalData, personcode); + this.completeFixedIncome(fixedincome, personcode); + this.completeAssociation(association, personcode); + this.completeBalance(tcustPersonBalance, personcode, pSaveRequest); + Response response = pSaveRequest.getResponse(); + response.put("personcode", personcode); + response.put("personname", tcustPersonDetail.getName()); + + // Creacion de usuario del sistema + EntityManager entityManager = PersistenceHelper.getEntityManager(); + + Integer internalcode = getInternalCode(); + TsafeUser userObj = new TsafeUser(); + userObj.setPk(tcustPersonDetail.getIdentification()); + userObj.setPersoncode(personcode); + userObj.setCompanycode(1); + userObj.setInternalcode(internalcode); + entityManager.persist(userObj); + + // Creacion de usuario DETALLE del sistema + TsafeUserDetailKey userDetailKeyObj = new TsafeUserDetailKey(); + userDetailKeyObj.setDateto(FormatDates.getDefaultExpiryTimestamp()); + userDetailKeyObj.setPersoncode(personcode); + userDetailKeyObj.setUsercode(tcustPersonDetail.getIdentification()); + TsafeUserDetail userDetailObj = new TsafeUserDetail(); + userDetailObj.setPk(userDetailKeyObj); + userDetailObj.setRecordversion(0); + userDetailObj.setDatefrom(new Timestamp(System.currentTimeMillis())); + userDetailObj.setUserstatuscatalog("ACT"); + userDetailObj.setUserstatuscatalogcode("USERSTATUS"); + userDetailObj.setCompanycode(1); + userDetailObj.setAreacode(1); + userDetailObj.setOfficecode(1); + userDetailObj.setBranchcode(1); + userDetailObj.setChannelcode("BRC"); + userDetailObj.setLanguagecode("ES"); + userDetailObj.setNickname(tcustPersonDetail.getIdentification()); + userDetailObj.setPassword("7c4a8d09ca3762af61e59520943dc26494f8941b"); + userDetailObj.setChangepassword("Y"); + userDetailObj.setIngressuser("ADMIN"); + userDetailObj.setActivateuser("ADMIN"); + userDetailObj.setIsuserbpm("Y"); + entityManager.persist(userDetailObj); + + } + this.completeAditionalInfo(pSaveRequest, tcustPersonDetail); + this.balanceCode(tcustPersonBalance, pSaveRequest); + + } catch (Exception e) { + return pSaveRequest; + } + return pSaveRequest; + } + + /** + * Metodo para reversos + * + * @param pSaveRequest + * @return + * @throws Exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + /** + * Completa el codigo de la persona en la tabla TcustPeople + * + * @param tcustPeople + * @param personcode + * @throws Exception + */ + private void completePeople(SaveRequest pSaverequest, TcustPeople tcustPeople, Integer personcode) throws Exception { + TcustPeopleKey tcustPeopleKey = new TcustPeopleKey(); + tcustPeopleKey.setPersoncode(personcode); + tcustPeople.setPk(tcustPeopleKey); + tcustPeople.setIngressusercode(pSaverequest.getUser()); + } + + /** + * Metodo que se encarga de completar el personcode en la tabla + * Tcustpeoplejob + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeJob(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleJob tcustPeopleJob = (TcustPeopleJob) object; + if ((tcustPeopleJob != null) && (tcustPeopleJob.getPk().getPersoncode() == null)) { + TcustPeopleJobKey tcustPeopleJobKey = new TcustPeopleJobKey(); + tcustPeopleJobKey.setPersoncode(personcode); + tcustPeopleJobKey.setJobsequence(tcustPeopleJob.getPk().getJobsequence()); + tcustPeopleJob.setPk(tcustPeopleJobKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla + * TcustPeopleVehicle + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeVehicles(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleVehicle tcustPeopleVehicle = (TcustPeopleVehicle) object; + if ((tcustPeopleVehicle != null) && (tcustPeopleVehicle.getPk().getPersoncode() == null)) { + TcustPeopleVehicleKey tcustPeopleVehicleKey = new TcustPeopleVehicleKey(); + tcustPeopleVehicleKey.setPersoncode(personcode); + tcustPeopleVehicleKey.setVehiclesequence(tcustPeopleVehicle.getPk().getVehiclesequence()); + tcustPeopleVehicle.setPk(tcustPeopleVehicleKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla + * TcustPeopleOtherAssets + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeOtherAssets(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleOtherAssets tcustPeopleOtherAssets = (TcustPeopleOtherAssets) object; + if ((tcustPeopleOtherAssets != null) && (tcustPeopleOtherAssets.getPk().getPersoncode() == null)) { + TcustPeopleOtherAssetsKey tcustPeopleOtherAssetsKey = new TcustPeopleOtherAssetsKey(); + tcustPeopleOtherAssetsKey.setPersoncode(personcode); + tcustPeopleOtherAssetsKey.setAssetssequence(tcustPeopleOtherAssets.getPk().getAssetssequence()); + tcustPeopleOtherAssets.setPk(tcustPeopleOtherAssetsKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla + * TcustPeopleRealAssets + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeRealAssets(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleRealAssets tcustPeopleRealAssets = (TcustPeopleRealAssets) object; + if ((tcustPeopleRealAssets != null) && (tcustPeopleRealAssets.getPk().getPersoncode() == null)) { + TcustPeopleRealAssetsKey tcustPeopleRealAssetsKey = new TcustPeopleRealAssetsKey(); + tcustPeopleRealAssetsKey.setPersoncode(personcode); + tcustPeopleRealAssetsKey.setAssetssequence(tcustPeopleRealAssets.getPk().getAssetssequence()); + tcustPeopleRealAssets.setPk(tcustPeopleRealAssetsKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla + * TcustPeopleTradeReferences + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeTradeReferences(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleTradereferences tcustPeopleTradereferences = (TcustPeopleTradereferences) object; + if ((tcustPeopleTradereferences != null) && (tcustPeopleTradereferences.getPk().getPersoncode() == null)) { + TcustPeopleTradereferencesKey tcustPeopleTradereferencesKey = new TcustPeopleTradereferencesKey(); + tcustPeopleTradereferencesKey.setPersoncode(personcode); + tcustPeopleTradereferencesKey.setTradesequence(tcustPeopleTradereferences.getPk().getTradesequence()); + tcustPeopleTradereferences.setPk(tcustPeopleTradereferencesKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla + * TcustPeopleIncome + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeIncome(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleIncome tcustPeopleIncome = (TcustPeopleIncome) object; + if ((tcustPeopleIncome != null) && (tcustPeopleIncome.getPk().getPersoncode() == null)) { + TcustPeopleIncomeKey tcustPeopleIncomeKey = new TcustPeopleIncomeKey(); + tcustPeopleIncomeKey.setPersoncode(personcode); + tcustPeopleIncomeKey.setIncomesequence(tcustPeopleIncome.getPk().getIncomesequence()); + tcustPeopleIncome.setPk(tcustPeopleIncomeKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla + * TcustPeopleExpenses + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeExpenses(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleExpenses tcustPeopleExpenses = (TcustPeopleExpenses) object; + if ((tcustPeopleExpenses != null) && (tcustPeopleExpenses.getPk().getPersoncode() == null)) { + TcustPeopleExpensesKey tcustPeopleExpensesKey = new TcustPeopleExpensesKey(); + tcustPeopleExpensesKey.setPersoncode(personcode); + tcustPeopleExpensesKey.setExpensesequence(tcustPeopleExpenses.getPk().getExpensesequence()); + tcustPeopleExpenses.setPk(tcustPeopleExpensesKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla + * TcustPeopleLoan + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeLoan(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleLoan tcustPeopleLoan = (TcustPeopleLoan) object; + if ((tcustPeopleLoan != null) && (tcustPeopleLoan.getPk().getPersoncode() == null)) { + TcustPeopleLoanKey tcustPeopleLoanKey = new TcustPeopleLoanKey(); + tcustPeopleLoanKey.setPersoncode(personcode); + tcustPeopleLoanKey.setLoansequence(tcustPeopleLoan.getPk().getLoansequence()); + tcustPeopleLoan.setPk(tcustPeopleLoanKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla + * TcustPeopleAditionalData + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeAditionalData(Object lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + TcustPeopleAditionalData tcustPeopleAditionalData = (TcustPeopleAditionalData) lDetail; + if ((tcustPeopleAditionalData != null) && (tcustPeopleAditionalData.getPk().getPersoncode() == null)) { + tcustPeopleAditionalData.getPk().setPersoncode(personcode); + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla + * TcustPeopleFixedIncome + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeFixedIncome(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleFixedIncome tcustPeopleFixedIncome = (TcustPeopleFixedIncome) object; + if ((tcustPeopleFixedIncome != null) && (tcustPeopleFixedIncome.getPk().getPersoncode() == null)) { + TcustPeopleFixedIncomeKey tcustPeopleFixedIncomeKey = new TcustPeopleFixedIncomeKey(); + tcustPeopleFixedIncomeKey.setPersoncode(personcode); + tcustPeopleFixedIncomeKey.setFixedincomesequence(tcustPeopleFixedIncome.getPk().getFixedincomesequence()); + tcustPeopleFixedIncome.setPk(tcustPeopleFixedIncomeKey); + } + } + } + + /** + * Metodo que se encarga de completar el personcode en la tabla + * TcustPeopleAssociation + * + * @param lDetail + * @param personcode + * @throws Exception + */ + private void completeAssociation(List lDetail, Integer personcode) throws Exception { + if (lDetail == null) { + return; + } + for (Object object : lDetail) { + TcustPeopleAssociation tcustPeopleAssociation = (TcustPeopleAssociation) object; + if ((tcustPeopleAssociation != null) && (tcustPeopleAssociation.getPk().getPersoncode() == null)) { + TcustPeopleAssociationKey tcustPeopleAssociationKey = new TcustPeopleAssociationKey(); + tcustPeopleAssociationKey.setPersoncode(personcode); + tcustPeopleAssociationKey.setAssociationsequence(tcustPeopleAssociation.getPk().getAssociationsequence()); + tcustPeopleAssociation.setPk(tcustPeopleAssociationKey); + } + } + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/FinancialSituation.java b/base/business/person/src/main/java/com/fp/person/rules/save/FinancialSituation.java new file mode 100644 index 0000000..64828e4 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/FinancialSituation.java @@ -0,0 +1,145 @@ +package com.fp.person.rules.save; + +import java.math.BigDecimal; +import java.sql.Date; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.save.SaveRequest; +import com.fp.excel.ExcelToMap; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.balance.TcustBalanceAccount; +import com.fp.persistence.pcustomer.balance.TcustBalanceFinancial; +import com.fp.persistence.pcustomer.balance.TcustBalanceFinancialKey; +import com.fp.persistence.pcustomer.balance.TcustPersonBalance; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.image.TgeneFilesDetailKey; + +/** + * Clase que graba la data recibida de Excel en la tabla TcustBalanceFinancial + * + * @author BPTWPA + */ +public class FinancialSituation { + + /** + * M�todo que graba en la base de datos las cuentas del balance subido en excel + * + * @param tcustPersonBalance Objeto TcustPersonBalance + * @param excelMap Mapa obtenido del archivo de excel + * @throws Exception + */ + // public List completeFinancialSituation(TcustPersonBalance tcustPersonBalance, SaveRequest + // pSaveRequest) throws Exception { + public void completeFinancialSituation(TcustPersonBalance tcustPersonBalance, SaveRequest pSaveRequest) throws Exception { + // List lTcustBalanceFinancial = new ArrayList(); + boolean isNew= (Boolean) pSaveRequest.get("nuevo"); + Map mapExcel; + if (tcustPersonBalance == null) { + return;// lTcustBalanceFinancial; + } + TgeneFilesDetailKey tgeneFilesDetailKey = new TgeneFilesDetailKey(tcustPersonBalance.getCode(), FormatDates.getDefaultExpiryTimestamp()); + TgeneFilesDetail tgeneFilesDetail = TgeneFilesDetail.find(PersistenceHelper.getEntityManager(), tgeneFilesDetailKey); + if (tgeneFilesDetail == null) { + return;// lTcustBalanceFinancial; + } + if (tgeneFilesDetail.getExtension().equals("xls") || tgeneFilesDetail.getExtension().equals("xlsx")) { + APPLogger.getLogger().error("2"); + ExcelToMap excelMap = new ExcelToMap(tgeneFilesDetail.getImage(), tgeneFilesDetail.getExtension()); + mapExcel = excelMap.getExcelMap(); + APPLogger.getLogger().error("3"); + if ((mapExcel == null) || mapExcel.isEmpty()) { + throw new GeneralException("CUST-0009","ARCHIVO NO CUMPLE CON FORMATO REQUERIDO"); + } + APPLogger.getLogger().error("3.1"); + + if(!isNew) + this.update(tcustPersonBalance.getPk().getPersoncode(), tcustPersonBalance.getPk().getBalancedate(), tcustPersonBalance.getPk() + .getBalancecatalog(), tcustPersonBalance.getPk().getBalancecatalogcode()); + if (tcustPersonBalance.getPk().getBalancecatalog().compareTo("BG") == 0) { + APPLogger.getLogger().error("3.2"); + Integer rows = mapExcel.size() / 4; + if (!String.valueOf(mapExcel.get("1:0")).equals("") ||!String.valueOf(mapExcel.get("0:1")).equals("ACTIVOS")) { + throw new GeneralException("CUST-0004", "El ARCHIVO NO ES EL CORRECTO - BG"); + } + APPLogger.getLogger().error("3.3"); + for (int i = 1; i <= rows; i++) { + TcustBalanceFinancial tcustBalanceFinancial = new TcustBalanceFinancial(); + String parameter = i + ":3"; + if (mapExcel.containsKey(parameter)) { + TcustBalanceAccount tcustBalanceAccount = TcustBalanceAccount.findPerParameter(PersistenceHelper.getEntityManager(), + parameter); + if (tcustBalanceAccount != null) { + Object value = mapExcel.get(parameter); + TcustBalanceFinancialKey tcustBalanceFinancialKey = new TcustBalanceFinancialKey(); + tcustBalanceFinancialKey.setPersoncode(tcustPersonBalance.getPk().getPersoncode()); + tcustBalanceFinancialKey.setBalancedate(tcustPersonBalance.getPk().getBalancedate()); + tcustBalanceFinancialKey.setBalancecatalog(tcustPersonBalance.getPk().getBalancecatalog()); + tcustBalanceFinancialKey.setBalancecatalogcode(tcustPersonBalance.getPk().getBalancecatalogcode()); + tcustBalanceFinancialKey.setDateto(FormatDates.getDefaultExpiryTimestamp()); + tcustBalanceFinancialKey.setAccountcode(tcustBalanceAccount.getPk().getAccountcode()); + tcustBalanceFinancial.setPk(tcustBalanceFinancialKey); + tcustBalanceFinancial.setValueaccount(new BigDecimal(value.getClass().getSimpleName().equals("BigDecimal") ? String + .valueOf(value) : "0")); + tcustBalanceFinancial.setIngressuser(pSaveRequest.getUser()); + PersistenceHelper.save(tcustBalanceFinancial); + // lTcustBalanceFinancial.add(tcustBalanceFinancial); + + } + } + } + APPLogger.getLogger().error("3.2"); + } else { + APPLogger.getLogger().error("3.4"); + Integer rows = mapExcel.size() / 3; + if (String.valueOf(mapExcel.get("1:0")).equals("") ||!String.valueOf(mapExcel.get("0:1")).equals("Nombre de la Cuenta")) { + throw new GeneralException("CUST-0005", "El ARCHIVO NO ES EL CORRECTO - BG(IFIS)"); + } + for (int i = 1; i <= rows; i++) { + TcustBalanceFinancial tcustBalanceFinancial = new TcustBalanceFinancial(); + String keyCode = i + ":0"; + String keyValue = i + ":2"; + if (mapExcel.containsKey(keyCode) && mapExcel.containsKey(keyValue)) { + Object code = mapExcel.get(keyCode); + Object value = mapExcel.get(keyValue); + TcustBalanceFinancialKey tcustBalanceFinancialKey = new TcustBalanceFinancialKey(); + tcustBalanceFinancialKey.setPersoncode(tcustPersonBalance.getPk().getPersoncode()); + tcustBalanceFinancialKey.setBalancedate(tcustPersonBalance.getPk().getBalancedate()); + tcustBalanceFinancialKey.setBalancecatalog(tcustPersonBalance.getPk().getBalancecatalog()); + tcustBalanceFinancialKey.setBalancecatalogcode(tcustPersonBalance.getPk().getBalancecatalogcode()); + tcustBalanceFinancialKey.setDateto(FormatDates.getDefaultExpiryTimestamp()); + tcustBalanceFinancialKey.setAccountcode(String.valueOf(code)); + tcustBalanceFinancial.setPk(tcustBalanceFinancialKey); + tcustBalanceFinancial.setValueaccount(new BigDecimal(value.getClass().getSimpleName().equals("BigDecimal") ? String + .valueOf(value) : "0")); + tcustBalanceFinancial.setIngressuser(pSaveRequest.getUser()); + PersistenceHelper.save(tcustBalanceFinancial); + // lTcustBalanceFinancial.add(tcustBalanceFinancial); + } + } + APPLogger.getLogger().error("3.5"); + } + } else { + throw new GeneralException("CUST-0006", "EXTENSIN INCORRECTA DEL ARCHIVO"); + } + APPLogger.getLogger().error("4"); + // return lTcustBalanceFinancial; + } + + private void update(Integer pPerson, Date pDate, String pCatalog, String pCatalogCode) throws Exception { + String sql = "update TCUSTBALANCEFINANCIAL set dateto=:dateto where PERSONCODE=:PERSON and BALANCEDATE=:date" + + " and BALANCECATALOG=:TYPE and BALANCECATALOGCODE=:TYPECODE and dateto=:vig"; + Query q = PersistenceHelper.createNativeQuery(sql); + q.setParameter("dateto", FormatDates.getInstance().getDataBaseTimestamp()); + q.setParameter("PERSON", pPerson); + q.setParameter("date", pDate); + q.setParameter("TYPE", pCatalog); + q.setParameter("TYPECODE", pCatalogCode); + q.setParameter("vig", FormatDates.getDefaultExpiryTimestamp()); + q.executeUpdate(); + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/JuridicalPerson.java b/base/business/person/src/main/java/com/fp/person/rules/save/JuridicalPerson.java new file mode 100644 index 0000000..2f56e04 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/JuridicalPerson.java @@ -0,0 +1,137 @@ +package com.fp.person.rules.save; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.joda.time.DateTime; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.company.TcustCompany; +import com.fp.persistence.pcustomer.company.TcustCompanyKey; +import com.fp.persistence.pcustomer.gene.TcustPerson; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonAddressKey; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pcustomer.gene.TcustPersonPhoneKey; +import com.fp.sessionbeans.helper.Sequence; + +public class JuridicalPerson extends TransactionRule { + + private static final long serialVersionUID = 1L; + + @SuppressWarnings("unchecked") + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + try { + TcustPersonDetail detallesPersona=(TcustPersonDetail)pSaveRequest.get("PERSON"); + TcustCompany company=(TcustCompany)pSaveRequest.get("COMPANY"); + List direcciones=(List)pSaveRequest.get("ADDRESSES"); + List telefonos=(List)pSaveRequest.get("PHONES"); + + //Persistiendo el TCUSTPERSON + TcustPersonDetailKey pkDetallesPersona=new TcustPersonDetailKey(); + + Calendar calendarioDateto=Calendar.getInstance(); + calendarioDateto.set(Calendar.YEAR, 2999); + calendarioDateto.set(Calendar.MONTH, Calendar.DECEMBER); + calendarioDateto.set(Calendar.DAY_OF_MONTH,31); + calendarioDateto.set(Calendar.MILLISECOND, 0); + calendarioDateto.set(Calendar.SECOND, 0); + calendarioDateto.set(Calendar.MINUTE, 0); + calendarioDateto.set(Calendar.HOUR, 0); + + //Caso en que la persona es nueva + if(detallesPersona.isnew && (detallesPersona.getPk()==null || detallesPersona.getPk().getPersoncode()==null)){ + Sequence sequence = new Sequence(); + Integer personcode=Integer.valueOf(sequence.getNextValue("PERSONCODE").toString()); + TcustPerson persona=new TcustPerson(); + if(personcode!=null){ + persona.setPk(personcode); + pkDetallesPersona.setPersoncode(personcode); + //PersistenceHelper.getEntityManager().persist(persona); + } + + pkDetallesPersona.setDateto(FormatDates.getDefaultExpiryTimestamp()); + detallesPersona.setPk(pkDetallesPersona); + }else{ + pkDetallesPersona=detallesPersona.getPk(); + } + + //Persistiendo el TCUSTPERSONDETAIL + if(!detallesPersona.isnew){ + detallesPersona=(TcustPersonDetail)PersistenceHelper.getEntityManager().merge(detallesPersona); + } + //PersistenceHelper.getEntityManager().persist(detallesPersona); + + //Persistiendo el TCUSTCOMPANY + //Caso en que la compannia es nueva + // if(company.isnew && (company.getPk()==null || company.getPk().getPersoncode()==null)){ + TcustCompanyKey pkJuridica=new TcustCompanyKey(); + // pkJuridica.setDateto(new Timestamp(calendarioDateto.getTimeInMillis())); + pkJuridica.setDateto(FormatDates.getDefaultExpiryTimestamp()); + pkJuridica.setPersoncode(pkDetallesPersona.getPersoncode()); + company.setPk(pkJuridica); + // } + +/* if(!company.isnew){ + company=(TcustCompany)PersistenceHelper.getEntityManager().merge(company); + }*/ + // PersistenceHelper.getEntityManager().persist(company); + + //Persistiendo las direcciones + for (TcustPersonAddress direccion : direcciones) { + if(direccion.getPk()!=null && direccion.getPk().getAddressnumber()!=null && direccion.getPk().getPersoncode()!=null && direccion.getPk().getDateto()!=null){ + direccion=PersistenceHelper.getEntityManager().merge(direccion); + //PersistenceHelper.getEntityManager().persist(direccion); + }else{ + TcustPersonAddressKey pkDireccion=new TcustPersonAddressKey(); + pkDireccion.setPersoncode(pkDetallesPersona.getPersoncode()); + pkDireccion.setDateto(FormatDates.getDefaultExpiryTimestamp()); + + direccion.setPk(pkDireccion); + direccion.setDatefrom(new Timestamp(Calendar.getInstance().getTimeInMillis())); + PersistenceHelper.getEntityManager().persist(direccion); + } + } + + //Persistiendo los telefonos + for (TcustPersonPhone telefono : telefonos) { + if(telefono.getPk()!=null && telefono.getPk().getPersoncode()!=null){ + telefono=PersistenceHelper.getEntityManager().merge(telefono); + //PersistenceHelper.getEntityManager().persist(telefono); + }else{ + TcustPersonPhoneKey pkTelefono=new TcustPersonPhoneKey(); + pkTelefono.setPersoncode(pkDetallesPersona.getPersoncode()); + pkTelefono.setDateto(FormatDates.getDefaultExpiryTimestamp()); + + telefono.setPk(pkTelefono); + telefono.setDatefrom(new Timestamp(Calendar.getInstance().getTimeInMillis())); + PersistenceHelper.getEntityManager().persist(telefono); + } + } + + // PersistenceHelper.getEntityManager().flush(); + + } catch (Exception e) { + return pSaveRequest; + } + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest arg0) throws Exception { + + return arg0; + } + + + +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/LogoImage.java b/base/business/person/src/main/java/com/fp/person/rules/save/LogoImage.java new file mode 100644 index 0000000..b21c3a0 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/LogoImage.java @@ -0,0 +1,108 @@ +package com.fp.person.rules.save; + +import com.fp.dto.helper.FileHelper; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.company.TcustCompany; +import com.fp.persistence.pcustomer.company.TcustCompanyKey; +import com.fp.persistence.pgeneral.image.TgeneFiles; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.image.TgeneFilesDetailKey; +import java.sql.Timestamp; +import java.util.List; + +/** + * Clase que se encarga de agregar o modificar los logos de una empresa + * + * @author scastillo + */ +public class LogoImage extends TransactionRule { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Metodo que genera el numero de sequencia de imagenes para el logo de + * empresas + * + * @param sr + * @return + * @throws Exception + */ + @Override + public SaveRequest normalProcess(SaveRequest sr) throws Exception { + Integer personcode = (Integer) sr.get("pk_personcode"); + Integer logocode = (Integer) sr.get("logocode"); + List fileItem = (List) sr.get("file"); + if (fileItem!=null && !fileItem.isEmpty() && fileItem.size() == 1) { + if(fileItem.get(0).getExtension() != null){ + if (fileItem.get(0).getExtension().toLowerCase().compareTo("jpg") == 0 + || fileItem.get(0).getExtension().toLowerCase().compareTo("gif") == 0 + || fileItem.get(0).getExtension().toLowerCase().compareTo("png") == 0) { + int contador = 1; + if (logocode == null) { + logocode = PersonImage.getFileCode(); + TgeneFiles tgeneFiles = new TgeneFiles(); + tgeneFiles.setPk(logocode); + sr.putSaveBean("TGENEFILES", tgeneFiles, (contador++)); + } + TgeneFilesDetailKey tgeneFilesDetailKey = new TgeneFilesDetailKey(); + tgeneFilesDetailKey.setCode(logocode); + Timestamp fechaactual = FormatDates.getInstance().getDataBaseTimestamp(); + TgeneFilesDetail tgeneFilesDetail = TgeneFilesDetail.find( + PersistenceHelper.getEntityManager(), + tgeneFilesDetailKey); + if (tgeneFilesDetail == null) { + tgeneFilesDetail = new TgeneFilesDetail(); + tgeneFilesDetail.setPk(tgeneFilesDetailKey); + tgeneFilesDetail.setImage(fileItem.get(0).getImage()); + tgeneFilesDetail.setCapturedate(FormatDates.getInstance().getDataBaseDate()); + tgeneFilesDetail.setImagesize(Integer.parseInt(String.valueOf(fileItem.get(0).getSize()))); + tgeneFilesDetail.setIngressuser(sr.getUser()); + tgeneFilesDetail.setExtension(fileItem.get(0).getExtension()); + tgeneFilesDetail.setContenttype(fileItem.get(0).getContentType()); + tgeneFilesDetail.setName(fileItem.get(0).getName()); + } else { + tgeneFilesDetail.setImage(fileItem.get(0).getImage()); + tgeneFilesDetail.setCapturedate(FormatDates.getInstance().getDataBaseDate()); + tgeneFilesDetail.setImagesize(Integer.parseInt(String.valueOf(fileItem.get(0).getSize()))); + tgeneFilesDetail.setDatefrom(fechaactual); + tgeneFilesDetail.setModifyuser(sr.getUser()); + tgeneFilesDetail.setContenttype(fileItem.get(0).getContentType()); + tgeneFilesDetail.setName(fileItem.get(0).getName()); + PersistenceHelper.getEntityManager().detach( + tgeneFilesDetail); + } + sr.putSaveBean("TGENEFILESDETAIL", tgeneFilesDetail, + (contador++)); + TcustCompanyKey tcustCompanyKey = new TcustCompanyKey(); + tcustCompanyKey.setPersoncode(personcode); + tcustCompanyKey.setDateto(FormatDates.getDefaultExpiryTimestamp()); + TcustCompany tcustCompany = TcustCompany.find( + PersistenceHelper.getEntityManager(), tcustCompanyKey); + tcustCompany.setModifyuser(sr.getUser()); + tcustCompany.setPicture(fileItem.get(0).getImage()); + tcustCompany.setLogo(logocode); + tcustCompany.setDatefrom(fechaactual); + PersistenceHelper.getEntityManager().detach(tcustCompany); + sr.putSaveBean("TCUSTCOMPANY", tcustCompany, (contador++)); + } else { + throw new GeneralException("CUST-0007", "Los tipos de archivos permitidos son jpg, gif y png"); + } + } + } + sr.getResponse().put("codes", "[" + logocode + "]"); + return sr; + } + + @Override + public SaveRequest reverseProcess(SaveRequest sr) throws Exception { + return sr; + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/PersonBalanceFile.java b/base/business/person/src/main/java/com/fp/person/rules/save/PersonBalanceFile.java new file mode 100644 index 0000000..d6be719 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/PersonBalanceFile.java @@ -0,0 +1,79 @@ +package com.fp.person.rules.save; + +import java.util.List; + +import javax.persistence.EntityManager; + +import com.fp.dto.helper.FileHelper; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.image.TgeneFiles; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.image.TgeneFilesDetailKey; + +/** + * Clase que se encarga de guardar los datos de la situacin financiera de + * personas y subir un archive a la DB + * + * @author BPTWPA + */ +public class PersonBalanceFile extends TransactionRule { + + /** + * Mtodo que recibe datos para registrar la informacion en la DB + * + * @param pSaveRequest Recibe un objeto SaveRequest + * @return pSaveRequest Retorna un objeto SaveRequest + * @throws Exception + */ + @SuppressWarnings("unchecked") + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + String balancefile = (String) pSaveRequest.get("balancefile"); + List fileItem = (List) pSaveRequest.get("file"); + if (fileItem == null || balancefile == null || fileItem.isEmpty()) { + return pSaveRequest; + } + if (balancefile != null && balancefile.compareTo("excelfile") == 0) { + Integer filecode = PersonImage.getFileCode(); + TgeneFiles tgeneFiles = TgeneFiles.find(PersistenceHelper.getEntityManager(), filecode); + if (tgeneFiles == null) { + tgeneFiles = new TgeneFiles(filecode); + pSaveRequest.putSaveBean("TGENEFILES", tgeneFiles, 1); + } + TgeneFilesDetailKey tgeneFilesDetailKey = new TgeneFilesDetailKey(filecode, FormatDates.getDefaultExpiryTimestamp()); + TgeneFilesDetail tgeneFilesDetail = TgeneFilesDetail.find(PersistenceHelper.getEntityManager(), tgeneFilesDetailKey); + if (tgeneFilesDetail == null) { + tgeneFilesDetail = new TgeneFilesDetail(); + tgeneFilesDetail.setPk(tgeneFilesDetailKey); + tgeneFilesDetail.setImage(fileItem.get(0).getImage()); + tgeneFilesDetail.setCapturedate(FormatDates.getInstance().getDataBaseDate()); + tgeneFilesDetail.setImagesize(Integer.parseInt(String.valueOf(fileItem.get(0).getSize()))); + tgeneFilesDetail.setIngressuser(pSaveRequest.getUser()); + tgeneFilesDetail.setExtension(fileItem.get(0).getExtension()); + tgeneFilesDetail.setContenttype(fileItem.get(0).getContentType()); + tgeneFilesDetail.setName(fileItem.get(0).getName()); + } else { + tgeneFilesDetail.setImage(fileItem.get(0).getImage()); + tgeneFilesDetail.setCapturedate(FormatDates.getInstance().getDataBaseDate()); + tgeneFilesDetail.setImagesize(Integer.parseInt(String.valueOf(fileItem.get(0).getSize()))); + tgeneFilesDetail.setDatefrom(FormatDates.getInstance().getDataBaseTimestamp()); + tgeneFilesDetail.setModifyuser(pSaveRequest.getUser()); + tgeneFilesDetail.setContenttype(fileItem.get(0).getContentType()); + tgeneFilesDetail.setName(fileItem.get(0).getName()); + EntityManager em = PersistenceHelper.getEntityManager(); + em.detach(tgeneFilesDetail); + } + pSaveRequest.putSaveBean("TGENEFILESDETAIL", tgeneFilesDetail, 2); + pSaveRequest.getResponse().put("codes", "[" + filecode + "]"); + } + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/PersonImage.java b/base/business/person/src/main/java/com/fp/person/rules/save/PersonImage.java new file mode 100644 index 0000000..82ecf26 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/PersonImage.java @@ -0,0 +1,137 @@ +package com.fp.person.rules.save; + +import java.util.List; + +import com.fp.dto.helper.FileHelper; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pcustomer.people.TcustPeople; +import com.fp.persistence.pcustomer.people.TcustPeopleKey; +import com.fp.persistence.pgeneral.image.TgeneFiles; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.image.TgeneFilesDetailKey; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Clase que se encarga de subir a la BDD la imagen y asociar la foto y firma + * del cliente + * + * @author scastillo + */ +public class PersonImage extends TransactionRule { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Metodo que agrega una imagen en la base de datos + * + * @param pSaveRequest + * @return + * @throws Exception + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + Integer personcode = (Integer) pSaveRequest.get("pk_personcode"); + Integer photocode = (Integer) pSaveRequest.get("photocode"); + Integer signaturecode = (Integer) pSaveRequest.get("signaturecode"); + List fileItem = (List) pSaveRequest.get("file"); + if (fileItem.isEmpty() || fileItem.size() != 2) { + return pSaveRequest; + } + TcustPeople tcustPeople=null; + //TcustPeopleKey tcustPeopleKey = new TcustPeopleKey(personcode,FormatDates.getDefaultExpiryTimestamp()); + tcustPeople = (TcustPeople) pSaveRequest.getSaveBeanModifiedObject("TCUSTPEOPLE"); + if(tcustPeople==null){ + TcustPeopleKey tcustPeopleKey = new TcustPeopleKey(personcode,FormatDates.getDefaultExpiryTimestamp()); + tcustPeople = TcustPeople.find(PersistenceHelper.getEntityManager(), tcustPeopleKey); + } + photocode = this.buildImageCode(photocode, fileItem.get(0),pSaveRequest); + signaturecode = this.buildImageCode(signaturecode, fileItem.get(1), pSaveRequest); + if (tcustPeople!=null && tcustPeople.getPhotocode() == null && photocode != null) { + tcustPeople.setPhotocode(photocode); + tcustPeople.setModifyusercode(pSaveRequest.getUser()); + } + if (tcustPeople!=null && tcustPeople.getSignaturecode() == null && signaturecode != null) { + tcustPeople.setSignaturecode(signaturecode); + tcustPeople.setModifyusercode(pSaveRequest.getUser()); + } + + pSaveRequest.getResponse().put("codes", "["+ photocode + "," + signaturecode + "]"); + return pSaveRequest; + } + + /** + * Metodo que se ejecuta en modo reverso + * + * @param pSaveRequest + * @return + * @throws Exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) + throws Exception { + return pSaveRequest; + } + + /** + * Metodo que devuelve la secuencia que le pertenece a una nueva imagen. + * + * @return Codigo de la nueva persona. + * @throws Exception + */ + public static Integer getFileCode() throws Exception { + Sequence sequence = new Sequence(); + return Integer.valueOf(sequence.getNextValue("FILECODE").toString()); + } + + /** + * Metodo que se encarga de construir la imagen + * + * @param photocode + * @param fileItem + * @param saveRequest + * @throws Exception + */ + private Integer buildImageCode(Integer photocode, FileHelper fileItem, + SaveRequest saveRequest) throws Exception { + if (!fileItem.getName().equals("")) { + if (fileItem.getExtension().toLowerCase().compareTo("jpg") == 0 + || fileItem.getExtension().toLowerCase().compareTo("gif") == 0 + || fileItem.getExtension().toLowerCase().compareTo("png") == 0) { + if (photocode == null) { + photocode = getFileCode(); + TgeneFiles tgeneFiles = new TgeneFiles(photocode); + PersistenceHelper.save(tgeneFiles); + } + TgeneFilesDetailKey tgeneFilesDetailKey = new TgeneFilesDetailKey(photocode, FormatDates.getDefaultExpiryTimestamp()); + TgeneFilesDetail tgeneFilesDetail = TgeneFilesDetail.find(PersistenceHelper.getEntityManager(),tgeneFilesDetailKey); + if (tgeneFilesDetail == null) { + tgeneFilesDetail = new TgeneFilesDetail(tgeneFilesDetailKey); + tgeneFilesDetail.setImage(fileItem.getImage()); + tgeneFilesDetail.setCapturedate(FormatDates.getInstance().getDataBaseDate()); + tgeneFilesDetail.setImagesize(Integer.parseInt(String.valueOf(fileItem.getSize()))); + tgeneFilesDetail.setIngressuser(saveRequest.getUser()); + tgeneFilesDetail.setExtension(fileItem.getExtension()); + PersistenceHelper.save(tgeneFilesDetail); + } else { + tgeneFilesDetail.setImage(fileItem.getImage()); + tgeneFilesDetail.setCapturedate(FormatDates.getInstance().getDataBaseDate()); + tgeneFilesDetail.setImagesize(Integer.parseInt(String.valueOf(fileItem.getSize()))); + tgeneFilesDetail.setModifyuser(saveRequest.getUser()); + tgeneFilesDetail.setExtension(fileItem.getExtension()); + PersistenceHelper.saveOrUpdate(tgeneFilesDetail); + } + } else { + throw new GeneralException("CUST-0007", + "LOS TIPOS DE ARCHIVOS PERMITIDOS SON JPG, GIF Y PNG"); + } + } + return photocode; + } +} \ No newline at end of file diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/ValidateAddressPhones.java b/base/business/person/src/main/java/com/fp/person/rules/save/ValidateAddressPhones.java new file mode 100644 index 0000000..e986e8e --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/ValidateAddressPhones.java @@ -0,0 +1,60 @@ +package com.fp.person.rules.save; + +import java.util.List; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; + +public class ValidateAddressPhones extends TransactionRule { + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + Integer personcode = null; + Object objpersoncode = pSaveRequest.get("personcode"); + if (objpersoncode instanceof String) { + personcode = Integer.parseInt(objpersoncode.toString()); + } else if (objpersoncode instanceof String) { + personcode = (Integer) objpersoncode; + } + + if ((pSaveRequest.get("TCUSTPERSONADDRESS") == null) && (pSaveRequest.get("TCUSTPERSONPHONE") == null)) { + return pSaveRequest; + } + + List laddressdel = pSaveRequest.getSaveBeanDeletedRecords("TCUSTPERSONADDRESS"); + List laddressmod = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONADDRESS"); + List laddressbase = TcustPersonAddress.findByPersonCode(PersistenceHelper.getEntityManager(), personcode); + + List laddressFinal = Constant.getFinalList(laddressbase, Constant.convertList(laddressmod, TcustPersonAddress.class), + Constant.convertList(laddressdel, TcustPersonAddress.class)); + + if ((laddressFinal == null) || laddressFinal.isEmpty()) { + throw new GeneralException("CUST-0011", "SE NECESITA INGRESAR UNA DIRECCIN"); + } + + List lphonesdel = pSaveRequest.getSaveBeanDeletedRecords("TCUSTPERSONPHONE"); + List lphonesmod = pSaveRequest.getSaveBeanModifiedRecords("TCUSTPERSONPHONE"); + List lphonebase = TcustPersonPhone.findPhones(PersistenceHelper.getEntityManager(), personcode, + Constant.getDefaultExpiryTimestamp()); + + List lphoneFinal = Constant.getFinalList(lphonebase, Constant.convertList(lphonesmod, TcustPersonPhone.class), + Constant.convertList(lphonesdel, TcustPersonPhone.class)); + + if ((lphoneFinal == null) || lphoneFinal.isEmpty()) { + throw new GeneralException("CUST-0012", "NECESITA UN REGISTRO TELEFNICO"); + } + + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/VerifyInConsep.java b/base/business/person/src/main/java/com/fp/person/rules/save/VerifyInConsep.java new file mode 100644 index 0000000..b3d741d --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/VerifyInConsep.java @@ -0,0 +1,242 @@ +package com.fp.person.rules.save; + +import com.fp.common.helper.Constant; +import com.fp.dto.Response; +import com.fp.dto.data.SaveData; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.NestedSave; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonDetailKey; +import com.fp.persistence.pcustomer.people.TcustPeople; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.gene.OptmListaNegra; +import com.fp.persistence.pgeneral.gene.TgeneConsepLog; +import com.fp.sessionbeans.helper.Sequence; +import java.sql.Timestamp; +import java.util.List; + +/** + * + * @author hinga + */ +public abstract class VerifyInConsep extends TransactionRule { + + /** + * Metodo q busca personas que se encuentre en la lista de CONSEP y guarda auditoria de la misma + * + * @param pSaveRequest Objeto que almacena referencia a las tablas de que intervienen en el proceso con sus datos. + * @param ldata lista de objetos OptmListaNegra + * @param personId Identificacin de la persona. + * @throws Exception + */ + protected void fillConsep(SaveRequest pSaveRequest, List ldata, String personId, String firsname, String middlename, String lastname, String surename, String transaction, boolean continueSave) throws Exception { + Response resp = pSaveRequest.getResponse(); + TgeneAccountingDateBranch db = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pSaveRequest.getCompany(), 0); + Timestamp datenow = new Timestamp(db.getWorkingdate().getTime()); + Integer cod = this.getLogId(); + resp.setResponseCode("TIME-0016"); + boolean verifysindicado = false; + String saveorupdate = "N"; + if (ldata != null && !ldata.isEmpty()) { + String message = ""; + for (OptmListaNegra obj : ldata) { + if (message.compareTo("") != 0) { + message += "
"; + } + message += "(" + obj.getNombre() + " " + obj.getApellido() + ") " + "SE ENCUENTRA REGISTRADA EN LA TABLA DE CONSEP - "; + if (obj.getId_tiplisneg() == 1) { + verifysindicado = true; + saveorupdate = "N"; + message += "SINDICADO"; + } else if (obj.getId_tiplisneg() == 2 && "YES".equals((String) pSaveRequest.get("lisnegcontinue"))) { + saveorupdate = "S"; + message += "HOMNIMO"; + } else { + message += "HOMNIMO"; + } + pSaveRequest.putSaveBean("TGENECONSEP", obj); + } + for (OptmListaNegra obj : ldata) { + this.saveConsepLog(pSaveRequest, obj, personId, firsname, middlename, lastname, surename, cod, transaction, datenow, saveorupdate); + cod = cod + 1; + } + if (verifysindicado && transaction.equals("N")) { + if (!continueSave) { + throw new GeneralException("CUST-0002", "
" + message + "
NO SE PUEDE REGISTRAR EL CLIENTE"); + } + } else if (verifysindicado && transaction.equals("U")) { + resp.setResponseUserMessage(message); + } else { + if ("YES".equals((String) pSaveRequest.get("lisnegcontinue"))) { + resp.setResponseUserMessage(message); + } else { + if (!continueSave) { + throw new GeneralException("CUST-0003", "
" + message + "
NO SE REGISTRO EL CLIENTE"); + } + } + } + } else { + pSaveRequest.putSaveBean("TGENECONSEP", null); + TgeneConsepLog tgeneConsepLog = new TgeneConsepLog(); + tgeneConsepLog.setPk(cod); + tgeneConsepLog.setIdentificacion(personId); + tgeneConsepLog.setNombre_prim(firsname); + tgeneConsepLog.setNombre_seg(middlename); + tgeneConsepLog.setApellido_prim(lastname); + tgeneConsepLog.setApellido_seg(surename); + tgeneConsepLog.setId_listanegra("0"); + tgeneConsepLog.setId_tiplisneg(0L); + tgeneConsepLog.setFec_ing_lisneg(null); + tgeneConsepLog.setUsuario_cod(pSaveRequest.getUser()); + tgeneConsepLog.setFec_transaccion(datenow);//FormatDates.getInstance().getDataBaseTimestamp() + tgeneConsepLog.setTerminal(pSaveRequest.getTerminalCode()); + tgeneConsepLog.setTransaccion(transaction); + if ("N".equals(transaction)) { + tgeneConsepLog.setCreacion_cli("S"); + tgeneConsepLog.setActualizacion_cli("N"); + } else { + tgeneConsepLog.setCreacion_cli("N"); + tgeneConsepLog.setActualizacion_cli("S"); + } + tgeneConsepLog.setConstancia_consep("N"); + //Envia el bean a la base de datos en una session independiente + NestedSave nestedSave = new NestedSave(pSaveRequest.getCompany(), tgeneConsepLog); + nestedSave.start(); + //sb.join(); NO HABILITAR Espera a la ejecuciond el hijo. + resp.setResponseUserMessage("LA PERSONA NO SE ENCUENTRA REGISTRADA EN LA TABLA DEL CONSEP"); + } + } + + /** + * Metodo que guarda auditoria de los registros de CONSEP + * + * @param pSaveRequest + * @param optmListaNegra + * @param identificationConsep + * @param firsname + * @param middlename + * @param lastname + * @param surename + * @param cod + * @param transac + * @param datenow + * @param saveorupdate + * @throws Exception + */ + private void saveConsepLog(SaveRequest pSaveRequest, OptmListaNegra optmListaNegra, String identificationConsep, String firsname, + String middlename, String lastname, String surename, Integer cod, String transac, Timestamp datenow, String saveorupdate) throws Exception { + TgeneConsepLog tgeneConsepLog = new TgeneConsepLog(); + tgeneConsepLog.setPk(cod); + tgeneConsepLog.setIdentificacion(identificationConsep); + tgeneConsepLog.setNombre_prim(firsname); + tgeneConsepLog.setNombre_seg(middlename); + tgeneConsepLog.setApellido_prim(lastname); + tgeneConsepLog.setApellido_seg(surename); + tgeneConsepLog.setId_listanegra(optmListaNegra.getPk()); + tgeneConsepLog.setId_tiplisneg(optmListaNegra.getId_tiplisneg()); + tgeneConsepLog.setFec_ing_lisneg(optmListaNegra.getFec_ing_lisneg()); + tgeneConsepLog.setUsuario_cod((String) pSaveRequest.get("user")); + tgeneConsepLog.setFec_transaccion(datenow);//FormatDates.getInstance().getDataBaseTimestamp() + tgeneConsepLog.setTerminal((String) pSaveRequest.get("terminalCode")); + tgeneConsepLog.setTransaccion(transac); + if ("N".equals(transac)) { + tgeneConsepLog.setCreacion_cli(saveorupdate); + tgeneConsepLog.setActualizacion_cli("N"); + } else { + tgeneConsepLog.setCreacion_cli("N"); + tgeneConsepLog.setActualizacion_cli("S"); + } + tgeneConsepLog.setConstancia_consep("S"); + NestedSave nestedSave = new NestedSave(pSaveRequest.getCompany(), tgeneConsepLog); + nestedSave.start(); + } + + /** + * Metodo que verifica que si cambian la identificación no se encuentre SINDICADA + * + * @param tcustPeople + * @param pSaveRequest + * @param identificationConsep + * @throws Exception + */ + protected void verifyChangeIdentificationPeople(TcustPeople tcustPeople, SaveRequest pSaveRequest, String identificationConsep) throws Exception { + if (tcustPeople != null) { + TcustPersonDetail tcustPersonDetailUpdate = (TcustPersonDetail) pSaveRequest.getSaveBeanModifiedObject("TCUSTPERSONDETAIL"); + if (tcustPersonDetailUpdate != null && tcustPersonDetailUpdate.getIdentification() != null) { + TcustPersonDetailKey tcustPersonDetailKey = new TcustPersonDetailKey((Integer) pSaveRequest.get("personcode"), Constant.getDefaultExpiryTimestamp()); + TcustPersonDetail tcustPersonDetail = TcustPersonDetail.find(PersistenceHelper.getEntityManager(), tcustPersonDetailKey); + if (tcustPersonDetail != null && tcustPersonDetail.getIdentification() != null + && tcustPersonDetailUpdate.getIdentification().compareTo(tcustPersonDetail.getIdentification()) != 0) { + List ldata = OptmListaNegra.find(PersistenceHelper.getEntityManager(), identificationConsep); + if (ldata != null && !ldata.isEmpty()) { + Integer cod = this.getLogId(); + TgeneAccountingDateBranch db = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pSaveRequest.getCompany(), 0); + Timestamp datenow = new Timestamp(db.getWorkingdate().getTime()); + for (int i = 0; i < ldata.size(); i++) { + OptmListaNegra optmListaNegra = ldata.get(i); + if (optmListaNegra != null) { + if (optmListaNegra.getId_tiplisneg() != null && String.valueOf(optmListaNegra.getId_tiplisneg()).compareTo("1") == 0) { + this.saveConsepLog(pSaveRequest, optmListaNegra, identificationConsep, tcustPeople.getFirstname(), tcustPeople.getMiddlename(), + tcustPeople.getLastname(), tcustPeople.getSurename(), cod, "U", datenow, null); + throw new GeneralException("CUST-0008", "NO SE PUEDE CAMBIAR LA IDENTIFICACIN YA QUE ESTA SE ENCUENTRA COMO SINDICADA"); + } + } + } + } + } + } + } + } + + /** + * Metodo para grabar auditoria de personas juridicas en cambio de identificacion si esta como SINDICADA + * + * @param pSaveRequest + * @param identificationConsep + * @throws Exception + */ + protected void verifyChangeIdentificationPeople(SaveRequest pSaveRequest, String identificationConsep) throws Exception { + TcustPersonDetail tcustPersonDetailUpdate = (TcustPersonDetail) pSaveRequest.getSaveBeanModifiedObject("TCUSTPERSONDETAIL"); + if (tcustPersonDetailUpdate != null && tcustPersonDetailUpdate.getIdentification() != null) { + TcustPersonDetailKey tcustPersonDetailKey = new TcustPersonDetailKey((Integer) pSaveRequest.get("personcode"), Constant.getDefaultExpiryTimestamp()); + TcustPersonDetail tcustPersonDetail = TcustPersonDetail.find(PersistenceHelper.getEntityManager(), tcustPersonDetailKey); + if (tcustPersonDetail != null && tcustPersonDetail.getIdentification() != null + && tcustPersonDetailUpdate.getIdentification().compareTo(tcustPersonDetail.getIdentification()) != 0) { + List ldata = OptmListaNegra.find(PersistenceHelper.getEntityManager(), identificationConsep); + if (ldata != null && !ldata.isEmpty()) { + Integer cod = this.getLogId(); + TgeneAccountingDateBranch db = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneAccountingDateBranch( + pSaveRequest.getCompany(), 0); + Timestamp datenow = new Timestamp(db.getWorkingdate().getTime()); + for (int i = 0; i < ldata.size(); i++) { + OptmListaNegra optmListaNegra = ldata.get(i); + if (optmListaNegra != null) { + if (optmListaNegra.getId_tiplisneg() != null && String.valueOf(optmListaNegra.getId_tiplisneg()).compareTo("1") == 0) { + this.saveConsepLog(pSaveRequest, optmListaNegra, identificationConsep, tcustPersonDetail.getName(), null, + null, null, cod, "U", datenow, null); + throw new GeneralException("CUST-0008", "NO SE PUEDE CAMBIAR LA IDENTIFICACIN YA QUE ESTA SE ENCUENTRA COMO SINDICADA"); + } + } + } + } + } + } + } + + /** + * Metodoq ue obtiene la secuencia para guardar los logs + * + * @return + * @throws Exception + */ + protected Integer getLogId() throws Exception { + Sequence sequence = new Sequence(); + Integer personcode = Integer.valueOf(sequence.getNextValue("LOGCONSEP").toString()); + return personcode; + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/VerifyInConsepCompany.java b/base/business/person/src/main/java/com/fp/person/rules/save/VerifyInConsepCompany.java new file mode 100644 index 0000000..2f3c12b --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/VerifyInConsepCompany.java @@ -0,0 +1,87 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.person.rules.save; + +import com.fp.common.helper.Constant; +import com.fp.dto.save.SaveBean; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pcustomer.company.TcustCompany; +import com.fp.persistence.pcustomer.company.TcustCompanyKey; +import com.fp.persistence.pcustomer.company.TcustCompanyManagers; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.OptmListaNegra; +import java.util.List; + +/** + * Clase que verifica si la compania se encuentra registrada en el CONSEP + * + * @author hinga + */ +public class VerifyInConsepCompany extends VerifyInConsep { + + /** + * Ejecuta la transaccion en modo normal.
Verifica que la persona que se intenta regidtrar se encuentra o no en + * la lista negra (CONSEP). + * + * @param pSaveRequest Objeto que almacena referencia a las tablas de que intervienen en el proceso con sus datos. + * @throws Exception + * @return pSaveRequest Objeto que almacena referencia a las tablas de que intervienen en el proceso con sus datos. + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + String firsname = null, transaction = null, identificationConsep = null; + identificationConsep = (String) pSaveRequest.get("identification"); + if (pSaveRequest.get("personcode") != null) { + this.verifyChangeIdentificationPeople(pSaveRequest, identificationConsep); + } + SaveBean saveBean = (SaveBean) pSaveRequest.get("TCUSTCOMPANYMANAGERS"); + if (saveBean != null) { + List lTcustCompanyManagers = saveBean.getModifiedRecords(); + for (int i = 0; i < lTcustCompanyManagers.size(); i++) { + TcustCompanyManagers tcustCompanyManagers = (TcustCompanyManagers) lTcustCompanyManagers.get(i); + if (tcustCompanyManagers.getPk() != null && tcustCompanyManagers.getPk().getManagerpersoncode() != null) { + TcustPersonDetail tcustPersonDetail = TcustPersonDetail.find(PersistenceHelper.getEntityManager(), + tcustCompanyManagers.getPk().getManagerpersoncode()); + if (tcustPersonDetail != null && tcustPersonDetail.getIdentification() != null) { + List ldata = OptmListaNegra.find(PersistenceHelper.getEntityManager(), tcustPersonDetail.getIdentification()); + String typeItem; + String isnew = (String) tcustCompanyManagers.get("isnew"); + if (isnew != null && isnew.compareTo("Y") == 0) { + typeItem = "N"; + } else { + typeItem = "U"; + } + if (identificationConsep.compareTo(tcustPersonDetail.getIdentification()) != 0) { + this.fillConsep(pSaveRequest, ldata, tcustPersonDetail.getIdentification(), tcustPersonDetail.getName(), null, null, null, typeItem, true); + } + } + } + } + } + if (pSaveRequest.get("personcode") == null || "".equals(((Integer) pSaveRequest.get("personcode")).toString())) { + transaction = "N"; + } else { + transaction = "U"; + } + firsname = (String) pSaveRequest.get("socialreason"); + if (identificationConsep != null) { + List ldata = OptmListaNegra.find(PersistenceHelper.getEntityManager(), identificationConsep); + this.fillConsep(pSaveRequest, ldata, identificationConsep, firsname, null, null, null, transaction, false); + } + return pSaveRequest; + } + + /** + * Ejecuta la transaccion en modo reverso.
+ * + * @param pSaveRequest Objeto que almacena referencia a las tablas de que intervienen en el proceso con sus datos. + * @throws Exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } +} diff --git a/base/business/person/src/main/java/com/fp/person/rules/save/VerifyInConsepPerson.java b/base/business/person/src/main/java/com/fp/person/rules/save/VerifyInConsepPerson.java new file mode 100644 index 0000000..22eba58 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/rules/save/VerifyInConsepPerson.java @@ -0,0 +1,75 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.person.rules.save; + +import com.fp.common.helper.Constant; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pcustomer.people.TcustPeople; +import com.fp.persistence.pcustomer.people.TcustPeopleKey; +import com.fp.persistence.pgeneral.gene.OptmListaNegra; +import java.util.List; + +/** + * Clase que verifica si la persona se encuentra registrada en el CONSEP + * + * @author hinga + */ +public class VerifyInConsepPerson extends VerifyInConsep { + + /** + * Ejecuta la transaccion en modo normal.
Verifica que la persona que se intenta registrar se encuentra o no en + * la lista negra (CONSEP). + * + * @param pSaveRequest Objeto que almacena referencia a las tablas de que intervienen en el proceso con sus datos. + * @throws Exception + * @return pSaveRequest Objeto que almacena referencia a las tablas de que intervienen en el proceso con sus datos. + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + String firsname = null, middlename = null, lastname = null, surename = null, transaction = null, identificationConsep = null; + String balancefile = (String) pSaveRequest.get("balancefile"); + if (balancefile != null && balancefile.compareTo("excelfile") == 0) { + return pSaveRequest; + } + identificationConsep = (String) pSaveRequest.get("identification"); + TcustPeople tcustPeople = null; + + if (pSaveRequest.get("personcode") == null || pSaveRequest.get("personcode").equals("")) { + tcustPeople = (TcustPeople) pSaveRequest.getSaveBeanModifiedObject("TCUSTPEOPLE"); + transaction = "N"; + } else { + TcustPeopleKey key = new TcustPeopleKey(new Integer((String)pSaveRequest.get("personcode")), Constant.getDefaultExpiryTimestamp()); + tcustPeople = TcustPeople.find(PersistenceHelper.getEntityManager(), key); + transaction = "U"; + } + if(tcustPeople == null){ + tcustPeople = (TcustPeople) pSaveRequest.getSaveBeanModifiedObject("TCUSTPEOPLE"); + } + if(transaction.compareTo("U") == 0){ + this.verifyChangeIdentificationPeople(tcustPeople, pSaveRequest, identificationConsep); + } + firsname = tcustPeople.getFirstname(); + middlename = tcustPeople.getMiddlename(); + lastname = tcustPeople.getLastname(); + surename = tcustPeople.getSurename(); + if (identificationConsep != null) { + List ldata = OptmListaNegra.find(PersistenceHelper.getEntityManager(), identificationConsep); + this.fillConsep(pSaveRequest, ldata, identificationConsep, firsname, middlename, lastname, surename, transaction, false); + } + return pSaveRequest; + } + + /** + * Ejecuta la transaccion en modo reverso.
+ * + * @param pSaveRequest Objeto que almacena referencia a las tablas de que intervienen en el proceso con sus datos. + * @throws Exception + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } +} diff --git a/base/business/person/src/main/java/com/fp/person/validate/.svn/entries b/base/business/person/src/main/java/com/fp/person/validate/.svn/entries new file mode 100644 index 0000000..7e6e600 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/validate/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/person/src/main/java/com/fp/person/validate +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ValidateIdentification.java +file + + + + +2022-07-28T03:40:41.762799Z +a67dc6d782ce290b08554cd58ca42fa6 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3940 + diff --git a/base/business/person/src/main/java/com/fp/person/validate/.svn/text-base/ValidateIdentification.java.svn-base b/base/business/person/src/main/java/com/fp/person/validate/.svn/text-base/ValidateIdentification.java.svn-base new file mode 100644 index 0000000..799e894 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/validate/.svn/text-base/ValidateIdentification.java.svn-base @@ -0,0 +1,144 @@ +package com.fp.person.validate; + +import java.math.BigDecimal; + +/** + * Clase para validar la cédula y el RUC de una persona + * @author BPTWPA + * @version 2.1 + */ +public class ValidateIdentification { + /** + * Método para validar la cédula + * + * @param id Número de la cédula + * @return result Retorna V/F según la validez de la cédula + */ + public static boolean cedula(String id) { + + boolean result = true; + + int[] modulo9 = { 2, 1, 2, 1, 2, 1, 2, 1, 2 }; + + BigDecimal verif = new BigDecimal(0); + if (id.length() != 10) + result = false; + else { + for (int i = 0; i < 9; i++) { + BigDecimal temp = new BigDecimal(new BigDecimal(id.substring(i, (i + 1))).multiply(new BigDecimal(modulo9[i])).toString()); + if (temp.doubleValue() > 9){ + temp = temp.subtract(new BigDecimal("9")); + } + verif = verif.add(temp); + } + if (verif.doubleValue() % 10 == 0){ + if (Integer.parseInt(id.substring(9, 10)) == 0){ + result = true; + } else{ + result = false; + } + } else if ((10 - (verif.doubleValue() % 10)) == Integer.parseInt(id.substring(9, 10))){ + result = true; + } else { + result = false; + } + } + return result; + } + + /** + * Método para validar el Ruc + * + * @param ruc Número del Ruc + * @return Retorna V/F según la validez del Ruc + */ + public static boolean ruc(String ruc) { + + boolean result = true; + + int[] modulo11 = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + + BigDecimal verif = new BigDecimal(0); + if (ruc.length() < 13) + result = false; + else if (Integer.parseInt(ruc.substring(0, 2)) < 1 + || Integer.parseInt(ruc.substring(0, 2)) > 22) { + result = false; + } else { + if (Integer.parseInt(ruc.substring(2, 3)) < 0 + || (Integer.parseInt(ruc.substring(2, 3)) > 6 && Integer + .parseInt(ruc.substring(2, 3)) < 9)) { + result = false; + } else { + if (Integer.parseInt(ruc.substring(2, 3)) == 9) { // sociedad privada o extranjeros + if (!ruc.substring(10, 13).equals("001")) + result = false; + else { + modulo11[0] = 4; + modulo11[1] = 3; + modulo11[2] = 2; + modulo11[3] = 7; + modulo11[4] = 6; + modulo11[5] = 5; + modulo11[6] = 4; + modulo11[7] = 3; + modulo11[8] = 2; + for (int i = 0; i < 9; i++) { + verif = verif.add(new BigDecimal(ruc.substring(i, + (i + 1))).multiply(new BigDecimal( + modulo11[i]))); + } + if (verif.doubleValue() % 11 == 0) + if (Integer.parseInt(ruc.substring(9, 10)) == 0) + result = true; + else + result = false; + else if ((11 - (verif.doubleValue() % 11)) == Integer + .parseInt(ruc.substring(9, 10))) + result = true; + else + result = false; + } + } else if (Integer.parseInt(ruc.substring(2, 3)) == 6) { // sociedad pblicas + + if (!ruc.substring(10, 13).equals("001")) + result = false; + else { + modulo11[0] = 3; + modulo11[1] = 2; + modulo11[2] = 7; + modulo11[3] = 6; + modulo11[4] = 5; + modulo11[5] = 4; + modulo11[6] = 3; + modulo11[7] = 2; + for (int i = 0; i < 8; i++) { + verif = verif.add(new BigDecimal(ruc.substring(i, + (i + 1))).multiply(new BigDecimal( + modulo11[i]))); + } + if (verif.doubleValue() % 11 == 0) + if (Integer.parseInt(ruc.substring(8, 9)) == 0) + result = true; + else + result = false; + else if ((11 - (verif.doubleValue() % 11)) == Integer + .parseInt(ruc.substring(8, 9))) + result = true; + else + result = false; + } + } else if (Integer.parseInt(ruc.substring(2, 3)) < 6 + && Integer.parseInt(ruc.substring(2, 3)) >= 0) { // personas naturales + + if (!ruc.substring(10, 13).equals("001")) + result = false; + else { + result = cedula(ruc.substring(0, 10)); + } + } + } + } + return result; + } +} diff --git a/base/business/person/src/main/java/com/fp/person/validate/ValidateIdentification.java b/base/business/person/src/main/java/com/fp/person/validate/ValidateIdentification.java new file mode 100644 index 0000000..799e894 --- /dev/null +++ b/base/business/person/src/main/java/com/fp/person/validate/ValidateIdentification.java @@ -0,0 +1,144 @@ +package com.fp.person.validate; + +import java.math.BigDecimal; + +/** + * Clase para validar la cédula y el RUC de una persona + * @author BPTWPA + * @version 2.1 + */ +public class ValidateIdentification { + /** + * Método para validar la cédula + * + * @param id Número de la cédula + * @return result Retorna V/F según la validez de la cédula + */ + public static boolean cedula(String id) { + + boolean result = true; + + int[] modulo9 = { 2, 1, 2, 1, 2, 1, 2, 1, 2 }; + + BigDecimal verif = new BigDecimal(0); + if (id.length() != 10) + result = false; + else { + for (int i = 0; i < 9; i++) { + BigDecimal temp = new BigDecimal(new BigDecimal(id.substring(i, (i + 1))).multiply(new BigDecimal(modulo9[i])).toString()); + if (temp.doubleValue() > 9){ + temp = temp.subtract(new BigDecimal("9")); + } + verif = verif.add(temp); + } + if (verif.doubleValue() % 10 == 0){ + if (Integer.parseInt(id.substring(9, 10)) == 0){ + result = true; + } else{ + result = false; + } + } else if ((10 - (verif.doubleValue() % 10)) == Integer.parseInt(id.substring(9, 10))){ + result = true; + } else { + result = false; + } + } + return result; + } + + /** + * Método para validar el Ruc + * + * @param ruc Número del Ruc + * @return Retorna V/F según la validez del Ruc + */ + public static boolean ruc(String ruc) { + + boolean result = true; + + int[] modulo11 = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + + BigDecimal verif = new BigDecimal(0); + if (ruc.length() < 13) + result = false; + else if (Integer.parseInt(ruc.substring(0, 2)) < 1 + || Integer.parseInt(ruc.substring(0, 2)) > 22) { + result = false; + } else { + if (Integer.parseInt(ruc.substring(2, 3)) < 0 + || (Integer.parseInt(ruc.substring(2, 3)) > 6 && Integer + .parseInt(ruc.substring(2, 3)) < 9)) { + result = false; + } else { + if (Integer.parseInt(ruc.substring(2, 3)) == 9) { // sociedad privada o extranjeros + if (!ruc.substring(10, 13).equals("001")) + result = false; + else { + modulo11[0] = 4; + modulo11[1] = 3; + modulo11[2] = 2; + modulo11[3] = 7; + modulo11[4] = 6; + modulo11[5] = 5; + modulo11[6] = 4; + modulo11[7] = 3; + modulo11[8] = 2; + for (int i = 0; i < 9; i++) { + verif = verif.add(new BigDecimal(ruc.substring(i, + (i + 1))).multiply(new BigDecimal( + modulo11[i]))); + } + if (verif.doubleValue() % 11 == 0) + if (Integer.parseInt(ruc.substring(9, 10)) == 0) + result = true; + else + result = false; + else if ((11 - (verif.doubleValue() % 11)) == Integer + .parseInt(ruc.substring(9, 10))) + result = true; + else + result = false; + } + } else if (Integer.parseInt(ruc.substring(2, 3)) == 6) { // sociedad pblicas + + if (!ruc.substring(10, 13).equals("001")) + result = false; + else { + modulo11[0] = 3; + modulo11[1] = 2; + modulo11[2] = 7; + modulo11[3] = 6; + modulo11[4] = 5; + modulo11[5] = 4; + modulo11[6] = 3; + modulo11[7] = 2; + for (int i = 0; i < 8; i++) { + verif = verif.add(new BigDecimal(ruc.substring(i, + (i + 1))).multiply(new BigDecimal( + modulo11[i]))); + } + if (verif.doubleValue() % 11 == 0) + if (Integer.parseInt(ruc.substring(8, 9)) == 0) + result = true; + else + result = false; + else if ((11 - (verif.doubleValue() % 11)) == Integer + .parseInt(ruc.substring(8, 9))) + result = true; + else + result = false; + } + } else if (Integer.parseInt(ruc.substring(2, 3)) < 6 + && Integer.parseInt(ruc.substring(2, 3)) >= 0) { // personas naturales + + if (!ruc.substring(10, 13).equals("001")) + result = false; + else { + result = cedula(ruc.substring(0, 10)); + } + } + } + } + return result; + } +} diff --git a/base/business/person/src/main/resources/.svn/entries b/base/business/person/src/main/resources/.svn/entries new file mode 100644 index 0000000..87b3faa --- /dev/null +++ b/base/business/person/src/main/resources/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/person/src/main/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +personmessages_es.properties +file + + + + +2022-07-28T03:40:42.152800Z +4db10bff3a83d02c86220556e4bac0dc +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +810 + diff --git a/base/business/person/src/main/resources/.svn/text-base/personmessages_es.properties.svn-base b/base/business/person/src/main/resources/.svn/text-base/personmessages_es.properties.svn-base new file mode 100644 index 0000000..bab0cfc --- /dev/null +++ b/base/business/person/src/main/resources/.svn/text-base/personmessages_es.properties.svn-base @@ -0,0 +1,12 @@ +CUST-0001=PERSONA NO DEFINIDA EN TCUSTPERSONDETAIL: PERSONCODE:{0} +CUST-0002=LA PERSONA SE ENCUENTRA REGISTRADA EN LA TABLA DE CONSEP CONSEP - SINDICADO, NO SE PUEDE REGISTRAR EL CLIENTE" +CUST-0003=LA PERSONA SE ENCUENTRA REGISTRADA EN LA TABLA DE CONSEP CONSEP - HOM\u00D3NIMO, NO SE REGISTRO EL CLIENTE +CUST-0004=El ARCHIVO NO ES EL CORRECTO - BG +CUST-0005=El ARCHIVO NO ES EL CORRECTO - BG(IFIS) +CUST-0006=EXTENSI\u00D2N INCORRECTA DEL ARCHIVO +CUST-0007=LOS TIPOS DE ARCHIVOS PERMITIDOS SON JPG, GIF Y PNG +CUST-0008=NO SE PUEDE CAMBIAR LA IDENTIFICACI\u00D3N YA QUE ESTA SE ENCUENTRA COMO SINDICADA +CUST-0009=ARCHIVO NO CUMPLE CON FORMATO REQUERIDO +CUST-0010=NO SE PUEDE ELIMINAR LA DIRECCI\u00D3N PORQUE SE ENCUENTRA ASOCIADA +CUST-0013=C\u00C9DULA NO V\u00C1LIDA +CUST-0014=RUC NO V\u00C1LIDO \ No newline at end of file diff --git a/base/business/person/src/main/resources/personmessages_es.properties b/base/business/person/src/main/resources/personmessages_es.properties new file mode 100644 index 0000000..bab0cfc --- /dev/null +++ b/base/business/person/src/main/resources/personmessages_es.properties @@ -0,0 +1,12 @@ +CUST-0001=PERSONA NO DEFINIDA EN TCUSTPERSONDETAIL: PERSONCODE:{0} +CUST-0002=LA PERSONA SE ENCUENTRA REGISTRADA EN LA TABLA DE CONSEP CONSEP - SINDICADO, NO SE PUEDE REGISTRAR EL CLIENTE" +CUST-0003=LA PERSONA SE ENCUENTRA REGISTRADA EN LA TABLA DE CONSEP CONSEP - HOM\u00D3NIMO, NO SE REGISTRO EL CLIENTE +CUST-0004=El ARCHIVO NO ES EL CORRECTO - BG +CUST-0005=El ARCHIVO NO ES EL CORRECTO - BG(IFIS) +CUST-0006=EXTENSI\u00D2N INCORRECTA DEL ARCHIVO +CUST-0007=LOS TIPOS DE ARCHIVOS PERMITIDOS SON JPG, GIF Y PNG +CUST-0008=NO SE PUEDE CAMBIAR LA IDENTIFICACI\u00D3N YA QUE ESTA SE ENCUENTRA COMO SINDICADA +CUST-0009=ARCHIVO NO CUMPLE CON FORMATO REQUERIDO +CUST-0010=NO SE PUEDE ELIMINAR LA DIRECCI\u00D3N PORQUE SE ENCUENTRA ASOCIADA +CUST-0013=C\u00C9DULA NO V\u00C1LIDA +CUST-0014=RUC NO V\u00C1LIDO \ No newline at end of file diff --git a/base/business/person/src/test/.svn/entries b/base/business/person/src/test/.svn/entries new file mode 100644 index 0000000..820f7e6 --- /dev/null +++ b/base/business/person/src/test/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/person/src/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/business/person/src/test/java/.svn/entries b/base/business/person/src/test/java/.svn/entries new file mode 100644 index 0000000..ecba98b --- /dev/null +++ b/base/business/person/src/test/java/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/person/src/test/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/business/person/src/test/resources/.svn/entries b/base/business/person/src/test/resources/.svn/entries new file mode 100644 index 0000000..980d4db --- /dev/null +++ b/base/business/person/src/test/resources/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/person/src/test/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/business/person/target/classes/com/fp/person/db/DataHelper.class b/base/business/person/target/classes/com/fp/person/db/DataHelper.class new file mode 100644 index 0000000..0f08f14 Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/db/DataHelper.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/query/ActivityEconomic.class b/base/business/person/target/classes/com/fp/person/rules/query/ActivityEconomic.class new file mode 100644 index 0000000..ad345b4 Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/query/ActivityEconomic.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/query/CountryProvinceCity.class b/base/business/person/target/classes/com/fp/person/rules/query/CountryProvinceCity.class new file mode 100644 index 0000000..84a8d28 Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/query/CountryProvinceCity.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/query/DirectionFull.class b/base/business/person/target/classes/com/fp/person/rules/query/DirectionFull.class new file mode 100644 index 0000000..8bfc58f Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/query/DirectionFull.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/query/PersonName.class b/base/business/person/target/classes/com/fp/person/rules/query/PersonName.class new file mode 100644 index 0000000..4d7a697 Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/query/PersonName.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/query/PhonesPerClient.class b/base/business/person/target/classes/com/fp/person/rules/query/PhonesPerClient.class new file mode 100644 index 0000000..4a7bb98 Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/query/PhonesPerClient.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/query/code/AddressSequence.class b/base/business/person/target/classes/com/fp/person/rules/query/code/AddressSequence.class new file mode 100644 index 0000000..c78cb94 Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/query/code/AddressSequence.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/query/code/LovFinancialInstitutions.class b/base/business/person/target/classes/com/fp/person/rules/query/code/LovFinancialInstitutions.class new file mode 100644 index 0000000..3e80648 Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/query/code/LovFinancialInstitutions.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/query/code/PercentageStockholder.class b/base/business/person/target/classes/com/fp/person/rules/query/code/PercentageStockholder.class new file mode 100644 index 0000000..470aac2 Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/query/code/PercentageStockholder.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/query/code/ValidationAddress.class b/base/business/person/target/classes/com/fp/person/rules/query/code/ValidationAddress.class new file mode 100644 index 0000000..dec7a2e Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/query/code/ValidationAddress.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/query/code/VerifyManagers.class b/base/business/person/target/classes/com/fp/person/rules/query/code/VerifyManagers.class new file mode 100644 index 0000000..cd80acd Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/query/code/VerifyManagers.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/query/code/sbs/EmployeeLov.class b/base/business/person/target/classes/com/fp/person/rules/query/code/sbs/EmployeeLov.class new file mode 100644 index 0000000..0981e19 Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/query/code/sbs/EmployeeLov.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/save/CompleteCompanyCode.class b/base/business/person/target/classes/com/fp/person/rules/save/CompleteCompanyCode.class new file mode 100644 index 0000000..fe70ac1 Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/save/CompleteCompanyCode.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/save/CompleteHistoryActivity.class b/base/business/person/target/classes/com/fp/person/rules/save/CompleteHistoryActivity.class new file mode 100644 index 0000000..2f8e972 Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/save/CompleteHistoryActivity.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/save/CompletePersonAndCompany.class b/base/business/person/target/classes/com/fp/person/rules/save/CompletePersonAndCompany.class new file mode 100644 index 0000000..5169aea Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/save/CompletePersonAndCompany.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/save/CompletePersonCode.class b/base/business/person/target/classes/com/fp/person/rules/save/CompletePersonCode.class new file mode 100644 index 0000000..5c2758e Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/save/CompletePersonCode.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/save/FinancialSituation.class b/base/business/person/target/classes/com/fp/person/rules/save/FinancialSituation.class new file mode 100644 index 0000000..dcba36c Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/save/FinancialSituation.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/save/JuridicalPerson.class b/base/business/person/target/classes/com/fp/person/rules/save/JuridicalPerson.class new file mode 100644 index 0000000..dc646a5 Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/save/JuridicalPerson.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/save/LogoImage.class b/base/business/person/target/classes/com/fp/person/rules/save/LogoImage.class new file mode 100644 index 0000000..b42fd5d Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/save/LogoImage.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/save/PersonBalanceFile.class b/base/business/person/target/classes/com/fp/person/rules/save/PersonBalanceFile.class new file mode 100644 index 0000000..01a6c49 Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/save/PersonBalanceFile.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/save/PersonImage.class b/base/business/person/target/classes/com/fp/person/rules/save/PersonImage.class new file mode 100644 index 0000000..8872d71 Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/save/PersonImage.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/save/ValidateAddressPhones.class b/base/business/person/target/classes/com/fp/person/rules/save/ValidateAddressPhones.class new file mode 100644 index 0000000..0d65e73 Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/save/ValidateAddressPhones.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/save/VerifyInConsep.class b/base/business/person/target/classes/com/fp/person/rules/save/VerifyInConsep.class new file mode 100644 index 0000000..7a51bbc Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/save/VerifyInConsep.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/save/VerifyInConsepCompany.class b/base/business/person/target/classes/com/fp/person/rules/save/VerifyInConsepCompany.class new file mode 100644 index 0000000..d328449 Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/save/VerifyInConsepCompany.class differ diff --git a/base/business/person/target/classes/com/fp/person/rules/save/VerifyInConsepPerson.class b/base/business/person/target/classes/com/fp/person/rules/save/VerifyInConsepPerson.class new file mode 100644 index 0000000..3caeb77 Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/rules/save/VerifyInConsepPerson.class differ diff --git a/base/business/person/target/classes/com/fp/person/validate/ValidateIdentification.class b/base/business/person/target/classes/com/fp/person/validate/ValidateIdentification.class new file mode 100644 index 0000000..7cfcd64 Binary files /dev/null and b/base/business/person/target/classes/com/fp/person/validate/ValidateIdentification.class differ diff --git a/base/business/person/target/classes/personmessages_es.properties b/base/business/person/target/classes/personmessages_es.properties new file mode 100644 index 0000000..bab0cfc --- /dev/null +++ b/base/business/person/target/classes/personmessages_es.properties @@ -0,0 +1,12 @@ +CUST-0001=PERSONA NO DEFINIDA EN TCUSTPERSONDETAIL: PERSONCODE:{0} +CUST-0002=LA PERSONA SE ENCUENTRA REGISTRADA EN LA TABLA DE CONSEP CONSEP - SINDICADO, NO SE PUEDE REGISTRAR EL CLIENTE" +CUST-0003=LA PERSONA SE ENCUENTRA REGISTRADA EN LA TABLA DE CONSEP CONSEP - HOM\u00D3NIMO, NO SE REGISTRO EL CLIENTE +CUST-0004=El ARCHIVO NO ES EL CORRECTO - BG +CUST-0005=El ARCHIVO NO ES EL CORRECTO - BG(IFIS) +CUST-0006=EXTENSI\u00D2N INCORRECTA DEL ARCHIVO +CUST-0007=LOS TIPOS DE ARCHIVOS PERMITIDOS SON JPG, GIF Y PNG +CUST-0008=NO SE PUEDE CAMBIAR LA IDENTIFICACI\u00D3N YA QUE ESTA SE ENCUENTRA COMO SINDICADA +CUST-0009=ARCHIVO NO CUMPLE CON FORMATO REQUERIDO +CUST-0010=NO SE PUEDE ELIMINAR LA DIRECCI\u00D3N PORQUE SE ENCUENTRA ASOCIADA +CUST-0013=C\u00C9DULA NO V\u00C1LIDA +CUST-0014=RUC NO V\u00C1LIDO \ No newline at end of file diff --git a/base/business/person/target/maven-archiver/pom.properties b/base/business/person/target/maven-archiver/pom.properties new file mode 100644 index 0000000..ccde666 --- /dev/null +++ b/base/business/person/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:53:12 ECT 2022 +version=2.1 +groupId=com.fp.base.business +artifactId=person diff --git a/base/business/person/target/person-2.1.jar b/base/business/person/target/person-2.1.jar new file mode 100644 index 0000000..bfb1e31 Binary files /dev/null and b/base/business/person/target/person-2.1.jar differ diff --git a/base/business/pom.xml b/base/business/pom.xml new file mode 100644 index 0000000..83970b0 --- /dev/null +++ b/base/business/pom.xml @@ -0,0 +1,72 @@ + + + + base + com.fp + 2.1 + + 4.0.0 + com.fp.base + business + flipbean + 2.1 + pom + Financial Lifecycle Process + + general + person + report + log + viaticos + armas + + + + com.fp.base.dto + dto + 2.1 + provided + + + com.fp.base.dto + common + 2.1 + provided + + + com.fp.base.persistence + util + 2.1 + provided + + + log4j + log4j + provided + + + com.fp.base.core + bpm + 2.1 + provided + + + + org.jboss.spec.javax.ejb + jboss-ejb-api_3.1_spec + + + org.hibernate + hibernate-core + + + org.hibernate + hibernate-entitymanager + + + org.jbpm + jbpm-human-task-core + provided + + + \ No newline at end of file diff --git a/base/business/report/.svn/dir-prop-base b/base/business/report/.svn/dir-prop-base new file mode 100644 index 0000000..40820ff --- /dev/null +++ b/base/business/report/.svn/dir-prop-base @@ -0,0 +1,6 @@ +K 10 +svn:ignore +V 7 +target + +END diff --git a/base/business/report/.svn/entries b/base/business/report/.svn/entries new file mode 100644 index 0000000..8686096 --- /dev/null +++ b/base/business/report/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/report +svn://172.17.26.185/COMACO + + + +2014-10-17T05:32:00.734115Z +1669 +jvaca +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:43.039804Z +09efa4216cc11c6f20d4cbaec31cd42f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +587 + diff --git a/base/business/report/.svn/text-base/pom.xml.svn-base b/base/business/report/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..3389071 --- /dev/null +++ b/base/business/report/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,16 @@ + + + + business + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.business + report + report + 2.1 + \ No newline at end of file diff --git a/base/business/report/pom.xml b/base/business/report/pom.xml new file mode 100644 index 0000000..3389071 --- /dev/null +++ b/base/business/report/pom.xml @@ -0,0 +1,16 @@ + + + + business + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.business + report + report + 2.1 + \ No newline at end of file diff --git a/base/business/report/src/.svn/entries b/base/business/report/src/.svn/entries new file mode 100644 index 0000000..a8b0a4d --- /dev/null +++ b/base/business/report/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/report/src +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/base/business/report/src/main/.svn/entries b/base/business/report/src/main/.svn/entries new file mode 100644 index 0000000..21b994f --- /dev/null +++ b/base/business/report/src/main/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/report/src/main +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/business/report/src/main/java/.svn/entries b/base/business/report/src/main/java/.svn/entries new file mode 100644 index 0000000..f87c9cc --- /dev/null +++ b/base/business/report/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/report/src/main/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/business/report/src/main/java/com/.svn/entries b/base/business/report/src/main/java/com/.svn/entries new file mode 100644 index 0000000..85bdb19 --- /dev/null +++ b/base/business/report/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/report/src/main/java/com +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/business/report/src/main/java/com/fp/.svn/entries b/base/business/report/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..d046ea0 --- /dev/null +++ b/base/business/report/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/report/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +report +dir + diff --git a/base/business/report/src/main/java/com/fp/report/.svn/entries b/base/business/report/src/main/java/com/fp/report/.svn/entries new file mode 100644 index 0000000..c79b794 --- /dev/null +++ b/base/business/report/src/main/java/com/fp/report/.svn/entries @@ -0,0 +1,40 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/report/src/main/java/com/fp/report +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +db +dir + +query +dir + +rules +dir + +util +dir + diff --git a/base/business/report/src/main/java/com/fp/report/db/.svn/entries b/base/business/report/src/main/java/com/fp/report/db/.svn/entries new file mode 100644 index 0000000..9281a88 --- /dev/null +++ b/base/business/report/src/main/java/com/fp/report/db/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/report/src/main/java/com/fp/report/db +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +DataHelper.java +file + + + + +2022-07-28T03:40:42.516802Z +07be0dc7dc2017748fcd6ad8dde6c816 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +625 + +SQLUtil.java +file + + + + +2022-07-28T03:40:42.516802Z +cda5c2fa3ad281abf183c2046eac9230 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1150 + diff --git a/base/business/report/src/main/java/com/fp/report/db/.svn/text-base/DataHelper.java.svn-base b/base/business/report/src/main/java/com/fp/report/db/.svn/text-base/DataHelper.java.svn-base new file mode 100644 index 0000000..8fc067f --- /dev/null +++ b/base/business/report/src/main/java/com/fp/report/db/.svn/text-base/DataHelper.java.svn-base @@ -0,0 +1,29 @@ +package com.fp.report.db; + +/** + * Clase utilitaria que maneje sql y hql utiliada en el proyecto accounting + * @author scastillo + */ +public class DataHelper { + + /** + * Almacena una instancia de DataHelper. + */ + private static DataHelper cache; + + /** + * Entrega una instancia de DataHelper. + * @return DataHelper + */ + public static DataHelper getInstance() { + if (cache != null) { + return cache; + } + synchronized (DataHelper.class) { + if (cache == null) { + cache = new DataHelper(); + } + } + return cache; + } +} diff --git a/base/business/report/src/main/java/com/fp/report/db/.svn/text-base/SQLUtil.java.svn-base b/base/business/report/src/main/java/com/fp/report/db/.svn/text-base/SQLUtil.java.svn-base new file mode 100644 index 0000000..23b5a54 --- /dev/null +++ b/base/business/report/src/main/java/com/fp/report/db/.svn/text-base/SQLUtil.java.svn-base @@ -0,0 +1,38 @@ +package com.fp.report.db; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.ArrayList; +import java.util.List; + +public class SQLUtil { + public static Object execute(Connection pCon, String pSQL, Object[] pParams) throws Exception { + ArrayList a; + PreparedStatement pst = pCon.prepareStatement(pSQL); + ResultSet rst = null; + try { + if (pParams != null) { + for (int i = 0; i < pParams.length; i++) { + Object object = pParams[i]; + pst.setObject(i + 1, object); + } + } + rst = pst.executeQuery(); + return (rst.next()) ? rst.getObject(1) : null; + } finally { + if (rst != null) { + rst.close(); + } + if (pst != null) { + pst.close(); + } + } + } + + public static List prepareParameter(List pData, Object newParam) { + List data = (pData == null) ? new ArrayList() : pData; + data.add(newParam); + return data; + } +} diff --git a/base/business/report/src/main/java/com/fp/report/db/DataHelper.java b/base/business/report/src/main/java/com/fp/report/db/DataHelper.java new file mode 100644 index 0000000..8fc067f --- /dev/null +++ b/base/business/report/src/main/java/com/fp/report/db/DataHelper.java @@ -0,0 +1,29 @@ +package com.fp.report.db; + +/** + * Clase utilitaria que maneje sql y hql utiliada en el proyecto accounting + * @author scastillo + */ +public class DataHelper { + + /** + * Almacena una instancia de DataHelper. + */ + private static DataHelper cache; + + /** + * Entrega una instancia de DataHelper. + * @return DataHelper + */ + public static DataHelper getInstance() { + if (cache != null) { + return cache; + } + synchronized (DataHelper.class) { + if (cache == null) { + cache = new DataHelper(); + } + } + return cache; + } +} diff --git a/base/business/report/src/main/java/com/fp/report/db/SQLUtil.java b/base/business/report/src/main/java/com/fp/report/db/SQLUtil.java new file mode 100644 index 0000000..23b5a54 --- /dev/null +++ b/base/business/report/src/main/java/com/fp/report/db/SQLUtil.java @@ -0,0 +1,38 @@ +package com.fp.report.db; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.ArrayList; +import java.util.List; + +public class SQLUtil { + public static Object execute(Connection pCon, String pSQL, Object[] pParams) throws Exception { + ArrayList a; + PreparedStatement pst = pCon.prepareStatement(pSQL); + ResultSet rst = null; + try { + if (pParams != null) { + for (int i = 0; i < pParams.length; i++) { + Object object = pParams[i]; + pst.setObject(i + 1, object); + } + } + rst = pst.executeQuery(); + return (rst.next()) ? rst.getObject(1) : null; + } finally { + if (rst != null) { + rst.close(); + } + if (pst != null) { + pst.close(); + } + } + } + + public static List prepareParameter(List pData, Object newParam) { + List data = (pData == null) ? new ArrayList() : pData; + data.add(newParam); + return data; + } +} diff --git a/base/business/report/src/main/java/com/fp/report/query/.svn/entries b/base/business/report/src/main/java/com/fp/report/query/.svn/entries new file mode 100644 index 0000000..37b6510 --- /dev/null +++ b/base/business/report/src/main/java/com/fp/report/query/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/report/src/main/java/com/fp/report/query +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/business/report/src/main/java/com/fp/report/rules/.svn/entries b/base/business/report/src/main/java/com/fp/report/rules/.svn/entries new file mode 100644 index 0000000..05b6d0b --- /dev/null +++ b/base/business/report/src/main/java/com/fp/report/rules/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/report/src/main/java/com/fp/report/rules +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +query +dir + +save +dir + diff --git a/base/business/report/src/main/java/com/fp/report/rules/query/.svn/entries b/base/business/report/src/main/java/com/fp/report/rules/query/.svn/entries new file mode 100644 index 0000000..aab94d2 --- /dev/null +++ b/base/business/report/src/main/java/com/fp/report/rules/query/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/report/src/main/java/com/fp/report/rules/query +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/business/report/src/main/java/com/fp/report/rules/save/.svn/entries b/base/business/report/src/main/java/com/fp/report/rules/save/.svn/entries new file mode 100644 index 0000000..87affad --- /dev/null +++ b/base/business/report/src/main/java/com/fp/report/rules/save/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/report/src/main/java/com/fp/report/rules/save +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/business/report/src/main/java/com/fp/report/util/.svn/entries b/base/business/report/src/main/java/com/fp/report/util/.svn/entries new file mode 100644 index 0000000..e3649a3 --- /dev/null +++ b/base/business/report/src/main/java/com/fp/report/util/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/report/src/main/java/com/fp/report/util +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +Utilities.java +file + + + + +2022-07-28T03:40:42.704803Z +8dc1d4f814ab10c325eb36dfc0eacbae +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5218 + diff --git a/base/business/report/src/main/java/com/fp/report/util/.svn/text-base/Utilities.java.svn-base b/base/business/report/src/main/java/com/fp/report/util/.svn/text-base/Utilities.java.svn-base new file mode 100644 index 0000000..6d3bdef --- /dev/null +++ b/base/business/report/src/main/java/com/fp/report/util/.svn/text-base/Utilities.java.svn-base @@ -0,0 +1,213 @@ +package com.fp.report.util; + +import java.io.BufferedReader; +import java.io.IOException; +import java.math.BigDecimal; +import java.sql.Clob; +import java.sql.SQLException; +import java.text.DecimalFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.GregorianCalendar; + +import org.apache.commons.lang.StringUtils; + +/** + * Clase que se encarga de ofrecer utilidades para ser utilizadas por iReports + * + * @author scastillo + */ +public class Utilities { + + /** + * Formato ISO + */ + private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat( + "yyyy-MM-dd"); + /** + * + */ + private static GregorianCalendar gregorianCalendar = new GregorianCalendar(); + + /** + * Constructor por defecto de la clase + */ + public Utilities() { + } + + /** + * Metodo que devuelve la fecha de expiracion para manejo de reportes + * + * @return java.util.Date + */ + public static java.util.Date getDefaultExpiryDate() { + java.util.Date date = null; + try { + date = Utilities.simpleDateFormat.parse("2999-12-31"); + } catch (ParseException ex) { + return null; + } + return date; + } + + /** + * Mtodo que devuelve la fecha de expiracion para manejo de reportes + * + * @return java.sql.Timestamp + */ + public static java.sql.Timestamp getDefaultExpiryTimestamp() { + return java.sql.Timestamp.valueOf("2999-12-31 00:00:00.000"); + } + + /** + * Metodo que se encarga de devolver + * + * @param pDate + * String que contiene la fecha en formato yyyy-MM-dd + * @return java.util.Date + */ + public static java.util.Date StringToDate(String pDate) { + java.util.Date date = null; + try { + date = Utilities.simpleDateFormat.parse(pDate); + } catch (ParseException ex) { + return null; + } + return date; + } + + /** + * Metodo que agrega dias en una fecha + * + * @param pDate + * Fecha en formato yyyy-MM-dd + * @param daysnumber + * Nmero de dias a sumar o restar + * @return + */ + public static java.util.Date addDays(String pDate, int daysnumber) { + try { + java.util.Date date = Utilities.simpleDateFormat.parse(pDate); + Utilities.gregorianCalendar.setTime(date); + Utilities.gregorianCalendar.add(Calendar.DAY_OF_YEAR, daysnumber); + return new java.util.Date(Utilities.gregorianCalendar.getTime() + .getTime()); + } catch (ParseException ex) { + return null; + } + } + + /** + * Metodo que suma/resta meses a una fecha + * + * @param pDate + * Fecha en formato yyyy-MM-dd + * @param Monthsnumber + * Nmero de mese a sumar o restar. Si se resta enviar un nmero + * entero negativo + * @return + */ + public static java.util.Date addMonths(String pDate, int Monthsnumber) { + try { + java.util.Date date = Utilities.simpleDateFormat.parse(pDate); + Utilities.gregorianCalendar.setTime(date); + Utilities.gregorianCalendar.add(Calendar.MONTH, Monthsnumber); + return new java.util.Date(Utilities.gregorianCalendar.getTime() + .getTime()); + } catch (ParseException ex) { + return null; + } + } + + /** + * Metodo que convierte un clob a string + * + * @param clb + * Clob a convertir + * @return + */ + public static String clobToString(Clob clb) { + if (clb == null) { + return null; + } + StringBuilder str = new StringBuilder(); + String strng; + BufferedReader bufferRead; + try { + bufferRead = new BufferedReader(clb.getCharacterStream()); + } catch (SQLException ex) { + return null; + } + try { + while ((strng = bufferRead.readLine()) != null) { + str.append(strng); + } + } catch (IOException ex) { + return null; + } + return str.toString(); + } + + /** + * Metodo que devuelve la particion + * + * @param pDate + * @return + */ + public static String getPartition(String pDate) { + if ((pDate != null) && (pDate.compareTo("") != 0)) { + pDate = pDate.replaceAll("\\-", ""); + pDate = pDate.substring(0, 6); + return pDate; + } else { + return null; + } + } + + public static String lpad(String pData, char pFiller, int pLength) { + return StringUtils.leftPad(pData, pLength, pFiller); + } + + public static String rpad(String pData, char pFiller, int pLength) { + String st = ""; + if (pData.length() > pLength) { + st = pData.substring(0, pLength); + } else { + st = StringUtils.rightPad(pData, pLength, pFiller); + } + return st; + } + + public static String removeCurrencySeparatorsSymbol(BigDecimal pData, + int pLengthDecimal) { + BigDecimal value = pData.setScale(pLengthDecimal, + BigDecimal.ROUND_HALF_UP); + + return value.toString().replaceAll("\\.", "").replaceAll("\\,", ""); + } + + public static String formatCurrency(BigDecimal pData, String format) { + DecimalFormat frmt = new DecimalFormat(format); + String formatted = frmt.format(pData.doubleValue()); + + return formatted; + } + + public static String getFormatedDate(java.util.Date pDate, String format) { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format); + String date = null; + date = simpleDateFormat.format(pDate); + return date; + + } + + public static String getFormatedDate(java.sql.Date pDate, String format) { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format); + String date = null; + date = simpleDateFormat.format(pDate); + return date; + + } + +} diff --git a/base/business/report/src/main/java/com/fp/report/util/Utilities.java b/base/business/report/src/main/java/com/fp/report/util/Utilities.java new file mode 100644 index 0000000..6d3bdef --- /dev/null +++ b/base/business/report/src/main/java/com/fp/report/util/Utilities.java @@ -0,0 +1,213 @@ +package com.fp.report.util; + +import java.io.BufferedReader; +import java.io.IOException; +import java.math.BigDecimal; +import java.sql.Clob; +import java.sql.SQLException; +import java.text.DecimalFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.GregorianCalendar; + +import org.apache.commons.lang.StringUtils; + +/** + * Clase que se encarga de ofrecer utilidades para ser utilizadas por iReports + * + * @author scastillo + */ +public class Utilities { + + /** + * Formato ISO + */ + private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat( + "yyyy-MM-dd"); + /** + * + */ + private static GregorianCalendar gregorianCalendar = new GregorianCalendar(); + + /** + * Constructor por defecto de la clase + */ + public Utilities() { + } + + /** + * Metodo que devuelve la fecha de expiracion para manejo de reportes + * + * @return java.util.Date + */ + public static java.util.Date getDefaultExpiryDate() { + java.util.Date date = null; + try { + date = Utilities.simpleDateFormat.parse("2999-12-31"); + } catch (ParseException ex) { + return null; + } + return date; + } + + /** + * Mtodo que devuelve la fecha de expiracion para manejo de reportes + * + * @return java.sql.Timestamp + */ + public static java.sql.Timestamp getDefaultExpiryTimestamp() { + return java.sql.Timestamp.valueOf("2999-12-31 00:00:00.000"); + } + + /** + * Metodo que se encarga de devolver + * + * @param pDate + * String que contiene la fecha en formato yyyy-MM-dd + * @return java.util.Date + */ + public static java.util.Date StringToDate(String pDate) { + java.util.Date date = null; + try { + date = Utilities.simpleDateFormat.parse(pDate); + } catch (ParseException ex) { + return null; + } + return date; + } + + /** + * Metodo que agrega dias en una fecha + * + * @param pDate + * Fecha en formato yyyy-MM-dd + * @param daysnumber + * Nmero de dias a sumar o restar + * @return + */ + public static java.util.Date addDays(String pDate, int daysnumber) { + try { + java.util.Date date = Utilities.simpleDateFormat.parse(pDate); + Utilities.gregorianCalendar.setTime(date); + Utilities.gregorianCalendar.add(Calendar.DAY_OF_YEAR, daysnumber); + return new java.util.Date(Utilities.gregorianCalendar.getTime() + .getTime()); + } catch (ParseException ex) { + return null; + } + } + + /** + * Metodo que suma/resta meses a una fecha + * + * @param pDate + * Fecha en formato yyyy-MM-dd + * @param Monthsnumber + * Nmero de mese a sumar o restar. Si se resta enviar un nmero + * entero negativo + * @return + */ + public static java.util.Date addMonths(String pDate, int Monthsnumber) { + try { + java.util.Date date = Utilities.simpleDateFormat.parse(pDate); + Utilities.gregorianCalendar.setTime(date); + Utilities.gregorianCalendar.add(Calendar.MONTH, Monthsnumber); + return new java.util.Date(Utilities.gregorianCalendar.getTime() + .getTime()); + } catch (ParseException ex) { + return null; + } + } + + /** + * Metodo que convierte un clob a string + * + * @param clb + * Clob a convertir + * @return + */ + public static String clobToString(Clob clb) { + if (clb == null) { + return null; + } + StringBuilder str = new StringBuilder(); + String strng; + BufferedReader bufferRead; + try { + bufferRead = new BufferedReader(clb.getCharacterStream()); + } catch (SQLException ex) { + return null; + } + try { + while ((strng = bufferRead.readLine()) != null) { + str.append(strng); + } + } catch (IOException ex) { + return null; + } + return str.toString(); + } + + /** + * Metodo que devuelve la particion + * + * @param pDate + * @return + */ + public static String getPartition(String pDate) { + if ((pDate != null) && (pDate.compareTo("") != 0)) { + pDate = pDate.replaceAll("\\-", ""); + pDate = pDate.substring(0, 6); + return pDate; + } else { + return null; + } + } + + public static String lpad(String pData, char pFiller, int pLength) { + return StringUtils.leftPad(pData, pLength, pFiller); + } + + public static String rpad(String pData, char pFiller, int pLength) { + String st = ""; + if (pData.length() > pLength) { + st = pData.substring(0, pLength); + } else { + st = StringUtils.rightPad(pData, pLength, pFiller); + } + return st; + } + + public static String removeCurrencySeparatorsSymbol(BigDecimal pData, + int pLengthDecimal) { + BigDecimal value = pData.setScale(pLengthDecimal, + BigDecimal.ROUND_HALF_UP); + + return value.toString().replaceAll("\\.", "").replaceAll("\\,", ""); + } + + public static String formatCurrency(BigDecimal pData, String format) { + DecimalFormat frmt = new DecimalFormat(format); + String formatted = frmt.format(pData.doubleValue()); + + return formatted; + } + + public static String getFormatedDate(java.util.Date pDate, String format) { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format); + String date = null; + date = simpleDateFormat.format(pDate); + return date; + + } + + public static String getFormatedDate(java.sql.Date pDate, String format) { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format); + String date = null; + date = simpleDateFormat.format(pDate); + return date; + + } + +} diff --git a/base/business/report/src/main/resources/.svn/entries b/base/business/report/src/main/resources/.svn/entries new file mode 100644 index 0000000..b989421 --- /dev/null +++ b/base/business/report/src/main/resources/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/report/src/main/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/business/report/src/test/.svn/entries b/base/business/report/src/test/.svn/entries new file mode 100644 index 0000000..f436a6d --- /dev/null +++ b/base/business/report/src/test/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/report/src/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/business/report/src/test/java/.svn/entries b/base/business/report/src/test/java/.svn/entries new file mode 100644 index 0000000..fb1e6c4 --- /dev/null +++ b/base/business/report/src/test/java/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/report/src/test/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/business/report/src/test/resources/.svn/entries b/base/business/report/src/test/resources/.svn/entries new file mode 100644 index 0000000..7774de3 --- /dev/null +++ b/base/business/report/src/test/resources/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/report/src/test/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/business/report/target/classes/com/fp/report/db/DataHelper.class b/base/business/report/target/classes/com/fp/report/db/DataHelper.class new file mode 100644 index 0000000..20456f2 Binary files /dev/null and b/base/business/report/target/classes/com/fp/report/db/DataHelper.class differ diff --git a/base/business/report/target/classes/com/fp/report/db/SQLUtil.class b/base/business/report/target/classes/com/fp/report/db/SQLUtil.class new file mode 100644 index 0000000..b601bd1 Binary files /dev/null and b/base/business/report/target/classes/com/fp/report/db/SQLUtil.class differ diff --git a/base/business/report/target/classes/com/fp/report/util/Utilities.class b/base/business/report/target/classes/com/fp/report/util/Utilities.class new file mode 100644 index 0000000..ac70c7a Binary files /dev/null and b/base/business/report/target/classes/com/fp/report/util/Utilities.class differ diff --git a/base/business/report/target/maven-archiver/pom.properties b/base/business/report/target/maven-archiver/pom.properties new file mode 100644 index 0000000..5fcd972 --- /dev/null +++ b/base/business/report/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:53:16 ECT 2022 +version=2.1 +groupId=com.fp.base.business +artifactId=report diff --git a/base/business/report/target/report-2.1.jar b/base/business/report/target/report-2.1.jar new file mode 100644 index 0000000..9c79325 Binary files /dev/null and b/base/business/report/target/report-2.1.jar differ diff --git a/base/business/viaticos/.svn/dir-prop-base b/base/business/viaticos/.svn/dir-prop-base new file mode 100644 index 0000000..3e2a6f2 --- /dev/null +++ b/base/business/viaticos/.svn/dir-prop-base @@ -0,0 +1,9 @@ +K 10 +svn:ignore +V 37 +.classpath +.project +.settings +target + +END diff --git a/base/business/viaticos/.svn/entries b/base/business/viaticos/.svn/entries new file mode 100644 index 0000000..dc3ae7c --- /dev/null +++ b/base/business/viaticos/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos +svn://172.17.26.185/COMACO + + + +2015-06-23T07:17:36.315401Z +4128 +cpiedra +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:40.207792Z +d4e5da5eb2df5af4758fc822b4dd2830 +2014-09-11T07:02:10.090385Z +665 +jvaca + + + + + + + + + + + + + + + + + + + + + +1362 + diff --git a/base/business/viaticos/.svn/text-base/pom.xml.svn-base b/base/business/viaticos/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..e845f52 --- /dev/null +++ b/base/business/viaticos/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,46 @@ + + + 4.0.0 + + com.fp.base + business + 2.1 + + com.fp.base.business + viaticos + viaticos + + + com.fp.base.persistence + pviaticos + 2.1 + + + com.fp.base.core + bpm + 2.1 + + + com.fp.base.bpm + simple + 2.1 + + + com.fp.base.bpm + bpmlib + 2.1 + + + com.fp.base + sessionbeans + 2.1 + + + com.fp.base.persistence + pbpm + 2.1 + + + + diff --git a/base/business/viaticos/pom.xml b/base/business/viaticos/pom.xml new file mode 100644 index 0000000..e845f52 --- /dev/null +++ b/base/business/viaticos/pom.xml @@ -0,0 +1,46 @@ + + + 4.0.0 + + com.fp.base + business + 2.1 + + com.fp.base.business + viaticos + viaticos + + + com.fp.base.persistence + pviaticos + 2.1 + + + com.fp.base.core + bpm + 2.1 + + + com.fp.base.bpm + simple + 2.1 + + + com.fp.base.bpm + bpmlib + 2.1 + + + com.fp.base + sessionbeans + 2.1 + + + com.fp.base.persistence + pbpm + 2.1 + + + + diff --git a/base/business/viaticos/src/.svn/entries b/base/business/viaticos/src/.svn/entries new file mode 100644 index 0000000..ade6359 --- /dev/null +++ b/base/business/viaticos/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src +svn://172.17.26.185/COMACO + + + +2015-06-23T07:17:36.315401Z +4128 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/base/business/viaticos/src/main/.svn/entries b/base/business/viaticos/src/main/.svn/entries new file mode 100644 index 0000000..93ee238 --- /dev/null +++ b/base/business/viaticos/src/main/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main +svn://172.17.26.185/COMACO + + + +2015-06-23T07:17:36.315401Z +4128 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/business/viaticos/src/main/java/.svn/entries b/base/business/viaticos/src/main/java/.svn/entries new file mode 100644 index 0000000..515f206 --- /dev/null +++ b/base/business/viaticos/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main/java +svn://172.17.26.185/COMACO + + + +2015-06-23T07:17:36.315401Z +4128 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/business/viaticos/src/main/java/com/.svn/entries b/base/business/viaticos/src/main/java/com/.svn/entries new file mode 100644 index 0000000..dd25838 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main/java/com +svn://172.17.26.185/COMACO + + + +2015-06-23T07:17:36.315401Z +4128 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/business/viaticos/src/main/java/com/fp/.svn/entries b/base/business/viaticos/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..454ff0c --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2015-06-23T07:17:36.315401Z +4128 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +viaticos +dir + diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/.svn/entries b/base/business/viaticos/src/main/java/com/fp/viaticos/.svn/entries new file mode 100644 index 0000000..f173531 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/.svn/entries @@ -0,0 +1,37 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main/java/com/fp/viaticos +svn://172.17.26.185/COMACO + + + +2015-06-23T07:17:36.315401Z +4128 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +mail +dir + +task +dir + +rules +dir + diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/entries b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/entries new file mode 100644 index 0000000..e943d40 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/entries @@ -0,0 +1,439 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main/java/com/fp/viaticos/mail +svn://172.17.26.185/COMACO + + + +2014-09-11T07:01:34.572119Z +664 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +Grupos.java +file + + + + +2022-07-28T03:40:39.364788Z +c2cdeee7546504c17cd955329c4c3dfb +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1807 + +MailMasivo.java +file + + + + +2022-07-28T03:40:39.364788Z +800a0d9d052a87151bafa0a18ff2bdfc +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3366 + +ResponsableUnidad.java +file + + + + +2022-07-28T03:40:39.364788Z +a58cde142dd748f75b1467a63822e4ae +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1866 + +Movilizacion.java +file + + + + +2022-07-28T03:40:39.365788Z +f1c98157da919d5fa612d14c0e883322 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4060 + +EmpleadoyJefeyResponsableUnidad.java +file + + + + +2022-07-28T03:40:39.365788Z +e562df554f29f80e84b21078388876ec +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2263 + +Empleado.java +file + + + + +2022-07-28T03:40:39.365788Z +fd9ac2d980b9ffa26eb5c8d303d76629 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2038 + +thread +dir + +EmpleadoyJefe.java +file + + + + +2022-07-28T03:40:39.365788Z +4f0821b757d05acc7c0fd02f4dd5cc01 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1917 + +Jefe.java +file + + + + +2022-07-28T03:40:39.366788Z +c9320fa4e1c7263a2c73798a0480b92b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1802 + +Contabilidad.java +file + + + + +2022-07-28T03:40:39.366788Z +d0c3b5e1fb4157900063f33556bf0e0f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3059 + +Tesoreria.java +file + + + + +2022-07-28T03:40:39.366788Z +a76ad72d483ca5938718c0e84ff79b23 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3465 + +TalentoHumano.java +file + + + + +2022-07-28T03:40:39.366788Z +a97fa936f78de39b0fc57ae9ffbf9535 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3063 + +UsaurioIngresoSolicitud.java +file + + + + +2022-07-28T03:40:39.367788Z +39b45707b472d2fbf1bf4a22b49b10d4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2112 + diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/Contabilidad.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/Contabilidad.java.svn-base new file mode 100644 index 0000000..f6c2adf --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/Contabilidad.java.svn-base @@ -0,0 +1,78 @@ +package com.fp.viaticos.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.param.ViaCiudadUsuario; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.maia.MailRecipient; +import com.fp.viaticos.rules.exception.ViaticosException; + +/** + * Clase que se encarga de objener el email de un usuario asociado a contabilidad. + * + * @version 2.1 + */ +public class Contabilidad extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + List lemail = new ArrayList(); + Map mresp = new HashMap(); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return mresp; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado e = ejpql.find(vsol.getCod_empleado()); + + String usuario = this.getUsuario(e.getCodigoLocalidad(), "CONTABILIDAD"); + + // adiciona email del empleado. + lemail.add(ejpql.findPorUsuarioWeb(usuario.toLowerCase()).getEmail()); + + mresp.put("lemail", lemail); + return mresp; + } + + /** + * Busca en la tabla ViaCiudadUsuario, el codigo de usuario asociado a una localidad a la que pertence un + * funcionario de la SBS. + * + * @param ciudad Codigo de ciudad a obtener el usuario. + * @return String + * @throws Exception + */ + private String getUsuario(String ciudad, String actividad) throws Exception { + Query qry = PersistenceHelper.getEntityManager().createQuery( + "from ViaCiudadUsuario t where t.pk.cod_actividad_catalog = :actividad and t.pk.cod_ciudad_catalog = :ciudad "); + qry.setParameter("ciudad", ciudad); + qry.setParameter("actividad", actividad); + ViaCiudadUsuario obj = null; + try { + obj = (ViaCiudadUsuario) qry.getSingleResult(); + } catch (NoResultException e) { + throw new ViaticosException("VIA-0002", "USUARIO NO DEFINIDO EN VIA_CIUDAD_USUARIO CIUDAD: {0} ACTIVIDAD: {1} ", ciudad, actividad); + } + return obj.getCod_usuario(); + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/Empleado.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/Empleado.java.svn-base new file mode 100644 index 0000000..2ce36fd --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/Empleado.java.svn-base @@ -0,0 +1,57 @@ +package com.fp.viaticos.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.maia.MailRecipient; + +/** + * Clase que se encarga de objener el email de un empleado para enviar notificaciones. + * + * @version 2.1 + */ +public class Empleado extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + Map mresp = new HashMap(); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return mresp; + } + String csolicitud = (String) mrequest.get("csolicitud"); + mresp.put("lemail", this.getEmail(csolicitud, "S")); + return mresp; + } + + /** + * Entrega el email de un empleado, dado el codigo d solicitud y el tipo de solicitud. + * + * @param csolicitud Codigo de solicitud. + * @param tipo Tipo S solicitud, I informe. + * @return List + * @throws Exception + */ + public List getEmail(String csolicitud, String tipo) throws Exception { + List lemail = new ArrayList(); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(csolicitud, tipo)); + + EmpleadoJpql e = new EmpleadoJpql(); + // adiciona email del empleado. + lemail.add(e.find(vsol.getCod_empleado()).getEmail()); + return lemail; + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/EmpleadoyJefe.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/EmpleadoyJefe.java.svn-base new file mode 100644 index 0000000..1cd7878 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/EmpleadoyJefe.java.svn-base @@ -0,0 +1,53 @@ +package com.fp.viaticos.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.maia.MailRecipient; + +/** + * Clase que se encarga de objener el email de un empleado y jefe inmediato a enviar notificaciones. + * + * @version 2.1 + */ +public class EmpleadoyJefe extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + List lemail = new ArrayList(); + Map mresp = new HashMap(); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return mresp; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + String codigoJefe = vsol.getCod_jefe(); + + EmpleadoJpql e = new EmpleadoJpql(); + // adiciona email del empleado. + lemail.add(e.find(vsol.getCod_empleado()).getEmail()); + + if (codigoJefe == null) { + codigoJefe = e.find(vsol.getCod_empleado()).getCodigoJefe(); + } + // adiciona email del jefe del empleado. + lemail.add(e.find(codigoJefe).getEmail()); + mresp.put("lemail", lemail); + return mresp; + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/EmpleadoyJefeyResponsableUnidad.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/EmpleadoyJefeyResponsableUnidad.java.svn-base new file mode 100644 index 0000000..7a408ca --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/EmpleadoyJefeyResponsableUnidad.java.svn-base @@ -0,0 +1,60 @@ +package com.fp.viaticos.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.maia.MailRecipient; + +/** + * Clase que se encarga de objener el email de un empleado y jefe inmediato a enviar notificaciones. + * + * @version 2.1 + */ +public class EmpleadoyJefeyResponsableUnidad extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + List lemail = new ArrayList(); + Map mresp = new HashMap(); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return mresp; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + String codigoJefe = vsol.getCod_jefe(); + String codigoRespUnidad = vsol.getCod_responsable(); + + EmpleadoJpql e = new EmpleadoJpql(); + // adiciona email del empleado. + lemail.add(e.find(vsol.getCod_empleado()).getEmail()); + + if (codigoJefe == null) { + codigoJefe = e.find(vsol.getCod_empleado()).getCodigoJefe(); + } + if (codigoRespUnidad == null) { + codigoRespUnidad = e.find(vsol.getCod_empleado()).getCodigoResponsableUnidad(); + } + // adiciona email del jefe del empleado. + lemail.add(e.find(codigoJefe).getEmail()); + // Adiciona el email del jefe del servidor publico. + lemail.add(e.find(codigoRespUnidad).getEmail()); + + mresp.put("lemail", lemail); + return mresp; + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/Grupos.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/Grupos.java.svn-base new file mode 100644 index 0000000..220b0e4 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/Grupos.java.svn-base @@ -0,0 +1,55 @@ +package com.fp.viaticos.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pbpm.gene.TbpmGroupsUsers; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.simple.maia.MailRecipientGroup; + +/** + * Clase que se encarga de objener la lista de emails asociados a un grupo definod en TbpmGroupsUsers. + * + * @version 2.1 + */ +public class Grupos extends MailRecipientGroup { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipientGroup#getEmailAddress(java.lang.Object, java.lang.String) + */ + @Override + public Map getEmailAddress(Object pParam, String pGroupCode) throws Exception { + List lemail = new ArrayList(); + Map mresp = new HashMap(); + + List lgrupos = TbpmGroupsUsers.find(PersistenceHelper.getEntityManager(), pGroupCode); + for (TbpmGroupsUsers tbpmGroupsUsers : lgrupos) { + String email = this.getEmailPorUsuario(tbpmGroupsUsers.getPk().getUsercode()); + if (email != null) { + lemail.add(email); + } + } + mresp.put("lemail", lemail); + return mresp; + } + + /** + * Obtiene el email de un empleado de la sbs. + * + * @param cusuario Codigo de usaurio. + * @return String + * @throws Exception + */ + private String getEmailPorUsuario(String cusuario) throws Exception { + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado e = ejpql.findPorUsuarioWeb(cusuario); + return e.getEmail(); + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/Jefe.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/Jefe.java.svn-base new file mode 100644 index 0000000..ec880e9 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/Jefe.java.svn-base @@ -0,0 +1,51 @@ +package com.fp.viaticos.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.maia.MailRecipient; + +/** + * Clase que se encarga de objener el email de un jefe asociado a un empleado de la sbs. + * + * @version 2.1 + */ +public class Jefe extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + List lemail = new ArrayList(); + Map mresp = new HashMap(); + + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return mresp; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + String codigoJefe = vsol.getCod_jefe(); + EmpleadoJpql e = new EmpleadoJpql(); + if (codigoJefe == null) { + codigoJefe = e.find(vsol.getCod_empleado()).getCodigoJefe(); + } + + // Adiciona el email del jefe del servidor publico. + lemail.add(e.find(codigoJefe).getEmail()); + mresp.put("lemail", lemail); + return mresp; + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/MailMasivo.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/MailMasivo.java.svn-base new file mode 100644 index 0000000..d31c324 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/MailMasivo.java.svn-base @@ -0,0 +1,89 @@ +package com.fp.viaticos.mail; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import org.hibernate.SQLQuery; +import org.hibernate.ScrollableResults; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.viaticos.mail.thread.MailPorSolicitud; + +/** + * Clase que se encarga de almacenar comentarios de la tarea y el estatus actual de la solicitud. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class MailMasivo { + + /** + * Result que contiene los numeros de solicitud o informes por entregar que ya llegaron a la fecha de vencimeinto y + * hay que enviar recordatorios. + */ + protected ScrollableResults rSet; + + /** + * Recorre el resultset que contiene los numeros de operacion a ejecutar el tareas del lote, ejecuta por operacion. + * + * @param numerohilos Numero de hilos a levantar en paralelo para la ejecucion del lote. + * @throws Exception + */ + protected void ejecutar(Integer hilos, SaveRequest pSaverequest) throws Exception { + ExecutorService pool = Executors.newFixedThreadPool(hilos); + try { + if (rSet != null) { + while (rSet.next()) { + try { + Object[] obj = rSet.get(); + // Ejecuta tareas por operacion o por criterio unico de ejecucion. + procesaPorSolicitud(pool, obj, pSaverequest); + } catch (Exception e) { + APPLogger.getLogger().error(e, e); + } + } + } + } finally { + if (rSet != null) { + rSet.close(); + } + } + // control de finalizacion de ejecucion del bathc. + pool.shutdown(); + boolean isfinish = pool.isTerminated(); + while (!isfinish) { + isfinish = pool.isTerminated(); + Thread.sleep(600); + } + } + + /** + * Levanta un hilo por solictud, de la clase que se encarga de enviar notificaciones. + * + * @param pool Objeto que contiene el Ejecutor de hilos. + * @param obj Objeto que contiene la solicitud tipo y numero de dias desde el cual no tomo una accion en el flujo. + * @param pSaverequest + * @throws Exception + */ + private void procesaPorSolicitud(ExecutorService pool, Object[] obj, SaveRequest pSaverequest) throws Exception { + MailPorSolicitud thread = new MailPorSolicitud(pSaverequest, (String) obj[0], (String) obj[1], Integer.valueOf(obj[2].toString())); + pool.execute(thread); + } + + /** Sentencia que entrega las solicitudes a enviar mail. */ + private static final String JPQL = " select cod_solicitud, cod_tipo, ((trunc(sysdate) - fec_fin_viatico)) + 1 dias " + + "from via_solicitud where (trunc(sysdate) - fec_fin_viatico) + 1 between 1 and 4 and cod_estado in ('SAP','IPI') ant tipo = 'SOL' "; + + /** + * Metodo que obtiene las solicitudes a enviar mail masivos. + * + * @throws Exception + */ + protected void fillRset() throws Exception { + SQLQuery qry = PersistenceHelper.getSession().createSQLQuery(MailMasivo.JPQL); + rSet = qry.scroll(); + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/Movilizacion.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/Movilizacion.java.svn-base new file mode 100644 index 0000000..cb8c657 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/Movilizacion.java.svn-base @@ -0,0 +1,103 @@ +package com.fp.viaticos.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.param.ViaNotificacionMovilizacion; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudTransporte; +import com.fp.simple.maia.MailRecipient; +import com.fp.viaticos.rules.exception.ViaticosException; + +/** + * Clase que se encarga de objener el email de un usuario asociado a la ciudad origen del empleado. + * + * @version 2.1 + */ +public class Movilizacion extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + List lemail = new ArrayList(); + Map mresp = new HashMap(); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return mresp; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado e = ejpql.find(vsol.getCod_empleado()); + + String usuario = this.getUsuario(e.getCodigoLocalidad()); + + // adiciona email del empleado. + lemail.add(ejpql.findPorUsuarioWeb(usuario).getEmail()); + + mresp.put("lemail", lemail); + return mresp; + } + + /** + * Busca en la tabla ViaCiudadUsuario, el codigo de usuario asociado a una localidad a la que pertence un + * funcionario de la SBS. + * + * @param ciudad Codigo de ciudad a obtener el usuario. + * @return String + * @throws Exception + */ + private String getUsuario(String ciudad) throws Exception { + Query qry = PersistenceHelper.getEntityManager().createQuery("from ViaNotificacionMovilizacion t where t.pk.cod_ciudad_catalog = :ciudad "); + qry.setParameter("ciudad", ciudad); + + ViaNotificacionMovilizacion obj = null; + try { + obj = (ViaNotificacionMovilizacion) qry.getSingleResult(); + } catch (NoResultException e) { + throw new ViaticosException("VIA-0010", "USUARIO NO DEFINIDO EN VIA_NOTIFICACION_MOVILIZACION CIUDAD: {0}", ciudad); + } + return obj.getCod_usuario(); + } + + /** + * Obtiene el tipo de transporte de una solicitud, si tiene un registro tipo "A" Aereo, retorna A, casocoantrario + * retorna "T" Terrestre. + * + * @param csolicitud Numero de solictud a obtener el tipo de transporte. + * @return String + * @throws Exception + */ + @SuppressWarnings({ "unchecked", "unused" }) + private String getTipoTransporte(String csolicitud) throws Exception { + String tipotrasp = "T"; + Query qry = PersistenceHelper.getEntityManager().createQuery( + "from ViaSolicitudTransporte t where t.pk.cod_solicitud = :csolicitud and t.pk.cod_tipo = :tipo"); + qry.setParameter("csolicitud", csolicitud); + qry.setParameter("tipo", "S"); + List ldatos = qry.getResultList(); + for (ViaSolicitudTransporte obj : ldatos) { + if (obj.getCod_tip_transporte().equals("A")) { + tipotrasp = "A"; + break; + } + } + return tipotrasp; + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/ResponsableUnidad.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/ResponsableUnidad.java.svn-base new file mode 100644 index 0000000..cbc4c8a --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/ResponsableUnidad.java.svn-base @@ -0,0 +1,51 @@ +package com.fp.viaticos.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.maia.MailRecipient; + +/** + * Clase que se encarga de objener el email del responsable de unidad a enviar notificaciones.. + * + * @version 2.1 + */ +public class ResponsableUnidad extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + List lemail = new ArrayList(); + Map mresp = new HashMap(); + + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return mresp; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + String codigoRespUnidad = vsol.getCod_responsable(); + EmpleadoJpql e = new EmpleadoJpql(); + if (codigoRespUnidad == null) { + codigoRespUnidad = e.find(vsol.getCod_empleado()).getCodigoResponsableUnidad(); + } + + // Adiciona el email del jefe del servidor publico. + lemail.add(e.find(codigoRespUnidad).getEmail()); + mresp.put("lemail", lemail); + return mresp; + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/TalentoHumano.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/TalentoHumano.java.svn-base new file mode 100644 index 0000000..2b2024d --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/TalentoHumano.java.svn-base @@ -0,0 +1,78 @@ +package com.fp.viaticos.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.param.ViaCiudadUsuario; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.maia.MailRecipient; +import com.fp.viaticos.rules.exception.ViaticosException; + +/** + * Clase que se encarga de objener el email de un usuario asociado a talento humano. + * + * @version 2.1 + */ +public class TalentoHumano extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + List lemail = new ArrayList(); + Map mresp = new HashMap(); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return mresp; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado e = ejpql.find(vsol.getCod_empleado()); + + String usuario = this.getUsuario(e.getCodigoLocalidad(), "TALENTOHUMANO"); + + // adiciona email del empleado. + lemail.add(ejpql.findPorUsuarioWeb(usuario.toLowerCase()).getEmail()); + + mresp.put("lemail", lemail); + return mresp; + } + + /** + * Busca en la tabla ViaCiudadUsuario, el codigo de usuario asociado a una localidad a la que pertence un + * funcionario de la SBS. + * + * @param ciudad Codigo de ciudad a obtener el usuario. + * @return String + * @throws Exception + */ + private String getUsuario(String ciudad, String actividad) throws Exception { + Query qry = PersistenceHelper.getEntityManager().createQuery( + "from ViaCiudadUsuario t where t.pk.cod_actividad_catalog = :actividad and t.pk.cod_ciudad_catalog = :ciudad "); + qry.setParameter("ciudad", ciudad); + qry.setParameter("actividad", actividad); + ViaCiudadUsuario obj = null; + try { + obj = (ViaCiudadUsuario) qry.getSingleResult(); + } catch (NoResultException e) { + throw new ViaticosException("VIA-0002", "USUARIO NO DEFINIDO EN VIA_CIUDAD_USUARIO CIUDAD: {0} ACTIVIDAD: {1} ", ciudad, actividad); + } + return obj.getCod_usuario(); + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/Tesoreria.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/Tesoreria.java.svn-base new file mode 100644 index 0000000..22f2fed --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/Tesoreria.java.svn-base @@ -0,0 +1,90 @@ +package com.fp.viaticos.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.param.ViaCiudadUsuario; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.maia.MailRecipient; +import com.fp.viaticos.rules.exception.ViaticosException; + +/** + * Clase que se encarga de objener el email de un usuario asociado a tesoreria. + * + * @version 2.1 + */ +public class Tesoreria extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + Map mresp = new HashMap(); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return mresp; + } + String csolicitud = (String) mrequest.get("csolicitud"); + + mresp.put("lemail", this.getEmail(csolicitud, "S")); + return mresp; + } + + /** + * Entrega el email de un empleado, dado el codigo d solicitud y el tipo de solicitud. + * + * @param csolicitud Codigo de solicitud. + * @param tipo Tipo S solicitud, I informe. + * @return List + * @throws Exception + */ + public List getEmail(String csolicitud, String tipo) throws Exception { + List lemail = new ArrayList(); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(csolicitud, tipo)); + + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado e = ejpql.find(vsol.getCod_empleado()); + + String usuario = this.getUsuario(e.getCodigoLocalidad(), "TESORERIA"); + + // adiciona email del empleado. + lemail.add(ejpql.findPorUsuarioWeb(usuario.toLowerCase()).getEmail()); + return lemail; + } + + /** + * Busca en la tabla ViaCiudadUsuario, el codigo de usuario asociado a una localidad a la que pertence un + * funcionario de la SBS. + * + * @param ciudad Codigo de ciudad a obtener el usuario. + * @return String + * @throws Exception + */ + private String getUsuario(String ciudad, String actividad) throws Exception { + Query qry = PersistenceHelper.getEntityManager().createQuery( + "from ViaCiudadUsuario t where t.pk.cod_actividad_catalog = :actividad and t.pk.cod_ciudad_catalog = :ciudad "); + qry.setParameter("ciudad", ciudad); + qry.setParameter("actividad", actividad); + ViaCiudadUsuario obj = null; + try { + obj = (ViaCiudadUsuario) qry.getSingleResult(); + } catch (NoResultException e) { + throw new ViaticosException("VIA-0002", "USUARIO NO DEFINIDO EN VIA_CIUDAD_USUARIO CIUDAD: {0} ACTIVIDAD: {1} ", ciudad, actividad); + } + return obj.getCod_usuario(); + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/UsaurioIngresoSolicitud.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/UsaurioIngresoSolicitud.java.svn-base new file mode 100644 index 0000000..3d6d604 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/.svn/text-base/UsaurioIngresoSolicitud.java.svn-base @@ -0,0 +1,57 @@ +package com.fp.viaticos.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.maia.MailRecipient; + +/** + * Clase que se encarga de objener el email del usuario que ingresa la solicitud para enviar notificaciones. + * + * @version 2.1 + */ +public class UsaurioIngresoSolicitud extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + Map mresp = new HashMap(); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return mresp; + } + String csolicitud = (String) mrequest.get("csolicitud"); + mresp.put("lemail", this.getEmail(csolicitud, "S")); + return mresp; + } + + /** + * Entrega el email de un empleado que ingresa la solicitud, dado el codigo d solicitud y el tipo de solicitud. + * + * @param csolicitud Codigo de solicitud. + * @param tipo Tipo S solicitud, I informe. + * @return List + * @throws Exception + */ + public List getEmail(String csolicitud, String tipo) throws Exception { + List lemail = new ArrayList(); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(csolicitud, tipo)); + + EmpleadoJpql e = new EmpleadoJpql(); + // adiciona email del empleado. + lemail.add(e.findPorUsuarioWeb(vsol.getCod_usuario()).getEmail()); + return lemail; + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/Contabilidad.java b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/Contabilidad.java new file mode 100644 index 0000000..f6c2adf --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/Contabilidad.java @@ -0,0 +1,78 @@ +package com.fp.viaticos.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.param.ViaCiudadUsuario; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.maia.MailRecipient; +import com.fp.viaticos.rules.exception.ViaticosException; + +/** + * Clase que se encarga de objener el email de un usuario asociado a contabilidad. + * + * @version 2.1 + */ +public class Contabilidad extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + List lemail = new ArrayList(); + Map mresp = new HashMap(); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return mresp; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado e = ejpql.find(vsol.getCod_empleado()); + + String usuario = this.getUsuario(e.getCodigoLocalidad(), "CONTABILIDAD"); + + // adiciona email del empleado. + lemail.add(ejpql.findPorUsuarioWeb(usuario.toLowerCase()).getEmail()); + + mresp.put("lemail", lemail); + return mresp; + } + + /** + * Busca en la tabla ViaCiudadUsuario, el codigo de usuario asociado a una localidad a la que pertence un + * funcionario de la SBS. + * + * @param ciudad Codigo de ciudad a obtener el usuario. + * @return String + * @throws Exception + */ + private String getUsuario(String ciudad, String actividad) throws Exception { + Query qry = PersistenceHelper.getEntityManager().createQuery( + "from ViaCiudadUsuario t where t.pk.cod_actividad_catalog = :actividad and t.pk.cod_ciudad_catalog = :ciudad "); + qry.setParameter("ciudad", ciudad); + qry.setParameter("actividad", actividad); + ViaCiudadUsuario obj = null; + try { + obj = (ViaCiudadUsuario) qry.getSingleResult(); + } catch (NoResultException e) { + throw new ViaticosException("VIA-0002", "USUARIO NO DEFINIDO EN VIA_CIUDAD_USUARIO CIUDAD: {0} ACTIVIDAD: {1} ", ciudad, actividad); + } + return obj.getCod_usuario(); + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/Empleado.java b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/Empleado.java new file mode 100644 index 0000000..2ce36fd --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/Empleado.java @@ -0,0 +1,57 @@ +package com.fp.viaticos.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.maia.MailRecipient; + +/** + * Clase que se encarga de objener el email de un empleado para enviar notificaciones. + * + * @version 2.1 + */ +public class Empleado extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + Map mresp = new HashMap(); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return mresp; + } + String csolicitud = (String) mrequest.get("csolicitud"); + mresp.put("lemail", this.getEmail(csolicitud, "S")); + return mresp; + } + + /** + * Entrega el email de un empleado, dado el codigo d solicitud y el tipo de solicitud. + * + * @param csolicitud Codigo de solicitud. + * @param tipo Tipo S solicitud, I informe. + * @return List + * @throws Exception + */ + public List getEmail(String csolicitud, String tipo) throws Exception { + List lemail = new ArrayList(); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(csolicitud, tipo)); + + EmpleadoJpql e = new EmpleadoJpql(); + // adiciona email del empleado. + lemail.add(e.find(vsol.getCod_empleado()).getEmail()); + return lemail; + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/EmpleadoyJefe.java b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/EmpleadoyJefe.java new file mode 100644 index 0000000..1cd7878 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/EmpleadoyJefe.java @@ -0,0 +1,53 @@ +package com.fp.viaticos.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.maia.MailRecipient; + +/** + * Clase que se encarga de objener el email de un empleado y jefe inmediato a enviar notificaciones. + * + * @version 2.1 + */ +public class EmpleadoyJefe extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + List lemail = new ArrayList(); + Map mresp = new HashMap(); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return mresp; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + String codigoJefe = vsol.getCod_jefe(); + + EmpleadoJpql e = new EmpleadoJpql(); + // adiciona email del empleado. + lemail.add(e.find(vsol.getCod_empleado()).getEmail()); + + if (codigoJefe == null) { + codigoJefe = e.find(vsol.getCod_empleado()).getCodigoJefe(); + } + // adiciona email del jefe del empleado. + lemail.add(e.find(codigoJefe).getEmail()); + mresp.put("lemail", lemail); + return mresp; + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/EmpleadoyJefeyResponsableUnidad.java b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/EmpleadoyJefeyResponsableUnidad.java new file mode 100644 index 0000000..7a408ca --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/EmpleadoyJefeyResponsableUnidad.java @@ -0,0 +1,60 @@ +package com.fp.viaticos.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.maia.MailRecipient; + +/** + * Clase que se encarga de objener el email de un empleado y jefe inmediato a enviar notificaciones. + * + * @version 2.1 + */ +public class EmpleadoyJefeyResponsableUnidad extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + List lemail = new ArrayList(); + Map mresp = new HashMap(); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return mresp; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + String codigoJefe = vsol.getCod_jefe(); + String codigoRespUnidad = vsol.getCod_responsable(); + + EmpleadoJpql e = new EmpleadoJpql(); + // adiciona email del empleado. + lemail.add(e.find(vsol.getCod_empleado()).getEmail()); + + if (codigoJefe == null) { + codigoJefe = e.find(vsol.getCod_empleado()).getCodigoJefe(); + } + if (codigoRespUnidad == null) { + codigoRespUnidad = e.find(vsol.getCod_empleado()).getCodigoResponsableUnidad(); + } + // adiciona email del jefe del empleado. + lemail.add(e.find(codigoJefe).getEmail()); + // Adiciona el email del jefe del servidor publico. + lemail.add(e.find(codigoRespUnidad).getEmail()); + + mresp.put("lemail", lemail); + return mresp; + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/Grupos.java b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/Grupos.java new file mode 100644 index 0000000..220b0e4 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/Grupos.java @@ -0,0 +1,55 @@ +package com.fp.viaticos.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pbpm.gene.TbpmGroupsUsers; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.simple.maia.MailRecipientGroup; + +/** + * Clase que se encarga de objener la lista de emails asociados a un grupo definod en TbpmGroupsUsers. + * + * @version 2.1 + */ +public class Grupos extends MailRecipientGroup { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipientGroup#getEmailAddress(java.lang.Object, java.lang.String) + */ + @Override + public Map getEmailAddress(Object pParam, String pGroupCode) throws Exception { + List lemail = new ArrayList(); + Map mresp = new HashMap(); + + List lgrupos = TbpmGroupsUsers.find(PersistenceHelper.getEntityManager(), pGroupCode); + for (TbpmGroupsUsers tbpmGroupsUsers : lgrupos) { + String email = this.getEmailPorUsuario(tbpmGroupsUsers.getPk().getUsercode()); + if (email != null) { + lemail.add(email); + } + } + mresp.put("lemail", lemail); + return mresp; + } + + /** + * Obtiene el email de un empleado de la sbs. + * + * @param cusuario Codigo de usaurio. + * @return String + * @throws Exception + */ + private String getEmailPorUsuario(String cusuario) throws Exception { + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado e = ejpql.findPorUsuarioWeb(cusuario); + return e.getEmail(); + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/Jefe.java b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/Jefe.java new file mode 100644 index 0000000..ec880e9 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/Jefe.java @@ -0,0 +1,51 @@ +package com.fp.viaticos.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.maia.MailRecipient; + +/** + * Clase que se encarga de objener el email de un jefe asociado a un empleado de la sbs. + * + * @version 2.1 + */ +public class Jefe extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + List lemail = new ArrayList(); + Map mresp = new HashMap(); + + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return mresp; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + String codigoJefe = vsol.getCod_jefe(); + EmpleadoJpql e = new EmpleadoJpql(); + if (codigoJefe == null) { + codigoJefe = e.find(vsol.getCod_empleado()).getCodigoJefe(); + } + + // Adiciona el email del jefe del servidor publico. + lemail.add(e.find(codigoJefe).getEmail()); + mresp.put("lemail", lemail); + return mresp; + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/MailMasivo.java b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/MailMasivo.java new file mode 100644 index 0000000..195650e --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/MailMasivo.java @@ -0,0 +1,89 @@ +package com.fp.viaticos.mail; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import org.hibernate.SQLQuery; +import org.hibernate.ScrollableResults; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.viaticos.mail.thread.MailPorSolicitud; + +/** + * Clase que se encarga de almacenar comentarios de la tarea y el estatus actual de la solicitud. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class MailMasivo { + + /** + * Result que contiene los numeros de solicitud o informes por entregar que ya llegaron a la fecha de vencimeinto y + * hay que enviar recordatorios. + */ + protected ScrollableResults rSet; + + /** + * Recorre el resultset que contiene los numeros de operacion a ejecutar el tareas del lote, ejecuta por operacion. + * + * @param numerohilos Numero de hilos a levantar en paralelo para la ejecucion del lote. + * @throws Exception + */ + protected void ejecutar(Integer hilos, SaveRequest pSaverequest) throws Exception { + ExecutorService pool = Executors.newFixedThreadPool(hilos); + try { + if (rSet != null) { + while (rSet.next()) { + try { + Object[] obj = rSet.get(); + // Ejecuta tareas por operacion o por criterio unico de ejecucion. + procesaPorSolicitud(pool, obj, pSaverequest); + } catch (Exception e) { + APPLogger.getLogger().error(e, e); + } + } + } + } finally { + if (rSet != null) { + rSet.close(); + } + } + // control de finalizacion de ejecucion del bathc. + pool.shutdown(); + boolean isfinish = pool.isTerminated(); + while (!isfinish) { + isfinish = pool.isTerminated(); + Thread.sleep(600); + } + } + + /** + * Levanta un hilo por solictud, de la clase que se encarga de enviar notificaciones. + * + * @param pool Objeto que contiene el Ejecutor de hilos. + * @param obj Objeto que contiene la solicitud tipo y numero de dias desde el cual no tomo una accion en el flujo. + * @param pSaverequest + * @throws Exception + */ + private void procesaPorSolicitud(ExecutorService pool, Object[] obj, SaveRequest pSaverequest) throws Exception { + MailPorSolicitud thread = new MailPorSolicitud(pSaverequest, (String) obj[0], (String) obj[1], Integer.valueOf(obj[2].toString())); + pool.execute(thread); + } + + /** Sentencia que entrega las solicitudes a enviar mail. */ + private static final String JPQL = " select cod_solicitud, cod_tipo, ((trunc(select now()) - fec_fin_viatico)) + 1 dias " + + "from via_solicitud where (trunc(select now()) - fec_fin_viatico) + 1 between 1 and 4 and cod_estado in ('SAP','IPI') ant tipo = 'SOL' "; + + /** + * Metodo que obtiene las solicitudes a enviar mail masivos. + * + * @throws Exception + */ + protected void fillRset() throws Exception { + SQLQuery qry = PersistenceHelper.getSession().createSQLQuery(MailMasivo.JPQL); + rSet = qry.scroll(); + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/Movilizacion.java b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/Movilizacion.java new file mode 100644 index 0000000..cb8c657 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/Movilizacion.java @@ -0,0 +1,103 @@ +package com.fp.viaticos.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.param.ViaNotificacionMovilizacion; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudTransporte; +import com.fp.simple.maia.MailRecipient; +import com.fp.viaticos.rules.exception.ViaticosException; + +/** + * Clase que se encarga de objener el email de un usuario asociado a la ciudad origen del empleado. + * + * @version 2.1 + */ +public class Movilizacion extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + List lemail = new ArrayList(); + Map mresp = new HashMap(); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return mresp; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado e = ejpql.find(vsol.getCod_empleado()); + + String usuario = this.getUsuario(e.getCodigoLocalidad()); + + // adiciona email del empleado. + lemail.add(ejpql.findPorUsuarioWeb(usuario).getEmail()); + + mresp.put("lemail", lemail); + return mresp; + } + + /** + * Busca en la tabla ViaCiudadUsuario, el codigo de usuario asociado a una localidad a la que pertence un + * funcionario de la SBS. + * + * @param ciudad Codigo de ciudad a obtener el usuario. + * @return String + * @throws Exception + */ + private String getUsuario(String ciudad) throws Exception { + Query qry = PersistenceHelper.getEntityManager().createQuery("from ViaNotificacionMovilizacion t where t.pk.cod_ciudad_catalog = :ciudad "); + qry.setParameter("ciudad", ciudad); + + ViaNotificacionMovilizacion obj = null; + try { + obj = (ViaNotificacionMovilizacion) qry.getSingleResult(); + } catch (NoResultException e) { + throw new ViaticosException("VIA-0010", "USUARIO NO DEFINIDO EN VIA_NOTIFICACION_MOVILIZACION CIUDAD: {0}", ciudad); + } + return obj.getCod_usuario(); + } + + /** + * Obtiene el tipo de transporte de una solicitud, si tiene un registro tipo "A" Aereo, retorna A, casocoantrario + * retorna "T" Terrestre. + * + * @param csolicitud Numero de solictud a obtener el tipo de transporte. + * @return String + * @throws Exception + */ + @SuppressWarnings({ "unchecked", "unused" }) + private String getTipoTransporte(String csolicitud) throws Exception { + String tipotrasp = "T"; + Query qry = PersistenceHelper.getEntityManager().createQuery( + "from ViaSolicitudTransporte t where t.pk.cod_solicitud = :csolicitud and t.pk.cod_tipo = :tipo"); + qry.setParameter("csolicitud", csolicitud); + qry.setParameter("tipo", "S"); + List ldatos = qry.getResultList(); + for (ViaSolicitudTransporte obj : ldatos) { + if (obj.getCod_tip_transporte().equals("A")) { + tipotrasp = "A"; + break; + } + } + return tipotrasp; + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/ResponsableUnidad.java b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/ResponsableUnidad.java new file mode 100644 index 0000000..cbc4c8a --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/ResponsableUnidad.java @@ -0,0 +1,51 @@ +package com.fp.viaticos.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.maia.MailRecipient; + +/** + * Clase que se encarga de objener el email del responsable de unidad a enviar notificaciones.. + * + * @version 2.1 + */ +public class ResponsableUnidad extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + List lemail = new ArrayList(); + Map mresp = new HashMap(); + + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return mresp; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + String codigoRespUnidad = vsol.getCod_responsable(); + EmpleadoJpql e = new EmpleadoJpql(); + if (codigoRespUnidad == null) { + codigoRespUnidad = e.find(vsol.getCod_empleado()).getCodigoResponsableUnidad(); + } + + // Adiciona el email del jefe del servidor publico. + lemail.add(e.find(codigoRespUnidad).getEmail()); + mresp.put("lemail", lemail); + return mresp; + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/TalentoHumano.java b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/TalentoHumano.java new file mode 100644 index 0000000..2b2024d --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/TalentoHumano.java @@ -0,0 +1,78 @@ +package com.fp.viaticos.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.param.ViaCiudadUsuario; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.maia.MailRecipient; +import com.fp.viaticos.rules.exception.ViaticosException; + +/** + * Clase que se encarga de objener el email de un usuario asociado a talento humano. + * + * @version 2.1 + */ +public class TalentoHumano extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + List lemail = new ArrayList(); + Map mresp = new HashMap(); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return mresp; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado e = ejpql.find(vsol.getCod_empleado()); + + String usuario = this.getUsuario(e.getCodigoLocalidad(), "TALENTOHUMANO"); + + // adiciona email del empleado. + lemail.add(ejpql.findPorUsuarioWeb(usuario.toLowerCase()).getEmail()); + + mresp.put("lemail", lemail); + return mresp; + } + + /** + * Busca en la tabla ViaCiudadUsuario, el codigo de usuario asociado a una localidad a la que pertence un + * funcionario de la SBS. + * + * @param ciudad Codigo de ciudad a obtener el usuario. + * @return String + * @throws Exception + */ + private String getUsuario(String ciudad, String actividad) throws Exception { + Query qry = PersistenceHelper.getEntityManager().createQuery( + "from ViaCiudadUsuario t where t.pk.cod_actividad_catalog = :actividad and t.pk.cod_ciudad_catalog = :ciudad "); + qry.setParameter("ciudad", ciudad); + qry.setParameter("actividad", actividad); + ViaCiudadUsuario obj = null; + try { + obj = (ViaCiudadUsuario) qry.getSingleResult(); + } catch (NoResultException e) { + throw new ViaticosException("VIA-0002", "USUARIO NO DEFINIDO EN VIA_CIUDAD_USUARIO CIUDAD: {0} ACTIVIDAD: {1} ", ciudad, actividad); + } + return obj.getCod_usuario(); + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/Tesoreria.java b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/Tesoreria.java new file mode 100644 index 0000000..22f2fed --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/Tesoreria.java @@ -0,0 +1,90 @@ +package com.fp.viaticos.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.param.ViaCiudadUsuario; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.maia.MailRecipient; +import com.fp.viaticos.rules.exception.ViaticosException; + +/** + * Clase que se encarga de objener el email de un usuario asociado a tesoreria. + * + * @version 2.1 + */ +public class Tesoreria extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + Map mresp = new HashMap(); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return mresp; + } + String csolicitud = (String) mrequest.get("csolicitud"); + + mresp.put("lemail", this.getEmail(csolicitud, "S")); + return mresp; + } + + /** + * Entrega el email de un empleado, dado el codigo d solicitud y el tipo de solicitud. + * + * @param csolicitud Codigo de solicitud. + * @param tipo Tipo S solicitud, I informe. + * @return List + * @throws Exception + */ + public List getEmail(String csolicitud, String tipo) throws Exception { + List lemail = new ArrayList(); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(csolicitud, tipo)); + + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado e = ejpql.find(vsol.getCod_empleado()); + + String usuario = this.getUsuario(e.getCodigoLocalidad(), "TESORERIA"); + + // adiciona email del empleado. + lemail.add(ejpql.findPorUsuarioWeb(usuario.toLowerCase()).getEmail()); + return lemail; + } + + /** + * Busca en la tabla ViaCiudadUsuario, el codigo de usuario asociado a una localidad a la que pertence un + * funcionario de la SBS. + * + * @param ciudad Codigo de ciudad a obtener el usuario. + * @return String + * @throws Exception + */ + private String getUsuario(String ciudad, String actividad) throws Exception { + Query qry = PersistenceHelper.getEntityManager().createQuery( + "from ViaCiudadUsuario t where t.pk.cod_actividad_catalog = :actividad and t.pk.cod_ciudad_catalog = :ciudad "); + qry.setParameter("ciudad", ciudad); + qry.setParameter("actividad", actividad); + ViaCiudadUsuario obj = null; + try { + obj = (ViaCiudadUsuario) qry.getSingleResult(); + } catch (NoResultException e) { + throw new ViaticosException("VIA-0002", "USUARIO NO DEFINIDO EN VIA_CIUDAD_USUARIO CIUDAD: {0} ACTIVIDAD: {1} ", ciudad, actividad); + } + return obj.getCod_usuario(); + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/UsaurioIngresoSolicitud.java b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/UsaurioIngresoSolicitud.java new file mode 100644 index 0000000..3d6d604 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/UsaurioIngresoSolicitud.java @@ -0,0 +1,57 @@ +package com.fp.viaticos.mail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.maia.MailRecipient; + +/** + * Clase que se encarga de objener el email del usuario que ingresa la solicitud para enviar notificaciones. + * + * @version 2.1 + */ +public class UsaurioIngresoSolicitud extends MailRecipient { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.maia.MailRecipient#getEmailAddress(java.lang.Object) + */ + @SuppressWarnings("unchecked") + @Override + public Map getEmailAddress(Object pParam) throws Exception { + Map mresp = new HashMap(); + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return mresp; + } + String csolicitud = (String) mrequest.get("csolicitud"); + mresp.put("lemail", this.getEmail(csolicitud, "S")); + return mresp; + } + + /** + * Entrega el email de un empleado que ingresa la solicitud, dado el codigo d solicitud y el tipo de solicitud. + * + * @param csolicitud Codigo de solicitud. + * @param tipo Tipo S solicitud, I informe. + * @return List + * @throws Exception + */ + public List getEmail(String csolicitud, String tipo) throws Exception { + List lemail = new ArrayList(); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(csolicitud, tipo)); + + EmpleadoJpql e = new EmpleadoJpql(); + // adiciona email del empleado. + lemail.add(e.findPorUsuarioWeb(vsol.getCod_usuario()).getEmail()); + return lemail; + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/thread/.svn/entries b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/thread/.svn/entries new file mode 100644 index 0000000..d6e0119 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/thread/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main/java/com/fp/viaticos/mail/thread +svn://172.17.26.185/COMACO + + + +2014-09-11T07:01:34.572119Z +664 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +MailPorSolicitud.java +file + + + + +2022-07-28T03:40:39.314788Z +69edef22383d74dbfeeb508294984232 +2014-09-11T07:01:34.572119Z +664 +jvaca + + + + + + + + + + + + + + + + + + + + + +3853 + diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/thread/.svn/text-base/MailPorSolicitud.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/thread/.svn/text-base/MailPorSolicitud.java.svn-base new file mode 100644 index 0000000..4b595f3 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/thread/.svn/text-base/MailPorSolicitud.java.svn-base @@ -0,0 +1,122 @@ +package com.fp.viaticos.mail.thread; + +import java.util.ArrayList; +import java.util.List; + +import com.fp.bpmlib.flow.RuleUtil; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.viaticos.mail.Empleado; +import com.fp.viaticos.mail.Tesoreria; + +/** + * Hilo que se encarga de enviar mail's al empleado y/o tesoreria por solicitud. El mail se envia si el usuario tiene + * tareas en estatus aprobar o por ingresar informe. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class MailPorSolicitud implements Runnable { + + /** + * Request con el que inicia la transaccion de envio de correos. + */ + private final SaveRequest saverequest; + + /** + * Numero de solicitud a obtener informacion asociada a la solicitud con la que se envia el mail. + */ + private final String csolicitud; + + /** + * S solicitud. I informe. + */ + private final String tipo; + + /** + * Numero de dias desde la fecha de vencimiento del viatico. + */ + private final Integer dias; + + /** + * Crea una instancia de MailPorSolicitud. + * + * @param saverequest Objeto con el que inicia una solicitud. + * @param csolicitud Numero de solicitus. + * @param tipo Tipo de registro, S solicitud, I informe. + * @throws Exception + */ + public MailPorSolicitud(SaveRequest saverequest, String csolicitud, String tipo, Integer dias) throws Exception { + this.saverequest = saverequest; + this.csolicitud = csolicitud; + this.tipo = tipo; + this.dias = dias; + } + + /** + * Metodo que se encarga de inicio de ejecucion del hilo. + */ + @Override + public void run() { + try { + process(); + } catch (Exception e) { + APPLogger.getLogger().error(e); + } + } + + /** + * Metodo que se encarga de la llamada al ejb para la ejecucion de una cuenta. + * + * @throws Exception Se presenta en el caso que la el proceso de la tarea no haya sido satisfactoria + */ + private void process() throws Exception { + try { + SessionData s = new SessionData(); + s.setCompany(saverequest.getCompany()); + ThreadFacade.setSaveRequest(s); + PersistenceHelper.setEntityManager(PersistenceManager.getInstance().createEntityManagerLocal()); + PersistenceHelper.beginNewTransaction(); + this.sendMail(); + PersistenceHelper.commitNewTransaction(); + } catch (Exception e) { + PersistenceHelper.rollbackNewTransaction(); + APPLogger.getLogger().error(e); + } + } + + /** + * Envia mail al empleado y a tesoria si tiene 4 dias de reteazo en tomar acciones en el flujo. + * + * @throws Exception + */ + private void sendMail() throws Exception { + RuleUtil.setSubjectTemplate(1); + RuleUtil.setContentTemplate(2); + List lemail = new ArrayList(); + + Empleado emp = new Empleado(); + lemail.addAll(emp.getEmail(csolicitud, tipo)); + + if (dias == 4) { + Tesoreria t = new Tesoreria(); + lemail.addAll(t.getEmail(csolicitud, tipo)); + } + + for (String email : lemail) { + RuleUtil.toAddress(email); + } + if (!lemail.isEmpty()) { + Request request = new Request(); + saverequest.copy(request); + request.put("csolicitud", csolicitud); + RuleUtil.sendMail(request); + } + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/mail/thread/MailPorSolicitud.java b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/thread/MailPorSolicitud.java new file mode 100644 index 0000000..4b595f3 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/mail/thread/MailPorSolicitud.java @@ -0,0 +1,122 @@ +package com.fp.viaticos.mail.thread; + +import java.util.ArrayList; +import java.util.List; + +import com.fp.bpmlib.flow.RuleUtil; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.viaticos.mail.Empleado; +import com.fp.viaticos.mail.Tesoreria; + +/** + * Hilo que se encarga de enviar mail's al empleado y/o tesoreria por solicitud. El mail se envia si el usuario tiene + * tareas en estatus aprobar o por ingresar informe. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class MailPorSolicitud implements Runnable { + + /** + * Request con el que inicia la transaccion de envio de correos. + */ + private final SaveRequest saverequest; + + /** + * Numero de solicitud a obtener informacion asociada a la solicitud con la que se envia el mail. + */ + private final String csolicitud; + + /** + * S solicitud. I informe. + */ + private final String tipo; + + /** + * Numero de dias desde la fecha de vencimiento del viatico. + */ + private final Integer dias; + + /** + * Crea una instancia de MailPorSolicitud. + * + * @param saverequest Objeto con el que inicia una solicitud. + * @param csolicitud Numero de solicitus. + * @param tipo Tipo de registro, S solicitud, I informe. + * @throws Exception + */ + public MailPorSolicitud(SaveRequest saverequest, String csolicitud, String tipo, Integer dias) throws Exception { + this.saverequest = saverequest; + this.csolicitud = csolicitud; + this.tipo = tipo; + this.dias = dias; + } + + /** + * Metodo que se encarga de inicio de ejecucion del hilo. + */ + @Override + public void run() { + try { + process(); + } catch (Exception e) { + APPLogger.getLogger().error(e); + } + } + + /** + * Metodo que se encarga de la llamada al ejb para la ejecucion de una cuenta. + * + * @throws Exception Se presenta en el caso que la el proceso de la tarea no haya sido satisfactoria + */ + private void process() throws Exception { + try { + SessionData s = new SessionData(); + s.setCompany(saverequest.getCompany()); + ThreadFacade.setSaveRequest(s); + PersistenceHelper.setEntityManager(PersistenceManager.getInstance().createEntityManagerLocal()); + PersistenceHelper.beginNewTransaction(); + this.sendMail(); + PersistenceHelper.commitNewTransaction(); + } catch (Exception e) { + PersistenceHelper.rollbackNewTransaction(); + APPLogger.getLogger().error(e); + } + } + + /** + * Envia mail al empleado y a tesoria si tiene 4 dias de reteazo en tomar acciones en el flujo. + * + * @throws Exception + */ + private void sendMail() throws Exception { + RuleUtil.setSubjectTemplate(1); + RuleUtil.setContentTemplate(2); + List lemail = new ArrayList(); + + Empleado emp = new Empleado(); + lemail.addAll(emp.getEmail(csolicitud, tipo)); + + if (dias == 4) { + Tesoreria t = new Tesoreria(); + lemail.addAll(t.getEmail(csolicitud, tipo)); + } + + for (String email : lemail) { + RuleUtil.toAddress(email); + } + if (!lemail.isEmpty()) { + Request request = new Request(); + saverequest.copy(request); + request.put("csolicitud", csolicitud); + RuleUtil.sendMail(request); + } + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/.svn/entries b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/.svn/entries new file mode 100644 index 0000000..c24b542 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/.svn/entries @@ -0,0 +1,43 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main/java/com/fp/viaticos/rules +svn://172.17.26.185/COMACO + + + +2015-06-23T07:17:36.315401Z +4128 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +query +dir + +enums +dir + +consulta +dir + +exception +dir + +save +dir + diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/consulta/.svn/entries b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/consulta/.svn/entries new file mode 100644 index 0000000..c1beee7 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/consulta/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main/java/com/fp/viaticos/rules/consulta +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +solicitud +dir + diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/consulta/solicitud/.svn/entries b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/consulta/solicitud/.svn/entries new file mode 100644 index 0000000..5868a34 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/consulta/solicitud/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main/java/com/fp/viaticos/rules/consulta/solicitud +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ConsultaSolicitud.java +file + + + + +2022-07-28T03:40:39.664790Z +4c2886f18f9f950945001859578b0dcc +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4148 + +ConsultaComentarios.java +file + + + + +2022-07-28T03:40:39.664790Z +f716fa9058fe97130c72993688cc4da2 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1912 + diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/consulta/solicitud/.svn/text-base/ConsultaComentarios.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/consulta/solicitud/.svn/text-base/ConsultaComentarios.java.svn-base new file mode 100644 index 0000000..4b8088b --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/consulta/solicitud/.svn/text-base/ConsultaComentarios.java.svn-base @@ -0,0 +1,55 @@ +package com.fp.viaticos.rules.consulta.solicitud; + +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudComentarios; +import com.fp.viaticos.rules.enums.EnumCodigos; + +public class ConsultaComentarios extends QueryRule { + + /** + * + */ + private static final long serialVersionUID = 1L; + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pQrequest) throws Exception { + Response response = pQrequest.getResponse(); + QueryJsf query = new QueryJsf(); + query.execute(pQrequest); + List comentarios = (List) response.get("SOLICITUDCOMENTARIOS"); + this.completarDatos(comentarios); + return pQrequest; + } + + /** + * Método que completa los datos de los comentarios + * + * @param comentarios Lista de objetos tipo ViaSolicitudComentarios + */ + private void completarDatos(List comentarios) throws Exception { + if (comentarios == null || comentarios.isEmpty()) { + return; + } + for (Object objeto : comentarios) { + ViaSolicitudComentarios comentario = (ViaSolicitudComentarios) objeto; + Empleado emp = null; + EmpleadoJpql e = new EmpleadoJpql(); + // empleado + if (comentario.getCod_usuario() != null) { + emp = e.findPorUsuarioWeb(comentario.getCod_usuario().toLowerCase()); + if (emp != null) { + comentario.modifiedData.put("empleado", emp.getNombre()); + comentario.modifiedData.put("cargo", emp.getCargo()); + } + } + } + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/consulta/solicitud/.svn/text-base/ConsultaSolicitud.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/consulta/solicitud/.svn/text-base/ConsultaSolicitud.java.svn-base new file mode 100644 index 0000000..27283f1 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/consulta/solicitud/.svn/text-base/ConsultaSolicitud.java.svn-base @@ -0,0 +1,127 @@ +package com.fp.viaticos.rules.consulta.solicitud; + +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.param.ViaDiasAcumulados; +import com.fp.persistence.pviaticos.param.ViaDiasAcumuladosKey; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudIntegrantes; +import com.fp.viaticos.rules.query.destino.DestinoQuery; + +public class ConsultaSolicitud extends QueryRule{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + @Override + public QueryRequest process(QueryRequest pQrequest) throws Exception { + Response response = pQrequest.getResponse(); + QueryJsf query = new QueryJsf(); + query.execute(pQrequest); + Object solicitud = (Object) response.get("SOLICITUD"); + List integrantes = (List)response.get("SOLICITUDINTEGRANTES"); + this.completeInfoSolicitud(solicitud); + this.completeInfoIntegrantes(integrantes); + return pQrequest; + } + + /** + * Completa los datos de la solicitud + * @param object Objeto ViaSolicitud + * @throws Exception + */ + public void completeInfoSolicitud(Object object) throws Exception{ + if(object==null){ + return; + } + ViaSolicitud solicitud = (ViaSolicitud)object; + Empleado emp = null; + EmpleadoJpql e = new EmpleadoJpql(); + DestinoQuery qry = new DestinoQuery(); + + //Funcionario ingresa + emp = e.findPorUsuarioWeb(solicitud.getCod_usuario().toLowerCase()); + if(emp!=null){ + solicitud.modifiedData.put("cod_ingreso", emp.getCodigo()); + solicitud.modifiedData.put("nom_ingreso", emp.getNombre()); + } + //jefe + if(solicitud.getCod_jefe()!=null){ + emp = e.find(solicitud.getCod_jefe()); + if(emp!=null){ + solicitud.modifiedData.put("nombrejefe", emp.getNombre()); + solicitud.modifiedData.put("cargojefe", emp.getNombreCargo()); + } + } + //Responsable + if(solicitud.getCod_responsable()!=null){ + emp = e.find(solicitud.getCod_responsable()); + if(emp!=null){ + solicitud.modifiedData.put("nombreresponsable", emp.getNombre()); + solicitud.modifiedData.put("cargoresponsable", emp.getNombreCargo()); + } + } + //Destino + Object obj = qry.find(solicitud.getCod_destino()); + if(obj!=null){ + Object[] destino = (Object[])obj; + solicitud.modifiedData.put("destinoname", destino[1]); + } + //Dias acumulados por destino + Calendar calendar = Calendar.getInstance(); + calendar.setTime(solicitud.getFec_creacion()); + BigDecimal dias = this.diasPorDestino(solicitud.getCod_empleado(), solicitud.getCod_destino(),calendar.get(Calendar.YEAR)); + solicitud.modifiedData.put("comisionciudad", solicitud.getNum_dias().add(dias)); + } + + /** + * Completa la informacion de los integrantes + * @param objeto + */ + public void completeInfoIntegrantes(List objetos)throws Exception{ + if(objetos==null || objetos.isEmpty()){ + return; + } + for(Object obj:objetos){ + ViaSolicitudIntegrantes integrante = (ViaSolicitudIntegrantes)obj; + EmpleadoJpql e = new EmpleadoJpql(); + Empleado emp = e.find(integrante.getPk().getCod_empleado()); + if(emp!=null){ + integrante.modifiedData.put("empleado", emp.getNombre()); + } + } + + } + + /** + * Entrega los dias acumulados por ciudad + * @param codEmpleado + * @param codDestino + * @param periodo + * @return + * @throws Exception + */ + private BigDecimal diasPorDestino(String codEmpleado, String codDestino, Integer periodo)throws Exception{ + BigDecimal valor = new BigDecimal("0.0"); + ViaDiasAcumuladosKey key = new ViaDiasAcumuladosKey(); + key.setCod_empleado(codEmpleado); + key.setCod_destino(codDestino); + key.setCod_ejercicio(periodo); + ViaDiasAcumulados acumulados = ViaDiasAcumulados.find(PersistenceHelper.getEntityManager(), key); + if(acumulados!=null){ + valor.add(acumulados.getNum_dias()); + } + return valor; + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/consulta/solicitud/ConsultaComentarios.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/consulta/solicitud/ConsultaComentarios.java new file mode 100644 index 0000000..4b8088b --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/consulta/solicitud/ConsultaComentarios.java @@ -0,0 +1,55 @@ +package com.fp.viaticos.rules.consulta.solicitud; + +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudComentarios; +import com.fp.viaticos.rules.enums.EnumCodigos; + +public class ConsultaComentarios extends QueryRule { + + /** + * + */ + private static final long serialVersionUID = 1L; + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pQrequest) throws Exception { + Response response = pQrequest.getResponse(); + QueryJsf query = new QueryJsf(); + query.execute(pQrequest); + List comentarios = (List) response.get("SOLICITUDCOMENTARIOS"); + this.completarDatos(comentarios); + return pQrequest; + } + + /** + * Método que completa los datos de los comentarios + * + * @param comentarios Lista de objetos tipo ViaSolicitudComentarios + */ + private void completarDatos(List comentarios) throws Exception { + if (comentarios == null || comentarios.isEmpty()) { + return; + } + for (Object objeto : comentarios) { + ViaSolicitudComentarios comentario = (ViaSolicitudComentarios) objeto; + Empleado emp = null; + EmpleadoJpql e = new EmpleadoJpql(); + // empleado + if (comentario.getCod_usuario() != null) { + emp = e.findPorUsuarioWeb(comentario.getCod_usuario().toLowerCase()); + if (emp != null) { + comentario.modifiedData.put("empleado", emp.getNombre()); + comentario.modifiedData.put("cargo", emp.getCargo()); + } + } + } + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/consulta/solicitud/ConsultaSolicitud.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/consulta/solicitud/ConsultaSolicitud.java new file mode 100644 index 0000000..27283f1 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/consulta/solicitud/ConsultaSolicitud.java @@ -0,0 +1,127 @@ +package com.fp.viaticos.rules.consulta.solicitud; + +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.param.ViaDiasAcumulados; +import com.fp.persistence.pviaticos.param.ViaDiasAcumuladosKey; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudIntegrantes; +import com.fp.viaticos.rules.query.destino.DestinoQuery; + +public class ConsultaSolicitud extends QueryRule{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + @Override + public QueryRequest process(QueryRequest pQrequest) throws Exception { + Response response = pQrequest.getResponse(); + QueryJsf query = new QueryJsf(); + query.execute(pQrequest); + Object solicitud = (Object) response.get("SOLICITUD"); + List integrantes = (List)response.get("SOLICITUDINTEGRANTES"); + this.completeInfoSolicitud(solicitud); + this.completeInfoIntegrantes(integrantes); + return pQrequest; + } + + /** + * Completa los datos de la solicitud + * @param object Objeto ViaSolicitud + * @throws Exception + */ + public void completeInfoSolicitud(Object object) throws Exception{ + if(object==null){ + return; + } + ViaSolicitud solicitud = (ViaSolicitud)object; + Empleado emp = null; + EmpleadoJpql e = new EmpleadoJpql(); + DestinoQuery qry = new DestinoQuery(); + + //Funcionario ingresa + emp = e.findPorUsuarioWeb(solicitud.getCod_usuario().toLowerCase()); + if(emp!=null){ + solicitud.modifiedData.put("cod_ingreso", emp.getCodigo()); + solicitud.modifiedData.put("nom_ingreso", emp.getNombre()); + } + //jefe + if(solicitud.getCod_jefe()!=null){ + emp = e.find(solicitud.getCod_jefe()); + if(emp!=null){ + solicitud.modifiedData.put("nombrejefe", emp.getNombre()); + solicitud.modifiedData.put("cargojefe", emp.getNombreCargo()); + } + } + //Responsable + if(solicitud.getCod_responsable()!=null){ + emp = e.find(solicitud.getCod_responsable()); + if(emp!=null){ + solicitud.modifiedData.put("nombreresponsable", emp.getNombre()); + solicitud.modifiedData.put("cargoresponsable", emp.getNombreCargo()); + } + } + //Destino + Object obj = qry.find(solicitud.getCod_destino()); + if(obj!=null){ + Object[] destino = (Object[])obj; + solicitud.modifiedData.put("destinoname", destino[1]); + } + //Dias acumulados por destino + Calendar calendar = Calendar.getInstance(); + calendar.setTime(solicitud.getFec_creacion()); + BigDecimal dias = this.diasPorDestino(solicitud.getCod_empleado(), solicitud.getCod_destino(),calendar.get(Calendar.YEAR)); + solicitud.modifiedData.put("comisionciudad", solicitud.getNum_dias().add(dias)); + } + + /** + * Completa la informacion de los integrantes + * @param objeto + */ + public void completeInfoIntegrantes(List objetos)throws Exception{ + if(objetos==null || objetos.isEmpty()){ + return; + } + for(Object obj:objetos){ + ViaSolicitudIntegrantes integrante = (ViaSolicitudIntegrantes)obj; + EmpleadoJpql e = new EmpleadoJpql(); + Empleado emp = e.find(integrante.getPk().getCod_empleado()); + if(emp!=null){ + integrante.modifiedData.put("empleado", emp.getNombre()); + } + } + + } + + /** + * Entrega los dias acumulados por ciudad + * @param codEmpleado + * @param codDestino + * @param periodo + * @return + * @throws Exception + */ + private BigDecimal diasPorDestino(String codEmpleado, String codDestino, Integer periodo)throws Exception{ + BigDecimal valor = new BigDecimal("0.0"); + ViaDiasAcumuladosKey key = new ViaDiasAcumuladosKey(); + key.setCod_empleado(codEmpleado); + key.setCod_destino(codDestino); + key.setCod_ejercicio(periodo); + ViaDiasAcumulados acumulados = ViaDiasAcumulados.find(PersistenceHelper.getEntityManager(), key); + if(acumulados!=null){ + valor.add(acumulados.getNum_dias()); + } + return valor; + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/enums/.svn/entries b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/enums/.svn/entries new file mode 100644 index 0000000..85888df --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/enums/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main/java/com/fp/viaticos/rules/enums +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +EnumEstadosSolicitud.java +file + + + + +2022-07-28T03:40:39.628790Z +0fabfa58e32382027de95b9cacd2bbf1 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1463 + +EnumCodigos.java +file + + + + +2022-07-28T03:40:39.628790Z +cb780cc9e1e1fbc568bd0e65755dfffd +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +938 + diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/enums/.svn/text-base/EnumCodigos.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/enums/.svn/text-base/EnumCodigos.java.svn-base new file mode 100644 index 0000000..6e1e783 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/enums/.svn/text-base/EnumCodigos.java.svn-base @@ -0,0 +1,48 @@ +package com.fp.viaticos.rules.enums; + +/** + * Enumeracion en la que se define codigos utilites de solicitud de viaticos. + * + * @version 2.1 + */ +public enum EnumCodigos { + /** + * Código tipo solicitud + */ + SOLICITUD("S"), + /** + * Código tipo informe + */ + INFORME("I"), + /** + * Código del parametro de días + */ + VIA_03("VIA_03"), + /** + * Código del parametro para permitir días de salida + */ + VIA_04("VIA_04"), + /** + * Código del parametro para permitir días de llegada + */ + VIA_05("VIA_05"); + /** + * Atributo para obtener el valor + */ + private String codigo; + + /** + * @param texto + * @param codigo + */ + private EnumCodigos(String codigo) { + this.codigo = codigo; + } + + /** + * @return the texto + */ + public String getCodigo() { + return codigo; + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/enums/.svn/text-base/EnumEstadosSolicitud.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/enums/.svn/text-base/EnumEstadosSolicitud.java.svn-base new file mode 100644 index 0000000..df81b2c --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/enums/.svn/text-base/EnumEstadosSolicitud.java.svn-base @@ -0,0 +1,71 @@ +package com.fp.viaticos.rules.enums; + +/** + * Enumeracion en la que se define codigos de estado de una solicitud. + * + * @version 2.1 + */ +public enum EnumEstadosSolicitud { + /** + * Código estado ingresado + */ + INGRESADO("IN"), + /** + * Código estado por aprobar + */ + ANULACION_POR_APROBAR("SAA"), + /** + * Código estado por aprobar + */ + POR_APROBAR("SPA"), + /** + * Código estado por corregir + */ + POR_CORREGIR("SPC"), + /** + * Código estado aprobado + */ + APROBADA("SAP"), + /** + * Código estado anulada + */ + ANULADA("SAN"), + /** + * Código estado por ingresar informe + */ + POR_ING_INFORME("IPI"), + /** + * Código estado informe aprobado + */ + INF_APROBADO("IAP"), + /** + * Código estado informe por aprobar + */ + INF_POR_APROBAR("IPA"), + /** + * Código estado informe por aprobar + */ + INF_POR_CORREGIR("IPC"); + /** + * ACodigo de estatus de la solicitud. + */ + private String estatus; + + /** + * @param texto + * @param codigo + */ + private EnumEstadosSolicitud(String estatus) { + this.estatus = estatus; + } + + /** + * Entrega el valor de: estatus + * + * @return String + */ + public String getEstatus() { + return estatus; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/enums/EnumCodigos.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/enums/EnumCodigos.java new file mode 100644 index 0000000..6e1e783 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/enums/EnumCodigos.java @@ -0,0 +1,48 @@ +package com.fp.viaticos.rules.enums; + +/** + * Enumeracion en la que se define codigos utilites de solicitud de viaticos. + * + * @version 2.1 + */ +public enum EnumCodigos { + /** + * Código tipo solicitud + */ + SOLICITUD("S"), + /** + * Código tipo informe + */ + INFORME("I"), + /** + * Código del parametro de días + */ + VIA_03("VIA_03"), + /** + * Código del parametro para permitir días de salida + */ + VIA_04("VIA_04"), + /** + * Código del parametro para permitir días de llegada + */ + VIA_05("VIA_05"); + /** + * Atributo para obtener el valor + */ + private String codigo; + + /** + * @param texto + * @param codigo + */ + private EnumCodigos(String codigo) { + this.codigo = codigo; + } + + /** + * @return the texto + */ + public String getCodigo() { + return codigo; + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/enums/EnumEstadosSolicitud.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/enums/EnumEstadosSolicitud.java new file mode 100644 index 0000000..df81b2c --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/enums/EnumEstadosSolicitud.java @@ -0,0 +1,71 @@ +package com.fp.viaticos.rules.enums; + +/** + * Enumeracion en la que se define codigos de estado de una solicitud. + * + * @version 2.1 + */ +public enum EnumEstadosSolicitud { + /** + * Código estado ingresado + */ + INGRESADO("IN"), + /** + * Código estado por aprobar + */ + ANULACION_POR_APROBAR("SAA"), + /** + * Código estado por aprobar + */ + POR_APROBAR("SPA"), + /** + * Código estado por corregir + */ + POR_CORREGIR("SPC"), + /** + * Código estado aprobado + */ + APROBADA("SAP"), + /** + * Código estado anulada + */ + ANULADA("SAN"), + /** + * Código estado por ingresar informe + */ + POR_ING_INFORME("IPI"), + /** + * Código estado informe aprobado + */ + INF_APROBADO("IAP"), + /** + * Código estado informe por aprobar + */ + INF_POR_APROBAR("IPA"), + /** + * Código estado informe por aprobar + */ + INF_POR_CORREGIR("IPC"); + /** + * ACodigo de estatus de la solicitud. + */ + private String estatus; + + /** + * @param texto + * @param codigo + */ + private EnumEstadosSolicitud(String estatus) { + this.estatus = estatus; + } + + /** + * Entrega el valor de: estatus + * + * @return String + */ + public String getEstatus() { + return estatus; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/exception/.svn/entries b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/exception/.svn/entries new file mode 100644 index 0000000..c38c530 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/exception/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main/java/com/fp/viaticos/rules/exception +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ViaticosException.java +file + + + + +2022-07-28T03:40:39.726790Z +80e2c6985c460b78a03e4304f078da69 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1113 + diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/exception/.svn/text-base/ViaticosException.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/exception/.svn/text-base/ViaticosException.java.svn-base new file mode 100644 index 0000000..3fc7491 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/exception/.svn/text-base/ViaticosException.java.svn-base @@ -0,0 +1,33 @@ +package com.fp.viaticos.rules.exception; + +import javax.ejb.ApplicationException; + +import com.fp.common.exception.APPException; + +@ApplicationException(rollback=true) +public class ViaticosException extends APPException{ + + /**Version de la clase. */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de ViaticosException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public ViaticosException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de ViaticosException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public ViaticosException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/exception/ViaticosException.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/exception/ViaticosException.java new file mode 100644 index 0000000..3fc7491 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/exception/ViaticosException.java @@ -0,0 +1,33 @@ +package com.fp.viaticos.rules.exception; + +import javax.ejb.ApplicationException; + +import com.fp.common.exception.APPException; + +@ApplicationException(rollback=true) +public class ViaticosException extends APPException{ + + /**Version de la clase. */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de ViaticosException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public ViaticosException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de ViaticosException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public ViaticosException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/.svn/entries b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/.svn/entries new file mode 100644 index 0000000..19809a4 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/.svn/entries @@ -0,0 +1,43 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +informe +dir + +solicitud +dir + +destino +dir + +empleados +dir + +general +dir + diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/destino/.svn/entries b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/destino/.svn/entries new file mode 100644 index 0000000..e7e79c0 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/destino/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/destino +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +DestinoQuery.java +file + + + + +2022-07-28T03:40:39.502789Z +d55d004c7437ee3a41b6b08ddcfdd03d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1522 + +LovDestinoSbs.java +file + + + + +2022-07-28T03:40:39.503789Z +e3dce7045187394118760c5fb232a6e8 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +740 + diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/destino/.svn/text-base/DestinoQuery.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/destino/.svn/text-base/DestinoQuery.java.svn-base new file mode 100644 index 0000000..02dc399 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/destino/.svn/text-base/DestinoQuery.java.svn-base @@ -0,0 +1,46 @@ +package com.fp.viaticos.rules.query.destino; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.query.DtoQuery; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.Empleado; + +public class DestinoQuery extends QueryJsf{ + + /** + * Consulta para obtener todas los destinos + */ + private static String SQL = "select t.COD_DESTINO, t.NOM_dESTINO, t.USU_AUD_LUGARES, t.FEC_AUD_LUGARES, t.STS_DESTINO from SCA.SCP_DESTINO t"; + + /** + * Método que obtiene los destinos segun los filtros enviados + * @param dtoquery Objeto DtoQuery + * @return list + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List find(DtoQuery dtoquery) throws Exception{ + super.buildCriteria(dtoquery); + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(DestinoQuery.SQL + (super.where == null ? "" : super.where.toString()) ); + super.setParameters(dtoquery, qry); + return qry.getResultList(); + } + + /** + * Entrega el destino + * @param codDestino Codigo destino + * @return obj Object[] + */ + public Object find(String codDestino)throws Exception{ + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(DestinoQuery.SQL + " WHERE t.COD_DESTINO = :CODDESTINO"); + qry.setParameter("CODDESTINO", codDestino); + Object obj = qry.getSingleResult(); + return obj; + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/destino/.svn/text-base/LovDestinoSbs.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/destino/.svn/text-base/LovDestinoSbs.java.svn-base new file mode 100644 index 0000000..9067368 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/destino/.svn/text-base/LovDestinoSbs.java.svn-base @@ -0,0 +1,28 @@ +package com.fp.viaticos.rules.query.destino; + +import java.util.List; + +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +public class LovDestinoSbs extends QueryRule{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Metodo sobreescrito para gestionar la respuesta de la consulta + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + DtoQuery dtoquery = pQueryRequest.getQueryTables().get("LOVDESTINO"); + DestinoQuery e = new DestinoQuery(); + List ldestinos = e.find(dtoquery); + pQueryRequest.getResponse().put("LOVDESTINO", ldestinos); + return pQueryRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/destino/DestinoQuery.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/destino/DestinoQuery.java new file mode 100644 index 0000000..02dc399 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/destino/DestinoQuery.java @@ -0,0 +1,46 @@ +package com.fp.viaticos.rules.query.destino; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.query.DtoQuery; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.Empleado; + +public class DestinoQuery extends QueryJsf{ + + /** + * Consulta para obtener todas los destinos + */ + private static String SQL = "select t.COD_DESTINO, t.NOM_dESTINO, t.USU_AUD_LUGARES, t.FEC_AUD_LUGARES, t.STS_DESTINO from SCA.SCP_DESTINO t"; + + /** + * Método que obtiene los destinos segun los filtros enviados + * @param dtoquery Objeto DtoQuery + * @return list + * @throws Exception + */ + @SuppressWarnings("unchecked") + public List find(DtoQuery dtoquery) throws Exception{ + super.buildCriteria(dtoquery); + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(DestinoQuery.SQL + (super.where == null ? "" : super.where.toString()) ); + super.setParameters(dtoquery, qry); + return qry.getResultList(); + } + + /** + * Entrega el destino + * @param codDestino Codigo destino + * @return obj Object[] + */ + public Object find(String codDestino)throws Exception{ + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(DestinoQuery.SQL + " WHERE t.COD_DESTINO = :CODDESTINO"); + qry.setParameter("CODDESTINO", codDestino); + Object obj = qry.getSingleResult(); + return obj; + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/destino/LovDestinoSbs.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/destino/LovDestinoSbs.java new file mode 100644 index 0000000..9067368 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/destino/LovDestinoSbs.java @@ -0,0 +1,28 @@ +package com.fp.viaticos.rules.query.destino; + +import java.util.List; + +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; + +public class LovDestinoSbs extends QueryRule{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Metodo sobreescrito para gestionar la respuesta de la consulta + */ + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + DtoQuery dtoquery = pQueryRequest.getQueryTables().get("LOVDESTINO"); + DestinoQuery e = new DestinoQuery(); + List ldestinos = e.find(dtoquery); + pQueryRequest.getResponse().put("LOVDESTINO", ldestinos); + return pQueryRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/empleados/.svn/entries b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/empleados/.svn/entries new file mode 100644 index 0000000..ab524e8 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/empleados/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/empleados +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +LovEmpleadosSbs.java +file + + + + +2022-07-28T03:40:39.521789Z +596bfdb1224ea4d72c3c14941c54ae8c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1112 + +UsuarioPorCiudad.java +file + + + + +2022-07-28T03:40:39.521789Z +64298cac77bd37c4d9277171fa553537 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1383 + +NotificacionMovilizacion.java +file + + + + +2022-07-28T03:40:39.522789Z +afb2a8b3ac0b8d391a72f1f29ca0de1a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1444 + diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/empleados/.svn/text-base/LovEmpleadosSbs.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/empleados/.svn/text-base/LovEmpleadosSbs.java.svn-base new file mode 100644 index 0000000..d0ef3d6 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/empleados/.svn/text-base/LovEmpleadosSbs.java.svn-base @@ -0,0 +1,32 @@ +package com.fp.viaticos.rules.query.empleados; + +import java.sql.Date; +import java.util.List; + +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; + +/** + * Clase que se encarga de consultar en la vista HRA.VWDATOSEMPLEADOS de empleados de la sbs dado un dtoquery. + * + * @author Jorge Vaca + * @version 2.1 + */ +@SuppressWarnings("serial") +public class LovEmpleadosSbs extends QueryRule{ + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + DtoQuery dtoquery = pQueryRequest.getQueryTables().get("LOVEMPLEADOSSBS"); + EmpleadoJpql e = new EmpleadoJpql(); + List lempleados = e.find(dtoquery); + pQueryRequest.getResponse().put("LOVEMPLEADOSSBS", lempleados); + pQueryRequest.getResponse().put("DATE", FormatDates.getInstance().getDataBaseDate()); + return pQueryRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/empleados/.svn/text-base/NotificacionMovilizacion.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/empleados/.svn/text-base/NotificacionMovilizacion.java.svn-base new file mode 100644 index 0000000..f15b1f6 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/empleados/.svn/text-base/NotificacionMovilizacion.java.svn-base @@ -0,0 +1,41 @@ +package com.fp.viaticos.rules.query.empleados; + +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.param.ViaNotificacionMovilizacion; + +/** + * Clase que se encarga de consultar datos de VIA_CIUDAD_USUARIO, y el nombre del empleado sbs asociado al codigo de + * usuario web. + * + * @author Jorge Vaca + * @version 2.1 + */ +@SuppressWarnings("serial") +public class NotificacionMovilizacion extends QueryRule { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.QueryRule#process(com.fp.dto.query.QueryRequest) + */ + @SuppressWarnings({ "unchecked" }) + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + QueryJsf qf = new QueryJsf(); + qf.execute(pQueryRequest); + List ldata = (List) pQueryRequest.getResponse().get("NOTIFIACIONMOVILIZACION"); + for (ViaNotificacionMovilizacion obj : ldata) { + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado e = ejpql.findPorUsuarioWeb(obj.getCod_usuario().toLowerCase()); + obj.addAddtionalInfo("nusuario", e.getNombre()); + } + return pQueryRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/empleados/.svn/text-base/UsuarioPorCiudad.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/empleados/.svn/text-base/UsuarioPorCiudad.java.svn-base new file mode 100644 index 0000000..51f27a7 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/empleados/.svn/text-base/UsuarioPorCiudad.java.svn-base @@ -0,0 +1,41 @@ +package com.fp.viaticos.rules.query.empleados; + +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.param.ViaCiudadUsuario; + +/** + * Clase que se encarga de consultar datos de VIA_CIUDAD_USUARIO, y el nombre del empleado sbs asociado al codigo de + * usuario web.. + * + * @author Jorge Vaca + * @version 2.1 + */ +@SuppressWarnings("serial") +public class UsuarioPorCiudad extends QueryRule { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.QueryRule#process(com.fp.dto.query.QueryRequest) + */ + @SuppressWarnings({ "unchecked" }) + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + QueryJsf qf = new QueryJsf(); + qf.execute(pQueryRequest); + List ldata = (List) pQueryRequest.getResponse().get("CIUDADUSUARIO"); + for (ViaCiudadUsuario obj : ldata) { + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado e = ejpql.findPorUsuarioWeb(obj.getCod_usuario().toLowerCase()); + obj.addAddtionalInfo("nusuario", e.getNombre()); + } + return pQueryRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/empleados/LovEmpleadosSbs.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/empleados/LovEmpleadosSbs.java new file mode 100644 index 0000000..d0ef3d6 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/empleados/LovEmpleadosSbs.java @@ -0,0 +1,32 @@ +package com.fp.viaticos.rules.query.empleados; + +import java.sql.Date; +import java.util.List; + +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; + +/** + * Clase que se encarga de consultar en la vista HRA.VWDATOSEMPLEADOS de empleados de la sbs dado un dtoquery. + * + * @author Jorge Vaca + * @version 2.1 + */ +@SuppressWarnings("serial") +public class LovEmpleadosSbs extends QueryRule{ + + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + DtoQuery dtoquery = pQueryRequest.getQueryTables().get("LOVEMPLEADOSSBS"); + EmpleadoJpql e = new EmpleadoJpql(); + List lempleados = e.find(dtoquery); + pQueryRequest.getResponse().put("LOVEMPLEADOSSBS", lempleados); + pQueryRequest.getResponse().put("DATE", FormatDates.getInstance().getDataBaseDate()); + return pQueryRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/empleados/NotificacionMovilizacion.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/empleados/NotificacionMovilizacion.java new file mode 100644 index 0000000..f15b1f6 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/empleados/NotificacionMovilizacion.java @@ -0,0 +1,41 @@ +package com.fp.viaticos.rules.query.empleados; + +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.param.ViaNotificacionMovilizacion; + +/** + * Clase que se encarga de consultar datos de VIA_CIUDAD_USUARIO, y el nombre del empleado sbs asociado al codigo de + * usuario web. + * + * @author Jorge Vaca + * @version 2.1 + */ +@SuppressWarnings("serial") +public class NotificacionMovilizacion extends QueryRule { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.QueryRule#process(com.fp.dto.query.QueryRequest) + */ + @SuppressWarnings({ "unchecked" }) + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + QueryJsf qf = new QueryJsf(); + qf.execute(pQueryRequest); + List ldata = (List) pQueryRequest.getResponse().get("NOTIFIACIONMOVILIZACION"); + for (ViaNotificacionMovilizacion obj : ldata) { + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado e = ejpql.findPorUsuarioWeb(obj.getCod_usuario().toLowerCase()); + obj.addAddtionalInfo("nusuario", e.getNombre()); + } + return pQueryRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/empleados/UsuarioPorCiudad.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/empleados/UsuarioPorCiudad.java new file mode 100644 index 0000000..51f27a7 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/empleados/UsuarioPorCiudad.java @@ -0,0 +1,41 @@ +package com.fp.viaticos.rules.query.empleados; + +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.param.ViaCiudadUsuario; + +/** + * Clase que se encarga de consultar datos de VIA_CIUDAD_USUARIO, y el nombre del empleado sbs asociado al codigo de + * usuario web.. + * + * @author Jorge Vaca + * @version 2.1 + */ +@SuppressWarnings("serial") +public class UsuarioPorCiudad extends QueryRule { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.QueryRule#process(com.fp.dto.query.QueryRequest) + */ + @SuppressWarnings({ "unchecked" }) + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + QueryJsf qf = new QueryJsf(); + qf.execute(pQueryRequest); + List ldata = (List) pQueryRequest.getResponse().get("CIUDADUSUARIO"); + for (ViaCiudadUsuario obj : ldata) { + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado e = ejpql.findPorUsuarioWeb(obj.getCod_usuario().toLowerCase()); + obj.addAddtionalInfo("nusuario", e.getNombre()); + } + return pQueryRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/general/.svn/entries b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/general/.svn/entries new file mode 100644 index 0000000..45b5386 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/general/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/general +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +DiasAcumulados.java +file + + + + +2022-07-28T03:40:39.552789Z +39731d581aafc11dc3c7711ab03cf63c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1731 + diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/general/.svn/text-base/DiasAcumulados.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/general/.svn/text-base/DiasAcumulados.java.svn-base new file mode 100644 index 0000000..a272d1a --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/general/.svn/text-base/DiasAcumulados.java.svn-base @@ -0,0 +1,58 @@ +package com.fp.viaticos.rules.query.general; + +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.param.ViaDiasAcumulados; +import com.fp.viaticos.rules.query.destino.DestinoQuery; + +public class DiasAcumulados extends QueryRule{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pQrequest) throws Exception { + Response response = pQrequest.getResponse(); + QueryJsf query = new QueryJsf(); + query.execute(pQrequest); + List acumulados = (List)response.get("DIASACUMULADOS"); + this.completarDatos(acumulados); + return pQrequest; + } + + /** + * Método que completa los datos de los comentarios + * @param comentarios Lista de objetos tipo ViaSolicitudComentarios + */ + private void completarDatos(List acumulados) throws Exception{ + if(acumulados==null || acumulados.isEmpty()){ + return; + } + for(Object objeto: acumulados){ + ViaDiasAcumulados acumulado = (ViaDiasAcumulados)objeto; + Empleado emp = null; + EmpleadoJpql e = new EmpleadoJpql(); + //empleado + emp = e.find(acumulado.getPk().getCod_empleado()); + if(emp!=null){ + acumulado.modifiedData.put("empleado", emp.getNombre()); + } + + //Destino + DestinoQuery qry = new DestinoQuery(); + Object[] destino = (Object[])qry.find(acumulado.getPk().getCod_destino()); + if(destino!=null){ + acumulado.modifiedData.put("destino", destino[1]); + } + } + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/general/DiasAcumulados.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/general/DiasAcumulados.java new file mode 100644 index 0000000..a272d1a --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/general/DiasAcumulados.java @@ -0,0 +1,58 @@ +package com.fp.viaticos.rules.query.general; + +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.param.ViaDiasAcumulados; +import com.fp.viaticos.rules.query.destino.DestinoQuery; + +public class DiasAcumulados extends QueryRule{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pQrequest) throws Exception { + Response response = pQrequest.getResponse(); + QueryJsf query = new QueryJsf(); + query.execute(pQrequest); + List acumulados = (List)response.get("DIASACUMULADOS"); + this.completarDatos(acumulados); + return pQrequest; + } + + /** + * Método que completa los datos de los comentarios + * @param comentarios Lista de objetos tipo ViaSolicitudComentarios + */ + private void completarDatos(List acumulados) throws Exception{ + if(acumulados==null || acumulados.isEmpty()){ + return; + } + for(Object objeto: acumulados){ + ViaDiasAcumulados acumulado = (ViaDiasAcumulados)objeto; + Empleado emp = null; + EmpleadoJpql e = new EmpleadoJpql(); + //empleado + emp = e.find(acumulado.getPk().getCod_empleado()); + if(emp!=null){ + acumulado.modifiedData.put("empleado", emp.getNombre()); + } + + //Destino + DestinoQuery qry = new DestinoQuery(); + Object[] destino = (Object[])qry.find(acumulado.getPk().getCod_destino()); + if(destino!=null){ + acumulado.modifiedData.put("destino", destino[1]); + } + } + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/informe/.svn/entries b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/informe/.svn/entries new file mode 100644 index 0000000..d525b99 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/informe/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/informe +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +Informe.java +file + + + + +2022-07-28T03:40:39.447789Z +bb6283f149e7b47649d020f11a696600 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4710 + diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/informe/.svn/text-base/Informe.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/informe/.svn/text-base/Informe.java.svn-base new file mode 100644 index 0000000..deb6c8f --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/informe/.svn/text-base/Informe.java.svn-base @@ -0,0 +1,139 @@ +package com.fp.viaticos.rules.query.informe; + +import java.util.ArrayList; +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudIntegrantes; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudTransporte; +import com.fp.viaticos.rules.consulta.solicitud.ConsultaSolicitud; +import com.fp.viaticos.rules.enums.EnumCodigos; + +public class Informe extends QueryRule{ + + /** + * Clase que clona los objetos de la solicitud para el informe + */ + private static final long serialVersionUID = 1L; + + /** + * Metodo sobreescrito para gestionar la respuesta de la consulta + */ + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + + String codSolicitud = (String)pQueryRequest.get("csolicitud"); + + ViaSolicitud informe = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(codSolicitud, EnumCodigos.INFORME.getCodigo())); + if(informe!=null){ + return pQueryRequest; + } + + this.fijaFiltrosSolicitud(pQueryRequest); + + Response response = pQueryRequest.getResponse(); + QueryJsf query = new QueryJsf(); + query.execute(pQueryRequest); + + Object object=response.get("SOLICITUD"); + List objectIntegrantes=(List)response.get("SOLICITUDINTEGRANTES"); + List objectTransporte=(List)response.get("SOLICITUDTRANSPORTE"); + + if(object == null){ + return pQueryRequest; + } + + ViaSolicitud solicitud = (ViaSolicitud) object; + solicitud = (ViaSolicitud)solicitud.cloneMe(); + solicitud.setIsnew(true); + ConsultaSolicitud data = new ConsultaSolicitud(); + solicitud.setFec_creacion(FormatDates.getInstance().getDataBaseDate()); + data.completeInfoSolicitud(solicitud); + + response.put("SOLICITUD", solicitud); + response.put("SOLICITUDINTEGRANTES", this.cloneIntegrantes(objectIntegrantes)); + response.put("SOLICITUDTRANSPORTE", this.cloneTransporte(objectTransporte)); + response.put("CLONE", "Y"); + + return pQueryRequest; + } + /** + * Método para cambio de filtros + */ + public void fijaFiltrosSolicitud(QueryRequest pQueryRequest) throws Exception{ + + DtoQuery dtoQuery = (DtoQuery)pQueryRequest.getQueryTables().get("SOLICITUD"); + DtoQuery dtoQueryInt = (DtoQuery)pQueryRequest.getQueryTables().get("SOLICITUDINTEGRANTES"); + DtoQuery dtoQueryTra = (DtoQuery)pQueryRequest.getQueryTables().get("SOLICITUDTRANSPORTE"); + + List filtros = dtoQuery.getLfilter(); + List filtrosInt = dtoQueryInt.getLfilter(); + List filtrosTra = dtoQueryTra.getLfilter(); + + for(Filter filtro: filtros){ + if(filtro.getField().equals("pk.cod_tipo")){ + filtro.setValue(EnumCodigos.SOLICITUD.getCodigo()); + break; + } + } + for(Filter filtro: filtrosInt){ + if(filtro.getField().equals("pk.cod_tipo")){ + filtro.setValue(EnumCodigos.SOLICITUD.getCodigo()); + break; + } + } + for(Filter filtro: filtrosTra){ + if(filtro.getField().equals("pk.cod_tipo")){ + filtro.setValue(EnumCodigos.SOLICITUD.getCodigo()); + break; + } + } + } + /** + * Mtodo para clonar la lista de objetos ViaSolicitudIntegrantes + * @param object + */ + private List cloneIntegrantes(List objects) throws Exception { + List listIntegrantes = new ArrayList(); + ViaSolicitudIntegrantes integrante; + + for(Object objeto:objects) + { + integrante = (ViaSolicitudIntegrantes)objeto; + ViaSolicitudIntegrantes inte = (ViaSolicitudIntegrantes)integrante.cloneMe(); + listIntegrantes.add(inte); + } + ConsultaSolicitud data = new ConsultaSolicitud(); + data.completeInfoIntegrantes(objects); + return listIntegrantes; + } + + /** + * Mtodo para clonar la lista de objetos ViaSolicitudTransporte + * @param object + */ + private List cloneTransporte(List objects) throws Exception { + List listTransporte = new ArrayList(); + ViaSolicitudTransporte transporte; + + for(Object objeto:objects) + { + transporte = (ViaSolicitudTransporte)objeto; + ViaSolicitudTransporte trans = (ViaSolicitudTransporte)transporte.cloneMe(); + trans.getPk().setCod_secuencia(null); + listTransporte.add(trans); + } + return listTransporte; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/informe/Informe.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/informe/Informe.java new file mode 100644 index 0000000..deb6c8f --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/informe/Informe.java @@ -0,0 +1,139 @@ +package com.fp.viaticos.rules.query.informe; + +import java.util.ArrayList; +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudIntegrantes; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudTransporte; +import com.fp.viaticos.rules.consulta.solicitud.ConsultaSolicitud; +import com.fp.viaticos.rules.enums.EnumCodigos; + +public class Informe extends QueryRule{ + + /** + * Clase que clona los objetos de la solicitud para el informe + */ + private static final long serialVersionUID = 1L; + + /** + * Metodo sobreescrito para gestionar la respuesta de la consulta + */ + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pQueryRequest) throws Exception { + + String codSolicitud = (String)pQueryRequest.get("csolicitud"); + + ViaSolicitud informe = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(codSolicitud, EnumCodigos.INFORME.getCodigo())); + if(informe!=null){ + return pQueryRequest; + } + + this.fijaFiltrosSolicitud(pQueryRequest); + + Response response = pQueryRequest.getResponse(); + QueryJsf query = new QueryJsf(); + query.execute(pQueryRequest); + + Object object=response.get("SOLICITUD"); + List objectIntegrantes=(List)response.get("SOLICITUDINTEGRANTES"); + List objectTransporte=(List)response.get("SOLICITUDTRANSPORTE"); + + if(object == null){ + return pQueryRequest; + } + + ViaSolicitud solicitud = (ViaSolicitud) object; + solicitud = (ViaSolicitud)solicitud.cloneMe(); + solicitud.setIsnew(true); + ConsultaSolicitud data = new ConsultaSolicitud(); + solicitud.setFec_creacion(FormatDates.getInstance().getDataBaseDate()); + data.completeInfoSolicitud(solicitud); + + response.put("SOLICITUD", solicitud); + response.put("SOLICITUDINTEGRANTES", this.cloneIntegrantes(objectIntegrantes)); + response.put("SOLICITUDTRANSPORTE", this.cloneTransporte(objectTransporte)); + response.put("CLONE", "Y"); + + return pQueryRequest; + } + /** + * Método para cambio de filtros + */ + public void fijaFiltrosSolicitud(QueryRequest pQueryRequest) throws Exception{ + + DtoQuery dtoQuery = (DtoQuery)pQueryRequest.getQueryTables().get("SOLICITUD"); + DtoQuery dtoQueryInt = (DtoQuery)pQueryRequest.getQueryTables().get("SOLICITUDINTEGRANTES"); + DtoQuery dtoQueryTra = (DtoQuery)pQueryRequest.getQueryTables().get("SOLICITUDTRANSPORTE"); + + List filtros = dtoQuery.getLfilter(); + List filtrosInt = dtoQueryInt.getLfilter(); + List filtrosTra = dtoQueryTra.getLfilter(); + + for(Filter filtro: filtros){ + if(filtro.getField().equals("pk.cod_tipo")){ + filtro.setValue(EnumCodigos.SOLICITUD.getCodigo()); + break; + } + } + for(Filter filtro: filtrosInt){ + if(filtro.getField().equals("pk.cod_tipo")){ + filtro.setValue(EnumCodigos.SOLICITUD.getCodigo()); + break; + } + } + for(Filter filtro: filtrosTra){ + if(filtro.getField().equals("pk.cod_tipo")){ + filtro.setValue(EnumCodigos.SOLICITUD.getCodigo()); + break; + } + } + } + /** + * Mtodo para clonar la lista de objetos ViaSolicitudIntegrantes + * @param object + */ + private List cloneIntegrantes(List objects) throws Exception { + List listIntegrantes = new ArrayList(); + ViaSolicitudIntegrantes integrante; + + for(Object objeto:objects) + { + integrante = (ViaSolicitudIntegrantes)objeto; + ViaSolicitudIntegrantes inte = (ViaSolicitudIntegrantes)integrante.cloneMe(); + listIntegrantes.add(inte); + } + ConsultaSolicitud data = new ConsultaSolicitud(); + data.completeInfoIntegrantes(objects); + return listIntegrantes; + } + + /** + * Mtodo para clonar la lista de objetos ViaSolicitudTransporte + * @param object + */ + private List cloneTransporte(List objects) throws Exception { + List listTransporte = new ArrayList(); + ViaSolicitudTransporte transporte; + + for(Object objeto:objects) + { + transporte = (ViaSolicitudTransporte)objeto; + ViaSolicitudTransporte trans = (ViaSolicitudTransporte)transporte.cloneMe(); + trans.getPk().setCod_secuencia(null); + listTransporte.add(trans); + } + return listTransporte; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/solicitud/.svn/entries b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/solicitud/.svn/entries new file mode 100644 index 0000000..f1f7b43 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/solicitud/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/solicitud +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ConsultaEstadoSolicitud.java +file + + + + +2022-07-28T03:40:39.478789Z +c2163ab7c22c21beb25ff764c0de7394 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4345 + +ConsultaLovSolicitud.java +file + + + + +2022-07-28T03:40:39.478789Z +b20d658667c048aab98770bb95a40f6d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1490 + diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/solicitud/.svn/text-base/ConsultaEstadoSolicitud.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/solicitud/.svn/text-base/ConsultaEstadoSolicitud.java.svn-base new file mode 100644 index 0000000..f1c1c05 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/solicitud/.svn/text-base/ConsultaEstadoSolicitud.java.svn-base @@ -0,0 +1,132 @@ +package com.fp.viaticos.rules.query.solicitud; + +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; + +public class ConsultaEstadoSolicitud extends QueryRule { + + private static final long serialVersionUID = 1L; + private static String query="select coalesce(sum(val_importe),0) from VIA.via_sol_liquidacion where cod_solicitud = :codSolicitud and cod_tipo = :codTipo"; + private static String queryNomRespDirFin ="SELECT em.apellidos||' '||em.nombres AS NOMBRE FROM HRA.vwdatosempleados em WHERE UPPER(EM.USUARIO_WEB)=" + + "(SELECT ciu.cod_usuario FROM MAIADE.via_ciudad_usuario ciu where ciu.cod_actividad_catalog='TESORERIA' and ciu.cod_ciudad_catalog = :codLocalidad)"; + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pQrequest) throws Exception { + Response response = pQrequest.getResponse(); + QueryJsf query = new QueryJsf(); + query.execute(pQrequest); + + List estadosSolicitud = (List) response + .get("VIASOLICITUDCONSULTA"); + + this.completeInfoSolicitud(estadosSolicitud); + return pQrequest; + } + + + /** + * Completa la información de los integrantes + * + * @param objeto + */ + private void completeInfoSolicitud(List objetos) throws Exception { + if (objetos == null || objetos.isEmpty()) { + return; + } + for (Object obj : objetos) { + + ViaSolicitud solicitud = (ViaSolicitud) obj; + EmpleadoJpql e = new EmpleadoJpql(); + Empleado emp = e.find(solicitud.getCod_empleado()); + + solicitud.modifiedData.put("nombrefuncionario", emp.getNombre()); + + if (solicitud.getCod_jefe() != null) { + Empleado jefe = e.find(solicitud.getCod_jefe()); + if (jefe != null) { + solicitud.modifiedData.put("nombrejefe", jefe.getNombreJefe()); + solicitud.modifiedData.put("cargojefe", jefe.getNombreCargoJefe()); + } + }else + { + if (emp != null) { + solicitud.modifiedData.put("nombrejefe", emp.getNombreJefe()); + solicitud.modifiedData.put("cargojefe", emp.getNombreCargo()); + } + } + + if (solicitud.getCod_responsable() != null) { + + Empleado responsable = e.find(solicitud.getCod_responsable()); + if (responsable != null) { + solicitud.modifiedData.put("nombreresponsable",responsable.getNombreResponsableUnidad()); + solicitud.modifiedData.put("cargoresponsable",responsable.getNombreCargoResponsableUnidad()); + } + } + else + { + if (emp != null) { + solicitud.modifiedData.put("nombreresponsable", emp.getNombreResponsableUnidad()); + solicitud.modifiedData.put("cargoresponsable", emp.getNombreCargoResponsableUnidad()); + } + } + + solicitud.modifiedData.put("gastos",this.getGastos(solicitud)); + solicitud.modifiedData.put("nomResDirFin", this.getNomRespDirFin(emp)==null?"":this.getNomRespDirFin(emp)); + + } + + } + + /** + * Método para obtener el nombre del responsable de la Dirección Financiera + * @param empleado + * @return + * @throws CommondbException + */ + private String getNomRespDirFin(Empleado empleado) throws CommondbException + { + String value = null; + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(queryNomRespDirFin); + qry.setParameter("codLocalidad", empleado.getCodigoLocalidad()); + try{ + value = (String)qry.getSingleResult(); + }catch(NoResultException ex){ + value = null; + } + return value; + } + + + /** + * Método para obtener los gastos totalizados por solicitud y tipo de documento + * @param solicitud + * @return + * @throws CommondbException + */ + private BigDecimal getGastos(ViaSolicitud solicitud) throws CommondbException + { + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(query); + + qry.setParameter("codSolicitud", solicitud.getPk().getCod_solicitud()); + qry.setParameter("codTipo", solicitud.getPk().getCod_tipo()); + + return (BigDecimal)qry.getSingleResult(); + } + + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/solicitud/.svn/text-base/ConsultaLovSolicitud.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/solicitud/.svn/text-base/ConsultaLovSolicitud.java.svn-base new file mode 100644 index 0000000..a3b44dc --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/solicitud/.svn/text-base/ConsultaLovSolicitud.java.svn-base @@ -0,0 +1,53 @@ +package com.fp.viaticos.rules.query.solicitud; + +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.viaticos.rules.query.destino.DestinoQuery; + +public class ConsultaLovSolicitud extends QueryRule{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + @Override + public QueryRequest process(QueryRequest pQrequest) throws Exception { + Response response = pQrequest.getResponse(); + QueryJsf query = new QueryJsf(); + query.execute(pQrequest); + List solicitudes = (List)response.get("SOLICITUDLOV"); + this.completeInfoSolicitud(solicitudes); + return null; + } + + /** + * Completa los datos de la solicitud + * @param List Objetos ViaSolicitud + * @throws Exception + */ + public void completeInfoSolicitud(List objects) throws Exception{ + if(objects==null){ + return; + } + for(Object object: objects){ + ViaSolicitud solicitud = (ViaSolicitud)object; + DestinoQuery qry = new DestinoQuery(); + //Destino + Object obj = qry.find(solicitud.getCod_destino()); + if(obj!=null){ + Object[] destino = (Object[])obj; + solicitud.modifiedData.put("destinoname", destino[1]); + } + } + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/solicitud/ConsultaEstadoSolicitud.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/solicitud/ConsultaEstadoSolicitud.java new file mode 100644 index 0000000..f1c1c05 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/solicitud/ConsultaEstadoSolicitud.java @@ -0,0 +1,132 @@ +package com.fp.viaticos.rules.query.solicitud; + +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; + +public class ConsultaEstadoSolicitud extends QueryRule { + + private static final long serialVersionUID = 1L; + private static String query="select coalesce(sum(val_importe),0) from VIA.via_sol_liquidacion where cod_solicitud = :codSolicitud and cod_tipo = :codTipo"; + private static String queryNomRespDirFin ="SELECT em.apellidos||' '||em.nombres AS NOMBRE FROM HRA.vwdatosempleados em WHERE UPPER(EM.USUARIO_WEB)=" + + "(SELECT ciu.cod_usuario FROM MAIADE.via_ciudad_usuario ciu where ciu.cod_actividad_catalog='TESORERIA' and ciu.cod_ciudad_catalog = :codLocalidad)"; + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest pQrequest) throws Exception { + Response response = pQrequest.getResponse(); + QueryJsf query = new QueryJsf(); + query.execute(pQrequest); + + List estadosSolicitud = (List) response + .get("VIASOLICITUDCONSULTA"); + + this.completeInfoSolicitud(estadosSolicitud); + return pQrequest; + } + + + /** + * Completa la información de los integrantes + * + * @param objeto + */ + private void completeInfoSolicitud(List objetos) throws Exception { + if (objetos == null || objetos.isEmpty()) { + return; + } + for (Object obj : objetos) { + + ViaSolicitud solicitud = (ViaSolicitud) obj; + EmpleadoJpql e = new EmpleadoJpql(); + Empleado emp = e.find(solicitud.getCod_empleado()); + + solicitud.modifiedData.put("nombrefuncionario", emp.getNombre()); + + if (solicitud.getCod_jefe() != null) { + Empleado jefe = e.find(solicitud.getCod_jefe()); + if (jefe != null) { + solicitud.modifiedData.put("nombrejefe", jefe.getNombreJefe()); + solicitud.modifiedData.put("cargojefe", jefe.getNombreCargoJefe()); + } + }else + { + if (emp != null) { + solicitud.modifiedData.put("nombrejefe", emp.getNombreJefe()); + solicitud.modifiedData.put("cargojefe", emp.getNombreCargo()); + } + } + + if (solicitud.getCod_responsable() != null) { + + Empleado responsable = e.find(solicitud.getCod_responsable()); + if (responsable != null) { + solicitud.modifiedData.put("nombreresponsable",responsable.getNombreResponsableUnidad()); + solicitud.modifiedData.put("cargoresponsable",responsable.getNombreCargoResponsableUnidad()); + } + } + else + { + if (emp != null) { + solicitud.modifiedData.put("nombreresponsable", emp.getNombreResponsableUnidad()); + solicitud.modifiedData.put("cargoresponsable", emp.getNombreCargoResponsableUnidad()); + } + } + + solicitud.modifiedData.put("gastos",this.getGastos(solicitud)); + solicitud.modifiedData.put("nomResDirFin", this.getNomRespDirFin(emp)==null?"":this.getNomRespDirFin(emp)); + + } + + } + + /** + * Método para obtener el nombre del responsable de la Dirección Financiera + * @param empleado + * @return + * @throws CommondbException + */ + private String getNomRespDirFin(Empleado empleado) throws CommondbException + { + String value = null; + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(queryNomRespDirFin); + qry.setParameter("codLocalidad", empleado.getCodigoLocalidad()); + try{ + value = (String)qry.getSingleResult(); + }catch(NoResultException ex){ + value = null; + } + return value; + } + + + /** + * Método para obtener los gastos totalizados por solicitud y tipo de documento + * @param solicitud + * @return + * @throws CommondbException + */ + private BigDecimal getGastos(ViaSolicitud solicitud) throws CommondbException + { + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(query); + + qry.setParameter("codSolicitud", solicitud.getPk().getCod_solicitud()); + qry.setParameter("codTipo", solicitud.getPk().getCod_tipo()); + + return (BigDecimal)qry.getSingleResult(); + } + + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/solicitud/ConsultaLovSolicitud.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/solicitud/ConsultaLovSolicitud.java new file mode 100644 index 0000000..a3b44dc --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/query/solicitud/ConsultaLovSolicitud.java @@ -0,0 +1,53 @@ +package com.fp.viaticos.rules.query.solicitud; + +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.viaticos.rules.query.destino.DestinoQuery; + +public class ConsultaLovSolicitud extends QueryRule{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + @Override + public QueryRequest process(QueryRequest pQrequest) throws Exception { + Response response = pQrequest.getResponse(); + QueryJsf query = new QueryJsf(); + query.execute(pQrequest); + List solicitudes = (List)response.get("SOLICITUDLOV"); + this.completeInfoSolicitud(solicitudes); + return null; + } + + /** + * Completa los datos de la solicitud + * @param List Objetos ViaSolicitud + * @throws Exception + */ + public void completeInfoSolicitud(List objects) throws Exception{ + if(objects==null){ + return; + } + for(Object object: objects){ + ViaSolicitud solicitud = (ViaSolicitud)object; + DestinoQuery qry = new DestinoQuery(); + //Destino + Object obj = qry.find(solicitud.getCod_destino()); + if(obj!=null){ + Object[] destino = (Object[])obj; + solicitud.modifiedData.put("destinoname", destino[1]); + } + } + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/.svn/entries b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/.svn/entries new file mode 100644 index 0000000..c4531cf --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save +svn://172.17.26.185/COMACO + + + +2015-06-23T07:17:36.315401Z +4128 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +solicitud +dir + +acumulados +dir + diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/acumulados/.svn/entries b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/acumulados/.svn/entries new file mode 100644 index 0000000..70be502 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/acumulados/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/acumulados +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +DiasAcumulados.java +file + + + + +2022-07-28T03:40:39.877791Z +023012b41e04c8e3183e6424829007cd +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2462 + diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/acumulados/.svn/text-base/DiasAcumulados.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/acumulados/.svn/text-base/DiasAcumulados.java.svn-base new file mode 100644 index 0000000..7363ab3 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/acumulados/.svn/text-base/DiasAcumulados.java.svn-base @@ -0,0 +1,77 @@ +package com.fp.viaticos.rules.save.acumulados; + +import java.math.BigDecimal; +import java.sql.Date; +import java.util.Calendar; +import java.util.List; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.param.ViaDiasAcumulados; +import com.fp.persistence.pviaticos.param.ViaDiasAcumuladosKey; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.viaticos.rules.enums.EnumCodigos; +/** + * Clase que se encarga de completar informacin para acumulacion de dias en la solicitud de viaticos. + * + * @author WPA. + * @version 2.1 + */ +public class DiasAcumulados extends TransactionRule { + + private static final long serialVersionUID = 1L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (Constant.ifYes((String) pSaveRequest.get("isnew")) || pSaveRequest.get("csolicitud") == null) { + return pSaveRequest; + } + + String solicitud = (String)pSaveRequest.get("csolicitud"); + + ViaSolicitud informe = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, EnumCodigos.INFORME.getCodigo())); + if(informe == null){ + return pSaveRequest; + } + + ViaDiasAcumuladosKey key = new ViaDiasAcumuladosKey(); + key.setCod_destino(informe.getCod_destino()); + key.setCod_ejercicio(this.getYear(informe.getFec_creacion())); + key.setCod_empleado(informe.getCod_empleado()); + + ViaDiasAcumulados acumulado = ViaDiasAcumulados.find(PersistenceHelper.getEntityManager(), key); + + if(acumulado!=null){ + BigDecimal dias = acumulado.getNum_dias().add(informe.getNum_dias()); + acumulado.setNum_dias(dias); + + }else{ + acumulado = new ViaDiasAcumulados(); + acumulado.setPk(key); + acumulado.setNum_dias(informe.getNum_dias()); + PersistenceHelper.saveOrUpdate(acumulado); + } + + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + /** + * Entrega el anio + * @param date Fecha + * @return year + */ + private Integer getYear(Date date){ + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + return calendar.get(Calendar.YEAR); + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/acumulados/DiasAcumulados.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/acumulados/DiasAcumulados.java new file mode 100644 index 0000000..7363ab3 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/acumulados/DiasAcumulados.java @@ -0,0 +1,77 @@ +package com.fp.viaticos.rules.save.acumulados; + +import java.math.BigDecimal; +import java.sql.Date; +import java.util.Calendar; +import java.util.List; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.param.ViaDiasAcumulados; +import com.fp.persistence.pviaticos.param.ViaDiasAcumuladosKey; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.viaticos.rules.enums.EnumCodigos; +/** + * Clase que se encarga de completar informacin para acumulacion de dias en la solicitud de viaticos. + * + * @author WPA. + * @version 2.1 + */ +public class DiasAcumulados extends TransactionRule { + + private static final long serialVersionUID = 1L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (Constant.ifYes((String) pSaveRequest.get("isnew")) || pSaveRequest.get("csolicitud") == null) { + return pSaveRequest; + } + + String solicitud = (String)pSaveRequest.get("csolicitud"); + + ViaSolicitud informe = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, EnumCodigos.INFORME.getCodigo())); + if(informe == null){ + return pSaveRequest; + } + + ViaDiasAcumuladosKey key = new ViaDiasAcumuladosKey(); + key.setCod_destino(informe.getCod_destino()); + key.setCod_ejercicio(this.getYear(informe.getFec_creacion())); + key.setCod_empleado(informe.getCod_empleado()); + + ViaDiasAcumulados acumulado = ViaDiasAcumulados.find(PersistenceHelper.getEntityManager(), key); + + if(acumulado!=null){ + BigDecimal dias = acumulado.getNum_dias().add(informe.getNum_dias()); + acumulado.setNum_dias(dias); + + }else{ + acumulado = new ViaDiasAcumulados(); + acumulado.setPk(key); + acumulado.setNum_dias(informe.getNum_dias()); + PersistenceHelper.saveOrUpdate(acumulado); + } + + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + /** + * Entrega el anio + * @param date Fecha + * @return year + */ + private Integer getYear(Date date){ + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + return calendar.get(Calendar.YEAR); + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/.svn/entries b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/.svn/entries new file mode 100644 index 0000000..792c16c --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/.svn/entries @@ -0,0 +1,201 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud +svn://172.17.26.185/COMACO + + + +2015-06-23T07:17:36.315401Z +4128 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +Solicitud.java +file + + + + +2022-07-28T03:40:39.827790Z +7f1a6521f5aa8cbfaddb3fb5147408f8 +2015-06-23T07:17:36.315401Z +4128 +cpiedra + + + + + + + + + + + + + + + + + + + + + +2129 + +SolicitudTransporte.java +file + + + + +2022-07-28T03:40:39.827790Z +25f16b2f23662e1353aeca858d963893 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1790 + +estados +dir + +Comentarios.java +file + + + + +2022-07-28T03:40:39.828790Z +52fd902388be70b3ea569d4dd6c589f2 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3012 + +SolicitudIntegrantes.java +file + + + + +2022-07-28T03:40:39.828790Z +fd19052b4417aab259c112bf13c30142 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1780 + +ValidaFeriados.java +file + + + + +2022-07-28T03:40:39.828790Z +b222f74f04a3a650d42f97acdd08a702 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7753 + diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/.svn/text-base/Comentarios.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/.svn/text-base/Comentarios.java.svn-base new file mode 100644 index 0000000..0796b90 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/.svn/text-base/Comentarios.java.svn-base @@ -0,0 +1,73 @@ +package com.fp.viaticos.rules.save.solicitud; + +import java.sql.Date; +import java.text.SimpleDateFormat; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudComentarios; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudComentariosKey; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.viaticos.rules.enums.EnumCodigos; + +/** + * Clase que se encarga de almacenar comentarios de la tarea y el estatus actual de la solicitud. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class Comentarios extends TransactionRule { + + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (pSaveRequest.get("csolicitud") == null || pSaveRequest.get("BPMStatus") == null || pSaveRequest.get("tipo") == null) { + return pSaveRequest; + } + String csolicitud = pSaveRequest.getString("csolicitud"); + // El estado y los comentarios solo van a la solicitud. + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(csolicitud, EnumCodigos.SOLICITUD.getCodigo())); + this.crearComentario(pSaveRequest, vsol); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + private void crearComentario(SaveRequest pSaveRequest, ViaSolicitud vsol) throws Exception { + ViaSolicitudComentariosKey key = new ViaSolicitudComentariosKey(); + key.setCod_solicitud(vsol.getPk().getCod_solicitud()); + key.setCod_tipo(vsol.getPk().getCod_tipo()); + + ViaSolicitudComentarios comen = new ViaSolicitudComentarios(key); + comen.setCod_estado(vsol.getCod_estado()); + comen.setCod_usuario(pSaveRequest.getUser()); + Date f = FormatDates.getInstance().getDataBaseDate(); + SimpleDateFormat sdf = FormatDates.getInstance().getHourSecondsFormat(); + comen.setFec_comentario(f); + comen.setFec_hora(sdf.format(FormatDates.getInstance().getDataBaseTimestamp())); + comen.setTxt_actividad(pSaveRequest.getString("taskname")); + comen.setTxt_comentario(pSaveRequest.getString("BPMObs")); + // Almacena en la base de datos el comentario. + PersistenceHelper.getEntityManager().persist(comen); + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/.svn/text-base/Solicitud.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/.svn/text-base/Solicitud.java.svn-base new file mode 100644 index 0000000..5870a4c --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/.svn/text-base/Solicitud.java.svn-base @@ -0,0 +1,65 @@ +package com.fp.viaticos.rules.save.solicitud; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Clase que se encarga de completar informacin de una solicitud de viaticos. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class Solicitud extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (Constant.ifYes((String) pSaveRequest.get("isnew")) || pSaveRequest.get("csolicitud") != null) { + return pSaveRequest; + } + String codSolicitud = null; + ViaSolicitud viasolicitud = (ViaSolicitud) pSaveRequest.getSaveBeanModifiedObject("SOLICITUD"); + if (viasolicitud == null) { + return pSaveRequest; + } + codSolicitud = viasolicitud.getPk().getCod_solicitud(); + if (viasolicitud.getPk().getCod_solicitud() == null) { + codSolicitud = this.getCodigoSolicitud(); + viasolicitud.getPk().setCod_solicitud(codSolicitud); + pSaveRequest.put("csolicitud", codSolicitud); + } + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + /** + * Metodo que devuelve la secuencia de una solicitud de viaticos. + * + * @return Codigo de la nueva solicitud de viaticos. + * @throws Exception + */ + private String getCodigoSolicitud() throws Exception { + Sequence sequence = new Sequence(); + Integer solcitud = Integer.valueOf(sequence.getNextValue("VIATICOS").toString()); + return solcitud.toString(); + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/.svn/text-base/SolicitudIntegrantes.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/.svn/text-base/SolicitudIntegrantes.java.svn-base new file mode 100644 index 0000000..fd0718d --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/.svn/text-base/SolicitudIntegrantes.java.svn-base @@ -0,0 +1,54 @@ +package com.fp.viaticos.rules.save.solicitud; + +import java.util.List; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudIntegrantes; + +/** + * Clase que se encarga de completar informacin de integrantes de una solicitud de viaticos. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class SolicitudIntegrantes extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (Constant.ifYes((String) pSaveRequest.get("isnew")) || pSaveRequest.get("csolicitud") == null) { + return pSaveRequest; + } + String codSolicitud = (String) pSaveRequest.get("csolicitud"); + List lintegrantes = pSaveRequest.getSaveBeanModifiedRecords("SOLICITUDINTEGRANTES"); + if(lintegrantes==null || lintegrantes.isEmpty()){ + return null; + } + for (Object object : lintegrantes) { + ViaSolicitudIntegrantes obj = (ViaSolicitudIntegrantes) object; + if (obj.getPk().getCod_solicitud() == null) { + obj.getPk().setCod_solicitud(codSolicitud); + } + } + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/.svn/text-base/SolicitudTransporte.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/.svn/text-base/SolicitudTransporte.java.svn-base new file mode 100644 index 0000000..2331bcc --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/.svn/text-base/SolicitudTransporte.java.svn-base @@ -0,0 +1,54 @@ +package com.fp.viaticos.rules.save.solicitud; + +import java.util.List; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudTransporte; + +/** + * Clase que se encarga de completar informacin de medios de transporte utilizados en la solicitud de viaticos. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class SolicitudTransporte extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (Constant.ifYes((String) pSaveRequest.get("isnew")) || pSaveRequest.get("csolicitud") == null) { + return pSaveRequest; + } + String codSolicitud = (String) pSaveRequest.get("csolicitud"); + List ltransporte = pSaveRequest.getSaveBeanModifiedRecords("SOLICITUDTRANSPORTE"); + if(ltransporte==null || ltransporte.isEmpty()){ + return null; + } + for (Object object : ltransporte) { + ViaSolicitudTransporte obj = (ViaSolicitudTransporte) object; + if (obj.getPk().getCod_solicitud() == null) { + obj.getPk().setCod_solicitud(codSolicitud); + } + } + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/.svn/text-base/ValidaFeriados.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/.svn/text-base/ValidaFeriados.java.svn-base new file mode 100644 index 0000000..3c1870a --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/.svn/text-base/ValidaFeriados.java.svn-base @@ -0,0 +1,207 @@ +package com.fp.viaticos.rules.save.solicitud; + +import java.math.BigDecimal; +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.List; +import java.util.Locale; + +import javax.persistence.Query; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.param.ViaParametros; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.viaticos.rules.enums.EnumCodigos; +import com.fp.viaticos.rules.exception.ViaticosException; +/** + * Clase que valida las fechas de la solicitud + * @author BPTWPA + * @version 2.1 + */ +public class ValidaFeriados extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /** + * Milisegundos + */ + private static final long MILISEGUNDOS = 24 * 60 * 60 * 1000; + + /** + * Método que ejecuta el proceso de mantenimiento/control + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + + if (Constant.ifYes((String) pSaveRequest.get("isnew")) || pSaveRequest.get("csolicitud") != null) { + return pSaveRequest; + } + + String csolicitud = (String)pSaveRequest.get("csolicitud"); + + ViaSolicitud viasolicitud = (ViaSolicitud) pSaveRequest.getSaveBeanModifiedObject("SOLICITUD"); + if (viasolicitud == null) { + return pSaveRequest; + } + if(csolicitud!=null && viasolicitud.equals(csolicitud)){ + return pSaveRequest; + } + this.validateDates(viasolicitud); + this.validateViatico(viasolicitud); + this.validateSolicitude(viasolicitud); + return pSaveRequest; + } + + /** + * Validaci´n de fechas de la solicitud + * @param solicitud + */ + public void validateSolicitude(ViaSolicitud solicitud) throws Exception{ + + String firstYear = this.getYear(solicitud.getFec_ini_viatico()); + String secondYear = this.getYear(solicitud.getFec_fin_viatico()); + String firstDate = this.getDate(solicitud.getFec_ini_viatico()); + String secondDate = this.getDate(solicitud.getFec_fin_viatico()); + + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(ValidaFeriados.SQL); + qry.setParameter("firstYear", firstYear); + qry.setParameter("secondYear", secondYear); + qry.setParameter("firstDate", firstDate); + qry.setParameter("secondDate", secondDate); + + List feriados = qry.getResultList(); + + if(!feriados.isEmpty()){ + throw new ViaticosException("VIA-0003", "EXISTEN D\u00cdAS FERIADOS PARA EL PERIODO: {0} / {1}", this.getDate(solicitud.getFec_ini_viatico()), this.getDate(solicitud.getFec_fin_viatico())); + } + } + + /** + * Validaci´n de fechas de la solicitud + * @param solicitud + */ + public void validateViatico(ViaSolicitud solicitud) throws Exception{ + + String firstDate = this.getDate(solicitud.getFec_ini_viatico()); + + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(ValidaFeriados.SQL_SOL); + qry.setParameter("firstDate", firstDate); + qry.setParameter("initTime", solicitud.getFec_hora_inicio()); + qry.setParameter("codEmployee", solicitud.getCod_empleado()); + + List solicitudes = qry.getResultList(); + + if(!solicitudes.isEmpty()){ + throw new ViaticosException("VIA-0004", "YA EXISTE UNA SOLICITUD INGRESADA PARA EL PERIODO: {0} / {1}", this.getDate(solicitud.getFec_ini_viatico()), this.getDate(solicitud.getFec_fin_viatico())); + } + } + + /** + * Valída las fechas de comisión + * @param solicitud ViaSolicitud + * @throws Exception + */ + private void validateDates(ViaSolicitud solicitud) throws Exception{ + + long dias = (solicitud.getFec_fin_viatico().getTime() - solicitud.getFec_ini_viatico().getTime()) / ValidaFeriados.MILISEGUNDOS; + + ViaParametros parametroDias = ViaParametros.find(PersistenceHelper.getEntityManager(), EnumCodigos.VIA_03.getCodigo()); + + if(parametroDias==null){ + throw new ViaticosException("VIA-0005", "PAR\u00c1METRO DE N\u00daMERO M\u00c1XIMO DE D\u00CDAS NO ENCONTRADO"); + } + + if(parametroDias.getNum_valor().compareTo(new BigDecimal(dias)) < 0){ + throw new ViaticosException("VIA-0006", "HA EXCEDIDO EL N\u00daMERO DE D\u00cdAS PERMITIDOS PARA EL VI\u00cdTICO"); + } + + if(this.obtieneDia(solicitud.getFec_ini_viatico())==1 || this.obtieneDia(solicitud.getFec_ini_viatico())==7){ + ViaParametros param = ViaParametros.find(PersistenceHelper.getEntityManager(), EnumCodigos.VIA_04.getCodigo()); + if(param.getTex_valor().equals("N")){ + throw new ViaticosException("VIA-0008", "NO PUEDE REGISTRAR UN FIN DE SEMANA COMO SALIDA DEL VI\u00cdTICO {0}",this.getDate(solicitud.getFec_ini_viatico())); + } + } + + if(this.obtieneDia(solicitud.getFec_fin_viatico())==7){ + ViaParametros param = ViaParametros.find(PersistenceHelper.getEntityManager(), EnumCodigos.VIA_05.getCodigo()); + if(param.getTex_valor().equals("N")){ + throw new ViaticosException("VIA-0009", "NO PUEDE REGISTRAR UN FIN DE SEMANA COMO LLEGADA DEL VI\u00cdTICO {0}",this.getDate(solicitud.getFec_fin_viatico())); + } + } + + for(int i=0; i <= dias;i++){ + Date fecha = this.agregarDias(solicitud.getFec_ini_viatico(), i); + int dia = this.obtieneDia(fecha); + if(i == 0 && ( dia == 1 || dia == 7)){ + continue; + } + if(i == dias && dia == 1){ + throw new ViaticosException("VIA-0009", "NO PUEDE REGISTRAR UN FIN DE SEMANA COMO LLEGADA DEL VI\u00cdTICO {0}",this.getDate(solicitud.getFec_fin_viatico())); + } + if(dia == 1 || dia == 7){ + throw new ViaticosException("VIA-0007", "EXISTEn FINES DE SEMANA EN EN EL PERIODO SELECIONADO {0} / {1}",this.getDate(solicitud.getFec_ini_viatico()), this.getDate(solicitud.getFec_fin_viatico())); + } + } + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + // TODO Auto-generated method stub + return pSaveRequest; + } + + /** + * Entrega el anio + * @param date Fecha + * @return year + */ + private String getYear(Date date){ + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + return String.valueOf(calendar.get(Calendar.YEAR)); + } + + /** + * Obtiene la fecha en string + * @param date + * @return + */ + private String getDate(Date date){ + SimpleDateFormat formato = new SimpleDateFormat("dd-MM-yyyy", new Locale("es", "ES")); + return formato.format(date); + } + /** + * Agrega dias a una fecha + */ + private Date agregarDias(Date fecha, int dias) { + Calendar calendario = Calendar.getInstance(); + calendario.setTime(fecha); + calendario.add(Calendar.DATE, dias); + return new Date(calendario.getTime().getTime()); + } + /** + * obriene el dia de la semana + */ + private Integer obtieneDia(Date fecha) { + Calendar cal = Calendar.getInstance(); + cal.setTime(fecha); + return cal.get(Calendar.DAY_OF_WEEK); + } + /** + * Sql del esquema SRM para los dias feriados + */ + private static String SQL = "select FEC_DIA from SRM.SRM_DIAS_FERIADOS " + + "where (to_char(FEC_DIA, 'yyyy') = :firstYear or to_char(FEC_DIA, 'yyyy') = :secondYear) " + + "AND FEC_DIA BETWEEN TO_DATE(:firstDate, 'dd-MM-yyyy') AND TO_DATE(:secondDate, 'dd-MM-yyyy')"; + + /** + * Sql para obtener las solicitudes ingresadas + */ + private static String SQL_SOL = "SELECT DISTINCT(SOL.COD_SOLICITUD) FROM VIA.VIA_SOLICITUD SOL " + + "WHERE SOL.COD_ESTADO NOT IN ('SAN') AND SOL.COD_EMPLEADO = :codEmployee " + + "AND SOL.FEC_FIN_VIATICO >= TO_DATE( :firstDate, 'dd-MM-yyyy') and SOL.FEC_HORA_FIN >= :initTime "; +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/Comentarios.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/Comentarios.java new file mode 100644 index 0000000..0796b90 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/Comentarios.java @@ -0,0 +1,73 @@ +package com.fp.viaticos.rules.save.solicitud; + +import java.sql.Date; +import java.text.SimpleDateFormat; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudComentarios; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudComentariosKey; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.viaticos.rules.enums.EnumCodigos; + +/** + * Clase que se encarga de almacenar comentarios de la tarea y el estatus actual de la solicitud. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class Comentarios extends TransactionRule { + + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (pSaveRequest.get("csolicitud") == null || pSaveRequest.get("BPMStatus") == null || pSaveRequest.get("tipo") == null) { + return pSaveRequest; + } + String csolicitud = pSaveRequest.getString("csolicitud"); + // El estado y los comentarios solo van a la solicitud. + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(csolicitud, EnumCodigos.SOLICITUD.getCodigo())); + this.crearComentario(pSaveRequest, vsol); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + private void crearComentario(SaveRequest pSaveRequest, ViaSolicitud vsol) throws Exception { + ViaSolicitudComentariosKey key = new ViaSolicitudComentariosKey(); + key.setCod_solicitud(vsol.getPk().getCod_solicitud()); + key.setCod_tipo(vsol.getPk().getCod_tipo()); + + ViaSolicitudComentarios comen = new ViaSolicitudComentarios(key); + comen.setCod_estado(vsol.getCod_estado()); + comen.setCod_usuario(pSaveRequest.getUser()); + Date f = FormatDates.getInstance().getDataBaseDate(); + SimpleDateFormat sdf = FormatDates.getInstance().getHourSecondsFormat(); + comen.setFec_comentario(f); + comen.setFec_hora(sdf.format(FormatDates.getInstance().getDataBaseTimestamp())); + comen.setTxt_actividad(pSaveRequest.getString("taskname")); + comen.setTxt_comentario(pSaveRequest.getString("BPMObs")); + // Almacena en la base de datos el comentario. + PersistenceHelper.getEntityManager().persist(comen); + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/Solicitud.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/Solicitud.java new file mode 100644 index 0000000..5870a4c --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/Solicitud.java @@ -0,0 +1,65 @@ +package com.fp.viaticos.rules.save.solicitud; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.sessionbeans.helper.Sequence; + +/** + * Clase que se encarga de completar informacin de una solicitud de viaticos. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class Solicitud extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (Constant.ifYes((String) pSaveRequest.get("isnew")) || pSaveRequest.get("csolicitud") != null) { + return pSaveRequest; + } + String codSolicitud = null; + ViaSolicitud viasolicitud = (ViaSolicitud) pSaveRequest.getSaveBeanModifiedObject("SOLICITUD"); + if (viasolicitud == null) { + return pSaveRequest; + } + codSolicitud = viasolicitud.getPk().getCod_solicitud(); + if (viasolicitud.getPk().getCod_solicitud() == null) { + codSolicitud = this.getCodigoSolicitud(); + viasolicitud.getPk().setCod_solicitud(codSolicitud); + pSaveRequest.put("csolicitud", codSolicitud); + } + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + + /** + * Metodo que devuelve la secuencia de una solicitud de viaticos. + * + * @return Codigo de la nueva solicitud de viaticos. + * @throws Exception + */ + private String getCodigoSolicitud() throws Exception { + Sequence sequence = new Sequence(); + Integer solcitud = Integer.valueOf(sequence.getNextValue("VIATICOS").toString()); + return solcitud.toString(); + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/SolicitudIntegrantes.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/SolicitudIntegrantes.java new file mode 100644 index 0000000..fd0718d --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/SolicitudIntegrantes.java @@ -0,0 +1,54 @@ +package com.fp.viaticos.rules.save.solicitud; + +import java.util.List; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudIntegrantes; + +/** + * Clase que se encarga de completar informacin de integrantes de una solicitud de viaticos. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class SolicitudIntegrantes extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (Constant.ifYes((String) pSaveRequest.get("isnew")) || pSaveRequest.get("csolicitud") == null) { + return pSaveRequest; + } + String codSolicitud = (String) pSaveRequest.get("csolicitud"); + List lintegrantes = pSaveRequest.getSaveBeanModifiedRecords("SOLICITUDINTEGRANTES"); + if(lintegrantes==null || lintegrantes.isEmpty()){ + return null; + } + for (Object object : lintegrantes) { + ViaSolicitudIntegrantes obj = (ViaSolicitudIntegrantes) object; + if (obj.getPk().getCod_solicitud() == null) { + obj.getPk().setCod_solicitud(codSolicitud); + } + } + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/SolicitudTransporte.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/SolicitudTransporte.java new file mode 100644 index 0000000..2331bcc --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/SolicitudTransporte.java @@ -0,0 +1,54 @@ +package com.fp.viaticos.rules.save.solicitud; + +import java.util.List; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudTransporte; + +/** + * Clase que se encarga de completar informacin de medios de transporte utilizados en la solicitud de viaticos. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class SolicitudTransporte extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (Constant.ifYes((String) pSaveRequest.get("isnew")) || pSaveRequest.get("csolicitud") == null) { + return pSaveRequest; + } + String codSolicitud = (String) pSaveRequest.get("csolicitud"); + List ltransporte = pSaveRequest.getSaveBeanModifiedRecords("SOLICITUDTRANSPORTE"); + if(ltransporte==null || ltransporte.isEmpty()){ + return null; + } + for (Object object : ltransporte) { + ViaSolicitudTransporte obj = (ViaSolicitudTransporte) object; + if (obj.getPk().getCod_solicitud() == null) { + obj.getPk().setCod_solicitud(codSolicitud); + } + } + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/ValidaFeriados.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/ValidaFeriados.java new file mode 100644 index 0000000..3c1870a --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/ValidaFeriados.java @@ -0,0 +1,207 @@ +package com.fp.viaticos.rules.save.solicitud; + +import java.math.BigDecimal; +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.List; +import java.util.Locale; + +import javax.persistence.Query; + +import com.fp.common.helper.Constant; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.param.ViaParametros; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.viaticos.rules.enums.EnumCodigos; +import com.fp.viaticos.rules.exception.ViaticosException; +/** + * Clase que valida las fechas de la solicitud + * @author BPTWPA + * @version 2.1 + */ +public class ValidaFeriados extends TransactionRule { + + private static final long serialVersionUID = 1L; + + /** + * Milisegundos + */ + private static final long MILISEGUNDOS = 24 * 60 * 60 * 1000; + + /** + * Método que ejecuta el proceso de mantenimiento/control + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + + if (Constant.ifYes((String) pSaveRequest.get("isnew")) || pSaveRequest.get("csolicitud") != null) { + return pSaveRequest; + } + + String csolicitud = (String)pSaveRequest.get("csolicitud"); + + ViaSolicitud viasolicitud = (ViaSolicitud) pSaveRequest.getSaveBeanModifiedObject("SOLICITUD"); + if (viasolicitud == null) { + return pSaveRequest; + } + if(csolicitud!=null && viasolicitud.equals(csolicitud)){ + return pSaveRequest; + } + this.validateDates(viasolicitud); + this.validateViatico(viasolicitud); + this.validateSolicitude(viasolicitud); + return pSaveRequest; + } + + /** + * Validaci´n de fechas de la solicitud + * @param solicitud + */ + public void validateSolicitude(ViaSolicitud solicitud) throws Exception{ + + String firstYear = this.getYear(solicitud.getFec_ini_viatico()); + String secondYear = this.getYear(solicitud.getFec_fin_viatico()); + String firstDate = this.getDate(solicitud.getFec_ini_viatico()); + String secondDate = this.getDate(solicitud.getFec_fin_viatico()); + + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(ValidaFeriados.SQL); + qry.setParameter("firstYear", firstYear); + qry.setParameter("secondYear", secondYear); + qry.setParameter("firstDate", firstDate); + qry.setParameter("secondDate", secondDate); + + List feriados = qry.getResultList(); + + if(!feriados.isEmpty()){ + throw new ViaticosException("VIA-0003", "EXISTEN D\u00cdAS FERIADOS PARA EL PERIODO: {0} / {1}", this.getDate(solicitud.getFec_ini_viatico()), this.getDate(solicitud.getFec_fin_viatico())); + } + } + + /** + * Validaci´n de fechas de la solicitud + * @param solicitud + */ + public void validateViatico(ViaSolicitud solicitud) throws Exception{ + + String firstDate = this.getDate(solicitud.getFec_ini_viatico()); + + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(ValidaFeriados.SQL_SOL); + qry.setParameter("firstDate", firstDate); + qry.setParameter("initTime", solicitud.getFec_hora_inicio()); + qry.setParameter("codEmployee", solicitud.getCod_empleado()); + + List solicitudes = qry.getResultList(); + + if(!solicitudes.isEmpty()){ + throw new ViaticosException("VIA-0004", "YA EXISTE UNA SOLICITUD INGRESADA PARA EL PERIODO: {0} / {1}", this.getDate(solicitud.getFec_ini_viatico()), this.getDate(solicitud.getFec_fin_viatico())); + } + } + + /** + * Valída las fechas de comisión + * @param solicitud ViaSolicitud + * @throws Exception + */ + private void validateDates(ViaSolicitud solicitud) throws Exception{ + + long dias = (solicitud.getFec_fin_viatico().getTime() - solicitud.getFec_ini_viatico().getTime()) / ValidaFeriados.MILISEGUNDOS; + + ViaParametros parametroDias = ViaParametros.find(PersistenceHelper.getEntityManager(), EnumCodigos.VIA_03.getCodigo()); + + if(parametroDias==null){ + throw new ViaticosException("VIA-0005", "PAR\u00c1METRO DE N\u00daMERO M\u00c1XIMO DE D\u00CDAS NO ENCONTRADO"); + } + + if(parametroDias.getNum_valor().compareTo(new BigDecimal(dias)) < 0){ + throw new ViaticosException("VIA-0006", "HA EXCEDIDO EL N\u00daMERO DE D\u00cdAS PERMITIDOS PARA EL VI\u00cdTICO"); + } + + if(this.obtieneDia(solicitud.getFec_ini_viatico())==1 || this.obtieneDia(solicitud.getFec_ini_viatico())==7){ + ViaParametros param = ViaParametros.find(PersistenceHelper.getEntityManager(), EnumCodigos.VIA_04.getCodigo()); + if(param.getTex_valor().equals("N")){ + throw new ViaticosException("VIA-0008", "NO PUEDE REGISTRAR UN FIN DE SEMANA COMO SALIDA DEL VI\u00cdTICO {0}",this.getDate(solicitud.getFec_ini_viatico())); + } + } + + if(this.obtieneDia(solicitud.getFec_fin_viatico())==7){ + ViaParametros param = ViaParametros.find(PersistenceHelper.getEntityManager(), EnumCodigos.VIA_05.getCodigo()); + if(param.getTex_valor().equals("N")){ + throw new ViaticosException("VIA-0009", "NO PUEDE REGISTRAR UN FIN DE SEMANA COMO LLEGADA DEL VI\u00cdTICO {0}",this.getDate(solicitud.getFec_fin_viatico())); + } + } + + for(int i=0; i <= dias;i++){ + Date fecha = this.agregarDias(solicitud.getFec_ini_viatico(), i); + int dia = this.obtieneDia(fecha); + if(i == 0 && ( dia == 1 || dia == 7)){ + continue; + } + if(i == dias && dia == 1){ + throw new ViaticosException("VIA-0009", "NO PUEDE REGISTRAR UN FIN DE SEMANA COMO LLEGADA DEL VI\u00cdTICO {0}",this.getDate(solicitud.getFec_fin_viatico())); + } + if(dia == 1 || dia == 7){ + throw new ViaticosException("VIA-0007", "EXISTEn FINES DE SEMANA EN EN EL PERIODO SELECIONADO {0} / {1}",this.getDate(solicitud.getFec_ini_viatico()), this.getDate(solicitud.getFec_fin_viatico())); + } + } + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + // TODO Auto-generated method stub + return pSaveRequest; + } + + /** + * Entrega el anio + * @param date Fecha + * @return year + */ + private String getYear(Date date){ + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + return String.valueOf(calendar.get(Calendar.YEAR)); + } + + /** + * Obtiene la fecha en string + * @param date + * @return + */ + private String getDate(Date date){ + SimpleDateFormat formato = new SimpleDateFormat("dd-MM-yyyy", new Locale("es", "ES")); + return formato.format(date); + } + /** + * Agrega dias a una fecha + */ + private Date agregarDias(Date fecha, int dias) { + Calendar calendario = Calendar.getInstance(); + calendario.setTime(fecha); + calendario.add(Calendar.DATE, dias); + return new Date(calendario.getTime().getTime()); + } + /** + * obriene el dia de la semana + */ + private Integer obtieneDia(Date fecha) { + Calendar cal = Calendar.getInstance(); + cal.setTime(fecha); + return cal.get(Calendar.DAY_OF_WEEK); + } + /** + * Sql del esquema SRM para los dias feriados + */ + private static String SQL = "select FEC_DIA from SRM.SRM_DIAS_FERIADOS " + + "where (to_char(FEC_DIA, 'yyyy') = :firstYear or to_char(FEC_DIA, 'yyyy') = :secondYear) " + + "AND FEC_DIA BETWEEN TO_DATE(:firstDate, 'dd-MM-yyyy') AND TO_DATE(:secondDate, 'dd-MM-yyyy')"; + + /** + * Sql para obtener las solicitudes ingresadas + */ + private static String SQL_SOL = "SELECT DISTINCT(SOL.COD_SOLICITUD) FROM VIA.VIA_SOLICITUD SOL " + + "WHERE SOL.COD_ESTADO NOT IN ('SAN') AND SOL.COD_EMPLEADO = :codEmployee " + + "AND SOL.FEC_FIN_VIATICO >= TO_DATE( :firstDate, 'dd-MM-yyyy') and SOL.FEC_HORA_FIN >= :initTime "; +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/entries b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/entries new file mode 100644 index 0000000..09c322c --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/entries @@ -0,0 +1,436 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +EstadoHelper.java +file + + + + +2022-07-28T03:40:39.795790Z +2f789265a85eb85243f96f066030bb33 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1326 + +PorAprobarModificaciones.java +file + + + + +2022-07-28T03:40:39.795790Z +ee7326ce467ae23a6997ade66bad08c7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1087 + +Anulada.java +file + + + + +2022-07-28T03:40:39.795790Z +7bfea3aa21e3d3f29946907f0a789ad0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1207 + +InformeAprobado.java +file + + + + +2022-07-28T03:40:39.796790Z +fd41a11906f15f7ff46a9a12d7e51fce +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1218 + +InformePorAprobar.java +file + + + + +2022-07-28T03:40:39.796790Z +26cdd999caf4e079753e12091136b11c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1112 + +PorAprobar.java +file + + + + +2022-07-28T03:40:39.796790Z +b0c5e14948d614d3ab3d7ee2c8e94cfd +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1092 + +ConfirmaAnulacion.java +file + + + + +2022-07-28T03:40:39.796790Z +7b2d1702528e0de9393c546d3ccaf03f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1079 + +Aprobada.java +file + + + + +2022-07-28T03:40:39.797790Z +1917fdfea329a94004d66d16ff15547e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1210 + +PorIngresarInforme.java +file + + + + +2022-07-28T03:40:39.797790Z +b0487f994ad7f339e337ffed90685465 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1239 + +InformePorCorregir.java +file + + + + +2022-07-28T03:40:39.797790Z +f1143e47d056a73da25903bb67ccb4e0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1229 + +NegarComision.java +file + + + + +2022-07-28T03:40:39.797790Z +56508c4038d523181db85135aca6fa08 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1241 + +PorCorregir.java +file + + + + +2022-07-28T03:40:39.798790Z +03e31b2f497424a3554a2fff05e5b267 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1221 + diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/Anulada.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/Anulada.java.svn-base new file mode 100644 index 0000000..d83c8ff --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/Anulada.java.svn-base @@ -0,0 +1,41 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.save.SaveRequest; +import com.fp.simple.dto.Responses; +import com.fp.viaticos.rules.enums.EnumEstadosSolicitud; + +/** + * Clase que se encarga de cambiar el estado de una solicitud a anulada. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class Anulada extends EstadoHelper { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + Responses resp = Responses.findResponse(pSaveRequest.getString("BPMStatus")); + if (!resp.getCode().equals("D")) { + return pSaveRequest; + } + super.cambiar(pSaveRequest, EnumEstadosSolicitud.ANULADA.getEstatus()); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/Aprobada.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/Aprobada.java.svn-base new file mode 100644 index 0000000..fdb917e --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/Aprobada.java.svn-base @@ -0,0 +1,41 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.save.SaveRequest; +import com.fp.simple.dto.Responses; +import com.fp.viaticos.rules.enums.EnumEstadosSolicitud; + +/** + * Clase que se encarga de cambiar el estado de una solicitud a aprobada. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class Aprobada extends EstadoHelper { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + Responses resp = Responses.findResponse(pSaveRequest.getString("BPMStatus")); + if (!resp.getCode().equals("A")) { + return pSaveRequest; + } + super.cambiar(pSaveRequest, EnumEstadosSolicitud.APROBADA.getEstatus()); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/ConfirmaAnulacion.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/ConfirmaAnulacion.java.svn-base new file mode 100644 index 0000000..c7d553a --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/ConfirmaAnulacion.java.svn-base @@ -0,0 +1,37 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.save.SaveRequest; +import com.fp.viaticos.rules.enums.EnumEstadosSolicitud; + +/** + * Clase que se encarga de cambiar el estado de una solicitud a anulada forzado sin considerar la opcion de la tarea + * aprobar, negar, modificar. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class ConfirmaAnulacion extends EstadoHelper { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + super.cambiar(pSaveRequest, EnumEstadosSolicitud.ANULADA.getEstatus()); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/EstadoHelper.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/EstadoHelper.java.svn-base new file mode 100644 index 0000000..a7370c3 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/EstadoHelper.java.svn-base @@ -0,0 +1,32 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.viaticos.rules.enums.EnumCodigos; + +/** + * Clase que se encarga de cambiar el estado de una solicitud o de un informe. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public abstract class EstadoHelper extends TransactionRule { + + /** + * Metodo que cambia el estado de una solicitud o de un informe. + * + * @param pSaveRequest Objeto que tien informacion util para el procesamiento de una transaccion. + * @param cestado Codigo de estado a actualziar en la solicitud o el informe. + * @throws Exception + */ + protected void cambiar(SaveRequest pSaveRequest, String cestado) throws Exception { + String csolicitud = pSaveRequest.getString("csolicitud"); + // El tipo siempre es S el informe no maneja estados. + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(csolicitud, EnumCodigos.SOLICITUD.getCodigo())); + vsol.setCod_estado(cestado); + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/InformeAprobado.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/InformeAprobado.java.svn-base new file mode 100644 index 0000000..2970090 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/InformeAprobado.java.svn-base @@ -0,0 +1,41 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.save.SaveRequest; +import com.fp.simple.dto.Responses; +import com.fp.viaticos.rules.enums.EnumEstadosSolicitud; + +/** + * Clase que se encarga de cambiar el estado de un informe a aprobado. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class InformeAprobado extends EstadoHelper { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + Responses resp = Responses.findResponse(pSaveRequest.getString("BPMStatus")); + if (!resp.getCode().equals("A")) { + return pSaveRequest; + } + super.cambiar(pSaveRequest, EnumEstadosSolicitud.INF_APROBADO.getEstatus()); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/InformePorAprobar.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/InformePorAprobar.java.svn-base new file mode 100644 index 0000000..8683365 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/InformePorAprobar.java.svn-base @@ -0,0 +1,39 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.save.SaveRequest; +import com.fp.viaticos.rules.enums.EnumEstadosSolicitud; + +/** + * Clase que se encarga de cambiar el estado de un informe a por aprobar. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class InformePorAprobar extends EstadoHelper { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (pSaveRequest.get("BPMStatus") == null) { + return pSaveRequest; + } + super.cambiar(pSaveRequest, EnumEstadosSolicitud.INF_POR_APROBAR.getEstatus()); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/InformePorCorregir.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/InformePorCorregir.java.svn-base new file mode 100644 index 0000000..c3a58dc --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/InformePorCorregir.java.svn-base @@ -0,0 +1,41 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.save.SaveRequest; +import com.fp.simple.dto.Responses; +import com.fp.viaticos.rules.enums.EnumEstadosSolicitud; + +/** + * Clase que se encarga de cambiar el estado de un informe a por corregir. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class InformePorCorregir extends EstadoHelper { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + Responses resp = Responses.findResponse(pSaveRequest.getString("BPMStatus")); + if (!resp.getCode().equals("M")) { + return pSaveRequest; + } + super.cambiar(pSaveRequest, EnumEstadosSolicitud.INF_POR_CORREGIR.getEstatus()); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/NegarComision.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/NegarComision.java.svn-base new file mode 100644 index 0000000..b531427 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/NegarComision.java.svn-base @@ -0,0 +1,41 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.save.SaveRequest; +import com.fp.simple.dto.Responses; +import com.fp.viaticos.rules.enums.EnumEstadosSolicitud; + +/** + * Clase que se encarga de cambiar el estado de una solicitud a anulacion por aprobar. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class NegarComision extends EstadoHelper { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + Responses resp = Responses.findResponse(pSaveRequest.getString("BPMStatus")); + if (!resp.getCode().equals("D")) { + return pSaveRequest; + } + super.cambiar(pSaveRequest, EnumEstadosSolicitud.ANULACION_POR_APROBAR.getEstatus()); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/PorAprobar.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/PorAprobar.java.svn-base new file mode 100644 index 0000000..dacadac --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/PorAprobar.java.svn-base @@ -0,0 +1,39 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.save.SaveRequest; +import com.fp.viaticos.rules.enums.EnumEstadosSolicitud; + +/** + * Clase que se encarga de cambiar el estado de una solicitud a por aprobar. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class PorAprobar extends EstadoHelper { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (!this.isNew(pSaveRequest)) { + return pSaveRequest; + } + super.cambiar(pSaveRequest, EnumEstadosSolicitud.POR_APROBAR.getEstatus()); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/PorAprobarModificaciones.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/PorAprobarModificaciones.java.svn-base new file mode 100644 index 0000000..3c36489 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/PorAprobarModificaciones.java.svn-base @@ -0,0 +1,37 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.save.SaveRequest; +import com.fp.viaticos.rules.enums.EnumEstadosSolicitud; + +/** + * Clase que se encarga de cambiar el estado de una solicitud a por aprobar cuando el servidor publico realiza + * modificacionesa la solicitud. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class PorAprobarModificaciones extends EstadoHelper { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + super.cambiar(pSaveRequest, EnumEstadosSolicitud.POR_APROBAR.getEstatus()); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/PorCorregir.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/PorCorregir.java.svn-base new file mode 100644 index 0000000..4eda698 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/PorCorregir.java.svn-base @@ -0,0 +1,41 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.save.SaveRequest; +import com.fp.simple.dto.Responses; +import com.fp.viaticos.rules.enums.EnumEstadosSolicitud; + +/** + * Clase que se encarga de cambiar el estado de una solicitud a por corregir. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class PorCorregir extends EstadoHelper { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + Responses resp = Responses.findResponse(pSaveRequest.getString("BPMStatus")); + if (!resp.getCode().equals("M")) { + return pSaveRequest; + } + super.cambiar(pSaveRequest, EnumEstadosSolicitud.POR_CORREGIR.getEstatus()); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/PorIngresarInforme.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/PorIngresarInforme.java.svn-base new file mode 100644 index 0000000..d03378f --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/.svn/text-base/PorIngresarInforme.java.svn-base @@ -0,0 +1,41 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.save.SaveRequest; +import com.fp.simple.dto.Responses; +import com.fp.viaticos.rules.enums.EnumEstadosSolicitud; + +/** + * Clase que se encarga de cambiar el estado de una solicitud a por ingresar informe. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class PorIngresarInforme extends EstadoHelper { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + Responses resp = Responses.findResponse(pSaveRequest.getString("BPMStatus")); + if (!resp.getCode().equals("A")) { + return pSaveRequest; + } + super.cambiar(pSaveRequest, EnumEstadosSolicitud.POR_ING_INFORME.getEstatus()); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/Anulada.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/Anulada.java new file mode 100644 index 0000000..d83c8ff --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/Anulada.java @@ -0,0 +1,41 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.save.SaveRequest; +import com.fp.simple.dto.Responses; +import com.fp.viaticos.rules.enums.EnumEstadosSolicitud; + +/** + * Clase que se encarga de cambiar el estado de una solicitud a anulada. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class Anulada extends EstadoHelper { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + Responses resp = Responses.findResponse(pSaveRequest.getString("BPMStatus")); + if (!resp.getCode().equals("D")) { + return pSaveRequest; + } + super.cambiar(pSaveRequest, EnumEstadosSolicitud.ANULADA.getEstatus()); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/Aprobada.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/Aprobada.java new file mode 100644 index 0000000..fdb917e --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/Aprobada.java @@ -0,0 +1,41 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.save.SaveRequest; +import com.fp.simple.dto.Responses; +import com.fp.viaticos.rules.enums.EnumEstadosSolicitud; + +/** + * Clase que se encarga de cambiar el estado de una solicitud a aprobada. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class Aprobada extends EstadoHelper { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + Responses resp = Responses.findResponse(pSaveRequest.getString("BPMStatus")); + if (!resp.getCode().equals("A")) { + return pSaveRequest; + } + super.cambiar(pSaveRequest, EnumEstadosSolicitud.APROBADA.getEstatus()); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/ConfirmaAnulacion.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/ConfirmaAnulacion.java new file mode 100644 index 0000000..c7d553a --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/ConfirmaAnulacion.java @@ -0,0 +1,37 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.save.SaveRequest; +import com.fp.viaticos.rules.enums.EnumEstadosSolicitud; + +/** + * Clase que se encarga de cambiar el estado de una solicitud a anulada forzado sin considerar la opcion de la tarea + * aprobar, negar, modificar. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class ConfirmaAnulacion extends EstadoHelper { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + super.cambiar(pSaveRequest, EnumEstadosSolicitud.ANULADA.getEstatus()); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/EstadoHelper.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/EstadoHelper.java new file mode 100644 index 0000000..a7370c3 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/EstadoHelper.java @@ -0,0 +1,32 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.viaticos.rules.enums.EnumCodigos; + +/** + * Clase que se encarga de cambiar el estado de una solicitud o de un informe. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public abstract class EstadoHelper extends TransactionRule { + + /** + * Metodo que cambia el estado de una solicitud o de un informe. + * + * @param pSaveRequest Objeto que tien informacion util para el procesamiento de una transaccion. + * @param cestado Codigo de estado a actualziar en la solicitud o el informe. + * @throws Exception + */ + protected void cambiar(SaveRequest pSaveRequest, String cestado) throws Exception { + String csolicitud = pSaveRequest.getString("csolicitud"); + // El tipo siempre es S el informe no maneja estados. + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(csolicitud, EnumCodigos.SOLICITUD.getCodigo())); + vsol.setCod_estado(cestado); + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/InformeAprobado.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/InformeAprobado.java new file mode 100644 index 0000000..2970090 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/InformeAprobado.java @@ -0,0 +1,41 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.save.SaveRequest; +import com.fp.simple.dto.Responses; +import com.fp.viaticos.rules.enums.EnumEstadosSolicitud; + +/** + * Clase que se encarga de cambiar el estado de un informe a aprobado. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class InformeAprobado extends EstadoHelper { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + Responses resp = Responses.findResponse(pSaveRequest.getString("BPMStatus")); + if (!resp.getCode().equals("A")) { + return pSaveRequest; + } + super.cambiar(pSaveRequest, EnumEstadosSolicitud.INF_APROBADO.getEstatus()); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/InformePorAprobar.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/InformePorAprobar.java new file mode 100644 index 0000000..8683365 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/InformePorAprobar.java @@ -0,0 +1,39 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.save.SaveRequest; +import com.fp.viaticos.rules.enums.EnumEstadosSolicitud; + +/** + * Clase que se encarga de cambiar el estado de un informe a por aprobar. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class InformePorAprobar extends EstadoHelper { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (pSaveRequest.get("BPMStatus") == null) { + return pSaveRequest; + } + super.cambiar(pSaveRequest, EnumEstadosSolicitud.INF_POR_APROBAR.getEstatus()); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/InformePorCorregir.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/InformePorCorregir.java new file mode 100644 index 0000000..c3a58dc --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/InformePorCorregir.java @@ -0,0 +1,41 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.save.SaveRequest; +import com.fp.simple.dto.Responses; +import com.fp.viaticos.rules.enums.EnumEstadosSolicitud; + +/** + * Clase que se encarga de cambiar el estado de un informe a por corregir. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class InformePorCorregir extends EstadoHelper { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + Responses resp = Responses.findResponse(pSaveRequest.getString("BPMStatus")); + if (!resp.getCode().equals("M")) { + return pSaveRequest; + } + super.cambiar(pSaveRequest, EnumEstadosSolicitud.INF_POR_CORREGIR.getEstatus()); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/NegarComision.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/NegarComision.java new file mode 100644 index 0000000..b531427 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/NegarComision.java @@ -0,0 +1,41 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.save.SaveRequest; +import com.fp.simple.dto.Responses; +import com.fp.viaticos.rules.enums.EnumEstadosSolicitud; + +/** + * Clase que se encarga de cambiar el estado de una solicitud a anulacion por aprobar. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class NegarComision extends EstadoHelper { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + Responses resp = Responses.findResponse(pSaveRequest.getString("BPMStatus")); + if (!resp.getCode().equals("D")) { + return pSaveRequest; + } + super.cambiar(pSaveRequest, EnumEstadosSolicitud.ANULACION_POR_APROBAR.getEstatus()); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/PorAprobar.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/PorAprobar.java new file mode 100644 index 0000000..dacadac --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/PorAprobar.java @@ -0,0 +1,39 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.save.SaveRequest; +import com.fp.viaticos.rules.enums.EnumEstadosSolicitud; + +/** + * Clase que se encarga de cambiar el estado de una solicitud a por aprobar. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class PorAprobar extends EstadoHelper { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + if (!this.isNew(pSaveRequest)) { + return pSaveRequest; + } + super.cambiar(pSaveRequest, EnumEstadosSolicitud.POR_APROBAR.getEstatus()); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/PorAprobarModificaciones.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/PorAprobarModificaciones.java new file mode 100644 index 0000000..3c36489 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/PorAprobarModificaciones.java @@ -0,0 +1,37 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.save.SaveRequest; +import com.fp.viaticos.rules.enums.EnumEstadosSolicitud; + +/** + * Clase que se encarga de cambiar el estado de una solicitud a por aprobar cuando el servidor publico realiza + * modificacionesa la solicitud. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class PorAprobarModificaciones extends EstadoHelper { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + super.cambiar(pSaveRequest, EnumEstadosSolicitud.POR_APROBAR.getEstatus()); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/PorCorregir.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/PorCorregir.java new file mode 100644 index 0000000..4eda698 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/PorCorregir.java @@ -0,0 +1,41 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.save.SaveRequest; +import com.fp.simple.dto.Responses; +import com.fp.viaticos.rules.enums.EnumEstadosSolicitud; + +/** + * Clase que se encarga de cambiar el estado de una solicitud a por corregir. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class PorCorregir extends EstadoHelper { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + Responses resp = Responses.findResponse(pSaveRequest.getString("BPMStatus")); + if (!resp.getCode().equals("M")) { + return pSaveRequest; + } + super.cambiar(pSaveRequest, EnumEstadosSolicitud.POR_CORREGIR.getEstatus()); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/PorIngresarInforme.java b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/PorIngresarInforme.java new file mode 100644 index 0000000..d03378f --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/rules/save/solicitud/estados/PorIngresarInforme.java @@ -0,0 +1,41 @@ +package com.fp.viaticos.rules.save.solicitud.estados; + +import com.fp.dto.save.SaveRequest; +import com.fp.simple.dto.Responses; +import com.fp.viaticos.rules.enums.EnumEstadosSolicitud; + +/** + * Clase que se encarga de cambiar el estado de una solicitud a por ingresar informe. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +public class PorIngresarInforme extends EstadoHelper { + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#normalProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + Responses resp = Responses.findResponse(pSaveRequest.getString("BPMStatus")); + if (!resp.getCode().equals("A")) { + return pSaveRequest; + } + super.cambiar(pSaveRequest, EnumEstadosSolicitud.POR_ING_INFORME.getEstatus()); + return pSaveRequest; + } + + /* + * (non-Javadoc) + * + * @see com.fp.dto.rules.TransactionRule#reverseProcess(com.fp.dto.save.SaveRequest) + */ + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception { + return pSaveRequest; + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/entries b/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/entries new file mode 100644 index 0000000..0f49da3 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/entries @@ -0,0 +1,334 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main/java/com/fp/viaticos/task +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +AsignarSupervisior.java +file + + + + +2022-07-28T03:40:39.402789Z +a9df1e49e911aef7353cb563a8f0ee95 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1766 + +AsignarSupervisiorInforme.java +file + + + + +2022-07-28T03:40:39.402789Z +5aa91f911a6a120ff3ecbf0554787569 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1775 + +AsignarContabilidad.java +file + + + + +2022-07-28T03:40:39.402789Z +1f93f3475ea261ecce56a13de0e5310e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3014 + +AsignarTesoreria.java +file + + + + +2022-07-28T03:40:39.402789Z +c76b90169e97f9ea6759058d2e1bacc9 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3006 + +AsignarTalentoHumano.java +file + + + + +2022-07-28T03:40:39.403789Z +f4b7b588d41596f64d581d959cb24f5a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3018 + +AsignarUsuarioIngresaSolicitud.java +file + + + + +2022-07-28T03:40:39.403789Z +36176d6913a90fd12cae00e64eb8ccad +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1317 + +AsignarEmpleado.java +file + + + + +2022-07-28T03:40:39.403789Z +45b79e520e26850ef919b02256c1d244 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1426 + +AsignarJefe.java +file + + + + +2022-07-28T03:40:39.403789Z +e59339d83fa0576332f6f39cbda54d1e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2081 + +AsignarJefeInforme.java +file + + + + +2022-07-28T03:40:39.403789Z +be6d865e6d12a3e0a5cf522318ab9126 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2085 + diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarContabilidad.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarContabilidad.java.svn-base new file mode 100644 index 0000000..df36e1a --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarContabilidad.java.svn-base @@ -0,0 +1,72 @@ +package com.fp.viaticos.task; + +import java.util.HashMap; +import java.util.Map; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.param.ViaCiudadUsuario; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.action.TaskAction; +import com.fp.viaticos.rules.exception.ViaticosException; + +/** + * Clase que se encarga de obtener y fijar el usuario responsable de ejecutar la tarea de contabilidad. + * + * @version 2.1 + */ +public class AsignarContabilidad extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.simple.flow.DataMap) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado e = ejpql.find(vsol.getCod_empleado()); + if (e.getCodigoLocalidad() == null) { + throw new ViaticosException("VIA-0001", "CODIGO DE LOCALIDAD NO ASOCIADO AL EMPLEADO: {0} {1}", e.getCodigo(), e.getNombre()); + } + // El userID va en mayusculas asi esta definido en las tablas de jbpm y maia. + m.put("userId", this.getUsuario(e.getCodigoLocalidad(), "CONTABILIDAD")); + m.put("action", "A"); + } + + /** + * Busca en la tabla ViaCiudadUsuario, el codigo de usuario asociado a una localidad a la que pertence un + * funcionario de la SBS. + * + * @param ciudad Codigo de ciudad a obtener el usuario. + * @return String + * @throws Exception + */ + private String getUsuario(String ciudad, String actividad) throws Exception { + Query qry = PersistenceHelper.getEntityManager().createQuery( + "from ViaCiudadUsuario t where t.pk.cod_actividad_catalog = :actividad and t.pk.cod_ciudad_catalog = :ciudad "); + qry.setParameter("ciudad", ciudad); + qry.setParameter("actividad", actividad); + ViaCiudadUsuario obj = null; + try { + obj = (ViaCiudadUsuario) qry.getSingleResult(); + } catch (NoResultException e) { + throw new ViaticosException("VIA-0002", "USUARIO NO DEFINIDO EN VIA_CIUDAD_USUARIO CIUDAD: {0} ACTIVIDAD: {1} ", ciudad, actividad); + } + return obj.getCod_usuario(); + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarEmpleado.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarEmpleado.java.svn-base new file mode 100644 index 0000000..7ddfc2e --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarEmpleado.java.svn-base @@ -0,0 +1,42 @@ +package com.fp.viaticos.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de empleado asociado a la solicitud en el request campo userId, para asignar + * una tarea. + * + * @version 2.1 + */ +public class AsignarEmpleado extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + EmpleadoJpql e = new EmpleadoJpql(); + m.put("userId", e.find(vsol.getCod_empleado()).getUsuarioweb().toUpperCase()); + m.put("action", "A"); + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarJefe.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarJefe.java.svn-base new file mode 100644 index 0000000..2c4dd97 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarJefe.java.svn-base @@ -0,0 +1,56 @@ +package com.fp.viaticos.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de jefe del empleado que realiza una solicitud de viaticos, en el request + * campo userId, para asignar una tarea. + * + * @version 2.1 + */ +public class AsignarJefe extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.simple.flow.DataMap) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + String codigoJefe = vsol.getCod_jefe(); + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado emp = ejpql.find(vsol.getCod_empleado()); + if (codigoJefe == null) { + codigoJefe = emp.getCodigoJefe(); + } + + // El userID va en mayusculas asi esta definido en las tablas de jbpm y maia. + + m.put("userId", ejpql.find(codigoJefe).getUsuarioweb().toUpperCase()); + if (emp.getCodigoJefe().equals(emp.getCodigoResponsableUnidad())) { + m.put("action", "N"); // Va con N para que no le asigane la tarea al jefe inmediato solo asigana al + // responsable de la unidad. + } else { + m.put("action", "A"); + } + + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarJefeInforme.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarJefeInforme.java.svn-base new file mode 100644 index 0000000..df64453 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarJefeInforme.java.svn-base @@ -0,0 +1,56 @@ +package com.fp.viaticos.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de jefe del empleado que ingresa el informe de viaticos, en el request campo + * userId, para asignar una tarea. + * + * @version 2.1 + */ +public class AsignarJefeInforme extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.simple.flow.DataMap) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "I")); + + String codigoJefe = vsol.getCod_jefe(); + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado emp = ejpql.find(vsol.getCod_empleado()); + if (codigoJefe == null) { + codigoJefe = emp.getCodigoJefe(); + } + + // El userID va en mayusculas asi esta definido en las tablas de jbpm y maia. + + m.put("userId", ejpql.find(codigoJefe).getUsuarioweb().toUpperCase()); + if (emp.getCodigoJefe().equals(emp.getCodigoResponsableUnidad())) { + m.put("action", "N"); // Va con N para que no le asigane la tarea al jefe inmediato solo asigana al + // responsable de la unidad. + } else { + m.put("action", "A"); + } + + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarSupervisior.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarSupervisior.java.svn-base new file mode 100644 index 0000000..98803a9 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarSupervisior.java.svn-base @@ -0,0 +1,48 @@ +package com.fp.viaticos.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de supervisor de area, del empleado que realiza una solicitud de viaticos, en + * el request campo userId, para asignar una tarea. + * + * @version 2.1 + */ +public class AsignarSupervisior extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.simple.flow.DataMap) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + String codigoRespUnidad = vsol.getCod_responsable(); + EmpleadoJpql e = new EmpleadoJpql(); + if (codigoRespUnidad == null) { + codigoRespUnidad = e.find(vsol.getCod_empleado()).getCodigoResponsableUnidad(); + } + + // El userID va en mayusculas asi esta definido en las tablas de jbpm y maia. + m.put("userId", e.find(codigoRespUnidad).getUsuarioweb().toUpperCase()); + m.put("action", "A"); + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarSupervisiorInforme.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarSupervisiorInforme.java.svn-base new file mode 100644 index 0000000..2c3155e --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarSupervisiorInforme.java.svn-base @@ -0,0 +1,48 @@ +package com.fp.viaticos.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de supervisor de area, del empleado que realiza una liquidacion de viaticos, + * en el request campo userId, para asignar una tarea. + * + * @version 2.1 + */ +public class AsignarSupervisiorInforme extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.simple.flow.DataMap) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "I")); + + String codigoRespUnidad = vsol.getCod_responsable(); + EmpleadoJpql e = new EmpleadoJpql(); + if (codigoRespUnidad == null) { + codigoRespUnidad = e.find(vsol.getCod_empleado()).getCodigoResponsableUnidad(); + } + + // El userID va en mayusculas asi esta definido en las tablas de jbpm y maia. + m.put("userId", e.find(codigoRespUnidad).getUsuarioweb().toUpperCase()); + m.put("action", "A"); + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarTalentoHumano.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarTalentoHumano.java.svn-base new file mode 100644 index 0000000..73111b1 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarTalentoHumano.java.svn-base @@ -0,0 +1,72 @@ +package com.fp.viaticos.task; + +import java.util.HashMap; +import java.util.Map; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.param.ViaCiudadUsuario; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.action.TaskAction; +import com.fp.viaticos.rules.exception.ViaticosException; + +/** + * Clase que se encarga de obtener y fijar el usuario responsable de ejecutar la tarea de talento humano. + * + * @version 2.1 + */ +public class AsignarTalentoHumano extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.simple.flow.DataMap) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado e = ejpql.find(vsol.getCod_empleado()); + if (e.getCodigoLocalidad() == null) { + throw new ViaticosException("VIA-0001", "CODIGO DE LOCALIDAD NO ASOCIADO AL EMPLEADO: {0} {1}", e.getCodigo(), e.getNombre()); + } + // El userID va en mayusculas asi esta definido en las tablas de jbpm y maia. + m.put("userId", this.getUsuario(e.getCodigoLocalidad(), "TALENTOHUMANO")); + m.put("action", "A"); + } + + /** + * Busca en la tabla ViaCiudadUsuario, el codigo de usuario asociado a una localidad a la que pertence un + * funcionario de la SBS. + * + * @param ciudad Codigo de ciudad a obtener el usuario. + * @return String + * @throws Exception + */ + private String getUsuario(String ciudad, String actividad) throws Exception { + Query qry = PersistenceHelper.getEntityManager().createQuery( + "from ViaCiudadUsuario t where t.pk.cod_actividad_catalog = :actividad and t.pk.cod_ciudad_catalog = :ciudad "); + qry.setParameter("ciudad", ciudad); + qry.setParameter("actividad", actividad); + ViaCiudadUsuario obj = null; + try { + obj = (ViaCiudadUsuario) qry.getSingleResult(); + } catch (NoResultException e) { + throw new ViaticosException("VIA-0002", "USUARIO NO DEFINIDO EN VIA_CIUDAD_USUARIO CIUDAD: {0} ACTIVIDAD: {1} ", ciudad, actividad); + } + return obj.getCod_usuario(); + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarTesoreria.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarTesoreria.java.svn-base new file mode 100644 index 0000000..6dbd1df --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarTesoreria.java.svn-base @@ -0,0 +1,72 @@ +package com.fp.viaticos.task; + +import java.util.HashMap; +import java.util.Map; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.param.ViaCiudadUsuario; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.action.TaskAction; +import com.fp.viaticos.rules.exception.ViaticosException; + +/** + * Clase que se encarga de obtener y fijar el usuario responsable de ejecutar la tarea de tesoreria.. + * + * @version 2.1 + */ +public class AsignarTesoreria extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.simple.flow.DataMap) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado e = ejpql.find(vsol.getCod_empleado()); + if (e.getCodigoLocalidad() == null) { + throw new ViaticosException("VIA-0001", "CODIGO DE LOCALIDAD NO ASOCIADO AL EMPLEADO: {0} {1}", e.getCodigo(), e.getNombre()); + } + // El userID va en mayusculas asi esta definido en las tablas de jbpm y maia. + m.put("userId", this.getUsuario(e.getCodigoLocalidad(), "TESORERIA")); + m.put("action", "A"); + } + + /** + * Busca en la tabla ViaCiudadUsuario, el codigo de usuario asociado a una localidad a la que pertence un + * funcionario de la SBS. + * + * @param ciudad Codigo de ciudad a obtener el usuario. + * @return String + * @throws Exception + */ + private String getUsuario(String ciudad, String actividad) throws Exception { + Query qry = PersistenceHelper.getEntityManager().createQuery( + "from ViaCiudadUsuario t where t.pk.cod_actividad_catalog = :actividad and t.pk.cod_ciudad_catalog = :ciudad "); + qry.setParameter("ciudad", ciudad); + qry.setParameter("actividad", actividad); + ViaCiudadUsuario obj = null; + try { + obj = (ViaCiudadUsuario) qry.getSingleResult(); + } catch (NoResultException e) { + throw new ViaticosException("VIA-0002", "USUARIO NO DEFINIDO EN VIA_CIUDAD_USUARIO CIUDAD: {0} ACTIVIDAD: {1} ", ciudad, actividad); + } + return obj.getCod_usuario(); + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarUsuarioIngresaSolicitud.java.svn-base b/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarUsuarioIngresaSolicitud.java.svn-base new file mode 100644 index 0000000..a68e1b5 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/task/.svn/text-base/AsignarUsuarioIngresaSolicitud.java.svn-base @@ -0,0 +1,40 @@ +package com.fp.viaticos.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de usuario de ingreso de la solicitud en el request campo userId, para + * asignar una tarea. + * + * @version 2.1 + */ +public class AsignarUsuarioIngresaSolicitud extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + m.put("userId", vsol.getCod_usuario().toUpperCase()); + m.put("action", "A"); + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarContabilidad.java b/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarContabilidad.java new file mode 100644 index 0000000..df36e1a --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarContabilidad.java @@ -0,0 +1,72 @@ +package com.fp.viaticos.task; + +import java.util.HashMap; +import java.util.Map; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.param.ViaCiudadUsuario; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.action.TaskAction; +import com.fp.viaticos.rules.exception.ViaticosException; + +/** + * Clase que se encarga de obtener y fijar el usuario responsable de ejecutar la tarea de contabilidad. + * + * @version 2.1 + */ +public class AsignarContabilidad extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.simple.flow.DataMap) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado e = ejpql.find(vsol.getCod_empleado()); + if (e.getCodigoLocalidad() == null) { + throw new ViaticosException("VIA-0001", "CODIGO DE LOCALIDAD NO ASOCIADO AL EMPLEADO: {0} {1}", e.getCodigo(), e.getNombre()); + } + // El userID va en mayusculas asi esta definido en las tablas de jbpm y maia. + m.put("userId", this.getUsuario(e.getCodigoLocalidad(), "CONTABILIDAD")); + m.put("action", "A"); + } + + /** + * Busca en la tabla ViaCiudadUsuario, el codigo de usuario asociado a una localidad a la que pertence un + * funcionario de la SBS. + * + * @param ciudad Codigo de ciudad a obtener el usuario. + * @return String + * @throws Exception + */ + private String getUsuario(String ciudad, String actividad) throws Exception { + Query qry = PersistenceHelper.getEntityManager().createQuery( + "from ViaCiudadUsuario t where t.pk.cod_actividad_catalog = :actividad and t.pk.cod_ciudad_catalog = :ciudad "); + qry.setParameter("ciudad", ciudad); + qry.setParameter("actividad", actividad); + ViaCiudadUsuario obj = null; + try { + obj = (ViaCiudadUsuario) qry.getSingleResult(); + } catch (NoResultException e) { + throw new ViaticosException("VIA-0002", "USUARIO NO DEFINIDO EN VIA_CIUDAD_USUARIO CIUDAD: {0} ACTIVIDAD: {1} ", ciudad, actividad); + } + return obj.getCod_usuario(); + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarEmpleado.java b/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarEmpleado.java new file mode 100644 index 0000000..7ddfc2e --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarEmpleado.java @@ -0,0 +1,42 @@ +package com.fp.viaticos.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de empleado asociado a la solicitud en el request campo userId, para asignar + * una tarea. + * + * @version 2.1 + */ +public class AsignarEmpleado extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + EmpleadoJpql e = new EmpleadoJpql(); + m.put("userId", e.find(vsol.getCod_empleado()).getUsuarioweb().toUpperCase()); + m.put("action", "A"); + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarJefe.java b/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarJefe.java new file mode 100644 index 0000000..2c4dd97 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarJefe.java @@ -0,0 +1,56 @@ +package com.fp.viaticos.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de jefe del empleado que realiza una solicitud de viaticos, en el request + * campo userId, para asignar una tarea. + * + * @version 2.1 + */ +public class AsignarJefe extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.simple.flow.DataMap) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + String codigoJefe = vsol.getCod_jefe(); + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado emp = ejpql.find(vsol.getCod_empleado()); + if (codigoJefe == null) { + codigoJefe = emp.getCodigoJefe(); + } + + // El userID va en mayusculas asi esta definido en las tablas de jbpm y maia. + + m.put("userId", ejpql.find(codigoJefe).getUsuarioweb().toUpperCase()); + if (emp.getCodigoJefe().equals(emp.getCodigoResponsableUnidad())) { + m.put("action", "N"); // Va con N para que no le asigane la tarea al jefe inmediato solo asigana al + // responsable de la unidad. + } else { + m.put("action", "A"); + } + + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarJefeInforme.java b/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarJefeInforme.java new file mode 100644 index 0000000..df64453 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarJefeInforme.java @@ -0,0 +1,56 @@ +package com.fp.viaticos.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de jefe del empleado que ingresa el informe de viaticos, en el request campo + * userId, para asignar una tarea. + * + * @version 2.1 + */ +public class AsignarJefeInforme extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.simple.flow.DataMap) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "I")); + + String codigoJefe = vsol.getCod_jefe(); + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado emp = ejpql.find(vsol.getCod_empleado()); + if (codigoJefe == null) { + codigoJefe = emp.getCodigoJefe(); + } + + // El userID va en mayusculas asi esta definido en las tablas de jbpm y maia. + + m.put("userId", ejpql.find(codigoJefe).getUsuarioweb().toUpperCase()); + if (emp.getCodigoJefe().equals(emp.getCodigoResponsableUnidad())) { + m.put("action", "N"); // Va con N para que no le asigane la tarea al jefe inmediato solo asigana al + // responsable de la unidad. + } else { + m.put("action", "A"); + } + + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarSupervisior.java b/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarSupervisior.java new file mode 100644 index 0000000..98803a9 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarSupervisior.java @@ -0,0 +1,48 @@ +package com.fp.viaticos.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de supervisor de area, del empleado que realiza una solicitud de viaticos, en + * el request campo userId, para asignar una tarea. + * + * @version 2.1 + */ +public class AsignarSupervisior extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.simple.flow.DataMap) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + String codigoRespUnidad = vsol.getCod_responsable(); + EmpleadoJpql e = new EmpleadoJpql(); + if (codigoRespUnidad == null) { + codigoRespUnidad = e.find(vsol.getCod_empleado()).getCodigoResponsableUnidad(); + } + + // El userID va en mayusculas asi esta definido en las tablas de jbpm y maia. + m.put("userId", e.find(codigoRespUnidad).getUsuarioweb().toUpperCase()); + m.put("action", "A"); + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarSupervisiorInforme.java b/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarSupervisiorInforme.java new file mode 100644 index 0000000..2c3155e --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarSupervisiorInforme.java @@ -0,0 +1,48 @@ +package com.fp.viaticos.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de supervisor de area, del empleado que realiza una liquidacion de viaticos, + * en el request campo userId, para asignar una tarea. + * + * @version 2.1 + */ +public class AsignarSupervisiorInforme extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.simple.flow.DataMap) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "I")); + + String codigoRespUnidad = vsol.getCod_responsable(); + EmpleadoJpql e = new EmpleadoJpql(); + if (codigoRespUnidad == null) { + codigoRespUnidad = e.find(vsol.getCod_empleado()).getCodigoResponsableUnidad(); + } + + // El userID va en mayusculas asi esta definido en las tablas de jbpm y maia. + m.put("userId", e.find(codigoRespUnidad).getUsuarioweb().toUpperCase()); + m.put("action", "A"); + } + +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarTalentoHumano.java b/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarTalentoHumano.java new file mode 100644 index 0000000..73111b1 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarTalentoHumano.java @@ -0,0 +1,72 @@ +package com.fp.viaticos.task; + +import java.util.HashMap; +import java.util.Map; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.param.ViaCiudadUsuario; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.action.TaskAction; +import com.fp.viaticos.rules.exception.ViaticosException; + +/** + * Clase que se encarga de obtener y fijar el usuario responsable de ejecutar la tarea de talento humano. + * + * @version 2.1 + */ +public class AsignarTalentoHumano extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.simple.flow.DataMap) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado e = ejpql.find(vsol.getCod_empleado()); + if (e.getCodigoLocalidad() == null) { + throw new ViaticosException("VIA-0001", "CODIGO DE LOCALIDAD NO ASOCIADO AL EMPLEADO: {0} {1}", e.getCodigo(), e.getNombre()); + } + // El userID va en mayusculas asi esta definido en las tablas de jbpm y maia. + m.put("userId", this.getUsuario(e.getCodigoLocalidad(), "TALENTOHUMANO")); + m.put("action", "A"); + } + + /** + * Busca en la tabla ViaCiudadUsuario, el codigo de usuario asociado a una localidad a la que pertence un + * funcionario de la SBS. + * + * @param ciudad Codigo de ciudad a obtener el usuario. + * @return String + * @throws Exception + */ + private String getUsuario(String ciudad, String actividad) throws Exception { + Query qry = PersistenceHelper.getEntityManager().createQuery( + "from ViaCiudadUsuario t where t.pk.cod_actividad_catalog = :actividad and t.pk.cod_ciudad_catalog = :ciudad "); + qry.setParameter("ciudad", ciudad); + qry.setParameter("actividad", actividad); + ViaCiudadUsuario obj = null; + try { + obj = (ViaCiudadUsuario) qry.getSingleResult(); + } catch (NoResultException e) { + throw new ViaticosException("VIA-0002", "USUARIO NO DEFINIDO EN VIA_CIUDAD_USUARIO CIUDAD: {0} ACTIVIDAD: {1} ", ciudad, actividad); + } + return obj.getCod_usuario(); + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarTesoreria.java b/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarTesoreria.java new file mode 100644 index 0000000..6dbd1df --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarTesoreria.java @@ -0,0 +1,72 @@ +package com.fp.viaticos.task; + +import java.util.HashMap; +import java.util.Map; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; +import com.fp.persistence.pviaticos.param.ViaCiudadUsuario; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.action.TaskAction; +import com.fp.viaticos.rules.exception.ViaticosException; + +/** + * Clase que se encarga de obtener y fijar el usuario responsable de ejecutar la tarea de tesoreria.. + * + * @version 2.1 + */ +public class AsignarTesoreria extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.simple.flow.DataMap) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + EmpleadoJpql ejpql = new EmpleadoJpql(); + Empleado e = ejpql.find(vsol.getCod_empleado()); + if (e.getCodigoLocalidad() == null) { + throw new ViaticosException("VIA-0001", "CODIGO DE LOCALIDAD NO ASOCIADO AL EMPLEADO: {0} {1}", e.getCodigo(), e.getNombre()); + } + // El userID va en mayusculas asi esta definido en las tablas de jbpm y maia. + m.put("userId", this.getUsuario(e.getCodigoLocalidad(), "TESORERIA")); + m.put("action", "A"); + } + + /** + * Busca en la tabla ViaCiudadUsuario, el codigo de usuario asociado a una localidad a la que pertence un + * funcionario de la SBS. + * + * @param ciudad Codigo de ciudad a obtener el usuario. + * @return String + * @throws Exception + */ + private String getUsuario(String ciudad, String actividad) throws Exception { + Query qry = PersistenceHelper.getEntityManager().createQuery( + "from ViaCiudadUsuario t where t.pk.cod_actividad_catalog = :actividad and t.pk.cod_ciudad_catalog = :ciudad "); + qry.setParameter("ciudad", ciudad); + qry.setParameter("actividad", actividad); + ViaCiudadUsuario obj = null; + try { + obj = (ViaCiudadUsuario) qry.getSingleResult(); + } catch (NoResultException e) { + throw new ViaticosException("VIA-0002", "USUARIO NO DEFINIDO EN VIA_CIUDAD_USUARIO CIUDAD: {0} ACTIVIDAD: {1} ", ciudad, actividad); + } + return obj.getCod_usuario(); + } +} diff --git a/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarUsuarioIngresaSolicitud.java b/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarUsuarioIngresaSolicitud.java new file mode 100644 index 0000000..a68e1b5 --- /dev/null +++ b/base/business/viaticos/src/main/java/com/fp/viaticos/task/AsignarUsuarioIngresaSolicitud.java @@ -0,0 +1,40 @@ +package com.fp.viaticos.task; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitud; +import com.fp.persistence.pviaticos.solicitud.ViaSolicitudKey; +import com.fp.simple.action.TaskAction; + +/** + * Clase que se encarga de fijar el codigo de usuario de ingreso de la solicitud en el request campo userId, para + * asignar una tarea. + * + * @version 2.1 + */ +public class AsignarUsuarioIngresaSolicitud extends TaskAction { + + /* + * (non-Javadoc) + * + * @see com.fp.simple.action.TaskAction#assignOwner(com.fp.dto.Request) + */ + @SuppressWarnings("unchecked") + @Override + public void assignOwner(Object pParam) throws Exception { + HashMap m = (HashMap) pParam; + + Map mrequest = (Map) m.get("request"); + if (mrequest.get("csolicitud") == null) { + return; + } + String solicitud = (String) mrequest.get("csolicitud"); + ViaSolicitud vsol = ViaSolicitud.find(PersistenceHelper.getEntityManager(), new ViaSolicitudKey(solicitud, "S")); + + m.put("userId", vsol.getCod_usuario().toUpperCase()); + m.put("action", "A"); + } + +} diff --git a/base/business/viaticos/src/main/resources/.svn/entries b/base/business/viaticos/src/main/resources/.svn/entries new file mode 100644 index 0000000..49eab02 --- /dev/null +++ b/base/business/viaticos/src/main/resources/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/main/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +viamessages_es.properties +file + + + + +2022-07-28T03:40:40.126792Z +c2935165fb30ba3689c3abdc4d14323f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +666 + diff --git a/base/business/viaticos/src/main/resources/.svn/text-base/viamessages_es.properties.svn-base b/base/business/viaticos/src/main/resources/.svn/text-base/viamessages_es.properties.svn-base new file mode 100644 index 0000000..fe07c4a --- /dev/null +++ b/base/business/viaticos/src/main/resources/.svn/text-base/viamessages_es.properties.svn-base @@ -0,0 +1,10 @@ +# CODIGOS DE MENSAJE +VIA-0001=CODIGO DE LOCALIDAD NO ASOCIADO AL EMPLEADO: {0} {1} +VIA-0002=USUARIO NO DEFINIDO EN VIA_CIUDAD_USUARIO CIUDAD: {0} +VIA-0003=EXISTEN D\u00cdAS FERIADOS PARA EL PERIODO\: {0} / {1} +VIA-0004=YA EXISTE UNA SOLICITUD INGRESADA PARA EL PERIODO: {0} / {1} +VIA-0005=PAR\u00c1METRO DE N\u00daMERO M\u00c1XIMO DE D\u00cdAS NO ENCONTRADO +VIA-0006=HA EXCEDIDO EL N\u00daMERO DE D\u00cdAS PERMITIDO PARA EL VI\u00cdTICO +VIA-0007=EXISTEn FINES DE SEMANA EN EL PERIODO SELECIONADO {0} / {1} + VIA-0008=NO PUEDE REGISTRAR UN FIN DE SEMANA COMO SALIDA DEL VI\u00cdTICO {0} + VIA-0009=NO PUEDE REGISTRAR UN FIN DE SEMANA COMO LLEGADA DEL VI\u00cdTICO {0} diff --git a/base/business/viaticos/src/main/resources/viamessages_es.properties b/base/business/viaticos/src/main/resources/viamessages_es.properties new file mode 100644 index 0000000..fe07c4a --- /dev/null +++ b/base/business/viaticos/src/main/resources/viamessages_es.properties @@ -0,0 +1,10 @@ +# CODIGOS DE MENSAJE +VIA-0001=CODIGO DE LOCALIDAD NO ASOCIADO AL EMPLEADO: {0} {1} +VIA-0002=USUARIO NO DEFINIDO EN VIA_CIUDAD_USUARIO CIUDAD: {0} +VIA-0003=EXISTEN D\u00cdAS FERIADOS PARA EL PERIODO\: {0} / {1} +VIA-0004=YA EXISTE UNA SOLICITUD INGRESADA PARA EL PERIODO: {0} / {1} +VIA-0005=PAR\u00c1METRO DE N\u00daMERO M\u00c1XIMO DE D\u00cdAS NO ENCONTRADO +VIA-0006=HA EXCEDIDO EL N\u00daMERO DE D\u00cdAS PERMITIDO PARA EL VI\u00cdTICO +VIA-0007=EXISTEn FINES DE SEMANA EN EL PERIODO SELECIONADO {0} / {1} + VIA-0008=NO PUEDE REGISTRAR UN FIN DE SEMANA COMO SALIDA DEL VI\u00cdTICO {0} + VIA-0009=NO PUEDE REGISTRAR UN FIN DE SEMANA COMO LLEGADA DEL VI\u00cdTICO {0} diff --git a/base/business/viaticos/src/test/.svn/entries b/base/business/viaticos/src/test/.svn/entries new file mode 100644 index 0000000..d3d5d43 --- /dev/null +++ b/base/business/viaticos/src/test/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + diff --git a/base/business/viaticos/src/test/java/.svn/entries b/base/business/viaticos/src/test/java/.svn/entries new file mode 100644 index 0000000..50088db --- /dev/null +++ b/base/business/viaticos/src/test/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/test/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/business/viaticos/src/test/java/com/.svn/entries b/base/business/viaticos/src/test/java/com/.svn/entries new file mode 100644 index 0000000..88c2845 --- /dev/null +++ b/base/business/viaticos/src/test/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/test/java/com +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/business/viaticos/src/test/java/com/fp/.svn/entries b/base/business/viaticos/src/test/java/com/fp/.svn/entries new file mode 100644 index 0000000..6738979 --- /dev/null +++ b/base/business/viaticos/src/test/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/test/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +base +dir + diff --git a/base/business/viaticos/src/test/java/com/fp/base/.svn/entries b/base/business/viaticos/src/test/java/com/fp/base/.svn/entries new file mode 100644 index 0000000..7fa7e0c --- /dev/null +++ b/base/business/viaticos/src/test/java/com/fp/base/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/test/java/com/fp/base +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +business +dir + diff --git a/base/business/viaticos/src/test/java/com/fp/base/business/.svn/entries b/base/business/viaticos/src/test/java/com/fp/base/business/.svn/entries new file mode 100644 index 0000000..6aebdf2 --- /dev/null +++ b/base/business/viaticos/src/test/java/com/fp/base/business/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/business/viaticos/src/test/java/com/fp/base/business +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +AppTest.java +file + + + + +2022-07-28T03:40:39.105787Z +6169340dd2ff6d4b207fa8fafced0c64 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +686 + diff --git a/base/business/viaticos/src/test/java/com/fp/base/business/.svn/text-base/AppTest.java.svn-base b/base/business/viaticos/src/test/java/com/fp/base/business/.svn/text-base/AppTest.java.svn-base new file mode 100644 index 0000000..24b4d47 --- /dev/null +++ b/base/business/viaticos/src/test/java/com/fp/base/business/.svn/text-base/AppTest.java.svn-base @@ -0,0 +1,38 @@ +package com.fp.base.business; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/base/business/viaticos/src/test/java/com/fp/base/business/AppTest.java b/base/business/viaticos/src/test/java/com/fp/base/business/AppTest.java new file mode 100644 index 0000000..24b4d47 --- /dev/null +++ b/base/business/viaticos/src/test/java/com/fp/base/business/AppTest.java @@ -0,0 +1,38 @@ +package com.fp.base.business; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/mail/Contabilidad.class b/base/business/viaticos/target/classes/com/fp/viaticos/mail/Contabilidad.class new file mode 100644 index 0000000..c0a21a3 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/mail/Contabilidad.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/mail/Empleado.class b/base/business/viaticos/target/classes/com/fp/viaticos/mail/Empleado.class new file mode 100644 index 0000000..ab1bd33 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/mail/Empleado.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/mail/EmpleadoyJefe.class b/base/business/viaticos/target/classes/com/fp/viaticos/mail/EmpleadoyJefe.class new file mode 100644 index 0000000..c6aed31 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/mail/EmpleadoyJefe.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/mail/EmpleadoyJefeyResponsableUnidad.class b/base/business/viaticos/target/classes/com/fp/viaticos/mail/EmpleadoyJefeyResponsableUnidad.class new file mode 100644 index 0000000..c596cdf Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/mail/EmpleadoyJefeyResponsableUnidad.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/mail/Grupos.class b/base/business/viaticos/target/classes/com/fp/viaticos/mail/Grupos.class new file mode 100644 index 0000000..ee8dcd7 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/mail/Grupos.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/mail/Jefe.class b/base/business/viaticos/target/classes/com/fp/viaticos/mail/Jefe.class new file mode 100644 index 0000000..5291e5d Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/mail/Jefe.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/mail/MailMasivo.class b/base/business/viaticos/target/classes/com/fp/viaticos/mail/MailMasivo.class new file mode 100644 index 0000000..d7b9942 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/mail/MailMasivo.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/mail/Movilizacion.class b/base/business/viaticos/target/classes/com/fp/viaticos/mail/Movilizacion.class new file mode 100644 index 0000000..5bbb782 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/mail/Movilizacion.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/mail/ResponsableUnidad.class b/base/business/viaticos/target/classes/com/fp/viaticos/mail/ResponsableUnidad.class new file mode 100644 index 0000000..4e34f6c Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/mail/ResponsableUnidad.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/mail/TalentoHumano.class b/base/business/viaticos/target/classes/com/fp/viaticos/mail/TalentoHumano.class new file mode 100644 index 0000000..98f05fa Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/mail/TalentoHumano.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/mail/Tesoreria.class b/base/business/viaticos/target/classes/com/fp/viaticos/mail/Tesoreria.class new file mode 100644 index 0000000..dfb93b5 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/mail/Tesoreria.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/mail/UsaurioIngresoSolicitud.class b/base/business/viaticos/target/classes/com/fp/viaticos/mail/UsaurioIngresoSolicitud.class new file mode 100644 index 0000000..b31bb96 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/mail/UsaurioIngresoSolicitud.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/mail/thread/MailPorSolicitud.class b/base/business/viaticos/target/classes/com/fp/viaticos/mail/thread/MailPorSolicitud.class new file mode 100644 index 0000000..d1e1d2c Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/mail/thread/MailPorSolicitud.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/consulta/solicitud/ConsultaComentarios.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/consulta/solicitud/ConsultaComentarios.class new file mode 100644 index 0000000..b1bc088 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/consulta/solicitud/ConsultaComentarios.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/consulta/solicitud/ConsultaSolicitud.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/consulta/solicitud/ConsultaSolicitud.class new file mode 100644 index 0000000..e7fb648 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/consulta/solicitud/ConsultaSolicitud.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/enums/EnumCodigos.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/enums/EnumCodigos.class new file mode 100644 index 0000000..ea6a8e7 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/enums/EnumCodigos.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/enums/EnumEstadosSolicitud.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/enums/EnumEstadosSolicitud.class new file mode 100644 index 0000000..837e4c6 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/enums/EnumEstadosSolicitud.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/exception/ViaticosException.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/exception/ViaticosException.class new file mode 100644 index 0000000..2e0a368 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/exception/ViaticosException.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/destino/DestinoQuery.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/destino/DestinoQuery.class new file mode 100644 index 0000000..05f7493 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/destino/DestinoQuery.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/destino/LovDestinoSbs.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/destino/LovDestinoSbs.class new file mode 100644 index 0000000..ff4a163 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/destino/LovDestinoSbs.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/empleados/LovEmpleadosSbs.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/empleados/LovEmpleadosSbs.class new file mode 100644 index 0000000..644f967 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/empleados/LovEmpleadosSbs.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/empleados/NotificacionMovilizacion.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/empleados/NotificacionMovilizacion.class new file mode 100644 index 0000000..c565296 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/empleados/NotificacionMovilizacion.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/empleados/UsuarioPorCiudad.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/empleados/UsuarioPorCiudad.class new file mode 100644 index 0000000..1dc590b Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/empleados/UsuarioPorCiudad.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/general/DiasAcumulados.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/general/DiasAcumulados.class new file mode 100644 index 0000000..6d94df6 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/general/DiasAcumulados.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/informe/Informe.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/informe/Informe.class new file mode 100644 index 0000000..3fb2f7d Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/informe/Informe.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/solicitud/ConsultaEstadoSolicitud.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/solicitud/ConsultaEstadoSolicitud.class new file mode 100644 index 0000000..2625f04 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/solicitud/ConsultaEstadoSolicitud.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/solicitud/ConsultaLovSolicitud.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/solicitud/ConsultaLovSolicitud.class new file mode 100644 index 0000000..16d2d7f Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/query/solicitud/ConsultaLovSolicitud.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/acumulados/DiasAcumulados.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/acumulados/DiasAcumulados.class new file mode 100644 index 0000000..b576050 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/acumulados/DiasAcumulados.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/Comentarios.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/Comentarios.class new file mode 100644 index 0000000..0d621af Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/Comentarios.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/Solicitud.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/Solicitud.class new file mode 100644 index 0000000..9dccadf Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/Solicitud.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/SolicitudIntegrantes.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/SolicitudIntegrantes.class new file mode 100644 index 0000000..dbc40ba Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/SolicitudIntegrantes.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/SolicitudTransporte.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/SolicitudTransporte.class new file mode 100644 index 0000000..d1b4623 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/SolicitudTransporte.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/ValidaFeriados.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/ValidaFeriados.class new file mode 100644 index 0000000..315cad9 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/ValidaFeriados.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/Anulada.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/Anulada.class new file mode 100644 index 0000000..5d4c319 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/Anulada.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/Aprobada.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/Aprobada.class new file mode 100644 index 0000000..678a982 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/Aprobada.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/ConfirmaAnulacion.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/ConfirmaAnulacion.class new file mode 100644 index 0000000..1346b4a Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/ConfirmaAnulacion.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/EstadoHelper.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/EstadoHelper.class new file mode 100644 index 0000000..9d83c9b Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/EstadoHelper.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/InformeAprobado.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/InformeAprobado.class new file mode 100644 index 0000000..b8af9fd Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/InformeAprobado.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/InformePorAprobar.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/InformePorAprobar.class new file mode 100644 index 0000000..7681e50 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/InformePorAprobar.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/InformePorCorregir.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/InformePorCorregir.class new file mode 100644 index 0000000..cb8c124 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/InformePorCorregir.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/NegarComision.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/NegarComision.class new file mode 100644 index 0000000..6bfe506 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/NegarComision.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/PorAprobar.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/PorAprobar.class new file mode 100644 index 0000000..e3a4fc1 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/PorAprobar.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/PorAprobarModificaciones.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/PorAprobarModificaciones.class new file mode 100644 index 0000000..773e63f Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/PorAprobarModificaciones.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/PorCorregir.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/PorCorregir.class new file mode 100644 index 0000000..43c0f32 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/PorCorregir.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/PorIngresarInforme.class b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/PorIngresarInforme.class new file mode 100644 index 0000000..5548721 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/rules/save/solicitud/estados/PorIngresarInforme.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarContabilidad.class b/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarContabilidad.class new file mode 100644 index 0000000..4fba1b6 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarContabilidad.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarEmpleado.class b/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarEmpleado.class new file mode 100644 index 0000000..a7eb953 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarEmpleado.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarJefe.class b/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarJefe.class new file mode 100644 index 0000000..3034ff7 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarJefe.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarJefeInforme.class b/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarJefeInforme.class new file mode 100644 index 0000000..b33fb91 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarJefeInforme.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarSupervisior.class b/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarSupervisior.class new file mode 100644 index 0000000..022915b Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarSupervisior.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarSupervisiorInforme.class b/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarSupervisiorInforme.class new file mode 100644 index 0000000..7c15c9f Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarSupervisiorInforme.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarTalentoHumano.class b/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarTalentoHumano.class new file mode 100644 index 0000000..9ee2c5c Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarTalentoHumano.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarTesoreria.class b/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarTesoreria.class new file mode 100644 index 0000000..63401ba Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarTesoreria.class differ diff --git a/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarUsuarioIngresaSolicitud.class b/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarUsuarioIngresaSolicitud.class new file mode 100644 index 0000000..31dd9f6 Binary files /dev/null and b/base/business/viaticos/target/classes/com/fp/viaticos/task/AsignarUsuarioIngresaSolicitud.class differ diff --git a/base/business/viaticos/target/classes/viamessages_es.properties b/base/business/viaticos/target/classes/viamessages_es.properties new file mode 100644 index 0000000..fe07c4a --- /dev/null +++ b/base/business/viaticos/target/classes/viamessages_es.properties @@ -0,0 +1,10 @@ +# CODIGOS DE MENSAJE +VIA-0001=CODIGO DE LOCALIDAD NO ASOCIADO AL EMPLEADO: {0} {1} +VIA-0002=USUARIO NO DEFINIDO EN VIA_CIUDAD_USUARIO CIUDAD: {0} +VIA-0003=EXISTEN D\u00cdAS FERIADOS PARA EL PERIODO\: {0} / {1} +VIA-0004=YA EXISTE UNA SOLICITUD INGRESADA PARA EL PERIODO: {0} / {1} +VIA-0005=PAR\u00c1METRO DE N\u00daMERO M\u00c1XIMO DE D\u00cdAS NO ENCONTRADO +VIA-0006=HA EXCEDIDO EL N\u00daMERO DE D\u00cdAS PERMITIDO PARA EL VI\u00cdTICO +VIA-0007=EXISTEn FINES DE SEMANA EN EL PERIODO SELECIONADO {0} / {1} + VIA-0008=NO PUEDE REGISTRAR UN FIN DE SEMANA COMO SALIDA DEL VI\u00cdTICO {0} + VIA-0009=NO PUEDE REGISTRAR UN FIN DE SEMANA COMO LLEGADA DEL VI\u00cdTICO {0} diff --git a/base/business/viaticos/target/maven-archiver/pom.properties b/base/business/viaticos/target/maven-archiver/pom.properties new file mode 100644 index 0000000..c043596 --- /dev/null +++ b/base/business/viaticos/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:53:18 ECT 2022 +version=2.1 +groupId=com.fp.base.business +artifactId=viaticos diff --git a/base/business/viaticos/target/viaticos-2.1.jar b/base/business/viaticos/target/viaticos-2.1.jar new file mode 100644 index 0000000..d375c97 Binary files /dev/null and b/base/business/viaticos/target/viaticos-2.1.jar differ diff --git a/base/core/.svn/entries b/base/core/.svn/entries new file mode 100644 index 0000000..a36f422 --- /dev/null +++ b/base/core/.svn/entries @@ -0,0 +1,71 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core +svn://172.17.26.185/COMACO + + + +2015-02-20T10:57:23.058271Z +3827 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +firmas +dir + +alfresco-client +dir + +pom.xml +file + + + + +2022-07-28T03:40:38.670785Z +247eeb6c7a90a32507357f7f4974d671 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1372 + +bpm +dir + diff --git a/base/core/.svn/text-base/pom.xml.svn-base b/base/core/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..a4d2510 --- /dev/null +++ b/base/core/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,42 @@ + + + + base + com.fp + 2.1 + + 4.0.0 + com.fp.base + core + flipbean + 2.1 + pom + Financial Lifecycle Process + + bpm + firmas + alfresco-client + + + + + com.fp.base.dto + common + 2.1 + + + com.fp.base.dto + dto + 2.1 + + + org.hibernate + hibernate-core + provided + + + org.hibernate + hibernate-entitymanager + + + \ No newline at end of file diff --git a/base/core/alfresco-client/.svn/dir-prop-base b/base/core/alfresco-client/.svn/dir-prop-base new file mode 100644 index 0000000..40820ff --- /dev/null +++ b/base/core/alfresco-client/.svn/dir-prop-base @@ -0,0 +1,6 @@ +K 10 +svn:ignore +V 7 +target + +END diff --git a/base/core/alfresco-client/.svn/entries b/base/core/alfresco-client/.svn/entries new file mode 100644 index 0000000..1c8fb7c --- /dev/null +++ b/base/core/alfresco-client/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/alfresco-client +svn://172.17.26.185/COMACO + + + +2015-02-20T10:57:23.058271Z +3827 +cpiedra +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:37.916782Z +783e949153b7d338b61d9a9e7071dbe1 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1448 + diff --git a/base/core/alfresco-client/.svn/text-base/pom.xml.svn-base b/base/core/alfresco-client/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..b9e43ab --- /dev/null +++ b/base/core/alfresco-client/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,44 @@ + + 4.0.0 + + com.fp.base + core + 2.1 + + com.fp.base.core + alfresco-client + http://maven.apache.org + + UTF-8 + + + + + org.apache.httpcomponents + httpclient + 4.3.1 + provided + + + org.apache.httpcomponents + httpmime + 4.3.1 + provided + + + org.apache.httpcomponents + httpcore + 4.3.1 + provided + + + net.sf.json-lib + json-lib + provided + + + commons-io + commons-io + + + \ No newline at end of file diff --git a/base/core/alfresco-client/pom.xml b/base/core/alfresco-client/pom.xml new file mode 100644 index 0000000..b9e43ab --- /dev/null +++ b/base/core/alfresco-client/pom.xml @@ -0,0 +1,44 @@ + + 4.0.0 + + com.fp.base + core + 2.1 + + com.fp.base.core + alfresco-client + http://maven.apache.org + + UTF-8 + + + + + org.apache.httpcomponents + httpclient + 4.3.1 + provided + + + org.apache.httpcomponents + httpmime + 4.3.1 + provided + + + org.apache.httpcomponents + httpcore + 4.3.1 + provided + + + net.sf.json-lib + json-lib + provided + + + commons-io + commons-io + + + \ No newline at end of file diff --git a/base/core/alfresco-client/src/.svn/entries b/base/core/alfresco-client/src/.svn/entries new file mode 100644 index 0000000..ccd9275 --- /dev/null +++ b/base/core/alfresco-client/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/alfresco-client/src +svn://172.17.26.185/COMACO + + + +2015-02-20T10:57:23.058271Z +3827 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/base/core/alfresco-client/src/main/.svn/entries b/base/core/alfresco-client/src/main/.svn/entries new file mode 100644 index 0000000..f4af581 --- /dev/null +++ b/base/core/alfresco-client/src/main/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/alfresco-client/src/main +svn://172.17.26.185/COMACO + + + +2015-02-20T10:57:23.058271Z +3827 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/core/alfresco-client/src/main/java/.svn/entries b/base/core/alfresco-client/src/main/java/.svn/entries new file mode 100644 index 0000000..c4c8768 --- /dev/null +++ b/base/core/alfresco-client/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/alfresco-client/src/main/java +svn://172.17.26.185/COMACO + + + +2014-11-20T05:37:05.456961Z +2997 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/core/alfresco-client/src/main/java/com/.svn/entries b/base/core/alfresco-client/src/main/java/com/.svn/entries new file mode 100644 index 0000000..fabb1c8 --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/alfresco-client/src/main/java/com +svn://172.17.26.185/COMACO + + + +2014-11-20T05:37:05.456961Z +2997 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/core/alfresco-client/src/main/java/com/fp/.svn/entries b/base/core/alfresco-client/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..8e29834 --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/alfresco-client/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-11-20T05:37:05.456961Z +2997 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +alfresco +dir + diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/.svn/entries b/base/core/alfresco-client/src/main/java/com/fp/alfresco/.svn/entries new file mode 100644 index 0000000..e3ae7ba --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/.svn/entries @@ -0,0 +1,43 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/alfresco-client/src/main/java/com/fp/alfresco +svn://172.17.26.185/COMACO + + + +2014-11-20T05:37:05.456961Z +2997 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +auth +dir + +enums +dir + +util +dir + +client +dir + +exception +dir + diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/auth/.svn/entries b/base/core/alfresco-client/src/main/java/com/fp/alfresco/auth/.svn/entries new file mode 100644 index 0000000..f94a9d2 --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/auth/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/alfresco-client/src/main/java/com/fp/alfresco/auth +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +Authentication.java +file + + + + +2022-07-28T03:40:37.520780Z +5773957b2b55f7c90c567a8a1c509d46 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1410 + +AlfrescoFileAuth.java +file + + + + +2022-07-28T03:40:37.520780Z +1915fd30504395dcc975e89622917245 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1701 + diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/auth/.svn/text-base/AlfrescoFileAuth.java.svn-base b/base/core/alfresco-client/src/main/java/com/fp/alfresco/auth/.svn/text-base/AlfrescoFileAuth.java.svn-base new file mode 100644 index 0000000..6647708 --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/auth/.svn/text-base/AlfrescoFileAuth.java.svn-base @@ -0,0 +1,56 @@ +/** + * + */ +package com.fp.alfresco.auth; + +import net.sf.json.JSONObject; +import net.sf.json.JSONSerializer; + +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpRequestBase; +import org.apache.http.impl.client.HttpClients; + +import com.fp.alfresco.util.ApiProperties; +import com.fp.alfresco.util.ApiResponseHandler; + +/** + * Autenticación mediante un archivo de propiedades + * @author bpt + * + */ +public class AlfrescoFileAuth extends Authentication{ + + + @Override + public boolean authenticate() { + try{ + super.user = ApiProperties.getProperty("api.user"); + super.password = ApiProperties.getProperty("api.password"); + + HttpClient client = HttpClients.createDefault(); + String authUrl = ApiProperties.getProperty("api.uri.base") +ApiProperties.getProperty("api.uri.login", super.user, super.password); + HttpRequestBase httpRequest = new HttpGet(authUrl); + ApiResponseHandler handler = new ApiResponseHandler(); + HttpResponse response = client.execute(httpRequest); + String responseString = (String) handler.handleResponse(response, false); + + JSONObject json = (JSONObject) JSONSerializer.toJSON(responseString); + super.ticket = json.getJSONObject("data").getString("ticket"); + if(super.ticket!=null){ + return true; + } + }catch(Exception e){ + e.printStackTrace(); + } + return false; + } + + public static void main(String[] args) + { + AlfrescoFileAuth auth = new AlfrescoFileAuth(); + boolean isauth = auth.authenticate(); + System.out.println(isauth); + } +} diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/auth/.svn/text-base/Authentication.java.svn-base b/base/core/alfresco-client/src/main/java/com/fp/alfresco/auth/.svn/text-base/Authentication.java.svn-base new file mode 100644 index 0000000..4a9c33e --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/auth/.svn/text-base/Authentication.java.svn-base @@ -0,0 +1,68 @@ +/** + * + */ +package com.fp.alfresco.auth; + +/** + * Clase que maneja la autenticación y acceso al repositorio de Alfresco mediante webscripts + * @author bpt + * + */ +public abstract class Authentication { + + protected String user; + + protected String password; + + protected String ticket; + + /** + * M´todo principal que maneja la forma en que se autenticará el API hacia el repositorio de Alfresco mediante webscripts + * @return + */ + public abstract boolean authenticate(); + + /** + * @return Retorna el atributo user + */ + public String getUser() { + return this.user; + } + + /** + * @param user Parámetro a fijar en el atributo user + */ + public void setUser(String user) { + this.user = user; + } + + /** + * @return Retorna el atributo password + */ + public String getPassword() { + return this.password; + } + + /** + * @param password Parámetro a fijar en el atributo password + */ + public void setPassword(String password) { + this.password = password; + } + + /** + * @return Retorna el atributo ticket + */ + public String getTicket() { + return this.ticket; + } + + /** + * @param ticket Parámetro a fijar en el atributo ticket + */ + public void setTicket(String ticket) { + this.ticket = ticket; + } + + +} diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/auth/AlfrescoFileAuth.java b/base/core/alfresco-client/src/main/java/com/fp/alfresco/auth/AlfrescoFileAuth.java new file mode 100644 index 0000000..6647708 --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/auth/AlfrescoFileAuth.java @@ -0,0 +1,56 @@ +/** + * + */ +package com.fp.alfresco.auth; + +import net.sf.json.JSONObject; +import net.sf.json.JSONSerializer; + +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpRequestBase; +import org.apache.http.impl.client.HttpClients; + +import com.fp.alfresco.util.ApiProperties; +import com.fp.alfresco.util.ApiResponseHandler; + +/** + * Autenticación mediante un archivo de propiedades + * @author bpt + * + */ +public class AlfrescoFileAuth extends Authentication{ + + + @Override + public boolean authenticate() { + try{ + super.user = ApiProperties.getProperty("api.user"); + super.password = ApiProperties.getProperty("api.password"); + + HttpClient client = HttpClients.createDefault(); + String authUrl = ApiProperties.getProperty("api.uri.base") +ApiProperties.getProperty("api.uri.login", super.user, super.password); + HttpRequestBase httpRequest = new HttpGet(authUrl); + ApiResponseHandler handler = new ApiResponseHandler(); + HttpResponse response = client.execute(httpRequest); + String responseString = (String) handler.handleResponse(response, false); + + JSONObject json = (JSONObject) JSONSerializer.toJSON(responseString); + super.ticket = json.getJSONObject("data").getString("ticket"); + if(super.ticket!=null){ + return true; + } + }catch(Exception e){ + e.printStackTrace(); + } + return false; + } + + public static void main(String[] args) + { + AlfrescoFileAuth auth = new AlfrescoFileAuth(); + boolean isauth = auth.authenticate(); + System.out.println(isauth); + } +} diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/auth/Authentication.java b/base/core/alfresco-client/src/main/java/com/fp/alfresco/auth/Authentication.java new file mode 100644 index 0000000..4a9c33e --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/auth/Authentication.java @@ -0,0 +1,68 @@ +/** + * + */ +package com.fp.alfresco.auth; + +/** + * Clase que maneja la autenticación y acceso al repositorio de Alfresco mediante webscripts + * @author bpt + * + */ +public abstract class Authentication { + + protected String user; + + protected String password; + + protected String ticket; + + /** + * M´todo principal que maneja la forma en que se autenticará el API hacia el repositorio de Alfresco mediante webscripts + * @return + */ + public abstract boolean authenticate(); + + /** + * @return Retorna el atributo user + */ + public String getUser() { + return this.user; + } + + /** + * @param user Parámetro a fijar en el atributo user + */ + public void setUser(String user) { + this.user = user; + } + + /** + * @return Retorna el atributo password + */ + public String getPassword() { + return this.password; + } + + /** + * @param password Parámetro a fijar en el atributo password + */ + public void setPassword(String password) { + this.password = password; + } + + /** + * @return Retorna el atributo ticket + */ + public String getTicket() { + return this.ticket; + } + + /** + * @param ticket Parámetro a fijar en el atributo ticket + */ + public void setTicket(String ticket) { + this.ticket = ticket; + } + + +} diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/client/.svn/entries b/base/core/alfresco-client/src/main/java/com/fp/alfresco/client/.svn/entries new file mode 100644 index 0000000..4f0f01c --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/client/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/alfresco-client/src/main/java/com/fp/alfresco/client +svn://172.17.26.185/COMACO + + + +2014-11-20T05:37:05.456961Z +2997 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +AlfrescoApi.java +file + + + + +2022-07-28T03:40:37.616781Z +4176ae212757b4f153ddeb2b3ce1c83c +2014-11-20T05:37:05.456961Z +2997 +dcruz + + + + + + + + + + + + + + + + + + + + + +15293 + +DocumentoAlfresco.java +file + + + + +2022-07-28T03:40:37.616781Z +72df43dfde77145936d01a84e474990d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4811 + +Prueba.java +file + + + + +2022-07-28T03:40:37.616781Z +aced61aa4ab2bbd1ff784054b8ace540 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5109 + diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/client/.svn/text-base/AlfrescoApi.java.svn-base b/base/core/alfresco-client/src/main/java/com/fp/alfresco/client/.svn/text-base/AlfrescoApi.java.svn-base new file mode 100644 index 0000000..ae200fe --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/client/.svn/text-base/AlfrescoApi.java.svn-base @@ -0,0 +1,434 @@ +/** + * + */ +package com.fp.alfresco.client; + +import java.io.InputStream; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TimeZone; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import net.sf.json.JSONSerializer; + +import org.apache.commons.lang.StringEscapeUtils; +import org.apache.http.Consts; +import org.apache.http.HttpEntity; +import org.apache.http.HttpException; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.entity.mime.content.FileBody; +import org.apache.http.entity.mime.content.StringBody; + +import com.fp.alfresco.enums.EnumDataType; +import com.fp.alfresco.enums.EnumRequestType; +import com.fp.alfresco.exception.ExceptionWebscript; +import com.fp.alfresco.util.ApiProperties; +import com.fp.alfresco.util.ApiRequest; +import com.fp.alfresco.util.UriUtils; + +/** + * + * Clase que proporciona métodos comunes para interactuar con el repositorio de Alfresco + * @author bpt + * + */ +public class AlfrescoApi { + + /** + * Objeto de tipo ApiRequest que realiza las consultas a alfresco + */ + private ApiRequest apiRequest; + + /** + * Variable que contiene el namespace base del API de alfresco + */ + private String baseQuery; + + /** + * Variable que contiene el nombre del sitio que se consumira en la llamada a Alfresco + */ + private String site; + + private static final String MIME_TEXT = ApiProperties.getProperty("api.common.mime.type"); + + private static final String PREFIX_METADATA = ApiProperties.getProperty("api.name.prefix.metadata"); + + /** + * Constructor + */ + public AlfrescoApi(String site){ + this.apiRequest = new ApiRequest(); + this.site = site; + this.baseQuery = ApiProperties.getProperty("api.site.defaultquery", site); + } + + /** + * Método principal para la busqueda de documentos + * @param query + * @param ticket + * @return + * @throws Exception + */ + public List findDocuments(String query) throws Exception{ + String uri = ApiProperties.getProperty("api.uri.search.general")+UriUtils.formatearParametrosUrl("query=" + this.baseQuery+ " AND " + query); + + String response = this.apiRequest.authRequest(EnumRequestType.GET, uri).toString(); + return this.transformeResponse(response); + } + + /** + * Retorna una lista de {@link DocumentoAlfresco} por xpath + * @param xPathLocation la ruta xpath de una carpeta + * @return + * @throws Exception + */ + private List findByXPathLocation(String xPathLocation) throws Exception{ + String uri = ApiProperties.getProperty("api.uri.search.general")+UriUtils.formatearParametrosUrl("query=PATH:\"" + xPathLocation); + String response = this.apiRequest.authRequest(EnumRequestType.GET, uri).toString(); + return this.transformeResponse(response); + } + + /** + * Método que busca por id del documento + * @param documentId + * @return + * @throws Exception + */ + public DocumentoAlfresco findById(String documentId) throws Exception + { + String query = "ID:\""+ documentId +"\""; + List l = this.findDocuments(query); + if(!l.isEmpty()){ + return l.get(0); + } + return null; + } + + /** + * Método que busca un documento por contenido + * @param documentContent + * @return + * @throws Exception + */ + public List findByContent(String documentContent) throws Exception + { + String query = "TEXT:\""+ documentContent+"\""; + return this.findDocuments(query); + } + + /** + * Método que busca un documento por atributo + * @param documentContent + * @return + * @throws Exception + */ + public List findByAttribute(String attributeName, String value) throws Exception + { + attributeName = attributeName.replace(":", "\\:"); + String query = "@"+attributeName+":\""+ value+"\""; + return this.findDocuments(query); + } + + /** + * Método que busca un documento por tipo + * @param type + * @return + * @throws Exception + */ + public List findByType(String type) throws Exception + { + String query = "TYPE:\""+type+"\""; + return this.findDocuments(query); + } + + /** + * Devuelve una lista de {@link DocumentoAlfresco} por xpath de la carpeta + * @param xPathLocationFolder xpath de la carpeta a buscar + * @return + * @throws Exception + */ + public List findListByXPathLocation(String xPathLocationFolder) throws Exception{ + if((xPathLocationFolder==null) || xPathLocationFolder.isEmpty()){ + throw new ExceptionWebscript("Ruta de la carpeta requerido"); + } + xPathLocationFolder+="/*\" AND TYPE:\"cm:content\""; + return this.findByXPathLocation(xPathLocationFolder); + } + + /** + * Retorna un {@link DocumentoAlfresco} por dirección xpath + * @param xPathLocationDocument dirección xpath del documento + * @return + * @throws Exception + */ + public DocumentoAlfresco findOneByXPathLocation(String xPathLocationDocument) throws Exception{ + if((xPathLocationDocument==null) || xPathLocationDocument.isEmpty()){ + throw new ExceptionWebscript("Ruta del documento requerido"); + } + xPathLocationDocument+="\""; + List l = this.findByXPathLocation(xPathLocationDocument); + if(!l.isEmpty()){ + return l.get(0); + } + return null; + } + + /** + * Recibe la respuesta en JSON y retorna una lista de tipo List + * @param response + * + */ + private List transformeResponse(String response) { + List l = new ArrayList(); + JSONObject json = (JSONObject) JSONSerializer.toJSON(response); + Integer resultados = json.getInt("resultados"); + if(resultados>0){ + JSONArray documents = json.getJSONArray("documentos"); + for (Object object : documents) { + JSONObject jo = (JSONObject) object; + DocumentoAlfresco d = this.getSingleDocumentResponse(jo); + l.add(d); + } + } + return l; + } + + /** + * Retorna un {@link DocumentoAlfresco} en base aun {@link JSONObject} enviado + * @param jo Objeto json que formará el {@link DocumentoAlfresco} + * @return + */ + @SuppressWarnings("unchecked") + private DocumentoAlfresco getSingleDocumentResponse(JSONObject jo) { + Map mprops = jo.getJSONObject("propiedades"); + DocumentoAlfresco d = new DocumentoAlfresco(jo.getString("nombre"), ((Map)mprops.get("cm:modifier")).get("userName").toString()); + d.setId(jo.getString("referencia")); + d.setNombre(jo.getString("nombre")); + d.setModificadoPor(((Map)mprops.get("cm:modifier")).get("userName").toString()); + d.setAccesoDescarga(jo.getString("accesoDescarga")); + d.setxPathLocationPadre(jo.getString("xPathLocationPadre")); + d.setxPathLocation(jo.getString("xPathLocation")); + d.setTipo(jo.getString("tipo")); + d.setPropiedades(new HashMap()); + this.fillPropertiesSearch(d.getPropiedades(), jo.getJSONObject("propiedades")); + return d; + } + + /** + * Método recursivo que llena las propiedades de un documento en un mapa + * @param mprop Mapa para llenar las propiedades de un documento + * @param jobject Propiedad de un documento + */ + @SuppressWarnings("unchecked") + private void fillPropertiesSearch(Map mprop, JSONObject jobject) { + Set ks = jobject.keySet(); + for (String key : ks) { + Object item = jobject.get(key); + if(item instanceof JSONObject){ + Map subProp = new HashMap(); + mprop.put(key, subProp); + this.fillPropertiesSearch(subProp, (JSONObject)item); + }else{ + mprop.put(key, item.toString()); + } + } + } + + /** + * Método que arma los parámetros en base al documento + * @param documento + * @return + * @throws Exception + */ + private String armarParametrosPropiedades(DocumentoAlfresco documento) throws Exception { + TimeZone tz = TimeZone.getTimeZone("GMT-05:00"); + DateFormat iso8601 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); + iso8601.setTimeZone(tz); + StringBuffer cadena = new StringBuffer("{"); + Map> map = documento.getPropiedadesToSet(); + if(map==null){ + cadena.append("}"); + return cadena.toString(); + } + boolean existAttrs = false; + Set keys = map.keySet(); + for (String key : keys) { + if(key.startsWith(PREFIX_METADATA)){ + existAttrs = true; + Map prop = map.get(key); + String propValue = null; + Object type = prop.get("type"); + Object value = prop.get("value"); + if(!(type instanceof EnumDataType)){ + throw new ExceptionWebscript("El campo '"+key+"' debe tener el atributo 'type' de tipo [EnumDataType]"); + } + if(value!=null){ + if(type==EnumDataType.STRING){ + if(!(value instanceof String)) { + throw new ExceptionWebscript("El campo '"+key+"' debe tener el atributo 'value' de tipo [String]"); + } + propValue = StringEscapeUtils.escapeJavaScript(value.toString()); + + }else if(type==EnumDataType.DATE){ + if(!(value instanceof Date)) { + throw new ExceptionWebscript("El campo '"+key+"' debe tener el atributo 'value' de tipo [Date]"); + } + propValue = iso8601.format(value); + propValue = propValue.substring(0,22)+":00"; + }else if(type==EnumDataType.NUMBER){ + if(!(value instanceof Number)) { + throw new ExceptionWebscript("El campo '"+key+"' debe tener el atributo 'value' de tipo [Number]"); + } + propValue = value.toString(); + } + } + if((propValue!=null) && !propValue.isEmpty()) { + cadena.append("\""+key+"\":") + .append("{") + .append("\"value\":").append("\""+propValue+"\"") + .append(",") + .append("\"type\":").append("\""+((EnumDataType)type).getValue()+"\"") + .append("},"); + } + } + } + if(existAttrs) { + cadena.deleteCharAt(cadena.length()-1); + } + cadena.append("}"); + return cadena.toString(); + } + + /** + * Se obtiene un documento en base a su id + * @param documentId id del documento + * @return + * @throws Exception + */ + public InputStream downloadDocumentById(String documentId) throws Exception{ + String uriDownload = ApiProperties.getProperty("api.uri.download.id"); + uriDownload+=documentId.replace("://", "/"); + return (InputStream) this.apiRequest.authRequest(EnumRequestType.GET, uriDownload, true, true); + } + + /** + * Se obtiene un documento en base a su xpath + * @param xPathLocation ruta de la dirección en donde se encuentra el documento + * @param includeSite bandera si se debe especificar el sitio + * @return + * @throws Exception + */ + public InputStream downloadDocumentByXPathLocation(String xPathLocation, boolean includeSite) throws Exception{ + if(includeSite){ + xPathLocation = xPathLocation.replace("{0}", this.site); + } + DocumentoAlfresco docAlfresco = findOneByXPathLocation(xPathLocation); + if(docAlfresco == null){ + return null; + } +// xPathLocation = xPathLocation.replace("/app:", "").replace("/st:", "/").replace("/cm:", "/"); +// String uriDownload = ApiProperties.getProperty("api.uri.download.path", xPathLocation); +// (InputStream) this.apiRequest.authRequest(EnumRequestType.GET, uriDownload, true, true) + return downloadDocumentById(docAlfresco.getId()); + } + + public InputStream downloadDocumentByXPathLocation(String xPathLocation) throws Exception{ + return this.downloadDocumentByXPathLocation(xPathLocation, true); + } + + /** + * Método que carga un documento en una ruta especificada + * @param location + * @param document + * @param isUpdate + * @return + * @throws Exception + */ + private DocumentoAlfresco uploadDocument(String location, DocumentoAlfresco document, boolean isUpdate) throws Exception { + if(document.getFile()==null){ + throw new Exception("Debe fijar un archivo"); + } + String ubicacion = null; + if(isUpdate){ + ubicacion = location; + }else{ + ubicacion = ApiProperties.getProperty("api.doclocation.base", this.site)+"/"+ location; + } + String uri = ApiProperties.getProperty("api.uri.create.general")+ + UriUtils.formatearParametrosUrl( + "tipo=" +document.getTipo() + +"&ubicacion=" +ubicacion + +"&modificadoPor="+document.getModificadoPor() + +"&propiedades="+this.armarParametrosPropiedades(document) + ); + + FileBody bin = new FileBody(document.getFile()); + HttpEntity entityHttp = null; + if(isUpdate){ + entityHttp = MultipartEntityBuilder.create() + .addPart("archivo", bin) + .addPart("filename", new StringBody(document.getNombre(), ContentType.create(MIME_TEXT, Consts.ISO_8859_1))) + .addPart("xPathUpdateDocument", new StringBody(document.getxPathLocation(), ContentType.create(MIME_TEXT, Consts.ISO_8859_1))) + .build(); + }else{ + entityHttp = MultipartEntityBuilder.create() + .addPart("archivo", bin) + .addPart("filename", new StringBody(document.getNombre(), ContentType.create(MIME_TEXT, Consts.ISO_8859_1))) + .build(); + } + try { + String response = this.apiRequest.authRequest(EnumRequestType.POST, uri, entityHttp).toString(); + JSONObject jo = (JSONObject) JSONSerializer.toJSON(response); + return this.getSingleDocumentResponse(jo); + } catch (HttpException e) { + throw new ExceptionWebscript("Error al conectar con el servidor de alfresco", e); + } + } + + /** + * Método que carga un nuevo documento en la ruta ingresada + * @param partialxPathLocation ruta xpath en donde se almacenará el documento + * @param document + * @return + * @throws Exception + */ + public DocumentoAlfresco uploadNewDocument(String partialxPathLocation, DocumentoAlfresco document) throws Exception { + return this.uploadDocument(partialxPathLocation, document, false); + } + + /** + * Para actualizar el documento primero lo consulto + * @param document + * @return + * @throws Exception + */ + public DocumentoAlfresco uploadUpdateDocument(DocumentoAlfresco document) throws Exception { + return this.uploadDocument(document.getxPathLocation(), document, true); + } + /** + * Elimina un documento dado un nodeRef. + * @param nodeRef Identificador único del documento o carpeta que se desea eliminar + * @return Boolean indicando si se realizó el proceso de eliminación de forma correcta. + * @throws Exception Se ejecuta una excepción cuando no se encuentra el documento en el repositorio Alfresco + */ + public boolean deleteDocument(String nodeRef) throws Exception { + StringBuilder urlDescarga = new StringBuilder(ApiProperties.getProperty("api.uri.delete.general")); + urlDescarga.append(nodeRef.replace("://", "/")); + Object response = this.apiRequest.authRequest(EnumRequestType.DELETE, urlDescarga.toString(), false, true); + JSONObject jo = (JSONObject) JSONSerializer.toJSON(response); + return Boolean.parseBoolean(jo.get("overallSuccess").toString()); + } + + public String getSite() { + return site; + } + +} diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/client/.svn/text-base/DocumentoAlfresco.java.svn-base b/base/core/alfresco-client/src/main/java/com/fp/alfresco/client/.svn/text-base/DocumentoAlfresco.java.svn-base new file mode 100644 index 0000000..c4f7ef9 --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/client/.svn/text-base/DocumentoAlfresco.java.svn-base @@ -0,0 +1,180 @@ +/** + * + */ +package com.fp.alfresco.client; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import com.fp.alfresco.enums.EnumDataType; +import com.fp.alfresco.enums.EnumDocumentType; + +/** + * Documento que contiene las propiedades que posee todo documento alfresco + * @author bpt + * + */ +public class DocumentoAlfresco { + private String id; + private String nombre; + private String modificadoPor; + private String accesoDescarga; + private String xPathLocationPadre; + private String xPathLocation; + private String tipo; + private Map propiedades; + private Map> propiedadesToSet; + private File file; + + public DocumentoAlfresco(String nombre, String modificadoPor){ + this.nombre = nombre; + this.modificadoPor = modificadoPor; + this.tipo = EnumDocumentType.FILE.getValue(); + this.propiedades = new HashMap(); + this.propiedadesToSet = new HashMap>(); + } + + /** + * @return Retorna el atributo id + */ + public String getId() { + return this.id; + } + /** + * @param id Parámetro a fijar en el atributo id + */ + public void setId(String id) { + this.id = id; + } + /** + * @return Retorna el atributo nombre + */ + public String getNombre() { + return this.nombre; + } + /** + * @param nombre Parámetro a fijar en el atributo nombre + */ + public void setNombre(String nombre) { + this.nombre = nombre; + } + + /** + * @return Retorna el atributo modificadoPor + */ + public String getModificadoPor() { + return this.modificadoPor; + } + + /** + * @param modificadoPor Parámetro a fijar en el atributo modificadoPor + */ + public void setModificadoPor(String modificadoPor) { + this.modificadoPor = modificadoPor; + } + /** + * @return Retorna el atributo accesoDescarga + */ + public String getAccesoDescarga() { + return this.accesoDescarga; + } + /** + * @param accesoDescarga Parámetro a fijar en el atributo accesoDescarga + */ + public void setAccesoDescarga(String accesoDescarga) { + this.accesoDescarga = accesoDescarga; + } + + /** + * @return Retorna el atributo xPathLocationPadre + */ + public String getxPathLocationPadre() { + return this.xPathLocationPadre; + } + + /** + * @param xPathLocationPadre Parámetro a fijar en el atributo xPathLocationPadre + */ + public void setxPathLocationPadre(String xPathLocationPadre) { + this.xPathLocationPadre = xPathLocationPadre; + } + + /** + * @return Retorna el atributo xPathLocation + */ + public String getxPathLocation() { + return this.xPathLocation; + } + /** + * @param xPathLocation Parámetro a fijar en el atributo xPathLocation + */ + public void setxPathLocation(String xPathLocation) { + this.xPathLocation = xPathLocation; + } + /** + * @return Retorna el atributo tipo + */ + public String getTipo() { + return this.tipo; + } + /** + * @param tipo Parámetro a fijar en el atributo tipo + */ + public void setTipo(String tipo) { + this.tipo = tipo; + } + /** + * @return Retorna el atributo propiedades + */ + public Map getPropiedades() { + return this.propiedades; + } + /** + * @param propiedades Parámetro a fijar en el atributo propiedades + */ + public void setPropiedades(Map propiedades) { + this.propiedades = propiedades; + } + + /** + * @return Retorna el atributo propiedadesToSet + */ + public Map> getPropiedadesToSet() { + return this.propiedadesToSet; + } + + /** + * @param propiedadesToSet Parámetro a fijar en el atributo propiedadesToSet + */ + public void setPropiedadesToSet( + Map> propiedadesToSet) { + this.propiedadesToSet = propiedadesToSet; + } + + /** + * @return Retorna el atributo file + */ + public File getFile() { + return this.file; + } + /** + * @param file Parámetro a fijar en el atributo file + */ + public void setFile(File file) { + this.file = file; + } + + /** + * Método para agregar una propiedad al documento que se va a subir + * @param name Nombre del campo + * @param value Valor del campo + * @param type Tipo de dato del campo + */ + public void setPropiedadCampo(String name, Object value, EnumDataType type){ + HashMap item = new HashMap(); + item.put("value", value); + item.put("type", type); + this.propiedadesToSet.put(name, item); + } +} diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/client/.svn/text-base/Prueba.java.svn-base b/base/core/alfresco-client/src/main/java/com/fp/alfresco/client/.svn/text-base/Prueba.java.svn-base new file mode 100644 index 0000000..f6d6952 --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/client/.svn/text-base/Prueba.java.svn-base @@ -0,0 +1,151 @@ +/** + * + */ +package com.fp.alfresco.client; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +import org.apache.commons.io.IOUtils; + +/** + * Clases test de Alfresco api client + * @author bpt + * + */ +public class Prueba { + + /** + * Método principal + * @param args + * @throws Exception + */ + public static void main(String[] args) throws Exception { + subirActualizarDocumento(); + } + + /** + * Actualiza documentos + * @throws Exception + */ + public static void subirActualizarDocumento() throws Exception{ + AlfrescoApi api = new AlfrescoApi("ejemplo"); + File f = new File("/home/james/DAVID/xpathAlfBujias.pdf"); + DocumentoAlfresco doc = api.findOneByXPathLocation("/app:company_home/st:sites/cm:ejemplo/cm:documentLibrary/cm:Carga_Archivos_Prueba/cm:xpathAlfBujias.pdf"); + //DocumentoAlfresco doc = api.findOneByXPathLocation("/app:company_home/st:sites/cm:spj/cm:documentLibrary/cm:INTENDENCIAS/cm:INTENDENCIA DE CUENCA/cm:2015/cm:OCTUBRE/cm:torneo_futbol.xlsx"); + doc.setModificadoPor("dcruz"); + doc.setFile(f); + doc.setNombre(f.getName()); + doc = api.uploadUpdateDocument(doc); + } + + /** + * Sube documentos + * @throws Exception + */ + public static void subirDocumento() throws Exception{ + AlfrescoApi api = new AlfrescoApi("ejemplo"); + File f = new File("/home/james/DAVID/xpathAlfBujias.pdf"); + DocumentoAlfresco doc = new DocumentoAlfresco(f.getName(), "dcruz"); +// doc.setTipo("sbspjd:providenciasJudiciales"); + doc.setModificadoPor("dcruz"); + doc.setFile(f); +// doc.setPropiedadCampo("sbspjd:numeroCircular", "SG-2015-3612", EnumDataType.STRING); +// doc.setPropiedadCampo("sbspjd:fechaPubliSist", new Date(), EnumDataType.DATE); +// doc.setPropiedadCampo("sbsgen:remitente", "COACTIVAS DEL SRI DEL NORTE", EnumDataType.STRING); +// doc.setPropiedadCampo("sbspjd:numFojas", 3.0, EnumDataType.NUMBER); + doc.setNombre(f.getName()); + + doc = api.uploadNewDocument("cm:Carga_Archivos_Prueba", doc); + } + + /** + * Descarga documentos + * @throws Exception + */ + public static void descargarDocumento() throws Exception{ + AlfrescoApi api = new AlfrescoApi("ejemplo"); + DocumentoAlfresco doc =api.findById("workspace://SpacesStore/90e9b3d1-cb64-45ca-bd99-087b87052cf7"); + InputStream inputStream = api.downloadDocumentById(doc.getId()); + OutputStream outputStream = new FileOutputStream("/home/james/DAVID/alf_cat_bujias_2011.pdf"); + IOUtils.copy(inputStream, outputStream); + IOUtils.closeQuietly(outputStream); + } + + /** + * Descarga ayudas + * @throws Exception + */ + public static void descargarDocumentoAyudas() throws Exception{ + AlfrescoApi api = new AlfrescoApi("ejemplo"); +// InputStream inputStream = api.downloadDocumentByXPathLocation("/app:company_home/st:sites/cm:seo/cm:documentLibrary/cm:ayudas/cm:parametro.pdf"); + InputStream inputStream = api.downloadDocumentByXPathLocation("/app:company_home/st:sites/cm:{0}/cm:documentLibrary/cm:Carga_Archivos_Prueba/cm:"+"cat_bujias_2011"+".pdf", true); + OutputStream outputStream = new FileOutputStream("/home/james/DAVID/xpathAlfBujias.pdf"); + IOUtils.copy(inputStream, outputStream); + outputStream.close(); + } + + /** + * busca por xpath + * @throws Exception + */ + public static void buscarPorXpathLocation() throws Exception{ + AlfrescoApi api = new AlfrescoApi("jep"); + DocumentoAlfresco doc = api.findOneByXPathLocation("/app:company_home/st:sites/cm:jep/cm:documentLibrary/cm:Carga_Archivos_Plantilla/cm:cat_bujias_2011.pdf"); + System.out.println(doc); +// if(doc!=null){ + //doc.getxPathLocation(); +// } + } + + /** + * Busca por id + * @throws Exception + */ + public static void buscarPorId() throws Exception{ + AlfrescoApi api = new AlfrescoApi("seo"); + DocumentoAlfresco doc = api.findById("workspace://SpacesStore/6b502f0b-39f4-47a8-915d-071cacc953cf"); + System.out.println(doc); + } + + /** + * Busca por contenido + * @throws Exception + */ + public static void buscarPorContenido() throws Exception{ + AlfrescoApi api = new AlfrescoApi("seo"); + List ldoc = api.findByContent("fines pertinentes"); + System.out.println(ldoc); + } + + /** + * Busca por atributos + * @throws Exception + */ + public static void buscarPorAtributo() throws Exception{ + AlfrescoApi api = new AlfrescoApi("seo"); + DateFormat iso8601 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); + String string = "2013-12-23"; + Date date = new SimpleDateFormat("yyyy-MM-dd").parse(string); + String ds = iso8601.format(date); + List ldoc = api.findByAttribute("sbspjd:fechaFRecepcion", ds); + System.out.println(ldoc); + } + + /** + * Elimina por id + * @throws Exception + */ + public static void eliminarDocumentoPorId() throws Exception{ + AlfrescoApi api = new AlfrescoApi("ejemplo"); + api.deleteDocument("workspace://SpacesStore/c358fb30-a001-49dc-9ef9-b2b185f48325"); + + } + +} diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/client/AlfrescoApi.java b/base/core/alfresco-client/src/main/java/com/fp/alfresco/client/AlfrescoApi.java new file mode 100644 index 0000000..ae200fe --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/client/AlfrescoApi.java @@ -0,0 +1,434 @@ +/** + * + */ +package com.fp.alfresco.client; + +import java.io.InputStream; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TimeZone; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import net.sf.json.JSONSerializer; + +import org.apache.commons.lang.StringEscapeUtils; +import org.apache.http.Consts; +import org.apache.http.HttpEntity; +import org.apache.http.HttpException; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.entity.mime.content.FileBody; +import org.apache.http.entity.mime.content.StringBody; + +import com.fp.alfresco.enums.EnumDataType; +import com.fp.alfresco.enums.EnumRequestType; +import com.fp.alfresco.exception.ExceptionWebscript; +import com.fp.alfresco.util.ApiProperties; +import com.fp.alfresco.util.ApiRequest; +import com.fp.alfresco.util.UriUtils; + +/** + * + * Clase que proporciona métodos comunes para interactuar con el repositorio de Alfresco + * @author bpt + * + */ +public class AlfrescoApi { + + /** + * Objeto de tipo ApiRequest que realiza las consultas a alfresco + */ + private ApiRequest apiRequest; + + /** + * Variable que contiene el namespace base del API de alfresco + */ + private String baseQuery; + + /** + * Variable que contiene el nombre del sitio que se consumira en la llamada a Alfresco + */ + private String site; + + private static final String MIME_TEXT = ApiProperties.getProperty("api.common.mime.type"); + + private static final String PREFIX_METADATA = ApiProperties.getProperty("api.name.prefix.metadata"); + + /** + * Constructor + */ + public AlfrescoApi(String site){ + this.apiRequest = new ApiRequest(); + this.site = site; + this.baseQuery = ApiProperties.getProperty("api.site.defaultquery", site); + } + + /** + * Método principal para la busqueda de documentos + * @param query + * @param ticket + * @return + * @throws Exception + */ + public List findDocuments(String query) throws Exception{ + String uri = ApiProperties.getProperty("api.uri.search.general")+UriUtils.formatearParametrosUrl("query=" + this.baseQuery+ " AND " + query); + + String response = this.apiRequest.authRequest(EnumRequestType.GET, uri).toString(); + return this.transformeResponse(response); + } + + /** + * Retorna una lista de {@link DocumentoAlfresco} por xpath + * @param xPathLocation la ruta xpath de una carpeta + * @return + * @throws Exception + */ + private List findByXPathLocation(String xPathLocation) throws Exception{ + String uri = ApiProperties.getProperty("api.uri.search.general")+UriUtils.formatearParametrosUrl("query=PATH:\"" + xPathLocation); + String response = this.apiRequest.authRequest(EnumRequestType.GET, uri).toString(); + return this.transformeResponse(response); + } + + /** + * Método que busca por id del documento + * @param documentId + * @return + * @throws Exception + */ + public DocumentoAlfresco findById(String documentId) throws Exception + { + String query = "ID:\""+ documentId +"\""; + List l = this.findDocuments(query); + if(!l.isEmpty()){ + return l.get(0); + } + return null; + } + + /** + * Método que busca un documento por contenido + * @param documentContent + * @return + * @throws Exception + */ + public List findByContent(String documentContent) throws Exception + { + String query = "TEXT:\""+ documentContent+"\""; + return this.findDocuments(query); + } + + /** + * Método que busca un documento por atributo + * @param documentContent + * @return + * @throws Exception + */ + public List findByAttribute(String attributeName, String value) throws Exception + { + attributeName = attributeName.replace(":", "\\:"); + String query = "@"+attributeName+":\""+ value+"\""; + return this.findDocuments(query); + } + + /** + * Método que busca un documento por tipo + * @param type + * @return + * @throws Exception + */ + public List findByType(String type) throws Exception + { + String query = "TYPE:\""+type+"\""; + return this.findDocuments(query); + } + + /** + * Devuelve una lista de {@link DocumentoAlfresco} por xpath de la carpeta + * @param xPathLocationFolder xpath de la carpeta a buscar + * @return + * @throws Exception + */ + public List findListByXPathLocation(String xPathLocationFolder) throws Exception{ + if((xPathLocationFolder==null) || xPathLocationFolder.isEmpty()){ + throw new ExceptionWebscript("Ruta de la carpeta requerido"); + } + xPathLocationFolder+="/*\" AND TYPE:\"cm:content\""; + return this.findByXPathLocation(xPathLocationFolder); + } + + /** + * Retorna un {@link DocumentoAlfresco} por dirección xpath + * @param xPathLocationDocument dirección xpath del documento + * @return + * @throws Exception + */ + public DocumentoAlfresco findOneByXPathLocation(String xPathLocationDocument) throws Exception{ + if((xPathLocationDocument==null) || xPathLocationDocument.isEmpty()){ + throw new ExceptionWebscript("Ruta del documento requerido"); + } + xPathLocationDocument+="\""; + List l = this.findByXPathLocation(xPathLocationDocument); + if(!l.isEmpty()){ + return l.get(0); + } + return null; + } + + /** + * Recibe la respuesta en JSON y retorna una lista de tipo List + * @param response + * + */ + private List transformeResponse(String response) { + List l = new ArrayList(); + JSONObject json = (JSONObject) JSONSerializer.toJSON(response); + Integer resultados = json.getInt("resultados"); + if(resultados>0){ + JSONArray documents = json.getJSONArray("documentos"); + for (Object object : documents) { + JSONObject jo = (JSONObject) object; + DocumentoAlfresco d = this.getSingleDocumentResponse(jo); + l.add(d); + } + } + return l; + } + + /** + * Retorna un {@link DocumentoAlfresco} en base aun {@link JSONObject} enviado + * @param jo Objeto json que formará el {@link DocumentoAlfresco} + * @return + */ + @SuppressWarnings("unchecked") + private DocumentoAlfresco getSingleDocumentResponse(JSONObject jo) { + Map mprops = jo.getJSONObject("propiedades"); + DocumentoAlfresco d = new DocumentoAlfresco(jo.getString("nombre"), ((Map)mprops.get("cm:modifier")).get("userName").toString()); + d.setId(jo.getString("referencia")); + d.setNombre(jo.getString("nombre")); + d.setModificadoPor(((Map)mprops.get("cm:modifier")).get("userName").toString()); + d.setAccesoDescarga(jo.getString("accesoDescarga")); + d.setxPathLocationPadre(jo.getString("xPathLocationPadre")); + d.setxPathLocation(jo.getString("xPathLocation")); + d.setTipo(jo.getString("tipo")); + d.setPropiedades(new HashMap()); + this.fillPropertiesSearch(d.getPropiedades(), jo.getJSONObject("propiedades")); + return d; + } + + /** + * Método recursivo que llena las propiedades de un documento en un mapa + * @param mprop Mapa para llenar las propiedades de un documento + * @param jobject Propiedad de un documento + */ + @SuppressWarnings("unchecked") + private void fillPropertiesSearch(Map mprop, JSONObject jobject) { + Set ks = jobject.keySet(); + for (String key : ks) { + Object item = jobject.get(key); + if(item instanceof JSONObject){ + Map subProp = new HashMap(); + mprop.put(key, subProp); + this.fillPropertiesSearch(subProp, (JSONObject)item); + }else{ + mprop.put(key, item.toString()); + } + } + } + + /** + * Método que arma los parámetros en base al documento + * @param documento + * @return + * @throws Exception + */ + private String armarParametrosPropiedades(DocumentoAlfresco documento) throws Exception { + TimeZone tz = TimeZone.getTimeZone("GMT-05:00"); + DateFormat iso8601 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); + iso8601.setTimeZone(tz); + StringBuffer cadena = new StringBuffer("{"); + Map> map = documento.getPropiedadesToSet(); + if(map==null){ + cadena.append("}"); + return cadena.toString(); + } + boolean existAttrs = false; + Set keys = map.keySet(); + for (String key : keys) { + if(key.startsWith(PREFIX_METADATA)){ + existAttrs = true; + Map prop = map.get(key); + String propValue = null; + Object type = prop.get("type"); + Object value = prop.get("value"); + if(!(type instanceof EnumDataType)){ + throw new ExceptionWebscript("El campo '"+key+"' debe tener el atributo 'type' de tipo [EnumDataType]"); + } + if(value!=null){ + if(type==EnumDataType.STRING){ + if(!(value instanceof String)) { + throw new ExceptionWebscript("El campo '"+key+"' debe tener el atributo 'value' de tipo [String]"); + } + propValue = StringEscapeUtils.escapeJavaScript(value.toString()); + + }else if(type==EnumDataType.DATE){ + if(!(value instanceof Date)) { + throw new ExceptionWebscript("El campo '"+key+"' debe tener el atributo 'value' de tipo [Date]"); + } + propValue = iso8601.format(value); + propValue = propValue.substring(0,22)+":00"; + }else if(type==EnumDataType.NUMBER){ + if(!(value instanceof Number)) { + throw new ExceptionWebscript("El campo '"+key+"' debe tener el atributo 'value' de tipo [Number]"); + } + propValue = value.toString(); + } + } + if((propValue!=null) && !propValue.isEmpty()) { + cadena.append("\""+key+"\":") + .append("{") + .append("\"value\":").append("\""+propValue+"\"") + .append(",") + .append("\"type\":").append("\""+((EnumDataType)type).getValue()+"\"") + .append("},"); + } + } + } + if(existAttrs) { + cadena.deleteCharAt(cadena.length()-1); + } + cadena.append("}"); + return cadena.toString(); + } + + /** + * Se obtiene un documento en base a su id + * @param documentId id del documento + * @return + * @throws Exception + */ + public InputStream downloadDocumentById(String documentId) throws Exception{ + String uriDownload = ApiProperties.getProperty("api.uri.download.id"); + uriDownload+=documentId.replace("://", "/"); + return (InputStream) this.apiRequest.authRequest(EnumRequestType.GET, uriDownload, true, true); + } + + /** + * Se obtiene un documento en base a su xpath + * @param xPathLocation ruta de la dirección en donde se encuentra el documento + * @param includeSite bandera si se debe especificar el sitio + * @return + * @throws Exception + */ + public InputStream downloadDocumentByXPathLocation(String xPathLocation, boolean includeSite) throws Exception{ + if(includeSite){ + xPathLocation = xPathLocation.replace("{0}", this.site); + } + DocumentoAlfresco docAlfresco = findOneByXPathLocation(xPathLocation); + if(docAlfresco == null){ + return null; + } +// xPathLocation = xPathLocation.replace("/app:", "").replace("/st:", "/").replace("/cm:", "/"); +// String uriDownload = ApiProperties.getProperty("api.uri.download.path", xPathLocation); +// (InputStream) this.apiRequest.authRequest(EnumRequestType.GET, uriDownload, true, true) + return downloadDocumentById(docAlfresco.getId()); + } + + public InputStream downloadDocumentByXPathLocation(String xPathLocation) throws Exception{ + return this.downloadDocumentByXPathLocation(xPathLocation, true); + } + + /** + * Método que carga un documento en una ruta especificada + * @param location + * @param document + * @param isUpdate + * @return + * @throws Exception + */ + private DocumentoAlfresco uploadDocument(String location, DocumentoAlfresco document, boolean isUpdate) throws Exception { + if(document.getFile()==null){ + throw new Exception("Debe fijar un archivo"); + } + String ubicacion = null; + if(isUpdate){ + ubicacion = location; + }else{ + ubicacion = ApiProperties.getProperty("api.doclocation.base", this.site)+"/"+ location; + } + String uri = ApiProperties.getProperty("api.uri.create.general")+ + UriUtils.formatearParametrosUrl( + "tipo=" +document.getTipo() + +"&ubicacion=" +ubicacion + +"&modificadoPor="+document.getModificadoPor() + +"&propiedades="+this.armarParametrosPropiedades(document) + ); + + FileBody bin = new FileBody(document.getFile()); + HttpEntity entityHttp = null; + if(isUpdate){ + entityHttp = MultipartEntityBuilder.create() + .addPart("archivo", bin) + .addPart("filename", new StringBody(document.getNombre(), ContentType.create(MIME_TEXT, Consts.ISO_8859_1))) + .addPart("xPathUpdateDocument", new StringBody(document.getxPathLocation(), ContentType.create(MIME_TEXT, Consts.ISO_8859_1))) + .build(); + }else{ + entityHttp = MultipartEntityBuilder.create() + .addPart("archivo", bin) + .addPart("filename", new StringBody(document.getNombre(), ContentType.create(MIME_TEXT, Consts.ISO_8859_1))) + .build(); + } + try { + String response = this.apiRequest.authRequest(EnumRequestType.POST, uri, entityHttp).toString(); + JSONObject jo = (JSONObject) JSONSerializer.toJSON(response); + return this.getSingleDocumentResponse(jo); + } catch (HttpException e) { + throw new ExceptionWebscript("Error al conectar con el servidor de alfresco", e); + } + } + + /** + * Método que carga un nuevo documento en la ruta ingresada + * @param partialxPathLocation ruta xpath en donde se almacenará el documento + * @param document + * @return + * @throws Exception + */ + public DocumentoAlfresco uploadNewDocument(String partialxPathLocation, DocumentoAlfresco document) throws Exception { + return this.uploadDocument(partialxPathLocation, document, false); + } + + /** + * Para actualizar el documento primero lo consulto + * @param document + * @return + * @throws Exception + */ + public DocumentoAlfresco uploadUpdateDocument(DocumentoAlfresco document) throws Exception { + return this.uploadDocument(document.getxPathLocation(), document, true); + } + /** + * Elimina un documento dado un nodeRef. + * @param nodeRef Identificador único del documento o carpeta que se desea eliminar + * @return Boolean indicando si se realizó el proceso de eliminación de forma correcta. + * @throws Exception Se ejecuta una excepción cuando no se encuentra el documento en el repositorio Alfresco + */ + public boolean deleteDocument(String nodeRef) throws Exception { + StringBuilder urlDescarga = new StringBuilder(ApiProperties.getProperty("api.uri.delete.general")); + urlDescarga.append(nodeRef.replace("://", "/")); + Object response = this.apiRequest.authRequest(EnumRequestType.DELETE, urlDescarga.toString(), false, true); + JSONObject jo = (JSONObject) JSONSerializer.toJSON(response); + return Boolean.parseBoolean(jo.get("overallSuccess").toString()); + } + + public String getSite() { + return site; + } + +} diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/client/DocumentoAlfresco.java b/base/core/alfresco-client/src/main/java/com/fp/alfresco/client/DocumentoAlfresco.java new file mode 100644 index 0000000..c4f7ef9 --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/client/DocumentoAlfresco.java @@ -0,0 +1,180 @@ +/** + * + */ +package com.fp.alfresco.client; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import com.fp.alfresco.enums.EnumDataType; +import com.fp.alfresco.enums.EnumDocumentType; + +/** + * Documento que contiene las propiedades que posee todo documento alfresco + * @author bpt + * + */ +public class DocumentoAlfresco { + private String id; + private String nombre; + private String modificadoPor; + private String accesoDescarga; + private String xPathLocationPadre; + private String xPathLocation; + private String tipo; + private Map propiedades; + private Map> propiedadesToSet; + private File file; + + public DocumentoAlfresco(String nombre, String modificadoPor){ + this.nombre = nombre; + this.modificadoPor = modificadoPor; + this.tipo = EnumDocumentType.FILE.getValue(); + this.propiedades = new HashMap(); + this.propiedadesToSet = new HashMap>(); + } + + /** + * @return Retorna el atributo id + */ + public String getId() { + return this.id; + } + /** + * @param id Parámetro a fijar en el atributo id + */ + public void setId(String id) { + this.id = id; + } + /** + * @return Retorna el atributo nombre + */ + public String getNombre() { + return this.nombre; + } + /** + * @param nombre Parámetro a fijar en el atributo nombre + */ + public void setNombre(String nombre) { + this.nombre = nombre; + } + + /** + * @return Retorna el atributo modificadoPor + */ + public String getModificadoPor() { + return this.modificadoPor; + } + + /** + * @param modificadoPor Parámetro a fijar en el atributo modificadoPor + */ + public void setModificadoPor(String modificadoPor) { + this.modificadoPor = modificadoPor; + } + /** + * @return Retorna el atributo accesoDescarga + */ + public String getAccesoDescarga() { + return this.accesoDescarga; + } + /** + * @param accesoDescarga Parámetro a fijar en el atributo accesoDescarga + */ + public void setAccesoDescarga(String accesoDescarga) { + this.accesoDescarga = accesoDescarga; + } + + /** + * @return Retorna el atributo xPathLocationPadre + */ + public String getxPathLocationPadre() { + return this.xPathLocationPadre; + } + + /** + * @param xPathLocationPadre Parámetro a fijar en el atributo xPathLocationPadre + */ + public void setxPathLocationPadre(String xPathLocationPadre) { + this.xPathLocationPadre = xPathLocationPadre; + } + + /** + * @return Retorna el atributo xPathLocation + */ + public String getxPathLocation() { + return this.xPathLocation; + } + /** + * @param xPathLocation Parámetro a fijar en el atributo xPathLocation + */ + public void setxPathLocation(String xPathLocation) { + this.xPathLocation = xPathLocation; + } + /** + * @return Retorna el atributo tipo + */ + public String getTipo() { + return this.tipo; + } + /** + * @param tipo Parámetro a fijar en el atributo tipo + */ + public void setTipo(String tipo) { + this.tipo = tipo; + } + /** + * @return Retorna el atributo propiedades + */ + public Map getPropiedades() { + return this.propiedades; + } + /** + * @param propiedades Parámetro a fijar en el atributo propiedades + */ + public void setPropiedades(Map propiedades) { + this.propiedades = propiedades; + } + + /** + * @return Retorna el atributo propiedadesToSet + */ + public Map> getPropiedadesToSet() { + return this.propiedadesToSet; + } + + /** + * @param propiedadesToSet Parámetro a fijar en el atributo propiedadesToSet + */ + public void setPropiedadesToSet( + Map> propiedadesToSet) { + this.propiedadesToSet = propiedadesToSet; + } + + /** + * @return Retorna el atributo file + */ + public File getFile() { + return this.file; + } + /** + * @param file Parámetro a fijar en el atributo file + */ + public void setFile(File file) { + this.file = file; + } + + /** + * Método para agregar una propiedad al documento que se va a subir + * @param name Nombre del campo + * @param value Valor del campo + * @param type Tipo de dato del campo + */ + public void setPropiedadCampo(String name, Object value, EnumDataType type){ + HashMap item = new HashMap(); + item.put("value", value); + item.put("type", type); + this.propiedadesToSet.put(name, item); + } +} diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/client/Prueba.java b/base/core/alfresco-client/src/main/java/com/fp/alfresco/client/Prueba.java new file mode 100644 index 0000000..f6d6952 --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/client/Prueba.java @@ -0,0 +1,151 @@ +/** + * + */ +package com.fp.alfresco.client; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +import org.apache.commons.io.IOUtils; + +/** + * Clases test de Alfresco api client + * @author bpt + * + */ +public class Prueba { + + /** + * Método principal + * @param args + * @throws Exception + */ + public static void main(String[] args) throws Exception { + subirActualizarDocumento(); + } + + /** + * Actualiza documentos + * @throws Exception + */ + public static void subirActualizarDocumento() throws Exception{ + AlfrescoApi api = new AlfrescoApi("ejemplo"); + File f = new File("/home/james/DAVID/xpathAlfBujias.pdf"); + DocumentoAlfresco doc = api.findOneByXPathLocation("/app:company_home/st:sites/cm:ejemplo/cm:documentLibrary/cm:Carga_Archivos_Prueba/cm:xpathAlfBujias.pdf"); + //DocumentoAlfresco doc = api.findOneByXPathLocation("/app:company_home/st:sites/cm:spj/cm:documentLibrary/cm:INTENDENCIAS/cm:INTENDENCIA DE CUENCA/cm:2015/cm:OCTUBRE/cm:torneo_futbol.xlsx"); + doc.setModificadoPor("dcruz"); + doc.setFile(f); + doc.setNombre(f.getName()); + doc = api.uploadUpdateDocument(doc); + } + + /** + * Sube documentos + * @throws Exception + */ + public static void subirDocumento() throws Exception{ + AlfrescoApi api = new AlfrescoApi("ejemplo"); + File f = new File("/home/james/DAVID/xpathAlfBujias.pdf"); + DocumentoAlfresco doc = new DocumentoAlfresco(f.getName(), "dcruz"); +// doc.setTipo("sbspjd:providenciasJudiciales"); + doc.setModificadoPor("dcruz"); + doc.setFile(f); +// doc.setPropiedadCampo("sbspjd:numeroCircular", "SG-2015-3612", EnumDataType.STRING); +// doc.setPropiedadCampo("sbspjd:fechaPubliSist", new Date(), EnumDataType.DATE); +// doc.setPropiedadCampo("sbsgen:remitente", "COACTIVAS DEL SRI DEL NORTE", EnumDataType.STRING); +// doc.setPropiedadCampo("sbspjd:numFojas", 3.0, EnumDataType.NUMBER); + doc.setNombre(f.getName()); + + doc = api.uploadNewDocument("cm:Carga_Archivos_Prueba", doc); + } + + /** + * Descarga documentos + * @throws Exception + */ + public static void descargarDocumento() throws Exception{ + AlfrescoApi api = new AlfrescoApi("ejemplo"); + DocumentoAlfresco doc =api.findById("workspace://SpacesStore/90e9b3d1-cb64-45ca-bd99-087b87052cf7"); + InputStream inputStream = api.downloadDocumentById(doc.getId()); + OutputStream outputStream = new FileOutputStream("/home/james/DAVID/alf_cat_bujias_2011.pdf"); + IOUtils.copy(inputStream, outputStream); + IOUtils.closeQuietly(outputStream); + } + + /** + * Descarga ayudas + * @throws Exception + */ + public static void descargarDocumentoAyudas() throws Exception{ + AlfrescoApi api = new AlfrescoApi("ejemplo"); +// InputStream inputStream = api.downloadDocumentByXPathLocation("/app:company_home/st:sites/cm:seo/cm:documentLibrary/cm:ayudas/cm:parametro.pdf"); + InputStream inputStream = api.downloadDocumentByXPathLocation("/app:company_home/st:sites/cm:{0}/cm:documentLibrary/cm:Carga_Archivos_Prueba/cm:"+"cat_bujias_2011"+".pdf", true); + OutputStream outputStream = new FileOutputStream("/home/james/DAVID/xpathAlfBujias.pdf"); + IOUtils.copy(inputStream, outputStream); + outputStream.close(); + } + + /** + * busca por xpath + * @throws Exception + */ + public static void buscarPorXpathLocation() throws Exception{ + AlfrescoApi api = new AlfrescoApi("jep"); + DocumentoAlfresco doc = api.findOneByXPathLocation("/app:company_home/st:sites/cm:jep/cm:documentLibrary/cm:Carga_Archivos_Plantilla/cm:cat_bujias_2011.pdf"); + System.out.println(doc); +// if(doc!=null){ + //doc.getxPathLocation(); +// } + } + + /** + * Busca por id + * @throws Exception + */ + public static void buscarPorId() throws Exception{ + AlfrescoApi api = new AlfrescoApi("seo"); + DocumentoAlfresco doc = api.findById("workspace://SpacesStore/6b502f0b-39f4-47a8-915d-071cacc953cf"); + System.out.println(doc); + } + + /** + * Busca por contenido + * @throws Exception + */ + public static void buscarPorContenido() throws Exception{ + AlfrescoApi api = new AlfrescoApi("seo"); + List ldoc = api.findByContent("fines pertinentes"); + System.out.println(ldoc); + } + + /** + * Busca por atributos + * @throws Exception + */ + public static void buscarPorAtributo() throws Exception{ + AlfrescoApi api = new AlfrescoApi("seo"); + DateFormat iso8601 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); + String string = "2013-12-23"; + Date date = new SimpleDateFormat("yyyy-MM-dd").parse(string); + String ds = iso8601.format(date); + List ldoc = api.findByAttribute("sbspjd:fechaFRecepcion", ds); + System.out.println(ldoc); + } + + /** + * Elimina por id + * @throws Exception + */ + public static void eliminarDocumentoPorId() throws Exception{ + AlfrescoApi api = new AlfrescoApi("ejemplo"); + api.deleteDocument("workspace://SpacesStore/c358fb30-a001-49dc-9ef9-b2b185f48325"); + + } + +} diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/enums/.svn/entries b/base/core/alfresco-client/src/main/java/com/fp/alfresco/enums/.svn/entries new file mode 100644 index 0000000..80e31b0 --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/enums/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/alfresco-client/src/main/java/com/fp/alfresco/enums +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +EnumRequestType.java +file + + + + +2022-07-28T03:40:37.540781Z +2f815af5fb270e9af228af10d41acf4d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +337 + +EnumDataType.java +file + + + + +2022-07-28T03:40:37.540781Z +4561884759cfa26fbd49117f20dc6f03 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +896 + +EnumDocumentType.java +file + + + + +2022-07-28T03:40:37.540781Z +d2a53d8945971354d167bc37743944d0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +748 + diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/enums/.svn/text-base/EnumDataType.java.svn-base b/base/core/alfresco-client/src/main/java/com/fp/alfresco/enums/.svn/text-base/EnumDataType.java.svn-base new file mode 100644 index 0000000..1e2b075 --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/enums/.svn/text-base/EnumDataType.java.svn-base @@ -0,0 +1,50 @@ +/** + * + */ +package com.fp.alfresco.enums; + +import java.util.Date; + +/** + * Enumeración que contiene los valores constantes de los tipos de datos + * @author bpt + * + */ +public enum EnumDataType { + /** + * Tipo de dato {@link String} + */ + STRING("string"), + /** + * Tipo de dato {@link Date} + */ + DATE("date"), + /** + * Tipo de dato {@link Number} + */ + NUMBER("number"); + + /** + * Contiene el valor ingresado de la enumeración + */ + private String value; + + private EnumDataType(String value) { + this.value = value; + } + + /** + * @return Retorna el atributo value + */ + public String getValue() { + return this.value; + } + + /** + * @param value Parámetro a fijar en el atributo value + */ + public void setValue(String value) { + this.value = value; + } + +} diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/enums/.svn/text-base/EnumDocumentType.java.svn-base b/base/core/alfresco-client/src/main/java/com/fp/alfresco/enums/.svn/text-base/EnumDocumentType.java.svn-base new file mode 100644 index 0000000..6443bb5 --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/enums/.svn/text-base/EnumDocumentType.java.svn-base @@ -0,0 +1,41 @@ +/** + * + */ +package com.fp.alfresco.enums; + +/** + * Enumeración que contiene los tipos de documentos que se van a buscar dentro del repositorio + * @author bpt + * + */ +public enum EnumDocumentType { + /** + * Tipo documento carpeta + */ + FOLDER("cm:folder"), + /** + * Tipo documento contenido + */ + FILE("cm:content"); + + private String value; + + private EnumDocumentType(String value) { + this.value = value; + } + + /** + * @return Retorna el atributo value + */ + public String getValue() { + return this.value; + } + + /** + * @param value Parámetro a fijar en el atributo value + */ + public void setValue(String value) { + this.value = value; + } + +} diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/enums/.svn/text-base/EnumRequestType.java.svn-base b/base/core/alfresco-client/src/main/java/com/fp/alfresco/enums/.svn/text-base/EnumRequestType.java.svn-base new file mode 100644 index 0000000..e105bfb --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/enums/.svn/text-base/EnumRequestType.java.svn-base @@ -0,0 +1,24 @@ +/** + * + */ +package com.fp.alfresco.enums; + +/** + * Tipos de solicitud que se realizarán en los webscripts + * @author bpt + * + */ +public enum EnumRequestType { + /** + * Método HTTP GET + */ + GET, + /** + * Método HTTP POST + */ + POST, + /** + * Método HTTP DELETE + */ + DELETE +} diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/enums/EnumDataType.java b/base/core/alfresco-client/src/main/java/com/fp/alfresco/enums/EnumDataType.java new file mode 100644 index 0000000..1e2b075 --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/enums/EnumDataType.java @@ -0,0 +1,50 @@ +/** + * + */ +package com.fp.alfresco.enums; + +import java.util.Date; + +/** + * Enumeración que contiene los valores constantes de los tipos de datos + * @author bpt + * + */ +public enum EnumDataType { + /** + * Tipo de dato {@link String} + */ + STRING("string"), + /** + * Tipo de dato {@link Date} + */ + DATE("date"), + /** + * Tipo de dato {@link Number} + */ + NUMBER("number"); + + /** + * Contiene el valor ingresado de la enumeración + */ + private String value; + + private EnumDataType(String value) { + this.value = value; + } + + /** + * @return Retorna el atributo value + */ + public String getValue() { + return this.value; + } + + /** + * @param value Parámetro a fijar en el atributo value + */ + public void setValue(String value) { + this.value = value; + } + +} diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/enums/EnumDocumentType.java b/base/core/alfresco-client/src/main/java/com/fp/alfresco/enums/EnumDocumentType.java new file mode 100644 index 0000000..6443bb5 --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/enums/EnumDocumentType.java @@ -0,0 +1,41 @@ +/** + * + */ +package com.fp.alfresco.enums; + +/** + * Enumeración que contiene los tipos de documentos que se van a buscar dentro del repositorio + * @author bpt + * + */ +public enum EnumDocumentType { + /** + * Tipo documento carpeta + */ + FOLDER("cm:folder"), + /** + * Tipo documento contenido + */ + FILE("cm:content"); + + private String value; + + private EnumDocumentType(String value) { + this.value = value; + } + + /** + * @return Retorna el atributo value + */ + public String getValue() { + return this.value; + } + + /** + * @param value Parámetro a fijar en el atributo value + */ + public void setValue(String value) { + this.value = value; + } + +} diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/enums/EnumRequestType.java b/base/core/alfresco-client/src/main/java/com/fp/alfresco/enums/EnumRequestType.java new file mode 100644 index 0000000..e105bfb --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/enums/EnumRequestType.java @@ -0,0 +1,24 @@ +/** + * + */ +package com.fp.alfresco.enums; + +/** + * Tipos de solicitud que se realizarán en los webscripts + * @author bpt + * + */ +public enum EnumRequestType { + /** + * Método HTTP GET + */ + GET, + /** + * Método HTTP POST + */ + POST, + /** + * Método HTTP DELETE + */ + DELETE +} diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/exception/.svn/entries b/base/core/alfresco-client/src/main/java/com/fp/alfresco/exception/.svn/entries new file mode 100644 index 0000000..5a1c283 --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/exception/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/alfresco-client/src/main/java/com/fp/alfresco/exception +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ExceptionWebscript.java +file + + + + +2022-07-28T03:40:37.656781Z +a84d50c2c94380d7aae6feb2a5033a9d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +581 + diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/exception/.svn/text-base/ExceptionWebscript.java.svn-base b/base/core/alfresco-client/src/main/java/com/fp/alfresco/exception/.svn/text-base/ExceptionWebscript.java.svn-base new file mode 100644 index 0000000..934a3d0 --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/exception/.svn/text-base/ExceptionWebscript.java.svn-base @@ -0,0 +1,33 @@ +/** + * + */ +package com.fp.alfresco.exception; + +/** + * Excepción que manejará los errores que se producen dentro del API + * @author bpt + * + */ +public class ExceptionWebscript extends Exception { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public ExceptionWebscript() { + super(); + } + + public ExceptionWebscript(String message, Throwable cause) { + super(message, cause); + } + + public ExceptionWebscript(String message) { + super(message); + } + + public ExceptionWebscript(Throwable cause) { + super(cause); + } +} diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/exception/ExceptionWebscript.java b/base/core/alfresco-client/src/main/java/com/fp/alfresco/exception/ExceptionWebscript.java new file mode 100644 index 0000000..934a3d0 --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/exception/ExceptionWebscript.java @@ -0,0 +1,33 @@ +/** + * + */ +package com.fp.alfresco.exception; + +/** + * Excepción que manejará los errores que se producen dentro del API + * @author bpt + * + */ +public class ExceptionWebscript extends Exception { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public ExceptionWebscript() { + super(); + } + + public ExceptionWebscript(String message, Throwable cause) { + super(message, cause); + } + + public ExceptionWebscript(String message) { + super(message); + } + + public ExceptionWebscript(Throwable cause) { + super(cause); + } +} diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/.svn/entries b/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/.svn/entries new file mode 100644 index 0000000..d50cbb6 --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/.svn/entries @@ -0,0 +1,164 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/alfresco-client/src/main/java/com/fp/alfresco/util +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +UriUtils.java +file + + + + +2022-07-28T03:40:37.577781Z +c37a6ae280bafe6c0bbfcd23d7282577 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1747 + +ApiRequest.java +file + + + + +2022-07-28T03:40:37.578781Z +7db6115ac77b916fbf765900f28f4690 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5716 + +ApiProperties.java +file + + + + +2022-07-28T03:40:37.578781Z +9bb1e7338885e6be8e08e765efd9fb6f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1457 + +ApiResponseHandler.java +file + + + + +2022-07-28T03:40:37.578781Z +d9f1c83dd40ada7774d3f4926afb665a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1831 + diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/.svn/text-base/ApiProperties.java.svn-base b/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/.svn/text-base/ApiProperties.java.svn-base new file mode 100644 index 0000000..5b0262b --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/.svn/text-base/ApiProperties.java.svn-base @@ -0,0 +1,57 @@ +/** + * + */ +package com.fp.alfresco.util; + +import java.text.MessageFormat; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * Clase utilitaria que sirve para manipular archivo de propiedades + * @author bpt + * + */ +public class ApiProperties { + private static final String BUNDLE_NAME = "alfresco-api"; + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Devuelve le valor de una propiedad por medio de su clave + * @param key clave enviada para recuperar su valor + * @return + */ + public static String getProperty(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return "Archivo:"+BUNDLE_NAME+" no encontrado"; + } catch (Throwable e) { + return null; + } + } + + /** + * Se obtiene el valor de una propiedad en base la clave y los parámetros enviados + * @param pKey clave + * @param pParameters array de parátros enviados + * @return + */ + public static String getProperty(String pKey, Object... pParameters) { + try { + String msg = null; + try{ + msg = RESOURCE_BUNDLE.getString(pKey); + }catch(Exception e){ + msg = null; + } + if(msg == null){ + msg = pKey; + } + return MessageFormat.format(msg, pParameters); + } catch (Throwable e) { + return null; + } + } +} \ No newline at end of file diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/.svn/text-base/ApiRequest.java.svn-base b/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/.svn/text-base/ApiRequest.java.svn-base new file mode 100644 index 0000000..23ac298 --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/.svn/text-base/ApiRequest.java.svn-base @@ -0,0 +1,158 @@ +/** + * + */ +package com.fp.alfresco.util; + +import org.apache.http.HttpEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpRequestBase; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; + +import com.fp.alfresco.auth.AlfrescoFileAuth; +import com.fp.alfresco.auth.Authentication; +import com.fp.alfresco.enums.EnumRequestType; +import com.fp.alfresco.exception.ExceptionWebscript; + + +/** + * + * Clase que gestiona las peticiones realizadas en el API de Alfresco + * @author bpt + * + */ +public class ApiRequest { + private String uriBase = ApiProperties.getProperty("api.uri.base"); + + private CloseableHttpClient client = HttpClients.createDefault(); + + private Authentication auth = new AlfrescoFileAuth(); + + /** + * Retorna una respuesta a una petición REST simple + * @param requestType tipo de petición + * @param uri URI + * @return respuesta a la petición REST + * @throws Exception + */ + public String simpleRequest(EnumRequestType requestType, String uri) throws Exception{ + HttpRequestBase httpRequest; + uri = this.uriBase+uri; + + if(requestType==EnumRequestType.GET){ + httpRequest = new HttpGet(uri); + }else{ + httpRequest = new HttpPost(uri); + } + ApiResponseHandler handler = new ApiResponseHandler(); + CloseableHttpResponse response = this.client.execute(httpRequest); + return handler.handleResponse(response); + } + + /** + * Método de autenticación de acceso al repositorio de Alfresco + * @param requestType tipo de petición + * @param uri URI de la petición + * @param isOnlyTicket si es solo ticket + * @param entity objeto en la request + * @param isGetEntityContent retorna contenido en la petición REST + * @return un objeto con la respuesta a la autenticació + * @throws Exception + */ + private Object authRequest(EnumRequestType requestType, String uri, boolean isOnlyTicket, HttpEntity entity, boolean isGetEntityContent) throws Exception{ + uri = this.uriBase+uri; + if(this.auth.authenticate()){ + if(isOnlyTicket) { + uri+= "?alf_ticket=" + this.auth.getTicket(); + }else{ + uri+= "&alf_ticket=" + this.auth.getTicket(); + } + HttpRequestBase httpRequest; + if(requestType==EnumRequestType.GET){ + httpRequest = new HttpGet(uri); + }else if(requestType==EnumRequestType.POST){ + httpRequest = new HttpPost(uri); + if(entity!=null){ + ((HttpPost)httpRequest).setEntity(entity); + } + }else { + httpRequest = new HttpDelete(uri); + } + ApiResponseHandler handler = new ApiResponseHandler(); + CloseableHttpResponse response = this.client.execute(httpRequest); +// try { + return handler.handleResponse(response, isGetEntityContent); +// }finally { + //response.close(); +// } + }else{ + throw new ExceptionWebscript("Error al autenticar con alfresco"); + } + } + + /** + * Método de autenticación de acceso al repositorio de Alfresco + * @param requestType tipo de petición + * @param uri URI de la petición + * @return un objeto con la respuesta a la autenticació + * @throws Exception + */ + public Object authRequest(EnumRequestType requestType, String uri) throws Exception{ + return this.authRequest(requestType, uri, false, null, false); + } + + /** + * Método de autenticación de acceso al repositorio de Alfresco + * @param requestType tipo de petición + * @param uri URI de la petición + * @param entity objeto en la request + * @return un objeto con la respuesta a la autenticació + * @throws Exception + */ + public Object authRequest(EnumRequestType requestType, String uri, HttpEntity entity) throws Exception{ + return this.authRequest(requestType, uri, false, entity, false); + } + + /** + * Método de autenticación de acceso al repositorio de Alfresco + * @param requestType tipo de petición + * @param uri URI de la petición + * @param isGetEntityContent retorna contenido en la petición REST + * @return un objeto con la respuesta a la autenticació + * @throws Exception + */ + public Object authRequest(EnumRequestType requestType, String uri, boolean isGetEntityContent) throws Exception{ + return this.authRequest(requestType, uri, false, null, isGetEntityContent); + } + + /** + * Método de autenticación de acceso al repositorio de Alfresco + * @param requestType tipo de petición + * @param uri URI de la petición + * @param isGetEntityContent retorna contenido en la petición REST + * @param isOnlyTicket si es solo ticket + * @return un objeto con la respuesta a la autenticació + * @throws Exception + */ + public Object authRequest(EnumRequestType requestType, String uri, boolean isGetEntityContent, boolean includeTicket) throws Exception{ + return this.authRequest(requestType, uri, includeTicket, null, isGetEntityContent); + } + + /** + * @return Retorna el atributo auth + */ + public Authentication getAuth() { + return this.auth; + } + + /** + * @param auth Parámetro a fijar en el atributo auth + */ + public void setAuth(Authentication auth) { + this.auth = auth; + } + +} diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/.svn/text-base/ApiResponseHandler.java.svn-base b/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/.svn/text-base/ApiResponseHandler.java.svn-base new file mode 100644 index 0000000..147c465 --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/.svn/text-base/ApiResponseHandler.java.svn-base @@ -0,0 +1,58 @@ +/** + * + */ +package com.fp.alfresco.util; + +import java.io.IOException; + +import net.sf.json.JSONObject; +import net.sf.json.JSONSerializer; + +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.ResponseHandler; +import org.apache.http.util.EntityUtils; + +import com.fp.alfresco.exception.ExceptionWebscript; + +/** + * Clase que maneja las respuestas de una petició en el web scripts api client + * @author bpt + * + */ +public class ApiResponseHandler implements ResponseHandler{ + + /** + * Método manejador de respuestas + */ + /* (non-Javadoc) + * @see org.apache.http.client.ResponseHandler#handleResponse(org.apache.http.HttpResponse) + */ + public String handleResponse(HttpResponse response) throws ClientProtocolException, IOException { + return null; + } + + /** + * Método manejador de respuestas y su conversión a un objeto específico + * @param response respuesta recibida + * @param isGetEntity si se lo debe retornar como un Stream un String o un objeto JSON + * @return la respuesta + * @throws Exception + */ + public Object handleResponse(HttpResponse response, boolean isGetEntity) throws Exception{ + int status = response.getStatusLine().getStatusCode(); + HttpEntity entityResponse = response.getEntity(); + if ((status >= 200) && (status < 300)) { + if(isGetEntity){ + return entityResponse.getContent(); + } else { + return EntityUtils.toString(entityResponse); + } + } else { + JSONObject json = (JSONObject) JSONSerializer.toJSON(EntityUtils.toString(entityResponse)); + String message = json.getString("message"); + throw new ExceptionWebscript(message); + } + } +} diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/.svn/text-base/UriUtils.java.svn-base b/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/.svn/text-base/UriUtils.java.svn-base new file mode 100644 index 0000000..fcf44dd --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/.svn/text-base/UriUtils.java.svn-base @@ -0,0 +1,58 @@ +/** + * + */ +package com.fp.alfresco.util; + +import java.net.URI; +import java.net.URISyntaxException; + +/** + * Clase utilitaria con funcionalidades adicionales + * @author bpt + * + */ +public final class UriUtils { + + /** + * Método que parsea la url en formato string que el servidor lo pueda + * procesar. + * + * @param url + * Cadena que forma parte de la url + * @return cadena formatea. + * @throws ExceptionWebscript + * Excepción controlada que define los errores posibles durante + * el procesamiento con el webscript de Alfresco. + */ + public static String formatearParametrosUrl(String url) throws Exception { + try { + URI uri = new URI(null, null, null, url, null); + return uri.toString(); + } catch (URISyntaxException e) { + throw new Exception("ERROR: No se pudo formatear la url para ser entendida por el servidor \n\t URL = " + url, e); + } + } + + /** + * Método que parsea la url en formato ASCII que el servidor lo pueda + * procesar. + * + * @param url + * Cadena que forma parte de la url + * @return cadena formatea. + * @throws ExceptionWebscript + * Excepción controlada que define los errores posibles durante + * el procesamiento con el webscript de Alfresco. + */ + public static String formatearParametrosAsciiUrl(String url) throws Exception { + try { + URI uri = new URI(null, null, null, url, null); + return uri.toASCIIString(); + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + throw new Exception("ERROR: No se pudo formatear la url para ser entendida por el servidor \n\t URL = " + url, e); + } + } + + +} diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/ApiProperties.java b/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/ApiProperties.java new file mode 100644 index 0000000..5b0262b --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/ApiProperties.java @@ -0,0 +1,57 @@ +/** + * + */ +package com.fp.alfresco.util; + +import java.text.MessageFormat; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * Clase utilitaria que sirve para manipular archivo de propiedades + * @author bpt + * + */ +public class ApiProperties { + private static final String BUNDLE_NAME = "alfresco-api"; + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Devuelve le valor de una propiedad por medio de su clave + * @param key clave enviada para recuperar su valor + * @return + */ + public static String getProperty(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return "Archivo:"+BUNDLE_NAME+" no encontrado"; + } catch (Throwable e) { + return null; + } + } + + /** + * Se obtiene el valor de una propiedad en base la clave y los parámetros enviados + * @param pKey clave + * @param pParameters array de parátros enviados + * @return + */ + public static String getProperty(String pKey, Object... pParameters) { + try { + String msg = null; + try{ + msg = RESOURCE_BUNDLE.getString(pKey); + }catch(Exception e){ + msg = null; + } + if(msg == null){ + msg = pKey; + } + return MessageFormat.format(msg, pParameters); + } catch (Throwable e) { + return null; + } + } +} \ No newline at end of file diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/ApiRequest.java b/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/ApiRequest.java new file mode 100644 index 0000000..23ac298 --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/ApiRequest.java @@ -0,0 +1,158 @@ +/** + * + */ +package com.fp.alfresco.util; + +import org.apache.http.HttpEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpRequestBase; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; + +import com.fp.alfresco.auth.AlfrescoFileAuth; +import com.fp.alfresco.auth.Authentication; +import com.fp.alfresco.enums.EnumRequestType; +import com.fp.alfresco.exception.ExceptionWebscript; + + +/** + * + * Clase que gestiona las peticiones realizadas en el API de Alfresco + * @author bpt + * + */ +public class ApiRequest { + private String uriBase = ApiProperties.getProperty("api.uri.base"); + + private CloseableHttpClient client = HttpClients.createDefault(); + + private Authentication auth = new AlfrescoFileAuth(); + + /** + * Retorna una respuesta a una petición REST simple + * @param requestType tipo de petición + * @param uri URI + * @return respuesta a la petición REST + * @throws Exception + */ + public String simpleRequest(EnumRequestType requestType, String uri) throws Exception{ + HttpRequestBase httpRequest; + uri = this.uriBase+uri; + + if(requestType==EnumRequestType.GET){ + httpRequest = new HttpGet(uri); + }else{ + httpRequest = new HttpPost(uri); + } + ApiResponseHandler handler = new ApiResponseHandler(); + CloseableHttpResponse response = this.client.execute(httpRequest); + return handler.handleResponse(response); + } + + /** + * Método de autenticación de acceso al repositorio de Alfresco + * @param requestType tipo de petición + * @param uri URI de la petición + * @param isOnlyTicket si es solo ticket + * @param entity objeto en la request + * @param isGetEntityContent retorna contenido en la petición REST + * @return un objeto con la respuesta a la autenticació + * @throws Exception + */ + private Object authRequest(EnumRequestType requestType, String uri, boolean isOnlyTicket, HttpEntity entity, boolean isGetEntityContent) throws Exception{ + uri = this.uriBase+uri; + if(this.auth.authenticate()){ + if(isOnlyTicket) { + uri+= "?alf_ticket=" + this.auth.getTicket(); + }else{ + uri+= "&alf_ticket=" + this.auth.getTicket(); + } + HttpRequestBase httpRequest; + if(requestType==EnumRequestType.GET){ + httpRequest = new HttpGet(uri); + }else if(requestType==EnumRequestType.POST){ + httpRequest = new HttpPost(uri); + if(entity!=null){ + ((HttpPost)httpRequest).setEntity(entity); + } + }else { + httpRequest = new HttpDelete(uri); + } + ApiResponseHandler handler = new ApiResponseHandler(); + CloseableHttpResponse response = this.client.execute(httpRequest); +// try { + return handler.handleResponse(response, isGetEntityContent); +// }finally { + //response.close(); +// } + }else{ + throw new ExceptionWebscript("Error al autenticar con alfresco"); + } + } + + /** + * Método de autenticación de acceso al repositorio de Alfresco + * @param requestType tipo de petición + * @param uri URI de la petición + * @return un objeto con la respuesta a la autenticació + * @throws Exception + */ + public Object authRequest(EnumRequestType requestType, String uri) throws Exception{ + return this.authRequest(requestType, uri, false, null, false); + } + + /** + * Método de autenticación de acceso al repositorio de Alfresco + * @param requestType tipo de petición + * @param uri URI de la petición + * @param entity objeto en la request + * @return un objeto con la respuesta a la autenticació + * @throws Exception + */ + public Object authRequest(EnumRequestType requestType, String uri, HttpEntity entity) throws Exception{ + return this.authRequest(requestType, uri, false, entity, false); + } + + /** + * Método de autenticación de acceso al repositorio de Alfresco + * @param requestType tipo de petición + * @param uri URI de la petición + * @param isGetEntityContent retorna contenido en la petición REST + * @return un objeto con la respuesta a la autenticació + * @throws Exception + */ + public Object authRequest(EnumRequestType requestType, String uri, boolean isGetEntityContent) throws Exception{ + return this.authRequest(requestType, uri, false, null, isGetEntityContent); + } + + /** + * Método de autenticación de acceso al repositorio de Alfresco + * @param requestType tipo de petición + * @param uri URI de la petición + * @param isGetEntityContent retorna contenido en la petición REST + * @param isOnlyTicket si es solo ticket + * @return un objeto con la respuesta a la autenticació + * @throws Exception + */ + public Object authRequest(EnumRequestType requestType, String uri, boolean isGetEntityContent, boolean includeTicket) throws Exception{ + return this.authRequest(requestType, uri, includeTicket, null, isGetEntityContent); + } + + /** + * @return Retorna el atributo auth + */ + public Authentication getAuth() { + return this.auth; + } + + /** + * @param auth Parámetro a fijar en el atributo auth + */ + public void setAuth(Authentication auth) { + this.auth = auth; + } + +} diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/ApiResponseHandler.java b/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/ApiResponseHandler.java new file mode 100644 index 0000000..147c465 --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/ApiResponseHandler.java @@ -0,0 +1,58 @@ +/** + * + */ +package com.fp.alfresco.util; + +import java.io.IOException; + +import net.sf.json.JSONObject; +import net.sf.json.JSONSerializer; + +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.ResponseHandler; +import org.apache.http.util.EntityUtils; + +import com.fp.alfresco.exception.ExceptionWebscript; + +/** + * Clase que maneja las respuestas de una petició en el web scripts api client + * @author bpt + * + */ +public class ApiResponseHandler implements ResponseHandler{ + + /** + * Método manejador de respuestas + */ + /* (non-Javadoc) + * @see org.apache.http.client.ResponseHandler#handleResponse(org.apache.http.HttpResponse) + */ + public String handleResponse(HttpResponse response) throws ClientProtocolException, IOException { + return null; + } + + /** + * Método manejador de respuestas y su conversión a un objeto específico + * @param response respuesta recibida + * @param isGetEntity si se lo debe retornar como un Stream un String o un objeto JSON + * @return la respuesta + * @throws Exception + */ + public Object handleResponse(HttpResponse response, boolean isGetEntity) throws Exception{ + int status = response.getStatusLine().getStatusCode(); + HttpEntity entityResponse = response.getEntity(); + if ((status >= 200) && (status < 300)) { + if(isGetEntity){ + return entityResponse.getContent(); + } else { + return EntityUtils.toString(entityResponse); + } + } else { + JSONObject json = (JSONObject) JSONSerializer.toJSON(EntityUtils.toString(entityResponse)); + String message = json.getString("message"); + throw new ExceptionWebscript(message); + } + } +} diff --git a/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/UriUtils.java b/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/UriUtils.java new file mode 100644 index 0000000..fcf44dd --- /dev/null +++ b/base/core/alfresco-client/src/main/java/com/fp/alfresco/util/UriUtils.java @@ -0,0 +1,58 @@ +/** + * + */ +package com.fp.alfresco.util; + +import java.net.URI; +import java.net.URISyntaxException; + +/** + * Clase utilitaria con funcionalidades adicionales + * @author bpt + * + */ +public final class UriUtils { + + /** + * Método que parsea la url en formato string que el servidor lo pueda + * procesar. + * + * @param url + * Cadena que forma parte de la url + * @return cadena formatea. + * @throws ExceptionWebscript + * Excepción controlada que define los errores posibles durante + * el procesamiento con el webscript de Alfresco. + */ + public static String formatearParametrosUrl(String url) throws Exception { + try { + URI uri = new URI(null, null, null, url, null); + return uri.toString(); + } catch (URISyntaxException e) { + throw new Exception("ERROR: No se pudo formatear la url para ser entendida por el servidor \n\t URL = " + url, e); + } + } + + /** + * Método que parsea la url en formato ASCII que el servidor lo pueda + * procesar. + * + * @param url + * Cadena que forma parte de la url + * @return cadena formatea. + * @throws ExceptionWebscript + * Excepción controlada que define los errores posibles durante + * el procesamiento con el webscript de Alfresco. + */ + public static String formatearParametrosAsciiUrl(String url) throws Exception { + try { + URI uri = new URI(null, null, null, url, null); + return uri.toASCIIString(); + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + throw new Exception("ERROR: No se pudo formatear la url para ser entendida por el servidor \n\t URL = " + url, e); + } + } + + +} diff --git a/base/core/alfresco-client/src/main/resources/.svn/entries b/base/core/alfresco-client/src/main/resources/.svn/entries new file mode 100644 index 0000000..2df5b8c --- /dev/null +++ b/base/core/alfresco-client/src/main/resources/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/alfresco-client/src/main/resources +svn://172.17.26.185/COMACO + + + +2015-02-20T10:57:23.058271Z +3827 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +alfresco-api.properties +file + + + + +2022-07-28T03:40:37.827782Z +10021dad2318b9b2e95c0ea901c1aa41 +2015-02-20T10:57:23.058271Z +3827 +cpiedra + + + + + + + + + + + + + + + + + + + + + +729 + diff --git a/base/core/alfresco-client/src/main/resources/.svn/text-base/alfresco-api.properties.svn-base b/base/core/alfresco-client/src/main/resources/.svn/text-base/alfresco-api.properties.svn-base new file mode 100644 index 0000000..35ef104 --- /dev/null +++ b/base/core/alfresco-client/src/main/resources/.svn/text-base/alfresco-api.properties.svn-base @@ -0,0 +1,17 @@ +#Configuracion APP +api.user=admin +api.password=admin +api.uri.base=http://172.17.26.184:8080/alfresco/service +api.uri.delete.general=/slingshot/doclib/action/file/node/ +#Directorio base para las consultas +api.doclocation.base=/app:company_home/st:sites/cm:{0}/cm:documentLibrary +api.site.defaultquery=PATH:"/app:company_home/st:sites/cm:{0}/cm:documentLibrary//*" +#Propiedades servicios +api.uri.login=/api/login.json?u={0}&pw={1} +api.uri.download.id=/api/node/content/ +api.uri.download.path=/api/path/content/workspace/SpacesStore/{0} +api.uri.search.general=/com/fp/general/consulta/buscar +api.uri.create.general=/com/fp/general/mantenimiento/crear + +api.name.prefix.metadata=mcommon +api.common.mime.type=text/plain \ No newline at end of file diff --git a/base/core/alfresco-client/src/main/resources/alfresco-api.properties b/base/core/alfresco-client/src/main/resources/alfresco-api.properties new file mode 100644 index 0000000..35ef104 --- /dev/null +++ b/base/core/alfresco-client/src/main/resources/alfresco-api.properties @@ -0,0 +1,17 @@ +#Configuracion APP +api.user=admin +api.password=admin +api.uri.base=http://172.17.26.184:8080/alfresco/service +api.uri.delete.general=/slingshot/doclib/action/file/node/ +#Directorio base para las consultas +api.doclocation.base=/app:company_home/st:sites/cm:{0}/cm:documentLibrary +api.site.defaultquery=PATH:"/app:company_home/st:sites/cm:{0}/cm:documentLibrary//*" +#Propiedades servicios +api.uri.login=/api/login.json?u={0}&pw={1} +api.uri.download.id=/api/node/content/ +api.uri.download.path=/api/path/content/workspace/SpacesStore/{0} +api.uri.search.general=/com/fp/general/consulta/buscar +api.uri.create.general=/com/fp/general/mantenimiento/crear + +api.name.prefix.metadata=mcommon +api.common.mime.type=text/plain \ No newline at end of file diff --git a/base/core/alfresco-client/src/test/.svn/entries b/base/core/alfresco-client/src/test/.svn/entries new file mode 100644 index 0000000..0aea1bf --- /dev/null +++ b/base/core/alfresco-client/src/test/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/alfresco-client/src/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/core/alfresco-client/src/test/java/.svn/entries b/base/core/alfresco-client/src/test/java/.svn/entries new file mode 100644 index 0000000..66f6628 --- /dev/null +++ b/base/core/alfresco-client/src/test/java/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/alfresco-client/src/test/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/core/alfresco-client/src/test/resources/.svn/entries b/base/core/alfresco-client/src/test/resources/.svn/entries new file mode 100644 index 0000000..aeab9b8 --- /dev/null +++ b/base/core/alfresco-client/src/test/resources/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/alfresco-client/src/test/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/core/alfresco-client/target/alfresco-client-2.1.jar b/base/core/alfresco-client/target/alfresco-client-2.1.jar new file mode 100644 index 0000000..267ad91 Binary files /dev/null and b/base/core/alfresco-client/target/alfresco-client-2.1.jar differ diff --git a/base/core/alfresco-client/target/classes/alfresco-api.properties b/base/core/alfresco-client/target/classes/alfresco-api.properties new file mode 100644 index 0000000..35ef104 --- /dev/null +++ b/base/core/alfresco-client/target/classes/alfresco-api.properties @@ -0,0 +1,17 @@ +#Configuracion APP +api.user=admin +api.password=admin +api.uri.base=http://172.17.26.184:8080/alfresco/service +api.uri.delete.general=/slingshot/doclib/action/file/node/ +#Directorio base para las consultas +api.doclocation.base=/app:company_home/st:sites/cm:{0}/cm:documentLibrary +api.site.defaultquery=PATH:"/app:company_home/st:sites/cm:{0}/cm:documentLibrary//*" +#Propiedades servicios +api.uri.login=/api/login.json?u={0}&pw={1} +api.uri.download.id=/api/node/content/ +api.uri.download.path=/api/path/content/workspace/SpacesStore/{0} +api.uri.search.general=/com/fp/general/consulta/buscar +api.uri.create.general=/com/fp/general/mantenimiento/crear + +api.name.prefix.metadata=mcommon +api.common.mime.type=text/plain \ No newline at end of file diff --git a/base/core/alfresco-client/target/classes/com/fp/alfresco/auth/AlfrescoFileAuth.class b/base/core/alfresco-client/target/classes/com/fp/alfresco/auth/AlfrescoFileAuth.class new file mode 100644 index 0000000..ee012e3 Binary files /dev/null and b/base/core/alfresco-client/target/classes/com/fp/alfresco/auth/AlfrescoFileAuth.class differ diff --git a/base/core/alfresco-client/target/classes/com/fp/alfresco/auth/Authentication.class b/base/core/alfresco-client/target/classes/com/fp/alfresco/auth/Authentication.class new file mode 100644 index 0000000..df698b2 Binary files /dev/null and b/base/core/alfresco-client/target/classes/com/fp/alfresco/auth/Authentication.class differ diff --git a/base/core/alfresco-client/target/classes/com/fp/alfresco/client/AlfrescoApi.class b/base/core/alfresco-client/target/classes/com/fp/alfresco/client/AlfrescoApi.class new file mode 100644 index 0000000..a89fd1e Binary files /dev/null and b/base/core/alfresco-client/target/classes/com/fp/alfresco/client/AlfrescoApi.class differ diff --git a/base/core/alfresco-client/target/classes/com/fp/alfresco/client/DocumentoAlfresco.class b/base/core/alfresco-client/target/classes/com/fp/alfresco/client/DocumentoAlfresco.class new file mode 100644 index 0000000..9c6dc13 Binary files /dev/null and b/base/core/alfresco-client/target/classes/com/fp/alfresco/client/DocumentoAlfresco.class differ diff --git a/base/core/alfresco-client/target/classes/com/fp/alfresco/client/Prueba.class b/base/core/alfresco-client/target/classes/com/fp/alfresco/client/Prueba.class new file mode 100644 index 0000000..0eb98c2 Binary files /dev/null and b/base/core/alfresco-client/target/classes/com/fp/alfresco/client/Prueba.class differ diff --git a/base/core/alfresco-client/target/classes/com/fp/alfresco/enums/EnumDataType.class b/base/core/alfresco-client/target/classes/com/fp/alfresco/enums/EnumDataType.class new file mode 100644 index 0000000..742b308 Binary files /dev/null and b/base/core/alfresco-client/target/classes/com/fp/alfresco/enums/EnumDataType.class differ diff --git a/base/core/alfresco-client/target/classes/com/fp/alfresco/enums/EnumDocumentType.class b/base/core/alfresco-client/target/classes/com/fp/alfresco/enums/EnumDocumentType.class new file mode 100644 index 0000000..2beb420 Binary files /dev/null and b/base/core/alfresco-client/target/classes/com/fp/alfresco/enums/EnumDocumentType.class differ diff --git a/base/core/alfresco-client/target/classes/com/fp/alfresco/enums/EnumRequestType.class b/base/core/alfresco-client/target/classes/com/fp/alfresco/enums/EnumRequestType.class new file mode 100644 index 0000000..3e80766 Binary files /dev/null and b/base/core/alfresco-client/target/classes/com/fp/alfresco/enums/EnumRequestType.class differ diff --git a/base/core/alfresco-client/target/classes/com/fp/alfresco/exception/ExceptionWebscript.class b/base/core/alfresco-client/target/classes/com/fp/alfresco/exception/ExceptionWebscript.class new file mode 100644 index 0000000..1aede1b Binary files /dev/null and b/base/core/alfresco-client/target/classes/com/fp/alfresco/exception/ExceptionWebscript.class differ diff --git a/base/core/alfresco-client/target/classes/com/fp/alfresco/util/ApiProperties.class b/base/core/alfresco-client/target/classes/com/fp/alfresco/util/ApiProperties.class new file mode 100644 index 0000000..5a0631a Binary files /dev/null and b/base/core/alfresco-client/target/classes/com/fp/alfresco/util/ApiProperties.class differ diff --git a/base/core/alfresco-client/target/classes/com/fp/alfresco/util/ApiRequest.class b/base/core/alfresco-client/target/classes/com/fp/alfresco/util/ApiRequest.class new file mode 100644 index 0000000..1712268 Binary files /dev/null and b/base/core/alfresco-client/target/classes/com/fp/alfresco/util/ApiRequest.class differ diff --git a/base/core/alfresco-client/target/classes/com/fp/alfresco/util/ApiResponseHandler.class b/base/core/alfresco-client/target/classes/com/fp/alfresco/util/ApiResponseHandler.class new file mode 100644 index 0000000..e127fa3 Binary files /dev/null and b/base/core/alfresco-client/target/classes/com/fp/alfresco/util/ApiResponseHandler.class differ diff --git a/base/core/alfresco-client/target/classes/com/fp/alfresco/util/UriUtils.class b/base/core/alfresco-client/target/classes/com/fp/alfresco/util/UriUtils.class new file mode 100644 index 0000000..c27f860 Binary files /dev/null and b/base/core/alfresco-client/target/classes/com/fp/alfresco/util/UriUtils.class differ diff --git a/base/core/alfresco-client/target/maven-archiver/pom.properties b/base/core/alfresco-client/target/maven-archiver/pom.properties new file mode 100644 index 0000000..a69c47e --- /dev/null +++ b/base/core/alfresco-client/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:53:09 ECT 2022 +version=2.1 +groupId=com.fp.base.core +artifactId=alfresco-client diff --git a/base/core/bpm/.svn/dir-prop-base b/base/core/bpm/.svn/dir-prop-base new file mode 100644 index 0000000..3e2a6f2 --- /dev/null +++ b/base/core/bpm/.svn/dir-prop-base @@ -0,0 +1,9 @@ +K 10 +svn:ignore +V 37 +.classpath +.project +.settings +target + +END diff --git a/base/core/bpm/.svn/entries b/base/core/bpm/.svn/entries new file mode 100644 index 0000000..801c684 --- /dev/null +++ b/base/core/bpm/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/bpm +svn://172.17.26.185/COMACO + + + +2014-12-10T05:53:44.943625Z +3397 +gbenavides +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:38.645785Z +24fff636df8c33127fd12e871798a753 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1292 + diff --git a/base/core/bpm/.svn/text-base/pom.xml.svn-base b/base/core/bpm/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..6895a66 --- /dev/null +++ b/base/core/bpm/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,38 @@ + + + + core + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.core + bpm + bpm + + + com.fp.base.persistence + util + 2.1 + + + com.fp.base.persistence + pgeneral + 2.1 + compile + + + net.sf.json-lib + json-lib + provided + + + xom + xom + provided + + + diff --git a/base/core/bpm/pom.xml b/base/core/bpm/pom.xml new file mode 100644 index 0000000..6895a66 --- /dev/null +++ b/base/core/bpm/pom.xml @@ -0,0 +1,38 @@ + + + + core + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.core + bpm + bpm + + + com.fp.base.persistence + util + 2.1 + + + com.fp.base.persistence + pgeneral + 2.1 + compile + + + net.sf.json-lib + json-lib + provided + + + xom + xom + provided + + + diff --git a/base/core/bpm/src/.svn/entries b/base/core/bpm/src/.svn/entries new file mode 100644 index 0000000..84fe5cd --- /dev/null +++ b/base/core/bpm/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/bpm/src +svn://172.17.26.185/COMACO + + + +2014-12-10T05:53:44.943625Z +3397 +gbenavides + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/base/core/bpm/src/main/.svn/entries b/base/core/bpm/src/main/.svn/entries new file mode 100644 index 0000000..55933ec --- /dev/null +++ b/base/core/bpm/src/main/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/bpm/src/main +svn://172.17.26.185/COMACO + + + +2014-12-10T05:53:44.943625Z +3397 +gbenavides + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/core/bpm/src/main/java/.svn/entries b/base/core/bpm/src/main/java/.svn/entries new file mode 100644 index 0000000..9cc20e8 --- /dev/null +++ b/base/core/bpm/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/bpm/src/main/java +svn://172.17.26.185/COMACO + + + +2014-12-10T05:53:44.943625Z +3397 +gbenavides + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/core/bpm/src/main/java/com/.svn/entries b/base/core/bpm/src/main/java/com/.svn/entries new file mode 100644 index 0000000..453ef1e --- /dev/null +++ b/base/core/bpm/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/bpm/src/main/java/com +svn://172.17.26.185/COMACO + + + +2014-12-10T05:53:44.943625Z +3397 +gbenavides + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/core/bpm/src/main/java/com/fp/.svn/entries b/base/core/bpm/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..45240b8 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/bpm/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-12-10T05:53:44.943625Z +3397 +gbenavides + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +bpm +dir + diff --git a/base/core/bpm/src/main/java/com/fp/bpm/.svn/entries b/base/core/bpm/src/main/java/com/fp/bpm/.svn/entries new file mode 100644 index 0000000..0a54443 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/.svn/entries @@ -0,0 +1,114 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/bpm/src/main/java/com/fp/bpm +svn://172.17.26.185/COMACO + + + +2014-12-10T05:53:44.943625Z +3397 +gbenavides + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +helper +dir + +actions +dir + +EngineExecutor.java +file + + + + +2022-07-28T03:40:38.452784Z +ad7c803c44c25da460cf050749d92dc0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5211 + +query +dir + +rules +dir + +report +dir + +ActionExecutor.java +file + + + + +2022-07-28T03:40:38.452784Z +87091334c2663b77d163c3618bb6ed2a +2014-12-10T05:53:44.943625Z +3397 +gbenavides + + + + + + + + + + + + + + + + + + + + + +10647 + +save +dir + diff --git a/base/core/bpm/src/main/java/com/fp/bpm/.svn/text-base/ActionExecutor.java.netbeans-base b/base/core/bpm/src/main/java/com/fp/bpm/.svn/text-base/ActionExecutor.java.netbeans-base new file mode 100644 index 0000000..301147c --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/.svn/text-base/ActionExecutor.java.netbeans-base @@ -0,0 +1,272 @@ +package com.fp.bpm; + +import java.math.BigDecimal; +import java.net.InetAddress; +import java.util.List; + +import com.fp.base.persistence.util.helper.MessageManager; +import com.fp.common.helper.BeanManager; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.data.SaveData; +import com.fp.dto.helper.FileHelper; +import com.fp.persistence.commondb.NestedSave; +import com.fp.persistence.commondb.db.DataHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.log.TgeneTransactionLog; +import com.fp.persistence.pgeneral.log.TgeneTransactionMessage; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * @author jorge + * + */ +public abstract class ActionExecutor { + + /** Request de entrada de una transaccion */ + protected Request request; + + /** Objeto que contiene el log de una transaccion. */ + protected TgeneTransactionLog log = null; + + public abstract String execute(String pRequest, List fileItem) throws Exception; + + protected TgeneTransactionLog requestToLog() throws Exception { + InetAddress.getLocalHost().getAddress(); + this.log = new TgeneTransactionLog(); + this.log.setCompanycode(this.request.getCompany()); + this.request.setJournalId(this.request.getJournalId()); + // Fija parametros al objeto + this.log.setPk(this.request.getJournalId()); + this.log.setTransactionmodule(this.request.getTransactionModule()); + this.log.setTransactioncode(this.request.getTransactionCode()); + this.log.setTransactionversion(this.request.getTransactionVersion()); + // Fecha contable + if (this.request.getCompany() != null) { + TgeneAccountingDateBranch d = DataHelper.getInstance().getTgeneAccountingDateBranch(this.request.getCompany(), 0); + this.log.setAccountingdate(d.getAccountingdate()); + this.request.put("accountingdate", d.getAccountingdate()); + this.request.put("workingdate", d.getWorkingdate()); + } + if ((this.request.getTransactionModule() != null) && (this.request.getTransactionCode() != null) + && (this.request.getTransactionVersion() != null)) { + // Almacena en el request los datos generales de la definicion de una transaccion. + this.request.mbeans.put( + "tgenetransaction", + DataHelper.getInstance().getTgeneTransaction(this.request.getTransactionModule(), this.request.getTransactionCode(), + this.request.getTransactionVersion())); + } + this.log.setServer(this.getIp()); + this.log.setRealdate(FormatDates.getInstance().getDataBaseTimestamp()); + this.log.setBranchcode(this.request.getBranchCode()); + this.log.setOfficecode(this.request.getOfficeCode()); + this.log.setTerminalcode(this.request.getTerminalCode()); + this.log.setUsercode(this.request.getUser()); + this.log.setBrowser(this.request.getBrowser()); + this.log.setOperativsystem(this.request.getOperativesystem()); + this.request.mbeans.put("tgenetransactionlog", this.log); + return this.log; + } + + /** + * Metodo que graba el log de transacciones cuando el resultado de ejecucion de la transaccion es ok. + * + * @param pTime Tiempo de ejecucion de la transaccion. + * @throws Exception + */ + public void saveLog(BigDecimal pTime, String pMethod) throws Exception { + // Si el valor del campo transaccion es null no grabar en ese caso se trata de obtener la lista de companias y + // no es la ejecucion de una trabsaccion + // o se trata de una lista de valores. + if (!this.isInsert()) { + return; + } + this.log.setDuration(pTime); + this.log.setResultcode(Response.RESPONSE_OK); + this.log.setUsermessage("OK"); + this.log.setMethod(this.getMethod(pMethod)); + this.setAditionaldata(); + // PersistenceHelper.save(this.log); + // El log se graba en un hilo independiente. + new NestedSave(this.log.getCompanycode(), this.log).start(); + } + + /** + * + * @throws Exception + */ + private void setAditionaldata() throws Exception { + // Fija datos del subject de la agenda, si no tiene un valor previo y el codigo de plantilla de mensaje es + // diferente de null. + this.log.setPersoncode(this.request.getLogperson()); + this.setPerson(); + this.log.setSolicitudenumber(this.request.getLogsolicitude()==null ?this.request.get("csolicitud")==null?this.request.getLogsolicitude():this.request.get("csolicitud").toString():this.request.getLogsolicitude()); + this.setSolicitudnumber(); + this.log.setAccount(this.request.getLogaccount()); + this.setAccount(); + + if (this.request.mbeans.get("tgenetransaction") == null) { + return; + } + Integer messagecode = ((TgeneTransaction) this.request.mbeans.get("tgenetransaction")).getMessagecode(); + if ((this.log.getAditionaldata() == null) && (messagecode != null)) { + String msg = MessageManager.getMessage(this.request); + if(msg.length() > 299){ + this.log.setAditionaldata(msg.substring(0, 298)); + }else{ + this.log.setAditionaldata(msg); + } + if (this.request.getSubject() == null) { + this.request.setSubject(msg); + } + } + + } + + private void setPerson() throws Exception { + if (this.log.getPersoncode() == null) { + try { + BeanManager.setBeanAttributeValue(this.log, "personcode", + SaveData.getPersoncode() == null ? null : Integer.valueOf(SaveData.getPersoncode())); + } catch (Exception e) { + APPLogger.getLogger().debug(e.getStackTrace()[0]); + } + } + } + + private void setAccount() throws Exception { + if (this.log.getAccount() == null) { + try { + BeanManager.setBeanAttributeValue(this.log, "account", SaveData.getAccount()); + } catch (Exception e) { + // TODO: handle exception + } + } + } + + private void setSolicitudnumber() throws Exception { + if (this.log.getSolicitudenumber() == null) { + try { + BeanManager.setBeanAttributeValue(this.log, "solicitudenumber", SaveData.getSolicitudenumber()); + } catch (Exception e) { + // TODO: handle exception + } + } + + } + + /** + * Metodo que almacena el log de auditoria, sin que este forme parte del tiempo de la transaccion. + * + * @param pTime Tiempo de ejecucion de la transaccion. + * @param pResultCode Codigo de resultado. + * @param pMessage Messaje de usuario. + * @throws Exception + */ + public void saveLogWithCommit(BigDecimal pTime, String pMethod, String pResultCode, String pMessage, String indata, String outdata) + throws Exception { + // Si el valor del campo transaccion es null no grabar en ese caso se trata de obtener la lista de companias y + // no es la ejecucion de una trabsaccion + // o se trata de una lista de valores. + if (!this.isInsert()) { + return; + } + + this.log.setDuration(pTime); + this.log.setResultcode(pResultCode.length() > 20 ? pResultCode.substring(0, 19) : pResultCode); + this.log.setUsermessage(pMessage.length() > 200 ? pMessage.substring(0, 199) : pMessage); + this.log.setMethod(this.getMethod(pMethod)); + // Mensajes de entrada y salida + TgeneTransactionMessage m = new TgeneTransactionMessage(); + m.setPk(this.request.getJournalId()); + m.setDatain(indata); + m.setDataout(outdata); + if(indata != null){ + new NestedSave(this.log.getCompanycode(), this.log, m).start(); + }else{ + new NestedSave(this.log.getCompanycode(), this.log).start(); + } + + + } + + /** + * Verifica si almacena o no el log de auditoria. + * + * @return boolean + * @throws Exception + */ + private boolean isInsert() throws Exception { + if ((this.log == null) || (this.log.getTransactionmodule() == null) || (this.log.getTransactioncode() == null)) { + return false; + } + return true; + } + + /** + * Entrega las iniciales del metodo a almacenar en la tabla de log de transacciones. + * + * @param pMethod Nombre del metodo a ejecutar. + * @return String + * @throws Exception + */ + private String getMethod(String pMethod) throws Exception { + if (pMethod.compareTo("save") == 0) { + return "S"; + } + if (pMethod.compareTo("query") == 0) { + return "Q"; + } + if (pMethod.compareTo("logon") == 0) { + return "L"; + } + return ""; + } + + /** + * Entrega la ip del servidor de aplicaciones. + * + * @return String + * @throws Exception + */ + private String getIp() throws Exception { + byte[] ip = InetAddress.getLocalHost().getAddress(); + + String sIPAddress = ""; + + for (int x = 0; x < ip.length; x++) { + if (x > 0) { + // A todos los numeros les anteponemos + // un punto menos al primero + sIPAddress += "."; + } + // Jugamos con los bytes y cambiamos el bit del signo + sIPAddress += ip[x] & 255; + } + return sIPAddress; + } + + /** + * Entrega el valor de: request + * + * @return Request + */ + public Request getRequest() { + return this.request; + } + + /** + * Fija el modulo, transaccion y version de origen. + * + * @throws Exception + */ + public void fillOriginalTransaction() throws Exception { + if (this.request != null) { + this.request.setOriginalTransactionModule(this.request.getTransactionModule()); + this.request.setOriginalTransactionCode(this.request.getTransactionCode()); + this.request.setOriginalTransactionVersion(this.request.getTransactionVersion()); + } + } +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/.svn/text-base/ActionExecutor.java.svn-base b/base/core/bpm/src/main/java/com/fp/bpm/.svn/text-base/ActionExecutor.java.svn-base new file mode 100644 index 0000000..301147c --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/.svn/text-base/ActionExecutor.java.svn-base @@ -0,0 +1,272 @@ +package com.fp.bpm; + +import java.math.BigDecimal; +import java.net.InetAddress; +import java.util.List; + +import com.fp.base.persistence.util.helper.MessageManager; +import com.fp.common.helper.BeanManager; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.data.SaveData; +import com.fp.dto.helper.FileHelper; +import com.fp.persistence.commondb.NestedSave; +import com.fp.persistence.commondb.db.DataHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.log.TgeneTransactionLog; +import com.fp.persistence.pgeneral.log.TgeneTransactionMessage; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * @author jorge + * + */ +public abstract class ActionExecutor { + + /** Request de entrada de una transaccion */ + protected Request request; + + /** Objeto que contiene el log de una transaccion. */ + protected TgeneTransactionLog log = null; + + public abstract String execute(String pRequest, List fileItem) throws Exception; + + protected TgeneTransactionLog requestToLog() throws Exception { + InetAddress.getLocalHost().getAddress(); + this.log = new TgeneTransactionLog(); + this.log.setCompanycode(this.request.getCompany()); + this.request.setJournalId(this.request.getJournalId()); + // Fija parametros al objeto + this.log.setPk(this.request.getJournalId()); + this.log.setTransactionmodule(this.request.getTransactionModule()); + this.log.setTransactioncode(this.request.getTransactionCode()); + this.log.setTransactionversion(this.request.getTransactionVersion()); + // Fecha contable + if (this.request.getCompany() != null) { + TgeneAccountingDateBranch d = DataHelper.getInstance().getTgeneAccountingDateBranch(this.request.getCompany(), 0); + this.log.setAccountingdate(d.getAccountingdate()); + this.request.put("accountingdate", d.getAccountingdate()); + this.request.put("workingdate", d.getWorkingdate()); + } + if ((this.request.getTransactionModule() != null) && (this.request.getTransactionCode() != null) + && (this.request.getTransactionVersion() != null)) { + // Almacena en el request los datos generales de la definicion de una transaccion. + this.request.mbeans.put( + "tgenetransaction", + DataHelper.getInstance().getTgeneTransaction(this.request.getTransactionModule(), this.request.getTransactionCode(), + this.request.getTransactionVersion())); + } + this.log.setServer(this.getIp()); + this.log.setRealdate(FormatDates.getInstance().getDataBaseTimestamp()); + this.log.setBranchcode(this.request.getBranchCode()); + this.log.setOfficecode(this.request.getOfficeCode()); + this.log.setTerminalcode(this.request.getTerminalCode()); + this.log.setUsercode(this.request.getUser()); + this.log.setBrowser(this.request.getBrowser()); + this.log.setOperativsystem(this.request.getOperativesystem()); + this.request.mbeans.put("tgenetransactionlog", this.log); + return this.log; + } + + /** + * Metodo que graba el log de transacciones cuando el resultado de ejecucion de la transaccion es ok. + * + * @param pTime Tiempo de ejecucion de la transaccion. + * @throws Exception + */ + public void saveLog(BigDecimal pTime, String pMethod) throws Exception { + // Si el valor del campo transaccion es null no grabar en ese caso se trata de obtener la lista de companias y + // no es la ejecucion de una trabsaccion + // o se trata de una lista de valores. + if (!this.isInsert()) { + return; + } + this.log.setDuration(pTime); + this.log.setResultcode(Response.RESPONSE_OK); + this.log.setUsermessage("OK"); + this.log.setMethod(this.getMethod(pMethod)); + this.setAditionaldata(); + // PersistenceHelper.save(this.log); + // El log se graba en un hilo independiente. + new NestedSave(this.log.getCompanycode(), this.log).start(); + } + + /** + * + * @throws Exception + */ + private void setAditionaldata() throws Exception { + // Fija datos del subject de la agenda, si no tiene un valor previo y el codigo de plantilla de mensaje es + // diferente de null. + this.log.setPersoncode(this.request.getLogperson()); + this.setPerson(); + this.log.setSolicitudenumber(this.request.getLogsolicitude()==null ?this.request.get("csolicitud")==null?this.request.getLogsolicitude():this.request.get("csolicitud").toString():this.request.getLogsolicitude()); + this.setSolicitudnumber(); + this.log.setAccount(this.request.getLogaccount()); + this.setAccount(); + + if (this.request.mbeans.get("tgenetransaction") == null) { + return; + } + Integer messagecode = ((TgeneTransaction) this.request.mbeans.get("tgenetransaction")).getMessagecode(); + if ((this.log.getAditionaldata() == null) && (messagecode != null)) { + String msg = MessageManager.getMessage(this.request); + if(msg.length() > 299){ + this.log.setAditionaldata(msg.substring(0, 298)); + }else{ + this.log.setAditionaldata(msg); + } + if (this.request.getSubject() == null) { + this.request.setSubject(msg); + } + } + + } + + private void setPerson() throws Exception { + if (this.log.getPersoncode() == null) { + try { + BeanManager.setBeanAttributeValue(this.log, "personcode", + SaveData.getPersoncode() == null ? null : Integer.valueOf(SaveData.getPersoncode())); + } catch (Exception e) { + APPLogger.getLogger().debug(e.getStackTrace()[0]); + } + } + } + + private void setAccount() throws Exception { + if (this.log.getAccount() == null) { + try { + BeanManager.setBeanAttributeValue(this.log, "account", SaveData.getAccount()); + } catch (Exception e) { + // TODO: handle exception + } + } + } + + private void setSolicitudnumber() throws Exception { + if (this.log.getSolicitudenumber() == null) { + try { + BeanManager.setBeanAttributeValue(this.log, "solicitudenumber", SaveData.getSolicitudenumber()); + } catch (Exception e) { + // TODO: handle exception + } + } + + } + + /** + * Metodo que almacena el log de auditoria, sin que este forme parte del tiempo de la transaccion. + * + * @param pTime Tiempo de ejecucion de la transaccion. + * @param pResultCode Codigo de resultado. + * @param pMessage Messaje de usuario. + * @throws Exception + */ + public void saveLogWithCommit(BigDecimal pTime, String pMethod, String pResultCode, String pMessage, String indata, String outdata) + throws Exception { + // Si el valor del campo transaccion es null no grabar en ese caso se trata de obtener la lista de companias y + // no es la ejecucion de una trabsaccion + // o se trata de una lista de valores. + if (!this.isInsert()) { + return; + } + + this.log.setDuration(pTime); + this.log.setResultcode(pResultCode.length() > 20 ? pResultCode.substring(0, 19) : pResultCode); + this.log.setUsermessage(pMessage.length() > 200 ? pMessage.substring(0, 199) : pMessage); + this.log.setMethod(this.getMethod(pMethod)); + // Mensajes de entrada y salida + TgeneTransactionMessage m = new TgeneTransactionMessage(); + m.setPk(this.request.getJournalId()); + m.setDatain(indata); + m.setDataout(outdata); + if(indata != null){ + new NestedSave(this.log.getCompanycode(), this.log, m).start(); + }else{ + new NestedSave(this.log.getCompanycode(), this.log).start(); + } + + + } + + /** + * Verifica si almacena o no el log de auditoria. + * + * @return boolean + * @throws Exception + */ + private boolean isInsert() throws Exception { + if ((this.log == null) || (this.log.getTransactionmodule() == null) || (this.log.getTransactioncode() == null)) { + return false; + } + return true; + } + + /** + * Entrega las iniciales del metodo a almacenar en la tabla de log de transacciones. + * + * @param pMethod Nombre del metodo a ejecutar. + * @return String + * @throws Exception + */ + private String getMethod(String pMethod) throws Exception { + if (pMethod.compareTo("save") == 0) { + return "S"; + } + if (pMethod.compareTo("query") == 0) { + return "Q"; + } + if (pMethod.compareTo("logon") == 0) { + return "L"; + } + return ""; + } + + /** + * Entrega la ip del servidor de aplicaciones. + * + * @return String + * @throws Exception + */ + private String getIp() throws Exception { + byte[] ip = InetAddress.getLocalHost().getAddress(); + + String sIPAddress = ""; + + for (int x = 0; x < ip.length; x++) { + if (x > 0) { + // A todos los numeros les anteponemos + // un punto menos al primero + sIPAddress += "."; + } + // Jugamos con los bytes y cambiamos el bit del signo + sIPAddress += ip[x] & 255; + } + return sIPAddress; + } + + /** + * Entrega el valor de: request + * + * @return Request + */ + public Request getRequest() { + return this.request; + } + + /** + * Fija el modulo, transaccion y version de origen. + * + * @throws Exception + */ + public void fillOriginalTransaction() throws Exception { + if (this.request != null) { + this.request.setOriginalTransactionModule(this.request.getTransactionModule()); + this.request.setOriginalTransactionCode(this.request.getTransactionCode()); + this.request.setOriginalTransactionVersion(this.request.getTransactionVersion()); + } + } +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/.svn/text-base/EngineExecutor.java.netbeans-base b/base/core/bpm/src/main/java/com/fp/bpm/.svn/text-base/EngineExecutor.java.netbeans-base new file mode 100644 index 0000000..454f690 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/.svn/text-base/EngineExecutor.java.netbeans-base @@ -0,0 +1,139 @@ +package com.fp.bpm; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.apache.commons.lang.time.StopWatch; + +import com.fp.bpm.actions.ActionTypes; +import com.fp.common.exception.APPException; +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.logger.APPLogger; +import com.fp.dto.data.SaveData; +import com.fp.dto.helper.FileHelper; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; + +/** + * Clase que se encarga de ejecutar acciones o peticiones que llegan desde los distintos canales. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class EngineExecutor { + + /** Objeto que contiene la instancia de la accion a ejecutar. */ + private ActionExecutor action = null; + + /** Almacena el metod a ejecutar, logon,save,query */ + private String method; + + /** Almacena el string de ejecucion de una transaccion. */ + private String data; + + private JSONObject response; + + /** + * Metodo que se encarga de la ejecucion de una accion. + * + * @param pData Datos con los que se procesa la transaccion. + * @param pFileItems Lista de archivos o imagenes a almacenar en la base. + * @return Object + * @throws Exception + */ + public Object process(String pData, List pFileItems) throws Throwable { + StopWatch sw = null; + boolean error = false; + try { + sw = new StopWatch(); + sw.start(); + this.filldata(pData); + this.execute(pFileItems); + PersistenceHelper.flushTransaction(); + sw.stop(); + + } catch (Throwable e) { + error = true; + try { + if (sw != null) { + sw.stop(); + } + } catch (IllegalStateException e1) { + // o hacer nada el stopwatch ya esta detenido + } + this.fillError(e); + throw e; + } finally { + try { + if (!error) { + this.action.saveLog(this.getTime(sw), this.method); + } else { + this.action.saveLogWithCommit(this.getTime(sw), this.method, this.response.getString("messageCode"), + this.response.getString("message"), this.data, this.response.toString()); + } + } catch (Exception e2) { + APPLogger.getLogger().error("ERROR GRABANDO LOG AUDITORIA \n"); + } + } + return this.response; + + } + + private void execute(List pFileItems) throws Throwable { + this.action = ActionTypes.getActionTypes(this.method).getInstanceOfAction(); + this.response.put("result", this.action.execute(this.data, pFileItems)); + } + + private void filldata(String pData) throws Throwable { + this.response = new JSONObject(); + JSONObject rpcObject = JSONObject.fromObject(pData); + String id = rpcObject.getString("id"); + if (id != null) { + this.response.put("id", id); + } + JSONArray paramsArray = rpcObject.getJSONArray("params"); + List params = new ArrayList(); + for (int i = 0; i < paramsArray.size(); i++) { + params.add(paramsArray.get(i)); + } + this.method = rpcObject.getString("method"); + this.data = params.get(0).toString(); + // Almacena string de datos de entrada en el thread local, se utiliza para llenar + SaveData.setOriginalString(this.data); + } + + /** + * Obtiene el tiempo de respuesta resultado de la ejecucion de una transaccion. + * + * @param sw Objeto que contiene el tiempo de ejecucion de una transaccion. + * @return BigDecimal + * @throws Exception + */ + private BigDecimal getTime(StopWatch sw) throws Exception { + Date d = new Date(sw.getTime()); + return new BigDecimal(FormatDates.getInstance().getTimeInSeconds().format(d)); + } + + private void fillError(Throwable e) throws Exception { + APPLogger.getLogger().error("\nRequest:==>\n" + this.data); + ExceptionHandler eh = new ExceptionHandler(e, "es"); + String usrmsg = eh.getUserMessage(); + APPLogger.getLogger().error("User Message:==>\n" + usrmsg); + this.response.put("message", usrmsg); + this.response.put("messageCode", eh.getCode()); + this.response.put("isAplicationMessage", eh.isAppexception()); + this.response.put("trace", eh.getTechnicalMessage()); + if ((e instanceof APPException) || (e instanceof SQLException)) { + this.response.put("stackTrace", eh.getTechnicalMessage()); + } else { + this.response.put("stackTrace", eh.getStackTrace().length() > 1536 ? eh.getStackTrace().substring(0, 1536) : eh.getStackTrace()); + APPLogger.getLogger().error("StackTrace:==>" + this.response.get("stackTrace")); + } + } +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/.svn/text-base/EngineExecutor.java.svn-base b/base/core/bpm/src/main/java/com/fp/bpm/.svn/text-base/EngineExecutor.java.svn-base new file mode 100644 index 0000000..454f690 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/.svn/text-base/EngineExecutor.java.svn-base @@ -0,0 +1,139 @@ +package com.fp.bpm; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.apache.commons.lang.time.StopWatch; + +import com.fp.bpm.actions.ActionTypes; +import com.fp.common.exception.APPException; +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.logger.APPLogger; +import com.fp.dto.data.SaveData; +import com.fp.dto.helper.FileHelper; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; + +/** + * Clase que se encarga de ejecutar acciones o peticiones que llegan desde los distintos canales. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class EngineExecutor { + + /** Objeto que contiene la instancia de la accion a ejecutar. */ + private ActionExecutor action = null; + + /** Almacena el metod a ejecutar, logon,save,query */ + private String method; + + /** Almacena el string de ejecucion de una transaccion. */ + private String data; + + private JSONObject response; + + /** + * Metodo que se encarga de la ejecucion de una accion. + * + * @param pData Datos con los que se procesa la transaccion. + * @param pFileItems Lista de archivos o imagenes a almacenar en la base. + * @return Object + * @throws Exception + */ + public Object process(String pData, List pFileItems) throws Throwable { + StopWatch sw = null; + boolean error = false; + try { + sw = new StopWatch(); + sw.start(); + this.filldata(pData); + this.execute(pFileItems); + PersistenceHelper.flushTransaction(); + sw.stop(); + + } catch (Throwable e) { + error = true; + try { + if (sw != null) { + sw.stop(); + } + } catch (IllegalStateException e1) { + // o hacer nada el stopwatch ya esta detenido + } + this.fillError(e); + throw e; + } finally { + try { + if (!error) { + this.action.saveLog(this.getTime(sw), this.method); + } else { + this.action.saveLogWithCommit(this.getTime(sw), this.method, this.response.getString("messageCode"), + this.response.getString("message"), this.data, this.response.toString()); + } + } catch (Exception e2) { + APPLogger.getLogger().error("ERROR GRABANDO LOG AUDITORIA \n"); + } + } + return this.response; + + } + + private void execute(List pFileItems) throws Throwable { + this.action = ActionTypes.getActionTypes(this.method).getInstanceOfAction(); + this.response.put("result", this.action.execute(this.data, pFileItems)); + } + + private void filldata(String pData) throws Throwable { + this.response = new JSONObject(); + JSONObject rpcObject = JSONObject.fromObject(pData); + String id = rpcObject.getString("id"); + if (id != null) { + this.response.put("id", id); + } + JSONArray paramsArray = rpcObject.getJSONArray("params"); + List params = new ArrayList(); + for (int i = 0; i < paramsArray.size(); i++) { + params.add(paramsArray.get(i)); + } + this.method = rpcObject.getString("method"); + this.data = params.get(0).toString(); + // Almacena string de datos de entrada en el thread local, se utiliza para llenar + SaveData.setOriginalString(this.data); + } + + /** + * Obtiene el tiempo de respuesta resultado de la ejecucion de una transaccion. + * + * @param sw Objeto que contiene el tiempo de ejecucion de una transaccion. + * @return BigDecimal + * @throws Exception + */ + private BigDecimal getTime(StopWatch sw) throws Exception { + Date d = new Date(sw.getTime()); + return new BigDecimal(FormatDates.getInstance().getTimeInSeconds().format(d)); + } + + private void fillError(Throwable e) throws Exception { + APPLogger.getLogger().error("\nRequest:==>\n" + this.data); + ExceptionHandler eh = new ExceptionHandler(e, "es"); + String usrmsg = eh.getUserMessage(); + APPLogger.getLogger().error("User Message:==>\n" + usrmsg); + this.response.put("message", usrmsg); + this.response.put("messageCode", eh.getCode()); + this.response.put("isAplicationMessage", eh.isAppexception()); + this.response.put("trace", eh.getTechnicalMessage()); + if ((e instanceof APPException) || (e instanceof SQLException)) { + this.response.put("stackTrace", eh.getTechnicalMessage()); + } else { + this.response.put("stackTrace", eh.getStackTrace().length() > 1536 ? eh.getStackTrace().substring(0, 1536) : eh.getStackTrace()); + APPLogger.getLogger().error("StackTrace:==>" + this.response.get("stackTrace")); + } + } +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/ActionExecutor.java b/base/core/bpm/src/main/java/com/fp/bpm/ActionExecutor.java new file mode 100644 index 0000000..85449cf --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/ActionExecutor.java @@ -0,0 +1,266 @@ +package com.fp.bpm; + +import java.math.BigDecimal; +import java.net.InetAddress; +import java.util.List; + +import com.fp.base.persistence.util.helper.MessageManager; +import com.fp.common.helper.BeanManager; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.data.SaveData; +import com.fp.dto.helper.FileHelper; +import com.fp.persistence.commondb.NestedSave; +import com.fp.persistence.commondb.db.DataHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.log.TgeneTransactionLog; +import com.fp.persistence.pgeneral.log.TgeneTransactionMessage; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * @author jorge + * + */ +public abstract class ActionExecutor { + + /** + * Request de entrada de una transaccion + */ + protected Request request; + + /** + * Objeto que contiene el log de una transaccion. + */ + protected TgeneTransactionLog log = null; + + public abstract String execute(String pRequest, List fileItem) throws Exception; + + protected TgeneTransactionLog requestToLog() throws Exception { + InetAddress.getLocalHost().getAddress(); + this.log = new TgeneTransactionLog(); + this.log.setCompanycode(this.request.getCompany()); + this.request.setJournalId(this.request.getJournalId()); + // Fija parametros al objeto + this.log.setPk(this.request.getJournalId()); + this.log.setTransactionmodule(this.request.getTransactionModule()); + this.log.setTransactioncode(this.request.getTransactionCode()); + this.log.setTransactionversion(this.request.getTransactionVersion()); + // Fecha contable + if (this.request.getCompany() != null) { + TgeneAccountingDateBranch d = DataHelper.getInstance().getTgeneAccountingDateBranch(this.request.getCompany(), 0); + this.log.setAccountingdate(d.getAccountingdate()); + this.request.put("accountingdate", d.getAccountingdate()); + this.request.put("workingdate", d.getWorkingdate()); + } + if ((this.request.getTransactionModule() != null) && (this.request.getTransactionCode() != null) + && (this.request.getTransactionVersion() != null)) { + // Almacena en el request los datos generales de la definicion de una transaccion. + this.request.mbeans.put("tgenetransaction",DataHelper.getInstance().getTgeneTransaction( + this.request.getTransactionModule(), this.request.getTransactionCode(),this.request.getTransactionVersion())); + } + this.log.setServer(this.getIp()); + this.log.setRealdate(FormatDates.getInstance().getDataBaseTimestamp()); + this.log.setBranchcode(this.request.getBranchCode()); + this.log.setOfficecode(this.request.getOfficeCode()); + this.log.setTerminalcode(this.request.getTerminalCode()); + this.log.setUsercode(this.request.getUser()); + this.log.setBrowser(this.request.getBrowser()); + this.log.setOperativsystem(this.request.getOperativesystem()); + this.request.mbeans.put("tgenetransactionlog", this.log); + return this.log; + } + + /** + * Metodo que graba el log de transacciones cuando el resultado de ejecucion + * de la transaccion es ok. + * + * @param pTime Tiempo de ejecucion de la transaccion. + * @param pMethod + * @throws Exception + */ + public void saveLog(BigDecimal pTime, String pMethod) throws Exception { + if (!this.isInsert()) { + return; + } + System.err.println(""); + this.log.setDuration(pTime); + this.log.setResultcode(Response.RESPONSE_OK); + this.log.setUsermessage("OK"); + this.log.setMethod(this.getMethod(pMethod)); + this.setAditionaldata(); + new NestedSave(this.log.getCompanycode(), this.log).start(); + } + + /** + * + * @throws Exception + */ + private void setAditionaldata() throws Exception { + this.log.setPersoncode(this.request.getLogperson()); + this.setPerson(); + this.log.setSolicitudenumber(this.request.getLogsolicitude() == null ? this.request.get("csolicitud") == null ? this.request.getLogsolicitude() : this.request.get("csolicitud").toString() : this.request.getLogsolicitude()); + this.setSolicitudnumber(); + this.log.setAccount(this.request.getLogaccount()); + this.setAccount(); + if (this.request.mbeans.get("tgenetransaction") == null) { + return; + } + Integer messagecode = ((TgeneTransaction) this.request.mbeans.get("tgenetransaction")).getMessagecode(); + if ((this.log.getAditionaldata() == null) && (messagecode != null)) { + String msg = MessageManager.getMessage(this.request); + if (msg.length() > 299) { + this.log.setAditionaldata(msg.substring(0, 298)); + } else { + this.log.setAditionaldata(msg); + } + if (this.request.getSubject() == null) { + this.request.setSubject(msg); + } + } + + } + + private void setPerson() throws Exception { + if (this.log.getPersoncode() == null) { + try { + BeanManager.setBeanAttributeValue(this.log, "personcode", + SaveData.getPersoncode() == null ? null : Integer.valueOf(SaveData.getPersoncode())); + } catch (Exception e) { + } + } + } + + private void setAccount() throws Exception { + if (this.log.getAccount() == null) { + try { + BeanManager.setBeanAttributeValue(this.log, "account", SaveData.getAccount()); + } catch (Exception e) { + // TODO: handle exception + } + } + } + + private void setSolicitudnumber() throws Exception { + if (this.log.getSolicitudenumber() == null) { + try { + BeanManager.setBeanAttributeValue(this.log, "solicitudenumber", SaveData.getSolicitudenumber()); + } catch (Exception e) { + // TODO: handle exception + } + } + + } + + /** + * Metodo que almacena el log de auditoria, sin que este forme parte del + * tiempo de la transaccion. + * + * @param pTime Tiempo de ejecucion de la transaccion. + * @param pResultCode Codigo de resultado. + * @param pMessage Messaje de usuario. + * @throws Exception + */ + public void saveLogWithCommit(BigDecimal pTime, String pMethod, String pResultCode, String pMessage, String indata, String outdata) + throws Exception { + if (!this.isInsert()) { + return; + } + + this.log.setDuration(pTime); + this.log.setResultcode(pResultCode.length() > 20 ? pResultCode.substring(0, 19) : pResultCode); + this.log.setUsermessage(pMessage.length() > 200 ? pMessage.substring(0, 199) : pMessage); + this.log.setMethod(this.getMethod(pMethod)); + // Mensajes de entrada y salida + TgeneTransactionMessage m = new TgeneTransactionMessage(); + m.setPk(this.request.getJournalId()); + m.setDatain(indata); + m.setDataout(outdata); + if (indata != null) { + new NestedSave(this.log.getCompanycode(), this.log, m).start(); + } else { + new NestedSave(this.log.getCompanycode(), this.log).start(); + } + + } + + /** + * Verifica si almacena o no el log de auditoria. + * + * @return boolean + * @throws Exception + */ + private boolean isInsert() throws Exception { + if ((this.log == null) || (this.log.getTransactionmodule() == null) || (this.log.getTransactioncode() == null)) { + return false; + } + return true; + } + + /** + * Entrega las iniciales del metodo a almacenar en la tabla de log de + * transacciones. + * + * @param pMethod Nombre del metodo a ejecutar. + * @return String + * @throws Exception + */ + private String getMethod(String pMethod) throws Exception { + if (pMethod.compareTo("save") == 0) { + return "S"; + } + if (pMethod.compareTo("query") == 0) { + return "Q"; + } + if (pMethod.compareTo("logon") == 0) { + return "L"; + } + return ""; + } + + /** + * Entrega la ip del servidor de aplicaciones. + * + * @return String + * @throws Exception + */ + private String getIp() throws Exception { + byte[] ip = InetAddress.getLocalHost().getAddress(); + + String sIPAddress = ""; + + for (int x = 0; x < ip.length; x++) { + if (x > 0) { + // A todos los numeros les anteponemos + // un punto menos al primero + sIPAddress += "."; + } + // Jugamos con los bytes y cambiamos el bit del signo + sIPAddress += ip[x] & 255; + } + return sIPAddress; + } + + /** + * Entrega el valor de: request + * + * @return Request + */ + public Request getRequest() { + return this.request; + } + + /** + * Fija el modulo, transaccion y version de origen. + * + * @throws Exception + */ + public void fillOriginalTransaction() throws Exception { + if (this.request != null) { + this.request.setOriginalTransactionModule(this.request.getTransactionModule()); + this.request.setOriginalTransactionCode(this.request.getTransactionCode()); + this.request.setOriginalTransactionVersion(this.request.getTransactionVersion()); + } + } +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/EngineExecutor.java b/base/core/bpm/src/main/java/com/fp/bpm/EngineExecutor.java new file mode 100644 index 0000000..454f690 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/EngineExecutor.java @@ -0,0 +1,139 @@ +package com.fp.bpm; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.apache.commons.lang.time.StopWatch; + +import com.fp.bpm.actions.ActionTypes; +import com.fp.common.exception.APPException; +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.logger.APPLogger; +import com.fp.dto.data.SaveData; +import com.fp.dto.helper.FileHelper; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; + +/** + * Clase que se encarga de ejecutar acciones o peticiones que llegan desde los distintos canales. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class EngineExecutor { + + /** Objeto que contiene la instancia de la accion a ejecutar. */ + private ActionExecutor action = null; + + /** Almacena el metod a ejecutar, logon,save,query */ + private String method; + + /** Almacena el string de ejecucion de una transaccion. */ + private String data; + + private JSONObject response; + + /** + * Metodo que se encarga de la ejecucion de una accion. + * + * @param pData Datos con los que se procesa la transaccion. + * @param pFileItems Lista de archivos o imagenes a almacenar en la base. + * @return Object + * @throws Exception + */ + public Object process(String pData, List pFileItems) throws Throwable { + StopWatch sw = null; + boolean error = false; + try { + sw = new StopWatch(); + sw.start(); + this.filldata(pData); + this.execute(pFileItems); + PersistenceHelper.flushTransaction(); + sw.stop(); + + } catch (Throwable e) { + error = true; + try { + if (sw != null) { + sw.stop(); + } + } catch (IllegalStateException e1) { + // o hacer nada el stopwatch ya esta detenido + } + this.fillError(e); + throw e; + } finally { + try { + if (!error) { + this.action.saveLog(this.getTime(sw), this.method); + } else { + this.action.saveLogWithCommit(this.getTime(sw), this.method, this.response.getString("messageCode"), + this.response.getString("message"), this.data, this.response.toString()); + } + } catch (Exception e2) { + APPLogger.getLogger().error("ERROR GRABANDO LOG AUDITORIA \n"); + } + } + return this.response; + + } + + private void execute(List pFileItems) throws Throwable { + this.action = ActionTypes.getActionTypes(this.method).getInstanceOfAction(); + this.response.put("result", this.action.execute(this.data, pFileItems)); + } + + private void filldata(String pData) throws Throwable { + this.response = new JSONObject(); + JSONObject rpcObject = JSONObject.fromObject(pData); + String id = rpcObject.getString("id"); + if (id != null) { + this.response.put("id", id); + } + JSONArray paramsArray = rpcObject.getJSONArray("params"); + List params = new ArrayList(); + for (int i = 0; i < paramsArray.size(); i++) { + params.add(paramsArray.get(i)); + } + this.method = rpcObject.getString("method"); + this.data = params.get(0).toString(); + // Almacena string de datos de entrada en el thread local, se utiliza para llenar + SaveData.setOriginalString(this.data); + } + + /** + * Obtiene el tiempo de respuesta resultado de la ejecucion de una transaccion. + * + * @param sw Objeto que contiene el tiempo de ejecucion de una transaccion. + * @return BigDecimal + * @throws Exception + */ + private BigDecimal getTime(StopWatch sw) throws Exception { + Date d = new Date(sw.getTime()); + return new BigDecimal(FormatDates.getInstance().getTimeInSeconds().format(d)); + } + + private void fillError(Throwable e) throws Exception { + APPLogger.getLogger().error("\nRequest:==>\n" + this.data); + ExceptionHandler eh = new ExceptionHandler(e, "es"); + String usrmsg = eh.getUserMessage(); + APPLogger.getLogger().error("User Message:==>\n" + usrmsg); + this.response.put("message", usrmsg); + this.response.put("messageCode", eh.getCode()); + this.response.put("isAplicationMessage", eh.isAppexception()); + this.response.put("trace", eh.getTechnicalMessage()); + if ((e instanceof APPException) || (e instanceof SQLException)) { + this.response.put("stackTrace", eh.getTechnicalMessage()); + } else { + this.response.put("stackTrace", eh.getStackTrace().length() > 1536 ? eh.getStackTrace().substring(0, 1536) : eh.getStackTrace()); + APPLogger.getLogger().error("StackTrace:==>" + this.response.get("stackTrace")); + } + } +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/entries b/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/entries new file mode 100644 index 0000000..bb36466 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/bpm/src/main/java/com/fp/bpm/actions +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ActionTypes.java +file + + + + +2022-07-28T03:40:38.270784Z +2b41556f8963ae6df6570100c2f5c118 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2000 + +QueryAction.java +file + + + + +2022-07-28T03:40:38.270784Z +25a87710b759487beec0d52f66f65e22 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6754 + +LogonAction.java +file + + + + +2022-07-28T03:40:38.270784Z +ad98dbfdea3b6463c0167901d7742800 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3093 + +SaveAction.java +file + + + + +2022-07-28T03:40:38.270784Z +5d274d76fe122bfd5b32482aaaaa6fd0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7149 + +SaveActionHelper.java +file + + + + +2022-07-28T03:40:38.271784Z +9a98ff6688420b31e21800164d616da7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +11605 + +Action.java +file + + + + +2022-07-28T03:40:38.271784Z +3489d2be1a9b2bfe9ed933e86e07afa0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +63 + diff --git a/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/Action.java.svn-base b/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/Action.java.svn-base new file mode 100644 index 0000000..0e44f97 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/Action.java.svn-base @@ -0,0 +1,5 @@ +package com.fp.bpm.actions; + +public interface Action { + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/ActionTypes.java.svn-base b/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/ActionTypes.java.svn-base new file mode 100644 index 0000000..3307dba --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/ActionTypes.java.svn-base @@ -0,0 +1,80 @@ +package com.fp.bpm.actions; + +import com.fp.bpm.ActionExecutor; + +/** + * Enumeracion en la que se define las clases que resuleven o ejecutan una accion. + * @author Jorge Vaca. + * @version 2.1 + */ +public enum ActionTypes { + + QUERY("query","com.fp.bpm.actions.QueryAction"), + SAVE("save","com.fp.bpm.actions.SaveAction"), + LOGON("logon","com.fp.bpm.actions.LogonAction"); + + /** + * Codig de accion al cual se asocia la clase de ejecucion. + */ + private String actionCode; + /** + * Clase especifica que procesa un codigo de accion. + */ + private String actionClass; + + /** + * Crea una instancia de de ActionTypes. + * @param pActionCode Codigo de accion. + * @param pActionClass Clase que procesa la accion.. + */ + private ActionTypes(String pActionCode,String pActionClass) { + actionCode = pActionCode; + actionClass = pActionClass; + } + + /** + * Entraga un objeto ActionTypes dado el codigo de accion. + * @param pActionCode Cdigo de accion. + * @return ActionTypes + * @throws Exception + */ + public static ActionTypes getActionTypes(String pActionCode) throws Exception{ + ActionTypes [] at = null; + at = ActionTypes.values(); + ActionTypes actiontypes = null; + for(ActionTypes obj : at){ + if(obj.actionCode.compareTo(pActionCode) == 0){ + actiontypes = obj; + } + } + return actiontypes; + } + + /** + * Entrega una instancia de la clase que maneja datos por cada accion. + * @return ActionExecutor + * @throws Exception + */ + public ActionExecutor getInstanceOfAction() throws Exception{ + return (ActionExecutor)Class.forName(actionClass).newInstance(); + } + + /** + * Entrega el valor de actionCode. + * @return String + * @throws Exception + */ + public String getActionCode() throws Exception { + return actionCode; + } + + /** + * Entrega el valor de actionClass. + * @return String + * @throws Exception + */ + public String getActionClass() throws Exception { + return actionClass; + } + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/LogonAction.java.svn-base b/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/LogonAction.java.svn-base new file mode 100644 index 0000000..a5b033c --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/LogonAction.java.svn-base @@ -0,0 +1,61 @@ +package com.fp.bpm.actions; + +import java.util.List; + +import com.fp.bpm.ActionExecutor; +import com.fp.bpm.query.QueryProcessor; +import com.fp.common.fin.MessageGenerator; +import com.fp.dto.Response; +import com.fp.dto.helper.FileHelper; +import com.fp.dto.json.Serializer; +import com.fp.dto.query.QueryRequest; + +/** + * Clase que se encarga del logon del usuario. + * + * @author Santiago Castillo. + * @version 2.1 + */ +public class LogonAction extends ActionExecutor { + + @Override + public String execute(String pRequest, List fileItem) throws Exception { + String[] globaldata = pRequest.split(","); + String[] datacompany = globaldata[0].split(":"); + String dataAux = globaldata[1].substring(8, globaldata[1].length() - 3); + String[] data = dataAux.split(":"); + if (data.length != 5) { + return ""; + } + String company = datacompany[1]; + String login = data[0]; + String password = data[1].substring(16, 56); + String jsessionid = data[2]; + String ip = data[3]; + String host = data[4]; + String newRequest = "\"{" + "\"company\":" + company + "," + "\"transactionModule\":\"1\"," + "\"transactionCode\":9998," + + "\"transactionVersion\":1," + "\"login\":\"" + login + "\"," + "\"ip\":\"" + ip + "\"," + "\"itemValue\":\"" + password + "\"," + "\"jsessionid\":\"" + jsessionid + + "\"," + "\"host\":\"" + host + "\"," + "\"TSAFEUSERDETAIL\":{" + "\"automatic\":true," + + "\"beanName\":\"com.fp.persistence.pgeneral.safe.TsafeUserDetail\"," + "\"criteria\":[" + "{" + "\"operation\":\"=\"," + + "\"order\":null," + "\"value\":" + company + "," + "\"property\":\"companycode\"," + + "\"transportBeanClass\":\"com.fp.dto.query.QueryCriteria\"" + "}," + "{" + "\"operation\":\"=\"," + "\"order\":null," + + "\"value\":\"" + login + "\"," + "\"property\":\"pk.usercode\"," + "\"transportBeanClass\":\"com.fp.dto.query.QueryCriteria\"" + + "}," + "{" + "\"operation\":\"=\"," + "\"order\":null," + "\"value\":\"2999-12-31\"," + "\"property\":\"pk.dateto\"," + + "\"transportBeanClass\":\"com.fp.dto.query.QueryCriteria\"" + "}" + "]," + "\"page\":1," + "\"pageSize\":10," + + "\"transportBeanClass\":\"com.fp.dto.query.QueryBean\"," + "\"multirecord\":false" + "}," + "\"querytype\":\"T\"" + "}\""; + Serializer ser = new Serializer(newRequest); + QueryRequest qr = (QueryRequest) ser.toObject(QueryRequest.class); + MessageGenerator mg = MessageGenerator.getInstance(); + qr.setJournalId(mg.generateId(qr.getUser())); + // Log de transaccion + super.request = qr; + super.requestToLog(); + // fin log transaccion + Response res = new Response(Response.RESPONSE_OK, "OK"); + QueryProcessor qp = new QueryProcessor(); + qr.setResponse(res); + qp.process(qr); + ser = new Serializer(res); + return ser.toJSON(); + } +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/QueryAction.java.netbeans-base b/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/QueryAction.java.netbeans-base new file mode 100644 index 0000000..38dce64 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/QueryAction.java.netbeans-base @@ -0,0 +1,178 @@ +package com.fp.bpm.actions; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.SQLException; +import java.util.List; + +import org.apache.commons.lang.time.StopWatch; + +import com.fp.bpm.ActionExecutor; +import com.fp.bpm.helper.TransactionTime; +import com.fp.bpm.query.QueryProcessor; +import com.fp.common.exception.APPException; +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.fin.MessageGenerator; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.data.SaveData; +import com.fp.dto.helper.FileHelper; +import com.fp.dto.json.Serializer; +import com.fp.dto.query.QueryRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.helper.FormatDates; + +/** + * Clase que se encarga del manejo de querys en la aplicacion + */ +public class QueryAction extends ActionExecutor { + + /** + * Metodo que ejecuta el jason enviado desde la web + * + * @param pRequest Json que viaja desde la aplicacion + * @return + * @throws Exception + */ + @Override + public String execute(String pRequest, List fileItem) throws Exception { + Serializer ser = new Serializer(pRequest); + QueryRequest qr = (QueryRequest) ser.toObject(QueryRequest.class); + Response res = new Response(Response.RESPONSE_OK, "OK"); + // fija numero de mensaje + MessageGenerator mg = MessageGenerator.getInstance(); + qr.setJournalId(mg.generateId(qr.getUser())); + // Log de transaccion + super.request = qr; + // fija transaccion original + super.fillOriginalTransaction(); + super.requestToLog(); + // fin log transaccion + // Inicializa datos para el log de la transaccion. + this.fillThreadData(pRequest); + if (TransactionTime.verifyTransactionTime(null, qr)) { + qr.setResponse(res); + QueryProcessor qp = new QueryProcessor(); + qp.process(qr); + } else { + res = new Response("CORE-005", "TRANSACCION FUERA DE HORARIO: " + qr.getTransactionModule() + " TRANSACCION: " + qr.getTransactionCode() + + " VERSION: " + qr.getTransactionVersion()); + } + // res.changeAbstractBeanToMap(); + ser = new Serializer(res); + return ser.toJSON(); + } + + /** + * Metodo que almacena en SaveData, los datos del saverequest de entrada. + * + * @throws Exception + */ + private void fillThreadData(String pData) throws Exception { + // Inicializa el thread local. + SaveData.setSaveRequest(null); + // Almacena string de datos de entrada en el thread local, se utiliza para llenar + if (SaveData.getOriginalString() == null) { + // En producccion se almacena en el EngineExecutor + SaveData.setOriginalString(pData); + } + } + + + public Object process(Request request) throws Exception { + Response response = new Response(Response.RESPONSE_OK, "OK"); + StopWatch sw = null; + boolean error = false; + try { + sw = new StopWatch(); + sw.start(); + + this.execute(request, response); + + sw.stop(); + + } catch (Throwable e) { + error = true; + try { + if (sw != null) { + sw.stop(); + } + } catch (IllegalStateException e1) { + // o hacer nada el stopwatch ya esta detenido + } + this.fillError(e, response); + //retorn excepcion para que no haga commit el ejb querybean + throw e; + } finally { + try { + if (!error) { + super.saveLog(this.getTime(sw), "Q"); + } else { + super.saveLogWithCommit(this.getTime(sw), "Q", response.getResponseCode(), + response.getResponseUserMessage(), null, null); + } + } catch (Exception e2) { + APPLogger.getLogger().error("ERROR GRABANDO LOG AUDITORIA \n"); + } + } + return response; + } + + private void execute(Request request, Response response) throws Exception { + QueryRequest qr = new QueryRequest(); + request.copy(qr); + request.copyMapValues(qr); + + qr.setQueryTables(request.getQueryTables()); + qr.setJsf(true); + qr.setResponse(response); + qr.putAll(request.getModifiedData()); //campos del request codigo de consuta. + // fija numero de mensaje + MessageGenerator mg = MessageGenerator.getInstance(); + qr.setJournalId(mg.generateId(qr.getUser())); + // Log de transaccion + super.request = qr; + // fija transaccion original + super.fillOriginalTransaction(); + super.requestToLog(); + // fin log transaccion + + if (TransactionTime.verifyTransactionTime(null, qr)) { + QueryProcessor qp = new QueryProcessor(); + qp.process(qr); + } else { + throw new GeneralException("CORE-0054", "TRANSACCIN FUERA DE HORARIO MODULO: {0} TRANSACCIN: {1} VERSIN: {2}", qr.getTransactionModule(), + qr.getTransactionCode(), qr.getTransactionVersion()); + } + } + + /** + * Obtiene el tiempo de respuesta resultado de la ejecucion de una transaccion. + * + * @param sw Objeto que contiene el tiempo de ejecucion de una transaccion. + * @return BigDecimal + * @throws Exception + */ + private BigDecimal getTime(StopWatch sw) throws Exception { + Date d = new Date(sw.getTime()); + return new BigDecimal(FormatDates.getInstance().getTimeInSeconds().format(d)); + } + + private void fillError(Throwable e,Response response) throws Exception { + ExceptionHandler eh = new ExceptionHandler(e, "es"); + APPLogger.getLogger().error("User Message:==>\n" + eh.getUserMessage()); + response.setResponseCode(eh.getCode()); + response.setResponseUserMessage(eh.getUserMessage()); + response.setIsAplicationMessage(eh.isAppexception()); + + + if ((e instanceof APPException) || (e instanceof SQLException)) { + response.setResponseStack(eh.getTechnicalMessage()); + } else { + response.setResponseStack( eh.getStackTrace().length() > 1536 ? eh.getStackTrace().substring(0, 1536) : eh.getStackTrace()); + APPLogger.getLogger().error("StackTrace:==>" + response.getResponseStack()); + } + } + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/QueryAction.java.svn-base b/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/QueryAction.java.svn-base new file mode 100644 index 0000000..38dce64 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/QueryAction.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.bpm.actions; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.SQLException; +import java.util.List; + +import org.apache.commons.lang.time.StopWatch; + +import com.fp.bpm.ActionExecutor; +import com.fp.bpm.helper.TransactionTime; +import com.fp.bpm.query.QueryProcessor; +import com.fp.common.exception.APPException; +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.fin.MessageGenerator; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.data.SaveData; +import com.fp.dto.helper.FileHelper; +import com.fp.dto.json.Serializer; +import com.fp.dto.query.QueryRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.helper.FormatDates; + +/** + * Clase que se encarga del manejo de querys en la aplicacion + */ +public class QueryAction extends ActionExecutor { + + /** + * Metodo que ejecuta el jason enviado desde la web + * + * @param pRequest Json que viaja desde la aplicacion + * @return + * @throws Exception + */ + @Override + public String execute(String pRequest, List fileItem) throws Exception { + Serializer ser = new Serializer(pRequest); + QueryRequest qr = (QueryRequest) ser.toObject(QueryRequest.class); + Response res = new Response(Response.RESPONSE_OK, "OK"); + // fija numero de mensaje + MessageGenerator mg = MessageGenerator.getInstance(); + qr.setJournalId(mg.generateId(qr.getUser())); + // Log de transaccion + super.request = qr; + // fija transaccion original + super.fillOriginalTransaction(); + super.requestToLog(); + // fin log transaccion + // Inicializa datos para el log de la transaccion. + this.fillThreadData(pRequest); + if (TransactionTime.verifyTransactionTime(null, qr)) { + qr.setResponse(res); + QueryProcessor qp = new QueryProcessor(); + qp.process(qr); + } else { + res = new Response("CORE-005", "TRANSACCION FUERA DE HORARIO: " + qr.getTransactionModule() + " TRANSACCION: " + qr.getTransactionCode() + + " VERSION: " + qr.getTransactionVersion()); + } + // res.changeAbstractBeanToMap(); + ser = new Serializer(res); + return ser.toJSON(); + } + + /** + * Metodo que almacena en SaveData, los datos del saverequest de entrada. + * + * @throws Exception + */ + private void fillThreadData(String pData) throws Exception { + // Inicializa el thread local. + SaveData.setSaveRequest(null); + // Almacena string de datos de entrada en el thread local, se utiliza para llenar + if (SaveData.getOriginalString() == null) { + // En producccion se almacena en el EngineExecutor + SaveData.setOriginalString(pData); + } + } + + + public Object process(Request request) throws Exception { + Response response = new Response(Response.RESPONSE_OK, "OK"); + StopWatch sw = null; + boolean error = false; + try { + sw = new StopWatch(); + sw.start(); + + this.execute(request, response); + + sw.stop(); + + } catch (Throwable e) { + error = true; + try { + if (sw != null) { + sw.stop(); + } + } catch (IllegalStateException e1) { + // o hacer nada el stopwatch ya esta detenido + } + this.fillError(e, response); + //retorn excepcion para que no haga commit el ejb querybean + throw e; + } finally { + try { + if (!error) { + super.saveLog(this.getTime(sw), "Q"); + } else { + super.saveLogWithCommit(this.getTime(sw), "Q", response.getResponseCode(), + response.getResponseUserMessage(), null, null); + } + } catch (Exception e2) { + APPLogger.getLogger().error("ERROR GRABANDO LOG AUDITORIA \n"); + } + } + return response; + } + + private void execute(Request request, Response response) throws Exception { + QueryRequest qr = new QueryRequest(); + request.copy(qr); + request.copyMapValues(qr); + + qr.setQueryTables(request.getQueryTables()); + qr.setJsf(true); + qr.setResponse(response); + qr.putAll(request.getModifiedData()); //campos del request codigo de consuta. + // fija numero de mensaje + MessageGenerator mg = MessageGenerator.getInstance(); + qr.setJournalId(mg.generateId(qr.getUser())); + // Log de transaccion + super.request = qr; + // fija transaccion original + super.fillOriginalTransaction(); + super.requestToLog(); + // fin log transaccion + + if (TransactionTime.verifyTransactionTime(null, qr)) { + QueryProcessor qp = new QueryProcessor(); + qp.process(qr); + } else { + throw new GeneralException("CORE-0054", "TRANSACCIN FUERA DE HORARIO MODULO: {0} TRANSACCIN: {1} VERSIN: {2}", qr.getTransactionModule(), + qr.getTransactionCode(), qr.getTransactionVersion()); + } + } + + /** + * Obtiene el tiempo de respuesta resultado de la ejecucion de una transaccion. + * + * @param sw Objeto que contiene el tiempo de ejecucion de una transaccion. + * @return BigDecimal + * @throws Exception + */ + private BigDecimal getTime(StopWatch sw) throws Exception { + Date d = new Date(sw.getTime()); + return new BigDecimal(FormatDates.getInstance().getTimeInSeconds().format(d)); + } + + private void fillError(Throwable e,Response response) throws Exception { + ExceptionHandler eh = new ExceptionHandler(e, "es"); + APPLogger.getLogger().error("User Message:==>\n" + eh.getUserMessage()); + response.setResponseCode(eh.getCode()); + response.setResponseUserMessage(eh.getUserMessage()); + response.setIsAplicationMessage(eh.isAppexception()); + + + if ((e instanceof APPException) || (e instanceof SQLException)) { + response.setResponseStack(eh.getTechnicalMessage()); + } else { + response.setResponseStack( eh.getStackTrace().length() > 1536 ? eh.getStackTrace().substring(0, 1536) : eh.getStackTrace()); + APPLogger.getLogger().error("StackTrace:==>" + response.getResponseStack()); + } + } + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/SaveAction.java.netbeans-base b/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/SaveAction.java.netbeans-base new file mode 100644 index 0000000..e2e7b92 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/SaveAction.java.netbeans-base @@ -0,0 +1,185 @@ +package com.fp.bpm.actions; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.SQLException; +import java.util.List; + +import org.apache.commons.lang.time.StopWatch; + +import com.fp.bpm.ActionExecutor; +import com.fp.bpm.helper.TransactionTime; +import com.fp.bpm.save.SaveProcessor; +import com.fp.common.exception.APPException; +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.fin.MessageGenerator; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.data.SaveData; +import com.fp.dto.helper.FileHelper; +import com.fp.dto.json.Serializer; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.helper.FormatDates; + +/** + * Accion que permite el almacenamiento de informacion en la Base de Datos. + * + * @version 2.1 + */ +public class SaveAction extends ActionExecutor { + + /** + * Funcin que gurda los datos enviados en la base de datos + * + * @param pRequest Peticion de Datos para la Accion + * @param fileItem Lista de archivos si van a ser procesados por lote + * @return Respuesta en JSON del proceso del save. + * @throws Exception + */ + @Override + public String execute(String pRequest, List fileItem) throws Exception { + Serializer ser = new Serializer(pRequest); + SaveRequest sr = (SaveRequest) ser.toObject(SaveRequest.class); + // fija numero de mensaje + MessageGenerator mg = MessageGenerator.getInstance(); + sr.setJournalId(mg.generateId(sr.getUser())); + // Log de la transaccion. + super.request = sr; + // fija transaccion original + super.fillOriginalTransaction(); + super.requestToLog(); + // Fin log de transaccion + sr.put("file", fileItem); + Response res = new Response(Response.RESPONSE_OK, "OK"); + + this.fillThreadData(pRequest, sr); + if (TransactionTime.verifyTransactionTime(sr, null)) { + sr.setResponse(res); + SaveProcessor processor = new SaveProcessor(); + processor.process(sr, res); + } else { + res = new Response("CORE-005", "TRANSACCION FUERA DE HORARIO: " + sr.getTransactionModule() + " TRANSACCION: " + sr.getTransactionCode() + + " VERSION: " + sr.getTransactionVersion()); + } + ser = new Serializer(res); + return ser.toJSON(); + } + + /** + * Metodo que almacena en SaveData, los datos del saverequest de entrada. + * + * @throws Exception + */ + private void fillThreadData(String pData, SaveRequest pSaveRequest) throws Exception { + SaveData.setSaveRequest(pSaveRequest); + // Almacena string de datos de entrada en el thread local, se utiliza para llenar + if (SaveData.getOriginalString() == null && pData != null) { + // En producccion se almacena en el EngineExecutor + SaveData.setOriginalString(pData); + } + } + + public Object process(Request request) throws Exception { + Response response = new Response(Response.RESPONSE_OK, "OK"); + StopWatch sw = null; + boolean error = false; + try { + sw = new StopWatch(); + sw.start(); + + this.execute(request, response); + + sw.stop(); + + } catch (Throwable e) { + error = true; + try { + if (sw != null) { + sw.stop(); + } + } catch (IllegalStateException e1) { + // o hacer nada el stopwatch ya esta detenido + } + this.fillError(e, response); + //retorn excepcion para que no haga commit el ejb savebean + throw e; + } finally { + try { + if (!error) { + super.saveLog(this.getTime(sw), "S"); + } else { + super.saveLogWithCommit(this.getTime(sw), "S", response.getResponseCode(), response.getResponseUserMessage(), null, null); + } + } catch (Exception e2) { + APPLogger.getLogger().error("ERROR GRABANDO LOG AUDITORIA \n"); + } + } + return response; + } + + /** + * Funcin que gurda los datos enviados en la base de datos + * + * @param pRequest Peticion de Datos para la Accion + * @throws Exception + */ + public void execute(Request request, Response response) throws Exception { + SaveRequest sr = new SaveRequest(); + sr.setJsf(true); + request.copy(sr); + request.copyMapValues(sr); + sr.setResponse(response); + sr.putAll(request.getModifiedData()); //campos sueltos del request. + SaveActionHelper sah = new SaveActionHelper(); + sah.addSaveBean(request, sr); // Adiciona sabebean de mantenimiento. + // fija numero de mensaje + MessageGenerator mg = MessageGenerator.getInstance(); + sr.setJournalId(mg.generateId(sr.getUser())); + // Log de la transaccion. + super.request = sr; + // fija transaccion original + super.fillOriginalTransaction(); + super.requestToLog(); + // Fin log de transaccion + this.fillThreadData(null, sr); + if (TransactionTime.verifyTransactionTime(sr, null)) { + SaveProcessor processor = new SaveProcessor(); + processor.process(sr, response); + + sah.addPktoResponse(request, response); + } else { + throw new GeneralException("CORE-0054", "TRANSACCIN FUERA DE HORARIO MODULO: {0} TRANSACCIN: {1} VERSIN: {2}", sr.getTransactionModule(), + sr.getTransactionCode(), sr.getTransactionVersion()); + } + } + + /** + * Obtiene el tiempo de respuesta resultado de la ejecucion de una transaccion. + * + * @param sw Objeto que contiene el tiempo de ejecucion de una transaccion. + * @return BigDecimal + * @throws Exception + */ + private BigDecimal getTime(StopWatch sw) throws Exception { + Date d = new Date(sw.getTime()); + return new BigDecimal(FormatDates.getInstance().getTimeInSeconds().format(d)); + } + + private void fillError(Throwable e, Response response) throws Exception { + ExceptionHandler eh = new ExceptionHandler(e, "es"); + APPLogger.getLogger().error("User Message:==>\n" + eh.getUserMessage()); + response.setResponseCode(eh.getCode()); + response.setResponseUserMessage(eh.getUserMessage()); + response.setIsAplicationMessage(eh.isAppexception()); + + if ((e instanceof APPException) || (e instanceof SQLException)) { + response.setResponseStack(eh.getTechnicalMessage()); + } else { + response.setResponseStack(eh.getStackTrace().length() > 1536 ? eh.getStackTrace().substring(0, 1536) : eh.getStackTrace()); + APPLogger.getLogger().error("StackTrace:==>" + response.getResponseStack()); + } + } + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/SaveAction.java.svn-base b/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/SaveAction.java.svn-base new file mode 100644 index 0000000..e2e7b92 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/SaveAction.java.svn-base @@ -0,0 +1,185 @@ +package com.fp.bpm.actions; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.SQLException; +import java.util.List; + +import org.apache.commons.lang.time.StopWatch; + +import com.fp.bpm.ActionExecutor; +import com.fp.bpm.helper.TransactionTime; +import com.fp.bpm.save.SaveProcessor; +import com.fp.common.exception.APPException; +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.fin.MessageGenerator; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.data.SaveData; +import com.fp.dto.helper.FileHelper; +import com.fp.dto.json.Serializer; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.helper.FormatDates; + +/** + * Accion que permite el almacenamiento de informacion en la Base de Datos. + * + * @version 2.1 + */ +public class SaveAction extends ActionExecutor { + + /** + * Funcin que gurda los datos enviados en la base de datos + * + * @param pRequest Peticion de Datos para la Accion + * @param fileItem Lista de archivos si van a ser procesados por lote + * @return Respuesta en JSON del proceso del save. + * @throws Exception + */ + @Override + public String execute(String pRequest, List fileItem) throws Exception { + Serializer ser = new Serializer(pRequest); + SaveRequest sr = (SaveRequest) ser.toObject(SaveRequest.class); + // fija numero de mensaje + MessageGenerator mg = MessageGenerator.getInstance(); + sr.setJournalId(mg.generateId(sr.getUser())); + // Log de la transaccion. + super.request = sr; + // fija transaccion original + super.fillOriginalTransaction(); + super.requestToLog(); + // Fin log de transaccion + sr.put("file", fileItem); + Response res = new Response(Response.RESPONSE_OK, "OK"); + + this.fillThreadData(pRequest, sr); + if (TransactionTime.verifyTransactionTime(sr, null)) { + sr.setResponse(res); + SaveProcessor processor = new SaveProcessor(); + processor.process(sr, res); + } else { + res = new Response("CORE-005", "TRANSACCION FUERA DE HORARIO: " + sr.getTransactionModule() + " TRANSACCION: " + sr.getTransactionCode() + + " VERSION: " + sr.getTransactionVersion()); + } + ser = new Serializer(res); + return ser.toJSON(); + } + + /** + * Metodo que almacena en SaveData, los datos del saverequest de entrada. + * + * @throws Exception + */ + private void fillThreadData(String pData, SaveRequest pSaveRequest) throws Exception { + SaveData.setSaveRequest(pSaveRequest); + // Almacena string de datos de entrada en el thread local, se utiliza para llenar + if (SaveData.getOriginalString() == null && pData != null) { + // En producccion se almacena en el EngineExecutor + SaveData.setOriginalString(pData); + } + } + + public Object process(Request request) throws Exception { + Response response = new Response(Response.RESPONSE_OK, "OK"); + StopWatch sw = null; + boolean error = false; + try { + sw = new StopWatch(); + sw.start(); + + this.execute(request, response); + + sw.stop(); + + } catch (Throwable e) { + error = true; + try { + if (sw != null) { + sw.stop(); + } + } catch (IllegalStateException e1) { + // o hacer nada el stopwatch ya esta detenido + } + this.fillError(e, response); + //retorn excepcion para que no haga commit el ejb savebean + throw e; + } finally { + try { + if (!error) { + super.saveLog(this.getTime(sw), "S"); + } else { + super.saveLogWithCommit(this.getTime(sw), "S", response.getResponseCode(), response.getResponseUserMessage(), null, null); + } + } catch (Exception e2) { + APPLogger.getLogger().error("ERROR GRABANDO LOG AUDITORIA \n"); + } + } + return response; + } + + /** + * Funcin que gurda los datos enviados en la base de datos + * + * @param pRequest Peticion de Datos para la Accion + * @throws Exception + */ + public void execute(Request request, Response response) throws Exception { + SaveRequest sr = new SaveRequest(); + sr.setJsf(true); + request.copy(sr); + request.copyMapValues(sr); + sr.setResponse(response); + sr.putAll(request.getModifiedData()); //campos sueltos del request. + SaveActionHelper sah = new SaveActionHelper(); + sah.addSaveBean(request, sr); // Adiciona sabebean de mantenimiento. + // fija numero de mensaje + MessageGenerator mg = MessageGenerator.getInstance(); + sr.setJournalId(mg.generateId(sr.getUser())); + // Log de la transaccion. + super.request = sr; + // fija transaccion original + super.fillOriginalTransaction(); + super.requestToLog(); + // Fin log de transaccion + this.fillThreadData(null, sr); + if (TransactionTime.verifyTransactionTime(sr, null)) { + SaveProcessor processor = new SaveProcessor(); + processor.process(sr, response); + + sah.addPktoResponse(request, response); + } else { + throw new GeneralException("CORE-0054", "TRANSACCIN FUERA DE HORARIO MODULO: {0} TRANSACCIN: {1} VERSIN: {2}", sr.getTransactionModule(), + sr.getTransactionCode(), sr.getTransactionVersion()); + } + } + + /** + * Obtiene el tiempo de respuesta resultado de la ejecucion de una transaccion. + * + * @param sw Objeto que contiene el tiempo de ejecucion de una transaccion. + * @return BigDecimal + * @throws Exception + */ + private BigDecimal getTime(StopWatch sw) throws Exception { + Date d = new Date(sw.getTime()); + return new BigDecimal(FormatDates.getInstance().getTimeInSeconds().format(d)); + } + + private void fillError(Throwable e, Response response) throws Exception { + ExceptionHandler eh = new ExceptionHandler(e, "es"); + APPLogger.getLogger().error("User Message:==>\n" + eh.getUserMessage()); + response.setResponseCode(eh.getCode()); + response.setResponseUserMessage(eh.getUserMessage()); + response.setIsAplicationMessage(eh.isAppexception()); + + if ((e instanceof APPException) || (e instanceof SQLException)) { + response.setResponseStack(eh.getTechnicalMessage()); + } else { + response.setResponseStack(eh.getStackTrace().length() > 1536 ? eh.getStackTrace().substring(0, 1536) : eh.getStackTrace()); + APPLogger.getLogger().error("StackTrace:==>" + response.getResponseStack()); + } + } + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/SaveActionHelper.java.svn-base b/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/SaveActionHelper.java.svn-base new file mode 100644 index 0000000..3b81148 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/actions/.svn/text-base/SaveActionHelper.java.svn-base @@ -0,0 +1,289 @@ +package com.fp.bpm.actions; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.persistence.EntityManager; + +import com.fp.bpm.save.Save; +import com.fp.common.exception.APPException; +import com.fp.common.helper.BeanManager; +import com.fp.common.helper.Constant; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.History; +import com.fp.dto.save.DtoSave; +import com.fp.dto.save.SaveBean; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; + +/** + * Clase utilitaria que crea un SaveRequest dado un request de mantenimiento. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class SaveActionHelper { + + public void addSaveBean(Request request, SaveRequest saverequest) throws Exception { + Map m = request.getSaveTables(); + if (m == null) { + return; + } + Set s = m.keySet(); + for (String key : s) { + DtoSave sdto = m.get(key); + this.addCamposControl(sdto, saverequest); + List lreg = creaObjetosPorTabla(sdto.getLupdated(), key, sdto.getBeanname()); + + SaveBean sb = new SaveBean(sdto.getBeanname()); + sb.setDeletedRecords(sdto.getLdeleted()); + Save save = new Save(); + save.deleteBean(sb); + sb.setDeletedRecords(new ArrayList()); + + sb.addModified(lreg, sdto.isIsForm()); + sb.addInsertObject(sdto.getLinsert(), sdto.isIsForm()); + Integer pos = sdto.getPosition(); + if (pos != null) { + saverequest.putSaveBean(key, sb, pos); + } else { + saverequest.putSaveBean(key, sb); + } + } + } + + /** + * Metodo que entrega una lista de Objetos con sus datos. + * + * @param mdatos Map con los datos a crear un objeto y fijar datos. + * @param criterio Criterio para armar la lista de objetos, el clriterio es; ins (Insert), upd (Update), del + * (delete) + * @param isupdate true indica que se realiza un update a la tabla. + * @param tabla Alias de la tabla a manipular. + * @return List + * @throws Exception + */ + private static List creaObjetosPorTabla(List> ldatos, String tabla, String nombrebean) throws Exception { + List lbeans = new ArrayList(); + if (ldatos == null || ldatos.isEmpty()) { + return lbeans; + } + for (Map map : ldatos) { + // En mantenimiento se ecesita el bean para obtener el pk y leer el registro de la base. + Object bean = SaveActionHelper.getBeanInstance(nombrebean); + // En el mantenimiento se cambia el bean por el de la base y se completa datos del rq. + bean = SaveActionHelper.mapToObjeto(bean, map, tabla); + ((AbstractDataTransport) bean).isupdated = true; + lbeans.add(bean); + } + return lbeans; + } + + /** + * + * @param tabladto + * @throws Exception + */ + private void addCamposControl(DtoSave dtosave, SaveRequest saverequest) throws Exception { + Map m = dtosave.getMdata(); + Set s = m.keySet(); + for (String key : s) { + Object obj = m.get(key); + try { + BeanManager.setBeanAttributeValue(this, key, obj); + } catch (NoSuchMethodException e) { + saverequest.put(key, obj); + } catch (IllegalArgumentException e1) { + fijaValorAlObjeto(key, obj, saverequest); + } + } + } + + /** + * Fija el valor al request convirtiendo el tipo de dato al definido en el request. + * + * @param key Nombre del atrinuto. + * @param obj Valor a fija al request. + * @throws Exception + */ + private void fijaValorAlObjeto(String key, Object obj, SaveRequest saverequest) throws Exception { + try { + Class type = null; + try { + type = BeanManager.getBeanGetterMethod(this, key).getReturnType(); + } catch (Exception e2) { + // No hacer nada. + } + try { + obj = BeanManager.convertObject(obj, type); + } catch (Exception e) { + // No hacer nada. + } + BeanManager.setBeanAttributeValue(this, key, obj); + } catch (Exception e) { + saverequest.put(key, obj); + } + } + + /** + * Metodo que crea y entrega una instancia de un bean persistente. + * + * @param beanname Paquete clase del bean a crear. + * @return Object + * @throws Exception + */ + private static Object getBeanInstance(String beanname) throws Exception { + + Object b = (Class.forName(beanname)).newInstance(); + if (!(b instanceof HibernateBean)) { + return b; + } + try { + Object bkey = Class.forName(beanname + "Key").newInstance(); + BeanManager.setBeanAttributeValue(b, "pk", bkey); + } catch (ClassNotFoundException e) { + // si el objeto no tiene pk compuesto no hacer nada. + return b; + } + return b; + } + + private static Object mapToObjeto(Object bean, Map map, String tabla) throws Exception { + for (String key : map.keySet()) { + Object valor = map.get(key); + setValue(bean, key, valor); + } + // Eso se hace solo si es un update. + if (bean instanceof AbstractDataTransport) { + // si es update y es de tipo trnsaporte de flip + bean = SaveActionHelper.merge(bean, map, tabla); + } + return bean; + } + + private static void setValue(Object bean, String campo, Object valor) throws Exception { + try { + BeanManager.setBeanAttributeValue(bean, campo, valor); + } catch (IllegalArgumentException e) { + Class type = null; + try { + type = BeanManager.getBeanGetterMethod(bean, campo).getReturnType(); + } catch (Exception e2) { + // No hacer nada. + } + try { + valor = BeanManager.convertObject(valor, type); + } catch (Exception e1) { + // No hacer nada. + } + BeanManager.setBeanAttributeValue(bean, campo, valor); + } catch (NullPointerException e) { + throw new APPException("COMMON-0019", "CAMPO: {0} NO EXISTE EN EL BEAN: {1}", campo, bean.getClass().getSimpleName()); + } + } + + private static Object merge(Object bean, Map map, String tablealias) throws Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + Object id = BeanManager.getBeanAttributeValue(bean, "pk"); + if ((id instanceof History)) { + History pk = (History) id; + if (pk.getDateto() == null) { + throw new APPException("COMMON-0020", "CAMPO DATETO DEL REGISTRO NO ENVIADO TABLA: {0}", bean.getClass().getSimpleName()); + } + } + HibernateBean beanbase = (HibernateBean) em.find(bean.getClass(), id); + if (beanbase == null) { + // Si no encuentra un registro a modificar en la base, esta cambiando el pk, o el registro tiene que llegar + // como un insert + throw new APPException("COMMON-0021", "TABLA NO PERMITE ACTUALIZAR EL PK: {0}", tablealias); + } + HibernateBean boriginal = (HibernateBean) beanbase.cloneMe(); + for (String key : map.keySet()) { + if (key.compareTo("__id") == 0 || key.compareTo("pk") == 0) { + continue; + } + key = key.replace("pk_", "pk."); + if ((key.length() >= 3) && (key.substring(0, 3).compareTo("pk.") == 0)) { + continue; + } + if (key.equals("recordversion")) { + validateOptlocking(map.get(key), beanbase); + } + Object value = map.get(key); + + BeanManager.setAbstractDataTransportAttributeValue(beanbase, key, value); + } + // va aqui porque en el for anterior se fija el valor de mdatos que llega desde la pantalla. + ((AbstractDataTransport) beanbase).put("ORIGINALBEAN", boriginal); + return beanbase; + } + + /** + * Valida que el campo optlock que llega en el request coincida con el que esta en la base de datos.s + * + * @param opplockrequest Valor del request del campo optlock. + * @param beanbase Objeto que contiene los datos de la base de datos de registro que se modifica. + * @throws Exception + */ + private static void validateOptlocking(Object opplockrequest, HibernateBean beanbase) throws Exception { + Object optlockorig = BeanManager.getBeanAttributeValue(beanbase, "recordversion"); + if (optlockorig != null && !opplockrequest.equals(optlockorig)) { + // Si la version del registro original es diferente el usuario tiene que reconsultar los datos. + throw new APPException("COMMON-0022", "DATOS DE LA TABLA: {0} MODIFICADOS EN OTRA SESSION RECONSULTE LOS DATOS", beanbase.getClass() + .getSimpleName()); + } + } + + public void addPktoResponse(Request request, Response response) throws Exception { + Map m = request.getSaveTables(); + if (m == null) { + return; + } + Set s = m.keySet(); + for (String key : s) { + DtoSave sdto = m.get(key); + if (!sdto.isReturnpk()) { + continue; + } + if (sdto.getLinsert() != null && !sdto.getLinsert().isEmpty()) { + AbstractDataTransport t = sdto.getLinsert().get(0); + if (t instanceof HibernateBean) { + List lpkfields = PersistenceManager.getDataBasePKFields(t.getClass()); + this.addPkbyTable(key, sdto.getLinsert(), lpkfields, response); + } + + } + } + } + + private void addPkbyTable(String key, List ldata, List lpkfields, Response response) throws Exception { + List> lpk = new ArrayList>(); + for (AbstractDataTransport obj : ldata) { + Map m = this.buildMapPk(obj, lpkfields); + lpk.add(m); + } + response.put(key, lpk); + } + + private Map buildMapPk(AbstractDataTransport bean, List lpkfields) throws Exception { + Map m = new HashMap(); + for (String field : lpkfields) { + String aux = field.toLowerCase(); + Object value = BeanManager.getBeanAttributeValue(bean, aux); + + if (aux.compareTo("pk.dateto") == 0 && value == null) { + value = Constant.getDefaultExpiryDate(); + } + m.put(field.replace(".", "_"), value); + } + m.put("rowkey", bean.getRowkey()); + return m; + } +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/actions/Action.java b/base/core/bpm/src/main/java/com/fp/bpm/actions/Action.java new file mode 100644 index 0000000..0e44f97 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/actions/Action.java @@ -0,0 +1,5 @@ +package com.fp.bpm.actions; + +public interface Action { + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/actions/ActionTypes.java b/base/core/bpm/src/main/java/com/fp/bpm/actions/ActionTypes.java new file mode 100644 index 0000000..3307dba --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/actions/ActionTypes.java @@ -0,0 +1,80 @@ +package com.fp.bpm.actions; + +import com.fp.bpm.ActionExecutor; + +/** + * Enumeracion en la que se define las clases que resuleven o ejecutan una accion. + * @author Jorge Vaca. + * @version 2.1 + */ +public enum ActionTypes { + + QUERY("query","com.fp.bpm.actions.QueryAction"), + SAVE("save","com.fp.bpm.actions.SaveAction"), + LOGON("logon","com.fp.bpm.actions.LogonAction"); + + /** + * Codig de accion al cual se asocia la clase de ejecucion. + */ + private String actionCode; + /** + * Clase especifica que procesa un codigo de accion. + */ + private String actionClass; + + /** + * Crea una instancia de de ActionTypes. + * @param pActionCode Codigo de accion. + * @param pActionClass Clase que procesa la accion.. + */ + private ActionTypes(String pActionCode,String pActionClass) { + actionCode = pActionCode; + actionClass = pActionClass; + } + + /** + * Entraga un objeto ActionTypes dado el codigo de accion. + * @param pActionCode Cdigo de accion. + * @return ActionTypes + * @throws Exception + */ + public static ActionTypes getActionTypes(String pActionCode) throws Exception{ + ActionTypes [] at = null; + at = ActionTypes.values(); + ActionTypes actiontypes = null; + for(ActionTypes obj : at){ + if(obj.actionCode.compareTo(pActionCode) == 0){ + actiontypes = obj; + } + } + return actiontypes; + } + + /** + * Entrega una instancia de la clase que maneja datos por cada accion. + * @return ActionExecutor + * @throws Exception + */ + public ActionExecutor getInstanceOfAction() throws Exception{ + return (ActionExecutor)Class.forName(actionClass).newInstance(); + } + + /** + * Entrega el valor de actionCode. + * @return String + * @throws Exception + */ + public String getActionCode() throws Exception { + return actionCode; + } + + /** + * Entrega el valor de actionClass. + * @return String + * @throws Exception + */ + public String getActionClass() throws Exception { + return actionClass; + } + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/actions/LogonAction.java b/base/core/bpm/src/main/java/com/fp/bpm/actions/LogonAction.java new file mode 100644 index 0000000..a5b033c --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/actions/LogonAction.java @@ -0,0 +1,61 @@ +package com.fp.bpm.actions; + +import java.util.List; + +import com.fp.bpm.ActionExecutor; +import com.fp.bpm.query.QueryProcessor; +import com.fp.common.fin.MessageGenerator; +import com.fp.dto.Response; +import com.fp.dto.helper.FileHelper; +import com.fp.dto.json.Serializer; +import com.fp.dto.query.QueryRequest; + +/** + * Clase que se encarga del logon del usuario. + * + * @author Santiago Castillo. + * @version 2.1 + */ +public class LogonAction extends ActionExecutor { + + @Override + public String execute(String pRequest, List fileItem) throws Exception { + String[] globaldata = pRequest.split(","); + String[] datacompany = globaldata[0].split(":"); + String dataAux = globaldata[1].substring(8, globaldata[1].length() - 3); + String[] data = dataAux.split(":"); + if (data.length != 5) { + return ""; + } + String company = datacompany[1]; + String login = data[0]; + String password = data[1].substring(16, 56); + String jsessionid = data[2]; + String ip = data[3]; + String host = data[4]; + String newRequest = "\"{" + "\"company\":" + company + "," + "\"transactionModule\":\"1\"," + "\"transactionCode\":9998," + + "\"transactionVersion\":1," + "\"login\":\"" + login + "\"," + "\"ip\":\"" + ip + "\"," + "\"itemValue\":\"" + password + "\"," + "\"jsessionid\":\"" + jsessionid + + "\"," + "\"host\":\"" + host + "\"," + "\"TSAFEUSERDETAIL\":{" + "\"automatic\":true," + + "\"beanName\":\"com.fp.persistence.pgeneral.safe.TsafeUserDetail\"," + "\"criteria\":[" + "{" + "\"operation\":\"=\"," + + "\"order\":null," + "\"value\":" + company + "," + "\"property\":\"companycode\"," + + "\"transportBeanClass\":\"com.fp.dto.query.QueryCriteria\"" + "}," + "{" + "\"operation\":\"=\"," + "\"order\":null," + + "\"value\":\"" + login + "\"," + "\"property\":\"pk.usercode\"," + "\"transportBeanClass\":\"com.fp.dto.query.QueryCriteria\"" + + "}," + "{" + "\"operation\":\"=\"," + "\"order\":null," + "\"value\":\"2999-12-31\"," + "\"property\":\"pk.dateto\"," + + "\"transportBeanClass\":\"com.fp.dto.query.QueryCriteria\"" + "}" + "]," + "\"page\":1," + "\"pageSize\":10," + + "\"transportBeanClass\":\"com.fp.dto.query.QueryBean\"," + "\"multirecord\":false" + "}," + "\"querytype\":\"T\"" + "}\""; + Serializer ser = new Serializer(newRequest); + QueryRequest qr = (QueryRequest) ser.toObject(QueryRequest.class); + MessageGenerator mg = MessageGenerator.getInstance(); + qr.setJournalId(mg.generateId(qr.getUser())); + // Log de transaccion + super.request = qr; + super.requestToLog(); + // fin log transaccion + Response res = new Response(Response.RESPONSE_OK, "OK"); + QueryProcessor qp = new QueryProcessor(); + qr.setResponse(res); + qp.process(qr); + ser = new Serializer(res); + return ser.toJSON(); + } +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/actions/QueryAction.java b/base/core/bpm/src/main/java/com/fp/bpm/actions/QueryAction.java new file mode 100644 index 0000000..ffb5b99 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/actions/QueryAction.java @@ -0,0 +1,177 @@ +package com.fp.bpm.actions; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.SQLException; +import java.util.List; + +import org.apache.commons.lang.time.StopWatch; + +import com.fp.bpm.ActionExecutor; +import com.fp.bpm.helper.TransactionTime; +import com.fp.bpm.query.QueryProcessor; +import com.fp.common.exception.APPException; +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.fin.MessageGenerator; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.data.SaveData; +import com.fp.dto.helper.FileHelper; +import com.fp.dto.json.Serializer; +import com.fp.dto.query.QueryRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.helper.FormatDates; + +/** + * Clase que se encarga del manejo de querys en la aplicacion + */ +public class QueryAction extends ActionExecutor { + + /** + * Metodo que ejecuta el jason enviado desde la web + * + * @param pRequest Json que viaja desde la aplicacion + * @return + * @throws Exception + */ + @Override + public String execute(String pRequest, List fileItem) throws Exception { + Serializer ser = new Serializer(pRequest); + QueryRequest qr = (QueryRequest) ser.toObject(QueryRequest.class); + Response res = new Response(Response.RESPONSE_OK, "OK"); + // fija numero de mensaje + MessageGenerator mg = MessageGenerator.getInstance(); + qr.setJournalId(mg.generateId(qr.getUser())); + // Log de transaccion + super.request = qr; + // fija transaccion original + super.fillOriginalTransaction(); + super.requestToLog(); + // fin log transaccion + // Inicializa datos para el log de la transaccion. + this.fillThreadData(pRequest); + if (TransactionTime.verifyTransactionTime(null, qr)) { + qr.setResponse(res); + QueryProcessor qp = new QueryProcessor(); + qp.process(qr); + } else { + res = new Response("CORE-005", "TRANSACCION FUERA DE HORARIO: " + qr.getTransactionModule() + " TRANSACCION: " + qr.getTransactionCode() + + " VERSION: " + qr.getTransactionVersion()); + } + // res.changeAbstractBeanToMap(); + ser = new Serializer(res); + return ser.toJSON(); + } + + /** + * Metodo que almacena en SaveData, los datos del saverequest de entrada. + * + * @throws Exception + */ + private void fillThreadData(String pData) throws Exception { + // Inicializa el thread local. + SaveData.setSaveRequest(null); + // Almacena string de datos de entrada en el thread local, se utiliza para llenar + if (SaveData.getOriginalString() == null) { + // En producccion se almacena en el EngineExecutor + SaveData.setOriginalString(pData); + } + } + + public Object process(Request request) throws Exception { + Response response = new Response(Response.RESPONSE_OK, "OK"); + StopWatch sw = null; + boolean error = false; + try { + sw = new StopWatch(); + sw.start(); + + this.execute(request, response); + + sw.stop(); + + } catch (Throwable e) { + error = true; + try { + if (sw != null) { + sw.stop(); + } + } catch (IllegalStateException e1) { + // o hacer nada el stopwatch ya esta detenido + } + this.fillError(e, response); + //retorn excepcion para que no haga commit el ejb querybean + throw e; + } finally { + try { + if (!error) { + super.saveLog(this.getTime(sw), "Q"); + } else { + super.saveLogWithCommit(this.getTime(sw), "Q", response.getResponseCode(), + response.getResponseUserMessage(), null, null); + } + } catch (Exception e2) { + APPLogger.getLogger().error("ERROR GRABANDO LOG AUDITORIA " + e2.toString(), e2); + } + } + return response; + } + + private void execute(Request request, Response response) throws Exception { + QueryRequest qr = new QueryRequest(); + request.copy(qr); + request.copyMapValues(qr); + + qr.setQueryTables(request.getQueryTables()); + qr.setJsf(true); + qr.setResponse(response); + qr.putAll(request.getModifiedData()); //campos del request codigo de consuta. + // fija numero de mensaje + MessageGenerator mg = MessageGenerator.getInstance(); + qr.setJournalId(mg.generateId(qr.getUser())); + // Log de transaccion + super.request = qr; + // fija transaccion original + super.fillOriginalTransaction(); + super.requestToLog(); + // fin log transaccion + + if (TransactionTime.verifyTransactionTime(null, qr)) { + QueryProcessor qp = new QueryProcessor(); + qp.process(qr); + } else { + throw new GeneralException("CORE-0054", "TRANSACCIN FUERA DE HORARIO MODULO: {0} TRANSACCIN: {1} VERSIN: {2}", qr.getTransactionModule(), + qr.getTransactionCode(), qr.getTransactionVersion()); + } + } + + /** + * Obtiene el tiempo de respuesta resultado de la ejecucion de una + * transaccion. + * + * @param sw Objeto que contiene el tiempo de ejecucion de una transaccion. + * @return BigDecimal + * @throws Exception + */ + private BigDecimal getTime(StopWatch sw) throws Exception { + Date d = new Date(sw.getTime()); + return new BigDecimal(FormatDates.getInstance().getTimeInSeconds().format(d)); + } + + private void fillError(Throwable e, Response response) throws Exception { + ExceptionHandler eh = new ExceptionHandler(e, "es"); + APPLogger.getLogger().error("User Message:==> " + eh.getUserMessage()); + response.setResponseCode(eh.getCode()); + response.setResponseUserMessage(eh.getUserMessage()); + response.setIsAplicationMessage(eh.isAppexception()); + + if ((e instanceof APPException) || (e instanceof SQLException)) { + response.setResponseStack(eh.getTechnicalMessage()); + } else { + response.setResponseStack(eh.getStackTrace().length() > 1536 ? eh.getStackTrace().substring(0, 1536) : eh.getStackTrace()); + APPLogger.getLogger().error("StackTrace:==>" + response.getResponseStack()); + } + } + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/actions/SaveAction.java b/base/core/bpm/src/main/java/com/fp/bpm/actions/SaveAction.java new file mode 100644 index 0000000..e2e7b92 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/actions/SaveAction.java @@ -0,0 +1,185 @@ +package com.fp.bpm.actions; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.SQLException; +import java.util.List; + +import org.apache.commons.lang.time.StopWatch; + +import com.fp.bpm.ActionExecutor; +import com.fp.bpm.helper.TransactionTime; +import com.fp.bpm.save.SaveProcessor; +import com.fp.common.exception.APPException; +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.fin.MessageGenerator; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.data.SaveData; +import com.fp.dto.helper.FileHelper; +import com.fp.dto.json.Serializer; +import com.fp.dto.save.SaveRequest; +import com.fp.general.exception.GeneralException; +import com.fp.persistence.commondb.helper.FormatDates; + +/** + * Accion que permite el almacenamiento de informacion en la Base de Datos. + * + * @version 2.1 + */ +public class SaveAction extends ActionExecutor { + + /** + * Funcin que gurda los datos enviados en la base de datos + * + * @param pRequest Peticion de Datos para la Accion + * @param fileItem Lista de archivos si van a ser procesados por lote + * @return Respuesta en JSON del proceso del save. + * @throws Exception + */ + @Override + public String execute(String pRequest, List fileItem) throws Exception { + Serializer ser = new Serializer(pRequest); + SaveRequest sr = (SaveRequest) ser.toObject(SaveRequest.class); + // fija numero de mensaje + MessageGenerator mg = MessageGenerator.getInstance(); + sr.setJournalId(mg.generateId(sr.getUser())); + // Log de la transaccion. + super.request = sr; + // fija transaccion original + super.fillOriginalTransaction(); + super.requestToLog(); + // Fin log de transaccion + sr.put("file", fileItem); + Response res = new Response(Response.RESPONSE_OK, "OK"); + + this.fillThreadData(pRequest, sr); + if (TransactionTime.verifyTransactionTime(sr, null)) { + sr.setResponse(res); + SaveProcessor processor = new SaveProcessor(); + processor.process(sr, res); + } else { + res = new Response("CORE-005", "TRANSACCION FUERA DE HORARIO: " + sr.getTransactionModule() + " TRANSACCION: " + sr.getTransactionCode() + + " VERSION: " + sr.getTransactionVersion()); + } + ser = new Serializer(res); + return ser.toJSON(); + } + + /** + * Metodo que almacena en SaveData, los datos del saverequest de entrada. + * + * @throws Exception + */ + private void fillThreadData(String pData, SaveRequest pSaveRequest) throws Exception { + SaveData.setSaveRequest(pSaveRequest); + // Almacena string de datos de entrada en el thread local, se utiliza para llenar + if (SaveData.getOriginalString() == null && pData != null) { + // En producccion se almacena en el EngineExecutor + SaveData.setOriginalString(pData); + } + } + + public Object process(Request request) throws Exception { + Response response = new Response(Response.RESPONSE_OK, "OK"); + StopWatch sw = null; + boolean error = false; + try { + sw = new StopWatch(); + sw.start(); + + this.execute(request, response); + + sw.stop(); + + } catch (Throwable e) { + error = true; + try { + if (sw != null) { + sw.stop(); + } + } catch (IllegalStateException e1) { + // o hacer nada el stopwatch ya esta detenido + } + this.fillError(e, response); + //retorn excepcion para que no haga commit el ejb savebean + throw e; + } finally { + try { + if (!error) { + super.saveLog(this.getTime(sw), "S"); + } else { + super.saveLogWithCommit(this.getTime(sw), "S", response.getResponseCode(), response.getResponseUserMessage(), null, null); + } + } catch (Exception e2) { + APPLogger.getLogger().error("ERROR GRABANDO LOG AUDITORIA \n"); + } + } + return response; + } + + /** + * Funcin que gurda los datos enviados en la base de datos + * + * @param pRequest Peticion de Datos para la Accion + * @throws Exception + */ + public void execute(Request request, Response response) throws Exception { + SaveRequest sr = new SaveRequest(); + sr.setJsf(true); + request.copy(sr); + request.copyMapValues(sr); + sr.setResponse(response); + sr.putAll(request.getModifiedData()); //campos sueltos del request. + SaveActionHelper sah = new SaveActionHelper(); + sah.addSaveBean(request, sr); // Adiciona sabebean de mantenimiento. + // fija numero de mensaje + MessageGenerator mg = MessageGenerator.getInstance(); + sr.setJournalId(mg.generateId(sr.getUser())); + // Log de la transaccion. + super.request = sr; + // fija transaccion original + super.fillOriginalTransaction(); + super.requestToLog(); + // Fin log de transaccion + this.fillThreadData(null, sr); + if (TransactionTime.verifyTransactionTime(sr, null)) { + SaveProcessor processor = new SaveProcessor(); + processor.process(sr, response); + + sah.addPktoResponse(request, response); + } else { + throw new GeneralException("CORE-0054", "TRANSACCIN FUERA DE HORARIO MODULO: {0} TRANSACCIN: {1} VERSIN: {2}", sr.getTransactionModule(), + sr.getTransactionCode(), sr.getTransactionVersion()); + } + } + + /** + * Obtiene el tiempo de respuesta resultado de la ejecucion de una transaccion. + * + * @param sw Objeto que contiene el tiempo de ejecucion de una transaccion. + * @return BigDecimal + * @throws Exception + */ + private BigDecimal getTime(StopWatch sw) throws Exception { + Date d = new Date(sw.getTime()); + return new BigDecimal(FormatDates.getInstance().getTimeInSeconds().format(d)); + } + + private void fillError(Throwable e, Response response) throws Exception { + ExceptionHandler eh = new ExceptionHandler(e, "es"); + APPLogger.getLogger().error("User Message:==>\n" + eh.getUserMessage()); + response.setResponseCode(eh.getCode()); + response.setResponseUserMessage(eh.getUserMessage()); + response.setIsAplicationMessage(eh.isAppexception()); + + if ((e instanceof APPException) || (e instanceof SQLException)) { + response.setResponseStack(eh.getTechnicalMessage()); + } else { + response.setResponseStack(eh.getStackTrace().length() > 1536 ? eh.getStackTrace().substring(0, 1536) : eh.getStackTrace()); + APPLogger.getLogger().error("StackTrace:==>" + response.getResponseStack()); + } + } + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/actions/SaveActionHelper.java b/base/core/bpm/src/main/java/com/fp/bpm/actions/SaveActionHelper.java new file mode 100644 index 0000000..3b81148 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/actions/SaveActionHelper.java @@ -0,0 +1,289 @@ +package com.fp.bpm.actions; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.persistence.EntityManager; + +import com.fp.bpm.save.Save; +import com.fp.common.exception.APPException; +import com.fp.common.helper.BeanManager; +import com.fp.common.helper.Constant; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.History; +import com.fp.dto.save.DtoSave; +import com.fp.dto.save.SaveBean; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; + +/** + * Clase utilitaria que crea un SaveRequest dado un request de mantenimiento. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class SaveActionHelper { + + public void addSaveBean(Request request, SaveRequest saverequest) throws Exception { + Map m = request.getSaveTables(); + if (m == null) { + return; + } + Set s = m.keySet(); + for (String key : s) { + DtoSave sdto = m.get(key); + this.addCamposControl(sdto, saverequest); + List lreg = creaObjetosPorTabla(sdto.getLupdated(), key, sdto.getBeanname()); + + SaveBean sb = new SaveBean(sdto.getBeanname()); + sb.setDeletedRecords(sdto.getLdeleted()); + Save save = new Save(); + save.deleteBean(sb); + sb.setDeletedRecords(new ArrayList()); + + sb.addModified(lreg, sdto.isIsForm()); + sb.addInsertObject(sdto.getLinsert(), sdto.isIsForm()); + Integer pos = sdto.getPosition(); + if (pos != null) { + saverequest.putSaveBean(key, sb, pos); + } else { + saverequest.putSaveBean(key, sb); + } + } + } + + /** + * Metodo que entrega una lista de Objetos con sus datos. + * + * @param mdatos Map con los datos a crear un objeto y fijar datos. + * @param criterio Criterio para armar la lista de objetos, el clriterio es; ins (Insert), upd (Update), del + * (delete) + * @param isupdate true indica que se realiza un update a la tabla. + * @param tabla Alias de la tabla a manipular. + * @return List + * @throws Exception + */ + private static List creaObjetosPorTabla(List> ldatos, String tabla, String nombrebean) throws Exception { + List lbeans = new ArrayList(); + if (ldatos == null || ldatos.isEmpty()) { + return lbeans; + } + for (Map map : ldatos) { + // En mantenimiento se ecesita el bean para obtener el pk y leer el registro de la base. + Object bean = SaveActionHelper.getBeanInstance(nombrebean); + // En el mantenimiento se cambia el bean por el de la base y se completa datos del rq. + bean = SaveActionHelper.mapToObjeto(bean, map, tabla); + ((AbstractDataTransport) bean).isupdated = true; + lbeans.add(bean); + } + return lbeans; + } + + /** + * + * @param tabladto + * @throws Exception + */ + private void addCamposControl(DtoSave dtosave, SaveRequest saverequest) throws Exception { + Map m = dtosave.getMdata(); + Set s = m.keySet(); + for (String key : s) { + Object obj = m.get(key); + try { + BeanManager.setBeanAttributeValue(this, key, obj); + } catch (NoSuchMethodException e) { + saverequest.put(key, obj); + } catch (IllegalArgumentException e1) { + fijaValorAlObjeto(key, obj, saverequest); + } + } + } + + /** + * Fija el valor al request convirtiendo el tipo de dato al definido en el request. + * + * @param key Nombre del atrinuto. + * @param obj Valor a fija al request. + * @throws Exception + */ + private void fijaValorAlObjeto(String key, Object obj, SaveRequest saverequest) throws Exception { + try { + Class type = null; + try { + type = BeanManager.getBeanGetterMethod(this, key).getReturnType(); + } catch (Exception e2) { + // No hacer nada. + } + try { + obj = BeanManager.convertObject(obj, type); + } catch (Exception e) { + // No hacer nada. + } + BeanManager.setBeanAttributeValue(this, key, obj); + } catch (Exception e) { + saverequest.put(key, obj); + } + } + + /** + * Metodo que crea y entrega una instancia de un bean persistente. + * + * @param beanname Paquete clase del bean a crear. + * @return Object + * @throws Exception + */ + private static Object getBeanInstance(String beanname) throws Exception { + + Object b = (Class.forName(beanname)).newInstance(); + if (!(b instanceof HibernateBean)) { + return b; + } + try { + Object bkey = Class.forName(beanname + "Key").newInstance(); + BeanManager.setBeanAttributeValue(b, "pk", bkey); + } catch (ClassNotFoundException e) { + // si el objeto no tiene pk compuesto no hacer nada. + return b; + } + return b; + } + + private static Object mapToObjeto(Object bean, Map map, String tabla) throws Exception { + for (String key : map.keySet()) { + Object valor = map.get(key); + setValue(bean, key, valor); + } + // Eso se hace solo si es un update. + if (bean instanceof AbstractDataTransport) { + // si es update y es de tipo trnsaporte de flip + bean = SaveActionHelper.merge(bean, map, tabla); + } + return bean; + } + + private static void setValue(Object bean, String campo, Object valor) throws Exception { + try { + BeanManager.setBeanAttributeValue(bean, campo, valor); + } catch (IllegalArgumentException e) { + Class type = null; + try { + type = BeanManager.getBeanGetterMethod(bean, campo).getReturnType(); + } catch (Exception e2) { + // No hacer nada. + } + try { + valor = BeanManager.convertObject(valor, type); + } catch (Exception e1) { + // No hacer nada. + } + BeanManager.setBeanAttributeValue(bean, campo, valor); + } catch (NullPointerException e) { + throw new APPException("COMMON-0019", "CAMPO: {0} NO EXISTE EN EL BEAN: {1}", campo, bean.getClass().getSimpleName()); + } + } + + private static Object merge(Object bean, Map map, String tablealias) throws Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + Object id = BeanManager.getBeanAttributeValue(bean, "pk"); + if ((id instanceof History)) { + History pk = (History) id; + if (pk.getDateto() == null) { + throw new APPException("COMMON-0020", "CAMPO DATETO DEL REGISTRO NO ENVIADO TABLA: {0}", bean.getClass().getSimpleName()); + } + } + HibernateBean beanbase = (HibernateBean) em.find(bean.getClass(), id); + if (beanbase == null) { + // Si no encuentra un registro a modificar en la base, esta cambiando el pk, o el registro tiene que llegar + // como un insert + throw new APPException("COMMON-0021", "TABLA NO PERMITE ACTUALIZAR EL PK: {0}", tablealias); + } + HibernateBean boriginal = (HibernateBean) beanbase.cloneMe(); + for (String key : map.keySet()) { + if (key.compareTo("__id") == 0 || key.compareTo("pk") == 0) { + continue; + } + key = key.replace("pk_", "pk."); + if ((key.length() >= 3) && (key.substring(0, 3).compareTo("pk.") == 0)) { + continue; + } + if (key.equals("recordversion")) { + validateOptlocking(map.get(key), beanbase); + } + Object value = map.get(key); + + BeanManager.setAbstractDataTransportAttributeValue(beanbase, key, value); + } + // va aqui porque en el for anterior se fija el valor de mdatos que llega desde la pantalla. + ((AbstractDataTransport) beanbase).put("ORIGINALBEAN", boriginal); + return beanbase; + } + + /** + * Valida que el campo optlock que llega en el request coincida con el que esta en la base de datos.s + * + * @param opplockrequest Valor del request del campo optlock. + * @param beanbase Objeto que contiene los datos de la base de datos de registro que se modifica. + * @throws Exception + */ + private static void validateOptlocking(Object opplockrequest, HibernateBean beanbase) throws Exception { + Object optlockorig = BeanManager.getBeanAttributeValue(beanbase, "recordversion"); + if (optlockorig != null && !opplockrequest.equals(optlockorig)) { + // Si la version del registro original es diferente el usuario tiene que reconsultar los datos. + throw new APPException("COMMON-0022", "DATOS DE LA TABLA: {0} MODIFICADOS EN OTRA SESSION RECONSULTE LOS DATOS", beanbase.getClass() + .getSimpleName()); + } + } + + public void addPktoResponse(Request request, Response response) throws Exception { + Map m = request.getSaveTables(); + if (m == null) { + return; + } + Set s = m.keySet(); + for (String key : s) { + DtoSave sdto = m.get(key); + if (!sdto.isReturnpk()) { + continue; + } + if (sdto.getLinsert() != null && !sdto.getLinsert().isEmpty()) { + AbstractDataTransport t = sdto.getLinsert().get(0); + if (t instanceof HibernateBean) { + List lpkfields = PersistenceManager.getDataBasePKFields(t.getClass()); + this.addPkbyTable(key, sdto.getLinsert(), lpkfields, response); + } + + } + } + } + + private void addPkbyTable(String key, List ldata, List lpkfields, Response response) throws Exception { + List> lpk = new ArrayList>(); + for (AbstractDataTransport obj : ldata) { + Map m = this.buildMapPk(obj, lpkfields); + lpk.add(m); + } + response.put(key, lpk); + } + + private Map buildMapPk(AbstractDataTransport bean, List lpkfields) throws Exception { + Map m = new HashMap(); + for (String field : lpkfields) { + String aux = field.toLowerCase(); + Object value = BeanManager.getBeanAttributeValue(bean, aux); + + if (aux.compareTo("pk.dateto") == 0 && value == null) { + value = Constant.getDefaultExpiryDate(); + } + m.put(field.replace(".", "_"), value); + } + m.put("rowkey", bean.getRowkey()); + return m; + } +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/helper/.svn/entries b/base/core/bpm/src/main/java/com/fp/bpm/helper/.svn/entries new file mode 100644 index 0000000..d83a379 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/helper/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/bpm/src/main/java/com/fp/bpm/helper +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TransactionTime.java +file + + + + +2022-07-28T03:40:38.233784Z +0634ce082a65ec63d6223169836f1795 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3618 + diff --git a/base/core/bpm/src/main/java/com/fp/bpm/helper/.svn/text-base/TransactionTime.java.svn-base b/base/core/bpm/src/main/java/com/fp/bpm/helper/.svn/text-base/TransactionTime.java.svn-base new file mode 100644 index 0000000..168be28 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/helper/.svn/text-base/TransactionTime.java.svn-base @@ -0,0 +1,77 @@ +package com.fp.bpm.helper; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.safe.TsafeProfileHorary; +import com.fp.persistence.pgeneral.safe.TsafeProfileHoraryKey; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.Calendar; + +/** + * Clase que se encarga de verificar si una transaccion se debe ejecutar en una hora determinada + * @author scastillo + */ +public class TransactionTime { + + private static SimpleDateFormat simpleDateFormatCreateTime = new SimpleDateFormat("HHmm"); + + /** + * Metodo que se encarga de verificar si la transaccion a procesar se encuentra dentro de un horario permitido + * @param saveRequest Objeto SaveRequest + * @param queryRequest Objeto QueryRequest + * @return + * @throws Exception + */ + public static boolean verifyTransactionTime(SaveRequest saveRequest, QueryRequest queryRequest) throws Exception { + boolean transactionEnabled = true; + if (queryRequest != null && queryRequest.get("cancelVerification") != null && ((Boolean) queryRequest.get("cancelVerification")).booleanValue()) { + return transactionEnabled; + } + String profile = null; + String module = null; + Integer transactioncode = null; + Integer transactionversion = null; + if (saveRequest != null) { + profile = saveRequest.getProfile(); + module = saveRequest.getTransactionModule(); + transactioncode = saveRequest.getTransactionCode(); + transactionversion = saveRequest.getTransactionVersion(); + } else if (queryRequest != null) { + profile = queryRequest.getProfile(); + module = queryRequest.getTransactionModule(); + transactioncode = queryRequest.getTransactionCode(); + transactionversion = queryRequest.getTransactionVersion(); + if (profile == null || module == null || transactioncode == null || transactionversion == null) { + return transactionEnabled; + } + } + Timestamp date = FormatDates.getInstance().getDataBaseTimestamp(); + Calendar calc = Calendar.getInstance(); + calc.setTime(date); + Integer day = calc.get(Calendar.DAY_OF_WEEK); + Integer hour = new Integer(TransactionTime.simpleDateFormatCreateTime.format(date)); + TsafeProfileHoraryKey tsafeProfileHoraryKey = new TsafeProfileHoraryKey(profile, + module, transactioncode, transactionversion, day); + TsafeProfileHorary tsafeProfileHorary = TsafeProfileHorary.find(PersistenceHelper.getEntityManager(), + tsafeProfileHoraryKey); + if (tsafeProfileHorary != null) { + Integer initTime = new Integer(tsafeProfileHorary.getInittime().replaceAll(":", "")); + Integer finishTime = new Integer(tsafeProfileHorary.getFinishtime().replaceAll(":", "")); + if (hour < initTime || hour > finishTime) { + transactionEnabled = false; + } + if (transactionEnabled && tsafeProfileHorary.getValidateamount() != null + && tsafeProfileHorary.getValidateamount().compareTo("Y") == 0) { + if (saveRequest != null) { + saveRequest.put("validateamount", "Y"); + } else if (queryRequest != null) { + queryRequest.put("validateamount", "Y"); + } + } + } + return transactionEnabled; + } +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/helper/TransactionTime.java b/base/core/bpm/src/main/java/com/fp/bpm/helper/TransactionTime.java new file mode 100644 index 0000000..168be28 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/helper/TransactionTime.java @@ -0,0 +1,77 @@ +package com.fp.bpm.helper; + +import com.fp.dto.query.QueryRequest; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.safe.TsafeProfileHorary; +import com.fp.persistence.pgeneral.safe.TsafeProfileHoraryKey; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.Calendar; + +/** + * Clase que se encarga de verificar si una transaccion se debe ejecutar en una hora determinada + * @author scastillo + */ +public class TransactionTime { + + private static SimpleDateFormat simpleDateFormatCreateTime = new SimpleDateFormat("HHmm"); + + /** + * Metodo que se encarga de verificar si la transaccion a procesar se encuentra dentro de un horario permitido + * @param saveRequest Objeto SaveRequest + * @param queryRequest Objeto QueryRequest + * @return + * @throws Exception + */ + public static boolean verifyTransactionTime(SaveRequest saveRequest, QueryRequest queryRequest) throws Exception { + boolean transactionEnabled = true; + if (queryRequest != null && queryRequest.get("cancelVerification") != null && ((Boolean) queryRequest.get("cancelVerification")).booleanValue()) { + return transactionEnabled; + } + String profile = null; + String module = null; + Integer transactioncode = null; + Integer transactionversion = null; + if (saveRequest != null) { + profile = saveRequest.getProfile(); + module = saveRequest.getTransactionModule(); + transactioncode = saveRequest.getTransactionCode(); + transactionversion = saveRequest.getTransactionVersion(); + } else if (queryRequest != null) { + profile = queryRequest.getProfile(); + module = queryRequest.getTransactionModule(); + transactioncode = queryRequest.getTransactionCode(); + transactionversion = queryRequest.getTransactionVersion(); + if (profile == null || module == null || transactioncode == null || transactionversion == null) { + return transactionEnabled; + } + } + Timestamp date = FormatDates.getInstance().getDataBaseTimestamp(); + Calendar calc = Calendar.getInstance(); + calc.setTime(date); + Integer day = calc.get(Calendar.DAY_OF_WEEK); + Integer hour = new Integer(TransactionTime.simpleDateFormatCreateTime.format(date)); + TsafeProfileHoraryKey tsafeProfileHoraryKey = new TsafeProfileHoraryKey(profile, + module, transactioncode, transactionversion, day); + TsafeProfileHorary tsafeProfileHorary = TsafeProfileHorary.find(PersistenceHelper.getEntityManager(), + tsafeProfileHoraryKey); + if (tsafeProfileHorary != null) { + Integer initTime = new Integer(tsafeProfileHorary.getInittime().replaceAll(":", "")); + Integer finishTime = new Integer(tsafeProfileHorary.getFinishtime().replaceAll(":", "")); + if (hour < initTime || hour > finishTime) { + transactionEnabled = false; + } + if (transactionEnabled && tsafeProfileHorary.getValidateamount() != null + && tsafeProfileHorary.getValidateamount().compareTo("Y") == 0) { + if (saveRequest != null) { + saveRequest.put("validateamount", "Y"); + } else if (queryRequest != null) { + queryRequest.put("validateamount", "Y"); + } + } + } + return transactionEnabled; + } +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/entries b/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/entries new file mode 100644 index 0000000..abdc52e --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/entries @@ -0,0 +1,269 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/bpm/src/main/java/com/fp/bpm/query +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +menu +dir + +Query.java +file + + + + +2022-07-28T03:40:38.337784Z +9009274058de23b9ef17f5af03dee0de +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7547 + +QueryHelper.java +file + + + + +2022-07-28T03:40:38.337784Z +0f328699680ab3bb9c6f130ead580874 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +13137 + +QueryProcessor.java +file + + + + +2022-07-28T03:40:38.338784Z +a6c0ffdbbc1548adc3a2793ee1722db6 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7755 + +QueryOperation.java +file + + + + +2022-07-28T03:40:38.338784Z +8a597ae3f4bd59dac7062d2d0c282312 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +64 + +QueryProcessCriteria.java +file + + + + +2022-07-28T03:40:38.338784Z +8221f620756f7ab915d9dc4d84fc8633 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4618 + +QueryJsf.java +file + + + + +2022-07-28T03:40:38.338784Z +7f619ef2b90c33f8bf9d02459fd1161c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8586 + +QueryHQL.java +file + + + + +2022-07-28T03:40:38.339784Z +2aff521aa09e728fa22cc3b48290b3f9 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +13607 + diff --git a/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/text-base/Query.java.svn-base b/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/text-base/Query.java.svn-base new file mode 100644 index 0000000..5de3c53 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/text-base/Query.java.svn-base @@ -0,0 +1,183 @@ +package com.fp.bpm.query; + + +import java.util.List; +import java.util.Map; + +import com.fp.common.helper.BeanManager; +import com.fp.common.logger.APPLogger; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Response; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; +import com.fp.dto.query.QueryRequest; +import com.fp.persistence.commondb.HqlStatement; +import com.fp.persistence.commondb.exception.CommondbException; +import java.util.ArrayList; +import java.util.Hashtable; + +/** + * Clase que se encarga de realizar consultas genericas a la base de datos. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class Query extends QueryHelper { // NOPMD by jorge on 12/10/10 21:44 + + /** + * Numero maximo de registros a entregar en en la consulta, cuando se trate de una consulta multiregistro. + */ + private int maxresults; + + /** + * Metodo principal que inicia la consulta de datos, El objeto QueryRequest contiene una lista de objetos QueryBean, + * para cada uno de estos objetos arma un Query le asocia parametros y ejecuta la consulta. + * + * @param pQueryRequest Objeto que contiene una lista de objetos QueryBean. + * @return boolean + * @throws CommondbException + * @throws ClassNotFoundException + * @throws InstantiationException + * @throws IllegalAccessException + * @throws Exception + */ + public boolean process(QueryRequest pQueryRequest) throws CommondbException, ClassNotFoundException, InstantiationException, + IllegalAccessException, Exception { + Response response = pQueryRequest.getResponse(); + Map bean = pQueryRequest.getBeans(); + for (String k : bean.keySet()) { + QueryBean qbean = bean.get(k); + if ((qbean.getBeanName() == null)) { + continue; + } + response.put(k, this.processByQueryBean(qbean)); + } + this.query = null; + return true; + } + + /** + * Metodo que se encarga de ejecutar la consulta por QueryBean, genera dicamente la sentencia, adiciona parametros + * ejecuta la consulta y arma la respuesta de los datos del bean. + * + * @param pQueryBean Objeto que contiene el bean a consultas, y las restricciones. + * @return Object + * @throws CommondbException + * @throws ClassNotFoundException + * @throws InstantiationException + * @throws IllegalAccessException + * @throws Exception + */ + private Object processByQueryBean(QueryBean pQueryBean) throws CommondbException, ClassNotFoundException, InstantiationException, + IllegalAccessException, Exception { + if ((pQueryBean.getQuerytype() != null) && (pQueryBean.getQuerytype().compareTo("E") == 0)) { + if (pQueryBean.isMultirecord()) { + List data = new ArrayList(); + data.add((AbstractDataTransport) this.createObject(pQueryBean)); + return data; + } + return this.createObject(pQueryBean); + } + this.buildSenetnce(pQueryBean); + // return null; + return this.queryData(pQueryBean); + } + + /** + * Metodo que se encarga de armar la sentencia del query, adiciona restricciones y criterios de ordenamiento de los + * resultados. + * + * @param pQueryBean Objeto que contiene el bean a consultas, y las restricciones. + * @throws CommondbException + * @throws ClassNotFoundException + * @throws InstantiationException + * @throws IllegalAccessException + * @throws Exception + */ + @SuppressWarnings("rawtypes") + private void buildSenetnce(QueryBean pQueryBean) throws CommondbException, ClassNotFoundException, // NOPMD by jorge + // on 12/10/10 + // 21:44 + InstantiationException, IllegalAccessException, Exception { + Object beanReference = Class.forName(pQueryBean.getBeanName()).newInstance(); + this.query = new StringBuffer(); + this.mParameters = new Hashtable(); + this.query.append("FROM " + pQueryBean.getBeanName() + " t "); + boolean first = true; + for (QueryCriteria criteria : pQueryBean.getCriteria()) { + String condition = criteria.getOperation(); + if ((condition != null) && ((condition.compareTo("isNull") == 0) || (condition.compareTo("isNotNull") == 0))) { + criteria.setValue(""); + } + if ((criteria.getValue() == null) + && ((condition == null) || (condition.compareTo("isNull") != 0) || (condition.compareTo("isNotNull") != 0))) { + continue; + } + if (first) { + this.query.append(" WHERE "); + first = false; + } else { + this.query.append(" AND "); + } + if (criteria.getOperation() == null) { + continue; + } + Class type = null; + try { + type = BeanManager.getBeanGetterMethod(beanReference, criteria.getProperty()).getReturnType(); + } catch (Exception e1) { + } + super.addRestrictions(criteria, type); + } + super.addOrder(pQueryBean); + if ((pQueryBean.getPage() > 0) && (pQueryBean.getPageSize() > 0)) { + this.maxresults = pQueryBean.getPageSize(); + } + } + + /** + * Metodo que se encarga de ejecutar la consulta, crea un HqlStatement, fija los parametros y arma los datos de + * respuesta. + * + * @param pQueryBean Objeto que contiene el bean a consultas, y las restricciones. + * @return Object + * @throws CommondbException + * @throws ClassNotFoundException + * @throws InstantiationException + * @throws IllegalAccessException + * @throws Exception + */ + @SuppressWarnings("unchecked") + private Object queryData(QueryBean pQueryBean) throws CommondbException, ClassNotFoundException, InstantiationException, IllegalAccessException, + Exception { + String searchCatalogDetail = (String) pQueryBean.get("catalogdesc"); + String[] nameAttributes = null; + if (searchCatalogDetail != null) { + nameAttributes = searchCatalogDetail.split("\\*"); + } + APPLogger.getLogger().debug("CONSULTA: " + super.query.toString()); + HqlStatement hql = new HqlStatement(super.query.toString()); + hql.setParametersValue(super.mParameters); + hql.setPage(pQueryBean.getPage()); + hql.setRecordperpage(this.maxresults); + if (pQueryBean.isMultirecord()) { + List data = new ArrayList(); + List ldata = hql.execute().getResultList(); + boolean exists = false; + for (Object object : ldata) { + exists = true; + data.add(this.fillRecord(pQueryBean, object, nameAttributes)); + } + if (!exists) { + Object obj = this.createObject(pQueryBean); + data.add(obj); + } + return (data); + } else { + AbstractDataTransport obj = (AbstractDataTransport) hql.getObject(); + super.completeDescriptionCatalog(obj, nameAttributes); + this.addAditionData(pQueryBean, obj); + return obj; + } + } +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/text-base/QueryHQL.java.svn-base b/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/text-base/QueryHQL.java.svn-base new file mode 100644 index 0000000..3fcd2a2 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/text-base/QueryHQL.java.svn-base @@ -0,0 +1,333 @@ +package com.fp.bpm.query; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; + +import org.hibernate.Criteria; +import org.hibernate.ScrollMode; +import org.hibernate.ScrollableResults; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Property; +import org.hibernate.criterion.Restrictions; + +import com.fp.common.helper.BeanManager; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Response; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; +import com.fp.dto.query.QueryRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.db.DataHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Motor de consultas generico. + * @author Jorge Vaca + * @version 2.1 + */ +public class QueryHQL { + + public QueryHQL() { + } + + /** + * Metodo que se encarga de ejecutar consultas genericas.
+ * Proceso.
+ *
    + *
  • Obtiene una lista de QueryBean del Objeto QueryRequest
  • + *
  • Ejecuta la consulta para cada QueryBean
  • + *
  • Llena la respuesta en el response.
  • + *
+ * @param pReq + * @return boolean + * @throws CommondbException + * @throws ClassNotFoundException + * @throws InstantiationException + * @throws IllegalAccessException + * @throws Exception + */ + public boolean process(QueryRequest pQueryRequest) throws CommondbException, ClassNotFoundException, InstantiationException, IllegalAccessException, Exception { + Response response = pQueryRequest.getResponse(); + Map bean = pQueryRequest.getBeans(); + for (String k : bean.keySet()) { + QueryBean qbean = bean.get(k); + response.put(k, this.processByQueryBean(qbean)); + } + return true; + } + + /** + * Metodo que ejecuta una consulta por QueryBean.
+ * Si el QueryType asociado al QueryBean es E, Crea y entrega un objeto vacio. + * @param pQueryBean Datos del QueryBean + * @return Object + * @throws CommondbException + * @throws ClassNotFoundException + * @throws InstantiationException + * @throws IllegalAccessException + * @throws Exception + */ + private Object processByQueryBean(QueryBean pQueryBean) throws CommondbException, ClassNotFoundException, InstantiationException, IllegalAccessException, Exception { + if (pQueryBean.getQuerytype() != null && pQueryBean.getQuerytype().compareTo("E") == 0) { + if (pQueryBean.isMultirecord()) { + List data = new ArrayList(); + data.add(this.createObject(pQueryBean)); + return data; + } + return this.createObject(pQueryBean); + } + Criteria cri = this.prepareCriteria(pQueryBean); + return this.queryData(cri, pQueryBean); + } + + /** + * Metodo que ejecuta la consulta a la base de datos.
+ * Si es un multiregistro obtiene un resultset se recorre y entraga la respuesta, casocontarrio busca un solo + * objeto en la base. + * @param pCriteria Criteria con la cual se obtiene los datos de la base. + * @param pQueryBean Datos del objeto de consulta. + * @return Object + * @throws CommondbException + * @throws ClassNotFoundException + * @throws InstantiationException + * @throws IllegalAccessException + * @throws Exception + */ + private Object queryData(Criteria pCriteria, QueryBean pQueryBean) throws CommondbException, ClassNotFoundException, InstantiationException, IllegalAccessException, Exception { + String searchCatalogDetail = (String) pQueryBean.get("catalogdesc"); + String[] nameAttributes = null; + if (searchCatalogDetail != null) { + nameAttributes = searchCatalogDetail.split("\\*"); + } + + if (pQueryBean.isMultirecord()) { + List data = new ArrayList(); + ScrollableResults scroll = pCriteria.scroll(ScrollMode.FORWARD_ONLY); + boolean exists = false; + while (scroll.next()) { + exists = true; + Object[] record = scroll.get(); + data.add(this.fillRecord(record, nameAttributes)); + } + if (!exists && pQueryBean.getPage() == 1) { + Object obj = this.createObject(pQueryBean); + data.add(obj); + } + return data; + } else { + AbstractDataTransport obj = (AbstractDataTransport) pCriteria.uniqueResult(); + this.completeDescriptionCatalog(obj, nameAttributes); + return obj; + } + } + + /** + * Metodo que transforma los campos de un registro a un AbstractDataTransport. + * @param pRecord Datos de un registro obtenidos de la base de datos. + * @param nameAttributes Atributos adicionales con los cuales se completa la descripcion del catalogo. + * @return Object. + * @throws Exception + */ + private Object fillRecord(Object[] pRecord, String[] nameAttributes) throws Exception { + if (pRecord == null) { + return null; + } + if (pRecord.length == 1) { + AbstractDataTransport obj = (AbstractDataTransport) pRecord[0]; + this.completeDescriptionCatalog(obj, nameAttributes); + return obj; + } else { + Map m = new HashMap(); + return m; + } + } + + /** + * Metodo que procesa y adiciona los distintos criterios al bean. + * @param pQueryBean Objeto al cual se adicionan las restricciones de consulta. + * @return Criteria + * @throws CommondbException + * @throws ClassNotFoundException + * @throws InstantiationException + * @throws IllegalAccessException + */ + @SuppressWarnings("rawtypes") + private Criteria prepareCriteria(QueryBean pQueryBean) throws CommondbException, ClassNotFoundException, InstantiationException, IllegalAccessException { + Object beanReference = Class.forName(pQueryBean.getBeanName()).newInstance(); + Criteria c = PersistenceHelper.getSession().createCriteria(pQueryBean.getBeanName()); + + for (QueryCriteria criteria : pQueryBean.getCriteria()) { + if (criteria.getOperation() == null) { + continue; + } + Class type = null; + try { + type = BeanManager.getBeanGetterMethod(beanReference, criteria.getProperty()).getReturnType(); + } catch (Exception e1) { + } + c.add(this.fillCriterionByCriteria(criteria, type)); + } + + for (QueryCriteria order : pQueryBean.getOrder(true)) { + c.addOrder(Order.asc(order.getProperty())); + } + for (QueryCriteria order : pQueryBean.getOrder(false)) { + c.addOrder(Order.desc(order.getProperty())); + } + if (pQueryBean.getPage() > 0 && pQueryBean.getPageSize() > 0) { + c.setMaxResults(pQueryBean.getPageSize()); + c.setFirstResult((pQueryBean.getPage() - 1) * pQueryBean.getPageSize()); + } + return c; + } + + /** + * Metodo que crea un Criterion de restriccion a asociar al HQL. + * @param pCriteria Objto que contiene las condiciones del criterio. + * @param pType Tipo de dato del campo a adicionar la restriccion. + * @return Criterion + * @throws CommondbException + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + private Criterion fillCriterionByCriteria(QueryCriteria pCriteria, Class pType) throws CommondbException { + Property prop = Property.forName(pCriteria.getProperty()); + Object value = pCriteria.getValue(); + try { + value = BeanManager.convertObject(pCriteria.getValue(), pType); + } catch (Exception e) { + } + if (pCriteria.getOperation().compareTo("<") == 0) { + return prop.lt(value); + } + if (pCriteria.getOperation().compareTo(">") == 0) { + return prop.gt(value); + } + if (pCriteria.getOperation().compareTo("<=") == 0) { + return prop.le(value); + } + if (pCriteria.getOperation().compareTo(">=") == 0) { + return prop.ge(value); + } + if (pCriteria.getOperation().compareTo("=") == 0) { + return prop.eq(value); + } + if (pCriteria.getOperation().compareTo("<>") == 0) { + return prop.ne(value); + } + if (pCriteria.getOperation().compareTo("like") == 0) { + return prop.like(value); + } + if (pCriteria.getOperation().compareTo("isNull") == 0) { + return prop.isNull(); + } + if (pCriteria.getOperation().compareTo("isNotNull") == 0) { + return prop.isNotNull(); + } + if (pCriteria.getOperation().compareTo("in") == 0) { + // + if (pType.getName().compareTo("java.lang.String") == 0) { + String val = (String) pCriteria.getValue(); + StringTokenizer st = new StringTokenizer(val, ","); + List param = new ArrayList(); + while (st.hasMoreElements()) { + String object = (String) st.nextElement(); + param.add(object.substring(1, (object.length() - 1))); + } + return prop.in(param); + } else if (pType.getName().compareTo("java.lang.Integer") == 0) { + String val = (String) pCriteria.getValue(); + StringTokenizer st = new StringTokenizer(val, ","); + List param = new ArrayList(); + while (st.hasMoreElements()) { + String object = (String) st.nextElement(); + if (object.startsWith("'") || object.startsWith("\"")) { + object = object.substring(1, (object.length() - 1)); + } + param.add(Integer.parseInt(object)); + } + return prop.in(param); + } else { + return prop.in((Collection) pCriteria.getValue()); + } + + } + if (pCriteria.getOperation().compareTo("between") == 0) { + Object[] param = ((Collection) pCriteria.getValue()).toArray(); + return prop.between(param[0], param[1]); + } + if (pCriteria.getOperation().compareTo("sql") == 0) { + return Restrictions.sqlRestriction((String) value); + } + throw new CommondbException("QRY001", "OPERADOR {0} NO DISPONIBLE", pCriteria.getOperation()); + } + + /** + * Metodo que crea un objeto de tipo beanname asociado al QueryBean. + * @param pQueryBean Datos del QueryBean + * @return Object + */ + private Object createObject(QueryBean pQueryBean) { + try { + HibernateBean obj = (HibernateBean) Class.forName(pQueryBean.getBeanName()).newInstance(); + try { + Object id = BeanManager.getBeanAttributeValue(obj, "pk"); + if (id == null) { + Object key = Class.forName(pQueryBean.getBeanName() + "Key").newInstance(); + BeanManager.setBeanAttributeValue(obj, "pk", key); + } + } catch (Exception e) { + return obj; + } + return obj; + + } catch (Exception e) { + return null; + } + } + + /** + * Metodo que se encarga de completar descripciones de catalogo. + * @param pObject Objeto al cual se completa las descripciones de catalogo. + * @param nameAttributes Arreglo con los nombres de catalogo a buscar descripciones ejemlo + * [baserate,calculationbase] + * @throws Exception + */ + private void completeDescriptionCatalog(AbstractDataTransport pObject, String[] nameAttributes) throws Exception { + if (nameAttributes == null) { + return; + } + for (int i = 0; i < nameAttributes.length; i++) { + if (nameAttributes[i].startsWith("pk_")) { + nameAttributes[i] = nameAttributes[i].replaceAll("_", "."); + } + String descCatalog = "catalog"; + String descCatalogCode = "catalogcode"; + if (nameAttributes[i].compareTo("pk.catalog") == 0 || nameAttributes[i].compareTo("catalog") == 0) { + descCatalog = ""; + descCatalogCode = "code"; + } + if (pObject == null) { + break; + } + String catalog = (String) BeanManager.getBeanAttributeValue(pObject, nameAttributes[i] + descCatalog); + String catalogcode = (String) BeanManager.getBeanAttributeValue(pObject, nameAttributes[i] + descCatalogCode); + String nameNewAtribute = nameAttributes[i] + "desc"; + if (nameNewAtribute.startsWith("pk.")) { + nameNewAtribute = nameNewAtribute.substring(3, nameNewAtribute.length()); + } + if (catalog != null && catalogcode != null) { + TgeneCatalogDetail detail = DataHelper.getInstance().getTgeneCatalogDetail(catalog, catalogcode); + pObject.addAddtionalInfo(nameNewAtribute, detail.getDescription()); + } else { + pObject.addAddtionalInfo(nameNewAtribute, null); + } + } + } +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/text-base/QueryHelper.java.svn-base b/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/text-base/QueryHelper.java.svn-base new file mode 100644 index 0000000..a63d0ef --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/text-base/QueryHelper.java.svn-base @@ -0,0 +1,333 @@ +package com.fp.bpm.query; + +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.persistence.NoResultException; +import javax.persistence.NonUniqueResultException; +import javax.persistence.Query; + +import com.fp.common.helper.BeanManager; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.query.AdditionalQuery; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.db.DataHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase utilitaria utiliza en el motor generico de consultas. + * @author Jorge Vaca. + * @version 2.1 + */ +public class QueryHelper { // NOPMD by jorge on 12/10/10 21:53 + + /**Almacena la senetencia dinamica de consulta.*/ + protected StringBuffer query = new StringBuffer(64); // NOPMD by jorge on 12/10/10 21:53 + /**Map que almacen los parametros o restricciones para cada consulta asociada a un Query.*/ + protected Map mParameters; + + /** + * Metodo que se encarga de adicionar a la sentencia las restricciones del query. + * @param pCriteria Objeto que contiene los criterios a aplicar en la sentencia. + * @param pType Tipo de dato del campo al cual se aplica la restriccion. + * @throws CommondbException + * @throws Exception + */ + @SuppressWarnings("rawtypes") + protected void addRestrictions(QueryCriteria pCriteria, Class pType) throws CommondbException,Exception { // NOPMD by jorge on 12/10/10 21:51 + String field = pCriteria.getProperty(); + String condition = pCriteria.getOperation(); + Object value = pCriteria.getValue(); + try { + value = BeanManager.convertObject(pCriteria.getValue(), pType); + } catch (Exception e) { + } + + if (this.basic(condition)) { + String aux = field.substring(field.indexOf(".") + 1,field.length()); // NOPMD by jorge on 12/10/10 21:52 + aux = this.getAux(aux); + query.append("t."+field+" "+condition+" "+":"+aux); + mParameters.put(aux, value); + return; + } + if (condition.compareTo("isNull") == 0 || condition.compareTo("isNotNull") == 0 ) { + query.append("t."+field+" is null "); + return; + } + if ( condition.compareTo("isNotNull") == 0 ) { + query.append("t."+field+" is not null "); + return; + } + if (condition.compareTo("sql") == 0) { + query.append(value); + return; + } + if (condition.compareTo("in") == 0 || condition.compareTo("not in") == 0) { + query.append("t."+field+" "+condition+"("+value+")"); + return; + } + if (pCriteria.getOperation().compareTo("between") == 0) { + Object[] param = ((Collection) pCriteria.getValue()).toArray(); + query.append("t."+field+" "+condition+" "+param[0] +" and "+param[1]); + return; + } + throw new CommondbException("QRY001", "OPERADOR {0} NO DISPONIBLE", pCriteria.getOperation()); + } + + /** + * Metodo que adiciona un numero secuencial si el campo de la restriccion se repite en la sentencia. + * @param pAux Parametro de la sentencia. + * @return String + * @throws Exception + */ + private String getAux(String pAux) throws Exception { + if(!mParameters.containsKey(pAux)){ + return pAux; + } + Set s = mParameters.keySet(); + int i = 0; + for (String obj : s) { + if(!obj.contains("AAA")){ + continue; + } + String data = obj.substring(obj.indexOf("AAA"),obj.length()); + data = data.substring(3, data.length()); + i = Integer.valueOf(data); + ++i; + } + return pAux+"AAA"+i; + } + + /** + * Metodo que se encarga de adicionar a la senetencia los criterios de orden de la consulta. + * @param pQueryBean Objeto que contiene el bean a consultas, y las restricciones. + * @throws Exception + */ + protected void addOrder(QueryBean pQueryBean) throws Exception { + boolean first = true; + for (QueryCriteria order : pQueryBean.getOrder(true)) { + if(first){ + query.append(" ORDER BY "); + }else{ + query.append(" ,"); + } + query.append("t."+order.getProperty()+" asc "); + first = false; + } + for (QueryCriteria order : pQueryBean.getOrder(false)) { + if(first){ + query.append(" ORDER BY "); + }else{ + query.append(" ,"); + } + query.append("t."+order.getProperty()+" desc "); + first = false; + } + } + + + + /** + * Metodo que crea un objeto de tipo beanname asociado al QueryBean. + * @param pQueryBean Objeto que contiene el bean a consultas, y las restricciones. + * @return Object + */ + protected Object createObject(QueryBean pQueryBean) { + try { + HibernateBean obj = (HibernateBean) Class.forName(pQueryBean.getBeanName()).newInstance(); + try { + Object id = BeanManager.getBeanAttributeValue(obj, "pk"); + if (id == null) { + Object key = Class.forName(pQueryBean.getBeanName() + "Key").newInstance(); + BeanManager.setBeanAttributeValue(obj, "pk", key); + } + } catch (Exception e) { + return obj; + } + return obj; + + } catch (Exception e) { + return null; + } + } + + /** + * Metodo que transforma los campos de un registro a un AbstractDataTransport. + * @param pRecord Datos de un registro obtenidos de la base de datos. + * @param nameAttributes Atributos adicionales con los cuales se completa la descripcion del catalogo. + * @return Object. + * @throws Exception + */ + protected AbstractDataTransport fillRecord(QueryBean pQueryBean,Object pRecord, String[] nameAttributes) throws Exception { + if (pRecord == null) { + return null; + } + AbstractDataTransport obj = (AbstractDataTransport) pRecord; + this.completeDescriptionCatalog(obj, nameAttributes); + this.addAditionData(pQueryBean, obj); + return obj; + + } + + /** + * Metodo que se encarga de completar descripciones de catalogo. + * @param pObject Objeto al cual se completa las descripciones de catalogo. + * @param nameAttributes Arreglo con los nombres de catalogo a buscar descripciones ejemlo + * [baserate,calculationbase] + * @throws Exception + */ + protected void completeDescriptionCatalog(AbstractDataTransport pObject, String[] nameAttributes) throws Exception { // NOPMD by jorge on 12/10/10 21:53 + if (nameAttributes == null) { + return; + } + for (int i = 0; i < nameAttributes.length; i++) { + if (nameAttributes[i].startsWith("pk_")) { + nameAttributes[i] = nameAttributes[i].replaceAll("_", "."); + } + String descCatalog = "catalog"; + String descCatalogCode = "catalogcode"; + if (nameAttributes[i].compareTo("pk.catalog") == 0 || nameAttributes[i].compareTo("catalog") == 0) { + descCatalog = ""; + descCatalogCode = "code"; + } + if (pObject == null) { + break; + } + String catalog = (String) BeanManager.getBeanAttributeValue(pObject, nameAttributes[i] + descCatalog); + String catalogcode = (String) BeanManager.getBeanAttributeValue(pObject, nameAttributes[i] + descCatalogCode); + String nameNewAtribute = nameAttributes[i] + "desc"; + if (nameNewAtribute.startsWith("pk.")) { + nameNewAtribute = nameNewAtribute.substring(3, nameNewAtribute.length()); + } + if (catalog != null && catalogcode != null) { + TgeneCatalogDetail detail = DataHelper.getInstance().getTgeneCatalogDetail(catalog, catalogcode); + pObject.addAddtionalInfo(nameNewAtribute, detail.getDescription()); + } else { + pObject.addAddtionalInfo(nameNewAtribute, null); + } + } + } + + /** + * Metodo que verifica que la condicion de la restriccion sea basica. + * @param pCondition Codigo de condicion de la restriccion. + * @return boolean + * @throws Exception + */ + protected boolean basic(String pCondition) throws Exception { + if (pCondition.compareTo("<") == 0) { + return true; + } + if (pCondition.compareTo(">") == 0) { + return true; + } + if (pCondition.compareTo("<=") == 0) { + return true; + } + if (pCondition.compareTo(">=") == 0) { + return true; + } + if (pCondition.compareTo("=") == 0) { + return true; + } + if (pCondition.compareTo("<>") == 0) { + return true; + } + if (pCondition.compareTo("like") == 0) { + return true; + } + return false; + } + + /** + * Metodo que se encarga de ejecutar sentencias que completan informacion de la consulta asociada al QueryBean. + * @param pQueryBean Objeto que contiene el bean a consultas, y las restricciones. + * @param pObject Objeto que contiene la datos resultado del query del bean principal de la consulta. + * @throws Exception + */ + protected void addAditionData(QueryBean pQueryBean,AbstractDataTransport pObject) throws Exception { + List lData = pQueryBean.getAdditionalQuery(); + if(lData == null || lData.isEmpty()){ + return; + } + for (AdditionalQuery additionalQuery : lData) { + this.processByAditionalQuery(additionalQuery, pObject); + } + } + + /** + * Metodo que ejecuta sentecias por cada AdditionalQuery, que llega como parametro.
+ * Los valores de la restriccion los toma del resultado del bean principal. + * @param pAdditional Objeto que contiene las consideraciones necesarias para armar una consula adiciona de datos. + * @param pObject Objeto que contiene la datos resultado del query del bean principal de la consulta. + * @throws Exception + */ + @SuppressWarnings("rawtypes") + private void processByAditionalQuery(AdditionalQuery pAdditional,AbstractDataTransport pObject) throws Exception { // NOPMD by jorge on 12/10/10 21:52 + if(pObject == null){ + return; + } + StringBuffer query = new StringBuffer(); // NOPMD by jorge on 12/10/10 21:52 + query.append("select t."+pAdditional.getField()+" from "+pAdditional.getBean()+" t "); + List> lCriteria = pAdditional.getCriteria(); + mParameters.clear(); + boolean first = true; + boolean execute = true; + for (Map map : lCriteria) { + if(first){ + query.append(" WHERE "); + first = false; + }else{ + query.append(" AND "); + } + String aux = map.get("inner").substring(map.get("inner").indexOf(".") + 1,map.get("inner").length()); // NOPMD by jorge on 12/10/10 21:52 + query.append("t."+map.get("inner")+" = "+":"+aux); + Object value = map.get("value"); + if(value == null){ + Class type = null; + try { + type = BeanManager.getBeanGetterMethod(pObject, map.get("outer")).getReturnType(); + } catch (Exception e1) { + } + String aux1 = map.get("outer"); //Si es pk simple llega pk, si es compuesta llega pk.campo + value = BeanManager.getBeanAttributeValue(pObject, aux1); + if(value == null){ + execute = false; //Si no encuentra valor en la tabla padre no ejecuta el query. + break; + } + if(type != null){ + value = BeanManager.convertObject(value, type); + } + } + mParameters.put(aux, value); + } + if(!execute){ + pObject.addAddtionalInfo(pAdditional.getAlias(), null); + return; + } + Query qry = PersistenceHelper.getEntityManager().createQuery(query.toString()); + Iterator itr = mParameters.keySet().iterator(); + while(itr.hasNext()){ + String key = itr.next(); + qry.setParameter(key, mParameters.get(key)); + } + try { + Object result = qry.getSingleResult(); + pObject.addAddtionalInfo(pAdditional.getAlias(), result); + } catch (NoResultException e) { + pObject.addAddtionalInfo(pAdditional.getAlias(), null); + } catch (NonUniqueResultException e) { + throw new CommondbException("COMMONDB-00015","EXISTE MAS DE UN REGISTRO PARA LA TABAL: {0}", e,pAdditional.getBean()); + } + + + } + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/text-base/QueryJsf.java.svn-base b/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/text-base/QueryJsf.java.svn-base new file mode 100644 index 0000000..c0ca051 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/text-base/QueryJsf.java.svn-base @@ -0,0 +1,249 @@ +package com.fp.bpm.query; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.persistence.NoResultException; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.query.SubQuery; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; + +/** + * Clase que se encarga de realizar consultas genericas a la base de datos. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class QueryJsf { + /** Map con el orden campos a aplicar a la consulta */ + protected final Map mparameter = new HashMap(); + + /** Parte de la setencia que tiene la instruccion for de la cosnualta. */ + private StringBuffer sql; + + /** Almacena las restriciones de la consulta. */ + protected StringBuffer where; + + private boolean issubquery = false; + + /** + * Metodo que se encarga de realizar consulta de tablas que llegan en el request.
+ * La cosnsulta se ejecuta por tabla. + * + * @param queryRequest Request de consultya que almacena la lista de tablas a consultar. + * @throws Exception + */ + public void execute(QueryRequest queryRequest) throws Exception { + Map mtablas = queryRequest.getQueryTables(); + if (mtablas == null) { + return; + } + Set s = mtablas.keySet(); + for (String key : s) { + // Crea nuevos objetos por cada tabla que se consulta. + sql = new StringBuffer(46); + where = new StringBuffer(46); + mparameter.clear(); + issubquery = false; + // Ejecuta consulta de la tabla. + DtoQuery dtoqry = mtablas.get(key); + if (dtoqry.getBeanname() == null) { + continue; + } + Object resp = queryByBean(dtoqry); + queryRequest.getResponse().put(key, resp); + + } + } + + private Object queryByBean(DtoQuery dtoquey) throws Exception { + buildSentence(dtoquey); + APPLogger.getLogger().debug(sql); + return executeByDtoQuery(dtoquey); + } + + private void buildSentence(DtoQuery dtoquery) throws Exception { + buildSql(dtoquery); + buildCriteria(dtoquery); + sql.append(where); + if (dtoquery.getOrderby() != null) { + sql.append(" order by " + dtoquery.getOrderby()); + } + } + + private Object executeByDtoQuery(DtoQuery dtoquery) throws Exception { + if (dtoquery.isMultirecord()) { + List lresp = queryList(dtoquery); + if (issubquery) { + return buildlistresponse(dtoquery, lresp); + } else { + return lresp; + } + } + Object resp = queryObject(dtoquery); + if ((resp != null) && issubquery) { + return buildobjectresponse(dtoquery, resp); + } + return resp; + } + + private Object buildobjectresponse(DtoQuery dtoquery, Object object) throws Exception { + List lsubquery = dtoquery.getlSubquery(); + Object[] obj = (Object[]) object; + AbstractDataTransport bean = (AbstractDataTransport) obj[0]; + for (int i = 1; i <= lsubquery.size(); i++) { + SubQuery s = lsubquery.get(i - 1); + Object valor = obj[i]; + bean.put(s.getAlias(), valor); + } + return bean; + } + + private Object buildlistresponse(DtoQuery dtoquery, List lresp) throws Exception { + List l = new ArrayList(); + List lsubquery = dtoquery.getlSubquery(); + for (Object object : lresp) { + Object[] obj = (Object[]) object; + AbstractDataTransport bean = (AbstractDataTransport) obj[0]; + for (int i = 1; i <= lsubquery.size(); i++) { + SubQuery s = lsubquery.get(i - 1); + Object valor = obj[i]; + bean.put(s.getAlias(), valor); + } + l.add(bean); + } + return l; + } + + /** + * Metodo que se encarga de construir y adicionar campos a consultar de una tabla. + * + * @throws Exception + */ + protected void buildSql(DtoQuery dtoquery) throws Exception { + sql.append("select t "); + List lsubquery = dtoquery.getlSubquery(); + for (SubQuery subQuery : lsubquery) { + issubquery = true; + sql.append("," + subQuery.getSubQuery()); + } + // Adiciona subqueries. + sql.append(" from " + dtoquery.getBeanname() + " t"); + + } + + protected void buildCriteria(DtoQuery dtoquery) throws Exception { + List lfiltro = dtoquery.getLfilter(); + if ((lfiltro == null) || lfiltro.isEmpty()) { + return; + } + boolean first = true; + for (Filter filtro : lfiltro) { + if (filtro.getSql() != null) { + this.addFiltersql(filtro.getSql(), first); + continue; + } + if (filtro.getValue() == null) { + continue; + } + addFilter(dtoquery.getBeanname(), filtro, first); + first = false; + } + } + + private void addFilter(String bean, Filter filtro, boolean first) throws Exception { + Object valor = filtro.getValue(); + String campo = filtro.getField(); + String condicion = filtro.getCondition() == null ? "=" : filtro.getCondition(); + valor = PersistenceManager.changeType(bean, campo, valor); + if (String.valueOf(valor).indexOf("%") >= 0) { + condicion = "like"; + } + String aux = campo.substring(campo.indexOf(".") + 1, campo.length()); + String cond = "t." + campo + " " + condicion + " " + ":" + aux; + mparameter.put(aux, valor); + if (where == null) { + where = new StringBuffer(46); + } + if (first) { + where.append(" where " + cond); + } else { + where.append(" and " + cond); + } + } + + private void addFiltersql(String sql, boolean first) throws Exception { + if (first) { + where.append(" where " + sql); + } else { + where.append(" and " + sql); + } + } + + /** + * Metodo que entrega una lista de objetos relacionados a la tabla que se consulta. + * + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + private List queryList(DtoQuery dtoquery) throws Exception { + javax.persistence.Query query = createQuery(dtoquery); + return query.getResultList(); + } + + /** + * Metodo que entrega un objeto, de una tabla relacionado a la consulta. + * + * @return Object. + * @throws Exception + */ + private Object queryObject(DtoQuery dtoquery) throws Exception { + Object obj = null; + javax.persistence.Query query = createQuery(dtoquery); + try { + obj = query.getSingleResult(); + } catch (NoResultException e) { + // Si no existe datos no hacer nada. + } + return obj; + } + + private javax.persistence.Query createQuery(DtoQuery dtoquery) throws Exception { + javax.persistence.Query query = PersistenceHelper.getEntityManager().createQuery(sql.toString()); + this.setParameters(dtoquery, query); + return query; + } + + /** + * Fija parametros, primer registro y ultimo registro de comsulta. + * + * @param dtoquery + * @param qry + * @throws Exception + */ + public void setParameters(DtoQuery dtoquery, javax.persistence.Query qry) throws Exception { + Integer pagina = dtoquery.getPage(); + Integer numreg = dtoquery.getRecperpage() == null ? 10 : dtoquery.getRecperpage(); + // Control de paginacion. + if (dtoquery.isMultirecord()) { + qry.setFirstResult(pagina); + qry.setMaxResults(numreg); + } + // Fija parametros a la sentencia + Set s = mparameter.keySet(); + for (String key : s) { + Object valor = mparameter.get(key); + qry.setParameter(key, valor); + } + } +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/text-base/QueryOperation.java.svn-base b/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/text-base/QueryOperation.java.svn-base new file mode 100644 index 0000000..a5a3cf3 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/text-base/QueryOperation.java.svn-base @@ -0,0 +1,5 @@ +package com.fp.bpm.query; + +public interface QueryOperation { + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/text-base/QueryProcessCriteria.java.svn-base b/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/text-base/QueryProcessCriteria.java.svn-base new file mode 100644 index 0000000..421e777 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/text-base/QueryProcessCriteria.java.svn-base @@ -0,0 +1,143 @@ +package com.fp.bpm.query; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.Criteria; +import org.hibernate.ScrollMode; +import org.hibernate.ScrollableResults; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Property; +import org.hibernate.criterion.Restrictions; + +import com.fp.common.helper.BeanManager; +import com.fp.dto.Response; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; +import com.fp.dto.query.QueryRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; + +public class QueryProcessCriteria { + public QueryProcessCriteria() { + } + + public boolean process(QueryRequest pReq, Response pRes) throws CommondbException, ClassNotFoundException, InstantiationException, IllegalAccessException { + Map bean = pReq.getBeans(); + for (String k : bean.keySet()) { + QueryBean qbean = bean.get(k); + pRes.put(k, this.process(qbean)); + } + return true; + } + + private Object process(QueryBean pQuery) throws CommondbException, ClassNotFoundException, InstantiationException, IllegalAccessException { + Criteria cri = this.prepareCriteria(pQuery); + return this.fillData(cri, pQuery.isMultirecord()); + } + + private Object fillData(Criteria pCriteria, boolean pMultirecord) { + + if (pMultirecord) { + List data = new ArrayList(); + ScrollableResults scroll = pCriteria.scroll(ScrollMode.FORWARD_ONLY); + while (scroll.next()) { + data.add(this.fillRecord(scroll.get())); + } + return data; + } else { + return pCriteria.uniqueResult(); + } + + } + + private Object fillRecord(Object[] pRecord) { + if (pRecord == null) { + return null; + } + if (pRecord.length == 1) { + return pRecord[0]; + } else { + Map m = new HashMap(); + return m; + } + } + + @SuppressWarnings("unchecked") + private Criteria prepareCriteria(QueryBean pQuery) throws CommondbException, ClassNotFoundException, InstantiationException, IllegalAccessException { + Object beanReference=Class.forName(pQuery.getBeanName()).newInstance(); + Criteria c = PersistenceHelper.getSession().createCriteria(pQuery.getBeanName()); + + for (QueryCriteria criteria : pQuery.getCriteria()) { + Class type=null; + try{ + type=BeanManager.getBeanGetterMethod(beanReference, criteria.getProperty()).getReturnType(); + }catch(Exception e1){ + } + c.add(this.prepareCriterion(criteria,type)); + } + for (QueryCriteria order : pQuery.getOrder(true)) { + c.addOrder(Order.asc(order.getProperty())); + } + for (QueryCriteria order : pQuery.getOrder(false)) { + c.addOrder(Order.desc(order.getProperty())); + } + if (pQuery.getPage() > 0 && pQuery.getPageSize() > 0) { + c.setMaxResults(pQuery.getPageSize()); + c.setFirstResult((pQuery.getPage() - 1) * pQuery.getPageSize()); + } + + return c; + } + + @SuppressWarnings("unchecked") + private Criterion prepareCriterion(QueryCriteria pCriteria,Class pType) throws CommondbException { + Property prop = Property.forName(pCriteria.getProperty()); + Object value=pCriteria.getValue(); + try{ + value=BeanManager.convertObject(pCriteria.getValue(),pType); + }catch(Exception e){} + if (pCriteria.getOperation().compareTo("<") == 0) { + return prop.lt(value); + } + if (pCriteria.getOperation().compareTo(">") == 0) { + return prop.gt(value); + } + if (pCriteria.getOperation().compareTo("<=") == 0) { + return prop.le(value); + } + if (pCriteria.getOperation().compareTo(">=") == 0) { + return prop.ge(value); + } + if (pCriteria.getOperation().compareTo("=") == 0) { + return prop.eq(value); + } + if (pCriteria.getOperation().compareTo("<>") == 0) { + return prop.ne(value); + } + if (pCriteria.getOperation().compareTo("like") == 0) { + return prop.like(value); + } + if (pCriteria.getOperation().compareTo("isNull") == 0) { + return prop.isNull(); + } + if (pCriteria.getOperation().compareTo("isNotNull") == 0) { + return prop.isNotNull(); + } + if (pCriteria.getOperation().compareTo("in") == 0) { + return prop.in((Collection) pCriteria.getValue()); + } + if (pCriteria.getOperation().compareTo("between") == 0) { + Object[] param = ((Collection) pCriteria.getValue()).toArray(); + return prop.between(param[0], param[1]); + } + if (pCriteria.getOperation().compareTo("sql") == 0) { + return Restrictions.sqlRestriction((String) value); + } + throw new CommondbException("QRY001", "OPERADOR {0} NO DISPONIBLE", pCriteria.getOperation()); + } +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/text-base/QueryProcessor.java.svn-base b/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/text-base/QueryProcessor.java.svn-base new file mode 100644 index 0000000..62d0d8e --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/query/.svn/text-base/QueryProcessor.java.svn-base @@ -0,0 +1,188 @@ +package com.fp.bpm.query; + +import java.util.List; +import java.util.Map; + +import com.fp.common.exception.CommonException; +import com.fp.common.exception.SavePointException; +import com.fp.common.logger.APPLogger; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.dto.rules.TransactionRule; +import com.fp.persistence.commondb.db.DataHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.pgeneral.gene.TgeneQueryProcess; +import com.fp.persistence.pgeneral.gene.TgeneTransactionQuery; + +/** + * Motor de consultas, el proceso se ejecuta de acuerodo a querytype.
+ * + * @author Jorge Vaca + * @version 2.1 + */ +public class QueryProcessor { + + /** Objeto con beans utilizados en el proceso de consulta. */ + private QueryRequest queryRequest; + + /** + * Metodo que se encarga de ejecutar consultas contra la base de datos, adicionalmente ejecuta consultas especiales + * si estas estarian parametrizadas. Proceso tipo de consulta.
+ * "P" Ejecuta consulta por reglas asociadas a un codigo de consulta. "T" Ejecuta consulta por reglas asociadas a la + * transaccion. "N" Ejecuta consultas genericas. + * + * @param pQueryRequest Objeto con beans utilizados en el proceso de consulta. + * @param pResponse Objeto en el cual se alamcena la respuesta de una transaccion. + * @return boolean + * @throws CommondbException + * @throws Exception + */ + public boolean process(QueryRequest pQueryRequest) throws CommondbException, Exception { + Thread.currentThread().setName(pQueryRequest.getJournalId()); + this.queryRequest = pQueryRequest; + String queryType = (String) pQueryRequest.get("querytype"); + + if ((queryType == null) || (queryType.compareTo("N") == 0)) { + if(!pQueryRequest.isJsf()){ + Query qry = new Query(); + qry.process(pQueryRequest); + }else{ + QueryJsf qry = new QueryJsf(); + qry.execute(pQueryRequest); + } + + } + // Ejecuta consultas especiales para una transaccion. + if ((queryType != null) && (queryType.compareTo("T") == 0)) { + this.processByTransaction(); + } + // Ejecuta consultas especiales para un codigo de query. + if ((queryType == null) || (queryType.compareTo("P") == 0)) { + // Si es null entra el contro esta en el metodo interno + this.processQueryByAlias(); + } + return true; + } + + /** + * Metodo que se encarga de ejecutar comandos especiales de consulta por queryalias. + * + * @param pQueryRequest Objeto con beans utilizados en el proceso de consulta. + * @param pResponse Objeto que contiene los datos de respuesta de la consulta. + * @throws Exception + */ + public void processQueryByAlias() throws Exception { + Map bean = this.queryRequest.getBeans(); + for (String k : bean.keySet()) { + QueryBean qbean = bean.get(k); + if (qbean.getQueryalias() != null) { + this.processByQueryCode(qbean.getQueryalias()); + } + } + String queryalias = (String) this.queryRequest.get("queryalias"); + if (queryalias != null) { + this.processByQueryCode(queryalias); + } + } + + /** + * Fija un nuevo valor en queryRequest + * + * @param pQueryRequest nuevo valor para queryRequest + */ + public void setQueryRequest(QueryRequest pQueryRequest) { + this.queryRequest = pQueryRequest; + } + + /** + * Metodo que se encarga de ejecutar procesos especiales de consulta por codigo de consulta. + * + * @param pQueryRequest Objeto con beans utilizados en el proceso de consulta. + * @param pQueryCode Codigo de consulta. + * @throws Exception + */ + private void processByQueryCode(String pQueryCode) throws Exception { + List lprocess = DataHelper.getInstance().getTgeneQueryProcess(pQueryCode); + if (lprocess == null) { + return; + } + for (TgeneQueryProcess obj : lprocess) { + this.processByCode(obj.getProcesscode(), pQueryCode); + } + } + + /** + * + * @param pResponse Objeto con beans utilizados en el proceso de consulta. + * @param pProcess Codigo de proceso a ejecutar. + * @param pQueryCode Codigo de consulta. + * @throws Exception + */ + private void processByCode(String pProcess, String pQueryCode) throws Exception { + QueryRule rule = null; + try { + rule = (QueryRule) Class.forName(pProcess).newInstance(); + } catch (ClassNotFoundException e) { + throw new CommonException("COMMON-0012", "CLASE {0} A EJECUTAR NO EXISTE CODE: {0}", e, pQueryCode); + } catch (ClassCastException e) { + throw new CommonException("COMMON-0013", "PROCESO {0} A EJECUTAR CODE: {1} NO IMPLEMENTA QUERYRULE", e, pProcess, pQueryCode); + } + APPLogger.getLogger().info("INICIO ==> " + rule); + rule.process(this.queryRequest); + APPLogger.getLogger().info("FIN ==> " + rule); + } + + /** + * Metodo que ejecuta procesos especiales de consulta por transaccion. + * + * @param pQueryRequest Objeto con beans utilizados en el proceso de consulta. + * @throws Exception + */ + private void processByTransaction() throws Exception { + if ((this.queryRequest.getTransactionModule() == null) || (this.queryRequest.getTransactionCode() == null)) { + return; + } + List lquery = DataHelper.getInstance().getTgeneTransactionQuery(this.queryRequest.getTransactionModule(), + this.queryRequest.getTransactionCode(), this.queryRequest.getTransactionVersion()); + if (lquery == null) { + return; + } + for (TgeneTransactionQuery obj : lquery) { + try { + this.processByTransactionRule(obj); + } catch (SavePointException e) { + // Detiene la ejecucion de componentes de negocio y graba la transaccion. + break; + } + + } + } + + /** + * Metodo encargado de ejecutar cada una de las reglas definidas en la transaccion. + * + * @param pSaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @param pProcess Objeto que contiene la regla a ejecutar. + * @throws Exception + */ + private void processByTransactionRule(TgeneTransactionQuery pQuery) throws Exception { + QueryRule rule = null; + try { + rule = (QueryRule) Class.forName(pQuery.getProcesscode()).newInstance(); + } catch (ClassNotFoundException e) { + throw new CommonException("COMMON-0014", "CLASE {0} A EJECUTAR NO EXISTE MODULE: {1} TRANS: {2} VERSION {3}", e, + pQuery.getProcesscode(), this.queryRequest.getTransactionModule(), this.queryRequest.getTransactionCode(), + this.queryRequest.getTransactionVersion()); + } catch (ClassCastException e) { + throw new CommonException("COMMON-0015", "PROCESO {0} A EJECUTAR MODULE: {1} TRANS: {2} VERSION {3} NO IMPLEMENTA {4}", e, + pQuery.getProcesscode(), this.queryRequest.getTransactionModule(), this.queryRequest.getTransactionCode(), + this.queryRequest.getTransactionVersion(), TransactionRule.class.getName()); + } + rule.setFlow(pQuery.getProcessname()); + rule.setRule(pQuery.getRulename()); + APPLogger.getLogger().info("INICIO ==> " + rule); + rule.process(this.queryRequest); + APPLogger.getLogger().info("FIN ==> " + rule); + } +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/query/Query.java b/base/core/bpm/src/main/java/com/fp/bpm/query/Query.java new file mode 100644 index 0000000..5de3c53 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/query/Query.java @@ -0,0 +1,183 @@ +package com.fp.bpm.query; + + +import java.util.List; +import java.util.Map; + +import com.fp.common.helper.BeanManager; +import com.fp.common.logger.APPLogger; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Response; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; +import com.fp.dto.query.QueryRequest; +import com.fp.persistence.commondb.HqlStatement; +import com.fp.persistence.commondb.exception.CommondbException; +import java.util.ArrayList; +import java.util.Hashtable; + +/** + * Clase que se encarga de realizar consultas genericas a la base de datos. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class Query extends QueryHelper { // NOPMD by jorge on 12/10/10 21:44 + + /** + * Numero maximo de registros a entregar en en la consulta, cuando se trate de una consulta multiregistro. + */ + private int maxresults; + + /** + * Metodo principal que inicia la consulta de datos, El objeto QueryRequest contiene una lista de objetos QueryBean, + * para cada uno de estos objetos arma un Query le asocia parametros y ejecuta la consulta. + * + * @param pQueryRequest Objeto que contiene una lista de objetos QueryBean. + * @return boolean + * @throws CommondbException + * @throws ClassNotFoundException + * @throws InstantiationException + * @throws IllegalAccessException + * @throws Exception + */ + public boolean process(QueryRequest pQueryRequest) throws CommondbException, ClassNotFoundException, InstantiationException, + IllegalAccessException, Exception { + Response response = pQueryRequest.getResponse(); + Map bean = pQueryRequest.getBeans(); + for (String k : bean.keySet()) { + QueryBean qbean = bean.get(k); + if ((qbean.getBeanName() == null)) { + continue; + } + response.put(k, this.processByQueryBean(qbean)); + } + this.query = null; + return true; + } + + /** + * Metodo que se encarga de ejecutar la consulta por QueryBean, genera dicamente la sentencia, adiciona parametros + * ejecuta la consulta y arma la respuesta de los datos del bean. + * + * @param pQueryBean Objeto que contiene el bean a consultas, y las restricciones. + * @return Object + * @throws CommondbException + * @throws ClassNotFoundException + * @throws InstantiationException + * @throws IllegalAccessException + * @throws Exception + */ + private Object processByQueryBean(QueryBean pQueryBean) throws CommondbException, ClassNotFoundException, InstantiationException, + IllegalAccessException, Exception { + if ((pQueryBean.getQuerytype() != null) && (pQueryBean.getQuerytype().compareTo("E") == 0)) { + if (pQueryBean.isMultirecord()) { + List data = new ArrayList(); + data.add((AbstractDataTransport) this.createObject(pQueryBean)); + return data; + } + return this.createObject(pQueryBean); + } + this.buildSenetnce(pQueryBean); + // return null; + return this.queryData(pQueryBean); + } + + /** + * Metodo que se encarga de armar la sentencia del query, adiciona restricciones y criterios de ordenamiento de los + * resultados. + * + * @param pQueryBean Objeto que contiene el bean a consultas, y las restricciones. + * @throws CommondbException + * @throws ClassNotFoundException + * @throws InstantiationException + * @throws IllegalAccessException + * @throws Exception + */ + @SuppressWarnings("rawtypes") + private void buildSenetnce(QueryBean pQueryBean) throws CommondbException, ClassNotFoundException, // NOPMD by jorge + // on 12/10/10 + // 21:44 + InstantiationException, IllegalAccessException, Exception { + Object beanReference = Class.forName(pQueryBean.getBeanName()).newInstance(); + this.query = new StringBuffer(); + this.mParameters = new Hashtable(); + this.query.append("FROM " + pQueryBean.getBeanName() + " t "); + boolean first = true; + for (QueryCriteria criteria : pQueryBean.getCriteria()) { + String condition = criteria.getOperation(); + if ((condition != null) && ((condition.compareTo("isNull") == 0) || (condition.compareTo("isNotNull") == 0))) { + criteria.setValue(""); + } + if ((criteria.getValue() == null) + && ((condition == null) || (condition.compareTo("isNull") != 0) || (condition.compareTo("isNotNull") != 0))) { + continue; + } + if (first) { + this.query.append(" WHERE "); + first = false; + } else { + this.query.append(" AND "); + } + if (criteria.getOperation() == null) { + continue; + } + Class type = null; + try { + type = BeanManager.getBeanGetterMethod(beanReference, criteria.getProperty()).getReturnType(); + } catch (Exception e1) { + } + super.addRestrictions(criteria, type); + } + super.addOrder(pQueryBean); + if ((pQueryBean.getPage() > 0) && (pQueryBean.getPageSize() > 0)) { + this.maxresults = pQueryBean.getPageSize(); + } + } + + /** + * Metodo que se encarga de ejecutar la consulta, crea un HqlStatement, fija los parametros y arma los datos de + * respuesta. + * + * @param pQueryBean Objeto que contiene el bean a consultas, y las restricciones. + * @return Object + * @throws CommondbException + * @throws ClassNotFoundException + * @throws InstantiationException + * @throws IllegalAccessException + * @throws Exception + */ + @SuppressWarnings("unchecked") + private Object queryData(QueryBean pQueryBean) throws CommondbException, ClassNotFoundException, InstantiationException, IllegalAccessException, + Exception { + String searchCatalogDetail = (String) pQueryBean.get("catalogdesc"); + String[] nameAttributes = null; + if (searchCatalogDetail != null) { + nameAttributes = searchCatalogDetail.split("\\*"); + } + APPLogger.getLogger().debug("CONSULTA: " + super.query.toString()); + HqlStatement hql = new HqlStatement(super.query.toString()); + hql.setParametersValue(super.mParameters); + hql.setPage(pQueryBean.getPage()); + hql.setRecordperpage(this.maxresults); + if (pQueryBean.isMultirecord()) { + List data = new ArrayList(); + List ldata = hql.execute().getResultList(); + boolean exists = false; + for (Object object : ldata) { + exists = true; + data.add(this.fillRecord(pQueryBean, object, nameAttributes)); + } + if (!exists) { + Object obj = this.createObject(pQueryBean); + data.add(obj); + } + return (data); + } else { + AbstractDataTransport obj = (AbstractDataTransport) hql.getObject(); + super.completeDescriptionCatalog(obj, nameAttributes); + this.addAditionData(pQueryBean, obj); + return obj; + } + } +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/query/QueryHQL.java b/base/core/bpm/src/main/java/com/fp/bpm/query/QueryHQL.java new file mode 100644 index 0000000..3fcd2a2 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/query/QueryHQL.java @@ -0,0 +1,333 @@ +package com.fp.bpm.query; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; + +import org.hibernate.Criteria; +import org.hibernate.ScrollMode; +import org.hibernate.ScrollableResults; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Property; +import org.hibernate.criterion.Restrictions; + +import com.fp.common.helper.BeanManager; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Response; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; +import com.fp.dto.query.QueryRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.db.DataHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Motor de consultas generico. + * @author Jorge Vaca + * @version 2.1 + */ +public class QueryHQL { + + public QueryHQL() { + } + + /** + * Metodo que se encarga de ejecutar consultas genericas.
+ * Proceso.
+ *
    + *
  • Obtiene una lista de QueryBean del Objeto QueryRequest
  • + *
  • Ejecuta la consulta para cada QueryBean
  • + *
  • Llena la respuesta en el response.
  • + *
+ * @param pReq + * @return boolean + * @throws CommondbException + * @throws ClassNotFoundException + * @throws InstantiationException + * @throws IllegalAccessException + * @throws Exception + */ + public boolean process(QueryRequest pQueryRequest) throws CommondbException, ClassNotFoundException, InstantiationException, IllegalAccessException, Exception { + Response response = pQueryRequest.getResponse(); + Map bean = pQueryRequest.getBeans(); + for (String k : bean.keySet()) { + QueryBean qbean = bean.get(k); + response.put(k, this.processByQueryBean(qbean)); + } + return true; + } + + /** + * Metodo que ejecuta una consulta por QueryBean.
+ * Si el QueryType asociado al QueryBean es E, Crea y entrega un objeto vacio. + * @param pQueryBean Datos del QueryBean + * @return Object + * @throws CommondbException + * @throws ClassNotFoundException + * @throws InstantiationException + * @throws IllegalAccessException + * @throws Exception + */ + private Object processByQueryBean(QueryBean pQueryBean) throws CommondbException, ClassNotFoundException, InstantiationException, IllegalAccessException, Exception { + if (pQueryBean.getQuerytype() != null && pQueryBean.getQuerytype().compareTo("E") == 0) { + if (pQueryBean.isMultirecord()) { + List data = new ArrayList(); + data.add(this.createObject(pQueryBean)); + return data; + } + return this.createObject(pQueryBean); + } + Criteria cri = this.prepareCriteria(pQueryBean); + return this.queryData(cri, pQueryBean); + } + + /** + * Metodo que ejecuta la consulta a la base de datos.
+ * Si es un multiregistro obtiene un resultset se recorre y entraga la respuesta, casocontarrio busca un solo + * objeto en la base. + * @param pCriteria Criteria con la cual se obtiene los datos de la base. + * @param pQueryBean Datos del objeto de consulta. + * @return Object + * @throws CommondbException + * @throws ClassNotFoundException + * @throws InstantiationException + * @throws IllegalAccessException + * @throws Exception + */ + private Object queryData(Criteria pCriteria, QueryBean pQueryBean) throws CommondbException, ClassNotFoundException, InstantiationException, IllegalAccessException, Exception { + String searchCatalogDetail = (String) pQueryBean.get("catalogdesc"); + String[] nameAttributes = null; + if (searchCatalogDetail != null) { + nameAttributes = searchCatalogDetail.split("\\*"); + } + + if (pQueryBean.isMultirecord()) { + List data = new ArrayList(); + ScrollableResults scroll = pCriteria.scroll(ScrollMode.FORWARD_ONLY); + boolean exists = false; + while (scroll.next()) { + exists = true; + Object[] record = scroll.get(); + data.add(this.fillRecord(record, nameAttributes)); + } + if (!exists && pQueryBean.getPage() == 1) { + Object obj = this.createObject(pQueryBean); + data.add(obj); + } + return data; + } else { + AbstractDataTransport obj = (AbstractDataTransport) pCriteria.uniqueResult(); + this.completeDescriptionCatalog(obj, nameAttributes); + return obj; + } + } + + /** + * Metodo que transforma los campos de un registro a un AbstractDataTransport. + * @param pRecord Datos de un registro obtenidos de la base de datos. + * @param nameAttributes Atributos adicionales con los cuales se completa la descripcion del catalogo. + * @return Object. + * @throws Exception + */ + private Object fillRecord(Object[] pRecord, String[] nameAttributes) throws Exception { + if (pRecord == null) { + return null; + } + if (pRecord.length == 1) { + AbstractDataTransport obj = (AbstractDataTransport) pRecord[0]; + this.completeDescriptionCatalog(obj, nameAttributes); + return obj; + } else { + Map m = new HashMap(); + return m; + } + } + + /** + * Metodo que procesa y adiciona los distintos criterios al bean. + * @param pQueryBean Objeto al cual se adicionan las restricciones de consulta. + * @return Criteria + * @throws CommondbException + * @throws ClassNotFoundException + * @throws InstantiationException + * @throws IllegalAccessException + */ + @SuppressWarnings("rawtypes") + private Criteria prepareCriteria(QueryBean pQueryBean) throws CommondbException, ClassNotFoundException, InstantiationException, IllegalAccessException { + Object beanReference = Class.forName(pQueryBean.getBeanName()).newInstance(); + Criteria c = PersistenceHelper.getSession().createCriteria(pQueryBean.getBeanName()); + + for (QueryCriteria criteria : pQueryBean.getCriteria()) { + if (criteria.getOperation() == null) { + continue; + } + Class type = null; + try { + type = BeanManager.getBeanGetterMethod(beanReference, criteria.getProperty()).getReturnType(); + } catch (Exception e1) { + } + c.add(this.fillCriterionByCriteria(criteria, type)); + } + + for (QueryCriteria order : pQueryBean.getOrder(true)) { + c.addOrder(Order.asc(order.getProperty())); + } + for (QueryCriteria order : pQueryBean.getOrder(false)) { + c.addOrder(Order.desc(order.getProperty())); + } + if (pQueryBean.getPage() > 0 && pQueryBean.getPageSize() > 0) { + c.setMaxResults(pQueryBean.getPageSize()); + c.setFirstResult((pQueryBean.getPage() - 1) * pQueryBean.getPageSize()); + } + return c; + } + + /** + * Metodo que crea un Criterion de restriccion a asociar al HQL. + * @param pCriteria Objto que contiene las condiciones del criterio. + * @param pType Tipo de dato del campo a adicionar la restriccion. + * @return Criterion + * @throws CommondbException + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + private Criterion fillCriterionByCriteria(QueryCriteria pCriteria, Class pType) throws CommondbException { + Property prop = Property.forName(pCriteria.getProperty()); + Object value = pCriteria.getValue(); + try { + value = BeanManager.convertObject(pCriteria.getValue(), pType); + } catch (Exception e) { + } + if (pCriteria.getOperation().compareTo("<") == 0) { + return prop.lt(value); + } + if (pCriteria.getOperation().compareTo(">") == 0) { + return prop.gt(value); + } + if (pCriteria.getOperation().compareTo("<=") == 0) { + return prop.le(value); + } + if (pCriteria.getOperation().compareTo(">=") == 0) { + return prop.ge(value); + } + if (pCriteria.getOperation().compareTo("=") == 0) { + return prop.eq(value); + } + if (pCriteria.getOperation().compareTo("<>") == 0) { + return prop.ne(value); + } + if (pCriteria.getOperation().compareTo("like") == 0) { + return prop.like(value); + } + if (pCriteria.getOperation().compareTo("isNull") == 0) { + return prop.isNull(); + } + if (pCriteria.getOperation().compareTo("isNotNull") == 0) { + return prop.isNotNull(); + } + if (pCriteria.getOperation().compareTo("in") == 0) { + // + if (pType.getName().compareTo("java.lang.String") == 0) { + String val = (String) pCriteria.getValue(); + StringTokenizer st = new StringTokenizer(val, ","); + List param = new ArrayList(); + while (st.hasMoreElements()) { + String object = (String) st.nextElement(); + param.add(object.substring(1, (object.length() - 1))); + } + return prop.in(param); + } else if (pType.getName().compareTo("java.lang.Integer") == 0) { + String val = (String) pCriteria.getValue(); + StringTokenizer st = new StringTokenizer(val, ","); + List param = new ArrayList(); + while (st.hasMoreElements()) { + String object = (String) st.nextElement(); + if (object.startsWith("'") || object.startsWith("\"")) { + object = object.substring(1, (object.length() - 1)); + } + param.add(Integer.parseInt(object)); + } + return prop.in(param); + } else { + return prop.in((Collection) pCriteria.getValue()); + } + + } + if (pCriteria.getOperation().compareTo("between") == 0) { + Object[] param = ((Collection) pCriteria.getValue()).toArray(); + return prop.between(param[0], param[1]); + } + if (pCriteria.getOperation().compareTo("sql") == 0) { + return Restrictions.sqlRestriction((String) value); + } + throw new CommondbException("QRY001", "OPERADOR {0} NO DISPONIBLE", pCriteria.getOperation()); + } + + /** + * Metodo que crea un objeto de tipo beanname asociado al QueryBean. + * @param pQueryBean Datos del QueryBean + * @return Object + */ + private Object createObject(QueryBean pQueryBean) { + try { + HibernateBean obj = (HibernateBean) Class.forName(pQueryBean.getBeanName()).newInstance(); + try { + Object id = BeanManager.getBeanAttributeValue(obj, "pk"); + if (id == null) { + Object key = Class.forName(pQueryBean.getBeanName() + "Key").newInstance(); + BeanManager.setBeanAttributeValue(obj, "pk", key); + } + } catch (Exception e) { + return obj; + } + return obj; + + } catch (Exception e) { + return null; + } + } + + /** + * Metodo que se encarga de completar descripciones de catalogo. + * @param pObject Objeto al cual se completa las descripciones de catalogo. + * @param nameAttributes Arreglo con los nombres de catalogo a buscar descripciones ejemlo + * [baserate,calculationbase] + * @throws Exception + */ + private void completeDescriptionCatalog(AbstractDataTransport pObject, String[] nameAttributes) throws Exception { + if (nameAttributes == null) { + return; + } + for (int i = 0; i < nameAttributes.length; i++) { + if (nameAttributes[i].startsWith("pk_")) { + nameAttributes[i] = nameAttributes[i].replaceAll("_", "."); + } + String descCatalog = "catalog"; + String descCatalogCode = "catalogcode"; + if (nameAttributes[i].compareTo("pk.catalog") == 0 || nameAttributes[i].compareTo("catalog") == 0) { + descCatalog = ""; + descCatalogCode = "code"; + } + if (pObject == null) { + break; + } + String catalog = (String) BeanManager.getBeanAttributeValue(pObject, nameAttributes[i] + descCatalog); + String catalogcode = (String) BeanManager.getBeanAttributeValue(pObject, nameAttributes[i] + descCatalogCode); + String nameNewAtribute = nameAttributes[i] + "desc"; + if (nameNewAtribute.startsWith("pk.")) { + nameNewAtribute = nameNewAtribute.substring(3, nameNewAtribute.length()); + } + if (catalog != null && catalogcode != null) { + TgeneCatalogDetail detail = DataHelper.getInstance().getTgeneCatalogDetail(catalog, catalogcode); + pObject.addAddtionalInfo(nameNewAtribute, detail.getDescription()); + } else { + pObject.addAddtionalInfo(nameNewAtribute, null); + } + } + } +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/query/QueryHelper.java b/base/core/bpm/src/main/java/com/fp/bpm/query/QueryHelper.java new file mode 100644 index 0000000..a63d0ef --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/query/QueryHelper.java @@ -0,0 +1,333 @@ +package com.fp.bpm.query; + +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.persistence.NoResultException; +import javax.persistence.NonUniqueResultException; +import javax.persistence.Query; + +import com.fp.common.helper.BeanManager; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.query.AdditionalQuery; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.db.DataHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase utilitaria utiliza en el motor generico de consultas. + * @author Jorge Vaca. + * @version 2.1 + */ +public class QueryHelper { // NOPMD by jorge on 12/10/10 21:53 + + /**Almacena la senetencia dinamica de consulta.*/ + protected StringBuffer query = new StringBuffer(64); // NOPMD by jorge on 12/10/10 21:53 + /**Map que almacen los parametros o restricciones para cada consulta asociada a un Query.*/ + protected Map mParameters; + + /** + * Metodo que se encarga de adicionar a la sentencia las restricciones del query. + * @param pCriteria Objeto que contiene los criterios a aplicar en la sentencia. + * @param pType Tipo de dato del campo al cual se aplica la restriccion. + * @throws CommondbException + * @throws Exception + */ + @SuppressWarnings("rawtypes") + protected void addRestrictions(QueryCriteria pCriteria, Class pType) throws CommondbException,Exception { // NOPMD by jorge on 12/10/10 21:51 + String field = pCriteria.getProperty(); + String condition = pCriteria.getOperation(); + Object value = pCriteria.getValue(); + try { + value = BeanManager.convertObject(pCriteria.getValue(), pType); + } catch (Exception e) { + } + + if (this.basic(condition)) { + String aux = field.substring(field.indexOf(".") + 1,field.length()); // NOPMD by jorge on 12/10/10 21:52 + aux = this.getAux(aux); + query.append("t."+field+" "+condition+" "+":"+aux); + mParameters.put(aux, value); + return; + } + if (condition.compareTo("isNull") == 0 || condition.compareTo("isNotNull") == 0 ) { + query.append("t."+field+" is null "); + return; + } + if ( condition.compareTo("isNotNull") == 0 ) { + query.append("t."+field+" is not null "); + return; + } + if (condition.compareTo("sql") == 0) { + query.append(value); + return; + } + if (condition.compareTo("in") == 0 || condition.compareTo("not in") == 0) { + query.append("t."+field+" "+condition+"("+value+")"); + return; + } + if (pCriteria.getOperation().compareTo("between") == 0) { + Object[] param = ((Collection) pCriteria.getValue()).toArray(); + query.append("t."+field+" "+condition+" "+param[0] +" and "+param[1]); + return; + } + throw new CommondbException("QRY001", "OPERADOR {0} NO DISPONIBLE", pCriteria.getOperation()); + } + + /** + * Metodo que adiciona un numero secuencial si el campo de la restriccion se repite en la sentencia. + * @param pAux Parametro de la sentencia. + * @return String + * @throws Exception + */ + private String getAux(String pAux) throws Exception { + if(!mParameters.containsKey(pAux)){ + return pAux; + } + Set s = mParameters.keySet(); + int i = 0; + for (String obj : s) { + if(!obj.contains("AAA")){ + continue; + } + String data = obj.substring(obj.indexOf("AAA"),obj.length()); + data = data.substring(3, data.length()); + i = Integer.valueOf(data); + ++i; + } + return pAux+"AAA"+i; + } + + /** + * Metodo que se encarga de adicionar a la senetencia los criterios de orden de la consulta. + * @param pQueryBean Objeto que contiene el bean a consultas, y las restricciones. + * @throws Exception + */ + protected void addOrder(QueryBean pQueryBean) throws Exception { + boolean first = true; + for (QueryCriteria order : pQueryBean.getOrder(true)) { + if(first){ + query.append(" ORDER BY "); + }else{ + query.append(" ,"); + } + query.append("t."+order.getProperty()+" asc "); + first = false; + } + for (QueryCriteria order : pQueryBean.getOrder(false)) { + if(first){ + query.append(" ORDER BY "); + }else{ + query.append(" ,"); + } + query.append("t."+order.getProperty()+" desc "); + first = false; + } + } + + + + /** + * Metodo que crea un objeto de tipo beanname asociado al QueryBean. + * @param pQueryBean Objeto que contiene el bean a consultas, y las restricciones. + * @return Object + */ + protected Object createObject(QueryBean pQueryBean) { + try { + HibernateBean obj = (HibernateBean) Class.forName(pQueryBean.getBeanName()).newInstance(); + try { + Object id = BeanManager.getBeanAttributeValue(obj, "pk"); + if (id == null) { + Object key = Class.forName(pQueryBean.getBeanName() + "Key").newInstance(); + BeanManager.setBeanAttributeValue(obj, "pk", key); + } + } catch (Exception e) { + return obj; + } + return obj; + + } catch (Exception e) { + return null; + } + } + + /** + * Metodo que transforma los campos de un registro a un AbstractDataTransport. + * @param pRecord Datos de un registro obtenidos de la base de datos. + * @param nameAttributes Atributos adicionales con los cuales se completa la descripcion del catalogo. + * @return Object. + * @throws Exception + */ + protected AbstractDataTransport fillRecord(QueryBean pQueryBean,Object pRecord, String[] nameAttributes) throws Exception { + if (pRecord == null) { + return null; + } + AbstractDataTransport obj = (AbstractDataTransport) pRecord; + this.completeDescriptionCatalog(obj, nameAttributes); + this.addAditionData(pQueryBean, obj); + return obj; + + } + + /** + * Metodo que se encarga de completar descripciones de catalogo. + * @param pObject Objeto al cual se completa las descripciones de catalogo. + * @param nameAttributes Arreglo con los nombres de catalogo a buscar descripciones ejemlo + * [baserate,calculationbase] + * @throws Exception + */ + protected void completeDescriptionCatalog(AbstractDataTransport pObject, String[] nameAttributes) throws Exception { // NOPMD by jorge on 12/10/10 21:53 + if (nameAttributes == null) { + return; + } + for (int i = 0; i < nameAttributes.length; i++) { + if (nameAttributes[i].startsWith("pk_")) { + nameAttributes[i] = nameAttributes[i].replaceAll("_", "."); + } + String descCatalog = "catalog"; + String descCatalogCode = "catalogcode"; + if (nameAttributes[i].compareTo("pk.catalog") == 0 || nameAttributes[i].compareTo("catalog") == 0) { + descCatalog = ""; + descCatalogCode = "code"; + } + if (pObject == null) { + break; + } + String catalog = (String) BeanManager.getBeanAttributeValue(pObject, nameAttributes[i] + descCatalog); + String catalogcode = (String) BeanManager.getBeanAttributeValue(pObject, nameAttributes[i] + descCatalogCode); + String nameNewAtribute = nameAttributes[i] + "desc"; + if (nameNewAtribute.startsWith("pk.")) { + nameNewAtribute = nameNewAtribute.substring(3, nameNewAtribute.length()); + } + if (catalog != null && catalogcode != null) { + TgeneCatalogDetail detail = DataHelper.getInstance().getTgeneCatalogDetail(catalog, catalogcode); + pObject.addAddtionalInfo(nameNewAtribute, detail.getDescription()); + } else { + pObject.addAddtionalInfo(nameNewAtribute, null); + } + } + } + + /** + * Metodo que verifica que la condicion de la restriccion sea basica. + * @param pCondition Codigo de condicion de la restriccion. + * @return boolean + * @throws Exception + */ + protected boolean basic(String pCondition) throws Exception { + if (pCondition.compareTo("<") == 0) { + return true; + } + if (pCondition.compareTo(">") == 0) { + return true; + } + if (pCondition.compareTo("<=") == 0) { + return true; + } + if (pCondition.compareTo(">=") == 0) { + return true; + } + if (pCondition.compareTo("=") == 0) { + return true; + } + if (pCondition.compareTo("<>") == 0) { + return true; + } + if (pCondition.compareTo("like") == 0) { + return true; + } + return false; + } + + /** + * Metodo que se encarga de ejecutar sentencias que completan informacion de la consulta asociada al QueryBean. + * @param pQueryBean Objeto que contiene el bean a consultas, y las restricciones. + * @param pObject Objeto que contiene la datos resultado del query del bean principal de la consulta. + * @throws Exception + */ + protected void addAditionData(QueryBean pQueryBean,AbstractDataTransport pObject) throws Exception { + List lData = pQueryBean.getAdditionalQuery(); + if(lData == null || lData.isEmpty()){ + return; + } + for (AdditionalQuery additionalQuery : lData) { + this.processByAditionalQuery(additionalQuery, pObject); + } + } + + /** + * Metodo que ejecuta sentecias por cada AdditionalQuery, que llega como parametro.
+ * Los valores de la restriccion los toma del resultado del bean principal. + * @param pAdditional Objeto que contiene las consideraciones necesarias para armar una consula adiciona de datos. + * @param pObject Objeto que contiene la datos resultado del query del bean principal de la consulta. + * @throws Exception + */ + @SuppressWarnings("rawtypes") + private void processByAditionalQuery(AdditionalQuery pAdditional,AbstractDataTransport pObject) throws Exception { // NOPMD by jorge on 12/10/10 21:52 + if(pObject == null){ + return; + } + StringBuffer query = new StringBuffer(); // NOPMD by jorge on 12/10/10 21:52 + query.append("select t."+pAdditional.getField()+" from "+pAdditional.getBean()+" t "); + List> lCriteria = pAdditional.getCriteria(); + mParameters.clear(); + boolean first = true; + boolean execute = true; + for (Map map : lCriteria) { + if(first){ + query.append(" WHERE "); + first = false; + }else{ + query.append(" AND "); + } + String aux = map.get("inner").substring(map.get("inner").indexOf(".") + 1,map.get("inner").length()); // NOPMD by jorge on 12/10/10 21:52 + query.append("t."+map.get("inner")+" = "+":"+aux); + Object value = map.get("value"); + if(value == null){ + Class type = null; + try { + type = BeanManager.getBeanGetterMethod(pObject, map.get("outer")).getReturnType(); + } catch (Exception e1) { + } + String aux1 = map.get("outer"); //Si es pk simple llega pk, si es compuesta llega pk.campo + value = BeanManager.getBeanAttributeValue(pObject, aux1); + if(value == null){ + execute = false; //Si no encuentra valor en la tabla padre no ejecuta el query. + break; + } + if(type != null){ + value = BeanManager.convertObject(value, type); + } + } + mParameters.put(aux, value); + } + if(!execute){ + pObject.addAddtionalInfo(pAdditional.getAlias(), null); + return; + } + Query qry = PersistenceHelper.getEntityManager().createQuery(query.toString()); + Iterator itr = mParameters.keySet().iterator(); + while(itr.hasNext()){ + String key = itr.next(); + qry.setParameter(key, mParameters.get(key)); + } + try { + Object result = qry.getSingleResult(); + pObject.addAddtionalInfo(pAdditional.getAlias(), result); + } catch (NoResultException e) { + pObject.addAddtionalInfo(pAdditional.getAlias(), null); + } catch (NonUniqueResultException e) { + throw new CommondbException("COMMONDB-00015","EXISTE MAS DE UN REGISTRO PARA LA TABAL: {0}", e,pAdditional.getBean()); + } + + + } + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/query/QueryJsf.java b/base/core/bpm/src/main/java/com/fp/bpm/query/QueryJsf.java new file mode 100644 index 0000000..c0ca051 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/query/QueryJsf.java @@ -0,0 +1,249 @@ +package com.fp.bpm.query; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.persistence.NoResultException; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.query.SubQuery; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; + +/** + * Clase que se encarga de realizar consultas genericas a la base de datos. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class QueryJsf { + /** Map con el orden campos a aplicar a la consulta */ + protected final Map mparameter = new HashMap(); + + /** Parte de la setencia que tiene la instruccion for de la cosnualta. */ + private StringBuffer sql; + + /** Almacena las restriciones de la consulta. */ + protected StringBuffer where; + + private boolean issubquery = false; + + /** + * Metodo que se encarga de realizar consulta de tablas que llegan en el request.
+ * La cosnsulta se ejecuta por tabla. + * + * @param queryRequest Request de consultya que almacena la lista de tablas a consultar. + * @throws Exception + */ + public void execute(QueryRequest queryRequest) throws Exception { + Map mtablas = queryRequest.getQueryTables(); + if (mtablas == null) { + return; + } + Set s = mtablas.keySet(); + for (String key : s) { + // Crea nuevos objetos por cada tabla que se consulta. + sql = new StringBuffer(46); + where = new StringBuffer(46); + mparameter.clear(); + issubquery = false; + // Ejecuta consulta de la tabla. + DtoQuery dtoqry = mtablas.get(key); + if (dtoqry.getBeanname() == null) { + continue; + } + Object resp = queryByBean(dtoqry); + queryRequest.getResponse().put(key, resp); + + } + } + + private Object queryByBean(DtoQuery dtoquey) throws Exception { + buildSentence(dtoquey); + APPLogger.getLogger().debug(sql); + return executeByDtoQuery(dtoquey); + } + + private void buildSentence(DtoQuery dtoquery) throws Exception { + buildSql(dtoquery); + buildCriteria(dtoquery); + sql.append(where); + if (dtoquery.getOrderby() != null) { + sql.append(" order by " + dtoquery.getOrderby()); + } + } + + private Object executeByDtoQuery(DtoQuery dtoquery) throws Exception { + if (dtoquery.isMultirecord()) { + List lresp = queryList(dtoquery); + if (issubquery) { + return buildlistresponse(dtoquery, lresp); + } else { + return lresp; + } + } + Object resp = queryObject(dtoquery); + if ((resp != null) && issubquery) { + return buildobjectresponse(dtoquery, resp); + } + return resp; + } + + private Object buildobjectresponse(DtoQuery dtoquery, Object object) throws Exception { + List lsubquery = dtoquery.getlSubquery(); + Object[] obj = (Object[]) object; + AbstractDataTransport bean = (AbstractDataTransport) obj[0]; + for (int i = 1; i <= lsubquery.size(); i++) { + SubQuery s = lsubquery.get(i - 1); + Object valor = obj[i]; + bean.put(s.getAlias(), valor); + } + return bean; + } + + private Object buildlistresponse(DtoQuery dtoquery, List lresp) throws Exception { + List l = new ArrayList(); + List lsubquery = dtoquery.getlSubquery(); + for (Object object : lresp) { + Object[] obj = (Object[]) object; + AbstractDataTransport bean = (AbstractDataTransport) obj[0]; + for (int i = 1; i <= lsubquery.size(); i++) { + SubQuery s = lsubquery.get(i - 1); + Object valor = obj[i]; + bean.put(s.getAlias(), valor); + } + l.add(bean); + } + return l; + } + + /** + * Metodo que se encarga de construir y adicionar campos a consultar de una tabla. + * + * @throws Exception + */ + protected void buildSql(DtoQuery dtoquery) throws Exception { + sql.append("select t "); + List lsubquery = dtoquery.getlSubquery(); + for (SubQuery subQuery : lsubquery) { + issubquery = true; + sql.append("," + subQuery.getSubQuery()); + } + // Adiciona subqueries. + sql.append(" from " + dtoquery.getBeanname() + " t"); + + } + + protected void buildCriteria(DtoQuery dtoquery) throws Exception { + List lfiltro = dtoquery.getLfilter(); + if ((lfiltro == null) || lfiltro.isEmpty()) { + return; + } + boolean first = true; + for (Filter filtro : lfiltro) { + if (filtro.getSql() != null) { + this.addFiltersql(filtro.getSql(), first); + continue; + } + if (filtro.getValue() == null) { + continue; + } + addFilter(dtoquery.getBeanname(), filtro, first); + first = false; + } + } + + private void addFilter(String bean, Filter filtro, boolean first) throws Exception { + Object valor = filtro.getValue(); + String campo = filtro.getField(); + String condicion = filtro.getCondition() == null ? "=" : filtro.getCondition(); + valor = PersistenceManager.changeType(bean, campo, valor); + if (String.valueOf(valor).indexOf("%") >= 0) { + condicion = "like"; + } + String aux = campo.substring(campo.indexOf(".") + 1, campo.length()); + String cond = "t." + campo + " " + condicion + " " + ":" + aux; + mparameter.put(aux, valor); + if (where == null) { + where = new StringBuffer(46); + } + if (first) { + where.append(" where " + cond); + } else { + where.append(" and " + cond); + } + } + + private void addFiltersql(String sql, boolean first) throws Exception { + if (first) { + where.append(" where " + sql); + } else { + where.append(" and " + sql); + } + } + + /** + * Metodo que entrega una lista de objetos relacionados a la tabla que se consulta. + * + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + private List queryList(DtoQuery dtoquery) throws Exception { + javax.persistence.Query query = createQuery(dtoquery); + return query.getResultList(); + } + + /** + * Metodo que entrega un objeto, de una tabla relacionado a la consulta. + * + * @return Object. + * @throws Exception + */ + private Object queryObject(DtoQuery dtoquery) throws Exception { + Object obj = null; + javax.persistence.Query query = createQuery(dtoquery); + try { + obj = query.getSingleResult(); + } catch (NoResultException e) { + // Si no existe datos no hacer nada. + } + return obj; + } + + private javax.persistence.Query createQuery(DtoQuery dtoquery) throws Exception { + javax.persistence.Query query = PersistenceHelper.getEntityManager().createQuery(sql.toString()); + this.setParameters(dtoquery, query); + return query; + } + + /** + * Fija parametros, primer registro y ultimo registro de comsulta. + * + * @param dtoquery + * @param qry + * @throws Exception + */ + public void setParameters(DtoQuery dtoquery, javax.persistence.Query qry) throws Exception { + Integer pagina = dtoquery.getPage(); + Integer numreg = dtoquery.getRecperpage() == null ? 10 : dtoquery.getRecperpage(); + // Control de paginacion. + if (dtoquery.isMultirecord()) { + qry.setFirstResult(pagina); + qry.setMaxResults(numreg); + } + // Fija parametros a la sentencia + Set s = mparameter.keySet(); + for (String key : s) { + Object valor = mparameter.get(key); + qry.setParameter(key, valor); + } + } +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/query/QueryOperation.java b/base/core/bpm/src/main/java/com/fp/bpm/query/QueryOperation.java new file mode 100644 index 0000000..a5a3cf3 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/query/QueryOperation.java @@ -0,0 +1,5 @@ +package com.fp.bpm.query; + +public interface QueryOperation { + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/query/QueryProcessCriteria.java b/base/core/bpm/src/main/java/com/fp/bpm/query/QueryProcessCriteria.java new file mode 100644 index 0000000..421e777 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/query/QueryProcessCriteria.java @@ -0,0 +1,143 @@ +package com.fp.bpm.query; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.Criteria; +import org.hibernate.ScrollMode; +import org.hibernate.ScrollableResults; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Property; +import org.hibernate.criterion.Restrictions; + +import com.fp.common.helper.BeanManager; +import com.fp.dto.Response; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; +import com.fp.dto.query.QueryRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; + +public class QueryProcessCriteria { + public QueryProcessCriteria() { + } + + public boolean process(QueryRequest pReq, Response pRes) throws CommondbException, ClassNotFoundException, InstantiationException, IllegalAccessException { + Map bean = pReq.getBeans(); + for (String k : bean.keySet()) { + QueryBean qbean = bean.get(k); + pRes.put(k, this.process(qbean)); + } + return true; + } + + private Object process(QueryBean pQuery) throws CommondbException, ClassNotFoundException, InstantiationException, IllegalAccessException { + Criteria cri = this.prepareCriteria(pQuery); + return this.fillData(cri, pQuery.isMultirecord()); + } + + private Object fillData(Criteria pCriteria, boolean pMultirecord) { + + if (pMultirecord) { + List data = new ArrayList(); + ScrollableResults scroll = pCriteria.scroll(ScrollMode.FORWARD_ONLY); + while (scroll.next()) { + data.add(this.fillRecord(scroll.get())); + } + return data; + } else { + return pCriteria.uniqueResult(); + } + + } + + private Object fillRecord(Object[] pRecord) { + if (pRecord == null) { + return null; + } + if (pRecord.length == 1) { + return pRecord[0]; + } else { + Map m = new HashMap(); + return m; + } + } + + @SuppressWarnings("unchecked") + private Criteria prepareCriteria(QueryBean pQuery) throws CommondbException, ClassNotFoundException, InstantiationException, IllegalAccessException { + Object beanReference=Class.forName(pQuery.getBeanName()).newInstance(); + Criteria c = PersistenceHelper.getSession().createCriteria(pQuery.getBeanName()); + + for (QueryCriteria criteria : pQuery.getCriteria()) { + Class type=null; + try{ + type=BeanManager.getBeanGetterMethod(beanReference, criteria.getProperty()).getReturnType(); + }catch(Exception e1){ + } + c.add(this.prepareCriterion(criteria,type)); + } + for (QueryCriteria order : pQuery.getOrder(true)) { + c.addOrder(Order.asc(order.getProperty())); + } + for (QueryCriteria order : pQuery.getOrder(false)) { + c.addOrder(Order.desc(order.getProperty())); + } + if (pQuery.getPage() > 0 && pQuery.getPageSize() > 0) { + c.setMaxResults(pQuery.getPageSize()); + c.setFirstResult((pQuery.getPage() - 1) * pQuery.getPageSize()); + } + + return c; + } + + @SuppressWarnings("unchecked") + private Criterion prepareCriterion(QueryCriteria pCriteria,Class pType) throws CommondbException { + Property prop = Property.forName(pCriteria.getProperty()); + Object value=pCriteria.getValue(); + try{ + value=BeanManager.convertObject(pCriteria.getValue(),pType); + }catch(Exception e){} + if (pCriteria.getOperation().compareTo("<") == 0) { + return prop.lt(value); + } + if (pCriteria.getOperation().compareTo(">") == 0) { + return prop.gt(value); + } + if (pCriteria.getOperation().compareTo("<=") == 0) { + return prop.le(value); + } + if (pCriteria.getOperation().compareTo(">=") == 0) { + return prop.ge(value); + } + if (pCriteria.getOperation().compareTo("=") == 0) { + return prop.eq(value); + } + if (pCriteria.getOperation().compareTo("<>") == 0) { + return prop.ne(value); + } + if (pCriteria.getOperation().compareTo("like") == 0) { + return prop.like(value); + } + if (pCriteria.getOperation().compareTo("isNull") == 0) { + return prop.isNull(); + } + if (pCriteria.getOperation().compareTo("isNotNull") == 0) { + return prop.isNotNull(); + } + if (pCriteria.getOperation().compareTo("in") == 0) { + return prop.in((Collection) pCriteria.getValue()); + } + if (pCriteria.getOperation().compareTo("between") == 0) { + Object[] param = ((Collection) pCriteria.getValue()).toArray(); + return prop.between(param[0], param[1]); + } + if (pCriteria.getOperation().compareTo("sql") == 0) { + return Restrictions.sqlRestriction((String) value); + } + throw new CommondbException("QRY001", "OPERADOR {0} NO DISPONIBLE", pCriteria.getOperation()); + } +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/query/QueryProcessor.java b/base/core/bpm/src/main/java/com/fp/bpm/query/QueryProcessor.java new file mode 100644 index 0000000..62d0d8e --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/query/QueryProcessor.java @@ -0,0 +1,188 @@ +package com.fp.bpm.query; + +import java.util.List; +import java.util.Map; + +import com.fp.common.exception.CommonException; +import com.fp.common.exception.SavePointException; +import com.fp.common.logger.APPLogger; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.dto.rules.TransactionRule; +import com.fp.persistence.commondb.db.DataHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.pgeneral.gene.TgeneQueryProcess; +import com.fp.persistence.pgeneral.gene.TgeneTransactionQuery; + +/** + * Motor de consultas, el proceso se ejecuta de acuerodo a querytype.
+ * + * @author Jorge Vaca + * @version 2.1 + */ +public class QueryProcessor { + + /** Objeto con beans utilizados en el proceso de consulta. */ + private QueryRequest queryRequest; + + /** + * Metodo que se encarga de ejecutar consultas contra la base de datos, adicionalmente ejecuta consultas especiales + * si estas estarian parametrizadas. Proceso tipo de consulta.
+ * "P" Ejecuta consulta por reglas asociadas a un codigo de consulta. "T" Ejecuta consulta por reglas asociadas a la + * transaccion. "N" Ejecuta consultas genericas. + * + * @param pQueryRequest Objeto con beans utilizados en el proceso de consulta. + * @param pResponse Objeto en el cual se alamcena la respuesta de una transaccion. + * @return boolean + * @throws CommondbException + * @throws Exception + */ + public boolean process(QueryRequest pQueryRequest) throws CommondbException, Exception { + Thread.currentThread().setName(pQueryRequest.getJournalId()); + this.queryRequest = pQueryRequest; + String queryType = (String) pQueryRequest.get("querytype"); + + if ((queryType == null) || (queryType.compareTo("N") == 0)) { + if(!pQueryRequest.isJsf()){ + Query qry = new Query(); + qry.process(pQueryRequest); + }else{ + QueryJsf qry = new QueryJsf(); + qry.execute(pQueryRequest); + } + + } + // Ejecuta consultas especiales para una transaccion. + if ((queryType != null) && (queryType.compareTo("T") == 0)) { + this.processByTransaction(); + } + // Ejecuta consultas especiales para un codigo de query. + if ((queryType == null) || (queryType.compareTo("P") == 0)) { + // Si es null entra el contro esta en el metodo interno + this.processQueryByAlias(); + } + return true; + } + + /** + * Metodo que se encarga de ejecutar comandos especiales de consulta por queryalias. + * + * @param pQueryRequest Objeto con beans utilizados en el proceso de consulta. + * @param pResponse Objeto que contiene los datos de respuesta de la consulta. + * @throws Exception + */ + public void processQueryByAlias() throws Exception { + Map bean = this.queryRequest.getBeans(); + for (String k : bean.keySet()) { + QueryBean qbean = bean.get(k); + if (qbean.getQueryalias() != null) { + this.processByQueryCode(qbean.getQueryalias()); + } + } + String queryalias = (String) this.queryRequest.get("queryalias"); + if (queryalias != null) { + this.processByQueryCode(queryalias); + } + } + + /** + * Fija un nuevo valor en queryRequest + * + * @param pQueryRequest nuevo valor para queryRequest + */ + public void setQueryRequest(QueryRequest pQueryRequest) { + this.queryRequest = pQueryRequest; + } + + /** + * Metodo que se encarga de ejecutar procesos especiales de consulta por codigo de consulta. + * + * @param pQueryRequest Objeto con beans utilizados en el proceso de consulta. + * @param pQueryCode Codigo de consulta. + * @throws Exception + */ + private void processByQueryCode(String pQueryCode) throws Exception { + List lprocess = DataHelper.getInstance().getTgeneQueryProcess(pQueryCode); + if (lprocess == null) { + return; + } + for (TgeneQueryProcess obj : lprocess) { + this.processByCode(obj.getProcesscode(), pQueryCode); + } + } + + /** + * + * @param pResponse Objeto con beans utilizados en el proceso de consulta. + * @param pProcess Codigo de proceso a ejecutar. + * @param pQueryCode Codigo de consulta. + * @throws Exception + */ + private void processByCode(String pProcess, String pQueryCode) throws Exception { + QueryRule rule = null; + try { + rule = (QueryRule) Class.forName(pProcess).newInstance(); + } catch (ClassNotFoundException e) { + throw new CommonException("COMMON-0012", "CLASE {0} A EJECUTAR NO EXISTE CODE: {0}", e, pQueryCode); + } catch (ClassCastException e) { + throw new CommonException("COMMON-0013", "PROCESO {0} A EJECUTAR CODE: {1} NO IMPLEMENTA QUERYRULE", e, pProcess, pQueryCode); + } + APPLogger.getLogger().info("INICIO ==> " + rule); + rule.process(this.queryRequest); + APPLogger.getLogger().info("FIN ==> " + rule); + } + + /** + * Metodo que ejecuta procesos especiales de consulta por transaccion. + * + * @param pQueryRequest Objeto con beans utilizados en el proceso de consulta. + * @throws Exception + */ + private void processByTransaction() throws Exception { + if ((this.queryRequest.getTransactionModule() == null) || (this.queryRequest.getTransactionCode() == null)) { + return; + } + List lquery = DataHelper.getInstance().getTgeneTransactionQuery(this.queryRequest.getTransactionModule(), + this.queryRequest.getTransactionCode(), this.queryRequest.getTransactionVersion()); + if (lquery == null) { + return; + } + for (TgeneTransactionQuery obj : lquery) { + try { + this.processByTransactionRule(obj); + } catch (SavePointException e) { + // Detiene la ejecucion de componentes de negocio y graba la transaccion. + break; + } + + } + } + + /** + * Metodo encargado de ejecutar cada una de las reglas definidas en la transaccion. + * + * @param pSaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @param pProcess Objeto que contiene la regla a ejecutar. + * @throws Exception + */ + private void processByTransactionRule(TgeneTransactionQuery pQuery) throws Exception { + QueryRule rule = null; + try { + rule = (QueryRule) Class.forName(pQuery.getProcesscode()).newInstance(); + } catch (ClassNotFoundException e) { + throw new CommonException("COMMON-0014", "CLASE {0} A EJECUTAR NO EXISTE MODULE: {1} TRANS: {2} VERSION {3}", e, + pQuery.getProcesscode(), this.queryRequest.getTransactionModule(), this.queryRequest.getTransactionCode(), + this.queryRequest.getTransactionVersion()); + } catch (ClassCastException e) { + throw new CommonException("COMMON-0015", "PROCESO {0} A EJECUTAR MODULE: {1} TRANS: {2} VERSION {3} NO IMPLEMENTA {4}", e, + pQuery.getProcesscode(), this.queryRequest.getTransactionModule(), this.queryRequest.getTransactionCode(), + this.queryRequest.getTransactionVersion(), TransactionRule.class.getName()); + } + rule.setFlow(pQuery.getProcessname()); + rule.setRule(pQuery.getRulename()); + APPLogger.getLogger().info("INICIO ==> " + rule); + rule.process(this.queryRequest); + APPLogger.getLogger().info("FIN ==> " + rule); + } +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/query/menu/.svn/entries b/base/core/bpm/src/main/java/com/fp/bpm/query/menu/.svn/entries new file mode 100644 index 0000000..5646017 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/query/menu/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/bpm/src/main/java/com/fp/bpm/query/menu +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +Menu.java +file + + + + +2022-07-28T03:40:38.310784Z +843f86d73d918de4f7c439f12b40b29f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +207 + diff --git a/base/core/bpm/src/main/java/com/fp/bpm/query/menu/.svn/text-base/Menu.java.svn-base b/base/core/bpm/src/main/java/com/fp/bpm/query/menu/.svn/text-base/Menu.java.svn-base new file mode 100644 index 0000000..fa0f6b4 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/query/menu/.svn/text-base/Menu.java.svn-base @@ -0,0 +1,16 @@ +package com.fp.bpm.query.menu; + + + +import com.fp.dto.Response; +import com.fp.dto.query.menu.MenuRequest; + +public class Menu { + + + public boolean process(MenuRequest pReq, Response pRes){ + + return true; + } + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/query/menu/Menu.java b/base/core/bpm/src/main/java/com/fp/bpm/query/menu/Menu.java new file mode 100644 index 0000000..fa0f6b4 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/query/menu/Menu.java @@ -0,0 +1,16 @@ +package com.fp.bpm.query.menu; + + + +import com.fp.dto.Response; +import com.fp.dto.query.menu.MenuRequest; + +public class Menu { + + + public boolean process(MenuRequest pReq, Response pRes){ + + return true; + } + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/report/.svn/entries b/base/core/bpm/src/main/java/com/fp/bpm/report/.svn/entries new file mode 100644 index 0000000..6fa4d7f --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/report/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/bpm/src/main/java/com/fp/bpm/report +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ReportProcessor.java +file + + + + +2022-07-28T03:40:38.391784Z +370e03fd0fca3ea801db0fa7c42c1ebc +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3218 + +ReportOperation.java +file + + + + +2022-07-28T03:40:38.391784Z +c63a135ff5b569d9a1973b4fc96227f4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +172 + diff --git a/base/core/bpm/src/main/java/com/fp/bpm/report/.svn/text-base/ReportOperation.java.svn-base b/base/core/bpm/src/main/java/com/fp/bpm/report/.svn/text-base/ReportOperation.java.svn-base new file mode 100644 index 0000000..19d2b4f --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/report/.svn/text-base/ReportOperation.java.svn-base @@ -0,0 +1,10 @@ +package com.fp.bpm.report; + +/** + * Interface de operaciones asociadas a reportes. + * @author Jorge Vaca + * @version 2.1 + */ +public interface ReportOperation { + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/report/.svn/text-base/ReportProcessor.java.svn-base b/base/core/bpm/src/main/java/com/fp/bpm/report/.svn/text-base/ReportProcessor.java.svn-base new file mode 100644 index 0000000..447454a --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/report/.svn/text-base/ReportProcessor.java.svn-base @@ -0,0 +1,72 @@ +package com.fp.bpm.report; + +import java.util.List; + +import com.fp.common.exception.CommonException; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.ReportRule; +import com.fp.dto.rules.TransactionRule; +import com.fp.persistence.commondb.db.DataHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.pgeneral.trans.report.TgeneTransactionReports; + +public class ReportProcessor { + + /**Objeto con beans utilizados en el proceso de consulta.*/ + private QueryRequest queryRequest; + + /** + * Metodo que se encarga de llenar tablas utilizadas en la generacion de reportes. + * @param pQueryRequest Datos utilizados en la generacion de reportes. + * @return boolean + * @throws CommondbException + * @throws Exception + */ + public boolean process(QueryRequest pQueryRequest) throws CommondbException, Exception { + Thread.currentThread().setName(pQueryRequest.getJournalId()); + queryRequest = pQueryRequest; + //Ejecuta consultas especiales para una transaccion. + this.processByTransaction(); + return true; + } + + /** + * Metodo que ejecuta procesos especiales de consulta por transaccion. + * @param pQueryRequest Objeto con beans utilizados en el proceso de consulta. + * @throws Exception + */ + private void processByTransaction() throws Exception { + if (queryRequest.getTransactionModule() == null || queryRequest.getTransactionCode() == null) { + return; + } + List lquery = DataHelper.getInstance().getTgeneTransactionReports( + queryRequest.getTransactionModule(), queryRequest.getTransactionCode(), queryRequest.getTransactionVersion()); + if (lquery == null) { + return; + } + for (TgeneTransactionReports obj : lquery) { + this.processByTransactionRule(obj); + } + } + + /** + * Metodo encargado de ejecutar cada una de las reglas definidas en la transaccion. + * @param pSaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @param pProcess Objeto que contiene la regla a ejecutar. + * @throws Exception + */ + private void processByTransactionRule(TgeneTransactionReports pObj) throws Exception { + ReportRule rule = null; + try { + rule = (ReportRule) Class.forName(pObj.getProcesscode()).newInstance(); + } catch (ClassNotFoundException e) { + throw new CommonException("COMMON-0014", "CLASE {0} A EJECUTAR NO EXISTE MODULE: {1} TRANS: {2} VERSION {3}", e, pObj.getProcesscode(), + queryRequest.getTransactionModule(), queryRequest.getTransactionCode(), queryRequest.getTransactionVersion()); + } catch (ClassCastException e) { + throw new CommonException("COMMON-0015", "PROCESO {0} A EJECUTAR MODULE: {1} TRANS: {2} VERSION {3} NO IMPLEMENTA {4}", e, pObj.getProcesscode(), + queryRequest.getTransactionModule(), queryRequest.getTransactionCode(), queryRequest.getTransactionVersion(), TransactionRule.class.getName()); + } + rule.process(queryRequest); + } + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/report/ReportOperation.java b/base/core/bpm/src/main/java/com/fp/bpm/report/ReportOperation.java new file mode 100644 index 0000000..19d2b4f --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/report/ReportOperation.java @@ -0,0 +1,10 @@ +package com.fp.bpm.report; + +/** + * Interface de operaciones asociadas a reportes. + * @author Jorge Vaca + * @version 2.1 + */ +public interface ReportOperation { + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/report/ReportProcessor.java b/base/core/bpm/src/main/java/com/fp/bpm/report/ReportProcessor.java new file mode 100644 index 0000000..447454a --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/report/ReportProcessor.java @@ -0,0 +1,72 @@ +package com.fp.bpm.report; + +import java.util.List; + +import com.fp.common.exception.CommonException; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.ReportRule; +import com.fp.dto.rules.TransactionRule; +import com.fp.persistence.commondb.db.DataHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.pgeneral.trans.report.TgeneTransactionReports; + +public class ReportProcessor { + + /**Objeto con beans utilizados en el proceso de consulta.*/ + private QueryRequest queryRequest; + + /** + * Metodo que se encarga de llenar tablas utilizadas en la generacion de reportes. + * @param pQueryRequest Datos utilizados en la generacion de reportes. + * @return boolean + * @throws CommondbException + * @throws Exception + */ + public boolean process(QueryRequest pQueryRequest) throws CommondbException, Exception { + Thread.currentThread().setName(pQueryRequest.getJournalId()); + queryRequest = pQueryRequest; + //Ejecuta consultas especiales para una transaccion. + this.processByTransaction(); + return true; + } + + /** + * Metodo que ejecuta procesos especiales de consulta por transaccion. + * @param pQueryRequest Objeto con beans utilizados en el proceso de consulta. + * @throws Exception + */ + private void processByTransaction() throws Exception { + if (queryRequest.getTransactionModule() == null || queryRequest.getTransactionCode() == null) { + return; + } + List lquery = DataHelper.getInstance().getTgeneTransactionReports( + queryRequest.getTransactionModule(), queryRequest.getTransactionCode(), queryRequest.getTransactionVersion()); + if (lquery == null) { + return; + } + for (TgeneTransactionReports obj : lquery) { + this.processByTransactionRule(obj); + } + } + + /** + * Metodo encargado de ejecutar cada una de las reglas definidas en la transaccion. + * @param pSaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @param pProcess Objeto que contiene la regla a ejecutar. + * @throws Exception + */ + private void processByTransactionRule(TgeneTransactionReports pObj) throws Exception { + ReportRule rule = null; + try { + rule = (ReportRule) Class.forName(pObj.getProcesscode()).newInstance(); + } catch (ClassNotFoundException e) { + throw new CommonException("COMMON-0014", "CLASE {0} A EJECUTAR NO EXISTE MODULE: {1} TRANS: {2} VERSION {3}", e, pObj.getProcesscode(), + queryRequest.getTransactionModule(), queryRequest.getTransactionCode(), queryRequest.getTransactionVersion()); + } catch (ClassCastException e) { + throw new CommonException("COMMON-0015", "PROCESO {0} A EJECUTAR MODULE: {1} TRANS: {2} VERSION {3} NO IMPLEMENTA {4}", e, pObj.getProcesscode(), + queryRequest.getTransactionModule(), queryRequest.getTransactionCode(), queryRequest.getTransactionVersion(), TransactionRule.class.getName()); + } + rule.process(queryRequest); + } + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/rules/.svn/entries b/base/core/bpm/src/main/java/com/fp/bpm/rules/.svn/entries new file mode 100644 index 0000000..2b695a3 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/rules/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/bpm/src/main/java/com/fp/bpm/rules +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/core/bpm/src/main/java/com/fp/bpm/save/.svn/entries b/base/core/bpm/src/main/java/com/fp/bpm/save/.svn/entries new file mode 100644 index 0000000..91194ea --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/save/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/bpm/src/main/java/com/fp/bpm/save +svn://172.17.26.185/COMACO + + + +2014-10-30T07:12:09.504235Z +2212 +wpatino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +SaveOperation.java +file + + + + +2022-07-28T03:40:38.426784Z +eeeedf65fabaf683912e104cffe64cd5 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +212 + +Save.java +file + + + + +2022-07-28T03:40:38.427784Z +5764715f15bbcc18350e9e0c02c82e83 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5666 + +SaveProcessor.java +file + + + + +2022-07-28T03:40:38.427784Z +92212ad49edc98d6c04d4d80d3a0a534 +2014-10-30T07:12:09.504235Z +2212 +wpatino + + + + + + + + + + + + + + + + + + + + + +8154 + diff --git a/base/core/bpm/src/main/java/com/fp/bpm/save/.svn/text-base/Save.java.svn-base b/base/core/bpm/src/main/java/com/fp/bpm/save/.svn/text-base/Save.java.svn-base new file mode 100644 index 0000000..d3d5371 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/save/.svn/text-base/Save.java.svn-base @@ -0,0 +1,145 @@ +package com.fp.bpm.save; + +import java.util.ArrayList; +import java.util.List; + +import com.fp.common.helper.Constant; +import com.fp.common.logger.APPLogger; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Response; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.save.SaveBean; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; + +/** + * Clase que se encarga de persistir en la base de datos los beans. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class Save { + + /** + * Recorre la lista de orden de envio de beans a la base, Obtiene el savebean y ejecuta el dml. + * + * @param pSaveRequest Objeto con los beans a almacenar en la base de datos. + * @param pResponse Respuesta del proceso. + * @return boolean + * @throws CommondbException + * @throws Exception + */ + public boolean process(SaveRequest pSaveRequest, Response pResponse) throws CommondbException, Exception { + List lOrderPersistentBeans = pSaveRequest.getLOrderPersistentBeans(); + for (String key : lOrderPersistentBeans) { + Object obj = pSaveRequest.get(key); + if (obj instanceof SaveBean) { + APPLogger.getLogger().debug("Request de Mantenimiento recibido: " + pSaveRequest); + SaveBean sbean = (SaveBean) obj; + if (sbean.isSave()) { + this.saveBean(sbean); + } + } + } + int size = lOrderPersistentBeans.size(); + for (int i = size; i > 0; i--) { + Object obj = pSaveRequest.get(lOrderPersistentBeans.get(i - 1)); + if (obj instanceof SaveBean) { + APPLogger.getLogger().debug("Request de Mantenimiento recibido: " + pSaveRequest); + SaveBean sbean = (SaveBean) obj; + this.deleteBean(sbean); + } + } + + return true; + } + + /** + * Ejecuta sentencias DML contra la base de datos. + * + * @param pSaveBean Referencia a SaveBean + * @throws CommondbException + */ + private void saveBean(SaveBean pSaveBean) throws CommondbException, Exception { + + try { + if (pSaveBean.getModifiedObject() != null) { + APPLogger.getLogger().debug("Bean para mantenimiento: (saveBean) " + pSaveBean); + Object expire = ((AbstractDataTransport) pSaveBean.getModifiedObject()).get("expire"); + if (expire != null && Constant.ifYes(expire.toString())) { + PersistenceHelper.expire((HibernateBean) pSaveBean.getModifiedObject()); + } else { + Object isnew = ((AbstractDataTransport) pSaveBean.getModifiedObject()).get("isnew"); + if (isnew != null && Constant.ifYes(isnew.toString())) { + PersistenceHelper.save((HibernateBean) pSaveBean.getModifiedObject()); + } else { + PersistenceHelper.saveOrUpdate((HibernateBean) pSaveBean.getModifiedObject()); + } + } + } + for (Object obj : pSaveBean.getModifiedRecords()) { + APPLogger.getLogger().debug("Bean para mantenimiento de un List: (saveBean) " + pSaveBean); + Object expire = ((AbstractDataTransport) obj).get("expire"); + if (expire != null && Constant.ifYes(expire.toString())) { + PersistenceHelper.expire((HibernateBean) obj); + } else { + Object isnew = ((AbstractDataTransport) obj).get("isnew"); + if (isnew != null && Constant.ifYes(isnew.toString())) { + PersistenceHelper.save((HibernateBean) obj); + } else { + PersistenceHelper.saveOrUpdate((HibernateBean) obj); + } + } + + } + } catch (ClassCastException e) { + return; + // En este caso no hacer nada si no es un bean persistente. + } + } + + /** + * Ejecuta sentencias DML contra la base de datos. + * + * @param pSaveBean Referencia a SaveBean + * @throws CommondbException + */ + public void deleteBean(SaveBean pSaveBean) throws CommondbException, Exception { + + try { + if (pSaveBean.getDeletedObject() != null) { + APPLogger.getLogger().debug("Bean para delete: (saveBean) " + pSaveBean); + PersistenceHelper.delete((HibernateBean) pSaveBean.getDeletedObject()); + } + + for (Object obj : pSaveBean.getDeletedRecords()) { + APPLogger.getLogger().debug("Bean para delete de un List: (saveBean) " + pSaveBean); + PersistenceHelper.delete((HibernateBean) obj); + } + } catch (ClassCastException e) { + return; + // En este caso no hacer nada si no es un bean persistente. + } + } + + /** + * Metodo que elimina los bean que ya se gha realizado commit. + * + * @throws Exception + */ + public static void cleanSaveBeans(SaveRequest pSaveRequest) throws Exception { + List lOrderPersistentBeans = pSaveRequest.getLOrderPersistentBeans(); + List ldata = new ArrayList(); + for (String key : lOrderPersistentBeans) { + ldata.add(key); + } + for (String key : ldata) { + Object obj = pSaveRequest.get(key); + if (obj instanceof SaveBean) { + lOrderPersistentBeans.remove(((SaveBean) obj).getBeanAlias()); + } + } + } + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/save/.svn/text-base/SaveOperation.java.svn-base b/base/core/bpm/src/main/java/com/fp/bpm/save/.svn/text-base/SaveOperation.java.svn-base new file mode 100644 index 0000000..64192c1 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/save/.svn/text-base/SaveOperation.java.svn-base @@ -0,0 +1,10 @@ +package com.fp.bpm.save; + +/** + * Interface de las operaciones o acciones que se encarga de hacer un Alata o Modificacin de registros. + * @author Jorge Vaca + * @version 2.1 + */ +public interface SaveOperation { + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/save/.svn/text-base/SaveProcessor.java.svn-base b/base/core/bpm/src/main/java/com/fp/bpm/save/.svn/text-base/SaveProcessor.java.svn-base new file mode 100644 index 0000000..f69fb00 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/save/.svn/text-base/SaveProcessor.java.svn-base @@ -0,0 +1,198 @@ +package com.fp.bpm.save; + +import java.util.List; + +import com.fp.common.exception.CommonException; +import com.fp.common.exception.SavePointException; +import com.fp.common.helper.Constant; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Response; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.db.DataHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.pgeneral.trans.TgeneTransactionProcess; + +/** + * Clase que se encarga del orquestamiento de reglas de negocio asociadas a una transaccion en modo normal.
+ * Proceso.
+ *
    + *
  • Lee la definicion de las reglas definidas en la tabla tgenetransactionrule.
  • + *
  • Recore las reglas.
  • + *
  • Obtiene la clase especifica que implementa la interface TransactionRule.
  • + *
  • Invoca a cada de una de las clases ejecutando el modo normal.
  • + *
+ * NOTA: Si se requere que grabe hay que invocar a la clase que se encarga de esta tarea. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class SaveProcessor { + + /** Objeto con beans utilizados en el proceso de una transaccion. */ + private SaveRequest saveRequest; + + /** + * Metodo que se encarga del procesar procesos de negocio en linea. + * + * @param pSaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @param pResponse Objeto en el cual se alamcena la respuesta de una transaccion. + * @return boolean + * @throws CommondbException + * @throws Exception + */ + public boolean processReverse(SaveRequest pSaveRequest, Response pResponse) throws CommondbException, Exception { + Thread.currentThread().setName(pSaveRequest.getJournalId()); + this.saveRequest = pSaveRequest; + this.processrules(pResponse, false); + return true; + } + + /** + * Metodo que se encarga del procesar procesos de negocio en linea. + * + * @param pSaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @param pResponse Objeto en el cual se alamcena la respuesta de una transaccion. + * @return boolean + * @throws CommondbException + * @throws Exception + */ + public boolean process(SaveRequest pSaveRequest, Response pResponse) throws CommondbException, Exception { + Thread.currentThread().setName(pSaveRequest.getJournalId()); + this.saveRequest = pSaveRequest; + this.processrules(pResponse, true); + return true; + } + + /** + * Metodo que se encarga del procesar procesos de negocio en linea. + * + * @param pSaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @param pResponse Objeto en el cual se alamcena la respuesta de una transaccion. + * @return boolean + * @throws CommondbException + * @throws Exception + */ + public boolean processWithoutSave(SaveRequest pSaveRequest, Response pResponse) throws CommondbException, Exception { + try { + this.saveRequest = pSaveRequest; + this.processrules(pResponse, false); + } catch (Exception e) { + throw e; + } + return true; + } + + /** + * Metodo que se encarga del procesar procesos de negocios que se invocan desde un proceso de fin de dia.. + * + * @param pSaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @param pResponse Objeto en el cual se alamcena la respuesta de una transaccion. + * @return boolean + * @throws CommondbException + * @throws Exception + */ + public boolean processBatch(SaveRequest pSaveRequest, Response pResponse) throws CommondbException, Exception { + try { + this.saveRequest = pSaveRequest; + this.processrules(pResponse, true); + } catch (Exception e) { + throw e; + } + return true; + } + + /** + * Metodo que se encarga del procesar procesos de negocio. + * + * @param pResponse Objeto en el cual se alamcena la respuesta de una transaccion. + * @param pCommit Indica si se hace commit o no. + * @return boolean + * @throws CommondbException + * @throws Exception + */ + private void processrules(Response pResponse, boolean pCommit) throws CommondbException, Exception { + List lObjects = this.getProcess(); + if (lObjects != null) { + for (TgeneTransactionProcess obj : lObjects) { + try { + this.processByRule(obj); + } catch (SavePointException e) { + // Detiene la ejecucion de componentes de negocio y graba la transaccion. + break; + } + + } + } + // Ejecuta dml contra la base + // ojo no hacer commit por que esto se usa en el batch + if (pCommit) { + Save save = new Save(); + save.process(this.saveRequest, pResponse); + } + } + + /** + * Metodo encargado de ejecutar cada una de las reglas definidas en la transaccion. + * + * @param pProcess Objeto que contiene la regla a ejecutar. + * @throws Exception + */ + private void processByRule(TgeneTransactionProcess pProcess) throws Exception { + TransactionRule rule = null; + try { + rule = (TransactionRule) Class.forName(pProcess.getProcesscode()).newInstance(); + } catch (ClassNotFoundException e) { + throw new CommonException("COMMON-0006", "REGLA {0} A EJECUTAR NO DEFINIDO MODULE: {1} TRANS: {2} VERSION {3}", + pProcess.getProcesscode(), e, this.saveRequest.getTransactionModule(), this.saveRequest.getTransactionCode(), + this.saveRequest.getTransactionVersion()); + } catch (ClassCastException e) { + throw new CommonException("COMMON-0007", "REGLA {0} A EJECUTAR MODULE: {1} TRANS: {2} VERSION {3} NO IMPLEMENTA {4}", e, + pProcess.getProcesscode(), this.saveRequest.getTransactionModule(), this.saveRequest.getTransactionCode(), + this.saveRequest.getTransactionVersion(), TransactionRule.class.getName()); + } + APPLogger.getLogger().info(rule); + String reverse = (String) this.saveRequest.get("reverse"); + rule.setFlow(pProcess.getProcessname()); + rule.setRule(pProcess.getRulename()); + if (Constant.ifYes(reverse)) { + rule.reverseProcess(this.saveRequest); + } else { + rule.normalProcess(this.saveRequest); + } + + } + + /** + * Metodo que obtiene una lista de reglas definidos a nivel de transaccion. + * + * @return List + * @throws Exception + */ + private List getProcess() throws Exception { + List lObjects = DataHelper.getInstance().getTgeneTransactionProcess(this.saveRequest.getTransactionModule(), + this.saveRequest.getTransactionCode(), this.saveRequest.getTransactionVersion()); + + /* + * No va porque existe transacciones normales if(lObjects == null || lObjects.isEmpty()){ throw new + * CommonException("COMMON-0006", + * "REGLAS NO DEFINIDAS RN TGENETRANSACTIONPROCESS MODULE: {1} TRANS: {2} VERSION {3}", + * saveRequest.getTransactionModule(),saveRequest.getTransactionCode(), saveRequest.getTransactionVersion()); } + */ + return lObjects; + } + + /** + * Envia los beans a la base de datos y limpia los bean del save que ya se enviaron a al abse. + * + * @param saverequest + * @throws Exception + */ + public static void saveAndFlush(SaveRequest saverequest) throws Exception { + Save save = new Save(); + save.process(saverequest, saverequest.getResponse()); + PersistenceHelper.flushTransaction(); + Save.cleanSaveBeans(saverequest); + } +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/save/Save.java b/base/core/bpm/src/main/java/com/fp/bpm/save/Save.java new file mode 100644 index 0000000..d3d5371 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/save/Save.java @@ -0,0 +1,145 @@ +package com.fp.bpm.save; + +import java.util.ArrayList; +import java.util.List; + +import com.fp.common.helper.Constant; +import com.fp.common.logger.APPLogger; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Response; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.save.SaveBean; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; + +/** + * Clase que se encarga de persistir en la base de datos los beans. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class Save { + + /** + * Recorre la lista de orden de envio de beans a la base, Obtiene el savebean y ejecuta el dml. + * + * @param pSaveRequest Objeto con los beans a almacenar en la base de datos. + * @param pResponse Respuesta del proceso. + * @return boolean + * @throws CommondbException + * @throws Exception + */ + public boolean process(SaveRequest pSaveRequest, Response pResponse) throws CommondbException, Exception { + List lOrderPersistentBeans = pSaveRequest.getLOrderPersistentBeans(); + for (String key : lOrderPersistentBeans) { + Object obj = pSaveRequest.get(key); + if (obj instanceof SaveBean) { + APPLogger.getLogger().debug("Request de Mantenimiento recibido: " + pSaveRequest); + SaveBean sbean = (SaveBean) obj; + if (sbean.isSave()) { + this.saveBean(sbean); + } + } + } + int size = lOrderPersistentBeans.size(); + for (int i = size; i > 0; i--) { + Object obj = pSaveRequest.get(lOrderPersistentBeans.get(i - 1)); + if (obj instanceof SaveBean) { + APPLogger.getLogger().debug("Request de Mantenimiento recibido: " + pSaveRequest); + SaveBean sbean = (SaveBean) obj; + this.deleteBean(sbean); + } + } + + return true; + } + + /** + * Ejecuta sentencias DML contra la base de datos. + * + * @param pSaveBean Referencia a SaveBean + * @throws CommondbException + */ + private void saveBean(SaveBean pSaveBean) throws CommondbException, Exception { + + try { + if (pSaveBean.getModifiedObject() != null) { + APPLogger.getLogger().debug("Bean para mantenimiento: (saveBean) " + pSaveBean); + Object expire = ((AbstractDataTransport) pSaveBean.getModifiedObject()).get("expire"); + if (expire != null && Constant.ifYes(expire.toString())) { + PersistenceHelper.expire((HibernateBean) pSaveBean.getModifiedObject()); + } else { + Object isnew = ((AbstractDataTransport) pSaveBean.getModifiedObject()).get("isnew"); + if (isnew != null && Constant.ifYes(isnew.toString())) { + PersistenceHelper.save((HibernateBean) pSaveBean.getModifiedObject()); + } else { + PersistenceHelper.saveOrUpdate((HibernateBean) pSaveBean.getModifiedObject()); + } + } + } + for (Object obj : pSaveBean.getModifiedRecords()) { + APPLogger.getLogger().debug("Bean para mantenimiento de un List: (saveBean) " + pSaveBean); + Object expire = ((AbstractDataTransport) obj).get("expire"); + if (expire != null && Constant.ifYes(expire.toString())) { + PersistenceHelper.expire((HibernateBean) obj); + } else { + Object isnew = ((AbstractDataTransport) obj).get("isnew"); + if (isnew != null && Constant.ifYes(isnew.toString())) { + PersistenceHelper.save((HibernateBean) obj); + } else { + PersistenceHelper.saveOrUpdate((HibernateBean) obj); + } + } + + } + } catch (ClassCastException e) { + return; + // En este caso no hacer nada si no es un bean persistente. + } + } + + /** + * Ejecuta sentencias DML contra la base de datos. + * + * @param pSaveBean Referencia a SaveBean + * @throws CommondbException + */ + public void deleteBean(SaveBean pSaveBean) throws CommondbException, Exception { + + try { + if (pSaveBean.getDeletedObject() != null) { + APPLogger.getLogger().debug("Bean para delete: (saveBean) " + pSaveBean); + PersistenceHelper.delete((HibernateBean) pSaveBean.getDeletedObject()); + } + + for (Object obj : pSaveBean.getDeletedRecords()) { + APPLogger.getLogger().debug("Bean para delete de un List: (saveBean) " + pSaveBean); + PersistenceHelper.delete((HibernateBean) obj); + } + } catch (ClassCastException e) { + return; + // En este caso no hacer nada si no es un bean persistente. + } + } + + /** + * Metodo que elimina los bean que ya se gha realizado commit. + * + * @throws Exception + */ + public static void cleanSaveBeans(SaveRequest pSaveRequest) throws Exception { + List lOrderPersistentBeans = pSaveRequest.getLOrderPersistentBeans(); + List ldata = new ArrayList(); + for (String key : lOrderPersistentBeans) { + ldata.add(key); + } + for (String key : ldata) { + Object obj = pSaveRequest.get(key); + if (obj instanceof SaveBean) { + lOrderPersistentBeans.remove(((SaveBean) obj).getBeanAlias()); + } + } + } + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/save/SaveOperation.java b/base/core/bpm/src/main/java/com/fp/bpm/save/SaveOperation.java new file mode 100644 index 0000000..64192c1 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/save/SaveOperation.java @@ -0,0 +1,10 @@ +package com.fp.bpm.save; + +/** + * Interface de las operaciones o acciones que se encarga de hacer un Alata o Modificacin de registros. + * @author Jorge Vaca + * @version 2.1 + */ +public interface SaveOperation { + +} diff --git a/base/core/bpm/src/main/java/com/fp/bpm/save/SaveProcessor.java b/base/core/bpm/src/main/java/com/fp/bpm/save/SaveProcessor.java new file mode 100644 index 0000000..f69fb00 --- /dev/null +++ b/base/core/bpm/src/main/java/com/fp/bpm/save/SaveProcessor.java @@ -0,0 +1,198 @@ +package com.fp.bpm.save; + +import java.util.List; + +import com.fp.common.exception.CommonException; +import com.fp.common.exception.SavePointException; +import com.fp.common.helper.Constant; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Response; +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.db.DataHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.pgeneral.trans.TgeneTransactionProcess; + +/** + * Clase que se encarga del orquestamiento de reglas de negocio asociadas a una transaccion en modo normal.
+ * Proceso.
+ *
    + *
  • Lee la definicion de las reglas definidas en la tabla tgenetransactionrule.
  • + *
  • Recore las reglas.
  • + *
  • Obtiene la clase especifica que implementa la interface TransactionRule.
  • + *
  • Invoca a cada de una de las clases ejecutando el modo normal.
  • + *
+ * NOTA: Si se requere que grabe hay que invocar a la clase que se encarga de esta tarea. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class SaveProcessor { + + /** Objeto con beans utilizados en el proceso de una transaccion. */ + private SaveRequest saveRequest; + + /** + * Metodo que se encarga del procesar procesos de negocio en linea. + * + * @param pSaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @param pResponse Objeto en el cual se alamcena la respuesta de una transaccion. + * @return boolean + * @throws CommondbException + * @throws Exception + */ + public boolean processReverse(SaveRequest pSaveRequest, Response pResponse) throws CommondbException, Exception { + Thread.currentThread().setName(pSaveRequest.getJournalId()); + this.saveRequest = pSaveRequest; + this.processrules(pResponse, false); + return true; + } + + /** + * Metodo que se encarga del procesar procesos de negocio en linea. + * + * @param pSaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @param pResponse Objeto en el cual se alamcena la respuesta de una transaccion. + * @return boolean + * @throws CommondbException + * @throws Exception + */ + public boolean process(SaveRequest pSaveRequest, Response pResponse) throws CommondbException, Exception { + Thread.currentThread().setName(pSaveRequest.getJournalId()); + this.saveRequest = pSaveRequest; + this.processrules(pResponse, true); + return true; + } + + /** + * Metodo que se encarga del procesar procesos de negocio en linea. + * + * @param pSaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @param pResponse Objeto en el cual se alamcena la respuesta de una transaccion. + * @return boolean + * @throws CommondbException + * @throws Exception + */ + public boolean processWithoutSave(SaveRequest pSaveRequest, Response pResponse) throws CommondbException, Exception { + try { + this.saveRequest = pSaveRequest; + this.processrules(pResponse, false); + } catch (Exception e) { + throw e; + } + return true; + } + + /** + * Metodo que se encarga del procesar procesos de negocios que se invocan desde un proceso de fin de dia.. + * + * @param pSaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @param pResponse Objeto en el cual se alamcena la respuesta de una transaccion. + * @return boolean + * @throws CommondbException + * @throws Exception + */ + public boolean processBatch(SaveRequest pSaveRequest, Response pResponse) throws CommondbException, Exception { + try { + this.saveRequest = pSaveRequest; + this.processrules(pResponse, true); + } catch (Exception e) { + throw e; + } + return true; + } + + /** + * Metodo que se encarga del procesar procesos de negocio. + * + * @param pResponse Objeto en el cual se alamcena la respuesta de una transaccion. + * @param pCommit Indica si se hace commit o no. + * @return boolean + * @throws CommondbException + * @throws Exception + */ + private void processrules(Response pResponse, boolean pCommit) throws CommondbException, Exception { + List lObjects = this.getProcess(); + if (lObjects != null) { + for (TgeneTransactionProcess obj : lObjects) { + try { + this.processByRule(obj); + } catch (SavePointException e) { + // Detiene la ejecucion de componentes de negocio y graba la transaccion. + break; + } + + } + } + // Ejecuta dml contra la base + // ojo no hacer commit por que esto se usa en el batch + if (pCommit) { + Save save = new Save(); + save.process(this.saveRequest, pResponse); + } + } + + /** + * Metodo encargado de ejecutar cada una de las reglas definidas en la transaccion. + * + * @param pProcess Objeto que contiene la regla a ejecutar. + * @throws Exception + */ + private void processByRule(TgeneTransactionProcess pProcess) throws Exception { + TransactionRule rule = null; + try { + rule = (TransactionRule) Class.forName(pProcess.getProcesscode()).newInstance(); + } catch (ClassNotFoundException e) { + throw new CommonException("COMMON-0006", "REGLA {0} A EJECUTAR NO DEFINIDO MODULE: {1} TRANS: {2} VERSION {3}", + pProcess.getProcesscode(), e, this.saveRequest.getTransactionModule(), this.saveRequest.getTransactionCode(), + this.saveRequest.getTransactionVersion()); + } catch (ClassCastException e) { + throw new CommonException("COMMON-0007", "REGLA {0} A EJECUTAR MODULE: {1} TRANS: {2} VERSION {3} NO IMPLEMENTA {4}", e, + pProcess.getProcesscode(), this.saveRequest.getTransactionModule(), this.saveRequest.getTransactionCode(), + this.saveRequest.getTransactionVersion(), TransactionRule.class.getName()); + } + APPLogger.getLogger().info(rule); + String reverse = (String) this.saveRequest.get("reverse"); + rule.setFlow(pProcess.getProcessname()); + rule.setRule(pProcess.getRulename()); + if (Constant.ifYes(reverse)) { + rule.reverseProcess(this.saveRequest); + } else { + rule.normalProcess(this.saveRequest); + } + + } + + /** + * Metodo que obtiene una lista de reglas definidos a nivel de transaccion. + * + * @return List + * @throws Exception + */ + private List getProcess() throws Exception { + List lObjects = DataHelper.getInstance().getTgeneTransactionProcess(this.saveRequest.getTransactionModule(), + this.saveRequest.getTransactionCode(), this.saveRequest.getTransactionVersion()); + + /* + * No va porque existe transacciones normales if(lObjects == null || lObjects.isEmpty()){ throw new + * CommonException("COMMON-0006", + * "REGLAS NO DEFINIDAS RN TGENETRANSACTIONPROCESS MODULE: {1} TRANS: {2} VERSION {3}", + * saveRequest.getTransactionModule(),saveRequest.getTransactionCode(), saveRequest.getTransactionVersion()); } + */ + return lObjects; + } + + /** + * Envia los beans a la base de datos y limpia los bean del save que ya se enviaron a al abse. + * + * @param saverequest + * @throws Exception + */ + public static void saveAndFlush(SaveRequest saverequest) throws Exception { + Save save = new Save(); + save.process(saverequest, saverequest.getResponse()); + PersistenceHelper.flushTransaction(); + Save.cleanSaveBeans(saverequest); + } +} diff --git a/base/core/bpm/src/main/resources/.svn/entries b/base/core/bpm/src/main/resources/.svn/entries new file mode 100644 index 0000000..85124ef --- /dev/null +++ b/base/core/bpm/src/main/resources/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/bpm/src/main/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/core/bpm/src/test/.svn/entries b/base/core/bpm/src/test/.svn/entries new file mode 100644 index 0000000..289d204 --- /dev/null +++ b/base/core/bpm/src/test/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/bpm/src/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/core/bpm/src/test/java/.svn/entries b/base/core/bpm/src/test/java/.svn/entries new file mode 100644 index 0000000..6b4fb12 --- /dev/null +++ b/base/core/bpm/src/test/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/bpm/src/test/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + diff --git a/base/core/bpm/src/test/java/test/.svn/entries b/base/core/bpm/src/test/java/test/.svn/entries new file mode 100644 index 0000000..523d0fb --- /dev/null +++ b/base/core/bpm/src/test/java/test/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/bpm/src/test/java/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/core/bpm/src/test/java/test/com/.svn/entries b/base/core/bpm/src/test/java/test/com/.svn/entries new file mode 100644 index 0000000..4261794 --- /dev/null +++ b/base/core/bpm/src/test/java/test/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/bpm/src/test/java/test/com +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/core/bpm/src/test/java/test/com/fp/.svn/entries b/base/core/bpm/src/test/java/test/com/fp/.svn/entries new file mode 100644 index 0000000..c1e957c --- /dev/null +++ b/base/core/bpm/src/test/java/test/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/bpm/src/test/java/test/com/fp +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +bpm +dir + diff --git a/base/core/bpm/src/test/java/test/com/fp/bpm/.svn/entries b/base/core/bpm/src/test/java/test/com/fp/bpm/.svn/entries new file mode 100644 index 0000000..be0a6e5 --- /dev/null +++ b/base/core/bpm/src/test/java/test/com/fp/bpm/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/bpm/src/test/java/test/com/fp/bpm +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/core/bpm/src/test/resources/.svn/entries b/base/core/bpm/src/test/resources/.svn/entries new file mode 100644 index 0000000..a1e1f43 --- /dev/null +++ b/base/core/bpm/src/test/resources/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/bpm/src/test/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/core/bpm/target/bpm-2.1.jar b/base/core/bpm/target/bpm-2.1.jar new file mode 100644 index 0000000..aecd23a Binary files /dev/null and b/base/core/bpm/target/bpm-2.1.jar differ diff --git a/base/core/bpm/target/classes/com/fp/bpm/ActionExecutor.class b/base/core/bpm/target/classes/com/fp/bpm/ActionExecutor.class new file mode 100644 index 0000000..a898ef2 Binary files /dev/null and b/base/core/bpm/target/classes/com/fp/bpm/ActionExecutor.class differ diff --git a/base/core/bpm/target/classes/com/fp/bpm/EngineExecutor.class b/base/core/bpm/target/classes/com/fp/bpm/EngineExecutor.class new file mode 100644 index 0000000..37faadf Binary files /dev/null and b/base/core/bpm/target/classes/com/fp/bpm/EngineExecutor.class differ diff --git a/base/core/bpm/target/classes/com/fp/bpm/actions/Action.class b/base/core/bpm/target/classes/com/fp/bpm/actions/Action.class new file mode 100644 index 0000000..1fd3cf3 Binary files /dev/null and b/base/core/bpm/target/classes/com/fp/bpm/actions/Action.class differ diff --git a/base/core/bpm/target/classes/com/fp/bpm/actions/ActionTypes.class b/base/core/bpm/target/classes/com/fp/bpm/actions/ActionTypes.class new file mode 100644 index 0000000..908a2fd Binary files /dev/null and b/base/core/bpm/target/classes/com/fp/bpm/actions/ActionTypes.class differ diff --git a/base/core/bpm/target/classes/com/fp/bpm/actions/LogonAction.class b/base/core/bpm/target/classes/com/fp/bpm/actions/LogonAction.class new file mode 100644 index 0000000..37b107b Binary files /dev/null and b/base/core/bpm/target/classes/com/fp/bpm/actions/LogonAction.class differ diff --git a/base/core/bpm/target/classes/com/fp/bpm/actions/QueryAction.class b/base/core/bpm/target/classes/com/fp/bpm/actions/QueryAction.class new file mode 100644 index 0000000..ff048f4 Binary files /dev/null and b/base/core/bpm/target/classes/com/fp/bpm/actions/QueryAction.class differ diff --git a/base/core/bpm/target/classes/com/fp/bpm/actions/SaveAction.class b/base/core/bpm/target/classes/com/fp/bpm/actions/SaveAction.class new file mode 100644 index 0000000..41bde16 Binary files /dev/null and b/base/core/bpm/target/classes/com/fp/bpm/actions/SaveAction.class differ diff --git a/base/core/bpm/target/classes/com/fp/bpm/actions/SaveActionHelper.class b/base/core/bpm/target/classes/com/fp/bpm/actions/SaveActionHelper.class new file mode 100644 index 0000000..4c4bbd2 Binary files /dev/null and b/base/core/bpm/target/classes/com/fp/bpm/actions/SaveActionHelper.class differ diff --git a/base/core/bpm/target/classes/com/fp/bpm/helper/TransactionTime.class b/base/core/bpm/target/classes/com/fp/bpm/helper/TransactionTime.class new file mode 100644 index 0000000..3eeffe0 Binary files /dev/null and b/base/core/bpm/target/classes/com/fp/bpm/helper/TransactionTime.class differ diff --git a/base/core/bpm/target/classes/com/fp/bpm/query/Query.class b/base/core/bpm/target/classes/com/fp/bpm/query/Query.class new file mode 100644 index 0000000..dbdc52b Binary files /dev/null and b/base/core/bpm/target/classes/com/fp/bpm/query/Query.class differ diff --git a/base/core/bpm/target/classes/com/fp/bpm/query/QueryHQL.class b/base/core/bpm/target/classes/com/fp/bpm/query/QueryHQL.class new file mode 100644 index 0000000..fec336e Binary files /dev/null and b/base/core/bpm/target/classes/com/fp/bpm/query/QueryHQL.class differ diff --git a/base/core/bpm/target/classes/com/fp/bpm/query/QueryHelper.class b/base/core/bpm/target/classes/com/fp/bpm/query/QueryHelper.class new file mode 100644 index 0000000..055789e Binary files /dev/null and b/base/core/bpm/target/classes/com/fp/bpm/query/QueryHelper.class differ diff --git a/base/core/bpm/target/classes/com/fp/bpm/query/QueryJsf.class b/base/core/bpm/target/classes/com/fp/bpm/query/QueryJsf.class new file mode 100644 index 0000000..13fd6b4 Binary files /dev/null and b/base/core/bpm/target/classes/com/fp/bpm/query/QueryJsf.class differ diff --git a/base/core/bpm/target/classes/com/fp/bpm/query/QueryOperation.class b/base/core/bpm/target/classes/com/fp/bpm/query/QueryOperation.class new file mode 100644 index 0000000..e99eb68 Binary files /dev/null and b/base/core/bpm/target/classes/com/fp/bpm/query/QueryOperation.class differ diff --git a/base/core/bpm/target/classes/com/fp/bpm/query/QueryProcessCriteria.class b/base/core/bpm/target/classes/com/fp/bpm/query/QueryProcessCriteria.class new file mode 100644 index 0000000..ab42cc4 Binary files /dev/null and b/base/core/bpm/target/classes/com/fp/bpm/query/QueryProcessCriteria.class differ diff --git a/base/core/bpm/target/classes/com/fp/bpm/query/QueryProcessor.class b/base/core/bpm/target/classes/com/fp/bpm/query/QueryProcessor.class new file mode 100644 index 0000000..348d74d Binary files /dev/null and b/base/core/bpm/target/classes/com/fp/bpm/query/QueryProcessor.class differ diff --git a/base/core/bpm/target/classes/com/fp/bpm/query/menu/Menu.class b/base/core/bpm/target/classes/com/fp/bpm/query/menu/Menu.class new file mode 100644 index 0000000..3bed16c Binary files /dev/null and b/base/core/bpm/target/classes/com/fp/bpm/query/menu/Menu.class differ diff --git a/base/core/bpm/target/classes/com/fp/bpm/report/ReportOperation.class b/base/core/bpm/target/classes/com/fp/bpm/report/ReportOperation.class new file mode 100644 index 0000000..90fe46e Binary files /dev/null and b/base/core/bpm/target/classes/com/fp/bpm/report/ReportOperation.class differ diff --git a/base/core/bpm/target/classes/com/fp/bpm/report/ReportProcessor.class b/base/core/bpm/target/classes/com/fp/bpm/report/ReportProcessor.class new file mode 100644 index 0000000..35f5989 Binary files /dev/null and b/base/core/bpm/target/classes/com/fp/bpm/report/ReportProcessor.class differ diff --git a/base/core/bpm/target/classes/com/fp/bpm/save/Save.class b/base/core/bpm/target/classes/com/fp/bpm/save/Save.class new file mode 100644 index 0000000..217dc4e Binary files /dev/null and b/base/core/bpm/target/classes/com/fp/bpm/save/Save.class differ diff --git a/base/core/bpm/target/classes/com/fp/bpm/save/SaveOperation.class b/base/core/bpm/target/classes/com/fp/bpm/save/SaveOperation.class new file mode 100644 index 0000000..25728de Binary files /dev/null and b/base/core/bpm/target/classes/com/fp/bpm/save/SaveOperation.class differ diff --git a/base/core/bpm/target/classes/com/fp/bpm/save/SaveProcessor.class b/base/core/bpm/target/classes/com/fp/bpm/save/SaveProcessor.class new file mode 100644 index 0000000..a50094a Binary files /dev/null and b/base/core/bpm/target/classes/com/fp/bpm/save/SaveProcessor.class differ diff --git a/base/core/bpm/target/maven-archiver/pom.properties b/base/core/bpm/target/maven-archiver/pom.properties new file mode 100644 index 0000000..50c3ae7 --- /dev/null +++ b/base/core/bpm/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:52:56 ECT 2022 +version=2.1 +groupId=com.fp.base.core +artifactId=bpm diff --git a/base/core/firmas/.svn/dir-prop-base b/base/core/firmas/.svn/dir-prop-base new file mode 100644 index 0000000..40820ff --- /dev/null +++ b/base/core/firmas/.svn/dir-prop-base @@ -0,0 +1,6 @@ +K 10 +svn:ignore +V 7 +target + +END diff --git a/base/core/firmas/.svn/entries b/base/core/firmas/.svn/entries new file mode 100644 index 0000000..dca7f57 --- /dev/null +++ b/base/core/firmas/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/firmas +svn://172.17.26.185/COMACO + + + +2014-10-17T05:35:34.255544Z +1671 +jvaca +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:37.224779Z +27b5bfab9dbb337de682e87bbb814661 +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + + + + + + + + +1733 + diff --git a/base/core/firmas/.svn/text-base/pom.xml.svn-base b/base/core/firmas/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..b91217b --- /dev/null +++ b/base/core/firmas/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,57 @@ + + + 4.0.0 + + com.fp.base + core + 2.1 + + com.fp.base.core + firmas + firmas + http://maven.apache.org + + UTF-8 + + + + junit + junit + 3.8.1 + test + + + com.fp.base.core + bpm + 2.1 + + + com.fp.base.persistence + pfirmas + 2.1 + provided + + + com.fp.base.persistence + pviaticos + 2.1 + provided + + + org.bouncycastle + bcprov-jdk15on + 1.50 + + + org.bouncycastle + bcmail-jdk15on + 1.50 + + + com.itextpdf + itextpdf + 5.5.0 + + + diff --git a/base/core/firmas/pom.xml b/base/core/firmas/pom.xml new file mode 100644 index 0000000..b91217b --- /dev/null +++ b/base/core/firmas/pom.xml @@ -0,0 +1,57 @@ + + + 4.0.0 + + com.fp.base + core + 2.1 + + com.fp.base.core + firmas + firmas + http://maven.apache.org + + UTF-8 + + + + junit + junit + 3.8.1 + test + + + com.fp.base.core + bpm + 2.1 + + + com.fp.base.persistence + pfirmas + 2.1 + provided + + + com.fp.base.persistence + pviaticos + 2.1 + provided + + + org.bouncycastle + bcprov-jdk15on + 1.50 + + + org.bouncycastle + bcmail-jdk15on + 1.50 + + + com.itextpdf + itextpdf + 5.5.0 + + + diff --git a/base/core/firmas/src/.svn/entries b/base/core/firmas/src/.svn/entries new file mode 100644 index 0000000..4b9ff30 --- /dev/null +++ b/base/core/firmas/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/firmas/src +svn://172.17.26.185/COMACO + + + +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/base/core/firmas/src/main/.svn/entries b/base/core/firmas/src/main/.svn/entries new file mode 100644 index 0000000..9f84b2a --- /dev/null +++ b/base/core/firmas/src/main/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/firmas/src/main +svn://172.17.26.185/COMACO + + + +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/core/firmas/src/main/java/.svn/entries b/base/core/firmas/src/main/java/.svn/entries new file mode 100644 index 0000000..79a4b73 --- /dev/null +++ b/base/core/firmas/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/firmas/src/main/java +svn://172.17.26.185/COMACO + + + +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/core/firmas/src/main/java/com/.svn/entries b/base/core/firmas/src/main/java/com/.svn/entries new file mode 100644 index 0000000..3a0fd6c --- /dev/null +++ b/base/core/firmas/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/firmas/src/main/java/com +svn://172.17.26.185/COMACO + + + +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/core/firmas/src/main/java/com/fp/.svn/entries b/base/core/firmas/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..80112de --- /dev/null +++ b/base/core/firmas/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/firmas/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +firmas +dir + diff --git a/base/core/firmas/src/main/java/com/fp/firmas/.svn/entries b/base/core/firmas/src/main/java/com/fp/firmas/.svn/entries new file mode 100644 index 0000000..8f9e32b --- /dev/null +++ b/base/core/firmas/src/main/java/com/fp/firmas/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/firmas/src/main/java/com/fp/firmas +svn://172.17.26.185/COMACO + + + +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +rules +dir + diff --git a/base/core/firmas/src/main/java/com/fp/firmas/rules/.svn/entries b/base/core/firmas/src/main/java/com/fp/firmas/rules/.svn/entries new file mode 100644 index 0000000..a3bc406 --- /dev/null +++ b/base/core/firmas/src/main/java/com/fp/firmas/rules/.svn/entries @@ -0,0 +1,37 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/firmas/src/main/java/com/fp/firmas/rules +svn://172.17.26.185/COMACO + + + +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +query +dir + +common +dir + +save +dir + diff --git a/base/core/firmas/src/main/java/com/fp/firmas/rules/common/.svn/entries b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/.svn/entries new file mode 100644 index 0000000..79e1aaa --- /dev/null +++ b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/.svn/entries @@ -0,0 +1,105 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/firmas/src/main/java/com/fp/firmas/rules/common +svn://172.17.26.185/COMACO + + + +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +enumerator +dir + +CertificateUtils.java +file + + + + +2022-07-28T03:40:36.881778Z +b7e42e1257649916abb4ac6802938c5a +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + + + + + + + + +29895 + +PDFRendererListener.java +file + + + + +2022-07-28T03:40:36.881778Z +60bd93a23c166f4947fc882b7dc8485d +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + + + + + + + + +1586 + +resources +dir + +exception +dir + diff --git a/base/core/firmas/src/main/java/com/fp/firmas/rules/common/.svn/text-base/CertificateUtils.java.svn-base b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/.svn/text-base/CertificateUtils.java.svn-base new file mode 100644 index 0000000..25d73f8 --- /dev/null +++ b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/.svn/text-base/CertificateUtils.java.svn-base @@ -0,0 +1,738 @@ +package com.fp.firmas.rules.common; + +import java.io.BufferedOutputStream; +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.math.BigInteger; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.Security; +import java.security.UnrecoverableKeyException; +import java.security.cert.Certificate; +import java.security.cert.CertificateEncodingException; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Enumeration; +import java.util.List; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import org.bouncycastle.cert.X509CertificateHolder; +import org.bouncycastle.cert.ocsp.BasicOCSPResp; +import org.bouncycastle.cert.ocsp.CertificateID; +import org.bouncycastle.cert.ocsp.CertificateStatus; +import org.bouncycastle.cert.ocsp.OCSPException; +import org.bouncycastle.cert.ocsp.OCSPReq; +import org.bouncycastle.cert.ocsp.OCSPReqBuilder; +import org.bouncycastle.cert.ocsp.OCSPResp; +import org.bouncycastle.cert.ocsp.RevokedStatus; +import org.bouncycastle.cert.ocsp.SingleResp; +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.bouncycastle.operator.OperatorCreationException; +import org.bouncycastle.operator.jcajce.JcaDigestCalculatorProviderBuilder; + +import com.fp.base.persistence.TfirmDatosFirmante; +import com.fp.common.logger.APPLogger; +import com.fp.firmas.rules.common.enumerator.SignType; +import com.fp.firmas.rules.common.exception.FirmasException; +import com.fp.firmas.rules.common.resources.FirmMessages; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pfirmas.param.TfirmCertificado; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.itextpdf.text.DocumentException; +import com.itextpdf.text.Font; +import com.itextpdf.text.Rectangle; +import com.itextpdf.text.pdf.AcroFields; +import com.itextpdf.text.pdf.PdfReader; +import com.itextpdf.text.pdf.PdfSignatureAppearance; +import com.itextpdf.text.pdf.PdfStamper; +import com.itextpdf.text.pdf.parser.PdfReaderContentParser; +import com.itextpdf.text.pdf.parser.Vector; +import com.itextpdf.text.pdf.security.BouncyCastleDigest; +import com.itextpdf.text.pdf.security.CertificateInfo; +import com.itextpdf.text.pdf.security.CertificateInfo.X500Name; +import com.itextpdf.text.pdf.security.CertificateUtil; +import com.itextpdf.text.pdf.security.DigestAlgorithms; +import com.itextpdf.text.pdf.security.ExternalDigest; +import com.itextpdf.text.pdf.security.ExternalSignature; +import com.itextpdf.text.pdf.security.MakeSignature; +import com.itextpdf.text.pdf.security.MakeSignature.CryptoStandard; +import com.itextpdf.text.pdf.security.OcspClient; +import com.itextpdf.text.pdf.security.OcspClientBouncyCastle; +import com.itextpdf.text.pdf.security.PrivateKeySignature; +import com.itextpdf.text.pdf.security.TSAClient; + +/** + * Clase que contiene metodos utilitarios para manejar certificados + * + * @author dcruz + * + */ +public class CertificateUtils { + + /* + * CONSTANTES DESIGNADAS SEGUN LA NUEVA ESTRUCTURA DEL BCE + */ + // OIDs de Campos del Certificado: + public static final String OID_CEDULA_PASAPORTE = FirmMessages.getString("oid.cedula_pasaporte"); + + public static final String OID_NOMBRES = FirmMessages.getString("oid.nombres_persona"); + + public static final String OID_APELLIDO_1 = FirmMessages.getString("oid.apellido_persona1"); + + public static final String OID_APELLIDO_2 = FirmMessages.getString("oid.apellido_persona2"); + + public static final String OID_CARGO = FirmMessages.getString("oid.cargo"); + + public static final String OID_INSTITUCION = FirmMessages.getString("oid.institucion"); + + public static final String OID_DIRECCION = FirmMessages.getString("oid.direccion"); + + public static final String OID_TELEFONO = FirmMessages.getString("oid.telefono"); + + public static final String OID_CIUDAD = FirmMessages.getString("oid.ciudad"); + + public static final String OID_RAZON_SOCIAL = FirmMessages.getString("oid.razon_social"); + + public static final String OID_RUC = FirmMessages.getString("oid.ruc"); + + public static final String X509 = "X.509"; + + static { + BouncyCastleProvider provider = new BouncyCastleProvider(); + Security.addProvider(provider); + } + + /** + * Retorna el certificado del usuario contenido en la firma + * + * @param store el store en el que se va a buscar los certificados + * @param aliases los alias que estan dentro del keystore + * @return el {@link java.security.Certificate} + * @throws KeyStoreException + */ + public synchronized static Certificate obtainCertificateInAlias(KeyStore store, Enumeration aliases) throws KeyStoreException { + Certificate certs[] = null; + synchronized (aliases) { + int i = 0; + while (aliases.hasMoreElements()) { + String alias = aliases.nextElement(); + //System.out.println("Se imprime los alias: " + i + " " + alias); + certs = store.getCertificateChain(alias); + for (int j = 0; j < certs.length; j++) { + X509Certificate certificate = (X509Certificate) certs[j]; + boolean[] usages = certificate.getKeyUsage(); + // System.out.println("Certificado en primera posicion usado: " + j + " " + usages[0]); + if (usages[0]) { + return certificate; + } + } + i++; + } + + } + return null; + } + + /** + * Se devuelve todos los datos de la firma del usuario en base al certificado enviado + * + * @param certificate el certificado enviado + * @return Los datos del certificado de dicho usuario + */ + public static TfirmDatosFirmante obtainDataForCertificate(Certificate certificate) { + X509Certificate signedCertificate = (X509Certificate) certificate; + TfirmDatosFirmante datosFirmante = new TfirmDatosFirmante(); + if (signedCertificate.getExtensionValue(OID_CEDULA_PASAPORTE) != null) { + datosFirmante.setIdentificacion(new String(signedCertificate.getExtensionValue(OID_CEDULA_PASAPORTE)).trim()); + } + if (signedCertificate.getExtensionValue(OID_NOMBRES) != null) { + datosFirmante.setNombre(new String(signedCertificate.getExtensionValue(OID_NOMBRES)).trim()); + } + if (signedCertificate.getExtensionValue(OID_APELLIDO_1) != null) { + datosFirmante.setApellido1(new String(signedCertificate.getExtensionValue(OID_APELLIDO_1)).trim()); + if (signedCertificate.getExtensionValue(OID_APELLIDO_2) != null) { + datosFirmante.setApellido2(new String(signedCertificate.getExtensionValue(OID_APELLIDO_2)).trim()); + } else { + datosFirmante.setApellido2(""); + } + } + if (signedCertificate.getExtensionValue(OID_TELEFONO) != null) { + datosFirmante.setTelefono(new String(signedCertificate.getExtensionValue(OID_TELEFONO)).trim()); + } + if (signedCertificate.getExtensionValue(OID_CARGO) != null) { + datosFirmante.setCargo(new String(signedCertificate.getExtensionValue(OID_CARGO)).trim()); + } + if (signedCertificate.getExtensionValue(OID_CIUDAD) != null) { + datosFirmante.setCiudad(new String(signedCertificate.getExtensionValue(OID_CIUDAD)).trim()); + } + if (signedCertificate.getExtensionValue(OID_DIRECCION) != null) { + datosFirmante.setDireccion(new String(signedCertificate.getExtensionValue(OID_DIRECCION)).trim()); + } + if (signedCertificate.getExtensionValue(OID_INSTITUCION) != null) { + datosFirmante.setInstitucion(new String(signedCertificate.getExtensionValue(OID_INSTITUCION)).trim()); + } + if (signedCertificate.getExtensionValue(OID_RAZON_SOCIAL) != null) { + datosFirmante.setInstitucion(new String(signedCertificate.getExtensionValue(OID_RAZON_SOCIAL)).trim()); + } + if (signedCertificate.getExtensionValue(OID_RUC) != null) { + datosFirmante.setRuc(new String(signedCertificate.getExtensionValue(OID_RUC)).trim()); + } + datosFirmante.setFechaInicioVigencia(signedCertificate.getNotBefore()); + datosFirmante.setFechaVigencia(signedCertificate.getNotAfter()); + return datosFirmante; + } + + /** + * Valida que el certificado del usuario sea un certificado valido contra el servicio OCSP del proveedor + * + * @param certificateUser + * @throws FileNotFoundException + * @throws CertificateException + */ + public static void validateOcsCertificate(Certificate certificateUser) throws FileNotFoundException, CertificateException, FirmasException{ + // System.out.println(((X509Certificate) certificateUser).getIssuerDN().getName()); + CertificateFactory cf = CertificateFactory.getInstance(X509); + InputStream subordStream = new FileInputStream(FirmMessages.getString("dir.ruta.base.repositorio") + "/" + + FirmMessages.getString("nombre.certificado.subordinado")); + X509Certificate subordCertificate = (X509Certificate) cf.generateCertificate(subordStream); + check((X509Certificate) certificateUser, subordCertificate); + try{ + subordStream.close(); + }catch(Exception e){} + } + + /** + * Valida que los certificados enviados sean validos por la entidad certificadora + * + * @param issuerCert certificado del usuario + * @param x509Cert certificado que firmo el certificado expedido + */ + public static void check(X509Certificate issuerCert, X509Certificate x509Cert) throws FirmasException{ + + OutputStream out = null; + DataOutputStream dataOut =null; + InputStream in =null; + + try { + + BigInteger serialNumber = issuerCert.getSerialNumber(); + X509CertificateHolder holder; + + try { + holder = new X509CertificateHolder(x509Cert.getEncoded()); + } catch (IOException e) { + throw new RuntimeException(e); + } + + CertificateID id = new CertificateID(new JcaDigestCalculatorProviderBuilder().setProvider(BouncyCastleProvider.PROVIDER_NAME).build() + .get(CertificateID.HASH_SHA1), holder, serialNumber); + + OCSPReqBuilder ocspGen = new OCSPReqBuilder(); + ocspGen.addRequest(id); + OCSPReq ocspReq = ocspGen.build(); + + // Ir al OCSP + String ocspUrl = CertificateUtil.getOCSPURL(issuerCert); + + if (ocspUrl == null) { + APPLogger.getLogger().error("URL de OCSP is null"); + return; + } + + URL url; + + try { + url = new URL(ocspUrl); + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } + + HttpURLConnection con; + OCSPResp ocspResponse; + + + try { + con = (HttpURLConnection) url.openConnection(); + + con.setRequestProperty("Content-Type", "application/ocsp-request"); + con.setRequestProperty("Accept", "application/ocsp-response"); + con.setDoOutput(true); + out = con.getOutputStream(); + dataOut = new DataOutputStream(new BufferedOutputStream(out)); + + dataOut.write(ocspReq.getEncoded()); + + APPLogger.getLogger().info("Estado de respuesta de la peticion=" + con.getResponseCode()); + + /* + * Se parsea la respuesta y se obtiene el estado del certificado retornado por el OCSP + */ + in = (InputStream) con.getContent(); + byte[] resp = read(in); // Read the reponse + ocspResponse = new OCSPResp(resp); + + + } catch (IOException e) { + throw new FirmasException("FIR-0001", "ERROR AL ESTABLECER CONEXI\u00d3N AL SERVICIO: {0}", url); + } + + int status = ocspResponse.getStatus(); + APPLogger.getLogger().info("status=" + status); + + BasicOCSPResp basicResponse = (BasicOCSPResp) ocspResponse.getResponseObject(); + + if (basicResponse != null) { + SingleResp[] responses = basicResponse.getResponses(); + SingleResp response = responses[0]; + CertificateStatus certStatus = response.getCertStatus(); + + if (certStatus instanceof RevokedStatus) { + APPLogger.getLogger().error("REVOKED"); + RevokedStatus revokedStatus = (RevokedStatus) certStatus; + APPLogger.getLogger().error("Reason: " + revokedStatus.getRevocationReason()); + APPLogger.getLogger().error("Date: " + revokedStatus.getRevocationTime()); + + throw new FirmasException("FIR-0002", "ERROR, CERTIFICADO REVOCADO POR {0} CON FECHA {1}", revokedStatus.getRevocationReason(), + revokedStatus.getRevocationTime()); + } + } + } catch (OCSPException e) { + throw new RuntimeException(e); + } catch (CertificateEncodingException e) { + throw new RuntimeException(e); + } catch (OperatorCreationException e) { + throw new RuntimeException(e); + } + finally{ + try { + dataOut.close(); + if(in!=null) { + in.close(); + } + out.close(); + } catch (IOException e) {} + } + } + + /** + * Devuelve los nombres de firmas de un documento PDF + * + * @param docStream el documento a verificar + * @return un lista de nombres de firmas + */ + public static List obtainNameSigns(InputStream docStream) { + PdfReader docPdf = null; + try { + docPdf = new PdfReader(docStream); + AcroFields af = docPdf.getAcroFields(); + return af.getSignatureNames(); + } catch (IOException e) { + APPLogger.getLogger().error("Error al obtener los nombres del documentoss"); + return null; + } finally { + if(docPdf != null){ + docPdf.close(); + } + } + } + + /** + * Metodo para firmar documentos + * @param fileSrc + * @param usuario + * @param password + * @param compania + * @param reason + * @param location + * @param rectangle + * @param numPage + * @param nameSign + * @return + * @throws Exception + */ + public static byte[] sign(InputStream fileSrc, String usuario, String password, Integer compania, String reason, String location, + Rectangle rectangle, int numPage, String nameSign, String pathCertificate) throws Exception { + String path = pathCertificate; + FileInputStream ceritificateInputStream = new FileInputStream(path); + return sign(fileSrc, ceritificateInputStream, password, reason, location, false, true, rectangle, numPage, nameSign); + } + + /** + * Metodo para firmar documentos + * @param fileSrc + * @param usuario + * @param password + * @param compania + * @param reason + * @param location + * @param rectangle + * @param numPage + * @param nameSign + * @return + * @throws Exception + */ + public static byte[] sign(InputStream fileSrc, String usuario, String password, Integer compania, String reason, String location, + Rectangle rectangle, int numPage, String nameSign) throws Exception { + String path = getPath(usuario, compania); + FileInputStream ceritificateInputStream = new FileInputStream(path); + return sign(fileSrc, ceritificateInputStream, password, reason, location, false, true, rectangle, numPage, nameSign); + } + + /** + * Método que firma un documento en base los parámetros indicados + * + * @param fileSrc archivo origen + * @param fileCert archivo destino + * @param password contrasena + * @param reason razón o motivo de la firma. + * @param location localización coemtario adicional de la firma. + * @param withTS tiene TS estamapado de tiempo. + * @param withOCSP tiene OCSP verificacion de la firma por el la entidad certificadora BCE. + * @param rectangle lugar localizaci´n firma + * @param numPage número pagina + * @param nameSign nombre firma + * @return el documento firmado + */ + private static byte[] sign(InputStream fileSrc, InputStream fileCert, String password, String reason, String location, boolean withTS, + boolean withOCSP, Rectangle rectangle, int numPage, String nameSign) { + OutputStream outputStream =null; + PdfStamper stamper = null; + try { + PdfReader pdfReader = new PdfReader(fileSrc); + PDFRendererListener listener = new PDFRendererListener(); + Integer numberPage = pdfReader.getNumberOfPages(); + PdfReaderContentParser parser =new PdfReaderContentParser(pdfReader); + parser.processContent(numberPage, listener); + List listaI = listener.getListaImagenes(); + float llx = listaI.get(3).get(1);//50; + float lly = listaI.get(3).get(1);//210; + float urx = llx+250;//305; + float ury = lly+60;//277; + rectangle = new Rectangle(llx, lly, urx, ury); + + + outputStream = new ByteArrayOutputStream(512); + stamper = PdfStamper.createSignature(pdfReader, outputStream, '\0'); + PdfSignatureAppearance appearance = stamper.getSignatureAppearance(); + + KeyStore store = KeyStore.getInstance("PKCS12"); + store.load(fileCert, password.toCharArray()); + String alias = store.aliases().nextElement(); + ExternalSignature signature = new PrivateKeySignature((PrivateKey) store.getKey(alias, password.toCharArray()), DigestAlgorithms.SHA256, + "SunRsaSign"); + appearance.setLayer2Text(generateSignText(store.getCertificateChain(alias), reason, location)); + appearance.setLayer2Font(new Font(Font.FontFamily.UNDEFINED, 8F)); + appearance.setVisibleSignature(rectangle, numPage, nameSign); + TSAClient tsc = null; + if (withTS) { + + } + OcspClient ocsp = null; + if (withOCSP) { + ocsp = new OcspClientBouncyCastle(); + } + + ExternalDigest externalDigest = new BouncyCastleDigest(); + + MakeSignature.signDetached(appearance, externalDigest, signature, store.getCertificateChain(alias), null, ocsp, tsc, 15000, + CryptoStandard.CADES); + return ((ByteArrayOutputStream) outputStream).toByteArray(); + } catch (IOException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (DocumentException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (KeyStoreException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (NoSuchAlgorithmException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (CertificateException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (UnrecoverableKeyException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (GeneralSecurityException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } + finally{ + try{ + fileCert.close(); + fileSrc.close(); + try { + stamper.close(); + } catch (Exception e2) { + } + + if(outputStream!=null) { + outputStream.close(); + } + } + catch (IOException e){ + APPLogger.getLogger().error(e); + } + } + return null; + } + + public static byte[] sign(InputStream fileSrc, String usuario, String password, String reason, String location, + String nameSign, String pathCertificate, SignType signType) throws Exception { + String path = pathCertificate; + FileInputStream certificateInputStream = null; + try{ + certificateInputStream = new FileInputStream(path); + return positionSign(fileSrc, certificateInputStream, password, reason, location, false, true, nameSign,signType); + }finally{ + if(certificateInputStream !=null){ + certificateInputStream.close(); + } + } + + } + + /** + * Método que firma un documento en base los parámetros indicados + * @param fileSrc + * @param fileCert + * @param password + * @param reason + * @param location + * @param withTS + * @param withOCSP + * @param nameSign + * @param signType + * @return + */ + private static byte[] positionSign(InputStream fileSrc, InputStream fileCert, String password, String reason, String location, boolean withTS, + boolean withOCSP, String nameSign, SignType signType) { + OutputStream outputStream =null; + PdfStamper stamper = null; + try { + PdfReader pdfReader = new PdfReader(fileSrc); + PDFRendererListener listener = new PDFRendererListener(); + Integer numPage = pdfReader.getNumberOfPages(); + PdfReaderContentParser parser =new PdfReaderContentParser(pdfReader); + parser.processContent(numPage, listener); + List listaI = listener.getListaImagenes(); + float llx = listaI.get(listaI.size()-signType.getIndice()).get(0); + float lly = listaI.get(listaI.size()-signType.getIndice()).get(1); + float urx = llx+250;//305; + float ury = lly+60;//277; + Rectangle rectangle = new Rectangle(llx, lly, urx, ury); + outputStream = new ByteArrayOutputStream(512); + stamper = PdfStamper.createSignature(pdfReader, outputStream, '\0'); + PdfSignatureAppearance appearance = stamper.getSignatureAppearance(); + + KeyStore store = KeyStore.getInstance("PKCS12"); + store.load(fileCert, password.toCharArray()); + String alias = store.aliases().nextElement(); + ExternalSignature signature = new PrivateKeySignature((PrivateKey) store.getKey(alias, password.toCharArray()), DigestAlgorithms.SHA256, + "SunRsaSign"); + appearance.setLayer2Text(generateSignText(store.getCertificateChain(alias), reason, location)); + appearance.setLayer2Font(new Font(Font.FontFamily.UNDEFINED, 8F)); + appearance.setVisibleSignature(rectangle, numPage, nameSign); + TSAClient tsc = null; + if (withTS) { + + } + OcspClient ocsp = null; + if (withOCSP) { + ocsp = new OcspClientBouncyCastle(); + } + + ExternalDigest externalDigest = new BouncyCastleDigest(); + + MakeSignature.signDetached(appearance, externalDigest, signature, store.getCertificateChain(alias), null, ocsp, tsc, 15000, + CryptoStandard.CADES); + return ((ByteArrayOutputStream) outputStream).toByteArray(); + } catch (IOException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (DocumentException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (KeyStoreException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (NoSuchAlgorithmException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (CertificateException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (UnrecoverableKeyException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (GeneralSecurityException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } + finally{ + try{ + fileCert.close(); + fileSrc.close(); + try { + stamper.close(); + } catch (Exception e2) { + } + + if(outputStream!=null) { + outputStream.close(); + } + } + catch (IOException e){ + APPLogger.getLogger().error(e); + } + } + return null; + } + + /** + * Arma documento el texto a mostrar de la plantilla + * @param chains certificados + * @param reason razón + * @param location lugar + * @return una layout de la firma + */ + private static String generateSignText(Certificate[] chains, String reason, String location){ + StringBuffer textLayout = new StringBuffer("Firmado digitalmente por: "); + String name = null; + X500Name x500name = CertificateInfo.getSubjectFields((X509Certificate)chains[0]); + if (x500name != null) { + name = x500name.getField("CN"); + if (name == null) { + name = x500name.getField("E"); + } + } + if(name == null){ + name = ""; + } + textLayout.append(name).append("\n"); + if(reason != null){ + textLayout.append("Raz\u00f3n: ").append(reason).append("\n"); + } + /* + if(location != null){ + textLayout.append("Lugar: ").append(location).append("\n"); + } + */ + SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); + textLayout.append("Fecha: ").append(format.format(new Date(System.currentTimeMillis()))); + return textLayout.toString(); + } + + private static byte[] read(InputStream in) throws IOException { + ByteArrayOutputStream bos = null; + try { + bos = new ByteArrayOutputStream(); + int next = in.read(); + while (next > -1) { + bos.write(next); + next = in.read(); + } + bos.flush(); + + return bos.toByteArray(); + } finally { + if(in != null){ + in.close(); + } + if(bos != null){ + bos.close(); + } + } + + } + + /** + * Entrega el path en el que se encuentra el certificado digital. + * + * @param cusuario Codigo de usuario. + * @param ccompania Codigo de compania. + * @return String + * @throws Exception + */ + private static String getPath(String cusuario, Integer ccompania) throws Exception { + TfirmCertificado tfirmcertificado = getTfirmCertificado(cusuario); + TgeneParametersKey tgeneParametersKey = new TgeneParametersKey("PATH_CERTIFICADO_BCE", ccompania); + TgeneParameters tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), tgeneParametersKey); + String path = tgeneParameters.getTextvalue() + "/" + tfirmcertificado.getPk().getIdcertificado(); + return path; + } + + /** + * Sentencia que entrega la defincion vigente de un certificado digital para un usuario. + */ + private static final String JPQL = "from TfirmCertificado where t.codigousuario = :cusuario"; + + /** + * Entrega defincion de certificados digitales vigente. + * + * @param cusuario Codigo de usuario. + * @return TfirmCertificado. + * @throws Exception + */ + private static TfirmCertificado getTfirmCertificado(String cusuario) throws Exception { + TfirmCertificado tfirmCertificado = null; + Query qry = PersistenceHelper.getEntityManager().createQuery(JPQL); + qry.setParameter("cusuario", cusuario); + try { + tfirmCertificado = (TfirmCertificado) qry.getSingleResult(); + } catch (NoResultException e) { + throw new FirmasException("FIR-0001", "PARAMETROS DEL CERTIFICADO DIGITAL NO DEFINIDO PARA EL USUARIO: {0}", cusuario); + } + return tfirmCertificado; + } + + /** + * Método para validar el password ingresado + * @param path + * @param usuario + * @param password + * @param compania + * @return + * @throws Exception + */ + public static boolean validatePassword(String path, String usuario, + String password, Integer compania) { + FileInputStream certificateInputStream =null; + try { + certificateInputStream = new FileInputStream(path); + KeyStore ks = KeyStore.getInstance("PKCS12"); + ks.load(certificateInputStream, password.toCharArray()); + return true; + } catch (Exception e) { + return false; + }finally{ + try { + if(certificateInputStream!=null) + { + certificateInputStream.close(); + } + } catch (IOException e) {} + } + + } + +} diff --git a/base/core/firmas/src/main/java/com/fp/firmas/rules/common/.svn/text-base/PDFRendererListener.java.svn-base b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/.svn/text-base/PDFRendererListener.java.svn-base new file mode 100644 index 0000000..a755cd0 --- /dev/null +++ b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/.svn/text-base/PDFRendererListener.java.svn-base @@ -0,0 +1,69 @@ +/** + * + */ +package com.fp.firmas.rules.common; + +import java.util.ArrayList; +import java.util.List; + +import com.itextpdf.text.pdf.parser.ImageRenderInfo; +import com.itextpdf.text.pdf.parser.RenderListener; +import com.itextpdf.text.pdf.parser.TextRenderInfo; +import com.itextpdf.text.pdf.parser.Vector; + +/** + * @author Gbensvides + * + */ +public class PDFRendererListener implements RenderListener { + + /* (non-Javadoc) + * @see com.itextpdf.text.pdf.parser.RenderListener#beginTextBlock() + * + */ + + List listaImagenes = new ArrayList(); + + @Override + public void beginTextBlock() { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see com.itextpdf.text.pdf.parser.RenderListener#renderText(com.itextpdf.text.pdf.parser.TextRenderInfo) + */ + @Override + public void renderText(TextRenderInfo renderInfo) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see com.itextpdf.text.pdf.parser.RenderListener#endTextBlock() + */ + @Override + public void endTextBlock() { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see com.itextpdf.text.pdf.parser.RenderListener#renderImage(com.itextpdf.text.pdf.parser.ImageRenderInfo) + */ + @Override + public void renderImage(ImageRenderInfo renderInfo) { + // TODO Auto-generated method stub + listaImagenes.add(renderInfo.getStartPoint()); + + } + + public List getListaImagenes() { + return listaImagenes; + } + + public void setListaImagenes(List listaImagenes) { + this.listaImagenes = listaImagenes; + } + +} diff --git a/base/core/firmas/src/main/java/com/fp/firmas/rules/common/CertificateUtils.java b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/CertificateUtils.java new file mode 100644 index 0000000..25d73f8 --- /dev/null +++ b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/CertificateUtils.java @@ -0,0 +1,738 @@ +package com.fp.firmas.rules.common; + +import java.io.BufferedOutputStream; +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.math.BigInteger; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.Security; +import java.security.UnrecoverableKeyException; +import java.security.cert.Certificate; +import java.security.cert.CertificateEncodingException; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Enumeration; +import java.util.List; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import org.bouncycastle.cert.X509CertificateHolder; +import org.bouncycastle.cert.ocsp.BasicOCSPResp; +import org.bouncycastle.cert.ocsp.CertificateID; +import org.bouncycastle.cert.ocsp.CertificateStatus; +import org.bouncycastle.cert.ocsp.OCSPException; +import org.bouncycastle.cert.ocsp.OCSPReq; +import org.bouncycastle.cert.ocsp.OCSPReqBuilder; +import org.bouncycastle.cert.ocsp.OCSPResp; +import org.bouncycastle.cert.ocsp.RevokedStatus; +import org.bouncycastle.cert.ocsp.SingleResp; +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.bouncycastle.operator.OperatorCreationException; +import org.bouncycastle.operator.jcajce.JcaDigestCalculatorProviderBuilder; + +import com.fp.base.persistence.TfirmDatosFirmante; +import com.fp.common.logger.APPLogger; +import com.fp.firmas.rules.common.enumerator.SignType; +import com.fp.firmas.rules.common.exception.FirmasException; +import com.fp.firmas.rules.common.resources.FirmMessages; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pfirmas.param.TfirmCertificado; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; +import com.itextpdf.text.DocumentException; +import com.itextpdf.text.Font; +import com.itextpdf.text.Rectangle; +import com.itextpdf.text.pdf.AcroFields; +import com.itextpdf.text.pdf.PdfReader; +import com.itextpdf.text.pdf.PdfSignatureAppearance; +import com.itextpdf.text.pdf.PdfStamper; +import com.itextpdf.text.pdf.parser.PdfReaderContentParser; +import com.itextpdf.text.pdf.parser.Vector; +import com.itextpdf.text.pdf.security.BouncyCastleDigest; +import com.itextpdf.text.pdf.security.CertificateInfo; +import com.itextpdf.text.pdf.security.CertificateInfo.X500Name; +import com.itextpdf.text.pdf.security.CertificateUtil; +import com.itextpdf.text.pdf.security.DigestAlgorithms; +import com.itextpdf.text.pdf.security.ExternalDigest; +import com.itextpdf.text.pdf.security.ExternalSignature; +import com.itextpdf.text.pdf.security.MakeSignature; +import com.itextpdf.text.pdf.security.MakeSignature.CryptoStandard; +import com.itextpdf.text.pdf.security.OcspClient; +import com.itextpdf.text.pdf.security.OcspClientBouncyCastle; +import com.itextpdf.text.pdf.security.PrivateKeySignature; +import com.itextpdf.text.pdf.security.TSAClient; + +/** + * Clase que contiene metodos utilitarios para manejar certificados + * + * @author dcruz + * + */ +public class CertificateUtils { + + /* + * CONSTANTES DESIGNADAS SEGUN LA NUEVA ESTRUCTURA DEL BCE + */ + // OIDs de Campos del Certificado: + public static final String OID_CEDULA_PASAPORTE = FirmMessages.getString("oid.cedula_pasaporte"); + + public static final String OID_NOMBRES = FirmMessages.getString("oid.nombres_persona"); + + public static final String OID_APELLIDO_1 = FirmMessages.getString("oid.apellido_persona1"); + + public static final String OID_APELLIDO_2 = FirmMessages.getString("oid.apellido_persona2"); + + public static final String OID_CARGO = FirmMessages.getString("oid.cargo"); + + public static final String OID_INSTITUCION = FirmMessages.getString("oid.institucion"); + + public static final String OID_DIRECCION = FirmMessages.getString("oid.direccion"); + + public static final String OID_TELEFONO = FirmMessages.getString("oid.telefono"); + + public static final String OID_CIUDAD = FirmMessages.getString("oid.ciudad"); + + public static final String OID_RAZON_SOCIAL = FirmMessages.getString("oid.razon_social"); + + public static final String OID_RUC = FirmMessages.getString("oid.ruc"); + + public static final String X509 = "X.509"; + + static { + BouncyCastleProvider provider = new BouncyCastleProvider(); + Security.addProvider(provider); + } + + /** + * Retorna el certificado del usuario contenido en la firma + * + * @param store el store en el que se va a buscar los certificados + * @param aliases los alias que estan dentro del keystore + * @return el {@link java.security.Certificate} + * @throws KeyStoreException + */ + public synchronized static Certificate obtainCertificateInAlias(KeyStore store, Enumeration aliases) throws KeyStoreException { + Certificate certs[] = null; + synchronized (aliases) { + int i = 0; + while (aliases.hasMoreElements()) { + String alias = aliases.nextElement(); + //System.out.println("Se imprime los alias: " + i + " " + alias); + certs = store.getCertificateChain(alias); + for (int j = 0; j < certs.length; j++) { + X509Certificate certificate = (X509Certificate) certs[j]; + boolean[] usages = certificate.getKeyUsage(); + // System.out.println("Certificado en primera posicion usado: " + j + " " + usages[0]); + if (usages[0]) { + return certificate; + } + } + i++; + } + + } + return null; + } + + /** + * Se devuelve todos los datos de la firma del usuario en base al certificado enviado + * + * @param certificate el certificado enviado + * @return Los datos del certificado de dicho usuario + */ + public static TfirmDatosFirmante obtainDataForCertificate(Certificate certificate) { + X509Certificate signedCertificate = (X509Certificate) certificate; + TfirmDatosFirmante datosFirmante = new TfirmDatosFirmante(); + if (signedCertificate.getExtensionValue(OID_CEDULA_PASAPORTE) != null) { + datosFirmante.setIdentificacion(new String(signedCertificate.getExtensionValue(OID_CEDULA_PASAPORTE)).trim()); + } + if (signedCertificate.getExtensionValue(OID_NOMBRES) != null) { + datosFirmante.setNombre(new String(signedCertificate.getExtensionValue(OID_NOMBRES)).trim()); + } + if (signedCertificate.getExtensionValue(OID_APELLIDO_1) != null) { + datosFirmante.setApellido1(new String(signedCertificate.getExtensionValue(OID_APELLIDO_1)).trim()); + if (signedCertificate.getExtensionValue(OID_APELLIDO_2) != null) { + datosFirmante.setApellido2(new String(signedCertificate.getExtensionValue(OID_APELLIDO_2)).trim()); + } else { + datosFirmante.setApellido2(""); + } + } + if (signedCertificate.getExtensionValue(OID_TELEFONO) != null) { + datosFirmante.setTelefono(new String(signedCertificate.getExtensionValue(OID_TELEFONO)).trim()); + } + if (signedCertificate.getExtensionValue(OID_CARGO) != null) { + datosFirmante.setCargo(new String(signedCertificate.getExtensionValue(OID_CARGO)).trim()); + } + if (signedCertificate.getExtensionValue(OID_CIUDAD) != null) { + datosFirmante.setCiudad(new String(signedCertificate.getExtensionValue(OID_CIUDAD)).trim()); + } + if (signedCertificate.getExtensionValue(OID_DIRECCION) != null) { + datosFirmante.setDireccion(new String(signedCertificate.getExtensionValue(OID_DIRECCION)).trim()); + } + if (signedCertificate.getExtensionValue(OID_INSTITUCION) != null) { + datosFirmante.setInstitucion(new String(signedCertificate.getExtensionValue(OID_INSTITUCION)).trim()); + } + if (signedCertificate.getExtensionValue(OID_RAZON_SOCIAL) != null) { + datosFirmante.setInstitucion(new String(signedCertificate.getExtensionValue(OID_RAZON_SOCIAL)).trim()); + } + if (signedCertificate.getExtensionValue(OID_RUC) != null) { + datosFirmante.setRuc(new String(signedCertificate.getExtensionValue(OID_RUC)).trim()); + } + datosFirmante.setFechaInicioVigencia(signedCertificate.getNotBefore()); + datosFirmante.setFechaVigencia(signedCertificate.getNotAfter()); + return datosFirmante; + } + + /** + * Valida que el certificado del usuario sea un certificado valido contra el servicio OCSP del proveedor + * + * @param certificateUser + * @throws FileNotFoundException + * @throws CertificateException + */ + public static void validateOcsCertificate(Certificate certificateUser) throws FileNotFoundException, CertificateException, FirmasException{ + // System.out.println(((X509Certificate) certificateUser).getIssuerDN().getName()); + CertificateFactory cf = CertificateFactory.getInstance(X509); + InputStream subordStream = new FileInputStream(FirmMessages.getString("dir.ruta.base.repositorio") + "/" + + FirmMessages.getString("nombre.certificado.subordinado")); + X509Certificate subordCertificate = (X509Certificate) cf.generateCertificate(subordStream); + check((X509Certificate) certificateUser, subordCertificate); + try{ + subordStream.close(); + }catch(Exception e){} + } + + /** + * Valida que los certificados enviados sean validos por la entidad certificadora + * + * @param issuerCert certificado del usuario + * @param x509Cert certificado que firmo el certificado expedido + */ + public static void check(X509Certificate issuerCert, X509Certificate x509Cert) throws FirmasException{ + + OutputStream out = null; + DataOutputStream dataOut =null; + InputStream in =null; + + try { + + BigInteger serialNumber = issuerCert.getSerialNumber(); + X509CertificateHolder holder; + + try { + holder = new X509CertificateHolder(x509Cert.getEncoded()); + } catch (IOException e) { + throw new RuntimeException(e); + } + + CertificateID id = new CertificateID(new JcaDigestCalculatorProviderBuilder().setProvider(BouncyCastleProvider.PROVIDER_NAME).build() + .get(CertificateID.HASH_SHA1), holder, serialNumber); + + OCSPReqBuilder ocspGen = new OCSPReqBuilder(); + ocspGen.addRequest(id); + OCSPReq ocspReq = ocspGen.build(); + + // Ir al OCSP + String ocspUrl = CertificateUtil.getOCSPURL(issuerCert); + + if (ocspUrl == null) { + APPLogger.getLogger().error("URL de OCSP is null"); + return; + } + + URL url; + + try { + url = new URL(ocspUrl); + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } + + HttpURLConnection con; + OCSPResp ocspResponse; + + + try { + con = (HttpURLConnection) url.openConnection(); + + con.setRequestProperty("Content-Type", "application/ocsp-request"); + con.setRequestProperty("Accept", "application/ocsp-response"); + con.setDoOutput(true); + out = con.getOutputStream(); + dataOut = new DataOutputStream(new BufferedOutputStream(out)); + + dataOut.write(ocspReq.getEncoded()); + + APPLogger.getLogger().info("Estado de respuesta de la peticion=" + con.getResponseCode()); + + /* + * Se parsea la respuesta y se obtiene el estado del certificado retornado por el OCSP + */ + in = (InputStream) con.getContent(); + byte[] resp = read(in); // Read the reponse + ocspResponse = new OCSPResp(resp); + + + } catch (IOException e) { + throw new FirmasException("FIR-0001", "ERROR AL ESTABLECER CONEXI\u00d3N AL SERVICIO: {0}", url); + } + + int status = ocspResponse.getStatus(); + APPLogger.getLogger().info("status=" + status); + + BasicOCSPResp basicResponse = (BasicOCSPResp) ocspResponse.getResponseObject(); + + if (basicResponse != null) { + SingleResp[] responses = basicResponse.getResponses(); + SingleResp response = responses[0]; + CertificateStatus certStatus = response.getCertStatus(); + + if (certStatus instanceof RevokedStatus) { + APPLogger.getLogger().error("REVOKED"); + RevokedStatus revokedStatus = (RevokedStatus) certStatus; + APPLogger.getLogger().error("Reason: " + revokedStatus.getRevocationReason()); + APPLogger.getLogger().error("Date: " + revokedStatus.getRevocationTime()); + + throw new FirmasException("FIR-0002", "ERROR, CERTIFICADO REVOCADO POR {0} CON FECHA {1}", revokedStatus.getRevocationReason(), + revokedStatus.getRevocationTime()); + } + } + } catch (OCSPException e) { + throw new RuntimeException(e); + } catch (CertificateEncodingException e) { + throw new RuntimeException(e); + } catch (OperatorCreationException e) { + throw new RuntimeException(e); + } + finally{ + try { + dataOut.close(); + if(in!=null) { + in.close(); + } + out.close(); + } catch (IOException e) {} + } + } + + /** + * Devuelve los nombres de firmas de un documento PDF + * + * @param docStream el documento a verificar + * @return un lista de nombres de firmas + */ + public static List obtainNameSigns(InputStream docStream) { + PdfReader docPdf = null; + try { + docPdf = new PdfReader(docStream); + AcroFields af = docPdf.getAcroFields(); + return af.getSignatureNames(); + } catch (IOException e) { + APPLogger.getLogger().error("Error al obtener los nombres del documentoss"); + return null; + } finally { + if(docPdf != null){ + docPdf.close(); + } + } + } + + /** + * Metodo para firmar documentos + * @param fileSrc + * @param usuario + * @param password + * @param compania + * @param reason + * @param location + * @param rectangle + * @param numPage + * @param nameSign + * @return + * @throws Exception + */ + public static byte[] sign(InputStream fileSrc, String usuario, String password, Integer compania, String reason, String location, + Rectangle rectangle, int numPage, String nameSign, String pathCertificate) throws Exception { + String path = pathCertificate; + FileInputStream ceritificateInputStream = new FileInputStream(path); + return sign(fileSrc, ceritificateInputStream, password, reason, location, false, true, rectangle, numPage, nameSign); + } + + /** + * Metodo para firmar documentos + * @param fileSrc + * @param usuario + * @param password + * @param compania + * @param reason + * @param location + * @param rectangle + * @param numPage + * @param nameSign + * @return + * @throws Exception + */ + public static byte[] sign(InputStream fileSrc, String usuario, String password, Integer compania, String reason, String location, + Rectangle rectangle, int numPage, String nameSign) throws Exception { + String path = getPath(usuario, compania); + FileInputStream ceritificateInputStream = new FileInputStream(path); + return sign(fileSrc, ceritificateInputStream, password, reason, location, false, true, rectangle, numPage, nameSign); + } + + /** + * Método que firma un documento en base los parámetros indicados + * + * @param fileSrc archivo origen + * @param fileCert archivo destino + * @param password contrasena + * @param reason razón o motivo de la firma. + * @param location localización coemtario adicional de la firma. + * @param withTS tiene TS estamapado de tiempo. + * @param withOCSP tiene OCSP verificacion de la firma por el la entidad certificadora BCE. + * @param rectangle lugar localizaci´n firma + * @param numPage número pagina + * @param nameSign nombre firma + * @return el documento firmado + */ + private static byte[] sign(InputStream fileSrc, InputStream fileCert, String password, String reason, String location, boolean withTS, + boolean withOCSP, Rectangle rectangle, int numPage, String nameSign) { + OutputStream outputStream =null; + PdfStamper stamper = null; + try { + PdfReader pdfReader = new PdfReader(fileSrc); + PDFRendererListener listener = new PDFRendererListener(); + Integer numberPage = pdfReader.getNumberOfPages(); + PdfReaderContentParser parser =new PdfReaderContentParser(pdfReader); + parser.processContent(numberPage, listener); + List listaI = listener.getListaImagenes(); + float llx = listaI.get(3).get(1);//50; + float lly = listaI.get(3).get(1);//210; + float urx = llx+250;//305; + float ury = lly+60;//277; + rectangle = new Rectangle(llx, lly, urx, ury); + + + outputStream = new ByteArrayOutputStream(512); + stamper = PdfStamper.createSignature(pdfReader, outputStream, '\0'); + PdfSignatureAppearance appearance = stamper.getSignatureAppearance(); + + KeyStore store = KeyStore.getInstance("PKCS12"); + store.load(fileCert, password.toCharArray()); + String alias = store.aliases().nextElement(); + ExternalSignature signature = new PrivateKeySignature((PrivateKey) store.getKey(alias, password.toCharArray()), DigestAlgorithms.SHA256, + "SunRsaSign"); + appearance.setLayer2Text(generateSignText(store.getCertificateChain(alias), reason, location)); + appearance.setLayer2Font(new Font(Font.FontFamily.UNDEFINED, 8F)); + appearance.setVisibleSignature(rectangle, numPage, nameSign); + TSAClient tsc = null; + if (withTS) { + + } + OcspClient ocsp = null; + if (withOCSP) { + ocsp = new OcspClientBouncyCastle(); + } + + ExternalDigest externalDigest = new BouncyCastleDigest(); + + MakeSignature.signDetached(appearance, externalDigest, signature, store.getCertificateChain(alias), null, ocsp, tsc, 15000, + CryptoStandard.CADES); + return ((ByteArrayOutputStream) outputStream).toByteArray(); + } catch (IOException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (DocumentException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (KeyStoreException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (NoSuchAlgorithmException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (CertificateException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (UnrecoverableKeyException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (GeneralSecurityException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } + finally{ + try{ + fileCert.close(); + fileSrc.close(); + try { + stamper.close(); + } catch (Exception e2) { + } + + if(outputStream!=null) { + outputStream.close(); + } + } + catch (IOException e){ + APPLogger.getLogger().error(e); + } + } + return null; + } + + public static byte[] sign(InputStream fileSrc, String usuario, String password, String reason, String location, + String nameSign, String pathCertificate, SignType signType) throws Exception { + String path = pathCertificate; + FileInputStream certificateInputStream = null; + try{ + certificateInputStream = new FileInputStream(path); + return positionSign(fileSrc, certificateInputStream, password, reason, location, false, true, nameSign,signType); + }finally{ + if(certificateInputStream !=null){ + certificateInputStream.close(); + } + } + + } + + /** + * Método que firma un documento en base los parámetros indicados + * @param fileSrc + * @param fileCert + * @param password + * @param reason + * @param location + * @param withTS + * @param withOCSP + * @param nameSign + * @param signType + * @return + */ + private static byte[] positionSign(InputStream fileSrc, InputStream fileCert, String password, String reason, String location, boolean withTS, + boolean withOCSP, String nameSign, SignType signType) { + OutputStream outputStream =null; + PdfStamper stamper = null; + try { + PdfReader pdfReader = new PdfReader(fileSrc); + PDFRendererListener listener = new PDFRendererListener(); + Integer numPage = pdfReader.getNumberOfPages(); + PdfReaderContentParser parser =new PdfReaderContentParser(pdfReader); + parser.processContent(numPage, listener); + List listaI = listener.getListaImagenes(); + float llx = listaI.get(listaI.size()-signType.getIndice()).get(0); + float lly = listaI.get(listaI.size()-signType.getIndice()).get(1); + float urx = llx+250;//305; + float ury = lly+60;//277; + Rectangle rectangle = new Rectangle(llx, lly, urx, ury); + outputStream = new ByteArrayOutputStream(512); + stamper = PdfStamper.createSignature(pdfReader, outputStream, '\0'); + PdfSignatureAppearance appearance = stamper.getSignatureAppearance(); + + KeyStore store = KeyStore.getInstance("PKCS12"); + store.load(fileCert, password.toCharArray()); + String alias = store.aliases().nextElement(); + ExternalSignature signature = new PrivateKeySignature((PrivateKey) store.getKey(alias, password.toCharArray()), DigestAlgorithms.SHA256, + "SunRsaSign"); + appearance.setLayer2Text(generateSignText(store.getCertificateChain(alias), reason, location)); + appearance.setLayer2Font(new Font(Font.FontFamily.UNDEFINED, 8F)); + appearance.setVisibleSignature(rectangle, numPage, nameSign); + TSAClient tsc = null; + if (withTS) { + + } + OcspClient ocsp = null; + if (withOCSP) { + ocsp = new OcspClientBouncyCastle(); + } + + ExternalDigest externalDigest = new BouncyCastleDigest(); + + MakeSignature.signDetached(appearance, externalDigest, signature, store.getCertificateChain(alias), null, ocsp, tsc, 15000, + CryptoStandard.CADES); + return ((ByteArrayOutputStream) outputStream).toByteArray(); + } catch (IOException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (DocumentException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (KeyStoreException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (NoSuchAlgorithmException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (CertificateException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (UnrecoverableKeyException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } catch (GeneralSecurityException e) { + APPLogger.getLogger().error(e); + e.printStackTrace(); + } + finally{ + try{ + fileCert.close(); + fileSrc.close(); + try { + stamper.close(); + } catch (Exception e2) { + } + + if(outputStream!=null) { + outputStream.close(); + } + } + catch (IOException e){ + APPLogger.getLogger().error(e); + } + } + return null; + } + + /** + * Arma documento el texto a mostrar de la plantilla + * @param chains certificados + * @param reason razón + * @param location lugar + * @return una layout de la firma + */ + private static String generateSignText(Certificate[] chains, String reason, String location){ + StringBuffer textLayout = new StringBuffer("Firmado digitalmente por: "); + String name = null; + X500Name x500name = CertificateInfo.getSubjectFields((X509Certificate)chains[0]); + if (x500name != null) { + name = x500name.getField("CN"); + if (name == null) { + name = x500name.getField("E"); + } + } + if(name == null){ + name = ""; + } + textLayout.append(name).append("\n"); + if(reason != null){ + textLayout.append("Raz\u00f3n: ").append(reason).append("\n"); + } + /* + if(location != null){ + textLayout.append("Lugar: ").append(location).append("\n"); + } + */ + SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); + textLayout.append("Fecha: ").append(format.format(new Date(System.currentTimeMillis()))); + return textLayout.toString(); + } + + private static byte[] read(InputStream in) throws IOException { + ByteArrayOutputStream bos = null; + try { + bos = new ByteArrayOutputStream(); + int next = in.read(); + while (next > -1) { + bos.write(next); + next = in.read(); + } + bos.flush(); + + return bos.toByteArray(); + } finally { + if(in != null){ + in.close(); + } + if(bos != null){ + bos.close(); + } + } + + } + + /** + * Entrega el path en el que se encuentra el certificado digital. + * + * @param cusuario Codigo de usuario. + * @param ccompania Codigo de compania. + * @return String + * @throws Exception + */ + private static String getPath(String cusuario, Integer ccompania) throws Exception { + TfirmCertificado tfirmcertificado = getTfirmCertificado(cusuario); + TgeneParametersKey tgeneParametersKey = new TgeneParametersKey("PATH_CERTIFICADO_BCE", ccompania); + TgeneParameters tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), tgeneParametersKey); + String path = tgeneParameters.getTextvalue() + "/" + tfirmcertificado.getPk().getIdcertificado(); + return path; + } + + /** + * Sentencia que entrega la defincion vigente de un certificado digital para un usuario. + */ + private static final String JPQL = "from TfirmCertificado where t.codigousuario = :cusuario"; + + /** + * Entrega defincion de certificados digitales vigente. + * + * @param cusuario Codigo de usuario. + * @return TfirmCertificado. + * @throws Exception + */ + private static TfirmCertificado getTfirmCertificado(String cusuario) throws Exception { + TfirmCertificado tfirmCertificado = null; + Query qry = PersistenceHelper.getEntityManager().createQuery(JPQL); + qry.setParameter("cusuario", cusuario); + try { + tfirmCertificado = (TfirmCertificado) qry.getSingleResult(); + } catch (NoResultException e) { + throw new FirmasException("FIR-0001", "PARAMETROS DEL CERTIFICADO DIGITAL NO DEFINIDO PARA EL USUARIO: {0}", cusuario); + } + return tfirmCertificado; + } + + /** + * Método para validar el password ingresado + * @param path + * @param usuario + * @param password + * @param compania + * @return + * @throws Exception + */ + public static boolean validatePassword(String path, String usuario, + String password, Integer compania) { + FileInputStream certificateInputStream =null; + try { + certificateInputStream = new FileInputStream(path); + KeyStore ks = KeyStore.getInstance("PKCS12"); + ks.load(certificateInputStream, password.toCharArray()); + return true; + } catch (Exception e) { + return false; + }finally{ + try { + if(certificateInputStream!=null) + { + certificateInputStream.close(); + } + } catch (IOException e) {} + } + + } + +} diff --git a/base/core/firmas/src/main/java/com/fp/firmas/rules/common/PDFRendererListener.java b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/PDFRendererListener.java new file mode 100644 index 0000000..a755cd0 --- /dev/null +++ b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/PDFRendererListener.java @@ -0,0 +1,69 @@ +/** + * + */ +package com.fp.firmas.rules.common; + +import java.util.ArrayList; +import java.util.List; + +import com.itextpdf.text.pdf.parser.ImageRenderInfo; +import com.itextpdf.text.pdf.parser.RenderListener; +import com.itextpdf.text.pdf.parser.TextRenderInfo; +import com.itextpdf.text.pdf.parser.Vector; + +/** + * @author Gbensvides + * + */ +public class PDFRendererListener implements RenderListener { + + /* (non-Javadoc) + * @see com.itextpdf.text.pdf.parser.RenderListener#beginTextBlock() + * + */ + + List listaImagenes = new ArrayList(); + + @Override + public void beginTextBlock() { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see com.itextpdf.text.pdf.parser.RenderListener#renderText(com.itextpdf.text.pdf.parser.TextRenderInfo) + */ + @Override + public void renderText(TextRenderInfo renderInfo) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see com.itextpdf.text.pdf.parser.RenderListener#endTextBlock() + */ + @Override + public void endTextBlock() { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see com.itextpdf.text.pdf.parser.RenderListener#renderImage(com.itextpdf.text.pdf.parser.ImageRenderInfo) + */ + @Override + public void renderImage(ImageRenderInfo renderInfo) { + // TODO Auto-generated method stub + listaImagenes.add(renderInfo.getStartPoint()); + + } + + public List getListaImagenes() { + return listaImagenes; + } + + public void setListaImagenes(List listaImagenes) { + this.listaImagenes = listaImagenes; + } + +} diff --git a/base/core/firmas/src/main/java/com/fp/firmas/rules/common/enumerator/.svn/entries b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/enumerator/.svn/entries new file mode 100644 index 0000000..a6c629e --- /dev/null +++ b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/enumerator/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/firmas/src/main/java/com/fp/firmas/rules/common/enumerator +svn://172.17.26.185/COMACO + + + +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +SignType.java +file + + + + +2022-07-28T03:40:36.803777Z +8eeea6e36a67dad9a44f3493e2bb7c0b +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + + + + + + + + +291 + diff --git a/base/core/firmas/src/main/java/com/fp/firmas/rules/common/enumerator/.svn/text-base/SignType.java.svn-base b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/enumerator/.svn/text-base/SignType.java.svn-base new file mode 100644 index 0000000..5a0c2dc --- /dev/null +++ b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/enumerator/.svn/text-base/SignType.java.svn-base @@ -0,0 +1,21 @@ +package com.fp.firmas.rules.common.enumerator; + +public enum SignType { + + EMPLEADO(3), + JEFE(2), + SUPERVISOR(1), + JEFE_INFORME(1), + SUPERVISOR_INFORME(2); + + private int cargo; + + private SignType(int a){ + cargo = a; + } + + public int getIndice() { + return cargo; + } + +} diff --git a/base/core/firmas/src/main/java/com/fp/firmas/rules/common/enumerator/SignType.java b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/enumerator/SignType.java new file mode 100644 index 0000000..5a0c2dc --- /dev/null +++ b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/enumerator/SignType.java @@ -0,0 +1,21 @@ +package com.fp.firmas.rules.common.enumerator; + +public enum SignType { + + EMPLEADO(3), + JEFE(2), + SUPERVISOR(1), + JEFE_INFORME(1), + SUPERVISOR_INFORME(2); + + private int cargo; + + private SignType(int a){ + cargo = a; + } + + public int getIndice() { + return cargo; + } + +} diff --git a/base/core/firmas/src/main/java/com/fp/firmas/rules/common/exception/.svn/entries b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/exception/.svn/entries new file mode 100644 index 0000000..a6fa0ea --- /dev/null +++ b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/exception/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/firmas/src/main/java/com/fp/firmas/rules/common/exception +svn://172.17.26.185/COMACO + + + +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +FirmasException.java +file + + + + +2022-07-28T03:40:36.860778Z +a24f08f02df905811e925b5d343fde3e +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + + + + + + + + +853 + diff --git a/base/core/firmas/src/main/java/com/fp/firmas/rules/common/exception/.svn/text-base/FirmasException.java.svn-base b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/exception/.svn/text-base/FirmasException.java.svn-base new file mode 100644 index 0000000..8b27c9b --- /dev/null +++ b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/exception/.svn/text-base/FirmasException.java.svn-base @@ -0,0 +1,38 @@ +package com.fp.firmas.rules.common.exception; + +import com.fp.common.exception.APPException; + +/** + * Clase que manejará todos los errores relacionados con la firma digital + * + * @author dcruz + * + */ +public class FirmasException extends APPException { + + + private static final long serialVersionUID = -599185902882644036L; + + /** + * Crea una instancia de {@link FirmasException} + * @param code + * @param message + * @param pCause + * @param pParameters + */ + public FirmasException(String code, String message, Exception pCause, + Object... pParameters) { + super(code, message, pCause, pParameters); + } + + /** + * Crea una instancia de {@link FirmasException} + * @param code + * @param message + * @param pParameters + */ + public FirmasException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } + +} diff --git a/base/core/firmas/src/main/java/com/fp/firmas/rules/common/exception/FirmasException.java b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/exception/FirmasException.java new file mode 100644 index 0000000..8b27c9b --- /dev/null +++ b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/exception/FirmasException.java @@ -0,0 +1,38 @@ +package com.fp.firmas.rules.common.exception; + +import com.fp.common.exception.APPException; + +/** + * Clase que manejará todos los errores relacionados con la firma digital + * + * @author dcruz + * + */ +public class FirmasException extends APPException { + + + private static final long serialVersionUID = -599185902882644036L; + + /** + * Crea una instancia de {@link FirmasException} + * @param code + * @param message + * @param pCause + * @param pParameters + */ + public FirmasException(String code, String message, Exception pCause, + Object... pParameters) { + super(code, message, pCause, pParameters); + } + + /** + * Crea una instancia de {@link FirmasException} + * @param code + * @param message + * @param pParameters + */ + public FirmasException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } + +} diff --git a/base/core/firmas/src/main/java/com/fp/firmas/rules/common/resources/.svn/entries b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/resources/.svn/entries new file mode 100644 index 0000000..ab86ff8 --- /dev/null +++ b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/resources/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/firmas/src/main/java/com/fp/firmas/rules/common/resources +svn://172.17.26.185/COMACO + + + +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +FirmMessages.java +file + + + + +2022-07-28T03:40:36.838777Z +01a26b97f7ae7710077a63b917f63c52 +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + + + + + + + + +378 + diff --git a/base/core/firmas/src/main/java/com/fp/firmas/rules/common/resources/.svn/text-base/FirmMessages.java.svn-base b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/resources/.svn/text-base/FirmMessages.java.svn-base new file mode 100644 index 0000000..33d2335 --- /dev/null +++ b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/resources/.svn/text-base/FirmMessages.java.svn-base @@ -0,0 +1,19 @@ +package com.fp.firmas.rules.common.resources; + +import java.util.ResourceBundle; + +public class FirmMessages { + + private final static String RESOURCE = "firmessages_es"; + + private final static ResourceBundle firmessages; + + static{ + firmessages = ResourceBundle.getBundle(RESOURCE); + } + + public static String getString(String key) { + return firmessages.getString(key); + } + +} diff --git a/base/core/firmas/src/main/java/com/fp/firmas/rules/common/resources/FirmMessages.java b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/resources/FirmMessages.java new file mode 100644 index 0000000..33d2335 --- /dev/null +++ b/base/core/firmas/src/main/java/com/fp/firmas/rules/common/resources/FirmMessages.java @@ -0,0 +1,19 @@ +package com.fp.firmas.rules.common.resources; + +import java.util.ResourceBundle; + +public class FirmMessages { + + private final static String RESOURCE = "firmessages_es"; + + private final static ResourceBundle firmessages; + + static{ + firmessages = ResourceBundle.getBundle(RESOURCE); + } + + public static String getString(String key) { + return firmessages.getString(key); + } + +} diff --git a/base/core/firmas/src/main/java/com/fp/firmas/rules/query/.svn/entries b/base/core/firmas/src/main/java/com/fp/firmas/rules/query/.svn/entries new file mode 100644 index 0000000..690e828 --- /dev/null +++ b/base/core/firmas/src/main/java/com/fp/firmas/rules/query/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/firmas/src/main/java/com/fp/firmas/rules/query +svn://172.17.26.185/COMACO + + + +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +UsuarioCertificado.java +file + + + + +2022-07-28T03:40:36.745777Z +cba4c4b131b0ed3ad6afad14cb392659 +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + + + + + + + + +1720 + diff --git a/base/core/firmas/src/main/java/com/fp/firmas/rules/query/.svn/text-base/UsuarioCertificado.java.svn-base b/base/core/firmas/src/main/java/com/fp/firmas/rules/query/.svn/text-base/UsuarioCertificado.java.svn-base new file mode 100644 index 0000000..d559f0f --- /dev/null +++ b/base/core/firmas/src/main/java/com/fp/firmas/rules/query/.svn/text-base/UsuarioCertificado.java.svn-base @@ -0,0 +1,46 @@ +package com.fp.firmas.rules.query; + +import java.util.Date; +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pfirmas.param.TfirmCertificado; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; + +/** + * Completa información del usuario a desplegar en la grilla de consulta de datos del funcionario + * + * @author dcruz + * + */ +public class UsuarioCertificado extends QueryRule { + + private static final long serialVersionUID = 1L; + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest queryRequest) throws Exception { + QueryJsf queryJsf = new QueryJsf(); + queryJsf.execute(queryRequest); + List certificadosUsuList = (List) queryRequest.getResponse().get("USUARIOCERTIFICADOS"); + completaDatosConsulta(certificadosUsuList); + return queryRequest; + } + + private void completaDatosConsulta(List certificadoList) throws Exception{ + if(certificadoList != null && !certificadoList.isEmpty()){ + for (TfirmCertificado tfirmCertificado : certificadoList) { + //completamos la informacion faltante de los certificados + EmpleadoJpql emJpql = new EmpleadoJpql(); + Empleado empleado = emJpql.findPorUsuarioWeb(tfirmCertificado.getCodigousuario()); + tfirmCertificado.modifiedData.put("nom_servidor", empleado.getNombre()); + tfirmCertificado.modifiedData.put("estado_certificado", tfirmCertificado.getPk().getFcaducidad().compareTo(new Date(System.currentTimeMillis())) >=0 ? "VIGENTE":"CADUCADO"); + tfirmCertificado.setCargo(empleado.getCargo()); + } + } + } + +} diff --git a/base/core/firmas/src/main/java/com/fp/firmas/rules/query/UsuarioCertificado.java b/base/core/firmas/src/main/java/com/fp/firmas/rules/query/UsuarioCertificado.java new file mode 100644 index 0000000..d559f0f --- /dev/null +++ b/base/core/firmas/src/main/java/com/fp/firmas/rules/query/UsuarioCertificado.java @@ -0,0 +1,46 @@ +package com.fp.firmas.rules.query; + +import java.util.Date; +import java.util.List; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.query.QueryRequest; +import com.fp.dto.rules.QueryRule; +import com.fp.persistence.pfirmas.param.TfirmCertificado; +import com.fp.persistence.pviaticos.hra.Empleado; +import com.fp.persistence.pviaticos.hra.EmpleadoJpql; + +/** + * Completa información del usuario a desplegar en la grilla de consulta de datos del funcionario + * + * @author dcruz + * + */ +public class UsuarioCertificado extends QueryRule { + + private static final long serialVersionUID = 1L; + + @SuppressWarnings("unchecked") + @Override + public QueryRequest process(QueryRequest queryRequest) throws Exception { + QueryJsf queryJsf = new QueryJsf(); + queryJsf.execute(queryRequest); + List certificadosUsuList = (List) queryRequest.getResponse().get("USUARIOCERTIFICADOS"); + completaDatosConsulta(certificadosUsuList); + return queryRequest; + } + + private void completaDatosConsulta(List certificadoList) throws Exception{ + if(certificadoList != null && !certificadoList.isEmpty()){ + for (TfirmCertificado tfirmCertificado : certificadoList) { + //completamos la informacion faltante de los certificados + EmpleadoJpql emJpql = new EmpleadoJpql(); + Empleado empleado = emJpql.findPorUsuarioWeb(tfirmCertificado.getCodigousuario()); + tfirmCertificado.modifiedData.put("nom_servidor", empleado.getNombre()); + tfirmCertificado.modifiedData.put("estado_certificado", tfirmCertificado.getPk().getFcaducidad().compareTo(new Date(System.currentTimeMillis())) >=0 ? "VIGENTE":"CADUCADO"); + tfirmCertificado.setCargo(empleado.getCargo()); + } + } + } + +} diff --git a/base/core/firmas/src/main/java/com/fp/firmas/rules/save/.svn/entries b/base/core/firmas/src/main/java/com/fp/firmas/rules/save/.svn/entries new file mode 100644 index 0000000..3323733 --- /dev/null +++ b/base/core/firmas/src/main/java/com/fp/firmas/rules/save/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/firmas/src/main/java/com/fp/firmas/rules/save +svn://172.17.26.185/COMACO + + + +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +CertificadoFirma.java +file + + + + +2022-07-28T03:40:36.926778Z +39f1b02a2df15f8f3e43a9bf2146131c +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + + + + + + + + +2725 + diff --git a/base/core/firmas/src/main/java/com/fp/firmas/rules/save/.svn/text-base/CertificadoFirma.java.svn-base b/base/core/firmas/src/main/java/com/fp/firmas/rules/save/.svn/text-base/CertificadoFirma.java.svn-base new file mode 100644 index 0000000..c3e7a98 --- /dev/null +++ b/base/core/firmas/src/main/java/com/fp/firmas/rules/save/.svn/text-base/CertificadoFirma.java.svn-base @@ -0,0 +1,68 @@ +package com.fp.firmas.rules.save; + +import java.io.ByteArrayInputStream; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import java.util.List; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.firmas.rules.common.resources.FirmMessages; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.pfirmas.param.TfirmCertificado; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; + +/** + * Clase que completa la información acerca de los certificados dentro del repositorio de certificados + * + * @author dcruz + * + */ +public class CertificadoFirma extends TransactionRule{ + + private static final long serialVersionUID = 1L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + + List firmCertificados = pSaveRequest.getSaveBeanModifiedRecords("USUARIOCERTIFICADOS"); + String path = (String)pSaveRequest.get("path"); + for (Object object : firmCertificados) { + if(object instanceof TfirmCertificado){ + TfirmCertificado certificado = (TfirmCertificado)object; + guardarCertficadoRepositorio(certificado, path); + } + } + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) + throws Exception { + return pSaveRequest; + } + + private void guardarCertficadoRepositorio(TfirmCertificado certificado, String pathCertificado) throws CommondbException, Exception{ +// String path = getPath(certificado);//obtiene la ruta a grabar el certificado +// String path = FirmMessages.getString("dir.ruta.base.repositorio") + "/" + certificado.getPk().getIdcertificado();//cambiar por el parametro en la base + String path = pathCertificado + "/" + certificado.getPk().getIdcertificado(); + if(!Files.exists(Paths.get(path))){ + Files.createFile(Paths.get(path)); + Files.copy(new ByteArrayInputStream((byte[])certificado.modifiedData.get("valor_certificado_bin")), Paths.get(path)); + }else{ + Files.copy(new ByteArrayInputStream((byte[])certificado.modifiedData.get("valor_certificado_bin")), Paths.get(path), StandardCopyOption.REPLACE_EXISTING); + } + + } + + private String getPath(TfirmCertificado certificado) throws CommondbException, Exception { + TgeneParametersKey tgeneParametersKey = new TgeneParametersKey("PATH_CERTIFICADO_BCE", 1); + TgeneParameters tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), tgeneParametersKey); + String path = tgeneParameters.getTextvalue() + "/" + certificado.getPk().getIdcertificado(); + return path; + } + +} diff --git a/base/core/firmas/src/main/java/com/fp/firmas/rules/save/CertificadoFirma.java b/base/core/firmas/src/main/java/com/fp/firmas/rules/save/CertificadoFirma.java new file mode 100644 index 0000000..c3e7a98 --- /dev/null +++ b/base/core/firmas/src/main/java/com/fp/firmas/rules/save/CertificadoFirma.java @@ -0,0 +1,68 @@ +package com.fp.firmas.rules.save; + +import java.io.ByteArrayInputStream; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import java.util.List; + +import com.fp.dto.rules.TransactionRule; +import com.fp.dto.save.SaveRequest; +import com.fp.firmas.rules.common.resources.FirmMessages; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.pfirmas.param.TfirmCertificado; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParametersKey; + +/** + * Clase que completa la información acerca de los certificados dentro del repositorio de certificados + * + * @author dcruz + * + */ +public class CertificadoFirma extends TransactionRule{ + + private static final long serialVersionUID = 1L; + + @Override + public SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception { + + List firmCertificados = pSaveRequest.getSaveBeanModifiedRecords("USUARIOCERTIFICADOS"); + String path = (String)pSaveRequest.get("path"); + for (Object object : firmCertificados) { + if(object instanceof TfirmCertificado){ + TfirmCertificado certificado = (TfirmCertificado)object; + guardarCertficadoRepositorio(certificado, path); + } + } + return pSaveRequest; + } + + @Override + public SaveRequest reverseProcess(SaveRequest pSaveRequest) + throws Exception { + return pSaveRequest; + } + + private void guardarCertficadoRepositorio(TfirmCertificado certificado, String pathCertificado) throws CommondbException, Exception{ +// String path = getPath(certificado);//obtiene la ruta a grabar el certificado +// String path = FirmMessages.getString("dir.ruta.base.repositorio") + "/" + certificado.getPk().getIdcertificado();//cambiar por el parametro en la base + String path = pathCertificado + "/" + certificado.getPk().getIdcertificado(); + if(!Files.exists(Paths.get(path))){ + Files.createFile(Paths.get(path)); + Files.copy(new ByteArrayInputStream((byte[])certificado.modifiedData.get("valor_certificado_bin")), Paths.get(path)); + }else{ + Files.copy(new ByteArrayInputStream((byte[])certificado.modifiedData.get("valor_certificado_bin")), Paths.get(path), StandardCopyOption.REPLACE_EXISTING); + } + + } + + private String getPath(TfirmCertificado certificado) throws CommondbException, Exception { + TgeneParametersKey tgeneParametersKey = new TgeneParametersKey("PATH_CERTIFICADO_BCE", 1); + TgeneParameters tgeneParameters = TgeneParameters.find(PersistenceHelper.getEntityManager(), tgeneParametersKey); + String path = tgeneParameters.getTextvalue() + "/" + certificado.getPk().getIdcertificado(); + return path; + } + +} diff --git a/base/core/firmas/src/main/resources/.svn/entries b/base/core/firmas/src/main/resources/.svn/entries new file mode 100644 index 0000000..f055cde --- /dev/null +++ b/base/core/firmas/src/main/resources/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/firmas/src/main/resources +svn://172.17.26.185/COMACO + + + +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +firmessages_es.properties +file + + + + +2022-07-28T03:40:37.143779Z +fd28a0db17ea9f914c47011556fddec1 +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + + + + + + + + +2077 + diff --git a/base/core/firmas/src/main/resources/.svn/text-base/firmessages_es.properties.svn-base b/base/core/firmas/src/main/resources/.svn/text-base/firmessages_es.properties.svn-base new file mode 100644 index 0000000..224b110 --- /dev/null +++ b/base/core/firmas/src/main/resources/.svn/text-base/firmessages_es.properties.svn-base @@ -0,0 +1,46 @@ +################################################### +##### S\u00edmbolos unicode +#####\u00e1 -> +#####\u00e9 -> +#####\u00ed -> +#####\u00f3 -> +#####\u00fa -> +#####\u00c1 -> +#####\u00c9 -> +#####\u00cd -> +#####\u00d3 -> +#####\u00da -> +#####\u00f1 -> +#####\u00d1 -> +#####\u0020 -> Espacio en blanco +################################################### + +#======================================================================================== +#=======CODIGO EXCEPCIONES=============================================================== +#======================================================================================== +FIR-0001=ERROR AL ESTABLECER CONEXI\u00D3N AL SERVICIO\: {0} +FIR-0002=ERROR, CERTIFICADO REVOCADO POR {0} CON FECHA {1} +FIR-0005=ERROR, ES OBLIGATORIO CARGAR UN ARCHIVO +#======================================================================================== +#=======OIDs GENERALES DE IDENTIFICACION DEL USUARIO EN EL CERTIFICADO=================== +#======================================================================================== +oid.cedula_pasaporte=1.3.6.1.4.1.37947.3.1 +oid.nombres_persona=1.3.6.1.4.1.37947.3.2 +oid.apellido_persona1=1.3.6.1.4.1.37947.3.3 +oid.apellido_persona2=1.3.6.1.4.1.37947.3.4 +oid.cargo=1.3.6.1.4.1.37947.3.5 +oid.institucion=1.3.6.1.4.1.37947.3.6 +oid.direccion=1.3.6.1.4.1.37947.3.7 +oid.telefono=1.3.6.1.4.1.37947.3.8 +oid.ciudad=1.3.6.1.4.1.37947.3.9 +oid.razon_social=1.3.6.1.4.1.37947.3.10 +oid.ruc=1.3.6.1.4.1.37947.3.11 +#======================================================================================== +#=======RUTAS DE LOS DIRECTORIOS DEL REPOSITORIO DE CERTIFICADOS========================= +#======================================================================================== +dir.ruta.base.repositorio=/media/store/maia/jboss-eap-6.0/digital_repository +dir.nombre.carpeta.usuarios=users +nombre.certificado.raiz=CARAIZ.cer +nombre.certificado.subordinado=CASUBORDINADO.cer +service.url.address.ocsp=http://ocsp.digsigtrust.com:80 +#service.url.address.ocsp=http://ocsp.openvalidation.org:80 \ No newline at end of file diff --git a/base/core/firmas/src/main/resources/firmessages_es.properties b/base/core/firmas/src/main/resources/firmessages_es.properties new file mode 100644 index 0000000..224b110 --- /dev/null +++ b/base/core/firmas/src/main/resources/firmessages_es.properties @@ -0,0 +1,46 @@ +################################################### +##### S\u00edmbolos unicode +#####\u00e1 -> +#####\u00e9 -> +#####\u00ed -> +#####\u00f3 -> +#####\u00fa -> +#####\u00c1 -> +#####\u00c9 -> +#####\u00cd -> +#####\u00d3 -> +#####\u00da -> +#####\u00f1 -> +#####\u00d1 -> +#####\u0020 -> Espacio en blanco +################################################### + +#======================================================================================== +#=======CODIGO EXCEPCIONES=============================================================== +#======================================================================================== +FIR-0001=ERROR AL ESTABLECER CONEXI\u00D3N AL SERVICIO\: {0} +FIR-0002=ERROR, CERTIFICADO REVOCADO POR {0} CON FECHA {1} +FIR-0005=ERROR, ES OBLIGATORIO CARGAR UN ARCHIVO +#======================================================================================== +#=======OIDs GENERALES DE IDENTIFICACION DEL USUARIO EN EL CERTIFICADO=================== +#======================================================================================== +oid.cedula_pasaporte=1.3.6.1.4.1.37947.3.1 +oid.nombres_persona=1.3.6.1.4.1.37947.3.2 +oid.apellido_persona1=1.3.6.1.4.1.37947.3.3 +oid.apellido_persona2=1.3.6.1.4.1.37947.3.4 +oid.cargo=1.3.6.1.4.1.37947.3.5 +oid.institucion=1.3.6.1.4.1.37947.3.6 +oid.direccion=1.3.6.1.4.1.37947.3.7 +oid.telefono=1.3.6.1.4.1.37947.3.8 +oid.ciudad=1.3.6.1.4.1.37947.3.9 +oid.razon_social=1.3.6.1.4.1.37947.3.10 +oid.ruc=1.3.6.1.4.1.37947.3.11 +#======================================================================================== +#=======RUTAS DE LOS DIRECTORIOS DEL REPOSITORIO DE CERTIFICADOS========================= +#======================================================================================== +dir.ruta.base.repositorio=/media/store/maia/jboss-eap-6.0/digital_repository +dir.nombre.carpeta.usuarios=users +nombre.certificado.raiz=CARAIZ.cer +nombre.certificado.subordinado=CASUBORDINADO.cer +service.url.address.ocsp=http://ocsp.digsigtrust.com:80 +#service.url.address.ocsp=http://ocsp.openvalidation.org:80 \ No newline at end of file diff --git a/base/core/firmas/src/test/.svn/entries b/base/core/firmas/src/test/.svn/entries new file mode 100644 index 0000000..4a78f9d --- /dev/null +++ b/base/core/firmas/src/test/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/firmas/src/test +svn://172.17.26.185/COMACO + + + +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + diff --git a/base/core/firmas/src/test/java/.svn/entries b/base/core/firmas/src/test/java/.svn/entries new file mode 100644 index 0000000..98a4f1c --- /dev/null +++ b/base/core/firmas/src/test/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/firmas/src/test/java +svn://172.17.26.185/COMACO + + + +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/core/firmas/src/test/java/com/.svn/entries b/base/core/firmas/src/test/java/com/.svn/entries new file mode 100644 index 0000000..7e3f759 --- /dev/null +++ b/base/core/firmas/src/test/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/firmas/src/test/java/com +svn://172.17.26.185/COMACO + + + +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/core/firmas/src/test/java/com/fp/.svn/entries b/base/core/firmas/src/test/java/com/fp/.svn/entries new file mode 100644 index 0000000..d69d724 --- /dev/null +++ b/base/core/firmas/src/test/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/firmas/src/test/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +firmas +dir + diff --git a/base/core/firmas/src/test/java/com/fp/firmas/.svn/entries b/base/core/firmas/src/test/java/com/fp/firmas/.svn/entries new file mode 100644 index 0000000..060cec1 --- /dev/null +++ b/base/core/firmas/src/test/java/com/fp/firmas/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/core/firmas/src/test/java/com/fp/firmas +svn://172.17.26.185/COMACO + + + +2014-09-11T06:05:22.283455Z +657 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/core/firmas/target/classes/com/fp/firmas/rules/common/CertificateUtils.class b/base/core/firmas/target/classes/com/fp/firmas/rules/common/CertificateUtils.class new file mode 100644 index 0000000..30d9897 Binary files /dev/null and b/base/core/firmas/target/classes/com/fp/firmas/rules/common/CertificateUtils.class differ diff --git a/base/core/firmas/target/classes/com/fp/firmas/rules/common/PDFRendererListener.class b/base/core/firmas/target/classes/com/fp/firmas/rules/common/PDFRendererListener.class new file mode 100644 index 0000000..37dda33 Binary files /dev/null and b/base/core/firmas/target/classes/com/fp/firmas/rules/common/PDFRendererListener.class differ diff --git a/base/core/firmas/target/classes/com/fp/firmas/rules/common/enumerator/SignType.class b/base/core/firmas/target/classes/com/fp/firmas/rules/common/enumerator/SignType.class new file mode 100644 index 0000000..031098b Binary files /dev/null and b/base/core/firmas/target/classes/com/fp/firmas/rules/common/enumerator/SignType.class differ diff --git a/base/core/firmas/target/classes/com/fp/firmas/rules/common/exception/FirmasException.class b/base/core/firmas/target/classes/com/fp/firmas/rules/common/exception/FirmasException.class new file mode 100644 index 0000000..b4b62da Binary files /dev/null and b/base/core/firmas/target/classes/com/fp/firmas/rules/common/exception/FirmasException.class differ diff --git a/base/core/firmas/target/classes/com/fp/firmas/rules/common/resources/FirmMessages.class b/base/core/firmas/target/classes/com/fp/firmas/rules/common/resources/FirmMessages.class new file mode 100644 index 0000000..512613c Binary files /dev/null and b/base/core/firmas/target/classes/com/fp/firmas/rules/common/resources/FirmMessages.class differ diff --git a/base/core/firmas/target/classes/com/fp/firmas/rules/query/UsuarioCertificado.class b/base/core/firmas/target/classes/com/fp/firmas/rules/query/UsuarioCertificado.class new file mode 100644 index 0000000..b29982b Binary files /dev/null and b/base/core/firmas/target/classes/com/fp/firmas/rules/query/UsuarioCertificado.class differ diff --git a/base/core/firmas/target/classes/com/fp/firmas/rules/save/CertificadoFirma.class b/base/core/firmas/target/classes/com/fp/firmas/rules/save/CertificadoFirma.class new file mode 100644 index 0000000..2ca9ebf Binary files /dev/null and b/base/core/firmas/target/classes/com/fp/firmas/rules/save/CertificadoFirma.class differ diff --git a/base/core/firmas/target/classes/firmessages_es.properties b/base/core/firmas/target/classes/firmessages_es.properties new file mode 100644 index 0000000..224b110 --- /dev/null +++ b/base/core/firmas/target/classes/firmessages_es.properties @@ -0,0 +1,46 @@ +################################################### +##### S\u00edmbolos unicode +#####\u00e1 -> +#####\u00e9 -> +#####\u00ed -> +#####\u00f3 -> +#####\u00fa -> +#####\u00c1 -> +#####\u00c9 -> +#####\u00cd -> +#####\u00d3 -> +#####\u00da -> +#####\u00f1 -> +#####\u00d1 -> +#####\u0020 -> Espacio en blanco +################################################### + +#======================================================================================== +#=======CODIGO EXCEPCIONES=============================================================== +#======================================================================================== +FIR-0001=ERROR AL ESTABLECER CONEXI\u00D3N AL SERVICIO\: {0} +FIR-0002=ERROR, CERTIFICADO REVOCADO POR {0} CON FECHA {1} +FIR-0005=ERROR, ES OBLIGATORIO CARGAR UN ARCHIVO +#======================================================================================== +#=======OIDs GENERALES DE IDENTIFICACION DEL USUARIO EN EL CERTIFICADO=================== +#======================================================================================== +oid.cedula_pasaporte=1.3.6.1.4.1.37947.3.1 +oid.nombres_persona=1.3.6.1.4.1.37947.3.2 +oid.apellido_persona1=1.3.6.1.4.1.37947.3.3 +oid.apellido_persona2=1.3.6.1.4.1.37947.3.4 +oid.cargo=1.3.6.1.4.1.37947.3.5 +oid.institucion=1.3.6.1.4.1.37947.3.6 +oid.direccion=1.3.6.1.4.1.37947.3.7 +oid.telefono=1.3.6.1.4.1.37947.3.8 +oid.ciudad=1.3.6.1.4.1.37947.3.9 +oid.razon_social=1.3.6.1.4.1.37947.3.10 +oid.ruc=1.3.6.1.4.1.37947.3.11 +#======================================================================================== +#=======RUTAS DE LOS DIRECTORIOS DEL REPOSITORIO DE CERTIFICADOS========================= +#======================================================================================== +dir.ruta.base.repositorio=/media/store/maia/jboss-eap-6.0/digital_repository +dir.nombre.carpeta.usuarios=users +nombre.certificado.raiz=CARAIZ.cer +nombre.certificado.subordinado=CASUBORDINADO.cer +service.url.address.ocsp=http://ocsp.digsigtrust.com:80 +#service.url.address.ocsp=http://ocsp.openvalidation.org:80 \ No newline at end of file diff --git a/base/core/firmas/target/firmas-2.1.jar b/base/core/firmas/target/firmas-2.1.jar new file mode 100644 index 0000000..aaf8b3c Binary files /dev/null and b/base/core/firmas/target/firmas-2.1.jar differ diff --git a/base/core/firmas/target/maven-archiver/pom.properties b/base/core/firmas/target/maven-archiver/pom.properties new file mode 100644 index 0000000..f137b45 --- /dev/null +++ b/base/core/firmas/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:53:08 ECT 2022 +version=2.1 +groupId=com.fp.base.core +artifactId=firmas diff --git a/base/core/pom.xml b/base/core/pom.xml new file mode 100644 index 0000000..a4d2510 --- /dev/null +++ b/base/core/pom.xml @@ -0,0 +1,42 @@ + + + + base + com.fp + 2.1 + + 4.0.0 + com.fp.base + core + flipbean + 2.1 + pom + Financial Lifecycle Process + + bpm + firmas + alfresco-client + + + + + com.fp.base.dto + common + 2.1 + + + com.fp.base.dto + dto + 2.1 + + + org.hibernate + hibernate-core + provided + + + org.hibernate + hibernate-entitymanager + + + \ No newline at end of file diff --git a/base/dto/.svn/entries b/base/dto/.svn/entries new file mode 100644 index 0000000..19f772e --- /dev/null +++ b/base/dto/.svn/entries @@ -0,0 +1,68 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto +svn://172.17.26.185/COMACO + + + +2016-02-05T16:15:03.013395Z +4436 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +dto +dir + +common +dir + +pom.xml +file + + + + +2022-07-28T03:40:36.509776Z +9c346b644ae422e493aa3efa87149832 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1066 + diff --git a/base/dto/.svn/text-base/pom.xml.svn-base b/base/dto/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..a0dafe4 --- /dev/null +++ b/base/dto/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,32 @@ + + + + base + com.fp + 2.1 + + 4.0.0 + com.fp.base + dto + dto + 2.1 + pom + Financial Lifecycle Process + + common + dto + + + + org.apache.velocity + velocity + + + org.apache.velocity + velocity-tools + + + diff --git a/base/dto/common/.svn/dir-prop-base b/base/dto/common/.svn/dir-prop-base new file mode 100644 index 0000000..3e2a6f2 --- /dev/null +++ b/base/dto/common/.svn/dir-prop-base @@ -0,0 +1,9 @@ +K 10 +svn:ignore +V 37 +.classpath +.project +.settings +target + +END diff --git a/base/dto/common/.svn/entries b/base/dto/common/.svn/entries new file mode 100644 index 0000000..7a10af8 --- /dev/null +++ b/base/dto/common/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common +svn://172.17.26.185/COMACO + + + +2016-02-05T16:15:03.013395Z +4436 +fpazmino +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:36.485776Z +bdf0b774598f9e54739bda000c413439 +2015-10-19T06:08:31.903910Z +4294 +fpazmino + + + + + + + + + + + + + + + + + + + + + +2851 + diff --git a/base/dto/common/.svn/text-base/pom.xml.svn-base b/base/dto/common/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..67f87da --- /dev/null +++ b/base/dto/common/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,86 @@ + + + + dto + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.dto + common + common + + + + + com.fp.base.dto + dto + 2.1 + + + net.sf.json-lib + json-lib + + + xom + xom + + + log4j + log4j + + + dom4j + dom4j + 1.6.1 + + + org.jboss.spec.javax.ejb + jboss-ejb-api_3.1_spec + provided + + + org.hibernate + hibernate-core + + + org.hibernate + hibernate-entitymanager + + + + xalan + serializer + 2.7.1 + jar + provided + + + + org.mvel + mvel2 + + + org.apache.poi + poi + + + org.apache.poi + poi-ooxml + + + javax.mail + mail + + + javax.activation + activation + + + jep + jep + + + diff --git a/base/dto/common/pom.xml b/base/dto/common/pom.xml new file mode 100644 index 0000000..ecf5bde --- /dev/null +++ b/base/dto/common/pom.xml @@ -0,0 +1,87 @@ + + + + dto + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.dto + common + common + + + + + com.fp.base.dto + dto + 2.1 + + + net.sf.json-lib + json-lib + + + xom + xom + + + log4j + log4j + + + dom4j + dom4j + 1.6.1 + provided + + + org.jboss.spec.javax.ejb + jboss-ejb-api_3.1_spec + provided + + + org.hibernate + hibernate-core + + + org.hibernate + hibernate-entitymanager + + + + xalan + serializer + 2.7.1 + jar + provided + + + + org.mvel + mvel2 + + + org.apache.poi + poi + + + org.apache.poi + poi-ooxml + + + javax.mail + mail + + + javax.activation + activation + + + jep + jep + + + diff --git a/base/dto/common/src/.svn/entries b/base/dto/common/src/.svn/entries new file mode 100644 index 0000000..9e04c9a --- /dev/null +++ b/base/dto/common/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src +svn://172.17.26.185/COMACO + + + +2016-02-05T16:15:03.013395Z +4436 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/base/dto/common/src/main/.svn/entries b/base/dto/common/src/main/.svn/entries new file mode 100644 index 0000000..a63f3e1 --- /dev/null +++ b/base/dto/common/src/main/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main +svn://172.17.26.185/COMACO + + + +2016-02-05T16:15:03.013395Z +4436 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/dto/common/src/main/java/.svn/entries b/base/dto/common/src/main/java/.svn/entries new file mode 100644 index 0000000..a461e98 --- /dev/null +++ b/base/dto/common/src/main/java/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java +svn://172.17.26.185/COMACO + + + +2016-02-05T16:15:03.013395Z +4436 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +com +dir + diff --git a/base/dto/common/src/main/java/com/.svn/entries b/base/dto/common/src/main/java/com/.svn/entries new file mode 100644 index 0000000..3f8bdfd --- /dev/null +++ b/base/dto/common/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com +svn://172.17.26.185/COMACO + + + +2016-02-05T16:15:03.013395Z +4436 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/dto/common/src/main/java/com/fp/.svn/entries b/base/dto/common/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..0d15849 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/.svn/entries @@ -0,0 +1,103 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2016-02-05T16:15:03.013395Z +4436 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +viaticos +dir + +mail +dir + +persistence +dir + +telered +dir + +dto +dir + +builder +dir + +timedeposit +dir + +teller +dir + +core +dir + +common +dir + +loan +dir + +installment +dir + +accounting +dir + +ach +dir + +creditfacility +dir + +excel +dir + +documents +dir + +receivable +dir + +application +dir + +bpmlib +dir + +bscoring +dir + +term +dir + +warranty +dir + +demandeposit +dir + +general +dir + diff --git a/base/dto/common/src/main/java/com/fp/accounting/.svn/entries b/base/dto/common/src/main/java/com/fp/accounting/.svn/entries new file mode 100644 index 0000000..5547dc5 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/accounting/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/accounting +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +exception +dir + diff --git a/base/dto/common/src/main/java/com/fp/accounting/exception/.svn/entries b/base/dto/common/src/main/java/com/fp/accounting/exception/.svn/entries new file mode 100644 index 0000000..73691cf --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/accounting/exception/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/accounting/exception +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +AccountingException.java +file + + + + +2022-07-28T03:40:35.408771Z +995fa5cf38917293288a518e2e04808e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1348 + diff --git a/base/dto/common/src/main/java/com/fp/accounting/exception/.svn/text-base/AccountingException.java.svn-base b/base/dto/common/src/main/java/com/fp/accounting/exception/.svn/text-base/AccountingException.java.svn-base new file mode 100644 index 0000000..2bc913e --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/accounting/exception/.svn/text-base/AccountingException.java.svn-base @@ -0,0 +1,40 @@ +package com.fp.accounting.exception; + +import javax.ejb.ApplicationException; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete accounting o contabilidad + * @author scastillo + * @version 2.1 + */ +@ApplicationException(rollback=true) +public class AccountingException extends APPException { + + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de AccountingException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public AccountingException(String code, String message, Exception pCause, Object... pParameters) { + super(code, message, pCause, pParameters); + } + + /** + * Crea una instancia de AccountingException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public AccountingException(String code, String message, Object... pParameters) { + super(code, message, pParameters); + } +} \ No newline at end of file diff --git a/base/dto/common/src/main/java/com/fp/accounting/exception/AccountingException.java b/base/dto/common/src/main/java/com/fp/accounting/exception/AccountingException.java new file mode 100644 index 0000000..2bc913e --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/accounting/exception/AccountingException.java @@ -0,0 +1,40 @@ +package com.fp.accounting.exception; + +import javax.ejb.ApplicationException; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete accounting o contabilidad + * @author scastillo + * @version 2.1 + */ +@ApplicationException(rollback=true) +public class AccountingException extends APPException { + + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de AccountingException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public AccountingException(String code, String message, Exception pCause, Object... pParameters) { + super(code, message, pCause, pParameters); + } + + /** + * Crea una instancia de AccountingException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public AccountingException(String code, String message, Object... pParameters) { + super(code, message, pParameters); + } +} \ No newline at end of file diff --git a/base/dto/common/src/main/java/com/fp/ach/.svn/entries b/base/dto/common/src/main/java/com/fp/ach/.svn/entries new file mode 100644 index 0000000..57be915 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/ach/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/ach +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +exception +dir + diff --git a/base/dto/common/src/main/java/com/fp/ach/exception/.svn/entries b/base/dto/common/src/main/java/com/fp/ach/exception/.svn/entries new file mode 100644 index 0000000..087ebc1 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/ach/exception/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/ach/exception +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +AchException.java +file + + + + +2022-07-28T03:40:35.558772Z +c0e86adb01ab5b6a0868ad2a4e89976f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1283 + diff --git a/base/dto/common/src/main/java/com/fp/ach/exception/.svn/text-base/AchException.java.svn-base b/base/dto/common/src/main/java/com/fp/ach/exception/.svn/text-base/AchException.java.svn-base new file mode 100644 index 0000000..15bc267 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/ach/exception/.svn/text-base/AchException.java.svn-base @@ -0,0 +1,39 @@ +package com.fp.ach.exception; + +import javax.ejb.ApplicationException; + +import com.fp.common.exception.APPException; + +/** + * Clase que se encarga del manejo de errores de ACH + * @author scastillo + */ +@ApplicationException(rollback=true) +public class AchException extends APPException { + + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de AchException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public AchException(String code, String message, Exception pCause, Object... pParameters) { + super(code, message, pCause, pParameters); + } + + /** + * Crea una instancia de AchException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public AchException(String code, String message, Object... pParameters) { + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/ach/exception/AchException.java b/base/dto/common/src/main/java/com/fp/ach/exception/AchException.java new file mode 100644 index 0000000..15bc267 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/ach/exception/AchException.java @@ -0,0 +1,39 @@ +package com.fp.ach.exception; + +import javax.ejb.ApplicationException; + +import com.fp.common.exception.APPException; + +/** + * Clase que se encarga del manejo de errores de ACH + * @author scastillo + */ +@ApplicationException(rollback=true) +public class AchException extends APPException { + + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de AchException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public AchException(String code, String message, Exception pCause, Object... pParameters) { + super(code, message, pCause, pParameters); + } + + /** + * Crea una instancia de AchException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public AchException(String code, String message, Object... pParameters) { + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/application/.svn/entries b/base/dto/common/src/main/java/com/fp/application/.svn/entries new file mode 100644 index 0000000..519ae2d --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/application/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/application +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +exception +dir + diff --git a/base/dto/common/src/main/java/com/fp/application/exception/.svn/entries b/base/dto/common/src/main/java/com/fp/application/exception/.svn/entries new file mode 100644 index 0000000..f2c3368 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/application/exception/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/application/exception +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +SolicitudeException.java +file + + + + +2022-07-28T03:40:35.852773Z +b2ec3ddef838112799fb18f2646e0044 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1259 + diff --git a/base/dto/common/src/main/java/com/fp/application/exception/.svn/text-base/SolicitudeException.java.svn-base b/base/dto/common/src/main/java/com/fp/application/exception/.svn/text-base/SolicitudeException.java.svn-base new file mode 100644 index 0000000..5d6df5b --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/application/exception/.svn/text-base/SolicitudeException.java.svn-base @@ -0,0 +1,41 @@ +package com.fp.application.exception; + +import javax.ejb.ApplicationException; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete de solicitudes. + * @author Jorge Vaca + * @version 2.1 + */ +@ApplicationException(rollback=true) +public class SolicitudeException extends APPException{ + + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de LoanException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public SolicitudeException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de LoanException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public SolicitudeException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } + +} diff --git a/base/dto/common/src/main/java/com/fp/application/exception/SolicitudeException.java b/base/dto/common/src/main/java/com/fp/application/exception/SolicitudeException.java new file mode 100644 index 0000000..5d6df5b --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/application/exception/SolicitudeException.java @@ -0,0 +1,41 @@ +package com.fp.application.exception; + +import javax.ejb.ApplicationException; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete de solicitudes. + * @author Jorge Vaca + * @version 2.1 + */ +@ApplicationException(rollback=true) +public class SolicitudeException extends APPException{ + + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de LoanException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public SolicitudeException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de LoanException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public SolicitudeException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } + +} diff --git a/base/dto/common/src/main/java/com/fp/bpmlib/.svn/entries b/base/dto/common/src/main/java/com/fp/bpmlib/.svn/entries new file mode 100644 index 0000000..b4294b8 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/bpmlib/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/bpmlib +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +BPMException.java +file + + + + +2022-07-28T03:40:35.924774Z +00fe9adca42c4fdba32709790c45c293 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1323 + diff --git a/base/dto/common/src/main/java/com/fp/bpmlib/.svn/text-base/BPMException.java.svn-base b/base/dto/common/src/main/java/com/fp/bpmlib/.svn/text-base/BPMException.java.svn-base new file mode 100644 index 0000000..8ef66e1 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/bpmlib/.svn/text-base/BPMException.java.svn-base @@ -0,0 +1,43 @@ +package com.fp.bpmlib; + +import javax.ejb.ApplicationException; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete BPM o cuentas a la vista. + * + * @author Jorge Vaca + * @version 2.1 + */ +@ApplicationException(rollback = true) +public class BPMException extends APPException { + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de BPMException. + * + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public BPMException(String code, String message, Exception pCause, Object... pParameters) { + super(code, message, pCause, pParameters); + } + + /** + * Crea una instancia de BPMException. + * + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public BPMException(String code, String message, Object... pParameters) { + super(code, message, pParameters); + } + +} diff --git a/base/dto/common/src/main/java/com/fp/bpmlib/BPMException.java b/base/dto/common/src/main/java/com/fp/bpmlib/BPMException.java new file mode 100644 index 0000000..8ef66e1 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/bpmlib/BPMException.java @@ -0,0 +1,43 @@ +package com.fp.bpmlib; + +import javax.ejb.ApplicationException; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete BPM o cuentas a la vista. + * + * @author Jorge Vaca + * @version 2.1 + */ +@ApplicationException(rollback = true) +public class BPMException extends APPException { + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de BPMException. + * + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public BPMException(String code, String message, Exception pCause, Object... pParameters) { + super(code, message, pCause, pParameters); + } + + /** + * Crea una instancia de BPMException. + * + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public BPMException(String code, String message, Object... pParameters) { + super(code, message, pParameters); + } + +} diff --git a/base/dto/common/src/main/java/com/fp/bscoring/.svn/entries b/base/dto/common/src/main/java/com/fp/bscoring/.svn/entries new file mode 100644 index 0000000..b02d63f --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/bscoring/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/bscoring +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +BscoringException.java +file + + + + +2022-07-28T03:40:35.956774Z +beaea9f91eeaa4a13cd563998d56d860 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1589 + diff --git a/base/dto/common/src/main/java/com/fp/bscoring/.svn/text-base/BscoringException.java.svn-base b/base/dto/common/src/main/java/com/fp/bscoring/.svn/text-base/BscoringException.java.svn-base new file mode 100644 index 0000000..ec8993c --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/bscoring/.svn/text-base/BscoringException.java.svn-base @@ -0,0 +1,48 @@ +package com.fp.bscoring; + +import com.fp.common.exception.APPException; + +public class BscoringException extends APPException{ + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de BscoringException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativo + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public BscoringException(String pCode, String pMessage, Exception pCause, Object... pParameters) { + super(pCode, pMessage, pCause, pParameters); + } + /** + * Crea una instancia de BscoringException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativo + */ + public BscoringException(String pCode, String pMessage) { + super(pCode, pMessage); + } + /** + * Crea una instancia de BscoringException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativo + * @param parameters parametros a presentar con el mensaje + */ + public BscoringException(String pCode, String pMessage, Object... pParameters) { + super(pCode, pMessage, pParameters); + } + /** + * Crea una instancia de BscoringException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativo + * @param cause causa original de la excepcion + */ + public BscoringException(String pCode, String pMessage, Exception pCause) { + super(pCode, pMessage, pCause); + } +} diff --git a/base/dto/common/src/main/java/com/fp/bscoring/BscoringException.java b/base/dto/common/src/main/java/com/fp/bscoring/BscoringException.java new file mode 100644 index 0000000..ec8993c --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/bscoring/BscoringException.java @@ -0,0 +1,48 @@ +package com.fp.bscoring; + +import com.fp.common.exception.APPException; + +public class BscoringException extends APPException{ + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de BscoringException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativo + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public BscoringException(String pCode, String pMessage, Exception pCause, Object... pParameters) { + super(pCode, pMessage, pCause, pParameters); + } + /** + * Crea una instancia de BscoringException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativo + */ + public BscoringException(String pCode, String pMessage) { + super(pCode, pMessage); + } + /** + * Crea una instancia de BscoringException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativo + * @param parameters parametros a presentar con el mensaje + */ + public BscoringException(String pCode, String pMessage, Object... pParameters) { + super(pCode, pMessage, pParameters); + } + /** + * Crea una instancia de BscoringException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativo + * @param cause causa original de la excepcion + */ + public BscoringException(String pCode, String pMessage, Exception pCause) { + super(pCode, pMessage, pCause); + } +} diff --git a/base/dto/common/src/main/java/com/fp/builder/.svn/entries b/base/dto/common/src/main/java/com/fp/builder/.svn/entries new file mode 100644 index 0000000..0e65b03 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/builder/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/builder +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +BuilderException.java +file + + + + +2022-07-28T03:40:34.495767Z +a93f0c13bfe745b01c03498be148293f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +744 + diff --git a/base/dto/common/src/main/java/com/fp/builder/.svn/text-base/BuilderException.java.svn-base b/base/dto/common/src/main/java/com/fp/builder/.svn/text-base/BuilderException.java.svn-base new file mode 100644 index 0000000..efe3b21 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/builder/.svn/text-base/BuilderException.java.svn-base @@ -0,0 +1,27 @@ +package com.fp.builder; + +import com.fp.common.exception.APPException; + +public class BuilderException extends APPException { + + public BuilderException(String pCode, String pMessage, Exception pCause, Object... pParameters) { + super(pCode, pMessage, pCause, pParameters); + } + + public BuilderException(String pCode, String pMessage) { + super(pCode, pMessage); + } + + public BuilderException(String pCode, String pMessage, Object... pParameters) { + super(pCode, pMessage, pParameters); + } + public BuilderException(String pCode, String pMessage, Exception pCause) { + super(pCode, pMessage, pCause); + } + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + +} diff --git a/base/dto/common/src/main/java/com/fp/builder/BuilderException.java b/base/dto/common/src/main/java/com/fp/builder/BuilderException.java new file mode 100644 index 0000000..efe3b21 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/builder/BuilderException.java @@ -0,0 +1,27 @@ +package com.fp.builder; + +import com.fp.common.exception.APPException; + +public class BuilderException extends APPException { + + public BuilderException(String pCode, String pMessage, Exception pCause, Object... pParameters) { + super(pCode, pMessage, pCause, pParameters); + } + + public BuilderException(String pCode, String pMessage) { + super(pCode, pMessage); + } + + public BuilderException(String pCode, String pMessage, Object... pParameters) { + super(pCode, pMessage, pParameters); + } + public BuilderException(String pCode, String pMessage, Exception pCause) { + super(pCode, pMessage, pCause); + } + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + +} diff --git a/base/dto/common/src/main/java/com/fp/common/.svn/entries b/base/dto/common/src/main/java/com/fp/common/.svn/entries new file mode 100644 index 0000000..5db820f --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/.svn/entries @@ -0,0 +1,61 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/common +svn://172.17.26.185/COMACO + + + +2014-09-17T05:52:10.767036Z +863 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +helper +dir + +logger +dir + +files +dir + +soap +dir + +base64 +dir + +formula +dir + +messages +dir + +thread +dir + +fin +dir + +properties +dir + +exception +dir + diff --git a/base/dto/common/src/main/java/com/fp/common/base64/.svn/entries b/base/dto/common/src/main/java/com/fp/common/base64/.svn/entries new file mode 100644 index 0000000..bd3999e --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/base64/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/common/base64 +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +Base64Input.java +file + + + + +2022-07-28T03:40:34.905769Z +fafe8573db1ece7c141c84a863c9fb00 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4137 + diff --git a/base/dto/common/src/main/java/com/fp/common/base64/.svn/text-base/Base64Input.java.svn-base b/base/dto/common/src/main/java/com/fp/common/base64/.svn/text-base/Base64Input.java.svn-base new file mode 100644 index 0000000..891d1ef --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/base64/.svn/text-base/Base64Input.java.svn-base @@ -0,0 +1,171 @@ +package com.fp.common.base64; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.FilterInputStream; +import java.io.IOException; +import java.io.InputStream; + +import com.fp.common.logger.APPLogger; + +/** + * Clase que se encarga de + * @author Jorge Vaca. + * @version 2.1 + */ +public class Base64Input extends FilterInputStream { + private static final char[] BASE_64 = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', + 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9', '+', '/' }; + + /** + * Decodifica un array de bytes codificado. + * + * @param contenido Array de bytes + * @return array de bytes decodificado + */ + public static String decodificar(String contenido) { + ByteArrayOutputStream o = new ByteArrayOutputStream(); + ByteArrayInputStream i = new ByteArrayInputStream(contenido.replaceAll("\n", "").getBytes()); + Base64Input in = new Base64Input(i); + + try { + while (in.available() > 0) { + o.write(in.read()); + } + } catch (IOException e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + return o.toString(); + } + + private int i = 0; + + private byte[] outbuf = new byte[3]; + + /** + * Crea un nuevo objeto Base64InputStream. + * + * @param in Stream de entrada + */ + public Base64Input(InputStream in) { + super(in); + } + + /** + * Esta es una implementacion especial que devuelve 1 si hay aun por leer y + * 0 si ya se acabo. + * + * @return 1 si hay aun bytes por leer o 0 si no. + * @throws IOException En caso de que no se haya abierto el inputstream + */ + @Override + public int available() throws IOException { + return (this.in.available() + this.i > 0) ? 1 : 0; + } + + private int byteDesdeChar() throws IOException { + char c = (char) super.read(); + + while ((c == '\n') && (super.available() > 0)) { + c = (char) super.read(); // se salta las lineas + } + + while ((c == '=') && (super.available() > 0)) { + c = (char) super.read(); // se salta los iguales del final + } + + for (int a = 0; a < BASE_64.length; a++) { + if (BASE_64[a] == c) { + this.i++; + + return a; + } + } + + return 0; + } + + /** + * Indica si se soporta marcas. + * + * @return false siempre + */ + @Override + public boolean markSupported() { + return false; + } + + /** + * Lee un caracter. + * + * @return int con el caracter + * @throws IOException en caso de error + */ + @Override + public int read() throws IOException { + if (this.i == 0) { + int a = this.byteDesdeChar(); + int b = this.byteDesdeChar(); + int c = this.byteDesdeChar(); + int d = this.byteDesdeChar(); + int j = this.i--; + + if (this.i > 0) { + this.outbuf[2 - --this.i] = (byte) (a << 2 | b >> 4); + } + + if (this.i > 0) { + this.outbuf[2 - --this.i] = (byte) (b << 4 | c >> 2); + } + + if (this.i > 0) { + this.outbuf[2 - --this.i] = (byte) (c << 6 | d >> 0); + } + + this.i += j - 1; + } + + return this.outbuf[2 - --this.i]; + } + + /** + * Lee un array de bytes. + * + * @param b Array + * @return entero con el resultado + * @throws IOException en caso de error + */ + @Override + public int read(byte[] b) throws IOException { + throw new IOException("Metodo no implementado"); + } + + /** + * Lee un array de caracteres con un offset y longitud. + * + * @param b Array + * @param off Offset + * @param len Longitud + * @return entero con el resultado + * @throws IOException en caso de error + */ + @Override + public int read(byte[] b, int off, int len) throws IOException { + throw new IOException("Metodo no implementado"); + } + + /** + * Se salta n bytes del stream. No implementado. + * + * @param n Numero de bytes + * @return long con el resultado + * @throws IOException en caso de error + */ + @Override + public long skip(long n) throws IOException { + throw new IOException("Metodo no implementado"); + } + +} diff --git a/base/dto/common/src/main/java/com/fp/common/base64/Base64Input.java b/base/dto/common/src/main/java/com/fp/common/base64/Base64Input.java new file mode 100644 index 0000000..891d1ef --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/base64/Base64Input.java @@ -0,0 +1,171 @@ +package com.fp.common.base64; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.FilterInputStream; +import java.io.IOException; +import java.io.InputStream; + +import com.fp.common.logger.APPLogger; + +/** + * Clase que se encarga de + * @author Jorge Vaca. + * @version 2.1 + */ +public class Base64Input extends FilterInputStream { + private static final char[] BASE_64 = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', + 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9', '+', '/' }; + + /** + * Decodifica un array de bytes codificado. + * + * @param contenido Array de bytes + * @return array de bytes decodificado + */ + public static String decodificar(String contenido) { + ByteArrayOutputStream o = new ByteArrayOutputStream(); + ByteArrayInputStream i = new ByteArrayInputStream(contenido.replaceAll("\n", "").getBytes()); + Base64Input in = new Base64Input(i); + + try { + while (in.available() > 0) { + o.write(in.read()); + } + } catch (IOException e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + return o.toString(); + } + + private int i = 0; + + private byte[] outbuf = new byte[3]; + + /** + * Crea un nuevo objeto Base64InputStream. + * + * @param in Stream de entrada + */ + public Base64Input(InputStream in) { + super(in); + } + + /** + * Esta es una implementacion especial que devuelve 1 si hay aun por leer y + * 0 si ya se acabo. + * + * @return 1 si hay aun bytes por leer o 0 si no. + * @throws IOException En caso de que no se haya abierto el inputstream + */ + @Override + public int available() throws IOException { + return (this.in.available() + this.i > 0) ? 1 : 0; + } + + private int byteDesdeChar() throws IOException { + char c = (char) super.read(); + + while ((c == '\n') && (super.available() > 0)) { + c = (char) super.read(); // se salta las lineas + } + + while ((c == '=') && (super.available() > 0)) { + c = (char) super.read(); // se salta los iguales del final + } + + for (int a = 0; a < BASE_64.length; a++) { + if (BASE_64[a] == c) { + this.i++; + + return a; + } + } + + return 0; + } + + /** + * Indica si se soporta marcas. + * + * @return false siempre + */ + @Override + public boolean markSupported() { + return false; + } + + /** + * Lee un caracter. + * + * @return int con el caracter + * @throws IOException en caso de error + */ + @Override + public int read() throws IOException { + if (this.i == 0) { + int a = this.byteDesdeChar(); + int b = this.byteDesdeChar(); + int c = this.byteDesdeChar(); + int d = this.byteDesdeChar(); + int j = this.i--; + + if (this.i > 0) { + this.outbuf[2 - --this.i] = (byte) (a << 2 | b >> 4); + } + + if (this.i > 0) { + this.outbuf[2 - --this.i] = (byte) (b << 4 | c >> 2); + } + + if (this.i > 0) { + this.outbuf[2 - --this.i] = (byte) (c << 6 | d >> 0); + } + + this.i += j - 1; + } + + return this.outbuf[2 - --this.i]; + } + + /** + * Lee un array de bytes. + * + * @param b Array + * @return entero con el resultado + * @throws IOException en caso de error + */ + @Override + public int read(byte[] b) throws IOException { + throw new IOException("Metodo no implementado"); + } + + /** + * Lee un array de caracteres con un offset y longitud. + * + * @param b Array + * @param off Offset + * @param len Longitud + * @return entero con el resultado + * @throws IOException en caso de error + */ + @Override + public int read(byte[] b, int off, int len) throws IOException { + throw new IOException("Metodo no implementado"); + } + + /** + * Se salta n bytes del stream. No implementado. + * + * @param n Numero de bytes + * @return long con el resultado + * @throws IOException en caso de error + */ + @Override + public long skip(long n) throws IOException { + throw new IOException("Metodo no implementado"); + } + +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/.svn/entries b/base/dto/common/src/main/java/com/fp/common/exception/.svn/entries new file mode 100644 index 0000000..831c168 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/.svn/entries @@ -0,0 +1,436 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/common/exception +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +APPException.java +file + + + + +2022-07-28T03:40:35.177770Z +6937b71061ffa80db2b8bc6426394d8a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4049 + +StaleObjectStateException.java +file + + + + +2022-07-28T03:40:35.178770Z +2e98e9933333e9252508b235d37a1315 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1005 + +PropertyValueException.java +file + + + + +2022-07-28T03:40:35.178770Z +4a3a2062b0febfa25f8fa99cfcfee0b1 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +926 + +AbstractExceptionMessage.java +file + + + + +2022-07-28T03:40:35.178770Z +207f09856848a0f5dd5f8ae070acd278 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +525 + +CommonException.java +file + + + + +2022-07-28T03:40:35.178770Z +87c31f667c8a976813f1251838b0d2d9 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1195 + +NonUniqueObjectException.java +file + + + + +2022-07-28T03:40:35.179770Z +5e7cd6fbae0631c4496ff74a7538d79a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1185 + +SavePointException.java +file + + + + +2022-07-28T03:40:35.179770Z +c327ce42230fa899592c0a0a5b0c2668 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1282 + +ExceptionManager.java +file + + + + +2022-07-28T03:40:35.179770Z +2bdf50d549389bb5c9fd6a6b81345137 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1863 + +SQLExceptionManager.java +file + + + + +2022-07-28T03:40:35.179770Z +82ee28329a2c3f9ef3744bdbb805edfb +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +10456 + +ExceptionHandler.java +file + + + + +2022-07-28T03:40:35.180770Z +3e7b445cad33a302f4480cd5111aeaaa +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9025 + +IdentifierGenerationException.java +file + + + + +2022-07-28T03:40:35.180770Z +10aeb6af9f28c0b674e9db60b60c89fa +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +951 + +ExceptionsProperties.java +file + + + + +2022-07-28T03:40:35.180770Z +42d3c1d7b5d8c552023539a277bed9b7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +935 + diff --git a/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/APPException.java.svn-base b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/APPException.java.svn-base new file mode 100644 index 0000000..ee9f1d4 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/APPException.java.svn-base @@ -0,0 +1,135 @@ +package com.fp.common.exception; + +import java.util.Locale; +import java.util.ResourceBundle; + +import javax.ejb.ApplicationException; + +import com.fp.common.helper.Constant; + +/** + * Clase generica del manejo de excepciones aplicativas. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ApplicationException(rollback = true) +public class APPException extends RuntimeException { + + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Codigo de mensaje aplicativo. + */ + protected String code; + + /** + * Arreglo de parametros a mostrar en la aplicacion como numero de cuenta, tipo de saldo etc... + */ + protected Object[] parameters; + + /** + * Crea una instancia de excepcion aplicativa. + * + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativo. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public APPException(String code, String message, Object... pParameters) { + super(code + ": " + message); + this.code = code; + parameters = pParameters; + } + + /** + * Crea una intancia de excepcion aplicativa. + * + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativo. + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public APPException(String code, String message, Exception pCause, Object... pParameters) { + super(code + ": " + message); + super.initCause(pCause); + this.code = code; + parameters = pParameters; + } + + /** + * Entrega el valor del codigo de mensaje aplicativo. + * + * @return String + */ + public String getCode() { + return code; + } + + /** + * Entrega el mensaje de la excepcion. + * + * @see java.lang.Throwable#getMessage() + * @return String + */ + @Override + public String getMessage() { + String message = this.getMessage(new Locale("es")); + return message; + } + + /** + * Retorna el mensaje de la excepcion. + * + * @param pLocale Codigo de Locale a utilizar para presentar el mensaje traducido. + * @return String + */ + public String getMessage(Locale pLocale) { + try { + ResourceBundle resource = ResourceBundle.getBundle("userMessages", pLocale); + String msg = resource.getString(code); + if (parameters != null) { + msg = Constant.formatMessage(msg, parameters); + } + return msg; + } catch (Exception e) { + + try { + String msg = super.getMessage() + " <*>"; + msg = Constant.formatMessage(msg, parameters); + return msg; + } catch (Exception e1) { + return super.getMessage() + " <*>"; + } + + } + } + + /** + * Cambia los parametros del mensaje por los de la excepcion. + * + * @param message + * @return + */ + public String getUserMessage(String language) { + String msg = ""; + try { + AbstractExceptionMessage m = (AbstractExceptionMessage) Class.forName("com.fp.general.exception.ExceptionMessage").newInstance(); + msg = m.getMessage(this.getCode(), language.toUpperCase()); + } catch (APPException e) { + msg = super.getMessage(); + } catch (Exception e) { + return "NO PUEDE OBTENER DESCRIPCION DE MENSAJE APLICATIVO EN TGENERESULT CODIGO " + this.getCode() + " IDIOMA " + language; + } + try { + if (parameters != null) { + msg = Constant.formatMessage(msg, parameters); + } + } catch (Exception e) { + // no tomar accion + } + return msg; + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/AbstractExceptionMessage.java.svn-base b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/AbstractExceptionMessage.java.svn-base new file mode 100644 index 0000000..3c5d3df --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/AbstractExceptionMessage.java.svn-base @@ -0,0 +1,19 @@ +package com.fp.common.exception; + +/** + * Clase encargada de entregar la descripcion de un mensaje aplicativo. + * + * @author Jorge Vaca + * @version 2.1 + */ +public abstract class AbstractExceptionMessage { + + /** + * Entrega la descripcion de un mensaje aplicativo. + * + * @param aplicationcode Codigo de mensaje. + * @param language Idioma asociado al lenguaje. + * @return String + */ + public abstract String getMessage(String aplicationcode, String language) throws Exception; +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/CommonException.java.svn-base b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/CommonException.java.svn-base new file mode 100644 index 0000000..ea96bf6 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/CommonException.java.svn-base @@ -0,0 +1,37 @@ +package com.fp.common.exception; + +import javax.ejb.ApplicationException; + +/** + * Manejo de excepcion del paquete comun del core. + * @author Jorge Vaca. + * @version 2.1 + */ +@ApplicationException(rollback=true) +public class CommonException extends APPException { + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de CommonException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public CommonException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de CommonException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public CommonException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/ExceptionHandler.java.svn-base b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/ExceptionHandler.java.svn-base new file mode 100644 index 0000000..ba31fc3 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/ExceptionHandler.java.svn-base @@ -0,0 +1,269 @@ +package com.fp.common.exception; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.lang.reflect.InvocationTargetException; +import java.sql.BatchUpdateException; +import java.sql.SQLException; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +import javax.persistence.PersistenceException; + +import org.hibernate.exception.ConstraintViolationException; +import org.hibernate.exception.GenericJDBCException; + +import com.fp.common.logger.APPLogger; + +/** + * Clase encargada del manejo de excepciones + * + * @author Jorge Vaca + * @version 2.1 + */ +public class ExceptionHandler { + + /** + * Referencia a la excepcion presentanda. + */ + private final Throwable exception; + + /** + * Referencia a la causa de la excepcion. + */ + private Throwable cause; + + /** + * Codigo de lenguage + */ + private String language = "es"; + + /** + * Indica que es un mensaje aplicativo. + */ + private boolean appexception = false; + + /** + * Crea una Instancia de ExceptionHandler + * + * @param pException Excepcion por Manejar + */ + public ExceptionHandler(Throwable pException, String pLanguage) { + APPLogger.getLogger().warn(pException, pException); + this.exception = pException; + this.cause = this.exception.getCause(); + if (pException instanceof APPException) { + this.appexception = true; + } + while ((this.cause != null) && (this.cause.getCause() != null)) { + if ((pException instanceof InvocationTargetException) || (pException instanceof PersistenceException) + || (this.cause instanceof PersistenceException) || (this.cause instanceof InvocationTargetException) + || (pException instanceof RuntimeException)) { + if (this.cause instanceof PersistenceException) { + this.cause = this.cause.getCause(); + } + if ((this.cause != null) && (this.cause.getCause() != null)) { + this.cause = this.cause.getCause(); + } + if ((this.cause != null) && (this.cause instanceof ConstraintViolationException)) { + this.cause = this.cause.getCause(); + } + if ((this.cause != null) && (this.cause instanceof GenericJDBCException)) { + this.cause = this.cause.getCause(); + } + } else { + break; + } + if ((this.cause == null) || (this.cause.getCause() == null)) { + break; + } + } + if (pLanguage != null) { + this.language = pLanguage.toLowerCase(); + } + } + + /** + * Metodo que entrega un mensaje tecnico. + * + * @return String + */ + public String getTechnicalMessage() { + if (!(this.exception instanceof APPException)) { + return ""; + } + String message = this.exception.getMessage(); + StackTraceElement[] stack = this.exception.getStackTrace(); + if (this.cause != null) { + message = this.cause.getMessage(); + stack = this.cause.getStackTrace(); + } + for (StackTraceElement element : stack) { + if (element.getClassName().indexOf("com.fp") > -1) { + message += " " + element.getClassName() + " : " + element.getLineNumber(); + break; + } + } + return message; + } + + /** + * Metodo que entrega el StackTrace de la Excepcion. + * + * @return + */ + public String getStackTrace() { + try { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + StackTraceElement[] ele; + if (this.cause != null) { + // pw.println(this.cause.getMessage()); + ele = this.cause.getStackTrace(); + // this.cause.printStackTrace(pw); + } else { + // pw.println(this.exception.getMessage()); + ele = this.exception.getStackTrace(); + // this.exception.printStackTrace(pw); + } + String msg = this.getTechnicalMessage(); + if (msg.length() > 200) { + msg = msg.substring(0, 200); + } + pw.println(msg); + boolean first = true; + for (StackTraceElement element : ele) { + if (first) { + pw.println(element.getClassName() + "." + element.getMethodName() + ":" + element.getLineNumber()); + first = false; + continue; + } + if (element.getClassName().indexOf("com.fp") > -1) { + pw.println(" " + element.getClassName() + "." + element.getMethodName() + ":" + element.getLineNumber()); + } + } + + String data = sw.toString(); + pw.close(); + return data; + } catch (Exception e) { + return null; + } + } + + /** + * Metodo que entrega el mensaje de usuario. + * + * @return String + */ + public String getUserMessage() { + String message = this.exception.getMessage(); + Locale locale = new Locale(this.language, Locale.getDefault().getCountry(), this.getVariant()); + boolean exist = false; + if (this.exception instanceof APPException) { + message = ((APPException) this.exception).getUserMessage(this.language); + exist = true; + } + if (this.cause instanceof APPException) { + message = ((APPException) this.cause).getUserMessage(this.language); + exist = true; + } + if (!exist) { + ExceptionManager man = this.getExceptionManager(); + if (man == null) { + try { + ResourceBundle bdl = ResourceBundle.getBundle("userMessages", locale); + message = bdl.getString(this.exception.getClass().getName()); + } catch (MissingResourceException e) { + message = this.exception.getMessage(); + } + } else { + man.setLocale(locale); + message = man.getUserMessage(this.cause != null ? this.cause : this.exception); + } + } + return message; + } + + /** + * Metodo que entrega la clase que se encarga del manejo de la excepcion. + * + * @return ExceptionManager + */ + private ExceptionManager getExceptionManager() { + try { + ExceptionsProperties param = ExceptionsProperties.getInstance(); + String className = ""; + if (this.cause == null) { + className = param.getValue(this.exception.getClass().getName()); + } else { + className = param.getValue(this.cause.getClass().getName()); + } + return (ExceptionManager) Class.forName(className).newInstance(); + } catch (Exception e) { + return null; + } + } + + /** + * Metodo que entrega el codigo de la excepcion. + * + * @return String + */ + public String getCode() { + String code = this.exception.getClass().getName(); + if (this.cause != null) { + code = this.cause.getClass().getName(); + if ((this.cause instanceof BatchUpdateException) || (this.cause instanceof SQLException)) { + Integer i = ((SQLException) this.cause).getErrorCode(); + code = i.toString(); + if (code.compareTo("0") == 0) { + // Si no puede obtener una coneccion de base devuelve el codigo de error 0 + code = "99999"; + } + } + } else if (this.exception instanceof SQLException) { + Integer i = ((SQLException) this.exception).getErrorCode(); + code = i.toString(); + if (code.compareTo("0") == 0) { + // Si no puede obtener una coneccion de base devuelve el codigo de error 0 + code = "99999"; + } + } + if (this.exception instanceof APPException) { + code = ((APPException) this.exception).getCode(); + } + if (this.cause instanceof APPException) { + code = ((APPException) this.cause).getCode(); + } + return code; + } + + /** + * Metodo que entrega la variante del idioma. + * + * @return String + */ + private String getVariant() { + String code = ""; + for (int i = 0; i < this.getCode().length(); i++) { + if (Character.isDigit(this.getCode().charAt(i))) { + break; + } else { + code += this.getCode().charAt(i); + } + } + return code; + } + + /** + * Entrega el valor de: ExceptionHandler.java + * + * @return boolean + */ + public boolean isAppexception() { + return this.appexception; + } + +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/ExceptionManager.java.svn-base b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/ExceptionManager.java.svn-base new file mode 100644 index 0000000..1043da9 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/ExceptionManager.java.svn-base @@ -0,0 +1,73 @@ +package com.fp.common.exception; + +import java.text.MessageFormat; +import java.util.Locale; +import java.util.ResourceBundle; + +/** + * Clase que se encarga del manejo de excepciones. + * @author Jorge Vaca. + * @version 2.1 + */ +public abstract class ExceptionManager { + + /**Bundle que maneja los texto de error por idioma, locale*/ + private ResourceBundle messages; + /**Locale con el cual se obtiene el bundle.*/ + private Locale locale; + + /** + * Metodoq ue entrega el mensaje de usuario dada la Excepcion. + * @param pException Excepcion utilizada para obtener el mensaje de usuario. + * @return String + */ + abstract public String getUserMessage(Throwable pException); + + /** + * Metodo que entrega el codigo de excepcion. + * @param pException Excepcion utilizada para obtener el codigo de excepcion. + * @return String + */ + abstract public String getCode(Throwable pException); + + /** + * Metodo que fija el Locale, que sirve para obtener el bundel que maneja los textos de la excepcion. + * @param pLocale + */ + public void setLocale(Locale pLocale) { + locale = pLocale; + messages = ResourceBundle.getBundle("userMessages", locale); + } + + + /** + * Entrega el mensaje del bundle. + * @param pKey Codigo de mensaje del bundle. + * @return + */ + protected String getMessage(String pKey) { + try { + return messages.getString(pKey); + } catch (Throwable e) { + return null; + } + } + + /** + * Entrega el mensaje del bundle. + * @param pKey Codigo de mensaje del bundle. + * @param pParameters Parametros con los que se cpmpleta el mensaje definido en el bundle. + * @return String + */ + protected String getMessage(String pKey, Object... pParameters) { + try { + String msg = this.getMessage(pKey); + if(msg == null){ + msg = pKey; + } + return MessageFormat.format(msg, pParameters); + } catch (Throwable e) { + return null; + } + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/ExceptionsProperties.java.svn-base b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/ExceptionsProperties.java.svn-base new file mode 100644 index 0000000..f431c91 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/ExceptionsProperties.java.svn-base @@ -0,0 +1,38 @@ +package com.fp.common.exception; + +import java.io.IOException; + +import com.fp.common.properties.PropertiesHandler; + + + +/** + * Clase que se encarga del manejo del archivo de propiedades common. + * @author Jorge Vaca. + * @version 2.1 + */ +public class ExceptionsProperties extends PropertiesHandler { + /** + * Almacena una instancia del tipo ExceptionsProperties en el singleton. + */ + private static ExceptionsProperties instance=null; + /** + * Crea una instancia de CommonProperties. + */ + private ExceptionsProperties() throws IOException,Exception{ + super("exceptions"); + } + /** + * Crea y entrega una instancia de ExceptionsProperties. + * @return ExceptionsProperties + * @throws IOException + */ + public static ExceptionsProperties getInstance() throws IOException,Exception{ + synchronized(ExceptionsProperties.class){ + if(instance==null){ + instance=new ExceptionsProperties(); + } + } + return instance; + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/IdentifierGenerationException.java.svn-base b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/IdentifierGenerationException.java.svn-base new file mode 100644 index 0000000..1fa3c37 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/IdentifierGenerationException.java.svn-base @@ -0,0 +1,34 @@ +package com.fp.common.exception; + +import com.fp.common.logger.APPLogger; + +/** + * Clase que maneja execpcion de campos de clave primaria requeridos. + * @author Jorge Vaca + * @version 2.1 + */ +public class IdentifierGenerationException extends ExceptionManager{ + + /** + * Metodo que entrega el mensaje de usuario de la excepcion. + */ + public String getUserMessage(Throwable pException) { + try{ + String data=pException.getMessage(); + data=data.substring(data.indexOf(':')+1, data.length()); + data=data.substring(data.indexOf('.')+1); + String[]param=data.split("\\."); + return this.getMessage("Campos de clave primaria de la tabla [{0}] no enviados.",param[param.length -1]); + }catch(Exception e){ + APPLogger.getLogger().warn(e); + } + return pException.getLocalizedMessage(); + } + + /** + * Metodo que entrega el codigo de la excepcion. + */ + public String getCode(Throwable pException) { + return pException.getClass().getName(); + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/NonUniqueObjectException.java.svn-base b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/NonUniqueObjectException.java.svn-base new file mode 100644 index 0000000..b5b7350 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/NonUniqueObjectException.java.svn-base @@ -0,0 +1,40 @@ +package com.fp.common.exception; + +import com.fp.common.logger.APPLogger; + +/** + * Clase que se encarga del manejo de excepcion cuando se envia al entity manager mas de un objeto con el mismo pk. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class NonUniqueObjectException extends ExceptionManager { + + /** + * Metodo que entrega el mensaje de usuario. + */ + @Override + public String getUserMessage(Throwable pException) { + try { + String data = pException.getMessage(); + data = data.substring(data.indexOf(':') + 1, data.length()); + data = data.substring(data.indexOf('.') + 1); + data = data.substring(0, data.indexOf('#')); + String[] param = data.split("\\."); + data = param[param.length - 1]; + return this.getMessage("NonUniqueObjectException", data); + } catch (Exception e) { + APPLogger.getLogger().warn(e); + } + return pException.getLocalizedMessage(); + } + + /** + * Metodo que entrega el codigo de excepcion. + */ + @Override + public String getCode(Throwable pException) { + return pException.getClass().getName(); + } + +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/PropertyValueException.java.svn-base b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/PropertyValueException.java.svn-base new file mode 100644 index 0000000..c9d65e1 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/PropertyValueException.java.svn-base @@ -0,0 +1,35 @@ +package com.fp.common.exception; + +import com.fp.common.logger.APPLogger; + +/** + * Clase que maneja exepcion de valores requeridos en un bean. + * @author Jorge Vaca + * @version 2.1 + */ +public class PropertyValueException extends ExceptionManager{ + + /** + * Metodo que entrega el mensaje de usuario de la excepcion. + */ + public String getUserMessage(Throwable pException) { + try{ + String data=pException.getMessage(); + data=data.substring(data.indexOf(':')+1, data.length()); + data=data.substring(data.indexOf('.')+1); + String[]param=data.split("\\."); + return this.getMessage("PropertyValueException",param[param.length -2],param[param.length -1]); + }catch(Exception e){ + APPLogger.getLogger().warn(e); + } + return pException.getLocalizedMessage(); + } + + /** + * Metodo que entrega el codigo de la excepcion. + */ + public String getCode(Throwable pException) { + return pException.getClass().getName(); + } + +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/SQLExceptionManager.java.svn-base b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/SQLExceptionManager.java.svn-base new file mode 100644 index 0000000..ad60154 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/SQLExceptionManager.java.svn-base @@ -0,0 +1,266 @@ +package com.fp.common.exception; + +import java.sql.SQLException; + +import com.fp.common.helper.FkException; +import com.fp.common.logger.APPLogger; + +/** + * Clase que se encarga del manejo de excepciones de base de datos. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class SQLExceptionManager extends ExceptionManager { + + /** + * campos requeridos + */ + private static final int NOT_NULL = 1400; + /** + * pk duplicado + */ + private static final int UNIQUE = 1; + /** + * pk duplicado + */ + private static final int UNIQUE_SYBASE = 2601; + /** + * pk duplicado + */ + private static final int UNIQUE_INFORM = -239; + /** + * pk duplicado + */ + private static final int UNIQUE_INFORMIX = -268; + /** + * pk duplicado + */ + private static final int UNIQUE_ID = -100; + /** + * pk duplicado + */ + private static final int UNIQUE_IDINF = -346; + /** + * Error cuando se agrega un registro en Oracle y esta tiene referencia en + * una tabla padre y no se encuentra definida + */ + private static final int FKOracle = 2291; + /** + * Error cuando se agrega un registro en Sybase y esta tiene referencia en + * una tabla padre y no se encuentra definida + */ + private static final int FKSybase = 546; + /** + * Error cuando se elimina un registro en oracle y este tiene referencia en + * una tabla hija + */ + private static final int FK1Oracle = 2292; + /** + * Error cuando se elimina un registro en sybase y este tiene referencia en + * una tabla hija + */ + private static final int FK1Sybase = 547; + /** + * Error cuando se elimina un registro en informix y este tiene referencia en + * una tabla hija + */ + private static final int FK1Informix = -692; + /** + * Error de referencia FK + */ + private static final int LOCKSYBASE = 12205; + /** + * Error en oracle cuando se ingresa en un campo numerico mayor a la + * longitud permitida + */ + private static final int VALUELARGERNUMBER = 1438; + /** + * Error en informix cuando se ingresa en un campo numerico mayor a la + * longitud permitida + */ + private static final int LARGENUBER_INFORM= -1226; + /** + * Error en oracle cuando se ingresa en un campo de texto mayor a la + * longitud permitida + */ + private static final int VALUELARGERSTRING = 12899; + + /** + * Metodo que entrega el mensaje de usuario. + * + * @param pException + * @return + */ + @Override + public String getUserMessage(Throwable pException) { + SQLException exception; + try { + exception = (SQLException) pException; + } catch (Exception e) { + return pException.getLocalizedMessage(); + } + try { + if (exception.getErrorCode() == NOT_NULL) { + String data = exception.getMessage(); + data = data.substring(data.indexOf('(') + 1, data.indexOf(')')).replaceAll("\"", ""); + data = data.substring(data.indexOf('.') + 1); + String[] param = data.split("\\."); + return super.getMessage("sql-not-null", param[0], param[1]); + } + if (exception.getErrorCode() == UNIQUE) { + String data = exception.getMessage(); + data = data.substring(data.indexOf('.') + 1, data.indexOf(')')); + return super.getMessage("sql.unique", data); + } + if (exception.getErrorCode() == UNIQUE_INFORM || exception.getErrorCode() == UNIQUE_INFORMIX) { + String data = exception.getMessage(); + data = data.substring(data.indexOf(':') + 1, data.indexOf(')')); + return super.getMessage("sql.unique", data); + } + if (exception.getErrorCode() == UNIQUE_SYBASE) { + //"Attempt to insert duplicate key row in object 'TGENECATALOG' with unique index 'PKTGENECATALOG' " + String data = exception.getMessage(); + data = data.substring(data.indexOf("'") + 1, data.indexOf("' ")); + return super.getMessage("sql.unique", data); + } + if (exception.getErrorCode() == UNIQUE_ID) { + //"Attempt to insert duplicate key row in object 'TGENECATALOG' with unique index 'PKTGENECATALOG' " + String data = exception.getMessage(); + data = data.substring(data.indexOf(":") + 1, data.indexOf(".")); + return super.getMessage("sql.uniqueID", data); + } + if (exception.getErrorCode()==UNIQUE_IDINF) { + String data = exception.getMessage(); + return super.getMessage("sql.uniqueIDINF"); + } + if (exception.getErrorCode() == FKOracle || exception.getErrorCode() == FKSybase) { + String data = this.getFk(exception); + if (data == null) { + return exception.getMessage(); + } + return data; + } + if (exception.getErrorCode() == FK1Oracle || exception.getErrorCode() == FK1Sybase) { + String data = this.getFk1(exception); + if (data == null) { + return exception.getMessage(); + } + return data; + } + if (exception.getErrorCode()==FK1Informix) { + String data = exception.getMessage(); + data = data.substring(data.indexOf(".") + 1, data.indexOf(")")); + return super.getMessage("fk.informix", data); + } + if (exception.getErrorCode() == LOCKSYBASE) { + String data = this.getFk(exception); + if (data == null) { + return super.getMessage("lock", data); + } + return data; + } + if (exception.getErrorCode() == VALUELARGERNUMBER) { + return super.getMessage("valuelarger"); + } + if (exception.getErrorCode() == LARGENUBER_INFORM) { + return super.getMessage("valuelarger"); + } + if (exception.getErrorCode() == VALUELARGERSTRING) { + String mensaje = exception.getMessage(); + int a = mensaje.indexOf("\""); + mensaje = mensaje.substring(a, mensaje.length()); + mensaje = mensaje.replaceAll("\"", ""); + String[] codes = mensaje.split("\\."); + if (codes.length == 3) { + String campo = codes[2].substring(0, codes[2].indexOf("(")).trim(); + String longitud = codes[2].substring(codes[2].indexOf("("), codes[2].length()); + longitud = longitud.replace("actual", "Longitud ingresada"); + longitud = longitud.replace("maximum", "Longitud permitida"); + return super.getMessage("valueLargerWithValue", codes[1], campo, longitud); + } else { + return super.getMessage("valuelarger"); + } + } + } catch (Exception e) { + APPLogger.getLogger().warn(e); + } + return exception.getLocalizedMessage(); + } + + /** + * Entrega el codigo de la excepcion. + * + * @param pException + * @return + */ + @Override + public String getCode(Throwable pException) { + SQLException exception = (SQLException) pException; + return "SQL-" + exception.getErrorCode(); + } + + /** + * Metodo que entrega el mensaje de la exception de FK + * + * @param exception Datos de SQLException + * @return String + */ + private String getFk(SQLException exception) { + try { + String data = exception.getMessage(); + int initialposition = data.indexOf('(') + 1; + int endposition = data.indexOf(')'); + if (initialposition > 0 && endposition > 0) { + data = data.substring(initialposition, endposition).replaceAll("\"", ""); + data = data.substring(data.indexOf('.') + 1); + FkException fk = (FkException) Class.forName("com.fp.persistence.commondb.helper.Fkconstraint").newInstance(); + String[] d = fk.getFkData(data); + return super.getMessage("fk", d[1], d[0]); + } else if (data.indexOf(", table name = '") > 0) { + data = data.substring(data.indexOf(", table name = '") + 16, data.length()); + String patherTable = data.substring(0, data.indexOf("'")); + data = data.substring(data.indexOf(", constraint name = '") + 21, data.length()); + String constraintName = data.substring(0, data.indexOf("'")); + return super.getMessage("fkg", patherTable, constraintName); + } else { + return null; + } + } catch (Exception e) { + return null; + } + + } + + /** + * Metodo que entrega el mensaje de la exception de FK + * + * @param exception Datos de SQLException + * @return String + */ + private String getFk1(SQLException exception) { + try { + String data = exception.getMessage(); + int initialposition = data.indexOf('(') + 1; + int endposition = data.indexOf(')'); + if (initialposition > 0 && endposition > 0) { + data = data.substring(initialposition, endposition).replaceAll("\"", ""); + data = data.substring(data.indexOf('.') + 1); + FkException fk = (FkException) Class.forName("com.fp.persistence.commondb.helper.Fkconstraint").newInstance(); + String[] d = fk.getFkData(data); + return super.getMessage("fk1", d[1], d[0]); + } else if (data.indexOf(", table name = '") > 0) { + data = data.substring(data.indexOf(", table name = '") + 16, data.length()); + String patherTable = data.substring(0, data.indexOf("'")); + data = data.substring(data.indexOf(", constraint name = '") + 21, data.length()); + String constraintName = data.substring(0, data.indexOf("'")); + return super.getMessage("fk1g", patherTable, constraintName); + } else { + return null; + } + } catch (Exception e) { + return null; + } + + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/SavePointException.java.svn-base b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/SavePointException.java.svn-base new file mode 100644 index 0000000..11b7a2c --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/SavePointException.java.svn-base @@ -0,0 +1,36 @@ +package com.fp.common.exception; + +/** + * Clase que se encarga del manejo de excepcion que interrumpe la ejecucion de componentes de negocio y graba la transaccion. + * @author Jorge Vaca + * @version 2.1 + */ +public class SavePointException extends APPException { + + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de SavePointException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public SavePointException(String code, String message, Exception pCause, Object... pParameters) { + super(code, message, pCause, pParameters); + } + + /** + * Crea una instancia de SavePointException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public SavePointException(String code, String message, Object... pParameters) { + super(code, message, pParameters); + } + +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/StaleObjectStateException.java.svn-base b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/StaleObjectStateException.java.svn-base new file mode 100644 index 0000000..6675f39 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/.svn/text-base/StaleObjectStateException.java.svn-base @@ -0,0 +1,37 @@ +package com.fp.common.exception; + +import com.fp.common.logger.APPLogger; + +/** + * Clase que se encarga del manejo de excepcion cuando el registro es modificado en otra session de base + * de datos. + * @author Jorge Vaca + * @version 2.1 + */ +public class StaleObjectStateException extends ExceptionManager{ + + /** + * Metodo que entrega el mensaje de usuario. + */ + public String getUserMessage(Throwable pException) { + try{ + String data=pException.getMessage(); + data=data.substring(data.indexOf(':')+1, data.length()); + data=data.substring(data.indexOf('.')+1); + data=data.substring(0,data.indexOf('#')); + String[]param=data.split("\\."); + data=param[param.length-1]; + return this.getMessage("StaleObjectStateException", data); + }catch(Exception e){ + APPLogger.getLogger().warn(e); + } + return pException.getLocalizedMessage(); + } + + /** + * Metodo que entrega el codigo de excepcion. + */ + public String getCode(Throwable pException) { + return pException.getClass().getName(); + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/APPException.java b/base/dto/common/src/main/java/com/fp/common/exception/APPException.java new file mode 100644 index 0000000..ee9f1d4 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/APPException.java @@ -0,0 +1,135 @@ +package com.fp.common.exception; + +import java.util.Locale; +import java.util.ResourceBundle; + +import javax.ejb.ApplicationException; + +import com.fp.common.helper.Constant; + +/** + * Clase generica del manejo de excepciones aplicativas. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ApplicationException(rollback = true) +public class APPException extends RuntimeException { + + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Codigo de mensaje aplicativo. + */ + protected String code; + + /** + * Arreglo de parametros a mostrar en la aplicacion como numero de cuenta, tipo de saldo etc... + */ + protected Object[] parameters; + + /** + * Crea una instancia de excepcion aplicativa. + * + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativo. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public APPException(String code, String message, Object... pParameters) { + super(code + ": " + message); + this.code = code; + parameters = pParameters; + } + + /** + * Crea una intancia de excepcion aplicativa. + * + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativo. + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public APPException(String code, String message, Exception pCause, Object... pParameters) { + super(code + ": " + message); + super.initCause(pCause); + this.code = code; + parameters = pParameters; + } + + /** + * Entrega el valor del codigo de mensaje aplicativo. + * + * @return String + */ + public String getCode() { + return code; + } + + /** + * Entrega el mensaje de la excepcion. + * + * @see java.lang.Throwable#getMessage() + * @return String + */ + @Override + public String getMessage() { + String message = this.getMessage(new Locale("es")); + return message; + } + + /** + * Retorna el mensaje de la excepcion. + * + * @param pLocale Codigo de Locale a utilizar para presentar el mensaje traducido. + * @return String + */ + public String getMessage(Locale pLocale) { + try { + ResourceBundle resource = ResourceBundle.getBundle("userMessages", pLocale); + String msg = resource.getString(code); + if (parameters != null) { + msg = Constant.formatMessage(msg, parameters); + } + return msg; + } catch (Exception e) { + + try { + String msg = super.getMessage() + " <*>"; + msg = Constant.formatMessage(msg, parameters); + return msg; + } catch (Exception e1) { + return super.getMessage() + " <*>"; + } + + } + } + + /** + * Cambia los parametros del mensaje por los de la excepcion. + * + * @param message + * @return + */ + public String getUserMessage(String language) { + String msg = ""; + try { + AbstractExceptionMessage m = (AbstractExceptionMessage) Class.forName("com.fp.general.exception.ExceptionMessage").newInstance(); + msg = m.getMessage(this.getCode(), language.toUpperCase()); + } catch (APPException e) { + msg = super.getMessage(); + } catch (Exception e) { + return "NO PUEDE OBTENER DESCRIPCION DE MENSAJE APLICATIVO EN TGENERESULT CODIGO " + this.getCode() + " IDIOMA " + language; + } + try { + if (parameters != null) { + msg = Constant.formatMessage(msg, parameters); + } + } catch (Exception e) { + // no tomar accion + } + return msg; + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/AbstractExceptionMessage.java b/base/dto/common/src/main/java/com/fp/common/exception/AbstractExceptionMessage.java new file mode 100644 index 0000000..3c5d3df --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/AbstractExceptionMessage.java @@ -0,0 +1,19 @@ +package com.fp.common.exception; + +/** + * Clase encargada de entregar la descripcion de un mensaje aplicativo. + * + * @author Jorge Vaca + * @version 2.1 + */ +public abstract class AbstractExceptionMessage { + + /** + * Entrega la descripcion de un mensaje aplicativo. + * + * @param aplicationcode Codigo de mensaje. + * @param language Idioma asociado al lenguaje. + * @return String + */ + public abstract String getMessage(String aplicationcode, String language) throws Exception; +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/CommonException.java b/base/dto/common/src/main/java/com/fp/common/exception/CommonException.java new file mode 100644 index 0000000..ea96bf6 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/CommonException.java @@ -0,0 +1,37 @@ +package com.fp.common.exception; + +import javax.ejb.ApplicationException; + +/** + * Manejo de excepcion del paquete comun del core. + * @author Jorge Vaca. + * @version 2.1 + */ +@ApplicationException(rollback=true) +public class CommonException extends APPException { + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de CommonException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public CommonException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de CommonException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public CommonException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/ExceptionHandler.java b/base/dto/common/src/main/java/com/fp/common/exception/ExceptionHandler.java new file mode 100644 index 0000000..ba31fc3 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/ExceptionHandler.java @@ -0,0 +1,269 @@ +package com.fp.common.exception; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.lang.reflect.InvocationTargetException; +import java.sql.BatchUpdateException; +import java.sql.SQLException; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +import javax.persistence.PersistenceException; + +import org.hibernate.exception.ConstraintViolationException; +import org.hibernate.exception.GenericJDBCException; + +import com.fp.common.logger.APPLogger; + +/** + * Clase encargada del manejo de excepciones + * + * @author Jorge Vaca + * @version 2.1 + */ +public class ExceptionHandler { + + /** + * Referencia a la excepcion presentanda. + */ + private final Throwable exception; + + /** + * Referencia a la causa de la excepcion. + */ + private Throwable cause; + + /** + * Codigo de lenguage + */ + private String language = "es"; + + /** + * Indica que es un mensaje aplicativo. + */ + private boolean appexception = false; + + /** + * Crea una Instancia de ExceptionHandler + * + * @param pException Excepcion por Manejar + */ + public ExceptionHandler(Throwable pException, String pLanguage) { + APPLogger.getLogger().warn(pException, pException); + this.exception = pException; + this.cause = this.exception.getCause(); + if (pException instanceof APPException) { + this.appexception = true; + } + while ((this.cause != null) && (this.cause.getCause() != null)) { + if ((pException instanceof InvocationTargetException) || (pException instanceof PersistenceException) + || (this.cause instanceof PersistenceException) || (this.cause instanceof InvocationTargetException) + || (pException instanceof RuntimeException)) { + if (this.cause instanceof PersistenceException) { + this.cause = this.cause.getCause(); + } + if ((this.cause != null) && (this.cause.getCause() != null)) { + this.cause = this.cause.getCause(); + } + if ((this.cause != null) && (this.cause instanceof ConstraintViolationException)) { + this.cause = this.cause.getCause(); + } + if ((this.cause != null) && (this.cause instanceof GenericJDBCException)) { + this.cause = this.cause.getCause(); + } + } else { + break; + } + if ((this.cause == null) || (this.cause.getCause() == null)) { + break; + } + } + if (pLanguage != null) { + this.language = pLanguage.toLowerCase(); + } + } + + /** + * Metodo que entrega un mensaje tecnico. + * + * @return String + */ + public String getTechnicalMessage() { + if (!(this.exception instanceof APPException)) { + return ""; + } + String message = this.exception.getMessage(); + StackTraceElement[] stack = this.exception.getStackTrace(); + if (this.cause != null) { + message = this.cause.getMessage(); + stack = this.cause.getStackTrace(); + } + for (StackTraceElement element : stack) { + if (element.getClassName().indexOf("com.fp") > -1) { + message += " " + element.getClassName() + " : " + element.getLineNumber(); + break; + } + } + return message; + } + + /** + * Metodo que entrega el StackTrace de la Excepcion. + * + * @return + */ + public String getStackTrace() { + try { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + StackTraceElement[] ele; + if (this.cause != null) { + // pw.println(this.cause.getMessage()); + ele = this.cause.getStackTrace(); + // this.cause.printStackTrace(pw); + } else { + // pw.println(this.exception.getMessage()); + ele = this.exception.getStackTrace(); + // this.exception.printStackTrace(pw); + } + String msg = this.getTechnicalMessage(); + if (msg.length() > 200) { + msg = msg.substring(0, 200); + } + pw.println(msg); + boolean first = true; + for (StackTraceElement element : ele) { + if (first) { + pw.println(element.getClassName() + "." + element.getMethodName() + ":" + element.getLineNumber()); + first = false; + continue; + } + if (element.getClassName().indexOf("com.fp") > -1) { + pw.println(" " + element.getClassName() + "." + element.getMethodName() + ":" + element.getLineNumber()); + } + } + + String data = sw.toString(); + pw.close(); + return data; + } catch (Exception e) { + return null; + } + } + + /** + * Metodo que entrega el mensaje de usuario. + * + * @return String + */ + public String getUserMessage() { + String message = this.exception.getMessage(); + Locale locale = new Locale(this.language, Locale.getDefault().getCountry(), this.getVariant()); + boolean exist = false; + if (this.exception instanceof APPException) { + message = ((APPException) this.exception).getUserMessage(this.language); + exist = true; + } + if (this.cause instanceof APPException) { + message = ((APPException) this.cause).getUserMessage(this.language); + exist = true; + } + if (!exist) { + ExceptionManager man = this.getExceptionManager(); + if (man == null) { + try { + ResourceBundle bdl = ResourceBundle.getBundle("userMessages", locale); + message = bdl.getString(this.exception.getClass().getName()); + } catch (MissingResourceException e) { + message = this.exception.getMessage(); + } + } else { + man.setLocale(locale); + message = man.getUserMessage(this.cause != null ? this.cause : this.exception); + } + } + return message; + } + + /** + * Metodo que entrega la clase que se encarga del manejo de la excepcion. + * + * @return ExceptionManager + */ + private ExceptionManager getExceptionManager() { + try { + ExceptionsProperties param = ExceptionsProperties.getInstance(); + String className = ""; + if (this.cause == null) { + className = param.getValue(this.exception.getClass().getName()); + } else { + className = param.getValue(this.cause.getClass().getName()); + } + return (ExceptionManager) Class.forName(className).newInstance(); + } catch (Exception e) { + return null; + } + } + + /** + * Metodo que entrega el codigo de la excepcion. + * + * @return String + */ + public String getCode() { + String code = this.exception.getClass().getName(); + if (this.cause != null) { + code = this.cause.getClass().getName(); + if ((this.cause instanceof BatchUpdateException) || (this.cause instanceof SQLException)) { + Integer i = ((SQLException) this.cause).getErrorCode(); + code = i.toString(); + if (code.compareTo("0") == 0) { + // Si no puede obtener una coneccion de base devuelve el codigo de error 0 + code = "99999"; + } + } + } else if (this.exception instanceof SQLException) { + Integer i = ((SQLException) this.exception).getErrorCode(); + code = i.toString(); + if (code.compareTo("0") == 0) { + // Si no puede obtener una coneccion de base devuelve el codigo de error 0 + code = "99999"; + } + } + if (this.exception instanceof APPException) { + code = ((APPException) this.exception).getCode(); + } + if (this.cause instanceof APPException) { + code = ((APPException) this.cause).getCode(); + } + return code; + } + + /** + * Metodo que entrega la variante del idioma. + * + * @return String + */ + private String getVariant() { + String code = ""; + for (int i = 0; i < this.getCode().length(); i++) { + if (Character.isDigit(this.getCode().charAt(i))) { + break; + } else { + code += this.getCode().charAt(i); + } + } + return code; + } + + /** + * Entrega el valor de: ExceptionHandler.java + * + * @return boolean + */ + public boolean isAppexception() { + return this.appexception; + } + +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/ExceptionManager.java b/base/dto/common/src/main/java/com/fp/common/exception/ExceptionManager.java new file mode 100644 index 0000000..1043da9 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/ExceptionManager.java @@ -0,0 +1,73 @@ +package com.fp.common.exception; + +import java.text.MessageFormat; +import java.util.Locale; +import java.util.ResourceBundle; + +/** + * Clase que se encarga del manejo de excepciones. + * @author Jorge Vaca. + * @version 2.1 + */ +public abstract class ExceptionManager { + + /**Bundle que maneja los texto de error por idioma, locale*/ + private ResourceBundle messages; + /**Locale con el cual se obtiene el bundle.*/ + private Locale locale; + + /** + * Metodoq ue entrega el mensaje de usuario dada la Excepcion. + * @param pException Excepcion utilizada para obtener el mensaje de usuario. + * @return String + */ + abstract public String getUserMessage(Throwable pException); + + /** + * Metodo que entrega el codigo de excepcion. + * @param pException Excepcion utilizada para obtener el codigo de excepcion. + * @return String + */ + abstract public String getCode(Throwable pException); + + /** + * Metodo que fija el Locale, que sirve para obtener el bundel que maneja los textos de la excepcion. + * @param pLocale + */ + public void setLocale(Locale pLocale) { + locale = pLocale; + messages = ResourceBundle.getBundle("userMessages", locale); + } + + + /** + * Entrega el mensaje del bundle. + * @param pKey Codigo de mensaje del bundle. + * @return + */ + protected String getMessage(String pKey) { + try { + return messages.getString(pKey); + } catch (Throwable e) { + return null; + } + } + + /** + * Entrega el mensaje del bundle. + * @param pKey Codigo de mensaje del bundle. + * @param pParameters Parametros con los que se cpmpleta el mensaje definido en el bundle. + * @return String + */ + protected String getMessage(String pKey, Object... pParameters) { + try { + String msg = this.getMessage(pKey); + if(msg == null){ + msg = pKey; + } + return MessageFormat.format(msg, pParameters); + } catch (Throwable e) { + return null; + } + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/ExceptionsProperties.java b/base/dto/common/src/main/java/com/fp/common/exception/ExceptionsProperties.java new file mode 100644 index 0000000..f431c91 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/ExceptionsProperties.java @@ -0,0 +1,38 @@ +package com.fp.common.exception; + +import java.io.IOException; + +import com.fp.common.properties.PropertiesHandler; + + + +/** + * Clase que se encarga del manejo del archivo de propiedades common. + * @author Jorge Vaca. + * @version 2.1 + */ +public class ExceptionsProperties extends PropertiesHandler { + /** + * Almacena una instancia del tipo ExceptionsProperties en el singleton. + */ + private static ExceptionsProperties instance=null; + /** + * Crea una instancia de CommonProperties. + */ + private ExceptionsProperties() throws IOException,Exception{ + super("exceptions"); + } + /** + * Crea y entrega una instancia de ExceptionsProperties. + * @return ExceptionsProperties + * @throws IOException + */ + public static ExceptionsProperties getInstance() throws IOException,Exception{ + synchronized(ExceptionsProperties.class){ + if(instance==null){ + instance=new ExceptionsProperties(); + } + } + return instance; + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/IdentifierGenerationException.java b/base/dto/common/src/main/java/com/fp/common/exception/IdentifierGenerationException.java new file mode 100644 index 0000000..1fa3c37 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/IdentifierGenerationException.java @@ -0,0 +1,34 @@ +package com.fp.common.exception; + +import com.fp.common.logger.APPLogger; + +/** + * Clase que maneja execpcion de campos de clave primaria requeridos. + * @author Jorge Vaca + * @version 2.1 + */ +public class IdentifierGenerationException extends ExceptionManager{ + + /** + * Metodo que entrega el mensaje de usuario de la excepcion. + */ + public String getUserMessage(Throwable pException) { + try{ + String data=pException.getMessage(); + data=data.substring(data.indexOf(':')+1, data.length()); + data=data.substring(data.indexOf('.')+1); + String[]param=data.split("\\."); + return this.getMessage("Campos de clave primaria de la tabla [{0}] no enviados.",param[param.length -1]); + }catch(Exception e){ + APPLogger.getLogger().warn(e); + } + return pException.getLocalizedMessage(); + } + + /** + * Metodo que entrega el codigo de la excepcion. + */ + public String getCode(Throwable pException) { + return pException.getClass().getName(); + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/NonUniqueObjectException.java b/base/dto/common/src/main/java/com/fp/common/exception/NonUniqueObjectException.java new file mode 100644 index 0000000..b5b7350 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/NonUniqueObjectException.java @@ -0,0 +1,40 @@ +package com.fp.common.exception; + +import com.fp.common.logger.APPLogger; + +/** + * Clase que se encarga del manejo de excepcion cuando se envia al entity manager mas de un objeto con el mismo pk. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class NonUniqueObjectException extends ExceptionManager { + + /** + * Metodo que entrega el mensaje de usuario. + */ + @Override + public String getUserMessage(Throwable pException) { + try { + String data = pException.getMessage(); + data = data.substring(data.indexOf(':') + 1, data.length()); + data = data.substring(data.indexOf('.') + 1); + data = data.substring(0, data.indexOf('#')); + String[] param = data.split("\\."); + data = param[param.length - 1]; + return this.getMessage("NonUniqueObjectException", data); + } catch (Exception e) { + APPLogger.getLogger().warn(e); + } + return pException.getLocalizedMessage(); + } + + /** + * Metodo que entrega el codigo de excepcion. + */ + @Override + public String getCode(Throwable pException) { + return pException.getClass().getName(); + } + +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/PropertyValueException.java b/base/dto/common/src/main/java/com/fp/common/exception/PropertyValueException.java new file mode 100644 index 0000000..c9d65e1 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/PropertyValueException.java @@ -0,0 +1,35 @@ +package com.fp.common.exception; + +import com.fp.common.logger.APPLogger; + +/** + * Clase que maneja exepcion de valores requeridos en un bean. + * @author Jorge Vaca + * @version 2.1 + */ +public class PropertyValueException extends ExceptionManager{ + + /** + * Metodo que entrega el mensaje de usuario de la excepcion. + */ + public String getUserMessage(Throwable pException) { + try{ + String data=pException.getMessage(); + data=data.substring(data.indexOf(':')+1, data.length()); + data=data.substring(data.indexOf('.')+1); + String[]param=data.split("\\."); + return this.getMessage("PropertyValueException",param[param.length -2],param[param.length -1]); + }catch(Exception e){ + APPLogger.getLogger().warn(e); + } + return pException.getLocalizedMessage(); + } + + /** + * Metodo que entrega el codigo de la excepcion. + */ + public String getCode(Throwable pException) { + return pException.getClass().getName(); + } + +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/SQLExceptionManager.java b/base/dto/common/src/main/java/com/fp/common/exception/SQLExceptionManager.java new file mode 100644 index 0000000..ad60154 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/SQLExceptionManager.java @@ -0,0 +1,266 @@ +package com.fp.common.exception; + +import java.sql.SQLException; + +import com.fp.common.helper.FkException; +import com.fp.common.logger.APPLogger; + +/** + * Clase que se encarga del manejo de excepciones de base de datos. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class SQLExceptionManager extends ExceptionManager { + + /** + * campos requeridos + */ + private static final int NOT_NULL = 1400; + /** + * pk duplicado + */ + private static final int UNIQUE = 1; + /** + * pk duplicado + */ + private static final int UNIQUE_SYBASE = 2601; + /** + * pk duplicado + */ + private static final int UNIQUE_INFORM = -239; + /** + * pk duplicado + */ + private static final int UNIQUE_INFORMIX = -268; + /** + * pk duplicado + */ + private static final int UNIQUE_ID = -100; + /** + * pk duplicado + */ + private static final int UNIQUE_IDINF = -346; + /** + * Error cuando se agrega un registro en Oracle y esta tiene referencia en + * una tabla padre y no se encuentra definida + */ + private static final int FKOracle = 2291; + /** + * Error cuando se agrega un registro en Sybase y esta tiene referencia en + * una tabla padre y no se encuentra definida + */ + private static final int FKSybase = 546; + /** + * Error cuando se elimina un registro en oracle y este tiene referencia en + * una tabla hija + */ + private static final int FK1Oracle = 2292; + /** + * Error cuando se elimina un registro en sybase y este tiene referencia en + * una tabla hija + */ + private static final int FK1Sybase = 547; + /** + * Error cuando se elimina un registro en informix y este tiene referencia en + * una tabla hija + */ + private static final int FK1Informix = -692; + /** + * Error de referencia FK + */ + private static final int LOCKSYBASE = 12205; + /** + * Error en oracle cuando se ingresa en un campo numerico mayor a la + * longitud permitida + */ + private static final int VALUELARGERNUMBER = 1438; + /** + * Error en informix cuando se ingresa en un campo numerico mayor a la + * longitud permitida + */ + private static final int LARGENUBER_INFORM= -1226; + /** + * Error en oracle cuando se ingresa en un campo de texto mayor a la + * longitud permitida + */ + private static final int VALUELARGERSTRING = 12899; + + /** + * Metodo que entrega el mensaje de usuario. + * + * @param pException + * @return + */ + @Override + public String getUserMessage(Throwable pException) { + SQLException exception; + try { + exception = (SQLException) pException; + } catch (Exception e) { + return pException.getLocalizedMessage(); + } + try { + if (exception.getErrorCode() == NOT_NULL) { + String data = exception.getMessage(); + data = data.substring(data.indexOf('(') + 1, data.indexOf(')')).replaceAll("\"", ""); + data = data.substring(data.indexOf('.') + 1); + String[] param = data.split("\\."); + return super.getMessage("sql-not-null", param[0], param[1]); + } + if (exception.getErrorCode() == UNIQUE) { + String data = exception.getMessage(); + data = data.substring(data.indexOf('.') + 1, data.indexOf(')')); + return super.getMessage("sql.unique", data); + } + if (exception.getErrorCode() == UNIQUE_INFORM || exception.getErrorCode() == UNIQUE_INFORMIX) { + String data = exception.getMessage(); + data = data.substring(data.indexOf(':') + 1, data.indexOf(')')); + return super.getMessage("sql.unique", data); + } + if (exception.getErrorCode() == UNIQUE_SYBASE) { + //"Attempt to insert duplicate key row in object 'TGENECATALOG' with unique index 'PKTGENECATALOG' " + String data = exception.getMessage(); + data = data.substring(data.indexOf("'") + 1, data.indexOf("' ")); + return super.getMessage("sql.unique", data); + } + if (exception.getErrorCode() == UNIQUE_ID) { + //"Attempt to insert duplicate key row in object 'TGENECATALOG' with unique index 'PKTGENECATALOG' " + String data = exception.getMessage(); + data = data.substring(data.indexOf(":") + 1, data.indexOf(".")); + return super.getMessage("sql.uniqueID", data); + } + if (exception.getErrorCode()==UNIQUE_IDINF) { + String data = exception.getMessage(); + return super.getMessage("sql.uniqueIDINF"); + } + if (exception.getErrorCode() == FKOracle || exception.getErrorCode() == FKSybase) { + String data = this.getFk(exception); + if (data == null) { + return exception.getMessage(); + } + return data; + } + if (exception.getErrorCode() == FK1Oracle || exception.getErrorCode() == FK1Sybase) { + String data = this.getFk1(exception); + if (data == null) { + return exception.getMessage(); + } + return data; + } + if (exception.getErrorCode()==FK1Informix) { + String data = exception.getMessage(); + data = data.substring(data.indexOf(".") + 1, data.indexOf(")")); + return super.getMessage("fk.informix", data); + } + if (exception.getErrorCode() == LOCKSYBASE) { + String data = this.getFk(exception); + if (data == null) { + return super.getMessage("lock", data); + } + return data; + } + if (exception.getErrorCode() == VALUELARGERNUMBER) { + return super.getMessage("valuelarger"); + } + if (exception.getErrorCode() == LARGENUBER_INFORM) { + return super.getMessage("valuelarger"); + } + if (exception.getErrorCode() == VALUELARGERSTRING) { + String mensaje = exception.getMessage(); + int a = mensaje.indexOf("\""); + mensaje = mensaje.substring(a, mensaje.length()); + mensaje = mensaje.replaceAll("\"", ""); + String[] codes = mensaje.split("\\."); + if (codes.length == 3) { + String campo = codes[2].substring(0, codes[2].indexOf("(")).trim(); + String longitud = codes[2].substring(codes[2].indexOf("("), codes[2].length()); + longitud = longitud.replace("actual", "Longitud ingresada"); + longitud = longitud.replace("maximum", "Longitud permitida"); + return super.getMessage("valueLargerWithValue", codes[1], campo, longitud); + } else { + return super.getMessage("valuelarger"); + } + } + } catch (Exception e) { + APPLogger.getLogger().warn(e); + } + return exception.getLocalizedMessage(); + } + + /** + * Entrega el codigo de la excepcion. + * + * @param pException + * @return + */ + @Override + public String getCode(Throwable pException) { + SQLException exception = (SQLException) pException; + return "SQL-" + exception.getErrorCode(); + } + + /** + * Metodo que entrega el mensaje de la exception de FK + * + * @param exception Datos de SQLException + * @return String + */ + private String getFk(SQLException exception) { + try { + String data = exception.getMessage(); + int initialposition = data.indexOf('(') + 1; + int endposition = data.indexOf(')'); + if (initialposition > 0 && endposition > 0) { + data = data.substring(initialposition, endposition).replaceAll("\"", ""); + data = data.substring(data.indexOf('.') + 1); + FkException fk = (FkException) Class.forName("com.fp.persistence.commondb.helper.Fkconstraint").newInstance(); + String[] d = fk.getFkData(data); + return super.getMessage("fk", d[1], d[0]); + } else if (data.indexOf(", table name = '") > 0) { + data = data.substring(data.indexOf(", table name = '") + 16, data.length()); + String patherTable = data.substring(0, data.indexOf("'")); + data = data.substring(data.indexOf(", constraint name = '") + 21, data.length()); + String constraintName = data.substring(0, data.indexOf("'")); + return super.getMessage("fkg", patherTable, constraintName); + } else { + return null; + } + } catch (Exception e) { + return null; + } + + } + + /** + * Metodo que entrega el mensaje de la exception de FK + * + * @param exception Datos de SQLException + * @return String + */ + private String getFk1(SQLException exception) { + try { + String data = exception.getMessage(); + int initialposition = data.indexOf('(') + 1; + int endposition = data.indexOf(')'); + if (initialposition > 0 && endposition > 0) { + data = data.substring(initialposition, endposition).replaceAll("\"", ""); + data = data.substring(data.indexOf('.') + 1); + FkException fk = (FkException) Class.forName("com.fp.persistence.commondb.helper.Fkconstraint").newInstance(); + String[] d = fk.getFkData(data); + return super.getMessage("fk1", d[1], d[0]); + } else if (data.indexOf(", table name = '") > 0) { + data = data.substring(data.indexOf(", table name = '") + 16, data.length()); + String patherTable = data.substring(0, data.indexOf("'")); + data = data.substring(data.indexOf(", constraint name = '") + 21, data.length()); + String constraintName = data.substring(0, data.indexOf("'")); + return super.getMessage("fk1g", patherTable, constraintName); + } else { + return null; + } + } catch (Exception e) { + return null; + } + + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/SavePointException.java b/base/dto/common/src/main/java/com/fp/common/exception/SavePointException.java new file mode 100644 index 0000000..11b7a2c --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/SavePointException.java @@ -0,0 +1,36 @@ +package com.fp.common.exception; + +/** + * Clase que se encarga del manejo de excepcion que interrumpe la ejecucion de componentes de negocio y graba la transaccion. + * @author Jorge Vaca + * @version 2.1 + */ +public class SavePointException extends APPException { + + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de SavePointException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public SavePointException(String code, String message, Exception pCause, Object... pParameters) { + super(code, message, pCause, pParameters); + } + + /** + * Crea una instancia de SavePointException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public SavePointException(String code, String message, Object... pParameters) { + super(code, message, pParameters); + } + +} diff --git a/base/dto/common/src/main/java/com/fp/common/exception/StaleObjectStateException.java b/base/dto/common/src/main/java/com/fp/common/exception/StaleObjectStateException.java new file mode 100644 index 0000000..6675f39 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/exception/StaleObjectStateException.java @@ -0,0 +1,37 @@ +package com.fp.common.exception; + +import com.fp.common.logger.APPLogger; + +/** + * Clase que se encarga del manejo de excepcion cuando el registro es modificado en otra session de base + * de datos. + * @author Jorge Vaca + * @version 2.1 + */ +public class StaleObjectStateException extends ExceptionManager{ + + /** + * Metodo que entrega el mensaje de usuario. + */ + public String getUserMessage(Throwable pException) { + try{ + String data=pException.getMessage(); + data=data.substring(data.indexOf(':')+1, data.length()); + data=data.substring(data.indexOf('.')+1); + data=data.substring(0,data.indexOf('#')); + String[]param=data.split("\\."); + data=param[param.length-1]; + return this.getMessage("StaleObjectStateException", data); + }catch(Exception e){ + APPLogger.getLogger().warn(e); + } + return pException.getLocalizedMessage(); + } + + /** + * Metodo que entrega el codigo de excepcion. + */ + public String getCode(Throwable pException) { + return pException.getClass().getName(); + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/files/.svn/entries b/base/dto/common/src/main/java/com/fp/common/files/.svn/entries new file mode 100644 index 0000000..425f17b --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/files/.svn/entries @@ -0,0 +1,99 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/common/files +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +FileIterator.java +file + + + + +2022-07-28T03:40:34.834769Z +06e1b3b4af1c19caa692c2fb69253866 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3669 + +StreamHelper.java +file + + + + +2022-07-28T03:40:34.834769Z +430c849f3ebdca52797122b7e37c76b3 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6112 + +record +dir + diff --git a/base/dto/common/src/main/java/com/fp/common/files/.svn/text-base/FileIterator.java.svn-base b/base/dto/common/src/main/java/com/fp/common/files/.svn/text-base/FileIterator.java.svn-base new file mode 100644 index 0000000..1f5852f --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/files/.svn/text-base/FileIterator.java.svn-base @@ -0,0 +1,128 @@ +package com.fp.common.files; + +import java.io.BufferedInputStream; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.Iterator; + +import com.fp.ach.exception.AchException; +import com.fp.common.logger.APPLogger; + +/** + * Clase que se encarga de la lectura de los archivos Nacha + * Cada Iterable contiene 88 registros cada uno de los cuales esta compuesto por 94 bytes + * @author scastillo + */ +public class FileIterator implements Iterable { + + /* + * Tamanio de bytes de lectura + * Se multiplica los 94 bytes que contiene cada registro por el numero + * de lecturas que se desea efectuar en nuestro caso 88 registros + * LLegan caracteres especiales de fin de registro \r\n son 96 bytes por registro + */ + private int size = 8448; //antes 8272 + /** + * Variable que contiene los bytes del archivo + */ + BufferedInputStream bufferedInputStream = null; + /** + * Variable que contiene los bytes de los 88 registros + */ + byte[] buffer = null; + /* + * Variable que indica el numero de registros leidos + */ + int bytesRead; + /* + * Variable que contiene el contador de registros + */ + int count; + + /** + * Constructor por defecto de la clase + * @param fileName Nombre del archivo a procesar + * @throws Exception + */ + public FileIterator(String fileName, int sizebuffer) throws Exception { + size = sizebuffer; + buffer = new byte[size]; + bytesRead = 0; + count = 0; + try { + bufferedInputStream = new BufferedInputStream(new FileInputStream(fileName)); + } catch (FileNotFoundException ex) { + throw new AchException("ACH-0001", "NO SE PUEDE LEER EL ARCHIVO {0}", fileName); + } + } + + /** + * Interator de la clase NachaFileIterator + * @return + */ + public Iterator iterator() { + return new NFIterator(); + } + + /** + * Metodo que se encarga de cerrar el archivo + * @throws Exception + */ + public void closeBuffer() { + if (bufferedInputStream != null) { + try { + bufferedInputStream.close(); + } catch (IOException ex) { + APPLogger.getLogger().error("No se pudo cerrar el buffer", ex); + } + } + } + + /** + * Clase privada que se encarga de realizar el Interator + */ + private class NFIterator implements Iterator { + /* + * Variable que contiene los 88 registros + */ + + private String currentLine; + + /** + * Metodo que recorre los los 88 registros + * @return + */ + public boolean hasNext() { + try { + if ((bytesRead = bufferedInputStream.read(buffer)) != -1) { + currentLine = new String(buffer, 0, bytesRead, "ISO-8859-1"); + count++; + } else { + currentLine = null; + closeBuffer(); + } + } catch (IOException e) { + currentLine = null; + closeBuffer(); + } + + return currentLine != null; + } + + /** + * Metodo que devuelve los siguientes 88 registros + * @return + */ + public String next() { + return currentLine; + } + + /** + * Metodo que se jecuta al elimnar un registro + * NO HACE NADA + */ + public void remove() { + } + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/files/.svn/text-base/StreamHelper.java.svn-base b/base/dto/common/src/main/java/com/fp/common/files/.svn/text-base/StreamHelper.java.svn-base new file mode 100644 index 0000000..15a77ba --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/files/.svn/text-base/StreamHelper.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.common.files; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.zip.DataFormatException; +import java.util.zip.Deflater; +import java.util.zip.DeflaterOutputStream; +import java.util.zip.Inflater; +import java.util.zip.InflaterInputStream; + +import org.apache.velocity.exception.ResourceNotFoundException; + +/** + * Clase utilitaria que se encarga del manejo de streams. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class StreamHelper { + public static void serialize(Object pData, String pName) throws IOException { + FileOutputStream sw = new FileOutputStream("/log/" + pName + ".rq"); + ObjectOutputStream oo = new ObjectOutputStream(sw); + oo.writeObject(pData); + oo.close(); + } + + public static String readResource(String pResource) throws Exception { + InputStream in = String.class.getResourceAsStream(pResource); + try { + if (in == null) { + throw new ResourceNotFoundException(pResource); + } + return StreamHelper.readStream(in); + } finally { + if (in != null) { + in.close(); + } + } + } + + public static byte[] objectToBytes(Object pData) throws IOException { + ByteArrayOutputStream sw = new ByteArrayOutputStream(); + ObjectOutputStream oo = new ObjectOutputStream(sw); + oo.writeObject(pData); + oo.close(); + return sw.toByteArray(); + } + + public static Object bytesToObject(byte[] pData) throws IOException, ClassNotFoundException { + ByteArrayInputStream sw = new ByteArrayInputStream(pData); + ObjectInputStream oo = new ObjectInputStream(sw); + Object data = oo.readObject(); + oo.close(); + return data; + } + + public static Object deserialize(String pName) throws IOException, ClassNotFoundException { + FileInputStream sw = new FileInputStream("/log/" + pName + ".rq"); + ObjectInputStream oo = new ObjectInputStream(sw); + Object data = oo.readObject(); + oo.close(); + return data; + } + + public static String readFile(String pPath) throws IOException { + FileInputStream fin = new FileInputStream(pPath); + String data = StreamHelper.readStream(fin); + fin.close(); + return data; + } + + public static void saveFile(String pPath, byte[] pContent) throws IOException { + FileOutputStream fout = new FileOutputStream(pPath); + fout.write(pContent); + fout.close(); + } + + public static String readStream(InputStream pIn) throws IOException { + byte b[] = new byte[9999]; + int car = 0; + String data = ""; + do { + car = pIn.read(b); + if (car > 0) { + data += new String(b, 0, car); + } + } while (car > 0); + return data; + } + + public static void writeFile(String pPath, String pData) throws IOException { + FileOutputStream fos = new FileOutputStream(pPath); + fos.write(pData.getBytes()); + fos.close(); + } + + public static byte[] compress64k(byte[] pData) throws IOException { + byte[] output = new byte[65536]; + Deflater compresser = new Deflater(); + compresser.setInput(pData); + compresser.finish(); + int c = compresser.deflate(output); + ByteArrayInputStream by = new ByteArrayInputStream(output, 0, c); + byte b[] = StreamHelper.streamToBytes(by); + by.close(); + return b; + } + + public static byte[] unCompress64k(byte[] pData) throws IOException, DataFormatException { + Inflater decompresser = new Inflater(); + decompresser.setInput(pData, 0, pData.length); + byte[] result = new byte[65536]; + int resultLength = decompresser.inflate(result); + decompresser.end(); + ByteArrayInputStream by = new ByteArrayInputStream(result, 0, resultLength); + byte b[] = StreamHelper.streamToBytes(by); + by.close(); + return b; + } + + public static byte[] compress(byte[] pData) throws IOException { + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + DeflaterOutputStream dout = new DeflaterOutputStream(bout); + dout.write(pData); + dout.close(); + byte b[] = bout.toByteArray(); + return b; + } + + public static byte[] unCompress(byte[] pData) throws IOException { + ByteArrayInputStream bin = new ByteArrayInputStream(pData); + InflaterInputStream din = new InflaterInputStream(bin); + byte b[] = StreamHelper.streamToBytes(din); + din.close(); + + return b; + } + + public static byte[] streamToBytes(InputStream pData) throws IOException { + ByteArrayOutputStream by = new ByteArrayOutputStream(); + byte b[] = new byte[9999]; + int car = 0; + do { + car = pData.read(b); + if (car > 0) { + by.write(b, 0, car); + } + } while (car > 0); + b = by.toByteArray(); + by.close(); + return b; + } + + public static byte[] compress(String pData) throws IOException { + return StreamHelper.compress(pData.getBytes()); + } + + public static byte[] compressObject(Object pData) throws IOException { + return StreamHelper.compress(StreamHelper.objectToBytes(pData)); + } + + public static String unCompressToString(byte[] pData) throws IOException { + byte[] b = StreamHelper.unCompress(pData); + return new String(b); + } + + public static Object unCompressToObject(byte[] pData) throws IOException, ClassNotFoundException { + byte[] b = StreamHelper.unCompress(pData); + return StreamHelper.bytesToObject(b); + } + +} diff --git a/base/dto/common/src/main/java/com/fp/common/files/FileIterator.java b/base/dto/common/src/main/java/com/fp/common/files/FileIterator.java new file mode 100644 index 0000000..1f5852f --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/files/FileIterator.java @@ -0,0 +1,128 @@ +package com.fp.common.files; + +import java.io.BufferedInputStream; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.Iterator; + +import com.fp.ach.exception.AchException; +import com.fp.common.logger.APPLogger; + +/** + * Clase que se encarga de la lectura de los archivos Nacha + * Cada Iterable contiene 88 registros cada uno de los cuales esta compuesto por 94 bytes + * @author scastillo + */ +public class FileIterator implements Iterable { + + /* + * Tamanio de bytes de lectura + * Se multiplica los 94 bytes que contiene cada registro por el numero + * de lecturas que se desea efectuar en nuestro caso 88 registros + * LLegan caracteres especiales de fin de registro \r\n son 96 bytes por registro + */ + private int size = 8448; //antes 8272 + /** + * Variable que contiene los bytes del archivo + */ + BufferedInputStream bufferedInputStream = null; + /** + * Variable que contiene los bytes de los 88 registros + */ + byte[] buffer = null; + /* + * Variable que indica el numero de registros leidos + */ + int bytesRead; + /* + * Variable que contiene el contador de registros + */ + int count; + + /** + * Constructor por defecto de la clase + * @param fileName Nombre del archivo a procesar + * @throws Exception + */ + public FileIterator(String fileName, int sizebuffer) throws Exception { + size = sizebuffer; + buffer = new byte[size]; + bytesRead = 0; + count = 0; + try { + bufferedInputStream = new BufferedInputStream(new FileInputStream(fileName)); + } catch (FileNotFoundException ex) { + throw new AchException("ACH-0001", "NO SE PUEDE LEER EL ARCHIVO {0}", fileName); + } + } + + /** + * Interator de la clase NachaFileIterator + * @return + */ + public Iterator iterator() { + return new NFIterator(); + } + + /** + * Metodo que se encarga de cerrar el archivo + * @throws Exception + */ + public void closeBuffer() { + if (bufferedInputStream != null) { + try { + bufferedInputStream.close(); + } catch (IOException ex) { + APPLogger.getLogger().error("No se pudo cerrar el buffer", ex); + } + } + } + + /** + * Clase privada que se encarga de realizar el Interator + */ + private class NFIterator implements Iterator { + /* + * Variable que contiene los 88 registros + */ + + private String currentLine; + + /** + * Metodo que recorre los los 88 registros + * @return + */ + public boolean hasNext() { + try { + if ((bytesRead = bufferedInputStream.read(buffer)) != -1) { + currentLine = new String(buffer, 0, bytesRead, "ISO-8859-1"); + count++; + } else { + currentLine = null; + closeBuffer(); + } + } catch (IOException e) { + currentLine = null; + closeBuffer(); + } + + return currentLine != null; + } + + /** + * Metodo que devuelve los siguientes 88 registros + * @return + */ + public String next() { + return currentLine; + } + + /** + * Metodo que se jecuta al elimnar un registro + * NO HACE NADA + */ + public void remove() { + } + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/files/StreamHelper.java b/base/dto/common/src/main/java/com/fp/common/files/StreamHelper.java new file mode 100644 index 0000000..15a77ba --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/files/StreamHelper.java @@ -0,0 +1,178 @@ +package com.fp.common.files; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.zip.DataFormatException; +import java.util.zip.Deflater; +import java.util.zip.DeflaterOutputStream; +import java.util.zip.Inflater; +import java.util.zip.InflaterInputStream; + +import org.apache.velocity.exception.ResourceNotFoundException; + +/** + * Clase utilitaria que se encarga del manejo de streams. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class StreamHelper { + public static void serialize(Object pData, String pName) throws IOException { + FileOutputStream sw = new FileOutputStream("/log/" + pName + ".rq"); + ObjectOutputStream oo = new ObjectOutputStream(sw); + oo.writeObject(pData); + oo.close(); + } + + public static String readResource(String pResource) throws Exception { + InputStream in = String.class.getResourceAsStream(pResource); + try { + if (in == null) { + throw new ResourceNotFoundException(pResource); + } + return StreamHelper.readStream(in); + } finally { + if (in != null) { + in.close(); + } + } + } + + public static byte[] objectToBytes(Object pData) throws IOException { + ByteArrayOutputStream sw = new ByteArrayOutputStream(); + ObjectOutputStream oo = new ObjectOutputStream(sw); + oo.writeObject(pData); + oo.close(); + return sw.toByteArray(); + } + + public static Object bytesToObject(byte[] pData) throws IOException, ClassNotFoundException { + ByteArrayInputStream sw = new ByteArrayInputStream(pData); + ObjectInputStream oo = new ObjectInputStream(sw); + Object data = oo.readObject(); + oo.close(); + return data; + } + + public static Object deserialize(String pName) throws IOException, ClassNotFoundException { + FileInputStream sw = new FileInputStream("/log/" + pName + ".rq"); + ObjectInputStream oo = new ObjectInputStream(sw); + Object data = oo.readObject(); + oo.close(); + return data; + } + + public static String readFile(String pPath) throws IOException { + FileInputStream fin = new FileInputStream(pPath); + String data = StreamHelper.readStream(fin); + fin.close(); + return data; + } + + public static void saveFile(String pPath, byte[] pContent) throws IOException { + FileOutputStream fout = new FileOutputStream(pPath); + fout.write(pContent); + fout.close(); + } + + public static String readStream(InputStream pIn) throws IOException { + byte b[] = new byte[9999]; + int car = 0; + String data = ""; + do { + car = pIn.read(b); + if (car > 0) { + data += new String(b, 0, car); + } + } while (car > 0); + return data; + } + + public static void writeFile(String pPath, String pData) throws IOException { + FileOutputStream fos = new FileOutputStream(pPath); + fos.write(pData.getBytes()); + fos.close(); + } + + public static byte[] compress64k(byte[] pData) throws IOException { + byte[] output = new byte[65536]; + Deflater compresser = new Deflater(); + compresser.setInput(pData); + compresser.finish(); + int c = compresser.deflate(output); + ByteArrayInputStream by = new ByteArrayInputStream(output, 0, c); + byte b[] = StreamHelper.streamToBytes(by); + by.close(); + return b; + } + + public static byte[] unCompress64k(byte[] pData) throws IOException, DataFormatException { + Inflater decompresser = new Inflater(); + decompresser.setInput(pData, 0, pData.length); + byte[] result = new byte[65536]; + int resultLength = decompresser.inflate(result); + decompresser.end(); + ByteArrayInputStream by = new ByteArrayInputStream(result, 0, resultLength); + byte b[] = StreamHelper.streamToBytes(by); + by.close(); + return b; + } + + public static byte[] compress(byte[] pData) throws IOException { + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + DeflaterOutputStream dout = new DeflaterOutputStream(bout); + dout.write(pData); + dout.close(); + byte b[] = bout.toByteArray(); + return b; + } + + public static byte[] unCompress(byte[] pData) throws IOException { + ByteArrayInputStream bin = new ByteArrayInputStream(pData); + InflaterInputStream din = new InflaterInputStream(bin); + byte b[] = StreamHelper.streamToBytes(din); + din.close(); + + return b; + } + + public static byte[] streamToBytes(InputStream pData) throws IOException { + ByteArrayOutputStream by = new ByteArrayOutputStream(); + byte b[] = new byte[9999]; + int car = 0; + do { + car = pData.read(b); + if (car > 0) { + by.write(b, 0, car); + } + } while (car > 0); + b = by.toByteArray(); + by.close(); + return b; + } + + public static byte[] compress(String pData) throws IOException { + return StreamHelper.compress(pData.getBytes()); + } + + public static byte[] compressObject(Object pData) throws IOException { + return StreamHelper.compress(StreamHelper.objectToBytes(pData)); + } + + public static String unCompressToString(byte[] pData) throws IOException { + byte[] b = StreamHelper.unCompress(pData); + return new String(b); + } + + public static Object unCompressToObject(byte[] pData) throws IOException, ClassNotFoundException { + byte[] b = StreamHelper.unCompress(pData); + return StreamHelper.bytesToObject(b); + } + +} diff --git a/base/dto/common/src/main/java/com/fp/common/files/record/.svn/entries b/base/dto/common/src/main/java/com/fp/common/files/record/.svn/entries new file mode 100644 index 0000000..42d22f8 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/files/record/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/common/files/record +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +RecordIterator.java +file + + + + +2022-07-28T03:40:34.810769Z +3b135162902e23bfeacbf4fe31b6852a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2155 + diff --git a/base/dto/common/src/main/java/com/fp/common/files/record/.svn/text-base/RecordIterator.java.svn-base b/base/dto/common/src/main/java/com/fp/common/files/record/.svn/text-base/RecordIterator.java.svn-base new file mode 100644 index 0000000..6811eca --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/files/record/.svn/text-base/RecordIterator.java.svn-base @@ -0,0 +1,85 @@ +package com.fp.common.files.record; + +import java.util.Iterator; + + +/** + * Clase que se encarga de la lectura de los bytes de cada registro + * Cada Iterable que contiene los 94 bytes del registro + * @author scastillo + */ +public class RecordIterator implements Iterable { + /* + * Variable que contiene la posicion inicial para armar los 94 bytes + */ + + int startPosition = 0; + /** + * Variable que contine los 88 registros + */ + String inString; + /* + * Variable que indica el tamao de cada registro + */ + private int size = 96; + + /** + * Constructor de la clase + * @param inString + */ + public RecordIterator(String inString,int linesize) { + size = linesize; + this.inString = inString; + } + + /** + * Metodo que reccore los registros + */ + public Iterator iterator() { + return new RIterator(); + } + + /** + * Clase privada que se encarga de realizar el Interator + */ + private class RIterator implements Iterator { + /* + * Variable que contiene los 94 bytes del registro nacha + */ + + String register; + + public boolean hasNext() { + boolean ret = false; + int endPosition = startPosition + size; + if (startPosition == inString.length()) { + return false; + } + if (endPosition > inString.length()) { + endPosition = inString.length(); + } + register = inString.substring(startPosition, endPosition); + if (startPosition < inString.length()) { + startPosition += size; + ret = true; + } else { + ret = false; + } + return ret; + } + + /** + * Metodo que devuelve un registro de 94 bytes + * @return + */ + public String next() { + return register; + } + + /** + * Metodo que se ejecuta al eliminar un registro + */ + public void remove() { + } + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/files/record/RecordIterator.java b/base/dto/common/src/main/java/com/fp/common/files/record/RecordIterator.java new file mode 100644 index 0000000..6811eca --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/files/record/RecordIterator.java @@ -0,0 +1,85 @@ +package com.fp.common.files.record; + +import java.util.Iterator; + + +/** + * Clase que se encarga de la lectura de los bytes de cada registro + * Cada Iterable que contiene los 94 bytes del registro + * @author scastillo + */ +public class RecordIterator implements Iterable { + /* + * Variable que contiene la posicion inicial para armar los 94 bytes + */ + + int startPosition = 0; + /** + * Variable que contine los 88 registros + */ + String inString; + /* + * Variable que indica el tamao de cada registro + */ + private int size = 96; + + /** + * Constructor de la clase + * @param inString + */ + public RecordIterator(String inString,int linesize) { + size = linesize; + this.inString = inString; + } + + /** + * Metodo que reccore los registros + */ + public Iterator iterator() { + return new RIterator(); + } + + /** + * Clase privada que se encarga de realizar el Interator + */ + private class RIterator implements Iterator { + /* + * Variable que contiene los 94 bytes del registro nacha + */ + + String register; + + public boolean hasNext() { + boolean ret = false; + int endPosition = startPosition + size; + if (startPosition == inString.length()) { + return false; + } + if (endPosition > inString.length()) { + endPosition = inString.length(); + } + register = inString.substring(startPosition, endPosition); + if (startPosition < inString.length()) { + startPosition += size; + ret = true; + } else { + ret = false; + } + return ret; + } + + /** + * Metodo que devuelve un registro de 94 bytes + * @return + */ + public String next() { + return register; + } + + /** + * Metodo que se ejecuta al eliminar un registro + */ + public void remove() { + } + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/fin/.svn/entries b/base/dto/common/src/main/java/com/fp/common/fin/.svn/entries new file mode 100644 index 0000000..d931116 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/fin/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/common/fin +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +MessageGenerator.java +file + + + + +2022-07-28T03:40:35.064770Z +8fe47d9440415c602537118a1603375c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1504 + diff --git a/base/dto/common/src/main/java/com/fp/common/fin/.svn/text-base/MessageGenerator.java.svn-base b/base/dto/common/src/main/java/com/fp/common/fin/.svn/text-base/MessageGenerator.java.svn-base new file mode 100644 index 0000000..5060136 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/fin/.svn/text-base/MessageGenerator.java.svn-base @@ -0,0 +1,56 @@ +package com.fp.common.fin; + +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; + +/** + * Clase que se encarga de generar un numero de mensaje para procesar transacciones financieras. + * @author Jorge Vaca + * @version 2.1 + */ +public class MessageGenerator { + /*Almacena una instancia de MessageGenerator.*/ + public static MessageGenerator cache; + + /*Monitor para sincronizar la obtencion del numero de mensaje.*/ + private boolean monitor=false; + + /*Formato para obtener la fecha del servidor de aplicaciones.*/ + private SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMMdd-HH:mm:ss.SSSSSS"); + + /** + * Entrega una instancia de MessageGenerator. + * @return MessageGenerator + * @throws Exception + */ + public static MessageGenerator getInstance() throws Exception { + synchronized (MessageGenerator.class) { + if(cache == null){ + cache = new MessageGenerator(); + } + } + return cache; + } + + /** + * Entrega un numero de mensaje dado un prefijo. + * @param pPrefix Prefijo del numero de mensaje. + * @return String + * @throws Exception + */ + public synchronized String generateId(String pPrefix) throws Exception{ + while(monitor){ + wait(); + } + try{ + monitor=true; + Double d = Math.floor((Math.random() * 100000)); + DecimalFormat df = new DecimalFormat("00000"); + return pPrefix+"-"+sdf.format(System.currentTimeMillis()) +"-"+ df.format(d); + }finally{ + monitor=false; + notifyAll(); + } + } + +} diff --git a/base/dto/common/src/main/java/com/fp/common/fin/MessageGenerator.java b/base/dto/common/src/main/java/com/fp/common/fin/MessageGenerator.java new file mode 100644 index 0000000..5060136 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/fin/MessageGenerator.java @@ -0,0 +1,56 @@ +package com.fp.common.fin; + +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; + +/** + * Clase que se encarga de generar un numero de mensaje para procesar transacciones financieras. + * @author Jorge Vaca + * @version 2.1 + */ +public class MessageGenerator { + /*Almacena una instancia de MessageGenerator.*/ + public static MessageGenerator cache; + + /*Monitor para sincronizar la obtencion del numero de mensaje.*/ + private boolean monitor=false; + + /*Formato para obtener la fecha del servidor de aplicaciones.*/ + private SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMMdd-HH:mm:ss.SSSSSS"); + + /** + * Entrega una instancia de MessageGenerator. + * @return MessageGenerator + * @throws Exception + */ + public static MessageGenerator getInstance() throws Exception { + synchronized (MessageGenerator.class) { + if(cache == null){ + cache = new MessageGenerator(); + } + } + return cache; + } + + /** + * Entrega un numero de mensaje dado un prefijo. + * @param pPrefix Prefijo del numero de mensaje. + * @return String + * @throws Exception + */ + public synchronized String generateId(String pPrefix) throws Exception{ + while(monitor){ + wait(); + } + try{ + monitor=true; + Double d = Math.floor((Math.random() * 100000)); + DecimalFormat df = new DecimalFormat("00000"); + return pPrefix+"-"+sdf.format(System.currentTimeMillis()) +"-"+ df.format(d); + }finally{ + monitor=false; + notifyAll(); + } + } + +} diff --git a/base/dto/common/src/main/java/com/fp/common/formula/.svn/entries b/base/dto/common/src/main/java/com/fp/common/formula/.svn/entries new file mode 100644 index 0000000..4527e26 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/formula/.svn/entries @@ -0,0 +1,99 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/common/formula +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +functions +dir + +FormulaEvaluator.java +file + + + + +2022-07-28T03:40:34.969769Z +bbb24690fa21be234689d9b4f2dd301b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2417 + +AbstractFunction.java +file + + + + +2022-07-28T03:40:34.969769Z +93424cea0dda9f8e8359976dbc85e8c5 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2806 + diff --git a/base/dto/common/src/main/java/com/fp/common/formula/.svn/text-base/AbstractFunction.java.svn-base b/base/dto/common/src/main/java/com/fp/common/formula/.svn/text-base/AbstractFunction.java.svn-base new file mode 100644 index 0000000..6af0643 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/formula/.svn/text-base/AbstractFunction.java.svn-base @@ -0,0 +1,90 @@ +package com.fp.common.formula; + +import java.math.BigDecimal; +import java.sql.Date; +import java.util.Stack; + +import org.apache.log4j.Logger; +import org.nfunk.jep.ParseException; +import org.nfunk.jep.function.PostfixMathCommand; + +import com.fp.common.helper.BeanManager; + +public abstract class AbstractFunction extends PostfixMathCommand { + private static final Logger LOG = Logger.getLogger(AbstractFunction.class); + + public abstract Object eval() throws Exception; + + protected Stack stack; + + @SuppressWarnings("unchecked") + @Override + public void run(Stack pStack) throws ParseException { + this.stack = pStack; + this.checkStack(pStack); + try { + pStack.push(this.eval()); + } catch (Exception e) { + AbstractFunction.LOG.warn(e.getMessage(), e); + throw new ParseException(e.getMessage()); + } + } + + protected Object nextObjectParameter() { + // return this.stack.remove(0); + return this.stack.pop(); + } + + protected Object getConstant(String pName) { + return FormulaEvaluator.getRunning().getConstant(pName); + } + + protected String getStringConstant(String pName) throws Exception { + String val = (String) FormulaEvaluator.getRunning().getConstant(pName); + if (val == null) { + throw new ParseException("Constante no especificada " + pName); + } + return val; + } + + protected BigDecimal getBigDecimalConstant(String pName) throws Exception { + Object val = FormulaEvaluator.getRunning().getConstant(pName); + if (val == null) { + throw new ParseException("Constante no especificada " + pName); + } + if (val instanceof Number) { + return new BigDecimal(val.toString()); + } + throw new ParseException("Valor no Valido"); + } + + protected BigDecimal nextBigDecimalParameter() throws Exception { + Object param = this.nextObjectParameter(); + if (param instanceof Number) { + return new BigDecimal(param.toString()); + } + if (param instanceof String) { + String constant = (String) param; + Object val = this.getConstant(constant); + if ((val != null) && (val instanceof Number)) { + return new BigDecimal(val.toString()); + } + } + throw new ParseException("Tipo de Dato incorrecto"); + + } + + protected Date nextDateParameter() throws Exception { + Object param = this.nextObjectParameter(); + if (param instanceof Date) { + return (Date) param; + } + return BeanManager.convertObject(param, Date.class); + + } + + protected String nextStringParameter() { + Object param = this.nextObjectParameter(); + return param.toString(); + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/formula/.svn/text-base/FormulaEvaluator.java.svn-base b/base/dto/common/src/main/java/com/fp/common/formula/.svn/text-base/FormulaEvaluator.java.svn-base new file mode 100644 index 0000000..386866f --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/formula/.svn/text-base/FormulaEvaluator.java.svn-base @@ -0,0 +1,89 @@ +package com.fp.common.formula; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; + +import org.apache.log4j.Logger; +import org.nfunk.jep.JEP; +import org.nfunk.jep.ParseException; +import org.nfunk.jep.function.PostfixMathCommand; + +public class FormulaEvaluator { + private static final Logger LOG = Logger.getLogger(FormulaEvaluator.class); + + private static final ThreadLocal running = new ThreadLocal(); + + private JEP parser; + + private String expression; + + private Map constants = new HashMap(); + + public FormulaEvaluator() { + this(null); + } + + public static FormulaEvaluator getRunning() { + return FormulaEvaluator.running.get(); + } + + public FormulaEvaluator(String pExpression) { + this.parser = new JEP(); + this.parser.addStandardConstants(); + this.parser.addStandardFunctions(); + this.parser.setAllowUndeclared(false); + this.parser.setImplicitMul(false); + this.expression = pExpression; + + } + + public BigDecimal evalNumeric() throws Exception { + this.parse(); + FormulaEvaluator.running.set(this); + Double val = this.parser.getValue(); + if (val.isNaN()) { + throw new Exception(this.parser.getErrorInfo()); + } + FormulaEvaluator.LOG.debug(val); + return BigDecimal.valueOf(val); + } + + /** + * Entrega el Valor de expression + * + * @return Valor de expression + */ + public String getExpression() { + return this.expression; + } + + public void parse() throws ParseException { + this.parser.parseExpression(this.expression); + if (this.parser.hasError()) { + throw new ParseException(this.parser.getErrorInfo()); + } + } + + public void setConstant(String pName, Object pVal) { + this.constants.put(pName, pVal); + this.parser.addConstant(pName, pVal); + } + + public Object getConstant(String pName) { + return this.constants.get(pName); + } + + /** + * Fija el valor de la propiedad expression + * + * @param expression El valor para expression + */ + public void setExpression(String expression) { + this.expression = expression; + } + + public void setFunction(String pName, PostfixMathCommand pCommand) { + this.parser.addFunction(pName, pCommand); + } +} \ No newline at end of file diff --git a/base/dto/common/src/main/java/com/fp/common/formula/AbstractFunction.java b/base/dto/common/src/main/java/com/fp/common/formula/AbstractFunction.java new file mode 100644 index 0000000..6af0643 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/formula/AbstractFunction.java @@ -0,0 +1,90 @@ +package com.fp.common.formula; + +import java.math.BigDecimal; +import java.sql.Date; +import java.util.Stack; + +import org.apache.log4j.Logger; +import org.nfunk.jep.ParseException; +import org.nfunk.jep.function.PostfixMathCommand; + +import com.fp.common.helper.BeanManager; + +public abstract class AbstractFunction extends PostfixMathCommand { + private static final Logger LOG = Logger.getLogger(AbstractFunction.class); + + public abstract Object eval() throws Exception; + + protected Stack stack; + + @SuppressWarnings("unchecked") + @Override + public void run(Stack pStack) throws ParseException { + this.stack = pStack; + this.checkStack(pStack); + try { + pStack.push(this.eval()); + } catch (Exception e) { + AbstractFunction.LOG.warn(e.getMessage(), e); + throw new ParseException(e.getMessage()); + } + } + + protected Object nextObjectParameter() { + // return this.stack.remove(0); + return this.stack.pop(); + } + + protected Object getConstant(String pName) { + return FormulaEvaluator.getRunning().getConstant(pName); + } + + protected String getStringConstant(String pName) throws Exception { + String val = (String) FormulaEvaluator.getRunning().getConstant(pName); + if (val == null) { + throw new ParseException("Constante no especificada " + pName); + } + return val; + } + + protected BigDecimal getBigDecimalConstant(String pName) throws Exception { + Object val = FormulaEvaluator.getRunning().getConstant(pName); + if (val == null) { + throw new ParseException("Constante no especificada " + pName); + } + if (val instanceof Number) { + return new BigDecimal(val.toString()); + } + throw new ParseException("Valor no Valido"); + } + + protected BigDecimal nextBigDecimalParameter() throws Exception { + Object param = this.nextObjectParameter(); + if (param instanceof Number) { + return new BigDecimal(param.toString()); + } + if (param instanceof String) { + String constant = (String) param; + Object val = this.getConstant(constant); + if ((val != null) && (val instanceof Number)) { + return new BigDecimal(val.toString()); + } + } + throw new ParseException("Tipo de Dato incorrecto"); + + } + + protected Date nextDateParameter() throws Exception { + Object param = this.nextObjectParameter(); + if (param instanceof Date) { + return (Date) param; + } + return BeanManager.convertObject(param, Date.class); + + } + + protected String nextStringParameter() { + Object param = this.nextObjectParameter(); + return param.toString(); + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/formula/FormulaEvaluator.java b/base/dto/common/src/main/java/com/fp/common/formula/FormulaEvaluator.java new file mode 100644 index 0000000..386866f --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/formula/FormulaEvaluator.java @@ -0,0 +1,89 @@ +package com.fp.common.formula; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; + +import org.apache.log4j.Logger; +import org.nfunk.jep.JEP; +import org.nfunk.jep.ParseException; +import org.nfunk.jep.function.PostfixMathCommand; + +public class FormulaEvaluator { + private static final Logger LOG = Logger.getLogger(FormulaEvaluator.class); + + private static final ThreadLocal running = new ThreadLocal(); + + private JEP parser; + + private String expression; + + private Map constants = new HashMap(); + + public FormulaEvaluator() { + this(null); + } + + public static FormulaEvaluator getRunning() { + return FormulaEvaluator.running.get(); + } + + public FormulaEvaluator(String pExpression) { + this.parser = new JEP(); + this.parser.addStandardConstants(); + this.parser.addStandardFunctions(); + this.parser.setAllowUndeclared(false); + this.parser.setImplicitMul(false); + this.expression = pExpression; + + } + + public BigDecimal evalNumeric() throws Exception { + this.parse(); + FormulaEvaluator.running.set(this); + Double val = this.parser.getValue(); + if (val.isNaN()) { + throw new Exception(this.parser.getErrorInfo()); + } + FormulaEvaluator.LOG.debug(val); + return BigDecimal.valueOf(val); + } + + /** + * Entrega el Valor de expression + * + * @return Valor de expression + */ + public String getExpression() { + return this.expression; + } + + public void parse() throws ParseException { + this.parser.parseExpression(this.expression); + if (this.parser.hasError()) { + throw new ParseException(this.parser.getErrorInfo()); + } + } + + public void setConstant(String pName, Object pVal) { + this.constants.put(pName, pVal); + this.parser.addConstant(pName, pVal); + } + + public Object getConstant(String pName) { + return this.constants.get(pName); + } + + /** + * Fija el valor de la propiedad expression + * + * @param expression El valor para expression + */ + public void setExpression(String expression) { + this.expression = expression; + } + + public void setFunction(String pName, PostfixMathCommand pCommand) { + this.parser.addFunction(pName, pCommand); + } +} \ No newline at end of file diff --git a/base/dto/common/src/main/java/com/fp/common/formula/functions/.svn/entries b/base/dto/common/src/main/java/com/fp/common/formula/functions/.svn/entries new file mode 100644 index 0000000..7eb0b82 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/formula/functions/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/common/formula/functions +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +Percent.java +file + + + + +2022-07-28T03:40:34.943769Z +01d2f0435dbc26d41ec2b4f380de9cec +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +614 + +Sum.java +file + + + + +2022-07-28T03:40:34.944769Z +a648ce1d88a635b70c18a575da510559 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +830 + diff --git a/base/dto/common/src/main/java/com/fp/common/formula/functions/.svn/text-base/Percent.java.svn-base b/base/dto/common/src/main/java/com/fp/common/formula/functions/.svn/text-base/Percent.java.svn-base new file mode 100644 index 0000000..8fa6832 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/formula/functions/.svn/text-base/Percent.java.svn-base @@ -0,0 +1,27 @@ +package com.fp.common.formula.functions; + +import java.math.BigDecimal; +import java.math.RoundingMode; + +import com.fp.common.formula.AbstractFunction; +import com.fp.common.helper.Constant; + +/** + * @author + */ +public class Percent extends AbstractFunction { + + @Override + public int getNumberOfParameters() { + return 2; + } + + @Override + public Object eval() throws Exception { + BigDecimal total = this.nextBigDecimalParameter(); + BigDecimal value = this.nextBigDecimalParameter(); + + return value.multiply(Constant.BD_ONE_HUNDRED).divide(total, RoundingMode.HALF_UP); + } + +} \ No newline at end of file diff --git a/base/dto/common/src/main/java/com/fp/common/formula/functions/.svn/text-base/Sum.java.svn-base b/base/dto/common/src/main/java/com/fp/common/formula/functions/.svn/text-base/Sum.java.svn-base new file mode 100644 index 0000000..cdc97d3 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/formula/functions/.svn/text-base/Sum.java.svn-base @@ -0,0 +1,31 @@ +package com.fp.common.formula.functions; + +import java.math.BigDecimal; + +import com.fp.common.formula.AbstractFunction; + +/** + * @author + */ +public class Sum extends AbstractFunction { + + @Override + public int getNumberOfParameters() { + return 5; + } + + @Override + public Object eval() throws Exception { + BigDecimal total = BigDecimal.ZERO; +// total = total.add(this.nextBigDecimalParameter()); +// total = total.add(this.nextBigDecimalParameter()); +// total = total.add(this.nextBigDecimalParameter()); +// total = total.add(this.nextBigDecimalParameter()); +// total = total.add(this.nextBigDecimalParameter()); + for(int i=0; i + * El numerador representa los dias mes ejeplo si la base es 360/xxx indica que los meses son de 3o dias, + * si la base es 365/*** indica que los meses son calendario.
+ * El denominador indica el numero de dias que se paga intereses en el anio. + * Ejemplo 360/360, 360/365, 365/360, 365/365.
+ * @author Jorge Vaca + * @version 2.1 + */ +public enum CalculationBase { + B360360(360,360, 30,"360/360"), B360365(360,365, 30,"360/365"), B365360(365,360, 1,"365/360"),B365365(365,365, 1,"365/365"); + /**Numero de dias anio de la base de calculo denomindor. */ + private int yearBase; + /** Numerador de la base de calculo. */ + private int monthBase; + /** Numero de dias por mes de la base de calculo, si es 1 indica que son meses calendario. */ + private int days; + /** Codigo de base de calculo. */ + private String baseCode=""; + + /** + * Crea una enumeracion de la base de calculo. + * @param pMonth Numerador de la base de calculo. + * @param pYearbase Denominador de la base de calculo. + * @param pDays Dias de la base de calculo, si es 1 son dias calendario. + * @param pBase Codigo de la base de calculo. + */ + private CalculationBase(int pMonth,int pYearbase, int pDays,String pBaseCode) { + this.yearBase = pYearbase; + this.monthBase=pMonth; + this.days = pDays; + this.baseCode=pBaseCode; + } + + public int getYearBase() { + return yearBase; + } + + /** + * Entrega el numero de dias de un mes y anio dado los dias mes del numerador de la base de calculo. + * @param pMonth Mes a obtener el numero de dias. + * @param pYear Anio a obtener el numero de dias. + * @return + * @throws Exception + */ + public int getMonthDays(int pMonth, int pYear) throws Exception { + if (this.days == 1) { + GregorianCalendar cal = new GregorianCalendar(); + cal.setTime(new Date()); + cal.set(Calendar.YEAR, pYear); + cal.set(Calendar.MONTH, pMonth); + cal.set(Calendar.DATE, 1); + return cal.getMaximum(Calendar.DATE); + } else { + return this.days; + } + } + + /** + * Entrega el numero de dias de una anio. + * @param pYear + * @return + * @throws Exception + */ + public int getYearDays(int pYear) throws Exception { + if (this.days == -1) { + GregorianCalendar cal = new GregorianCalendar(); + cal.setTime(new Date()); + cal.set(Calendar.YEAR, pYear); + cal.set(Calendar.MONTH, Calendar.JANUARY); + cal.set(Calendar.DATE, 1); + return cal.getMaximum(Calendar.DAY_OF_YEAR); + } else { + return this.days; + } + } + + /** + * Entrega el codigo de la base de calculo. + * @return String + * @throws Exception + */ + public String getBaseCode() throws Exception{ + return this.baseCode; + } + + /** + * Entrega los dias mes de la base de calculo. + * @return int + * @throws Exception + */ + public int getMonthBase() throws Exception{ + return this.monthBase; + } + + /** + * Entrega el numero de dias de la base de calculo. Si la base mes es 365 entrega 1. + * @return this.days + * @throws Exception + */ + public int getDay() throws Exception{ + return days; + } + + /** + * Entrega CalculationBase dada la base de calculo. + * @param pBase Base de calculo 360/360, 360/365, 365/360, 365/365. + * @return CalculationBase + * @throws Exception + */ + public static CalculationBase getCalculationBase(String pBaseCode) throws Exception{ + CalculationBase [] ct = null; + ct = CalculationBase.values(); + CalculationBase ctype = null; + for(CalculationBase obj : ct){ + if(obj.baseCode.compareTo(pBaseCode) == 0){ + ctype = obj; + } + } + return ctype; + } + +} diff --git a/base/dto/common/src/main/java/com/fp/common/helper/.svn/text-base/Constant.java.svn-base b/base/dto/common/src/main/java/com/fp/common/helper/.svn/text-base/Constant.java.svn-base new file mode 100644 index 0000000..e9c987a --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/helper/.svn/text-base/Constant.java.svn-base @@ -0,0 +1,448 @@ +package com.fp.common.helper; + +import java.lang.reflect.Method; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import javax.persistence.EntityManager; + +/** + * Clase en la cual se definen contantes de la aplicacion. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class Constant { + + /** + * Codigo de respuesta ok al ejecutar una transaccion. + */ + public static final String RS_SUCCESS = "0"; + /** + * Constante que define un valor BigDecimal Cero. + */ + public static final BigDecimal BD_ZERO = BigDecimal.ZERO; + /** + * Constante que define un valor BigDecimal uno (1). + */ + public static final BigDecimal BD_ONE = BigDecimal.ONE; + /** + * Constante que define un valor BigDecimal uno negativo (1). + */ + public static final BigDecimal BD_ONE_NEGATIVE = new BigDecimal("-1"); + /** + * Constante que define un valor BigDecimal cien (100). + */ + public static final BigDecimal BD_ONE_HUNDRED = new BigDecimal("100"); + /** + * Constante que define un valor BigDecimal de un centavo (0.01). + */ + public static final BigDecimal BD_ONE_HUNDREDTH = new BigDecimal("0.01"); + /** + * Constante que define un valor 1 en string. + */ + public static final String STR_ONE = "1"; + /** + * Constante que define un valor Y en string. + */ + public static final String STR_Y = "Y"; + /** + * Constante que define un valor N en string. + */ + public static final String STR_N = "N"; + /** + * Codigo de respuesta ok al ejecutar una transaccion. + */ + public static final String NO_DATA_FOUND = "COMMONDB-0006"; + /** + * UNCHECKED WARNING + */ + public static final String WARN_UNCHECKED = "unchecked"; + public static final String INFORMIX_DIALECT = "org.hibernate.dialect.InformixDialect"; + public static final String ORACLE_DIALECT = "org.hibernate.dialect.Oracle10gDialect"; + + /** + * Metodo que valida si el valor de un cadena es "Y". si el valor es null o + * diferente retorna false. + * + * @param pValue Valor a comprobar si es Y, en ese caso retorna true, + * @return boolean + * @throws Exception + */ + public static boolean ifYes(String pValue) throws Exception { + boolean result = false; + if (pValue == null) { + return false; + } + if (pValue.compareTo("Y") == 0) { + return true; + } + return result; + } + + /** + * Metodo que se encarga de cambiar a mayuscula la primera letra de una + * palabra. + * + * @param pString String a cambiar a mayusculas las primeras letras de cada + * palabra del parrafo. + * @return String + * @throws Exception + */ + public static String capitalize(String pString) throws Exception { + String[] words = pString.split("\\s"); + String resp = ""; + for (String s : words) { + resp = resp + Constant.capitalizeword(s) + " "; + } + return resp; + } + + /** + * Metodo que se encarga de cambiar a mayuscula la primera letra de una + * palabra. + * + * @param s Palabra a cambiar a mayuscula la primera letra. + * @return String + * @throws Exception + */ + private static String capitalizeword(String s) throws Exception { + if (s.length() == 0) { + return s; + } + return s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase(); + } + /** + * Constante que define un unchecked. + */ + public static final String VUNCHECKED = "unchecked"; + /** + * Constante que define la cuenta. + */ + public static final String VACCOUNT = "account"; + /** + * Constante que define la compania asociada a la cuenta. + */ + public static final String VCOMPANY = "company"; + /** + * Constante que define la fecha de vigencia de un registro. + */ + public static final String VDATETO = "dateto"; + /** + * Anio mes de particion de una tabla. + */ + public static final String VPARTITION = "partition"; + /** + * Codigo de modulo. + */ + public static final String VMODULECODE = "modulecode"; + /** + * Codigo de producto. + */ + public static final String VPRODUCTCODE = "productcode"; + /** + * Codigo de subproducto. + */ + public static final String VSUBPRODUCTCODE = "subproductcode"; + /** + * Codigo de moneda. + */ + public static final String VCURRENCYCODE = "currencycode"; + /** + * Fecha de trabajo. + */ + public static final String VWORKINGDATE = "workingdate"; + /** + * Separador del key de maps cuando este se compone de varios atributos. + */ + public static String SEPARATOR = "^"; + /** + * Codigo de modulo asociado a una transaccion. + */ + public static final String VTRANSACTIONMODULE = "transactionmodule"; + /** + * Codigo de transaccion. + */ + public static final String VTRANSACTIONCODE = "transactioncode"; + /** + * Codigo de version de una transaccion. + */ + public static final String VTRANSACTIONVERSION = "transactionversion"; + /** + * Almacena el el timestamp por defecto de expiracion + */ + private static Timestamp vDefaulttimestamp; + + /** + * Devuelve la fecha hasta default de 2999-12-31 + * + * @return Fecha hasta 2999-12-31 + * @throws Exception + */ + public static Timestamp getDefaultExpiryTimestamp() throws Exception { + if (Constant.vDefaulttimestamp == null) { + SimpleDateFormat fd = new SimpleDateFormat("yyyy-MM-dd"); + ; + java.util.Date a = fd.parse("2999-12-31"); + Constant.vDefaulttimestamp = new Timestamp(a.getTime()); + } + return Constant.vDefaulttimestamp; + } + /** + * Almacena la fecha por defecto de expiracion + */ + private static Date vDefaultdate; + + /** + * Devuelve la fecha hasta default de 2999-12-31 + * + * @return Fecha hasta 2999-12-31 + * @throws Exception + */ + public static java.sql.Date getDefaultExpiryDate() throws Exception { + if (Constant.vDefaultdate == null) { + SimpleDateFormat fd = new SimpleDateFormat("yyyy-MM-dd"); + ; + java.util.Date a = fd.parse("2999-12-31"); + Constant.vDefaultdate = new java.sql.Date(a.getTime()); + } + return Constant.vDefaultdate; + } + /** + * Almacena el formato yyyyMM + */ + private static SimpleDateFormat vPartition; + + /** + * Formatea una fecha para ser empleada como campo de particionamiento en + * una Tabla + * + * @param pDate Fecha de Referencia. + * @return String Fecha con el formato yyyyMM + * @throws Exception + */ + public static String getPartition(Date pDate) throws Exception { + if (Constant.vPartition == null) { + Constant.vPartition = new SimpleDateFormat("yyyyMM"); + } + String aux = ""; + try { + aux = Constant.vPartition.format(pDate); + } catch (Exception e) { + aux = Constant.vPartition.format(pDate); + } + return aux; + } + + /** + * Formatea una fecha para ser empleada como campo de particionamiento en + * una Tabla + * + * @param pDate Fecha de Referencia. + * @return String Fecha con el formato yyyyMM + * @throws Exception + */ + public static String getPartition(Timestamp pDate) throws Exception { + if (Constant.vPartition == null) { + Constant.vPartition = new SimpleDateFormat("yyyyMM"); + } + String aux = ""; + try { + aux = Constant.vPartition.format(pDate); + } catch (Exception e) { + aux = Constant.vPartition.format(pDate); + } + return aux; + } + + /** + * Entrega el la particion default de caducidad de registros. + * + * @return Particion con el formato yyyyMM + * @throws Exception + */ + public static String getDefaultPartition() throws Exception { + return "299912"; + } + + /** + * Entrega el dialecto de la base de datos. + * + * @param pEntityManager Referencia a una session de base de datos. + * @return String + * @throws Exception + */ + public static String getDialect(EntityManager pEntityManager) throws Exception { + Object dialect = null; + dialect = pEntityManager.getEntityManagerFactory().getProperties().get("hibernate.dialect"); + return dialect.toString(); + } + + /** + * Retorna true si el dialecto de base es Oracle. + * + * @param pEntityManager Referencia a una session de base de datos. + * @return boolean + * @throws Exception + */ + public static boolean isOracleDialect(EntityManager pEntityManager) throws Exception { + String dialect = null; + dialect = (String) pEntityManager.getEntityManagerFactory().getProperties().get("hibernate.dialect"); + if (DialectDB.ORACLE.getCode().compareTo(dialect) == 0) { + return true; + } + return false; + } + + /** + * Retorna true si el dialecto de base es Oracle. + * + * @param pEntityManager Referencia a una session de base de datos. + * @return boolean + * @throws Exception + */ + public static boolean isSybaseDialect(EntityManager pEntityManager) throws Exception { + String dialect = null; + dialect = (String) pEntityManager.getEntityManagerFactory().getProperties().get("hibernate.dialect"); + if (DialectDB.SYBASE.getCode().compareTo(dialect) == 0) { + return true; + } + return false; + } + + /** + * Para poder realizar la comparacin los objetos deben tener sobreescrito + * el metodo equals + * + * @param obj E del mismo tipo de la lista + * @param l Lista de objetos de tipo E + * @return + * @throws InvocationTargetException + * @throws IllegalAccessException + * @throws + */ + public static int isInList(E obj, List l, String... equalmethods) throws Exception { + Method m = null; + if ((equalmethods != null) && (equalmethods.length > 0) && (equalmethods[0] != null)) { + m = obj.getClass().getMethod(equalmethods[0], Object.class); + } + int i = 0; + if ((l == null) || l.isEmpty()) { + return -1; + } + for (E item : l) { + Boolean result = (Boolean) (m != null ? m.invoke(obj, item) : obj.equals(item)); + if (result) { + return i; + } + i++; + } + return -1; + } + + /** + * Para poder realizar la comparacin los objetos deben tener sobreescrito + * el metodo equals + * + * @param l Lista de beans + * @param obj Bean del mismo tipo de la lista + * @return E | null + */ + public static E isInList(List l, E obj) { + if ((l == null) || l.isEmpty()) { + return null; + } + for (E item : l) { + if (obj.equals(item)) { + return item; + } + } + return null; + } + + public static boolean existRepeated(List lMod) { + if ((lMod == null) || lMod.isEmpty()) { + return false; + } + HashSet hs = new HashSet(); + for (T item : lMod) { + hs.add(item); + } + return lMod.size() == hs.size() ? false : true; + } + + public static List getFinalList(List lDB, List lMod, List lDel, String... equalmethods) throws Exception { + List lFinal = new ArrayList(); + // Quitar eliminados + if (!lDB.isEmpty()) { + for (T rdb : lDB) { + if (Constant.isInList(rdb, lDel, equalmethods) < 0) { + lFinal.add(rdb); + } + } + } + + List lFinalCopy = new ArrayList(lFinal); + // actualizar modificados y agregar nuevos + if ((lMod != null) && !lMod.isEmpty()) { + for (T rmod : lMod) { + int index = Constant.isInList(rmod, lFinalCopy, equalmethods); + if (index >= 0) { + lFinal.set(index, rmod); + } else { + lFinal.add(rmod); + } + } + } + return lFinal; + } + + /** + * Funcin que transforma una lista de objetos a una lista especfica + * + * @param lobj Lista de objetos + * @param cl Clase a la que se va a convertir cada miembro de la lista + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List convertList(List lobj, Class cl) throws Exception { + List l = new ArrayList(); + if (lobj != null) { + for (Object obj : lobj) { + if (cl.isInstance(obj)) { + l.add((T) obj); + } + } + } + return l; + } + + /** + * Método que se encarga de formatear mensajes con parametros + * + * @param message + * @param parameters + * @return + */ + public static String formatMessage(String message, Object... parameters) { + if (parameters != null) { + Object[] parametersAux = parameters; + for (int i = 0; i < parametersAux.length; i++) { + Object objeto = parametersAux[i]; + if (objeto instanceof Integer || objeto instanceof Long) { + message = message.replaceAll("\\{" + i + "\\}", "{" + i + ",number,#}"); + } else if (objeto instanceof BigDecimal) { + message = message.replaceAll("\\{" + i + "\\}", "{" + i + ",number,#,###.##}"); + } + } + message = MessageFormat.format(message, parameters); + } + return message; + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/helper/.svn/text-base/DialectDB.java.svn-base b/base/dto/common/src/main/java/com/fp/common/helper/.svn/text-base/DialectDB.java.svn-base new file mode 100644 index 0000000..265ed9e --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/helper/.svn/text-base/DialectDB.java.svn-base @@ -0,0 +1,36 @@ +package com.fp.common.helper; + +/** + * Enumeracion que maneja los distintos dialectos de base de datos. + * @author Jorge Vaca + * @version 2.1 + */ +public enum DialectDB { + + ORACLE("org.hibernate.dialect.Oracle10gDialect"), + SYBASE("org.hibernate.dialect.SybaseDialect") + ; + + /**Codigo de dialecto de la base de datos.*/ + private String code; + + /** + * Crea una instancia de la enumeracion. + * @param pCode Codigo de dialecto. + */ + DialectDB(String pCode){ + code = pCode; + } + + + + /** + * Entrega el valor del dialecto de la enumeracion. + * @return String + * @throws Exception + */ + public String getCode() throws Exception { + return code; + } + +} diff --git a/base/dto/common/src/main/java/com/fp/common/helper/.svn/text-base/FkException.java.svn-base b/base/dto/common/src/main/java/com/fp/common/helper/.svn/text-base/FkException.java.svn-base new file mode 100644 index 0000000..b2c606f --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/helper/.svn/text-base/FkException.java.svn-base @@ -0,0 +1,18 @@ +package com.fp.common.helper; + + +/** + * Interface a implementar por la clase que entrega tabla padre y tabla dependiente cuando hay un + * fk violado. + * @author Jorge Vaca + * @version 2.1 + */ +public interface FkException { + + /** + * Entrega la tabla padre y dependiente dado un foreing key. + * @param fk constraint con el cual se obtien la tabla padre y la tabla dependiente. + * @return String[] + */ + public String[] getFkData(String fk); +} diff --git a/base/dto/common/src/main/java/com/fp/common/helper/CalculationBase.java b/base/dto/common/src/main/java/com/fp/common/helper/CalculationBase.java new file mode 100644 index 0000000..896d287 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/helper/CalculationBase.java @@ -0,0 +1,129 @@ +package com.fp.common.helper; + +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; + +/** + * Enumeracion que maneja las distintas bases de calculo que maneja la aplicacion.
+ * El numerador representa los dias mes ejeplo si la base es 360/xxx indica que los meses son de 3o dias, + * si la base es 365/*** indica que los meses son calendario.
+ * El denominador indica el numero de dias que se paga intereses en el anio. + * Ejemplo 360/360, 360/365, 365/360, 365/365.
+ * @author Jorge Vaca + * @version 2.1 + */ +public enum CalculationBase { + B360360(360,360, 30,"360/360"), B360365(360,365, 30,"360/365"), B365360(365,360, 1,"365/360"),B365365(365,365, 1,"365/365"); + /**Numero de dias anio de la base de calculo denomindor. */ + private int yearBase; + /** Numerador de la base de calculo. */ + private int monthBase; + /** Numero de dias por mes de la base de calculo, si es 1 indica que son meses calendario. */ + private int days; + /** Codigo de base de calculo. */ + private String baseCode=""; + + /** + * Crea una enumeracion de la base de calculo. + * @param pMonth Numerador de la base de calculo. + * @param pYearbase Denominador de la base de calculo. + * @param pDays Dias de la base de calculo, si es 1 son dias calendario. + * @param pBase Codigo de la base de calculo. + */ + private CalculationBase(int pMonth,int pYearbase, int pDays,String pBaseCode) { + this.yearBase = pYearbase; + this.monthBase=pMonth; + this.days = pDays; + this.baseCode=pBaseCode; + } + + public int getYearBase() { + return yearBase; + } + + /** + * Entrega el numero de dias de un mes y anio dado los dias mes del numerador de la base de calculo. + * @param pMonth Mes a obtener el numero de dias. + * @param pYear Anio a obtener el numero de dias. + * @return + * @throws Exception + */ + public int getMonthDays(int pMonth, int pYear) throws Exception { + if (this.days == 1) { + GregorianCalendar cal = new GregorianCalendar(); + cal.setTime(new Date()); + cal.set(Calendar.YEAR, pYear); + cal.set(Calendar.MONTH, pMonth); + cal.set(Calendar.DATE, 1); + return cal.getMaximum(Calendar.DATE); + } else { + return this.days; + } + } + + /** + * Entrega el numero de dias de una anio. + * @param pYear + * @return + * @throws Exception + */ + public int getYearDays(int pYear) throws Exception { + if (this.days == -1) { + GregorianCalendar cal = new GregorianCalendar(); + cal.setTime(new Date()); + cal.set(Calendar.YEAR, pYear); + cal.set(Calendar.MONTH, Calendar.JANUARY); + cal.set(Calendar.DATE, 1); + return cal.getMaximum(Calendar.DAY_OF_YEAR); + } else { + return this.days; + } + } + + /** + * Entrega el codigo de la base de calculo. + * @return String + * @throws Exception + */ + public String getBaseCode() throws Exception{ + return this.baseCode; + } + + /** + * Entrega los dias mes de la base de calculo. + * @return int + * @throws Exception + */ + public int getMonthBase() throws Exception{ + return this.monthBase; + } + + /** + * Entrega el numero de dias de la base de calculo. Si la base mes es 365 entrega 1. + * @return this.days + * @throws Exception + */ + public int getDay() throws Exception{ + return days; + } + + /** + * Entrega CalculationBase dada la base de calculo. + * @param pBase Base de calculo 360/360, 360/365, 365/360, 365/365. + * @return CalculationBase + * @throws Exception + */ + public static CalculationBase getCalculationBase(String pBaseCode) throws Exception{ + CalculationBase [] ct = null; + ct = CalculationBase.values(); + CalculationBase ctype = null; + for(CalculationBase obj : ct){ + if(obj.baseCode.compareTo(pBaseCode) == 0){ + ctype = obj; + } + } + return ctype; + } + +} diff --git a/base/dto/common/src/main/java/com/fp/common/helper/Constant.java b/base/dto/common/src/main/java/com/fp/common/helper/Constant.java new file mode 100644 index 0000000..f07aed6 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/helper/Constant.java @@ -0,0 +1,449 @@ +package com.fp.common.helper; + +import java.lang.reflect.Method; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import javax.persistence.EntityManager; + +/** + * Clase en la cual se definen contantes de la aplicacion. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class Constant { + + /** + * Codigo de respuesta ok al ejecutar una transaccion. + */ + public static final String RS_SUCCESS = "0"; + /** + * Constante que define un valor BigDecimal Cero. + */ + public static final BigDecimal BD_ZERO = BigDecimal.ZERO; + /** + * Constante que define un valor BigDecimal uno (1). + */ + public static final BigDecimal BD_ONE = BigDecimal.ONE; + /** + * Constante que define un valor BigDecimal uno negativo (1). + */ + public static final BigDecimal BD_ONE_NEGATIVE = new BigDecimal("-1"); + /** + * Constante que define un valor BigDecimal cien (100). + */ + public static final BigDecimal BD_ONE_HUNDRED = new BigDecimal("100"); + /** + * Constante que define un valor BigDecimal de un centavo (0.01). + */ + public static final BigDecimal BD_ONE_HUNDREDTH = new BigDecimal("0.01"); + /** + * Constante que define un valor 1 en string. + */ + public static final String STR_ONE = "1"; + /** + * Constante que define un valor Y en string. + */ + public static final String STR_Y = "Y"; + /** + * Constante que define un valor N en string. + */ + public static final String STR_N = "N"; + /** + * Codigo de respuesta ok al ejecutar una transaccion. + */ + public static final String NO_DATA_FOUND = "COMMONDB-0006"; + /** + * UNCHECKED WARNING + */ + public static final String WARN_UNCHECKED = "unchecked"; + public static final String INFORMIX_DIALECT = "org.hibernate.dialect.InformixDialect"; + public static final String ORACLE_DIALECT = "org.hibernate.dialect.Oracle10gDialect"; + public static final String POSTGRES_DIALECT = "org.hibernate.dialect.PostgreSQLDialect"; + + /** + * Metodo que valida si el valor de un cadena es "Y". si el valor es null o + * diferente retorna false. + * + * @param pValue Valor a comprobar si es Y, en ese caso retorna true, + * @return boolean + * @throws Exception + */ + public static boolean ifYes(String pValue) throws Exception { + boolean result = false; + if (pValue == null) { + return false; + } + if (pValue.compareTo("Y") == 0) { + return true; + } + return result; + } + + /** + * Metodo que se encarga de cambiar a mayuscula la primera letra de una + * palabra. + * + * @param pString String a cambiar a mayusculas las primeras letras de cada + * palabra del parrafo. + * @return String + * @throws Exception + */ + public static String capitalize(String pString) throws Exception { + String[] words = pString.split("\\s"); + String resp = ""; + for (String s : words) { + resp = resp + Constant.capitalizeword(s) + " "; + } + return resp; + } + + /** + * Metodo que se encarga de cambiar a mayuscula la primera letra de una + * palabra. + * + * @param s Palabra a cambiar a mayuscula la primera letra. + * @return String + * @throws Exception + */ + private static String capitalizeword(String s) throws Exception { + if (s.length() == 0) { + return s; + } + return s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase(); + } + /** + * Constante que define un unchecked. + */ + public static final String VUNCHECKED = "unchecked"; + /** + * Constante que define la cuenta. + */ + public static final String VACCOUNT = "account"; + /** + * Constante que define la compania asociada a la cuenta. + */ + public static final String VCOMPANY = "company"; + /** + * Constante que define la fecha de vigencia de un registro. + */ + public static final String VDATETO = "dateto"; + /** + * Anio mes de particion de una tabla. + */ + public static final String VPARTITION = "partition"; + /** + * Codigo de modulo. + */ + public static final String VMODULECODE = "modulecode"; + /** + * Codigo de producto. + */ + public static final String VPRODUCTCODE = "productcode"; + /** + * Codigo de subproducto. + */ + public static final String VSUBPRODUCTCODE = "subproductcode"; + /** + * Codigo de moneda. + */ + public static final String VCURRENCYCODE = "currencycode"; + /** + * Fecha de trabajo. + */ + public static final String VWORKINGDATE = "workingdate"; + /** + * Separador del key de maps cuando este se compone de varios atributos. + */ + public static String SEPARATOR = "^"; + /** + * Codigo de modulo asociado a una transaccion. + */ + public static final String VTRANSACTIONMODULE = "transactionmodule"; + /** + * Codigo de transaccion. + */ + public static final String VTRANSACTIONCODE = "transactioncode"; + /** + * Codigo de version de una transaccion. + */ + public static final String VTRANSACTIONVERSION = "transactionversion"; + /** + * Almacena el el timestamp por defecto de expiracion + */ + private static Timestamp vDefaulttimestamp; + + /** + * Devuelve la fecha hasta default de 2999-12-31 + * + * @return Fecha hasta 2999-12-31 + * @throws Exception + */ + public static Timestamp getDefaultExpiryTimestamp() throws Exception { + if (Constant.vDefaulttimestamp == null) { + SimpleDateFormat fd = new SimpleDateFormat("yyyy-MM-dd"); + ; + java.util.Date a = fd.parse("2999-12-31"); + Constant.vDefaulttimestamp = new Timestamp(a.getTime()); + } + return Constant.vDefaulttimestamp; + } + /** + * Almacena la fecha por defecto de expiracion + */ + private static Date vDefaultdate; + + /** + * Devuelve la fecha hasta default de 2999-12-31 + * + * @return Fecha hasta 2999-12-31 + * @throws Exception + */ + public static java.sql.Date getDefaultExpiryDate() throws Exception { + if (Constant.vDefaultdate == null) { + SimpleDateFormat fd = new SimpleDateFormat("yyyy-MM-dd"); + ; + java.util.Date a = fd.parse("2999-12-31"); + Constant.vDefaultdate = new java.sql.Date(a.getTime()); + } + return Constant.vDefaultdate; + } + /** + * Almacena el formato yyyyMM + */ + private static SimpleDateFormat vPartition; + + /** + * Formatea una fecha para ser empleada como campo de particionamiento en + * una Tabla + * + * @param pDate Fecha de Referencia. + * @return String Fecha con el formato yyyyMM + * @throws Exception + */ + public static String getPartition(Date pDate) throws Exception { + if (Constant.vPartition == null) { + Constant.vPartition = new SimpleDateFormat("yyyyMM"); + } + String aux = ""; + try { + aux = Constant.vPartition.format(pDate); + } catch (Exception e) { + aux = Constant.vPartition.format(pDate); + } + return aux; + } + + /** + * Formatea una fecha para ser empleada como campo de particionamiento en + * una Tabla + * + * @param pDate Fecha de Referencia. + * @return String Fecha con el formato yyyyMM + * @throws Exception + */ + public static String getPartition(Timestamp pDate) throws Exception { + if (Constant.vPartition == null) { + Constant.vPartition = new SimpleDateFormat("yyyyMM"); + } + String aux = ""; + try { + aux = Constant.vPartition.format(pDate); + } catch (Exception e) { + aux = Constant.vPartition.format(pDate); + } + return aux; + } + + /** + * Entrega el la particion default de caducidad de registros. + * + * @return Particion con el formato yyyyMM + * @throws Exception + */ + public static String getDefaultPartition() throws Exception { + return "299912"; + } + + /** + * Entrega el dialecto de la base de datos. + * + * @param pEntityManager Referencia a una session de base de datos. + * @return String + * @throws Exception + */ + public static String getDialect(EntityManager pEntityManager) throws Exception { + Object dialect = null; + dialect = pEntityManager.getEntityManagerFactory().getProperties().get("hibernate.dialect"); + return dialect.toString(); + } + + /** + * Retorna true si el dialecto de base es Oracle. + * + * @param pEntityManager Referencia a una session de base de datos. + * @return boolean + * @throws Exception + */ + public static boolean isOracleDialect(EntityManager pEntityManager) throws Exception { + String dialect = null; + dialect = (String) pEntityManager.getEntityManagerFactory().getProperties().get("hibernate.dialect"); + if (DialectDB.POSTGRES.getCode().compareTo(dialect) == 0) { + return true; + } + return false; + } + + /** + * Retorna true si el dialecto de base es Oracle. + * + * @param pEntityManager Referencia a una session de base de datos. + * @return boolean + * @throws Exception + */ + public static boolean isSybaseDialect(EntityManager pEntityManager) throws Exception { + String dialect = null; + dialect = (String) pEntityManager.getEntityManagerFactory().getProperties().get("hibernate.dialect"); + if (DialectDB.SYBASE.getCode().compareTo(dialect) == 0) { + return true; + } + return false; + } + + /** + * Para poder realizar la comparacin los objetos deben tener sobreescrito + * el metodo equals + * + * @param obj E del mismo tipo de la lista + * @param l Lista de objetos de tipo E + * @return + * @throws InvocationTargetException + * @throws IllegalAccessException + * @throws + */ + public static int isInList(E obj, List l, String... equalmethods) throws Exception { + Method m = null; + if ((equalmethods != null) && (equalmethods.length > 0) && (equalmethods[0] != null)) { + m = obj.getClass().getMethod(equalmethods[0], Object.class); + } + int i = 0; + if ((l == null) || l.isEmpty()) { + return -1; + } + for (E item : l) { + Boolean result = (Boolean) (m != null ? m.invoke(obj, item) : obj.equals(item)); + if (result) { + return i; + } + i++; + } + return -1; + } + + /** + * Para poder realizar la comparacin los objetos deben tener sobreescrito + * el metodo equals + * + * @param l Lista de beans + * @param obj Bean del mismo tipo de la lista + * @return E | null + */ + public static E isInList(List l, E obj) { + if ((l == null) || l.isEmpty()) { + return null; + } + for (E item : l) { + if (obj.equals(item)) { + return item; + } + } + return null; + } + + public static boolean existRepeated(List lMod) { + if ((lMod == null) || lMod.isEmpty()) { + return false; + } + HashSet hs = new HashSet(); + for (T item : lMod) { + hs.add(item); + } + return lMod.size() == hs.size() ? false : true; + } + + public static List getFinalList(List lDB, List lMod, List lDel, String... equalmethods) throws Exception { + List lFinal = new ArrayList(); + // Quitar eliminados + if (!lDB.isEmpty()) { + for (T rdb : lDB) { + if (Constant.isInList(rdb, lDel, equalmethods) < 0) { + lFinal.add(rdb); + } + } + } + + List lFinalCopy = new ArrayList(lFinal); + // actualizar modificados y agregar nuevos + if ((lMod != null) && !lMod.isEmpty()) { + for (T rmod : lMod) { + int index = Constant.isInList(rmod, lFinalCopy, equalmethods); + if (index >= 0) { + lFinal.set(index, rmod); + } else { + lFinal.add(rmod); + } + } + } + return lFinal; + } + + /** + * Funcin que transforma una lista de objetos a una lista especfica + * + * @param lobj Lista de objetos + * @param cl Clase a la que se va a convertir cada miembro de la lista + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List convertList(List lobj, Class cl) throws Exception { + List l = new ArrayList(); + if (lobj != null) { + for (Object obj : lobj) { + if (cl.isInstance(obj)) { + l.add((T) obj); + } + } + } + return l; + } + + /** + * Método que se encarga de formatear mensajes con parametros + * + * @param message + * @param parameters + * @return + */ + public static String formatMessage(String message, Object... parameters) { + if (parameters != null) { + Object[] parametersAux = parameters; + for (int i = 0; i < parametersAux.length; i++) { + Object objeto = parametersAux[i]; + if (objeto instanceof Integer || objeto instanceof Long) { + message = message.replaceAll("\\{" + i + "\\}", "{" + i + ",number,#}"); + } else if (objeto instanceof BigDecimal) { + message = message.replaceAll("\\{" + i + "\\}", "{" + i + ",number,#,###.##}"); + } + } + message = MessageFormat.format(message, parameters); + } + return message; + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/helper/DialectDB.java b/base/dto/common/src/main/java/com/fp/common/helper/DialectDB.java new file mode 100644 index 0000000..f8d793d --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/helper/DialectDB.java @@ -0,0 +1,37 @@ +package com.fp.common.helper; + +/** + * Enumeracion que maneja los distintos dialectos de base de datos. + * @author Jorge Vaca + * @version 2.1 + */ +public enum DialectDB { + + ORACLE("org.hibernate.dialect.Oracle10gDialect"), + SYBASE("org.hibernate.dialect.SybaseDialect"), + POSTGRES("org.hibernate.dialect.PostgreSQLDialect") + ; + + /**Codigo de dialecto de la base de datos.*/ + private String code; + + /** + * Crea una instancia de la enumeracion. + * @param pCode Codigo de dialecto. + */ + DialectDB(String pCode){ + code = pCode; + } + + + + /** + * Entrega el valor del dialecto de la enumeracion. + * @return String + * @throws Exception + */ + public String getCode() throws Exception { + return code; + } + +} diff --git a/base/dto/common/src/main/java/com/fp/common/helper/FkException.java b/base/dto/common/src/main/java/com/fp/common/helper/FkException.java new file mode 100644 index 0000000..b2c606f --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/helper/FkException.java @@ -0,0 +1,18 @@ +package com.fp.common.helper; + + +/** + * Interface a implementar por la clase que entrega tabla padre y tabla dependiente cuando hay un + * fk violado. + * @author Jorge Vaca + * @version 2.1 + */ +public interface FkException { + + /** + * Entrega la tabla padre y dependiente dado un foreing key. + * @param fk constraint con el cual se obtien la tabla padre y la tabla dependiente. + * @return String[] + */ + public String[] getFkData(String fk); +} diff --git a/base/dto/common/src/main/java/com/fp/common/logger/.svn/entries b/base/dto/common/src/main/java/com/fp/common/logger/.svn/entries new file mode 100644 index 0000000..359a58a --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/logger/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/common/logger +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +APPLogger.java +file + + + + +2022-07-28T03:40:34.771769Z +c1221aa7c0dbcfe44eecd208bd52bc8a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +729 + diff --git a/base/dto/common/src/main/java/com/fp/common/logger/.svn/text-base/APPLogger.java.svn-base b/base/dto/common/src/main/java/com/fp/common/logger/.svn/text-base/APPLogger.java.svn-base new file mode 100644 index 0000000..60ebe6b --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/logger/.svn/text-base/APPLogger.java.svn-base @@ -0,0 +1,32 @@ +package com.fp.common.logger; +import org.apache.log4j.Logger; +import org.apache.log4j.PropertyConfigurator; + +public class APPLogger extends Logger { + + +private static boolean monitorInit=false; + + public APPLogger(String name) { + super(name); + } + + public static Logger getLogger(String name) { + Logger logger=Logger.getLogger(name);//, factory); + return logger; + } + + public static Logger getLogger() { + Exception e=new Exception(); + StackTraceElement el=e.getStackTrace()[1]; + if(!monitorInit){ + PropertyConfigurator.configureAndWatch("log4j.properties"); + monitorInit=true; + } + return getLogger(el.getClassName()); + } + + public void error(Object arg0) { + super.error(arg0); + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/logger/APPLogger.java b/base/dto/common/src/main/java/com/fp/common/logger/APPLogger.java new file mode 100644 index 0000000..60ebe6b --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/logger/APPLogger.java @@ -0,0 +1,32 @@ +package com.fp.common.logger; +import org.apache.log4j.Logger; +import org.apache.log4j.PropertyConfigurator; + +public class APPLogger extends Logger { + + +private static boolean monitorInit=false; + + public APPLogger(String name) { + super(name); + } + + public static Logger getLogger(String name) { + Logger logger=Logger.getLogger(name);//, factory); + return logger; + } + + public static Logger getLogger() { + Exception e=new Exception(); + StackTraceElement el=e.getStackTrace()[1]; + if(!monitorInit){ + PropertyConfigurator.configureAndWatch("log4j.properties"); + monitorInit=true; + } + return getLogger(el.getClassName()); + } + + public void error(Object arg0) { + super.error(arg0); + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/messages/.svn/entries b/base/dto/common/src/main/java/com/fp/common/messages/.svn/entries new file mode 100644 index 0000000..42231df --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/messages/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/common/messages +svn://172.17.26.185/COMACO + + + +2014-09-17T05:52:10.767036Z +863 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +MessageUtil.java +file + + + + +2022-07-28T03:40:35.006770Z +aa94044b0e547842f585727261e6e24c +2014-09-17T05:52:10.767036Z +863 +cpiedra + + + + + + + + + + + + + + + + + + + + + +2537 + +ELEval.java +file + + + + +2022-07-28T03:40:35.006770Z +7c2114269b33e970eb153938445e7b47 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +209 + diff --git a/base/dto/common/src/main/java/com/fp/common/messages/.svn/text-base/ELEval.java.svn-base b/base/dto/common/src/main/java/com/fp/common/messages/.svn/text-base/ELEval.java.svn-base new file mode 100644 index 0000000..32197bd --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/messages/.svn/text-base/ELEval.java.svn-base @@ -0,0 +1,9 @@ +package com.fp.common.messages; + +import org.mvel2.MVEL; + +public class ELEval { + public static Object eval(Object pReference, String pExpression) { + return MVEL.eval(pExpression, pReference); + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/messages/.svn/text-base/MessageUtil.java.netbeans-base b/base/dto/common/src/main/java/com/fp/common/messages/.svn/text-base/MessageUtil.java.netbeans-base new file mode 100644 index 0000000..a41e7b4 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/messages/.svn/text-base/MessageUtil.java.netbeans-base @@ -0,0 +1,81 @@ +package com.fp.common.messages; + +import java.io.StringWriter; +import java.util.Locale; +import java.util.Properties; + +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.Velocity; +import org.apache.velocity.app.VelocityEngine; +import org.apache.velocity.runtime.RuntimeConstants; +import org.apache.velocity.tools.generic.DateTool; +import org.apache.velocity.tools.generic.MathTool; +import org.apache.velocity.tools.generic.NumberTool; + +import com.fp.common.logger.APPLogger; + +public class MessageUtil { + private String pattern; + + private final VelocityEngine ve; + + VelocityContext context = new VelocityContext(); + + public MessageUtil(String pLanguage) throws Exception { + Velocity.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, this); + Velocity.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, "org.apache.velocity.runtime.log.SimpleLog4JLogSystem"); + this.ve = new VelocityEngine(); + this.ve.init(); + this.init(pLanguage); + } + + public MessageUtil(String pLanguage, Properties p) throws Exception { + this.ve = new VelocityEngine(); + this.ve.init(p); + this.init(pLanguage); + } + + private void init(String pLanguage) { + this.context.put("date", new DateTool()); + this.context.put("math", new MathTool()); + this.context.put("number", new NumberTool()); + try { + + //this.context.put("builder", Class.forName("com.fp.builder.templates.MessageTemplates").newInstance()); + } catch (Exception e) { + APPLogger.getLogger().warn(e, e); + } + try { + + this.context.put("general", Class.forName("com.fp.base.persistence.util.helper.GeneralDescriptions").newInstance()); + } catch (Exception e) { + APPLogger.getLogger().warn(e, e); + } + + this.context.put("locate", new Locale(pLanguage.toLowerCase())); + } + + public MessageUtil(String pLanguage, String pPattern) throws Exception { + this(pLanguage); + this.pattern = pPattern; + } + + public void setPattern(String pPattern) { + this.pattern = pPattern; + } + + public void setValue(String pName, Object pValue) { + this.context.put(pName, pValue); + } + + public String getMessage() throws Exception { + StringWriter writer = new StringWriter(); + try { + this.ve.evaluate(this.context, writer, "", this.pattern); + } finally { + writer.close(); + } + return writer.toString(); + } + +} diff --git a/base/dto/common/src/main/java/com/fp/common/messages/.svn/text-base/MessageUtil.java.svn-base b/base/dto/common/src/main/java/com/fp/common/messages/.svn/text-base/MessageUtil.java.svn-base new file mode 100644 index 0000000..a41e7b4 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/messages/.svn/text-base/MessageUtil.java.svn-base @@ -0,0 +1,81 @@ +package com.fp.common.messages; + +import java.io.StringWriter; +import java.util.Locale; +import java.util.Properties; + +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.Velocity; +import org.apache.velocity.app.VelocityEngine; +import org.apache.velocity.runtime.RuntimeConstants; +import org.apache.velocity.tools.generic.DateTool; +import org.apache.velocity.tools.generic.MathTool; +import org.apache.velocity.tools.generic.NumberTool; + +import com.fp.common.logger.APPLogger; + +public class MessageUtil { + private String pattern; + + private final VelocityEngine ve; + + VelocityContext context = new VelocityContext(); + + public MessageUtil(String pLanguage) throws Exception { + Velocity.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, this); + Velocity.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, "org.apache.velocity.runtime.log.SimpleLog4JLogSystem"); + this.ve = new VelocityEngine(); + this.ve.init(); + this.init(pLanguage); + } + + public MessageUtil(String pLanguage, Properties p) throws Exception { + this.ve = new VelocityEngine(); + this.ve.init(p); + this.init(pLanguage); + } + + private void init(String pLanguage) { + this.context.put("date", new DateTool()); + this.context.put("math", new MathTool()); + this.context.put("number", new NumberTool()); + try { + + //this.context.put("builder", Class.forName("com.fp.builder.templates.MessageTemplates").newInstance()); + } catch (Exception e) { + APPLogger.getLogger().warn(e, e); + } + try { + + this.context.put("general", Class.forName("com.fp.base.persistence.util.helper.GeneralDescriptions").newInstance()); + } catch (Exception e) { + APPLogger.getLogger().warn(e, e); + } + + this.context.put("locate", new Locale(pLanguage.toLowerCase())); + } + + public MessageUtil(String pLanguage, String pPattern) throws Exception { + this(pLanguage); + this.pattern = pPattern; + } + + public void setPattern(String pPattern) { + this.pattern = pPattern; + } + + public void setValue(String pName, Object pValue) { + this.context.put(pName, pValue); + } + + public String getMessage() throws Exception { + StringWriter writer = new StringWriter(); + try { + this.ve.evaluate(this.context, writer, "", this.pattern); + } finally { + writer.close(); + } + return writer.toString(); + } + +} diff --git a/base/dto/common/src/main/java/com/fp/common/messages/ELEval.java b/base/dto/common/src/main/java/com/fp/common/messages/ELEval.java new file mode 100644 index 0000000..32197bd --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/messages/ELEval.java @@ -0,0 +1,9 @@ +package com.fp.common.messages; + +import org.mvel2.MVEL; + +public class ELEval { + public static Object eval(Object pReference, String pExpression) { + return MVEL.eval(pExpression, pReference); + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/messages/MessageUtil.java b/base/dto/common/src/main/java/com/fp/common/messages/MessageUtil.java new file mode 100644 index 0000000..a41e7b4 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/messages/MessageUtil.java @@ -0,0 +1,81 @@ +package com.fp.common.messages; + +import java.io.StringWriter; +import java.util.Locale; +import java.util.Properties; + +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.Velocity; +import org.apache.velocity.app.VelocityEngine; +import org.apache.velocity.runtime.RuntimeConstants; +import org.apache.velocity.tools.generic.DateTool; +import org.apache.velocity.tools.generic.MathTool; +import org.apache.velocity.tools.generic.NumberTool; + +import com.fp.common.logger.APPLogger; + +public class MessageUtil { + private String pattern; + + private final VelocityEngine ve; + + VelocityContext context = new VelocityContext(); + + public MessageUtil(String pLanguage) throws Exception { + Velocity.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, this); + Velocity.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, "org.apache.velocity.runtime.log.SimpleLog4JLogSystem"); + this.ve = new VelocityEngine(); + this.ve.init(); + this.init(pLanguage); + } + + public MessageUtil(String pLanguage, Properties p) throws Exception { + this.ve = new VelocityEngine(); + this.ve.init(p); + this.init(pLanguage); + } + + private void init(String pLanguage) { + this.context.put("date", new DateTool()); + this.context.put("math", new MathTool()); + this.context.put("number", new NumberTool()); + try { + + //this.context.put("builder", Class.forName("com.fp.builder.templates.MessageTemplates").newInstance()); + } catch (Exception e) { + APPLogger.getLogger().warn(e, e); + } + try { + + this.context.put("general", Class.forName("com.fp.base.persistence.util.helper.GeneralDescriptions").newInstance()); + } catch (Exception e) { + APPLogger.getLogger().warn(e, e); + } + + this.context.put("locate", new Locale(pLanguage.toLowerCase())); + } + + public MessageUtil(String pLanguage, String pPattern) throws Exception { + this(pLanguage); + this.pattern = pPattern; + } + + public void setPattern(String pPattern) { + this.pattern = pPattern; + } + + public void setValue(String pName, Object pValue) { + this.context.put(pName, pValue); + } + + public String getMessage() throws Exception { + StringWriter writer = new StringWriter(); + try { + this.ve.evaluate(this.context, writer, "", this.pattern); + } finally { + writer.close(); + } + return writer.toString(); + } + +} diff --git a/base/dto/common/src/main/java/com/fp/common/properties/.svn/entries b/base/dto/common/src/main/java/com/fp/common/properties/.svn/entries new file mode 100644 index 0000000..94922d0 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/properties/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/common/properties +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +CommonProperties.java +file + + + + +2022-07-28T03:40:35.106770Z +dae2f213ada01f950be708491f042709 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +949 + +PropertiesHandler.java +file + + + + +2022-07-28T03:40:35.106770Z +a4ce5b52bb9c308c9da6603bf4d59d6e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7204 + diff --git a/base/dto/common/src/main/java/com/fp/common/properties/.svn/text-base/CommonProperties.java.svn-base b/base/dto/common/src/main/java/com/fp/common/properties/.svn/text-base/CommonProperties.java.svn-base new file mode 100644 index 0000000..49641fc --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/properties/.svn/text-base/CommonProperties.java.svn-base @@ -0,0 +1,37 @@ +package com.fp.common.properties; + +import java.io.IOException; + +/** + * Clase que se encarga del manejo del archivo de propiedades common. + * @author Jorge Vaca. + * @version 2.1 + */ +public final class CommonProperties extends PropertiesHandler { + /** + * Almacena una instancia del tipo CommonProperties en el singleton. + */ + private static CommonProperties instance=null; + + /** + * Crea una instancia de CommonProperties. + * @throws IOException + */ + private CommonProperties() throws IOException,Exception{ + super("common"); + } + + /** + * Crea y entrega una instancia de CommonProperties. + * @return CommonProperties + * @throws IOException + */ + public static CommonProperties getInstance() throws IOException,Exception{ + synchronized (CommonProperties.class) { + if(instance==null){ + instance=new CommonProperties(); + } + } + return instance; + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/properties/.svn/text-base/PropertiesHandler.java.svn-base b/base/dto/common/src/main/java/com/fp/common/properties/.svn/text-base/PropertiesHandler.java.svn-base new file mode 100644 index 0000000..fec9dd9 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/properties/.svn/text-base/PropertiesHandler.java.svn-base @@ -0,0 +1,241 @@ +package com.fp.common.properties; + + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import java.util.Set; +import java.util.StringTokenizer; + + + + +/** + * Clase que permite el acceso en caliente a archivos propiedades. + * Si se cambia un archivo properties no es necesario reiniciar la instancia para que la aplicaicon + * tomo los nuevos valores. + * @author Jorge Vaca. + * @version 2.1 + */ +public class PropertiesHandler { + // ~ Variables de Instancia + // *********************************************************************** + + /** + * Archivo + */ + private File file; + + /** + * Recurso que contiene las propiedades definidas en el Archivo + */ + private Properties resource; + + /** + * Path del Archivo de propiedades + */ + private String resourceFile; + + /** + * Fecha del archivo subido a memoria + */ + private long date; + + private String name; + + private static final String PROPERTIES = ".properties"; + + // ~ Contructores + // ********************************************************************************* + + /** + * Crea una nueva instancia de PropertiesHandler + * + * @throws Exception + * Error + * @param pName + * Raiz del Archivo properties Manejado + */ + public PropertiesHandler(String pName) throws Exception { + this.name = pName; + String path = System.getProperties().getProperty("java.class.path"); + String pathSeparator = System.getProperties().getProperty("path.separator"); + String dirSeparator = System.getProperties().getProperty("file.separator"); + StringTokenizer st = new StringTokenizer(path, pathSeparator); + while (st.hasMoreElements()) { + String f1 = (String) st.nextElement(); + File f2 = new File(f1); + if (!f2.isDirectory()) { + continue; + } + this.resourceFile = f1 + dirSeparator + pName + PROPERTIES; + try { + this.findFile(); + if (this.file.exists()) { + break; + } + } catch (FileNotFoundException e) { + continue; + } + } + + this.reload(); + + } + + // ~ Mtodos + // ************************************************************************************** + + /** + * Verifica si el archivo fuente de las propiedades ha sido modificado + * + * @throws Exception + * Error al verificar el Archivo + */ + private void check() throws Exception { + try { + File f2 = new File(this.resourceFile); + long date1 = f2.lastModified(); + + if (this.date != date1) { + this.date = date1; + this.file = f2; + this.reload(); + } + } catch (NullPointerException e) { + //NO hacer nada + } + } + + /** + * Encuentra el archivo + * + * @throws Exception + * Error al encontrar el archivo + */ + private void findFile() throws Exception { + this.file = new File(this.resourceFile); + this.date = this.file.lastModified(); + } + + /** + * Entrega el valor en booleano de la variable + * + * @param pKey + * Nombre de la variable a entregar + * @return El valor booleano de la variable + * @throws Exception + * Error al convertir el valor encontrado a booleano + */ + public boolean getBooleanValue(String pKey) throws Exception { + return (this.getValue(pKey).compareTo("true") == 0) ? true : false; + } + + /** + * Entrega el valor en entero de la variable + * + * @param pKey + * Nombre de la variable a entregar + * @return El valor entero de la variable + * @throws Exception + * Error al convertir el valor encontrado a entero + */ + public int getIntValue(String pKey) throws Exception { + return Integer.parseInt(this.getValue(pKey)); + } + + public Set getKeyList() throws Exception { + return this.resource.keySet(); + } + + /** + * Entrega la lista de Valores asociados al Key separado por ',' + * + * @param pKey + * Key del archivo + * @return Lista de valores + * @throws Exception + */ + public List getList(String pKey) throws Exception { + return this.getList(pKey, ","); + } + + /** + * Entrega la lista de Valores asociados al Key separado por un token + * + * @param pKey + * Key del archivo + * @param pToken + * Separador de valores + * @return Lista de Valores + * @throws Exception + */ + public List getList(String pKey, String pToken) throws Exception { + String data = this.getStringValue(pKey); + List list = new ArrayList(); + if (data.indexOf(pToken) < 0) { + list.add(data); + } else { + String[] dataArr = data.split(pToken); + for (String string : dataArr) { + list.add(string); + } + } + return list; + } + + public String getStringValue(String pKey) throws Exception { + this.check(); + try { + return this.resource.getProperty(pKey); + } catch (NullPointerException e) { + throw new Exception("Cadena No Encontrada " + pKey, e); + } + } + + /** + * Entrega el valor de la variable + * + * @param pKey + * Nombre de la variable a entregar + * @return El valor de la variable + * @throws Exception + * Error al Encontrar la variable + */ + public String getValue(String pKey) throws Exception { + this.check(); + try { + return this.resource.getProperty(pKey).trim(); + } catch (NullPointerException e) { + throw new Exception("Cadena No Encontrada " + pKey, e); + } + } + + public boolean hasValue(String pKey) throws Exception { + return this.resource.containsKey(pKey); + } + + /** + * Recarga el contenido del Archivo + * + * @throws Exception + * Error al recargar el archivo + */ + private void reload() throws Exception { + InputStream in = null; + try { + in = new FileInputStream(this.file); + } catch (NullPointerException e) { + in = this.getClass().getClassLoader().getResource(this.name + PROPERTIES).openStream(); + } catch (FileNotFoundException e) { + in = this.getClass().getClassLoader().getResource(this.name + PROPERTIES).openStream(); + } + this.resource = new Properties(); + this.resource.load(in); + in.close(); + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/properties/CommonProperties.java b/base/dto/common/src/main/java/com/fp/common/properties/CommonProperties.java new file mode 100644 index 0000000..49641fc --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/properties/CommonProperties.java @@ -0,0 +1,37 @@ +package com.fp.common.properties; + +import java.io.IOException; + +/** + * Clase que se encarga del manejo del archivo de propiedades common. + * @author Jorge Vaca. + * @version 2.1 + */ +public final class CommonProperties extends PropertiesHandler { + /** + * Almacena una instancia del tipo CommonProperties en el singleton. + */ + private static CommonProperties instance=null; + + /** + * Crea una instancia de CommonProperties. + * @throws IOException + */ + private CommonProperties() throws IOException,Exception{ + super("common"); + } + + /** + * Crea y entrega una instancia de CommonProperties. + * @return CommonProperties + * @throws IOException + */ + public static CommonProperties getInstance() throws IOException,Exception{ + synchronized (CommonProperties.class) { + if(instance==null){ + instance=new CommonProperties(); + } + } + return instance; + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/properties/PropertiesHandler.java b/base/dto/common/src/main/java/com/fp/common/properties/PropertiesHandler.java new file mode 100644 index 0000000..fec9dd9 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/properties/PropertiesHandler.java @@ -0,0 +1,241 @@ +package com.fp.common.properties; + + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import java.util.Set; +import java.util.StringTokenizer; + + + + +/** + * Clase que permite el acceso en caliente a archivos propiedades. + * Si se cambia un archivo properties no es necesario reiniciar la instancia para que la aplicaicon + * tomo los nuevos valores. + * @author Jorge Vaca. + * @version 2.1 + */ +public class PropertiesHandler { + // ~ Variables de Instancia + // *********************************************************************** + + /** + * Archivo + */ + private File file; + + /** + * Recurso que contiene las propiedades definidas en el Archivo + */ + private Properties resource; + + /** + * Path del Archivo de propiedades + */ + private String resourceFile; + + /** + * Fecha del archivo subido a memoria + */ + private long date; + + private String name; + + private static final String PROPERTIES = ".properties"; + + // ~ Contructores + // ********************************************************************************* + + /** + * Crea una nueva instancia de PropertiesHandler + * + * @throws Exception + * Error + * @param pName + * Raiz del Archivo properties Manejado + */ + public PropertiesHandler(String pName) throws Exception { + this.name = pName; + String path = System.getProperties().getProperty("java.class.path"); + String pathSeparator = System.getProperties().getProperty("path.separator"); + String dirSeparator = System.getProperties().getProperty("file.separator"); + StringTokenizer st = new StringTokenizer(path, pathSeparator); + while (st.hasMoreElements()) { + String f1 = (String) st.nextElement(); + File f2 = new File(f1); + if (!f2.isDirectory()) { + continue; + } + this.resourceFile = f1 + dirSeparator + pName + PROPERTIES; + try { + this.findFile(); + if (this.file.exists()) { + break; + } + } catch (FileNotFoundException e) { + continue; + } + } + + this.reload(); + + } + + // ~ Mtodos + // ************************************************************************************** + + /** + * Verifica si el archivo fuente de las propiedades ha sido modificado + * + * @throws Exception + * Error al verificar el Archivo + */ + private void check() throws Exception { + try { + File f2 = new File(this.resourceFile); + long date1 = f2.lastModified(); + + if (this.date != date1) { + this.date = date1; + this.file = f2; + this.reload(); + } + } catch (NullPointerException e) { + //NO hacer nada + } + } + + /** + * Encuentra el archivo + * + * @throws Exception + * Error al encontrar el archivo + */ + private void findFile() throws Exception { + this.file = new File(this.resourceFile); + this.date = this.file.lastModified(); + } + + /** + * Entrega el valor en booleano de la variable + * + * @param pKey + * Nombre de la variable a entregar + * @return El valor booleano de la variable + * @throws Exception + * Error al convertir el valor encontrado a booleano + */ + public boolean getBooleanValue(String pKey) throws Exception { + return (this.getValue(pKey).compareTo("true") == 0) ? true : false; + } + + /** + * Entrega el valor en entero de la variable + * + * @param pKey + * Nombre de la variable a entregar + * @return El valor entero de la variable + * @throws Exception + * Error al convertir el valor encontrado a entero + */ + public int getIntValue(String pKey) throws Exception { + return Integer.parseInt(this.getValue(pKey)); + } + + public Set getKeyList() throws Exception { + return this.resource.keySet(); + } + + /** + * Entrega la lista de Valores asociados al Key separado por ',' + * + * @param pKey + * Key del archivo + * @return Lista de valores + * @throws Exception + */ + public List getList(String pKey) throws Exception { + return this.getList(pKey, ","); + } + + /** + * Entrega la lista de Valores asociados al Key separado por un token + * + * @param pKey + * Key del archivo + * @param pToken + * Separador de valores + * @return Lista de Valores + * @throws Exception + */ + public List getList(String pKey, String pToken) throws Exception { + String data = this.getStringValue(pKey); + List list = new ArrayList(); + if (data.indexOf(pToken) < 0) { + list.add(data); + } else { + String[] dataArr = data.split(pToken); + for (String string : dataArr) { + list.add(string); + } + } + return list; + } + + public String getStringValue(String pKey) throws Exception { + this.check(); + try { + return this.resource.getProperty(pKey); + } catch (NullPointerException e) { + throw new Exception("Cadena No Encontrada " + pKey, e); + } + } + + /** + * Entrega el valor de la variable + * + * @param pKey + * Nombre de la variable a entregar + * @return El valor de la variable + * @throws Exception + * Error al Encontrar la variable + */ + public String getValue(String pKey) throws Exception { + this.check(); + try { + return this.resource.getProperty(pKey).trim(); + } catch (NullPointerException e) { + throw new Exception("Cadena No Encontrada " + pKey, e); + } + } + + public boolean hasValue(String pKey) throws Exception { + return this.resource.containsKey(pKey); + } + + /** + * Recarga el contenido del Archivo + * + * @throws Exception + * Error al recargar el archivo + */ + private void reload() throws Exception { + InputStream in = null; + try { + in = new FileInputStream(this.file); + } catch (NullPointerException e) { + in = this.getClass().getClassLoader().getResource(this.name + PROPERTIES).openStream(); + } catch (FileNotFoundException e) { + in = this.getClass().getClassLoader().getResource(this.name + PROPERTIES).openStream(); + } + this.resource = new Properties(); + this.resource.load(in); + in.close(); + } +} diff --git a/base/dto/common/src/main/java/com/fp/common/soap/.svn/entries b/base/dto/common/src/main/java/com/fp/common/soap/.svn/entries new file mode 100644 index 0000000..667cf9a --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/soap/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/common/soap +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +WSClient.java +file + + + + +2022-07-28T03:40:34.872769Z +c72c5c1945cc7f48192b7793d260d7f5 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4633 + diff --git a/base/dto/common/src/main/java/com/fp/common/soap/.svn/text-base/WSClient.java.svn-base b/base/dto/common/src/main/java/com/fp/common/soap/.svn/text-base/WSClient.java.svn-base new file mode 100644 index 0000000..eb27ebb --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/soap/.svn/text-base/WSClient.java.svn-base @@ -0,0 +1,137 @@ +package com.fp.common.soap; + +import java.io.ByteArrayInputStream; +import java.io.FileOutputStream; +import java.io.StringWriter; +import java.net.URL; + +import javax.xml.soap.MessageFactory; +import javax.xml.soap.SOAPConnection; +import javax.xml.soap.SOAPConnectionFactory; +import javax.xml.soap.SOAPMessage; + +import org.apache.log4j.Logger; +import org.apache.xml.serializer.ToXMLStream; +import org.w3c.dom.Node; + +import com.fp.common.files.StreamHelper; +import com.fp.common.properties.PropertiesHandler; + +public final class WSClient { + private static final Logger LOG = Logger.getLogger(WSClient.class); + + /** Instancia singleton de SOAPClient */ + private static WSClient instance = null; + + /** + * Obtiene la instancia singleton de SOAPClient + * + * @return singleton + */ + public static WSClient getInstance() { + synchronized (WSClient.class) { + if (WSClient.instance == null) { + WSClient.instance = new WSClient(); + } + } + return WSClient.instance; + } + + /** + * Contructor sin parametros + */ + private WSClient() { + } + + /** + * Envia una peticion SOAP en base a los parametros definido en el PropertiesHandler + * + * @param pEndpintURL + * @param pSoapRequest + * @param ph + * @return data resultado de la peticion + * @throws Exception + */ + public String soapSend(String pEndpintURL, String pSoapRequest, PropertiesHandler ph) throws Exception { + try { + WSClient.LOG.debug("ENDPOINT " + pEndpintURL); + + String file = ph.getStringValue("ws.ofac.path") + "/FL" + Double.valueOf(Math.random() * 100000).intValue() + + ".txt"; + + FileOutputStream fout = new FileOutputStream(file); + try { + fout.write(pSoapRequest.getBytes()); + } finally { + fout.close(); + } + + String command = ph.getStringValue("ws.ofac.command") + " " + pEndpintURL + " " + file; + + /* + * Descomentar para pruebas en Windows String command =File.separator + * +"Fitbank"+File.separator+"soap"+File.separator+"run.bat" + " " + EndpintURL + " " + file; + */ + + Process p = Runtime.getRuntime().exec(command); + + String data = StreamHelper.readStream(p.getInputStream()); + WSClient.LOG.debug("Respuesta |" + data + "|"); + return data; + } catch (Exception e) { + WSClient.LOG.error(e, e); + throw e; + } + } + + public SOAPMessage prepareMessage(String pSoapRequest) throws Exception { + return this.prepareMessage(pSoapRequest, "ISO-8859-1"); + } + + /** + * Prepara el mensaje SOAP a ser enviado + * + * @param pSoapRequest + * @return + * @throws Exception + */ + public SOAPMessage prepareMessage(String pSoapRequest, String pEncoding) throws Exception { + MessageFactory msgFactory = MessageFactory.newInstance(); + WSClient.LOG.debug("MessageFactory |" + msgFactory.getClass().getName() + "|"); + return msgFactory.createMessage(null, new ByteArrayInputStream( + // ("" + pSoapRequest).getBytes())); + ("" + pSoapRequest).getBytes())); + } + + /** + * Envia una peticion SOAP para pruebas mediante una nueva conexion + * + * @param pEndpintURL + * @param pSoapRequest + * @return resp + * @throws Exception + */ + public String soapSendReal(String pEndpintURL, String pSoapRequest) throws Exception { + WSClient.LOG.debug("EndPoint |" + pEndpintURL + "| Peticion |" + pSoapRequest + "|"); + // MessageFactory msgFactory = new MessageFactoryImpl(); + SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection(); + SOAPMessage reqMsg = this.prepareMessage(pSoapRequest); + URL epURL = new URL(pEndpintURL); + SOAPMessage resMsg = con.call(reqMsg, epURL); + String resp = WSClient.nodeToString(resMsg.getSOAPBody().getOwnerDocument()); + WSClient.LOG.debug(" Respuesta |" + resp + "|"); + return resp; + } + + public static String nodeToString(Node pNode) throws Exception { + String data = ""; + ToXMLStream dser = (ToXMLStream) (new ToXMLStream()).asDOMSerializer(); + + StringWriter sw = new StringWriter(); + dser.setWriter(sw); + dser.serialize(pNode); + String element = sw.toString(); + data = element.substring(element.indexOf(">") + 1); + return data; + } +} \ No newline at end of file diff --git a/base/dto/common/src/main/java/com/fp/common/soap/WSClient.java b/base/dto/common/src/main/java/com/fp/common/soap/WSClient.java new file mode 100644 index 0000000..eb27ebb --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/soap/WSClient.java @@ -0,0 +1,137 @@ +package com.fp.common.soap; + +import java.io.ByteArrayInputStream; +import java.io.FileOutputStream; +import java.io.StringWriter; +import java.net.URL; + +import javax.xml.soap.MessageFactory; +import javax.xml.soap.SOAPConnection; +import javax.xml.soap.SOAPConnectionFactory; +import javax.xml.soap.SOAPMessage; + +import org.apache.log4j.Logger; +import org.apache.xml.serializer.ToXMLStream; +import org.w3c.dom.Node; + +import com.fp.common.files.StreamHelper; +import com.fp.common.properties.PropertiesHandler; + +public final class WSClient { + private static final Logger LOG = Logger.getLogger(WSClient.class); + + /** Instancia singleton de SOAPClient */ + private static WSClient instance = null; + + /** + * Obtiene la instancia singleton de SOAPClient + * + * @return singleton + */ + public static WSClient getInstance() { + synchronized (WSClient.class) { + if (WSClient.instance == null) { + WSClient.instance = new WSClient(); + } + } + return WSClient.instance; + } + + /** + * Contructor sin parametros + */ + private WSClient() { + } + + /** + * Envia una peticion SOAP en base a los parametros definido en el PropertiesHandler + * + * @param pEndpintURL + * @param pSoapRequest + * @param ph + * @return data resultado de la peticion + * @throws Exception + */ + public String soapSend(String pEndpintURL, String pSoapRequest, PropertiesHandler ph) throws Exception { + try { + WSClient.LOG.debug("ENDPOINT " + pEndpintURL); + + String file = ph.getStringValue("ws.ofac.path") + "/FL" + Double.valueOf(Math.random() * 100000).intValue() + + ".txt"; + + FileOutputStream fout = new FileOutputStream(file); + try { + fout.write(pSoapRequest.getBytes()); + } finally { + fout.close(); + } + + String command = ph.getStringValue("ws.ofac.command") + " " + pEndpintURL + " " + file; + + /* + * Descomentar para pruebas en Windows String command =File.separator + * +"Fitbank"+File.separator+"soap"+File.separator+"run.bat" + " " + EndpintURL + " " + file; + */ + + Process p = Runtime.getRuntime().exec(command); + + String data = StreamHelper.readStream(p.getInputStream()); + WSClient.LOG.debug("Respuesta |" + data + "|"); + return data; + } catch (Exception e) { + WSClient.LOG.error(e, e); + throw e; + } + } + + public SOAPMessage prepareMessage(String pSoapRequest) throws Exception { + return this.prepareMessage(pSoapRequest, "ISO-8859-1"); + } + + /** + * Prepara el mensaje SOAP a ser enviado + * + * @param pSoapRequest + * @return + * @throws Exception + */ + public SOAPMessage prepareMessage(String pSoapRequest, String pEncoding) throws Exception { + MessageFactory msgFactory = MessageFactory.newInstance(); + WSClient.LOG.debug("MessageFactory |" + msgFactory.getClass().getName() + "|"); + return msgFactory.createMessage(null, new ByteArrayInputStream( + // ("" + pSoapRequest).getBytes())); + ("" + pSoapRequest).getBytes())); + } + + /** + * Envia una peticion SOAP para pruebas mediante una nueva conexion + * + * @param pEndpintURL + * @param pSoapRequest + * @return resp + * @throws Exception + */ + public String soapSendReal(String pEndpintURL, String pSoapRequest) throws Exception { + WSClient.LOG.debug("EndPoint |" + pEndpintURL + "| Peticion |" + pSoapRequest + "|"); + // MessageFactory msgFactory = new MessageFactoryImpl(); + SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection(); + SOAPMessage reqMsg = this.prepareMessage(pSoapRequest); + URL epURL = new URL(pEndpintURL); + SOAPMessage resMsg = con.call(reqMsg, epURL); + String resp = WSClient.nodeToString(resMsg.getSOAPBody().getOwnerDocument()); + WSClient.LOG.debug(" Respuesta |" + resp + "|"); + return resp; + } + + public static String nodeToString(Node pNode) throws Exception { + String data = ""; + ToXMLStream dser = (ToXMLStream) (new ToXMLStream()).asDOMSerializer(); + + StringWriter sw = new StringWriter(); + dser.setWriter(sw); + dser.serialize(pNode); + String element = sw.toString(); + data = element.substring(element.indexOf(">") + 1); + return data; + } +} \ No newline at end of file diff --git a/base/dto/common/src/main/java/com/fp/common/thread/.svn/entries b/base/dto/common/src/main/java/com/fp/common/thread/.svn/entries new file mode 100644 index 0000000..f719162 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/thread/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/common/thread +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +Monitor.java +file + + + + +2022-07-28T03:40:35.038770Z +798fa21e23b37a02978e1328a5b71c89 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3529 + diff --git a/base/dto/common/src/main/java/com/fp/common/thread/.svn/text-base/Monitor.java.svn-base b/base/dto/common/src/main/java/com/fp/common/thread/.svn/text-base/Monitor.java.svn-base new file mode 100644 index 0000000..5098509 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/thread/.svn/text-base/Monitor.java.svn-base @@ -0,0 +1,154 @@ +package com.fp.common.thread; + +import java.util.ArrayList; +import java.util.List; + +import com.fp.common.logger.APPLogger; + +/** + * Clase orquestadora de la ejecucion de hilos, controla el numero de operaciones que se ejecutan en paralelo. + * @author Jorge Vaca + * @version 2.1 + */ +/** + * @author Jorge Vaca + * @version 2.1 + */ +/** + * @author Jorge Vaca + * @version 2.1 + */ +public class Monitor { + + /** Indica que para el proceso en ejecucion. */ + private boolean stop = false; + + /** Contador de hilos activos. Cada hilo procesa una cuenta en el fin de dia.*/ + private Long count = Long.valueOf(0); + + /** Monitos de hilo. */ + private boolean available = true; + + /** Monitor de finaliacin de ejecucin de hilos. */ + private boolean end = true; + /** Maximo numero de hilos a levantar en la ejecucin de un batch. */ + protected Integer maxthreads = 0; + + /** Lista que almacena el numero del hilo a procesar. */ + private List lmaxthreads; + + + /** + * Crea una instancia de Monitor. + * @throws Exception + */ + @SuppressWarnings("unchecked") + public Monitor(Integer pMaxthreads) throws Exception{ + maxthreads = pMaxthreads; + lmaxthreads = new ArrayList(); + for (int i = 1; i <= maxthreads; i++) { + lmaxthreads.add(i); + } + } + + + /** + * Metodo que permite controlar la finalizacion de ejecucion de un hilo, resta el contador en 1 para permitir que + * la aplicacion levante la ejecucion de un hilo adicional. + * @param pThreadNumber Numero de hilo en ejecucion, se utiliza en el numero de mensaje con el cual se ejecuta el fin de dia. + * @throws Exception + */ + public synchronized void removeCounter(Integer pThreadNumber) throws Exception { + if (!available) { + wait(); + } + try{ + available = false; + count--; + lmaxthreads.add(pThreadNumber); + }finally{ + available = true; + if (count <= 0) { + end = true; + } + this.notify(); + } + } + + + /** + * Metodo que controla el inicio de ejecucion de un hilo. Suma 1 al contador de hilos en ejecucion. + * @return Integer Numero de hilo en ejecuvion. + * @throws Exception + */ + public synchronized Integer addCounter() throws Exception { + if (!available || count >= this.maxthreads) { + wait(); + } + Integer numthread =0; + try{ + available = false; + int icount = this.count.intValue(); + icount++; + this.count = Long.valueOf(icount); + if(!lmaxthreads.isEmpty()){ + numthread = lmaxthreads.get(0); + lmaxthreads.remove(0); + } + }finally{ + available = true; + end = false; + this.notify(); + } + return numthread; + } + + + /** + * Metodo que controla la finalizacion de ejecucion de todos los hilos que se levantaron en la ejecucion del batch. + * @throws Exception + */ + public synchronized void finish() throws Exception { + while (!end) { + wait(); + } + try { + // this.setStatusProcessed(); + // TODO Change status to executed + APPLogger.getLogger().info("Fin Prceso de Batch "); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Metodo que entrega el numero de hilos en ejecucion. + * @return Long + */ + public Long getCount() { + return count; + } + + + /** + * Entrega el valor de: stop + * @return boolean + */ + public boolean isStop() { + return stop; + } + + + /** + * Fija el valor de: stop + * @param stop valor a almacenar en el objeto. + */ + public void setStop(boolean stop) { + this.stop = stop; + } + + + + + +} \ No newline at end of file diff --git a/base/dto/common/src/main/java/com/fp/common/thread/Monitor.java b/base/dto/common/src/main/java/com/fp/common/thread/Monitor.java new file mode 100644 index 0000000..5098509 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/common/thread/Monitor.java @@ -0,0 +1,154 @@ +package com.fp.common.thread; + +import java.util.ArrayList; +import java.util.List; + +import com.fp.common.logger.APPLogger; + +/** + * Clase orquestadora de la ejecucion de hilos, controla el numero de operaciones que se ejecutan en paralelo. + * @author Jorge Vaca + * @version 2.1 + */ +/** + * @author Jorge Vaca + * @version 2.1 + */ +/** + * @author Jorge Vaca + * @version 2.1 + */ +public class Monitor { + + /** Indica que para el proceso en ejecucion. */ + private boolean stop = false; + + /** Contador de hilos activos. Cada hilo procesa una cuenta en el fin de dia.*/ + private Long count = Long.valueOf(0); + + /** Monitos de hilo. */ + private boolean available = true; + + /** Monitor de finaliacin de ejecucin de hilos. */ + private boolean end = true; + /** Maximo numero de hilos a levantar en la ejecucin de un batch. */ + protected Integer maxthreads = 0; + + /** Lista que almacena el numero del hilo a procesar. */ + private List lmaxthreads; + + + /** + * Crea una instancia de Monitor. + * @throws Exception + */ + @SuppressWarnings("unchecked") + public Monitor(Integer pMaxthreads) throws Exception{ + maxthreads = pMaxthreads; + lmaxthreads = new ArrayList(); + for (int i = 1; i <= maxthreads; i++) { + lmaxthreads.add(i); + } + } + + + /** + * Metodo que permite controlar la finalizacion de ejecucion de un hilo, resta el contador en 1 para permitir que + * la aplicacion levante la ejecucion de un hilo adicional. + * @param pThreadNumber Numero de hilo en ejecucion, se utiliza en el numero de mensaje con el cual se ejecuta el fin de dia. + * @throws Exception + */ + public synchronized void removeCounter(Integer pThreadNumber) throws Exception { + if (!available) { + wait(); + } + try{ + available = false; + count--; + lmaxthreads.add(pThreadNumber); + }finally{ + available = true; + if (count <= 0) { + end = true; + } + this.notify(); + } + } + + + /** + * Metodo que controla el inicio de ejecucion de un hilo. Suma 1 al contador de hilos en ejecucion. + * @return Integer Numero de hilo en ejecuvion. + * @throws Exception + */ + public synchronized Integer addCounter() throws Exception { + if (!available || count >= this.maxthreads) { + wait(); + } + Integer numthread =0; + try{ + available = false; + int icount = this.count.intValue(); + icount++; + this.count = Long.valueOf(icount); + if(!lmaxthreads.isEmpty()){ + numthread = lmaxthreads.get(0); + lmaxthreads.remove(0); + } + }finally{ + available = true; + end = false; + this.notify(); + } + return numthread; + } + + + /** + * Metodo que controla la finalizacion de ejecucion de todos los hilos que se levantaron en la ejecucion del batch. + * @throws Exception + */ + public synchronized void finish() throws Exception { + while (!end) { + wait(); + } + try { + // this.setStatusProcessed(); + // TODO Change status to executed + APPLogger.getLogger().info("Fin Prceso de Batch "); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Metodo que entrega el numero de hilos en ejecucion. + * @return Long + */ + public Long getCount() { + return count; + } + + + /** + * Entrega el valor de: stop + * @return boolean + */ + public boolean isStop() { + return stop; + } + + + /** + * Fija el valor de: stop + * @param stop valor a almacenar en el objeto. + */ + public void setStop(boolean stop) { + this.stop = stop; + } + + + + + +} \ No newline at end of file diff --git a/base/dto/common/src/main/java/com/fp/core/.svn/entries b/base/dto/common/src/main/java/com/fp/core/.svn/entries new file mode 100644 index 0000000..3ab9aca --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/core/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/core +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +exception +dir + diff --git a/base/dto/common/src/main/java/com/fp/core/exception/.svn/entries b/base/dto/common/src/main/java/com/fp/core/exception/.svn/entries new file mode 100644 index 0000000..b615f0a --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/core/exception/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/core/exception +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +CoreException.java +file + + + + +2022-07-28T03:40:35.266771Z +866d920f46328403350451a964a1b692 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1233 + diff --git a/base/dto/common/src/main/java/com/fp/core/exception/.svn/text-base/CoreException.java.svn-base b/base/dto/common/src/main/java/com/fp/core/exception/.svn/text-base/CoreException.java.svn-base new file mode 100644 index 0000000..7a2bace --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/core/exception/.svn/text-base/CoreException.java.svn-base @@ -0,0 +1,40 @@ +package com.fp.core.exception; + +import javax.ejb.ApplicationException; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete comun del core. + * @author Jorge Vaca. + * @version 2.1 + */ +@ApplicationException(rollback=true) +public class CoreException extends APPException { + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de CoreException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public CoreException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de CoreException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public CoreException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } +} + diff --git a/base/dto/common/src/main/java/com/fp/core/exception/CoreException.java b/base/dto/common/src/main/java/com/fp/core/exception/CoreException.java new file mode 100644 index 0000000..7a2bace --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/core/exception/CoreException.java @@ -0,0 +1,40 @@ +package com.fp.core.exception; + +import javax.ejb.ApplicationException; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete comun del core. + * @author Jorge Vaca. + * @version 2.1 + */ +@ApplicationException(rollback=true) +public class CoreException extends APPException { + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de CoreException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public CoreException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de CoreException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public CoreException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } +} + diff --git a/base/dto/common/src/main/java/com/fp/creditfacility/.svn/entries b/base/dto/common/src/main/java/com/fp/creditfacility/.svn/entries new file mode 100644 index 0000000..5d2d5a0 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/creditfacility/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/creditfacility +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +exception +dir + diff --git a/base/dto/common/src/main/java/com/fp/creditfacility/exception/.svn/entries b/base/dto/common/src/main/java/com/fp/creditfacility/exception/.svn/entries new file mode 100644 index 0000000..1e2ee79 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/creditfacility/exception/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/creditfacility/exception +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +CreditFacilityException.java +file + + + + +2022-07-28T03:40:35.634772Z +e2b9ae97ef4be4c5d6f1a7edb0542290 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1315 + diff --git a/base/dto/common/src/main/java/com/fp/creditfacility/exception/.svn/text-base/CreditFacilityException.java.svn-base b/base/dto/common/src/main/java/com/fp/creditfacility/exception/.svn/text-base/CreditFacilityException.java.svn-base new file mode 100644 index 0000000..dcc88df --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/creditfacility/exception/.svn/text-base/CreditFacilityException.java.svn-base @@ -0,0 +1,40 @@ +package com.fp.creditfacility.exception; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete lineas de credito. + * + * @author Jorge Vaca + * @version 2.1 + */ +@javax.ejb.ApplicationException(rollback = true) +public class CreditFacilityException extends APPException { + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de CreditFacilityException. + * + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public CreditFacilityException(String code, String message, Exception pCause, Object... pParameters) { + super(code, message, pCause, pParameters); + } + + /** + * Crea una instancia de CreditFacilityException. + * + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public CreditFacilityException(String code, String message, Object... pParameters) { + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/creditfacility/exception/CreditFacilityException.java b/base/dto/common/src/main/java/com/fp/creditfacility/exception/CreditFacilityException.java new file mode 100644 index 0000000..dcc88df --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/creditfacility/exception/CreditFacilityException.java @@ -0,0 +1,40 @@ +package com.fp.creditfacility.exception; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete lineas de credito. + * + * @author Jorge Vaca + * @version 2.1 + */ +@javax.ejb.ApplicationException(rollback = true) +public class CreditFacilityException extends APPException { + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de CreditFacilityException. + * + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public CreditFacilityException(String code, String message, Exception pCause, Object... pParameters) { + super(code, message, pCause, pParameters); + } + + /** + * Crea una instancia de CreditFacilityException. + * + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public CreditFacilityException(String code, String message, Object... pParameters) { + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/demandeposit/.svn/entries b/base/dto/common/src/main/java/com/fp/demandeposit/.svn/entries new file mode 100644 index 0000000..8601665 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/demandeposit/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/demandeposit +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +exception +dir + diff --git a/base/dto/common/src/main/java/com/fp/demandeposit/exception/.svn/entries b/base/dto/common/src/main/java/com/fp/demandeposit/exception/.svn/entries new file mode 100644 index 0000000..4487bca --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/demandeposit/exception/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/demandeposit/exception +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +DemandDepositException.java +file + + + + +2022-07-28T03:40:36.122774Z +9c9a2e6c296ac00404f6946bb4dfb8ed +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1301 + diff --git a/base/dto/common/src/main/java/com/fp/demandeposit/exception/.svn/text-base/DemandDepositException.java.svn-base b/base/dto/common/src/main/java/com/fp/demandeposit/exception/.svn/text-base/DemandDepositException.java.svn-base new file mode 100644 index 0000000..545f0fe --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/demandeposit/exception/.svn/text-base/DemandDepositException.java.svn-base @@ -0,0 +1,40 @@ +package com.fp.demandeposit.exception; + +import javax.ejb.ApplicationException; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete demanddeposit o cuentas a la vista. + * @author Jorge Vaca + * @version 2.1 + */ +@ApplicationException(rollback=true) +public class DemandDepositException extends APPException{ + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de DemandDepositException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public DemandDepositException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de DemandDepositException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public DemandDepositException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } + +} diff --git a/base/dto/common/src/main/java/com/fp/demandeposit/exception/DemandDepositException.java b/base/dto/common/src/main/java/com/fp/demandeposit/exception/DemandDepositException.java new file mode 100644 index 0000000..545f0fe --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/demandeposit/exception/DemandDepositException.java @@ -0,0 +1,40 @@ +package com.fp.demandeposit.exception; + +import javax.ejb.ApplicationException; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete demanddeposit o cuentas a la vista. + * @author Jorge Vaca + * @version 2.1 + */ +@ApplicationException(rollback=true) +public class DemandDepositException extends APPException{ + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de DemandDepositException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public DemandDepositException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de DemandDepositException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public DemandDepositException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } + +} diff --git a/base/dto/common/src/main/java/com/fp/documents/.svn/entries b/base/dto/common/src/main/java/com/fp/documents/.svn/entries new file mode 100644 index 0000000..7ab6f6b --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/documents/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/documents +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +DocException.java +file + + + + +2022-07-28T03:40:35.731773Z +5185db13c08d59fe6355211e5021f054 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1229 + diff --git a/base/dto/common/src/main/java/com/fp/documents/.svn/text-base/DocException.java.svn-base b/base/dto/common/src/main/java/com/fp/documents/.svn/text-base/DocException.java.svn-base new file mode 100644 index 0000000..6549729 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/documents/.svn/text-base/DocException.java.svn-base @@ -0,0 +1,37 @@ +package com.fp.documents; + +import javax.ejb.ApplicationException; + +import com.fp.common.exception.APPException; + +@ApplicationException(rollback = true) +public class DocException extends APPException { + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de DemandDepositException. + * + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public DocException(String code, String message, Exception pCause, Object... pParameters) { + super(code, message, pCause, pParameters); + } + + /** + * Crea una instancia de DemandDepositException. + * + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public DocException(String code, String message, Object... pParameters) { + super(code, message, pParameters); + } + +} diff --git a/base/dto/common/src/main/java/com/fp/documents/DocException.java b/base/dto/common/src/main/java/com/fp/documents/DocException.java new file mode 100644 index 0000000..6549729 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/documents/DocException.java @@ -0,0 +1,37 @@ +package com.fp.documents; + +import javax.ejb.ApplicationException; + +import com.fp.common.exception.APPException; + +@ApplicationException(rollback = true) +public class DocException extends APPException { + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de DemandDepositException. + * + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public DocException(String code, String message, Exception pCause, Object... pParameters) { + super(code, message, pCause, pParameters); + } + + /** + * Crea una instancia de DemandDepositException. + * + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public DocException(String code, String message, Object... pParameters) { + super(code, message, pParameters); + } + +} diff --git a/base/dto/common/src/main/java/com/fp/dto/.svn/entries b/base/dto/common/src/main/java/com/fp/dto/.svn/entries new file mode 100644 index 0000000..a744353 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/dto/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/dto +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +json +dir + diff --git a/base/dto/common/src/main/java/com/fp/dto/json/.svn/entries b/base/dto/common/src/main/java/com/fp/dto/json/.svn/entries new file mode 100644 index 0000000..42e7dab --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/dto/json/.svn/entries @@ -0,0 +1,133 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/dto/json +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ObjectValueProcessor.java +file + + + + +2022-07-28T03:40:34.592768Z +a76590b460cbf0180e2b63d585b2a82e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +845 + +Serializer.java +file + + + + +2022-07-28T03:40:34.592768Z +d6c17ba916798a17e776252f0ed02277 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +10615 + +DateValueProcessor.java +file + + + + +2022-07-28T03:40:34.592768Z +092c8277d1c98013d77cb90224051db7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1473 + +morpher +dir + diff --git a/base/dto/common/src/main/java/com/fp/dto/json/.svn/text-base/DateValueProcessor.java.svn-base b/base/dto/common/src/main/java/com/fp/dto/json/.svn/text-base/DateValueProcessor.java.svn-base new file mode 100644 index 0000000..cfb0708 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/dto/json/.svn/text-base/DateValueProcessor.java.svn-base @@ -0,0 +1,41 @@ +package com.fp.dto.json; + +import java.sql.Date; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; + +import net.sf.json.JsonConfig; +import net.sf.json.processors.JsonValueProcessor; + +public class DateValueProcessor implements JsonValueProcessor { + public static final String DATE_TRANSPORT = "yyyy-MM-dd"; + + public static final String TIMESTAMP_TRANSPORT = "yyyy-MM-dd HH:mm:ss"; + + @Override + public Object processArrayValue(Object value, JsonConfig jsonConfig) { + String data = ""; + if (value instanceof Date) { + SimpleDateFormat sdf = new SimpleDateFormat(DateValueProcessor.DATE_TRANSPORT); + data = sdf.format((java.util.Date) value); + } else if (value instanceof Timestamp) { + SimpleDateFormat sdf = new SimpleDateFormat(DateValueProcessor.TIMESTAMP_TRANSPORT); + data = sdf.format((java.util.Date) value); + } + return data; + } + + @Override + public Object processObjectValue(String key, Object value, JsonConfig jsonConfig) { + String data = ""; + if (value instanceof Date) { + SimpleDateFormat sdf = new SimpleDateFormat(DateValueProcessor.DATE_TRANSPORT); + data = sdf.format((Date) value); + } else if (value instanceof Timestamp) { + SimpleDateFormat sdf = new SimpleDateFormat(DateValueProcessor.TIMESTAMP_TRANSPORT); + data = sdf.format((Timestamp) value); + } + return data; + } + +} diff --git a/base/dto/common/src/main/java/com/fp/dto/json/.svn/text-base/ObjectValueProcessor.java.svn-base b/base/dto/common/src/main/java/com/fp/dto/json/.svn/text-base/ObjectValueProcessor.java.svn-base new file mode 100644 index 0000000..350c50c --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/dto/json/.svn/text-base/ObjectValueProcessor.java.svn-base @@ -0,0 +1,28 @@ +package com.fp.dto.json; + +import java.math.BigDecimal; + +import net.sf.json.JSONArray; +import net.sf.json.JSONNull; +import net.sf.json.processors.DefaultValueProcessor; +import net.sf.json.util.JSONUtils; + +public class ObjectValueProcessor implements DefaultValueProcessor { + @SuppressWarnings("unchecked") + public Object getDefaultValue( Class type ) { + if( JSONUtils.isArray( type ) ){ + return new JSONArray(); + }else if( JSONUtils.isNumber( type ) ){ + if( JSONUtils.isDouble( type ) ){ + return new BigDecimal("0" ); + }else{ + return new Long( 0 ); + } + }else if( JSONUtils.isBoolean( type ) ){ + return Boolean.FALSE; + }else if( JSONUtils.isString( type ) ){ + return ""; + } + return JSONNull.getInstance(); + } + } \ No newline at end of file diff --git a/base/dto/common/src/main/java/com/fp/dto/json/.svn/text-base/Serializer.java.svn-base b/base/dto/common/src/main/java/com/fp/dto/json/.svn/text-base/Serializer.java.svn-base new file mode 100644 index 0000000..e70f5b3 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/dto/json/.svn/text-base/Serializer.java.svn-base @@ -0,0 +1,346 @@ +package com.fp.dto.json; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.sf.ezmorph.Morpher; +import net.sf.ezmorph.MorpherRegistry; +import net.sf.ezmorph.bean.MorphDynaBean; +import net.sf.json.JSONObject; +import net.sf.json.JsonConfig; +import net.sf.json.util.JSONUtils; +import net.sf.json.xml.XMLSerializer; + +import org.apache.commons.beanutils.DynaProperty; +import org.apache.commons.beanutils.PropertyUtils; + +import com.fp.common.helper.BeanManager; +import com.fp.common.logger.APPLogger; +import com.fp.dto.AbstractData; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Response; +import com.fp.dto.json.morpher.DateMorpher; +import com.fp.dto.json.morpher.TimestampMorpher; +import com.fp.dto.save.SaveBean; +import com.fp.dto.save.SaveRequest; + +public class Serializer { + + private Serializable data; + + private String json; + + private JSONObject jsonObj; + + private JsonConfig jsonConfig; + + private MorpherRegistry morpherRegistry; + + public Serializer(Serializable pData) throws Exception { + if (pData instanceof Response) { + ((Response) pData).changeAbstractBeanToMap(); + } + this.data = pData; + this.config(); + } + + public Serializer(String pXML, boolean pIndex) { + this("" + new XMLSerializer().read(pXML)); + } + + public Serializer(String pJSON) { + this.json = pJSON.trim(); + this.config(); + if ((this.json.charAt(0) == '"') && (this.json.charAt(this.json.length() - 1) == '"')) { + this.json = this.json.substring(1, this.json.length() - 1); + } + this.jsonObj = JSONObject.fromObject(this.json, this.jsonConfig); + } + + private void config() { + this.jsonConfig = new JsonConfig(); + this.jsonConfig.registerJsonValueProcessor(Date.class, new DateValueProcessor()); + this.jsonConfig.registerJsonValueProcessor(Timestamp.class, new DateValueProcessor()); + this.jsonConfig.registerDefaultValueProcessor(Double.class, new ObjectValueProcessor()); + this.morpherRegistry = JSONUtils.getMorpherRegistry(); + Morpher dynaMorpher = new TimestampMorpher(); + this.morpherRegistry.registerMorpher(dynaMorpher); + dynaMorpher = new DateMorpher(); + this.morpherRegistry.registerMorpher(dynaMorpher); + } + + /** + * Entrega un string en formato json. + * + * @return String + * @throws Exception + */ + public final String toJSON() throws Exception { + try { + JSONObject jsonData = JSONObject.fromObject(this.data, this.jsonConfig); + return jsonData.toString(); + } catch (Exception e) { + APPLogger.getLogger().error(e, e); + throw e; + } + } + + public String toXML() throws Exception { + try { + JSONObject jsonData = JSONObject.fromObject(this.data, this.jsonConfig); + XMLSerializer xml = new XMLSerializer(); + xml.setElementName("REGISTRO"); + xml.setObjectName("FP"); + xml.setTrimSpaces(true); + xml.setRemoveNamespacePrefixFromElements(true); + xml.setSkipWhitespace(true); + xml.setSkipNamespaces(true); + String sXML = xml.write(jsonData); + while (sXML.indexOf("null=\"true\"/>") > 0) { + String aux1 = sXML.substring(0, sXML.indexOf("null=\"true\"/>")); + String aux2 = sXML.substring(sXML.indexOf("null=\"true\"/>") + 13); + sXML = aux1.substring(0, aux1.lastIndexOf("<")) + aux2; + } + return sXML; + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @SuppressWarnings("unchecked") + public Object toObject(Class pType) throws Exception { + Object obj = JSONObject.toBean(this.jsonObj, pType); + if (obj instanceof Map) { + Map m = (Map) obj; + if (!m.containsKey("transportBeanClass")) { + m.put("transportBeanClass", pType.getName()); + } + // m=this.correctMap(m); + obj = this.manageMapBean(m); + } + + return obj; + } + + @SuppressWarnings("unchecked") + public T toObjectGenerics(T pType) throws Exception { + T obj = (T) JSONObject.toBean(this.jsonObj, pType.getClass()); + if (obj instanceof Map) { + Map m = (Map) obj; + if (!m.containsKey("transportBeanClass")) { + m.put("transportBeanClass", pType.getClass().getName()); + } + // m=this.correctMap(m); + obj = (T) this.manageMapBean(m); + } + + return obj; + } + + private List manageList(List pList) throws ClassNotFoundException, InstantiationException, IllegalAccessException, + InvocationTargetException, NoSuchMethodException, ParseException { + List dataList = new ArrayList(); + for (Object obj : pList) { + dataList.add(this.manageValue(obj, null)); + } + return dataList; + } + + @SuppressWarnings("unchecked") + private Object manageValue(Object pObject, Class pType) throws ClassNotFoundException, InstantiationException, IllegalAccessException, + InvocationTargetException, NoSuchMethodException, ParseException { + if (pObject == null) { + return null; + } + if (pObject instanceof String) { + if (((String) pObject).compareTo("null") == 0) { + return null; + } + } + if (pObject instanceof JSONObject) { + JSONObject obj = (JSONObject) pObject; + if (obj.isNullObject()) { + return null; + } + } + if (pType != null) { + // System.out.println(pObject+" "+"->"+pType.getName()); + return BeanManager.convertObject(pObject, pType); + } + if (pObject instanceof Double) { + return new BigDecimal("" + pObject); + } + if (pObject instanceof Map) { + Map m = (Map) pObject;// this.correctMap((Map)pObject); + return this.manageMapBean(m); + } + if (pObject instanceof MorphDynaBean) { + return this.manageBean((MorphDynaBean) pObject); + } + if (pObject instanceof List) { + return this.manageList((List) pObject); + } + if (pObject instanceof String) { + String sObj = (String) pObject; + if (sObj.length() == DateValueProcessor.DATE_TRANSPORT.length()) { + try { + return new Date(new SimpleDateFormat(DateValueProcessor.DATE_TRANSPORT).parse(sObj).getTime()); + } catch (Exception e) { + } + } + if (sObj.length() == DateValueProcessor.TIMESTAMP_TRANSPORT.length()) { + try { + return new Timestamp(new SimpleDateFormat(DateValueProcessor.TIMESTAMP_TRANSPORT).parse(sObj).getTime()); + } catch (Exception e) { + } + } + return pObject; + } + return pObject; + } + + @SuppressWarnings("unchecked") + private Object manageBean(MorphDynaBean pMorphDynaBean) throws ClassNotFoundException, InstantiationException, IllegalAccessException, + InvocationTargetException, NoSuchMethodException { + DynaProperty[] prop = pMorphDynaBean.getDynaClass().getDynaProperties(); + Map mapBean = new HashMap(); + for (DynaProperty dynaProperty : prop) { + String name = dynaProperty.getName(); + mapBean.put(name, pMorphDynaBean.get(name)); + } + if (!mapBean.containsKey("transportBeanClass")) { + mapBean.put("transportBeanClass", "java.util.HashMap"); + } + return this.manageMapBean(mapBean); + } + + private String correctType(String pType) { + if (pType.compareTo("java.util.List") == 0) { + return "java.util.ArrayList"; + } + if (pType.compareTo("java.util.Map") == 0) { + return "java.util.HashMap"; + } + return pType; + } + + @SuppressWarnings("unchecked") + private Object manageMapBean(Map pMapBean) throws ClassNotFoundException, InstantiationException, IllegalAccessException, + InvocationTargetException, NoSuchMethodException { + String classType = (String) pMapBean.get("transportBeanClass"); + if (classType == null) { + return pMapBean; + } + classType = this.correctType(classType); + Object obj = Class.forName(classType).newInstance(); + Set keys = pMapBean.keySet(); + for (Object key : keys) { + String name = (String) key; + if (name.compareTo("transportBeanClass") == 0) { + continue; + } + try { + Class type = PropertyUtils.getPropertyType(obj, name); + try { + + if (type.getPackage().getName().compareTo("java.util") == 0) { + type = null; + } + } catch (Exception e) { + } + Object value = this.manageValue(pMapBean.get(name), type); + try { + // PropertyUtils.setProperty(obj, name, value); + if (classType.compareTo("java.util.HashMap") == 0) { + ((Map) obj).put(name, value); + } else { + if (value instanceof MorphDynaBean) { + value = this.manageBean((MorphDynaBean) value); + } + if (value instanceof Map) { + value = this.manageMapBean((Map) value); + } + BeanManager.setBeanAttributeValue(obj, name, + BeanManager.convertObject(value, BeanManager.getBeanGetterMethod(obj, name).getReturnType())); + } + } catch (Exception eadd) { + if (name.indexOf("transportBeanClass") > 0) { + String prop = name.replaceAll("_transportBeanClass", ""); + Object objProp = this.prepareBean(prop, (String) value, pMapBean); + try { + // PropertyUtils.setProperty(obj, prop, objProp); + BeanManager.setBeanAttributeValue(obj, prop, + BeanManager.convertObject(objProp, BeanManager.getBeanGetterMethod(obj, prop).getReturnType())); + } catch (Exception e) { + try { + AbstractData dt = (AbstractData) obj; + dt.addAddtionalInfo(prop, objProp); + } catch (Exception e1) { + } + } + } else { + try { + if ((obj instanceof SaveRequest) && (value instanceof SaveBean)) { + ((SaveRequest) obj).putSaveBean(((SaveBean) value).getBeanAlias(), value); + } else { + //JVC 22 octubre 2012 todo el if + if(obj instanceof AbstractDataTransport){ + ((AbstractDataTransport)obj).put(name, value); + }else{ + AbstractData dt = (AbstractData) obj; + dt.addAddtionalInfo(name, value); + } + + } + } catch (Exception e1) { + } + } + } + } catch (Exception e) { + e.printStackTrace(); + continue; + } + } + return obj; + } + + @SuppressWarnings("unchecked") + private Object prepareBean(String pPrefix, String pClass, Map pMapBean) throws ClassNotFoundException, InstantiationException, + IllegalAccessException { + Class c = Class.forName(pClass); + Object obj = c.newInstance(); + Field[] fs = c.getDeclaredFields(); + for (Field field : fs) { + try { + String name = field.getName(); + if (name.compareTo("serialVersionUID") == 0) { + continue; + } + Object val = null; + try { + val = pMapBean.get(pPrefix + "_" + name); + } catch (Exception e1) { + continue; + } + BeanManager.setBeanAttributeValue(obj, name, + BeanManager.convertObject(val, BeanManager.getBeanGetterMethod(obj, name).getReturnType())); + } catch (Exception e) { + APPLogger.getLogger().debug(e); + continue; + } + } + return obj; + } +} diff --git a/base/dto/common/src/main/java/com/fp/dto/json/DateValueProcessor.java b/base/dto/common/src/main/java/com/fp/dto/json/DateValueProcessor.java new file mode 100644 index 0000000..cfb0708 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/dto/json/DateValueProcessor.java @@ -0,0 +1,41 @@ +package com.fp.dto.json; + +import java.sql.Date; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; + +import net.sf.json.JsonConfig; +import net.sf.json.processors.JsonValueProcessor; + +public class DateValueProcessor implements JsonValueProcessor { + public static final String DATE_TRANSPORT = "yyyy-MM-dd"; + + public static final String TIMESTAMP_TRANSPORT = "yyyy-MM-dd HH:mm:ss"; + + @Override + public Object processArrayValue(Object value, JsonConfig jsonConfig) { + String data = ""; + if (value instanceof Date) { + SimpleDateFormat sdf = new SimpleDateFormat(DateValueProcessor.DATE_TRANSPORT); + data = sdf.format((java.util.Date) value); + } else if (value instanceof Timestamp) { + SimpleDateFormat sdf = new SimpleDateFormat(DateValueProcessor.TIMESTAMP_TRANSPORT); + data = sdf.format((java.util.Date) value); + } + return data; + } + + @Override + public Object processObjectValue(String key, Object value, JsonConfig jsonConfig) { + String data = ""; + if (value instanceof Date) { + SimpleDateFormat sdf = new SimpleDateFormat(DateValueProcessor.DATE_TRANSPORT); + data = sdf.format((Date) value); + } else if (value instanceof Timestamp) { + SimpleDateFormat sdf = new SimpleDateFormat(DateValueProcessor.TIMESTAMP_TRANSPORT); + data = sdf.format((Timestamp) value); + } + return data; + } + +} diff --git a/base/dto/common/src/main/java/com/fp/dto/json/ObjectValueProcessor.java b/base/dto/common/src/main/java/com/fp/dto/json/ObjectValueProcessor.java new file mode 100644 index 0000000..350c50c --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/dto/json/ObjectValueProcessor.java @@ -0,0 +1,28 @@ +package com.fp.dto.json; + +import java.math.BigDecimal; + +import net.sf.json.JSONArray; +import net.sf.json.JSONNull; +import net.sf.json.processors.DefaultValueProcessor; +import net.sf.json.util.JSONUtils; + +public class ObjectValueProcessor implements DefaultValueProcessor { + @SuppressWarnings("unchecked") + public Object getDefaultValue( Class type ) { + if( JSONUtils.isArray( type ) ){ + return new JSONArray(); + }else if( JSONUtils.isNumber( type ) ){ + if( JSONUtils.isDouble( type ) ){ + return new BigDecimal("0" ); + }else{ + return new Long( 0 ); + } + }else if( JSONUtils.isBoolean( type ) ){ + return Boolean.FALSE; + }else if( JSONUtils.isString( type ) ){ + return ""; + } + return JSONNull.getInstance(); + } + } \ No newline at end of file diff --git a/base/dto/common/src/main/java/com/fp/dto/json/Serializer.java b/base/dto/common/src/main/java/com/fp/dto/json/Serializer.java new file mode 100644 index 0000000..e70f5b3 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/dto/json/Serializer.java @@ -0,0 +1,346 @@ +package com.fp.dto.json; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.sf.ezmorph.Morpher; +import net.sf.ezmorph.MorpherRegistry; +import net.sf.ezmorph.bean.MorphDynaBean; +import net.sf.json.JSONObject; +import net.sf.json.JsonConfig; +import net.sf.json.util.JSONUtils; +import net.sf.json.xml.XMLSerializer; + +import org.apache.commons.beanutils.DynaProperty; +import org.apache.commons.beanutils.PropertyUtils; + +import com.fp.common.helper.BeanManager; +import com.fp.common.logger.APPLogger; +import com.fp.dto.AbstractData; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Response; +import com.fp.dto.json.morpher.DateMorpher; +import com.fp.dto.json.morpher.TimestampMorpher; +import com.fp.dto.save.SaveBean; +import com.fp.dto.save.SaveRequest; + +public class Serializer { + + private Serializable data; + + private String json; + + private JSONObject jsonObj; + + private JsonConfig jsonConfig; + + private MorpherRegistry morpherRegistry; + + public Serializer(Serializable pData) throws Exception { + if (pData instanceof Response) { + ((Response) pData).changeAbstractBeanToMap(); + } + this.data = pData; + this.config(); + } + + public Serializer(String pXML, boolean pIndex) { + this("" + new XMLSerializer().read(pXML)); + } + + public Serializer(String pJSON) { + this.json = pJSON.trim(); + this.config(); + if ((this.json.charAt(0) == '"') && (this.json.charAt(this.json.length() - 1) == '"')) { + this.json = this.json.substring(1, this.json.length() - 1); + } + this.jsonObj = JSONObject.fromObject(this.json, this.jsonConfig); + } + + private void config() { + this.jsonConfig = new JsonConfig(); + this.jsonConfig.registerJsonValueProcessor(Date.class, new DateValueProcessor()); + this.jsonConfig.registerJsonValueProcessor(Timestamp.class, new DateValueProcessor()); + this.jsonConfig.registerDefaultValueProcessor(Double.class, new ObjectValueProcessor()); + this.morpherRegistry = JSONUtils.getMorpherRegistry(); + Morpher dynaMorpher = new TimestampMorpher(); + this.morpherRegistry.registerMorpher(dynaMorpher); + dynaMorpher = new DateMorpher(); + this.morpherRegistry.registerMorpher(dynaMorpher); + } + + /** + * Entrega un string en formato json. + * + * @return String + * @throws Exception + */ + public final String toJSON() throws Exception { + try { + JSONObject jsonData = JSONObject.fromObject(this.data, this.jsonConfig); + return jsonData.toString(); + } catch (Exception e) { + APPLogger.getLogger().error(e, e); + throw e; + } + } + + public String toXML() throws Exception { + try { + JSONObject jsonData = JSONObject.fromObject(this.data, this.jsonConfig); + XMLSerializer xml = new XMLSerializer(); + xml.setElementName("REGISTRO"); + xml.setObjectName("FP"); + xml.setTrimSpaces(true); + xml.setRemoveNamespacePrefixFromElements(true); + xml.setSkipWhitespace(true); + xml.setSkipNamespaces(true); + String sXML = xml.write(jsonData); + while (sXML.indexOf("null=\"true\"/>") > 0) { + String aux1 = sXML.substring(0, sXML.indexOf("null=\"true\"/>")); + String aux2 = sXML.substring(sXML.indexOf("null=\"true\"/>") + 13); + sXML = aux1.substring(0, aux1.lastIndexOf("<")) + aux2; + } + return sXML; + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @SuppressWarnings("unchecked") + public Object toObject(Class pType) throws Exception { + Object obj = JSONObject.toBean(this.jsonObj, pType); + if (obj instanceof Map) { + Map m = (Map) obj; + if (!m.containsKey("transportBeanClass")) { + m.put("transportBeanClass", pType.getName()); + } + // m=this.correctMap(m); + obj = this.manageMapBean(m); + } + + return obj; + } + + @SuppressWarnings("unchecked") + public T toObjectGenerics(T pType) throws Exception { + T obj = (T) JSONObject.toBean(this.jsonObj, pType.getClass()); + if (obj instanceof Map) { + Map m = (Map) obj; + if (!m.containsKey("transportBeanClass")) { + m.put("transportBeanClass", pType.getClass().getName()); + } + // m=this.correctMap(m); + obj = (T) this.manageMapBean(m); + } + + return obj; + } + + private List manageList(List pList) throws ClassNotFoundException, InstantiationException, IllegalAccessException, + InvocationTargetException, NoSuchMethodException, ParseException { + List dataList = new ArrayList(); + for (Object obj : pList) { + dataList.add(this.manageValue(obj, null)); + } + return dataList; + } + + @SuppressWarnings("unchecked") + private Object manageValue(Object pObject, Class pType) throws ClassNotFoundException, InstantiationException, IllegalAccessException, + InvocationTargetException, NoSuchMethodException, ParseException { + if (pObject == null) { + return null; + } + if (pObject instanceof String) { + if (((String) pObject).compareTo("null") == 0) { + return null; + } + } + if (pObject instanceof JSONObject) { + JSONObject obj = (JSONObject) pObject; + if (obj.isNullObject()) { + return null; + } + } + if (pType != null) { + // System.out.println(pObject+" "+"->"+pType.getName()); + return BeanManager.convertObject(pObject, pType); + } + if (pObject instanceof Double) { + return new BigDecimal("" + pObject); + } + if (pObject instanceof Map) { + Map m = (Map) pObject;// this.correctMap((Map)pObject); + return this.manageMapBean(m); + } + if (pObject instanceof MorphDynaBean) { + return this.manageBean((MorphDynaBean) pObject); + } + if (pObject instanceof List) { + return this.manageList((List) pObject); + } + if (pObject instanceof String) { + String sObj = (String) pObject; + if (sObj.length() == DateValueProcessor.DATE_TRANSPORT.length()) { + try { + return new Date(new SimpleDateFormat(DateValueProcessor.DATE_TRANSPORT).parse(sObj).getTime()); + } catch (Exception e) { + } + } + if (sObj.length() == DateValueProcessor.TIMESTAMP_TRANSPORT.length()) { + try { + return new Timestamp(new SimpleDateFormat(DateValueProcessor.TIMESTAMP_TRANSPORT).parse(sObj).getTime()); + } catch (Exception e) { + } + } + return pObject; + } + return pObject; + } + + @SuppressWarnings("unchecked") + private Object manageBean(MorphDynaBean pMorphDynaBean) throws ClassNotFoundException, InstantiationException, IllegalAccessException, + InvocationTargetException, NoSuchMethodException { + DynaProperty[] prop = pMorphDynaBean.getDynaClass().getDynaProperties(); + Map mapBean = new HashMap(); + for (DynaProperty dynaProperty : prop) { + String name = dynaProperty.getName(); + mapBean.put(name, pMorphDynaBean.get(name)); + } + if (!mapBean.containsKey("transportBeanClass")) { + mapBean.put("transportBeanClass", "java.util.HashMap"); + } + return this.manageMapBean(mapBean); + } + + private String correctType(String pType) { + if (pType.compareTo("java.util.List") == 0) { + return "java.util.ArrayList"; + } + if (pType.compareTo("java.util.Map") == 0) { + return "java.util.HashMap"; + } + return pType; + } + + @SuppressWarnings("unchecked") + private Object manageMapBean(Map pMapBean) throws ClassNotFoundException, InstantiationException, IllegalAccessException, + InvocationTargetException, NoSuchMethodException { + String classType = (String) pMapBean.get("transportBeanClass"); + if (classType == null) { + return pMapBean; + } + classType = this.correctType(classType); + Object obj = Class.forName(classType).newInstance(); + Set keys = pMapBean.keySet(); + for (Object key : keys) { + String name = (String) key; + if (name.compareTo("transportBeanClass") == 0) { + continue; + } + try { + Class type = PropertyUtils.getPropertyType(obj, name); + try { + + if (type.getPackage().getName().compareTo("java.util") == 0) { + type = null; + } + } catch (Exception e) { + } + Object value = this.manageValue(pMapBean.get(name), type); + try { + // PropertyUtils.setProperty(obj, name, value); + if (classType.compareTo("java.util.HashMap") == 0) { + ((Map) obj).put(name, value); + } else { + if (value instanceof MorphDynaBean) { + value = this.manageBean((MorphDynaBean) value); + } + if (value instanceof Map) { + value = this.manageMapBean((Map) value); + } + BeanManager.setBeanAttributeValue(obj, name, + BeanManager.convertObject(value, BeanManager.getBeanGetterMethod(obj, name).getReturnType())); + } + } catch (Exception eadd) { + if (name.indexOf("transportBeanClass") > 0) { + String prop = name.replaceAll("_transportBeanClass", ""); + Object objProp = this.prepareBean(prop, (String) value, pMapBean); + try { + // PropertyUtils.setProperty(obj, prop, objProp); + BeanManager.setBeanAttributeValue(obj, prop, + BeanManager.convertObject(objProp, BeanManager.getBeanGetterMethod(obj, prop).getReturnType())); + } catch (Exception e) { + try { + AbstractData dt = (AbstractData) obj; + dt.addAddtionalInfo(prop, objProp); + } catch (Exception e1) { + } + } + } else { + try { + if ((obj instanceof SaveRequest) && (value instanceof SaveBean)) { + ((SaveRequest) obj).putSaveBean(((SaveBean) value).getBeanAlias(), value); + } else { + //JVC 22 octubre 2012 todo el if + if(obj instanceof AbstractDataTransport){ + ((AbstractDataTransport)obj).put(name, value); + }else{ + AbstractData dt = (AbstractData) obj; + dt.addAddtionalInfo(name, value); + } + + } + } catch (Exception e1) { + } + } + } + } catch (Exception e) { + e.printStackTrace(); + continue; + } + } + return obj; + } + + @SuppressWarnings("unchecked") + private Object prepareBean(String pPrefix, String pClass, Map pMapBean) throws ClassNotFoundException, InstantiationException, + IllegalAccessException { + Class c = Class.forName(pClass); + Object obj = c.newInstance(); + Field[] fs = c.getDeclaredFields(); + for (Field field : fs) { + try { + String name = field.getName(); + if (name.compareTo("serialVersionUID") == 0) { + continue; + } + Object val = null; + try { + val = pMapBean.get(pPrefix + "_" + name); + } catch (Exception e1) { + continue; + } + BeanManager.setBeanAttributeValue(obj, name, + BeanManager.convertObject(val, BeanManager.getBeanGetterMethod(obj, name).getReturnType())); + } catch (Exception e) { + APPLogger.getLogger().debug(e); + continue; + } + } + return obj; + } +} diff --git a/base/dto/common/src/main/java/com/fp/dto/json/morpher/.svn/entries b/base/dto/common/src/main/java/com/fp/dto/json/morpher/.svn/entries new file mode 100644 index 0000000..a60f427 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/dto/json/morpher/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/dto/json/morpher +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TimestampMorpher.java +file + + + + +2022-07-28T03:40:34.539768Z +85e0e0445957e6c1aab96a0a46cd2586 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +660 + +DateMorpher.java +file + + + + +2022-07-28T03:40:34.539768Z +b8f365e8aaba103cf025b5f3ab9555d3 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +625 + diff --git a/base/dto/common/src/main/java/com/fp/dto/json/morpher/.svn/text-base/DateMorpher.java.svn-base b/base/dto/common/src/main/java/com/fp/dto/json/morpher/.svn/text-base/DateMorpher.java.svn-base new file mode 100644 index 0000000..a74f166 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/dto/json/morpher/.svn/text-base/DateMorpher.java.svn-base @@ -0,0 +1,29 @@ +package com.fp.dto.json.morpher; + +import java.sql.Date; +import java.text.SimpleDateFormat; + +import com.fp.dto.json.DateValueProcessor; + +import net.sf.ezmorph.object.AbstractObjectMorpher; + +public class DateMorpher extends AbstractObjectMorpher { + + public Object morph(Object pValue) { + if(pValue instanceof Date){ + return (Date)pValue; + } + try{ + if(pValue instanceof String){ + return new Date( new SimpleDateFormat(DateValueProcessor.DATE_TRANSPORT).parse((String)pValue).getTime()); + } + }catch(Exception e){} + return null; + } + + @SuppressWarnings("unchecked") + public Class morphsTo() { + return Date.class; + } + +} diff --git a/base/dto/common/src/main/java/com/fp/dto/json/morpher/.svn/text-base/TimestampMorpher.java.svn-base b/base/dto/common/src/main/java/com/fp/dto/json/morpher/.svn/text-base/TimestampMorpher.java.svn-base new file mode 100644 index 0000000..254e057 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/dto/json/morpher/.svn/text-base/TimestampMorpher.java.svn-base @@ -0,0 +1,29 @@ +package com.fp.dto.json.morpher; + +import java.sql.Timestamp; +import java.text.SimpleDateFormat; + +import net.sf.ezmorph.object.AbstractObjectMorpher; + +import com.fp.dto.json.DateValueProcessor; + +public class TimestampMorpher extends AbstractObjectMorpher { + + public Object morph(Object pValue) { + if(pValue instanceof Timestamp){ + return (Timestamp)pValue; + } + try{ + if(pValue instanceof String){ + return new Timestamp( new SimpleDateFormat(DateValueProcessor.TIMESTAMP_TRANSPORT).parse((String)pValue).getTime()); + } + }catch(Exception e){} + return null; + } + + @SuppressWarnings("unchecked") + public Class morphsTo() { + return Timestamp.class; + } + +} diff --git a/base/dto/common/src/main/java/com/fp/dto/json/morpher/DateMorpher.java b/base/dto/common/src/main/java/com/fp/dto/json/morpher/DateMorpher.java new file mode 100644 index 0000000..a74f166 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/dto/json/morpher/DateMorpher.java @@ -0,0 +1,29 @@ +package com.fp.dto.json.morpher; + +import java.sql.Date; +import java.text.SimpleDateFormat; + +import com.fp.dto.json.DateValueProcessor; + +import net.sf.ezmorph.object.AbstractObjectMorpher; + +public class DateMorpher extends AbstractObjectMorpher { + + public Object morph(Object pValue) { + if(pValue instanceof Date){ + return (Date)pValue; + } + try{ + if(pValue instanceof String){ + return new Date( new SimpleDateFormat(DateValueProcessor.DATE_TRANSPORT).parse((String)pValue).getTime()); + } + }catch(Exception e){} + return null; + } + + @SuppressWarnings("unchecked") + public Class morphsTo() { + return Date.class; + } + +} diff --git a/base/dto/common/src/main/java/com/fp/dto/json/morpher/TimestampMorpher.java b/base/dto/common/src/main/java/com/fp/dto/json/morpher/TimestampMorpher.java new file mode 100644 index 0000000..254e057 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/dto/json/morpher/TimestampMorpher.java @@ -0,0 +1,29 @@ +package com.fp.dto.json.morpher; + +import java.sql.Timestamp; +import java.text.SimpleDateFormat; + +import net.sf.ezmorph.object.AbstractObjectMorpher; + +import com.fp.dto.json.DateValueProcessor; + +public class TimestampMorpher extends AbstractObjectMorpher { + + public Object morph(Object pValue) { + if(pValue instanceof Timestamp){ + return (Timestamp)pValue; + } + try{ + if(pValue instanceof String){ + return new Timestamp( new SimpleDateFormat(DateValueProcessor.TIMESTAMP_TRANSPORT).parse((String)pValue).getTime()); + } + }catch(Exception e){} + return null; + } + + @SuppressWarnings("unchecked") + public Class morphsTo() { + return Timestamp.class; + } + +} diff --git a/base/dto/common/src/main/java/com/fp/excel/.svn/entries b/base/dto/common/src/main/java/com/fp/excel/.svn/entries new file mode 100644 index 0000000..f8abc07 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/excel/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/excel +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ExcelToMap.java +file + + + + +2022-07-28T03:40:35.704773Z +ef7fc74d3c41a48812afe916b7ec836c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9154 + +WorkbookFactory.java +file + + + + +2022-07-28T03:40:35.705773Z +5e2b4471a1c01463536547eba1d2bbf0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3543 + +WorkbookFactoryStreamBytes.java +file + + + + +2022-07-28T03:40:35.705773Z +fb30329d5f5330505bc871e8f47a2bf0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3194 + +ExcelToMapMessages.java +file + + + + +2022-07-28T03:40:35.705773Z +113a530893ef95cc785e10ce8e376b93 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1345 + +XLSXUtil.java +file + + + + +2022-07-28T03:40:35.705773Z +7a9b4689a7d1ab88a5a687ff0a8ea923 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +10514 + +FormulaManage.java +file + + + + +2022-07-28T03:40:35.706773Z +120d53ded146012cf8b1e9730d074390 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +84 + diff --git a/base/dto/common/src/main/java/com/fp/excel/.svn/text-base/ExcelToMap.java.svn-base b/base/dto/common/src/main/java/com/fp/excel/.svn/text-base/ExcelToMap.java.svn-base new file mode 100644 index 0000000..a3fbd29 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/excel/.svn/text-base/ExcelToMap.java.svn-base @@ -0,0 +1,201 @@ +package com.fp.excel; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellValue; +import org.apache.poi.ss.usermodel.DateUtil; +import org.apache.poi.ss.usermodel.FormulaEvaluator; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; + +/** + * + * @author malmeida + */ +public class ExcelToMap implements ExcelToMapMessages { + + private WorkbookFactory wf; + private WorkbookFactoryStreamBytes wfsb; + + public ExcelToMap(String file_Path) { + this.wf = new WorkbookFactory(file_Path); + } + + /** + * + * @param arrayBytesExcel + * @param extension + */ + public ExcelToMap(byte[] arrayBytesExcel, String extension) { + this.wfsb = new WorkbookFactoryStreamBytes(arrayBytesExcel, extension); + } + + /** + * + * @return + */ + public String get_Workbook_Status() { + return this.wf.get_WorkbookFactory_Status(); + } + + public String getWorkbookStatusByte() { + return this.wfsb.getWorkbookFactoryStatus(); + } + + /** + * + * @return + */ + public Map getExcelMap() { + String workbookStatus = this.wfsb.getWorkbookFactoryStatus(); + if (workbookStatus.equals(ExcelToMapMessages.WORKBOOK_CREATED)) { + Workbook wb = wfsb.getExcelWorkBook(); + FormulaEvaluator fev = wb.getCreationHelper().createFormulaEvaluator(); + int activeSheetIndex = wb.getActiveSheetIndex(); + String activeSheetName = wb.getSheetName(activeSheetIndex); + Sheet activeSheet = wb.getSheet(activeSheetName); + Map cellList = new HashMap(); + for (Row row : activeSheet) { + for (Cell cell : row) { + int cell_Row_Index = cell.getRowIndex(); + int cell_Colum_Index = cell.getColumnIndex(); + String MapKey = "" + cell_Row_Index + ":" + cell_Colum_Index; + switch (cell.getCellType()) { + case Cell.CELL_TYPE_BOOLEAN: +// System.out.println(MapKey); + String cell_value_boolean_str = cell.getStringCellValue(); + Object bool_obj = Boolean.parseBoolean(cell_value_boolean_str); + cellList.put(MapKey, bool_obj); + break; + case Cell.CELL_TYPE_NUMERIC: + if (DateUtil.isCellDateFormatted(cell)) { +// System.out.println(MapKey); + Date cellValue_date = cell.getDateCellValue(); + long cellValue_long = cellValue_date.getTime(); + java.sql.Date sqlDate = new java.sql.Date(cellValue_long); + Object date_obj = sqlDate; + cellList.put(MapKey, date_obj); + } else { +// System.out.println(MapKey); + double cellValue_double = cell.getNumericCellValue(); + Object cell_value_bd = new BigDecimal(cellValue_double); + cellList.put(MapKey, cell_value_bd); + } + break; + case Cell.CELL_TYPE_STRING: +// System.out.println(MapKey); + Object cell_value_str = cell.getStringCellValue(); + cellList.put(MapKey, cell_value_str); + break; + case Cell.CELL_TYPE_BLANK: +// System.out.println(MapKey); + Object cell_value_blank_str = ""; + cellList.put(MapKey, cell_value_blank_str); + break; + case Cell.CELL_TYPE_ERROR: +// System.out.println(MapKey); + Object cell_value_error_str = ""; + cellList.put(MapKey, cell_value_error_str); + break; + case Cell.CELL_TYPE_FORMULA: +// System.out.println(MapKey); + CellValue cellValue = fev.evaluate(cell); + + switch (cellValue.getCellType()) { + case Cell.CELL_TYPE_BOOLEAN: +// System.out.println(MapKey); + String cell_value_boolean_f_str = cell.getStringCellValue(); + Object cell_value_boolean_f = Boolean.parseBoolean(cell_value_boolean_f_str); + cellList.put(MapKey, cell_value_boolean_f); + break; + case Cell.CELL_TYPE_NUMERIC: + if (DateUtil.isCellDateFormatted(cell)) { +// System.out.println(MapKey); + Date cellValue_date = cell.getDateCellValue(); + long cellValue_long = cellValue_date.getTime(); + java.sql.Date sqlDate = new java.sql.Date(cellValue_long); + Object date_obj = sqlDate; + cellList.put(MapKey, date_obj); + } else { +// System.out.println(MapKey); + double cellValue_double = cell.getNumericCellValue(); + Object cell_value_bd = new BigDecimal(cellValue_double); + cellList.put(MapKey, cell_value_bd); + } + break; + case Cell.CELL_TYPE_STRING: +// System.out.println(MapKey); + Object cell_value_str_f = cell.getStringCellValue(); + cellList.put(MapKey, cell_value_str_f); + break; + case Cell.CELL_TYPE_BLANK: +// System.out.println(MapKey); + Object cell_value_blank_str_f = ""; + cellList.put(MapKey, cell_value_blank_str_f); + break; + case Cell.CELL_TYPE_ERROR: +// System.out.println(MapKey); + Object cell_value_error_str_f = ""; + cellList.put(MapKey, cell_value_error_str_f); + break; + case Cell.CELL_TYPE_FORMULA: +// NUNCA OCURRE + break; + default: +// System.out.println(MapKey); + Object cell_value_indeterminado_str_f = ""; + cellList.put(MapKey, cell_value_indeterminado_str_f); + break; + } + break; + default: +// System.out.println(MapKey); + Object cell_value_indeterminado_str = ""; + cellList.put(MapKey, cell_value_indeterminado_str); + break; + } + } + } + return cellList; + } else { + return null; + } + } + + /** + * + * @param fila_init + * @param fila_final + * @param colum_init + * @param colum_final + * @return + */ + public List> get_Especific_Data(int fila_init, int fila_final, int colum_init, int colum_final) { + Map cell_list = this.getExcelMap(); + List> ldata = new ArrayList>(); + for (int i = fila_init; i <= fila_final; i++) { + Map m = new HashMap(); + for (int j = colum_init; j <= colum_final; j++) { + String Key = "" + i + ":" + j; + if (cell_list.containsKey(Key)) { + Object obj = cell_list.get(Key); + m.put(Key, obj); +// System.out.println(obj.toString()); + } else { + Object obj = "blank"; + m.put(Key, obj); +// System.out.println(obj.toString()); + } + } + ldata.add(m); + } + + return ldata; + } +} diff --git a/base/dto/common/src/main/java/com/fp/excel/.svn/text-base/ExcelToMapMessages.java.svn-base b/base/dto/common/src/main/java/com/fp/excel/.svn/text-base/ExcelToMapMessages.java.svn-base new file mode 100644 index 0000000..c8d6197 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/excel/.svn/text-base/ExcelToMapMessages.java.svn-base @@ -0,0 +1,45 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.excel; + +/** + * + * @author malmeida + */ +public interface ExcelToMapMessages { + + public final String DIRECTORY_PATH = "C:/BlueNova/Proyectos Bupartech/Netbeans Workspace/MAIA Transformer releases/MAIAWorkbookFactoryApp"; + + public final String FILE_PATH = "IncomeStatements.xlsx"; + +// public final String FILE_PATH = "IncomeStatements.xls"; + + public final String FILE_NOT_FOUND = "Libro de excel no existe en el directorio especificado: WorkbookFactory"; + + public final String INPUT_STREAM_CREATED = "Creado el flujo para el libro de excel: WorkbookFactory"; + + public final String WORKBOOK_NOT_CREATED = "No se pudo crear el libro de excel: WorkbookFactory"; + + public final String WORKBOOK_CREATED = "Libro excel creado: WorkbookFactory"; + + public final String ROW_TITLE = "Row_title"; + + public final String ROW_HEADER = "Row_header"; + + public final String ROW_DATA = "Row_data"; + + public final int CELL_NUMERIC_DATA_TYPE = 0; + + public final int CELL_STRING_DATA_TYPE = 1; + + public final int CELL_DATE_DATA_TYPE = 2; + + public final int CELL_BOOLEAN_DATA_TYPE = 3; + + public final int CELL_FORMULA_DATA_TYPE = 4; + + + +} diff --git a/base/dto/common/src/main/java/com/fp/excel/.svn/text-base/FormulaManage.java.svn-base b/base/dto/common/src/main/java/com/fp/excel/.svn/text-base/FormulaManage.java.svn-base new file mode 100644 index 0000000..24be953 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/excel/.svn/text-base/FormulaManage.java.svn-base @@ -0,0 +1,5 @@ +package com.fp.excel; + +public enum FormulaManage { + CacheValue, Formula, None; +} diff --git a/base/dto/common/src/main/java/com/fp/excel/.svn/text-base/WorkbookFactory.java.svn-base b/base/dto/common/src/main/java/com/fp/excel/.svn/text-base/WorkbookFactory.java.svn-base new file mode 100644 index 0000000..3f30bc5 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/excel/.svn/text-base/WorkbookFactory.java.svn-base @@ -0,0 +1,139 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.excel; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.StringTokenizer; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +/** + * + * @author malmeida + */ +public class WorkbookFactory implements ExcelToMapMessages { + + private InputStream inp; + + private String file_path, workbookFactoryStatus, file_extension; + + private Workbook wb; + + public WorkbookFactory(String file_Path){ + + this.file_path = file_Path; + + this.workbookFactoryStatus = null; + + this.inp = this.input_Stream_Builder(this.file_path); + + this.wb = this.excel_Workbook_Builder(); + + this.file_extension = null; + + } + + private InputStream input_Stream_Builder(String file_Path){ + + try { + + InputStream inpm = new FileInputStream(file_Path); + + this.workbookFactoryStatus = WorkbookFactory.INPUT_STREAM_CREATED; + + return inpm; + + } catch (FileNotFoundException ex) { + + this.workbookFactoryStatus = WorkbookFactory.FILE_NOT_FOUND; + + return null; + + } + + } + + private Workbook excel_Workbook_Builder (){ + + if(this.workbookFactoryStatus.equals(WorkbookFactory.FILE_NOT_FOUND)){ + + this.workbookFactoryStatus = WorkbookFactory.WORKBOOK_NOT_CREATED; + + return null; + + }else{ + + Workbook wbm = null; + + try { + + this.file_extension = this.get_Workbook_Extension(this.file_path); + + if(this.file_extension.equals("xls")){ + + wbm = new HSSFWorkbook(this.inp); + } + + if(this.file_extension.equals("xlsx")){ + + wbm = new XSSFWorkbook(this.inp); + + } + + this.workbookFactoryStatus = WorkbookFactory.WORKBOOK_CREATED; + + return wbm; + + } catch (IOException ex) { + + this.workbookFactoryStatus = WorkbookFactory.WORKBOOK_NOT_CREATED; + + return null; + + }catch (Exception ex) { + + this.workbookFactoryStatus = WorkbookFactory.WORKBOOK_NOT_CREATED; + + return null; + + } + + } + + } + + private String get_Workbook_Extension(String file_path){ + + StringTokenizer tkn = new StringTokenizer(file_path,"."); + + String fe = null; + + while (tkn.hasMoreTokens()){ + + fe = tkn.nextToken(); + + } + + return fe; + + } + + public String get_WorkbookFactory_Status(){ + + return this.workbookFactoryStatus; + + } + + public Workbook get_ExcelWorkBook(){ + + return this.wb; + + } + +} diff --git a/base/dto/common/src/main/java/com/fp/excel/.svn/text-base/WorkbookFactoryStreamBytes.java.svn-base b/base/dto/common/src/main/java/com/fp/excel/.svn/text-base/WorkbookFactoryStreamBytes.java.svn-base new file mode 100644 index 0000000..ba8c81d --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/excel/.svn/text-base/WorkbookFactoryStreamBytes.java.svn-base @@ -0,0 +1,109 @@ +package com.fp.excel; + +import java.io.ByteArrayInputStream; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.StringTokenizer; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +/** + * Clase que obtiene el archivo de excel a partir de un arreglo de bytes + * + * @author malmeida + */ +public class WorkbookFactoryStreamBytes implements ExcelToMapMessages { + + private InputStream inp; + private String workbookFactoryStatus, file_extension, extension; + private Workbook wb; + private byte[] arrayBytesExcel; + + /** + * + * @param arrayBytesExcel + * @param extension + */ + public WorkbookFactoryStreamBytes(byte[] arrayBytesExcel, String extension) { + this.workbookFactoryStatus = null; + this.arrayBytesExcel = arrayBytesExcel; + this.inp = inputStreamBuilder(this.arrayBytesExcel); + this.extension = extension; + this.wb = this.excelWorkbookBuilder(this.extension); + } + + /** + * + * @param arrayBytesExcel + * @return + */ + private InputStream inputStreamBuilder(byte[] arrayBytesExcel) { + try { + InputStream inpm = new ByteArrayInputStream(arrayBytesExcel); + this.workbookFactoryStatus = WorkbookFactoryStreamBytes.INPUT_STREAM_CREATED; + return inpm; + } catch (Exception ex) { + this.workbookFactoryStatus = WorkbookFactoryStreamBytes.FILE_NOT_FOUND; + return null; + } + } + + /** + * + * @param fileExtension + * @return + */ + private Workbook excelWorkbookBuilder(String fileExtension) { + if (this.workbookFactoryStatus.equals(WorkbookFactoryStreamBytes.FILE_NOT_FOUND)) { + this.workbookFactoryStatus = WorkbookFactoryStreamBytes.WORKBOOK_NOT_CREATED; + return null; + } else { + Workbook wbm = null; + try { + this.file_extension = fileExtension; + if (this.file_extension.equals("xls")) { + wbm = new HSSFWorkbook(this.inp); + } + if (this.file_extension.equals("xlsx")) { + wbm = new XSSFWorkbook(this.inp); + } + this.workbookFactoryStatus = WorkbookFactoryStreamBytes.WORKBOOK_CREATED; + return wbm; + } catch (IOException ex) { + this.workbookFactoryStatus = WorkbookFactoryStreamBytes.WORKBOOK_NOT_CREATED; + return null; + } catch (Exception ex) { + this.workbookFactoryStatus = WorkbookFactoryStreamBytes.WORKBOOK_NOT_CREATED; + return null; + } + } + + } + + /** + * + * @return + */ + public String getWorkbookFactoryStatus() { + return this.workbookFactoryStatus; + } + + /** + * + * @return + */ + public String getWorkbookFactoryStatusByte() { + return this.workbookFactoryStatus; + } + + /** + * + * @return + */ + public Workbook getExcelWorkBook() { + return this.wb; + } +} \ No newline at end of file diff --git a/base/dto/common/src/main/java/com/fp/excel/.svn/text-base/XLSXUtil.java.svn-base b/base/dto/common/src/main/java/com/fp/excel/.svn/text-base/XLSXUtil.java.svn-base new file mode 100644 index 0000000..e359fd8 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/excel/.svn/text-base/XLSXUtil.java.svn-base @@ -0,0 +1,287 @@ +package com.fp.excel; + +import java.io.InputStream; +import java.io.OutputStream; +import java.math.BigDecimal; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.NoSuchElementException; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.DataFormat; +import org.apache.poi.ss.usermodel.Font; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFCellStyle; +import org.apache.poi.xssf.usermodel.XSSFColor; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import com.fp.common.helper.BeanManager; + +public class XLSXUtil { + + private Workbook book; + + public Workbook getBook() { + return this.book; + } + private Sheet sheet; + private int sheetIndex; + private int maxSheets; + private int index; + + public XLSXUtil() { + this.book = new XSSFWorkbook(); + this.sheet = this.book.createSheet(); + this.index = 0; + } + + public XLSXUtil(InputStream pIn) throws Exception { + this.book = new XSSFWorkbook(pIn); + this.maxSheets = this.book.getNumberOfSheets(); + this.sheet = this.book.getSheetAt(0); + this.index = 0; + } + + public void addRecord(Object[] pRecord, String styleRow) throws Exception { + + CellStyle style = (styleRow.equals("H"))?this.createStyle(this.book):null; + Row row = this.sheet.createRow(this.index++); + + for (int i = 0; i < pRecord.length; i++) { + Object object = pRecord[i]; + Cell cell = null; + if (object instanceof Number) { + cell = row.createCell(i, Cell.CELL_TYPE_NUMERIC); + cell.setCellValue(BeanManager.convertObject(object, BigDecimal.class).doubleValue()); + cell.setCellStyle(style); + } + if (object instanceof Date) { + cell = row.createCell(i); + CellStyle styleDate = this.book.createCellStyle(); + DataFormat fmt = this.book.createDataFormat(); + styleDate.setDataFormat(fmt.getFormat("yyyy-MM-dd")); + cell.setCellStyle(styleDate); + cell.setCellValue((Date) object); + } + if (cell == null) { + cell = row.createCell(i, Cell.CELL_TYPE_STRING); + cell.setCellValue(BeanManager.convertObject(object, String.class)); + cell.setCellStyle(style); + } + + } + } + + public Map> readSheet() { + Map> data = new HashMap>(); + for (int i = this.sheet.getFirstRowNum(); i <= this.sheet.getLastRowNum(); i++) { + Map record = this.manageRecord(i); + data.put(i, record); + } + return data; + } + + public Map manageRecord(int pIndex) { + return this.manageRecord(pIndex, -1, FormulaManage.None); + } + + public Map manageRecord(int pIndex, int pEnd, FormulaManage pManage) { + Map record = new HashMap(); + Row r = this.sheet.getRow(pIndex); + if (r == null) { + return record; + } + Iterator ic = r.cellIterator(); + while (ic.hasNext()) { + Cell c = ic.next(); + if ((c.getColumnIndex() > pEnd) && (pEnd > 0)) { + break; + } + Object value = this.manageCell(c,pManage);//(pManage==FormulaManage.None)?this.manageCell(c, pManage):this.manageCellValue(c); + if (value == null) { + continue; + } + record.put(c.getColumnIndex(), value); + } + return record; + } + + public Map manageRecordForm(int pIndex, int pInit, int pEnd, FormulaManage pManage) { + Map record = new HashMap(); + Row r = this.sheet.getRow(pIndex); + if (r == null) { + return record; + } + for (Cell c : r) { + if (c.getColumnIndex() >= pInit && c.getColumnIndex() < pEnd) { + Object value = this.manageCellValue(c); + if (value == null) { + continue; + } + record.put(c.getColumnIndex(), value); + } else if (c.getColumnIndex() >= pEnd) { + break; + } + } + return record; + } + + private Object manageCell(Cell pCell, FormulaManage pManage) { + Object val = null; + switch (pCell.getCellType()) { + case Cell.CELL_TYPE_NUMERIC: + val = Math.round(pCell.getNumericCellValue() * 100) / 100d; + break; + case Cell.CELL_TYPE_STRING: + val = pCell.getStringCellValue(); + val = pCell.getRichStringCellValue(); + break; + case Cell.CELL_TYPE_BLANK: + val = pCell.getStringCellValue(); + break; + case Cell.CELL_TYPE_FORMULA: + /* + * FormulaEvaluator evaluator = this.book.getCreationHelper().createFormulaEvaluator(); try { CellValue + * cellValue = evaluator.evaluate(pCell); switch (cellValue.getCellType()) { case Cell.CELL_TYPE_NUMERIC: + * val = cellValue.getNumberValue(); break; case Cell.CELL_TYPE_STRING: val = cellValue.getStringValue(); + * break; case Cell.CELL_TYPE_BOOLEAN: val = cellValue.getBooleanValue(); break; case Cell.CELL_TYPE_ERROR: + * val = cellValue.getErrorValue(); break; default: val = pCell.getCellFormula(); } } catch (Exception e) { + * val = pCell.getCellFormula(); break; } + */ + if (pManage == FormulaManage.None) { + val = null; + break; + } + if (pManage == FormulaManage.Formula) { + val = pCell.getCellFormula(); + break; + } + switch (pCell.getCachedFormulaResultType()) { + case Cell.CELL_TYPE_NUMERIC: + val = pCell.getNumericCellValue(); + break; + case Cell.CELL_TYPE_STRING: + val = pCell.getRichStringCellValue(); + break; + default: + val = pCell.getCellFormula(); + // throw new IllegalArgumentException(); + } + + break; + case Cell.CELL_TYPE_BOOLEAN: + val = pCell.getBooleanCellValue(); + break; + case Cell.CELL_TYPE_ERROR: + val = pCell.getErrorCellValue(); + break; + } + return val; + } + + /** + * Entrega el valor de la celda + * @param pCell Cell + * @return value Object + */ + private Object manageCellValue(Cell pCell) { + Object val = null; + double value=0; + switch (pCell.getCellType()) { + case Cell.CELL_TYPE_NUMERIC: + value=pCell.getNumericCellValue(); + val = Math.round(value * 100) / 100d; + break; + case Cell.CELL_TYPE_STRING: + val = pCell.getStringCellValue(); + break; + case Cell.CELL_TYPE_BLANK: + val = null; + break; + case Cell.CELL_TYPE_FORMULA: + + switch (pCell.getCachedFormulaResultType()) { + case Cell.CELL_TYPE_NUMERIC: + value=pCell.getNumericCellValue(); + val = Math.round(value * 100) / 100d; + break; + case Cell.CELL_TYPE_STRING: + val=pCell.getRichStringCellValue(); + val=pCell.getStringCellValue(); +// val = pCell.getRichStringCellValue(); + break; + case Cell.CELL_TYPE_BLANK: + val = null; + break; + case Cell.CELL_TYPE_ERROR: + val = null; + break; + default: + val=null; +// val = pCell.getCellFormula(); + } + + break; + case Cell.CELL_TYPE_BOOLEAN: + val = pCell.getBooleanCellValue(); + break; + case Cell.CELL_TYPE_ERROR: + val = pCell.getErrorCellValue(); + break; + } + return val; + } + + public void save(OutputStream pOut) throws Exception { + this.book.write(pOut); + } + + public String getSheetName() { + return this.sheet.getSheetName(); + } + + public void nextSheet() { + if (this.sheetIndex >= this.maxSheets) { + throw new NoSuchElementException(); + } + this.sheet = this.book.getSheetAt(++this.sheetIndex); + this.index = 0; + } + + public void goSheet(String pName) { + int ind = this.book.getSheetIndex(pName); + if ((ind < 0) || (ind >= this.maxSheets)) { + throw new NoSuchElementException(); + } + this.sheet = this.book.getSheetAt(ind); + this.index = 0; + } + + private CellStyle createStyle(Workbook wb){ + CellStyle style = wb.createCellStyle(); + style.setBorderRight(CellStyle.BORDER_THIN); + style.setRightBorderColor(IndexedColors.GREY_80_PERCENT.getIndex()); + style.setBorderBottom(CellStyle.BORDER_THIN); + style.setBottomBorderColor(IndexedColors.GREY_80_PERCENT.getIndex()); + style.setBorderLeft(CellStyle.BORDER_THIN); + style.setLeftBorderColor(IndexedColors.GREY_80_PERCENT.getIndex()); + style.setBorderTop(CellStyle.BORDER_THIN); + style.setTopBorderColor(IndexedColors.GREY_80_PERCENT.getIndex()); + + Font header2Font = wb.createFont(); + header2Font.setColor(IndexedColors.WHITE.getIndex()); + XSSFCellStyle style_h_2 = (XSSFCellStyle) style; + style_h_2.setAlignment(CellStyle.ALIGN_CENTER); + style_h_2.setFillForegroundColor(new XSSFColor(new java.awt.Color(86, 142, 213))); + style_h_2.setFillPattern(CellStyle.SOLID_FOREGROUND); + style_h_2.setFont(header2Font); + + return style_h_2; + } +} diff --git a/base/dto/common/src/main/java/com/fp/excel/ExcelToMap.java b/base/dto/common/src/main/java/com/fp/excel/ExcelToMap.java new file mode 100644 index 0000000..a3fbd29 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/excel/ExcelToMap.java @@ -0,0 +1,201 @@ +package com.fp.excel; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellValue; +import org.apache.poi.ss.usermodel.DateUtil; +import org.apache.poi.ss.usermodel.FormulaEvaluator; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; + +/** + * + * @author malmeida + */ +public class ExcelToMap implements ExcelToMapMessages { + + private WorkbookFactory wf; + private WorkbookFactoryStreamBytes wfsb; + + public ExcelToMap(String file_Path) { + this.wf = new WorkbookFactory(file_Path); + } + + /** + * + * @param arrayBytesExcel + * @param extension + */ + public ExcelToMap(byte[] arrayBytesExcel, String extension) { + this.wfsb = new WorkbookFactoryStreamBytes(arrayBytesExcel, extension); + } + + /** + * + * @return + */ + public String get_Workbook_Status() { + return this.wf.get_WorkbookFactory_Status(); + } + + public String getWorkbookStatusByte() { + return this.wfsb.getWorkbookFactoryStatus(); + } + + /** + * + * @return + */ + public Map getExcelMap() { + String workbookStatus = this.wfsb.getWorkbookFactoryStatus(); + if (workbookStatus.equals(ExcelToMapMessages.WORKBOOK_CREATED)) { + Workbook wb = wfsb.getExcelWorkBook(); + FormulaEvaluator fev = wb.getCreationHelper().createFormulaEvaluator(); + int activeSheetIndex = wb.getActiveSheetIndex(); + String activeSheetName = wb.getSheetName(activeSheetIndex); + Sheet activeSheet = wb.getSheet(activeSheetName); + Map cellList = new HashMap(); + for (Row row : activeSheet) { + for (Cell cell : row) { + int cell_Row_Index = cell.getRowIndex(); + int cell_Colum_Index = cell.getColumnIndex(); + String MapKey = "" + cell_Row_Index + ":" + cell_Colum_Index; + switch (cell.getCellType()) { + case Cell.CELL_TYPE_BOOLEAN: +// System.out.println(MapKey); + String cell_value_boolean_str = cell.getStringCellValue(); + Object bool_obj = Boolean.parseBoolean(cell_value_boolean_str); + cellList.put(MapKey, bool_obj); + break; + case Cell.CELL_TYPE_NUMERIC: + if (DateUtil.isCellDateFormatted(cell)) { +// System.out.println(MapKey); + Date cellValue_date = cell.getDateCellValue(); + long cellValue_long = cellValue_date.getTime(); + java.sql.Date sqlDate = new java.sql.Date(cellValue_long); + Object date_obj = sqlDate; + cellList.put(MapKey, date_obj); + } else { +// System.out.println(MapKey); + double cellValue_double = cell.getNumericCellValue(); + Object cell_value_bd = new BigDecimal(cellValue_double); + cellList.put(MapKey, cell_value_bd); + } + break; + case Cell.CELL_TYPE_STRING: +// System.out.println(MapKey); + Object cell_value_str = cell.getStringCellValue(); + cellList.put(MapKey, cell_value_str); + break; + case Cell.CELL_TYPE_BLANK: +// System.out.println(MapKey); + Object cell_value_blank_str = ""; + cellList.put(MapKey, cell_value_blank_str); + break; + case Cell.CELL_TYPE_ERROR: +// System.out.println(MapKey); + Object cell_value_error_str = ""; + cellList.put(MapKey, cell_value_error_str); + break; + case Cell.CELL_TYPE_FORMULA: +// System.out.println(MapKey); + CellValue cellValue = fev.evaluate(cell); + + switch (cellValue.getCellType()) { + case Cell.CELL_TYPE_BOOLEAN: +// System.out.println(MapKey); + String cell_value_boolean_f_str = cell.getStringCellValue(); + Object cell_value_boolean_f = Boolean.parseBoolean(cell_value_boolean_f_str); + cellList.put(MapKey, cell_value_boolean_f); + break; + case Cell.CELL_TYPE_NUMERIC: + if (DateUtil.isCellDateFormatted(cell)) { +// System.out.println(MapKey); + Date cellValue_date = cell.getDateCellValue(); + long cellValue_long = cellValue_date.getTime(); + java.sql.Date sqlDate = new java.sql.Date(cellValue_long); + Object date_obj = sqlDate; + cellList.put(MapKey, date_obj); + } else { +// System.out.println(MapKey); + double cellValue_double = cell.getNumericCellValue(); + Object cell_value_bd = new BigDecimal(cellValue_double); + cellList.put(MapKey, cell_value_bd); + } + break; + case Cell.CELL_TYPE_STRING: +// System.out.println(MapKey); + Object cell_value_str_f = cell.getStringCellValue(); + cellList.put(MapKey, cell_value_str_f); + break; + case Cell.CELL_TYPE_BLANK: +// System.out.println(MapKey); + Object cell_value_blank_str_f = ""; + cellList.put(MapKey, cell_value_blank_str_f); + break; + case Cell.CELL_TYPE_ERROR: +// System.out.println(MapKey); + Object cell_value_error_str_f = ""; + cellList.put(MapKey, cell_value_error_str_f); + break; + case Cell.CELL_TYPE_FORMULA: +// NUNCA OCURRE + break; + default: +// System.out.println(MapKey); + Object cell_value_indeterminado_str_f = ""; + cellList.put(MapKey, cell_value_indeterminado_str_f); + break; + } + break; + default: +// System.out.println(MapKey); + Object cell_value_indeterminado_str = ""; + cellList.put(MapKey, cell_value_indeterminado_str); + break; + } + } + } + return cellList; + } else { + return null; + } + } + + /** + * + * @param fila_init + * @param fila_final + * @param colum_init + * @param colum_final + * @return + */ + public List> get_Especific_Data(int fila_init, int fila_final, int colum_init, int colum_final) { + Map cell_list = this.getExcelMap(); + List> ldata = new ArrayList>(); + for (int i = fila_init; i <= fila_final; i++) { + Map m = new HashMap(); + for (int j = colum_init; j <= colum_final; j++) { + String Key = "" + i + ":" + j; + if (cell_list.containsKey(Key)) { + Object obj = cell_list.get(Key); + m.put(Key, obj); +// System.out.println(obj.toString()); + } else { + Object obj = "blank"; + m.put(Key, obj); +// System.out.println(obj.toString()); + } + } + ldata.add(m); + } + + return ldata; + } +} diff --git a/base/dto/common/src/main/java/com/fp/excel/ExcelToMapMessages.java b/base/dto/common/src/main/java/com/fp/excel/ExcelToMapMessages.java new file mode 100644 index 0000000..c8d6197 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/excel/ExcelToMapMessages.java @@ -0,0 +1,45 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.excel; + +/** + * + * @author malmeida + */ +public interface ExcelToMapMessages { + + public final String DIRECTORY_PATH = "C:/BlueNova/Proyectos Bupartech/Netbeans Workspace/MAIA Transformer releases/MAIAWorkbookFactoryApp"; + + public final String FILE_PATH = "IncomeStatements.xlsx"; + +// public final String FILE_PATH = "IncomeStatements.xls"; + + public final String FILE_NOT_FOUND = "Libro de excel no existe en el directorio especificado: WorkbookFactory"; + + public final String INPUT_STREAM_CREATED = "Creado el flujo para el libro de excel: WorkbookFactory"; + + public final String WORKBOOK_NOT_CREATED = "No se pudo crear el libro de excel: WorkbookFactory"; + + public final String WORKBOOK_CREATED = "Libro excel creado: WorkbookFactory"; + + public final String ROW_TITLE = "Row_title"; + + public final String ROW_HEADER = "Row_header"; + + public final String ROW_DATA = "Row_data"; + + public final int CELL_NUMERIC_DATA_TYPE = 0; + + public final int CELL_STRING_DATA_TYPE = 1; + + public final int CELL_DATE_DATA_TYPE = 2; + + public final int CELL_BOOLEAN_DATA_TYPE = 3; + + public final int CELL_FORMULA_DATA_TYPE = 4; + + + +} diff --git a/base/dto/common/src/main/java/com/fp/excel/FormulaManage.java b/base/dto/common/src/main/java/com/fp/excel/FormulaManage.java new file mode 100644 index 0000000..24be953 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/excel/FormulaManage.java @@ -0,0 +1,5 @@ +package com.fp.excel; + +public enum FormulaManage { + CacheValue, Formula, None; +} diff --git a/base/dto/common/src/main/java/com/fp/excel/WorkbookFactory.java b/base/dto/common/src/main/java/com/fp/excel/WorkbookFactory.java new file mode 100644 index 0000000..3f30bc5 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/excel/WorkbookFactory.java @@ -0,0 +1,139 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.excel; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.StringTokenizer; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +/** + * + * @author malmeida + */ +public class WorkbookFactory implements ExcelToMapMessages { + + private InputStream inp; + + private String file_path, workbookFactoryStatus, file_extension; + + private Workbook wb; + + public WorkbookFactory(String file_Path){ + + this.file_path = file_Path; + + this.workbookFactoryStatus = null; + + this.inp = this.input_Stream_Builder(this.file_path); + + this.wb = this.excel_Workbook_Builder(); + + this.file_extension = null; + + } + + private InputStream input_Stream_Builder(String file_Path){ + + try { + + InputStream inpm = new FileInputStream(file_Path); + + this.workbookFactoryStatus = WorkbookFactory.INPUT_STREAM_CREATED; + + return inpm; + + } catch (FileNotFoundException ex) { + + this.workbookFactoryStatus = WorkbookFactory.FILE_NOT_FOUND; + + return null; + + } + + } + + private Workbook excel_Workbook_Builder (){ + + if(this.workbookFactoryStatus.equals(WorkbookFactory.FILE_NOT_FOUND)){ + + this.workbookFactoryStatus = WorkbookFactory.WORKBOOK_NOT_CREATED; + + return null; + + }else{ + + Workbook wbm = null; + + try { + + this.file_extension = this.get_Workbook_Extension(this.file_path); + + if(this.file_extension.equals("xls")){ + + wbm = new HSSFWorkbook(this.inp); + } + + if(this.file_extension.equals("xlsx")){ + + wbm = new XSSFWorkbook(this.inp); + + } + + this.workbookFactoryStatus = WorkbookFactory.WORKBOOK_CREATED; + + return wbm; + + } catch (IOException ex) { + + this.workbookFactoryStatus = WorkbookFactory.WORKBOOK_NOT_CREATED; + + return null; + + }catch (Exception ex) { + + this.workbookFactoryStatus = WorkbookFactory.WORKBOOK_NOT_CREATED; + + return null; + + } + + } + + } + + private String get_Workbook_Extension(String file_path){ + + StringTokenizer tkn = new StringTokenizer(file_path,"."); + + String fe = null; + + while (tkn.hasMoreTokens()){ + + fe = tkn.nextToken(); + + } + + return fe; + + } + + public String get_WorkbookFactory_Status(){ + + return this.workbookFactoryStatus; + + } + + public Workbook get_ExcelWorkBook(){ + + return this.wb; + + } + +} diff --git a/base/dto/common/src/main/java/com/fp/excel/WorkbookFactoryStreamBytes.java b/base/dto/common/src/main/java/com/fp/excel/WorkbookFactoryStreamBytes.java new file mode 100644 index 0000000..ba8c81d --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/excel/WorkbookFactoryStreamBytes.java @@ -0,0 +1,109 @@ +package com.fp.excel; + +import java.io.ByteArrayInputStream; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.StringTokenizer; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +/** + * Clase que obtiene el archivo de excel a partir de un arreglo de bytes + * + * @author malmeida + */ +public class WorkbookFactoryStreamBytes implements ExcelToMapMessages { + + private InputStream inp; + private String workbookFactoryStatus, file_extension, extension; + private Workbook wb; + private byte[] arrayBytesExcel; + + /** + * + * @param arrayBytesExcel + * @param extension + */ + public WorkbookFactoryStreamBytes(byte[] arrayBytesExcel, String extension) { + this.workbookFactoryStatus = null; + this.arrayBytesExcel = arrayBytesExcel; + this.inp = inputStreamBuilder(this.arrayBytesExcel); + this.extension = extension; + this.wb = this.excelWorkbookBuilder(this.extension); + } + + /** + * + * @param arrayBytesExcel + * @return + */ + private InputStream inputStreamBuilder(byte[] arrayBytesExcel) { + try { + InputStream inpm = new ByteArrayInputStream(arrayBytesExcel); + this.workbookFactoryStatus = WorkbookFactoryStreamBytes.INPUT_STREAM_CREATED; + return inpm; + } catch (Exception ex) { + this.workbookFactoryStatus = WorkbookFactoryStreamBytes.FILE_NOT_FOUND; + return null; + } + } + + /** + * + * @param fileExtension + * @return + */ + private Workbook excelWorkbookBuilder(String fileExtension) { + if (this.workbookFactoryStatus.equals(WorkbookFactoryStreamBytes.FILE_NOT_FOUND)) { + this.workbookFactoryStatus = WorkbookFactoryStreamBytes.WORKBOOK_NOT_CREATED; + return null; + } else { + Workbook wbm = null; + try { + this.file_extension = fileExtension; + if (this.file_extension.equals("xls")) { + wbm = new HSSFWorkbook(this.inp); + } + if (this.file_extension.equals("xlsx")) { + wbm = new XSSFWorkbook(this.inp); + } + this.workbookFactoryStatus = WorkbookFactoryStreamBytes.WORKBOOK_CREATED; + return wbm; + } catch (IOException ex) { + this.workbookFactoryStatus = WorkbookFactoryStreamBytes.WORKBOOK_NOT_CREATED; + return null; + } catch (Exception ex) { + this.workbookFactoryStatus = WorkbookFactoryStreamBytes.WORKBOOK_NOT_CREATED; + return null; + } + } + + } + + /** + * + * @return + */ + public String getWorkbookFactoryStatus() { + return this.workbookFactoryStatus; + } + + /** + * + * @return + */ + public String getWorkbookFactoryStatusByte() { + return this.workbookFactoryStatus; + } + + /** + * + * @return + */ + public Workbook getExcelWorkBook() { + return this.wb; + } +} \ No newline at end of file diff --git a/base/dto/common/src/main/java/com/fp/excel/XLSXUtil.java b/base/dto/common/src/main/java/com/fp/excel/XLSXUtil.java new file mode 100644 index 0000000..e359fd8 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/excel/XLSXUtil.java @@ -0,0 +1,287 @@ +package com.fp.excel; + +import java.io.InputStream; +import java.io.OutputStream; +import java.math.BigDecimal; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.NoSuchElementException; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.DataFormat; +import org.apache.poi.ss.usermodel.Font; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFCellStyle; +import org.apache.poi.xssf.usermodel.XSSFColor; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import com.fp.common.helper.BeanManager; + +public class XLSXUtil { + + private Workbook book; + + public Workbook getBook() { + return this.book; + } + private Sheet sheet; + private int sheetIndex; + private int maxSheets; + private int index; + + public XLSXUtil() { + this.book = new XSSFWorkbook(); + this.sheet = this.book.createSheet(); + this.index = 0; + } + + public XLSXUtil(InputStream pIn) throws Exception { + this.book = new XSSFWorkbook(pIn); + this.maxSheets = this.book.getNumberOfSheets(); + this.sheet = this.book.getSheetAt(0); + this.index = 0; + } + + public void addRecord(Object[] pRecord, String styleRow) throws Exception { + + CellStyle style = (styleRow.equals("H"))?this.createStyle(this.book):null; + Row row = this.sheet.createRow(this.index++); + + for (int i = 0; i < pRecord.length; i++) { + Object object = pRecord[i]; + Cell cell = null; + if (object instanceof Number) { + cell = row.createCell(i, Cell.CELL_TYPE_NUMERIC); + cell.setCellValue(BeanManager.convertObject(object, BigDecimal.class).doubleValue()); + cell.setCellStyle(style); + } + if (object instanceof Date) { + cell = row.createCell(i); + CellStyle styleDate = this.book.createCellStyle(); + DataFormat fmt = this.book.createDataFormat(); + styleDate.setDataFormat(fmt.getFormat("yyyy-MM-dd")); + cell.setCellStyle(styleDate); + cell.setCellValue((Date) object); + } + if (cell == null) { + cell = row.createCell(i, Cell.CELL_TYPE_STRING); + cell.setCellValue(BeanManager.convertObject(object, String.class)); + cell.setCellStyle(style); + } + + } + } + + public Map> readSheet() { + Map> data = new HashMap>(); + for (int i = this.sheet.getFirstRowNum(); i <= this.sheet.getLastRowNum(); i++) { + Map record = this.manageRecord(i); + data.put(i, record); + } + return data; + } + + public Map manageRecord(int pIndex) { + return this.manageRecord(pIndex, -1, FormulaManage.None); + } + + public Map manageRecord(int pIndex, int pEnd, FormulaManage pManage) { + Map record = new HashMap(); + Row r = this.sheet.getRow(pIndex); + if (r == null) { + return record; + } + Iterator ic = r.cellIterator(); + while (ic.hasNext()) { + Cell c = ic.next(); + if ((c.getColumnIndex() > pEnd) && (pEnd > 0)) { + break; + } + Object value = this.manageCell(c,pManage);//(pManage==FormulaManage.None)?this.manageCell(c, pManage):this.manageCellValue(c); + if (value == null) { + continue; + } + record.put(c.getColumnIndex(), value); + } + return record; + } + + public Map manageRecordForm(int pIndex, int pInit, int pEnd, FormulaManage pManage) { + Map record = new HashMap(); + Row r = this.sheet.getRow(pIndex); + if (r == null) { + return record; + } + for (Cell c : r) { + if (c.getColumnIndex() >= pInit && c.getColumnIndex() < pEnd) { + Object value = this.manageCellValue(c); + if (value == null) { + continue; + } + record.put(c.getColumnIndex(), value); + } else if (c.getColumnIndex() >= pEnd) { + break; + } + } + return record; + } + + private Object manageCell(Cell pCell, FormulaManage pManage) { + Object val = null; + switch (pCell.getCellType()) { + case Cell.CELL_TYPE_NUMERIC: + val = Math.round(pCell.getNumericCellValue() * 100) / 100d; + break; + case Cell.CELL_TYPE_STRING: + val = pCell.getStringCellValue(); + val = pCell.getRichStringCellValue(); + break; + case Cell.CELL_TYPE_BLANK: + val = pCell.getStringCellValue(); + break; + case Cell.CELL_TYPE_FORMULA: + /* + * FormulaEvaluator evaluator = this.book.getCreationHelper().createFormulaEvaluator(); try { CellValue + * cellValue = evaluator.evaluate(pCell); switch (cellValue.getCellType()) { case Cell.CELL_TYPE_NUMERIC: + * val = cellValue.getNumberValue(); break; case Cell.CELL_TYPE_STRING: val = cellValue.getStringValue(); + * break; case Cell.CELL_TYPE_BOOLEAN: val = cellValue.getBooleanValue(); break; case Cell.CELL_TYPE_ERROR: + * val = cellValue.getErrorValue(); break; default: val = pCell.getCellFormula(); } } catch (Exception e) { + * val = pCell.getCellFormula(); break; } + */ + if (pManage == FormulaManage.None) { + val = null; + break; + } + if (pManage == FormulaManage.Formula) { + val = pCell.getCellFormula(); + break; + } + switch (pCell.getCachedFormulaResultType()) { + case Cell.CELL_TYPE_NUMERIC: + val = pCell.getNumericCellValue(); + break; + case Cell.CELL_TYPE_STRING: + val = pCell.getRichStringCellValue(); + break; + default: + val = pCell.getCellFormula(); + // throw new IllegalArgumentException(); + } + + break; + case Cell.CELL_TYPE_BOOLEAN: + val = pCell.getBooleanCellValue(); + break; + case Cell.CELL_TYPE_ERROR: + val = pCell.getErrorCellValue(); + break; + } + return val; + } + + /** + * Entrega el valor de la celda + * @param pCell Cell + * @return value Object + */ + private Object manageCellValue(Cell pCell) { + Object val = null; + double value=0; + switch (pCell.getCellType()) { + case Cell.CELL_TYPE_NUMERIC: + value=pCell.getNumericCellValue(); + val = Math.round(value * 100) / 100d; + break; + case Cell.CELL_TYPE_STRING: + val = pCell.getStringCellValue(); + break; + case Cell.CELL_TYPE_BLANK: + val = null; + break; + case Cell.CELL_TYPE_FORMULA: + + switch (pCell.getCachedFormulaResultType()) { + case Cell.CELL_TYPE_NUMERIC: + value=pCell.getNumericCellValue(); + val = Math.round(value * 100) / 100d; + break; + case Cell.CELL_TYPE_STRING: + val=pCell.getRichStringCellValue(); + val=pCell.getStringCellValue(); +// val = pCell.getRichStringCellValue(); + break; + case Cell.CELL_TYPE_BLANK: + val = null; + break; + case Cell.CELL_TYPE_ERROR: + val = null; + break; + default: + val=null; +// val = pCell.getCellFormula(); + } + + break; + case Cell.CELL_TYPE_BOOLEAN: + val = pCell.getBooleanCellValue(); + break; + case Cell.CELL_TYPE_ERROR: + val = pCell.getErrorCellValue(); + break; + } + return val; + } + + public void save(OutputStream pOut) throws Exception { + this.book.write(pOut); + } + + public String getSheetName() { + return this.sheet.getSheetName(); + } + + public void nextSheet() { + if (this.sheetIndex >= this.maxSheets) { + throw new NoSuchElementException(); + } + this.sheet = this.book.getSheetAt(++this.sheetIndex); + this.index = 0; + } + + public void goSheet(String pName) { + int ind = this.book.getSheetIndex(pName); + if ((ind < 0) || (ind >= this.maxSheets)) { + throw new NoSuchElementException(); + } + this.sheet = this.book.getSheetAt(ind); + this.index = 0; + } + + private CellStyle createStyle(Workbook wb){ + CellStyle style = wb.createCellStyle(); + style.setBorderRight(CellStyle.BORDER_THIN); + style.setRightBorderColor(IndexedColors.GREY_80_PERCENT.getIndex()); + style.setBorderBottom(CellStyle.BORDER_THIN); + style.setBottomBorderColor(IndexedColors.GREY_80_PERCENT.getIndex()); + style.setBorderLeft(CellStyle.BORDER_THIN); + style.setLeftBorderColor(IndexedColors.GREY_80_PERCENT.getIndex()); + style.setBorderTop(CellStyle.BORDER_THIN); + style.setTopBorderColor(IndexedColors.GREY_80_PERCENT.getIndex()); + + Font header2Font = wb.createFont(); + header2Font.setColor(IndexedColors.WHITE.getIndex()); + XSSFCellStyle style_h_2 = (XSSFCellStyle) style; + style_h_2.setAlignment(CellStyle.ALIGN_CENTER); + style_h_2.setFillForegroundColor(new XSSFColor(new java.awt.Color(86, 142, 213))); + style_h_2.setFillPattern(CellStyle.SOLID_FOREGROUND); + style_h_2.setFont(header2Font); + + return style_h_2; + } +} diff --git a/base/dto/common/src/main/java/com/fp/general/.svn/entries b/base/dto/common/src/main/java/com/fp/general/.svn/entries new file mode 100644 index 0000000..26c58c8 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/general/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/general +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +exception +dir + diff --git a/base/dto/common/src/main/java/com/fp/general/exception/.svn/entries b/base/dto/common/src/main/java/com/fp/general/exception/.svn/entries new file mode 100644 index 0000000..a7a2a72 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/general/exception/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/general/exception +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +GeneralException.java +file + + + + +2022-07-28T03:40:36.216775Z +b2e93a4b8d7d6333fe127335a8784003 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1095 + diff --git a/base/dto/common/src/main/java/com/fp/general/exception/.svn/text-base/GeneralException.java.svn-base b/base/dto/common/src/main/java/com/fp/general/exception/.svn/text-base/GeneralException.java.svn-base new file mode 100644 index 0000000..09953e7 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/general/exception/.svn/text-base/GeneralException.java.svn-base @@ -0,0 +1,33 @@ +package com.fp.general.exception; + +import javax.ejb.ApplicationException; + +import com.fp.common.exception.APPException; + +@ApplicationException(rollback=true) +public class GeneralException extends APPException{ + + /**Version de la clase. */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de LoanException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public GeneralException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de LoanException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public GeneralException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/general/exception/GeneralException.java b/base/dto/common/src/main/java/com/fp/general/exception/GeneralException.java new file mode 100644 index 0000000..09953e7 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/general/exception/GeneralException.java @@ -0,0 +1,33 @@ +package com.fp.general.exception; + +import javax.ejb.ApplicationException; + +import com.fp.common.exception.APPException; + +@ApplicationException(rollback=true) +public class GeneralException extends APPException{ + + /**Version de la clase. */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de LoanException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public GeneralException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de LoanException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public GeneralException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/installment/.svn/entries b/base/dto/common/src/main/java/com/fp/installment/.svn/entries new file mode 100644 index 0000000..2db1c90 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/installment/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/installment +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +exception +dir + diff --git a/base/dto/common/src/main/java/com/fp/installment/exception/.svn/entries b/base/dto/common/src/main/java/com/fp/installment/exception/.svn/entries new file mode 100644 index 0000000..6edde85 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/installment/exception/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/installment/exception +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +InstallmentException.java +file + + + + +2022-07-28T03:40:35.483772Z +c401515893115d87b2ba10fae759cb2c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1320 + diff --git a/base/dto/common/src/main/java/com/fp/installment/exception/.svn/text-base/InstallmentException.java.svn-base b/base/dto/common/src/main/java/com/fp/installment/exception/.svn/text-base/InstallmentException.java.svn-base new file mode 100644 index 0000000..acab334 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/installment/exception/.svn/text-base/InstallmentException.java.svn-base @@ -0,0 +1,40 @@ +package com.fp.installment.exception; + + +import javax.ejb.ApplicationException; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete Installment, el cual se encarga de generacion y manejo de tablas de + * amortizacion. + * @author Jorge Vaca + * @version 2.1 + */ +@ApplicationException(rollback=true) +public class InstallmentException extends APPException{ + + /**Version de la clase. */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de LoanException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public InstallmentException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de LoanException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public InstallmentException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/installment/exception/InstallmentException.java b/base/dto/common/src/main/java/com/fp/installment/exception/InstallmentException.java new file mode 100644 index 0000000..acab334 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/installment/exception/InstallmentException.java @@ -0,0 +1,40 @@ +package com.fp.installment.exception; + + +import javax.ejb.ApplicationException; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete Installment, el cual se encarga de generacion y manejo de tablas de + * amortizacion. + * @author Jorge Vaca + * @version 2.1 + */ +@ApplicationException(rollback=true) +public class InstallmentException extends APPException{ + + /**Version de la clase. */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de LoanException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public InstallmentException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de LoanException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public InstallmentException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/loan/.svn/entries b/base/dto/common/src/main/java/com/fp/loan/.svn/entries new file mode 100644 index 0000000..7e847f5 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/loan/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/loan +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +exception +dir + diff --git a/base/dto/common/src/main/java/com/fp/loan/exception/.svn/entries b/base/dto/common/src/main/java/com/fp/loan/exception/.svn/entries new file mode 100644 index 0000000..afcd4a0 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/loan/exception/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/loan/exception +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +LoanException.java +file + + + + +2022-07-28T03:40:35.333771Z +663542d976a5cd75c89019e9d40013ec +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1218 + diff --git a/base/dto/common/src/main/java/com/fp/loan/exception/.svn/text-base/LoanException.java.svn-base b/base/dto/common/src/main/java/com/fp/loan/exception/.svn/text-base/LoanException.java.svn-base new file mode 100644 index 0000000..5b8031f --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/loan/exception/.svn/text-base/LoanException.java.svn-base @@ -0,0 +1,38 @@ +package com.fp.loan.exception; + + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete loan o cuentas de credito y cartera. + * @author Jorge Vaca + * @version 2.1 + */ +@javax.ejb.ApplicationException(rollback=true) +public class LoanException extends APPException{ + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de LoanException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public LoanException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de LoanException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public LoanException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/loan/exception/LoanException.java b/base/dto/common/src/main/java/com/fp/loan/exception/LoanException.java new file mode 100644 index 0000000..5b8031f --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/loan/exception/LoanException.java @@ -0,0 +1,38 @@ +package com.fp.loan.exception; + + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete loan o cuentas de credito y cartera. + * @author Jorge Vaca + * @version 2.1 + */ +@javax.ejb.ApplicationException(rollback=true) +public class LoanException extends APPException{ + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de LoanException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public LoanException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de LoanException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public LoanException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/mail/.svn/entries b/base/dto/common/src/main/java/com/fp/mail/.svn/entries new file mode 100644 index 0000000..1c25903 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/mail/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/mail +svn://172.17.26.185/COMACO + + + +2016-02-05T16:15:03.013395Z +4436 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +Mail.java +file + + + + +2022-07-28T03:40:34.212766Z +4dc066b6c20f5b5deb2381e79938be2c +2016-02-05T16:15:03.013395Z +4436 +fpazmino + + + + + + + + + + + + + + + + + + + + + +13620 + diff --git a/base/dto/common/src/main/java/com/fp/mail/.svn/text-base/Mail.java.svn-base b/base/dto/common/src/main/java/com/fp/mail/.svn/text-base/Mail.java.svn-base new file mode 100644 index 0000000..19df6f6 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/mail/.svn/text-base/Mail.java.svn-base @@ -0,0 +1,489 @@ +/* + * + */ +package com.fp.mail; + +import java.util.Date; +import java.util.Properties; + +import javax.activation.DataHandler; +import javax.activation.FileDataSource; +import javax.mail.Authenticator; +import javax.mail.BodyPart; +import javax.mail.Message; +import javax.mail.PasswordAuthentication; +import javax.mail.Session; +import javax.mail.Transport; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeBodyPart; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeMultipart; +import javax.mail.util.ByteArrayDataSource; + +import com.fp.common.logger.APPLogger; +import com.fp.common.properties.PropertiesHandler; + +// TODO: Auto-generated Javadoc +/** + * Class Mail encargada del envío de correos. + * + * @author gfiallos + */ +public class Mail { + + /** + * Class SMTPAuthenticator encargada de establecer los parametros de autenticación con el Servidor de Correo. + * + * @author gfiallos + */ + private class SMTPAuthenticator extends Authenticator { + + /** + * Obtiene el valor de password authentication. + * + * @return Valor de password authentication + */ + @Override + public PasswordAuthentication getPasswordAuthentication() { + try { + PropertiesHandler ph = new PropertiesHandler("mail"); + String username = ph.getStringValue("mail.smtp.user"); + String password1 = ph.getStringValue("mail.smtp.password"); + return new PasswordAuthentication(username, password1); + } catch (Exception e) { + APPLogger.getLogger().error(e); + } + return null; + } + } + + /** El valor de bcc. */ + private String bcc; + + /** El valor de cc. */ + private String cc; + + /** El valor de cont. */ + private String cont = null; + + /** El valor de from. */ + private String from; + + /** El valor de mailer. */ + private String mailer = ""; + + /** El valor de port. */ + private int port; + + /** El valor de user. */ + private String user; + + /** El valor de password. */ + private String password; + + /** El valor de auth. */ + private boolean auth; + + /** El valor de mail data. */ + private MimeMultipart mailData; + + /** El valor de mailhost. */ + private String mailhost = null; + + /** El valor de subject. */ + private String subject = null; + + /** El valor de to. */ + private String to = null; + + /** El valor de smtps. */ + private boolean smtps; + + /** El valor de content message type. */ + private String contentMessageType = "text/html"; + + /** + * Crea una nueva instancia de mail. + * + * @param pSubject the subject + * @param pMessage the message + * @param pTo the to + * @throws Exception la exception + */ + public Mail(String pSubject, String pMessage, String pTo) throws Exception { + this(pSubject, pMessage, pTo, null, null, true); + } + + /** + * Crea una nueva instancia de mail. + * + * @param pSubject the subject + * @param pMessage the message + * @param pTo the to + * @param pCopy the copy + * @throws Exception la exception + */ + public Mail(String pSubject, String pMessage, String pTo, String pCopy) throws Exception { + this(pSubject, pMessage, pTo, pCopy, null, true); + } + + /** + * Crea una nueva instancia de mail. + * + * @param pSubject the subject + * @param pMessage the message + * @param pTo the to + * @param pCopy the copy + * @param pBcc the bcc + * @param pInit the init + * @throws Exception la exception + */ + public Mail(String pSubject, String pMessage, String pTo, String pCopy, String pBcc, boolean pInit) throws Exception { + if (pInit) { + this.init(); + } + this.to = pTo; + this.subject = pSubject; + this.cc = pCopy; + this.bcc = pBcc; + + this.cont = pMessage; + if (this.cont != null) { + this.manageContent(); + } + + } + + /** + * Permite poner una plantilla de descripcion al mail + * @param pMessage + * @throws Exception + */ + public void setCuerpoMail(String pMessage) throws Exception { + this.cont = pMessage; + if (this.cont != null) { + this.manageContent(); + } + } + + /** + * Método que implementa la construcción del contenido del mail. + * + * @throws Exception la exception + */ + private void manageContent() throws Exception { + BodyPart content = new MimeBodyPart(); + ByteArrayDataSource bad = new ByteArrayDataSource(this.cont.getBytes(), this.contentMessageType); + DataHandler dh = new DataHandler(bad); + content.setDataHandler(dh); + + this.mailData = new MimeMultipart(); + this.mailData.addBodyPart(content); + } + + /** + * Entrega el valor de contentMessageType. + * + * @return Valor de contentMessageType + */ + public String getContentMessageType() { + return this.contentMessageType; + } + + /** + * Fija un nuevo valor en contentMessageType. + * + * @param pContentMessageType nuevo valor para contentMessageType + */ + public void setContentMessageType(String pContentMessageType) { + this.contentMessageType = pContentMessageType; + } + + /** + * Inicia los datos básicos para el envío del Correo. + * + * @throws Exception la exception + */ + protected void init() throws Exception { + PropertiesHandler ph = new PropertiesHandler("mail"); + this.from = ph.getValue("mail.from"); + this.mailhost = ph.getValue("mail.smtp.server"); + this.port = ph.getIntValue("mail.smtp.port"); + this.user = ph.getStringValue("mail.smtp.user"); + this.password = ph.getStringValue("mail.smtp.password"); + this.auth = ph.getBooleanValue("mail.smtp.auth"); + this.smtps = ph.getBooleanValue("mail.smtps"); + } + + /** + * Configura el envío de Correos. + * + * @param pFrom Remitente + * @param pMailhost Servidor SMTP + * @param pPort Puerto SMTP + * @param pUser Usuario de ingreso al servidor SMTP + * @param pPassword Password de ingreso al servidor SMTP + * @param pAuth Indicador si se requiere autenticación con el Servidor + * @param pSMTPS Indicador si el servidor maneja protocolo seguro + * @throws Exception la exception + */ + public void config(String pFrom, String pMailhost, int pPort, String pUser, String pPassword, boolean pAuth, boolean pSMTPS) throws Exception { + this.from = pFrom; + this.mailhost = pMailhost; + this.port = pPort; + this.user = pUser; + this.password = pPassword; + this.auth = pAuth; + this.smtps = pSMTPS; + } + + /** + * Adiciona un attachment. + * + * @param pName the name + * @param pPath the path + * @throws Exception la exception + */ + public void addAttachment(String pName, String pPath) throws Exception { + try{ + BodyPart attach = new MimeBodyPart(); + attach.setDataHandler(new DataHandler(new FileDataSource(pPath))); + attach.setFileName(pName); + if(mailData==null){ + this.mailData = new MimeMultipart(); + } + this.mailData.addBodyPart(attach); + }catch(Exception err){ + APPLogger.getLogger().error(err); + } + } + + /** + * Adiciona un attachment. + * + * @param pName the name + * @param bytesAttachment the bytes attachment + * @param contentType the content type + * @throws Exception la exception + */ + public void addAttachment(String pName, byte[] bytesAttachment, String contentType) throws Exception { + try{ + BodyPart attach = new MimeBodyPart(); + ByteArrayDataSource bad = new ByteArrayDataSource(bytesAttachment, contentType); + DataHandler dh = new DataHandler(bad); + attach.setDataHandler(dh); + attach.setFileName(pName); + if(mailData==null){ + this.mailData = new MimeMultipart(); + } + this.mailData.addBodyPart(attach); + }catch(Exception err){ + APPLogger.getLogger().error(err); + } + } + + /** + * Envía el Correo. + * + * @throws Exception la exception + */ + public void send() throws Exception { + if (this.mailData == null) { + this.manageContent(); + } + Properties props = System.getProperties(); + props.put("mail.smtp.localhost", "mail.google.com"); + if (this.mailhost != null) { + props.put("mail.smtp.host", this.mailhost); + props.setProperty("mail.smtp.port", "" + this.port); + if (this.smtps) { + props.put("mail.smtp.ssl", "true"); + props.put("mail.smtp.starttls.enable", "true"); + props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); + props.put("mail.smtp.socketFactory.fallback", "false"); + } + props.setProperty("mail.smtp.auth", "" + this.auth); + + } + + Session session = null; + if (this.smtps) { + @SuppressWarnings("synthetic-access") + Authenticator auth1 = new SMTPAuthenticator(); + session = Session.getDefaultInstance(props, auth1); + } else { + session = Session.getDefaultInstance(props, null); + } + Message msg = new MimeMessage(session); + + msg.setFrom(new InternetAddress(this.from)); + msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(this.to, false)); + + if (this.cc != null) { + msg.setRecipients(Message.RecipientType.CC, InternetAddress.parse(this.cc, false)); + } + + if (this.bcc != null) { + msg.setRecipients(Message.RecipientType.BCC, InternetAddress.parse(this.bcc, false)); + } + + msg.setSubject(this.subject); + + msg.setContent(this.mailData); + msg.setHeader("X-Mailer", this.mailer); + msg.setSentDate(new Date()); + Transport t = null; + if (this.smtps || !this.auth) { + Transport.send(msg); + } + else { + t = session.getTransport("smtp"); + t.connect(this.mailhost, this.port, this.user, this.password); + t.sendMessage(msg, msg.getAllRecipients()); + t.close(); + } + + } + + /** + * Entrega el valor de bcc. + * + * @return Valor de bcc + */ + public String getBcc() { + return this.bcc; + } + + /** + * Fija un nuevo valor en bcc. + * + * @param pBcc nuevo valor para bcc + */ + public void setBcc(String pBcc) { + this.bcc = pBcc; + } + + /** + * Entrega el valor de cc. + * + * @return Valor de cc + */ + public String getCc() { + return this.cc; + } + + /** + * Fija un nuevo valor en cc. + * + * @param pCc nuevo valor para cc + */ + public void setCc(String pCc) { + this.cc = pCc; + } + + /** + * Entrega el valor de cont. + * + * @return Valor de cont + */ + public String getCont() { + return this.cont; + } + + /** + * Fija un nuevo valor en cont. + * + * @param pCont nuevo valor para cont + */ + public void setCont(String pCont) { + this.cont = pCont; + } + + /** + * Entrega el valor de from. + * + * @return Valor de from + */ + public String getFrom() { + return this.from; + } + + /** + * Fija un nuevo valor en from. + * + * @param pFrom nuevo valor para from + */ + public void setFrom(String pFrom) { + this.from = pFrom; + } + + /** + * Entrega el valor de mailer. + * + * @return Valor de mailer + */ + public String getMailer() { + return this.mailer; + } + + /** + * Fija un nuevo valor en mailer. + * + * @param pMailer nuevo valor para mailer + */ + public void setMailer(String pMailer) { + this.mailer = pMailer; + } + + /** + * Entrega el valor de subject. + * + * @return Valor de subject + */ + public String getSubject() { + return this.subject; + } + + /** + * Fija un nuevo valor en subject. + * + * @param pSubject nuevo valor para subject + */ + public void setSubject(String pSubject) { + this.subject = pSubject; + } + + /** + * Entrega el valor de to. + * + * @return Valor de to + */ + public String getTo() { + return this.to; + } + + /** + * Fija un nuevo valor en to. + * + * @param pTo nuevo valor para to + */ + public void setTo(String pTo) { + this.to = pTo; + } + + public Mail() { + } + public static void main(String[] args) { + try { + Mail m = new Mail(); + m.config("notificacion@sbs.gob.ec", "5.9.144.187", 26, null, null, false, false); + m.setTo("pruebas@sbs.gob.ec"); + m.setSubject("Prueba mail maia"); + m.setCont("texto de prueba de correo"); + m.send(); + } catch (Exception e) { + APPLogger.getLogger().error(e); + } + + } +} diff --git a/base/dto/common/src/main/java/com/fp/mail/Mail.java b/base/dto/common/src/main/java/com/fp/mail/Mail.java new file mode 100644 index 0000000..19df6f6 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/mail/Mail.java @@ -0,0 +1,489 @@ +/* + * + */ +package com.fp.mail; + +import java.util.Date; +import java.util.Properties; + +import javax.activation.DataHandler; +import javax.activation.FileDataSource; +import javax.mail.Authenticator; +import javax.mail.BodyPart; +import javax.mail.Message; +import javax.mail.PasswordAuthentication; +import javax.mail.Session; +import javax.mail.Transport; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeBodyPart; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeMultipart; +import javax.mail.util.ByteArrayDataSource; + +import com.fp.common.logger.APPLogger; +import com.fp.common.properties.PropertiesHandler; + +// TODO: Auto-generated Javadoc +/** + * Class Mail encargada del envío de correos. + * + * @author gfiallos + */ +public class Mail { + + /** + * Class SMTPAuthenticator encargada de establecer los parametros de autenticación con el Servidor de Correo. + * + * @author gfiallos + */ + private class SMTPAuthenticator extends Authenticator { + + /** + * Obtiene el valor de password authentication. + * + * @return Valor de password authentication + */ + @Override + public PasswordAuthentication getPasswordAuthentication() { + try { + PropertiesHandler ph = new PropertiesHandler("mail"); + String username = ph.getStringValue("mail.smtp.user"); + String password1 = ph.getStringValue("mail.smtp.password"); + return new PasswordAuthentication(username, password1); + } catch (Exception e) { + APPLogger.getLogger().error(e); + } + return null; + } + } + + /** El valor de bcc. */ + private String bcc; + + /** El valor de cc. */ + private String cc; + + /** El valor de cont. */ + private String cont = null; + + /** El valor de from. */ + private String from; + + /** El valor de mailer. */ + private String mailer = ""; + + /** El valor de port. */ + private int port; + + /** El valor de user. */ + private String user; + + /** El valor de password. */ + private String password; + + /** El valor de auth. */ + private boolean auth; + + /** El valor de mail data. */ + private MimeMultipart mailData; + + /** El valor de mailhost. */ + private String mailhost = null; + + /** El valor de subject. */ + private String subject = null; + + /** El valor de to. */ + private String to = null; + + /** El valor de smtps. */ + private boolean smtps; + + /** El valor de content message type. */ + private String contentMessageType = "text/html"; + + /** + * Crea una nueva instancia de mail. + * + * @param pSubject the subject + * @param pMessage the message + * @param pTo the to + * @throws Exception la exception + */ + public Mail(String pSubject, String pMessage, String pTo) throws Exception { + this(pSubject, pMessage, pTo, null, null, true); + } + + /** + * Crea una nueva instancia de mail. + * + * @param pSubject the subject + * @param pMessage the message + * @param pTo the to + * @param pCopy the copy + * @throws Exception la exception + */ + public Mail(String pSubject, String pMessage, String pTo, String pCopy) throws Exception { + this(pSubject, pMessage, pTo, pCopy, null, true); + } + + /** + * Crea una nueva instancia de mail. + * + * @param pSubject the subject + * @param pMessage the message + * @param pTo the to + * @param pCopy the copy + * @param pBcc the bcc + * @param pInit the init + * @throws Exception la exception + */ + public Mail(String pSubject, String pMessage, String pTo, String pCopy, String pBcc, boolean pInit) throws Exception { + if (pInit) { + this.init(); + } + this.to = pTo; + this.subject = pSubject; + this.cc = pCopy; + this.bcc = pBcc; + + this.cont = pMessage; + if (this.cont != null) { + this.manageContent(); + } + + } + + /** + * Permite poner una plantilla de descripcion al mail + * @param pMessage + * @throws Exception + */ + public void setCuerpoMail(String pMessage) throws Exception { + this.cont = pMessage; + if (this.cont != null) { + this.manageContent(); + } + } + + /** + * Método que implementa la construcción del contenido del mail. + * + * @throws Exception la exception + */ + private void manageContent() throws Exception { + BodyPart content = new MimeBodyPart(); + ByteArrayDataSource bad = new ByteArrayDataSource(this.cont.getBytes(), this.contentMessageType); + DataHandler dh = new DataHandler(bad); + content.setDataHandler(dh); + + this.mailData = new MimeMultipart(); + this.mailData.addBodyPart(content); + } + + /** + * Entrega el valor de contentMessageType. + * + * @return Valor de contentMessageType + */ + public String getContentMessageType() { + return this.contentMessageType; + } + + /** + * Fija un nuevo valor en contentMessageType. + * + * @param pContentMessageType nuevo valor para contentMessageType + */ + public void setContentMessageType(String pContentMessageType) { + this.contentMessageType = pContentMessageType; + } + + /** + * Inicia los datos básicos para el envío del Correo. + * + * @throws Exception la exception + */ + protected void init() throws Exception { + PropertiesHandler ph = new PropertiesHandler("mail"); + this.from = ph.getValue("mail.from"); + this.mailhost = ph.getValue("mail.smtp.server"); + this.port = ph.getIntValue("mail.smtp.port"); + this.user = ph.getStringValue("mail.smtp.user"); + this.password = ph.getStringValue("mail.smtp.password"); + this.auth = ph.getBooleanValue("mail.smtp.auth"); + this.smtps = ph.getBooleanValue("mail.smtps"); + } + + /** + * Configura el envío de Correos. + * + * @param pFrom Remitente + * @param pMailhost Servidor SMTP + * @param pPort Puerto SMTP + * @param pUser Usuario de ingreso al servidor SMTP + * @param pPassword Password de ingreso al servidor SMTP + * @param pAuth Indicador si se requiere autenticación con el Servidor + * @param pSMTPS Indicador si el servidor maneja protocolo seguro + * @throws Exception la exception + */ + public void config(String pFrom, String pMailhost, int pPort, String pUser, String pPassword, boolean pAuth, boolean pSMTPS) throws Exception { + this.from = pFrom; + this.mailhost = pMailhost; + this.port = pPort; + this.user = pUser; + this.password = pPassword; + this.auth = pAuth; + this.smtps = pSMTPS; + } + + /** + * Adiciona un attachment. + * + * @param pName the name + * @param pPath the path + * @throws Exception la exception + */ + public void addAttachment(String pName, String pPath) throws Exception { + try{ + BodyPart attach = new MimeBodyPart(); + attach.setDataHandler(new DataHandler(new FileDataSource(pPath))); + attach.setFileName(pName); + if(mailData==null){ + this.mailData = new MimeMultipart(); + } + this.mailData.addBodyPart(attach); + }catch(Exception err){ + APPLogger.getLogger().error(err); + } + } + + /** + * Adiciona un attachment. + * + * @param pName the name + * @param bytesAttachment the bytes attachment + * @param contentType the content type + * @throws Exception la exception + */ + public void addAttachment(String pName, byte[] bytesAttachment, String contentType) throws Exception { + try{ + BodyPart attach = new MimeBodyPart(); + ByteArrayDataSource bad = new ByteArrayDataSource(bytesAttachment, contentType); + DataHandler dh = new DataHandler(bad); + attach.setDataHandler(dh); + attach.setFileName(pName); + if(mailData==null){ + this.mailData = new MimeMultipart(); + } + this.mailData.addBodyPart(attach); + }catch(Exception err){ + APPLogger.getLogger().error(err); + } + } + + /** + * Envía el Correo. + * + * @throws Exception la exception + */ + public void send() throws Exception { + if (this.mailData == null) { + this.manageContent(); + } + Properties props = System.getProperties(); + props.put("mail.smtp.localhost", "mail.google.com"); + if (this.mailhost != null) { + props.put("mail.smtp.host", this.mailhost); + props.setProperty("mail.smtp.port", "" + this.port); + if (this.smtps) { + props.put("mail.smtp.ssl", "true"); + props.put("mail.smtp.starttls.enable", "true"); + props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); + props.put("mail.smtp.socketFactory.fallback", "false"); + } + props.setProperty("mail.smtp.auth", "" + this.auth); + + } + + Session session = null; + if (this.smtps) { + @SuppressWarnings("synthetic-access") + Authenticator auth1 = new SMTPAuthenticator(); + session = Session.getDefaultInstance(props, auth1); + } else { + session = Session.getDefaultInstance(props, null); + } + Message msg = new MimeMessage(session); + + msg.setFrom(new InternetAddress(this.from)); + msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(this.to, false)); + + if (this.cc != null) { + msg.setRecipients(Message.RecipientType.CC, InternetAddress.parse(this.cc, false)); + } + + if (this.bcc != null) { + msg.setRecipients(Message.RecipientType.BCC, InternetAddress.parse(this.bcc, false)); + } + + msg.setSubject(this.subject); + + msg.setContent(this.mailData); + msg.setHeader("X-Mailer", this.mailer); + msg.setSentDate(new Date()); + Transport t = null; + if (this.smtps || !this.auth) { + Transport.send(msg); + } + else { + t = session.getTransport("smtp"); + t.connect(this.mailhost, this.port, this.user, this.password); + t.sendMessage(msg, msg.getAllRecipients()); + t.close(); + } + + } + + /** + * Entrega el valor de bcc. + * + * @return Valor de bcc + */ + public String getBcc() { + return this.bcc; + } + + /** + * Fija un nuevo valor en bcc. + * + * @param pBcc nuevo valor para bcc + */ + public void setBcc(String pBcc) { + this.bcc = pBcc; + } + + /** + * Entrega el valor de cc. + * + * @return Valor de cc + */ + public String getCc() { + return this.cc; + } + + /** + * Fija un nuevo valor en cc. + * + * @param pCc nuevo valor para cc + */ + public void setCc(String pCc) { + this.cc = pCc; + } + + /** + * Entrega el valor de cont. + * + * @return Valor de cont + */ + public String getCont() { + return this.cont; + } + + /** + * Fija un nuevo valor en cont. + * + * @param pCont nuevo valor para cont + */ + public void setCont(String pCont) { + this.cont = pCont; + } + + /** + * Entrega el valor de from. + * + * @return Valor de from + */ + public String getFrom() { + return this.from; + } + + /** + * Fija un nuevo valor en from. + * + * @param pFrom nuevo valor para from + */ + public void setFrom(String pFrom) { + this.from = pFrom; + } + + /** + * Entrega el valor de mailer. + * + * @return Valor de mailer + */ + public String getMailer() { + return this.mailer; + } + + /** + * Fija un nuevo valor en mailer. + * + * @param pMailer nuevo valor para mailer + */ + public void setMailer(String pMailer) { + this.mailer = pMailer; + } + + /** + * Entrega el valor de subject. + * + * @return Valor de subject + */ + public String getSubject() { + return this.subject; + } + + /** + * Fija un nuevo valor en subject. + * + * @param pSubject nuevo valor para subject + */ + public void setSubject(String pSubject) { + this.subject = pSubject; + } + + /** + * Entrega el valor de to. + * + * @return Valor de to + */ + public String getTo() { + return this.to; + } + + /** + * Fija un nuevo valor en to. + * + * @param pTo nuevo valor para to + */ + public void setTo(String pTo) { + this.to = pTo; + } + + public Mail() { + } + public static void main(String[] args) { + try { + Mail m = new Mail(); + m.config("notificacion@sbs.gob.ec", "5.9.144.187", 26, null, null, false, false); + m.setTo("pruebas@sbs.gob.ec"); + m.setSubject("Prueba mail maia"); + m.setCont("texto de prueba de correo"); + m.send(); + } catch (Exception e) { + APPLogger.getLogger().error(e); + } + + } +} diff --git a/base/dto/common/src/main/java/com/fp/persistence/.svn/entries b/base/dto/common/src/main/java/com/fp/persistence/.svn/entries new file mode 100644 index 0000000..29682c4 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/persistence/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/persistence +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +commondb +dir + diff --git a/base/dto/common/src/main/java/com/fp/persistence/commondb/.svn/entries b/base/dto/common/src/main/java/com/fp/persistence/commondb/.svn/entries new file mode 100644 index 0000000..5fa5cd4 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/persistence/commondb/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/persistence/commondb +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +exception +dir + diff --git a/base/dto/common/src/main/java/com/fp/persistence/commondb/exception/.svn/entries b/base/dto/common/src/main/java/com/fp/persistence/commondb/exception/.svn/entries new file mode 100644 index 0000000..f74fa00 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/persistence/commondb/exception/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/persistence/commondb/exception +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +CommondbException.java +file + + + + +2022-07-28T03:40:34.332767Z +fde4d164323d36e319a17ef4f9a91351 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1235 + diff --git a/base/dto/common/src/main/java/com/fp/persistence/commondb/exception/.svn/text-base/CommondbException.java.svn-base b/base/dto/common/src/main/java/com/fp/persistence/commondb/exception/.svn/text-base/CommondbException.java.svn-base new file mode 100644 index 0000000..bd13b80 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/persistence/commondb/exception/.svn/text-base/CommondbException.java.svn-base @@ -0,0 +1,39 @@ + +package com.fp.persistence.commondb.exception; + +import com.fp.common.exception.APPException; + + +/** + * Manejo de excepcion del paquete comun del core. + * @author Jorge Vaca. + * @version 2.1 + */ +@javax.ejb.ApplicationException(rollback=true) +public class CommondbException extends APPException { + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de CommonException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public CommondbException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de CommonException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public CommondbException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/persistence/commondb/exception/CommondbException.java b/base/dto/common/src/main/java/com/fp/persistence/commondb/exception/CommondbException.java new file mode 100644 index 0000000..bd13b80 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/persistence/commondb/exception/CommondbException.java @@ -0,0 +1,39 @@ + +package com.fp.persistence.commondb.exception; + +import com.fp.common.exception.APPException; + + +/** + * Manejo de excepcion del paquete comun del core. + * @author Jorge Vaca. + * @version 2.1 + */ +@javax.ejb.ApplicationException(rollback=true) +public class CommondbException extends APPException { + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de CommonException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public CommondbException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de CommonException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public CommondbException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/receivable/.svn/entries b/base/dto/common/src/main/java/com/fp/receivable/.svn/entries new file mode 100644 index 0000000..24099b7 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/receivable/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/receivable +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +exception +dir + diff --git a/base/dto/common/src/main/java/com/fp/receivable/exception/.svn/entries b/base/dto/common/src/main/java/com/fp/receivable/exception/.svn/entries new file mode 100644 index 0000000..5202316 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/receivable/exception/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/receivable/exception +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ReceivableException.java +file + + + + +2022-07-28T03:40:35.775773Z +f4b5d036f4f28e73b0a9a578728ef1a4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1248 + diff --git a/base/dto/common/src/main/java/com/fp/receivable/exception/.svn/text-base/ReceivableException.java.svn-base b/base/dto/common/src/main/java/com/fp/receivable/exception/.svn/text-base/ReceivableException.java.svn-base new file mode 100644 index 0000000..d3bcfa6 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/receivable/exception/.svn/text-base/ReceivableException.java.svn-base @@ -0,0 +1,38 @@ +package com.fp.receivable.exception; + + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete receivable (cuentas por cobrar). + * @author amerchan + * @version 2.1 + */ +@javax.ejb.ApplicationException(rollback=true) +public class ReceivableException extends APPException{ + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de ReceivableException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public ReceivableException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de ReceivableException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public ReceivableException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/receivable/exception/ReceivableException.java b/base/dto/common/src/main/java/com/fp/receivable/exception/ReceivableException.java new file mode 100644 index 0000000..d3bcfa6 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/receivable/exception/ReceivableException.java @@ -0,0 +1,38 @@ +package com.fp.receivable.exception; + + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete receivable (cuentas por cobrar). + * @author amerchan + * @version 2.1 + */ +@javax.ejb.ApplicationException(rollback=true) +public class ReceivableException extends APPException{ + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de ReceivableException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public ReceivableException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de ReceivableException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public ReceivableException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/telered/.svn/entries b/base/dto/common/src/main/java/com/fp/telered/.svn/entries new file mode 100644 index 0000000..3567da5 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/telered/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/telered +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +exception +dir + diff --git a/base/dto/common/src/main/java/com/fp/telered/exception/.svn/entries b/base/dto/common/src/main/java/com/fp/telered/exception/.svn/entries new file mode 100644 index 0000000..2e40e9e --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/telered/exception/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/telered/exception +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TeleredException.java +file + + + + +2022-07-28T03:40:34.247766Z +f06db173947dcb7a6a562f765b8ccc29 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1248 + diff --git a/base/dto/common/src/main/java/com/fp/telered/exception/.svn/text-base/TeleredException.java.svn-base b/base/dto/common/src/main/java/com/fp/telered/exception/.svn/text-base/TeleredException.java.svn-base new file mode 100644 index 0000000..27d84da --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/telered/exception/.svn/text-base/TeleredException.java.svn-base @@ -0,0 +1,41 @@ +package com.fp.telered.exception; + +import javax.ejb.ApplicationException; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete de telered. + * @author Jorge Vaca. + * @version 2.1 + */ +@ApplicationException(rollback=true) +public class TeleredException extends APPException{ + + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de TeleredException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public TeleredException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de TeleredException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public TeleredException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } + +} diff --git a/base/dto/common/src/main/java/com/fp/telered/exception/TeleredException.java b/base/dto/common/src/main/java/com/fp/telered/exception/TeleredException.java new file mode 100644 index 0000000..27d84da --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/telered/exception/TeleredException.java @@ -0,0 +1,41 @@ +package com.fp.telered.exception; + +import javax.ejb.ApplicationException; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete de telered. + * @author Jorge Vaca. + * @version 2.1 + */ +@ApplicationException(rollback=true) +public class TeleredException extends APPException{ + + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de TeleredException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public TeleredException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de TeleredException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public TeleredException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } + +} diff --git a/base/dto/common/src/main/java/com/fp/teller/.svn/entries b/base/dto/common/src/main/java/com/fp/teller/.svn/entries new file mode 100644 index 0000000..244e12b --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/teller/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/teller +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +exception +dir + diff --git a/base/dto/common/src/main/java/com/fp/teller/exception/.svn/entries b/base/dto/common/src/main/java/com/fp/teller/exception/.svn/entries new file mode 100644 index 0000000..8e608d1 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/teller/exception/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/teller/exception +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TellerException.java +file + + + + +2022-07-28T03:40:34.665768Z +c10af6c644d570f1d8fa5fabbe9140d1 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1305 + diff --git a/base/dto/common/src/main/java/com/fp/teller/exception/.svn/text-base/TellerException.java.svn-base b/base/dto/common/src/main/java/com/fp/teller/exception/.svn/text-base/TellerException.java.svn-base new file mode 100644 index 0000000..5c225f2 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/teller/exception/.svn/text-base/TellerException.java.svn-base @@ -0,0 +1,38 @@ +package com.fp.teller.exception; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete demanddeposit o cuentas a la vista. + * @author Jorge Vaca + * @version 2.1 + */ +@javax.ejb.ApplicationException(rollback=true) +public class TellerException extends APPException { + + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de TellerException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public TellerException(String code, String message, Exception pCause, Object... pParameters) { + super(code, message, pCause, pParameters); + } + + /** + * Crea una instancia de TellerException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public TellerException(String code, String message, Object... pParameters) { + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/teller/exception/TellerException.java b/base/dto/common/src/main/java/com/fp/teller/exception/TellerException.java new file mode 100644 index 0000000..5c225f2 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/teller/exception/TellerException.java @@ -0,0 +1,38 @@ +package com.fp.teller.exception; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete demanddeposit o cuentas a la vista. + * @author Jorge Vaca + * @version 2.1 + */ +@javax.ejb.ApplicationException(rollback=true) +public class TellerException extends APPException { + + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de TellerException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public TellerException(String code, String message, Exception pCause, Object... pParameters) { + super(code, message, pCause, pParameters); + } + + /** + * Crea una instancia de TellerException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public TellerException(String code, String message, Object... pParameters) { + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/term/.svn/entries b/base/dto/common/src/main/java/com/fp/term/.svn/entries new file mode 100644 index 0000000..9d8aa62 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/term/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/term +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +exception +dir + diff --git a/base/dto/common/src/main/java/com/fp/term/exception/.svn/entries b/base/dto/common/src/main/java/com/fp/term/exception/.svn/entries new file mode 100644 index 0000000..e143025 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/term/exception/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/term/exception +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TermException.java +file + + + + +2022-07-28T03:40:35.994774Z +7fe071310253a41dc80d81e3c0bbe880 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1211 + diff --git a/base/dto/common/src/main/java/com/fp/term/exception/.svn/text-base/TermException.java.svn-base b/base/dto/common/src/main/java/com/fp/term/exception/.svn/text-base/TermException.java.svn-base new file mode 100644 index 0000000..122a212 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/term/exception/.svn/text-base/TermException.java.svn-base @@ -0,0 +1,37 @@ +package com.fp.term.exception; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete term, certificados de deposito. + * @author Jorge Vaca + * @version 2.1 + */ +@javax.ejb.ApplicationException(rollback=true) +public class TermException extends APPException{ + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de LoanException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public TermException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de LoanException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public TermException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/term/exception/TermException.java b/base/dto/common/src/main/java/com/fp/term/exception/TermException.java new file mode 100644 index 0000000..122a212 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/term/exception/TermException.java @@ -0,0 +1,37 @@ +package com.fp.term.exception; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete term, certificados de deposito. + * @author Jorge Vaca + * @version 2.1 + */ +@javax.ejb.ApplicationException(rollback=true) +public class TermException extends APPException{ + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de LoanException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public TermException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de LoanException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public TermException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/timedeposit/.svn/entries b/base/dto/common/src/main/java/com/fp/timedeposit/.svn/entries new file mode 100644 index 0000000..ba809d3 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/timedeposit/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/timedeposit +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +exception +dir + diff --git a/base/dto/common/src/main/java/com/fp/timedeposit/exception/.svn/entries b/base/dto/common/src/main/java/com/fp/timedeposit/exception/.svn/entries new file mode 100644 index 0000000..116a03c --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/timedeposit/exception/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/timedeposit/exception +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TimeDepositException.java +file + + + + +2022-07-28T03:40:34.423767Z +b94f76f35606e62988980298a5c7c66a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1224 + diff --git a/base/dto/common/src/main/java/com/fp/timedeposit/exception/.svn/text-base/TimeDepositException.java.svn-base b/base/dto/common/src/main/java/com/fp/timedeposit/exception/.svn/text-base/TimeDepositException.java.svn-base new file mode 100644 index 0000000..532967f --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/timedeposit/exception/.svn/text-base/TimeDepositException.java.svn-base @@ -0,0 +1,38 @@ +package com.fp.timedeposit.exception; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete timedeposit o certificados de deposito. + * @author Jorge Vaca + * @version 2.1 + */ +@javax.ejb.ApplicationException(rollback=true) +public class TimeDepositException extends APPException{ + + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de TimeDepositException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public TimeDepositException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de TimeDepositException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public TimeDepositException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/timedeposit/exception/TimeDepositException.java b/base/dto/common/src/main/java/com/fp/timedeposit/exception/TimeDepositException.java new file mode 100644 index 0000000..532967f --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/timedeposit/exception/TimeDepositException.java @@ -0,0 +1,38 @@ +package com.fp.timedeposit.exception; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete timedeposit o certificados de deposito. + * @author Jorge Vaca + * @version 2.1 + */ +@javax.ejb.ApplicationException(rollback=true) +public class TimeDepositException extends APPException{ + + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de TimeDepositException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public TimeDepositException(String code, String message, Exception pCause,Object... pParameters){ + super(code, message, pCause,pParameters); + } + + /** + * Crea una instancia de TimeDepositException. + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativ + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public TimeDepositException(String code, String message, Object... pParameters){ + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/viaticos/.svn/entries b/base/dto/common/src/main/java/com/fp/viaticos/.svn/entries new file mode 100644 index 0000000..446c93b --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/viaticos/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/viaticos +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +exception +dir + diff --git a/base/dto/common/src/main/java/com/fp/viaticos/exception/.svn/entries b/base/dto/common/src/main/java/com/fp/viaticos/exception/.svn/entries new file mode 100644 index 0000000..aae1228 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/viaticos/exception/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/viaticos/exception +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ViaticosException.java +file + + + + +2022-07-28T03:40:34.152766Z +ee8ef88974c7e0b4b324452af2da52d4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1340 + diff --git a/base/dto/common/src/main/java/com/fp/viaticos/exception/.svn/text-base/ViaticosException.java.svn-base b/base/dto/common/src/main/java/com/fp/viaticos/exception/.svn/text-base/ViaticosException.java.svn-base new file mode 100644 index 0000000..5deb9e4 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/viaticos/exception/.svn/text-base/ViaticosException.java.svn-base @@ -0,0 +1,41 @@ +package com.fp.viaticos.exception; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete demanddeposit o cuentas a la vista. + * + * @author Jorge Vaca + * @version 2.1 + */ +@javax.ejb.ApplicationException(rollback = true) +public class ViaticosException extends APPException { + + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de ViaticosException. + * + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativo + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public ViaticosException(String code, String message, Exception pCause, Object... pParameters) { + super(code, message, pCause, pParameters); + } + + /** + * Crea una instancia de ViaticosException. + * + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativo + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public ViaticosException(String code, String message, Object... pParameters) { + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/viaticos/exception/ViaticosException.java b/base/dto/common/src/main/java/com/fp/viaticos/exception/ViaticosException.java new file mode 100644 index 0000000..5deb9e4 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/viaticos/exception/ViaticosException.java @@ -0,0 +1,41 @@ +package com.fp.viaticos.exception; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepcion del paquete demanddeposit o cuentas a la vista. + * + * @author Jorge Vaca + * @version 2.1 + */ +@javax.ejb.ApplicationException(rollback = true) +public class ViaticosException extends APPException { + + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de ViaticosException. + * + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativo + * @param pCause Excepcion original, cuando esta no se origina en api's de terceros. + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public ViaticosException(String code, String message, Exception pCause, Object... pParameters) { + super(code, message, pCause, pParameters); + } + + /** + * Crea una instancia de ViaticosException. + * + * @param code Codigo de mensaje aplicativo. + * @param message Mensaje aplicativo + * @param pParameters Arreglo de parametros a presentar adcionales al mensaje aplicativo. + */ + public ViaticosException(String code, String message, Object... pParameters) { + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/warranty/.svn/entries b/base/dto/common/src/main/java/com/fp/warranty/.svn/entries new file mode 100644 index 0000000..eeb260e --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/warranty/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/warranty +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +exception +dir + diff --git a/base/dto/common/src/main/java/com/fp/warranty/exception/.svn/entries b/base/dto/common/src/main/java/com/fp/warranty/exception/.svn/entries new file mode 100644 index 0000000..af5b9e8 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/warranty/exception/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/com/fp/warranty/exception +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +WarrantyException.java +file + + + + +2022-07-28T03:40:36.052774Z +0dba8f60b97a28f8ecab5c5c14848523 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1243 + diff --git a/base/dto/common/src/main/java/com/fp/warranty/exception/.svn/text-base/WarrantyException.java.svn-base b/base/dto/common/src/main/java/com/fp/warranty/exception/.svn/text-base/WarrantyException.java.svn-base new file mode 100644 index 0000000..bb88a88 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/warranty/exception/.svn/text-base/WarrantyException.java.svn-base @@ -0,0 +1,37 @@ +package com.fp.warranty.exception; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepciones del paquete de garantias + * @author jarias + */ +@javax.ejb.ApplicationException(rollback = true) +public class WarrantyException extends APPException { + + /** + * Version de la clase + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de WarrantyException + * @param code Codigo de mensaje aplicativo + * @param message Mensaje aplicativo + * @param pCause Excepcion original,cuando esta no se origina en apis de terceros + * @param pParameters Arreglo de parametros a presentar adicionales al mensaje aplicativo + */ + public WarrantyException(String code, String message, Exception pCause, Object... pParameters) { + super(code, message, pCause, pParameters); + } + + /** + * Crea una instancia de WarrantyException + * @param code Codigo de mensaje aplicativo + * @param message Mensaje aplicativo + * @param pParameters Arreglo de parametros a presentar adicionales al mensaje aplicativo + */ + public WarrantyException(String code, String message, Object... pParameters) { + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/com/fp/warranty/exception/WarrantyException.java b/base/dto/common/src/main/java/com/fp/warranty/exception/WarrantyException.java new file mode 100644 index 0000000..bb88a88 --- /dev/null +++ b/base/dto/common/src/main/java/com/fp/warranty/exception/WarrantyException.java @@ -0,0 +1,37 @@ +package com.fp.warranty.exception; + +import com.fp.common.exception.APPException; + +/** + * Manejo de excepciones del paquete de garantias + * @author jarias + */ +@javax.ejb.ApplicationException(rollback = true) +public class WarrantyException extends APPException { + + /** + * Version de la clase + */ + private static final long serialVersionUID = 1L; + + /** + * Crea una instancia de WarrantyException + * @param code Codigo de mensaje aplicativo + * @param message Mensaje aplicativo + * @param pCause Excepcion original,cuando esta no se origina en apis de terceros + * @param pParameters Arreglo de parametros a presentar adicionales al mensaje aplicativo + */ + public WarrantyException(String code, String message, Exception pCause, Object... pParameters) { + super(code, message, pCause, pParameters); + } + + /** + * Crea una instancia de WarrantyException + * @param code Codigo de mensaje aplicativo + * @param message Mensaje aplicativo + * @param pParameters Arreglo de parametros a presentar adicionales al mensaje aplicativo + */ + public WarrantyException(String code, String message, Object... pParameters) { + super(code, message, pParameters); + } +} diff --git a/base/dto/common/src/main/java/test/.svn/entries b/base/dto/common/src/main/java/test/.svn/entries new file mode 100644 index 0000000..4c866a4 --- /dev/null +++ b/base/dto/common/src/main/java/test/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/dto/common/src/main/java/test/com/.svn/entries b/base/dto/common/src/main/java/test/com/.svn/entries new file mode 100644 index 0000000..be9c795 --- /dev/null +++ b/base/dto/common/src/main/java/test/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/test/com +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/dto/common/src/main/java/test/com/fp/.svn/entries b/base/dto/common/src/main/java/test/com/fp/.svn/entries new file mode 100644 index 0000000..e092678 --- /dev/null +++ b/base/dto/common/src/main/java/test/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/test/com/fp +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +json +dir + diff --git a/base/dto/common/src/main/java/test/com/fp/json/.svn/entries b/base/dto/common/src/main/java/test/com/fp/json/.svn/entries new file mode 100644 index 0000000..e7cf4ad --- /dev/null +++ b/base/dto/common/src/main/java/test/com/fp/json/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/java/test/com/fp/json +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TestingBean.java +file + + + + +2022-07-28T03:40:34.007765Z +12b7fc9c14894f964bee67d2274a1c78 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1689 + +TestingBean1.java +file + + + + +2022-07-28T03:40:34.007765Z +e68118692b2098390c3f5b6710691622 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +899 + +TestingBeanKey.java +file + + + + +2022-07-28T03:40:34.007765Z +fcb0372cf587e07ac0fb80dfc686bdcf +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +530 + diff --git a/base/dto/common/src/main/java/test/com/fp/json/.svn/text-base/TestingBean.java.svn-base b/base/dto/common/src/main/java/test/com/fp/json/.svn/text-base/TestingBean.java.svn-base new file mode 100644 index 0000000..f250969 --- /dev/null +++ b/base/dto/common/src/main/java/test/com/fp/json/.svn/text-base/TestingBean.java.svn-base @@ -0,0 +1,98 @@ +package test.com.fp.json; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; + +import com.fp.dto.AbstractDataTransport; + +public class TestingBean extends AbstractDataTransport { + + /** + * + */ + private static final long serialVersionUID = 1L; + private Date date; + private Timestamp timestamp; + private String string; + private int entero; + private BigDecimal amount; + private boolean flag; + private TestingBeanKey pk; + + public TestingBean() { + + } + + public TestingBean(Date date, Timestamp timestamp, String string, int entero, BigDecimal amount, boolean flag) { + this.date = date; + this.timestamp = timestamp; + this.string = string; + this.entero = entero; + this.amount = amount; + this.flag = flag; + } + + @Override + public Object cloneMe() throws CloneNotSupportedException { + TestingBean p = (TestingBean) this.clone(); + return p; + } + + public BigDecimal getAmount() { + return amount; + } + + public Date getDate() { + return date; + } + + public int getEntero() { + return entero; + } + + public TestingBeanKey getPk() { + return pk; + } + + public String getString() { + return string; + } + + public Timestamp getTimestamp() { + return timestamp; + } + + public boolean isFlag() { + return flag; + } + + public void setAmount(BigDecimal amount) { + this.amount = amount; + } + + public void setDate(Date date) { + this.date = date; + } + + public void setEntero(int entero) { + this.entero = entero; + } + + public void setFlag(boolean flag) { + this.flag = flag; + } + + public void setPk(TestingBeanKey pk) { + this.pk = pk; + } + + public void setString(String string) { + this.string = string; + } + + public void setTimestamp(Timestamp timestamp) { + this.timestamp = timestamp; + } + +} diff --git a/base/dto/common/src/main/java/test/com/fp/json/.svn/text-base/TestingBean1.java.svn-base b/base/dto/common/src/main/java/test/com/fp/json/.svn/text-base/TestingBean1.java.svn-base new file mode 100644 index 0000000..15a2dd0 --- /dev/null +++ b/base/dto/common/src/main/java/test/com/fp/json/.svn/text-base/TestingBean1.java.svn-base @@ -0,0 +1,57 @@ +package test.com.fp.json; + + +import com.fp.dto.AbstractDataTransport; + +public class TestingBean1 extends AbstractDataTransport { + + /** + * + */ + private static final long serialVersionUID = 1L; + private String string; + private int entero; + private long pk; + + public TestingBean1() { + + } + @Override + public Object cloneMe() throws CloneNotSupportedException { + TestingBean1 p = (TestingBean1) this.clone(); + return p; + } + + + public TestingBean1(String string, int entero,long pk) { + this.string = string; + this.entero = entero; + this.pk=pk; + } + + public int getEntero() { + return entero; + } + + public void setEntero(int entero) { + this.entero = entero; + } + + public long getPk() { + return pk; + } + + public void setPk(long pk) { + this.pk = pk; + } + + public String getString() { + return string; + } + + public void setString(String string) { + this.string = string; + } + + +} diff --git a/base/dto/common/src/main/java/test/com/fp/json/.svn/text-base/TestingBeanKey.java.svn-base b/base/dto/common/src/main/java/test/com/fp/json/.svn/text-base/TestingBeanKey.java.svn-base new file mode 100644 index 0000000..6969def --- /dev/null +++ b/base/dto/common/src/main/java/test/com/fp/json/.svn/text-base/TestingBeanKey.java.svn-base @@ -0,0 +1,32 @@ +package test.com.fp.json; + +import com.fp.dto.hb.HibernateId; + +public class TestingBeanKey implements HibernateId{ + private String campo1; + private Long campo2; + + public TestingBeanKey() { + } + + public TestingBeanKey(String campo1, Long campo2) { + this.campo1 = campo1; + this.campo2 = campo2; + } + + public String getCampo1() { + return campo1; + } + + public Long getCampo2() { + return campo2; + } + + public void setCampo1(String campo1) { + this.campo1 = campo1; + } + + public void setCampo2(Long campo2) { + this.campo2 = campo2; + } +} diff --git a/base/dto/common/src/main/java/test/com/fp/json/TestingBean.java b/base/dto/common/src/main/java/test/com/fp/json/TestingBean.java new file mode 100644 index 0000000..f250969 --- /dev/null +++ b/base/dto/common/src/main/java/test/com/fp/json/TestingBean.java @@ -0,0 +1,98 @@ +package test.com.fp.json; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; + +import com.fp.dto.AbstractDataTransport; + +public class TestingBean extends AbstractDataTransport { + + /** + * + */ + private static final long serialVersionUID = 1L; + private Date date; + private Timestamp timestamp; + private String string; + private int entero; + private BigDecimal amount; + private boolean flag; + private TestingBeanKey pk; + + public TestingBean() { + + } + + public TestingBean(Date date, Timestamp timestamp, String string, int entero, BigDecimal amount, boolean flag) { + this.date = date; + this.timestamp = timestamp; + this.string = string; + this.entero = entero; + this.amount = amount; + this.flag = flag; + } + + @Override + public Object cloneMe() throws CloneNotSupportedException { + TestingBean p = (TestingBean) this.clone(); + return p; + } + + public BigDecimal getAmount() { + return amount; + } + + public Date getDate() { + return date; + } + + public int getEntero() { + return entero; + } + + public TestingBeanKey getPk() { + return pk; + } + + public String getString() { + return string; + } + + public Timestamp getTimestamp() { + return timestamp; + } + + public boolean isFlag() { + return flag; + } + + public void setAmount(BigDecimal amount) { + this.amount = amount; + } + + public void setDate(Date date) { + this.date = date; + } + + public void setEntero(int entero) { + this.entero = entero; + } + + public void setFlag(boolean flag) { + this.flag = flag; + } + + public void setPk(TestingBeanKey pk) { + this.pk = pk; + } + + public void setString(String string) { + this.string = string; + } + + public void setTimestamp(Timestamp timestamp) { + this.timestamp = timestamp; + } + +} diff --git a/base/dto/common/src/main/java/test/com/fp/json/TestingBean1.java b/base/dto/common/src/main/java/test/com/fp/json/TestingBean1.java new file mode 100644 index 0000000..15a2dd0 --- /dev/null +++ b/base/dto/common/src/main/java/test/com/fp/json/TestingBean1.java @@ -0,0 +1,57 @@ +package test.com.fp.json; + + +import com.fp.dto.AbstractDataTransport; + +public class TestingBean1 extends AbstractDataTransport { + + /** + * + */ + private static final long serialVersionUID = 1L; + private String string; + private int entero; + private long pk; + + public TestingBean1() { + + } + @Override + public Object cloneMe() throws CloneNotSupportedException { + TestingBean1 p = (TestingBean1) this.clone(); + return p; + } + + + public TestingBean1(String string, int entero,long pk) { + this.string = string; + this.entero = entero; + this.pk=pk; + } + + public int getEntero() { + return entero; + } + + public void setEntero(int entero) { + this.entero = entero; + } + + public long getPk() { + return pk; + } + + public void setPk(long pk) { + this.pk = pk; + } + + public String getString() { + return string; + } + + public void setString(String string) { + this.string = string; + } + + +} diff --git a/base/dto/common/src/main/java/test/com/fp/json/TestingBeanKey.java b/base/dto/common/src/main/java/test/com/fp/json/TestingBeanKey.java new file mode 100644 index 0000000..6969def --- /dev/null +++ b/base/dto/common/src/main/java/test/com/fp/json/TestingBeanKey.java @@ -0,0 +1,32 @@ +package test.com.fp.json; + +import com.fp.dto.hb.HibernateId; + +public class TestingBeanKey implements HibernateId{ + private String campo1; + private Long campo2; + + public TestingBeanKey() { + } + + public TestingBeanKey(String campo1, Long campo2) { + this.campo1 = campo1; + this.campo2 = campo2; + } + + public String getCampo1() { + return campo1; + } + + public Long getCampo2() { + return campo2; + } + + public void setCampo1(String campo1) { + this.campo1 = campo1; + } + + public void setCampo2(Long campo2) { + this.campo2 = campo2; + } +} diff --git a/base/dto/common/src/main/resources/.svn/entries b/base/dto/common/src/main/resources/.svn/entries new file mode 100644 index 0000000..8f0ead6 --- /dev/null +++ b/base/dto/common/src/main/resources/.svn/entries @@ -0,0 +1,198 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/main/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +userMessages_es_EC.properties +file + + + + +2022-07-28T03:40:36.381775Z +d95fc1b90d5259a40af3f1e38cc9db56 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1409 + +userMessages.properties +file + + + + +2022-07-28T03:40:36.381775Z +cbe71e321df31b3db992d6ad9f8e45fe +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1644 + +commonmessages_es.properties +file + + + + +2022-07-28T03:40:36.382776Z +c76f2059ca257484bce81a4bd365464c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1382 + +userMessages_es.properties +file + + + + +2022-07-28T03:40:36.382776Z +cc30ed36fa09216feafdc626dfabf633 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1409 + +exceptions.properties +file + + + + +2022-07-28T03:40:36.382776Z +26f8346d07d225644537cd265314553f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1042 + diff --git a/base/dto/common/src/main/resources/.svn/text-base/commonmessages_es.properties.svn-base b/base/dto/common/src/main/resources/.svn/text-base/commonmessages_es.properties.svn-base new file mode 100644 index 0000000..d9a8874 --- /dev/null +++ b/base/dto/common/src/main/resources/.svn/text-base/commonmessages_es.properties.svn-base @@ -0,0 +1,19 @@ +COMMON-0001=Prueba 1 +COMMON-0002=La cuenta se encuentra en estado {0} +COMMON-0003=El usuario {0} no tiene permitido dep\u00F3sitos mayores a {1,number,currency} +COMMON-0005=El saldo promedio de la cuenta {0} al {1,date,dd-MMM-yyyy} es {2,number,###,###,##0.00} +COMMON-0006=PROCESO {0} A EJECUTAR NO DEFINIDO MODULE: {1} TRANS: {2} VERSION {3} +COMMON-0007=PROCESO {0} A EJECUTAR MODULE: {1} TRANS: {2} VERSION {3} NO IMPLEMENTA {4} +COMMON-0008=PROCESO A EJECUTAR NO DEFINIDAS EN TGENETRANSACTIONPROCESS MODULE: {1} TRANS: {2} VERSION {3} +COMMON-0009=PROCESO {0} A EJECUTAR NO DEFINIDO EN TGENEBATCHPREVIOUSPROCESS MOD: {1} TRAN: {2} VER: {3} +COMMON-0010=PROCESO {0} A EJECUTAR NO IMPLEMENTA: {0} MOD: {1} TRAN: {2} VER: {3} +COMMON-0011=PROCESO {0} A EJECUTAR NO DEFINIDO EN TGENEBATCHPROCESS MOD: {1} TRAN: {2} VER: {3} +COMMON-0012=CLASE {0} A EJECUTAR NO EXISTE CODE: {0} +COMMON-0013=PROCESO {0} A EJECUTAR CODE: {1} NO IMPLEMENTA QUERYRULE +COMMON-0014=CLASE {0} A EJECUTAR NO EXISTE MODULE: {1} TRANS: {2} VERSION {3} +COMMON-0015=PROCESO {0} A EJECUTAR MODULE: {1} TRANS: {2} VERSION {3} NO IMPLEMENTA {4} +COMMON-0016=PROCESOS BATCH NO DEFINIDOS EN TGENEBATCH MODULE: {0} TRANS: {1} VERSION {2} +COMMON-0017=CLASE A EJECUTAR NODEFINIDA EN TGENEBATCHPROCESS ACTION:{0}, MOD: {1} TRANMOD:{2} TRAN:{3} VER: {4} +COMMON-0018=USUARIO INACTIVO +COMMON-0019= +COMMON-0020= \ No newline at end of file diff --git a/base/dto/common/src/main/resources/.svn/text-base/exceptions.properties.svn-base b/base/dto/common/src/main/resources/.svn/text-base/exceptions.properties.svn-base new file mode 100644 index 0000000..b0868f5 --- /dev/null +++ b/base/dto/common/src/main/resources/.svn/text-base/exceptions.properties.svn-base @@ -0,0 +1,12 @@ +java.sql.SQLException=com.fp.common.exception.SQLExceptionManager +java.sql.SQLSyntaxErrorException=com.fp.common.exception.SQLExceptionManager +java.sql.BatchUpdateException=com.fp.common.exception.SQLExceptionManager +java.sql.SQLIntegrityConstraintViolationException=com.fp.common.exception.SQLExceptionManager +org.hibernate.exception.ConstraintViolationException=com.fp.common.exception.SQLExceptionManager +javax.persistence.PersistenceException=com.fp.common.exception.SQLExceptionManager +org.hibernate.exception.GenericJDBCException=com.fp.common.exception.SQLExceptionManager +org.hibernate.NonUniqueObjectException=com.fp.common.exception.NonUniqueObjectException +org.hibernate.PropertyValueException=com.fp.common.exception.PropertyValueException +org.hibernate.StaleObjectStateException=com.fp.common.exception.StaleObjectStateException +org.hibernate.id.IdentifierGenerationException=com.fp.common.exception.IdentifierGenerationException +javax.persistence.EntityExistsException=com.fp.common.exception.NonUniqueObjectException \ No newline at end of file diff --git a/base/dto/common/src/main/resources/.svn/text-base/userMessages.properties.svn-base b/base/dto/common/src/main/resources/.svn/text-base/userMessages.properties.svn-base new file mode 100644 index 0000000..3600b17 --- /dev/null +++ b/base/dto/common/src/main/resources/.svn/text-base/userMessages.properties.svn-base @@ -0,0 +1,20 @@ +it4b.success = TRANSACCI\u00d3N REALIZADA CORRECTAMENTE +java.lang.ClassNotFoundException = APLICACI\u00d3N NO INSTALADA CORRECTAMENTE. CONTACTE AL ADMINISTRADOR DEL SISTEMA +java.lang.NoClassDefFoundError = APLICACI\u00d3N NO INSTALADA CORRECTAMENTE. CONTACTE AL ADMINISTRADOR DEL SISTEMA +java.lang.NullPointerException = ERROR NO CONTROLADO EN LA APLICACI\u00d3N. CONTACTE AL PROVEEDOR +java.lang.NumberFormatException = SE ESPERABA UN VALOR NUM\u00c9RICO +sql-not-null=VALOR REQUERIDO PARA LA TABLA: [{0}] CAMPO: [{1}] +StaleObjectStateException=REGISTRO DE LA TABLA: [{0}] MODIFICADO EN OTRA SESI\u00d3N, RECONSULTE LOS DATOS +NonUniqueObjectException=ESTA INGRESANDO REGISTROS DUPLICADOS EN LA TABLA: [{0}] +PropertyValueException=VALOR REQUERIDO PARA LA TABLA: [{0}] CAMPO: [{1}] +fk=NO EXISTE REFERENCIA DE [{0}] EN [{1}] +fkg=NO SE PUEDE INSERTAR EL REGISTRO DE LA TABLA {0} PORQUE EXISTE REFERENCIA EN EL CONSTRAINT {1} HACIA OTRA TABLA +fk1=NO SE PUEDE ELIMINAR EL REGISTRO YA QUE SE ENCUENTRA REFERENCIADO [{0}] EN [{1}] +fk1g=NO SE PUEDE ELIMINAR EL REGISTRO DE LA TABLA {0} PORQUE EXISTE REFERENCIA EN EL CONSTRAINT {1} HACIA OTRA TABLA +sql.unique=NO PUEDE INGRESAR UN REGISTRO QUE YA EXISTE: [{0}] +lock=RECURSO EN USO INTENTE NUEVAMENTE: [{0}] +valuelarger=EL VALOR INGRESADO SOBREPASA LA LONGITUD PERMITIDA DEL CAMPO +valueLargerWithValue=EL VALOR INGRESADO EN LA TABLA {0} EN EL CAMPO {1} SOBREPASA LA LONGITUD PERMITIDA {2} +sql.uniqueID=N\u00daMERO DE IDENTIFICACI\u00d3N YA EXISTE: [{0}] +fk.informix=NO SE PUEDE ELIMINAR EL REGISTRO YA QUE SE ENCUENTRA REFERENCIADO:[{0}] +sql.uniqueIDINF=N\u00daMERO DE IDENTIFICACI\u00d3N YA EXISTE \ No newline at end of file diff --git a/base/dto/common/src/main/resources/.svn/text-base/userMessages_es.properties.netbeans-base b/base/dto/common/src/main/resources/.svn/text-base/userMessages_es.properties.netbeans-base new file mode 100644 index 0000000..17b4915 --- /dev/null +++ b/base/dto/common/src/main/resources/.svn/text-base/userMessages_es.properties.netbeans-base @@ -0,0 +1,17 @@ +it4b.success = TRANSACCION REALIZADA CORRECTAMENTE +java.lang.ClassNotFoundException = APLICACION NO INSTALADA CORRECTAMENTE. CONTACTE AL ADMINISTRADOR DEL SISTEMA +java.lang.NoClassDefFoundError = APLICACION NO INSTALADA CORRECTAMENTE. CONTACTE AL ADMINISTRADOR DEL SISTEMA +java.lang.NullPointerException = ERROR NO CONTROLADO EN LA APLICACION. CONTACTE AL PROVEEDOR +java.lang.NumberFormatException = SE ESPERABA UN VALOR NUMERICO +sql-not-null=VALOR REQUERIDO PARA LA TABLA: [{0}] CAMPO: [{1}] +StaleObjectStateException=REGISTRO DE LA TABLA: [{0}] MODIFICADO EN OTRA SESI\u00d3N, RECONSULTE LOS DATOS +NonUniqueObjectException=ESTA INGRESANDO REGISTROS DUPLICADOS EN LA TABLA: [{0}] +PropertyValueException=VALOR REQUERIDO PARA LA TABLA: [{0}] CAMPO: [{1}] +fk=NO EXISTE REFERENCIA DE [{0}] EN [{1}] +fkg=NO SE PUEDE INSERTAR EL REGISTRO DE LA TABLA {0} PORQUE EXISTE REFERENCIA EN EL CONSTRAINT {1} HACIA OTRA TABLA +fk1=NO SE PUEDE ELIMINAR EL REGISTRO YA QUE SE ENCUENTRA REFERENCIADO [{0}] EN [{1}] +fk1g=NO SE PUEDE ELIMINAR EL REGISTRO DE LA TABLA {0} PORQUE EXISTE REFERENCIA EN EL CONSTRAINT {1} HACIA OTRA TABLA +sql.unique=NO PUEDE INGRESAR UN REGISTRO QUE YA EXISTE: [{0}] +lock=RECURSO EN USO INTENTE NUEVAMENTE: [{0}] +valuelarger=EL VALOR INGRESADO SOBREPASA LA LONGITUD PERMITIDA DEL CAMPO +valueLargerWithValue=EL VALOR INGRESADO EN LA TABLA {0} EN EL CAMPO {1} SOBREPASA LA LONGITUD PERMITIDA {2} \ No newline at end of file diff --git a/base/dto/common/src/main/resources/.svn/text-base/userMessages_es.properties.svn-base b/base/dto/common/src/main/resources/.svn/text-base/userMessages_es.properties.svn-base new file mode 100644 index 0000000..17b4915 --- /dev/null +++ b/base/dto/common/src/main/resources/.svn/text-base/userMessages_es.properties.svn-base @@ -0,0 +1,17 @@ +it4b.success = TRANSACCION REALIZADA CORRECTAMENTE +java.lang.ClassNotFoundException = APLICACION NO INSTALADA CORRECTAMENTE. CONTACTE AL ADMINISTRADOR DEL SISTEMA +java.lang.NoClassDefFoundError = APLICACION NO INSTALADA CORRECTAMENTE. CONTACTE AL ADMINISTRADOR DEL SISTEMA +java.lang.NullPointerException = ERROR NO CONTROLADO EN LA APLICACION. CONTACTE AL PROVEEDOR +java.lang.NumberFormatException = SE ESPERABA UN VALOR NUMERICO +sql-not-null=VALOR REQUERIDO PARA LA TABLA: [{0}] CAMPO: [{1}] +StaleObjectStateException=REGISTRO DE LA TABLA: [{0}] MODIFICADO EN OTRA SESI\u00d3N, RECONSULTE LOS DATOS +NonUniqueObjectException=ESTA INGRESANDO REGISTROS DUPLICADOS EN LA TABLA: [{0}] +PropertyValueException=VALOR REQUERIDO PARA LA TABLA: [{0}] CAMPO: [{1}] +fk=NO EXISTE REFERENCIA DE [{0}] EN [{1}] +fkg=NO SE PUEDE INSERTAR EL REGISTRO DE LA TABLA {0} PORQUE EXISTE REFERENCIA EN EL CONSTRAINT {1} HACIA OTRA TABLA +fk1=NO SE PUEDE ELIMINAR EL REGISTRO YA QUE SE ENCUENTRA REFERENCIADO [{0}] EN [{1}] +fk1g=NO SE PUEDE ELIMINAR EL REGISTRO DE LA TABLA {0} PORQUE EXISTE REFERENCIA EN EL CONSTRAINT {1} HACIA OTRA TABLA +sql.unique=NO PUEDE INGRESAR UN REGISTRO QUE YA EXISTE: [{0}] +lock=RECURSO EN USO INTENTE NUEVAMENTE: [{0}] +valuelarger=EL VALOR INGRESADO SOBREPASA LA LONGITUD PERMITIDA DEL CAMPO +valueLargerWithValue=EL VALOR INGRESADO EN LA TABLA {0} EN EL CAMPO {1} SOBREPASA LA LONGITUD PERMITIDA {2} \ No newline at end of file diff --git a/base/dto/common/src/main/resources/.svn/text-base/userMessages_es_EC.properties.svn-base b/base/dto/common/src/main/resources/.svn/text-base/userMessages_es_EC.properties.svn-base new file mode 100644 index 0000000..0827acb --- /dev/null +++ b/base/dto/common/src/main/resources/.svn/text-base/userMessages_es_EC.properties.svn-base @@ -0,0 +1,17 @@ +flip.success = TRANSACCION REALIZADA CORRECTAMENTE +java.lang.ClassNotFoundException = APLICACION NO INSTALADA CORRECTAMENTE. CONTACTE AL ADMINISTRADOR DEL SISTEMA +java.lang.NoClassDefFoundError = APLICACION NO INSTALADA CORRECTAMENTE. CONTACTE AL ADMINISTRADOR DEL SISTEMA +java.lang.NullPointerException = ERROR NO CONTROLADO EN LA APLICACION. CONTACTE AL PROVEEDOR +java.lang.NumberFormatException = SE ESPERABA UN VALOR NUMERICO +sql-not-null=VALOR REQUERIDO PARA LA TABLA: [{0}] CAMPO: [{1}] +StaleObjectStateException=REGISTRO DE LA TABLA: [{0}] MODIFICADO EN OTRA SESI\u00d3N, RECONSULTE LOS DATOS +NonUniqueObjectException=ESTA INGRESANDO REGISTROS DUPLICADOS EN LA TABLA: [{0}] +PropertyValueException=VALOR REQUERIDO PARA LA TABLA: [{0}] CAMPO: [{1}] +fk=NO EXISTE REFERENCIA DE [{0}] EN [{1}] +fkg=NO SE PUEDE INSERTAR EL REGISTRO DE LA TABLA {0} PORQUE EXISTE REFERENCIA EN EL CONSTRAINT {1} HACIA OTRA TABLA +fk1=NO SE PUEDE ELIMINAR EL REGISTRO YA QUE SE ENCUENTRA REFERENCIADO [{0}] EN [{1}] +fk1g=NO SE PUEDE ELIMINAR EL REGISTRO DE LA TABLA {0} PORQUE EXISTE REFERENCIA EN EL CONSTRAINT {1} HACIA OTRA TABLA +sql.unique=NO PUEDE INGRESAR UN REGISTRO QUE YA EXISTE: [{0}] +lock=RECURSO EN USO INTENTE NUEVAMENTE: [{0}] +valuelarger=EL VALOR INGRESADO SOBREPASA LA LONGITUD PERMITIDA DEL CAMPO +valueLargerWithValue=EL VALOR INGRESADO EN LA TABLA {0} EN EL CAMPO {1} SOBREPASA LA LONGITUD PERMITIDA {2} \ No newline at end of file diff --git a/base/dto/common/src/main/resources/commonmessages_es.properties b/base/dto/common/src/main/resources/commonmessages_es.properties new file mode 100644 index 0000000..d9a8874 --- /dev/null +++ b/base/dto/common/src/main/resources/commonmessages_es.properties @@ -0,0 +1,19 @@ +COMMON-0001=Prueba 1 +COMMON-0002=La cuenta se encuentra en estado {0} +COMMON-0003=El usuario {0} no tiene permitido dep\u00F3sitos mayores a {1,number,currency} +COMMON-0005=El saldo promedio de la cuenta {0} al {1,date,dd-MMM-yyyy} es {2,number,###,###,##0.00} +COMMON-0006=PROCESO {0} A EJECUTAR NO DEFINIDO MODULE: {1} TRANS: {2} VERSION {3} +COMMON-0007=PROCESO {0} A EJECUTAR MODULE: {1} TRANS: {2} VERSION {3} NO IMPLEMENTA {4} +COMMON-0008=PROCESO A EJECUTAR NO DEFINIDAS EN TGENETRANSACTIONPROCESS MODULE: {1} TRANS: {2} VERSION {3} +COMMON-0009=PROCESO {0} A EJECUTAR NO DEFINIDO EN TGENEBATCHPREVIOUSPROCESS MOD: {1} TRAN: {2} VER: {3} +COMMON-0010=PROCESO {0} A EJECUTAR NO IMPLEMENTA: {0} MOD: {1} TRAN: {2} VER: {3} +COMMON-0011=PROCESO {0} A EJECUTAR NO DEFINIDO EN TGENEBATCHPROCESS MOD: {1} TRAN: {2} VER: {3} +COMMON-0012=CLASE {0} A EJECUTAR NO EXISTE CODE: {0} +COMMON-0013=PROCESO {0} A EJECUTAR CODE: {1} NO IMPLEMENTA QUERYRULE +COMMON-0014=CLASE {0} A EJECUTAR NO EXISTE MODULE: {1} TRANS: {2} VERSION {3} +COMMON-0015=PROCESO {0} A EJECUTAR MODULE: {1} TRANS: {2} VERSION {3} NO IMPLEMENTA {4} +COMMON-0016=PROCESOS BATCH NO DEFINIDOS EN TGENEBATCH MODULE: {0} TRANS: {1} VERSION {2} +COMMON-0017=CLASE A EJECUTAR NODEFINIDA EN TGENEBATCHPROCESS ACTION:{0}, MOD: {1} TRANMOD:{2} TRAN:{3} VER: {4} +COMMON-0018=USUARIO INACTIVO +COMMON-0019= +COMMON-0020= \ No newline at end of file diff --git a/base/dto/common/src/main/resources/exceptions.properties b/base/dto/common/src/main/resources/exceptions.properties new file mode 100644 index 0000000..b0868f5 --- /dev/null +++ b/base/dto/common/src/main/resources/exceptions.properties @@ -0,0 +1,12 @@ +java.sql.SQLException=com.fp.common.exception.SQLExceptionManager +java.sql.SQLSyntaxErrorException=com.fp.common.exception.SQLExceptionManager +java.sql.BatchUpdateException=com.fp.common.exception.SQLExceptionManager +java.sql.SQLIntegrityConstraintViolationException=com.fp.common.exception.SQLExceptionManager +org.hibernate.exception.ConstraintViolationException=com.fp.common.exception.SQLExceptionManager +javax.persistence.PersistenceException=com.fp.common.exception.SQLExceptionManager +org.hibernate.exception.GenericJDBCException=com.fp.common.exception.SQLExceptionManager +org.hibernate.NonUniqueObjectException=com.fp.common.exception.NonUniqueObjectException +org.hibernate.PropertyValueException=com.fp.common.exception.PropertyValueException +org.hibernate.StaleObjectStateException=com.fp.common.exception.StaleObjectStateException +org.hibernate.id.IdentifierGenerationException=com.fp.common.exception.IdentifierGenerationException +javax.persistence.EntityExistsException=com.fp.common.exception.NonUniqueObjectException \ No newline at end of file diff --git a/base/dto/common/src/main/resources/userMessages.properties b/base/dto/common/src/main/resources/userMessages.properties new file mode 100644 index 0000000..3600b17 --- /dev/null +++ b/base/dto/common/src/main/resources/userMessages.properties @@ -0,0 +1,20 @@ +it4b.success = TRANSACCI\u00d3N REALIZADA CORRECTAMENTE +java.lang.ClassNotFoundException = APLICACI\u00d3N NO INSTALADA CORRECTAMENTE. CONTACTE AL ADMINISTRADOR DEL SISTEMA +java.lang.NoClassDefFoundError = APLICACI\u00d3N NO INSTALADA CORRECTAMENTE. CONTACTE AL ADMINISTRADOR DEL SISTEMA +java.lang.NullPointerException = ERROR NO CONTROLADO EN LA APLICACI\u00d3N. CONTACTE AL PROVEEDOR +java.lang.NumberFormatException = SE ESPERABA UN VALOR NUM\u00c9RICO +sql-not-null=VALOR REQUERIDO PARA LA TABLA: [{0}] CAMPO: [{1}] +StaleObjectStateException=REGISTRO DE LA TABLA: [{0}] MODIFICADO EN OTRA SESI\u00d3N, RECONSULTE LOS DATOS +NonUniqueObjectException=ESTA INGRESANDO REGISTROS DUPLICADOS EN LA TABLA: [{0}] +PropertyValueException=VALOR REQUERIDO PARA LA TABLA: [{0}] CAMPO: [{1}] +fk=NO EXISTE REFERENCIA DE [{0}] EN [{1}] +fkg=NO SE PUEDE INSERTAR EL REGISTRO DE LA TABLA {0} PORQUE EXISTE REFERENCIA EN EL CONSTRAINT {1} HACIA OTRA TABLA +fk1=NO SE PUEDE ELIMINAR EL REGISTRO YA QUE SE ENCUENTRA REFERENCIADO [{0}] EN [{1}] +fk1g=NO SE PUEDE ELIMINAR EL REGISTRO DE LA TABLA {0} PORQUE EXISTE REFERENCIA EN EL CONSTRAINT {1} HACIA OTRA TABLA +sql.unique=NO PUEDE INGRESAR UN REGISTRO QUE YA EXISTE: [{0}] +lock=RECURSO EN USO INTENTE NUEVAMENTE: [{0}] +valuelarger=EL VALOR INGRESADO SOBREPASA LA LONGITUD PERMITIDA DEL CAMPO +valueLargerWithValue=EL VALOR INGRESADO EN LA TABLA {0} EN EL CAMPO {1} SOBREPASA LA LONGITUD PERMITIDA {2} +sql.uniqueID=N\u00daMERO DE IDENTIFICACI\u00d3N YA EXISTE: [{0}] +fk.informix=NO SE PUEDE ELIMINAR EL REGISTRO YA QUE SE ENCUENTRA REFERENCIADO:[{0}] +sql.uniqueIDINF=N\u00daMERO DE IDENTIFICACI\u00d3N YA EXISTE \ No newline at end of file diff --git a/base/dto/common/src/main/resources/userMessages_es.properties b/base/dto/common/src/main/resources/userMessages_es.properties new file mode 100644 index 0000000..17b4915 --- /dev/null +++ b/base/dto/common/src/main/resources/userMessages_es.properties @@ -0,0 +1,17 @@ +it4b.success = TRANSACCION REALIZADA CORRECTAMENTE +java.lang.ClassNotFoundException = APLICACION NO INSTALADA CORRECTAMENTE. CONTACTE AL ADMINISTRADOR DEL SISTEMA +java.lang.NoClassDefFoundError = APLICACION NO INSTALADA CORRECTAMENTE. CONTACTE AL ADMINISTRADOR DEL SISTEMA +java.lang.NullPointerException = ERROR NO CONTROLADO EN LA APLICACION. CONTACTE AL PROVEEDOR +java.lang.NumberFormatException = SE ESPERABA UN VALOR NUMERICO +sql-not-null=VALOR REQUERIDO PARA LA TABLA: [{0}] CAMPO: [{1}] +StaleObjectStateException=REGISTRO DE LA TABLA: [{0}] MODIFICADO EN OTRA SESI\u00d3N, RECONSULTE LOS DATOS +NonUniqueObjectException=ESTA INGRESANDO REGISTROS DUPLICADOS EN LA TABLA: [{0}] +PropertyValueException=VALOR REQUERIDO PARA LA TABLA: [{0}] CAMPO: [{1}] +fk=NO EXISTE REFERENCIA DE [{0}] EN [{1}] +fkg=NO SE PUEDE INSERTAR EL REGISTRO DE LA TABLA {0} PORQUE EXISTE REFERENCIA EN EL CONSTRAINT {1} HACIA OTRA TABLA +fk1=NO SE PUEDE ELIMINAR EL REGISTRO YA QUE SE ENCUENTRA REFERENCIADO [{0}] EN [{1}] +fk1g=NO SE PUEDE ELIMINAR EL REGISTRO DE LA TABLA {0} PORQUE EXISTE REFERENCIA EN EL CONSTRAINT {1} HACIA OTRA TABLA +sql.unique=NO PUEDE INGRESAR UN REGISTRO QUE YA EXISTE: [{0}] +lock=RECURSO EN USO INTENTE NUEVAMENTE: [{0}] +valuelarger=EL VALOR INGRESADO SOBREPASA LA LONGITUD PERMITIDA DEL CAMPO +valueLargerWithValue=EL VALOR INGRESADO EN LA TABLA {0} EN EL CAMPO {1} SOBREPASA LA LONGITUD PERMITIDA {2} \ No newline at end of file diff --git a/base/dto/common/src/main/resources/userMessages_es_EC.properties b/base/dto/common/src/main/resources/userMessages_es_EC.properties new file mode 100644 index 0000000..0827acb --- /dev/null +++ b/base/dto/common/src/main/resources/userMessages_es_EC.properties @@ -0,0 +1,17 @@ +flip.success = TRANSACCION REALIZADA CORRECTAMENTE +java.lang.ClassNotFoundException = APLICACION NO INSTALADA CORRECTAMENTE. CONTACTE AL ADMINISTRADOR DEL SISTEMA +java.lang.NoClassDefFoundError = APLICACION NO INSTALADA CORRECTAMENTE. CONTACTE AL ADMINISTRADOR DEL SISTEMA +java.lang.NullPointerException = ERROR NO CONTROLADO EN LA APLICACION. CONTACTE AL PROVEEDOR +java.lang.NumberFormatException = SE ESPERABA UN VALOR NUMERICO +sql-not-null=VALOR REQUERIDO PARA LA TABLA: [{0}] CAMPO: [{1}] +StaleObjectStateException=REGISTRO DE LA TABLA: [{0}] MODIFICADO EN OTRA SESI\u00d3N, RECONSULTE LOS DATOS +NonUniqueObjectException=ESTA INGRESANDO REGISTROS DUPLICADOS EN LA TABLA: [{0}] +PropertyValueException=VALOR REQUERIDO PARA LA TABLA: [{0}] CAMPO: [{1}] +fk=NO EXISTE REFERENCIA DE [{0}] EN [{1}] +fkg=NO SE PUEDE INSERTAR EL REGISTRO DE LA TABLA {0} PORQUE EXISTE REFERENCIA EN EL CONSTRAINT {1} HACIA OTRA TABLA +fk1=NO SE PUEDE ELIMINAR EL REGISTRO YA QUE SE ENCUENTRA REFERENCIADO [{0}] EN [{1}] +fk1g=NO SE PUEDE ELIMINAR EL REGISTRO DE LA TABLA {0} PORQUE EXISTE REFERENCIA EN EL CONSTRAINT {1} HACIA OTRA TABLA +sql.unique=NO PUEDE INGRESAR UN REGISTRO QUE YA EXISTE: [{0}] +lock=RECURSO EN USO INTENTE NUEVAMENTE: [{0}] +valuelarger=EL VALOR INGRESADO SOBREPASA LA LONGITUD PERMITIDA DEL CAMPO +valueLargerWithValue=EL VALOR INGRESADO EN LA TABLA {0} EN EL CAMPO {1} SOBREPASA LA LONGITUD PERMITIDA {2} \ No newline at end of file diff --git a/base/dto/common/src/test/.svn/entries b/base/dto/common/src/test/.svn/entries new file mode 100644 index 0000000..c25a491 --- /dev/null +++ b/base/dto/common/src/test/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/dto/common/src/test/java/.svn/entries b/base/dto/common/src/test/java/.svn/entries new file mode 100644 index 0000000..f4bc478 --- /dev/null +++ b/base/dto/common/src/test/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/test/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + diff --git a/base/dto/common/src/test/java/test/.svn/entries b/base/dto/common/src/test/java/test/.svn/entries new file mode 100644 index 0000000..7ece153 --- /dev/null +++ b/base/dto/common/src/test/java/test/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/test/java/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/dto/common/src/test/java/test/com/.svn/entries b/base/dto/common/src/test/java/test/com/.svn/entries new file mode 100644 index 0000000..29e5d83 --- /dev/null +++ b/base/dto/common/src/test/java/test/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/test/java/test/com +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/dto/common/src/test/java/test/com/fp/.svn/entries b/base/dto/common/src/test/java/test/com/fp/.svn/entries new file mode 100644 index 0000000..bc26ba2 --- /dev/null +++ b/base/dto/common/src/test/java/test/com/fp/.svn/entries @@ -0,0 +1,37 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/test/java/test/com/fp +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +excel +dir + +common +dir + +json +dir + diff --git a/base/dto/common/src/test/java/test/com/fp/common/.svn/entries b/base/dto/common/src/test/java/test/com/fp/common/.svn/entries new file mode 100644 index 0000000..03b07a0 --- /dev/null +++ b/base/dto/common/src/test/java/test/com/fp/common/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/test/java/test/com/fp/common +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +InternationalitationTest.java +file + + + + +2022-07-28T03:40:33.755764Z +3f5e9a37a59c68e852d7abed6a092885 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +447 + +ELTest.java +file + + + + +2022-07-28T03:40:33.756764Z +d989352a15ddf533e7b643417e84d8a4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2457 + +MessageTest.java +file + + + + +2022-07-28T03:40:33.756764Z +e876389c9c49c75b91913ef85e578dc3 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3230 + diff --git a/base/dto/common/src/test/java/test/com/fp/common/.svn/text-base/ELTest.java.svn-base b/base/dto/common/src/test/java/test/com/fp/common/.svn/text-base/ELTest.java.svn-base new file mode 100644 index 0000000..7d1fbe0 --- /dev/null +++ b/base/dto/common/src/test/java/test/com/fp/common/.svn/text-base/ELTest.java.svn-base @@ -0,0 +1,65 @@ +package test.com.fp.common; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Assert; +import org.junit.Test; + +import test.com.fp.json.TestingBean; + +import com.fp.common.messages.ELEval; +import com.fp.dto.save.SaveBean; +import com.fp.dto.save.SaveRequest; + +public class ELTest { + private Map maia = new HashMap(); + + public ELTest() throws Exception { + SaveRequest sr = new SaveRequest(); + sr.setUser("GF"); + sr.setTransactionCode(150); + sr.put("OfficeName", "Prueba"); + sr.put("val", new BigDecimal("129983.89")); + sr.put("date", new Date(1323961406815L)); + SaveBean sb = new SaveBean("test.com.fp.json.TestingBean"); + TestingBean tb = new TestingBean(); + tb.setEntero(1200); + sb.addModifiedObject(tb); + sr.putSaveBean("aliasSaveBean", sb); + this.maia.put("request", sr); + } + + @Test + public void name() throws Exception { + Assert.assertEquals("User", "GF", ELEval.eval(this.maia, "request.user")); + Assert.assertEquals("User", String.class, ELEval.eval(this.maia, "request.user").getClass()); + } + + @Test + public void control() throws Exception { + Assert.assertEquals("Control", "Prueba", ELEval.eval(this.maia, "request.OfficeName")); + Assert.assertEquals("Control", String.class, ELEval.eval(this.maia, "request.OfficeName").getClass()); + } + + @Test + public void bigDecimal() throws Exception { + Assert.assertEquals("BigDecimal", new BigDecimal("129983.89"), ELEval.eval(this.maia, "request.val")); + Assert.assertEquals("BigDecimal", BigDecimal.class, ELEval.eval(this.maia, "request.val").getClass()); + } + + @Test + public void date() throws Exception { + Assert.assertEquals("Date", new Date(1323961406815L), ELEval.eval(this.maia, "request.date")); + Assert.assertEquals("Date", Date.class, ELEval.eval(this.maia, "request.date").getClass()); + } + + @Test + public void bean() throws Exception { + Assert.assertEquals("Bean", SaveBean.class, ELEval.eval(this.maia, "request.aliasSaveBean").getClass()); + Assert.assertEquals("Bean", TestingBean.class, ELEval.eval(this.maia, "request.aliasSaveBean.modifiedRecords[0]").getClass()); + Assert.assertEquals("Bean", 1200, ELEval.eval(this.maia, "request.aliasSaveBean.modifiedRecords[0].entero")); + } +} diff --git a/base/dto/common/src/test/java/test/com/fp/common/.svn/text-base/InternationalitationTest.java.svn-base b/base/dto/common/src/test/java/test/com/fp/common/.svn/text-base/InternationalitationTest.java.svn-base new file mode 100644 index 0000000..f92df14 --- /dev/null +++ b/base/dto/common/src/test/java/test/com/fp/common/.svn/text-base/InternationalitationTest.java.svn-base @@ -0,0 +1,17 @@ +package test.com.fp.common; + +import java.util.Locale; + +import junit.framework.TestCase; + +public class InternationalitationTest extends TestCase{ + @SuppressWarnings("unused") + public void testEnglish(){ + Locale[] loc=Locale.getAvailableLocales(); + for (Locale locale :loc ) { + //System.out.println("insert into tlanguage (clanguage,name) values('"+ locale.getLanguage()+"','"+locale.getDisplayLanguage()+"');"); + } + } +} + + diff --git a/base/dto/common/src/test/java/test/com/fp/common/.svn/text-base/MessageTest.java.svn-base b/base/dto/common/src/test/java/test/com/fp/common/.svn/text-base/MessageTest.java.svn-base new file mode 100644 index 0000000..0c46769 --- /dev/null +++ b/base/dto/common/src/test/java/test/com/fp/common/.svn/text-base/MessageTest.java.svn-base @@ -0,0 +1,92 @@ +package test.com.fp.common; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Assert; +import org.junit.Test; + +import com.fp.common.messages.MessageUtil; +import com.fp.dto.save.SaveRequest; + +public class MessageTest { + private MessageUtil mu; + + public MessageTest() throws Exception { + SaveRequest sr = new SaveRequest(); + sr.setUser("GF"); + sr.setTransactionCode(150); + sr.put("OfficeName", "Prueba"); + sr.put("val", new BigDecimal("129983.89")); + sr.put("per", new BigDecimal("83.89")); + sr.put("date", new Date(1323961406815L)); + this.mu = new MessageUtil("es"); + this.mu.setValue("name", "German Fiallos"); + this.mu.setValue("request", sr); + } + + @Test + public void name() throws Exception { + this.mu.setPattern("$name"); + Assert.assertEquals("Nombre", "German Fiallos", this.mu.getMessage()); + } + + @Test + public void user() throws Exception { + this.mu.setPattern("$request.user"); + Assert.assertEquals("Usuario", "GF", this.mu.getMessage()); + } + + @Test + public void transaction() throws Exception { + this.mu.setPattern("$request.transactionCode"); + Assert.assertEquals("Transaccion", "150", this.mu.getMessage()); + } + + @Test + public void date() throws Exception { + this.mu.setPattern("$date.format('yyyy-MM-dd', $request.date)"); + Assert.assertEquals("Date", "2011-12-15", this.mu.getMessage()); + this.mu.setPattern("$date.format('yyyy-MMM-dd', $request.date,$locate)"); + Assert.assertEquals("Date", "2011-dic-15", this.mu.getMessage()); + this.mu.setPattern("$date.format(\"EEEEEEEEEEEEEEEEE, d 'de' MMMMMMMMMM 'de' yyyy\", $request.date,$locate)"); + Assert.assertEquals("Date", "jueves, 15 de diciembre de 2011", this.mu.getMessage()); + + } + + @Test + public void amount() throws Exception { + this.mu.setPattern("$number.currency($request.val)"); + Assert.assertEquals("Monto", "$129,983.89", this.mu.getMessage()); + this.mu.setPattern("$number.format($request.val)"); + Assert.assertEquals("Monto", "129,983.89", this.mu.getMessage()); + } + + @Test + public void cond() throws Exception { + this.mu.setPattern("#if( $cond ) OK #else NO #end"); + this.mu.setValue("cond", Boolean.TRUE); + Assert.assertEquals("Date", " OK ", this.mu.getMessage()); + this.mu.setValue("cond", Boolean.FALSE); + Assert.assertEquals("Date", " NO ", this.mu.getMessage()); + } + + @Test + public void loop() throws Exception { + this.mu.setPattern("#foreach( $val in $list ) $val.code $val.value #end"); + List> data = new ArrayList>(); + for (int i = 0; i < 3; i++) { + Map rec = new HashMap(); + rec.put("code", i); + rec.put("value", "Prueba-" + i); + data.add(rec); + } + this.mu.setValue("list", data); + Assert.assertEquals("Date", " 0 Prueba-0 1 Prueba-1 2 Prueba-2 ", this.mu.getMessage()); + } + +} diff --git a/base/dto/common/src/test/java/test/com/fp/common/ELTest.java b/base/dto/common/src/test/java/test/com/fp/common/ELTest.java new file mode 100644 index 0000000..7d1fbe0 --- /dev/null +++ b/base/dto/common/src/test/java/test/com/fp/common/ELTest.java @@ -0,0 +1,65 @@ +package test.com.fp.common; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Assert; +import org.junit.Test; + +import test.com.fp.json.TestingBean; + +import com.fp.common.messages.ELEval; +import com.fp.dto.save.SaveBean; +import com.fp.dto.save.SaveRequest; + +public class ELTest { + private Map maia = new HashMap(); + + public ELTest() throws Exception { + SaveRequest sr = new SaveRequest(); + sr.setUser("GF"); + sr.setTransactionCode(150); + sr.put("OfficeName", "Prueba"); + sr.put("val", new BigDecimal("129983.89")); + sr.put("date", new Date(1323961406815L)); + SaveBean sb = new SaveBean("test.com.fp.json.TestingBean"); + TestingBean tb = new TestingBean(); + tb.setEntero(1200); + sb.addModifiedObject(tb); + sr.putSaveBean("aliasSaveBean", sb); + this.maia.put("request", sr); + } + + @Test + public void name() throws Exception { + Assert.assertEquals("User", "GF", ELEval.eval(this.maia, "request.user")); + Assert.assertEquals("User", String.class, ELEval.eval(this.maia, "request.user").getClass()); + } + + @Test + public void control() throws Exception { + Assert.assertEquals("Control", "Prueba", ELEval.eval(this.maia, "request.OfficeName")); + Assert.assertEquals("Control", String.class, ELEval.eval(this.maia, "request.OfficeName").getClass()); + } + + @Test + public void bigDecimal() throws Exception { + Assert.assertEquals("BigDecimal", new BigDecimal("129983.89"), ELEval.eval(this.maia, "request.val")); + Assert.assertEquals("BigDecimal", BigDecimal.class, ELEval.eval(this.maia, "request.val").getClass()); + } + + @Test + public void date() throws Exception { + Assert.assertEquals("Date", new Date(1323961406815L), ELEval.eval(this.maia, "request.date")); + Assert.assertEquals("Date", Date.class, ELEval.eval(this.maia, "request.date").getClass()); + } + + @Test + public void bean() throws Exception { + Assert.assertEquals("Bean", SaveBean.class, ELEval.eval(this.maia, "request.aliasSaveBean").getClass()); + Assert.assertEquals("Bean", TestingBean.class, ELEval.eval(this.maia, "request.aliasSaveBean.modifiedRecords[0]").getClass()); + Assert.assertEquals("Bean", 1200, ELEval.eval(this.maia, "request.aliasSaveBean.modifiedRecords[0].entero")); + } +} diff --git a/base/dto/common/src/test/java/test/com/fp/common/InternationalitationTest.java b/base/dto/common/src/test/java/test/com/fp/common/InternationalitationTest.java new file mode 100644 index 0000000..f92df14 --- /dev/null +++ b/base/dto/common/src/test/java/test/com/fp/common/InternationalitationTest.java @@ -0,0 +1,17 @@ +package test.com.fp.common; + +import java.util.Locale; + +import junit.framework.TestCase; + +public class InternationalitationTest extends TestCase{ + @SuppressWarnings("unused") + public void testEnglish(){ + Locale[] loc=Locale.getAvailableLocales(); + for (Locale locale :loc ) { + //System.out.println("insert into tlanguage (clanguage,name) values('"+ locale.getLanguage()+"','"+locale.getDisplayLanguage()+"');"); + } + } +} + + diff --git a/base/dto/common/src/test/java/test/com/fp/common/MessageTest.java b/base/dto/common/src/test/java/test/com/fp/common/MessageTest.java new file mode 100644 index 0000000..0c46769 --- /dev/null +++ b/base/dto/common/src/test/java/test/com/fp/common/MessageTest.java @@ -0,0 +1,92 @@ +package test.com.fp.common; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Assert; +import org.junit.Test; + +import com.fp.common.messages.MessageUtil; +import com.fp.dto.save.SaveRequest; + +public class MessageTest { + private MessageUtil mu; + + public MessageTest() throws Exception { + SaveRequest sr = new SaveRequest(); + sr.setUser("GF"); + sr.setTransactionCode(150); + sr.put("OfficeName", "Prueba"); + sr.put("val", new BigDecimal("129983.89")); + sr.put("per", new BigDecimal("83.89")); + sr.put("date", new Date(1323961406815L)); + this.mu = new MessageUtil("es"); + this.mu.setValue("name", "German Fiallos"); + this.mu.setValue("request", sr); + } + + @Test + public void name() throws Exception { + this.mu.setPattern("$name"); + Assert.assertEquals("Nombre", "German Fiallos", this.mu.getMessage()); + } + + @Test + public void user() throws Exception { + this.mu.setPattern("$request.user"); + Assert.assertEquals("Usuario", "GF", this.mu.getMessage()); + } + + @Test + public void transaction() throws Exception { + this.mu.setPattern("$request.transactionCode"); + Assert.assertEquals("Transaccion", "150", this.mu.getMessage()); + } + + @Test + public void date() throws Exception { + this.mu.setPattern("$date.format('yyyy-MM-dd', $request.date)"); + Assert.assertEquals("Date", "2011-12-15", this.mu.getMessage()); + this.mu.setPattern("$date.format('yyyy-MMM-dd', $request.date,$locate)"); + Assert.assertEquals("Date", "2011-dic-15", this.mu.getMessage()); + this.mu.setPattern("$date.format(\"EEEEEEEEEEEEEEEEE, d 'de' MMMMMMMMMM 'de' yyyy\", $request.date,$locate)"); + Assert.assertEquals("Date", "jueves, 15 de diciembre de 2011", this.mu.getMessage()); + + } + + @Test + public void amount() throws Exception { + this.mu.setPattern("$number.currency($request.val)"); + Assert.assertEquals("Monto", "$129,983.89", this.mu.getMessage()); + this.mu.setPattern("$number.format($request.val)"); + Assert.assertEquals("Monto", "129,983.89", this.mu.getMessage()); + } + + @Test + public void cond() throws Exception { + this.mu.setPattern("#if( $cond ) OK #else NO #end"); + this.mu.setValue("cond", Boolean.TRUE); + Assert.assertEquals("Date", " OK ", this.mu.getMessage()); + this.mu.setValue("cond", Boolean.FALSE); + Assert.assertEquals("Date", " NO ", this.mu.getMessage()); + } + + @Test + public void loop() throws Exception { + this.mu.setPattern("#foreach( $val in $list ) $val.code $val.value #end"); + List> data = new ArrayList>(); + for (int i = 0; i < 3; i++) { + Map rec = new HashMap(); + rec.put("code", i); + rec.put("value", "Prueba-" + i); + data.add(rec); + } + this.mu.setValue("list", data); + Assert.assertEquals("Date", " 0 Prueba-0 1 Prueba-1 2 Prueba-2 ", this.mu.getMessage()); + } + +} diff --git a/base/dto/common/src/test/java/test/com/fp/excel/.svn/entries b/base/dto/common/src/test/java/test/com/fp/excel/.svn/entries new file mode 100644 index 0000000..e1f043c --- /dev/null +++ b/base/dto/common/src/test/java/test/com/fp/excel/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/test/java/test/com/fp/excel +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ExcelToMapMain.java +file + + + + +2022-07-28T03:40:33.699764Z +13dbbeeb2d477bfe5ed3ac7b778f281c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1275 + diff --git a/base/dto/common/src/test/java/test/com/fp/excel/.svn/text-base/ExcelToMapMain.java.svn-base b/base/dto/common/src/test/java/test/com/fp/excel/.svn/text-base/ExcelToMapMain.java.svn-base new file mode 100644 index 0000000..5c56c6d --- /dev/null +++ b/base/dto/common/src/test/java/test/com/fp/excel/.svn/text-base/ExcelToMapMain.java.svn-base @@ -0,0 +1,46 @@ +package test.com.fp.excel; + +import com.fp.excel.*; +import java.io.FileNotFoundException; +import java.util.List; +import java.util.Map; + + +/** + * + * @author Ingeniero Marco Almeida P. + * 23-Dic-2011 + */ +public class ExcelToMapMain implements ExcelToMapMessages{ + + /** + * @param args the command line arguments + */ + public static void main(String[] args) throws FileNotFoundException { + + ExcelToMap wmp = new ExcelToMap (ExcelToMapMain.FILE_PATH); + + if(wmp.get_Workbook_Status().equals(ExcelToMapMain.WORKBOOK_CREATED)){ + + List> ldata = wmp.get_Especific_Data(0,11,0,2); + + for(Map mp : ldata){ + + String key = "0:1"; + + if(mp.containsKey(key)){ + Object obj = mp.get(key); + System.out.println(obj.toString()); + }else{ + Object obj = "blank"; + System.out.println(obj.toString()); + } + } + + }else{ + + System.err.println(wmp.get_Workbook_Status()); + + } + } +} diff --git a/base/dto/common/src/test/java/test/com/fp/excel/ExcelToMapMain.java b/base/dto/common/src/test/java/test/com/fp/excel/ExcelToMapMain.java new file mode 100644 index 0000000..5c56c6d --- /dev/null +++ b/base/dto/common/src/test/java/test/com/fp/excel/ExcelToMapMain.java @@ -0,0 +1,46 @@ +package test.com.fp.excel; + +import com.fp.excel.*; +import java.io.FileNotFoundException; +import java.util.List; +import java.util.Map; + + +/** + * + * @author Ingeniero Marco Almeida P. + * 23-Dic-2011 + */ +public class ExcelToMapMain implements ExcelToMapMessages{ + + /** + * @param args the command line arguments + */ + public static void main(String[] args) throws FileNotFoundException { + + ExcelToMap wmp = new ExcelToMap (ExcelToMapMain.FILE_PATH); + + if(wmp.get_Workbook_Status().equals(ExcelToMapMain.WORKBOOK_CREATED)){ + + List> ldata = wmp.get_Especific_Data(0,11,0,2); + + for(Map mp : ldata){ + + String key = "0:1"; + + if(mp.containsKey(key)){ + Object obj = mp.get(key); + System.out.println(obj.toString()); + }else{ + Object obj = "blank"; + System.out.println(obj.toString()); + } + } + + }else{ + + System.err.println(wmp.get_Workbook_Status()); + + } + } +} diff --git a/base/dto/common/src/test/java/test/com/fp/json/.svn/entries b/base/dto/common/src/test/java/test/com/fp/json/.svn/entries new file mode 100644 index 0000000..1568011 --- /dev/null +++ b/base/dto/common/src/test/java/test/com/fp/json/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/test/java/test/com/fp/json +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +SerializerTest.java +file + + + + +2022-07-28T03:40:33.777764Z +8913394653b158829e9d99f235fbc682 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +25542 + diff --git a/base/dto/common/src/test/java/test/com/fp/json/.svn/text-base/SerializerTest.java.svn-base b/base/dto/common/src/test/java/test/com/fp/json/.svn/text-base/SerializerTest.java.svn-base new file mode 100644 index 0000000..89687a1 --- /dev/null +++ b/base/dto/common/src/test/java/test/com/fp/json/.svn/text-base/SerializerTest.java.svn-base @@ -0,0 +1,426 @@ +package test.com.fp.json; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import junit.framework.TestCase; + +import com.fp.dto.fin.FinancialRequest; +import com.fp.dto.json.Serializer; +import com.fp.dto.save.SaveRequest; + +public class SerializerTest extends TestCase { + @SuppressWarnings("unchecked") + public void compareList(List pExtected, List pData) { + TestCase.assertEquals(pExtected.size(), pData.size()); + for (int i = 0; i < pExtected.size(); i++) { + this.compareTestingBean((TestingBean) pExtected.get(i), (TestingBean) pData.get(i)); + } + } + + public void compareTestingBean(TestingBean pExtected, TestingBean pData) { + TestCase.assertEquals(pExtected.getEntero(), pData.getEntero()); + TestCase.assertEquals(pExtected.getString(), pData.getString()); + TestCase.assertEquals(pExtected.getAmount(), pData.getAmount()); + TestCase.assertEquals(pExtected.getDate(), pData.getDate()); + TestCase.assertEquals(pExtected.getTimestamp(), pData.getTimestamp()); + TestCase.assertEquals(pExtected.isFlag(), pData.isFlag()); + TestCase.assertEquals(pExtected.getTransportBeanClass(), pData.getTransportBeanClass()); + } + + public void testBean2JSON() throws Exception { + long time = 1228088753000L; + long date = 1228021200000L; + TestingBean bean = new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true); + Serializer ser = new Serializer(bean); + System.out.println(ser.toJSON()); + } + + public void testBean2JSON1() throws Exception { + long time = 1228088753000L; + long date = 1228021200000L; + TestingBean bean = new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true); + bean.setPk(new TestingBeanKey("Prueba", 21L)); + Serializer ser = new Serializer(bean); + System.out.println(">>>>>>>>>>>>>>>>>>>" + ser.toJSON()); + System.out.println(">>>>>>>>>>>>>>>>>>>" + ser.toXML()); + } + + public void testJson2Bean1() throws Exception { + String json = "{\"amount\":12.34,\"timestamp\":\"2008-11-30 18:45:53\",\"flag\":true,\"pk_campo2\":21,\"string\":\"Value\",\"pk_campo1\":\"Prueba\",\"entero\":10,\"transportBeanClass\":\"test.com.fp.json.TestingBean\",\"date\":\"2008-11-30\",\"pk_transportBeanClass\":\"test.com.fp.json.TestingBeanKey\",\"modified\":false}"; + Serializer ser = new Serializer(json); + TestingBean b = (TestingBean) ser.toObject(TestingBean.class); + System.out.println(b); + } + + public void testQueryRequest() throws Exception { + FinancialRequest fr = new FinancialRequest(); + fr.setBranchCode(1); + fr.setUser("gf"); + fr.setCreditAccount("aaaaa"); + Serializer ser = new Serializer(fr); + System.out.println(">>>>>>>>>>>>>>>>>>>" + ser.toJSON()); + } + + public void testBean2JSONAdditional() throws Exception { + long time = 1228088753000L; + long date = 1228021200000L; + TestingBean bean = new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true); + bean.setPk(new TestingBeanKey("Prueba", 21L)); + bean.addAddtionalInfo("add1", "Des1"); + bean.addAddtionalInfo("add2", "Des2"); + Serializer ser = new Serializer(bean); + System.out.println(">>>>>>>>>>>>>>>>>>>" + ser.toJSON()); + System.out.println(">>>>>>>>>>>>>>>>>>>" + ser.toXML()); + ser = new Serializer(new TestingBean1("Prueba", 12, 13)); + System.out.println(">>>>>>>>>>>>>>>>>>>" + ser.toJSON()); + System.out.println(">>>>>>>>>>>>>>>>>>>" + ser.toXML()); + } + + public void testBean2XML() throws Exception { + long time = 1228088753000L; + long date = 1228021200000L; + TestingBean bean = new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true); + Serializer ser = new Serializer(bean); + System.out.println("Bean a XML"); + System.out.println(ser.toXML()); + } + + public void testJSON2Bean() throws Exception { + long time = 1228088753000L; + long date = 1228021200000L; + TestingBean expected = new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true); + String data = "{\"amount\":12.34,\"date\":\"2008-11-30\",\"entero\":10,\"flag\":true,\"string\":\"Value\",\"timestamp\":\"2008-11-30 18:45:53\",\"transportBeanClass\":\"test.com.fp.json.TestingBean\"}"; + Serializer ser = new Serializer(data); + TestingBean json = (TestingBean) ser.toObject(TestingBean.class); + this.compareTestingBean(expected, json); + } + + public void testJSON2Bean1() throws Exception { + long time = 1228088753000L; + long date = 1228021200000L; + TestingBean expected = new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true); + expected.setPk(new TestingBeanKey("Prueba", 21L)); + String data = "{\"amount\":12.34,\"date\":\"2008-11-30\",\"deleted\":false,\"entero\":10,\"flag\":true,\"modified\":false,\"pk\":{\"campo1\":\"Prueba\",\"campo2\":21},\"string\":\"Value\",\"timestamp\":\"2008-11-30 18:45:53\",\"transportBeanClass\":\"test.com.fp.json.TestingBean\"}"; + Serializer ser = new Serializer(data); + TestingBean json = (TestingBean) ser.toObject(TestingBean.class); + this.compareTestingBean(expected, json); + } + + @SuppressWarnings("unchecked") + public void testJSON2Map() throws Exception { + Map expected = new HashMap(); + expected.put("booleano", true); + expected.put("int", 10); + expected.put("string", "Valor"); + expected.put("monto", new BigDecimal("1200.43")); + long time = 1228088753000L; + long date = 1228021200000L; + expected.put("date", new Date(date)); + expected.put("timestamp", new Timestamp(time)); + String data = "{\"monto\":1200.43,\"string\":\"Valor\",\"int\":10,\"timestamp\":\"2008-11-30 18:45:53\",\"date\":\"2008-11-30\",\"booleano\":true}"; + Serializer ser = new Serializer(data); + Map json = (Map) ser.toObject(Map.class); + Set keys = expected.keySet(); + for (String key : keys) { + Object ex = expected.get(key); + Object obj = json.get(key); + TestCase.assertEquals(ex.getClass(), obj.getClass()); + TestCase.assertEquals(ex, obj); + } + } + + @SuppressWarnings("unchecked") + public void testJSON2MapBean() throws Exception { + Map expected = new HashMap(); + expected.put("booleano", true); + expected.put("int", 10); + expected.put("string", "Valor"); + expected.put("monto", new BigDecimal("1200.43")); + long time = 1228088753000L; + long date = 1228021200000L; + expected.put("date", new Date(date)); + expected.put("timestamp", new Timestamp(time)); + expected.put("bean", new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true)); + String data = "{\"monto\":1200.43,\"string\":\"Valor\",\"monto1\":1200,\"int\":10,\"timestamp\":\"2008-11-30 18:45:53\",\"date\":\"2008-11-30\",\"bean\":{\"amount\":12.34,\"date\":\"2008-11-30\",\"entero\":10,\"flag\":true,\"string\":\"Value\",\"timestamp\":\"2008-11-30 18:45:53\",\"transportBeanClass\":\"test.com.fp.json.TestingBean\"},\"booleano\":true}"; + Serializer ser = new Serializer(data); + Map json = (Map) ser.toObject(Map.class); + Set keys = expected.keySet(); + for (String key : keys) { + Object ex = expected.get(key); + Object obj = json.get(key); + TestCase.assertEquals(ex.getClass(), obj.getClass()); + if (ex instanceof TestingBean) { + this.compareTestingBean((TestingBean) ex, (TestingBean) obj); + } else { + TestCase.assertEquals(ex, obj); + } + } + } + + @SuppressWarnings("unchecked") + public void testJSON2MapBeanArray() throws Exception { + Map expected = new HashMap(); + expected.put("booleano", true); + expected.put("int", 10); + expected.put("string", "Valor"); + expected.put("monto", new BigDecimal("1200.43")); + long time = 1228088753000L; + long date = 1228021200000L; + expected.put("date", new Date(date)); + expected.put("timestamp", new Timestamp(time)); + List arr = new ArrayList(); + arr.add(new TestingBean(new Date(date), new Timestamp(time), "Value1", 10, new BigDecimal("12.34"), true)); + arr.add(new TestingBean(new Date(date), new Timestamp(time), "Value1", 10, new BigDecimal("111.34"), false)); + expected.put("bean", arr); + String data = "{\"monto\":1200.43,\"string\":\"Valor\",\"int\":10,\"timestamp\":\"2008-11-30 18:45:53\",\"date\":\"2008-11-30\",\"bean\":[{\"amount\":12.34,\"date\":\"2008-11-30\",\"entero\":10,\"flag\":true,\"string\":\"Value1\",\"timestamp\":\"2008-11-30 18:45:53\",\"transportBeanClass\":\"test.com.fp.json.TestingBean\"},{\"amount\":111.34,\"date\":\"2008-11-30\",\"entero\":10,\"flag\":false,\"string\":\"Value1\",\"timestamp\":\"2008-11-30 18:45:53\",\"transportBeanClass\":\"test.com.fp.json.TestingBean\"}],\"booleano\":true}"; + Serializer ser = new Serializer(data); + Map json = (Map) ser.toObject(Map.class); + Set keys = expected.keySet(); + for (String key : keys) { + Object ex = expected.get(key); + Object obj = json.get(key); + if (ex instanceof List) { + compareList((List) ex, (List) obj); + } else { + TestCase.assertEquals("" + ex + "<-->" + obj, ex.getClass(), obj.getClass()); + TestCase.assertEquals("" + ex.getClass().getName() + "<-->" + obj.getClass().getName(), ex, obj); + } + } + } + + public void testMap2JSON() throws Exception { + Map data = new HashMap(); + data.put("booleano", true); + data.put("int", 10); + data.put("string", "Valor"); + data.put("monto", new BigDecimal("1200.43")); + data.put("monto1", new BigDecimal("1200")); + long time = 1228088753000L; + long date = 1228021200000L; + data.put("date", new Date(date)); + data.put("timestamp", new Timestamp(time)); + Serializable sData = (Serializable) data; + Serializer ser = new Serializer(sData); + System.out.println(ser.toJSON()); + + } + + public void testMap2XML() throws Exception { + Map data = new HashMap(); + data.put("booleano", true); + data.put("int", 10); + data.put("string", "Valor"); + data.put("monto", new BigDecimal("1200.43")); + data.put("monto1", new BigDecimal("1200")); + long time = 1228088753000L; + long date = 1228021200000L; + data.put("date", new Date(date)); + data.put("timestamp", new Timestamp(time)); + Serializable sData = (Serializable) data; + Serializer ser = new Serializer(sData); + System.out.println("MAP a XML"); + System.out.println(ser.toXML()); + // String expected = + // "\ntrue2008-11-30101200.431200Valor2008-11-30 18:45:53"; + } + + public void testMapBean2JSON() throws Exception { + Map data = new HashMap(); + data.put("booleano", true); + data.put("int", 10); + data.put("string", "Valor"); + data.put("monto", new BigDecimal("1200.43")); + data.put("monto1", new BigDecimal("1200")); + long time = 1228088753000L; + long date = 1228021200000L; + data.put("date", new Date(date)); + data.put("timestamp", new Timestamp(time)); + data.put("bean", new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true)); + Serializable sData = (Serializable) data; + Serializer ser = new Serializer(sData); + System.out.println(ser.toJSON()); + } + + public void testMapBean2XML() throws Exception { + Map data = new HashMap(); + data.put("booleano", true); + data.put("int", 10); + data.put("string", "Valor"); + data.put("monto", new BigDecimal("1200.43")); + data.put("monto1", new BigDecimal("1200")); + long time = 1228088753000L; + long date = 1228021200000L; + data.put("date", new Date(date)); + data.put("timestamp", new Timestamp(time)); + data.put("bean", new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true)); + Serializable sData = (Serializable) data; + Serializer ser = new Serializer(sData); + System.out.println("Map Bean a XML"); + System.out.println(ser.toXML()); + + } + + public void testMapBeanArray2JSON() throws Exception { + Map data = new HashMap(); + data.put("booleano", true); + data.put("int", 10); + data.put("string", "Valor"); + data.put("monto", new BigDecimal("1200.43")); + data.put("monto1", new BigDecimal("1200")); + long time = 1228088753000L; + long date = 1228021200000L; + data.put("date", new Date(date)); + data.put("timestamp", new Timestamp(time)); + List arr = new ArrayList(); + arr.add(new TestingBean(new Date(date), new Timestamp(time), "Value1", 10, new BigDecimal("12.34"), true)); + arr.add(new TestingBean(new Date(date), new Timestamp(time), "Value1", 10, new BigDecimal("111.34"), false)); + data.put("bean", arr); + Serializable sData = (Serializable) data; + Serializer ser = new Serializer(sData); + System.out.println(ser.toJSON()); + } + + public void testMapBeanArray2XML() throws Exception { + Map data = new HashMap(); + data.put("booleano", true); + data.put("int", 10); + data.put("string", "Valor"); + data.put("monto", new BigDecimal("1200.43")); + data.put("monto1", new BigDecimal("1200")); + long time = 1228088753000L; + long date = 1228021200000L; + data.put("date", new Date(date)); + data.put("timestamp", new Timestamp(time)); + List arr = new ArrayList(); + arr.add(new TestingBean(new Date(date), new Timestamp(time), "Value1", 10, new BigDecimal("12.34"), true)); + arr.add(new TestingBean(new Date(date), new Timestamp(time), "Value1", 10, new BigDecimal("111.34"), false)); + data.put("bean", arr); + Serializable sData = (Serializable) data; + Serializer ser = new Serializer(sData); + System.out.println("MAP ARRAY"); + System.out.println(ser.toXML()); + + } + + public void testXML2Bean() throws Exception { + long time = 1228088753000L; + long date = 1228021200000L; + TestingBean expected = new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true); + String data = "12.342008-11-3010trueValue2008-11-30 18:45:53test.com.fp.json.TestingBean"; + Serializer ser = new Serializer(data, true); + TestingBean json = (TestingBean) ser.toObject(TestingBean.class); + this.compareTestingBean(expected, json); + } + + public void testXML2Bean1() throws Exception { + long time = 1228088753000L; + long date = 1228021200000L; + TestingBean expected = new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true); + expected.setPk(new TestingBeanKey("Prueba", 21L)); + String data = " 12.342008-11-30false10truefalsePrueba21Value2008-11-30 18:45:53test.com.fp.json.TestingBean"; + Serializer ser = new Serializer(data, true); + TestingBean json = (TestingBean) ser.toObject(TestingBean.class); + this.compareTestingBean(expected, json); + } + + @SuppressWarnings("unchecked") + public void testXML2Map() throws Exception { + Map expected = new HashMap(); + expected.put("booleano", true); + expected.put("int", 10); + expected.put("string", "Valor"); + expected.put("monto", new BigDecimal("1200.43")); + long time = 1228088753000L; + long date = 1228021200000L; + expected.put("date", new Date(date)); + expected.put("timestamp", new Timestamp(time)); + String data = "\ntrue2008-11-30101200.431200Valor2008-11-30 18:45:53"; + Serializer ser = new Serializer(data, true); + Map json = (Map) ser.toObject(Map.class); + Set keys = expected.keySet(); + for (String key : keys) { + Object ex = expected.get(key); + Object obj = json.get(key); + TestCase.assertEquals(ex.getClass(), obj.getClass()); + TestCase.assertEquals(ex, obj); + } + } + + @SuppressWarnings("unchecked") + public void testXML2MapBean() throws Exception { + Map expected = new HashMap(); + expected.put("booleano", true); + expected.put("int", 10); + expected.put("string", "Valor"); + expected.put("monto", new BigDecimal("1200.43")); + long time = 1228088753000L; + long date = 1228021200000L; + expected.put("date", new Date(date)); + expected.put("timestamp", new Timestamp(time)); + expected.put("bean", new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true)); + String data = "12.342008-11-3010trueValue2008-11-30 18:45:53test.com.fp.json.TestingBeantrue2008-11-30101200.431200Valor2008-11-30 18:45:53"; + Serializer ser = new Serializer(data, true); + Map json = (Map) ser.toObject(Map.class); + Set keys = expected.keySet(); + for (String key : keys) { + Object ex = expected.get(key); + Object obj = json.get(key); + TestCase.assertEquals(ex.getClass(), obj.getClass()); + if (ex instanceof TestingBean) { + this.compareTestingBean((TestingBean) ex, (TestingBean) obj); + } else { + TestCase.assertEquals(ex, obj); + } + } + } + + /* + * public void testFinancial() throws Exception{ try{ String + * xml=StreamHelper.readFile("/home/gfiallos/temp/flip/a.xml"); Serializer ser=new Serializer(xml, true); + * FinancialRequest fr=(FinancialRequest)ser.toObject(FinancialRequest.class); Serializer ser1=new Serializer(fr); + * System.out.print(">>>"+ser1.toJSON()); }catch(Exception e){ e.printStackTrace(); } } + */ + /* + * private void testBeanPersistenteToJSON() throws Exception{ SaveRequest sq = new SaveRequest(); long time = + * 1228088753000L; long date = 1228021200000L; TestingBean expected = new TestingBean(new Date(date), new + * Timestamp(time), "Value", 10, new BigDecimal("12.34"), true); sq.putSaveBean("A", expected); Serializer ser = new + * Serializer(sq); String dataJSON=ser.toJSON(); String dataExpected= + * "{\"officeCode\":null,\"journalId\":null,\"channelCode\":null,\"authorizedUser\":null,\"A\":{\"deletedObject\":null,\"beanName\":\"A\",\"automatic\":true,\"modifiedObject\":{\"amount\":12.34,\"timestamp\":\"2008-11-30 18:45:53\",\"flag\":true,\"string\":\"Value\",\"entero\":10,\"transportBeanClass\":\"test.com.fp.json.TestingBean\",\"date\":\"2008-11-30\",\"modified\":false,\"pk\":null},\"modifiedRecords\":[],\"transportBeanClass\":\"com.fp.dto.save.SaveBean\",\"deletedRecords\":[],\"modified\":false},\"transactionCode\":null,\"transactionVersion\":null,\"internalUserCode\":null,\"branchCode\":null,\"lOrderPersistentBeans\":[\"A\"],\"modified\":false,\"terminalCode\":null,\"company\":null,\"transactionModule\":null,\"language\":null,\"transportBeanClass\":\"com.fp.dto.save.SaveRequest\",\"user\":null,\"profile\":null}" + * ; System.out.println("BeanPersistenteToJSON "+dataJSON); TestCase.assertEquals(dataExpected, dataJSON); + * + * } + */ + public void testBeanPersistente() throws Exception { + String json = "{\"officeCode\":null,\"journalId\":null,\"channelCode\":null,\"authorizedUser\":null,\"A\":{\"deletedObject\":null,\"beanName\":\"A\",\"automatic\":true,\"modifiedObject\":{\"amount\":12.34,\"timestamp\":\"2008-11-30 18:45:53\",\"flag\":true,\"string\":\"Value\",\"entero\":10,\"transportBeanClass\":\"test.com.fp.json.TestingBean\",\"date\":\"2008-11-30\",\"pk\":null},\"modifiedRecords\":[],\"transportBeanClass\":\"com.fp.dto.save.SaveBean\",\"deletedRecords\":[]},\"transactionCode\":null,\"transactionVersion\":null,\"internalUserCode\":null,\"branchCode\":null,\"lOrderPersistentBeans\":[\"A\"],\"terminalCode\":null,\"company\":null,\"transactionModule\":null,\"language\":null,\"transportBeanClass\":\"com.fp.dto.save.SaveRequest\",\"user\":null,\"profile\":null}"; + SaveRequest sq = new SaveRequest(); + long time = 1228088753000L; + long date = 1228021200000L; + TestingBean expected = new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true); + sq.putSaveBean("A", expected); + Serializer ser = new Serializer(json); + SaveRequest srData = (SaveRequest) ser.toObject(SaveRequest.class); + TestingBean val = (TestingBean) srData.getSaveBeanModifiedObject("A"); + + TestCase.assertEquals(expected.toString(), val.toString()); + + } + + public void testFinancial1() throws Exception { + try { + String json = "{\"accountingVoucher\":false,\"newAccountOffice\":null,\"officeCode\":1,\"journalId\":null,\"authorizedUser\":null,\"transactionCode\":200,\"transactionVersion\":1,\"newSubProduct\":null,\"onLine\":true,\"document\":\"ABC\",\"area\":\"1\",\"terminalCode\":\"ter-jvc\",\"commentary\":null,\"originalTransactionModule\":null,\"transactionModule\":\"11\",\"accountingDate\":null,\"processDate\":null,\"profile\":1,\"reverse\":\"N\",\"journalIdReverse\":null,\"valueDate\":null,\"creditQuotaNumber\":null,\"channelCode\":\"PC\",\"depositCode\":null,\"financialItems\":[{\"account\":\"[]\",\"accountStatus\":\"[]\",\"accountingCode\":\"[]\",\"amount\":100,\"companyAccount\":0,\"creditType\":\"[]\",\"currecy\":\"USD\",\"destinyBranch\":0,\"destinyOffice\":0,\"expirationDate\":\"\",\"itemCode\":1,\"overdrawCatalog\":\"[]\",\"overdrawCatalogCode\":\"[]\",\"quotaNumber\":0,\"repeating\":false}],\"creditAccount\":null,\"settlement\":null,\"transactionMode\":\"N\",\"branchCode\":1,\"newAccountBranch\":null,\"modified\":false,\"debitAccount\":\"1110000001\",\"originalTransactionVersion\":null,\"company\":1,\"debitQuotaNumber\":null,\"workingDate\":null,\"language\":\"ES\",\"transportBeanClass\":\"com.fp.dto.fin.FinancialRequest\",\"originalTransactionCode\":null,\"user\":\"jvaca\"}"; + Serializer ser = new Serializer(json); + FinancialRequest fr = (FinancialRequest) ser.toObject(FinancialRequest.class); + System.out.print(fr); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/base/dto/common/src/test/java/test/com/fp/json/SerializerTest.java b/base/dto/common/src/test/java/test/com/fp/json/SerializerTest.java new file mode 100644 index 0000000..89687a1 --- /dev/null +++ b/base/dto/common/src/test/java/test/com/fp/json/SerializerTest.java @@ -0,0 +1,426 @@ +package test.com.fp.json; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import junit.framework.TestCase; + +import com.fp.dto.fin.FinancialRequest; +import com.fp.dto.json.Serializer; +import com.fp.dto.save.SaveRequest; + +public class SerializerTest extends TestCase { + @SuppressWarnings("unchecked") + public void compareList(List pExtected, List pData) { + TestCase.assertEquals(pExtected.size(), pData.size()); + for (int i = 0; i < pExtected.size(); i++) { + this.compareTestingBean((TestingBean) pExtected.get(i), (TestingBean) pData.get(i)); + } + } + + public void compareTestingBean(TestingBean pExtected, TestingBean pData) { + TestCase.assertEquals(pExtected.getEntero(), pData.getEntero()); + TestCase.assertEquals(pExtected.getString(), pData.getString()); + TestCase.assertEquals(pExtected.getAmount(), pData.getAmount()); + TestCase.assertEquals(pExtected.getDate(), pData.getDate()); + TestCase.assertEquals(pExtected.getTimestamp(), pData.getTimestamp()); + TestCase.assertEquals(pExtected.isFlag(), pData.isFlag()); + TestCase.assertEquals(pExtected.getTransportBeanClass(), pData.getTransportBeanClass()); + } + + public void testBean2JSON() throws Exception { + long time = 1228088753000L; + long date = 1228021200000L; + TestingBean bean = new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true); + Serializer ser = new Serializer(bean); + System.out.println(ser.toJSON()); + } + + public void testBean2JSON1() throws Exception { + long time = 1228088753000L; + long date = 1228021200000L; + TestingBean bean = new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true); + bean.setPk(new TestingBeanKey("Prueba", 21L)); + Serializer ser = new Serializer(bean); + System.out.println(">>>>>>>>>>>>>>>>>>>" + ser.toJSON()); + System.out.println(">>>>>>>>>>>>>>>>>>>" + ser.toXML()); + } + + public void testJson2Bean1() throws Exception { + String json = "{\"amount\":12.34,\"timestamp\":\"2008-11-30 18:45:53\",\"flag\":true,\"pk_campo2\":21,\"string\":\"Value\",\"pk_campo1\":\"Prueba\",\"entero\":10,\"transportBeanClass\":\"test.com.fp.json.TestingBean\",\"date\":\"2008-11-30\",\"pk_transportBeanClass\":\"test.com.fp.json.TestingBeanKey\",\"modified\":false}"; + Serializer ser = new Serializer(json); + TestingBean b = (TestingBean) ser.toObject(TestingBean.class); + System.out.println(b); + } + + public void testQueryRequest() throws Exception { + FinancialRequest fr = new FinancialRequest(); + fr.setBranchCode(1); + fr.setUser("gf"); + fr.setCreditAccount("aaaaa"); + Serializer ser = new Serializer(fr); + System.out.println(">>>>>>>>>>>>>>>>>>>" + ser.toJSON()); + } + + public void testBean2JSONAdditional() throws Exception { + long time = 1228088753000L; + long date = 1228021200000L; + TestingBean bean = new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true); + bean.setPk(new TestingBeanKey("Prueba", 21L)); + bean.addAddtionalInfo("add1", "Des1"); + bean.addAddtionalInfo("add2", "Des2"); + Serializer ser = new Serializer(bean); + System.out.println(">>>>>>>>>>>>>>>>>>>" + ser.toJSON()); + System.out.println(">>>>>>>>>>>>>>>>>>>" + ser.toXML()); + ser = new Serializer(new TestingBean1("Prueba", 12, 13)); + System.out.println(">>>>>>>>>>>>>>>>>>>" + ser.toJSON()); + System.out.println(">>>>>>>>>>>>>>>>>>>" + ser.toXML()); + } + + public void testBean2XML() throws Exception { + long time = 1228088753000L; + long date = 1228021200000L; + TestingBean bean = new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true); + Serializer ser = new Serializer(bean); + System.out.println("Bean a XML"); + System.out.println(ser.toXML()); + } + + public void testJSON2Bean() throws Exception { + long time = 1228088753000L; + long date = 1228021200000L; + TestingBean expected = new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true); + String data = "{\"amount\":12.34,\"date\":\"2008-11-30\",\"entero\":10,\"flag\":true,\"string\":\"Value\",\"timestamp\":\"2008-11-30 18:45:53\",\"transportBeanClass\":\"test.com.fp.json.TestingBean\"}"; + Serializer ser = new Serializer(data); + TestingBean json = (TestingBean) ser.toObject(TestingBean.class); + this.compareTestingBean(expected, json); + } + + public void testJSON2Bean1() throws Exception { + long time = 1228088753000L; + long date = 1228021200000L; + TestingBean expected = new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true); + expected.setPk(new TestingBeanKey("Prueba", 21L)); + String data = "{\"amount\":12.34,\"date\":\"2008-11-30\",\"deleted\":false,\"entero\":10,\"flag\":true,\"modified\":false,\"pk\":{\"campo1\":\"Prueba\",\"campo2\":21},\"string\":\"Value\",\"timestamp\":\"2008-11-30 18:45:53\",\"transportBeanClass\":\"test.com.fp.json.TestingBean\"}"; + Serializer ser = new Serializer(data); + TestingBean json = (TestingBean) ser.toObject(TestingBean.class); + this.compareTestingBean(expected, json); + } + + @SuppressWarnings("unchecked") + public void testJSON2Map() throws Exception { + Map expected = new HashMap(); + expected.put("booleano", true); + expected.put("int", 10); + expected.put("string", "Valor"); + expected.put("monto", new BigDecimal("1200.43")); + long time = 1228088753000L; + long date = 1228021200000L; + expected.put("date", new Date(date)); + expected.put("timestamp", new Timestamp(time)); + String data = "{\"monto\":1200.43,\"string\":\"Valor\",\"int\":10,\"timestamp\":\"2008-11-30 18:45:53\",\"date\":\"2008-11-30\",\"booleano\":true}"; + Serializer ser = new Serializer(data); + Map json = (Map) ser.toObject(Map.class); + Set keys = expected.keySet(); + for (String key : keys) { + Object ex = expected.get(key); + Object obj = json.get(key); + TestCase.assertEquals(ex.getClass(), obj.getClass()); + TestCase.assertEquals(ex, obj); + } + } + + @SuppressWarnings("unchecked") + public void testJSON2MapBean() throws Exception { + Map expected = new HashMap(); + expected.put("booleano", true); + expected.put("int", 10); + expected.put("string", "Valor"); + expected.put("monto", new BigDecimal("1200.43")); + long time = 1228088753000L; + long date = 1228021200000L; + expected.put("date", new Date(date)); + expected.put("timestamp", new Timestamp(time)); + expected.put("bean", new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true)); + String data = "{\"monto\":1200.43,\"string\":\"Valor\",\"monto1\":1200,\"int\":10,\"timestamp\":\"2008-11-30 18:45:53\",\"date\":\"2008-11-30\",\"bean\":{\"amount\":12.34,\"date\":\"2008-11-30\",\"entero\":10,\"flag\":true,\"string\":\"Value\",\"timestamp\":\"2008-11-30 18:45:53\",\"transportBeanClass\":\"test.com.fp.json.TestingBean\"},\"booleano\":true}"; + Serializer ser = new Serializer(data); + Map json = (Map) ser.toObject(Map.class); + Set keys = expected.keySet(); + for (String key : keys) { + Object ex = expected.get(key); + Object obj = json.get(key); + TestCase.assertEquals(ex.getClass(), obj.getClass()); + if (ex instanceof TestingBean) { + this.compareTestingBean((TestingBean) ex, (TestingBean) obj); + } else { + TestCase.assertEquals(ex, obj); + } + } + } + + @SuppressWarnings("unchecked") + public void testJSON2MapBeanArray() throws Exception { + Map expected = new HashMap(); + expected.put("booleano", true); + expected.put("int", 10); + expected.put("string", "Valor"); + expected.put("monto", new BigDecimal("1200.43")); + long time = 1228088753000L; + long date = 1228021200000L; + expected.put("date", new Date(date)); + expected.put("timestamp", new Timestamp(time)); + List arr = new ArrayList(); + arr.add(new TestingBean(new Date(date), new Timestamp(time), "Value1", 10, new BigDecimal("12.34"), true)); + arr.add(new TestingBean(new Date(date), new Timestamp(time), "Value1", 10, new BigDecimal("111.34"), false)); + expected.put("bean", arr); + String data = "{\"monto\":1200.43,\"string\":\"Valor\",\"int\":10,\"timestamp\":\"2008-11-30 18:45:53\",\"date\":\"2008-11-30\",\"bean\":[{\"amount\":12.34,\"date\":\"2008-11-30\",\"entero\":10,\"flag\":true,\"string\":\"Value1\",\"timestamp\":\"2008-11-30 18:45:53\",\"transportBeanClass\":\"test.com.fp.json.TestingBean\"},{\"amount\":111.34,\"date\":\"2008-11-30\",\"entero\":10,\"flag\":false,\"string\":\"Value1\",\"timestamp\":\"2008-11-30 18:45:53\",\"transportBeanClass\":\"test.com.fp.json.TestingBean\"}],\"booleano\":true}"; + Serializer ser = new Serializer(data); + Map json = (Map) ser.toObject(Map.class); + Set keys = expected.keySet(); + for (String key : keys) { + Object ex = expected.get(key); + Object obj = json.get(key); + if (ex instanceof List) { + compareList((List) ex, (List) obj); + } else { + TestCase.assertEquals("" + ex + "<-->" + obj, ex.getClass(), obj.getClass()); + TestCase.assertEquals("" + ex.getClass().getName() + "<-->" + obj.getClass().getName(), ex, obj); + } + } + } + + public void testMap2JSON() throws Exception { + Map data = new HashMap(); + data.put("booleano", true); + data.put("int", 10); + data.put("string", "Valor"); + data.put("monto", new BigDecimal("1200.43")); + data.put("monto1", new BigDecimal("1200")); + long time = 1228088753000L; + long date = 1228021200000L; + data.put("date", new Date(date)); + data.put("timestamp", new Timestamp(time)); + Serializable sData = (Serializable) data; + Serializer ser = new Serializer(sData); + System.out.println(ser.toJSON()); + + } + + public void testMap2XML() throws Exception { + Map data = new HashMap(); + data.put("booleano", true); + data.put("int", 10); + data.put("string", "Valor"); + data.put("monto", new BigDecimal("1200.43")); + data.put("monto1", new BigDecimal("1200")); + long time = 1228088753000L; + long date = 1228021200000L; + data.put("date", new Date(date)); + data.put("timestamp", new Timestamp(time)); + Serializable sData = (Serializable) data; + Serializer ser = new Serializer(sData); + System.out.println("MAP a XML"); + System.out.println(ser.toXML()); + // String expected = + // "\ntrue2008-11-30101200.431200Valor2008-11-30 18:45:53"; + } + + public void testMapBean2JSON() throws Exception { + Map data = new HashMap(); + data.put("booleano", true); + data.put("int", 10); + data.put("string", "Valor"); + data.put("monto", new BigDecimal("1200.43")); + data.put("monto1", new BigDecimal("1200")); + long time = 1228088753000L; + long date = 1228021200000L; + data.put("date", new Date(date)); + data.put("timestamp", new Timestamp(time)); + data.put("bean", new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true)); + Serializable sData = (Serializable) data; + Serializer ser = new Serializer(sData); + System.out.println(ser.toJSON()); + } + + public void testMapBean2XML() throws Exception { + Map data = new HashMap(); + data.put("booleano", true); + data.put("int", 10); + data.put("string", "Valor"); + data.put("monto", new BigDecimal("1200.43")); + data.put("monto1", new BigDecimal("1200")); + long time = 1228088753000L; + long date = 1228021200000L; + data.put("date", new Date(date)); + data.put("timestamp", new Timestamp(time)); + data.put("bean", new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true)); + Serializable sData = (Serializable) data; + Serializer ser = new Serializer(sData); + System.out.println("Map Bean a XML"); + System.out.println(ser.toXML()); + + } + + public void testMapBeanArray2JSON() throws Exception { + Map data = new HashMap(); + data.put("booleano", true); + data.put("int", 10); + data.put("string", "Valor"); + data.put("monto", new BigDecimal("1200.43")); + data.put("monto1", new BigDecimal("1200")); + long time = 1228088753000L; + long date = 1228021200000L; + data.put("date", new Date(date)); + data.put("timestamp", new Timestamp(time)); + List arr = new ArrayList(); + arr.add(new TestingBean(new Date(date), new Timestamp(time), "Value1", 10, new BigDecimal("12.34"), true)); + arr.add(new TestingBean(new Date(date), new Timestamp(time), "Value1", 10, new BigDecimal("111.34"), false)); + data.put("bean", arr); + Serializable sData = (Serializable) data; + Serializer ser = new Serializer(sData); + System.out.println(ser.toJSON()); + } + + public void testMapBeanArray2XML() throws Exception { + Map data = new HashMap(); + data.put("booleano", true); + data.put("int", 10); + data.put("string", "Valor"); + data.put("monto", new BigDecimal("1200.43")); + data.put("monto1", new BigDecimal("1200")); + long time = 1228088753000L; + long date = 1228021200000L; + data.put("date", new Date(date)); + data.put("timestamp", new Timestamp(time)); + List arr = new ArrayList(); + arr.add(new TestingBean(new Date(date), new Timestamp(time), "Value1", 10, new BigDecimal("12.34"), true)); + arr.add(new TestingBean(new Date(date), new Timestamp(time), "Value1", 10, new BigDecimal("111.34"), false)); + data.put("bean", arr); + Serializable sData = (Serializable) data; + Serializer ser = new Serializer(sData); + System.out.println("MAP ARRAY"); + System.out.println(ser.toXML()); + + } + + public void testXML2Bean() throws Exception { + long time = 1228088753000L; + long date = 1228021200000L; + TestingBean expected = new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true); + String data = "12.342008-11-3010trueValue2008-11-30 18:45:53test.com.fp.json.TestingBean"; + Serializer ser = new Serializer(data, true); + TestingBean json = (TestingBean) ser.toObject(TestingBean.class); + this.compareTestingBean(expected, json); + } + + public void testXML2Bean1() throws Exception { + long time = 1228088753000L; + long date = 1228021200000L; + TestingBean expected = new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true); + expected.setPk(new TestingBeanKey("Prueba", 21L)); + String data = " 12.342008-11-30false10truefalsePrueba21Value2008-11-30 18:45:53test.com.fp.json.TestingBean"; + Serializer ser = new Serializer(data, true); + TestingBean json = (TestingBean) ser.toObject(TestingBean.class); + this.compareTestingBean(expected, json); + } + + @SuppressWarnings("unchecked") + public void testXML2Map() throws Exception { + Map expected = new HashMap(); + expected.put("booleano", true); + expected.put("int", 10); + expected.put("string", "Valor"); + expected.put("monto", new BigDecimal("1200.43")); + long time = 1228088753000L; + long date = 1228021200000L; + expected.put("date", new Date(date)); + expected.put("timestamp", new Timestamp(time)); + String data = "\ntrue2008-11-30101200.431200Valor2008-11-30 18:45:53"; + Serializer ser = new Serializer(data, true); + Map json = (Map) ser.toObject(Map.class); + Set keys = expected.keySet(); + for (String key : keys) { + Object ex = expected.get(key); + Object obj = json.get(key); + TestCase.assertEquals(ex.getClass(), obj.getClass()); + TestCase.assertEquals(ex, obj); + } + } + + @SuppressWarnings("unchecked") + public void testXML2MapBean() throws Exception { + Map expected = new HashMap(); + expected.put("booleano", true); + expected.put("int", 10); + expected.put("string", "Valor"); + expected.put("monto", new BigDecimal("1200.43")); + long time = 1228088753000L; + long date = 1228021200000L; + expected.put("date", new Date(date)); + expected.put("timestamp", new Timestamp(time)); + expected.put("bean", new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true)); + String data = "12.342008-11-3010trueValue2008-11-30 18:45:53test.com.fp.json.TestingBeantrue2008-11-30101200.431200Valor2008-11-30 18:45:53"; + Serializer ser = new Serializer(data, true); + Map json = (Map) ser.toObject(Map.class); + Set keys = expected.keySet(); + for (String key : keys) { + Object ex = expected.get(key); + Object obj = json.get(key); + TestCase.assertEquals(ex.getClass(), obj.getClass()); + if (ex instanceof TestingBean) { + this.compareTestingBean((TestingBean) ex, (TestingBean) obj); + } else { + TestCase.assertEquals(ex, obj); + } + } + } + + /* + * public void testFinancial() throws Exception{ try{ String + * xml=StreamHelper.readFile("/home/gfiallos/temp/flip/a.xml"); Serializer ser=new Serializer(xml, true); + * FinancialRequest fr=(FinancialRequest)ser.toObject(FinancialRequest.class); Serializer ser1=new Serializer(fr); + * System.out.print(">>>"+ser1.toJSON()); }catch(Exception e){ e.printStackTrace(); } } + */ + /* + * private void testBeanPersistenteToJSON() throws Exception{ SaveRequest sq = new SaveRequest(); long time = + * 1228088753000L; long date = 1228021200000L; TestingBean expected = new TestingBean(new Date(date), new + * Timestamp(time), "Value", 10, new BigDecimal("12.34"), true); sq.putSaveBean("A", expected); Serializer ser = new + * Serializer(sq); String dataJSON=ser.toJSON(); String dataExpected= + * "{\"officeCode\":null,\"journalId\":null,\"channelCode\":null,\"authorizedUser\":null,\"A\":{\"deletedObject\":null,\"beanName\":\"A\",\"automatic\":true,\"modifiedObject\":{\"amount\":12.34,\"timestamp\":\"2008-11-30 18:45:53\",\"flag\":true,\"string\":\"Value\",\"entero\":10,\"transportBeanClass\":\"test.com.fp.json.TestingBean\",\"date\":\"2008-11-30\",\"modified\":false,\"pk\":null},\"modifiedRecords\":[],\"transportBeanClass\":\"com.fp.dto.save.SaveBean\",\"deletedRecords\":[],\"modified\":false},\"transactionCode\":null,\"transactionVersion\":null,\"internalUserCode\":null,\"branchCode\":null,\"lOrderPersistentBeans\":[\"A\"],\"modified\":false,\"terminalCode\":null,\"company\":null,\"transactionModule\":null,\"language\":null,\"transportBeanClass\":\"com.fp.dto.save.SaveRequest\",\"user\":null,\"profile\":null}" + * ; System.out.println("BeanPersistenteToJSON "+dataJSON); TestCase.assertEquals(dataExpected, dataJSON); + * + * } + */ + public void testBeanPersistente() throws Exception { + String json = "{\"officeCode\":null,\"journalId\":null,\"channelCode\":null,\"authorizedUser\":null,\"A\":{\"deletedObject\":null,\"beanName\":\"A\",\"automatic\":true,\"modifiedObject\":{\"amount\":12.34,\"timestamp\":\"2008-11-30 18:45:53\",\"flag\":true,\"string\":\"Value\",\"entero\":10,\"transportBeanClass\":\"test.com.fp.json.TestingBean\",\"date\":\"2008-11-30\",\"pk\":null},\"modifiedRecords\":[],\"transportBeanClass\":\"com.fp.dto.save.SaveBean\",\"deletedRecords\":[]},\"transactionCode\":null,\"transactionVersion\":null,\"internalUserCode\":null,\"branchCode\":null,\"lOrderPersistentBeans\":[\"A\"],\"terminalCode\":null,\"company\":null,\"transactionModule\":null,\"language\":null,\"transportBeanClass\":\"com.fp.dto.save.SaveRequest\",\"user\":null,\"profile\":null}"; + SaveRequest sq = new SaveRequest(); + long time = 1228088753000L; + long date = 1228021200000L; + TestingBean expected = new TestingBean(new Date(date), new Timestamp(time), "Value", 10, new BigDecimal("12.34"), true); + sq.putSaveBean("A", expected); + Serializer ser = new Serializer(json); + SaveRequest srData = (SaveRequest) ser.toObject(SaveRequest.class); + TestingBean val = (TestingBean) srData.getSaveBeanModifiedObject("A"); + + TestCase.assertEquals(expected.toString(), val.toString()); + + } + + public void testFinancial1() throws Exception { + try { + String json = "{\"accountingVoucher\":false,\"newAccountOffice\":null,\"officeCode\":1,\"journalId\":null,\"authorizedUser\":null,\"transactionCode\":200,\"transactionVersion\":1,\"newSubProduct\":null,\"onLine\":true,\"document\":\"ABC\",\"area\":\"1\",\"terminalCode\":\"ter-jvc\",\"commentary\":null,\"originalTransactionModule\":null,\"transactionModule\":\"11\",\"accountingDate\":null,\"processDate\":null,\"profile\":1,\"reverse\":\"N\",\"journalIdReverse\":null,\"valueDate\":null,\"creditQuotaNumber\":null,\"channelCode\":\"PC\",\"depositCode\":null,\"financialItems\":[{\"account\":\"[]\",\"accountStatus\":\"[]\",\"accountingCode\":\"[]\",\"amount\":100,\"companyAccount\":0,\"creditType\":\"[]\",\"currecy\":\"USD\",\"destinyBranch\":0,\"destinyOffice\":0,\"expirationDate\":\"\",\"itemCode\":1,\"overdrawCatalog\":\"[]\",\"overdrawCatalogCode\":\"[]\",\"quotaNumber\":0,\"repeating\":false}],\"creditAccount\":null,\"settlement\":null,\"transactionMode\":\"N\",\"branchCode\":1,\"newAccountBranch\":null,\"modified\":false,\"debitAccount\":\"1110000001\",\"originalTransactionVersion\":null,\"company\":1,\"debitQuotaNumber\":null,\"workingDate\":null,\"language\":\"ES\",\"transportBeanClass\":\"com.fp.dto.fin.FinancialRequest\",\"originalTransactionCode\":null,\"user\":\"jvaca\"}"; + Serializer ser = new Serializer(json); + FinancialRequest fr = (FinancialRequest) ser.toObject(FinancialRequest.class); + System.out.print(fr); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/base/dto/common/src/test/resources/.svn/entries b/base/dto/common/src/test/resources/.svn/entries new file mode 100644 index 0000000..60cdaf5 --- /dev/null +++ b/base/dto/common/src/test/resources/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/common/src/test/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/dto/common/target/classes/com/fp/accounting/exception/AccountingException.class b/base/dto/common/target/classes/com/fp/accounting/exception/AccountingException.class new file mode 100644 index 0000000..1997916 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/accounting/exception/AccountingException.class differ diff --git a/base/dto/common/target/classes/com/fp/ach/exception/AchException.class b/base/dto/common/target/classes/com/fp/ach/exception/AchException.class new file mode 100644 index 0000000..dc96fdb Binary files /dev/null and b/base/dto/common/target/classes/com/fp/ach/exception/AchException.class differ diff --git a/base/dto/common/target/classes/com/fp/application/exception/SolicitudeException.class b/base/dto/common/target/classes/com/fp/application/exception/SolicitudeException.class new file mode 100644 index 0000000..1857da2 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/application/exception/SolicitudeException.class differ diff --git a/base/dto/common/target/classes/com/fp/bpmlib/BPMException.class b/base/dto/common/target/classes/com/fp/bpmlib/BPMException.class new file mode 100644 index 0000000..80cf298 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/bpmlib/BPMException.class differ diff --git a/base/dto/common/target/classes/com/fp/bscoring/BscoringException.class b/base/dto/common/target/classes/com/fp/bscoring/BscoringException.class new file mode 100644 index 0000000..e92d79b Binary files /dev/null and b/base/dto/common/target/classes/com/fp/bscoring/BscoringException.class differ diff --git a/base/dto/common/target/classes/com/fp/builder/BuilderException.class b/base/dto/common/target/classes/com/fp/builder/BuilderException.class new file mode 100644 index 0000000..4b20c07 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/builder/BuilderException.class differ diff --git a/base/dto/common/target/classes/com/fp/common/base64/Base64Input.class b/base/dto/common/target/classes/com/fp/common/base64/Base64Input.class new file mode 100644 index 0000000..ac76695 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/base64/Base64Input.class differ diff --git a/base/dto/common/target/classes/com/fp/common/exception/APPException.class b/base/dto/common/target/classes/com/fp/common/exception/APPException.class new file mode 100644 index 0000000..116a78c Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/exception/APPException.class differ diff --git a/base/dto/common/target/classes/com/fp/common/exception/AbstractExceptionMessage.class b/base/dto/common/target/classes/com/fp/common/exception/AbstractExceptionMessage.class new file mode 100644 index 0000000..636df62 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/exception/AbstractExceptionMessage.class differ diff --git a/base/dto/common/target/classes/com/fp/common/exception/CommonException.class b/base/dto/common/target/classes/com/fp/common/exception/CommonException.class new file mode 100644 index 0000000..f1b782a Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/exception/CommonException.class differ diff --git a/base/dto/common/target/classes/com/fp/common/exception/ExceptionHandler.class b/base/dto/common/target/classes/com/fp/common/exception/ExceptionHandler.class new file mode 100644 index 0000000..fbb5c22 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/exception/ExceptionHandler.class differ diff --git a/base/dto/common/target/classes/com/fp/common/exception/ExceptionManager.class b/base/dto/common/target/classes/com/fp/common/exception/ExceptionManager.class new file mode 100644 index 0000000..00aa8e2 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/exception/ExceptionManager.class differ diff --git a/base/dto/common/target/classes/com/fp/common/exception/ExceptionsProperties.class b/base/dto/common/target/classes/com/fp/common/exception/ExceptionsProperties.class new file mode 100644 index 0000000..109caf8 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/exception/ExceptionsProperties.class differ diff --git a/base/dto/common/target/classes/com/fp/common/exception/IdentifierGenerationException.class b/base/dto/common/target/classes/com/fp/common/exception/IdentifierGenerationException.class new file mode 100644 index 0000000..26e3362 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/exception/IdentifierGenerationException.class differ diff --git a/base/dto/common/target/classes/com/fp/common/exception/NonUniqueObjectException.class b/base/dto/common/target/classes/com/fp/common/exception/NonUniqueObjectException.class new file mode 100644 index 0000000..0dac5bb Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/exception/NonUniqueObjectException.class differ diff --git a/base/dto/common/target/classes/com/fp/common/exception/PropertyValueException.class b/base/dto/common/target/classes/com/fp/common/exception/PropertyValueException.class new file mode 100644 index 0000000..71678df Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/exception/PropertyValueException.class differ diff --git a/base/dto/common/target/classes/com/fp/common/exception/SQLExceptionManager.class b/base/dto/common/target/classes/com/fp/common/exception/SQLExceptionManager.class new file mode 100644 index 0000000..1cd561b Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/exception/SQLExceptionManager.class differ diff --git a/base/dto/common/target/classes/com/fp/common/exception/SavePointException.class b/base/dto/common/target/classes/com/fp/common/exception/SavePointException.class new file mode 100644 index 0000000..993c10e Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/exception/SavePointException.class differ diff --git a/base/dto/common/target/classes/com/fp/common/exception/StaleObjectStateException.class b/base/dto/common/target/classes/com/fp/common/exception/StaleObjectStateException.class new file mode 100644 index 0000000..1a1e464 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/exception/StaleObjectStateException.class differ diff --git a/base/dto/common/target/classes/com/fp/common/files/FileIterator$1.class b/base/dto/common/target/classes/com/fp/common/files/FileIterator$1.class new file mode 100644 index 0000000..d0349df Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/files/FileIterator$1.class differ diff --git a/base/dto/common/target/classes/com/fp/common/files/FileIterator$NFIterator.class b/base/dto/common/target/classes/com/fp/common/files/FileIterator$NFIterator.class new file mode 100644 index 0000000..9a82e4c Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/files/FileIterator$NFIterator.class differ diff --git a/base/dto/common/target/classes/com/fp/common/files/FileIterator.class b/base/dto/common/target/classes/com/fp/common/files/FileIterator.class new file mode 100644 index 0000000..5437711 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/files/FileIterator.class differ diff --git a/base/dto/common/target/classes/com/fp/common/files/StreamHelper.class b/base/dto/common/target/classes/com/fp/common/files/StreamHelper.class new file mode 100644 index 0000000..4384e98 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/files/StreamHelper.class differ diff --git a/base/dto/common/target/classes/com/fp/common/files/record/RecordIterator$1.class b/base/dto/common/target/classes/com/fp/common/files/record/RecordIterator$1.class new file mode 100644 index 0000000..c890fff Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/files/record/RecordIterator$1.class differ diff --git a/base/dto/common/target/classes/com/fp/common/files/record/RecordIterator$RIterator.class b/base/dto/common/target/classes/com/fp/common/files/record/RecordIterator$RIterator.class new file mode 100644 index 0000000..ce9aeca Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/files/record/RecordIterator$RIterator.class differ diff --git a/base/dto/common/target/classes/com/fp/common/files/record/RecordIterator.class b/base/dto/common/target/classes/com/fp/common/files/record/RecordIterator.class new file mode 100644 index 0000000..9d0a264 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/files/record/RecordIterator.class differ diff --git a/base/dto/common/target/classes/com/fp/common/fin/MessageGenerator.class b/base/dto/common/target/classes/com/fp/common/fin/MessageGenerator.class new file mode 100644 index 0000000..031dd89 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/fin/MessageGenerator.class differ diff --git a/base/dto/common/target/classes/com/fp/common/formula/AbstractFunction.class b/base/dto/common/target/classes/com/fp/common/formula/AbstractFunction.class new file mode 100644 index 0000000..57a5167 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/formula/AbstractFunction.class differ diff --git a/base/dto/common/target/classes/com/fp/common/formula/FormulaEvaluator.class b/base/dto/common/target/classes/com/fp/common/formula/FormulaEvaluator.class new file mode 100644 index 0000000..dee52eb Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/formula/FormulaEvaluator.class differ diff --git a/base/dto/common/target/classes/com/fp/common/formula/functions/Percent.class b/base/dto/common/target/classes/com/fp/common/formula/functions/Percent.class new file mode 100644 index 0000000..2d9ba3d Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/formula/functions/Percent.class differ diff --git a/base/dto/common/target/classes/com/fp/common/formula/functions/Sum.class b/base/dto/common/target/classes/com/fp/common/formula/functions/Sum.class new file mode 100644 index 0000000..ae58c0a Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/formula/functions/Sum.class differ diff --git a/base/dto/common/target/classes/com/fp/common/helper/CalculationBase.class b/base/dto/common/target/classes/com/fp/common/helper/CalculationBase.class new file mode 100644 index 0000000..76b8ad6 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/helper/CalculationBase.class differ diff --git a/base/dto/common/target/classes/com/fp/common/helper/Constant.class b/base/dto/common/target/classes/com/fp/common/helper/Constant.class new file mode 100644 index 0000000..db2f66f Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/helper/Constant.class differ diff --git a/base/dto/common/target/classes/com/fp/common/helper/DialectDB.class b/base/dto/common/target/classes/com/fp/common/helper/DialectDB.class new file mode 100644 index 0000000..ec7aaa6 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/helper/DialectDB.class differ diff --git a/base/dto/common/target/classes/com/fp/common/helper/FkException.class b/base/dto/common/target/classes/com/fp/common/helper/FkException.class new file mode 100644 index 0000000..ba9bfc4 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/helper/FkException.class differ diff --git a/base/dto/common/target/classes/com/fp/common/logger/APPLogger.class b/base/dto/common/target/classes/com/fp/common/logger/APPLogger.class new file mode 100644 index 0000000..6fdce51 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/logger/APPLogger.class differ diff --git a/base/dto/common/target/classes/com/fp/common/messages/ELEval.class b/base/dto/common/target/classes/com/fp/common/messages/ELEval.class new file mode 100644 index 0000000..422a8ff Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/messages/ELEval.class differ diff --git a/base/dto/common/target/classes/com/fp/common/messages/MessageUtil.class b/base/dto/common/target/classes/com/fp/common/messages/MessageUtil.class new file mode 100644 index 0000000..c2ce96f Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/messages/MessageUtil.class differ diff --git a/base/dto/common/target/classes/com/fp/common/properties/CommonProperties.class b/base/dto/common/target/classes/com/fp/common/properties/CommonProperties.class new file mode 100644 index 0000000..6434df5 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/properties/CommonProperties.class differ diff --git a/base/dto/common/target/classes/com/fp/common/properties/PropertiesHandler.class b/base/dto/common/target/classes/com/fp/common/properties/PropertiesHandler.class new file mode 100644 index 0000000..05c5fd7 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/properties/PropertiesHandler.class differ diff --git a/base/dto/common/target/classes/com/fp/common/soap/WSClient.class b/base/dto/common/target/classes/com/fp/common/soap/WSClient.class new file mode 100644 index 0000000..ea862c2 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/soap/WSClient.class differ diff --git a/base/dto/common/target/classes/com/fp/common/thread/Monitor.class b/base/dto/common/target/classes/com/fp/common/thread/Monitor.class new file mode 100644 index 0000000..72ce2c0 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/common/thread/Monitor.class differ diff --git a/base/dto/common/target/classes/com/fp/core/exception/CoreException.class b/base/dto/common/target/classes/com/fp/core/exception/CoreException.class new file mode 100644 index 0000000..60e63ea Binary files /dev/null and b/base/dto/common/target/classes/com/fp/core/exception/CoreException.class differ diff --git a/base/dto/common/target/classes/com/fp/creditfacility/exception/CreditFacilityException.class b/base/dto/common/target/classes/com/fp/creditfacility/exception/CreditFacilityException.class new file mode 100644 index 0000000..4e116f2 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/creditfacility/exception/CreditFacilityException.class differ diff --git a/base/dto/common/target/classes/com/fp/demandeposit/exception/DemandDepositException.class b/base/dto/common/target/classes/com/fp/demandeposit/exception/DemandDepositException.class new file mode 100644 index 0000000..2bb59f4 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/demandeposit/exception/DemandDepositException.class differ diff --git a/base/dto/common/target/classes/com/fp/documents/DocException.class b/base/dto/common/target/classes/com/fp/documents/DocException.class new file mode 100644 index 0000000..a03567c Binary files /dev/null and b/base/dto/common/target/classes/com/fp/documents/DocException.class differ diff --git a/base/dto/common/target/classes/com/fp/dto/json/DateValueProcessor.class b/base/dto/common/target/classes/com/fp/dto/json/DateValueProcessor.class new file mode 100644 index 0000000..f33bda2 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/dto/json/DateValueProcessor.class differ diff --git a/base/dto/common/target/classes/com/fp/dto/json/ObjectValueProcessor.class b/base/dto/common/target/classes/com/fp/dto/json/ObjectValueProcessor.class new file mode 100644 index 0000000..4dd1c27 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/dto/json/ObjectValueProcessor.class differ diff --git a/base/dto/common/target/classes/com/fp/dto/json/Serializer.class b/base/dto/common/target/classes/com/fp/dto/json/Serializer.class new file mode 100644 index 0000000..6670d94 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/dto/json/Serializer.class differ diff --git a/base/dto/common/target/classes/com/fp/dto/json/morpher/DateMorpher.class b/base/dto/common/target/classes/com/fp/dto/json/morpher/DateMorpher.class new file mode 100644 index 0000000..73c8982 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/dto/json/morpher/DateMorpher.class differ diff --git a/base/dto/common/target/classes/com/fp/dto/json/morpher/TimestampMorpher.class b/base/dto/common/target/classes/com/fp/dto/json/morpher/TimestampMorpher.class new file mode 100644 index 0000000..82d9f80 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/dto/json/morpher/TimestampMorpher.class differ diff --git a/base/dto/common/target/classes/com/fp/excel/ExcelToMap.class b/base/dto/common/target/classes/com/fp/excel/ExcelToMap.class new file mode 100644 index 0000000..6f821ca Binary files /dev/null and b/base/dto/common/target/classes/com/fp/excel/ExcelToMap.class differ diff --git a/base/dto/common/target/classes/com/fp/excel/ExcelToMapMessages.class b/base/dto/common/target/classes/com/fp/excel/ExcelToMapMessages.class new file mode 100644 index 0000000..c66c829 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/excel/ExcelToMapMessages.class differ diff --git a/base/dto/common/target/classes/com/fp/excel/FormulaManage.class b/base/dto/common/target/classes/com/fp/excel/FormulaManage.class new file mode 100644 index 0000000..a08e2fb Binary files /dev/null and b/base/dto/common/target/classes/com/fp/excel/FormulaManage.class differ diff --git a/base/dto/common/target/classes/com/fp/excel/WorkbookFactory.class b/base/dto/common/target/classes/com/fp/excel/WorkbookFactory.class new file mode 100644 index 0000000..8005bb4 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/excel/WorkbookFactory.class differ diff --git a/base/dto/common/target/classes/com/fp/excel/WorkbookFactoryStreamBytes.class b/base/dto/common/target/classes/com/fp/excel/WorkbookFactoryStreamBytes.class new file mode 100644 index 0000000..8b26dbf Binary files /dev/null and b/base/dto/common/target/classes/com/fp/excel/WorkbookFactoryStreamBytes.class differ diff --git a/base/dto/common/target/classes/com/fp/excel/XLSXUtil.class b/base/dto/common/target/classes/com/fp/excel/XLSXUtil.class new file mode 100644 index 0000000..94fe513 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/excel/XLSXUtil.class differ diff --git a/base/dto/common/target/classes/com/fp/general/exception/GeneralException.class b/base/dto/common/target/classes/com/fp/general/exception/GeneralException.class new file mode 100644 index 0000000..49806d9 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/general/exception/GeneralException.class differ diff --git a/base/dto/common/target/classes/com/fp/installment/exception/InstallmentException.class b/base/dto/common/target/classes/com/fp/installment/exception/InstallmentException.class new file mode 100644 index 0000000..6a84b80 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/installment/exception/InstallmentException.class differ diff --git a/base/dto/common/target/classes/com/fp/loan/exception/LoanException.class b/base/dto/common/target/classes/com/fp/loan/exception/LoanException.class new file mode 100644 index 0000000..534be2c Binary files /dev/null and b/base/dto/common/target/classes/com/fp/loan/exception/LoanException.class differ diff --git a/base/dto/common/target/classes/com/fp/mail/Mail$1.class b/base/dto/common/target/classes/com/fp/mail/Mail$1.class new file mode 100644 index 0000000..bd564b2 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/mail/Mail$1.class differ diff --git a/base/dto/common/target/classes/com/fp/mail/Mail$SMTPAuthenticator.class b/base/dto/common/target/classes/com/fp/mail/Mail$SMTPAuthenticator.class new file mode 100644 index 0000000..b39aa28 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/mail/Mail$SMTPAuthenticator.class differ diff --git a/base/dto/common/target/classes/com/fp/mail/Mail.class b/base/dto/common/target/classes/com/fp/mail/Mail.class new file mode 100644 index 0000000..9ac9306 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/mail/Mail.class differ diff --git a/base/dto/common/target/classes/com/fp/persistence/commondb/exception/CommondbException.class b/base/dto/common/target/classes/com/fp/persistence/commondb/exception/CommondbException.class new file mode 100644 index 0000000..138edc7 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/persistence/commondb/exception/CommondbException.class differ diff --git a/base/dto/common/target/classes/com/fp/receivable/exception/ReceivableException.class b/base/dto/common/target/classes/com/fp/receivable/exception/ReceivableException.class new file mode 100644 index 0000000..c4b176a Binary files /dev/null and b/base/dto/common/target/classes/com/fp/receivable/exception/ReceivableException.class differ diff --git a/base/dto/common/target/classes/com/fp/telered/exception/TeleredException.class b/base/dto/common/target/classes/com/fp/telered/exception/TeleredException.class new file mode 100644 index 0000000..b8c02d5 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/telered/exception/TeleredException.class differ diff --git a/base/dto/common/target/classes/com/fp/teller/exception/TellerException.class b/base/dto/common/target/classes/com/fp/teller/exception/TellerException.class new file mode 100644 index 0000000..8ca3983 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/teller/exception/TellerException.class differ diff --git a/base/dto/common/target/classes/com/fp/term/exception/TermException.class b/base/dto/common/target/classes/com/fp/term/exception/TermException.class new file mode 100644 index 0000000..15cd2c4 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/term/exception/TermException.class differ diff --git a/base/dto/common/target/classes/com/fp/timedeposit/exception/TimeDepositException.class b/base/dto/common/target/classes/com/fp/timedeposit/exception/TimeDepositException.class new file mode 100644 index 0000000..12dc8fb Binary files /dev/null and b/base/dto/common/target/classes/com/fp/timedeposit/exception/TimeDepositException.class differ diff --git a/base/dto/common/target/classes/com/fp/viaticos/exception/ViaticosException.class b/base/dto/common/target/classes/com/fp/viaticos/exception/ViaticosException.class new file mode 100644 index 0000000..4f46d1d Binary files /dev/null and b/base/dto/common/target/classes/com/fp/viaticos/exception/ViaticosException.class differ diff --git a/base/dto/common/target/classes/com/fp/warranty/exception/WarrantyException.class b/base/dto/common/target/classes/com/fp/warranty/exception/WarrantyException.class new file mode 100644 index 0000000..c963f23 Binary files /dev/null and b/base/dto/common/target/classes/com/fp/warranty/exception/WarrantyException.class differ diff --git a/base/dto/common/target/classes/commonmessages_es.properties b/base/dto/common/target/classes/commonmessages_es.properties new file mode 100644 index 0000000..d9a8874 --- /dev/null +++ b/base/dto/common/target/classes/commonmessages_es.properties @@ -0,0 +1,19 @@ +COMMON-0001=Prueba 1 +COMMON-0002=La cuenta se encuentra en estado {0} +COMMON-0003=El usuario {0} no tiene permitido dep\u00F3sitos mayores a {1,number,currency} +COMMON-0005=El saldo promedio de la cuenta {0} al {1,date,dd-MMM-yyyy} es {2,number,###,###,##0.00} +COMMON-0006=PROCESO {0} A EJECUTAR NO DEFINIDO MODULE: {1} TRANS: {2} VERSION {3} +COMMON-0007=PROCESO {0} A EJECUTAR MODULE: {1} TRANS: {2} VERSION {3} NO IMPLEMENTA {4} +COMMON-0008=PROCESO A EJECUTAR NO DEFINIDAS EN TGENETRANSACTIONPROCESS MODULE: {1} TRANS: {2} VERSION {3} +COMMON-0009=PROCESO {0} A EJECUTAR NO DEFINIDO EN TGENEBATCHPREVIOUSPROCESS MOD: {1} TRAN: {2} VER: {3} +COMMON-0010=PROCESO {0} A EJECUTAR NO IMPLEMENTA: {0} MOD: {1} TRAN: {2} VER: {3} +COMMON-0011=PROCESO {0} A EJECUTAR NO DEFINIDO EN TGENEBATCHPROCESS MOD: {1} TRAN: {2} VER: {3} +COMMON-0012=CLASE {0} A EJECUTAR NO EXISTE CODE: {0} +COMMON-0013=PROCESO {0} A EJECUTAR CODE: {1} NO IMPLEMENTA QUERYRULE +COMMON-0014=CLASE {0} A EJECUTAR NO EXISTE MODULE: {1} TRANS: {2} VERSION {3} +COMMON-0015=PROCESO {0} A EJECUTAR MODULE: {1} TRANS: {2} VERSION {3} NO IMPLEMENTA {4} +COMMON-0016=PROCESOS BATCH NO DEFINIDOS EN TGENEBATCH MODULE: {0} TRANS: {1} VERSION {2} +COMMON-0017=CLASE A EJECUTAR NODEFINIDA EN TGENEBATCHPROCESS ACTION:{0}, MOD: {1} TRANMOD:{2} TRAN:{3} VER: {4} +COMMON-0018=USUARIO INACTIVO +COMMON-0019= +COMMON-0020= \ No newline at end of file diff --git a/base/dto/common/target/classes/exceptions.properties b/base/dto/common/target/classes/exceptions.properties new file mode 100644 index 0000000..b0868f5 --- /dev/null +++ b/base/dto/common/target/classes/exceptions.properties @@ -0,0 +1,12 @@ +java.sql.SQLException=com.fp.common.exception.SQLExceptionManager +java.sql.SQLSyntaxErrorException=com.fp.common.exception.SQLExceptionManager +java.sql.BatchUpdateException=com.fp.common.exception.SQLExceptionManager +java.sql.SQLIntegrityConstraintViolationException=com.fp.common.exception.SQLExceptionManager +org.hibernate.exception.ConstraintViolationException=com.fp.common.exception.SQLExceptionManager +javax.persistence.PersistenceException=com.fp.common.exception.SQLExceptionManager +org.hibernate.exception.GenericJDBCException=com.fp.common.exception.SQLExceptionManager +org.hibernate.NonUniqueObjectException=com.fp.common.exception.NonUniqueObjectException +org.hibernate.PropertyValueException=com.fp.common.exception.PropertyValueException +org.hibernate.StaleObjectStateException=com.fp.common.exception.StaleObjectStateException +org.hibernate.id.IdentifierGenerationException=com.fp.common.exception.IdentifierGenerationException +javax.persistence.EntityExistsException=com.fp.common.exception.NonUniqueObjectException \ No newline at end of file diff --git a/base/dto/common/target/classes/test/com/fp/json/TestingBean.class b/base/dto/common/target/classes/test/com/fp/json/TestingBean.class new file mode 100644 index 0000000..765e92c Binary files /dev/null and b/base/dto/common/target/classes/test/com/fp/json/TestingBean.class differ diff --git a/base/dto/common/target/classes/test/com/fp/json/TestingBean1.class b/base/dto/common/target/classes/test/com/fp/json/TestingBean1.class new file mode 100644 index 0000000..466b48e Binary files /dev/null and b/base/dto/common/target/classes/test/com/fp/json/TestingBean1.class differ diff --git a/base/dto/common/target/classes/test/com/fp/json/TestingBeanKey.class b/base/dto/common/target/classes/test/com/fp/json/TestingBeanKey.class new file mode 100644 index 0000000..e8dc283 Binary files /dev/null and b/base/dto/common/target/classes/test/com/fp/json/TestingBeanKey.class differ diff --git a/base/dto/common/target/classes/userMessages.properties b/base/dto/common/target/classes/userMessages.properties new file mode 100644 index 0000000..3600b17 --- /dev/null +++ b/base/dto/common/target/classes/userMessages.properties @@ -0,0 +1,20 @@ +it4b.success = TRANSACCI\u00d3N REALIZADA CORRECTAMENTE +java.lang.ClassNotFoundException = APLICACI\u00d3N NO INSTALADA CORRECTAMENTE. CONTACTE AL ADMINISTRADOR DEL SISTEMA +java.lang.NoClassDefFoundError = APLICACI\u00d3N NO INSTALADA CORRECTAMENTE. CONTACTE AL ADMINISTRADOR DEL SISTEMA +java.lang.NullPointerException = ERROR NO CONTROLADO EN LA APLICACI\u00d3N. CONTACTE AL PROVEEDOR +java.lang.NumberFormatException = SE ESPERABA UN VALOR NUM\u00c9RICO +sql-not-null=VALOR REQUERIDO PARA LA TABLA: [{0}] CAMPO: [{1}] +StaleObjectStateException=REGISTRO DE LA TABLA: [{0}] MODIFICADO EN OTRA SESI\u00d3N, RECONSULTE LOS DATOS +NonUniqueObjectException=ESTA INGRESANDO REGISTROS DUPLICADOS EN LA TABLA: [{0}] +PropertyValueException=VALOR REQUERIDO PARA LA TABLA: [{0}] CAMPO: [{1}] +fk=NO EXISTE REFERENCIA DE [{0}] EN [{1}] +fkg=NO SE PUEDE INSERTAR EL REGISTRO DE LA TABLA {0} PORQUE EXISTE REFERENCIA EN EL CONSTRAINT {1} HACIA OTRA TABLA +fk1=NO SE PUEDE ELIMINAR EL REGISTRO YA QUE SE ENCUENTRA REFERENCIADO [{0}] EN [{1}] +fk1g=NO SE PUEDE ELIMINAR EL REGISTRO DE LA TABLA {0} PORQUE EXISTE REFERENCIA EN EL CONSTRAINT {1} HACIA OTRA TABLA +sql.unique=NO PUEDE INGRESAR UN REGISTRO QUE YA EXISTE: [{0}] +lock=RECURSO EN USO INTENTE NUEVAMENTE: [{0}] +valuelarger=EL VALOR INGRESADO SOBREPASA LA LONGITUD PERMITIDA DEL CAMPO +valueLargerWithValue=EL VALOR INGRESADO EN LA TABLA {0} EN EL CAMPO {1} SOBREPASA LA LONGITUD PERMITIDA {2} +sql.uniqueID=N\u00daMERO DE IDENTIFICACI\u00d3N YA EXISTE: [{0}] +fk.informix=NO SE PUEDE ELIMINAR EL REGISTRO YA QUE SE ENCUENTRA REFERENCIADO:[{0}] +sql.uniqueIDINF=N\u00daMERO DE IDENTIFICACI\u00d3N YA EXISTE \ No newline at end of file diff --git a/base/dto/common/target/classes/userMessages_es.properties b/base/dto/common/target/classes/userMessages_es.properties new file mode 100644 index 0000000..17b4915 --- /dev/null +++ b/base/dto/common/target/classes/userMessages_es.properties @@ -0,0 +1,17 @@ +it4b.success = TRANSACCION REALIZADA CORRECTAMENTE +java.lang.ClassNotFoundException = APLICACION NO INSTALADA CORRECTAMENTE. CONTACTE AL ADMINISTRADOR DEL SISTEMA +java.lang.NoClassDefFoundError = APLICACION NO INSTALADA CORRECTAMENTE. CONTACTE AL ADMINISTRADOR DEL SISTEMA +java.lang.NullPointerException = ERROR NO CONTROLADO EN LA APLICACION. CONTACTE AL PROVEEDOR +java.lang.NumberFormatException = SE ESPERABA UN VALOR NUMERICO +sql-not-null=VALOR REQUERIDO PARA LA TABLA: [{0}] CAMPO: [{1}] +StaleObjectStateException=REGISTRO DE LA TABLA: [{0}] MODIFICADO EN OTRA SESI\u00d3N, RECONSULTE LOS DATOS +NonUniqueObjectException=ESTA INGRESANDO REGISTROS DUPLICADOS EN LA TABLA: [{0}] +PropertyValueException=VALOR REQUERIDO PARA LA TABLA: [{0}] CAMPO: [{1}] +fk=NO EXISTE REFERENCIA DE [{0}] EN [{1}] +fkg=NO SE PUEDE INSERTAR EL REGISTRO DE LA TABLA {0} PORQUE EXISTE REFERENCIA EN EL CONSTRAINT {1} HACIA OTRA TABLA +fk1=NO SE PUEDE ELIMINAR EL REGISTRO YA QUE SE ENCUENTRA REFERENCIADO [{0}] EN [{1}] +fk1g=NO SE PUEDE ELIMINAR EL REGISTRO DE LA TABLA {0} PORQUE EXISTE REFERENCIA EN EL CONSTRAINT {1} HACIA OTRA TABLA +sql.unique=NO PUEDE INGRESAR UN REGISTRO QUE YA EXISTE: [{0}] +lock=RECURSO EN USO INTENTE NUEVAMENTE: [{0}] +valuelarger=EL VALOR INGRESADO SOBREPASA LA LONGITUD PERMITIDA DEL CAMPO +valueLargerWithValue=EL VALOR INGRESADO EN LA TABLA {0} EN EL CAMPO {1} SOBREPASA LA LONGITUD PERMITIDA {2} \ No newline at end of file diff --git a/base/dto/common/target/classes/userMessages_es_EC.properties b/base/dto/common/target/classes/userMessages_es_EC.properties new file mode 100644 index 0000000..0827acb --- /dev/null +++ b/base/dto/common/target/classes/userMessages_es_EC.properties @@ -0,0 +1,17 @@ +flip.success = TRANSACCION REALIZADA CORRECTAMENTE +java.lang.ClassNotFoundException = APLICACION NO INSTALADA CORRECTAMENTE. CONTACTE AL ADMINISTRADOR DEL SISTEMA +java.lang.NoClassDefFoundError = APLICACION NO INSTALADA CORRECTAMENTE. CONTACTE AL ADMINISTRADOR DEL SISTEMA +java.lang.NullPointerException = ERROR NO CONTROLADO EN LA APLICACION. CONTACTE AL PROVEEDOR +java.lang.NumberFormatException = SE ESPERABA UN VALOR NUMERICO +sql-not-null=VALOR REQUERIDO PARA LA TABLA: [{0}] CAMPO: [{1}] +StaleObjectStateException=REGISTRO DE LA TABLA: [{0}] MODIFICADO EN OTRA SESI\u00d3N, RECONSULTE LOS DATOS +NonUniqueObjectException=ESTA INGRESANDO REGISTROS DUPLICADOS EN LA TABLA: [{0}] +PropertyValueException=VALOR REQUERIDO PARA LA TABLA: [{0}] CAMPO: [{1}] +fk=NO EXISTE REFERENCIA DE [{0}] EN [{1}] +fkg=NO SE PUEDE INSERTAR EL REGISTRO DE LA TABLA {0} PORQUE EXISTE REFERENCIA EN EL CONSTRAINT {1} HACIA OTRA TABLA +fk1=NO SE PUEDE ELIMINAR EL REGISTRO YA QUE SE ENCUENTRA REFERENCIADO [{0}] EN [{1}] +fk1g=NO SE PUEDE ELIMINAR EL REGISTRO DE LA TABLA {0} PORQUE EXISTE REFERENCIA EN EL CONSTRAINT {1} HACIA OTRA TABLA +sql.unique=NO PUEDE INGRESAR UN REGISTRO QUE YA EXISTE: [{0}] +lock=RECURSO EN USO INTENTE NUEVAMENTE: [{0}] +valuelarger=EL VALOR INGRESADO SOBREPASA LA LONGITUD PERMITIDA DEL CAMPO +valueLargerWithValue=EL VALOR INGRESADO EN LA TABLA {0} EN EL CAMPO {1} SOBREPASA LA LONGITUD PERMITIDA {2} \ No newline at end of file diff --git a/base/dto/common/target/common-2.1.jar b/base/dto/common/target/common-2.1.jar new file mode 100644 index 0000000..67ada14 Binary files /dev/null and b/base/dto/common/target/common-2.1.jar differ diff --git a/base/dto/common/target/maven-archiver/pom.properties b/base/dto/common/target/maven-archiver/pom.properties new file mode 100644 index 0000000..e2db770 --- /dev/null +++ b/base/dto/common/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:52:39 ECT 2022 +version=2.1 +groupId=com.fp.base.dto +artifactId=common diff --git a/base/dto/dto/.svn/dir-prop-base b/base/dto/dto/.svn/dir-prop-base new file mode 100644 index 0000000..3e2a6f2 --- /dev/null +++ b/base/dto/dto/.svn/dir-prop-base @@ -0,0 +1,9 @@ +K 10 +svn:ignore +V 37 +.classpath +.project +.settings +target + +END diff --git a/base/dto/dto/.svn/entries b/base/dto/dto/.svn/entries new file mode 100644 index 0000000..6208c69 --- /dev/null +++ b/base/dto/dto/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto +svn://172.17.26.185/COMACO + + + +2016-01-28T19:52:45.544614Z +4419 +fpazmino +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:33.649764Z +a1f57667ce7d054132d453e42af4316a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1004 + diff --git a/base/dto/dto/.svn/text-base/pom.xml.svn-base b/base/dto/dto/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..717ce74 --- /dev/null +++ b/base/dto/dto/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,35 @@ + + + + dto + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.dto + dto + fp Platform - DTO + + + + + commons-beanutils + commons-beanutils + + + log4j + log4j + + + diff --git a/base/dto/dto/pom.xml b/base/dto/dto/pom.xml new file mode 100644 index 0000000..717ce74 --- /dev/null +++ b/base/dto/dto/pom.xml @@ -0,0 +1,35 @@ + + + + dto + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.dto + dto + fp Platform - DTO + + + + + commons-beanutils + commons-beanutils + + + log4j + log4j + + + diff --git a/base/dto/dto/src/.svn/entries b/base/dto/dto/src/.svn/entries new file mode 100644 index 0000000..a7d128b --- /dev/null +++ b/base/dto/dto/src/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src +svn://172.17.26.185/COMACO + + + +2016-01-28T19:52:45.544614Z +4419 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +main +dir + diff --git a/base/dto/dto/src/main/.svn/entries b/base/dto/dto/src/main/.svn/entries new file mode 100644 index 0000000..b94fc22 --- /dev/null +++ b/base/dto/dto/src/main/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main +svn://172.17.26.185/COMACO + + + +2016-01-28T19:52:45.544614Z +4419 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/dto/dto/src/main/java/.svn/entries b/base/dto/dto/src/main/java/.svn/entries new file mode 100644 index 0000000..197abbe --- /dev/null +++ b/base/dto/dto/src/main/java/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/java +svn://172.17.26.185/COMACO + + + +2016-01-28T19:52:45.544614Z +4419 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +com +dir + diff --git a/base/dto/dto/src/main/java/com/.svn/entries b/base/dto/dto/src/main/java/com/.svn/entries new file mode 100644 index 0000000..dfa3c74 --- /dev/null +++ b/base/dto/dto/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/java/com +svn://172.17.26.185/COMACO + + + +2016-01-28T19:52:45.544614Z +4419 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/dto/dto/src/main/java/com/fp/.svn/entries b/base/dto/dto/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..bd4df6f --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2016-01-28T19:52:45.544614Z +4419 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +dto +dir + +common +dir + diff --git a/base/dto/dto/src/main/java/com/fp/common/.svn/entries b/base/dto/dto/src/main/java/com/fp/common/.svn/entries new file mode 100644 index 0000000..ccde0e1 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/common/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/java/com/fp/common +svn://172.17.26.185/COMACO + + + +2014-11-10T13:24:34.397461Z +2562 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +helper +dir + diff --git a/base/dto/dto/src/main/java/com/fp/common/helper/.svn/entries b/base/dto/dto/src/main/java/com/fp/common/helper/.svn/entries new file mode 100644 index 0000000..f47cf2c --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/common/helper/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/java/com/fp/common/helper +svn://172.17.26.185/COMACO + + + +2014-11-10T13:24:34.397461Z +2562 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +BeanManager.java +file + + + + +2022-07-28T03:40:33.413763Z +e390f837ba673a8d6132c1c2d22da5de +2014-11-10T13:24:34.397461Z +2562 +cpiedra + + + + + + + + + + + + + + + + + + + + + +23366 + diff --git a/base/dto/dto/src/main/java/com/fp/common/helper/.svn/text-base/BeanManager.java.netbeans-base b/base/dto/dto/src/main/java/com/fp/common/helper/.svn/text-base/BeanManager.java.netbeans-base new file mode 100644 index 0000000..d8d2a18 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/common/helper/.svn/text-base/BeanManager.java.netbeans-base @@ -0,0 +1,590 @@ +package com.fp.common.helper; + +/** + * Clase utilitaria para el manejo de objetos, ejemplo permite comparar dos objetos, obtener el valor de un atributo de un objeto, fijar el valor de un atributo de un objeto, entrega informacin de datos que fueron modificado en el objeto original. + * + * @author Jorge Vaca. + * @version 2.1 + */ + +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.HashMap; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.hb.HibernateBean; + +/** + * Clase utilitaria para el manejo de objetos. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class BeanManager { + + public static SimpleDateFormat getTransportDateFormat() { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + return sdf; + } + + /** + * Obtiene el Formateador para el Transporte de Timestamp + * + * @throws java.lang.Exception Error en la creaci�n del Formateador + * @return Formateador para el Transporte de Timestamp + */ + public static SimpleDateFormat getTransportDatetimeFormat() { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return sdf; + + } + + /** + * Obtiene el formateador de Timestamps para su transaporte en String + * + * @return Formtateador + * @throws Exception + */ + public static SimpleDateFormat getTransportTimestampFormat() { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); + return sdf; + } + + /** + * Entrega el valor de un atributo perteneciente a un bean persistente. + * + * @param pObject Bean persistente. + * @param pName Nombre del atributo. + * @return + * @throws NoSuchMethodException + * @throws SecurityException + * @throws InvocationTargetException + * @throws IllegalAccessException + * @throws IllegalArgumentException + * @throws Exception + */ + public static Object getBeanAttributeValue(Object pObject, String pAttribute) throws Exception { + if (pAttribute.indexOf('.') > 0) { + String name = pAttribute.substring(0, pAttribute.indexOf('.')); + String subName = pAttribute.substring(pAttribute.indexOf('.') + 1); + name = name.substring(0, 1).toUpperCase() + name.substring(1); + Method m = null; + try { + m = pObject.getClass().getMethod("get" + name, new Class[] {}); + } catch (Exception e) { + m = pObject.getClass().getMethod("is" + name, new Class[] {}); + } + return BeanManager.getBeanAttributeValue(m.invoke(pObject, new Object[] {}), subName); + } else { + Method m = BeanManager.getBeanGetterMethod(pObject, pAttribute); + return m.invoke(pObject, new Object[] {}); + } + } + + /** + * Fija el valro de un un atributo del bean, dado el bean, nombre del atributo y el valor. + * + * @param bean Objeto a fijar el valor. + * @param pAttribute Nombre del atributo a fijar el valor. + * @param pValue Valor a alamcenar en el atributo. + * @return Object + * @throws Exception + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static Object setAbstractDataTransportAttributeValue(HibernateBean bean, String pAttribute, Object pValue) throws Exception { + try { + BeanManager.setBeanAttributeValue(bean, pAttribute, pValue); + } catch (IllegalArgumentException e) { + Class type = BeanManager.getBeanGetterMethod(bean, pAttribute).getReturnType(); + pValue = BeanManager.convertObject(pValue, type); + try { + BeanManager.setBeanAttributeValue(bean, pAttribute, pValue); + } catch (NoSuchMethodException e2) { + ((AbstractDataTransport) bean).put(pAttribute, pValue); + } + } + return bean; + } + + /** + * Fija el valor de un atributo en un TransportBean. + * + * @param pObject Referencia a TransportBean. + * @param pAttribute Nombre del atributo a fijar el valor. + * @param pValue Valor a fijar en el atributo del bean. + * @return + * @throws NoSuchMethodException + * @throws SecurityException + * @throws InvocationTargetException + * @throws IllegalAccessException + * @throws IllegalArgumentException + * @throws Exception + */ + public static Object setBeanAttributeValue(Object pObject, String pAttribute, Object pValue) throws SecurityException, NoSuchMethodException, + IllegalArgumentException, IllegalAccessException, InvocationTargetException { + if (pAttribute.indexOf('.') > 0) { + String name = pAttribute.substring(0, pAttribute.indexOf('.')); + String subName = pAttribute.substring(pAttribute.indexOf('.') + 1); + name = name.substring(0, 1).toUpperCase() + name.substring(1); + Method m = pObject.getClass().getMethod("get" + name, new Class[] {}); + return BeanManager.setBeanAttributeValue(m.invoke(pObject, new Object[] {}), subName, pValue); + } else { + Method m = BeanManager.getBeanSetterMethod(pObject, pAttribute, pValue); + return m.invoke(pObject, new Object[] { pValue }); + } + } + + @SuppressWarnings("unchecked") + public static T convertObject(Object pValue, Class pType) throws ParseException { + return BeanManager.convertObject(pValue, pType, false); + } + + @SuppressWarnings("unchecked") + public static T convertObject(Object pValue, Class pType, boolean pUpper) throws ParseException { + Object value = pValue; + if (pType.getName().compareTo("java.lang.String") == 0 && pUpper) { + if (value != null) { + value = value.toString().toUpperCase(); + } + } + try { + if (value == null || value.getClass().getName().compareTo(pType.getName()) == 0) { + return (T) value; + } + if (value != null) { + if (pType.getName().compareTo("java.lang.String") != 0 && pValue.toString().compareTo("") == 0) { + return null; + } + } + + return pType.cast(value); + } catch (ClassCastException e) { + ; + } + String sValue = value.toString(); + Class[] param = { String.class }; + try { + Constructor c = pType.getConstructor(param); + Object[] data = { sValue }; + return (T) c.newInstance(data); + } catch (Exception e) { + // No hacer nada + } + if (pType.getName().compareTo(Timestamp.class.getName()) == 0) { + String val = sValue; + if (sValue.indexOf(".") < 0) { + sValue += ".0"; + } + String d[] = sValue.split(" "); + if (d.length == 2) { + sValue = d[0] + " " + d[1].replaceAll("-", ":"); + } + try { + return (T) new Timestamp(BeanManager.getTransportTimestampFormat().parse(sValue).getTime()); + } catch (Exception e) { + return (T) new Timestamp(BeanManager.getTransportDateFormat().parse(val).getTime()); + } + } + if (pType.getName().compareTo(Date.class.getName()) == 0) { + String d[] = sValue.split(" "); + if (d.length == 2) { + sValue = d[0]; + } + return (T) new Date(BeanManager.getTransportDateFormat().parse(sValue).getTime()); + } + /* + * if(pType.getName().compareTo(Clob.class.getName()) == 0){ ClobImpl clob = new ClobImpl(sValue); return clob; + * } if(pType.getName().compareTo(Blob.class.getName()) == 0){ BlobImpl blob = new BlobImpl(sValue.getBytes()); + * return blob; } + */ + return (T) value; + } + + /** + * Entrega el valor de un atributo para que sea comparable. + * + * @param pObject Bean de referencia. + * @param pAttribute Atributo a obtener el valor. + * @return + * @throws SecurityException + * @throws IllegalArgumentException + * @throws NoSuchMethodException + * @throws IllegalAccessException + * @throws InvocationTargetException + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static Comparable getBeanAttributeComparable(Object pObject, String pAttribute) throws SecurityException, + IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, Exception { + return (Comparable) BeanManager.getBeanAttributeValue(pObject, pAttribute); + } + + /** + * Entrega el valor de un atributo perteneciente a un bean persistente. + * + * @param pObject Bean persistente. + * @param pName Nombre del atributo. + * @return + * @throws NoSuchMethodException + * @throws SecurityException + * @throws Exception + */ + public static Method getBeanGetterMethod(Object pObject, String pField) throws SecurityException, NoSuchMethodException, ClassNotFoundException, + IllegalAccessException, InstantiationException { + Method m = null; + if (pField.indexOf('.') > 0) { + m = BeanManager.getMethodpk(pObject, pField); + } else { + m = BeanManager.getMethodnormal(pObject, pField); + } + return m; + } + + private static Method getMethodnormal(Object pObject, String pField) throws SecurityException, NoSuchMethodException { + pField = pField.substring(0, 1).toUpperCase() + pField.substring(1); + Method m = null; + try { + m = BeanManager.getMethod(pObject, "get" + pField, null); + } catch (Exception e) { + m = BeanManager.getMethod(pObject, "is" + pField, null); + } + return m; + } + + private static Method getMethodpk(Object pObject, String pAttribute) throws SecurityException, NoSuchMethodException, ClassNotFoundException, + IllegalAccessException, InstantiationException { + Method m = null; + Object bean = null; + String classpk = ""; + if (pAttribute.indexOf('.') > 0) { + String subName = pAttribute.substring(pAttribute.indexOf('.') + 1); + subName = subName.substring(0, 1).toUpperCase() + subName.substring(1); + classpk = pObject.getClass().getName() + "Key"; + try { + bean = BeanManager.getBeanAttributeValue(pObject, "pk"); + } catch (Exception e) { + // No hacer nada + } + if (bean == null) { + bean = Class.forName(classpk).newInstance(); + } + try { + m = bean.getClass().getMethod("get" + subName, new Class[] {}); + } catch (Exception e) { + m = bean.getClass().getMethod("is" + subName, new Class[] {}); + } + } + return m; + } + + private static Method getMethod(Object pObject, String pMethod, Object pValue) throws NoSuchMethodException { + Method[] m = pObject.getClass().getMethods(); + Method method = null; + for (Method me : m) { + if (me.getName().compareTo(pMethod) == 0) { + method = me; + break; + } + } + if (method == null) { + method = pObject.getClass().getMethod(pMethod, pValue == null ? null : new Class[] { pValue.getClass() }); + } + return method; + } + + /** + * Entrega el nombre del metodo a invocar para fijar un valor en un Bean. + * + * @param pObject Bean de referencia. + * @param pAttribute Nombre del atributo a fijar el valor. + * @param pValue Valor a fijar en el atributo. + * @return + * @throws SecurityException + * @throws NoSuchMethodException + */ + public static Method getBeanSetterMethod(Object pObject, String pAttribute, Object pValue) throws SecurityException, NoSuchMethodException { + pAttribute = pAttribute.substring(0, 1).toUpperCase() + pAttribute.substring(1); + return BeanManager.getMethod(pObject, "set" + pAttribute, pValue); + } + + /** + * Compara dos Objetos, si los objetos son iguales retorna true. + * + * @param pObject Objeto uno. + * @param pOtherObject Objeto dos + * @return + * @throws SecurityException + * @throws IllegalArgumentException + * @throws NoSuchMethodException + * @throws IllegalAccessException + * @throws InvocationTargetException + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static boolean compareObject(Object pObject, Object pOtherObject) throws SecurityException, IllegalArgumentException, + NoSuchMethodException, IllegalAccessException, InvocationTargetException, Exception { + Field f[] = pObject.getClass().getDeclaredFields(); + boolean equal = true; + for (Field obj : f) { + if (obj.getName().compareTo("pk") == 0 || obj.getName().compareTo("hashValue") == 0 || obj.getName().compareTo("class") == 0 + || obj.getName().compareTo("serialVersionUID") == 0) { + continue; + } + Object value = null; + try { + value = BeanManager.getBeanAttributeValue(pObject, obj.getName()); + } catch (NoSuchMethodException e) { + continue; + } + Object value1 = null; + try { + value1 = BeanManager.getBeanAttributeValue(pOtherObject, obj.getName()); + } catch (Exception e) { + continue; + } + if (value == null && value1 == null) { + continue; + } + if (!(value != null && value instanceof Comparable)) { + continue; + } + if (!(value1 != null && value1 instanceof Comparable)) { + continue; + } + if (value == null && value1 != null) { + return false; + } + if (value1 == null && value != null) { + return false; + } + if (((Comparable) value).compareTo(value1) != 0) { + return false; + } + } + return equal; + } + + /** + * Metodo que se encarga de hacer un merge de dos objetos, si los datos de un campo del objeto origen son diferentes + * a los del destino remplazo los datos destino con los datos del origen. + * + * @param pSourceObject Datos del objeto orgigene a copiar al destino. + * @param pDestinyObject Datos del objeto destino. + * @throws SecurityException + * @throws IllegalArgumentException + * @throws NoSuchMethodException + * @throws IllegalAccessException + * @throws InvocationTargetException + * @throws Exception + */ + public static void mergeObject(Object pSourceObject, Object pDestinyObject) throws SecurityException, IllegalArgumentException, + NoSuchMethodException, IllegalAccessException, InvocationTargetException, Exception { + Field f[] = pSourceObject.getClass().getDeclaredFields(); + for (Field obj : f) { + if (obj.getName().compareTo("pk") == 0 || obj.getName().compareTo("hashValue") == 0 || obj.getName().compareTo("class") == 0 + || obj.getName().compareTo("serialVersionUID") == 0) { + continue; + } + Object value = BeanManager.getBeanAttributeValue(pSourceObject, obj.getName()); + Object value1 = BeanManager.getBeanAttributeValue(pDestinyObject, obj.getName()); + if (!BeanManager.isEqual(value, value1)) { + BeanManager.setBeanAttributeValue(pDestinyObject, obj.getName(), value); + } + } + } + + /** + * Metodo que compara el valor de dos objetos simples no compuestos, ejemplo BigDecimal, String, Integer etc. + * + * @param pValue valor a compar + * @param pValue1 valor con el que se compara el primer parametro. + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + private static boolean isEqual(Object pValue, Object pValue1) throws Exception { + if (pValue == null && pValue1 == null) { + return true; + } else if (pValue == null && pValue1 != null) { + return false; + } else if (pValue1 == null && pValue != null) { + return false; + } else if (!(pValue != null && pValue instanceof Comparable)) { + return true; + } else if (!(pValue1 != null && pValue1 instanceof Comparable)) { + return true; + } else if (((Comparable) pValue).compareTo(pValue1) != 0) { + return false; + } else { + return true; + } + } + + /** + * Metodo que compara dos string dado la una condicion. + * + * @param pValue Valor del primer string. + * @param pOtherValue Valor con el que se compara el primer string. + * @param pCondition Condicion con la que se evalua los dos strings. + * @return + */ + public static boolean compareString(String pValue, String pOtherValue, String pCondition) { + if (pCondition.compareTo("==") == 0 || pCondition.compareTo("=") == 0) { + if (pValue.compareTo(pOtherValue) == 0) { + return true; + } + } + if (pCondition.compareTo("!=") == 0) { + if (pValue.compareTo(pOtherValue) != 0) { + return true; + } + } + if (pCondition.compareTo(">") == 0) { + if (pValue.compareTo(pOtherValue) > 0) { + return true; + } + } + if (pCondition.compareTo(">=") == 0) { + if (pValue.compareTo(pOtherValue) >= 0) { + return true; + } + } + if (pCondition.compareTo("<") == 0) { + if (pValue.compareTo(pOtherValue) < 0) { + return true; + } + } + if (pCondition.compareTo("<=") == 0) { + if (pValue.compareTo(pOtherValue) <= 0) { + return true; + } + } + return false; + } + + /** + * Metodo que compara dos BigDecimal dado la una condicion. + * + * @param pValue Valor del primer BigDecimal. + * @param pOtherValue Valor con el que se compara el primer BigDecimal. + * @param pCondition Condicion con la que se evalua los dos BigDecimal. + * @return + */ + public static boolean compareBigDecimal(BigDecimal pValue, BigDecimal pOtherValue, String pCondition) { + if (pCondition.compareTo("==") == 0 || pCondition.compareTo("=") == 0) { + if (pValue.compareTo(pOtherValue) == 0) { + return true; + } + } + if (pCondition.compareTo("!=") == 0) { + if (pValue.compareTo(pOtherValue) != 0) { + return true; + } + } + if (pCondition.compareTo(">") == 0) { + if (pValue.compareTo(pOtherValue) > 0) { + return true; + } + } + if (pCondition.compareTo(">=") == 0) { + if (pValue.compareTo(pOtherValue) >= 0) { + return true; + } + } + if (pCondition.compareTo("<") == 0) { + if (pValue.compareTo(pOtherValue) < 0) { + return true; + } + } + if (pCondition.compareTo("<=") == 0) { + if (pValue.compareTo(pOtherValue) <= 0) { + return true; + } + } + return false; + } + + public static Integer getRecordversion(Object bean) throws Exception { + Object optlock; + try { + optlock = BeanManager.getBeanAttributeValue(bean, "recordversion"); + } catch (NoSuchMethodException e) { + return null; + } + if (optlock == null) { + return 0; + } + return Integer.valueOf(optlock.toString()); + } + + @SuppressWarnings("unchecked") + public static HashMap getModified(AbstractDataTransport beanoriginal, AbstractDataTransport beanmodificado) throws Exception { + + HashMap updated = new HashMap(); + Field f[] = beanoriginal.getClass().getDeclaredFields(); + boolean modificado = false; + Integer optlock = null; + + for (Field obj : f) { + modificado = false; + String ncampo = obj.getName(); + if (ncampo.compareTo("pk") == 0 || ncampo.compareTo("hashValue") == 0 || ncampo.compareTo("class") == 0 + || ncampo.compareTo("serialVersionUID") == 0) { + continue; + } + Object valori, valmod = null; + try { + valori = BeanManager.getBeanAttributeValue(beanoriginal, obj.getName()); + valmod = BeanManager.getBeanAttributeValue(beanmodificado, obj.getName()); + } catch (NoSuchMethodException e) { + continue; + } + if (valmod instanceof byte[]) { + updated.put(ncampo, valmod); + continue; + } + if (ncampo.equals("recordversion")) { + optlock = (Integer) valmod; + continue; + } + if (valori == null && valmod == null) { + continue; + } + if (valori == null && valmod != null) { + modificado = true; + } + if (valmod == null && valori != null) { + modificado = true; + } + if (valori != null && valmod != null && ((Comparable) valori).compareTo(valmod) != 0) { + modificado = true; + } + if (modificado) { + updated.put(ncampo, valmod); + } + } + if (!updated.isEmpty()) { + updated.put("pk", BeanManager.getBeanAttributeValue(beanmodificado, "pk")); + if (optlock != null) { + updated.put("recordversion", BeanManager.getBeanAttributeValue(beanmodificado, "recordversion")); + } + + // hay que crear el objeto para poder eliminar el bean original. + HashMap mdata = new HashMap(); + mdata = (HashMap) BeanManager.getBeanAttributeValue(beanmodificado, "modifiedData"); + // mdata.remove("ORIGINALBEAN"); + updated.put("modifiedData", mdata); + updated.put("rowkey", BeanManager.getBeanAttributeValue(beanmodificado, "rowkey")); + + } + return updated; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/common/helper/.svn/text-base/BeanManager.java.svn-base b/base/dto/dto/src/main/java/com/fp/common/helper/.svn/text-base/BeanManager.java.svn-base new file mode 100644 index 0000000..d8d2a18 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/common/helper/.svn/text-base/BeanManager.java.svn-base @@ -0,0 +1,590 @@ +package com.fp.common.helper; + +/** + * Clase utilitaria para el manejo de objetos, ejemplo permite comparar dos objetos, obtener el valor de un atributo de un objeto, fijar el valor de un atributo de un objeto, entrega informacin de datos que fueron modificado en el objeto original. + * + * @author Jorge Vaca. + * @version 2.1 + */ + +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.HashMap; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.hb.HibernateBean; + +/** + * Clase utilitaria para el manejo de objetos. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class BeanManager { + + public static SimpleDateFormat getTransportDateFormat() { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + return sdf; + } + + /** + * Obtiene el Formateador para el Transporte de Timestamp + * + * @throws java.lang.Exception Error en la creaci�n del Formateador + * @return Formateador para el Transporte de Timestamp + */ + public static SimpleDateFormat getTransportDatetimeFormat() { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return sdf; + + } + + /** + * Obtiene el formateador de Timestamps para su transaporte en String + * + * @return Formtateador + * @throws Exception + */ + public static SimpleDateFormat getTransportTimestampFormat() { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); + return sdf; + } + + /** + * Entrega el valor de un atributo perteneciente a un bean persistente. + * + * @param pObject Bean persistente. + * @param pName Nombre del atributo. + * @return + * @throws NoSuchMethodException + * @throws SecurityException + * @throws InvocationTargetException + * @throws IllegalAccessException + * @throws IllegalArgumentException + * @throws Exception + */ + public static Object getBeanAttributeValue(Object pObject, String pAttribute) throws Exception { + if (pAttribute.indexOf('.') > 0) { + String name = pAttribute.substring(0, pAttribute.indexOf('.')); + String subName = pAttribute.substring(pAttribute.indexOf('.') + 1); + name = name.substring(0, 1).toUpperCase() + name.substring(1); + Method m = null; + try { + m = pObject.getClass().getMethod("get" + name, new Class[] {}); + } catch (Exception e) { + m = pObject.getClass().getMethod("is" + name, new Class[] {}); + } + return BeanManager.getBeanAttributeValue(m.invoke(pObject, new Object[] {}), subName); + } else { + Method m = BeanManager.getBeanGetterMethod(pObject, pAttribute); + return m.invoke(pObject, new Object[] {}); + } + } + + /** + * Fija el valro de un un atributo del bean, dado el bean, nombre del atributo y el valor. + * + * @param bean Objeto a fijar el valor. + * @param pAttribute Nombre del atributo a fijar el valor. + * @param pValue Valor a alamcenar en el atributo. + * @return Object + * @throws Exception + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static Object setAbstractDataTransportAttributeValue(HibernateBean bean, String pAttribute, Object pValue) throws Exception { + try { + BeanManager.setBeanAttributeValue(bean, pAttribute, pValue); + } catch (IllegalArgumentException e) { + Class type = BeanManager.getBeanGetterMethod(bean, pAttribute).getReturnType(); + pValue = BeanManager.convertObject(pValue, type); + try { + BeanManager.setBeanAttributeValue(bean, pAttribute, pValue); + } catch (NoSuchMethodException e2) { + ((AbstractDataTransport) bean).put(pAttribute, pValue); + } + } + return bean; + } + + /** + * Fija el valor de un atributo en un TransportBean. + * + * @param pObject Referencia a TransportBean. + * @param pAttribute Nombre del atributo a fijar el valor. + * @param pValue Valor a fijar en el atributo del bean. + * @return + * @throws NoSuchMethodException + * @throws SecurityException + * @throws InvocationTargetException + * @throws IllegalAccessException + * @throws IllegalArgumentException + * @throws Exception + */ + public static Object setBeanAttributeValue(Object pObject, String pAttribute, Object pValue) throws SecurityException, NoSuchMethodException, + IllegalArgumentException, IllegalAccessException, InvocationTargetException { + if (pAttribute.indexOf('.') > 0) { + String name = pAttribute.substring(0, pAttribute.indexOf('.')); + String subName = pAttribute.substring(pAttribute.indexOf('.') + 1); + name = name.substring(0, 1).toUpperCase() + name.substring(1); + Method m = pObject.getClass().getMethod("get" + name, new Class[] {}); + return BeanManager.setBeanAttributeValue(m.invoke(pObject, new Object[] {}), subName, pValue); + } else { + Method m = BeanManager.getBeanSetterMethod(pObject, pAttribute, pValue); + return m.invoke(pObject, new Object[] { pValue }); + } + } + + @SuppressWarnings("unchecked") + public static T convertObject(Object pValue, Class pType) throws ParseException { + return BeanManager.convertObject(pValue, pType, false); + } + + @SuppressWarnings("unchecked") + public static T convertObject(Object pValue, Class pType, boolean pUpper) throws ParseException { + Object value = pValue; + if (pType.getName().compareTo("java.lang.String") == 0 && pUpper) { + if (value != null) { + value = value.toString().toUpperCase(); + } + } + try { + if (value == null || value.getClass().getName().compareTo(pType.getName()) == 0) { + return (T) value; + } + if (value != null) { + if (pType.getName().compareTo("java.lang.String") != 0 && pValue.toString().compareTo("") == 0) { + return null; + } + } + + return pType.cast(value); + } catch (ClassCastException e) { + ; + } + String sValue = value.toString(); + Class[] param = { String.class }; + try { + Constructor c = pType.getConstructor(param); + Object[] data = { sValue }; + return (T) c.newInstance(data); + } catch (Exception e) { + // No hacer nada + } + if (pType.getName().compareTo(Timestamp.class.getName()) == 0) { + String val = sValue; + if (sValue.indexOf(".") < 0) { + sValue += ".0"; + } + String d[] = sValue.split(" "); + if (d.length == 2) { + sValue = d[0] + " " + d[1].replaceAll("-", ":"); + } + try { + return (T) new Timestamp(BeanManager.getTransportTimestampFormat().parse(sValue).getTime()); + } catch (Exception e) { + return (T) new Timestamp(BeanManager.getTransportDateFormat().parse(val).getTime()); + } + } + if (pType.getName().compareTo(Date.class.getName()) == 0) { + String d[] = sValue.split(" "); + if (d.length == 2) { + sValue = d[0]; + } + return (T) new Date(BeanManager.getTransportDateFormat().parse(sValue).getTime()); + } + /* + * if(pType.getName().compareTo(Clob.class.getName()) == 0){ ClobImpl clob = new ClobImpl(sValue); return clob; + * } if(pType.getName().compareTo(Blob.class.getName()) == 0){ BlobImpl blob = new BlobImpl(sValue.getBytes()); + * return blob; } + */ + return (T) value; + } + + /** + * Entrega el valor de un atributo para que sea comparable. + * + * @param pObject Bean de referencia. + * @param pAttribute Atributo a obtener el valor. + * @return + * @throws SecurityException + * @throws IllegalArgumentException + * @throws NoSuchMethodException + * @throws IllegalAccessException + * @throws InvocationTargetException + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static Comparable getBeanAttributeComparable(Object pObject, String pAttribute) throws SecurityException, + IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, Exception { + return (Comparable) BeanManager.getBeanAttributeValue(pObject, pAttribute); + } + + /** + * Entrega el valor de un atributo perteneciente a un bean persistente. + * + * @param pObject Bean persistente. + * @param pName Nombre del atributo. + * @return + * @throws NoSuchMethodException + * @throws SecurityException + * @throws Exception + */ + public static Method getBeanGetterMethod(Object pObject, String pField) throws SecurityException, NoSuchMethodException, ClassNotFoundException, + IllegalAccessException, InstantiationException { + Method m = null; + if (pField.indexOf('.') > 0) { + m = BeanManager.getMethodpk(pObject, pField); + } else { + m = BeanManager.getMethodnormal(pObject, pField); + } + return m; + } + + private static Method getMethodnormal(Object pObject, String pField) throws SecurityException, NoSuchMethodException { + pField = pField.substring(0, 1).toUpperCase() + pField.substring(1); + Method m = null; + try { + m = BeanManager.getMethod(pObject, "get" + pField, null); + } catch (Exception e) { + m = BeanManager.getMethod(pObject, "is" + pField, null); + } + return m; + } + + private static Method getMethodpk(Object pObject, String pAttribute) throws SecurityException, NoSuchMethodException, ClassNotFoundException, + IllegalAccessException, InstantiationException { + Method m = null; + Object bean = null; + String classpk = ""; + if (pAttribute.indexOf('.') > 0) { + String subName = pAttribute.substring(pAttribute.indexOf('.') + 1); + subName = subName.substring(0, 1).toUpperCase() + subName.substring(1); + classpk = pObject.getClass().getName() + "Key"; + try { + bean = BeanManager.getBeanAttributeValue(pObject, "pk"); + } catch (Exception e) { + // No hacer nada + } + if (bean == null) { + bean = Class.forName(classpk).newInstance(); + } + try { + m = bean.getClass().getMethod("get" + subName, new Class[] {}); + } catch (Exception e) { + m = bean.getClass().getMethod("is" + subName, new Class[] {}); + } + } + return m; + } + + private static Method getMethod(Object pObject, String pMethod, Object pValue) throws NoSuchMethodException { + Method[] m = pObject.getClass().getMethods(); + Method method = null; + for (Method me : m) { + if (me.getName().compareTo(pMethod) == 0) { + method = me; + break; + } + } + if (method == null) { + method = pObject.getClass().getMethod(pMethod, pValue == null ? null : new Class[] { pValue.getClass() }); + } + return method; + } + + /** + * Entrega el nombre del metodo a invocar para fijar un valor en un Bean. + * + * @param pObject Bean de referencia. + * @param pAttribute Nombre del atributo a fijar el valor. + * @param pValue Valor a fijar en el atributo. + * @return + * @throws SecurityException + * @throws NoSuchMethodException + */ + public static Method getBeanSetterMethod(Object pObject, String pAttribute, Object pValue) throws SecurityException, NoSuchMethodException { + pAttribute = pAttribute.substring(0, 1).toUpperCase() + pAttribute.substring(1); + return BeanManager.getMethod(pObject, "set" + pAttribute, pValue); + } + + /** + * Compara dos Objetos, si los objetos son iguales retorna true. + * + * @param pObject Objeto uno. + * @param pOtherObject Objeto dos + * @return + * @throws SecurityException + * @throws IllegalArgumentException + * @throws NoSuchMethodException + * @throws IllegalAccessException + * @throws InvocationTargetException + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static boolean compareObject(Object pObject, Object pOtherObject) throws SecurityException, IllegalArgumentException, + NoSuchMethodException, IllegalAccessException, InvocationTargetException, Exception { + Field f[] = pObject.getClass().getDeclaredFields(); + boolean equal = true; + for (Field obj : f) { + if (obj.getName().compareTo("pk") == 0 || obj.getName().compareTo("hashValue") == 0 || obj.getName().compareTo("class") == 0 + || obj.getName().compareTo("serialVersionUID") == 0) { + continue; + } + Object value = null; + try { + value = BeanManager.getBeanAttributeValue(pObject, obj.getName()); + } catch (NoSuchMethodException e) { + continue; + } + Object value1 = null; + try { + value1 = BeanManager.getBeanAttributeValue(pOtherObject, obj.getName()); + } catch (Exception e) { + continue; + } + if (value == null && value1 == null) { + continue; + } + if (!(value != null && value instanceof Comparable)) { + continue; + } + if (!(value1 != null && value1 instanceof Comparable)) { + continue; + } + if (value == null && value1 != null) { + return false; + } + if (value1 == null && value != null) { + return false; + } + if (((Comparable) value).compareTo(value1) != 0) { + return false; + } + } + return equal; + } + + /** + * Metodo que se encarga de hacer un merge de dos objetos, si los datos de un campo del objeto origen son diferentes + * a los del destino remplazo los datos destino con los datos del origen. + * + * @param pSourceObject Datos del objeto orgigene a copiar al destino. + * @param pDestinyObject Datos del objeto destino. + * @throws SecurityException + * @throws IllegalArgumentException + * @throws NoSuchMethodException + * @throws IllegalAccessException + * @throws InvocationTargetException + * @throws Exception + */ + public static void mergeObject(Object pSourceObject, Object pDestinyObject) throws SecurityException, IllegalArgumentException, + NoSuchMethodException, IllegalAccessException, InvocationTargetException, Exception { + Field f[] = pSourceObject.getClass().getDeclaredFields(); + for (Field obj : f) { + if (obj.getName().compareTo("pk") == 0 || obj.getName().compareTo("hashValue") == 0 || obj.getName().compareTo("class") == 0 + || obj.getName().compareTo("serialVersionUID") == 0) { + continue; + } + Object value = BeanManager.getBeanAttributeValue(pSourceObject, obj.getName()); + Object value1 = BeanManager.getBeanAttributeValue(pDestinyObject, obj.getName()); + if (!BeanManager.isEqual(value, value1)) { + BeanManager.setBeanAttributeValue(pDestinyObject, obj.getName(), value); + } + } + } + + /** + * Metodo que compara el valor de dos objetos simples no compuestos, ejemplo BigDecimal, String, Integer etc. + * + * @param pValue valor a compar + * @param pValue1 valor con el que se compara el primer parametro. + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + private static boolean isEqual(Object pValue, Object pValue1) throws Exception { + if (pValue == null && pValue1 == null) { + return true; + } else if (pValue == null && pValue1 != null) { + return false; + } else if (pValue1 == null && pValue != null) { + return false; + } else if (!(pValue != null && pValue instanceof Comparable)) { + return true; + } else if (!(pValue1 != null && pValue1 instanceof Comparable)) { + return true; + } else if (((Comparable) pValue).compareTo(pValue1) != 0) { + return false; + } else { + return true; + } + } + + /** + * Metodo que compara dos string dado la una condicion. + * + * @param pValue Valor del primer string. + * @param pOtherValue Valor con el que se compara el primer string. + * @param pCondition Condicion con la que se evalua los dos strings. + * @return + */ + public static boolean compareString(String pValue, String pOtherValue, String pCondition) { + if (pCondition.compareTo("==") == 0 || pCondition.compareTo("=") == 0) { + if (pValue.compareTo(pOtherValue) == 0) { + return true; + } + } + if (pCondition.compareTo("!=") == 0) { + if (pValue.compareTo(pOtherValue) != 0) { + return true; + } + } + if (pCondition.compareTo(">") == 0) { + if (pValue.compareTo(pOtherValue) > 0) { + return true; + } + } + if (pCondition.compareTo(">=") == 0) { + if (pValue.compareTo(pOtherValue) >= 0) { + return true; + } + } + if (pCondition.compareTo("<") == 0) { + if (pValue.compareTo(pOtherValue) < 0) { + return true; + } + } + if (pCondition.compareTo("<=") == 0) { + if (pValue.compareTo(pOtherValue) <= 0) { + return true; + } + } + return false; + } + + /** + * Metodo que compara dos BigDecimal dado la una condicion. + * + * @param pValue Valor del primer BigDecimal. + * @param pOtherValue Valor con el que se compara el primer BigDecimal. + * @param pCondition Condicion con la que se evalua los dos BigDecimal. + * @return + */ + public static boolean compareBigDecimal(BigDecimal pValue, BigDecimal pOtherValue, String pCondition) { + if (pCondition.compareTo("==") == 0 || pCondition.compareTo("=") == 0) { + if (pValue.compareTo(pOtherValue) == 0) { + return true; + } + } + if (pCondition.compareTo("!=") == 0) { + if (pValue.compareTo(pOtherValue) != 0) { + return true; + } + } + if (pCondition.compareTo(">") == 0) { + if (pValue.compareTo(pOtherValue) > 0) { + return true; + } + } + if (pCondition.compareTo(">=") == 0) { + if (pValue.compareTo(pOtherValue) >= 0) { + return true; + } + } + if (pCondition.compareTo("<") == 0) { + if (pValue.compareTo(pOtherValue) < 0) { + return true; + } + } + if (pCondition.compareTo("<=") == 0) { + if (pValue.compareTo(pOtherValue) <= 0) { + return true; + } + } + return false; + } + + public static Integer getRecordversion(Object bean) throws Exception { + Object optlock; + try { + optlock = BeanManager.getBeanAttributeValue(bean, "recordversion"); + } catch (NoSuchMethodException e) { + return null; + } + if (optlock == null) { + return 0; + } + return Integer.valueOf(optlock.toString()); + } + + @SuppressWarnings("unchecked") + public static HashMap getModified(AbstractDataTransport beanoriginal, AbstractDataTransport beanmodificado) throws Exception { + + HashMap updated = new HashMap(); + Field f[] = beanoriginal.getClass().getDeclaredFields(); + boolean modificado = false; + Integer optlock = null; + + for (Field obj : f) { + modificado = false; + String ncampo = obj.getName(); + if (ncampo.compareTo("pk") == 0 || ncampo.compareTo("hashValue") == 0 || ncampo.compareTo("class") == 0 + || ncampo.compareTo("serialVersionUID") == 0) { + continue; + } + Object valori, valmod = null; + try { + valori = BeanManager.getBeanAttributeValue(beanoriginal, obj.getName()); + valmod = BeanManager.getBeanAttributeValue(beanmodificado, obj.getName()); + } catch (NoSuchMethodException e) { + continue; + } + if (valmod instanceof byte[]) { + updated.put(ncampo, valmod); + continue; + } + if (ncampo.equals("recordversion")) { + optlock = (Integer) valmod; + continue; + } + if (valori == null && valmod == null) { + continue; + } + if (valori == null && valmod != null) { + modificado = true; + } + if (valmod == null && valori != null) { + modificado = true; + } + if (valori != null && valmod != null && ((Comparable) valori).compareTo(valmod) != 0) { + modificado = true; + } + if (modificado) { + updated.put(ncampo, valmod); + } + } + if (!updated.isEmpty()) { + updated.put("pk", BeanManager.getBeanAttributeValue(beanmodificado, "pk")); + if (optlock != null) { + updated.put("recordversion", BeanManager.getBeanAttributeValue(beanmodificado, "recordversion")); + } + + // hay que crear el objeto para poder eliminar el bean original. + HashMap mdata = new HashMap(); + mdata = (HashMap) BeanManager.getBeanAttributeValue(beanmodificado, "modifiedData"); + // mdata.remove("ORIGINALBEAN"); + updated.put("modifiedData", mdata); + updated.put("rowkey", BeanManager.getBeanAttributeValue(beanmodificado, "rowkey")); + + } + return updated; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/common/helper/BeanManager.java b/base/dto/dto/src/main/java/com/fp/common/helper/BeanManager.java new file mode 100644 index 0000000..d8d2a18 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/common/helper/BeanManager.java @@ -0,0 +1,590 @@ +package com.fp.common.helper; + +/** + * Clase utilitaria para el manejo de objetos, ejemplo permite comparar dos objetos, obtener el valor de un atributo de un objeto, fijar el valor de un atributo de un objeto, entrega informacin de datos que fueron modificado en el objeto original. + * + * @author Jorge Vaca. + * @version 2.1 + */ + +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.HashMap; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.hb.HibernateBean; + +/** + * Clase utilitaria para el manejo de objetos. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class BeanManager { + + public static SimpleDateFormat getTransportDateFormat() { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + return sdf; + } + + /** + * Obtiene el Formateador para el Transporte de Timestamp + * + * @throws java.lang.Exception Error en la creaci�n del Formateador + * @return Formateador para el Transporte de Timestamp + */ + public static SimpleDateFormat getTransportDatetimeFormat() { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return sdf; + + } + + /** + * Obtiene el formateador de Timestamps para su transaporte en String + * + * @return Formtateador + * @throws Exception + */ + public static SimpleDateFormat getTransportTimestampFormat() { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); + return sdf; + } + + /** + * Entrega el valor de un atributo perteneciente a un bean persistente. + * + * @param pObject Bean persistente. + * @param pName Nombre del atributo. + * @return + * @throws NoSuchMethodException + * @throws SecurityException + * @throws InvocationTargetException + * @throws IllegalAccessException + * @throws IllegalArgumentException + * @throws Exception + */ + public static Object getBeanAttributeValue(Object pObject, String pAttribute) throws Exception { + if (pAttribute.indexOf('.') > 0) { + String name = pAttribute.substring(0, pAttribute.indexOf('.')); + String subName = pAttribute.substring(pAttribute.indexOf('.') + 1); + name = name.substring(0, 1).toUpperCase() + name.substring(1); + Method m = null; + try { + m = pObject.getClass().getMethod("get" + name, new Class[] {}); + } catch (Exception e) { + m = pObject.getClass().getMethod("is" + name, new Class[] {}); + } + return BeanManager.getBeanAttributeValue(m.invoke(pObject, new Object[] {}), subName); + } else { + Method m = BeanManager.getBeanGetterMethod(pObject, pAttribute); + return m.invoke(pObject, new Object[] {}); + } + } + + /** + * Fija el valro de un un atributo del bean, dado el bean, nombre del atributo y el valor. + * + * @param bean Objeto a fijar el valor. + * @param pAttribute Nombre del atributo a fijar el valor. + * @param pValue Valor a alamcenar en el atributo. + * @return Object + * @throws Exception + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static Object setAbstractDataTransportAttributeValue(HibernateBean bean, String pAttribute, Object pValue) throws Exception { + try { + BeanManager.setBeanAttributeValue(bean, pAttribute, pValue); + } catch (IllegalArgumentException e) { + Class type = BeanManager.getBeanGetterMethod(bean, pAttribute).getReturnType(); + pValue = BeanManager.convertObject(pValue, type); + try { + BeanManager.setBeanAttributeValue(bean, pAttribute, pValue); + } catch (NoSuchMethodException e2) { + ((AbstractDataTransport) bean).put(pAttribute, pValue); + } + } + return bean; + } + + /** + * Fija el valor de un atributo en un TransportBean. + * + * @param pObject Referencia a TransportBean. + * @param pAttribute Nombre del atributo a fijar el valor. + * @param pValue Valor a fijar en el atributo del bean. + * @return + * @throws NoSuchMethodException + * @throws SecurityException + * @throws InvocationTargetException + * @throws IllegalAccessException + * @throws IllegalArgumentException + * @throws Exception + */ + public static Object setBeanAttributeValue(Object pObject, String pAttribute, Object pValue) throws SecurityException, NoSuchMethodException, + IllegalArgumentException, IllegalAccessException, InvocationTargetException { + if (pAttribute.indexOf('.') > 0) { + String name = pAttribute.substring(0, pAttribute.indexOf('.')); + String subName = pAttribute.substring(pAttribute.indexOf('.') + 1); + name = name.substring(0, 1).toUpperCase() + name.substring(1); + Method m = pObject.getClass().getMethod("get" + name, new Class[] {}); + return BeanManager.setBeanAttributeValue(m.invoke(pObject, new Object[] {}), subName, pValue); + } else { + Method m = BeanManager.getBeanSetterMethod(pObject, pAttribute, pValue); + return m.invoke(pObject, new Object[] { pValue }); + } + } + + @SuppressWarnings("unchecked") + public static T convertObject(Object pValue, Class pType) throws ParseException { + return BeanManager.convertObject(pValue, pType, false); + } + + @SuppressWarnings("unchecked") + public static T convertObject(Object pValue, Class pType, boolean pUpper) throws ParseException { + Object value = pValue; + if (pType.getName().compareTo("java.lang.String") == 0 && pUpper) { + if (value != null) { + value = value.toString().toUpperCase(); + } + } + try { + if (value == null || value.getClass().getName().compareTo(pType.getName()) == 0) { + return (T) value; + } + if (value != null) { + if (pType.getName().compareTo("java.lang.String") != 0 && pValue.toString().compareTo("") == 0) { + return null; + } + } + + return pType.cast(value); + } catch (ClassCastException e) { + ; + } + String sValue = value.toString(); + Class[] param = { String.class }; + try { + Constructor c = pType.getConstructor(param); + Object[] data = { sValue }; + return (T) c.newInstance(data); + } catch (Exception e) { + // No hacer nada + } + if (pType.getName().compareTo(Timestamp.class.getName()) == 0) { + String val = sValue; + if (sValue.indexOf(".") < 0) { + sValue += ".0"; + } + String d[] = sValue.split(" "); + if (d.length == 2) { + sValue = d[0] + " " + d[1].replaceAll("-", ":"); + } + try { + return (T) new Timestamp(BeanManager.getTransportTimestampFormat().parse(sValue).getTime()); + } catch (Exception e) { + return (T) new Timestamp(BeanManager.getTransportDateFormat().parse(val).getTime()); + } + } + if (pType.getName().compareTo(Date.class.getName()) == 0) { + String d[] = sValue.split(" "); + if (d.length == 2) { + sValue = d[0]; + } + return (T) new Date(BeanManager.getTransportDateFormat().parse(sValue).getTime()); + } + /* + * if(pType.getName().compareTo(Clob.class.getName()) == 0){ ClobImpl clob = new ClobImpl(sValue); return clob; + * } if(pType.getName().compareTo(Blob.class.getName()) == 0){ BlobImpl blob = new BlobImpl(sValue.getBytes()); + * return blob; } + */ + return (T) value; + } + + /** + * Entrega el valor de un atributo para que sea comparable. + * + * @param pObject Bean de referencia. + * @param pAttribute Atributo a obtener el valor. + * @return + * @throws SecurityException + * @throws IllegalArgumentException + * @throws NoSuchMethodException + * @throws IllegalAccessException + * @throws InvocationTargetException + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static Comparable getBeanAttributeComparable(Object pObject, String pAttribute) throws SecurityException, + IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, Exception { + return (Comparable) BeanManager.getBeanAttributeValue(pObject, pAttribute); + } + + /** + * Entrega el valor de un atributo perteneciente a un bean persistente. + * + * @param pObject Bean persistente. + * @param pName Nombre del atributo. + * @return + * @throws NoSuchMethodException + * @throws SecurityException + * @throws Exception + */ + public static Method getBeanGetterMethod(Object pObject, String pField) throws SecurityException, NoSuchMethodException, ClassNotFoundException, + IllegalAccessException, InstantiationException { + Method m = null; + if (pField.indexOf('.') > 0) { + m = BeanManager.getMethodpk(pObject, pField); + } else { + m = BeanManager.getMethodnormal(pObject, pField); + } + return m; + } + + private static Method getMethodnormal(Object pObject, String pField) throws SecurityException, NoSuchMethodException { + pField = pField.substring(0, 1).toUpperCase() + pField.substring(1); + Method m = null; + try { + m = BeanManager.getMethod(pObject, "get" + pField, null); + } catch (Exception e) { + m = BeanManager.getMethod(pObject, "is" + pField, null); + } + return m; + } + + private static Method getMethodpk(Object pObject, String pAttribute) throws SecurityException, NoSuchMethodException, ClassNotFoundException, + IllegalAccessException, InstantiationException { + Method m = null; + Object bean = null; + String classpk = ""; + if (pAttribute.indexOf('.') > 0) { + String subName = pAttribute.substring(pAttribute.indexOf('.') + 1); + subName = subName.substring(0, 1).toUpperCase() + subName.substring(1); + classpk = pObject.getClass().getName() + "Key"; + try { + bean = BeanManager.getBeanAttributeValue(pObject, "pk"); + } catch (Exception e) { + // No hacer nada + } + if (bean == null) { + bean = Class.forName(classpk).newInstance(); + } + try { + m = bean.getClass().getMethod("get" + subName, new Class[] {}); + } catch (Exception e) { + m = bean.getClass().getMethod("is" + subName, new Class[] {}); + } + } + return m; + } + + private static Method getMethod(Object pObject, String pMethod, Object pValue) throws NoSuchMethodException { + Method[] m = pObject.getClass().getMethods(); + Method method = null; + for (Method me : m) { + if (me.getName().compareTo(pMethod) == 0) { + method = me; + break; + } + } + if (method == null) { + method = pObject.getClass().getMethod(pMethod, pValue == null ? null : new Class[] { pValue.getClass() }); + } + return method; + } + + /** + * Entrega el nombre del metodo a invocar para fijar un valor en un Bean. + * + * @param pObject Bean de referencia. + * @param pAttribute Nombre del atributo a fijar el valor. + * @param pValue Valor a fijar en el atributo. + * @return + * @throws SecurityException + * @throws NoSuchMethodException + */ + public static Method getBeanSetterMethod(Object pObject, String pAttribute, Object pValue) throws SecurityException, NoSuchMethodException { + pAttribute = pAttribute.substring(0, 1).toUpperCase() + pAttribute.substring(1); + return BeanManager.getMethod(pObject, "set" + pAttribute, pValue); + } + + /** + * Compara dos Objetos, si los objetos son iguales retorna true. + * + * @param pObject Objeto uno. + * @param pOtherObject Objeto dos + * @return + * @throws SecurityException + * @throws IllegalArgumentException + * @throws NoSuchMethodException + * @throws IllegalAccessException + * @throws InvocationTargetException + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static boolean compareObject(Object pObject, Object pOtherObject) throws SecurityException, IllegalArgumentException, + NoSuchMethodException, IllegalAccessException, InvocationTargetException, Exception { + Field f[] = pObject.getClass().getDeclaredFields(); + boolean equal = true; + for (Field obj : f) { + if (obj.getName().compareTo("pk") == 0 || obj.getName().compareTo("hashValue") == 0 || obj.getName().compareTo("class") == 0 + || obj.getName().compareTo("serialVersionUID") == 0) { + continue; + } + Object value = null; + try { + value = BeanManager.getBeanAttributeValue(pObject, obj.getName()); + } catch (NoSuchMethodException e) { + continue; + } + Object value1 = null; + try { + value1 = BeanManager.getBeanAttributeValue(pOtherObject, obj.getName()); + } catch (Exception e) { + continue; + } + if (value == null && value1 == null) { + continue; + } + if (!(value != null && value instanceof Comparable)) { + continue; + } + if (!(value1 != null && value1 instanceof Comparable)) { + continue; + } + if (value == null && value1 != null) { + return false; + } + if (value1 == null && value != null) { + return false; + } + if (((Comparable) value).compareTo(value1) != 0) { + return false; + } + } + return equal; + } + + /** + * Metodo que se encarga de hacer un merge de dos objetos, si los datos de un campo del objeto origen son diferentes + * a los del destino remplazo los datos destino con los datos del origen. + * + * @param pSourceObject Datos del objeto orgigene a copiar al destino. + * @param pDestinyObject Datos del objeto destino. + * @throws SecurityException + * @throws IllegalArgumentException + * @throws NoSuchMethodException + * @throws IllegalAccessException + * @throws InvocationTargetException + * @throws Exception + */ + public static void mergeObject(Object pSourceObject, Object pDestinyObject) throws SecurityException, IllegalArgumentException, + NoSuchMethodException, IllegalAccessException, InvocationTargetException, Exception { + Field f[] = pSourceObject.getClass().getDeclaredFields(); + for (Field obj : f) { + if (obj.getName().compareTo("pk") == 0 || obj.getName().compareTo("hashValue") == 0 || obj.getName().compareTo("class") == 0 + || obj.getName().compareTo("serialVersionUID") == 0) { + continue; + } + Object value = BeanManager.getBeanAttributeValue(pSourceObject, obj.getName()); + Object value1 = BeanManager.getBeanAttributeValue(pDestinyObject, obj.getName()); + if (!BeanManager.isEqual(value, value1)) { + BeanManager.setBeanAttributeValue(pDestinyObject, obj.getName(), value); + } + } + } + + /** + * Metodo que compara el valor de dos objetos simples no compuestos, ejemplo BigDecimal, String, Integer etc. + * + * @param pValue valor a compar + * @param pValue1 valor con el que se compara el primer parametro. + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + private static boolean isEqual(Object pValue, Object pValue1) throws Exception { + if (pValue == null && pValue1 == null) { + return true; + } else if (pValue == null && pValue1 != null) { + return false; + } else if (pValue1 == null && pValue != null) { + return false; + } else if (!(pValue != null && pValue instanceof Comparable)) { + return true; + } else if (!(pValue1 != null && pValue1 instanceof Comparable)) { + return true; + } else if (((Comparable) pValue).compareTo(pValue1) != 0) { + return false; + } else { + return true; + } + } + + /** + * Metodo que compara dos string dado la una condicion. + * + * @param pValue Valor del primer string. + * @param pOtherValue Valor con el que se compara el primer string. + * @param pCondition Condicion con la que se evalua los dos strings. + * @return + */ + public static boolean compareString(String pValue, String pOtherValue, String pCondition) { + if (pCondition.compareTo("==") == 0 || pCondition.compareTo("=") == 0) { + if (pValue.compareTo(pOtherValue) == 0) { + return true; + } + } + if (pCondition.compareTo("!=") == 0) { + if (pValue.compareTo(pOtherValue) != 0) { + return true; + } + } + if (pCondition.compareTo(">") == 0) { + if (pValue.compareTo(pOtherValue) > 0) { + return true; + } + } + if (pCondition.compareTo(">=") == 0) { + if (pValue.compareTo(pOtherValue) >= 0) { + return true; + } + } + if (pCondition.compareTo("<") == 0) { + if (pValue.compareTo(pOtherValue) < 0) { + return true; + } + } + if (pCondition.compareTo("<=") == 0) { + if (pValue.compareTo(pOtherValue) <= 0) { + return true; + } + } + return false; + } + + /** + * Metodo que compara dos BigDecimal dado la una condicion. + * + * @param pValue Valor del primer BigDecimal. + * @param pOtherValue Valor con el que se compara el primer BigDecimal. + * @param pCondition Condicion con la que se evalua los dos BigDecimal. + * @return + */ + public static boolean compareBigDecimal(BigDecimal pValue, BigDecimal pOtherValue, String pCondition) { + if (pCondition.compareTo("==") == 0 || pCondition.compareTo("=") == 0) { + if (pValue.compareTo(pOtherValue) == 0) { + return true; + } + } + if (pCondition.compareTo("!=") == 0) { + if (pValue.compareTo(pOtherValue) != 0) { + return true; + } + } + if (pCondition.compareTo(">") == 0) { + if (pValue.compareTo(pOtherValue) > 0) { + return true; + } + } + if (pCondition.compareTo(">=") == 0) { + if (pValue.compareTo(pOtherValue) >= 0) { + return true; + } + } + if (pCondition.compareTo("<") == 0) { + if (pValue.compareTo(pOtherValue) < 0) { + return true; + } + } + if (pCondition.compareTo("<=") == 0) { + if (pValue.compareTo(pOtherValue) <= 0) { + return true; + } + } + return false; + } + + public static Integer getRecordversion(Object bean) throws Exception { + Object optlock; + try { + optlock = BeanManager.getBeanAttributeValue(bean, "recordversion"); + } catch (NoSuchMethodException e) { + return null; + } + if (optlock == null) { + return 0; + } + return Integer.valueOf(optlock.toString()); + } + + @SuppressWarnings("unchecked") + public static HashMap getModified(AbstractDataTransport beanoriginal, AbstractDataTransport beanmodificado) throws Exception { + + HashMap updated = new HashMap(); + Field f[] = beanoriginal.getClass().getDeclaredFields(); + boolean modificado = false; + Integer optlock = null; + + for (Field obj : f) { + modificado = false; + String ncampo = obj.getName(); + if (ncampo.compareTo("pk") == 0 || ncampo.compareTo("hashValue") == 0 || ncampo.compareTo("class") == 0 + || ncampo.compareTo("serialVersionUID") == 0) { + continue; + } + Object valori, valmod = null; + try { + valori = BeanManager.getBeanAttributeValue(beanoriginal, obj.getName()); + valmod = BeanManager.getBeanAttributeValue(beanmodificado, obj.getName()); + } catch (NoSuchMethodException e) { + continue; + } + if (valmod instanceof byte[]) { + updated.put(ncampo, valmod); + continue; + } + if (ncampo.equals("recordversion")) { + optlock = (Integer) valmod; + continue; + } + if (valori == null && valmod == null) { + continue; + } + if (valori == null && valmod != null) { + modificado = true; + } + if (valmod == null && valori != null) { + modificado = true; + } + if (valori != null && valmod != null && ((Comparable) valori).compareTo(valmod) != 0) { + modificado = true; + } + if (modificado) { + updated.put(ncampo, valmod); + } + } + if (!updated.isEmpty()) { + updated.put("pk", BeanManager.getBeanAttributeValue(beanmodificado, "pk")); + if (optlock != null) { + updated.put("recordversion", BeanManager.getBeanAttributeValue(beanmodificado, "recordversion")); + } + + // hay que crear el objeto para poder eliminar el bean original. + HashMap mdata = new HashMap(); + mdata = (HashMap) BeanManager.getBeanAttributeValue(beanmodificado, "modifiedData"); + // mdata.remove("ORIGINALBEAN"); + updated.put("modifiedData", mdata); + updated.put("rowkey", BeanManager.getBeanAttributeValue(beanmodificado, "rowkey")); + + } + return updated; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/.svn/entries b/base/dto/dto/src/main/java/com/fp/dto/.svn/entries new file mode 100644 index 0000000..5d621ee --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/.svn/entries @@ -0,0 +1,293 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/java/com/fp/dto +svn://172.17.26.185/COMACO + + + +2016-01-28T19:52:45.544614Z +4419 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +helper +dir + +batch +dir + +AbstractDataTransfer.java +file + + + + +2022-07-28T03:40:33.383763Z +fcd55c41de95a86296c5865edc88b178 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5201 + +quota +dir + +hb +dir + +AbstractDataTransport.java +file + + + + +2022-07-28T03:40:33.383763Z +5f1730bfffe59bbf6720e955766ac122 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2632 + +rules +dir + +save +dir + +AbstractDataBalanceTransport.java +file + + + + +2022-07-28T03:40:33.383763Z +83021349decbd8e7523e87358263b3e2 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +830 + +query +dir + +GeneralRequest.java +file + + + + +2022-07-28T03:40:33.384763Z +854766c8f6c0321082ec82fbb4b6d77f +2014-09-11T07:18:43.661713Z +674 +jvaca + + + + + + + + + + + + + + + + + + + + + +12577 + +Request.java +file + + + + +2022-07-28T03:40:33.384763Z +c2ceffa195b541e1ec28dec390271aeb +2016-01-28T19:52:45.544614Z +4419 +fpazmino + + + + + + + + + + + + + + + + + + + + + +24465 + +data +dir + +fin +dir + +AbstractData.java +file + + + + +2022-07-28T03:40:33.384763Z +6ab5cd1e41aedc77f8b5592b8c99d20c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5083 + +Response.java +file + + + + +2022-07-28T03:40:33.384763Z +664c73830ac71185744f5f260b8a4335 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6716 + diff --git a/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/AbstractData.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/AbstractData.java.svn-base new file mode 100644 index 0000000..fd208ca --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/AbstractData.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.dto; + +import java.beans.PropertyChangeEvent; +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.commons.beanutils.BeanMap; + +import com.fp.common.helper.BeanManager; +import com.fp.dto.hb.HibernateId; + +public abstract class AbstractData extends HashMap implements Serializable { + + /** Version de la clase. */ + private static final long serialVersionUID = 1L; + + // protected PropertyChangeSupport pcs = new PropertyChangeSupport(this); + private final Map modifiedData = new HashMap(); + + // private boolean modified = false; + + public Map modifiedData() { + return modifiedData; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + private void verifyField(String pField, Object pOld, Object pNew) { + if (pOld == pNew) { + return; + } + if (pOld == null && pNew != null) { + this.putFieldModified(pField, "null"); + return; + } + if (pOld != null && pNew == null) { + this.putFieldModified(pField, pOld); + return; + } + if (pOld.getClass().getName().compareTo(pNew.getClass().getName()) != 0) { + this.putFieldModified(pField, pOld); + return; + } + if (pOld instanceof Comparable) { + if (((Comparable) pOld).compareTo(pNew) != 0) { + this.putFieldModified(pField, pOld); + return; + } + } + this.putFieldModified(pField, pOld); + } + + private void putFieldModified(String pField, Object pData) { + if (!this.modifiedData.containsKey(pField)) { + // modified = true; + modifiedData.put(pField, pData); + } + } + + + /** + * Entrega el valor de: modifiedData + * @return Map + */ + public Map getModifiedData() { + return modifiedData; + } + + public void propertyChange(PropertyChangeEvent evt) { + this.verifyField(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue()); + } + + /* + * public PropertyChangeSupport getPcs() { return pcs; } + */ + public void clean() { + // this.modified=false; + this.modifiedData.clear(); + } + + public String getTransportBeanClass() { + return this.getClass().getCanonicalName(); + } + + public void addAddtionalInfo(String pName, Object pValue) { + super.put(pName, pValue); + } + + /* + * (non-Javadoc) + * + * @see java.util.HashMap#entrySet() + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public Set> entrySet() { + Field[] fs1 = this.getClass().getDeclaredFields(); + List fs = new ArrayList(); + for (Field f : fs1) { + fs.add(f); + } + try { + Class csuper = this.getClass().getSuperclass(); + do { + if (csuper != null) { + Field[] fs2 = csuper.getDeclaredFields(); + for (Field f : fs2) { + fs.add(f); + } + } + csuper = csuper.getSuperclass(); + } while (csuper != null); + } catch (Exception e) { + } + for (Field field : fs) { + try { + String name = field.getName(); + if (name.compareTo("serialVersionUID") == 0) { + continue; + } + Object val = null; + try { + val = BeanManager.getBeanAttributeValue(this, name); + } catch (Exception e1) { + continue; + } + if (val instanceof HibernateId) { + BeanMap bm = new BeanMap(val); + Set> ent = bm.entrySet(); + for (java.util.Map.Entry e : ent) { + String key = e.getKey(); + if (key.compareTo("class") == 0 || key.compareTo("transportBeanClass") == 0 || key.compareTo("empty") == 0) { + // key = "transportBeanClass"; para que no envie el transportbeanclass + continue; + } + super.put(name + "_" + key, e.getValue()); + } + continue; + } + super.put(name, val); + } catch (Exception e) { + continue; + } + } + // super.put("transportBeanClass", this.getTransportBeanClass()); + return super.entrySet(); + } + + public Set> entrySetDefault() { + return super.entrySet(); + } +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/AbstractDataBalanceTransport.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/AbstractDataBalanceTransport.java.svn-base new file mode 100644 index 0000000..84c7be5 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/AbstractDataBalanceTransport.java.svn-base @@ -0,0 +1,37 @@ +package com.fp.dto; + +import com.fp.dto.fin.FinancialExchange; + +/** + * Clase a extender en las clase que manejan saldos de cuentas. + * @author Jorge Vaca + * @version 2.1 + */ +public class AbstractDataBalanceTransport extends AbstractDataTransport{ + + private static final long serialVersionUID = 1L; + /**Indica si el registro de la tabla es modificado.*/ + private boolean modified = false; + + /** + * Entrega el valor de: modified + * @return boolean + */ + public boolean isModified() { + return modified; + } + + /** + * Fija el valor de: modified + * @param modified + */ + public void setModified(boolean modified) { + this.modified = modified; + } + + @Override + public Object cloneMe() throws CloneNotSupportedException { + AbstractDataBalanceTransport p = (AbstractDataBalanceTransport) this.clone(); + return p; + } +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/AbstractDataTransfer.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/AbstractDataTransfer.java.svn-base new file mode 100644 index 0000000..ead471a --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/AbstractDataTransfer.java.svn-base @@ -0,0 +1,222 @@ +package com.fp.dto; + +import java.io.Serializable; +import java.util.HashMap; + +public abstract class AbstractDataTransfer extends HashMap implements Serializable,Cloneable{ + /** + * Codigo de version de la clase. + */ + private static final long serialVersionUID = 1L; + /** Codigo de usuario que ejecuta una transaccion. */ + private String user; + /** Codigo interno de usuario que ejecuta una transaccion. */ + private Integer internalUserCode; + /** Idioma preferido del usuario. */ + protected String language; + /** Perfil del Usuario. */ + protected Integer profile; + /** Codigo del modulo al que pertenece la transaccion. */ + private String transactionModule; + /** Codigo de transaccion a ejecutar. */ + private Integer transactionCode; + /** Version de la transaccion a ejecutar. */ + private Integer transactionVersion; + /** Codigo de terminal asociado al ip de la maquina desde la cual se ejecuta una transaccion. */ + private String terminalCode; + /** Identificador de la transaccion. */ + private String journalId; + /** Codigo de canal desde el cual se ejecuta una transaccion. */ + private String channelCode; + /** Codigo de sucursal origen de la transaccion. */ + private Integer branchCode; + /** Codigo de oficina origen de la transaccion. */ + private Integer officeCode; + /** Codigo de usuario que ejecuta una transaccion. */ + private String authorizedUser; + /** + * Entrega el valor de: user + * @return String + */ + public String getUser() { + return user; + } + /** + * Fija el valor de: user + * @param user + */ + public void setUser(String user) { + this.user = user; + } + + /** + * Entrega el valor de: internalUserCode + * @return Integer + */ + public Integer getInternalUserCode() { + return internalUserCode; + } + /** + * Fija el valor de internalUserCode + * @param internalUserCode value to set + */ + public void setInternalUserCode(Integer internalUserCode) { + this.internalUserCode = internalUserCode; + } + /** + * Entrega el valor de: language + * @return String + */ + public String getLanguage() { + return language; + } + /** + * Fija el valor de: language + * @param language + */ + public void setLanguage(String language) { + this.language = language; + } + /** + * Entrega el valor de: profile + * @return Integer + */ + public Integer getProfile() { + return profile; + } + /** + * Fija el valor de: profile + * @param profile + */ + public void setProfile(Integer profile) { + this.profile = profile; + } + /** + * Entrega el valor de: transactionModule + * @return String + */ + public String getTransactionModule() { + return transactionModule; + } + /** + * Fija el valor de: transactionModule + * @param transactionModule + */ + public void setTransactionModule(String transactionModule) { + this.transactionModule = transactionModule; + } + /** + * Entrega el valor de: transactionCode + * @return Integer + */ + public Integer getTransactionCode() { + return transactionCode; + } + /** + * Fija el valor de: transactionCode + * @param transactionCode + */ + public void setTransactionCode(Integer transactionCode) { + this.transactionCode = transactionCode; + } + /** + * Entrega el valor de: transactionVersion + * @return Integer + */ + public Integer getTransactionVersion() { + return transactionVersion; + } + /** + * Fija el valor de: transactionVersion + * @param transactionVersion + */ + public void setTransactionVersion(Integer transactionVersion) { + this.transactionVersion = transactionVersion; + } + /** + * Entrega el valor de: terminalCode + * @return String + */ + public String getTerminalCode() { + return terminalCode; + } + /** + * Fija el valor de: terminalCode + * @param terminalCode + */ + public void setTerminalCode(String terminalCode) { + this.terminalCode = terminalCode; + } + /** + * Entrega el valor de: journalId + * @return String + */ + public String getJournalId() { + return journalId; + } + /** + * Fija el valor de: journalId + * @param journalId + */ + public void setJournalId(String journalId) { + this.journalId = journalId; + } + /** + * Entrega el valor de: channelCode + * @return String + */ + public String getChannelCode() { + return channelCode; + } + /** + * Fija el valor de: channelCode + * @param channelCode + */ + public void setChannelCode(String channelCode) { + this.channelCode = channelCode; + } + /** + * Entrega el valor de: branchCode + * @return Integer + */ + public Integer getBranchCode() { + return branchCode; + } + /** + * Fija el valor de: branchCode + * @param branchCode + */ + public void setBranchCode(Integer branchCode) { + this.branchCode = branchCode; + } + /** + * Entrega el valor de: officeCode + * @return Integer + */ + public Integer getOfficeCode() { + return officeCode; + } + /** + * Fija el valor de: officeCode + * @param officeCode + */ + public void setOfficeCode(Integer officeCode) { + this.officeCode = officeCode; + } + /** + * Entrega el valor de: authorizedUser + * @return String + */ + public String getAuthorizedUser() { + return authorizedUser; + } + /** + * Fija el valor de: authorizedUser + * @param authorizedUser + */ + public void setAuthorizedUser(String authorizedUser) { + this.authorizedUser = authorizedUser; + } + + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/AbstractDataTransport.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/AbstractDataTransport.java.svn-base new file mode 100644 index 0000000..8770c7e --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/AbstractDataTransport.java.svn-base @@ -0,0 +1,113 @@ +package com.fp.dto; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +/** + * Clase a extender en los entity beans, que manejan el mapeo de objetos con la base de datos relacional. + * + * @author Jorge Vaca . + * @version 2.1 + */ +public abstract class AbstractDataTransport implements Serializable, Cloneable { + + /** Version de la clase. */ + private static final long serialVersionUID = 1L; + + /** + * HashCode asociado con la Instancia. + */ + private int rowkey = 0; + + public HashMap modifiedData = new HashMap(); + + /** + * Indica que el registro es nuevo. + */ + public boolean isnew = false; + + /** Indica que el registro se actualiza en la base de datos en save generico. */ + public boolean isupdated = false; + + public abstract Object cloneMe() throws CloneNotSupportedException; + + /** + * Implementacion del metodo rowkey del registro. + * + * @return el hashCode la instancia + */ + public final int rowkey() { + if (rowkey == 0) { + rowkey = (int) (Math.random() * 10000000); + } + return rowkey; + } + + // private boolean modified = false; + + public Map modifiedData() { + return modifiedData; + } + + public Object get(String key) { + return modifiedData.get(key); + } + + public void put(String pField, Object pData) { + modifiedData.put(pField, pData); + } + + public void addAddtionalInfo(String pName, Object pValue) { + modifiedData.put(pName, pValue); + } + + public HashMap getModifiedData() { + return modifiedData; + } + + public void setModifiedData(HashMap modifiedData) { + this.modifiedData = modifiedData; + } + + public String getTransportBeanClass() { + return this.getClass().getCanonicalName(); + } + + /** + * Entrega el valor de: rowkey + * + * @return int + */ + public int getRowkey() { + return rowkey; + } + + /** + * Fija el valor de: rowkey + * + * @param Valor a fijar en el atributo. + */ + public void setRowkey(int rowkey) { + this.rowkey = rowkey; + } + + /** + * Entrega el valor de: isnew + * + * @return boolean + */ + public boolean isIsnew() { + return isnew; + } + + /** + * Fija el valor de: isnew + * + * @param Valor a fijar en el atributo + */ + public void setIsnew(boolean isnew) { + this.isnew = isnew; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/GeneralRequest.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/GeneralRequest.java.svn-base new file mode 100644 index 0000000..4744d99 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/GeneralRequest.java.svn-base @@ -0,0 +1,524 @@ +package com.fp.dto; + +import java.io.Serializable; + +public class GeneralRequest extends AbstractDataTransport implements Serializable { + + private static final long serialVersionUID = 1L; + + /** Objeto que almacena la respuesta de una consulta. */ + private Response response; + + /** Codigo de usuario que ejecuta una transaccion. */ + protected String user; + + /** Idioma preferido del usuario. */ + /** Codigo interno de usuario que ejecuta una transaccion. */ + protected Integer internalUserCode; + + /** + * language + */ + protected String language; + + /** Perfil del Usuario. */ + protected String profile; + + /** Codigo del modulo al que pertenece la transaccion. */ + protected String transactionModule; + + /** Codigo de transaccion a ejecutar. */ + protected Integer transactionCode; + + /** Version de la transaccion a ejecutar. */ + protected Integer transactionVersion; + + /** Codigo de terminal asociado al ip de la maquina desde la cual se ejecuta una transaccion. */ + protected String terminalCode; + + /** Identificador de la transaccion. */ + protected String journalId; + + /** Codigo de canal desde el cual se ejecuta una transaccion. */ + protected String channelCode; + + /** Codigo de compania. */ + protected Integer company; + + /** Codigo de sucursal origen de la transaccion. */ + protected Integer branchCode; + + /** Codigo de oficina origen de la transaccion. */ + protected Integer officeCode; + + /** Codigo de usuario que ejecuta una transaccion. */ + protected String authorizedUser; + + /** Numero de cuenta a enviar al log de transacion. */ + protected String logaccount; + + /** Numero de solicitud a enviar al log de transacion. */ + protected String logsolicitude; + + /** Codigo de persona a enviar al log de transacion. */ + protected Integer logperson; + + /** + * Subject a presentar en la agenda del usuario. + */ + protected String subject; + + /** Codigo del modulo original al que pertenece la transaccion. */ + private String originalTransactionModule; + + /** Codigo de transaccion original a ejecutar. */ + private Integer originalTransactionCode; + + /** Version de la transaccion original a ejecutar. */ + private Integer originalTransactionVersion; + + /** Secuencia interna de la transaccion por numero de mensaje. */ + private Integer jounalSequence; + + /** Indica que la transaccion que se esta ejecutando es el linea. */ + private boolean onLine = true; + + /** + * Entrega el valor de: response + * + * @return Response + */ + public Response getResponse() { + return response; + } + + /** + * Fija el valor de: response + * + * @param response Valor a fijar en el atributo. + */ + public void setResponse(Response response) { + this.response = response; + } + + /** + * Entrega el valor de: user + * + * @return String + */ + public String getUser() { + return user; + } + + /** + * Fija el valor de: user + * + * @param user Valor a fijar en el atributo. + */ + public void setUser(String user) { + this.user = user; + } + + /** + * Entrega el valor de: internalUserCode + * + * @return Integer + */ + public Integer getInternalUserCode() { + return internalUserCode; + } + + /** + * Fija el valor de: internalUserCode + * + * @param internalUserCode Valor a fijar en el atributo. + */ + public void setInternalUserCode(Integer internalUserCode) { + this.internalUserCode = internalUserCode; + } + + /** + * Entrega el valor de: language + * + * @return String + */ + public String getLanguage() { + return language; + } + + /** + * Fija el valor de: language + * + * @param language Valor a fijar en el atributo. + */ + public void setLanguage(String language) { + this.language = language; + } + + /** + * Entrega el valor de: profile + * + * @return String + */ + public String getProfile() { + return profile; + } + + /** + * Fija el valor de: profile + * + * @param profile Valor a fijar en el atributo. + */ + public void setProfile(String profile) { + this.profile = profile; + } + + /** + * Entrega el valor de: transactionModule + * + * @return String + */ + public String getTransactionModule() { + return transactionModule; + } + + /** + * Fija el valor de: transactionModule + * + * @param transactionModule Valor a fijar en el atributo. + */ + public void setTransactionModule(String transactionModule) { + this.transactionModule = transactionModule; + } + + /** + * Entrega el valor de: transactionCode + * + * @return Integer + */ + public Integer getTransactionCode() { + return transactionCode; + } + + /** + * Fija el valor de: transactionCode + * + * @param transactionCode Valor a fijar en el atributo. + */ + public void setTransactionCode(Integer transactionCode) { + this.transactionCode = transactionCode; + } + + /** + * Entrega el valor de: transactionVersion + * + * @return Integer + */ + public Integer getTransactionVersion() { + return transactionVersion; + } + + /** + * Fija el valor de: transactionVersion + * + * @param transactionVersion Valor a fijar en el atributo. + */ + public void setTransactionVersion(Integer transactionVersion) { + this.transactionVersion = transactionVersion; + } + + /** + * Entrega el valor de: terminalCode + * + * @return String + */ + public String getTerminalCode() { + return terminalCode; + } + + /** + * Fija el valor de: terminalCode + * + * @param terminalCode Valor a fijar en el atributo. + */ + public void setTerminalCode(String terminalCode) { + this.terminalCode = terminalCode; + } + + /** + * Entrega el valor de: journalId + * + * @return String + */ + public String getJournalId() { + return journalId; + } + + /** + * Fija el valor de: journalId + * + * @param journalId Valor a fijar en el atributo. + */ + public void setJournalId(String journalId) { + this.journalId = journalId; + } + + /** + * Entrega el valor de: channelCode + * + * @return String + */ + public String getChannelCode() { + return channelCode; + } + + /** + * Fija el valor de: channelCode + * + * @param channelCode Valor a fijar en el atributo. + */ + public void setChannelCode(String channelCode) { + this.channelCode = channelCode; + } + + /** + * Entrega el valor de: company + * + * @return Integer + */ + public Integer getCompany() { + return company; + } + + /** + * Fija el valor de: company + * + * @param company Valor a fijar en el atributo. + */ + public void setCompany(Integer company) { + this.company = company; + } + + /** + * Entrega el valor de: branchCode + * + * @return Integer + */ + public Integer getBranchCode() { + return branchCode; + } + + /** + * Fija el valor de: branchCode + * + * @param branchCode Valor a fijar en el atributo. + */ + public void setBranchCode(Integer branchCode) { + this.branchCode = branchCode; + } + + /** + * Entrega el valor de: officeCode + * + * @return Integer + */ + public Integer getOfficeCode() { + return officeCode; + } + + /** + * Fija el valor de: officeCode + * + * @param officeCode Valor a fijar en el atributo. + */ + public void setOfficeCode(Integer officeCode) { + this.officeCode = officeCode; + } + + /** + * Entrega el valor de: authorizedUser + * + * @return String + */ + public String getAuthorizedUser() { + return authorizedUser; + } + + /** + * Fija el valor de: authorizedUser + * + * @param authorizedUser Valor a fijar en el atributo. + */ + public void setAuthorizedUser(String authorizedUser) { + this.authorizedUser = authorizedUser; + } + + /** + * Entrega el valor de: logaccount + * + * @return String + */ + public String getLogaccount() { + return logaccount; + } + + /** + * Fija el valor de: logaccount + * + * @param logaccount Valor a fijar en el atributo. + */ + public void setLogaccount(String logaccount) { + this.logaccount = logaccount; + } + + /** + * Entrega el valor de: logsolicitude + * + * @return String + */ + public String getLogsolicitude() { + return logsolicitude; + } + + /** + * Fija el valor de: logsolicitude + * + * @param logsolicitude Valor a fijar en el atributo. + */ + public void setLogsolicitude(String logsolicitude) { + this.logsolicitude = logsolicitude; + } + + /** + * Entrega el valor de: logperson + * + * @return Integer + */ + public Integer getLogperson() { + return logperson; + } + + /** + * Fija el valor de: logperson + * + * @param logperson Valor a fijar en el atributo. + */ + public void setLogperson(Integer logperson) { + this.logperson = logperson; + } + + /** + * Entrega el valor de: subject + * + * @return String + */ + public String getSubject() { + return subject; + } + + /** + * Fija el valor de: subject + * + * @param subject Valor a fijar en el atributo. + */ + public void setSubject(String subject) { + this.subject = subject; + } + + /** + * Entrega el valor de: originalTransactionModule + * + * @return String + */ + public String getOriginalTransactionModule() { + return originalTransactionModule; + } + + /** + * Fija el valor de: originalTransactionModule + * + * @param originalTransactionModule Valor a fijar en el atributo. + */ + public void setOriginalTransactionModule(String originalTransactionModule) { + this.originalTransactionModule = originalTransactionModule; + } + + /** + * Entrega el valor de: originalTransactionCode + * + * @return Integer + */ + public Integer getOriginalTransactionCode() { + return originalTransactionCode; + } + + /** + * Fija el valor de: originalTransactionCode + * + * @param originalTransactionCode Valor a fijar en el atributo. + */ + public void setOriginalTransactionCode(Integer originalTransactionCode) { + this.originalTransactionCode = originalTransactionCode; + } + + /** + * Entrega el valor de: originalTransactionVersion + * + * @return Integer + */ + public Integer getOriginalTransactionVersion() { + return originalTransactionVersion; + } + + /** + * Fija el valor de: originalTransactionVersion + * + * @param originalTransactionVersion Valor a fijar en el atributo. + */ + public void setOriginalTransactionVersion(Integer originalTransactionVersion) { + this.originalTransactionVersion = originalTransactionVersion; + } + + /** + * Entrega el valor de: jounalSequence + * + * @return Integer + */ + public Integer getJounalSequence() { + return jounalSequence; + } + + /** + * Fija el valor de: jounalSequence + * + * @param jounalSequence Valor a fijar en el atributo. + */ + public void setJounalSequence(Integer jounalSequence) { + this.jounalSequence = jounalSequence; + } + + /** + * Entrega el valor de: onLine + * + * @return boolean + */ + public boolean isOnLine() { + return onLine; + } + + /** + * Fija el valor de: onLine + * + * @param onLine Valor a fijar en el atributo. + */ + public void setOnLine(boolean onLine) { + this.onLine = onLine; + } + + @Override + public Object cloneMe() throws CloneNotSupportedException { + // No hacer un clone esta definido por la herencia de AbstractDataTransport + return null; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/Request.java.netbeans-base b/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/Request.java.netbeans-base new file mode 100644 index 0000000..8a1bd40 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/Request.java.netbeans-base @@ -0,0 +1,958 @@ +package com.fp.dto; + +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import com.fp.common.helper.BeanManager; +import com.fp.dto.fin.FinancialRequest; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.dto.save.SaveBean; + +/** + * Requet general utilizado en el procesamiento de transacciones, ejemplo consultas, mantenimiento, reportes financiero. + * + * @author Jorge Vaca . + * @version 2.1 + */ +public class Request extends AbstractData { + + private static final long serialVersionUID = 1L; + + /** Objeto que almacena la respuesta de una consulta. */ + private Response response; + + /** Codigo de usuario que ejecuta una transaccion. */ + protected String user; + + /** Idioma preferido del usuario. */ + /** Codigo interno de usuario que ejecuta una transaccion. */ + protected Integer internalUserCode; + + /** + * language + */ + protected String language; + + /** Perfil del Usuario. */ + protected String profile; + + /** Codigo del modulo al que pertenece la transaccion. */ + protected String transactionModule; + + /** Codigo de transaccion a ejecutar. */ + protected Integer transactionCode; + + /** Version de la transaccion a ejecutar. */ + protected Integer transactionVersion; + + /** Codigo de terminal asociado al ip de la maquina desde la cual se ejecuta una transaccion. */ + protected String terminalCode; + + /** Nombre de la transaccion*/ + protected String tname; + + /** Identificador de la transaccion. */ + protected String journalId; + + /** Codigo de canal desde el cual se ejecuta una transaccion. */ + protected String channelCode; + + /** Codigo de compania. */ + protected Integer company; + + /** Codigo de sucursal origen de la transaccion. */ + protected Integer branchCode; + + /** Codigo de oficina origen de la transaccion. */ + protected Integer officeCode; + + /** Codigo de area origen de la transaccion. */ + protected Integer areaCode; + + /** Codigo de usuario que ejecuta una transaccion. */ + protected String authorizedUser; + + /** Numero de cuenta a enviar al log de transacion. */ + protected String logaccount; + + /** Numero de solicitud a enviar al log de transacion. */ + protected String logsolicitude; + + /** Codigo de persona a enviar al log de transacion. */ + protected Integer logperson; + + /** Centro de control donde pertenece la persona para enviar al log de transacion. */ + protected String centrocontrol; + + /** Unidad de control donde pertenece la persona para enviar al log de transacion. */ + protected String unidad; + + /** + * Subject a presentar en la agenda del usuario. + */ + protected String subject; + + /** Codigo del modulo original al que pertenece la transaccion. */ + private String originalTransactionModule; + + /** Codigo de transaccion original a ejecutar. */ + private Integer originalTransactionCode; + + /** Version de la transaccion original a ejecutar. */ + private Integer originalTransactionVersion; + + /** Secuencia interna de la transaccion por numero de mensaje. */ + private Integer jounalSequence; + + /** Indica que la transaccion que se esta ejecutando es el linea. */ + private boolean onLine = true; + + /** Navegador utilizado **/ + private String browser; + + /** Sitema operativo utilizado **/ + private String operativesystem; + + /** Cabecera de la transaccion que se esta ejecutando. */ + public Map mbeans = new HashMap(); + + /** + * Entrega el valor de subject + * + * @return Valor de subject + */ + public String getSubject() { + return this.subject; + } + + /** + * Fija un nuevo valor en subject + * + * @param subject nuevo valor para subject + */ + public void setSubject(String subject) { + this.subject = subject; + } + + /** + * Metodo que copia los valoes del requestq que llega como parametro. + * + * @param pRequest Datos del request a copiar. + * @throws Exception + */ + public void copy(Request pRequest) throws Exception { + this.copyFields(Request.class.getDeclaredFields(), pRequest); + } + + /** + * Metodo que copia los valoes del requestq que llega como parametro. + * + * @param pRequest Datos del request a copiar. + * @throws Exception + */ + public void copy(GeneralRequest pGeneralRequest) throws Exception { + this.copyFields(Request.class.getDeclaredFields(), pGeneralRequest); + // copia los datos del request del que estan el map al request general utilizado en el financiero. + Set s = super.keySet(); + for (String key : s) { + pGeneralRequest.put(key, super.get(key)); + } + } + + /** + * Metodo que fina el valor en request actual los datos del request que llegan como parametro. + * + * @param pFields Arreglo de campos que formn parte del request. + * @param pRequest Datos del request original a copiar. + * @throws Exception + */ + private void copyFields(Field[] pFields, GeneralRequest pGeneralRequest) throws Exception { + for (Field f : pFields) { + try { + Object value = f.get(this); + BeanManager.setBeanAttributeValue(pGeneralRequest, f.getName(), value); + } catch (Exception e) { + continue; + } + } + } + + /** + * Metodo que fina el valor en request actual los datos del request que llegan como parametro. + * + * @param pFields Arreglo de campos que formn parte del request. + * @param pRequest Datos del request original a copiar. + * @throws Exception + */ + private void copyFields(Field[] pFields, Request pRequest) throws Exception { + for (Field f : pFields) { + try { + f.set(pRequest, f.get(this)); + } catch (Exception e) { + continue; + } + } + } + + /** + * Metodo que copia los valoes del requestq que llega como parametro. + * + * @param pRequest Datos del request a copiar. + * @throws Exception + */ + public void copyMapValues(Request pRequest) throws Exception { + Set s = this.keySet(); + for (String key : s) { + pRequest.put(key, this.get(key)); + } + } + + /** + * Metodo que copia los valoes del requestq que llega como parametro. + * + * @param pRequest Datos del request a copiar. + * @throws Exception + */ + public void copyMapValuesWithOutSaveBean(Request pRequest) throws Exception { + Set s = this.keySet(); + for (String key : s) { + if(this.get(key) == null || this.get(key) instanceof SaveBean){ + continue; + } + pRequest.put(key, this.get(key)); + } + } + + /** + * Metodo que completa datos del Request en un financial request. + * + * @param pFinancialRequest Objeto a ser completado con los datos del Request. + * @throws Exception + */ + protected void completeFinancialRequest(FinancialRequest pFinancialRequest) throws Exception { + this.copy(pFinancialRequest); + } + + /** + * Metodo que crea y entraga un FinancialRequest dado un SaveRequest. + * + * @return FinancialRequest + * @throws Exception + */ + public FinancialRequest toFinancialRequest() throws Exception { + FinancialRequest financialRequest = new FinancialRequest(); + this.copy(financialRequest); + return financialRequest; + } + + /** + * Entrega el valor de: user + * + * @return String + */ + public String getUser() { + return this.user; + } + + /** + * Fija el valor de: user + * + * @param user + */ + public void setUser(String user) { + this.user = user; + } + + /** + * Entrega el valor de: internalUserCode + * + * @return Integer + */ + public Integer getInternalUserCode() { + return this.internalUserCode; + } + + /** + * Fija el valor de internalUserCode + * + * @param internalUserCode value to set + */ + public void setInternalUserCode(Integer internalUserCode) { + this.internalUserCode = internalUserCode; + } + + /** + * Entrega el valor de: language + * + * @return String + */ + public String getLanguage() { + return this.language; + } + + /** + * Fija el valor de: language + * + * @param language + */ + public void setLanguage(String language) { + this.language = language; + } + + /** + * Entrega el valor de: profile + * + * @return String + */ + public String getProfile() { + return this.profile; + } + + /** + * Fija el valor de: profile + * + * @param profile + */ + public void setProfile(String profile) { + this.profile = profile; + } + + /** + * Entrega el valor de: transactionModule + * + * @return String + */ + public String getTransactionModule() { + return this.transactionModule; + } + + /** + * Fija el valor de: transactionModule + * + * @param transactionModule + */ + public void setTransactionModule(String transactionModule) { + this.transactionModule = transactionModule; + } + + /** + * Entrega el valor de: transactionCode + * + * @return Integer + */ + public Integer getTransactionCode() { + return this.transactionCode; + } + + /** + * Fija el valor de: transactionCode + * + * @param transactionCode + */ + public void setTransactionCode(Integer transactionCode) { + this.transactionCode = transactionCode; + } + + /** + * Entrega el valor de: transactionVersion + * + * @return Integer + */ + public Integer getTransactionVersion() { + return this.transactionVersion; + } + + /** + * Fija el valor de: transactionVersion + * + * @param transactionVersion + */ + public void setTransactionVersion(Integer transactionVersion) { + this.transactionVersion = transactionVersion; + } + + /** + * Entrega el valor de: terminalCode + * + * @return String + */ + public String getTerminalCode() { + return this.terminalCode; + } + + /** + * Fija el valor de: terminalCode + * + * @param terminalCode + */ + public void setTerminalCode(String terminalCode) { + this.terminalCode = terminalCode; + } + + /** + * Entrega el valor de: journalId + * + * @return String + */ + public String getJournalId() { + return this.journalId; + } + + /** + * Fija el valor de: journalId + * + * @param journalId + */ + public void setJournalId(String journalId) { + this.journalId = journalId; + } + + /** + * Entrega el valor de: channelCode + * + * @return String + */ + public String getChannelCode() { + return this.channelCode; + } + + /** + * Fija el valor de: channelCode + * + * @param channelCode + */ + public void setChannelCode(String channelCode) { + this.channelCode = channelCode; + } + + /** + * Entrega el valor de: company + * + * @return Integer + */ + public Integer getCompany() { + return this.company; + } + + /** + * Fija el valor de company + * + * @param company value to set + */ + public void setCompany(Integer company) { + this.company = company; + } + + /** + * Entrega el valor de: branchCode + * + * @return Integer + */ + public Integer getBranchCode() { + return this.branchCode; + } + + /** + * Fija el valor de: branchCode + * + * @param branchCode + */ + public void setBranchCode(Integer branchCode) { + this.branchCode = branchCode; + } + + /** + * Entrega el valor de: officeCode + * + * @return Integer + */ + public Integer getOfficeCode() { + return this.officeCode; + } + + /** + * Fija el valor de: officeCode + * + * @param officeCode + */ + public void setOfficeCode(Integer officeCode) { + this.officeCode = officeCode; + } + + /** + * Entrega el valor de: areaCode + * + * @return Integer + */ + public Integer getAreaCode() { + return this.areaCode; + } + + /** + * Fija el valor de: areaCode + * + * @param areaCode + */ + public void setAreaCode(Integer areaCode) { + this.areaCode = areaCode; + } + + /** + * Entrega el valor de: authorizedUser + * + * @return String + */ + public String getAuthorizedUser() { + return this.authorizedUser; + } + + /** + * Fija el valor de: authorizedUser + * + * @param authorizedUser + */ + public void setAuthorizedUser(String authorizedUser) { + this.authorizedUser = authorizedUser; + } + + /** + * Entrega el valor convertido a Bigdecimal de un objeto del map. + * + * @param key Key de la entrada del map. + * @return BigDecimal + */ + public BigDecimal getBigDecimal(Object key) { + if (this.get(key) instanceof Integer) { + return new BigDecimal((Integer) this.get(key)); + } + if (this.get(key) instanceof Long) { + return new BigDecimal((Long) this.get(key)); + } + if (this.get(key) == null) { + return BigDecimal.ZERO; + } + return (BigDecimal) this.get(key); + } + + /** + * Entrega el valor convertido a Bigdecimal de un objeto del map. + * + * @param key Key de la entrada del map. + * @return BigDecimal + */ + public Date getDate(Object key) throws ParseException { + String value = this.getString(key); + SimpleDateFormat formatt = new SimpleDateFormat("yyyy-MM-dd"); + return new Date(formatt.parse(value).getTime()); + } + + /** + * Entrega el valor convertido a String de un objeto del map. + * + * @param key Key de la entrada del map. + * @return String + */ + public String getString(Object key) { + Object val = this.get(key); + if (val == null) { + throw new RuntimeException("NO SE PUDO DETERMINAR EL VALOR DE " + key); + } + return "" + val; + } + + /** + * Entrega el valor convertido a String de un objeto del map. + * + * @param key Key de la entrada del map. + * @return String + */ + public String findString(Object key) { + Object val = this.find(key); + if (val == null) { + throw new RuntimeException("NO SE PUDO DETERMINAR EL VALOR DE " + key); + } + return "" + val; + } + + /** + * Entrega el valor de un objeto, busca en el request si no lo encuentra busca en el response. + * + * @param key Key de la entrada del map. + * @return String + */ + public Object find(Object key) { + Object val = this.get(key); + if ((val == null) && (this.response != null)) { + val = this.response.get(key); + } + return val; + } + + /** + * Entrega el valor convertido a long de un objeto del map. + * + * @param key Key de la entrada del map. + * @return Long + */ + public Long getLong(Object key) { + return Long.valueOf(this.getString(key)); + } + + /** + * Entrega el valor convertido a integer de un objeto del map. + * + * @param key Key de la entrada del map. + * @return Integer + */ + public Integer getInteger(Object key) { + return Integer.valueOf(this.getString(key)); + } + + /** + * Entrega el valor de: logaccount. + * + * @return String + */ + public String getLogaccount() { + return this.logaccount; + } + + /** + * Fija el valor de: logaccount. + * + * @param logaccount + */ + public void setLogaccount(String logaccount) { + this.logaccount = logaccount; + } + + /** + * Entrega el valor de: logsolicitude. + * + * @return String + */ + public String getLogsolicitude() { + return this.logsolicitude; + } + + /** + * Fija el valor de: logsolicitude. + * + * @param logsolicitude + */ + public void setLogsolicitude(String logsolicitude) { + this.logsolicitude = logsolicitude; + } + + /** + * Entrega el valor de: logpPerson. + * + * @return Integer + */ + public Integer getLogperson() { + return this.logperson; + } + + /** + * Fija el valor de: logsolicitude. + * + * @param logsolicitude + */ + public void setLogperson(Integer logperson) { + this.logperson = logperson; + } + + /** + * Entrega el valor de: centrocontrol. + * + * @return String + */ + public String getCentrocontrol() { + return centrocontrol; + } + + /** + * Fija el valor de: centrocontrol. + * + * @param centrocontrol + */ + public void setCentrocontrol(String centrocontrol) { + this.centrocontrol = centrocontrol; + } + + /** + * Entrega el valor de: unidad. + * + * @return String + */ + public String getUnidad() { + return unidad; + } + + /** + * Fija el valor de: unidad. + * + * @param unidad + */ + public void setUnidad(String unidad) { + this.unidad = unidad; + } + + protected Map ruleParameters = new HashMap(); + + /** + * Entrega el valor de ruleParameters + * + * @return Valor de ruleParameters + */ + public Map getRuleParameters() { + return this.ruleParameters; + } + + /** + * Entrega el valor de: originalTransactionModule + * + * @return String + */ + public String getOriginalTransactionModule() { + return this.originalTransactionModule; + } + + /** + * Fija el valor de: originalTransactionModule + * + * @param originalTransactionModule + */ + public void setOriginalTransactionModule(String originalTransactionModule) { + this.originalTransactionModule = originalTransactionModule; + } + + /** + * Entrega el valor de: originalTransactionCode + * + * @return Integer + */ + public Integer getOriginalTransactionCode() { + return this.originalTransactionCode; + } + + /** + * Fija el valor de: originalTransactionCode + * + * @param originalTransactionCode + */ + public void setOriginalTransactionCode(Integer originalTransactionCode) { + this.originalTransactionCode = originalTransactionCode; + } + + /** + * Entrega el valor de: originalTransactionVersion + * + * @return Integer + */ + public Integer getOriginalTransactionVersion() { + return this.originalTransactionVersion; + } + + /** + * Fija el valor de: originalTransactionVersion + * + * @param originalTransactionVersion + */ + public void setOriginalTransactionVersion(Integer originalTransactionVersion) { + this.originalTransactionVersion = originalTransactionVersion; + } + + /** + * Entrega el valor de: jounalSequence + * + * @return Integer + */ + public Integer getJounalSequence() { + return this.jounalSequence; + } + + /** + * Fija el valor de jounalSequence + * + * @param jounalSequence value to set + */ + public void setJounalSequence(Integer jounalSequence) { + this.jounalSequence = jounalSequence; + } + + /** + * Entrega el valor de: onLine + * + * @return boolean + */ + public boolean isOnLine() { + return this.onLine; + } + + /** + * Fija el valor de: onLine + * + * @param onLine + */ + public void setOnLine(boolean onLine) { + this.onLine = onLine; + } + + /** + * Fija un nuevo valor en ruleParameters + * + * @param pRuleParameters nuevo valor para ruleParameters + */ + public void setRuleParameters(Map pRuleParameters) { + this.ruleParameters = pRuleParameters; + } + + public void addRuleParameter(String pName, Object pValue) { + this.ruleParameters.put(pName, pValue); + } + + public void cleanRuleParameters() { + this.ruleParameters = new HashMap(); + } + + public void addRuleParameter(String pNameValue) { + String[] val = pNameValue.split(","); + this.ruleParameters.put(val[0], val[1]); + } + + public String getRuleParameterString(String pKey) { + return "" + this.ruleParameters.get(pKey); + } + + public boolean getRuleParameterIsYes(String pKey) { + return "Y".compareTo(this.getRuleParameterString(pKey)) == 0; + } + + public BigDecimal getRuleParameterBigDecimal(String pKey) { + return new BigDecimal(this.getRuleParameterString(pKey)); + } + + public Integer getRuleParameterInteger(String pKey) { + return Integer.valueOf(this.getRuleParameterString(pKey)); + } + + /** + * Entrega el valor de: QueryRequest.java + * + * @return Response + */ + public Response getResponse() { + return this.response; + } + + /** + * Fija el valor de: response + * + * @param response Valor a almacenar + */ + public void setResponse(Response response) { + this.response = response; + } + + /** + * Filja map con tablas a consultar. + * + * @param mquerytables + * @throws Exception + */ + public void setQueryTables(HashMap mquerytables) throws Exception { + this.put("MQUERY", mquerytables); + } + + /** + * Entrega un map con la metadata de tablas a consultar. + * + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public HashMap getQueryTables() throws Exception { + return (HashMap) this.get("MQUERY"); + } + + /** + * Filja map con tablas a dar mantenimiento. + * + * @param msavetables + * @throws Exception + */ + public void setSaveTables(HashMap msavetables) throws Exception { + this.put("MSAVE", msavetables); + } + + /** + * Entrega un map con la metadata de tablas a dar mantenimiento. + * + * @return HashMap + * @throws Exception + */ + @SuppressWarnings("unchecked") + public HashMap getSaveTables() throws Exception { + return (HashMap) this.get("MSAVE"); + } + + /** + * Entrega la descripcion del navegador + * + * @return browser + */ + public String getBrowser() { + return browser; + } + + /** + * Fija la descripcion del navegador + * + * @param browser + */ + public void setBrowser(String browser) { + this.browser = browser; + } + + /** + * Entrega la descripcion del sistema operativo + * + * @return operativesystem + */ + public String getOperativesystem() { + return operativesystem; + } + + /** + * Fija la descripcion del sistema operativo + * + * @param operativesystem + */ + public void setOperativesystem(String operativesystem) { + this.operativesystem = operativesystem; + } + /** + * Entrega el nombre de la transaccion + * @return tname + */ + public String getTname() { + return tname; + } + /** + * Fija el nombre de la transaccion + * @param tname + */ + public void setTname(String tname) { + this.tname = tname; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/Request.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/Request.java.svn-base new file mode 100644 index 0000000..8a1bd40 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/Request.java.svn-base @@ -0,0 +1,958 @@ +package com.fp.dto; + +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import com.fp.common.helper.BeanManager; +import com.fp.dto.fin.FinancialRequest; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.dto.save.SaveBean; + +/** + * Requet general utilizado en el procesamiento de transacciones, ejemplo consultas, mantenimiento, reportes financiero. + * + * @author Jorge Vaca . + * @version 2.1 + */ +public class Request extends AbstractData { + + private static final long serialVersionUID = 1L; + + /** Objeto que almacena la respuesta de una consulta. */ + private Response response; + + /** Codigo de usuario que ejecuta una transaccion. */ + protected String user; + + /** Idioma preferido del usuario. */ + /** Codigo interno de usuario que ejecuta una transaccion. */ + protected Integer internalUserCode; + + /** + * language + */ + protected String language; + + /** Perfil del Usuario. */ + protected String profile; + + /** Codigo del modulo al que pertenece la transaccion. */ + protected String transactionModule; + + /** Codigo de transaccion a ejecutar. */ + protected Integer transactionCode; + + /** Version de la transaccion a ejecutar. */ + protected Integer transactionVersion; + + /** Codigo de terminal asociado al ip de la maquina desde la cual se ejecuta una transaccion. */ + protected String terminalCode; + + /** Nombre de la transaccion*/ + protected String tname; + + /** Identificador de la transaccion. */ + protected String journalId; + + /** Codigo de canal desde el cual se ejecuta una transaccion. */ + protected String channelCode; + + /** Codigo de compania. */ + protected Integer company; + + /** Codigo de sucursal origen de la transaccion. */ + protected Integer branchCode; + + /** Codigo de oficina origen de la transaccion. */ + protected Integer officeCode; + + /** Codigo de area origen de la transaccion. */ + protected Integer areaCode; + + /** Codigo de usuario que ejecuta una transaccion. */ + protected String authorizedUser; + + /** Numero de cuenta a enviar al log de transacion. */ + protected String logaccount; + + /** Numero de solicitud a enviar al log de transacion. */ + protected String logsolicitude; + + /** Codigo de persona a enviar al log de transacion. */ + protected Integer logperson; + + /** Centro de control donde pertenece la persona para enviar al log de transacion. */ + protected String centrocontrol; + + /** Unidad de control donde pertenece la persona para enviar al log de transacion. */ + protected String unidad; + + /** + * Subject a presentar en la agenda del usuario. + */ + protected String subject; + + /** Codigo del modulo original al que pertenece la transaccion. */ + private String originalTransactionModule; + + /** Codigo de transaccion original a ejecutar. */ + private Integer originalTransactionCode; + + /** Version de la transaccion original a ejecutar. */ + private Integer originalTransactionVersion; + + /** Secuencia interna de la transaccion por numero de mensaje. */ + private Integer jounalSequence; + + /** Indica que la transaccion que se esta ejecutando es el linea. */ + private boolean onLine = true; + + /** Navegador utilizado **/ + private String browser; + + /** Sitema operativo utilizado **/ + private String operativesystem; + + /** Cabecera de la transaccion que se esta ejecutando. */ + public Map mbeans = new HashMap(); + + /** + * Entrega el valor de subject + * + * @return Valor de subject + */ + public String getSubject() { + return this.subject; + } + + /** + * Fija un nuevo valor en subject + * + * @param subject nuevo valor para subject + */ + public void setSubject(String subject) { + this.subject = subject; + } + + /** + * Metodo que copia los valoes del requestq que llega como parametro. + * + * @param pRequest Datos del request a copiar. + * @throws Exception + */ + public void copy(Request pRequest) throws Exception { + this.copyFields(Request.class.getDeclaredFields(), pRequest); + } + + /** + * Metodo que copia los valoes del requestq que llega como parametro. + * + * @param pRequest Datos del request a copiar. + * @throws Exception + */ + public void copy(GeneralRequest pGeneralRequest) throws Exception { + this.copyFields(Request.class.getDeclaredFields(), pGeneralRequest); + // copia los datos del request del que estan el map al request general utilizado en el financiero. + Set s = super.keySet(); + for (String key : s) { + pGeneralRequest.put(key, super.get(key)); + } + } + + /** + * Metodo que fina el valor en request actual los datos del request que llegan como parametro. + * + * @param pFields Arreglo de campos que formn parte del request. + * @param pRequest Datos del request original a copiar. + * @throws Exception + */ + private void copyFields(Field[] pFields, GeneralRequest pGeneralRequest) throws Exception { + for (Field f : pFields) { + try { + Object value = f.get(this); + BeanManager.setBeanAttributeValue(pGeneralRequest, f.getName(), value); + } catch (Exception e) { + continue; + } + } + } + + /** + * Metodo que fina el valor en request actual los datos del request que llegan como parametro. + * + * @param pFields Arreglo de campos que formn parte del request. + * @param pRequest Datos del request original a copiar. + * @throws Exception + */ + private void copyFields(Field[] pFields, Request pRequest) throws Exception { + for (Field f : pFields) { + try { + f.set(pRequest, f.get(this)); + } catch (Exception e) { + continue; + } + } + } + + /** + * Metodo que copia los valoes del requestq que llega como parametro. + * + * @param pRequest Datos del request a copiar. + * @throws Exception + */ + public void copyMapValues(Request pRequest) throws Exception { + Set s = this.keySet(); + for (String key : s) { + pRequest.put(key, this.get(key)); + } + } + + /** + * Metodo que copia los valoes del requestq que llega como parametro. + * + * @param pRequest Datos del request a copiar. + * @throws Exception + */ + public void copyMapValuesWithOutSaveBean(Request pRequest) throws Exception { + Set s = this.keySet(); + for (String key : s) { + if(this.get(key) == null || this.get(key) instanceof SaveBean){ + continue; + } + pRequest.put(key, this.get(key)); + } + } + + /** + * Metodo que completa datos del Request en un financial request. + * + * @param pFinancialRequest Objeto a ser completado con los datos del Request. + * @throws Exception + */ + protected void completeFinancialRequest(FinancialRequest pFinancialRequest) throws Exception { + this.copy(pFinancialRequest); + } + + /** + * Metodo que crea y entraga un FinancialRequest dado un SaveRequest. + * + * @return FinancialRequest + * @throws Exception + */ + public FinancialRequest toFinancialRequest() throws Exception { + FinancialRequest financialRequest = new FinancialRequest(); + this.copy(financialRequest); + return financialRequest; + } + + /** + * Entrega el valor de: user + * + * @return String + */ + public String getUser() { + return this.user; + } + + /** + * Fija el valor de: user + * + * @param user + */ + public void setUser(String user) { + this.user = user; + } + + /** + * Entrega el valor de: internalUserCode + * + * @return Integer + */ + public Integer getInternalUserCode() { + return this.internalUserCode; + } + + /** + * Fija el valor de internalUserCode + * + * @param internalUserCode value to set + */ + public void setInternalUserCode(Integer internalUserCode) { + this.internalUserCode = internalUserCode; + } + + /** + * Entrega el valor de: language + * + * @return String + */ + public String getLanguage() { + return this.language; + } + + /** + * Fija el valor de: language + * + * @param language + */ + public void setLanguage(String language) { + this.language = language; + } + + /** + * Entrega el valor de: profile + * + * @return String + */ + public String getProfile() { + return this.profile; + } + + /** + * Fija el valor de: profile + * + * @param profile + */ + public void setProfile(String profile) { + this.profile = profile; + } + + /** + * Entrega el valor de: transactionModule + * + * @return String + */ + public String getTransactionModule() { + return this.transactionModule; + } + + /** + * Fija el valor de: transactionModule + * + * @param transactionModule + */ + public void setTransactionModule(String transactionModule) { + this.transactionModule = transactionModule; + } + + /** + * Entrega el valor de: transactionCode + * + * @return Integer + */ + public Integer getTransactionCode() { + return this.transactionCode; + } + + /** + * Fija el valor de: transactionCode + * + * @param transactionCode + */ + public void setTransactionCode(Integer transactionCode) { + this.transactionCode = transactionCode; + } + + /** + * Entrega el valor de: transactionVersion + * + * @return Integer + */ + public Integer getTransactionVersion() { + return this.transactionVersion; + } + + /** + * Fija el valor de: transactionVersion + * + * @param transactionVersion + */ + public void setTransactionVersion(Integer transactionVersion) { + this.transactionVersion = transactionVersion; + } + + /** + * Entrega el valor de: terminalCode + * + * @return String + */ + public String getTerminalCode() { + return this.terminalCode; + } + + /** + * Fija el valor de: terminalCode + * + * @param terminalCode + */ + public void setTerminalCode(String terminalCode) { + this.terminalCode = terminalCode; + } + + /** + * Entrega el valor de: journalId + * + * @return String + */ + public String getJournalId() { + return this.journalId; + } + + /** + * Fija el valor de: journalId + * + * @param journalId + */ + public void setJournalId(String journalId) { + this.journalId = journalId; + } + + /** + * Entrega el valor de: channelCode + * + * @return String + */ + public String getChannelCode() { + return this.channelCode; + } + + /** + * Fija el valor de: channelCode + * + * @param channelCode + */ + public void setChannelCode(String channelCode) { + this.channelCode = channelCode; + } + + /** + * Entrega el valor de: company + * + * @return Integer + */ + public Integer getCompany() { + return this.company; + } + + /** + * Fija el valor de company + * + * @param company value to set + */ + public void setCompany(Integer company) { + this.company = company; + } + + /** + * Entrega el valor de: branchCode + * + * @return Integer + */ + public Integer getBranchCode() { + return this.branchCode; + } + + /** + * Fija el valor de: branchCode + * + * @param branchCode + */ + public void setBranchCode(Integer branchCode) { + this.branchCode = branchCode; + } + + /** + * Entrega el valor de: officeCode + * + * @return Integer + */ + public Integer getOfficeCode() { + return this.officeCode; + } + + /** + * Fija el valor de: officeCode + * + * @param officeCode + */ + public void setOfficeCode(Integer officeCode) { + this.officeCode = officeCode; + } + + /** + * Entrega el valor de: areaCode + * + * @return Integer + */ + public Integer getAreaCode() { + return this.areaCode; + } + + /** + * Fija el valor de: areaCode + * + * @param areaCode + */ + public void setAreaCode(Integer areaCode) { + this.areaCode = areaCode; + } + + /** + * Entrega el valor de: authorizedUser + * + * @return String + */ + public String getAuthorizedUser() { + return this.authorizedUser; + } + + /** + * Fija el valor de: authorizedUser + * + * @param authorizedUser + */ + public void setAuthorizedUser(String authorizedUser) { + this.authorizedUser = authorizedUser; + } + + /** + * Entrega el valor convertido a Bigdecimal de un objeto del map. + * + * @param key Key de la entrada del map. + * @return BigDecimal + */ + public BigDecimal getBigDecimal(Object key) { + if (this.get(key) instanceof Integer) { + return new BigDecimal((Integer) this.get(key)); + } + if (this.get(key) instanceof Long) { + return new BigDecimal((Long) this.get(key)); + } + if (this.get(key) == null) { + return BigDecimal.ZERO; + } + return (BigDecimal) this.get(key); + } + + /** + * Entrega el valor convertido a Bigdecimal de un objeto del map. + * + * @param key Key de la entrada del map. + * @return BigDecimal + */ + public Date getDate(Object key) throws ParseException { + String value = this.getString(key); + SimpleDateFormat formatt = new SimpleDateFormat("yyyy-MM-dd"); + return new Date(formatt.parse(value).getTime()); + } + + /** + * Entrega el valor convertido a String de un objeto del map. + * + * @param key Key de la entrada del map. + * @return String + */ + public String getString(Object key) { + Object val = this.get(key); + if (val == null) { + throw new RuntimeException("NO SE PUDO DETERMINAR EL VALOR DE " + key); + } + return "" + val; + } + + /** + * Entrega el valor convertido a String de un objeto del map. + * + * @param key Key de la entrada del map. + * @return String + */ + public String findString(Object key) { + Object val = this.find(key); + if (val == null) { + throw new RuntimeException("NO SE PUDO DETERMINAR EL VALOR DE " + key); + } + return "" + val; + } + + /** + * Entrega el valor de un objeto, busca en el request si no lo encuentra busca en el response. + * + * @param key Key de la entrada del map. + * @return String + */ + public Object find(Object key) { + Object val = this.get(key); + if ((val == null) && (this.response != null)) { + val = this.response.get(key); + } + return val; + } + + /** + * Entrega el valor convertido a long de un objeto del map. + * + * @param key Key de la entrada del map. + * @return Long + */ + public Long getLong(Object key) { + return Long.valueOf(this.getString(key)); + } + + /** + * Entrega el valor convertido a integer de un objeto del map. + * + * @param key Key de la entrada del map. + * @return Integer + */ + public Integer getInteger(Object key) { + return Integer.valueOf(this.getString(key)); + } + + /** + * Entrega el valor de: logaccount. + * + * @return String + */ + public String getLogaccount() { + return this.logaccount; + } + + /** + * Fija el valor de: logaccount. + * + * @param logaccount + */ + public void setLogaccount(String logaccount) { + this.logaccount = logaccount; + } + + /** + * Entrega el valor de: logsolicitude. + * + * @return String + */ + public String getLogsolicitude() { + return this.logsolicitude; + } + + /** + * Fija el valor de: logsolicitude. + * + * @param logsolicitude + */ + public void setLogsolicitude(String logsolicitude) { + this.logsolicitude = logsolicitude; + } + + /** + * Entrega el valor de: logpPerson. + * + * @return Integer + */ + public Integer getLogperson() { + return this.logperson; + } + + /** + * Fija el valor de: logsolicitude. + * + * @param logsolicitude + */ + public void setLogperson(Integer logperson) { + this.logperson = logperson; + } + + /** + * Entrega el valor de: centrocontrol. + * + * @return String + */ + public String getCentrocontrol() { + return centrocontrol; + } + + /** + * Fija el valor de: centrocontrol. + * + * @param centrocontrol + */ + public void setCentrocontrol(String centrocontrol) { + this.centrocontrol = centrocontrol; + } + + /** + * Entrega el valor de: unidad. + * + * @return String + */ + public String getUnidad() { + return unidad; + } + + /** + * Fija el valor de: unidad. + * + * @param unidad + */ + public void setUnidad(String unidad) { + this.unidad = unidad; + } + + protected Map ruleParameters = new HashMap(); + + /** + * Entrega el valor de ruleParameters + * + * @return Valor de ruleParameters + */ + public Map getRuleParameters() { + return this.ruleParameters; + } + + /** + * Entrega el valor de: originalTransactionModule + * + * @return String + */ + public String getOriginalTransactionModule() { + return this.originalTransactionModule; + } + + /** + * Fija el valor de: originalTransactionModule + * + * @param originalTransactionModule + */ + public void setOriginalTransactionModule(String originalTransactionModule) { + this.originalTransactionModule = originalTransactionModule; + } + + /** + * Entrega el valor de: originalTransactionCode + * + * @return Integer + */ + public Integer getOriginalTransactionCode() { + return this.originalTransactionCode; + } + + /** + * Fija el valor de: originalTransactionCode + * + * @param originalTransactionCode + */ + public void setOriginalTransactionCode(Integer originalTransactionCode) { + this.originalTransactionCode = originalTransactionCode; + } + + /** + * Entrega el valor de: originalTransactionVersion + * + * @return Integer + */ + public Integer getOriginalTransactionVersion() { + return this.originalTransactionVersion; + } + + /** + * Fija el valor de: originalTransactionVersion + * + * @param originalTransactionVersion + */ + public void setOriginalTransactionVersion(Integer originalTransactionVersion) { + this.originalTransactionVersion = originalTransactionVersion; + } + + /** + * Entrega el valor de: jounalSequence + * + * @return Integer + */ + public Integer getJounalSequence() { + return this.jounalSequence; + } + + /** + * Fija el valor de jounalSequence + * + * @param jounalSequence value to set + */ + public void setJounalSequence(Integer jounalSequence) { + this.jounalSequence = jounalSequence; + } + + /** + * Entrega el valor de: onLine + * + * @return boolean + */ + public boolean isOnLine() { + return this.onLine; + } + + /** + * Fija el valor de: onLine + * + * @param onLine + */ + public void setOnLine(boolean onLine) { + this.onLine = onLine; + } + + /** + * Fija un nuevo valor en ruleParameters + * + * @param pRuleParameters nuevo valor para ruleParameters + */ + public void setRuleParameters(Map pRuleParameters) { + this.ruleParameters = pRuleParameters; + } + + public void addRuleParameter(String pName, Object pValue) { + this.ruleParameters.put(pName, pValue); + } + + public void cleanRuleParameters() { + this.ruleParameters = new HashMap(); + } + + public void addRuleParameter(String pNameValue) { + String[] val = pNameValue.split(","); + this.ruleParameters.put(val[0], val[1]); + } + + public String getRuleParameterString(String pKey) { + return "" + this.ruleParameters.get(pKey); + } + + public boolean getRuleParameterIsYes(String pKey) { + return "Y".compareTo(this.getRuleParameterString(pKey)) == 0; + } + + public BigDecimal getRuleParameterBigDecimal(String pKey) { + return new BigDecimal(this.getRuleParameterString(pKey)); + } + + public Integer getRuleParameterInteger(String pKey) { + return Integer.valueOf(this.getRuleParameterString(pKey)); + } + + /** + * Entrega el valor de: QueryRequest.java + * + * @return Response + */ + public Response getResponse() { + return this.response; + } + + /** + * Fija el valor de: response + * + * @param response Valor a almacenar + */ + public void setResponse(Response response) { + this.response = response; + } + + /** + * Filja map con tablas a consultar. + * + * @param mquerytables + * @throws Exception + */ + public void setQueryTables(HashMap mquerytables) throws Exception { + this.put("MQUERY", mquerytables); + } + + /** + * Entrega un map con la metadata de tablas a consultar. + * + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public HashMap getQueryTables() throws Exception { + return (HashMap) this.get("MQUERY"); + } + + /** + * Filja map con tablas a dar mantenimiento. + * + * @param msavetables + * @throws Exception + */ + public void setSaveTables(HashMap msavetables) throws Exception { + this.put("MSAVE", msavetables); + } + + /** + * Entrega un map con la metadata de tablas a dar mantenimiento. + * + * @return HashMap + * @throws Exception + */ + @SuppressWarnings("unchecked") + public HashMap getSaveTables() throws Exception { + return (HashMap) this.get("MSAVE"); + } + + /** + * Entrega la descripcion del navegador + * + * @return browser + */ + public String getBrowser() { + return browser; + } + + /** + * Fija la descripcion del navegador + * + * @param browser + */ + public void setBrowser(String browser) { + this.browser = browser; + } + + /** + * Entrega la descripcion del sistema operativo + * + * @return operativesystem + */ + public String getOperativesystem() { + return operativesystem; + } + + /** + * Fija la descripcion del sistema operativo + * + * @param operativesystem + */ + public void setOperativesystem(String operativesystem) { + this.operativesystem = operativesystem; + } + /** + * Entrega el nombre de la transaccion + * @return tname + */ + public String getTname() { + return tname; + } + /** + * Fija el nombre de la transaccion + * @param tname + */ + public void setTname(String tname) { + this.tname = tname; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/Response.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/Response.java.svn-base new file mode 100644 index 0000000..04acab7 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/.svn/text-base/Response.java.svn-base @@ -0,0 +1,224 @@ +package com.fp.dto; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.commons.beanutils.BeanMap; + +import com.fp.common.helper.BeanManager; +import com.fp.dto.hb.HibernateId; + +public class Response extends HashMap implements Serializable { + + /** Version de la clase. */ + private static final long serialVersionUID = 1L; + + /** Constante que define el codigo de respuesta ok. */ + public static final String RESPONSE_OK = "0"; + + /** Codigo de respuesta. */ + private String responseCode; + + /** Mensaje de usuario asociado al codigo de respuesta. */ + private String responseUserMessage; + + /** Mensaje tecnico asociado al codigo de respuesta. */ + private String responseTechnicalMessage; + + /** Stack trace, del error ocasionada en al ejecucion de una operacion. */ + private String responseStack; + + /** + * Variable para identificar si un mensaje es o no de aplicacion + */ + private boolean isAplicationMessage; + + /** + * Metodo que rerna si el mensaje es de la aplicacion + * + * @return + */ + public boolean isIsAplicationMessage() { + return isAplicationMessage; + } + + /** + * Metodo que fija si el mensaje es de la aplicacion o no + * + * @param isAplicationMessage + */ + public void setIsAplicationMessage(boolean isAplicationMessage) { + this.isAplicationMessage = isAplicationMessage; + this.put("isAplicationMessage", isAplicationMessage); + } + + /** + * Entrega el valor de: responseTechnicalMessage + * + * @return String + */ + public String getResponseTechnicalMessage() { + return responseTechnicalMessage; + } + + /** + * Fija el valor de: responseTechnicalMessage + * + * @param responseTechnicalMessage + */ + public void setResponseTechnicalMessage(String responseTechnicalMessage) { + this.responseTechnicalMessage = responseTechnicalMessage; + this.put("responseTechnicalMessage", responseTechnicalMessage); + } + + /** + * Entrega el valor de: responseStack + * + * @return String + */ + public String getResponseStack() { + return responseStack; + } + + /** + * Fija el valor de: responseStack + * + * @param responseStack + */ + public void setResponseStack(String responseStack) { + this.responseStack = responseStack; + this.put("responseStack", responseStack); + } + + /** + * Entrega el valor de: responseCode + * + * @return String + */ + public String getResponseCode() { + return responseCode; + } + + /** + * Entrega el valor de: responseUserMessage + * + * @return String + */ + public String getResponseUserMessage() { + return responseUserMessage; + } + + public Response(String responseCode, String responseUserMessage) { + this.responseCode = responseCode; + this.responseUserMessage = responseUserMessage; + this.put("messageCode", responseCode); + this.put("message", responseUserMessage); + this.put("isAplicationMessage", true); + } + + /** + * Fija el valor de: responseCode + * + * @param responseCode + */ + public void setResponseCode(String responseCode) { + this.responseCode = responseCode; + this.put("messageCode", responseCode); + } + + /** + * Fija el valor de: responseUserMessage + * + * @param responseUserMessage + */ + public void setResponseUserMessage(String responseUserMessage) { + this.responseUserMessage = responseUserMessage; + this.put("message", responseUserMessage); + } + + public void changeAbstractBeanToMap() throws Exception { + Set s = super.keySet(); + for (String key : s) { + Object obj; + obj = super.get(key); + + if (obj instanceof AbstractDataTransport) { + Map mresp = this.beanToMap((AbstractDataTransport) obj); + super.put(key, mresp); + } + if (obj instanceof List) { + this.changeBeanListToMap(key, obj); + continue; + } + } + } + + @SuppressWarnings("unchecked") + private void changeBeanListToMap(String key, Object data) throws Exception { + List ldata; + try { + ldata = (List) data; + } catch (Exception e) { + return; + } + List> lresp = new ArrayList>(); + for (Object obj : ldata) { + if (obj instanceof AbstractDataTransport) { + Map mresp = this.beanToMap((AbstractDataTransport) obj); + lresp.add(mresp); + } + } + if (!lresp.isEmpty()) { + super.put(key, lresp); + } + + } + + @SuppressWarnings("unchecked") + private Map beanToMap(AbstractDataTransport bean) throws Exception { + Map mresp = new HashMap(); + Field[] fs = bean.getClass().getDeclaredFields(); + for (Field field : fs) { + try { + String name = field.getName(); + if (name.compareTo("serialVersionUID") == 0 || name.compareTo("__id") == 0) { + continue; + } + Object val = null; + try { + val = BeanManager.getBeanAttributeValue(bean, name); + } catch (Exception e1) { + continue; + } + if (val instanceof HibernateId) { + BeanMap bm = new BeanMap(val); + Set> ent = bm.entrySet(); + for (java.util.Map.Entry e : ent) { + String key = e.getKey(); + if (key.compareTo("class") == 0 || key.compareTo("transportBeanClass") == 0 || key.compareTo("empty") == 0 + || key.compareTo("modifiedData") == 0) { + continue; + } + mresp.put(name + "_" + key, e.getValue()); + } + continue; + } + mresp.put(name, val); + } catch (Exception e) { + continue; + } + + } + // completa datos adicionales. + Set s = bean.modifiedData.keySet(); + for (String key : s) { + mresp.put(key, bean.modifiedData.get(key)); + } + return mresp; + } +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/AbstractData.java b/base/dto/dto/src/main/java/com/fp/dto/AbstractData.java new file mode 100644 index 0000000..fd208ca --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/AbstractData.java @@ -0,0 +1,156 @@ +package com.fp.dto; + +import java.beans.PropertyChangeEvent; +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.commons.beanutils.BeanMap; + +import com.fp.common.helper.BeanManager; +import com.fp.dto.hb.HibernateId; + +public abstract class AbstractData extends HashMap implements Serializable { + + /** Version de la clase. */ + private static final long serialVersionUID = 1L; + + // protected PropertyChangeSupport pcs = new PropertyChangeSupport(this); + private final Map modifiedData = new HashMap(); + + // private boolean modified = false; + + public Map modifiedData() { + return modifiedData; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + private void verifyField(String pField, Object pOld, Object pNew) { + if (pOld == pNew) { + return; + } + if (pOld == null && pNew != null) { + this.putFieldModified(pField, "null"); + return; + } + if (pOld != null && pNew == null) { + this.putFieldModified(pField, pOld); + return; + } + if (pOld.getClass().getName().compareTo(pNew.getClass().getName()) != 0) { + this.putFieldModified(pField, pOld); + return; + } + if (pOld instanceof Comparable) { + if (((Comparable) pOld).compareTo(pNew) != 0) { + this.putFieldModified(pField, pOld); + return; + } + } + this.putFieldModified(pField, pOld); + } + + private void putFieldModified(String pField, Object pData) { + if (!this.modifiedData.containsKey(pField)) { + // modified = true; + modifiedData.put(pField, pData); + } + } + + + /** + * Entrega el valor de: modifiedData + * @return Map + */ + public Map getModifiedData() { + return modifiedData; + } + + public void propertyChange(PropertyChangeEvent evt) { + this.verifyField(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue()); + } + + /* + * public PropertyChangeSupport getPcs() { return pcs; } + */ + public void clean() { + // this.modified=false; + this.modifiedData.clear(); + } + + public String getTransportBeanClass() { + return this.getClass().getCanonicalName(); + } + + public void addAddtionalInfo(String pName, Object pValue) { + super.put(pName, pValue); + } + + /* + * (non-Javadoc) + * + * @see java.util.HashMap#entrySet() + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public Set> entrySet() { + Field[] fs1 = this.getClass().getDeclaredFields(); + List fs = new ArrayList(); + for (Field f : fs1) { + fs.add(f); + } + try { + Class csuper = this.getClass().getSuperclass(); + do { + if (csuper != null) { + Field[] fs2 = csuper.getDeclaredFields(); + for (Field f : fs2) { + fs.add(f); + } + } + csuper = csuper.getSuperclass(); + } while (csuper != null); + } catch (Exception e) { + } + for (Field field : fs) { + try { + String name = field.getName(); + if (name.compareTo("serialVersionUID") == 0) { + continue; + } + Object val = null; + try { + val = BeanManager.getBeanAttributeValue(this, name); + } catch (Exception e1) { + continue; + } + if (val instanceof HibernateId) { + BeanMap bm = new BeanMap(val); + Set> ent = bm.entrySet(); + for (java.util.Map.Entry e : ent) { + String key = e.getKey(); + if (key.compareTo("class") == 0 || key.compareTo("transportBeanClass") == 0 || key.compareTo("empty") == 0) { + // key = "transportBeanClass"; para que no envie el transportbeanclass + continue; + } + super.put(name + "_" + key, e.getValue()); + } + continue; + } + super.put(name, val); + } catch (Exception e) { + continue; + } + } + // super.put("transportBeanClass", this.getTransportBeanClass()); + return super.entrySet(); + } + + public Set> entrySetDefault() { + return super.entrySet(); + } +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/AbstractDataBalanceTransport.java b/base/dto/dto/src/main/java/com/fp/dto/AbstractDataBalanceTransport.java new file mode 100644 index 0000000..84c7be5 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/AbstractDataBalanceTransport.java @@ -0,0 +1,37 @@ +package com.fp.dto; + +import com.fp.dto.fin.FinancialExchange; + +/** + * Clase a extender en las clase que manejan saldos de cuentas. + * @author Jorge Vaca + * @version 2.1 + */ +public class AbstractDataBalanceTransport extends AbstractDataTransport{ + + private static final long serialVersionUID = 1L; + /**Indica si el registro de la tabla es modificado.*/ + private boolean modified = false; + + /** + * Entrega el valor de: modified + * @return boolean + */ + public boolean isModified() { + return modified; + } + + /** + * Fija el valor de: modified + * @param modified + */ + public void setModified(boolean modified) { + this.modified = modified; + } + + @Override + public Object cloneMe() throws CloneNotSupportedException { + AbstractDataBalanceTransport p = (AbstractDataBalanceTransport) this.clone(); + return p; + } +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/AbstractDataTransfer.java b/base/dto/dto/src/main/java/com/fp/dto/AbstractDataTransfer.java new file mode 100644 index 0000000..ead471a --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/AbstractDataTransfer.java @@ -0,0 +1,222 @@ +package com.fp.dto; + +import java.io.Serializable; +import java.util.HashMap; + +public abstract class AbstractDataTransfer extends HashMap implements Serializable,Cloneable{ + /** + * Codigo de version de la clase. + */ + private static final long serialVersionUID = 1L; + /** Codigo de usuario que ejecuta una transaccion. */ + private String user; + /** Codigo interno de usuario que ejecuta una transaccion. */ + private Integer internalUserCode; + /** Idioma preferido del usuario. */ + protected String language; + /** Perfil del Usuario. */ + protected Integer profile; + /** Codigo del modulo al que pertenece la transaccion. */ + private String transactionModule; + /** Codigo de transaccion a ejecutar. */ + private Integer transactionCode; + /** Version de la transaccion a ejecutar. */ + private Integer transactionVersion; + /** Codigo de terminal asociado al ip de la maquina desde la cual se ejecuta una transaccion. */ + private String terminalCode; + /** Identificador de la transaccion. */ + private String journalId; + /** Codigo de canal desde el cual se ejecuta una transaccion. */ + private String channelCode; + /** Codigo de sucursal origen de la transaccion. */ + private Integer branchCode; + /** Codigo de oficina origen de la transaccion. */ + private Integer officeCode; + /** Codigo de usuario que ejecuta una transaccion. */ + private String authorizedUser; + /** + * Entrega el valor de: user + * @return String + */ + public String getUser() { + return user; + } + /** + * Fija el valor de: user + * @param user + */ + public void setUser(String user) { + this.user = user; + } + + /** + * Entrega el valor de: internalUserCode + * @return Integer + */ + public Integer getInternalUserCode() { + return internalUserCode; + } + /** + * Fija el valor de internalUserCode + * @param internalUserCode value to set + */ + public void setInternalUserCode(Integer internalUserCode) { + this.internalUserCode = internalUserCode; + } + /** + * Entrega el valor de: language + * @return String + */ + public String getLanguage() { + return language; + } + /** + * Fija el valor de: language + * @param language + */ + public void setLanguage(String language) { + this.language = language; + } + /** + * Entrega el valor de: profile + * @return Integer + */ + public Integer getProfile() { + return profile; + } + /** + * Fija el valor de: profile + * @param profile + */ + public void setProfile(Integer profile) { + this.profile = profile; + } + /** + * Entrega el valor de: transactionModule + * @return String + */ + public String getTransactionModule() { + return transactionModule; + } + /** + * Fija el valor de: transactionModule + * @param transactionModule + */ + public void setTransactionModule(String transactionModule) { + this.transactionModule = transactionModule; + } + /** + * Entrega el valor de: transactionCode + * @return Integer + */ + public Integer getTransactionCode() { + return transactionCode; + } + /** + * Fija el valor de: transactionCode + * @param transactionCode + */ + public void setTransactionCode(Integer transactionCode) { + this.transactionCode = transactionCode; + } + /** + * Entrega el valor de: transactionVersion + * @return Integer + */ + public Integer getTransactionVersion() { + return transactionVersion; + } + /** + * Fija el valor de: transactionVersion + * @param transactionVersion + */ + public void setTransactionVersion(Integer transactionVersion) { + this.transactionVersion = transactionVersion; + } + /** + * Entrega el valor de: terminalCode + * @return String + */ + public String getTerminalCode() { + return terminalCode; + } + /** + * Fija el valor de: terminalCode + * @param terminalCode + */ + public void setTerminalCode(String terminalCode) { + this.terminalCode = terminalCode; + } + /** + * Entrega el valor de: journalId + * @return String + */ + public String getJournalId() { + return journalId; + } + /** + * Fija el valor de: journalId + * @param journalId + */ + public void setJournalId(String journalId) { + this.journalId = journalId; + } + /** + * Entrega el valor de: channelCode + * @return String + */ + public String getChannelCode() { + return channelCode; + } + /** + * Fija el valor de: channelCode + * @param channelCode + */ + public void setChannelCode(String channelCode) { + this.channelCode = channelCode; + } + /** + * Entrega el valor de: branchCode + * @return Integer + */ + public Integer getBranchCode() { + return branchCode; + } + /** + * Fija el valor de: branchCode + * @param branchCode + */ + public void setBranchCode(Integer branchCode) { + this.branchCode = branchCode; + } + /** + * Entrega el valor de: officeCode + * @return Integer + */ + public Integer getOfficeCode() { + return officeCode; + } + /** + * Fija el valor de: officeCode + * @param officeCode + */ + public void setOfficeCode(Integer officeCode) { + this.officeCode = officeCode; + } + /** + * Entrega el valor de: authorizedUser + * @return String + */ + public String getAuthorizedUser() { + return authorizedUser; + } + /** + * Fija el valor de: authorizedUser + * @param authorizedUser + */ + public void setAuthorizedUser(String authorizedUser) { + this.authorizedUser = authorizedUser; + } + + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/AbstractDataTransport.java b/base/dto/dto/src/main/java/com/fp/dto/AbstractDataTransport.java new file mode 100644 index 0000000..8770c7e --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/AbstractDataTransport.java @@ -0,0 +1,113 @@ +package com.fp.dto; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +/** + * Clase a extender en los entity beans, que manejan el mapeo de objetos con la base de datos relacional. + * + * @author Jorge Vaca . + * @version 2.1 + */ +public abstract class AbstractDataTransport implements Serializable, Cloneable { + + /** Version de la clase. */ + private static final long serialVersionUID = 1L; + + /** + * HashCode asociado con la Instancia. + */ + private int rowkey = 0; + + public HashMap modifiedData = new HashMap(); + + /** + * Indica que el registro es nuevo. + */ + public boolean isnew = false; + + /** Indica que el registro se actualiza en la base de datos en save generico. */ + public boolean isupdated = false; + + public abstract Object cloneMe() throws CloneNotSupportedException; + + /** + * Implementacion del metodo rowkey del registro. + * + * @return el hashCode la instancia + */ + public final int rowkey() { + if (rowkey == 0) { + rowkey = (int) (Math.random() * 10000000); + } + return rowkey; + } + + // private boolean modified = false; + + public Map modifiedData() { + return modifiedData; + } + + public Object get(String key) { + return modifiedData.get(key); + } + + public void put(String pField, Object pData) { + modifiedData.put(pField, pData); + } + + public void addAddtionalInfo(String pName, Object pValue) { + modifiedData.put(pName, pValue); + } + + public HashMap getModifiedData() { + return modifiedData; + } + + public void setModifiedData(HashMap modifiedData) { + this.modifiedData = modifiedData; + } + + public String getTransportBeanClass() { + return this.getClass().getCanonicalName(); + } + + /** + * Entrega el valor de: rowkey + * + * @return int + */ + public int getRowkey() { + return rowkey; + } + + /** + * Fija el valor de: rowkey + * + * @param Valor a fijar en el atributo. + */ + public void setRowkey(int rowkey) { + this.rowkey = rowkey; + } + + /** + * Entrega el valor de: isnew + * + * @return boolean + */ + public boolean isIsnew() { + return isnew; + } + + /** + * Fija el valor de: isnew + * + * @param Valor a fijar en el atributo + */ + public void setIsnew(boolean isnew) { + this.isnew = isnew; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/GeneralRequest.java b/base/dto/dto/src/main/java/com/fp/dto/GeneralRequest.java new file mode 100644 index 0000000..4744d99 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/GeneralRequest.java @@ -0,0 +1,524 @@ +package com.fp.dto; + +import java.io.Serializable; + +public class GeneralRequest extends AbstractDataTransport implements Serializable { + + private static final long serialVersionUID = 1L; + + /** Objeto que almacena la respuesta de una consulta. */ + private Response response; + + /** Codigo de usuario que ejecuta una transaccion. */ + protected String user; + + /** Idioma preferido del usuario. */ + /** Codigo interno de usuario que ejecuta una transaccion. */ + protected Integer internalUserCode; + + /** + * language + */ + protected String language; + + /** Perfil del Usuario. */ + protected String profile; + + /** Codigo del modulo al que pertenece la transaccion. */ + protected String transactionModule; + + /** Codigo de transaccion a ejecutar. */ + protected Integer transactionCode; + + /** Version de la transaccion a ejecutar. */ + protected Integer transactionVersion; + + /** Codigo de terminal asociado al ip de la maquina desde la cual se ejecuta una transaccion. */ + protected String terminalCode; + + /** Identificador de la transaccion. */ + protected String journalId; + + /** Codigo de canal desde el cual se ejecuta una transaccion. */ + protected String channelCode; + + /** Codigo de compania. */ + protected Integer company; + + /** Codigo de sucursal origen de la transaccion. */ + protected Integer branchCode; + + /** Codigo de oficina origen de la transaccion. */ + protected Integer officeCode; + + /** Codigo de usuario que ejecuta una transaccion. */ + protected String authorizedUser; + + /** Numero de cuenta a enviar al log de transacion. */ + protected String logaccount; + + /** Numero de solicitud a enviar al log de transacion. */ + protected String logsolicitude; + + /** Codigo de persona a enviar al log de transacion. */ + protected Integer logperson; + + /** + * Subject a presentar en la agenda del usuario. + */ + protected String subject; + + /** Codigo del modulo original al que pertenece la transaccion. */ + private String originalTransactionModule; + + /** Codigo de transaccion original a ejecutar. */ + private Integer originalTransactionCode; + + /** Version de la transaccion original a ejecutar. */ + private Integer originalTransactionVersion; + + /** Secuencia interna de la transaccion por numero de mensaje. */ + private Integer jounalSequence; + + /** Indica que la transaccion que se esta ejecutando es el linea. */ + private boolean onLine = true; + + /** + * Entrega el valor de: response + * + * @return Response + */ + public Response getResponse() { + return response; + } + + /** + * Fija el valor de: response + * + * @param response Valor a fijar en el atributo. + */ + public void setResponse(Response response) { + this.response = response; + } + + /** + * Entrega el valor de: user + * + * @return String + */ + public String getUser() { + return user; + } + + /** + * Fija el valor de: user + * + * @param user Valor a fijar en el atributo. + */ + public void setUser(String user) { + this.user = user; + } + + /** + * Entrega el valor de: internalUserCode + * + * @return Integer + */ + public Integer getInternalUserCode() { + return internalUserCode; + } + + /** + * Fija el valor de: internalUserCode + * + * @param internalUserCode Valor a fijar en el atributo. + */ + public void setInternalUserCode(Integer internalUserCode) { + this.internalUserCode = internalUserCode; + } + + /** + * Entrega el valor de: language + * + * @return String + */ + public String getLanguage() { + return language; + } + + /** + * Fija el valor de: language + * + * @param language Valor a fijar en el atributo. + */ + public void setLanguage(String language) { + this.language = language; + } + + /** + * Entrega el valor de: profile + * + * @return String + */ + public String getProfile() { + return profile; + } + + /** + * Fija el valor de: profile + * + * @param profile Valor a fijar en el atributo. + */ + public void setProfile(String profile) { + this.profile = profile; + } + + /** + * Entrega el valor de: transactionModule + * + * @return String + */ + public String getTransactionModule() { + return transactionModule; + } + + /** + * Fija el valor de: transactionModule + * + * @param transactionModule Valor a fijar en el atributo. + */ + public void setTransactionModule(String transactionModule) { + this.transactionModule = transactionModule; + } + + /** + * Entrega el valor de: transactionCode + * + * @return Integer + */ + public Integer getTransactionCode() { + return transactionCode; + } + + /** + * Fija el valor de: transactionCode + * + * @param transactionCode Valor a fijar en el atributo. + */ + public void setTransactionCode(Integer transactionCode) { + this.transactionCode = transactionCode; + } + + /** + * Entrega el valor de: transactionVersion + * + * @return Integer + */ + public Integer getTransactionVersion() { + return transactionVersion; + } + + /** + * Fija el valor de: transactionVersion + * + * @param transactionVersion Valor a fijar en el atributo. + */ + public void setTransactionVersion(Integer transactionVersion) { + this.transactionVersion = transactionVersion; + } + + /** + * Entrega el valor de: terminalCode + * + * @return String + */ + public String getTerminalCode() { + return terminalCode; + } + + /** + * Fija el valor de: terminalCode + * + * @param terminalCode Valor a fijar en el atributo. + */ + public void setTerminalCode(String terminalCode) { + this.terminalCode = terminalCode; + } + + /** + * Entrega el valor de: journalId + * + * @return String + */ + public String getJournalId() { + return journalId; + } + + /** + * Fija el valor de: journalId + * + * @param journalId Valor a fijar en el atributo. + */ + public void setJournalId(String journalId) { + this.journalId = journalId; + } + + /** + * Entrega el valor de: channelCode + * + * @return String + */ + public String getChannelCode() { + return channelCode; + } + + /** + * Fija el valor de: channelCode + * + * @param channelCode Valor a fijar en el atributo. + */ + public void setChannelCode(String channelCode) { + this.channelCode = channelCode; + } + + /** + * Entrega el valor de: company + * + * @return Integer + */ + public Integer getCompany() { + return company; + } + + /** + * Fija el valor de: company + * + * @param company Valor a fijar en el atributo. + */ + public void setCompany(Integer company) { + this.company = company; + } + + /** + * Entrega el valor de: branchCode + * + * @return Integer + */ + public Integer getBranchCode() { + return branchCode; + } + + /** + * Fija el valor de: branchCode + * + * @param branchCode Valor a fijar en el atributo. + */ + public void setBranchCode(Integer branchCode) { + this.branchCode = branchCode; + } + + /** + * Entrega el valor de: officeCode + * + * @return Integer + */ + public Integer getOfficeCode() { + return officeCode; + } + + /** + * Fija el valor de: officeCode + * + * @param officeCode Valor a fijar en el atributo. + */ + public void setOfficeCode(Integer officeCode) { + this.officeCode = officeCode; + } + + /** + * Entrega el valor de: authorizedUser + * + * @return String + */ + public String getAuthorizedUser() { + return authorizedUser; + } + + /** + * Fija el valor de: authorizedUser + * + * @param authorizedUser Valor a fijar en el atributo. + */ + public void setAuthorizedUser(String authorizedUser) { + this.authorizedUser = authorizedUser; + } + + /** + * Entrega el valor de: logaccount + * + * @return String + */ + public String getLogaccount() { + return logaccount; + } + + /** + * Fija el valor de: logaccount + * + * @param logaccount Valor a fijar en el atributo. + */ + public void setLogaccount(String logaccount) { + this.logaccount = logaccount; + } + + /** + * Entrega el valor de: logsolicitude + * + * @return String + */ + public String getLogsolicitude() { + return logsolicitude; + } + + /** + * Fija el valor de: logsolicitude + * + * @param logsolicitude Valor a fijar en el atributo. + */ + public void setLogsolicitude(String logsolicitude) { + this.logsolicitude = logsolicitude; + } + + /** + * Entrega el valor de: logperson + * + * @return Integer + */ + public Integer getLogperson() { + return logperson; + } + + /** + * Fija el valor de: logperson + * + * @param logperson Valor a fijar en el atributo. + */ + public void setLogperson(Integer logperson) { + this.logperson = logperson; + } + + /** + * Entrega el valor de: subject + * + * @return String + */ + public String getSubject() { + return subject; + } + + /** + * Fija el valor de: subject + * + * @param subject Valor a fijar en el atributo. + */ + public void setSubject(String subject) { + this.subject = subject; + } + + /** + * Entrega el valor de: originalTransactionModule + * + * @return String + */ + public String getOriginalTransactionModule() { + return originalTransactionModule; + } + + /** + * Fija el valor de: originalTransactionModule + * + * @param originalTransactionModule Valor a fijar en el atributo. + */ + public void setOriginalTransactionModule(String originalTransactionModule) { + this.originalTransactionModule = originalTransactionModule; + } + + /** + * Entrega el valor de: originalTransactionCode + * + * @return Integer + */ + public Integer getOriginalTransactionCode() { + return originalTransactionCode; + } + + /** + * Fija el valor de: originalTransactionCode + * + * @param originalTransactionCode Valor a fijar en el atributo. + */ + public void setOriginalTransactionCode(Integer originalTransactionCode) { + this.originalTransactionCode = originalTransactionCode; + } + + /** + * Entrega el valor de: originalTransactionVersion + * + * @return Integer + */ + public Integer getOriginalTransactionVersion() { + return originalTransactionVersion; + } + + /** + * Fija el valor de: originalTransactionVersion + * + * @param originalTransactionVersion Valor a fijar en el atributo. + */ + public void setOriginalTransactionVersion(Integer originalTransactionVersion) { + this.originalTransactionVersion = originalTransactionVersion; + } + + /** + * Entrega el valor de: jounalSequence + * + * @return Integer + */ + public Integer getJounalSequence() { + return jounalSequence; + } + + /** + * Fija el valor de: jounalSequence + * + * @param jounalSequence Valor a fijar en el atributo. + */ + public void setJounalSequence(Integer jounalSequence) { + this.jounalSequence = jounalSequence; + } + + /** + * Entrega el valor de: onLine + * + * @return boolean + */ + public boolean isOnLine() { + return onLine; + } + + /** + * Fija el valor de: onLine + * + * @param onLine Valor a fijar en el atributo. + */ + public void setOnLine(boolean onLine) { + this.onLine = onLine; + } + + @Override + public Object cloneMe() throws CloneNotSupportedException { + // No hacer un clone esta definido por la herencia de AbstractDataTransport + return null; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/Request.java b/base/dto/dto/src/main/java/com/fp/dto/Request.java new file mode 100644 index 0000000..8a1bd40 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/Request.java @@ -0,0 +1,958 @@ +package com.fp.dto; + +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import com.fp.common.helper.BeanManager; +import com.fp.dto.fin.FinancialRequest; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.dto.save.SaveBean; + +/** + * Requet general utilizado en el procesamiento de transacciones, ejemplo consultas, mantenimiento, reportes financiero. + * + * @author Jorge Vaca . + * @version 2.1 + */ +public class Request extends AbstractData { + + private static final long serialVersionUID = 1L; + + /** Objeto que almacena la respuesta de una consulta. */ + private Response response; + + /** Codigo de usuario que ejecuta una transaccion. */ + protected String user; + + /** Idioma preferido del usuario. */ + /** Codigo interno de usuario que ejecuta una transaccion. */ + protected Integer internalUserCode; + + /** + * language + */ + protected String language; + + /** Perfil del Usuario. */ + protected String profile; + + /** Codigo del modulo al que pertenece la transaccion. */ + protected String transactionModule; + + /** Codigo de transaccion a ejecutar. */ + protected Integer transactionCode; + + /** Version de la transaccion a ejecutar. */ + protected Integer transactionVersion; + + /** Codigo de terminal asociado al ip de la maquina desde la cual se ejecuta una transaccion. */ + protected String terminalCode; + + /** Nombre de la transaccion*/ + protected String tname; + + /** Identificador de la transaccion. */ + protected String journalId; + + /** Codigo de canal desde el cual se ejecuta una transaccion. */ + protected String channelCode; + + /** Codigo de compania. */ + protected Integer company; + + /** Codigo de sucursal origen de la transaccion. */ + protected Integer branchCode; + + /** Codigo de oficina origen de la transaccion. */ + protected Integer officeCode; + + /** Codigo de area origen de la transaccion. */ + protected Integer areaCode; + + /** Codigo de usuario que ejecuta una transaccion. */ + protected String authorizedUser; + + /** Numero de cuenta a enviar al log de transacion. */ + protected String logaccount; + + /** Numero de solicitud a enviar al log de transacion. */ + protected String logsolicitude; + + /** Codigo de persona a enviar al log de transacion. */ + protected Integer logperson; + + /** Centro de control donde pertenece la persona para enviar al log de transacion. */ + protected String centrocontrol; + + /** Unidad de control donde pertenece la persona para enviar al log de transacion. */ + protected String unidad; + + /** + * Subject a presentar en la agenda del usuario. + */ + protected String subject; + + /** Codigo del modulo original al que pertenece la transaccion. */ + private String originalTransactionModule; + + /** Codigo de transaccion original a ejecutar. */ + private Integer originalTransactionCode; + + /** Version de la transaccion original a ejecutar. */ + private Integer originalTransactionVersion; + + /** Secuencia interna de la transaccion por numero de mensaje. */ + private Integer jounalSequence; + + /** Indica que la transaccion que se esta ejecutando es el linea. */ + private boolean onLine = true; + + /** Navegador utilizado **/ + private String browser; + + /** Sitema operativo utilizado **/ + private String operativesystem; + + /** Cabecera de la transaccion que se esta ejecutando. */ + public Map mbeans = new HashMap(); + + /** + * Entrega el valor de subject + * + * @return Valor de subject + */ + public String getSubject() { + return this.subject; + } + + /** + * Fija un nuevo valor en subject + * + * @param subject nuevo valor para subject + */ + public void setSubject(String subject) { + this.subject = subject; + } + + /** + * Metodo que copia los valoes del requestq que llega como parametro. + * + * @param pRequest Datos del request a copiar. + * @throws Exception + */ + public void copy(Request pRequest) throws Exception { + this.copyFields(Request.class.getDeclaredFields(), pRequest); + } + + /** + * Metodo que copia los valoes del requestq que llega como parametro. + * + * @param pRequest Datos del request a copiar. + * @throws Exception + */ + public void copy(GeneralRequest pGeneralRequest) throws Exception { + this.copyFields(Request.class.getDeclaredFields(), pGeneralRequest); + // copia los datos del request del que estan el map al request general utilizado en el financiero. + Set s = super.keySet(); + for (String key : s) { + pGeneralRequest.put(key, super.get(key)); + } + } + + /** + * Metodo que fina el valor en request actual los datos del request que llegan como parametro. + * + * @param pFields Arreglo de campos que formn parte del request. + * @param pRequest Datos del request original a copiar. + * @throws Exception + */ + private void copyFields(Field[] pFields, GeneralRequest pGeneralRequest) throws Exception { + for (Field f : pFields) { + try { + Object value = f.get(this); + BeanManager.setBeanAttributeValue(pGeneralRequest, f.getName(), value); + } catch (Exception e) { + continue; + } + } + } + + /** + * Metodo que fina el valor en request actual los datos del request que llegan como parametro. + * + * @param pFields Arreglo de campos que formn parte del request. + * @param pRequest Datos del request original a copiar. + * @throws Exception + */ + private void copyFields(Field[] pFields, Request pRequest) throws Exception { + for (Field f : pFields) { + try { + f.set(pRequest, f.get(this)); + } catch (Exception e) { + continue; + } + } + } + + /** + * Metodo que copia los valoes del requestq que llega como parametro. + * + * @param pRequest Datos del request a copiar. + * @throws Exception + */ + public void copyMapValues(Request pRequest) throws Exception { + Set s = this.keySet(); + for (String key : s) { + pRequest.put(key, this.get(key)); + } + } + + /** + * Metodo que copia los valoes del requestq que llega como parametro. + * + * @param pRequest Datos del request a copiar. + * @throws Exception + */ + public void copyMapValuesWithOutSaveBean(Request pRequest) throws Exception { + Set s = this.keySet(); + for (String key : s) { + if(this.get(key) == null || this.get(key) instanceof SaveBean){ + continue; + } + pRequest.put(key, this.get(key)); + } + } + + /** + * Metodo que completa datos del Request en un financial request. + * + * @param pFinancialRequest Objeto a ser completado con los datos del Request. + * @throws Exception + */ + protected void completeFinancialRequest(FinancialRequest pFinancialRequest) throws Exception { + this.copy(pFinancialRequest); + } + + /** + * Metodo que crea y entraga un FinancialRequest dado un SaveRequest. + * + * @return FinancialRequest + * @throws Exception + */ + public FinancialRequest toFinancialRequest() throws Exception { + FinancialRequest financialRequest = new FinancialRequest(); + this.copy(financialRequest); + return financialRequest; + } + + /** + * Entrega el valor de: user + * + * @return String + */ + public String getUser() { + return this.user; + } + + /** + * Fija el valor de: user + * + * @param user + */ + public void setUser(String user) { + this.user = user; + } + + /** + * Entrega el valor de: internalUserCode + * + * @return Integer + */ + public Integer getInternalUserCode() { + return this.internalUserCode; + } + + /** + * Fija el valor de internalUserCode + * + * @param internalUserCode value to set + */ + public void setInternalUserCode(Integer internalUserCode) { + this.internalUserCode = internalUserCode; + } + + /** + * Entrega el valor de: language + * + * @return String + */ + public String getLanguage() { + return this.language; + } + + /** + * Fija el valor de: language + * + * @param language + */ + public void setLanguage(String language) { + this.language = language; + } + + /** + * Entrega el valor de: profile + * + * @return String + */ + public String getProfile() { + return this.profile; + } + + /** + * Fija el valor de: profile + * + * @param profile + */ + public void setProfile(String profile) { + this.profile = profile; + } + + /** + * Entrega el valor de: transactionModule + * + * @return String + */ + public String getTransactionModule() { + return this.transactionModule; + } + + /** + * Fija el valor de: transactionModule + * + * @param transactionModule + */ + public void setTransactionModule(String transactionModule) { + this.transactionModule = transactionModule; + } + + /** + * Entrega el valor de: transactionCode + * + * @return Integer + */ + public Integer getTransactionCode() { + return this.transactionCode; + } + + /** + * Fija el valor de: transactionCode + * + * @param transactionCode + */ + public void setTransactionCode(Integer transactionCode) { + this.transactionCode = transactionCode; + } + + /** + * Entrega el valor de: transactionVersion + * + * @return Integer + */ + public Integer getTransactionVersion() { + return this.transactionVersion; + } + + /** + * Fija el valor de: transactionVersion + * + * @param transactionVersion + */ + public void setTransactionVersion(Integer transactionVersion) { + this.transactionVersion = transactionVersion; + } + + /** + * Entrega el valor de: terminalCode + * + * @return String + */ + public String getTerminalCode() { + return this.terminalCode; + } + + /** + * Fija el valor de: terminalCode + * + * @param terminalCode + */ + public void setTerminalCode(String terminalCode) { + this.terminalCode = terminalCode; + } + + /** + * Entrega el valor de: journalId + * + * @return String + */ + public String getJournalId() { + return this.journalId; + } + + /** + * Fija el valor de: journalId + * + * @param journalId + */ + public void setJournalId(String journalId) { + this.journalId = journalId; + } + + /** + * Entrega el valor de: channelCode + * + * @return String + */ + public String getChannelCode() { + return this.channelCode; + } + + /** + * Fija el valor de: channelCode + * + * @param channelCode + */ + public void setChannelCode(String channelCode) { + this.channelCode = channelCode; + } + + /** + * Entrega el valor de: company + * + * @return Integer + */ + public Integer getCompany() { + return this.company; + } + + /** + * Fija el valor de company + * + * @param company value to set + */ + public void setCompany(Integer company) { + this.company = company; + } + + /** + * Entrega el valor de: branchCode + * + * @return Integer + */ + public Integer getBranchCode() { + return this.branchCode; + } + + /** + * Fija el valor de: branchCode + * + * @param branchCode + */ + public void setBranchCode(Integer branchCode) { + this.branchCode = branchCode; + } + + /** + * Entrega el valor de: officeCode + * + * @return Integer + */ + public Integer getOfficeCode() { + return this.officeCode; + } + + /** + * Fija el valor de: officeCode + * + * @param officeCode + */ + public void setOfficeCode(Integer officeCode) { + this.officeCode = officeCode; + } + + /** + * Entrega el valor de: areaCode + * + * @return Integer + */ + public Integer getAreaCode() { + return this.areaCode; + } + + /** + * Fija el valor de: areaCode + * + * @param areaCode + */ + public void setAreaCode(Integer areaCode) { + this.areaCode = areaCode; + } + + /** + * Entrega el valor de: authorizedUser + * + * @return String + */ + public String getAuthorizedUser() { + return this.authorizedUser; + } + + /** + * Fija el valor de: authorizedUser + * + * @param authorizedUser + */ + public void setAuthorizedUser(String authorizedUser) { + this.authorizedUser = authorizedUser; + } + + /** + * Entrega el valor convertido a Bigdecimal de un objeto del map. + * + * @param key Key de la entrada del map. + * @return BigDecimal + */ + public BigDecimal getBigDecimal(Object key) { + if (this.get(key) instanceof Integer) { + return new BigDecimal((Integer) this.get(key)); + } + if (this.get(key) instanceof Long) { + return new BigDecimal((Long) this.get(key)); + } + if (this.get(key) == null) { + return BigDecimal.ZERO; + } + return (BigDecimal) this.get(key); + } + + /** + * Entrega el valor convertido a Bigdecimal de un objeto del map. + * + * @param key Key de la entrada del map. + * @return BigDecimal + */ + public Date getDate(Object key) throws ParseException { + String value = this.getString(key); + SimpleDateFormat formatt = new SimpleDateFormat("yyyy-MM-dd"); + return new Date(formatt.parse(value).getTime()); + } + + /** + * Entrega el valor convertido a String de un objeto del map. + * + * @param key Key de la entrada del map. + * @return String + */ + public String getString(Object key) { + Object val = this.get(key); + if (val == null) { + throw new RuntimeException("NO SE PUDO DETERMINAR EL VALOR DE " + key); + } + return "" + val; + } + + /** + * Entrega el valor convertido a String de un objeto del map. + * + * @param key Key de la entrada del map. + * @return String + */ + public String findString(Object key) { + Object val = this.find(key); + if (val == null) { + throw new RuntimeException("NO SE PUDO DETERMINAR EL VALOR DE " + key); + } + return "" + val; + } + + /** + * Entrega el valor de un objeto, busca en el request si no lo encuentra busca en el response. + * + * @param key Key de la entrada del map. + * @return String + */ + public Object find(Object key) { + Object val = this.get(key); + if ((val == null) && (this.response != null)) { + val = this.response.get(key); + } + return val; + } + + /** + * Entrega el valor convertido a long de un objeto del map. + * + * @param key Key de la entrada del map. + * @return Long + */ + public Long getLong(Object key) { + return Long.valueOf(this.getString(key)); + } + + /** + * Entrega el valor convertido a integer de un objeto del map. + * + * @param key Key de la entrada del map. + * @return Integer + */ + public Integer getInteger(Object key) { + return Integer.valueOf(this.getString(key)); + } + + /** + * Entrega el valor de: logaccount. + * + * @return String + */ + public String getLogaccount() { + return this.logaccount; + } + + /** + * Fija el valor de: logaccount. + * + * @param logaccount + */ + public void setLogaccount(String logaccount) { + this.logaccount = logaccount; + } + + /** + * Entrega el valor de: logsolicitude. + * + * @return String + */ + public String getLogsolicitude() { + return this.logsolicitude; + } + + /** + * Fija el valor de: logsolicitude. + * + * @param logsolicitude + */ + public void setLogsolicitude(String logsolicitude) { + this.logsolicitude = logsolicitude; + } + + /** + * Entrega el valor de: logpPerson. + * + * @return Integer + */ + public Integer getLogperson() { + return this.logperson; + } + + /** + * Fija el valor de: logsolicitude. + * + * @param logsolicitude + */ + public void setLogperson(Integer logperson) { + this.logperson = logperson; + } + + /** + * Entrega el valor de: centrocontrol. + * + * @return String + */ + public String getCentrocontrol() { + return centrocontrol; + } + + /** + * Fija el valor de: centrocontrol. + * + * @param centrocontrol + */ + public void setCentrocontrol(String centrocontrol) { + this.centrocontrol = centrocontrol; + } + + /** + * Entrega el valor de: unidad. + * + * @return String + */ + public String getUnidad() { + return unidad; + } + + /** + * Fija el valor de: unidad. + * + * @param unidad + */ + public void setUnidad(String unidad) { + this.unidad = unidad; + } + + protected Map ruleParameters = new HashMap(); + + /** + * Entrega el valor de ruleParameters + * + * @return Valor de ruleParameters + */ + public Map getRuleParameters() { + return this.ruleParameters; + } + + /** + * Entrega el valor de: originalTransactionModule + * + * @return String + */ + public String getOriginalTransactionModule() { + return this.originalTransactionModule; + } + + /** + * Fija el valor de: originalTransactionModule + * + * @param originalTransactionModule + */ + public void setOriginalTransactionModule(String originalTransactionModule) { + this.originalTransactionModule = originalTransactionModule; + } + + /** + * Entrega el valor de: originalTransactionCode + * + * @return Integer + */ + public Integer getOriginalTransactionCode() { + return this.originalTransactionCode; + } + + /** + * Fija el valor de: originalTransactionCode + * + * @param originalTransactionCode + */ + public void setOriginalTransactionCode(Integer originalTransactionCode) { + this.originalTransactionCode = originalTransactionCode; + } + + /** + * Entrega el valor de: originalTransactionVersion + * + * @return Integer + */ + public Integer getOriginalTransactionVersion() { + return this.originalTransactionVersion; + } + + /** + * Fija el valor de: originalTransactionVersion + * + * @param originalTransactionVersion + */ + public void setOriginalTransactionVersion(Integer originalTransactionVersion) { + this.originalTransactionVersion = originalTransactionVersion; + } + + /** + * Entrega el valor de: jounalSequence + * + * @return Integer + */ + public Integer getJounalSequence() { + return this.jounalSequence; + } + + /** + * Fija el valor de jounalSequence + * + * @param jounalSequence value to set + */ + public void setJounalSequence(Integer jounalSequence) { + this.jounalSequence = jounalSequence; + } + + /** + * Entrega el valor de: onLine + * + * @return boolean + */ + public boolean isOnLine() { + return this.onLine; + } + + /** + * Fija el valor de: onLine + * + * @param onLine + */ + public void setOnLine(boolean onLine) { + this.onLine = onLine; + } + + /** + * Fija un nuevo valor en ruleParameters + * + * @param pRuleParameters nuevo valor para ruleParameters + */ + public void setRuleParameters(Map pRuleParameters) { + this.ruleParameters = pRuleParameters; + } + + public void addRuleParameter(String pName, Object pValue) { + this.ruleParameters.put(pName, pValue); + } + + public void cleanRuleParameters() { + this.ruleParameters = new HashMap(); + } + + public void addRuleParameter(String pNameValue) { + String[] val = pNameValue.split(","); + this.ruleParameters.put(val[0], val[1]); + } + + public String getRuleParameterString(String pKey) { + return "" + this.ruleParameters.get(pKey); + } + + public boolean getRuleParameterIsYes(String pKey) { + return "Y".compareTo(this.getRuleParameterString(pKey)) == 0; + } + + public BigDecimal getRuleParameterBigDecimal(String pKey) { + return new BigDecimal(this.getRuleParameterString(pKey)); + } + + public Integer getRuleParameterInteger(String pKey) { + return Integer.valueOf(this.getRuleParameterString(pKey)); + } + + /** + * Entrega el valor de: QueryRequest.java + * + * @return Response + */ + public Response getResponse() { + return this.response; + } + + /** + * Fija el valor de: response + * + * @param response Valor a almacenar + */ + public void setResponse(Response response) { + this.response = response; + } + + /** + * Filja map con tablas a consultar. + * + * @param mquerytables + * @throws Exception + */ + public void setQueryTables(HashMap mquerytables) throws Exception { + this.put("MQUERY", mquerytables); + } + + /** + * Entrega un map con la metadata de tablas a consultar. + * + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public HashMap getQueryTables() throws Exception { + return (HashMap) this.get("MQUERY"); + } + + /** + * Filja map con tablas a dar mantenimiento. + * + * @param msavetables + * @throws Exception + */ + public void setSaveTables(HashMap msavetables) throws Exception { + this.put("MSAVE", msavetables); + } + + /** + * Entrega un map con la metadata de tablas a dar mantenimiento. + * + * @return HashMap + * @throws Exception + */ + @SuppressWarnings("unchecked") + public HashMap getSaveTables() throws Exception { + return (HashMap) this.get("MSAVE"); + } + + /** + * Entrega la descripcion del navegador + * + * @return browser + */ + public String getBrowser() { + return browser; + } + + /** + * Fija la descripcion del navegador + * + * @param browser + */ + public void setBrowser(String browser) { + this.browser = browser; + } + + /** + * Entrega la descripcion del sistema operativo + * + * @return operativesystem + */ + public String getOperativesystem() { + return operativesystem; + } + + /** + * Fija la descripcion del sistema operativo + * + * @param operativesystem + */ + public void setOperativesystem(String operativesystem) { + this.operativesystem = operativesystem; + } + /** + * Entrega el nombre de la transaccion + * @return tname + */ + public String getTname() { + return tname; + } + /** + * Fija el nombre de la transaccion + * @param tname + */ + public void setTname(String tname) { + this.tname = tname; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/Response.java b/base/dto/dto/src/main/java/com/fp/dto/Response.java new file mode 100644 index 0000000..04acab7 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/Response.java @@ -0,0 +1,224 @@ +package com.fp.dto; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.commons.beanutils.BeanMap; + +import com.fp.common.helper.BeanManager; +import com.fp.dto.hb.HibernateId; + +public class Response extends HashMap implements Serializable { + + /** Version de la clase. */ + private static final long serialVersionUID = 1L; + + /** Constante que define el codigo de respuesta ok. */ + public static final String RESPONSE_OK = "0"; + + /** Codigo de respuesta. */ + private String responseCode; + + /** Mensaje de usuario asociado al codigo de respuesta. */ + private String responseUserMessage; + + /** Mensaje tecnico asociado al codigo de respuesta. */ + private String responseTechnicalMessage; + + /** Stack trace, del error ocasionada en al ejecucion de una operacion. */ + private String responseStack; + + /** + * Variable para identificar si un mensaje es o no de aplicacion + */ + private boolean isAplicationMessage; + + /** + * Metodo que rerna si el mensaje es de la aplicacion + * + * @return + */ + public boolean isIsAplicationMessage() { + return isAplicationMessage; + } + + /** + * Metodo que fija si el mensaje es de la aplicacion o no + * + * @param isAplicationMessage + */ + public void setIsAplicationMessage(boolean isAplicationMessage) { + this.isAplicationMessage = isAplicationMessage; + this.put("isAplicationMessage", isAplicationMessage); + } + + /** + * Entrega el valor de: responseTechnicalMessage + * + * @return String + */ + public String getResponseTechnicalMessage() { + return responseTechnicalMessage; + } + + /** + * Fija el valor de: responseTechnicalMessage + * + * @param responseTechnicalMessage + */ + public void setResponseTechnicalMessage(String responseTechnicalMessage) { + this.responseTechnicalMessage = responseTechnicalMessage; + this.put("responseTechnicalMessage", responseTechnicalMessage); + } + + /** + * Entrega el valor de: responseStack + * + * @return String + */ + public String getResponseStack() { + return responseStack; + } + + /** + * Fija el valor de: responseStack + * + * @param responseStack + */ + public void setResponseStack(String responseStack) { + this.responseStack = responseStack; + this.put("responseStack", responseStack); + } + + /** + * Entrega el valor de: responseCode + * + * @return String + */ + public String getResponseCode() { + return responseCode; + } + + /** + * Entrega el valor de: responseUserMessage + * + * @return String + */ + public String getResponseUserMessage() { + return responseUserMessage; + } + + public Response(String responseCode, String responseUserMessage) { + this.responseCode = responseCode; + this.responseUserMessage = responseUserMessage; + this.put("messageCode", responseCode); + this.put("message", responseUserMessage); + this.put("isAplicationMessage", true); + } + + /** + * Fija el valor de: responseCode + * + * @param responseCode + */ + public void setResponseCode(String responseCode) { + this.responseCode = responseCode; + this.put("messageCode", responseCode); + } + + /** + * Fija el valor de: responseUserMessage + * + * @param responseUserMessage + */ + public void setResponseUserMessage(String responseUserMessage) { + this.responseUserMessage = responseUserMessage; + this.put("message", responseUserMessage); + } + + public void changeAbstractBeanToMap() throws Exception { + Set s = super.keySet(); + for (String key : s) { + Object obj; + obj = super.get(key); + + if (obj instanceof AbstractDataTransport) { + Map mresp = this.beanToMap((AbstractDataTransport) obj); + super.put(key, mresp); + } + if (obj instanceof List) { + this.changeBeanListToMap(key, obj); + continue; + } + } + } + + @SuppressWarnings("unchecked") + private void changeBeanListToMap(String key, Object data) throws Exception { + List ldata; + try { + ldata = (List) data; + } catch (Exception e) { + return; + } + List> lresp = new ArrayList>(); + for (Object obj : ldata) { + if (obj instanceof AbstractDataTransport) { + Map mresp = this.beanToMap((AbstractDataTransport) obj); + lresp.add(mresp); + } + } + if (!lresp.isEmpty()) { + super.put(key, lresp); + } + + } + + @SuppressWarnings("unchecked") + private Map beanToMap(AbstractDataTransport bean) throws Exception { + Map mresp = new HashMap(); + Field[] fs = bean.getClass().getDeclaredFields(); + for (Field field : fs) { + try { + String name = field.getName(); + if (name.compareTo("serialVersionUID") == 0 || name.compareTo("__id") == 0) { + continue; + } + Object val = null; + try { + val = BeanManager.getBeanAttributeValue(bean, name); + } catch (Exception e1) { + continue; + } + if (val instanceof HibernateId) { + BeanMap bm = new BeanMap(val); + Set> ent = bm.entrySet(); + for (java.util.Map.Entry e : ent) { + String key = e.getKey(); + if (key.compareTo("class") == 0 || key.compareTo("transportBeanClass") == 0 || key.compareTo("empty") == 0 + || key.compareTo("modifiedData") == 0) { + continue; + } + mresp.put(name + "_" + key, e.getValue()); + } + continue; + } + mresp.put(name, val); + } catch (Exception e) { + continue; + } + + } + // completa datos adicionales. + Set s = bean.modifiedData.keySet(); + for (String key : s) { + mresp.put(key, bean.modifiedData.get(key)); + } + return mresp; + } +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/batch/.svn/entries b/base/dto/dto/src/main/java/com/fp/dto/batch/.svn/entries new file mode 100644 index 0000000..5031c01 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/batch/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/java/com/fp/dto/batch +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +BatchModuleRequest.java +file + + + + +2022-07-28T03:40:33.036761Z +5a48a435309260be4c6efc2f45c0e4b3 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5523 + +BatchAccountRequest.java +file + + + + +2022-07-28T03:40:33.036761Z +f78ce8271bd43e93f2db79611b1c02bb +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6727 + diff --git a/base/dto/dto/src/main/java/com/fp/dto/batch/.svn/text-base/BatchAccountRequest.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/batch/.svn/text-base/BatchAccountRequest.java.svn-base new file mode 100644 index 0000000..b650e0b --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/batch/.svn/text-base/BatchAccountRequest.java.svn-base @@ -0,0 +1,273 @@ +package com.fp.dto.batch; + +import java.io.Serializable; +import java.sql.Date; +import java.util.HashMap; + +public class BatchAccountRequest extends HashMap implements Cloneable, Serializable { + + private static final long serialVersionUID = -9161287129394163022L; + + /** Nmero de cuenta a la cual se va a ejecutar el proceso de fin de dia. */ + private String account; + + /** Cdigo de compania a la cual se va a proceder a ejecutar el fin de da. */ + private Integer company; + + /** Fecha contable en la cual se ejecuta el proceso de fin de dia, esta fecha pasa a la tabla de journal. */ + private Date accountingDate; + + /** Fecha de trabajo de la aplicacion. */ + private Date workingingDate; + + /** Fecha contable anterior a la fecha contable. */ + private Date previousDccountingDate; + + /** Proxima fecha contable */ + private Date nextAccountingDate; + + /** Modulo asociado a la cuenta a la cual se va a proceder a realizar el cierre de fin de da. */ + private String accountModule; + + /** Numero de hilo con el cual se ejecuta el proceso batch. */ + private Integer threadnumber; + + /** Codigo de modulo al que pertenece la transaccion con la cual se ejecuta el proceso de fin de dia. */ + private String transactionModule; + + /** Codigo de transaccion que origina la ejecucion del batch. */ + private Integer transactionCode; + + /** Version de transaccion que origina la ejecucion del batch. */ + private Integer transactionVersion; + + /** Codigo del modulo. */ + private String modulecode; + + /** + * Devuelve un clon del objeto. + * + * @return BatchAccountRequest + * @throws CloneNotSupportedException + */ + public BatchAccountRequest cloneMe() throws CloneNotSupportedException { + return (BatchAccountRequest) this.clone(); + } + + /** + * Entrega el valor de: account + * + * @return String + */ + public String getAccount() { + return this.account; + } + + /** + * Fija el valor de account + * + * @param account value to set + */ + public void setAccount(String account) { + this.account = account; + } + + /** + * Entrega el valor de: company + * + * @return Integer + */ + public Integer getCompany() { + return this.company; + } + + /** + * Fija el valor de company + * + * @param company value to set + */ + public void setCompany(Integer company) { + this.company = company; + } + + /** + * Entrega el valor de: accountingDate + * + * @return Date + */ + public Date getAccountingDate() { + return this.accountingDate; + } + + /** + * Fija el valor de accountingDate + * + * @param accountingDate value to set + */ + public void setAccountingDate(Date accountingDate) { + this.accountingDate = accountingDate; + } + + /** + * Entrega el valor de: workingingDate + * + * @return Date + */ + public Date getWorkingingDate() { + return this.workingingDate; + } + + /** + * Fija el valor de workingingDate + * + * @param workingingDate value to set + */ + public void setWorkingingDate(Date workingingDate) { + this.workingingDate = workingingDate; + } + + /** + * Entrega el valor de: previousDccountingDate + * + * @return Date + */ + public Date getPreviousDccountingDate() { + return this.previousDccountingDate; + } + + /** + * Fija el valor de previousDccountingDate + * + * @param previousDccountingDate value to set + */ + public void setPreviousDccountingDate(Date previousDccountingDate) { + this.previousDccountingDate = previousDccountingDate; + } + + /** + * Entrega el valor de: nextAccountingDate + * + * @return Date + */ + public Date getNextAccountingDate() { + return this.nextAccountingDate; + } + + /** + * Fija el valor de nextAccountingDate + * + * @param nextAccountingDate value to set + */ + public void setNextAccountingDate(Date nextAccountingDate) { + this.nextAccountingDate = nextAccountingDate; + } + + /** + * Entrega el valor de: accountModule + * + * @return String + */ + public String getAccountModule() { + return this.accountModule; + } + + /** + * Fija el valor de accountModule + * + * @param accountModule value to set + */ + public void setAccountModule(String accountModule) { + this.accountModule = accountModule; + } + + /** + * Entrega el valor de: threadnumber + * + * @return Integer + */ + public Integer getThreadnumber() { + return this.threadnumber; + } + + /** + * Fija el valor de: threadnumber + * + * @param threadnumber + */ + public void setThreadnumber(Integer threadnumber) { + this.threadnumber = threadnumber; + } + + /** + * Entrega el valor de: transactionModule + * + * @return String + */ + public String getTransactionModule() { + return this.transactionModule; + } + + /** + * Fija el valor de: transactionModule + * + * @param transactionModule + */ + public void setTransactionModule(String transactionModule) { + this.transactionModule = transactionModule; + } + + /** + * Entrega el valor de: transactionCode + * + * @return Integer + */ + public Integer getTransactionCode() { + return this.transactionCode; + } + + /** + * Fija el valor de: transactionCode + * + * @param transactionCode + */ + public void setTransactionCode(Integer transactionCode) { + this.transactionCode = transactionCode; + } + + /** + * Entrega el valor de: transactionVersion + * + * @return Integer + */ + public Integer getTransactionVersion() { + return this.transactionVersion; + } + + /** + * Fija el valor de: transactionVersion + * + * @param transactionVersion + */ + public void setTransactionVersion(Integer transactionVersion) { + this.transactionVersion = transactionVersion; + } + + /** + * Entrega el valor de: transactionVersion + * + * @return Integer + */ + public String getModuleCode() { + return this.modulecode; + } + + /** + * Fija el valor de: transactionVersion + * + * @param transactionVersion + */ + public void setModuleCode(String modulecode) { + this.modulecode = modulecode; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/batch/.svn/text-base/BatchModuleRequest.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/batch/.svn/text-base/BatchModuleRequest.java.svn-base new file mode 100644 index 0000000..64624f4 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/batch/.svn/text-base/BatchModuleRequest.java.svn-base @@ -0,0 +1,225 @@ +package com.fp.dto.batch; + +import java.io.Serializable; +import java.sql.Date; +import java.util.HashMap; + +/** + * Clase que maneja las fecha contables con la cuales se ejecuta el proceso del fin de dia, y la transaccion con la que + * ejecuta el fin de dia. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class BatchModuleRequest extends HashMap implements Serializable { + + /** Version de la clase. */ + private static final long serialVersionUID = 1L; + + /** Fecha contable de la aplicacion. */ + private Date accountingDate; + + /** Fecha de trabajo de la aplicacion. */ + private Date workingingDate; + + /** Fecha contable anterior a la fecha contable. */ + private Date previousAccountingDate; + + /** Proxima fecha contable */ + private Date nextAccountingDate; + + /** Modulo asociado a la cuenta a la cual se va a proceder a realizar el cierre de fin de da. */ + private String moduleCode; + + /** Codigo de modulo al que pertenece la transaccion con la cual se ejecuta el proceso de fin de dia. */ + private String transactionModule; + + /** Codigo de transaccion que origina la ejecucion del batch. */ + private Integer transactionCode; + + /** Version de transaccion que origina la ejecucion del batch. */ + private Integer transactionVersion; + + /** Codigo de compania asociado a cuentas. */ + private Integer company; + + /** Journalid de la transaccion. */ + private String journalid; + + /** + * Entrega el valor de: accountingDate + * + * @return Date + */ + public Date getAccountingDate() { + return this.accountingDate; + } + + /** + * Fija el valor de accountingDate + * + * @param accountingDate value to set + */ + public void setAccountingDate(Date accountingDate) { + this.accountingDate = accountingDate; + } + + /** + * Entrega el valor de: workingingDate + * + * @return Date + */ + public Date getWorkingingDate() { + return this.workingingDate; + } + + /** + * Fija el valor de workingingDate + * + * @param workingingDate value to set + */ + public void setWorkingingDate(Date workingingDate) { + this.workingingDate = workingingDate; + } + + /** + * Entrega el valor de: previousAccountingDate + * + * @return Date + */ + public Date getPreviousAccountingDate() { + return this.previousAccountingDate; + } + + /** + * Fija el valor de previousAccountingDate + * + * @param previousAccountingDate value to set + */ + public void setPreviousAccountingDate(Date previousAccountingDate) { + this.previousAccountingDate = previousAccountingDate; + } + + /** + * Entrega el valor de: nextAccountingDate + * + * @return Date + */ + public Date getNextAccountingDate() { + return this.nextAccountingDate; + } + + /** + * Fija el valor de nextAccountingDate + * + * @param nextAccountingDate value to set + */ + public void setNextAccountingDate(Date nextAccountingDate) { + this.nextAccountingDate = nextAccountingDate; + } + + /** + * Entrega el valor de: moduleCode + * + * @return String + */ + public String getModuleCode() { + return this.moduleCode; + } + + /** + * Fija el valor de moduleCode + * + * @param moduleCode value to set + */ + public void setModuleCode(String moduleCode) { + this.moduleCode = moduleCode; + } + + /** + * Entrega el valor de: transactionModule + * + * @return String + */ + public String getTransactionModule() { + return this.transactionModule; + } + + /** + * Fija el valor de transactionModule + * + * @param transactionModule value to set + */ + public void setTransactionModule(String transactionModule) { + this.transactionModule = transactionModule; + } + + /** + * Entrega el valor de: transactionCode + * + * @return Integer + */ + public Integer getTransactionCode() { + return this.transactionCode; + } + + /** + * Fija el valor de transactionCode + * + * @param transactionCode value to set + */ + public void setTransactionCode(Integer transactionCode) { + this.transactionCode = transactionCode; + } + + /** + * Entrega el valor de: transactionVersion + * + * @return Integer + */ + public Integer getTransactionVersion() { + return this.transactionVersion; + } + + /** + * Fija el valor de transactionVersion + * + * @param transactionVersion value to set + */ + public void setTransactionVersion(Integer transactionVersion) { + this.transactionVersion = transactionVersion; + } + + /** + * Entrega el valor de: company + * + * @return Integer + */ + public Integer getCompany() { + return this.company; + } + + /** + * Fija el valor de: company + * + * @param company value to set + */ + public void setCompany(Integer company) { + this.company = company; + } + + /** + * @return the journalid + */ + public String getJournalid() { + return this.journalid; + } + + /** + * @param journalid the journalid to set + */ + public void setJournalid(String journalid) { + this.journalid = journalid; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/batch/BatchAccountRequest.java b/base/dto/dto/src/main/java/com/fp/dto/batch/BatchAccountRequest.java new file mode 100644 index 0000000..b650e0b --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/batch/BatchAccountRequest.java @@ -0,0 +1,273 @@ +package com.fp.dto.batch; + +import java.io.Serializable; +import java.sql.Date; +import java.util.HashMap; + +public class BatchAccountRequest extends HashMap implements Cloneable, Serializable { + + private static final long serialVersionUID = -9161287129394163022L; + + /** Nmero de cuenta a la cual se va a ejecutar el proceso de fin de dia. */ + private String account; + + /** Cdigo de compania a la cual se va a proceder a ejecutar el fin de da. */ + private Integer company; + + /** Fecha contable en la cual se ejecuta el proceso de fin de dia, esta fecha pasa a la tabla de journal. */ + private Date accountingDate; + + /** Fecha de trabajo de la aplicacion. */ + private Date workingingDate; + + /** Fecha contable anterior a la fecha contable. */ + private Date previousDccountingDate; + + /** Proxima fecha contable */ + private Date nextAccountingDate; + + /** Modulo asociado a la cuenta a la cual se va a proceder a realizar el cierre de fin de da. */ + private String accountModule; + + /** Numero de hilo con el cual se ejecuta el proceso batch. */ + private Integer threadnumber; + + /** Codigo de modulo al que pertenece la transaccion con la cual se ejecuta el proceso de fin de dia. */ + private String transactionModule; + + /** Codigo de transaccion que origina la ejecucion del batch. */ + private Integer transactionCode; + + /** Version de transaccion que origina la ejecucion del batch. */ + private Integer transactionVersion; + + /** Codigo del modulo. */ + private String modulecode; + + /** + * Devuelve un clon del objeto. + * + * @return BatchAccountRequest + * @throws CloneNotSupportedException + */ + public BatchAccountRequest cloneMe() throws CloneNotSupportedException { + return (BatchAccountRequest) this.clone(); + } + + /** + * Entrega el valor de: account + * + * @return String + */ + public String getAccount() { + return this.account; + } + + /** + * Fija el valor de account + * + * @param account value to set + */ + public void setAccount(String account) { + this.account = account; + } + + /** + * Entrega el valor de: company + * + * @return Integer + */ + public Integer getCompany() { + return this.company; + } + + /** + * Fija el valor de company + * + * @param company value to set + */ + public void setCompany(Integer company) { + this.company = company; + } + + /** + * Entrega el valor de: accountingDate + * + * @return Date + */ + public Date getAccountingDate() { + return this.accountingDate; + } + + /** + * Fija el valor de accountingDate + * + * @param accountingDate value to set + */ + public void setAccountingDate(Date accountingDate) { + this.accountingDate = accountingDate; + } + + /** + * Entrega el valor de: workingingDate + * + * @return Date + */ + public Date getWorkingingDate() { + return this.workingingDate; + } + + /** + * Fija el valor de workingingDate + * + * @param workingingDate value to set + */ + public void setWorkingingDate(Date workingingDate) { + this.workingingDate = workingingDate; + } + + /** + * Entrega el valor de: previousDccountingDate + * + * @return Date + */ + public Date getPreviousDccountingDate() { + return this.previousDccountingDate; + } + + /** + * Fija el valor de previousDccountingDate + * + * @param previousDccountingDate value to set + */ + public void setPreviousDccountingDate(Date previousDccountingDate) { + this.previousDccountingDate = previousDccountingDate; + } + + /** + * Entrega el valor de: nextAccountingDate + * + * @return Date + */ + public Date getNextAccountingDate() { + return this.nextAccountingDate; + } + + /** + * Fija el valor de nextAccountingDate + * + * @param nextAccountingDate value to set + */ + public void setNextAccountingDate(Date nextAccountingDate) { + this.nextAccountingDate = nextAccountingDate; + } + + /** + * Entrega el valor de: accountModule + * + * @return String + */ + public String getAccountModule() { + return this.accountModule; + } + + /** + * Fija el valor de accountModule + * + * @param accountModule value to set + */ + public void setAccountModule(String accountModule) { + this.accountModule = accountModule; + } + + /** + * Entrega el valor de: threadnumber + * + * @return Integer + */ + public Integer getThreadnumber() { + return this.threadnumber; + } + + /** + * Fija el valor de: threadnumber + * + * @param threadnumber + */ + public void setThreadnumber(Integer threadnumber) { + this.threadnumber = threadnumber; + } + + /** + * Entrega el valor de: transactionModule + * + * @return String + */ + public String getTransactionModule() { + return this.transactionModule; + } + + /** + * Fija el valor de: transactionModule + * + * @param transactionModule + */ + public void setTransactionModule(String transactionModule) { + this.transactionModule = transactionModule; + } + + /** + * Entrega el valor de: transactionCode + * + * @return Integer + */ + public Integer getTransactionCode() { + return this.transactionCode; + } + + /** + * Fija el valor de: transactionCode + * + * @param transactionCode + */ + public void setTransactionCode(Integer transactionCode) { + this.transactionCode = transactionCode; + } + + /** + * Entrega el valor de: transactionVersion + * + * @return Integer + */ + public Integer getTransactionVersion() { + return this.transactionVersion; + } + + /** + * Fija el valor de: transactionVersion + * + * @param transactionVersion + */ + public void setTransactionVersion(Integer transactionVersion) { + this.transactionVersion = transactionVersion; + } + + /** + * Entrega el valor de: transactionVersion + * + * @return Integer + */ + public String getModuleCode() { + return this.modulecode; + } + + /** + * Fija el valor de: transactionVersion + * + * @param transactionVersion + */ + public void setModuleCode(String modulecode) { + this.modulecode = modulecode; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/batch/BatchModuleRequest.java b/base/dto/dto/src/main/java/com/fp/dto/batch/BatchModuleRequest.java new file mode 100644 index 0000000..64624f4 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/batch/BatchModuleRequest.java @@ -0,0 +1,225 @@ +package com.fp.dto.batch; + +import java.io.Serializable; +import java.sql.Date; +import java.util.HashMap; + +/** + * Clase que maneja las fecha contables con la cuales se ejecuta el proceso del fin de dia, y la transaccion con la que + * ejecuta el fin de dia. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class BatchModuleRequest extends HashMap implements Serializable { + + /** Version de la clase. */ + private static final long serialVersionUID = 1L; + + /** Fecha contable de la aplicacion. */ + private Date accountingDate; + + /** Fecha de trabajo de la aplicacion. */ + private Date workingingDate; + + /** Fecha contable anterior a la fecha contable. */ + private Date previousAccountingDate; + + /** Proxima fecha contable */ + private Date nextAccountingDate; + + /** Modulo asociado a la cuenta a la cual se va a proceder a realizar el cierre de fin de da. */ + private String moduleCode; + + /** Codigo de modulo al que pertenece la transaccion con la cual se ejecuta el proceso de fin de dia. */ + private String transactionModule; + + /** Codigo de transaccion que origina la ejecucion del batch. */ + private Integer transactionCode; + + /** Version de transaccion que origina la ejecucion del batch. */ + private Integer transactionVersion; + + /** Codigo de compania asociado a cuentas. */ + private Integer company; + + /** Journalid de la transaccion. */ + private String journalid; + + /** + * Entrega el valor de: accountingDate + * + * @return Date + */ + public Date getAccountingDate() { + return this.accountingDate; + } + + /** + * Fija el valor de accountingDate + * + * @param accountingDate value to set + */ + public void setAccountingDate(Date accountingDate) { + this.accountingDate = accountingDate; + } + + /** + * Entrega el valor de: workingingDate + * + * @return Date + */ + public Date getWorkingingDate() { + return this.workingingDate; + } + + /** + * Fija el valor de workingingDate + * + * @param workingingDate value to set + */ + public void setWorkingingDate(Date workingingDate) { + this.workingingDate = workingingDate; + } + + /** + * Entrega el valor de: previousAccountingDate + * + * @return Date + */ + public Date getPreviousAccountingDate() { + return this.previousAccountingDate; + } + + /** + * Fija el valor de previousAccountingDate + * + * @param previousAccountingDate value to set + */ + public void setPreviousAccountingDate(Date previousAccountingDate) { + this.previousAccountingDate = previousAccountingDate; + } + + /** + * Entrega el valor de: nextAccountingDate + * + * @return Date + */ + public Date getNextAccountingDate() { + return this.nextAccountingDate; + } + + /** + * Fija el valor de nextAccountingDate + * + * @param nextAccountingDate value to set + */ + public void setNextAccountingDate(Date nextAccountingDate) { + this.nextAccountingDate = nextAccountingDate; + } + + /** + * Entrega el valor de: moduleCode + * + * @return String + */ + public String getModuleCode() { + return this.moduleCode; + } + + /** + * Fija el valor de moduleCode + * + * @param moduleCode value to set + */ + public void setModuleCode(String moduleCode) { + this.moduleCode = moduleCode; + } + + /** + * Entrega el valor de: transactionModule + * + * @return String + */ + public String getTransactionModule() { + return this.transactionModule; + } + + /** + * Fija el valor de transactionModule + * + * @param transactionModule value to set + */ + public void setTransactionModule(String transactionModule) { + this.transactionModule = transactionModule; + } + + /** + * Entrega el valor de: transactionCode + * + * @return Integer + */ + public Integer getTransactionCode() { + return this.transactionCode; + } + + /** + * Fija el valor de transactionCode + * + * @param transactionCode value to set + */ + public void setTransactionCode(Integer transactionCode) { + this.transactionCode = transactionCode; + } + + /** + * Entrega el valor de: transactionVersion + * + * @return Integer + */ + public Integer getTransactionVersion() { + return this.transactionVersion; + } + + /** + * Fija el valor de transactionVersion + * + * @param transactionVersion value to set + */ + public void setTransactionVersion(Integer transactionVersion) { + this.transactionVersion = transactionVersion; + } + + /** + * Entrega el valor de: company + * + * @return Integer + */ + public Integer getCompany() { + return this.company; + } + + /** + * Fija el valor de: company + * + * @param company value to set + */ + public void setCompany(Integer company) { + this.company = company; + } + + /** + * @return the journalid + */ + public String getJournalid() { + return this.journalid; + } + + /** + * @param journalid the journalid to set + */ + public void setJournalid(String journalid) { + this.journalid = journalid; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/data/.svn/entries b/base/dto/dto/src/main/java/com/fp/dto/data/.svn/entries new file mode 100644 index 0000000..b84a8e6 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/data/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/java/com/fp/dto/data +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +SaveData.java +file + + + + +2022-07-28T03:40:33.329762Z +58de37027adc37ae52b6b7e46b6f00f0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5361 + +TransactionDTO.java +file + + + + +2022-07-28T03:40:33.330762Z +732cdf697f7a0342da1f2df306d09bc7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2198 + diff --git a/base/dto/dto/src/main/java/com/fp/dto/data/.svn/text-base/SaveData.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/data/.svn/text-base/SaveData.java.svn-base new file mode 100644 index 0000000..236f01b --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/data/.svn/text-base/SaveData.java.svn-base @@ -0,0 +1,181 @@ +package com.fp.dto.data; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.dto.save.SaveRequest; + +/** + * Thread local que almacena los datos del SaveRequest de entrada. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class SaveData { + /** Almacena una instancia de SaaveRequest con los datos de entrada. */ + private static final ThreadLocal> threadsave = new ThreadLocal>(); + + /** + * Metodo que entrega datos del SaveRequest. + * + * @return SaveRequest + */ + public static SaveRequest getSaveRequest() { + Map m = threadsave.get(); + if (m == null) { + return null; + } + return (SaveRequest) m.get("SAVEREQUEST"); + } + + /** + * Metoo que almacena en el thread local datos de SaveRequest. + * + * @param pSaveRequest + */ + public static void setSaveRequest(SaveRequest pSaveRequest) { + Map m = SaveData.getMap(); + m.put("SAVEREQUEST", pSaveRequest); + threadsave.set(m); + } + + /** + * Metodo que entrega datos del SaveRequest. + * + * @return SaveRequest + */ + public static String getOriginalString() { + Map m = threadsave.get(); + return (String) m.get("DATA"); + } + + /** + * Metoo que almacena en el thread local datos de SaveRequest. + * + * @param pSaveRequest + */ + public static void setOriginalString(String pData) { + Map m = SaveData.getMap(); + m.put("DATA", pData); + threadsave.set(m); + } + + /** + * Entrega el map asociado al thread local. + * + * @return Map + * @throws Exception + */ + public static Map getMap() { + Map m = threadsave.get(); + if (m == null) { + m = new HashMap(); + threadsave.set(m); + } + return m; + } + + /** + * Entrega el valor del codigo de persona asociado a una transaccion. + * + * @return String + * @throws Exception + */ + public static String getPersoncode() throws Exception { + String data = getValue("personcode"); + if (data == null) { + data = getValue("PERSONCODE"); + } + if ((data != null) && (data.length() > 10)) { + data = null; + } + return data; + } + + /** + * Entrega el valor del numero de cuenta asociado a una transaccion. + * + * @return String + * @throws Exception + */ + public static String getAccount() throws Exception { + String data = getValue("ACCOUNT"); + if (data == null) { + data = getValue("account"); + } + if (data == null) { + data = getValue("ACCOUNTNUMBER"); + } + if (data == null) { + data = getValue("accountnumber"); + } + if ((data != null) && (data.length() > 20)) { + data = null; + } + return data; + } + + /** + * Entrega el valor del numero de solicitud asociado a una transaccion. + * + * @return String + * @throws Exception + */ + public static String getSolicitudenumber() throws Exception { + String data = getValue("solicitudnumber"); + if (data == null) { + data = getValue("SOLICITUDNUMBER"); + } + if ((data != null) && (data.length() > 20)) { + data = null; + } + return data; + } + + /** + * Entrga el valor de un key, como personcode, account, solicitudnumber. + * + * @param parameter Key a buscar en la cadena json de entrada. + * @return String + * @throws Exception + */ + private static String getValue(String parameter) throws Exception { + // Si ya se cargo el valo se entrag, sio no existe en el map se parsea el mensaje. + Object aux = SaveData.getMap().get(parameter.toUpperCase()); + String data = null; + if ((aux == null) || (aux.toString().compareTo("") == 0)) { + String json = SaveData.getOriginalString(); + int i = json.indexOf(parameter); + if (i > 0) { + int j = json.indexOf(",", i); + data = json.substring(i, j); + String value = null; + int lon = data.indexOf(":"); + if (lon > 0) { + value = data.substring(data.indexOf(":") + 1, data.length()); + value = value.replace("\"", ""); + } + if (data.indexOf(":") > 0) { + data = data.substring(0, data.indexOf(":") - 1); + } else { + data = null; // encera data. + } + if ((data != null) && (data.compareTo(parameter) == 0)) { + SaveData.getMap().put(parameter.toUpperCase(), value); + data = value; + } + } + } else { + data = aux.toString(); + } + return data; + } + + /** + * Encera el thread local. + */ + public static void unset() { + threadsave.set(null); + threadsave.remove(); + } +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/data/.svn/text-base/TransactionDTO.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/data/.svn/text-base/TransactionDTO.java.svn-base new file mode 100644 index 0000000..71cfe88 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/data/.svn/text-base/TransactionDTO.java.svn-base @@ -0,0 +1,102 @@ +package com.fp.dto.data; + +import java.io.Serializable; + +public class TransactionDTO implements Serializable, Comparable { + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + private String module; + + private Integer transaction; + + private Integer version; + + /** + * Entrega el valor de module + * + * @return Valor de module + */ + public String getModule() { + return this.module; + } + + /** + * Fija un nuevo valor en module + * + * @param module nuevo valor para module + */ + public void setModule(String module) { + this.module = module; + } + + /** + * Entrega el valor de transaction + * + * @return Valor de transaction + */ + public Integer getTransaction() { + return this.transaction; + } + + /** + * Fija un nuevo valor en transaction + * + * @param transaction nuevo valor para transaction + */ + public void setTransaction(Integer transaction) { + this.transaction = transaction; + } + + /** + * Entrega el valor de version + * + * @return Valor de version + */ + public Integer getVersion() { + return this.version; + } + + /** + * Fija un nuevo valor en version + * + * @param version nuevo valor para version + */ + public void setVersion(Integer version) { + this.version = version; + } + + @Override + public int compareTo(TransactionDTO o) { + int mod = this.module.compareTo(o.module); + if (mod != 0) { + return mod; + } + int trn = this.transaction.compareTo(o.transaction); + if (trn != 0) { + return trn; + } + int ver = this.version.compareTo(o.version); + if (ver != 0) { + return ver; + } + return 0; + } + + public TransactionDTO(String module, Integer transaction, Integer version) { + this.module = module; + this.transaction = transaction; + this.version = version; + } + + public TransactionDTO() { + } + + @Override + public String toString() { + return this.module + "," + this.transaction + "," + this.version; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/data/SaveData.java b/base/dto/dto/src/main/java/com/fp/dto/data/SaveData.java new file mode 100644 index 0000000..236f01b --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/data/SaveData.java @@ -0,0 +1,181 @@ +package com.fp.dto.data; + +import java.util.HashMap; +import java.util.Map; + +import com.fp.dto.save.SaveRequest; + +/** + * Thread local que almacena los datos del SaveRequest de entrada. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class SaveData { + /** Almacena una instancia de SaaveRequest con los datos de entrada. */ + private static final ThreadLocal> threadsave = new ThreadLocal>(); + + /** + * Metodo que entrega datos del SaveRequest. + * + * @return SaveRequest + */ + public static SaveRequest getSaveRequest() { + Map m = threadsave.get(); + if (m == null) { + return null; + } + return (SaveRequest) m.get("SAVEREQUEST"); + } + + /** + * Metoo que almacena en el thread local datos de SaveRequest. + * + * @param pSaveRequest + */ + public static void setSaveRequest(SaveRequest pSaveRequest) { + Map m = SaveData.getMap(); + m.put("SAVEREQUEST", pSaveRequest); + threadsave.set(m); + } + + /** + * Metodo que entrega datos del SaveRequest. + * + * @return SaveRequest + */ + public static String getOriginalString() { + Map m = threadsave.get(); + return (String) m.get("DATA"); + } + + /** + * Metoo que almacena en el thread local datos de SaveRequest. + * + * @param pSaveRequest + */ + public static void setOriginalString(String pData) { + Map m = SaveData.getMap(); + m.put("DATA", pData); + threadsave.set(m); + } + + /** + * Entrega el map asociado al thread local. + * + * @return Map + * @throws Exception + */ + public static Map getMap() { + Map m = threadsave.get(); + if (m == null) { + m = new HashMap(); + threadsave.set(m); + } + return m; + } + + /** + * Entrega el valor del codigo de persona asociado a una transaccion. + * + * @return String + * @throws Exception + */ + public static String getPersoncode() throws Exception { + String data = getValue("personcode"); + if (data == null) { + data = getValue("PERSONCODE"); + } + if ((data != null) && (data.length() > 10)) { + data = null; + } + return data; + } + + /** + * Entrega el valor del numero de cuenta asociado a una transaccion. + * + * @return String + * @throws Exception + */ + public static String getAccount() throws Exception { + String data = getValue("ACCOUNT"); + if (data == null) { + data = getValue("account"); + } + if (data == null) { + data = getValue("ACCOUNTNUMBER"); + } + if (data == null) { + data = getValue("accountnumber"); + } + if ((data != null) && (data.length() > 20)) { + data = null; + } + return data; + } + + /** + * Entrega el valor del numero de solicitud asociado a una transaccion. + * + * @return String + * @throws Exception + */ + public static String getSolicitudenumber() throws Exception { + String data = getValue("solicitudnumber"); + if (data == null) { + data = getValue("SOLICITUDNUMBER"); + } + if ((data != null) && (data.length() > 20)) { + data = null; + } + return data; + } + + /** + * Entrga el valor de un key, como personcode, account, solicitudnumber. + * + * @param parameter Key a buscar en la cadena json de entrada. + * @return String + * @throws Exception + */ + private static String getValue(String parameter) throws Exception { + // Si ya se cargo el valo se entrag, sio no existe en el map se parsea el mensaje. + Object aux = SaveData.getMap().get(parameter.toUpperCase()); + String data = null; + if ((aux == null) || (aux.toString().compareTo("") == 0)) { + String json = SaveData.getOriginalString(); + int i = json.indexOf(parameter); + if (i > 0) { + int j = json.indexOf(",", i); + data = json.substring(i, j); + String value = null; + int lon = data.indexOf(":"); + if (lon > 0) { + value = data.substring(data.indexOf(":") + 1, data.length()); + value = value.replace("\"", ""); + } + if (data.indexOf(":") > 0) { + data = data.substring(0, data.indexOf(":") - 1); + } else { + data = null; // encera data. + } + if ((data != null) && (data.compareTo(parameter) == 0)) { + SaveData.getMap().put(parameter.toUpperCase(), value); + data = value; + } + } + } else { + data = aux.toString(); + } + return data; + } + + /** + * Encera el thread local. + */ + public static void unset() { + threadsave.set(null); + threadsave.remove(); + } +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/data/TransactionDTO.java b/base/dto/dto/src/main/java/com/fp/dto/data/TransactionDTO.java new file mode 100644 index 0000000..71cfe88 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/data/TransactionDTO.java @@ -0,0 +1,102 @@ +package com.fp.dto.data; + +import java.io.Serializable; + +public class TransactionDTO implements Serializable, Comparable { + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + private String module; + + private Integer transaction; + + private Integer version; + + /** + * Entrega el valor de module + * + * @return Valor de module + */ + public String getModule() { + return this.module; + } + + /** + * Fija un nuevo valor en module + * + * @param module nuevo valor para module + */ + public void setModule(String module) { + this.module = module; + } + + /** + * Entrega el valor de transaction + * + * @return Valor de transaction + */ + public Integer getTransaction() { + return this.transaction; + } + + /** + * Fija un nuevo valor en transaction + * + * @param transaction nuevo valor para transaction + */ + public void setTransaction(Integer transaction) { + this.transaction = transaction; + } + + /** + * Entrega el valor de version + * + * @return Valor de version + */ + public Integer getVersion() { + return this.version; + } + + /** + * Fija un nuevo valor en version + * + * @param version nuevo valor para version + */ + public void setVersion(Integer version) { + this.version = version; + } + + @Override + public int compareTo(TransactionDTO o) { + int mod = this.module.compareTo(o.module); + if (mod != 0) { + return mod; + } + int trn = this.transaction.compareTo(o.transaction); + if (trn != 0) { + return trn; + } + int ver = this.version.compareTo(o.version); + if (ver != 0) { + return ver; + } + return 0; + } + + public TransactionDTO(String module, Integer transaction, Integer version) { + this.module = module; + this.transaction = transaction; + this.version = version; + } + + public TransactionDTO() { + } + + @Override + public String toString() { + return this.module + "," + this.transaction + "," + this.version; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/fin/.svn/entries b/base/dto/dto/src/main/java/com/fp/dto/fin/.svn/entries new file mode 100644 index 0000000..106a964 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/fin/.svn/entries @@ -0,0 +1,164 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/java/com/fp/dto/fin +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +FinancialItem.java +file + + + + +2022-07-28T03:40:33.355762Z +108b90df1afe7361ab42ce699e3d518d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +15262 + +FinancialExchange.java +file + + + + +2022-07-28T03:40:33.355762Z +bdd47fe563f6b745548b9b241e45c2ed +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7534 + +Concept.java +file + + + + +2022-07-28T03:40:33.355762Z +358f7fdf6ee0e7a11a1e70e7bc1eb95f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +787 + +FinancialRequest.java +file + + + + +2022-07-28T03:40:33.355762Z +ca98cc2a505ce24e2ab9cd864850ab33 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +18787 + diff --git a/base/dto/dto/src/main/java/com/fp/dto/fin/.svn/text-base/Concept.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/fin/.svn/text-base/Concept.java.svn-base new file mode 100644 index 0000000..1fe61a1 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/fin/.svn/text-base/Concept.java.svn-base @@ -0,0 +1,47 @@ +package com.fp.dto.fin; + +import java.io.Serializable; + +public class Concept implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + /**Codigo de concepto.*/ + private Integer code; + /**Descripcion del concepto.*/ + private String description; + /** + * Entrega el valor de: code + * @return Integer + */ + public Integer getCode() { + return code; + } + /** + * Fija el valor de: code + * @param code + */ + public void setCode(Integer code) { + this.code = code; + } + /** + * Entrega el valor de: description + * @return String + */ + public String getDescription() { + return description; + } + /** + * Fija el valor de: description + * @param description + */ + public void setDescription(String description) { + this.description = description; + } + + + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/fin/.svn/text-base/FinancialExchange.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/fin/.svn/text-base/FinancialExchange.java.svn-base new file mode 100644 index 0000000..ee835ab --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/fin/.svn/text-base/FinancialExchange.java.svn-base @@ -0,0 +1,292 @@ +package com.fp.dto.fin; + +import java.math.BigDecimal; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.query.AdditionalQuery; + +/** + * Clase que se encarga de almacenar informacion necesaria para generar transacciones de compra venta de divisas. + * Adicionalmente sirve para ejecutar transacciones para la cuenta origen o destino por cada instancia de la clase + * ejemplo credito a cuentas por desembolso de prestamo, debito a cuentas para apertura de un plazo fijo.
+ * Para ejecuar el financiero se utiliza el evento y el lado a generar el financiero que puede ser origene, destino, + * ambos. + * @author Jorge Vaca + * @version 2.1 + * + */ +public class FinancialExchange extends AbstractDataTransport{ + + private static final long serialVersionUID = 1L; + /**Codigo de rubro, asociado al rubro de la transaccion. se utiliza en caja para hacer desglose + * de monedas ejempl deposito cuenta vista rubor efectivo.*/ + private Integer itemcode; + /**Codigo de la moneda origen, si es distinata a la moneda oficial se realiza la compra de divisas.*/ + private String origincurrency; + /**Monto en la moneda origen.*/ + private BigDecimal originamount; + /**Numero de cueta origen utilizada para ejecutar transacciones financieras.*/ + private String originaccount; + /**Codigo de compania a la que pertenece la cuenta origen*/ + private Integer origincompany; + /**Codigo de la moneda origen, si es distinata a la moneda oficial se realiza la compra de divisas.*/ + private String destinycurrency; + /**Monto en la moneda origen.*/ + private BigDecimal destinyamount; + /**Numero de cueta destino utilizada para ejecutar transacciones financieras.*/ + private String destinyaccount; + /**Codigo de compania a la que pertenece la cuenta destino*/ + private Integer destinycompany; + /**Codigo contable utilizado para ejecutar transacciones financieras.*/ + private String accountantcode; + /**Cotizacion de compra a aplicar en la transaccion de compra de divisas.*/ + private BigDecimal purchaserate; + /**Cotizacion de venta a aplicar en la transaccion de venta de divisas.*/ + private BigDecimal salerate; + /**Codigo de evento con el cual se ejecuta la transaccion financiera.*/ + private String event; + /**Codigo de subsistema asociado al evento con el cual se ejecuta la transaccion financiera.*/ + private String eventmodule; + /**"true" se calcula el monto origen, en este caso se conoce el monto destino, + * "false" se calcula el monto destino en este caso se conoce el monto origen..*/ + private boolean calculateOrigin; + /**"O" Indica que se graba el financiero con el origen de la transaccion, + * "D" Indica que se graba el financiero con el destino de la transaccion.*/ + private String financial; + + + @Override + public Object cloneMe() throws CloneNotSupportedException { + FinancialExchange p = (FinancialExchange) this.clone(); + return p; + } + + /** + * Entrega el valor de: itemcode + * @return Integer + */ + public Integer getItemcode() { + return itemcode; + } + /** + * Fija el valor de: itemcode + * @param itemcode + */ + public void setItemcode(Integer itemcode) { + this.itemcode = itemcode; + } + /** + * Entrega el valor de: origincurrency + * @return String + */ + public String getOrigincurrency() { + return origincurrency; + } + /** + * Fija el valor de: origincurrency + * @param origincurrency + */ + public void setOrigincurrency(String origincurrency) { + this.origincurrency = origincurrency; + } + /** + * Entrega el valor de: originamount + * @return BigDecimal + */ + public BigDecimal getOriginamount() { + return originamount; + } + /** + * Fija el valor de: originamount + * @param originamount + */ + public void setOriginamount(BigDecimal originamount) { + this.originamount = originamount; + } + /** + * Entrega el valor de: originaccount + * @return String + */ + public String getOriginaccount() { + return originaccount; + } + /** + * Fija el valor de: originaccount + * @param originaccount + */ + public void setOriginaccount(String originaccount) { + this.originaccount = originaccount; + } + /** + * Entrega el valor de: origincompany + * @return Integer + */ + public Integer getOrigincompany() { + return origincompany; + } + /** + * Fija el valor de: origincompany + * @param origincompany + */ + public void setOrigincompany(Integer origincompany) { + this.origincompany = origincompany; + } + /** + * Entrega el valor de: destinycurrency + * @return String + */ + public String getDestinycurrency() { + return destinycurrency; + } + /** + * Fija el valor de: destinycurrency + * @param destinycurrency + */ + public void setDestinycurrency(String destinycurrency) { + this.destinycurrency = destinycurrency; + } + /** + * Entrega el valor de: destinyamount + * @return BigDecimal + */ + public BigDecimal getDestinyamount() { + return destinyamount; + } + /** + * Fija el valor de: destinyamount + * @param destinyamount + */ + public void setDestinyamount(BigDecimal destinyamount) { + this.destinyamount = destinyamount; + } + /** + * Entrega el valor de: destinyaccount + * @return String + */ + public String getDestinyaccount() { + return destinyaccount; + } + /** + * Fija el valor de: destinyaccount + * @param destinyaccount + */ + public void setDestinyaccount(String destinyaccount) { + this.destinyaccount = destinyaccount; + } + /** + * Entrega el valor de: destinycompany + * @return Integer + */ + public Integer getDestinycompany() { + return destinycompany; + } + /** + * Fija el valor de: destinycompany + * @param destinycompany + */ + public void setDestinycompany(Integer destinycompany) { + this.destinycompany = destinycompany; + } + /** + * Entrega el valor de: accountantcode + * @return String + */ + public String getAccountantcode() { + return accountantcode; + } + /** + * Fija el valor de: accountantcode + * @param accountantcode + */ + public void setAccountantcode(String accountantcode) { + this.accountantcode = accountantcode; + } + /** + * Entrega el valor de: purchaserate + * @return BigDecimal + */ + public BigDecimal getPurchaserate() { + return purchaserate; + } + /** + * Fija el valor de: purchaserate + * @param purchaserate + */ + public void setPurchaserate(BigDecimal purchaserate) { + this.purchaserate = purchaserate; + } + /** + * Entrega el valor de: salerate + * @return BigDecimal + */ + public BigDecimal getSalerate() { + return salerate; + } + /** + * Fija el valor de: salerate + * @param salerate + */ + public void setSalerate(BigDecimal salerate) { + this.salerate = salerate; + } + /** + * Entrega el valor de: event + * @return String + */ + public String getEvent() { + return event; + } + /** + * Fija el valor de: event + * @param event + */ + public void setEvent(String event) { + this.event = event; + } + + /** + * Entrega el valor de: eventmodule + * @return String + */ + public String getEventmodule() { + return eventmodule; + } + /** + * Fija el valor de: eventmodule + * @param eventmodule + */ + public void setEventmodule(String eventmodule) { + this.eventmodule = eventmodule; + } + /** + * Entrega el valor de: calculateOrigin + * @return boolean + */ + public boolean isCalculateOrigin() { + return calculateOrigin; + } + /** + * Fija el valor de: calculateOrigin + * @param calculateOrigin + */ + public void setCalculateOrigin(boolean calculateOrigin) { + this.calculateOrigin = calculateOrigin; + } + /** + * Entrega el valor de: financial + * @return String + */ + public String getFinancial() { + return financial; + } + /** + * Fija el valor de: financial + * @param financial + */ + public void setFinancial(String financial) { + this.financial = financial; + } + + +} + diff --git a/base/dto/dto/src/main/java/com/fp/dto/fin/.svn/text-base/FinancialItem.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/fin/.svn/text-base/FinancialItem.java.svn-base new file mode 100644 index 0000000..42dcec9 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/fin/.svn/text-base/FinancialItem.java.svn-base @@ -0,0 +1,612 @@ +package com.fp.dto.fin; + +import java.math.BigDecimal; +import java.sql.Date; + +import com.fp.dto.AbstractDataTransport; + +/** + * Clase utilizada en el procesos de transacciones financieras. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class FinancialItem extends AbstractDataTransport implements Cloneable { + + private static final long serialVersionUID = 1L; + + /** Codigo de rubro asociado a una transaccion monetaria. */ + private Integer itemCode; + + /** + * Numero de cuenta que se afecta con el rubro. Si el valor del atributo esta vacio se toma la cuenta que llega en + * el FinancialRequest, dependiendo de la definicion del rubro si es debito o credito. + */ + private String account; + + /** Codigo de compania a la que pertenece la cuenta. */ + private Integer companyAccount; + + /** + * Numero de cuota de una tabla de pagos que se afecta, utilizado en cuentas que manejan tablas de pagos ejemplo + * pago, prestamos. + */ + private Integer quotaNumber; + + /** + * Secuencia interna de la cuota de una tabla de pagos que se afecta, utilizado en cuentas que manejan tablas de + * pagos ejemplo pago, prestamos. + */ + private Integer quotaSequence; + + /** + * Codigo contable que se afecta con el movimiento, si llega un valor en este atributo se respeta es valor + * casocontrario el codigo contable lo obtiene la aplicacion. + */ + private String accountingCode; + + /** + * Sucursal destino del movimiento, si afecta a una cuenta producto se toma la sucursal de la cuenta. tambien se + * utiliza en el manejod e intersucursales. + */ + private Integer destinyBranch; + + /** + * Oficina destino del movimiento, si afecta a una cuenta producto se toma la sucursal de la cuenta. tambien se + * utiliza en el manejod e intersucursales. + */ + private Integer destinyOffice; + + /** + * Sucursal origen del movimiento, si afecta a una cuenta producto se toma la sucursal de la cuenta. tambien se + * utiliza en el manejod e intersucursales. + */ + private Integer originBranch; + + /** + * Oficina origen del movimiento, si afecta a una cuenta producto se toma la sucursal de la cuenta. tambien se + * utiliza en el manejod e intersucursales. + */ + private Integer originOffice; + + /** Monto de la transaccion */ + private BigDecimal amount; + + /** Codigo de moneda en la que esta expresado el valor del rubro. */ + private String currecy; + + /** + * Estatus de la cuenta con el que se afecta el moviento, si es una cuneta producto, si llega en blanco se toma de + * la cuenta producto + */ + private String accountStatus; + + /** + * Indica que con el mismo rubro de la transaccion se va a registrar varios asientos en el journal, ejemplo, + * registro de comprobantes contables, contabilizacion de cuotas de plazo fijo o prestamos. + */ + private boolean repeating = false; + + /** Tipo de sobregito , ejemplo CONTRACTED,OCASIONAL,INDIRECT, etc */ + private String overdrawCatalog; + + /** Codigo de tabla de tipo de sobregiro OVERDRAWTYPE. */ + private String overdrawCatalogCode; + + /** Codigo de tipo de credito que se afecta con la transaccion. */ + private String creditType; + + /** Codigo de estatus de la operacion que se afecta con la transaccion. */ + private String operationStatus; + + /** Fecha de inicio de la cuota o del sobregiro. */ + private Date beginingDate; + + /** Fecha de vencimiento de la cuota o del sobregiro. */ + private Date expirationDate; + + /** Indica si el tipo de saldo actualiza saldos. Ejm false, en contabilizacion de desembolso de un credito. */ + private boolean updateBalance = true; + + /** + * Cotizacion de compra o venta, con el cual se calcula el valor en moneda local para grabar en la tbala de journal. + */ + private BigDecimal exchangeQuote; + + /** Codigo de modulo utilizado en el registro contable de provisiones */ + private String accountmodule; + + /** Codigo de producto utilizado en el registro contable de provisiones */ + private String accountproduct; + + /** Codigo de subproducto utilizado en el registro contable de provisiones */ + private String accountsubproduct; + + /** + * Crea una instancia de FinancialItem, vacia. + */ + public FinancialItem() { + } + + /** + * Crea una instancia de FinancialItem. + * + * @param pItemCode Codigo de rubro con el cual se ejecuta la transaccion. + * @param pAmount Monto en el que se afecta el rubro. + * @param pCurrency Codigo de moneda en la que se expresa el monto del rubro. + * @throws Exception + */ + public FinancialItem(Integer pItemCode, BigDecimal pAmount, String pCurrency) throws Exception { + this.itemCode = pItemCode; + this.amount = pAmount; + this.currecy = pCurrency; + } + + /** + * Entrega una copia de la instancia de FinancialItem. + * + * @return FinancialItem + * @throws CloneNotSupportedException + */ + public FinancialItem cloneMe() throws CloneNotSupportedException { + return (FinancialItem) super.clone(); + } + + /** + * Entrega el valor de: itemCode + * + * @return Integer + */ + public Integer getItemCode() { + return this.itemCode; + } + + /** + * Fija el valor de itemCode + * + * @param code + */ + public void setItemCode(Integer itemCode) { + this.itemCode = itemCode; + } + + /** + * Entrega el valor de: account + * + * @return String + */ + public String getAccount() { + return this.account; + } + + /** + * Fija el valor de account + * + * @param account + */ + public void setAccount(String account) { + this.account = account; + } + + /** + * Entrega el valor de: companyAccount + * + * @return Integer + */ + public Integer getCompanyAccount() { + return this.companyAccount; + } + + /** + * Fija el valor de companyAccount + * + * @param companyAccount + */ + public void setCompanyAccount(Integer companyAccount) { + this.companyAccount = companyAccount; + } + + /** + * Entrega el valor de: quotaNumber + * + * @return Integer + */ + public Integer getQuotaNumber() { + return this.quotaNumber; + } + + /** + * Fija el valor de quotaNumber + * + * @param quotaNumber + */ + public void setQuotaNumber(Integer quotaNumber) { + this.quotaNumber = quotaNumber; + } + + /** + * Entrega el valor de: quotaSequence + * + * @return Integer + */ + public Integer getQuotaSequence() { + return this.quotaSequence; + } + + /** + * Fija el valor de quotaSequence + * + * @param quotaSequence value to set + */ + public void setQuotaSequence(Integer quotaSequence) { + this.quotaSequence = quotaSequence; + } + + /** + * Entrega el valor de: accountingCode + * + * @return String + */ + public String getAccountingCode() { + return this.accountingCode; + } + + /** + * Fija el valor de accountingCode + * + * @param accountingCode + */ + public void setAccountingCode(String accountingCode) { + this.accountingCode = accountingCode; + } + + /** + * Entrega el valor de: destinyBranch + * + * @return Integer + */ + public Integer getDestinyBranch() { + return this.destinyBranch; + } + + /** + * Fija el valor de destinyBranch + * + * @param destinyBranch + */ + public void setDestinyBranch(Integer destinyBranch) { + this.destinyBranch = destinyBranch; + } + + /** + * Entrega el valor de: destinyOffice + * + * @return Integer + */ + public Integer getDestinyOffice() { + return this.destinyOffice; + } + + /** + * Fija el valor de destinyOffice + * + * @param destinyOffice + */ + public void setDestinyOffice(Integer destinyOffice) { + this.destinyOffice = destinyOffice; + } + + /** + * Entrega el valor de: originBranch + * + * @return Integer + */ + public Integer getOriginBranch() { + return this.originBranch; + } + + /** + * Fija el valor de: originBranch + * + * @param originBranch value to set + */ + public void setOriginBranch(Integer originBranch) { + this.originBranch = originBranch; + } + + /** + * Entrega el valor de: originOffice + * + * @return Integer + */ + public Integer getOriginOffice() { + return this.originOffice; + } + + /** + * Fija el valor de: originOffice + * + * @param originOffice value to set + */ + public void setOriginOffice(Integer originOffice) { + this.originOffice = originOffice; + } + + /** + * Entrega el valor de: amount + * + * @return BigDecimal + */ + public BigDecimal getAmount() { + return this.amount; + } + + /** + * Fija el valor de amount + * + * @param amount + */ + public void setAmount(BigDecimal amount) { + this.amount = amount; + } + + /** + * Entrega el valor de: accountStatus + * + * @return String + */ + public String getAccountStatus() { + return this.accountStatus; + } + + /** + * Fija el valor de accountStatus + * + * @param accountStatus + */ + public void setAccountStatus(String accountStatus) { + this.accountStatus = accountStatus; + } + + /** + * Entrega el valor de: repeating + * + * @return boolean + */ + public boolean isRepeating() { + return this.repeating; + } + + /** + * Fija el valor de: repeating + * + * @param repeating + */ + public void setRepeating(boolean repeating) { + this.repeating = repeating; + } + + /** + * Entrega el valor de: currecy + * + * @return String + */ + public String getCurrecy() { + return this.currecy; + } + + /** + * Fija el valor de: currecy + * + * @param currecy + */ + public void setCurrecy(String currecy) { + this.currecy = currecy; + } + + @Override + public String toString() { + String data = "itemCode:" + this.itemCode + " currecy:" + this.currecy + " account:" + this.account + " cia:" + this.companyAccount + + " amount:" + this.amount + " qn: " + this.quotaNumber; + return data; + } + + /** + * Entrega el valor de: overdrawCatalog + * + * @return String + */ + public String getOverdrawCatalog() { + return this.overdrawCatalog; + } + + /** + * Fija el valor de overdrawCatalog + * + * @param overdrawCatalog value to set + */ + public void setOverdrawCatalog(String overdrawCatalog) { + this.overdrawCatalog = overdrawCatalog; + } + + /** + * Entrega el valor de: overdrawCatalogCode + * + * @return String + */ + public String getOverdrawCatalogCode() { + return this.overdrawCatalogCode; + } + + /** + * Fija el valor de overdrawCatalogCode + * + * @param overdrawCatalogCode value to set + */ + public void setOverdrawCatalogCode(String overdrawCatalogCode) { + this.overdrawCatalogCode = overdrawCatalogCode; + } + + /** + * Entrega el valor de: creditType + * + * @return String + */ + public String getCreditType() { + return this.creditType; + } + + /** + * Fija el valor de creditType + * + * @param creditType value to set + */ + public void setCreditType(String creditType) { + this.creditType = creditType; + } + + /** + * Entrega el valor de: operationStatus + * + * @return String + */ + public String getOperationStatus() { + return this.operationStatus; + } + + /** + * Fija el valor de: operationStatus + * + * @param operationStatus value to set + */ + public void setOperationStatus(String operationStatus) { + this.operationStatus = operationStatus; + } + + /** + * Entrega el valor de: beginingDate + * + * @return Date + */ + public Date getBeginingDate() { + return this.beginingDate; + } + + /** + * Fija el valor de beginingDate + * + * @param beginingDate value to set + */ + public void setBeginingDate(Date beginingDate) { + this.beginingDate = beginingDate; + } + + /** + * Entrega el valor de: expirationDate + * + * @return Date + */ + public Date getExpirationDate() { + return this.expirationDate; + } + + /** + * Fija el valor de expirationDate + * + * @param expirationDate value to set + */ + public void setExpirationDate(Date expirationDate) { + this.expirationDate = expirationDate; + } + + /** + * Entrega el valor de: updateBalance + * + * @return boolean + */ + public boolean isUpdateBalance() { + return this.updateBalance; + } + + /** + * Fija el valor de updateBalance + * + * @param updateBalance value to set + */ + public void setUpdateBalance(boolean updateBalance) { + this.updateBalance = updateBalance; + } + + /** + * Entrega el valor de: exchangeQuote + * + * @return BigDecimal + */ + public BigDecimal getExchangeQuote() { + return this.exchangeQuote; + } + + /** + * Fija el valor de: exchangeQuote + * + * @param exchangeQuote + */ + public void setExchangeQuote(BigDecimal exchangeQuote) { + this.exchangeQuote = exchangeQuote; + } + + /** + * Entrega el valor de: accountmodule + * + * @return String + */ + public String getAccountmodule() { + return this.accountmodule; + } + + /** + * Fija el valor de: accountmodule + * + * @param accountmodule value to set + */ + public void setAccountmodule(String accountmodule) { + this.accountmodule = accountmodule; + } + + /** + * Entrega el valor de: accountproduct + * + * @return String + */ + public String getAccountproduct() { + return this.accountproduct; + } + + /** + * Fija el valor de: accountproduct + * + * @param accountproduct value to set + */ + public void setAccountproduct(String accountproduct) { + this.accountproduct = accountproduct; + } + + /** + * Entrega el valor de: accountsubproduct + * + * @return String + */ + public String getAccountsubproduct() { + return this.accountsubproduct; + } + + /** + * Fija el valor de: accountsubproduct + * + * @param accountsubproduct value to set + */ + public void setAccountsubproduct(String accountsubproduct) { + this.accountsubproduct = accountsubproduct; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/fin/.svn/text-base/FinancialRequest.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/fin/.svn/text-base/FinancialRequest.java.svn-base new file mode 100644 index 0000000..b1007c7 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/fin/.svn/text-base/FinancialRequest.java.svn-base @@ -0,0 +1,754 @@ +package com.fp.dto.fin; + +import java.sql.Date; +import java.util.ArrayList; +import java.util.List; + +import com.fp.dto.Request; + +/** + * Clase utilizada en el procesamiento de transacciones finacieras.
+ * Ejemplo: Depositos, Pago cheque, Desembolso creditos, Pago intereses certificados deposito. Etc.. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class FinancialRequest extends Request { + + public static String aux = "Hola mundo"; + + /* Version del objeto. */ + private static final long serialVersionUID = 1L; + + /** Identificador de la transaccion. */ + protected String oldjournalId; + + /** Modo en el que se ejecuta la transaccion N (Normal) I (Imperativo o Forzado) */ + private String transactionMode = "N"; + + /** Fecha contable del movimiento. */ + private Date accountingDate; + + /** Fecha de trabao del movimiento. */ + private Date workingdate; + + /** Fecha de proceso del movimiento, con esta fecha se lleva los saldos de cuentas producto. */ + private Date processDate; + + /** + * Fecha valor del movimiento, se utiliza en el calculo de ajuste de interese, los cuales se contabilizan con la + * fecha de hoy. + */ + private Date valueDate; + + /** True indica que se esta ejecutando un comprobante contable. */ + private boolean accountingVoucher = false; + + /** Numero de documento, papeleta o numero de cheque. */ + private String document; + + /** Numero de documento final, o numero de cheque final, se utiliza en la anulacion de un rango de cheques. */ + private String enddocument; + + /** Glosa de la transaccion,texto libre. */ + private String commentary; + + /** Codigo de area al que pertence el terminal. */ + private String area; + + /** Fecha de compenzacion del movimiento. */ + private Date settlement; + + /** Numero cuenta debito, en una transaccion monetaria. */ + private String debitAccount; + + /** + * Numero de cuota asociada a la cuenta debito, se utiliza si la transaccion afecta a una cuenta que afecta a una + * tabla de pagos. + */ + private Integer debitQuotaNumber; + + /** Numero de cuenta credito, en una transaccion monetaria. */ + private String creditAccount; + + /** + * Numero de cuota asociada a la cuenta credito, se utiliza si la transaccion afecta a una cuenta que afecta a una + * tabla de pagos. + */ + private Integer creditQuotaNumber; + + /** Indica que el request va a ejecutar un reverso de una transaccion. */ + private String reverse = "N"; + + /** Numero de mensaje a reversar. */ + private String journalIdReverse; + + /** Sucursal a la que cambiara la cuenta producto */ + private Integer newAccountBranch; + + /** Oficina a la que cambiara la cuenta producto */ + private Integer newAccountOffice; + + /** Sub Producto al cual cambiara la cuenta producto, no se permite cambios de producto de cuentas. */ + private String newSubProduct; + + /** Codigo de deposito utilizado en depositos codificados. */ + private String depositCode; + + /** Lista de rubros enviados desde un canal para ejecutar una transacion. */ + private List financialItems = new ArrayList(); + + /** + * Indica si se cambia el debito por credito, Ejemplo reverso contable del registro de una CXC en el cobro de la + * misma. + */ + private boolean changeDebitByCredit = false; + + /** Indica que al ejecutar una transaccion calcula provisiones o no. */ + private boolean calculateprovision = true; + + /** Codigo de tipos de identificacion */ + private String identificationcatalog; + + /** Codigo de catalogo de tipo de identificacion */ + private String identificationcatalogcode = "IDENTIFICATION"; + + /** Identificacion del cliente. */ + private String identification; + + /** Codigo de persona beneficiaria */ + private Integer beneficiaryperson; + + /** Nombre del beneficiario. */ + private String beneficiaryname; + + /** Numero de transaccion de caja multiple, asociado a la fecha de trabajo usuario. */ + private Integer mixnumber; + + /** Indica que la transaccion es de contabilizacion del accrual diario de intereses. */ + private boolean accrualdaily = false; + + /** + * Entrega una copia de la instancia de FinancialItem. + * + * @return FinancialItem + * @throws CloneNotSupportedException + */ + public FinancialRequest cloneMe() throws CloneNotSupportedException { + return (FinancialRequest) super.clone(); + } + + /** + * Entrega el valor de: oldjournalId + * + * @return String + */ + public String getOldjournalId() { + return this.oldjournalId; + } + + /** + * Fija el valor de: oldjournalId + * + * @param oldjournalId valor a almacenar en el objeto. + */ + public void setOldjournalId(String oldjournalId) { + this.oldjournalId = oldjournalId; + } + + /** + * Metodo que cambia el codigo de transaccion del FinancialRequest. + * + * @param pModule Codigo de modulo al que pertenece la nueva transaccion. + * @param pTransaction Codigo de la nueva transaccion. + * @param pVersion Version de la nueva transaccion. + * @throws Exception + */ + public void changeTransaction(String pModule, Integer pTransaction, Integer pVersion) throws Exception { + this.transactionModule = pModule; + this.transactionCode = pTransaction; + this.transactionVersion = pVersion; + } + + /** + * Encera financialItems de una transaccion. + */ + public void cleanItems() { + this.financialItems = new ArrayList(); + } + + /** + * Entrega el valor de: transactionMode + * + * @return String + */ + public String getTransactionMode() { + return this.transactionMode; + } + + /** + * Fija el valor de: transactionMode + * + * @param transactionMode + */ + public void setTransactionMode(String transactionMode) { + this.transactionMode = transactionMode; + } + + /** + * Entrega el valor de: accountingDate + * + * @return Date + */ + public Date getAccountingDate() { + return this.accountingDate; + } + + /** + * Fija el valor de: accountingDate + * + * @param accountingDate + */ + public void setAccountingDate(Date accountingDate) { + this.accountingDate = accountingDate; + } + + /** + * Entrega el valor de: workingdate + * + * @return Date + */ + public Date getWorkingdate() { + return this.workingdate; + } + + /** + * Fija el valor de workingDate + * + * @param workingdate value to set + */ + public void setWorkingdate(Date workingdate) { + this.workingdate = workingdate; + } + + /** + * Entrega el valor de: processDate + * + * @return Date + */ + public Date getProcessDate() { + return this.processDate; + } + + /** + * Fija el valor de: processDate + * + * @param processDate + */ + public void setProcessDate(Date processDate) { + this.processDate = processDate; + } + + /** + * Entrega el valor de: valueDate + * + * @return Date + */ + public Date getValueDate() { + return this.valueDate; + } + + /** + * Fija el valor de: valueDate + * + * @param valueDate + */ + public void setValueDate(Date valueDate) { + this.valueDate = valueDate; + } + + /** + * Entrega el valor de: accountingVoucher + * + * @return boolean + */ + public boolean isAccountingVoucher() { + return this.accountingVoucher; + } + + /** + * Fija el valor de: accountingVoucher + * + * @param accountingVoucher + */ + public void setAccountingVoucher(boolean accountingVoucher) { + this.accountingVoucher = accountingVoucher; + } + + /** + * Entrega el valor de: document + * + * @return String + */ + public String getDocument() { + return this.document; + } + + /** + * Fija el valor de: document + * + * @param document + */ + public void setDocument(String document) { + this.document = document; + } + + /** + * @return the enddocument + */ + public String getEnddocument() { + return this.enddocument; + } + + /** + * @param enddocument the enddocument to set + */ + public void setEnddocument(String enddocument) { + this.enddocument = enddocument; + } + + /** + * Entrega el valor de: commentary + * + * @return String + */ + public String getCommentary() { + return this.commentary; + } + + /** + * Fija el valor de: commentary + * + * @param commentary + */ + public void setCommentary(String commentary) { + this.commentary = commentary; + } + + /** + * Entrega el valor de: area + * + * @return String + */ + public String getArea() { + return this.area; + } + + /** + * Fija el valor de: area + * + * @param area + */ + public void setArea(String area) { + this.area = area; + } + + /** + * Entrega el valor de: settlement + * + * @return Date + */ + public Date getSettlement() { + return this.settlement; + } + + /** + * Fija el valor de: settlement + * + * @param settlement + */ + public void setSettlement(Date settlement) { + this.settlement = settlement; + } + + /** + * Entrega el valor de: debitAccount + * + * @return String + */ + public String getDebitAccount() { + return this.debitAccount; + } + + /** + * Fija el valor de: debitAccount + * + * @param debitAccount + */ + public void setDebitAccount(String debitAccount) { + this.debitAccount = debitAccount; + } + + /** + * Entrega el valor de: debitQuotaNumber + * + * @return Integer + */ + public Integer getDebitQuotaNumber() { + return this.debitQuotaNumber; + } + + /** + * Fija el valor de: debitQuotaNumber + * + * @param debitQuotaNumber + */ + public void setDebitQuotaNumber(Integer debitQuotaNumber) { + this.debitQuotaNumber = debitQuotaNumber; + } + + /** + * Entrega el valor de: creditAccount + * + * @return String + */ + public String getCreditAccount() { + return this.creditAccount; + } + + /** + * Fija el valor de: creditAccount + * + * @param creditAccount + */ + public void setCreditAccount(String creditAccount) { + this.creditAccount = creditAccount; + } + + /** + * Entrega el valor de: creditQuotaNumber + * + * @return Integer + */ + public Integer getCreditQuotaNumber() { + return this.creditQuotaNumber; + } + + /** + * Fija el valor de: creditQuotaNumber + * + * @param creditQuotaNumber + */ + public void setCreditQuotaNumber(Integer creditQuotaNumber) { + this.creditQuotaNumber = creditQuotaNumber; + } + + /** + * Entrega el valor de: reverse + * + * @return String + */ + public String getReverse() { + return this.reverse; + } + + /** + * Fija el valor de: reverse + * + * @param reverse + */ + public void setReverse(String reverse) { + this.reverse = reverse; + } + + /** + * Entrega el valor de: journalIdReverse + * + * @return String + */ + public String getJournalIdReverse() { + return this.journalIdReverse; + } + + /** + * Fija el valor de: journalIdReverse + * + * @param journalIdReverse + */ + public void setJournalIdReverse(String journalIdReverse) { + this.journalIdReverse = journalIdReverse; + } + + /** + * Entrega el valor de: newAccountBranch + * + * @return Integer + */ + public Integer getNewAccountBranch() { + return this.newAccountBranch; + } + + /** + * Fija el valor de: newAccountBranch + * + * @param newAccountBranch + */ + public void setNewAccountBranch(Integer newAccountBranch) { + this.newAccountBranch = newAccountBranch; + } + + /** + * Entrega el valor de: newAccountOffice + * + * @return Integer + */ + public Integer getNewAccountOffice() { + return this.newAccountOffice; + } + + /** + * Fija el valor de: newAccountOffice + * + * @param newAccountOffice + */ + public void setNewAccountOffice(Integer newAccountOffice) { + this.newAccountOffice = newAccountOffice; + } + + /** + * Entrega el valor de: newSubProduct + * + * @return String + */ + public String getNewSubProduct() { + return this.newSubProduct; + } + + /** + * Fija el valor de: newSubProduct + * + * @param newSubProduct + */ + public void setNewSubProduct(String newSubProduct) { + this.newSubProduct = newSubProduct; + } + + /** + * Adiciona un item a procesar en la transaccion. + * + * @param pFinancialItem Datos del FinancialItem. + * @throws Exception + */ + public void addFinancialItem(FinancialItem pFinancialItem) throws Exception { + this.financialItems.add(pFinancialItem); + } + + /** + * Adiciona una Lista de item a procesar en la transaccion. + * + * @param pFinancialItems Lista de items. + * @throws Exception + */ + public void addFinancialItems(List pFinancialItems) throws Exception { + this.financialItems.addAll(pFinancialItems); + } + + /** + * Entrega el valor de: financialItems + * + * @return List + */ + public List getFinancialItems() { + return this.financialItems; + } + + /** + * Fija el valor de: financialItems + * + * @param financialItems + */ + public void setFinancialItems(List financialItems) { + this.financialItems = financialItems; + } + + /** + * Entrega el valor de: depositCode + * + * @return String + */ + public String getDepositCode() { + return this.depositCode; + } + + /** + * Fija el valor de: depositCode + * + * @param depositCode + */ + public void setDepositCode(String depositCode) { + this.depositCode = depositCode; + } + + /** + * Entrega el valor de: changeDebitByCredit + * + * @return boolean + */ + public boolean isChangeDebitByCredit() { + return this.changeDebitByCredit; + } + + /** + * Fija el valor de changeDebitByCredit + * + * @param changeDebitByCredit value to set + */ + public void setChangeDebitByCredit(boolean changeDebitByCredit) { + this.changeDebitByCredit = changeDebitByCredit; + } + + /** + * Entrega el valor de: calculateprovision + * + * @return boolean + */ + public boolean isCalculateprovision() { + return this.calculateprovision; + } + + /** + * Fija el valor de: calculateprovision + * + * @param calculateprovision + */ + public void setCalculateprovision(boolean calculateprovision) { + this.calculateprovision = calculateprovision; + } + + /** + * Entrega el valor de: FinancialRequest.java + * + * @return String + */ + public String getIdentificationcatalog() { + return this.identificationcatalog; + } + + /** + * Fija el valor de: FinancialRequest.java + * + * @param identificationcatalog valor a almacenar en el objeto. + */ + public void setIdentificationcatalog(String identificationcatalog) { + this.identificationcatalog = identificationcatalog; + } + + /** + * Entrega el valor de: FinancialRequest.java + * + * @return String + */ + public String getIdentificationcatalogcode() { + return this.identificationcatalogcode; + } + + /** + * Fija el valor de: FinancialRequest.java + * + * @param identificationcatalogcode valor a almacenar en el objeto. + */ + public void setIdentificationcatalogcode(String identificationcatalogcode) { + this.identificationcatalogcode = identificationcatalogcode; + } + + /** + * Entrega el valor de: FinancialRequest.java + * + * @return Integer + */ + public Integer getBeneficiaryperson() { + return this.beneficiaryperson; + } + + /** + * Fija el valor de: FinancialRequest.java + * + * @param beneficiaryperson valor a almacenar en el objeto. + */ + public void setBeneficiaryperson(Integer beneficiaryperson) { + this.beneficiaryperson = beneficiaryperson; + } + + /** + * Entrega el valor de: FinancialRequest.java + * + * @return String + */ + public String getBeneficiaryname() { + return this.beneficiaryname; + } + + /** + * Fija el valor de: FinancialRequest.java + * + * @param beneficiaryname valor a almacenar en el objeto. + */ + public void setBeneficiaryname(String beneficiaryname) { + this.beneficiaryname = beneficiaryname; + } + + /** + * Entrega el valor de: FinancialRequest.java + * + * @return String + */ + public String getIdentification() { + return this.identification; + } + + /** + * Fija el valor de: FinancialRequest.java + * + * @param identification valor a almacenar en el objeto. + */ + public void setIdentification(String identification) { + this.identification = identification; + } + + /** + * Entrega el valor de: FinancialRequest.java + * + * @return Integer + */ + public Integer getMixnumber() { + return this.mixnumber; + } + + /** + * Fija el valor de: FinancialRequest.java + * + * @param mixnumber valor a almacenar en el objeto. + */ + public void setMixnumber(Integer mixnumber) { + this.mixnumber = mixnumber; + } + + /** + * Entrega el valor de: accrualdaily + * + * @return boolean + */ + public boolean isAccrualdaily() { + return this.accrualdaily; + } + + /** + * Fija el valor de: accrualdaily + * + * @param accrualdaily value to set + */ + public void setAccrualdaily(boolean accrualdaily) { + this.accrualdaily = accrualdaily; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/fin/Concept.java b/base/dto/dto/src/main/java/com/fp/dto/fin/Concept.java new file mode 100644 index 0000000..1fe61a1 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/fin/Concept.java @@ -0,0 +1,47 @@ +package com.fp.dto.fin; + +import java.io.Serializable; + +public class Concept implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + /**Codigo de concepto.*/ + private Integer code; + /**Descripcion del concepto.*/ + private String description; + /** + * Entrega el valor de: code + * @return Integer + */ + public Integer getCode() { + return code; + } + /** + * Fija el valor de: code + * @param code + */ + public void setCode(Integer code) { + this.code = code; + } + /** + * Entrega el valor de: description + * @return String + */ + public String getDescription() { + return description; + } + /** + * Fija el valor de: description + * @param description + */ + public void setDescription(String description) { + this.description = description; + } + + + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/fin/FinancialExchange.java b/base/dto/dto/src/main/java/com/fp/dto/fin/FinancialExchange.java new file mode 100644 index 0000000..ee835ab --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/fin/FinancialExchange.java @@ -0,0 +1,292 @@ +package com.fp.dto.fin; + +import java.math.BigDecimal; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.query.AdditionalQuery; + +/** + * Clase que se encarga de almacenar informacion necesaria para generar transacciones de compra venta de divisas. + * Adicionalmente sirve para ejecutar transacciones para la cuenta origen o destino por cada instancia de la clase + * ejemplo credito a cuentas por desembolso de prestamo, debito a cuentas para apertura de un plazo fijo.
+ * Para ejecuar el financiero se utiliza el evento y el lado a generar el financiero que puede ser origene, destino, + * ambos. + * @author Jorge Vaca + * @version 2.1 + * + */ +public class FinancialExchange extends AbstractDataTransport{ + + private static final long serialVersionUID = 1L; + /**Codigo de rubro, asociado al rubro de la transaccion. se utiliza en caja para hacer desglose + * de monedas ejempl deposito cuenta vista rubor efectivo.*/ + private Integer itemcode; + /**Codigo de la moneda origen, si es distinata a la moneda oficial se realiza la compra de divisas.*/ + private String origincurrency; + /**Monto en la moneda origen.*/ + private BigDecimal originamount; + /**Numero de cueta origen utilizada para ejecutar transacciones financieras.*/ + private String originaccount; + /**Codigo de compania a la que pertenece la cuenta origen*/ + private Integer origincompany; + /**Codigo de la moneda origen, si es distinata a la moneda oficial se realiza la compra de divisas.*/ + private String destinycurrency; + /**Monto en la moneda origen.*/ + private BigDecimal destinyamount; + /**Numero de cueta destino utilizada para ejecutar transacciones financieras.*/ + private String destinyaccount; + /**Codigo de compania a la que pertenece la cuenta destino*/ + private Integer destinycompany; + /**Codigo contable utilizado para ejecutar transacciones financieras.*/ + private String accountantcode; + /**Cotizacion de compra a aplicar en la transaccion de compra de divisas.*/ + private BigDecimal purchaserate; + /**Cotizacion de venta a aplicar en la transaccion de venta de divisas.*/ + private BigDecimal salerate; + /**Codigo de evento con el cual se ejecuta la transaccion financiera.*/ + private String event; + /**Codigo de subsistema asociado al evento con el cual se ejecuta la transaccion financiera.*/ + private String eventmodule; + /**"true" se calcula el monto origen, en este caso se conoce el monto destino, + * "false" se calcula el monto destino en este caso se conoce el monto origen..*/ + private boolean calculateOrigin; + /**"O" Indica que se graba el financiero con el origen de la transaccion, + * "D" Indica que se graba el financiero con el destino de la transaccion.*/ + private String financial; + + + @Override + public Object cloneMe() throws CloneNotSupportedException { + FinancialExchange p = (FinancialExchange) this.clone(); + return p; + } + + /** + * Entrega el valor de: itemcode + * @return Integer + */ + public Integer getItemcode() { + return itemcode; + } + /** + * Fija el valor de: itemcode + * @param itemcode + */ + public void setItemcode(Integer itemcode) { + this.itemcode = itemcode; + } + /** + * Entrega el valor de: origincurrency + * @return String + */ + public String getOrigincurrency() { + return origincurrency; + } + /** + * Fija el valor de: origincurrency + * @param origincurrency + */ + public void setOrigincurrency(String origincurrency) { + this.origincurrency = origincurrency; + } + /** + * Entrega el valor de: originamount + * @return BigDecimal + */ + public BigDecimal getOriginamount() { + return originamount; + } + /** + * Fija el valor de: originamount + * @param originamount + */ + public void setOriginamount(BigDecimal originamount) { + this.originamount = originamount; + } + /** + * Entrega el valor de: originaccount + * @return String + */ + public String getOriginaccount() { + return originaccount; + } + /** + * Fija el valor de: originaccount + * @param originaccount + */ + public void setOriginaccount(String originaccount) { + this.originaccount = originaccount; + } + /** + * Entrega el valor de: origincompany + * @return Integer + */ + public Integer getOrigincompany() { + return origincompany; + } + /** + * Fija el valor de: origincompany + * @param origincompany + */ + public void setOrigincompany(Integer origincompany) { + this.origincompany = origincompany; + } + /** + * Entrega el valor de: destinycurrency + * @return String + */ + public String getDestinycurrency() { + return destinycurrency; + } + /** + * Fija el valor de: destinycurrency + * @param destinycurrency + */ + public void setDestinycurrency(String destinycurrency) { + this.destinycurrency = destinycurrency; + } + /** + * Entrega el valor de: destinyamount + * @return BigDecimal + */ + public BigDecimal getDestinyamount() { + return destinyamount; + } + /** + * Fija el valor de: destinyamount + * @param destinyamount + */ + public void setDestinyamount(BigDecimal destinyamount) { + this.destinyamount = destinyamount; + } + /** + * Entrega el valor de: destinyaccount + * @return String + */ + public String getDestinyaccount() { + return destinyaccount; + } + /** + * Fija el valor de: destinyaccount + * @param destinyaccount + */ + public void setDestinyaccount(String destinyaccount) { + this.destinyaccount = destinyaccount; + } + /** + * Entrega el valor de: destinycompany + * @return Integer + */ + public Integer getDestinycompany() { + return destinycompany; + } + /** + * Fija el valor de: destinycompany + * @param destinycompany + */ + public void setDestinycompany(Integer destinycompany) { + this.destinycompany = destinycompany; + } + /** + * Entrega el valor de: accountantcode + * @return String + */ + public String getAccountantcode() { + return accountantcode; + } + /** + * Fija el valor de: accountantcode + * @param accountantcode + */ + public void setAccountantcode(String accountantcode) { + this.accountantcode = accountantcode; + } + /** + * Entrega el valor de: purchaserate + * @return BigDecimal + */ + public BigDecimal getPurchaserate() { + return purchaserate; + } + /** + * Fija el valor de: purchaserate + * @param purchaserate + */ + public void setPurchaserate(BigDecimal purchaserate) { + this.purchaserate = purchaserate; + } + /** + * Entrega el valor de: salerate + * @return BigDecimal + */ + public BigDecimal getSalerate() { + return salerate; + } + /** + * Fija el valor de: salerate + * @param salerate + */ + public void setSalerate(BigDecimal salerate) { + this.salerate = salerate; + } + /** + * Entrega el valor de: event + * @return String + */ + public String getEvent() { + return event; + } + /** + * Fija el valor de: event + * @param event + */ + public void setEvent(String event) { + this.event = event; + } + + /** + * Entrega el valor de: eventmodule + * @return String + */ + public String getEventmodule() { + return eventmodule; + } + /** + * Fija el valor de: eventmodule + * @param eventmodule + */ + public void setEventmodule(String eventmodule) { + this.eventmodule = eventmodule; + } + /** + * Entrega el valor de: calculateOrigin + * @return boolean + */ + public boolean isCalculateOrigin() { + return calculateOrigin; + } + /** + * Fija el valor de: calculateOrigin + * @param calculateOrigin + */ + public void setCalculateOrigin(boolean calculateOrigin) { + this.calculateOrigin = calculateOrigin; + } + /** + * Entrega el valor de: financial + * @return String + */ + public String getFinancial() { + return financial; + } + /** + * Fija el valor de: financial + * @param financial + */ + public void setFinancial(String financial) { + this.financial = financial; + } + + +} + diff --git a/base/dto/dto/src/main/java/com/fp/dto/fin/FinancialItem.java b/base/dto/dto/src/main/java/com/fp/dto/fin/FinancialItem.java new file mode 100644 index 0000000..42dcec9 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/fin/FinancialItem.java @@ -0,0 +1,612 @@ +package com.fp.dto.fin; + +import java.math.BigDecimal; +import java.sql.Date; + +import com.fp.dto.AbstractDataTransport; + +/** + * Clase utilizada en el procesos de transacciones financieras. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class FinancialItem extends AbstractDataTransport implements Cloneable { + + private static final long serialVersionUID = 1L; + + /** Codigo de rubro asociado a una transaccion monetaria. */ + private Integer itemCode; + + /** + * Numero de cuenta que se afecta con el rubro. Si el valor del atributo esta vacio se toma la cuenta que llega en + * el FinancialRequest, dependiendo de la definicion del rubro si es debito o credito. + */ + private String account; + + /** Codigo de compania a la que pertenece la cuenta. */ + private Integer companyAccount; + + /** + * Numero de cuota de una tabla de pagos que se afecta, utilizado en cuentas que manejan tablas de pagos ejemplo + * pago, prestamos. + */ + private Integer quotaNumber; + + /** + * Secuencia interna de la cuota de una tabla de pagos que se afecta, utilizado en cuentas que manejan tablas de + * pagos ejemplo pago, prestamos. + */ + private Integer quotaSequence; + + /** + * Codigo contable que se afecta con el movimiento, si llega un valor en este atributo se respeta es valor + * casocontrario el codigo contable lo obtiene la aplicacion. + */ + private String accountingCode; + + /** + * Sucursal destino del movimiento, si afecta a una cuenta producto se toma la sucursal de la cuenta. tambien se + * utiliza en el manejod e intersucursales. + */ + private Integer destinyBranch; + + /** + * Oficina destino del movimiento, si afecta a una cuenta producto se toma la sucursal de la cuenta. tambien se + * utiliza en el manejod e intersucursales. + */ + private Integer destinyOffice; + + /** + * Sucursal origen del movimiento, si afecta a una cuenta producto se toma la sucursal de la cuenta. tambien se + * utiliza en el manejod e intersucursales. + */ + private Integer originBranch; + + /** + * Oficina origen del movimiento, si afecta a una cuenta producto se toma la sucursal de la cuenta. tambien se + * utiliza en el manejod e intersucursales. + */ + private Integer originOffice; + + /** Monto de la transaccion */ + private BigDecimal amount; + + /** Codigo de moneda en la que esta expresado el valor del rubro. */ + private String currecy; + + /** + * Estatus de la cuenta con el que se afecta el moviento, si es una cuneta producto, si llega en blanco se toma de + * la cuenta producto + */ + private String accountStatus; + + /** + * Indica que con el mismo rubro de la transaccion se va a registrar varios asientos en el journal, ejemplo, + * registro de comprobantes contables, contabilizacion de cuotas de plazo fijo o prestamos. + */ + private boolean repeating = false; + + /** Tipo de sobregito , ejemplo CONTRACTED,OCASIONAL,INDIRECT, etc */ + private String overdrawCatalog; + + /** Codigo de tabla de tipo de sobregiro OVERDRAWTYPE. */ + private String overdrawCatalogCode; + + /** Codigo de tipo de credito que se afecta con la transaccion. */ + private String creditType; + + /** Codigo de estatus de la operacion que se afecta con la transaccion. */ + private String operationStatus; + + /** Fecha de inicio de la cuota o del sobregiro. */ + private Date beginingDate; + + /** Fecha de vencimiento de la cuota o del sobregiro. */ + private Date expirationDate; + + /** Indica si el tipo de saldo actualiza saldos. Ejm false, en contabilizacion de desembolso de un credito. */ + private boolean updateBalance = true; + + /** + * Cotizacion de compra o venta, con el cual se calcula el valor en moneda local para grabar en la tbala de journal. + */ + private BigDecimal exchangeQuote; + + /** Codigo de modulo utilizado en el registro contable de provisiones */ + private String accountmodule; + + /** Codigo de producto utilizado en el registro contable de provisiones */ + private String accountproduct; + + /** Codigo de subproducto utilizado en el registro contable de provisiones */ + private String accountsubproduct; + + /** + * Crea una instancia de FinancialItem, vacia. + */ + public FinancialItem() { + } + + /** + * Crea una instancia de FinancialItem. + * + * @param pItemCode Codigo de rubro con el cual se ejecuta la transaccion. + * @param pAmount Monto en el que se afecta el rubro. + * @param pCurrency Codigo de moneda en la que se expresa el monto del rubro. + * @throws Exception + */ + public FinancialItem(Integer pItemCode, BigDecimal pAmount, String pCurrency) throws Exception { + this.itemCode = pItemCode; + this.amount = pAmount; + this.currecy = pCurrency; + } + + /** + * Entrega una copia de la instancia de FinancialItem. + * + * @return FinancialItem + * @throws CloneNotSupportedException + */ + public FinancialItem cloneMe() throws CloneNotSupportedException { + return (FinancialItem) super.clone(); + } + + /** + * Entrega el valor de: itemCode + * + * @return Integer + */ + public Integer getItemCode() { + return this.itemCode; + } + + /** + * Fija el valor de itemCode + * + * @param code + */ + public void setItemCode(Integer itemCode) { + this.itemCode = itemCode; + } + + /** + * Entrega el valor de: account + * + * @return String + */ + public String getAccount() { + return this.account; + } + + /** + * Fija el valor de account + * + * @param account + */ + public void setAccount(String account) { + this.account = account; + } + + /** + * Entrega el valor de: companyAccount + * + * @return Integer + */ + public Integer getCompanyAccount() { + return this.companyAccount; + } + + /** + * Fija el valor de companyAccount + * + * @param companyAccount + */ + public void setCompanyAccount(Integer companyAccount) { + this.companyAccount = companyAccount; + } + + /** + * Entrega el valor de: quotaNumber + * + * @return Integer + */ + public Integer getQuotaNumber() { + return this.quotaNumber; + } + + /** + * Fija el valor de quotaNumber + * + * @param quotaNumber + */ + public void setQuotaNumber(Integer quotaNumber) { + this.quotaNumber = quotaNumber; + } + + /** + * Entrega el valor de: quotaSequence + * + * @return Integer + */ + public Integer getQuotaSequence() { + return this.quotaSequence; + } + + /** + * Fija el valor de quotaSequence + * + * @param quotaSequence value to set + */ + public void setQuotaSequence(Integer quotaSequence) { + this.quotaSequence = quotaSequence; + } + + /** + * Entrega el valor de: accountingCode + * + * @return String + */ + public String getAccountingCode() { + return this.accountingCode; + } + + /** + * Fija el valor de accountingCode + * + * @param accountingCode + */ + public void setAccountingCode(String accountingCode) { + this.accountingCode = accountingCode; + } + + /** + * Entrega el valor de: destinyBranch + * + * @return Integer + */ + public Integer getDestinyBranch() { + return this.destinyBranch; + } + + /** + * Fija el valor de destinyBranch + * + * @param destinyBranch + */ + public void setDestinyBranch(Integer destinyBranch) { + this.destinyBranch = destinyBranch; + } + + /** + * Entrega el valor de: destinyOffice + * + * @return Integer + */ + public Integer getDestinyOffice() { + return this.destinyOffice; + } + + /** + * Fija el valor de destinyOffice + * + * @param destinyOffice + */ + public void setDestinyOffice(Integer destinyOffice) { + this.destinyOffice = destinyOffice; + } + + /** + * Entrega el valor de: originBranch + * + * @return Integer + */ + public Integer getOriginBranch() { + return this.originBranch; + } + + /** + * Fija el valor de: originBranch + * + * @param originBranch value to set + */ + public void setOriginBranch(Integer originBranch) { + this.originBranch = originBranch; + } + + /** + * Entrega el valor de: originOffice + * + * @return Integer + */ + public Integer getOriginOffice() { + return this.originOffice; + } + + /** + * Fija el valor de: originOffice + * + * @param originOffice value to set + */ + public void setOriginOffice(Integer originOffice) { + this.originOffice = originOffice; + } + + /** + * Entrega el valor de: amount + * + * @return BigDecimal + */ + public BigDecimal getAmount() { + return this.amount; + } + + /** + * Fija el valor de amount + * + * @param amount + */ + public void setAmount(BigDecimal amount) { + this.amount = amount; + } + + /** + * Entrega el valor de: accountStatus + * + * @return String + */ + public String getAccountStatus() { + return this.accountStatus; + } + + /** + * Fija el valor de accountStatus + * + * @param accountStatus + */ + public void setAccountStatus(String accountStatus) { + this.accountStatus = accountStatus; + } + + /** + * Entrega el valor de: repeating + * + * @return boolean + */ + public boolean isRepeating() { + return this.repeating; + } + + /** + * Fija el valor de: repeating + * + * @param repeating + */ + public void setRepeating(boolean repeating) { + this.repeating = repeating; + } + + /** + * Entrega el valor de: currecy + * + * @return String + */ + public String getCurrecy() { + return this.currecy; + } + + /** + * Fija el valor de: currecy + * + * @param currecy + */ + public void setCurrecy(String currecy) { + this.currecy = currecy; + } + + @Override + public String toString() { + String data = "itemCode:" + this.itemCode + " currecy:" + this.currecy + " account:" + this.account + " cia:" + this.companyAccount + + " amount:" + this.amount + " qn: " + this.quotaNumber; + return data; + } + + /** + * Entrega el valor de: overdrawCatalog + * + * @return String + */ + public String getOverdrawCatalog() { + return this.overdrawCatalog; + } + + /** + * Fija el valor de overdrawCatalog + * + * @param overdrawCatalog value to set + */ + public void setOverdrawCatalog(String overdrawCatalog) { + this.overdrawCatalog = overdrawCatalog; + } + + /** + * Entrega el valor de: overdrawCatalogCode + * + * @return String + */ + public String getOverdrawCatalogCode() { + return this.overdrawCatalogCode; + } + + /** + * Fija el valor de overdrawCatalogCode + * + * @param overdrawCatalogCode value to set + */ + public void setOverdrawCatalogCode(String overdrawCatalogCode) { + this.overdrawCatalogCode = overdrawCatalogCode; + } + + /** + * Entrega el valor de: creditType + * + * @return String + */ + public String getCreditType() { + return this.creditType; + } + + /** + * Fija el valor de creditType + * + * @param creditType value to set + */ + public void setCreditType(String creditType) { + this.creditType = creditType; + } + + /** + * Entrega el valor de: operationStatus + * + * @return String + */ + public String getOperationStatus() { + return this.operationStatus; + } + + /** + * Fija el valor de: operationStatus + * + * @param operationStatus value to set + */ + public void setOperationStatus(String operationStatus) { + this.operationStatus = operationStatus; + } + + /** + * Entrega el valor de: beginingDate + * + * @return Date + */ + public Date getBeginingDate() { + return this.beginingDate; + } + + /** + * Fija el valor de beginingDate + * + * @param beginingDate value to set + */ + public void setBeginingDate(Date beginingDate) { + this.beginingDate = beginingDate; + } + + /** + * Entrega el valor de: expirationDate + * + * @return Date + */ + public Date getExpirationDate() { + return this.expirationDate; + } + + /** + * Fija el valor de expirationDate + * + * @param expirationDate value to set + */ + public void setExpirationDate(Date expirationDate) { + this.expirationDate = expirationDate; + } + + /** + * Entrega el valor de: updateBalance + * + * @return boolean + */ + public boolean isUpdateBalance() { + return this.updateBalance; + } + + /** + * Fija el valor de updateBalance + * + * @param updateBalance value to set + */ + public void setUpdateBalance(boolean updateBalance) { + this.updateBalance = updateBalance; + } + + /** + * Entrega el valor de: exchangeQuote + * + * @return BigDecimal + */ + public BigDecimal getExchangeQuote() { + return this.exchangeQuote; + } + + /** + * Fija el valor de: exchangeQuote + * + * @param exchangeQuote + */ + public void setExchangeQuote(BigDecimal exchangeQuote) { + this.exchangeQuote = exchangeQuote; + } + + /** + * Entrega el valor de: accountmodule + * + * @return String + */ + public String getAccountmodule() { + return this.accountmodule; + } + + /** + * Fija el valor de: accountmodule + * + * @param accountmodule value to set + */ + public void setAccountmodule(String accountmodule) { + this.accountmodule = accountmodule; + } + + /** + * Entrega el valor de: accountproduct + * + * @return String + */ + public String getAccountproduct() { + return this.accountproduct; + } + + /** + * Fija el valor de: accountproduct + * + * @param accountproduct value to set + */ + public void setAccountproduct(String accountproduct) { + this.accountproduct = accountproduct; + } + + /** + * Entrega el valor de: accountsubproduct + * + * @return String + */ + public String getAccountsubproduct() { + return this.accountsubproduct; + } + + /** + * Fija el valor de: accountsubproduct + * + * @param accountsubproduct value to set + */ + public void setAccountsubproduct(String accountsubproduct) { + this.accountsubproduct = accountsubproduct; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/fin/FinancialRequest.java b/base/dto/dto/src/main/java/com/fp/dto/fin/FinancialRequest.java new file mode 100644 index 0000000..b1007c7 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/fin/FinancialRequest.java @@ -0,0 +1,754 @@ +package com.fp.dto.fin; + +import java.sql.Date; +import java.util.ArrayList; +import java.util.List; + +import com.fp.dto.Request; + +/** + * Clase utilizada en el procesamiento de transacciones finacieras.
+ * Ejemplo: Depositos, Pago cheque, Desembolso creditos, Pago intereses certificados deposito. Etc.. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class FinancialRequest extends Request { + + public static String aux = "Hola mundo"; + + /* Version del objeto. */ + private static final long serialVersionUID = 1L; + + /** Identificador de la transaccion. */ + protected String oldjournalId; + + /** Modo en el que se ejecuta la transaccion N (Normal) I (Imperativo o Forzado) */ + private String transactionMode = "N"; + + /** Fecha contable del movimiento. */ + private Date accountingDate; + + /** Fecha de trabao del movimiento. */ + private Date workingdate; + + /** Fecha de proceso del movimiento, con esta fecha se lleva los saldos de cuentas producto. */ + private Date processDate; + + /** + * Fecha valor del movimiento, se utiliza en el calculo de ajuste de interese, los cuales se contabilizan con la + * fecha de hoy. + */ + private Date valueDate; + + /** True indica que se esta ejecutando un comprobante contable. */ + private boolean accountingVoucher = false; + + /** Numero de documento, papeleta o numero de cheque. */ + private String document; + + /** Numero de documento final, o numero de cheque final, se utiliza en la anulacion de un rango de cheques. */ + private String enddocument; + + /** Glosa de la transaccion,texto libre. */ + private String commentary; + + /** Codigo de area al que pertence el terminal. */ + private String area; + + /** Fecha de compenzacion del movimiento. */ + private Date settlement; + + /** Numero cuenta debito, en una transaccion monetaria. */ + private String debitAccount; + + /** + * Numero de cuota asociada a la cuenta debito, se utiliza si la transaccion afecta a una cuenta que afecta a una + * tabla de pagos. + */ + private Integer debitQuotaNumber; + + /** Numero de cuenta credito, en una transaccion monetaria. */ + private String creditAccount; + + /** + * Numero de cuota asociada a la cuenta credito, se utiliza si la transaccion afecta a una cuenta que afecta a una + * tabla de pagos. + */ + private Integer creditQuotaNumber; + + /** Indica que el request va a ejecutar un reverso de una transaccion. */ + private String reverse = "N"; + + /** Numero de mensaje a reversar. */ + private String journalIdReverse; + + /** Sucursal a la que cambiara la cuenta producto */ + private Integer newAccountBranch; + + /** Oficina a la que cambiara la cuenta producto */ + private Integer newAccountOffice; + + /** Sub Producto al cual cambiara la cuenta producto, no se permite cambios de producto de cuentas. */ + private String newSubProduct; + + /** Codigo de deposito utilizado en depositos codificados. */ + private String depositCode; + + /** Lista de rubros enviados desde un canal para ejecutar una transacion. */ + private List financialItems = new ArrayList(); + + /** + * Indica si se cambia el debito por credito, Ejemplo reverso contable del registro de una CXC en el cobro de la + * misma. + */ + private boolean changeDebitByCredit = false; + + /** Indica que al ejecutar una transaccion calcula provisiones o no. */ + private boolean calculateprovision = true; + + /** Codigo de tipos de identificacion */ + private String identificationcatalog; + + /** Codigo de catalogo de tipo de identificacion */ + private String identificationcatalogcode = "IDENTIFICATION"; + + /** Identificacion del cliente. */ + private String identification; + + /** Codigo de persona beneficiaria */ + private Integer beneficiaryperson; + + /** Nombre del beneficiario. */ + private String beneficiaryname; + + /** Numero de transaccion de caja multiple, asociado a la fecha de trabajo usuario. */ + private Integer mixnumber; + + /** Indica que la transaccion es de contabilizacion del accrual diario de intereses. */ + private boolean accrualdaily = false; + + /** + * Entrega una copia de la instancia de FinancialItem. + * + * @return FinancialItem + * @throws CloneNotSupportedException + */ + public FinancialRequest cloneMe() throws CloneNotSupportedException { + return (FinancialRequest) super.clone(); + } + + /** + * Entrega el valor de: oldjournalId + * + * @return String + */ + public String getOldjournalId() { + return this.oldjournalId; + } + + /** + * Fija el valor de: oldjournalId + * + * @param oldjournalId valor a almacenar en el objeto. + */ + public void setOldjournalId(String oldjournalId) { + this.oldjournalId = oldjournalId; + } + + /** + * Metodo que cambia el codigo de transaccion del FinancialRequest. + * + * @param pModule Codigo de modulo al que pertenece la nueva transaccion. + * @param pTransaction Codigo de la nueva transaccion. + * @param pVersion Version de la nueva transaccion. + * @throws Exception + */ + public void changeTransaction(String pModule, Integer pTransaction, Integer pVersion) throws Exception { + this.transactionModule = pModule; + this.transactionCode = pTransaction; + this.transactionVersion = pVersion; + } + + /** + * Encera financialItems de una transaccion. + */ + public void cleanItems() { + this.financialItems = new ArrayList(); + } + + /** + * Entrega el valor de: transactionMode + * + * @return String + */ + public String getTransactionMode() { + return this.transactionMode; + } + + /** + * Fija el valor de: transactionMode + * + * @param transactionMode + */ + public void setTransactionMode(String transactionMode) { + this.transactionMode = transactionMode; + } + + /** + * Entrega el valor de: accountingDate + * + * @return Date + */ + public Date getAccountingDate() { + return this.accountingDate; + } + + /** + * Fija el valor de: accountingDate + * + * @param accountingDate + */ + public void setAccountingDate(Date accountingDate) { + this.accountingDate = accountingDate; + } + + /** + * Entrega el valor de: workingdate + * + * @return Date + */ + public Date getWorkingdate() { + return this.workingdate; + } + + /** + * Fija el valor de workingDate + * + * @param workingdate value to set + */ + public void setWorkingdate(Date workingdate) { + this.workingdate = workingdate; + } + + /** + * Entrega el valor de: processDate + * + * @return Date + */ + public Date getProcessDate() { + return this.processDate; + } + + /** + * Fija el valor de: processDate + * + * @param processDate + */ + public void setProcessDate(Date processDate) { + this.processDate = processDate; + } + + /** + * Entrega el valor de: valueDate + * + * @return Date + */ + public Date getValueDate() { + return this.valueDate; + } + + /** + * Fija el valor de: valueDate + * + * @param valueDate + */ + public void setValueDate(Date valueDate) { + this.valueDate = valueDate; + } + + /** + * Entrega el valor de: accountingVoucher + * + * @return boolean + */ + public boolean isAccountingVoucher() { + return this.accountingVoucher; + } + + /** + * Fija el valor de: accountingVoucher + * + * @param accountingVoucher + */ + public void setAccountingVoucher(boolean accountingVoucher) { + this.accountingVoucher = accountingVoucher; + } + + /** + * Entrega el valor de: document + * + * @return String + */ + public String getDocument() { + return this.document; + } + + /** + * Fija el valor de: document + * + * @param document + */ + public void setDocument(String document) { + this.document = document; + } + + /** + * @return the enddocument + */ + public String getEnddocument() { + return this.enddocument; + } + + /** + * @param enddocument the enddocument to set + */ + public void setEnddocument(String enddocument) { + this.enddocument = enddocument; + } + + /** + * Entrega el valor de: commentary + * + * @return String + */ + public String getCommentary() { + return this.commentary; + } + + /** + * Fija el valor de: commentary + * + * @param commentary + */ + public void setCommentary(String commentary) { + this.commentary = commentary; + } + + /** + * Entrega el valor de: area + * + * @return String + */ + public String getArea() { + return this.area; + } + + /** + * Fija el valor de: area + * + * @param area + */ + public void setArea(String area) { + this.area = area; + } + + /** + * Entrega el valor de: settlement + * + * @return Date + */ + public Date getSettlement() { + return this.settlement; + } + + /** + * Fija el valor de: settlement + * + * @param settlement + */ + public void setSettlement(Date settlement) { + this.settlement = settlement; + } + + /** + * Entrega el valor de: debitAccount + * + * @return String + */ + public String getDebitAccount() { + return this.debitAccount; + } + + /** + * Fija el valor de: debitAccount + * + * @param debitAccount + */ + public void setDebitAccount(String debitAccount) { + this.debitAccount = debitAccount; + } + + /** + * Entrega el valor de: debitQuotaNumber + * + * @return Integer + */ + public Integer getDebitQuotaNumber() { + return this.debitQuotaNumber; + } + + /** + * Fija el valor de: debitQuotaNumber + * + * @param debitQuotaNumber + */ + public void setDebitQuotaNumber(Integer debitQuotaNumber) { + this.debitQuotaNumber = debitQuotaNumber; + } + + /** + * Entrega el valor de: creditAccount + * + * @return String + */ + public String getCreditAccount() { + return this.creditAccount; + } + + /** + * Fija el valor de: creditAccount + * + * @param creditAccount + */ + public void setCreditAccount(String creditAccount) { + this.creditAccount = creditAccount; + } + + /** + * Entrega el valor de: creditQuotaNumber + * + * @return Integer + */ + public Integer getCreditQuotaNumber() { + return this.creditQuotaNumber; + } + + /** + * Fija el valor de: creditQuotaNumber + * + * @param creditQuotaNumber + */ + public void setCreditQuotaNumber(Integer creditQuotaNumber) { + this.creditQuotaNumber = creditQuotaNumber; + } + + /** + * Entrega el valor de: reverse + * + * @return String + */ + public String getReverse() { + return this.reverse; + } + + /** + * Fija el valor de: reverse + * + * @param reverse + */ + public void setReverse(String reverse) { + this.reverse = reverse; + } + + /** + * Entrega el valor de: journalIdReverse + * + * @return String + */ + public String getJournalIdReverse() { + return this.journalIdReverse; + } + + /** + * Fija el valor de: journalIdReverse + * + * @param journalIdReverse + */ + public void setJournalIdReverse(String journalIdReverse) { + this.journalIdReverse = journalIdReverse; + } + + /** + * Entrega el valor de: newAccountBranch + * + * @return Integer + */ + public Integer getNewAccountBranch() { + return this.newAccountBranch; + } + + /** + * Fija el valor de: newAccountBranch + * + * @param newAccountBranch + */ + public void setNewAccountBranch(Integer newAccountBranch) { + this.newAccountBranch = newAccountBranch; + } + + /** + * Entrega el valor de: newAccountOffice + * + * @return Integer + */ + public Integer getNewAccountOffice() { + return this.newAccountOffice; + } + + /** + * Fija el valor de: newAccountOffice + * + * @param newAccountOffice + */ + public void setNewAccountOffice(Integer newAccountOffice) { + this.newAccountOffice = newAccountOffice; + } + + /** + * Entrega el valor de: newSubProduct + * + * @return String + */ + public String getNewSubProduct() { + return this.newSubProduct; + } + + /** + * Fija el valor de: newSubProduct + * + * @param newSubProduct + */ + public void setNewSubProduct(String newSubProduct) { + this.newSubProduct = newSubProduct; + } + + /** + * Adiciona un item a procesar en la transaccion. + * + * @param pFinancialItem Datos del FinancialItem. + * @throws Exception + */ + public void addFinancialItem(FinancialItem pFinancialItem) throws Exception { + this.financialItems.add(pFinancialItem); + } + + /** + * Adiciona una Lista de item a procesar en la transaccion. + * + * @param pFinancialItems Lista de items. + * @throws Exception + */ + public void addFinancialItems(List pFinancialItems) throws Exception { + this.financialItems.addAll(pFinancialItems); + } + + /** + * Entrega el valor de: financialItems + * + * @return List + */ + public List getFinancialItems() { + return this.financialItems; + } + + /** + * Fija el valor de: financialItems + * + * @param financialItems + */ + public void setFinancialItems(List financialItems) { + this.financialItems = financialItems; + } + + /** + * Entrega el valor de: depositCode + * + * @return String + */ + public String getDepositCode() { + return this.depositCode; + } + + /** + * Fija el valor de: depositCode + * + * @param depositCode + */ + public void setDepositCode(String depositCode) { + this.depositCode = depositCode; + } + + /** + * Entrega el valor de: changeDebitByCredit + * + * @return boolean + */ + public boolean isChangeDebitByCredit() { + return this.changeDebitByCredit; + } + + /** + * Fija el valor de changeDebitByCredit + * + * @param changeDebitByCredit value to set + */ + public void setChangeDebitByCredit(boolean changeDebitByCredit) { + this.changeDebitByCredit = changeDebitByCredit; + } + + /** + * Entrega el valor de: calculateprovision + * + * @return boolean + */ + public boolean isCalculateprovision() { + return this.calculateprovision; + } + + /** + * Fija el valor de: calculateprovision + * + * @param calculateprovision + */ + public void setCalculateprovision(boolean calculateprovision) { + this.calculateprovision = calculateprovision; + } + + /** + * Entrega el valor de: FinancialRequest.java + * + * @return String + */ + public String getIdentificationcatalog() { + return this.identificationcatalog; + } + + /** + * Fija el valor de: FinancialRequest.java + * + * @param identificationcatalog valor a almacenar en el objeto. + */ + public void setIdentificationcatalog(String identificationcatalog) { + this.identificationcatalog = identificationcatalog; + } + + /** + * Entrega el valor de: FinancialRequest.java + * + * @return String + */ + public String getIdentificationcatalogcode() { + return this.identificationcatalogcode; + } + + /** + * Fija el valor de: FinancialRequest.java + * + * @param identificationcatalogcode valor a almacenar en el objeto. + */ + public void setIdentificationcatalogcode(String identificationcatalogcode) { + this.identificationcatalogcode = identificationcatalogcode; + } + + /** + * Entrega el valor de: FinancialRequest.java + * + * @return Integer + */ + public Integer getBeneficiaryperson() { + return this.beneficiaryperson; + } + + /** + * Fija el valor de: FinancialRequest.java + * + * @param beneficiaryperson valor a almacenar en el objeto. + */ + public void setBeneficiaryperson(Integer beneficiaryperson) { + this.beneficiaryperson = beneficiaryperson; + } + + /** + * Entrega el valor de: FinancialRequest.java + * + * @return String + */ + public String getBeneficiaryname() { + return this.beneficiaryname; + } + + /** + * Fija el valor de: FinancialRequest.java + * + * @param beneficiaryname valor a almacenar en el objeto. + */ + public void setBeneficiaryname(String beneficiaryname) { + this.beneficiaryname = beneficiaryname; + } + + /** + * Entrega el valor de: FinancialRequest.java + * + * @return String + */ + public String getIdentification() { + return this.identification; + } + + /** + * Fija el valor de: FinancialRequest.java + * + * @param identification valor a almacenar en el objeto. + */ + public void setIdentification(String identification) { + this.identification = identification; + } + + /** + * Entrega el valor de: FinancialRequest.java + * + * @return Integer + */ + public Integer getMixnumber() { + return this.mixnumber; + } + + /** + * Fija el valor de: FinancialRequest.java + * + * @param mixnumber valor a almacenar en el objeto. + */ + public void setMixnumber(Integer mixnumber) { + this.mixnumber = mixnumber; + } + + /** + * Entrega el valor de: accrualdaily + * + * @return boolean + */ + public boolean isAccrualdaily() { + return this.accrualdaily; + } + + /** + * Fija el valor de: accrualdaily + * + * @param accrualdaily value to set + */ + public void setAccrualdaily(boolean accrualdaily) { + this.accrualdaily = accrualdaily; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/hb/.svn/entries b/base/dto/dto/src/main/java/com/fp/dto/hb/.svn/entries new file mode 100644 index 0000000..05bbdde --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/hb/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/java/com/fp/dto/hb +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +AbstractExpire.java +file + + + + +2022-07-28T03:40:33.074761Z +bc4d07783c2cf2faade501d56258363e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +383 + +History.java +file + + + + +2022-07-28T03:40:33.074761Z +1e71bb0485d8ae3256ac3b74c1b49f20 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +401 + +Log.java +file + + + + +2022-07-28T03:40:33.075761Z +b2746b8a31f04695cabdffee6501f404 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +107 + +Cache.java +file + + + + +2022-07-28T03:40:33.075761Z +2c0bd68b967cd0c7c5bd805699362f14 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +109 + +HibernateBean.java +file + + + + +2022-07-28T03:40:33.075761Z +29fa8a6586f92f6761ee791977e9fa5a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +276 + +HibernateId.java +file + + + + +2022-07-28T03:40:33.075761Z +adb96cf2d7a9bab496529c05c23c2faf +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +109 + diff --git a/base/dto/dto/src/main/java/com/fp/dto/hb/.svn/text-base/AbstractExpire.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/hb/.svn/text-base/AbstractExpire.java.svn-base new file mode 100644 index 0000000..6ad5ce4 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/hb/.svn/text-base/AbstractExpire.java.svn-base @@ -0,0 +1,19 @@ +package com.fp.dto.hb; + +import com.fp.dto.AbstractDataTransport; + +/** + * Interface que indica que una regiostro de una tabla maneja concepto datefrom dateto. + * @author Jorge Vaca + * @version 2.1 + */ +public abstract class AbstractExpire extends AbstractDataTransport implements Cloneable{ + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + + + +} \ No newline at end of file diff --git a/base/dto/dto/src/main/java/com/fp/dto/hb/.svn/text-base/Cache.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/hb/.svn/text-base/Cache.java.svn-base new file mode 100644 index 0000000..15baf9e --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/hb/.svn/text-base/Cache.java.svn-base @@ -0,0 +1,7 @@ +package com.fp.dto.hb; + +import java.io.Serializable; + +public interface Cache extends Serializable{ + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/hb/.svn/text-base/HibernateBean.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/hb/.svn/text-base/HibernateBean.java.svn-base new file mode 100644 index 0000000..b8410e4 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/hb/.svn/text-base/HibernateBean.java.svn-base @@ -0,0 +1,13 @@ +package com.fp.dto.hb; + +public interface HibernateBean { + public Object createInstance() throws Exception; + + /** + * Clona la instancia del Bean + * + * @return Instancia nueva + * @throws Exception + */ + Object cloneMe() throws Exception; +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/hb/.svn/text-base/HibernateId.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/hb/.svn/text-base/HibernateId.java.svn-base new file mode 100644 index 0000000..102fa12 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/hb/.svn/text-base/HibernateId.java.svn-base @@ -0,0 +1,7 @@ +package com.fp.dto.hb; + +import java.io.Serializable; + +public interface HibernateId extends Serializable{ + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/hb/.svn/text-base/History.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/hb/.svn/text-base/History.java.svn-base new file mode 100644 index 0000000..b8c89a0 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/hb/.svn/text-base/History.java.svn-base @@ -0,0 +1,16 @@ +package com.fp.dto.hb; + +import java.sql.Timestamp; + +/** + * Interface que indica que una regiostro de una tabla maneja concepto datefrom dateto. + * @author Jorge Vaca + * @version 2.1 + */ +public interface History { + + /**Fija el valor de caducidad del registro.*/ + public void setDateto(Timestamp pDateTo); + /**Entrega la fecha hasta la cual esta vigente un registro.*/ + public Timestamp getDateto(); +} \ No newline at end of file diff --git a/base/dto/dto/src/main/java/com/fp/dto/hb/.svn/text-base/Log.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/hb/.svn/text-base/Log.java.svn-base new file mode 100644 index 0000000..3d4c6db --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/hb/.svn/text-base/Log.java.svn-base @@ -0,0 +1,7 @@ +package com.fp.dto.hb; + +import java.io.Serializable; + +public interface Log extends Serializable{ + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/hb/AbstractExpire.java b/base/dto/dto/src/main/java/com/fp/dto/hb/AbstractExpire.java new file mode 100644 index 0000000..6ad5ce4 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/hb/AbstractExpire.java @@ -0,0 +1,19 @@ +package com.fp.dto.hb; + +import com.fp.dto.AbstractDataTransport; + +/** + * Interface que indica que una regiostro de una tabla maneja concepto datefrom dateto. + * @author Jorge Vaca + * @version 2.1 + */ +public abstract class AbstractExpire extends AbstractDataTransport implements Cloneable{ + /** + * Version de la clase. + */ + private static final long serialVersionUID = 1L; + + + + +} \ No newline at end of file diff --git a/base/dto/dto/src/main/java/com/fp/dto/hb/Cache.java b/base/dto/dto/src/main/java/com/fp/dto/hb/Cache.java new file mode 100644 index 0000000..15baf9e --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/hb/Cache.java @@ -0,0 +1,7 @@ +package com.fp.dto.hb; + +import java.io.Serializable; + +public interface Cache extends Serializable{ + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/hb/HibernateBean.java b/base/dto/dto/src/main/java/com/fp/dto/hb/HibernateBean.java new file mode 100644 index 0000000..b8410e4 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/hb/HibernateBean.java @@ -0,0 +1,13 @@ +package com.fp.dto.hb; + +public interface HibernateBean { + public Object createInstance() throws Exception; + + /** + * Clona la instancia del Bean + * + * @return Instancia nueva + * @throws Exception + */ + Object cloneMe() throws Exception; +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/hb/HibernateId.java b/base/dto/dto/src/main/java/com/fp/dto/hb/HibernateId.java new file mode 100644 index 0000000..102fa12 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/hb/HibernateId.java @@ -0,0 +1,7 @@ +package com.fp.dto.hb; + +import java.io.Serializable; + +public interface HibernateId extends Serializable{ + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/hb/History.java b/base/dto/dto/src/main/java/com/fp/dto/hb/History.java new file mode 100644 index 0000000..b8c89a0 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/hb/History.java @@ -0,0 +1,16 @@ +package com.fp.dto.hb; + +import java.sql.Timestamp; + +/** + * Interface que indica que una regiostro de una tabla maneja concepto datefrom dateto. + * @author Jorge Vaca + * @version 2.1 + */ +public interface History { + + /**Fija el valor de caducidad del registro.*/ + public void setDateto(Timestamp pDateTo); + /**Entrega la fecha hasta la cual esta vigente un registro.*/ + public Timestamp getDateto(); +} \ No newline at end of file diff --git a/base/dto/dto/src/main/java/com/fp/dto/hb/Log.java b/base/dto/dto/src/main/java/com/fp/dto/hb/Log.java new file mode 100644 index 0000000..3d4c6db --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/hb/Log.java @@ -0,0 +1,7 @@ +package com.fp.dto.hb; + +import java.io.Serializable; + +public interface Log extends Serializable{ + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/helper/.svn/entries b/base/dto/dto/src/main/java/com/fp/dto/helper/.svn/entries new file mode 100644 index 0000000..c8daec3 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/helper/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/java/com/fp/dto/helper +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +FileHelper.java +file + + + + +2022-07-28T03:40:33.006761Z +254d1fb2b524d7be3b2bcd68a0392697 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2372 + diff --git a/base/dto/dto/src/main/java/com/fp/dto/helper/.svn/text-base/FileHelper.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/helper/.svn/text-base/FileHelper.java.svn-base new file mode 100644 index 0000000..8925a7f --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/helper/.svn/text-base/FileHelper.java.svn-base @@ -0,0 +1,127 @@ +package com.fp.dto.helper; + +import java.io.Serializable; + +/** + * Clase que se encarga del manejo de archivo como imagenes + * + * @author scastillo + */ +public class FileHelper implements Serializable { + /* + * Variable que contiene la extencion del archivo + */ + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + private String extension; + + /* + * Variable que contiene el archivo como tal + */ + private byte[] image; + + /* + * Variable que contiene el nombre del archivo + */ + private String name; + + /* + * Variable que contiene el tama�o del archivo + */ + private Integer size; + + private String contentType; + + /** + * Entrega el valor de contentType + * + * @return Valor de contentType + */ + public String getContentType() { + return this.contentType; + } + + /** + * Fija un nuevo valor en contentType + * + * @param pContentType nuevo valor para contentType + */ + public void setContentType(String pContentType) { + this.contentType = pContentType; + } + + /** + * Metodo que devuelve la extencion del archivo + * + * @return + */ + public String getExtension() { + return this.extension; + } + + /** + * Metodo que asigna la extencion del archivo + * + * @param extension + */ + public void setExtension(String extension) { + this.extension = extension; + } + + /** + * Metodo que devuelve el archivo como tal + * + * @return + */ + public byte[] getImage() { + return this.image; + } + + /** + * Metodo que asigna un archivo + * + * @param image + */ + public void setImage(byte[] image) { + this.image = image; + } + + /** + * Metodo que devuelve el nombre del archivo + * + * @return + */ + public String getName() { + return this.name; + } + + /** + * Metodo que asigna el nombre del archivo + * + * @param name + */ + public void setName(String name) { + this.name = name; + } + + /** + * Metodo que devuelve el tamanio del archivo + * + * @return + */ + public Integer getSize() { + return this.size; + } + + /* + * Metodo que asigna el tamanio del archivo + */ + + public void setSize(Integer size) { + this.size = size; + } +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/helper/FileHelper.java b/base/dto/dto/src/main/java/com/fp/dto/helper/FileHelper.java new file mode 100644 index 0000000..8925a7f --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/helper/FileHelper.java @@ -0,0 +1,127 @@ +package com.fp.dto.helper; + +import java.io.Serializable; + +/** + * Clase que se encarga del manejo de archivo como imagenes + * + * @author scastillo + */ +public class FileHelper implements Serializable { + /* + * Variable que contiene la extencion del archivo + */ + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + private String extension; + + /* + * Variable que contiene el archivo como tal + */ + private byte[] image; + + /* + * Variable que contiene el nombre del archivo + */ + private String name; + + /* + * Variable que contiene el tama�o del archivo + */ + private Integer size; + + private String contentType; + + /** + * Entrega el valor de contentType + * + * @return Valor de contentType + */ + public String getContentType() { + return this.contentType; + } + + /** + * Fija un nuevo valor en contentType + * + * @param pContentType nuevo valor para contentType + */ + public void setContentType(String pContentType) { + this.contentType = pContentType; + } + + /** + * Metodo que devuelve la extencion del archivo + * + * @return + */ + public String getExtension() { + return this.extension; + } + + /** + * Metodo que asigna la extencion del archivo + * + * @param extension + */ + public void setExtension(String extension) { + this.extension = extension; + } + + /** + * Metodo que devuelve el archivo como tal + * + * @return + */ + public byte[] getImage() { + return this.image; + } + + /** + * Metodo que asigna un archivo + * + * @param image + */ + public void setImage(byte[] image) { + this.image = image; + } + + /** + * Metodo que devuelve el nombre del archivo + * + * @return + */ + public String getName() { + return this.name; + } + + /** + * Metodo que asigna el nombre del archivo + * + * @param name + */ + public void setName(String name) { + this.name = name; + } + + /** + * Metodo que devuelve el tamanio del archivo + * + * @return + */ + public Integer getSize() { + return this.size; + } + + /* + * Metodo que asigna el tamanio del archivo + */ + + public void setSize(Integer size) { + this.size = size; + } +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/query/.svn/entries b/base/dto/dto/src/main/java/com/fp/dto/query/.svn/entries new file mode 100644 index 0000000..980adab --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/query/.svn/entries @@ -0,0 +1,303 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/java/com/fp/dto/query +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +SubQuery.java +file + + + + +2022-07-28T03:40:33.305762Z +52339da9eed618634dca53f5c6208736 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2672 + +menu +dir + +Filter.java +file + + + + +2022-07-28T03:40:33.306762Z +c7f277312c802dab67ed78c1e00a4102 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3104 + +QueryCriteria.java +file + + + + +2022-07-28T03:40:33.306762Z +21455130daa6492bcd4f7ea467c139c7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5397 + +FilterTypes.java +file + + + + +2022-07-28T03:40:33.306762Z +d19678a70d4636dd8646fc4060fabae6 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +876 + +QueryBean.java +file + + + + +2022-07-28T03:40:33.306762Z +df506bca8e1c9cd4791176cc7e962830 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7241 + +DtoQuery.java +file + + + + +2022-07-28T03:40:33.307762Z +4fe74211ce650ab9a79259b0b6f4d6a6 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5499 + +AdditionalQuery.java +file + + + + +2022-07-28T03:40:33.307762Z +2a8f9f256d7ed672176446b98b16b489 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2286 + +QueryRequest.java +file + + + + +2022-07-28T03:40:33.307762Z +f716708cb681624321eaaa8bb30e6eb8 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1554 + diff --git a/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/AdditionalQuery.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/AdditionalQuery.java.svn-base new file mode 100644 index 0000000..545a27c --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/AdditionalQuery.java.svn-base @@ -0,0 +1,105 @@ +package com.fp.dto.query; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import com.fp.dto.AbstractDataTransport; + +/** + * Clase que almacena beans de con los cuales se realiza joins entre tablas en consultas. + * @author Jorge Vaca + * @version 2.1 + */ +public class AdditionalQuery extends AbstractDataTransport implements Cloneable{ + + private static final long serialVersionUID = 1L; + /** + * Nombre del bean. + */ + private String bean; + /** + * Nombre del campo a obtener + */ + private String field; + /** + * Alias del campo en el cual se va a devolver la respuesta + */ + private String alias; + /** + * Criterios a emplearse en el subquery + */ + private List> criteria = new ArrayList>(); + + public AdditionalQuery() { + } + + @Override + public Object cloneMe() throws CloneNotSupportedException { + AdditionalQuery p = (AdditionalQuery) this.clone(); + return p; + } + /** + * Metodo que obtiene el b ean del cual se va a realizar el subquery + * @return + */ + public String getBean() { + return bean; + } + + /** + * Metodo que asigna el bean para el subquery + * @param bean + */ + public void setBean(String bean) { + this.bean = bean; + } + + /** + * Metodo que devuelve el alias + * @return + */ + public String getAlias() { + return alias; + } + + /** + * Metodo que asigna el alias + * @param alias + */ + public void setAlias(String alias) { + this.alias = alias; + } + + /** + * Metodo que obtiene el campo a obtener de la consulta + * @return + */ + public String getField() { + return field; + } + + /** + * Metodo que asigna el campo para la consulta + * @param field + */ + public void setField(String field) { + this.field = field; + } + + /** + * Metodo que devuelve los criterios para el subquery + * @return + */ + public List> getCriteria() { + return criteria; + } + + /** + * Metodo que asigna los criterios para el subquery + * @param criteria + */ + public void setCriteria(List> criteria) { + this.criteria = criteria; + } +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/DtoQuery.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/DtoQuery.java.svn-base new file mode 100644 index 0000000..ac74e14 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/DtoQuery.java.svn-base @@ -0,0 +1,212 @@ +package com.fp.dto.query; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * Dto de transporte utilizado en la ejecucin de consultas invocadas desde el front end, contiene metadata necesaria + * para armar y ejecutar consultas en la base de datos. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class DtoQuery implements Serializable { + + private static final long serialVersionUID = 6080115615379062328L; + + /** + * Nombre del bean, con el cual se va a ejecutar la consulta. + */ + private String beanname; + + /** + * Numero de pagina se utiliza para consultar mas de un registro. + */ + private Integer page = 0; + + /** + * Numero de registros por pagina. + */ + private Integer recperpage = 0; + + /** + * True indica que la consulta espera de respuesrta de 0..n registros. + */ + private boolean multirecord = false; + + /** + * String que contiene la lista de campos por el cual se va a ordenar la consula.
+ * ejemplo
+ * pk.pais ordenado por pais
+ * pk.pais,pk.provincia,nombre ordenado por 3 campo
+ * nombre desc orden descendente por nombre
+ */ + private String orderby; + + /** + * Lista de filtros con los cuales se arma la sentencia de la consulta. + */ + private final List lfiltros = new ArrayList(); + + private final List lSubquery = new ArrayList(); + + /** + * Crea una instancia de {@link DtoConsulta}. + * + * @param beanname Nombre del bean a consultar. + * @param mcriterios Map de filtros tipo camo-valor. + * @throws Exception + */ + public DtoQuery(String beanname, Map mcriterios) throws Exception { + this.beanname = beanname; + addCriterios(mcriterios); + } + + /** + * Crea una instancia de {@link DtoConsulta}. + * + * @param beanname Nombre del bean a consultar. + * @param mcriterios Map de filtros tipo camo-valor. + * @throws Exception + */ + public DtoQuery(String beanname, Integer page, Integer recperpage, boolean multirecord, Map mcriterios) throws Exception { + this.beanname = beanname; + this.page = page; + this.recperpage = recperpage; + this.multirecord = multirecord; + addCriterios(mcriterios); + } + + /** + * Adiciona criterios a la consulta dado map, campo-valor. + * + * @param mcriterios Map que contiene filtros, campo - valor, al inicio del campo puede estar incluido el criterio. + * @throws Exception + */ + public void addCriterios(Map mcriterios) throws Exception { + if (mcriterios == null) { + return; + } + Set s = mcriterios.keySet(); + for (String campo : s) { + if (mcriterios.get(campo) != "" && mcriterios.get(campo) != null) { + Filter f = new Filter(campo, mcriterios.get(campo)); + lfiltros.add(f); + } + } + } + + /** + * Adiciona un filtro a la consulta. + * + * @param filtro Objeto que contiene los datos del filtro a utilizar en la consulta. + * @throws Exception + */ + public void addFiltro(Filter filtro) throws Exception { + lfiltros.add(filtro); + } + + /** + * Adiciona un subquery a la consulta. + * + * @param subquery Objeto que contiene los datos de subquery a utilizar en la consulta. + * @throws Exception + */ + public void addSubQuery(SubQuery subquery) throws Exception { + lSubquery.add(subquery); + } + + /** + * Entrega el valor de: beanname + * + * @return String + */ + public String getBeanname() { + return beanname; + } + + /** + * Fija el valor de: beanname + * + * @param Valor a fijar en el atributo. + */ + public void setBeanname(String beanname) { + this.beanname = beanname; + } + + /** + * Entrega el valor de: orderby + * + * @return String + */ + public String getOrderby() { + return orderby; + } + + /** + * Fija el valor de: orderby + * + * @param Valor a fijar en el atributo. + */ + public void setOrderby(String orderby) { + this.orderby = orderby; + } + + /** + * Entrega el valor de: page + * + * @return Integer + */ + public Integer getPage() { + return page; + } + + /** + * Entrega el valor de: multirecord + * + * @return boolean + */ + public boolean isMultirecord() { + return multirecord; + } + + /** + * Fija el valor de: multirecord + * + * @param Valor a fijar en el atributo. + */ + public void setMultirecord(boolean multirecord) { + this.multirecord = multirecord; + } + + /** + * Entrega el valor de: recperpage + * + * @return Integer + */ + public Integer getRecperpage() { + return recperpage; + } + + /** + * Entrega el valor de: lfiltros + * + * @return List + */ + public List getLfilter() { + return lfiltros; + } + + /** + * Entrega el valor de: lSubquery + * + * @return List + */ + public List getlSubquery() { + return lSubquery; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/Filter.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/Filter.java.svn-base new file mode 100644 index 0000000..0bafd83 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/Filter.java.svn-base @@ -0,0 +1,142 @@ +package com.fp.dto.query; + +import java.io.Serializable; + +/** + * Objeto que contiene filtros asociados a una tabla. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class Filter implements Serializable { + + private static final long serialVersionUID = -459214658769947266L; + /** + * Nombre del campo perteneciente a la tabla o bean. + */ + private String field; + /** + * Condicion a aplicar, si es null y el tipo de dato es String se toma like. + */ + private String condition; + /** + * Valor de la condicion, si es diferente de null se considera en la sentencia. + */ + private String value; + /** + * Valor de una condicion incluye campo y valor ejemplo: t.modulecode = 12 or t.modulecode is null + * Este valor es prioritario, si existe se adiciona al where. + */ + private String sql; + + /** + * Crea una instancia de FIlter. + */ + public Filter() { + } + + /** + * Crea una instancia de Filtro, Evalua la condicion del filtro que puede llegar en el nombre del campo ejemplo >=pk.cuidad. + * @param campo Nombre de un campo pertenceciente a un entity bean. + * @param valor Valor del criterio. + * @throws Exception + */ + public Filter(String field, String value) throws Exception { + this.field = field; + this.value = value; + if(value.length() > 1){ + evaluadoscriterio(value.substring(0, 2)); + } + if (condition == null && value.length() > 0) { + evaluadoscriterio(value.substring(0, 1)); + } + } + + /** + * Crea una instancia de Filtro. + * @param campo Nombre de un campo pertenceciente a un entity bean. + * @param valor Valor del criterio. + * @throws Exception + */ + public Filter(String field, String condition, String value) { + this.field = field; + this.condition = condition; + this.value = value; + } + + private void evaluadoscriterio(String cond) throws Exception { + if (FilterTypes.getFilterTypes(cond) != null) { + condition = cond; + value = value.substring(cond.length(), value.length()); + } + } + + /** + * Entrega el valor de: field + * @return String + */ + public String getField() { + return field; + } + + /** + * Fija el valor de: field + * @param Valor a fijar en el atributo. + */ + public void setField(String field) { + this.field = field; + } + + /** + * Entrega el valor de: condition + * @return String + */ + public String getCondition() { + return condition; + } + + /** + * Fija el valor de: condition + * @param Valor a fijar en el atributo. + */ + public void setCondition(String condition) { + this.condition = condition; + } + + /** + * Entrega el valor de: value + * @return String + */ + public String getValue() { + return value; + } + + /** + * Fija el valor de: value + * @param Valor a fijar en el atributo. + */ + public void setValue(String value) { + this.value = value; + } + + /** + * Entrega el valor de: sql + * @return String + */ + public String getSql() { + return sql; + } + + /** + * Fija el valor de: sql + * @param sql Valor a fijar en el atributo. + */ + + public void setSql(String sql) { + this.sql = sql; + } + + + +} + diff --git a/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/FilterTypes.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/FilterTypes.java.svn-base new file mode 100644 index 0000000..aa43581 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/FilterTypes.java.svn-base @@ -0,0 +1,36 @@ +package com.fp.dto.query; + +public enum FilterTypes { + + EQUAL("="), DIFFERENT("!="), MAYOR(">"), GREATERTHAN("<"), LESSOREQUAL(">="), GREATOREQUAL("<="); + + /** + * Codigo de criterio. + */ + private String criteriacondition; + + /** + * Crea una instancia de FilterTypes. + * @param criteriacondition Codigo de criterio. + */ + private FilterTypes(String criteriacondition) { + this.criteriacondition = criteriacondition; + } + + /** + * Entraga un objeto FilterTypes dado una condicion. + * @param criterio Codigo de criterio. + * @return FilterTypes + * @throws Exception + */ + public static FilterTypes getFilterTypes(String criteriacondition) throws Exception { + FilterTypes em = null; + for (FilterTypes obj : FilterTypes.values()) { + if (obj.criteriacondition.compareTo(criteriacondition) == 0) { + em = obj; + } + } + return em; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/QueryBean.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/QueryBean.java.svn-base new file mode 100644 index 0000000..a804f75 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/QueryBean.java.svn-base @@ -0,0 +1,281 @@ +package com.fp.dto.query; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.common.helper.BeanManager; +import com.fp.dto.AbstractData; + +/** + * @author Jorge Vaca + * @version 2.1 + */ +/** + * @author jorge + * + */ +public class QueryBean extends AbstractData { + + /** Version de la clase */ + private static final long serialVersionUID = 1L; + + /** Paquete clase asociado al bena. */ + private String beanName; + + /** Numero de registros a consultar por pagina, se utiliaz en la paginacion en una pantalla */ + private int pageSize = 10; + + /** Numero de pagina en que se encuentra la consulta */ + private int page = 1; + + /** true, indica que la consulta entrega mas de un registro. */ + private boolean multirecord = true; + + /** Codigo de query alias, se utiliza para ejecutar consultas por codigo de consulta. */ + private String queryalias; + + /** Tipo de consulta, T transacion, P codigo de consulta */ + private String querytype; + + /** Lista de criterios asociados a al querybean */ + private List criteria = new ArrayList(); + + /** Lista de query adicionales, utilizados para entregar informacion adicional asociada al bean principal */ + private List additionalQuery = new ArrayList(); + + /** + * Entrega el valor de: beanName + * + * @return String + */ + public String getBeanName() { + return this.beanName; + } + + /** + * Fija el valor de: beanName + * + * @param beanName + */ + public void setBeanName(String beanName) { + this.beanName = beanName; + } + + public List getAdditionalQuery() { + return this.additionalQuery; + } + + public void setAdditionalQuery(List additionalQuery) { + this.additionalQuery = additionalQuery; + } + + /** + * Entrega el valor de: criteria + * + * @return List + */ + public List getCriteria() { + return this.criteria; + } + + /** + * Fija el valor de: criteria + * + * @param criteria + */ + public void setCriteria(List criteria) { + this.criteria = criteria; + } + + public QueryBean(String beanName) { + this.beanName = beanName; + } + + public QueryBean() { + } + + /** + * Entrega el valor de: pageSize + * + * @return int + */ + public int getPageSize() { + return this.pageSize; + } + + /** + * Fija el valor de: pageSize + * + * @param pageSize + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + /** + * Entrega el valor de: page + * + * @return int + */ + public int getPage() { + return this.page; + } + + /** + * Fija el valor de: page + * + * @param page + */ + public void setPage(int page) { + this.page = page; + } + + /** + * Entrega el valor de un criterio. + * + * @param pProperty Nombre del parametro de criterio. + * @return Object + * @throws Exception + */ + public Object getCriteriaValue(String pProperty) throws Exception { + Object value = null; + QueryCriteria obj = null; + for (QueryCriteria queryCriteria : this.criteria) { + if (queryCriteria.getProperty().compareTo(pProperty) == 0) { + obj = queryCriteria; + } + } + if (obj != null) { + value = obj.getValue(); + } + return value; + } + + /** + * Entrega el valor de un criterio. + * + * @param pProperty Nombre del parametro de criterio. + * @return Object + * @throws Exception + */ + public boolean isNotin(String pProperty) throws Exception { + boolean exists = false; + String aux = "not in"; + QueryCriteria obj = null; + for (QueryCriteria queryCriteria : this.criteria) { + if (queryCriteria.getProperty().compareTo(pProperty) == 0) { + obj = queryCriteria; + } + } + if (obj != null) { + exists = obj.getOperation().toLowerCase().compareTo(aux) == 0; + } + return exists; + } + + /** + * Metodo que fija un valor de un criterio. + * + * @param pProperty Nombre del criterio. + * @param pValue Valor a almacenar en el criterio. + * @throws Exception + */ + public void setCriteriaValue(String pProperty, Object pValue) throws Exception { + for (QueryCriteria obj : this.criteria) { + if (obj.getProperty().compareTo(pProperty) == 0) { + BeanManager.setBeanAttributeValue(obj, "value", pValue); + } + } + } + + /** + * Metodo que entrega una lista de criterios ordenada. + * + * @param pAsc true entrega una lista de criterios ordenada ascendentemente, false entrega una lista de criterios + * ordenada descendentemente. + * @return List + */ + public List getOrder(boolean pAsc) { + List order = new ArrayList(); + Map aux = new HashMap(); + List key = new ArrayList(); + for (QueryCriteria queryCriteria : this.criteria) { + if (pAsc) { + if (queryCriteria.getOrder() > 0) { + if (key.contains(Math.abs(queryCriteria.getOrder()))) { + continue; + } + key.add(Math.abs(queryCriteria.getOrder())); + aux.put(Math.abs(queryCriteria.getOrder()), queryCriteria); + } + } else { + if (queryCriteria.getOrder() < 0) { + if (key.contains(Math.abs(queryCriteria.getOrder()))) { + continue; + } + key.add(Math.abs(queryCriteria.getOrder())); + aux.put(Math.abs(queryCriteria.getOrder()), queryCriteria); + } + } + } + Collections.sort(key); + for (Integer k : key) { + order.add(aux.get(k)); + } + return order; + } + + /** + * Entrega el valor de: multirecord + * + * @return boolean + */ + public boolean isMultirecord() { + return this.multirecord; + } + + /** + * Fija el valor de: multirecord + * + * @param multirecord + */ + public void setMultirecord(boolean multirecord) { + this.multirecord = multirecord; + } + + /** + * Entrega el valor de: queryalias + * + * @return String + */ + public String getQueryalias() { + return this.queryalias; + } + + /** + * Fija el valor de: queryalias + * + * @param queryalias + */ + public void setQueryalias(String queryalias) { + this.queryalias = queryalias; + } + + /** + * @return the querytype + */ + public String getQuerytype() { + return this.querytype; + } + + /** + * @param querytype the querytype to set + */ + public void setQuerytype(String querytype) { + this.querytype = querytype; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/QueryCriteria.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/QueryCriteria.java.svn-base new file mode 100644 index 0000000..1b71f12 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/QueryCriteria.java.svn-base @@ -0,0 +1,197 @@ +package com.fp.dto.query; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.data.SaveData; + +/** + * Clase de transporte, que se asocia a un querybena con las restricciones a aplicar + * en una sentencia SQL. + * @author Jorge Vaca + * @version 2.1 + */ +public class QueryCriteria extends AbstractDataTransport{ + /**Version de la clase.*/ + private static final long serialVersionUID = 1L; + /**Nombrte del campo de la tabla*/ + private String property; + /**Criterio de la restriccion, =, != , like, >= etc.*/ + private String operation; + /**Valor de la restriccion.*/ + private Object value; + /**Indice del orden en las sentencias.*/ + private int order=0; + + @Override + public Object cloneMe() throws CloneNotSupportedException { + QueryCriteria p = (QueryCriteria) this.clone(); + return p; + } + /** + * Entrega el valor de: property + * @return String + */ + public String getProperty() { + return property; + } + /** + * Fija el valor de: property + * @param property + */ + public void setProperty(String property) { + this.property = property; + if(this.value != null){ + this.setLogData(property, value); + } + } + /** + * Entrega el valor de: operation + * @return String + */ + public String getOperation() { + return operation; + } + /** + * Fija el valor de: operation + * @param operation + */ + public void setOperation(String operation) { + this.operation = operation; + } + /** + * Entrega el valor de: value + * @return Object + */ + public Object getValue() { + if(value instanceof Integer){ + return Long.parseLong(value.toString()); + } + return value; + } + + /** + * Fija el valor de: value + * @param value + */ + public void setValue(Object value) { + this.value = value; + if(this.property != null){ + this.setLogData(property, value); + } + } + /** + * Entrega el valor de: order + * @return int + */ + public int getOrder() { + return order; + } + /** + * Fija el valor de: order + * @param order + */ + public void setOrder(int order) { + this.order = order; + } + public QueryCriteria(){ + + } + + /** + * Crea una instancia de QueryCriteria. + * @param property Nombre del campo a aplicar la restriccion. + * @param operation Condicion =, != , >, >= etc + * @param value Valor de la restriccion. + */ + public QueryCriteria(String property, String operation, Object value) { + this(property,operation,value,0); + } + + /** + * Crea una instancia de QueryCriteria, la condicion de la restriccion es like. + * @param property Nombre del campo a aplicar la restriccion. + * @param value Valor de la restriccion. + */ + public QueryCriteria(String property, Object value) { + this(property,"like",value,0); + } + + /** + * Crea una instancia de QueryCriteria + * @param property Nombre del campo. + * @param operation Condicion =, != , >, >= etc + * @param value Valor de la restriccion. + * @param order Orden de presentacion en la consulta. + */ + public QueryCriteria(String property, String operation, Object value, int order) { + this.property = property; + this.operation = operation; + this.value = value; + this.order = order; + this.setLogData(property, value); + } + + private void setLogData(String property,Object value) { + try { + this.setPersoncode(property, value); + this.setAccount(property, value); + this.setSolicitudenumber(property, value); + } catch (Exception e) { + //no hacer nada + } + } + + /** + * Verifica que el nombre del campo sea PERSONCODE, y almacena en los datos de parametros del log el valor del campo. + * @param property Nombre del campo a verificar. + * @param value Valor del campo. + * @throws Exception + */ + private void setPersoncode(String property,Object value) throws Exception { + String field = "PERSONCODE"; + if (!property.toUpperCase().contains(field) ){ + return; + } + this.setData(property, field, value); + } + + /** + * Verifica que el nombre del campo sea PERSONCODE, y almacena en los datos de parametros del log el valor del campo. + * @param property Nombre del campo a verificar. + * @param value Valor del campo. + * @throws Exception + */ + private void setAccount(String property,Object value) throws Exception { + String field = "ACCOUNT"; + if (!property.toUpperCase().contains(field) ){ + return; + } + this.setData(property, field, value); + } + + /** + * Verifica que el nombre del campo sea PERSONCODE, y almacena en los datos de parametros del log el valor del campo. + * @param property Nombre del campo a verificar. + * @param value Valor del campo. + * @throws Exception + */ + private void setSolicitudenumber(String property,Object value) throws Exception { + String field = "SOLICITUDNUMBER"; + if (!property.toUpperCase().contains(field) ){ + return; + } + this.setData(property, field, value); + } + + private void setData(String property,String field,Object value) throws Exception { + if( SaveData.getMap().get(field) != null) { + return; + } + if (property.indexOf('.') > 0) { + property = property.substring(property.indexOf('.')+1); + } + if(property.toUpperCase().compareTo(field) == 0){ + SaveData.getMap().put(field, value); + } + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/QueryRequest.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/QueryRequest.java.svn-base new file mode 100644 index 0000000..08e1f20 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/QueryRequest.java.svn-base @@ -0,0 +1,85 @@ +package com.fp.dto.query; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import com.fp.dto.Request; + +/** + * + * @author Jorge Vaca + * @version 2.1 + */ +public class QueryRequest extends Request { + + private static final long serialVersionUID = 1L; + + /** + * indica si la consulta se origina en una pagina jsf. + */ + private boolean jsf = false; + + /* (non-Javadoc) + * @see java.util.HashMap#get(java.lang.Object) + */ + @Override + public Object get(Object key) { + return super.get(key); + } + + /* (non-Javadoc) + * @see java.util.HashMap#put(java.lang.Object, java.lang.Object) + */ + @Override + public Object put(String key, Object value) { + if(key.compareTo("beans")==0){ + return value; + } + return super.put(key, value); + } + + /** + * Entrega un map con los objetos de tipo QueryBean. + * @return Map + */ + public Map getBeans() { + Map beans=new HashMap(); + Set keys=super.keySet(); + for(String key:keys){ + Object obj=super.get(key); + if(obj instanceof QueryBean){ + beans.put(key, (QueryBean)obj); + } + } + return beans; + } + + @Override + public Set> entrySet() { + super.entrySet(); + super.remove("beans"); + return super.entrySetDefault(); + } + + /** + * Entrega el valor de: jsf + * @return boolean + */ + public boolean isJsf() { + return jsf; + } + + /** + * Fija el valor de: jsf + * @param Valor a fijar en el atributo. + */ + public void setJsf(boolean jsf) { + this.jsf = jsf; + } + + + + + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/SubQuery.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/SubQuery.java.svn-base new file mode 100644 index 0000000..7fa2340 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/query/.svn/text-base/SubQuery.java.svn-base @@ -0,0 +1,122 @@ +package com.fp.dto.query; + +import java.io.Serializable; + +/** + * Objeto que contiene la definicion de un subquery asociado a un bean. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class SubQuery implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * Nombre del bean, asociado a una tabla a utilziar en el subquery. + */ + private String beanname; + /** + * Campo a consultar en el subquery. + */ + private String field; + /** + * Nombre con el cual se entrega la respuesta, si el alias es null toma el valor de campo. + */ + private String alias; + /** + * Where con el cual se ejecuta el subquery.
+ * Ejemplo considera i.pk.pais = t.pk.pais and i.provincia = t.provincia.
+ * siempre va (i) para el bean del subquery y (t) para la tabla externa. + */ + private String where; + + /** + * Crea una instancia de SubQuery. + * @param beanname Nombre del bean con el que se realiza el subquery. + * @param campo Nombre de campo a consultar. + * @param alias Alias con el cual se entrega la respuesta. + * @param filtro Filtro a utilziar en el subquery. + * @throws Exception + */ + public SubQuery(String beanname, String field, String alias, String joinFields) throws Exception { + this.beanname = beanname; + this.field = field; + this.alias = alias; + if (this.alias == null) { + this.alias = this.field; + } + where = " where " + joinFields; + } + + public String getSubQuery() throws Exception { + return "(select i." + field + " from " + beanname + " i " + where + ")"; + } + + /** + * Entrega el valor de: beanname + * @return String + */ + public String getBeanname() { + return beanname; + } + + /** + * Fija el valor de: beanname + * @param Valor a fijar en el atributo. + */ + public void setBeanname(String beanname) { + this.beanname = beanname; + } + + /** + * Entrega el valor de: field + * @return String + */ + public String getField() { + return field; + } + + /** + * Fija el valor de: field + * @param Valor a fijar en el atributo. + */ + public void setField(String field) { + this.field = field; + } + + /** + * Entrega el valor de: alias + * @return String + */ + public String getAlias() { + return alias; + } + + /** + * Fija el valor de: alias + * @param Valor a fijar en el atributo. + */ + public void setAlias(String alias) { + this.alias = alias; + } + + /** + * Entrega el valor de: where + * @return String + */ + public String getWhere() { + return where; + } + + /** + * Fija el valor de: where + * @param Valor a fijar en el atributo. + */ + public void setWhere(String where) { + this.where = where; + } + + + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/query/AdditionalQuery.java b/base/dto/dto/src/main/java/com/fp/dto/query/AdditionalQuery.java new file mode 100644 index 0000000..545a27c --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/query/AdditionalQuery.java @@ -0,0 +1,105 @@ +package com.fp.dto.query; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import com.fp.dto.AbstractDataTransport; + +/** + * Clase que almacena beans de con los cuales se realiza joins entre tablas en consultas. + * @author Jorge Vaca + * @version 2.1 + */ +public class AdditionalQuery extends AbstractDataTransport implements Cloneable{ + + private static final long serialVersionUID = 1L; + /** + * Nombre del bean. + */ + private String bean; + /** + * Nombre del campo a obtener + */ + private String field; + /** + * Alias del campo en el cual se va a devolver la respuesta + */ + private String alias; + /** + * Criterios a emplearse en el subquery + */ + private List> criteria = new ArrayList>(); + + public AdditionalQuery() { + } + + @Override + public Object cloneMe() throws CloneNotSupportedException { + AdditionalQuery p = (AdditionalQuery) this.clone(); + return p; + } + /** + * Metodo que obtiene el b ean del cual se va a realizar el subquery + * @return + */ + public String getBean() { + return bean; + } + + /** + * Metodo que asigna el bean para el subquery + * @param bean + */ + public void setBean(String bean) { + this.bean = bean; + } + + /** + * Metodo que devuelve el alias + * @return + */ + public String getAlias() { + return alias; + } + + /** + * Metodo que asigna el alias + * @param alias + */ + public void setAlias(String alias) { + this.alias = alias; + } + + /** + * Metodo que obtiene el campo a obtener de la consulta + * @return + */ + public String getField() { + return field; + } + + /** + * Metodo que asigna el campo para la consulta + * @param field + */ + public void setField(String field) { + this.field = field; + } + + /** + * Metodo que devuelve los criterios para el subquery + * @return + */ + public List> getCriteria() { + return criteria; + } + + /** + * Metodo que asigna los criterios para el subquery + * @param criteria + */ + public void setCriteria(List> criteria) { + this.criteria = criteria; + } +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/query/DtoQuery.java b/base/dto/dto/src/main/java/com/fp/dto/query/DtoQuery.java new file mode 100644 index 0000000..ac74e14 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/query/DtoQuery.java @@ -0,0 +1,212 @@ +package com.fp.dto.query; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * Dto de transporte utilizado en la ejecucin de consultas invocadas desde el front end, contiene metadata necesaria + * para armar y ejecutar consultas en la base de datos. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class DtoQuery implements Serializable { + + private static final long serialVersionUID = 6080115615379062328L; + + /** + * Nombre del bean, con el cual se va a ejecutar la consulta. + */ + private String beanname; + + /** + * Numero de pagina se utiliza para consultar mas de un registro. + */ + private Integer page = 0; + + /** + * Numero de registros por pagina. + */ + private Integer recperpage = 0; + + /** + * True indica que la consulta espera de respuesrta de 0..n registros. + */ + private boolean multirecord = false; + + /** + * String que contiene la lista de campos por el cual se va a ordenar la consula.
+ * ejemplo
+ * pk.pais ordenado por pais
+ * pk.pais,pk.provincia,nombre ordenado por 3 campo
+ * nombre desc orden descendente por nombre
+ */ + private String orderby; + + /** + * Lista de filtros con los cuales se arma la sentencia de la consulta. + */ + private final List lfiltros = new ArrayList(); + + private final List lSubquery = new ArrayList(); + + /** + * Crea una instancia de {@link DtoConsulta}. + * + * @param beanname Nombre del bean a consultar. + * @param mcriterios Map de filtros tipo camo-valor. + * @throws Exception + */ + public DtoQuery(String beanname, Map mcriterios) throws Exception { + this.beanname = beanname; + addCriterios(mcriterios); + } + + /** + * Crea una instancia de {@link DtoConsulta}. + * + * @param beanname Nombre del bean a consultar. + * @param mcriterios Map de filtros tipo camo-valor. + * @throws Exception + */ + public DtoQuery(String beanname, Integer page, Integer recperpage, boolean multirecord, Map mcriterios) throws Exception { + this.beanname = beanname; + this.page = page; + this.recperpage = recperpage; + this.multirecord = multirecord; + addCriterios(mcriterios); + } + + /** + * Adiciona criterios a la consulta dado map, campo-valor. + * + * @param mcriterios Map que contiene filtros, campo - valor, al inicio del campo puede estar incluido el criterio. + * @throws Exception + */ + public void addCriterios(Map mcriterios) throws Exception { + if (mcriterios == null) { + return; + } + Set s = mcriterios.keySet(); + for (String campo : s) { + if (mcriterios.get(campo) != "" && mcriterios.get(campo) != null) { + Filter f = new Filter(campo, mcriterios.get(campo)); + lfiltros.add(f); + } + } + } + + /** + * Adiciona un filtro a la consulta. + * + * @param filtro Objeto que contiene los datos del filtro a utilizar en la consulta. + * @throws Exception + */ + public void addFiltro(Filter filtro) throws Exception { + lfiltros.add(filtro); + } + + /** + * Adiciona un subquery a la consulta. + * + * @param subquery Objeto que contiene los datos de subquery a utilizar en la consulta. + * @throws Exception + */ + public void addSubQuery(SubQuery subquery) throws Exception { + lSubquery.add(subquery); + } + + /** + * Entrega el valor de: beanname + * + * @return String + */ + public String getBeanname() { + return beanname; + } + + /** + * Fija el valor de: beanname + * + * @param Valor a fijar en el atributo. + */ + public void setBeanname(String beanname) { + this.beanname = beanname; + } + + /** + * Entrega el valor de: orderby + * + * @return String + */ + public String getOrderby() { + return orderby; + } + + /** + * Fija el valor de: orderby + * + * @param Valor a fijar en el atributo. + */ + public void setOrderby(String orderby) { + this.orderby = orderby; + } + + /** + * Entrega el valor de: page + * + * @return Integer + */ + public Integer getPage() { + return page; + } + + /** + * Entrega el valor de: multirecord + * + * @return boolean + */ + public boolean isMultirecord() { + return multirecord; + } + + /** + * Fija el valor de: multirecord + * + * @param Valor a fijar en el atributo. + */ + public void setMultirecord(boolean multirecord) { + this.multirecord = multirecord; + } + + /** + * Entrega el valor de: recperpage + * + * @return Integer + */ + public Integer getRecperpage() { + return recperpage; + } + + /** + * Entrega el valor de: lfiltros + * + * @return List + */ + public List getLfilter() { + return lfiltros; + } + + /** + * Entrega el valor de: lSubquery + * + * @return List + */ + public List getlSubquery() { + return lSubquery; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/query/Filter.java b/base/dto/dto/src/main/java/com/fp/dto/query/Filter.java new file mode 100644 index 0000000..0bafd83 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/query/Filter.java @@ -0,0 +1,142 @@ +package com.fp.dto.query; + +import java.io.Serializable; + +/** + * Objeto que contiene filtros asociados a una tabla. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class Filter implements Serializable { + + private static final long serialVersionUID = -459214658769947266L; + /** + * Nombre del campo perteneciente a la tabla o bean. + */ + private String field; + /** + * Condicion a aplicar, si es null y el tipo de dato es String se toma like. + */ + private String condition; + /** + * Valor de la condicion, si es diferente de null se considera en la sentencia. + */ + private String value; + /** + * Valor de una condicion incluye campo y valor ejemplo: t.modulecode = 12 or t.modulecode is null + * Este valor es prioritario, si existe se adiciona al where. + */ + private String sql; + + /** + * Crea una instancia de FIlter. + */ + public Filter() { + } + + /** + * Crea una instancia de Filtro, Evalua la condicion del filtro que puede llegar en el nombre del campo ejemplo >=pk.cuidad. + * @param campo Nombre de un campo pertenceciente a un entity bean. + * @param valor Valor del criterio. + * @throws Exception + */ + public Filter(String field, String value) throws Exception { + this.field = field; + this.value = value; + if(value.length() > 1){ + evaluadoscriterio(value.substring(0, 2)); + } + if (condition == null && value.length() > 0) { + evaluadoscriterio(value.substring(0, 1)); + } + } + + /** + * Crea una instancia de Filtro. + * @param campo Nombre de un campo pertenceciente a un entity bean. + * @param valor Valor del criterio. + * @throws Exception + */ + public Filter(String field, String condition, String value) { + this.field = field; + this.condition = condition; + this.value = value; + } + + private void evaluadoscriterio(String cond) throws Exception { + if (FilterTypes.getFilterTypes(cond) != null) { + condition = cond; + value = value.substring(cond.length(), value.length()); + } + } + + /** + * Entrega el valor de: field + * @return String + */ + public String getField() { + return field; + } + + /** + * Fija el valor de: field + * @param Valor a fijar en el atributo. + */ + public void setField(String field) { + this.field = field; + } + + /** + * Entrega el valor de: condition + * @return String + */ + public String getCondition() { + return condition; + } + + /** + * Fija el valor de: condition + * @param Valor a fijar en el atributo. + */ + public void setCondition(String condition) { + this.condition = condition; + } + + /** + * Entrega el valor de: value + * @return String + */ + public String getValue() { + return value; + } + + /** + * Fija el valor de: value + * @param Valor a fijar en el atributo. + */ + public void setValue(String value) { + this.value = value; + } + + /** + * Entrega el valor de: sql + * @return String + */ + public String getSql() { + return sql; + } + + /** + * Fija el valor de: sql + * @param sql Valor a fijar en el atributo. + */ + + public void setSql(String sql) { + this.sql = sql; + } + + + +} + diff --git a/base/dto/dto/src/main/java/com/fp/dto/query/FilterTypes.java b/base/dto/dto/src/main/java/com/fp/dto/query/FilterTypes.java new file mode 100644 index 0000000..aa43581 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/query/FilterTypes.java @@ -0,0 +1,36 @@ +package com.fp.dto.query; + +public enum FilterTypes { + + EQUAL("="), DIFFERENT("!="), MAYOR(">"), GREATERTHAN("<"), LESSOREQUAL(">="), GREATOREQUAL("<="); + + /** + * Codigo de criterio. + */ + private String criteriacondition; + + /** + * Crea una instancia de FilterTypes. + * @param criteriacondition Codigo de criterio. + */ + private FilterTypes(String criteriacondition) { + this.criteriacondition = criteriacondition; + } + + /** + * Entraga un objeto FilterTypes dado una condicion. + * @param criterio Codigo de criterio. + * @return FilterTypes + * @throws Exception + */ + public static FilterTypes getFilterTypes(String criteriacondition) throws Exception { + FilterTypes em = null; + for (FilterTypes obj : FilterTypes.values()) { + if (obj.criteriacondition.compareTo(criteriacondition) == 0) { + em = obj; + } + } + return em; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/query/QueryBean.java b/base/dto/dto/src/main/java/com/fp/dto/query/QueryBean.java new file mode 100644 index 0000000..a804f75 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/query/QueryBean.java @@ -0,0 +1,281 @@ +package com.fp.dto.query; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.common.helper.BeanManager; +import com.fp.dto.AbstractData; + +/** + * @author Jorge Vaca + * @version 2.1 + */ +/** + * @author jorge + * + */ +public class QueryBean extends AbstractData { + + /** Version de la clase */ + private static final long serialVersionUID = 1L; + + /** Paquete clase asociado al bena. */ + private String beanName; + + /** Numero de registros a consultar por pagina, se utiliaz en la paginacion en una pantalla */ + private int pageSize = 10; + + /** Numero de pagina en que se encuentra la consulta */ + private int page = 1; + + /** true, indica que la consulta entrega mas de un registro. */ + private boolean multirecord = true; + + /** Codigo de query alias, se utiliza para ejecutar consultas por codigo de consulta. */ + private String queryalias; + + /** Tipo de consulta, T transacion, P codigo de consulta */ + private String querytype; + + /** Lista de criterios asociados a al querybean */ + private List criteria = new ArrayList(); + + /** Lista de query adicionales, utilizados para entregar informacion adicional asociada al bean principal */ + private List additionalQuery = new ArrayList(); + + /** + * Entrega el valor de: beanName + * + * @return String + */ + public String getBeanName() { + return this.beanName; + } + + /** + * Fija el valor de: beanName + * + * @param beanName + */ + public void setBeanName(String beanName) { + this.beanName = beanName; + } + + public List getAdditionalQuery() { + return this.additionalQuery; + } + + public void setAdditionalQuery(List additionalQuery) { + this.additionalQuery = additionalQuery; + } + + /** + * Entrega el valor de: criteria + * + * @return List + */ + public List getCriteria() { + return this.criteria; + } + + /** + * Fija el valor de: criteria + * + * @param criteria + */ + public void setCriteria(List criteria) { + this.criteria = criteria; + } + + public QueryBean(String beanName) { + this.beanName = beanName; + } + + public QueryBean() { + } + + /** + * Entrega el valor de: pageSize + * + * @return int + */ + public int getPageSize() { + return this.pageSize; + } + + /** + * Fija el valor de: pageSize + * + * @param pageSize + */ + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + /** + * Entrega el valor de: page + * + * @return int + */ + public int getPage() { + return this.page; + } + + /** + * Fija el valor de: page + * + * @param page + */ + public void setPage(int page) { + this.page = page; + } + + /** + * Entrega el valor de un criterio. + * + * @param pProperty Nombre del parametro de criterio. + * @return Object + * @throws Exception + */ + public Object getCriteriaValue(String pProperty) throws Exception { + Object value = null; + QueryCriteria obj = null; + for (QueryCriteria queryCriteria : this.criteria) { + if (queryCriteria.getProperty().compareTo(pProperty) == 0) { + obj = queryCriteria; + } + } + if (obj != null) { + value = obj.getValue(); + } + return value; + } + + /** + * Entrega el valor de un criterio. + * + * @param pProperty Nombre del parametro de criterio. + * @return Object + * @throws Exception + */ + public boolean isNotin(String pProperty) throws Exception { + boolean exists = false; + String aux = "not in"; + QueryCriteria obj = null; + for (QueryCriteria queryCriteria : this.criteria) { + if (queryCriteria.getProperty().compareTo(pProperty) == 0) { + obj = queryCriteria; + } + } + if (obj != null) { + exists = obj.getOperation().toLowerCase().compareTo(aux) == 0; + } + return exists; + } + + /** + * Metodo que fija un valor de un criterio. + * + * @param pProperty Nombre del criterio. + * @param pValue Valor a almacenar en el criterio. + * @throws Exception + */ + public void setCriteriaValue(String pProperty, Object pValue) throws Exception { + for (QueryCriteria obj : this.criteria) { + if (obj.getProperty().compareTo(pProperty) == 0) { + BeanManager.setBeanAttributeValue(obj, "value", pValue); + } + } + } + + /** + * Metodo que entrega una lista de criterios ordenada. + * + * @param pAsc true entrega una lista de criterios ordenada ascendentemente, false entrega una lista de criterios + * ordenada descendentemente. + * @return List + */ + public List getOrder(boolean pAsc) { + List order = new ArrayList(); + Map aux = new HashMap(); + List key = new ArrayList(); + for (QueryCriteria queryCriteria : this.criteria) { + if (pAsc) { + if (queryCriteria.getOrder() > 0) { + if (key.contains(Math.abs(queryCriteria.getOrder()))) { + continue; + } + key.add(Math.abs(queryCriteria.getOrder())); + aux.put(Math.abs(queryCriteria.getOrder()), queryCriteria); + } + } else { + if (queryCriteria.getOrder() < 0) { + if (key.contains(Math.abs(queryCriteria.getOrder()))) { + continue; + } + key.add(Math.abs(queryCriteria.getOrder())); + aux.put(Math.abs(queryCriteria.getOrder()), queryCriteria); + } + } + } + Collections.sort(key); + for (Integer k : key) { + order.add(aux.get(k)); + } + return order; + } + + /** + * Entrega el valor de: multirecord + * + * @return boolean + */ + public boolean isMultirecord() { + return this.multirecord; + } + + /** + * Fija el valor de: multirecord + * + * @param multirecord + */ + public void setMultirecord(boolean multirecord) { + this.multirecord = multirecord; + } + + /** + * Entrega el valor de: queryalias + * + * @return String + */ + public String getQueryalias() { + return this.queryalias; + } + + /** + * Fija el valor de: queryalias + * + * @param queryalias + */ + public void setQueryalias(String queryalias) { + this.queryalias = queryalias; + } + + /** + * @return the querytype + */ + public String getQuerytype() { + return this.querytype; + } + + /** + * @param querytype the querytype to set + */ + public void setQuerytype(String querytype) { + this.querytype = querytype; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/query/QueryCriteria.java b/base/dto/dto/src/main/java/com/fp/dto/query/QueryCriteria.java new file mode 100644 index 0000000..1b71f12 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/query/QueryCriteria.java @@ -0,0 +1,197 @@ +package com.fp.dto.query; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.data.SaveData; + +/** + * Clase de transporte, que se asocia a un querybena con las restricciones a aplicar + * en una sentencia SQL. + * @author Jorge Vaca + * @version 2.1 + */ +public class QueryCriteria extends AbstractDataTransport{ + /**Version de la clase.*/ + private static final long serialVersionUID = 1L; + /**Nombrte del campo de la tabla*/ + private String property; + /**Criterio de la restriccion, =, != , like, >= etc.*/ + private String operation; + /**Valor de la restriccion.*/ + private Object value; + /**Indice del orden en las sentencias.*/ + private int order=0; + + @Override + public Object cloneMe() throws CloneNotSupportedException { + QueryCriteria p = (QueryCriteria) this.clone(); + return p; + } + /** + * Entrega el valor de: property + * @return String + */ + public String getProperty() { + return property; + } + /** + * Fija el valor de: property + * @param property + */ + public void setProperty(String property) { + this.property = property; + if(this.value != null){ + this.setLogData(property, value); + } + } + /** + * Entrega el valor de: operation + * @return String + */ + public String getOperation() { + return operation; + } + /** + * Fija el valor de: operation + * @param operation + */ + public void setOperation(String operation) { + this.operation = operation; + } + /** + * Entrega el valor de: value + * @return Object + */ + public Object getValue() { + if(value instanceof Integer){ + return Long.parseLong(value.toString()); + } + return value; + } + + /** + * Fija el valor de: value + * @param value + */ + public void setValue(Object value) { + this.value = value; + if(this.property != null){ + this.setLogData(property, value); + } + } + /** + * Entrega el valor de: order + * @return int + */ + public int getOrder() { + return order; + } + /** + * Fija el valor de: order + * @param order + */ + public void setOrder(int order) { + this.order = order; + } + public QueryCriteria(){ + + } + + /** + * Crea una instancia de QueryCriteria. + * @param property Nombre del campo a aplicar la restriccion. + * @param operation Condicion =, != , >, >= etc + * @param value Valor de la restriccion. + */ + public QueryCriteria(String property, String operation, Object value) { + this(property,operation,value,0); + } + + /** + * Crea una instancia de QueryCriteria, la condicion de la restriccion es like. + * @param property Nombre del campo a aplicar la restriccion. + * @param value Valor de la restriccion. + */ + public QueryCriteria(String property, Object value) { + this(property,"like",value,0); + } + + /** + * Crea una instancia de QueryCriteria + * @param property Nombre del campo. + * @param operation Condicion =, != , >, >= etc + * @param value Valor de la restriccion. + * @param order Orden de presentacion en la consulta. + */ + public QueryCriteria(String property, String operation, Object value, int order) { + this.property = property; + this.operation = operation; + this.value = value; + this.order = order; + this.setLogData(property, value); + } + + private void setLogData(String property,Object value) { + try { + this.setPersoncode(property, value); + this.setAccount(property, value); + this.setSolicitudenumber(property, value); + } catch (Exception e) { + //no hacer nada + } + } + + /** + * Verifica que el nombre del campo sea PERSONCODE, y almacena en los datos de parametros del log el valor del campo. + * @param property Nombre del campo a verificar. + * @param value Valor del campo. + * @throws Exception + */ + private void setPersoncode(String property,Object value) throws Exception { + String field = "PERSONCODE"; + if (!property.toUpperCase().contains(field) ){ + return; + } + this.setData(property, field, value); + } + + /** + * Verifica que el nombre del campo sea PERSONCODE, y almacena en los datos de parametros del log el valor del campo. + * @param property Nombre del campo a verificar. + * @param value Valor del campo. + * @throws Exception + */ + private void setAccount(String property,Object value) throws Exception { + String field = "ACCOUNT"; + if (!property.toUpperCase().contains(field) ){ + return; + } + this.setData(property, field, value); + } + + /** + * Verifica que el nombre del campo sea PERSONCODE, y almacena en los datos de parametros del log el valor del campo. + * @param property Nombre del campo a verificar. + * @param value Valor del campo. + * @throws Exception + */ + private void setSolicitudenumber(String property,Object value) throws Exception { + String field = "SOLICITUDNUMBER"; + if (!property.toUpperCase().contains(field) ){ + return; + } + this.setData(property, field, value); + } + + private void setData(String property,String field,Object value) throws Exception { + if( SaveData.getMap().get(field) != null) { + return; + } + if (property.indexOf('.') > 0) { + property = property.substring(property.indexOf('.')+1); + } + if(property.toUpperCase().compareTo(field) == 0){ + SaveData.getMap().put(field, value); + } + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/query/QueryRequest.java b/base/dto/dto/src/main/java/com/fp/dto/query/QueryRequest.java new file mode 100644 index 0000000..08e1f20 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/query/QueryRequest.java @@ -0,0 +1,85 @@ +package com.fp.dto.query; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import com.fp.dto.Request; + +/** + * + * @author Jorge Vaca + * @version 2.1 + */ +public class QueryRequest extends Request { + + private static final long serialVersionUID = 1L; + + /** + * indica si la consulta se origina en una pagina jsf. + */ + private boolean jsf = false; + + /* (non-Javadoc) + * @see java.util.HashMap#get(java.lang.Object) + */ + @Override + public Object get(Object key) { + return super.get(key); + } + + /* (non-Javadoc) + * @see java.util.HashMap#put(java.lang.Object, java.lang.Object) + */ + @Override + public Object put(String key, Object value) { + if(key.compareTo("beans")==0){ + return value; + } + return super.put(key, value); + } + + /** + * Entrega un map con los objetos de tipo QueryBean. + * @return Map + */ + public Map getBeans() { + Map beans=new HashMap(); + Set keys=super.keySet(); + for(String key:keys){ + Object obj=super.get(key); + if(obj instanceof QueryBean){ + beans.put(key, (QueryBean)obj); + } + } + return beans; + } + + @Override + public Set> entrySet() { + super.entrySet(); + super.remove("beans"); + return super.entrySetDefault(); + } + + /** + * Entrega el valor de: jsf + * @return boolean + */ + public boolean isJsf() { + return jsf; + } + + /** + * Fija el valor de: jsf + * @param Valor a fijar en el atributo. + */ + public void setJsf(boolean jsf) { + this.jsf = jsf; + } + + + + + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/query/SubQuery.java b/base/dto/dto/src/main/java/com/fp/dto/query/SubQuery.java new file mode 100644 index 0000000..7fa2340 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/query/SubQuery.java @@ -0,0 +1,122 @@ +package com.fp.dto.query; + +import java.io.Serializable; + +/** + * Objeto que contiene la definicion de un subquery asociado a un bean. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class SubQuery implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * Nombre del bean, asociado a una tabla a utilziar en el subquery. + */ + private String beanname; + /** + * Campo a consultar en el subquery. + */ + private String field; + /** + * Nombre con el cual se entrega la respuesta, si el alias es null toma el valor de campo. + */ + private String alias; + /** + * Where con el cual se ejecuta el subquery.
+ * Ejemplo considera i.pk.pais = t.pk.pais and i.provincia = t.provincia.
+ * siempre va (i) para el bean del subquery y (t) para la tabla externa. + */ + private String where; + + /** + * Crea una instancia de SubQuery. + * @param beanname Nombre del bean con el que se realiza el subquery. + * @param campo Nombre de campo a consultar. + * @param alias Alias con el cual se entrega la respuesta. + * @param filtro Filtro a utilziar en el subquery. + * @throws Exception + */ + public SubQuery(String beanname, String field, String alias, String joinFields) throws Exception { + this.beanname = beanname; + this.field = field; + this.alias = alias; + if (this.alias == null) { + this.alias = this.field; + } + where = " where " + joinFields; + } + + public String getSubQuery() throws Exception { + return "(select i." + field + " from " + beanname + " i " + where + ")"; + } + + /** + * Entrega el valor de: beanname + * @return String + */ + public String getBeanname() { + return beanname; + } + + /** + * Fija el valor de: beanname + * @param Valor a fijar en el atributo. + */ + public void setBeanname(String beanname) { + this.beanname = beanname; + } + + /** + * Entrega el valor de: field + * @return String + */ + public String getField() { + return field; + } + + /** + * Fija el valor de: field + * @param Valor a fijar en el atributo. + */ + public void setField(String field) { + this.field = field; + } + + /** + * Entrega el valor de: alias + * @return String + */ + public String getAlias() { + return alias; + } + + /** + * Fija el valor de: alias + * @param Valor a fijar en el atributo. + */ + public void setAlias(String alias) { + this.alias = alias; + } + + /** + * Entrega el valor de: where + * @return String + */ + public String getWhere() { + return where; + } + + /** + * Fija el valor de: where + * @param Valor a fijar en el atributo. + */ + public void setWhere(String where) { + this.where = where; + } + + + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/query/menu/.svn/entries b/base/dto/dto/src/main/java/com/fp/dto/query/menu/.svn/entries new file mode 100644 index 0000000..bae1b6a --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/query/menu/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/java/com/fp/dto/query/menu +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +MenuRequest.java +file + + + + +2022-07-28T03:40:33.289762Z +2a3dfa212f69e90e212029f79f548734 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +618 + diff --git a/base/dto/dto/src/main/java/com/fp/dto/query/menu/.svn/text-base/MenuRequest.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/query/menu/.svn/text-base/MenuRequest.java.svn-base new file mode 100644 index 0000000..3e326d7 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/query/menu/.svn/text-base/MenuRequest.java.svn-base @@ -0,0 +1,35 @@ +package com.fp.dto.query.menu; + +import com.fp.dto.Request; + +public class MenuRequest extends Request{ + private static final long serialVersionUID = 1L; + private String grouping; + private String criteria; + private int page=1; + + public String getCriteria() { + return criteria; + } + + public void setCriteria(String criteria) { + this.criteria = criteria; + } + + public String getGrouping() { + return grouping; + } + + public void setGrouping(String grouping) { + this.grouping = grouping; + } + + public int getPage() { + return page; + } + + public void setPage(int page) { + this.page = page; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/query/menu/MenuRequest.java b/base/dto/dto/src/main/java/com/fp/dto/query/menu/MenuRequest.java new file mode 100644 index 0000000..3e326d7 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/query/menu/MenuRequest.java @@ -0,0 +1,35 @@ +package com.fp.dto.query.menu; + +import com.fp.dto.Request; + +public class MenuRequest extends Request{ + private static final long serialVersionUID = 1L; + private String grouping; + private String criteria; + private int page=1; + + public String getCriteria() { + return criteria; + } + + public void setCriteria(String criteria) { + this.criteria = criteria; + } + + public String getGrouping() { + return grouping; + } + + public void setGrouping(String grouping) { + this.grouping = grouping; + } + + public int getPage() { + return page; + } + + public void setPage(int page) { + this.page = page; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/quota/.svn/entries b/base/dto/dto/src/main/java/com/fp/dto/quota/.svn/entries new file mode 100644 index 0000000..cb2288b --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/quota/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/java/com/fp/dto/quota +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +Quota.java +file + + + + +2022-07-28T03:40:33.101761Z +d5840ed9f204d702d728759085eb4b1c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2570 + +QuotaDetail.java +file + + + + +2022-07-28T03:40:33.102761Z +55d77d5a375cd30871850e9f36aac3b1 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7777 + diff --git a/base/dto/dto/src/main/java/com/fp/dto/quota/.svn/text-base/Quota.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/quota/.svn/text-base/Quota.java.svn-base new file mode 100644 index 0000000..c65a852 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/quota/.svn/text-base/Quota.java.svn-base @@ -0,0 +1,105 @@ +package com.fp.dto.quota; + +import java.io.Serializable; + +import com.fp.dto.AbstractDataBalanceTransport; + +/** + * Clase utilitaria de la cabecera de tabla de cuotas, se utilzia para alamacenar valores temporales en los procesos + * ejemplo cobro de cuotas. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class Quota extends AbstractDataBalanceTransport implements Serializable, Cloneable { + + /** Version de la clase. */ + private static final long serialVersionUID = 1L; + + /** Indica si paga uno o mas valores en la cuota, se utiliza para recorrer solo las cuotas pagadas del detail. */ + private boolean applyPayment = false; + + /** Indica que la cuota se paga en su totalidad y hay que actualiazar la fecha de pago. */ + private boolean fullPaymet = false; + + /** + * True indica que se genero historia del registro, se utiliza junto a fullpayment Si fullpayment == true && history + * == false se genera un registro de historia. + */ + private boolean history = false; + + /** True indica que se adiciono un nuevo registro. */ + private boolean added = false; + + /** + * Entrega el valor de: applyPayment + * + * @return boolean + */ + public boolean isApplyPayment() { + return this.applyPayment; + } + + /** + * Fija el valor de applyPayment + * + * @param applyPayment value to set + */ + public void setApplyPayment(boolean applyPayment) { + this.applyPayment = applyPayment; + } + + /** + * Entrega el valor de: fullPaymet + * + * @return boolean + */ + public boolean isFullPaymet() { + return this.fullPaymet; + } + + /** + * Fija el valor de fullPaymet + * + * @param fullPaymet value to set + */ + public void setFullPaymet(boolean fullPaymet) { + this.fullPaymet = fullPaymet; + } + + /** + * Entrega el valor de: history + * + * @return boolean + */ + public boolean isHistory() { + return this.history; + } + + /** + * Fija el valor de history + * + * @param history value to set + */ + public void setHistory(boolean history) { + this.history = history; + } + + /** + * Entrega el valor de: added + * + * @return boolean + */ + public boolean isAdded() { + return this.added; + } + + /** + * Fija el valor de added + * + * @param added value to set + */ + public void setAdded(boolean added) { + this.added = added; + } +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/quota/.svn/text-base/QuotaDetail.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/quota/.svn/text-base/QuotaDetail.java.svn-base new file mode 100644 index 0000000..224909e --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/quota/.svn/text-base/QuotaDetail.java.svn-base @@ -0,0 +1,304 @@ +package com.fp.dto.quota; + +import java.io.Serializable; +import java.math.BigDecimal; + +import com.fp.dto.AbstractDataBalanceTransport; + +/** + * Clase utilitaria del detalle de uan cuota de la tabla de amortizacion, se utilzia para alamacenar valores temporales + * en los procesos ejemplo cobro de cuotas. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class QuotaDetail extends AbstractDataBalanceTransport implements Serializable, Cloneable { + + /** Version de la clase. */ + private static final long serialVersionUID = 1L; + + /** Indica que se hace un pago al tipo de saldo del detalle de la cuota. */ + private boolean applyPayment = false; + + /** Valor que se paga por tipo de saldo, con este valor se arma el financiero. */ + private BigDecimal paymentValue = BigDecimal.ZERO; + + /** Valor adeudado para el tipo de saldo. */ + private BigDecimal debtValue = BigDecimal.ZERO; + + /** Indica que se hace un pago anticipado al tipo de saldo del detalle de la cuota. */ + private boolean applyProjectedValue = false; + + /** Valor a pagar por adelantado, en los tipos de saldo de provisiones. */ + private BigDecimal projectedValue = BigDecimal.ZERO; + + /** + * Indica que se caduca el registro por que se pago por completo, ejemplo, en cuotas vencidas se cobra el interes + * normal adeudado, en este caso se caduca el registro, los tipos de saldo que no son interes como cargos, si se + * cobra por completo se caduca el registro. + */ + private boolean expire = false; + + /** Indica que se paga por completo el valor adeudado de un tipo de saldo de la cuoata. */ + private boolean fullPaymet = false; + + /** + * Indica que actuliaza el valor de la provision a cero, cuando deja de provisionar una cuota, o cuando esta se paga + * completa. + */ + private boolean updateProvisionToZero = false; + + /** + * Almacena la defincion de cobro, asociado al registro de detalle de la cuota, con la definicion de de la + * transaccion se arma el financiero. + */ + private Object transactionPayment; + + /** Valor que a reversar en pagos con fecha valor. */ + private BigDecimal discountBackValue = BigDecimal.ZERO; + + /** Valor de tipos de saldo ACC que se cobra adelantado. */ + private BigDecimal advancedValue = BigDecimal.ZERO; + + /** + * True indica que se genero historia del registro. + */ + private boolean history = false; + + /** True indica que se adiciono un nuevo registro. */ + private boolean added = false; + + /** + * Entrega el valor de: applyPayment + * + * @return boolean + */ + public boolean isApplyPayment() { + return this.applyPayment; + } + + /** + * Fija el valor de applyPayment + * + * @param applyPayment value to set + */ + public void setApplyPayment(boolean applyPayment) { + this.applyPayment = applyPayment; + } + + /** + * Entrega el valor de: paymentValue + * + * @return BigDecimal + */ + public BigDecimal getPaymentValue() { + return this.paymentValue; + } + + /** + * Fija el valor de paymentValue + * + * @param paymentValue value to set + */ + public void setPaymentValue(BigDecimal paymentValue) { + this.paymentValue = paymentValue; + } + + /** + * Entrega el valor de: debtValue + * + * @return BigDecimal + */ + public BigDecimal getDebtValue() { + return this.debtValue; + } + + /** + * Fija el valor de debtValue + * + * @param debtValue value to set + */ + public void setDebtValue(BigDecimal debtValue) { + this.debtValue = debtValue; + } + + /** + * Entrega el valor de: applyProjectedValue + * + * @return boolean + */ + public boolean isApplyProjectedValue() { + return this.applyProjectedValue; + } + + /** + * Fija el valor de applyProjectedValue + * + * @param applyProjectedValue value to set + */ + public void setApplyProjectedValue(boolean applyProjectedValue) { + this.applyProjectedValue = applyProjectedValue; + } + + /** + * Entrega el valor de: projectedValue + * + * @return BigDecimal + */ + public BigDecimal getProjectedValue() { + return this.projectedValue; + } + + /** + * Fija el valor de projectedValue + * + * @param projectedValue value to set + */ + public void setProjectedValue(BigDecimal projectedValue) { + this.projectedValue = projectedValue; + } + + /** + * Entrega el valor de: expire + * + * @return boolean + */ + public boolean isExpire() { + return this.expire; + } + + /** + * Fija el valor de expire + * + * @param expire value to set + */ + public void setExpire(boolean expire) { + this.expire = expire; + } + + /** + * Entrega el valor de: fullPaymet + * + * @return boolean + */ + public boolean isFullPaymet() { + return this.fullPaymet; + } + + /** + * Fija el valor de fullPaymet + * + * @param fullPaymet value to set + */ + public void setFullPaymet(boolean fullPaymet) { + this.fullPaymet = fullPaymet; + } + + /** + * Entrega el valor de: updateProvisionToZero + * + * @return boolean + */ + public boolean isUpdateProvisionToZero() { + return this.updateProvisionToZero; + } + + /** + * Fija el valor de updateProvisionToZero + * + * @param updateProvisionToZero value to set + */ + public void setUpdateProvisionToZero(boolean updateProvisionToZero) { + this.updateProvisionToZero = updateProvisionToZero; + } + + /** + * Entrega el valor de: transactionPayment + * + * @return Object + */ + public Object getTransactionPayment() { + return this.transactionPayment; + } + + /** + * Fija el valor de transactionPayment + * + * @param transactionPayment value to set + */ + public void setTransactionPayment(Object transactionPayment) { + this.transactionPayment = transactionPayment; + } + + /** + * Entrega el valor de: discountBackValue + * + * @return BigDecimal + */ + public BigDecimal getDiscountBackValue() { + return this.discountBackValue; + } + + /** + * Fija el valor de discountBackValue + * + * @param discountBackValue value to set + */ + public void setDiscountBackValue(BigDecimal discountBackValue) { + this.discountBackValue = discountBackValue; + } + + /** + * Entrega el valor de: advancedValue + * + * @return BigDecimal + */ + public BigDecimal getAdvancedValue() { + return this.advancedValue; + } + + /** + * Fija el valor de advancedValue + * + * @param advancedValue value to set + */ + public void setAdvancedValue(BigDecimal advancedValue) { + this.advancedValue = advancedValue; + } + + /** + * Entrega el valor de: history + * + * @return boolean + */ + public boolean isHistory() { + return this.history; + } + + /** + * Fija el valor de history + * + * @param history value to set + */ + public void setHistory(boolean history) { + this.history = history; + } + + /** + * Entrega el valor de: added + * + * @return boolean + */ + public boolean isAdded() { + return this.added; + } + + /** + * Fija el valor de added + * + * @param added value to set + */ + public void setAdded(boolean added) { + this.added = added; + } +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/quota/Quota.java b/base/dto/dto/src/main/java/com/fp/dto/quota/Quota.java new file mode 100644 index 0000000..c65a852 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/quota/Quota.java @@ -0,0 +1,105 @@ +package com.fp.dto.quota; + +import java.io.Serializable; + +import com.fp.dto.AbstractDataBalanceTransport; + +/** + * Clase utilitaria de la cabecera de tabla de cuotas, se utilzia para alamacenar valores temporales en los procesos + * ejemplo cobro de cuotas. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class Quota extends AbstractDataBalanceTransport implements Serializable, Cloneable { + + /** Version de la clase. */ + private static final long serialVersionUID = 1L; + + /** Indica si paga uno o mas valores en la cuota, se utiliza para recorrer solo las cuotas pagadas del detail. */ + private boolean applyPayment = false; + + /** Indica que la cuota se paga en su totalidad y hay que actualiazar la fecha de pago. */ + private boolean fullPaymet = false; + + /** + * True indica que se genero historia del registro, se utiliza junto a fullpayment Si fullpayment == true && history + * == false se genera un registro de historia. + */ + private boolean history = false; + + /** True indica que se adiciono un nuevo registro. */ + private boolean added = false; + + /** + * Entrega el valor de: applyPayment + * + * @return boolean + */ + public boolean isApplyPayment() { + return this.applyPayment; + } + + /** + * Fija el valor de applyPayment + * + * @param applyPayment value to set + */ + public void setApplyPayment(boolean applyPayment) { + this.applyPayment = applyPayment; + } + + /** + * Entrega el valor de: fullPaymet + * + * @return boolean + */ + public boolean isFullPaymet() { + return this.fullPaymet; + } + + /** + * Fija el valor de fullPaymet + * + * @param fullPaymet value to set + */ + public void setFullPaymet(boolean fullPaymet) { + this.fullPaymet = fullPaymet; + } + + /** + * Entrega el valor de: history + * + * @return boolean + */ + public boolean isHistory() { + return this.history; + } + + /** + * Fija el valor de history + * + * @param history value to set + */ + public void setHistory(boolean history) { + this.history = history; + } + + /** + * Entrega el valor de: added + * + * @return boolean + */ + public boolean isAdded() { + return this.added; + } + + /** + * Fija el valor de added + * + * @param added value to set + */ + public void setAdded(boolean added) { + this.added = added; + } +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/quota/QuotaDetail.java b/base/dto/dto/src/main/java/com/fp/dto/quota/QuotaDetail.java new file mode 100644 index 0000000..224909e --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/quota/QuotaDetail.java @@ -0,0 +1,304 @@ +package com.fp.dto.quota; + +import java.io.Serializable; +import java.math.BigDecimal; + +import com.fp.dto.AbstractDataBalanceTransport; + +/** + * Clase utilitaria del detalle de uan cuota de la tabla de amortizacion, se utilzia para alamacenar valores temporales + * en los procesos ejemplo cobro de cuotas. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class QuotaDetail extends AbstractDataBalanceTransport implements Serializable, Cloneable { + + /** Version de la clase. */ + private static final long serialVersionUID = 1L; + + /** Indica que se hace un pago al tipo de saldo del detalle de la cuota. */ + private boolean applyPayment = false; + + /** Valor que se paga por tipo de saldo, con este valor se arma el financiero. */ + private BigDecimal paymentValue = BigDecimal.ZERO; + + /** Valor adeudado para el tipo de saldo. */ + private BigDecimal debtValue = BigDecimal.ZERO; + + /** Indica que se hace un pago anticipado al tipo de saldo del detalle de la cuota. */ + private boolean applyProjectedValue = false; + + /** Valor a pagar por adelantado, en los tipos de saldo de provisiones. */ + private BigDecimal projectedValue = BigDecimal.ZERO; + + /** + * Indica que se caduca el registro por que se pago por completo, ejemplo, en cuotas vencidas se cobra el interes + * normal adeudado, en este caso se caduca el registro, los tipos de saldo que no son interes como cargos, si se + * cobra por completo se caduca el registro. + */ + private boolean expire = false; + + /** Indica que se paga por completo el valor adeudado de un tipo de saldo de la cuoata. */ + private boolean fullPaymet = false; + + /** + * Indica que actuliaza el valor de la provision a cero, cuando deja de provisionar una cuota, o cuando esta se paga + * completa. + */ + private boolean updateProvisionToZero = false; + + /** + * Almacena la defincion de cobro, asociado al registro de detalle de la cuota, con la definicion de de la + * transaccion se arma el financiero. + */ + private Object transactionPayment; + + /** Valor que a reversar en pagos con fecha valor. */ + private BigDecimal discountBackValue = BigDecimal.ZERO; + + /** Valor de tipos de saldo ACC que se cobra adelantado. */ + private BigDecimal advancedValue = BigDecimal.ZERO; + + /** + * True indica que se genero historia del registro. + */ + private boolean history = false; + + /** True indica que se adiciono un nuevo registro. */ + private boolean added = false; + + /** + * Entrega el valor de: applyPayment + * + * @return boolean + */ + public boolean isApplyPayment() { + return this.applyPayment; + } + + /** + * Fija el valor de applyPayment + * + * @param applyPayment value to set + */ + public void setApplyPayment(boolean applyPayment) { + this.applyPayment = applyPayment; + } + + /** + * Entrega el valor de: paymentValue + * + * @return BigDecimal + */ + public BigDecimal getPaymentValue() { + return this.paymentValue; + } + + /** + * Fija el valor de paymentValue + * + * @param paymentValue value to set + */ + public void setPaymentValue(BigDecimal paymentValue) { + this.paymentValue = paymentValue; + } + + /** + * Entrega el valor de: debtValue + * + * @return BigDecimal + */ + public BigDecimal getDebtValue() { + return this.debtValue; + } + + /** + * Fija el valor de debtValue + * + * @param debtValue value to set + */ + public void setDebtValue(BigDecimal debtValue) { + this.debtValue = debtValue; + } + + /** + * Entrega el valor de: applyProjectedValue + * + * @return boolean + */ + public boolean isApplyProjectedValue() { + return this.applyProjectedValue; + } + + /** + * Fija el valor de applyProjectedValue + * + * @param applyProjectedValue value to set + */ + public void setApplyProjectedValue(boolean applyProjectedValue) { + this.applyProjectedValue = applyProjectedValue; + } + + /** + * Entrega el valor de: projectedValue + * + * @return BigDecimal + */ + public BigDecimal getProjectedValue() { + return this.projectedValue; + } + + /** + * Fija el valor de projectedValue + * + * @param projectedValue value to set + */ + public void setProjectedValue(BigDecimal projectedValue) { + this.projectedValue = projectedValue; + } + + /** + * Entrega el valor de: expire + * + * @return boolean + */ + public boolean isExpire() { + return this.expire; + } + + /** + * Fija el valor de expire + * + * @param expire value to set + */ + public void setExpire(boolean expire) { + this.expire = expire; + } + + /** + * Entrega el valor de: fullPaymet + * + * @return boolean + */ + public boolean isFullPaymet() { + return this.fullPaymet; + } + + /** + * Fija el valor de fullPaymet + * + * @param fullPaymet value to set + */ + public void setFullPaymet(boolean fullPaymet) { + this.fullPaymet = fullPaymet; + } + + /** + * Entrega el valor de: updateProvisionToZero + * + * @return boolean + */ + public boolean isUpdateProvisionToZero() { + return this.updateProvisionToZero; + } + + /** + * Fija el valor de updateProvisionToZero + * + * @param updateProvisionToZero value to set + */ + public void setUpdateProvisionToZero(boolean updateProvisionToZero) { + this.updateProvisionToZero = updateProvisionToZero; + } + + /** + * Entrega el valor de: transactionPayment + * + * @return Object + */ + public Object getTransactionPayment() { + return this.transactionPayment; + } + + /** + * Fija el valor de transactionPayment + * + * @param transactionPayment value to set + */ + public void setTransactionPayment(Object transactionPayment) { + this.transactionPayment = transactionPayment; + } + + /** + * Entrega el valor de: discountBackValue + * + * @return BigDecimal + */ + public BigDecimal getDiscountBackValue() { + return this.discountBackValue; + } + + /** + * Fija el valor de discountBackValue + * + * @param discountBackValue value to set + */ + public void setDiscountBackValue(BigDecimal discountBackValue) { + this.discountBackValue = discountBackValue; + } + + /** + * Entrega el valor de: advancedValue + * + * @return BigDecimal + */ + public BigDecimal getAdvancedValue() { + return this.advancedValue; + } + + /** + * Fija el valor de advancedValue + * + * @param advancedValue value to set + */ + public void setAdvancedValue(BigDecimal advancedValue) { + this.advancedValue = advancedValue; + } + + /** + * Entrega el valor de: history + * + * @return boolean + */ + public boolean isHistory() { + return this.history; + } + + /** + * Fija el valor de history + * + * @param history value to set + */ + public void setHistory(boolean history) { + this.history = history; + } + + /** + * Entrega el valor de: added + * + * @return boolean + */ + public boolean isAdded() { + return this.added; + } + + /** + * Fija el valor de added + * + * @param added value to set + */ + public void setAdded(boolean added) { + this.added = added; + } +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/entries b/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/entries new file mode 100644 index 0000000..f83973e --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/entries @@ -0,0 +1,269 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/java/com/fp/dto/rules +svn://172.17.26.185/COMACO + + + +2014-10-30T07:13:48.982625Z +2214 +wpatino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +Service.java +file + + + + +2022-07-28T03:40:33.239762Z +a60552f7873500355326f70acdc576e7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +499 + +ReportRule.java +file + + + + +2022-07-28T03:40:33.239762Z +e70ff0da34ee3faf0ffabbbe9a10b4d7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +907 + +ScheduleRule.java +file + + + + +2022-07-28T03:40:33.239762Z +b7ac3f321c6d9067347b81295661b351 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +475 + +ExceptionRule.java +file + + + + +2022-07-28T03:40:33.239762Z +4a709fac0638dae4728ff4b454d7e80f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +598 + +AbstractRule.java +file + + + + +2022-07-28T03:40:33.239762Z +d82fc4655d376e16f3c1e67f4f9c8f0f +2014-10-30T07:13:48.982625Z +2214 +wpatino + + + + + + + + + + + + + + + + + + + + + +1150 + +QueryRule.java +file + + + + +2022-07-28T03:40:33.240762Z +6d1a9c962680231531da701b87cc9963 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +825 + +TransactionRule.java +file + + + + +2022-07-28T03:40:33.240762Z +7fa08f61107ddb7da883d7413d6a4ab8 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1390 + +com +dir + diff --git a/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/text-base/AbstractRule.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/text-base/AbstractRule.java.svn-base new file mode 100644 index 0000000..c0db9a5 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/text-base/AbstractRule.java.svn-base @@ -0,0 +1,60 @@ +package com.fp.dto.rules; + +import java.io.Serializable; + +import com.fp.dto.Request; + +public abstract class AbstractRule implements Serializable { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + public abstract Request execute(Request pRequest) throws Exception; + + protected String rule; + + /** + * Entrega el valor de rule + * + * @return Valor de rule + */ + public String getRule() { + return this.rule; + } + + /** + * Fija un nuevo valor en rule + * + * @param rule nuevo valor para rule + */ + public void setRule(String rule) { + this.rule = rule; + } + + /** + * Entrega el valor de flow + * + * @return Valor de flow + */ + public String getFlow() { + return this.flow; + } + + /** + * Fija un nuevo valor en flow + * + * @param flow nuevo valor para flow + */ + public void setFlow(String flow) { + this.flow = flow; + } + + protected String flow; + + + protected boolean isNew(Request pRequest) throws Exception { + return ("" + pRequest.get("isnew")).compareTo("Y") == 0; + } +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/text-base/ExceptionRule.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/text-base/ExceptionRule.java.svn-base new file mode 100644 index 0000000..c1608c9 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/text-base/ExceptionRule.java.svn-base @@ -0,0 +1,20 @@ +package com.fp.dto.rules; + +import com.fp.dto.save.SaveRequest; + +/** + * Interface a implemntar por los comandos que generan excepciones de autorizacion en las solicitudes. + * @author Jorge Vaca + * @version 2.1 + */ +public interface ExceptionRule { + + /** + * Implementa logica de negocio a invocar cuando una transaccion se ejecuta en modo normal. + * @param pSaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @return String Condicion de la excepcion. + * @throws Exception + */ + public String execute(SaveRequest pSaveRequest) throws Exception; + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/text-base/QueryRule.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/text-base/QueryRule.java.svn-base new file mode 100644 index 0000000..277f943 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/text-base/QueryRule.java.svn-base @@ -0,0 +1,33 @@ +package com.fp.dto.rules; + +import com.fp.dto.Request; +import com.fp.dto.query.QueryRequest; + +/** + * Clase a extender por las clases que se encargan de ejecutar consultas especiales. + * + * @author Jorge Vaca + * @version 2.1 + * + */ +public abstract class QueryRule extends AbstractRule { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + /** + * Implementa logica de negocio a invocar para ejecutar consultas especiales. + * + * @param pQueryRequest Objeto con beans utilizados en el proceso de consulta. + * @throws Exception + */ + public abstract QueryRequest process(QueryRequest pQueryRequest) throws Exception; + + @Override + public Request execute(Request pRequest) throws Exception { + return this.process((QueryRequest) pRequest); + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/text-base/ReportRule.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/text-base/ReportRule.java.svn-base new file mode 100644 index 0000000..4ece468 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/text-base/ReportRule.java.svn-base @@ -0,0 +1,32 @@ +package com.fp.dto.rules; + +import com.fp.dto.Request; +import com.fp.dto.query.QueryRequest; + +/** + * Clase a extender por las clases que se encargan de llenar tablas temporales a utilizar en reportes. + * + * @author Jorge Vaca + * @version 2.1 + */ +public abstract class ReportRule extends AbstractRule { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + /** + * Implementa logica de negocio a invocar para ejecutar comandos que llenan tablas para reportes especiale. + * + * @param pQueryRequest Objeto con datos utilizados en la ejecucion de un reportes. + * @throws Exception + */ + public abstract QueryRequest process(QueryRequest pQueryRequest) throws Exception; + + @Override + public Request execute(Request pRequest) throws Exception { + return this.process((QueryRequest) pRequest); + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/text-base/ScheduleRule.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/text-base/ScheduleRule.java.svn-base new file mode 100644 index 0000000..0b479a7 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/text-base/ScheduleRule.java.svn-base @@ -0,0 +1,18 @@ +package com.fp.dto.rules; + +import com.fp.dto.save.SaveRequest; +/** + * Interface a implemntar por los comandos que se ejecutan procesos calendarizados. + * @author Jorge Vaca + * @version 2.1 + */ +public interface ScheduleRule { + + /** + * Implementa logica de negocio de tareas calendarizadas. + * @param pSaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @throws Exception + */ + public void execute(SaveRequest pSaveRequest) throws Exception; + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/text-base/Service.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/text-base/Service.java.svn-base new file mode 100644 index 0000000..548386e --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/text-base/Service.java.svn-base @@ -0,0 +1,17 @@ +package com.fp.dto.rules; + +/** + * Clase a extender por las reglas de negocio que levantan demonios o servicios, ejemplo contabilizacion, task server, Scheduler + * + * @author Jorge Vaca + * @version 2.1 + */ +public abstract class Service { + + /**Metodo que levanta un demonio.*/ + public abstract void start() throws Exception; + /**Metodo que detiene o para un demonio.*/ + public abstract void stop() throws Exception; + /**Metodo que indica .*/ + public abstract boolean isrunning() throws Exception; +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/text-base/TransactionRule.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/text-base/TransactionRule.java.svn-base new file mode 100644 index 0000000..6ae96df --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/rules/.svn/text-base/TransactionRule.java.svn-base @@ -0,0 +1,41 @@ +package com.fp.dto.rules; + +import com.fp.dto.Request; +import com.fp.dto.save.SaveRequest; + +/** + * Clase a extender por los comandos que se ejecutan a nivel de transaccion. + * + * @author Jorge Vaca + * @version 2.1 + */ +public abstract class TransactionRule extends AbstractRule { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + /** + * Implementa logica de negocio a invocar cuando una transaccion se ejecuta en modo normal. + * + * @param pSaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @return SaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @throws Exception + */ + public abstract SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception; + + /** + * Implementa logica de negocio a invocar cuando una transaccion se ejecuta en modo reverso. + * + * @param pSaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @return SaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @throws Exception + */ + public abstract SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception; + + @Override + public Request execute(Request pRequest) throws Exception { + return this.normalProcess((SaveRequest) pRequest); + } +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/rules/AbstractRule.java b/base/dto/dto/src/main/java/com/fp/dto/rules/AbstractRule.java new file mode 100644 index 0000000..c0db9a5 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/rules/AbstractRule.java @@ -0,0 +1,60 @@ +package com.fp.dto.rules; + +import java.io.Serializable; + +import com.fp.dto.Request; + +public abstract class AbstractRule implements Serializable { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + public abstract Request execute(Request pRequest) throws Exception; + + protected String rule; + + /** + * Entrega el valor de rule + * + * @return Valor de rule + */ + public String getRule() { + return this.rule; + } + + /** + * Fija un nuevo valor en rule + * + * @param rule nuevo valor para rule + */ + public void setRule(String rule) { + this.rule = rule; + } + + /** + * Entrega el valor de flow + * + * @return Valor de flow + */ + public String getFlow() { + return this.flow; + } + + /** + * Fija un nuevo valor en flow + * + * @param flow nuevo valor para flow + */ + public void setFlow(String flow) { + this.flow = flow; + } + + protected String flow; + + + protected boolean isNew(Request pRequest) throws Exception { + return ("" + pRequest.get("isnew")).compareTo("Y") == 0; + } +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/rules/ExceptionRule.java b/base/dto/dto/src/main/java/com/fp/dto/rules/ExceptionRule.java new file mode 100644 index 0000000..c1608c9 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/rules/ExceptionRule.java @@ -0,0 +1,20 @@ +package com.fp.dto.rules; + +import com.fp.dto.save.SaveRequest; + +/** + * Interface a implemntar por los comandos que generan excepciones de autorizacion en las solicitudes. + * @author Jorge Vaca + * @version 2.1 + */ +public interface ExceptionRule { + + /** + * Implementa logica de negocio a invocar cuando una transaccion se ejecuta en modo normal. + * @param pSaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @return String Condicion de la excepcion. + * @throws Exception + */ + public String execute(SaveRequest pSaveRequest) throws Exception; + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/rules/QueryRule.java b/base/dto/dto/src/main/java/com/fp/dto/rules/QueryRule.java new file mode 100644 index 0000000..277f943 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/rules/QueryRule.java @@ -0,0 +1,33 @@ +package com.fp.dto.rules; + +import com.fp.dto.Request; +import com.fp.dto.query.QueryRequest; + +/** + * Clase a extender por las clases que se encargan de ejecutar consultas especiales. + * + * @author Jorge Vaca + * @version 2.1 + * + */ +public abstract class QueryRule extends AbstractRule { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + /** + * Implementa logica de negocio a invocar para ejecutar consultas especiales. + * + * @param pQueryRequest Objeto con beans utilizados en el proceso de consulta. + * @throws Exception + */ + public abstract QueryRequest process(QueryRequest pQueryRequest) throws Exception; + + @Override + public Request execute(Request pRequest) throws Exception { + return this.process((QueryRequest) pRequest); + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/rules/ReportRule.java b/base/dto/dto/src/main/java/com/fp/dto/rules/ReportRule.java new file mode 100644 index 0000000..4ece468 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/rules/ReportRule.java @@ -0,0 +1,32 @@ +package com.fp.dto.rules; + +import com.fp.dto.Request; +import com.fp.dto.query.QueryRequest; + +/** + * Clase a extender por las clases que se encargan de llenar tablas temporales a utilizar en reportes. + * + * @author Jorge Vaca + * @version 2.1 + */ +public abstract class ReportRule extends AbstractRule { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + /** + * Implementa logica de negocio a invocar para ejecutar comandos que llenan tablas para reportes especiale. + * + * @param pQueryRequest Objeto con datos utilizados en la ejecucion de un reportes. + * @throws Exception + */ + public abstract QueryRequest process(QueryRequest pQueryRequest) throws Exception; + + @Override + public Request execute(Request pRequest) throws Exception { + return this.process((QueryRequest) pRequest); + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/rules/ScheduleRule.java b/base/dto/dto/src/main/java/com/fp/dto/rules/ScheduleRule.java new file mode 100644 index 0000000..0b479a7 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/rules/ScheduleRule.java @@ -0,0 +1,18 @@ +package com.fp.dto.rules; + +import com.fp.dto.save.SaveRequest; +/** + * Interface a implemntar por los comandos que se ejecutan procesos calendarizados. + * @author Jorge Vaca + * @version 2.1 + */ +public interface ScheduleRule { + + /** + * Implementa logica de negocio de tareas calendarizadas. + * @param pSaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @throws Exception + */ + public void execute(SaveRequest pSaveRequest) throws Exception; + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/rules/Service.java b/base/dto/dto/src/main/java/com/fp/dto/rules/Service.java new file mode 100644 index 0000000..548386e --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/rules/Service.java @@ -0,0 +1,17 @@ +package com.fp.dto.rules; + +/** + * Clase a extender por las reglas de negocio que levantan demonios o servicios, ejemplo contabilizacion, task server, Scheduler + * + * @author Jorge Vaca + * @version 2.1 + */ +public abstract class Service { + + /**Metodo que levanta un demonio.*/ + public abstract void start() throws Exception; + /**Metodo que detiene o para un demonio.*/ + public abstract void stop() throws Exception; + /**Metodo que indica .*/ + public abstract boolean isrunning() throws Exception; +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/rules/TransactionRule.java b/base/dto/dto/src/main/java/com/fp/dto/rules/TransactionRule.java new file mode 100644 index 0000000..6ae96df --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/rules/TransactionRule.java @@ -0,0 +1,41 @@ +package com.fp.dto.rules; + +import com.fp.dto.Request; +import com.fp.dto.save.SaveRequest; + +/** + * Clase a extender por los comandos que se ejecutan a nivel de transaccion. + * + * @author Jorge Vaca + * @version 2.1 + */ +public abstract class TransactionRule extends AbstractRule { + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + /** + * Implementa logica de negocio a invocar cuando una transaccion se ejecuta en modo normal. + * + * @param pSaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @return SaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @throws Exception + */ + public abstract SaveRequest normalProcess(SaveRequest pSaveRequest) throws Exception; + + /** + * Implementa logica de negocio a invocar cuando una transaccion se ejecuta en modo reverso. + * + * @param pSaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @return SaveRequest Objeto con beans utilizados en el proceso de una transaccion. + * @throws Exception + */ + public abstract SaveRequest reverseProcess(SaveRequest pSaveRequest) throws Exception; + + @Override + public Request execute(Request pRequest) throws Exception { + return this.normalProcess((SaveRequest) pRequest); + } +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/rules/com/.svn/entries b/base/dto/dto/src/main/java/com/fp/dto/rules/com/.svn/entries new file mode 100644 index 0000000..c4e234b --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/rules/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/java/com/fp/dto/rules/com +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/dto/dto/src/main/java/com/fp/dto/rules/com/fp/.svn/entries b/base/dto/dto/src/main/java/com/fp/dto/rules/com/fp/.svn/entries new file mode 100644 index 0000000..baad2ab --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/rules/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/java/com/fp/dto/rules/com/fp +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +dto +dir + diff --git a/base/dto/dto/src/main/java/com/fp/dto/rules/com/fp/dto/.svn/entries b/base/dto/dto/src/main/java/com/fp/dto/rules/com/fp/dto/.svn/entries new file mode 100644 index 0000000..3456596 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/rules/com/fp/dto/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/java/com/fp/dto/rules/com/fp/dto +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/dto/dto/src/main/java/com/fp/dto/save/.svn/entries b/base/dto/dto/src/main/java/com/fp/dto/save/.svn/entries new file mode 100644 index 0000000..77f9327 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/save/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/java/com/fp/dto/save +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +SaveBean.java +file + + + + +2022-07-28T03:40:33.270762Z +cbde94016dcfd7b16e0db38d35616aaf +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6146 + +DtoSave.java +file + + + + +2022-07-28T03:40:33.270762Z +a98f27118cace9ae8d8c22b32d69bdc5 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8413 + +SaveRequest.java +file + + + + +2022-07-28T03:40:33.270762Z +883e6ef5f4f68c5781a022d8709cba95 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8760 + diff --git a/base/dto/dto/src/main/java/com/fp/dto/save/.svn/text-base/DtoSave.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/save/.svn/text-base/DtoSave.java.svn-base new file mode 100644 index 0000000..14b9605 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/save/.svn/text-base/DtoSave.java.svn-base @@ -0,0 +1,327 @@ +package com.fp.dto.save; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Date; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import com.fp.dto.AbstractDataTransport; + +/** + * Dto de transporte utilizado en insercin, eliminacin, actualizacin de datos en la base, adicionalmente permite + * transportar informacin desde el front end, la misma que ser utilizada en componentes de mantenimiento implementados + * en el back end.e. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class DtoSave implements Serializable { + + private static final long serialVersionUID = 2802444515156689856L; + + /** Nombre del bean a dar mantenimiento insert, update delete o financieros. */ + private String beanname; + + /** Lista de registros a eliminar de en la base de datos. */ + private final List ldeleted = new ArrayList(); + + /** Lista de registros a insertar en la base de datos. */ + private List linsert = new ArrayList(); + + /** Lista de objetos a modificar en la base de datos. */ + private List> lupdated = new ArrayList>(); + + /** Posicion de grabado de los registros, por tabla */ + private Integer position; + + /** Datos adicionales utilizados en el mantenimiento */ + private HashMap mdata = new HashMap(); + + /** + * Atributo para identificar si enviamos un form + */ + private boolean isForm; + + private boolean returnpk = false; + + /** + * Crea una instancia de DtoSave. + */ + public DtoSave() { + } + + public void put(String key, Object value) { + mdata.put(key, value); + } + + public Object get(String key) { + return mdata.get(key); + } + + /** + * Entrega un valor tipo String de un map. + * + * @param key Key del map a obtener un valor. + * @return String + */ + public String getString(Object key) { + // Si el valor en null retorna null. + return (String) mdata.get(key); + } + + /** + * Entrega un valor tipo Date de un map. + * + * @param key Key del map a obtener un valor. + * @return Date + */ + public Date getDate(Object key) { + return (Date) mdata.get(key); + } + + /** + * Entrega un valor tipo Integer de un map. + * + * @param key Key del map a obtener un valor. + * @return Integer + */ + public Integer getInteger(Object key) { + try { + return Integer.valueOf(mdata.get(key).toString()); + } catch (NumberFormatException e) { + // Tiene que retornar null las clases internamete tienen validaciones. + return null; + } catch (NullPointerException e) { + return null; + } + + } + + /** + * Entrega un valor tipo Long de un map. + * + * @param key Key del map a obtener un valor. + * @return Long + */ + public Long getLong(Object key) { + try { + return Long.valueOf(mdata.get(key).toString()); + } catch (NumberFormatException e) { + // Tiene que retornar null las clases internamete tienen validaciones. + return null; + } catch (NullPointerException e) { + return null; + } + } + + /** + * Entrega un valor tipo Long de un map. + * + * @param key Key del map a obtener un valor. + * @return Long + */ + public BigDecimal getBigDecimal(Object key) { + try { + return BigDecimal.valueOf(Double.valueOf(mdata.get(key).toString())); + } catch (NumberFormatException e) { + // Tiene que retornar null las clases internamete tienen validaciones. + return null; + } catch (NullPointerException e) { + return null; + } + } + + /** + * Metodo que adiciona registros a crear en la base. + * + * @param lnew Lista de datos a insertar en la base. + * @throws Exception + */ + public final void addNew(List lnew) throws Exception { + if (lnew.isEmpty()) { + return; + } + linsert.addAll(lnew); + } + + /** + * Metodo que adiciona registros a actualizar en la base. + * + * @param lupdate Lista de datos a modificar en la base. + * @throws Exception + */ + public final void addUpdated(List> lupdate) throws Exception { + if (lupdate.isEmpty()) { + return; + } + lupdated.addAll(lupdate); + } + + /** + * Metodo que adiciona registros a eliminar de la base. + * + * @param ldelete Lista de datos a eliminar en la base. + * @throws Exception + */ + public final void addDeleted(List ldelete) throws Exception { + if (ldelete.isEmpty()) { + return; + } + ldeleted.addAll(ldelete); + } + + /** + * Metodo que verifica que el bean tenga acciones a realizar en la base. + * + * @return boolean. + * @throws Exception + */ + public boolean pendingProcess() throws Exception { + if (linsert.isEmpty() && lupdated.isEmpty() && ldeleted.isEmpty()) { + return false; + } + return true; + } + + /** + * Entrega el valor de: beanname + * + * @return String + */ + public String getBeanname() { + return beanname; + } + + /** + * Fija el valor de: beanname + * + * @param Valor a fijar en el atributo. + */ + public void setBeanname(String beanname) { + this.beanname = beanname; + } + + /** + * Entrega el valor de: linsert + * + * @return List + */ + public List getLinsert() { + return linsert; + } + + /** + * Fija el valor de: linsert + * + * @param Valor a fijar en el atributo. + */ + public void setLinsert(List linsert) { + this.linsert = linsert; + } + + /** + * Entrega el valor de: lupdated + * + * @return List> + */ + public List> getLupdated() { + return lupdated; + } + + /** + * Fija el valor de: lupdated + * + * @param Valor a fijar en el atributo. + */ + public void setLupdated(List> lupdated) { + this.lupdated = lupdated; + } + + /** + * Entrega el valor de: position + * + * @return Integer + */ + public Integer getPosition() { + return position; + } + + /** + * Fija el valor de: position + * + * @param Valor a fijar en el atributo. + */ + public void setPosition(Integer position) { + this.position = position; + } + + /** + * Entrega el valor de: mdata + * + * @return HashMap + */ + public HashMap getMdata() { + return mdata; + } + + /** + * Fija el valor de: mdata + * + * @param Valor a fijar en el atributo. + */ + public void setMdata(HashMap mdata) { + this.mdata = mdata; + } + + /** + * Entrega el valor de: returnpk + * + * @return boolean + */ + public boolean isReturnpk() { + return returnpk; + } + + /** + * Fija el valor de: returnpk + * + * @param Valor a fijar en el atributo. + */ + public void setReturnpk(boolean returnpk) { + this.returnpk = returnpk; + } + + /** + * Entrega el valor de: ldeleted + * + * @return List + */ + public List getLdeleted() { + List l = new ArrayList(); + for (AbstractDataTransport obj : ldeleted) { + l.add(obj); + } + return l; + } + + /** + * Entrega V/F si es formulario + * + * @return isForm V/F + */ + public boolean isIsForm() { + return isForm; + } + + /** + * Fija V/F si es formulario + * + * @param isForm V/F + */ + public void setIsForm(boolean isForm) { + this.isForm = isForm; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/save/.svn/text-base/SaveBean.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/save/.svn/text-base/SaveBean.java.svn-base new file mode 100644 index 0000000..bf05ce3 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/save/.svn/text-base/SaveBean.java.svn-base @@ -0,0 +1,253 @@ +package com.fp.dto.save; + +import java.util.ArrayList; +import java.util.List; + +import com.fp.dto.AbstractData; +import com.fp.dto.AbstractDataTransport; + +public class SaveBean extends AbstractData { + + private static final long serialVersionUID = 1L; + + /** Alias del bean, utilizado como key en los map, si no llega el alias, el key es el nombre del bean. */ + private String beanAlias; + + /** Clase asociada al bean. */ + private String beanName; + + /** Lista de registros modificados de un bean asociado a una tabla. */ + private List modifiedRecords = new ArrayList(); + + /** Lista de registros a eliminar de la basse de datos. */ + private List deletedRecords = new ArrayList(); + + /** Objeto asociado a un registro de una tabla a insertar o actualizar en la base de datos. */ + private Object modifiedObject; + + /** Objeto asociado a un registro de una tabla a eliminar la base de datos. */ + private Object deletedObject; + + /** Orden del insert o update del objeto cuando se envia la base de datos. */ + private Integer position; + + /** true, indica que el registro se almacena en la base de datos, false no se almacena. */ + private boolean save = true; + + /** + * Crea una instancia de SaveBean. + */ + public SaveBean() { + } + + /** + * Crea una instancia de SaveBean, dado el alias del bean. + * + * @param beanName Alias del bean. + */ + public SaveBean(String beanName) { + this.beanName = beanName; + this.beanAlias = beanName; + } + + /** + * Entrega el valor de: beanAlias + * + * @return String + */ + public String getBeanAlias() { + if (beanAlias == null) { + return this.getBeanName(); + } + return beanAlias; + } + + /** + * Fija el valor de: beanAlias + * + * @param beanAlias + */ + public void setBeanAlias(String beanAlias) { + this.beanAlias = beanAlias; + } + + /** + * Entrega el valor de: beanName + * + * @return String + */ + public String getBeanName() { + return beanName; + } + + /** + * Fija el valor de: beanName + * + * @param beanName + */ + public void setBeanName(String beanName) { + this.beanName = beanName; + } + + /** + * Adiciona un elemento a la lista de objetos modificados. + * + * @param pObject Objeto a adicionar a la lista de registros modificados a enviar a almacenar en la base de datos. + * @throws Exception + */ + public void addModifiedObject(Object pObject) throws Exception { + modifiedRecords.add(pObject); + } + + public void addModifiedObject(List ldata) throws Exception { + if(!ldata.isEmpty() && ldata.size() == 1){ + modifiedObject = ldata.get(0) ; + return; + } + for (AbstractDataTransport obj : ldata) { + obj.addAddtionalInfo("isnew", "Y"); + modifiedRecords.add(obj); + } + } + + public void addModified(List ldata, boolean isForm) throws Exception { + if(!ldata.isEmpty() && ldata.size() == 1 && isForm){ + modifiedObject = ldata.get(0) ; + return; + } + for (Object object : ldata) { + AbstractDataTransport obj = (AbstractDataTransport)object; + modifiedRecords.add(obj); + } + } + + public void addInsertObject(List ldata, boolean isForm) throws Exception { + if(!ldata.isEmpty() && ldata.size() == 1 && isForm){ + modifiedObject = ldata.get(0) ; + return; + } + for (AbstractDataTransport obj : ldata) { + obj.addAddtionalInfo("isnew", "Y"); + modifiedRecords.add(obj); + } + } + + /** + * Entrega el valor de: modifiedRecords + * + * @return List + */ + public List getModifiedRecords() { + return modifiedRecords; + } + + /** + * Fija el valor de: modifiedRecords + * + * @param modifiedRecords + */ + public void setModifiedRecords(List modifiedRecords) { + this.modifiedRecords = modifiedRecords; + } + + /** + * Entrega el valor de: deletedRecords + * + * @return List + */ + public List getDeletedRecords() { + return deletedRecords; + } + + /** + * Fija el valor de: deletedRecords + * + * @param deletedRecords + */ + public void setDeletedRecords(List deletedRecords) { + this.deletedRecords = deletedRecords; + } + + /** + * Entrega el valor de: modifiedObject + * + * @return Object + */ + public Object getModifiedObject() { + return modifiedObject; + } + + /** + * Fija el valor de modifiedObject + * + * @param modifiedObject value to set + */ + public void setModifiedObject(Object modifiedObject) { + this.modifiedObject = modifiedObject; + } + + /** + * Entrega el valor de: deletedObject + * + * @return Object + */ + public Object getDeletedObject() { + return deletedObject; + } + + /** + * Fija el valor de deletedObject + * + * @param deletedObject value to set + */ + public void setDeletedObject(Object deletedObject) { + this.deletedObject = deletedObject; + } + + /** + * Entrega el valor de: position + * + * @return Integer + */ + public Integer getPosition() { + return position; + } + + /** + * Fija el valor de: position + * + * @param position + */ + public void setPosition(Integer position) { + this.position = position; + } + + /** + * Entrega el valor de: save + * + * @return the save + */ + public boolean isSave() { + return save; + } + + /** + * Fija el valor de: save + * + * @param save the save to set + */ + public void setSave(boolean save) { + this.save = save; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "SaveBean:" + this.beanName + " d:" + this.deletedRecords.size() + " m:" + this.modifiedRecords.size(); + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/save/.svn/text-base/SaveRequest.java.svn-base b/base/dto/dto/src/main/java/com/fp/dto/save/.svn/text-base/SaveRequest.java.svn-base new file mode 100644 index 0000000..e3c83bc --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/save/.svn/text-base/SaveRequest.java.svn-base @@ -0,0 +1,298 @@ +package com.fp.dto.save; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.fp.dto.Request; +import com.fp.dto.fin.FinancialRequest; + +/** + * Clase que contiene beans de insert o update de datos en la base. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class SaveRequest extends Request { + + private static final long serialVersionUID = 1L; + + /** + * indica si la consulta se origina en una pagina jsf. + */ + private boolean jsf = false; + + /** Lista de nombres de beans a almacenar en la base de datos. */ + private final List lOrderPersistentBeans = new ArrayList(); + + /* + * (non-Javadoc) + * + * @see java.util.HashMap#put(java.lang.Object, java.lang.Object) + */ + @Override + public Object put(String key, Object value) { + if (key.compareTo("beans") == 0) { + return value; + } + return super.put(key, value); + } + + /** + * Adiciona un objeto SaveBean persistente al request. + * + * @param key Alias del objeto, es el mismo que el namebean del objeto SaveBean. + * @param pObject Objeto a adicionar al SaveRequest. + * @param pPosition Posicion del objeto para grabar en la base de datos. + * @return Object + */ + @SuppressWarnings("unchecked") + public Object putSaveBean(String key, Object pObject, Integer pPosition) throws Exception { + SaveBean saveBean = null; + if (pObject instanceof SaveBean) { + saveBean = (SaveBean) pObject; + } else { + saveBean = new SaveBean(key); + if (pObject instanceof List) { + saveBean.setModifiedRecords((List) pObject); + } else { + saveBean.setModifiedObject(pObject); + } + saveBean.setPosition(pPosition); + } + if (key.compareTo("beans") == 0) { + return pObject; + } + if (pPosition == null) { + this.addObjecttoList(key); + } else { + int index = --pPosition; + if ((lOrderPersistentBeans.size() == 0) || (index > lOrderPersistentBeans.size())) { + this.addObjecttoList(key); + } else { + this.addObjecttoList(key, index); + } + } + return super.put(key, saveBean); + } + + /** + * Adiciona un key de un objeto a la lista de beans persistentes, si existe en la lista elimina el registro y lo + * adiciona. + * + * @param key Key a almacenar en la lista. + * @throws Exception + */ + private void addObjecttoList(String key) throws Exception { + if (lOrderPersistentBeans.contains(key)) { + lOrderPersistentBeans.remove(key); + } + lOrderPersistentBeans.add(key); + } + + /** + * Adiciona un key de un objeto a la lista de beans persistentes, si existe en la lista elimina el registro y lo + * adiciona. + * + * @param key Key a almacenar en la lista. + * @param index Indice con el que se almacena el key en la lista. + * @throws Exception + */ + private void addObjecttoList(String key, Integer index) throws Exception { + if (lOrderPersistentBeans.contains(key)) { + lOrderPersistentBeans.remove(key); + } + lOrderPersistentBeans.add(index, key); + } + + /** + * Adiciona un objeto SaveBean persistente al request. + * + * @param key Alias del objeto, es el mismo que el namebean del objeto SaveBean. + * @param pObject Objeto a adicionar al SaveRequest. + * @return Object + */ + @SuppressWarnings("unchecked") + public Object putSaveBean(String key, Object pObject) throws Exception { + SaveBean saveBean = null; + if (pObject instanceof SaveBean) { + saveBean = (SaveBean) pObject; + if (saveBean.getPosition() != null) { + return this.putSaveBean(key, pObject, saveBean.getPosition()); + } + } else { + saveBean = new SaveBean(key); + if (pObject instanceof List) { + saveBean.setModifiedRecords((List) pObject); + } else { + saveBean.setModifiedObject(pObject); + } + } + if (key.compareTo("beans") == 0) { + return pObject; + } + this.addObjecttoList(key); + return super.put(key, saveBean); + } + + /** + * Entrega un objeto SaveBean dado el key. + * + * @param pKey Key a buscar y entregarr el objeto. + * @return SaveBean + * @throws Exception + */ + public SaveBean getSaveBeanOLD(Object pKey) throws Exception { + return (SaveBean) super.get(pKey); + } + + /** + * Entrega un objeto SaveBean dado el key. + * + * @param pKey Key a buscar y entregarr el objeto. + * @return SaveBean + * @throws Exception + */ + public Object getSaveBeanModifiedObject(Object pKey) throws Exception { + try { + SaveBean sb = (SaveBean) super.get(pKey); + if (sb != null) { + return sb.getModifiedObject(); + } + } catch (ClassCastException e) { + return null; + } + return null; + } + + /** + * Entrega un SaveBean dato el key del objeto. Si no existe el objeto entrega null; + * + * @param pKey Key del objeto a buscar. + * @return SaveBean + * @throws Exception + */ + public SaveBean getSaveBean(Object pKey) throws Exception { + try { + return (SaveBean) super.get(pKey); + } catch (Exception e) { + return null; + } + } + + /** + * Entrega una Lista de registros modificados dado el key. + * + * @param pKey Key a buscar y entregarr el objeto. + * @return List + * @throws Exception + */ + public List getSaveBeanModifiedRecords(Object pKey) throws Exception { + List lObjects = null; + try { + SaveBean sb = (SaveBean) super.get(pKey); + if (sb == null) { + return lObjects; + } else { + lObjects = sb.getModifiedRecords(); + } + return lObjects; + } catch (ClassCastException e) { + return null; + } + + } + + /** + * Entrega una Lista de registros marcados para eliminar dado el key. + * + * @param pKey Key a buscar y entregarr el objeto. + * @return List + * @throws Exception + */ + public List getSaveBeanDeletedRecords(Object pKey) throws Exception { + List lObjects = null; + try { + SaveBean sb = (SaveBean) super.get(pKey); + if (sb == null) { + return lObjects; + } else { + lObjects = sb.getDeletedRecords(); + } + return lObjects; + } catch (ClassCastException e) { + return null; + } + } + + /** + * Entrega el valor de: beans + * + * @return Map + */ + public Map getBeans() { + Map beans = new HashMap(); + Set keys = super.keySet(); + for (String key : keys) { + Object obj = super.get(key); + if (obj instanceof SaveBean) { + beans.put(key, (SaveBean) obj); + } + } + return beans; + } + + /** + * Metodo que entrega un objeto FinancialRequest, que contiene informacion necesaria para procesar una transaccion + * financiera. + * + * @return FinancialRequest Dto que permite ejecutar transacciones financieras. + * @throws Exception + */ + public FinancialRequest getFinancialRequest() throws Exception { + FinancialRequest frequest = (FinancialRequest) this.getSaveBeanModifiedObject("FINANCIAL"); + if (frequest == null) { + return frequest; + } + super.completeFinancialRequest(frequest); + return frequest; + } + + @Override + public Set> entrySet() { + super.entrySet(); + super.remove("beans"); + return super.entrySetDefault(); + } + + /** + * Entrega una lista con el nombre de los SaveBean a realizar sentencias DML en la base de datos. + * + * @return List + * @throws Exception + */ + public List getLOrderPersistentBeans() throws Exception { + return lOrderPersistentBeans; + } + + /** + * Entrega el valor de: jsf + * + * @return boolean + */ + public boolean isJsf() { + return jsf; + } + + /** + * Fija el valor de: jsf + * + * @param Valor a fijar en el atributo. + */ + public void setJsf(boolean jsf) { + this.jsf = jsf; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/save/DtoSave.java b/base/dto/dto/src/main/java/com/fp/dto/save/DtoSave.java new file mode 100644 index 0000000..14b9605 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/save/DtoSave.java @@ -0,0 +1,327 @@ +package com.fp.dto.save; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Date; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import com.fp.dto.AbstractDataTransport; + +/** + * Dto de transporte utilizado en insercin, eliminacin, actualizacin de datos en la base, adicionalmente permite + * transportar informacin desde el front end, la misma que ser utilizada en componentes de mantenimiento implementados + * en el back end.e. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class DtoSave implements Serializable { + + private static final long serialVersionUID = 2802444515156689856L; + + /** Nombre del bean a dar mantenimiento insert, update delete o financieros. */ + private String beanname; + + /** Lista de registros a eliminar de en la base de datos. */ + private final List ldeleted = new ArrayList(); + + /** Lista de registros a insertar en la base de datos. */ + private List linsert = new ArrayList(); + + /** Lista de objetos a modificar en la base de datos. */ + private List> lupdated = new ArrayList>(); + + /** Posicion de grabado de los registros, por tabla */ + private Integer position; + + /** Datos adicionales utilizados en el mantenimiento */ + private HashMap mdata = new HashMap(); + + /** + * Atributo para identificar si enviamos un form + */ + private boolean isForm; + + private boolean returnpk = false; + + /** + * Crea una instancia de DtoSave. + */ + public DtoSave() { + } + + public void put(String key, Object value) { + mdata.put(key, value); + } + + public Object get(String key) { + return mdata.get(key); + } + + /** + * Entrega un valor tipo String de un map. + * + * @param key Key del map a obtener un valor. + * @return String + */ + public String getString(Object key) { + // Si el valor en null retorna null. + return (String) mdata.get(key); + } + + /** + * Entrega un valor tipo Date de un map. + * + * @param key Key del map a obtener un valor. + * @return Date + */ + public Date getDate(Object key) { + return (Date) mdata.get(key); + } + + /** + * Entrega un valor tipo Integer de un map. + * + * @param key Key del map a obtener un valor. + * @return Integer + */ + public Integer getInteger(Object key) { + try { + return Integer.valueOf(mdata.get(key).toString()); + } catch (NumberFormatException e) { + // Tiene que retornar null las clases internamete tienen validaciones. + return null; + } catch (NullPointerException e) { + return null; + } + + } + + /** + * Entrega un valor tipo Long de un map. + * + * @param key Key del map a obtener un valor. + * @return Long + */ + public Long getLong(Object key) { + try { + return Long.valueOf(mdata.get(key).toString()); + } catch (NumberFormatException e) { + // Tiene que retornar null las clases internamete tienen validaciones. + return null; + } catch (NullPointerException e) { + return null; + } + } + + /** + * Entrega un valor tipo Long de un map. + * + * @param key Key del map a obtener un valor. + * @return Long + */ + public BigDecimal getBigDecimal(Object key) { + try { + return BigDecimal.valueOf(Double.valueOf(mdata.get(key).toString())); + } catch (NumberFormatException e) { + // Tiene que retornar null las clases internamete tienen validaciones. + return null; + } catch (NullPointerException e) { + return null; + } + } + + /** + * Metodo que adiciona registros a crear en la base. + * + * @param lnew Lista de datos a insertar en la base. + * @throws Exception + */ + public final void addNew(List lnew) throws Exception { + if (lnew.isEmpty()) { + return; + } + linsert.addAll(lnew); + } + + /** + * Metodo que adiciona registros a actualizar en la base. + * + * @param lupdate Lista de datos a modificar en la base. + * @throws Exception + */ + public final void addUpdated(List> lupdate) throws Exception { + if (lupdate.isEmpty()) { + return; + } + lupdated.addAll(lupdate); + } + + /** + * Metodo que adiciona registros a eliminar de la base. + * + * @param ldelete Lista de datos a eliminar en la base. + * @throws Exception + */ + public final void addDeleted(List ldelete) throws Exception { + if (ldelete.isEmpty()) { + return; + } + ldeleted.addAll(ldelete); + } + + /** + * Metodo que verifica que el bean tenga acciones a realizar en la base. + * + * @return boolean. + * @throws Exception + */ + public boolean pendingProcess() throws Exception { + if (linsert.isEmpty() && lupdated.isEmpty() && ldeleted.isEmpty()) { + return false; + } + return true; + } + + /** + * Entrega el valor de: beanname + * + * @return String + */ + public String getBeanname() { + return beanname; + } + + /** + * Fija el valor de: beanname + * + * @param Valor a fijar en el atributo. + */ + public void setBeanname(String beanname) { + this.beanname = beanname; + } + + /** + * Entrega el valor de: linsert + * + * @return List + */ + public List getLinsert() { + return linsert; + } + + /** + * Fija el valor de: linsert + * + * @param Valor a fijar en el atributo. + */ + public void setLinsert(List linsert) { + this.linsert = linsert; + } + + /** + * Entrega el valor de: lupdated + * + * @return List> + */ + public List> getLupdated() { + return lupdated; + } + + /** + * Fija el valor de: lupdated + * + * @param Valor a fijar en el atributo. + */ + public void setLupdated(List> lupdated) { + this.lupdated = lupdated; + } + + /** + * Entrega el valor de: position + * + * @return Integer + */ + public Integer getPosition() { + return position; + } + + /** + * Fija el valor de: position + * + * @param Valor a fijar en el atributo. + */ + public void setPosition(Integer position) { + this.position = position; + } + + /** + * Entrega el valor de: mdata + * + * @return HashMap + */ + public HashMap getMdata() { + return mdata; + } + + /** + * Fija el valor de: mdata + * + * @param Valor a fijar en el atributo. + */ + public void setMdata(HashMap mdata) { + this.mdata = mdata; + } + + /** + * Entrega el valor de: returnpk + * + * @return boolean + */ + public boolean isReturnpk() { + return returnpk; + } + + /** + * Fija el valor de: returnpk + * + * @param Valor a fijar en el atributo. + */ + public void setReturnpk(boolean returnpk) { + this.returnpk = returnpk; + } + + /** + * Entrega el valor de: ldeleted + * + * @return List + */ + public List getLdeleted() { + List l = new ArrayList(); + for (AbstractDataTransport obj : ldeleted) { + l.add(obj); + } + return l; + } + + /** + * Entrega V/F si es formulario + * + * @return isForm V/F + */ + public boolean isIsForm() { + return isForm; + } + + /** + * Fija V/F si es formulario + * + * @param isForm V/F + */ + public void setIsForm(boolean isForm) { + this.isForm = isForm; + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/save/SaveBean.java b/base/dto/dto/src/main/java/com/fp/dto/save/SaveBean.java new file mode 100644 index 0000000..bf05ce3 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/save/SaveBean.java @@ -0,0 +1,253 @@ +package com.fp.dto.save; + +import java.util.ArrayList; +import java.util.List; + +import com.fp.dto.AbstractData; +import com.fp.dto.AbstractDataTransport; + +public class SaveBean extends AbstractData { + + private static final long serialVersionUID = 1L; + + /** Alias del bean, utilizado como key en los map, si no llega el alias, el key es el nombre del bean. */ + private String beanAlias; + + /** Clase asociada al bean. */ + private String beanName; + + /** Lista de registros modificados de un bean asociado a una tabla. */ + private List modifiedRecords = new ArrayList(); + + /** Lista de registros a eliminar de la basse de datos. */ + private List deletedRecords = new ArrayList(); + + /** Objeto asociado a un registro de una tabla a insertar o actualizar en la base de datos. */ + private Object modifiedObject; + + /** Objeto asociado a un registro de una tabla a eliminar la base de datos. */ + private Object deletedObject; + + /** Orden del insert o update del objeto cuando se envia la base de datos. */ + private Integer position; + + /** true, indica que el registro se almacena en la base de datos, false no se almacena. */ + private boolean save = true; + + /** + * Crea una instancia de SaveBean. + */ + public SaveBean() { + } + + /** + * Crea una instancia de SaveBean, dado el alias del bean. + * + * @param beanName Alias del bean. + */ + public SaveBean(String beanName) { + this.beanName = beanName; + this.beanAlias = beanName; + } + + /** + * Entrega el valor de: beanAlias + * + * @return String + */ + public String getBeanAlias() { + if (beanAlias == null) { + return this.getBeanName(); + } + return beanAlias; + } + + /** + * Fija el valor de: beanAlias + * + * @param beanAlias + */ + public void setBeanAlias(String beanAlias) { + this.beanAlias = beanAlias; + } + + /** + * Entrega el valor de: beanName + * + * @return String + */ + public String getBeanName() { + return beanName; + } + + /** + * Fija el valor de: beanName + * + * @param beanName + */ + public void setBeanName(String beanName) { + this.beanName = beanName; + } + + /** + * Adiciona un elemento a la lista de objetos modificados. + * + * @param pObject Objeto a adicionar a la lista de registros modificados a enviar a almacenar en la base de datos. + * @throws Exception + */ + public void addModifiedObject(Object pObject) throws Exception { + modifiedRecords.add(pObject); + } + + public void addModifiedObject(List ldata) throws Exception { + if(!ldata.isEmpty() && ldata.size() == 1){ + modifiedObject = ldata.get(0) ; + return; + } + for (AbstractDataTransport obj : ldata) { + obj.addAddtionalInfo("isnew", "Y"); + modifiedRecords.add(obj); + } + } + + public void addModified(List ldata, boolean isForm) throws Exception { + if(!ldata.isEmpty() && ldata.size() == 1 && isForm){ + modifiedObject = ldata.get(0) ; + return; + } + for (Object object : ldata) { + AbstractDataTransport obj = (AbstractDataTransport)object; + modifiedRecords.add(obj); + } + } + + public void addInsertObject(List ldata, boolean isForm) throws Exception { + if(!ldata.isEmpty() && ldata.size() == 1 && isForm){ + modifiedObject = ldata.get(0) ; + return; + } + for (AbstractDataTransport obj : ldata) { + obj.addAddtionalInfo("isnew", "Y"); + modifiedRecords.add(obj); + } + } + + /** + * Entrega el valor de: modifiedRecords + * + * @return List + */ + public List getModifiedRecords() { + return modifiedRecords; + } + + /** + * Fija el valor de: modifiedRecords + * + * @param modifiedRecords + */ + public void setModifiedRecords(List modifiedRecords) { + this.modifiedRecords = modifiedRecords; + } + + /** + * Entrega el valor de: deletedRecords + * + * @return List + */ + public List getDeletedRecords() { + return deletedRecords; + } + + /** + * Fija el valor de: deletedRecords + * + * @param deletedRecords + */ + public void setDeletedRecords(List deletedRecords) { + this.deletedRecords = deletedRecords; + } + + /** + * Entrega el valor de: modifiedObject + * + * @return Object + */ + public Object getModifiedObject() { + return modifiedObject; + } + + /** + * Fija el valor de modifiedObject + * + * @param modifiedObject value to set + */ + public void setModifiedObject(Object modifiedObject) { + this.modifiedObject = modifiedObject; + } + + /** + * Entrega el valor de: deletedObject + * + * @return Object + */ + public Object getDeletedObject() { + return deletedObject; + } + + /** + * Fija el valor de deletedObject + * + * @param deletedObject value to set + */ + public void setDeletedObject(Object deletedObject) { + this.deletedObject = deletedObject; + } + + /** + * Entrega el valor de: position + * + * @return Integer + */ + public Integer getPosition() { + return position; + } + + /** + * Fija el valor de: position + * + * @param position + */ + public void setPosition(Integer position) { + this.position = position; + } + + /** + * Entrega el valor de: save + * + * @return the save + */ + public boolean isSave() { + return save; + } + + /** + * Fija el valor de: save + * + * @param save the save to set + */ + public void setSave(boolean save) { + this.save = save; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "SaveBean:" + this.beanName + " d:" + this.deletedRecords.size() + " m:" + this.modifiedRecords.size(); + } + +} diff --git a/base/dto/dto/src/main/java/com/fp/dto/save/SaveRequest.java b/base/dto/dto/src/main/java/com/fp/dto/save/SaveRequest.java new file mode 100644 index 0000000..0bc4633 --- /dev/null +++ b/base/dto/dto/src/main/java/com/fp/dto/save/SaveRequest.java @@ -0,0 +1,299 @@ +package com.fp.dto.save; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.fp.dto.Request; +import com.fp.dto.fin.FinancialRequest; + +/** + * Clase que contiene beans de insert o update de datos en la base. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class SaveRequest extends Request { + + private static final long serialVersionUID = 1L; + + /** + * indica si la consulta se origina en una pagina jsf. + */ + private boolean jsf = false; + + /** Lista de nombres de beans a almacenar en la base de datos. */ + private final List lOrderPersistentBeans = new ArrayList(); + + /* + * (non-Javadoc) + * + * @see java.util.HashMap#put(java.lang.Object, java.lang.Object) + */ + @Override + public Object put(String key, Object value) { + if (key.compareTo("beans") == 0) { + return value; + } + return super.put(key, value); + } + + /** + * Adiciona un objeto SaveBean persistente al request. + * + * @param key Alias del objeto, es el mismo que el namebean del objeto SaveBean. + * @param pObject Objeto a adicionar al SaveRequest. + * @param pPosition Posicion del objeto para grabar en la base de datos. + * @return Object + */ + @SuppressWarnings("unchecked") + public Object putSaveBean(String key, Object pObject, Integer pPosition) throws Exception { + SaveBean saveBean = null; + if (pObject instanceof SaveBean) { + saveBean = (SaveBean) pObject; + } else { + saveBean = new SaveBean(key); + if (pObject instanceof List) { + saveBean.setModifiedRecords((List) pObject); + } else { + saveBean.setModifiedObject(pObject); + } + saveBean.setPosition(pPosition); + } + if (key.compareTo("beans") == 0) { + return pObject; + } + if (pPosition == null) { + this.addObjecttoList(key); + } else { + int index = --pPosition; + if ((lOrderPersistentBeans.size() == 0) || (index > lOrderPersistentBeans.size())) { + this.addObjecttoList(key); + } else { + this.addObjecttoList(key, index); + } + } + return super.put(key, saveBean); + } + + /** + * Adiciona un key de un objeto a la lista de beans persistentes, si existe en la lista elimina el registro y lo + * adiciona. + * + * @param key Key a almacenar en la lista. + * @throws Exception + */ + private void addObjecttoList(String key) throws Exception { + if (lOrderPersistentBeans.contains(key)) { + lOrderPersistentBeans.remove(key); + } + lOrderPersistentBeans.add(key); + } + + /** + * Adiciona un key de un objeto a la lista de beans persistentes, si existe en la lista elimina el registro y lo + * adiciona. + * + * @param key Key a almacenar en la lista. + * @param index Indice con el que se almacena el key en la lista. + * @throws Exception + */ + private void addObjecttoList(String key, Integer index) throws Exception { + if (lOrderPersistentBeans.contains(key)) { + lOrderPersistentBeans.remove(key); + } + lOrderPersistentBeans.add(index, key); + } + + /** + * Adiciona un objeto SaveBean persistente al request. + * + * @param key Alias del objeto, es el mismo que el namebean del objeto SaveBean. + * @param pObject Objeto a adicionar al SaveRequest. + * @return Object + */ + @SuppressWarnings("unchecked") + public Object putSaveBean(String key, Object pObject) throws Exception { + SaveBean saveBean = null; + if (pObject instanceof SaveBean) { + saveBean = (SaveBean) pObject; + if (saveBean.getPosition() != null) { + return this.putSaveBean(key, pObject, saveBean.getPosition()); + } + } else { + saveBean = new SaveBean(key); + if (pObject instanceof List) { + saveBean.setModifiedRecords((List) pObject); + } else { + saveBean.setModifiedObject(pObject); + } + } + /** ==================== ACA AGREGE KEY VALUE COMPARACION NULL*/ + if ( key !=null && key.compareTo("beans") == 0 ) { + return pObject; + } + this.addObjecttoList(key); + return super.put(key, saveBean); + } + + /** + * Entrega un objeto SaveBean dado el key. + * + * @param pKey Key a buscar y entregarr el objeto. + * @return SaveBean + * @throws Exception + */ + public SaveBean getSaveBeanOLD(Object pKey) throws Exception { + return (SaveBean) super.get(pKey); + } + + /** + * Entrega un objeto SaveBean dado el key. + * + * @param pKey Key a buscar y entregarr el objeto. + * @return SaveBean + * @throws Exception + */ + public Object getSaveBeanModifiedObject(Object pKey) throws Exception { + try { + SaveBean sb = (SaveBean) super.get(pKey); + if (sb != null) { + return sb.getModifiedObject(); + } + } catch (ClassCastException e) { + return null; + } + return null; + } + + /** + * Entrega un SaveBean dato el key del objeto. Si no existe el objeto entrega null; + * + * @param pKey Key del objeto a buscar. + * @return SaveBean + * @throws Exception + */ + public SaveBean getSaveBean(Object pKey) throws Exception { + try { + return (SaveBean) super.get(pKey); + } catch (Exception e) { + return null; + } + } + + /** + * Entrega una Lista de registros modificados dado el key. + * + * @param pKey Key a buscar y entregarr el objeto. + * @return List + * @throws Exception + */ + public List getSaveBeanModifiedRecords(Object pKey) throws Exception { + List lObjects = null; + try { + SaveBean sb = (SaveBean) super.get(pKey); + if (sb == null) { + return lObjects; + } else { + lObjects = sb.getModifiedRecords(); + } + return lObjects; + } catch (ClassCastException e) { + return null; + } + + } + + /** + * Entrega una Lista de registros marcados para eliminar dado el key. + * + * @param pKey Key a buscar y entregarr el objeto. + * @return List + * @throws Exception + */ + public List getSaveBeanDeletedRecords(Object pKey) throws Exception { + List lObjects = null; + try { + SaveBean sb = (SaveBean) super.get(pKey); + if (sb == null) { + return lObjects; + } else { + lObjects = sb.getDeletedRecords(); + } + return lObjects; + } catch (ClassCastException e) { + return null; + } + } + + /** + * Entrega el valor de: beans + * + * @return Map + */ + public Map getBeans() { + Map beans = new HashMap(); + Set keys = super.keySet(); + for (String key : keys) { + Object obj = super.get(key); + if (obj instanceof SaveBean) { + beans.put(key, (SaveBean) obj); + } + } + return beans; + } + + /** + * Metodo que entrega un objeto FinancialRequest, que contiene informacion necesaria para procesar una transaccion + * financiera. + * + * @return FinancialRequest Dto que permite ejecutar transacciones financieras. + * @throws Exception + */ + public FinancialRequest getFinancialRequest() throws Exception { + FinancialRequest frequest = (FinancialRequest) this.getSaveBeanModifiedObject("FINANCIAL"); + if (frequest == null) { + return frequest; + } + super.completeFinancialRequest(frequest); + return frequest; + } + + @Override + public Set> entrySet() { + super.entrySet(); + super.remove("beans"); + return super.entrySetDefault(); + } + + /** + * Entrega una lista con el nombre de los SaveBean a realizar sentencias DML en la base de datos. + * + * @return List + * @throws Exception + */ + public List getLOrderPersistentBeans() throws Exception { + return lOrderPersistentBeans; + } + + /** + * Entrega el valor de: jsf + * + * @return boolean + */ + public boolean isJsf() { + return jsf; + } + + /** + * Fija el valor de: jsf + * + * @param Valor a fijar en el atributo. + */ + public void setJsf(boolean jsf) { + this.jsf = jsf; + } + +} diff --git a/base/dto/dto/src/main/java/test/.svn/entries b/base/dto/dto/src/main/java/test/.svn/entries new file mode 100644 index 0000000..6d8c8b9 --- /dev/null +++ b/base/dto/dto/src/main/java/test/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/java/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/dto/dto/src/main/java/test/com/.svn/entries b/base/dto/dto/src/main/java/test/com/.svn/entries new file mode 100644 index 0000000..888299a --- /dev/null +++ b/base/dto/dto/src/main/java/test/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/java/test/com +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/dto/dto/src/main/java/test/com/fp/.svn/entries b/base/dto/dto/src/main/java/test/com/fp/.svn/entries new file mode 100644 index 0000000..ade3cfd --- /dev/null +++ b/base/dto/dto/src/main/java/test/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/java/test/com/fp +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +json +dir + diff --git a/base/dto/dto/src/main/java/test/com/fp/json/.svn/entries b/base/dto/dto/src/main/java/test/com/fp/json/.svn/entries new file mode 100644 index 0000000..4705307 --- /dev/null +++ b/base/dto/dto/src/main/java/test/com/fp/json/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/java/test/com/fp/json +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TestingBean.java +file + + + + +2022-07-28T03:40:32.861760Z +2686393862dc0e24fb4720abc2d45d49 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1714 + +TestingBean1.java +file + + + + +2022-07-28T03:40:32.861760Z +aeed3939deb6737503dd6adbe257eaf4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +893 + +TestingBeanKey.java +file + + + + +2022-07-28T03:40:32.861760Z +fcb0372cf587e07ac0fb80dfc686bdcf +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +530 + diff --git a/base/dto/dto/src/main/java/test/com/fp/json/.svn/text-base/TestingBean.java.svn-base b/base/dto/dto/src/main/java/test/com/fp/json/.svn/text-base/TestingBean.java.svn-base new file mode 100644 index 0000000..206442b --- /dev/null +++ b/base/dto/dto/src/main/java/test/com/fp/json/.svn/text-base/TestingBean.java.svn-base @@ -0,0 +1,99 @@ +package test.com.fp.json; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; + +import com.fp.dto.AbstractDataTransport; + +public class TestingBean extends AbstractDataTransport implements Cloneable { + + /** + * + */ + private static final long serialVersionUID = 1L; + private Date date; + private Timestamp timestamp; + private String string; + private int entero; + private BigDecimal amount; + private boolean flag; + private TestingBeanKey pk; + + public TestingBean() { + + } + + public TestingBean(Date date, Timestamp timestamp, String string, int entero, BigDecimal amount, boolean flag) { + this.date = date; + this.timestamp = timestamp; + this.string = string; + this.entero = entero; + this.amount = amount; + this.flag = flag; + } + + @Override + public Object cloneMe() throws CloneNotSupportedException { + TestingBean p = (TestingBean) this.clone(); + return p; + } + + public BigDecimal getAmount() { + return amount; + } + + public Date getDate() { + return date; + } + + public int getEntero() { + return entero; + } + + public TestingBeanKey getPk() { + return pk; + } + + public String getString() { + return string; + } + + public Timestamp getTimestamp() { + return timestamp; + } + + public boolean isFlag() { + return flag; + } + + public void setAmount(BigDecimal amount) { + this.amount = amount; + } + + public void setDate(Date date) { + this.date = date; + } + + public void setEntero(int entero) { + this.entero = entero; + } + + public void setFlag(boolean flag) { + this.flag = flag; + } + + public void setPk(TestingBeanKey pk) { + this.pk = pk; + } + + public void setString(String string) { + this.string = string; + } + + public void setTimestamp(Timestamp timestamp) { + this.timestamp = timestamp; + } + + +} diff --git a/base/dto/dto/src/main/java/test/com/fp/json/.svn/text-base/TestingBean1.java.svn-base b/base/dto/dto/src/main/java/test/com/fp/json/.svn/text-base/TestingBean1.java.svn-base new file mode 100644 index 0000000..00707ae --- /dev/null +++ b/base/dto/dto/src/main/java/test/com/fp/json/.svn/text-base/TestingBean1.java.svn-base @@ -0,0 +1,55 @@ +package test.com.fp.json; + +import com.fp.dto.AbstractDataTransport; + +public class TestingBean1 extends AbstractDataTransport implements Cloneable { + + /** + * + */ + private static final long serialVersionUID = 1L; + private String string; + private int entero; + private long pk; + + public TestingBean1() { + + } + + @Override + public Object cloneMe() throws CloneNotSupportedException { + TestingBean1 p = (TestingBean1) this.clone(); + return p; + } + + public TestingBean1(String string, int entero, long pk) { + this.string = string; + this.entero = entero; + this.pk = pk; + } + + public int getEntero() { + return entero; + } + + public void setEntero(int entero) { + this.entero = entero; + } + + public long getPk() { + return pk; + } + + public void setPk(long pk) { + this.pk = pk; + } + + public String getString() { + return string; + } + + public void setString(String string) { + this.string = string; + } + +} diff --git a/base/dto/dto/src/main/java/test/com/fp/json/.svn/text-base/TestingBeanKey.java.svn-base b/base/dto/dto/src/main/java/test/com/fp/json/.svn/text-base/TestingBeanKey.java.svn-base new file mode 100644 index 0000000..6969def --- /dev/null +++ b/base/dto/dto/src/main/java/test/com/fp/json/.svn/text-base/TestingBeanKey.java.svn-base @@ -0,0 +1,32 @@ +package test.com.fp.json; + +import com.fp.dto.hb.HibernateId; + +public class TestingBeanKey implements HibernateId{ + private String campo1; + private Long campo2; + + public TestingBeanKey() { + } + + public TestingBeanKey(String campo1, Long campo2) { + this.campo1 = campo1; + this.campo2 = campo2; + } + + public String getCampo1() { + return campo1; + } + + public Long getCampo2() { + return campo2; + } + + public void setCampo1(String campo1) { + this.campo1 = campo1; + } + + public void setCampo2(Long campo2) { + this.campo2 = campo2; + } +} diff --git a/base/dto/dto/src/main/java/test/com/fp/json/TestingBean.java b/base/dto/dto/src/main/java/test/com/fp/json/TestingBean.java new file mode 100644 index 0000000..206442b --- /dev/null +++ b/base/dto/dto/src/main/java/test/com/fp/json/TestingBean.java @@ -0,0 +1,99 @@ +package test.com.fp.json; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; + +import com.fp.dto.AbstractDataTransport; + +public class TestingBean extends AbstractDataTransport implements Cloneable { + + /** + * + */ + private static final long serialVersionUID = 1L; + private Date date; + private Timestamp timestamp; + private String string; + private int entero; + private BigDecimal amount; + private boolean flag; + private TestingBeanKey pk; + + public TestingBean() { + + } + + public TestingBean(Date date, Timestamp timestamp, String string, int entero, BigDecimal amount, boolean flag) { + this.date = date; + this.timestamp = timestamp; + this.string = string; + this.entero = entero; + this.amount = amount; + this.flag = flag; + } + + @Override + public Object cloneMe() throws CloneNotSupportedException { + TestingBean p = (TestingBean) this.clone(); + return p; + } + + public BigDecimal getAmount() { + return amount; + } + + public Date getDate() { + return date; + } + + public int getEntero() { + return entero; + } + + public TestingBeanKey getPk() { + return pk; + } + + public String getString() { + return string; + } + + public Timestamp getTimestamp() { + return timestamp; + } + + public boolean isFlag() { + return flag; + } + + public void setAmount(BigDecimal amount) { + this.amount = amount; + } + + public void setDate(Date date) { + this.date = date; + } + + public void setEntero(int entero) { + this.entero = entero; + } + + public void setFlag(boolean flag) { + this.flag = flag; + } + + public void setPk(TestingBeanKey pk) { + this.pk = pk; + } + + public void setString(String string) { + this.string = string; + } + + public void setTimestamp(Timestamp timestamp) { + this.timestamp = timestamp; + } + + +} diff --git a/base/dto/dto/src/main/java/test/com/fp/json/TestingBean1.java b/base/dto/dto/src/main/java/test/com/fp/json/TestingBean1.java new file mode 100644 index 0000000..00707ae --- /dev/null +++ b/base/dto/dto/src/main/java/test/com/fp/json/TestingBean1.java @@ -0,0 +1,55 @@ +package test.com.fp.json; + +import com.fp.dto.AbstractDataTransport; + +public class TestingBean1 extends AbstractDataTransport implements Cloneable { + + /** + * + */ + private static final long serialVersionUID = 1L; + private String string; + private int entero; + private long pk; + + public TestingBean1() { + + } + + @Override + public Object cloneMe() throws CloneNotSupportedException { + TestingBean1 p = (TestingBean1) this.clone(); + return p; + } + + public TestingBean1(String string, int entero, long pk) { + this.string = string; + this.entero = entero; + this.pk = pk; + } + + public int getEntero() { + return entero; + } + + public void setEntero(int entero) { + this.entero = entero; + } + + public long getPk() { + return pk; + } + + public void setPk(long pk) { + this.pk = pk; + } + + public String getString() { + return string; + } + + public void setString(String string) { + this.string = string; + } + +} diff --git a/base/dto/dto/src/main/java/test/com/fp/json/TestingBeanKey.java b/base/dto/dto/src/main/java/test/com/fp/json/TestingBeanKey.java new file mode 100644 index 0000000..6969def --- /dev/null +++ b/base/dto/dto/src/main/java/test/com/fp/json/TestingBeanKey.java @@ -0,0 +1,32 @@ +package test.com.fp.json; + +import com.fp.dto.hb.HibernateId; + +public class TestingBeanKey implements HibernateId{ + private String campo1; + private Long campo2; + + public TestingBeanKey() { + } + + public TestingBeanKey(String campo1, Long campo2) { + this.campo1 = campo1; + this.campo2 = campo2; + } + + public String getCampo1() { + return campo1; + } + + public Long getCampo2() { + return campo2; + } + + public void setCampo1(String campo1) { + this.campo1 = campo1; + } + + public void setCampo2(Long campo2) { + this.campo2 = campo2; + } +} diff --git a/base/dto/dto/src/main/resources/.svn/entries b/base/dto/dto/src/main/resources/.svn/entries new file mode 100644 index 0000000..e91144a --- /dev/null +++ b/base/dto/dto/src/main/resources/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/dto/dto/src/main/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/dto/dto/target/classes/com/fp/common/helper/BeanManager.class b/base/dto/dto/target/classes/com/fp/common/helper/BeanManager.class new file mode 100644 index 0000000..5a00182 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/common/helper/BeanManager.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/AbstractData.class b/base/dto/dto/target/classes/com/fp/dto/AbstractData.class new file mode 100644 index 0000000..ebb9707 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/AbstractData.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/AbstractDataBalanceTransport.class b/base/dto/dto/target/classes/com/fp/dto/AbstractDataBalanceTransport.class new file mode 100644 index 0000000..a081c5e Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/AbstractDataBalanceTransport.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/AbstractDataTransfer.class b/base/dto/dto/target/classes/com/fp/dto/AbstractDataTransfer.class new file mode 100644 index 0000000..e459484 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/AbstractDataTransfer.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/AbstractDataTransport.class b/base/dto/dto/target/classes/com/fp/dto/AbstractDataTransport.class new file mode 100644 index 0000000..a99f8c4 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/AbstractDataTransport.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/GeneralRequest.class b/base/dto/dto/target/classes/com/fp/dto/GeneralRequest.class new file mode 100644 index 0000000..ceef5a9 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/GeneralRequest.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/Request.class b/base/dto/dto/target/classes/com/fp/dto/Request.class new file mode 100644 index 0000000..5fe62eb Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/Request.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/Response.class b/base/dto/dto/target/classes/com/fp/dto/Response.class new file mode 100644 index 0000000..f04aec1 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/Response.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/batch/BatchAccountRequest.class b/base/dto/dto/target/classes/com/fp/dto/batch/BatchAccountRequest.class new file mode 100644 index 0000000..30dee2e Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/batch/BatchAccountRequest.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/batch/BatchModuleRequest.class b/base/dto/dto/target/classes/com/fp/dto/batch/BatchModuleRequest.class new file mode 100644 index 0000000..59e9175 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/batch/BatchModuleRequest.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/data/SaveData.class b/base/dto/dto/target/classes/com/fp/dto/data/SaveData.class new file mode 100644 index 0000000..6602969 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/data/SaveData.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/data/TransactionDTO.class b/base/dto/dto/target/classes/com/fp/dto/data/TransactionDTO.class new file mode 100644 index 0000000..d939588 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/data/TransactionDTO.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/fin/Concept.class b/base/dto/dto/target/classes/com/fp/dto/fin/Concept.class new file mode 100644 index 0000000..82e05fe Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/fin/Concept.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/fin/FinancialExchange.class b/base/dto/dto/target/classes/com/fp/dto/fin/FinancialExchange.class new file mode 100644 index 0000000..5c68fde Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/fin/FinancialExchange.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/fin/FinancialItem.class b/base/dto/dto/target/classes/com/fp/dto/fin/FinancialItem.class new file mode 100644 index 0000000..a3bcea9 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/fin/FinancialItem.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/fin/FinancialRequest.class b/base/dto/dto/target/classes/com/fp/dto/fin/FinancialRequest.class new file mode 100644 index 0000000..c5277c6 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/fin/FinancialRequest.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/hb/AbstractExpire.class b/base/dto/dto/target/classes/com/fp/dto/hb/AbstractExpire.class new file mode 100644 index 0000000..682069d Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/hb/AbstractExpire.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/hb/Cache.class b/base/dto/dto/target/classes/com/fp/dto/hb/Cache.class new file mode 100644 index 0000000..882c523 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/hb/Cache.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/hb/HibernateBean.class b/base/dto/dto/target/classes/com/fp/dto/hb/HibernateBean.class new file mode 100644 index 0000000..aa837df Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/hb/HibernateBean.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/hb/HibernateId.class b/base/dto/dto/target/classes/com/fp/dto/hb/HibernateId.class new file mode 100644 index 0000000..eeecbde Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/hb/HibernateId.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/hb/History.class b/base/dto/dto/target/classes/com/fp/dto/hb/History.class new file mode 100644 index 0000000..ecac5b0 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/hb/History.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/hb/Log.class b/base/dto/dto/target/classes/com/fp/dto/hb/Log.class new file mode 100644 index 0000000..9fd0301 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/hb/Log.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/helper/FileHelper.class b/base/dto/dto/target/classes/com/fp/dto/helper/FileHelper.class new file mode 100644 index 0000000..7ea0827 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/helper/FileHelper.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/query/AdditionalQuery.class b/base/dto/dto/target/classes/com/fp/dto/query/AdditionalQuery.class new file mode 100644 index 0000000..0d2437f Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/query/AdditionalQuery.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/query/DtoQuery.class b/base/dto/dto/target/classes/com/fp/dto/query/DtoQuery.class new file mode 100644 index 0000000..ac5162c Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/query/DtoQuery.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/query/Filter.class b/base/dto/dto/target/classes/com/fp/dto/query/Filter.class new file mode 100644 index 0000000..fc153ae Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/query/Filter.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/query/FilterTypes.class b/base/dto/dto/target/classes/com/fp/dto/query/FilterTypes.class new file mode 100644 index 0000000..82b1878 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/query/FilterTypes.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/query/QueryBean.class b/base/dto/dto/target/classes/com/fp/dto/query/QueryBean.class new file mode 100644 index 0000000..f9e635e Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/query/QueryBean.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/query/QueryCriteria.class b/base/dto/dto/target/classes/com/fp/dto/query/QueryCriteria.class new file mode 100644 index 0000000..0472937 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/query/QueryCriteria.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/query/QueryRequest.class b/base/dto/dto/target/classes/com/fp/dto/query/QueryRequest.class new file mode 100644 index 0000000..efd1d7b Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/query/QueryRequest.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/query/SubQuery.class b/base/dto/dto/target/classes/com/fp/dto/query/SubQuery.class new file mode 100644 index 0000000..b46026a Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/query/SubQuery.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/query/menu/MenuRequest.class b/base/dto/dto/target/classes/com/fp/dto/query/menu/MenuRequest.class new file mode 100644 index 0000000..4d41a69 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/query/menu/MenuRequest.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/quota/Quota.class b/base/dto/dto/target/classes/com/fp/dto/quota/Quota.class new file mode 100644 index 0000000..864ebae Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/quota/Quota.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/quota/QuotaDetail.class b/base/dto/dto/target/classes/com/fp/dto/quota/QuotaDetail.class new file mode 100644 index 0000000..7449add Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/quota/QuotaDetail.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/rules/AbstractRule.class b/base/dto/dto/target/classes/com/fp/dto/rules/AbstractRule.class new file mode 100644 index 0000000..be7404c Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/rules/AbstractRule.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/rules/ExceptionRule.class b/base/dto/dto/target/classes/com/fp/dto/rules/ExceptionRule.class new file mode 100644 index 0000000..1b96b55 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/rules/ExceptionRule.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/rules/QueryRule.class b/base/dto/dto/target/classes/com/fp/dto/rules/QueryRule.class new file mode 100644 index 0000000..ecc27e2 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/rules/QueryRule.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/rules/ReportRule.class b/base/dto/dto/target/classes/com/fp/dto/rules/ReportRule.class new file mode 100644 index 0000000..b82e80c Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/rules/ReportRule.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/rules/ScheduleRule.class b/base/dto/dto/target/classes/com/fp/dto/rules/ScheduleRule.class new file mode 100644 index 0000000..d308c88 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/rules/ScheduleRule.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/rules/Service.class b/base/dto/dto/target/classes/com/fp/dto/rules/Service.class new file mode 100644 index 0000000..2db2dd0 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/rules/Service.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/rules/TransactionRule.class b/base/dto/dto/target/classes/com/fp/dto/rules/TransactionRule.class new file mode 100644 index 0000000..66c4539 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/rules/TransactionRule.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/save/DtoSave.class b/base/dto/dto/target/classes/com/fp/dto/save/DtoSave.class new file mode 100644 index 0000000..0d6848c Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/save/DtoSave.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/save/SaveBean.class b/base/dto/dto/target/classes/com/fp/dto/save/SaveBean.class new file mode 100644 index 0000000..3dd24fb Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/save/SaveBean.class differ diff --git a/base/dto/dto/target/classes/com/fp/dto/save/SaveRequest.class b/base/dto/dto/target/classes/com/fp/dto/save/SaveRequest.class new file mode 100644 index 0000000..32b45d5 Binary files /dev/null and b/base/dto/dto/target/classes/com/fp/dto/save/SaveRequest.class differ diff --git a/base/dto/dto/target/classes/test/com/fp/json/TestingBean.class b/base/dto/dto/target/classes/test/com/fp/json/TestingBean.class new file mode 100644 index 0000000..556c5aa Binary files /dev/null and b/base/dto/dto/target/classes/test/com/fp/json/TestingBean.class differ diff --git a/base/dto/dto/target/classes/test/com/fp/json/TestingBean1.class b/base/dto/dto/target/classes/test/com/fp/json/TestingBean1.class new file mode 100644 index 0000000..2bf0a32 Binary files /dev/null and b/base/dto/dto/target/classes/test/com/fp/json/TestingBean1.class differ diff --git a/base/dto/dto/target/classes/test/com/fp/json/TestingBeanKey.class b/base/dto/dto/target/classes/test/com/fp/json/TestingBeanKey.class new file mode 100644 index 0000000..e8dc283 Binary files /dev/null and b/base/dto/dto/target/classes/test/com/fp/json/TestingBeanKey.class differ diff --git a/base/dto/dto/target/dto-2.1.jar b/base/dto/dto/target/dto-2.1.jar new file mode 100644 index 0000000..4e008b1 Binary files /dev/null and b/base/dto/dto/target/dto-2.1.jar differ diff --git a/base/dto/dto/target/maven-archiver/pom.properties b/base/dto/dto/target/maven-archiver/pom.properties new file mode 100644 index 0000000..2eeed5c --- /dev/null +++ b/base/dto/dto/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:52:37 ECT 2022 +version=2.1 +groupId=com.fp.base.dto +artifactId=dto diff --git a/base/dto/pom.xml b/base/dto/pom.xml new file mode 100644 index 0000000..a0dafe4 --- /dev/null +++ b/base/dto/pom.xml @@ -0,0 +1,32 @@ + + + + base + com.fp + 2.1 + + 4.0.0 + com.fp.base + dto + dto + 2.1 + pom + Financial Lifecycle Process + + common + dto + + + + org.apache.velocity + velocity + + + org.apache.velocity + velocity-tools + + + diff --git a/base/facade/.svn/dir-prop-base b/base/facade/.svn/dir-prop-base new file mode 100644 index 0000000..3e2a6f2 --- /dev/null +++ b/base/facade/.svn/dir-prop-base @@ -0,0 +1,9 @@ +K 10 +svn:ignore +V 37 +.classpath +.project +.settings +target + +END diff --git a/base/facade/.svn/entries b/base/facade/.svn/entries new file mode 100644 index 0000000..0649e69 --- /dev/null +++ b/base/facade/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facade +svn://172.17.26.185/COMACO + + + +2014-09-17T08:28:17.153318Z +876 +jvaca +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:25.078727Z +f3b8b39cb6a7900054dc6aa3ed648429 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2528 + diff --git a/base/facade/.svn/text-base/pom.xml.svn-base b/base/facade/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..aa3f7b2 --- /dev/null +++ b/base/facade/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,85 @@ + + + + base + com.fp + 2.1 + + 4.0.0 + com.fp.base + facade + Facade + + + + + org.jboss.spec.javax.ejb + jboss-ejb-api_3.1_spec + provided + + + org.hibernate + hibernate-core + provided + + + org.hibernate + hibernate-entitymanager + provided + + + + commons-fileupload + commons-fileupload + + + com.fp.base + facadeclient + + + + com.fp.base.core + bpm + 2.1 + + + com.fp.base.dto + dto + 2.1 + provided + + + log4j + log4j + provided + + + com.fp.base.dto + common + 2.1 + provided + + + com.fp.base.business + general + 2.1 + + + com.fp.base.persistence + util + 2.1 + + + net.sf.json-lib + json-lib + provided + + + xom + xom + provided + + + diff --git a/base/facade/pom.xml b/base/facade/pom.xml new file mode 100644 index 0000000..aa3f7b2 --- /dev/null +++ b/base/facade/pom.xml @@ -0,0 +1,85 @@ + + + + base + com.fp + 2.1 + + 4.0.0 + com.fp.base + facade + Facade + + + + + org.jboss.spec.javax.ejb + jboss-ejb-api_3.1_spec + provided + + + org.hibernate + hibernate-core + provided + + + org.hibernate + hibernate-entitymanager + provided + + + + commons-fileupload + commons-fileupload + + + com.fp.base + facadeclient + + + + com.fp.base.core + bpm + 2.1 + + + com.fp.base.dto + dto + 2.1 + provided + + + log4j + log4j + provided + + + com.fp.base.dto + common + 2.1 + provided + + + com.fp.base.business + general + 2.1 + + + com.fp.base.persistence + util + 2.1 + + + net.sf.json-lib + json-lib + provided + + + xom + xom + provided + + + diff --git a/base/facade/src/.svn/entries b/base/facade/src/.svn/entries new file mode 100644 index 0000000..8b00fe0 --- /dev/null +++ b/base/facade/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facade/src +svn://172.17.26.185/COMACO + + + +2014-09-17T08:28:17.153318Z +876 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/base/facade/src/main/.svn/entries b/base/facade/src/main/.svn/entries new file mode 100644 index 0000000..cd58e5a --- /dev/null +++ b/base/facade/src/main/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facade/src/main +svn://172.17.26.185/COMACO + + + +2014-09-17T08:28:17.153318Z +876 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/facade/src/main/java/.svn/entries b/base/facade/src/main/java/.svn/entries new file mode 100644 index 0000000..a510d28 --- /dev/null +++ b/base/facade/src/main/java/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facade/src/main/java +svn://172.17.26.185/COMACO + + + +2014-09-17T08:28:17.153318Z +876 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +META-INF +dir + +com +dir + diff --git a/base/facade/src/main/java/META-INF/.svn/entries b/base/facade/src/main/java/META-INF/.svn/entries new file mode 100644 index 0000000..47ce740 --- /dev/null +++ b/base/facade/src/main/java/META-INF/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facade/src/main/java/META-INF +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +MANIFEST.MF +file + + + + +2022-07-28T03:40:24.659725Z +1e64711d4cda5dfa351caeb25e74d938 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +52 + +ejb-jar.xml +file + + + + +2022-07-28T03:40:24.659725Z +799119297c8daeb56bac6c232addfc4c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +448 + diff --git a/base/facade/src/main/java/META-INF/.svn/text-base/MANIFEST.MF.svn-base b/base/facade/src/main/java/META-INF/.svn/text-base/MANIFEST.MF.svn-base new file mode 100644 index 0000000..6f1be26 --- /dev/null +++ b/base/facade/src/main/java/META-INF/.svn/text-base/MANIFEST.MF.svn-base @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: ejbClient.jar + diff --git a/base/facade/src/main/java/META-INF/.svn/text-base/ejb-jar.xml.svn-base b/base/facade/src/main/java/META-INF/.svn/text-base/ejb-jar.xml.svn-base new file mode 100644 index 0000000..51787a7 --- /dev/null +++ b/base/facade/src/main/java/META-INF/.svn/text-base/ejb-jar.xml.svn-base @@ -0,0 +1,6 @@ + + + + ejbmaia + facadeclient.jar + \ No newline at end of file diff --git a/base/facade/src/main/java/META-INF/MANIFEST.MF b/base/facade/src/main/java/META-INF/MANIFEST.MF new file mode 100644 index 0000000..6f1be26 --- /dev/null +++ b/base/facade/src/main/java/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: ejbClient.jar + diff --git a/base/facade/src/main/java/META-INF/ejb-jar.xml b/base/facade/src/main/java/META-INF/ejb-jar.xml new file mode 100644 index 0000000..51787a7 --- /dev/null +++ b/base/facade/src/main/java/META-INF/ejb-jar.xml @@ -0,0 +1,6 @@ + + + + ejbmaia + facadeclient.jar + \ No newline at end of file diff --git a/base/facade/src/main/java/com/.svn/entries b/base/facade/src/main/java/com/.svn/entries new file mode 100644 index 0000000..95c079f --- /dev/null +++ b/base/facade/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facade/src/main/java/com +svn://172.17.26.185/COMACO + + + +2014-09-17T08:28:17.153318Z +876 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/facade/src/main/java/com/fp/.svn/entries b/base/facade/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..26135ac --- /dev/null +++ b/base/facade/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facade/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-09-17T08:28:17.153318Z +876 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +facade +dir + diff --git a/base/facade/src/main/java/com/fp/facade/.svn/entries b/base/facade/src/main/java/com/fp/facade/.svn/entries new file mode 100644 index 0000000..60df937 --- /dev/null +++ b/base/facade/src/main/java/com/fp/facade/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facade/src/main/java/com/fp/facade +svn://172.17.26.185/COMACO + + + +2014-09-17T08:28:17.153318Z +876 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ejb +dir + +db +dir + diff --git a/base/facade/src/main/java/com/fp/facade/db/.svn/entries b/base/facade/src/main/java/com/fp/facade/db/.svn/entries new file mode 100644 index 0000000..4b04378 --- /dev/null +++ b/base/facade/src/main/java/com/fp/facade/db/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facade/src/main/java/com/fp/facade/db +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +DataHelper.java +file + + + + +2022-07-28T03:40:24.812725Z +453ef9b5ef769162aaa728a10f52393a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +625 + diff --git a/base/facade/src/main/java/com/fp/facade/db/.svn/text-base/DataHelper.java.svn-base b/base/facade/src/main/java/com/fp/facade/db/.svn/text-base/DataHelper.java.svn-base new file mode 100644 index 0000000..8e41b23 --- /dev/null +++ b/base/facade/src/main/java/com/fp/facade/db/.svn/text-base/DataHelper.java.svn-base @@ -0,0 +1,29 @@ +package com.fp.facade.db; + +/** + * Clase utilitaria que maneje sql y hql utiliada en el proyecto accounting + * @author scastillo + */ +public class DataHelper { + + /** + * Almacena una instancia de DataHelper. + */ + private static DataHelper cache; + + /** + * Entrega una instancia de DataHelper. + * @return DataHelper + */ + public static DataHelper getInstance() { + if (cache != null) { + return cache; + } + synchronized (DataHelper.class) { + if (cache == null) { + cache = new DataHelper(); + } + } + return cache; + } +} diff --git a/base/facade/src/main/java/com/fp/facade/db/DataHelper.java b/base/facade/src/main/java/com/fp/facade/db/DataHelper.java new file mode 100644 index 0000000..8e41b23 --- /dev/null +++ b/base/facade/src/main/java/com/fp/facade/db/DataHelper.java @@ -0,0 +1,29 @@ +package com.fp.facade.db; + +/** + * Clase utilitaria que maneje sql y hql utiliada en el proyecto accounting + * @author scastillo + */ +public class DataHelper { + + /** + * Almacena una instancia de DataHelper. + */ + private static DataHelper cache; + + /** + * Entrega una instancia de DataHelper. + * @return DataHelper + */ + public static DataHelper getInstance() { + if (cache != null) { + return cache; + } + synchronized (DataHelper.class) { + if (cache == null) { + cache = new DataHelper(); + } + } + return cache; + } +} diff --git a/base/facade/src/main/java/com/fp/facade/ejb/.svn/entries b/base/facade/src/main/java/com/fp/facade/ejb/.svn/entries new file mode 100644 index 0000000..0ced8ca --- /dev/null +++ b/base/facade/src/main/java/com/fp/facade/ejb/.svn/entries @@ -0,0 +1,235 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facade/src/main/java/com/fp/facade/ejb +svn://172.17.26.185/COMACO + + + +2014-09-17T08:28:17.153318Z +876 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +helper +dir + +QueryWithCommitBean.java +file + + + + +2022-07-28T03:40:24.790725Z +b1179e2dc8df4364c0a00bd1db5fb185 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2000 + +ReportBean.java +file + + + + +2022-07-28T03:40:24.790725Z +a28a2e9db1bb081dcf1c74015f7d0155 +2014-09-17T08:28:17.153318Z +876 +jvaca + + + + + + + + + + + + + + + + + + + + + +2676 + +SaveBean.java +file + + + + +2022-07-28T03:40:24.791725Z +0aca071598efb61d221b3dee6b17dea4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1967 + +JobsIniciatorBean.java +file + + + + +2022-07-28T03:40:24.791725Z +4950cacabe6aee8fa966b029be3aa014 +2014-09-11T06:58:31.794658Z +663 +jvaca + + + + + + + + + + + + + + + + + + + + + +2640 + +FacadeBean.java +file + + + + +2022-07-28T03:40:24.791725Z +32051ec7811c753e8c46c5447aa3c0cf +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6903 + +QueryBean.java +file + + + + +2022-07-28T03:40:24.791725Z +268b9c028d41fe93f6db0cc7d101d280 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2107 + diff --git a/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/FacadeBean.java.netbeans-base b/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/FacadeBean.java.netbeans-base new file mode 100644 index 0000000..a3b1c92 --- /dev/null +++ b/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/FacadeBean.java.netbeans-base @@ -0,0 +1,179 @@ +package com.fp.facade.ejb; + +import java.lang.reflect.Method; +import java.sql.SQLException; +import java.util.List; + +import javax.ejb.Stateless; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; +import javax.ejb.TransactionManagement; +import javax.ejb.TransactionManagementType; +import javax.persistence.EntityManager; + +import net.sf.json.JSONObject; + +import com.fp.bpm.EngineExecutor; +import com.fp.bpm.report.ReportProcessor; +import com.fp.common.exception.APPException; +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.fin.MessageGenerator; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Response; +import com.fp.dto.helper.FileHelper; +import com.fp.dto.json.Serializer; +import com.fp.dto.query.QueryRequest; +import com.fp.facade.ejb.helper.BeanHelper; +import com.fp.facadeclient.ejb.FacadeBeanRemote; +import com.fp.general.security.rules.CloseAllSessions; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; + +/** + * Session Bean implementation class FacadeBean + */ +@Stateless(name = "facadebean") +@TransactionManagement(value = TransactionManagementType.BEAN) +public class FacadeBean extends BeanHelper implements FacadeBeanRemote { + + // @PersistenceContext(unitName="ejb") + // EntityManager em; + + /** + * Metodo que permite verificar que el servicio este activo. + * + * @param pData Datos con los que se procesa la transaccion. + * @return Object + * @throws Exception + */ + @Override + public Object ping(String pData) throws Exception { + try { + this.fillThreadFacade(this.getCompany(pData)); + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + Response res = new Response(Response.RESPONSE_OK, "OK" + pData); + Serializer ser = new Serializer(res); + return ser.toJSON(); + } catch (Exception e) { + throw e; + } finally { + //PersistenceHelper.closeSession(); + } + + } + + /** + * Metodo que se encarga de la ejecucion de una accion. + * + * @param pData Datos con los que se procesa la transaccion. + * @param pFileItems Lista de archivos o imagenes a almacenar en la base. + * @return Object + * @throws Exception + */ + @Override + @TransactionAttribute(TransactionAttributeType.REQUIRED) + public Object process(String pData, List pFileItems) throws Throwable { + this.fillThreadFacade(this.getCompany(pData)); + JSONObject response = new JSONObject(); + // Para obtener un EntityManager dinamico + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + try { + BeanHelper.cleanThreadLocal(); + PersistenceHelper.beginTransaction(); + EngineExecutor ee = new EngineExecutor(); + String resp = ee.process(pData, pFileItems).toString(); + // em.flush(); + PersistenceHelper.commitTransaction(); + return resp; + } catch (Throwable e) { + APPLogger.getLogger().warn(e, e); + PersistenceHelper.rollbackTransaction(); + try { + this.fillError(e, response, pData); + } catch (Throwable e1) { + APPLogger.getLogger().warn(e1, e1); + } + return response.toString(); + } finally { + PersistenceHelper.closeSession(); + } + } + + private void fillError(Throwable e, Object pResponse, String pData) throws Exception { + JSONObject response = (JSONObject) pResponse; + APPLogger.getLogger().error("\nRequest:==>\n" + pData); + ExceptionHandler eh = new ExceptionHandler(e, "es"); + String usrmsg = eh.getUserMessage(); + APPLogger.getLogger().error("User Message:==>\n" + usrmsg); + response.put("message", usrmsg); + response.put("messageCode", eh.getCode()); + response.put("isAplicationMessage", eh.isAppexception()); + response.put("trace", eh.getTechnicalMessage()); + if ((e instanceof APPException) || (e instanceof SQLException)) { + response.put("stackTrace", eh.getTechnicalMessage()); + } else { + response.put("stackTrace", eh.getStackTrace()); + APPLogger.getLogger().error("StackTrace:==>" + eh.getStackTrace()); + } + } + + + /** + * Metodo que se encarga de expirar sessiones de usuario. + * + * @param host IP del servidor web + */ + @Override + public void expireSessions(String host) throws Exception { + try { + this.fillThreadFacade(this.getCompany(null)); + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + PersistenceHelper.beginTransaction(); + CloseAllSessions.getInstance().expireSessions(host); + PersistenceHelper.commitTransaction(); + } catch (Exception e) { + PersistenceHelper.rollbackTransaction(); + APPLogger.getLogger().error("expireSessions==> " + e); + } finally { + PersistenceHelper.closeSession(); + } + } + + /** + * Metodo que se encarga de ejecutar y/o llenar tablas temporales para la ejeucion de reportes. + * + * @param pQueryRequest Datos de la consulta del reporte. + * @throws Exception + */ + @Override + public Object reportProcessor(Object pQueryRequest) throws Exception { + JSONObject response = new JSONObject(); + try { + QueryRequest queryReq = (QueryRequest) pQueryRequest; + this.fillThreadFacade(queryReq.getCompany()); + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + PersistenceHelper.beginTransaction(); + Response res = new Response(Response.RESPONSE_OK, "OK"); + queryReq.setResponse(res); + MessageGenerator mg = MessageGenerator.getInstance(); + queryReq.setJournalId(mg.generateId(queryReq.getUser())); + ReportProcessor rp = new ReportProcessor(); + rp.process(queryReq); + PersistenceHelper.commitTransaction(); + Serializer ser = new Serializer(res); + return ser.toJSON(); + } catch (Exception e) { + PersistenceHelper.rollbackTransaction(); + this.fillError(e, response, ""); + } finally { + PersistenceHelper.closeSession(); + } + return response.toString(); + + } + +} diff --git a/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/FacadeBean.java.svn-base b/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/FacadeBean.java.svn-base new file mode 100644 index 0000000..a3b1c92 --- /dev/null +++ b/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/FacadeBean.java.svn-base @@ -0,0 +1,179 @@ +package com.fp.facade.ejb; + +import java.lang.reflect.Method; +import java.sql.SQLException; +import java.util.List; + +import javax.ejb.Stateless; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; +import javax.ejb.TransactionManagement; +import javax.ejb.TransactionManagementType; +import javax.persistence.EntityManager; + +import net.sf.json.JSONObject; + +import com.fp.bpm.EngineExecutor; +import com.fp.bpm.report.ReportProcessor; +import com.fp.common.exception.APPException; +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.fin.MessageGenerator; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Response; +import com.fp.dto.helper.FileHelper; +import com.fp.dto.json.Serializer; +import com.fp.dto.query.QueryRequest; +import com.fp.facade.ejb.helper.BeanHelper; +import com.fp.facadeclient.ejb.FacadeBeanRemote; +import com.fp.general.security.rules.CloseAllSessions; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; + +/** + * Session Bean implementation class FacadeBean + */ +@Stateless(name = "facadebean") +@TransactionManagement(value = TransactionManagementType.BEAN) +public class FacadeBean extends BeanHelper implements FacadeBeanRemote { + + // @PersistenceContext(unitName="ejb") + // EntityManager em; + + /** + * Metodo que permite verificar que el servicio este activo. + * + * @param pData Datos con los que se procesa la transaccion. + * @return Object + * @throws Exception + */ + @Override + public Object ping(String pData) throws Exception { + try { + this.fillThreadFacade(this.getCompany(pData)); + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + Response res = new Response(Response.RESPONSE_OK, "OK" + pData); + Serializer ser = new Serializer(res); + return ser.toJSON(); + } catch (Exception e) { + throw e; + } finally { + //PersistenceHelper.closeSession(); + } + + } + + /** + * Metodo que se encarga de la ejecucion de una accion. + * + * @param pData Datos con los que se procesa la transaccion. + * @param pFileItems Lista de archivos o imagenes a almacenar en la base. + * @return Object + * @throws Exception + */ + @Override + @TransactionAttribute(TransactionAttributeType.REQUIRED) + public Object process(String pData, List pFileItems) throws Throwable { + this.fillThreadFacade(this.getCompany(pData)); + JSONObject response = new JSONObject(); + // Para obtener un EntityManager dinamico + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + try { + BeanHelper.cleanThreadLocal(); + PersistenceHelper.beginTransaction(); + EngineExecutor ee = new EngineExecutor(); + String resp = ee.process(pData, pFileItems).toString(); + // em.flush(); + PersistenceHelper.commitTransaction(); + return resp; + } catch (Throwable e) { + APPLogger.getLogger().warn(e, e); + PersistenceHelper.rollbackTransaction(); + try { + this.fillError(e, response, pData); + } catch (Throwable e1) { + APPLogger.getLogger().warn(e1, e1); + } + return response.toString(); + } finally { + PersistenceHelper.closeSession(); + } + } + + private void fillError(Throwable e, Object pResponse, String pData) throws Exception { + JSONObject response = (JSONObject) pResponse; + APPLogger.getLogger().error("\nRequest:==>\n" + pData); + ExceptionHandler eh = new ExceptionHandler(e, "es"); + String usrmsg = eh.getUserMessage(); + APPLogger.getLogger().error("User Message:==>\n" + usrmsg); + response.put("message", usrmsg); + response.put("messageCode", eh.getCode()); + response.put("isAplicationMessage", eh.isAppexception()); + response.put("trace", eh.getTechnicalMessage()); + if ((e instanceof APPException) || (e instanceof SQLException)) { + response.put("stackTrace", eh.getTechnicalMessage()); + } else { + response.put("stackTrace", eh.getStackTrace()); + APPLogger.getLogger().error("StackTrace:==>" + eh.getStackTrace()); + } + } + + + /** + * Metodo que se encarga de expirar sessiones de usuario. + * + * @param host IP del servidor web + */ + @Override + public void expireSessions(String host) throws Exception { + try { + this.fillThreadFacade(this.getCompany(null)); + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + PersistenceHelper.beginTransaction(); + CloseAllSessions.getInstance().expireSessions(host); + PersistenceHelper.commitTransaction(); + } catch (Exception e) { + PersistenceHelper.rollbackTransaction(); + APPLogger.getLogger().error("expireSessions==> " + e); + } finally { + PersistenceHelper.closeSession(); + } + } + + /** + * Metodo que se encarga de ejecutar y/o llenar tablas temporales para la ejeucion de reportes. + * + * @param pQueryRequest Datos de la consulta del reporte. + * @throws Exception + */ + @Override + public Object reportProcessor(Object pQueryRequest) throws Exception { + JSONObject response = new JSONObject(); + try { + QueryRequest queryReq = (QueryRequest) pQueryRequest; + this.fillThreadFacade(queryReq.getCompany()); + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + PersistenceHelper.beginTransaction(); + Response res = new Response(Response.RESPONSE_OK, "OK"); + queryReq.setResponse(res); + MessageGenerator mg = MessageGenerator.getInstance(); + queryReq.setJournalId(mg.generateId(queryReq.getUser())); + ReportProcessor rp = new ReportProcessor(); + rp.process(queryReq); + PersistenceHelper.commitTransaction(); + Serializer ser = new Serializer(res); + return ser.toJSON(); + } catch (Exception e) { + PersistenceHelper.rollbackTransaction(); + this.fillError(e, response, ""); + } finally { + PersistenceHelper.closeSession(); + } + return response.toString(); + + } + +} diff --git a/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/JobsIniciatorBean.java.svn-base b/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/JobsIniciatorBean.java.svn-base new file mode 100644 index 0000000..c4e29cf --- /dev/null +++ b/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/JobsIniciatorBean.java.svn-base @@ -0,0 +1,84 @@ +package com.fp.facade.ejb; + +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.ejb.Singleton; +import javax.ejb.Startup; +import javax.persistence.EntityManager; + +import com.fp.base.persistence.util.job.ServiceManager; +import com.fp.common.logger.APPLogger; +import com.fp.facade.ejb.helper.BeanHelper; +import com.fp.general.scheduler.MiaScheduler; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; + +@Singleton +@Startup +public class JobsIniciatorBean extends BeanHelper { + + /** Variable que controla que los job's inicien. */ + private boolean iniciar = false; + private MiaScheduler ms; + @PostConstruct + protected void iniciartareas() { + if (!iniciar) { + APPLogger.getLogger().error("INICIA EJECUCION DE TAREAS O DEMONIOS EN EL SERVIDOR"); + try { + this.startJobs(); + iniciar = true; + } catch (Exception e) { + APPLogger.getLogger().error(e.getStackTrace()); + } + + } + + } + + /** + * Metodo que inicia el Job de tareas automaticas. + * + * @throws Exception + */ + public void startJobs() throws Exception { + this.fillThreadFacade(this.getCompany(null)); + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + try { + APPLogger.getLogger().error("Inicia Servidor Contable"); + ServiceManager sm = new ServiceManager(); + // Inicia tareas automaticas. + sm.autoamaticInit(); + APPLogger.getLogger().error("Servidor Contable ok"); + } catch (Exception e) { + } finally { + PersistenceHelper.closeSession(); + } + this.scheduleJObs(); + + } + + /** + * Metodo que inicia la ejeciucion de tareas calendarizadas. + * + * @throws Exception + */ + private void scheduleJObs() throws Exception { + this.fillThreadFacade(this.getCompany(null)); + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + try { + // Levanta ejecutor de tareas calendarizadas. + MiaScheduler ms = new MiaScheduler(); + ms.init(); + } catch (Exception e) { + } finally { + PersistenceHelper.closeSession(); + } + } + + @PreDestroy + private void detenerJobs() throws Exception{ + ms.detenerJob(); + } +} diff --git a/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/QueryBean.java.netbeans-base b/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/QueryBean.java.netbeans-base new file mode 100644 index 0000000..55b02f4 --- /dev/null +++ b/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/QueryBean.java.netbeans-base @@ -0,0 +1,61 @@ +package com.fp.facade.ejb; + +import javax.ejb.Stateless; +import javax.ejb.TransactionManagement; +import javax.ejb.TransactionManagementType; +import javax.persistence.EntityManager; + +import com.fp.bpm.actions.QueryAction; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.facade.ejb.helper.BeanHelper; +import com.fp.facadeclient.ejb.FacadeBeanJsfRemote; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; + +/** + * Ejb, que actua como fachada de transacciones de consulta. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@Stateless(name = "querybean") +@TransactionManagement(value = TransactionManagementType.BEAN) +public class QueryBean extends BeanHelper implements FacadeBeanJsfRemote { + + /** + * Metodo que se encarga de la ejecucion de una accion. + * + * @param request Request con los datos necesarios para ejecutar una accion, consulta o mantenimiento. + * @return Object + * @throws Exception + */ + @Override + public Object process(Request request) throws Throwable { + this.fillThreadFacade(request.getCompany()); + Object resp = null; + // Para obtener un EntityManager dinamico + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + try { + BeanHelper.cleanThreadLocal(); + // PersistenceHelper.beginTransaction(); + QueryAction qa = new QueryAction(); + resp = qa.process(request); + // PersistenceHelper.commitTransaction(); + return resp; + } catch (Throwable e) { + APPLogger.getLogger().warn(e, e); + // PersistenceHelper.rollbackTransaction(); + try { + return BeanHelper.fillError(e); + } catch (Throwable e1) { + APPLogger.getLogger().warn(e1, e1); + throw e1; + } + } finally { + PersistenceHelper.closeSession(); + } + } + +} diff --git a/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/QueryBean.java.svn-base b/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/QueryBean.java.svn-base new file mode 100644 index 0000000..55b02f4 --- /dev/null +++ b/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/QueryBean.java.svn-base @@ -0,0 +1,61 @@ +package com.fp.facade.ejb; + +import javax.ejb.Stateless; +import javax.ejb.TransactionManagement; +import javax.ejb.TransactionManagementType; +import javax.persistence.EntityManager; + +import com.fp.bpm.actions.QueryAction; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.facade.ejb.helper.BeanHelper; +import com.fp.facadeclient.ejb.FacadeBeanJsfRemote; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; + +/** + * Ejb, que actua como fachada de transacciones de consulta. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@Stateless(name = "querybean") +@TransactionManagement(value = TransactionManagementType.BEAN) +public class QueryBean extends BeanHelper implements FacadeBeanJsfRemote { + + /** + * Metodo que se encarga de la ejecucion de una accion. + * + * @param request Request con los datos necesarios para ejecutar una accion, consulta o mantenimiento. + * @return Object + * @throws Exception + */ + @Override + public Object process(Request request) throws Throwable { + this.fillThreadFacade(request.getCompany()); + Object resp = null; + // Para obtener un EntityManager dinamico + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + try { + BeanHelper.cleanThreadLocal(); + // PersistenceHelper.beginTransaction(); + QueryAction qa = new QueryAction(); + resp = qa.process(request); + // PersistenceHelper.commitTransaction(); + return resp; + } catch (Throwable e) { + APPLogger.getLogger().warn(e, e); + // PersistenceHelper.rollbackTransaction(); + try { + return BeanHelper.fillError(e); + } catch (Throwable e1) { + APPLogger.getLogger().warn(e1, e1); + throw e1; + } + } finally { + PersistenceHelper.closeSession(); + } + } + +} diff --git a/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/QueryWithCommitBean.java.svn-base b/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/QueryWithCommitBean.java.svn-base new file mode 100644 index 0000000..e40944f --- /dev/null +++ b/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/QueryWithCommitBean.java.svn-base @@ -0,0 +1,55 @@ +package com.fp.facade.ejb; + +import javax.ejb.Stateless; +import javax.ejb.TransactionManagement; +import javax.ejb.TransactionManagementType; +import javax.persistence.EntityManager; + +import com.fp.bpm.actions.QueryAction; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.facade.ejb.helper.BeanHelper; +import com.fp.facadeclient.ejb.FacadeBeanJsfRemote; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; + +@Stateless(name = "querywithcommitbean") +@TransactionManagement(value = TransactionManagementType.BEAN) +public class QueryWithCommitBean extends BeanHelper implements FacadeBeanJsfRemote { + + /** + * Metodo que se encarga de la ejecucion de una accion. + * + * @param request Request con los datos necesarios para ejecutar una accion, consulta o mantenimiento. + * @return Object + * @throws Exception + */ + @Override + public Object process(Request request) throws Throwable { + this.fillThreadFacade(request.getCompany()); + Object resp = null; + // Para obtener un EntityManager dinamico + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + try { + BeanHelper.cleanThreadLocal(); + PersistenceHelper.beginTransaction(); + QueryAction qa = new QueryAction(); + resp = qa.process(request); + PersistenceHelper.commitTransaction(); + return resp; + } catch (Throwable e) { + APPLogger.getLogger().warn(e, e); + PersistenceHelper.rollbackTransaction(); + try { + return BeanHelper.fillError(e); + } catch (Throwable e1) { + APPLogger.getLogger().warn(e1, e1); + throw e1; + } + } finally { + PersistenceHelper.closeSession(); + } + } + +} diff --git a/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/ReportBean.java.svn-base b/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/ReportBean.java.svn-base new file mode 100644 index 0000000..7f26cda --- /dev/null +++ b/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/ReportBean.java.svn-base @@ -0,0 +1,71 @@ +package com.fp.facade.ejb; + +import javax.ejb.Stateless; +import javax.ejb.TransactionManagement; +import javax.ejb.TransactionManagementType; +import javax.persistence.EntityManager; + +import com.fp.bpm.report.ReportProcessor; +import com.fp.common.fin.MessageGenerator; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.facade.ejb.helper.BeanHelper; +import com.fp.facadeclient.ejb.FacadeBeanJsfRemote; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; + +@Stateless(name = "reportbean") +@TransactionManagement(value = TransactionManagementType.BEAN) +public class ReportBean extends BeanHelper implements FacadeBeanJsfRemote { + + /** + * Metodo que se encarga de la ejecucion de una accion. + * @param request Request con los datos necesarios para ejecutar una accion, consulta o mantenimiento. + * @return Object + * @throws Exception + */ + @Override + public Object process(Request request) throws Throwable{ + this.fillThreadFacade(request.getCompany()); + Object resp = null; + // Para obtener un EntityManager dinamico + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + Response response = new Response(Response.RESPONSE_OK, "OK"); + try { + BeanHelper.cleanThreadLocal(); + QueryRequest qr = new QueryRequest(); + request.copy(qr); + request.copyMapValues(qr); + + qr.setQueryTables(request.getQueryTables()); + qr.setJsf(true); + qr.setResponse(response); + qr.putAll(request.getModifiedData()); //campos del request codigo de consuta. + // fija numero de mensaje + MessageGenerator mg = MessageGenerator.getInstance(); + qr.setJournalId(mg.generateId(qr.getUser())); + + PersistenceHelper.beginTransaction(); + ReportProcessor rp = new ReportProcessor(); + resp = rp.process(qr); + PersistenceHelper.commitTransaction(); + return resp; + } catch (Throwable e) { + APPLogger.getLogger().warn(e, e); + //PersistenceHelper.rollbackTransaction(); + try { + return BeanHelper.fillError(e); + } catch (Throwable e1) { + APPLogger.getLogger().warn(e1, e1); + throw e1; + } + } finally { + PersistenceHelper.closeSession(); + } + } + + +} diff --git a/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/SaveBean.java.svn-base b/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/SaveBean.java.svn-base new file mode 100644 index 0000000..7921e41 --- /dev/null +++ b/base/facade/src/main/java/com/fp/facade/ejb/.svn/text-base/SaveBean.java.svn-base @@ -0,0 +1,54 @@ +package com.fp.facade.ejb; + +import javax.ejb.Stateless; +import javax.ejb.TransactionManagement; +import javax.ejb.TransactionManagementType; +import javax.persistence.EntityManager; + +import com.fp.bpm.actions.SaveAction; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.facade.ejb.helper.BeanHelper; +import com.fp.facadeclient.ejb.FacadeBeanJsfRemote; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; + +@Stateless(name = "savebean") +@TransactionManagement(value = TransactionManagementType.BEAN) +public class SaveBean extends BeanHelper implements FacadeBeanJsfRemote { + + /** + * Metodo que se encarga de la ejecucion de una accion. + * @param request Request con los datos necesarios para ejecutar una accion, consulta o mantenimiento. + * @return Object + * @throws Exception + */ + public Object process(Request request) throws Throwable{ + this.fillThreadFacade(request.getCompany()); + Object resp = null; + // Para obtener un EntityManager dinamico + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + try { + BeanHelper.cleanThreadLocal(); + PersistenceHelper.beginTransaction(); + SaveAction sa = new SaveAction(); + resp = sa.process(request); + PersistenceHelper.commitTransaction(); + return resp; + } catch (Throwable e) { + APPLogger.getLogger().warn(e, e); + PersistenceHelper.rollbackTransaction(); + try { + return BeanHelper.fillError(e); + } catch (Throwable e1) { + APPLogger.getLogger().warn(e1, e1); + throw e1; + } + } finally { + PersistenceHelper.closeSession(); + } + } + + +} diff --git a/base/facade/src/main/java/com/fp/facade/ejb/FacadeBean.java b/base/facade/src/main/java/com/fp/facade/ejb/FacadeBean.java new file mode 100644 index 0000000..9049b2d --- /dev/null +++ b/base/facade/src/main/java/com/fp/facade/ejb/FacadeBean.java @@ -0,0 +1,179 @@ +package com.fp.facade.ejb; + +import java.lang.reflect.Method; +import java.sql.SQLException; +import java.util.List; + +import javax.ejb.Stateless; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; +import javax.ejb.TransactionManagement; +import javax.ejb.TransactionManagementType; +import javax.persistence.EntityManager; + +import net.sf.json.JSONObject; + +import com.fp.bpm.EngineExecutor; +import com.fp.bpm.report.ReportProcessor; +import com.fp.common.exception.APPException; +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.fin.MessageGenerator; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Response; +import com.fp.dto.helper.FileHelper; +import com.fp.dto.json.Serializer; +import com.fp.dto.query.QueryRequest; +import com.fp.facade.ejb.helper.BeanHelper; +import com.fp.facadeclient.ejb.FacadeBeanRemote; +import com.fp.general.security.rules.CloseAllSessions; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; + +/** + * Session Bean implementation class FacadeBean + */ +@Stateless(name = "facadebean") +@TransactionManagement(value = TransactionManagementType.BEAN) +public class FacadeBean extends BeanHelper implements FacadeBeanRemote { + + // @PersistenceContext(unitName="ejb") + // EntityManager em; + + /** + * Metodo que permite verificar que el servicio este activo. + * + * @param pData Datos con los que se procesa la transaccion. + * @return Object + * @throws Exception + */ + @Override + public Object ping(String pData) throws Exception { + try { + this.fillThreadFacade(this.getCompany(pData)); + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + Response res = new Response(Response.RESPONSE_OK, "OK" + pData); + Serializer ser = new Serializer(res); + return ser.toJSON(); + } catch (Exception e) { + throw e; + } finally { + //PersistenceHelper.closeSession(); + } + + } + + /** + * Metodo que se encarga de la ejecucion de una accion. + * + * @param pData Datos con los que se procesa la transaccion. + * @param pFileItems Lista de archivos o imagenes a almacenar en la base. + * @return Object + * @throws Exception + */ + @Override + @TransactionAttribute(TransactionAttributeType.REQUIRED) + public Object process(String pData, List pFileItems) throws Throwable { + this.fillThreadFacade(this.getCompany(pData)); + JSONObject response = new JSONObject(); + // Para obtener un EntityManager dinamico + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + try { + BeanHelper.cleanThreadLocal(); + PersistenceHelper.beginTransaction(); + EngineExecutor ee = new EngineExecutor(); + String resp = ee.process(pData, pFileItems).toString(); + // em.flush(); + PersistenceHelper.commitTransaction(); + return resp; + } catch (Throwable e) { + APPLogger.getLogger().warn(e, e); + PersistenceHelper.rollbackTransaction(); + try { + this.fillError(e, response, pData); + } catch (Throwable e1) { + APPLogger.getLogger().warn(e1, e1); + } + return response.toString(); + } finally { + PersistenceHelper.closeSession(); + } + } + + private void fillError(Throwable e, Object pResponse, String pData) throws Exception { + JSONObject response = (JSONObject) pResponse; + APPLogger.getLogger().error("\nRequest:==>" + pData); + ExceptionHandler eh = new ExceptionHandler(e, "es"); + String usrmsg = eh.getUserMessage(); + APPLogger.getLogger().error("User Message:==> " + usrmsg); + response.put("message", usrmsg); + response.put("messageCode", eh.getCode()); + response.put("isAplicationMessage", eh.isAppexception()); + response.put("trace", eh.getTechnicalMessage()); + if ((e instanceof APPException) || (e instanceof SQLException)) { + response.put("stackTrace", eh.getTechnicalMessage()); + } else { + response.put("stackTrace", eh.getStackTrace()); + APPLogger.getLogger().error("StackTrace:==>" + eh.getStackTrace()); + } + } + + + /** + * Metodo que se encarga de expirar sessiones de usuario. + * + * @param host IP del servidor web + */ + @Override + public void expireSessions(String host) throws Exception { + try { + this.fillThreadFacade(this.getCompany(null)); + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + PersistenceHelper.beginTransaction(); + CloseAllSessions.getInstance().expireSessions(host); + PersistenceHelper.commitTransaction(); + } catch (Exception e) { + PersistenceHelper.rollbackTransaction(); + APPLogger.getLogger().error("expireSessions==> " + e); + } finally { + PersistenceHelper.closeSession(); + } + } + + /** + * Metodo que se encarga de ejecutar y/o llenar tablas temporales para la ejeucion de reportes. + * + * @param pQueryRequest Datos de la consulta del reporte. + * @throws Exception + */ + @Override + public Object reportProcessor(Object pQueryRequest) throws Exception { + JSONObject response = new JSONObject(); + try { + QueryRequest queryReq = (QueryRequest) pQueryRequest; + this.fillThreadFacade(queryReq.getCompany()); + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + PersistenceHelper.beginTransaction(); + Response res = new Response(Response.RESPONSE_OK, "OK"); + queryReq.setResponse(res); + MessageGenerator mg = MessageGenerator.getInstance(); + queryReq.setJournalId(mg.generateId(queryReq.getUser())); + ReportProcessor rp = new ReportProcessor(); + rp.process(queryReq); + PersistenceHelper.commitTransaction(); + Serializer ser = new Serializer(res); + return ser.toJSON(); + } catch (Exception e) { + PersistenceHelper.rollbackTransaction(); + this.fillError(e, response, ""); + } finally { + PersistenceHelper.closeSession(); + } + return response.toString(); + + } + +} diff --git a/base/facade/src/main/java/com/fp/facade/ejb/JobsIniciatorBean.java b/base/facade/src/main/java/com/fp/facade/ejb/JobsIniciatorBean.java new file mode 100644 index 0000000..c4e29cf --- /dev/null +++ b/base/facade/src/main/java/com/fp/facade/ejb/JobsIniciatorBean.java @@ -0,0 +1,84 @@ +package com.fp.facade.ejb; + +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.ejb.Singleton; +import javax.ejb.Startup; +import javax.persistence.EntityManager; + +import com.fp.base.persistence.util.job.ServiceManager; +import com.fp.common.logger.APPLogger; +import com.fp.facade.ejb.helper.BeanHelper; +import com.fp.general.scheduler.MiaScheduler; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; + +@Singleton +@Startup +public class JobsIniciatorBean extends BeanHelper { + + /** Variable que controla que los job's inicien. */ + private boolean iniciar = false; + private MiaScheduler ms; + @PostConstruct + protected void iniciartareas() { + if (!iniciar) { + APPLogger.getLogger().error("INICIA EJECUCION DE TAREAS O DEMONIOS EN EL SERVIDOR"); + try { + this.startJobs(); + iniciar = true; + } catch (Exception e) { + APPLogger.getLogger().error(e.getStackTrace()); + } + + } + + } + + /** + * Metodo que inicia el Job de tareas automaticas. + * + * @throws Exception + */ + public void startJobs() throws Exception { + this.fillThreadFacade(this.getCompany(null)); + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + try { + APPLogger.getLogger().error("Inicia Servidor Contable"); + ServiceManager sm = new ServiceManager(); + // Inicia tareas automaticas. + sm.autoamaticInit(); + APPLogger.getLogger().error("Servidor Contable ok"); + } catch (Exception e) { + } finally { + PersistenceHelper.closeSession(); + } + this.scheduleJObs(); + + } + + /** + * Metodo que inicia la ejeciucion de tareas calendarizadas. + * + * @throws Exception + */ + private void scheduleJObs() throws Exception { + this.fillThreadFacade(this.getCompany(null)); + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + try { + // Levanta ejecutor de tareas calendarizadas. + MiaScheduler ms = new MiaScheduler(); + ms.init(); + } catch (Exception e) { + } finally { + PersistenceHelper.closeSession(); + } + } + + @PreDestroy + private void detenerJobs() throws Exception{ + ms.detenerJob(); + } +} diff --git a/base/facade/src/main/java/com/fp/facade/ejb/QueryBean.java b/base/facade/src/main/java/com/fp/facade/ejb/QueryBean.java new file mode 100644 index 0000000..b7b43f6 --- /dev/null +++ b/base/facade/src/main/java/com/fp/facade/ejb/QueryBean.java @@ -0,0 +1,62 @@ +package com.fp.facade.ejb; + +import javax.ejb.Stateless; +import javax.ejb.TransactionManagement; +import javax.ejb.TransactionManagementType; +import javax.persistence.EntityManager; + +import com.fp.bpm.actions.QueryAction; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.facade.ejb.helper.BeanHelper; +import com.fp.facadeclient.ejb.FacadeBeanJsfRemote; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; + +/** + * Ejb, que actua como fachada de transacciones de consulta. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@Stateless(name = "querybean") +@TransactionManagement(value = TransactionManagementType.BEAN) +public class QueryBean extends BeanHelper implements FacadeBeanJsfRemote { + + /** + * Metodo que se encarga de la ejecucion de una accion. + * + * @param request Request con los datos necesarios para ejecutar una accion, consulta o mantenimiento. + * @return Object + * @throws Exception + */ + @Override + public Object process(Request request) throws Throwable { + this.fillThreadFacade(request.getCompany()); + Object resp = null; + // Para obtener un EntityManager dinamico + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + try { + BeanHelper.cleanThreadLocal(); + // PersistenceHelper.beginTransaction(); + QueryAction qa = new QueryAction(); + resp = qa.process(request); + // PersistenceHelper.commitTransaction(); + return resp; + } catch (Throwable e) { + APPLogger.getLogger().warn(e, e); + // PersistenceHelper.rollbackTransaction(); + try { + System.err.println("===========> ERROR " + e); + return BeanHelper.fillError(e); + } catch (Throwable e1) { + APPLogger.getLogger().warn(e1, e1); + throw e1; + } + } finally { + PersistenceHelper.closeSession(); + } + } + +} diff --git a/base/facade/src/main/java/com/fp/facade/ejb/QueryWithCommitBean.java b/base/facade/src/main/java/com/fp/facade/ejb/QueryWithCommitBean.java new file mode 100644 index 0000000..e40944f --- /dev/null +++ b/base/facade/src/main/java/com/fp/facade/ejb/QueryWithCommitBean.java @@ -0,0 +1,55 @@ +package com.fp.facade.ejb; + +import javax.ejb.Stateless; +import javax.ejb.TransactionManagement; +import javax.ejb.TransactionManagementType; +import javax.persistence.EntityManager; + +import com.fp.bpm.actions.QueryAction; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.facade.ejb.helper.BeanHelper; +import com.fp.facadeclient.ejb.FacadeBeanJsfRemote; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; + +@Stateless(name = "querywithcommitbean") +@TransactionManagement(value = TransactionManagementType.BEAN) +public class QueryWithCommitBean extends BeanHelper implements FacadeBeanJsfRemote { + + /** + * Metodo que se encarga de la ejecucion de una accion. + * + * @param request Request con los datos necesarios para ejecutar una accion, consulta o mantenimiento. + * @return Object + * @throws Exception + */ + @Override + public Object process(Request request) throws Throwable { + this.fillThreadFacade(request.getCompany()); + Object resp = null; + // Para obtener un EntityManager dinamico + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + try { + BeanHelper.cleanThreadLocal(); + PersistenceHelper.beginTransaction(); + QueryAction qa = new QueryAction(); + resp = qa.process(request); + PersistenceHelper.commitTransaction(); + return resp; + } catch (Throwable e) { + APPLogger.getLogger().warn(e, e); + PersistenceHelper.rollbackTransaction(); + try { + return BeanHelper.fillError(e); + } catch (Throwable e1) { + APPLogger.getLogger().warn(e1, e1); + throw e1; + } + } finally { + PersistenceHelper.closeSession(); + } + } + +} diff --git a/base/facade/src/main/java/com/fp/facade/ejb/ReportBean.java b/base/facade/src/main/java/com/fp/facade/ejb/ReportBean.java new file mode 100644 index 0000000..7f26cda --- /dev/null +++ b/base/facade/src/main/java/com/fp/facade/ejb/ReportBean.java @@ -0,0 +1,71 @@ +package com.fp.facade.ejb; + +import javax.ejb.Stateless; +import javax.ejb.TransactionManagement; +import javax.ejb.TransactionManagementType; +import javax.persistence.EntityManager; + +import com.fp.bpm.report.ReportProcessor; +import com.fp.common.fin.MessageGenerator; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.QueryRequest; +import com.fp.facade.ejb.helper.BeanHelper; +import com.fp.facadeclient.ejb.FacadeBeanJsfRemote; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; + +@Stateless(name = "reportbean") +@TransactionManagement(value = TransactionManagementType.BEAN) +public class ReportBean extends BeanHelper implements FacadeBeanJsfRemote { + + /** + * Metodo que se encarga de la ejecucion de una accion. + * @param request Request con los datos necesarios para ejecutar una accion, consulta o mantenimiento. + * @return Object + * @throws Exception + */ + @Override + public Object process(Request request) throws Throwable{ + this.fillThreadFacade(request.getCompany()); + Object resp = null; + // Para obtener un EntityManager dinamico + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + Response response = new Response(Response.RESPONSE_OK, "OK"); + try { + BeanHelper.cleanThreadLocal(); + QueryRequest qr = new QueryRequest(); + request.copy(qr); + request.copyMapValues(qr); + + qr.setQueryTables(request.getQueryTables()); + qr.setJsf(true); + qr.setResponse(response); + qr.putAll(request.getModifiedData()); //campos del request codigo de consuta. + // fija numero de mensaje + MessageGenerator mg = MessageGenerator.getInstance(); + qr.setJournalId(mg.generateId(qr.getUser())); + + PersistenceHelper.beginTransaction(); + ReportProcessor rp = new ReportProcessor(); + resp = rp.process(qr); + PersistenceHelper.commitTransaction(); + return resp; + } catch (Throwable e) { + APPLogger.getLogger().warn(e, e); + //PersistenceHelper.rollbackTransaction(); + try { + return BeanHelper.fillError(e); + } catch (Throwable e1) { + APPLogger.getLogger().warn(e1, e1); + throw e1; + } + } finally { + PersistenceHelper.closeSession(); + } + } + + +} diff --git a/base/facade/src/main/java/com/fp/facade/ejb/SaveBean.java b/base/facade/src/main/java/com/fp/facade/ejb/SaveBean.java new file mode 100644 index 0000000..7921e41 --- /dev/null +++ b/base/facade/src/main/java/com/fp/facade/ejb/SaveBean.java @@ -0,0 +1,54 @@ +package com.fp.facade.ejb; + +import javax.ejb.Stateless; +import javax.ejb.TransactionManagement; +import javax.ejb.TransactionManagementType; +import javax.persistence.EntityManager; + +import com.fp.bpm.actions.SaveAction; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.facade.ejb.helper.BeanHelper; +import com.fp.facadeclient.ejb.FacadeBeanJsfRemote; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; + +@Stateless(name = "savebean") +@TransactionManagement(value = TransactionManagementType.BEAN) +public class SaveBean extends BeanHelper implements FacadeBeanJsfRemote { + + /** + * Metodo que se encarga de la ejecucion de una accion. + * @param request Request con los datos necesarios para ejecutar una accion, consulta o mantenimiento. + * @return Object + * @throws Exception + */ + public Object process(Request request) throws Throwable{ + this.fillThreadFacade(request.getCompany()); + Object resp = null; + // Para obtener un EntityManager dinamico + EntityManager em = PersistenceManager.getInstance().createEntityManagerLocal(); + PersistenceHelper.setEntityManager(em); + try { + BeanHelper.cleanThreadLocal(); + PersistenceHelper.beginTransaction(); + SaveAction sa = new SaveAction(); + resp = sa.process(request); + PersistenceHelper.commitTransaction(); + return resp; + } catch (Throwable e) { + APPLogger.getLogger().warn(e, e); + PersistenceHelper.rollbackTransaction(); + try { + return BeanHelper.fillError(e); + } catch (Throwable e1) { + APPLogger.getLogger().warn(e1, e1); + throw e1; + } + } finally { + PersistenceHelper.closeSession(); + } + } + + +} diff --git a/base/facade/src/main/java/com/fp/facade/ejb/helper/.svn/entries b/base/facade/src/main/java/com/fp/facade/ejb/helper/.svn/entries new file mode 100644 index 0000000..bb3c31f --- /dev/null +++ b/base/facade/src/main/java/com/fp/facade/ejb/helper/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facade/src/main/java/com/fp/facade/ejb/helper +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +BeanHelper.java +file + + + + +2022-07-28T03:40:24.758725Z +01b929f9d584ef0bb427d0dfa5b7d969 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2734 + diff --git a/base/facade/src/main/java/com/fp/facade/ejb/helper/.svn/text-base/BeanHelper.java.svn-base b/base/facade/src/main/java/com/fp/facade/ejb/helper/.svn/text-base/BeanHelper.java.svn-base new file mode 100644 index 0000000..bf0fa4f --- /dev/null +++ b/base/facade/src/main/java/com/fp/facade/ejb/helper/.svn/text-base/BeanHelper.java.svn-base @@ -0,0 +1,86 @@ +package com.fp.facade.ejb.helper; + +import java.lang.reflect.Method; + +import net.sf.json.JSONObject; + +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.logger.APPLogger; +import com.fp.common.properties.PropertiesHandler; +import com.fp.dto.Response; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; + +public class BeanHelper { + + /** + * LLena el threadlocal con el codigo de comania. + * @param pComany Codigo de compania a asocial al threadlocal. + * @throws Exception + */ + protected void fillThreadFacade(Integer pComany) throws Exception { + SessionData s = new SessionData(); + s.setCompany(pComany); + s.setIsEjb(false); + ThreadFacade.setSaveRequest(s); + } + + /** + * Metodo que entraga el codigo de la compania que llega en el request, con la que trabaja el usuario. + * @param data Json de entrada + * @return Integer + * @throws Exception + */ + protected Integer getCompany(String data) throws Exception { + Integer cia = 1; + try { + PropertiesHandler ph = new PropertiesHandler("fb-facade"); + cia = ph.getIntValue("defaultcompany"); + } catch (Exception e) { + APPLogger.getLogger().error("Error en getCompany"); + e.printStackTrace(); + cia = 1; + } + try { + JSONObject rpcObject = JSONObject.fromObject(data); + String dataux = rpcObject.getJSONArray("params").getString(0); + dataux = dataux.substring(1, dataux.length() - 1); + JSONObject a = JSONObject.fromObject(dataux); + String cp = a.getString("company"); + return Integer.valueOf(cp); + } catch (Exception e) { + return cia; + } + } + + public static void cleanThreadLocal() { + try { + Class c = Class.forName("com.fp.core.fin.helper.ThreadTransaction"); + Method m = c.getDeclaredMethod("unset"); + m.invoke(null); + } catch (Exception e) { + // NO hacer nada + } + } + + /** + * Tranforma las excepciones en un leguaje de usuario, arma y entrega la respuesta. + * @param e Excepcion a transformar a mensaje de usuario. + * @throws Exception + */ + public static final Response fillError(Throwable e) throws Throwable { + try { + // Encera el response. + Response response = null; + // Crea una nueva instancia de response. + ExceptionHandler eh = new ExceptionHandler(e, "ES"); + response = new Response(eh.getCode(), eh.getUserMessage()); + response.setResponseTechnicalMessage(eh.getTechnicalMessage()); + return response; + } catch (Exception e2) { + throw e2; + } + } + + +} diff --git a/base/facade/src/main/java/com/fp/facade/ejb/helper/BeanHelper.java b/base/facade/src/main/java/com/fp/facade/ejb/helper/BeanHelper.java new file mode 100644 index 0000000..bf0fa4f --- /dev/null +++ b/base/facade/src/main/java/com/fp/facade/ejb/helper/BeanHelper.java @@ -0,0 +1,86 @@ +package com.fp.facade.ejb.helper; + +import java.lang.reflect.Method; + +import net.sf.json.JSONObject; + +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.logger.APPLogger; +import com.fp.common.properties.PropertiesHandler; +import com.fp.dto.Response; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; + +public class BeanHelper { + + /** + * LLena el threadlocal con el codigo de comania. + * @param pComany Codigo de compania a asocial al threadlocal. + * @throws Exception + */ + protected void fillThreadFacade(Integer pComany) throws Exception { + SessionData s = new SessionData(); + s.setCompany(pComany); + s.setIsEjb(false); + ThreadFacade.setSaveRequest(s); + } + + /** + * Metodo que entraga el codigo de la compania que llega en el request, con la que trabaja el usuario. + * @param data Json de entrada + * @return Integer + * @throws Exception + */ + protected Integer getCompany(String data) throws Exception { + Integer cia = 1; + try { + PropertiesHandler ph = new PropertiesHandler("fb-facade"); + cia = ph.getIntValue("defaultcompany"); + } catch (Exception e) { + APPLogger.getLogger().error("Error en getCompany"); + e.printStackTrace(); + cia = 1; + } + try { + JSONObject rpcObject = JSONObject.fromObject(data); + String dataux = rpcObject.getJSONArray("params").getString(0); + dataux = dataux.substring(1, dataux.length() - 1); + JSONObject a = JSONObject.fromObject(dataux); + String cp = a.getString("company"); + return Integer.valueOf(cp); + } catch (Exception e) { + return cia; + } + } + + public static void cleanThreadLocal() { + try { + Class c = Class.forName("com.fp.core.fin.helper.ThreadTransaction"); + Method m = c.getDeclaredMethod("unset"); + m.invoke(null); + } catch (Exception e) { + // NO hacer nada + } + } + + /** + * Tranforma las excepciones en un leguaje de usuario, arma y entrega la respuesta. + * @param e Excepcion a transformar a mensaje de usuario. + * @throws Exception + */ + public static final Response fillError(Throwable e) throws Throwable { + try { + // Encera el response. + Response response = null; + // Crea una nueva instancia de response. + ExceptionHandler eh = new ExceptionHandler(e, "ES"); + response = new Response(eh.getCode(), eh.getUserMessage()); + response.setResponseTechnicalMessage(eh.getTechnicalMessage()); + return response; + } catch (Exception e2) { + throw e2; + } + } + + +} diff --git a/base/facade/src/main/resources/.svn/entries b/base/facade/src/main/resources/.svn/entries new file mode 100644 index 0000000..7142ab5 --- /dev/null +++ b/base/facade/src/main/resources/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facade/src/main/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +META-INF +dir + diff --git a/base/facade/src/main/resources/META-INF/.svn/entries b/base/facade/src/main/resources/META-INF/.svn/entries new file mode 100644 index 0000000..e70fd42 --- /dev/null +++ b/base/facade/src/main/resources/META-INF/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facade/src/main/resources/META-INF +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/facade/src/test/.svn/entries b/base/facade/src/test/.svn/entries new file mode 100644 index 0000000..9e8bcdf --- /dev/null +++ b/base/facade/src/test/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facade/src/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/facade/src/test/java/.svn/entries b/base/facade/src/test/java/.svn/entries new file mode 100644 index 0000000..4d81b5e --- /dev/null +++ b/base/facade/src/test/java/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facade/src/test/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/facade/src/test/resources/.svn/entries b/base/facade/src/test/resources/.svn/entries new file mode 100644 index 0000000..be4f4b6 --- /dev/null +++ b/base/facade/src/test/resources/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facade/src/test/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/facade/target/classes/com/fp/facade/db/DataHelper.class b/base/facade/target/classes/com/fp/facade/db/DataHelper.class new file mode 100644 index 0000000..e4f911c Binary files /dev/null and b/base/facade/target/classes/com/fp/facade/db/DataHelper.class differ diff --git a/base/facade/target/classes/com/fp/facade/ejb/FacadeBean.class b/base/facade/target/classes/com/fp/facade/ejb/FacadeBean.class new file mode 100644 index 0000000..5b34a90 Binary files /dev/null and b/base/facade/target/classes/com/fp/facade/ejb/FacadeBean.class differ diff --git a/base/facade/target/classes/com/fp/facade/ejb/JobsIniciatorBean.class b/base/facade/target/classes/com/fp/facade/ejb/JobsIniciatorBean.class new file mode 100644 index 0000000..6b44be9 Binary files /dev/null and b/base/facade/target/classes/com/fp/facade/ejb/JobsIniciatorBean.class differ diff --git a/base/facade/target/classes/com/fp/facade/ejb/QueryBean.class b/base/facade/target/classes/com/fp/facade/ejb/QueryBean.class new file mode 100644 index 0000000..6e98d93 Binary files /dev/null and b/base/facade/target/classes/com/fp/facade/ejb/QueryBean.class differ diff --git a/base/facade/target/classes/com/fp/facade/ejb/QueryWithCommitBean.class b/base/facade/target/classes/com/fp/facade/ejb/QueryWithCommitBean.class new file mode 100644 index 0000000..92e9960 Binary files /dev/null and b/base/facade/target/classes/com/fp/facade/ejb/QueryWithCommitBean.class differ diff --git a/base/facade/target/classes/com/fp/facade/ejb/ReportBean.class b/base/facade/target/classes/com/fp/facade/ejb/ReportBean.class new file mode 100644 index 0000000..4fdaea7 Binary files /dev/null and b/base/facade/target/classes/com/fp/facade/ejb/ReportBean.class differ diff --git a/base/facade/target/classes/com/fp/facade/ejb/SaveBean.class b/base/facade/target/classes/com/fp/facade/ejb/SaveBean.class new file mode 100644 index 0000000..6af8171 Binary files /dev/null and b/base/facade/target/classes/com/fp/facade/ejb/SaveBean.class differ diff --git a/base/facade/target/classes/com/fp/facade/ejb/helper/BeanHelper.class b/base/facade/target/classes/com/fp/facade/ejb/helper/BeanHelper.class new file mode 100644 index 0000000..f1ff422 Binary files /dev/null and b/base/facade/target/classes/com/fp/facade/ejb/helper/BeanHelper.class differ diff --git a/base/facade/target/facade-2.1.jar b/base/facade/target/facade-2.1.jar new file mode 100644 index 0000000..7d69701 Binary files /dev/null and b/base/facade/target/facade-2.1.jar differ diff --git a/base/facade/target/maven-archiver/pom.properties b/base/facade/target/maven-archiver/pom.properties new file mode 100644 index 0000000..44ef3e4 --- /dev/null +++ b/base/facade/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:53:23 ECT 2022 +version=2.1 +groupId=com.fp.base +artifactId=facade diff --git a/base/facadeclient/.svn/dir-prop-base b/base/facadeclient/.svn/dir-prop-base new file mode 100644 index 0000000..40820ff --- /dev/null +++ b/base/facadeclient/.svn/dir-prop-base @@ -0,0 +1,6 @@ +K 10 +svn:ignore +V 7 +target + +END diff --git a/base/facadeclient/.svn/entries b/base/facadeclient/.svn/entries new file mode 100644 index 0000000..4a29b60 --- /dev/null +++ b/base/facadeclient/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facadeclient +svn://172.17.26.185/COMACO + + + +2014-10-17T05:36:16.620015Z +1672 +jvaca +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:24.527724Z +cdd9b1f28aaaa67a7f41517873ee7144 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1724 + diff --git a/base/facadeclient/.svn/text-base/pom.xml.svn-base b/base/facadeclient/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..4e18873 --- /dev/null +++ b/base/facadeclient/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,49 @@ + + + + base + com.fp + 2.1 + + 4.0.0 + com.fp.base + facadeclient + Facade client + + + + log4j + log4j + provided + + + org.jboss.spec.javax.ejb + jboss-ejb-api_3.1_spec + provided + + + + com.fp.base.dto + dto + 2.1 + provided + + + com.fp.base.dto + common + 2.1 + provided + + + diff --git a/base/facadeclient/pom.xml b/base/facadeclient/pom.xml new file mode 100644 index 0000000..4e18873 --- /dev/null +++ b/base/facadeclient/pom.xml @@ -0,0 +1,49 @@ + + + + base + com.fp + 2.1 + + 4.0.0 + com.fp.base + facadeclient + Facade client + + + + log4j + log4j + provided + + + org.jboss.spec.javax.ejb + jboss-ejb-api_3.1_spec + provided + + + + com.fp.base.dto + dto + 2.1 + provided + + + com.fp.base.dto + common + 2.1 + provided + + + diff --git a/base/facadeclient/src/.svn/entries b/base/facadeclient/src/.svn/entries new file mode 100644 index 0000000..514837a --- /dev/null +++ b/base/facadeclient/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facadeclient/src +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/base/facadeclient/src/main/.svn/entries b/base/facadeclient/src/main/.svn/entries new file mode 100644 index 0000000..4d93cbc --- /dev/null +++ b/base/facadeclient/src/main/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facadeclient/src/main +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/facadeclient/src/main/java/.svn/entries b/base/facadeclient/src/main/java/.svn/entries new file mode 100644 index 0000000..7f7486f --- /dev/null +++ b/base/facadeclient/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facadeclient/src/main/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/facadeclient/src/main/java/com/.svn/entries b/base/facadeclient/src/main/java/com/.svn/entries new file mode 100644 index 0000000..6808330 --- /dev/null +++ b/base/facadeclient/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facadeclient/src/main/java/com +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/facadeclient/src/main/java/com/fp/.svn/entries b/base/facadeclient/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..f9da7d9 --- /dev/null +++ b/base/facadeclient/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facadeclient/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +facadeclient +dir + diff --git a/base/facadeclient/src/main/java/com/fp/facadeclient/.svn/entries b/base/facadeclient/src/main/java/com/fp/facadeclient/.svn/entries new file mode 100644 index 0000000..0374da6 --- /dev/null +++ b/base/facadeclient/src/main/java/com/fp/facadeclient/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facadeclient/src/main/java/com/fp/facadeclient +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +helper +dir + +ejb +dir + diff --git a/base/facadeclient/src/main/java/com/fp/facadeclient/ejb/.svn/entries b/base/facadeclient/src/main/java/com/fp/facadeclient/ejb/.svn/entries new file mode 100644 index 0000000..b976a96 --- /dev/null +++ b/base/facadeclient/src/main/java/com/fp/facadeclient/ejb/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facadeclient/src/main/java/com/fp/facadeclient/ejb +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +FacadeBeanRemote.java +file + + + + +2022-07-28T03:40:24.313723Z +5d0d06531499b9063959906968be40fe +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1242 + +FacadeBeanJsfRemote.java +file + + + + +2022-07-28T03:40:24.314723Z +c42389158d9f59d7a2c9d5afca7b829f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +564 + diff --git a/base/facadeclient/src/main/java/com/fp/facadeclient/ejb/.svn/text-base/FacadeBeanJsfRemote.java.netbeans-base b/base/facadeclient/src/main/java/com/fp/facadeclient/ejb/.svn/text-base/FacadeBeanJsfRemote.java.netbeans-base new file mode 100644 index 0000000..1d4a7ff --- /dev/null +++ b/base/facadeclient/src/main/java/com/fp/facadeclient/ejb/.svn/text-base/FacadeBeanJsfRemote.java.netbeans-base @@ -0,0 +1,23 @@ +package com.fp.facadeclient.ejb; + +import javax.ejb.Remote; + +import com.fp.dto.Request; + +/** + * Interface remota de ejb de ejecucion de transacciones. + * @author Jorge Vaca. + * @version 2.1 + */ +@Remote +public interface FacadeBeanJsfRemote { + + /** + * Metodo que se encarga de la ejecucion de una accion. + * @param request Request con los datos necesarios para ejecutar una accion, consulta o mantenimiento. + * @return Object + * @throws Exception + */ + public Object process(Request request) throws Throwable; + +} diff --git a/base/facadeclient/src/main/java/com/fp/facadeclient/ejb/.svn/text-base/FacadeBeanJsfRemote.java.svn-base b/base/facadeclient/src/main/java/com/fp/facadeclient/ejb/.svn/text-base/FacadeBeanJsfRemote.java.svn-base new file mode 100644 index 0000000..1d4a7ff --- /dev/null +++ b/base/facadeclient/src/main/java/com/fp/facadeclient/ejb/.svn/text-base/FacadeBeanJsfRemote.java.svn-base @@ -0,0 +1,23 @@ +package com.fp.facadeclient.ejb; + +import javax.ejb.Remote; + +import com.fp.dto.Request; + +/** + * Interface remota de ejb de ejecucion de transacciones. + * @author Jorge Vaca. + * @version 2.1 + */ +@Remote +public interface FacadeBeanJsfRemote { + + /** + * Metodo que se encarga de la ejecucion de una accion. + * @param request Request con los datos necesarios para ejecutar una accion, consulta o mantenimiento. + * @return Object + * @throws Exception + */ + public Object process(Request request) throws Throwable; + +} diff --git a/base/facadeclient/src/main/java/com/fp/facadeclient/ejb/.svn/text-base/FacadeBeanRemote.java.svn-base b/base/facadeclient/src/main/java/com/fp/facadeclient/ejb/.svn/text-base/FacadeBeanRemote.java.svn-base new file mode 100644 index 0000000..bc97866 --- /dev/null +++ b/base/facadeclient/src/main/java/com/fp/facadeclient/ejb/.svn/text-base/FacadeBeanRemote.java.svn-base @@ -0,0 +1,45 @@ +package com.fp.facadeclient.ejb; + +import java.util.List; + +import javax.ejb.Remote; + +import com.fp.dto.helper.FileHelper; + +/** + * Interface remota de ejb de ejecucion de transacciones. + * @author Jorge Vaca. + * @version 2.1 + */ +@Remote +public interface FacadeBeanRemote { + + /** + * Metodo que permite verificar que el servicio este activo. + * @param pData Datos con los que se procesa la transaccion. + * @return Object + * @throws Exception + */ + public Object ping(String pData) throws Throwable; + + /** + * Metodo que se encarga de la ejecucion de una accion. + * @param pData Datos con los que se procesa la transaccion. + * @param pFileItems Lista de archivos o imagenes a almacenar en la base. + * @return Object + * @throws Exception + */ + public Object process(String pData, List pFileItems) throws Throwable; + + /** + * Metodo que se encarga de expirar sessiones de usuario. + * @param host IP del servidor web + */ + public void expireSessions(String host) throws Throwable; + + /** + * Metodo que se encarga de procesar los reportes especiales + */ + public Object reportProcessor(Object pQueryRequest) throws Throwable; + +} diff --git a/base/facadeclient/src/main/java/com/fp/facadeclient/ejb/FacadeBeanJsfRemote.java b/base/facadeclient/src/main/java/com/fp/facadeclient/ejb/FacadeBeanJsfRemote.java new file mode 100644 index 0000000..1d4a7ff --- /dev/null +++ b/base/facadeclient/src/main/java/com/fp/facadeclient/ejb/FacadeBeanJsfRemote.java @@ -0,0 +1,23 @@ +package com.fp.facadeclient.ejb; + +import javax.ejb.Remote; + +import com.fp.dto.Request; + +/** + * Interface remota de ejb de ejecucion de transacciones. + * @author Jorge Vaca. + * @version 2.1 + */ +@Remote +public interface FacadeBeanJsfRemote { + + /** + * Metodo que se encarga de la ejecucion de una accion. + * @param request Request con los datos necesarios para ejecutar una accion, consulta o mantenimiento. + * @return Object + * @throws Exception + */ + public Object process(Request request) throws Throwable; + +} diff --git a/base/facadeclient/src/main/java/com/fp/facadeclient/ejb/FacadeBeanRemote.java b/base/facadeclient/src/main/java/com/fp/facadeclient/ejb/FacadeBeanRemote.java new file mode 100644 index 0000000..bc97866 --- /dev/null +++ b/base/facadeclient/src/main/java/com/fp/facadeclient/ejb/FacadeBeanRemote.java @@ -0,0 +1,45 @@ +package com.fp.facadeclient.ejb; + +import java.util.List; + +import javax.ejb.Remote; + +import com.fp.dto.helper.FileHelper; + +/** + * Interface remota de ejb de ejecucion de transacciones. + * @author Jorge Vaca. + * @version 2.1 + */ +@Remote +public interface FacadeBeanRemote { + + /** + * Metodo que permite verificar que el servicio este activo. + * @param pData Datos con los que se procesa la transaccion. + * @return Object + * @throws Exception + */ + public Object ping(String pData) throws Throwable; + + /** + * Metodo que se encarga de la ejecucion de una accion. + * @param pData Datos con los que se procesa la transaccion. + * @param pFileItems Lista de archivos o imagenes a almacenar en la base. + * @return Object + * @throws Exception + */ + public Object process(String pData, List pFileItems) throws Throwable; + + /** + * Metodo que se encarga de expirar sessiones de usuario. + * @param host IP del servidor web + */ + public void expireSessions(String host) throws Throwable; + + /** + * Metodo que se encarga de procesar los reportes especiales + */ + public Object reportProcessor(Object pQueryRequest) throws Throwable; + +} diff --git a/base/facadeclient/src/main/java/com/fp/facadeclient/helper/.svn/entries b/base/facadeclient/src/main/java/com/fp/facadeclient/helper/.svn/entries new file mode 100644 index 0000000..8d75342 --- /dev/null +++ b/base/facadeclient/src/main/java/com/fp/facadeclient/helper/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facadeclient/src/main/java/com/fp/facadeclient/helper +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ServiceLocator.java +file + + + + +2022-07-28T03:40:24.259723Z +310ff322767c3283e447e9d1be9a1903 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3846 + +ServiceLocatorJsf.java +file + + + + +2022-07-28T03:40:24.259723Z +d6fa11827c297be90727073698bd4b34 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2884 + +ServiceLocatorJboss7.java +file + + + + +2022-07-28T03:40:24.259723Z +b27a00a97351f3a06195e2a7ea70e9b0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3847 + diff --git a/base/facadeclient/src/main/java/com/fp/facadeclient/helper/.svn/text-base/ServiceLocator.java.svn-base b/base/facadeclient/src/main/java/com/fp/facadeclient/helper/.svn/text-base/ServiceLocator.java.svn-base new file mode 100644 index 0000000..7765ed7 --- /dev/null +++ b/base/facadeclient/src/main/java/com/fp/facadeclient/helper/.svn/text-base/ServiceLocator.java.svn-base @@ -0,0 +1,108 @@ +package com.fp.facadeclient.helper; + +import java.util.Properties; + +import javax.ejb.EJB; +import javax.naming.Context; +import javax.naming.InitialContext; + +import com.fp.common.logger.APPLogger; +import com.fp.common.properties.PropertiesHandler; +import com.fp.facadeclient.ejb.FacadeBeanRemote; +import javax.naming.NamingException; + +/** + * Clase utilitaria que mantiene una coneccion con el bean de fachada de entrada al core. + * @author Jorge Vaca. + * @version 2.1 + */ +public class ServiceLocator { + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + @EJB + private FacadeBeanRemote facadeRemote; + /** + * Almacena una instancia de ServiceLocator. + */ + private static ServiceLocator cache; + + /** + * Entrega una instancia de ServiceLocator. + * @return ServiceLocator + */ + public static ServiceLocator getInstance() { + if (cache != null) { + return cache; + } + synchronized (ServiceLocator.class) { + if (cache == null) { + cache = new ServiceLocator(); + } + } + return cache; + } + + /** + * Entrega el valor de: facadeRemote + * @return FacadeBeanRemote + */ + public FacadeBeanRemote getFacadeRemote() throws Exception { + if (this.facadeRemote == null) { + this.fillFacadeBeanRemote(); + } + return facadeRemote; + } + + /** + * Obtiene una coneccion a bean de entrada al core. + * @throws Exception + */ + private void fillFacadeBeanRemote() { + if (this.facadeRemote == null) { + String server = null; + try { + APPLogger.getLogger().info("\nOBTENIENDO CONTEXT DEL SESSION BEAN"); + PropertiesHandler ph = new PropertiesHandler("fb-facade"); + Properties props = new Properties(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); + server = "jnp://" + ph.getStringValue("server") + ":" + ph.getStringValue("port"); + props.put(Context.PROVIDER_URL, server); + Context jndiContext = new InitialContext(props); + String a = ph.getStringValue("ear") + ph.getStringValue("bean"); + Object obj = jndiContext.lookup(a); + this.facadeRemote = (FacadeBeanRemote) obj; + APPLogger.getLogger().info("\nCONTEXT DEL SESSION BEAN OBTENIDO: " + server); + } catch (NamingException ex) { + APPLogger.getLogger().error("\nNamingException ServiceLocator: " + server, ex); + } catch (Exception ex) { + APPLogger.getLogger().error("\nException ServiceLocator: " + server, ex); + } + + } + } + + /** + * Obtiene una coneccion a bean de entrada al core. + * @throws Exception + */ + protected void fillFacadeBeanRemoteTest() throws Exception { + if (this.facadeRemote == null) { + try { + APPLogger.getLogger().info("\nOBTENIENDO UN CONTEXT DEL SESSION BEAN"); + Properties props = new Properties(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); + props.put(Context.PROVIDER_URL, "jnp://127.0.0.1:1299"); + Context jndiContext = new InitialContext(props); + String a = "maiaear-2.1/" + "FacadeBean/remote"; + Object obj = jndiContext.lookup(a); + this.facadeRemote = (FacadeBeanRemote) obj; + APPLogger.getLogger().info("\nOK CONTEXT"); + } catch (Exception ex) { + APPLogger.getLogger().error(ex); + } + } + } +} diff --git a/base/facadeclient/src/main/java/com/fp/facadeclient/helper/.svn/text-base/ServiceLocatorJboss7.java.svn-base b/base/facadeclient/src/main/java/com/fp/facadeclient/helper/.svn/text-base/ServiceLocatorJboss7.java.svn-base new file mode 100644 index 0000000..96003fb --- /dev/null +++ b/base/facadeclient/src/main/java/com/fp/facadeclient/helper/.svn/text-base/ServiceLocatorJboss7.java.svn-base @@ -0,0 +1,90 @@ +package com.fp.facadeclient.helper; + +import java.util.Hashtable; + +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; + +import com.fp.common.logger.APPLogger; +import com.fp.facadeclient.ejb.FacadeBeanRemote; + +/** + * Clase utilitaria que mantiene una coneccion con el bean de fachada de entrada al core que esta desplegado en jboss 7. + * @author Jorge Vaca. + * @version 2.1 + */ +public class ServiceLocatorJboss7 { + + /** + * Almacena una instancia de ServiceLocatorJboss. + */ + private static ServiceLocatorJboss7 cache; + + private FacadeBeanRemote facadebeanremote; + + /** + * Entrega una instancia de ServiceLocatorJboss. + * @return ServiceLocator + */ + public static ServiceLocatorJboss7 getInstance() { + if (ServiceLocatorJboss7.cache != null) { + return ServiceLocatorJboss7.cache; + } + synchronized (ServiceLocatorJboss7.class) { + if (ServiceLocatorJboss7.cache == null) { + ServiceLocatorJboss7.cache = new ServiceLocatorJboss7(); + } + } + return ServiceLocatorJboss7.cache; + } + + /** + * Entrega un proxy de los ejb remotos. + * @return FacadeBeanRemote + */ + public FacadeBeanRemote getFacadeRemote() throws Exception { + if (this.facadebeanremote == null) { + APPLogger.getLogger().error("Obtiene una coneccion con el core"); + this.facadebeanremote = ServiceLocatorJboss7.lookupRemoteStatelessFacadeBean(); + } + return this.facadebeanremote; + } + + /** + * Looks up and returns the proxy to remote stateless calculator bean + * @return + * @throws NamingException + */ + private static FacadeBeanRemote lookupRemoteStatelessFacadeBean() throws NamingException { + Hashtable jndiProperties = new Hashtable(); + jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); + Context context = new InitialContext(jndiProperties); + + // The app name is the application name of the deployed EJBs. This is typically the ear name + // without the .ear suffix. However, the application name could be overridden in the application.xml of the + // EJB deployment on the server. + // Since we haven't deployed the application as a .ear, the app name for us will be an empty string + final String appName = "maiaear-2.1"; + // This is the module name of the deployed EJBs on the server. This is typically the jar name of the + // EJB deployment, without the .jar suffix, but can be overridden via the ejb-jar.xml + // In this example, we have deployed the EJBs in a jboss-as-ejb-remote-app.jar, so the module name is + // jboss-as-ejb-remote-app + final String moduleName = "facade"; + // AS7 allows each deployment to have an (optional) distinct name. We haven't specified a distinct name for + // our EJB deployment, so this is an empty string + final String distinctName = ""; + // The EJB name which by default is the simple class name of the bean implementation class + // final String beanName = FacadeBean.class.getSimpleName(); + final String beanName = "facadebean"; // esto porque en el ejb esta el nombre del bean cambiado. + // the remote view fully qualified class name + final String viewClassName = FacadeBeanRemote.class.getName(); + // let's do the lookup + String aux = "ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + viewClassName; + return (FacadeBeanRemote) context.lookup(aux); + } + + // LIbrerias + // jboss-client-7.1.0.Final.jar esta bajo jbos-as-7.1.0.final\bin\client + +} diff --git a/base/facadeclient/src/main/java/com/fp/facadeclient/helper/.svn/text-base/ServiceLocatorJsf.java.netbeans-base b/base/facadeclient/src/main/java/com/fp/facadeclient/helper/.svn/text-base/ServiceLocatorJsf.java.netbeans-base new file mode 100644 index 0000000..9af41e1 --- /dev/null +++ b/base/facadeclient/src/main/java/com/fp/facadeclient/helper/.svn/text-base/ServiceLocatorJsf.java.netbeans-base @@ -0,0 +1,81 @@ +package com.fp.facadeclient.helper; + +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; + +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; + +import com.fp.common.logger.APPLogger; +import com.fp.facadeclient.ejb.FacadeBeanJsfRemote; + +public class ServiceLocatorJsf { + // Nombre del ear sin .ear + private static final String APP_NAME = "maiaear-2.1"; + // Nombre del modulo ejb es el jar que contiene los ejb sin .jar + private static final String MODULE_NAME = "facade"; + // Paquete clase de la interface remota. + private static final String BEAN_REMOTO = FacadeBeanJsfRemote.class.getName(); + /** + * Almacena una instancia de ServiceLocator. + */ + private static ServiceLocatorJsf cache; + + private final Map mbeans = new HashMap(); + + /** + * Entrega una instancia de ServiceLocator. + * @return ServiceLocator + */ + public static ServiceLocatorJsf getInstance() { + if (ServiceLocatorJsf.cache != null) { + return ServiceLocatorJsf.cache; + } + synchronized (ServiceLocator.class) { + if (ServiceLocatorJsf.cache == null) { + ServiceLocatorJsf.cache = new ServiceLocatorJsf(); + } + } + return ServiceLocatorJsf.cache; + } + + /** + * Entrega un proxy de los ejb remotos. + * @param nombesessionbean Nombre del ejb remoto a obtener un proxy. + * @return FacadeBeanRemote + */ + public FacadeBeanJsfRemote getFacadeRemote(String nombesessionbean) throws Exception { + FacadeBeanJsfRemote bean = this.mbeans.get(nombesessionbean); + if (bean == null) { + synchronized (this.mbeans) { + bean = this.mbeans.get(nombesessionbean); + if (bean == null) { + APPLogger.getLogger().info("Obtiene una coneccion al EJB ==> " + nombesessionbean); + bean = ServiceLocatorJsf.lookupRemoteStatelessFacadeBean(nombesessionbean); + this.mbeans.put(nombesessionbean, bean); + } + } + } + return bean; + } + + /** + * Busca y entrega el proxy de un ejb con el cual se ejecuta un servicio de negocio. + * @return FacadeBeanJsfRemote + * @throws NamingException + */ + private static FacadeBeanJsfRemote lookupRemoteStatelessFacadeBean(String beanname) throws NamingException { + // Tiene que ser hashtable no considerar en el pmd. + Hashtable jndiProperties = new Hashtable(); // NOPMD by jorge on 6/19/12 3:36 PM + jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); + Context context = new InitialContext(jndiProperties); + String aux = "ejb:" + ServiceLocatorJsf.APP_NAME + "/" + ServiceLocatorJsf.MODULE_NAME + "//" + beanname + "!" + + ServiceLocatorJsf.BEAN_REMOTO; + return (FacadeBeanJsfRemote) context.lookup(aux); + } + + // LIbrerias + // jboss-client-7.1.0.Final.jar esta bajo jbos-as-7.1.0.final\bin\client +} diff --git a/base/facadeclient/src/main/java/com/fp/facadeclient/helper/.svn/text-base/ServiceLocatorJsf.java.svn-base b/base/facadeclient/src/main/java/com/fp/facadeclient/helper/.svn/text-base/ServiceLocatorJsf.java.svn-base new file mode 100644 index 0000000..9af41e1 --- /dev/null +++ b/base/facadeclient/src/main/java/com/fp/facadeclient/helper/.svn/text-base/ServiceLocatorJsf.java.svn-base @@ -0,0 +1,81 @@ +package com.fp.facadeclient.helper; + +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; + +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; + +import com.fp.common.logger.APPLogger; +import com.fp.facadeclient.ejb.FacadeBeanJsfRemote; + +public class ServiceLocatorJsf { + // Nombre del ear sin .ear + private static final String APP_NAME = "maiaear-2.1"; + // Nombre del modulo ejb es el jar que contiene los ejb sin .jar + private static final String MODULE_NAME = "facade"; + // Paquete clase de la interface remota. + private static final String BEAN_REMOTO = FacadeBeanJsfRemote.class.getName(); + /** + * Almacena una instancia de ServiceLocator. + */ + private static ServiceLocatorJsf cache; + + private final Map mbeans = new HashMap(); + + /** + * Entrega una instancia de ServiceLocator. + * @return ServiceLocator + */ + public static ServiceLocatorJsf getInstance() { + if (ServiceLocatorJsf.cache != null) { + return ServiceLocatorJsf.cache; + } + synchronized (ServiceLocator.class) { + if (ServiceLocatorJsf.cache == null) { + ServiceLocatorJsf.cache = new ServiceLocatorJsf(); + } + } + return ServiceLocatorJsf.cache; + } + + /** + * Entrega un proxy de los ejb remotos. + * @param nombesessionbean Nombre del ejb remoto a obtener un proxy. + * @return FacadeBeanRemote + */ + public FacadeBeanJsfRemote getFacadeRemote(String nombesessionbean) throws Exception { + FacadeBeanJsfRemote bean = this.mbeans.get(nombesessionbean); + if (bean == null) { + synchronized (this.mbeans) { + bean = this.mbeans.get(nombesessionbean); + if (bean == null) { + APPLogger.getLogger().info("Obtiene una coneccion al EJB ==> " + nombesessionbean); + bean = ServiceLocatorJsf.lookupRemoteStatelessFacadeBean(nombesessionbean); + this.mbeans.put(nombesessionbean, bean); + } + } + } + return bean; + } + + /** + * Busca y entrega el proxy de un ejb con el cual se ejecuta un servicio de negocio. + * @return FacadeBeanJsfRemote + * @throws NamingException + */ + private static FacadeBeanJsfRemote lookupRemoteStatelessFacadeBean(String beanname) throws NamingException { + // Tiene que ser hashtable no considerar en el pmd. + Hashtable jndiProperties = new Hashtable(); // NOPMD by jorge on 6/19/12 3:36 PM + jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); + Context context = new InitialContext(jndiProperties); + String aux = "ejb:" + ServiceLocatorJsf.APP_NAME + "/" + ServiceLocatorJsf.MODULE_NAME + "//" + beanname + "!" + + ServiceLocatorJsf.BEAN_REMOTO; + return (FacadeBeanJsfRemote) context.lookup(aux); + } + + // LIbrerias + // jboss-client-7.1.0.Final.jar esta bajo jbos-as-7.1.0.final\bin\client +} diff --git a/base/facadeclient/src/main/java/com/fp/facadeclient/helper/ServiceLocator.java b/base/facadeclient/src/main/java/com/fp/facadeclient/helper/ServiceLocator.java new file mode 100644 index 0000000..d30f2af --- /dev/null +++ b/base/facadeclient/src/main/java/com/fp/facadeclient/helper/ServiceLocator.java @@ -0,0 +1,110 @@ +package com.fp.facadeclient.helper; + +import java.util.Properties; + +import javax.ejb.EJB; +import javax.naming.Context; +import javax.naming.InitialContext; + +import com.fp.common.logger.APPLogger; +import com.fp.common.properties.PropertiesHandler; +import com.fp.facadeclient.ejb.FacadeBeanRemote; +import javax.naming.NamingException; + +/** + * Clase utilitaria que mantiene una coneccion con el bean de fachada de entrada al core. + * @author Jorge Vaca. + * @version 2.1 + */ +public class ServiceLocator { + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + @EJB + private FacadeBeanRemote facadeRemote; + /** + * Almacena una instancia de ServiceLocator. + */ + private static ServiceLocator cache; + + /** + * Entrega una instancia de ServiceLocator. + * @return ServiceLocator + */ + public static ServiceLocator getInstance() { + if (cache != null) { + return cache; + } + synchronized (ServiceLocator.class) { + if (cache == null) { + cache = new ServiceLocator(); + } + } + return cache; + } + + /** + * Entrega el valor de: facadeRemote + * @return FacadeBeanRemote + */ + public FacadeBeanRemote getFacadeRemote() throws Exception { + if (this.facadeRemote == null) { + this.fillFacadeBeanRemote(); + } + return facadeRemote; + } + + /** + * Obtiene una coneccion a bean de entrada al core. + * @throws Exception + */ + private void fillFacadeBeanRemote() { + if (this.facadeRemote == null) { + String server = null; + try { + APPLogger.getLogger().info("\nOBTENIENDO CONTEXT DEL SESSION BEAN"); + PropertiesHandler ph = new PropertiesHandler("fb-facade"); + Properties props = new Properties(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); + + server = "jnp://" + ph.getStringValue("server") + ":" + ph.getStringValue("port"); + System.out.println("Apuntando al server >>>" +server); + props.put(Context.PROVIDER_URL, server); + Context jndiContext = new InitialContext(props); + String a = ph.getStringValue("ear") + ph.getStringValue("bean"); + Object obj = jndiContext.lookup(a); + this.facadeRemote = (FacadeBeanRemote) obj; + APPLogger.getLogger().info("\nCONTEXT DEL SESSION BEAN OBTENIDO: " + server); + } catch (NamingException ex) { + APPLogger.getLogger().error("\nNamingException ServiceLocator: " + server, ex); + } catch (Exception ex) { + APPLogger.getLogger().error("\nException ServiceLocator: " + server, ex); + } + + } + } + + /** + * Obtiene una coneccion a bean de entrada al core. + * @throws Exception + */ + protected void fillFacadeBeanRemoteTest() throws Exception { + if (this.facadeRemote == null) { + try { + APPLogger.getLogger().info("\nOBTENIENDO UN CONTEXT DEL SESSION BEAN"); + Properties props = new Properties(); + props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); + props.put(Context.PROVIDER_URL, "jnp://127.0.0.1:1299"); + Context jndiContext = new InitialContext(props); + String a = "maiaear-2.1/" + "FacadeBean/remote"; + Object obj = jndiContext.lookup(a); + this.facadeRemote = (FacadeBeanRemote) obj; + APPLogger.getLogger().info("\nOK CONTEXT"); + } catch (Exception ex) { + APPLogger.getLogger().error(ex); + } + } + } +} diff --git a/base/facadeclient/src/main/java/com/fp/facadeclient/helper/ServiceLocatorJboss7.java b/base/facadeclient/src/main/java/com/fp/facadeclient/helper/ServiceLocatorJboss7.java new file mode 100644 index 0000000..d295f7e --- /dev/null +++ b/base/facadeclient/src/main/java/com/fp/facadeclient/helper/ServiceLocatorJboss7.java @@ -0,0 +1,89 @@ +package com.fp.facadeclient.helper; + +import java.util.Hashtable; + +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; + +import com.fp.common.logger.APPLogger; +import com.fp.facadeclient.ejb.FacadeBeanRemote; + +/** + * Clase utilitaria que mantiene una coneccion con el bean de fachada de entrada al core que esta desplegado en jboss 7. + * @author Jorge Vaca. + * @version 2.1 + */ +public class ServiceLocatorJboss7 { + + /** + * Almacena una instancia de ServiceLocatorJboss. + */ + private static ServiceLocatorJboss7 cache; + + private FacadeBeanRemote facadebeanremote; + + /** + * Entrega una instancia de ServiceLocatorJboss. + * @return ServiceLocator + */ + public static ServiceLocatorJboss7 getInstance() { + if (ServiceLocatorJboss7.cache != null) { + return ServiceLocatorJboss7.cache; + } + synchronized (ServiceLocatorJboss7.class) { + if (ServiceLocatorJboss7.cache == null) { + ServiceLocatorJboss7.cache = new ServiceLocatorJboss7(); + } + } + return ServiceLocatorJboss7.cache; + } + + /** + * Entrega un proxy de los ejb remotos. + * @return FacadeBeanRemote + */ + public FacadeBeanRemote getFacadeRemote() throws Exception { + if (this.facadebeanremote == null) { + APPLogger.getLogger().error("Obtiene una coneccion con el core"); + this.facadebeanremote = ServiceLocatorJboss7.lookupRemoteStatelessFacadeBean(); + } + return this.facadebeanremote; + } + + /** + * Looks up and returns the proxy to remote stateless calculator bean + * @return + * @throws NamingException + */ + private static FacadeBeanRemote lookupRemoteStatelessFacadeBean() throws NamingException { + Hashtable jndiProperties = new Hashtable(); + jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); + Context context = new InitialContext(jndiProperties); + // The app name is the application name of the deployed EJBs. This is typically the ear name + // without the .ear suffix. However, the application name could be overridden in the application.xml of the + // EJB deployment on the server. + // Since we haven't deployed the application as a .ear, the app name for us will be an empty string + final String appName = "maiaear-2.1"; + // This is the module name of the deployed EJBs on the server. This is typically the jar name of the + // EJB deployment, without the .jar suffix, but can be overridden via the ejb-jar.xml + // In this example, we have deployed the EJBs in a jboss-as-ejb-remote-app.jar, so the module name is + // jboss-as-ejb-remote-app + final String moduleName = "facade"; + // AS7 allows each deployment to have an (optional) distinct name. We haven't specified a distinct name for + // our EJB deployment, so this is an empty string + final String distinctName = ""; + // The EJB name which by default is the simple class name of the bean implementation class + // final String beanName = FacadeBean.class.getSimpleName(); + final String beanName = "facadebean"; // esto porque en el ejb esta el nombre del bean cambiado. + // the remote view fully qualified class name + final String viewClassName = FacadeBeanRemote.class.getName(); + // let's do the lookup + String aux = "ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + viewClassName; + return (FacadeBeanRemote) context.lookup(aux); + } + + // LIbrerias + // jboss-client-7.1.0.Final.jar esta bajo jbos-as-7.1.0.final\bin\client + +} diff --git a/base/facadeclient/src/main/java/com/fp/facadeclient/helper/ServiceLocatorJsf.java b/base/facadeclient/src/main/java/com/fp/facadeclient/helper/ServiceLocatorJsf.java new file mode 100644 index 0000000..0fa0751 --- /dev/null +++ b/base/facadeclient/src/main/java/com/fp/facadeclient/helper/ServiceLocatorJsf.java @@ -0,0 +1,83 @@ +package com.fp.facadeclient.helper; + +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; + +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; + +import com.fp.common.logger.APPLogger; +import com.fp.facadeclient.ejb.FacadeBeanJsfRemote; + +public class ServiceLocatorJsf { + // Nombre del ear sin .ear + private static final String APP_NAME = "maiaear-2.1"; + // Nombre del modulo ejb es el jar que contiene los ejb sin .jar + private static final String MODULE_NAME = "facade"; + // Paquete clase de la interface remota. + private static final String BEAN_REMOTO = FacadeBeanJsfRemote.class.getName(); + /** + * Almacena una instancia de ServiceLocator. + */ + private static ServiceLocatorJsf cache; + + private final Map mbeans = new HashMap(); + + /** + * Entrega una instancia de ServiceLocator. + * @return ServiceLocator + */ + public static ServiceLocatorJsf getInstance() { + if (ServiceLocatorJsf.cache != null) { + return ServiceLocatorJsf.cache; + } + synchronized (ServiceLocator.class) { + if (ServiceLocatorJsf.cache == null) { + ServiceLocatorJsf.cache = new ServiceLocatorJsf(); + } + } + return ServiceLocatorJsf.cache; + } + + /** + * Entrega un proxy de los ejb remotos. + * @param nombesessionbean Nombre del ejb remoto a obtener un proxy. + * @return FacadeBeanRemote + */ + public FacadeBeanJsfRemote getFacadeRemote(String nombesessionbean) throws Exception { + FacadeBeanJsfRemote bean = this.mbeans.get(nombesessionbean); + if (bean == null) { + synchronized (this.mbeans) { + bean = this.mbeans.get(nombesessionbean); + if (bean == null) { + APPLogger.getLogger().info("Obtiene una coneccion al EJB ==> " + nombesessionbean); + bean = ServiceLocatorJsf.lookupRemoteStatelessFacadeBean(nombesessionbean); + + this.mbeans.put(nombesessionbean, bean); + } + } + } + return bean; + } + + /** + * Busca y entrega el proxy de un ejb con el cual se ejecuta un servicio de negocio. + * @return FacadeBeanJsfRemote + * @throws NamingException + */ + private static FacadeBeanJsfRemote lookupRemoteStatelessFacadeBean(String beanname) throws NamingException { + // Tiene que ser hashtable no considerar en el pmd. + Hashtable jndiProperties = new Hashtable(); // NOPMD by jorge on 6/19/12 3:36 PM + jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); + Context context = new InitialContext(jndiProperties); + String aux = "ejb:" + ServiceLocatorJsf.APP_NAME + "/" + ServiceLocatorJsf.MODULE_NAME + "//" + beanname + "!" + + ServiceLocatorJsf.BEAN_REMOTO; + System.out.println("Holii> "+aux); + return (FacadeBeanJsfRemote) context.lookup(aux); + } + + // LIbrerias + // jboss-client-7.1.0.Final.jar esta bajo jbos-as-7.1.0.final\bin\client +} diff --git a/base/facadeclient/src/main/resources/.svn/entries b/base/facadeclient/src/main/resources/.svn/entries new file mode 100644 index 0000000..217ff81 --- /dev/null +++ b/base/facadeclient/src/main/resources/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facadeclient/src/main/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +jboss-ejb-client.properties +file + + + + +2022-07-28T03:40:24.445724Z +296f0db3465f22f7af57e0191952d3a6 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +959 + diff --git a/base/facadeclient/src/main/resources/.svn/text-base/jboss-ejb-client.properties.svn-base b/base/facadeclient/src/main/resources/.svn/text-base/jboss-ejb-client.properties.svn-base new file mode 100644 index 0000000..76b8ebd --- /dev/null +++ b/base/facadeclient/src/main/resources/.svn/text-base/jboss-ejb-client.properties.svn-base @@ -0,0 +1,21 @@ +remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false +remote.connections=default + +remote.connection.default.host=localhost +#remote.connection.default.host=192.168.1.105 +remote.connection.default.port=4447 +remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false + +#para el servidor remoto que esta en linux +#remote.connection.default.username=jvaca +#remote.connection.default.password=Gato1971 + + +#revisar si finciona en linux +#remote.connection.one.host=${host.ip:172.20.10.2 +#remote.connection.one.port=${host.port:4447} +#remote.connection.one.username=${username:flip} +#remote.connection.one.password=${password:flip01} +#remote.connection.one.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false +#remote.connection.one.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT=false +#remote.connection.one.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS=${host.auth:JBOSS-LOCAL-USER} \ No newline at end of file diff --git a/base/facadeclient/src/main/resources/jboss-ejb-client.properties b/base/facadeclient/src/main/resources/jboss-ejb-client.properties new file mode 100644 index 0000000..76b8ebd --- /dev/null +++ b/base/facadeclient/src/main/resources/jboss-ejb-client.properties @@ -0,0 +1,21 @@ +remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false +remote.connections=default + +remote.connection.default.host=localhost +#remote.connection.default.host=192.168.1.105 +remote.connection.default.port=4447 +remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false + +#para el servidor remoto que esta en linux +#remote.connection.default.username=jvaca +#remote.connection.default.password=Gato1971 + + +#revisar si finciona en linux +#remote.connection.one.host=${host.ip:172.20.10.2 +#remote.connection.one.port=${host.port:4447} +#remote.connection.one.username=${username:flip} +#remote.connection.one.password=${password:flip01} +#remote.connection.one.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false +#remote.connection.one.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT=false +#remote.connection.one.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS=${host.auth:JBOSS-LOCAL-USER} \ No newline at end of file diff --git a/base/facadeclient/src/test/.svn/entries b/base/facadeclient/src/test/.svn/entries new file mode 100644 index 0000000..a62ead2 --- /dev/null +++ b/base/facadeclient/src/test/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facadeclient/src/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/facadeclient/src/test/java/.svn/entries b/base/facadeclient/src/test/java/.svn/entries new file mode 100644 index 0000000..e71c1fb --- /dev/null +++ b/base/facadeclient/src/test/java/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facadeclient/src/test/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/facadeclient/src/test/resources/.svn/entries b/base/facadeclient/src/test/resources/.svn/entries new file mode 100644 index 0000000..4cd12fa --- /dev/null +++ b/base/facadeclient/src/test/resources/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/facadeclient/src/test/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/facadeclient/target/classes/com/fp/facadeclient/ejb/FacadeBeanJsfRemote.class b/base/facadeclient/target/classes/com/fp/facadeclient/ejb/FacadeBeanJsfRemote.class new file mode 100644 index 0000000..be91bed Binary files /dev/null and b/base/facadeclient/target/classes/com/fp/facadeclient/ejb/FacadeBeanJsfRemote.class differ diff --git a/base/facadeclient/target/classes/com/fp/facadeclient/ejb/FacadeBeanRemote.class b/base/facadeclient/target/classes/com/fp/facadeclient/ejb/FacadeBeanRemote.class new file mode 100644 index 0000000..147a7bd Binary files /dev/null and b/base/facadeclient/target/classes/com/fp/facadeclient/ejb/FacadeBeanRemote.class differ diff --git a/base/facadeclient/target/classes/com/fp/facadeclient/helper/ServiceLocator.class b/base/facadeclient/target/classes/com/fp/facadeclient/helper/ServiceLocator.class new file mode 100644 index 0000000..1d7e1a1 Binary files /dev/null and b/base/facadeclient/target/classes/com/fp/facadeclient/helper/ServiceLocator.class differ diff --git a/base/facadeclient/target/classes/com/fp/facadeclient/helper/ServiceLocatorJboss7.class b/base/facadeclient/target/classes/com/fp/facadeclient/helper/ServiceLocatorJboss7.class new file mode 100644 index 0000000..f33c6ce Binary files /dev/null and b/base/facadeclient/target/classes/com/fp/facadeclient/helper/ServiceLocatorJboss7.class differ diff --git a/base/facadeclient/target/classes/com/fp/facadeclient/helper/ServiceLocatorJsf.class b/base/facadeclient/target/classes/com/fp/facadeclient/helper/ServiceLocatorJsf.class new file mode 100644 index 0000000..079da25 Binary files /dev/null and b/base/facadeclient/target/classes/com/fp/facadeclient/helper/ServiceLocatorJsf.class differ diff --git a/base/facadeclient/target/classes/jboss-ejb-client.properties b/base/facadeclient/target/classes/jboss-ejb-client.properties new file mode 100644 index 0000000..76b8ebd --- /dev/null +++ b/base/facadeclient/target/classes/jboss-ejb-client.properties @@ -0,0 +1,21 @@ +remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false +remote.connections=default + +remote.connection.default.host=localhost +#remote.connection.default.host=192.168.1.105 +remote.connection.default.port=4447 +remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false + +#para el servidor remoto que esta en linux +#remote.connection.default.username=jvaca +#remote.connection.default.password=Gato1971 + + +#revisar si finciona en linux +#remote.connection.one.host=${host.ip:172.20.10.2 +#remote.connection.one.port=${host.port:4447} +#remote.connection.one.username=${username:flip} +#remote.connection.one.password=${password:flip01} +#remote.connection.one.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false +#remote.connection.one.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT=false +#remote.connection.one.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS=${host.auth:JBOSS-LOCAL-USER} \ No newline at end of file diff --git a/base/facadeclient/target/facadeclient-2.1.jar b/base/facadeclient/target/facadeclient-2.1.jar new file mode 100644 index 0000000..594366f Binary files /dev/null and b/base/facadeclient/target/facadeclient-2.1.jar differ diff --git a/base/facadeclient/target/maven-archiver/pom.properties b/base/facadeclient/target/maven-archiver/pom.properties new file mode 100644 index 0000000..1624c74 --- /dev/null +++ b/base/facadeclient/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:53:22 ECT 2022 +version=2.1 +groupId=com.fp.base +artifactId=facadeclient diff --git a/base/persistence/.svn/entries b/base/persistence/.svn/entries new file mode 100644 index 0000000..2199164 --- /dev/null +++ b/base/persistence/.svn/entries @@ -0,0 +1,89 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence +svn://172.17.26.185/COMACO + + + +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +pcustomer +dir + +pfirmas +dir + +plog +dir + +pviaticos +dir + +parmas +dir + +pom.xml +file + + + + +2022-07-28T03:40:32.804760Z +9a84500d88534e2437482fe039812bb3 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1803 + +pgeneral +dir + +util +dir + +commondb +dir + +pbpm +dir + diff --git a/base/persistence/.svn/text-base/pom.xml.svn-base b/base/persistence/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..777df78 --- /dev/null +++ b/base/persistence/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,53 @@ + + + + base + com.fp + 2.1 + + 4.0.0 + com.fp.base + persistence + persistence + 2.1 + pom + Financial Lifecycle Process Persistence Beans + + commondb + pgeneral + pcustomer + pbpm + util + plog + pviaticos + pfirmas + parmas + + + + com.fp.base.dto + dto + ${project.version} + + + com.fp.base.dto + common + ${project.version} + + + org.jboss.spec.javax.ejb + jboss-ejb-api_3.1_spec + provided + + + org.hibernate + hibernate-core + provided + + + org.hibernate + hibernate-entitymanager + provided + + + \ No newline at end of file diff --git a/base/persistence/commondb/.pmd b/base/persistence/commondb/.pmd new file mode 100644 index 0000000..2f1733e --- /dev/null +++ b/base/persistence/commondb/.pmd @@ -0,0 +1,601 @@ + + + false + .ruleset + + + EmptyIfStmt + Basic Rules + + + EmptyWhileStmt + Basic Rules + + + EmptyTryBlock + Basic Rules + + + EmptyFinallyBlock + Basic Rules + + + EmptySwitchStatements + Basic Rules + + + JumbledIncrementer + Basic Rules + + + ForLoopShouldBeWhileLoop + Basic Rules + + + UnnecessaryConversionTemporary + Basic Rules + + + OverrideBothEqualsAndHashcode + Basic Rules + + + DoubleCheckedLocking + Basic Rules + + + ReturnFromFinallyBlock + Basic Rules + + + EmptySynchronizedBlock + Basic Rules + + + UnnecessaryReturn + Basic Rules + + + EmptyStaticInitializer + Basic Rules + + + UnconditionalIfStatement + Basic Rules + + + EmptyStatementNotInLoop + Basic Rules + + + BooleanInstantiation + Basic Rules + + + UnnecessaryFinalModifier + Basic Rules + + + CollapsibleIfStatements + Basic Rules + + + UselessOverridingMethod + Basic Rules + + + ClassCastExceptionWithToArray + Basic Rules + + + AvoidDecimalLiteralsInBigDecimalConstructor + Basic Rules + + + UselessOperationOnImmutable + Basic Rules + + + MisplacedNullCheck + Basic Rules + + + UnusedNullCheckInEquals + Basic Rules + + + AvoidThreadGroup + Basic Rules + + + BrokenNullCheck + Basic Rules + + + AvoidUsingOctalValues + Basic Rules + + + AvoidUsingHardCodedIP + Basic Rules + + + CheckResultSet + Basic Rules + + + AvoidMultipleUnaryOperators + Basic Rules + + + EmptyInitializer + Basic Rules + + + NPathComplexity + Code Size Rules + + + ExcessiveMethodLength + Code Size Rules + + + NcssMethodCount + Code Size Rules + + + NcssTypeCount + Code Size Rules + + + NcssConstructorCount + Code Size Rules + + + VariableNamingConventions + Naming Rules + + + MethodNamingConventions + Naming Rules + + + ClassNamingConventions + Naming Rules + + + AvoidDollarSigns + Naming Rules + + + MethodWithSameNameAsEnclosingClass + Naming Rules + + + SuspiciousHashcodeMethodName + Naming Rules + + + SuspiciousConstantFieldName + Naming Rules + + + SuspiciousEqualsMethodName + Naming Rules + + + AvoidFieldNameMatchingTypeName + Naming Rules + + + AvoidFieldNameMatchingMethodName + Naming Rules + + + NoPackage + Naming Rules + + + PackageCase + Naming Rules + + + MisleadingVariableName + Naming Rules + + + BooleanGetMethodName + Naming Rules + + + MoreThanOneLogger + Java Logging Rules + + + LoggerIsNotStaticFinal + Java Logging Rules + + + SystemPrintln + Java Logging Rules + + + AvoidPrintStackTrace + Java Logging Rules + + + IfStmtsMustUseBraces + Braces Rules + + + WhileLoopsMustUseBraces + Braces Rules + + + IfElseStmtsMustUseBraces + Braces Rules + + + ForLoopsMustUseBraces + Braces Rules + + + UseSingleton + Design Rules + + + SimplifyBooleanReturns + Design Rules + + + SimplifyBooleanExpressions + Design Rules + + + SwitchStmtsShouldHaveDefault + Design Rules + + + SwitchDensity + Design Rules + + + AccessorClassGeneration + Design Rules + + + FinalFieldCouldBeStatic + Design Rules + + + CloseResource + Design Rules + + + NonStaticInitializer + Design Rules + + + DefaultLabelNotLastInSwitchStmt + Design Rules + + + NonCaseLabelInSwitchStatement + Design Rules + + + OptimizableToArrayCall + Design Rules + + + BadComparison + Design Rules + + + EqualsNull + Design Rules + + + InstantiationToGetClass + Design Rules + + + IdempotentOperations + Design Rules + + + AvoidProtectedFieldInFinalClass + Design Rules + + + MissingStaticMethodInNonInstantiatableClass + Design Rules + + + MissingBreakInSwitch + Design Rules + + + UseNotifyAllInsteadOfNotify + Design Rules + + + AvoidInstanceofChecksInCatchClause + Design Rules + + + AbstractClassWithoutAbstractMethod + Design Rules + + + SimplifyConditional + Design Rules + + + CompareObjectsWithEquals + Design Rules + + + PositionLiteralsFirstInComparisons + Design Rules + + + UnnecessaryLocalBeforeReturn + Design Rules + + + NonThreadSafeSingleton + Design Rules + + + UncommentedEmptyMethod + Design Rules + + + AvoidConstantsInterface + Design Rules + + + UnsynchronizedStaticDateFormatter + Design Rules + + + PreserveStackTrace + Design Rules + + + UseCollectionIsEmpty + Design Rules + + + ClassWithOnlyPrivateConstructorsShouldBeFinal + Design Rules + + + EmptyMethodInAbstractClassShouldBeAbstract + Design Rules + + + SingularField + Design Rules + + + ReturnEmptyArrayRatherThanNull + Design Rules + + + AbstractClassWithoutAnyMethod + Design Rules + + + TooFewBranchesForASwitchStatement + Design Rules + + + ReplaceVectorWithList + Migration Rules + + + ReplaceHashtableWithMap + Migration Rules + + + ReplaceEnumerationWithIterator + Migration Rules + + + AvoidEnumAsIdentifier + Migration Rules + + + AvoidAssertAsIdentifier + Migration Rules + + + IntegerInstantiation + Migration Rules + + + ByteInstantiation + Migration Rules + + + ShortInstantiation + Migration Rules + + + LongInstantiation + Migration Rules + + + JUnit4TestShouldUseBeforeAnnotation + Migration Rules + + + JUnit4TestShouldUseAfterAnnotation + Migration Rules + + + JUnit4TestShouldUseTestAnnotation + Migration Rules + + + JUnit4SuitesShouldUseSuiteAnnotation + Migration Rules + + + JUnitUseExpected + Migration Rules + + + AvoidDuplicateLiterals + String and StringBuffer Rules + + + StringToString + String and StringBuffer Rules + + + InefficientStringBuffering + String and StringBuffer Rules + + + UnnecessaryCaseChange + String and StringBuffer Rules + + + UseStringBufferLength + String and StringBuffer Rules + + + AppendCharacterWithChar + String and StringBuffer Rules + + + ConsecutiveLiteralAppends + String and StringBuffer Rules + + + UseIndexOfChar + String and StringBuffer Rules + + + InefficientEmptyStringCheck + String and StringBuffer Rules + + + InsufficientStringBufferDeclaration + String and StringBuffer Rules + + + UselessStringValueOf + String and StringBuffer Rules + + + StringBufferInstantiationWithChar + String and StringBuffer Rules + + + UseEqualsToCompareStrings + String and StringBuffer Rules + + + AvoidStringBufferField + String and StringBuffer Rules + + + LooseCoupling + Type Resolution Rules + + + CloneMethodMustImplementCloneable + Type Resolution Rules + + + UnusedImports + Type Resolution Rules + + + UnnecessaryConstructor + Controversial Rules + + + UnusedModifier + Controversial Rules + + + AssignmentInOperand + Controversial Rules + + + AtLeastOneConstructor + Controversial Rules + + + DontImportSun + Controversial Rules + + + SuspiciousOctalEscape + Controversial Rules + + + DefaultPackage + Controversial Rules + + + BooleanInversion + Controversial Rules + + + AvoidFinalLocalVariable + Controversial Rules + + + AvoidUsingShortType + Controversial Rules + + + AvoidUsingVolatile + Controversial Rules + + + AvoidUsingNativeCode + Controversial Rules + + + AvoidAccessibilityAlteration + Controversial Rules + + + DoNotCallGarbageCollectionExplicitly + Controversial Rules + + + UnusedPrivateField + Unused Code Rules + + + UnusedLocalVariable + Unused Code Rules + + + UnusedPrivateMethod + Unused Code Rules + + + UnusedFormalParameter + Unused Code Rules + + + AvoidDeeplyNestedIfStmts + Design Rules + + + CyclomaticComplexity + Code Size Rules + + + false + true + diff --git a/base/persistence/commondb/.svn/dir-prop-base b/base/persistence/commondb/.svn/dir-prop-base new file mode 100644 index 0000000..3e2a6f2 --- /dev/null +++ b/base/persistence/commondb/.svn/dir-prop-base @@ -0,0 +1,9 @@ +K 10 +svn:ignore +V 37 +.classpath +.project +.settings +target + +END diff --git a/base/persistence/commondb/.svn/entries b/base/persistence/commondb/.svn/entries new file mode 100644 index 0000000..f2c3839 --- /dev/null +++ b/base/persistence/commondb/.svn/entries @@ -0,0 +1,99 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/commondb +svn://172.17.26.185/COMACO + + + +2015-01-16T05:34:18.740661Z +3756 +cpiedra +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:32.404758Z +8e446ae3fb296d8a77b58890e44c2655 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +847 + +.pmd +file + + + + +2022-07-28T03:40:32.404758Z +a005c8627d2a64c8f23720db011d5372 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +18996 + diff --git a/base/persistence/commondb/.svn/text-base/.pmd.svn-base b/base/persistence/commondb/.svn/text-base/.pmd.svn-base new file mode 100644 index 0000000..2f1733e --- /dev/null +++ b/base/persistence/commondb/.svn/text-base/.pmd.svn-base @@ -0,0 +1,601 @@ + + + false + .ruleset + + + EmptyIfStmt + Basic Rules + + + EmptyWhileStmt + Basic Rules + + + EmptyTryBlock + Basic Rules + + + EmptyFinallyBlock + Basic Rules + + + EmptySwitchStatements + Basic Rules + + + JumbledIncrementer + Basic Rules + + + ForLoopShouldBeWhileLoop + Basic Rules + + + UnnecessaryConversionTemporary + Basic Rules + + + OverrideBothEqualsAndHashcode + Basic Rules + + + DoubleCheckedLocking + Basic Rules + + + ReturnFromFinallyBlock + Basic Rules + + + EmptySynchronizedBlock + Basic Rules + + + UnnecessaryReturn + Basic Rules + + + EmptyStaticInitializer + Basic Rules + + + UnconditionalIfStatement + Basic Rules + + + EmptyStatementNotInLoop + Basic Rules + + + BooleanInstantiation + Basic Rules + + + UnnecessaryFinalModifier + Basic Rules + + + CollapsibleIfStatements + Basic Rules + + + UselessOverridingMethod + Basic Rules + + + ClassCastExceptionWithToArray + Basic Rules + + + AvoidDecimalLiteralsInBigDecimalConstructor + Basic Rules + + + UselessOperationOnImmutable + Basic Rules + + + MisplacedNullCheck + Basic Rules + + + UnusedNullCheckInEquals + Basic Rules + + + AvoidThreadGroup + Basic Rules + + + BrokenNullCheck + Basic Rules + + + AvoidUsingOctalValues + Basic Rules + + + AvoidUsingHardCodedIP + Basic Rules + + + CheckResultSet + Basic Rules + + + AvoidMultipleUnaryOperators + Basic Rules + + + EmptyInitializer + Basic Rules + + + NPathComplexity + Code Size Rules + + + ExcessiveMethodLength + Code Size Rules + + + NcssMethodCount + Code Size Rules + + + NcssTypeCount + Code Size Rules + + + NcssConstructorCount + Code Size Rules + + + VariableNamingConventions + Naming Rules + + + MethodNamingConventions + Naming Rules + + + ClassNamingConventions + Naming Rules + + + AvoidDollarSigns + Naming Rules + + + MethodWithSameNameAsEnclosingClass + Naming Rules + + + SuspiciousHashcodeMethodName + Naming Rules + + + SuspiciousConstantFieldName + Naming Rules + + + SuspiciousEqualsMethodName + Naming Rules + + + AvoidFieldNameMatchingTypeName + Naming Rules + + + AvoidFieldNameMatchingMethodName + Naming Rules + + + NoPackage + Naming Rules + + + PackageCase + Naming Rules + + + MisleadingVariableName + Naming Rules + + + BooleanGetMethodName + Naming Rules + + + MoreThanOneLogger + Java Logging Rules + + + LoggerIsNotStaticFinal + Java Logging Rules + + + SystemPrintln + Java Logging Rules + + + AvoidPrintStackTrace + Java Logging Rules + + + IfStmtsMustUseBraces + Braces Rules + + + WhileLoopsMustUseBraces + Braces Rules + + + IfElseStmtsMustUseBraces + Braces Rules + + + ForLoopsMustUseBraces + Braces Rules + + + UseSingleton + Design Rules + + + SimplifyBooleanReturns + Design Rules + + + SimplifyBooleanExpressions + Design Rules + + + SwitchStmtsShouldHaveDefault + Design Rules + + + SwitchDensity + Design Rules + + + AccessorClassGeneration + Design Rules + + + FinalFieldCouldBeStatic + Design Rules + + + CloseResource + Design Rules + + + NonStaticInitializer + Design Rules + + + DefaultLabelNotLastInSwitchStmt + Design Rules + + + NonCaseLabelInSwitchStatement + Design Rules + + + OptimizableToArrayCall + Design Rules + + + BadComparison + Design Rules + + + EqualsNull + Design Rules + + + InstantiationToGetClass + Design Rules + + + IdempotentOperations + Design Rules + + + AvoidProtectedFieldInFinalClass + Design Rules + + + MissingStaticMethodInNonInstantiatableClass + Design Rules + + + MissingBreakInSwitch + Design Rules + + + UseNotifyAllInsteadOfNotify + Design Rules + + + AvoidInstanceofChecksInCatchClause + Design Rules + + + AbstractClassWithoutAbstractMethod + Design Rules + + + SimplifyConditional + Design Rules + + + CompareObjectsWithEquals + Design Rules + + + PositionLiteralsFirstInComparisons + Design Rules + + + UnnecessaryLocalBeforeReturn + Design Rules + + + NonThreadSafeSingleton + Design Rules + + + UncommentedEmptyMethod + Design Rules + + + AvoidConstantsInterface + Design Rules + + + UnsynchronizedStaticDateFormatter + Design Rules + + + PreserveStackTrace + Design Rules + + + UseCollectionIsEmpty + Design Rules + + + ClassWithOnlyPrivateConstructorsShouldBeFinal + Design Rules + + + EmptyMethodInAbstractClassShouldBeAbstract + Design Rules + + + SingularField + Design Rules + + + ReturnEmptyArrayRatherThanNull + Design Rules + + + AbstractClassWithoutAnyMethod + Design Rules + + + TooFewBranchesForASwitchStatement + Design Rules + + + ReplaceVectorWithList + Migration Rules + + + ReplaceHashtableWithMap + Migration Rules + + + ReplaceEnumerationWithIterator + Migration Rules + + + AvoidEnumAsIdentifier + Migration Rules + + + AvoidAssertAsIdentifier + Migration Rules + + + IntegerInstantiation + Migration Rules + + + ByteInstantiation + Migration Rules + + + ShortInstantiation + Migration Rules + + + LongInstantiation + Migration Rules + + + JUnit4TestShouldUseBeforeAnnotation + Migration Rules + + + JUnit4TestShouldUseAfterAnnotation + Migration Rules + + + JUnit4TestShouldUseTestAnnotation + Migration Rules + + + JUnit4SuitesShouldUseSuiteAnnotation + Migration Rules + + + JUnitUseExpected + Migration Rules + + + AvoidDuplicateLiterals + String and StringBuffer Rules + + + StringToString + String and StringBuffer Rules + + + InefficientStringBuffering + String and StringBuffer Rules + + + UnnecessaryCaseChange + String and StringBuffer Rules + + + UseStringBufferLength + String and StringBuffer Rules + + + AppendCharacterWithChar + String and StringBuffer Rules + + + ConsecutiveLiteralAppends + String and StringBuffer Rules + + + UseIndexOfChar + String and StringBuffer Rules + + + InefficientEmptyStringCheck + String and StringBuffer Rules + + + InsufficientStringBufferDeclaration + String and StringBuffer Rules + + + UselessStringValueOf + String and StringBuffer Rules + + + StringBufferInstantiationWithChar + String and StringBuffer Rules + + + UseEqualsToCompareStrings + String and StringBuffer Rules + + + AvoidStringBufferField + String and StringBuffer Rules + + + LooseCoupling + Type Resolution Rules + + + CloneMethodMustImplementCloneable + Type Resolution Rules + + + UnusedImports + Type Resolution Rules + + + UnnecessaryConstructor + Controversial Rules + + + UnusedModifier + Controversial Rules + + + AssignmentInOperand + Controversial Rules + + + AtLeastOneConstructor + Controversial Rules + + + DontImportSun + Controversial Rules + + + SuspiciousOctalEscape + Controversial Rules + + + DefaultPackage + Controversial Rules + + + BooleanInversion + Controversial Rules + + + AvoidFinalLocalVariable + Controversial Rules + + + AvoidUsingShortType + Controversial Rules + + + AvoidUsingVolatile + Controversial Rules + + + AvoidUsingNativeCode + Controversial Rules + + + AvoidAccessibilityAlteration + Controversial Rules + + + DoNotCallGarbageCollectionExplicitly + Controversial Rules + + + UnusedPrivateField + Unused Code Rules + + + UnusedLocalVariable + Unused Code Rules + + + UnusedPrivateMethod + Unused Code Rules + + + UnusedFormalParameter + Unused Code Rules + + + AvoidDeeplyNestedIfStmts + Design Rules + + + CyclomaticComplexity + Code Size Rules + + + false + true + diff --git a/base/persistence/commondb/.svn/text-base/pom.xml.svn-base b/base/persistence/commondb/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..6866f10 --- /dev/null +++ b/base/persistence/commondb/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,27 @@ + + + + persistence + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.persistence + commondb + commondb + + + com.fp.base.persistence + pgeneral + 2.1 + + + org.codehaus.btm + btm + provided + + + + diff --git a/base/persistence/commondb/pom.xml b/base/persistence/commondb/pom.xml new file mode 100644 index 0000000..6866f10 --- /dev/null +++ b/base/persistence/commondb/pom.xml @@ -0,0 +1,27 @@ + + + + persistence + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.persistence + commondb + commondb + + + com.fp.base.persistence + pgeneral + 2.1 + + + org.codehaus.btm + btm + provided + + + + diff --git a/base/persistence/commondb/src/.svn/entries b/base/persistence/commondb/src/.svn/entries new file mode 100644 index 0000000..0283836 --- /dev/null +++ b/base/persistence/commondb/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/commondb/src +svn://172.17.26.185/COMACO + + + +2015-01-16T05:34:18.740661Z +3756 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/base/persistence/commondb/src/main/.svn/entries b/base/persistence/commondb/src/main/.svn/entries new file mode 100644 index 0000000..4cadc91 --- /dev/null +++ b/base/persistence/commondb/src/main/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/commondb/src/main +svn://172.17.26.185/COMACO + + + +2015-01-16T05:34:18.740661Z +3756 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/persistence/commondb/src/main/java/.svn/entries b/base/persistence/commondb/src/main/java/.svn/entries new file mode 100644 index 0000000..607b832 --- /dev/null +++ b/base/persistence/commondb/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/commondb/src/main/java +svn://172.17.26.185/COMACO + + + +2015-01-16T05:34:18.740661Z +3756 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/persistence/commondb/src/main/java/com/.svn/entries b/base/persistence/commondb/src/main/java/com/.svn/entries new file mode 100644 index 0000000..6d2ee25 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/commondb/src/main/java/com +svn://172.17.26.185/COMACO + + + +2015-01-16T05:34:18.740661Z +3756 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/persistence/commondb/src/main/java/com/fp/.svn/entries b/base/persistence/commondb/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..d045dce --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/commondb/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2015-01-16T05:34:18.740661Z +3756 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +persistence +dir + diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/.svn/entries b/base/persistence/commondb/src/main/java/com/fp/persistence/.svn/entries new file mode 100644 index 0000000..f4845d0 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/commondb/src/main/java/com/fp/persistence +svn://172.17.26.185/COMACO + + + +2015-01-16T05:34:18.740661Z +3756 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +commondb +dir + diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/entries b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/entries new file mode 100644 index 0000000..dfbc4b3 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/entries @@ -0,0 +1,284 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/commondb/src/main/java/com/fp/persistence/commondb +svn://172.17.26.185/COMACO + + + +2015-01-16T05:34:18.740661Z +3756 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +helper +dir + +FlipUserTransaction.java +file + + + + +2022-07-28T03:40:31.987757Z +1ddaed4b0e547853814e0761ee6f6434 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1641 + +PersistenceManager.java +file + + + + +2022-07-28T03:40:31.987757Z +80f201f681ffcd6c8fbc95eea00dac81 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +13018 + +log +dir + +NestedSave.java +file + + + + +2022-07-28T03:40:31.988757Z +7bb889b33c538f7e2c1e380864efdbcc +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2133 + +cache +dir + +GeneralQuery.java +file + + + + +2022-07-28T03:40:31.988757Z +e90dc0f26f61d935e9d91dc49e86b88d +2014-11-25T04:30:55.012264Z +3075 +cpiedra + + + + + + + + + + + + + + + + + + + + + +8103 + +PersistenceHelper.java +file + + + + +2022-07-28T03:40:31.988757Z +4616e9eeef568507b03b8540a9d03eef +2014-10-27T05:10:06.348806Z +1962 +dcruz + + + + + + + + + + + + + + + + + + + + + +31899 + +db +dir + +PersistenceMetadata.java +file + + + + +2022-07-28T03:40:31.988757Z +7f0cb337d9a8536c8fd838be620cc43f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +10182 + +data +dir + +HqlStatement.java +file + + + + +2022-07-28T03:40:31.989757Z +c8da52d99cb9371d9ded6af00c8d8a60 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +11035 + +exception +dir + diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/FlipUserTransaction.java.svn-base b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/FlipUserTransaction.java.svn-base new file mode 100644 index 0000000..b5cf667 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/FlipUserTransaction.java.svn-base @@ -0,0 +1,68 @@ +package com.fp.persistence.commondb; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceException; +import javax.transaction.NotSupportedException; +import javax.transaction.RollbackException; +import javax.transaction.Status; +import javax.transaction.SystemException; +import javax.transaction.UserTransaction; + +public class FlipUserTransaction implements UserTransaction { + + private EntityManager em; + + public FlipUserTransaction(EntityManager em) { + this.em = em; + } + + public void begin() throws NotSupportedException { + if (em.getTransaction().isActive()) { + throw new NotSupportedException(); + } + em.getTransaction().begin(); + } + + public void commit() throws RollbackException { + try { + em.getTransaction().commit(); + } catch (javax.persistence.RollbackException e) { + throw new RollbackException(e.getMessage()); + } + } + + public void rollback() throws SystemException { + try { + em.getTransaction().rollback(); + } catch (PersistenceException e) { + throw new SystemException(e.getMessage()); + } + } + + public void setRollbackOnly() { + em.getTransaction().setRollbackOnly(); + } + + public int getStatus() { + if (em.getTransaction().isActive()) { + return Status.STATUS_ACTIVE; + } else { + return Status.STATUS_NO_TRANSACTION; + } + } + + public void setTransactionTimeout(int timeout) { + throw new UnsupportedOperationException(); + } + + public void close() { + try { + if (em.isOpen()) { + em.clear(); + em.close(); + } + } catch (Exception e) { + // No hacer nada la sessioo no est aabierta + } + } +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/GeneralQuery.java.svn-base b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/GeneralQuery.java.svn-base new file mode 100644 index 0000000..564aed6 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/GeneralQuery.java.svn-base @@ -0,0 +1,222 @@ +package com.fp.persistence.commondb; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.persistence.Query; + +import com.fp.common.helper.BeanManager; +import com.fp.common.logger.APPLogger; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; + +/** + * Clase que agrega los parametros y valores a una consulta + * + * @author wpatio + */ +public class GeneralQuery { + + /** + * Mtodo que agrega los parmetros de una consulta + * + * @param qb + * @param jpql + * @param mcriteria + * @throws Exception + */ + public static void addParameters(QueryBean qb, StringBuilder jpql, Map mcriteria) throws Exception { + GeneralQuery.addParameters(qb, jpql, mcriteria, false); + } + + /** + * Mtodo que agrega los parmetros de una consulta + * + * @param qb + * @param jpql + * @param mcriteria + * @throws Exception + */ + public static void addParameters(QueryBean qb, StringBuilder jpql, Map mcriteria, boolean isnative) throws Exception { + if (qb == null) { + return; + } + List lcriteria = qb.getCriteria(); + for (QueryCriteria obj : lcriteria) { + String condition = obj.getOperation(); + if (obj.getProperty() == null || obj.getValue() == null && condition == null) { + continue; + } + String aux = obj.getProperty(); + if (isnative) { + if (aux.indexOf(".") > 0) { + // Es if va en este punto por que el in puede llegar en un campo de llave primaria o en cualquier + // otro campo. + aux = aux.substring(3, aux.length()); + } + String param = obj.getProperty(); + if (condition.compareTo("in") == 0 || condition.compareTo("not in") == 0) { + jpql.append(" and t.").append(aux).append(" ").append(obj.getOperation()).append(" (").append(obj.getValue()).append(") "); + aux = null; + } else { + jpql.append(" and t.").append(aux).append(" ").append(obj.getOperation()).append(" :").append(param); + aux = param; + } + + } else { + aux = aux.replace(".", "_"); + jpql.append(" and t.").append(obj.getProperty()).append(" ").append(obj.getOperation()).append(" :").append(aux); + } + + if (aux != null) { + mcriteria.put(aux, obj.getValue()); + } + + } + // Order by de la sentencia + boolean first = true; + for (QueryCriteria order : qb.getOrder(true)) { + if (first) { + jpql.append(" ORDER BY "); + } else { + jpql.append(" ,"); + } + jpql.append("t.").append(order.getProperty()).append(" asc "); + first = false; + } + } + + /** + * Metodo que agrega el valos a los parametros para la consulta + * + * @param qb + * @param mcriteria + * @param qry + * @throws Exception + */ + public static void setParameters(QueryBean qb, Map mcriteria, Query qry) throws Exception { + if (qb == null) { + return; + } + Object beanReference = Class.forName(qb.getBeanName()).newInstance(); + Set s = mcriteria.keySet(); + Class type = null; + for (String key : s) { + try { + String aux = key; + aux = aux.replace("_", "."); + type = BeanManager.getBeanGetterMethod(beanReference, aux).getReturnType(); + } catch (Exception e1) { + APPLogger.getLogger().error(e1.getStackTrace()); + } + Object value = mcriteria.get(key); + try { + value = BeanManager.convertObject(value, type); + } catch (Exception e) { + } + qry.setParameter(key, value); + } + Integer page = qb.getPage(); + if (page != null && page >= 0 && qb.getPageSize() > 0) { + if (page > 1) { + qry.setFirstResult((qb.getPage() - 1) * qb.getPageSize()); + } + qry.setMaxResults(qb.getPageSize()); + } + } + + public static void paginate(QueryBean qb, Query qry) throws Exception { + Integer page = new Integer(qb.getPage()); + Integer recordperpage = new Integer(qb.getPageSize()); + if (page != null && recordperpage != null && page >= 0 && recordperpage > 0) { + if (page > 1) { + qry.setFirstResult((page - 1) * recordperpage); + } + qry.setMaxResults(recordperpage); + } + } + + public static void addParametersJSF(StringBuilder jpql, DtoQuery dto) { + GeneralQuery.addParametersJSF(jpql, dto, true); + } + + /** + * Agrega parametros a una consulta JSF + * + * @param jpql Consulta + * @param dto Objeto data transport + */ + public static void addParametersJSF(StringBuilder jpql, DtoQuery dto, boolean addwhere) { + List lfilters = dto.getLfilter(); + boolean first = addwhere; + String aux = " and "; + if (!lfilters.isEmpty()) { + for (Filter filter : lfilters) { + String condition = filter.getCondition() != null ? "=" : filter.getValue().indexOf("%") >= 0 ? "like" : "="; + jpql.append(aux).append("t." + filter.getField() + " ").append(condition).append(" :" + filter.getField().replace(".", "_")); + } + } + } + + /** + * Fija el valor a parametros de una consulta JSF + * + * @param jpql Consulta + * @param dto Objeto data transport + * @param + */ + public static void setParametersJSF(StringBuilder jpql, DtoQuery dto, Query qry) throws Exception { + List lfilters = dto.getLfilter(); + Object beanReference = Class.forName(dto.getBeanname()).newInstance(); + try { + Object beankey = Class.forName(dto.getBeanname() + "Key").newInstance(); + if (beankey != null) { + BeanManager.setBeanAttributeValue(beanReference, "pk", beankey); + } + } catch (Exception e) { + // No hacer nada + } + + Class type = null; + if (!lfilters.isEmpty()) { + for (Filter filter : lfilters) { + type = BeanManager.getBeanGetterMethod(beanReference, filter.getField()).getReturnType(); + Object value = BeanManager.convertObject(filter.getValue(), type); + qry.setParameter(filter.getField().replace(".", "_"), value); + } + } + Integer pagina = dto.getPage(); + Integer numreg = dto.getRecperpage() == null ? 10 : dto.getRecperpage(); + // Control de paginacion. + if (dto.isMultirecord()) { + qry.setFirstResult(pagina); + qry.setMaxResults(numreg); + } + } + + /** + * Fija el valor a parametros de una consulta JSF + * + * @param jpql Consulta + * @param dto Objeto data transport + * @param + */ + public static void setParametersNative(StringBuilder jpql, DtoQuery dto, Query qry) throws Exception { + List lfilters = dto.getLfilter(); + if (!lfilters.isEmpty()) { + for (Filter filter : lfilters) { + qry.setParameter(filter.getField().replace(".", "_"), filter.getValue()); + } + } + Integer page = dto.getPage(); + if (page != null && page >= 0 && dto.getRecperpage() > 0) { + if (page > 1) { + qry.setFirstResult((dto.getPage() - 1) * dto.getRecperpage()); + } + qry.setMaxResults(dto.getRecperpage()); + } + } +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/HqlStatement.java.svn-base b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/HqlStatement.java.svn-base new file mode 100644 index 0000000..fb0424b --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/HqlStatement.java.svn-base @@ -0,0 +1,394 @@ +package com.fp.persistence.commondb; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.text.ParseException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Parameter; +import javax.persistence.Query; + +import org.apache.log4j.Logger; +import org.hibernate.HibernateException; + +import com.fp.common.exception.CommonException; +import com.fp.common.logger.APPLogger; +import com.fp.dto.hb.Log; +import com.fp.persistence.commondb.exception.CommondbException; + +/** + * @author jorge + * + */ +public class HqlStatement { + + /** + * Map auxiliar empleado para el manejo de Parametros + */ + private Map map; + + /** + * Sentencia HQL a ejecutar + */ + private String sentence; + + /** + * EntityManager de hibernate empleada en la consulta + */ + private EntityManager em; + + /** + * Indicador de si la consulta requiere manejar Cache + */ + private boolean cacheAbled = false; + + /** + * Indicador de si la consulta es de Lectura solamente + */ + private boolean readonly = false; + + /** + * Pagina en la que se encuentra la consulta + */ + private Integer page = null; + + /** + * Numero de registros por pagina + */ + private Integer recordperpage = null; + + private Integer i = null; + + /** + * Referencia al Log + */ + private Logger log = APPLogger.getLogger(); + + /** + * Entrega el valor de page. + * + * @return page. + */ + public Integer getPage() { + return this.page; + } + + /** + * Fija el valor de page. + * + * @param pPage. + */ + public void setPage(Integer pPage) { + this.page = pPage; + } + + /** + * Entrega el valor de recordperpage. + * + * @return recordperpage. + */ + public Integer getRecordperpage() { + return this.recordperpage; + } + + /** + * Fija el valor de recordperpage. + * + * @param pRecordperpage. + */ + public void setRecordperpage(Integer pRecordperpage) { + this.recordperpage = pRecordperpage; + } + + /** + * Crea una nueva instancia de UtilHB + * + * @throws CommonException + * + */ + public HqlStatement() throws CommondbException { + this(null); + } + + /** + * Crea una nueva instancia con una sentencia a ejecutar. + * + * @param pSentence Sentencia a ejecutar + * @param pLockMode Tipo de Bloqueo Pesismista + * @param pLocktime Tiempo de espera para un bloqueo pesimista. + * @throws CommonException + * @throws Exception + */ + public HqlStatement(String pSentence) throws CommondbException { + this.sentence = pSentence; + this.map = new HashMap(); + this.em = PersistenceHelper.getEntityManager(); + } + + /** + * Fija un criterio string de la sentencia. El nombre del parametro debe ser igual al del where de la sentencia. + * + * @param pParameter + * @param pString + */ + public void setString(String pParameter, String pString) { + this.map.put(pParameter, pString); + } + + /** + * Fija un criterio Data a la sentencia. El nombre del parametro debe ser igual al del where de la sentencia. + * + * @param pParameter + * @param pDate + */ + public void setDate(String pParameter, Date pDate) { + this.map.put(pParameter, pDate); + } + + /** + * Fija un criterio Timestamp a la sentencia. El nombre del parametro debe ser igual al del where de la sentencia. + * + * @param pParameter + * @param pTimestamp + */ + public void setTimestamp(String pParameter, Timestamp pTimestamp) { + this.map.put(pParameter, pTimestamp); + } + + /** + * Fija un criterio Integer a la sentencia. El nombre del parametro debe ser igual al del where de la sentencia. + * + * @param pParameter + * @param pInteger + */ + public void setInteger(String pParameter, Integer pInteger) { + if (pInteger == null) { + this.map.put(pParameter, Integer.class); + } else { + this.map.put(pParameter, pInteger); + } + } + + + /** + * Fija un criterio Long a la sentencia. El nombre del parametro debe ser igual al del where de la sentencia. + * + * @param pParameter + * @param pLong + */ + public void setLong(String pParameter, Long pLong) { + if (pLong == null) { + this.map.put(pParameter, Long.class); + } else { + this.map.put(pParameter, pLong); + } + } + + /** + * Fija un criterio BigDecimal a la sentencia. El nombre del parametro debe ser igual al del where de la sentencia. + * + * @param pParameter + * @param pBigdecimal + */ + public void setBigDecimal(String pParameter, BigDecimal pBigdecimal) { + if (pBigdecimal == null) { + this.map.put(pParameter, BigDecimal.class); + } else { + this.map.put(pParameter, pBigdecimal); + } + } + + /** + * Setea valores de parametros definidos previamente en una sentencia. + * + * @param pMparamters Map con el nombre del parametro y el valor del mismo. + * @throws Exception + */ + public void setParametersValue(Map pMparamters) { + Iterator itr = pMparamters.keySet().iterator(); + while (itr.hasNext()) { + String key = itr.next(); + Object value = pMparamters.get(key); + if (value instanceof String) { + this.setString(key, (String) value); + } + if (value instanceof Integer) { + this.setInteger(key, (Integer) value); + } + if (value instanceof Long) { + this.setLong(key, (Long) value); + } + if (value instanceof BigDecimal) { + this.setBigDecimal(key, (BigDecimal) value); + } + if (value instanceof Date) { + this.setDate(key, (Date) value); + } + if (value instanceof Timestamp) { + this.setTimestamp(key, (Timestamp) value); + } + } + } + + /** + * Retorna: un entity si la sentencia retorna un entity, si es un conjunto de campos de una o mas tablas retorna un + * Array. + *
    + *
  1. Objeto que contiene una entidad si la sentencia retorna un entity
    + * sentencia ==> from com.test.Test as t where t.pk.c1 = :valor1
  2. + *
  3. Array que contiene una entidad si la sentencia retorna mas de un campo
    + * sentencia ==> select t.c1,t.c2...t.c3 from com.test.Test as t
  4. + *
  5. Array que contiene una entidades o campos cuando existe junturas. sentencia ==> from com.test.Test a,from + * com.test.Testuno b where a.pk=b.pk and b.pk.lenguage = 'ES'
  6. + *
+ * + * @return + * @throws CommonException + * @throws HibernateException + * @throws ParseException + * @throws Exception + */ + public Object getObject() throws HibernateException, CommondbException, ParseException, SQLException, Exception { + Object obj = null; + try { + obj = this.execute().getSingleResult(); + } catch (NoResultException e) { + return obj; + } + if (this.readonly) { + this.em.detach(obj); + } + return obj; + } + + @SuppressWarnings("unchecked") + public T getObject(@SuppressWarnings("unused") + Class pType) throws HibernateException, CommondbException, ParseException, SQLException, Exception { + T obj = null; + try { + obj = (T) this.execute().getSingleResult(); + } catch (NoResultException e) { + return obj; + } + if (this.readonly) { + this.em.detach(obj); + } + return obj; + } + + /** + * Ejecuta una sentencia. + * + * @return + * @throws CommonException + * @throws ParseException + * @throws Exception + */ + @SuppressWarnings("rawtypes") + public Query execute() throws CommondbException, ParseException, Exception { + if (this.sentence == null) { + throw new CommondbException("COMMONDB-0007", "SENTENCIA INVALIDA"); + } + // Query qry=(QueryImpl)em.createQuery(sentence); + APPLogger.getLogger().debug("Sentencia ==> " + this.sentence); + Query qry = this.em.createQuery(this.sentence); + Set> param = qry.getParameters(); + // String[]param=qry.getNamedParameters(); + for (Parameter par : param) { + String parameter = par.getName(); + Object obj = this.map.get(parameter); + if (obj == null) { + throw new CommondbException("COMMONDB-0008", "VALOR NO ENVIADO {0}", parameter); + } + qry.setParameter(parameter, obj); + } + if ((this.page != null) && (this.recordperpage != null) && (this.page >= 0) && (this.recordperpage > 0)) { + if (this.page > 1) { + qry.setFirstResult((this.page - 1) * this.recordperpage); + } + qry.setMaxResults(this.recordperpage); + } + return qry; + } + + /** + * Fija una sentencia a ejecutar. + * + * @param pSentence + */ + public void setSentence(String pSentence) { + this.map.clear(); + this.sentence = pSentence; + } + + /** + * Entrega la sentencia a ejecutar. + * + * @return + */ + public String getSentence() { + return this.sentence; + } + + /** + * Marca la setencia para cache. + * + * @param cacheAbled + */ + public void setCacheAbled(boolean cacheAbled) { + this.cacheAbled = cacheAbled; + } + + /** + * Indica si la sentencia esta marcada para cache. + * + * @return + */ + public boolean isCacheAbled() { + return this.cacheAbled; + } + + /** + * Fija la sentencia en readonly. + * + * @param readonly + */ + public void setReadonly(boolean readonly) { + this.readonly = readonly; + } + + /** + * Indica si la sentencia a ejecutar es solo de lectura. + * + * @return + */ + public boolean isReadonly() { + return this.readonly; + } + + /** + * Entrega el valor de: i + * + * @return Integer + */ + public Integer getI() { + return this.i; + } + + /** + * Fija el valor de: i + * + * @param i value to set + */ + public void setI(Integer i) { + this.i = i; + } + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/NestedSave.java.netbeans-base b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/NestedSave.java.netbeans-base new file mode 100644 index 0000000..0ad5ef8 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/NestedSave.java.netbeans-base @@ -0,0 +1,62 @@ +package com.fp.persistence.commondb; + +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.logger.APPLogger; +import com.fp.dto.hb.HibernateBean; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; + +/** + * Clase que permite grabar o actualizar informacin en la base de datos en una sesin de base de datos independiente a + * la utiliza en la ejecucin de una transaccin.. + * + * @version 2.1 + */ +public class NestedSave extends Thread { + private final HibernateBean[] bean; + + private final Integer company; + + private boolean merge; + + public NestedSave(Integer pCompany, HibernateBean... pBean) { + bean = pBean; + company = pCompany; + } + + public NestedSave(Integer pCompany, boolean merge, HibernateBean... pBean) { + bean = pBean; + company = pCompany; + this.merge = merge; + } + + @Override + public void run() { + try { + SessionData s = new SessionData(); + s.setCompany(company); + ThreadFacade.setSaveRequest(s); + PersistenceHelper.setEntityManager(PersistenceManager.getInstance().createEntityManagerLocal()); + PersistenceHelper.beginNewTransaction(); + for (HibernateBean b : bean) { + if (!merge) { + APPLogger.getLogger().info("Inserta registro de auditoria"); + PersistenceHelper.getEntityManager().detach(b); + PersistenceHelper.save(b); + } else { + PersistenceHelper.getEntityManager().merge(b); + } + + } + PersistenceHelper.commitNewTransaction(); + } catch (Exception e) { + PersistenceHelper.rollbackNewTransaction(); + ExceptionHandler eh = new ExceptionHandler(e, "es"); + String usrmsg = eh.getUserMessage(); + APPLogger.getLogger().error("User Message:==>\n" + usrmsg); + APPLogger.getLogger().error("Stack trace:==>\n" + eh.getStackTrace()); + } finally { + PersistenceHelper.closeSession(); + } + } +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/NestedSave.java.svn-base b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/NestedSave.java.svn-base new file mode 100644 index 0000000..0ad5ef8 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/NestedSave.java.svn-base @@ -0,0 +1,62 @@ +package com.fp.persistence.commondb; + +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.logger.APPLogger; +import com.fp.dto.hb.HibernateBean; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; + +/** + * Clase que permite grabar o actualizar informacin en la base de datos en una sesin de base de datos independiente a + * la utiliza en la ejecucin de una transaccin.. + * + * @version 2.1 + */ +public class NestedSave extends Thread { + private final HibernateBean[] bean; + + private final Integer company; + + private boolean merge; + + public NestedSave(Integer pCompany, HibernateBean... pBean) { + bean = pBean; + company = pCompany; + } + + public NestedSave(Integer pCompany, boolean merge, HibernateBean... pBean) { + bean = pBean; + company = pCompany; + this.merge = merge; + } + + @Override + public void run() { + try { + SessionData s = new SessionData(); + s.setCompany(company); + ThreadFacade.setSaveRequest(s); + PersistenceHelper.setEntityManager(PersistenceManager.getInstance().createEntityManagerLocal()); + PersistenceHelper.beginNewTransaction(); + for (HibernateBean b : bean) { + if (!merge) { + APPLogger.getLogger().info("Inserta registro de auditoria"); + PersistenceHelper.getEntityManager().detach(b); + PersistenceHelper.save(b); + } else { + PersistenceHelper.getEntityManager().merge(b); + } + + } + PersistenceHelper.commitNewTransaction(); + } catch (Exception e) { + PersistenceHelper.rollbackNewTransaction(); + ExceptionHandler eh = new ExceptionHandler(e, "es"); + String usrmsg = eh.getUserMessage(); + APPLogger.getLogger().error("User Message:==>\n" + usrmsg); + APPLogger.getLogger().error("Stack trace:==>\n" + eh.getStackTrace()); + } finally { + PersistenceHelper.closeSession(); + } + } +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/PersistenceHelper.java.svn-base b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/PersistenceHelper.java.svn-base new file mode 100644 index 0000000..9cc5e0e --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/PersistenceHelper.java.svn-base @@ -0,0 +1,853 @@ +package com.fp.persistence.commondb; + +import java.sql.Timestamp; +import java.util.ResourceBundle; + +import javax.ejb.NoSuchEntityException; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NameNotFoundException; +import javax.naming.NamingException; +import javax.persistence.EntityManager; +import javax.persistence.EntityTransaction; +import javax.persistence.Query; +import javax.persistence.TypedQuery; +import javax.transaction.HeuristicMixedException; +import javax.transaction.HeuristicRollbackException; +import javax.transaction.NotSupportedException; +import javax.transaction.RollbackException; +import javax.transaction.SystemException; +import javax.transaction.TransactionManager; +import javax.transaction.UserTransaction; + +import org.hibernate.HibernateException; +import org.hibernate.Session; + +import bitronix.tm.TransactionManagerServices; + +import com.fp.common.exception.APPException; +import com.fp.common.exception.CommonException; +import com.fp.common.helper.BeanManager; +import com.fp.common.logger.APPLogger; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.data.SaveData; +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.History; +import com.fp.dto.hb.Log; +import com.fp.persistence.commondb.cache.CacheManager; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.commondb.log.Audit; + +public class PersistenceHelper { + + /** + * Almacena un EntityManager de JPA. + */ + private static final ThreadLocal threadSession = new ThreadLocal(); + /** + * Almacena una transaccion de Hibernate. + */ + // private static final ThreadLocal threadTransaction = new ThreadLocal(); + private static final ThreadLocal threadTransaction = new ThreadLocal(); + private static final ThreadLocal threadTransactionManager = new ThreadLocal(); + private static final ThreadLocal threadEntityTransaction = new ThreadLocal(); + private static final ThreadLocal threadcommit = new ThreadLocal(); + + /** + * Retorna una session de hibernate. + * + * @return s + * @throws CommonException + * @throws Exception + */ + public static Session getSession() throws CommondbException { + Session s = (Session) PersistenceHelper.threadSession.get().getDelegate(); + if (s == null) { + throw new CommondbException("COMMONDB-0004", "SESION NO ASOCIADA A UNA TRANSACCION"); + } + return s; + } + + public static boolean isrollbackonly() { + try { + UserTransaction ut = PersistenceHelper.threadTransaction.get(); + if (ut != null) { + int i = ut.getStatus(); + if (i == javax.transaction.Status.STATUS_MARKED_ROLLBACK) { + return true; + } + } + TransactionManager tm = PersistenceHelper.threadTransactionManager.get(); + if (tm != null) { + int i = tm.getStatus(); + if (i == javax.transaction.Status.STATUS_MARKED_ROLLBACK) { + return true; + } + } + return false; + } catch (Exception e) { + return false; + } + } + + /** + * Retorna una Connection de tipo sql + * + * @return Connection + * @throws CommonException + * @throws Exception + */ + @SuppressWarnings("deprecation") + /* + public static Connection getConnection() throws CommondbException { + Session s = (Session) PersistenceHelper.threadSession.get().getDelegate(); + if (s == null) { + throw new CommondbException("COMMONDB-0004", "SESION NO ASOCIADA A UNA TRANSACCION"); + } + return s.connection(); + } + */ + + public static EntityManager getEntityManager() throws CommondbException { + EntityManager em = PersistenceHelper.threadSession.get(); + if (em == null) { + throw new CommondbException("COMMONDB-0004", "SESION NO ASOCIADA A UNA TRANSACCION"); + } + return em; + } + + /** + * Encera y cierra el EntityManager. + */ + public static void closeSession() { + try { + EntityManager em = PersistenceHelper.threadSession.get(); + if ((em != null)) { + em.clear(); + } + if (em.isOpen()) { + em.close(); + } + PersistenceHelper.threadTransaction.set(null); + PersistenceHelper.threadSession.set(null); + PersistenceHelper.threadcommit.set(null); + PersistenceHelper.threadTransactionManager.set(null); + PersistenceHelper.threadEntityTransaction.set(null); + } catch (Exception e) { + APPLogger.getLogger().error(e); + } + } + + /** + * Fija una session de hibernate. + * + * @param session + * @throws Exception + */ + public static boolean getThreadcommit() { + if (PersistenceHelper.threadcommit.get() == null) { + return true; + } + return PersistenceHelper.threadcommit.get(); + } + + /** + * Fija una session de hibernate. + * + * @param session + * @throws Exception + */ + public static void setThreadcommit(boolean pDocommit) { + PersistenceHelper.threadcommit.set(pDocommit); + } + + /** + * Fija una session de hibernate. + * + * @param session + * @throws Exception + */ + public static void setEntityManager(EntityManager pEntityManager) { + PersistenceHelper.threadSession.set(pEntityManager); + } + + /** + * Inicia el proceso de una transaccion de hibernate.. + * + * @throws CommonException + * @throws HibernateException + * @throws SystemException + * @throws NotSupportedException + * @throws NamingException + * @throws Exception + */ + public static EntityTransaction beginTransactionLocal() throws HibernateException, CommondbException, NotSupportedException, SystemException, + NamingException { + EntityTransaction et = PersistenceHelper.getEntityManager().getTransaction(); + PersistenceHelper.threadEntityTransaction.set(et); + et.begin(); + return et; + } + + /** + * Inicia el proceso de una transaccion de hibernate.. + * + * @throws CommonException + * @throws HibernateException + * @throws SystemException + * @throws NotSupportedException + * @throws NamingException + * @throws Exception + */ + public static UserTransaction beginTransaction() throws HibernateException, CommondbException, NotSupportedException, SystemException, + NamingException { + PersistenceHelper.called(); + UserTransaction ut = (UserTransaction) new InitialContext().lookup("java:comp/UserTransaction"); + PersistenceHelper.threadTransaction.set(ut); + ut.begin(); + PersistenceHelper.getEntityManager().joinTransaction(); + return ut; + } + + public static void beginNewTransaction() throws HibernateException, CommondbException, NotSupportedException, SystemException, NamingException { + // WebLogic javax.transaction.TransactionManager + // JBOSS java:/TransactionManager + TransactionManager tm = null; + try { + tm = (TransactionManager) new InitialContext().lookup("java:/TransactionManager"); + } catch (NameNotFoundException e) { + tm = TransactionManagerServices.getTransactionManager(); + } + + PersistenceHelper.threadTransactionManager.set(tm); + tm.begin(); + PersistenceHelper.getEntityManager().joinTransaction(); + + } + + /** + * Graba los dml que estan en la transaccion. + * + * @throws CommonException + * @throws Exception + */ + public static void commitNewTransaction() throws Exception { + if (!PersistenceHelper.getThreadcommit()) { + PersistenceHelper.rollbackNewTransaction(); + return; + } + if (PersistenceHelper.isrollbackonly()) { + PersistenceHelper.called(); + throw new APPException("FLIP01", "TRANSACCION NO PERMITE COMMIT"); + } + TransactionManager tx = PersistenceHelper.threadTransactionManager.get(); + try { + if ((tx != null)) { + try { + if (ResourceBundle.getBundle("jndi").getString(Context.INITIAL_CONTEXT_FACTORY) + .compareTo("bitronix.tm.jndi.BitronixInitialContextFactory") == 0) { + PersistenceHelper.flushTransaction(); + PersistenceHelper.getEntityManager().createNativeQuery("commit").executeUpdate(); + } + } catch (Exception e) { + // No hacer nada + } + + tx.commit(); + } else { + throw new CommondbException("COMMONDB-0005", "TRANSACCION YA APLICADA"); + } + } finally { + PersistenceHelper.getEntityManager().clear(); + PersistenceHelper.threadTransactionManager.set(null); + } + } + + /** + * Graba los dml que estan en la transaccion. + * + * @throws CommonException + * @throws Exception + */ + public static void commitTransaction() throws CommondbException, SecurityException, IllegalStateException, RollbackException, + HeuristicMixedException, HeuristicRollbackException, SystemException, APPException { + if (!PersistenceHelper.getThreadcommit()) { + PersistenceHelper.rollbackTransaction(); + return; + } + PersistenceHelper.called(); + if (PersistenceHelper.isrollbackonly()) { + throw new APPException("COMMONDB-0006", "TRANSACCION NO PUEDE SER PROCESADA "); + } + UserTransaction tx = PersistenceHelper.threadTransaction.get(); + try { + if ((tx != null)) { + tx.commit(); + } else { + throw new CommondbException("COMMONDB-0005", "TRANSACCION YA APLICADA"); + } + } finally { + PersistenceHelper.getEntityManager().clear(); + PersistenceHelper.threadTransaction.set(null); + } + } + + /** + * Graba los dml que estan en la transaccion. + * + * @throws CommonException + * @throws Exception + */ + public static void commitTransactionLocal() throws CommondbException, SecurityException, IllegalStateException, RollbackException, + HeuristicMixedException, HeuristicRollbackException, SystemException, APPException { + if (!PersistenceHelper.getThreadcommit()) { + PersistenceHelper.rollbackTransaction(); + return; + } + PersistenceHelper.called(); + if (PersistenceHelper.isrollbackonly()) { + throw new APPException("COMMONDB-0006", "TRANSACCION NO PUEDE SER PROCESADA "); + } + EntityTransaction tx = PersistenceHelper.threadEntityTransaction.get(); + try { + if ((tx != null)) { + tx.commit(); + } else { + throw new CommondbException("COMMONDB-0005", "TRANSACCION YA APLICADA"); + } + } finally { + PersistenceHelper.getEntityManager().clear(); + PersistenceHelper.threadTransaction.set(null); + } + } + + /** + * Graba los dml que estan en la transaccion. + * + * @throws CommondbException + */ + public static void flushTransaction() throws Exception { + + if (PersistenceHelper.isrollbackonly()) { + PersistenceHelper.called(); + throw new APPException("COMMONDB-0006", "TRANSACCION NO PUEDE SER PROCESADA "); + } + EntityManager em = PersistenceHelper.getEntityManager(); + em.flush(); + } + + private static void called() { + StackTraceElement st = new Exception().getStackTrace()[2]; + StackTraceElement st1 = new Exception().getStackTrace()[1]; + APPLogger.getLogger().info( + st1.getMethodName().toUpperCase() + "==>>" + st.getClassName() + "." + st.getMethodName() + ":" + st.getLineNumber()); + } + + /** + * rollback de los dml que estan dentro de la transaccion. + * + * @throws SystemException + * @throws SecurityException + * @throws IllegalStateException + * + * @throws CommonException + */ + public static void rollbackTransaction() { + PersistenceHelper.called(); + UserTransaction tx = PersistenceHelper.threadTransaction.get(); + try { + if ((tx != null)) { + try { + PersistenceHelper.getEntityManager().createNativeQuery("rollback").executeUpdate(); + } catch (Exception e) { + // NO HACER NADA + } + tx.setRollbackOnly(); + tx.rollback(); + } + } catch (Exception e1) { + APPLogger.getLogger().error(e1, e1); + } finally { + PersistenceHelper.threadTransaction.set(null); + } + } + + /** + * rollback de los dml que estan dentro de la transaccion. + * + * @throws SystemException + * @throws SecurityException + * @throws IllegalStateException + * + * @throws CommonException + */ + public static void rollbackTransactionLocal() { + PersistenceHelper.called(); + EntityTransaction tx = PersistenceHelper.threadEntityTransaction.get(); + try { + if ((tx != null)) { + try { + PersistenceHelper.getEntityManager().createNativeQuery("rollback").executeUpdate(); + } catch (Exception e) { + // NO HACER NADA + } + tx.setRollbackOnly(); + tx.rollback(); + } + } catch (Exception e1) { + APPLogger.getLogger().error(e1, e1); + } finally { + PersistenceHelper.threadTransaction.set(null); + } + } + + /** + * rollback de los dml que estan dentro de la transaccion. + * + * @throws SystemException + * @throws SecurityException + * @throws IllegalStateException + * + * @throws CommonException + */ + public static void rollbackNewTransaction() { + Exception e = new Exception(); + StackTraceElement s = e.getStackTrace()[1]; + APPLogger.getLogger().error(s.getClassName() + "." + s.getMethodName() + ":" + s.getLineNumber()); + TransactionManager tx = PersistenceHelper.threadTransactionManager.get(); + if (PersistenceHelper.isrollbackonly()) { + } + try { + if ((tx != null)) { + try { + PersistenceHelper.getEntityManager().createNativeQuery("rollback").executeUpdate(); + } catch (Exception ex) { + tx.setRollbackOnly(); + // NO HACER NADA + } + tx.setRollbackOnly(); + tx.rollback(); + } + } catch (Exception e1) { + APPLogger.getLogger().error(e1, e1); + } finally { + PersistenceHelper.threadTransactionManager.set(null); + } + } + + /** + * Retorna verdadero si a la transacci�n se dio un commit; + * + * @return boolean + * @throws Exception + */ + public static boolean isCommitted() throws Exception { + // EntityTransaction tx = PersistenceHelper.threadTransaction.get(); + UserTransaction tx = PersistenceHelper.threadTransaction.get(); + // if ((tx != null) && !tx.isActive()) { + if ((tx != null)) { + return false; + } + return true; + } + + /** + * Retorna verdadero si a la transacci�n se dio un commit; + * + * @return boolean + * @throws Exception + */ + public static boolean isRolledBack() throws Exception { + // EntityTransaction tx = PersistenceHelper.threadTransaction.get(); + // if ((tx != null) && !tx.isActive()) { + UserTransaction tx = PersistenceHelper.threadTransaction.get(); + if ((tx != null)) { + return false; + } + return true; + } + + /** + * Inserta un registro en la base de datos. + * + * @param pClassName Nombre de la clase que maneja la persistencia de una + * tabla. + * @param pBean Bean a insertar. + * @throws CommonException + * @throws Exception + */ + public static void save(HibernateBean pBean) throws CommondbException, Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + Object id = BeanManager.getBeanAttributeValue(pBean, "pk"); + if ((id instanceof History)) { + if (BeanManager.getBeanAttributeValue(pBean, "datefrom") == null) { + Timestamp t = FormatDates.getInstance().getDataBaseTimestamp(); + BeanManager.setBeanAttributeValue(pBean, "datefrom", t); + } + History pk = (History) id; + BeanManager.setBeanAttributeValue(pk, "dateto", FormatDates.getDefaultExpiryTimestamp()); + } + PersistenceHelper.setIngressUser(pBean); + PersistenceHelper.setLastupdate(pBean); + PersistenceHelper.setCreationDate(pBean); + // s.psave(pClassName,pBean); + em.persist(pBean); + if (pBean instanceof Log) { + Audit.insert(pBean); + } + } + + /** + * Actualiza un registro en la base de datos. + * + * @param pBean Bean a actualiar. + * @throws CommonException + * @throws Exception + */ + public static void update(HibernateBean pBean) throws CommondbException { + EntityManager em = PersistenceHelper.getEntityManager(); + // pBean = em.merge(pBean); + if (!em.contains(pBean)) { + throw new NoSuchEntityException(); + } + } + + /** + * Actualiza o inserta un registro en la base de datos. + * + * @param pBean Bean a actualiar o insertar. + * @throws CommonException + * @throws Exception + */ + public static void saveOrUpdate(HibernateBean pBean) throws CommondbException, Exception { + PersistenceHelper.called(); + APPLogger.getLogger().info(pBean.getClass().getName()); + APPLogger.getLogger().debug(pBean); + EntityManager em = PersistenceHelper.getEntityManager(); + + Object id = BeanManager.getBeanAttributeValue(pBean, "pk"); + if ((id instanceof History)) { + HibernateBean bean = PersistenceHelper.manageHistory(pBean, id); + pBean = em.merge(bean); + } else { + em.detach(pBean); + PersistenceHelper.setModifyUser(pBean); + PersistenceHelper.setLastupdate(pBean); + PersistenceHelper.setCreationDate(pBean); + if (pBean instanceof Cache) { + // Limpia el cache de datos internamente obtiene el nombre real del bean sin considerar el paquete. + CacheManager cm = CacheManager.getInstance(); + cm.clean(pBean.getClass().getName()); + } + if ((pBean instanceof Log)) { + HibernateBean oldbean = em.find(pBean.getClass(), id); + if (oldbean != null) { + // Graba log de auditoria. + Audit.process(pBean, oldbean); + } + } + pBean = em.merge(pBean); + } + } + + public static void persist(HibernateBean pBean) throws CommondbException, Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + PersistenceHelper.setIngressUser(pBean); + em.persist(pBean); + Audit.insert(pBean); + } + + /** + * Metodo que se encarga de caducar un registro que maneja historia. + * + * @param pBean Bean a caducar. + * @throws CommondbException + * @throws Exception + */ + public static void expire(HibernateBean pBean) throws CommondbException, Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + Object id = BeanManager.getBeanAttributeValue(pBean, "pk"); + if ((id instanceof History)) { + HibernateBean newbean = (HibernateBean) pBean.cloneMe(); + PersistenceHelper.getEntityManager().remove(pBean);; + History pk = (History) BeanManager.getBeanAttributeValue(newbean, "pk"); + pk.setDateto(FormatDates.getInstance().getDataBaseTimestamp()); + em.persist(newbean); + } + if (pBean instanceof Cache) { + // Limpia el cache de la tabla. + CacheManager cm = CacheManager.getInstance(); + cm.clean(pBean.getClass().getName()); + } + } + + /** + * Caduca registro persistente. + * + * @param pBean Bean a caducar. + * @throws CommonException + * @throws Exception + */ + public static void delete(HibernateBean pBean) throws CommondbException, Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + Object id = BeanManager.getBeanAttributeValue(pBean, "pk"); + if (id == null) { + return; + } + if (pBean != null) { + if ((id instanceof History)) { + //Las siguientes 3 lineas corrigen el problema con los registros que manejan auditoria + History pk = (History) BeanManager.getBeanAttributeValue(pBean, "pk"); + if (pk.getDateto() == null) { + pk.setDateto(FormatDates.getDefaultExpiryTimestamp()); + } + HibernateBean newbean = (HibernateBean) pBean.cloneMe(); + PersistenceHelper.expireRecord(newbean, FormatDates.getInstance().getDataBaseTimestamp()); + } + if (!em.contains(pBean)) { + em.remove(em.find(pBean.getClass(), id)); + } else { + em.remove(pBean); + } + if (pBean instanceof Log) { + Audit.delete(pBean); + } + } + if (pBean instanceof Cache) { + // Limpia el cache de la tabla. + CacheManager cm = CacheManager.getInstance(); + cm.clean(pBean.getClass().getName()); + } + } + + /** + * Metodo que se encarga del manejo de la historia de registros en la base, + * si estos manejan date from date to. + * + * @param pBean Bena a almacenar en la base de datos. + * @return HibernateBean + * @throws Exception + */ + private static HibernateBean manageHistory(HibernateBean pBean, Object pid) throws Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + Object id = pid; + HibernateBean oldbean = null; + HibernateBean newbean = pBean; + if ((id instanceof History)) { + History pk = (History) id; + if (pk.getDateto() == null) { + // Si es null y existe un registro en la base indica que se da mantenimiento sobre el mismo registro, en + // este caso + // se elimina de la base. + PersistenceHelper.verifyBean(em, pBean, id); + // pk.setDateto(null); + } + if (pk.getDateto() != null) { + Object obj = ((AbstractDataTransport)pBean).get("ORIGINALBEAN"); + if(obj == null){ + em.detach(pBean); + newbean = (HibernateBean) pBean.cloneMe(); + oldbean = em.find(pBean.getClass(), id); + if(oldbean != null){ + em.detach(oldbean); + } + }else{ + oldbean = (HibernateBean)obj; + } + + id = BeanManager.getBeanAttributeValue(newbean, "pk"); + pk = (History) id; + if (pk.getDateto().compareTo(FormatDates.getDefaultExpiryTimestamp()) < 0) { + return pBean; + } + } + Timestamp t = FormatDates.getInstance().getDataBaseTimestamp(); + if ((pBean instanceof Cache) && (oldbean != null)) { + // Limpia el cache de la tabla unicamente si esta dando mantenimiento a un registro. + CacheManager cm = CacheManager.getInstance(); + cm.clean(pBean.getClass().getName()); + } + if ((pBean instanceof Log)) { + // Graba log de auditoria. + if (oldbean != null) { + Audit.process(pBean, oldbean); + } else { + Audit.insert(pBean); + } + + } + if ((oldbean != null) && !BeanManager.compareObject(pBean, oldbean)) { + PersistenceHelper.expireRecord(oldbean, t); + BeanManager.setBeanAttributeValue(newbean, "datefrom", t); + } + if (BeanManager.getBeanAttributeValue(newbean, "datefrom") == null) { + BeanManager.setBeanAttributeValue(newbean, "datefrom", t); + } + BeanManager.setBeanAttributeValue(pk, "dateto", FormatDates.getDefaultExpiryTimestamp()); + PersistenceHelper.setpartition(pk, pk.getDateto()); + PersistenceHelper.setModifyUser(newbean); + } + return newbean; + } + + /** + * Si valor de dateto es null y existe un registro en la base indica que se + * da mantenimiento sobre el mismo registro, en este caso se elimina el + * registro de la base. + * + * @param em EntityManager utilizado en dml. + * @param pBean Referencia al bean persistente. + * @param id Pk del bean. + * @throws Exception + */ + private static void verifyBean(EntityManager em, HibernateBean pBean, Object id) throws Exception { + try { + History pk = (History) id; + pk.setDateto(FormatDates.getDefaultExpiryTimestamp()); + HibernateBean oldbean = em.find(pBean.getClass(), id); + if (oldbean != null) { + em.detach(pBean); + em.remove(oldbean); + } + } catch (Exception e) { + // No hacer nada + } + + } + + /** + * Metodo que expira un registro en la base de datos. + * + * @param pOldBean Objeto que contiene el registro de una tabla a expirar. + * @param pTimestamp Fecha con la cual se expira un registro. + * @throws Exception + */ + public static void expireRecord(HibernateBean pOldBean, Timestamp pTimestamp) throws Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + History pk = (History) BeanManager.getBeanAttributeValue(pOldBean, "pk"); + pk.setDateto(pTimestamp); + PersistenceHelper.setpartition(pk, pTimestamp); + em.persist(pOldBean); + } + + /** + * Metodo fija la particion en un registro, la particion es yyyymm del campo + * dateto. + * + * @param pHistory Pk de un registro. + * @param pTimestamp fecha con la cual se caduca un registro. + * @throws Exception + */ + private static void setpartition(History pHistory, Timestamp pTimestamp) throws Exception { + try { + BeanManager.setBeanAttributeValue(pHistory, "partition", FormatDates.getPartition(pTimestamp)); + } catch (Exception e1) { + } + } + + /** + * Metodo que separa el objeto de la session de la base de datos. + * + * @param pBean Objeto a separar de la base de datos. + * @throws Exception + */ + public static void detatch(HibernateBean pBean) throws Exception { + if(pBean != null){ + PersistenceHelper.called(); + EntityManager em = PersistenceHelper.getEntityManager(); + em.detach(pBean); + } + } + + /** + * Fija el usuario de creacion de un registro. + * + * @param pBean Objeto a almacenar en la base de datos. + * @throws Exception + */ + public static void setIngressUser(HibernateBean pBean) throws Exception { + try { + BeanManager.setBeanAttributeValue(pBean, "ingressuser", SaveData.getSaveRequest().getUser()); + } catch (Exception e) { + try { + BeanManager.setBeanAttributeValue(pBean, "ingressusercode", SaveData.getSaveRequest().getUser()); + } catch (Exception e2) { + // Si no existe el campo en el bean no hacer nada. + } + } + } + + /** + * Fija el usuario de creacion de un registro. + * + * @param pBean Objeto a almacenar en la base de datos. + * @throws Exception + */ + public static void setLastupdate(HibernateBean pBean) throws Exception { + try { + BeanManager.setBeanAttributeValue(pBean, "lastupdate", SaveData.getSaveRequest().get("accountingdate")); + } catch (Exception e) { + // Si no existe el campo en el bean no hacer nada. + } + } + + /** + * Fija el fecha de admision de un registro. + * + * @param pBean Objeto a almacenar en la base de datos. + * @throws Exception + */ + public static void setCreationDate(HibernateBean pBean) throws Exception { + try { + if (BeanManager.getBeanAttributeValue(pBean, "creationdate") == null) { + BeanManager.setBeanAttributeValue(pBean, "creationdate", SaveData.getSaveRequest().get("accountingdate")); + } + } catch (Exception e) { + // Si no existe el campo en el bean no hacer nada. + } + } + + /** + * Fija el usuario de creacion de un registro. + * + * @param pBean Objeto a almacenar en la base de datos. + * @throws Exception + */ + public static void setModifyUser(HibernateBean pBean) throws Exception { + try { + BeanManager.setBeanAttributeValue(pBean, "modifyuser", SaveData.getSaveRequest().getUser()); + } catch (Exception e) { + try { + BeanManager.setBeanAttributeValue(pBean, "modifyusercode", SaveData.getSaveRequest().getUser()); + } catch (Exception e2) { + // Si no existe el campo en el bean no hacer nada. + } + } + } + + public static Query prepareQuery(String pName, Integer pPage, Integer pRecords) throws Exception { + Query q = PersistenceHelper.getEntityManager().createNamedQuery(pName); + q.setFirstResult((pPage - 1) * pRecords); + q.setMaxResults(pRecords); + return q; + } + + public static Query prepareQuery(String pName) throws Exception { + return PersistenceHelper.getEntityManager().createNamedQuery(pName); + } + + public static Query createQuery(String pJPQL) throws Exception { + return PersistenceHelper.getEntityManager().createQuery(pJPQL); + } + + public static Query createNativeQuery(String pSQL) throws Exception { + return PersistenceHelper.getEntityManager().createNativeQuery(pSQL); + } + + public static TypedQuery prepareQuery(String pName, Class pType) throws Exception { + return PersistenceHelper.getEntityManager().createNamedQuery(pName, pType); + } + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/PersistenceManager.java.netbeans-base b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/PersistenceManager.java.netbeans-base new file mode 100644 index 0000000..bddbe40 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/PersistenceManager.java.netbeans-base @@ -0,0 +1,348 @@ +package com.fp.persistence.commondb; + +import java.lang.reflect.Field; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.FlushModeType; +import javax.persistence.Persistence; +import javax.persistence.Table; +import javax.persistence.metamodel.EntityType; + +import org.hibernate.SQLQuery; +import org.hibernate.Session; + +import com.fp.common.helper.BeanManager; +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.data.ThreadFacade; + +/** + * Clase que se encarga del manejo de la favtoria de EntityManager. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class PersistenceManager { + + /** + * Key para genrar un map de los beans mapeados en el archivo de hbconfiguration. + */ + public static final String NAME = "NAMES"; + + /** + * Key que alamacena el numero de sessiones abiertas en el sessionfactory. + */ + public static final String OPEN = "OPEN"; + + /** + * Key que alamacena el numero de sessiones cerradas en el sessionfactory. + */ + public static final String CLOSED = "CLOSED"; + + /** + * Key que almacenal hora en la que se genero el sessionfactory . + */ + public static final String START_TIME = "START TIME"; + + /** + * Instancia a la que hace referencia el Sigleton + */ + private static PersistenceManager instance = null; + + /** + * Map de EntityManagerFactory ejb por compania. + */ + private final Map memfejb = new HashMap(); + + /** + * Map de EntityManagerFactory local por compania. + */ + private final Map memf = new HashMap(); + + /** + * Map de EntityManagerFactory auxiliar por persistence unit. + */ + private final Map memfaux = new HashMap(); + + /** + * Metodo que entrega una instancia de PersistenceManager, si existe una creada la entrega, caso contrario crea una. + * Adicionalmenet hace el mapping de las tablas del modelo relacional al modelo de objetos, creando el + * EntityManagerFactory. + * + * @return PersistenceManager + */ + public static PersistenceManager getInstance() { + synchronized (PersistenceManager.class) { + if (PersistenceManager.instance == null) { + PersistenceManager.instance = new PersistenceManager(); + PersistenceManager.instance.fillEntityManagerFactory(); + } else { + Integer cia = PersistenceManager.getCompany(); + if (((PersistenceManager.instance.memfejb.get(cia) == null) && PersistenceManager.iSEjb()) + || (PersistenceManager.instance.memf.get(cia) == null)) { + PersistenceManager.instance.fillEntityManagerFactory(); + } + } + } + return PersistenceManager.instance; + } + + /** + * Contruye el entitymanager falctory. + */ + private void fillEntityManagerFactory() { + Integer cia = PersistenceManager.getCompany(); + if ((PersistenceManager.instance.memfejb.get(cia) == null) && PersistenceManager.iSEjb()) { + APPLogger.getLogger().error("CREANDO ENTYTY MANAGER FACTORY EJB: " + cia); + try { + PersistenceManager.instance.memfejb.put(cia, PersistenceManager.getEntityManagerFactory("ejb", cia)); + APPLogger.getLogger().error("CREO ENTYTY MANAGER FACTORY EJB: " + cia); + } catch (Exception e) { + APPLogger.getLogger().error("NO PUEDE CONSTRUIR EL ENTYTY MANAGER FACTORY EJB" + cia); + APPLogger.getLogger().error(e, e); + } + + } + if (PersistenceManager.instance.memf.get(cia) == null) { + APPLogger.getLogger().error("CREANDO ENTYTY MANAGER FACTORY LOCAL: " + cia); + try { + PersistenceManager.instance.memf.put(cia, PersistenceManager.getEntityManagerFactory("local", cia)); + APPLogger.getLogger().error("CREO ENTYTY MANAGER FACTORY LOCAL: " + cia); + } catch (Exception e) { + APPLogger.getLogger().error("NO PUEDE CONSTRUIR EL ENTYTY MANAGER FACTORY LOCAL" + cia); + APPLogger.getLogger().error(e, e); + } + + } + } + + /** + * Metodo que crea y entrega un EntityManagerFactory, dado el persistenceunit mas el codigo de compania. + * + * @param pUnit Nombre del persistenceunit con el cual se crea el EntityManagerFactory. + * @param pCompany Codigo de compania. + * @return EntityManagerFactory + * @throws Exception + */ + private static EntityManagerFactory getEntityManagerFactory(String pUnit, Integer pCompany) throws Exception { + Map configOverrides = new HashMap(); + configOverrides.put("hibernate.ejb.cfgfile", "hibernateFlipMapping.cfg.xml"); + EntityManagerFactory emf = null; + emf = Persistence.createEntityManagerFactory(pUnit + pCompany, configOverrides); + return emf; + } + + /** + * Metodo que entrega una instancia de PersistenceManager para pruebas, si existe una creada la entrega, caso + * contrario crea una. Adicionalmenet hace el mapping de las tablas del modelo relacional al modelo de objetos, + * creando el EntityManagerFactory. + * + * @return PersistenceManager + */ + public static PersistenceManager getInstanceTest() { + synchronized (PersistenceManager.class) { + if (PersistenceManager.instance == null) { + PersistenceManager.instance = new PersistenceManager(); + } + } + Integer cia = PersistenceManager.getCompany(); + if (PersistenceManager.instance.memf.get(cia) == null) { + try { + PersistenceManager.instance.memf.put(cia, PersistenceManager.getEntityManagerFactory("local", cia)); + } catch (Exception e) { + APPLogger.getLogger().error("NO PUEDE CONSTRUIR EL ENTYTY MANAGER FACTORY LOCAL" + cia, e); + } + // Para que no construya uno en pruebas. + PersistenceManager.instance.memfejb.put(cia, PersistenceManager.instance.memf.get(cia)); + } + return PersistenceManager.instance; + } + + /** + * Constructor que se encarga de crear una instancia de PersistenceManager + * + * @param test + */ + public PersistenceManager() { + } + + /** + * Metodo que se encarga de crear un objeto EntityManager. + * + * @return EntityManager + */ + public EntityManager createEntityManager() { + EntityManager em = memfejb.get(PersistenceManager.getCompany()).createEntityManager(); + return em; + } + + /** + * Metodo que se encarga de crear un objeto EntityManager. + * + * @return EntityManager + */ + public EntityManager createEntityManagerLocal() { + EntityManager em = memf.get(PersistenceManager.getCompany()).createEntityManager(); + em.setFlushMode(FlushModeType.COMMIT); + return em; + } + + /** Cierra el SessionFactory */ + public void close() { + memfejb.get(PersistenceManager.getCompany()).close(); + } + + /** + * Entrega EntityManagerFactory dado el persistenceunit name, se utiiza para conecciones auxiliares a bases de + * datos, ejemplo cobis. + * + * @return Map + */ + public EntityManagerFactory getEntityManagerFactoryAuxiliar(String pUnit) { + EntityManagerFactory emf = memfaux.get(pUnit); + if (emf == null) { + emf = Persistence.createEntityManagerFactory(pUnit); + memfaux.put(pUnit, emf); + } + return emf; + } + + /** + * Permite Fijar el estado de Trace de la Conexión + * + * @param pSession Session de hibernate de Referencia + * @param pStatus Estado del Trace. + * @throws SQLException + * @throws Exception + */ + public void setTrace(Session pSession, boolean pStatus) { + SQLQuery sql = pSession.createSQLQuery("alter session set sql_trace =" + pStatus); + sql.executeUpdate(); + } + + /** + * Entrega el codigo de compania de trabajo. + * + * @return Integer + * @throws Exception + */ + private static Integer getCompany() { + return ThreadFacade.getSessionData().getCompany(); + } + + private static boolean iSEjb() { + return ThreadFacade.getSessionData().isEjb(); + } + + public Class findEntityClass(String pTable) throws Exception { + return this.findEntity(pTable).getJavaType(); + } + + public EntityType findEntity(String pTable) throws Exception { + EntityManagerFactory emf = PersistenceHelper.getEntityManager().getEntityManagerFactory(); + Set> set = emf.getMetamodel().getEntities(); + EntityType entity = null; + for (EntityType entityType : set) { + Table t = entityType.getJavaType().getAnnotation(Table.class); + if (t.name().compareTo(pTable) == 0) { + entity = entityType; + break; + } + } + return entity; + } + + @SuppressWarnings("rawtypes") + public static List getDataBasePKFields(Class bean) { + List ldata = new ArrayList(); + for (Field f : bean.getDeclaredFields()) { + if (f.isAnnotationPresent(EmbeddedId.class)) { + Class pkT = f.getType(); + for (Field f1 : pkT.getDeclaredFields()) { + if (f1.isAnnotationPresent(Column.class)) { + ldata.add("pk." + f1.getAnnotation(Column.class).name().toLowerCase()); + } + } + } + } + if (ldata.isEmpty()) { + ldata.add("pk"); + } + return ldata; + } + + public List getDataBaseFields(String pTable) throws Exception { + List data = new ArrayList(); + Class et = this.findEntityClass(pTable); + for (Field f : et.getDeclaredFields()) { + if (f.isAnnotationPresent(Column.class)) { + data.add(f.getAnnotation(Column.class).name()); + } + if (f.isAnnotationPresent(EmbeddedId.class)) { + Class pkT = f.getType(); + for (Field f1 : pkT.getDeclaredFields()) { + if (f1.isAnnotationPresent(Column.class)) { + data.add(f1.getAnnotation(Column.class).name()); + } + } + } + } + return data; + } + + /** + * Entrega el tipo de dato de un campo de una clase. Si no encuentra el campo retorna null. + * + * @param clase Clase a buscar el tipo de dato de un campo. + * @param field Nombre del campo a buscar en la clase. + * @return Class + */ + public static Class getType(Class clase, String field) { + Class tipo = null; + for (Field f : clase.getDeclaredFields()) { + tipo = f.getType(); + if (f.isAnnotationPresent(EmbeddedId.class)) { + for (Field f1 : tipo.getDeclaredFields()) { + if (f1.isAnnotationPresent(Column.class) && f1.getName().equals(field)) { + tipo = f1.getType(); + return tipo; + } + } + } + if (f.isAnnotationPresent(Column.class) && f.getName().equals(field)) { + return tipo; + } + } + return null; + } + + /** + * Convierte el valor al tipo de satos del atributo de la clase. + * + * @param bean Nombre de la clase a buscar el tipo de datos de un campo. + * @param field Nombre del campo a buscar el tipo de dato. + * @param value Valor a transformar al tipo de dato de una clase. + * @return Object + * @throws Exception + */ + public static Object changeType(String bean, String field, Object value) throws Exception { + if (value == null) { + return value; + } + // Convierte el valor del criterio al tipo especifico del campo de la clase. + Class tipo = PersistenceManager.getType(Class.forName(bean), field.replace("pk.", "")); + if (tipo != null) { + value = BeanManager.convertObject(value, tipo); + } + return value; + } + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/PersistenceManager.java.svn-base b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/PersistenceManager.java.svn-base new file mode 100644 index 0000000..bddbe40 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/PersistenceManager.java.svn-base @@ -0,0 +1,348 @@ +package com.fp.persistence.commondb; + +import java.lang.reflect.Field; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.FlushModeType; +import javax.persistence.Persistence; +import javax.persistence.Table; +import javax.persistence.metamodel.EntityType; + +import org.hibernate.SQLQuery; +import org.hibernate.Session; + +import com.fp.common.helper.BeanManager; +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.data.ThreadFacade; + +/** + * Clase que se encarga del manejo de la favtoria de EntityManager. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class PersistenceManager { + + /** + * Key para genrar un map de los beans mapeados en el archivo de hbconfiguration. + */ + public static final String NAME = "NAMES"; + + /** + * Key que alamacena el numero de sessiones abiertas en el sessionfactory. + */ + public static final String OPEN = "OPEN"; + + /** + * Key que alamacena el numero de sessiones cerradas en el sessionfactory. + */ + public static final String CLOSED = "CLOSED"; + + /** + * Key que almacenal hora en la que se genero el sessionfactory . + */ + public static final String START_TIME = "START TIME"; + + /** + * Instancia a la que hace referencia el Sigleton + */ + private static PersistenceManager instance = null; + + /** + * Map de EntityManagerFactory ejb por compania. + */ + private final Map memfejb = new HashMap(); + + /** + * Map de EntityManagerFactory local por compania. + */ + private final Map memf = new HashMap(); + + /** + * Map de EntityManagerFactory auxiliar por persistence unit. + */ + private final Map memfaux = new HashMap(); + + /** + * Metodo que entrega una instancia de PersistenceManager, si existe una creada la entrega, caso contrario crea una. + * Adicionalmenet hace el mapping de las tablas del modelo relacional al modelo de objetos, creando el + * EntityManagerFactory. + * + * @return PersistenceManager + */ + public static PersistenceManager getInstance() { + synchronized (PersistenceManager.class) { + if (PersistenceManager.instance == null) { + PersistenceManager.instance = new PersistenceManager(); + PersistenceManager.instance.fillEntityManagerFactory(); + } else { + Integer cia = PersistenceManager.getCompany(); + if (((PersistenceManager.instance.memfejb.get(cia) == null) && PersistenceManager.iSEjb()) + || (PersistenceManager.instance.memf.get(cia) == null)) { + PersistenceManager.instance.fillEntityManagerFactory(); + } + } + } + return PersistenceManager.instance; + } + + /** + * Contruye el entitymanager falctory. + */ + private void fillEntityManagerFactory() { + Integer cia = PersistenceManager.getCompany(); + if ((PersistenceManager.instance.memfejb.get(cia) == null) && PersistenceManager.iSEjb()) { + APPLogger.getLogger().error("CREANDO ENTYTY MANAGER FACTORY EJB: " + cia); + try { + PersistenceManager.instance.memfejb.put(cia, PersistenceManager.getEntityManagerFactory("ejb", cia)); + APPLogger.getLogger().error("CREO ENTYTY MANAGER FACTORY EJB: " + cia); + } catch (Exception e) { + APPLogger.getLogger().error("NO PUEDE CONSTRUIR EL ENTYTY MANAGER FACTORY EJB" + cia); + APPLogger.getLogger().error(e, e); + } + + } + if (PersistenceManager.instance.memf.get(cia) == null) { + APPLogger.getLogger().error("CREANDO ENTYTY MANAGER FACTORY LOCAL: " + cia); + try { + PersistenceManager.instance.memf.put(cia, PersistenceManager.getEntityManagerFactory("local", cia)); + APPLogger.getLogger().error("CREO ENTYTY MANAGER FACTORY LOCAL: " + cia); + } catch (Exception e) { + APPLogger.getLogger().error("NO PUEDE CONSTRUIR EL ENTYTY MANAGER FACTORY LOCAL" + cia); + APPLogger.getLogger().error(e, e); + } + + } + } + + /** + * Metodo que crea y entrega un EntityManagerFactory, dado el persistenceunit mas el codigo de compania. + * + * @param pUnit Nombre del persistenceunit con el cual se crea el EntityManagerFactory. + * @param pCompany Codigo de compania. + * @return EntityManagerFactory + * @throws Exception + */ + private static EntityManagerFactory getEntityManagerFactory(String pUnit, Integer pCompany) throws Exception { + Map configOverrides = new HashMap(); + configOverrides.put("hibernate.ejb.cfgfile", "hibernateFlipMapping.cfg.xml"); + EntityManagerFactory emf = null; + emf = Persistence.createEntityManagerFactory(pUnit + pCompany, configOverrides); + return emf; + } + + /** + * Metodo que entrega una instancia de PersistenceManager para pruebas, si existe una creada la entrega, caso + * contrario crea una. Adicionalmenet hace el mapping de las tablas del modelo relacional al modelo de objetos, + * creando el EntityManagerFactory. + * + * @return PersistenceManager + */ + public static PersistenceManager getInstanceTest() { + synchronized (PersistenceManager.class) { + if (PersistenceManager.instance == null) { + PersistenceManager.instance = new PersistenceManager(); + } + } + Integer cia = PersistenceManager.getCompany(); + if (PersistenceManager.instance.memf.get(cia) == null) { + try { + PersistenceManager.instance.memf.put(cia, PersistenceManager.getEntityManagerFactory("local", cia)); + } catch (Exception e) { + APPLogger.getLogger().error("NO PUEDE CONSTRUIR EL ENTYTY MANAGER FACTORY LOCAL" + cia, e); + } + // Para que no construya uno en pruebas. + PersistenceManager.instance.memfejb.put(cia, PersistenceManager.instance.memf.get(cia)); + } + return PersistenceManager.instance; + } + + /** + * Constructor que se encarga de crear una instancia de PersistenceManager + * + * @param test + */ + public PersistenceManager() { + } + + /** + * Metodo que se encarga de crear un objeto EntityManager. + * + * @return EntityManager + */ + public EntityManager createEntityManager() { + EntityManager em = memfejb.get(PersistenceManager.getCompany()).createEntityManager(); + return em; + } + + /** + * Metodo que se encarga de crear un objeto EntityManager. + * + * @return EntityManager + */ + public EntityManager createEntityManagerLocal() { + EntityManager em = memf.get(PersistenceManager.getCompany()).createEntityManager(); + em.setFlushMode(FlushModeType.COMMIT); + return em; + } + + /** Cierra el SessionFactory */ + public void close() { + memfejb.get(PersistenceManager.getCompany()).close(); + } + + /** + * Entrega EntityManagerFactory dado el persistenceunit name, se utiiza para conecciones auxiliares a bases de + * datos, ejemplo cobis. + * + * @return Map + */ + public EntityManagerFactory getEntityManagerFactoryAuxiliar(String pUnit) { + EntityManagerFactory emf = memfaux.get(pUnit); + if (emf == null) { + emf = Persistence.createEntityManagerFactory(pUnit); + memfaux.put(pUnit, emf); + } + return emf; + } + + /** + * Permite Fijar el estado de Trace de la Conexión + * + * @param pSession Session de hibernate de Referencia + * @param pStatus Estado del Trace. + * @throws SQLException + * @throws Exception + */ + public void setTrace(Session pSession, boolean pStatus) { + SQLQuery sql = pSession.createSQLQuery("alter session set sql_trace =" + pStatus); + sql.executeUpdate(); + } + + /** + * Entrega el codigo de compania de trabajo. + * + * @return Integer + * @throws Exception + */ + private static Integer getCompany() { + return ThreadFacade.getSessionData().getCompany(); + } + + private static boolean iSEjb() { + return ThreadFacade.getSessionData().isEjb(); + } + + public Class findEntityClass(String pTable) throws Exception { + return this.findEntity(pTable).getJavaType(); + } + + public EntityType findEntity(String pTable) throws Exception { + EntityManagerFactory emf = PersistenceHelper.getEntityManager().getEntityManagerFactory(); + Set> set = emf.getMetamodel().getEntities(); + EntityType entity = null; + for (EntityType entityType : set) { + Table t = entityType.getJavaType().getAnnotation(Table.class); + if (t.name().compareTo(pTable) == 0) { + entity = entityType; + break; + } + } + return entity; + } + + @SuppressWarnings("rawtypes") + public static List getDataBasePKFields(Class bean) { + List ldata = new ArrayList(); + for (Field f : bean.getDeclaredFields()) { + if (f.isAnnotationPresent(EmbeddedId.class)) { + Class pkT = f.getType(); + for (Field f1 : pkT.getDeclaredFields()) { + if (f1.isAnnotationPresent(Column.class)) { + ldata.add("pk." + f1.getAnnotation(Column.class).name().toLowerCase()); + } + } + } + } + if (ldata.isEmpty()) { + ldata.add("pk"); + } + return ldata; + } + + public List getDataBaseFields(String pTable) throws Exception { + List data = new ArrayList(); + Class et = this.findEntityClass(pTable); + for (Field f : et.getDeclaredFields()) { + if (f.isAnnotationPresent(Column.class)) { + data.add(f.getAnnotation(Column.class).name()); + } + if (f.isAnnotationPresent(EmbeddedId.class)) { + Class pkT = f.getType(); + for (Field f1 : pkT.getDeclaredFields()) { + if (f1.isAnnotationPresent(Column.class)) { + data.add(f1.getAnnotation(Column.class).name()); + } + } + } + } + return data; + } + + /** + * Entrega el tipo de dato de un campo de una clase. Si no encuentra el campo retorna null. + * + * @param clase Clase a buscar el tipo de dato de un campo. + * @param field Nombre del campo a buscar en la clase. + * @return Class + */ + public static Class getType(Class clase, String field) { + Class tipo = null; + for (Field f : clase.getDeclaredFields()) { + tipo = f.getType(); + if (f.isAnnotationPresent(EmbeddedId.class)) { + for (Field f1 : tipo.getDeclaredFields()) { + if (f1.isAnnotationPresent(Column.class) && f1.getName().equals(field)) { + tipo = f1.getType(); + return tipo; + } + } + } + if (f.isAnnotationPresent(Column.class) && f.getName().equals(field)) { + return tipo; + } + } + return null; + } + + /** + * Convierte el valor al tipo de satos del atributo de la clase. + * + * @param bean Nombre de la clase a buscar el tipo de datos de un campo. + * @param field Nombre del campo a buscar el tipo de dato. + * @param value Valor a transformar al tipo de dato de una clase. + * @return Object + * @throws Exception + */ + public static Object changeType(String bean, String field, Object value) throws Exception { + if (value == null) { + return value; + } + // Convierte el valor del criterio al tipo especifico del campo de la clase. + Class tipo = PersistenceManager.getType(Class.forName(bean), field.replace("pk.", "")); + if (tipo != null) { + value = BeanManager.convertObject(value, tipo); + } + return value; + } + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/PersistenceMetadata.java.svn-base b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/PersistenceMetadata.java.svn-base new file mode 100644 index 0000000..da2e185 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/.svn/text-base/PersistenceMetadata.java.svn-base @@ -0,0 +1,294 @@ +package com.fp.persistence.commondb; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.hibernate.cfg.Configuration; +import org.hibernate.mapping.Column; +import org.hibernate.mapping.PersistentClass; +import org.hibernate.mapping.Property; +import org.hibernate.mapping.RootClass; +import org.hibernate.mapping.SimpleValue; + +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.commondb.helper.FormatDates; + + +public class PersistenceMetadata { + private Configuration cfg; + public PersistenceMetadata(Configuration pConf){ + this.cfg=pConf; + } + private PersistentClass getPresistenceClass(String pName) throws CommondbException{ + PersistentClass c=cfg.getClassMapping(pName); + if(c==null){ + throw new CommondbException("COMMONDB-0009","EL BEAN {0} NO SE ENCUENTRA EN EL SESSIONFACTORY",pName); + } + return c; + } + /** + * Entrega el nombre de la propiedad del Bean que hace referencia al Campo Dado + * @param pBean Clase de tipo Bean + * @param pField Campo de la Tabla + * @return Propiedad del Bean. + * @throws CommonException + * @throws Exception + */ + @SuppressWarnings({ "rawtypes" }) +public String getJavaProperty(Class pBean,String pField) throws CommondbException { + PersistentClass c=getPresistenceClass(pBean.getName()); + Iterator it=c.getKey().getColumnIterator(); + int cont = 0; + while(it.hasNext()) { + it.next(); + cont ++; + } + it=c.getKey().getColumnIterator(); + while(it.hasNext()){ + Column col=(Column)it.next(); + if(col.getName().toUpperCase().compareTo(pField.toUpperCase()) == 0){ + if (cont == 1){ + return "pk"; + } + + return "pk."+pField.toLowerCase(); + } + } + return pField.toLowerCase(); + } +@SuppressWarnings("rawtypes") +public String getFieldName(Class pBean,String pField) throws CommondbException { + PersistentClass c=getPresistenceClass(pBean.getName()); + Iterator it=c.getPropertyIterator(); + if(pField.toLowerCase().indexOf("pk.")>-1){ + pField=pField.substring(pField.toLowerCase().indexOf("pk.")+3); + it=c.getKey().getColumnIterator(); + while (it.hasNext()) { + Column element = (Column) it.next(); + if(element.getName().compareTo(pField)==0){ + return element.getName().toUpperCase(); + } + } + throw new CommondbException("",""); + } + if(pField.compareToIgnoreCase("pk")==0){ + it=c.getKey().getColumnIterator(); + Column col = (Column)it.next(); + if(it.hasNext()){ + throw new CommondbException("",""); + } + return col.getName().toUpperCase(); + } + while(it.hasNext()){ + Property col=(Property)it.next(); + if(col.getName().compareToIgnoreCase(pField.toUpperCase()) == 0){ + return pField.toUpperCase(); + } + } + throw new CommondbException("",""); + } + /** + * Verifica si un campo es un atributo del bean. + * @param pBean Nombre del bean que maneja la persistencia de una tabla + * @param pCampo Campo de la Tabla + * @return + * @throws CommonException + * @throws Exception + */ + +@SuppressWarnings("rawtypes") +public boolean isJavaProperty(Class pBean,String pField) throws CommondbException { + PersistentClass c=getPresistenceClass(pBean.getName()); + Iterator it=c.getTable().getColumnIterator(); + while(it.hasNext()){ + Column col=(Column)it.next(); + if(col.getName().toUpperCase().compareTo(pField.toUpperCase()) == 0){ + return true; + } + } + return false; + } + /** + * Entrega el nombre del campo de una tabla. Si la tabla tiene un unicampo campo que forma parte del primary key de la misma. + * @param pBean Nombre del bean que maneja la persistencia de una tabla. + * @return + * @throws CommonException + * @throws Exception + */ +@SuppressWarnings("rawtypes") +public String getFieldnameByPkSingleField(Class pBean) throws CommondbException { + PersistentClass c=getPresistenceClass(pBean.getName()); + Iterator it=c.getKey().getColumnIterator(); + int cont = 0; + Column col = null; + while(it.hasNext()) { + col = (Column)it.next(); + cont ++; + } + if (cont == 1){ + return col.getName().toUpperCase(); + } + if(cont > 1){ + throw new CommondbException("COMMONDB-00010","TABLA {0} TIENE UN PRIMARY KEY COMPUESTO ",c.getTable().getName().toUpperCase()); + } + return null; + } + + /** + * Entrega un lista de campos que forman el primary key de una tabla. + * @param pBean Nombre del bean que maneja la persistencia de una tabla. + * @return lFieldspk + * @throws CommonException + * @throws Exception + */ +@SuppressWarnings("rawtypes") +public List getFieldsPrimaryKey(Class pBean) throws CommondbException { + PersistentClass c=getPresistenceClass(pBean.getName()); + Iterator it=c.getKey().getColumnIterator(); + Column col = null; + List lFieldspk = new ArrayList(); + while(it.hasNext()) { + col = (Column)it.next(); + lFieldspk.add(col.getName().toUpperCase()); + } + return lFieldspk; + } + + /** + * Enterga el campo que maneja el versionamiento de un bean. + * @param pBean Clase de tipo Bean + * @return + * @throws CommonException + * @throws Exception + */ +@SuppressWarnings("rawtypes") +public String getFieldVersion(Class pBean) throws CommondbException { + PersistentClass c=getPresistenceClass(pBean.getName()); + String version = null; + if(c.getVersion() != null){ + version = c.getVersion().getName(); + } + return version; + } + + /** + * Enterga el nombre de la tabla de un bean. + * @param pBean Clase de tipo Bean + * @return + * @throws CommonException + * @throws Exception + */ + @SuppressWarnings("rawtypes") +public String getTableName(Class pBean) throws CommondbException { + PersistentClass c=getPresistenceClass(pBean.getName()); + String table = c.getTable().getName().toUpperCase(); + return table; + } + public String getClassName(String pName) throws CommondbException{ + return this.getPresistenceClass(pName).getClassName(); + } + + /** + * Enterga el bean que maneja una tabla. + * @param pTablename Nombre de la tabla. + * @return Nombre de la clase que implementa el Bean + * @throws CommonException + * @throws Exception + */ + @SuppressWarnings("rawtypes") +public String getBeanname(String pTablename) throws CommondbException { + Iterator itr = cfg.getClassMappings(); + String bean = null; + while (itr.hasNext()) { + RootClass rc = (RootClass)itr.next(); + if(rc.getTable().getName().toUpperCase().compareTo(pTablename.toUpperCase()) == 0){ + bean = rc.getClassName(); + } + } + if(bean == null){ + throw new CommondbException("COMMONDB-00011","BEAN NO DEFINIDO PARA LA TABLA {0} ",pTablename); + } + return bean; + } + /** + * Transforma el valor al tipo de dato del tabla.campo. + * @param pBean Nombre del bean que maneja l apersistencia de una tabla. + * @param pCampo Nombre de un campo que pertenece a una tabla manejada por el bean. + * @param pValue Valor del campo, puede estar en un tipo de dato distinto al de la tabla. + * @return newvalue Valor con el tipo de dato del campo en la tabla. + * @throws CommonException + * @throws ParseException + * @throws ClassNotFoundException + * @throws NoSuchFieldException + * @throws SecurityException + * @throws Exception + */ + @SuppressWarnings("rawtypes") +public Object convertValueType(String pBean,String pCampo,Object pValue) throws CommondbException, ParseException, SecurityException, NoSuchFieldException, ClassNotFoundException { + Object newvalue = null; + String type = ""; + if(pCampo.compareTo("pk")!=0){ + PersistentClass c=getPresistenceClass(pBean); + Iterator it=c.getTable().getColumnIterator(); + Column column = null; + boolean find = false; + while (it.hasNext()){ + column = (Column)it.next(); + if(column.getName().toUpperCase().compareTo(pCampo.toUpperCase()) == 0){ + find = true; + break; + } + } + if(!find){ + throw new CommondbException("COMMONDB-00012","CAMPO {0} NO DEFINIDO EN LA TABLA {1}",pCampo,c.getTable().getName()); + } + SimpleValue simplevalue = (SimpleValue)column.getValue(); + type = simplevalue.getTypeName(); + }else{ + type=Class.forName(pBean).getDeclaredField(pCampo).getType().getName(); + } + if(pValue.getClass().getName().compareTo(type) == 0 ){ + newvalue = pValue; + }else{ + if(type.compareTo("java.lang.String") == 0 ){ + newvalue = pValue; + } + if(type.compareTo("java.lang.Integer") == 0 ){ + newvalue = new Integer(pValue.toString()); + } + if(type.compareTo("java.math.BigDecimal") == 0 ){ + DecimalFormatSymbols dfs = new DecimalFormatSymbols(); + dfs.setDecimalSeparator('.'); + dfs.setGroupingSeparator(','); + DecimalFormat df = new DecimalFormat("##############.#######",dfs); + newvalue = new BigDecimal(df.parse(pValue.toString()).doubleValue()); + } + if(type.compareTo("java.sql.Date") == 0 ){ + SimpleDateFormat sdf = FormatDates.getInstance().getTransportDatetimeFormat(); + newvalue = new Date(sdf.parse(pValue.toString()).getTime()); + } + if(type.compareTo("java.sql.Timestamp") == 0 ){ + SimpleDateFormat sdf = FormatDates.getInstance().getTransportDatetimeFormat(); + try{ + String valor=pValue.toString(); + if(valor.length()==10){ + valor+=" 00:00:00.0"; + } + newvalue = new Timestamp(sdf.parse(valor).getTime()); + + }catch(Exception ex){ + ex.printStackTrace(); + } + } + } + return newvalue; + } +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/FlipUserTransaction.java b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/FlipUserTransaction.java new file mode 100644 index 0000000..b5cf667 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/FlipUserTransaction.java @@ -0,0 +1,68 @@ +package com.fp.persistence.commondb; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceException; +import javax.transaction.NotSupportedException; +import javax.transaction.RollbackException; +import javax.transaction.Status; +import javax.transaction.SystemException; +import javax.transaction.UserTransaction; + +public class FlipUserTransaction implements UserTransaction { + + private EntityManager em; + + public FlipUserTransaction(EntityManager em) { + this.em = em; + } + + public void begin() throws NotSupportedException { + if (em.getTransaction().isActive()) { + throw new NotSupportedException(); + } + em.getTransaction().begin(); + } + + public void commit() throws RollbackException { + try { + em.getTransaction().commit(); + } catch (javax.persistence.RollbackException e) { + throw new RollbackException(e.getMessage()); + } + } + + public void rollback() throws SystemException { + try { + em.getTransaction().rollback(); + } catch (PersistenceException e) { + throw new SystemException(e.getMessage()); + } + } + + public void setRollbackOnly() { + em.getTransaction().setRollbackOnly(); + } + + public int getStatus() { + if (em.getTransaction().isActive()) { + return Status.STATUS_ACTIVE; + } else { + return Status.STATUS_NO_TRANSACTION; + } + } + + public void setTransactionTimeout(int timeout) { + throw new UnsupportedOperationException(); + } + + public void close() { + try { + if (em.isOpen()) { + em.clear(); + em.close(); + } + } catch (Exception e) { + // No hacer nada la sessioo no est aabierta + } + } +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/GeneralQuery.java b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/GeneralQuery.java new file mode 100644 index 0000000..564aed6 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/GeneralQuery.java @@ -0,0 +1,222 @@ +package com.fp.persistence.commondb; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.persistence.Query; + +import com.fp.common.helper.BeanManager; +import com.fp.common.logger.APPLogger; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; + +/** + * Clase que agrega los parametros y valores a una consulta + * + * @author wpatio + */ +public class GeneralQuery { + + /** + * Mtodo que agrega los parmetros de una consulta + * + * @param qb + * @param jpql + * @param mcriteria + * @throws Exception + */ + public static void addParameters(QueryBean qb, StringBuilder jpql, Map mcriteria) throws Exception { + GeneralQuery.addParameters(qb, jpql, mcriteria, false); + } + + /** + * Mtodo que agrega los parmetros de una consulta + * + * @param qb + * @param jpql + * @param mcriteria + * @throws Exception + */ + public static void addParameters(QueryBean qb, StringBuilder jpql, Map mcriteria, boolean isnative) throws Exception { + if (qb == null) { + return; + } + List lcriteria = qb.getCriteria(); + for (QueryCriteria obj : lcriteria) { + String condition = obj.getOperation(); + if (obj.getProperty() == null || obj.getValue() == null && condition == null) { + continue; + } + String aux = obj.getProperty(); + if (isnative) { + if (aux.indexOf(".") > 0) { + // Es if va en este punto por que el in puede llegar en un campo de llave primaria o en cualquier + // otro campo. + aux = aux.substring(3, aux.length()); + } + String param = obj.getProperty(); + if (condition.compareTo("in") == 0 || condition.compareTo("not in") == 0) { + jpql.append(" and t.").append(aux).append(" ").append(obj.getOperation()).append(" (").append(obj.getValue()).append(") "); + aux = null; + } else { + jpql.append(" and t.").append(aux).append(" ").append(obj.getOperation()).append(" :").append(param); + aux = param; + } + + } else { + aux = aux.replace(".", "_"); + jpql.append(" and t.").append(obj.getProperty()).append(" ").append(obj.getOperation()).append(" :").append(aux); + } + + if (aux != null) { + mcriteria.put(aux, obj.getValue()); + } + + } + // Order by de la sentencia + boolean first = true; + for (QueryCriteria order : qb.getOrder(true)) { + if (first) { + jpql.append(" ORDER BY "); + } else { + jpql.append(" ,"); + } + jpql.append("t.").append(order.getProperty()).append(" asc "); + first = false; + } + } + + /** + * Metodo que agrega el valos a los parametros para la consulta + * + * @param qb + * @param mcriteria + * @param qry + * @throws Exception + */ + public static void setParameters(QueryBean qb, Map mcriteria, Query qry) throws Exception { + if (qb == null) { + return; + } + Object beanReference = Class.forName(qb.getBeanName()).newInstance(); + Set s = mcriteria.keySet(); + Class type = null; + for (String key : s) { + try { + String aux = key; + aux = aux.replace("_", "."); + type = BeanManager.getBeanGetterMethod(beanReference, aux).getReturnType(); + } catch (Exception e1) { + APPLogger.getLogger().error(e1.getStackTrace()); + } + Object value = mcriteria.get(key); + try { + value = BeanManager.convertObject(value, type); + } catch (Exception e) { + } + qry.setParameter(key, value); + } + Integer page = qb.getPage(); + if (page != null && page >= 0 && qb.getPageSize() > 0) { + if (page > 1) { + qry.setFirstResult((qb.getPage() - 1) * qb.getPageSize()); + } + qry.setMaxResults(qb.getPageSize()); + } + } + + public static void paginate(QueryBean qb, Query qry) throws Exception { + Integer page = new Integer(qb.getPage()); + Integer recordperpage = new Integer(qb.getPageSize()); + if (page != null && recordperpage != null && page >= 0 && recordperpage > 0) { + if (page > 1) { + qry.setFirstResult((page - 1) * recordperpage); + } + qry.setMaxResults(recordperpage); + } + } + + public static void addParametersJSF(StringBuilder jpql, DtoQuery dto) { + GeneralQuery.addParametersJSF(jpql, dto, true); + } + + /** + * Agrega parametros a una consulta JSF + * + * @param jpql Consulta + * @param dto Objeto data transport + */ + public static void addParametersJSF(StringBuilder jpql, DtoQuery dto, boolean addwhere) { + List lfilters = dto.getLfilter(); + boolean first = addwhere; + String aux = " and "; + if (!lfilters.isEmpty()) { + for (Filter filter : lfilters) { + String condition = filter.getCondition() != null ? "=" : filter.getValue().indexOf("%") >= 0 ? "like" : "="; + jpql.append(aux).append("t." + filter.getField() + " ").append(condition).append(" :" + filter.getField().replace(".", "_")); + } + } + } + + /** + * Fija el valor a parametros de una consulta JSF + * + * @param jpql Consulta + * @param dto Objeto data transport + * @param + */ + public static void setParametersJSF(StringBuilder jpql, DtoQuery dto, Query qry) throws Exception { + List lfilters = dto.getLfilter(); + Object beanReference = Class.forName(dto.getBeanname()).newInstance(); + try { + Object beankey = Class.forName(dto.getBeanname() + "Key").newInstance(); + if (beankey != null) { + BeanManager.setBeanAttributeValue(beanReference, "pk", beankey); + } + } catch (Exception e) { + // No hacer nada + } + + Class type = null; + if (!lfilters.isEmpty()) { + for (Filter filter : lfilters) { + type = BeanManager.getBeanGetterMethod(beanReference, filter.getField()).getReturnType(); + Object value = BeanManager.convertObject(filter.getValue(), type); + qry.setParameter(filter.getField().replace(".", "_"), value); + } + } + Integer pagina = dto.getPage(); + Integer numreg = dto.getRecperpage() == null ? 10 : dto.getRecperpage(); + // Control de paginacion. + if (dto.isMultirecord()) { + qry.setFirstResult(pagina); + qry.setMaxResults(numreg); + } + } + + /** + * Fija el valor a parametros de una consulta JSF + * + * @param jpql Consulta + * @param dto Objeto data transport + * @param + */ + public static void setParametersNative(StringBuilder jpql, DtoQuery dto, Query qry) throws Exception { + List lfilters = dto.getLfilter(); + if (!lfilters.isEmpty()) { + for (Filter filter : lfilters) { + qry.setParameter(filter.getField().replace(".", "_"), filter.getValue()); + } + } + Integer page = dto.getPage(); + if (page != null && page >= 0 && dto.getRecperpage() > 0) { + if (page > 1) { + qry.setFirstResult((dto.getPage() - 1) * dto.getRecperpage()); + } + qry.setMaxResults(dto.getRecperpage()); + } + } +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/HqlStatement.java b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/HqlStatement.java new file mode 100644 index 0000000..fb0424b --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/HqlStatement.java @@ -0,0 +1,394 @@ +package com.fp.persistence.commondb; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.text.ParseException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Parameter; +import javax.persistence.Query; + +import org.apache.log4j.Logger; +import org.hibernate.HibernateException; + +import com.fp.common.exception.CommonException; +import com.fp.common.logger.APPLogger; +import com.fp.dto.hb.Log; +import com.fp.persistence.commondb.exception.CommondbException; + +/** + * @author jorge + * + */ +public class HqlStatement { + + /** + * Map auxiliar empleado para el manejo de Parametros + */ + private Map map; + + /** + * Sentencia HQL a ejecutar + */ + private String sentence; + + /** + * EntityManager de hibernate empleada en la consulta + */ + private EntityManager em; + + /** + * Indicador de si la consulta requiere manejar Cache + */ + private boolean cacheAbled = false; + + /** + * Indicador de si la consulta es de Lectura solamente + */ + private boolean readonly = false; + + /** + * Pagina en la que se encuentra la consulta + */ + private Integer page = null; + + /** + * Numero de registros por pagina + */ + private Integer recordperpage = null; + + private Integer i = null; + + /** + * Referencia al Log + */ + private Logger log = APPLogger.getLogger(); + + /** + * Entrega el valor de page. + * + * @return page. + */ + public Integer getPage() { + return this.page; + } + + /** + * Fija el valor de page. + * + * @param pPage. + */ + public void setPage(Integer pPage) { + this.page = pPage; + } + + /** + * Entrega el valor de recordperpage. + * + * @return recordperpage. + */ + public Integer getRecordperpage() { + return this.recordperpage; + } + + /** + * Fija el valor de recordperpage. + * + * @param pRecordperpage. + */ + public void setRecordperpage(Integer pRecordperpage) { + this.recordperpage = pRecordperpage; + } + + /** + * Crea una nueva instancia de UtilHB + * + * @throws CommonException + * + */ + public HqlStatement() throws CommondbException { + this(null); + } + + /** + * Crea una nueva instancia con una sentencia a ejecutar. + * + * @param pSentence Sentencia a ejecutar + * @param pLockMode Tipo de Bloqueo Pesismista + * @param pLocktime Tiempo de espera para un bloqueo pesimista. + * @throws CommonException + * @throws Exception + */ + public HqlStatement(String pSentence) throws CommondbException { + this.sentence = pSentence; + this.map = new HashMap(); + this.em = PersistenceHelper.getEntityManager(); + } + + /** + * Fija un criterio string de la sentencia. El nombre del parametro debe ser igual al del where de la sentencia. + * + * @param pParameter + * @param pString + */ + public void setString(String pParameter, String pString) { + this.map.put(pParameter, pString); + } + + /** + * Fija un criterio Data a la sentencia. El nombre del parametro debe ser igual al del where de la sentencia. + * + * @param pParameter + * @param pDate + */ + public void setDate(String pParameter, Date pDate) { + this.map.put(pParameter, pDate); + } + + /** + * Fija un criterio Timestamp a la sentencia. El nombre del parametro debe ser igual al del where de la sentencia. + * + * @param pParameter + * @param pTimestamp + */ + public void setTimestamp(String pParameter, Timestamp pTimestamp) { + this.map.put(pParameter, pTimestamp); + } + + /** + * Fija un criterio Integer a la sentencia. El nombre del parametro debe ser igual al del where de la sentencia. + * + * @param pParameter + * @param pInteger + */ + public void setInteger(String pParameter, Integer pInteger) { + if (pInteger == null) { + this.map.put(pParameter, Integer.class); + } else { + this.map.put(pParameter, pInteger); + } + } + + + /** + * Fija un criterio Long a la sentencia. El nombre del parametro debe ser igual al del where de la sentencia. + * + * @param pParameter + * @param pLong + */ + public void setLong(String pParameter, Long pLong) { + if (pLong == null) { + this.map.put(pParameter, Long.class); + } else { + this.map.put(pParameter, pLong); + } + } + + /** + * Fija un criterio BigDecimal a la sentencia. El nombre del parametro debe ser igual al del where de la sentencia. + * + * @param pParameter + * @param pBigdecimal + */ + public void setBigDecimal(String pParameter, BigDecimal pBigdecimal) { + if (pBigdecimal == null) { + this.map.put(pParameter, BigDecimal.class); + } else { + this.map.put(pParameter, pBigdecimal); + } + } + + /** + * Setea valores de parametros definidos previamente en una sentencia. + * + * @param pMparamters Map con el nombre del parametro y el valor del mismo. + * @throws Exception + */ + public void setParametersValue(Map pMparamters) { + Iterator itr = pMparamters.keySet().iterator(); + while (itr.hasNext()) { + String key = itr.next(); + Object value = pMparamters.get(key); + if (value instanceof String) { + this.setString(key, (String) value); + } + if (value instanceof Integer) { + this.setInteger(key, (Integer) value); + } + if (value instanceof Long) { + this.setLong(key, (Long) value); + } + if (value instanceof BigDecimal) { + this.setBigDecimal(key, (BigDecimal) value); + } + if (value instanceof Date) { + this.setDate(key, (Date) value); + } + if (value instanceof Timestamp) { + this.setTimestamp(key, (Timestamp) value); + } + } + } + + /** + * Retorna: un entity si la sentencia retorna un entity, si es un conjunto de campos de una o mas tablas retorna un + * Array. + *
    + *
  1. Objeto que contiene una entidad si la sentencia retorna un entity
    + * sentencia ==> from com.test.Test as t where t.pk.c1 = :valor1
  2. + *
  3. Array que contiene una entidad si la sentencia retorna mas de un campo
    + * sentencia ==> select t.c1,t.c2...t.c3 from com.test.Test as t
  4. + *
  5. Array que contiene una entidades o campos cuando existe junturas. sentencia ==> from com.test.Test a,from + * com.test.Testuno b where a.pk=b.pk and b.pk.lenguage = 'ES'
  6. + *
+ * + * @return + * @throws CommonException + * @throws HibernateException + * @throws ParseException + * @throws Exception + */ + public Object getObject() throws HibernateException, CommondbException, ParseException, SQLException, Exception { + Object obj = null; + try { + obj = this.execute().getSingleResult(); + } catch (NoResultException e) { + return obj; + } + if (this.readonly) { + this.em.detach(obj); + } + return obj; + } + + @SuppressWarnings("unchecked") + public T getObject(@SuppressWarnings("unused") + Class pType) throws HibernateException, CommondbException, ParseException, SQLException, Exception { + T obj = null; + try { + obj = (T) this.execute().getSingleResult(); + } catch (NoResultException e) { + return obj; + } + if (this.readonly) { + this.em.detach(obj); + } + return obj; + } + + /** + * Ejecuta una sentencia. + * + * @return + * @throws CommonException + * @throws ParseException + * @throws Exception + */ + @SuppressWarnings("rawtypes") + public Query execute() throws CommondbException, ParseException, Exception { + if (this.sentence == null) { + throw new CommondbException("COMMONDB-0007", "SENTENCIA INVALIDA"); + } + // Query qry=(QueryImpl)em.createQuery(sentence); + APPLogger.getLogger().debug("Sentencia ==> " + this.sentence); + Query qry = this.em.createQuery(this.sentence); + Set> param = qry.getParameters(); + // String[]param=qry.getNamedParameters(); + for (Parameter par : param) { + String parameter = par.getName(); + Object obj = this.map.get(parameter); + if (obj == null) { + throw new CommondbException("COMMONDB-0008", "VALOR NO ENVIADO {0}", parameter); + } + qry.setParameter(parameter, obj); + } + if ((this.page != null) && (this.recordperpage != null) && (this.page >= 0) && (this.recordperpage > 0)) { + if (this.page > 1) { + qry.setFirstResult((this.page - 1) * this.recordperpage); + } + qry.setMaxResults(this.recordperpage); + } + return qry; + } + + /** + * Fija una sentencia a ejecutar. + * + * @param pSentence + */ + public void setSentence(String pSentence) { + this.map.clear(); + this.sentence = pSentence; + } + + /** + * Entrega la sentencia a ejecutar. + * + * @return + */ + public String getSentence() { + return this.sentence; + } + + /** + * Marca la setencia para cache. + * + * @param cacheAbled + */ + public void setCacheAbled(boolean cacheAbled) { + this.cacheAbled = cacheAbled; + } + + /** + * Indica si la sentencia esta marcada para cache. + * + * @return + */ + public boolean isCacheAbled() { + return this.cacheAbled; + } + + /** + * Fija la sentencia en readonly. + * + * @param readonly + */ + public void setReadonly(boolean readonly) { + this.readonly = readonly; + } + + /** + * Indica si la sentencia a ejecutar es solo de lectura. + * + * @return + */ + public boolean isReadonly() { + return this.readonly; + } + + /** + * Entrega el valor de: i + * + * @return Integer + */ + public Integer getI() { + return this.i; + } + + /** + * Fija el valor de: i + * + * @param i value to set + */ + public void setI(Integer i) { + this.i = i; + } + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/NestedSave.java b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/NestedSave.java new file mode 100644 index 0000000..e0bd2e7 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/NestedSave.java @@ -0,0 +1,62 @@ +package com.fp.persistence.commondb; + +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.logger.APPLogger; +import com.fp.dto.hb.HibernateBean; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; + +/** + * Clase que permite grabar o actualizar informacin en la base de datos en una sesin de base de datos independiente a + * la utiliza en la ejecucin de una transaccin.. + * + * @version 2.1 + */ +public class NestedSave extends Thread { + private final HibernateBean[] bean; + + private final Integer company; + + private boolean merge; + + public NestedSave(Integer pCompany, HibernateBean... pBean) { + bean = pBean; + company = pCompany; + } + + public NestedSave(Integer pCompany, boolean merge, HibernateBean... pBean) { + bean = pBean; + company = pCompany; + this.merge = merge; + } + + @Override + public void run() { + try { + SessionData s = new SessionData(); + s.setCompany(company); + ThreadFacade.setSaveRequest(s); + PersistenceHelper.setEntityManager(PersistenceManager.getInstance().createEntityManagerLocal()); + PersistenceHelper.beginNewTransaction(); + for (HibernateBean b : bean) { + if (!merge) { + APPLogger.getLogger().info("Inserta registro de auditoria"); + PersistenceHelper.getEntityManager().detach(b); + PersistenceHelper.save(b); + } else { + PersistenceHelper.getEntityManager().merge(b); + } + + } + PersistenceHelper.commitNewTransaction(); + } catch (Exception e) { + PersistenceHelper.rollbackNewTransaction(); + ExceptionHandler eh = new ExceptionHandler(e, "es"); + String usrmsg = eh.getUserMessage(); + APPLogger.getLogger().error("User Message:==> " + usrmsg); + APPLogger.getLogger().error("Stack trace:==> " + eh.getStackTrace()); + } finally { + PersistenceHelper.closeSession(); + } + } +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/PersistenceHelper.java b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/PersistenceHelper.java new file mode 100644 index 0000000..9cc5e0e --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/PersistenceHelper.java @@ -0,0 +1,853 @@ +package com.fp.persistence.commondb; + +import java.sql.Timestamp; +import java.util.ResourceBundle; + +import javax.ejb.NoSuchEntityException; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NameNotFoundException; +import javax.naming.NamingException; +import javax.persistence.EntityManager; +import javax.persistence.EntityTransaction; +import javax.persistence.Query; +import javax.persistence.TypedQuery; +import javax.transaction.HeuristicMixedException; +import javax.transaction.HeuristicRollbackException; +import javax.transaction.NotSupportedException; +import javax.transaction.RollbackException; +import javax.transaction.SystemException; +import javax.transaction.TransactionManager; +import javax.transaction.UserTransaction; + +import org.hibernate.HibernateException; +import org.hibernate.Session; + +import bitronix.tm.TransactionManagerServices; + +import com.fp.common.exception.APPException; +import com.fp.common.exception.CommonException; +import com.fp.common.helper.BeanManager; +import com.fp.common.logger.APPLogger; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.data.SaveData; +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.History; +import com.fp.dto.hb.Log; +import com.fp.persistence.commondb.cache.CacheManager; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.commondb.log.Audit; + +public class PersistenceHelper { + + /** + * Almacena un EntityManager de JPA. + */ + private static final ThreadLocal threadSession = new ThreadLocal(); + /** + * Almacena una transaccion de Hibernate. + */ + // private static final ThreadLocal threadTransaction = new ThreadLocal(); + private static final ThreadLocal threadTransaction = new ThreadLocal(); + private static final ThreadLocal threadTransactionManager = new ThreadLocal(); + private static final ThreadLocal threadEntityTransaction = new ThreadLocal(); + private static final ThreadLocal threadcommit = new ThreadLocal(); + + /** + * Retorna una session de hibernate. + * + * @return s + * @throws CommonException + * @throws Exception + */ + public static Session getSession() throws CommondbException { + Session s = (Session) PersistenceHelper.threadSession.get().getDelegate(); + if (s == null) { + throw new CommondbException("COMMONDB-0004", "SESION NO ASOCIADA A UNA TRANSACCION"); + } + return s; + } + + public static boolean isrollbackonly() { + try { + UserTransaction ut = PersistenceHelper.threadTransaction.get(); + if (ut != null) { + int i = ut.getStatus(); + if (i == javax.transaction.Status.STATUS_MARKED_ROLLBACK) { + return true; + } + } + TransactionManager tm = PersistenceHelper.threadTransactionManager.get(); + if (tm != null) { + int i = tm.getStatus(); + if (i == javax.transaction.Status.STATUS_MARKED_ROLLBACK) { + return true; + } + } + return false; + } catch (Exception e) { + return false; + } + } + + /** + * Retorna una Connection de tipo sql + * + * @return Connection + * @throws CommonException + * @throws Exception + */ + @SuppressWarnings("deprecation") + /* + public static Connection getConnection() throws CommondbException { + Session s = (Session) PersistenceHelper.threadSession.get().getDelegate(); + if (s == null) { + throw new CommondbException("COMMONDB-0004", "SESION NO ASOCIADA A UNA TRANSACCION"); + } + return s.connection(); + } + */ + + public static EntityManager getEntityManager() throws CommondbException { + EntityManager em = PersistenceHelper.threadSession.get(); + if (em == null) { + throw new CommondbException("COMMONDB-0004", "SESION NO ASOCIADA A UNA TRANSACCION"); + } + return em; + } + + /** + * Encera y cierra el EntityManager. + */ + public static void closeSession() { + try { + EntityManager em = PersistenceHelper.threadSession.get(); + if ((em != null)) { + em.clear(); + } + if (em.isOpen()) { + em.close(); + } + PersistenceHelper.threadTransaction.set(null); + PersistenceHelper.threadSession.set(null); + PersistenceHelper.threadcommit.set(null); + PersistenceHelper.threadTransactionManager.set(null); + PersistenceHelper.threadEntityTransaction.set(null); + } catch (Exception e) { + APPLogger.getLogger().error(e); + } + } + + /** + * Fija una session de hibernate. + * + * @param session + * @throws Exception + */ + public static boolean getThreadcommit() { + if (PersistenceHelper.threadcommit.get() == null) { + return true; + } + return PersistenceHelper.threadcommit.get(); + } + + /** + * Fija una session de hibernate. + * + * @param session + * @throws Exception + */ + public static void setThreadcommit(boolean pDocommit) { + PersistenceHelper.threadcommit.set(pDocommit); + } + + /** + * Fija una session de hibernate. + * + * @param session + * @throws Exception + */ + public static void setEntityManager(EntityManager pEntityManager) { + PersistenceHelper.threadSession.set(pEntityManager); + } + + /** + * Inicia el proceso de una transaccion de hibernate.. + * + * @throws CommonException + * @throws HibernateException + * @throws SystemException + * @throws NotSupportedException + * @throws NamingException + * @throws Exception + */ + public static EntityTransaction beginTransactionLocal() throws HibernateException, CommondbException, NotSupportedException, SystemException, + NamingException { + EntityTransaction et = PersistenceHelper.getEntityManager().getTransaction(); + PersistenceHelper.threadEntityTransaction.set(et); + et.begin(); + return et; + } + + /** + * Inicia el proceso de una transaccion de hibernate.. + * + * @throws CommonException + * @throws HibernateException + * @throws SystemException + * @throws NotSupportedException + * @throws NamingException + * @throws Exception + */ + public static UserTransaction beginTransaction() throws HibernateException, CommondbException, NotSupportedException, SystemException, + NamingException { + PersistenceHelper.called(); + UserTransaction ut = (UserTransaction) new InitialContext().lookup("java:comp/UserTransaction"); + PersistenceHelper.threadTransaction.set(ut); + ut.begin(); + PersistenceHelper.getEntityManager().joinTransaction(); + return ut; + } + + public static void beginNewTransaction() throws HibernateException, CommondbException, NotSupportedException, SystemException, NamingException { + // WebLogic javax.transaction.TransactionManager + // JBOSS java:/TransactionManager + TransactionManager tm = null; + try { + tm = (TransactionManager) new InitialContext().lookup("java:/TransactionManager"); + } catch (NameNotFoundException e) { + tm = TransactionManagerServices.getTransactionManager(); + } + + PersistenceHelper.threadTransactionManager.set(tm); + tm.begin(); + PersistenceHelper.getEntityManager().joinTransaction(); + + } + + /** + * Graba los dml que estan en la transaccion. + * + * @throws CommonException + * @throws Exception + */ + public static void commitNewTransaction() throws Exception { + if (!PersistenceHelper.getThreadcommit()) { + PersistenceHelper.rollbackNewTransaction(); + return; + } + if (PersistenceHelper.isrollbackonly()) { + PersistenceHelper.called(); + throw new APPException("FLIP01", "TRANSACCION NO PERMITE COMMIT"); + } + TransactionManager tx = PersistenceHelper.threadTransactionManager.get(); + try { + if ((tx != null)) { + try { + if (ResourceBundle.getBundle("jndi").getString(Context.INITIAL_CONTEXT_FACTORY) + .compareTo("bitronix.tm.jndi.BitronixInitialContextFactory") == 0) { + PersistenceHelper.flushTransaction(); + PersistenceHelper.getEntityManager().createNativeQuery("commit").executeUpdate(); + } + } catch (Exception e) { + // No hacer nada + } + + tx.commit(); + } else { + throw new CommondbException("COMMONDB-0005", "TRANSACCION YA APLICADA"); + } + } finally { + PersistenceHelper.getEntityManager().clear(); + PersistenceHelper.threadTransactionManager.set(null); + } + } + + /** + * Graba los dml que estan en la transaccion. + * + * @throws CommonException + * @throws Exception + */ + public static void commitTransaction() throws CommondbException, SecurityException, IllegalStateException, RollbackException, + HeuristicMixedException, HeuristicRollbackException, SystemException, APPException { + if (!PersistenceHelper.getThreadcommit()) { + PersistenceHelper.rollbackTransaction(); + return; + } + PersistenceHelper.called(); + if (PersistenceHelper.isrollbackonly()) { + throw new APPException("COMMONDB-0006", "TRANSACCION NO PUEDE SER PROCESADA "); + } + UserTransaction tx = PersistenceHelper.threadTransaction.get(); + try { + if ((tx != null)) { + tx.commit(); + } else { + throw new CommondbException("COMMONDB-0005", "TRANSACCION YA APLICADA"); + } + } finally { + PersistenceHelper.getEntityManager().clear(); + PersistenceHelper.threadTransaction.set(null); + } + } + + /** + * Graba los dml que estan en la transaccion. + * + * @throws CommonException + * @throws Exception + */ + public static void commitTransactionLocal() throws CommondbException, SecurityException, IllegalStateException, RollbackException, + HeuristicMixedException, HeuristicRollbackException, SystemException, APPException { + if (!PersistenceHelper.getThreadcommit()) { + PersistenceHelper.rollbackTransaction(); + return; + } + PersistenceHelper.called(); + if (PersistenceHelper.isrollbackonly()) { + throw new APPException("COMMONDB-0006", "TRANSACCION NO PUEDE SER PROCESADA "); + } + EntityTransaction tx = PersistenceHelper.threadEntityTransaction.get(); + try { + if ((tx != null)) { + tx.commit(); + } else { + throw new CommondbException("COMMONDB-0005", "TRANSACCION YA APLICADA"); + } + } finally { + PersistenceHelper.getEntityManager().clear(); + PersistenceHelper.threadTransaction.set(null); + } + } + + /** + * Graba los dml que estan en la transaccion. + * + * @throws CommondbException + */ + public static void flushTransaction() throws Exception { + + if (PersistenceHelper.isrollbackonly()) { + PersistenceHelper.called(); + throw new APPException("COMMONDB-0006", "TRANSACCION NO PUEDE SER PROCESADA "); + } + EntityManager em = PersistenceHelper.getEntityManager(); + em.flush(); + } + + private static void called() { + StackTraceElement st = new Exception().getStackTrace()[2]; + StackTraceElement st1 = new Exception().getStackTrace()[1]; + APPLogger.getLogger().info( + st1.getMethodName().toUpperCase() + "==>>" + st.getClassName() + "." + st.getMethodName() + ":" + st.getLineNumber()); + } + + /** + * rollback de los dml que estan dentro de la transaccion. + * + * @throws SystemException + * @throws SecurityException + * @throws IllegalStateException + * + * @throws CommonException + */ + public static void rollbackTransaction() { + PersistenceHelper.called(); + UserTransaction tx = PersistenceHelper.threadTransaction.get(); + try { + if ((tx != null)) { + try { + PersistenceHelper.getEntityManager().createNativeQuery("rollback").executeUpdate(); + } catch (Exception e) { + // NO HACER NADA + } + tx.setRollbackOnly(); + tx.rollback(); + } + } catch (Exception e1) { + APPLogger.getLogger().error(e1, e1); + } finally { + PersistenceHelper.threadTransaction.set(null); + } + } + + /** + * rollback de los dml que estan dentro de la transaccion. + * + * @throws SystemException + * @throws SecurityException + * @throws IllegalStateException + * + * @throws CommonException + */ + public static void rollbackTransactionLocal() { + PersistenceHelper.called(); + EntityTransaction tx = PersistenceHelper.threadEntityTransaction.get(); + try { + if ((tx != null)) { + try { + PersistenceHelper.getEntityManager().createNativeQuery("rollback").executeUpdate(); + } catch (Exception e) { + // NO HACER NADA + } + tx.setRollbackOnly(); + tx.rollback(); + } + } catch (Exception e1) { + APPLogger.getLogger().error(e1, e1); + } finally { + PersistenceHelper.threadTransaction.set(null); + } + } + + /** + * rollback de los dml que estan dentro de la transaccion. + * + * @throws SystemException + * @throws SecurityException + * @throws IllegalStateException + * + * @throws CommonException + */ + public static void rollbackNewTransaction() { + Exception e = new Exception(); + StackTraceElement s = e.getStackTrace()[1]; + APPLogger.getLogger().error(s.getClassName() + "." + s.getMethodName() + ":" + s.getLineNumber()); + TransactionManager tx = PersistenceHelper.threadTransactionManager.get(); + if (PersistenceHelper.isrollbackonly()) { + } + try { + if ((tx != null)) { + try { + PersistenceHelper.getEntityManager().createNativeQuery("rollback").executeUpdate(); + } catch (Exception ex) { + tx.setRollbackOnly(); + // NO HACER NADA + } + tx.setRollbackOnly(); + tx.rollback(); + } + } catch (Exception e1) { + APPLogger.getLogger().error(e1, e1); + } finally { + PersistenceHelper.threadTransactionManager.set(null); + } + } + + /** + * Retorna verdadero si a la transacci�n se dio un commit; + * + * @return boolean + * @throws Exception + */ + public static boolean isCommitted() throws Exception { + // EntityTransaction tx = PersistenceHelper.threadTransaction.get(); + UserTransaction tx = PersistenceHelper.threadTransaction.get(); + // if ((tx != null) && !tx.isActive()) { + if ((tx != null)) { + return false; + } + return true; + } + + /** + * Retorna verdadero si a la transacci�n se dio un commit; + * + * @return boolean + * @throws Exception + */ + public static boolean isRolledBack() throws Exception { + // EntityTransaction tx = PersistenceHelper.threadTransaction.get(); + // if ((tx != null) && !tx.isActive()) { + UserTransaction tx = PersistenceHelper.threadTransaction.get(); + if ((tx != null)) { + return false; + } + return true; + } + + /** + * Inserta un registro en la base de datos. + * + * @param pClassName Nombre de la clase que maneja la persistencia de una + * tabla. + * @param pBean Bean a insertar. + * @throws CommonException + * @throws Exception + */ + public static void save(HibernateBean pBean) throws CommondbException, Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + Object id = BeanManager.getBeanAttributeValue(pBean, "pk"); + if ((id instanceof History)) { + if (BeanManager.getBeanAttributeValue(pBean, "datefrom") == null) { + Timestamp t = FormatDates.getInstance().getDataBaseTimestamp(); + BeanManager.setBeanAttributeValue(pBean, "datefrom", t); + } + History pk = (History) id; + BeanManager.setBeanAttributeValue(pk, "dateto", FormatDates.getDefaultExpiryTimestamp()); + } + PersistenceHelper.setIngressUser(pBean); + PersistenceHelper.setLastupdate(pBean); + PersistenceHelper.setCreationDate(pBean); + // s.psave(pClassName,pBean); + em.persist(pBean); + if (pBean instanceof Log) { + Audit.insert(pBean); + } + } + + /** + * Actualiza un registro en la base de datos. + * + * @param pBean Bean a actualiar. + * @throws CommonException + * @throws Exception + */ + public static void update(HibernateBean pBean) throws CommondbException { + EntityManager em = PersistenceHelper.getEntityManager(); + // pBean = em.merge(pBean); + if (!em.contains(pBean)) { + throw new NoSuchEntityException(); + } + } + + /** + * Actualiza o inserta un registro en la base de datos. + * + * @param pBean Bean a actualiar o insertar. + * @throws CommonException + * @throws Exception + */ + public static void saveOrUpdate(HibernateBean pBean) throws CommondbException, Exception { + PersistenceHelper.called(); + APPLogger.getLogger().info(pBean.getClass().getName()); + APPLogger.getLogger().debug(pBean); + EntityManager em = PersistenceHelper.getEntityManager(); + + Object id = BeanManager.getBeanAttributeValue(pBean, "pk"); + if ((id instanceof History)) { + HibernateBean bean = PersistenceHelper.manageHistory(pBean, id); + pBean = em.merge(bean); + } else { + em.detach(pBean); + PersistenceHelper.setModifyUser(pBean); + PersistenceHelper.setLastupdate(pBean); + PersistenceHelper.setCreationDate(pBean); + if (pBean instanceof Cache) { + // Limpia el cache de datos internamente obtiene el nombre real del bean sin considerar el paquete. + CacheManager cm = CacheManager.getInstance(); + cm.clean(pBean.getClass().getName()); + } + if ((pBean instanceof Log)) { + HibernateBean oldbean = em.find(pBean.getClass(), id); + if (oldbean != null) { + // Graba log de auditoria. + Audit.process(pBean, oldbean); + } + } + pBean = em.merge(pBean); + } + } + + public static void persist(HibernateBean pBean) throws CommondbException, Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + PersistenceHelper.setIngressUser(pBean); + em.persist(pBean); + Audit.insert(pBean); + } + + /** + * Metodo que se encarga de caducar un registro que maneja historia. + * + * @param pBean Bean a caducar. + * @throws CommondbException + * @throws Exception + */ + public static void expire(HibernateBean pBean) throws CommondbException, Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + Object id = BeanManager.getBeanAttributeValue(pBean, "pk"); + if ((id instanceof History)) { + HibernateBean newbean = (HibernateBean) pBean.cloneMe(); + PersistenceHelper.getEntityManager().remove(pBean);; + History pk = (History) BeanManager.getBeanAttributeValue(newbean, "pk"); + pk.setDateto(FormatDates.getInstance().getDataBaseTimestamp()); + em.persist(newbean); + } + if (pBean instanceof Cache) { + // Limpia el cache de la tabla. + CacheManager cm = CacheManager.getInstance(); + cm.clean(pBean.getClass().getName()); + } + } + + /** + * Caduca registro persistente. + * + * @param pBean Bean a caducar. + * @throws CommonException + * @throws Exception + */ + public static void delete(HibernateBean pBean) throws CommondbException, Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + Object id = BeanManager.getBeanAttributeValue(pBean, "pk"); + if (id == null) { + return; + } + if (pBean != null) { + if ((id instanceof History)) { + //Las siguientes 3 lineas corrigen el problema con los registros que manejan auditoria + History pk = (History) BeanManager.getBeanAttributeValue(pBean, "pk"); + if (pk.getDateto() == null) { + pk.setDateto(FormatDates.getDefaultExpiryTimestamp()); + } + HibernateBean newbean = (HibernateBean) pBean.cloneMe(); + PersistenceHelper.expireRecord(newbean, FormatDates.getInstance().getDataBaseTimestamp()); + } + if (!em.contains(pBean)) { + em.remove(em.find(pBean.getClass(), id)); + } else { + em.remove(pBean); + } + if (pBean instanceof Log) { + Audit.delete(pBean); + } + } + if (pBean instanceof Cache) { + // Limpia el cache de la tabla. + CacheManager cm = CacheManager.getInstance(); + cm.clean(pBean.getClass().getName()); + } + } + + /** + * Metodo que se encarga del manejo de la historia de registros en la base, + * si estos manejan date from date to. + * + * @param pBean Bena a almacenar en la base de datos. + * @return HibernateBean + * @throws Exception + */ + private static HibernateBean manageHistory(HibernateBean pBean, Object pid) throws Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + Object id = pid; + HibernateBean oldbean = null; + HibernateBean newbean = pBean; + if ((id instanceof History)) { + History pk = (History) id; + if (pk.getDateto() == null) { + // Si es null y existe un registro en la base indica que se da mantenimiento sobre el mismo registro, en + // este caso + // se elimina de la base. + PersistenceHelper.verifyBean(em, pBean, id); + // pk.setDateto(null); + } + if (pk.getDateto() != null) { + Object obj = ((AbstractDataTransport)pBean).get("ORIGINALBEAN"); + if(obj == null){ + em.detach(pBean); + newbean = (HibernateBean) pBean.cloneMe(); + oldbean = em.find(pBean.getClass(), id); + if(oldbean != null){ + em.detach(oldbean); + } + }else{ + oldbean = (HibernateBean)obj; + } + + id = BeanManager.getBeanAttributeValue(newbean, "pk"); + pk = (History) id; + if (pk.getDateto().compareTo(FormatDates.getDefaultExpiryTimestamp()) < 0) { + return pBean; + } + } + Timestamp t = FormatDates.getInstance().getDataBaseTimestamp(); + if ((pBean instanceof Cache) && (oldbean != null)) { + // Limpia el cache de la tabla unicamente si esta dando mantenimiento a un registro. + CacheManager cm = CacheManager.getInstance(); + cm.clean(pBean.getClass().getName()); + } + if ((pBean instanceof Log)) { + // Graba log de auditoria. + if (oldbean != null) { + Audit.process(pBean, oldbean); + } else { + Audit.insert(pBean); + } + + } + if ((oldbean != null) && !BeanManager.compareObject(pBean, oldbean)) { + PersistenceHelper.expireRecord(oldbean, t); + BeanManager.setBeanAttributeValue(newbean, "datefrom", t); + } + if (BeanManager.getBeanAttributeValue(newbean, "datefrom") == null) { + BeanManager.setBeanAttributeValue(newbean, "datefrom", t); + } + BeanManager.setBeanAttributeValue(pk, "dateto", FormatDates.getDefaultExpiryTimestamp()); + PersistenceHelper.setpartition(pk, pk.getDateto()); + PersistenceHelper.setModifyUser(newbean); + } + return newbean; + } + + /** + * Si valor de dateto es null y existe un registro en la base indica que se + * da mantenimiento sobre el mismo registro, en este caso se elimina el + * registro de la base. + * + * @param em EntityManager utilizado en dml. + * @param pBean Referencia al bean persistente. + * @param id Pk del bean. + * @throws Exception + */ + private static void verifyBean(EntityManager em, HibernateBean pBean, Object id) throws Exception { + try { + History pk = (History) id; + pk.setDateto(FormatDates.getDefaultExpiryTimestamp()); + HibernateBean oldbean = em.find(pBean.getClass(), id); + if (oldbean != null) { + em.detach(pBean); + em.remove(oldbean); + } + } catch (Exception e) { + // No hacer nada + } + + } + + /** + * Metodo que expira un registro en la base de datos. + * + * @param pOldBean Objeto que contiene el registro de una tabla a expirar. + * @param pTimestamp Fecha con la cual se expira un registro. + * @throws Exception + */ + public static void expireRecord(HibernateBean pOldBean, Timestamp pTimestamp) throws Exception { + EntityManager em = PersistenceHelper.getEntityManager(); + History pk = (History) BeanManager.getBeanAttributeValue(pOldBean, "pk"); + pk.setDateto(pTimestamp); + PersistenceHelper.setpartition(pk, pTimestamp); + em.persist(pOldBean); + } + + /** + * Metodo fija la particion en un registro, la particion es yyyymm del campo + * dateto. + * + * @param pHistory Pk de un registro. + * @param pTimestamp fecha con la cual se caduca un registro. + * @throws Exception + */ + private static void setpartition(History pHistory, Timestamp pTimestamp) throws Exception { + try { + BeanManager.setBeanAttributeValue(pHistory, "partition", FormatDates.getPartition(pTimestamp)); + } catch (Exception e1) { + } + } + + /** + * Metodo que separa el objeto de la session de la base de datos. + * + * @param pBean Objeto a separar de la base de datos. + * @throws Exception + */ + public static void detatch(HibernateBean pBean) throws Exception { + if(pBean != null){ + PersistenceHelper.called(); + EntityManager em = PersistenceHelper.getEntityManager(); + em.detach(pBean); + } + } + + /** + * Fija el usuario de creacion de un registro. + * + * @param pBean Objeto a almacenar en la base de datos. + * @throws Exception + */ + public static void setIngressUser(HibernateBean pBean) throws Exception { + try { + BeanManager.setBeanAttributeValue(pBean, "ingressuser", SaveData.getSaveRequest().getUser()); + } catch (Exception e) { + try { + BeanManager.setBeanAttributeValue(pBean, "ingressusercode", SaveData.getSaveRequest().getUser()); + } catch (Exception e2) { + // Si no existe el campo en el bean no hacer nada. + } + } + } + + /** + * Fija el usuario de creacion de un registro. + * + * @param pBean Objeto a almacenar en la base de datos. + * @throws Exception + */ + public static void setLastupdate(HibernateBean pBean) throws Exception { + try { + BeanManager.setBeanAttributeValue(pBean, "lastupdate", SaveData.getSaveRequest().get("accountingdate")); + } catch (Exception e) { + // Si no existe el campo en el bean no hacer nada. + } + } + + /** + * Fija el fecha de admision de un registro. + * + * @param pBean Objeto a almacenar en la base de datos. + * @throws Exception + */ + public static void setCreationDate(HibernateBean pBean) throws Exception { + try { + if (BeanManager.getBeanAttributeValue(pBean, "creationdate") == null) { + BeanManager.setBeanAttributeValue(pBean, "creationdate", SaveData.getSaveRequest().get("accountingdate")); + } + } catch (Exception e) { + // Si no existe el campo en el bean no hacer nada. + } + } + + /** + * Fija el usuario de creacion de un registro. + * + * @param pBean Objeto a almacenar en la base de datos. + * @throws Exception + */ + public static void setModifyUser(HibernateBean pBean) throws Exception { + try { + BeanManager.setBeanAttributeValue(pBean, "modifyuser", SaveData.getSaveRequest().getUser()); + } catch (Exception e) { + try { + BeanManager.setBeanAttributeValue(pBean, "modifyusercode", SaveData.getSaveRequest().getUser()); + } catch (Exception e2) { + // Si no existe el campo en el bean no hacer nada. + } + } + } + + public static Query prepareQuery(String pName, Integer pPage, Integer pRecords) throws Exception { + Query q = PersistenceHelper.getEntityManager().createNamedQuery(pName); + q.setFirstResult((pPage - 1) * pRecords); + q.setMaxResults(pRecords); + return q; + } + + public static Query prepareQuery(String pName) throws Exception { + return PersistenceHelper.getEntityManager().createNamedQuery(pName); + } + + public static Query createQuery(String pJPQL) throws Exception { + return PersistenceHelper.getEntityManager().createQuery(pJPQL); + } + + public static Query createNativeQuery(String pSQL) throws Exception { + return PersistenceHelper.getEntityManager().createNativeQuery(pSQL); + } + + public static TypedQuery prepareQuery(String pName, Class pType) throws Exception { + return PersistenceHelper.getEntityManager().createNamedQuery(pName, pType); + } + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/PersistenceManager.java b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/PersistenceManager.java new file mode 100644 index 0000000..f699267 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/PersistenceManager.java @@ -0,0 +1,343 @@ +package com.fp.persistence.commondb; + +import java.lang.reflect.Field; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.FlushModeType; +import javax.persistence.Persistence; +import javax.persistence.Table; +import javax.persistence.metamodel.EntityType; + +import org.hibernate.SQLQuery; +import org.hibernate.Session; + +import com.fp.common.helper.BeanManager; +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.data.ThreadFacade; + +/** + * Clase que se encarga del manejo de la favtoria de EntityManager. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class PersistenceManager { + + /** + * Key para genrar un map de los beans mapeados en el archivo de hbconfiguration. + */ + public static final String NAME = "NAMES"; + + /** + * Key que alamacena el numero de sessiones abiertas en el sessionfactory. + */ + public static final String OPEN = "OPEN"; + + /** + * Key que alamacena el numero de sessiones cerradas en el sessionfactory. + */ + public static final String CLOSED = "CLOSED"; + + /** + * Key que almacenal hora en la que se genero el sessionfactory . + */ + public static final String START_TIME = "START TIME"; + + /** + * Instancia a la que hace referencia el Sigleton + */ + private static PersistenceManager instance = null; + + /** + * Map de EntityManagerFactory ejb por compania. + */ + private final Map memfejb = new HashMap(); + + /** + * Map de EntityManagerFactory local por compania. + */ + private final Map memf = new HashMap(); + + /** + * Map de EntityManagerFactory auxiliar por persistence unit. + */ + private final Map memfaux = new HashMap(); + + /** + * Metodo que entrega una instancia de PersistenceManager, si existe una creada la entrega, caso contrario crea una. + * Adicionalmenet hace el mapping de las tablas del modelo relacional al modelo de objetos, creando el + * EntityManagerFactory. + * + * @return PersistenceManager + */ + public static PersistenceManager getInstance() { + synchronized (PersistenceManager.class) { + if (PersistenceManager.instance == null) { + PersistenceManager.instance = new PersistenceManager(); + PersistenceManager.instance.fillEntityManagerFactory(); + } else { + Integer cia = PersistenceManager.getCompany(); + if (((PersistenceManager.instance.memfejb.get(cia) == null) && PersistenceManager.iSEjb()) + || (PersistenceManager.instance.memf.get(cia) == null)) { + PersistenceManager.instance.fillEntityManagerFactory(); + } + } + } + return PersistenceManager.instance; + } + + /** + * Contruye el entitymanager falctory. + */ + private void fillEntityManagerFactory() { + Integer cia = PersistenceManager.getCompany(); + + if (cia != null && (PersistenceManager.instance.memfejb.get(cia) == null) && PersistenceManager.iSEjb()) { + try { + PersistenceManager.instance.memfejb.put(cia, PersistenceManager.getEntityManagerFactory("ejb", cia)); + } catch (Exception e) { + APPLogger.getLogger().error(e, e); + } + + } + if (cia != null && PersistenceManager.instance.memf.get(cia) == null) { + try { + PersistenceManager.instance.memf.put(cia, PersistenceManager.getEntityManagerFactory("local", cia)); + } catch (Exception e) { + APPLogger.getLogger().error(e, e); + } + + } + } + + /** + * Metodo que crea y entrega un EntityManagerFactory, dado el persistenceunit mas el codigo de compania. + * + * @param pUnit Nombre del persistenceunit con el cual se crea el EntityManagerFactory. + * @param pCompany Codigo de compania. + * @return EntityManagerFactory + * @throws Exception + */ + private static EntityManagerFactory getEntityManagerFactory(String pUnit, Integer pCompany) throws Exception { + Map configOverrides = new HashMap(); + configOverrides.put("hibernate.ejb.cfgfile", "hibernateFlipMapping.cfg.xml"); + EntityManagerFactory emf = null; + emf = Persistence.createEntityManagerFactory(pUnit + pCompany, configOverrides); + return emf; + } + + /** + * Metodo que entrega una instancia de PersistenceManager para pruebas, si existe una creada la entrega, caso + * contrario crea una. Adicionalmenet hace el mapping de las tablas del modelo relacional al modelo de objetos, + * creando el EntityManagerFactory. + * + * @return PersistenceManager + */ + public static PersistenceManager getInstanceTest() { + synchronized (PersistenceManager.class) { + if (PersistenceManager.instance == null) { + PersistenceManager.instance = new PersistenceManager(); + } + } + Integer cia = PersistenceManager.getCompany(); + if (PersistenceManager.instance.memf.get(cia) == null) { + try { + PersistenceManager.instance.memf.put(cia, PersistenceManager.getEntityManagerFactory("local", cia)); + } catch (Exception e) { + APPLogger.getLogger().error("NO PUEDE CONSTRUIR EL ENTYTY MANAGER FACTORY LOCAL" + cia, e); + } + // Para que no construya uno en pruebas. + PersistenceManager.instance.memfejb.put(cia, PersistenceManager.instance.memf.get(cia)); + } + return PersistenceManager.instance; + } + + /** + * Constructor que se encarga de crear una instancia de PersistenceManager + * + * @param test + */ + public PersistenceManager() { + } + + /** + * Metodo que se encarga de crear un objeto EntityManager. + * + * @return EntityManager + */ + public EntityManager createEntityManager() { + EntityManager em = memfejb.get(PersistenceManager.getCompany()).createEntityManager(); + return em; + } + + /** + * Metodo que se encarga de crear un objeto EntityManager. + * + * @return EntityManager + */ + public EntityManager createEntityManagerLocal() { + EntityManager em = memf.get(PersistenceManager.getCompany()).createEntityManager(); + em.setFlushMode(FlushModeType.COMMIT); + return em; + } + + /** Cierra el SessionFactory */ + public void close() { + memfejb.get(PersistenceManager.getCompany()).close(); + } + + /** + * Entrega EntityManagerFactory dado el persistenceunit name, se utiiza para conecciones auxiliares a bases de + * datos, ejemplo cobis. + * + * @return Map + */ + public EntityManagerFactory getEntityManagerFactoryAuxiliar(String pUnit) { + EntityManagerFactory emf = memfaux.get(pUnit); + if (emf == null) { + emf = Persistence.createEntityManagerFactory(pUnit); + memfaux.put(pUnit, emf); + } + return emf; + } + + /** + * Permite Fijar el estado de Trace de la Conexión + * + * @param pSession Session de hibernate de Referencia + * @param pStatus Estado del Trace. + * @throws SQLException + * @throws Exception + */ + public void setTrace(Session pSession, boolean pStatus) { + SQLQuery sql = pSession.createSQLQuery("alter session set sql_trace =" + pStatus); + sql.executeUpdate(); + } + + /** + * Entrega el codigo de compania de trabajo. + * + * @return Integer + * @throws Exception + */ + private static Integer getCompany() { + return ThreadFacade.getSessionData().getCompany(); + } + + private static boolean iSEjb() { + return ThreadFacade.getSessionData().isEjb(); + } + + public Class findEntityClass(String pTable) throws Exception { + return this.findEntity(pTable).getJavaType(); + } + + public EntityType findEntity(String pTable) throws Exception { + EntityManagerFactory emf = PersistenceHelper.getEntityManager().getEntityManagerFactory(); + Set> set = emf.getMetamodel().getEntities(); + EntityType entity = null; + for (EntityType entityType : set) { + Table t = entityType.getJavaType().getAnnotation(Table.class); + if (t.name().compareTo(pTable) == 0) { + entity = entityType; + break; + } + } + return entity; + } + + @SuppressWarnings("rawtypes") + public static List getDataBasePKFields(Class bean) { + List ldata = new ArrayList(); + for (Field f : bean.getDeclaredFields()) { + if (f.isAnnotationPresent(EmbeddedId.class)) { + Class pkT = f.getType(); + for (Field f1 : pkT.getDeclaredFields()) { + if (f1.isAnnotationPresent(Column.class)) { + ldata.add("pk." + f1.getAnnotation(Column.class).name().toLowerCase()); + } + } + } + } + if (ldata.isEmpty()) { + ldata.add("pk"); + } + return ldata; + } + + public List getDataBaseFields(String pTable) throws Exception { + List data = new ArrayList(); + Class et = this.findEntityClass(pTable); + for (Field f : et.getDeclaredFields()) { + if (f.isAnnotationPresent(Column.class)) { + data.add(f.getAnnotation(Column.class).name()); + } + if (f.isAnnotationPresent(EmbeddedId.class)) { + Class pkT = f.getType(); + for (Field f1 : pkT.getDeclaredFields()) { + if (f1.isAnnotationPresent(Column.class)) { + data.add(f1.getAnnotation(Column.class).name()); + } + } + } + } + return data; + } + + /** + * Entrega el tipo de dato de un campo de una clase. Si no encuentra el campo retorna null. + * + * @param clase Clase a buscar el tipo de dato de un campo. + * @param field Nombre del campo a buscar en la clase. + * @return Class + */ + public static Class getType(Class clase, String field) { + Class tipo = null; + for (Field f : clase.getDeclaredFields()) { + tipo = f.getType(); + if (f.isAnnotationPresent(EmbeddedId.class)) { + for (Field f1 : tipo.getDeclaredFields()) { + if (f1.isAnnotationPresent(Column.class) && f1.getName().equals(field)) { + tipo = f1.getType(); + return tipo; + } + } + } + if (f.isAnnotationPresent(Column.class) && f.getName().equals(field)) { + return tipo; + } + } + return null; + } + + /** + * Convierte el valor al tipo de satos del atributo de la clase. + * + * @param bean Nombre de la clase a buscar el tipo de datos de un campo. + * @param field Nombre del campo a buscar el tipo de dato. + * @param value Valor a transformar al tipo de dato de una clase. + * @return Object + * @throws Exception + */ + public static Object changeType(String bean, String field, Object value) throws Exception { + if (value == null) { + return value; + } + // Convierte el valor del criterio al tipo especifico del campo de la clase. + Class tipo = PersistenceManager.getType(Class.forName(bean), field.replace("pk.", "")); + if (tipo != null) { + value = BeanManager.convertObject(value, tipo); + } + return value; + } + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/PersistenceMetadata.java b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/PersistenceMetadata.java new file mode 100644 index 0000000..da2e185 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/PersistenceMetadata.java @@ -0,0 +1,294 @@ +package com.fp.persistence.commondb; + +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.hibernate.cfg.Configuration; +import org.hibernate.mapping.Column; +import org.hibernate.mapping.PersistentClass; +import org.hibernate.mapping.Property; +import org.hibernate.mapping.RootClass; +import org.hibernate.mapping.SimpleValue; + +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.commondb.helper.FormatDates; + + +public class PersistenceMetadata { + private Configuration cfg; + public PersistenceMetadata(Configuration pConf){ + this.cfg=pConf; + } + private PersistentClass getPresistenceClass(String pName) throws CommondbException{ + PersistentClass c=cfg.getClassMapping(pName); + if(c==null){ + throw new CommondbException("COMMONDB-0009","EL BEAN {0} NO SE ENCUENTRA EN EL SESSIONFACTORY",pName); + } + return c; + } + /** + * Entrega el nombre de la propiedad del Bean que hace referencia al Campo Dado + * @param pBean Clase de tipo Bean + * @param pField Campo de la Tabla + * @return Propiedad del Bean. + * @throws CommonException + * @throws Exception + */ + @SuppressWarnings({ "rawtypes" }) +public String getJavaProperty(Class pBean,String pField) throws CommondbException { + PersistentClass c=getPresistenceClass(pBean.getName()); + Iterator it=c.getKey().getColumnIterator(); + int cont = 0; + while(it.hasNext()) { + it.next(); + cont ++; + } + it=c.getKey().getColumnIterator(); + while(it.hasNext()){ + Column col=(Column)it.next(); + if(col.getName().toUpperCase().compareTo(pField.toUpperCase()) == 0){ + if (cont == 1){ + return "pk"; + } + + return "pk."+pField.toLowerCase(); + } + } + return pField.toLowerCase(); + } +@SuppressWarnings("rawtypes") +public String getFieldName(Class pBean,String pField) throws CommondbException { + PersistentClass c=getPresistenceClass(pBean.getName()); + Iterator it=c.getPropertyIterator(); + if(pField.toLowerCase().indexOf("pk.")>-1){ + pField=pField.substring(pField.toLowerCase().indexOf("pk.")+3); + it=c.getKey().getColumnIterator(); + while (it.hasNext()) { + Column element = (Column) it.next(); + if(element.getName().compareTo(pField)==0){ + return element.getName().toUpperCase(); + } + } + throw new CommondbException("",""); + } + if(pField.compareToIgnoreCase("pk")==0){ + it=c.getKey().getColumnIterator(); + Column col = (Column)it.next(); + if(it.hasNext()){ + throw new CommondbException("",""); + } + return col.getName().toUpperCase(); + } + while(it.hasNext()){ + Property col=(Property)it.next(); + if(col.getName().compareToIgnoreCase(pField.toUpperCase()) == 0){ + return pField.toUpperCase(); + } + } + throw new CommondbException("",""); + } + /** + * Verifica si un campo es un atributo del bean. + * @param pBean Nombre del bean que maneja la persistencia de una tabla + * @param pCampo Campo de la Tabla + * @return + * @throws CommonException + * @throws Exception + */ + +@SuppressWarnings("rawtypes") +public boolean isJavaProperty(Class pBean,String pField) throws CommondbException { + PersistentClass c=getPresistenceClass(pBean.getName()); + Iterator it=c.getTable().getColumnIterator(); + while(it.hasNext()){ + Column col=(Column)it.next(); + if(col.getName().toUpperCase().compareTo(pField.toUpperCase()) == 0){ + return true; + } + } + return false; + } + /** + * Entrega el nombre del campo de una tabla. Si la tabla tiene un unicampo campo que forma parte del primary key de la misma. + * @param pBean Nombre del bean que maneja la persistencia de una tabla. + * @return + * @throws CommonException + * @throws Exception + */ +@SuppressWarnings("rawtypes") +public String getFieldnameByPkSingleField(Class pBean) throws CommondbException { + PersistentClass c=getPresistenceClass(pBean.getName()); + Iterator it=c.getKey().getColumnIterator(); + int cont = 0; + Column col = null; + while(it.hasNext()) { + col = (Column)it.next(); + cont ++; + } + if (cont == 1){ + return col.getName().toUpperCase(); + } + if(cont > 1){ + throw new CommondbException("COMMONDB-00010","TABLA {0} TIENE UN PRIMARY KEY COMPUESTO ",c.getTable().getName().toUpperCase()); + } + return null; + } + + /** + * Entrega un lista de campos que forman el primary key de una tabla. + * @param pBean Nombre del bean que maneja la persistencia de una tabla. + * @return lFieldspk + * @throws CommonException + * @throws Exception + */ +@SuppressWarnings("rawtypes") +public List getFieldsPrimaryKey(Class pBean) throws CommondbException { + PersistentClass c=getPresistenceClass(pBean.getName()); + Iterator it=c.getKey().getColumnIterator(); + Column col = null; + List lFieldspk = new ArrayList(); + while(it.hasNext()) { + col = (Column)it.next(); + lFieldspk.add(col.getName().toUpperCase()); + } + return lFieldspk; + } + + /** + * Enterga el campo que maneja el versionamiento de un bean. + * @param pBean Clase de tipo Bean + * @return + * @throws CommonException + * @throws Exception + */ +@SuppressWarnings("rawtypes") +public String getFieldVersion(Class pBean) throws CommondbException { + PersistentClass c=getPresistenceClass(pBean.getName()); + String version = null; + if(c.getVersion() != null){ + version = c.getVersion().getName(); + } + return version; + } + + /** + * Enterga el nombre de la tabla de un bean. + * @param pBean Clase de tipo Bean + * @return + * @throws CommonException + * @throws Exception + */ + @SuppressWarnings("rawtypes") +public String getTableName(Class pBean) throws CommondbException { + PersistentClass c=getPresistenceClass(pBean.getName()); + String table = c.getTable().getName().toUpperCase(); + return table; + } + public String getClassName(String pName) throws CommondbException{ + return this.getPresistenceClass(pName).getClassName(); + } + + /** + * Enterga el bean que maneja una tabla. + * @param pTablename Nombre de la tabla. + * @return Nombre de la clase que implementa el Bean + * @throws CommonException + * @throws Exception + */ + @SuppressWarnings("rawtypes") +public String getBeanname(String pTablename) throws CommondbException { + Iterator itr = cfg.getClassMappings(); + String bean = null; + while (itr.hasNext()) { + RootClass rc = (RootClass)itr.next(); + if(rc.getTable().getName().toUpperCase().compareTo(pTablename.toUpperCase()) == 0){ + bean = rc.getClassName(); + } + } + if(bean == null){ + throw new CommondbException("COMMONDB-00011","BEAN NO DEFINIDO PARA LA TABLA {0} ",pTablename); + } + return bean; + } + /** + * Transforma el valor al tipo de dato del tabla.campo. + * @param pBean Nombre del bean que maneja l apersistencia de una tabla. + * @param pCampo Nombre de un campo que pertenece a una tabla manejada por el bean. + * @param pValue Valor del campo, puede estar en un tipo de dato distinto al de la tabla. + * @return newvalue Valor con el tipo de dato del campo en la tabla. + * @throws CommonException + * @throws ParseException + * @throws ClassNotFoundException + * @throws NoSuchFieldException + * @throws SecurityException + * @throws Exception + */ + @SuppressWarnings("rawtypes") +public Object convertValueType(String pBean,String pCampo,Object pValue) throws CommondbException, ParseException, SecurityException, NoSuchFieldException, ClassNotFoundException { + Object newvalue = null; + String type = ""; + if(pCampo.compareTo("pk")!=0){ + PersistentClass c=getPresistenceClass(pBean); + Iterator it=c.getTable().getColumnIterator(); + Column column = null; + boolean find = false; + while (it.hasNext()){ + column = (Column)it.next(); + if(column.getName().toUpperCase().compareTo(pCampo.toUpperCase()) == 0){ + find = true; + break; + } + } + if(!find){ + throw new CommondbException("COMMONDB-00012","CAMPO {0} NO DEFINIDO EN LA TABLA {1}",pCampo,c.getTable().getName()); + } + SimpleValue simplevalue = (SimpleValue)column.getValue(); + type = simplevalue.getTypeName(); + }else{ + type=Class.forName(pBean).getDeclaredField(pCampo).getType().getName(); + } + if(pValue.getClass().getName().compareTo(type) == 0 ){ + newvalue = pValue; + }else{ + if(type.compareTo("java.lang.String") == 0 ){ + newvalue = pValue; + } + if(type.compareTo("java.lang.Integer") == 0 ){ + newvalue = new Integer(pValue.toString()); + } + if(type.compareTo("java.math.BigDecimal") == 0 ){ + DecimalFormatSymbols dfs = new DecimalFormatSymbols(); + dfs.setDecimalSeparator('.'); + dfs.setGroupingSeparator(','); + DecimalFormat df = new DecimalFormat("##############.#######",dfs); + newvalue = new BigDecimal(df.parse(pValue.toString()).doubleValue()); + } + if(type.compareTo("java.sql.Date") == 0 ){ + SimpleDateFormat sdf = FormatDates.getInstance().getTransportDatetimeFormat(); + newvalue = new Date(sdf.parse(pValue.toString()).getTime()); + } + if(type.compareTo("java.sql.Timestamp") == 0 ){ + SimpleDateFormat sdf = FormatDates.getInstance().getTransportDatetimeFormat(); + try{ + String valor=pValue.toString(); + if(valor.length()==10){ + valor+=" 00:00:00.0"; + } + newvalue = new Timestamp(sdf.parse(valor).getTime()); + + }catch(Exception ex){ + ex.printStackTrace(); + } + } + } + return newvalue; + } +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/cache/.svn/entries b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/cache/.svn/entries new file mode 100644 index 0000000..d4a4bda --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/cache/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/cache +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +CacheManager.java +file + + + + +2022-07-28T03:40:31.850756Z +2bf3474856b279c9bbcdbee1b061bcc5 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3906 + diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/cache/.svn/text-base/CacheManager.java.svn-base b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/cache/.svn/text-base/CacheManager.java.svn-base new file mode 100644 index 0000000..94f640a --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/cache/.svn/text-base/CacheManager.java.svn-base @@ -0,0 +1,147 @@ +package com.fp.persistence.commondb.cache; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; + +/** + * Clase utilitaria, que mantiene las variables de cache de informacion de beans + * asociados a tablas de la base de datos. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public final class CacheManager { + + private CacheManager() { + } + + /** Almacena una instancia de DataHelper. */ + private static CacheManager cache; + + /** + * Entrega una instancia de DataHelper. + * + * @return DataHelper + */ + public static CacheManager getInstance() { + if (cache != null) { + return cache; + } + synchronized (CacheManager.class) { + if (cache == null) { + cache = new CacheManager(); + } + } + return cache; + } + + /** Map que almacena definicion de un bean
+ * El key del map es el nombre del bean. + * Object contiene registros dado el pk o una clave que identifica al registro. + * */ + private Map mcache = new HashMap(); + + /** + * Metodo que entrega datos dado el bean y el key de los datos. + * @param pBeanName Nombre del bean. + * @param pKey Key de datos. + * @return Object. + * @throws Exception + */ + @SuppressWarnings("unchecked") + public Object getData(String pBeanName,String pKey) throws Exception { + Map mdata = (Map)mcache.get(pBeanName); + if(mdata == null){ + return null; + } + return mdata.get(pKey); + } + + /** + * Metodo que entrega la defincion de un map, si existe en cache. + * @param pBeanName Nombre del bean. + * @return Map + * @throws Exception + */ + @SuppressWarnings("unchecked") + public Map getMapDefinition(String pBeanName) throws Exception { + Map mdata = (Map)mcache.get(pBeanName); + if(mdata == null){ + mdata = new HashMap(); + } + return mdata; + } + + /** + * Metodo que adiciona datos de una tabla al cache. + * @param pBeanName Nombre del bean. + * @param pData Datos a adicionar al cache. + * @throws Exception + */ + public void putData(String pBeanName,Object pData) throws Exception { + synchronized (mcache) { + if (!mcache.containsKey(pBeanName)) { + mcache.put(pBeanName, pData); + } + } + } + + /** + * Metodo que se encarga de limpiar el cache de un objeto. + * @param pBeanName Key del objeto a limpiar el cache. + * @throws Exception + */ + @SuppressWarnings("unchecked") + public void clean(String pBeanName) throws Exception { + String name = pBeanName; + if(pBeanName.indexOf(".") > 0){ + StringTokenizer st = new StringTokenizer(pBeanName, "."); + while (st.hasMoreElements()) { + name = (String) st.nextElement(); + } + } + this.cleanByObject((Map)mcache.get(name)); + synchronized (mcache){ + mcache.remove(name); + } + } + + /** + * Metodo que se encarga el cache total de datos. + * @throws Exception + */ + @SuppressWarnings("unchecked") + public void cleanAll() throws Exception { + Iterator itr = mcache.values().iterator(); + while (itr.hasNext()) { + this.cleanByObject((Map) itr.next()); + } + } + + /** + * Metodo que limpia el cache de un objeto, este puede ser una lista de registros de una tabla + * o un registro unico de la tabla. + * @param mData Map que contiene los datos a encerar. + * @throws Exception + */ + @SuppressWarnings("rawtypes") + private void cleanByObject(Map mData) throws Exception { + if(mData == null){ + return; + } + synchronized (mData) { + Iterator itr = mData.values().iterator(); + while (itr.hasNext()) { + Object obj = itr.next(); + if (obj instanceof List) { + ((List) obj).clear(); + } + } + mData.clear(); + } + } + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/cache/CacheManager.java b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/cache/CacheManager.java new file mode 100644 index 0000000..94f640a --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/cache/CacheManager.java @@ -0,0 +1,147 @@ +package com.fp.persistence.commondb.cache; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; + +/** + * Clase utilitaria, que mantiene las variables de cache de informacion de beans + * asociados a tablas de la base de datos. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public final class CacheManager { + + private CacheManager() { + } + + /** Almacena una instancia de DataHelper. */ + private static CacheManager cache; + + /** + * Entrega una instancia de DataHelper. + * + * @return DataHelper + */ + public static CacheManager getInstance() { + if (cache != null) { + return cache; + } + synchronized (CacheManager.class) { + if (cache == null) { + cache = new CacheManager(); + } + } + return cache; + } + + /** Map que almacena definicion de un bean
+ * El key del map es el nombre del bean. + * Object contiene registros dado el pk o una clave que identifica al registro. + * */ + private Map mcache = new HashMap(); + + /** + * Metodo que entrega datos dado el bean y el key de los datos. + * @param pBeanName Nombre del bean. + * @param pKey Key de datos. + * @return Object. + * @throws Exception + */ + @SuppressWarnings("unchecked") + public Object getData(String pBeanName,String pKey) throws Exception { + Map mdata = (Map)mcache.get(pBeanName); + if(mdata == null){ + return null; + } + return mdata.get(pKey); + } + + /** + * Metodo que entrega la defincion de un map, si existe en cache. + * @param pBeanName Nombre del bean. + * @return Map + * @throws Exception + */ + @SuppressWarnings("unchecked") + public Map getMapDefinition(String pBeanName) throws Exception { + Map mdata = (Map)mcache.get(pBeanName); + if(mdata == null){ + mdata = new HashMap(); + } + return mdata; + } + + /** + * Metodo que adiciona datos de una tabla al cache. + * @param pBeanName Nombre del bean. + * @param pData Datos a adicionar al cache. + * @throws Exception + */ + public void putData(String pBeanName,Object pData) throws Exception { + synchronized (mcache) { + if (!mcache.containsKey(pBeanName)) { + mcache.put(pBeanName, pData); + } + } + } + + /** + * Metodo que se encarga de limpiar el cache de un objeto. + * @param pBeanName Key del objeto a limpiar el cache. + * @throws Exception + */ + @SuppressWarnings("unchecked") + public void clean(String pBeanName) throws Exception { + String name = pBeanName; + if(pBeanName.indexOf(".") > 0){ + StringTokenizer st = new StringTokenizer(pBeanName, "."); + while (st.hasMoreElements()) { + name = (String) st.nextElement(); + } + } + this.cleanByObject((Map)mcache.get(name)); + synchronized (mcache){ + mcache.remove(name); + } + } + + /** + * Metodo que se encarga el cache total de datos. + * @throws Exception + */ + @SuppressWarnings("unchecked") + public void cleanAll() throws Exception { + Iterator itr = mcache.values().iterator(); + while (itr.hasNext()) { + this.cleanByObject((Map) itr.next()); + } + } + + /** + * Metodo que limpia el cache de un objeto, este puede ser una lista de registros de una tabla + * o un registro unico de la tabla. + * @param mData Map que contiene los datos a encerar. + * @throws Exception + */ + @SuppressWarnings("rawtypes") + private void cleanByObject(Map mData) throws Exception { + if(mData == null){ + return; + } + synchronized (mData) { + Iterator itr = mData.values().iterator(); + while (itr.hasNext()) { + Object obj = itr.next(); + if (obj instanceof List) { + ((List) obj).clear(); + } + } + mData.clear(); + } + } + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/data/.svn/entries b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/data/.svn/entries new file mode 100644 index 0000000..bd84d22 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/data/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/data +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ThreadFacade.java +file + + + + +2022-07-28T03:40:31.945756Z +b8523a6e48b68ec26eecd39a453e863e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +821 + +SessionData.java +file + + + + +2022-07-28T03:40:31.945756Z +a872a890ba995d21b4d71bc5d85c7e97 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +935 + diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/data/.svn/text-base/SessionData.java.netbeans-base b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/data/.svn/text-base/SessionData.java.netbeans-base new file mode 100644 index 0000000..8e4ca7b --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/data/.svn/text-base/SessionData.java.netbeans-base @@ -0,0 +1,50 @@ +package com.fp.persistence.commondb.data; + + +/** + * Clase utilitaria que almacena datos de session ejemplo codigo de compania. + * @author Jorge Vaca. + * @version 2.1 + */ +public class SessionData { + + /**Codigo de compania de trabajo.*/ + private Integer company; + + /**True Indica que la entrada de la acplicacion es un ejb, False es pruebas.*/ + private boolean isEjb = false; + + /** + * Entrega el valor de: isEjb + * @return Boolean + */ + public boolean isEjb() { + return isEjb; + } + + /** + * Fija el valor de: isEjb + * @param isEjb value to set + */ + public void setIsEjb(boolean isEjb) { + this.isEjb = isEjb; + } + + /** + * Entrega el valor de: company + * @return Integer + */ + public Integer getCompany() { + return company; + } + + /** + * Fija el valor de: company + * @param company value to set + */ + public void setCompany(Integer company) { + this.company = company; + } + + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/data/.svn/text-base/SessionData.java.svn-base b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/data/.svn/text-base/SessionData.java.svn-base new file mode 100644 index 0000000..8e4ca7b --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/data/.svn/text-base/SessionData.java.svn-base @@ -0,0 +1,50 @@ +package com.fp.persistence.commondb.data; + + +/** + * Clase utilitaria que almacena datos de session ejemplo codigo de compania. + * @author Jorge Vaca. + * @version 2.1 + */ +public class SessionData { + + /**Codigo de compania de trabajo.*/ + private Integer company; + + /**True Indica que la entrada de la acplicacion es un ejb, False es pruebas.*/ + private boolean isEjb = false; + + /** + * Entrega el valor de: isEjb + * @return Boolean + */ + public boolean isEjb() { + return isEjb; + } + + /** + * Fija el valor de: isEjb + * @param isEjb value to set + */ + public void setIsEjb(boolean isEjb) { + this.isEjb = isEjb; + } + + /** + * Entrega el valor de: company + * @return Integer + */ + public Integer getCompany() { + return company; + } + + /** + * Fija el valor de: company + * @param company value to set + */ + public void setCompany(Integer company) { + this.company = company; + } + + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/data/.svn/text-base/ThreadFacade.java.svn-base b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/data/.svn/text-base/ThreadFacade.java.svn-base new file mode 100644 index 0000000..dccdfa7 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/data/.svn/text-base/ThreadFacade.java.svn-base @@ -0,0 +1,31 @@ +package com.fp.persistence.commondb.data; + + +/** + * Thread local que almacena datos de codigo de compania, como de UserTransaction a ser utilizados + * en el hilo de ejecucion. + * @author Jorge Vaca. + * @version 2.1 + */ +public class ThreadFacade { + + /**Almacena una instancia de SaaveRequest con los datos de entrada.*/ + private static final ThreadLocal threadsave = new ThreadLocal(); + + /** + * Metodo que entrega datos del SessionData. + * @return SessionData + */ + public static SessionData getSessionData() { + return (SessionData) threadsave.get(); + } + + /** + * Metoo que almacena en el thread local datos de SessionData. + * @param SessionData + */ + public static void setSaveRequest(SessionData pSessionData) { + threadsave.set(pSessionData); + } + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/data/SessionData.java b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/data/SessionData.java new file mode 100644 index 0000000..8e4ca7b --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/data/SessionData.java @@ -0,0 +1,50 @@ +package com.fp.persistence.commondb.data; + + +/** + * Clase utilitaria que almacena datos de session ejemplo codigo de compania. + * @author Jorge Vaca. + * @version 2.1 + */ +public class SessionData { + + /**Codigo de compania de trabajo.*/ + private Integer company; + + /**True Indica que la entrada de la acplicacion es un ejb, False es pruebas.*/ + private boolean isEjb = false; + + /** + * Entrega el valor de: isEjb + * @return Boolean + */ + public boolean isEjb() { + return isEjb; + } + + /** + * Fija el valor de: isEjb + * @param isEjb value to set + */ + public void setIsEjb(boolean isEjb) { + this.isEjb = isEjb; + } + + /** + * Entrega el valor de: company + * @return Integer + */ + public Integer getCompany() { + return company; + } + + /** + * Fija el valor de: company + * @param company value to set + */ + public void setCompany(Integer company) { + this.company = company; + } + + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/data/ThreadFacade.java b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/data/ThreadFacade.java new file mode 100644 index 0000000..dccdfa7 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/data/ThreadFacade.java @@ -0,0 +1,31 @@ +package com.fp.persistence.commondb.data; + + +/** + * Thread local que almacena datos de codigo de compania, como de UserTransaction a ser utilizados + * en el hilo de ejecucion. + * @author Jorge Vaca. + * @version 2.1 + */ +public class ThreadFacade { + + /**Almacena una instancia de SaaveRequest con los datos de entrada.*/ + private static final ThreadLocal threadsave = new ThreadLocal(); + + /** + * Metodo que entrega datos del SessionData. + * @return SessionData + */ + public static SessionData getSessionData() { + return (SessionData) threadsave.get(); + } + + /** + * Metoo que almacena en el thread local datos de SessionData. + * @param SessionData + */ + public static void setSaveRequest(SessionData pSessionData) { + threadsave.set(pSessionData); + } + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/db/.svn/entries b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/db/.svn/entries new file mode 100644 index 0000000..a8978d4 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/db/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/db +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +DataHelper.java +file + + + + +2022-07-28T03:40:31.897756Z +9da7d8c94365c86191871e7c984afe27 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +14566 + +CloneData.java +file + + + + +2022-07-28T03:40:31.897756Z +9335b435e808b9da97ce92f8073bfcaa +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5698 + diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/db/.svn/text-base/CloneData.java.svn-base b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/db/.svn/text-base/CloneData.java.svn-base new file mode 100644 index 0000000..8ad72b1 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/db/.svn/text-base/CloneData.java.svn-base @@ -0,0 +1,195 @@ +/* + * + */ +package com.fp.persistence.commondb.db; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; + +/** + * Class CloneData encargada de copiar los datos de una tabla a otra tabla empleando una sola Sentencia SQL + * (Insert-select) + * + * @author gfiallos + */ +public class CloneData { + + /** Tabla Origen */ + private String table; + + /** Tabla Destino */ + private String destiny; + + /** El valor de fields. */ + private List fields; + + /** El valor de restrictions. */ + private Map restrictions = new HashMap(); + + /** El valor de replacements. */ + private Map replacements = new HashMap(); + + /** El valor de em. */ + private EntityManager em; + + /** + * Crea una nueva instancia de clone data. + * + * @param pTable Tabla Origen + * @throws Exception la exception + */ + public CloneData(String pTable) throws Exception { + this(pTable, pTable); + } + + /** + * Crea una nueva instancia de clone data. + * + * @param pTable Tabla Origen + * @param pDestiny Tabla Destino + * @throws Exception la exception + */ + public CloneData(String pTable, String pDestiny) throws Exception { + this.destiny = pDestiny; + this.table = pTable; + this.prepare(); + } + + /** + * Crea una nueva instancia de clone data. + * + * @param pTable Tabla Origen + * @param pRestrictions the restrictions + * @throws Exception la exception + */ + public CloneData(String pTable, Map pRestrictions) throws Exception { + this(pTable); + this.restrictions = pRestrictions; + } + + /** + * Adiciona un restriction. + * + * @param pName the name + * @param pValue the value + */ + public void addRestriction(String pName, Object pValue) { + this.restrictions.put(pName, pValue); + } + + /** + * Adiciona un replacement. + * + * @param pName the name + * @param pValue the value + */ + public void addReplacement(String pName, Object pValue) { + this.replacements.put(pName, pValue); + } + + /** + * Prepara los campos para la instrucción dada + * + * @throws Exception la exception + */ + private void prepare() throws Exception { + this.em = PersistenceHelper.getEntityManager(); + this.fields = PersistenceManager.getInstance().getDataBaseFields(this.destiny); + } + + /** + * Prepara la sentencia instert insert. + * + * @return string + * @throws Exception la exception + */ + private String prepareInsert() throws Exception { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + boolean first = true; + for (String name : this.fields) { + if (first) { + pw.print("insert into " + this.destiny + " (" + name); + first = false; + } else { + pw.print(" ," + name); + first = false; + } + } + pw.println(")"); + pw.close(); + return sw.toString(); + } + + /** + * Prepara el select. + * + * @return string + * @throws Exception la exception + */ + private String prepareSelect() throws Exception { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + boolean first = true; + for (String name : this.fields) { + if (this.replacements.containsKey(name)) { + // name = "cast( :r" + name.toLowerCase() + " as varchar(20) )"; + name = "'" + this.replacements.get(name) + "'"; + } + if (first) { + pw.print("select " + name); + first = false; + } else { + pw.print(" ," + name); + first = false; + } + } + pw.println(); + pw.println(" from " + this.table); + first = true; + for (Entry val : this.restrictions.entrySet()) { + if (first) { + pw.println(" where " + val.getKey() + "=:_" + val.getKey().toLowerCase()); + first = false; + } else { + pw.println(" and " + val.getKey() + "=:_" + val.getKey().toLowerCase()); + first = false; + } + } + pw.close(); + return sw.toString(); + } + + /** + * Executa la copia + * + * @return int + * @throws Exception la exception + */ + public int execute() throws Exception { + PersistenceHelper.flushTransaction(); + String sql = this.prepareInsert() + this.prepareSelect(); + APPLogger.getLogger().debug("Instruccion de Copia " + sql); + Query q = this.em.createNativeQuery(sql); + for (Entry val : this.restrictions.entrySet()) { + APPLogger.getLogger().debug("_" + val.getKey().toLowerCase() + ">>>>" + val.getValue()); + q.setParameter("_" + val.getKey().toLowerCase(), val.getValue()); + } + // for (Entry val : this.replacements.entrySet()) { + // q.setParameter("r" + val.getKey().toLowerCase().toLowerCase(), val.getValue()); + // APPLogger.getLogger().debug("r" + val.getKey().toLowerCase() + ">>>>" + val.getValue()); + // } + return q.executeUpdate(); + } +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/db/.svn/text-base/DataHelper.java.svn-base b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/db/.svn/text-base/DataHelper.java.svn-base new file mode 100644 index 0000000..3182ab6 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/db/.svn/text-base/DataHelper.java.svn-base @@ -0,0 +1,346 @@ +package com.fp.persistence.commondb.db; + +import java.sql.Date; +import java.util.List; +import java.util.Map; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import com.fp.common.helper.Constant; +import com.fp.common.properties.CommonProperties; +import com.fp.core.exception.CoreException; +import com.fp.persistence.commondb.HqlStatement; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.cache.CacheManager; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.pgeneral.date.TgeneAccountingDate; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranchKey; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneQueryProcess; +import com.fp.persistence.pgeneral.gene.TgeneTransactionQuery; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; +import com.fp.persistence.pgeneral.trans.TgeneTransactionProcess; +import com.fp.persistence.pgeneral.trans.report.TgeneTransactionReports; + + +/** + * Clase que se encarga de manejo de sentencias SQL o HQL con la base de datos, + * Existe ciertas tablas con informacion estatica, las cuales se cargan a memoria.
+ * Otras tablas se define para que se cargue a cache la informacion de ciertos regitros que esten marcagos con ManageCache. + * @author Jorge Vaca + * @version 2.1 + */ +public class DataHelper { + /**Almacena una instancia de DataHelper.*/ + private static DataHelper cache; + /**Separador del key de maps cuando este se compone de varios atributos.*/ + private static String separator = "^"; + /** + * Entrega una instancia de DataHelper. + * @return DataHelper + */ + public static DataHelper getInstance(){ + if(cache != null){ + return cache; + } + synchronized(DataHelper.class){ + if (cache == null) { + cache = new DataHelper(); + } + } + return cache; + } + + + /** + * Entrega un objeto con los datos de TgeneAccountingDateBranch. Que contiene la fecha contable de una sucursal. + * @param pComany Codigo de compania a obtener la fecha contable. + * @param pBranch Codigo de sucursal a obtener la fecha contable. + * @return TgeneAccountingDateBranch + * @throws CoreException + * @throws Exception + */ + public TgeneAccountingDateBranch getTgeneAccountingDateBranch(Integer pComany, Integer pBranch) throws CommondbException,Exception { + TgeneAccountingDateBranchKey key = new TgeneAccountingDateBranchKey(); + key.setBranchcode(pBranch); + key.setCompanycode(pComany); + TgeneAccountingDateBranch obj = null; + try { + obj = TgeneAccountingDateBranch.find(PersistenceHelper.getEntityManager(), key); + } catch (NoResultException e) { + throw new CommondbException("COMMONDB-00013","FECHA CONTABLE NO DEFINIDA PARA LA COMPANIA {0}, SUCURSAL {1}",pComany,pBranch); + } + return obj; + } + + + /**Sentencia que devuelve la definicion de una transaccion..*/ + private static final String HQL_TRANSACTION = + "from TgeneTransaction tt " + + " where tt.pk.transactionmodule = :transactionmodule " + + " and tt.pk.transactioncode = :transactioncode "+ + " and tt.pk.transactionversion = :transactionversion "; + + /** + * Entrega la definicion de una transaccion definida en tgenetransaction. + * @param pTransactionModule Codigo del modulo al que pertenece la transaccion. + * @param pTransactionCode Codigo de transaccion. + * @param pTransactionVersion Version de la transaccion. + * @return TgeneTransaction + * @throws Exception + */ + public TgeneTransaction getTgeneTransaction(String pTransactionModule,Integer pTransactionCode,Integer pTransactionVersion) throws Exception { + TgeneTransaction tgeneTransaction = null; + String key = pTransactionModule+separator+pTransactionCode+separator+pTransactionVersion; + + CacheManager cm = CacheManager.getInstance(); + tgeneTransaction = (TgeneTransaction) cm.getData("TgeneTransaction", key); + + if(tgeneTransaction != null){ + return tgeneTransaction; + } + Query qry = PersistenceHelper.getEntityManager().createQuery(HQL_TRANSACTION); + qry.setParameter("transactionmodule", pTransactionModule); + qry.setParameter("transactioncode", pTransactionCode); + qry.setParameter("transactionversion", pTransactionVersion); + try { + tgeneTransaction = (TgeneTransaction)qry.getSingleResult(); + PersistenceHelper.getEntityManager().detach(tgeneTransaction); + } catch (NoResultException e) { + //no hacer nada + } + + //if manage cache + if (tgeneTransaction != null && Constant.ifYes(tgeneTransaction.getManagecache()) ) { + Map m = cm.getMapDefinition("TgeneTransaction"); + m.put(key, tgeneTransaction); + cm.putData("TgeneTransaction", (Object) m); + + } + return tgeneTransaction; + } + + /**Sentencia que devuelve la definicion de procesos de negocio a ejecutar para una transaccion..*/ + private static final String HQL_TRANSACTION_RULE = + "from TgeneTransactionProcess ttp " + + " where ttp.pk.transactionmodule = :transactionmodule " + + " and ttp.pk.transactioncode = :transactioncode "+ + " and ttp.pk.transactionversion = :transactionversion "+ + " and ttp.status = 'A' "+ + " order by ttp.executionorder "; + + + /** + * Entrega la definicion de procesos de negocio de una transaccion definida. + * @param pTransactionModule Codigo del modulo al que pertenece la transaccion. + * @param pTransactionCode Codigo de transaccion. + * @param pTransactionVersion Version de la transaccion. + * @return List + * @throws Exception + */ + @SuppressWarnings(Constant.VUNCHECKED) + public List getTgeneTransactionProcess(String pTransactionModule,Integer pTransactionCode,Integer pTransactionVersion) throws Exception { + List lTgeneTransactionProcess = null; + String key = pTransactionModule+separator+pTransactionCode+separator+pTransactionVersion; + + CacheManager cm = CacheManager.getInstance(); + lTgeneTransactionProcess = (List) cm.getData("TgeneTransactionProcess", key); + + if(lTgeneTransactionProcess != null){ + return lTgeneTransactionProcess; + } + HqlStatement hql = new HqlStatement(HQL_TRANSACTION_RULE); + hql.setString(Constant.VTRANSACTIONMODULE, pTransactionModule); + hql.setInteger(Constant.VTRANSACTIONCODE, pTransactionCode); + hql.setInteger(Constant.VTRANSACTIONVERSION, pTransactionVersion); + hql.setReadonly(true); + + lTgeneTransactionProcess = hql.execute().getResultList(); + + if(lTgeneTransactionProcess == null || lTgeneTransactionProcess.size() == 0){ + return lTgeneTransactionProcess; + } + /*if manage cache COMMONDB-0006*/ + TgeneTransactionProcess obj = lTgeneTransactionProcess.get(0); + if (obj != null && Constant.ifYes(obj.getManagecache()) ) { + Map m = cm.getMapDefinition("TgeneTransactionProcess"); + m.put(key, lTgeneTransactionProcess); + cm.putData("TgeneTransactionProcess", (Object) m); + } + return lTgeneTransactionProcess; + } + + /**Sentencia que devuelve la definicion de procesos a ejecutar el query para una transaccion..*/ + private static final String HQL_TRANSACTION_QUERY = + "from TgeneTransactionQuery ttq " + + " where ttq.pk.transactionmodule = :transactionmodule " + + " and ttq.pk.transactioncode = :transactioncode "+ + " and ttq.pk.transactionversion = :transactionversion "+ + " and ttq.status = 'A' "+ + " order by ttq.executionorder "; + + /** + * Entrega la definicion de procesos que complementan datos en la consulta para una transaccion. + * @param pTransactionModule Codigo del modulo al que pertenece la transaccion. + * @param pTransactionCode Codigo de transaccion. + * @param pTransactionVersion Version de la transaccion. + * @return List + * @throws Exception + */ + @SuppressWarnings(Constant.VUNCHECKED) + public List getTgeneTransactionQuery(String pTransactionModule,Integer pTransactionCode,Integer pTransactionVersion) throws Exception { + List lTgeneTransactionQuery = null; + + HqlStatement hql = new HqlStatement(HQL_TRANSACTION_QUERY); + hql.setString(Constant.VTRANSACTIONMODULE, pTransactionModule); + hql.setInteger(Constant.VTRANSACTIONCODE, pTransactionCode); + hql.setInteger(Constant.VTRANSACTIONVERSION, pTransactionVersion); + hql.setReadonly(true); + lTgeneTransactionQuery = hql.execute().getResultList(); + return lTgeneTransactionQuery; + } + + /**Sentencia que devuelve la definicion de procesos a ejecutar en la generacion de reportes..*/ + private static final String HQL_TRANSACTION_REPORT = + "from TgeneTransactionReports ttr " + + " where ttr.pk.transactionmodule = :transactionmodule " + + " and ttr.pk.transactioncode = :transactioncode "+ + " and ttr.pk.transactionversion = :transactionversion "+ + " and ttr.status = 'A' "+ + " order by ttr.executionorder "; + + /** + * Entrega la definicion de procesos que se encargan de generar datos a utilizar en la generacion de reportes. + * @param pTransactionModule Codigo del modulo al que pertenece la transaccion. + * @param pTransactionCode Codigo de transaccion. + * @param pTransactionVersion Version de la transaccion. + * @return List + * @throws Exception + */ + @SuppressWarnings(Constant.VUNCHECKED) + public List getTgeneTransactionReports(String pTransactionModule,Integer pTransactionCode,Integer pTransactionVersion) throws Exception { + List lReports = null; + HqlStatement hql = new HqlStatement(HQL_TRANSACTION_REPORT); + hql.setString(Constant.VTRANSACTIONMODULE, pTransactionModule); + hql.setInteger(Constant.VTRANSACTIONCODE, pTransactionCode); + hql.setInteger(Constant.VTRANSACTIONVERSION, pTransactionVersion); + hql.setReadonly(true); + lReports = hql.execute().getResultList(); + return lReports; + } + + /**Sentencia que devuelve la definicion de procesos a ejecutar para un codigo de consulta.*/ + private static final String HQL_QUERY_PROCESS = + "from TgeneQueryProcess tqp " + + " where tqp.pk.querycode = :querycode " + + " and tqp.status = 'A' "+ + " order by executionorder "; + + /** + * Entrega la definicion de procesos que complementan datos en la consulta para un codigo de consulta. + * @param pQueryCode Codigo del consulta con el cual se completa datos. + * @return List + * @throws Exception + */ + @SuppressWarnings(Constant.VUNCHECKED) + public List getTgeneQueryProcess(String pQueryCode) throws Exception { + List lTgeneQueryProcess = null; + HqlStatement hql = new HqlStatement(HQL_QUERY_PROCESS); + hql.setString("querycode", pQueryCode); + hql.setReadonly(true); + lTgeneQueryProcess = hql.execute().getResultList(); + return lTgeneQueryProcess; + } + + /** + * Metodo que entrega la fecha contable de liberacion de fondos de cheques locales. + * @param pBranch Codigo de sucursal. + * @param pCompany Codigo de compania. + * @param pAccountingDate Fecha contable en la cual se ejecuta la transaccion. + * @return Date + * @throws Exception + */ + public Date getHoldDate(Integer pBranch,Integer pCompany,Date pAccountingDate) throws Exception { + Integer days = CommonProperties.getInstance().getIntValue("localhold"); + List lDates = this.getTgeneAccountingDate(pBranch, pCompany, pAccountingDate); + Date olddate = null; + Date d = null; + int i = 0; + for (TgeneAccountingDate obj : lDates) { + if(olddate == null || olddate.compareTo(obj.getAccountingdate()) != 0){ + i++; + } + olddate = obj.getAccountingdate(); + if(i >= days){ + d = obj.getAccountingdate(); + break; + } + } + if(d == null){ + throw new CommondbException("COMMONDB-00014", "FECHAS CONTABLES NO DEFINIDAS EN: {0} PARA LA COMPANIA {1}, SUCURSAL {2}", + "TGENEACCOUNTINGDATE",pCompany,pBranch); + } + return d; + } + + + /** Sentencia que devuelve lista de fechas contables por sucursal.*/ + private static final String HQL_HOLD_ACCOUNTING_DATE_BRANCH = + "from TgeneAccountingDate d " + + " where d.pk.branchcode = :branch " + + " and d.pk.companycode = :company "+ + " and d.accountingdate > :accountingdate "+ + " and d.accountingdate < :accountingdate + :days "; + + /** + * Metodo que entrega una lista de TgeneAccountingDate, con el cual se obtiene los dias de retencion + * de cheques locales. + * @param pBranch Codigo de sucursal. + * @param pCompany Codigo de compania. + * @param pAccountingDate Fecha contable. + * @return List + * @throws Exception + */ + @SuppressWarnings(Constant.VUNCHECKED) + private List getTgeneAccountingDate(Integer pBranch,Integer pCompany,Date pAccountingDate) throws CommondbException,Exception { + List lDates = null; + HqlStatement hql = new HqlStatement(HQL_HOLD_ACCOUNTING_DATE_BRANCH); + hql.setInteger("branch", pBranch); + hql.setInteger("company", pCompany); + hql.setDate("accountingdate", pAccountingDate); + hql.setInteger("days", 15); + hql.setReadonly(true); + lDates = hql.execute().getResultList(); + if(lDates == null || lDates.size() == 0){ + throw new CommondbException("COMMONDB-00014", "FECHAS CONTABLES NO DEFINIDAS EN: {0} PARA LA COMPANIA {1}, SUCURSAL {2}", + "TGENEACCOUNTINGDATE",pCompany,pBranch); + } + return lDates; + } + + /**Sentencia que devuelve un registro del detalle del catalog.*/ + private static final String HQL_CATALOG_DETAIL = + "from TgeneCatalogDetail tcd " + + " where tcd.pk.catalog = :catalog " + + " and tcd.pk.catalogcode = :catalogcode "; + + /** + * Metodo que entrega la definicion de detalel del catalogo. + * @param pCatalog Codigo dentro del catalogo. + * @param pCatalogcode Codigo de catalogo. + * @return TgeneCatalogDetail + * @throws Exception + */ + public TgeneCatalogDetail getTgeneCatalogDetail(String pCatalog,String pCatalogcode) throws Exception { + TgeneCatalogDetail tgeneCatalogDetail = null; + HqlStatement hql = new HqlStatement(); + hql.setSentence(HQL_CATALOG_DETAIL); + hql.setString("catalog", pCatalog); + hql.setString("catalogcode", pCatalogcode); + tgeneCatalogDetail = (TgeneCatalogDetail)hql.getObject(); + return tgeneCatalogDetail; + } + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/db/CloneData.java b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/db/CloneData.java new file mode 100644 index 0000000..8ad72b1 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/db/CloneData.java @@ -0,0 +1,195 @@ +/* + * + */ +package com.fp.persistence.commondb.db; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; + +/** + * Class CloneData encargada de copiar los datos de una tabla a otra tabla empleando una sola Sentencia SQL + * (Insert-select) + * + * @author gfiallos + */ +public class CloneData { + + /** Tabla Origen */ + private String table; + + /** Tabla Destino */ + private String destiny; + + /** El valor de fields. */ + private List fields; + + /** El valor de restrictions. */ + private Map restrictions = new HashMap(); + + /** El valor de replacements. */ + private Map replacements = new HashMap(); + + /** El valor de em. */ + private EntityManager em; + + /** + * Crea una nueva instancia de clone data. + * + * @param pTable Tabla Origen + * @throws Exception la exception + */ + public CloneData(String pTable) throws Exception { + this(pTable, pTable); + } + + /** + * Crea una nueva instancia de clone data. + * + * @param pTable Tabla Origen + * @param pDestiny Tabla Destino + * @throws Exception la exception + */ + public CloneData(String pTable, String pDestiny) throws Exception { + this.destiny = pDestiny; + this.table = pTable; + this.prepare(); + } + + /** + * Crea una nueva instancia de clone data. + * + * @param pTable Tabla Origen + * @param pRestrictions the restrictions + * @throws Exception la exception + */ + public CloneData(String pTable, Map pRestrictions) throws Exception { + this(pTable); + this.restrictions = pRestrictions; + } + + /** + * Adiciona un restriction. + * + * @param pName the name + * @param pValue the value + */ + public void addRestriction(String pName, Object pValue) { + this.restrictions.put(pName, pValue); + } + + /** + * Adiciona un replacement. + * + * @param pName the name + * @param pValue the value + */ + public void addReplacement(String pName, Object pValue) { + this.replacements.put(pName, pValue); + } + + /** + * Prepara los campos para la instrucción dada + * + * @throws Exception la exception + */ + private void prepare() throws Exception { + this.em = PersistenceHelper.getEntityManager(); + this.fields = PersistenceManager.getInstance().getDataBaseFields(this.destiny); + } + + /** + * Prepara la sentencia instert insert. + * + * @return string + * @throws Exception la exception + */ + private String prepareInsert() throws Exception { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + boolean first = true; + for (String name : this.fields) { + if (first) { + pw.print("insert into " + this.destiny + " (" + name); + first = false; + } else { + pw.print(" ," + name); + first = false; + } + } + pw.println(")"); + pw.close(); + return sw.toString(); + } + + /** + * Prepara el select. + * + * @return string + * @throws Exception la exception + */ + private String prepareSelect() throws Exception { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + boolean first = true; + for (String name : this.fields) { + if (this.replacements.containsKey(name)) { + // name = "cast( :r" + name.toLowerCase() + " as varchar(20) )"; + name = "'" + this.replacements.get(name) + "'"; + } + if (first) { + pw.print("select " + name); + first = false; + } else { + pw.print(" ," + name); + first = false; + } + } + pw.println(); + pw.println(" from " + this.table); + first = true; + for (Entry val : this.restrictions.entrySet()) { + if (first) { + pw.println(" where " + val.getKey() + "=:_" + val.getKey().toLowerCase()); + first = false; + } else { + pw.println(" and " + val.getKey() + "=:_" + val.getKey().toLowerCase()); + first = false; + } + } + pw.close(); + return sw.toString(); + } + + /** + * Executa la copia + * + * @return int + * @throws Exception la exception + */ + public int execute() throws Exception { + PersistenceHelper.flushTransaction(); + String sql = this.prepareInsert() + this.prepareSelect(); + APPLogger.getLogger().debug("Instruccion de Copia " + sql); + Query q = this.em.createNativeQuery(sql); + for (Entry val : this.restrictions.entrySet()) { + APPLogger.getLogger().debug("_" + val.getKey().toLowerCase() + ">>>>" + val.getValue()); + q.setParameter("_" + val.getKey().toLowerCase(), val.getValue()); + } + // for (Entry val : this.replacements.entrySet()) { + // q.setParameter("r" + val.getKey().toLowerCase().toLowerCase(), val.getValue()); + // APPLogger.getLogger().debug("r" + val.getKey().toLowerCase() + ">>>>" + val.getValue()); + // } + return q.executeUpdate(); + } +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/db/DataHelper.java b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/db/DataHelper.java new file mode 100644 index 0000000..3182ab6 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/db/DataHelper.java @@ -0,0 +1,346 @@ +package com.fp.persistence.commondb.db; + +import java.sql.Date; +import java.util.List; +import java.util.Map; + +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import com.fp.common.helper.Constant; +import com.fp.common.properties.CommonProperties; +import com.fp.core.exception.CoreException; +import com.fp.persistence.commondb.HqlStatement; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.cache.CacheManager; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.pgeneral.date.TgeneAccountingDate; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranchKey; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneQueryProcess; +import com.fp.persistence.pgeneral.gene.TgeneTransactionQuery; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; +import com.fp.persistence.pgeneral.trans.TgeneTransactionProcess; +import com.fp.persistence.pgeneral.trans.report.TgeneTransactionReports; + + +/** + * Clase que se encarga de manejo de sentencias SQL o HQL con la base de datos, + * Existe ciertas tablas con informacion estatica, las cuales se cargan a memoria.
+ * Otras tablas se define para que se cargue a cache la informacion de ciertos regitros que esten marcagos con ManageCache. + * @author Jorge Vaca + * @version 2.1 + */ +public class DataHelper { + /**Almacena una instancia de DataHelper.*/ + private static DataHelper cache; + /**Separador del key de maps cuando este se compone de varios atributos.*/ + private static String separator = "^"; + /** + * Entrega una instancia de DataHelper. + * @return DataHelper + */ + public static DataHelper getInstance(){ + if(cache != null){ + return cache; + } + synchronized(DataHelper.class){ + if (cache == null) { + cache = new DataHelper(); + } + } + return cache; + } + + + /** + * Entrega un objeto con los datos de TgeneAccountingDateBranch. Que contiene la fecha contable de una sucursal. + * @param pComany Codigo de compania a obtener la fecha contable. + * @param pBranch Codigo de sucursal a obtener la fecha contable. + * @return TgeneAccountingDateBranch + * @throws CoreException + * @throws Exception + */ + public TgeneAccountingDateBranch getTgeneAccountingDateBranch(Integer pComany, Integer pBranch) throws CommondbException,Exception { + TgeneAccountingDateBranchKey key = new TgeneAccountingDateBranchKey(); + key.setBranchcode(pBranch); + key.setCompanycode(pComany); + TgeneAccountingDateBranch obj = null; + try { + obj = TgeneAccountingDateBranch.find(PersistenceHelper.getEntityManager(), key); + } catch (NoResultException e) { + throw new CommondbException("COMMONDB-00013","FECHA CONTABLE NO DEFINIDA PARA LA COMPANIA {0}, SUCURSAL {1}",pComany,pBranch); + } + return obj; + } + + + /**Sentencia que devuelve la definicion de una transaccion..*/ + private static final String HQL_TRANSACTION = + "from TgeneTransaction tt " + + " where tt.pk.transactionmodule = :transactionmodule " + + " and tt.pk.transactioncode = :transactioncode "+ + " and tt.pk.transactionversion = :transactionversion "; + + /** + * Entrega la definicion de una transaccion definida en tgenetransaction. + * @param pTransactionModule Codigo del modulo al que pertenece la transaccion. + * @param pTransactionCode Codigo de transaccion. + * @param pTransactionVersion Version de la transaccion. + * @return TgeneTransaction + * @throws Exception + */ + public TgeneTransaction getTgeneTransaction(String pTransactionModule,Integer pTransactionCode,Integer pTransactionVersion) throws Exception { + TgeneTransaction tgeneTransaction = null; + String key = pTransactionModule+separator+pTransactionCode+separator+pTransactionVersion; + + CacheManager cm = CacheManager.getInstance(); + tgeneTransaction = (TgeneTransaction) cm.getData("TgeneTransaction", key); + + if(tgeneTransaction != null){ + return tgeneTransaction; + } + Query qry = PersistenceHelper.getEntityManager().createQuery(HQL_TRANSACTION); + qry.setParameter("transactionmodule", pTransactionModule); + qry.setParameter("transactioncode", pTransactionCode); + qry.setParameter("transactionversion", pTransactionVersion); + try { + tgeneTransaction = (TgeneTransaction)qry.getSingleResult(); + PersistenceHelper.getEntityManager().detach(tgeneTransaction); + } catch (NoResultException e) { + //no hacer nada + } + + //if manage cache + if (tgeneTransaction != null && Constant.ifYes(tgeneTransaction.getManagecache()) ) { + Map m = cm.getMapDefinition("TgeneTransaction"); + m.put(key, tgeneTransaction); + cm.putData("TgeneTransaction", (Object) m); + + } + return tgeneTransaction; + } + + /**Sentencia que devuelve la definicion de procesos de negocio a ejecutar para una transaccion..*/ + private static final String HQL_TRANSACTION_RULE = + "from TgeneTransactionProcess ttp " + + " where ttp.pk.transactionmodule = :transactionmodule " + + " and ttp.pk.transactioncode = :transactioncode "+ + " and ttp.pk.transactionversion = :transactionversion "+ + " and ttp.status = 'A' "+ + " order by ttp.executionorder "; + + + /** + * Entrega la definicion de procesos de negocio de una transaccion definida. + * @param pTransactionModule Codigo del modulo al que pertenece la transaccion. + * @param pTransactionCode Codigo de transaccion. + * @param pTransactionVersion Version de la transaccion. + * @return List + * @throws Exception + */ + @SuppressWarnings(Constant.VUNCHECKED) + public List getTgeneTransactionProcess(String pTransactionModule,Integer pTransactionCode,Integer pTransactionVersion) throws Exception { + List lTgeneTransactionProcess = null; + String key = pTransactionModule+separator+pTransactionCode+separator+pTransactionVersion; + + CacheManager cm = CacheManager.getInstance(); + lTgeneTransactionProcess = (List) cm.getData("TgeneTransactionProcess", key); + + if(lTgeneTransactionProcess != null){ + return lTgeneTransactionProcess; + } + HqlStatement hql = new HqlStatement(HQL_TRANSACTION_RULE); + hql.setString(Constant.VTRANSACTIONMODULE, pTransactionModule); + hql.setInteger(Constant.VTRANSACTIONCODE, pTransactionCode); + hql.setInteger(Constant.VTRANSACTIONVERSION, pTransactionVersion); + hql.setReadonly(true); + + lTgeneTransactionProcess = hql.execute().getResultList(); + + if(lTgeneTransactionProcess == null || lTgeneTransactionProcess.size() == 0){ + return lTgeneTransactionProcess; + } + /*if manage cache COMMONDB-0006*/ + TgeneTransactionProcess obj = lTgeneTransactionProcess.get(0); + if (obj != null && Constant.ifYes(obj.getManagecache()) ) { + Map m = cm.getMapDefinition("TgeneTransactionProcess"); + m.put(key, lTgeneTransactionProcess); + cm.putData("TgeneTransactionProcess", (Object) m); + } + return lTgeneTransactionProcess; + } + + /**Sentencia que devuelve la definicion de procesos a ejecutar el query para una transaccion..*/ + private static final String HQL_TRANSACTION_QUERY = + "from TgeneTransactionQuery ttq " + + " where ttq.pk.transactionmodule = :transactionmodule " + + " and ttq.pk.transactioncode = :transactioncode "+ + " and ttq.pk.transactionversion = :transactionversion "+ + " and ttq.status = 'A' "+ + " order by ttq.executionorder "; + + /** + * Entrega la definicion de procesos que complementan datos en la consulta para una transaccion. + * @param pTransactionModule Codigo del modulo al que pertenece la transaccion. + * @param pTransactionCode Codigo de transaccion. + * @param pTransactionVersion Version de la transaccion. + * @return List + * @throws Exception + */ + @SuppressWarnings(Constant.VUNCHECKED) + public List getTgeneTransactionQuery(String pTransactionModule,Integer pTransactionCode,Integer pTransactionVersion) throws Exception { + List lTgeneTransactionQuery = null; + + HqlStatement hql = new HqlStatement(HQL_TRANSACTION_QUERY); + hql.setString(Constant.VTRANSACTIONMODULE, pTransactionModule); + hql.setInteger(Constant.VTRANSACTIONCODE, pTransactionCode); + hql.setInteger(Constant.VTRANSACTIONVERSION, pTransactionVersion); + hql.setReadonly(true); + lTgeneTransactionQuery = hql.execute().getResultList(); + return lTgeneTransactionQuery; + } + + /**Sentencia que devuelve la definicion de procesos a ejecutar en la generacion de reportes..*/ + private static final String HQL_TRANSACTION_REPORT = + "from TgeneTransactionReports ttr " + + " where ttr.pk.transactionmodule = :transactionmodule " + + " and ttr.pk.transactioncode = :transactioncode "+ + " and ttr.pk.transactionversion = :transactionversion "+ + " and ttr.status = 'A' "+ + " order by ttr.executionorder "; + + /** + * Entrega la definicion de procesos que se encargan de generar datos a utilizar en la generacion de reportes. + * @param pTransactionModule Codigo del modulo al que pertenece la transaccion. + * @param pTransactionCode Codigo de transaccion. + * @param pTransactionVersion Version de la transaccion. + * @return List + * @throws Exception + */ + @SuppressWarnings(Constant.VUNCHECKED) + public List getTgeneTransactionReports(String pTransactionModule,Integer pTransactionCode,Integer pTransactionVersion) throws Exception { + List lReports = null; + HqlStatement hql = new HqlStatement(HQL_TRANSACTION_REPORT); + hql.setString(Constant.VTRANSACTIONMODULE, pTransactionModule); + hql.setInteger(Constant.VTRANSACTIONCODE, pTransactionCode); + hql.setInteger(Constant.VTRANSACTIONVERSION, pTransactionVersion); + hql.setReadonly(true); + lReports = hql.execute().getResultList(); + return lReports; + } + + /**Sentencia que devuelve la definicion de procesos a ejecutar para un codigo de consulta.*/ + private static final String HQL_QUERY_PROCESS = + "from TgeneQueryProcess tqp " + + " where tqp.pk.querycode = :querycode " + + " and tqp.status = 'A' "+ + " order by executionorder "; + + /** + * Entrega la definicion de procesos que complementan datos en la consulta para un codigo de consulta. + * @param pQueryCode Codigo del consulta con el cual se completa datos. + * @return List + * @throws Exception + */ + @SuppressWarnings(Constant.VUNCHECKED) + public List getTgeneQueryProcess(String pQueryCode) throws Exception { + List lTgeneQueryProcess = null; + HqlStatement hql = new HqlStatement(HQL_QUERY_PROCESS); + hql.setString("querycode", pQueryCode); + hql.setReadonly(true); + lTgeneQueryProcess = hql.execute().getResultList(); + return lTgeneQueryProcess; + } + + /** + * Metodo que entrega la fecha contable de liberacion de fondos de cheques locales. + * @param pBranch Codigo de sucursal. + * @param pCompany Codigo de compania. + * @param pAccountingDate Fecha contable en la cual se ejecuta la transaccion. + * @return Date + * @throws Exception + */ + public Date getHoldDate(Integer pBranch,Integer pCompany,Date pAccountingDate) throws Exception { + Integer days = CommonProperties.getInstance().getIntValue("localhold"); + List lDates = this.getTgeneAccountingDate(pBranch, pCompany, pAccountingDate); + Date olddate = null; + Date d = null; + int i = 0; + for (TgeneAccountingDate obj : lDates) { + if(olddate == null || olddate.compareTo(obj.getAccountingdate()) != 0){ + i++; + } + olddate = obj.getAccountingdate(); + if(i >= days){ + d = obj.getAccountingdate(); + break; + } + } + if(d == null){ + throw new CommondbException("COMMONDB-00014", "FECHAS CONTABLES NO DEFINIDAS EN: {0} PARA LA COMPANIA {1}, SUCURSAL {2}", + "TGENEACCOUNTINGDATE",pCompany,pBranch); + } + return d; + } + + + /** Sentencia que devuelve lista de fechas contables por sucursal.*/ + private static final String HQL_HOLD_ACCOUNTING_DATE_BRANCH = + "from TgeneAccountingDate d " + + " where d.pk.branchcode = :branch " + + " and d.pk.companycode = :company "+ + " and d.accountingdate > :accountingdate "+ + " and d.accountingdate < :accountingdate + :days "; + + /** + * Metodo que entrega una lista de TgeneAccountingDate, con el cual se obtiene los dias de retencion + * de cheques locales. + * @param pBranch Codigo de sucursal. + * @param pCompany Codigo de compania. + * @param pAccountingDate Fecha contable. + * @return List + * @throws Exception + */ + @SuppressWarnings(Constant.VUNCHECKED) + private List getTgeneAccountingDate(Integer pBranch,Integer pCompany,Date pAccountingDate) throws CommondbException,Exception { + List lDates = null; + HqlStatement hql = new HqlStatement(HQL_HOLD_ACCOUNTING_DATE_BRANCH); + hql.setInteger("branch", pBranch); + hql.setInteger("company", pCompany); + hql.setDate("accountingdate", pAccountingDate); + hql.setInteger("days", 15); + hql.setReadonly(true); + lDates = hql.execute().getResultList(); + if(lDates == null || lDates.size() == 0){ + throw new CommondbException("COMMONDB-00014", "FECHAS CONTABLES NO DEFINIDAS EN: {0} PARA LA COMPANIA {1}, SUCURSAL {2}", + "TGENEACCOUNTINGDATE",pCompany,pBranch); + } + return lDates; + } + + /**Sentencia que devuelve un registro del detalle del catalog.*/ + private static final String HQL_CATALOG_DETAIL = + "from TgeneCatalogDetail tcd " + + " where tcd.pk.catalog = :catalog " + + " and tcd.pk.catalogcode = :catalogcode "; + + /** + * Metodo que entrega la definicion de detalel del catalogo. + * @param pCatalog Codigo dentro del catalogo. + * @param pCatalogcode Codigo de catalogo. + * @return TgeneCatalogDetail + * @throws Exception + */ + public TgeneCatalogDetail getTgeneCatalogDetail(String pCatalog,String pCatalogcode) throws Exception { + TgeneCatalogDetail tgeneCatalogDetail = null; + HqlStatement hql = new HqlStatement(); + hql.setSentence(HQL_CATALOG_DETAIL); + hql.setString("catalog", pCatalog); + hql.setString("catalogcode", pCatalogcode); + tgeneCatalogDetail = (TgeneCatalogDetail)hql.getObject(); + return tgeneCatalogDetail; + } + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/exception/.svn/entries b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/exception/.svn/entries new file mode 100644 index 0000000..1e37ae9 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/exception/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/exception +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +Constant.java +file + + + + +2022-07-28T03:40:31.957756Z +4c633ec932638d0155eba7aa2bf3dff2 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +446 + diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/exception/.svn/text-base/Constant.java.svn-base b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/exception/.svn/text-base/Constant.java.svn-base new file mode 100644 index 0000000..f1edd2f --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/exception/.svn/text-base/Constant.java.svn-base @@ -0,0 +1,17 @@ +package com.fp.persistence.commondb.exception; + +/** + * Clase en la cual se definen codigos de excepcion que se usan a menudo.. + * @author Jorge Vaca. + * @version 2.1 + */ +public class Constant { + + /** Codigo de respuesta ok al ejecutar una transaccion. */ + public static final String RS_SUCCESS="0"; + + /** Codigo de respuesta ok al ejecutar una transaccion. */ + public static final String NO_DATA_FOUND ="COMMONDB-0006"; + + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/exception/Constant.java b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/exception/Constant.java new file mode 100644 index 0000000..f1edd2f --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/exception/Constant.java @@ -0,0 +1,17 @@ +package com.fp.persistence.commondb.exception; + +/** + * Clase en la cual se definen codigos de excepcion que se usan a menudo.. + * @author Jorge Vaca. + * @version 2.1 + */ +public class Constant { + + /** Codigo de respuesta ok al ejecutar una transaccion. */ + public static final String RS_SUCCESS="0"; + + /** Codigo de respuesta ok al ejecutar una transaccion. */ + public static final String NO_DATA_FOUND ="COMMONDB-0006"; + + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/.svn/entries b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/.svn/entries new file mode 100644 index 0000000..0912efe --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/.svn/entries @@ -0,0 +1,201 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +APPDates.java +file + + + + +2022-07-28T03:40:31.773756Z +acdb676d3b7a9137efa8b456593fbdbe +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +17275 + +Frequency.java +file + + + + +2022-07-28T03:40:31.773756Z +2cd5f8a055588b739c74770dcd8605e4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1832 + +Fkconstraint.java +file + + + + +2022-07-28T03:40:31.773756Z +6e8322382bce40a0473acf1a758c102c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1759 + +sequence +dir + +FormatDates.java +file + + + + +2022-07-28T03:40:31.773756Z +59335a745608d557fb4189d38e26606a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8547 + +MapUtil.java +file + + + + +2022-07-28T03:40:31.774756Z +6443daabba4face35d6065f76d66c5f7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2262 + diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/.svn/text-base/APPDates.java.svn-base b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/.svn/text-base/APPDates.java.svn-base new file mode 100644 index 0000000..152c1ec --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/.svn/text-base/APPDates.java.svn-base @@ -0,0 +1,507 @@ +package com.fp.persistence.commondb.helper; + +import java.sql.Date; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.GregorianCalendar; + +import com.fp.common.helper.CalculationBase; +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.exception.CommondbException; + +/** + * Clase utilitaria para el manejo de fechas. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class APPDates implements Comparable { + + /* Fecha base para las Operaciones */ + private Date date; + + /* Base de Calculo */ + private CalculationBase base; + + /* Calendario Encargado de las operaciones con las Fechas */ + private final GregorianCalendar calendar; + + /* Formateador de Fechas para transporte */ + private final SimpleDateFormat formateador; + + /** + * Crea una nueva instancia de Dates + * + * @param pDate Fecha base + * @param pBase Base de Calculo; + */ + public APPDates(String pDate, CalculationBase pBase) throws Exception { + this(new Date(FormatDates.getInstance().getTransportDateFormat().parse(pDate).getTime()), pBase); + } + + /** + * Crea una nueva instancia de Dates + * + * @param pDate Fecha base como string formato yyyy-MM-dd + */ + public APPDates(String pDate) throws Exception { + this(pDate, CalculationBase.B360365); + } + + /** + * Crea una nueva instancia de Dates + * + * @param pDate Fecha base + * @param pBase Base de Calculo; + */ + public APPDates(Date pDate, CalculationBase pBase) throws Exception { + this.date = pDate; + this.base = pBase; + this.calendar = new GregorianCalendar(); + this.calendar.setTime(this.date); + this.formateador = FormatDates.getInstance().getTransportDateFormat(); + } + + /** + * Crea una nueva instancia de Dates + * + * @param pDate Fecha base + * @param pBase Base de Calculo; + */ + public APPDates(Date pDate, CalculationBase pBase, SimpleDateFormat sdf) throws Exception { + this.date = pDate; + this.base = pBase; + this.calendar = new GregorianCalendar(); + this.calendar.setTime(this.date); + this.formateador = sdf; + } + + /** + * Crea una nueva instancia de Dates con base 360/365 + * + * @param pDate Fecha base + */ + public APPDates(Date pDate) throws Exception { + this(pDate, CalculationBase.B360365); + } + + /** + * Entrega el Valor de date. + * + * @return Date + */ + public Date getDate() { + return this.date; + } + + /** + * Entrega el Valor de date. + * + * @return Timestamp + */ + public Timestamp getTimestamp() { + return new Timestamp(this.date.getTime()); + } + + /** + * Metodoq ue resta un mes a una fecha y le pone el ultimo dia del mes en la misma. + * + * @throws Exception + */ + public void substractOneMonth365() throws Exception { + this.calendar.add(Calendar.MONTH, -1); + int max1 = this.calendar.getActualMaximum(Calendar.DAY_OF_MONTH); + this.calendar.set(Calendar.DAY_OF_MONTH, max1); + this.date = new Date(this.calendar.getTimeInMillis()); + } + + /** + * Clase que se encarga de restar dos fechas, a la fecha mayor se resta una fecha menor. + * + * @param pInicialdate Feinicial a restar de una fecha final. + * @return int + * @throws Exception + */ + public int substract(APPDates pInicialdate) throws Exception { + int days = 0; + if (pInicialdate.getDate().after(this.date)) { + throw new CommondbException("COMMONDB-0001", "FECHA A RESTAR: {0,date,yyyy-MM-dd} ES MAYOR A: {1,date,yyyy-MM-dd}", + pInicialdate.getDate(), this.date); + } + if (pInicialdate.getDate().compareTo(this.date) == 0) { + return 0; + } + if (this.base.getMonthBase() == 365) { + days = this.substract365(pInicialdate); + } else { + days = this.substract360(pInicialdate); + } + return days; + } + + /** + * Metodo que resta fechas en base cuando la base es 365/xxx + * + * @param pInicialdate Fecha inicia a restar. + * @return int + * @throws Exception + */ + private int substract365(APPDates pInicialdate) throws Exception { + int days = 0; + GregorianCalendar cal1 = new GregorianCalendar(); + cal1.setTime(pInicialdate.getDate()); + do { + cal1.add(Calendar.DATE, 1); + days++; + } while (this.date.compareTo(cal1.getTime()) != 0); + return days; + } + + /** + * Metodo que se encarga de restar dos fehcas en base 360. + * + * @param pInicialdate + * @return + * @throws Exception + */ + private int substract360(APPDates pInicialdate) throws Exception { + int days = 0; + int nYears = this.getField(Calendar.YEAR) - pInicialdate.getField(Calendar.YEAR); + int nMonths = this.getField(Calendar.MONTH) - pInicialdate.getField(Calendar.MONTH); + int dayone = this.getField(Calendar.DAY_OF_MONTH); + if (dayone == 31) { + dayone = 30; + } + int daytwo = pInicialdate.getField(Calendar.DAY_OF_MONTH); + if (daytwo == 31) { + daytwo = 30; + } + int nMonth = this.getField(Calendar.MONTH); + if (nMonth == 1) { // 0 enero, 1 febrero , 2 marzo + // si el dia de la fecha es igual al maximo dia del mes + if (this.getField(Calendar.DAY_OF_MONTH) == this.calendar.getActualMaximum(Calendar.DAY_OF_MONTH)) { + int day = pInicialdate.getField(Calendar.DAY_OF_MONTH); + if ((day == 30) || (day == 31)) { + dayone = 30; + } + } + } + nMonth = pInicialdate.getField(Calendar.MONTH); + if (nMonth == 1) { // 0 enero, 1 febrero , 2 marzo + // si el dia de la fecha es igual al maximo dia del mes + if (pInicialdate.getField(Calendar.DAY_OF_MONTH) == pInicialdate.calendar.getActualMaximum(Calendar.DAY_OF_MONTH)) { + int day = this.getField(Calendar.DAY_OF_MONTH); + if ((day == 30) || (day == 31)) { + daytwo = 30; + } + } + } + nYears = nYears * 12 * 30; + nMonths = nMonths * 30; + days = dayone - daytwo; + days = nYears + nMonths + days; + /* v_dias_resultado := (nvl(v_anios,0) * 12 * 30) + (nvl(v_meses,0) * 30) + (nvl(v_dia1,0) - nvl(v_dia2,0)); */ + return days; + } + + /** + * Aniadir dias a una Fecha + * + * @param days Numero de dias a aniadir + */ + public void addYearBased(int days) throws Exception { + if (this.base.getYearBase() == 365) { + this.calendar.add(Calendar.DATE, days); + } else { + if (Math.abs(days) >= 30) { + int month = (int) Math.floor(days / 30); + this.calendar.add(Calendar.MONTH, month); + this.calendar.add(Calendar.DATE, days % 30); + } else { + this.calendar.add(Calendar.DATE, days); + } + } + this.date = new Date(this.calendar.getTime().getTime()); + } + + /** + * Aniadir dias a una Fecha, amteniendo un dia fijo en la fecha. + * + * @param days Numero de dias a adicionar. + * @param payDay Fecha de pago. + * @throws Exception + */ + public void addDaysBased(int days, Integer payDay) throws Exception { + if (this.base.getMonthBase() == 365) { + /* + * if( days == 31 || this.calendar.getActualMaximum(Calendar.DAY_OF_MONTH) >= days){ + * this.calendar.add(Calendar.MONTH,1); }else{ this.calendar.add(Calendar.DATE, days); } + */ + this.calendar.add(Calendar.DATE, days); + } else { + if (Math.abs(days) >= 30) { + int diff = 0; + if (this.calendar.get(Calendar.MONTH) == Calendar.FEBRUARY) { + if (this.calendar.get(Calendar.DATE) >= 28) { + if ((payDay != null) && (this.calendar.getActualMaximum(Calendar.DAY_OF_MONTH) < payDay)) { + // diff= (this.calendar.getActualMaximum(Calendar.DAY_OF_MONTH)==29)?1:2; + diff = payDay - this.calendar.getActualMaximum(Calendar.DAY_OF_MONTH); + } + } + } + int month = (int) Math.floor(days / 30); + this.calendar.add(Calendar.MONTH, month); + int d = days % 30; + this.calendar.add(Calendar.DATE, d); + if (diff > 0) { + this.calendar.add(Calendar.DATE, diff); + } + } else { + this.calendar.add(Calendar.DATE, days); + } + } + this.date = new Date(this.calendar.getTime().getTime()); + } + + /** + * Aniadir dias a una Fecha + * + * @param days Numero de dias a aniadir + */ + public void addMonthBased(int days) throws Exception { + if (this.base.getMonthBase() == 365) { + this.calendar.add(Calendar.DATE, days); + } else { + if (Math.abs(days) >= 30) { + int diff = 0; + if (this.calendar.get(Calendar.MONTH) == Calendar.FEBRUARY) { + if (this.calendar.get(Calendar.DATE) >= 28) { + diff = (this.calendar.getActualMaximum(Calendar.DAY_OF_MONTH) == 29) ? 1 : 2; + } + } + int month = (int) Math.floor(days / 30); + this.calendar.add(Calendar.MONTH, month); + this.calendar.add(Calendar.DATE, days % 30); + if (diff > 0) { + this.calendar.add(Calendar.DATE, diff); + } + } else { + this.calendar.add(Calendar.DATE, days); + } + } + this.date = new Date(this.calendar.getTime().getTime()); + } + + /** + * Entrega el Valor de base de calculo. + * + * @return CalculationBase. + */ + public CalculationBase getBase() { + return this.base; + } + + /** + * Fija el valor de base de calculo + * + * @param base Nuevo valor de base. + */ + public void setBase(CalculationBase base) { + this.base = base; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return this.formateador.format(this.date).toString(); + } + + public int getField(int pField) throws Exception { + return this.calendar.get(pField); + } + + /** + * Entrega el Valor de calendar. + * + * @return GregorianCalendar. + */ + public GregorianCalendar getGregorianCalendar() { + return this.calendar; + } + + public APPDates dateFrecuency(Frequency pFrecuency) throws Exception { + this.calendar.add(Calendar.DATE, pFrecuency.getNumDays(this.getDate(), this.formateador)); + return new APPDates(new Date(this.calendar.getTime().getTime())); + } + + public APPDates nextDateofSequence(Frequency pFrecuency, int pDay) throws Exception { + int days = pFrecuency.getNumDays(this.getDate(), this.formateador); + if (days > 31) { + // TODO Incluiy las frecuanias superiores a mensual + throw new CommondbException("COMMONDB-0002", "LA FRECUENCIA DEBE SER MENOR O IGUAL A MENSUAL"); + } + if (pDay > days) { + if ((pFrecuency == Frequency.MONTHLY) && (pDay == 31)) { + pDay = days; + } else { + throw new CommondbException("COMMONDB-0003", "El DIA {0} NO PUEDE MAYOR AL NUMEOR DE DIAS DE LA FRECUENCIA{1}", pDay, days); + } + } + GregorianCalendar cal = new GregorianCalendar(); + cal.setTime(this.date); + if (pFrecuency == Frequency.WEEKLY) { + while (cal.get(Calendar.DAY_OF_WEEK) != pDay) { + cal.add(Calendar.DAY_OF_WEEK, 1); + } + return new APPDates(new Date(cal.getTime().getTime())); + } + cal.set(Calendar.DATE, pDay); + APPLogger.getLogger().debug("Calendario base ==> " + cal.getTime()); + APPLogger.getLogger().debug("Maximo dia del mes ==> " + cal.getActualMaximum(Calendar.DAY_OF_MONTH)); + while (cal.getTime().before(this.date)) { + cal.add(Calendar.DATE, days); + } + while ((cal.get(Calendar.MONTH) != this.getField(Calendar.MONTH)) && (pDay != cal.get(Calendar.DATE))) { + cal.add(Calendar.DATE, -1); + } + if ((cal.get(Calendar.DATE) == 30) && (cal.getActualMaximum(Calendar.DAY_OF_MONTH) == 31)) { + cal.add(Calendar.DATE, 1); + } + return new APPDates(new Date(cal.getTime().getTime())); + } + + public int getJulianDate() throws Exception { + GregorianCalendar c = new GregorianCalendar(); + c.setTime(this.date); + return this.toJulian(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DATE)); + } + + private int toJulian(int year, int month, int day) throws Exception { + int julianYear = year; + if (year < 0) { + julianYear++; + } + int julianMonth = month; + if (month > 2) { + julianMonth++; + } else { + julianYear--; + julianMonth += 13; + } + + double julian = (java.lang.Math.floor(365.25 * julianYear) + java.lang.Math.floor(30.6001 * julianMonth) + day + 1720995.0); + + if ((day + (31 * (month + (12 * year)))) >= JGREG) { + int ja = (int) (0.01 * julianYear); + julian += (2 - ja) + (0.25 * ja); + } + return (int) Math.floor(julian); + } + + public static final int JGREG = 15 + (31 * (10 + (12 * 1582))); + + /** + * Adiciona anios, meses, dias, semanas ..Etc a una fecha. + * + * @param field Constante de anio, mes, dia...Etc + * @param value Numero de anios, dias, meses a adicionar puese der un valor negativo. + * @throws Exception + */ + public void addField(int field, int value) throws Exception { + getGregorianCalendar().add(field, value); + this.date = new Date(getGregorianCalendar().getTimeInMillis()); + } + + /** + * Adiciona anios, meses, dias, semanas ..Etc a una fecha. + * + * @param field Constante de anio, mes, dia...Etc + * @param value Numero de anios, dias, meses a adicionar puese der un valor negativo. + * @throws Exception + */ + public void setField(int field, int value) throws Exception { + if (field == Calendar.DAY_OF_MONTH) { + int maxday = getGregorianCalendar().getActualMaximum(Calendar.DAY_OF_MONTH); + if (value > maxday) { + value = maxday; + } + } + getGregorianCalendar().set(field, value); + this.date = new Date(getGregorianCalendar().getTimeInMillis()); + } + + /** + * Compara dos Dates. + * + * @param o + * @return + */ + @Override + public int compareTo(Object o) { + if (!(o instanceof APPDates)) { + return -1; + } + APPDates d = (APPDates) o; + return this.date.compareTo(d.date); + } + + /** + * Entrega el dia del anio al correspondiente a la Fecha + * + * @return Dia del Anio + * @throws Exception + */ + public int getDayOfYear() throws Exception { + GregorianCalendar gcal = new GregorianCalendar(); + gcal.setTime(this.date); + return gcal.get(Calendar.DAY_OF_YEAR); + } + + /** + * Entrega lso dias del mes correspondiente a la fecha. + * + * @return int + * @throws Exception + */ + public int getDaysOfMonth() throws Exception { + if (this.base.getMonthBase() == 360) { + return 30; + } + GregorianCalendar gcal = new GregorianCalendar(); + gcal.setTime(this.date); + return gcal.getActualMaximum(Calendar.DAY_OF_MONTH); + } + + /** + * Fija el ultimo dia del mes corespondiente a la fecha. + * + * @return + * @throws Exception + */ + public void setLastDateOfMonth() throws Exception { + Calendar gcal = new GregorianCalendar(); + gcal.setTime(this.date); + gcal.set(Calendar.DAY_OF_MONTH, this.getDaysOfMonth()); + this.date = new Date(gcal.getTimeInMillis()); + } + + /** + * Entrega el mes del ao correspondiente a la Fecha + * + * @return mes del ao + * @throws Exception + */ + public String getMonthOfYear() throws Exception { + int month = this.getField(Calendar.MONTH) + 1; + if (month < 10) { + return "0" + month; + } else { + return "" + month; + } + } +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/.svn/text-base/Fkconstraint.java.svn-base b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/.svn/text-base/Fkconstraint.java.svn-base new file mode 100644 index 0000000..830f795 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/.svn/text-base/Fkconstraint.java.svn-base @@ -0,0 +1,53 @@ +package com.fp.persistence.commondb.helper; + +import javax.persistence.Query; + +import com.fp.common.helper.FkException; +import com.fp.persistence.commondb.PersistenceHelper; + +/** + * Clase que entrega la tabla padre y dependiente dado un foreing key. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class Fkconstraint implements FkException { + + @Override + public String[] getFkData(String pFk) { + try { + String parent = this.getParentTable(pFk); + String child = this.getChildTable(pFk); + String[] data = new String[2]; + data[0] = parent; + data[1] = child; + return data; + } catch (Exception e) { + // No tomar accion. + } + return null; + } + + private String getParentTable(String pFk) throws Exception { + String table = null; + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(Fkconstraint.SQL); + qry.setParameter("fk", pFk); + table = (String) qry.getSingleResult(); + return table; + } + + private String getChildTable(String pFk) throws Exception { + String table = null; + // SQLQuery qry = pSession.createSQLQuery(Fkconstraint.SQL_DEP); + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(Fkconstraint.SQL_DEP); + qry.setParameter("fk", pFk); + table = (String) qry.getSingleResult(); + return table; + } + + private static final String SQL = "select table_name from user_constraints where constraint_name = ( " + + "select unique r_constraint_name from all_constraints where constraint_name = :fk)"; + + private static final String SQL_DEP = "select table_name from user_constraints where constraint_name = :fk"; + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/.svn/text-base/FormatDates.java.svn-base b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/.svn/text-base/FormatDates.java.svn-base new file mode 100644 index 0000000..b018f39 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/.svn/text-base/FormatDates.java.svn-base @@ -0,0 +1,260 @@ +package com.fp.persistence.commondb.helper; + +import java.sql.Date; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.GregorianCalendar; + +import javax.persistence.EntityManager; + +import org.hibernate.HibernateException; +import org.hibernate.SQLQuery; +import org.hibernate.Session; + +import com.fp.common.exception.CommonException; +import com.fp.common.helper.Constant; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; + +public final class FormatDates { + + /** Intancia Singleton */ + private static FormatDates cache = null; + + /** Almacena el formato yyyy-MM-dd HH:mm:ss */ + private SimpleDateFormat vDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + /** Almacena el formato yyyy-MM-dd */ + private SimpleDateFormat vDate = new SimpleDateFormat("yyyy-MM-dd");; + + /** Almacena el formato yyyy-MM-dd HH:mm:ss.SSS */ + private SimpleDateFormat vTimestamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); + + /** Almacena el formato HH:mm:ss */ + private SimpleDateFormat vTime = new SimpleDateFormat("mm:ss.SSS"); + + /** Almacena el formato HH:mm:ss */ + private SimpleDateFormat vTimeInseconds = new SimpleDateFormat("ss.SSS"); + + /* Crea una Instancia de FormatDates */ + private FormatDates() { + } + + /** + * Entrega una instancia de la clase. + * + * @return FormatDates + */ + public static FormatDates getInstance() { + synchronized (FormatDates.class) { + if (FormatDates.cache == null) { + FormatDates.cache = new FormatDates(); + } + } + return FormatDates.cache; + } + + /** + * Obtiene el Formateador para el Transporte de Fechas: formato yyyy-MM-dd + * + * @return SimpleDateFormat + */ + public SimpleDateFormat getTimeInSeconds() { + if (vTimeInseconds == null) { + vTimeInseconds = new SimpleDateFormat("ss.SSS"); + } + return vTimeInseconds; + } + + /** + * Obtiene el Formateador para el Transporte de Fechas: formato yyyy-MM-dd + * + * @return SimpleDateFormat + */ + public SimpleDateFormat getTransportDateFormat() { + if (vDate == null) { + vDate = new SimpleDateFormat("yyyy-MM-dd"); + } + return vDate; + } + + /** + * Obtiene el Formateador para el Transporte de Timestamp: formato yyyy-MM-dd HH:mm:ss + * + * @return SimpleDateFormat + */ + public SimpleDateFormat getTransportDatetimeFormat() { + if (vDateTime == null) { + vDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + } + return vDateTime; + + } + + /** + * Obtiene el formateador de Timestamps para su transaporte en String: formato yyyy-MM-dd HH:mm:ss.SSS + * + * @return SimpleDateFormat + */ + public SimpleDateFormat getTransportTimestampFormat() { + if (vTimestamp == null) { + vTimestamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); + } + return vTimestamp; + } + + /** + * Obtiene el formateador de Horas para su transaporte en String: formato HH:mm + * + * @return SimpleDateFormat + */ + public SimpleDateFormat getHourSecondsFormat() { + return new SimpleDateFormat("HH:mm"); + } + + /** + * Obtiene el formateador de Horas para su transaporte en String: formato HH:mm:ss + * + * @return SimpleDateFormat + */ + public SimpleDateFormat getTimeFormat() { + return new SimpleDateFormat("HH:mm:ss"); + } + + /** + * Obtiene el formateador de un conteo de tiempo en String + * + * @return SimpleDateFormat. + */ + public SimpleDateFormat getTimeCountFormat() { + if (vTime == null) { + vTime = new SimpleDateFormat("mm:ss.SSS"); + } + return vTime; + } + + /** + * Enterga el timestamp de la base de datos. + * + * @return Timestamp + * @throws CommonException + * @throws HibernateException + */ + public Timestamp getDataBaseTimestamp() throws HibernateException, CommondbException, Exception { + Timestamp timestamp = null; + String dialect = Constant.getDialect(PersistenceHelper.getEntityManager()); + String sql = "SELECT systimestamp as timestamp FROM dual "; + if (dialect.compareTo("org.hibernate.dialect.SybaseDialect") == 0) { + sql = "select getDate() as timestamp "; + } + if (dialect.compareTo("org.hibernate.dialect.InformixDialect") == 0) { + sql = "select current as timestamp from dual "; + } + + SQLQuery q = PersistenceHelper.getSession().createSQLQuery(sql); + + q.addScalar("timestamp", new org.hibernate.type.TimestampType()); + timestamp = (Timestamp) q.uniqueResult(); + GregorianCalendar gc = new GregorianCalendar(); + gc.setTimeInMillis(timestamp.getTime()); + if (gc.get(Calendar.MILLISECOND) == 0) { + GregorianCalendar gc1 = new GregorianCalendar(); + gc1.setTimeInMillis(System.currentTimeMillis()); + gc.set(Calendar.MILLISECOND, gc1.get(Calendar.MILLISECOND)); + timestamp = new Timestamp(gc.getTimeInMillis()); + } + return timestamp; + } + + /** + * Enterga el timestamp de la base de datos. + * + * @return Timestamp + * @throws CommonException + * @throws HibernateException + */ + public Timestamp getDataBaseTimestamp(EntityManager pEntityManager) throws HibernateException, CommondbException, Exception { + Timestamp timestamp = null; + String dialect = Constant.getDialect(pEntityManager); + String sql = "SELECT systimestamp as timestamp FROM dual "; + if (dialect.compareTo("org.hibernate.dialect.SybaseDialect") == 0) { + sql = "select getDate() as timestamp "; + } + if (dialect.compareTo("org.hibernate.dialect.InformixDialect") == 0) { + sql = "select current as timestamp from dual"; + } + SQLQuery q = ((Session) pEntityManager.getDelegate()).createSQLQuery(sql); + q.addScalar("timestamp", new org.hibernate.type.TimestampType()); + timestamp = (Timestamp) q.uniqueResult(); + return timestamp; + } + + /** + * Enterga el timestamp de la base de datos. + * + * @return Date + * @throws CommonException + * @throws HibernateException + */ + public Date getDataBaseDate() throws HibernateException, CommondbException { + Date timestamp = null; + SQLQuery q = PersistenceHelper.getSession().createSQLQuery("SELECT sysdate as timestamp FROM dual "); + q.addScalar("timestamp", new org.hibernate.type.DateType()); + timestamp = (Date) q.uniqueResult(); + return timestamp; + } + + /** + * Formatea una fecha para ser empleada como campo de particionamiento en una Tabla + * + * @param pDate Fecha de Referencia. + * @return String Fecha con el formato yyyyMM + * @throws Exception + */ + public static String getPartition(Date pDate) throws Exception { + return Constant.getPartition(pDate); + } + + /** + * Formatea una fecha para ser empleada como campo de particionamiento en una Tabla + * + * @param pDate Fecha de Referencia. + * @return String Fecha con el formato yyyyMM + * @throws Exception + */ + public static String getPartition(Timestamp pDate) throws Exception { + return Constant.getPartition(pDate); + } + + /** + * Entrega el la particion default de caducidad de registros. + * + * @return Particion con el formato yyyyMM + * @throws Exception + */ + public static String getDefaultPartition() throws Exception { + return "299912"; + } + + /** + * Devuelve la fecha hasta default de 2999-12-31 + * + * @return Fecha hasta 2999-12-31 + * @throws Exception + */ + public static Timestamp getDefaultExpiryTimestamp() throws Exception { + return Constant.getDefaultExpiryTimestamp(); + } + + /** + * Devuelve la fecha hasta default de 2999-12-31 + * + * @return Fecha hasta 2999-12-31 + * @throws Exception + */ + public static java.sql.Date getDefaultExpiryDate() throws Exception { + return Constant.getDefaultExpiryDate(); + } + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/.svn/text-base/Frequency.java.svn-base b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/.svn/text-base/Frequency.java.svn-base new file mode 100644 index 0000000..c2729a0 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/.svn/text-base/Frequency.java.svn-base @@ -0,0 +1,76 @@ +package com.fp.persistence.commondb.helper; + +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.Calendar; + +import com.fp.common.helper.CalculationBase; + +/** + * Enumeracion que almacena las distintas frecuencias de calculo de la aplicacion. + * @author Jorge Vaca. + * @version 2.1 + * + */ +public enum Frequency { + DAYLY(1,1), WEEKLY(2,7), BIWEEKLY(3,15), MONTHLY(4,-1), BIMONTHLY(5,-2), TRIMONTHLY(6,-3), + SEMESTRAL(7,-6), ANNUAL(8,-12); + + private int numDays; + private Integer code; + + /** + * Crea una nueva frecuencia. El valor negativo -1 indica 1 mes, -2 indica 2 meses... Etc. + * @param pCode Cdigo de frecuencia. + * @param pDays Das de la frecuencia. + */ + private Frequency(int pCode, int pDays) { + this.numDays = pDays; + this.code = pCode; + } + + /** + * Entrega el Valor de numDays. + * @return numDays. + */ + public int getNumDays(Date pDate,SimpleDateFormat sdf) throws Exception { + int data = numDays; + if (data < 0) { + data = data * -1; + APPDates d = new APPDates(pDate,CalculationBase.B365365,sdf); + d.addField(Calendar.MONTH, data); + APPDates a = new APPDates(pDate,CalculationBase.B365365,sdf); + data = d.substract(a); + } + return data; + } + + /** + * Entraga un objeto Frecuency dado el codigo de frecuencia. + * @param pCode Cdigo de frecuencia. + * @return Frequency + * @throws Exception + */ + public static Frequency getFrecuency(Integer pCode) throws Exception{ + Frequency [] bt = null; + bt = Frequency.values(); + Frequency btype = null; + for(Frequency obj : bt){ + if(obj.code.compareTo(pCode) == 0){ + btype = obj; + } + } + return btype; + } + + /** + * Entrega el valor de: code + * @return Integer + */ + public Integer getCode() { + return code; + } + + + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/.svn/text-base/MapUtil.java.svn-base b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/.svn/text-base/MapUtil.java.svn-base new file mode 100644 index 0000000..6244b11 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/.svn/text-base/MapUtil.java.svn-base @@ -0,0 +1,81 @@ +/* + * + */ +package com.fp.persistence.commondb.helper; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.exception.CommondbException; + +/** + * Class MapUtil encargada de maneja los resultados de un Query. + * + * @author gfiallos + */ +public final class MapUtil { + + /** El valor de instance. */ + private static MapUtil instance = null; + + /** + * Crea una nueva instancia de map util. + */ + private MapUtil() { + } + + /** + * Obtiene la única instancia de MapUtil. + * + * @return única instancia de MapUtil + */ + public static MapUtil getInstance() { + synchronized (MapUtil.class) { + if (MapUtil.instance == null) { + MapUtil.instance = new MapUtil(); + } + return MapUtil.instance; + } + } + + /** + * Convierte los datos de una lista de objectos a una lista de Maps + * + * @param pData data en Arreglo + * @param pNames Nombre de los key por campo + * @return list data convertida + * @throws CommondbException la commondb exception + */ + public List> arrayToMapList(List pData, String... pNames) throws CommondbException { + List> data = new ArrayList>(); + for (Object[] obj : pData) { + data.add(this.arrayToMap(obj, pNames)); + } + return data; + } + + /** + * TRansforma un arreglo de objetos a Map + * + * @param pData Data en arraglo + * @param pNames Nombre de los Keys + * @return map Resultado + * @throws CommondbException la commondb exception + */ + public Map arrayToMap(Object[] pData, String... pNames) throws CommondbException { + Map data = new HashMap(); + if ((pData == null) || (pNames == null) || (pData.length < pNames.length)) { + throw new CommondbException("COMMONDB-00021", "NUMERO DE ETIQUETAS ERRADO"); + } + for (int i = 0; i < pData.length; i++) { + if (i >= pNames.length) { + break; + } + data.put(pNames[i], pData[i]); + + } + return data; + } +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/APPDates.java b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/APPDates.java new file mode 100644 index 0000000..d4e2e33 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/APPDates.java @@ -0,0 +1,507 @@ +package com.fp.persistence.commondb.helper; + +import java.sql.Date; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.GregorianCalendar; + +import com.fp.common.helper.CalculationBase; +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.exception.CommondbException; + +/** + * Clase utilitaria para el manejo de fechas. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class APPDates implements Comparable { + + /* Fecha base para las Operaciones */ + private Date date; + + /* Base de Calculo */ + private CalculationBase base; + + /* Calendario Encargado de las operaciones con las Fechas */ + private final GregorianCalendar calendar; + + /* Formateador de Fechas para transporte */ + private final SimpleDateFormat formateador; + + /** + * Crea una nueva instancia de Dates + * + * @param pDate Fecha base + * @param pBase Base de Calculo; + */ + public APPDates(String pDate, CalculationBase pBase) throws Exception { + this(new Date(FormatDates.getInstance().getTransportDateFormat().parse(pDate).getTime()), pBase); + } + + /** + * Crea una nueva instancia de Dates + * + * @param pDate Fecha base como string formato yyyy-MM-dd + */ + public APPDates(String pDate) throws Exception { + this(pDate, CalculationBase.B360365); + } + + /** + * Crea una nueva instancia de Dates + * + * @param pDate Fecha base + * @param pBase Base de Calculo; + */ + public APPDates(Date pDate, CalculationBase pBase) throws Exception { + this.date = pDate; + this.base = pBase; + this.calendar = new GregorianCalendar(); + this.calendar.setTime(this.date); + this.formateador = FormatDates.getInstance().getTransportDateFormat(); + } + + /** + * Crea una nueva instancia de Dates + * + * @param pDate Fecha base + * @param pBase Base de Calculo; + */ + public APPDates(Date pDate, CalculationBase pBase, SimpleDateFormat sdf) throws Exception { + this.date = pDate; + this.base = pBase; + this.calendar = new GregorianCalendar(); + this.calendar.setTime(this.date); + this.formateador = sdf; + } + + /** + * Crea una nueva instancia de Dates con base 360/365 + * + * @param pDate Fecha base + */ + public APPDates(Date pDate) throws Exception { + this(pDate, CalculationBase.B360365); + } + + /** + * Entrega el Valor de date. + * + * @return Date + */ + public Date getDate() { + return this.date; + } + + /** + * Entrega el Valor de date. + * + * @return Timestamp + */ + public Timestamp getTimestamp() { + return new Timestamp(this.date.getTime()); + } + + /** + * Metodoq ue resta un mes a una fecha y le pone el ultimo dia del mes en la misma. + * + * @throws Exception + */ + public void substractOneMonth365() throws Exception { + this.calendar.add(Calendar.MONTH, -1); + int max1 = this.calendar.getActualMaximum(Calendar.DAY_OF_MONTH); + this.calendar.set(Calendar.DAY_OF_MONTH, max1); + this.date = new Date(this.calendar.getTimeInMillis()); + } + + /** + * Clase que se encarga de restar dos fechas, a la fecha mayor se resta una fecha menor. + * + * @param pInicialdate Feinicial a restar de una fecha final. + * @return int + * @throws Exception + */ + public int substract(APPDates pInicialdate) throws Exception { + int days = 0; + if (pInicialdate.getDate().after(this.date)) { + throw new CommondbException("COMMONDB-0001", "FECHA A RESTAR: {0,date,yyyy-MM-dd} ES MAYOR A: {1,date,yyyy-MM-dd}", + pInicialdate.getDate(), this.date); + } + if (pInicialdate.getDate().compareTo(this.date) == 0) { + return 0; + } + if (this.base.getMonthBase() == 365) { + days = this.substract365(pInicialdate); + } else { + days = this.substract360(pInicialdate); + } + return days; + } + + /** + * Metodo que resta fechas en base cuando la base es 365/xxx + * + * @param pInicialdate Fecha inicia a restar. + * @return int + * @throws Exception + */ + private int substract365(APPDates pInicialdate) throws Exception { + int days = 0; + GregorianCalendar cal1 = new GregorianCalendar(); + cal1.setTime(pInicialdate.getDate()); + do { + cal1.add(Calendar.DATE, 1); + days++; + } while (this.date.compareTo(cal1.getTime()) != 0); + return days; + } + + /** + * Metodo que se encarga de restar dos fehcas en base 360. + * + * @param pInicialdate + * @return + * @throws Exception + */ + private int substract360(APPDates pInicialdate) throws Exception { + int days = 0; + int nYears = this.getField(Calendar.YEAR) - pInicialdate.getField(Calendar.YEAR); + int nMonths = this.getField(Calendar.MONTH) - pInicialdate.getField(Calendar.MONTH); + int dayone = this.getField(Calendar.DAY_OF_MONTH); + if (dayone == 31) { + dayone = 30; + } + int daytwo = pInicialdate.getField(Calendar.DAY_OF_MONTH); + if (daytwo == 31) { + daytwo = 30; + } + int nMonth = this.getField(Calendar.MONTH); + if (nMonth == 1) { // 0 enero, 1 febrero , 2 marzo + // si el dia de la fecha es igual al maximo dia del mes + if (this.getField(Calendar.DAY_OF_MONTH) == this.calendar.getActualMaximum(Calendar.DAY_OF_MONTH)) { + int day = pInicialdate.getField(Calendar.DAY_OF_MONTH); + if ((day == 30) || (day == 31)) { + dayone = 30; + } + } + } + nMonth = pInicialdate.getField(Calendar.MONTH); + if (nMonth == 1) { // 0 enero, 1 febrero , 2 marzo + // si el dia de la fecha es igual al maximo dia del mes + if (pInicialdate.getField(Calendar.DAY_OF_MONTH) == pInicialdate.calendar.getActualMaximum(Calendar.DAY_OF_MONTH)) { + int day = this.getField(Calendar.DAY_OF_MONTH); + if ((day == 30) || (day == 31)) { + daytwo = 30; + } + } + } + nYears = nYears * 12 * 30; + nMonths = nMonths * 30; + days = dayone - daytwo; + days = nYears + nMonths + days; + /* v_dias_resultado := (coalesce(v_anios,0) * 12 * 30) + (coalesce(v_meses,0) * 30) + (coalesce(v_dia1,0) - coalesce(v_dia2,0)); */ + return days; + } + + /** + * Aniadir dias a una Fecha + * + * @param days Numero de dias a aniadir + */ + public void addYearBased(int days) throws Exception { + if (this.base.getYearBase() == 365) { + this.calendar.add(Calendar.DATE, days); + } else { + if (Math.abs(days) >= 30) { + int month = (int) Math.floor(days / 30); + this.calendar.add(Calendar.MONTH, month); + this.calendar.add(Calendar.DATE, days % 30); + } else { + this.calendar.add(Calendar.DATE, days); + } + } + this.date = new Date(this.calendar.getTime().getTime()); + } + + /** + * Aniadir dias a una Fecha, amteniendo un dia fijo en la fecha. + * + * @param days Numero de dias a adicionar. + * @param payDay Fecha de pago. + * @throws Exception + */ + public void addDaysBased(int days, Integer payDay) throws Exception { + if (this.base.getMonthBase() == 365) { + /* + * if( days == 31 || this.calendar.getActualMaximum(Calendar.DAY_OF_MONTH) >= days){ + * this.calendar.add(Calendar.MONTH,1); }else{ this.calendar.add(Calendar.DATE, days); } + */ + this.calendar.add(Calendar.DATE, days); + } else { + if (Math.abs(days) >= 30) { + int diff = 0; + if (this.calendar.get(Calendar.MONTH) == Calendar.FEBRUARY) { + if (this.calendar.get(Calendar.DATE) >= 28) { + if ((payDay != null) && (this.calendar.getActualMaximum(Calendar.DAY_OF_MONTH) < payDay)) { + // diff= (this.calendar.getActualMaximum(Calendar.DAY_OF_MONTH)==29)?1:2; + diff = payDay - this.calendar.getActualMaximum(Calendar.DAY_OF_MONTH); + } + } + } + int month = (int) Math.floor(days / 30); + this.calendar.add(Calendar.MONTH, month); + int d = days % 30; + this.calendar.add(Calendar.DATE, d); + if (diff > 0) { + this.calendar.add(Calendar.DATE, diff); + } + } else { + this.calendar.add(Calendar.DATE, days); + } + } + this.date = new Date(this.calendar.getTime().getTime()); + } + + /** + * Aniadir dias a una Fecha + * + * @param days Numero de dias a aniadir + */ + public void addMonthBased(int days) throws Exception { + if (this.base.getMonthBase() == 365) { + this.calendar.add(Calendar.DATE, days); + } else { + if (Math.abs(days) >= 30) { + int diff = 0; + if (this.calendar.get(Calendar.MONTH) == Calendar.FEBRUARY) { + if (this.calendar.get(Calendar.DATE) >= 28) { + diff = (this.calendar.getActualMaximum(Calendar.DAY_OF_MONTH) == 29) ? 1 : 2; + } + } + int month = (int) Math.floor(days / 30); + this.calendar.add(Calendar.MONTH, month); + this.calendar.add(Calendar.DATE, days % 30); + if (diff > 0) { + this.calendar.add(Calendar.DATE, diff); + } + } else { + this.calendar.add(Calendar.DATE, days); + } + } + this.date = new Date(this.calendar.getTime().getTime()); + } + + /** + * Entrega el Valor de base de calculo. + * + * @return CalculationBase. + */ + public CalculationBase getBase() { + return this.base; + } + + /** + * Fija el valor de base de calculo + * + * @param base Nuevo valor de base. + */ + public void setBase(CalculationBase base) { + this.base = base; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return this.formateador.format(this.date).toString(); + } + + public int getField(int pField) throws Exception { + return this.calendar.get(pField); + } + + /** + * Entrega el Valor de calendar. + * + * @return GregorianCalendar. + */ + public GregorianCalendar getGregorianCalendar() { + return this.calendar; + } + + public APPDates dateFrecuency(Frequency pFrecuency) throws Exception { + this.calendar.add(Calendar.DATE, pFrecuency.getNumDays(this.getDate(), this.formateador)); + return new APPDates(new Date(this.calendar.getTime().getTime())); + } + + public APPDates nextDateofSequence(Frequency pFrecuency, int pDay) throws Exception { + int days = pFrecuency.getNumDays(this.getDate(), this.formateador); + if (days > 31) { + // TODO Incluiy las frecuanias superiores a mensual + throw new CommondbException("COMMONDB-0002", "LA FRECUENCIA DEBE SER MENOR O IGUAL A MENSUAL"); + } + if (pDay > days) { + if ((pFrecuency == Frequency.MONTHLY) && (pDay == 31)) { + pDay = days; + } else { + throw new CommondbException("COMMONDB-0003", "El DIA {0} NO PUEDE MAYOR AL NUMEOR DE DIAS DE LA FRECUENCIA{1}", pDay, days); + } + } + GregorianCalendar cal = new GregorianCalendar(); + cal.setTime(this.date); + if (pFrecuency == Frequency.WEEKLY) { + while (cal.get(Calendar.DAY_OF_WEEK) != pDay) { + cal.add(Calendar.DAY_OF_WEEK, 1); + } + return new APPDates(new Date(cal.getTime().getTime())); + } + cal.set(Calendar.DATE, pDay); + APPLogger.getLogger().debug("Calendario base ==> " + cal.getTime()); + APPLogger.getLogger().debug("Maximo dia del mes ==> " + cal.getActualMaximum(Calendar.DAY_OF_MONTH)); + while (cal.getTime().before(this.date)) { + cal.add(Calendar.DATE, days); + } + while ((cal.get(Calendar.MONTH) != this.getField(Calendar.MONTH)) && (pDay != cal.get(Calendar.DATE))) { + cal.add(Calendar.DATE, -1); + } + if ((cal.get(Calendar.DATE) == 30) && (cal.getActualMaximum(Calendar.DAY_OF_MONTH) == 31)) { + cal.add(Calendar.DATE, 1); + } + return new APPDates(new Date(cal.getTime().getTime())); + } + + public int getJulianDate() throws Exception { + GregorianCalendar c = new GregorianCalendar(); + c.setTime(this.date); + return this.toJulian(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DATE)); + } + + private int toJulian(int year, int month, int day) throws Exception { + int julianYear = year; + if (year < 0) { + julianYear++; + } + int julianMonth = month; + if (month > 2) { + julianMonth++; + } else { + julianYear--; + julianMonth += 13; + } + + double julian = (java.lang.Math.floor(365.25 * julianYear) + java.lang.Math.floor(30.6001 * julianMonth) + day + 1720995.0); + + if ((day + (31 * (month + (12 * year)))) >= JGREG) { + int ja = (int) (0.01 * julianYear); + julian += (2 - ja) + (0.25 * ja); + } + return (int) Math.floor(julian); + } + + public static final int JGREG = 15 + (31 * (10 + (12 * 1582))); + + /** + * Adiciona anios, meses, dias, semanas ..Etc a una fecha. + * + * @param field Constante de anio, mes, dia...Etc + * @param value Numero de anios, dias, meses a adicionar puese der un valor negativo. + * @throws Exception + */ + public void addField(int field, int value) throws Exception { + getGregorianCalendar().add(field, value); + this.date = new Date(getGregorianCalendar().getTimeInMillis()); + } + + /** + * Adiciona anios, meses, dias, semanas ..Etc a una fecha. + * + * @param field Constante de anio, mes, dia...Etc + * @param value Numero de anios, dias, meses a adicionar puese der un valor negativo. + * @throws Exception + */ + public void setField(int field, int value) throws Exception { + if (field == Calendar.DAY_OF_MONTH) { + int maxday = getGregorianCalendar().getActualMaximum(Calendar.DAY_OF_MONTH); + if (value > maxday) { + value = maxday; + } + } + getGregorianCalendar().set(field, value); + this.date = new Date(getGregorianCalendar().getTimeInMillis()); + } + + /** + * Compara dos Dates. + * + * @param o + * @return + */ + @Override + public int compareTo(Object o) { + if (!(o instanceof APPDates)) { + return -1; + } + APPDates d = (APPDates) o; + return this.date.compareTo(d.date); + } + + /** + * Entrega el dia del anio al correspondiente a la Fecha + * + * @return Dia del Anio + * @throws Exception + */ + public int getDayOfYear() throws Exception { + GregorianCalendar gcal = new GregorianCalendar(); + gcal.setTime(this.date); + return gcal.get(Calendar.DAY_OF_YEAR); + } + + /** + * Entrega lso dias del mes correspondiente a la fecha. + * + * @return int + * @throws Exception + */ + public int getDaysOfMonth() throws Exception { + if (this.base.getMonthBase() == 360) { + return 30; + } + GregorianCalendar gcal = new GregorianCalendar(); + gcal.setTime(this.date); + return gcal.getActualMaximum(Calendar.DAY_OF_MONTH); + } + + /** + * Fija el ultimo dia del mes corespondiente a la fecha. + * + * @return + * @throws Exception + */ + public void setLastDateOfMonth() throws Exception { + Calendar gcal = new GregorianCalendar(); + gcal.setTime(this.date); + gcal.set(Calendar.DAY_OF_MONTH, this.getDaysOfMonth()); + this.date = new Date(gcal.getTimeInMillis()); + } + + /** + * Entrega el mes del ao correspondiente a la Fecha + * + * @return mes del ao + * @throws Exception + */ + public String getMonthOfYear() throws Exception { + int month = this.getField(Calendar.MONTH) + 1; + if (month < 10) { + return "0" + month; + } else { + return "" + month; + } + } +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/Fkconstraint.java b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/Fkconstraint.java new file mode 100644 index 0000000..830f795 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/Fkconstraint.java @@ -0,0 +1,53 @@ +package com.fp.persistence.commondb.helper; + +import javax.persistence.Query; + +import com.fp.common.helper.FkException; +import com.fp.persistence.commondb.PersistenceHelper; + +/** + * Clase que entrega la tabla padre y dependiente dado un foreing key. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class Fkconstraint implements FkException { + + @Override + public String[] getFkData(String pFk) { + try { + String parent = this.getParentTable(pFk); + String child = this.getChildTable(pFk); + String[] data = new String[2]; + data[0] = parent; + data[1] = child; + return data; + } catch (Exception e) { + // No tomar accion. + } + return null; + } + + private String getParentTable(String pFk) throws Exception { + String table = null; + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(Fkconstraint.SQL); + qry.setParameter("fk", pFk); + table = (String) qry.getSingleResult(); + return table; + } + + private String getChildTable(String pFk) throws Exception { + String table = null; + // SQLQuery qry = pSession.createSQLQuery(Fkconstraint.SQL_DEP); + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(Fkconstraint.SQL_DEP); + qry.setParameter("fk", pFk); + table = (String) qry.getSingleResult(); + return table; + } + + private static final String SQL = "select table_name from user_constraints where constraint_name = ( " + + "select unique r_constraint_name from all_constraints where constraint_name = :fk)"; + + private static final String SQL_DEP = "select table_name from user_constraints where constraint_name = :fk"; + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/FormatDates.java b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/FormatDates.java new file mode 100644 index 0000000..bce66e4 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/FormatDates.java @@ -0,0 +1,260 @@ +package com.fp.persistence.commondb.helper; + +import java.sql.Date; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.GregorianCalendar; + +import javax.persistence.EntityManager; + +import org.hibernate.HibernateException; +import org.hibernate.SQLQuery; +import org.hibernate.Session; + +import com.fp.common.exception.CommonException; +import com.fp.common.helper.Constant; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.exception.CommondbException; + +public final class FormatDates { + + /** Intancia Singleton */ + private static FormatDates cache = null; + + /** Almacena el formato yyyy-MM-dd HH:mm:ss */ + private SimpleDateFormat vDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + /** Almacena el formato yyyy-MM-dd */ + private SimpleDateFormat vDate = new SimpleDateFormat("yyyy-MM-dd");; + + /** Almacena el formato yyyy-MM-dd HH:mm:ss.SSS */ + private SimpleDateFormat vTimestamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); + + /** Almacena el formato HH:mm:ss */ + private SimpleDateFormat vTime = new SimpleDateFormat("mm:ss.SSS"); + + /** Almacena el formato HH:mm:ss */ + private SimpleDateFormat vTimeInseconds = new SimpleDateFormat("ss.SSS"); + + /* Crea una Instancia de FormatDates */ + private FormatDates() { + } + + /** + * Entrega una instancia de la clase. + * + * @return FormatDates + */ + public static FormatDates getInstance() { + synchronized (FormatDates.class) { + if (FormatDates.cache == null) { + FormatDates.cache = new FormatDates(); + } + } + return FormatDates.cache; + } + + /** + * Obtiene el Formateador para el Transporte de Fechas: formato yyyy-MM-dd + * + * @return SimpleDateFormat + */ + public SimpleDateFormat getTimeInSeconds() { + if (vTimeInseconds == null) { + vTimeInseconds = new SimpleDateFormat("ss.SSS"); + } + return vTimeInseconds; + } + + /** + * Obtiene el Formateador para el Transporte de Fechas: formato yyyy-MM-dd + * + * @return SimpleDateFormat + */ + public SimpleDateFormat getTransportDateFormat() { + if (vDate == null) { + vDate = new SimpleDateFormat("yyyy-MM-dd"); + } + return vDate; + } + + /** + * Obtiene el Formateador para el Transporte de Timestamp: formato yyyy-MM-dd HH:mm:ss + * + * @return SimpleDateFormat + */ + public SimpleDateFormat getTransportDatetimeFormat() { + if (vDateTime == null) { + vDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + } + return vDateTime; + + } + + /** + * Obtiene el formateador de Timestamps para su transaporte en String: formato yyyy-MM-dd HH:mm:ss.SSS + * + * @return SimpleDateFormat + */ + public SimpleDateFormat getTransportTimestampFormat() { + if (vTimestamp == null) { + vTimestamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); + } + return vTimestamp; + } + + /** + * Obtiene el formateador de Horas para su transaporte en String: formato HH:mm + * + * @return SimpleDateFormat + */ + public SimpleDateFormat getHourSecondsFormat() { + return new SimpleDateFormat("HH:mm"); + } + + /** + * Obtiene el formateador de Horas para su transaporte en String: formato HH:mm:ss + * + * @return SimpleDateFormat + */ + public SimpleDateFormat getTimeFormat() { + return new SimpleDateFormat("HH:mm:ss"); + } + + /** + * Obtiene el formateador de un conteo de tiempo en String + * + * @return SimpleDateFormat. + */ + public SimpleDateFormat getTimeCountFormat() { + if (vTime == null) { + vTime = new SimpleDateFormat("mm:ss.SSS"); + } + return vTime; + } + + /** + * Enterga el timestamp de la base de datos. + * + * @return Timestamp + * @throws CommonException + * @throws HibernateException + */ + public Timestamp getDataBaseTimestamp() throws HibernateException, CommondbException, Exception { + Timestamp timestamp = null; + String dialect = Constant.getDialect(PersistenceHelper.getEntityManager()); + String sql = "select CURRENT_TIMESTAMP as timestamp";//ANTES ORACLE: "SELECT systimestamp as timestamp FROM dual "; + if (dialect.compareTo("org.hibernate.dialect.SybaseDialect") == 0) { + sql = "select CURRENT_TIMESTAMP as timestamp";//ANTES ORACLE: "select getDate() as timestamp "; + } + if (dialect.compareTo("org.hibernate.dialect.InformixDialect") == 0) { + sql = "select CURRENT_TIMESTAMP as timestamp"; + } + + SQLQuery q = PersistenceHelper.getSession().createSQLQuery(sql); + + q.addScalar("timestamp", new org.hibernate.type.TimestampType()); + timestamp = (Timestamp) q.uniqueResult(); + GregorianCalendar gc = new GregorianCalendar(); + gc.setTimeInMillis(timestamp.getTime()); + if (gc.get(Calendar.MILLISECOND) == 0) { + GregorianCalendar gc1 = new GregorianCalendar(); + gc1.setTimeInMillis(System.currentTimeMillis()); + gc.set(Calendar.MILLISECOND, gc1.get(Calendar.MILLISECOND)); + timestamp = new Timestamp(gc.getTimeInMillis()); + } + return timestamp; + } + + /** + * Enterga el timestamp de la base de datos. + * + * @return Timestamp + * @throws CommonException + * @throws HibernateException + */ + public Timestamp getDataBaseTimestamp(EntityManager pEntityManager) throws HibernateException, CommondbException, Exception { + Timestamp timestamp = null; + String dialect = Constant.getDialect(pEntityManager); + String sql = "select CURRENT_TIMESTAMP as timestamp";//ANTES ORACLE: "SELECT systimestamp as timestamp FROM dual "; + if (dialect.compareTo("org.hibernate.dialect.SybaseDialect") == 0) { + sql = "select CURRENT_TIMESTAMP as timestamp ";//ANTES ORACLE: "select getDate() as timestamp "; + } + if (dialect.compareTo("org.hibernate.dialect.InformixDialect") == 0) { + sql = "select CURRENT_TIMESTAMP as timestamp"; + } + SQLQuery q = ((Session) pEntityManager.getDelegate()).createSQLQuery(sql); + q.addScalar("timestamp", new org.hibernate.type.TimestampType()); + timestamp = (Timestamp) q.uniqueResult(); + return timestamp; + } + + /** + * Enterga el timestamp de la base de datos. + * + * @return Date + * @throws CommonException + * @throws HibernateException + */ + public Date getDataBaseDate() throws HibernateException, CommondbException { + Date timestamp = null;// + SQLQuery q = PersistenceHelper.getSession().createSQLQuery("select localtimestamp as timestamp"); /**antes con oracle: SELECT sysdate as timestamp FROM dual*/ + q.addScalar("timestamp", new org.hibernate.type.DateType()); + timestamp = (Date) q.uniqueResult(); + return timestamp; + } + + /** + * Formatea una fecha para ser empleada como campo de particionamiento en una Tabla + * + * @param pDate Fecha de Referencia. + * @return String Fecha con el formato yyyyMM + * @throws Exception + */ + public static String getPartition(Date pDate) throws Exception { + return Constant.getPartition(pDate); + } + + /** + * Formatea una fecha para ser empleada como campo de particionamiento en una Tabla + * + * @param pDate Fecha de Referencia. + * @return String Fecha con el formato yyyyMM + * @throws Exception + */ + public static String getPartition(Timestamp pDate) throws Exception { + return Constant.getPartition(pDate); + } + + /** + * Entrega el la particion default de caducidad de registros. + * + * @return Particion con el formato yyyyMM + * @throws Exception + */ + public static String getDefaultPartition() throws Exception { + return "299912"; + } + + /** + * Devuelve la fecha hasta default de 2999-12-31 + * + * @return Fecha hasta 2999-12-31 + * @throws Exception + */ + public static Timestamp getDefaultExpiryTimestamp() throws Exception { + return Constant.getDefaultExpiryTimestamp(); + } + + /** + * Devuelve la fecha hasta default de 2999-12-31 + * + * @return Fecha hasta 2999-12-31 + * @throws Exception + */ + public static java.sql.Date getDefaultExpiryDate() throws Exception { + return Constant.getDefaultExpiryDate(); + } + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/Frequency.java b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/Frequency.java new file mode 100644 index 0000000..c2729a0 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/Frequency.java @@ -0,0 +1,76 @@ +package com.fp.persistence.commondb.helper; + +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.Calendar; + +import com.fp.common.helper.CalculationBase; + +/** + * Enumeracion que almacena las distintas frecuencias de calculo de la aplicacion. + * @author Jorge Vaca. + * @version 2.1 + * + */ +public enum Frequency { + DAYLY(1,1), WEEKLY(2,7), BIWEEKLY(3,15), MONTHLY(4,-1), BIMONTHLY(5,-2), TRIMONTHLY(6,-3), + SEMESTRAL(7,-6), ANNUAL(8,-12); + + private int numDays; + private Integer code; + + /** + * Crea una nueva frecuencia. El valor negativo -1 indica 1 mes, -2 indica 2 meses... Etc. + * @param pCode Cdigo de frecuencia. + * @param pDays Das de la frecuencia. + */ + private Frequency(int pCode, int pDays) { + this.numDays = pDays; + this.code = pCode; + } + + /** + * Entrega el Valor de numDays. + * @return numDays. + */ + public int getNumDays(Date pDate,SimpleDateFormat sdf) throws Exception { + int data = numDays; + if (data < 0) { + data = data * -1; + APPDates d = new APPDates(pDate,CalculationBase.B365365,sdf); + d.addField(Calendar.MONTH, data); + APPDates a = new APPDates(pDate,CalculationBase.B365365,sdf); + data = d.substract(a); + } + return data; + } + + /** + * Entraga un objeto Frecuency dado el codigo de frecuencia. + * @param pCode Cdigo de frecuencia. + * @return Frequency + * @throws Exception + */ + public static Frequency getFrecuency(Integer pCode) throws Exception{ + Frequency [] bt = null; + bt = Frequency.values(); + Frequency btype = null; + for(Frequency obj : bt){ + if(obj.code.compareTo(pCode) == 0){ + btype = obj; + } + } + return btype; + } + + /** + * Entrega el valor de: code + * @return Integer + */ + public Integer getCode() { + return code; + } + + + +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/MapUtil.java b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/MapUtil.java new file mode 100644 index 0000000..6244b11 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/MapUtil.java @@ -0,0 +1,81 @@ +/* + * + */ +package com.fp.persistence.commondb.helper; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fp.persistence.commondb.exception.CommondbException; + +/** + * Class MapUtil encargada de maneja los resultados de un Query. + * + * @author gfiallos + */ +public final class MapUtil { + + /** El valor de instance. */ + private static MapUtil instance = null; + + /** + * Crea una nueva instancia de map util. + */ + private MapUtil() { + } + + /** + * Obtiene la única instancia de MapUtil. + * + * @return única instancia de MapUtil + */ + public static MapUtil getInstance() { + synchronized (MapUtil.class) { + if (MapUtil.instance == null) { + MapUtil.instance = new MapUtil(); + } + return MapUtil.instance; + } + } + + /** + * Convierte los datos de una lista de objectos a una lista de Maps + * + * @param pData data en Arreglo + * @param pNames Nombre de los key por campo + * @return list data convertida + * @throws CommondbException la commondb exception + */ + public List> arrayToMapList(List pData, String... pNames) throws CommondbException { + List> data = new ArrayList>(); + for (Object[] obj : pData) { + data.add(this.arrayToMap(obj, pNames)); + } + return data; + } + + /** + * TRansforma un arreglo de objetos a Map + * + * @param pData Data en arraglo + * @param pNames Nombre de los Keys + * @return map Resultado + * @throws CommondbException la commondb exception + */ + public Map arrayToMap(Object[] pData, String... pNames) throws CommondbException { + Map data = new HashMap(); + if ((pData == null) || (pNames == null) || (pData.length < pNames.length)) { + throw new CommondbException("COMMONDB-00021", "NUMERO DE ETIQUETAS ERRADO"); + } + for (int i = 0; i < pData.length; i++) { + if (i >= pNames.length) { + break; + } + data.put(pNames[i], pData[i]); + + } + return data; + } +} diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/sequence/.svn/entries b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/sequence/.svn/entries new file mode 100644 index 0000000..6c2b950 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/sequence/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/helper/sequence +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/log/.svn/entries b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/log/.svn/entries new file mode 100644 index 0000000..059dc07 --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/log/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/log +svn://172.17.26.185/COMACO + + + +2015-01-16T05:34:18.740661Z +3756 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +Audit.java +file + + + + +2022-07-28T03:40:31.809756Z +298e7779ea7357ad17171ea1d0954759 +2015-01-16T05:34:18.740661Z +3756 +cpiedra + + + + + + + + + + + + + + + + + + + + + +11392 + diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/log/.svn/text-base/Audit.java.netbeans-base b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/log/.svn/text-base/Audit.java.netbeans-base new file mode 100644 index 0000000..5b1d2bd --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/log/.svn/text-base/Audit.java.netbeans-base @@ -0,0 +1,289 @@ +package com.fp.persistence.commondb.log; + +import java.lang.reflect.Field; +import java.sql.Date; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.Map; + +import com.fp.common.helper.BeanManager; +import com.fp.common.logger.APPLogger; +import com.fp.dto.data.SaveData; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranchKey; +import com.fp.persistence.pgeneral.safe.TsafeAudit; +import com.fp.persistence.pgeneral.safe.TsafeAuditInsDel; +import com.fp.persistence.pgeneral.safe.TsafeAuditInsDelKey; +import com.fp.persistence.pgeneral.safe.TsafeAuditKey; +import com.fp.persistence.pgeneral.safe.TsafeUser; + +/** + * Clase que se encarga del menejo de auditoria de de cambios en tablas. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class Audit { + + /** + * Metodo que obtiene lista de campos del registro, y procesa por campo , si el valor cambio se genera un registro + * de auditoria. + * + * @param newBean Datos del registro nuevo. + * @param oldBean Datos del registro anterior. + * @throws Exception + */ + public static void process(HibernateBean newBean, HibernateBean oldBean) throws Exception { + Field f[] = newBean.getClass().getDeclaredFields(); + Timestamp t = null; + for (Field obj : f) { + if (obj.getName().compareTo("pk") == 0 || obj.getName().compareTo("hashValue") == 0 + || obj.getName().compareTo("class") == 0 || obj.getName().compareTo("serialVersionUID") == 0) { + continue; + } + if (t == null) { + t = FormatDates.getInstance().getDataBaseTimestamp(); + } + Audit.processByField(obj, newBean, oldBean, t); + } + } + + /** + * Metodo que verifica si los datos del campo son diferente de los valores del registro anterior. + * + * @param f Nombre del campo. + * @param newBean Datos del nuevo registro. + * @param oldBean Datos del registro anterior. + * @throws Exception + */ + @SuppressWarnings({"unchecked", "rawtypes"}) + private static void processByField(Field f, HibernateBean newBean, HibernateBean oldBean, Timestamp t) throws Exception { + Object newvalue; + try { + newvalue = BeanManager.getBeanAttributeValue(newBean, f.getName()); + } catch (NoSuchMethodException e) { + return; + } + Object oldvalue; + try { + oldvalue = BeanManager.getBeanAttributeValue(oldBean, f.getName()); + } catch (Exception e) { + return; + } + if (newvalue == null && oldvalue == null) { + return; + } + if ((newvalue == null && oldvalue != null) || (newvalue != null && oldvalue == null)) { + saveLog(newBean.getClass().getSimpleName(), f, newvalue, oldvalue, t); + return; + } + if (newvalue instanceof Comparable) { + if (((Comparable) newvalue).compareTo(oldvalue) != 0) { + saveLog(newBean.getClass().getSimpleName(), f, newvalue, oldvalue, t); + } + } + } + + /** + * Crea e inserta un rgistro en la tabla de auditoria TsafeAudit. + * + * @param beanName Nombre del bean. + * @param f Nombre del campo de la base. + * @param newvalue Nuevo valor. + * @param oldvalue Valor anterior. + * @throws Exception + */ + private static void saveLog(String beanName, Field f, Object newvalue, Object oldvalue, Timestamp t) throws Exception { + SaveRequest sr = SaveData.getSaveRequest(); + //Crea un objeto con los datos a almacenar auditoria. + TsafeAuditKey key = new TsafeAuditKey(); + //TgeneAccountingDateBranchKey dkey = new TgeneAccountingDateBranchKey(0, sr.getCompany()); + //TgeneAccountingDateBranch d = TgeneAccountingDateBranch.find(PersistenceHelper.getEntityManager(), dkey); + Date fecha = new Date(t.getTime()); + key.setChangedate(fecha);//d.getAccountingdate() + key.setTablename(beanName.toUpperCase()); + key.setColumnname(f.getName().toUpperCase()); + key.setPartitiondb(FormatDates.getPartition(key.getChangedate())); + key.setRealdate(t); + TsafeAudit obj = new TsafeAudit(); + obj.setPk(key); + obj.setCompanycode(sr.getCompany()); + obj.setOfficecode(sr.getOfficeCode()); + obj.setBranchcode(sr.getBranchCode()); + obj.setTerminalcode(sr.getTerminalCode()); + obj.setUsercode(sr.getUser()); + obj.setTransactionmodule(sr.getTransactionModule()); + obj.setTransactioncode(sr.getTransactionCode()); + obj.setTransactionversion(sr.getTransactionVersion()); + obj.setBrowser(sr.getBrowser()); + obj.setOperativesystem(sr.getOperativesystem()); + if (oldvalue != null) { + obj.setOldvalue(oldvalue.toString()); + } + if (newvalue != null) { + obj.setNewvalue(newvalue.toString()); + } + if(sr.getUser()!=null){ + TsafeUser user= TsafeUser.find(PersistenceHelper.getEntityManager(), sr.getUser()); + if(user!=null){ + obj.setPersoncode(user.getPersoncode()); + } + } + setAdicionalData(obj); + //Almacena el registro en la base. + PersistenceHelper.save(obj); + } + + /** + * Metodo que registra en el log de auditoria los registros nuevos de una tabla. + * + * @param pBean Datos del registro nuevo. + * @throws Exception + */ + public static void insert(HibernateBean pBean) throws Exception { + insertdelete(pBean, true); + } + + /** + * Metodo que registra en el log de auditoria los registros nuevos de una tabla. + * + * @param pBean Datos del registro nuevo. + * @throws Exception + */ + public static void delete(HibernateBean pBean) throws Exception { + insertdelete(pBean, false); + } + + /** + * Metodo que registra en el log de auditoria los registros nuevos de una tabla. + * + * @param pBean Datos del registro nuevo. + * @throws Exception + */ + private static void insertdelete(HibernateBean pBean, boolean insert) throws Exception { + Field f[] = pBean.getClass().getDeclaredFields(); + Map m = new HashMap(); + for (Field obj : f) { + if (obj.getName().compareTo("hashValue") == 0 + || obj.getName().compareTo("class") == 0 || obj.getName().compareTo("serialVersionUID") == 0) { + continue; + } + String value = getBeanValue(pBean, obj.getName()); + m.put(obj.getName(), value); + } + if (!m.isEmpty()) { + saveLogInsertDelete(pBean.getClass().getSimpleName(), m, insert); + } + } + + /** + * Entrega el valor de un campo. + * + * @param pBean bean a obtener el valor de un campo. + * @param pField Nombre del campo a obtener el valor. + * @return String. + * @throws Exception + */ + private static String getBeanValue(HibernateBean pBean, String pField) throws Exception { + String newvalue; + try { + newvalue = BeanManager.getBeanAttributeValue(pBean, pField).toString(); + if (newvalue.contains("from")) { + //Para que no envie sentecias JPL que estan en el bean. + return null; + } + } catch (Exception e) { + return null; + } + return newvalue; + } + + /** + * Crea un registro en la base con datos de insert o update de un registro. + * + * @param beanName Nombre de la tabla. + * @param m Map con los campos de la tabla. + * @param insert true indica que inserta un registro, false indica que se elimian un registro de la base. + * @throws Exception + */ + private static void saveLogInsertDelete(String beanName, Map m, boolean insert) throws Exception { + Timestamp t = FormatDates.getInstance().getDataBaseTimestamp(); + SaveRequest sr = SaveData.getSaveRequest(); + if (sr == null) { + return; + } + //Crea un objeto con los datos a almacenar auditoria. + TsafeAuditInsDelKey key = new TsafeAuditInsDelKey(); + //TgeneAccountingDateBranchKey dkey = new TgeneAccountingDateBranchKey(0, sr.getCompany()); + //TgeneAccountingDateBranch d = TgeneAccountingDateBranch.find(PersistenceHelper.getEntityManager(), dkey); + Date fecha = new Date(t.getTime()); + key.setChangedate(fecha); + key.setTablename(beanName.toUpperCase()); + key.setPartitiondb(FormatDates.getPartition(key.getChangedate())); + key.setRealdate(t); + TsafeAuditInsDel obj = new TsafeAuditInsDel(); + obj.setPk(key); + obj.setCompanycode(sr.getCompany()); + obj.setOfficecode(sr.getOfficeCode()); + obj.setBranchcode(sr.getBranchCode()); + obj.setTerminalcode(sr.getTerminalCode()); + obj.setUsercode(sr.getUser()); + obj.setTransactionmodule(sr.getTransactionModule()); + obj.setTransactioncode(sr.getTransactionCode()); + obj.setTransactionversion(sr.getTransactionVersion()); + obj.setBrowser(sr.getBrowser()); + obj.setOperativesystem(sr.getOperativesystem()); + if (insert) { + obj.setIsinsert("Y"); + obj.setIsdelete("N"); + } else { + obj.setIsinsert("N"); + obj.setIsdelete("Y"); + } + obj.setRecvalue(m.toString()); + setAdicionalData(obj); + + if(sr.getUser()!=null){ + TsafeUser user= TsafeUser.find(PersistenceHelper.getEntityManager(), sr.getUser()); + if(user!=null){ + obj.setPersoncode(user.getPersoncode()); + } + } + + //Almacena el registro en la base. + PersistenceHelper.save(obj); + } +/** + * + * @param obj + * @throws Exception + */ + private static void setAdicionalData(HibernateBean obj) throws Exception { + try{ + try { + BeanManager.setBeanAttributeValue(obj, "account", SaveData.getAccount().substring(0, 19)); + } catch (Exception e) { + //NO hacer nada, + APPLogger.getLogger().debug(e.getStackTrace()[0]); + } + try { + BeanManager.setBeanAttributeValue(obj, "personcode", SaveData.getPersoncode() == null ? null : Integer.valueOf(SaveData.getPersoncode())); + } catch (Exception e) { + //NO hacer nada, + APPLogger.getLogger().debug(e.getStackTrace()[0]); + } + try { + BeanManager.setBeanAttributeValue(obj, "solicitudenumber", SaveData.getSolicitudenumber().substring(0, 19)); + } catch (Exception e) { + //NO hacer nada, + APPLogger.getLogger().debug(e.getStackTrace()[0]); + } + } catch(Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + } +} \ No newline at end of file diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/log/.svn/text-base/Audit.java.svn-base b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/log/.svn/text-base/Audit.java.svn-base new file mode 100644 index 0000000..5b1d2bd --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/log/.svn/text-base/Audit.java.svn-base @@ -0,0 +1,289 @@ +package com.fp.persistence.commondb.log; + +import java.lang.reflect.Field; +import java.sql.Date; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.Map; + +import com.fp.common.helper.BeanManager; +import com.fp.common.logger.APPLogger; +import com.fp.dto.data.SaveData; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranchKey; +import com.fp.persistence.pgeneral.safe.TsafeAudit; +import com.fp.persistence.pgeneral.safe.TsafeAuditInsDel; +import com.fp.persistence.pgeneral.safe.TsafeAuditInsDelKey; +import com.fp.persistence.pgeneral.safe.TsafeAuditKey; +import com.fp.persistence.pgeneral.safe.TsafeUser; + +/** + * Clase que se encarga del menejo de auditoria de de cambios en tablas. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class Audit { + + /** + * Metodo que obtiene lista de campos del registro, y procesa por campo , si el valor cambio se genera un registro + * de auditoria. + * + * @param newBean Datos del registro nuevo. + * @param oldBean Datos del registro anterior. + * @throws Exception + */ + public static void process(HibernateBean newBean, HibernateBean oldBean) throws Exception { + Field f[] = newBean.getClass().getDeclaredFields(); + Timestamp t = null; + for (Field obj : f) { + if (obj.getName().compareTo("pk") == 0 || obj.getName().compareTo("hashValue") == 0 + || obj.getName().compareTo("class") == 0 || obj.getName().compareTo("serialVersionUID") == 0) { + continue; + } + if (t == null) { + t = FormatDates.getInstance().getDataBaseTimestamp(); + } + Audit.processByField(obj, newBean, oldBean, t); + } + } + + /** + * Metodo que verifica si los datos del campo son diferente de los valores del registro anterior. + * + * @param f Nombre del campo. + * @param newBean Datos del nuevo registro. + * @param oldBean Datos del registro anterior. + * @throws Exception + */ + @SuppressWarnings({"unchecked", "rawtypes"}) + private static void processByField(Field f, HibernateBean newBean, HibernateBean oldBean, Timestamp t) throws Exception { + Object newvalue; + try { + newvalue = BeanManager.getBeanAttributeValue(newBean, f.getName()); + } catch (NoSuchMethodException e) { + return; + } + Object oldvalue; + try { + oldvalue = BeanManager.getBeanAttributeValue(oldBean, f.getName()); + } catch (Exception e) { + return; + } + if (newvalue == null && oldvalue == null) { + return; + } + if ((newvalue == null && oldvalue != null) || (newvalue != null && oldvalue == null)) { + saveLog(newBean.getClass().getSimpleName(), f, newvalue, oldvalue, t); + return; + } + if (newvalue instanceof Comparable) { + if (((Comparable) newvalue).compareTo(oldvalue) != 0) { + saveLog(newBean.getClass().getSimpleName(), f, newvalue, oldvalue, t); + } + } + } + + /** + * Crea e inserta un rgistro en la tabla de auditoria TsafeAudit. + * + * @param beanName Nombre del bean. + * @param f Nombre del campo de la base. + * @param newvalue Nuevo valor. + * @param oldvalue Valor anterior. + * @throws Exception + */ + private static void saveLog(String beanName, Field f, Object newvalue, Object oldvalue, Timestamp t) throws Exception { + SaveRequest sr = SaveData.getSaveRequest(); + //Crea un objeto con los datos a almacenar auditoria. + TsafeAuditKey key = new TsafeAuditKey(); + //TgeneAccountingDateBranchKey dkey = new TgeneAccountingDateBranchKey(0, sr.getCompany()); + //TgeneAccountingDateBranch d = TgeneAccountingDateBranch.find(PersistenceHelper.getEntityManager(), dkey); + Date fecha = new Date(t.getTime()); + key.setChangedate(fecha);//d.getAccountingdate() + key.setTablename(beanName.toUpperCase()); + key.setColumnname(f.getName().toUpperCase()); + key.setPartitiondb(FormatDates.getPartition(key.getChangedate())); + key.setRealdate(t); + TsafeAudit obj = new TsafeAudit(); + obj.setPk(key); + obj.setCompanycode(sr.getCompany()); + obj.setOfficecode(sr.getOfficeCode()); + obj.setBranchcode(sr.getBranchCode()); + obj.setTerminalcode(sr.getTerminalCode()); + obj.setUsercode(sr.getUser()); + obj.setTransactionmodule(sr.getTransactionModule()); + obj.setTransactioncode(sr.getTransactionCode()); + obj.setTransactionversion(sr.getTransactionVersion()); + obj.setBrowser(sr.getBrowser()); + obj.setOperativesystem(sr.getOperativesystem()); + if (oldvalue != null) { + obj.setOldvalue(oldvalue.toString()); + } + if (newvalue != null) { + obj.setNewvalue(newvalue.toString()); + } + if(sr.getUser()!=null){ + TsafeUser user= TsafeUser.find(PersistenceHelper.getEntityManager(), sr.getUser()); + if(user!=null){ + obj.setPersoncode(user.getPersoncode()); + } + } + setAdicionalData(obj); + //Almacena el registro en la base. + PersistenceHelper.save(obj); + } + + /** + * Metodo que registra en el log de auditoria los registros nuevos de una tabla. + * + * @param pBean Datos del registro nuevo. + * @throws Exception + */ + public static void insert(HibernateBean pBean) throws Exception { + insertdelete(pBean, true); + } + + /** + * Metodo que registra en el log de auditoria los registros nuevos de una tabla. + * + * @param pBean Datos del registro nuevo. + * @throws Exception + */ + public static void delete(HibernateBean pBean) throws Exception { + insertdelete(pBean, false); + } + + /** + * Metodo que registra en el log de auditoria los registros nuevos de una tabla. + * + * @param pBean Datos del registro nuevo. + * @throws Exception + */ + private static void insertdelete(HibernateBean pBean, boolean insert) throws Exception { + Field f[] = pBean.getClass().getDeclaredFields(); + Map m = new HashMap(); + for (Field obj : f) { + if (obj.getName().compareTo("hashValue") == 0 + || obj.getName().compareTo("class") == 0 || obj.getName().compareTo("serialVersionUID") == 0) { + continue; + } + String value = getBeanValue(pBean, obj.getName()); + m.put(obj.getName(), value); + } + if (!m.isEmpty()) { + saveLogInsertDelete(pBean.getClass().getSimpleName(), m, insert); + } + } + + /** + * Entrega el valor de un campo. + * + * @param pBean bean a obtener el valor de un campo. + * @param pField Nombre del campo a obtener el valor. + * @return String. + * @throws Exception + */ + private static String getBeanValue(HibernateBean pBean, String pField) throws Exception { + String newvalue; + try { + newvalue = BeanManager.getBeanAttributeValue(pBean, pField).toString(); + if (newvalue.contains("from")) { + //Para que no envie sentecias JPL que estan en el bean. + return null; + } + } catch (Exception e) { + return null; + } + return newvalue; + } + + /** + * Crea un registro en la base con datos de insert o update de un registro. + * + * @param beanName Nombre de la tabla. + * @param m Map con los campos de la tabla. + * @param insert true indica que inserta un registro, false indica que se elimian un registro de la base. + * @throws Exception + */ + private static void saveLogInsertDelete(String beanName, Map m, boolean insert) throws Exception { + Timestamp t = FormatDates.getInstance().getDataBaseTimestamp(); + SaveRequest sr = SaveData.getSaveRequest(); + if (sr == null) { + return; + } + //Crea un objeto con los datos a almacenar auditoria. + TsafeAuditInsDelKey key = new TsafeAuditInsDelKey(); + //TgeneAccountingDateBranchKey dkey = new TgeneAccountingDateBranchKey(0, sr.getCompany()); + //TgeneAccountingDateBranch d = TgeneAccountingDateBranch.find(PersistenceHelper.getEntityManager(), dkey); + Date fecha = new Date(t.getTime()); + key.setChangedate(fecha); + key.setTablename(beanName.toUpperCase()); + key.setPartitiondb(FormatDates.getPartition(key.getChangedate())); + key.setRealdate(t); + TsafeAuditInsDel obj = new TsafeAuditInsDel(); + obj.setPk(key); + obj.setCompanycode(sr.getCompany()); + obj.setOfficecode(sr.getOfficeCode()); + obj.setBranchcode(sr.getBranchCode()); + obj.setTerminalcode(sr.getTerminalCode()); + obj.setUsercode(sr.getUser()); + obj.setTransactionmodule(sr.getTransactionModule()); + obj.setTransactioncode(sr.getTransactionCode()); + obj.setTransactionversion(sr.getTransactionVersion()); + obj.setBrowser(sr.getBrowser()); + obj.setOperativesystem(sr.getOperativesystem()); + if (insert) { + obj.setIsinsert("Y"); + obj.setIsdelete("N"); + } else { + obj.setIsinsert("N"); + obj.setIsdelete("Y"); + } + obj.setRecvalue(m.toString()); + setAdicionalData(obj); + + if(sr.getUser()!=null){ + TsafeUser user= TsafeUser.find(PersistenceHelper.getEntityManager(), sr.getUser()); + if(user!=null){ + obj.setPersoncode(user.getPersoncode()); + } + } + + //Almacena el registro en la base. + PersistenceHelper.save(obj); + } +/** + * + * @param obj + * @throws Exception + */ + private static void setAdicionalData(HibernateBean obj) throws Exception { + try{ + try { + BeanManager.setBeanAttributeValue(obj, "account", SaveData.getAccount().substring(0, 19)); + } catch (Exception e) { + //NO hacer nada, + APPLogger.getLogger().debug(e.getStackTrace()[0]); + } + try { + BeanManager.setBeanAttributeValue(obj, "personcode", SaveData.getPersoncode() == null ? null : Integer.valueOf(SaveData.getPersoncode())); + } catch (Exception e) { + //NO hacer nada, + APPLogger.getLogger().debug(e.getStackTrace()[0]); + } + try { + BeanManager.setBeanAttributeValue(obj, "solicitudenumber", SaveData.getSolicitudenumber().substring(0, 19)); + } catch (Exception e) { + //NO hacer nada, + APPLogger.getLogger().debug(e.getStackTrace()[0]); + } + } catch(Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + } +} \ No newline at end of file diff --git a/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/log/Audit.java b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/log/Audit.java new file mode 100644 index 0000000..5b1d2bd --- /dev/null +++ b/base/persistence/commondb/src/main/java/com/fp/persistence/commondb/log/Audit.java @@ -0,0 +1,289 @@ +package com.fp.persistence.commondb.log; + +import java.lang.reflect.Field; +import java.sql.Date; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.Map; + +import com.fp.common.helper.BeanManager; +import com.fp.common.logger.APPLogger; +import com.fp.dto.data.SaveData; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.save.SaveRequest; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranchKey; +import com.fp.persistence.pgeneral.safe.TsafeAudit; +import com.fp.persistence.pgeneral.safe.TsafeAuditInsDel; +import com.fp.persistence.pgeneral.safe.TsafeAuditInsDelKey; +import com.fp.persistence.pgeneral.safe.TsafeAuditKey; +import com.fp.persistence.pgeneral.safe.TsafeUser; + +/** + * Clase que se encarga del menejo de auditoria de de cambios en tablas. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class Audit { + + /** + * Metodo que obtiene lista de campos del registro, y procesa por campo , si el valor cambio se genera un registro + * de auditoria. + * + * @param newBean Datos del registro nuevo. + * @param oldBean Datos del registro anterior. + * @throws Exception + */ + public static void process(HibernateBean newBean, HibernateBean oldBean) throws Exception { + Field f[] = newBean.getClass().getDeclaredFields(); + Timestamp t = null; + for (Field obj : f) { + if (obj.getName().compareTo("pk") == 0 || obj.getName().compareTo("hashValue") == 0 + || obj.getName().compareTo("class") == 0 || obj.getName().compareTo("serialVersionUID") == 0) { + continue; + } + if (t == null) { + t = FormatDates.getInstance().getDataBaseTimestamp(); + } + Audit.processByField(obj, newBean, oldBean, t); + } + } + + /** + * Metodo que verifica si los datos del campo son diferente de los valores del registro anterior. + * + * @param f Nombre del campo. + * @param newBean Datos del nuevo registro. + * @param oldBean Datos del registro anterior. + * @throws Exception + */ + @SuppressWarnings({"unchecked", "rawtypes"}) + private static void processByField(Field f, HibernateBean newBean, HibernateBean oldBean, Timestamp t) throws Exception { + Object newvalue; + try { + newvalue = BeanManager.getBeanAttributeValue(newBean, f.getName()); + } catch (NoSuchMethodException e) { + return; + } + Object oldvalue; + try { + oldvalue = BeanManager.getBeanAttributeValue(oldBean, f.getName()); + } catch (Exception e) { + return; + } + if (newvalue == null && oldvalue == null) { + return; + } + if ((newvalue == null && oldvalue != null) || (newvalue != null && oldvalue == null)) { + saveLog(newBean.getClass().getSimpleName(), f, newvalue, oldvalue, t); + return; + } + if (newvalue instanceof Comparable) { + if (((Comparable) newvalue).compareTo(oldvalue) != 0) { + saveLog(newBean.getClass().getSimpleName(), f, newvalue, oldvalue, t); + } + } + } + + /** + * Crea e inserta un rgistro en la tabla de auditoria TsafeAudit. + * + * @param beanName Nombre del bean. + * @param f Nombre del campo de la base. + * @param newvalue Nuevo valor. + * @param oldvalue Valor anterior. + * @throws Exception + */ + private static void saveLog(String beanName, Field f, Object newvalue, Object oldvalue, Timestamp t) throws Exception { + SaveRequest sr = SaveData.getSaveRequest(); + //Crea un objeto con los datos a almacenar auditoria. + TsafeAuditKey key = new TsafeAuditKey(); + //TgeneAccountingDateBranchKey dkey = new TgeneAccountingDateBranchKey(0, sr.getCompany()); + //TgeneAccountingDateBranch d = TgeneAccountingDateBranch.find(PersistenceHelper.getEntityManager(), dkey); + Date fecha = new Date(t.getTime()); + key.setChangedate(fecha);//d.getAccountingdate() + key.setTablename(beanName.toUpperCase()); + key.setColumnname(f.getName().toUpperCase()); + key.setPartitiondb(FormatDates.getPartition(key.getChangedate())); + key.setRealdate(t); + TsafeAudit obj = new TsafeAudit(); + obj.setPk(key); + obj.setCompanycode(sr.getCompany()); + obj.setOfficecode(sr.getOfficeCode()); + obj.setBranchcode(sr.getBranchCode()); + obj.setTerminalcode(sr.getTerminalCode()); + obj.setUsercode(sr.getUser()); + obj.setTransactionmodule(sr.getTransactionModule()); + obj.setTransactioncode(sr.getTransactionCode()); + obj.setTransactionversion(sr.getTransactionVersion()); + obj.setBrowser(sr.getBrowser()); + obj.setOperativesystem(sr.getOperativesystem()); + if (oldvalue != null) { + obj.setOldvalue(oldvalue.toString()); + } + if (newvalue != null) { + obj.setNewvalue(newvalue.toString()); + } + if(sr.getUser()!=null){ + TsafeUser user= TsafeUser.find(PersistenceHelper.getEntityManager(), sr.getUser()); + if(user!=null){ + obj.setPersoncode(user.getPersoncode()); + } + } + setAdicionalData(obj); + //Almacena el registro en la base. + PersistenceHelper.save(obj); + } + + /** + * Metodo que registra en el log de auditoria los registros nuevos de una tabla. + * + * @param pBean Datos del registro nuevo. + * @throws Exception + */ + public static void insert(HibernateBean pBean) throws Exception { + insertdelete(pBean, true); + } + + /** + * Metodo que registra en el log de auditoria los registros nuevos de una tabla. + * + * @param pBean Datos del registro nuevo. + * @throws Exception + */ + public static void delete(HibernateBean pBean) throws Exception { + insertdelete(pBean, false); + } + + /** + * Metodo que registra en el log de auditoria los registros nuevos de una tabla. + * + * @param pBean Datos del registro nuevo. + * @throws Exception + */ + private static void insertdelete(HibernateBean pBean, boolean insert) throws Exception { + Field f[] = pBean.getClass().getDeclaredFields(); + Map m = new HashMap(); + for (Field obj : f) { + if (obj.getName().compareTo("hashValue") == 0 + || obj.getName().compareTo("class") == 0 || obj.getName().compareTo("serialVersionUID") == 0) { + continue; + } + String value = getBeanValue(pBean, obj.getName()); + m.put(obj.getName(), value); + } + if (!m.isEmpty()) { + saveLogInsertDelete(pBean.getClass().getSimpleName(), m, insert); + } + } + + /** + * Entrega el valor de un campo. + * + * @param pBean bean a obtener el valor de un campo. + * @param pField Nombre del campo a obtener el valor. + * @return String. + * @throws Exception + */ + private static String getBeanValue(HibernateBean pBean, String pField) throws Exception { + String newvalue; + try { + newvalue = BeanManager.getBeanAttributeValue(pBean, pField).toString(); + if (newvalue.contains("from")) { + //Para que no envie sentecias JPL que estan en el bean. + return null; + } + } catch (Exception e) { + return null; + } + return newvalue; + } + + /** + * Crea un registro en la base con datos de insert o update de un registro. + * + * @param beanName Nombre de la tabla. + * @param m Map con los campos de la tabla. + * @param insert true indica que inserta un registro, false indica que se elimian un registro de la base. + * @throws Exception + */ + private static void saveLogInsertDelete(String beanName, Map m, boolean insert) throws Exception { + Timestamp t = FormatDates.getInstance().getDataBaseTimestamp(); + SaveRequest sr = SaveData.getSaveRequest(); + if (sr == null) { + return; + } + //Crea un objeto con los datos a almacenar auditoria. + TsafeAuditInsDelKey key = new TsafeAuditInsDelKey(); + //TgeneAccountingDateBranchKey dkey = new TgeneAccountingDateBranchKey(0, sr.getCompany()); + //TgeneAccountingDateBranch d = TgeneAccountingDateBranch.find(PersistenceHelper.getEntityManager(), dkey); + Date fecha = new Date(t.getTime()); + key.setChangedate(fecha); + key.setTablename(beanName.toUpperCase()); + key.setPartitiondb(FormatDates.getPartition(key.getChangedate())); + key.setRealdate(t); + TsafeAuditInsDel obj = new TsafeAuditInsDel(); + obj.setPk(key); + obj.setCompanycode(sr.getCompany()); + obj.setOfficecode(sr.getOfficeCode()); + obj.setBranchcode(sr.getBranchCode()); + obj.setTerminalcode(sr.getTerminalCode()); + obj.setUsercode(sr.getUser()); + obj.setTransactionmodule(sr.getTransactionModule()); + obj.setTransactioncode(sr.getTransactionCode()); + obj.setTransactionversion(sr.getTransactionVersion()); + obj.setBrowser(sr.getBrowser()); + obj.setOperativesystem(sr.getOperativesystem()); + if (insert) { + obj.setIsinsert("Y"); + obj.setIsdelete("N"); + } else { + obj.setIsinsert("N"); + obj.setIsdelete("Y"); + } + obj.setRecvalue(m.toString()); + setAdicionalData(obj); + + if(sr.getUser()!=null){ + TsafeUser user= TsafeUser.find(PersistenceHelper.getEntityManager(), sr.getUser()); + if(user!=null){ + obj.setPersoncode(user.getPersoncode()); + } + } + + //Almacena el registro en la base. + PersistenceHelper.save(obj); + } +/** + * + * @param obj + * @throws Exception + */ + private static void setAdicionalData(HibernateBean obj) throws Exception { + try{ + try { + BeanManager.setBeanAttributeValue(obj, "account", SaveData.getAccount().substring(0, 19)); + } catch (Exception e) { + //NO hacer nada, + APPLogger.getLogger().debug(e.getStackTrace()[0]); + } + try { + BeanManager.setBeanAttributeValue(obj, "personcode", SaveData.getPersoncode() == null ? null : Integer.valueOf(SaveData.getPersoncode())); + } catch (Exception e) { + //NO hacer nada, + APPLogger.getLogger().debug(e.getStackTrace()[0]); + } + try { + BeanManager.setBeanAttributeValue(obj, "solicitudenumber", SaveData.getSolicitudenumber().substring(0, 19)); + } catch (Exception e) { + //NO hacer nada, + APPLogger.getLogger().debug(e.getStackTrace()[0]); + } + } catch(Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + } +} \ No newline at end of file diff --git a/base/persistence/commondb/src/main/resources/.svn/entries b/base/persistence/commondb/src/main/resources/.svn/entries new file mode 100644 index 0000000..8280a65 --- /dev/null +++ b/base/persistence/commondb/src/main/resources/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/commondb/src/main/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +commondbmessages_es.properties +file + + + + +2022-07-28T03:40:32.250758Z +27a0a4585d3e3812b13aa45a9f2a4550 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1016 + diff --git a/base/persistence/commondb/src/main/resources/.svn/text-base/commondbmessages_es.properties.svn-base b/base/persistence/commondb/src/main/resources/.svn/text-base/commondbmessages_es.properties.svn-base new file mode 100644 index 0000000..5a668cb --- /dev/null +++ b/base/persistence/commondb/src/main/resources/.svn/text-base/commondbmessages_es.properties.svn-base @@ -0,0 +1,23 @@ +COMMONDB-0001=FECHA A RESTAR: {0,date,yyyy-MM-dd} ES MAYOR A: {1,date,yyyy-MM-dd} +COMMONDB-0002=LA FRECUENCIA DEBE SER MENOR O IGUAL A MENSUAL +COMMONDB-0003=El DIA {0} NO PUEDE MAYOR AL NUMEOR DE DIAS DE LA FRECUENCIA{1} +COMMONDB-0004=SESION NO ASOCIADA A UNA TRANSACCION +COMMONDB-0005=TRANSACCION YA APLICADA +COMMONDB-0006=CONSULTA NO TIENE REGISTROS +COMMONDB-0007=SENTENCIA INVALIDA +COMMONDB-0008=VALOR NO ENVIADO {0} +COMMONDB-0009=EL BEAN {0} NO SE ENCUENTRA EN EL SESSIONFACTORY +COMMONDB-00010=TABLA {0} TIENE UN PRIMARY KEY COMPUESTO +COMMONDB-00011=BEAN NO DEFINIDO PARA LA TABLA {0} +COMMONDB-00012=CAMPO {0} NO DEFINIDO EN LA TABLA {1} +COMMONDB-00013=FECHA CONTABLE NO DEFINIDA PARA LA COMPANIA {0}, SUCURSAL {1} +COMMONDB-00014=FECHAS CONTABLES NO DEFINIDAS EN: {0} PARA LA COMPANIA {1}, SUCURSAL {2} +COMMONDB-00015=EXISTE MAS DE UN REGISTRO PARA LA TABAL: {0} +COMMONDB-00016= +COMMONDB-00017= +COMMONDB-00018= +COMMONDB-00019= +COMMONDB-00020= +COMMONDB-00021=NUMERO DE ETIQUETAS ERRADO + + diff --git a/base/persistence/commondb/src/main/resources/commondbmessages_es.properties b/base/persistence/commondb/src/main/resources/commondbmessages_es.properties new file mode 100644 index 0000000..5a668cb --- /dev/null +++ b/base/persistence/commondb/src/main/resources/commondbmessages_es.properties @@ -0,0 +1,23 @@ +COMMONDB-0001=FECHA A RESTAR: {0,date,yyyy-MM-dd} ES MAYOR A: {1,date,yyyy-MM-dd} +COMMONDB-0002=LA FRECUENCIA DEBE SER MENOR O IGUAL A MENSUAL +COMMONDB-0003=El DIA {0} NO PUEDE MAYOR AL NUMEOR DE DIAS DE LA FRECUENCIA{1} +COMMONDB-0004=SESION NO ASOCIADA A UNA TRANSACCION +COMMONDB-0005=TRANSACCION YA APLICADA +COMMONDB-0006=CONSULTA NO TIENE REGISTROS +COMMONDB-0007=SENTENCIA INVALIDA +COMMONDB-0008=VALOR NO ENVIADO {0} +COMMONDB-0009=EL BEAN {0} NO SE ENCUENTRA EN EL SESSIONFACTORY +COMMONDB-00010=TABLA {0} TIENE UN PRIMARY KEY COMPUESTO +COMMONDB-00011=BEAN NO DEFINIDO PARA LA TABLA {0} +COMMONDB-00012=CAMPO {0} NO DEFINIDO EN LA TABLA {1} +COMMONDB-00013=FECHA CONTABLE NO DEFINIDA PARA LA COMPANIA {0}, SUCURSAL {1} +COMMONDB-00014=FECHAS CONTABLES NO DEFINIDAS EN: {0} PARA LA COMPANIA {1}, SUCURSAL {2} +COMMONDB-00015=EXISTE MAS DE UN REGISTRO PARA LA TABAL: {0} +COMMONDB-00016= +COMMONDB-00017= +COMMONDB-00018= +COMMONDB-00019= +COMMONDB-00020= +COMMONDB-00021=NUMERO DE ETIQUETAS ERRADO + + diff --git a/base/persistence/commondb/src/test/.svn/entries b/base/persistence/commondb/src/test/.svn/entries new file mode 100644 index 0000000..9d1b545 --- /dev/null +++ b/base/persistence/commondb/src/test/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/commondb/src/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/persistence/commondb/src/test/java/.svn/entries b/base/persistence/commondb/src/test/java/.svn/entries new file mode 100644 index 0000000..7beb1be --- /dev/null +++ b/base/persistence/commondb/src/test/java/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/commondb/src/test/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/persistence/commondb/src/test/resources/.svn/entries b/base/persistence/commondb/src/test/resources/.svn/entries new file mode 100644 index 0000000..cb9f9b4 --- /dev/null +++ b/base/persistence/commondb/src/test/resources/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/commondb/src/test/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/persistence/commondb/target/classes/com/fp/persistence/commondb/FlipUserTransaction.class b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/FlipUserTransaction.class new file mode 100644 index 0000000..65b04ca Binary files /dev/null and b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/FlipUserTransaction.class differ diff --git a/base/persistence/commondb/target/classes/com/fp/persistence/commondb/GeneralQuery.class b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/GeneralQuery.class new file mode 100644 index 0000000..49909a1 Binary files /dev/null and b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/GeneralQuery.class differ diff --git a/base/persistence/commondb/target/classes/com/fp/persistence/commondb/HqlStatement.class b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/HqlStatement.class new file mode 100644 index 0000000..02c787b Binary files /dev/null and b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/HqlStatement.class differ diff --git a/base/persistence/commondb/target/classes/com/fp/persistence/commondb/NestedSave.class b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/NestedSave.class new file mode 100644 index 0000000..3185b81 Binary files /dev/null and b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/NestedSave.class differ diff --git a/base/persistence/commondb/target/classes/com/fp/persistence/commondb/PersistenceHelper.class b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/PersistenceHelper.class new file mode 100644 index 0000000..fd0450f Binary files /dev/null and b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/PersistenceHelper.class differ diff --git a/base/persistence/commondb/target/classes/com/fp/persistence/commondb/PersistenceManager.class b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/PersistenceManager.class new file mode 100644 index 0000000..6b5435f Binary files /dev/null and b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/PersistenceManager.class differ diff --git a/base/persistence/commondb/target/classes/com/fp/persistence/commondb/PersistenceMetadata.class b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/PersistenceMetadata.class new file mode 100644 index 0000000..add8776 Binary files /dev/null and b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/PersistenceMetadata.class differ diff --git a/base/persistence/commondb/target/classes/com/fp/persistence/commondb/cache/CacheManager.class b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/cache/CacheManager.class new file mode 100644 index 0000000..e2e95d1 Binary files /dev/null and b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/cache/CacheManager.class differ diff --git a/base/persistence/commondb/target/classes/com/fp/persistence/commondb/data/SessionData.class b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/data/SessionData.class new file mode 100644 index 0000000..b91f044 Binary files /dev/null and b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/data/SessionData.class differ diff --git a/base/persistence/commondb/target/classes/com/fp/persistence/commondb/data/ThreadFacade.class b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/data/ThreadFacade.class new file mode 100644 index 0000000..7c08299 Binary files /dev/null and b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/data/ThreadFacade.class differ diff --git a/base/persistence/commondb/target/classes/com/fp/persistence/commondb/db/CloneData.class b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/db/CloneData.class new file mode 100644 index 0000000..2e90ce8 Binary files /dev/null and b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/db/CloneData.class differ diff --git a/base/persistence/commondb/target/classes/com/fp/persistence/commondb/db/DataHelper.class b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/db/DataHelper.class new file mode 100644 index 0000000..b837b61 Binary files /dev/null and b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/db/DataHelper.class differ diff --git a/base/persistence/commondb/target/classes/com/fp/persistence/commondb/exception/Constant.class b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/exception/Constant.class new file mode 100644 index 0000000..9ee5655 Binary files /dev/null and b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/exception/Constant.class differ diff --git a/base/persistence/commondb/target/classes/com/fp/persistence/commondb/helper/APPDates.class b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/helper/APPDates.class new file mode 100644 index 0000000..260ab11 Binary files /dev/null and b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/helper/APPDates.class differ diff --git a/base/persistence/commondb/target/classes/com/fp/persistence/commondb/helper/Fkconstraint.class b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/helper/Fkconstraint.class new file mode 100644 index 0000000..5b01fb7 Binary files /dev/null and b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/helper/Fkconstraint.class differ diff --git a/base/persistence/commondb/target/classes/com/fp/persistence/commondb/helper/FormatDates.class b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/helper/FormatDates.class new file mode 100644 index 0000000..54542d3 Binary files /dev/null and b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/helper/FormatDates.class differ diff --git a/base/persistence/commondb/target/classes/com/fp/persistence/commondb/helper/Frequency.class b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/helper/Frequency.class new file mode 100644 index 0000000..cfc5654 Binary files /dev/null and b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/helper/Frequency.class differ diff --git a/base/persistence/commondb/target/classes/com/fp/persistence/commondb/helper/MapUtil.class b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/helper/MapUtil.class new file mode 100644 index 0000000..ef92629 Binary files /dev/null and b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/helper/MapUtil.class differ diff --git a/base/persistence/commondb/target/classes/com/fp/persistence/commondb/log/Audit.class b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/log/Audit.class new file mode 100644 index 0000000..984ed3f Binary files /dev/null and b/base/persistence/commondb/target/classes/com/fp/persistence/commondb/log/Audit.class differ diff --git a/base/persistence/commondb/target/classes/commondbmessages_es.properties b/base/persistence/commondb/target/classes/commondbmessages_es.properties new file mode 100644 index 0000000..5a668cb --- /dev/null +++ b/base/persistence/commondb/target/classes/commondbmessages_es.properties @@ -0,0 +1,23 @@ +COMMONDB-0001=FECHA A RESTAR: {0,date,yyyy-MM-dd} ES MAYOR A: {1,date,yyyy-MM-dd} +COMMONDB-0002=LA FRECUENCIA DEBE SER MENOR O IGUAL A MENSUAL +COMMONDB-0003=El DIA {0} NO PUEDE MAYOR AL NUMEOR DE DIAS DE LA FRECUENCIA{1} +COMMONDB-0004=SESION NO ASOCIADA A UNA TRANSACCION +COMMONDB-0005=TRANSACCION YA APLICADA +COMMONDB-0006=CONSULTA NO TIENE REGISTROS +COMMONDB-0007=SENTENCIA INVALIDA +COMMONDB-0008=VALOR NO ENVIADO {0} +COMMONDB-0009=EL BEAN {0} NO SE ENCUENTRA EN EL SESSIONFACTORY +COMMONDB-00010=TABLA {0} TIENE UN PRIMARY KEY COMPUESTO +COMMONDB-00011=BEAN NO DEFINIDO PARA LA TABLA {0} +COMMONDB-00012=CAMPO {0} NO DEFINIDO EN LA TABLA {1} +COMMONDB-00013=FECHA CONTABLE NO DEFINIDA PARA LA COMPANIA {0}, SUCURSAL {1} +COMMONDB-00014=FECHAS CONTABLES NO DEFINIDAS EN: {0} PARA LA COMPANIA {1}, SUCURSAL {2} +COMMONDB-00015=EXISTE MAS DE UN REGISTRO PARA LA TABAL: {0} +COMMONDB-00016= +COMMONDB-00017= +COMMONDB-00018= +COMMONDB-00019= +COMMONDB-00020= +COMMONDB-00021=NUMERO DE ETIQUETAS ERRADO + + diff --git a/base/persistence/commondb/target/commondb-2.1.jar b/base/persistence/commondb/target/commondb-2.1.jar new file mode 100644 index 0000000..3c1e867 Binary files /dev/null and b/base/persistence/commondb/target/commondb-2.1.jar differ diff --git a/base/persistence/commondb/target/maven-archiver/pom.properties b/base/persistence/commondb/target/maven-archiver/pom.properties new file mode 100644 index 0000000..2d9261e --- /dev/null +++ b/base/persistence/commondb/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:52:49 ECT 2022 +version=2.1 +groupId=com.fp.base.persistence +artifactId=commondb diff --git a/base/persistence/parmas/.classpath b/base/persistence/parmas/.classpath new file mode 100644 index 0000000..94b6867 --- /dev/null +++ b/base/persistence/parmas/.classpath @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/base/persistence/parmas/.project b/base/persistence/parmas/.project new file mode 100644 index 0000000..eaeb29c --- /dev/null +++ b/base/persistence/parmas/.project @@ -0,0 +1,48 @@ + + + parmas + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.hibernate.eclipse.console.hibernateBuilder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.eclipse.babel.editor.rbeBuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.hibernate.eclipse.console.hibernateNature + org.eclipse.wst.common.project.facet.core.nature + com.jaspersoft.studio.babel.editor.rbeNature + + diff --git a/base/persistence/parmas/.settings/.svn/entries b/base/persistence/parmas/.settings/.svn/entries new file mode 100644 index 0000000..4129687 --- /dev/null +++ b/base/persistence/parmas/.settings/.svn/entries @@ -0,0 +1,266 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/.settings +svn://172.17.26.185/COMACO + + + +2015-12-29T14:44:23.142349Z +4359 +cvasquez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +org.eclipse.jdt.core.prefs +file + + + + +2022-07-28T03:40:28.886743Z +9c5661676ceb67312e95b170dcde2dda +2014-10-24T04:09:44.450107Z +1906 +ogarcia + + + + + + + + + + + + + + + + + + + + + +430 + +org.eclipse.m2e.core.prefs +file + + + + +2022-07-28T03:40:28.887743Z +66985cccd6a27c2401be11bc75d9ea23 +2014-10-24T04:09:44.450107Z +1906 +ogarcia + + + + + + + + + + + + + + + + + + + + + +90 + +org.eclipse.core.resources.prefs +file + + + + +2022-07-28T03:40:28.887743Z +a9703a6bb6a3abf4cb5c0472f9db8b48 +2014-10-24T04:09:44.450107Z +1906 +ogarcia + + + + + + + + + + + + + + + + + + + + + +134 + +org.eclipse.wst.common.project.facet.core.xml +file + + + + +2022-07-28T03:40:28.887743Z +15f8d7ec0431c0a6fbea4f6ca024795b +2014-10-24T04:09:44.450107Z +1906 +ogarcia + + + + + + + + + + + + + + + + + + + + + +172 + +org.hibernate.eclipse.console.prefs +file + + + + +2022-07-28T03:40:28.887743Z +111170a7f7a4052d29b315f3504ffc72 +2014-10-24T04:09:44.450107Z +1906 +ogarcia + + + + + + + + + + + + + + + + + + + + + +80 + +org.eclipse.wst.validation.prefs +file + + + + +2022-07-28T03:40:28.887743Z +81a4c1a45fc1cb2ad389f79f65c38de3 +2015-12-29T14:44:23.142349Z +4359 +cvasquez + + + + + + + + + + + + + + + + + + + + + +50 + +org.eclipse.wst.common.component +file + + + + +2022-07-28T03:40:28.888743Z +557719675987419c8a454e8d3c94a28d +2014-10-24T04:09:44.450107Z +1906 +ogarcia + + + + + + + + + + + + + + + + + + + + + +244 + diff --git a/base/persistence/parmas/.settings/.svn/text-base/org.eclipse.core.resources.prefs.svn-base b/base/persistence/parmas/.settings/.svn/text-base/org.eclipse.core.resources.prefs.svn-base new file mode 100644 index 0000000..67a1686 --- /dev/null +++ b/base/persistence/parmas/.settings/.svn/text-base/org.eclipse.core.resources.prefs.svn-base @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +encoding//src/main/java=ISO-8859-1 +encoding//src/test/java=ISO-8859-1 +encoding/=ISO-8859-1 diff --git a/base/persistence/parmas/.settings/.svn/text-base/org.eclipse.jdt.core.prefs.svn-base b/base/persistence/parmas/.settings/.svn/text-base/org.eclipse.jdt.core.prefs.svn-base new file mode 100644 index 0000000..c788ee3 --- /dev/null +++ b/base/persistence/parmas/.settings/.svn/text-base/org.eclipse.jdt.core.prefs.svn-base @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/base/persistence/parmas/.settings/.svn/text-base/org.eclipse.m2e.core.prefs.svn-base b/base/persistence/parmas/.settings/.svn/text-base/org.eclipse.m2e.core.prefs.svn-base new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/base/persistence/parmas/.settings/.svn/text-base/org.eclipse.m2e.core.prefs.svn-base @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/base/persistence/parmas/.settings/.svn/text-base/org.eclipse.wst.common.component.svn-base b/base/persistence/parmas/.settings/.svn/text-base/org.eclipse.wst.common.component.svn-base new file mode 100644 index 0000000..1a7ddce --- /dev/null +++ b/base/persistence/parmas/.settings/.svn/text-base/org.eclipse.wst.common.component.svn-base @@ -0,0 +1,5 @@ + + + + + diff --git a/base/persistence/parmas/.settings/.svn/text-base/org.eclipse.wst.common.project.facet.core.xml.svn-base b/base/persistence/parmas/.settings/.svn/text-base/org.eclipse.wst.common.project.facet.core.xml.svn-base new file mode 100644 index 0000000..d788c0d --- /dev/null +++ b/base/persistence/parmas/.settings/.svn/text-base/org.eclipse.wst.common.project.facet.core.xml.svn-base @@ -0,0 +1,5 @@ + + + + + diff --git a/base/persistence/parmas/.settings/.svn/text-base/org.eclipse.wst.validation.prefs.svn-base b/base/persistence/parmas/.settings/.svn/text-base/org.eclipse.wst.validation.prefs.svn-base new file mode 100644 index 0000000..6f1cba6 --- /dev/null +++ b/base/persistence/parmas/.settings/.svn/text-base/org.eclipse.wst.validation.prefs.svn-base @@ -0,0 +1,2 @@ +disabled=06target +eclipse.preferences.version=1 diff --git a/base/persistence/parmas/.settings/.svn/text-base/org.hibernate.eclipse.console.prefs.svn-base b/base/persistence/parmas/.settings/.svn/text-base/org.hibernate.eclipse.console.prefs.svn-base new file mode 100644 index 0000000..d9275ad --- /dev/null +++ b/base/persistence/parmas/.settings/.svn/text-base/org.hibernate.eclipse.console.prefs.svn-base @@ -0,0 +1,3 @@ +default.configuration= +eclipse.preferences.version=1 +hibernate3.enabled=true diff --git a/base/persistence/parmas/.settings/org.eclipse.core.resources.prefs b/base/persistence/parmas/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..67a1686 --- /dev/null +++ b/base/persistence/parmas/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +encoding//src/main/java=ISO-8859-1 +encoding//src/test/java=ISO-8859-1 +encoding/=ISO-8859-1 diff --git a/base/persistence/parmas/.settings/org.eclipse.jdt.core.prefs b/base/persistence/parmas/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..c788ee3 --- /dev/null +++ b/base/persistence/parmas/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/base/persistence/parmas/.settings/org.eclipse.m2e.core.prefs b/base/persistence/parmas/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/base/persistence/parmas/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/base/persistence/parmas/.settings/org.eclipse.wst.common.component b/base/persistence/parmas/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..1a7ddce --- /dev/null +++ b/base/persistence/parmas/.settings/org.eclipse.wst.common.component @@ -0,0 +1,5 @@ + + + + + diff --git a/base/persistence/parmas/.settings/org.eclipse.wst.common.project.facet.core.xml b/base/persistence/parmas/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..d788c0d --- /dev/null +++ b/base/persistence/parmas/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/base/persistence/parmas/.settings/org.eclipse.wst.validation.prefs b/base/persistence/parmas/.settings/org.eclipse.wst.validation.prefs new file mode 100644 index 0000000..6f1cba6 --- /dev/null +++ b/base/persistence/parmas/.settings/org.eclipse.wst.validation.prefs @@ -0,0 +1,2 @@ +disabled=06target +eclipse.preferences.version=1 diff --git a/base/persistence/parmas/.settings/org.hibernate.eclipse.console.prefs b/base/persistence/parmas/.settings/org.hibernate.eclipse.console.prefs new file mode 100644 index 0000000..d9275ad --- /dev/null +++ b/base/persistence/parmas/.settings/org.hibernate.eclipse.console.prefs @@ -0,0 +1,3 @@ +default.configuration= +eclipse.preferences.version=1 +hibernate3.enabled=true diff --git a/base/persistence/parmas/.svn/dir-prop-base b/base/persistence/parmas/.svn/dir-prop-base new file mode 100644 index 0000000..40820ff --- /dev/null +++ b/base/persistence/parmas/.svn/dir-prop-base @@ -0,0 +1,6 @@ +K 10 +svn:ignore +V 7 +target + +END diff --git a/base/persistence/parmas/.svn/entries b/base/persistence/parmas/.svn/entries new file mode 100644 index 0000000..95144af --- /dev/null +++ b/base/persistence/parmas/.svn/entries @@ -0,0 +1,139 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas +svn://172.17.26.185/COMACO + + + +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +.classpath +file + + + + +2022-07-28T03:40:28.912743Z +179b3c0571a314fc472173592628377e +2014-10-24T04:09:44.450107Z +1906 +ogarcia + + + + + + + + + + + + + + + + + + + + + +1097 + +.project +file + + + + +2022-07-28T03:40:28.912743Z +565dfa904e5c52c715a373c70d3d87c5 +2015-12-29T14:44:23.142349Z +4359 +cvasquez + + + + + + + + + + + + + + + + + + + + + +1415 + +src +dir + +bin +dir + +pom.xml +file + + + + +2022-07-28T03:40:28.912743Z +be5a646196b70a9a534037d60c672f19 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +541 + +.settings +dir + diff --git a/base/persistence/parmas/.svn/text-base/.classpath.svn-base b/base/persistence/parmas/.svn/text-base/.classpath.svn-base new file mode 100644 index 0000000..94b6867 --- /dev/null +++ b/base/persistence/parmas/.svn/text-base/.classpath.svn-base @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/base/persistence/parmas/.svn/text-base/.project.svn-base b/base/persistence/parmas/.svn/text-base/.project.svn-base new file mode 100644 index 0000000..eaeb29c --- /dev/null +++ b/base/persistence/parmas/.svn/text-base/.project.svn-base @@ -0,0 +1,48 @@ + + + parmas + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.hibernate.eclipse.console.hibernateBuilder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.eclipse.babel.editor.rbeBuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.hibernate.eclipse.console.hibernateNature + org.eclipse.wst.common.project.facet.core.nature + com.jaspersoft.studio.babel.editor.rbeNature + + diff --git a/base/persistence/parmas/.svn/text-base/pom.xml.svn-base b/base/persistence/parmas/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..18e76e0 --- /dev/null +++ b/base/persistence/parmas/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,15 @@ + + + 4.0.0 + + com.fp.base + persistence + 2.1 + + com.fp.base.persistence + parmas + parmas + + + diff --git a/base/persistence/parmas/bin/.svn/entries b/base/persistence/parmas/bin/.svn/entries new file mode 100644 index 0000000..0cadb4f --- /dev/null +++ b/base/persistence/parmas/bin/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/bin +svn://172.17.26.185/COMACO + + + +2014-10-21T05:02:04.597749Z +1761 +dlopez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + diff --git a/base/persistence/parmas/bin/src/.svn/entries b/base/persistence/parmas/bin/src/.svn/entries new file mode 100644 index 0000000..03be60e --- /dev/null +++ b/base/persistence/parmas/bin/src/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/bin/src +svn://172.17.26.185/COMACO + + + +2014-10-21T05:02:04.597749Z +1761 +dlopez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +main +dir + diff --git a/base/persistence/parmas/bin/src/main/.svn/entries b/base/persistence/parmas/bin/src/main/.svn/entries new file mode 100644 index 0000000..674bf6e --- /dev/null +++ b/base/persistence/parmas/bin/src/main/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/bin/src/main +svn://172.17.26.185/COMACO + + + +2014-10-21T05:02:04.597749Z +1761 +dlopez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + diff --git a/base/persistence/parmas/bin/src/main/java/.svn/entries b/base/persistence/parmas/bin/src/main/java/.svn/entries new file mode 100644 index 0000000..09381d5 --- /dev/null +++ b/base/persistence/parmas/bin/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/bin/src/main/java +svn://172.17.26.185/COMACO + + + +2014-10-21T05:02:04.597749Z +1761 +dlopez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/persistence/parmas/bin/src/main/java/com/.svn/entries b/base/persistence/parmas/bin/src/main/java/com/.svn/entries new file mode 100644 index 0000000..10a1b0e --- /dev/null +++ b/base/persistence/parmas/bin/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/bin/src/main/java/com +svn://172.17.26.185/COMACO + + + +2014-10-21T05:02:04.597749Z +1761 +dlopez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/persistence/parmas/bin/src/main/java/com/fp/.svn/entries b/base/persistence/parmas/bin/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..85a1b62 --- /dev/null +++ b/base/persistence/parmas/bin/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/bin/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-10-21T05:02:04.597749Z +1761 +dlopez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +persistence +dir + diff --git a/base/persistence/parmas/bin/src/main/java/com/fp/persistence/.svn/entries b/base/persistence/parmas/bin/src/main/java/com/fp/persistence/.svn/entries new file mode 100644 index 0000000..14deefb --- /dev/null +++ b/base/persistence/parmas/bin/src/main/java/com/fp/persistence/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/bin/src/main/java/com/fp/persistence +svn://172.17.26.185/COMACO + + + +2014-10-21T05:02:04.597749Z +1761 +dlopez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +parmas +dir + diff --git a/base/persistence/parmas/bin/src/main/java/com/fp/persistence/parmas/.svn/entries b/base/persistence/parmas/bin/src/main/java/com/fp/persistence/parmas/.svn/entries new file mode 100644 index 0000000..123e5aa --- /dev/null +++ b/base/persistence/parmas/bin/src/main/java/com/fp/persistence/parmas/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/bin/src/main/java/com/fp/persistence/parmas +svn://172.17.26.185/COMACO + + + +2014-10-21T05:02:04.597749Z +1761 +dlopez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +param +dir + diff --git a/base/persistence/parmas/bin/src/main/java/com/fp/persistence/parmas/param/.svn/entries b/base/persistence/parmas/bin/src/main/java/com/fp/persistence/parmas/param/.svn/entries new file mode 100644 index 0000000..53f531f --- /dev/null +++ b/base/persistence/parmas/bin/src/main/java/com/fp/persistence/parmas/param/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/bin/src/main/java/com/fp/persistence/parmas/param +svn://172.17.26.185/COMACO + + + +2014-10-21T05:02:04.597749Z +1761 +dlopez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TarmCentroControl.class +file + + + + +2022-07-28T03:40:28.613742Z +92154f670a6c79c7731cb73b61609f0e +2014-10-21T05:02:04.597749Z +1761 +dlopez +has-props + + + + + + + + + + + + + + + + + + + + +10063 + diff --git a/base/persistence/parmas/bin/src/main/java/com/fp/persistence/parmas/param/.svn/prop-base/TarmCentroControl.class.svn-base b/base/persistence/parmas/bin/src/main/java/com/fp/persistence/parmas/param/.svn/prop-base/TarmCentroControl.class.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/base/persistence/parmas/bin/src/main/java/com/fp/persistence/parmas/param/.svn/prop-base/TarmCentroControl.class.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/base/persistence/parmas/bin/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmCentroControl.class.svn-base b/base/persistence/parmas/bin/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmCentroControl.class.svn-base new file mode 100644 index 0000000..93dec4e Binary files /dev/null and b/base/persistence/parmas/bin/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmCentroControl.class.svn-base differ diff --git a/base/persistence/parmas/bin/src/main/java/com/fp/persistence/parmas/param/TarmCentroControl.class b/base/persistence/parmas/bin/src/main/java/com/fp/persistence/parmas/param/TarmCentroControl.class new file mode 100644 index 0000000..93dec4e Binary files /dev/null and b/base/persistence/parmas/bin/src/main/java/com/fp/persistence/parmas/param/TarmCentroControl.class differ diff --git a/base/persistence/parmas/pom.xml b/base/persistence/parmas/pom.xml new file mode 100644 index 0000000..18e76e0 --- /dev/null +++ b/base/persistence/parmas/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + + com.fp.base + persistence + 2.1 + + com.fp.base.persistence + parmas + parmas + + + diff --git a/base/persistence/parmas/src/.svn/entries b/base/persistence/parmas/src/.svn/entries new file mode 100644 index 0000000..8be7d78 --- /dev/null +++ b/base/persistence/parmas/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src +svn://172.17.26.185/COMACO + + + +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/base/persistence/parmas/src/main/.svn/entries b/base/persistence/parmas/src/main/.svn/entries new file mode 100644 index 0000000..02ef074 --- /dev/null +++ b/base/persistence/parmas/src/main/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/main +svn://172.17.26.185/COMACO + + + +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + diff --git a/base/persistence/parmas/src/main/java/.svn/entries b/base/persistence/parmas/src/main/java/.svn/entries new file mode 100644 index 0000000..3752d0f --- /dev/null +++ b/base/persistence/parmas/src/main/java/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/main/java +svn://172.17.26.185/COMACO + + + +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ec +dir + +com +dir + diff --git a/base/persistence/parmas/src/main/java/com/.svn/entries b/base/persistence/parmas/src/main/java/com/.svn/entries new file mode 100644 index 0000000..1cc401c --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/main/java/com +svn://172.17.26.185/COMACO + + + +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/persistence/parmas/src/main/java/com/fp/.svn/entries b/base/persistence/parmas/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..b92b14a --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +persistence +dir + diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/.svn/entries b/base/persistence/parmas/src/main/java/com/fp/persistence/.svn/entries new file mode 100644 index 0000000..d46d9f9 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/main/java/com/fp/persistence +svn://172.17.26.185/COMACO + + + +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +parmas +dir + diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/.svn/entries b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/.svn/entries new file mode 100644 index 0000000..5dd3fc9 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/.svn/entries @@ -0,0 +1,49 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/main/java/com/fp/persistence/parmas +svn://172.17.26.185/COMACO + + + +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +inte +dir + +param +dir + +dto +dir + +soli +dir + +eval +dir + +fun +dir + +ins +dir + diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/.svn/entries b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/.svn/entries new file mode 100644 index 0000000..468e98e --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto +svn://172.17.26.185/COMACO + + + +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ws +dir + diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/entries b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/entries new file mode 100644 index 0000000..42a07dc --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/entries @@ -0,0 +1,368 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws +svn://172.17.26.185/COMACO + + + +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +InfoGuardiaDto.java +file + + + + +2022-07-28T03:40:27.884739Z +46ca6f1de6f3c205ee40c63d79829bb6 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1100 + +DatosArmaDto.java +file + + + + +2022-07-28T03:40:27.884739Z +ad8d8ff70b7d822c9557428ed1d8f84e +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +3754 + +DatosSnapDto.java +file + + + + +2022-07-28T03:40:27.884739Z +3d779319b3825cc9233fc3971aeac59b +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +4004 + +DocumentoDto.java +file + + + + +2022-07-28T03:40:27.885739Z +804852a22a5d5397ae6090b5ea65e736 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +4412 + +ArmaDto.java +file + + + + +2022-07-28T03:40:27.885739Z +8ee8674990871ba2f91b2620ad37302b +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +2579 + +ImagenDto.java +file + + + + +2022-07-28T03:40:27.885739Z +cc73bd7b6d27ec5943ca54b44cc146be +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1298 + +ColaImpresionDto.java +file + + + + +2022-07-28T03:40:27.886739Z +5b892183dd12b0e9bd518c0d592e76c1 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +2052 + +JefeCentroControlDto.java +file + + + + +2022-07-28T03:40:27.886739Z +4b154d8f547e698f5ed967ffd2dcbcc5 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1182 + +TramiteDto.java +file + + + + +2022-07-28T03:40:27.886739Z +772f8336b8f8d71ee827fcc6632ba18b +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1486 + +PersonaDto.java +file + + + + +2022-07-28T03:40:27.887739Z +ea9d5102fc9c164d4eac415a2965f752 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +3144 + diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/prop-base/ArmaDto.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/prop-base/ArmaDto.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/prop-base/ArmaDto.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/prop-base/ColaImpresionDto.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/prop-base/ColaImpresionDto.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/prop-base/ColaImpresionDto.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/prop-base/DocumentoDto.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/prop-base/DocumentoDto.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/prop-base/DocumentoDto.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/prop-base/ImagenDto.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/prop-base/ImagenDto.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/prop-base/ImagenDto.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/prop-base/JefeCentroControlDto.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/prop-base/JefeCentroControlDto.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/prop-base/JefeCentroControlDto.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/prop-base/PersonaDto.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/prop-base/PersonaDto.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/prop-base/PersonaDto.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/ArmaDto.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/ArmaDto.java.svn-base new file mode 100644 index 0000000..c666c83 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/ArmaDto.java.svn-base @@ -0,0 +1,134 @@ +package com.fp.persistence.parmas.dto.ws; + +import java.io.Serializable; + +/** + * DTO que transportará los datos del arma + * @author dcruz + * + */ +public class ArmaDto implements Serializable{ + + private static final long serialVersionUID = 7339086491340802876L; + /** + * id del arma en la base datos + */ + private String idArma; + /** + * serie del arma + */ + private String serie; + /** + * clase del arma + */ + private String clase; + /** + * Tipo de arma + */ + private String tipo; + /** + * Marca del arma + */ + private String marca; + /** + * Modelo del arma + */ + private String modelo; + /** + * Calibre del arma + */ + private String calibre; + /** + * Unidad o medida del arma + */ + private String unidadMedidaPeso; + /** + * Longitud arma + */ + private String longitud; + /** + * Estado del arma + */ + private String estado; + /** + * Cantidad de dicha arma + */ + private Integer cantidad; + /** + * Tag asociado al arma + */ + private String tagAsociado; + + public String getIdArma() { + return idArma; + } + public void setIdArma(String idArma) { + this.idArma = idArma; + } + public String getSerie() { + return serie; + } + public void setSerie(String serie) { + this.serie = serie; + } + public String getClase() { + return clase; + } + public void setClase(String clase) { + this.clase = clase; + } + public String getTipo() { + return tipo; + } + public void setTipo(String tipo) { + this.tipo = tipo; + } + public String getMarca() { + return marca; + } + public void setMarca(String marca) { + this.marca = marca; + } + public String getModelo() { + return modelo; + } + public void setModelo(String modelo) { + this.modelo = modelo; + } + public String getCalibre() { + return calibre; + } + public void setCalibre(String calibre) { + this.calibre = calibre; + } + public String getEstado() { + return estado; + } + public void setEstado(String estado) { + this.estado = estado; + } + public Integer getCantidad() { + return cantidad; + } + public void setCantidad(Integer cantidad) { + this.cantidad = cantidad; + } + public String getUnidadMedidaPeso() { + return unidadMedidaPeso; + } + public void setUnidadMedidaPeso(String unidadMedidaPeso) { + this.unidadMedidaPeso = unidadMedidaPeso; + } + public String getLongitud() { + return longitud; + } + public void setLongitud(String longitud) { + this.longitud = longitud; + } + public String getTagAsociado() { + return tagAsociado; + } + public void setTagAsociado(String tagAsociado) { + this.tagAsociado = tagAsociado; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/ColaImpresionDto.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/ColaImpresionDto.java.svn-base new file mode 100644 index 0000000..841b251 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/ColaImpresionDto.java.svn-base @@ -0,0 +1,89 @@ +package com.fp.persistence.parmas.dto.ws; + +import java.io.Serializable; +import java.sql.Timestamp; +import java.util.Date; + +/** + * DTO que contiene datos para los datos a imprimir en los documentos + * @author dcruz + * + */ +public class ColaImpresionDto implements Serializable { + + private static final long serialVersionUID = 2701742512229268659L; + + /** + * Clave identificatoria del registro impresión + */ + private String idImpresion; + /** + * Fecha de inserción del registro + */ + private Timestamp fechaRegistro; + /** + * Fecha de impresión + */ + private Date fechaImpresion; + /** + * Documento a imprimir + */ + private DocumentoDto documento; + /** + * Datos de la persona + */ + private PersonaDto persona; + /** + * Datos del arma a entregar el permiso + */ + private ArmaDto arma; + + /** + * Bandera que determina si el documento a imprimir es una autorización o un permiso + */ + private String esAutorizacion; + + public String getIdImpresion() { + return idImpresion; + } + public void setIdImpresion(String idImpresion) { + this.idImpresion = idImpresion; + } + public Timestamp getFechaRegistro() { + return fechaRegistro; + } + public void setFechaRegistro(Timestamp fechaRegistro) { + this.fechaRegistro = fechaRegistro; + } + public Date getFechaImpresion() { + return fechaImpresion; + } + public void setFechaImpresion(Date fechaImpresion) { + this.fechaImpresion = fechaImpresion; + } + public PersonaDto getPersona() { + return persona; + } + public void setPersona(PersonaDto persona) { + this.persona = persona; + } + public ArmaDto getArma() { + return arma; + } + public void setArma(ArmaDto arma) { + this.arma = arma; + } + public DocumentoDto getDocumento() { + return documento; + } + public void setDocumento(DocumentoDto documento) { + this.documento = documento; + } + public String getEsAutorizacion() { + return esAutorizacion; + } + public void setEsAutorizacion(String esAutorizacion) { + this.esAutorizacion = esAutorizacion; + } + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/DatosArmaDto.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/DatosArmaDto.java.svn-base new file mode 100644 index 0000000..0c06b58 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/DatosArmaDto.java.svn-base @@ -0,0 +1,200 @@ +package com.fp.persistence.parmas.dto.ws; + +import java.io.Serializable; + +/** + * Contiene datos del arma y las imagenes asociadas a una arma + * @author Manuel Cepeda + * + */ +public class DatosArmaDto implements Serializable{ + + private static final long serialVersionUID = 5203532003887140746L; + + private String lote; + private String tipoFabricacion; + private String marca; + private String modelo; + private String estadoArma; + private String tipoPermiso; + private String descripcionClase; + private String descripcionTipo; + private String calibre; + + private String imagenImpronta; + private String imagenArma; + private String fichaTecnicaArma; + + public DatosArmaDto() { + } + + /** + * @return the imagenImpronta + */ + public String getImagenImpronta() { + return imagenImpronta; + } + + /** + * @param imagenImpronta the imagenImpronta to set + */ + public void setImagenImpronta(String imagenImpronta) { + this.imagenImpronta = imagenImpronta; + } + + /** + * @return the imagenArma + */ + public String getImagenArma() { + return imagenArma; + } + + /** + * @param imagenArma the imagenArma to set + */ + public void setImagenArma(String imagenArma) { + this.imagenArma = imagenArma; + } + + /** + * @return the fichaTecnicaArma + */ + public String getFichaTecnicaArma() { + return fichaTecnicaArma; + } + + /** + * @param fichaTecnicaArma the fichaTecnicaArma to set + */ + public void setFichaTecnicaArma(String fichaTecnicaArma) { + this.fichaTecnicaArma = fichaTecnicaArma; + } + + /** + * @return the lote + */ + public String getLote() { + return lote; + } + + /** + * @param lote the lote to set + */ + public void setLote(String lote) { + this.lote = lote; + } + + /** + * @return the tipoFabricacion + */ + public String getTipoFabricacion() { + return tipoFabricacion; + } + + /** + * @param tipoFabricacion the tipoFabricacion to set + */ + public void setTipoFabricacion(String tipoFabricacion) { + this.tipoFabricacion = tipoFabricacion; + } + + /** + * @return the marca + */ + public String getMarca() { + return marca; + } + + /** + * @param marca the marca to set + */ + public void setMarca(String marca) { + this.marca = marca; + } + + /** + * @return the modelo + */ + public String getModelo() { + return modelo; + } + + /** + * @param modelo the modelo to set + */ + public void setModelo(String modelo) { + this.modelo = modelo; + } + + /** + * @return the estadoArma + */ + public String getEstadoArma() { + return estadoArma; + } + + /** + * @param estadoArma the estadoArma to set + */ + public void setEstadoArma(String estadoArma) { + this.estadoArma = estadoArma; + } + + /** + * @return the tipoPermiso + */ + public String getTipoPermiso() { + return tipoPermiso; + } + + /** + * @param tipoPermiso the tipoPermiso to set + */ + public void setTipoPermiso(String tipoPermiso) { + this.tipoPermiso = tipoPermiso; + } + + /** + * @return the descripcionClase + */ + public String getDescripcionClase() { + return descripcionClase; + } + + /** + * @param descripcionClase the descripcionClase to set + */ + public void setDescripcionClase(String descripcionClase) { + this.descripcionClase = descripcionClase; + } + + /** + * @return the descripcionTipo + */ + public String getDescripcionTipo() { + return descripcionTipo; + } + + /** + * @param descripcionTipo the descripcionTipo to set + */ + public void setDescripcionTipo(String descripcionTipo) { + this.descripcionTipo = descripcionTipo; + } + + /** + * @return the calibre + */ + public String getCalibre() { + return calibre; + } + + /** + * @param calibre the calibre to set + */ + public void setCalibre(String calibre) { + this.calibre = calibre; + } + + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/DatosSnapDto.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/DatosSnapDto.java.svn-base new file mode 100644 index 0000000..43b1dd8 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/DatosSnapDto.java.svn-base @@ -0,0 +1,181 @@ +package com.fp.persistence.parmas.dto.ws; + +import java.io.Serializable; +import java.util.List; + +/** + * Contiene datos de la persona, sea natural o juridica, informacion e images de armas + * @author Manuel Cepeda + * + */ +public class DatosSnapDto implements Serializable{ + + private static final long serialVersionUID = 5203532003887140746L; + /** + * Codigo de la persona en la base de datos + */ + private Integer codigoPersona; + /** + * Nombre de la razonSocial + */ + private String razonSocial; + /** + * Dirección de residencia de la persona + */ + private String direccion; + /** + * Nombre de la email + */ + private String email; + /** + * Teléfono de domicilio de la persona + */ + private String telefonoFijo; + /** + * celular de la persona + */ + private String telefonoCelular; + private String testPsicologico; + private List listaTramites; + private List listaGuardias; + + private String xPathLocation; + + + + + private List listaDatosArma; + + /** + * @return the codigoPersona + */ + public Integer getCodigoPersona() { + return codigoPersona; + } + /** + * @param codigoPersona the codigoPersona to set + */ + public void setCodigoPersona(Integer codigoPersona) { + this.codigoPersona = codigoPersona; + } + /** + * @return the razonSocial + */ + public String getRazonSocial() { + return razonSocial; + } + /** + * @param razonSocial the razonSocial to set + */ + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + /** + * @return the direccion + */ + public String getDireccion() { + return direccion; + } + /** + * @param direccion the direccion to set + */ + public void setDireccion(String direccion) { + this.direccion = direccion; + } + /** + * @return the email + */ + public String getEmail() { + return email; + } + /** + * @param email the email to set + */ + public void setEmail(String email) { + this.email = email; + } + /** + * @return the telefonoFijo + */ + public String getTelefonoFijo() { + return telefonoFijo; + } + /** + * @param telefonoFijo the telefonoFijo to set + */ + public void setTelefonoFijo(String telefonoFijo) { + this.telefonoFijo = telefonoFijo; + } + /** + * @return the telefonoCelular + */ + public String getTelefonoCelular() { + return telefonoCelular; + } + /** + * @param telefonoCelular the telefonoCelular to set + */ + public void setTelefonoCelular(String telefonoCelular) { + this.telefonoCelular = telefonoCelular; + } + /** + * @return the listaTramites + */ + public List getListaTramites() { + return listaTramites; + } + /** + * @param listaTramites the listaTramites to set + */ + public void setListaTramites(List listaTramites) { + this.listaTramites = listaTramites; + } + /** + * @return the listaGuardias + */ + public List getListaGuardias() { + return listaGuardias; + } + /** + * @param listaGuardias the listaGuardias to set + */ + public void setListaGuardias(List listaGuardias) { + this.listaGuardias = listaGuardias; + } + /** + * @return the xPathLocation + */ + public String getxPathLocation() { + return xPathLocation; + } + /** + * @param xPathLocation the xPathLocation to set + */ + public void setxPathLocation(String xPathLocation) { + this.xPathLocation = xPathLocation; + } + /** + * @return the listaDatosArma + */ + public List getListaDatosArma() { + return listaDatosArma; + } + /** + * @param listaDatosArma the listaDatosArma to set + */ + public void setListaDatosArma(List listaDatosArma) { + this.listaDatosArma = listaDatosArma; + } + /** + * @return the testPsicologico + */ + public String getTestPsicologico() { + return testPsicologico; + } + /** + * @param testPsicologico the testPsicologico to set + */ + public void setTestPsicologico(String testPsicologico) { + this.testPsicologico = testPsicologico; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/DocumentoDto.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/DocumentoDto.java.svn-base new file mode 100644 index 0000000..9e52a4f --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/DocumentoDto.java.svn-base @@ -0,0 +1,175 @@ +package com.fp.persistence.parmas.dto.ws; + +import java.io.Serializable; +import java.util.Date; + +/** + * Contiene datos de los documentos habilitantes + * @author dcruz + * + */ +public class DocumentoDto implements Serializable { + + private static final long serialVersionUID = -955491058987586481L; + /** + * Código del documento + */ + private Long codigoDocumento; + /** + * Número del documento + */ + private String numeroDocumento; + /** + * Fecha en la que emitió el documento + */ + private Date fechaEmision; + /** + * Fecha de expiración del documento + */ + private Date fechaExpiracion; + /** + * Número de solicitud + */ + private String numeroSolicitud; + /** + * Código del arma enlazado con el documento habilitante si es que existe + */ + private String carma; + /** + * El tipo de trámite por el que fue expedido el documento + */ + private String tipoTramite; + /** + * El trámite por el que fue expedido el documento + */ + private String tramite; + /** + * La categoría por el que fue expedido el documento + */ + private String categoria; + /** + * El uso/actividad por el que fue expedido el documento + */ + private String usoActividad; + /** + * Estado en el que se encuentra la solicitud + */ + private String estadoTramite; + + /** + * Bandera que determina si muestra la fecha de expiracion o la descripcion. + */ + private String esFechaExpiracion; + + /** + * Descripcion del documento se utiliza para + * mostrar un texto en caso que no se muestre la fecha de expiracion. + */ + private String descripcion; + + /** + * Descripcion1 del documento se utiliza para + * mostrar el texto de la jurisdiccion(Ecuador, Canton, Parroquia, Provincia). + * Se concatena descripcion1+descripcion2 + */ + private String descripcion1; + + /** + * Descripcion2 del documento se utiliza para + * mostrar el texto del pie del tramite. + * Se concatena descripcion1+descripcion2 + */ + private String descripcion2; + + public Long getCodigoDocumento() { + return codigoDocumento; + } + public void setCodigoDocumento(Long codigoDocumento) { + this.codigoDocumento = codigoDocumento; + } + public String getNumeroDocumento() { + return numeroDocumento; + } + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + public Date getFechaEmision() { + return fechaEmision; + } + public void setFechaEmision(Date fechaEmision) { + this.fechaEmision = fechaEmision; + } + public Date getFechaExpiracion() { + return fechaExpiracion; + } + public void setFechaExpiracion(Date fechaExpiracion) { + this.fechaExpiracion = fechaExpiracion; + } + public String getNumeroSolicitud() { + return numeroSolicitud; + } + public void setNumeroSolicitud(String numeroSolicitud) { + this.numeroSolicitud = numeroSolicitud; + } + public String getCarma() { + return carma; + } + public void setCarma(String carma) { + this.carma = carma; + } + public String getTipoTramite() { + return tipoTramite; + } + public void setTipoTramite(String tipoTramite) { + this.tipoTramite = tipoTramite; + } + public String getTramite() { + return tramite; + } + public void setTramite(String tramite) { + this.tramite = tramite; + } + public String getCategoria() { + return categoria; + } + public void setCategoria(String categoria) { + this.categoria = categoria; + } + public String getUsoActividad() { + return usoActividad; + } + public void setUsoActividad(String usoActividad) { + this.usoActividad = usoActividad; + } + public String getEstadoTramite() { + return estadoTramite; + } + public void setEstadoTramite(String estadoTramite) { + this.estadoTramite = estadoTramite; + } + public String getEsFechaExpiracion() { + return esFechaExpiracion; + } + public void setEsFechaExpiracion(String esFechaExpiracion) { + this.esFechaExpiracion = esFechaExpiracion; + } + public String getDescripcion() { + return descripcion; + } + public void setDescripcion(String descripcion) { + this.descripcion = descripcion; + } + public String getDescripcion1() { + return descripcion1; + } + public void setDescripcion1(String descripcion1) { + this.descripcion1 = descripcion1; + } + public String getDescripcion2() { + return descripcion2; + } + public void setDescripcion2(String descripcion2) { + this.descripcion2 = descripcion2; + } + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/ImagenDto.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/ImagenDto.java.svn-base new file mode 100644 index 0000000..39e0da1 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/ImagenDto.java.svn-base @@ -0,0 +1,60 @@ +package com.fp.persistence.parmas.dto.ws; + +import java.io.Serializable; + +public class ImagenDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * Código de la imagen + */ + private Integer codigoImagen; + /** + * Content type de la imagen + */ + private String tipoContenido; + /** + * La imagen en bytes + */ + private byte[] imagen; + /** + * La extensión de la imagen + */ + private String extension; + /** + * Size de la imagen + */ + private Integer tamanioImagen; + public Integer getCodigoImagen() { + return codigoImagen; + } + public void setCodigoImagen(Integer codigoImagen) { + this.codigoImagen = codigoImagen; + } + public String getTipoContenido() { + return tipoContenido; + } + public void setTipoContenido(String tipoContenido) { + this.tipoContenido = tipoContenido; + } + public byte[] getImagen() { + return imagen; + } + public void setImagen(byte[] imagen) { + this.imagen = imagen; + } + public String getExtension() { + return extension; + } + public void setExtension(String extension) { + this.extension = extension; + } + public Integer getTamanioImagen() { + return tamanioImagen; + } + public void setTamanioImagen(Integer tamanioImagen) { + this.tamanioImagen = tamanioImagen; + } + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/InfoGuardiaDto.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/InfoGuardiaDto.java.svn-base new file mode 100644 index 0000000..5f554b3 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/InfoGuardiaDto.java.svn-base @@ -0,0 +1,59 @@ +package com.fp.persistence.parmas.dto.ws; + +import java.io.Serializable; +import java.util.Date; + +/** + * Contiene datos de los guardias que tienes una empresa y los datos del guardia + * @author Manuel Cepeda + * + */ +public class InfoGuardiaDto implements Serializable{ + + private static final long serialVersionUID = 5203532003887140746L; + + private String nombre; + private String estado; + private String empresa; + + public InfoGuardiaDto() { + } + + /** + * @return the nombre + */ + public String getNombre() { + return nombre; + } + /** + * @param nombre the nombre to set + */ + public void setNombre(String nombre) { + this.nombre = nombre; + } + /** + * @return the estado + */ + public String getEstado() { + return estado; + } + /** + * @param estado the estado to set + */ + public void setEstado(String estado) { + this.estado = estado; + } + /** + * @return the empresa + */ + public String getEmpresa() { + return empresa; + } + /** + * @param empresa the empresa to set + */ + public void setEmpresa(String empresa) { + this.empresa = empresa; + } + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/JefeCentroControlDto.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/JefeCentroControlDto.java.svn-base new file mode 100644 index 0000000..f5154e7 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/JefeCentroControlDto.java.svn-base @@ -0,0 +1,56 @@ +package com.fp.persistence.parmas.dto.ws; + +import java.io.Serializable; + +/** + * DTO que contiene los datos del jefe del centro de control centro de control + * @author dcruz + * + */ +public class JefeCentroControlDto implements Serializable { + + private static final long serialVersionUID = 443509338679825612L; + + /** + * Nombre del jefe del centro de control + */ + private String nombre; + /** + * Ubicación del centro de control + */ + private String ubicacion; + /** + * Firma del jefe del centro de control + */ + private byte[] firma; + /** + * Rango del jefe de centro de impresión + */ + private String rangoJefe; + + public String getNombre() { + return nombre; + } + public void setNombre(String nombre) { + this.nombre = nombre; + } + public String getUbicacion() { + return ubicacion; + } + public void setUbicacion(String ubicacion) { + this.ubicacion = ubicacion; + } + public byte[] getFirma() { + return firma; + } + public void setFirma(byte[] firma) { + this.firma = firma; + } + public String getRangoJefe() { + return rangoJefe; + } + public void setRangoJefe(String rangoJefe) { + this.rangoJefe = rangoJefe; + } + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/PersonaDto.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/PersonaDto.java.svn-base new file mode 100644 index 0000000..d996bf6 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/PersonaDto.java.svn-base @@ -0,0 +1,135 @@ +package com.fp.persistence.parmas.dto.ws; + +import java.io.Serializable; + +/** + * Contiene datos de la persona, sea natural o juridica + * @author dcruz + * + */ +public class PersonaDto implements Serializable{ + + private static final long serialVersionUID = 5203532003887140746L; + /** + * Codigo de la persona en la base de datos + */ + private Integer codigoPersona; + /** + * Nombre de la persona + */ + private String nombre; + /** + * Código del usuario atado a esta persona + */ + private String codigoUsuario; + /** + * Identificación de la persona + */ + private String identificacion; + /** + * Tipo de identificación de la persona + */ + private String tipoIdentificacion; + /** + * Provincia de residencia de la persona + */ + private String provincia; + /** + * Cantón de residencia de la persona + */ + private String canton; + /** + * Parroquia de residencia de la persona + */ + private String parroquia; + /** + * Dirección de residencia de la persona + */ + private String direccion; + /** + * Teléfono de domicilio de la persona + */ + private String telefono; + /** + * Representante legal en caso de ser jurídico + */ + private String representanteLegal; + /** + * Grado militar de la persona si lo posee + */ + private String grado; + + public Integer getCodigoPersona() { + return codigoPersona; + } + public void setCodigoPersona(Integer codigoPersona) { + this.codigoPersona = codigoPersona; + } + public String getNombre() { + return nombre; + } + public void setNombre(String nombre) { + this.nombre = nombre; + } + public String getIdentificacion() { + return identificacion; + } + public void setIdentificacion(String identificacion) { + this.identificacion = identificacion; + } + public String getTipoIdentificacion() { + return tipoIdentificacion; + } + public void setTipoIdentificacion(String tipoIdentificacion) { + this.tipoIdentificacion = tipoIdentificacion; + } + public String getProvincia() { + return provincia; + } + public void setProvincia(String provincia) { + this.provincia = provincia; + } + public String getCanton() { + return canton; + } + public void setCanton(String canton) { + this.canton = canton; + } + public String getParroquia() { + return parroquia; + } + public void setParroquia(String parroquia) { + this.parroquia = parroquia; + } + public String getDireccion() { + return direccion; + } + public void setDireccion(String direccion) { + this.direccion = direccion; + } + public String getTelefono() { + return telefono; + } + public void setTelefono(String telefono) { + this.telefono = telefono; + } + public String getCodigoUsuario() { + return codigoUsuario; + } + public void setCodigoUsuario(String codigoUsuario) { + this.codigoUsuario = codigoUsuario; + } + public String getRepresentanteLegal() { + return representanteLegal; + } + public void setRepresentanteLegal(String representanteLegal) { + this.representanteLegal = representanteLegal; + } + public String getGrado() { + return grado; + } + public void setGrado(String grado) { + this.grado = grado; + } + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/TramiteDto.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/TramiteDto.java.svn-base new file mode 100644 index 0000000..b7c9acd --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/.svn/text-base/TramiteDto.java.svn-base @@ -0,0 +1,68 @@ +package com.fp.persistence.parmas.dto.ws; + +import java.io.Serializable; +import java.util.Date; + +/** + * Contiene datos de los tramites de una persona + * @author Manuel Cepeda + * + */ +public class TramiteDto implements Serializable{ + + private static final long serialVersionUID = 5203532003887140746L; + + private String tramite; + private Date fechaEmision; + private Date fechaExpiracion; + private String numeroDocumento; + /** + * @return the tramite + */ + public String getTramite() { + return tramite; + } + /** + * @param tramite the tramite to set + */ + public void setTramite(String tramite) { + this.tramite = tramite; + } + /** + * @return the fechaEmision + */ + public Date getFechaEmision() { + return fechaEmision; + } + /** + * @param fechaEmision the fechaEmision to set + */ + public void setFechaEmision(Date fechaEmision) { + this.fechaEmision = fechaEmision; + } + /** + * @return the fechaExpiracion + */ + public Date getFechaExpiracion() { + return fechaExpiracion; + } + /** + * @param fechaExpiracion the fechaExpiracion to set + */ + public void setFechaExpiracion(Date fechaExpiracion) { + this.fechaExpiracion = fechaExpiracion; + } + /** + * @return the numeroDocumento + */ + public String getNumeroDocumento() { + return numeroDocumento; + } + /** + * @param numeroDocumento the numeroDocumento to set + */ + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/ArmaDto.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/ArmaDto.java new file mode 100644 index 0000000..c666c83 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/ArmaDto.java @@ -0,0 +1,134 @@ +package com.fp.persistence.parmas.dto.ws; + +import java.io.Serializable; + +/** + * DTO que transportará los datos del arma + * @author dcruz + * + */ +public class ArmaDto implements Serializable{ + + private static final long serialVersionUID = 7339086491340802876L; + /** + * id del arma en la base datos + */ + private String idArma; + /** + * serie del arma + */ + private String serie; + /** + * clase del arma + */ + private String clase; + /** + * Tipo de arma + */ + private String tipo; + /** + * Marca del arma + */ + private String marca; + /** + * Modelo del arma + */ + private String modelo; + /** + * Calibre del arma + */ + private String calibre; + /** + * Unidad o medida del arma + */ + private String unidadMedidaPeso; + /** + * Longitud arma + */ + private String longitud; + /** + * Estado del arma + */ + private String estado; + /** + * Cantidad de dicha arma + */ + private Integer cantidad; + /** + * Tag asociado al arma + */ + private String tagAsociado; + + public String getIdArma() { + return idArma; + } + public void setIdArma(String idArma) { + this.idArma = idArma; + } + public String getSerie() { + return serie; + } + public void setSerie(String serie) { + this.serie = serie; + } + public String getClase() { + return clase; + } + public void setClase(String clase) { + this.clase = clase; + } + public String getTipo() { + return tipo; + } + public void setTipo(String tipo) { + this.tipo = tipo; + } + public String getMarca() { + return marca; + } + public void setMarca(String marca) { + this.marca = marca; + } + public String getModelo() { + return modelo; + } + public void setModelo(String modelo) { + this.modelo = modelo; + } + public String getCalibre() { + return calibre; + } + public void setCalibre(String calibre) { + this.calibre = calibre; + } + public String getEstado() { + return estado; + } + public void setEstado(String estado) { + this.estado = estado; + } + public Integer getCantidad() { + return cantidad; + } + public void setCantidad(Integer cantidad) { + this.cantidad = cantidad; + } + public String getUnidadMedidaPeso() { + return unidadMedidaPeso; + } + public void setUnidadMedidaPeso(String unidadMedidaPeso) { + this.unidadMedidaPeso = unidadMedidaPeso; + } + public String getLongitud() { + return longitud; + } + public void setLongitud(String longitud) { + this.longitud = longitud; + } + public String getTagAsociado() { + return tagAsociado; + } + public void setTagAsociado(String tagAsociado) { + this.tagAsociado = tagAsociado; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/ColaImpresionDto.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/ColaImpresionDto.java new file mode 100644 index 0000000..841b251 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/ColaImpresionDto.java @@ -0,0 +1,89 @@ +package com.fp.persistence.parmas.dto.ws; + +import java.io.Serializable; +import java.sql.Timestamp; +import java.util.Date; + +/** + * DTO que contiene datos para los datos a imprimir en los documentos + * @author dcruz + * + */ +public class ColaImpresionDto implements Serializable { + + private static final long serialVersionUID = 2701742512229268659L; + + /** + * Clave identificatoria del registro impresión + */ + private String idImpresion; + /** + * Fecha de inserción del registro + */ + private Timestamp fechaRegistro; + /** + * Fecha de impresión + */ + private Date fechaImpresion; + /** + * Documento a imprimir + */ + private DocumentoDto documento; + /** + * Datos de la persona + */ + private PersonaDto persona; + /** + * Datos del arma a entregar el permiso + */ + private ArmaDto arma; + + /** + * Bandera que determina si el documento a imprimir es una autorización o un permiso + */ + private String esAutorizacion; + + public String getIdImpresion() { + return idImpresion; + } + public void setIdImpresion(String idImpresion) { + this.idImpresion = idImpresion; + } + public Timestamp getFechaRegistro() { + return fechaRegistro; + } + public void setFechaRegistro(Timestamp fechaRegistro) { + this.fechaRegistro = fechaRegistro; + } + public Date getFechaImpresion() { + return fechaImpresion; + } + public void setFechaImpresion(Date fechaImpresion) { + this.fechaImpresion = fechaImpresion; + } + public PersonaDto getPersona() { + return persona; + } + public void setPersona(PersonaDto persona) { + this.persona = persona; + } + public ArmaDto getArma() { + return arma; + } + public void setArma(ArmaDto arma) { + this.arma = arma; + } + public DocumentoDto getDocumento() { + return documento; + } + public void setDocumento(DocumentoDto documento) { + this.documento = documento; + } + public String getEsAutorizacion() { + return esAutorizacion; + } + public void setEsAutorizacion(String esAutorizacion) { + this.esAutorizacion = esAutorizacion; + } + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/DatosArmaDto.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/DatosArmaDto.java new file mode 100644 index 0000000..0c06b58 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/DatosArmaDto.java @@ -0,0 +1,200 @@ +package com.fp.persistence.parmas.dto.ws; + +import java.io.Serializable; + +/** + * Contiene datos del arma y las imagenes asociadas a una arma + * @author Manuel Cepeda + * + */ +public class DatosArmaDto implements Serializable{ + + private static final long serialVersionUID = 5203532003887140746L; + + private String lote; + private String tipoFabricacion; + private String marca; + private String modelo; + private String estadoArma; + private String tipoPermiso; + private String descripcionClase; + private String descripcionTipo; + private String calibre; + + private String imagenImpronta; + private String imagenArma; + private String fichaTecnicaArma; + + public DatosArmaDto() { + } + + /** + * @return the imagenImpronta + */ + public String getImagenImpronta() { + return imagenImpronta; + } + + /** + * @param imagenImpronta the imagenImpronta to set + */ + public void setImagenImpronta(String imagenImpronta) { + this.imagenImpronta = imagenImpronta; + } + + /** + * @return the imagenArma + */ + public String getImagenArma() { + return imagenArma; + } + + /** + * @param imagenArma the imagenArma to set + */ + public void setImagenArma(String imagenArma) { + this.imagenArma = imagenArma; + } + + /** + * @return the fichaTecnicaArma + */ + public String getFichaTecnicaArma() { + return fichaTecnicaArma; + } + + /** + * @param fichaTecnicaArma the fichaTecnicaArma to set + */ + public void setFichaTecnicaArma(String fichaTecnicaArma) { + this.fichaTecnicaArma = fichaTecnicaArma; + } + + /** + * @return the lote + */ + public String getLote() { + return lote; + } + + /** + * @param lote the lote to set + */ + public void setLote(String lote) { + this.lote = lote; + } + + /** + * @return the tipoFabricacion + */ + public String getTipoFabricacion() { + return tipoFabricacion; + } + + /** + * @param tipoFabricacion the tipoFabricacion to set + */ + public void setTipoFabricacion(String tipoFabricacion) { + this.tipoFabricacion = tipoFabricacion; + } + + /** + * @return the marca + */ + public String getMarca() { + return marca; + } + + /** + * @param marca the marca to set + */ + public void setMarca(String marca) { + this.marca = marca; + } + + /** + * @return the modelo + */ + public String getModelo() { + return modelo; + } + + /** + * @param modelo the modelo to set + */ + public void setModelo(String modelo) { + this.modelo = modelo; + } + + /** + * @return the estadoArma + */ + public String getEstadoArma() { + return estadoArma; + } + + /** + * @param estadoArma the estadoArma to set + */ + public void setEstadoArma(String estadoArma) { + this.estadoArma = estadoArma; + } + + /** + * @return the tipoPermiso + */ + public String getTipoPermiso() { + return tipoPermiso; + } + + /** + * @param tipoPermiso the tipoPermiso to set + */ + public void setTipoPermiso(String tipoPermiso) { + this.tipoPermiso = tipoPermiso; + } + + /** + * @return the descripcionClase + */ + public String getDescripcionClase() { + return descripcionClase; + } + + /** + * @param descripcionClase the descripcionClase to set + */ + public void setDescripcionClase(String descripcionClase) { + this.descripcionClase = descripcionClase; + } + + /** + * @return the descripcionTipo + */ + public String getDescripcionTipo() { + return descripcionTipo; + } + + /** + * @param descripcionTipo the descripcionTipo to set + */ + public void setDescripcionTipo(String descripcionTipo) { + this.descripcionTipo = descripcionTipo; + } + + /** + * @return the calibre + */ + public String getCalibre() { + return calibre; + } + + /** + * @param calibre the calibre to set + */ + public void setCalibre(String calibre) { + this.calibre = calibre; + } + + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/DatosSnapDto.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/DatosSnapDto.java new file mode 100644 index 0000000..43b1dd8 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/DatosSnapDto.java @@ -0,0 +1,181 @@ +package com.fp.persistence.parmas.dto.ws; + +import java.io.Serializable; +import java.util.List; + +/** + * Contiene datos de la persona, sea natural o juridica, informacion e images de armas + * @author Manuel Cepeda + * + */ +public class DatosSnapDto implements Serializable{ + + private static final long serialVersionUID = 5203532003887140746L; + /** + * Codigo de la persona en la base de datos + */ + private Integer codigoPersona; + /** + * Nombre de la razonSocial + */ + private String razonSocial; + /** + * Dirección de residencia de la persona + */ + private String direccion; + /** + * Nombre de la email + */ + private String email; + /** + * Teléfono de domicilio de la persona + */ + private String telefonoFijo; + /** + * celular de la persona + */ + private String telefonoCelular; + private String testPsicologico; + private List listaTramites; + private List listaGuardias; + + private String xPathLocation; + + + + + private List listaDatosArma; + + /** + * @return the codigoPersona + */ + public Integer getCodigoPersona() { + return codigoPersona; + } + /** + * @param codigoPersona the codigoPersona to set + */ + public void setCodigoPersona(Integer codigoPersona) { + this.codigoPersona = codigoPersona; + } + /** + * @return the razonSocial + */ + public String getRazonSocial() { + return razonSocial; + } + /** + * @param razonSocial the razonSocial to set + */ + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + /** + * @return the direccion + */ + public String getDireccion() { + return direccion; + } + /** + * @param direccion the direccion to set + */ + public void setDireccion(String direccion) { + this.direccion = direccion; + } + /** + * @return the email + */ + public String getEmail() { + return email; + } + /** + * @param email the email to set + */ + public void setEmail(String email) { + this.email = email; + } + /** + * @return the telefonoFijo + */ + public String getTelefonoFijo() { + return telefonoFijo; + } + /** + * @param telefonoFijo the telefonoFijo to set + */ + public void setTelefonoFijo(String telefonoFijo) { + this.telefonoFijo = telefonoFijo; + } + /** + * @return the telefonoCelular + */ + public String getTelefonoCelular() { + return telefonoCelular; + } + /** + * @param telefonoCelular the telefonoCelular to set + */ + public void setTelefonoCelular(String telefonoCelular) { + this.telefonoCelular = telefonoCelular; + } + /** + * @return the listaTramites + */ + public List getListaTramites() { + return listaTramites; + } + /** + * @param listaTramites the listaTramites to set + */ + public void setListaTramites(List listaTramites) { + this.listaTramites = listaTramites; + } + /** + * @return the listaGuardias + */ + public List getListaGuardias() { + return listaGuardias; + } + /** + * @param listaGuardias the listaGuardias to set + */ + public void setListaGuardias(List listaGuardias) { + this.listaGuardias = listaGuardias; + } + /** + * @return the xPathLocation + */ + public String getxPathLocation() { + return xPathLocation; + } + /** + * @param xPathLocation the xPathLocation to set + */ + public void setxPathLocation(String xPathLocation) { + this.xPathLocation = xPathLocation; + } + /** + * @return the listaDatosArma + */ + public List getListaDatosArma() { + return listaDatosArma; + } + /** + * @param listaDatosArma the listaDatosArma to set + */ + public void setListaDatosArma(List listaDatosArma) { + this.listaDatosArma = listaDatosArma; + } + /** + * @return the testPsicologico + */ + public String getTestPsicologico() { + return testPsicologico; + } + /** + * @param testPsicologico the testPsicologico to set + */ + public void setTestPsicologico(String testPsicologico) { + this.testPsicologico = testPsicologico; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/DocumentoDto.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/DocumentoDto.java new file mode 100644 index 0000000..9e52a4f --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/DocumentoDto.java @@ -0,0 +1,175 @@ +package com.fp.persistence.parmas.dto.ws; + +import java.io.Serializable; +import java.util.Date; + +/** + * Contiene datos de los documentos habilitantes + * @author dcruz + * + */ +public class DocumentoDto implements Serializable { + + private static final long serialVersionUID = -955491058987586481L; + /** + * Código del documento + */ + private Long codigoDocumento; + /** + * Número del documento + */ + private String numeroDocumento; + /** + * Fecha en la que emitió el documento + */ + private Date fechaEmision; + /** + * Fecha de expiración del documento + */ + private Date fechaExpiracion; + /** + * Número de solicitud + */ + private String numeroSolicitud; + /** + * Código del arma enlazado con el documento habilitante si es que existe + */ + private String carma; + /** + * El tipo de trámite por el que fue expedido el documento + */ + private String tipoTramite; + /** + * El trámite por el que fue expedido el documento + */ + private String tramite; + /** + * La categoría por el que fue expedido el documento + */ + private String categoria; + /** + * El uso/actividad por el que fue expedido el documento + */ + private String usoActividad; + /** + * Estado en el que se encuentra la solicitud + */ + private String estadoTramite; + + /** + * Bandera que determina si muestra la fecha de expiracion o la descripcion. + */ + private String esFechaExpiracion; + + /** + * Descripcion del documento se utiliza para + * mostrar un texto en caso que no se muestre la fecha de expiracion. + */ + private String descripcion; + + /** + * Descripcion1 del documento se utiliza para + * mostrar el texto de la jurisdiccion(Ecuador, Canton, Parroquia, Provincia). + * Se concatena descripcion1+descripcion2 + */ + private String descripcion1; + + /** + * Descripcion2 del documento se utiliza para + * mostrar el texto del pie del tramite. + * Se concatena descripcion1+descripcion2 + */ + private String descripcion2; + + public Long getCodigoDocumento() { + return codigoDocumento; + } + public void setCodigoDocumento(Long codigoDocumento) { + this.codigoDocumento = codigoDocumento; + } + public String getNumeroDocumento() { + return numeroDocumento; + } + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + public Date getFechaEmision() { + return fechaEmision; + } + public void setFechaEmision(Date fechaEmision) { + this.fechaEmision = fechaEmision; + } + public Date getFechaExpiracion() { + return fechaExpiracion; + } + public void setFechaExpiracion(Date fechaExpiracion) { + this.fechaExpiracion = fechaExpiracion; + } + public String getNumeroSolicitud() { + return numeroSolicitud; + } + public void setNumeroSolicitud(String numeroSolicitud) { + this.numeroSolicitud = numeroSolicitud; + } + public String getCarma() { + return carma; + } + public void setCarma(String carma) { + this.carma = carma; + } + public String getTipoTramite() { + return tipoTramite; + } + public void setTipoTramite(String tipoTramite) { + this.tipoTramite = tipoTramite; + } + public String getTramite() { + return tramite; + } + public void setTramite(String tramite) { + this.tramite = tramite; + } + public String getCategoria() { + return categoria; + } + public void setCategoria(String categoria) { + this.categoria = categoria; + } + public String getUsoActividad() { + return usoActividad; + } + public void setUsoActividad(String usoActividad) { + this.usoActividad = usoActividad; + } + public String getEstadoTramite() { + return estadoTramite; + } + public void setEstadoTramite(String estadoTramite) { + this.estadoTramite = estadoTramite; + } + public String getEsFechaExpiracion() { + return esFechaExpiracion; + } + public void setEsFechaExpiracion(String esFechaExpiracion) { + this.esFechaExpiracion = esFechaExpiracion; + } + public String getDescripcion() { + return descripcion; + } + public void setDescripcion(String descripcion) { + this.descripcion = descripcion; + } + public String getDescripcion1() { + return descripcion1; + } + public void setDescripcion1(String descripcion1) { + this.descripcion1 = descripcion1; + } + public String getDescripcion2() { + return descripcion2; + } + public void setDescripcion2(String descripcion2) { + this.descripcion2 = descripcion2; + } + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/ImagenDto.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/ImagenDto.java new file mode 100644 index 0000000..39e0da1 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/ImagenDto.java @@ -0,0 +1,60 @@ +package com.fp.persistence.parmas.dto.ws; + +import java.io.Serializable; + +public class ImagenDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * Código de la imagen + */ + private Integer codigoImagen; + /** + * Content type de la imagen + */ + private String tipoContenido; + /** + * La imagen en bytes + */ + private byte[] imagen; + /** + * La extensión de la imagen + */ + private String extension; + /** + * Size de la imagen + */ + private Integer tamanioImagen; + public Integer getCodigoImagen() { + return codigoImagen; + } + public void setCodigoImagen(Integer codigoImagen) { + this.codigoImagen = codigoImagen; + } + public String getTipoContenido() { + return tipoContenido; + } + public void setTipoContenido(String tipoContenido) { + this.tipoContenido = tipoContenido; + } + public byte[] getImagen() { + return imagen; + } + public void setImagen(byte[] imagen) { + this.imagen = imagen; + } + public String getExtension() { + return extension; + } + public void setExtension(String extension) { + this.extension = extension; + } + public Integer getTamanioImagen() { + return tamanioImagen; + } + public void setTamanioImagen(Integer tamanioImagen) { + this.tamanioImagen = tamanioImagen; + } + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/InfoGuardiaDto.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/InfoGuardiaDto.java new file mode 100644 index 0000000..5f554b3 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/InfoGuardiaDto.java @@ -0,0 +1,59 @@ +package com.fp.persistence.parmas.dto.ws; + +import java.io.Serializable; +import java.util.Date; + +/** + * Contiene datos de los guardias que tienes una empresa y los datos del guardia + * @author Manuel Cepeda + * + */ +public class InfoGuardiaDto implements Serializable{ + + private static final long serialVersionUID = 5203532003887140746L; + + private String nombre; + private String estado; + private String empresa; + + public InfoGuardiaDto() { + } + + /** + * @return the nombre + */ + public String getNombre() { + return nombre; + } + /** + * @param nombre the nombre to set + */ + public void setNombre(String nombre) { + this.nombre = nombre; + } + /** + * @return the estado + */ + public String getEstado() { + return estado; + } + /** + * @param estado the estado to set + */ + public void setEstado(String estado) { + this.estado = estado; + } + /** + * @return the empresa + */ + public String getEmpresa() { + return empresa; + } + /** + * @param empresa the empresa to set + */ + public void setEmpresa(String empresa) { + this.empresa = empresa; + } + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/JefeCentroControlDto.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/JefeCentroControlDto.java new file mode 100644 index 0000000..f5154e7 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/JefeCentroControlDto.java @@ -0,0 +1,56 @@ +package com.fp.persistence.parmas.dto.ws; + +import java.io.Serializable; + +/** + * DTO que contiene los datos del jefe del centro de control centro de control + * @author dcruz + * + */ +public class JefeCentroControlDto implements Serializable { + + private static final long serialVersionUID = 443509338679825612L; + + /** + * Nombre del jefe del centro de control + */ + private String nombre; + /** + * Ubicación del centro de control + */ + private String ubicacion; + /** + * Firma del jefe del centro de control + */ + private byte[] firma; + /** + * Rango del jefe de centro de impresión + */ + private String rangoJefe; + + public String getNombre() { + return nombre; + } + public void setNombre(String nombre) { + this.nombre = nombre; + } + public String getUbicacion() { + return ubicacion; + } + public void setUbicacion(String ubicacion) { + this.ubicacion = ubicacion; + } + public byte[] getFirma() { + return firma; + } + public void setFirma(byte[] firma) { + this.firma = firma; + } + public String getRangoJefe() { + return rangoJefe; + } + public void setRangoJefe(String rangoJefe) { + this.rangoJefe = rangoJefe; + } + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/PersonaDto.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/PersonaDto.java new file mode 100644 index 0000000..d996bf6 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/PersonaDto.java @@ -0,0 +1,135 @@ +package com.fp.persistence.parmas.dto.ws; + +import java.io.Serializable; + +/** + * Contiene datos de la persona, sea natural o juridica + * @author dcruz + * + */ +public class PersonaDto implements Serializable{ + + private static final long serialVersionUID = 5203532003887140746L; + /** + * Codigo de la persona en la base de datos + */ + private Integer codigoPersona; + /** + * Nombre de la persona + */ + private String nombre; + /** + * Código del usuario atado a esta persona + */ + private String codigoUsuario; + /** + * Identificación de la persona + */ + private String identificacion; + /** + * Tipo de identificación de la persona + */ + private String tipoIdentificacion; + /** + * Provincia de residencia de la persona + */ + private String provincia; + /** + * Cantón de residencia de la persona + */ + private String canton; + /** + * Parroquia de residencia de la persona + */ + private String parroquia; + /** + * Dirección de residencia de la persona + */ + private String direccion; + /** + * Teléfono de domicilio de la persona + */ + private String telefono; + /** + * Representante legal en caso de ser jurídico + */ + private String representanteLegal; + /** + * Grado militar de la persona si lo posee + */ + private String grado; + + public Integer getCodigoPersona() { + return codigoPersona; + } + public void setCodigoPersona(Integer codigoPersona) { + this.codigoPersona = codigoPersona; + } + public String getNombre() { + return nombre; + } + public void setNombre(String nombre) { + this.nombre = nombre; + } + public String getIdentificacion() { + return identificacion; + } + public void setIdentificacion(String identificacion) { + this.identificacion = identificacion; + } + public String getTipoIdentificacion() { + return tipoIdentificacion; + } + public void setTipoIdentificacion(String tipoIdentificacion) { + this.tipoIdentificacion = tipoIdentificacion; + } + public String getProvincia() { + return provincia; + } + public void setProvincia(String provincia) { + this.provincia = provincia; + } + public String getCanton() { + return canton; + } + public void setCanton(String canton) { + this.canton = canton; + } + public String getParroquia() { + return parroquia; + } + public void setParroquia(String parroquia) { + this.parroquia = parroquia; + } + public String getDireccion() { + return direccion; + } + public void setDireccion(String direccion) { + this.direccion = direccion; + } + public String getTelefono() { + return telefono; + } + public void setTelefono(String telefono) { + this.telefono = telefono; + } + public String getCodigoUsuario() { + return codigoUsuario; + } + public void setCodigoUsuario(String codigoUsuario) { + this.codigoUsuario = codigoUsuario; + } + public String getRepresentanteLegal() { + return representanteLegal; + } + public void setRepresentanteLegal(String representanteLegal) { + this.representanteLegal = representanteLegal; + } + public String getGrado() { + return grado; + } + public void setGrado(String grado) { + this.grado = grado; + } + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/TramiteDto.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/TramiteDto.java new file mode 100644 index 0000000..b7c9acd --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/dto/ws/TramiteDto.java @@ -0,0 +1,68 @@ +package com.fp.persistence.parmas.dto.ws; + +import java.io.Serializable; +import java.util.Date; + +/** + * Contiene datos de los tramites de una persona + * @author Manuel Cepeda + * + */ +public class TramiteDto implements Serializable{ + + private static final long serialVersionUID = 5203532003887140746L; + + private String tramite; + private Date fechaEmision; + private Date fechaExpiracion; + private String numeroDocumento; + /** + * @return the tramite + */ + public String getTramite() { + return tramite; + } + /** + * @param tramite the tramite to set + */ + public void setTramite(String tramite) { + this.tramite = tramite; + } + /** + * @return the fechaEmision + */ + public Date getFechaEmision() { + return fechaEmision; + } + /** + * @param fechaEmision the fechaEmision to set + */ + public void setFechaEmision(Date fechaEmision) { + this.fechaEmision = fechaEmision; + } + /** + * @return the fechaExpiracion + */ + public Date getFechaExpiracion() { + return fechaExpiracion; + } + /** + * @param fechaExpiracion the fechaExpiracion to set + */ + public void setFechaExpiracion(Date fechaExpiracion) { + this.fechaExpiracion = fechaExpiracion; + } + /** + * @return the numeroDocumento + */ + public String getNumeroDocumento() { + return numeroDocumento; + } + /** + * @param numeroDocumento the numeroDocumento to set + */ + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/.svn/entries b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/.svn/entries new file mode 100644 index 0000000..0505c10 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/.svn/entries @@ -0,0 +1,164 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval +svn://172.17.26.185/COMACO + + + +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TarmRespuestas.java +file + + + + +2022-07-28T03:40:28.058740Z +56daa6d24bc4a1c3dbb1fd84a615ba87 +2015-04-24T07:30:01.320551Z +4057 +dlopez + + + + + + + + + + + + + + + + + + + + + +5612 + +TarmDetallePreguntas.java +file + + + + +2022-07-28T03:40:28.058740Z +3da7fcb9ea74ab76e235d881f591692d +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +5590 + +TarmEvaluacion.java +file + + + + +2022-07-28T03:40:28.059740Z +de7adf2c428173c0a5fe2c191d6f5658 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +12716 + +TarmPreguntas.java +file + + + + +2022-07-28T03:40:28.059740Z +50f3384016467512199c7e90003ba864 +2015-01-08T09:24:45.800079Z +3722 +cpiedra + + + + + + + + + + + + + + + + + + + + + +7625 + diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/.svn/text-base/TarmDetallePreguntas.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/.svn/text-base/TarmDetallePreguntas.java.svn-base new file mode 100644 index 0000000..a2480a7 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/.svn/text-base/TarmDetallePreguntas.java.svn-base @@ -0,0 +1,201 @@ +package com.fp.persistence.parmas.eval; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMDETALLEPREGUNTAS*/ +@Entity(name="TarmDetallePreguntas") +@Table(name="TARMDETALLEPREGUNTAS") +public class TarmDetallePreguntas extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmDetallePreguntas +*/ +@Id +@Column(name="CDETALLEPREGUNTAS" ,nullable=false, updatable=false) +private String pk; +@Column(name="CEVALUACION", nullable=true) + +/** +* Referencia a la Evaluacion +*/ +private String cevaluacion; + +@Column(name="CRESPUESTACORRECTA", nullable=true) + +/** +* Referencia a la respuesta correcta de una pregunta + +*/ +private Integer crespuestacorrecta; + +@Column(name="CPREGUNTA", nullable=true) + +/** +* Referencia a la Pregunta + +*/ +private Integer cpregunta; + +@Column(name="CRESPUESTAINGRESADA", nullable=true) + +/** +* Referencia a la Respuesta Ingresada por el usuario + +*/ +private Integer crespuestaingresada; + +/**Contructor por defecto*/ +public TarmDetallePreguntas(){ +} +/**Contructor de TarmDetallePreguntas +@param pPk Clave Primaria del entity +*/ +public TarmDetallePreguntas(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmDetallePreguntas +*/ +public static TarmDetallePreguntas find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmDetallePreguntas obj = pEntityManager.find(TarmDetallePreguntas.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmDetallePreguntas +@return El objeto que referencia a la Clave primaria de TarmDetallePreguntas +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmDetallePreguntas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmDetallePreguntas +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de cevaluacion +@return valor de cevaluacion*/ +public String getCevaluacion(){ + return cevaluacion; +} +/**Fija el valor de cevaluacion +@param pCevaluacion nuevo Valor de cevaluacion*/ +public void setCevaluacion(String pCevaluacion){ + cevaluacion=pCevaluacion; +} + +/**Obtiene el valor de crespuestacorrecta +@return valor de crespuestacorrecta*/ +public Integer getCrespuestacorrecta(){ + return crespuestacorrecta; +} +/**Fija el valor de crespuestacorrecta +@param pCrespuestacorrecta nuevo Valor de crespuestacorrecta*/ +public void setCrespuestacorrecta(Integer pCrespuestacorrecta){ + crespuestacorrecta=pCrespuestacorrecta; +} + +/**Obtiene el valor de cpregunta +@return valor de cpregunta*/ +public Integer getCpregunta(){ + return cpregunta; +} +/**Fija el valor de cpregunta +@param pCpregunta nuevo Valor de cpregunta*/ +public void setCpregunta(Integer pCpregunta){ + cpregunta=pCpregunta; +} + +/**Obtiene el valor de crespuestaingresada +@return valor de crespuestaingresada*/ +public Integer getCrespuestaingresada(){ + return crespuestaingresada; +} +/**Fija el valor de crespuestaingresada +@param pCrespuestaingresada nuevo Valor de crespuestaingresada*/ +public void setCrespuestaingresada(Integer pCrespuestaingresada){ + crespuestaingresada=pCrespuestaingresada; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmDetallePreguntas))return false; + TarmDetallePreguntas that = (TarmDetallePreguntas) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmDetallePreguntas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmDetallePreguntas +*/ +public Object createInstance(){ + TarmDetallePreguntas instance=new TarmDetallePreguntas(); + return instance; +} +/**Clona la entidad TarmDetallePreguntas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmDetallePreguntas p=(TarmDetallePreguntas)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/.svn/text-base/TarmEvaluacion.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/.svn/text-base/TarmEvaluacion.java.svn-base new file mode 100644 index 0000000..e2d30bd --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/.svn/text-base/TarmEvaluacion.java.svn-base @@ -0,0 +1,514 @@ +package com.fp.persistence.parmas.eval; + +import javax.persistence.Entity; + +import java.sql.Timestamp; + +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMEVALUACION*/ +@Entity(name="TarmEvaluacion") +@Table(name="TARMEVALUACION") +public class TarmEvaluacion extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmEvaluacion +*/ +@Id +@Column(name="CEVALUACION" ,nullable=false, updatable=false) +private String pk; +@Column(name="TIPOEVALUACION", nullable=true) + +/** +* Codigo de catalogo 01 Conocimiento Guardias, 02 Conocimiento Particulares +*/ +private String tipoevaluacion; + +@Column(name="FECHA", nullable=true) + +/** +* Fecha en la que se rindio la evaluacin +*/ +private Timestamp fecha; + +@Column(name="INTENTO", nullable=true) + +/** +* # de Intento en la evaluacin +*/ +private Long intento; + +@Column(name="CENTROMEDICO", nullable=true) + +/** +* null +*/ +private String centromedico; + +@Column(name="VIGENTE", nullable=true) + +/** +* null +*/ +private String vigente; + +@Column(name="FECHADEPOSITO", nullable=true) + +/** +* null +*/ +private Date fechadeposito; + +@Column(name="NOPAPELETA", nullable=true) + +/** +* null +*/ +private String nopapeleta; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona a ser evaluada +*/ +private Integer personcode; + +@Column(name="TIPOEVALUACIONCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de evaluacin +*/ +private String tipoevaluacioncodigo; + +@Column(name="FECHAEXPIRACION", nullable=true) + +/** +* FECHA DE EXPIRACON DE LA EVALUACION +*/ +private Date fechaexpiracion; + +@Column(name="FREGISTRO", nullable=true) + +/** +* null +*/ +private Timestamp fregistro; + +@Column(name="RESULTADOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de resultado + +*/ +private String resultadocodigo; + +@Column(name="PSICOLOGORESPONSABLE", nullable=true) + +/** +* NOMBRE DEL DOCTOR PSICOLOGO RESPONSABLE DE LA EVALUACION PSICOLOGICA +*/ +private String psicologoresponsable; + +@Column(name="OBSERVACION", nullable=true) + +/** +* OBSERVACIONES DENTRO DE LA EVALUACION PSICOLOGICA +*/ +private String observacion; + +@Column(name="FECHAPREOX", nullable=true) + +/** +* Fecha en la cual puede volver a rendir la evalaucion +*/ +private Date fechapreox; + +@Column(name="INFORMEXPATH", nullable=true) + +/** +* PATH DONDE SE ALMACENA LA INFORMACION DE LA EVALUACION PSICOLOGICA +*/ +private String informexpath; + +@Column(name="RESULTADO", nullable=true) + +/** +* Codigo de catalogo 01 Aprobado, 02 Reprobado +*/ +private String resultado; + +@Column(name="CENTROMEDICOCODE", nullable=true) + +/** +* null +*/ +private String centromedicocode; + +@Column(name="EMPRESAPERSONCODE", nullable=true) + +/** +* null +*/ +private Integer empresapersoncode; + +@Column(name="TIPDOCPSICOLOGO", nullable=true) + +/** +* null +*/ +private String tipdocpsicologo; + +@Column(name="TIPDOCCODEPSICOLOGO", nullable=true) + +/** +* null +*/ +private String tipdoccodepsicologo; + +@Column(name="NUMDOCPSICOLOGO", nullable=true) + +/** +* null +*/ +private String numdocpsicologo; + +/**Contructor por defecto*/ +public TarmEvaluacion(){ +} +/**Contructor de TarmEvaluacion +@param pPk Clave Primaria del entity +*/ +public TarmEvaluacion(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmEvaluacion +*/ +public static TarmEvaluacion find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmEvaluacion obj = pEntityManager.find(TarmEvaluacion.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmEvaluacion +@return El objeto que referencia a la Clave primaria de TarmEvaluacion +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmEvaluacion +@param pPk El objeto que referencia a la nueva Clave primaria de TarmEvaluacion +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de tipoevaluacion +@return valor de tipoevaluacion*/ +public String getTipoevaluacion(){ + return tipoevaluacion; +} +/**Fija el valor de tipoevaluacion +@param pTipoevaluacion nuevo Valor de tipoevaluacion*/ +public void setTipoevaluacion(String pTipoevaluacion){ + tipoevaluacion=pTipoevaluacion; +} + +/**Obtiene el valor de fecha +@return valor de fecha*/ +public Timestamp getFecha(){ + return fecha; +} +/**Fija el valor de fecha +@param pFecha nuevo Valor de fecha*/ +public void setFecha(Timestamp pFecha){ + fecha=pFecha; +} + +/**Obtiene el valor de intento +@return valor de intento*/ +public Long getIntento(){ + return intento; +} +/**Fija el valor de intento +@param pIntento nuevo Valor de intento*/ +public void setIntento(Long pIntento){ + intento=pIntento; +} + +/**Obtiene el valor de centromedico +@return valor de centromedico*/ +public String getCentromedico(){ + return centromedico; +} +/**Fija el valor de centromedico +@param pCentromedico nuevo Valor de centromedico*/ +public void setCentromedico(String pCentromedico){ + centromedico=pCentromedico; +} + +/**Obtiene el valor de vigente +@return valor de vigente*/ +public String getVigente(){ + return vigente; +} +/**Fija el valor de vigente +@param pVigente nuevo Valor de vigente*/ +public void setVigente(String pVigente){ + vigente=pVigente; +} + +/**Obtiene el valor de fechadeposito +@return valor de fechadeposito*/ +public Date getFechadeposito(){ + return fechadeposito; +} +/**Fija el valor de fechadeposito +@param pFechadeposito nuevo Valor de fechadeposito*/ +public void setFechadeposito(Date pFechadeposito){ + fechadeposito=pFechadeposito; +} + +/**Obtiene el valor de nopapeleta +@return valor de nopapeleta*/ +public String getNopapeleta(){ + return nopapeleta; +} +/**Fija el valor de nopapeleta +@param pNopapeleta nuevo Valor de nopapeleta*/ +public void setNopapeleta(String pNopapeleta){ + nopapeleta=pNopapeleta; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de tipoevaluacioncodigo +@return valor de tipoevaluacioncodigo*/ +public String getTipoevaluacioncodigo(){ + return tipoevaluacioncodigo; +} +/**Fija el valor de tipoevaluacioncodigo +@param pTipoevaluacioncodigo nuevo Valor de tipoevaluacioncodigo*/ +public void setTipoevaluacioncodigo(String pTipoevaluacioncodigo){ + tipoevaluacioncodigo=pTipoevaluacioncodigo; +} + +/**Obtiene el valor de fechaexpiracion +@return valor de fechaexpiracion*/ +public Date getFechaexpiracion(){ + return fechaexpiracion; +} +/**Fija el valor de fechaexpiracion +@param pFechaexpiracion nuevo Valor de fechaexpiracion*/ +public void setFechaexpiracion(Date pFechaexpiracion){ + fechaexpiracion=pFechaexpiracion; +} + +/**Obtiene el valor de fregistro +@return valor de fregistro*/ +public Timestamp getFregistro(){ + return fregistro; +} +/**Fija el valor de fregistro +@param pFregistro nuevo Valor de fregistro*/ +public void setFregistro(Timestamp pFregistro){ + fregistro=pFregistro; +} + +/**Obtiene el valor de resultadocodigo +@return valor de resultadocodigo*/ +public String getResultadocodigo(){ + return resultadocodigo; +} +/**Fija el valor de resultadocodigo +@param pResultadocodigo nuevo Valor de resultadocodigo*/ +public void setResultadocodigo(String pResultadocodigo){ + resultadocodigo=pResultadocodigo; +} + +/**Obtiene el valor de psicologoresponsable +@return valor de psicologoresponsable*/ +public String getPsicologoresponsable(){ + return psicologoresponsable; +} +/**Fija el valor de psicologoresponsable +@param pPsicologoresponsable nuevo Valor de psicologoresponsable*/ +public void setPsicologoresponsable(String pPsicologoresponsable){ + psicologoresponsable=pPsicologoresponsable; +} + +/**Obtiene el valor de observacion +@return valor de observacion*/ +public String getObservacion(){ + return observacion; +} +/**Fija el valor de observacion +@param pObservacion nuevo Valor de observacion*/ +public void setObservacion(String pObservacion){ + observacion=pObservacion; +} + +/**Obtiene el valor de fechapreox +@return valor de fechapreox*/ +public Date getFechapreox(){ + return fechapreox; +} +/**Fija el valor de fechapreox +@param pFechapreox nuevo Valor de fechapreox*/ +public void setFechapreox(Date pFechapreox){ + fechapreox=pFechapreox; +} + +/**Obtiene el valor de informexpath +@return valor de informexpath*/ +public String getInformexpath(){ + return informexpath; +} +/**Fija el valor de informexpath +@param pInformexpath nuevo Valor de informexpath*/ +public void setInformexpath(String pInformexpath){ + informexpath=pInformexpath; +} + +/**Obtiene el valor de resultado +@return valor de resultado*/ +public String getResultado(){ + return resultado; +} +/**Fija el valor de resultado +@param pResultado nuevo Valor de resultado*/ +public void setResultado(String pResultado){ + resultado=pResultado; +} + +/**Obtiene el valor de centromedicocode +@return valor de centromedicocode*/ +public String getCentromedicocode(){ + return centromedicocode; +} +/**Fija el valor de centromedicocode +@param pCentromedicocode nuevo Valor de centromedicocode*/ +public void setCentromedicocode(String pCentromedicocode){ + centromedicocode=pCentromedicocode; +} + +/**Obtiene el valor de empresapersoncode +@return valor de empresapersoncode*/ +public Integer getEmpresapersoncode(){ + return empresapersoncode; +} +/**Fija el valor de empresapersoncode +@param pEmpresapersoncode nuevo Valor de empresapersoncode*/ +public void setEmpresapersoncode(Integer pEmpresapersoncode){ + empresapersoncode=pEmpresapersoncode; +} + +public String getTipdocpsicologo() { + return tipdocpsicologo; +} +public void setTipdocpsicologo(String tipdocpsicologo) { + this.tipdocpsicologo = tipdocpsicologo; +} +public String getTipdoccodepsicologo() { + return tipdoccodepsicologo; +} +public void setTipdoccodepsicologo(String tipdoccodepsicologo) { + this.tipdoccodepsicologo = tipdoccodepsicologo; +} +public String getNumdocpsicologo() { + return numdocpsicologo; +} +public void setNumdocpsicologo(String numdocpsicologo) { + this.numdocpsicologo = numdocpsicologo; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmEvaluacion))return false; + TarmEvaluacion that = (TarmEvaluacion) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmEvaluacion +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmEvaluacion +*/ +public Object createInstance(){ + TarmEvaluacion instance=new TarmEvaluacion(); + return instance; +} +/**Clona la entidad TarmEvaluacion +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmEvaluacion p=(TarmEvaluacion)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/.svn/text-base/TarmPreguntas.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/.svn/text-base/TarmPreguntas.java.svn-base new file mode 100644 index 0000000..db6bcd6 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/.svn/text-base/TarmPreguntas.java.svn-base @@ -0,0 +1,281 @@ +package com.fp.persistence.parmas.eval; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMPREGUNTAS*/ +@Entity(name="TarmPreguntas") +@Table(name="TARMPREGUNTAS") +public class TarmPreguntas extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmPreguntas +*/ +@Id +@Column(name="CPREGUNTA" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "TARMPREGUNTAS"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.Number"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "8")}) + @GeneratedValue(generator = "seq_id") +private Integer pk; +@Column(name="TIPOEVALUACION", nullable=true) + +/** +* null +*/ +private String tipoevaluacion; + +@Column(name="TIPOEVALUACIONCODIGO", nullable=true) + +/** +* null +*/ +private String tipoevaluacioncodigo; + +@Column(name="TIPOPERSONA", nullable=true) + +/** +* null +*/ +private String tipopersona; + +@Column(name="TIPOPERSONACODIGO", nullable=true) + +/** +* null +*/ +private String tipopersonacodigo; + +@Column(name="DESCRIPCION", nullable=true) + +/** +* null +*/ +private String descripcion; + +@Column(name="NUMEROPREGUNTA", nullable=true) + +/** +* null +*/ +private Integer numeropregunta; + +@Column(name="ESTADOPREGUNTA", nullable=true) + +/** +* null +*/ +private String estadopregunta; + +@Column(name="ESTADOPREGUNTACODIGO", nullable=true) + +/** +* null +*/ +private String estadopreguntacodigo; + + +/**Contructor por defecto*/ +public TarmPreguntas(){ +} +/**Contructor de TarmPreguntas +@param pPk Clave Primaria del entity +*/ +public TarmPreguntas(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmPreguntas +*/ +public static TarmPreguntas find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmPreguntas obj = pEntityManager.find(TarmPreguntas.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmPreguntas +@return El objeto que referencia a la Clave primaria de TarmPreguntas +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmPreguntas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmPreguntas +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de tipoevaluacion +@return valor de tipoevaluacion*/ +public String getTipoevaluacion(){ + return tipoevaluacion; +} +/**Fija el valor de tipoevaluacion +@param pTipoevaluacion nuevo Valor de tipoevaluacion*/ +public void setTipoevaluacion(String pTipoevaluacion){ + tipoevaluacion=pTipoevaluacion; +} + +/**Obtiene el valor de tipoevaluacioncodigo +@return valor de tipoevaluacioncodigo*/ +public String getTipoevaluacioncodigo(){ + return tipoevaluacioncodigo; +} +/**Fija el valor de tipoevaluacioncodigo +@param pTipoevaluacioncodigo nuevo Valor de tipoevaluacioncodigo*/ +public void setTipoevaluacioncodigo(String pTipoevaluacioncodigo){ + tipoevaluacioncodigo=pTipoevaluacioncodigo; +} + +/**Obtiene el valor de tipopersona +@return valor de tipopersona*/ +public String getTipopersona(){ + return tipopersona; +} +/**Fija el valor de tipopersona +@param pTipopersona nuevo Valor de tipopersona*/ +public void setTipopersona(String pTipopersona){ + tipopersona=pTipopersona; +} + +/**Obtiene el valor de tipopersonacodigo +@return valor de tipopersonacodigo*/ +public String getTipopersonacodigo(){ + return tipopersonacodigo; +} +/**Fija el valor de tipopersonacodigo +@param pTipopersonacodigo nuevo Valor de tipopersonacodigo*/ +public void setTipopersonacodigo(String pTipopersonacodigo){ + tipopersonacodigo=pTipopersonacodigo; +} + +/**Obtiene el valor de descripcion +@return valor de descripcion*/ +public String getDescripcion(){ + return descripcion; +} +/**Fija el valor de descripcion +@param pDescripcion nuevo Valor de descripcion*/ +public void setDescripcion(String pDescripcion){ + descripcion=pDescripcion; +} + +/**Obtiene el valor de numeropregunta +@return valor de numeropregunta*/ +public Integer getNumeropregunta(){ + return numeropregunta; +} +/**Fija el valor de numeropregunta +@param pNumeropregunta nuevo Valor de numeropregunta*/ +public void setNumeropregunta(Integer pNumeropregunta){ + numeropregunta=pNumeropregunta; +} + +/**Obtiene el valor de estadopregunta +@return valor de estadopregunta*/ +public String getEstadopregunta() { + return estadopregunta; +} +/**Fija el valor de estadopregunta +@param pDescripcion nuevo Valor de estadopregunta*/ +public void setEstadopregunta(String estadopregunta) { + this.estadopregunta = estadopregunta; +} + +/**Obtiene el valor de estadopreguntacodigo +@return valor de estadopreguntacodigo*/ +public String getEstadopreguntacodigo() { + return estadopreguntacodigo; +} +/**Fija el valor de estadopreguntacodigo +@param pDescripcion nuevo Valor de estadopreguntacodigo*/ +public void setEstadopreguntacodigo(String estadopreguntacodigo) { + this.estadopreguntacodigo = estadopreguntacodigo; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmPreguntas))return false; + TarmPreguntas that = (TarmPreguntas) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmPreguntas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmPreguntas +*/ +public Object createInstance(){ + TarmPreguntas instance=new TarmPreguntas(); + return instance; +} +/**Clona la entidad TarmPreguntas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmPreguntas p=(TarmPreguntas)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/.svn/text-base/TarmRespuestas.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/.svn/text-base/TarmRespuestas.java.svn-base new file mode 100644 index 0000000..f665c28 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/.svn/text-base/TarmRespuestas.java.svn-base @@ -0,0 +1,209 @@ +package com.fp.persistence.parmas.eval; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMRESPUESTAS*/ +@Entity(name="TarmRespuestas") +@Table(name="TARMRESPUESTAS") +public class TarmRespuestas extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmRespuestas +*/ +@Id +@Column(name="CRESPUESTA" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "TARMRESPUESTAS"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.Number"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "8")}) + @GeneratedValue(generator = "seq_id") +private Integer pk; +@Column(name="CPREGUNTA", nullable=true) + +/** +* null +*/ +private Integer cpregunta; + +@Column(name="DESCRIPCION", nullable=true) + +/** +* null +*/ +private String descripcion; + +@Column(name="ESCORRECTA", nullable=true) + +/** +* null +*/ +private String escorrecta; + +@Column(name="ISACTIVE", nullable=true) + +/** +* null +*/ +private String isactive; + +/**Contructor por defecto*/ +public TarmRespuestas(){ +} +/**Contructor de TarmRespuestas +@param pPk Clave Primaria del entity +*/ +public TarmRespuestas(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmRespuestas +*/ +public static TarmRespuestas find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmRespuestas obj = pEntityManager.find(TarmRespuestas.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmRespuestas +@return El objeto que referencia a la Clave primaria de TarmRespuestas +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmRespuestas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmRespuestas +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de cpregunta +@return valor de cpregunta*/ +public Integer getCpregunta(){ + return cpregunta; +} +/**Fija el valor de cpregunta +@param pCpregunta nuevo Valor de cpregunta*/ +public void setCpregunta(Integer pCpregunta){ + cpregunta=pCpregunta; +} + +/**Obtiene el valor de descripcion +@return valor de descripcion*/ +public String getDescripcion(){ + return descripcion; +} +/**Fija el valor de descripcion +@param pDescripcion nuevo Valor de descripcion*/ +public void setDescripcion(String pDescripcion){ + descripcion=pDescripcion; +} + +/**Obtiene el valor de escorrecta +@return valor de escorrecta*/ +public String getEscorrecta(){ + return escorrecta; +} +/**Fija el valor de escorrecta +@param pEscorrecta nuevo Valor de escorrecta*/ +public void setEscorrecta(String pEscorrecta){ + escorrecta=pEscorrecta; +} + +/**Obtiene el valor de escorrecta +@return valor de escorrecta*/ +public String getIsactive() { + return isactive; +} + +/**Fija el valor de escorrecta +@param pEscorrecta nuevo Valor de escorrecta*/ +public void setIsactive(String pIsactive) { + this.isactive = pIsactive; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmRespuestas))return false; + TarmRespuestas that = (TarmRespuestas) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmRespuestas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmRespuestas +*/ +public Object createInstance(){ + TarmRespuestas instance=new TarmRespuestas(); + return instance; +} +/**Clona la entidad TarmRespuestas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmRespuestas p=(TarmRespuestas)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/TarmDetallePreguntas.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/TarmDetallePreguntas.java new file mode 100644 index 0000000..a2480a7 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/TarmDetallePreguntas.java @@ -0,0 +1,201 @@ +package com.fp.persistence.parmas.eval; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMDETALLEPREGUNTAS*/ +@Entity(name="TarmDetallePreguntas") +@Table(name="TARMDETALLEPREGUNTAS") +public class TarmDetallePreguntas extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmDetallePreguntas +*/ +@Id +@Column(name="CDETALLEPREGUNTAS" ,nullable=false, updatable=false) +private String pk; +@Column(name="CEVALUACION", nullable=true) + +/** +* Referencia a la Evaluacion +*/ +private String cevaluacion; + +@Column(name="CRESPUESTACORRECTA", nullable=true) + +/** +* Referencia a la respuesta correcta de una pregunta + +*/ +private Integer crespuestacorrecta; + +@Column(name="CPREGUNTA", nullable=true) + +/** +* Referencia a la Pregunta + +*/ +private Integer cpregunta; + +@Column(name="CRESPUESTAINGRESADA", nullable=true) + +/** +* Referencia a la Respuesta Ingresada por el usuario + +*/ +private Integer crespuestaingresada; + +/**Contructor por defecto*/ +public TarmDetallePreguntas(){ +} +/**Contructor de TarmDetallePreguntas +@param pPk Clave Primaria del entity +*/ +public TarmDetallePreguntas(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmDetallePreguntas +*/ +public static TarmDetallePreguntas find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmDetallePreguntas obj = pEntityManager.find(TarmDetallePreguntas.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmDetallePreguntas +@return El objeto que referencia a la Clave primaria de TarmDetallePreguntas +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmDetallePreguntas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmDetallePreguntas +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de cevaluacion +@return valor de cevaluacion*/ +public String getCevaluacion(){ + return cevaluacion; +} +/**Fija el valor de cevaluacion +@param pCevaluacion nuevo Valor de cevaluacion*/ +public void setCevaluacion(String pCevaluacion){ + cevaluacion=pCevaluacion; +} + +/**Obtiene el valor de crespuestacorrecta +@return valor de crespuestacorrecta*/ +public Integer getCrespuestacorrecta(){ + return crespuestacorrecta; +} +/**Fija el valor de crespuestacorrecta +@param pCrespuestacorrecta nuevo Valor de crespuestacorrecta*/ +public void setCrespuestacorrecta(Integer pCrespuestacorrecta){ + crespuestacorrecta=pCrespuestacorrecta; +} + +/**Obtiene el valor de cpregunta +@return valor de cpregunta*/ +public Integer getCpregunta(){ + return cpregunta; +} +/**Fija el valor de cpregunta +@param pCpregunta nuevo Valor de cpregunta*/ +public void setCpregunta(Integer pCpregunta){ + cpregunta=pCpregunta; +} + +/**Obtiene el valor de crespuestaingresada +@return valor de crespuestaingresada*/ +public Integer getCrespuestaingresada(){ + return crespuestaingresada; +} +/**Fija el valor de crespuestaingresada +@param pCrespuestaingresada nuevo Valor de crespuestaingresada*/ +public void setCrespuestaingresada(Integer pCrespuestaingresada){ + crespuestaingresada=pCrespuestaingresada; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmDetallePreguntas))return false; + TarmDetallePreguntas that = (TarmDetallePreguntas) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmDetallePreguntas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmDetallePreguntas +*/ +public Object createInstance(){ + TarmDetallePreguntas instance=new TarmDetallePreguntas(); + return instance; +} +/**Clona la entidad TarmDetallePreguntas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmDetallePreguntas p=(TarmDetallePreguntas)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/TarmEvaluacion.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/TarmEvaluacion.java new file mode 100644 index 0000000..e2d30bd --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/TarmEvaluacion.java @@ -0,0 +1,514 @@ +package com.fp.persistence.parmas.eval; + +import javax.persistence.Entity; + +import java.sql.Timestamp; + +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMEVALUACION*/ +@Entity(name="TarmEvaluacion") +@Table(name="TARMEVALUACION") +public class TarmEvaluacion extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmEvaluacion +*/ +@Id +@Column(name="CEVALUACION" ,nullable=false, updatable=false) +private String pk; +@Column(name="TIPOEVALUACION", nullable=true) + +/** +* Codigo de catalogo 01 Conocimiento Guardias, 02 Conocimiento Particulares +*/ +private String tipoevaluacion; + +@Column(name="FECHA", nullable=true) + +/** +* Fecha en la que se rindio la evaluacin +*/ +private Timestamp fecha; + +@Column(name="INTENTO", nullable=true) + +/** +* # de Intento en la evaluacin +*/ +private Long intento; + +@Column(name="CENTROMEDICO", nullable=true) + +/** +* null +*/ +private String centromedico; + +@Column(name="VIGENTE", nullable=true) + +/** +* null +*/ +private String vigente; + +@Column(name="FECHADEPOSITO", nullable=true) + +/** +* null +*/ +private Date fechadeposito; + +@Column(name="NOPAPELETA", nullable=true) + +/** +* null +*/ +private String nopapeleta; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona a ser evaluada +*/ +private Integer personcode; + +@Column(name="TIPOEVALUACIONCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de evaluacin +*/ +private String tipoevaluacioncodigo; + +@Column(name="FECHAEXPIRACION", nullable=true) + +/** +* FECHA DE EXPIRACON DE LA EVALUACION +*/ +private Date fechaexpiracion; + +@Column(name="FREGISTRO", nullable=true) + +/** +* null +*/ +private Timestamp fregistro; + +@Column(name="RESULTADOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de resultado + +*/ +private String resultadocodigo; + +@Column(name="PSICOLOGORESPONSABLE", nullable=true) + +/** +* NOMBRE DEL DOCTOR PSICOLOGO RESPONSABLE DE LA EVALUACION PSICOLOGICA +*/ +private String psicologoresponsable; + +@Column(name="OBSERVACION", nullable=true) + +/** +* OBSERVACIONES DENTRO DE LA EVALUACION PSICOLOGICA +*/ +private String observacion; + +@Column(name="FECHAPREOX", nullable=true) + +/** +* Fecha en la cual puede volver a rendir la evalaucion +*/ +private Date fechapreox; + +@Column(name="INFORMEXPATH", nullable=true) + +/** +* PATH DONDE SE ALMACENA LA INFORMACION DE LA EVALUACION PSICOLOGICA +*/ +private String informexpath; + +@Column(name="RESULTADO", nullable=true) + +/** +* Codigo de catalogo 01 Aprobado, 02 Reprobado +*/ +private String resultado; + +@Column(name="CENTROMEDICOCODE", nullable=true) + +/** +* null +*/ +private String centromedicocode; + +@Column(name="EMPRESAPERSONCODE", nullable=true) + +/** +* null +*/ +private Integer empresapersoncode; + +@Column(name="TIPDOCPSICOLOGO", nullable=true) + +/** +* null +*/ +private String tipdocpsicologo; + +@Column(name="TIPDOCCODEPSICOLOGO", nullable=true) + +/** +* null +*/ +private String tipdoccodepsicologo; + +@Column(name="NUMDOCPSICOLOGO", nullable=true) + +/** +* null +*/ +private String numdocpsicologo; + +/**Contructor por defecto*/ +public TarmEvaluacion(){ +} +/**Contructor de TarmEvaluacion +@param pPk Clave Primaria del entity +*/ +public TarmEvaluacion(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmEvaluacion +*/ +public static TarmEvaluacion find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmEvaluacion obj = pEntityManager.find(TarmEvaluacion.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmEvaluacion +@return El objeto que referencia a la Clave primaria de TarmEvaluacion +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmEvaluacion +@param pPk El objeto que referencia a la nueva Clave primaria de TarmEvaluacion +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de tipoevaluacion +@return valor de tipoevaluacion*/ +public String getTipoevaluacion(){ + return tipoevaluacion; +} +/**Fija el valor de tipoevaluacion +@param pTipoevaluacion nuevo Valor de tipoevaluacion*/ +public void setTipoevaluacion(String pTipoevaluacion){ + tipoevaluacion=pTipoevaluacion; +} + +/**Obtiene el valor de fecha +@return valor de fecha*/ +public Timestamp getFecha(){ + return fecha; +} +/**Fija el valor de fecha +@param pFecha nuevo Valor de fecha*/ +public void setFecha(Timestamp pFecha){ + fecha=pFecha; +} + +/**Obtiene el valor de intento +@return valor de intento*/ +public Long getIntento(){ + return intento; +} +/**Fija el valor de intento +@param pIntento nuevo Valor de intento*/ +public void setIntento(Long pIntento){ + intento=pIntento; +} + +/**Obtiene el valor de centromedico +@return valor de centromedico*/ +public String getCentromedico(){ + return centromedico; +} +/**Fija el valor de centromedico +@param pCentromedico nuevo Valor de centromedico*/ +public void setCentromedico(String pCentromedico){ + centromedico=pCentromedico; +} + +/**Obtiene el valor de vigente +@return valor de vigente*/ +public String getVigente(){ + return vigente; +} +/**Fija el valor de vigente +@param pVigente nuevo Valor de vigente*/ +public void setVigente(String pVigente){ + vigente=pVigente; +} + +/**Obtiene el valor de fechadeposito +@return valor de fechadeposito*/ +public Date getFechadeposito(){ + return fechadeposito; +} +/**Fija el valor de fechadeposito +@param pFechadeposito nuevo Valor de fechadeposito*/ +public void setFechadeposito(Date pFechadeposito){ + fechadeposito=pFechadeposito; +} + +/**Obtiene el valor de nopapeleta +@return valor de nopapeleta*/ +public String getNopapeleta(){ + return nopapeleta; +} +/**Fija el valor de nopapeleta +@param pNopapeleta nuevo Valor de nopapeleta*/ +public void setNopapeleta(String pNopapeleta){ + nopapeleta=pNopapeleta; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de tipoevaluacioncodigo +@return valor de tipoevaluacioncodigo*/ +public String getTipoevaluacioncodigo(){ + return tipoevaluacioncodigo; +} +/**Fija el valor de tipoevaluacioncodigo +@param pTipoevaluacioncodigo nuevo Valor de tipoevaluacioncodigo*/ +public void setTipoevaluacioncodigo(String pTipoevaluacioncodigo){ + tipoevaluacioncodigo=pTipoevaluacioncodigo; +} + +/**Obtiene el valor de fechaexpiracion +@return valor de fechaexpiracion*/ +public Date getFechaexpiracion(){ + return fechaexpiracion; +} +/**Fija el valor de fechaexpiracion +@param pFechaexpiracion nuevo Valor de fechaexpiracion*/ +public void setFechaexpiracion(Date pFechaexpiracion){ + fechaexpiracion=pFechaexpiracion; +} + +/**Obtiene el valor de fregistro +@return valor de fregistro*/ +public Timestamp getFregistro(){ + return fregistro; +} +/**Fija el valor de fregistro +@param pFregistro nuevo Valor de fregistro*/ +public void setFregistro(Timestamp pFregistro){ + fregistro=pFregistro; +} + +/**Obtiene el valor de resultadocodigo +@return valor de resultadocodigo*/ +public String getResultadocodigo(){ + return resultadocodigo; +} +/**Fija el valor de resultadocodigo +@param pResultadocodigo nuevo Valor de resultadocodigo*/ +public void setResultadocodigo(String pResultadocodigo){ + resultadocodigo=pResultadocodigo; +} + +/**Obtiene el valor de psicologoresponsable +@return valor de psicologoresponsable*/ +public String getPsicologoresponsable(){ + return psicologoresponsable; +} +/**Fija el valor de psicologoresponsable +@param pPsicologoresponsable nuevo Valor de psicologoresponsable*/ +public void setPsicologoresponsable(String pPsicologoresponsable){ + psicologoresponsable=pPsicologoresponsable; +} + +/**Obtiene el valor de observacion +@return valor de observacion*/ +public String getObservacion(){ + return observacion; +} +/**Fija el valor de observacion +@param pObservacion nuevo Valor de observacion*/ +public void setObservacion(String pObservacion){ + observacion=pObservacion; +} + +/**Obtiene el valor de fechapreox +@return valor de fechapreox*/ +public Date getFechapreox(){ + return fechapreox; +} +/**Fija el valor de fechapreox +@param pFechapreox nuevo Valor de fechapreox*/ +public void setFechapreox(Date pFechapreox){ + fechapreox=pFechapreox; +} + +/**Obtiene el valor de informexpath +@return valor de informexpath*/ +public String getInformexpath(){ + return informexpath; +} +/**Fija el valor de informexpath +@param pInformexpath nuevo Valor de informexpath*/ +public void setInformexpath(String pInformexpath){ + informexpath=pInformexpath; +} + +/**Obtiene el valor de resultado +@return valor de resultado*/ +public String getResultado(){ + return resultado; +} +/**Fija el valor de resultado +@param pResultado nuevo Valor de resultado*/ +public void setResultado(String pResultado){ + resultado=pResultado; +} + +/**Obtiene el valor de centromedicocode +@return valor de centromedicocode*/ +public String getCentromedicocode(){ + return centromedicocode; +} +/**Fija el valor de centromedicocode +@param pCentromedicocode nuevo Valor de centromedicocode*/ +public void setCentromedicocode(String pCentromedicocode){ + centromedicocode=pCentromedicocode; +} + +/**Obtiene el valor de empresapersoncode +@return valor de empresapersoncode*/ +public Integer getEmpresapersoncode(){ + return empresapersoncode; +} +/**Fija el valor de empresapersoncode +@param pEmpresapersoncode nuevo Valor de empresapersoncode*/ +public void setEmpresapersoncode(Integer pEmpresapersoncode){ + empresapersoncode=pEmpresapersoncode; +} + +public String getTipdocpsicologo() { + return tipdocpsicologo; +} +public void setTipdocpsicologo(String tipdocpsicologo) { + this.tipdocpsicologo = tipdocpsicologo; +} +public String getTipdoccodepsicologo() { + return tipdoccodepsicologo; +} +public void setTipdoccodepsicologo(String tipdoccodepsicologo) { + this.tipdoccodepsicologo = tipdoccodepsicologo; +} +public String getNumdocpsicologo() { + return numdocpsicologo; +} +public void setNumdocpsicologo(String numdocpsicologo) { + this.numdocpsicologo = numdocpsicologo; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmEvaluacion))return false; + TarmEvaluacion that = (TarmEvaluacion) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmEvaluacion +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmEvaluacion +*/ +public Object createInstance(){ + TarmEvaluacion instance=new TarmEvaluacion(); + return instance; +} +/**Clona la entidad TarmEvaluacion +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmEvaluacion p=(TarmEvaluacion)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/TarmPreguntas.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/TarmPreguntas.java new file mode 100644 index 0000000..db6bcd6 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/TarmPreguntas.java @@ -0,0 +1,281 @@ +package com.fp.persistence.parmas.eval; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMPREGUNTAS*/ +@Entity(name="TarmPreguntas") +@Table(name="TARMPREGUNTAS") +public class TarmPreguntas extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmPreguntas +*/ +@Id +@Column(name="CPREGUNTA" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "TARMPREGUNTAS"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.Number"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "8")}) + @GeneratedValue(generator = "seq_id") +private Integer pk; +@Column(name="TIPOEVALUACION", nullable=true) + +/** +* null +*/ +private String tipoevaluacion; + +@Column(name="TIPOEVALUACIONCODIGO", nullable=true) + +/** +* null +*/ +private String tipoevaluacioncodigo; + +@Column(name="TIPOPERSONA", nullable=true) + +/** +* null +*/ +private String tipopersona; + +@Column(name="TIPOPERSONACODIGO", nullable=true) + +/** +* null +*/ +private String tipopersonacodigo; + +@Column(name="DESCRIPCION", nullable=true) + +/** +* null +*/ +private String descripcion; + +@Column(name="NUMEROPREGUNTA", nullable=true) + +/** +* null +*/ +private Integer numeropregunta; + +@Column(name="ESTADOPREGUNTA", nullable=true) + +/** +* null +*/ +private String estadopregunta; + +@Column(name="ESTADOPREGUNTACODIGO", nullable=true) + +/** +* null +*/ +private String estadopreguntacodigo; + + +/**Contructor por defecto*/ +public TarmPreguntas(){ +} +/**Contructor de TarmPreguntas +@param pPk Clave Primaria del entity +*/ +public TarmPreguntas(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmPreguntas +*/ +public static TarmPreguntas find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmPreguntas obj = pEntityManager.find(TarmPreguntas.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmPreguntas +@return El objeto que referencia a la Clave primaria de TarmPreguntas +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmPreguntas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmPreguntas +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de tipoevaluacion +@return valor de tipoevaluacion*/ +public String getTipoevaluacion(){ + return tipoevaluacion; +} +/**Fija el valor de tipoevaluacion +@param pTipoevaluacion nuevo Valor de tipoevaluacion*/ +public void setTipoevaluacion(String pTipoevaluacion){ + tipoevaluacion=pTipoevaluacion; +} + +/**Obtiene el valor de tipoevaluacioncodigo +@return valor de tipoevaluacioncodigo*/ +public String getTipoevaluacioncodigo(){ + return tipoevaluacioncodigo; +} +/**Fija el valor de tipoevaluacioncodigo +@param pTipoevaluacioncodigo nuevo Valor de tipoevaluacioncodigo*/ +public void setTipoevaluacioncodigo(String pTipoevaluacioncodigo){ + tipoevaluacioncodigo=pTipoevaluacioncodigo; +} + +/**Obtiene el valor de tipopersona +@return valor de tipopersona*/ +public String getTipopersona(){ + return tipopersona; +} +/**Fija el valor de tipopersona +@param pTipopersona nuevo Valor de tipopersona*/ +public void setTipopersona(String pTipopersona){ + tipopersona=pTipopersona; +} + +/**Obtiene el valor de tipopersonacodigo +@return valor de tipopersonacodigo*/ +public String getTipopersonacodigo(){ + return tipopersonacodigo; +} +/**Fija el valor de tipopersonacodigo +@param pTipopersonacodigo nuevo Valor de tipopersonacodigo*/ +public void setTipopersonacodigo(String pTipopersonacodigo){ + tipopersonacodigo=pTipopersonacodigo; +} + +/**Obtiene el valor de descripcion +@return valor de descripcion*/ +public String getDescripcion(){ + return descripcion; +} +/**Fija el valor de descripcion +@param pDescripcion nuevo Valor de descripcion*/ +public void setDescripcion(String pDescripcion){ + descripcion=pDescripcion; +} + +/**Obtiene el valor de numeropregunta +@return valor de numeropregunta*/ +public Integer getNumeropregunta(){ + return numeropregunta; +} +/**Fija el valor de numeropregunta +@param pNumeropregunta nuevo Valor de numeropregunta*/ +public void setNumeropregunta(Integer pNumeropregunta){ + numeropregunta=pNumeropregunta; +} + +/**Obtiene el valor de estadopregunta +@return valor de estadopregunta*/ +public String getEstadopregunta() { + return estadopregunta; +} +/**Fija el valor de estadopregunta +@param pDescripcion nuevo Valor de estadopregunta*/ +public void setEstadopregunta(String estadopregunta) { + this.estadopregunta = estadopregunta; +} + +/**Obtiene el valor de estadopreguntacodigo +@return valor de estadopreguntacodigo*/ +public String getEstadopreguntacodigo() { + return estadopreguntacodigo; +} +/**Fija el valor de estadopreguntacodigo +@param pDescripcion nuevo Valor de estadopreguntacodigo*/ +public void setEstadopreguntacodigo(String estadopreguntacodigo) { + this.estadopreguntacodigo = estadopreguntacodigo; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmPreguntas))return false; + TarmPreguntas that = (TarmPreguntas) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmPreguntas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmPreguntas +*/ +public Object createInstance(){ + TarmPreguntas instance=new TarmPreguntas(); + return instance; +} +/**Clona la entidad TarmPreguntas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmPreguntas p=(TarmPreguntas)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/TarmRespuestas.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/TarmRespuestas.java new file mode 100644 index 0000000..f665c28 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/eval/TarmRespuestas.java @@ -0,0 +1,209 @@ +package com.fp.persistence.parmas.eval; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMRESPUESTAS*/ +@Entity(name="TarmRespuestas") +@Table(name="TARMRESPUESTAS") +public class TarmRespuestas extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmRespuestas +*/ +@Id +@Column(name="CRESPUESTA" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "TARMRESPUESTAS"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.Number"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "8")}) + @GeneratedValue(generator = "seq_id") +private Integer pk; +@Column(name="CPREGUNTA", nullable=true) + +/** +* null +*/ +private Integer cpregunta; + +@Column(name="DESCRIPCION", nullable=true) + +/** +* null +*/ +private String descripcion; + +@Column(name="ESCORRECTA", nullable=true) + +/** +* null +*/ +private String escorrecta; + +@Column(name="ISACTIVE", nullable=true) + +/** +* null +*/ +private String isactive; + +/**Contructor por defecto*/ +public TarmRespuestas(){ +} +/**Contructor de TarmRespuestas +@param pPk Clave Primaria del entity +*/ +public TarmRespuestas(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmRespuestas +*/ +public static TarmRespuestas find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmRespuestas obj = pEntityManager.find(TarmRespuestas.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmRespuestas +@return El objeto que referencia a la Clave primaria de TarmRespuestas +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmRespuestas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmRespuestas +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de cpregunta +@return valor de cpregunta*/ +public Integer getCpregunta(){ + return cpregunta; +} +/**Fija el valor de cpregunta +@param pCpregunta nuevo Valor de cpregunta*/ +public void setCpregunta(Integer pCpregunta){ + cpregunta=pCpregunta; +} + +/**Obtiene el valor de descripcion +@return valor de descripcion*/ +public String getDescripcion(){ + return descripcion; +} +/**Fija el valor de descripcion +@param pDescripcion nuevo Valor de descripcion*/ +public void setDescripcion(String pDescripcion){ + descripcion=pDescripcion; +} + +/**Obtiene el valor de escorrecta +@return valor de escorrecta*/ +public String getEscorrecta(){ + return escorrecta; +} +/**Fija el valor de escorrecta +@param pEscorrecta nuevo Valor de escorrecta*/ +public void setEscorrecta(String pEscorrecta){ + escorrecta=pEscorrecta; +} + +/**Obtiene el valor de escorrecta +@return valor de escorrecta*/ +public String getIsactive() { + return isactive; +} + +/**Fija el valor de escorrecta +@param pEscorrecta nuevo Valor de escorrecta*/ +public void setIsactive(String pIsactive) { + this.isactive = pIsactive; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmRespuestas))return false; + TarmRespuestas that = (TarmRespuestas) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmRespuestas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmRespuestas +*/ +public Object createInstance(){ + TarmRespuestas instance=new TarmRespuestas(); + return instance; +} +/**Clona la entidad TarmRespuestas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmRespuestas p=(TarmRespuestas)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/entries b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/entries new file mode 100644 index 0000000..ec8ca1a --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/entries @@ -0,0 +1,436 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun +svn://172.17.26.185/COMACO + + + +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TarmTotalPersona.java +file + + + + +2022-07-28T03:40:28.258740Z +7c658b8d2be73e58a13751024fd869c7 +2015-01-08T09:24:45.800079Z +3722 +cpiedra + + + + + + + + + + + + + + + + + + + + + +13779 + +TarmCarga.java +file + + + + +2022-07-28T03:40:28.258740Z +2135567cd0e189ce08d133cb52ac37fa +2015-12-29T13:58:56.911893Z +4357 +fpazmino + + + + + + + + + + + + + + + + + + + + + +8133 + +TarmCashManagementHistory.java +file + + + + +2022-07-28T03:40:28.259740Z +bf6b7296eb5b9627130d09b5ce4b85d4 +2015-10-19T06:35:28.927984Z +4298 +fpazmino + + + + + + + + + + + + + + + + + + + + + +6065 + +TarmInventarioSubidoPorPersona.java +file + + + + +2022-07-28T03:40:28.259740Z +1474f467924bbe694de0e892e68e0879 +2015-09-21T11:32:33.372883Z +4284 +fpazmino + + + + + + + + + + + + + + + + + + + + + +4556 + +TarmSolicitudImportacionKey.java +file + + + + +2022-07-28T03:40:28.260740Z +f973267c51e8b3fecefdaca9b380837f +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +3733 + +TarmDetalleImportacion.java +file + + + + +2022-07-28T03:40:28.260740Z +a18876b27d5c9223c4c1e16d7906b61f +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +5344 + +TarmRegistroArmas.java +file + + + + +2022-07-28T03:40:28.260740Z +3c8a3a3d8d234f0462623ec130ac41e8 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +9054 + +TarmSolicitudImportacion.java +file + + + + +2022-07-28T03:40:28.261740Z +1b56123d609cadf3517a08e66066deac +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +6295 + +TarmVentaArmaTem.java +file + + + + +2022-07-28T03:40:28.261740Z +03232a1e3d09a9388af105bdc46ae6c5 +2021-05-14T20:49:02.138208Z +4637 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +6371 + +TarmInventarioSubidoPorPersonaKey.java +file + + + + +2022-07-28T03:40:28.262740Z +c40294a65b4b17d783143a2ff97239e4 +2015-09-21T11:32:33.372883Z +4284 +fpazmino + + + + + + + + + + + + + + + + + + + + + +3427 + +TarmCargaDetalle.java +file + + + + +2022-07-28T03:40:28.262740Z +16fc734c68dd21a1da913809ae27e3e5 +2015-12-29T13:58:56.911893Z +4357 +fpazmino + + + + + + + + + + + + + + + + + + + + + +4349 + +TarmMovimientoArmas.java +file + + + + +2022-07-28T03:40:28.262740Z +41bd0119cc2658cf5ae27528b9bdfb14 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +8257 + diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/prop-base/TarmDetalleImportacion.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/prop-base/TarmDetalleImportacion.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/prop-base/TarmDetalleImportacion.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/prop-base/TarmSolicitudImportacion.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/prop-base/TarmSolicitudImportacion.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/prop-base/TarmSolicitudImportacion.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/prop-base/TarmSolicitudImportacionKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/prop-base/TarmSolicitudImportacionKey.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/prop-base/TarmSolicitudImportacionKey.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmCarga.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmCarga.java.svn-base new file mode 100644 index 0000000..69e366e --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmCarga.java.svn-base @@ -0,0 +1,329 @@ +package com.fp.persistence.parmas.fun; + +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMCARGA*/ +@Entity(name="TarmCarga") +@Table(name="TARMCARGA") +public class TarmCarga extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmCarga +*/ +@Id +@Column(name="CCARGA" ,nullable=false, updatable=false) +private String pk; +@Column(name="PROVINCECODE", nullable=true) + +/** +* null +*/ +private String provincecode; + +@Column(name="CITYCODE", nullable=true) + +/** +* null +*/ +private String citycode; + +@Column(name="AUCP", nullable=true) + +/** +* NUMERO DE SOLICITUD DE IMPORTACION VUE +*/ +private String aucp; + +@Column(name="CANTONCODE", nullable=true) + +/** +* null +*/ +private String cantoncode; + +@Column(name="PERSONCODE", nullable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="ESDESADUANIZADO", nullable=false) + +/** +* CAMPO PARA INDICAR SI UNA IMPORTACION FUE DESADUANIDA +*/ +private String esdesaduanizado; + +@Column(name="TIPOCARGA", nullable=false) + +/** +* INDICA SI LA CARGA ES UNA IMPORTACION, PRODUCCION O INVENTARIO +*/ +private String tipocarga; + +@Column(name="CREGISTRO", nullable=false) + +/** +* null +*/ +private Long cregistro; + +@Column(name="FECHA", nullable=false) + +/** +* FECHA DE LA CARGA +*/ +private Timestamp fecha; + +@Column(name="CSOLICITUD", nullable=true) + +/** +* Codigo de solicitud previa importacion a la que esta atada la carga +*/ +private String csolicitud; + +@Column(name="CATEGORIA", nullable=true) + +/** +* null +*/ +private String categoria; + +/**Contructor por defecto*/ +public TarmCarga(){ +} +/**Contructor de TarmCarga +@param pPk Clave Primaria del entity +@param pPersoncode Codigo de persona +@param pEsdesaduanizado CAMPO PARA INDICAR SI UNA IMPORTACION FUE DESADUANIDA +@param pTipocarga INDICA SI LA CARGA ES UNA IMPORTACION, PRODUCCION O INVENTARIO +@param pCregistro null +@param pFecha FECHA DE LA CARGA +*/ +public TarmCarga(String pPk,Integer pPersoncode,String pEsdesaduanizado,String pTipocarga,Long pCregistro,Timestamp pFecha){ + this(); + pk=pPk; + personcode=pPersoncode; + esdesaduanizado=pEsdesaduanizado; + tipocarga=pTipocarga; + cregistro=pCregistro; + fecha=pFecha; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmCarga +*/ +public static TarmCarga find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmCarga obj = pEntityManager.find(TarmCarga.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmCarga +@return El objeto que referencia a la Clave primaria de TarmCarga +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmCarga +@param pPk El objeto que referencia a la nueva Clave primaria de TarmCarga +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de provincecode +@return valor de provincecode*/ +public String getProvincecode(){ + return provincecode; +} +/**Fija el valor de provincecode +@param pProvincecode nuevo Valor de provincecode*/ +public void setProvincecode(String pProvincecode){ + provincecode=pProvincecode; +} + +/**Obtiene el valor de citycode +@return valor de citycode*/ +public String getCitycode(){ + return citycode; +} +/**Fija el valor de citycode +@param pCitycode nuevo Valor de citycode*/ +public void setCitycode(String pCitycode){ + citycode=pCitycode; +} + +/**Obtiene el valor de aucp +@return valor de aucp*/ +public String getAucp(){ + return aucp; +} +/**Fija el valor de aucp +@param pAucp nuevo Valor de aucp*/ +public void setAucp(String pAucp){ + aucp=pAucp; +} + +/**Obtiene el valor de cantoncode +@return valor de cantoncode*/ +public String getCantoncode(){ + return cantoncode; +} +/**Fija el valor de cantoncode +@param pCantoncode nuevo Valor de cantoncode*/ +public void setCantoncode(String pCantoncode){ + cantoncode=pCantoncode; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de esdesaduanizado +@return valor de esdesaduanizado*/ +public String getEsdesaduanizado(){ + return esdesaduanizado; +} +/**Fija el valor de esdesaduanizado +@param pEsdesaduanizado nuevo Valor de esdesaduanizado*/ +public void setEsdesaduanizado(String pEsdesaduanizado){ + esdesaduanizado=pEsdesaduanizado; +} + +/**Obtiene el valor de tipocarga +@return valor de tipocarga*/ +public String getTipocarga(){ + return tipocarga; +} +/**Fija el valor de tipocarga +@param pTipocarga nuevo Valor de tipocarga*/ +public void setTipocarga(String pTipocarga){ + tipocarga=pTipocarga; +} + +/**Obtiene el valor de cregistro +@return valor de cregistro*/ +public Long getCregistro(){ + return cregistro; +} +/**Fija el valor de cregistro +@param pCregistro nuevo Valor de cregistro*/ +public void setCregistro(Long pCregistro){ + cregistro=pCregistro; +} + +/**Obtiene el valor de fecha +@return valor de fecha*/ +public Timestamp getFecha(){ + return fecha; +} +/**Fija el valor de fecha +@param pFecha nuevo Valor de fecha*/ +public void setFecha(Timestamp pFecha){ + fecha=pFecha; +} + +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Obtiene el valor de categoria +@return valor de categoria*/ +public String getCategoria(){ + return categoria; +} +/**Fija el valor de categoria +@param pCategoria nuevo Valor de categoria*/ +public void setCategoria(String pCategoria){ + categoria=pCategoria; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmCarga))return false; + TarmCarga that = (TarmCarga) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmCarga +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmCarga +*/ +public Object createInstance(){ + TarmCarga instance=new TarmCarga(); + return instance; +} +/**Clona la entidad TarmCarga +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmCarga p=(TarmCarga)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmCargaDetalle.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmCargaDetalle.java.svn-base new file mode 100644 index 0000000..6a38c9f --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmCargaDetalle.java.svn-base @@ -0,0 +1,160 @@ +package com.fp.persistence.parmas.fun; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMCARGADETALLE*/ +@Entity(name="TarmCargaDetalle") +@Table(name="TARMCARGADETALLE") +public class TarmCargaDetalle extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmCargaDetalle +*/ +@Id +@Column(name="CCARGADETALLE" ,nullable=false, updatable=false) +private String pk; +@Column(name="CCARGA", nullable=false) + +/** +* CODIGO DE CARGA +*/ +private String ccarga; + +@Column(name="CARMA", nullable=false) + +/** +* CODIGO DE ARMA +*/ +private String carma; + +/**Contructor por defecto*/ +public TarmCargaDetalle(){ +} +/**Contructor de TarmCargaDetalle +@param pPk Clave Primaria del entity +@param pCcarga CODIGO DE CARGA +@param pCarma CODIGO DE ARMA +*/ +public TarmCargaDetalle(String pPk,String pCcarga,String pCarma){ + this(); + pk=pPk; + ccarga=pCcarga; + carma=pCarma; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmCargaDetalle +*/ +public static TarmCargaDetalle find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmCargaDetalle obj = pEntityManager.find(TarmCargaDetalle.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmCargaDetalle +@return El objeto que referencia a la Clave primaria de TarmCargaDetalle +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmCargaDetalle +@param pPk El objeto que referencia a la nueva Clave primaria de TarmCargaDetalle +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de ccarga +@return valor de ccarga*/ +public String getCcarga(){ + return ccarga; +} +/**Fija el valor de ccarga +@param pCcarga nuevo Valor de ccarga*/ +public void setCcarga(String pCcarga){ + ccarga=pCcarga; +} + +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmCargaDetalle))return false; + TarmCargaDetalle that = (TarmCargaDetalle) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmCargaDetalle +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmCargaDetalle +*/ +public Object createInstance(){ + TarmCargaDetalle instance=new TarmCargaDetalle(); + return instance; +} +/**Clona la entidad TarmCargaDetalle +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmCargaDetalle p=(TarmCargaDetalle)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmCashManagementHistory.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmCashManagementHistory.java.svn-base new file mode 100644 index 0000000..bc465d2 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmCashManagementHistory.java.svn-base @@ -0,0 +1,224 @@ +package com.fp.persistence.parmas.fun; + +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMCASHMANAGEMENTHISTORY*/ +@Entity(name="TarmCashManagementHistory") +@Table(name="TARMCASHMANAGEMENTHISTORY") +public class TarmCashManagementHistory extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmCashManagementHistory +*/ +@Id +@Column(name="CCASHMANAGEMENT" ,nullable=false, updatable=false) +private String pk; +@Column(name="PATHREPORTE", nullable=false) + +/** +* null +*/ +private String pathreporte; + +@Column(name="USERCODE", nullable=false) + +/** +* null +*/ +private String usercode; + +@Column(name="DATEFROM", nullable=false) + +/** +* null +*/ +private Timestamp datefrom; + +@Column(name="DATETO", nullable=false) + +/** +* null +*/ +private Timestamp dateto; + +@Column(name="NOMBREARCHIVO", nullable=false) + +/** +* null +*/ +private String nombrearchivo; + +/**Contructor por defecto*/ +public TarmCashManagementHistory(){ +} +/**Contructor de TarmCashManagementHistory +@param pPk Clave Primaria del entity +@param pPathreporte null +@param pUsercode null +@param pDatefrom null +@param pDateto null +@param pNombrearchivo null +*/ +public TarmCashManagementHistory(String pPk,String pPathreporte,String pUsercode,Timestamp pDatefrom,Timestamp pDateto,String pNombrearchivo){ + this(); + pk=pPk; + pathreporte=pPathreporte; + usercode=pUsercode; + datefrom=pDatefrom; + dateto=pDateto; + nombrearchivo=pNombrearchivo; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmCashManagementHistory +*/ +public static TarmCashManagementHistory find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmCashManagementHistory obj = pEntityManager.find(TarmCashManagementHistory.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmCashManagementHistory +@return El objeto que referencia a la Clave primaria de TarmCashManagementHistory +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmCashManagementHistory +@param pPk El objeto que referencia a la nueva Clave primaria de TarmCashManagementHistory +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de pathreporte +@return valor de pathreporte*/ +public String getPathreporte(){ + return pathreporte; +} +/**Fija el valor de pathreporte +@param pPathreporte nuevo Valor de pathreporte*/ +public void setPathreporte(String pPathreporte){ + pathreporte=pPathreporte; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de datefrom +@return valor de datefrom*/ +public Timestamp getDatefrom(){ + return datefrom; +} +/**Fija el valor de datefrom +@param pDatefrom nuevo Valor de datefrom*/ +public void setDatefrom(Timestamp pDatefrom){ + datefrom=pDatefrom; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de nombrearchivo +@return valor de nombrearchivo*/ +public String getNombrearchivo(){ + return nombrearchivo; +} +/**Fija el valor de nombrearchivo +@param pNombrearchivo nuevo Valor de nombrearchivo*/ +public void setNombrearchivo(String pNombrearchivo){ + nombrearchivo=pNombrearchivo; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmCashManagementHistory))return false; + TarmCashManagementHistory that = (TarmCashManagementHistory) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmCashManagementHistory +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmCashManagementHistory +*/ +public Object createInstance(){ + TarmCashManagementHistory instance=new TarmCashManagementHistory(); + return instance; +} +/**Clona la entidad TarmCashManagementHistory +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmCashManagementHistory p=(TarmCashManagementHistory)this.clone(); + return p; +} +public Object getId() { + return this.pk; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmDetalleImportacion.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmDetalleImportacion.java.svn-base new file mode 100644 index 0000000..bc3f26f --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmDetalleImportacion.java.svn-base @@ -0,0 +1,201 @@ +package com.fp.persistence.parmas.fun; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMDETALLEIMPORTACION*/ +@Entity(name="TarmDetalleImportacion") +@Table(name="TARMDETALLEIMPORTACION") +public class TarmDetalleImportacion extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmDetalleImportacion +*/ +@Id +@Column(name="CDETALLEIMPORTACION" ,nullable=false, updatable=false) +private Long pk; +@Column(name="CIMPORTACION", nullable=true) + +/** +* null +*/ +private Long cimportacion; + +@Column(name="CSOLICITUD", nullable=true) + +/** +* Codigo de solicitud de controld e armas +*/ +private String csolicitud; + +@Column(name="CARMA", nullable=true) + +/** +* null +*/ +private String carma; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* null +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TarmDetalleImportacion(){ +} +/**Contructor de TarmDetalleImportacion +@param pPk Clave Primaria del entity +*/ +public TarmDetalleImportacion(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmDetalleImportacion +*/ +public static TarmDetalleImportacion find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmDetalleImportacion obj = pEntityManager.find(TarmDetalleImportacion.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmDetalleImportacion +@return El objeto que referencia a la Clave primaria de TarmDetalleImportacion +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmDetalleImportacion +@param pPk El objeto que referencia a la nueva Clave primaria de TarmDetalleImportacion +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de cimportacion +@return valor de cimportacion*/ +public Long getCimportacion(){ + return cimportacion; +} +/**Fija el valor de cimportacion +@param pCimportacion nuevo Valor de cimportacion*/ +public void setCimportacion(Long pCimportacion){ + cimportacion=pCimportacion; +} + +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmDetalleImportacion))return false; + TarmDetalleImportacion that = (TarmDetalleImportacion) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmDetalleImportacion +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmDetalleImportacion +*/ +public Object createInstance(){ + TarmDetalleImportacion instance=new TarmDetalleImportacion(); + return instance; +} +/**Clona la entidad TarmDetalleImportacion +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmDetalleImportacion p=(TarmDetalleImportacion)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmInventarioSubidoPorPersona.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmInventarioSubidoPorPersona.java.svn-base new file mode 100644 index 0000000..f924ada --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmInventarioSubidoPorPersona.java.svn-base @@ -0,0 +1,140 @@ +package com.fp.persistence.parmas.fun; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMINVENTARIOSUBIDOPORPERSONA*/ +@Entity(name="TarmInventarioSubidoPorPersona") +@Table(name="TARMINVENTARIOSUBIDOPORPERSONA") +public class TarmInventarioSubidoPorPersona extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmInventarioSubidoPorPersona +*/ +@EmbeddedId +private TarmInventarioSubidoPorPersonaKey pk; +@Column(name="FECHACARGA", nullable=true) + +/** +* null +*/ +private Timestamp fechacarga; + +/**Contructor por defecto*/ +public TarmInventarioSubidoPorPersona(){ +} +/**Contructor de TarmInventarioSubidoPorPersona +@param pPk Clave Primaria del entity +*/ +public TarmInventarioSubidoPorPersona(TarmInventarioSubidoPorPersonaKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmInventarioSubidoPorPersona +*/ +public static TarmInventarioSubidoPorPersona find(EntityManager pEntityManager,TarmInventarioSubidoPorPersonaKey pKey) throws Exception{ + TarmInventarioSubidoPorPersona obj = pEntityManager.find(TarmInventarioSubidoPorPersona.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmInventarioSubidoPorPersona +@return El objeto que referencia a la Clave primaria de TarmInventarioSubidoPorPersona +*/ +public TarmInventarioSubidoPorPersonaKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmInventarioSubidoPorPersona +@param pPk El objeto que referencia a la nueva Clave primaria de TarmInventarioSubidoPorPersona +*/ +public void setPk(TarmInventarioSubidoPorPersonaKey pPk){ + pk=pPk; +} +/**Obtiene el valor de fechacarga +@return valor de fechacarga*/ +public Timestamp getFechacarga(){ + return fechacarga; +} +/**Fija el valor de fechacarga +@param pFechacarga nuevo Valor de fechacarga*/ +public void setFechacarga(Timestamp pFechacarga){ + fechacarga=pFechacarga; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmInventarioSubidoPorPersona))return false; + TarmInventarioSubidoPorPersona that = (TarmInventarioSubidoPorPersona) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmInventarioSubidoPorPersona +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmInventarioSubidoPorPersona +*/ +public Object createInstance(){ + TarmInventarioSubidoPorPersona instance=new TarmInventarioSubidoPorPersona(); + instance.setPk(new TarmInventarioSubidoPorPersonaKey()); + return instance; +} +/**Clona la entidad TarmInventarioSubidoPorPersona +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmInventarioSubidoPorPersona p=(TarmInventarioSubidoPorPersona)this.clone(); + p.setPk((TarmInventarioSubidoPorPersonaKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmInventarioSubidoPorPersonaKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmInventarioSubidoPorPersonaKey.java.svn-base new file mode 100644 index 0000000..1a46332 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmInventarioSubidoPorPersonaKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.parmas.fun; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMINVENTARIOSUBIDOPORPERSONA*/ +@Embeddable +public class TarmInventarioSubidoPorPersonaKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CLASE", nullable=false,updatable=false) + +/** +* null +*/ +private String clase; + +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* null +*/ +private Integer personcode; + +/**Contructor por defecto*/ +public TarmInventarioSubidoPorPersonaKey(){} +/**Contructor de TarmInventarioSubidoPorPersonaKey +@param pClase null +@param pPersoncode null +*/ +public TarmInventarioSubidoPorPersonaKey(String pClase,Integer pPersoncode){ + clase=pClase; + personcode=pPersoncode; +} +/**Obtiene el valor de clase +@return valor de clase*/ +public String getClase(){ + return clase; +} +/**Fija el valor de clase +@param pClase nuevo Valor de clase*/ +public void setClase(String pClase){ + clase=pClase; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Implementacion de la comparacion de TarmInventarioSubidoPorPersonaKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmInventarioSubidoPorPersonaKey))return false; + TarmInventarioSubidoPorPersonaKey that = (TarmInventarioSubidoPorPersonaKey) o; + if (this.getClase() == null || that.getClase() == null){ + return false; + } + if (! this.getClase().equals(that.getClase())){ + return false; + } + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmInventarioSubidoPorPersonaKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getClase() == null ? 0 : this.getClase().hashCode()); + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmMovimientoArmas.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmMovimientoArmas.java.svn-base new file mode 100644 index 0000000..e0124db --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmMovimientoArmas.java.svn-base @@ -0,0 +1,322 @@ +package com.fp.persistence.parmas.fun; + +import javax.persistence.Entity; + +import java.sql.Timestamp; + +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMMOVIMIENTOARMAS*/ +@Entity(name="TarmMovimientoArmas") +@Table(name="TARMMOVIMIENTOARMAS") +public class TarmMovimientoArmas extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmMovimientoArmas +*/ +@Id +@Column(name="CMOVIMIENTO" ,nullable=false, updatable=false) +private String pk; +@Column(name="FACTURA", nullable=true) + +/** +* Nmero de Factura +*/ +private String factura; + +@Column(name="FECHA", nullable=true) + +/** +* Fecha de registro +*/ +private Timestamp fecha; + +@Column(name="JUSTIFICACION", nullable=true) + +/** +* Comentario en el cual se justifica el movimiento del material +*/ +private String justificacion; + +@Column(name="NOREGISTRO", nullable=true) + +/** +* Nmero de Registro +*/ +private String noregistro; + + + +@Column(name="TIPOMOVIMIENTOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de movimiento +*/ +private String tipomovimientocodigo; + +@Column(name="CARMA", nullable=true) + +/** +* Codigo del arma la cual se vende, transpasa, entre otros. +*/ +private String carma; + +@Column(name="PERSONCODEVENDEDOR", nullable=true) + +/** +* Codigo de persona vendedora +*/ +private Integer personcodevendedor; + +@Column(name="TIPOMOVIMIENTO", nullable=true) + +/** +* Codigo de catalogo 01 Venta, 02 Produccion +*/ +private String tipomovimiento; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Versin del Registro +*/ +private Integer recordversion; + +@Column(name="PERSONCODECOMPRADOR", nullable=true) + +/** +* Codigo de persona compradora + +*/ +private Integer personcodecomprador; + +/**Contructor por defecto*/ +public TarmMovimientoArmas(){ +} +/**Contructor de TarmMovimientoArmas +@param pPk Clave Primaria del entity +*/ +public TarmMovimientoArmas(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmMovimientoArmas +*/ +public static TarmMovimientoArmas find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmMovimientoArmas obj = pEntityManager.find(TarmMovimientoArmas.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmMovimientoArmas +@return El objeto que referencia a la Clave primaria de TarmMovimientoArmas +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmMovimientoArmas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmMovimientoArmas +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de factura +@return valor de factura*/ +public String getFactura(){ + return factura; +} +/**Fija el valor de factura +@param pFactura nuevo Valor de factura*/ +public void setFactura(String pFactura){ + factura=pFactura; +} + +/**Obtiene el valor de fecha +@return valor de fecha*/ +public Timestamp getFecha(){ + return fecha; +} +/**Fija el valor de fecha +@param pFecha nuevo Valor de fecha*/ +public void setFecha(Timestamp pFecha){ + fecha=pFecha; +} + +/**Obtiene el valor de justificacion +@return valor de justificacion*/ +public String getJustificacion(){ + return justificacion; +} +/**Fija el valor de justificacion +@param pJustificacion nuevo Valor de justificacion*/ +public void setJustificacion(String pJustificacion){ + justificacion=pJustificacion; +} + +/**Obtiene el valor de noregistro +@return valor de noregistro*/ +public String getNoregistro(){ + return noregistro; +} +/**Fija el valor de noregistro +@param pNoregistro nuevo Valor de noregistro*/ +public void setNoregistro(String pNoregistro){ + noregistro=pNoregistro; +} + +/**Obtiene el valor de fecha + +/**Fija el valor de fecha + + +/**Obtiene el valor de tipomovimientocodigo +@return valor de tipomovimientocodigo*/ +public String getTipomovimientocodigo(){ + return tipomovimientocodigo; +} +/**Fija el valor de tipomovimientocodigo +@param pTipomovimientocodigo nuevo Valor de tipomovimientocodigo*/ +public void setTipomovimientocodigo(String pTipomovimientocodigo){ + tipomovimientocodigo=pTipomovimientocodigo; +} + +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de personcodevendedor +@return valor de personcodevendedor*/ +public Integer getPersoncodevendedor(){ + return personcodevendedor; +} +/**Fija el valor de personcodevendedor +@param pPersoncodevendedor nuevo Valor de personcodevendedor*/ +public void setPersoncodevendedor(Integer pPersoncodevendedor){ + personcodevendedor=pPersoncodevendedor; +} + +/**Obtiene el valor de tipomovimiento +@return valor de tipomovimiento*/ +public String getTipomovimiento(){ + return tipomovimiento; +} +/**Fija el valor de tipomovimiento +@param pTipomovimiento nuevo Valor de tipomovimiento*/ +public void setTipomovimiento(String pTipomovimiento){ + tipomovimiento=pTipomovimiento; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de personcodecomprador +@return valor de personcodecomprador*/ +public Integer getPersoncodecomprador(){ + return personcodecomprador; +} +/**Fija el valor de personcodecomprador +@param pPersoncodecomprador nuevo Valor de personcodecomprador*/ +public void setPersoncodecomprador(Integer pPersoncodecomprador){ + personcodecomprador=pPersoncodecomprador; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmMovimientoArmas))return false; + TarmMovimientoArmas that = (TarmMovimientoArmas) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmMovimientoArmas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmMovimientoArmas +*/ +public Object createInstance(){ + TarmMovimientoArmas instance=new TarmMovimientoArmas(); + return instance; +} +/**Clona la entidad TarmMovimientoArmas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmMovimientoArmas p=(TarmMovimientoArmas)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmRegistroArmas.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmRegistroArmas.java.svn-base new file mode 100644 index 0000000..5afcdc1 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmRegistroArmas.java.svn-base @@ -0,0 +1,367 @@ +package com.fp.persistence.parmas.fun; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMREGISTROARMAS*/ +@Entity(name="TarmRegistroArmas") +@Table(name="TARMREGISTROARMAS") +public class TarmRegistroArmas extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmRegistroArmas +*/ +@Id +@Column(name="CREGISTRO" ,nullable=false, updatable=false) +private Long pk; +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="TIPOREGISTRO", nullable=true) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String tiporegistro; + +@Column(name="TIPOREGISTROCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo Codigo de tabla de tipos de Registro +*/ +private String tiporegistrocodigo; + +@Column(name="PAISORIGEN", nullable=true) + +/** +* Codigo de pais +*/ +private String paisorigen; + +@Column(name="FCREACION", nullable=true) + +/** +* Fecha de creacin del registro + +*/ +private Date fcreacion; + +@Column(name="FABRICANTE", nullable=true) + +/** +* Nombre del fabricante del arma +*/ +private String fabricante; + +@Column(name="DUI", nullable=true) + +/** +* null +*/ +private String dui; + +@Column(name="TOTALFOB", nullable=true) + +/** +* null +*/ +private BigDecimal totalfob; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* null +*/ +private Integer recordversion; + +@Column(name="TRAMITE", nullable=true) + +/** +* null +*/ +private Long tramite; + +@Column(name="AEROPUERTOPUERTO", nullable=true) + +/** +* Nombre del aeropuerto o puerto referente a la importacion +*/ +private String aeropuertopuerto; + +@Column(name="SOLICITUDNUM", nullable=true) + +/** +* Numero de la solicitud relacionada con la importacion +*/ +private String solicitudnum; + +@Column(name="FECHASOLICITUD", nullable=true) + +/** +* Fecha de la solicitud +*/ +private Date fechasolicitud; + +/**Contructor por defecto*/ +public TarmRegistroArmas(){ +} +/**Contructor de TarmRegistroArmas +@param pPk Clave Primaria del entity +*/ +public TarmRegistroArmas(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmRegistroArmas +*/ +public static TarmRegistroArmas find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmRegistroArmas obj = pEntityManager.find(TarmRegistroArmas.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmRegistroArmas +@return El objeto que referencia a la Clave primaria de TarmRegistroArmas +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmRegistroArmas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmRegistroArmas +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de tiporegistro +@return valor de tiporegistro*/ +public String getTiporegistro(){ + return tiporegistro; +} +/**Fija el valor de tiporegistro +@param pTiporegistro nuevo Valor de tiporegistro*/ +public void setTiporegistro(String pTiporegistro){ + tiporegistro=pTiporegistro; +} + +/**Obtiene el valor de tiporegistrocodigo +@return valor de tiporegistrocodigo*/ +public String getTiporegistrocodigo(){ + return tiporegistrocodigo; +} +/**Fija el valor de tiporegistrocodigo +@param pTiporegistrocodigo nuevo Valor de tiporegistrocodigo*/ +public void setTiporegistrocodigo(String pTiporegistrocodigo){ + tiporegistrocodigo=pTiporegistrocodigo; +} + +/**Obtiene el valor de paisorigen +@return valor de paisorigen*/ +public String getPaisorigen(){ + return paisorigen; +} +/**Fija el valor de paisorigen +@param pPaisorigen nuevo Valor de paisorigen*/ +public void setPaisorigen(String pPaisorigen){ + paisorigen=pPaisorigen; +} + +/**Obtiene el valor de fcreacion +@return valor de fcreacion*/ +public Date getFcreacion(){ + return fcreacion; +} +/**Fija el valor de fcreacion +@param pFcreacion nuevo Valor de fcreacion*/ +public void setFcreacion(Date pFcreacion){ + fcreacion=pFcreacion; +} + +/**Obtiene el valor de fabricante +@return valor de fabricante*/ +public String getFabricante(){ + return fabricante; +} +/**Fija el valor de fabricante +@param pFabricante nuevo Valor de fabricante*/ +public void setFabricante(String pFabricante){ + fabricante=pFabricante; +} + +/**Obtiene el valor de dui +@return valor de dui*/ +public String getDui(){ + return dui; +} +/**Fija el valor de dui +@param pDui nuevo Valor de dui*/ +public void setDui(String pDui){ + dui=pDui; +} + +/**Obtiene el valor de totalfob +@return valor de totalfob*/ +public BigDecimal getTotalfob(){ + return totalfob; +} +/**Fija el valor de totalfob +@param pTotalfob nuevo Valor de totalfob*/ +public void setTotalfob(BigDecimal pTotalfob){ + totalfob=pTotalfob; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de tramite +@return valor de tramite*/ +public Long getTramite(){ + return tramite; +} +/**Fija el valor de tramite +@param pTramite nuevo Valor de tramite*/ +public void setTramite(Long pTramite){ + tramite=pTramite; +} + +/**Obtiene el valor de aeropuertopuerto +@return valor de aeropuertopuerto*/ +public String getAeropuertopuerto(){ + return aeropuertopuerto; +} +/**Fija el valor de aeropuertopuerto +@param pAeropuertopuerto nuevo Valor de aeropuertopuerto*/ +public void setAeropuertopuerto(String pAeropuertopuerto){ + aeropuertopuerto=pAeropuertopuerto; +} + +/**Obtiene el valor de solicitudnum +@return valor de solicitudnum*/ +public String getSolicitudnum(){ + return solicitudnum; +} +/**Fija el valor de solicitudnum +@param pSolicitudnum nuevo Valor de solicitudnum*/ +public void setSolicitudnum(String pSolicitudnum){ + solicitudnum=pSolicitudnum; +} + +/**Obtiene el valor de fechasolicitud +@return valor de fechasolicitud*/ +public Date getFechasolicitud(){ + return fechasolicitud; +} +/**Fija el valor de fechasolicitud +@param pFechasolicitud nuevo Valor de fechasolicitud*/ +public void setFechasolicitud(Date pFechasolicitud){ + fechasolicitud=pFechasolicitud; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmRegistroArmas))return false; + TarmRegistroArmas that = (TarmRegistroArmas) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmRegistroArmas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmRegistroArmas +*/ +public Object createInstance(){ + TarmRegistroArmas instance=new TarmRegistroArmas(); + return instance; +} +/**Clona la entidad TarmRegistroArmas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmRegistroArmas p=(TarmRegistroArmas)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmSolicitudImportacion.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmSolicitudImportacion.java.svn-base new file mode 100644 index 0000000..15fabde --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmSolicitudImportacion.java.svn-base @@ -0,0 +1,241 @@ +package com.fp.persistence.parmas.fun; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMSOLICITUDIMPORTACION*/ +@Entity(name="TarmSolicitudImportacion") +@Table(name="TARMSOLICITUDIMPORTACION") +public class TarmSolicitudImportacion extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmSolicitudImportacion +*/ +@EmbeddedId +private TarmSolicitudImportacionKey pk; +@Column(name="CPAISORIGEN", nullable=true) + +/** +* Codigo de pais +*/ +private String cpaisorigen; + +@Column(name="FCREACION", nullable=true) + +/** +* null +*/ +private Date fcreacion; + +@Column(name="FABRICANTE", nullable=true) + +/** +* null +*/ +private String fabricante; + +@Column(name="DUI", nullable=true) + +/** +* null +*/ +private String dui; + +@Column(name="TOTAL_FOB", nullable=true) + +/** +* null +*/ +private BigDecimal total_fob; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* null +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TarmSolicitudImportacion(){ +} +/**Contructor de TarmSolicitudImportacion +@param pPk Clave Primaria del entity +*/ +public TarmSolicitudImportacion(TarmSolicitudImportacionKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmSolicitudImportacion +*/ +public static TarmSolicitudImportacion find(EntityManager pEntityManager,TarmSolicitudImportacionKey pKey) throws Exception{ + TarmSolicitudImportacion obj = pEntityManager.find(TarmSolicitudImportacion.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmSolicitudImportacion +@return El objeto que referencia a la Clave primaria de TarmSolicitudImportacion +*/ +public TarmSolicitudImportacionKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmSolicitudImportacion +@param pPk El objeto que referencia a la nueva Clave primaria de TarmSolicitudImportacion +*/ +public void setPk(TarmSolicitudImportacionKey pPk){ + pk=pPk; +} +/**Obtiene el valor de cpaisorigen +@return valor de cpaisorigen*/ +public String getCpaisorigen(){ + return cpaisorigen; +} +/**Fija el valor de cpaisorigen +@param pCpaisorigen nuevo Valor de cpaisorigen*/ +public void setCpaisorigen(String pCpaisorigen){ + cpaisorigen=pCpaisorigen; +} + +/**Obtiene el valor de fcreacion +@return valor de fcreacion*/ +public Date getFcreacion(){ + return fcreacion; +} +/**Fija el valor de fcreacion +@param pFcreacion nuevo Valor de fcreacion*/ +public void setFcreacion(Date pFcreacion){ + fcreacion=pFcreacion; +} + +/**Obtiene el valor de fabricante +@return valor de fabricante*/ +public String getFabricante(){ + return fabricante; +} +/**Fija el valor de fabricante +@param pFabricante nuevo Valor de fabricante*/ +public void setFabricante(String pFabricante){ + fabricante=pFabricante; +} + +/**Obtiene el valor de dui +@return valor de dui*/ +public String getDui(){ + return dui; +} +/**Fija el valor de dui +@param pDui nuevo Valor de dui*/ +public void setDui(String pDui){ + dui=pDui; +} + +/**Obtiene el valor de total_fob +@return valor de total_fob*/ +public BigDecimal getTotal_fob(){ + return total_fob; +} +/**Fija el valor de total_fob +@param pTotal_fob nuevo Valor de total_fob*/ +public void setTotal_fob(BigDecimal pTotal_fob){ + total_fob=pTotal_fob; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmSolicitudImportacion))return false; + TarmSolicitudImportacion that = (TarmSolicitudImportacion) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmSolicitudImportacion +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmSolicitudImportacion +*/ +public Object createInstance(){ + TarmSolicitudImportacion instance=new TarmSolicitudImportacion(); + instance.setPk(new TarmSolicitudImportacionKey()); + return instance; +} +/**Clona la entidad TarmSolicitudImportacion +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmSolicitudImportacion p=(TarmSolicitudImportacion)this.clone(); + p.setPk((TarmSolicitudImportacionKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmSolicitudImportacionKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmSolicitudImportacionKey.java.svn-base new file mode 100644 index 0000000..1587c71 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmSolicitudImportacionKey.java.svn-base @@ -0,0 +1,131 @@ +package com.fp.persistence.parmas.fun; + +import javax.persistence.Column; + +import java.io.Serializable; + +import com.fp.dto.hb.HibernateId; + +import java.lang.reflect.Field; + +import javax.persistence.Embeddable; +import javax.persistence.GeneratedValue; +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que hace referencia a la Clave Primaria de TARMSOLICITUDIMPORTACION*/ +@Embeddable +public class TarmSolicitudImportacionKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CIMPORTACION", nullable=false,updatable=false) +/** +* null +*/ +private Long cimportacion; + +@Column(name="CSOLICITUD", nullable=false,updatable=false) + +/** +* Codigo de solicitud de controld e armas +*/ +private String csolicitud; + +/**Contructor por defecto*/ +public TarmSolicitudImportacionKey(){} +/**Contructor de TarmSolicitudImportacionKey +@param pCimportacion null +@param pCsolicitud Codigo de solicitud de controld e armas +*/ +public TarmSolicitudImportacionKey(Long pCimportacion,String pCsolicitud){ + cimportacion=pCimportacion; + csolicitud=pCsolicitud; +} +/**Obtiene el valor de cimportacion +@return valor de cimportacion*/ +public Long getCimportacion(){ + return cimportacion; +} +/**Fija el valor de cimportacion +@param pCimportacion nuevo Valor de cimportacion*/ +public void setCimportacion(Long pCimportacion){ + cimportacion=pCimportacion; +} + +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Implementacion de la comparacion de TarmSolicitudImportacionKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmSolicitudImportacionKey))return false; + TarmSolicitudImportacionKey that = (TarmSolicitudImportacionKey) o; + if (this.getCimportacion() == null || that.getCimportacion() == null){ + return false; + } + if (! this.getCimportacion().equals(that.getCimportacion())){ + return false; + } + if (this.getCsolicitud() == null || that.getCsolicitud() == null){ + return false; + } + if (! this.getCsolicitud().equals(that.getCsolicitud())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmSolicitudImportacionKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCimportacion() == null ? 0 : this.getCimportacion().hashCode()); + result = result * 37 + (this.getCsolicitud() == null ? 0 : this.getCsolicitud().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmTotalPersona.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmTotalPersona.java.svn-base new file mode 100644 index 0000000..509ae99 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmTotalPersona.java.svn-base @@ -0,0 +1,483 @@ +package com.fp.persistence.parmas.fun; + +import javax.persistence.Entity; + +import java.sql.Timestamp; + +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import javax.persistence.GeneratedValue; +import javax.persistence.Query; + +import java.util.List; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMTOTALPERSONA*/ +@Entity(name="TarmTotalPersona") +@Table(name="TARMTOTALPERSONA") +public class TarmTotalPersona extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmTotalPersona +*/ +@Id +@Column(name="CTOTAL" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "TARMTOTALPERSONA"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.String"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "6")}) + @GeneratedValue(generator = "seq_id") +private String pk; +@Column(name="CANTIDADMOVIMIENTO", nullable=true) + +/** +* Almacena el valor de armas o explosivos ingresados o egresados que modifico el saldo anterior +*/ +private BigDecimal cantidadmovimiento; + +@Column(name="UNIDADMEDIDAPESOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de medida +*/ +private String unidadmedidapesocodigo; + +@Column(name="INGRESOEGRESO", nullable=true) + +/** +* Codigo de catalogo para indicar si es un ingreso o un egreso +*/ +private String ingresoegreso; + +@Column(name="INGRESOEGRESOCODIGO", nullable=true) + +/** +* Codigo de catalogcode ESINGRESOEGRESO +*/ +private String ingresoegresocodigo; + +@Column(name="TIPOARMAEXPLOSIVO", nullable=true) + +/** +* Codigo de catalogo 01 Revolver, 02 Polvora +*/ +private String tipoarmaexplosivo; + +@Column(name="TIPOARMAEXPLOSIVOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de de arma o explosivo +*/ +private String tipoarmaexplosivocodigo; + +@Column(name="PERSONCODIGO", nullable=true) + +/** +* Codigo de persona +*/ +private Integer personcodigo; + +@Column(name="FECHA", nullable=true) + +/** +* Fecha de registro +*/ +private Timestamp fecha; + +@Column(name="UNIDADMEDIDAPESO", nullable=true) + +/** +* Codigo de catalogo 01KG, 02 Unidad +*/ +private String unidadmedidapeso; + +@Column(name="SALDOANTERIOR", nullable=true) + +/** +* Valor numerico de la transaccion anterior +*/ +private BigDecimal saldoanterior; + +@Column(name="TOTAL", nullable=false) + +/** +* Suma total de arma explosivos segn tipoexplosivoarma,clase, persona +*/ +private BigDecimal total; + +@Column(name="CMOVIMIENTO", nullable=true) + +/** +* null +*/ +private String cmovimiento; + +@Column(name="CLASECODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo. Codigo de tabla de tipos de Clase de arma +*/ +private String clasecodigo; + +@Column(name="CARMA", nullable=true) + +/** +* Codigo de arma +*/ +private String carma; + +@Column(name="CLASE", nullable=true) + +/** +* Codigo de catalogo 01 Explosivo, 02 Arma de fuego +*/ +private String clase; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Versin del Registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TarmTotalPersona(){ +} +/**Contructor de TarmTotalPersona +@param pPk Clave Primaria del entity +@param pTotal Suma total de arma explosivos segn tipoexplosivoarma,clase, persona +*/ +public TarmTotalPersona(String pPk,BigDecimal pTotal){ + this(); + pk=pPk; + total=pTotal; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmTotalPersona +*/ +public static TarmTotalPersona find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmTotalPersona obj = pEntityManager.find(TarmTotalPersona.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmTotalPersona +@return El objeto que referencia a la Clave primaria de TarmTotalPersona +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmTotalPersona +@param pPk El objeto que referencia a la nueva Clave primaria de TarmTotalPersona +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de cantidadmovimiento +@return valor de cantidadmovimiento*/ +public BigDecimal getCantidadmovimiento(){ + return cantidadmovimiento; +} +/**Fija el valor de cantidadmovimiento +@param pCantidadmovimiento nuevo Valor de cantidadmovimiento*/ +public void setCantidadmovimiento(BigDecimal pCantidadmovimiento){ + cantidadmovimiento=pCantidadmovimiento; +} + +/**Obtiene el valor de unidadmedidapesocodigo +@return valor de unidadmedidapesocodigo*/ +public String getUnidadmedidapesocodigo(){ + return unidadmedidapesocodigo; +} +/**Fija el valor de unidadmedidapesocodigo +@param pUnidadmedidapesocodigo nuevo Valor de unidadmedidapesocodigo*/ +public void setUnidadmedidapesocodigo(String pUnidadmedidapesocodigo){ + unidadmedidapesocodigo=pUnidadmedidapesocodigo; +} + +/**Obtiene el valor de ingresoegreso +@return valor de ingresoegreso*/ +public String getIngresoegreso(){ + return ingresoegreso; +} +/**Fija el valor de ingresoegreso +@param pIngresoegreso nuevo Valor de ingresoegreso*/ +public void setIngresoegreso(String pIngresoegreso){ + ingresoegreso=pIngresoegreso; +} + +/**Obtiene el valor de ingresoegresocodigo +@return valor de ingresoegresocodigo*/ +public String getIngresoegresocodigo(){ + return ingresoegresocodigo; +} +/**Fija el valor de ingresoegresocodigo +@param pIngresoegresocodigo nuevo Valor de ingresoegresocodigo*/ +public void setIngresoegresocodigo(String pIngresoegresocodigo){ + ingresoegresocodigo=pIngresoegresocodigo; +} + +/**Obtiene el valor de tipoarmaexplosivo +@return valor de tipoarmaexplosivo*/ +public String getTipoarmaexplosivo(){ + return tipoarmaexplosivo; +} +/**Fija el valor de tipoarmaexplosivo +@param pTipoarmaexplosivo nuevo Valor de tipoarmaexplosivo*/ +public void setTipoarmaexplosivo(String pTipoarmaexplosivo){ + tipoarmaexplosivo=pTipoarmaexplosivo; +} + +/**Obtiene el valor de tipoarmaexplosivocodigo +@return valor de tipoarmaexplosivocodigo*/ +public String getTipoarmaexplosivocodigo(){ + return tipoarmaexplosivocodigo; +} +/**Fija el valor de tipoarmaexplosivocodigo +@param pTipoarmaexplosivocodigo nuevo Valor de tipoarmaexplosivocodigo*/ +public void setTipoarmaexplosivocodigo(String pTipoarmaexplosivocodigo){ + tipoarmaexplosivocodigo=pTipoarmaexplosivocodigo; +} + +/**Obtiene el valor de personcodigo +@return valor de personcodigo*/ +public Integer getPersoncodigo(){ + return personcodigo; +} +/**Fija el valor de personcodigo +@param pPersoncodigo nuevo Valor de personcodigo*/ +public void setPersoncodigo(Integer pPersoncodigo){ + personcodigo=pPersoncodigo; +} + +/**Obtiene el valor de fecha +@return valor de fecha*/ +public Timestamp getFecha(){ + return fecha; +} +/**Fija el valor de fecha +@param pFecha nuevo Valor de fecha*/ +public void setFecha(Timestamp pFecha){ + fecha=pFecha; +} + +/**Obtiene el valor de unidadmedidapeso +@return valor de unidadmedidapeso*/ +public String getUnidadmedidapeso(){ + return unidadmedidapeso; +} +/**Fija el valor de unidadmedidapeso +@param pUnidadmedidapeso nuevo Valor de unidadmedidapeso*/ +public void setUnidadmedidapeso(String pUnidadmedidapeso){ + unidadmedidapeso=pUnidadmedidapeso; +} + +/**Obtiene el valor de saldoanterior +@return valor de saldoanterior*/ +public BigDecimal getSaldoanterior(){ + return saldoanterior; +} +/**Fija el valor de saldoanterior +@param pSaldoanterior nuevo Valor de saldoanterior*/ +public void setSaldoanterior(BigDecimal pSaldoanterior){ + saldoanterior=pSaldoanterior; +} + +/**Obtiene el valor de total +@return valor de total*/ +public BigDecimal getTotal(){ + return total; +} +/**Fija el valor de total +@param pTotal nuevo Valor de total*/ +public void setTotal(BigDecimal pTotal){ + total=pTotal; +} + +/**Obtiene el valor de cmovimiento +@return valor de cmovimiento*/ +public String getCmovimiento(){ + return cmovimiento; +} +/**Fija el valor de cmovimiento +@param pCmovimiento nuevo Valor de cmovimiento*/ +public void setCmovimiento(String pCmovimiento){ + cmovimiento=pCmovimiento; +} + +/**Obtiene el valor de clasecodigo +@return valor de clasecodigo*/ +public String getClasecodigo(){ + return clasecodigo; +} +/**Fija el valor de clasecodigo +@param pClasecodigo nuevo Valor de clasecodigo*/ +public void setClasecodigo(String pClasecodigo){ + clasecodigo=pClasecodigo; +} + +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de clase +@return valor de clase*/ +public String getClase(){ + return clase; +} +/**Fija el valor de clase +@param pClase nuevo Valor de clase*/ +public void setClase(String pClase){ + clase=pClase; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmTotalPersona))return false; + TarmTotalPersona that = (TarmTotalPersona) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmTotalPersona +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmTotalPersona +*/ +public Object createInstance(){ + TarmTotalPersona instance=new TarmTotalPersona(); + return instance; +} +/**Clona la entidad TarmTotalPersona +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmTotalPersona p=(TarmTotalPersona)this.clone(); + return p; +} + +/** + * Sentencia que devuelve un registro vigente de TarmTotalPerson + */ +private static final String JPQL_PERSONA = "from TarmTotalPersona ttp" + " where ttp.personcodigo = :personcode"; + +/** + * Metodo que entrega datos de un total en TarmTotalPerson. + * + * @param pEntityManager Session de la base de datos. + * @param personcode Codigo de la persona a quien pertenece la Direccion. + * @param addressnumber Numero de la direccion. + * @return tcustPersonAddress + * @throws Exception + */ +public static List findByPersona(EntityManager pEntityManager, Integer personcode) throws Exception { + Query qry = pEntityManager.createQuery(TarmTotalPersona.JPQL_PERSONA); + qry.setParameter("personcode", personcode); + return qry.getResultList(); +} + + +/** + * Sentencia que devuelve un registro vigente de TcustPersonAddress + */ +private static final String JPQL_TIPOCLASEPER = "from TarmTotalPersona ttp" + " where ttp.personcodigo = :personcode and ttp.clase = :clase and ttp.tipoarmaexplosivo = :tipoarmaexplosivo" + + " and ttp.fecha = (select max(ttpi.fecha) from TarmTotalPersona ttpi where ttpi.personcodigo = :personcode and ttpi.clase = :clase and ttpi.tipoarmaexplosivo = :tipoarmaexplosivo)"; + +/** + * Metodo que entrega datos de una Direccion definida en TcustPersonAddress. + * + * @param pEntityManager Session de la base de datos. + * @param personcode Codigo de la persona a quien pertenece la Direccion. + * @param addressnumber Numero de la direccion. + * @return tcustPersonAddress + * @throws Exception + */ +public static List findByClase(EntityManager pEntityManager, Integer personcode, String clase, String tipoarmaexplosivo) throws Exception { + Query qry = pEntityManager.createQuery(TarmTotalPersona.JPQL_TIPOCLASEPER); + qry.setParameter("personcode", personcode); + qry.setParameter("clase", clase); + qry.setParameter("tipoarmaexplosivo", tipoarmaexplosivo); + return qry.getResultList(); +} + + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmVentaArmaTem.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmVentaArmaTem.java.svn-base new file mode 100644 index 0000000..9218c66 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/.svn/text-base/TarmVentaArmaTem.java.svn-base @@ -0,0 +1,257 @@ +package com.fp.persistence.parmas.fun; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMVENTAARMATEM*/ +@Entity(name="TarmVentaArmaTem") +@Table(name="TARMVENTAARMATEM") +public class TarmVentaArmaTem extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmVentaArmaTem +*/ +@Id +@Column(name="CARMAVENTATEM" ,nullable=false, updatable=false) +private Integer pk; +@Column(name="CARMA", nullable=true) + +/** +* null +*/ +private String carma; + +@Column(name="FCREACION", nullable=true) + +/** +* null +*/ +private Date fcreacion; + +@Column(name="ESTADO", nullable=true) + +/** +* null +*/ +private String estado; + +@Column(name="PERSONCODIGO", nullable=true) + +/** +* null +*/ +private Integer personcodigo; + +@Column(name="FACTURA", nullable=true) +private String factura; + +@Column(name="NOREGISTRO", nullable=true) +private String noregistra; + + + +@Column(name="JUSTIFICACION", nullable=true) +private String justificacion; + +@Column(name="OBSERVACION", nullable=true) +private String observacion; + +@Column(name="PATHDOCUMENTO", nullable=true) +private String pathdocumento; + +@Column(name="CENTROCONTROL", nullable=true) +private String centrocontrol; + +/**Contructor por defecto*/ +public TarmVentaArmaTem(){ +} +/**Contructor de TarmVentaArmaTem +@param pPk Clave Primaria del entity +*/ +public TarmVentaArmaTem(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmVentaArmaTem +*/ +public static TarmVentaArmaTem find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmVentaArmaTem obj = pEntityManager.find(TarmVentaArmaTem.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmVentaArmaTem +@return El objeto que referencia a la Clave primaria de TarmVentaArmaTem +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmVentaArmaTem +@param pPk El objeto que referencia a la nueva Clave primaria de TarmVentaArmaTem +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de fcreacion +@return valor de fcreacion*/ +public Date getFcreacion(){ + return fcreacion; +} +/**Fija el valor de fcreacion +@param pFcreacion nuevo Valor de fcreacion*/ +public void setFcreacion(Date pFcreacion){ + fcreacion=pFcreacion; +} + +/**Obtiene el valor de estado +@return valor de estado*/ +public String getEstado(){ + return estado; +} +/**Fija el valor de estado +@param pEstado nuevo Valor de estado*/ +public void setEstado(String pEstado){ + estado=pEstado; +} + +/**Obtiene el valor de personcodigo +@return valor de personcodigo*/ +public Integer getPersoncodigo(){ + return personcodigo; +} +/**Fija el valor de personcodigo +@param pPersoncodigo nuevo Valor de personcodigo*/ +public void setPersoncodigo(Integer pPersoncodigo){ + personcodigo=pPersoncodigo; +} + + + +public String getFactura() { + return factura; +} +public void setFactura(String factura) { + this.factura = factura; +} +public String getNoregistra() { + return noregistra; +} +public void setNoregistra(String noregistra) { + this.noregistra = noregistra; +} + +public String getJustificacion() { + return justificacion; +} +public void setJustificacion(String justificacion) { + this.justificacion = justificacion; +} +public String getObservacion() { + return observacion; +} +public void setObservacion(String observacion) { + this.observacion = observacion; +} + +public String getPathdocumento() { + return pathdocumento; +} +public void setPathdocumento(String pathdocumento) { + this.pathdocumento = pathdocumento; +} + +public String getCentrocontrol() { + return centrocontrol; +} +public void setCentrocontrol(String centrocontrol) { + this.centrocontrol = centrocontrol; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmVentaArmaTem))return false; + TarmVentaArmaTem that = (TarmVentaArmaTem) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmVentaArmaTem +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmVentaArmaTem +*/ +public Object createInstance(){ + TarmVentaArmaTem instance=new TarmVentaArmaTem(); + return instance; +} +/**Clona la entidad TarmVentaArmaTem +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmVentaArmaTem p=(TarmVentaArmaTem)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmCarga.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmCarga.java new file mode 100644 index 0000000..69e366e --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmCarga.java @@ -0,0 +1,329 @@ +package com.fp.persistence.parmas.fun; + +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMCARGA*/ +@Entity(name="TarmCarga") +@Table(name="TARMCARGA") +public class TarmCarga extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmCarga +*/ +@Id +@Column(name="CCARGA" ,nullable=false, updatable=false) +private String pk; +@Column(name="PROVINCECODE", nullable=true) + +/** +* null +*/ +private String provincecode; + +@Column(name="CITYCODE", nullable=true) + +/** +* null +*/ +private String citycode; + +@Column(name="AUCP", nullable=true) + +/** +* NUMERO DE SOLICITUD DE IMPORTACION VUE +*/ +private String aucp; + +@Column(name="CANTONCODE", nullable=true) + +/** +* null +*/ +private String cantoncode; + +@Column(name="PERSONCODE", nullable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="ESDESADUANIZADO", nullable=false) + +/** +* CAMPO PARA INDICAR SI UNA IMPORTACION FUE DESADUANIDA +*/ +private String esdesaduanizado; + +@Column(name="TIPOCARGA", nullable=false) + +/** +* INDICA SI LA CARGA ES UNA IMPORTACION, PRODUCCION O INVENTARIO +*/ +private String tipocarga; + +@Column(name="CREGISTRO", nullable=false) + +/** +* null +*/ +private Long cregistro; + +@Column(name="FECHA", nullable=false) + +/** +* FECHA DE LA CARGA +*/ +private Timestamp fecha; + +@Column(name="CSOLICITUD", nullable=true) + +/** +* Codigo de solicitud previa importacion a la que esta atada la carga +*/ +private String csolicitud; + +@Column(name="CATEGORIA", nullable=true) + +/** +* null +*/ +private String categoria; + +/**Contructor por defecto*/ +public TarmCarga(){ +} +/**Contructor de TarmCarga +@param pPk Clave Primaria del entity +@param pPersoncode Codigo de persona +@param pEsdesaduanizado CAMPO PARA INDICAR SI UNA IMPORTACION FUE DESADUANIDA +@param pTipocarga INDICA SI LA CARGA ES UNA IMPORTACION, PRODUCCION O INVENTARIO +@param pCregistro null +@param pFecha FECHA DE LA CARGA +*/ +public TarmCarga(String pPk,Integer pPersoncode,String pEsdesaduanizado,String pTipocarga,Long pCregistro,Timestamp pFecha){ + this(); + pk=pPk; + personcode=pPersoncode; + esdesaduanizado=pEsdesaduanizado; + tipocarga=pTipocarga; + cregistro=pCregistro; + fecha=pFecha; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmCarga +*/ +public static TarmCarga find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmCarga obj = pEntityManager.find(TarmCarga.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmCarga +@return El objeto que referencia a la Clave primaria de TarmCarga +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmCarga +@param pPk El objeto que referencia a la nueva Clave primaria de TarmCarga +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de provincecode +@return valor de provincecode*/ +public String getProvincecode(){ + return provincecode; +} +/**Fija el valor de provincecode +@param pProvincecode nuevo Valor de provincecode*/ +public void setProvincecode(String pProvincecode){ + provincecode=pProvincecode; +} + +/**Obtiene el valor de citycode +@return valor de citycode*/ +public String getCitycode(){ + return citycode; +} +/**Fija el valor de citycode +@param pCitycode nuevo Valor de citycode*/ +public void setCitycode(String pCitycode){ + citycode=pCitycode; +} + +/**Obtiene el valor de aucp +@return valor de aucp*/ +public String getAucp(){ + return aucp; +} +/**Fija el valor de aucp +@param pAucp nuevo Valor de aucp*/ +public void setAucp(String pAucp){ + aucp=pAucp; +} + +/**Obtiene el valor de cantoncode +@return valor de cantoncode*/ +public String getCantoncode(){ + return cantoncode; +} +/**Fija el valor de cantoncode +@param pCantoncode nuevo Valor de cantoncode*/ +public void setCantoncode(String pCantoncode){ + cantoncode=pCantoncode; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de esdesaduanizado +@return valor de esdesaduanizado*/ +public String getEsdesaduanizado(){ + return esdesaduanizado; +} +/**Fija el valor de esdesaduanizado +@param pEsdesaduanizado nuevo Valor de esdesaduanizado*/ +public void setEsdesaduanizado(String pEsdesaduanizado){ + esdesaduanizado=pEsdesaduanizado; +} + +/**Obtiene el valor de tipocarga +@return valor de tipocarga*/ +public String getTipocarga(){ + return tipocarga; +} +/**Fija el valor de tipocarga +@param pTipocarga nuevo Valor de tipocarga*/ +public void setTipocarga(String pTipocarga){ + tipocarga=pTipocarga; +} + +/**Obtiene el valor de cregistro +@return valor de cregistro*/ +public Long getCregistro(){ + return cregistro; +} +/**Fija el valor de cregistro +@param pCregistro nuevo Valor de cregistro*/ +public void setCregistro(Long pCregistro){ + cregistro=pCregistro; +} + +/**Obtiene el valor de fecha +@return valor de fecha*/ +public Timestamp getFecha(){ + return fecha; +} +/**Fija el valor de fecha +@param pFecha nuevo Valor de fecha*/ +public void setFecha(Timestamp pFecha){ + fecha=pFecha; +} + +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Obtiene el valor de categoria +@return valor de categoria*/ +public String getCategoria(){ + return categoria; +} +/**Fija el valor de categoria +@param pCategoria nuevo Valor de categoria*/ +public void setCategoria(String pCategoria){ + categoria=pCategoria; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmCarga))return false; + TarmCarga that = (TarmCarga) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmCarga +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmCarga +*/ +public Object createInstance(){ + TarmCarga instance=new TarmCarga(); + return instance; +} +/**Clona la entidad TarmCarga +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmCarga p=(TarmCarga)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmCargaDetalle.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmCargaDetalle.java new file mode 100644 index 0000000..6a38c9f --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmCargaDetalle.java @@ -0,0 +1,160 @@ +package com.fp.persistence.parmas.fun; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMCARGADETALLE*/ +@Entity(name="TarmCargaDetalle") +@Table(name="TARMCARGADETALLE") +public class TarmCargaDetalle extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmCargaDetalle +*/ +@Id +@Column(name="CCARGADETALLE" ,nullable=false, updatable=false) +private String pk; +@Column(name="CCARGA", nullable=false) + +/** +* CODIGO DE CARGA +*/ +private String ccarga; + +@Column(name="CARMA", nullable=false) + +/** +* CODIGO DE ARMA +*/ +private String carma; + +/**Contructor por defecto*/ +public TarmCargaDetalle(){ +} +/**Contructor de TarmCargaDetalle +@param pPk Clave Primaria del entity +@param pCcarga CODIGO DE CARGA +@param pCarma CODIGO DE ARMA +*/ +public TarmCargaDetalle(String pPk,String pCcarga,String pCarma){ + this(); + pk=pPk; + ccarga=pCcarga; + carma=pCarma; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmCargaDetalle +*/ +public static TarmCargaDetalle find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmCargaDetalle obj = pEntityManager.find(TarmCargaDetalle.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmCargaDetalle +@return El objeto que referencia a la Clave primaria de TarmCargaDetalle +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmCargaDetalle +@param pPk El objeto que referencia a la nueva Clave primaria de TarmCargaDetalle +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de ccarga +@return valor de ccarga*/ +public String getCcarga(){ + return ccarga; +} +/**Fija el valor de ccarga +@param pCcarga nuevo Valor de ccarga*/ +public void setCcarga(String pCcarga){ + ccarga=pCcarga; +} + +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmCargaDetalle))return false; + TarmCargaDetalle that = (TarmCargaDetalle) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmCargaDetalle +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmCargaDetalle +*/ +public Object createInstance(){ + TarmCargaDetalle instance=new TarmCargaDetalle(); + return instance; +} +/**Clona la entidad TarmCargaDetalle +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmCargaDetalle p=(TarmCargaDetalle)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmCashManagementHistory.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmCashManagementHistory.java new file mode 100644 index 0000000..bc465d2 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmCashManagementHistory.java @@ -0,0 +1,224 @@ +package com.fp.persistence.parmas.fun; + +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMCASHMANAGEMENTHISTORY*/ +@Entity(name="TarmCashManagementHistory") +@Table(name="TARMCASHMANAGEMENTHISTORY") +public class TarmCashManagementHistory extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmCashManagementHistory +*/ +@Id +@Column(name="CCASHMANAGEMENT" ,nullable=false, updatable=false) +private String pk; +@Column(name="PATHREPORTE", nullable=false) + +/** +* null +*/ +private String pathreporte; + +@Column(name="USERCODE", nullable=false) + +/** +* null +*/ +private String usercode; + +@Column(name="DATEFROM", nullable=false) + +/** +* null +*/ +private Timestamp datefrom; + +@Column(name="DATETO", nullable=false) + +/** +* null +*/ +private Timestamp dateto; + +@Column(name="NOMBREARCHIVO", nullable=false) + +/** +* null +*/ +private String nombrearchivo; + +/**Contructor por defecto*/ +public TarmCashManagementHistory(){ +} +/**Contructor de TarmCashManagementHistory +@param pPk Clave Primaria del entity +@param pPathreporte null +@param pUsercode null +@param pDatefrom null +@param pDateto null +@param pNombrearchivo null +*/ +public TarmCashManagementHistory(String pPk,String pPathreporte,String pUsercode,Timestamp pDatefrom,Timestamp pDateto,String pNombrearchivo){ + this(); + pk=pPk; + pathreporte=pPathreporte; + usercode=pUsercode; + datefrom=pDatefrom; + dateto=pDateto; + nombrearchivo=pNombrearchivo; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmCashManagementHistory +*/ +public static TarmCashManagementHistory find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmCashManagementHistory obj = pEntityManager.find(TarmCashManagementHistory.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmCashManagementHistory +@return El objeto que referencia a la Clave primaria de TarmCashManagementHistory +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmCashManagementHistory +@param pPk El objeto que referencia a la nueva Clave primaria de TarmCashManagementHistory +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de pathreporte +@return valor de pathreporte*/ +public String getPathreporte(){ + return pathreporte; +} +/**Fija el valor de pathreporte +@param pPathreporte nuevo Valor de pathreporte*/ +public void setPathreporte(String pPathreporte){ + pathreporte=pPathreporte; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de datefrom +@return valor de datefrom*/ +public Timestamp getDatefrom(){ + return datefrom; +} +/**Fija el valor de datefrom +@param pDatefrom nuevo Valor de datefrom*/ +public void setDatefrom(Timestamp pDatefrom){ + datefrom=pDatefrom; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de nombrearchivo +@return valor de nombrearchivo*/ +public String getNombrearchivo(){ + return nombrearchivo; +} +/**Fija el valor de nombrearchivo +@param pNombrearchivo nuevo Valor de nombrearchivo*/ +public void setNombrearchivo(String pNombrearchivo){ + nombrearchivo=pNombrearchivo; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmCashManagementHistory))return false; + TarmCashManagementHistory that = (TarmCashManagementHistory) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmCashManagementHistory +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmCashManagementHistory +*/ +public Object createInstance(){ + TarmCashManagementHistory instance=new TarmCashManagementHistory(); + return instance; +} +/**Clona la entidad TarmCashManagementHistory +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmCashManagementHistory p=(TarmCashManagementHistory)this.clone(); + return p; +} +public Object getId() { + return this.pk; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmDetalleImportacion.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmDetalleImportacion.java new file mode 100644 index 0000000..bc3f26f --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmDetalleImportacion.java @@ -0,0 +1,201 @@ +package com.fp.persistence.parmas.fun; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMDETALLEIMPORTACION*/ +@Entity(name="TarmDetalleImportacion") +@Table(name="TARMDETALLEIMPORTACION") +public class TarmDetalleImportacion extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmDetalleImportacion +*/ +@Id +@Column(name="CDETALLEIMPORTACION" ,nullable=false, updatable=false) +private Long pk; +@Column(name="CIMPORTACION", nullable=true) + +/** +* null +*/ +private Long cimportacion; + +@Column(name="CSOLICITUD", nullable=true) + +/** +* Codigo de solicitud de controld e armas +*/ +private String csolicitud; + +@Column(name="CARMA", nullable=true) + +/** +* null +*/ +private String carma; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* null +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TarmDetalleImportacion(){ +} +/**Contructor de TarmDetalleImportacion +@param pPk Clave Primaria del entity +*/ +public TarmDetalleImportacion(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmDetalleImportacion +*/ +public static TarmDetalleImportacion find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmDetalleImportacion obj = pEntityManager.find(TarmDetalleImportacion.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmDetalleImportacion +@return El objeto que referencia a la Clave primaria de TarmDetalleImportacion +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmDetalleImportacion +@param pPk El objeto que referencia a la nueva Clave primaria de TarmDetalleImportacion +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de cimportacion +@return valor de cimportacion*/ +public Long getCimportacion(){ + return cimportacion; +} +/**Fija el valor de cimportacion +@param pCimportacion nuevo Valor de cimportacion*/ +public void setCimportacion(Long pCimportacion){ + cimportacion=pCimportacion; +} + +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmDetalleImportacion))return false; + TarmDetalleImportacion that = (TarmDetalleImportacion) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmDetalleImportacion +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmDetalleImportacion +*/ +public Object createInstance(){ + TarmDetalleImportacion instance=new TarmDetalleImportacion(); + return instance; +} +/**Clona la entidad TarmDetalleImportacion +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmDetalleImportacion p=(TarmDetalleImportacion)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmInventarioSubidoPorPersona.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmInventarioSubidoPorPersona.java new file mode 100644 index 0000000..f924ada --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmInventarioSubidoPorPersona.java @@ -0,0 +1,140 @@ +package com.fp.persistence.parmas.fun; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMINVENTARIOSUBIDOPORPERSONA*/ +@Entity(name="TarmInventarioSubidoPorPersona") +@Table(name="TARMINVENTARIOSUBIDOPORPERSONA") +public class TarmInventarioSubidoPorPersona extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmInventarioSubidoPorPersona +*/ +@EmbeddedId +private TarmInventarioSubidoPorPersonaKey pk; +@Column(name="FECHACARGA", nullable=true) + +/** +* null +*/ +private Timestamp fechacarga; + +/**Contructor por defecto*/ +public TarmInventarioSubidoPorPersona(){ +} +/**Contructor de TarmInventarioSubidoPorPersona +@param pPk Clave Primaria del entity +*/ +public TarmInventarioSubidoPorPersona(TarmInventarioSubidoPorPersonaKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmInventarioSubidoPorPersona +*/ +public static TarmInventarioSubidoPorPersona find(EntityManager pEntityManager,TarmInventarioSubidoPorPersonaKey pKey) throws Exception{ + TarmInventarioSubidoPorPersona obj = pEntityManager.find(TarmInventarioSubidoPorPersona.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmInventarioSubidoPorPersona +@return El objeto que referencia a la Clave primaria de TarmInventarioSubidoPorPersona +*/ +public TarmInventarioSubidoPorPersonaKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmInventarioSubidoPorPersona +@param pPk El objeto que referencia a la nueva Clave primaria de TarmInventarioSubidoPorPersona +*/ +public void setPk(TarmInventarioSubidoPorPersonaKey pPk){ + pk=pPk; +} +/**Obtiene el valor de fechacarga +@return valor de fechacarga*/ +public Timestamp getFechacarga(){ + return fechacarga; +} +/**Fija el valor de fechacarga +@param pFechacarga nuevo Valor de fechacarga*/ +public void setFechacarga(Timestamp pFechacarga){ + fechacarga=pFechacarga; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmInventarioSubidoPorPersona))return false; + TarmInventarioSubidoPorPersona that = (TarmInventarioSubidoPorPersona) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmInventarioSubidoPorPersona +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmInventarioSubidoPorPersona +*/ +public Object createInstance(){ + TarmInventarioSubidoPorPersona instance=new TarmInventarioSubidoPorPersona(); + instance.setPk(new TarmInventarioSubidoPorPersonaKey()); + return instance; +} +/**Clona la entidad TarmInventarioSubidoPorPersona +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmInventarioSubidoPorPersona p=(TarmInventarioSubidoPorPersona)this.clone(); + p.setPk((TarmInventarioSubidoPorPersonaKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmInventarioSubidoPorPersonaKey.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmInventarioSubidoPorPersonaKey.java new file mode 100644 index 0000000..1a46332 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmInventarioSubidoPorPersonaKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.parmas.fun; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMINVENTARIOSUBIDOPORPERSONA*/ +@Embeddable +public class TarmInventarioSubidoPorPersonaKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CLASE", nullable=false,updatable=false) + +/** +* null +*/ +private String clase; + +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* null +*/ +private Integer personcode; + +/**Contructor por defecto*/ +public TarmInventarioSubidoPorPersonaKey(){} +/**Contructor de TarmInventarioSubidoPorPersonaKey +@param pClase null +@param pPersoncode null +*/ +public TarmInventarioSubidoPorPersonaKey(String pClase,Integer pPersoncode){ + clase=pClase; + personcode=pPersoncode; +} +/**Obtiene el valor de clase +@return valor de clase*/ +public String getClase(){ + return clase; +} +/**Fija el valor de clase +@param pClase nuevo Valor de clase*/ +public void setClase(String pClase){ + clase=pClase; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Implementacion de la comparacion de TarmInventarioSubidoPorPersonaKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmInventarioSubidoPorPersonaKey))return false; + TarmInventarioSubidoPorPersonaKey that = (TarmInventarioSubidoPorPersonaKey) o; + if (this.getClase() == null || that.getClase() == null){ + return false; + } + if (! this.getClase().equals(that.getClase())){ + return false; + } + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmInventarioSubidoPorPersonaKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getClase() == null ? 0 : this.getClase().hashCode()); + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmMovimientoArmas.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmMovimientoArmas.java new file mode 100644 index 0000000..e0124db --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmMovimientoArmas.java @@ -0,0 +1,322 @@ +package com.fp.persistence.parmas.fun; + +import javax.persistence.Entity; + +import java.sql.Timestamp; + +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMMOVIMIENTOARMAS*/ +@Entity(name="TarmMovimientoArmas") +@Table(name="TARMMOVIMIENTOARMAS") +public class TarmMovimientoArmas extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmMovimientoArmas +*/ +@Id +@Column(name="CMOVIMIENTO" ,nullable=false, updatable=false) +private String pk; +@Column(name="FACTURA", nullable=true) + +/** +* Nmero de Factura +*/ +private String factura; + +@Column(name="FECHA", nullable=true) + +/** +* Fecha de registro +*/ +private Timestamp fecha; + +@Column(name="JUSTIFICACION", nullable=true) + +/** +* Comentario en el cual se justifica el movimiento del material +*/ +private String justificacion; + +@Column(name="NOREGISTRO", nullable=true) + +/** +* Nmero de Registro +*/ +private String noregistro; + + + +@Column(name="TIPOMOVIMIENTOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de movimiento +*/ +private String tipomovimientocodigo; + +@Column(name="CARMA", nullable=true) + +/** +* Codigo del arma la cual se vende, transpasa, entre otros. +*/ +private String carma; + +@Column(name="PERSONCODEVENDEDOR", nullable=true) + +/** +* Codigo de persona vendedora +*/ +private Integer personcodevendedor; + +@Column(name="TIPOMOVIMIENTO", nullable=true) + +/** +* Codigo de catalogo 01 Venta, 02 Produccion +*/ +private String tipomovimiento; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Versin del Registro +*/ +private Integer recordversion; + +@Column(name="PERSONCODECOMPRADOR", nullable=true) + +/** +* Codigo de persona compradora + +*/ +private Integer personcodecomprador; + +/**Contructor por defecto*/ +public TarmMovimientoArmas(){ +} +/**Contructor de TarmMovimientoArmas +@param pPk Clave Primaria del entity +*/ +public TarmMovimientoArmas(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmMovimientoArmas +*/ +public static TarmMovimientoArmas find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmMovimientoArmas obj = pEntityManager.find(TarmMovimientoArmas.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmMovimientoArmas +@return El objeto que referencia a la Clave primaria de TarmMovimientoArmas +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmMovimientoArmas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmMovimientoArmas +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de factura +@return valor de factura*/ +public String getFactura(){ + return factura; +} +/**Fija el valor de factura +@param pFactura nuevo Valor de factura*/ +public void setFactura(String pFactura){ + factura=pFactura; +} + +/**Obtiene el valor de fecha +@return valor de fecha*/ +public Timestamp getFecha(){ + return fecha; +} +/**Fija el valor de fecha +@param pFecha nuevo Valor de fecha*/ +public void setFecha(Timestamp pFecha){ + fecha=pFecha; +} + +/**Obtiene el valor de justificacion +@return valor de justificacion*/ +public String getJustificacion(){ + return justificacion; +} +/**Fija el valor de justificacion +@param pJustificacion nuevo Valor de justificacion*/ +public void setJustificacion(String pJustificacion){ + justificacion=pJustificacion; +} + +/**Obtiene el valor de noregistro +@return valor de noregistro*/ +public String getNoregistro(){ + return noregistro; +} +/**Fija el valor de noregistro +@param pNoregistro nuevo Valor de noregistro*/ +public void setNoregistro(String pNoregistro){ + noregistro=pNoregistro; +} + +/**Obtiene el valor de fecha + +/**Fija el valor de fecha + + +/**Obtiene el valor de tipomovimientocodigo +@return valor de tipomovimientocodigo*/ +public String getTipomovimientocodigo(){ + return tipomovimientocodigo; +} +/**Fija el valor de tipomovimientocodigo +@param pTipomovimientocodigo nuevo Valor de tipomovimientocodigo*/ +public void setTipomovimientocodigo(String pTipomovimientocodigo){ + tipomovimientocodigo=pTipomovimientocodigo; +} + +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de personcodevendedor +@return valor de personcodevendedor*/ +public Integer getPersoncodevendedor(){ + return personcodevendedor; +} +/**Fija el valor de personcodevendedor +@param pPersoncodevendedor nuevo Valor de personcodevendedor*/ +public void setPersoncodevendedor(Integer pPersoncodevendedor){ + personcodevendedor=pPersoncodevendedor; +} + +/**Obtiene el valor de tipomovimiento +@return valor de tipomovimiento*/ +public String getTipomovimiento(){ + return tipomovimiento; +} +/**Fija el valor de tipomovimiento +@param pTipomovimiento nuevo Valor de tipomovimiento*/ +public void setTipomovimiento(String pTipomovimiento){ + tipomovimiento=pTipomovimiento; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de personcodecomprador +@return valor de personcodecomprador*/ +public Integer getPersoncodecomprador(){ + return personcodecomprador; +} +/**Fija el valor de personcodecomprador +@param pPersoncodecomprador nuevo Valor de personcodecomprador*/ +public void setPersoncodecomprador(Integer pPersoncodecomprador){ + personcodecomprador=pPersoncodecomprador; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmMovimientoArmas))return false; + TarmMovimientoArmas that = (TarmMovimientoArmas) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmMovimientoArmas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmMovimientoArmas +*/ +public Object createInstance(){ + TarmMovimientoArmas instance=new TarmMovimientoArmas(); + return instance; +} +/**Clona la entidad TarmMovimientoArmas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmMovimientoArmas p=(TarmMovimientoArmas)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmRegistroArmas.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmRegistroArmas.java new file mode 100644 index 0000000..5afcdc1 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmRegistroArmas.java @@ -0,0 +1,367 @@ +package com.fp.persistence.parmas.fun; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMREGISTROARMAS*/ +@Entity(name="TarmRegistroArmas") +@Table(name="TARMREGISTROARMAS") +public class TarmRegistroArmas extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmRegistroArmas +*/ +@Id +@Column(name="CREGISTRO" ,nullable=false, updatable=false) +private Long pk; +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="TIPOREGISTRO", nullable=true) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String tiporegistro; + +@Column(name="TIPOREGISTROCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo Codigo de tabla de tipos de Registro +*/ +private String tiporegistrocodigo; + +@Column(name="PAISORIGEN", nullable=true) + +/** +* Codigo de pais +*/ +private String paisorigen; + +@Column(name="FCREACION", nullable=true) + +/** +* Fecha de creacin del registro + +*/ +private Date fcreacion; + +@Column(name="FABRICANTE", nullable=true) + +/** +* Nombre del fabricante del arma +*/ +private String fabricante; + +@Column(name="DUI", nullable=true) + +/** +* null +*/ +private String dui; + +@Column(name="TOTALFOB", nullable=true) + +/** +* null +*/ +private BigDecimal totalfob; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* null +*/ +private Integer recordversion; + +@Column(name="TRAMITE", nullable=true) + +/** +* null +*/ +private Long tramite; + +@Column(name="AEROPUERTOPUERTO", nullable=true) + +/** +* Nombre del aeropuerto o puerto referente a la importacion +*/ +private String aeropuertopuerto; + +@Column(name="SOLICITUDNUM", nullable=true) + +/** +* Numero de la solicitud relacionada con la importacion +*/ +private String solicitudnum; + +@Column(name="FECHASOLICITUD", nullable=true) + +/** +* Fecha de la solicitud +*/ +private Date fechasolicitud; + +/**Contructor por defecto*/ +public TarmRegistroArmas(){ +} +/**Contructor de TarmRegistroArmas +@param pPk Clave Primaria del entity +*/ +public TarmRegistroArmas(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmRegistroArmas +*/ +public static TarmRegistroArmas find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmRegistroArmas obj = pEntityManager.find(TarmRegistroArmas.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmRegistroArmas +@return El objeto que referencia a la Clave primaria de TarmRegistroArmas +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmRegistroArmas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmRegistroArmas +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de tiporegistro +@return valor de tiporegistro*/ +public String getTiporegistro(){ + return tiporegistro; +} +/**Fija el valor de tiporegistro +@param pTiporegistro nuevo Valor de tiporegistro*/ +public void setTiporegistro(String pTiporegistro){ + tiporegistro=pTiporegistro; +} + +/**Obtiene el valor de tiporegistrocodigo +@return valor de tiporegistrocodigo*/ +public String getTiporegistrocodigo(){ + return tiporegistrocodigo; +} +/**Fija el valor de tiporegistrocodigo +@param pTiporegistrocodigo nuevo Valor de tiporegistrocodigo*/ +public void setTiporegistrocodigo(String pTiporegistrocodigo){ + tiporegistrocodigo=pTiporegistrocodigo; +} + +/**Obtiene el valor de paisorigen +@return valor de paisorigen*/ +public String getPaisorigen(){ + return paisorigen; +} +/**Fija el valor de paisorigen +@param pPaisorigen nuevo Valor de paisorigen*/ +public void setPaisorigen(String pPaisorigen){ + paisorigen=pPaisorigen; +} + +/**Obtiene el valor de fcreacion +@return valor de fcreacion*/ +public Date getFcreacion(){ + return fcreacion; +} +/**Fija el valor de fcreacion +@param pFcreacion nuevo Valor de fcreacion*/ +public void setFcreacion(Date pFcreacion){ + fcreacion=pFcreacion; +} + +/**Obtiene el valor de fabricante +@return valor de fabricante*/ +public String getFabricante(){ + return fabricante; +} +/**Fija el valor de fabricante +@param pFabricante nuevo Valor de fabricante*/ +public void setFabricante(String pFabricante){ + fabricante=pFabricante; +} + +/**Obtiene el valor de dui +@return valor de dui*/ +public String getDui(){ + return dui; +} +/**Fija el valor de dui +@param pDui nuevo Valor de dui*/ +public void setDui(String pDui){ + dui=pDui; +} + +/**Obtiene el valor de totalfob +@return valor de totalfob*/ +public BigDecimal getTotalfob(){ + return totalfob; +} +/**Fija el valor de totalfob +@param pTotalfob nuevo Valor de totalfob*/ +public void setTotalfob(BigDecimal pTotalfob){ + totalfob=pTotalfob; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de tramite +@return valor de tramite*/ +public Long getTramite(){ + return tramite; +} +/**Fija el valor de tramite +@param pTramite nuevo Valor de tramite*/ +public void setTramite(Long pTramite){ + tramite=pTramite; +} + +/**Obtiene el valor de aeropuertopuerto +@return valor de aeropuertopuerto*/ +public String getAeropuertopuerto(){ + return aeropuertopuerto; +} +/**Fija el valor de aeropuertopuerto +@param pAeropuertopuerto nuevo Valor de aeropuertopuerto*/ +public void setAeropuertopuerto(String pAeropuertopuerto){ + aeropuertopuerto=pAeropuertopuerto; +} + +/**Obtiene el valor de solicitudnum +@return valor de solicitudnum*/ +public String getSolicitudnum(){ + return solicitudnum; +} +/**Fija el valor de solicitudnum +@param pSolicitudnum nuevo Valor de solicitudnum*/ +public void setSolicitudnum(String pSolicitudnum){ + solicitudnum=pSolicitudnum; +} + +/**Obtiene el valor de fechasolicitud +@return valor de fechasolicitud*/ +public Date getFechasolicitud(){ + return fechasolicitud; +} +/**Fija el valor de fechasolicitud +@param pFechasolicitud nuevo Valor de fechasolicitud*/ +public void setFechasolicitud(Date pFechasolicitud){ + fechasolicitud=pFechasolicitud; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmRegistroArmas))return false; + TarmRegistroArmas that = (TarmRegistroArmas) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmRegistroArmas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmRegistroArmas +*/ +public Object createInstance(){ + TarmRegistroArmas instance=new TarmRegistroArmas(); + return instance; +} +/**Clona la entidad TarmRegistroArmas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmRegistroArmas p=(TarmRegistroArmas)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmSolicitudImportacion.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmSolicitudImportacion.java new file mode 100644 index 0000000..15fabde --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmSolicitudImportacion.java @@ -0,0 +1,241 @@ +package com.fp.persistence.parmas.fun; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMSOLICITUDIMPORTACION*/ +@Entity(name="TarmSolicitudImportacion") +@Table(name="TARMSOLICITUDIMPORTACION") +public class TarmSolicitudImportacion extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmSolicitudImportacion +*/ +@EmbeddedId +private TarmSolicitudImportacionKey pk; +@Column(name="CPAISORIGEN", nullable=true) + +/** +* Codigo de pais +*/ +private String cpaisorigen; + +@Column(name="FCREACION", nullable=true) + +/** +* null +*/ +private Date fcreacion; + +@Column(name="FABRICANTE", nullable=true) + +/** +* null +*/ +private String fabricante; + +@Column(name="DUI", nullable=true) + +/** +* null +*/ +private String dui; + +@Column(name="TOTAL_FOB", nullable=true) + +/** +* null +*/ +private BigDecimal total_fob; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* null +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TarmSolicitudImportacion(){ +} +/**Contructor de TarmSolicitudImportacion +@param pPk Clave Primaria del entity +*/ +public TarmSolicitudImportacion(TarmSolicitudImportacionKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmSolicitudImportacion +*/ +public static TarmSolicitudImportacion find(EntityManager pEntityManager,TarmSolicitudImportacionKey pKey) throws Exception{ + TarmSolicitudImportacion obj = pEntityManager.find(TarmSolicitudImportacion.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmSolicitudImportacion +@return El objeto que referencia a la Clave primaria de TarmSolicitudImportacion +*/ +public TarmSolicitudImportacionKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmSolicitudImportacion +@param pPk El objeto que referencia a la nueva Clave primaria de TarmSolicitudImportacion +*/ +public void setPk(TarmSolicitudImportacionKey pPk){ + pk=pPk; +} +/**Obtiene el valor de cpaisorigen +@return valor de cpaisorigen*/ +public String getCpaisorigen(){ + return cpaisorigen; +} +/**Fija el valor de cpaisorigen +@param pCpaisorigen nuevo Valor de cpaisorigen*/ +public void setCpaisorigen(String pCpaisorigen){ + cpaisorigen=pCpaisorigen; +} + +/**Obtiene el valor de fcreacion +@return valor de fcreacion*/ +public Date getFcreacion(){ + return fcreacion; +} +/**Fija el valor de fcreacion +@param pFcreacion nuevo Valor de fcreacion*/ +public void setFcreacion(Date pFcreacion){ + fcreacion=pFcreacion; +} + +/**Obtiene el valor de fabricante +@return valor de fabricante*/ +public String getFabricante(){ + return fabricante; +} +/**Fija el valor de fabricante +@param pFabricante nuevo Valor de fabricante*/ +public void setFabricante(String pFabricante){ + fabricante=pFabricante; +} + +/**Obtiene el valor de dui +@return valor de dui*/ +public String getDui(){ + return dui; +} +/**Fija el valor de dui +@param pDui nuevo Valor de dui*/ +public void setDui(String pDui){ + dui=pDui; +} + +/**Obtiene el valor de total_fob +@return valor de total_fob*/ +public BigDecimal getTotal_fob(){ + return total_fob; +} +/**Fija el valor de total_fob +@param pTotal_fob nuevo Valor de total_fob*/ +public void setTotal_fob(BigDecimal pTotal_fob){ + total_fob=pTotal_fob; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmSolicitudImportacion))return false; + TarmSolicitudImportacion that = (TarmSolicitudImportacion) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmSolicitudImportacion +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmSolicitudImportacion +*/ +public Object createInstance(){ + TarmSolicitudImportacion instance=new TarmSolicitudImportacion(); + instance.setPk(new TarmSolicitudImportacionKey()); + return instance; +} +/**Clona la entidad TarmSolicitudImportacion +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmSolicitudImportacion p=(TarmSolicitudImportacion)this.clone(); + p.setPk((TarmSolicitudImportacionKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmSolicitudImportacionKey.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmSolicitudImportacionKey.java new file mode 100644 index 0000000..1587c71 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmSolicitudImportacionKey.java @@ -0,0 +1,131 @@ +package com.fp.persistence.parmas.fun; + +import javax.persistence.Column; + +import java.io.Serializable; + +import com.fp.dto.hb.HibernateId; + +import java.lang.reflect.Field; + +import javax.persistence.Embeddable; +import javax.persistence.GeneratedValue; +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que hace referencia a la Clave Primaria de TARMSOLICITUDIMPORTACION*/ +@Embeddable +public class TarmSolicitudImportacionKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CIMPORTACION", nullable=false,updatable=false) +/** +* null +*/ +private Long cimportacion; + +@Column(name="CSOLICITUD", nullable=false,updatable=false) + +/** +* Codigo de solicitud de controld e armas +*/ +private String csolicitud; + +/**Contructor por defecto*/ +public TarmSolicitudImportacionKey(){} +/**Contructor de TarmSolicitudImportacionKey +@param pCimportacion null +@param pCsolicitud Codigo de solicitud de controld e armas +*/ +public TarmSolicitudImportacionKey(Long pCimportacion,String pCsolicitud){ + cimportacion=pCimportacion; + csolicitud=pCsolicitud; +} +/**Obtiene el valor de cimportacion +@return valor de cimportacion*/ +public Long getCimportacion(){ + return cimportacion; +} +/**Fija el valor de cimportacion +@param pCimportacion nuevo Valor de cimportacion*/ +public void setCimportacion(Long pCimportacion){ + cimportacion=pCimportacion; +} + +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Implementacion de la comparacion de TarmSolicitudImportacionKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmSolicitudImportacionKey))return false; + TarmSolicitudImportacionKey that = (TarmSolicitudImportacionKey) o; + if (this.getCimportacion() == null || that.getCimportacion() == null){ + return false; + } + if (! this.getCimportacion().equals(that.getCimportacion())){ + return false; + } + if (this.getCsolicitud() == null || that.getCsolicitud() == null){ + return false; + } + if (! this.getCsolicitud().equals(that.getCsolicitud())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmSolicitudImportacionKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCimportacion() == null ? 0 : this.getCimportacion().hashCode()); + result = result * 37 + (this.getCsolicitud() == null ? 0 : this.getCsolicitud().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmTotalPersona.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmTotalPersona.java new file mode 100644 index 0000000..509ae99 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmTotalPersona.java @@ -0,0 +1,483 @@ +package com.fp.persistence.parmas.fun; + +import javax.persistence.Entity; + +import java.sql.Timestamp; + +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import javax.persistence.GeneratedValue; +import javax.persistence.Query; + +import java.util.List; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMTOTALPERSONA*/ +@Entity(name="TarmTotalPersona") +@Table(name="TARMTOTALPERSONA") +public class TarmTotalPersona extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmTotalPersona +*/ +@Id +@Column(name="CTOTAL" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "TARMTOTALPERSONA"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.String"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "6")}) + @GeneratedValue(generator = "seq_id") +private String pk; +@Column(name="CANTIDADMOVIMIENTO", nullable=true) + +/** +* Almacena el valor de armas o explosivos ingresados o egresados que modifico el saldo anterior +*/ +private BigDecimal cantidadmovimiento; + +@Column(name="UNIDADMEDIDAPESOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de medida +*/ +private String unidadmedidapesocodigo; + +@Column(name="INGRESOEGRESO", nullable=true) + +/** +* Codigo de catalogo para indicar si es un ingreso o un egreso +*/ +private String ingresoegreso; + +@Column(name="INGRESOEGRESOCODIGO", nullable=true) + +/** +* Codigo de catalogcode ESINGRESOEGRESO +*/ +private String ingresoegresocodigo; + +@Column(name="TIPOARMAEXPLOSIVO", nullable=true) + +/** +* Codigo de catalogo 01 Revolver, 02 Polvora +*/ +private String tipoarmaexplosivo; + +@Column(name="TIPOARMAEXPLOSIVOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de de arma o explosivo +*/ +private String tipoarmaexplosivocodigo; + +@Column(name="PERSONCODIGO", nullable=true) + +/** +* Codigo de persona +*/ +private Integer personcodigo; + +@Column(name="FECHA", nullable=true) + +/** +* Fecha de registro +*/ +private Timestamp fecha; + +@Column(name="UNIDADMEDIDAPESO", nullable=true) + +/** +* Codigo de catalogo 01KG, 02 Unidad +*/ +private String unidadmedidapeso; + +@Column(name="SALDOANTERIOR", nullable=true) + +/** +* Valor numerico de la transaccion anterior +*/ +private BigDecimal saldoanterior; + +@Column(name="TOTAL", nullable=false) + +/** +* Suma total de arma explosivos segn tipoexplosivoarma,clase, persona +*/ +private BigDecimal total; + +@Column(name="CMOVIMIENTO", nullable=true) + +/** +* null +*/ +private String cmovimiento; + +@Column(name="CLASECODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo. Codigo de tabla de tipos de Clase de arma +*/ +private String clasecodigo; + +@Column(name="CARMA", nullable=true) + +/** +* Codigo de arma +*/ +private String carma; + +@Column(name="CLASE", nullable=true) + +/** +* Codigo de catalogo 01 Explosivo, 02 Arma de fuego +*/ +private String clase; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Versin del Registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TarmTotalPersona(){ +} +/**Contructor de TarmTotalPersona +@param pPk Clave Primaria del entity +@param pTotal Suma total de arma explosivos segn tipoexplosivoarma,clase, persona +*/ +public TarmTotalPersona(String pPk,BigDecimal pTotal){ + this(); + pk=pPk; + total=pTotal; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmTotalPersona +*/ +public static TarmTotalPersona find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmTotalPersona obj = pEntityManager.find(TarmTotalPersona.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmTotalPersona +@return El objeto que referencia a la Clave primaria de TarmTotalPersona +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmTotalPersona +@param pPk El objeto que referencia a la nueva Clave primaria de TarmTotalPersona +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de cantidadmovimiento +@return valor de cantidadmovimiento*/ +public BigDecimal getCantidadmovimiento(){ + return cantidadmovimiento; +} +/**Fija el valor de cantidadmovimiento +@param pCantidadmovimiento nuevo Valor de cantidadmovimiento*/ +public void setCantidadmovimiento(BigDecimal pCantidadmovimiento){ + cantidadmovimiento=pCantidadmovimiento; +} + +/**Obtiene el valor de unidadmedidapesocodigo +@return valor de unidadmedidapesocodigo*/ +public String getUnidadmedidapesocodigo(){ + return unidadmedidapesocodigo; +} +/**Fija el valor de unidadmedidapesocodigo +@param pUnidadmedidapesocodigo nuevo Valor de unidadmedidapesocodigo*/ +public void setUnidadmedidapesocodigo(String pUnidadmedidapesocodigo){ + unidadmedidapesocodigo=pUnidadmedidapesocodigo; +} + +/**Obtiene el valor de ingresoegreso +@return valor de ingresoegreso*/ +public String getIngresoegreso(){ + return ingresoegreso; +} +/**Fija el valor de ingresoegreso +@param pIngresoegreso nuevo Valor de ingresoegreso*/ +public void setIngresoegreso(String pIngresoegreso){ + ingresoegreso=pIngresoegreso; +} + +/**Obtiene el valor de ingresoegresocodigo +@return valor de ingresoegresocodigo*/ +public String getIngresoegresocodigo(){ + return ingresoegresocodigo; +} +/**Fija el valor de ingresoegresocodigo +@param pIngresoegresocodigo nuevo Valor de ingresoegresocodigo*/ +public void setIngresoegresocodigo(String pIngresoegresocodigo){ + ingresoegresocodigo=pIngresoegresocodigo; +} + +/**Obtiene el valor de tipoarmaexplosivo +@return valor de tipoarmaexplosivo*/ +public String getTipoarmaexplosivo(){ + return tipoarmaexplosivo; +} +/**Fija el valor de tipoarmaexplosivo +@param pTipoarmaexplosivo nuevo Valor de tipoarmaexplosivo*/ +public void setTipoarmaexplosivo(String pTipoarmaexplosivo){ + tipoarmaexplosivo=pTipoarmaexplosivo; +} + +/**Obtiene el valor de tipoarmaexplosivocodigo +@return valor de tipoarmaexplosivocodigo*/ +public String getTipoarmaexplosivocodigo(){ + return tipoarmaexplosivocodigo; +} +/**Fija el valor de tipoarmaexplosivocodigo +@param pTipoarmaexplosivocodigo nuevo Valor de tipoarmaexplosivocodigo*/ +public void setTipoarmaexplosivocodigo(String pTipoarmaexplosivocodigo){ + tipoarmaexplosivocodigo=pTipoarmaexplosivocodigo; +} + +/**Obtiene el valor de personcodigo +@return valor de personcodigo*/ +public Integer getPersoncodigo(){ + return personcodigo; +} +/**Fija el valor de personcodigo +@param pPersoncodigo nuevo Valor de personcodigo*/ +public void setPersoncodigo(Integer pPersoncodigo){ + personcodigo=pPersoncodigo; +} + +/**Obtiene el valor de fecha +@return valor de fecha*/ +public Timestamp getFecha(){ + return fecha; +} +/**Fija el valor de fecha +@param pFecha nuevo Valor de fecha*/ +public void setFecha(Timestamp pFecha){ + fecha=pFecha; +} + +/**Obtiene el valor de unidadmedidapeso +@return valor de unidadmedidapeso*/ +public String getUnidadmedidapeso(){ + return unidadmedidapeso; +} +/**Fija el valor de unidadmedidapeso +@param pUnidadmedidapeso nuevo Valor de unidadmedidapeso*/ +public void setUnidadmedidapeso(String pUnidadmedidapeso){ + unidadmedidapeso=pUnidadmedidapeso; +} + +/**Obtiene el valor de saldoanterior +@return valor de saldoanterior*/ +public BigDecimal getSaldoanterior(){ + return saldoanterior; +} +/**Fija el valor de saldoanterior +@param pSaldoanterior nuevo Valor de saldoanterior*/ +public void setSaldoanterior(BigDecimal pSaldoanterior){ + saldoanterior=pSaldoanterior; +} + +/**Obtiene el valor de total +@return valor de total*/ +public BigDecimal getTotal(){ + return total; +} +/**Fija el valor de total +@param pTotal nuevo Valor de total*/ +public void setTotal(BigDecimal pTotal){ + total=pTotal; +} + +/**Obtiene el valor de cmovimiento +@return valor de cmovimiento*/ +public String getCmovimiento(){ + return cmovimiento; +} +/**Fija el valor de cmovimiento +@param pCmovimiento nuevo Valor de cmovimiento*/ +public void setCmovimiento(String pCmovimiento){ + cmovimiento=pCmovimiento; +} + +/**Obtiene el valor de clasecodigo +@return valor de clasecodigo*/ +public String getClasecodigo(){ + return clasecodigo; +} +/**Fija el valor de clasecodigo +@param pClasecodigo nuevo Valor de clasecodigo*/ +public void setClasecodigo(String pClasecodigo){ + clasecodigo=pClasecodigo; +} + +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de clase +@return valor de clase*/ +public String getClase(){ + return clase; +} +/**Fija el valor de clase +@param pClase nuevo Valor de clase*/ +public void setClase(String pClase){ + clase=pClase; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmTotalPersona))return false; + TarmTotalPersona that = (TarmTotalPersona) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmTotalPersona +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmTotalPersona +*/ +public Object createInstance(){ + TarmTotalPersona instance=new TarmTotalPersona(); + return instance; +} +/**Clona la entidad TarmTotalPersona +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmTotalPersona p=(TarmTotalPersona)this.clone(); + return p; +} + +/** + * Sentencia que devuelve un registro vigente de TarmTotalPerson + */ +private static final String JPQL_PERSONA = "from TarmTotalPersona ttp" + " where ttp.personcodigo = :personcode"; + +/** + * Metodo que entrega datos de un total en TarmTotalPerson. + * + * @param pEntityManager Session de la base de datos. + * @param personcode Codigo de la persona a quien pertenece la Direccion. + * @param addressnumber Numero de la direccion. + * @return tcustPersonAddress + * @throws Exception + */ +public static List findByPersona(EntityManager pEntityManager, Integer personcode) throws Exception { + Query qry = pEntityManager.createQuery(TarmTotalPersona.JPQL_PERSONA); + qry.setParameter("personcode", personcode); + return qry.getResultList(); +} + + +/** + * Sentencia que devuelve un registro vigente de TcustPersonAddress + */ +private static final String JPQL_TIPOCLASEPER = "from TarmTotalPersona ttp" + " where ttp.personcodigo = :personcode and ttp.clase = :clase and ttp.tipoarmaexplosivo = :tipoarmaexplosivo" + + " and ttp.fecha = (select max(ttpi.fecha) from TarmTotalPersona ttpi where ttpi.personcodigo = :personcode and ttpi.clase = :clase and ttpi.tipoarmaexplosivo = :tipoarmaexplosivo)"; + +/** + * Metodo que entrega datos de una Direccion definida en TcustPersonAddress. + * + * @param pEntityManager Session de la base de datos. + * @param personcode Codigo de la persona a quien pertenece la Direccion. + * @param addressnumber Numero de la direccion. + * @return tcustPersonAddress + * @throws Exception + */ +public static List findByClase(EntityManager pEntityManager, Integer personcode, String clase, String tipoarmaexplosivo) throws Exception { + Query qry = pEntityManager.createQuery(TarmTotalPersona.JPQL_TIPOCLASEPER); + qry.setParameter("personcode", personcode); + qry.setParameter("clase", clase); + qry.setParameter("tipoarmaexplosivo", tipoarmaexplosivo); + return qry.getResultList(); +} + + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmVentaArmaTem.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmVentaArmaTem.java new file mode 100644 index 0000000..9218c66 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/fun/TarmVentaArmaTem.java @@ -0,0 +1,257 @@ +package com.fp.persistence.parmas.fun; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMVENTAARMATEM*/ +@Entity(name="TarmVentaArmaTem") +@Table(name="TARMVENTAARMATEM") +public class TarmVentaArmaTem extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmVentaArmaTem +*/ +@Id +@Column(name="CARMAVENTATEM" ,nullable=false, updatable=false) +private Integer pk; +@Column(name="CARMA", nullable=true) + +/** +* null +*/ +private String carma; + +@Column(name="FCREACION", nullable=true) + +/** +* null +*/ +private Date fcreacion; + +@Column(name="ESTADO", nullable=true) + +/** +* null +*/ +private String estado; + +@Column(name="PERSONCODIGO", nullable=true) + +/** +* null +*/ +private Integer personcodigo; + +@Column(name="FACTURA", nullable=true) +private String factura; + +@Column(name="NOREGISTRO", nullable=true) +private String noregistra; + + + +@Column(name="JUSTIFICACION", nullable=true) +private String justificacion; + +@Column(name="OBSERVACION", nullable=true) +private String observacion; + +@Column(name="PATHDOCUMENTO", nullable=true) +private String pathdocumento; + +@Column(name="CENTROCONTROL", nullable=true) +private String centrocontrol; + +/**Contructor por defecto*/ +public TarmVentaArmaTem(){ +} +/**Contructor de TarmVentaArmaTem +@param pPk Clave Primaria del entity +*/ +public TarmVentaArmaTem(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmVentaArmaTem +*/ +public static TarmVentaArmaTem find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmVentaArmaTem obj = pEntityManager.find(TarmVentaArmaTem.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmVentaArmaTem +@return El objeto que referencia a la Clave primaria de TarmVentaArmaTem +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmVentaArmaTem +@param pPk El objeto que referencia a la nueva Clave primaria de TarmVentaArmaTem +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de fcreacion +@return valor de fcreacion*/ +public Date getFcreacion(){ + return fcreacion; +} +/**Fija el valor de fcreacion +@param pFcreacion nuevo Valor de fcreacion*/ +public void setFcreacion(Date pFcreacion){ + fcreacion=pFcreacion; +} + +/**Obtiene el valor de estado +@return valor de estado*/ +public String getEstado(){ + return estado; +} +/**Fija el valor de estado +@param pEstado nuevo Valor de estado*/ +public void setEstado(String pEstado){ + estado=pEstado; +} + +/**Obtiene el valor de personcodigo +@return valor de personcodigo*/ +public Integer getPersoncodigo(){ + return personcodigo; +} +/**Fija el valor de personcodigo +@param pPersoncodigo nuevo Valor de personcodigo*/ +public void setPersoncodigo(Integer pPersoncodigo){ + personcodigo=pPersoncodigo; +} + + + +public String getFactura() { + return factura; +} +public void setFactura(String factura) { + this.factura = factura; +} +public String getNoregistra() { + return noregistra; +} +public void setNoregistra(String noregistra) { + this.noregistra = noregistra; +} + +public String getJustificacion() { + return justificacion; +} +public void setJustificacion(String justificacion) { + this.justificacion = justificacion; +} +public String getObservacion() { + return observacion; +} +public void setObservacion(String observacion) { + this.observacion = observacion; +} + +public String getPathdocumento() { + return pathdocumento; +} +public void setPathdocumento(String pathdocumento) { + this.pathdocumento = pathdocumento; +} + +public String getCentrocontrol() { + return centrocontrol; +} +public void setCentrocontrol(String centrocontrol) { + this.centrocontrol = centrocontrol; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmVentaArmaTem))return false; + TarmVentaArmaTem that = (TarmVentaArmaTem) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmVentaArmaTem +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmVentaArmaTem +*/ +public Object createInstance(){ + TarmVentaArmaTem instance=new TarmVentaArmaTem(); + return instance; +} +/**Clona la entidad TarmVentaArmaTem +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmVentaArmaTem p=(TarmVentaArmaTem)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/ins/.svn/entries b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/ins/.svn/entries new file mode 100644 index 0000000..c726fc0 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/ins/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/ins +svn://172.17.26.185/COMACO + + + +2016-01-15T17:41:51.430820Z +4381 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TarmPlanificacionTramite.java +file + + + + +2022-07-28T03:40:28.295741Z +cddb2493165b007561ecb0a70408067e +2016-01-15T17:41:51.430820Z +4381 +fpazmino + + + + + + + + + + + + + + + + + + + + + +7808 + +TarmPlanificacionInspeccion.java +file + + + + +2022-07-28T03:40:28.296741Z +e3a680a5aba10caab1f93e97bd132b81 +2016-01-15T17:41:51.430820Z +4381 +fpazmino + + + + + + + + + + + + + + + + + + + + + +8658 + diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/ins/.svn/text-base/TarmPlanificacionInspeccion.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/ins/.svn/text-base/TarmPlanificacionInspeccion.java.svn-base new file mode 100644 index 0000000..bfb34ae --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/ins/.svn/text-base/TarmPlanificacionInspeccion.java.svn-base @@ -0,0 +1,354 @@ +package com.fp.persistence.parmas.ins; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMPLANIFICACIONINSPECCION*/ +@Entity(name="TarmPlanificacionInspeccion") +@Table(name="TARMPLANIFICACIONINSPECCION") +public class TarmPlanificacionInspeccion extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmPlanificacionInspeccion +*/ +@Id +@Column(name="CPLANIFICACION" ,nullable=false, updatable=false) +private Long pk; +@Column(name="CODIGO", nullable=true) + +/** +* null +*/ +private String codigo; + +@Column(name="DESCRIPCION", nullable=true) + +/** +* null +*/ +private String descripcion; + +@Column(name="FECHAGENERACION", nullable=true) + +/** +* null +*/ +private Date fechageneracion; + +@Column(name="FECHAINICIO", nullable=true) + +/** +* null +*/ +private Date fechainicio; + +@Column(name="FECHAFIN", nullable=true) + +/** +* null +*/ +private Date fechafin; + +@Column(name="CCENTROCONTROL", nullable=true) + +/** +* null +*/ +private String ccentrocontrol; + +@Column(name="ANNO", nullable=true) + +/** +* null +*/ +private Long anno; + +@Column(name="APROBADA", nullable=true) + +/** +* null +*/ +private String aprobada; + +@Column(name="XPATH", nullable=true) + +/** +* null +*/ +private String xpath; + +@Column(name="TIPOPLANIFICACIONCODE", nullable=true) + +/** +* null +*/ +private String idPlanificacion; + +@Column(name="TIPOPLANIFICACION", nullable=true) + +/** +* null +*/ +private String Planificacion; + + +@Column(name="PRESUPESTO", nullable=true) + +/** +* null +*/ +private Float presupuesto; + + + +/**Contructor por defecto*/ +public TarmPlanificacionInspeccion(){ +} +/**Contructor de TarmPlanificacionInspeccion +@param pPk Clave Primaria del entity +*/ +public TarmPlanificacionInspeccion(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmPlanificacionInspeccion +*/ +public static TarmPlanificacionInspeccion find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmPlanificacionInspeccion obj = pEntityManager.find(TarmPlanificacionInspeccion.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmPlanificacionInspeccion +@return El objeto que referencia a la Clave primaria de TarmPlanificacionInspeccion +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmPlanificacionInspeccion +@param pPk El objeto que referencia a la nueva Clave primaria de TarmPlanificacionInspeccion +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de codigo +@return valor de codigo*/ +public String getCodigo(){ + return codigo; +} +/**Fija el valor de codigo +@param pCodigo nuevo Valor de codigo*/ +public void setCodigo(String pCodigo){ + codigo=pCodigo; +} + +/**Obtiene el valor de descripcion +@return valor de descripcion*/ +public String getDescripcion(){ + return descripcion; +} +/**Fija el valor de descripcion +@param pDescripcion nuevo Valor de descripcion*/ +public void setDescripcion(String pDescripcion){ + descripcion=pDescripcion; +} + +/**Obtiene el valor de fechageneracion +@return valor de fechageneracion*/ +public Date getFechageneracion(){ + return fechageneracion; +} +/**Fija el valor de fechageneracion +@param pFechageneracion nuevo Valor de fechageneracion*/ +public void setFechageneracion(Date pFechageneracion){ + fechageneracion=pFechageneracion; +} + +/**Obtiene el valor de fechainicio +@return valor de fechainicio*/ +public Date getFechainicio(){ + return fechainicio; +} +/**Fija el valor de fechainicio +@param pFechainicio nuevo Valor de fechainicio*/ +public void setFechainicio(Date pFechainicio){ + fechainicio=pFechainicio; +} + +/**Obtiene el valor de fechafin +@return valor de fechafin*/ +public Date getFechafin(){ + return fechafin; +} +/**Fija el valor de fechafin +@param pFechafin nuevo Valor de fechafin*/ +public void setFechafin(Date pFechafin){ + fechafin=pFechafin; +} + +/**Obtiene el valor de ccentrocontrol +@return valor de ccentrocontrol*/ +public String getCcentrocontrol(){ + return ccentrocontrol; +} +/**Fija el valor de ccentrocontrol +@param pCcentrocontrol nuevo Valor de ccentrocontrol*/ +public void setCcentrocontrol(String pCcentrocontrol){ + ccentrocontrol=pCcentrocontrol; +} + +/**Obtiene el valor de anno +@return valor de ccentrocontrol*/ +public Long getAnno() { + return anno; +} +/**Fija el valor de anno +@param pCcentrocontrol nuevo Valor de ccentrocontrol*/ +public void setAnno(Long anno) { + this.anno = anno; +} + +/**Obtiene el valor de aprobada +@return valor de aprobada*/ +public String getAprobada() { + return aprobada; +} +/**Fija el valor de aprobada +@param pCcentrocontrol nuevo Valor de aprobada*/ +public void setAprobada(String aprobada) { + this.aprobada = aprobada; +} + +/**Obtiene el valor de xpath +@return valor de xpath*/ +public String getXpath() { + return xpath; +} +/**Fija el valor de xpath +@param pCcentrocontrol nuevo Valor de xpath*/ +public void setXpath(String xpath) { + this.xpath = xpath; +} + +/**Obtiene el valor de planificacion +@return valor de planificacion*/ +public String getIdPlanificacion() { + return idPlanificacion; +} +/**Fija el valor de planificacion +@param pidPlanificacion nuevo Valor de tipoplanificacionList*/ +public void setIdPlanificacion(String pidPlanificacion) { + this.idPlanificacion = pidPlanificacion; +} + +/**Obtiene el valor de planificacion +@return valor de planificacion*/ +public String getPlanificacion() { + return Planificacion; +} +/**Fija el valor de planificacion +@param pidPlanificacion nuevo Valor de tipoplanificacionList*/ +public void setPlanificacion(String pPlanificacion) { + this.Planificacion = pPlanificacion; +} + +/**Obtiene el valor de presupuesto +@return valor de presupuesto*/ +public Float getPresupuesto() { + return presupuesto; +} +/**Fija el valor de presupuesto +@param pidPlanificacion nuevo Valor de presupuesto*/ +public void setPresupuesto(Float ppresupuesto) { + this.presupuesto = ppresupuesto; +} + + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmPlanificacionInspeccion))return false; + TarmPlanificacionInspeccion that = (TarmPlanificacionInspeccion) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmPlanificacionInspeccion +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmPlanificacionInspeccion +*/ +public Object createInstance(){ + TarmPlanificacionInspeccion instance=new TarmPlanificacionInspeccion(); + return instance; +} +/**Clona la entidad TarmPlanificacionInspeccion +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmPlanificacionInspeccion p=(TarmPlanificacionInspeccion)this.clone(); + return p; +} + + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/ins/.svn/text-base/TarmPlanificacionTramite.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/ins/.svn/text-base/TarmPlanificacionTramite.java.svn-base new file mode 100644 index 0000000..e167597 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/ins/.svn/text-base/TarmPlanificacionTramite.java.svn-base @@ -0,0 +1,325 @@ +package com.fp.persistence.parmas.ins; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMPLANIFICACIONTRAMITE*/ +@Entity(name="TarmPlanificacionTramite") +@Table(name="TARMPLANIFICACIONTRAMITE") +public class TarmPlanificacionTramite extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmPlanificacionTramite +*/ +@Id +@Column(name="CPLANIFICACIONTRAMITE" ,nullable=false, updatable=false) +private Long pk; +@Column(name="CTRAMITE", nullable=true) + +/** +* null +*/ +private Long ctramite; + +@Column(name="MESNUMERO", nullable=true) + +/** +* null +*/ +private Long mesnumero; + +@Column(name="CPLANIFICACION", nullable=true) + +/** +* null +*/ +private Long cplanificacion; + +@Column(name="INSPECCION", nullable=true) + +/** +* null +*/ +private String inspeccion; + +@Column(name="CSOLICITUD", nullable=true) + +/** +* null +*/ +private String csolicitud; + +@Column(name="CDOCUMENTO", nullable=true) + +/** +* null +*/ +private Long cdocumento; + +@Column(name="MES", nullable=true) + +/** +* null +*/ +private String mes; + +@Column(name="PERIODO", nullable=true) + +/** +* null +*/ +private String periodo; + +@Column(name="INSPECTORES", nullable=true) + +/** +* null +*/ +private Long inspectores; + +@Column(name="VEHICULOS", nullable=true) + +/** +* null +*/ +private Long vehiculos; + +@Column(name="PRESUPESTO", nullable=true) + +/** +* null +*/ +private Float presupuesto; + +/**Contructor por defecto*/ +public TarmPlanificacionTramite(){ +} +/**Contructor de TarmPlanificacionTramite +@param pPk Clave Primaria del entity +*/ +public TarmPlanificacionTramite(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmPlanificacionTramite +*/ +public static TarmPlanificacionTramite find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmPlanificacionTramite obj = pEntityManager.find(TarmPlanificacionTramite.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmPlanificacionTramite +@return El objeto que referencia a la Clave primaria de TarmPlanificacionTramite +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmPlanificacionTramite +@param pPk El objeto que referencia a la nueva Clave primaria de TarmPlanificacionTramite +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de ctramite +@return valor de ctramite*/ +public Long getCtramite(){ + return ctramite; +} +/**Fija el valor de ctramite +@param pCtramite nuevo Valor de ctramite*/ +public void setCtramite(Long pCtramite){ + ctramite=pCtramite; +} + +/**Obtiene el valor de mesnumero +@return valor de mesnumero*/ +public Long getMesnumero(){ + return mesnumero; +} +/**Fija el valor de mesnumero +@param pMesnumero nuevo Valor de mesnumero*/ +public void setMesnumero(Long pMesnumero){ + mesnumero=pMesnumero; +} + +/**Obtiene el valor de cplanificacion +@return valor de cplanificacion*/ +public Long getCplanificacion(){ + return cplanificacion; +} +/**Fija el valor de cplanificacion +@param pCplanificacion nuevo Valor de cplanificacion*/ +public void setCplanificacion(Long pCplanificacion){ + cplanificacion=pCplanificacion; +} + +/**Obtiene el valor de inspeccion +@return valor de inspeccion*/ +public String getInspeccion(){ + return inspeccion; +} +/**Fija el valor de inspeccion +@param pInspeccion nuevo Valor de inspeccion*/ +public void setInspeccion(String pInspeccion){ + inspeccion=pInspeccion; +} + +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Obtiene el valor de cdocumento +@return valor de cdocumento*/ +public Long getCdocumento(){ + return cdocumento; +} +/**Fija el valor de cdocumento +@param pCdocumento nuevo Valor de cdocumento*/ +public void setCdocumento(Long pCdocumento){ + cdocumento=pCdocumento; +} + +/**Obtiene el valor de mes +@return valor de mes*/ +public String getMes(){ + return mes; +} +/**Fija el valor de mes +@param pMes nuevo Valor de mes*/ +public void setMes(String pMes){ + mes=pMes; +} + +/**Fija el valor de mes +@param pMes nuevo Valor de periodo*/ +public void setPeriodo(String pPeridodo){ + periodo=pPeridodo; +} + +/**Obtiene el valor de periodo +@return valor de mes*/ +public String getPeriodo(){ + return periodo; +} + +/**Obtiene el valor de inspectores +@return valor de inspectores*/ +public Long getInspectores(){ + return inspectores; +} +/**Fija el valor de cdocumento +@param pCdocumento nuevo Valor de cdocumento*/ +public void setInspectores(Long pinspectores){ + inspectores=pinspectores; +} + +/**Obtiene el valor de vehiculos +@return valor de vehiculos*/ +public Long getVehiculos(){ + return vehiculos; +} +/**Fija el valor de cdocumento +@param pCdocumento nuevo Valor de cdocumento*/ +public void setVehiculos(Long pvehiculos){ + vehiculos=pvehiculos; +} + +/**Obtiene el valor de presupuesto I +@return valor de presupuesto I*/ +public Float getPresupuesto() { + return presupuesto; +} +/**Fija el valor de presupuesto I +@param pidPlanificacion nuevo Valor de presupuesto I*/ +public void setPresupuesto(Float ppresupuesto) { + this.presupuesto = ppresupuesto; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmPlanificacionTramite))return false; + TarmPlanificacionTramite that = (TarmPlanificacionTramite) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmPlanificacionTramite +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmPlanificacionTramite +*/ +public Object createInstance(){ + TarmPlanificacionTramite instance=new TarmPlanificacionTramite(); + return instance; +} +/**Clona la entidad TarmPlanificacionTramite +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmPlanificacionTramite p=(TarmPlanificacionTramite)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/ins/TarmPlanificacionInspeccion.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/ins/TarmPlanificacionInspeccion.java new file mode 100644 index 0000000..bfb34ae --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/ins/TarmPlanificacionInspeccion.java @@ -0,0 +1,354 @@ +package com.fp.persistence.parmas.ins; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMPLANIFICACIONINSPECCION*/ +@Entity(name="TarmPlanificacionInspeccion") +@Table(name="TARMPLANIFICACIONINSPECCION") +public class TarmPlanificacionInspeccion extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmPlanificacionInspeccion +*/ +@Id +@Column(name="CPLANIFICACION" ,nullable=false, updatable=false) +private Long pk; +@Column(name="CODIGO", nullable=true) + +/** +* null +*/ +private String codigo; + +@Column(name="DESCRIPCION", nullable=true) + +/** +* null +*/ +private String descripcion; + +@Column(name="FECHAGENERACION", nullable=true) + +/** +* null +*/ +private Date fechageneracion; + +@Column(name="FECHAINICIO", nullable=true) + +/** +* null +*/ +private Date fechainicio; + +@Column(name="FECHAFIN", nullable=true) + +/** +* null +*/ +private Date fechafin; + +@Column(name="CCENTROCONTROL", nullable=true) + +/** +* null +*/ +private String ccentrocontrol; + +@Column(name="ANNO", nullable=true) + +/** +* null +*/ +private Long anno; + +@Column(name="APROBADA", nullable=true) + +/** +* null +*/ +private String aprobada; + +@Column(name="XPATH", nullable=true) + +/** +* null +*/ +private String xpath; + +@Column(name="TIPOPLANIFICACIONCODE", nullable=true) + +/** +* null +*/ +private String idPlanificacion; + +@Column(name="TIPOPLANIFICACION", nullable=true) + +/** +* null +*/ +private String Planificacion; + + +@Column(name="PRESUPESTO", nullable=true) + +/** +* null +*/ +private Float presupuesto; + + + +/**Contructor por defecto*/ +public TarmPlanificacionInspeccion(){ +} +/**Contructor de TarmPlanificacionInspeccion +@param pPk Clave Primaria del entity +*/ +public TarmPlanificacionInspeccion(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmPlanificacionInspeccion +*/ +public static TarmPlanificacionInspeccion find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmPlanificacionInspeccion obj = pEntityManager.find(TarmPlanificacionInspeccion.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmPlanificacionInspeccion +@return El objeto que referencia a la Clave primaria de TarmPlanificacionInspeccion +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmPlanificacionInspeccion +@param pPk El objeto que referencia a la nueva Clave primaria de TarmPlanificacionInspeccion +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de codigo +@return valor de codigo*/ +public String getCodigo(){ + return codigo; +} +/**Fija el valor de codigo +@param pCodigo nuevo Valor de codigo*/ +public void setCodigo(String pCodigo){ + codigo=pCodigo; +} + +/**Obtiene el valor de descripcion +@return valor de descripcion*/ +public String getDescripcion(){ + return descripcion; +} +/**Fija el valor de descripcion +@param pDescripcion nuevo Valor de descripcion*/ +public void setDescripcion(String pDescripcion){ + descripcion=pDescripcion; +} + +/**Obtiene el valor de fechageneracion +@return valor de fechageneracion*/ +public Date getFechageneracion(){ + return fechageneracion; +} +/**Fija el valor de fechageneracion +@param pFechageneracion nuevo Valor de fechageneracion*/ +public void setFechageneracion(Date pFechageneracion){ + fechageneracion=pFechageneracion; +} + +/**Obtiene el valor de fechainicio +@return valor de fechainicio*/ +public Date getFechainicio(){ + return fechainicio; +} +/**Fija el valor de fechainicio +@param pFechainicio nuevo Valor de fechainicio*/ +public void setFechainicio(Date pFechainicio){ + fechainicio=pFechainicio; +} + +/**Obtiene el valor de fechafin +@return valor de fechafin*/ +public Date getFechafin(){ + return fechafin; +} +/**Fija el valor de fechafin +@param pFechafin nuevo Valor de fechafin*/ +public void setFechafin(Date pFechafin){ + fechafin=pFechafin; +} + +/**Obtiene el valor de ccentrocontrol +@return valor de ccentrocontrol*/ +public String getCcentrocontrol(){ + return ccentrocontrol; +} +/**Fija el valor de ccentrocontrol +@param pCcentrocontrol nuevo Valor de ccentrocontrol*/ +public void setCcentrocontrol(String pCcentrocontrol){ + ccentrocontrol=pCcentrocontrol; +} + +/**Obtiene el valor de anno +@return valor de ccentrocontrol*/ +public Long getAnno() { + return anno; +} +/**Fija el valor de anno +@param pCcentrocontrol nuevo Valor de ccentrocontrol*/ +public void setAnno(Long anno) { + this.anno = anno; +} + +/**Obtiene el valor de aprobada +@return valor de aprobada*/ +public String getAprobada() { + return aprobada; +} +/**Fija el valor de aprobada +@param pCcentrocontrol nuevo Valor de aprobada*/ +public void setAprobada(String aprobada) { + this.aprobada = aprobada; +} + +/**Obtiene el valor de xpath +@return valor de xpath*/ +public String getXpath() { + return xpath; +} +/**Fija el valor de xpath +@param pCcentrocontrol nuevo Valor de xpath*/ +public void setXpath(String xpath) { + this.xpath = xpath; +} + +/**Obtiene el valor de planificacion +@return valor de planificacion*/ +public String getIdPlanificacion() { + return idPlanificacion; +} +/**Fija el valor de planificacion +@param pidPlanificacion nuevo Valor de tipoplanificacionList*/ +public void setIdPlanificacion(String pidPlanificacion) { + this.idPlanificacion = pidPlanificacion; +} + +/**Obtiene el valor de planificacion +@return valor de planificacion*/ +public String getPlanificacion() { + return Planificacion; +} +/**Fija el valor de planificacion +@param pidPlanificacion nuevo Valor de tipoplanificacionList*/ +public void setPlanificacion(String pPlanificacion) { + this.Planificacion = pPlanificacion; +} + +/**Obtiene el valor de presupuesto +@return valor de presupuesto*/ +public Float getPresupuesto() { + return presupuesto; +} +/**Fija el valor de presupuesto +@param pidPlanificacion nuevo Valor de presupuesto*/ +public void setPresupuesto(Float ppresupuesto) { + this.presupuesto = ppresupuesto; +} + + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmPlanificacionInspeccion))return false; + TarmPlanificacionInspeccion that = (TarmPlanificacionInspeccion) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmPlanificacionInspeccion +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmPlanificacionInspeccion +*/ +public Object createInstance(){ + TarmPlanificacionInspeccion instance=new TarmPlanificacionInspeccion(); + return instance; +} +/**Clona la entidad TarmPlanificacionInspeccion +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmPlanificacionInspeccion p=(TarmPlanificacionInspeccion)this.clone(); + return p; +} + + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/ins/TarmPlanificacionTramite.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/ins/TarmPlanificacionTramite.java new file mode 100644 index 0000000..e167597 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/ins/TarmPlanificacionTramite.java @@ -0,0 +1,325 @@ +package com.fp.persistence.parmas.ins; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMPLANIFICACIONTRAMITE*/ +@Entity(name="TarmPlanificacionTramite") +@Table(name="TARMPLANIFICACIONTRAMITE") +public class TarmPlanificacionTramite extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmPlanificacionTramite +*/ +@Id +@Column(name="CPLANIFICACIONTRAMITE" ,nullable=false, updatable=false) +private Long pk; +@Column(name="CTRAMITE", nullable=true) + +/** +* null +*/ +private Long ctramite; + +@Column(name="MESNUMERO", nullable=true) + +/** +* null +*/ +private Long mesnumero; + +@Column(name="CPLANIFICACION", nullable=true) + +/** +* null +*/ +private Long cplanificacion; + +@Column(name="INSPECCION", nullable=true) + +/** +* null +*/ +private String inspeccion; + +@Column(name="CSOLICITUD", nullable=true) + +/** +* null +*/ +private String csolicitud; + +@Column(name="CDOCUMENTO", nullable=true) + +/** +* null +*/ +private Long cdocumento; + +@Column(name="MES", nullable=true) + +/** +* null +*/ +private String mes; + +@Column(name="PERIODO", nullable=true) + +/** +* null +*/ +private String periodo; + +@Column(name="INSPECTORES", nullable=true) + +/** +* null +*/ +private Long inspectores; + +@Column(name="VEHICULOS", nullable=true) + +/** +* null +*/ +private Long vehiculos; + +@Column(name="PRESUPESTO", nullable=true) + +/** +* null +*/ +private Float presupuesto; + +/**Contructor por defecto*/ +public TarmPlanificacionTramite(){ +} +/**Contructor de TarmPlanificacionTramite +@param pPk Clave Primaria del entity +*/ +public TarmPlanificacionTramite(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmPlanificacionTramite +*/ +public static TarmPlanificacionTramite find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmPlanificacionTramite obj = pEntityManager.find(TarmPlanificacionTramite.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmPlanificacionTramite +@return El objeto que referencia a la Clave primaria de TarmPlanificacionTramite +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmPlanificacionTramite +@param pPk El objeto que referencia a la nueva Clave primaria de TarmPlanificacionTramite +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de ctramite +@return valor de ctramite*/ +public Long getCtramite(){ + return ctramite; +} +/**Fija el valor de ctramite +@param pCtramite nuevo Valor de ctramite*/ +public void setCtramite(Long pCtramite){ + ctramite=pCtramite; +} + +/**Obtiene el valor de mesnumero +@return valor de mesnumero*/ +public Long getMesnumero(){ + return mesnumero; +} +/**Fija el valor de mesnumero +@param pMesnumero nuevo Valor de mesnumero*/ +public void setMesnumero(Long pMesnumero){ + mesnumero=pMesnumero; +} + +/**Obtiene el valor de cplanificacion +@return valor de cplanificacion*/ +public Long getCplanificacion(){ + return cplanificacion; +} +/**Fija el valor de cplanificacion +@param pCplanificacion nuevo Valor de cplanificacion*/ +public void setCplanificacion(Long pCplanificacion){ + cplanificacion=pCplanificacion; +} + +/**Obtiene el valor de inspeccion +@return valor de inspeccion*/ +public String getInspeccion(){ + return inspeccion; +} +/**Fija el valor de inspeccion +@param pInspeccion nuevo Valor de inspeccion*/ +public void setInspeccion(String pInspeccion){ + inspeccion=pInspeccion; +} + +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Obtiene el valor de cdocumento +@return valor de cdocumento*/ +public Long getCdocumento(){ + return cdocumento; +} +/**Fija el valor de cdocumento +@param pCdocumento nuevo Valor de cdocumento*/ +public void setCdocumento(Long pCdocumento){ + cdocumento=pCdocumento; +} + +/**Obtiene el valor de mes +@return valor de mes*/ +public String getMes(){ + return mes; +} +/**Fija el valor de mes +@param pMes nuevo Valor de mes*/ +public void setMes(String pMes){ + mes=pMes; +} + +/**Fija el valor de mes +@param pMes nuevo Valor de periodo*/ +public void setPeriodo(String pPeridodo){ + periodo=pPeridodo; +} + +/**Obtiene el valor de periodo +@return valor de mes*/ +public String getPeriodo(){ + return periodo; +} + +/**Obtiene el valor de inspectores +@return valor de inspectores*/ +public Long getInspectores(){ + return inspectores; +} +/**Fija el valor de cdocumento +@param pCdocumento nuevo Valor de cdocumento*/ +public void setInspectores(Long pinspectores){ + inspectores=pinspectores; +} + +/**Obtiene el valor de vehiculos +@return valor de vehiculos*/ +public Long getVehiculos(){ + return vehiculos; +} +/**Fija el valor de cdocumento +@param pCdocumento nuevo Valor de cdocumento*/ +public void setVehiculos(Long pvehiculos){ + vehiculos=pvehiculos; +} + +/**Obtiene el valor de presupuesto I +@return valor de presupuesto I*/ +public Float getPresupuesto() { + return presupuesto; +} +/**Fija el valor de presupuesto I +@param pidPlanificacion nuevo Valor de presupuesto I*/ +public void setPresupuesto(Float ppresupuesto) { + this.presupuesto = ppresupuesto; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmPlanificacionTramite))return false; + TarmPlanificacionTramite that = (TarmPlanificacionTramite) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmPlanificacionTramite +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmPlanificacionTramite +*/ +public Object createInstance(){ + TarmPlanificacionTramite instance=new TarmPlanificacionTramite(); + return instance; +} +/**Clona la entidad TarmPlanificacionTramite +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmPlanificacionTramite p=(TarmPlanificacionTramite)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/.svn/entries b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/.svn/entries new file mode 100644 index 0000000..94de4de --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte +svn://172.17.26.185/COMACO + + + +2015-02-20T11:02:07.602745Z +3831 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TarmTagArma.java +file + + + + +2022-07-28T03:40:27.765738Z +366cce399bebfd556e5d28d084bbceae +2015-01-08T09:24:45.800079Z +3722 +cpiedra + + + + + + + + + + + + + + + + + + + + + +3936 + +TarmColadeImpresion.java +file + + + + +2022-07-28T03:40:27.765738Z +c3ef27e44e401c0490e3781573dd8964 +2015-01-08T09:24:45.800079Z +3722 +cpiedra + + + + + + + + + + + + + + + + + + + + + +7028 + +TarmLectura.java +file + + + + +2022-07-28T03:40:27.765738Z +6964a0e0ef3a4cc2a2122853c9e5a336 +2015-02-20T11:02:07.602745Z +3831 +cpiedra + + + + + + + + + + + + + + + + + + + + + +7008 + +TarmLecturaDetalleKey.java +file + + + + +2022-07-28T03:40:27.766738Z +20b0198357fbc3745bb38ef35167af5e +2014-11-06T11:16:58.222919Z +2422 +cpiedra + + + + + + + + + + + + + + + + + + + + + +3342 + +TarmTagArmaKey.java +file + + + + +2022-07-28T03:40:27.766738Z +9a15a3d369252e41f3f41833bfd28be1 +2014-10-17T10:59:07.105580Z +1687 +acevallos + + + + + + + + + + + + + + + + + + + + + +3141 + +TarmLecturaDetalle.java +file + + + + +2022-07-28T03:40:27.766738Z +92d56889e2f049bab914e3af94bfe144 +2015-01-08T09:24:45.800079Z +3722 +cpiedra + + + + + + + + + + + + + + + + + + + + + +3829 + diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/.svn/text-base/TarmColadeImpresion.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/.svn/text-base/TarmColadeImpresion.java.svn-base new file mode 100644 index 0000000..1026751 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/.svn/text-base/TarmColadeImpresion.java.svn-base @@ -0,0 +1,249 @@ +package com.fp.persistence.parmas.inte; + +import javax.persistence.Entity; + +import java.sql.Timestamp; + +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMCOLADEIMPRESION*/ +@Entity(name="TarmColadeImpresion") +@Table(name="TARMCOLADEIMPRESION") +public class TarmColadeImpresion extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmColadeImpresion +*/ +@Id +@Column(name="CIMPRESION" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "TARMCOLADEIMPRESION"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.String"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "10")}) + @GeneratedValue(generator = "seq_id") +private String pk; +@Column(name="ESTADOIMPRESION", nullable=true) + +/** +* Codigo de catalogo 01 Por Imprimir, 02 Impreso +*/ +private String estadoimpresion; + +@Column(name="FECHAIMPRESION", nullable=true) + +/** +* Fecha de Impresion del Documento +*/ +private Timestamp fechaimpresion; + +@Column(name="ESTADOIMPRESIONCODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String estadoimpresioncode; + +@Column(name="CDOCUMENTO", nullable=true) + +/** +* null +*/ +private Long cdocumento; + +@Column(name="FECHAREGISTRO", nullable=true) + +/** +* null +*/ +private Date fecharegistro; + +@Column(name="CODIGOTARJETA", nullable=true) + +/** +* Codigo interno de la tarjeta fisica +*/ +private String codigotarjeta; + +/**Contructor por defecto*/ +public TarmColadeImpresion(){ +} +/**Contructor de TarmColadeImpresion +@param pPk Clave Primaria del entity +*/ +public TarmColadeImpresion(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmColadeImpresion +*/ +public static TarmColadeImpresion find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmColadeImpresion obj = pEntityManager.find(TarmColadeImpresion.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmColadeImpresion +@return El objeto que referencia a la Clave primaria de TarmColadeImpresion +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmColadeImpresion +@param pPk El objeto que referencia a la nueva Clave primaria de TarmColadeImpresion +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de estadoimpresion +@return valor de estadoimpresion*/ +public String getEstadoimpresion(){ + return estadoimpresion; +} +/**Fija el valor de estadoimpresion +@param pEstadoimpresion nuevo Valor de estadoimpresion*/ +public void setEstadoimpresion(String pEstadoimpresion){ + estadoimpresion=pEstadoimpresion; +} + +/**Obtiene el valor de fechaimpresion +@return valor de fechaimpresion*/ +public Timestamp getFechaimpresion(){ + return fechaimpresion; +} +/**Fija el valor de fechaimpresion +@param pFechaimpresion nuevo Valor de fechaimpresion*/ +public void setFechaimpresion(Timestamp pFechaimpresion){ + fechaimpresion=pFechaimpresion; +} + +/**Obtiene el valor de estadoimpresioncode +@return valor de estadoimpresioncode*/ +public String getEstadoimpresioncode(){ + return estadoimpresioncode; +} +/**Fija el valor de estadoimpresioncode +@param pEstadoimpresioncode nuevo Valor de estadoimpresioncode*/ +public void setEstadoimpresioncode(String pEstadoimpresioncode){ + estadoimpresioncode=pEstadoimpresioncode; +} + +/**Obtiene el valor de cdocumento +@return valor de cdocumento*/ +public Long getCdocumento(){ + return cdocumento; +} +/**Fija el valor de cdocumento +@param pCdocumento nuevo Valor de cdocumento*/ +public void setCdocumento(Long pCdocumento){ + cdocumento=pCdocumento; +} + +/**Obtiene el valor de fecharegistro +@return valor de fecharegistro*/ +public Date getFecharegistro(){ + return fecharegistro; +} +/**Fija el valor de fecharegistro +@param pFecharegistro nuevo Valor de fecharegistro*/ +public void setFecharegistro(Date pFecharegistro){ + fecharegistro=pFecharegistro; +} + +/**Obtiene el valor de codigotarjeta +@return valor de codigotarjeta*/ +public String getCodigotarjeta(){ + return codigotarjeta; +} +/**Fija el valor de codigotarjeta +@param pCodigotarjeta nuevo Valor de codigotarjeta*/ +public void setCodigotarjeta(String pCodigotarjeta){ + codigotarjeta=pCodigotarjeta; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmColadeImpresion))return false; + TarmColadeImpresion that = (TarmColadeImpresion) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmColadeImpresion +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmColadeImpresion +*/ +public Object createInstance(){ + TarmColadeImpresion instance=new TarmColadeImpresion(); + return instance; +} +/**Clona la entidad TarmColadeImpresion +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmColadeImpresion p=(TarmColadeImpresion)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/.svn/text-base/TarmLectura.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/.svn/text-base/TarmLectura.java.svn-base new file mode 100644 index 0000000..4188dc0 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/.svn/text-base/TarmLectura.java.svn-base @@ -0,0 +1,285 @@ +package com.fp.persistence.parmas.inte; + +import javax.persistence.Entity; +import java.sql.Timestamp; +import com.fp.dto.hb.Log; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMLECTURA*/ +@Entity(name="TarmLectura") +@Table(name="TARMLECTURA") +public class TarmLectura extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmLectura +*/ +@Id +@Column(name="CLECTURA" ,nullable=false, updatable=false) +private Long pk; +@Column(name="DIRECCION", nullable=true) + +/** +* null +*/ +private String direccion; + +@Column(name="IDPORTAL", nullable=true) + +/** +* null +*/ +private String idportal; + +@Column(name="TIPOLECTURA", nullable=true) + +/** +* null +*/ +private String tipolectura; + +@Column(name="CANTONCODE", nullable=true) + +/** +* Codigo de canton +*/ +private String cantoncode; + +@Column(name="COUNTRYCODE", nullable=true) + +/** +* Codigo de pais +*/ +private String countrycode; + +@Column(name="FECHA", nullable=true) + +/** +* null +*/ +private Timestamp fecha; + +@Column(name="PARROQUIACODE", nullable=true) + +/** +* Codigo de parroquia +*/ +private String parroquiacode; + +@Column(name="TIPOLECTURACODE", nullable=true) + +/** +* null +*/ +private String tipolecturacode; + +@Column(name="PROVINCECODE", nullable=true) + +/** +* Codigo de provincia +*/ +private String provincecode; + +/**Contructor por defecto*/ +public TarmLectura(){ +} +/**Contructor de TarmLectura +@param pPk Clave Primaria del entity +*/ +public TarmLectura(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmLectura +*/ +public static TarmLectura find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmLectura obj = pEntityManager.find(TarmLectura.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmLectura +@return El objeto que referencia a la Clave primaria de TarmLectura +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmLectura +@param pPk El objeto que referencia a la nueva Clave primaria de TarmLectura +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de direccion +@return valor de direccion*/ +public String getDireccion(){ + return direccion; +} +/**Fija el valor de direccion +@param pDireccion nuevo Valor de direccion*/ +public void setDireccion(String pDireccion){ + direccion=pDireccion; +} + +/**Obtiene el valor de idportal +@return valor de idportal*/ +public String getIdportal(){ + return idportal; +} +/**Fija el valor de idportal +@param pIdportal nuevo Valor de idportal*/ +public void setIdportal(String pIdportal){ + idportal=pIdportal; +} + +/**Obtiene el valor de tipolectura +@return valor de tipolectura*/ +public String getTipolectura(){ + return tipolectura; +} +/**Fija el valor de tipolectura +@param pTipolectura nuevo Valor de tipolectura*/ +public void setTipolectura(String pTipolectura){ + tipolectura=pTipolectura; +} + +/**Obtiene el valor de cantoncode +@return valor de cantoncode*/ +public String getCantoncode(){ + return cantoncode; +} +/**Fija el valor de cantoncode +@param pCantoncode nuevo Valor de cantoncode*/ +public void setCantoncode(String pCantoncode){ + cantoncode=pCantoncode; +} + +/**Obtiene el valor de countrycode +@return valor de countrycode*/ +public String getCountrycode(){ + return countrycode; +} +/**Fija el valor de countrycode +@param pCountrycode nuevo Valor de countrycode*/ +public void setCountrycode(String pCountrycode){ + countrycode=pCountrycode; +} + +/**Obtiene el valor de fecha +@return valor de fecha*/ +public Timestamp getFecha(){ + return fecha; +} +/**Fija el valor de fecha +@param pFecha nuevo Valor de fecha*/ +public void setFecha(Timestamp pFecha){ + fecha=pFecha; +} + +/**Obtiene el valor de parroquiacode +@return valor de parroquiacode*/ +public String getParroquiacode(){ + return parroquiacode; +} +/**Fija el valor de parroquiacode +@param pParroquiacode nuevo Valor de parroquiacode*/ +public void setParroquiacode(String pParroquiacode){ + parroquiacode=pParroquiacode; +} + +/**Obtiene el valor de tipolecturacode +@return valor de tipolecturacode*/ +public String getTipolecturacode(){ + return tipolecturacode; +} +/**Fija el valor de tipolecturacode +@param pTipolecturacode nuevo Valor de tipolecturacode*/ +public void setTipolecturacode(String pTipolecturacode){ + tipolecturacode=pTipolecturacode; +} + +/**Obtiene el valor de provincecode +@return valor de provincecode*/ +public String getProvincecode(){ + return provincecode; +} +/**Fija el valor de provincecode +@param pProvincecode nuevo Valor de provincecode*/ +public void setProvincecode(String pProvincecode){ + provincecode=pProvincecode; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmLectura))return false; + TarmLectura that = (TarmLectura) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmLectura +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmLectura +*/ +public Object createInstance(){ + TarmLectura instance=new TarmLectura(); + return instance; +} +/**Clona la entidad TarmLectura +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmLectura p=(TarmLectura)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/.svn/text-base/TarmLecturaDetalle.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/.svn/text-base/TarmLecturaDetalle.java.svn-base new file mode 100644 index 0000000..54e68f4 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/.svn/text-base/TarmLecturaDetalle.java.svn-base @@ -0,0 +1,129 @@ +package com.fp.persistence.parmas.inte; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMLECTURADETALLE*/ +@Entity(name="TarmLecturaDetalle") +@Table(name="TARMLECTURADETALLE") +public class TarmLecturaDetalle extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmLecturaDetalle +*/ +@EmbeddedId +private TarmLecturaDetalleKey pk; +/**Contructor por defecto*/ +public TarmLecturaDetalle(){ +} +/**Contructor de TarmLecturaDetalle +@param pPk Clave Primaria del entity +*/ +public TarmLecturaDetalle(TarmLecturaDetalleKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmLecturaDetalle +*/ +public static TarmLecturaDetalle find(EntityManager pEntityManager,TarmLecturaDetalleKey pKey) throws Exception{ + TarmLecturaDetalle obj = pEntityManager.find(TarmLecturaDetalle.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmLecturaDetalle +@return El objeto que referencia a la Clave primaria de TarmLecturaDetalle +*/ +public TarmLecturaDetalleKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmLecturaDetalle +@param pPk El objeto que referencia a la nueva Clave primaria de TarmLecturaDetalle +*/ +public void setPk(TarmLecturaDetalleKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmLecturaDetalle))return false; + TarmLecturaDetalle that = (TarmLecturaDetalle) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmLecturaDetalle +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmLecturaDetalle +*/ +public Object createInstance(){ + TarmLecturaDetalle instance=new TarmLecturaDetalle(); + instance.setPk(new TarmLecturaDetalleKey()); + return instance; +} +/**Clona la entidad TarmLecturaDetalle +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmLecturaDetalle p=(TarmLecturaDetalle)this.clone(); + p.setPk((TarmLecturaDetalleKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/.svn/text-base/TarmLecturaDetalleKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/.svn/text-base/TarmLecturaDetalleKey.java.svn-base new file mode 100644 index 0000000..6b86d30 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/.svn/text-base/TarmLecturaDetalleKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.parmas.inte; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMLECTURADETALLE*/ +@Embeddable +public class TarmLecturaDetalleKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CLECTURA", nullable=false,updatable=false) + +/** +* null +*/ +private Long clectura; + +@Column(name="CODIGOTAG", nullable=false,updatable=false) + +/** +* null +*/ +private String codigotag; + +/**Contructor por defecto*/ +public TarmLecturaDetalleKey(){} +/**Contructor de TarmLecturaDetalleKey +@param pClectura null +@param pCodigotag null +*/ +public TarmLecturaDetalleKey(Long pClectura,String pCodigotag){ + clectura=pClectura; + codigotag=pCodigotag; +} +/**Obtiene el valor de clectura +@return valor de clectura*/ +public Long getClectura(){ + return clectura; +} +/**Fija el valor de clectura +@param pClectura nuevo Valor de clectura*/ +public void setClectura(Long pClectura){ + clectura=pClectura; +} + +/**Obtiene el valor de codigotag +@return valor de codigotag*/ +public String getCodigotag(){ + return codigotag; +} +/**Fija el valor de codigotag +@param pCodigotag nuevo Valor de codigotag*/ +public void setCodigotag(String pCodigotag){ + codigotag=pCodigotag; +} + +/**Implementacion de la comparacion de TarmLecturaDetalleKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmLecturaDetalleKey))return false; + TarmLecturaDetalleKey that = (TarmLecturaDetalleKey) o; + if (this.getClectura() == null || that.getClectura() == null){ + return false; + } + if (! this.getClectura().equals(that.getClectura())){ + return false; + } + if (this.getCodigotag() == null || that.getCodigotag() == null){ + return false; + } + if (! this.getCodigotag().equals(that.getCodigotag())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmLecturaDetalleKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getClectura() == null ? 0 : this.getClectura().hashCode()); + result = result * 37 + (this.getCodigotag() == null ? 0 : this.getCodigotag().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/.svn/text-base/TarmTagArma.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/.svn/text-base/TarmTagArma.java.svn-base new file mode 100644 index 0000000..505e974 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/.svn/text-base/TarmTagArma.java.svn-base @@ -0,0 +1,149 @@ +package com.fp.persistence.parmas.inte; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; + +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMTAGARMA*/ +@Entity(name="TarmTagArma") +@Table(name="TARMTAGARMA") +public class TarmTagArma extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ + +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmTagArma +*/ +@EmbeddedId +private TarmTagArmaKey pk; +@Column(name="FECHA", nullable=true) + +/** +* Fecha de vigencia del Tag +*/ +private Timestamp fecha; + +/**Contructor por defecto*/ +public TarmTagArma(){ +} +/**Contructor de TarmTagArma +@param pPk Clave Primaria del entity +*/ +public TarmTagArma(TarmTagArmaKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmTagArma +*/ +public static TarmTagArma find(EntityManager pEntityManager,TarmTagArmaKey pKey) throws Exception{ + TarmTagArma obj = pEntityManager.find(TarmTagArma.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmTagArma +@return El objeto que referencia a la Clave primaria de TarmTagArma +*/ +public TarmTagArmaKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmTagArma +@param pPk El objeto que referencia a la nueva Clave primaria de TarmTagArma +*/ +public void setPk(TarmTagArmaKey pPk){ + pk=pPk; +} +/**Obtiene el valor de fecha +@return valor de fecha*/ +public Timestamp getFecha(){ + return fecha; +} +/**Fija el valor de fecha +@param pFecha nuevo Valor de fecha*/ +public void setFecha(Timestamp pFecha){ + fecha=pFecha; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmTagArma))return false; + TarmTagArma that = (TarmTagArma) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmTagArma +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmTagArma +*/ +public Object createInstance(){ + TarmTagArma instance=new TarmTagArma(); + instance.setPk(new TarmTagArmaKey()); + return instance; +} +/**Clona la entidad TarmTagArma +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmTagArma p=(TarmTagArma)this.clone(); + p.setPk((TarmTagArmaKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/.svn/text-base/TarmTagArmaKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/.svn/text-base/TarmTagArmaKey.java.svn-base new file mode 100644 index 0000000..00bd9d5 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/.svn/text-base/TarmTagArmaKey.java.svn-base @@ -0,0 +1,125 @@ +package com.fp.persistence.parmas.inte; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMTAGARMA*/ +@Embeddable +public class TarmTagArmaKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ + +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CARMA", nullable=false,updatable=false) + +/** +* Codigo del arma +*/ +private String carma; + +@Column(name="CTAG", nullable=false,updatable=false) + +/** +* Codigo del Tag +*/ +private String ctag; + +/**Contructor por defecto*/ +public TarmTagArmaKey(){} +/**Contructor de TarmTagArmaKey +@param pCarma Codigo del arma +@param pCtag Codigo del Tag +*/ +public TarmTagArmaKey(String pCarma,String pCtag){ + carma=pCarma; + ctag=pCtag; +} +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de ctag +@return valor de ctag*/ +public String getCtag(){ + return ctag; +} +/**Fija el valor de ctag +@param pCtag nuevo Valor de ctag*/ +public void setCtag(String pCtag){ + ctag=pCtag; +} + +/**Implementacion de la comparacion de TarmTagArmaKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmTagArmaKey))return false; + TarmTagArmaKey that = (TarmTagArmaKey) o; + if (this.getCarma() == null || that.getCarma() == null){ + return false; + } + if (! this.getCarma().equals(that.getCarma())){ + return false; + } + if (this.getCtag() == null || that.getCtag() == null){ + return false; + } + if (! this.getCtag().equals(that.getCtag())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmTagArmaKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCarma() == null ? 0 : this.getCarma().hashCode()); + result = result * 37 + (this.getCtag() == null ? 0 : this.getCtag().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/TarmColadeImpresion.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/TarmColadeImpresion.java new file mode 100644 index 0000000..1026751 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/TarmColadeImpresion.java @@ -0,0 +1,249 @@ +package com.fp.persistence.parmas.inte; + +import javax.persistence.Entity; + +import java.sql.Timestamp; + +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMCOLADEIMPRESION*/ +@Entity(name="TarmColadeImpresion") +@Table(name="TARMCOLADEIMPRESION") +public class TarmColadeImpresion extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmColadeImpresion +*/ +@Id +@Column(name="CIMPRESION" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "TARMCOLADEIMPRESION"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.String"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "10")}) + @GeneratedValue(generator = "seq_id") +private String pk; +@Column(name="ESTADOIMPRESION", nullable=true) + +/** +* Codigo de catalogo 01 Por Imprimir, 02 Impreso +*/ +private String estadoimpresion; + +@Column(name="FECHAIMPRESION", nullable=true) + +/** +* Fecha de Impresion del Documento +*/ +private Timestamp fechaimpresion; + +@Column(name="ESTADOIMPRESIONCODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String estadoimpresioncode; + +@Column(name="CDOCUMENTO", nullable=true) + +/** +* null +*/ +private Long cdocumento; + +@Column(name="FECHAREGISTRO", nullable=true) + +/** +* null +*/ +private Date fecharegistro; + +@Column(name="CODIGOTARJETA", nullable=true) + +/** +* Codigo interno de la tarjeta fisica +*/ +private String codigotarjeta; + +/**Contructor por defecto*/ +public TarmColadeImpresion(){ +} +/**Contructor de TarmColadeImpresion +@param pPk Clave Primaria del entity +*/ +public TarmColadeImpresion(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmColadeImpresion +*/ +public static TarmColadeImpresion find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmColadeImpresion obj = pEntityManager.find(TarmColadeImpresion.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmColadeImpresion +@return El objeto que referencia a la Clave primaria de TarmColadeImpresion +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmColadeImpresion +@param pPk El objeto que referencia a la nueva Clave primaria de TarmColadeImpresion +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de estadoimpresion +@return valor de estadoimpresion*/ +public String getEstadoimpresion(){ + return estadoimpresion; +} +/**Fija el valor de estadoimpresion +@param pEstadoimpresion nuevo Valor de estadoimpresion*/ +public void setEstadoimpresion(String pEstadoimpresion){ + estadoimpresion=pEstadoimpresion; +} + +/**Obtiene el valor de fechaimpresion +@return valor de fechaimpresion*/ +public Timestamp getFechaimpresion(){ + return fechaimpresion; +} +/**Fija el valor de fechaimpresion +@param pFechaimpresion nuevo Valor de fechaimpresion*/ +public void setFechaimpresion(Timestamp pFechaimpresion){ + fechaimpresion=pFechaimpresion; +} + +/**Obtiene el valor de estadoimpresioncode +@return valor de estadoimpresioncode*/ +public String getEstadoimpresioncode(){ + return estadoimpresioncode; +} +/**Fija el valor de estadoimpresioncode +@param pEstadoimpresioncode nuevo Valor de estadoimpresioncode*/ +public void setEstadoimpresioncode(String pEstadoimpresioncode){ + estadoimpresioncode=pEstadoimpresioncode; +} + +/**Obtiene el valor de cdocumento +@return valor de cdocumento*/ +public Long getCdocumento(){ + return cdocumento; +} +/**Fija el valor de cdocumento +@param pCdocumento nuevo Valor de cdocumento*/ +public void setCdocumento(Long pCdocumento){ + cdocumento=pCdocumento; +} + +/**Obtiene el valor de fecharegistro +@return valor de fecharegistro*/ +public Date getFecharegistro(){ + return fecharegistro; +} +/**Fija el valor de fecharegistro +@param pFecharegistro nuevo Valor de fecharegistro*/ +public void setFecharegistro(Date pFecharegistro){ + fecharegistro=pFecharegistro; +} + +/**Obtiene el valor de codigotarjeta +@return valor de codigotarjeta*/ +public String getCodigotarjeta(){ + return codigotarjeta; +} +/**Fija el valor de codigotarjeta +@param pCodigotarjeta nuevo Valor de codigotarjeta*/ +public void setCodigotarjeta(String pCodigotarjeta){ + codigotarjeta=pCodigotarjeta; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmColadeImpresion))return false; + TarmColadeImpresion that = (TarmColadeImpresion) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmColadeImpresion +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmColadeImpresion +*/ +public Object createInstance(){ + TarmColadeImpresion instance=new TarmColadeImpresion(); + return instance; +} +/**Clona la entidad TarmColadeImpresion +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmColadeImpresion p=(TarmColadeImpresion)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/TarmLectura.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/TarmLectura.java new file mode 100644 index 0000000..4188dc0 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/TarmLectura.java @@ -0,0 +1,285 @@ +package com.fp.persistence.parmas.inte; + +import javax.persistence.Entity; +import java.sql.Timestamp; +import com.fp.dto.hb.Log; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMLECTURA*/ +@Entity(name="TarmLectura") +@Table(name="TARMLECTURA") +public class TarmLectura extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmLectura +*/ +@Id +@Column(name="CLECTURA" ,nullable=false, updatable=false) +private Long pk; +@Column(name="DIRECCION", nullable=true) + +/** +* null +*/ +private String direccion; + +@Column(name="IDPORTAL", nullable=true) + +/** +* null +*/ +private String idportal; + +@Column(name="TIPOLECTURA", nullable=true) + +/** +* null +*/ +private String tipolectura; + +@Column(name="CANTONCODE", nullable=true) + +/** +* Codigo de canton +*/ +private String cantoncode; + +@Column(name="COUNTRYCODE", nullable=true) + +/** +* Codigo de pais +*/ +private String countrycode; + +@Column(name="FECHA", nullable=true) + +/** +* null +*/ +private Timestamp fecha; + +@Column(name="PARROQUIACODE", nullable=true) + +/** +* Codigo de parroquia +*/ +private String parroquiacode; + +@Column(name="TIPOLECTURACODE", nullable=true) + +/** +* null +*/ +private String tipolecturacode; + +@Column(name="PROVINCECODE", nullable=true) + +/** +* Codigo de provincia +*/ +private String provincecode; + +/**Contructor por defecto*/ +public TarmLectura(){ +} +/**Contructor de TarmLectura +@param pPk Clave Primaria del entity +*/ +public TarmLectura(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmLectura +*/ +public static TarmLectura find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmLectura obj = pEntityManager.find(TarmLectura.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmLectura +@return El objeto que referencia a la Clave primaria de TarmLectura +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmLectura +@param pPk El objeto que referencia a la nueva Clave primaria de TarmLectura +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de direccion +@return valor de direccion*/ +public String getDireccion(){ + return direccion; +} +/**Fija el valor de direccion +@param pDireccion nuevo Valor de direccion*/ +public void setDireccion(String pDireccion){ + direccion=pDireccion; +} + +/**Obtiene el valor de idportal +@return valor de idportal*/ +public String getIdportal(){ + return idportal; +} +/**Fija el valor de idportal +@param pIdportal nuevo Valor de idportal*/ +public void setIdportal(String pIdportal){ + idportal=pIdportal; +} + +/**Obtiene el valor de tipolectura +@return valor de tipolectura*/ +public String getTipolectura(){ + return tipolectura; +} +/**Fija el valor de tipolectura +@param pTipolectura nuevo Valor de tipolectura*/ +public void setTipolectura(String pTipolectura){ + tipolectura=pTipolectura; +} + +/**Obtiene el valor de cantoncode +@return valor de cantoncode*/ +public String getCantoncode(){ + return cantoncode; +} +/**Fija el valor de cantoncode +@param pCantoncode nuevo Valor de cantoncode*/ +public void setCantoncode(String pCantoncode){ + cantoncode=pCantoncode; +} + +/**Obtiene el valor de countrycode +@return valor de countrycode*/ +public String getCountrycode(){ + return countrycode; +} +/**Fija el valor de countrycode +@param pCountrycode nuevo Valor de countrycode*/ +public void setCountrycode(String pCountrycode){ + countrycode=pCountrycode; +} + +/**Obtiene el valor de fecha +@return valor de fecha*/ +public Timestamp getFecha(){ + return fecha; +} +/**Fija el valor de fecha +@param pFecha nuevo Valor de fecha*/ +public void setFecha(Timestamp pFecha){ + fecha=pFecha; +} + +/**Obtiene el valor de parroquiacode +@return valor de parroquiacode*/ +public String getParroquiacode(){ + return parroquiacode; +} +/**Fija el valor de parroquiacode +@param pParroquiacode nuevo Valor de parroquiacode*/ +public void setParroquiacode(String pParroquiacode){ + parroquiacode=pParroquiacode; +} + +/**Obtiene el valor de tipolecturacode +@return valor de tipolecturacode*/ +public String getTipolecturacode(){ + return tipolecturacode; +} +/**Fija el valor de tipolecturacode +@param pTipolecturacode nuevo Valor de tipolecturacode*/ +public void setTipolecturacode(String pTipolecturacode){ + tipolecturacode=pTipolecturacode; +} + +/**Obtiene el valor de provincecode +@return valor de provincecode*/ +public String getProvincecode(){ + return provincecode; +} +/**Fija el valor de provincecode +@param pProvincecode nuevo Valor de provincecode*/ +public void setProvincecode(String pProvincecode){ + provincecode=pProvincecode; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmLectura))return false; + TarmLectura that = (TarmLectura) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmLectura +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmLectura +*/ +public Object createInstance(){ + TarmLectura instance=new TarmLectura(); + return instance; +} +/**Clona la entidad TarmLectura +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmLectura p=(TarmLectura)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/TarmLecturaDetalle.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/TarmLecturaDetalle.java new file mode 100644 index 0000000..54e68f4 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/TarmLecturaDetalle.java @@ -0,0 +1,129 @@ +package com.fp.persistence.parmas.inte; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMLECTURADETALLE*/ +@Entity(name="TarmLecturaDetalle") +@Table(name="TARMLECTURADETALLE") +public class TarmLecturaDetalle extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmLecturaDetalle +*/ +@EmbeddedId +private TarmLecturaDetalleKey pk; +/**Contructor por defecto*/ +public TarmLecturaDetalle(){ +} +/**Contructor de TarmLecturaDetalle +@param pPk Clave Primaria del entity +*/ +public TarmLecturaDetalle(TarmLecturaDetalleKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmLecturaDetalle +*/ +public static TarmLecturaDetalle find(EntityManager pEntityManager,TarmLecturaDetalleKey pKey) throws Exception{ + TarmLecturaDetalle obj = pEntityManager.find(TarmLecturaDetalle.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmLecturaDetalle +@return El objeto que referencia a la Clave primaria de TarmLecturaDetalle +*/ +public TarmLecturaDetalleKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmLecturaDetalle +@param pPk El objeto que referencia a la nueva Clave primaria de TarmLecturaDetalle +*/ +public void setPk(TarmLecturaDetalleKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmLecturaDetalle))return false; + TarmLecturaDetalle that = (TarmLecturaDetalle) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmLecturaDetalle +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmLecturaDetalle +*/ +public Object createInstance(){ + TarmLecturaDetalle instance=new TarmLecturaDetalle(); + instance.setPk(new TarmLecturaDetalleKey()); + return instance; +} +/**Clona la entidad TarmLecturaDetalle +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmLecturaDetalle p=(TarmLecturaDetalle)this.clone(); + p.setPk((TarmLecturaDetalleKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/TarmLecturaDetalleKey.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/TarmLecturaDetalleKey.java new file mode 100644 index 0000000..6b86d30 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/TarmLecturaDetalleKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.parmas.inte; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMLECTURADETALLE*/ +@Embeddable +public class TarmLecturaDetalleKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CLECTURA", nullable=false,updatable=false) + +/** +* null +*/ +private Long clectura; + +@Column(name="CODIGOTAG", nullable=false,updatable=false) + +/** +* null +*/ +private String codigotag; + +/**Contructor por defecto*/ +public TarmLecturaDetalleKey(){} +/**Contructor de TarmLecturaDetalleKey +@param pClectura null +@param pCodigotag null +*/ +public TarmLecturaDetalleKey(Long pClectura,String pCodigotag){ + clectura=pClectura; + codigotag=pCodigotag; +} +/**Obtiene el valor de clectura +@return valor de clectura*/ +public Long getClectura(){ + return clectura; +} +/**Fija el valor de clectura +@param pClectura nuevo Valor de clectura*/ +public void setClectura(Long pClectura){ + clectura=pClectura; +} + +/**Obtiene el valor de codigotag +@return valor de codigotag*/ +public String getCodigotag(){ + return codigotag; +} +/**Fija el valor de codigotag +@param pCodigotag nuevo Valor de codigotag*/ +public void setCodigotag(String pCodigotag){ + codigotag=pCodigotag; +} + +/**Implementacion de la comparacion de TarmLecturaDetalleKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmLecturaDetalleKey))return false; + TarmLecturaDetalleKey that = (TarmLecturaDetalleKey) o; + if (this.getClectura() == null || that.getClectura() == null){ + return false; + } + if (! this.getClectura().equals(that.getClectura())){ + return false; + } + if (this.getCodigotag() == null || that.getCodigotag() == null){ + return false; + } + if (! this.getCodigotag().equals(that.getCodigotag())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmLecturaDetalleKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getClectura() == null ? 0 : this.getClectura().hashCode()); + result = result * 37 + (this.getCodigotag() == null ? 0 : this.getCodigotag().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/TarmTagArma.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/TarmTagArma.java new file mode 100644 index 0000000..505e974 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/TarmTagArma.java @@ -0,0 +1,149 @@ +package com.fp.persistence.parmas.inte; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; + +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMTAGARMA*/ +@Entity(name="TarmTagArma") +@Table(name="TARMTAGARMA") +public class TarmTagArma extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ + +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmTagArma +*/ +@EmbeddedId +private TarmTagArmaKey pk; +@Column(name="FECHA", nullable=true) + +/** +* Fecha de vigencia del Tag +*/ +private Timestamp fecha; + +/**Contructor por defecto*/ +public TarmTagArma(){ +} +/**Contructor de TarmTagArma +@param pPk Clave Primaria del entity +*/ +public TarmTagArma(TarmTagArmaKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmTagArma +*/ +public static TarmTagArma find(EntityManager pEntityManager,TarmTagArmaKey pKey) throws Exception{ + TarmTagArma obj = pEntityManager.find(TarmTagArma.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmTagArma +@return El objeto que referencia a la Clave primaria de TarmTagArma +*/ +public TarmTagArmaKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmTagArma +@param pPk El objeto que referencia a la nueva Clave primaria de TarmTagArma +*/ +public void setPk(TarmTagArmaKey pPk){ + pk=pPk; +} +/**Obtiene el valor de fecha +@return valor de fecha*/ +public Timestamp getFecha(){ + return fecha; +} +/**Fija el valor de fecha +@param pFecha nuevo Valor de fecha*/ +public void setFecha(Timestamp pFecha){ + fecha=pFecha; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmTagArma))return false; + TarmTagArma that = (TarmTagArma) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmTagArma +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmTagArma +*/ +public Object createInstance(){ + TarmTagArma instance=new TarmTagArma(); + instance.setPk(new TarmTagArmaKey()); + return instance; +} +/**Clona la entidad TarmTagArma +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmTagArma p=(TarmTagArma)this.clone(); + p.setPk((TarmTagArmaKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/TarmTagArmaKey.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/TarmTagArmaKey.java new file mode 100644 index 0000000..00bd9d5 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/inte/TarmTagArmaKey.java @@ -0,0 +1,125 @@ +package com.fp.persistence.parmas.inte; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMTAGARMA*/ +@Embeddable +public class TarmTagArmaKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ + +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CARMA", nullable=false,updatable=false) + +/** +* Codigo del arma +*/ +private String carma; + +@Column(name="CTAG", nullable=false,updatable=false) + +/** +* Codigo del Tag +*/ +private String ctag; + +/**Contructor por defecto*/ +public TarmTagArmaKey(){} +/**Contructor de TarmTagArmaKey +@param pCarma Codigo del arma +@param pCtag Codigo del Tag +*/ +public TarmTagArmaKey(String pCarma,String pCtag){ + carma=pCarma; + ctag=pCtag; +} +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de ctag +@return valor de ctag*/ +public String getCtag(){ + return ctag; +} +/**Fija el valor de ctag +@param pCtag nuevo Valor de ctag*/ +public void setCtag(String pCtag){ + ctag=pCtag; +} + +/**Implementacion de la comparacion de TarmTagArmaKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmTagArmaKey))return false; + TarmTagArmaKey that = (TarmTagArmaKey) o; + if (this.getCarma() == null || that.getCarma() == null){ + return false; + } + if (! this.getCarma().equals(that.getCarma())){ + return false; + } + if (this.getCtag() == null || that.getCtag() == null){ + return false; + } + if (! this.getCtag().equals(that.getCtag())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmTagArmaKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCarma() == null ? 0 : this.getCarma().hashCode()); + result = result * 37 + (this.getCtag() == null ? 0 : this.getCtag().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/entries b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/entries new file mode 100644 index 0000000..0b86064 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/entries @@ -0,0 +1,572 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param +svn://172.17.26.185/COMACO + + + +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TarmCentroControlJur.java +file + + + + +2022-07-28T03:40:27.835739Z +7eb557e4a49c961ce1dc0e9f18fc8b6f +2015-01-08T09:24:45.800079Z +3722 +cpiedra + + + + + + + + + + + + + + + + + + + + + +5785 + +TarmComercianteCupo.java +file + + + + +2022-07-28T03:40:27.835739Z +ed7e448a12b2d395727ac7208ec6d473 +2015-01-08T09:24:45.800079Z +3722 +cpiedra + + + + + + + + + + + + + + + + + + + + + +10102 + +TarmOrigenTramiteKey.java +file + + + + +2022-07-28T03:40:27.836739Z +6255607b2dae1240cf14a7b6cfe45984 +2015-12-29T13:58:56.911893Z +4357 +fpazmino + + + + + + + + + + + + + + + + + + + + + +4455 + +TarmTramitesAtendidos.java +file + + + + +2022-07-28T03:40:27.836739Z +13dc6e68d99a963116592fc92ae6dae8 +2015-01-08T09:24:45.800079Z +3722 +cpiedra + + + + + + + + + + + + + + + + + + + + + +6512 + +TarmRequisito.java +file + + + + +2022-07-28T03:40:27.836739Z +24b7145ce9ec3f30f655d925ddb6815b +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +5696 + +TarmTipoArmaExplosivo.java +file + + + + +2022-07-28T03:40:27.837739Z +5c1faa39ee286885456a30620ac93e8b +2015-01-08T09:24:45.800079Z +3722 +cpiedra +has-props + + + + + + + + + + + + + + + + + + + + +9186 + +TarmSitioAlmacenamiento.java +file + + + + +2022-07-28T03:40:27.837739Z +b61154aa92fb3ee940b38497f5e52846 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +11018 + +TarmTipoSancion.java +file + + + + +2022-07-28T03:40:27.837739Z +ee931c05c7b385e40d9bb71ef9752b55 +2015-01-08T09:24:45.800079Z +3722 +cpiedra +has-props + + + + + + + + + + + + + + + + + + + + +10576 + +TarmRequisitoPorTipoTramite.java +file + + + + +2022-07-28T03:40:27.838739Z +07c0d9b2e50dd674bbf852d6f4bb667a +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +5393 + +TarmCentroControl.java +file + + + + +2022-07-28T03:40:27.838739Z +ce4bf2962c1c4674638da60da40bcde8 +2015-01-29T14:23:34.302245Z +3822 +cpiedra + + + + + + + + + + + + + + + + + + + + + +12263 + +TarmUnidadTipo.java +file + + + + +2022-07-28T03:40:27.838739Z +3a033d0058cee82b8041abc2f21283d7 +2015-01-08T09:24:45.800079Z +3722 +cpiedra + + + + + + + + + + + + + + + + + + + + + +4587 + +TarmRequisitoPorTipoTramiteKey.java +file + + + + +2022-07-28T03:40:27.838739Z +5e7866aa75a7b0721fb197f227532462 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +3486 + +TarmTipoTramite.java +file + + + + +2022-07-28T03:40:27.839739Z +acf07e9b86a96fd68f136561eb85505d +2015-01-08T09:24:45.800079Z +3722 +cpiedra + + + + + + + + + + + + + + + + + + + + + +4519 + +TarmTramite.java +file + + + + +2022-07-28T03:40:27.839739Z +bc295b48ba31ee0063f4446901783292 +2015-12-29T14:02:56.878326Z +4358 +fpazmino +has-props + + + + + + + + + + + + + + + + + + + + +24425 + +TarmOrigenTramite.java +file + + + + +2022-07-28T03:40:27.839739Z +8ae1cb8c89de7198cbe0cbc0aec18fec +2015-12-29T13:58:56.911893Z +4357 +fpazmino + + + + + + + + + + + + + + + + + + + + + +3717 + +TarmUnidadTipoKey.java +file + + + + +2022-07-28T03:40:27.839739Z +26a8f58116eda7bf6449df6d14ace435 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +7704 + diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/prop-base/TarmSitioAlmacenamiento.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/prop-base/TarmSitioAlmacenamiento.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/prop-base/TarmSitioAlmacenamiento.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/prop-base/TarmTipoArmaExplosivo.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/prop-base/TarmTipoArmaExplosivo.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/prop-base/TarmTipoArmaExplosivo.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/prop-base/TarmTipoSancion.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/prop-base/TarmTipoSancion.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/prop-base/TarmTipoSancion.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/prop-base/TarmTramite.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/prop-base/TarmTramite.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/prop-base/TarmTramite.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmCentroControl.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmCentroControl.java.svn-base new file mode 100644 index 0000000..7a445f0 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmCentroControl.java.svn-base @@ -0,0 +1,461 @@ +package com.fp.persistence.parmas.param; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMCENTROCONTROL*/ +@Entity(name="TarmCentroControl") +@Table(name="TARMCENTROCONTROL") +public class TarmCentroControl extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmCentroControl +*/ +@Id +@Column(name="CCENTROCONTROL" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CCENTROCONTROL"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.String"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "6")}) + @GeneratedValue(generator = "seq_id") +private String pk; +@Column(name="CUPOSLIBRESULTIMODIA", nullable=true) + +/** +* CUANTOS TRAMITES PUEDO REALIZAR EN LA FECHAPROXIMOTRAMITE PARA COMPLETAR EL NUMERO DE TRAMITES POR DIA DEL CENTRO +*/ +private Integer cuposlibresultimodia; + +@Column(name="DIRECCION", nullable=true) + +/** +* null +*/ +private String direccion; + +@Column(name="NOMBREINSTITUCION", nullable=true) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String nombreinstitucion; + +@Column(name="CANTONCODE", nullable=true) + +/** +* Codigo de canton +*/ +private String cantoncode; + +@Column(name="NOMBREINSTITUCIONCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String nombreinstitucioncodigo; + +@Column(name="TRAMITESPORDIA", nullable=true) + +/** +* null +*/ +private Integer tramitespordia; + +@Column(name="GRADO", nullable=true) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String grado; + +@Column(name="COUNTRYCODE", nullable=true) + +/** +* Codigo de pais +*/ +private String countrycode; + +@Column(name="INSTITUCIONTIPO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String instituciontipo; + +@Column(name="INSTITUCION", nullable=true) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String institucion; + +@Column(name="FECHAPROXIMOTRAMITE", nullable=true) + +/** +* FECHA DE ATENCION AL USUARIO PARA EL PROXIMO TRAMITE DE TIPO PERMISO QUE INGRESE +*/ +private Date fechaproximotramite; + +@Column(name="PARROQUIACODE", nullable=true) + +/** +* Codigo de parroquia +*/ +private String parroquiacode; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="ESTADO", nullable=true) + +/** +* null +*/ +private String estado; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DATETO", nullable=true) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="PROVINCECODE", nullable=true) + +/** +* Codigo de provincia +*/ +private String provincecode; + +@Column(name="GRADOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String gradocodigo; + +/**Contructor por defecto*/ +public TarmCentroControl(){ +} +/**Contructor de TarmCentroControl +@param pPk Clave Primaria del entity +*/ +public TarmCentroControl(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmCentroControl +*/ +public static TarmCentroControl find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmCentroControl obj = pEntityManager.find(TarmCentroControl.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmCentroControl +@return El objeto que referencia a la Clave primaria de TarmCentroControl +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmCentroControl +@param pPk El objeto que referencia a la nueva Clave primaria de TarmCentroControl +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de cuposlibresultimodia +@return valor de cuposlibresultimodia*/ +public Integer getCuposlibresultimodia(){ + return cuposlibresultimodia; +} +/**Fija el valor de cuposlibresultimodia +@param pCuposlibresultimodia nuevo Valor de cuposlibresultimodia*/ +public void setCuposlibresultimodia(Integer pCuposlibresultimodia){ + cuposlibresultimodia=pCuposlibresultimodia; +} + +/**Obtiene el valor de direccion +@return valor de direccion*/ +public String getDireccion(){ + return direccion; +} +/**Fija el valor de direccion +@param pDireccion nuevo Valor de direccion*/ +public void setDireccion(String pDireccion){ + direccion=pDireccion; +} + +/**Obtiene el valor de nombreinstitucion +@return valor de nombreinstitucion*/ +public String getNombreinstitucion(){ + return nombreinstitucion; +} +/**Fija el valor de nombreinstitucion +@param pNombreinstitucion nuevo Valor de nombreinstitucion*/ +public void setNombreinstitucion(String pNombreinstitucion){ + nombreinstitucion=pNombreinstitucion; +} + +/**Obtiene el valor de cantoncode +@return valor de cantoncode*/ +public String getCantoncode(){ + return cantoncode; +} +/**Fija el valor de cantoncode +@param pCantoncode nuevo Valor de cantoncode*/ +public void setCantoncode(String pCantoncode){ + cantoncode=pCantoncode; +} + +/**Obtiene el valor de nombreinstitucioncodigo +@return valor de nombreinstitucioncodigo*/ +public String getNombreinstitucioncodigo(){ + return nombreinstitucioncodigo; +} +/**Fija el valor de nombreinstitucioncodigo +@param pNombreinstitucioncodigo nuevo Valor de nombreinstitucioncodigo*/ +public void setNombreinstitucioncodigo(String pNombreinstitucioncodigo){ + nombreinstitucioncodigo=pNombreinstitucioncodigo; +} + +/**Obtiene el valor de tramitespordia +@return valor de tramitespordia*/ +public Integer getTramitespordia(){ + return tramitespordia; +} +/**Fija el valor de tramitespordia +@param pTramitespordia nuevo Valor de tramitespordia*/ +public void setTramitespordia(Integer pTramitespordia){ + tramitespordia=pTramitespordia; +} + +/**Obtiene el valor de grado +@return valor de grado*/ +public String getGrado(){ + return grado; +} +/**Fija el valor de grado +@param pGrado nuevo Valor de grado*/ +public void setGrado(String pGrado){ + grado=pGrado; +} + +/**Obtiene el valor de countrycode +@return valor de countrycode*/ +public String getCountrycode(){ + return countrycode; +} +/**Fija el valor de countrycode +@param pCountrycode nuevo Valor de countrycode*/ +public void setCountrycode(String pCountrycode){ + countrycode=pCountrycode; +} + +/**Obtiene el valor de instituciontipo +@return valor de instituciontipo*/ +public String getInstituciontipo(){ + return instituciontipo; +} +/**Fija el valor de instituciontipo +@param pInstituciontipo nuevo Valor de instituciontipo*/ +public void setInstituciontipo(String pInstituciontipo){ + instituciontipo=pInstituciontipo; +} + +/**Obtiene el valor de institucion +@return valor de institucion*/ +public String getInstitucion(){ + return institucion; +} +/**Fija el valor de institucion +@param pInstitucion nuevo Valor de institucion*/ +public void setInstitucion(String pInstitucion){ + institucion=pInstitucion; +} + +/**Obtiene el valor de fechaproximotramite +@return valor de fechaproximotramite*/ +public Date getFechaproximotramite(){ + return fechaproximotramite; +} +/**Fija el valor de fechaproximotramite +@param pFechaproximotramite nuevo Valor de fechaproximotramite*/ +public void setFechaproximotramite(Date pFechaproximotramite){ + fechaproximotramite=pFechaproximotramite; +} + +/**Obtiene el valor de parroquiacode +@return valor de parroquiacode*/ +public String getParroquiacode(){ + return parroquiacode; +} +/**Fija el valor de parroquiacode +@param pParroquiacode nuevo Valor de parroquiacode*/ +public void setParroquiacode(String pParroquiacode){ + parroquiacode=pParroquiacode; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de estado +@return valor de estado*/ +public String getEstado(){ + return estado; +} +/**Fija el valor de estado +@param pEstado nuevo Valor de estado*/ +public void setEstado(String pEstado){ + estado=pEstado; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de provincecode +@return valor de provincecode*/ +public String getProvincecode(){ + return provincecode; +} +/**Fija el valor de provincecode +@param pProvincecode nuevo Valor de provincecode*/ +public void setProvincecode(String pProvincecode){ + provincecode=pProvincecode; +} + +/**Obtiene el valor de gradocodigo +@return valor de gradocodigo*/ +public String getGradocodigo(){ + return gradocodigo; +} +/**Fija el valor de gradocodigo +@param pGradocodigo nuevo Valor de gradocodigo*/ +public void setGradocodigo(String pGradocodigo){ + gradocodigo=pGradocodigo; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmCentroControl))return false; + TarmCentroControl that = (TarmCentroControl) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmCentroControl +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmCentroControl +*/ +public Object createInstance(){ + TarmCentroControl instance=new TarmCentroControl(); + return instance; +} +/**Clona la entidad TarmCentroControl +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmCentroControl p=(TarmCentroControl)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmCentroControlJur.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmCentroControlJur.java.svn-base new file mode 100644 index 0000000..5a68b59 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmCentroControlJur.java.svn-base @@ -0,0 +1,202 @@ +package com.fp.persistence.parmas.param; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMCENCONTROLJUR*/ +@Entity(name="TarmCentroControlJur") +@Table(name="TARMCENCONTROLJUR") +public class TarmCentroControlJur extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmCentroControlJur +*/ +@Id +@Column(name="CJURISDICCION" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CJURISDICCION"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.Long"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "16")}) + @GeneratedValue(generator = "seq_id") +private Long pk; +@Column(name="CCENTROCONTROL", nullable=true) + +/** +* Codigo de centro de control de armas +*/ +private String ccentrocontrol; + +@Column(name="COUNTRYCODE", nullable=true) + +/** +* Codigo de pais +*/ +private String countrycode; + +@Column(name="PROVINCECODE", nullable=true) + +/** +* Codigo de provincia +*/ +private String provincecode; + +@Transient +private String provincianombre; + +/**Contructor por defecto*/ +public TarmCentroControlJur(){ +} +/**Contructor de TarmCentroControlJur +@param pPk Clave Primaria del entity +*/ +public TarmCentroControlJur(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmCentroControlJur +*/ +public static TarmCentroControlJur find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmCentroControlJur obj = pEntityManager.find(TarmCentroControlJur.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmCentroControlJur +@return El objeto que referencia a la Clave primaria de TarmCentroControlJur +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmCentroControlJur +@param pPk El objeto que referencia a la nueva Clave primaria de TarmCentroControlJur +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de ccentrocontrol +@return valor de ccentrocontrol*/ +public String getCcentrocontrol(){ + return ccentrocontrol; +} +/**Fija el valor de ccentrocontrol +@param pCcentrocontrol nuevo Valor de ccentrocontrol*/ +public void setCcentrocontrol(String pCcentrocontrol){ + ccentrocontrol=pCcentrocontrol; +} + +/**Obtiene el valor de countrycode +@return valor de countrycode*/ +public String getCountrycode(){ + return countrycode; +} +/**Fija el valor de countrycode +@param pCountrycode nuevo Valor de countrycode*/ +public void setCountrycode(String pCountrycode){ + countrycode=pCountrycode; +} + +/**Obtiene el valor de provincecode +@return valor de provincecode*/ +public String getProvincecode(){ + return provincecode; +} +/**Fija el valor de provincecode +@param pProvincecode nuevo Valor de provincecode*/ +public void setProvincecode(String pProvincecode){ + provincecode=pProvincecode; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmCentroControlJur))return false; + TarmCentroControlJur that = (TarmCentroControlJur) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmCentroControlJur +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmCentroControlJur +*/ +public Object createInstance(){ + TarmCentroControlJur instance=new TarmCentroControlJur(); + return instance; +} +/**Clona la entidad TarmCentroControlJur +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmCentroControlJur p=(TarmCentroControlJur)this.clone(); + return p; +} +public String getProvincianombre() { + return provincianombre; +} +public void setProvincianombre(String provincianombre) { + this.provincianombre = provincianombre; +} + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmComercianteCupo.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmComercianteCupo.java.svn-base new file mode 100644 index 0000000..34cc57f --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmComercianteCupo.java.svn-base @@ -0,0 +1,353 @@ +package com.fp.persistence.parmas.param; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMCOMERCIANTECUPO*/ +@Entity(name="TarmComercianteCupo") +@Table(name="TARMCOMERCIANTECUPO") +public class TarmComercianteCupo extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmComercianteCupo +*/ +@Id +@Column(name="CCOMCUPO" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CCOMCUPO"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.String"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "16")}) + @GeneratedValue(generator = "seq_id") +private String pk; +@Column(name="CLASE", nullable=true) + +/** +* Codigo de catalogo 01 Explosivo, 02 Arma de Fuego +*/ +private String clase; + +@Column(name="CLASECODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipo de clase de arma +*/ +private String clasecodigo; + +@Column(name="TIPOARMAEXPLOSIVO", nullable=true) + +/** +* Codigo de catalogo 01 Revolver, 02 Plvora +*/ +private String tipoarmaexplosivo; + +@Column(name="TIPOARMAEXPLOSIVOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de armaexplosivo +*/ +private String tipoarmaexplosivocodigo; + +@Column(name="UNIDADMEDIDAPESO", nullable=true) + +/** +* Codigo de catalogo 01 KG, 02 Unidad +*/ +private String unidadmedidapeso; + +@Column(name="UNIDADMEDIDAPESOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de pesounidad +*/ +private String unidadmedidapesocodigo; + +@Column(name="PERSONCODIGO", nullable=true) + +/** +* Codigo de persona comerciante +*/ +private Integer personcodigo; + +@Column(name="TIPOREGISTRO", nullable=true) + +/** +* Codigo de catalogo 01 Importacin, 02 Produccin +*/ +private String tiporegistro; + +@Column(name="TIPOREGISTROCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de registro +*/ +private String tiporegistrocodigo; + +@Column(name="CUPOUNIDAD", nullable=true) + +/** +* Valor de cupo asignado a un comerciante por el tipo de registro, clase, tipoarmaexplosivo. +*/ +private BigDecimal cupounidad; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Versin del Registro +*/ +private Integer recordversion; + +@Column(name="FECHAREGISTRO", nullable=true) + +/** +* Fecha del registro +*/ +private Timestamp fecharegistro; + +/**Contructor por defecto*/ +public TarmComercianteCupo(){ +} +/**Contructor de TarmComercianteCupo +@param pPk Clave Primaria del entity +*/ +public TarmComercianteCupo(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmComercianteCupo +*/ +public static TarmComercianteCupo find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmComercianteCupo obj = pEntityManager.find(TarmComercianteCupo.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmComercianteCupo +@return El objeto que referencia a la Clave primaria de TarmComercianteCupo +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmComercianteCupo +@param pPk El objeto que referencia a la nueva Clave primaria de TarmComercianteCupo +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de clase +@return valor de clase*/ +public String getClase(){ + return clase; +} +/**Fija el valor de clase +@param pClase nuevo Valor de clase*/ +public void setClase(String pClase){ + clase=pClase; +} + +/**Obtiene el valor de clasecodigo +@return valor de clasecodigo*/ +public String getClasecodigo(){ + return clasecodigo; +} +/**Fija el valor de clasecodigo +@param pClasecodigo nuevo Valor de clasecodigo*/ +public void setClasecodigo(String pClasecodigo){ + clasecodigo=pClasecodigo; +} + +/**Obtiene el valor de tipoarmaexplosivo +@return valor de tipoarmaexplosivo*/ +public String getTipoarmaexplosivo(){ + return tipoarmaexplosivo; +} +/**Fija el valor de tipoarmaexplosivo +@param pTipoarmaexplosivo nuevo Valor de tipoarmaexplosivo*/ +public void setTipoarmaexplosivo(String pTipoarmaexplosivo){ + tipoarmaexplosivo=pTipoarmaexplosivo; +} + +/**Obtiene el valor de tipoarmaexplosivocodigo +@return valor de tipoarmaexplosivocodigo*/ +public String getTipoarmaexplosivocodigo(){ + return tipoarmaexplosivocodigo; +} +/**Fija el valor de tipoarmaexplosivocodigo +@param pTipoarmaexplosivocodigo nuevo Valor de tipoarmaexplosivocodigo*/ +public void setTipoarmaexplosivocodigo(String pTipoarmaexplosivocodigo){ + tipoarmaexplosivocodigo=pTipoarmaexplosivocodigo; +} + +/**Obtiene el valor de unidadmedidapeso +@return valor de unidadmedidapeso*/ +public String getUnidadmedidapeso(){ + return unidadmedidapeso; +} +/**Fija el valor de unidadmedidapeso +@param pUnidadmedidapeso nuevo Valor de unidadmedidapeso*/ +public void setUnidadmedidapeso(String pUnidadmedidapeso){ + unidadmedidapeso=pUnidadmedidapeso; +} + +/**Obtiene el valor de unidadmedidapesocodigo +@return valor de unidadmedidapesocodigo*/ +public String getUnidadmedidapesocodigo(){ + return unidadmedidapesocodigo; +} +/**Fija el valor de unidadmedidapesocodigo +@param pUnidadmedidapesocodigo nuevo Valor de unidadmedidapesocodigo*/ +public void setUnidadmedidapesocodigo(String pUnidadmedidapesocodigo){ + unidadmedidapesocodigo=pUnidadmedidapesocodigo; +} + +/**Obtiene el valor de personcodigo +@return valor de personcodigo*/ +public Integer getPersoncodigo(){ + return personcodigo; +} +/**Fija el valor de personcodigo +@param pPersoncodigo nuevo Valor de personcodigo*/ +public void setPersoncodigo(Integer pPersoncodigo){ + personcodigo=pPersoncodigo; +} + +/**Obtiene el valor de tiporegistro +@return valor de tiporegistro*/ +public String getTiporegistro(){ + return tiporegistro; +} +/**Fija el valor de tiporegistro +@param pTiporegistro nuevo Valor de tiporegistro*/ +public void setTiporegistro(String pTiporegistro){ + tiporegistro=pTiporegistro; +} + +/**Obtiene el valor de tiporegistrocodigo +@return valor de tiporegistrocodigo*/ +public String getTiporegistrocodigo(){ + return tiporegistrocodigo; +} +/**Fija el valor de tiporegistrocodigo +@param pTiporegistrocodigo nuevo Valor de tiporegistrocodigo*/ +public void setTiporegistrocodigo(String pTiporegistrocodigo){ + tiporegistrocodigo=pTiporegistrocodigo; +} + +/**Obtiene el valor de cupounidad +@return valor de cupounidad*/ +public BigDecimal getCupounidad(){ + return cupounidad; +} +/**Fija el valor de cupounidad +@param pCupounidad nuevo Valor de cupounidad*/ +public void setCupounidad(BigDecimal pCupounidad){ + cupounidad=pCupounidad; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de fecharegistro +@return valor de fecharegistro*/ +public Timestamp getFecharegistro(){ + return fecharegistro; +} +/**Fija el valor de fecharegistro +@param pFecharegistro nuevo Valor de fecharegistro*/ +public void setFecharegistro(Timestamp pFecharegistro){ + fecharegistro=pFecharegistro; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmComercianteCupo))return false; + TarmComercianteCupo that = (TarmComercianteCupo) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmComercianteCupo +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmComercianteCupo +*/ +public Object createInstance(){ + TarmComercianteCupo instance=new TarmComercianteCupo(); + return instance; +} +/**Clona la entidad TarmComercianteCupo +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmComercianteCupo p=(TarmComercianteCupo)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmOrigenTramite.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmOrigenTramite.java.svn-base new file mode 100644 index 0000000..9b476ce --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmOrigenTramite.java.svn-base @@ -0,0 +1,121 @@ +package com.fp.persistence.parmas.param; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMORIGENTRAMITE*/ +@Entity(name="TarmOrigenTramite") +@Table(name="TARMORIGENTRAMITE") +public class TarmOrigenTramite extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmOrigenTramite +*/ +@EmbeddedId +private TarmOrigenTramiteKey pk; +/**Contructor por defecto*/ +public TarmOrigenTramite(){ +} +/**Contructor de TarmOrigenTramite +@param pPk Clave Primaria del entity +*/ +public TarmOrigenTramite(TarmOrigenTramiteKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmOrigenTramite +*/ +public static TarmOrigenTramite find(EntityManager pEntityManager,TarmOrigenTramiteKey pKey) throws Exception{ + TarmOrigenTramite obj = pEntityManager.find(TarmOrigenTramite.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmOrigenTramite +@return El objeto que referencia a la Clave primaria de TarmOrigenTramite +*/ +public TarmOrigenTramiteKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmOrigenTramite +@param pPk El objeto que referencia a la nueva Clave primaria de TarmOrigenTramite +*/ +public void setPk(TarmOrigenTramiteKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmOrigenTramite))return false; + TarmOrigenTramite that = (TarmOrigenTramite) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmOrigenTramite +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmOrigenTramite +*/ +public Object createInstance(){ + TarmOrigenTramite instance=new TarmOrigenTramite(); + instance.setPk(new TarmOrigenTramiteKey()); + return instance; +} +/**Clona la entidad TarmOrigenTramite +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmOrigenTramite p=(TarmOrigenTramite)this.clone(); + p.setPk((TarmOrigenTramiteKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmOrigenTramiteKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmOrigenTramiteKey.java.svn-base new file mode 100644 index 0000000..3de8628 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmOrigenTramiteKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.parmas.param; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMORIGENTRAMITE*/ +@Embeddable +public class TarmOrigenTramiteKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CTRAMITE", nullable=false,updatable=false) + +/** +* Codigo de tramite +*/ +private Long ctramite; + +@Column(name="ORIGENCATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de catalogcode de origen +*/ +private String origencatalogcode; + +@Column(name="ORIGENCATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo de origen +*/ +private String origencatalog; + +/**Contructor por defecto*/ +public TarmOrigenTramiteKey(){} +/**Contructor de TarmOrigenTramiteKey +@param pCtramite Codigo de tramite +@param pOrigencatalogcode Codigo de catalogcode de origen +@param pOrigencatalog Codigo de catalogo de origen +*/ +public TarmOrigenTramiteKey(Long pCtramite,String pOrigencatalogcode,String pOrigencatalog){ + ctramite=pCtramite; + origencatalogcode=pOrigencatalogcode; + origencatalog=pOrigencatalog; +} +/**Obtiene el valor de ctramite +@return valor de ctramite*/ +public Long getCtramite(){ + return ctramite; +} +/**Fija el valor de ctramite +@param pCtramite nuevo Valor de ctramite*/ +public void setCtramite(Long pCtramite){ + ctramite=pCtramite; +} + +/**Obtiene el valor de origencatalogcode +@return valor de origencatalogcode*/ +public String getOrigencatalogcode(){ + return origencatalogcode; +} +/**Fija el valor de origencatalogcode +@param pOrigencatalogcode nuevo Valor de origencatalogcode*/ +public void setOrigencatalogcode(String pOrigencatalogcode){ + origencatalogcode=pOrigencatalogcode; +} + +/**Obtiene el valor de origencatalog +@return valor de origencatalog*/ +public String getOrigencatalog(){ + return origencatalog; +} +/**Fija el valor de origencatalog +@param pOrigencatalog nuevo Valor de origencatalog*/ +public void setOrigencatalog(String pOrigencatalog){ + origencatalog=pOrigencatalog; +} + +/**Implementacion de la comparacion de TarmOrigenTramiteKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmOrigenTramiteKey))return false; + TarmOrigenTramiteKey that = (TarmOrigenTramiteKey) o; + if (this.getCtramite() == null || that.getCtramite() == null){ + return false; + } + if (! this.getCtramite().equals(that.getCtramite())){ + return false; + } + if (this.getOrigencatalogcode() == null || that.getOrigencatalogcode() == null){ + return false; + } + if (! this.getOrigencatalogcode().equals(that.getOrigencatalogcode())){ + return false; + } + if (this.getOrigencatalog() == null || that.getOrigencatalog() == null){ + return false; + } + if (! this.getOrigencatalog().equals(that.getOrigencatalog())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmOrigenTramiteKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCtramite() == null ? 0 : this.getCtramite().hashCode()); + result = result * 37 + (this.getOrigencatalogcode() == null ? 0 : this.getOrigencatalogcode().hashCode()); + result = result * 37 + (this.getOrigencatalog() == null ? 0 : this.getOrigencatalog().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmRequisito.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmRequisito.java.svn-base new file mode 100644 index 0000000..c2eec12 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmRequisito.java.svn-base @@ -0,0 +1,211 @@ +package com.fp.persistence.parmas.param; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMREQUISITO*/ +@Entity(name="TarmRequisito") +@Table(name="TARMREQUISITO") +public class TarmRequisito extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmRequisito +*/ +@Id +@Column(name="CREQUISITO" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CREQUISITO"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.String"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "6")}) + @GeneratedValue(generator = "seq_id") +private String pk; + +@Column(name="NOMBRE", nullable=false) + +/** +* Descripcion del requisito +*/ +private String nombre; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPCIONCORTA", nullable=true) + +/** +* Descripcion corta del requisito +*/ +private String descripcioncorta; + +@Column(name="ACTIVE", nullable=true) +/** +* Activo +*/ +private String active; + +/**Contructor por defecto*/ +public TarmRequisito(){ +} +/**Contructor de TarmRequisito +@param pPk Clave Primaria del entity +@param pNombre Descripcion del requisito +*/ +public TarmRequisito(String pPk,String pNombre){ + this(); + pk=pPk; + nombre=pNombre; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmRequisito +*/ +public static TarmRequisito find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmRequisito obj = pEntityManager.find(TarmRequisito.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmRequisito +@return El objeto que referencia a la Clave primaria de TarmRequisito +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmRequisito +@param pPk El objeto que referencia a la nueva Clave primaria de TarmRequisito +*/ +public void setPk(String pPk){ + pk=pPk; + +} +/**Obtiene el valor de nombre +@return valor de nombre*/ +public String getNombre(){ + return nombre; +} +/**Fija el valor de nombre +@param pNombre nuevo Valor de nombre*/ +public void setNombre(String pNombre){ + nombre=pNombre; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmRequisito))return false; + TarmRequisito that = (TarmRequisito) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmRequisito +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmRequisito +*/ +public Object createInstance(){ + TarmRequisito instance=new TarmRequisito(); + return instance; +} +/**Clona la entidad TarmRequisito +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmRequisito p=(TarmRequisito)this.clone(); + return p; +} + +/**Obtiene el valor de descripcioncorta +@return valor de descripcioncorta*/ +public String getDescripcioncorta() { + return descripcioncorta; +} + +/**Fija el valor de descripcioncorta +@param pRecordversion nuevo Valor de descripcioncorta*/ +public void setDescripcioncorta(String descripcioncorta) { + this.descripcioncorta = descripcioncorta; +} +public String getActive() { + return active; +} +public void setActive(String active) { + this.active = active; +} + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmRequisitoPorTipoTramite.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmRequisitoPorTipoTramite.java.svn-base new file mode 100644 index 0000000..a1a3d78 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmRequisitoPorTipoTramite.java.svn-base @@ -0,0 +1,182 @@ +package com.fp.persistence.parmas.param; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMREQUISITOPORTIPOTRAMITE*/ +@Entity(name="TarmRequisitoPorTipoTramite") +@Table(name="TARMREQUISITOPORTIPOTRAMITE") +public class TarmRequisitoPorTipoTramite extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmRequisitoPorTipoTramite +*/ +@EmbeddedId +private TarmRequisitoPorTipoTramiteKey pk; +@Column(name="DEPOSITOPORTRAMITE", nullable=true) + +/** +* null +*/ +private String depositoportramite; + +@Column(name="DEPOSITOPORCUSTODIO", nullable=true) + +/** +* null +*/ +private String depositoporcustodio; + +@Column(name="ACTIVE", nullable=true) + +/** +* null +*/ +private String active; + +/**Contructor por defecto*/ +public TarmRequisitoPorTipoTramite(){ +} +/**Contructor de TarmRequisitoPorTipoTramite +@param pPk Clave Primaria del entity +*/ +public TarmRequisitoPorTipoTramite(TarmRequisitoPorTipoTramiteKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmRequisitoPorTipoTramite +*/ +public static TarmRequisitoPorTipoTramite find(EntityManager pEntityManager,TarmRequisitoPorTipoTramiteKey pKey) throws Exception{ + TarmRequisitoPorTipoTramite obj = pEntityManager.find(TarmRequisitoPorTipoTramite.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmRequisitoPorTipoTramite +@return El objeto que referencia a la Clave primaria de TarmRequisitoPorTipoTramite +*/ +public TarmRequisitoPorTipoTramiteKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmRequisitoPorTipoTramite +@param pPk El objeto que referencia a la nueva Clave primaria de TarmRequisitoPorTipoTramite +*/ +public void setPk(TarmRequisitoPorTipoTramiteKey pPk){ + pk=pPk; +} +/**Obtiene el valor de depositoportramite +@return valor de depositoportramite*/ +public String getDepositoportramite(){ + return depositoportramite; +} +/**Fija el valor de depositoportramite +@param pDepositoportramite nuevo Valor de depositoportramite*/ +public void setDepositoportramite(String pDepositoportramite){ + depositoportramite=pDepositoportramite; +} + +/**Obtiene el valor de depositoporcustodio +@return valor de depositoporcustodio*/ +public String getDepositoporcustodio(){ + return depositoporcustodio; +} +/**Fija el valor de depositoporcustodio +@param pDepositoporcustodio nuevo Valor de depositoporcustodio*/ +public void setDepositoporcustodio(String pDepositoporcustodio){ + depositoporcustodio=pDepositoporcustodio; +} + +/**Obtiene el valor de active +@return valor de active*/ +public String getActive() { + return active; +} + +/**Fija el valor de active +@param pActive nuevo Valor de active*/ +public void setActive(String pActive) { + this.active = pActive; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmRequisitoPorTipoTramite))return false; + TarmRequisitoPorTipoTramite that = (TarmRequisitoPorTipoTramite) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmRequisitoPorTipoTramite +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmRequisitoPorTipoTramite +*/ +public Object createInstance(){ + TarmRequisitoPorTipoTramite instance=new TarmRequisitoPorTipoTramite(); + instance.setPk(new TarmRequisitoPorTipoTramiteKey()); + return instance; +} +/**Clona la entidad TarmRequisitoPorTipoTramite +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmRequisitoPorTipoTramite p=(TarmRequisitoPorTipoTramite)this.clone(); + p.setPk((TarmRequisitoPorTipoTramiteKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmRequisitoPorTipoTramiteKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmRequisitoPorTipoTramiteKey.java.svn-base new file mode 100644 index 0000000..8a86746 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmRequisitoPorTipoTramiteKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.parmas.param; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMREQUISITOPORTIPOTRAMITE*/ +@Embeddable +public class TarmRequisitoPorTipoTramiteKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CREQUISITO", nullable=false,updatable=false) + +/** +* Codigo de requisito +*/ +private String crequisito; + +@Column(name="CTRAMITE", nullable=false,updatable=false) + +/** +* null +*/ +private Long ctramite; + +/**Contructor por defecto*/ +public TarmRequisitoPorTipoTramiteKey(){} +/**Contructor de TarmRequisitoPorTipoTramiteKey +@param pCrequisito Codigo de requisito +@param pCtramite null +*/ +public TarmRequisitoPorTipoTramiteKey(String pCrequisito,Long pCtramite){ + crequisito=pCrequisito; + ctramite=pCtramite; +} +/**Obtiene el valor de crequisito +@return valor de crequisito*/ +public String getCrequisito(){ + return crequisito; +} +/**Fija el valor de crequisito +@param pCrequisito nuevo Valor de crequisito*/ +public void setCrequisito(String pCrequisito){ + crequisito=pCrequisito; +} + +/**Obtiene el valor de ctramite +@return valor de ctramite*/ +public Long getCtramite(){ + return ctramite; +} +/**Fija el valor de ctramite +@param pCtramite nuevo Valor de ctramite*/ +public void setCtramite(Long pCtramite){ + ctramite=pCtramite; +} + +/**Implementacion de la comparacion de TarmRequisitoPorTipoTramiteKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmRequisitoPorTipoTramiteKey))return false; + TarmRequisitoPorTipoTramiteKey that = (TarmRequisitoPorTipoTramiteKey) o; + if (this.getCrequisito() == null || that.getCrequisito() == null){ + return false; + } + if (! this.getCrequisito().equals(that.getCrequisito())){ + return false; + } + if (this.getCtramite() == null || that.getCtramite() == null){ + return false; + } + if (! this.getCtramite().equals(that.getCtramite())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmRequisitoPorTipoTramiteKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCrequisito() == null ? 0 : this.getCrequisito().hashCode()); + result = result * 37 + (this.getCtramite() == null ? 0 : this.getCtramite().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmSitioAlmacenamiento.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmSitioAlmacenamiento.java.svn-base new file mode 100644 index 0000000..70ca38d --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmSitioAlmacenamiento.java.svn-base @@ -0,0 +1,435 @@ +package com.fp.persistence.parmas.param; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMSITIOALMACENAMIENTO*/ +@Entity(name="TarmSitioAlmacenamiento") +@Table(name="TARMSITIOALMACENAMIENTO") +public class TarmSitioAlmacenamiento extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmSitioAlmacenamiento +*/ +@Id +@Column(name="CSITIOALMACENAMIENTO" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CSITIOALMACENAMIENTO"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.String"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "6")}) + @GeneratedValue(generator = "seq_id") +private String pk; +@Column(name="TIPOCOMERCIO", nullable=true) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String tipocomercio; + +@Column(name="TIPOCOMERCIOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String tipocomerciocodigo; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="COUNTRYCODE", nullable=true) + +/** +* Codigo de pais +*/ +private String countrycode; + +@Column(name="PROVINCECODE", nullable=true) + +/** +* Codigo de provincia +*/ +private String provincecode; + +@Column(name="CANTONCODE", nullable=true) + +/** +* Codigo de canton +*/ +private String cantoncode; + +@Column(name="PARROQUIACODE", nullable=true) + +/** +* Codigo de parroquia +*/ +private String parroquiacode; + +@Column(name="CITYCODE", nullable=true) + +/** +* Codigo de cuidad +*/ +private String citycode; + +@Column(name="BODEGA", nullable=true) + +/** +* null +*/ +private String bodega; + +@Column(name="DIRECCION", nullable=true) + +/** +* null +*/ +private String direccion; + +@Column(name="LATITUD", nullable=true) + +/** +* null +*/ +private BigDecimal latitud; + +@Column(name="LONGITUD", nullable=true) + +/** +* null +*/ +private BigDecimal longitud; + +@Column(name="RESPONSABLE", nullable=true) + +/** +* null +*/ +private String responsable; + +@Column(name="IDENTIFICACION", nullable=true) + +/** +* null +*/ +private String identificacion; + +@Column(name="TELEFONO", nullable=true) + +/** +* Campo qu registra el Telfono de la bodega +*/ +private String telefono; + +@Column(name="REFERENCIA", nullable=true) + +/** +* Campo que registra la referencia deonde esta localizada la bodega +*/ +private String referencia; + +@Column(name="ESTADO", nullable=true) + +/** +* Campo que contiene el estado del registro +*/ +private String estado; + +/**Contructor por defecto*/ +public TarmSitioAlmacenamiento(){ +} +/**Contructor de TarmSitioAlmacenamiento +@param pPk Clave Primaria del entity +*/ +public TarmSitioAlmacenamiento(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmSitioAlmacenamiento +*/ +public static TarmSitioAlmacenamiento find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmSitioAlmacenamiento obj = pEntityManager.find(TarmSitioAlmacenamiento.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmSitioAlmacenamiento +@return El objeto que referencia a la Clave primaria de TarmSitioAlmacenamiento +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmSitioAlmacenamiento +@param pPk El objeto que referencia a la nueva Clave primaria de TarmSitioAlmacenamiento +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de tipocomercio +@return valor de tipocomercio*/ +public String getTipocomercio(){ + return tipocomercio; +} +/**Fija el valor de tipocomercio +@param pTipocomercio nuevo Valor de tipocomercio*/ +public void setTipocomercio(String pTipocomercio){ + tipocomercio=pTipocomercio; +} + +/**Obtiene el valor de tipocomerciocodigo +@return valor de tipocomerciocodigo*/ +public String getTipocomerciocodigo(){ + return tipocomerciocodigo; +} +/**Fija el valor de tipocomerciocodigo +@param pTipocomerciocodigo nuevo Valor de tipocomerciocodigo*/ +public void setTipocomerciocodigo(String pTipocomerciocodigo){ + tipocomerciocodigo=pTipocomerciocodigo; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de countrycode +@return valor de countrycode*/ +public String getCountrycode(){ + return countrycode; +} +/**Fija el valor de countrycode +@param pCountrycode nuevo Valor de countrycode*/ +public void setCountrycode(String pCountrycode){ + countrycode=pCountrycode; +} + +/**Obtiene el valor de provincecode +@return valor de provincecode*/ +public String getProvincecode(){ + return provincecode; +} +/**Fija el valor de provincecode +@param pProvincecode nuevo Valor de provincecode*/ +public void setProvincecode(String pProvincecode){ + provincecode=pProvincecode; +} + +/**Obtiene el valor de cantoncode +@return valor de cantoncode*/ +public String getCantoncode(){ + return cantoncode; +} +/**Fija el valor de cantoncode +@param pCantoncode nuevo Valor de cantoncode*/ +public void setCantoncode(String pCantoncode){ + cantoncode=pCantoncode; +} + +/**Obtiene el valor de parroquiacode +@return valor de parroquiacode*/ +public String getParroquiacode(){ + return parroquiacode; +} +/**Fija el valor de parroquiacode +@param pParroquiacode nuevo Valor de parroquiacode*/ +public void setParroquiacode(String pParroquiacode){ + parroquiacode=pParroquiacode; +} + +/**Obtiene el valor de citycode +@return valor de citycode*/ +public String getCitycode(){ + return citycode; +} +/**Fija el valor de citycode +@param pCitycode nuevo Valor de citycode*/ +public void setCitycode(String pCitycode){ + citycode=pCitycode; +} + +/**Obtiene el valor de bodega +@return valor de bodega*/ +public String getBodega(){ + return bodega; +} +/**Fija el valor de bodega +@param pBodega nuevo Valor de bodega*/ +public void setBodega(String pBodega){ + bodega=pBodega; +} + +/**Obtiene el valor de direccion +@return valor de direccion*/ +public String getDireccion(){ + return direccion; +} +/**Fija el valor de direccion +@param pDireccion nuevo Valor de direccion*/ +public void setDireccion(String pDireccion){ + direccion=pDireccion; +} + +/**Obtiene el valor de latitud +@return valor de latitud*/ +public BigDecimal getLatitud(){ + return latitud; +} +/**Fija el valor de latitud +@param pLatitud nuevo Valor de latitud*/ +public void setLatitud(BigDecimal pLatitud){ + latitud=pLatitud; +} + +/**Obtiene el valor de longitud +@return valor de longitud*/ +public BigDecimal getLongitud(){ + return longitud; +} +/**Fija el valor de longitud +@param pLongitud nuevo Valor de longitud*/ +public void setLongitud(BigDecimal pLongitud){ + longitud=pLongitud; +} + +/**Obtiene el valor de responsable +@return valor de responsable*/ +public String getResponsable(){ + return responsable; +} +/**Fija el valor de responsable +@param pResponsable nuevo Valor de responsable*/ +public void setResponsable(String pResponsable){ + responsable=pResponsable; +} + +/**Obtiene el valor de identificacion +@return valor de identificacion*/ +public String getIdentificacion(){ + return identificacion; +} +/**Fija el valor de identificacion +@param pIdentificacion nuevo Valor de identificacion*/ +public void setIdentificacion(String pIdentificacion){ + identificacion=pIdentificacion; +} + +/**Obtiene el valor de telefono +@return valor de telefono*/ +public String getTelefono(){ + return telefono; +} +/**Fija el valor de telefono +@param pTelefono nuevo Valor de telefono*/ +public void setTelefono(String pTelefono){ + telefono=pTelefono; +} + +/**Obtiene el valor de referencia +@return valor de referencia*/ +public String getReferencia(){ + return referencia; +} +/**Fija el valor de referencia +@param pReferencia nuevo Valor de referencia*/ +public void setReferencia(String pReferencia){ + referencia=pReferencia; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmSitioAlmacenamiento))return false; + TarmSitioAlmacenamiento that = (TarmSitioAlmacenamiento) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmSitioAlmacenamiento +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmSitioAlmacenamiento +*/ +public Object createInstance(){ + TarmSitioAlmacenamiento instance=new TarmSitioAlmacenamiento(); + return instance; +} +/**Clona la entidad TarmSitioAlmacenamiento +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmSitioAlmacenamiento p=(TarmSitioAlmacenamiento)this.clone(); + return p; +} +public String getEstado() { + return estado; +} +public void setEstado(String estado) { + this.estado = estado; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmTipoArmaExplosivo.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmTipoArmaExplosivo.java.svn-base new file mode 100644 index 0000000..4e8339c --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmTipoArmaExplosivo.java.svn-base @@ -0,0 +1,333 @@ +package com.fp.persistence.parmas.param; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMTIPOARMAEXPLOSIVO*/ +@Entity(name="TarmTipoArmaExplosivo") +@Table(name="TARMTIPOARMAEXPLOSIVO") +public class TarmTipoArmaExplosivo extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmTipoArmaExplosivo +*/ +@Id +@Column(name="CTIPOARMAEXPLOSIVO" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "TARMTIPOARMAEXPLOSIVO"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.String"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "6")}) + @GeneratedValue(generator = "seq_id") +private String pk; +@Column(name="LONGITUD", nullable=true) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String longitud; + +@Column(name="LONGITUDCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String longitudcodigo; + +@Column(name="CALIBRE", nullable=true) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String calibre; + +@Column(name="CALIBRECODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String calibrecodigo; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* null +*/ +private Integer recordversion; + +@Column(name="CLASE", nullable=true) + +/** +* null +*/ +private String clase; + +@Column(name="TIPOARMAEXPLOSIVO", nullable=true) + +/** +* null +*/ +private String tipoarmaexplosivo; + +@Column(name="TIPOARMAEXPLOSIVOCODIGO", nullable=true) + +/** +* null +*/ +private String tipoarmaexplosivocodigo; + +@Column(name="UNIDADMEDIDAPESO", nullable=true) + +/** +* null +*/ +private String unidadmedidapeso; + +@Column(name="UNIDADMEDIDAPESOCODIGO", nullable=true) + +/** +* null +*/ +private String unidadmedidapesocodigo; + +@Column(name="CLASECODIGO", nullable=true) + +/** +* null +*/ +private String clasecodigo; + +/**Contructor por defecto*/ +public TarmTipoArmaExplosivo(){ +} +/**Contructor de TarmTipoArmaExplosivo +@param pPk Clave Primaria del entity +*/ +public TarmTipoArmaExplosivo(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmTipoArmaExplosivo +*/ +public static TarmTipoArmaExplosivo find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmTipoArmaExplosivo obj = pEntityManager.find(TarmTipoArmaExplosivo.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmTipoArmaExplosivo +@return El objeto que referencia a la Clave primaria de TarmTipoArmaExplosivo +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmTipoArmaExplosivo +@param pPk El objeto que referencia a la nueva Clave primaria de TarmTipoArmaExplosivo +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de longitud +@return valor de longitud*/ +public String getLongitud(){ + return longitud; +} +/**Fija el valor de longitud +@param pLongitud nuevo Valor de longitud*/ +public void setLongitud(String pLongitud){ + longitud=pLongitud; +} + +/**Obtiene el valor de longitudcodigo +@return valor de longitudcodigo*/ +public String getLongitudcodigo(){ + return longitudcodigo; +} +/**Fija el valor de longitudcodigo +@param pLongitudcodigo nuevo Valor de longitudcodigo*/ +public void setLongitudcodigo(String pLongitudcodigo){ + longitudcodigo=pLongitudcodigo; +} + +/**Obtiene el valor de calibre +@return valor de calibre*/ +public String getCalibre(){ + return calibre; +} +/**Fija el valor de calibre +@param pCalibre nuevo Valor de calibre*/ +public void setCalibre(String pCalibre){ + calibre=pCalibre; +} + +/**Obtiene el valor de calibrecodigo +@return valor de calibrecodigo*/ +public String getCalibrecodigo(){ + return calibrecodigo; +} +/**Fija el valor de calibrecodigo +@param pCalibrecodigo nuevo Valor de calibrecodigo*/ +public void setCalibrecodigo(String pCalibrecodigo){ + calibrecodigo=pCalibrecodigo; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de clase +@return valor de clase*/ +public String getClase(){ + return clase; +} +/**Fija el valor de clase +@param pClase nuevo Valor de clase*/ +public void setClase(String pClase){ + clase=pClase; +} + +/**Obtiene el valor de tipoarmaexplosivo +@return valor de tipoarmaexplosivo*/ +public String getTipoarmaexplosivo(){ + return tipoarmaexplosivo; +} +/**Fija el valor de tipoarmaexplosivo +@param pTipoarmaexplosivo nuevo Valor de tipoarmaexplosivo*/ +public void setTipoarmaexplosivo(String pTipoarmaexplosivo){ + tipoarmaexplosivo=pTipoarmaexplosivo; +} + +/**Obtiene el valor de tipoarmaexplosivocodigo +@return valor de tipoarmaexplosivocodigo*/ +public String getTipoarmaexplosivocodigo(){ + return tipoarmaexplosivocodigo; +} +/**Fija el valor de tipoarmaexplosivocodigo +@param pTipoarmaexplosivocodigo nuevo Valor de tipoarmaexplosivocodigo*/ +public void setTipoarmaexplosivocodigo(String pTipoarmaexplosivocodigo){ + tipoarmaexplosivocodigo=pTipoarmaexplosivocodigo; +} + +/**Obtiene el valor de unidadmedidapeso +@return valor de unidadmedidapeso*/ +public String getUnidadmedidapeso(){ + return unidadmedidapeso; +} +/**Fija el valor de unidadmedidapeso +@param pUnidadmedidapeso nuevo Valor de unidadmedidapeso*/ +public void setUnidadmedidapeso(String pUnidadmedidapeso){ + unidadmedidapeso=pUnidadmedidapeso; +} + +/**Obtiene el valor de unidadmedidapesocodigo +@return valor de unidadmedidapesocodigo*/ +public String getUnidadmedidapesocodigo(){ + return unidadmedidapesocodigo; +} +/**Fija el valor de unidadmedidapesocodigo +@param pUnidadmedidapesocodigo nuevo Valor de unidadmedidapesocodigo*/ +public void setUnidadmedidapesocodigo(String pUnidadmedidapesocodigo){ + unidadmedidapesocodigo=pUnidadmedidapesocodigo; +} + +/**Obtiene el valor de clasecodigo +@return valor de clasecodigo*/ +public String getClasecodigo(){ + return clasecodigo; +} +/**Fija el valor de clasecodigo +@param pClasecodigo nuevo Valor de clasecodigo*/ +public void setClasecodigo(String pClasecodigo){ + clasecodigo=pClasecodigo; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmTipoArmaExplosivo))return false; + TarmTipoArmaExplosivo that = (TarmTipoArmaExplosivo) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmTipoArmaExplosivo +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmTipoArmaExplosivo +*/ +public Object createInstance(){ + TarmTipoArmaExplosivo instance=new TarmTipoArmaExplosivo(); + return instance; +} +/**Clona la entidad TarmTipoArmaExplosivo +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmTipoArmaExplosivo p=(TarmTipoArmaExplosivo)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmTipoSancion.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmTipoSancion.java.svn-base new file mode 100644 index 0000000..84bd52d --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmTipoSancion.java.svn-base @@ -0,0 +1,376 @@ +package com.fp.persistence.parmas.param; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMTIPOSANCION*/ +@Entity(name="TarmTipoSancion") +@Table(name="TARMTIPOSANCION") +public class TarmTipoSancion extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmTipoSancion +*/ +@Id +@Column(name="CTIPOSANCION" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "TARMTIPOSANCION"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.String"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "6")}) + @GeneratedValue(generator = "seq_id") +private String pk; +@Column(name="CLASE", nullable=false) + +/** +* Codigo de catalogo correspondiente a la clase +*/ +private String clase; + +@Column(name="CLASECODIGO", nullable=false) + +/** +* Codigo de catalogcode correspondiente a la clase +*/ +private String clasecodigo; + +@Column(name="FALTA", nullable=false) + +/** +* Codigo de catalogo correspondiente a la falta +*/ +private String falta; + +@Column(name="FALTACODIGO", nullable=false) + +/** +* Codigo de catalogcode correspondiente a la falta +*/ +private String faltacodigo; + +@Column(name="TIPOFALTA", nullable=false) + +/** +* Codigo de catalogo correspondiente al tipo de falta +*/ +private String tipofalta; + +@Column(name="TIPOFALTACODIGO", nullable=false) + +/** +* Codigo de catalogcode correspondiente al tipo de falta +*/ +private String tipofaltacodigo; + +@Column(name="TRAMITE", nullable=false) + +/** +* Codigo de catalogo correspondiente al tramite +*/ +private String tramite; + +@Column(name="TRAMITECODIGO", nullable=false) + +/** +* Codigo de catalogcode correspondiente al tramite +*/ +private String tramitecodigo; + +@Column(name="SANCION", nullable=false) + +/** +* Codigo de catalogo correspondiente a la sancion +*/ +private String sancion; + +@Column(name="SANCIONCODIGO", nullable=false) + +/** +* Codigo de catalogcode correspondiente a la sancion +*/ +private String sancioncodigo; + +@Column(name="TIEMPO", nullable=false) + +/** +* Codigo de catalogo correspondiente al tiempo de la sancion en dias +*/ +private String tiempo; + +@Column(name="TIEMPOCODIGO", nullable=false) + +/** +* Codigo de catalogcode correspondiente al tiempo de vigencia de la sancion en dias +*/ +private String tiempocodigo; + +/**Contructor por defecto*/ +public TarmTipoSancion(){ +} +/**Contructor de TarmTipoSancion +@param pPk Clave Primaria del entity +@param pClase Codigo de catalogo correspondiente a la clase +@param pClasecodigo Codigo de catalogcode correspondiente a la clase +@param pFalta Codigo de catalogo correspondiente a la falta +@param pFaltacodigo Codigo de catalogcode correspondiente a la falta +@param pTipofalta Codigo de catalogo correspondiente al tipo de falta +@param pTipofaltacodigo Codigo de catalogcode correspondiente al tipo de falta +@param pTramite Codigo de catalogo correspondiente al tramite +@param pTramitecodigo Codigo de catalogcode correspondiente al tramite +@param pSancion Codigo de catalogo correspondiente a la sancion +@param pSancioncodigo Codigo de catalogcode correspondiente a la sancion +@param pTiempo Codigo de catalogo correspondiente al tiempo de la sancion en dias +@param pTiempocodigo Codigo de catalogcode correspondiente al tiempo de vigencia de la sancion en dias +*/ +public TarmTipoSancion(String pPk,String pClase,String pClasecodigo,String pFalta,String pFaltacodigo,String pTipofalta,String pTipofaltacodigo,String pTramite,String pTramitecodigo,String pSancion,String pSancioncodigo,String pTiempo,String pTiempocodigo){ + this(); + pk=pPk; + clase=pClase; + clasecodigo=pClasecodigo; + falta=pFalta; + faltacodigo=pFaltacodigo; + tipofalta=pTipofalta; + tipofaltacodigo=pTipofaltacodigo; + tramite=pTramite; + tramitecodigo=pTramitecodigo; + sancion=pSancion; + sancioncodigo=pSancioncodigo; + tiempo=pTiempo; + tiempocodigo=pTiempocodigo; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmTipoSancion +*/ +public static TarmTipoSancion find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmTipoSancion obj = pEntityManager.find(TarmTipoSancion.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmTipoSancion +@return El objeto que referencia a la Clave primaria de TarmTipoSancion +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmTipoSancion +@param pPk El objeto que referencia a la nueva Clave primaria de TarmTipoSancion +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de clase +@return valor de clase*/ +public String getClase(){ + return clase; +} +/**Fija el valor de clase +@param pClase nuevo Valor de clase*/ +public void setClase(String pClase){ + clase=pClase; +} + +/**Obtiene el valor de clasecodigo +@return valor de clasecodigo*/ +public String getClasecodigo(){ + return clasecodigo; +} +/**Fija el valor de clasecodigo +@param pClasecodigo nuevo Valor de clasecodigo*/ +public void setClasecodigo(String pClasecodigo){ + clasecodigo=pClasecodigo; +} + +/**Obtiene el valor de falta +@return valor de falta*/ +public String getFalta(){ + return falta; +} +/**Fija el valor de falta +@param pFalta nuevo Valor de falta*/ +public void setFalta(String pFalta){ + falta=pFalta; +} + +/**Obtiene el valor de faltacodigo +@return valor de faltacodigo*/ +public String getFaltacodigo(){ + return faltacodigo; +} +/**Fija el valor de faltacodigo +@param pFaltacodigo nuevo Valor de faltacodigo*/ +public void setFaltacodigo(String pFaltacodigo){ + faltacodigo=pFaltacodigo; +} + +/**Obtiene el valor de tipofalta +@return valor de tipofalta*/ +public String getTipofalta(){ + return tipofalta; +} +/**Fija el valor de tipofalta +@param pTipofalta nuevo Valor de tipofalta*/ +public void setTipofalta(String pTipofalta){ + tipofalta=pTipofalta; +} + +/**Obtiene el valor de tipofaltacodigo +@return valor de tipofaltacodigo*/ +public String getTipofaltacodigo(){ + return tipofaltacodigo; +} +/**Fija el valor de tipofaltacodigo +@param pTipofaltacodigo nuevo Valor de tipofaltacodigo*/ +public void setTipofaltacodigo(String pTipofaltacodigo){ + tipofaltacodigo=pTipofaltacodigo; +} + +/**Obtiene el valor de tramite +@return valor de tramite*/ +public String getTramite(){ + return tramite; +} +/**Fija el valor de tramite +@param pTramite nuevo Valor de tramite*/ +public void setTramite(String pTramite){ + tramite=pTramite; +} + +/**Obtiene el valor de tramitecodigo +@return valor de tramitecodigo*/ +public String getTramitecodigo(){ + return tramitecodigo; +} +/**Fija el valor de tramitecodigo +@param pTramitecodigo nuevo Valor de tramitecodigo*/ +public void setTramitecodigo(String pTramitecodigo){ + tramitecodigo=pTramitecodigo; +} + +/**Obtiene el valor de sancion +@return valor de sancion*/ +public String getSancion(){ + return sancion; +} +/**Fija el valor de sancion +@param pSancion nuevo Valor de sancion*/ +public void setSancion(String pSancion){ + sancion=pSancion; +} + +/**Obtiene el valor de sancioncodigo +@return valor de sancioncodigo*/ +public String getSancioncodigo(){ + return sancioncodigo; +} +/**Fija el valor de sancioncodigo +@param pSancioncodigo nuevo Valor de sancioncodigo*/ +public void setSancioncodigo(String pSancioncodigo){ + sancioncodigo=pSancioncodigo; +} + +/**Obtiene el valor de tiempo +@return valor de tiempo*/ +public String getTiempo(){ + return tiempo; +} +/**Fija el valor de tiempo +@param pTiempo nuevo Valor de tiempo*/ +public void setTiempo(String pTiempo){ + tiempo=pTiempo; +} + +/**Obtiene el valor de tiempocodigo +@return valor de tiempocodigo*/ +public String getTiempocodigo(){ + return tiempocodigo; +} +/**Fija el valor de tiempocodigo +@param pTiempocodigo nuevo Valor de tiempocodigo*/ +public void setTiempocodigo(String pTiempocodigo){ + tiempocodigo=pTiempocodigo; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmTipoSancion))return false; + TarmTipoSancion that = (TarmTipoSancion) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmTipoSancion +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmTipoSancion +*/ +public Object createInstance(){ + TarmTipoSancion instance=new TarmTipoSancion(); + return instance; +} +/**Clona la entidad TarmTipoSancion +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmTipoSancion p=(TarmTipoSancion)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmTipoTramite.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmTipoTramite.java.svn-base new file mode 100644 index 0000000..25a3d1b --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmTipoTramite.java.svn-base @@ -0,0 +1,167 @@ +package com.fp.persistence.parmas.param; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMTIPOTRAMITE*/ +@Entity(name="TarmTipoTramite") +@Table(name="TARMTIPOTRAMITE") +public class TarmTipoTramite extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmTipoTramite +*/ +@Id +@Column(name="CTIPOTRAMITE" ,nullable=false, updatable=false) +private String pk; +@Column(name="NOMBRE", nullable=false) + +/** +* Descripcion del tipo de tramite +*/ +private String nombre; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking del registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TarmTipoTramite(){ +} +/**Contructor de TarmTipoTramite +@param pPk Clave Primaria del entity +@param pNombre Descripcion del tipo de tramite +*/ +public TarmTipoTramite(String pPk,String pNombre){ + this(); + pk=pPk; + nombre=pNombre; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmTipoTramite +*/ +public static TarmTipoTramite find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmTipoTramite obj = pEntityManager.find(TarmTipoTramite.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmTipoTramite +@return El objeto que referencia a la Clave primaria de TarmTipoTramite +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmTipoTramite +@param pPk El objeto que referencia a la nueva Clave primaria de TarmTipoTramite +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de nombre +@return valor de nombre*/ +public String getNombre(){ + return nombre; +} +/**Fija el valor de nombre +@param pNombre nuevo Valor de nombre*/ +public void setNombre(String pNombre){ + nombre=pNombre; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmTipoTramite))return false; + TarmTipoTramite that = (TarmTipoTramite) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmTipoTramite +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmTipoTramite +*/ +public Object createInstance(){ + TarmTipoTramite instance=new TarmTipoTramite(); + return instance; +} +/**Clona la entidad TarmTipoTramite +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmTipoTramite p=(TarmTipoTramite)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmTramite.java.netbeans-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmTramite.java.netbeans-base new file mode 100644 index 0000000..c8132a5 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmTramite.java.netbeans-base @@ -0,0 +1,958 @@ +package com.fp.persistence.parmas.param; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMTRAMITE*/ +@Entity(name="TarmTramite") +@Table(name="TARMTRAMITE") +public class TarmTramite extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmTramite +*/ +@Id +@Column(name="CTRAMITE" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CTRAMITE"), + @Parameter(name = "type", value = "java.lang.Long"), + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "16")}) + @GeneratedValue(generator = "seq_id") +private Long pk; +@Column(name="COSTOCUSTODIO", nullable=true) + +/** +* Costo de cada custodio segun el tramite +*/ +private BigDecimal costocustodio; + +@Column(name="TIPOARCHIVOCODIGO", nullable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String tipoarchivocodigo; + +@Column(name="REGISTROGUARDIA", nullable=true) + +/** +* null +*/ +private String registroguardia; + +@Column(name="TIPOTRAMITE", nullable=false) + +/** +* null +*/ +private String tipotramite; + +@Column(name="ESTADOS", nullable=true) + +/** +* campo para validar la busqueda de las armas, segun los estados seleccionados +*/ +private String estados; + +@Column(name="PIE", nullable=true) + +/** +* Detalle del tramite para el pie del reporte +*/ +private String pie; + +@Column(name="CABECERA", nullable=true) + +/** +* Detalle del tramite para la cabecera del reporte +*/ +private String cabecera; + +@Column(name="DOCUMENTOHABILITANTE", nullable=true) + +/** +* null +*/ +private String documentohabilitante; + +@Column(name="REQUIEREEVALUACION", nullable=true) + +/** +* null +*/ +private String requiereevaluacion; + +@Column(name="CATEGORIACODIGO", nullable=false) + +/** +* null +*/ +private String categoriacodigo; + +@Column(name="TIPOPERSONA", nullable=true) + +/** +* null +*/ +private String tipopersona; + +@Column(name="ESTADOFINARMA", nullable=true) + +/** +* se registra el estado final del arma, al finalizar el tramite seleccionado +*/ +private String estadofinarma; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* null +*/ +private Integer recordversion; + +@Column(name="VIGENCIACODIGO", nullable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String vigenciacodigo; + +@Column(name="VIGENCIA", nullable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String vigencia; + +@Column(name="TIPOTRAMITECODIGO", nullable=false) + +/** +* null +*/ +private String tipotramitecodigo; + +@Column(name="FLUJOTRAMITECODE", nullable=true) + +/** +* null +*/ +private String flujotramitecode; + +@Column(name="REQUIEREINSPECCION", nullable=true) + +/** +* null +*/ +private String requiereinspeccion; + +@Column(name="TIPOARCHIVO", nullable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String tipoarchivo; + +@Column(name="USOACTIVIDAD", nullable=false) + +/** +* null +*/ +private String usoactividad; + +@Column(name="TIPOAUTORIZACION", nullable=false) + +/** +* null +*/ +private String tipoautorizacion; + +@Column(name="CTRAMITEPADRE", nullable=true) + +/** +* codigo del tramite padre +*/ +private Long ctramitepadre; + +@Column(name="CTRAMITEPADREALT", nullable=true) + +/** +* codigo del tramite padre alterno +*/ +private Long ctramitepadrealt; + +@Column(name="USOACTIVIDADCODIGO", nullable=false) + +/** +* null +*/ +private String usoactividadcodigo; + +@Column(name="CATEGORIA", nullable=false) + +/** +* null +*/ +private String categoria; + +@Column(name="TIPOAUTORIZACIONCODIGO", nullable=false) + +/** +* null +*/ +private String tipoautorizacioncodigo; + +@Column(name="LOGO", nullable=true) + +/** +* null +*/ +private String logo; + +@Column(name="COSTO", nullable=true) + +/** +* null +*/ +private BigDecimal costo; + +@Column(name="NUMEROMAXARMAS", nullable=true) + +/** +* campo para validar el numero maximo de armas para el tramite asociado +*/ +private Long numeromaxarmas; + +@Column(name="REIMPRESION", nullable=true) + +/** +* campo para validar si requiere reimpresion +*/ +private String reimpresion; + +@Column(name="FLUJOTRAMITE", nullable=true) + +/** +* null +*/ +private String flujotramite; + +@Column(name="MULTA", nullable=true) + +/** +* Multa asignada al tramite +*/ +private BigDecimal multa; + +@Column(name="REGISTROAGENCIASUCURSAL", nullable=true) + +/** +* null +*/ +private String registroagenciasucursal; + +@Column(name="REGISTROARMAS", nullable=true) + +/** +* null +*/ +private String registroarmas; + +@Column(name="TIPOCOSTOCODIGO", nullable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String tipocostocodigo; + +@Column(name="TIPOCOSTO", nullable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String tipocosto; + +@Column(name="SANCIONABLE", nullable=true) + +/** +* null +*/ +private String sancionable; + +@Column(name="TIPOPERSONACODE", nullable=true) + +/** +* null +*/ +private String tipopersonacode; + +@Column(name="CLASE", nullable=true) + +/** +* campo para validar la busqueda de las armas, segun los estados seleccionados +*/ +private String clase; + +@Column(name="VALIDACADUCIDADPADRE", nullable=true) + +/** +* null +*/ +private String validacaducidadpadre; + + +@Column(name="VALIDACADUCIDADPADREALT", nullable=true) + +/** +* null +*/ +private String validacaducidadpadrealt; + +@Column(name="VALIDAFECHAEXPIRACION", nullable=true) + +/** +* null +*/ +private String validaFechaExpiracion; + +@Column(name="VISUALIZARPORFECHAEXPIRACION", nullable=true) + +/** +* null +*/ +private String visualizarPorFechaExpiracion; + +@Column(name="JURISDICCION", nullable=true) + +/** +* null +*/ +private String jurisdiccion; + +@Column(name="JURISDICCIONCODE", nullable=true) + +/** +* null +*/ +private String jurisdiccioncode; + + +@Column(name="TIPOFABRICACION", nullable=true) + +/** +* null +*/ +private String tipofabricacion; + + +/**Contructor por defecto*/ +public TarmTramite(){ +} +/**Contructor de TarmTramite +@param pPk Clave Primaria del entity +@param pTipoarchivocodigo Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +@param pTipotramite null +@param pCategoriacodigo null +@param pVigenciacodigo Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +@param pVigencia Codigo de catalogo 01 Natural, 02 Juridico +@param pTipotramitecodigo null +@param pTipoarchivo Codigo de catalogo 01 Natural, 02 Juridico +@param pUsoactividad null +@param pTipoautorizacion null +@param pUsoactividadcodigo null +@param pCategoria null +@param pTipoautorizacioncodigo null +@param pTipocostocodigo Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +@param pTipocosto Codigo de catalogo 01 Natural, 02 Juridico +*/ +public TarmTramite(Long pPk,String pTipoarchivocodigo,String pTipotramite,String pCategoriacodigo,String pVigenciacodigo,String pVigencia,String pTipotramitecodigo,String pTipoarchivo,String pUsoactividad,String pTipoautorizacion,String pUsoactividadcodigo,String pCategoria,String pTipoautorizacioncodigo,String pTipocostocodigo,String pTipocosto){ + this(); + pk=pPk; + tipoarchivocodigo=pTipoarchivocodigo; + tipotramite=pTipotramite; + categoriacodigo=pCategoriacodigo; + vigenciacodigo=pVigenciacodigo; + vigencia=pVigencia; + tipotramitecodigo=pTipotramitecodigo; + tipoarchivo=pTipoarchivo; + usoactividad=pUsoactividad; + tipoautorizacion=pTipoautorizacion; + usoactividadcodigo=pUsoactividadcodigo; + categoria=pCategoria; + tipoautorizacioncodigo=pTipoautorizacioncodigo; + tipocostocodigo=pTipocostocodigo; + tipocosto=pTipocosto; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmTramite +*/ +public static TarmTramite find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmTramite obj = pEntityManager.find(TarmTramite.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmTramite +@return El objeto que referencia a la Clave primaria de TarmTramite +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmTramite +@param pPk El objeto que referencia a la nueva Clave primaria de TarmTramite +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de costocustodio +@return valor de costocustodio*/ +public BigDecimal getCostocustodio(){ + return costocustodio; +} +/**Fija el valor de costocustodio +@param pCostocustodio nuevo Valor de costocustodio*/ +public void setCostocustodio(BigDecimal pCostocustodio){ + costocustodio=pCostocustodio; +} + +/**Obtiene el valor de tipoarchivocodigo +@return valor de tipoarchivocodigo*/ +public String getTipoarchivocodigo(){ + return tipoarchivocodigo; +} +/**Fija el valor de tipoarchivocodigo +@param pTipoarchivocodigo nuevo Valor de tipoarchivocodigo*/ +public void setTipoarchivocodigo(String pTipoarchivocodigo){ + tipoarchivocodigo=pTipoarchivocodigo; +} + +/**Obtiene el valor de registroguardia +@return valor de registroguardia*/ +public String getRegistroguardia(){ + return registroguardia; +} +/**Fija el valor de registroguardia +@param pRegistroguardia nuevo Valor de registroguardia*/ +public void setRegistroguardia(String pRegistroguardia){ + registroguardia=pRegistroguardia; +} + +/**Obtiene el valor de tipotramite +@return valor de tipotramite*/ +public String getTipotramite(){ + return tipotramite; +} +/**Fija el valor de tipotramite +@param pTipotramite nuevo Valor de tipotramite*/ +public void setTipotramite(String pTipotramite){ + tipotramite=pTipotramite; +} + +/**Obtiene el valor de estados +@return valor de estados*/ +public String getEstados(){ + return estados; +} +/**Fija el valor de estados +@param pEstados nuevo Valor de estados*/ +public void setEstados(String pEstados){ + estados=pEstados; +} + +/**Obtiene el valor de pie +@return valor de pie*/ +public String getPie(){ + return pie; +} +/**Fija el valor de pie +@param pPie nuevo Valor de pie*/ +public void setPie(String pPie){ + pie=pPie; +} + +/**Obtiene el valor de cabecera +@return valor de cabecera*/ +public String getCabecera(){ + return cabecera; +} +/**Fija el valor de cabecera +@param pCabecera nuevo Valor de cabecera*/ +public void setCabecera(String pCabecera){ + cabecera=pCabecera; +} + +/**Obtiene el valor de documentohabilitante +@return valor de documentohabilitante*/ +public String getDocumentohabilitante(){ + return documentohabilitante; +} +/**Fija el valor de documentohabilitante +@param pDocumentohabilitante nuevo Valor de documentohabilitante*/ +public void setDocumentohabilitante(String pDocumentohabilitante){ + documentohabilitante=pDocumentohabilitante; +} + +/**Obtiene el valor de requiereevaluacion +@return valor de requiereevaluacion*/ +public String getRequiereevaluacion(){ + return requiereevaluacion; +} +/**Fija el valor de requiereevaluacion +@param pRequiereevaluacion nuevo Valor de requiereevaluacion*/ +public void setRequiereevaluacion(String pRequiereevaluacion){ + requiereevaluacion=pRequiereevaluacion; +} + +/**Obtiene el valor de categoriacodigo +@return valor de categoriacodigo*/ +public String getCategoriacodigo(){ + return categoriacodigo; +} +/**Fija el valor de categoriacodigo +@param pCategoriacodigo nuevo Valor de categoriacodigo*/ +public void setCategoriacodigo(String pCategoriacodigo){ + categoriacodigo=pCategoriacodigo; +} + +/**Obtiene el valor de tipopersona +@return valor de tipopersona*/ +public String getTipopersona(){ + return tipopersona; +} +/**Fija el valor de tipopersona +@param pTipopersona nuevo Valor de tipopersona*/ +public void setTipopersona(String pTipopersona){ + tipopersona=pTipopersona; +} + +/**Obtiene el valor de estadofinarma +@return valor de estadofinarma*/ +public String getEstadofinarma(){ + return estadofinarma; +} +/**Fija el valor de estadofinarma +@param pEstadofinarma nuevo Valor de estadofinarma*/ +public void setEstadofinarma(String pEstadofinarma){ + estadofinarma=pEstadofinarma; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de vigenciacodigo +@return valor de vigenciacodigo*/ +public String getVigenciacodigo(){ + return vigenciacodigo; +} +/**Fija el valor de vigenciacodigo +@param pVigenciacodigo nuevo Valor de vigenciacodigo*/ +public void setVigenciacodigo(String pVigenciacodigo){ + vigenciacodigo=pVigenciacodigo; +} + +/**Obtiene el valor de vigencia +@return valor de vigencia*/ +public String getVigencia(){ + return vigencia; +} +/**Fija el valor de vigencia +@param pVigencia nuevo Valor de vigencia*/ +public void setVigencia(String pVigencia){ + vigencia=pVigencia; +} + +/**Obtiene el valor de tipotramitecodigo +@return valor de tipotramitecodigo*/ +public String getTipotramitecodigo(){ + return tipotramitecodigo; +} +/**Fija el valor de tipotramitecodigo +@param pTipotramitecodigo nuevo Valor de tipotramitecodigo*/ +public void setTipotramitecodigo(String pTipotramitecodigo){ + tipotramitecodigo=pTipotramitecodigo; +} + +/**Obtiene el valor de flujotramitecode +@return valor de flujotramitecode*/ +public String getFlujotramitecode(){ + return flujotramitecode; +} +/**Fija el valor de flujotramitecode +@param pFlujotramitecode nuevo Valor de flujotramitecode*/ +public void setFlujotramitecode(String pFlujotramitecode){ + flujotramitecode=pFlujotramitecode; +} + +/**Obtiene el valor de requiereinspeccion +@return valor de requiereinspeccion*/ +public String getRequiereinspeccion(){ + return requiereinspeccion; +} +/**Fija el valor de requiereinspeccion +@param pRequiereinspeccion nuevo Valor de requiereinspeccion*/ +public void setRequiereinspeccion(String pRequiereinspeccion){ + requiereinspeccion=pRequiereinspeccion; +} + +/**Obtiene el valor de tipoarchivo +@return valor de tipoarchivo*/ +public String getTipoarchivo(){ + return tipoarchivo; +} +/**Fija el valor de tipoarchivo +@param pTipoarchivo nuevo Valor de tipoarchivo*/ +public void setTipoarchivo(String pTipoarchivo){ + tipoarchivo=pTipoarchivo; +} + +/**Obtiene el valor de usoactividad +@return valor de usoactividad*/ +public String getUsoactividad(){ + return usoactividad; +} +/**Fija el valor de usoactividad +@param pUsoactividad nuevo Valor de usoactividad*/ +public void setUsoactividad(String pUsoactividad){ + usoactividad=pUsoactividad; +} + +/**Obtiene el valor de tipoautorizacion +@return valor de tipoautorizacion*/ +public String getTipoautorizacion(){ + return tipoautorizacion; +} +/**Fija el valor de tipoautorizacion +@param pTipoautorizacion nuevo Valor de tipoautorizacion*/ +public void setTipoautorizacion(String pTipoautorizacion){ + tipoautorizacion=pTipoautorizacion; +} + +/**Obtiene el valor de ctramitepadre +@return valor de ctramitepadre*/ +public Long getCtramitepadre(){ + return ctramitepadre; +} +/**Fija el valor de ctramitepadre +@param pCtramitepadre nuevo Valor de ctramitepadre*/ +public void setCtramitepadre(Long pCtramitepadre){ + ctramitepadre=pCtramitepadre; +} +/**Obtiene el valor de ctramitepadrealt +@return valor de ctramitepadrealt*/ +public Long getCtramitepadrealt() { + return ctramitepadrealt; +} +/**Fija el valor de ctramitepadrealt +@param pCtramitepadre nuevo Valor de ctramitepadrealt*/ +public void setCtramitepadrealt(Long ctramitepadrealt) { + this.ctramitepadrealt = ctramitepadrealt; +} +/**Obtiene el valor de usoactividadcodigo +@return valor de usoactividadcodigo*/ +public String getUsoactividadcodigo(){ + return usoactividadcodigo; +} +/**Fija el valor de usoactividadcodigo +@param pUsoactividadcodigo nuevo Valor de usoactividadcodigo*/ +public void setUsoactividadcodigo(String pUsoactividadcodigo){ + usoactividadcodigo=pUsoactividadcodigo; +} + +/**Obtiene el valor de categoria +@return valor de categoria*/ +public String getCategoria(){ + return categoria; +} +/**Fija el valor de categoria +@param pCategoria nuevo Valor de categoria*/ +public void setCategoria(String pCategoria){ + categoria=pCategoria; +} + +/**Obtiene el valor de tipoautorizacioncodigo +@return valor de tipoautorizacioncodigo*/ +public String getTipoautorizacioncodigo(){ + return tipoautorizacioncodigo; +} +/**Fija el valor de tipoautorizacioncodigo +@param pTipoautorizacioncodigo nuevo Valor de tipoautorizacioncodigo*/ +public void setTipoautorizacioncodigo(String pTipoautorizacioncodigo){ + tipoautorizacioncodigo=pTipoautorizacioncodigo; +} + +/**Obtiene el valor de logo +@return valor de logo*/ +public String getLogo(){ + return logo; +} +/**Fija el valor de logo +@param pLogo nuevo Valor de logo*/ +public void setLogo(String pLogo){ + logo=pLogo; +} + +/**Obtiene el valor de costo +@return valor de costo*/ +public BigDecimal getCosto(){ + return costo; +} +/**Fija el valor de costo +@param pCosto nuevo Valor de costo*/ +public void setCosto(BigDecimal pCosto){ + costo=pCosto; +} + +/**Obtiene el valor de numeromaxarmas +@return valor de numeromaxarmas*/ +public Long getNumeromaxarmas(){ + return numeromaxarmas; +} +/**Fija el valor de numeromaxarmas +@param pNumeromaxarmas nuevo Valor de numeromaxarmas*/ +public void setNumeromaxarmas(Long pNumeromaxarmas){ + numeromaxarmas=pNumeromaxarmas; +} + +/**Obtiene el valor de reimpresion +@return valor de reimpresion*/ +public String getReimpresion(){ + return reimpresion; +} +/**Fija el valor de reimpresion +@param pReimpresion nuevo Valor de reimpresion*/ +public void setReimpresion(String pReimpresion){ + reimpresion=pReimpresion; +} + +/**Obtiene el valor de flujotramite +@return valor de flujotramite*/ +public String getFlujotramite(){ + return flujotramite; +} +/**Fija el valor de flujotramite +@param pFlujotramite nuevo Valor de flujotramite*/ +public void setFlujotramite(String pFlujotramite){ + flujotramite=pFlujotramite; +} + +/**Obtiene el valor de multa +@return valor de multa*/ +public BigDecimal getMulta(){ + return multa; +} +/**Fija el valor de multa +@param pMulta nuevo Valor de multa*/ +public void setMulta(BigDecimal pMulta){ + multa=pMulta; +} + +/**Obtiene el valor de registroagenciasucursal +@return valor de registroagenciasucursal*/ +public String getRegistroagenciasucursal(){ + return registroagenciasucursal; +} +/**Fija el valor de registroagenciasucursal +@param pRegistroagenciasucursal nuevo Valor de registroagenciasucursal*/ +public void setRegistroagenciasucursal(String pRegistroagenciasucursal){ + registroagenciasucursal=pRegistroagenciasucursal; +} + +/**Obtiene el valor de registroarmas +@return valor de registroarmas*/ +public String getRegistroarmas(){ + return registroarmas; +} +/**Fija el valor de registroarmas +@param pRegistroarmas nuevo Valor de registroarmas*/ +public void setRegistroarmas(String pRegistroarmas){ + registroarmas=pRegistroarmas; +} + +/**Obtiene el valor de tipocostocodigo +@return valor de tipocostocodigo*/ +public String getTipocostocodigo(){ + return tipocostocodigo; +} +/**Fija el valor de tipocostocodigo +@param pTipocostocodigo nuevo Valor de tipocostocodigo*/ +public void setTipocostocodigo(String pTipocostocodigo){ + tipocostocodigo=pTipocostocodigo; +} + +/**Obtiene el valor de tipocosto +@return valor de tipocosto*/ +public String getTipocosto(){ + return tipocosto; +} +/**Fija el valor de tipocosto +@param pTipocosto nuevo Valor de tipocosto*/ +public void setTipocosto(String pTipocosto){ + tipocosto=pTipocosto; +} + +/**Obtiene el valor de sancionable +@return valor de sancionable*/ +public String getSancionable(){ + return sancionable; +} +/**Fija el valor de sancionable +@param pSancionable nuevo Valor de sancionable*/ +public void setSancionable(String pSancionable){ + sancionable=pSancionable; +} + +/**Obtiene el valor de tipopersonacode +@return valor de tipopersonacode*/ +public String getTipopersonacode(){ + return tipopersonacode; +} +/**Fija el valor de tipopersonacode +@param pTipopersonacode nuevo Valor de tipopersonacode*/ +public void setTipopersonacode(String pTipopersonacode){ + tipopersonacode=pTipopersonacode; +} + +public String getClase() { + return clase; +} +public void setClase(String clase) { + this.clase = clase; +} +public String getValidacaducidadpadre() { + return validacaducidadpadre; +} +public void setValidacaducidadpadre(String validacaducidadpadre) { + this.validacaducidadpadre = validacaducidadpadre; +} +public String getValidacaducidadpadrealt() { + return validacaducidadpadrealt; +} +public void setValidacaducidadpadrealt(String validacaducidadpadrealt) { + this.validacaducidadpadrealt = validacaducidadpadrealt; +} + +public String getVisualizarPorFechaExpiracion() { + return visualizarPorFechaExpiracion; +} +public void setVisualizarPorFechaExpiracion(String visualizarPorFechaExpiracion) { + this.visualizarPorFechaExpiracion = visualizarPorFechaExpiracion; +} +public String getValidaFechaExpiracion() { + return validaFechaExpiracion; +} +public void setValidaFechaExpiracion(String validaFechaExpiracion) { + this.validaFechaExpiracion = validaFechaExpiracion; +} + +public String getJurisdiccion() { + return jurisdiccion; +} +public void setJurisdiccion(String jurisdiccion) { + this.jurisdiccion = jurisdiccion; +} + +public String getJurisdiccioncode() { + return jurisdiccioncode; +} +public void setJurisdiccioncode(String jurisdiccioncode) { + this.jurisdiccioncode = jurisdiccioncode; +} +public String getTipofabricacion() { + return tipofabricacion; +} +public void setTipofabricacion(String tipofabricacion) { + this.tipofabricacion = tipofabricacion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmTramite))return false; + TarmTramite that = (TarmTramite) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmTramite +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmTramite +*/ +public Object createInstance(){ + TarmTramite instance=new TarmTramite(); + return instance; +} +/**Clona la entidad TarmTramite +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmTramite p=(TarmTramite)this.clone(); + return p; +} + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmTramite.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmTramite.java.svn-base new file mode 100644 index 0000000..c8132a5 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmTramite.java.svn-base @@ -0,0 +1,958 @@ +package com.fp.persistence.parmas.param; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMTRAMITE*/ +@Entity(name="TarmTramite") +@Table(name="TARMTRAMITE") +public class TarmTramite extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmTramite +*/ +@Id +@Column(name="CTRAMITE" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CTRAMITE"), + @Parameter(name = "type", value = "java.lang.Long"), + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "16")}) + @GeneratedValue(generator = "seq_id") +private Long pk; +@Column(name="COSTOCUSTODIO", nullable=true) + +/** +* Costo de cada custodio segun el tramite +*/ +private BigDecimal costocustodio; + +@Column(name="TIPOARCHIVOCODIGO", nullable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String tipoarchivocodigo; + +@Column(name="REGISTROGUARDIA", nullable=true) + +/** +* null +*/ +private String registroguardia; + +@Column(name="TIPOTRAMITE", nullable=false) + +/** +* null +*/ +private String tipotramite; + +@Column(name="ESTADOS", nullable=true) + +/** +* campo para validar la busqueda de las armas, segun los estados seleccionados +*/ +private String estados; + +@Column(name="PIE", nullable=true) + +/** +* Detalle del tramite para el pie del reporte +*/ +private String pie; + +@Column(name="CABECERA", nullable=true) + +/** +* Detalle del tramite para la cabecera del reporte +*/ +private String cabecera; + +@Column(name="DOCUMENTOHABILITANTE", nullable=true) + +/** +* null +*/ +private String documentohabilitante; + +@Column(name="REQUIEREEVALUACION", nullable=true) + +/** +* null +*/ +private String requiereevaluacion; + +@Column(name="CATEGORIACODIGO", nullable=false) + +/** +* null +*/ +private String categoriacodigo; + +@Column(name="TIPOPERSONA", nullable=true) + +/** +* null +*/ +private String tipopersona; + +@Column(name="ESTADOFINARMA", nullable=true) + +/** +* se registra el estado final del arma, al finalizar el tramite seleccionado +*/ +private String estadofinarma; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* null +*/ +private Integer recordversion; + +@Column(name="VIGENCIACODIGO", nullable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String vigenciacodigo; + +@Column(name="VIGENCIA", nullable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String vigencia; + +@Column(name="TIPOTRAMITECODIGO", nullable=false) + +/** +* null +*/ +private String tipotramitecodigo; + +@Column(name="FLUJOTRAMITECODE", nullable=true) + +/** +* null +*/ +private String flujotramitecode; + +@Column(name="REQUIEREINSPECCION", nullable=true) + +/** +* null +*/ +private String requiereinspeccion; + +@Column(name="TIPOARCHIVO", nullable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String tipoarchivo; + +@Column(name="USOACTIVIDAD", nullable=false) + +/** +* null +*/ +private String usoactividad; + +@Column(name="TIPOAUTORIZACION", nullable=false) + +/** +* null +*/ +private String tipoautorizacion; + +@Column(name="CTRAMITEPADRE", nullable=true) + +/** +* codigo del tramite padre +*/ +private Long ctramitepadre; + +@Column(name="CTRAMITEPADREALT", nullable=true) + +/** +* codigo del tramite padre alterno +*/ +private Long ctramitepadrealt; + +@Column(name="USOACTIVIDADCODIGO", nullable=false) + +/** +* null +*/ +private String usoactividadcodigo; + +@Column(name="CATEGORIA", nullable=false) + +/** +* null +*/ +private String categoria; + +@Column(name="TIPOAUTORIZACIONCODIGO", nullable=false) + +/** +* null +*/ +private String tipoautorizacioncodigo; + +@Column(name="LOGO", nullable=true) + +/** +* null +*/ +private String logo; + +@Column(name="COSTO", nullable=true) + +/** +* null +*/ +private BigDecimal costo; + +@Column(name="NUMEROMAXARMAS", nullable=true) + +/** +* campo para validar el numero maximo de armas para el tramite asociado +*/ +private Long numeromaxarmas; + +@Column(name="REIMPRESION", nullable=true) + +/** +* campo para validar si requiere reimpresion +*/ +private String reimpresion; + +@Column(name="FLUJOTRAMITE", nullable=true) + +/** +* null +*/ +private String flujotramite; + +@Column(name="MULTA", nullable=true) + +/** +* Multa asignada al tramite +*/ +private BigDecimal multa; + +@Column(name="REGISTROAGENCIASUCURSAL", nullable=true) + +/** +* null +*/ +private String registroagenciasucursal; + +@Column(name="REGISTROARMAS", nullable=true) + +/** +* null +*/ +private String registroarmas; + +@Column(name="TIPOCOSTOCODIGO", nullable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String tipocostocodigo; + +@Column(name="TIPOCOSTO", nullable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String tipocosto; + +@Column(name="SANCIONABLE", nullable=true) + +/** +* null +*/ +private String sancionable; + +@Column(name="TIPOPERSONACODE", nullable=true) + +/** +* null +*/ +private String tipopersonacode; + +@Column(name="CLASE", nullable=true) + +/** +* campo para validar la busqueda de las armas, segun los estados seleccionados +*/ +private String clase; + +@Column(name="VALIDACADUCIDADPADRE", nullable=true) + +/** +* null +*/ +private String validacaducidadpadre; + + +@Column(name="VALIDACADUCIDADPADREALT", nullable=true) + +/** +* null +*/ +private String validacaducidadpadrealt; + +@Column(name="VALIDAFECHAEXPIRACION", nullable=true) + +/** +* null +*/ +private String validaFechaExpiracion; + +@Column(name="VISUALIZARPORFECHAEXPIRACION", nullable=true) + +/** +* null +*/ +private String visualizarPorFechaExpiracion; + +@Column(name="JURISDICCION", nullable=true) + +/** +* null +*/ +private String jurisdiccion; + +@Column(name="JURISDICCIONCODE", nullable=true) + +/** +* null +*/ +private String jurisdiccioncode; + + +@Column(name="TIPOFABRICACION", nullable=true) + +/** +* null +*/ +private String tipofabricacion; + + +/**Contructor por defecto*/ +public TarmTramite(){ +} +/**Contructor de TarmTramite +@param pPk Clave Primaria del entity +@param pTipoarchivocodigo Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +@param pTipotramite null +@param pCategoriacodigo null +@param pVigenciacodigo Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +@param pVigencia Codigo de catalogo 01 Natural, 02 Juridico +@param pTipotramitecodigo null +@param pTipoarchivo Codigo de catalogo 01 Natural, 02 Juridico +@param pUsoactividad null +@param pTipoautorizacion null +@param pUsoactividadcodigo null +@param pCategoria null +@param pTipoautorizacioncodigo null +@param pTipocostocodigo Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +@param pTipocosto Codigo de catalogo 01 Natural, 02 Juridico +*/ +public TarmTramite(Long pPk,String pTipoarchivocodigo,String pTipotramite,String pCategoriacodigo,String pVigenciacodigo,String pVigencia,String pTipotramitecodigo,String pTipoarchivo,String pUsoactividad,String pTipoautorizacion,String pUsoactividadcodigo,String pCategoria,String pTipoautorizacioncodigo,String pTipocostocodigo,String pTipocosto){ + this(); + pk=pPk; + tipoarchivocodigo=pTipoarchivocodigo; + tipotramite=pTipotramite; + categoriacodigo=pCategoriacodigo; + vigenciacodigo=pVigenciacodigo; + vigencia=pVigencia; + tipotramitecodigo=pTipotramitecodigo; + tipoarchivo=pTipoarchivo; + usoactividad=pUsoactividad; + tipoautorizacion=pTipoautorizacion; + usoactividadcodigo=pUsoactividadcodigo; + categoria=pCategoria; + tipoautorizacioncodigo=pTipoautorizacioncodigo; + tipocostocodigo=pTipocostocodigo; + tipocosto=pTipocosto; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmTramite +*/ +public static TarmTramite find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmTramite obj = pEntityManager.find(TarmTramite.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmTramite +@return El objeto que referencia a la Clave primaria de TarmTramite +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmTramite +@param pPk El objeto que referencia a la nueva Clave primaria de TarmTramite +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de costocustodio +@return valor de costocustodio*/ +public BigDecimal getCostocustodio(){ + return costocustodio; +} +/**Fija el valor de costocustodio +@param pCostocustodio nuevo Valor de costocustodio*/ +public void setCostocustodio(BigDecimal pCostocustodio){ + costocustodio=pCostocustodio; +} + +/**Obtiene el valor de tipoarchivocodigo +@return valor de tipoarchivocodigo*/ +public String getTipoarchivocodigo(){ + return tipoarchivocodigo; +} +/**Fija el valor de tipoarchivocodigo +@param pTipoarchivocodigo nuevo Valor de tipoarchivocodigo*/ +public void setTipoarchivocodigo(String pTipoarchivocodigo){ + tipoarchivocodigo=pTipoarchivocodigo; +} + +/**Obtiene el valor de registroguardia +@return valor de registroguardia*/ +public String getRegistroguardia(){ + return registroguardia; +} +/**Fija el valor de registroguardia +@param pRegistroguardia nuevo Valor de registroguardia*/ +public void setRegistroguardia(String pRegistroguardia){ + registroguardia=pRegistroguardia; +} + +/**Obtiene el valor de tipotramite +@return valor de tipotramite*/ +public String getTipotramite(){ + return tipotramite; +} +/**Fija el valor de tipotramite +@param pTipotramite nuevo Valor de tipotramite*/ +public void setTipotramite(String pTipotramite){ + tipotramite=pTipotramite; +} + +/**Obtiene el valor de estados +@return valor de estados*/ +public String getEstados(){ + return estados; +} +/**Fija el valor de estados +@param pEstados nuevo Valor de estados*/ +public void setEstados(String pEstados){ + estados=pEstados; +} + +/**Obtiene el valor de pie +@return valor de pie*/ +public String getPie(){ + return pie; +} +/**Fija el valor de pie +@param pPie nuevo Valor de pie*/ +public void setPie(String pPie){ + pie=pPie; +} + +/**Obtiene el valor de cabecera +@return valor de cabecera*/ +public String getCabecera(){ + return cabecera; +} +/**Fija el valor de cabecera +@param pCabecera nuevo Valor de cabecera*/ +public void setCabecera(String pCabecera){ + cabecera=pCabecera; +} + +/**Obtiene el valor de documentohabilitante +@return valor de documentohabilitante*/ +public String getDocumentohabilitante(){ + return documentohabilitante; +} +/**Fija el valor de documentohabilitante +@param pDocumentohabilitante nuevo Valor de documentohabilitante*/ +public void setDocumentohabilitante(String pDocumentohabilitante){ + documentohabilitante=pDocumentohabilitante; +} + +/**Obtiene el valor de requiereevaluacion +@return valor de requiereevaluacion*/ +public String getRequiereevaluacion(){ + return requiereevaluacion; +} +/**Fija el valor de requiereevaluacion +@param pRequiereevaluacion nuevo Valor de requiereevaluacion*/ +public void setRequiereevaluacion(String pRequiereevaluacion){ + requiereevaluacion=pRequiereevaluacion; +} + +/**Obtiene el valor de categoriacodigo +@return valor de categoriacodigo*/ +public String getCategoriacodigo(){ + return categoriacodigo; +} +/**Fija el valor de categoriacodigo +@param pCategoriacodigo nuevo Valor de categoriacodigo*/ +public void setCategoriacodigo(String pCategoriacodigo){ + categoriacodigo=pCategoriacodigo; +} + +/**Obtiene el valor de tipopersona +@return valor de tipopersona*/ +public String getTipopersona(){ + return tipopersona; +} +/**Fija el valor de tipopersona +@param pTipopersona nuevo Valor de tipopersona*/ +public void setTipopersona(String pTipopersona){ + tipopersona=pTipopersona; +} + +/**Obtiene el valor de estadofinarma +@return valor de estadofinarma*/ +public String getEstadofinarma(){ + return estadofinarma; +} +/**Fija el valor de estadofinarma +@param pEstadofinarma nuevo Valor de estadofinarma*/ +public void setEstadofinarma(String pEstadofinarma){ + estadofinarma=pEstadofinarma; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de vigenciacodigo +@return valor de vigenciacodigo*/ +public String getVigenciacodigo(){ + return vigenciacodigo; +} +/**Fija el valor de vigenciacodigo +@param pVigenciacodigo nuevo Valor de vigenciacodigo*/ +public void setVigenciacodigo(String pVigenciacodigo){ + vigenciacodigo=pVigenciacodigo; +} + +/**Obtiene el valor de vigencia +@return valor de vigencia*/ +public String getVigencia(){ + return vigencia; +} +/**Fija el valor de vigencia +@param pVigencia nuevo Valor de vigencia*/ +public void setVigencia(String pVigencia){ + vigencia=pVigencia; +} + +/**Obtiene el valor de tipotramitecodigo +@return valor de tipotramitecodigo*/ +public String getTipotramitecodigo(){ + return tipotramitecodigo; +} +/**Fija el valor de tipotramitecodigo +@param pTipotramitecodigo nuevo Valor de tipotramitecodigo*/ +public void setTipotramitecodigo(String pTipotramitecodigo){ + tipotramitecodigo=pTipotramitecodigo; +} + +/**Obtiene el valor de flujotramitecode +@return valor de flujotramitecode*/ +public String getFlujotramitecode(){ + return flujotramitecode; +} +/**Fija el valor de flujotramitecode +@param pFlujotramitecode nuevo Valor de flujotramitecode*/ +public void setFlujotramitecode(String pFlujotramitecode){ + flujotramitecode=pFlujotramitecode; +} + +/**Obtiene el valor de requiereinspeccion +@return valor de requiereinspeccion*/ +public String getRequiereinspeccion(){ + return requiereinspeccion; +} +/**Fija el valor de requiereinspeccion +@param pRequiereinspeccion nuevo Valor de requiereinspeccion*/ +public void setRequiereinspeccion(String pRequiereinspeccion){ + requiereinspeccion=pRequiereinspeccion; +} + +/**Obtiene el valor de tipoarchivo +@return valor de tipoarchivo*/ +public String getTipoarchivo(){ + return tipoarchivo; +} +/**Fija el valor de tipoarchivo +@param pTipoarchivo nuevo Valor de tipoarchivo*/ +public void setTipoarchivo(String pTipoarchivo){ + tipoarchivo=pTipoarchivo; +} + +/**Obtiene el valor de usoactividad +@return valor de usoactividad*/ +public String getUsoactividad(){ + return usoactividad; +} +/**Fija el valor de usoactividad +@param pUsoactividad nuevo Valor de usoactividad*/ +public void setUsoactividad(String pUsoactividad){ + usoactividad=pUsoactividad; +} + +/**Obtiene el valor de tipoautorizacion +@return valor de tipoautorizacion*/ +public String getTipoautorizacion(){ + return tipoautorizacion; +} +/**Fija el valor de tipoautorizacion +@param pTipoautorizacion nuevo Valor de tipoautorizacion*/ +public void setTipoautorizacion(String pTipoautorizacion){ + tipoautorizacion=pTipoautorizacion; +} + +/**Obtiene el valor de ctramitepadre +@return valor de ctramitepadre*/ +public Long getCtramitepadre(){ + return ctramitepadre; +} +/**Fija el valor de ctramitepadre +@param pCtramitepadre nuevo Valor de ctramitepadre*/ +public void setCtramitepadre(Long pCtramitepadre){ + ctramitepadre=pCtramitepadre; +} +/**Obtiene el valor de ctramitepadrealt +@return valor de ctramitepadrealt*/ +public Long getCtramitepadrealt() { + return ctramitepadrealt; +} +/**Fija el valor de ctramitepadrealt +@param pCtramitepadre nuevo Valor de ctramitepadrealt*/ +public void setCtramitepadrealt(Long ctramitepadrealt) { + this.ctramitepadrealt = ctramitepadrealt; +} +/**Obtiene el valor de usoactividadcodigo +@return valor de usoactividadcodigo*/ +public String getUsoactividadcodigo(){ + return usoactividadcodigo; +} +/**Fija el valor de usoactividadcodigo +@param pUsoactividadcodigo nuevo Valor de usoactividadcodigo*/ +public void setUsoactividadcodigo(String pUsoactividadcodigo){ + usoactividadcodigo=pUsoactividadcodigo; +} + +/**Obtiene el valor de categoria +@return valor de categoria*/ +public String getCategoria(){ + return categoria; +} +/**Fija el valor de categoria +@param pCategoria nuevo Valor de categoria*/ +public void setCategoria(String pCategoria){ + categoria=pCategoria; +} + +/**Obtiene el valor de tipoautorizacioncodigo +@return valor de tipoautorizacioncodigo*/ +public String getTipoautorizacioncodigo(){ + return tipoautorizacioncodigo; +} +/**Fija el valor de tipoautorizacioncodigo +@param pTipoautorizacioncodigo nuevo Valor de tipoautorizacioncodigo*/ +public void setTipoautorizacioncodigo(String pTipoautorizacioncodigo){ + tipoautorizacioncodigo=pTipoautorizacioncodigo; +} + +/**Obtiene el valor de logo +@return valor de logo*/ +public String getLogo(){ + return logo; +} +/**Fija el valor de logo +@param pLogo nuevo Valor de logo*/ +public void setLogo(String pLogo){ + logo=pLogo; +} + +/**Obtiene el valor de costo +@return valor de costo*/ +public BigDecimal getCosto(){ + return costo; +} +/**Fija el valor de costo +@param pCosto nuevo Valor de costo*/ +public void setCosto(BigDecimal pCosto){ + costo=pCosto; +} + +/**Obtiene el valor de numeromaxarmas +@return valor de numeromaxarmas*/ +public Long getNumeromaxarmas(){ + return numeromaxarmas; +} +/**Fija el valor de numeromaxarmas +@param pNumeromaxarmas nuevo Valor de numeromaxarmas*/ +public void setNumeromaxarmas(Long pNumeromaxarmas){ + numeromaxarmas=pNumeromaxarmas; +} + +/**Obtiene el valor de reimpresion +@return valor de reimpresion*/ +public String getReimpresion(){ + return reimpresion; +} +/**Fija el valor de reimpresion +@param pReimpresion nuevo Valor de reimpresion*/ +public void setReimpresion(String pReimpresion){ + reimpresion=pReimpresion; +} + +/**Obtiene el valor de flujotramite +@return valor de flujotramite*/ +public String getFlujotramite(){ + return flujotramite; +} +/**Fija el valor de flujotramite +@param pFlujotramite nuevo Valor de flujotramite*/ +public void setFlujotramite(String pFlujotramite){ + flujotramite=pFlujotramite; +} + +/**Obtiene el valor de multa +@return valor de multa*/ +public BigDecimal getMulta(){ + return multa; +} +/**Fija el valor de multa +@param pMulta nuevo Valor de multa*/ +public void setMulta(BigDecimal pMulta){ + multa=pMulta; +} + +/**Obtiene el valor de registroagenciasucursal +@return valor de registroagenciasucursal*/ +public String getRegistroagenciasucursal(){ + return registroagenciasucursal; +} +/**Fija el valor de registroagenciasucursal +@param pRegistroagenciasucursal nuevo Valor de registroagenciasucursal*/ +public void setRegistroagenciasucursal(String pRegistroagenciasucursal){ + registroagenciasucursal=pRegistroagenciasucursal; +} + +/**Obtiene el valor de registroarmas +@return valor de registroarmas*/ +public String getRegistroarmas(){ + return registroarmas; +} +/**Fija el valor de registroarmas +@param pRegistroarmas nuevo Valor de registroarmas*/ +public void setRegistroarmas(String pRegistroarmas){ + registroarmas=pRegistroarmas; +} + +/**Obtiene el valor de tipocostocodigo +@return valor de tipocostocodigo*/ +public String getTipocostocodigo(){ + return tipocostocodigo; +} +/**Fija el valor de tipocostocodigo +@param pTipocostocodigo nuevo Valor de tipocostocodigo*/ +public void setTipocostocodigo(String pTipocostocodigo){ + tipocostocodigo=pTipocostocodigo; +} + +/**Obtiene el valor de tipocosto +@return valor de tipocosto*/ +public String getTipocosto(){ + return tipocosto; +} +/**Fija el valor de tipocosto +@param pTipocosto nuevo Valor de tipocosto*/ +public void setTipocosto(String pTipocosto){ + tipocosto=pTipocosto; +} + +/**Obtiene el valor de sancionable +@return valor de sancionable*/ +public String getSancionable(){ + return sancionable; +} +/**Fija el valor de sancionable +@param pSancionable nuevo Valor de sancionable*/ +public void setSancionable(String pSancionable){ + sancionable=pSancionable; +} + +/**Obtiene el valor de tipopersonacode +@return valor de tipopersonacode*/ +public String getTipopersonacode(){ + return tipopersonacode; +} +/**Fija el valor de tipopersonacode +@param pTipopersonacode nuevo Valor de tipopersonacode*/ +public void setTipopersonacode(String pTipopersonacode){ + tipopersonacode=pTipopersonacode; +} + +public String getClase() { + return clase; +} +public void setClase(String clase) { + this.clase = clase; +} +public String getValidacaducidadpadre() { + return validacaducidadpadre; +} +public void setValidacaducidadpadre(String validacaducidadpadre) { + this.validacaducidadpadre = validacaducidadpadre; +} +public String getValidacaducidadpadrealt() { + return validacaducidadpadrealt; +} +public void setValidacaducidadpadrealt(String validacaducidadpadrealt) { + this.validacaducidadpadrealt = validacaducidadpadrealt; +} + +public String getVisualizarPorFechaExpiracion() { + return visualizarPorFechaExpiracion; +} +public void setVisualizarPorFechaExpiracion(String visualizarPorFechaExpiracion) { + this.visualizarPorFechaExpiracion = visualizarPorFechaExpiracion; +} +public String getValidaFechaExpiracion() { + return validaFechaExpiracion; +} +public void setValidaFechaExpiracion(String validaFechaExpiracion) { + this.validaFechaExpiracion = validaFechaExpiracion; +} + +public String getJurisdiccion() { + return jurisdiccion; +} +public void setJurisdiccion(String jurisdiccion) { + this.jurisdiccion = jurisdiccion; +} + +public String getJurisdiccioncode() { + return jurisdiccioncode; +} +public void setJurisdiccioncode(String jurisdiccioncode) { + this.jurisdiccioncode = jurisdiccioncode; +} +public String getTipofabricacion() { + return tipofabricacion; +} +public void setTipofabricacion(String tipofabricacion) { + this.tipofabricacion = tipofabricacion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmTramite))return false; + TarmTramite that = (TarmTramite) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmTramite +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmTramite +*/ +public Object createInstance(){ + TarmTramite instance=new TarmTramite(); + return instance; +} +/**Clona la entidad TarmTramite +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmTramite p=(TarmTramite)this.clone(); + return p; +} + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmTramitesAtendidos.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmTramitesAtendidos.java.svn-base new file mode 100644 index 0000000..9886c06 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmTramitesAtendidos.java.svn-base @@ -0,0 +1,214 @@ +package com.fp.persistence.parmas.param; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMTRAMITESATENDIDOS*/ +@Entity(name="TarmTramitesAtendidos") +@Table(name="TARMTRAMITESATENDIDOS") +public class TarmTramitesAtendidos extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmTramitesAtendidos +*/ +@Id +@Column(name="CTRAMITEATENDIDO" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CTRAMITEATENDIDO"), + @Parameter(name = "type", value = "java.lang.Long"), + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "16")}) + @GeneratedValue(generator = "seq_id") +private Long pk; +@Column(name="CCENTROCONTROL", nullable=false) + +/** +* Clave foranea del centro de control referido +*/ +private String ccentrocontrol; + +@Column(name="CTRAMITE", nullable=false) + +/** +* Clave foranea del codio de tramite referido +*/ +private Long ctramite; + +@Column(name="FECHAREGISTRO", nullable=false) + +/** +* Fecha en que se ingresa el registro +*/ +private Date fecharegistro; + +@Column(name="FECHAATENCION", nullable=false) + +/** +* Fecha programada para la tencion del tramite por el centro de control +*/ +private Date fechaatencion; + +/**Contructor por defecto*/ +public TarmTramitesAtendidos(){ +} +/**Contructor de TarmTramitesAtendidos +@param pPk Clave Primaria del entity +@param pCcentrocontrol Clave foranea del centro de control referido +@param pCtramite Clave foranea del codio de tramite referido +@param pFecharegistro Fecha en que se ingresa el registro +@param pFechaatencion Fecha programada para la tencion del tramite por el centro de control +*/ +public TarmTramitesAtendidos(Long pPk,String pCcentrocontrol,Long pCtramite,Date pFecharegistro,Date pFechaatencion){ + this(); + pk=pPk; + ccentrocontrol=pCcentrocontrol; + ctramite=pCtramite; + fecharegistro=pFecharegistro; + fechaatencion=pFechaatencion; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmTramitesAtendidos +*/ +public static TarmTramitesAtendidos find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmTramitesAtendidos obj = pEntityManager.find(TarmTramitesAtendidos.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmTramitesAtendidos +@return El objeto que referencia a la Clave primaria de TarmTramitesAtendidos +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmTramitesAtendidos +@param pPk El objeto que referencia a la nueva Clave primaria de TarmTramitesAtendidos +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de ccentrocontrol +@return valor de ccentrocontrol*/ +public String getCcentrocontrol(){ + return ccentrocontrol; +} +/**Fija el valor de ccentrocontrol +@param pCcentrocontrol nuevo Valor de ccentrocontrol*/ +public void setCcentrocontrol(String pCcentrocontrol){ + ccentrocontrol=pCcentrocontrol; +} + +/**Obtiene el valor de ctramite +@return valor de ctramite*/ +public Long getCtramite(){ + return ctramite; +} +/**Fija el valor de ctramite +@param pCtramite nuevo Valor de ctramite*/ +public void setCtramite(Long pCtramite){ + ctramite=pCtramite; +} + +/**Obtiene el valor de fecharegistro +@return valor de fecharegistro*/ +public Date getFecharegistro(){ + return fecharegistro; +} +/**Fija el valor de fecharegistro +@param pFecharegistro nuevo Valor de fecharegistro*/ +public void setFecharegistro(Date pFecharegistro){ + fecharegistro=pFecharegistro; +} + +/**Obtiene el valor de fechaatencion +@return valor de fechaatencion*/ +public Date getFechaatencion(){ + return fechaatencion; +} +/**Fija el valor de fechaatencion +@param pFechaatencion nuevo Valor de fechaatencion*/ +public void setFechaatencion(Date pFechaatencion){ + fechaatencion=pFechaatencion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmTramitesAtendidos))return false; + TarmTramitesAtendidos that = (TarmTramitesAtendidos) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmTramitesAtendidos +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmTramitesAtendidos +*/ +public Object createInstance(){ + TarmTramitesAtendidos instance=new TarmTramitesAtendidos(); + return instance; +} +/**Clona la entidad TarmTramitesAtendidos +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmTramitesAtendidos p=(TarmTramitesAtendidos)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmUnidadTipo.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmUnidadTipo.java.svn-base new file mode 100644 index 0000000..598ea45 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmUnidadTipo.java.svn-base @@ -0,0 +1,168 @@ +package com.fp.persistence.parmas.param; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMUNIDADTIPO*/ +@Entity(name="TarmUnidadTipo") +@Table(name="TARMUNIDADTIPO") +public class TarmUnidadTipo extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmUnidadTipo +*/ +@EmbeddedId +private TarmUnidadTipoKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Versin del Registro +*/ +private Integer recordversion; + +@Column(name="FECHAREGISTRO", nullable=true) + +/** +* Fecha de Registro +*/ +private Date fecharegistro; + +/**Contructor por defecto*/ +public TarmUnidadTipo(){ +} +/**Contructor de TarmUnidadTipo +@param pPk Clave Primaria del entity +*/ +public TarmUnidadTipo(TarmUnidadTipoKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmUnidadTipo +*/ +public static TarmUnidadTipo find(EntityManager pEntityManager,TarmUnidadTipoKey pKey) throws Exception{ + TarmUnidadTipo obj = pEntityManager.find(TarmUnidadTipo.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmUnidadTipo +@return El objeto que referencia a la Clave primaria de TarmUnidadTipo +*/ +public TarmUnidadTipoKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmUnidadTipo +@param pPk El objeto que referencia a la nueva Clave primaria de TarmUnidadTipo +*/ +public void setPk(TarmUnidadTipoKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de fecharegistro +@return valor de fecharegistro*/ +public Date getFecharegistro(){ + return fecharegistro; +} +/**Fija el valor de fecharegistro +@param pFecharegistro nuevo Valor de fecharegistro*/ +public void setFecharegistro(Date pFecharegistro){ + fecharegistro=pFecharegistro; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmUnidadTipo))return false; + TarmUnidadTipo that = (TarmUnidadTipo) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmUnidadTipo +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmUnidadTipo +*/ +public Object createInstance(){ + TarmUnidadTipo instance=new TarmUnidadTipo(); + instance.setPk(new TarmUnidadTipoKey()); + return instance; +} +/**Clona la entidad TarmUnidadTipo +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmUnidadTipo p=(TarmUnidadTipo)this.clone(); + p.setPk((TarmUnidadTipoKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmUnidadTipoKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmUnidadTipoKey.java.svn-base new file mode 100644 index 0000000..30c9abc --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/.svn/text-base/TarmUnidadTipoKey.java.svn-base @@ -0,0 +1,234 @@ +package com.fp.persistence.parmas.param; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMUNIDADTIPO*/ +@Embeddable +public class TarmUnidadTipoKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CLASE", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Explosivo, 02 Arma de Fuego +*/ +private String clase; + +@Column(name="CLASECODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de clase de arma +*/ +private String clasecode; + +@Column(name="TIPOARMAEXPLOSIVO", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Revolver, 02 Polvora +*/ +private String tipoarmaexplosivo; + +@Column(name="TIPOARMAEXPLOSIVOCODIGO", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de armaexplosivo +*/ +private String tipoarmaexplosivocodigo; + +@Column(name="UNIDADMEDIDAPESO", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 KG, 02 Unidad +*/ +private String unidadmedidapeso; + +@Column(name="UNIDADMEDIDAPESOCODIGO", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de unidad peso + +*/ +private String unidadmedidapesocodigo; + +/**Contructor por defecto*/ +public TarmUnidadTipoKey(){} +/**Contructor de TarmUnidadTipoKey +@param pClase Codigo de catalogo 01 Explosivo, 02 Arma de Fuego +@param pClasecode Codigo de tabla de catalogo 01 Codigo de tabla de clase de arma +@param pTipoarmaexplosivo Codigo de catalogo 01 Revolver, 02 Polvora +@param pTipoarmaexplosivocodigo Codigo de tabla de catalogo 01 Codigo de tabla de tipos de armaexplosivo +@param pUnidadmedidapeso Codigo de catalogo 01 KG, 02 Unidad +@param pUnidadmedidapesocodigo Codigo de tabla de catalogo 01 Codigo de tabla de tipos de unidad peso + +*/ +public TarmUnidadTipoKey(String pClase,String pClasecode,String pTipoarmaexplosivo,String pTipoarmaexplosivocodigo,String pUnidadmedidapeso,String pUnidadmedidapesocodigo){ + clase=pClase; + clasecode=pClasecode; + tipoarmaexplosivo=pTipoarmaexplosivo; + tipoarmaexplosivocodigo=pTipoarmaexplosivocodigo; + unidadmedidapeso=pUnidadmedidapeso; + unidadmedidapesocodigo=pUnidadmedidapesocodigo; +} +/**Obtiene el valor de clase +@return valor de clase*/ +public String getClase(){ + return clase; +} +/**Fija el valor de clase +@param pClase nuevo Valor de clase*/ +public void setClase(String pClase){ + clase=pClase; +} + +/**Obtiene el valor de clasecode +@return valor de clasecode*/ +public String getClasecode(){ + return clasecode; +} +/**Fija el valor de clasecode +@param pClasecode nuevo Valor de clasecode*/ +public void setClasecode(String pClasecode){ + clasecode=pClasecode; +} + +/**Obtiene el valor de tipoarmaexplosivo +@return valor de tipoarmaexplosivo*/ +public String getTipoarmaexplosivo(){ + return tipoarmaexplosivo; +} +/**Fija el valor de tipoarmaexplosivo +@param pTipoarmaexplosivo nuevo Valor de tipoarmaexplosivo*/ +public void setTipoarmaexplosivo(String pTipoarmaexplosivo){ + tipoarmaexplosivo=pTipoarmaexplosivo; +} + +/**Obtiene el valor de tipoarmaexplosivocodigo +@return valor de tipoarmaexplosivocodigo*/ +public String getTipoarmaexplosivocodigo(){ + return tipoarmaexplosivocodigo; +} +/**Fija el valor de tipoarmaexplosivocodigo +@param pTipoarmaexplosivocodigo nuevo Valor de tipoarmaexplosivocodigo*/ +public void setTipoarmaexplosivocodigo(String pTipoarmaexplosivocodigo){ + tipoarmaexplosivocodigo=pTipoarmaexplosivocodigo; +} + +/**Obtiene el valor de unidadmedidapeso +@return valor de unidadmedidapeso*/ +public String getUnidadmedidapeso(){ + return unidadmedidapeso; +} +/**Fija el valor de unidadmedidapeso +@param pUnidadmedidapeso nuevo Valor de unidadmedidapeso*/ +public void setUnidadmedidapeso(String pUnidadmedidapeso){ + unidadmedidapeso=pUnidadmedidapeso; +} + +/**Obtiene el valor de unidadmedidapesocodigo +@return valor de unidadmedidapesocodigo*/ +public String getUnidadmedidapesocodigo(){ + return unidadmedidapesocodigo; +} +/**Fija el valor de unidadmedidapesocodigo +@param pUnidadmedidapesocodigo nuevo Valor de unidadmedidapesocodigo*/ +public void setUnidadmedidapesocodigo(String pUnidadmedidapesocodigo){ + unidadmedidapesocodigo=pUnidadmedidapesocodigo; +} + +/**Implementacion de la comparacion de TarmUnidadTipoKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmUnidadTipoKey))return false; + TarmUnidadTipoKey that = (TarmUnidadTipoKey) o; + if (this.getClase() == null || that.getClase() == null){ + return false; + } + if (! this.getClase().equals(that.getClase())){ + return false; + } + if (this.getClasecode() == null || that.getClasecode() == null){ + return false; + } + if (! this.getClasecode().equals(that.getClasecode())){ + return false; + } + if (this.getTipoarmaexplosivo() == null || that.getTipoarmaexplosivo() == null){ + return false; + } + if (! this.getTipoarmaexplosivo().equals(that.getTipoarmaexplosivo())){ + return false; + } + if (this.getTipoarmaexplosivocodigo() == null || that.getTipoarmaexplosivocodigo() == null){ + return false; + } + if (! this.getTipoarmaexplosivocodigo().equals(that.getTipoarmaexplosivocodigo())){ + return false; + } + if (this.getUnidadmedidapeso() == null || that.getUnidadmedidapeso() == null){ + return false; + } + if (! this.getUnidadmedidapeso().equals(that.getUnidadmedidapeso())){ + return false; + } + if (this.getUnidadmedidapesocodigo() == null || that.getUnidadmedidapesocodigo() == null){ + return false; + } + if (! this.getUnidadmedidapesocodigo().equals(that.getUnidadmedidapesocodigo())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmUnidadTipoKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getClase() == null ? 0 : this.getClase().hashCode()); + result = result * 37 + (this.getClasecode() == null ? 0 : this.getClasecode().hashCode()); + result = result * 37 + (this.getTipoarmaexplosivo() == null ? 0 : this.getTipoarmaexplosivo().hashCode()); + result = result * 37 + (this.getTipoarmaexplosivocodigo() == null ? 0 : this.getTipoarmaexplosivocodigo().hashCode()); + result = result * 37 + (this.getUnidadmedidapeso() == null ? 0 : this.getUnidadmedidapeso().hashCode()); + result = result * 37 + (this.getUnidadmedidapesocodigo() == null ? 0 : this.getUnidadmedidapesocodigo().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmCentroControl.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmCentroControl.java new file mode 100644 index 0000000..fc6dc89 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmCentroControl.java @@ -0,0 +1,652 @@ +package com.fp.persistence.parmas.param; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMCENTROCONTROL + */ +@Entity(name = "TarmCentroControl") +@Table(name = "TARMCENTROCONTROL") +public class TarmCentroControl extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TarmCentroControl + */ + @Id + @Column(name = "CCENTROCONTROL", nullable = false, updatable = false) + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CCENTROCONTROL"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.String"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "6")}) + @GeneratedValue(generator = "seq_id") + private String pk; + @Column(name = "CUPOSLIBRESULTIMODIA", nullable = true) + + /** + * CUANTOS TRAMITES PUEDO REALIZAR EN LA FECHAPROXIMOTRAMITE PARA COMPLETAR + * EL NUMERO DE TRAMITES POR DIA DEL CENTRO + */ + private Integer cuposlibresultimodia; + + @Column(name = "DIRECCION", nullable = true) + + /** + * null + */ + private String direccion; + + @Column(name = "NOMBREINSTITUCION", nullable = true) + + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String nombreinstitucion; + + @Column(name = "CANTONCODE", nullable = true) + + /** + * Codigo de canton + */ + private String cantoncode; + + @Column(name = "NOMBREINSTITUCIONCODIGO", nullable = true) + + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String nombreinstitucioncodigo; + + @Column(name = "TRAMITESPORDIA", nullable = true) + + /** + * null + */ + private Integer tramitespordia; + + @Column(name = "GRADO", nullable = true) + + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String grado; + + @Column(name = "COUNTRYCODE", nullable = true) + + /** + * Codigo de pais + */ + private String countrycode; + + @Column(name = "INSTITUCIONTIPO", nullable = true) + + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String instituciontipo; + + @Column(name = "INSTITUCION", nullable = true) + + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String institucion; + + @Column(name = "FECHAPROXIMOTRAMITE", nullable = true) + + /** + * FECHA DE ATENCION AL USUARIO PARA EL PROXIMO TRAMITE DE TIPO PERMISO QUE + * INGRESE + */ + private Date fechaproximotramite; + + @Column(name = "PARROQUIACODE", nullable = true) + + /** + * Codigo de parroquia + */ + private String parroquiacode; + + @Column(name = "PERSONCODE", nullable = true) + + /** + * Codigo de persona + */ + private Integer personcode; + + @Column(name = "ESTADO", nullable = true) + + /** + * null + */ + private String estado; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + + /** + * Manejo de optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "DATETO", nullable = true) + + /** + * Fecha hasta la cual esta vigente el registro + */ + private Timestamp dateto; + + @Column(name = "PROVINCECODE", nullable = true) + + /** + * Codigo de provincia + */ + private String provincecode; + + @Column(name = "GRADOCODIGO", nullable = true) + + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String gradocodigo; + + /** + * puntofacturacion formato 001-000 + */ + @Column(name = "PUNTOFACTURACION", nullable = true) + private String puntofacturacion; + /** + * Secuencial para cada punto de facturacion + */ + @Column(name = "SECUENCIAFACTURACION", nullable = false) + private Integer secuenciafacturacion; + /** + * Contructor por defecto + */ + public TarmCentroControl() { + } + + /** + * Contructor de TarmCentroControl + * + * @param pPk Clave Primaria del entity + */ + public TarmCentroControl(String pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TarmCentroControl + */ + public static TarmCentroControl find(EntityManager pEntityManager, Object pKey) throws Exception { + TarmCentroControl obj = pEntityManager.find(TarmCentroControl.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TarmCentroControl + * + * @return El objeto que referencia a la Clave primaria de TarmCentroControl + */ + public String getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TarmCentroControl + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TarmCentroControl + */ + public void setPk(String pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de cuposlibresultimodia + * + * @return valor de cuposlibresultimodia + */ + public Integer getCuposlibresultimodia() { + return cuposlibresultimodia; + } + + /** + * Fija el valor de cuposlibresultimodia + * + * @param pCuposlibresultimodia nuevo Valor de cuposlibresultimodia + */ + public void setCuposlibresultimodia(Integer pCuposlibresultimodia) { + cuposlibresultimodia = pCuposlibresultimodia; + } + + /** + * Obtiene el valor de direccion + * + * @return valor de direccion + */ + public String getDireccion() { + return direccion; + } + + /** + * Fija el valor de direccion + * + * @param pDireccion nuevo Valor de direccion + */ + public void setDireccion(String pDireccion) { + direccion = pDireccion; + } + + /** + * Obtiene el valor de nombreinstitucion + * + * @return valor de nombreinstitucion + */ + public String getNombreinstitucion() { + return nombreinstitucion; + } + + /** + * Fija el valor de nombreinstitucion + * + * @param pNombreinstitucion nuevo Valor de nombreinstitucion + */ + public void setNombreinstitucion(String pNombreinstitucion) { + nombreinstitucion = pNombreinstitucion; + } + + /** + * Obtiene el valor de cantoncode + * + * @return valor de cantoncode + */ + public String getCantoncode() { + return cantoncode; + } + + /** + * Fija el valor de cantoncode + * + * @param pCantoncode nuevo Valor de cantoncode + */ + public void setCantoncode(String pCantoncode) { + cantoncode = pCantoncode; + } + + /** + * Obtiene el valor de nombreinstitucioncodigo + * + * @return valor de nombreinstitucioncodigo + */ + public String getNombreinstitucioncodigo() { + return nombreinstitucioncodigo; + } + + /** + * Fija el valor de nombreinstitucioncodigo + * + * @param pNombreinstitucioncodigo nuevo Valor de nombreinstitucioncodigo + */ + public void setNombreinstitucioncodigo(String pNombreinstitucioncodigo) { + nombreinstitucioncodigo = pNombreinstitucioncodigo; + } + + /** + * Obtiene el valor de tramitespordia + * + * @return valor de tramitespordia + */ + public Integer getTramitespordia() { + return tramitespordia; + } + + /** + * Fija el valor de tramitespordia + * + * @param pTramitespordia nuevo Valor de tramitespordia + */ + public void setTramitespordia(Integer pTramitespordia) { + tramitespordia = pTramitespordia; + } + + /** + * Obtiene el valor de grado + * + * @return valor de grado + */ + public String getGrado() { + return grado; + } + + /** + * Fija el valor de grado + * + * @param pGrado nuevo Valor de grado + */ + public void setGrado(String pGrado) { + grado = pGrado; + } + + /** + * Obtiene el valor de countrycode + * + * @return valor de countrycode + */ + public String getCountrycode() { + return countrycode; + } + + /** + * Fija el valor de countrycode + * + * @param pCountrycode nuevo Valor de countrycode + */ + public void setCountrycode(String pCountrycode) { + countrycode = pCountrycode; + } + + /** + * Obtiene el valor de instituciontipo + * + * @return valor de instituciontipo + */ + public String getInstituciontipo() { + return instituciontipo; + } + + /** + * Fija el valor de instituciontipo + * + * @param pInstituciontipo nuevo Valor de instituciontipo + */ + public void setInstituciontipo(String pInstituciontipo) { + instituciontipo = pInstituciontipo; + } + + /** + * Obtiene el valor de institucion + * + * @return valor de institucion + */ + public String getInstitucion() { + return institucion; + } + + /** + * Fija el valor de institucion + * + * @param pInstitucion nuevo Valor de institucion + */ + public void setInstitucion(String pInstitucion) { + institucion = pInstitucion; + } + + /** + * Obtiene el valor de fechaproximotramite + * + * @return valor de fechaproximotramite + */ + public Date getFechaproximotramite() { + return fechaproximotramite; + } + + /** + * Fija el valor de fechaproximotramite + * + * @param pFechaproximotramite nuevo Valor de fechaproximotramite + */ + public void setFechaproximotramite(Date pFechaproximotramite) { + fechaproximotramite = pFechaproximotramite; + } + + /** + * Obtiene el valor de parroquiacode + * + * @return valor de parroquiacode + */ + public String getParroquiacode() { + return parroquiacode; + } + + /** + * Fija el valor de parroquiacode + * + * @param pParroquiacode nuevo Valor de parroquiacode + */ + public void setParroquiacode(String pParroquiacode) { + parroquiacode = pParroquiacode; + } + + /** + * Obtiene el valor de personcode + * + * @return valor de personcode + */ + public Integer getPersoncode() { + return personcode; + } + + /** + * Fija el valor de personcode + * + * @param pPersoncode nuevo Valor de personcode + */ + public void setPersoncode(Integer pPersoncode) { + personcode = pPersoncode; + } + + /** + * Obtiene el valor de estado + * + * @return valor de estado + */ + public String getEstado() { + return estado; + } + + /** + * Fija el valor de estado + * + * @param pEstado nuevo Valor de estado + */ + public void setEstado(String pEstado) { + estado = pEstado; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de dateto + * + * @return valor de dateto + */ + public Timestamp getDateto() { + return dateto; + } + + /** + * Fija el valor de dateto + * + * @param pDateto nuevo Valor de dateto + */ + public void setDateto(Timestamp pDateto) { + dateto = pDateto; + } + + /** + * Obtiene el valor de provincecode + * + * @return valor de provincecode + */ + public String getProvincecode() { + return provincecode; + } + + /** + * Fija el valor de provincecode + * + * @param pProvincecode nuevo Valor de provincecode + */ + public void setProvincecode(String pProvincecode) { + provincecode = pProvincecode; + } + + /** + * Obtiene el valor de gradocodigo + * + * @return valor de gradocodigo + */ + public String getGradocodigo() { + return gradocodigo; + } + + /** + * Fija el valor de gradocodigo + * + * @param pGradocodigo nuevo Valor de gradocodigo + */ + public void setGradocodigo(String pGradocodigo) { + gradocodigo = pGradocodigo; + } + + public String getPuntofacturacion() { + return puntofacturacion; + } + + public void setPuntofacturacion(String puntofacturacion) { + this.puntofacturacion = puntofacturacion; + } + + public Integer getSecuenciafacturacion() { + return secuenciafacturacion; + } + + public void setSecuenciafacturacion(Integer secuenciafacturacion) { + this.secuenciafacturacion = secuenciafacturacion; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TarmCentroControl)) { + return false; + } + TarmCentroControl that = (TarmCentroControl) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TarmCentroControl + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacion toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacion de la creacion de un bean en blanco TarmCentroControl + */ + public Object createInstance() { + TarmCentroControl instance = new TarmCentroControl(); + return instance; + } + + /** + * Clona la entidad TarmCentroControl + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TarmCentroControl p = (TarmCentroControl) this.clone(); + return p; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmCentroControlJur.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmCentroControlJur.java new file mode 100644 index 0000000..5a68b59 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmCentroControlJur.java @@ -0,0 +1,202 @@ +package com.fp.persistence.parmas.param; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMCENCONTROLJUR*/ +@Entity(name="TarmCentroControlJur") +@Table(name="TARMCENCONTROLJUR") +public class TarmCentroControlJur extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmCentroControlJur +*/ +@Id +@Column(name="CJURISDICCION" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CJURISDICCION"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.Long"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "16")}) + @GeneratedValue(generator = "seq_id") +private Long pk; +@Column(name="CCENTROCONTROL", nullable=true) + +/** +* Codigo de centro de control de armas +*/ +private String ccentrocontrol; + +@Column(name="COUNTRYCODE", nullable=true) + +/** +* Codigo de pais +*/ +private String countrycode; + +@Column(name="PROVINCECODE", nullable=true) + +/** +* Codigo de provincia +*/ +private String provincecode; + +@Transient +private String provincianombre; + +/**Contructor por defecto*/ +public TarmCentroControlJur(){ +} +/**Contructor de TarmCentroControlJur +@param pPk Clave Primaria del entity +*/ +public TarmCentroControlJur(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmCentroControlJur +*/ +public static TarmCentroControlJur find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmCentroControlJur obj = pEntityManager.find(TarmCentroControlJur.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmCentroControlJur +@return El objeto que referencia a la Clave primaria de TarmCentroControlJur +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmCentroControlJur +@param pPk El objeto que referencia a la nueva Clave primaria de TarmCentroControlJur +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de ccentrocontrol +@return valor de ccentrocontrol*/ +public String getCcentrocontrol(){ + return ccentrocontrol; +} +/**Fija el valor de ccentrocontrol +@param pCcentrocontrol nuevo Valor de ccentrocontrol*/ +public void setCcentrocontrol(String pCcentrocontrol){ + ccentrocontrol=pCcentrocontrol; +} + +/**Obtiene el valor de countrycode +@return valor de countrycode*/ +public String getCountrycode(){ + return countrycode; +} +/**Fija el valor de countrycode +@param pCountrycode nuevo Valor de countrycode*/ +public void setCountrycode(String pCountrycode){ + countrycode=pCountrycode; +} + +/**Obtiene el valor de provincecode +@return valor de provincecode*/ +public String getProvincecode(){ + return provincecode; +} +/**Fija el valor de provincecode +@param pProvincecode nuevo Valor de provincecode*/ +public void setProvincecode(String pProvincecode){ + provincecode=pProvincecode; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmCentroControlJur))return false; + TarmCentroControlJur that = (TarmCentroControlJur) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmCentroControlJur +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmCentroControlJur +*/ +public Object createInstance(){ + TarmCentroControlJur instance=new TarmCentroControlJur(); + return instance; +} +/**Clona la entidad TarmCentroControlJur +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmCentroControlJur p=(TarmCentroControlJur)this.clone(); + return p; +} +public String getProvincianombre() { + return provincianombre; +} +public void setProvincianombre(String provincianombre) { + this.provincianombre = provincianombre; +} + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmComercianteCupo.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmComercianteCupo.java new file mode 100644 index 0000000..34cc57f --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmComercianteCupo.java @@ -0,0 +1,353 @@ +package com.fp.persistence.parmas.param; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMCOMERCIANTECUPO*/ +@Entity(name="TarmComercianteCupo") +@Table(name="TARMCOMERCIANTECUPO") +public class TarmComercianteCupo extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmComercianteCupo +*/ +@Id +@Column(name="CCOMCUPO" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CCOMCUPO"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.String"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "16")}) + @GeneratedValue(generator = "seq_id") +private String pk; +@Column(name="CLASE", nullable=true) + +/** +* Codigo de catalogo 01 Explosivo, 02 Arma de Fuego +*/ +private String clase; + +@Column(name="CLASECODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipo de clase de arma +*/ +private String clasecodigo; + +@Column(name="TIPOARMAEXPLOSIVO", nullable=true) + +/** +* Codigo de catalogo 01 Revolver, 02 Plvora +*/ +private String tipoarmaexplosivo; + +@Column(name="TIPOARMAEXPLOSIVOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de armaexplosivo +*/ +private String tipoarmaexplosivocodigo; + +@Column(name="UNIDADMEDIDAPESO", nullable=true) + +/** +* Codigo de catalogo 01 KG, 02 Unidad +*/ +private String unidadmedidapeso; + +@Column(name="UNIDADMEDIDAPESOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de pesounidad +*/ +private String unidadmedidapesocodigo; + +@Column(name="PERSONCODIGO", nullable=true) + +/** +* Codigo de persona comerciante +*/ +private Integer personcodigo; + +@Column(name="TIPOREGISTRO", nullable=true) + +/** +* Codigo de catalogo 01 Importacin, 02 Produccin +*/ +private String tiporegistro; + +@Column(name="TIPOREGISTROCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de registro +*/ +private String tiporegistrocodigo; + +@Column(name="CUPOUNIDAD", nullable=true) + +/** +* Valor de cupo asignado a un comerciante por el tipo de registro, clase, tipoarmaexplosivo. +*/ +private BigDecimal cupounidad; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Versin del Registro +*/ +private Integer recordversion; + +@Column(name="FECHAREGISTRO", nullable=true) + +/** +* Fecha del registro +*/ +private Timestamp fecharegistro; + +/**Contructor por defecto*/ +public TarmComercianteCupo(){ +} +/**Contructor de TarmComercianteCupo +@param pPk Clave Primaria del entity +*/ +public TarmComercianteCupo(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmComercianteCupo +*/ +public static TarmComercianteCupo find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmComercianteCupo obj = pEntityManager.find(TarmComercianteCupo.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmComercianteCupo +@return El objeto que referencia a la Clave primaria de TarmComercianteCupo +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmComercianteCupo +@param pPk El objeto que referencia a la nueva Clave primaria de TarmComercianteCupo +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de clase +@return valor de clase*/ +public String getClase(){ + return clase; +} +/**Fija el valor de clase +@param pClase nuevo Valor de clase*/ +public void setClase(String pClase){ + clase=pClase; +} + +/**Obtiene el valor de clasecodigo +@return valor de clasecodigo*/ +public String getClasecodigo(){ + return clasecodigo; +} +/**Fija el valor de clasecodigo +@param pClasecodigo nuevo Valor de clasecodigo*/ +public void setClasecodigo(String pClasecodigo){ + clasecodigo=pClasecodigo; +} + +/**Obtiene el valor de tipoarmaexplosivo +@return valor de tipoarmaexplosivo*/ +public String getTipoarmaexplosivo(){ + return tipoarmaexplosivo; +} +/**Fija el valor de tipoarmaexplosivo +@param pTipoarmaexplosivo nuevo Valor de tipoarmaexplosivo*/ +public void setTipoarmaexplosivo(String pTipoarmaexplosivo){ + tipoarmaexplosivo=pTipoarmaexplosivo; +} + +/**Obtiene el valor de tipoarmaexplosivocodigo +@return valor de tipoarmaexplosivocodigo*/ +public String getTipoarmaexplosivocodigo(){ + return tipoarmaexplosivocodigo; +} +/**Fija el valor de tipoarmaexplosivocodigo +@param pTipoarmaexplosivocodigo nuevo Valor de tipoarmaexplosivocodigo*/ +public void setTipoarmaexplosivocodigo(String pTipoarmaexplosivocodigo){ + tipoarmaexplosivocodigo=pTipoarmaexplosivocodigo; +} + +/**Obtiene el valor de unidadmedidapeso +@return valor de unidadmedidapeso*/ +public String getUnidadmedidapeso(){ + return unidadmedidapeso; +} +/**Fija el valor de unidadmedidapeso +@param pUnidadmedidapeso nuevo Valor de unidadmedidapeso*/ +public void setUnidadmedidapeso(String pUnidadmedidapeso){ + unidadmedidapeso=pUnidadmedidapeso; +} + +/**Obtiene el valor de unidadmedidapesocodigo +@return valor de unidadmedidapesocodigo*/ +public String getUnidadmedidapesocodigo(){ + return unidadmedidapesocodigo; +} +/**Fija el valor de unidadmedidapesocodigo +@param pUnidadmedidapesocodigo nuevo Valor de unidadmedidapesocodigo*/ +public void setUnidadmedidapesocodigo(String pUnidadmedidapesocodigo){ + unidadmedidapesocodigo=pUnidadmedidapesocodigo; +} + +/**Obtiene el valor de personcodigo +@return valor de personcodigo*/ +public Integer getPersoncodigo(){ + return personcodigo; +} +/**Fija el valor de personcodigo +@param pPersoncodigo nuevo Valor de personcodigo*/ +public void setPersoncodigo(Integer pPersoncodigo){ + personcodigo=pPersoncodigo; +} + +/**Obtiene el valor de tiporegistro +@return valor de tiporegistro*/ +public String getTiporegistro(){ + return tiporegistro; +} +/**Fija el valor de tiporegistro +@param pTiporegistro nuevo Valor de tiporegistro*/ +public void setTiporegistro(String pTiporegistro){ + tiporegistro=pTiporegistro; +} + +/**Obtiene el valor de tiporegistrocodigo +@return valor de tiporegistrocodigo*/ +public String getTiporegistrocodigo(){ + return tiporegistrocodigo; +} +/**Fija el valor de tiporegistrocodigo +@param pTiporegistrocodigo nuevo Valor de tiporegistrocodigo*/ +public void setTiporegistrocodigo(String pTiporegistrocodigo){ + tiporegistrocodigo=pTiporegistrocodigo; +} + +/**Obtiene el valor de cupounidad +@return valor de cupounidad*/ +public BigDecimal getCupounidad(){ + return cupounidad; +} +/**Fija el valor de cupounidad +@param pCupounidad nuevo Valor de cupounidad*/ +public void setCupounidad(BigDecimal pCupounidad){ + cupounidad=pCupounidad; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de fecharegistro +@return valor de fecharegistro*/ +public Timestamp getFecharegistro(){ + return fecharegistro; +} +/**Fija el valor de fecharegistro +@param pFecharegistro nuevo Valor de fecharegistro*/ +public void setFecharegistro(Timestamp pFecharegistro){ + fecharegistro=pFecharegistro; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmComercianteCupo))return false; + TarmComercianteCupo that = (TarmComercianteCupo) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmComercianteCupo +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmComercianteCupo +*/ +public Object createInstance(){ + TarmComercianteCupo instance=new TarmComercianteCupo(); + return instance; +} +/**Clona la entidad TarmComercianteCupo +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmComercianteCupo p=(TarmComercianteCupo)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmOrigenTramite.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmOrigenTramite.java new file mode 100644 index 0000000..9b476ce --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmOrigenTramite.java @@ -0,0 +1,121 @@ +package com.fp.persistence.parmas.param; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMORIGENTRAMITE*/ +@Entity(name="TarmOrigenTramite") +@Table(name="TARMORIGENTRAMITE") +public class TarmOrigenTramite extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmOrigenTramite +*/ +@EmbeddedId +private TarmOrigenTramiteKey pk; +/**Contructor por defecto*/ +public TarmOrigenTramite(){ +} +/**Contructor de TarmOrigenTramite +@param pPk Clave Primaria del entity +*/ +public TarmOrigenTramite(TarmOrigenTramiteKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmOrigenTramite +*/ +public static TarmOrigenTramite find(EntityManager pEntityManager,TarmOrigenTramiteKey pKey) throws Exception{ + TarmOrigenTramite obj = pEntityManager.find(TarmOrigenTramite.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmOrigenTramite +@return El objeto que referencia a la Clave primaria de TarmOrigenTramite +*/ +public TarmOrigenTramiteKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmOrigenTramite +@param pPk El objeto que referencia a la nueva Clave primaria de TarmOrigenTramite +*/ +public void setPk(TarmOrigenTramiteKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmOrigenTramite))return false; + TarmOrigenTramite that = (TarmOrigenTramite) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmOrigenTramite +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmOrigenTramite +*/ +public Object createInstance(){ + TarmOrigenTramite instance=new TarmOrigenTramite(); + instance.setPk(new TarmOrigenTramiteKey()); + return instance; +} +/**Clona la entidad TarmOrigenTramite +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmOrigenTramite p=(TarmOrigenTramite)this.clone(); + p.setPk((TarmOrigenTramiteKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmOrigenTramiteKey.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmOrigenTramiteKey.java new file mode 100644 index 0000000..3de8628 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmOrigenTramiteKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.parmas.param; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMORIGENTRAMITE*/ +@Embeddable +public class TarmOrigenTramiteKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CTRAMITE", nullable=false,updatable=false) + +/** +* Codigo de tramite +*/ +private Long ctramite; + +@Column(name="ORIGENCATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de catalogcode de origen +*/ +private String origencatalogcode; + +@Column(name="ORIGENCATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo de origen +*/ +private String origencatalog; + +/**Contructor por defecto*/ +public TarmOrigenTramiteKey(){} +/**Contructor de TarmOrigenTramiteKey +@param pCtramite Codigo de tramite +@param pOrigencatalogcode Codigo de catalogcode de origen +@param pOrigencatalog Codigo de catalogo de origen +*/ +public TarmOrigenTramiteKey(Long pCtramite,String pOrigencatalogcode,String pOrigencatalog){ + ctramite=pCtramite; + origencatalogcode=pOrigencatalogcode; + origencatalog=pOrigencatalog; +} +/**Obtiene el valor de ctramite +@return valor de ctramite*/ +public Long getCtramite(){ + return ctramite; +} +/**Fija el valor de ctramite +@param pCtramite nuevo Valor de ctramite*/ +public void setCtramite(Long pCtramite){ + ctramite=pCtramite; +} + +/**Obtiene el valor de origencatalogcode +@return valor de origencatalogcode*/ +public String getOrigencatalogcode(){ + return origencatalogcode; +} +/**Fija el valor de origencatalogcode +@param pOrigencatalogcode nuevo Valor de origencatalogcode*/ +public void setOrigencatalogcode(String pOrigencatalogcode){ + origencatalogcode=pOrigencatalogcode; +} + +/**Obtiene el valor de origencatalog +@return valor de origencatalog*/ +public String getOrigencatalog(){ + return origencatalog; +} +/**Fija el valor de origencatalog +@param pOrigencatalog nuevo Valor de origencatalog*/ +public void setOrigencatalog(String pOrigencatalog){ + origencatalog=pOrigencatalog; +} + +/**Implementacion de la comparacion de TarmOrigenTramiteKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmOrigenTramiteKey))return false; + TarmOrigenTramiteKey that = (TarmOrigenTramiteKey) o; + if (this.getCtramite() == null || that.getCtramite() == null){ + return false; + } + if (! this.getCtramite().equals(that.getCtramite())){ + return false; + } + if (this.getOrigencatalogcode() == null || that.getOrigencatalogcode() == null){ + return false; + } + if (! this.getOrigencatalogcode().equals(that.getOrigencatalogcode())){ + return false; + } + if (this.getOrigencatalog() == null || that.getOrigencatalog() == null){ + return false; + } + if (! this.getOrigencatalog().equals(that.getOrigencatalog())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmOrigenTramiteKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCtramite() == null ? 0 : this.getCtramite().hashCode()); + result = result * 37 + (this.getOrigencatalogcode() == null ? 0 : this.getOrigencatalogcode().hashCode()); + result = result * 37 + (this.getOrigencatalog() == null ? 0 : this.getOrigencatalog().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmRequisito.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmRequisito.java new file mode 100644 index 0000000..c2eec12 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmRequisito.java @@ -0,0 +1,211 @@ +package com.fp.persistence.parmas.param; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMREQUISITO*/ +@Entity(name="TarmRequisito") +@Table(name="TARMREQUISITO") +public class TarmRequisito extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmRequisito +*/ +@Id +@Column(name="CREQUISITO" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CREQUISITO"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.String"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "6")}) + @GeneratedValue(generator = "seq_id") +private String pk; + +@Column(name="NOMBRE", nullable=false) + +/** +* Descripcion del requisito +*/ +private String nombre; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPCIONCORTA", nullable=true) + +/** +* Descripcion corta del requisito +*/ +private String descripcioncorta; + +@Column(name="ACTIVE", nullable=true) +/** +* Activo +*/ +private String active; + +/**Contructor por defecto*/ +public TarmRequisito(){ +} +/**Contructor de TarmRequisito +@param pPk Clave Primaria del entity +@param pNombre Descripcion del requisito +*/ +public TarmRequisito(String pPk,String pNombre){ + this(); + pk=pPk; + nombre=pNombre; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmRequisito +*/ +public static TarmRequisito find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmRequisito obj = pEntityManager.find(TarmRequisito.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmRequisito +@return El objeto que referencia a la Clave primaria de TarmRequisito +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmRequisito +@param pPk El objeto que referencia a la nueva Clave primaria de TarmRequisito +*/ +public void setPk(String pPk){ + pk=pPk; + +} +/**Obtiene el valor de nombre +@return valor de nombre*/ +public String getNombre(){ + return nombre; +} +/**Fija el valor de nombre +@param pNombre nuevo Valor de nombre*/ +public void setNombre(String pNombre){ + nombre=pNombre; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmRequisito))return false; + TarmRequisito that = (TarmRequisito) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmRequisito +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmRequisito +*/ +public Object createInstance(){ + TarmRequisito instance=new TarmRequisito(); + return instance; +} +/**Clona la entidad TarmRequisito +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmRequisito p=(TarmRequisito)this.clone(); + return p; +} + +/**Obtiene el valor de descripcioncorta +@return valor de descripcioncorta*/ +public String getDescripcioncorta() { + return descripcioncorta; +} + +/**Fija el valor de descripcioncorta +@param pRecordversion nuevo Valor de descripcioncorta*/ +public void setDescripcioncorta(String descripcioncorta) { + this.descripcioncorta = descripcioncorta; +} +public String getActive() { + return active; +} +public void setActive(String active) { + this.active = active; +} + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmRequisitoPorTipoTramite.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmRequisitoPorTipoTramite.java new file mode 100644 index 0000000..a1a3d78 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmRequisitoPorTipoTramite.java @@ -0,0 +1,182 @@ +package com.fp.persistence.parmas.param; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMREQUISITOPORTIPOTRAMITE*/ +@Entity(name="TarmRequisitoPorTipoTramite") +@Table(name="TARMREQUISITOPORTIPOTRAMITE") +public class TarmRequisitoPorTipoTramite extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmRequisitoPorTipoTramite +*/ +@EmbeddedId +private TarmRequisitoPorTipoTramiteKey pk; +@Column(name="DEPOSITOPORTRAMITE", nullable=true) + +/** +* null +*/ +private String depositoportramite; + +@Column(name="DEPOSITOPORCUSTODIO", nullable=true) + +/** +* null +*/ +private String depositoporcustodio; + +@Column(name="ACTIVE", nullable=true) + +/** +* null +*/ +private String active; + +/**Contructor por defecto*/ +public TarmRequisitoPorTipoTramite(){ +} +/**Contructor de TarmRequisitoPorTipoTramite +@param pPk Clave Primaria del entity +*/ +public TarmRequisitoPorTipoTramite(TarmRequisitoPorTipoTramiteKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmRequisitoPorTipoTramite +*/ +public static TarmRequisitoPorTipoTramite find(EntityManager pEntityManager,TarmRequisitoPorTipoTramiteKey pKey) throws Exception{ + TarmRequisitoPorTipoTramite obj = pEntityManager.find(TarmRequisitoPorTipoTramite.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmRequisitoPorTipoTramite +@return El objeto que referencia a la Clave primaria de TarmRequisitoPorTipoTramite +*/ +public TarmRequisitoPorTipoTramiteKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmRequisitoPorTipoTramite +@param pPk El objeto que referencia a la nueva Clave primaria de TarmRequisitoPorTipoTramite +*/ +public void setPk(TarmRequisitoPorTipoTramiteKey pPk){ + pk=pPk; +} +/**Obtiene el valor de depositoportramite +@return valor de depositoportramite*/ +public String getDepositoportramite(){ + return depositoportramite; +} +/**Fija el valor de depositoportramite +@param pDepositoportramite nuevo Valor de depositoportramite*/ +public void setDepositoportramite(String pDepositoportramite){ + depositoportramite=pDepositoportramite; +} + +/**Obtiene el valor de depositoporcustodio +@return valor de depositoporcustodio*/ +public String getDepositoporcustodio(){ + return depositoporcustodio; +} +/**Fija el valor de depositoporcustodio +@param pDepositoporcustodio nuevo Valor de depositoporcustodio*/ +public void setDepositoporcustodio(String pDepositoporcustodio){ + depositoporcustodio=pDepositoporcustodio; +} + +/**Obtiene el valor de active +@return valor de active*/ +public String getActive() { + return active; +} + +/**Fija el valor de active +@param pActive nuevo Valor de active*/ +public void setActive(String pActive) { + this.active = pActive; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmRequisitoPorTipoTramite))return false; + TarmRequisitoPorTipoTramite that = (TarmRequisitoPorTipoTramite) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmRequisitoPorTipoTramite +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmRequisitoPorTipoTramite +*/ +public Object createInstance(){ + TarmRequisitoPorTipoTramite instance=new TarmRequisitoPorTipoTramite(); + instance.setPk(new TarmRequisitoPorTipoTramiteKey()); + return instance; +} +/**Clona la entidad TarmRequisitoPorTipoTramite +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmRequisitoPorTipoTramite p=(TarmRequisitoPorTipoTramite)this.clone(); + p.setPk((TarmRequisitoPorTipoTramiteKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmRequisitoPorTipoTramiteKey.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmRequisitoPorTipoTramiteKey.java new file mode 100644 index 0000000..8a86746 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmRequisitoPorTipoTramiteKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.parmas.param; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMREQUISITOPORTIPOTRAMITE*/ +@Embeddable +public class TarmRequisitoPorTipoTramiteKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CREQUISITO", nullable=false,updatable=false) + +/** +* Codigo de requisito +*/ +private String crequisito; + +@Column(name="CTRAMITE", nullable=false,updatable=false) + +/** +* null +*/ +private Long ctramite; + +/**Contructor por defecto*/ +public TarmRequisitoPorTipoTramiteKey(){} +/**Contructor de TarmRequisitoPorTipoTramiteKey +@param pCrequisito Codigo de requisito +@param pCtramite null +*/ +public TarmRequisitoPorTipoTramiteKey(String pCrequisito,Long pCtramite){ + crequisito=pCrequisito; + ctramite=pCtramite; +} +/**Obtiene el valor de crequisito +@return valor de crequisito*/ +public String getCrequisito(){ + return crequisito; +} +/**Fija el valor de crequisito +@param pCrequisito nuevo Valor de crequisito*/ +public void setCrequisito(String pCrequisito){ + crequisito=pCrequisito; +} + +/**Obtiene el valor de ctramite +@return valor de ctramite*/ +public Long getCtramite(){ + return ctramite; +} +/**Fija el valor de ctramite +@param pCtramite nuevo Valor de ctramite*/ +public void setCtramite(Long pCtramite){ + ctramite=pCtramite; +} + +/**Implementacion de la comparacion de TarmRequisitoPorTipoTramiteKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmRequisitoPorTipoTramiteKey))return false; + TarmRequisitoPorTipoTramiteKey that = (TarmRequisitoPorTipoTramiteKey) o; + if (this.getCrequisito() == null || that.getCrequisito() == null){ + return false; + } + if (! this.getCrequisito().equals(that.getCrequisito())){ + return false; + } + if (this.getCtramite() == null || that.getCtramite() == null){ + return false; + } + if (! this.getCtramite().equals(that.getCtramite())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmRequisitoPorTipoTramiteKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCrequisito() == null ? 0 : this.getCrequisito().hashCode()); + result = result * 37 + (this.getCtramite() == null ? 0 : this.getCtramite().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmSitioAlmacenamiento.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmSitioAlmacenamiento.java new file mode 100644 index 0000000..70ca38d --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmSitioAlmacenamiento.java @@ -0,0 +1,435 @@ +package com.fp.persistence.parmas.param; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMSITIOALMACENAMIENTO*/ +@Entity(name="TarmSitioAlmacenamiento") +@Table(name="TARMSITIOALMACENAMIENTO") +public class TarmSitioAlmacenamiento extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmSitioAlmacenamiento +*/ +@Id +@Column(name="CSITIOALMACENAMIENTO" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CSITIOALMACENAMIENTO"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.String"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "6")}) + @GeneratedValue(generator = "seq_id") +private String pk; +@Column(name="TIPOCOMERCIO", nullable=true) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String tipocomercio; + +@Column(name="TIPOCOMERCIOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String tipocomerciocodigo; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="COUNTRYCODE", nullable=true) + +/** +* Codigo de pais +*/ +private String countrycode; + +@Column(name="PROVINCECODE", nullable=true) + +/** +* Codigo de provincia +*/ +private String provincecode; + +@Column(name="CANTONCODE", nullable=true) + +/** +* Codigo de canton +*/ +private String cantoncode; + +@Column(name="PARROQUIACODE", nullable=true) + +/** +* Codigo de parroquia +*/ +private String parroquiacode; + +@Column(name="CITYCODE", nullable=true) + +/** +* Codigo de cuidad +*/ +private String citycode; + +@Column(name="BODEGA", nullable=true) + +/** +* null +*/ +private String bodega; + +@Column(name="DIRECCION", nullable=true) + +/** +* null +*/ +private String direccion; + +@Column(name="LATITUD", nullable=true) + +/** +* null +*/ +private BigDecimal latitud; + +@Column(name="LONGITUD", nullable=true) + +/** +* null +*/ +private BigDecimal longitud; + +@Column(name="RESPONSABLE", nullable=true) + +/** +* null +*/ +private String responsable; + +@Column(name="IDENTIFICACION", nullable=true) + +/** +* null +*/ +private String identificacion; + +@Column(name="TELEFONO", nullable=true) + +/** +* Campo qu registra el Telfono de la bodega +*/ +private String telefono; + +@Column(name="REFERENCIA", nullable=true) + +/** +* Campo que registra la referencia deonde esta localizada la bodega +*/ +private String referencia; + +@Column(name="ESTADO", nullable=true) + +/** +* Campo que contiene el estado del registro +*/ +private String estado; + +/**Contructor por defecto*/ +public TarmSitioAlmacenamiento(){ +} +/**Contructor de TarmSitioAlmacenamiento +@param pPk Clave Primaria del entity +*/ +public TarmSitioAlmacenamiento(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmSitioAlmacenamiento +*/ +public static TarmSitioAlmacenamiento find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmSitioAlmacenamiento obj = pEntityManager.find(TarmSitioAlmacenamiento.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmSitioAlmacenamiento +@return El objeto que referencia a la Clave primaria de TarmSitioAlmacenamiento +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmSitioAlmacenamiento +@param pPk El objeto que referencia a la nueva Clave primaria de TarmSitioAlmacenamiento +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de tipocomercio +@return valor de tipocomercio*/ +public String getTipocomercio(){ + return tipocomercio; +} +/**Fija el valor de tipocomercio +@param pTipocomercio nuevo Valor de tipocomercio*/ +public void setTipocomercio(String pTipocomercio){ + tipocomercio=pTipocomercio; +} + +/**Obtiene el valor de tipocomerciocodigo +@return valor de tipocomerciocodigo*/ +public String getTipocomerciocodigo(){ + return tipocomerciocodigo; +} +/**Fija el valor de tipocomerciocodigo +@param pTipocomerciocodigo nuevo Valor de tipocomerciocodigo*/ +public void setTipocomerciocodigo(String pTipocomerciocodigo){ + tipocomerciocodigo=pTipocomerciocodigo; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de countrycode +@return valor de countrycode*/ +public String getCountrycode(){ + return countrycode; +} +/**Fija el valor de countrycode +@param pCountrycode nuevo Valor de countrycode*/ +public void setCountrycode(String pCountrycode){ + countrycode=pCountrycode; +} + +/**Obtiene el valor de provincecode +@return valor de provincecode*/ +public String getProvincecode(){ + return provincecode; +} +/**Fija el valor de provincecode +@param pProvincecode nuevo Valor de provincecode*/ +public void setProvincecode(String pProvincecode){ + provincecode=pProvincecode; +} + +/**Obtiene el valor de cantoncode +@return valor de cantoncode*/ +public String getCantoncode(){ + return cantoncode; +} +/**Fija el valor de cantoncode +@param pCantoncode nuevo Valor de cantoncode*/ +public void setCantoncode(String pCantoncode){ + cantoncode=pCantoncode; +} + +/**Obtiene el valor de parroquiacode +@return valor de parroquiacode*/ +public String getParroquiacode(){ + return parroquiacode; +} +/**Fija el valor de parroquiacode +@param pParroquiacode nuevo Valor de parroquiacode*/ +public void setParroquiacode(String pParroquiacode){ + parroquiacode=pParroquiacode; +} + +/**Obtiene el valor de citycode +@return valor de citycode*/ +public String getCitycode(){ + return citycode; +} +/**Fija el valor de citycode +@param pCitycode nuevo Valor de citycode*/ +public void setCitycode(String pCitycode){ + citycode=pCitycode; +} + +/**Obtiene el valor de bodega +@return valor de bodega*/ +public String getBodega(){ + return bodega; +} +/**Fija el valor de bodega +@param pBodega nuevo Valor de bodega*/ +public void setBodega(String pBodega){ + bodega=pBodega; +} + +/**Obtiene el valor de direccion +@return valor de direccion*/ +public String getDireccion(){ + return direccion; +} +/**Fija el valor de direccion +@param pDireccion nuevo Valor de direccion*/ +public void setDireccion(String pDireccion){ + direccion=pDireccion; +} + +/**Obtiene el valor de latitud +@return valor de latitud*/ +public BigDecimal getLatitud(){ + return latitud; +} +/**Fija el valor de latitud +@param pLatitud nuevo Valor de latitud*/ +public void setLatitud(BigDecimal pLatitud){ + latitud=pLatitud; +} + +/**Obtiene el valor de longitud +@return valor de longitud*/ +public BigDecimal getLongitud(){ + return longitud; +} +/**Fija el valor de longitud +@param pLongitud nuevo Valor de longitud*/ +public void setLongitud(BigDecimal pLongitud){ + longitud=pLongitud; +} + +/**Obtiene el valor de responsable +@return valor de responsable*/ +public String getResponsable(){ + return responsable; +} +/**Fija el valor de responsable +@param pResponsable nuevo Valor de responsable*/ +public void setResponsable(String pResponsable){ + responsable=pResponsable; +} + +/**Obtiene el valor de identificacion +@return valor de identificacion*/ +public String getIdentificacion(){ + return identificacion; +} +/**Fija el valor de identificacion +@param pIdentificacion nuevo Valor de identificacion*/ +public void setIdentificacion(String pIdentificacion){ + identificacion=pIdentificacion; +} + +/**Obtiene el valor de telefono +@return valor de telefono*/ +public String getTelefono(){ + return telefono; +} +/**Fija el valor de telefono +@param pTelefono nuevo Valor de telefono*/ +public void setTelefono(String pTelefono){ + telefono=pTelefono; +} + +/**Obtiene el valor de referencia +@return valor de referencia*/ +public String getReferencia(){ + return referencia; +} +/**Fija el valor de referencia +@param pReferencia nuevo Valor de referencia*/ +public void setReferencia(String pReferencia){ + referencia=pReferencia; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmSitioAlmacenamiento))return false; + TarmSitioAlmacenamiento that = (TarmSitioAlmacenamiento) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmSitioAlmacenamiento +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmSitioAlmacenamiento +*/ +public Object createInstance(){ + TarmSitioAlmacenamiento instance=new TarmSitioAlmacenamiento(); + return instance; +} +/**Clona la entidad TarmSitioAlmacenamiento +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmSitioAlmacenamiento p=(TarmSitioAlmacenamiento)this.clone(); + return p; +} +public String getEstado() { + return estado; +} +public void setEstado(String estado) { + this.estado = estado; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmTipoArmaExplosivo.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmTipoArmaExplosivo.java new file mode 100644 index 0000000..4e8339c --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmTipoArmaExplosivo.java @@ -0,0 +1,333 @@ +package com.fp.persistence.parmas.param; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMTIPOARMAEXPLOSIVO*/ +@Entity(name="TarmTipoArmaExplosivo") +@Table(name="TARMTIPOARMAEXPLOSIVO") +public class TarmTipoArmaExplosivo extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmTipoArmaExplosivo +*/ +@Id +@Column(name="CTIPOARMAEXPLOSIVO" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "TARMTIPOARMAEXPLOSIVO"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.String"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "6")}) + @GeneratedValue(generator = "seq_id") +private String pk; +@Column(name="LONGITUD", nullable=true) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String longitud; + +@Column(name="LONGITUDCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String longitudcodigo; + +@Column(name="CALIBRE", nullable=true) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String calibre; + +@Column(name="CALIBRECODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String calibrecodigo; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* null +*/ +private Integer recordversion; + +@Column(name="CLASE", nullable=true) + +/** +* null +*/ +private String clase; + +@Column(name="TIPOARMAEXPLOSIVO", nullable=true) + +/** +* null +*/ +private String tipoarmaexplosivo; + +@Column(name="TIPOARMAEXPLOSIVOCODIGO", nullable=true) + +/** +* null +*/ +private String tipoarmaexplosivocodigo; + +@Column(name="UNIDADMEDIDAPESO", nullable=true) + +/** +* null +*/ +private String unidadmedidapeso; + +@Column(name="UNIDADMEDIDAPESOCODIGO", nullable=true) + +/** +* null +*/ +private String unidadmedidapesocodigo; + +@Column(name="CLASECODIGO", nullable=true) + +/** +* null +*/ +private String clasecodigo; + +/**Contructor por defecto*/ +public TarmTipoArmaExplosivo(){ +} +/**Contructor de TarmTipoArmaExplosivo +@param pPk Clave Primaria del entity +*/ +public TarmTipoArmaExplosivo(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmTipoArmaExplosivo +*/ +public static TarmTipoArmaExplosivo find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmTipoArmaExplosivo obj = pEntityManager.find(TarmTipoArmaExplosivo.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmTipoArmaExplosivo +@return El objeto que referencia a la Clave primaria de TarmTipoArmaExplosivo +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmTipoArmaExplosivo +@param pPk El objeto que referencia a la nueva Clave primaria de TarmTipoArmaExplosivo +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de longitud +@return valor de longitud*/ +public String getLongitud(){ + return longitud; +} +/**Fija el valor de longitud +@param pLongitud nuevo Valor de longitud*/ +public void setLongitud(String pLongitud){ + longitud=pLongitud; +} + +/**Obtiene el valor de longitudcodigo +@return valor de longitudcodigo*/ +public String getLongitudcodigo(){ + return longitudcodigo; +} +/**Fija el valor de longitudcodigo +@param pLongitudcodigo nuevo Valor de longitudcodigo*/ +public void setLongitudcodigo(String pLongitudcodigo){ + longitudcodigo=pLongitudcodigo; +} + +/**Obtiene el valor de calibre +@return valor de calibre*/ +public String getCalibre(){ + return calibre; +} +/**Fija el valor de calibre +@param pCalibre nuevo Valor de calibre*/ +public void setCalibre(String pCalibre){ + calibre=pCalibre; +} + +/**Obtiene el valor de calibrecodigo +@return valor de calibrecodigo*/ +public String getCalibrecodigo(){ + return calibrecodigo; +} +/**Fija el valor de calibrecodigo +@param pCalibrecodigo nuevo Valor de calibrecodigo*/ +public void setCalibrecodigo(String pCalibrecodigo){ + calibrecodigo=pCalibrecodigo; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de clase +@return valor de clase*/ +public String getClase(){ + return clase; +} +/**Fija el valor de clase +@param pClase nuevo Valor de clase*/ +public void setClase(String pClase){ + clase=pClase; +} + +/**Obtiene el valor de tipoarmaexplosivo +@return valor de tipoarmaexplosivo*/ +public String getTipoarmaexplosivo(){ + return tipoarmaexplosivo; +} +/**Fija el valor de tipoarmaexplosivo +@param pTipoarmaexplosivo nuevo Valor de tipoarmaexplosivo*/ +public void setTipoarmaexplosivo(String pTipoarmaexplosivo){ + tipoarmaexplosivo=pTipoarmaexplosivo; +} + +/**Obtiene el valor de tipoarmaexplosivocodigo +@return valor de tipoarmaexplosivocodigo*/ +public String getTipoarmaexplosivocodigo(){ + return tipoarmaexplosivocodigo; +} +/**Fija el valor de tipoarmaexplosivocodigo +@param pTipoarmaexplosivocodigo nuevo Valor de tipoarmaexplosivocodigo*/ +public void setTipoarmaexplosivocodigo(String pTipoarmaexplosivocodigo){ + tipoarmaexplosivocodigo=pTipoarmaexplosivocodigo; +} + +/**Obtiene el valor de unidadmedidapeso +@return valor de unidadmedidapeso*/ +public String getUnidadmedidapeso(){ + return unidadmedidapeso; +} +/**Fija el valor de unidadmedidapeso +@param pUnidadmedidapeso nuevo Valor de unidadmedidapeso*/ +public void setUnidadmedidapeso(String pUnidadmedidapeso){ + unidadmedidapeso=pUnidadmedidapeso; +} + +/**Obtiene el valor de unidadmedidapesocodigo +@return valor de unidadmedidapesocodigo*/ +public String getUnidadmedidapesocodigo(){ + return unidadmedidapesocodigo; +} +/**Fija el valor de unidadmedidapesocodigo +@param pUnidadmedidapesocodigo nuevo Valor de unidadmedidapesocodigo*/ +public void setUnidadmedidapesocodigo(String pUnidadmedidapesocodigo){ + unidadmedidapesocodigo=pUnidadmedidapesocodigo; +} + +/**Obtiene el valor de clasecodigo +@return valor de clasecodigo*/ +public String getClasecodigo(){ + return clasecodigo; +} +/**Fija el valor de clasecodigo +@param pClasecodigo nuevo Valor de clasecodigo*/ +public void setClasecodigo(String pClasecodigo){ + clasecodigo=pClasecodigo; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmTipoArmaExplosivo))return false; + TarmTipoArmaExplosivo that = (TarmTipoArmaExplosivo) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmTipoArmaExplosivo +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmTipoArmaExplosivo +*/ +public Object createInstance(){ + TarmTipoArmaExplosivo instance=new TarmTipoArmaExplosivo(); + return instance; +} +/**Clona la entidad TarmTipoArmaExplosivo +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmTipoArmaExplosivo p=(TarmTipoArmaExplosivo)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmTipoSancion.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmTipoSancion.java new file mode 100644 index 0000000..84bd52d --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmTipoSancion.java @@ -0,0 +1,376 @@ +package com.fp.persistence.parmas.param; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMTIPOSANCION*/ +@Entity(name="TarmTipoSancion") +@Table(name="TARMTIPOSANCION") +public class TarmTipoSancion extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmTipoSancion +*/ +@Id +@Column(name="CTIPOSANCION" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "TARMTIPOSANCION"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.String"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "6")}) + @GeneratedValue(generator = "seq_id") +private String pk; +@Column(name="CLASE", nullable=false) + +/** +* Codigo de catalogo correspondiente a la clase +*/ +private String clase; + +@Column(name="CLASECODIGO", nullable=false) + +/** +* Codigo de catalogcode correspondiente a la clase +*/ +private String clasecodigo; + +@Column(name="FALTA", nullable=false) + +/** +* Codigo de catalogo correspondiente a la falta +*/ +private String falta; + +@Column(name="FALTACODIGO", nullable=false) + +/** +* Codigo de catalogcode correspondiente a la falta +*/ +private String faltacodigo; + +@Column(name="TIPOFALTA", nullable=false) + +/** +* Codigo de catalogo correspondiente al tipo de falta +*/ +private String tipofalta; + +@Column(name="TIPOFALTACODIGO", nullable=false) + +/** +* Codigo de catalogcode correspondiente al tipo de falta +*/ +private String tipofaltacodigo; + +@Column(name="TRAMITE", nullable=false) + +/** +* Codigo de catalogo correspondiente al tramite +*/ +private String tramite; + +@Column(name="TRAMITECODIGO", nullable=false) + +/** +* Codigo de catalogcode correspondiente al tramite +*/ +private String tramitecodigo; + +@Column(name="SANCION", nullable=false) + +/** +* Codigo de catalogo correspondiente a la sancion +*/ +private String sancion; + +@Column(name="SANCIONCODIGO", nullable=false) + +/** +* Codigo de catalogcode correspondiente a la sancion +*/ +private String sancioncodigo; + +@Column(name="TIEMPO", nullable=false) + +/** +* Codigo de catalogo correspondiente al tiempo de la sancion en dias +*/ +private String tiempo; + +@Column(name="TIEMPOCODIGO", nullable=false) + +/** +* Codigo de catalogcode correspondiente al tiempo de vigencia de la sancion en dias +*/ +private String tiempocodigo; + +/**Contructor por defecto*/ +public TarmTipoSancion(){ +} +/**Contructor de TarmTipoSancion +@param pPk Clave Primaria del entity +@param pClase Codigo de catalogo correspondiente a la clase +@param pClasecodigo Codigo de catalogcode correspondiente a la clase +@param pFalta Codigo de catalogo correspondiente a la falta +@param pFaltacodigo Codigo de catalogcode correspondiente a la falta +@param pTipofalta Codigo de catalogo correspondiente al tipo de falta +@param pTipofaltacodigo Codigo de catalogcode correspondiente al tipo de falta +@param pTramite Codigo de catalogo correspondiente al tramite +@param pTramitecodigo Codigo de catalogcode correspondiente al tramite +@param pSancion Codigo de catalogo correspondiente a la sancion +@param pSancioncodigo Codigo de catalogcode correspondiente a la sancion +@param pTiempo Codigo de catalogo correspondiente al tiempo de la sancion en dias +@param pTiempocodigo Codigo de catalogcode correspondiente al tiempo de vigencia de la sancion en dias +*/ +public TarmTipoSancion(String pPk,String pClase,String pClasecodigo,String pFalta,String pFaltacodigo,String pTipofalta,String pTipofaltacodigo,String pTramite,String pTramitecodigo,String pSancion,String pSancioncodigo,String pTiempo,String pTiempocodigo){ + this(); + pk=pPk; + clase=pClase; + clasecodigo=pClasecodigo; + falta=pFalta; + faltacodigo=pFaltacodigo; + tipofalta=pTipofalta; + tipofaltacodigo=pTipofaltacodigo; + tramite=pTramite; + tramitecodigo=pTramitecodigo; + sancion=pSancion; + sancioncodigo=pSancioncodigo; + tiempo=pTiempo; + tiempocodigo=pTiempocodigo; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmTipoSancion +*/ +public static TarmTipoSancion find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmTipoSancion obj = pEntityManager.find(TarmTipoSancion.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmTipoSancion +@return El objeto que referencia a la Clave primaria de TarmTipoSancion +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmTipoSancion +@param pPk El objeto que referencia a la nueva Clave primaria de TarmTipoSancion +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de clase +@return valor de clase*/ +public String getClase(){ + return clase; +} +/**Fija el valor de clase +@param pClase nuevo Valor de clase*/ +public void setClase(String pClase){ + clase=pClase; +} + +/**Obtiene el valor de clasecodigo +@return valor de clasecodigo*/ +public String getClasecodigo(){ + return clasecodigo; +} +/**Fija el valor de clasecodigo +@param pClasecodigo nuevo Valor de clasecodigo*/ +public void setClasecodigo(String pClasecodigo){ + clasecodigo=pClasecodigo; +} + +/**Obtiene el valor de falta +@return valor de falta*/ +public String getFalta(){ + return falta; +} +/**Fija el valor de falta +@param pFalta nuevo Valor de falta*/ +public void setFalta(String pFalta){ + falta=pFalta; +} + +/**Obtiene el valor de faltacodigo +@return valor de faltacodigo*/ +public String getFaltacodigo(){ + return faltacodigo; +} +/**Fija el valor de faltacodigo +@param pFaltacodigo nuevo Valor de faltacodigo*/ +public void setFaltacodigo(String pFaltacodigo){ + faltacodigo=pFaltacodigo; +} + +/**Obtiene el valor de tipofalta +@return valor de tipofalta*/ +public String getTipofalta(){ + return tipofalta; +} +/**Fija el valor de tipofalta +@param pTipofalta nuevo Valor de tipofalta*/ +public void setTipofalta(String pTipofalta){ + tipofalta=pTipofalta; +} + +/**Obtiene el valor de tipofaltacodigo +@return valor de tipofaltacodigo*/ +public String getTipofaltacodigo(){ + return tipofaltacodigo; +} +/**Fija el valor de tipofaltacodigo +@param pTipofaltacodigo nuevo Valor de tipofaltacodigo*/ +public void setTipofaltacodigo(String pTipofaltacodigo){ + tipofaltacodigo=pTipofaltacodigo; +} + +/**Obtiene el valor de tramite +@return valor de tramite*/ +public String getTramite(){ + return tramite; +} +/**Fija el valor de tramite +@param pTramite nuevo Valor de tramite*/ +public void setTramite(String pTramite){ + tramite=pTramite; +} + +/**Obtiene el valor de tramitecodigo +@return valor de tramitecodigo*/ +public String getTramitecodigo(){ + return tramitecodigo; +} +/**Fija el valor de tramitecodigo +@param pTramitecodigo nuevo Valor de tramitecodigo*/ +public void setTramitecodigo(String pTramitecodigo){ + tramitecodigo=pTramitecodigo; +} + +/**Obtiene el valor de sancion +@return valor de sancion*/ +public String getSancion(){ + return sancion; +} +/**Fija el valor de sancion +@param pSancion nuevo Valor de sancion*/ +public void setSancion(String pSancion){ + sancion=pSancion; +} + +/**Obtiene el valor de sancioncodigo +@return valor de sancioncodigo*/ +public String getSancioncodigo(){ + return sancioncodigo; +} +/**Fija el valor de sancioncodigo +@param pSancioncodigo nuevo Valor de sancioncodigo*/ +public void setSancioncodigo(String pSancioncodigo){ + sancioncodigo=pSancioncodigo; +} + +/**Obtiene el valor de tiempo +@return valor de tiempo*/ +public String getTiempo(){ + return tiempo; +} +/**Fija el valor de tiempo +@param pTiempo nuevo Valor de tiempo*/ +public void setTiempo(String pTiempo){ + tiempo=pTiempo; +} + +/**Obtiene el valor de tiempocodigo +@return valor de tiempocodigo*/ +public String getTiempocodigo(){ + return tiempocodigo; +} +/**Fija el valor de tiempocodigo +@param pTiempocodigo nuevo Valor de tiempocodigo*/ +public void setTiempocodigo(String pTiempocodigo){ + tiempocodigo=pTiempocodigo; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmTipoSancion))return false; + TarmTipoSancion that = (TarmTipoSancion) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmTipoSancion +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmTipoSancion +*/ +public Object createInstance(){ + TarmTipoSancion instance=new TarmTipoSancion(); + return instance; +} +/**Clona la entidad TarmTipoSancion +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmTipoSancion p=(TarmTipoSancion)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmTipoTramite.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmTipoTramite.java new file mode 100644 index 0000000..25a3d1b --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmTipoTramite.java @@ -0,0 +1,167 @@ +package com.fp.persistence.parmas.param; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMTIPOTRAMITE*/ +@Entity(name="TarmTipoTramite") +@Table(name="TARMTIPOTRAMITE") +public class TarmTipoTramite extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmTipoTramite +*/ +@Id +@Column(name="CTIPOTRAMITE" ,nullable=false, updatable=false) +private String pk; +@Column(name="NOMBRE", nullable=false) + +/** +* Descripcion del tipo de tramite +*/ +private String nombre; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking del registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TarmTipoTramite(){ +} +/**Contructor de TarmTipoTramite +@param pPk Clave Primaria del entity +@param pNombre Descripcion del tipo de tramite +*/ +public TarmTipoTramite(String pPk,String pNombre){ + this(); + pk=pPk; + nombre=pNombre; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmTipoTramite +*/ +public static TarmTipoTramite find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmTipoTramite obj = pEntityManager.find(TarmTipoTramite.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmTipoTramite +@return El objeto que referencia a la Clave primaria de TarmTipoTramite +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmTipoTramite +@param pPk El objeto que referencia a la nueva Clave primaria de TarmTipoTramite +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de nombre +@return valor de nombre*/ +public String getNombre(){ + return nombre; +} +/**Fija el valor de nombre +@param pNombre nuevo Valor de nombre*/ +public void setNombre(String pNombre){ + nombre=pNombre; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmTipoTramite))return false; + TarmTipoTramite that = (TarmTipoTramite) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmTipoTramite +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmTipoTramite +*/ +public Object createInstance(){ + TarmTipoTramite instance=new TarmTipoTramite(); + return instance; +} +/**Clona la entidad TarmTipoTramite +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmTipoTramite p=(TarmTipoTramite)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmTramite.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmTramite.java new file mode 100644 index 0000000..39e575f --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmTramite.java @@ -0,0 +1,981 @@ +package com.fp.persistence.parmas.param; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMTRAMITE*/ +@Entity(name="TarmTramite") +@Table(name="TARMTRAMITE") +public class TarmTramite extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmTramite +*/ +@Id +@Column(name="CTRAMITE" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CTRAMITE"), + @Parameter(name = "type", value = "java.lang.Long"), + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "16")}) + @GeneratedValue(generator = "seq_id") +private Long pk; +@Column(name="COSTOCUSTODIO", nullable=true) + +/** +* Costo de cada custodio segun el tramite +*/ +private BigDecimal costocustodio; + +@Column(name="TIPOARCHIVOCODIGO", nullable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String tipoarchivocodigo; + +@Column(name="REGISTROGUARDIA", nullable=true) + +/** +* null +*/ +private String registroguardia; + +@Column(name="TIPOTRAMITE", nullable=false) + +/** +* null +*/ +private String tipotramite; + +@Column(name="ESTADOS", nullable=true) + +/** +* campo para validar la busqueda de las armas, segun los estados seleccionados +*/ +private String estados; + +@Column(name="PIE", nullable=true) + +/** +* Detalle del tramite para el pie del reporte +*/ +private String pie; + +@Column(name="CABECERA", nullable=true) + +/** +* Detalle del tramite para la cabecera del reporte +*/ +private String cabecera; + +@Column(name="DOCUMENTOHABILITANTE", nullable=true) + +/** +* null +*/ +private String documentohabilitante; + +@Column(name="REQUIEREEVALUACION", nullable=true) + +/** +* null +*/ +private String requiereevaluacion; + +@Column(name="CATEGORIACODIGO", nullable=false) + +/** +* null +*/ +private String categoriacodigo; + +@Column(name="TIPOPERSONA", nullable=true) + +/** +* null +*/ +private String tipopersona; + +@Column(name="ESTADOFINARMA", nullable=true) + +/** +* se registra el estado final del arma, al finalizar el tramite seleccionado +*/ +private String estadofinarma; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* null +*/ +private Integer recordversion; + +@Column(name="VIGENCIACODIGO", nullable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String vigenciacodigo; + +@Column(name="VIGENCIA", nullable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String vigencia; + +@Column(name="TIPOTRAMITECODIGO", nullable=false) + +/** +* null +*/ +private String tipotramitecodigo; + +@Column(name="FLUJOTRAMITECODE", nullable=true) + +/** +* null +*/ +private String flujotramitecode; + +@Column(name="REQUIEREINSPECCION", nullable=true) + +/** +* null +*/ +private String requiereinspeccion; + +@Column(name="TIPOARCHIVO", nullable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String tipoarchivo; + +@Column(name="USOACTIVIDAD", nullable=false) + +/** +* null +*/ +private String usoactividad; + +@Column(name="TIPOAUTORIZACION", nullable=false) + +/** +* null +*/ +private String tipoautorizacion; + +@Column(name="CTRAMITEPADRE", nullable=true) + +/** +* codigo del tramite padre +*/ +private Long ctramitepadre; + +@Column(name="CTRAMITEPADREALT", nullable=true) + +/** +* codigo del tramite padre alterno +*/ +private Long ctramitepadrealt; + +@Column(name="USOACTIVIDADCODIGO", nullable=false) + +/** +* null +*/ +private String usoactividadcodigo; + +@Column(name="CATEGORIA", nullable=false) + +/** +* null +*/ +private String categoria; + +@Column(name="TIPOAUTORIZACIONCODIGO", nullable=false) + +/** +* null +*/ +private String tipoautorizacioncodigo; + +@Column(name="LOGO", nullable=true) + +/** +* null +*/ +private String logo; + +@Column(name="COSTO", nullable=true) + +/** +* null +*/ +private BigDecimal costo; + +@Column(name="NUMEROMAXARMAS", nullable=true) + +/** +* campo para validar el numero maximo de armas para el tramite asociado +*/ +private Long numeromaxarmas; + +@Column(name="REIMPRESION", nullable=true) + +/** +* campo para validar si requiere reimpresion +*/ +private String reimpresion; + +@Column(name="FLUJOTRAMITE", nullable=true) + +/** +* null +*/ +private String flujotramite; + +@Column(name="MULTA", nullable=true) + +/** +* Multa asignada al tramite +*/ +private BigDecimal multa; + +@Column(name="REGISTROAGENCIASUCURSAL", nullable=true) + +/** +* null +*/ +private String registroagenciasucursal; + +@Column(name="REGISTROARMAS", nullable=true) + +/** +* null +*/ +private String registroarmas; + +@Column(name="TIPOCOSTOCODIGO", nullable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String tipocostocodigo; + +@Column(name="TIPOCOSTO", nullable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String tipocosto; + +@Column(name="SANCIONABLE", nullable=true) + +/** +* null +*/ +private String sancionable; + +@Column(name="TIPOPERSONACODE", nullable=true) + +/** +* null +*/ +private String tipopersonacode; + +@Column(name="CLASE", nullable=true) + +/** +* campo para validar la busqueda de las armas, segun los estados seleccionados +*/ +private String clase; + +@Column(name="VALIDACADUCIDADPADRE", nullable=true) + +/** +* null +*/ +private String validacaducidadpadre; + + +@Column(name="VALIDACADUCIDADPADREALT", nullable=true) + +/** +* null +*/ +private String validacaducidadpadrealt; + +@Column(name="VALIDAFECHAEXPIRACION", nullable=true) + +/** +* null +*/ +private String validaFechaExpiracion; + +@Column(name="VISUALIZARPORFECHAEXPIRACION", nullable=true) + +/** +* null +*/ +private String visualizarPorFechaExpiracion; + +@Column(name="JURISDICCION", nullable=true) + +/** +* null +*/ +private String jurisdiccion; + +@Column(name="JURISDICCIONCODE", nullable=true) + +/** +* null +*/ +private String jurisdiccioncode; + + +@Column(name="TIPOFABRICACION", nullable=true) + +/** +* null +*/ +private String tipofabricacion; + + +/** + * PARA OBTENER EL CATALOGO DE FACTURACION ELECTRONICA + */ +@Column(name="SERVICIO", nullable=true) + +private String servicio; + + + + +/**Contructor por defecto*/ +public TarmTramite(){ +} +/**Contructor de TarmTramite +@param pPk Clave Primaria del entity +@param pTipoarchivocodigo Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +@param pTipotramite null +@param pCategoriacodigo null +@param pVigenciacodigo Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +@param pVigencia Codigo de catalogo 01 Natural, 02 Juridico +@param pTipotramitecodigo null +@param pTipoarchivo Codigo de catalogo 01 Natural, 02 Juridico +@param pUsoactividad null +@param pTipoautorizacion null +@param pUsoactividadcodigo null +@param pCategoria null +@param pTipoautorizacioncodigo null +@param pTipocostocodigo Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +@param pTipocosto Codigo de catalogo 01 Natural, 02 Juridico +*/ + + +public TarmTramite(Long pPk,String pTipoarchivocodigo,String pTipotramite,String pCategoriacodigo,String pVigenciacodigo,String pVigencia,String pTipotramitecodigo,String pTipoarchivo,String pUsoactividad,String pTipoautorizacion,String pUsoactividadcodigo,String pCategoria,String pTipoautorizacioncodigo,String pTipocostocodigo,String pTipocosto, String pServicios){ + this(); + pk=pPk; + tipoarchivocodigo=pTipoarchivocodigo; + tipotramite=pTipotramite; + categoriacodigo=pCategoriacodigo; + vigenciacodigo=pVigenciacodigo; + vigencia=pVigencia; + tipotramitecodigo=pTipotramitecodigo; + tipoarchivo=pTipoarchivo; + usoactividad=pUsoactividad; + tipoautorizacion=pTipoautorizacion; + usoactividadcodigo=pUsoactividadcodigo; + categoria=pCategoria; + tipoautorizacioncodigo=pTipoautorizacioncodigo; + tipocostocodigo=pTipocostocodigo; + tipocosto=pTipocosto; + servicio=pServicios; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmTramite +*/ +public static TarmTramite find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmTramite obj = pEntityManager.find(TarmTramite.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmTramite +@return El objeto que referencia a la Clave primaria de TarmTramite +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmTramite +@param pPk El objeto que referencia a la nueva Clave primaria de TarmTramite +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de costocustodio +@return valor de costocustodio*/ +public BigDecimal getCostocustodio(){ + return costocustodio; +} +/**Fija el valor de costocustodio +@param pCostocustodio nuevo Valor de costocustodio*/ +public void setCostocustodio(BigDecimal pCostocustodio){ + costocustodio=pCostocustodio; +} + +/**Obtiene el valor de tipoarchivocodigo +@return valor de tipoarchivocodigo*/ +public String getTipoarchivocodigo(){ + return tipoarchivocodigo; +} +/**Fija el valor de tipoarchivocodigo +@param pTipoarchivocodigo nuevo Valor de tipoarchivocodigo*/ +public void setTipoarchivocodigo(String pTipoarchivocodigo){ + tipoarchivocodigo=pTipoarchivocodigo; +} + +/**Obtiene el valor de registroguardia +@return valor de registroguardia*/ +public String getRegistroguardia(){ + return registroguardia; +} +/**Fija el valor de registroguardia +@param pRegistroguardia nuevo Valor de registroguardia*/ +public void setRegistroguardia(String pRegistroguardia){ + registroguardia=pRegistroguardia; +} + +/**Obtiene el valor de tipotramite +@return valor de tipotramite*/ +public String getTipotramite(){ + return tipotramite; +} +/**Fija el valor de tipotramite +@param pTipotramite nuevo Valor de tipotramite*/ +public void setTipotramite(String pTipotramite){ + tipotramite=pTipotramite; +} + +/**Obtiene el valor de estados +@return valor de estados*/ +public String getEstados(){ + return estados; +} +/**Fija el valor de estados +@param pEstados nuevo Valor de estados*/ +public void setEstados(String pEstados){ + estados=pEstados; +} + +/**Obtiene el valor de pie +@return valor de pie*/ +public String getPie(){ + return pie; +} +/**Fija el valor de pie +@param pPie nuevo Valor de pie*/ +public void setPie(String pPie){ + pie=pPie; +} + +/**Obtiene el valor de cabecera +@return valor de cabecera*/ +public String getCabecera(){ + return cabecera; +} +/**Fija el valor de cabecera +@param pCabecera nuevo Valor de cabecera*/ +public void setCabecera(String pCabecera){ + cabecera=pCabecera; +} + +/**Obtiene el valor de documentohabilitante +@return valor de documentohabilitante*/ +public String getDocumentohabilitante(){ + return documentohabilitante; +} +/**Fija el valor de documentohabilitante +@param pDocumentohabilitante nuevo Valor de documentohabilitante*/ +public void setDocumentohabilitante(String pDocumentohabilitante){ + documentohabilitante=pDocumentohabilitante; +} + +/**Obtiene el valor de requiereevaluacion +@return valor de requiereevaluacion*/ +public String getRequiereevaluacion(){ + return requiereevaluacion; +} +/**Fija el valor de requiereevaluacion +@param pRequiereevaluacion nuevo Valor de requiereevaluacion*/ +public void setRequiereevaluacion(String pRequiereevaluacion){ + requiereevaluacion=pRequiereevaluacion; +} + +/**Obtiene el valor de categoriacodigo +@return valor de categoriacodigo*/ +public String getCategoriacodigo(){ + return categoriacodigo; +} +/**Fija el valor de categoriacodigo +@param pCategoriacodigo nuevo Valor de categoriacodigo*/ +public void setCategoriacodigo(String pCategoriacodigo){ + categoriacodigo=pCategoriacodigo; +} + +/**Obtiene el valor de tipopersona +@return valor de tipopersona*/ +public String getTipopersona(){ + return tipopersona; +} +/**Fija el valor de tipopersona +@param pTipopersona nuevo Valor de tipopersona*/ +public void setTipopersona(String pTipopersona){ + tipopersona=pTipopersona; +} + +/**Obtiene el valor de estadofinarma +@return valor de estadofinarma*/ +public String getEstadofinarma(){ + return estadofinarma; +} +/**Fija el valor de estadofinarma +@param pEstadofinarma nuevo Valor de estadofinarma*/ +public void setEstadofinarma(String pEstadofinarma){ + estadofinarma=pEstadofinarma; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de vigenciacodigo +@return valor de vigenciacodigo*/ +public String getVigenciacodigo(){ + return vigenciacodigo; +} +/**Fija el valor de vigenciacodigo +@param pVigenciacodigo nuevo Valor de vigenciacodigo*/ +public void setVigenciacodigo(String pVigenciacodigo){ + vigenciacodigo=pVigenciacodigo; +} + +/**Obtiene el valor de vigencia +@return valor de vigencia*/ +public String getVigencia(){ + return vigencia; +} +/**Fija el valor de vigencia +@param pVigencia nuevo Valor de vigencia*/ +public void setVigencia(String pVigencia){ + vigencia=pVigencia; +} + +/**Obtiene el valor de tipotramitecodigo +@return valor de tipotramitecodigo*/ +public String getTipotramitecodigo(){ + return tipotramitecodigo; +} +/**Fija el valor de tipotramitecodigo +@param pTipotramitecodigo nuevo Valor de tipotramitecodigo*/ +public void setTipotramitecodigo(String pTipotramitecodigo){ + tipotramitecodigo=pTipotramitecodigo; +} + +/**Obtiene el valor de flujotramitecode +@return valor de flujotramitecode*/ +public String getFlujotramitecode(){ + return flujotramitecode; +} +/**Fija el valor de flujotramitecode +@param pFlujotramitecode nuevo Valor de flujotramitecode*/ +public void setFlujotramitecode(String pFlujotramitecode){ + flujotramitecode=pFlujotramitecode; +} + +/**Obtiene el valor de requiereinspeccion +@return valor de requiereinspeccion*/ +public String getRequiereinspeccion(){ + return requiereinspeccion; +} +/**Fija el valor de requiereinspeccion +@param pRequiereinspeccion nuevo Valor de requiereinspeccion*/ +public void setRequiereinspeccion(String pRequiereinspeccion){ + requiereinspeccion=pRequiereinspeccion; +} + +/**Obtiene el valor de tipoarchivo +@return valor de tipoarchivo*/ +public String getTipoarchivo(){ + return tipoarchivo; +} +/**Fija el valor de tipoarchivo +@param pTipoarchivo nuevo Valor de tipoarchivo*/ +public void setTipoarchivo(String pTipoarchivo){ + tipoarchivo=pTipoarchivo; +} + +/**Obtiene el valor de usoactividad +@return valor de usoactividad*/ +public String getUsoactividad(){ + return usoactividad; +} +/**Fija el valor de usoactividad +@param pUsoactividad nuevo Valor de usoactividad*/ +public void setUsoactividad(String pUsoactividad){ + usoactividad=pUsoactividad; +} + +/**Obtiene el valor de tipoautorizacion +@return valor de tipoautorizacion*/ +public String getTipoautorizacion(){ + return tipoautorizacion; +} +/**Fija el valor de tipoautorizacion +@param pTipoautorizacion nuevo Valor de tipoautorizacion*/ +public void setTipoautorizacion(String pTipoautorizacion){ + tipoautorizacion=pTipoautorizacion; +} + +/**Obtiene el valor de ctramitepadre +@return valor de ctramitepadre*/ +public Long getCtramitepadre(){ + return ctramitepadre; +} +/**Fija el valor de ctramitepadre +@param pCtramitepadre nuevo Valor de ctramitepadre*/ +public void setCtramitepadre(Long pCtramitepadre){ + ctramitepadre=pCtramitepadre; +} +/**Obtiene el valor de ctramitepadrealt +@return valor de ctramitepadrealt*/ +public Long getCtramitepadrealt() { + return ctramitepadrealt; +} +/**Fija el valor de ctramitepadrealt +@param pCtramitepadre nuevo Valor de ctramitepadrealt*/ +public void setCtramitepadrealt(Long ctramitepadrealt) { + this.ctramitepadrealt = ctramitepadrealt; +} +/**Obtiene el valor de usoactividadcodigo +@return valor de usoactividadcodigo*/ +public String getUsoactividadcodigo(){ + return usoactividadcodigo; +} +/**Fija el valor de usoactividadcodigo +@param pUsoactividadcodigo nuevo Valor de usoactividadcodigo*/ +public void setUsoactividadcodigo(String pUsoactividadcodigo){ + usoactividadcodigo=pUsoactividadcodigo; +} + +/**Obtiene el valor de categoria +@return valor de categoria*/ +public String getCategoria(){ + return categoria; +} +/**Fija el valor de categoria +@param pCategoria nuevo Valor de categoria*/ +public void setCategoria(String pCategoria){ + categoria=pCategoria; +} + +/**Obtiene el valor de tipoautorizacioncodigo +@return valor de tipoautorizacioncodigo*/ +public String getTipoautorizacioncodigo(){ + return tipoautorizacioncodigo; +} +/**Fija el valor de tipoautorizacioncodigo +@param pTipoautorizacioncodigo nuevo Valor de tipoautorizacioncodigo*/ +public void setTipoautorizacioncodigo(String pTipoautorizacioncodigo){ + tipoautorizacioncodigo=pTipoautorizacioncodigo; +} + +/**Obtiene el valor de logo +@return valor de logo*/ +public String getLogo(){ + return logo; +} +/**Fija el valor de logo +@param pLogo nuevo Valor de logo*/ +public void setLogo(String pLogo){ + logo=pLogo; +} + +/**Obtiene el valor de costo +@return valor de costo*/ +public BigDecimal getCosto(){ + return costo; +} +/**Fija el valor de costo +@param pCosto nuevo Valor de costo*/ +public void setCosto(BigDecimal pCosto){ + costo=pCosto; +} + +/**Obtiene el valor de numeromaxarmas +@return valor de numeromaxarmas*/ +public Long getNumeromaxarmas(){ + return numeromaxarmas; +} +/**Fija el valor de numeromaxarmas +@param pNumeromaxarmas nuevo Valor de numeromaxarmas*/ +public void setNumeromaxarmas(Long pNumeromaxarmas){ + numeromaxarmas=pNumeromaxarmas; +} + +/**Obtiene el valor de reimpresion +@return valor de reimpresion*/ +public String getReimpresion(){ + return reimpresion; +} +/**Fija el valor de reimpresion +@param pReimpresion nuevo Valor de reimpresion*/ +public void setReimpresion(String pReimpresion){ + reimpresion=pReimpresion; +} + +/**Obtiene el valor de flujotramite +@return valor de flujotramite*/ +public String getFlujotramite(){ + return flujotramite; +} +/**Fija el valor de flujotramite +@param pFlujotramite nuevo Valor de flujotramite*/ +public void setFlujotramite(String pFlujotramite){ + flujotramite=pFlujotramite; +} + +/**Obtiene el valor de multa +@return valor de multa*/ +public BigDecimal getMulta(){ + return multa; +} +/**Fija el valor de multa +@param pMulta nuevo Valor de multa*/ +public void setMulta(BigDecimal pMulta){ + multa=pMulta; +} + +/**Obtiene el valor de registroagenciasucursal +@return valor de registroagenciasucursal*/ +public String getRegistroagenciasucursal(){ + return registroagenciasucursal; +} +/**Fija el valor de registroagenciasucursal +@param pRegistroagenciasucursal nuevo Valor de registroagenciasucursal*/ +public void setRegistroagenciasucursal(String pRegistroagenciasucursal){ + registroagenciasucursal=pRegistroagenciasucursal; +} + +/**Obtiene el valor de registroarmas +@return valor de registroarmas*/ +public String getRegistroarmas(){ + return registroarmas; +} +/**Fija el valor de registroarmas +@param pRegistroarmas nuevo Valor de registroarmas*/ +public void setRegistroarmas(String pRegistroarmas){ + registroarmas=pRegistroarmas; +} + +/**Obtiene el valor de tipocostocodigo +@return valor de tipocostocodigo*/ +public String getTipocostocodigo(){ + return tipocostocodigo; +} +/**Fija el valor de tipocostocodigo +@param pTipocostocodigo nuevo Valor de tipocostocodigo*/ +public void setTipocostocodigo(String pTipocostocodigo){ + tipocostocodigo=pTipocostocodigo; +} + +/**Obtiene el valor de tipocosto +@return valor de tipocosto*/ +public String getTipocosto(){ + return tipocosto; +} +/**Fija el valor de tipocosto +@param pTipocosto nuevo Valor de tipocosto*/ +public void setTipocosto(String pTipocosto){ + tipocosto=pTipocosto; +} + +/**Obtiene el valor de sancionable +@return valor de sancionable*/ +public String getSancionable(){ + return sancionable; +} +/**Fija el valor de sancionable +@param pSancionable nuevo Valor de sancionable*/ +public void setSancionable(String pSancionable){ + sancionable=pSancionable; +} + +/**Obtiene el valor de tipopersonacode +@return valor de tipopersonacode*/ +public String getTipopersonacode(){ + return tipopersonacode; +} +/**Fija el valor de tipopersonacode +@param pTipopersonacode nuevo Valor de tipopersonacode*/ +public void setTipopersonacode(String pTipopersonacode){ + tipopersonacode=pTipopersonacode; +} + +public String getClase() { + return clase; +} +public void setClase(String clase) { + this.clase = clase; +} +public String getValidacaducidadpadre() { + return validacaducidadpadre; +} +public void setValidacaducidadpadre(String validacaducidadpadre) { + this.validacaducidadpadre = validacaducidadpadre; +} +public String getValidacaducidadpadrealt() { + return validacaducidadpadrealt; +} +public void setValidacaducidadpadrealt(String validacaducidadpadrealt) { + this.validacaducidadpadrealt = validacaducidadpadrealt; +} + +public String getVisualizarPorFechaExpiracion() { + return visualizarPorFechaExpiracion; +} +public void setVisualizarPorFechaExpiracion(String visualizarPorFechaExpiracion) { + this.visualizarPorFechaExpiracion = visualizarPorFechaExpiracion; +} +public String getValidaFechaExpiracion() { + return validaFechaExpiracion; +} +public void setValidaFechaExpiracion(String validaFechaExpiracion) { + this.validaFechaExpiracion = validaFechaExpiracion; +} + +public String getJurisdiccion() { + return jurisdiccion; +} +public void setJurisdiccion(String jurisdiccion) { + this.jurisdiccion = jurisdiccion; +} + +public String getJurisdiccioncode() { + return jurisdiccioncode; +} +public void setJurisdiccioncode(String jurisdiccioncode) { + this.jurisdiccioncode = jurisdiccioncode; +} +public String getTipofabricacion() { + return tipofabricacion; +} +public void setTipofabricacion(String tipofabricacion) { + this.tipofabricacion = tipofabricacion; +} + + public void setServicio(String servicio) { + this.servicio = servicio; + } + + public String getServicio() { + return servicio; + } + + + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmTramite))return false; + TarmTramite that = (TarmTramite) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmTramite +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmTramite +*/ +public Object createInstance(){ + TarmTramite instance=new TarmTramite(); + return instance; +} +/**Clona la entidad TarmTramite +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmTramite p=(TarmTramite)this.clone(); + return p; +} + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmTramitesAtendidos.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmTramitesAtendidos.java new file mode 100644 index 0000000..9886c06 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmTramitesAtendidos.java @@ -0,0 +1,214 @@ +package com.fp.persistence.parmas.param; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMTRAMITESATENDIDOS*/ +@Entity(name="TarmTramitesAtendidos") +@Table(name="TARMTRAMITESATENDIDOS") +public class TarmTramitesAtendidos extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmTramitesAtendidos +*/ +@Id +@Column(name="CTRAMITEATENDIDO" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CTRAMITEATENDIDO"), + @Parameter(name = "type", value = "java.lang.Long"), + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "16")}) + @GeneratedValue(generator = "seq_id") +private Long pk; +@Column(name="CCENTROCONTROL", nullable=false) + +/** +* Clave foranea del centro de control referido +*/ +private String ccentrocontrol; + +@Column(name="CTRAMITE", nullable=false) + +/** +* Clave foranea del codio de tramite referido +*/ +private Long ctramite; + +@Column(name="FECHAREGISTRO", nullable=false) + +/** +* Fecha en que se ingresa el registro +*/ +private Date fecharegistro; + +@Column(name="FECHAATENCION", nullable=false) + +/** +* Fecha programada para la tencion del tramite por el centro de control +*/ +private Date fechaatencion; + +/**Contructor por defecto*/ +public TarmTramitesAtendidos(){ +} +/**Contructor de TarmTramitesAtendidos +@param pPk Clave Primaria del entity +@param pCcentrocontrol Clave foranea del centro de control referido +@param pCtramite Clave foranea del codio de tramite referido +@param pFecharegistro Fecha en que se ingresa el registro +@param pFechaatencion Fecha programada para la tencion del tramite por el centro de control +*/ +public TarmTramitesAtendidos(Long pPk,String pCcentrocontrol,Long pCtramite,Date pFecharegistro,Date pFechaatencion){ + this(); + pk=pPk; + ccentrocontrol=pCcentrocontrol; + ctramite=pCtramite; + fecharegistro=pFecharegistro; + fechaatencion=pFechaatencion; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmTramitesAtendidos +*/ +public static TarmTramitesAtendidos find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmTramitesAtendidos obj = pEntityManager.find(TarmTramitesAtendidos.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmTramitesAtendidos +@return El objeto que referencia a la Clave primaria de TarmTramitesAtendidos +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmTramitesAtendidos +@param pPk El objeto que referencia a la nueva Clave primaria de TarmTramitesAtendidos +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de ccentrocontrol +@return valor de ccentrocontrol*/ +public String getCcentrocontrol(){ + return ccentrocontrol; +} +/**Fija el valor de ccentrocontrol +@param pCcentrocontrol nuevo Valor de ccentrocontrol*/ +public void setCcentrocontrol(String pCcentrocontrol){ + ccentrocontrol=pCcentrocontrol; +} + +/**Obtiene el valor de ctramite +@return valor de ctramite*/ +public Long getCtramite(){ + return ctramite; +} +/**Fija el valor de ctramite +@param pCtramite nuevo Valor de ctramite*/ +public void setCtramite(Long pCtramite){ + ctramite=pCtramite; +} + +/**Obtiene el valor de fecharegistro +@return valor de fecharegistro*/ +public Date getFecharegistro(){ + return fecharegistro; +} +/**Fija el valor de fecharegistro +@param pFecharegistro nuevo Valor de fecharegistro*/ +public void setFecharegistro(Date pFecharegistro){ + fecharegistro=pFecharegistro; +} + +/**Obtiene el valor de fechaatencion +@return valor de fechaatencion*/ +public Date getFechaatencion(){ + return fechaatencion; +} +/**Fija el valor de fechaatencion +@param pFechaatencion nuevo Valor de fechaatencion*/ +public void setFechaatencion(Date pFechaatencion){ + fechaatencion=pFechaatencion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmTramitesAtendidos))return false; + TarmTramitesAtendidos that = (TarmTramitesAtendidos) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmTramitesAtendidos +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmTramitesAtendidos +*/ +public Object createInstance(){ + TarmTramitesAtendidos instance=new TarmTramitesAtendidos(); + return instance; +} +/**Clona la entidad TarmTramitesAtendidos +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmTramitesAtendidos p=(TarmTramitesAtendidos)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmUnidadTipo.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmUnidadTipo.java new file mode 100644 index 0000000..598ea45 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmUnidadTipo.java @@ -0,0 +1,168 @@ +package com.fp.persistence.parmas.param; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMUNIDADTIPO*/ +@Entity(name="TarmUnidadTipo") +@Table(name="TARMUNIDADTIPO") +public class TarmUnidadTipo extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmUnidadTipo +*/ +@EmbeddedId +private TarmUnidadTipoKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Versin del Registro +*/ +private Integer recordversion; + +@Column(name="FECHAREGISTRO", nullable=true) + +/** +* Fecha de Registro +*/ +private Date fecharegistro; + +/**Contructor por defecto*/ +public TarmUnidadTipo(){ +} +/**Contructor de TarmUnidadTipo +@param pPk Clave Primaria del entity +*/ +public TarmUnidadTipo(TarmUnidadTipoKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmUnidadTipo +*/ +public static TarmUnidadTipo find(EntityManager pEntityManager,TarmUnidadTipoKey pKey) throws Exception{ + TarmUnidadTipo obj = pEntityManager.find(TarmUnidadTipo.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmUnidadTipo +@return El objeto que referencia a la Clave primaria de TarmUnidadTipo +*/ +public TarmUnidadTipoKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmUnidadTipo +@param pPk El objeto que referencia a la nueva Clave primaria de TarmUnidadTipo +*/ +public void setPk(TarmUnidadTipoKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de fecharegistro +@return valor de fecharegistro*/ +public Date getFecharegistro(){ + return fecharegistro; +} +/**Fija el valor de fecharegistro +@param pFecharegistro nuevo Valor de fecharegistro*/ +public void setFecharegistro(Date pFecharegistro){ + fecharegistro=pFecharegistro; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmUnidadTipo))return false; + TarmUnidadTipo that = (TarmUnidadTipo) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmUnidadTipo +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmUnidadTipo +*/ +public Object createInstance(){ + TarmUnidadTipo instance=new TarmUnidadTipo(); + instance.setPk(new TarmUnidadTipoKey()); + return instance; +} +/**Clona la entidad TarmUnidadTipo +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmUnidadTipo p=(TarmUnidadTipo)this.clone(); + p.setPk((TarmUnidadTipoKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmUnidadTipoKey.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmUnidadTipoKey.java new file mode 100644 index 0000000..30c9abc --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/param/TarmUnidadTipoKey.java @@ -0,0 +1,234 @@ +package com.fp.persistence.parmas.param; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMUNIDADTIPO*/ +@Embeddable +public class TarmUnidadTipoKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CLASE", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Explosivo, 02 Arma de Fuego +*/ +private String clase; + +@Column(name="CLASECODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de clase de arma +*/ +private String clasecode; + +@Column(name="TIPOARMAEXPLOSIVO", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Revolver, 02 Polvora +*/ +private String tipoarmaexplosivo; + +@Column(name="TIPOARMAEXPLOSIVOCODIGO", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de armaexplosivo +*/ +private String tipoarmaexplosivocodigo; + +@Column(name="UNIDADMEDIDAPESO", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 KG, 02 Unidad +*/ +private String unidadmedidapeso; + +@Column(name="UNIDADMEDIDAPESOCODIGO", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de unidad peso + +*/ +private String unidadmedidapesocodigo; + +/**Contructor por defecto*/ +public TarmUnidadTipoKey(){} +/**Contructor de TarmUnidadTipoKey +@param pClase Codigo de catalogo 01 Explosivo, 02 Arma de Fuego +@param pClasecode Codigo de tabla de catalogo 01 Codigo de tabla de clase de arma +@param pTipoarmaexplosivo Codigo de catalogo 01 Revolver, 02 Polvora +@param pTipoarmaexplosivocodigo Codigo de tabla de catalogo 01 Codigo de tabla de tipos de armaexplosivo +@param pUnidadmedidapeso Codigo de catalogo 01 KG, 02 Unidad +@param pUnidadmedidapesocodigo Codigo de tabla de catalogo 01 Codigo de tabla de tipos de unidad peso + +*/ +public TarmUnidadTipoKey(String pClase,String pClasecode,String pTipoarmaexplosivo,String pTipoarmaexplosivocodigo,String pUnidadmedidapeso,String pUnidadmedidapesocodigo){ + clase=pClase; + clasecode=pClasecode; + tipoarmaexplosivo=pTipoarmaexplosivo; + tipoarmaexplosivocodigo=pTipoarmaexplosivocodigo; + unidadmedidapeso=pUnidadmedidapeso; + unidadmedidapesocodigo=pUnidadmedidapesocodigo; +} +/**Obtiene el valor de clase +@return valor de clase*/ +public String getClase(){ + return clase; +} +/**Fija el valor de clase +@param pClase nuevo Valor de clase*/ +public void setClase(String pClase){ + clase=pClase; +} + +/**Obtiene el valor de clasecode +@return valor de clasecode*/ +public String getClasecode(){ + return clasecode; +} +/**Fija el valor de clasecode +@param pClasecode nuevo Valor de clasecode*/ +public void setClasecode(String pClasecode){ + clasecode=pClasecode; +} + +/**Obtiene el valor de tipoarmaexplosivo +@return valor de tipoarmaexplosivo*/ +public String getTipoarmaexplosivo(){ + return tipoarmaexplosivo; +} +/**Fija el valor de tipoarmaexplosivo +@param pTipoarmaexplosivo nuevo Valor de tipoarmaexplosivo*/ +public void setTipoarmaexplosivo(String pTipoarmaexplosivo){ + tipoarmaexplosivo=pTipoarmaexplosivo; +} + +/**Obtiene el valor de tipoarmaexplosivocodigo +@return valor de tipoarmaexplosivocodigo*/ +public String getTipoarmaexplosivocodigo(){ + return tipoarmaexplosivocodigo; +} +/**Fija el valor de tipoarmaexplosivocodigo +@param pTipoarmaexplosivocodigo nuevo Valor de tipoarmaexplosivocodigo*/ +public void setTipoarmaexplosivocodigo(String pTipoarmaexplosivocodigo){ + tipoarmaexplosivocodigo=pTipoarmaexplosivocodigo; +} + +/**Obtiene el valor de unidadmedidapeso +@return valor de unidadmedidapeso*/ +public String getUnidadmedidapeso(){ + return unidadmedidapeso; +} +/**Fija el valor de unidadmedidapeso +@param pUnidadmedidapeso nuevo Valor de unidadmedidapeso*/ +public void setUnidadmedidapeso(String pUnidadmedidapeso){ + unidadmedidapeso=pUnidadmedidapeso; +} + +/**Obtiene el valor de unidadmedidapesocodigo +@return valor de unidadmedidapesocodigo*/ +public String getUnidadmedidapesocodigo(){ + return unidadmedidapesocodigo; +} +/**Fija el valor de unidadmedidapesocodigo +@param pUnidadmedidapesocodigo nuevo Valor de unidadmedidapesocodigo*/ +public void setUnidadmedidapesocodigo(String pUnidadmedidapesocodigo){ + unidadmedidapesocodigo=pUnidadmedidapesocodigo; +} + +/**Implementacion de la comparacion de TarmUnidadTipoKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmUnidadTipoKey))return false; + TarmUnidadTipoKey that = (TarmUnidadTipoKey) o; + if (this.getClase() == null || that.getClase() == null){ + return false; + } + if (! this.getClase().equals(that.getClase())){ + return false; + } + if (this.getClasecode() == null || that.getClasecode() == null){ + return false; + } + if (! this.getClasecode().equals(that.getClasecode())){ + return false; + } + if (this.getTipoarmaexplosivo() == null || that.getTipoarmaexplosivo() == null){ + return false; + } + if (! this.getTipoarmaexplosivo().equals(that.getTipoarmaexplosivo())){ + return false; + } + if (this.getTipoarmaexplosivocodigo() == null || that.getTipoarmaexplosivocodigo() == null){ + return false; + } + if (! this.getTipoarmaexplosivocodigo().equals(that.getTipoarmaexplosivocodigo())){ + return false; + } + if (this.getUnidadmedidapeso() == null || that.getUnidadmedidapeso() == null){ + return false; + } + if (! this.getUnidadmedidapeso().equals(that.getUnidadmedidapeso())){ + return false; + } + if (this.getUnidadmedidapesocodigo() == null || that.getUnidadmedidapesocodigo() == null){ + return false; + } + if (! this.getUnidadmedidapesocodigo().equals(that.getUnidadmedidapesocodigo())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmUnidadTipoKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getClase() == null ? 0 : this.getClase().hashCode()); + result = result * 37 + (this.getClasecode() == null ? 0 : this.getClasecode().hashCode()); + result = result * 37 + (this.getTipoarmaexplosivo() == null ? 0 : this.getTipoarmaexplosivo().hashCode()); + result = result * 37 + (this.getTipoarmaexplosivocodigo() == null ? 0 : this.getTipoarmaexplosivocodigo().hashCode()); + result = result * 37 + (this.getUnidadmedidapeso() == null ? 0 : this.getUnidadmedidapeso().hashCode()); + result = result * 37 + (this.getUnidadmedidapesocodigo() == null ? 0 : this.getUnidadmedidapesocodigo().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/entries b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/entries new file mode 100644 index 0000000..3f7053e --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/entries @@ -0,0 +1,1456 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli +svn://172.17.26.185/COMACO + + + +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TarmCustodiaTemporal.java +file + + + + +2022-07-28T03:40:28.016739Z +75d7572fc40944cc7b40b87cbff4cd9a +2015-01-08T09:24:45.800079Z +3722 +cpiedra + + + + + + + + + + + + + + + + + + + + + +14102 + +TarmSancionRecomendacion.java +file + + + + +2022-07-28T03:40:28.016739Z +829570e5b81cccd4206def9153c5c857 +2015-01-08T09:24:45.800079Z +3722 +cpiedra + + + + + + + + + + + + + + + + + + + + + +5474 + +TarmBodega.java +file + + + + +2022-07-28T03:40:28.016739Z +901180375866af7e0a1232318cb0104c +2015-01-08T09:24:45.800079Z +3722 +cpiedra + + + + + + + + + + + + + + + + + + + + + +4263 + +TarmSolicitudTramite.java +file + + + + +2022-07-28T03:40:28.016739Z +d45412364bbefafa5a16075df6f5acb1 +2021-12-29T13:50:49.591275Z +4660 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +13206 + +TarmSancionDecomisoKey.java +file + + + + +2022-07-28T03:40:28.017739Z +b0365c9d8b55c50e319260c4cbcd52ac +2014-12-18T11:41:31.502002Z +3593 +acevallos + + + + + + + + + + + + + + + + + + + + + +3636 + +TarmSolicitudDocumentoKey.java +file + + + + +2022-07-28T03:40:28.017739Z +1e2f526977d562157faba66b25919cee +2014-11-05T08:07:28.933878Z +2347 +acevallos +has-props + + + + + + + + + + + + + + + + + + + + +3559 + +TarmSolicitudRequisitos.java +file + + + + +2022-07-28T03:40:28.017739Z +4b338d9c55f9847b1ce18b7e9f849d3c +2015-01-08T09:24:45.800079Z +3722 +cpiedra +has-props + + + + + + + + + + + + + + + + + + + + +5173 + +TarmDocumentoHabilitanteDetall.java +file + + + + +2022-07-28T03:40:28.018739Z +3e1f15a537ff65924e69406b4cfc1106 +2015-01-08T12:13:59.030479Z +3730 +cguzman + + + + + + + + + + + + + + + + + + + + + +5588 + +TarmSolicitudGuardiasKey.java +file + + + + +2022-07-28T03:40:28.018739Z +28e364579d62fd3a143725f0eabfe8c4 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +4228 + +TarmSolicitudArmasKey.java +file + + + + +2022-07-28T03:40:28.018739Z +571e4f6d0c848789192e7505cdc35420 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +4145 + +TarmSolicitud.java +file + + + + +2022-07-28T03:40:28.019739Z +9622e0d284ae5b600e61ef1c4dd9282b +2015-12-29T13:58:56.911893Z +4357 +fpazmino +has-props + + + + + + + + + + + + + + + + + + + + +15473 + +TarmCertificadoArmas.java +file + + + + +2022-07-28T03:40:28.019739Z +07ce21bcfcb48e375f0941151f1acf3f +2016-01-20T17:08:28.980461Z +4390 +mcepeda + + + + + + + + + + + + + + + + + + + + + +8933 + +TarmTerminos.java +file + + + + +2022-07-28T03:40:28.019739Z +7da156e9cfe9c27454ab8440d1bbfde7 +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +4573 + +TarmSolicitudAgenciaSucursalKey.java +file + + + + +2022-07-28T03:40:28.020739Z +16edfd2c571cf1a58942c400c815e880 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +3535 + +TarmDecomiso.java +file + + + + +2022-07-28T03:40:28.020739Z +5ec8aa8426cb270b55557c634f5466cf +2016-02-15T20:49:58.089845Z +4450 +cvasquez + + + + + + + + + + + + + + + + + + + + + +17411 + +TarmInspeccionArchivo.java +file + + + + +2022-07-28T03:40:28.020739Z +ef7bd125fd84618c40fb61f74c10fd6b +2021-12-29T13:50:49.591275Z +4660 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +6152 + +TarmOrdenTrabajoCustodios.java +file + + + + +2022-07-28T03:40:28.021739Z +7095a2e9eda0ce6023734b7e67023e0c +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +7353 + +TarmTransaccionArmaBodega.java +file + + + + +2022-07-28T03:40:28.021739Z +ac9b7b86ebd73a828e71307c6eac22a7 +2015-01-08T09:24:45.800079Z +3722 +cpiedra + + + + + + + + + + + + + + + + + + + + + +7707 + +TarmCertificadoFiscalia.java +file + + + + +2022-07-28T03:40:28.022739Z +a99adc08ed6b2bafc364203ac1ac7271 +2016-01-20T17:08:28.980461Z +4390 +mcepeda + + + + + + + + + + + + + + + + + + + + + +7655 + +TarmCertificadoArmasKey.java +file + + + + +2022-07-28T03:40:28.022739Z +7af2efe500a13ec3e07746b646bf7092 +2015-08-03T04:31:16.511388Z +4245 +fpazmino + + + + + + + + + + + + + + + + + + + + + +4134 + +TarmOrdenTrabajo.java +file + + + + +2022-07-28T03:40:28.023739Z +19ed3a685d749de09cceffe86ae5657e +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +8166 + +TarmDocumentoAlfresco.java +file + + + + +2022-07-28T03:40:28.023739Z +5857b67a7d7c6ec71454003ca44e6a6c +2016-01-20T17:08:28.980461Z +4390 +mcepeda + + + + + + + + + + + + + + + + + + + + + +5651 + +TarmSancionDecomiso.java +file + + + + +2022-07-28T03:40:28.024739Z +d7d0e4cd2284c71c2c054bf7fc6f0b52 +2015-01-08T09:24:45.800079Z +3722 +cpiedra + + + + + + + + + + + + + + + + + + + + + +6922 + +TarmSolicitudDocumento.java +file + + + + +2022-07-28T03:40:28.023739Z +e1372c2083db2fd53d2f31d9ec9043f5 +2015-01-08T09:24:45.800079Z +3722 +cpiedra + + + + + + + + + + + + + + + + + + + + + +5164 + +TarmSolicitudGuardias.java +file + + + + +2022-07-28T03:40:28.024739Z +e92d6755da53c5150625c91610b7d2e9 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +3891 + +TarmSolicitudArmas.java +file + + + + +2022-07-28T03:40:28.025739Z +1778d7863e8a8a8a4d44600bba445f50 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +4916 + +TarmAgenciaArma.java +file + + + + +2022-07-28T03:40:28.025739Z +9eeb59a6451231bcc13c53555e51cc92 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +3730 + +TarmDecomisoArmaTransaccion.java +file + + + + +2022-07-28T03:40:28.025739Z +0c88aced76c2090f76e364f3c08a88e4 +2016-02-15T20:38:39.952729Z +4449 +cvasquez + + + + + + + + + + + + + + + + + + + + + +7148 + +TarmSolicitudAgenciaSucursal.java +file + + + + +2022-07-28T03:40:28.026739Z +1333117f9793e9e7ac17651ea6007614 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +4915 + +TarmDetRepDestruirArmas.java +file + + + + +2022-07-28T03:40:28.026739Z +cbdf0e1f6c57cd2d65ad5a44c151a927 +2015-01-08T09:24:45.800079Z +3722 +cpiedra + + + + + + + + + + + + + + + + + + + + + +8407 + +TarmInspeccion.java +file + + + + +2022-07-28T03:40:28.026739Z +91e91353cd6fadff736ef3e059090f82 +2016-01-21T16:08:24.054690Z +4398 +mcepeda + + + + + + + + + + + + + + + + + + + + + +9352 + +CashManagementDTO.java +file + + + + +2022-07-28T03:40:28.026739Z +60dd4953d97f8aa7158af5271c6d7c40 +2015-11-26T13:41:14.982482Z +4327 +fpazmino + + + + + + + + + + + + + + + + + + + + + +2740 + +TarmSolicitudTramiteKey.java +file + + + + +2022-07-28T03:40:28.027739Z +8aebfcdee7e73febe46a1f669c9534d7 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +3455 + +TarmGuardias.java +file + + + + +2022-07-28T03:40:28.027739Z +b98c68a52b9e1edf5f1579650468437a +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +4195 + +TarmSolicitudRequisitosKey.java +file + + + + +2022-07-28T03:40:28.027739Z +a0500024d9ae6625ddd651abd7551b34 +2014-08-20T09:24:12.183536Z +242 +cpiedra +has-props + + + + + + + + + + + + + + + + + + + + +4256 + +TarmAgenciaArmaKey.java +file + + + + +2022-07-28T03:40:28.028739Z +fe5282b54d8ed3a9145cd5ffd4ad8b6a +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +3336 + +TarmDocumentoHabilitante.java +file + + + + +2022-07-28T03:40:28.028739Z +3c62db9e6d9ccde1e8ed6746baedb9dd +2021-08-26T17:51:29.138509Z +4639 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +9824 + +TarmArmaPruebas.java +file + + + + +2022-07-28T03:40:28.029739Z +fe6ce9358a0079b97f535b5cecc75228 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +9574 + +TarmCabRepDestruirArmas.java +file + + + + +2022-07-28T03:40:28.029739Z +fa94028239e0ca04ae74723925a34dcc +2015-01-08T09:24:45.800079Z +3722 +cpiedra + + + + + + + + + + + + + + + + + + + + + +5339 + +TarmArmas.java +file + + + + +2022-07-28T03:40:28.029739Z +420a115a46d022d5a51b8ca96b66c31b +2021-11-16T16:57:03.937551Z +4652 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +18133 + +TarmDecomisoArma.java +file + + + + +2022-07-28T03:40:28.030739Z +4cab380db0d98fc3eb9facb29c02d93b +2016-01-20T17:08:28.980461Z +4390 +mcepeda +has-props + + + + + + + + + + + + + + + + + + + + +12948 + +TarmAgenciaSucursal.java +file + + + + +2022-07-28T03:40:28.030739Z +c22d1b941e4f02af66f53a9f7f0e66a2 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +10410 + diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmAgenciaArma.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmAgenciaArma.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmAgenciaArma.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmAgenciaArmaKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmAgenciaArmaKey.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmAgenciaArmaKey.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmAgenciaSucursal.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmAgenciaSucursal.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmAgenciaSucursal.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmArmaPruebas.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmArmaPruebas.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmArmaPruebas.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmArmas.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmArmas.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmArmas.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmDecomisoArma.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmDecomisoArma.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmDecomisoArma.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmDocumentoHabilitante.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmDocumentoHabilitante.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmDocumentoHabilitante.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmGuardias.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmGuardias.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmGuardias.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmOrdenTrabajo.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmOrdenTrabajo.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmOrdenTrabajo.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmOrdenTrabajoCustodios.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmOrdenTrabajoCustodios.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmOrdenTrabajoCustodios.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitud.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitud.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitud.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudAgenciaSucursal.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudAgenciaSucursal.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudAgenciaSucursal.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudAgenciaSucursalKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudAgenciaSucursalKey.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudAgenciaSucursalKey.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudArmas.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudArmas.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudArmas.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudArmasKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudArmasKey.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudArmasKey.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudDocumentoKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudDocumentoKey.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudDocumentoKey.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudGuardias.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudGuardias.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudGuardias.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudGuardiasKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudGuardiasKey.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudGuardiasKey.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudRequisitos.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudRequisitos.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudRequisitos.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudRequisitosKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudRequisitosKey.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudRequisitosKey.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudTramite.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudTramite.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudTramite.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudTramiteKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudTramiteKey.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/prop-base/TarmSolicitudTramiteKey.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/CashManagementDTO.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/CashManagementDTO.java.svn-base new file mode 100644 index 0000000..d9986c4 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/CashManagementDTO.java.svn-base @@ -0,0 +1,108 @@ +package com.fp.persistence.parmas.soli; + +import java.io.Serializable; +import java.math.BigDecimal; + +public class CashManagementDTO implements Serializable, Cloneable { + /** + * + */ + private static final long serialVersionUID = 1L; + // Codigo de orientacion + private String codigoServicio; + // Contrapartida + private String contrato; + private String moneda; + private String valorapagar; + // Forma de cobro + private String formaCobro; + private String tipoCuenta; + private String numeroCuenta; + // referencia, es el tipo autorizacion + private String referencia; + private String tipoIDCliente; + private String numeroIDCliente; + private String nombreCliente; + private String baseImponible; + private String csolicitud; + public String getCodigoServicio() { + return codigoServicio; + } + public void setCodigoServicio(String codigoServicio) { + this.codigoServicio = codigoServicio; + } + public String getContrato() { + return contrato; + } + public void setContrato(String contrato) { + this.contrato = contrato; + } + public String getMoneda() { + return moneda; + } + public void setMoneda(String moneda) { + this.moneda = moneda; + } + public String getValorapagar() { + return valorapagar; + } + public void setValorapagar(String valorapagar) { + this.valorapagar = valorapagar; + } + public String getFormaCobro() { + return formaCobro; + } + public void setFormaCobro(String formaCobro) { + this.formaCobro = formaCobro; + } + public String getTipoCuenta() { + return tipoCuenta; + } + public void setTipoCuenta(String tipoCuenta) { + this.tipoCuenta = tipoCuenta; + } + public String getNumeroCuenta() { + return numeroCuenta; + } + public void setNumeroCuenta(String numeroCuenta) { + this.numeroCuenta = numeroCuenta; + } + public String getReferencia() { + return referencia; + } + public void setReferencia(String referencia) { + this.referencia = referencia; + } + public String getTipoIDCliente() { + return tipoIDCliente; + } + public void setTipoIDCliente(String tipoIDCliente) { + this.tipoIDCliente = tipoIDCliente; + } + public String getNumeroIDCliente() { + return numeroIDCliente; + } + public void setNumeroIDCliente(String numeroIDCliente) { + this.numeroIDCliente = numeroIDCliente; + } + public String getNombreCliente() { + return nombreCliente; + } + public void setNombreCliente(String nombreCliente) { + this.nombreCliente = nombreCliente; + } + public String getBaseImponible() { + return baseImponible; + } + public void setBaseImponible(String baseImponible) { + this.baseImponible = baseImponible; + } + public String getCsolicitud() { + return csolicitud; + } + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmAgenciaArma.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmAgenciaArma.java.svn-base new file mode 100644 index 0000000..9790b08 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmAgenciaArma.java.svn-base @@ -0,0 +1,129 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMAGENCIAARMA*/ +@Entity(name="TarmAgenciaArma") +@Table(name="TARMAGENCIAARMA") +public class TarmAgenciaArma extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmAgenciaArma +*/ +@EmbeddedId +private TarmAgenciaArmaKey pk; +/**Contructor por defecto*/ +public TarmAgenciaArma(){ +} +/**Contructor de TarmAgenciaArma +@param pPk Clave Primaria del entity +*/ +public TarmAgenciaArma(TarmAgenciaArmaKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmAgenciaArma +*/ +public static TarmAgenciaArma find(EntityManager pEntityManager,TarmAgenciaArmaKey pKey) throws Exception{ + TarmAgenciaArma obj = pEntityManager.find(TarmAgenciaArma.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmAgenciaArma +@return El objeto que referencia a la Clave primaria de TarmAgenciaArma +*/ +public TarmAgenciaArmaKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmAgenciaArma +@param pPk El objeto que referencia a la nueva Clave primaria de TarmAgenciaArma +*/ +public void setPk(TarmAgenciaArmaKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmAgenciaArma))return false; + TarmAgenciaArma that = (TarmAgenciaArma) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmAgenciaArma +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmAgenciaArma +*/ +public Object createInstance(){ + TarmAgenciaArma instance=new TarmAgenciaArma(); + instance.setPk(new TarmAgenciaArmaKey()); + return instance; +} +/**Clona la entidad TarmAgenciaArma +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmAgenciaArma p=(TarmAgenciaArma)this.clone(); + p.setPk((TarmAgenciaArmaKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmAgenciaArmaKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmAgenciaArmaKey.java.svn-base new file mode 100644 index 0000000..69024dc --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmAgenciaArmaKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMAGENCIAARMA*/ +@Embeddable +public class TarmAgenciaArmaKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CARMA", nullable=false,updatable=false) + +/** +* PK del arma asociada a la agencia +*/ +private String carma; + +@Column(name="CAGENCIA", nullable=false,updatable=false) + +/** +* PK de la agencia asociada al arma +*/ +private Long cagencia; + +/**Contructor por defecto*/ +public TarmAgenciaArmaKey(){} +/**Contructor de TarmAgenciaArmaKey +@param pCarma PK del arma asociada a la agencia +@param pCagencia PK de la agencia asociada al arma +*/ +public TarmAgenciaArmaKey(String pCarma,Long pCagencia){ + carma=pCarma; + cagencia=pCagencia; +} +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de cagencia +@return valor de cagencia*/ +public Long getCagencia(){ + return cagencia; +} +/**Fija el valor de cagencia +@param pCagencia nuevo Valor de cagencia*/ +public void setCagencia(Long pCagencia){ + cagencia=pCagencia; +} + +/**Implementacion de la comparacion de TarmAgenciaArmaKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmAgenciaArmaKey))return false; + TarmAgenciaArmaKey that = (TarmAgenciaArmaKey) o; + if (this.getCarma() == null || that.getCarma() == null){ + return false; + } + if (! this.getCarma().equals(that.getCarma())){ + return false; + } + if (this.getCagencia() == null || that.getCagencia() == null){ + return false; + } + if (! this.getCagencia().equals(that.getCagencia())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmAgenciaArmaKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCarma() == null ? 0 : this.getCarma().hashCode()); + result = result * 37 + (this.getCagencia() == null ? 0 : this.getCagencia().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmAgenciaSucursal.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmAgenciaSucursal.java.svn-base new file mode 100644 index 0000000..7e93bf2 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmAgenciaSucursal.java.svn-base @@ -0,0 +1,426 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import java.util.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMAGENCIASUCURSAL*/ +@Entity(name="TarmAgenciaSucursal") +@Table(name="TARMAGENCIASUCURSAL") +public class TarmAgenciaSucursal extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmAgenciaSucursal +*/ +@Id +@Column(name="CAGENCIA" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CAGENCIA"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.Long"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "16")}) + @GeneratedValue(generator = "seq_id") +private Long pk; +@Column(name="COUNTRYCODE", nullable=true) + +/** +* Codigo de pais +*/ +private String countrycode; + +@Column(name="PROVINCECODE", nullable=true) + +/** +* Codigo de provincia +*/ +private String provincecode; + +@Column(name="CANTONCODE", nullable=true) + +/** +* Codigo de canton +*/ +private String cantoncode; + +@Column(name="PARROQUIACODE", nullable=true) + +/** +* Codigo de parroquia +*/ +private String parroquiacode; + +@Column(name="CITYCODE", nullable=true) + +/** +* Codigo de cuidad +*/ +private String citycode; + +@Column(name="TIPO", nullable=true) + +/** +* Tipo de agencia o sucursal +*/ +private String tipo; + +@Column(name="TIPOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo +*/ +private String tipocodigo; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de la empresa a la que pertenece la sucursal +*/ +private Integer personcode; + +@Column(name="DIRECCION", nullable=true) + +/** +* Ubicacion en donde se encuentra localizada la agencia +*/ +private String direccion; + +@Column(name="TELEFONO", nullable=true) + +/** +* Numero telefonico de la agencia +*/ +private String telefono; + +@Column(name="CORREO", nullable=true) + +/** +* Correo electronico de contacto para la agencia +*/ +private String correo; + +@Column(name="RESPONSABLE", nullable=true) + +/** +* Responsable encargado de la agencia +*/ +private String responsable; + +@Column(name="ESTADO", nullable=true) + +/** +* null +*/ +private String estado; + +@Column(name="ESTADOCODIGO", nullable=true) + +/** +* null +*/ +private String estadocodigo; + +@Column(name="FAUTORIZACION", nullable=true) + +/** +* null +*/ +private Date fautorizacion; + +@Column(name="NOMBRE", nullable=true) + +/** +* null +*/ +private String nombre; + +/**Contructor por defecto*/ +public TarmAgenciaSucursal(){ +} +/**Contructor de TarmAgenciaSucursal +@param pPk Clave Primaria del entity +*/ +public TarmAgenciaSucursal(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmAgenciaSucursal +*/ +public static TarmAgenciaSucursal find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmAgenciaSucursal obj = pEntityManager.find(TarmAgenciaSucursal.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmAgenciaSucursal +@return El objeto que referencia a la Clave primaria de TarmAgenciaSucursal +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmAgenciaSucursal +@param pPk El objeto que referencia a la nueva Clave primaria de TarmAgenciaSucursal +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de countrycode +@return valor de countrycode*/ +public String getCountrycode(){ + return countrycode; +} +/**Fija el valor de countrycode +@param pCountrycode nuevo Valor de countrycode*/ +public void setCountrycode(String pCountrycode){ + countrycode=pCountrycode; +} + +/**Obtiene el valor de provincecode +@return valor de provincecode*/ +public String getProvincecode(){ + return provincecode; +} +/**Fija el valor de provincecode +@param pProvincecode nuevo Valor de provincecode*/ +public void setProvincecode(String pProvincecode){ + provincecode=pProvincecode; +} + +/**Obtiene el valor de cantoncode +@return valor de cantoncode*/ +public String getCantoncode(){ + return cantoncode; +} +/**Fija el valor de cantoncode +@param pCantoncode nuevo Valor de cantoncode*/ +public void setCantoncode(String pCantoncode){ + cantoncode=pCantoncode; +} + +/**Obtiene el valor de parroquiacode +@return valor de parroquiacode*/ +public String getParroquiacode(){ + return parroquiacode; +} +/**Fija el valor de parroquiacode +@param pParroquiacode nuevo Valor de parroquiacode*/ +public void setParroquiacode(String pParroquiacode){ + parroquiacode=pParroquiacode; +} + +/**Obtiene el valor de citycode +@return valor de citycode*/ +public String getCitycode(){ + return citycode; +} +/**Fija el valor de citycode +@param pCitycode nuevo Valor de citycode*/ +public void setCitycode(String pCitycode){ + citycode=pCitycode; +} + +/**Obtiene el valor de tipo +@return valor de tipo*/ +public String getTipo(){ + return tipo; +} +/**Fija el valor de tipo +@param pTipo nuevo Valor de tipo*/ +public void setTipo(String pTipo){ + tipo=pTipo; +} + +/**Obtiene el valor de tipocodigo +@return valor de tipocodigo*/ +public String getTipocodigo(){ + return tipocodigo; +} +/**Fija el valor de tipocodigo +@param pTipocodigo nuevo Valor de tipocodigo*/ +public void setTipocodigo(String pTipocodigo){ + tipocodigo=pTipocodigo; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de direccion +@return valor de direccion*/ +public String getDireccion(){ + return direccion; +} +/**Fija el valor de direccion +@param pDireccion nuevo Valor de direccion*/ +public void setDireccion(String pDireccion){ + direccion=pDireccion; +} + +/**Obtiene el valor de telefono +@return valor de telefono*/ +public String getTelefono(){ + return telefono; +} +/**Fija el valor de telefono +@param pTelefono nuevo Valor de telefono*/ +public void setTelefono(String pTelefono){ + telefono=pTelefono; +} + +/**Obtiene el valor de correo +@return valor de correo*/ +public String getCorreo(){ + return correo; +} +/**Fija el valor de correo +@param pCorreo nuevo Valor de correo*/ +public void setCorreo(String pCorreo){ + correo=pCorreo; +} + +/**Obtiene el valor de responsable +@return valor de responsable*/ +public String getResponsable(){ + return responsable; +} +/**Fija el valor de responsable +@param pResponsable nuevo Valor de responsable*/ +public void setResponsable(String pResponsable){ + responsable=pResponsable; +} + +/**Obtiene el valor de estado +@return valor de estado*/ +public String getEstado(){ + return estado; +} +/**Fija el valor de estado +@param pEstado nuevo Valor de estado*/ +public void setEstado(String pEstado){ + estado=pEstado; +} + +/**Obtiene el valor de estadocodigo +@return valor de estadocodigo*/ +public String getEstadocodigo(){ + return estadocodigo; +} +/**Fija el valor de estadocodigo +@param pEstadocodigo nuevo Valor de estadocodigo*/ +public void setEstadocodigo(String pEstadocodigo){ + estadocodigo=pEstadocodigo; +} + +/**Obtiene el valor de fautorizacion +@return valor de fautorizacion*/ +public Date getFautorizacion(){ + return fautorizacion; +} +/**Fija el valor de fautorizacion +@param pFautorizacion nuevo Valor de fautorizacion*/ +public void setFautorizacion(Date pFautorizacion){ + fautorizacion=pFautorizacion; +} + +/**Obtiene el valor de nombre +@return valor de nombre*/ +public String getNombre(){ + return nombre; +} +/**Fija el valor de nombre +@param pNombre nuevo Valor de nombre*/ +public void setNombre(String pNombre){ + nombre=pNombre; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmAgenciaSucursal))return false; + TarmAgenciaSucursal that = (TarmAgenciaSucursal) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmAgenciaSucursal +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmAgenciaSucursal +*/ +public Object createInstance(){ + TarmAgenciaSucursal instance=new TarmAgenciaSucursal(); + return instance; +} +/**Clona la entidad TarmAgenciaSucursal +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmAgenciaSucursal p=(TarmAgenciaSucursal)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmArmaPruebas.java.netbeans-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmArmaPruebas.java.netbeans-base new file mode 100644 index 0000000..0876f76 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmArmaPruebas.java.netbeans-base @@ -0,0 +1,390 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMARMAPRUEBAS*/ +@Entity(name="TarmArmaPruebas") +@Table(name="TARMARMAPRUEBAS") +public class TarmArmaPruebas extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmArmaPruebas +*/ +@Id +@Column(name="CARMAPRUEBA" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CARMAPRUEBA"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.Long"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "16")}) +@GeneratedValue(generator = "seq_id") +private Long pk; +@Column(name="CSOLICITUD", nullable=true) + +/** +* Codigo de solicitud de controld e armas +*/ +private String csolicitud; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="CARMA", nullable=true) + +/** +* null +*/ +private String carma; + +@Column(name="OBSERVACION", nullable=true) + +/** +* null +*/ +private String observacion; + +@Column(name="XPATHIMPRONTA", nullable=true) + +/** +* null +*/ +private String xpathimpronta; + +@Column(name="XPATHFOTOGRAFIA", nullable=true) + +/** +* null +*/ +private String xpathfotografia; + +@Column(name="APTITUDDISPARO", nullable=true) + +/** +* null +*/ +private String aptituddisparo; + + +@Column(name="XPATHFICHATECARMAS", nullable=true) + +/** +* null +*/ +private String xpathfichatecarmas; + + +@Column(name="BALASTESTIGO", nullable=true) + +/** +* null +*/ +private String balastestigo; + +@Column(name="TUBOCANION", nullable=true) + +/** +* null +*/ +private String tubocanion; + +@Column(name="APRUEBAEVALUACION", nullable=true) + +/** +* null +*/ +private String apruebaevaluacion; + + + +@Column(name="VAINASTESTIGO", nullable=true) + +/** +* null +*/ +private String vainastestigo; + + +@Column(name = "IMAGENIMPRONTA", unique = false, nullable = false, length = 100000) + +/** +* null +*/ +private byte[] imagenimpronta; + +@Column(name = "IMAGENFOTOGRAFIA", unique = false, nullable = false, length = 100000) + +/** +* null +*/ +private byte[] imagenfotografia; + +@Column(name="ISIMPRESO", nullable=true) + +/** +* null +*/ +private String isimpreso; + + +/**Contructor por defecto*/ +public TarmArmaPruebas(){ +} +/**Contructor de TarmArmaPruebas +@param pPk Clave Primaria del entity +*/ +public TarmArmaPruebas(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmArmaPruebas +*/ +public static TarmArmaPruebas find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmArmaPruebas obj = pEntityManager.find(TarmArmaPruebas.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmArmaPruebas +@return El objeto que referencia a la Clave primaria de TarmArmaPruebas +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmArmaPruebas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmArmaPruebas +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de observacion +@return valor de observacion*/ +public String getObservacion(){ + return observacion; +} +/**Fija el valor de observacion +@param pObservacion nuevo Valor de observacion*/ +public void setObservacion(String pObservacion){ + observacion=pObservacion; +} + +/**Obtiene el valor de xpathimpronta +@return valor de xpathimpronta*/ +public String getXpathimpronta(){ + return xpathimpronta; +} +/**Fija el valor de xpathimpronta +@param pXpathimpronta nuevo Valor de xpathimpronta*/ +public void setXpathimpronta(String pXpathimpronta){ + xpathimpronta=pXpathimpronta; +} + +/**Obtiene el valor de xpathfotografia +@return valor de xpathfotografia*/ +public String getXpathfotografia(){ + return xpathfotografia; +} +/**Fija el valor de xpathfotografia +@param pXpathfotografia nuevo Valor de xpathfotografia*/ +public void setXpathfotografia(String pXpathfotografia){ + xpathfotografia=pXpathfotografia; +} + +public String getXpathfichatecarmas() { + return xpathfichatecarmas; +} +public void setXpathfichatecarmas(String xpathfichatecarmas) { + this.xpathfichatecarmas = xpathfichatecarmas; +} +/**Obtiene el valor de aptituddisparo +@return valor de aptituddisparo*/ +public String getAptituddisparo(){ + return aptituddisparo; +} +/**Fija el valor de aptituddisparo +@param pAptituddisparo nuevo Valor de aptituddisparo*/ +public void setAptituddisparo(String pAptituddisparo){ + aptituddisparo=pAptituddisparo; +} + +/**Obtiene el valor de balastestigo +@return valor de balastestigo*/ +public String getBalastestigo(){ + return balastestigo; +} +/**Fija el valor de balastestigo +@param pBalastestigo nuevo Valor de balastestigo*/ +public void setBalastestigo(String pBalastestigo){ + balastestigo=pBalastestigo; +} + +/**Obtiene el valor de vainastestigo +@return valor de vainastestigo*/ +public String getVainastestigo(){ + return vainastestigo; +} +/**Fija el valor de vainastestigo +@param pVainastestigo nuevo Valor de vainastestigo*/ +public void setVainastestigo(String pVainastestigo){ + vainastestigo=pVainastestigo; +} + +/**Obtiene el valor de apruebaevaluacion +@return valor de apruebaevaluacion*/ +public String getApruebaevaluacion(){ + return apruebaevaluacion; +} +/**Fija el valor de apruebaevaluacion +@param pApruebaevaluacion nuevo Valor de apruebaevaluacion*/ +public void setApruebaevaluacion(String pApruebaevaluacion){ + apruebaevaluacion=pApruebaevaluacion; +} + + +public byte[] getImagenimpronta() { + return imagenimpronta; +} +public void setImagenimpronta(byte[] imagenimpronta) { + this.imagenimpronta = imagenimpronta; +} +public byte[] getImagenfotografia() { + return imagenfotografia; +} +public void setImagenfotografia(byte[] imagenfotografia) { + this.imagenfotografia = imagenfotografia; +} + +public String getIsimpreso() { + return isimpreso; +} +public void setIsimpreso(String isimpreso) { + this.isimpreso = isimpreso; +} + +public String getTubocanion() { + return tubocanion; +} +public void setTubocanion(String tubocanion) { + this.tubocanion = tubocanion; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmArmaPruebas))return false; + TarmArmaPruebas that = (TarmArmaPruebas) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmArmaPruebas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmArmaPruebas +*/ +public Object createInstance(){ + TarmArmaPruebas instance=new TarmArmaPruebas(); + return instance; +} +/**Clona la entidad TarmArmaPruebas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmArmaPruebas p=(TarmArmaPruebas)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmArmaPruebas.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmArmaPruebas.java.svn-base new file mode 100644 index 0000000..0876f76 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmArmaPruebas.java.svn-base @@ -0,0 +1,390 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMARMAPRUEBAS*/ +@Entity(name="TarmArmaPruebas") +@Table(name="TARMARMAPRUEBAS") +public class TarmArmaPruebas extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmArmaPruebas +*/ +@Id +@Column(name="CARMAPRUEBA" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CARMAPRUEBA"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.Long"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "16")}) +@GeneratedValue(generator = "seq_id") +private Long pk; +@Column(name="CSOLICITUD", nullable=true) + +/** +* Codigo de solicitud de controld e armas +*/ +private String csolicitud; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="CARMA", nullable=true) + +/** +* null +*/ +private String carma; + +@Column(name="OBSERVACION", nullable=true) + +/** +* null +*/ +private String observacion; + +@Column(name="XPATHIMPRONTA", nullable=true) + +/** +* null +*/ +private String xpathimpronta; + +@Column(name="XPATHFOTOGRAFIA", nullable=true) + +/** +* null +*/ +private String xpathfotografia; + +@Column(name="APTITUDDISPARO", nullable=true) + +/** +* null +*/ +private String aptituddisparo; + + +@Column(name="XPATHFICHATECARMAS", nullable=true) + +/** +* null +*/ +private String xpathfichatecarmas; + + +@Column(name="BALASTESTIGO", nullable=true) + +/** +* null +*/ +private String balastestigo; + +@Column(name="TUBOCANION", nullable=true) + +/** +* null +*/ +private String tubocanion; + +@Column(name="APRUEBAEVALUACION", nullable=true) + +/** +* null +*/ +private String apruebaevaluacion; + + + +@Column(name="VAINASTESTIGO", nullable=true) + +/** +* null +*/ +private String vainastestigo; + + +@Column(name = "IMAGENIMPRONTA", unique = false, nullable = false, length = 100000) + +/** +* null +*/ +private byte[] imagenimpronta; + +@Column(name = "IMAGENFOTOGRAFIA", unique = false, nullable = false, length = 100000) + +/** +* null +*/ +private byte[] imagenfotografia; + +@Column(name="ISIMPRESO", nullable=true) + +/** +* null +*/ +private String isimpreso; + + +/**Contructor por defecto*/ +public TarmArmaPruebas(){ +} +/**Contructor de TarmArmaPruebas +@param pPk Clave Primaria del entity +*/ +public TarmArmaPruebas(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmArmaPruebas +*/ +public static TarmArmaPruebas find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmArmaPruebas obj = pEntityManager.find(TarmArmaPruebas.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmArmaPruebas +@return El objeto que referencia a la Clave primaria de TarmArmaPruebas +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmArmaPruebas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmArmaPruebas +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de observacion +@return valor de observacion*/ +public String getObservacion(){ + return observacion; +} +/**Fija el valor de observacion +@param pObservacion nuevo Valor de observacion*/ +public void setObservacion(String pObservacion){ + observacion=pObservacion; +} + +/**Obtiene el valor de xpathimpronta +@return valor de xpathimpronta*/ +public String getXpathimpronta(){ + return xpathimpronta; +} +/**Fija el valor de xpathimpronta +@param pXpathimpronta nuevo Valor de xpathimpronta*/ +public void setXpathimpronta(String pXpathimpronta){ + xpathimpronta=pXpathimpronta; +} + +/**Obtiene el valor de xpathfotografia +@return valor de xpathfotografia*/ +public String getXpathfotografia(){ + return xpathfotografia; +} +/**Fija el valor de xpathfotografia +@param pXpathfotografia nuevo Valor de xpathfotografia*/ +public void setXpathfotografia(String pXpathfotografia){ + xpathfotografia=pXpathfotografia; +} + +public String getXpathfichatecarmas() { + return xpathfichatecarmas; +} +public void setXpathfichatecarmas(String xpathfichatecarmas) { + this.xpathfichatecarmas = xpathfichatecarmas; +} +/**Obtiene el valor de aptituddisparo +@return valor de aptituddisparo*/ +public String getAptituddisparo(){ + return aptituddisparo; +} +/**Fija el valor de aptituddisparo +@param pAptituddisparo nuevo Valor de aptituddisparo*/ +public void setAptituddisparo(String pAptituddisparo){ + aptituddisparo=pAptituddisparo; +} + +/**Obtiene el valor de balastestigo +@return valor de balastestigo*/ +public String getBalastestigo(){ + return balastestigo; +} +/**Fija el valor de balastestigo +@param pBalastestigo nuevo Valor de balastestigo*/ +public void setBalastestigo(String pBalastestigo){ + balastestigo=pBalastestigo; +} + +/**Obtiene el valor de vainastestigo +@return valor de vainastestigo*/ +public String getVainastestigo(){ + return vainastestigo; +} +/**Fija el valor de vainastestigo +@param pVainastestigo nuevo Valor de vainastestigo*/ +public void setVainastestigo(String pVainastestigo){ + vainastestigo=pVainastestigo; +} + +/**Obtiene el valor de apruebaevaluacion +@return valor de apruebaevaluacion*/ +public String getApruebaevaluacion(){ + return apruebaevaluacion; +} +/**Fija el valor de apruebaevaluacion +@param pApruebaevaluacion nuevo Valor de apruebaevaluacion*/ +public void setApruebaevaluacion(String pApruebaevaluacion){ + apruebaevaluacion=pApruebaevaluacion; +} + + +public byte[] getImagenimpronta() { + return imagenimpronta; +} +public void setImagenimpronta(byte[] imagenimpronta) { + this.imagenimpronta = imagenimpronta; +} +public byte[] getImagenfotografia() { + return imagenfotografia; +} +public void setImagenfotografia(byte[] imagenfotografia) { + this.imagenfotografia = imagenfotografia; +} + +public String getIsimpreso() { + return isimpreso; +} +public void setIsimpreso(String isimpreso) { + this.isimpreso = isimpreso; +} + +public String getTubocanion() { + return tubocanion; +} +public void setTubocanion(String tubocanion) { + this.tubocanion = tubocanion; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmArmaPruebas))return false; + TarmArmaPruebas that = (TarmArmaPruebas) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmArmaPruebas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmArmaPruebas +*/ +public Object createInstance(){ + TarmArmaPruebas instance=new TarmArmaPruebas(); + return instance; +} +/**Clona la entidad TarmArmaPruebas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmArmaPruebas p=(TarmArmaPruebas)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmArmas.java.netbeans-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmArmas.java.netbeans-base new file mode 100644 index 0000000..456e172 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmArmas.java.netbeans-base @@ -0,0 +1,791 @@ +package com.fp.persistence.parmas.soli; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMARMAS*/ +@Entity(name="TarmArmas") +@Table(name="TARMARMAS") +public class TarmArmas extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmArmas +*/ +@Id +@Column(name="CARMA" ,nullable=false, updatable=false) +private String pk; +@Column(name="MARCA", nullable=true) + +/** +* null +*/ +private String marca; + +@Column(name="MARCACODIGO", nullable=true) + +/** +* null +*/ +private String marcacodigo; + +@Column(name="PARTIDAARANCELARIA", nullable=true) + +/** +* Partida arancelaria +*/ +private String partidaarancelaria; + +@Column(name="PARTIDAARANCELARIACODIGO", nullable=true) + +/** +* Partida arancelaria codigo +*/ +private String partidaarancelariacodigo; + +@Column(name="TIPOFABRICACION", nullable=true) + +/** +* null +*/ +private String tipofabricacion; + +@Column(name="TIPOFABRICACIONCODIGO", nullable=true) + +/** +* null +*/ +private String tipofabricacioncodigo; + +@Column(name="COLOR", nullable=true) + +/** +* null +*/ +private String color; + +@Column(name="COLORCODIGO", nullable=true) + +/** +* null +*/ +private String colorcodigo; + +@Column(name="CPAISORIGEN", nullable=true) + +/** +* null +*/ +private String cpaisorigen; + +@Column(name="UNIDADMEDIDACANTIDAD", nullable=true) + +/** +* null +*/ +private String unidadmedidacantidad; + +@Column(name="UNIDADMEDIDACANTIDADCODIGO", nullable=true) + +/** +* null +*/ +private String unidadmedidacantidadcodigo; + +@Column(name="ESTADO", nullable=true) + +/** +* null +*/ +private String estado; + +@Column(name="ESTADOCODIGO", nullable=true) + +/** +* null +*/ +private String estadocodigo; + +@Column(name="COUNTRYCODE", nullable=true) + +/** +* null +*/ +private String countrycode; + +@Column(name="PROVINCECODE", nullable=true) + +/** +* null +*/ +private String provincecode; + +@Column(name="CANTONCODE", nullable=true) + +/** +* null +*/ +private String cantoncode; + +@Column(name="PARROQUIACODE", nullable=true) + +/** +* null +*/ +private String parroquiacode; + +@Column(name="CREGISTRO", nullable=true) + +/** +* null +*/ +private Long cregistro; + +@Column(name="CITYCODE", nullable=true) + +/** +* null +*/ +private String citycode; + +@Column(name="LOTE", nullable=true) + +/** +* null +*/ +private String lote; + +@Column(name="CANTIDAD", nullable=true) + +/** +* null +*/ +private Integer cantidad; + +@Column(name="PESO", nullable=true) + +/** +* null +*/ +private BigDecimal peso; + +@Column(name="MODELO", nullable=true) + +/** +* null +*/ +private String modelo; + +@Column(name="SERIECANON", nullable=true) + +/** +* null +*/ +private String seriecanon; + +@Column(name="FEMISIONPERMISO", nullable=true) + +/** +* null +*/ +private Date femisionpermiso; + +@Column(name="DIRECCION", nullable=true) + +/** +* null +*/ +private String direccion; + +@Column(name="NEMONICOARMA", nullable=true) + +/** +* null +*/ +private String nemonicoarma; + +@Column(name="FECHAREGISTRO", nullable=true) + +/** +* null +*/ +private Date fecharegistro; + +@Column(name="RECORDVERSION", nullable=true) + +/** +* null +*/ +private Integer recordversion; + +@Column(name="CTIPOARMAEXPLOSIVO", nullable=true) + +/** +* null +*/ +private String ctipoarmaexplosivo; + +@Column(name="CODIGOARMA", nullable=true) + +/** +* Codigo identificador de arma +*/ +private String codigoarma; + +@Column(name="FDESADUANIZACION", nullable=true) + +/** +* null +*/ +private Date fdesaduanizacion; + +@Column(name="ESTADODECOMISO", nullable=true) + +/** +* null +*/ +private String estadoDecomiso; + + +@Column(name="ESTADOVENTA", nullable=true) + +/** +* null +*/ +private String estadoventa; + +@Column(name="PATHDOCUMENTO", nullable=true) + +private String pathDocumento; + +/**valor auxiliar + * + */ +@Transient +private int valorAux; + +/**valor auxiliar + * + */ +@Transient +private BigDecimal pesoAux; + +@Column(name="FECHACADUCIDAD", nullable=true) + +/** +* fecha de caducidad del documento habilitante +*/ +private Date fechacaducidad; + +@Column(name="PATHDOCUMENTOCREAR", nullable=true) +private String pathDocumentocrear; + +@Column(name="GENERACERTIFICADO", nullable=true) +private String generacertificado; + + + +public int getValorAux() { + return valorAux; +} +public void setValorAux(int valorAux) { + this.valorAux = valorAux; +} +public BigDecimal getPesoAux() { + return pesoAux; +} +public void setPesoAux(BigDecimal pesoAux) { + this.pesoAux = pesoAux; +} + +/**Contructor por defecto*/ +public TarmArmas(){ +} +/**Contructor de TarmArmas +@param pPk Clave Primaria del entity +*/ +public TarmArmas(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmArmas +*/ +public static TarmArmas find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmArmas obj = pEntityManager.find(TarmArmas.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmArmas +@return El objeto que referencia a la Clave primaria de TarmArmas +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmArmas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmArmas +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de marca +@return valor de marca*/ +public String getMarca(){ + return marca; +} +/**Fija el valor de marca +@param pMarca nuevo Valor de marca*/ +public void setMarca(String pMarca){ + marca=pMarca; +} + +/**Obtiene el valor de marcacodigo +@return valor de marcacodigo*/ +public String getMarcacodigo(){ + return marcacodigo; +} +/**Fija el valor de marcacodigo +@param pMarcacodigo nuevo Valor de marcacodigo*/ +public void setMarcacodigo(String pMarcacodigo){ + marcacodigo=pMarcacodigo; +} + +/**Obtiene el valor de tipofabricacion +@return valor de tipofabricacion*/ +public String getTipofabricacion(){ + return tipofabricacion; +} +/**Fija el valor de tipofabricacion +@param pTipofabricacion nuevo Valor de tipofabricacion*/ +public void setTipofabricacion(String pTipofabricacion){ + tipofabricacion=pTipofabricacion; +} + +/**Obtiene el valor de tipofabricacioncodigo +@return valor de tipofabricacioncodigo*/ +public String getTipofabricacioncodigo(){ + return tipofabricacioncodigo; +} +/**Fija el valor de tipofabricacioncodigo +@param pTipofabricacioncodigo nuevo Valor de tipofabricacioncodigo*/ +public void setTipofabricacioncodigo(String pTipofabricacioncodigo){ + tipofabricacioncodigo=pTipofabricacioncodigo; +} + +/**Obtiene el valor de color +@return valor de color*/ +public String getColor(){ + return color; +} +/**Fija el valor de color +@param pColor nuevo Valor de color*/ +public void setColor(String pColor){ + color=pColor; +} + +/**Obtiene el valor de colorcodigo +@return valor de colorcodigo*/ +public String getColorcodigo(){ + return colorcodigo; +} +/**Fija el valor de colorcodigo +@param pColorcodigo nuevo Valor de colorcodigo*/ +public void setColorcodigo(String pColorcodigo){ + colorcodigo=pColorcodigo; +} + +/**Obtiene el valor de cpaisorigen +@return valor de cpaisorigen*/ +public String getCpaisorigen(){ + return cpaisorigen; +} +/**Fija el valor de cpaisorigen +@param pCpaisorigen nuevo Valor de cpaisorigen*/ +public void setCpaisorigen(String pCpaisorigen){ + cpaisorigen=pCpaisorigen; +} + +/**Obtiene el valor de unidadmedidacantidad +@return valor de unidadmedidacantidad*/ +public String getUnidadmedidacantidad(){ + return unidadmedidacantidad; +} +/**Fija el valor de unidadmedidacantidad +@param pUnidadmedidacantidad nuevo Valor de unidadmedidacantidad*/ +public void setUnidadmedidacantidad(String pUnidadmedidacantidad){ + unidadmedidacantidad=pUnidadmedidacantidad; +} + +/**Obtiene el valor de unidadmedidacantidadcodigo +@return valor de unidadmedidacantidadcodigo*/ +public String getUnidadmedidacantidadcodigo(){ + return unidadmedidacantidadcodigo; +} +/**Fija el valor de unidadmedidacantidadcodigo +@param pUnidadmedidacantidadcodigo nuevo Valor de unidadmedidacantidadcodigo*/ +public void setUnidadmedidacantidadcodigo(String pUnidadmedidacantidadcodigo){ + unidadmedidacantidadcodigo=pUnidadmedidacantidadcodigo; +} + +/**Obtiene el valor de estado +@return valor de estado*/ +public String getEstado(){ + return estado; +} +/**Fija el valor de estado +@param pEstado nuevo Valor de estado*/ +public void setEstado(String pEstado){ + estado=pEstado; +} + +/**Obtiene el valor de estadocodigo +@return valor de estadocodigo*/ +public String getEstadocodigo(){ + return estadocodigo; +} +/**Fija el valor de estadocodigo +@param pEstadocodigo nuevo Valor de estadocodigo*/ +public void setEstadocodigo(String pEstadocodigo){ + estadocodigo=pEstadocodigo; +} + +/**Obtiene el valor de countrycode +@return valor de countrycode*/ +public String getCountrycode(){ + return countrycode; +} +/**Fija el valor de countrycode +@param pCountrycode nuevo Valor de countrycode*/ +public void setCountrycode(String pCountrycode){ + countrycode=pCountrycode; +} + +/**Obtiene el valor de provincecode +@return valor de provincecode*/ +public String getProvincecode(){ + return provincecode; +} +/**Fija el valor de provincecode +@param pProvincecode nuevo Valor de provincecode*/ +public void setProvincecode(String pProvincecode){ + provincecode=pProvincecode; +} + +/**Obtiene el valor de cantoncode +@return valor de cantoncode*/ +public String getCantoncode(){ + return cantoncode; +} +/**Fija el valor de cantoncode +@param pCantoncode nuevo Valor de cantoncode*/ +public void setCantoncode(String pCantoncode){ + cantoncode=pCantoncode; +} + +/**Obtiene el valor de parroquiacode +@return valor de parroquiacode*/ +public String getParroquiacode(){ + return parroquiacode; +} +/**Fija el valor de parroquiacode +@param pParroquiacode nuevo Valor de parroquiacode*/ +public void setParroquiacode(String pParroquiacode){ + parroquiacode=pParroquiacode; +} + +/**Obtiene el valor de cregistro +@return valor de cregistro*/ +public Long getCregistro(){ + return cregistro; +} +/**Fija el valor de cregistro +@param pCregistro nuevo Valor de cregistro*/ +public void setCregistro(Long pCregistro){ + cregistro=pCregistro; +} + +/**Obtiene el valor de citycode +@return valor de citycode*/ +public String getCitycode(){ + return citycode; +} +/**Fija el valor de citycode +@param pCitycode nuevo Valor de citycode*/ +public void setCitycode(String pCitycode){ + citycode=pCitycode; +} + +/**Obtiene el valor de lote +@return valor de lote*/ +public String getLote(){ + return lote; +} +/**Fija el valor de lote +@param pLote nuevo Valor de lote*/ +public void setLote(String pLote){ + lote=pLote; +} + +/**Obtiene el valor de cantidad +@return valor de cantidad*/ +public Integer getCantidad(){ + return cantidad; +} +/**Fija el valor de cantidad +@param pCantidad nuevo Valor de cantidad*/ +public void setCantidad(Integer pCantidad){ + cantidad=pCantidad; +} + +/**Obtiene el valor de peso +@return valor de peso*/ +public BigDecimal getPeso(){ + return peso; +} +/**Fija el valor de peso +@param pPeso nuevo Valor de peso*/ +public void setPeso(BigDecimal pPeso){ + peso=pPeso; +} + +/**Obtiene el valor de modelo +@return valor de modelo*/ +public String getModelo(){ + return modelo; +} +/**Fija el valor de modelo +@param pModelo nuevo Valor de modelo*/ +public void setModelo(String pModelo){ + modelo=pModelo; +} + +/**Obtiene el valor de seriecanon +@return valor de seriecanon*/ +public String getSeriecanon(){ + return seriecanon; +} +/**Fija el valor de seriecanon +@param pSeriecanon nuevo Valor de seriecanon*/ +public void setSeriecanon(String pSeriecanon){ + seriecanon=pSeriecanon; +} + +/**Obtiene el valor de femisionpermiso +@return valor de femisionpermiso*/ +public Date getFemisionpermiso(){ + return femisionpermiso; +} +/**Fija el valor de femisionpermiso +@param pFemisionpermiso nuevo Valor de femisionpermiso*/ +public void setFemisionpermiso(Date pFemisionpermiso){ + femisionpermiso=pFemisionpermiso; +} + +/**Obtiene el valor de direccion +@return valor de direccion*/ +public String getDireccion(){ + return direccion; +} +/**Fija el valor de direccion +@param pDireccion nuevo Valor de direccion*/ +public void setDireccion(String pDireccion){ + direccion=pDireccion; +} + +/**Obtiene el valor de nemonicoarma +@return valor de nemonicoarma*/ +public String getNemonicoarma(){ + return nemonicoarma; +} +/**Fija el valor de nemonicoarma +@param pNemonicoarma nuevo Valor de nemonicoarma*/ +public void setNemonicoarma(String pNemonicoarma){ + nemonicoarma=pNemonicoarma; +} + +/**Obtiene el valor de fecharegistro +@return valor de fecharegistro*/ +public Date getFecharegistro(){ + return fecharegistro; +} +/**Fija el valor de fecharegistro +@param pFecharegistro nuevo Valor de fecharegistro*/ +public void setFecharegistro(Date pFecharegistro){ + fecharegistro=pFecharegistro; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de ctipoarmaexplosivo +@return valor de ctipoarmaexplosivo*/ +public String getCtipoarmaexplosivo(){ + return ctipoarmaexplosivo; +} +/**Fija el valor de ctipoarmaexplosivo +@param pCtipoarmaexplosivo nuevo Valor de ctipoarmaexplosivo*/ +public void setCtipoarmaexplosivo(String pCtipoarmaexplosivo){ + ctipoarmaexplosivo=pCtipoarmaexplosivo; +} + +/**Obtiene el valor de codigoarma +@return valor de codigoarma*/ +public String getCodigoarma(){ + return codigoarma; +} +/**Fija el valor de codigoarma +@param pCodigoarma nuevo Valor de codigoarma*/ +public void setCodigoarma(String pCodigoarma){ + codigoarma=pCodigoarma; +} + +/**Obtiene el valor de fdesaduanizacion +@return valor de fdesaduanizacion*/ +public Date getFdesaduanizacion() { + return fdesaduanizacion; +} +/**Fija el valor de fdesaduanizacion +@param pCodigoarma nuevo Valor de fdesaduanizacion*/ +public void setFdesaduanizacion(Date fdesaduanizacion) { + this.fdesaduanizacion = fdesaduanizacion; +} + +/**Obtiene el valor de fechacaducidad +@return valor de fechacaducidad*/ +public Date getFechacaducidad(){ + return fechacaducidad; +} +/**Fija el valor de fechacaducidad +@param pFechacaducidad nuevo Valor de fechacaducidad*/ +public void setFechacaducidad(Date pFechacaducidad){ + fechacaducidad=pFechacaducidad; +} +public String getPartidaarancelaria() { + return partidaarancelaria; +} +public void setPartidaarancelaria(String partidaarancelaria) { + this.partidaarancelaria = partidaarancelaria; +} +public String getPartidaarancelariacodigo() { + return partidaarancelariacodigo; +} +public void setPartidaarancelariacodigo(String partidaarancelariacodigo) { + this.partidaarancelariacodigo = partidaarancelariacodigo; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmArmas))return false; + TarmArmas that = (TarmArmas) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmArmas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmArmas +*/ +public Object createInstance(){ + TarmArmas instance=new TarmArmas(); + return instance; +} +/**Clona la entidad TarmArmas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmArmas p=(TarmArmas)this.clone(); + return p; +} +public String getEstadoDecomiso() { + return estadoDecomiso; +} +public void setEstadoDecomiso(String estadoDecomiso) { + this.estadoDecomiso = estadoDecomiso; +} +public String getEstadoventa() { + return estadoventa; +} +public void setEstadoventa(String estadoventa) { + this.estadoventa = estadoventa; +} +public String getPathDocumento() { + return pathDocumento; +} +public void setPathDocumento(String pathDocumento) { + this.pathDocumento = pathDocumento; +} +public String getPathDocumentocrear() { + return pathDocumentocrear; +} +public void setPathDocumentocrear(String pathDocumentocrear) { + this.pathDocumentocrear = pathDocumentocrear; +} +public String getGeneracertificado() { + return generacertificado; +} +public void setGeneracertificado(String generacertificado) { + this.generacertificado = generacertificado; +} + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmArmas.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmArmas.java.svn-base new file mode 100644 index 0000000..456e172 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmArmas.java.svn-base @@ -0,0 +1,791 @@ +package com.fp.persistence.parmas.soli; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMARMAS*/ +@Entity(name="TarmArmas") +@Table(name="TARMARMAS") +public class TarmArmas extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmArmas +*/ +@Id +@Column(name="CARMA" ,nullable=false, updatable=false) +private String pk; +@Column(name="MARCA", nullable=true) + +/** +* null +*/ +private String marca; + +@Column(name="MARCACODIGO", nullable=true) + +/** +* null +*/ +private String marcacodigo; + +@Column(name="PARTIDAARANCELARIA", nullable=true) + +/** +* Partida arancelaria +*/ +private String partidaarancelaria; + +@Column(name="PARTIDAARANCELARIACODIGO", nullable=true) + +/** +* Partida arancelaria codigo +*/ +private String partidaarancelariacodigo; + +@Column(name="TIPOFABRICACION", nullable=true) + +/** +* null +*/ +private String tipofabricacion; + +@Column(name="TIPOFABRICACIONCODIGO", nullable=true) + +/** +* null +*/ +private String tipofabricacioncodigo; + +@Column(name="COLOR", nullable=true) + +/** +* null +*/ +private String color; + +@Column(name="COLORCODIGO", nullable=true) + +/** +* null +*/ +private String colorcodigo; + +@Column(name="CPAISORIGEN", nullable=true) + +/** +* null +*/ +private String cpaisorigen; + +@Column(name="UNIDADMEDIDACANTIDAD", nullable=true) + +/** +* null +*/ +private String unidadmedidacantidad; + +@Column(name="UNIDADMEDIDACANTIDADCODIGO", nullable=true) + +/** +* null +*/ +private String unidadmedidacantidadcodigo; + +@Column(name="ESTADO", nullable=true) + +/** +* null +*/ +private String estado; + +@Column(name="ESTADOCODIGO", nullable=true) + +/** +* null +*/ +private String estadocodigo; + +@Column(name="COUNTRYCODE", nullable=true) + +/** +* null +*/ +private String countrycode; + +@Column(name="PROVINCECODE", nullable=true) + +/** +* null +*/ +private String provincecode; + +@Column(name="CANTONCODE", nullable=true) + +/** +* null +*/ +private String cantoncode; + +@Column(name="PARROQUIACODE", nullable=true) + +/** +* null +*/ +private String parroquiacode; + +@Column(name="CREGISTRO", nullable=true) + +/** +* null +*/ +private Long cregistro; + +@Column(name="CITYCODE", nullable=true) + +/** +* null +*/ +private String citycode; + +@Column(name="LOTE", nullable=true) + +/** +* null +*/ +private String lote; + +@Column(name="CANTIDAD", nullable=true) + +/** +* null +*/ +private Integer cantidad; + +@Column(name="PESO", nullable=true) + +/** +* null +*/ +private BigDecimal peso; + +@Column(name="MODELO", nullable=true) + +/** +* null +*/ +private String modelo; + +@Column(name="SERIECANON", nullable=true) + +/** +* null +*/ +private String seriecanon; + +@Column(name="FEMISIONPERMISO", nullable=true) + +/** +* null +*/ +private Date femisionpermiso; + +@Column(name="DIRECCION", nullable=true) + +/** +* null +*/ +private String direccion; + +@Column(name="NEMONICOARMA", nullable=true) + +/** +* null +*/ +private String nemonicoarma; + +@Column(name="FECHAREGISTRO", nullable=true) + +/** +* null +*/ +private Date fecharegistro; + +@Column(name="RECORDVERSION", nullable=true) + +/** +* null +*/ +private Integer recordversion; + +@Column(name="CTIPOARMAEXPLOSIVO", nullable=true) + +/** +* null +*/ +private String ctipoarmaexplosivo; + +@Column(name="CODIGOARMA", nullable=true) + +/** +* Codigo identificador de arma +*/ +private String codigoarma; + +@Column(name="FDESADUANIZACION", nullable=true) + +/** +* null +*/ +private Date fdesaduanizacion; + +@Column(name="ESTADODECOMISO", nullable=true) + +/** +* null +*/ +private String estadoDecomiso; + + +@Column(name="ESTADOVENTA", nullable=true) + +/** +* null +*/ +private String estadoventa; + +@Column(name="PATHDOCUMENTO", nullable=true) + +private String pathDocumento; + +/**valor auxiliar + * + */ +@Transient +private int valorAux; + +/**valor auxiliar + * + */ +@Transient +private BigDecimal pesoAux; + +@Column(name="FECHACADUCIDAD", nullable=true) + +/** +* fecha de caducidad del documento habilitante +*/ +private Date fechacaducidad; + +@Column(name="PATHDOCUMENTOCREAR", nullable=true) +private String pathDocumentocrear; + +@Column(name="GENERACERTIFICADO", nullable=true) +private String generacertificado; + + + +public int getValorAux() { + return valorAux; +} +public void setValorAux(int valorAux) { + this.valorAux = valorAux; +} +public BigDecimal getPesoAux() { + return pesoAux; +} +public void setPesoAux(BigDecimal pesoAux) { + this.pesoAux = pesoAux; +} + +/**Contructor por defecto*/ +public TarmArmas(){ +} +/**Contructor de TarmArmas +@param pPk Clave Primaria del entity +*/ +public TarmArmas(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmArmas +*/ +public static TarmArmas find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmArmas obj = pEntityManager.find(TarmArmas.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmArmas +@return El objeto que referencia a la Clave primaria de TarmArmas +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmArmas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmArmas +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de marca +@return valor de marca*/ +public String getMarca(){ + return marca; +} +/**Fija el valor de marca +@param pMarca nuevo Valor de marca*/ +public void setMarca(String pMarca){ + marca=pMarca; +} + +/**Obtiene el valor de marcacodigo +@return valor de marcacodigo*/ +public String getMarcacodigo(){ + return marcacodigo; +} +/**Fija el valor de marcacodigo +@param pMarcacodigo nuevo Valor de marcacodigo*/ +public void setMarcacodigo(String pMarcacodigo){ + marcacodigo=pMarcacodigo; +} + +/**Obtiene el valor de tipofabricacion +@return valor de tipofabricacion*/ +public String getTipofabricacion(){ + return tipofabricacion; +} +/**Fija el valor de tipofabricacion +@param pTipofabricacion nuevo Valor de tipofabricacion*/ +public void setTipofabricacion(String pTipofabricacion){ + tipofabricacion=pTipofabricacion; +} + +/**Obtiene el valor de tipofabricacioncodigo +@return valor de tipofabricacioncodigo*/ +public String getTipofabricacioncodigo(){ + return tipofabricacioncodigo; +} +/**Fija el valor de tipofabricacioncodigo +@param pTipofabricacioncodigo nuevo Valor de tipofabricacioncodigo*/ +public void setTipofabricacioncodigo(String pTipofabricacioncodigo){ + tipofabricacioncodigo=pTipofabricacioncodigo; +} + +/**Obtiene el valor de color +@return valor de color*/ +public String getColor(){ + return color; +} +/**Fija el valor de color +@param pColor nuevo Valor de color*/ +public void setColor(String pColor){ + color=pColor; +} + +/**Obtiene el valor de colorcodigo +@return valor de colorcodigo*/ +public String getColorcodigo(){ + return colorcodigo; +} +/**Fija el valor de colorcodigo +@param pColorcodigo nuevo Valor de colorcodigo*/ +public void setColorcodigo(String pColorcodigo){ + colorcodigo=pColorcodigo; +} + +/**Obtiene el valor de cpaisorigen +@return valor de cpaisorigen*/ +public String getCpaisorigen(){ + return cpaisorigen; +} +/**Fija el valor de cpaisorigen +@param pCpaisorigen nuevo Valor de cpaisorigen*/ +public void setCpaisorigen(String pCpaisorigen){ + cpaisorigen=pCpaisorigen; +} + +/**Obtiene el valor de unidadmedidacantidad +@return valor de unidadmedidacantidad*/ +public String getUnidadmedidacantidad(){ + return unidadmedidacantidad; +} +/**Fija el valor de unidadmedidacantidad +@param pUnidadmedidacantidad nuevo Valor de unidadmedidacantidad*/ +public void setUnidadmedidacantidad(String pUnidadmedidacantidad){ + unidadmedidacantidad=pUnidadmedidacantidad; +} + +/**Obtiene el valor de unidadmedidacantidadcodigo +@return valor de unidadmedidacantidadcodigo*/ +public String getUnidadmedidacantidadcodigo(){ + return unidadmedidacantidadcodigo; +} +/**Fija el valor de unidadmedidacantidadcodigo +@param pUnidadmedidacantidadcodigo nuevo Valor de unidadmedidacantidadcodigo*/ +public void setUnidadmedidacantidadcodigo(String pUnidadmedidacantidadcodigo){ + unidadmedidacantidadcodigo=pUnidadmedidacantidadcodigo; +} + +/**Obtiene el valor de estado +@return valor de estado*/ +public String getEstado(){ + return estado; +} +/**Fija el valor de estado +@param pEstado nuevo Valor de estado*/ +public void setEstado(String pEstado){ + estado=pEstado; +} + +/**Obtiene el valor de estadocodigo +@return valor de estadocodigo*/ +public String getEstadocodigo(){ + return estadocodigo; +} +/**Fija el valor de estadocodigo +@param pEstadocodigo nuevo Valor de estadocodigo*/ +public void setEstadocodigo(String pEstadocodigo){ + estadocodigo=pEstadocodigo; +} + +/**Obtiene el valor de countrycode +@return valor de countrycode*/ +public String getCountrycode(){ + return countrycode; +} +/**Fija el valor de countrycode +@param pCountrycode nuevo Valor de countrycode*/ +public void setCountrycode(String pCountrycode){ + countrycode=pCountrycode; +} + +/**Obtiene el valor de provincecode +@return valor de provincecode*/ +public String getProvincecode(){ + return provincecode; +} +/**Fija el valor de provincecode +@param pProvincecode nuevo Valor de provincecode*/ +public void setProvincecode(String pProvincecode){ + provincecode=pProvincecode; +} + +/**Obtiene el valor de cantoncode +@return valor de cantoncode*/ +public String getCantoncode(){ + return cantoncode; +} +/**Fija el valor de cantoncode +@param pCantoncode nuevo Valor de cantoncode*/ +public void setCantoncode(String pCantoncode){ + cantoncode=pCantoncode; +} + +/**Obtiene el valor de parroquiacode +@return valor de parroquiacode*/ +public String getParroquiacode(){ + return parroquiacode; +} +/**Fija el valor de parroquiacode +@param pParroquiacode nuevo Valor de parroquiacode*/ +public void setParroquiacode(String pParroquiacode){ + parroquiacode=pParroquiacode; +} + +/**Obtiene el valor de cregistro +@return valor de cregistro*/ +public Long getCregistro(){ + return cregistro; +} +/**Fija el valor de cregistro +@param pCregistro nuevo Valor de cregistro*/ +public void setCregistro(Long pCregistro){ + cregistro=pCregistro; +} + +/**Obtiene el valor de citycode +@return valor de citycode*/ +public String getCitycode(){ + return citycode; +} +/**Fija el valor de citycode +@param pCitycode nuevo Valor de citycode*/ +public void setCitycode(String pCitycode){ + citycode=pCitycode; +} + +/**Obtiene el valor de lote +@return valor de lote*/ +public String getLote(){ + return lote; +} +/**Fija el valor de lote +@param pLote nuevo Valor de lote*/ +public void setLote(String pLote){ + lote=pLote; +} + +/**Obtiene el valor de cantidad +@return valor de cantidad*/ +public Integer getCantidad(){ + return cantidad; +} +/**Fija el valor de cantidad +@param pCantidad nuevo Valor de cantidad*/ +public void setCantidad(Integer pCantidad){ + cantidad=pCantidad; +} + +/**Obtiene el valor de peso +@return valor de peso*/ +public BigDecimal getPeso(){ + return peso; +} +/**Fija el valor de peso +@param pPeso nuevo Valor de peso*/ +public void setPeso(BigDecimal pPeso){ + peso=pPeso; +} + +/**Obtiene el valor de modelo +@return valor de modelo*/ +public String getModelo(){ + return modelo; +} +/**Fija el valor de modelo +@param pModelo nuevo Valor de modelo*/ +public void setModelo(String pModelo){ + modelo=pModelo; +} + +/**Obtiene el valor de seriecanon +@return valor de seriecanon*/ +public String getSeriecanon(){ + return seriecanon; +} +/**Fija el valor de seriecanon +@param pSeriecanon nuevo Valor de seriecanon*/ +public void setSeriecanon(String pSeriecanon){ + seriecanon=pSeriecanon; +} + +/**Obtiene el valor de femisionpermiso +@return valor de femisionpermiso*/ +public Date getFemisionpermiso(){ + return femisionpermiso; +} +/**Fija el valor de femisionpermiso +@param pFemisionpermiso nuevo Valor de femisionpermiso*/ +public void setFemisionpermiso(Date pFemisionpermiso){ + femisionpermiso=pFemisionpermiso; +} + +/**Obtiene el valor de direccion +@return valor de direccion*/ +public String getDireccion(){ + return direccion; +} +/**Fija el valor de direccion +@param pDireccion nuevo Valor de direccion*/ +public void setDireccion(String pDireccion){ + direccion=pDireccion; +} + +/**Obtiene el valor de nemonicoarma +@return valor de nemonicoarma*/ +public String getNemonicoarma(){ + return nemonicoarma; +} +/**Fija el valor de nemonicoarma +@param pNemonicoarma nuevo Valor de nemonicoarma*/ +public void setNemonicoarma(String pNemonicoarma){ + nemonicoarma=pNemonicoarma; +} + +/**Obtiene el valor de fecharegistro +@return valor de fecharegistro*/ +public Date getFecharegistro(){ + return fecharegistro; +} +/**Fija el valor de fecharegistro +@param pFecharegistro nuevo Valor de fecharegistro*/ +public void setFecharegistro(Date pFecharegistro){ + fecharegistro=pFecharegistro; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de ctipoarmaexplosivo +@return valor de ctipoarmaexplosivo*/ +public String getCtipoarmaexplosivo(){ + return ctipoarmaexplosivo; +} +/**Fija el valor de ctipoarmaexplosivo +@param pCtipoarmaexplosivo nuevo Valor de ctipoarmaexplosivo*/ +public void setCtipoarmaexplosivo(String pCtipoarmaexplosivo){ + ctipoarmaexplosivo=pCtipoarmaexplosivo; +} + +/**Obtiene el valor de codigoarma +@return valor de codigoarma*/ +public String getCodigoarma(){ + return codigoarma; +} +/**Fija el valor de codigoarma +@param pCodigoarma nuevo Valor de codigoarma*/ +public void setCodigoarma(String pCodigoarma){ + codigoarma=pCodigoarma; +} + +/**Obtiene el valor de fdesaduanizacion +@return valor de fdesaduanizacion*/ +public Date getFdesaduanizacion() { + return fdesaduanizacion; +} +/**Fija el valor de fdesaduanizacion +@param pCodigoarma nuevo Valor de fdesaduanizacion*/ +public void setFdesaduanizacion(Date fdesaduanizacion) { + this.fdesaduanizacion = fdesaduanizacion; +} + +/**Obtiene el valor de fechacaducidad +@return valor de fechacaducidad*/ +public Date getFechacaducidad(){ + return fechacaducidad; +} +/**Fija el valor de fechacaducidad +@param pFechacaducidad nuevo Valor de fechacaducidad*/ +public void setFechacaducidad(Date pFechacaducidad){ + fechacaducidad=pFechacaducidad; +} +public String getPartidaarancelaria() { + return partidaarancelaria; +} +public void setPartidaarancelaria(String partidaarancelaria) { + this.partidaarancelaria = partidaarancelaria; +} +public String getPartidaarancelariacodigo() { + return partidaarancelariacodigo; +} +public void setPartidaarancelariacodigo(String partidaarancelariacodigo) { + this.partidaarancelariacodigo = partidaarancelariacodigo; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmArmas))return false; + TarmArmas that = (TarmArmas) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmArmas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmArmas +*/ +public Object createInstance(){ + TarmArmas instance=new TarmArmas(); + return instance; +} +/**Clona la entidad TarmArmas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmArmas p=(TarmArmas)this.clone(); + return p; +} +public String getEstadoDecomiso() { + return estadoDecomiso; +} +public void setEstadoDecomiso(String estadoDecomiso) { + this.estadoDecomiso = estadoDecomiso; +} +public String getEstadoventa() { + return estadoventa; +} +public void setEstadoventa(String estadoventa) { + this.estadoventa = estadoventa; +} +public String getPathDocumento() { + return pathDocumento; +} +public void setPathDocumento(String pathDocumento) { + this.pathDocumento = pathDocumento; +} +public String getPathDocumentocrear() { + return pathDocumentocrear; +} +public void setPathDocumentocrear(String pathDocumentocrear) { + this.pathDocumentocrear = pathDocumentocrear; +} +public String getGeneracertificado() { + return generacertificado; +} +public void setGeneracertificado(String generacertificado) { + this.generacertificado = generacertificado; +} + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmBodega.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmBodega.java.svn-base new file mode 100644 index 0000000..3d167b9 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmBodega.java.svn-base @@ -0,0 +1,159 @@ +package com.fp.persistence.parmas.soli; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMBODEGA*/ +@Entity(name="TarmBodega") +@Table(name="TARMBODEGA") +public class TarmBodega extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmBodega +*/ +@Id +@Column(name="CBODEGA" ,nullable=false, updatable=false) +private Long pk; +@Column(name="CARMA", nullable=true) + +/** +* codigo del arma +*/ +private String carma; + +@Column(name="CCENTROCONTROL", nullable=true) + +/** +* Codigo de centro de control de armas,codigo de la bodega donde se encuentra el arma +*/ +private String ccentrocontrol; + +/**Contructor por defecto*/ +public TarmBodega(){ +} +/**Contructor de TarmBodega +@param pPk Clave Primaria del entity +*/ +public TarmBodega(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmBodega +*/ +public static TarmBodega find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmBodega obj = pEntityManager.find(TarmBodega.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmBodega +@return El objeto que referencia a la Clave primaria de TarmBodega +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmBodega +@param pPk El objeto que referencia a la nueva Clave primaria de TarmBodega +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de ccentrocontrol +@return valor de ccentrocontrol*/ +public String getCcentrocontrol(){ + return ccentrocontrol; +} +/**Fija el valor de ccentrocontrol +@param pCcentrocontrol nuevo Valor de ccentrocontrol*/ +public void setCcentrocontrol(String pCcentrocontrol){ + ccentrocontrol=pCcentrocontrol; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmBodega))return false; + TarmBodega that = (TarmBodega) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmBodega +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmBodega +*/ +public Object createInstance(){ + TarmBodega instance=new TarmBodega(); + return instance; +} +/**Clona la entidad TarmBodega +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmBodega p=(TarmBodega)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmCabRepDestruirArmas.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmCabRepDestruirArmas.java.svn-base new file mode 100644 index 0000000..e549758 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmCabRepDestruirArmas.java.svn-base @@ -0,0 +1,200 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMCABREPDESTRUIRARMAS*/ +@Entity(name="TarmCabRepDestruirArmas") +@Table(name="TARMCABREPDESTRUIRARMAS") +public class TarmCabRepDestruirArmas extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmCabRepDestruirArmas +*/ +@Id +@Column(name="CREPORTE" ,nullable=false, updatable=false) +private Integer pk; +@Column(name="FREPORTE", nullable=true) + +/** +* Fecha de generacion del reporte +*/ +private Date freporte; + +@Column(name="OBSJEFEDPTO", nullable=true) + +/** +* OBSERVACIONES GENERADAS POR EL JEFE DE DPTO +*/ +private String obsjefedpto; + +@Column(name="OBSJEFECC", nullable=true) + +/** +* OBSERVACIONES GENERADAS POR EL JEFE DEL COMANDO CONJUNTO +*/ +private String obsjefecc; + +@Column(name="XPATH", nullable=true) + +/** +* null +*/ +private String xpath; + +/**Contructor por defecto*/ +public TarmCabRepDestruirArmas(){ +} +/**Contructor de TarmCabRepDestruirArmas +@param pPk Clave Primaria del entity +*/ +public TarmCabRepDestruirArmas(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmCabRepDestruirArmas +*/ +public static TarmCabRepDestruirArmas find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmCabRepDestruirArmas obj = pEntityManager.find(TarmCabRepDestruirArmas.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmCabRepDestruirArmas +@return El objeto que referencia a la Clave primaria de TarmCabRepDestruirArmas +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmCabRepDestruirArmas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmCabRepDestruirArmas +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de freporte +@return valor de freporte*/ +public Date getFreporte(){ + return freporte; +} +/**Fija el valor de freporte +@param pFreporte nuevo Valor de freporte*/ +public void setFreporte(Date pFreporte){ + freporte=pFreporte; +} + +/**Obtiene el valor de obsjefedpto +@return valor de obsjefedpto*/ +public String getObsjefedpto(){ + return obsjefedpto; +} +/**Fija el valor de obsjefedpto +@param pObsjefedpto nuevo Valor de obsjefedpto*/ +public void setObsjefedpto(String pObsjefedpto){ + obsjefedpto=pObsjefedpto; +} + +/**Obtiene el valor de obsjefecc +@return valor de obsjefecc*/ +public String getObsjefecc(){ + return obsjefecc; +} +/**Fija el valor de obsjefecc +@param pObsjefecc nuevo Valor de obsjefecc*/ +public void setObsjefecc(String pObsjefecc){ + obsjefecc=pObsjefecc; +} + +/**Obtiene el valor de xpath +@return valor de xpath*/ +public String getXpath(){ + return xpath; +} +/**Fija el valor de xpath +@param pXpath nuevo Valor de xpath*/ +public void setXpath(String pXpath){ + xpath=pXpath; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmCabRepDestruirArmas))return false; + TarmCabRepDestruirArmas that = (TarmCabRepDestruirArmas) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmCabRepDestruirArmas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmCabRepDestruirArmas +*/ +public Object createInstance(){ + TarmCabRepDestruirArmas instance=new TarmCabRepDestruirArmas(); + return instance; +} +/**Clona la entidad TarmCabRepDestruirArmas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmCabRepDestruirArmas p=(TarmCabRepDestruirArmas)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmCertificadoArmas.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmCertificadoArmas.java.svn-base new file mode 100644 index 0000000..1c387fa --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmCertificadoArmas.java.svn-base @@ -0,0 +1,393 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMCERTIFICADOARMAS*/ +@Entity(name="TarmCertificadoArmas") +@Table(name="TARMCERTIFICADOARMAS") +public class TarmCertificadoArmas extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmCertificadoArmas +*/ +@EmbeddedId +private TarmCertificadoArmasKey pk; +@Column(name="LOTE", nullable=true) + +/** +* null +*/ +private String lote; + +@Column(name="PAISFABRICACION", nullable=true) + +/** +* null +*/ +private String paisfabricacion; + +@Column(name="NAME", nullable=false) + +/** +* null +*/ +private String name; + +@Column(name="CLASE", nullable=true) + +/** +* null +*/ +private String clase; + +@Column(name="ESTADO", nullable=true) + +/** +* null +*/ +private String estado; + +@Column(name="CALIBRE", nullable=true) + +/** +* null +*/ +private String calibre; + +@Column(name="TIPOARMAEXPLOSIVO", nullable=true) + +/** +* null +*/ +private String tipoarmaexplosivo; + +@Column(name="MARCA", nullable=true) + +/** +* null +*/ +private String marca; + +@Column(name="REGISTERDATE", nullable=true) + +/** +* null +*/ +private Date registerdate; + +@Column(name="USERCODE", nullable=true) + +/** +* null +*/ +private String usercode; +@Column(name="TICKET", nullable=true) + +/** +* null +*/ +private Integer ticket; + +@Column(name="IDENTIFICATION", nullable=true) + +/** +* null +*/ +private String identification; + + + + + +@Column(name="PERMISO", nullable=true) + +/** +* null +*/ +private String permiso; + +@Column(name="FECHAEMISON", nullable=true) + +/** +* null +*/ +private Date fechaemison; + +@Column(name="FECHAEXPIRACION", nullable=true) + +/** +* null +*/ +private Date fechaexpiracion; + +/**Contructor por defecto*/ +public TarmCertificadoArmas(){ +} +/**Contructor de TarmCertificadoArmas +@param pPk Clave Primaria del entity +@param pName null +*/ +public TarmCertificadoArmas(TarmCertificadoArmasKey pPk,String pName){ + this(); + pk=pPk; + name=pName; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmCertificadoArmas +*/ +public static TarmCertificadoArmas find(EntityManager pEntityManager,TarmCertificadoArmasKey pKey) throws Exception{ + TarmCertificadoArmas obj = pEntityManager.find(TarmCertificadoArmas.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmCertificadoArmas +@return El objeto que referencia a la Clave primaria de TarmCertificadoArmas +*/ +public TarmCertificadoArmasKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmCertificadoArmas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmCertificadoArmas +*/ +public void setPk(TarmCertificadoArmasKey pPk){ + pk=pPk; +} +/**Obtiene el valor de lote +@return valor de lote*/ +public String getLote(){ + return lote; +} +/**Fija el valor de lote +@param pLote nuevo Valor de lote*/ +public void setLote(String pLote){ + lote=pLote; +} + +/**Obtiene el valor de paisfabricacion +@return valor de paisfabricacion*/ +public String getPaisfabricacion(){ + return paisfabricacion; +} +/**Fija el valor de paisfabricacion +@param pPaisfabricacion nuevo Valor de paisfabricacion*/ +public void setPaisfabricacion(String pPaisfabricacion){ + paisfabricacion=pPaisfabricacion; +} + +/**Obtiene el valor de name +@return valor de name*/ +public String getName(){ + return name; +} +/**Fija el valor de name +@param pName nuevo Valor de name*/ +public void setName(String pName){ + name=pName; +} + +/**Obtiene el valor de clase +@return valor de clase*/ +public String getClase(){ + return clase; +} +/**Fija el valor de clase +@param pClase nuevo Valor de clase*/ +public void setClase(String pClase){ + clase=pClase; +} + +/**Obtiene el valor de estado +@return valor de estado*/ +public String getEstado(){ + return estado; +} +/**Fija el valor de estado +@param pEstado nuevo Valor de estado*/ +public void setEstado(String pEstado){ + estado=pEstado; +} + +/**Obtiene el valor de calibre +@return valor de calibre*/ +public String getCalibre(){ + return calibre; +} +/**Fija el valor de calibre +@param pCalibre nuevo Valor de calibre*/ +public void setCalibre(String pCalibre){ + calibre=pCalibre; +} + +/**Obtiene el valor de tipoarmaexplosivo +@return valor de tipoarmaexplosivo*/ +public String getTipoarmaexplosivo(){ + return tipoarmaexplosivo; +} +/**Fija el valor de tipoarmaexplosivo +@param pTipoarmaexplosivo nuevo Valor de tipoarmaexplosivo*/ +public void setTipoarmaexplosivo(String pTipoarmaexplosivo){ + tipoarmaexplosivo=pTipoarmaexplosivo; +} + +/**Obtiene el valor de marca +@return valor de marca*/ +public String getMarca(){ + return marca; +} +/**Fija el valor de marca +@param pMarca nuevo Valor de marca*/ +public void setMarca(String pMarca){ + marca=pMarca; +} + +/**Obtiene el valor de registerdate +@return valor de registerdate*/ +public Date getRegisterdate(){ + return registerdate; +} +/**Fija el valor de registerdate +@param pRegisterdate nuevo Valor de registerdate*/ +public void setRegisterdate(Date pRegisterdate){ + registerdate=pRegisterdate; +} + +/**Obtiene el valor de identification +@return valor de identification*/ +public String getIdentification(){ + return identification; +} +/**Fija el valor de identification +@param pIdentification nuevo Valor de identification*/ +public void setIdentification(String pIdentification){ + identification=pIdentification; +} + +public String getUsercode() { + return usercode; +} +public void setUsercode(String usercode) { + this.usercode = usercode; +} + +public Integer getTicket() { + return ticket; +} +public void setTicket(Integer ticket) { + this.ticket = ticket; +} +/** + * @return the permiso + */ +public String getPermiso() { + return permiso; +} +/** + * @param permiso the permiso to set + */ +public void setPermiso(String permiso) { + this.permiso = permiso; +} +/** + * @return the fechaemison + */ +public Date getFechaemison() { + return fechaemison; +} +/** + * @param fechaemison the fechaemison to set + */ +public void setFechaemison(Date fechaemison) { + this.fechaemison = fechaemison; +} +/** + * @return the fechaexpiracion + */ +public Date getFechaexpiracion() { + return fechaexpiracion; +} +/** + * @param fechaexpiracion the fechaexpiracion to set + */ +public void setFechaexpiracion(Date fechaexpiracion) { + this.fechaexpiracion = fechaexpiracion; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmCertificadoArmas))return false; + TarmCertificadoArmas that = (TarmCertificadoArmas) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmCertificadoArmas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmCertificadoArmas +*/ +public Object createInstance(){ + TarmCertificadoArmas instance=new TarmCertificadoArmas(); + instance.setPk(new TarmCertificadoArmasKey()); + return instance; +} +/**Clona la entidad TarmCertificadoArmas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmCertificadoArmas p=(TarmCertificadoArmas)this.clone(); + p.setPk((TarmCertificadoArmasKey)this.pk.cloneMe()); + return p; +} + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmCertificadoArmasKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmCertificadoArmasKey.java.svn-base new file mode 100644 index 0000000..e5cba79 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmCertificadoArmasKey.java.svn-base @@ -0,0 +1,153 @@ +package com.fp.persistence.parmas.soli; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMCERTIFICADOARMAS*/ +@Embeddable +public class TarmCertificadoArmasKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SESSIONID", nullable=false,updatable=false) + +/** +* null +*/ +private String sessionid; + +@Column(name="FECHAREPORTE", nullable=false,updatable=false) + +/** +* null +*/ +private Timestamp fechareporte; + +@Column(name="ORDEN", nullable=false,updatable=false) + +/** +* null +*/ +private Integer orden; + +/**Contructor por defecto*/ +public TarmCertificadoArmasKey(){} +/**Contructor de TarmCertificadoArmasKey +@param pSessionid null +@param pFechareporte null +@param pOrden null +*/ +public TarmCertificadoArmasKey(String pSessionid,Timestamp pFechareporte,Integer pOrden){ + sessionid=pSessionid; + fechareporte=pFechareporte; + orden=pOrden; +} +/**Obtiene el valor de sessionid +@return valor de sessionid*/ +public String getSessionid(){ + return sessionid; +} +/**Fija el valor de sessionid +@param pSessionid nuevo Valor de sessionid*/ +public void setSessionid(String pSessionid){ + sessionid=pSessionid; +} + +/**Obtiene el valor de fechareporte +@return valor de fechareporte*/ +public Timestamp getFechareporte(){ + return fechareporte; +} +/**Fija el valor de fechareporte +@param pFechareporte nuevo Valor de fechareporte*/ +public void setFechareporte(Timestamp pFechareporte){ + fechareporte=pFechareporte; +} + +/**Obtiene el valor de orden +@return valor de orden*/ +public Integer getOrden(){ + return orden; +} +/**Fija el valor de orden +@param pOrden nuevo Valor de orden*/ +public void setOrden(Integer pOrden){ + orden=pOrden; +} + +/**Implementacion de la comparacion de TarmCertificadoArmasKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmCertificadoArmasKey))return false; + TarmCertificadoArmasKey that = (TarmCertificadoArmasKey) o; + if (this.getSessionid() == null || that.getSessionid() == null){ + return false; + } + if (! this.getSessionid().equals(that.getSessionid())){ + return false; + } + if (this.getFechareporte() == null || that.getFechareporte() == null){ + return false; + } + if (! this.getFechareporte().equals(that.getFechareporte())){ + return false; + } + if (this.getOrden() == null || that.getOrden() == null){ + return false; + } + if (! this.getOrden().equals(that.getOrden())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmCertificadoArmasKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSessionid() == null ? 0 : this.getSessionid().hashCode()); + result = result * 37 + (this.getFechareporte() == null ? 0 : this.getFechareporte().hashCode()); + result = result * 37 + (this.getOrden() == null ? 0 : this.getOrden().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmCertificadoFiscalia.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmCertificadoFiscalia.java.svn-base new file mode 100644 index 0000000..f448af6 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmCertificadoFiscalia.java.svn-base @@ -0,0 +1,293 @@ +package com.fp.persistence.parmas.soli; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TarmCertificadoFiscalia*/ +@Entity(name="TarmCertificadoFiscalia") +@Table(name="TARMCERTIFICADOFISCALIA") +public class TarmCertificadoFiscalia extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmCertificadoFiscalia +*/ +@Id +@Column(name="CCERTIFICADOFISCALIA" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CERTIFICADOFISCALIA"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.Number"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "8")}) + @GeneratedValue(generator = "seq_id") +private Long pk; + +/** +* Numero de la Solicitid +*/ +@Column(name="NRSOLICITUD", nullable=true) +private String nrsolicitud; + +/** +* Nombre del Solicitante +*/ +@Column(name="NOMBRESOLICITANTE", nullable=true) +private String nombresolicitante; + +/** +* Numero de la instruccion Fiscal +*/ +@Column(name="NRINSTRUCCIONFISCAL", nullable=true) +private String nrinstruccionfiscal; + +/** +* Codigo de persona +*/ +@Column(name="personcode", nullable=true) +private Integer personcode; + +/** +* Direccion del archivo certificado en alfresco +*/ +@Column(name="XPATH", nullable=true) +private String xpath; + +/** +* Direccion del archivo certificado en alfresco para el Fiscal +*/ +@Column(name="XPATHSOLICITUDARMA", nullable=true) +private String xpathSolicitudArma; + +/** +* Fecha de creacin del registro +*/ +@Column(name="FCREACION", nullable=true) +private Date fcreacion; + +/** +* Nro. de oficio Fiscalia +*/ +@Column(name="NROFICIOFISCALIA", nullable=true) +private String nroficiofiscalia; + +/**Contructor por defecto*/ +public TarmCertificadoFiscalia(){ +} +/**Contructor de TarmCertificadoFiscalia +@param pPk Clave Primaria del entity +*/ +public TarmCertificadoFiscalia(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmCertificadoFiscalia +*/ +public static TarmCertificadoFiscalia find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmCertificadoFiscalia obj = pEntityManager.find(TarmCertificadoFiscalia.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmCertificadoFiscalia +@return El objeto que referencia a la Clave primaria de TarmCertificadoFiscalia +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmCertificadoFiscalia +@param pPk El objeto que referencia a la nueva Clave primaria de TarmCertificadoFiscalia +*/ +public void setPk(Long pPk){ + pk=pPk; +} + + +/** + * @return the hashValue + */ +public int getHashValue() { + return hashValue; +} +/** + * @param hashValue the hashValue to set + */ +public void setHashValue(int hashValue) { + this.hashValue = hashValue; +} +/** + * @return the nrsolicitud + */ +public String getNrsolicitud() { + return nrsolicitud; +} +/** + * @param nrsolicitud the nrsolicitud to set + */ +public void setNrsolicitud(String nrsolicitud) { + this.nrsolicitud = nrsolicitud; +} +/** + * @return the nombresolicitante + */ +public String getNombresolicitante() { + return nombresolicitante; +} +/** + * @param nombresolicitante the nombresolicitante to set + */ +public void setNombresolicitante(String nombresolicitante) { + this.nombresolicitante = nombresolicitante; +} +/** + * @return the nrinstruccionfiscal + */ +public String getNrinstruccionfiscal() { + return nrinstruccionfiscal; +} +/** + * @param nrinstruccionfiscal the nrinstruccionfiscal to set + */ +public void setNrinstruccionfiscal(String nrinstruccionfiscal) { + this.nrinstruccionfiscal = nrinstruccionfiscal; +} +/** + * @return the personcode + */ +public Integer getPersoncode() { + return personcode; +} +/** + * @param personcode the personcode to set + */ +public void setPersoncode(Integer personcode) { + this.personcode = personcode; +} +/** + * @return the xpath + */ +public String getXpath() { + return xpath; +} +/** + * @param xpath the xpath to set + */ +public void setXpath(String xpath) { + this.xpath = xpath; +} +/** + * @return the xpathSolicitudArma + */ +public String getXpathSolicitudArma() { + return xpathSolicitudArma; +} +/** + * @param xpathSolicitudArma the xpathSolicitudArma to set + */ +public void setXpathSolicitudArma(String xpathSolicitudArma) { + this.xpathSolicitudArma = xpathSolicitudArma; +} +/** + * @return the fcreacion + */ +public Date getFcreacion() { + return fcreacion; +} +/** + * @param fcreacion the fcreacion to set + */ +public void setFcreacion(Date fcreacion) { + this.fcreacion = fcreacion; +} +/** + * @return the nroficiofiscalia + */ +public String getNroficiofiscalia() { + return nroficiofiscalia; +} +/** + * @param nroficiofiscalia the nroficiofiscalia to set + */ +public void setNroficiofiscalia(String nroficiofiscalia) { + this.nroficiofiscalia = nroficiofiscalia; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmCertificadoFiscalia))return false; + TarmCertificadoFiscalia that = (TarmCertificadoFiscalia) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmCertificadoFiscalia +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmCertificadoFiscalia +*/ +public Object createInstance(){ + TarmCertificadoFiscalia instance=new TarmCertificadoFiscalia(); + return instance; +} +/**Clona la entidad TarmCertificadoFiscalia +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmCertificadoFiscalia p=(TarmCertificadoFiscalia)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmCustodiaTemporal.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmCustodiaTemporal.java.svn-base new file mode 100644 index 0000000..ba3479a --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmCustodiaTemporal.java.svn-base @@ -0,0 +1,524 @@ +package com.fp.persistence.parmas.soli; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMCUSTODIATEMPORAL*/ +@Entity(name="TarmCustodiaTemporal") +@Table(name="TARMCUSTODIATEMPORAL") +public class TarmCustodiaTemporal extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmCustodiaTemporal +*/ +@Id +@Column(name="CCUSTEMP" ,nullable=false, updatable=false) +private String pk; +@Column(name="TIPOREGISTRO", nullable=true) + +/** +* Codigo de catalogo 01 custodia temporal, 02 custodia temporal +*/ +private String tiporegistro; + +@Column(name="TIPOREGISTROCODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de registros +*/ +private String tiporegistrocode; + +@Column(name="AEROLINEA", nullable=true) + +/** +* Codigo de catalogo 01 Lan, 02 Icaro +*/ +private String aerolinea; + +@Column(name="AEROLINEACODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de aerolineas +*/ +private String aerolineacode; + +@Column(name="CCENTROCONTROL", nullable=true) + +/** +* Codigo de centro de control de armas +*/ +private String ccentrocontrol; + +@Column(name="COUNTRYCODEORIGEN", nullable=true) + +/** +* Codigo de pais de origen +*/ +private String countrycodeorigen; + +@Column(name="PROVINCECODEORIGEN", nullable=true) + +/** +* Codigo de provincia de origen +*/ +private String provincecodeorigen; + +@Column(name="CANTONCODEORIGEN", nullable=true) + +/** +* Codigo de canton de origen +*/ +private String cantoncodeorigen; + +@Column(name="CITYCODEORIGEN", nullable=true) + +/** +* Codigo de cuidad de origen +*/ +private String citycodeorigen; + +@Column(name="AEROPUERTOORIG", nullable=true) + +/** +* Codigo de catalogo 01 Mariscal Sucre, 02 Mariscal Lamar +*/ +private String aeropuertoorig; + +@Column(name="AEROPUERTOORIGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de aeropuertos +*/ +private String aeropuertoorigcode; + +@Column(name="COUNTRYCODEDEST", nullable=true) + +/** +* Codigo de pais de destino +*/ +private String countrycodedest; + +@Column(name="PROVINCECODEDEST", nullable=true) + +/** +* Codigo de provincia de destino +*/ +private String provincecodedest; + +@Column(name="CANTONCODEDEST", nullable=true) + +/** +* Codigo de canton de destino +*/ +private String cantoncodedest; + +@Column(name="CITYCODEDEST", nullable=true) + +/** +* Codigo de cuidad de destino +*/ +private String citycodedest; + +@Column(name="AEROPUERTODEST", nullable=true) + +/** +* Codigo de catalogo 01 Mariscal Sucre, 02 Simon Bolivar +*/ +private String aeropuertodest; + +@Column(name="AEROPUERTODESTCODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de aeropuertos de destino +*/ +private String aeropuertodestcode; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona que realiza el registro +*/ +private Integer personcode; + +@Column(name="PERSONCODEPROP", nullable=true) + +/** +* Codigo de persona propietaria +*/ +private Integer personcodeprop; + +@Column(name="NOTRANSACCION", nullable=true) + +/** +* Numero de Transaccion de la custodia temporal +*/ +private String notransaccion; + +@Column(name="FECHACUSTODIOS", nullable=true) + +/** +* Fecha del registro de la custodia temporal +*/ +private Date fechacustodios; + +@Column(name="VUELO", nullable=true) + +/** +* Numero de Vuelo en el cual se custodian las armas +*/ +private String vuelo; + +/**Contructor por defecto*/ +public TarmCustodiaTemporal(){ +} +/**Contructor de TarmCustodiaTemporal +@param pPk Clave Primaria del entity +*/ +public TarmCustodiaTemporal(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmCustodiaTemporal +*/ +public static TarmCustodiaTemporal find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmCustodiaTemporal obj = pEntityManager.find(TarmCustodiaTemporal.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmCustodiaTemporal +@return El objeto que referencia a la Clave primaria de TarmCustodiaTemporal +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmCustodiaTemporal +@param pPk El objeto que referencia a la nueva Clave primaria de TarmCustodiaTemporal +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de tiporegistro +@return valor de tiporegistro*/ +public String getTiporegistro(){ + return tiporegistro; +} +/**Fija el valor de tiporegistro +@param pTiporegistro nuevo Valor de tiporegistro*/ +public void setTiporegistro(String pTiporegistro){ + tiporegistro=pTiporegistro; +} + +/**Obtiene el valor de tiporegistrocode +@return valor de tiporegistrocode*/ +public String getTiporegistrocode(){ + return tiporegistrocode; +} +/**Fija el valor de tiporegistrocode +@param pTiporegistrocode nuevo Valor de tiporegistrocode*/ +public void setTiporegistrocode(String pTiporegistrocode){ + tiporegistrocode=pTiporegistrocode; +} + +/**Obtiene el valor de aerolinea +@return valor de aerolinea*/ +public String getAerolinea(){ + return aerolinea; +} +/**Fija el valor de aerolinea +@param pAerolinea nuevo Valor de aerolinea*/ +public void setAerolinea(String pAerolinea){ + aerolinea=pAerolinea; +} + +/**Obtiene el valor de aerolineacode +@return valor de aerolineacode*/ +public String getAerolineacode(){ + return aerolineacode; +} +/**Fija el valor de aerolineacode +@param pAerolineacode nuevo Valor de aerolineacode*/ +public void setAerolineacode(String pAerolineacode){ + aerolineacode=pAerolineacode; +} + +/**Obtiene el valor de ccentrocontrol +@return valor de ccentrocontrol*/ +public String getCcentrocontrol(){ + return ccentrocontrol; +} +/**Fija el valor de ccentrocontrol +@param pCcentrocontrol nuevo Valor de ccentrocontrol*/ +public void setCcentrocontrol(String pCcentrocontrol){ + ccentrocontrol=pCcentrocontrol; +} + +/**Obtiene el valor de countrycodeorigen +@return valor de countrycodeorigen*/ +public String getCountrycodeorigen(){ + return countrycodeorigen; +} +/**Fija el valor de countrycodeorigen +@param pCountrycodeorigen nuevo Valor de countrycodeorigen*/ +public void setCountrycodeorigen(String pCountrycodeorigen){ + countrycodeorigen=pCountrycodeorigen; +} + +/**Obtiene el valor de provincecodeorigen +@return valor de provincecodeorigen*/ +public String getProvincecodeorigen(){ + return provincecodeorigen; +} +/**Fija el valor de provincecodeorigen +@param pProvincecodeorigen nuevo Valor de provincecodeorigen*/ +public void setProvincecodeorigen(String pProvincecodeorigen){ + provincecodeorigen=pProvincecodeorigen; +} + +/**Obtiene el valor de cantoncodeorigen +@return valor de cantoncodeorigen*/ +public String getCantoncodeorigen(){ + return cantoncodeorigen; +} +/**Fija el valor de cantoncodeorigen +@param pCantoncodeorigen nuevo Valor de cantoncodeorigen*/ +public void setCantoncodeorigen(String pCantoncodeorigen){ + cantoncodeorigen=pCantoncodeorigen; +} + +/**Obtiene el valor de citycodeorigen +@return valor de citycodeorigen*/ +public String getCitycodeorigen(){ + return citycodeorigen; +} +/**Fija el valor de citycodeorigen +@param pCitycodeorigen nuevo Valor de citycodeorigen*/ +public void setCitycodeorigen(String pCitycodeorigen){ + citycodeorigen=pCitycodeorigen; +} + +/**Obtiene el valor de aeropuertoorig +@return valor de aeropuertoorig*/ +public String getAeropuertoorig(){ + return aeropuertoorig; +} +/**Fija el valor de aeropuertoorig +@param pAeropuertoorig nuevo Valor de aeropuertoorig*/ +public void setAeropuertoorig(String pAeropuertoorig){ + aeropuertoorig=pAeropuertoorig; +} + +/**Obtiene el valor de aeropuertoorigcode +@return valor de aeropuertoorigcode*/ +public String getAeropuertoorigcode(){ + return aeropuertoorigcode; +} +/**Fija el valor de aeropuertoorigcode +@param pAeropuertoorigcode nuevo Valor de aeropuertoorigcode*/ +public void setAeropuertoorigcode(String pAeropuertoorigcode){ + aeropuertoorigcode=pAeropuertoorigcode; +} + +/**Obtiene el valor de countrycodedest +@return valor de countrycodedest*/ +public String getCountrycodedest(){ + return countrycodedest; +} +/**Fija el valor de countrycodedest +@param pCountrycodedest nuevo Valor de countrycodedest*/ +public void setCountrycodedest(String pCountrycodedest){ + countrycodedest=pCountrycodedest; +} + +/**Obtiene el valor de provincecodedest +@return valor de provincecodedest*/ +public String getProvincecodedest(){ + return provincecodedest; +} +/**Fija el valor de provincecodedest +@param pProvincecodedest nuevo Valor de provincecodedest*/ +public void setProvincecodedest(String pProvincecodedest){ + provincecodedest=pProvincecodedest; +} + +/**Obtiene el valor de cantoncodedest +@return valor de cantoncodedest*/ +public String getCantoncodedest(){ + return cantoncodedest; +} +/**Fija el valor de cantoncodedest +@param pCantoncodedest nuevo Valor de cantoncodedest*/ +public void setCantoncodedest(String pCantoncodedest){ + cantoncodedest=pCantoncodedest; +} + +/**Obtiene el valor de citycodedest +@return valor de citycodedest*/ +public String getCitycodedest(){ + return citycodedest; +} +/**Fija el valor de citycodedest +@param pCitycodedest nuevo Valor de citycodedest*/ +public void setCitycodedest(String pCitycodedest){ + citycodedest=pCitycodedest; +} + +/**Obtiene el valor de aeropuertodest +@return valor de aeropuertodest*/ +public String getAeropuertodest(){ + return aeropuertodest; +} +/**Fija el valor de aeropuertodest +@param pAeropuertodest nuevo Valor de aeropuertodest*/ +public void setAeropuertodest(String pAeropuertodest){ + aeropuertodest=pAeropuertodest; +} + +/**Obtiene el valor de aeropuertodestcode +@return valor de aeropuertodestcode*/ +public String getAeropuertodestcode(){ + return aeropuertodestcode; +} +/**Fija el valor de aeropuertodestcode +@param pAeropuertodestcode nuevo Valor de aeropuertodestcode*/ +public void setAeropuertodestcode(String pAeropuertodestcode){ + aeropuertodestcode=pAeropuertodestcode; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de personcodeprop +@return valor de personcodeprop*/ +public Integer getPersoncodeprop(){ + return personcodeprop; +} +/**Fija el valor de personcodeprop +@param pPersoncodeprop nuevo Valor de personcodeprop*/ +public void setPersoncodeprop(Integer pPersoncodeprop){ + personcodeprop=pPersoncodeprop; +} + +/**Obtiene el valor de notransaccion +@return valor de notransaccion*/ +public String getNotransaccion(){ + return notransaccion; +} +/**Fija el valor de notransaccion +@param pNotransaccion nuevo Valor de notransaccion*/ +public void setNotransaccion(String pNotransaccion){ + notransaccion=pNotransaccion; +} + +/**Obtiene el valor de fechacustodios +@return valor de fechacustodios*/ +public Date getFechacustodios(){ + return fechacustodios; +} +/**Fija el valor de fechacustodios +@param pFechacustodios nuevo Valor de fechacustodios*/ +public void setFechacustodios(Date pFechacustodios){ + fechacustodios=pFechacustodios; +} + +/**Obtiene el valor de vuelo +@return valor de vuelo*/ +public String getVuelo(){ + return vuelo; +} +/**Fija el valor de vuelo +@param pVuelo nuevo Valor de vuelo*/ +public void setVuelo(String pVuelo){ + vuelo=pVuelo; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmCustodiaTemporal))return false; + TarmCustodiaTemporal that = (TarmCustodiaTemporal) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmCustodiaTemporal +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmCustodiaTemporal +*/ +public Object createInstance(){ + TarmCustodiaTemporal instance=new TarmCustodiaTemporal(); + return instance; +} +/**Clona la entidad TarmCustodiaTemporal +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmCustodiaTemporal p=(TarmCustodiaTemporal)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmDecomiso.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmDecomiso.java.svn-base new file mode 100644 index 0000000..91ba8ec --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmDecomiso.java.svn-base @@ -0,0 +1,694 @@ +package com.fp.persistence.parmas.soli; + +import com.fp.dto.hb.Log; + +import javax.persistence.Id; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; + +import javax.persistence.Version; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Column; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMDECOMISO*/ +@Entity(name="TarmDecomiso") +@Table(name="TARMDECOMISO") +public class TarmDecomiso extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmDecomiso +*/ +@Id +@Column(name="CDECOMISO" ,nullable=false, updatable=false) +private Long pk; +@Column(name="FECHADECOMISO", nullable=true) + +/** +* Fecha del decomiso +*/ +private Date fechadecomiso; + +@Column(name="NUMERORECIBO", nullable=true) + +/** +* Nmero del recibo +*/ +private String numerorecibo; + +@Column(name="PARROQUIACODE", nullable=true) + +/** +* Codigo de parroquia de decomiso +*/ +private String parroquiacode; + +@Column(name="COUNTRYCODE", nullable=true) + +/** +* Codigo de pais de decomiso +*/ +private String countrycode; + +@Column(name="LATITUD", nullable=true) + +/** +* null +*/ +private BigDecimal latitud; + +@Column(name="FECHAREGISTRO", nullable=true) + +/** +* Fecha de registro +*/ +private Date fecharegistro; + +@Column(name="TIPODOCUMENTO", nullable=true) + +/** +* Codigo de catalogo 01 Cdula, 02 Ruc +*/ +private String tipodocumento; + +@Column(name="TELEFONO", nullable=true) + +/** +* Telfono del decomisado +*/ +private String telefono; + +@Column(name="NUMEROTRANSACCION", nullable=true) + +/** +* Nmero de la transaccin +*/ +private String numerotransaccion; + +@Column(name="GRADOFUNCIONARIOCODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de grado +*/ +private String gradofuncionariocode; + +@Column(name="TIPODOCUMENTOCODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de documento +*/ +private String tipodocumentocode; + +@Column(name="TIPOPROCESO", nullable=true) + +/** +* Codigo de catalogo 01 Decomiso, 02 Incautacin +*/ +private String tipoproceso; + +@Column(name="PROVINCECODE", nullable=true) + +/** +* Codigo de provincia de decomiso +*/ +private String provincecode; + +@Column(name="FUNCIONARIO", nullable=true) + +/** +* Nombre del funcionario que realiza el decomiso +*/ +private String funcionario; + +@Column(name="GRADOFUNCIONARIO", nullable=true) + +/** +* Codigo de catalogo 01 Crnl, 02 Tnte +*/ +private String gradofuncionario; + +@Column(name="CCENTROCONTROLDESTINO", nullable=true) + +/** +* Codigo de centro de control de armas de destino(Donde se van a ser destruidas o donadas) +*/ +private String ccentrocontroldestino; + +@Column(name="PERSONCODEREGISTRA", nullable=true) + +/** +* codigo de la persona que realiza el registro +*/ +private Integer personcoderegistra; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona portadora del arma +*/ +private Integer personcode; + +@Column(name="CEDULAFUNCIONARIO", nullable=true) + +/** +* cdula de la persona que realiza el decomiso(Funcionario) +*/ +private String cedulafuncionario; + +@Column(name="NUMERODOCUMENTO", nullable=true) + +/** +* Nmero de documento de la persna o empresa a quien se le realiza el decomiso +*/ +private String numerodocumento; + +@Column(name="ORGANISMOCONTROL", nullable=true) + +/** +* Organismo de control "Fuerzas Armadas" +*/ +private String organismocontrol; + +@Column(name="CITYCODE", nullable=true) + +/** +* Codigo de cuidad de decomiso +*/ +private String citycode; + +@Column(name="CANTONCODE", nullable=true) + +/** +* Codigo de canton de decomiso +*/ +private String cantoncode; + +@Column(name="TIPOPROCESOCODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Cdigo del tipo de proceso +*/ +private String tipoprocesocode; + +@Column(name="LONGITUD", nullable=true) + +/** +* null +*/ +private BigDecimal longitud; + +@Column(name="NOMBRERAZONSOCIAL", nullable=true) + +/** +* Nombre de la persona o empresa del decomisado +*/ +private String nombrerazonsocial; + +@Column(name="DIRECCION", nullable=true) + +/** +* Direccin del lugar de decomiso +*/ +private String direccion; + + +@Column(name="CCENTROCONTROL", nullable=true) + +/** +* Codigo de centro de control de armas +*/ +private String ccentrocontrol; + +@Column(name="REFERENCIA", nullable=true) + +/** +* Refencia de una direccion del decomiso +*/ +private String referencia; + +@Column(name="XPATH", nullable=true) + +/** +* null +*/ +private String xpath; + +@Column(name="COMPROBANTEXPATH", nullable=true) + +/** +* null +*/ +private String comprobantexpath; + +/**Contructor por defecto*/ +public TarmDecomiso(){ +} +/**Contructor de TarmDecomiso +@param pPk Clave Primaria del entity +*/ +public TarmDecomiso(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmDecomiso +*/ +public static TarmDecomiso find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmDecomiso obj = pEntityManager.find(TarmDecomiso.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmDecomiso +@return El objeto que referencia a la Clave primaria de TarmDecomiso +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmDecomiso +@param pPk El objeto que referencia a la nueva Clave primaria de TarmDecomiso +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de fechadecomiso +@return valor de fechadecomiso*/ +public Date getFechadecomiso(){ + return fechadecomiso; +} +/**Fija el valor de fechadecomiso +@param pFechadecomiso nuevo Valor de fechadecomiso*/ +public void setFechadecomiso(Date pFechadecomiso){ + fechadecomiso=pFechadecomiso; +} + +/**Obtiene el valor de numerorecibo +@return valor de numerorecibo*/ +public String getNumerorecibo(){ + return numerorecibo; +} +/**Fija el valor de numerorecibo +@param pNumerorecibo nuevo Valor de numerorecibo*/ +public void setNumerorecibo(String pNumerorecibo){ + numerorecibo=pNumerorecibo; +} + +/**Obtiene el valor de parroquiacode +@return valor de parroquiacode*/ +public String getParroquiacode(){ + return parroquiacode; +} +/**Fija el valor de parroquiacode +@param pParroquiacode nuevo Valor de parroquiacode*/ +public void setParroquiacode(String pParroquiacode){ + parroquiacode=pParroquiacode; +} + +/**Obtiene el valor de countrycode +@return valor de countrycode*/ +public String getCountrycode(){ + return countrycode; +} +/**Fija el valor de countrycode +@param pCountrycode nuevo Valor de countrycode*/ +public void setCountrycode(String pCountrycode){ + countrycode=pCountrycode; +} + +/**Obtiene el valor de latitud +@return valor de latitud*/ +public BigDecimal getLatitud(){ + return latitud; +} +/**Fija el valor de latitud +@param pLatitud nuevo Valor de latitud*/ +public void setLatitud(BigDecimal pLatitud){ + latitud=pLatitud; +} + +/**Obtiene el valor de fecharegistro +@return valor de fecharegistro*/ +public Date getFecharegistro(){ + return fecharegistro; +} +/**Fija el valor de fecharegistro +@param pFecharegistro nuevo Valor de fecharegistro*/ +public void setFecharegistro(Date pFecharegistro){ + fecharegistro=pFecharegistro; +} + +/**Obtiene el valor de tipodocumento +@return valor de tipodocumento*/ +public String getTipodocumento(){ + return tipodocumento; +} +/**Fija el valor de tipodocumento +@param pTipodocumento nuevo Valor de tipodocumento*/ +public void setTipodocumento(String pTipodocumento){ + tipodocumento=pTipodocumento; +} + +/**Obtiene el valor de telefono +@return valor de telefono*/ +public String getTelefono(){ + return telefono; +} +/**Fija el valor de telefono +@param pTelefono nuevo Valor de telefono*/ +public void setTelefono(String pTelefono){ + telefono=pTelefono; +} + +/**Obtiene el valor de numerotransaccion +@return valor de numerotransaccion*/ +public String getNumerotransaccion(){ + return numerotransaccion; +} +/**Fija el valor de numerotransaccion +@param pNumerotransaccion nuevo Valor de numerotransaccion*/ +public void setNumerotransaccion(String pNumerotransaccion){ + numerotransaccion=pNumerotransaccion; +} + +/**Obtiene el valor de gradofuncionariocode +@return valor de gradofuncionariocode*/ +public String getGradofuncionariocode(){ + return gradofuncionariocode; +} +/**Fija el valor de gradofuncionariocode +@param pGradofuncionariocode nuevo Valor de gradofuncionariocode*/ +public void setGradofuncionariocode(String pGradofuncionariocode){ + gradofuncionariocode=pGradofuncionariocode; +} + +/**Obtiene el valor de tipodocumentocode +@return valor de tipodocumentocode*/ +public String getTipodocumentocode(){ + return tipodocumentocode; +} +/**Fija el valor de tipodocumentocode +@param pTipodocumentocode nuevo Valor de tipodocumentocode*/ +public void setTipodocumentocode(String pTipodocumentocode){ + tipodocumentocode=pTipodocumentocode; +} + +/**Obtiene el valor de tipoproceso +@return valor de tipoproceso*/ +public String getTipoproceso(){ + return tipoproceso; +} +/**Fija el valor de tipoproceso +@param pTipoproceso nuevo Valor de tipoproceso*/ +public void setTipoproceso(String pTipoproceso){ + tipoproceso=pTipoproceso; +} + +/**Obtiene el valor de provincecode +@return valor de provincecode*/ +public String getProvincecode(){ + return provincecode; +} +/**Fija el valor de provincecode +@param pProvincecode nuevo Valor de provincecode*/ +public void setProvincecode(String pProvincecode){ + provincecode=pProvincecode; +} + +/**Obtiene el valor de funcionario +@return valor de funcionario*/ +public String getFuncionario(){ + return funcionario; +} +/**Fija el valor de funcionario +@param pFuncionario nuevo Valor de funcionario*/ +public void setFuncionario(String pFuncionario){ + funcionario=pFuncionario; +} + +/**Obtiene el valor de gradofuncionario +@return valor de gradofuncionario*/ +public String getGradofuncionario(){ + return gradofuncionario; +} +/**Fija el valor de gradofuncionario +@param pGradofuncionario nuevo Valor de gradofuncionario*/ +public void setGradofuncionario(String pGradofuncionario){ + gradofuncionario=pGradofuncionario; +} + +/**Obtiene el valor de ccentrocontroldestino +@return valor de ccentrocontroldestino*/ +public String getCcentrocontroldestino(){ + return ccentrocontroldestino; +} +/**Fija el valor de ccentrocontroldestino +@param pCcentrocontroldestino nuevo Valor de ccentrocontroldestino*/ +public void setCcentrocontroldestino(String pCcentrocontroldestino){ + ccentrocontroldestino=pCcentrocontroldestino; +} + +/**Obtiene el valor de personcoderegistra +@return valor de personcoderegistra*/ +public Integer getPersoncoderegistra(){ + return personcoderegistra; +} +/**Fija el valor de personcoderegistra +@param pPersoncoderegistra nuevo Valor de personcoderegistra*/ +public void setPersoncoderegistra(Integer pPersoncoderegistra){ + personcoderegistra=pPersoncoderegistra; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de cedulafuncionario +@return valor de cedulafuncionario*/ +public String getCedulafuncionario(){ + return cedulafuncionario; +} +/**Fija el valor de cedulafuncionario +@param pCedulafuncionario nuevo Valor de cedulafuncionario*/ +public void setCedulafuncionario(String pCedulafuncionario){ + cedulafuncionario=pCedulafuncionario; +} + +/**Obtiene el valor de numerodocumento +@return valor de numerodocumento*/ +public String getNumerodocumento(){ + return numerodocumento; +} +/**Fija el valor de numerodocumento +@param pNumerodocumento nuevo Valor de numerodocumento*/ +public void setNumerodocumento(String pNumerodocumento){ + numerodocumento=pNumerodocumento; +} + +/**Obtiene el valor de organismocontrol +@return valor de organismocontrol*/ +public String getOrganismocontrol(){ + return organismocontrol; +} +/**Fija el valor de organismocontrol +@param pOrganismocontrol nuevo Valor de organismocontrol*/ +public void setOrganismocontrol(String pOrganismocontrol){ + organismocontrol=pOrganismocontrol; +} + +/**Obtiene el valor de citycode +@return valor de citycode*/ +public String getCitycode(){ + return citycode; +} +/**Fija el valor de citycode +@param pCitycode nuevo Valor de citycode*/ +public void setCitycode(String pCitycode){ + citycode=pCitycode; +} + +/**Obtiene el valor de cantoncode +@return valor de cantoncode*/ +public String getCantoncode(){ + return cantoncode; +} +/**Fija el valor de cantoncode +@param pCantoncode nuevo Valor de cantoncode*/ +public void setCantoncode(String pCantoncode){ + cantoncode=pCantoncode; +} + +/**Obtiene el valor de tipoprocesocode +@return valor de tipoprocesocode*/ +public String getTipoprocesocode(){ + return tipoprocesocode; +} +/**Fija el valor de tipoprocesocode +@param pTipoprocesocode nuevo Valor de tipoprocesocode*/ +public void setTipoprocesocode(String pTipoprocesocode){ + tipoprocesocode=pTipoprocesocode; +} + +/**Obtiene el valor de longitud +@return valor de longitud*/ +public BigDecimal getLongitud(){ + return longitud; +} +/**Fija el valor de longitud +@param pLongitud nuevo Valor de longitud*/ +public void setLongitud(BigDecimal pLongitud){ + longitud=pLongitud; +} + +/**Obtiene el valor de nombrerazonsocial +@return valor de nombrerazonsocial*/ +public String getNombrerazonsocial(){ + return nombrerazonsocial; +} +/**Fija el valor de nombrerazonsocial +@param pNombrerazonsocial nuevo Valor de nombrerazonsocial*/ +public void setNombrerazonsocial(String pNombrerazonsocial){ + nombrerazonsocial=pNombrerazonsocial; +} + +/**Obtiene el valor de direccion +@return valor de direccion*/ +public String getDireccion(){ + return direccion; +} +/**Fija el valor de direccion +@param pDireccion nuevo Valor de direccion*/ +public void setDireccion(String pDireccion){ + direccion=pDireccion; +} + +/**Obtiene el valor de ccentrocontrol +@return valor de ccentrocontrol*/ +public String getCcentrocontrol(){ + return ccentrocontrol; +} +/**Fija el valor de ccentrocontrol +@param pCcentrocontrol nuevo Valor de ccentrocontrol*/ +public void setCcentrocontrol(String pCcentrocontrol){ + ccentrocontrol=pCcentrocontrol; +} + /** + * @return the referencia + */ + public String getReferencia() { + return referencia; + } + + /** + * @param referencia the referencia to set + */ + public void setReferencia(String referencia) { + this.referencia = referencia; + } + + + /**Obtiene el valor de xpath + @return valor de xpath*/ + public String getXpath(){ + return xpath; + } + /**Fija el valor de xpath + @param xpathacta nuevo Valor de xpath*/ + public void setXpath(String xpath){ + this.xpath=xpath; + } + /**Obtiene el valor de comprobantexpath + @return valor de comprobantexpath*/ + public String getComprobantexpath() { + return comprobantexpath; + } + /**Fija el valor de comprobantexpath + @param xpathacta nuevo Valor de comprobantexpath*/ + public void setComprobantexpath(String comprobantexpath) { + this.comprobantexpath = comprobantexpath; + } + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmDecomiso))return false; + TarmDecomiso that = (TarmDecomiso) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmDecomiso +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmDecomiso +*/ +public Object createInstance(){ + TarmDecomiso instance=new TarmDecomiso(); + return instance; +} +/**Clona la entidad TarmDecomiso +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmDecomiso p=(TarmDecomiso)this.clone(); + return p; +} + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmDecomisoArma.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmDecomisoArma.java.svn-base new file mode 100644 index 0000000..e850f3b --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmDecomisoArma.java.svn-base @@ -0,0 +1,493 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; + +import java.sql.Timestamp; + +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMDECOMISOARMA*/ +@Entity(name="TarmDecomisoArma") +@Table(name="TARMDECOMISOARMA") +public class TarmDecomisoArma extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmDecomisoArma +*/ +@Id +@Column(name="CDECOMISOARMA" ,nullable=false, updatable=false) +private String pk; +@Column(name="CARMA", nullable=true) + +/** +* codigo da la tabla TarmArma +*/ +private String carma; + +@Column(name="MOTIVODECOMISO", nullable=true) + +/** +* Codigo de catalogo 01 Permiso Caducado, 02 Sin Papeles +*/ +private String motivodecomiso; + +@Column(name="MOTIVODECOMISOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String motivodecomisocodigo; + +@Column(name="ESTADO", nullable=true) + +/** +* Codigo de catalogo 01 Decomisado, 02 Incautado +*/ +private String estado; + +@Column(name="ESTADOCODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de estados +*/ +private String estadocode; + +@Column(name="UNIDADMEDIDA", nullable=true) + +/** +* Codigo de catalogo 01 Unidad, 02 Peso +*/ +private String unidadmedida; + +@Column(name="UNIDADMEDIDACODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de unidad +*/ +private String unidadmedidacode; + +@Column(name="CDECOMISO", nullable=true) + +/** +* Codigo de la Tabla Decomiso +*/ +private Long cdecomiso; + +@Column(name="FDECOMISO", nullable=true) + +/** +* fecha de registro del decomiso +*/ +private Timestamp fdecomiso; + +@Column(name="CANTIDAD", nullable=true) + +/** +* cantidad decomisada +*/ +private BigDecimal cantidad; + +@Column(name="OBSERVACION", nullable=true) + +/** +* observacin del decomiso +*/ +private String observacion; + +@Column(name="CCUSTEMP", nullable=true) + +/** +* null +*/ +private String ccustemp; + +@Column(name="ADESTRUIRSE", nullable=true) + +/** +* Codigo de catalogo para indicar si el arma esta en algun reporte del flujo de armas a destruir +*/ +private String adestruirse; + +@Column(name="ADESTRUIRSECODE", nullable=true) + +/** +* CatalogCode para indicar si el arma esta en algun reporte del flujo de armas a destruir +*/ +private String adestruirsecode; + +@Column(name="ESTADOANTERIOR", nullable=true) + +/** +* Tabla que contiene los decomisos y la custodia temporal de las armas asignadas a la persona +*/ +private String estadoanterior; + +@Column(name="TIPOREGISTROANTERIOR", nullable=true) + +/** +* CAmpo que registra el estado anterior del registro arma para cuando se devuelva regrese a su estado anterior +*/ +private String tiporegistroanterior; + +@Column(name="ENBODEGA", nullable=true) + +/** +* CAMPO QUE INDICA QUE EL TECNICO DE ALMACENAMIENTO CONFIRMO QUE EL ARMA DECOMISADA SE ENCUENTRA EN BODEGA +*/ +private String enbodega; + +@Column(name="CDECOMISOARMATRANSACCION", nullable=true) + +/** +* Clave foranea a TARMDECOMISOARMATRANSACCION +*/ +private Long cdecomisoarmatransaccion; + +@Column(name="CDECARMTRANRECEPCION", nullable=true) + +/** +* Codigo de la tabla TarmDecomisoArmaTransaccion para obtener el numero de transaccion de recepcion +*/ +private Long cdecarmtranrecepcion; + + +/** +* Operacion actual de la transaccion +*/ +@Column(name="COPERACIONTRANSACCION", nullable=true) +private String coperaciontransaccion; + + + +/**Contructor por defecto*/ +public TarmDecomisoArma(){ +} +/**Contructor de TarmDecomisoArma +@param pPk Clave Primaria del entity +*/ +public TarmDecomisoArma(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmDecomisoArma +*/ +public static TarmDecomisoArma find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmDecomisoArma obj = pEntityManager.find(TarmDecomisoArma.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmDecomisoArma +@return El objeto que referencia a la Clave primaria de TarmDecomisoArma +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmDecomisoArma +@param pPk El objeto que referencia a la nueva Clave primaria de TarmDecomisoArma +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de motivodecomiso +@return valor de motivodecomiso*/ +public String getMotivodecomiso(){ + return motivodecomiso; +} +/**Fija el valor de motivodecomiso +@param pMotivodecomiso nuevo Valor de motivodecomiso*/ +public void setMotivodecomiso(String pMotivodecomiso){ + motivodecomiso=pMotivodecomiso; +} + +/**Obtiene el valor de motivodecomisocodigo +@return valor de motivodecomisocodigo*/ +public String getMotivodecomisocodigo(){ + return motivodecomisocodigo; +} +/**Fija el valor de motivodecomisocodigo +@param pMotivodecomisocodigo nuevo Valor de motivodecomisocodigo*/ +public void setMotivodecomisocodigo(String pMotivodecomisocodigo){ + motivodecomisocodigo=pMotivodecomisocodigo; +} + +/**Obtiene el valor de estado +@return valor de estado*/ +public String getEstado(){ + return estado; +} +/**Fija el valor de estado +@param pEstado nuevo Valor de estado*/ +public void setEstado(String pEstado){ + estado=pEstado; +} + +/**Obtiene el valor de estadocode +@return valor de estadocode*/ +public String getEstadocode(){ + return estadocode; +} +/**Fija el valor de estadocode +@param pEstadocode nuevo Valor de estadocode*/ +public void setEstadocode(String pEstadocode){ + estadocode=pEstadocode; +} + +/**Obtiene el valor de unidadmedida +@return valor de unidadmedida*/ +public String getUnidadmedida(){ + return unidadmedida; +} +/**Fija el valor de unidadmedida +@param pUnidadmedida nuevo Valor de unidadmedida*/ +public void setUnidadmedida(String pUnidadmedida){ + unidadmedida=pUnidadmedida; +} + +/**Obtiene el valor de unidadmedidacode +@return valor de unidadmedidacode*/ +public String getUnidadmedidacode(){ + return unidadmedidacode; +} +/**Fija el valor de unidadmedidacode +@param pUnidadmedidacode nuevo Valor de unidadmedidacode*/ +public void setUnidadmedidacode(String pUnidadmedidacode){ + unidadmedidacode=pUnidadmedidacode; +} + +/**Obtiene el valor de cdecomiso +@return valor de cdecomiso*/ +public Long getCdecomiso(){ + return cdecomiso; +} +/**Fija el valor de cdecomiso +@param pCdecomiso nuevo Valor de cdecomiso*/ +public void setCdecomiso(Long pCdecomiso){ + cdecomiso=pCdecomiso; +} + +/**Obtiene el valor de fdecomiso +@return valor de fdecomiso*/ +public Timestamp getFdecomiso(){ + return fdecomiso; +} +/**Fija el valor de fdecomiso +@param pFdecomiso nuevo Valor de fdecomiso*/ +public void setFdecomiso(Timestamp pFdecomiso){ + fdecomiso=pFdecomiso; +} + +/**Obtiene el valor de cantidad +@return valor de cantidad*/ +public BigDecimal getCantidad(){ + return cantidad; +} +/**Fija el valor de cantidad +@param pCantidad nuevo Valor de cantidad*/ +public void setCantidad(BigDecimal pCantidad){ + cantidad=pCantidad; +} + +/**Obtiene el valor de observacion +@return valor de observacion*/ +public String getObservacion(){ + return observacion; +} +/**Fija el valor de observacion +@param pObservacion nuevo Valor de observacion*/ +public void setObservacion(String pObservacion){ + observacion=pObservacion; +} + +/**Obtiene el valor de ccustemp +@return valor de ccustemp*/ +public String getCcustemp(){ + return ccustemp; +} +/**Fija el valor de ccustemp +@param pCcustemp nuevo Valor de ccustemp*/ +public void setCcustemp(String pCcustemp){ + ccustemp=pCcustemp; +} + +/**Obtiene el valor de adestruirse +@return valor de adestruirse*/ +public String getAdestruirse(){ + return adestruirse; +} +/**Fija el valor de adestruirse +@param pAdestruirse nuevo Valor de adestruirse*/ +public void setAdestruirse(String pAdestruirse){ + adestruirse=pAdestruirse; +} + +/**Obtiene el valor de adestruirsecode +@return valor de adestruirsecode*/ +public String getAdestruirsecode(){ + return adestruirsecode; +} +/**Fija el valor de adestruirsecode +@param pAdestruirsecode nuevo Valor de adestruirsecode*/ +public void setAdestruirsecode(String pAdestruirsecode){ + adestruirsecode=pAdestruirsecode; +} + +/**Obtiene el valor de estadoanterior +@return valor de estadoanterior*/ +public String getEstadoanterior(){ + return estadoanterior; +} +/**Fija el valor de estadoanterior +@param pEstadoanterior nuevo Valor de estadoanterior*/ +public void setEstadoanterior(String pEstadoanterior){ + estadoanterior=pEstadoanterior; +} + +/**Obtiene el valor de tiporegistroanterior +@return valor de tiporegistroanterior*/ +public String getTiporegistroanterior(){ + return tiporegistroanterior; +} +/**Fija el valor de tiporegistroanterior +@param pTiporegistroanterior nuevo Valor de tiporegistroanterior*/ +public void setTiporegistroanterior(String pTiporegistroanterior){ + tiporegistroanterior=pTiporegistroanterior; +} + +/**Obtiene el valor de enbodega +@return valor de enbodega*/ +public String getEnbodega(){ + return enbodega; +} +/**Fija el valor de enbodega +@param pEnbodega nuevo Valor de enbodega*/ +public void setEnbodega(String pEnbodega){ + enbodega=pEnbodega; +} + +/**Obtiene el valor de cdecomisoarmatransaccion +@return valor de cdecomisoarmatransaccion*/ +public Long getCdecomisoarmatransaccion(){ + return cdecomisoarmatransaccion; +} +/**Fija el valor de cdecomisoarmatransaccion +@param pCdecomisoarmatransaccion nuevo Valor de cdecomisoarmatransaccion*/ +public void setCdecomisoarmatransaccion(Long pCdecomisoarmatransaccion){ + cdecomisoarmatransaccion=pCdecomisoarmatransaccion; +} + +/**Obtiene el valor de cdecarmtranrecepcion +@return valor de cdecarmtranrecepcion*/ +public Long getCdecarmtranrecepcion(){ + return cdecarmtranrecepcion; +} +/**Fija el valor de cdecarmtranrecepcion +@param pCdecarmtranrecepcion nuevo Valor de cdecarmtranrecepcion*/ +public void setCdecarmtranrecepcion(Long pCdecarmtranrecepcion){ + cdecarmtranrecepcion=pCdecarmtranrecepcion; +} + +/** + * @return the coperaciontransaccion + */ +public String getCoperaciontransaccion() { + return coperaciontransaccion; +} +/** + * @param coperaciontransaccion the coperaciontransaccion to set + */ +public void setCoperaciontransaccion(String coperaciontransaccion) { + this.coperaciontransaccion = coperaciontransaccion; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmDecomisoArma))return false; + TarmDecomisoArma that = (TarmDecomisoArma) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmDecomisoArma +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmDecomisoArma +*/ +public Object createInstance(){ + TarmDecomisoArma instance=new TarmDecomisoArma(); + return instance; +} +/**Clona la entidad TarmDecomisoArma +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmDecomisoArma p=(TarmDecomisoArma)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmDecomisoArmaTransaccion.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmDecomisoArmaTransaccion.java.svn-base new file mode 100644 index 0000000..baad37e --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmDecomisoArmaTransaccion.java.svn-base @@ -0,0 +1,258 @@ +package com.fp.persistence.parmas.soli; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMDECOMISOARMATRANSACCION*/ +@Entity(name="TarmDecomisoArmaTransaccion") +@Table(name="TARMDECOMISOARMATRANSACCION") +public class TarmDecomisoArmaTransaccion extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmDecomisoArmaTransaccion +*/ +@Id +@Column(name="CDECOMISOARMATRANSACCION" ,nullable=false, updatable=false) +private Long pk; +@Column(name="FCORTE", nullable=false) + +/** +* FECHA DE CORTE EN LA CUAL SE REALIZO LA GENERACION DEL NUMERO DE ENVIO +*/ +private Date fcorte; + +@Column(name="NUMEROTRANSACCION", nullable=true) + +/** +* null +*/ +private String numerotransaccion; + +@Column(name="CCONTROL", nullable=false) + +/** +* CODIGO DEL CENTRO DE CONTROL AL CUAL PERTENECE ESTE ENVIO +*/ +private String ccentrocontrol; + +@Column(name="FTRANSACCION", nullable=false) + +/** +* REGISTRO DE LA FECHA EN LA CUAL SE GENERO ESTE CODIGO DE TRANSACCION +*/ +private Date ftransaccion; + +@Column(name="XPATH", nullable=true) + +/** +* ruta del archivo que se almacena en el alfresco, para la recepcion de las armas +*/ +private String xpath; + +@Column(name="ESTADOFLUJO", nullable=true) + +/** +* null +*/ +private String estadoflujo; + +@Column(name="ESTADOFIRMA", nullable=true) + +/** +* null +*/ +private String estadofirma; + + +/**Contructor por defecto*/ +public TarmDecomisoArmaTransaccion(){ +} +/**Contructor de TarmDecomisoArmaTransaccion +@param pPk Clave Primaria del entity +@param pFcorte FECHA DE CORTE EN LA CUAL SE REALIZO LA GENERACION DEL NUMERO DE ENVIO +@param pCcontrol CODIGO DEL CENTRO DE CONTROL AL CUAL PERTENECE ESTE ENVIO +@param pFtransaccion REGISTRO DE LA FECHA EN LA CUAL SE GENERO ESTE CODIGO DE TRANSACCION +*/ +public TarmDecomisoArmaTransaccion(Long pPk,Date pFcorte,String pCcontrol,Date pFtransaccion){ + this(); + pk=pPk; + fcorte=pFcorte; + ccentrocontrol=pCcontrol; + ftransaccion=pFtransaccion; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmDecomisoArmaTransaccion +*/ +public static TarmDecomisoArmaTransaccion find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmDecomisoArmaTransaccion obj = pEntityManager.find(TarmDecomisoArmaTransaccion.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmDecomisoArmaTransaccion +@return El objeto que referencia a la Clave primaria de TarmDecomisoArmaTransaccion +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmDecomisoArmaTransaccion +@param pPk El objeto que referencia a la nueva Clave primaria de TarmDecomisoArmaTransaccion +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de fcorte +@return valor de fcorte*/ +public Date getFcorte(){ + return fcorte; +} +/**Fija el valor de fcorte +@param pFcorte nuevo Valor de fcorte*/ +public void setFcorte(Date pFcorte){ + fcorte=pFcorte; +} + +/**Obtiene el valor de numerotransaccion +@return valor de numerotransaccion*/ +public String getNumerotransaccion(){ + return numerotransaccion; +} +/**Fija el valor de numerotransaccion +@param pNumerotransaccion nuevo Valor de numerotransaccion*/ +public void setNumerotransaccion(String pNumerotransaccion){ + numerotransaccion=pNumerotransaccion; +} + +/**Obtiene el valor de ccontrol +@return valor de ccontrol*/ +public String getCcentrocontrol(){ + return ccentrocontrol; +} +/**Fija el valor de ccontrol +@param pCcontrol nuevo Valor de ccontrol*/ +public void setCcentrocontrol(String pCcontrol){ + ccentrocontrol=pCcontrol; +} + +/**Obtiene el valor de ftransaccion +@return valor de ftransaccion*/ +public Date getFtransaccion(){ + return ftransaccion; +} +/**Fija el valor de ftransaccion +@param pFtransaccion nuevo Valor de ftransaccion*/ +public void setFtransaccion(Date pFtransaccion){ + ftransaccion=pFtransaccion; +} + +/**Obtiene el valor de xpath +@return valor de xpath*/ +public String getXpath(){ + return xpath; +} +/**Fija el valor de xpath +@param pXpath nuevo Valor de xpath*/ +public void setXpath(String pXpath){ + xpath=pXpath; +} + +/**Obtiene el valor de estadoflujo +@return valor de estadoflujo*/ +public String getEstadoflujo(){ + return estadoflujo; +} +/** + * @return the estadofirma + */ +public String getEstadofirma() { + return estadofirma; +} +/** + * @param estadofirma the estadofirma to set + */ +public void setEstadofirma(String estadofirma) { + this.estadofirma = estadofirma; +} +/**Fija el valor de estadoflujo +@param pEstadoflujo nuevo Valor de estadoflujo*/ +public void setEstadoflujo(String pEstadoflujo){ + estadoflujo=pEstadoflujo; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmDecomisoArmaTransaccion))return false; + TarmDecomisoArmaTransaccion that = (TarmDecomisoArmaTransaccion) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmDecomisoArmaTransaccion +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmDecomisoArmaTransaccion +*/ +public Object createInstance(){ + TarmDecomisoArmaTransaccion instance=new TarmDecomisoArmaTransaccion(); + return instance; +} +/**Clona la entidad TarmDecomisoArmaTransaccion +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmDecomisoArmaTransaccion p=(TarmDecomisoArmaTransaccion)this.clone(); + return p; +} + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmDetRepDestruirArmas.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmDetRepDestruirArmas.java.svn-base new file mode 100644 index 0000000..53fd215 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmDetRepDestruirArmas.java.svn-base @@ -0,0 +1,348 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMDETREPDESTRUIRARMAS*/ +@Entity(name="TarmDetRepDestruirArmas") +@Table(name="TARMDETREPDESTRUIRARMAS") +public class TarmDetRepDestruirArmas extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmDetRepDestruirArmas +*/ +@Id +@Column(name="CDETREPDESTRUIRARMAS" ,nullable=false, updatable=false) +private Integer pk; +@Column(name="CREPORTE", nullable=false) + +/** +* Codigo del reporte +*/ +private Integer creporte; + +@Column(name="CDECOMISOARMA", nullable=false) + +/** +* Codigo de decomiso arma +*/ +private String cdecomisoarma; + +@Column(name="CLASE", nullable=true) + +/** +* Clase de arma o explosivo +*/ +private String clase; + +@Column(name="TIPO", nullable=true) + +/** +* Tipo de arma o explosivo +*/ +private String tipo; + +@Column(name="CALIBRE", nullable=true) + +/** +* Calibre del arma +*/ +private String calibre; + +@Column(name="MARCA", nullable=true) + +/** +* Marca del arma o explosivo +*/ +private String marca; + +@Column(name="SERIE", nullable=true) + +/** +* Serie del arma o explosivo +*/ +private String serie; + +@Column(name="CANTIDAD", nullable=true) + +/** +* Cantidad de unidades del arma o explosivo +*/ +private String cantidad; + +@Column(name="UNIDAD", nullable=true) + +/** +* Unidad de medida del arma o explosivo +*/ +private String unidad; + +@Column(name="FDECOMISO", nullable=true) + +/** +* Fecha de decomiso del arma o explosivo +*/ +private Date fdecomiso; + +@Column(name="PROPIETARIO", nullable=true) + +/** +* Propietario del arma o explosivo +*/ +private String propietario; + +@Column(name="NRECIBO", nullable=true) + +/** +* Numero de recibo con el que se incauto el arma o explosivo +*/ +private String nrecibo; + +/**Contructor por defecto*/ +public TarmDetRepDestruirArmas(){ +} +/**Contructor de TarmDetRepDestruirArmas +@param pPk Clave Primaria del entity +@param pCreporte Codigo del reporte +@param pCdecomisoarma Codigo de decomiso arma +*/ +public TarmDetRepDestruirArmas(Integer pPk,Integer pCreporte,String pCdecomisoarma){ + this(); + pk=pPk; + creporte=pCreporte; + cdecomisoarma=pCdecomisoarma; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmDetRepDestruirArmas +*/ +public static TarmDetRepDestruirArmas find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmDetRepDestruirArmas obj = pEntityManager.find(TarmDetRepDestruirArmas.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmDetRepDestruirArmas +@return El objeto que referencia a la Clave primaria de TarmDetRepDestruirArmas +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmDetRepDestruirArmas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmDetRepDestruirArmas +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de creporte +@return valor de creporte*/ +public Integer getCreporte(){ + return creporte; +} +/**Fija el valor de creporte +@param pCreporte nuevo Valor de creporte*/ +public void setCreporte(Integer pCreporte){ + creporte=pCreporte; +} + +/**Obtiene el valor de cdecomisoarma +@return valor de cdecomisoarma*/ +public String getCdecomisoarma(){ + return cdecomisoarma; +} +/**Fija el valor de cdecomisoarma +@param pCdecomisoarma nuevo Valor de cdecomisoarma*/ +public void setCdecomisoarma(String pCdecomisoarma){ + cdecomisoarma=pCdecomisoarma; +} + +/**Obtiene el valor de clase +@return valor de clase*/ +public String getClase(){ + return clase; +} +/**Fija el valor de clase +@param pClase nuevo Valor de clase*/ +public void setClase(String pClase){ + clase=pClase; +} + +/**Obtiene el valor de tipo +@return valor de tipo*/ +public String getTipo(){ + return tipo; +} +/**Fija el valor de tipo +@param pTipo nuevo Valor de tipo*/ +public void setTipo(String pTipo){ + tipo=pTipo; +} + +/**Obtiene el valor de calibre +@return valor de calibre*/ +public String getCalibre(){ + return calibre; +} +/**Fija el valor de calibre +@param pCalibre nuevo Valor de calibre*/ +public void setCalibre(String pCalibre){ + calibre=pCalibre; +} + +/**Obtiene el valor de marca +@return valor de marca*/ +public String getMarca(){ + return marca; +} +/**Fija el valor de marca +@param pMarca nuevo Valor de marca*/ +public void setMarca(String pMarca){ + marca=pMarca; +} + +/**Obtiene el valor de serie +@return valor de serie*/ +public String getSerie(){ + return serie; +} +/**Fija el valor de serie +@param pSerie nuevo Valor de serie*/ +public void setSerie(String pSerie){ + serie=pSerie; +} + +/**Obtiene el valor de cantidad +@return valor de cantidad*/ +public String getCantidad(){ + return cantidad; +} +/**Fija el valor de cantidad +@param pCantidad nuevo Valor de cantidad*/ +public void setCantidad(String pCantidad){ + cantidad=pCantidad; +} + +/**Obtiene el valor de unidad +@return valor de unidad*/ +public String getUnidad(){ + return unidad; +} +/**Fija el valor de unidad +@param pUnidad nuevo Valor de unidad*/ +public void setUnidad(String pUnidad){ + unidad=pUnidad; +} + +/**Obtiene el valor de fdecomiso +@return valor de fdecomiso*/ +public Date getFdecomiso(){ + return fdecomiso; +} +/**Fija el valor de fdecomiso +@param pFdecomiso nuevo Valor de fdecomiso*/ +public void setFdecomiso(Date pFdecomiso){ + fdecomiso=pFdecomiso; +} + +/**Obtiene el valor de propietario +@return valor de propietario*/ +public String getPropietario(){ + return propietario; +} +/**Fija el valor de propietario +@param pPropietario nuevo Valor de propietario*/ +public void setPropietario(String pPropietario){ + propietario=pPropietario; +} + +/**Obtiene el valor de nrecibo +@return valor de nrecibo*/ +public String getNrecibo(){ + return nrecibo; +} +/**Fija el valor de nrecibo +@param pNrecibo nuevo Valor de nrecibo*/ +public void setNrecibo(String pNrecibo){ + nrecibo=pNrecibo; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmDetRepDestruirArmas))return false; + TarmDetRepDestruirArmas that = (TarmDetRepDestruirArmas) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmDetRepDestruirArmas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmDetRepDestruirArmas +*/ +public Object createInstance(){ + TarmDetRepDestruirArmas instance=new TarmDetRepDestruirArmas(); + return instance; +} +/**Clona la entidad TarmDetRepDestruirArmas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmDetRepDestruirArmas p=(TarmDetRepDestruirArmas)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmDocumentoAlfresco.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmDocumentoAlfresco.java.svn-base new file mode 100644 index 0000000..9b6f06b --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmDocumentoAlfresco.java.svn-base @@ -0,0 +1,206 @@ +package com.fp.persistence.parmas.soli; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TarmDocumentoAlfresco*/ +@Entity(name="TarmDocumentoAlfresco") +@Table(name="TARMDOCUMENTOALFRESCO") +public class TarmDocumentoAlfresco extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmDocumentoAlfresco +*/ +@Id +@Column(name="DOCALFRESCOCODE" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "DOCUMENTOALFRESCO"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.Number"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "8")}) + @GeneratedValue(generator = "seq_id") +private Long pk; + +/** +* Codigo de catalogo 01Recepcion, 02 Envio +*/ +@Column(name="CATALOG", nullable=true) +private String catalogo; + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de operaciones +*/ +@Column(name="CATALOGCODE", nullable=true) +private String catalogoCode; + +/** +* codigo del perfil +*/ +@Column(name="PERFIL", nullable=true) +private Integer perfil; + +/** +* Codigo de documento +*/ +@Column(name="DOCUMENTO", nullable=true) +private String documento; + +/**Contructor por defecto*/ +public TarmDocumentoAlfresco(){ +} +/**Contructor de TarmDocumentoAlfresco +@param pPk Clave Primaria del entity +*/ +public TarmDocumentoAlfresco(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmDocumentoAlfresco +*/ +public static TarmDocumentoAlfresco find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmDocumentoAlfresco obj = pEntityManager.find(TarmDocumentoAlfresco.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmDocumentoAlfresco +@return El objeto que referencia a la Clave primaria de TarmDocumentoAlfresco +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmDocumentoAlfresco +@param pPk El objeto que referencia a la nueva Clave primaria de TarmDocumentoAlfresco +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/** + * @return the catalogo + */ +public String getCatalogo() { + return catalogo; +} +/** + * @param catalogo the catalogo to set + */ +public void setCatalogo(String catalogo) { + this.catalogo = catalogo; +} +/** + * @return the catalogoCode + */ +public String getCatalogoCode() { + return catalogoCode; +} +/** + * @param catalogoCode the catalogoCode to set + */ +public void setCatalogoCode(String catalogoCode) { + this.catalogoCode = catalogoCode; +} +/** + * @return the perfil + */ +public Integer getPerfil() { + return perfil; +} +/** + * @param perfil the perfil to set + */ +public void setPerfil(Integer perfil) { + this.perfil = perfil; +} +/** + * @return the documento + */ +public String getDocumento() { + return documento; +} +/** + * @param documento the documento to set + */ +public void setDocumento(String documento) { + this.documento = documento; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmDocumentoAlfresco))return false; + TarmDocumentoAlfresco that = (TarmDocumentoAlfresco) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmDocumentoAlfresco +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmDocumentoAlfresco +*/ +public Object createInstance(){ + TarmDocumentoAlfresco instance=new TarmDocumentoAlfresco(); + return instance; +} +/**Clona la entidad TarmDocumentoAlfresco +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmDocumentoAlfresco p=(TarmDocumentoAlfresco)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmDocumentoHabilitante.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmDocumentoHabilitante.java.svn-base new file mode 100644 index 0000000..8976b82 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmDocumentoHabilitante.java.svn-base @@ -0,0 +1,395 @@ +package com.fp.persistence.parmas.soli; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMDOCUMENTOHABILITANTE*/ +@Entity(name="TarmDocumentoHabilitante") +@Table(name="TARMDOCUMENTOHABILITANTE") +public class TarmDocumentoHabilitante extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmDocumentoHabilitante +*/ +@Id +@Column(name="CDOCUMENTO" ,nullable=false, updatable=false) +private Long pk; +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="NUMERODOCUMENTO", nullable=true) + +/** +* Numero de documento habilitante +*/ +private String numerodocumento; + +@Column(name="FECHAEMISION", nullable=true) + +/** +* Fecha en la que se emitio el documento +*/ +private Date fechaemision; + +@Column(name="FECHAEXPIRACION", nullable=true) + +/** +* Fecha de expiracion del documento +*/ +private Date fechaexpiracion; + +@Column(name="CSOLICITUD", nullable=true) + +/** +* null +*/ +private String csolicitud; + +@Column(name="XPATH", nullable=true) + +/** +* Ruta en Alfresco donde se almacena el documento Habilitante. +*/ +private String xpath; + +@Column(name="CARMA", nullable=true) + +/** +* null +*/ +private String carma; + +@Column(name="ESTADO", nullable=true) + +/** +* null +*/ +private String estado; + +@Column(name="ESTADOCODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de estado de documento habilitante +*/ +private String estadocode; + +@Column(name="CODIGOARMA", nullable=true) + +/** +* Codigo del arma identificador del arma +*/ +private String codigoarma; + +@Column(name="CTRAMITE", nullable=true) + +/** +* null +*/ +private Long ctramite; + + + +@Column(name="CCENTROCONTROL", nullable=true) + +/** +* CENTRO DE CONTROL +*/ +private String centrocontrol; + +@Column(name="CUENTAREIMPRESION", nullable=true) + +/** +* null +*/ +private Integer cuentareimpresion; + + +@Column(name="FECHACAMBIOEXPIRACION", nullable=true) + +/** +* Fecha de expiracion del documento +*/ +private Date fechacambioexpiracion; +@Column(name="OBSERVACION", nullable=true) + +/** +* CENTRO DE CONTROL +*/ +private String observacion; + +@Column(name="PATHSUSPENCION", nullable=true) + +/** +* Ruta en Alfresco donde se almacena el documento Habilitante. +*/ +private String pathSuspencion; + +/**Contructor por defecto*/ +public TarmDocumentoHabilitante(){ +} +/**Contructor de TarmDocumentoHabilitante +@param pPk Clave Primaria del entity +*/ +public TarmDocumentoHabilitante(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmDocumentoHabilitante +*/ +public static TarmDocumentoHabilitante find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmDocumentoHabilitante obj = pEntityManager.find(TarmDocumentoHabilitante.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmDocumentoHabilitante +@return El objeto que referencia a la Clave primaria de TarmDocumentoHabilitante +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmDocumentoHabilitante +@param pPk El objeto que referencia a la nueva Clave primaria de TarmDocumentoHabilitante +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de numerodocumento +@return valor de numerodocumento*/ +public String getNumerodocumento(){ + return numerodocumento; +} +/**Fija el valor de numerodocumento +@param pNumerodocumento nuevo Valor de numerodocumento*/ +public void setNumerodocumento(String pNumerodocumento){ + numerodocumento=pNumerodocumento; +} + +/**Obtiene el valor de fechaemision +@return valor de fechaemision*/ +public Date getFechaemision(){ + return fechaemision; +} +/**Fija el valor de fechaemision +@param pFechaemision nuevo Valor de fechaemision*/ +public void setFechaemision(Date pFechaemision){ + fechaemision=pFechaemision; +} + +/**Obtiene el valor de fechaexpiracion +@return valor de fechaexpiracion*/ +public Date getFechaexpiracion(){ + return fechaexpiracion; +} +/**Fija el valor de fechaexpiracion +@param pFechaexpiracion nuevo Valor de fechaexpiracion*/ +public void setFechaexpiracion(Date pFechaexpiracion){ + fechaexpiracion=pFechaexpiracion; +} + +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Obtiene el valor de xpath +@return valor de xpath*/ +public String getXpath(){ + return xpath; +} +/**Fija el valor de xpath +@param pXpath nuevo Valor de xpath*/ +public void setXpath(String pXpath){ + xpath=pXpath; +} + +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de estado +@return valor de estado*/ +public String getEstado(){ + return estado; +} +/**Fija el valor de estado +@param pEstado nuevo Valor de estado*/ +public void setEstado(String pEstado){ + estado=pEstado; +} + +/**Obtiene el valor de estadocode +@return valor de estadocode*/ +public String getEstadocode(){ + return estadocode; +} +/**Fija el valor de estadocode +@param pEstadocode nuevo Valor de estadocode*/ +public void setEstadocode(String pEstadocode){ + estadocode=pEstadocode; +} + +/**Obtiene el valor de codigoarma +@return valor de codigoarma*/ +public String getCodigoarma(){ + return codigoarma; +} +/**Fija el valor de codigoarma +@param pCodigoarma nuevo Valor de codigoarma*/ +public void setCodigoarma(String pCodigoarma){ + codigoarma=pCodigoarma; +} + +public String getCentrocontrol() { + return centrocontrol; +} +public void setCentrocontrol(String centrocontrol) { + this.centrocontrol = centrocontrol; +} +/**Obtiene el valor de ctramite +@return valor de ctramite*/ +public Long getCtramite(){ + return ctramite; +} +/**Fija el valor de ctramite +@param pCtramite nuevo Valor de ctramite*/ +public void setCtramite(Long pCtramite){ + ctramite=pCtramite; +} + +/**Obtiene el valor de cuentareimpresion +@return valor de cuentareimpresion*/ +public Integer getCuentareimpresion(){ + return cuentareimpresion; +} +/**Fija el valor de cuentareimpresion +@param pCuentareimpresion nuevo Valor de cuentareimpresion*/ +public void setCuentareimpresion(Integer pCuentareimpresion){ + cuentareimpresion=pCuentareimpresion; +} + +public Date getFechacambioexpiracion() { + return fechacambioexpiracion; +} +public void setFechacambioexpiracion(Date fechacambioexpiracion) { + this.fechacambioexpiracion = fechacambioexpiracion; +} +public String getObservacion() { + return observacion; +} +public void setObservacion(String observacion) { + this.observacion = observacion; +} +public String getPathSuspencion() { + return pathSuspencion; +} +public void setPathSuspencion(String pathSuspencion) { + this.pathSuspencion = pathSuspencion; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmDocumentoHabilitante))return false; + TarmDocumentoHabilitante that = (TarmDocumentoHabilitante) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmDocumentoHabilitante +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmDocumentoHabilitante +*/ +public Object createInstance(){ + TarmDocumentoHabilitante instance=new TarmDocumentoHabilitante(); + return instance; +} +/**Clona la entidad TarmDocumentoHabilitante +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmDocumentoHabilitante p=(TarmDocumentoHabilitante)this.clone(); + return p; +} + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmDocumentoHabilitanteDetall.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmDocumentoHabilitanteDetall.java.svn-base new file mode 100644 index 0000000..125df66 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmDocumentoHabilitanteDetall.java.svn-base @@ -0,0 +1,190 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMDOCUMENTOHABILITANTEDETALL*/ +@Entity(name="TarmDocumentoHabilitanteDetall") +@Table(name="TARMDOCUMENTOHABILITANTEDETALL") +public class TarmDocumentoHabilitanteDetall extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmDocumentoHabilitanteDetall +*/ +@Id +@Column(name="CODIGODETALLE" ,nullable=false, updatable=false) +/*@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CODIGODETALLE"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.String"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "6")}) + @GeneratedValue(generator = "seq_id")*/ +private String pk; +@Column(name="CARMA", nullable=true) + +/** +* null +*/ +private String carma; + +@Column(name="CDOCUMENTO", nullable=true) + +/** +* null +*/ +private Long cdocumento; + +@Column(name="CODIGOARMA", nullable=true) + +/** +* null +*/ +private String codigoarma; + +/**Contructor por defecto*/ +public TarmDocumentoHabilitanteDetall(){ +} +/**Contructor de TarmDocumentoHabilitanteDetall +@param pPk Clave Primaria del entity +*/ +public TarmDocumentoHabilitanteDetall(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmDocumentoHabilitanteDetall +*/ +public static TarmDocumentoHabilitanteDetall find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmDocumentoHabilitanteDetall obj = pEntityManager.find(TarmDocumentoHabilitanteDetall.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmDocumentoHabilitanteDetall +@return El objeto que referencia a la Clave primaria de TarmDocumentoHabilitanteDetall +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmDocumentoHabilitanteDetall +@param pPk El objeto que referencia a la nueva Clave primaria de TarmDocumentoHabilitanteDetall +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de cdocumento +@return valor de cdocumento*/ +public Long getCdocumento(){ + return cdocumento; +} +/**Fija el valor de cdocumento +@param pCdocumento nuevo Valor de cdocumento*/ +public void setCdocumento(Long pCdocumento){ + cdocumento=pCdocumento; +} + +/**Obtiene el valor de codigoarma +@return valor de codigoarma*/ +public String getCodigoarma(){ + return codigoarma; +} +/**Fija el valor de codigoarma +@param pCodigoarma nuevo Valor de codigoarma*/ +public void setCodigoarma(String pCodigoarma){ + codigoarma=pCodigoarma; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmDocumentoHabilitanteDetall))return false; + TarmDocumentoHabilitanteDetall that = (TarmDocumentoHabilitanteDetall) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmDocumentoHabilitanteDetall +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmDocumentoHabilitanteDetall +*/ +public Object createInstance(){ + TarmDocumentoHabilitanteDetall instance=new TarmDocumentoHabilitanteDetall(); + return instance; +} +/**Clona la entidad TarmDocumentoHabilitanteDetall +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmDocumentoHabilitanteDetall p=(TarmDocumentoHabilitanteDetall)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmGuardias.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmGuardias.java.svn-base new file mode 100644 index 0000000..0aaf308 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmGuardias.java.svn-base @@ -0,0 +1,162 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMGUARDIAS*/ +@Entity(name="TarmGuardias") +@Table(name="TARMGUARDIAS") +public class TarmGuardias extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmGuardias +*/ +@Id +@Column(name="CGUARDIA" ,nullable=false, updatable=false) +private Integer pk; +@Column(name="CEMPRESA", nullable=true) + +/** +* Codigo de persona +*/ +private Integer cempresa; + +@Column(name="ESTADO", nullable=true) + +/** +* null +*/ +private String estado; + +/**Contructor por defecto*/ +public TarmGuardias(){ +} +/**Contructor de TarmGuardias +@param pPk Clave Primaria del entity +*/ +public TarmGuardias(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmGuardias +*/ +public static TarmGuardias find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmGuardias obj = pEntityManager.find(TarmGuardias.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmGuardias +@return El objeto que referencia a la Clave primaria de TarmGuardias +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmGuardias +@param pPk El objeto que referencia a la nueva Clave primaria de TarmGuardias +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de cempresa +@return valor de cempresa*/ +public Integer getCempresa(){ + return cempresa; +} +/**Fija el valor de cempresa +@param pCempresa nuevo Valor de cempresa*/ +public void setCempresa(Integer pCempresa){ + cempresa=pCempresa; +} + +/**Obtiene el valor de estado +@return valor de estado*/ +public String getEstado(){ + return estado; +} +/**Fija el valor de estado +@param pEstado nuevo Valor de estado*/ +public void setEstado(String pEstado){ + estado=pEstado; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmGuardias))return false; + TarmGuardias that = (TarmGuardias) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmGuardias +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmGuardias +*/ +public Object createInstance(){ + TarmGuardias instance=new TarmGuardias(); + return instance; +} +/**Clona la entidad TarmGuardias +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmGuardias p=(TarmGuardias)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmInspeccion.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmInspeccion.java.svn-base new file mode 100644 index 0000000..66b9ff9 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmInspeccion.java.svn-base @@ -0,0 +1,365 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMINSPECCION*/ +@Entity(name="TarmInspeccion") +@Table(name="TARMINSPECCION") +public class TarmInspeccion extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmInspeccion +*/ +@Id +@Column(name="CINSPECCION" ,nullable=false, updatable=false) +private Long pk; +@Column(name="APLICADECOMISO", nullable=true) + +/** +* si el tramite se niega, el campo es para validar si aplica decomiso +*/ +private String aplicadecomiso; + +@Column(name="CSOLICITUD", nullable=true) + +/** +* Codigo de solicitud de controld e armas +*/ +private String csolicitud; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona responsable de la inspeccion +*/ +private Integer personcode; + +@Column(name="CTRAMITE", nullable=true) + +/** +* cdigo de la tabla de tramite +*/ +private Long ctramite; + +@Column(name="TRAMITEPROCESO", nullable=true) + +/** +* campo para validar si el tramite o proceso continua +*/ +private String tramiteproceso; + +@Column(name="OBSERVACION", nullable=true) + +/** +* campo de observacin de la inspeccin +*/ +private String observacion; + +@Column(name="FECHAREGISTRO", nullable=true) + +/** +* fecha de registro de la inspeccin +*/ +private Date fecharegistro; + +@Column(name="NUMORDENTRABAJO", nullable=true) + +/** +* null +*/ +private String numordentrabajo; + +@Column(name="CSITIOALMACENAMIENTO", nullable=true) + +/** +* cdigo de la tabla de sitios de almacenamiento +*/ +private String csitioalmacenamiento; + +@Column(name="CPLANIFICACIONTRAMITE", nullable=true) + +/** +* codigo de la tabla de planificacion tramite, codigo de la planificacion de la inspeccion +*/ +private Long cplanificaciontramite; + +@Column(name="PLANIFICADO", nullable=true) + +/** +* campo para validar si es el registro de una inspeccion planificada o no planificada +*/ +private String planificado; + +@Column(name="CENTROCONTROL", nullable=true) + +/** +* centro de control al que pertenece la persona que realiza el tramite +*/ +private String centrocontrol; + +@Column(name="ANNO", nullable=true) + +/** +* null +*/ +private Long anno; + +/**Contructor por defecto*/ +public TarmInspeccion(){ +} +/**Contructor de TarmInspeccion +@param pPk Clave Primaria del entity +*/ +public TarmInspeccion(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmInspeccion +*/ +public static TarmInspeccion find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmInspeccion obj = pEntityManager.find(TarmInspeccion.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmInspeccion +@return El objeto que referencia a la Clave primaria de TarmInspeccion +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmInspeccion +@param pPk El objeto que referencia a la nueva Clave primaria de TarmInspeccion +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de aplicadecomiso +@return valor de aplicadecomiso*/ +public String getAplicadecomiso(){ + return aplicadecomiso; +} +/**Fija el valor de aplicadecomiso +@param pAplicadecomiso nuevo Valor de aplicadecomiso*/ +public void setAplicadecomiso(String pAplicadecomiso){ + aplicadecomiso=pAplicadecomiso; +} + +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de ctramite +@return valor de ctramite*/ +public Long getCtramite(){ + return ctramite; +} +/**Fija el valor de ctramite +@param pCtramite nuevo Valor de ctramite*/ +public void setCtramite(Long pCtramite){ + ctramite=pCtramite; +} + +/**Obtiene el valor de tramiteproceso +@return valor de tramiteproceso*/ +public String getTramiteproceso(){ + return tramiteproceso; +} +/**Fija el valor de tramiteproceso +@param pTramiteproceso nuevo Valor de tramiteproceso*/ +public void setTramiteproceso(String pTramiteproceso){ + tramiteproceso=pTramiteproceso; +} + +/**Obtiene el valor de observacion +@return valor de observacion*/ +public String getObservacion(){ + return observacion; +} +/**Fija el valor de observacion +@param pObservacion nuevo Valor de observacion*/ +public void setObservacion(String pObservacion){ + observacion=pObservacion; +} + +/**Obtiene el valor de fecharegistro +@return valor de fecharegistro*/ +public Date getFecharegistro(){ + return fecharegistro; +} +/**Fija el valor de fecharegistro +@param pFecharegistro nuevo Valor de fecharegistro*/ +public void setFecharegistro(Date pFecharegistro){ + fecharegistro=pFecharegistro; +} + +/**Obtiene el valor de numordentrabajo +@return valor de numordentrabajo*/ +public String getNumordentrabajo(){ + return numordentrabajo; +} +/**Fija el valor de numordentrabajo +@param pNumordentrabajo nuevo Valor de numordentrabajo*/ +public void setNumordentrabajo(String pNumordentrabajo){ + numordentrabajo=pNumordentrabajo; +} + +/**Obtiene el valor de csitioalmacenamiento +@return valor de csitioalmacenamiento*/ +public String getCsitioalmacenamiento(){ + return csitioalmacenamiento; +} +/**Fija el valor de csitioalmacenamiento +@param pCsitioalmacenamiento nuevo Valor de csitioalmacenamiento*/ +public void setCsitioalmacenamiento(String pCsitioalmacenamiento){ + csitioalmacenamiento=pCsitioalmacenamiento; +} + +/**Obtiene el valor de cplanificaciontramite +@return valor de cplanificaciontramite*/ +public Long getCplanificaciontramite(){ + return cplanificaciontramite; +} +/**Fija el valor de cplanificaciontramite +@param pCplanificaciontramite nuevo Valor de cplanificaciontramite*/ +public void setCplanificaciontramite(Long pCplanificaciontramite){ + cplanificaciontramite=pCplanificaciontramite; +} + +/**Obtiene el valor de planificado +@return valor de planificado*/ +public String getPlanificado(){ + return planificado; +} +/**Fija el valor de planificado +@param pPlanificado nuevo Valor de planificado*/ +public void setPlanificado(String pPlanificado){ + planificado=pPlanificado; +} +/** + * @return the centrocontrol + */ +public String getCentrocontrol() { + return centrocontrol; +} +/** + * @param centrocontrol the centrocontrol to set + */ +public void setCentrocontrol(String centrocontrol) { + this.centrocontrol = centrocontrol; +} +/** + * @return the anno + */ +public Long getAnno() { + return anno; +} +/** + * @param anno the anno to set + */ +public void setAnno(Long anno) { + this.anno = anno; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmInspeccion))return false; + TarmInspeccion that = (TarmInspeccion) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmInspeccion +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmInspeccion +*/ +public Object createInstance(){ + TarmInspeccion instance=new TarmInspeccion(); + return instance; +} +/**Clona la entidad TarmInspeccion +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmInspeccion p=(TarmInspeccion)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmInspeccionArchivo.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmInspeccionArchivo.java.svn-base new file mode 100644 index 0000000..7c44f3d --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmInspeccionArchivo.java.svn-base @@ -0,0 +1,228 @@ +package com.fp.persistence.parmas.soli; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMINSPECCIONARCHIVO*/ +@Entity(name="TarmInspeccionArchivo") +@Table(name="TARMINSPECCIONARCHIVO") +public class TarmInspeccionArchivo extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmInspeccionArchivo +*/ +@Id +@Column(name="CINSPARCH" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CINSPARCH"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.Integer"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "10")}) + @GeneratedValue(generator = "seq_id") +private Integer pk; +@Column(name="CINSPECCION", nullable=true) + +/** +* codigo de la tabla de inspeccin +*/ +private Long cinspeccion; + +@Column(name="DESCRIPCION", nullable=true) + +/** +* null +*/ +private String descripcion; + +@Column(name="XPATH", nullable=true) + +/** +* null +*/ +private String xpath; + +@Column(name="XPATHORIGINAL", nullable=true) + +/** +* null +*/ +private String xpathoriginal; + +@Column(name="OBSERVACION", nullable=true) + +/** +* null +*/ +private String observacion; + +@Column(name="USUARIOCAMBIO", nullable=true) + +/** +* null +*/ +private String usuariocambio; + +/**Contructor por defecto*/ +public TarmInspeccionArchivo(){ +} +/**Contructor de TarmInspeccionArchivo +@param pPk Clave Primaria del entity +*/ +public TarmInspeccionArchivo(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmInspeccionArchivo +*/ +public static TarmInspeccionArchivo find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmInspeccionArchivo obj = pEntityManager.find(TarmInspeccionArchivo.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmInspeccionArchivo +@return El objeto que referencia a la Clave primaria de TarmInspeccionArchivo +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmInspeccionArchivo +@param pPk El objeto que referencia a la nueva Clave primaria de TarmInspeccionArchivo +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de cinspeccion +@return valor de cinspeccion*/ +public Long getCinspeccion(){ + return cinspeccion; +} +/**Fija el valor de cinspeccion +@param pCinspeccion nuevo Valor de cinspeccion*/ +public void setCinspeccion(Long pCinspeccion){ + cinspeccion=pCinspeccion; +} + +/**Obtiene el valor de descripcion +@return valor de descripcion*/ +public String getDescripcion(){ + return descripcion; +} +/**Fija el valor de descripcion +@param pDescripcion nuevo Valor de descripcion*/ +public void setDescripcion(String pDescripcion){ + descripcion=pDescripcion; +} + +/**Obtiene el valor de xpath +@return valor de xpath*/ +public String getXpath(){ + return xpath; +} + + +public String getXpathoriginal() { + return xpathoriginal; +} +public void setXpathoriginal(String xpathoriginal) { + this.xpathoriginal = xpathoriginal; +} +public String getObservacion() { + return observacion; +} +public void setObservacion(String observacion) { + this.observacion = observacion; +} +public String getUsuariocambio() { + return usuariocambio; +} +public void setUsuariocambio(String usuariocambio) { + this.usuariocambio = usuariocambio; +} +/**Fija el valor de xpath +@param pXpath nuevo Valor de xpath*/ +public void setXpath(String pXpath){ + xpath=pXpath; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmInspeccionArchivo))return false; + TarmInspeccionArchivo that = (TarmInspeccionArchivo) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmInspeccionArchivo +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmInspeccionArchivo +*/ +public Object createInstance(){ + TarmInspeccionArchivo instance=new TarmInspeccionArchivo(); + return instance; +} +/**Clona la entidad TarmInspeccionArchivo +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmInspeccionArchivo p=(TarmInspeccionArchivo)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmOrdenTrabajo.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmOrdenTrabajo.java.svn-base new file mode 100644 index 0000000..7291d3a --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmOrdenTrabajo.java.svn-base @@ -0,0 +1,330 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMORDENTRABAJO*/ +@Entity(name="TarmOrdenTrabajo") +@Table(name="TARMORDENTRABAJO") +public class TarmOrdenTrabajo extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmOrdenTrabajo +*/ +@Id +@Column(name="CORDENTRABAJO" ,nullable=false, updatable=false) +private Long pk; +@Column(name="CSOLICITUD", nullable=true) + +/** +* Codigo de solicitud de controld e armas +*/ +private String csolicitud; + +@Column(name="CTRAMITE", nullable=true) + +/** +* null +*/ +private Long ctramite; + +@Column(name="FSOLICITUD", nullable=true) + +/** +* null +*/ +private Date fsolicitud; + +@Column(name="DOCUMENTOREFERENCIA", nullable=true) + +/** +* null +*/ +private String documentoreferencia; + +@Column(name="EMPRESASOLICITA", nullable=true) + +/** +* null +*/ +private String empresasolicita; + +@Column(name="DIRECCIONCOMISION", nullable=true) + +/** +* null +*/ +private String direccioncomision; + +@Column(name="RUTA", nullable=true) + +/** +* null +*/ +private String ruta; + +@Column(name="TIEMPOESTIMADO", nullable=true) + +/** +* null +*/ +private String tiempoestimado; + +@Column(name="FINICIO", nullable=true) + +/** +* null +*/ +private Date finicio; + +@Column(name="FFINALIZACION", nullable=true) + +/** +* null +*/ +private Date ffinalizacion; + +@Column(name="OBSERVACIONES", nullable=true) + +/** +* null +*/ +private String observaciones; + +/**Contructor por defecto*/ +public TarmOrdenTrabajo(){ +} +/**Contructor de TarmOrdenTrabajo +@param pPk Clave Primaria del entity +*/ +public TarmOrdenTrabajo(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmOrdenTrabajo +*/ +public static TarmOrdenTrabajo find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmOrdenTrabajo obj = pEntityManager.find(TarmOrdenTrabajo.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmOrdenTrabajo +@return El objeto que referencia a la Clave primaria de TarmOrdenTrabajo +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmOrdenTrabajo +@param pPk El objeto que referencia a la nueva Clave primaria de TarmOrdenTrabajo +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Obtiene el valor de ctramite +@return valor de ctramite*/ +public Long getCtramite(){ + return ctramite; +} +/**Fija el valor de ctramite +@param pCtramite nuevo Valor de ctramite*/ +public void setCtramite(Long pCtramite){ + ctramite=pCtramite; +} + +/**Obtiene el valor de fsolicitud +@return valor de fsolicitud*/ +public Date getFsolicitud(){ + return fsolicitud; +} +/**Fija el valor de fsolicitud +@param pFsolicitud nuevo Valor de fsolicitud*/ +public void setFsolicitud(Date pFsolicitud){ + fsolicitud=pFsolicitud; +} + +/**Obtiene el valor de documentoreferencia +@return valor de documentoreferencia*/ +public String getDocumentoreferencia(){ + return documentoreferencia; +} +/**Fija el valor de documentoreferencia +@param pDocumentoreferencia nuevo Valor de documentoreferencia*/ +public void setDocumentoreferencia(String pDocumentoreferencia){ + documentoreferencia=pDocumentoreferencia; +} + +/**Obtiene el valor de empresasolicita +@return valor de empresasolicita*/ +public String getEmpresasolicita(){ + return empresasolicita; +} +/**Fija el valor de empresasolicita +@param pEmpresasolicita nuevo Valor de empresasolicita*/ +public void setEmpresasolicita(String pEmpresasolicita){ + empresasolicita=pEmpresasolicita; +} + +/**Obtiene el valor de direccioncomision +@return valor de direccioncomision*/ +public String getDireccioncomision(){ + return direccioncomision; +} +/**Fija el valor de direccioncomision +@param pDireccioncomision nuevo Valor de direccioncomision*/ +public void setDireccioncomision(String pDireccioncomision){ + direccioncomision=pDireccioncomision; +} + +/**Obtiene el valor de ruta +@return valor de ruta*/ +public String getRuta(){ + return ruta; +} +/**Fija el valor de ruta +@param pRuta nuevo Valor de ruta*/ +public void setRuta(String pRuta){ + ruta=pRuta; +} + +/**Obtiene el valor de tiempoestimado +@return valor de tiempoestimado*/ +public String getTiempoestimado(){ + return tiempoestimado; +} +/**Fija el valor de tiempoestimado +@param pTiempoestimado nuevo Valor de tiempoestimado*/ +public void setTiempoestimado(String pTiempoestimado){ + tiempoestimado=pTiempoestimado; +} + +/**Obtiene el valor de finicio +@return valor de finicio*/ +public Date getFinicio(){ + return finicio; +} +/**Fija el valor de finicio +@param pFinicio nuevo Valor de finicio*/ +public void setFinicio(Date pFinicio){ + finicio=pFinicio; +} + +/**Obtiene el valor de ffinalizacion +@return valor de ffinalizacion*/ +public Date getFfinalizacion(){ + return ffinalizacion; +} +/**Fija el valor de ffinalizacion +@param pFfinalizacion nuevo Valor de ffinalizacion*/ +public void setFfinalizacion(Date pFfinalizacion){ + ffinalizacion=pFfinalizacion; +} + +/**Obtiene el valor de observaciones +@return valor de observaciones*/ +public String getObservaciones(){ + return observaciones; +} +/**Fija el valor de observaciones +@param pObservaciones nuevo Valor de observaciones*/ +public void setObservaciones(String pObservaciones){ + observaciones=pObservaciones; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmOrdenTrabajo))return false; + TarmOrdenTrabajo that = (TarmOrdenTrabajo) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmOrdenTrabajo +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmOrdenTrabajo +*/ +public Object createInstance(){ + TarmOrdenTrabajo instance=new TarmOrdenTrabajo(); + return instance; +} +/**Clona la entidad TarmOrdenTrabajo +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmOrdenTrabajo p=(TarmOrdenTrabajo)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmOrdenTrabajoCustodios.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmOrdenTrabajoCustodios.java.svn-base new file mode 100644 index 0000000..026b29c --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmOrdenTrabajoCustodios.java.svn-base @@ -0,0 +1,263 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMORDENTRABAJOCUSTODIOS*/ +@Entity(name="TarmOrdenTrabajoCustodios") +@Table(name="TARMORDENTRABAJOCUSTODIOS") +public class TarmOrdenTrabajoCustodios extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmOrdenTrabajoCustodios +*/ +@Id +@Column(name="CORDENTRABAJOCUSTODIOS" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CORDENTRABAJOCUSTODIOS"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.Long"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "16")}) +@GeneratedValue(generator = "seq_id") +private Long pk; +@Column(name="GRADO", nullable=true) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String grado; + +@Column(name="GRADOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String gradocodigo; + +@Column(name="CORDENTRABAJO", nullable=true) + +/** +* null +*/ +private Long cordentrabajo; + +@Column(name="CEDULACUSTODIO", nullable=true) + +/** +* null +*/ +private String cedulacustodio; + +@Column(name="NOMBRECUSTODIO", nullable=true) + +/** +* null +*/ +private String nombrecustodio; + +@Column(name="APELLIDOSCUSTIDIO", nullable=true) + +/** +* null +*/ +private String apellidoscustidio; + +@Column(name="OBSERVACIONES", nullable=true) + +/** +* null +*/ +private String observaciones; + +/**Contructor por defecto*/ +public TarmOrdenTrabajoCustodios(){ +} +/**Contructor de TarmOrdenTrabajoCustodios +@param pPk Clave Primaria del entity +*/ +public TarmOrdenTrabajoCustodios(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmOrdenTrabajoCustodios +*/ +public static TarmOrdenTrabajoCustodios find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmOrdenTrabajoCustodios obj = pEntityManager.find(TarmOrdenTrabajoCustodios.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmOrdenTrabajoCustodios +@return El objeto que referencia a la Clave primaria de TarmOrdenTrabajoCustodios +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmOrdenTrabajoCustodios +@param pPk El objeto que referencia a la nueva Clave primaria de TarmOrdenTrabajoCustodios +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de grado +@return valor de grado*/ +public String getGrado(){ + return grado; +} +/**Fija el valor de grado +@param pGrado nuevo Valor de grado*/ +public void setGrado(String pGrado){ + grado=pGrado; +} + +/**Obtiene el valor de gradocodigo +@return valor de gradocodigo*/ +public String getGradocodigo(){ + return gradocodigo; +} +/**Fija el valor de gradocodigo +@param pGradocodigo nuevo Valor de gradocodigo*/ +public void setGradocodigo(String pGradocodigo){ + gradocodigo=pGradocodigo; +} + +/**Obtiene el valor de cordentrabajo +@return valor de cordentrabajo*/ +public Long getCordentrabajo(){ + return cordentrabajo; +} +/**Fija el valor de cordentrabajo +@param pCordentrabajo nuevo Valor de cordentrabajo*/ +public void setCordentrabajo(Long pCordentrabajo){ + cordentrabajo=pCordentrabajo; +} + +/**Obtiene el valor de cedulacustodio +@return valor de cedulacustodio*/ +public String getCedulacustodio(){ + return cedulacustodio; +} +/**Fija el valor de cedulacustodio +@param pCedulacustodio nuevo Valor de cedulacustodio*/ +public void setCedulacustodio(String pCedulacustodio){ + cedulacustodio=pCedulacustodio; +} + +/**Obtiene el valor de nombrecustodio +@return valor de nombrecustodio*/ +public String getNombrecustodio(){ + return nombrecustodio; +} +/**Fija el valor de nombrecustodio +@param pNombrecustodio nuevo Valor de nombrecustodio*/ +public void setNombrecustodio(String pNombrecustodio){ + nombrecustodio=pNombrecustodio; +} + +/**Obtiene el valor de apellidoscustidio +@return valor de apellidoscustidio*/ +public String getApellidoscustidio(){ + return apellidoscustidio; +} +/**Fija el valor de apellidoscustidio +@param pApellidoscustidio nuevo Valor de apellidoscustidio*/ +public void setApellidoscustidio(String pApellidoscustidio){ + apellidoscustidio=pApellidoscustidio; +} + +/**Obtiene el valor de observaciones +@return valor de observaciones*/ +public String getObservaciones() { + return observaciones; +} + +/**Fija el valor de observaciones +@param pObservaciones nuevo Valor de observaciones*/ +public void setObservaciones(String observaciones) { + this.observaciones = observaciones; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmOrdenTrabajoCustodios))return false; + TarmOrdenTrabajoCustodios that = (TarmOrdenTrabajoCustodios) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmOrdenTrabajoCustodios +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmOrdenTrabajoCustodios +*/ +public Object createInstance(){ + TarmOrdenTrabajoCustodios instance=new TarmOrdenTrabajoCustodios(); + return instance; +} +/**Clona la entidad TarmOrdenTrabajoCustodios +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmOrdenTrabajoCustodios p=(TarmOrdenTrabajoCustodios)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSancionDecomiso.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSancionDecomiso.java.svn-base new file mode 100644 index 0000000..39f9369 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSancionDecomiso.java.svn-base @@ -0,0 +1,273 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMSANCIONDECOMISO*/ +@Entity(name="TarmSancionDecomiso") +@Table(name="TARMSANCIONDECOMISO") +public class TarmSancionDecomiso extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmSancionDecomiso +*/ +@EmbeddedId +private TarmSancionDecomisoKey pk; +@Column(name="FECHAINICIO", nullable=true) + +/** +* null +*/ +private Date fechainicio; + +@Column(name="NORESOLUCION", nullable=true) + +/** +* Numero de la sancion convertido. SAN-00codigo +*/ +private String noresolucion; + +@Column(name="CTIPOSANCION", nullable=true) + +/** +* Clave primaria de la tabla +*/ +private String ctiposancion; + +@Column(name="FECHAFINAL", nullable=true) + +/** +* Fecha en la que se cumple la sancin +*/ +private Date fechafinal; + +@Column(name="XPATH", nullable=true) + +/** +* xpath del archivo convetido +*/ +private String xpath; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona sancionada +*/ +private Integer personcode; + +@Column(name="CDOCUMENTO", nullable=true) + +/** +* null +*/ +private Long cdocumento; + +@Column(name="CARMA", nullable=true) + +/** +* Codigo de arma +*/ +private String carma; + +/**Contructor por defecto*/ +public TarmSancionDecomiso(){ +} +/**Contructor de TarmSancionDecomiso +@param pPk Clave Primaria del entity +*/ +public TarmSancionDecomiso(TarmSancionDecomisoKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmSancionDecomiso +*/ +public static TarmSancionDecomiso find(EntityManager pEntityManager,TarmSancionDecomisoKey pKey) throws Exception{ + TarmSancionDecomiso obj = pEntityManager.find(TarmSancionDecomiso.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmSancionDecomiso +@return El objeto que referencia a la Clave primaria de TarmSancionDecomiso +*/ +public TarmSancionDecomisoKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmSancionDecomiso +@param pPk El objeto que referencia a la nueva Clave primaria de TarmSancionDecomiso +*/ +public void setPk(TarmSancionDecomisoKey pPk){ + pk=pPk; +} +/**Obtiene el valor de fechainicio +@return valor de fechainicio*/ +public Date getFechainicio(){ + return fechainicio; +} +/**Fija el valor de fechainicio +@param pFechainicio nuevo Valor de fechainicio*/ +public void setFechainicio(Date pFechainicio){ + fechainicio=pFechainicio; +} + +/**Obtiene el valor de noresolucion +@return valor de noresolucion*/ +public String getNoresolucion(){ + return noresolucion; +} +/**Fija el valor de noresolucion +@param pNoresolucion nuevo Valor de noresolucion*/ +public void setNoresolucion(String pNoresolucion){ + noresolucion=pNoresolucion; +} + +/**Obtiene el valor de ctiposancion +@return valor de ctiposancion*/ +public String getCtiposancion(){ + return ctiposancion; +} +/**Fija el valor de ctiposancion +@param pCtiposancion nuevo Valor de ctiposancion*/ +public void setCtiposancion(String pCtiposancion){ + ctiposancion=pCtiposancion; +} + +/**Obtiene el valor de fechafinal +@return valor de fechafinal*/ +public Date getFechafinal(){ + return fechafinal; +} +/**Fija el valor de fechafinal +@param pFechafinal nuevo Valor de fechafinal*/ +public void setFechafinal(Date pFechafinal){ + fechafinal=pFechafinal; +} + +/**Obtiene el valor de xpath +@return valor de xpath*/ +public String getXpath(){ + return xpath; +} +/**Fija el valor de xpath +@param pXpath nuevo Valor de xpath*/ +public void setXpath(String pXpath){ + xpath=pXpath; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de cdocumento +@return valor de cdocumento*/ +public Long getCdocumento(){ + return cdocumento; +} +/**Fija el valor de cdocumento +@param pCdocumento nuevo Valor de cdocumento*/ +public void setCdocumento(Long pCdocumento){ + cdocumento=pCdocumento; +} + +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmSancionDecomiso))return false; + TarmSancionDecomiso that = (TarmSancionDecomiso) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmSancionDecomiso +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmSancionDecomiso +*/ +public Object createInstance(){ + TarmSancionDecomiso instance=new TarmSancionDecomiso(); + instance.setPk(new TarmSancionDecomisoKey()); + return instance; +} +/**Clona la entidad TarmSancionDecomiso +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmSancionDecomiso p=(TarmSancionDecomiso)this.clone(); + p.setPk((TarmSancionDecomisoKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSancionDecomisoKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSancionDecomisoKey.java.svn-base new file mode 100644 index 0000000..c318c8b --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSancionDecomisoKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMSANCIONDECOMISO*/ +@Embeddable +public class TarmSancionDecomisoKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CSANCIONDECOMISO", nullable=false,updatable=false) + +/** +* Codigo de la sancion aplicada +*/ +private String csanciondecomiso; + +@Column(name="CDECOMISO", nullable=false,updatable=false) + +/** +* Codigo del decomiso asociado +*/ +private Long cdecomiso; + +/**Contructor por defecto*/ +public TarmSancionDecomisoKey(){} +/**Contructor de TarmSancionDecomisoKey +@param pCsanciondecomiso Codigo de la sancion aplicada +@param pCdecomiso Codigo del decomiso asociado +*/ +public TarmSancionDecomisoKey(String pCsanciondecomiso,Long pCdecomiso){ + csanciondecomiso=pCsanciondecomiso; + cdecomiso=pCdecomiso; +} +/**Obtiene el valor de csanciondecomiso +@return valor de csanciondecomiso*/ +public String getCsanciondecomiso(){ + return csanciondecomiso; +} +/**Fija el valor de csanciondecomiso +@param pCsanciondecomiso nuevo Valor de csanciondecomiso*/ +public void setCsanciondecomiso(String pCsanciondecomiso){ + csanciondecomiso=pCsanciondecomiso; +} + +/**Obtiene el valor de cdecomiso +@return valor de cdecomiso*/ +public Long getCdecomiso(){ + return cdecomiso; +} +/**Fija el valor de cdecomiso +@param pCdecomiso nuevo Valor de cdecomiso*/ +public void setCdecomiso(Long pCdecomiso){ + cdecomiso=pCdecomiso; +} + +/**Implementacion de la comparacion de TarmSancionDecomisoKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmSancionDecomisoKey))return false; + TarmSancionDecomisoKey that = (TarmSancionDecomisoKey) o; + if (this.getCsanciondecomiso() == null || that.getCsanciondecomiso() == null){ + return false; + } + if (! this.getCsanciondecomiso().equals(that.getCsanciondecomiso())){ + return false; + } + if (this.getCdecomiso() == null || that.getCdecomiso() == null){ + return false; + } + if (! this.getCdecomiso().equals(that.getCdecomiso())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmSancionDecomisoKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCsanciondecomiso() == null ? 0 : this.getCsanciondecomiso().hashCode()); + result = result * 37 + (this.getCdecomiso() == null ? 0 : this.getCdecomiso().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSancionRecomendacion.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSancionRecomendacion.java.svn-base new file mode 100644 index 0000000..f47d3ac --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSancionRecomendacion.java.svn-base @@ -0,0 +1,198 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMSANCIONRECOMENDACION*/ +@Entity(name="TarmSancionRecomendacion") +@Table(name="TARMSANCIONRECOMENDACION") +public class TarmSancionRecomendacion extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmSancionRecomendacion +*/ +@Id +@Column(name="CRECOMENDACION" ,nullable=false, updatable=false) +private String pk; +@Column(name="CDECOMISO", nullable=true) + +/** +* Codigo del Decomiso +*/ +private Long cdecomiso; + +@Column(name="CSANCIONDECOMISO", nullable=true) + +/** +* Codigo de la sancion ligada +*/ +private String csanciondecomiso; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de loggeada +*/ +private Integer personcode; + +@Column(name="RECOMENDACION", nullable=true) + +/** +* null +*/ +private String recomendacion; + +/**Contructor por defecto*/ +public TarmSancionRecomendacion(){ +} +/**Contructor de TarmSancionRecomendacion +@param pPk Clave Primaria del entity +*/ +public TarmSancionRecomendacion(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmSancionRecomendacion +*/ +public static TarmSancionRecomendacion find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmSancionRecomendacion obj = pEntityManager.find(TarmSancionRecomendacion.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmSancionRecomendacion +@return El objeto que referencia a la Clave primaria de TarmSancionRecomendacion +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmSancionRecomendacion +@param pPk El objeto que referencia a la nueva Clave primaria de TarmSancionRecomendacion +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de cdecomiso +@return valor de cdecomiso*/ +public Long getCdecomiso(){ + return cdecomiso; +} +/**Fija el valor de cdecomiso +@param pCdecomiso nuevo Valor de cdecomiso*/ +public void setCdecomiso(Long pCdecomiso){ + cdecomiso=pCdecomiso; +} + +/**Obtiene el valor de csanciondecomiso +@return valor de csanciondecomiso*/ +public String getCsanciondecomiso(){ + return csanciondecomiso; +} +/**Fija el valor de csanciondecomiso +@param pCsanciondecomiso nuevo Valor de csanciondecomiso*/ +public void setCsanciondecomiso(String pCsanciondecomiso){ + csanciondecomiso=pCsanciondecomiso; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de recomendacion +@return valor de recomendacion*/ +public String getRecomendacion(){ + return recomendacion; +} +/**Fija el valor de recomendacion +@param pRecomendacion nuevo Valor de recomendacion*/ +public void setRecomendacion(String pRecomendacion){ + recomendacion=pRecomendacion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmSancionRecomendacion))return false; + TarmSancionRecomendacion that = (TarmSancionRecomendacion) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmSancionRecomendacion +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmSancionRecomendacion +*/ +public Object createInstance(){ + TarmSancionRecomendacion instance=new TarmSancionRecomendacion(); + return instance; +} +/**Clona la entidad TarmSancionRecomendacion +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmSancionRecomendacion p=(TarmSancionRecomendacion)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitud.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitud.java.svn-base new file mode 100644 index 0000000..6dd595b --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitud.java.svn-base @@ -0,0 +1,624 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; + +import java.sql.Timestamp; + +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMSOLICITUD*/ +@Entity(name="TarmSolicitud") +@Table(name="TARMSOLICITUD") +public class TarmSolicitud extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmSolicitud +*/ +@Id +@Column(name="CSOLICITUD" ,nullable=false, updatable=false) +private String pk; +@Column(name="LUGARORIGEN", nullable=true) + +/** +* null +*/ +private String lugarorigen; + +@Column(name="ORIGENADQUISICION", nullable=true) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String origenadquisicion; + +@Column(name="CTRAMITE", nullable=true) + +/** +* null +*/ +private Long ctramite; + +@Column(name="CPROVINCIADESTINO", nullable=true) + +/** +* null +*/ +private String cprovinciadestino; + +@Column(name="LUGARDESTINO", nullable=true) + +/** +* null +*/ +private String lugardestino; + +@Column(name="FREAL", nullable=true) + +/** +* null +*/ +private Timestamp freal; + +@Column(name="MULTA", nullable=true) + +/** +* null +*/ +private BigDecimal multa; + +@Column(name="CPAISORIGEN", nullable=true) + +/** +* null +*/ +private String cpaisorigen; + +@Column(name="CPROVINCIAORIGEN", nullable=true) + +/** +* null +*/ +private String cprovinciaorigen; + +@Column(name="ESTADOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String estadocodigo; + +@Column(name="OBSERVACION", nullable=true) + +/** +* null +*/ +private String observacion; + +@Column(name="CCANTONORIGEN", nullable=true) + +/** +* null +*/ +private String ccantonorigen; + +@Column(name="CCANTONDESTINO", nullable=true) +/** +* null +*/ +private String ccantondestino; + +@Column(name="ESTADO", nullable=true) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String estado; + +@Column(name="FREGISTRO", nullable=true) + +/** +* null +*/ +private Date fregistro; + +@Column(name="NUMEROSOLICITUD", nullable=false) + +/** +* null +*/ +private String numerosolicitud; + +@Column(name="CPAISDESTINO", nullable=true) + +/** +* null +*/ +private String cpaisdestino; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="CCENTROCONTROL", nullable=true) + +/** +* Codigo de tipo de tramite +*/ +private String ccentrocontrol; + +@Column(name="ORIGENADQUISICIONCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String origenadquisicioncodigo; + +@Column(name="FVERIFICAREQUISITOS", nullable=true) + +/** +* Fecha en la que se verifica los requisitos de la solicitud +*/ +private Date fverificarequisitos; + +@Column(name="NUMEROCUSTODIOS", nullable=true) + +/** +* Indica el numero de custodios de la solicitud +*/ +private Integer numerocustodios; + +@Column(name="INICIOFLUJO", nullable=true) +/** +* null +*/ +private String inicioFlujo; + +@Column(name="AUCP", nullable=true) +/** +* Codigo de solicitud AUCP +*/ +private String aucp; + +@Column(name="XPATHACTA", nullable=true) + +/** +* null +*/ +private String xpathacta; + +@Column(name="TIPODOCUMENTOORIGEN", nullable=true) + +/** +* Codigo de catalogo 01 Cdula, 02 Ruc +*/ +private String tipodocumentoorigen; + +@Column(name="NUMERODOCUMENTOORIGEN", nullable=true) + +/** +* Nmero de documento de la persna o empresa que realiza la compra +*/ +private String numerodocumentoorigen; + +@Column(name="NOMBRERAZONSOCIALORIGEN", nullable=true) +/** +* Nombre de la persona o empresa de la compra +*/ +private String nombrerazonsocialorigen; + +/**Contructor por defecto*/ +public TarmSolicitud(){ +} +/**Contructor de TarmSolicitud +@param pPk Clave Primaria del entity +@param pNumerosolicitud null +*/ +public TarmSolicitud(String pPk,String pNumerosolicitud){ + this(); + pk=pPk; + numerosolicitud=pNumerosolicitud; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmSolicitud +*/ +public static TarmSolicitud find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmSolicitud obj = pEntityManager.find(TarmSolicitud.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmSolicitud +@return El objeto que referencia a la Clave primaria de TarmSolicitud +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmSolicitud +@param pPk El objeto que referencia a la nueva Clave primaria de TarmSolicitud +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de lugarorigen +@return valor de lugarorigen*/ +public String getLugarorigen(){ + return lugarorigen; +} +/**Fija el valor de lugarorigen +@param pLugarorigen nuevo Valor de lugarorigen*/ +public void setLugarorigen(String pLugarorigen){ + lugarorigen=pLugarorigen; +} + +/**Obtiene el valor de origenadquisicion +@return valor de origenadquisicion*/ +public String getOrigenadquisicion(){ + return origenadquisicion; +} +/**Fija el valor de origenadquisicion +@param pOrigenadquisicion nuevo Valor de origenadquisicion*/ +public void setOrigenadquisicion(String pOrigenadquisicion){ + origenadquisicion=pOrigenadquisicion; +} + +/**Obtiene el valor de ctramite +@return valor de ctramite*/ +public Long getCtramite(){ + return ctramite; +} +/**Fija el valor de ctramite +@param pCtramite nuevo Valor de ctramite*/ +public void setCtramite(Long pCtramite){ + ctramite=pCtramite; +} + +/**Obtiene el valor de cprovinciadestino +@return valor de cprovinciadestino*/ +public String getCprovinciadestino(){ + return cprovinciadestino; +} +/**Fija el valor de cprovinciadestino +@param pCprovinciadestino nuevo Valor de cprovinciadestino*/ +public void setCprovinciadestino(String pCprovinciadestino){ + cprovinciadestino=pCprovinciadestino; +} + +/**Obtiene el valor de lugardestino +@return valor de lugardestino*/ +public String getLugardestino(){ + return lugardestino; +} +/**Fija el valor de lugardestino +@param pLugardestino nuevo Valor de lugardestino*/ +public void setLugardestino(String pLugardestino){ + lugardestino=pLugardestino; +} + +/**Obtiene el valor de freal +@return valor de freal*/ +public Timestamp getFreal(){ + return freal; +} +/**Fija el valor de freal +@param pFreal nuevo Valor de freal*/ +public void setFreal(Timestamp pFreal){ + freal=pFreal; +} + +/**Obtiene el valor de multa +@return valor de multa*/ +public BigDecimal getMulta(){ + return multa; +} +/**Fija el valor de multa +@param pMulta nuevo Valor de multa*/ +public void setMulta(BigDecimal pMulta){ + multa=pMulta; +} + + +/**Obtiene el valor de cpaisorigen +@return valor de cpaisorigen*/ +public String getCpaisorigen(){ + return cpaisorigen; +} +/**Fija el valor de cpaisorigen +@param pCpaisorigen nuevo Valor de cpaisorigen*/ +public void setCpaisorigen(String pCpaisorigen){ + cpaisorigen=pCpaisorigen; +} + +/**Obtiene el valor de cprovinciaorigen +@return valor de cprovinciaorigen*/ +public String getCprovinciaorigen(){ + return cprovinciaorigen; +} +/**Fija el valor de cprovinciaorigen +@param pCprovinciaorigen nuevo Valor de cprovinciaorigen*/ +public void setCprovinciaorigen(String pCprovinciaorigen){ + cprovinciaorigen=pCprovinciaorigen; +} + +/**Obtiene el valor de estadocodigo +@return valor de estadocodigo*/ +public String getEstadocodigo(){ + return estadocodigo; +} +/**Fija el valor de estadocodigo +@param pEstadocodigo nuevo Valor de estadocodigo*/ +public void setEstadocodigo(String pEstadocodigo){ + estadocodigo=pEstadocodigo; +} + +/**Obtiene el valor de observacion +@return valor de observacion*/ +public String getObservacion(){ + return observacion; +} +/**Fija el valor de observacion +@param pObservacion nuevo Valor de observacion*/ +public void setObservacion(String pObservacion){ + observacion=pObservacion; +} + +/**Obtiene el valor de ccantonorigen +@return valor de ccantonorigen*/ +public String getCcantonorigen(){ + return ccantonorigen; +} +/**Fija el valor de ccantonorigen +@param pCcantonorigen nuevo Valor de ccantonorigen*/ +public void setCcantonorigen(String pCcantonorigen){ + ccantonorigen=pCcantonorigen; +} + +/**Obtiene el valor de ccantondestino +@return valor de ccantondestino*/ +public String getCcantondestino(){ + return ccantondestino; +} +/**Fija el valor de ccantondestino +@param pCcantondestino nuevo Valor de ccantondestino*/ +public void setCcantondestino(String pCcantondestino){ + ccantondestino=pCcantondestino; +} + +/**Obtiene el valor de estado +@return valor de estado*/ +public String getEstado(){ + return estado; +} +/**Fija el valor de estado +@param pEstado nuevo Valor de estado*/ +public void setEstado(String pEstado){ + estado=pEstado; +} + +/**Obtiene el valor de fregistro +@return valor de fregistro*/ +public Date getFregistro(){ + return fregistro; +} +/**Fija el valor de fregistro +@param pFregistro nuevo Valor de fregistro*/ +public void setFregistro(Date pFregistro){ + fregistro=pFregistro; +} + +/**Obtiene el valor de numerosolicitud +@return valor de numerosolicitud*/ +public String getNumerosolicitud(){ + return numerosolicitud; +} +/**Fija el valor de numerosolicitud +@param pNumerosolicitud nuevo Valor de numerosolicitud*/ +public void setNumerosolicitud(String pNumerosolicitud){ + numerosolicitud=pNumerosolicitud; +} + +/**Obtiene el valor de cpaisdestino +@return valor de cpaisdestino*/ +public String getCpaisdestino(){ + return cpaisdestino; +} +/**Fija el valor de cpaisdestino +@param pCpaisdestino nuevo Valor de cpaisdestino*/ +public void setCpaisdestino(String pCpaisdestino){ + cpaisdestino=pCpaisdestino; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de ccentrocontrol +@return valor de ccentrocontrol*/ +public String getCcentrocontrol(){ + return ccentrocontrol; +} +/**Fija el valor de ccentrocontrol +@param pCcentrocontrol nuevo Valor de ccentrocontrol*/ +public void setCcentrocontrol(String pCcentrocontrol){ + ccentrocontrol=pCcentrocontrol; +} + +/**Obtiene el valor de origenadquisicioncodigo +@return valor de origenadquisicioncodigo*/ +public String getOrigenadquisicioncodigo(){ + return origenadquisicioncodigo; +} +/**Fija el valor de origenadquisicioncodigo +@param pOrigenadquisicioncodigo nuevo Valor de origenadquisicioncodigo*/ +public void setOrigenadquisicioncodigo(String pOrigenadquisicioncodigo){ + origenadquisicioncodigo=pOrigenadquisicioncodigo; +} + +/**Obtiene el valor de fverificarequisitos +@return valor de fverificarequisitos*/ +public Date getFverificarequisitos(){ + return fverificarequisitos; +} +/**Fija el valor de fverificarequisitos +@param pFverificarequisitos nuevo Valor de fverificarequisitos*/ +public void setFverificarequisitos(Date pFverificarequisitos){ + fverificarequisitos=pFverificarequisitos; +} + +/**Obtiene el valor de numerocustodios +@return valor de numerocustodios*/ +public Integer getNumerocustodios(){ + return numerocustodios; +} +/**Fija el valor de numerocustodios +@param pNumerocustodios nuevo Valor de numerocustodios*/ +public void setNumerocustodios(Integer pNumerocustodios){ + numerocustodios=pNumerocustodios; +} + +public String getInicioFlujo() { + return inicioFlujo; +} +public void setInicioFlujo(String inicioFlujo) { + this.inicioFlujo = inicioFlujo; +} +public String getAucp() { + return aucp; +} +public void setAucp(String aucp) { + this.aucp = aucp; +} + +/**Obtiene el valor de xpathacta +@return valor de xpathacta*/ +public String getXpathacta(){ + return xpathacta; +} +/**Fija el valor de xpathacta +@param xpathacta nuevo Valor de xpathacta*/ +public void setXpathacta(String xpathacta){ + this.xpathacta=xpathacta; +} +/**Obtiene el valor de tipodocumento origen +@return valor de tipodocumento*/ +public String getTipodocumentoorigen() { + return tipodocumentoorigen; +} +/**Fija el valor de tipodocumento origen +@param pTipodocumento nuevo Valor de tipodocumento*/ +public void setTipodocumentoorigen(String pTipodocumentoorigen) { + this.tipodocumentoorigen = pTipodocumentoorigen; +} +/**Obtiene el valor de numerodocumento origen +@return valor de numerodocumento*/ +public String getNumerodocumentoorigen() { + return numerodocumentoorigen; +} +/**Fija el valor de numerodocumento origen +@param pNumerodocumento nuevo Valor de numerodocumento*/ +public void setNumerodocumentoorigen(String pNumerodocumentoorigen) { + this.numerodocumentoorigen = pNumerodocumentoorigen; +} +/**Obtiene el valor de nombrerazonsocial origen +@return valor de nombrerazonsocial*/ +public String getNombrerazonsocialorigen() { + return nombrerazonsocialorigen; +} +/**Fija el valor de nombrerazonsocial origen +@param pNombrerazonsocial nuevo Valor de nombrerazonsocial*/ +public void setNombrerazonsocialorigen(String pNombrerazonsocialorigen) { + this.nombrerazonsocialorigen = pNombrerazonsocialorigen; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmSolicitud))return false; + TarmSolicitud that = (TarmSolicitud) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmSolicitud +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmSolicitud +*/ +public Object createInstance(){ + TarmSolicitud instance=new TarmSolicitud(); + return instance; +} +/**Clona la entidad TarmSolicitud +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmSolicitud p=(TarmSolicitud)this.clone(); + return p; +} + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudAgenciaSucursal.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudAgenciaSucursal.java.svn-base new file mode 100644 index 0000000..19086b4 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudAgenciaSucursal.java.svn-base @@ -0,0 +1,163 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMSOLICITUDAGENCIASUCURSAL*/ +@Entity(name="TarmSolicitudAgenciaSucursal") +@Table(name="TARMSOLICITUDAGENCIASUCURSAL") +public class TarmSolicitudAgenciaSucursal extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmSolicitudAgenciaSucursal +*/ +@EmbeddedId +private TarmSolicitudAgenciaSucursalKey pk; +@Column(name="ESTADO", nullable=true) + +/** +* Estado de la agencia en el proceso de la solicitud +*/ +private String estado; + +@Column(name="ESTADOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo +*/ +private String estadocodigo; + +/**Contructor por defecto*/ +public TarmSolicitudAgenciaSucursal(){ +} +/**Contructor de TarmSolicitudAgenciaSucursal +@param pPk Clave Primaria del entity +*/ +public TarmSolicitudAgenciaSucursal(TarmSolicitudAgenciaSucursalKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmSolicitudAgenciaSucursal +*/ +public static TarmSolicitudAgenciaSucursal find(EntityManager pEntityManager,TarmSolicitudAgenciaSucursalKey pKey) throws Exception{ + TarmSolicitudAgenciaSucursal obj = pEntityManager.find(TarmSolicitudAgenciaSucursal.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmSolicitudAgenciaSucursal +@return El objeto que referencia a la Clave primaria de TarmSolicitudAgenciaSucursal +*/ +public TarmSolicitudAgenciaSucursalKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmSolicitudAgenciaSucursal +@param pPk El objeto que referencia a la nueva Clave primaria de TarmSolicitudAgenciaSucursal +*/ +public void setPk(TarmSolicitudAgenciaSucursalKey pPk){ + pk=pPk; +} +/**Obtiene el valor de estado +@return valor de estado*/ +public String getEstado(){ + return estado; +} +/**Fija el valor de estado +@param pEstado nuevo Valor de estado*/ +public void setEstado(String pEstado){ + estado=pEstado; +} + +/**Obtiene el valor de estadocodigo +@return valor de estadocodigo*/ +public String getEstadocodigo(){ + return estadocodigo; +} +/**Fija el valor de estadocodigo +@param pEstadocodigo nuevo Valor de estadocodigo*/ +public void setEstadocodigo(String pEstadocodigo){ + estadocodigo=pEstadocodigo; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmSolicitudAgenciaSucursal))return false; + TarmSolicitudAgenciaSucursal that = (TarmSolicitudAgenciaSucursal) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmSolicitudAgenciaSucursal +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmSolicitudAgenciaSucursal +*/ +public Object createInstance(){ + TarmSolicitudAgenciaSucursal instance=new TarmSolicitudAgenciaSucursal(); + instance.setPk(new TarmSolicitudAgenciaSucursalKey()); + return instance; +} +/**Clona la entidad TarmSolicitudAgenciaSucursal +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmSolicitudAgenciaSucursal p=(TarmSolicitudAgenciaSucursal)this.clone(); + p.setPk((TarmSolicitudAgenciaSucursalKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudAgenciaSucursalKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudAgenciaSucursalKey.java.svn-base new file mode 100644 index 0000000..5517f85 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudAgenciaSucursalKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMSOLICITUDAGENCIASUCURSAL*/ +@Embeddable +public class TarmSolicitudAgenciaSucursalKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CAGENCIA", nullable=false,updatable=false) + +/** +* null +*/ +private Long cagencia; + +@Column(name="CSOLICITUD", nullable=false,updatable=false) + +/** +* Codigo de solicitud de controld e armas +*/ +private String csolicitud; + +/**Contructor por defecto*/ +public TarmSolicitudAgenciaSucursalKey(){} +/**Contructor de TarmSolicitudAgenciaSucursalKey +@param pCagencia null +@param pCsolicitud Codigo de solicitud de controld e armas +*/ +public TarmSolicitudAgenciaSucursalKey(Long pCagencia,String pCsolicitud){ + cagencia=pCagencia; + csolicitud=pCsolicitud; +} +/**Obtiene el valor de cagencia +@return valor de cagencia*/ +public Long getCagencia(){ + return cagencia; +} +/**Fija el valor de cagencia +@param pCagencia nuevo Valor de cagencia*/ +public void setCagencia(Long pCagencia){ + cagencia=pCagencia; +} + +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Implementacion de la comparacion de TarmSolicitudAgenciaSucursalKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmSolicitudAgenciaSucursalKey))return false; + TarmSolicitudAgenciaSucursalKey that = (TarmSolicitudAgenciaSucursalKey) o; + if (this.getCagencia() == null || that.getCagencia() == null){ + return false; + } + if (! this.getCagencia().equals(that.getCagencia())){ + return false; + } + if (this.getCsolicitud() == null || that.getCsolicitud() == null){ + return false; + } + if (! this.getCsolicitud().equals(that.getCsolicitud())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmSolicitudAgenciaSucursalKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCagencia() == null ? 0 : this.getCagencia().hashCode()); + result = result * 37 + (this.getCsolicitud() == null ? 0 : this.getCsolicitud().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudArmas.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudArmas.java.svn-base new file mode 100644 index 0000000..80d5451 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudArmas.java.svn-base @@ -0,0 +1,186 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMSOLICITUDARMAS*/ +@Entity(name="TarmSolicitudArmas") +@Table(name="TARMSOLICITUDARMAS") +public class TarmSolicitudArmas extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmSolicitudArmas +*/ +@EmbeddedId +private TarmSolicitudArmasKey pk; +@Column(name="ENTREGADA", nullable=true) + +/** +* null +*/ +private String entregada; + +@Column(name="APROBADA", nullable=true) + +/** +* null +*/ +private String aprobada; + +@Column(name="PORDEVOLUCION", nullable=true) + +/** +* null +*/ +private String pordevolucion; + + +/**Contructor por defecto*/ +public TarmSolicitudArmas(){ +} +/**Contructor de TarmSolicitudArmas +@param pPk Clave Primaria del entity +*/ +public TarmSolicitudArmas(TarmSolicitudArmasKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmSolicitudArmas +*/ +public static TarmSolicitudArmas find(EntityManager pEntityManager,TarmSolicitudArmasKey pKey) throws Exception{ + TarmSolicitudArmas obj = pEntityManager.find(TarmSolicitudArmas.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmSolicitudArmas +@return El objeto que referencia a la Clave primaria de TarmSolicitudArmas +*/ +public TarmSolicitudArmasKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmSolicitudArmas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmSolicitudArmas +*/ +public void setPk(TarmSolicitudArmasKey pPk){ + pk=pPk; +} +/**Obtiene el valor de entregada +@return valor de entregada*/ +public String getEntregada(){ + return entregada; +} +/**Fija el valor de entregada +@param pEntregada nuevo Valor de entregada*/ +public void setEntregada(String pEntregada){ + entregada=pEntregada; +} + +/**Obtiene el valor de aprobada +@return valor de aprobada*/ +public String getAprobada(){ + return aprobada; +} +/**Fija el valor de aprobada +@param pAprobada nuevo Valor de aprobada*/ +public void setAprobada(String pAprobada){ + aprobada=pAprobada; +} + +/**Obtiene el valor de pordevolucion +@return valor de aprobada*/ +public String getPordevolucion() { + return pordevolucion; +} +/**Fija el valor de pordevlucion +@param pAprobada nuevo Valor de aprobada*/ +public void setPordevolucion(String pordevolucion) { + this.pordevolucion = pordevolucion; +} + + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmSolicitudArmas))return false; + TarmSolicitudArmas that = (TarmSolicitudArmas) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmSolicitudArmas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmSolicitudArmas +*/ +public Object createInstance(){ + TarmSolicitudArmas instance=new TarmSolicitudArmas(); + instance.setPk(new TarmSolicitudArmasKey()); + return instance; +} +/**Clona la entidad TarmSolicitudArmas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmSolicitudArmas p=(TarmSolicitudArmas)this.clone(); + p.setPk((TarmSolicitudArmasKey)this.pk.cloneMe()); + return p; +} + + + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudArmasKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudArmasKey.java.svn-base new file mode 100644 index 0000000..4d029ea --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudArmasKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMSOLICITUDARMAS*/ +@Embeddable +public class TarmSolicitudArmasKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CSOLICITUD", nullable=false,updatable=false) + +/** +* Codigo de solicitud de controld e armas +*/ +private String csolicitud; + +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="CARMA", nullable=false,updatable=false) + +/** +* null +*/ +private String carma; + +/**Contructor por defecto*/ +public TarmSolicitudArmasKey(){} +/**Contructor de TarmSolicitudArmasKey +@param pCsolicitud Codigo de solicitud de controld e armas +@param pPersoncode Codigo de persona +@param pCarma null +*/ +public TarmSolicitudArmasKey(String pCsolicitud,Integer pPersoncode,String pCarma){ + csolicitud=pCsolicitud; + personcode=pPersoncode; + carma=pCarma; +} +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Implementacion de la comparacion de TarmSolicitudArmasKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmSolicitudArmasKey))return false; + TarmSolicitudArmasKey that = (TarmSolicitudArmasKey) o; + if (this.getCsolicitud() == null || that.getCsolicitud() == null){ + return false; + } + if (! this.getCsolicitud().equals(that.getCsolicitud())){ + return false; + } + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getCarma() == null || that.getCarma() == null){ + return false; + } + if (! this.getCarma().equals(that.getCarma())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmSolicitudArmasKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCsolicitud() == null ? 0 : this.getCsolicitud().hashCode()); + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getCarma() == null ? 0 : this.getCarma().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudDocumento.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudDocumento.java.svn-base new file mode 100644 index 0000000..d895d6a --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudDocumento.java.svn-base @@ -0,0 +1,183 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMSOLICITUDDOCUMENTO*/ +@Entity(name="TarmSolicitudDocumento") +@Table(name="TARMSOLICITUDDOCUMENTO") +public class TarmSolicitudDocumento extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmSolicitudDocumento +*/ +@EmbeddedId +private TarmSolicitudDocumentoKey pk; +@Column(name="CHKIMPRESION", nullable=true) + +/** +* null +*/ +private String chkimpresion; + +@Column(name="CHKCERTIFICADO", nullable=true) + +/** +* null +*/ +private String chkcertificado; + +@Column(name="VERIFICADO", nullable=true) + +/** +* null +*/ +private String verificado; + +/**Contructor por defecto*/ +public TarmSolicitudDocumento(){ +} +/**Contructor de TarmSolicitudDocumento +@param pPk Clave Primaria del entity +*/ +public TarmSolicitudDocumento(TarmSolicitudDocumentoKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmSolicitudDocumento +*/ +public static TarmSolicitudDocumento find(EntityManager pEntityManager,TarmSolicitudDocumentoKey pKey) throws Exception{ + TarmSolicitudDocumento obj = pEntityManager.find(TarmSolicitudDocumento.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmSolicitudDocumento +@return El objeto que referencia a la Clave primaria de TarmSolicitudDocumento +*/ +public TarmSolicitudDocumentoKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmSolicitudDocumento +@param pPk El objeto que referencia a la nueva Clave primaria de TarmSolicitudDocumento +*/ +public void setPk(TarmSolicitudDocumentoKey pPk){ + pk=pPk; +} +/**Obtiene el valor de chkimpresion +@return valor de chkimpresion*/ +public String getChkimpresion(){ + return chkimpresion; +} +/**Fija el valor de chkimpresion +@param pChkimpresion nuevo Valor de chkimpresion*/ +public void setChkimpresion(String pChkimpresion){ + chkimpresion=pChkimpresion; +} + +/**Obtiene el valor de chkcertificado +@return valor de chkcertificado*/ +public String getChkcertificado(){ + return chkcertificado; +} +/**Fija el valor de chkcertificado +@param pChkcertificado nuevo Valor de chkcertificado*/ +public void setChkcertificado(String pChkcertificado){ + chkcertificado=pChkcertificado; +} + +/**Obtiene el valor de verificado +@return valor de verificado*/ +public String getVerificado(){ + return verificado; +} +/**Fija el valor de verificado +@param pVerificado nuevo Valor de verificado*/ +public void setVerificado(String pVerificado){ + verificado=pVerificado; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmSolicitudDocumento))return false; + TarmSolicitudDocumento that = (TarmSolicitudDocumento) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmSolicitudDocumento +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmSolicitudDocumento +*/ +public Object createInstance(){ + TarmSolicitudDocumento instance=new TarmSolicitudDocumento(); + instance.setPk(new TarmSolicitudDocumentoKey()); + return instance; +} +/**Clona la entidad TarmSolicitudDocumento +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmSolicitudDocumento p=(TarmSolicitudDocumento)this.clone(); + p.setPk((TarmSolicitudDocumentoKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudDocumentoKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudDocumentoKey.java.svn-base new file mode 100644 index 0000000..c21bbe0 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudDocumentoKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMSOLICITUDDOCUMENTO*/ +@Embeddable +public class TarmSolicitudDocumentoKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CDOCUMENTO", nullable=false,updatable=false) + +/** +* Codigo secuencial del documento habilitante +*/ +private Long cdocumento; + +@Column(name="CSOLICITUD", nullable=false,updatable=false) + +/** +* Codigo de solicitud +*/ +private String csolicitud; + +/**Contructor por defecto*/ +public TarmSolicitudDocumentoKey(){} +/**Contructor de TarmSolicitudDocumentoKey +@param pCdocumento Codigo secuencial del documento habilitante +@param pCsolicitud Codigo de solicitud +*/ +public TarmSolicitudDocumentoKey(Long pCdocumento,String pCsolicitud){ + cdocumento=pCdocumento; + csolicitud=pCsolicitud; +} +/**Obtiene el valor de cdocumento +@return valor de cdocumento*/ +public Long getCdocumento(){ + return cdocumento; +} +/**Fija el valor de cdocumento +@param pCdocumento nuevo Valor de cdocumento*/ +public void setCdocumento(Long pCdocumento){ + cdocumento=pCdocumento; +} + +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Implementacion de la comparacion de TarmSolicitudDocumentoKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmSolicitudDocumentoKey))return false; + TarmSolicitudDocumentoKey that = (TarmSolicitudDocumentoKey) o; + if (this.getCdocumento() == null || that.getCdocumento() == null){ + return false; + } + if (! this.getCdocumento().equals(that.getCdocumento())){ + return false; + } + if (this.getCsolicitud() == null || that.getCsolicitud() == null){ + return false; + } + if (! this.getCsolicitud().equals(that.getCsolicitud())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmSolicitudDocumentoKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCdocumento() == null ? 0 : this.getCdocumento().hashCode()); + result = result * 37 + (this.getCsolicitud() == null ? 0 : this.getCsolicitud().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudGuardias.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudGuardias.java.svn-base new file mode 100644 index 0000000..1503915 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudGuardias.java.svn-base @@ -0,0 +1,127 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMSOLICITUDGUARDIAS*/ +@Entity(name="TarmSolicitudGuardias") +@Table(name="TARMSOLICITUDGUARDIAS") +public class TarmSolicitudGuardias extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmSolicitudGuardias +*/ +@EmbeddedId +private TarmSolicitudGuardiasKey pk; +/**Contructor por defecto*/ +public TarmSolicitudGuardias(){ +} +/**Contructor de TarmSolicitudGuardias +@param pPk Clave Primaria del entity +*/ +public TarmSolicitudGuardias(TarmSolicitudGuardiasKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmSolicitudGuardias +*/ +public static TarmSolicitudGuardias find(EntityManager pEntityManager,TarmSolicitudGuardiasKey pKey) throws Exception{ + TarmSolicitudGuardias obj = pEntityManager.find(TarmSolicitudGuardias.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmSolicitudGuardias +@return El objeto que referencia a la Clave primaria de TarmSolicitudGuardias +*/ +public TarmSolicitudGuardiasKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmSolicitudGuardias +@param pPk El objeto que referencia a la nueva Clave primaria de TarmSolicitudGuardias +*/ +public void setPk(TarmSolicitudGuardiasKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmSolicitudGuardias))return false; + TarmSolicitudGuardias that = (TarmSolicitudGuardias) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmSolicitudGuardias +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmSolicitudGuardias +*/ +public Object createInstance(){ + TarmSolicitudGuardias instance=new TarmSolicitudGuardias(); + instance.setPk(new TarmSolicitudGuardiasKey()); + return instance; +} +/**Clona la entidad TarmSolicitudGuardias +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmSolicitudGuardias p=(TarmSolicitudGuardias)this.clone(); + p.setPk((TarmSolicitudGuardiasKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudGuardiasKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudGuardiasKey.java.svn-base new file mode 100644 index 0000000..d8b3b5a --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudGuardiasKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMSOLICITUDGUARDIAS*/ +@Embeddable +public class TarmSolicitudGuardiasKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CSOLICITUD", nullable=false,updatable=false) + +/** +* Codigo de solicitud de controld e armas +*/ +private String csolicitud; + +@Column(name="CEMPRESA", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer cempresa; + +@Column(name="CGUARDIA", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer cguardia; + +/**Contructor por defecto*/ +public TarmSolicitudGuardiasKey(){} +/**Contructor de TarmSolicitudGuardiasKey +@param pCsolicitud Codigo de solicitud de controld e armas +@param pCempresa Codigo de persona +@param pCguardia Codigo de persona +*/ +public TarmSolicitudGuardiasKey(String pCsolicitud,Integer pCempresa,Integer pCguardia){ + csolicitud=pCsolicitud; + cempresa=pCempresa; + cguardia=pCguardia; +} +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Obtiene el valor de cempresa +@return valor de cempresa*/ +public Integer getCempresa(){ + return cempresa; +} +/**Fija el valor de cempresa +@param pCempresa nuevo Valor de cempresa*/ +public void setCempresa(Integer pCempresa){ + cempresa=pCempresa; +} + +/**Obtiene el valor de cguardia +@return valor de cguardia*/ +public Integer getCguardia(){ + return cguardia; +} +/**Fija el valor de cguardia +@param pCguardia nuevo Valor de cguardia*/ +public void setCguardia(Integer pCguardia){ + cguardia=pCguardia; +} + +/**Implementacion de la comparacion de TarmSolicitudGuardiasKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmSolicitudGuardiasKey))return false; + TarmSolicitudGuardiasKey that = (TarmSolicitudGuardiasKey) o; + if (this.getCsolicitud() == null || that.getCsolicitud() == null){ + return false; + } + if (! this.getCsolicitud().equals(that.getCsolicitud())){ + return false; + } + if (this.getCempresa() == null || that.getCempresa() == null){ + return false; + } + if (! this.getCempresa().equals(that.getCempresa())){ + return false; + } + if (this.getCguardia() == null || that.getCguardia() == null){ + return false; + } + if (! this.getCguardia().equals(that.getCguardia())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmSolicitudGuardiasKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCsolicitud() == null ? 0 : this.getCsolicitud().hashCode()); + result = result * 37 + (this.getCempresa() == null ? 0 : this.getCempresa().hashCode()); + result = result * 37 + (this.getCguardia() == null ? 0 : this.getCguardia().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudRequisitos.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudRequisitos.java.svn-base new file mode 100644 index 0000000..5a96d0a --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudRequisitos.java.svn-base @@ -0,0 +1,181 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMSOLICITUDREQUISITOS*/ +@Entity(name="TarmSolicitudRequisitos") +@Table(name="TARMSOLICITUDREQUISITOS") +public class TarmSolicitudRequisitos extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmSolicitudRequisitos +*/ +@EmbeddedId +private TarmSolicitudRequisitosKey pk; +@Column(name="CARGADO", nullable=true) + +/** +* null +*/ +private String cargado; + +@Column(name="XPATHREQUISITO", nullable=true) + +/** +* null +*/ +private String xpathrequisito; + +@Column(name="ESTADOVALIDACION", nullable=true) + +/** +* null +*/ +private String estadovalidacion; + +/**Contructor por defecto*/ +public TarmSolicitudRequisitos(){ +} +/**Contructor de TarmSolicitudRequisitos +@param pPk Clave Primaria del entity +*/ +public TarmSolicitudRequisitos(TarmSolicitudRequisitosKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmSolicitudRequisitos +*/ +public static TarmSolicitudRequisitos find(EntityManager pEntityManager,TarmSolicitudRequisitosKey pKey) throws Exception{ + TarmSolicitudRequisitos obj = pEntityManager.find(TarmSolicitudRequisitos.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmSolicitudRequisitos +@return El objeto que referencia a la Clave primaria de TarmSolicitudRequisitos +*/ +public TarmSolicitudRequisitosKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmSolicitudRequisitos +@param pPk El objeto que referencia a la nueva Clave primaria de TarmSolicitudRequisitos +*/ +public void setPk(TarmSolicitudRequisitosKey pPk){ + pk=pPk; +} +/**Obtiene el valor de cargado +@return valor de cargado*/ +public String getCargado(){ + return cargado; +} +/**Fija el valor de cargado +@param pCargado nuevo Valor de cargado*/ +public void setCargado(String pCargado){ + cargado=pCargado; +} + +/**Obtiene el valor de xpathrequisito +@return valor de xpathrequisito*/ +public String getXpathrequisito(){ + return xpathrequisito; +} +/**Fija el valor de xpathrequisito +@param pXpathrequisito nuevo Valor de xpathrequisito*/ +public void setXpathrequisito(String pXpathrequisito){ + xpathrequisito=pXpathrequisito; +} + +/**Obtiene el valor de estadovalidacion +@return valor de estadovalidacion*/ +public String getEstadovalidacion(){ + return estadovalidacion; +} +/**Fija el valor de estadovalidacion +@param pEstadovalidacion nuevo Valor de estadovalidacion*/ +public void setEstadovalidacion(String pEstadovalidacion){ + estadovalidacion=pEstadovalidacion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmSolicitudRequisitos))return false; + TarmSolicitudRequisitos that = (TarmSolicitudRequisitos) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmSolicitudRequisitos +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmSolicitudRequisitos +*/ +public Object createInstance(){ + TarmSolicitudRequisitos instance=new TarmSolicitudRequisitos(); + instance.setPk(new TarmSolicitudRequisitosKey()); + return instance; +} +/**Clona la entidad TarmSolicitudRequisitos +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmSolicitudRequisitos p=(TarmSolicitudRequisitos)this.clone(); + p.setPk((TarmSolicitudRequisitosKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudRequisitosKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudRequisitosKey.java.svn-base new file mode 100644 index 0000000..f4de8d7 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudRequisitosKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMSOLICITUDREQUISITOS*/ +@Embeddable +public class TarmSolicitudRequisitosKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CSOLICITUD", nullable=false,updatable=false) + +/** +* Codigo de solicitud de controld e armas +*/ +private String csolicitud; + +@Column(name="CREQUISITO", nullable=false,updatable=false) + +/** +* Codigo de requisito +*/ +private String crequisito; + +@Column(name="CTRAMITE", nullable=false,updatable=false) + +/** +* null +*/ +private Long ctramite; + +/**Contructor por defecto*/ +public TarmSolicitudRequisitosKey(){} +/**Contructor de TarmSolicitudRequisitosKey +@param pCsolicitud Codigo de solicitud de controld e armas +@param pCrequisito Codigo de requisito +@param pCtramite null +*/ +public TarmSolicitudRequisitosKey(String pCsolicitud,String pCrequisito,Long pCtramite){ + csolicitud=pCsolicitud; + crequisito=pCrequisito; + ctramite=pCtramite; +} +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Obtiene el valor de crequisito +@return valor de crequisito*/ +public String getCrequisito(){ + return crequisito; +} +/**Fija el valor de crequisito +@param pCrequisito nuevo Valor de crequisito*/ +public void setCrequisito(String pCrequisito){ + crequisito=pCrequisito; +} + +/**Obtiene el valor de ctramite +@return valor de ctramite*/ +public Long getCtramite(){ + return ctramite; +} +/**Fija el valor de ctramite +@param pCtramite nuevo Valor de ctramite*/ +public void setCtramite(Long pCtramite){ + ctramite=pCtramite; +} + +/**Implementacion de la comparacion de TarmSolicitudRequisitosKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmSolicitudRequisitosKey))return false; + TarmSolicitudRequisitosKey that = (TarmSolicitudRequisitosKey) o; + if (this.getCsolicitud() == null || that.getCsolicitud() == null){ + return false; + } + if (! this.getCsolicitud().equals(that.getCsolicitud())){ + return false; + } + if (this.getCrequisito() == null || that.getCrequisito() == null){ + return false; + } + if (! this.getCrequisito().equals(that.getCrequisito())){ + return false; + } + if (this.getCtramite() == null || that.getCtramite() == null){ + return false; + } + if (! this.getCtramite().equals(that.getCtramite())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmSolicitudRequisitosKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCsolicitud() == null ? 0 : this.getCsolicitud().hashCode()); + result = result * 37 + (this.getCrequisito() == null ? 0 : this.getCrequisito().hashCode()); + result = result * 37 + (this.getCtramite() == null ? 0 : this.getCtramite().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudTramite.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudTramite.java.svn-base new file mode 100644 index 0000000..c8bb823 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudTramite.java.svn-base @@ -0,0 +1,518 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMSOLICITUDTRAMITE*/ +@Entity(name="TarmSolicitudTramite") +@Table(name="TARMSOLICITUDTRAMITE") +public class TarmSolicitudTramite extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmSolicitudTramite +*/ +@EmbeddedId +private TarmSolicitudTramiteKey pk; +@Column(name="NUMEROTRAMITE", nullable=true) + +/** +* null +*/ +private String numerotramite; + +@Column(name="VALOR", nullable=true) + +/** +* null +*/ +private BigDecimal valor; + +@Column(name="CANTIDAD", nullable=true) + +/** +* null +*/ +private Integer cantidad; + +@Column(name="NUMEROCOMPROBANTE", nullable=true) + +/** +* null +*/ +private String numerocomprobante; + +@Column(name="XPATHCOMPROBANTE", nullable=true) + +/** +* null +*/ +private String xpathcomprobante; + +@Column(name="XPATHRESOLUCION", nullable=true) + +/** +* null +*/ +private String xpathresolucion; + + +@Column(name="VALORVERIFICACION", nullable=true) + +/** +* null +*/ +private BigDecimal valorverificacion; + +@Column(name="FENTREGAARMAS", nullable=true) + +/** +* null +*/ +private Date fentregaarmas; + +@Column(name="VALORAPAGAR", nullable=true) + +/** +* null +*/ +private BigDecimal valorapagar; + +@Column(name="ESTADOTRAMITE", nullable=true) + +/** +* null +*/ +private String estadotramite; + +@Column(name="ESTADOTRAMITECODIGO", nullable=true) + +/** +* null +*/ +private String estadotramitecodigo; + +@Column(name="FECHACOMPROBANTE", nullable=true) + +/** +* null +*/ +private Date fechacomprobante; + +@Column(name="OBSERVACIONDEPOSITO", nullable=true) + +/** +* null +*/ +private String observaciondeposito; + +@Column(name="VALORVERIFICADO", nullable=true) + +/** +* null +*/ +private BigDecimal valorverificado; + + +@Column(name="OBSERVACIONNOVEDAD", nullable=true) + +/** +* null +*/ +private String observacionnovedad; + +@Column(name="VALORTRAMITEARMAS", nullable=true) + +/** +* Es el valor del tramite en caso de ser de tipo costo total o el valor del arma por el numero de armas en caso de ser de tipo costo parcial +*/ +private BigDecimal valortramitearmas; + +@Column(name="VALORMULTA", nullable=true) + +/** +* Es el valor de las multas no canceladas previas, que seran cobradas en este tramite +*/ +private BigDecimal valormulta; + +@Column(name="VALORCUSTODIOS", nullable=true) + +/** +* Es el valor del numero de custodios por el costo de cada custodio en ese tramite +*/ +private BigDecimal valorcustodios; + +@Column(name="INICIOFLUJO", nullable=true) +/** +* null +*/ +private String inicioFlujo; + +@Column(name="INCASHREPORT", nullable=true) +/** +* null +*/ +private String incashreport; + +@Column(name="XPATHCOMPROBANTEORIGINAL", nullable=true) + +/** +* null +*/ +private String xpathcomprobanteorignal; + +@Column(name="OBSERVACION", nullable=true) + +/** +* null +*/ +private String observacion; + +@Column(name="USUARIOCAMBIO", nullable=true) + +/** +* null +*/ +private String usuariocambio; + +/**Contructor por defecto*/ +public TarmSolicitudTramite(){ +} +/**Contructor de TarmSolicitudTramite +@param pPk Clave Primaria del entity +*/ +public TarmSolicitudTramite(TarmSolicitudTramiteKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmSolicitudTramite +*/ +public static TarmSolicitudTramite find(EntityManager pEntityManager,TarmSolicitudTramiteKey pKey) throws Exception{ + TarmSolicitudTramite obj = pEntityManager.find(TarmSolicitudTramite.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmSolicitudTramite +@return El objeto que referencia a la Clave primaria de TarmSolicitudTramite +*/ +public TarmSolicitudTramiteKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmSolicitudTramite +@param pPk El objeto que referencia a la nueva Clave primaria de TarmSolicitudTramite +*/ +public void setPk(TarmSolicitudTramiteKey pPk){ + pk=pPk; +} +/**Obtiene el valor de numerotramite +@return valor de numerotramite*/ +public String getNumerotramite(){ + return numerotramite; +} +/**Fija el valor de numerotramite +@param pNumerotramite nuevo Valor de numerotramite*/ +public void setNumerotramite(String pNumerotramite){ + numerotramite=pNumerotramite; +} + +/**Obtiene el valor de valor +@return valor de valor*/ +public BigDecimal getValor(){ + return valor; +} +/**Fija el valor de valor +@param pValor nuevo Valor de valor*/ +public void setValor(BigDecimal pValor){ + valor=pValor; +} + +/**Obtiene el valor de cantidad +@return valor de cantidad*/ +public Integer getCantidad(){ + return cantidad; +} +/**Fija el valor de cantidad +@param pCantidad nuevo Valor de cantidad*/ +public void setCantidad(Integer pCantidad){ + cantidad=pCantidad; +} + +/**Obtiene el valor de numerocomprobante +@return valor de numerocomprobante*/ +public String getNumerocomprobante(){ + return numerocomprobante; +} +/**Fija el valor de numerocomprobante +@param pNumerocomprobante nuevo Valor de numerocomprobante*/ +public void setNumerocomprobante(String pNumerocomprobante){ + numerocomprobante=pNumerocomprobante; +} + +/**Obtiene el valor de xpathcomprobante +@return valor de xpathcomprobante*/ +public String getXpathcomprobante(){ + return xpathcomprobante; +} +/**Fija el valor de xpathcomprobante +@param pXpathcomprobante nuevo Valor de xpathcomprobante*/ +public void setXpathcomprobante(String pXpathcomprobante){ + xpathcomprobante=pXpathcomprobante; +} + +/**Obtiene el valor de valorverificacion +@return valor de valorverificacion*/ +public BigDecimal getValorverificacion(){ + return valorverificacion; +} +/**Fija el valor de valorverificacion +@param pValorverificacion nuevo Valor de valorverificacion*/ +public void setValorverificacion(BigDecimal pValorverificacion){ + valorverificacion=pValorverificacion; +} + +/**Obtiene el valor de fentregaarmas +@return valor de fentregaarmas*/ +public Date getFentregaarmas(){ + return fentregaarmas; +} +/**Fija el valor de fentregaarmas +@param pFentregaarmas nuevo Valor de fentregaarmas*/ +public void setFentregaarmas(Date pFentregaarmas){ + fentregaarmas=pFentregaarmas; +} + +/**Obtiene el valor de valorapagar +@return valor de valorapagar*/ +public BigDecimal getValorapagar(){ + return valorapagar; +} +/**Fija el valor de valorapagar +@param pValorapagar nuevo Valor de valorapagar*/ +public void setValorapagar(BigDecimal pValorapagar){ + valorapagar=pValorapagar; +} + +/**Obtiene el valor de estadotramite +@return valor de estadotramite*/ +public String getEstadotramite(){ + return estadotramite; +} +/**Fija el valor de estadotramite +@param pEstadotramite nuevo Valor de estadotramite*/ +public void setEstadotramite(String pEstadotramite){ + estadotramite=pEstadotramite; +} + +/**Obtiene el valor de estadotramitecodigo +@return valor de estadotramitecodigo*/ +public String getEstadotramitecodigo(){ + return estadotramitecodigo; +} +/**Fija el valor de estadotramitecodigo +@param pEstadotramitecodigo nuevo Valor de estadotramitecodigo*/ +public void setEstadotramitecodigo(String pEstadotramitecodigo){ + estadotramitecodigo=pEstadotramitecodigo; +} + +/**Obtiene el valor de fechacomprobante +@return valor de fechacomprobante*/ +public Date getFechacomprobante(){ + return fechacomprobante; +} +/**Fija el valor de fechacomprobante +@param pFechacomprobante nuevo Valor de fechacomprobante*/ +public void setFechacomprobante(Date pFechacomprobante){ + fechacomprobante=pFechacomprobante; +} + +/**Obtiene el valor de observacion al verificar deposito +@return valor de observaciondeposito*/ +public String getObservaciondeposito(){ + return observaciondeposito; +} +/**Fija el valor de observacion al verificar deposito +@param pObservaciondeposito nuevo Valor de observaciondeposito*/ +public void setObservaciondeposito(String pObservaciondeposito){ + observaciondeposito=pObservaciondeposito; +} + +/**Obtiene el valor de valorverificado +@return valor de valorverificado*/ +public BigDecimal getValorverificado(){ + return valorverificado; +} +/**Fija el valor de valorverificado +@param pValorverificado nuevo Valor de valorverificado*/ +public void setValorverificado(BigDecimal pValorverificado){ + valorverificado=pValorverificado; +} + +/**Obtiene el valor de observacionnovedad +@return valor de observacionnovedad*/ +public String getObservacionnovedad() { + return observacionnovedad; +} +/**Fija el valor de observacionnovedad +@param pValorverificado nuevo Valor de observacionnovedad*/ +public void setObservacionnovedad(String observacionnovedad) { + this.observacionnovedad = observacionnovedad; +} + + +/**Obtiene el valor de valortramitearmas +@return valor de valortramitearmas*/ +public BigDecimal getValortramitearmas(){ + return valortramitearmas; +} +/**Fija el valor de valortramitearmas +@param pValortramitearmas nuevo Valor de valortramitearmas*/ +public void setValortramitearmas(BigDecimal pValortramitearmas){ + valortramitearmas=pValortramitearmas; +} +/**Obtiene el valor de valorcustodios +@return valor de valorcustodios*/ +public BigDecimal getValorcustodios(){ + return valorcustodios; +} +/**Fija el valor de valorcustodios +@param pValorcustodios nuevo Valor de valorcustodios*/ +public void setValorcustodios(BigDecimal pValorcustodios){ + valorcustodios=pValorcustodios; +} + +/**Obtiene el valor de valormulta +@return valor de valormulta*/ +public BigDecimal getValormulta(){ + return valormulta; +} +/**Fija el valor de valormulta +@param pValormulta nuevo Valor de valormulta*/ +public void setValormulta(BigDecimal pValormulta){ + valormulta=pValormulta; +} + + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmSolicitudTramite))return false; + TarmSolicitudTramite that = (TarmSolicitudTramite) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmSolicitudTramite +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmSolicitudTramite +*/ +public Object createInstance(){ + TarmSolicitudTramite instance=new TarmSolicitudTramite(); + instance.setPk(new TarmSolicitudTramiteKey()); + return instance; +} +/**Clona la entidad TarmSolicitudTramite +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmSolicitudTramite p=(TarmSolicitudTramite)this.clone(); + p.setPk((TarmSolicitudTramiteKey)this.pk.cloneMe()); + return p; +} +public String getInicioFlujo() { + return inicioFlujo; +} +public void setInicioFlujo(String inicioFlujo) { + this.inicioFlujo = inicioFlujo; +} +public String getIncashreport() { + return incashreport; +} +public void setIncashreport(String incashreport) { + this.incashreport = incashreport; +} +public String getXpathresolucion() { + return xpathresolucion; +} +public void setXpathresolucion(String xpathresolucion) { + this.xpathresolucion = xpathresolucion; +} +public String getXpathcomprobanteorignal() { + return xpathcomprobanteorignal; +} +public void setXpathcomprobanteorignal(String xpathcomprobanteorignal) { + this.xpathcomprobanteorignal = xpathcomprobanteorignal; +} +public String getObservacion() { + return observacion; +} +public void setObservacion(String observacion) { + this.observacion = observacion; +} +public String getUsuariocambio() { + return usuariocambio; +} +public void setUsuariocambio(String usuariocambio) { + this.usuariocambio = usuariocambio; +} + + + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudTramiteKey.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudTramiteKey.java.svn-base new file mode 100644 index 0000000..2cfe6cb --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmSolicitudTramiteKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMSOLICITUDTRAMITE*/ +@Embeddable +public class TarmSolicitudTramiteKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CSOLICITUD", nullable=false,updatable=false) + +/** +* Codigo de solicitud de controld e armas +*/ +private String csolicitud; + +@Column(name="CTRAMITE", nullable=false,updatable=false) + +/** +* null +*/ +private Long ctramite; + +/**Contructor por defecto*/ +public TarmSolicitudTramiteKey(){} +/**Contructor de TarmSolicitudTramiteKey +@param pCsolicitud Codigo de solicitud de controld e armas +@param pCtramite null +*/ +public TarmSolicitudTramiteKey(String pCsolicitud,Long pCtramite){ + csolicitud=pCsolicitud; + ctramite=pCtramite; +} +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Obtiene el valor de ctramite +@return valor de ctramite*/ +public Long getCtramite(){ + return ctramite; +} +/**Fija el valor de ctramite +@param pCtramite nuevo Valor de ctramite*/ +public void setCtramite(Long pCtramite){ + ctramite=pCtramite; +} + +/**Implementacion de la comparacion de TarmSolicitudTramiteKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmSolicitudTramiteKey))return false; + TarmSolicitudTramiteKey that = (TarmSolicitudTramiteKey) o; + if (this.getCsolicitud() == null || that.getCsolicitud() == null){ + return false; + } + if (! this.getCsolicitud().equals(that.getCsolicitud())){ + return false; + } + if (this.getCtramite() == null || that.getCtramite() == null){ + return false; + } + if (! this.getCtramite().equals(that.getCtramite())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmSolicitudTramiteKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCsolicitud() == null ? 0 : this.getCsolicitud().hashCode()); + result = result * 37 + (this.getCtramite() == null ? 0 : this.getCtramite().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmTerminos.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmTerminos.java.svn-base new file mode 100644 index 0000000..856d0c6 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmTerminos.java.svn-base @@ -0,0 +1,189 @@ +package com.fp.persistence.parmas.soli; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMTERMINOS*/ +@Entity(name="TarmTerminos") +@Table(name="TARMTERMINOS") +public class TarmTerminos extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmArmas +*/ +@Id +@Column(name="CTERMINOS" ,nullable=false, updatable=false) +private String pk; + +@Column(name="ACEPTA", nullable=true) + +/** +* null +*/ +private String acepta; + + +@Column(name="IDENTIFICACION", nullable=true) + +/** +* null +*/ +private String identificacion; + +@Column(name="DOCUMENTO", nullable=true) + +/** +* Partida arancelaria +*/ +private String documnto; + +@Column(name="FECHAREGISTRO", nullable=true) + +/** +*/ +private Date fecharegistro; + +/**Contructor por defecto*/ +public TarmTerminos(){ +} +/**Contructor de TarmArmas +@param pPk Clave Primaria del entity +*/ +public TarmTerminos(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmArmas +*/ +public static TarmTerminos find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmTerminos obj = pEntityManager.find(TarmTerminos.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmArmas +@return El objeto que referencia a la Clave primaria de TarmArmas +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmArmas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmArmas +*/ +public void setPk(String pPk){ + pk=pPk; +} + + + +public int getHashValue() { + return hashValue; +} +public void setHashValue(int hashValue) { + this.hashValue = hashValue; +} +public String getAcepta() { + return acepta; +} +public void setAcepta(String acepta) { + this.acepta = acepta; +} + +public String getIdentificacion() { + return identificacion; +} +public void setIdentificacion(String identificacion) { + this.identificacion = identificacion; +} +public String getDocumnto() { + return documnto; +} +public void setDocumnto(String documnto) { + this.documnto = documnto; +} +public Date getFecharegistro() { + return fecharegistro; +} +public void setFecharegistro(Date fecharegistro) { + this.fecharegistro = fecharegistro; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmTerminos))return false; + TarmTerminos that = (TarmTerminos) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmArmas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmArmas +*/ +public Object createInstance(){ + TarmTerminos instance=new TarmTerminos(); + return instance; +} +/**Clona la entidad TarmArmas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmTerminos p=(TarmTerminos)this.clone(); + return p; +} + + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmTransaccionArmaBodega.java.svn-base b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmTransaccionArmaBodega.java.svn-base new file mode 100644 index 0000000..7ebda1e --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/.svn/text-base/TarmTransaccionArmaBodega.java.svn-base @@ -0,0 +1,260 @@ +package com.fp.persistence.parmas.soli; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMTRANSACCIONARMABODEGA*/ +@Entity(name="TarmTransaccionArmaBodega") +@Table(name="TARMTRANSACCIONARMABODEGA") +public class TarmTransaccionArmaBodega extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmTransaccionArmaBodega +*/ +@Id +@Column(name="CTRANARMBODEGA" ,nullable=false, updatable=false) +/*@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CTRANARMBODEGA"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.Long"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "16")}) + @GeneratedValue(generator = "seq_id")*/ +private Long pk; +@Column(name="FECHA", nullable=true) + +/** +* fecha de registro +*/ +private Timestamp fecha; + +@Column(name="CDECOMISOARMATRANSACCION", nullable=true) + +/** +* codigo de la tabla tarmdecomisoarmatransaccion, se genera el codigo de envio y recepcion +*/ +private Long cdecomisoarmatransaccion; + +@Column(name="CARMA", nullable=true) + +/** +* codigo del arma +*/ +private String carma; + +@Column(name="OPERACION", nullable=true) + +/** +* Codigo de catalogo 01Recepcion, 02 Envio +*/ +private String operacion; + +@Column(name="OPERACIONCODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de operaciones +*/ +private String operacioncode; + +@Column(name="CCENTROCONTROLORIGEN", nullable=true) + +/** +* Codigo de centro de control de armas, bodega de origen +*/ +private String ccentrocontrolorigen; + +@Column(name="CCENTROCONTROLDESTINO", nullable=true) + +/** +* Codigo de centro de control de armas, bodega destino +*/ +private String ccentrocontroldestino; + +/**Contructor por defecto*/ +public TarmTransaccionArmaBodega(){ +} +/**Contructor de TarmTransaccionArmaBodega +@param pPk Clave Primaria del entity +*/ +public TarmTransaccionArmaBodega(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmTransaccionArmaBodega +*/ +public static TarmTransaccionArmaBodega find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmTransaccionArmaBodega obj = pEntityManager.find(TarmTransaccionArmaBodega.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmTransaccionArmaBodega +@return El objeto que referencia a la Clave primaria de TarmTransaccionArmaBodega +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmTransaccionArmaBodega +@param pPk El objeto que referencia a la nueva Clave primaria de TarmTransaccionArmaBodega +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de fecha +@return valor de fecha*/ +public Timestamp getFecha(){ + return fecha; +} +/**Fija el valor de fecha +@param pFecha nuevo Valor de fecha*/ +public void setFecha(Timestamp pFecha){ + fecha=pFecha; +} + +/**Obtiene el valor de cdecomisoarmatransaccion +@return valor de cdecomisoarmatransaccion*/ +public Long getCdecomisoarmatransaccion(){ + return cdecomisoarmatransaccion; +} +/**Fija el valor de cdecomisoarmatransaccion +@param pCdecomisoarmatransaccion nuevo Valor de cdecomisoarmatransaccion*/ +public void setCdecomisoarmatransaccion(Long pCdecomisoarmatransaccion){ + cdecomisoarmatransaccion=pCdecomisoarmatransaccion; +} + +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de operacion +@return valor de operacion*/ +public String getOperacion(){ + return operacion; +} +/**Fija el valor de operacion +@param pOperacion nuevo Valor de operacion*/ +public void setOperacion(String pOperacion){ + operacion=pOperacion; +} + +/**Obtiene el valor de operacioncode +@return valor de operacioncode*/ +public String getOperacioncode(){ + return operacioncode; +} +/**Fija el valor de operacioncode +@param pOperacioncode nuevo Valor de operacioncode*/ +public void setOperacioncode(String pOperacioncode){ + operacioncode=pOperacioncode; +} + +/**Obtiene el valor de ccentrocontrolorigen +@return valor de ccentrocontrolorigen*/ +public String getCcentrocontrolorigen(){ + return ccentrocontrolorigen; +} +/**Fija el valor de ccentrocontrolorigen +@param pCcentrocontrolorigen nuevo Valor de ccentrocontrolorigen*/ +public void setCcentrocontrolorigen(String pCcentrocontrolorigen){ + ccentrocontrolorigen=pCcentrocontrolorigen; +} + +/**Obtiene el valor de ccentrocontroldestino +@return valor de ccentrocontroldestino*/ +public String getCcentrocontroldestino(){ + return ccentrocontroldestino; +} +/**Fija el valor de ccentrocontroldestino +@param pCcentrocontroldestino nuevo Valor de ccentrocontroldestino*/ +public void setCcentrocontroldestino(String pCcentrocontroldestino){ + ccentrocontroldestino=pCcentrocontroldestino; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmTransaccionArmaBodega))return false; + TarmTransaccionArmaBodega that = (TarmTransaccionArmaBodega) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmTransaccionArmaBodega +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmTransaccionArmaBodega +*/ +public Object createInstance(){ + TarmTransaccionArmaBodega instance=new TarmTransaccionArmaBodega(); + return instance; +} +/**Clona la entidad TarmTransaccionArmaBodega +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmTransaccionArmaBodega p=(TarmTransaccionArmaBodega)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/CashManagementDTO.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/CashManagementDTO.java new file mode 100644 index 0000000..d9986c4 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/CashManagementDTO.java @@ -0,0 +1,108 @@ +package com.fp.persistence.parmas.soli; + +import java.io.Serializable; +import java.math.BigDecimal; + +public class CashManagementDTO implements Serializable, Cloneable { + /** + * + */ + private static final long serialVersionUID = 1L; + // Codigo de orientacion + private String codigoServicio; + // Contrapartida + private String contrato; + private String moneda; + private String valorapagar; + // Forma de cobro + private String formaCobro; + private String tipoCuenta; + private String numeroCuenta; + // referencia, es el tipo autorizacion + private String referencia; + private String tipoIDCliente; + private String numeroIDCliente; + private String nombreCliente; + private String baseImponible; + private String csolicitud; + public String getCodigoServicio() { + return codigoServicio; + } + public void setCodigoServicio(String codigoServicio) { + this.codigoServicio = codigoServicio; + } + public String getContrato() { + return contrato; + } + public void setContrato(String contrato) { + this.contrato = contrato; + } + public String getMoneda() { + return moneda; + } + public void setMoneda(String moneda) { + this.moneda = moneda; + } + public String getValorapagar() { + return valorapagar; + } + public void setValorapagar(String valorapagar) { + this.valorapagar = valorapagar; + } + public String getFormaCobro() { + return formaCobro; + } + public void setFormaCobro(String formaCobro) { + this.formaCobro = formaCobro; + } + public String getTipoCuenta() { + return tipoCuenta; + } + public void setTipoCuenta(String tipoCuenta) { + this.tipoCuenta = tipoCuenta; + } + public String getNumeroCuenta() { + return numeroCuenta; + } + public void setNumeroCuenta(String numeroCuenta) { + this.numeroCuenta = numeroCuenta; + } + public String getReferencia() { + return referencia; + } + public void setReferencia(String referencia) { + this.referencia = referencia; + } + public String getTipoIDCliente() { + return tipoIDCliente; + } + public void setTipoIDCliente(String tipoIDCliente) { + this.tipoIDCliente = tipoIDCliente; + } + public String getNumeroIDCliente() { + return numeroIDCliente; + } + public void setNumeroIDCliente(String numeroIDCliente) { + this.numeroIDCliente = numeroIDCliente; + } + public String getNombreCliente() { + return nombreCliente; + } + public void setNombreCliente(String nombreCliente) { + this.nombreCliente = nombreCliente; + } + public String getBaseImponible() { + return baseImponible; + } + public void setBaseImponible(String baseImponible) { + this.baseImponible = baseImponible; + } + public String getCsolicitud() { + return csolicitud; + } + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmAgenciaArma.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmAgenciaArma.java new file mode 100644 index 0000000..9790b08 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmAgenciaArma.java @@ -0,0 +1,129 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMAGENCIAARMA*/ +@Entity(name="TarmAgenciaArma") +@Table(name="TARMAGENCIAARMA") +public class TarmAgenciaArma extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmAgenciaArma +*/ +@EmbeddedId +private TarmAgenciaArmaKey pk; +/**Contructor por defecto*/ +public TarmAgenciaArma(){ +} +/**Contructor de TarmAgenciaArma +@param pPk Clave Primaria del entity +*/ +public TarmAgenciaArma(TarmAgenciaArmaKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmAgenciaArma +*/ +public static TarmAgenciaArma find(EntityManager pEntityManager,TarmAgenciaArmaKey pKey) throws Exception{ + TarmAgenciaArma obj = pEntityManager.find(TarmAgenciaArma.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmAgenciaArma +@return El objeto que referencia a la Clave primaria de TarmAgenciaArma +*/ +public TarmAgenciaArmaKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmAgenciaArma +@param pPk El objeto que referencia a la nueva Clave primaria de TarmAgenciaArma +*/ +public void setPk(TarmAgenciaArmaKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmAgenciaArma))return false; + TarmAgenciaArma that = (TarmAgenciaArma) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmAgenciaArma +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmAgenciaArma +*/ +public Object createInstance(){ + TarmAgenciaArma instance=new TarmAgenciaArma(); + instance.setPk(new TarmAgenciaArmaKey()); + return instance; +} +/**Clona la entidad TarmAgenciaArma +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmAgenciaArma p=(TarmAgenciaArma)this.clone(); + p.setPk((TarmAgenciaArmaKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmAgenciaArmaKey.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmAgenciaArmaKey.java new file mode 100644 index 0000000..69024dc --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmAgenciaArmaKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMAGENCIAARMA*/ +@Embeddable +public class TarmAgenciaArmaKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CARMA", nullable=false,updatable=false) + +/** +* PK del arma asociada a la agencia +*/ +private String carma; + +@Column(name="CAGENCIA", nullable=false,updatable=false) + +/** +* PK de la agencia asociada al arma +*/ +private Long cagencia; + +/**Contructor por defecto*/ +public TarmAgenciaArmaKey(){} +/**Contructor de TarmAgenciaArmaKey +@param pCarma PK del arma asociada a la agencia +@param pCagencia PK de la agencia asociada al arma +*/ +public TarmAgenciaArmaKey(String pCarma,Long pCagencia){ + carma=pCarma; + cagencia=pCagencia; +} +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de cagencia +@return valor de cagencia*/ +public Long getCagencia(){ + return cagencia; +} +/**Fija el valor de cagencia +@param pCagencia nuevo Valor de cagencia*/ +public void setCagencia(Long pCagencia){ + cagencia=pCagencia; +} + +/**Implementacion de la comparacion de TarmAgenciaArmaKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmAgenciaArmaKey))return false; + TarmAgenciaArmaKey that = (TarmAgenciaArmaKey) o; + if (this.getCarma() == null || that.getCarma() == null){ + return false; + } + if (! this.getCarma().equals(that.getCarma())){ + return false; + } + if (this.getCagencia() == null || that.getCagencia() == null){ + return false; + } + if (! this.getCagencia().equals(that.getCagencia())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmAgenciaArmaKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCarma() == null ? 0 : this.getCarma().hashCode()); + result = result * 37 + (this.getCagencia() == null ? 0 : this.getCagencia().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmAgenciaSucursal.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmAgenciaSucursal.java new file mode 100644 index 0000000..7e93bf2 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmAgenciaSucursal.java @@ -0,0 +1,426 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import java.util.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMAGENCIASUCURSAL*/ +@Entity(name="TarmAgenciaSucursal") +@Table(name="TARMAGENCIASUCURSAL") +public class TarmAgenciaSucursal extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmAgenciaSucursal +*/ +@Id +@Column(name="CAGENCIA" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CAGENCIA"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.Long"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "16")}) + @GeneratedValue(generator = "seq_id") +private Long pk; +@Column(name="COUNTRYCODE", nullable=true) + +/** +* Codigo de pais +*/ +private String countrycode; + +@Column(name="PROVINCECODE", nullable=true) + +/** +* Codigo de provincia +*/ +private String provincecode; + +@Column(name="CANTONCODE", nullable=true) + +/** +* Codigo de canton +*/ +private String cantoncode; + +@Column(name="PARROQUIACODE", nullable=true) + +/** +* Codigo de parroquia +*/ +private String parroquiacode; + +@Column(name="CITYCODE", nullable=true) + +/** +* Codigo de cuidad +*/ +private String citycode; + +@Column(name="TIPO", nullable=true) + +/** +* Tipo de agencia o sucursal +*/ +private String tipo; + +@Column(name="TIPOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo +*/ +private String tipocodigo; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de la empresa a la que pertenece la sucursal +*/ +private Integer personcode; + +@Column(name="DIRECCION", nullable=true) + +/** +* Ubicacion en donde se encuentra localizada la agencia +*/ +private String direccion; + +@Column(name="TELEFONO", nullable=true) + +/** +* Numero telefonico de la agencia +*/ +private String telefono; + +@Column(name="CORREO", nullable=true) + +/** +* Correo electronico de contacto para la agencia +*/ +private String correo; + +@Column(name="RESPONSABLE", nullable=true) + +/** +* Responsable encargado de la agencia +*/ +private String responsable; + +@Column(name="ESTADO", nullable=true) + +/** +* null +*/ +private String estado; + +@Column(name="ESTADOCODIGO", nullable=true) + +/** +* null +*/ +private String estadocodigo; + +@Column(name="FAUTORIZACION", nullable=true) + +/** +* null +*/ +private Date fautorizacion; + +@Column(name="NOMBRE", nullable=true) + +/** +* null +*/ +private String nombre; + +/**Contructor por defecto*/ +public TarmAgenciaSucursal(){ +} +/**Contructor de TarmAgenciaSucursal +@param pPk Clave Primaria del entity +*/ +public TarmAgenciaSucursal(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmAgenciaSucursal +*/ +public static TarmAgenciaSucursal find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmAgenciaSucursal obj = pEntityManager.find(TarmAgenciaSucursal.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmAgenciaSucursal +@return El objeto que referencia a la Clave primaria de TarmAgenciaSucursal +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmAgenciaSucursal +@param pPk El objeto que referencia a la nueva Clave primaria de TarmAgenciaSucursal +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de countrycode +@return valor de countrycode*/ +public String getCountrycode(){ + return countrycode; +} +/**Fija el valor de countrycode +@param pCountrycode nuevo Valor de countrycode*/ +public void setCountrycode(String pCountrycode){ + countrycode=pCountrycode; +} + +/**Obtiene el valor de provincecode +@return valor de provincecode*/ +public String getProvincecode(){ + return provincecode; +} +/**Fija el valor de provincecode +@param pProvincecode nuevo Valor de provincecode*/ +public void setProvincecode(String pProvincecode){ + provincecode=pProvincecode; +} + +/**Obtiene el valor de cantoncode +@return valor de cantoncode*/ +public String getCantoncode(){ + return cantoncode; +} +/**Fija el valor de cantoncode +@param pCantoncode nuevo Valor de cantoncode*/ +public void setCantoncode(String pCantoncode){ + cantoncode=pCantoncode; +} + +/**Obtiene el valor de parroquiacode +@return valor de parroquiacode*/ +public String getParroquiacode(){ + return parroquiacode; +} +/**Fija el valor de parroquiacode +@param pParroquiacode nuevo Valor de parroquiacode*/ +public void setParroquiacode(String pParroquiacode){ + parroquiacode=pParroquiacode; +} + +/**Obtiene el valor de citycode +@return valor de citycode*/ +public String getCitycode(){ + return citycode; +} +/**Fija el valor de citycode +@param pCitycode nuevo Valor de citycode*/ +public void setCitycode(String pCitycode){ + citycode=pCitycode; +} + +/**Obtiene el valor de tipo +@return valor de tipo*/ +public String getTipo(){ + return tipo; +} +/**Fija el valor de tipo +@param pTipo nuevo Valor de tipo*/ +public void setTipo(String pTipo){ + tipo=pTipo; +} + +/**Obtiene el valor de tipocodigo +@return valor de tipocodigo*/ +public String getTipocodigo(){ + return tipocodigo; +} +/**Fija el valor de tipocodigo +@param pTipocodigo nuevo Valor de tipocodigo*/ +public void setTipocodigo(String pTipocodigo){ + tipocodigo=pTipocodigo; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de direccion +@return valor de direccion*/ +public String getDireccion(){ + return direccion; +} +/**Fija el valor de direccion +@param pDireccion nuevo Valor de direccion*/ +public void setDireccion(String pDireccion){ + direccion=pDireccion; +} + +/**Obtiene el valor de telefono +@return valor de telefono*/ +public String getTelefono(){ + return telefono; +} +/**Fija el valor de telefono +@param pTelefono nuevo Valor de telefono*/ +public void setTelefono(String pTelefono){ + telefono=pTelefono; +} + +/**Obtiene el valor de correo +@return valor de correo*/ +public String getCorreo(){ + return correo; +} +/**Fija el valor de correo +@param pCorreo nuevo Valor de correo*/ +public void setCorreo(String pCorreo){ + correo=pCorreo; +} + +/**Obtiene el valor de responsable +@return valor de responsable*/ +public String getResponsable(){ + return responsable; +} +/**Fija el valor de responsable +@param pResponsable nuevo Valor de responsable*/ +public void setResponsable(String pResponsable){ + responsable=pResponsable; +} + +/**Obtiene el valor de estado +@return valor de estado*/ +public String getEstado(){ + return estado; +} +/**Fija el valor de estado +@param pEstado nuevo Valor de estado*/ +public void setEstado(String pEstado){ + estado=pEstado; +} + +/**Obtiene el valor de estadocodigo +@return valor de estadocodigo*/ +public String getEstadocodigo(){ + return estadocodigo; +} +/**Fija el valor de estadocodigo +@param pEstadocodigo nuevo Valor de estadocodigo*/ +public void setEstadocodigo(String pEstadocodigo){ + estadocodigo=pEstadocodigo; +} + +/**Obtiene el valor de fautorizacion +@return valor de fautorizacion*/ +public Date getFautorizacion(){ + return fautorizacion; +} +/**Fija el valor de fautorizacion +@param pFautorizacion nuevo Valor de fautorizacion*/ +public void setFautorizacion(Date pFautorizacion){ + fautorizacion=pFautorizacion; +} + +/**Obtiene el valor de nombre +@return valor de nombre*/ +public String getNombre(){ + return nombre; +} +/**Fija el valor de nombre +@param pNombre nuevo Valor de nombre*/ +public void setNombre(String pNombre){ + nombre=pNombre; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmAgenciaSucursal))return false; + TarmAgenciaSucursal that = (TarmAgenciaSucursal) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmAgenciaSucursal +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmAgenciaSucursal +*/ +public Object createInstance(){ + TarmAgenciaSucursal instance=new TarmAgenciaSucursal(); + return instance; +} +/**Clona la entidad TarmAgenciaSucursal +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmAgenciaSucursal p=(TarmAgenciaSucursal)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmArmaPruebas.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmArmaPruebas.java new file mode 100644 index 0000000..1c3059a --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmArmaPruebas.java @@ -0,0 +1,498 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMARMAPRUEBAS + */ +@Entity(name = "TarmArmaPruebas") +@Table(name = "TARMARMAPRUEBAS") +public class TarmArmaPruebas extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TarmArmaPruebas + */ + @Id + @Column(name = "CARMAPRUEBA", nullable = false, updatable = false) + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CARMAPRUEBA"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.Long"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "16")}) + @GeneratedValue(generator = "seq_id") + private Long pk; + @Column(name = "CSOLICITUD", nullable = true) + + /** + * Codigo de solicitud de controld e armas + */ + private String csolicitud; + + @Column(name = "PERSONCODE", nullable = true) + + /** + * Codigo de persona + */ + private Integer personcode; + + @Column(name = "CARMA", nullable = true) + + /** + * null + */ + private String carma; + + @Column(name = "OBSERVACION", nullable = true) + + /** + * null + */ + private String observacion; + + @Column(name = "XPATHIMPRONTA", nullable = true) + + /** + * null + */ + private String xpathimpronta; + + @Column(name = "XPATHFOTOGRAFIA", nullable = true) + + /** + * null + */ + private String xpathfotografia; + + @Column(name = "APTITUDDISPARO", nullable = true) + + /** + * null + */ + private String aptituddisparo; + + @Column(name = "XPATHFICHATECARMAS", nullable = true) + + /** + * null + */ + private String xpathfichatecarmas; + + @Column(name = "BALASTESTIGO", nullable = true) + + /** + * null + */ + private String balastestigo; + + @Column(name = "TUBOCANION", nullable = true) + + /** + * null + */ + private String tubocanion; + + @Column(name = "APRUEBAEVALUACION", nullable = true) + + /** + * null + */ + private String apruebaevaluacion; + + @Column(name = "VAINASTESTIGO", nullable = true) + + /** + * null + */ + private String vainastestigo; + + @Column(name = "IMAGENIMPRONTA", unique = false, nullable = false, length = 100000) + + /** + * null + */ + private byte[] imagenimpronta; + + @Column(name = "IMAGENFOTOGRAFIA", unique = false, nullable = false, length = 100000) + + /** + * null + */ + private byte[] imagenfotografia; + + @Column(name = "ISIMPRESO", nullable = true) + + /** + * null + */ + private String isimpreso; + + /** + * Contructor por defecto + */ + public TarmArmaPruebas() { + } + + /** + * Contructor de TarmArmaPruebas + * + * @param pPk Clave Primaria del entity + */ + public TarmArmaPruebas(Long pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TarmArmaPruebas + */ + public static TarmArmaPruebas find(EntityManager pEntityManager, Object pKey) throws Exception { + TarmArmaPruebas obj = pEntityManager.find(TarmArmaPruebas.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TarmArmaPruebas + * + * @return El objeto que referencia a la Clave primaria de TarmArmaPruebas + */ + public Long getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TarmArmaPruebas + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TarmArmaPruebas + */ + public void setPk(Long pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de csolicitud + * + * @return valor de csolicitud + */ + public String getCsolicitud() { + return csolicitud; + } + + /** + * Fija el valor de csolicitud + * + * @param pCsolicitud nuevo Valor de csolicitud + */ + public void setCsolicitud(String pCsolicitud) { + csolicitud = pCsolicitud; + } + + /** + * Obtiene el valor de personcode + * + * @return valor de personcode + */ + public Integer getPersoncode() { + return personcode; + } + + /** + * Fija el valor de personcode + * + * @param pPersoncode nuevo Valor de personcode + */ + public void setPersoncode(Integer pPersoncode) { + personcode = pPersoncode; + } + + /** + * Obtiene el valor de carma + * + * @return valor de carma + */ + public String getCarma() { + return carma; + } + + /** + * Fija el valor de carma + * + * @param pCarma nuevo Valor de carma + */ + public void setCarma(String pCarma) { + carma = pCarma; + } + + /** + * Obtiene el valor de observacion + * + * @return valor de observacion + */ + public String getObservacion() { + return observacion; + } + + /** + * Fija el valor de observacion + * + * @param pObservacion nuevo Valor de observacion + */ + public void setObservacion(String pObservacion) { + observacion = pObservacion; + } + + /** + * Obtiene el valor de xpathimpronta + * + * @return valor de xpathimpronta + */ + public String getXpathimpronta() { + return xpathimpronta; + } + + /** + * Fija el valor de xpathimpronta + * + * @param pXpathimpronta nuevo Valor de xpathimpronta + */ + public void setXpathimpronta(String pXpathimpronta) { + xpathimpronta = pXpathimpronta; + } + + /** + * Obtiene el valor de xpathfotografia + * + * @return valor de xpathfotografia + */ + public String getXpathfotografia() { + return xpathfotografia; + } + + /** + * Fija el valor de xpathfotografia + * + * @param pXpathfotografia nuevo Valor de xpathfotografia + */ + public void setXpathfotografia(String pXpathfotografia) { + xpathfotografia = pXpathfotografia; + } + + public String getXpathfichatecarmas() { + return xpathfichatecarmas; + } + + public void setXpathfichatecarmas(String xpathfichatecarmas) { + this.xpathfichatecarmas = xpathfichatecarmas; + } + + /** + * Obtiene el valor de aptituddisparo + * + * @return valor de aptituddisparo + */ + public String getAptituddisparo() { + return aptituddisparo; + } + + /** + * Fija el valor de aptituddisparo + * + * @param pAptituddisparo nuevo Valor de aptituddisparo + */ + public void setAptituddisparo(String pAptituddisparo) { + aptituddisparo = pAptituddisparo; + } + + /** + * Obtiene el valor de balastestigo + * + * @return valor de balastestigo + */ + public String getBalastestigo() { + return balastestigo; + } + + /** + * Fija el valor de balastestigo + * + * @param pBalastestigo nuevo Valor de balastestigo + */ + public void setBalastestigo(String pBalastestigo) { + balastestigo = pBalastestigo; + } + + /** + * Obtiene el valor de vainastestigo + * + * @return valor de vainastestigo + */ + public String getVainastestigo() { + return vainastestigo; + } + + /** + * Fija el valor de vainastestigo + * + * @param pVainastestigo nuevo Valor de vainastestigo + */ + public void setVainastestigo(String pVainastestigo) { + vainastestigo = pVainastestigo; + } + + /** + * Obtiene el valor de apruebaevaluacion + * + * @return valor de apruebaevaluacion + */ + public String getApruebaevaluacion() { + return apruebaevaluacion; + } + + /** + * Fija el valor de apruebaevaluacion + * + * @param pApruebaevaluacion nuevo Valor de apruebaevaluacion + */ + public void setApruebaevaluacion(String pApruebaevaluacion) { + apruebaevaluacion = pApruebaevaluacion; + } + + public byte[] getImagenimpronta() { + return imagenimpronta; + } + + public void setImagenimpronta(byte[] imagenimpronta) { + this.imagenimpronta = imagenimpronta; + } + + public byte[] getImagenfotografia() { + return imagenfotografia; + } + + public void setImagenfotografia(byte[] imagenfotografia) { + this.imagenfotografia = imagenfotografia; + } + + public String getIsimpreso() { + return isimpreso; + } + + public void setIsimpreso(String isimpreso) { + this.isimpreso = isimpreso; + } + + public String getTubocanion() { + return tubocanion; + } + + public void setTubocanion(String tubocanion) { + this.tubocanion = tubocanion; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TarmArmaPruebas)) { + return false; + } + TarmArmaPruebas that = (TarmArmaPruebas) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TarmArmaPruebas + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacion toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacion de la creacion de un bean en blanco TarmArmaPruebas + */ + public Object createInstance() { + TarmArmaPruebas instance = new TarmArmaPruebas(); + return instance; + } + + /** + * Clona la entidad TarmArmaPruebas + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TarmArmaPruebas p = (TarmArmaPruebas) this.clone(); + return p; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmArmas.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmArmas.java new file mode 100644 index 0000000..dc6b80d --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmArmas.java @@ -0,0 +1,1062 @@ +package com.fp.persistence.parmas.soli; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMARMAS + */ +@Entity(name = "TarmArmas") +@Table(name = "TARMARMAS") +public class TarmArmas extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TarmArmas + */ + @Id + @Column(name = "CARMA", nullable = false, updatable = false) + private String pk; + @Column(name = "MARCA", nullable = true) + + /** + * null + */ + private String marca; + + @Column(name = "MARCACODIGO", nullable = true) + + /** + * null + */ + private String marcacodigo; + + @Column(name = "PARTIDAARANCELARIA", nullable = true) + + /** + * Partida arancelaria + */ + private String partidaarancelaria; + + @Column(name = "PARTIDAARANCELARIACODIGO", nullable = true) + + /** + * Partida arancelaria codigo + */ + private String partidaarancelariacodigo; + + @Column(name = "TIPOFABRICACION", nullable = true) + + /** + * null + */ + private String tipofabricacion; + + @Column(name = "TIPOFABRICACIONCODIGO", nullable = true) + + /** + * null + */ + private String tipofabricacioncodigo; + + @Column(name = "COLOR", nullable = true) + + /** + * null + */ + private String color; + + @Column(name = "COLORCODIGO", nullable = true) + + /** + * null + */ + private String colorcodigo; + + @Column(name = "CPAISORIGEN", nullable = true) + + /** + * null + */ + private String cpaisorigen; + + @Column(name = "UNIDADMEDIDACANTIDAD", nullable = true) + + /** + * null + */ + private String unidadmedidacantidad; + + @Column(name = "UNIDADMEDIDACANTIDADCODIGO", nullable = true) + + /** + * null + */ + private String unidadmedidacantidadcodigo; + + @Column(name = "ESTADO", nullable = true) + + /** + * null + */ + private String estado; + + @Column(name = "ESTADOCODIGO", nullable = true) + + /** + * null + */ + private String estadocodigo; + + @Column(name = "COUNTRYCODE", nullable = true) + + /** + * null + */ + private String countrycode; + + @Column(name = "PROVINCECODE", nullable = true) + + /** + * null + */ + private String provincecode; + + @Column(name = "CANTONCODE", nullable = true) + + /** + * null + */ + private String cantoncode; + + @Column(name = "PARROQUIACODE", nullable = true) + + /** + * null + */ + private String parroquiacode; + + @Column(name = "CREGISTRO", nullable = true) + + /** + * null + */ + private Long cregistro; + + @Column(name = "CITYCODE", nullable = true) + + /** + * null + */ + private String citycode; + + @Column(name = "LOTE", nullable = true) + + /** + * null + */ + private String lote; + + @Column(name = "CANTIDAD", nullable = true) + + /** + * null + */ + private Integer cantidad; + + @Column(name = "PESO", nullable = true) + + /** + * null + */ + private BigDecimal peso; + + @Column(name = "MODELO", nullable = true) + + /** + * null + */ + private String modelo; + + @Column(name = "SERIECANON", nullable = true) + + /** + * null + */ + private String seriecanon; + + @Column(name = "FEMISIONPERMISO", nullable = true) + + /** + * null + */ + private Date femisionpermiso; + + @Column(name = "DIRECCION", nullable = true) + + /** + * null + */ + private String direccion; + + @Column(name = "NEMONICOARMA", nullable = true) + + /** + * null + */ + private String nemonicoarma; + + @Column(name = "FECHAREGISTRO", nullable = true) + + /** + * null + */ + private Date fecharegistro; + + @Column(name = "RECORDVERSION", nullable = true) + + /** + * null + */ + private Integer recordversion; + + @Column(name = "CTIPOARMAEXPLOSIVO", nullable = true) + + /** + * null + */ + private String ctipoarmaexplosivo; + + @Column(name = "CODIGOARMA", nullable = true) + + /** + * Codigo identificador de arma + */ + private String codigoarma; + + @Column(name = "FDESADUANIZACION", nullable = true) + + /** + * null + */ + private Date fdesaduanizacion; + + @Column(name = "ESTADODECOMISO", nullable = true) + + /** + * null + */ + private String estadoDecomiso; + + @Column(name = "ESTADOVENTA", nullable = true) + + /** + * null + */ + private String estadoventa; + + @Column(name = "PATHDOCUMENTO", nullable = true) + + private String pathDocumento; + + /** + * valor auxiliar + * + */ + @Transient + private int valorAux; + + /** + * valor auxiliar + * + */ + @Transient + private BigDecimal pesoAux; + + @Column(name = "FECHACADUCIDAD", nullable = true) + + /** + * fecha de caducidad del documento habilitante + */ + private Date fechacaducidad; + + @Column(name = "PATHDOCUMENTOCREAR", nullable = true) + private String pathDocumentocrear; + + @Column(name = "GENERACERTIFICADO", nullable = true) + private String generacertificado; + + public int getValorAux() { + return valorAux; + } + + public void setValorAux(int valorAux) { + this.valorAux = valorAux; + } + + public BigDecimal getPesoAux() { + return pesoAux; + } + + public void setPesoAux(BigDecimal pesoAux) { + this.pesoAux = pesoAux; + } + + /** + * Contructor por defecto + */ + public TarmArmas() { + } + + /** + * Contructor de TarmArmas + * + * @param pPk Clave Primaria del entity + */ + public TarmArmas(String pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TarmArmas + */ + public static TarmArmas find(EntityManager pEntityManager, Object pKey) throws Exception { + TarmArmas obj = pEntityManager.find(TarmArmas.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TarmArmas + * + * @return El objeto que referencia a la Clave primaria de TarmArmas + */ + public String getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TarmArmas + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TarmArmas + */ + public void setPk(String pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de marca + * + * @return valor de marca + */ + public String getMarca() { + return marca; + } + + /** + * Fija el valor de marca + * + * @param pMarca nuevo Valor de marca + */ + public void setMarca(String pMarca) { + marca = pMarca; + } + + /** + * Obtiene el valor de marcacodigo + * + * @return valor de marcacodigo + */ + public String getMarcacodigo() { + return marcacodigo; + } + + /** + * Fija el valor de marcacodigo + * + * @param pMarcacodigo nuevo Valor de marcacodigo + */ + public void setMarcacodigo(String pMarcacodigo) { + marcacodigo = pMarcacodigo; + } + + /** + * Obtiene el valor de tipofabricacion + * + * @return valor de tipofabricacion + */ + public String getTipofabricacion() { + return tipofabricacion; + } + + /** + * Fija el valor de tipofabricacion + * + * @param pTipofabricacion nuevo Valor de tipofabricacion + */ + public void setTipofabricacion(String pTipofabricacion) { + tipofabricacion = pTipofabricacion; + } + + /** + * Obtiene el valor de tipofabricacioncodigo + * + * @return valor de tipofabricacioncodigo + */ + public String getTipofabricacioncodigo() { + return tipofabricacioncodigo; + } + + /** + * Fija el valor de tipofabricacioncodigo + * + * @param pTipofabricacioncodigo nuevo Valor de tipofabricacioncodigo + */ + public void setTipofabricacioncodigo(String pTipofabricacioncodigo) { + tipofabricacioncodigo = pTipofabricacioncodigo; + } + + /** + * Obtiene el valor de color + * + * @return valor de color + */ + public String getColor() { + return color; + } + + /** + * Fija el valor de color + * + * @param pColor nuevo Valor de color + */ + public void setColor(String pColor) { + color = pColor; + } + + /** + * Obtiene el valor de colorcodigo + * + * @return valor de colorcodigo + */ + public String getColorcodigo() { + return colorcodigo; + } + + /** + * Fija el valor de colorcodigo + * + * @param pColorcodigo nuevo Valor de colorcodigo + */ + public void setColorcodigo(String pColorcodigo) { + colorcodigo = pColorcodigo; + } + + /** + * Obtiene el valor de cpaisorigen + * + * @return valor de cpaisorigen + */ + public String getCpaisorigen() { + return cpaisorigen; + } + + /** + * Fija el valor de cpaisorigen + * + * @param pCpaisorigen nuevo Valor de cpaisorigen + */ + public void setCpaisorigen(String pCpaisorigen) { + cpaisorigen = pCpaisorigen; + } + + /** + * Obtiene el valor de unidadmedidacantidad + * + * @return valor de unidadmedidacantidad + */ + public String getUnidadmedidacantidad() { + return unidadmedidacantidad; + } + + /** + * Fija el valor de unidadmedidacantidad + * + * @param pUnidadmedidacantidad nuevo Valor de unidadmedidacantidad + */ + public void setUnidadmedidacantidad(String pUnidadmedidacantidad) { + unidadmedidacantidad = pUnidadmedidacantidad; + } + + /** + * Obtiene el valor de unidadmedidacantidadcodigo + * + * @return valor de unidadmedidacantidadcodigo + */ + public String getUnidadmedidacantidadcodigo() { + return unidadmedidacantidadcodigo; + } + + /** + * Fija el valor de unidadmedidacantidadcodigo + * + * @param pUnidadmedidacantidadcodigo nuevo Valor de unidadmedidacantidadcodigo + */ + public void setUnidadmedidacantidadcodigo(String pUnidadmedidacantidadcodigo) { + unidadmedidacantidadcodigo = pUnidadmedidacantidadcodigo; + } + + /** + * Obtiene el valor de estado + * + * @return valor de estado + */ + public String getEstado() { + return estado; + } + + /** + * Fija el valor de estado + * + * @param pEstado nuevo Valor de estado + */ + public void setEstado(String pEstado) { + estado = pEstado; + } + + /** + * Obtiene el valor de estadocodigo + * + * @return valor de estadocodigo + */ + public String getEstadocodigo() { + return estadocodigo; + } + + /** + * Fija el valor de estadocodigo + * + * @param pEstadocodigo nuevo Valor de estadocodigo + */ + public void setEstadocodigo(String pEstadocodigo) { + estadocodigo = pEstadocodigo; + } + + /** + * Obtiene el valor de countrycode + * + * @return valor de countrycode + */ + public String getCountrycode() { + return countrycode; + } + + /** + * Fija el valor de countrycode + * + * @param pCountrycode nuevo Valor de countrycode + */ + public void setCountrycode(String pCountrycode) { + countrycode = pCountrycode; + } + + /** + * Obtiene el valor de provincecode + * + * @return valor de provincecode + */ + public String getProvincecode() { + return provincecode; + } + + /** + * Fija el valor de provincecode + * + * @param pProvincecode nuevo Valor de provincecode + */ + public void setProvincecode(String pProvincecode) { + provincecode = pProvincecode; + } + + /** + * Obtiene el valor de cantoncode + * + * @return valor de cantoncode + */ + public String getCantoncode() { + return cantoncode; + } + + /** + * Fija el valor de cantoncode + * + * @param pCantoncode nuevo Valor de cantoncode + */ + public void setCantoncode(String pCantoncode) { + cantoncode = pCantoncode; + } + + /** + * Obtiene el valor de parroquiacode + * + * @return valor de parroquiacode + */ + public String getParroquiacode() { + return parroquiacode; + } + + /** + * Fija el valor de parroquiacode + * + * @param pParroquiacode nuevo Valor de parroquiacode + */ + public void setParroquiacode(String pParroquiacode) { + parroquiacode = pParroquiacode; + } + + /** + * Obtiene el valor de cregistro + * + * @return valor de cregistro + */ + public Long getCregistro() { + return cregistro; + } + + /** + * Fija el valor de cregistro + * + * @param pCregistro nuevo Valor de cregistro + */ + public void setCregistro(Long pCregistro) { + cregistro = pCregistro; + } + + /** + * Obtiene el valor de citycode + * + * @return valor de citycode + */ + public String getCitycode() { + return citycode; + } + + /** + * Fija el valor de citycode + * + * @param pCitycode nuevo Valor de citycode + */ + public void setCitycode(String pCitycode) { + citycode = pCitycode; + } + + /** + * Obtiene el valor de lote + * + * @return valor de lote + */ + public String getLote() { + return lote; + } + + /** + * Fija el valor de lote + * + * @param pLote nuevo Valor de lote + */ + public void setLote(String pLote) { + lote = pLote; + } + + /** + * Obtiene el valor de cantidad + * + * @return valor de cantidad + */ + public Integer getCantidad() { + return cantidad; + } + + /** + * Fija el valor de cantidad + * + * @param pCantidad nuevo Valor de cantidad + */ + public void setCantidad(Integer pCantidad) { + cantidad = pCantidad; + } + + /** + * Obtiene el valor de peso + * + * @return valor de peso + */ + public BigDecimal getPeso() { + return peso; + } + + /** + * Fija el valor de peso + * + * @param pPeso nuevo Valor de peso + */ + public void setPeso(BigDecimal pPeso) { + peso = pPeso; + } + + /** + * Obtiene el valor de modelo + * + * @return valor de modelo + */ + public String getModelo() { + return modelo; + } + + /** + * Fija el valor de modelo + * + * @param pModelo nuevo Valor de modelo + */ + public void setModelo(String pModelo) { + modelo = pModelo; + } + + /** + * Obtiene el valor de seriecanon + * + * @return valor de seriecanon + */ + public String getSeriecanon() { + return seriecanon; + } + + /** + * Fija el valor de seriecanon + * + * @param pSeriecanon nuevo Valor de seriecanon + */ + public void setSeriecanon(String pSeriecanon) { + seriecanon = pSeriecanon; + } + + /** + * Obtiene el valor de femisionpermiso + * + * @return valor de femisionpermiso + */ + public Date getFemisionpermiso() { + return femisionpermiso; + } + + /** + * Fija el valor de femisionpermiso + * + * @param pFemisionpermiso nuevo Valor de femisionpermiso + */ + public void setFemisionpermiso(Date pFemisionpermiso) { + femisionpermiso = pFemisionpermiso; + } + + /** + * Obtiene el valor de direccion + * + * @return valor de direccion + */ + public String getDireccion() { + return direccion; + } + + /** + * Fija el valor de direccion + * + * @param pDireccion nuevo Valor de direccion + */ + public void setDireccion(String pDireccion) { + direccion = pDireccion; + } + + /** + * Obtiene el valor de nemonicoarma + * + * @return valor de nemonicoarma + */ + public String getNemonicoarma() { + return nemonicoarma; + } + + /** + * Fija el valor de nemonicoarma + * + * @param pNemonicoarma nuevo Valor de nemonicoarma + */ + public void setNemonicoarma(String pNemonicoarma) { + nemonicoarma = pNemonicoarma; + } + + /** + * Obtiene el valor de fecharegistro + * + * @return valor de fecharegistro + */ + public Date getFecharegistro() { + return fecharegistro; + } + + /** + * Fija el valor de fecharegistro + * + * @param pFecharegistro nuevo Valor de fecharegistro + */ + public void setFecharegistro(Date pFecharegistro) { + fecharegistro = pFecharegistro; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de ctipoarmaexplosivo + * + * @return valor de ctipoarmaexplosivo + */ + public String getCtipoarmaexplosivo() { + return ctipoarmaexplosivo; + } + + /** + * Fija el valor de ctipoarmaexplosivo + * + * @param pCtipoarmaexplosivo nuevo Valor de ctipoarmaexplosivo + */ + public void setCtipoarmaexplosivo(String pCtipoarmaexplosivo) { + ctipoarmaexplosivo = pCtipoarmaexplosivo; + } + + /** + * Obtiene el valor de codigoarma + * + * @return valor de codigoarma + */ + public String getCodigoarma() { + return codigoarma; + } + + /** + * Fija el valor de codigoarma + * + * @param pCodigoarma nuevo Valor de codigoarma + */ + public void setCodigoarma(String pCodigoarma) { + codigoarma = pCodigoarma; + } + + /** + * Obtiene el valor de fdesaduanizacion + * + * @return valor de fdesaduanizacion + */ + public Date getFdesaduanizacion() { + return fdesaduanizacion; + } + + /** + * Fija el valor de fdesaduanizacion + * + * @param pCodigoarma nuevo Valor de fdesaduanizacion + */ + public void setFdesaduanizacion(Date fdesaduanizacion) { + this.fdesaduanizacion = fdesaduanizacion; + } + + /** + * Obtiene el valor de fechacaducidad + * + * @return valor de fechacaducidad + */ + public Date getFechacaducidad() { + return fechacaducidad; + } + + /** + * Fija el valor de fechacaducidad + * + * @param pFechacaducidad nuevo Valor de fechacaducidad + */ + public void setFechacaducidad(Date pFechacaducidad) { + fechacaducidad = pFechacaducidad; + } + + public String getPartidaarancelaria() { + return partidaarancelaria; + } + + public void setPartidaarancelaria(String partidaarancelaria) { + this.partidaarancelaria = partidaarancelaria; + } + + public String getPartidaarancelariacodigo() { + return partidaarancelariacodigo; + } + + public void setPartidaarancelariacodigo(String partidaarancelariacodigo) { + this.partidaarancelariacodigo = partidaarancelariacodigo; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TarmArmas)) { + return false; + } + TarmArmas that = (TarmArmas) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TarmArmas + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacion toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacion de la creacion de un bean en blanco TarmArmas + */ + public Object createInstance() { + TarmArmas instance = new TarmArmas(); + return instance; + } + + /** + * Clona la entidad TarmArmas + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TarmArmas p = (TarmArmas) this.clone(); + return p; + } + + public String getEstadoDecomiso() { + return estadoDecomiso; + } + + public void setEstadoDecomiso(String estadoDecomiso) { + this.estadoDecomiso = estadoDecomiso; + } + + public String getEstadoventa() { + return estadoventa; + } + + public void setEstadoventa(String estadoventa) { + this.estadoventa = estadoventa; + } + + public String getPathDocumento() { + return pathDocumento; + } + + public void setPathDocumento(String pathDocumento) { + this.pathDocumento = pathDocumento; + } + + public String getPathDocumentocrear() { + return pathDocumentocrear; + } + + public void setPathDocumentocrear(String pathDocumentocrear) { + this.pathDocumentocrear = pathDocumentocrear; + } + + public String getGeneracertificado() { + return generacertificado; + } + + public void setGeneracertificado(String generacertificado) { + this.generacertificado = generacertificado; + } + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmBodega.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmBodega.java new file mode 100644 index 0000000..3d167b9 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmBodega.java @@ -0,0 +1,159 @@ +package com.fp.persistence.parmas.soli; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMBODEGA*/ +@Entity(name="TarmBodega") +@Table(name="TARMBODEGA") +public class TarmBodega extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmBodega +*/ +@Id +@Column(name="CBODEGA" ,nullable=false, updatable=false) +private Long pk; +@Column(name="CARMA", nullable=true) + +/** +* codigo del arma +*/ +private String carma; + +@Column(name="CCENTROCONTROL", nullable=true) + +/** +* Codigo de centro de control de armas,codigo de la bodega donde se encuentra el arma +*/ +private String ccentrocontrol; + +/**Contructor por defecto*/ +public TarmBodega(){ +} +/**Contructor de TarmBodega +@param pPk Clave Primaria del entity +*/ +public TarmBodega(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmBodega +*/ +public static TarmBodega find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmBodega obj = pEntityManager.find(TarmBodega.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmBodega +@return El objeto que referencia a la Clave primaria de TarmBodega +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmBodega +@param pPk El objeto que referencia a la nueva Clave primaria de TarmBodega +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de ccentrocontrol +@return valor de ccentrocontrol*/ +public String getCcentrocontrol(){ + return ccentrocontrol; +} +/**Fija el valor de ccentrocontrol +@param pCcentrocontrol nuevo Valor de ccentrocontrol*/ +public void setCcentrocontrol(String pCcentrocontrol){ + ccentrocontrol=pCcentrocontrol; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmBodega))return false; + TarmBodega that = (TarmBodega) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmBodega +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmBodega +*/ +public Object createInstance(){ + TarmBodega instance=new TarmBodega(); + return instance; +} +/**Clona la entidad TarmBodega +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmBodega p=(TarmBodega)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmCabRepDestruirArmas.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmCabRepDestruirArmas.java new file mode 100644 index 0000000..e549758 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmCabRepDestruirArmas.java @@ -0,0 +1,200 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMCABREPDESTRUIRARMAS*/ +@Entity(name="TarmCabRepDestruirArmas") +@Table(name="TARMCABREPDESTRUIRARMAS") +public class TarmCabRepDestruirArmas extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmCabRepDestruirArmas +*/ +@Id +@Column(name="CREPORTE" ,nullable=false, updatable=false) +private Integer pk; +@Column(name="FREPORTE", nullable=true) + +/** +* Fecha de generacion del reporte +*/ +private Date freporte; + +@Column(name="OBSJEFEDPTO", nullable=true) + +/** +* OBSERVACIONES GENERADAS POR EL JEFE DE DPTO +*/ +private String obsjefedpto; + +@Column(name="OBSJEFECC", nullable=true) + +/** +* OBSERVACIONES GENERADAS POR EL JEFE DEL COMANDO CONJUNTO +*/ +private String obsjefecc; + +@Column(name="XPATH", nullable=true) + +/** +* null +*/ +private String xpath; + +/**Contructor por defecto*/ +public TarmCabRepDestruirArmas(){ +} +/**Contructor de TarmCabRepDestruirArmas +@param pPk Clave Primaria del entity +*/ +public TarmCabRepDestruirArmas(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmCabRepDestruirArmas +*/ +public static TarmCabRepDestruirArmas find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmCabRepDestruirArmas obj = pEntityManager.find(TarmCabRepDestruirArmas.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmCabRepDestruirArmas +@return El objeto que referencia a la Clave primaria de TarmCabRepDestruirArmas +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmCabRepDestruirArmas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmCabRepDestruirArmas +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de freporte +@return valor de freporte*/ +public Date getFreporte(){ + return freporte; +} +/**Fija el valor de freporte +@param pFreporte nuevo Valor de freporte*/ +public void setFreporte(Date pFreporte){ + freporte=pFreporte; +} + +/**Obtiene el valor de obsjefedpto +@return valor de obsjefedpto*/ +public String getObsjefedpto(){ + return obsjefedpto; +} +/**Fija el valor de obsjefedpto +@param pObsjefedpto nuevo Valor de obsjefedpto*/ +public void setObsjefedpto(String pObsjefedpto){ + obsjefedpto=pObsjefedpto; +} + +/**Obtiene el valor de obsjefecc +@return valor de obsjefecc*/ +public String getObsjefecc(){ + return obsjefecc; +} +/**Fija el valor de obsjefecc +@param pObsjefecc nuevo Valor de obsjefecc*/ +public void setObsjefecc(String pObsjefecc){ + obsjefecc=pObsjefecc; +} + +/**Obtiene el valor de xpath +@return valor de xpath*/ +public String getXpath(){ + return xpath; +} +/**Fija el valor de xpath +@param pXpath nuevo Valor de xpath*/ +public void setXpath(String pXpath){ + xpath=pXpath; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmCabRepDestruirArmas))return false; + TarmCabRepDestruirArmas that = (TarmCabRepDestruirArmas) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmCabRepDestruirArmas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmCabRepDestruirArmas +*/ +public Object createInstance(){ + TarmCabRepDestruirArmas instance=new TarmCabRepDestruirArmas(); + return instance; +} +/**Clona la entidad TarmCabRepDestruirArmas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmCabRepDestruirArmas p=(TarmCabRepDestruirArmas)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmCertificadoArmas.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmCertificadoArmas.java new file mode 100644 index 0000000..1c387fa --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmCertificadoArmas.java @@ -0,0 +1,393 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMCERTIFICADOARMAS*/ +@Entity(name="TarmCertificadoArmas") +@Table(name="TARMCERTIFICADOARMAS") +public class TarmCertificadoArmas extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmCertificadoArmas +*/ +@EmbeddedId +private TarmCertificadoArmasKey pk; +@Column(name="LOTE", nullable=true) + +/** +* null +*/ +private String lote; + +@Column(name="PAISFABRICACION", nullable=true) + +/** +* null +*/ +private String paisfabricacion; + +@Column(name="NAME", nullable=false) + +/** +* null +*/ +private String name; + +@Column(name="CLASE", nullable=true) + +/** +* null +*/ +private String clase; + +@Column(name="ESTADO", nullable=true) + +/** +* null +*/ +private String estado; + +@Column(name="CALIBRE", nullable=true) + +/** +* null +*/ +private String calibre; + +@Column(name="TIPOARMAEXPLOSIVO", nullable=true) + +/** +* null +*/ +private String tipoarmaexplosivo; + +@Column(name="MARCA", nullable=true) + +/** +* null +*/ +private String marca; + +@Column(name="REGISTERDATE", nullable=true) + +/** +* null +*/ +private Date registerdate; + +@Column(name="USERCODE", nullable=true) + +/** +* null +*/ +private String usercode; +@Column(name="TICKET", nullable=true) + +/** +* null +*/ +private Integer ticket; + +@Column(name="IDENTIFICATION", nullable=true) + +/** +* null +*/ +private String identification; + + + + + +@Column(name="PERMISO", nullable=true) + +/** +* null +*/ +private String permiso; + +@Column(name="FECHAEMISON", nullable=true) + +/** +* null +*/ +private Date fechaemison; + +@Column(name="FECHAEXPIRACION", nullable=true) + +/** +* null +*/ +private Date fechaexpiracion; + +/**Contructor por defecto*/ +public TarmCertificadoArmas(){ +} +/**Contructor de TarmCertificadoArmas +@param pPk Clave Primaria del entity +@param pName null +*/ +public TarmCertificadoArmas(TarmCertificadoArmasKey pPk,String pName){ + this(); + pk=pPk; + name=pName; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmCertificadoArmas +*/ +public static TarmCertificadoArmas find(EntityManager pEntityManager,TarmCertificadoArmasKey pKey) throws Exception{ + TarmCertificadoArmas obj = pEntityManager.find(TarmCertificadoArmas.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmCertificadoArmas +@return El objeto que referencia a la Clave primaria de TarmCertificadoArmas +*/ +public TarmCertificadoArmasKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmCertificadoArmas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmCertificadoArmas +*/ +public void setPk(TarmCertificadoArmasKey pPk){ + pk=pPk; +} +/**Obtiene el valor de lote +@return valor de lote*/ +public String getLote(){ + return lote; +} +/**Fija el valor de lote +@param pLote nuevo Valor de lote*/ +public void setLote(String pLote){ + lote=pLote; +} + +/**Obtiene el valor de paisfabricacion +@return valor de paisfabricacion*/ +public String getPaisfabricacion(){ + return paisfabricacion; +} +/**Fija el valor de paisfabricacion +@param pPaisfabricacion nuevo Valor de paisfabricacion*/ +public void setPaisfabricacion(String pPaisfabricacion){ + paisfabricacion=pPaisfabricacion; +} + +/**Obtiene el valor de name +@return valor de name*/ +public String getName(){ + return name; +} +/**Fija el valor de name +@param pName nuevo Valor de name*/ +public void setName(String pName){ + name=pName; +} + +/**Obtiene el valor de clase +@return valor de clase*/ +public String getClase(){ + return clase; +} +/**Fija el valor de clase +@param pClase nuevo Valor de clase*/ +public void setClase(String pClase){ + clase=pClase; +} + +/**Obtiene el valor de estado +@return valor de estado*/ +public String getEstado(){ + return estado; +} +/**Fija el valor de estado +@param pEstado nuevo Valor de estado*/ +public void setEstado(String pEstado){ + estado=pEstado; +} + +/**Obtiene el valor de calibre +@return valor de calibre*/ +public String getCalibre(){ + return calibre; +} +/**Fija el valor de calibre +@param pCalibre nuevo Valor de calibre*/ +public void setCalibre(String pCalibre){ + calibre=pCalibre; +} + +/**Obtiene el valor de tipoarmaexplosivo +@return valor de tipoarmaexplosivo*/ +public String getTipoarmaexplosivo(){ + return tipoarmaexplosivo; +} +/**Fija el valor de tipoarmaexplosivo +@param pTipoarmaexplosivo nuevo Valor de tipoarmaexplosivo*/ +public void setTipoarmaexplosivo(String pTipoarmaexplosivo){ + tipoarmaexplosivo=pTipoarmaexplosivo; +} + +/**Obtiene el valor de marca +@return valor de marca*/ +public String getMarca(){ + return marca; +} +/**Fija el valor de marca +@param pMarca nuevo Valor de marca*/ +public void setMarca(String pMarca){ + marca=pMarca; +} + +/**Obtiene el valor de registerdate +@return valor de registerdate*/ +public Date getRegisterdate(){ + return registerdate; +} +/**Fija el valor de registerdate +@param pRegisterdate nuevo Valor de registerdate*/ +public void setRegisterdate(Date pRegisterdate){ + registerdate=pRegisterdate; +} + +/**Obtiene el valor de identification +@return valor de identification*/ +public String getIdentification(){ + return identification; +} +/**Fija el valor de identification +@param pIdentification nuevo Valor de identification*/ +public void setIdentification(String pIdentification){ + identification=pIdentification; +} + +public String getUsercode() { + return usercode; +} +public void setUsercode(String usercode) { + this.usercode = usercode; +} + +public Integer getTicket() { + return ticket; +} +public void setTicket(Integer ticket) { + this.ticket = ticket; +} +/** + * @return the permiso + */ +public String getPermiso() { + return permiso; +} +/** + * @param permiso the permiso to set + */ +public void setPermiso(String permiso) { + this.permiso = permiso; +} +/** + * @return the fechaemison + */ +public Date getFechaemison() { + return fechaemison; +} +/** + * @param fechaemison the fechaemison to set + */ +public void setFechaemison(Date fechaemison) { + this.fechaemison = fechaemison; +} +/** + * @return the fechaexpiracion + */ +public Date getFechaexpiracion() { + return fechaexpiracion; +} +/** + * @param fechaexpiracion the fechaexpiracion to set + */ +public void setFechaexpiracion(Date fechaexpiracion) { + this.fechaexpiracion = fechaexpiracion; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmCertificadoArmas))return false; + TarmCertificadoArmas that = (TarmCertificadoArmas) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmCertificadoArmas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmCertificadoArmas +*/ +public Object createInstance(){ + TarmCertificadoArmas instance=new TarmCertificadoArmas(); + instance.setPk(new TarmCertificadoArmasKey()); + return instance; +} +/**Clona la entidad TarmCertificadoArmas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmCertificadoArmas p=(TarmCertificadoArmas)this.clone(); + p.setPk((TarmCertificadoArmasKey)this.pk.cloneMe()); + return p; +} + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmCertificadoArmasKey.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmCertificadoArmasKey.java new file mode 100644 index 0000000..e5cba79 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmCertificadoArmasKey.java @@ -0,0 +1,153 @@ +package com.fp.persistence.parmas.soli; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMCERTIFICADOARMAS*/ +@Embeddable +public class TarmCertificadoArmasKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SESSIONID", nullable=false,updatable=false) + +/** +* null +*/ +private String sessionid; + +@Column(name="FECHAREPORTE", nullable=false,updatable=false) + +/** +* null +*/ +private Timestamp fechareporte; + +@Column(name="ORDEN", nullable=false,updatable=false) + +/** +* null +*/ +private Integer orden; + +/**Contructor por defecto*/ +public TarmCertificadoArmasKey(){} +/**Contructor de TarmCertificadoArmasKey +@param pSessionid null +@param pFechareporte null +@param pOrden null +*/ +public TarmCertificadoArmasKey(String pSessionid,Timestamp pFechareporte,Integer pOrden){ + sessionid=pSessionid; + fechareporte=pFechareporte; + orden=pOrden; +} +/**Obtiene el valor de sessionid +@return valor de sessionid*/ +public String getSessionid(){ + return sessionid; +} +/**Fija el valor de sessionid +@param pSessionid nuevo Valor de sessionid*/ +public void setSessionid(String pSessionid){ + sessionid=pSessionid; +} + +/**Obtiene el valor de fechareporte +@return valor de fechareporte*/ +public Timestamp getFechareporte(){ + return fechareporte; +} +/**Fija el valor de fechareporte +@param pFechareporte nuevo Valor de fechareporte*/ +public void setFechareporte(Timestamp pFechareporte){ + fechareporte=pFechareporte; +} + +/**Obtiene el valor de orden +@return valor de orden*/ +public Integer getOrden(){ + return orden; +} +/**Fija el valor de orden +@param pOrden nuevo Valor de orden*/ +public void setOrden(Integer pOrden){ + orden=pOrden; +} + +/**Implementacion de la comparacion de TarmCertificadoArmasKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmCertificadoArmasKey))return false; + TarmCertificadoArmasKey that = (TarmCertificadoArmasKey) o; + if (this.getSessionid() == null || that.getSessionid() == null){ + return false; + } + if (! this.getSessionid().equals(that.getSessionid())){ + return false; + } + if (this.getFechareporte() == null || that.getFechareporte() == null){ + return false; + } + if (! this.getFechareporte().equals(that.getFechareporte())){ + return false; + } + if (this.getOrden() == null || that.getOrden() == null){ + return false; + } + if (! this.getOrden().equals(that.getOrden())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmCertificadoArmasKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSessionid() == null ? 0 : this.getSessionid().hashCode()); + result = result * 37 + (this.getFechareporte() == null ? 0 : this.getFechareporte().hashCode()); + result = result * 37 + (this.getOrden() == null ? 0 : this.getOrden().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmCertificadoFiscalia.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmCertificadoFiscalia.java new file mode 100644 index 0000000..f448af6 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmCertificadoFiscalia.java @@ -0,0 +1,293 @@ +package com.fp.persistence.parmas.soli; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TarmCertificadoFiscalia*/ +@Entity(name="TarmCertificadoFiscalia") +@Table(name="TARMCERTIFICADOFISCALIA") +public class TarmCertificadoFiscalia extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmCertificadoFiscalia +*/ +@Id +@Column(name="CCERTIFICADOFISCALIA" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CERTIFICADOFISCALIA"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.Number"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "8")}) + @GeneratedValue(generator = "seq_id") +private Long pk; + +/** +* Numero de la Solicitid +*/ +@Column(name="NRSOLICITUD", nullable=true) +private String nrsolicitud; + +/** +* Nombre del Solicitante +*/ +@Column(name="NOMBRESOLICITANTE", nullable=true) +private String nombresolicitante; + +/** +* Numero de la instruccion Fiscal +*/ +@Column(name="NRINSTRUCCIONFISCAL", nullable=true) +private String nrinstruccionfiscal; + +/** +* Codigo de persona +*/ +@Column(name="personcode", nullable=true) +private Integer personcode; + +/** +* Direccion del archivo certificado en alfresco +*/ +@Column(name="XPATH", nullable=true) +private String xpath; + +/** +* Direccion del archivo certificado en alfresco para el Fiscal +*/ +@Column(name="XPATHSOLICITUDARMA", nullable=true) +private String xpathSolicitudArma; + +/** +* Fecha de creacin del registro +*/ +@Column(name="FCREACION", nullable=true) +private Date fcreacion; + +/** +* Nro. de oficio Fiscalia +*/ +@Column(name="NROFICIOFISCALIA", nullable=true) +private String nroficiofiscalia; + +/**Contructor por defecto*/ +public TarmCertificadoFiscalia(){ +} +/**Contructor de TarmCertificadoFiscalia +@param pPk Clave Primaria del entity +*/ +public TarmCertificadoFiscalia(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmCertificadoFiscalia +*/ +public static TarmCertificadoFiscalia find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmCertificadoFiscalia obj = pEntityManager.find(TarmCertificadoFiscalia.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmCertificadoFiscalia +@return El objeto que referencia a la Clave primaria de TarmCertificadoFiscalia +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmCertificadoFiscalia +@param pPk El objeto que referencia a la nueva Clave primaria de TarmCertificadoFiscalia +*/ +public void setPk(Long pPk){ + pk=pPk; +} + + +/** + * @return the hashValue + */ +public int getHashValue() { + return hashValue; +} +/** + * @param hashValue the hashValue to set + */ +public void setHashValue(int hashValue) { + this.hashValue = hashValue; +} +/** + * @return the nrsolicitud + */ +public String getNrsolicitud() { + return nrsolicitud; +} +/** + * @param nrsolicitud the nrsolicitud to set + */ +public void setNrsolicitud(String nrsolicitud) { + this.nrsolicitud = nrsolicitud; +} +/** + * @return the nombresolicitante + */ +public String getNombresolicitante() { + return nombresolicitante; +} +/** + * @param nombresolicitante the nombresolicitante to set + */ +public void setNombresolicitante(String nombresolicitante) { + this.nombresolicitante = nombresolicitante; +} +/** + * @return the nrinstruccionfiscal + */ +public String getNrinstruccionfiscal() { + return nrinstruccionfiscal; +} +/** + * @param nrinstruccionfiscal the nrinstruccionfiscal to set + */ +public void setNrinstruccionfiscal(String nrinstruccionfiscal) { + this.nrinstruccionfiscal = nrinstruccionfiscal; +} +/** + * @return the personcode + */ +public Integer getPersoncode() { + return personcode; +} +/** + * @param personcode the personcode to set + */ +public void setPersoncode(Integer personcode) { + this.personcode = personcode; +} +/** + * @return the xpath + */ +public String getXpath() { + return xpath; +} +/** + * @param xpath the xpath to set + */ +public void setXpath(String xpath) { + this.xpath = xpath; +} +/** + * @return the xpathSolicitudArma + */ +public String getXpathSolicitudArma() { + return xpathSolicitudArma; +} +/** + * @param xpathSolicitudArma the xpathSolicitudArma to set + */ +public void setXpathSolicitudArma(String xpathSolicitudArma) { + this.xpathSolicitudArma = xpathSolicitudArma; +} +/** + * @return the fcreacion + */ +public Date getFcreacion() { + return fcreacion; +} +/** + * @param fcreacion the fcreacion to set + */ +public void setFcreacion(Date fcreacion) { + this.fcreacion = fcreacion; +} +/** + * @return the nroficiofiscalia + */ +public String getNroficiofiscalia() { + return nroficiofiscalia; +} +/** + * @param nroficiofiscalia the nroficiofiscalia to set + */ +public void setNroficiofiscalia(String nroficiofiscalia) { + this.nroficiofiscalia = nroficiofiscalia; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmCertificadoFiscalia))return false; + TarmCertificadoFiscalia that = (TarmCertificadoFiscalia) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmCertificadoFiscalia +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmCertificadoFiscalia +*/ +public Object createInstance(){ + TarmCertificadoFiscalia instance=new TarmCertificadoFiscalia(); + return instance; +} +/**Clona la entidad TarmCertificadoFiscalia +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmCertificadoFiscalia p=(TarmCertificadoFiscalia)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmCustodiaTemporal.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmCustodiaTemporal.java new file mode 100644 index 0000000..ba3479a --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmCustodiaTemporal.java @@ -0,0 +1,524 @@ +package com.fp.persistence.parmas.soli; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMCUSTODIATEMPORAL*/ +@Entity(name="TarmCustodiaTemporal") +@Table(name="TARMCUSTODIATEMPORAL") +public class TarmCustodiaTemporal extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmCustodiaTemporal +*/ +@Id +@Column(name="CCUSTEMP" ,nullable=false, updatable=false) +private String pk; +@Column(name="TIPOREGISTRO", nullable=true) + +/** +* Codigo de catalogo 01 custodia temporal, 02 custodia temporal +*/ +private String tiporegistro; + +@Column(name="TIPOREGISTROCODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de registros +*/ +private String tiporegistrocode; + +@Column(name="AEROLINEA", nullable=true) + +/** +* Codigo de catalogo 01 Lan, 02 Icaro +*/ +private String aerolinea; + +@Column(name="AEROLINEACODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de aerolineas +*/ +private String aerolineacode; + +@Column(name="CCENTROCONTROL", nullable=true) + +/** +* Codigo de centro de control de armas +*/ +private String ccentrocontrol; + +@Column(name="COUNTRYCODEORIGEN", nullable=true) + +/** +* Codigo de pais de origen +*/ +private String countrycodeorigen; + +@Column(name="PROVINCECODEORIGEN", nullable=true) + +/** +* Codigo de provincia de origen +*/ +private String provincecodeorigen; + +@Column(name="CANTONCODEORIGEN", nullable=true) + +/** +* Codigo de canton de origen +*/ +private String cantoncodeorigen; + +@Column(name="CITYCODEORIGEN", nullable=true) + +/** +* Codigo de cuidad de origen +*/ +private String citycodeorigen; + +@Column(name="AEROPUERTOORIG", nullable=true) + +/** +* Codigo de catalogo 01 Mariscal Sucre, 02 Mariscal Lamar +*/ +private String aeropuertoorig; + +@Column(name="AEROPUERTOORIGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de aeropuertos +*/ +private String aeropuertoorigcode; + +@Column(name="COUNTRYCODEDEST", nullable=true) + +/** +* Codigo de pais de destino +*/ +private String countrycodedest; + +@Column(name="PROVINCECODEDEST", nullable=true) + +/** +* Codigo de provincia de destino +*/ +private String provincecodedest; + +@Column(name="CANTONCODEDEST", nullable=true) + +/** +* Codigo de canton de destino +*/ +private String cantoncodedest; + +@Column(name="CITYCODEDEST", nullable=true) + +/** +* Codigo de cuidad de destino +*/ +private String citycodedest; + +@Column(name="AEROPUERTODEST", nullable=true) + +/** +* Codigo de catalogo 01 Mariscal Sucre, 02 Simon Bolivar +*/ +private String aeropuertodest; + +@Column(name="AEROPUERTODESTCODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de aeropuertos de destino +*/ +private String aeropuertodestcode; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona que realiza el registro +*/ +private Integer personcode; + +@Column(name="PERSONCODEPROP", nullable=true) + +/** +* Codigo de persona propietaria +*/ +private Integer personcodeprop; + +@Column(name="NOTRANSACCION", nullable=true) + +/** +* Numero de Transaccion de la custodia temporal +*/ +private String notransaccion; + +@Column(name="FECHACUSTODIOS", nullable=true) + +/** +* Fecha del registro de la custodia temporal +*/ +private Date fechacustodios; + +@Column(name="VUELO", nullable=true) + +/** +* Numero de Vuelo en el cual se custodian las armas +*/ +private String vuelo; + +/**Contructor por defecto*/ +public TarmCustodiaTemporal(){ +} +/**Contructor de TarmCustodiaTemporal +@param pPk Clave Primaria del entity +*/ +public TarmCustodiaTemporal(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmCustodiaTemporal +*/ +public static TarmCustodiaTemporal find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmCustodiaTemporal obj = pEntityManager.find(TarmCustodiaTemporal.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmCustodiaTemporal +@return El objeto que referencia a la Clave primaria de TarmCustodiaTemporal +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmCustodiaTemporal +@param pPk El objeto que referencia a la nueva Clave primaria de TarmCustodiaTemporal +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de tiporegistro +@return valor de tiporegistro*/ +public String getTiporegistro(){ + return tiporegistro; +} +/**Fija el valor de tiporegistro +@param pTiporegistro nuevo Valor de tiporegistro*/ +public void setTiporegistro(String pTiporegistro){ + tiporegistro=pTiporegistro; +} + +/**Obtiene el valor de tiporegistrocode +@return valor de tiporegistrocode*/ +public String getTiporegistrocode(){ + return tiporegistrocode; +} +/**Fija el valor de tiporegistrocode +@param pTiporegistrocode nuevo Valor de tiporegistrocode*/ +public void setTiporegistrocode(String pTiporegistrocode){ + tiporegistrocode=pTiporegistrocode; +} + +/**Obtiene el valor de aerolinea +@return valor de aerolinea*/ +public String getAerolinea(){ + return aerolinea; +} +/**Fija el valor de aerolinea +@param pAerolinea nuevo Valor de aerolinea*/ +public void setAerolinea(String pAerolinea){ + aerolinea=pAerolinea; +} + +/**Obtiene el valor de aerolineacode +@return valor de aerolineacode*/ +public String getAerolineacode(){ + return aerolineacode; +} +/**Fija el valor de aerolineacode +@param pAerolineacode nuevo Valor de aerolineacode*/ +public void setAerolineacode(String pAerolineacode){ + aerolineacode=pAerolineacode; +} + +/**Obtiene el valor de ccentrocontrol +@return valor de ccentrocontrol*/ +public String getCcentrocontrol(){ + return ccentrocontrol; +} +/**Fija el valor de ccentrocontrol +@param pCcentrocontrol nuevo Valor de ccentrocontrol*/ +public void setCcentrocontrol(String pCcentrocontrol){ + ccentrocontrol=pCcentrocontrol; +} + +/**Obtiene el valor de countrycodeorigen +@return valor de countrycodeorigen*/ +public String getCountrycodeorigen(){ + return countrycodeorigen; +} +/**Fija el valor de countrycodeorigen +@param pCountrycodeorigen nuevo Valor de countrycodeorigen*/ +public void setCountrycodeorigen(String pCountrycodeorigen){ + countrycodeorigen=pCountrycodeorigen; +} + +/**Obtiene el valor de provincecodeorigen +@return valor de provincecodeorigen*/ +public String getProvincecodeorigen(){ + return provincecodeorigen; +} +/**Fija el valor de provincecodeorigen +@param pProvincecodeorigen nuevo Valor de provincecodeorigen*/ +public void setProvincecodeorigen(String pProvincecodeorigen){ + provincecodeorigen=pProvincecodeorigen; +} + +/**Obtiene el valor de cantoncodeorigen +@return valor de cantoncodeorigen*/ +public String getCantoncodeorigen(){ + return cantoncodeorigen; +} +/**Fija el valor de cantoncodeorigen +@param pCantoncodeorigen nuevo Valor de cantoncodeorigen*/ +public void setCantoncodeorigen(String pCantoncodeorigen){ + cantoncodeorigen=pCantoncodeorigen; +} + +/**Obtiene el valor de citycodeorigen +@return valor de citycodeorigen*/ +public String getCitycodeorigen(){ + return citycodeorigen; +} +/**Fija el valor de citycodeorigen +@param pCitycodeorigen nuevo Valor de citycodeorigen*/ +public void setCitycodeorigen(String pCitycodeorigen){ + citycodeorigen=pCitycodeorigen; +} + +/**Obtiene el valor de aeropuertoorig +@return valor de aeropuertoorig*/ +public String getAeropuertoorig(){ + return aeropuertoorig; +} +/**Fija el valor de aeropuertoorig +@param pAeropuertoorig nuevo Valor de aeropuertoorig*/ +public void setAeropuertoorig(String pAeropuertoorig){ + aeropuertoorig=pAeropuertoorig; +} + +/**Obtiene el valor de aeropuertoorigcode +@return valor de aeropuertoorigcode*/ +public String getAeropuertoorigcode(){ + return aeropuertoorigcode; +} +/**Fija el valor de aeropuertoorigcode +@param pAeropuertoorigcode nuevo Valor de aeropuertoorigcode*/ +public void setAeropuertoorigcode(String pAeropuertoorigcode){ + aeropuertoorigcode=pAeropuertoorigcode; +} + +/**Obtiene el valor de countrycodedest +@return valor de countrycodedest*/ +public String getCountrycodedest(){ + return countrycodedest; +} +/**Fija el valor de countrycodedest +@param pCountrycodedest nuevo Valor de countrycodedest*/ +public void setCountrycodedest(String pCountrycodedest){ + countrycodedest=pCountrycodedest; +} + +/**Obtiene el valor de provincecodedest +@return valor de provincecodedest*/ +public String getProvincecodedest(){ + return provincecodedest; +} +/**Fija el valor de provincecodedest +@param pProvincecodedest nuevo Valor de provincecodedest*/ +public void setProvincecodedest(String pProvincecodedest){ + provincecodedest=pProvincecodedest; +} + +/**Obtiene el valor de cantoncodedest +@return valor de cantoncodedest*/ +public String getCantoncodedest(){ + return cantoncodedest; +} +/**Fija el valor de cantoncodedest +@param pCantoncodedest nuevo Valor de cantoncodedest*/ +public void setCantoncodedest(String pCantoncodedest){ + cantoncodedest=pCantoncodedest; +} + +/**Obtiene el valor de citycodedest +@return valor de citycodedest*/ +public String getCitycodedest(){ + return citycodedest; +} +/**Fija el valor de citycodedest +@param pCitycodedest nuevo Valor de citycodedest*/ +public void setCitycodedest(String pCitycodedest){ + citycodedest=pCitycodedest; +} + +/**Obtiene el valor de aeropuertodest +@return valor de aeropuertodest*/ +public String getAeropuertodest(){ + return aeropuertodest; +} +/**Fija el valor de aeropuertodest +@param pAeropuertodest nuevo Valor de aeropuertodest*/ +public void setAeropuertodest(String pAeropuertodest){ + aeropuertodest=pAeropuertodest; +} + +/**Obtiene el valor de aeropuertodestcode +@return valor de aeropuertodestcode*/ +public String getAeropuertodestcode(){ + return aeropuertodestcode; +} +/**Fija el valor de aeropuertodestcode +@param pAeropuertodestcode nuevo Valor de aeropuertodestcode*/ +public void setAeropuertodestcode(String pAeropuertodestcode){ + aeropuertodestcode=pAeropuertodestcode; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de personcodeprop +@return valor de personcodeprop*/ +public Integer getPersoncodeprop(){ + return personcodeprop; +} +/**Fija el valor de personcodeprop +@param pPersoncodeprop nuevo Valor de personcodeprop*/ +public void setPersoncodeprop(Integer pPersoncodeprop){ + personcodeprop=pPersoncodeprop; +} + +/**Obtiene el valor de notransaccion +@return valor de notransaccion*/ +public String getNotransaccion(){ + return notransaccion; +} +/**Fija el valor de notransaccion +@param pNotransaccion nuevo Valor de notransaccion*/ +public void setNotransaccion(String pNotransaccion){ + notransaccion=pNotransaccion; +} + +/**Obtiene el valor de fechacustodios +@return valor de fechacustodios*/ +public Date getFechacustodios(){ + return fechacustodios; +} +/**Fija el valor de fechacustodios +@param pFechacustodios nuevo Valor de fechacustodios*/ +public void setFechacustodios(Date pFechacustodios){ + fechacustodios=pFechacustodios; +} + +/**Obtiene el valor de vuelo +@return valor de vuelo*/ +public String getVuelo(){ + return vuelo; +} +/**Fija el valor de vuelo +@param pVuelo nuevo Valor de vuelo*/ +public void setVuelo(String pVuelo){ + vuelo=pVuelo; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmCustodiaTemporal))return false; + TarmCustodiaTemporal that = (TarmCustodiaTemporal) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmCustodiaTemporal +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmCustodiaTemporal +*/ +public Object createInstance(){ + TarmCustodiaTemporal instance=new TarmCustodiaTemporal(); + return instance; +} +/**Clona la entidad TarmCustodiaTemporal +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmCustodiaTemporal p=(TarmCustodiaTemporal)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmDecomiso.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmDecomiso.java new file mode 100644 index 0000000..91ba8ec --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmDecomiso.java @@ -0,0 +1,694 @@ +package com.fp.persistence.parmas.soli; + +import com.fp.dto.hb.Log; + +import javax.persistence.Id; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; + +import javax.persistence.Version; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Column; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMDECOMISO*/ +@Entity(name="TarmDecomiso") +@Table(name="TARMDECOMISO") +public class TarmDecomiso extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmDecomiso +*/ +@Id +@Column(name="CDECOMISO" ,nullable=false, updatable=false) +private Long pk; +@Column(name="FECHADECOMISO", nullable=true) + +/** +* Fecha del decomiso +*/ +private Date fechadecomiso; + +@Column(name="NUMERORECIBO", nullable=true) + +/** +* Nmero del recibo +*/ +private String numerorecibo; + +@Column(name="PARROQUIACODE", nullable=true) + +/** +* Codigo de parroquia de decomiso +*/ +private String parroquiacode; + +@Column(name="COUNTRYCODE", nullable=true) + +/** +* Codigo de pais de decomiso +*/ +private String countrycode; + +@Column(name="LATITUD", nullable=true) + +/** +* null +*/ +private BigDecimal latitud; + +@Column(name="FECHAREGISTRO", nullable=true) + +/** +* Fecha de registro +*/ +private Date fecharegistro; + +@Column(name="TIPODOCUMENTO", nullable=true) + +/** +* Codigo de catalogo 01 Cdula, 02 Ruc +*/ +private String tipodocumento; + +@Column(name="TELEFONO", nullable=true) + +/** +* Telfono del decomisado +*/ +private String telefono; + +@Column(name="NUMEROTRANSACCION", nullable=true) + +/** +* Nmero de la transaccin +*/ +private String numerotransaccion; + +@Column(name="GRADOFUNCIONARIOCODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de grado +*/ +private String gradofuncionariocode; + +@Column(name="TIPODOCUMENTOCODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de documento +*/ +private String tipodocumentocode; + +@Column(name="TIPOPROCESO", nullable=true) + +/** +* Codigo de catalogo 01 Decomiso, 02 Incautacin +*/ +private String tipoproceso; + +@Column(name="PROVINCECODE", nullable=true) + +/** +* Codigo de provincia de decomiso +*/ +private String provincecode; + +@Column(name="FUNCIONARIO", nullable=true) + +/** +* Nombre del funcionario que realiza el decomiso +*/ +private String funcionario; + +@Column(name="GRADOFUNCIONARIO", nullable=true) + +/** +* Codigo de catalogo 01 Crnl, 02 Tnte +*/ +private String gradofuncionario; + +@Column(name="CCENTROCONTROLDESTINO", nullable=true) + +/** +* Codigo de centro de control de armas de destino(Donde se van a ser destruidas o donadas) +*/ +private String ccentrocontroldestino; + +@Column(name="PERSONCODEREGISTRA", nullable=true) + +/** +* codigo de la persona que realiza el registro +*/ +private Integer personcoderegistra; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona portadora del arma +*/ +private Integer personcode; + +@Column(name="CEDULAFUNCIONARIO", nullable=true) + +/** +* cdula de la persona que realiza el decomiso(Funcionario) +*/ +private String cedulafuncionario; + +@Column(name="NUMERODOCUMENTO", nullable=true) + +/** +* Nmero de documento de la persna o empresa a quien se le realiza el decomiso +*/ +private String numerodocumento; + +@Column(name="ORGANISMOCONTROL", nullable=true) + +/** +* Organismo de control "Fuerzas Armadas" +*/ +private String organismocontrol; + +@Column(name="CITYCODE", nullable=true) + +/** +* Codigo de cuidad de decomiso +*/ +private String citycode; + +@Column(name="CANTONCODE", nullable=true) + +/** +* Codigo de canton de decomiso +*/ +private String cantoncode; + +@Column(name="TIPOPROCESOCODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Cdigo del tipo de proceso +*/ +private String tipoprocesocode; + +@Column(name="LONGITUD", nullable=true) + +/** +* null +*/ +private BigDecimal longitud; + +@Column(name="NOMBRERAZONSOCIAL", nullable=true) + +/** +* Nombre de la persona o empresa del decomisado +*/ +private String nombrerazonsocial; + +@Column(name="DIRECCION", nullable=true) + +/** +* Direccin del lugar de decomiso +*/ +private String direccion; + + +@Column(name="CCENTROCONTROL", nullable=true) + +/** +* Codigo de centro de control de armas +*/ +private String ccentrocontrol; + +@Column(name="REFERENCIA", nullable=true) + +/** +* Refencia de una direccion del decomiso +*/ +private String referencia; + +@Column(name="XPATH", nullable=true) + +/** +* null +*/ +private String xpath; + +@Column(name="COMPROBANTEXPATH", nullable=true) + +/** +* null +*/ +private String comprobantexpath; + +/**Contructor por defecto*/ +public TarmDecomiso(){ +} +/**Contructor de TarmDecomiso +@param pPk Clave Primaria del entity +*/ +public TarmDecomiso(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmDecomiso +*/ +public static TarmDecomiso find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmDecomiso obj = pEntityManager.find(TarmDecomiso.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmDecomiso +@return El objeto que referencia a la Clave primaria de TarmDecomiso +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmDecomiso +@param pPk El objeto que referencia a la nueva Clave primaria de TarmDecomiso +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de fechadecomiso +@return valor de fechadecomiso*/ +public Date getFechadecomiso(){ + return fechadecomiso; +} +/**Fija el valor de fechadecomiso +@param pFechadecomiso nuevo Valor de fechadecomiso*/ +public void setFechadecomiso(Date pFechadecomiso){ + fechadecomiso=pFechadecomiso; +} + +/**Obtiene el valor de numerorecibo +@return valor de numerorecibo*/ +public String getNumerorecibo(){ + return numerorecibo; +} +/**Fija el valor de numerorecibo +@param pNumerorecibo nuevo Valor de numerorecibo*/ +public void setNumerorecibo(String pNumerorecibo){ + numerorecibo=pNumerorecibo; +} + +/**Obtiene el valor de parroquiacode +@return valor de parroquiacode*/ +public String getParroquiacode(){ + return parroquiacode; +} +/**Fija el valor de parroquiacode +@param pParroquiacode nuevo Valor de parroquiacode*/ +public void setParroquiacode(String pParroquiacode){ + parroquiacode=pParroquiacode; +} + +/**Obtiene el valor de countrycode +@return valor de countrycode*/ +public String getCountrycode(){ + return countrycode; +} +/**Fija el valor de countrycode +@param pCountrycode nuevo Valor de countrycode*/ +public void setCountrycode(String pCountrycode){ + countrycode=pCountrycode; +} + +/**Obtiene el valor de latitud +@return valor de latitud*/ +public BigDecimal getLatitud(){ + return latitud; +} +/**Fija el valor de latitud +@param pLatitud nuevo Valor de latitud*/ +public void setLatitud(BigDecimal pLatitud){ + latitud=pLatitud; +} + +/**Obtiene el valor de fecharegistro +@return valor de fecharegistro*/ +public Date getFecharegistro(){ + return fecharegistro; +} +/**Fija el valor de fecharegistro +@param pFecharegistro nuevo Valor de fecharegistro*/ +public void setFecharegistro(Date pFecharegistro){ + fecharegistro=pFecharegistro; +} + +/**Obtiene el valor de tipodocumento +@return valor de tipodocumento*/ +public String getTipodocumento(){ + return tipodocumento; +} +/**Fija el valor de tipodocumento +@param pTipodocumento nuevo Valor de tipodocumento*/ +public void setTipodocumento(String pTipodocumento){ + tipodocumento=pTipodocumento; +} + +/**Obtiene el valor de telefono +@return valor de telefono*/ +public String getTelefono(){ + return telefono; +} +/**Fija el valor de telefono +@param pTelefono nuevo Valor de telefono*/ +public void setTelefono(String pTelefono){ + telefono=pTelefono; +} + +/**Obtiene el valor de numerotransaccion +@return valor de numerotransaccion*/ +public String getNumerotransaccion(){ + return numerotransaccion; +} +/**Fija el valor de numerotransaccion +@param pNumerotransaccion nuevo Valor de numerotransaccion*/ +public void setNumerotransaccion(String pNumerotransaccion){ + numerotransaccion=pNumerotransaccion; +} + +/**Obtiene el valor de gradofuncionariocode +@return valor de gradofuncionariocode*/ +public String getGradofuncionariocode(){ + return gradofuncionariocode; +} +/**Fija el valor de gradofuncionariocode +@param pGradofuncionariocode nuevo Valor de gradofuncionariocode*/ +public void setGradofuncionariocode(String pGradofuncionariocode){ + gradofuncionariocode=pGradofuncionariocode; +} + +/**Obtiene el valor de tipodocumentocode +@return valor de tipodocumentocode*/ +public String getTipodocumentocode(){ + return tipodocumentocode; +} +/**Fija el valor de tipodocumentocode +@param pTipodocumentocode nuevo Valor de tipodocumentocode*/ +public void setTipodocumentocode(String pTipodocumentocode){ + tipodocumentocode=pTipodocumentocode; +} + +/**Obtiene el valor de tipoproceso +@return valor de tipoproceso*/ +public String getTipoproceso(){ + return tipoproceso; +} +/**Fija el valor de tipoproceso +@param pTipoproceso nuevo Valor de tipoproceso*/ +public void setTipoproceso(String pTipoproceso){ + tipoproceso=pTipoproceso; +} + +/**Obtiene el valor de provincecode +@return valor de provincecode*/ +public String getProvincecode(){ + return provincecode; +} +/**Fija el valor de provincecode +@param pProvincecode nuevo Valor de provincecode*/ +public void setProvincecode(String pProvincecode){ + provincecode=pProvincecode; +} + +/**Obtiene el valor de funcionario +@return valor de funcionario*/ +public String getFuncionario(){ + return funcionario; +} +/**Fija el valor de funcionario +@param pFuncionario nuevo Valor de funcionario*/ +public void setFuncionario(String pFuncionario){ + funcionario=pFuncionario; +} + +/**Obtiene el valor de gradofuncionario +@return valor de gradofuncionario*/ +public String getGradofuncionario(){ + return gradofuncionario; +} +/**Fija el valor de gradofuncionario +@param pGradofuncionario nuevo Valor de gradofuncionario*/ +public void setGradofuncionario(String pGradofuncionario){ + gradofuncionario=pGradofuncionario; +} + +/**Obtiene el valor de ccentrocontroldestino +@return valor de ccentrocontroldestino*/ +public String getCcentrocontroldestino(){ + return ccentrocontroldestino; +} +/**Fija el valor de ccentrocontroldestino +@param pCcentrocontroldestino nuevo Valor de ccentrocontroldestino*/ +public void setCcentrocontroldestino(String pCcentrocontroldestino){ + ccentrocontroldestino=pCcentrocontroldestino; +} + +/**Obtiene el valor de personcoderegistra +@return valor de personcoderegistra*/ +public Integer getPersoncoderegistra(){ + return personcoderegistra; +} +/**Fija el valor de personcoderegistra +@param pPersoncoderegistra nuevo Valor de personcoderegistra*/ +public void setPersoncoderegistra(Integer pPersoncoderegistra){ + personcoderegistra=pPersoncoderegistra; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de cedulafuncionario +@return valor de cedulafuncionario*/ +public String getCedulafuncionario(){ + return cedulafuncionario; +} +/**Fija el valor de cedulafuncionario +@param pCedulafuncionario nuevo Valor de cedulafuncionario*/ +public void setCedulafuncionario(String pCedulafuncionario){ + cedulafuncionario=pCedulafuncionario; +} + +/**Obtiene el valor de numerodocumento +@return valor de numerodocumento*/ +public String getNumerodocumento(){ + return numerodocumento; +} +/**Fija el valor de numerodocumento +@param pNumerodocumento nuevo Valor de numerodocumento*/ +public void setNumerodocumento(String pNumerodocumento){ + numerodocumento=pNumerodocumento; +} + +/**Obtiene el valor de organismocontrol +@return valor de organismocontrol*/ +public String getOrganismocontrol(){ + return organismocontrol; +} +/**Fija el valor de organismocontrol +@param pOrganismocontrol nuevo Valor de organismocontrol*/ +public void setOrganismocontrol(String pOrganismocontrol){ + organismocontrol=pOrganismocontrol; +} + +/**Obtiene el valor de citycode +@return valor de citycode*/ +public String getCitycode(){ + return citycode; +} +/**Fija el valor de citycode +@param pCitycode nuevo Valor de citycode*/ +public void setCitycode(String pCitycode){ + citycode=pCitycode; +} + +/**Obtiene el valor de cantoncode +@return valor de cantoncode*/ +public String getCantoncode(){ + return cantoncode; +} +/**Fija el valor de cantoncode +@param pCantoncode nuevo Valor de cantoncode*/ +public void setCantoncode(String pCantoncode){ + cantoncode=pCantoncode; +} + +/**Obtiene el valor de tipoprocesocode +@return valor de tipoprocesocode*/ +public String getTipoprocesocode(){ + return tipoprocesocode; +} +/**Fija el valor de tipoprocesocode +@param pTipoprocesocode nuevo Valor de tipoprocesocode*/ +public void setTipoprocesocode(String pTipoprocesocode){ + tipoprocesocode=pTipoprocesocode; +} + +/**Obtiene el valor de longitud +@return valor de longitud*/ +public BigDecimal getLongitud(){ + return longitud; +} +/**Fija el valor de longitud +@param pLongitud nuevo Valor de longitud*/ +public void setLongitud(BigDecimal pLongitud){ + longitud=pLongitud; +} + +/**Obtiene el valor de nombrerazonsocial +@return valor de nombrerazonsocial*/ +public String getNombrerazonsocial(){ + return nombrerazonsocial; +} +/**Fija el valor de nombrerazonsocial +@param pNombrerazonsocial nuevo Valor de nombrerazonsocial*/ +public void setNombrerazonsocial(String pNombrerazonsocial){ + nombrerazonsocial=pNombrerazonsocial; +} + +/**Obtiene el valor de direccion +@return valor de direccion*/ +public String getDireccion(){ + return direccion; +} +/**Fija el valor de direccion +@param pDireccion nuevo Valor de direccion*/ +public void setDireccion(String pDireccion){ + direccion=pDireccion; +} + +/**Obtiene el valor de ccentrocontrol +@return valor de ccentrocontrol*/ +public String getCcentrocontrol(){ + return ccentrocontrol; +} +/**Fija el valor de ccentrocontrol +@param pCcentrocontrol nuevo Valor de ccentrocontrol*/ +public void setCcentrocontrol(String pCcentrocontrol){ + ccentrocontrol=pCcentrocontrol; +} + /** + * @return the referencia + */ + public String getReferencia() { + return referencia; + } + + /** + * @param referencia the referencia to set + */ + public void setReferencia(String referencia) { + this.referencia = referencia; + } + + + /**Obtiene el valor de xpath + @return valor de xpath*/ + public String getXpath(){ + return xpath; + } + /**Fija el valor de xpath + @param xpathacta nuevo Valor de xpath*/ + public void setXpath(String xpath){ + this.xpath=xpath; + } + /**Obtiene el valor de comprobantexpath + @return valor de comprobantexpath*/ + public String getComprobantexpath() { + return comprobantexpath; + } + /**Fija el valor de comprobantexpath + @param xpathacta nuevo Valor de comprobantexpath*/ + public void setComprobantexpath(String comprobantexpath) { + this.comprobantexpath = comprobantexpath; + } + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmDecomiso))return false; + TarmDecomiso that = (TarmDecomiso) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmDecomiso +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmDecomiso +*/ +public Object createInstance(){ + TarmDecomiso instance=new TarmDecomiso(); + return instance; +} +/**Clona la entidad TarmDecomiso +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmDecomiso p=(TarmDecomiso)this.clone(); + return p; +} + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmDecomisoArma.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmDecomisoArma.java new file mode 100644 index 0000000..e850f3b --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmDecomisoArma.java @@ -0,0 +1,493 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; + +import java.sql.Timestamp; + +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMDECOMISOARMA*/ +@Entity(name="TarmDecomisoArma") +@Table(name="TARMDECOMISOARMA") +public class TarmDecomisoArma extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmDecomisoArma +*/ +@Id +@Column(name="CDECOMISOARMA" ,nullable=false, updatable=false) +private String pk; +@Column(name="CARMA", nullable=true) + +/** +* codigo da la tabla TarmArma +*/ +private String carma; + +@Column(name="MOTIVODECOMISO", nullable=true) + +/** +* Codigo de catalogo 01 Permiso Caducado, 02 Sin Papeles +*/ +private String motivodecomiso; + +@Column(name="MOTIVODECOMISOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String motivodecomisocodigo; + +@Column(name="ESTADO", nullable=true) + +/** +* Codigo de catalogo 01 Decomisado, 02 Incautado +*/ +private String estado; + +@Column(name="ESTADOCODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de estados +*/ +private String estadocode; + +@Column(name="UNIDADMEDIDA", nullable=true) + +/** +* Codigo de catalogo 01 Unidad, 02 Peso +*/ +private String unidadmedida; + +@Column(name="UNIDADMEDIDACODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de unidad +*/ +private String unidadmedidacode; + +@Column(name="CDECOMISO", nullable=true) + +/** +* Codigo de la Tabla Decomiso +*/ +private Long cdecomiso; + +@Column(name="FDECOMISO", nullable=true) + +/** +* fecha de registro del decomiso +*/ +private Timestamp fdecomiso; + +@Column(name="CANTIDAD", nullable=true) + +/** +* cantidad decomisada +*/ +private BigDecimal cantidad; + +@Column(name="OBSERVACION", nullable=true) + +/** +* observacin del decomiso +*/ +private String observacion; + +@Column(name="CCUSTEMP", nullable=true) + +/** +* null +*/ +private String ccustemp; + +@Column(name="ADESTRUIRSE", nullable=true) + +/** +* Codigo de catalogo para indicar si el arma esta en algun reporte del flujo de armas a destruir +*/ +private String adestruirse; + +@Column(name="ADESTRUIRSECODE", nullable=true) + +/** +* CatalogCode para indicar si el arma esta en algun reporte del flujo de armas a destruir +*/ +private String adestruirsecode; + +@Column(name="ESTADOANTERIOR", nullable=true) + +/** +* Tabla que contiene los decomisos y la custodia temporal de las armas asignadas a la persona +*/ +private String estadoanterior; + +@Column(name="TIPOREGISTROANTERIOR", nullable=true) + +/** +* CAmpo que registra el estado anterior del registro arma para cuando se devuelva regrese a su estado anterior +*/ +private String tiporegistroanterior; + +@Column(name="ENBODEGA", nullable=true) + +/** +* CAMPO QUE INDICA QUE EL TECNICO DE ALMACENAMIENTO CONFIRMO QUE EL ARMA DECOMISADA SE ENCUENTRA EN BODEGA +*/ +private String enbodega; + +@Column(name="CDECOMISOARMATRANSACCION", nullable=true) + +/** +* Clave foranea a TARMDECOMISOARMATRANSACCION +*/ +private Long cdecomisoarmatransaccion; + +@Column(name="CDECARMTRANRECEPCION", nullable=true) + +/** +* Codigo de la tabla TarmDecomisoArmaTransaccion para obtener el numero de transaccion de recepcion +*/ +private Long cdecarmtranrecepcion; + + +/** +* Operacion actual de la transaccion +*/ +@Column(name="COPERACIONTRANSACCION", nullable=true) +private String coperaciontransaccion; + + + +/**Contructor por defecto*/ +public TarmDecomisoArma(){ +} +/**Contructor de TarmDecomisoArma +@param pPk Clave Primaria del entity +*/ +public TarmDecomisoArma(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmDecomisoArma +*/ +public static TarmDecomisoArma find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmDecomisoArma obj = pEntityManager.find(TarmDecomisoArma.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmDecomisoArma +@return El objeto que referencia a la Clave primaria de TarmDecomisoArma +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmDecomisoArma +@param pPk El objeto que referencia a la nueva Clave primaria de TarmDecomisoArma +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de motivodecomiso +@return valor de motivodecomiso*/ +public String getMotivodecomiso(){ + return motivodecomiso; +} +/**Fija el valor de motivodecomiso +@param pMotivodecomiso nuevo Valor de motivodecomiso*/ +public void setMotivodecomiso(String pMotivodecomiso){ + motivodecomiso=pMotivodecomiso; +} + +/**Obtiene el valor de motivodecomisocodigo +@return valor de motivodecomisocodigo*/ +public String getMotivodecomisocodigo(){ + return motivodecomisocodigo; +} +/**Fija el valor de motivodecomisocodigo +@param pMotivodecomisocodigo nuevo Valor de motivodecomisocodigo*/ +public void setMotivodecomisocodigo(String pMotivodecomisocodigo){ + motivodecomisocodigo=pMotivodecomisocodigo; +} + +/**Obtiene el valor de estado +@return valor de estado*/ +public String getEstado(){ + return estado; +} +/**Fija el valor de estado +@param pEstado nuevo Valor de estado*/ +public void setEstado(String pEstado){ + estado=pEstado; +} + +/**Obtiene el valor de estadocode +@return valor de estadocode*/ +public String getEstadocode(){ + return estadocode; +} +/**Fija el valor de estadocode +@param pEstadocode nuevo Valor de estadocode*/ +public void setEstadocode(String pEstadocode){ + estadocode=pEstadocode; +} + +/**Obtiene el valor de unidadmedida +@return valor de unidadmedida*/ +public String getUnidadmedida(){ + return unidadmedida; +} +/**Fija el valor de unidadmedida +@param pUnidadmedida nuevo Valor de unidadmedida*/ +public void setUnidadmedida(String pUnidadmedida){ + unidadmedida=pUnidadmedida; +} + +/**Obtiene el valor de unidadmedidacode +@return valor de unidadmedidacode*/ +public String getUnidadmedidacode(){ + return unidadmedidacode; +} +/**Fija el valor de unidadmedidacode +@param pUnidadmedidacode nuevo Valor de unidadmedidacode*/ +public void setUnidadmedidacode(String pUnidadmedidacode){ + unidadmedidacode=pUnidadmedidacode; +} + +/**Obtiene el valor de cdecomiso +@return valor de cdecomiso*/ +public Long getCdecomiso(){ + return cdecomiso; +} +/**Fija el valor de cdecomiso +@param pCdecomiso nuevo Valor de cdecomiso*/ +public void setCdecomiso(Long pCdecomiso){ + cdecomiso=pCdecomiso; +} + +/**Obtiene el valor de fdecomiso +@return valor de fdecomiso*/ +public Timestamp getFdecomiso(){ + return fdecomiso; +} +/**Fija el valor de fdecomiso +@param pFdecomiso nuevo Valor de fdecomiso*/ +public void setFdecomiso(Timestamp pFdecomiso){ + fdecomiso=pFdecomiso; +} + +/**Obtiene el valor de cantidad +@return valor de cantidad*/ +public BigDecimal getCantidad(){ + return cantidad; +} +/**Fija el valor de cantidad +@param pCantidad nuevo Valor de cantidad*/ +public void setCantidad(BigDecimal pCantidad){ + cantidad=pCantidad; +} + +/**Obtiene el valor de observacion +@return valor de observacion*/ +public String getObservacion(){ + return observacion; +} +/**Fija el valor de observacion +@param pObservacion nuevo Valor de observacion*/ +public void setObservacion(String pObservacion){ + observacion=pObservacion; +} + +/**Obtiene el valor de ccustemp +@return valor de ccustemp*/ +public String getCcustemp(){ + return ccustemp; +} +/**Fija el valor de ccustemp +@param pCcustemp nuevo Valor de ccustemp*/ +public void setCcustemp(String pCcustemp){ + ccustemp=pCcustemp; +} + +/**Obtiene el valor de adestruirse +@return valor de adestruirse*/ +public String getAdestruirse(){ + return adestruirse; +} +/**Fija el valor de adestruirse +@param pAdestruirse nuevo Valor de adestruirse*/ +public void setAdestruirse(String pAdestruirse){ + adestruirse=pAdestruirse; +} + +/**Obtiene el valor de adestruirsecode +@return valor de adestruirsecode*/ +public String getAdestruirsecode(){ + return adestruirsecode; +} +/**Fija el valor de adestruirsecode +@param pAdestruirsecode nuevo Valor de adestruirsecode*/ +public void setAdestruirsecode(String pAdestruirsecode){ + adestruirsecode=pAdestruirsecode; +} + +/**Obtiene el valor de estadoanterior +@return valor de estadoanterior*/ +public String getEstadoanterior(){ + return estadoanterior; +} +/**Fija el valor de estadoanterior +@param pEstadoanterior nuevo Valor de estadoanterior*/ +public void setEstadoanterior(String pEstadoanterior){ + estadoanterior=pEstadoanterior; +} + +/**Obtiene el valor de tiporegistroanterior +@return valor de tiporegistroanterior*/ +public String getTiporegistroanterior(){ + return tiporegistroanterior; +} +/**Fija el valor de tiporegistroanterior +@param pTiporegistroanterior nuevo Valor de tiporegistroanterior*/ +public void setTiporegistroanterior(String pTiporegistroanterior){ + tiporegistroanterior=pTiporegistroanterior; +} + +/**Obtiene el valor de enbodega +@return valor de enbodega*/ +public String getEnbodega(){ + return enbodega; +} +/**Fija el valor de enbodega +@param pEnbodega nuevo Valor de enbodega*/ +public void setEnbodega(String pEnbodega){ + enbodega=pEnbodega; +} + +/**Obtiene el valor de cdecomisoarmatransaccion +@return valor de cdecomisoarmatransaccion*/ +public Long getCdecomisoarmatransaccion(){ + return cdecomisoarmatransaccion; +} +/**Fija el valor de cdecomisoarmatransaccion +@param pCdecomisoarmatransaccion nuevo Valor de cdecomisoarmatransaccion*/ +public void setCdecomisoarmatransaccion(Long pCdecomisoarmatransaccion){ + cdecomisoarmatransaccion=pCdecomisoarmatransaccion; +} + +/**Obtiene el valor de cdecarmtranrecepcion +@return valor de cdecarmtranrecepcion*/ +public Long getCdecarmtranrecepcion(){ + return cdecarmtranrecepcion; +} +/**Fija el valor de cdecarmtranrecepcion +@param pCdecarmtranrecepcion nuevo Valor de cdecarmtranrecepcion*/ +public void setCdecarmtranrecepcion(Long pCdecarmtranrecepcion){ + cdecarmtranrecepcion=pCdecarmtranrecepcion; +} + +/** + * @return the coperaciontransaccion + */ +public String getCoperaciontransaccion() { + return coperaciontransaccion; +} +/** + * @param coperaciontransaccion the coperaciontransaccion to set + */ +public void setCoperaciontransaccion(String coperaciontransaccion) { + this.coperaciontransaccion = coperaciontransaccion; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmDecomisoArma))return false; + TarmDecomisoArma that = (TarmDecomisoArma) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmDecomisoArma +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmDecomisoArma +*/ +public Object createInstance(){ + TarmDecomisoArma instance=new TarmDecomisoArma(); + return instance; +} +/**Clona la entidad TarmDecomisoArma +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmDecomisoArma p=(TarmDecomisoArma)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmDecomisoArmaTransaccion.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmDecomisoArmaTransaccion.java new file mode 100644 index 0000000..baad37e --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmDecomisoArmaTransaccion.java @@ -0,0 +1,258 @@ +package com.fp.persistence.parmas.soli; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMDECOMISOARMATRANSACCION*/ +@Entity(name="TarmDecomisoArmaTransaccion") +@Table(name="TARMDECOMISOARMATRANSACCION") +public class TarmDecomisoArmaTransaccion extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmDecomisoArmaTransaccion +*/ +@Id +@Column(name="CDECOMISOARMATRANSACCION" ,nullable=false, updatable=false) +private Long pk; +@Column(name="FCORTE", nullable=false) + +/** +* FECHA DE CORTE EN LA CUAL SE REALIZO LA GENERACION DEL NUMERO DE ENVIO +*/ +private Date fcorte; + +@Column(name="NUMEROTRANSACCION", nullable=true) + +/** +* null +*/ +private String numerotransaccion; + +@Column(name="CCONTROL", nullable=false) + +/** +* CODIGO DEL CENTRO DE CONTROL AL CUAL PERTENECE ESTE ENVIO +*/ +private String ccentrocontrol; + +@Column(name="FTRANSACCION", nullable=false) + +/** +* REGISTRO DE LA FECHA EN LA CUAL SE GENERO ESTE CODIGO DE TRANSACCION +*/ +private Date ftransaccion; + +@Column(name="XPATH", nullable=true) + +/** +* ruta del archivo que se almacena en el alfresco, para la recepcion de las armas +*/ +private String xpath; + +@Column(name="ESTADOFLUJO", nullable=true) + +/** +* null +*/ +private String estadoflujo; + +@Column(name="ESTADOFIRMA", nullable=true) + +/** +* null +*/ +private String estadofirma; + + +/**Contructor por defecto*/ +public TarmDecomisoArmaTransaccion(){ +} +/**Contructor de TarmDecomisoArmaTransaccion +@param pPk Clave Primaria del entity +@param pFcorte FECHA DE CORTE EN LA CUAL SE REALIZO LA GENERACION DEL NUMERO DE ENVIO +@param pCcontrol CODIGO DEL CENTRO DE CONTROL AL CUAL PERTENECE ESTE ENVIO +@param pFtransaccion REGISTRO DE LA FECHA EN LA CUAL SE GENERO ESTE CODIGO DE TRANSACCION +*/ +public TarmDecomisoArmaTransaccion(Long pPk,Date pFcorte,String pCcontrol,Date pFtransaccion){ + this(); + pk=pPk; + fcorte=pFcorte; + ccentrocontrol=pCcontrol; + ftransaccion=pFtransaccion; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmDecomisoArmaTransaccion +*/ +public static TarmDecomisoArmaTransaccion find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmDecomisoArmaTransaccion obj = pEntityManager.find(TarmDecomisoArmaTransaccion.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmDecomisoArmaTransaccion +@return El objeto que referencia a la Clave primaria de TarmDecomisoArmaTransaccion +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmDecomisoArmaTransaccion +@param pPk El objeto que referencia a la nueva Clave primaria de TarmDecomisoArmaTransaccion +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de fcorte +@return valor de fcorte*/ +public Date getFcorte(){ + return fcorte; +} +/**Fija el valor de fcorte +@param pFcorte nuevo Valor de fcorte*/ +public void setFcorte(Date pFcorte){ + fcorte=pFcorte; +} + +/**Obtiene el valor de numerotransaccion +@return valor de numerotransaccion*/ +public String getNumerotransaccion(){ + return numerotransaccion; +} +/**Fija el valor de numerotransaccion +@param pNumerotransaccion nuevo Valor de numerotransaccion*/ +public void setNumerotransaccion(String pNumerotransaccion){ + numerotransaccion=pNumerotransaccion; +} + +/**Obtiene el valor de ccontrol +@return valor de ccontrol*/ +public String getCcentrocontrol(){ + return ccentrocontrol; +} +/**Fija el valor de ccontrol +@param pCcontrol nuevo Valor de ccontrol*/ +public void setCcentrocontrol(String pCcontrol){ + ccentrocontrol=pCcontrol; +} + +/**Obtiene el valor de ftransaccion +@return valor de ftransaccion*/ +public Date getFtransaccion(){ + return ftransaccion; +} +/**Fija el valor de ftransaccion +@param pFtransaccion nuevo Valor de ftransaccion*/ +public void setFtransaccion(Date pFtransaccion){ + ftransaccion=pFtransaccion; +} + +/**Obtiene el valor de xpath +@return valor de xpath*/ +public String getXpath(){ + return xpath; +} +/**Fija el valor de xpath +@param pXpath nuevo Valor de xpath*/ +public void setXpath(String pXpath){ + xpath=pXpath; +} + +/**Obtiene el valor de estadoflujo +@return valor de estadoflujo*/ +public String getEstadoflujo(){ + return estadoflujo; +} +/** + * @return the estadofirma + */ +public String getEstadofirma() { + return estadofirma; +} +/** + * @param estadofirma the estadofirma to set + */ +public void setEstadofirma(String estadofirma) { + this.estadofirma = estadofirma; +} +/**Fija el valor de estadoflujo +@param pEstadoflujo nuevo Valor de estadoflujo*/ +public void setEstadoflujo(String pEstadoflujo){ + estadoflujo=pEstadoflujo; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmDecomisoArmaTransaccion))return false; + TarmDecomisoArmaTransaccion that = (TarmDecomisoArmaTransaccion) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmDecomisoArmaTransaccion +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmDecomisoArmaTransaccion +*/ +public Object createInstance(){ + TarmDecomisoArmaTransaccion instance=new TarmDecomisoArmaTransaccion(); + return instance; +} +/**Clona la entidad TarmDecomisoArmaTransaccion +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmDecomisoArmaTransaccion p=(TarmDecomisoArmaTransaccion)this.clone(); + return p; +} + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmDetRepDestruirArmas.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmDetRepDestruirArmas.java new file mode 100644 index 0000000..53fd215 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmDetRepDestruirArmas.java @@ -0,0 +1,348 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMDETREPDESTRUIRARMAS*/ +@Entity(name="TarmDetRepDestruirArmas") +@Table(name="TARMDETREPDESTRUIRARMAS") +public class TarmDetRepDestruirArmas extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmDetRepDestruirArmas +*/ +@Id +@Column(name="CDETREPDESTRUIRARMAS" ,nullable=false, updatable=false) +private Integer pk; +@Column(name="CREPORTE", nullable=false) + +/** +* Codigo del reporte +*/ +private Integer creporte; + +@Column(name="CDECOMISOARMA", nullable=false) + +/** +* Codigo de decomiso arma +*/ +private String cdecomisoarma; + +@Column(name="CLASE", nullable=true) + +/** +* Clase de arma o explosivo +*/ +private String clase; + +@Column(name="TIPO", nullable=true) + +/** +* Tipo de arma o explosivo +*/ +private String tipo; + +@Column(name="CALIBRE", nullable=true) + +/** +* Calibre del arma +*/ +private String calibre; + +@Column(name="MARCA", nullable=true) + +/** +* Marca del arma o explosivo +*/ +private String marca; + +@Column(name="SERIE", nullable=true) + +/** +* Serie del arma o explosivo +*/ +private String serie; + +@Column(name="CANTIDAD", nullable=true) + +/** +* Cantidad de unidades del arma o explosivo +*/ +private String cantidad; + +@Column(name="UNIDAD", nullable=true) + +/** +* Unidad de medida del arma o explosivo +*/ +private String unidad; + +@Column(name="FDECOMISO", nullable=true) + +/** +* Fecha de decomiso del arma o explosivo +*/ +private Date fdecomiso; + +@Column(name="PROPIETARIO", nullable=true) + +/** +* Propietario del arma o explosivo +*/ +private String propietario; + +@Column(name="NRECIBO", nullable=true) + +/** +* Numero de recibo con el que se incauto el arma o explosivo +*/ +private String nrecibo; + +/**Contructor por defecto*/ +public TarmDetRepDestruirArmas(){ +} +/**Contructor de TarmDetRepDestruirArmas +@param pPk Clave Primaria del entity +@param pCreporte Codigo del reporte +@param pCdecomisoarma Codigo de decomiso arma +*/ +public TarmDetRepDestruirArmas(Integer pPk,Integer pCreporte,String pCdecomisoarma){ + this(); + pk=pPk; + creporte=pCreporte; + cdecomisoarma=pCdecomisoarma; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmDetRepDestruirArmas +*/ +public static TarmDetRepDestruirArmas find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmDetRepDestruirArmas obj = pEntityManager.find(TarmDetRepDestruirArmas.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmDetRepDestruirArmas +@return El objeto que referencia a la Clave primaria de TarmDetRepDestruirArmas +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmDetRepDestruirArmas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmDetRepDestruirArmas +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de creporte +@return valor de creporte*/ +public Integer getCreporte(){ + return creporte; +} +/**Fija el valor de creporte +@param pCreporte nuevo Valor de creporte*/ +public void setCreporte(Integer pCreporte){ + creporte=pCreporte; +} + +/**Obtiene el valor de cdecomisoarma +@return valor de cdecomisoarma*/ +public String getCdecomisoarma(){ + return cdecomisoarma; +} +/**Fija el valor de cdecomisoarma +@param pCdecomisoarma nuevo Valor de cdecomisoarma*/ +public void setCdecomisoarma(String pCdecomisoarma){ + cdecomisoarma=pCdecomisoarma; +} + +/**Obtiene el valor de clase +@return valor de clase*/ +public String getClase(){ + return clase; +} +/**Fija el valor de clase +@param pClase nuevo Valor de clase*/ +public void setClase(String pClase){ + clase=pClase; +} + +/**Obtiene el valor de tipo +@return valor de tipo*/ +public String getTipo(){ + return tipo; +} +/**Fija el valor de tipo +@param pTipo nuevo Valor de tipo*/ +public void setTipo(String pTipo){ + tipo=pTipo; +} + +/**Obtiene el valor de calibre +@return valor de calibre*/ +public String getCalibre(){ + return calibre; +} +/**Fija el valor de calibre +@param pCalibre nuevo Valor de calibre*/ +public void setCalibre(String pCalibre){ + calibre=pCalibre; +} + +/**Obtiene el valor de marca +@return valor de marca*/ +public String getMarca(){ + return marca; +} +/**Fija el valor de marca +@param pMarca nuevo Valor de marca*/ +public void setMarca(String pMarca){ + marca=pMarca; +} + +/**Obtiene el valor de serie +@return valor de serie*/ +public String getSerie(){ + return serie; +} +/**Fija el valor de serie +@param pSerie nuevo Valor de serie*/ +public void setSerie(String pSerie){ + serie=pSerie; +} + +/**Obtiene el valor de cantidad +@return valor de cantidad*/ +public String getCantidad(){ + return cantidad; +} +/**Fija el valor de cantidad +@param pCantidad nuevo Valor de cantidad*/ +public void setCantidad(String pCantidad){ + cantidad=pCantidad; +} + +/**Obtiene el valor de unidad +@return valor de unidad*/ +public String getUnidad(){ + return unidad; +} +/**Fija el valor de unidad +@param pUnidad nuevo Valor de unidad*/ +public void setUnidad(String pUnidad){ + unidad=pUnidad; +} + +/**Obtiene el valor de fdecomiso +@return valor de fdecomiso*/ +public Date getFdecomiso(){ + return fdecomiso; +} +/**Fija el valor de fdecomiso +@param pFdecomiso nuevo Valor de fdecomiso*/ +public void setFdecomiso(Date pFdecomiso){ + fdecomiso=pFdecomiso; +} + +/**Obtiene el valor de propietario +@return valor de propietario*/ +public String getPropietario(){ + return propietario; +} +/**Fija el valor de propietario +@param pPropietario nuevo Valor de propietario*/ +public void setPropietario(String pPropietario){ + propietario=pPropietario; +} + +/**Obtiene el valor de nrecibo +@return valor de nrecibo*/ +public String getNrecibo(){ + return nrecibo; +} +/**Fija el valor de nrecibo +@param pNrecibo nuevo Valor de nrecibo*/ +public void setNrecibo(String pNrecibo){ + nrecibo=pNrecibo; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmDetRepDestruirArmas))return false; + TarmDetRepDestruirArmas that = (TarmDetRepDestruirArmas) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmDetRepDestruirArmas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmDetRepDestruirArmas +*/ +public Object createInstance(){ + TarmDetRepDestruirArmas instance=new TarmDetRepDestruirArmas(); + return instance; +} +/**Clona la entidad TarmDetRepDestruirArmas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmDetRepDestruirArmas p=(TarmDetRepDestruirArmas)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmDocumentoAlfresco.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmDocumentoAlfresco.java new file mode 100644 index 0000000..9b6f06b --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmDocumentoAlfresco.java @@ -0,0 +1,206 @@ +package com.fp.persistence.parmas.soli; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TarmDocumentoAlfresco*/ +@Entity(name="TarmDocumentoAlfresco") +@Table(name="TARMDOCUMENTOALFRESCO") +public class TarmDocumentoAlfresco extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmDocumentoAlfresco +*/ +@Id +@Column(name="DOCALFRESCOCODE" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "DOCUMENTOALFRESCO"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.Number"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "8")}) + @GeneratedValue(generator = "seq_id") +private Long pk; + +/** +* Codigo de catalogo 01Recepcion, 02 Envio +*/ +@Column(name="CATALOG", nullable=true) +private String catalogo; + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de operaciones +*/ +@Column(name="CATALOGCODE", nullable=true) +private String catalogoCode; + +/** +* codigo del perfil +*/ +@Column(name="PERFIL", nullable=true) +private Integer perfil; + +/** +* Codigo de documento +*/ +@Column(name="DOCUMENTO", nullable=true) +private String documento; + +/**Contructor por defecto*/ +public TarmDocumentoAlfresco(){ +} +/**Contructor de TarmDocumentoAlfresco +@param pPk Clave Primaria del entity +*/ +public TarmDocumentoAlfresco(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmDocumentoAlfresco +*/ +public static TarmDocumentoAlfresco find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmDocumentoAlfresco obj = pEntityManager.find(TarmDocumentoAlfresco.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmDocumentoAlfresco +@return El objeto que referencia a la Clave primaria de TarmDocumentoAlfresco +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmDocumentoAlfresco +@param pPk El objeto que referencia a la nueva Clave primaria de TarmDocumentoAlfresco +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/** + * @return the catalogo + */ +public String getCatalogo() { + return catalogo; +} +/** + * @param catalogo the catalogo to set + */ +public void setCatalogo(String catalogo) { + this.catalogo = catalogo; +} +/** + * @return the catalogoCode + */ +public String getCatalogoCode() { + return catalogoCode; +} +/** + * @param catalogoCode the catalogoCode to set + */ +public void setCatalogoCode(String catalogoCode) { + this.catalogoCode = catalogoCode; +} +/** + * @return the perfil + */ +public Integer getPerfil() { + return perfil; +} +/** + * @param perfil the perfil to set + */ +public void setPerfil(Integer perfil) { + this.perfil = perfil; +} +/** + * @return the documento + */ +public String getDocumento() { + return documento; +} +/** + * @param documento the documento to set + */ +public void setDocumento(String documento) { + this.documento = documento; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmDocumentoAlfresco))return false; + TarmDocumentoAlfresco that = (TarmDocumentoAlfresco) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmDocumentoAlfresco +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmDocumentoAlfresco +*/ +public Object createInstance(){ + TarmDocumentoAlfresco instance=new TarmDocumentoAlfresco(); + return instance; +} +/**Clona la entidad TarmDocumentoAlfresco +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmDocumentoAlfresco p=(TarmDocumentoAlfresco)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmDocumentoHabilitante.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmDocumentoHabilitante.java new file mode 100644 index 0000000..8976b82 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmDocumentoHabilitante.java @@ -0,0 +1,395 @@ +package com.fp.persistence.parmas.soli; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMDOCUMENTOHABILITANTE*/ +@Entity(name="TarmDocumentoHabilitante") +@Table(name="TARMDOCUMENTOHABILITANTE") +public class TarmDocumentoHabilitante extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmDocumentoHabilitante +*/ +@Id +@Column(name="CDOCUMENTO" ,nullable=false, updatable=false) +private Long pk; +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="NUMERODOCUMENTO", nullable=true) + +/** +* Numero de documento habilitante +*/ +private String numerodocumento; + +@Column(name="FECHAEMISION", nullable=true) + +/** +* Fecha en la que se emitio el documento +*/ +private Date fechaemision; + +@Column(name="FECHAEXPIRACION", nullable=true) + +/** +* Fecha de expiracion del documento +*/ +private Date fechaexpiracion; + +@Column(name="CSOLICITUD", nullable=true) + +/** +* null +*/ +private String csolicitud; + +@Column(name="XPATH", nullable=true) + +/** +* Ruta en Alfresco donde se almacena el documento Habilitante. +*/ +private String xpath; + +@Column(name="CARMA", nullable=true) + +/** +* null +*/ +private String carma; + +@Column(name="ESTADO", nullable=true) + +/** +* null +*/ +private String estado; + +@Column(name="ESTADOCODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de estado de documento habilitante +*/ +private String estadocode; + +@Column(name="CODIGOARMA", nullable=true) + +/** +* Codigo del arma identificador del arma +*/ +private String codigoarma; + +@Column(name="CTRAMITE", nullable=true) + +/** +* null +*/ +private Long ctramite; + + + +@Column(name="CCENTROCONTROL", nullable=true) + +/** +* CENTRO DE CONTROL +*/ +private String centrocontrol; + +@Column(name="CUENTAREIMPRESION", nullable=true) + +/** +* null +*/ +private Integer cuentareimpresion; + + +@Column(name="FECHACAMBIOEXPIRACION", nullable=true) + +/** +* Fecha de expiracion del documento +*/ +private Date fechacambioexpiracion; +@Column(name="OBSERVACION", nullable=true) + +/** +* CENTRO DE CONTROL +*/ +private String observacion; + +@Column(name="PATHSUSPENCION", nullable=true) + +/** +* Ruta en Alfresco donde se almacena el documento Habilitante. +*/ +private String pathSuspencion; + +/**Contructor por defecto*/ +public TarmDocumentoHabilitante(){ +} +/**Contructor de TarmDocumentoHabilitante +@param pPk Clave Primaria del entity +*/ +public TarmDocumentoHabilitante(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmDocumentoHabilitante +*/ +public static TarmDocumentoHabilitante find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmDocumentoHabilitante obj = pEntityManager.find(TarmDocumentoHabilitante.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmDocumentoHabilitante +@return El objeto que referencia a la Clave primaria de TarmDocumentoHabilitante +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmDocumentoHabilitante +@param pPk El objeto que referencia a la nueva Clave primaria de TarmDocumentoHabilitante +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de numerodocumento +@return valor de numerodocumento*/ +public String getNumerodocumento(){ + return numerodocumento; +} +/**Fija el valor de numerodocumento +@param pNumerodocumento nuevo Valor de numerodocumento*/ +public void setNumerodocumento(String pNumerodocumento){ + numerodocumento=pNumerodocumento; +} + +/**Obtiene el valor de fechaemision +@return valor de fechaemision*/ +public Date getFechaemision(){ + return fechaemision; +} +/**Fija el valor de fechaemision +@param pFechaemision nuevo Valor de fechaemision*/ +public void setFechaemision(Date pFechaemision){ + fechaemision=pFechaemision; +} + +/**Obtiene el valor de fechaexpiracion +@return valor de fechaexpiracion*/ +public Date getFechaexpiracion(){ + return fechaexpiracion; +} +/**Fija el valor de fechaexpiracion +@param pFechaexpiracion nuevo Valor de fechaexpiracion*/ +public void setFechaexpiracion(Date pFechaexpiracion){ + fechaexpiracion=pFechaexpiracion; +} + +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Obtiene el valor de xpath +@return valor de xpath*/ +public String getXpath(){ + return xpath; +} +/**Fija el valor de xpath +@param pXpath nuevo Valor de xpath*/ +public void setXpath(String pXpath){ + xpath=pXpath; +} + +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de estado +@return valor de estado*/ +public String getEstado(){ + return estado; +} +/**Fija el valor de estado +@param pEstado nuevo Valor de estado*/ +public void setEstado(String pEstado){ + estado=pEstado; +} + +/**Obtiene el valor de estadocode +@return valor de estadocode*/ +public String getEstadocode(){ + return estadocode; +} +/**Fija el valor de estadocode +@param pEstadocode nuevo Valor de estadocode*/ +public void setEstadocode(String pEstadocode){ + estadocode=pEstadocode; +} + +/**Obtiene el valor de codigoarma +@return valor de codigoarma*/ +public String getCodigoarma(){ + return codigoarma; +} +/**Fija el valor de codigoarma +@param pCodigoarma nuevo Valor de codigoarma*/ +public void setCodigoarma(String pCodigoarma){ + codigoarma=pCodigoarma; +} + +public String getCentrocontrol() { + return centrocontrol; +} +public void setCentrocontrol(String centrocontrol) { + this.centrocontrol = centrocontrol; +} +/**Obtiene el valor de ctramite +@return valor de ctramite*/ +public Long getCtramite(){ + return ctramite; +} +/**Fija el valor de ctramite +@param pCtramite nuevo Valor de ctramite*/ +public void setCtramite(Long pCtramite){ + ctramite=pCtramite; +} + +/**Obtiene el valor de cuentareimpresion +@return valor de cuentareimpresion*/ +public Integer getCuentareimpresion(){ + return cuentareimpresion; +} +/**Fija el valor de cuentareimpresion +@param pCuentareimpresion nuevo Valor de cuentareimpresion*/ +public void setCuentareimpresion(Integer pCuentareimpresion){ + cuentareimpresion=pCuentareimpresion; +} + +public Date getFechacambioexpiracion() { + return fechacambioexpiracion; +} +public void setFechacambioexpiracion(Date fechacambioexpiracion) { + this.fechacambioexpiracion = fechacambioexpiracion; +} +public String getObservacion() { + return observacion; +} +public void setObservacion(String observacion) { + this.observacion = observacion; +} +public String getPathSuspencion() { + return pathSuspencion; +} +public void setPathSuspencion(String pathSuspencion) { + this.pathSuspencion = pathSuspencion; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmDocumentoHabilitante))return false; + TarmDocumentoHabilitante that = (TarmDocumentoHabilitante) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmDocumentoHabilitante +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmDocumentoHabilitante +*/ +public Object createInstance(){ + TarmDocumentoHabilitante instance=new TarmDocumentoHabilitante(); + return instance; +} +/**Clona la entidad TarmDocumentoHabilitante +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmDocumentoHabilitante p=(TarmDocumentoHabilitante)this.clone(); + return p; +} + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmDocumentoHabilitanteDetall.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmDocumentoHabilitanteDetall.java new file mode 100644 index 0000000..125df66 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmDocumentoHabilitanteDetall.java @@ -0,0 +1,190 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMDOCUMENTOHABILITANTEDETALL*/ +@Entity(name="TarmDocumentoHabilitanteDetall") +@Table(name="TARMDOCUMENTOHABILITANTEDETALL") +public class TarmDocumentoHabilitanteDetall extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmDocumentoHabilitanteDetall +*/ +@Id +@Column(name="CODIGODETALLE" ,nullable=false, updatable=false) +/*@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CODIGODETALLE"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.String"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "6")}) + @GeneratedValue(generator = "seq_id")*/ +private String pk; +@Column(name="CARMA", nullable=true) + +/** +* null +*/ +private String carma; + +@Column(name="CDOCUMENTO", nullable=true) + +/** +* null +*/ +private Long cdocumento; + +@Column(name="CODIGOARMA", nullable=true) + +/** +* null +*/ +private String codigoarma; + +/**Contructor por defecto*/ +public TarmDocumentoHabilitanteDetall(){ +} +/**Contructor de TarmDocumentoHabilitanteDetall +@param pPk Clave Primaria del entity +*/ +public TarmDocumentoHabilitanteDetall(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmDocumentoHabilitanteDetall +*/ +public static TarmDocumentoHabilitanteDetall find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmDocumentoHabilitanteDetall obj = pEntityManager.find(TarmDocumentoHabilitanteDetall.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmDocumentoHabilitanteDetall +@return El objeto que referencia a la Clave primaria de TarmDocumentoHabilitanteDetall +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmDocumentoHabilitanteDetall +@param pPk El objeto que referencia a la nueva Clave primaria de TarmDocumentoHabilitanteDetall +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de cdocumento +@return valor de cdocumento*/ +public Long getCdocumento(){ + return cdocumento; +} +/**Fija el valor de cdocumento +@param pCdocumento nuevo Valor de cdocumento*/ +public void setCdocumento(Long pCdocumento){ + cdocumento=pCdocumento; +} + +/**Obtiene el valor de codigoarma +@return valor de codigoarma*/ +public String getCodigoarma(){ + return codigoarma; +} +/**Fija el valor de codigoarma +@param pCodigoarma nuevo Valor de codigoarma*/ +public void setCodigoarma(String pCodigoarma){ + codigoarma=pCodigoarma; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmDocumentoHabilitanteDetall))return false; + TarmDocumentoHabilitanteDetall that = (TarmDocumentoHabilitanteDetall) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmDocumentoHabilitanteDetall +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmDocumentoHabilitanteDetall +*/ +public Object createInstance(){ + TarmDocumentoHabilitanteDetall instance=new TarmDocumentoHabilitanteDetall(); + return instance; +} +/**Clona la entidad TarmDocumentoHabilitanteDetall +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmDocumentoHabilitanteDetall p=(TarmDocumentoHabilitanteDetall)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmGuardias.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmGuardias.java new file mode 100644 index 0000000..0aaf308 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmGuardias.java @@ -0,0 +1,162 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMGUARDIAS*/ +@Entity(name="TarmGuardias") +@Table(name="TARMGUARDIAS") +public class TarmGuardias extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmGuardias +*/ +@Id +@Column(name="CGUARDIA" ,nullable=false, updatable=false) +private Integer pk; +@Column(name="CEMPRESA", nullable=true) + +/** +* Codigo de persona +*/ +private Integer cempresa; + +@Column(name="ESTADO", nullable=true) + +/** +* null +*/ +private String estado; + +/**Contructor por defecto*/ +public TarmGuardias(){ +} +/**Contructor de TarmGuardias +@param pPk Clave Primaria del entity +*/ +public TarmGuardias(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmGuardias +*/ +public static TarmGuardias find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmGuardias obj = pEntityManager.find(TarmGuardias.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmGuardias +@return El objeto que referencia a la Clave primaria de TarmGuardias +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmGuardias +@param pPk El objeto que referencia a la nueva Clave primaria de TarmGuardias +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de cempresa +@return valor de cempresa*/ +public Integer getCempresa(){ + return cempresa; +} +/**Fija el valor de cempresa +@param pCempresa nuevo Valor de cempresa*/ +public void setCempresa(Integer pCempresa){ + cempresa=pCempresa; +} + +/**Obtiene el valor de estado +@return valor de estado*/ +public String getEstado(){ + return estado; +} +/**Fija el valor de estado +@param pEstado nuevo Valor de estado*/ +public void setEstado(String pEstado){ + estado=pEstado; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmGuardias))return false; + TarmGuardias that = (TarmGuardias) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmGuardias +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmGuardias +*/ +public Object createInstance(){ + TarmGuardias instance=new TarmGuardias(); + return instance; +} +/**Clona la entidad TarmGuardias +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmGuardias p=(TarmGuardias)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmInspeccion.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmInspeccion.java new file mode 100644 index 0000000..66b9ff9 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmInspeccion.java @@ -0,0 +1,365 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMINSPECCION*/ +@Entity(name="TarmInspeccion") +@Table(name="TARMINSPECCION") +public class TarmInspeccion extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmInspeccion +*/ +@Id +@Column(name="CINSPECCION" ,nullable=false, updatable=false) +private Long pk; +@Column(name="APLICADECOMISO", nullable=true) + +/** +* si el tramite se niega, el campo es para validar si aplica decomiso +*/ +private String aplicadecomiso; + +@Column(name="CSOLICITUD", nullable=true) + +/** +* Codigo de solicitud de controld e armas +*/ +private String csolicitud; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona responsable de la inspeccion +*/ +private Integer personcode; + +@Column(name="CTRAMITE", nullable=true) + +/** +* cdigo de la tabla de tramite +*/ +private Long ctramite; + +@Column(name="TRAMITEPROCESO", nullable=true) + +/** +* campo para validar si el tramite o proceso continua +*/ +private String tramiteproceso; + +@Column(name="OBSERVACION", nullable=true) + +/** +* campo de observacin de la inspeccin +*/ +private String observacion; + +@Column(name="FECHAREGISTRO", nullable=true) + +/** +* fecha de registro de la inspeccin +*/ +private Date fecharegistro; + +@Column(name="NUMORDENTRABAJO", nullable=true) + +/** +* null +*/ +private String numordentrabajo; + +@Column(name="CSITIOALMACENAMIENTO", nullable=true) + +/** +* cdigo de la tabla de sitios de almacenamiento +*/ +private String csitioalmacenamiento; + +@Column(name="CPLANIFICACIONTRAMITE", nullable=true) + +/** +* codigo de la tabla de planificacion tramite, codigo de la planificacion de la inspeccion +*/ +private Long cplanificaciontramite; + +@Column(name="PLANIFICADO", nullable=true) + +/** +* campo para validar si es el registro de una inspeccion planificada o no planificada +*/ +private String planificado; + +@Column(name="CENTROCONTROL", nullable=true) + +/** +* centro de control al que pertenece la persona que realiza el tramite +*/ +private String centrocontrol; + +@Column(name="ANNO", nullable=true) + +/** +* null +*/ +private Long anno; + +/**Contructor por defecto*/ +public TarmInspeccion(){ +} +/**Contructor de TarmInspeccion +@param pPk Clave Primaria del entity +*/ +public TarmInspeccion(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmInspeccion +*/ +public static TarmInspeccion find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmInspeccion obj = pEntityManager.find(TarmInspeccion.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmInspeccion +@return El objeto que referencia a la Clave primaria de TarmInspeccion +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmInspeccion +@param pPk El objeto que referencia a la nueva Clave primaria de TarmInspeccion +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de aplicadecomiso +@return valor de aplicadecomiso*/ +public String getAplicadecomiso(){ + return aplicadecomiso; +} +/**Fija el valor de aplicadecomiso +@param pAplicadecomiso nuevo Valor de aplicadecomiso*/ +public void setAplicadecomiso(String pAplicadecomiso){ + aplicadecomiso=pAplicadecomiso; +} + +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de ctramite +@return valor de ctramite*/ +public Long getCtramite(){ + return ctramite; +} +/**Fija el valor de ctramite +@param pCtramite nuevo Valor de ctramite*/ +public void setCtramite(Long pCtramite){ + ctramite=pCtramite; +} + +/**Obtiene el valor de tramiteproceso +@return valor de tramiteproceso*/ +public String getTramiteproceso(){ + return tramiteproceso; +} +/**Fija el valor de tramiteproceso +@param pTramiteproceso nuevo Valor de tramiteproceso*/ +public void setTramiteproceso(String pTramiteproceso){ + tramiteproceso=pTramiteproceso; +} + +/**Obtiene el valor de observacion +@return valor de observacion*/ +public String getObservacion(){ + return observacion; +} +/**Fija el valor de observacion +@param pObservacion nuevo Valor de observacion*/ +public void setObservacion(String pObservacion){ + observacion=pObservacion; +} + +/**Obtiene el valor de fecharegistro +@return valor de fecharegistro*/ +public Date getFecharegistro(){ + return fecharegistro; +} +/**Fija el valor de fecharegistro +@param pFecharegistro nuevo Valor de fecharegistro*/ +public void setFecharegistro(Date pFecharegistro){ + fecharegistro=pFecharegistro; +} + +/**Obtiene el valor de numordentrabajo +@return valor de numordentrabajo*/ +public String getNumordentrabajo(){ + return numordentrabajo; +} +/**Fija el valor de numordentrabajo +@param pNumordentrabajo nuevo Valor de numordentrabajo*/ +public void setNumordentrabajo(String pNumordentrabajo){ + numordentrabajo=pNumordentrabajo; +} + +/**Obtiene el valor de csitioalmacenamiento +@return valor de csitioalmacenamiento*/ +public String getCsitioalmacenamiento(){ + return csitioalmacenamiento; +} +/**Fija el valor de csitioalmacenamiento +@param pCsitioalmacenamiento nuevo Valor de csitioalmacenamiento*/ +public void setCsitioalmacenamiento(String pCsitioalmacenamiento){ + csitioalmacenamiento=pCsitioalmacenamiento; +} + +/**Obtiene el valor de cplanificaciontramite +@return valor de cplanificaciontramite*/ +public Long getCplanificaciontramite(){ + return cplanificaciontramite; +} +/**Fija el valor de cplanificaciontramite +@param pCplanificaciontramite nuevo Valor de cplanificaciontramite*/ +public void setCplanificaciontramite(Long pCplanificaciontramite){ + cplanificaciontramite=pCplanificaciontramite; +} + +/**Obtiene el valor de planificado +@return valor de planificado*/ +public String getPlanificado(){ + return planificado; +} +/**Fija el valor de planificado +@param pPlanificado nuevo Valor de planificado*/ +public void setPlanificado(String pPlanificado){ + planificado=pPlanificado; +} +/** + * @return the centrocontrol + */ +public String getCentrocontrol() { + return centrocontrol; +} +/** + * @param centrocontrol the centrocontrol to set + */ +public void setCentrocontrol(String centrocontrol) { + this.centrocontrol = centrocontrol; +} +/** + * @return the anno + */ +public Long getAnno() { + return anno; +} +/** + * @param anno the anno to set + */ +public void setAnno(Long anno) { + this.anno = anno; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmInspeccion))return false; + TarmInspeccion that = (TarmInspeccion) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmInspeccion +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmInspeccion +*/ +public Object createInstance(){ + TarmInspeccion instance=new TarmInspeccion(); + return instance; +} +/**Clona la entidad TarmInspeccion +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmInspeccion p=(TarmInspeccion)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmInspeccionArchivo.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmInspeccionArchivo.java new file mode 100644 index 0000000..7c44f3d --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmInspeccionArchivo.java @@ -0,0 +1,228 @@ +package com.fp.persistence.parmas.soli; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMINSPECCIONARCHIVO*/ +@Entity(name="TarmInspeccionArchivo") +@Table(name="TARMINSPECCIONARCHIVO") +public class TarmInspeccionArchivo extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmInspeccionArchivo +*/ +@Id +@Column(name="CINSPARCH" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CINSPARCH"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.Integer"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "10")}) + @GeneratedValue(generator = "seq_id") +private Integer pk; +@Column(name="CINSPECCION", nullable=true) + +/** +* codigo de la tabla de inspeccin +*/ +private Long cinspeccion; + +@Column(name="DESCRIPCION", nullable=true) + +/** +* null +*/ +private String descripcion; + +@Column(name="XPATH", nullable=true) + +/** +* null +*/ +private String xpath; + +@Column(name="XPATHORIGINAL", nullable=true) + +/** +* null +*/ +private String xpathoriginal; + +@Column(name="OBSERVACION", nullable=true) + +/** +* null +*/ +private String observacion; + +@Column(name="USUARIOCAMBIO", nullable=true) + +/** +* null +*/ +private String usuariocambio; + +/**Contructor por defecto*/ +public TarmInspeccionArchivo(){ +} +/**Contructor de TarmInspeccionArchivo +@param pPk Clave Primaria del entity +*/ +public TarmInspeccionArchivo(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmInspeccionArchivo +*/ +public static TarmInspeccionArchivo find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmInspeccionArchivo obj = pEntityManager.find(TarmInspeccionArchivo.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmInspeccionArchivo +@return El objeto que referencia a la Clave primaria de TarmInspeccionArchivo +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmInspeccionArchivo +@param pPk El objeto que referencia a la nueva Clave primaria de TarmInspeccionArchivo +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de cinspeccion +@return valor de cinspeccion*/ +public Long getCinspeccion(){ + return cinspeccion; +} +/**Fija el valor de cinspeccion +@param pCinspeccion nuevo Valor de cinspeccion*/ +public void setCinspeccion(Long pCinspeccion){ + cinspeccion=pCinspeccion; +} + +/**Obtiene el valor de descripcion +@return valor de descripcion*/ +public String getDescripcion(){ + return descripcion; +} +/**Fija el valor de descripcion +@param pDescripcion nuevo Valor de descripcion*/ +public void setDescripcion(String pDescripcion){ + descripcion=pDescripcion; +} + +/**Obtiene el valor de xpath +@return valor de xpath*/ +public String getXpath(){ + return xpath; +} + + +public String getXpathoriginal() { + return xpathoriginal; +} +public void setXpathoriginal(String xpathoriginal) { + this.xpathoriginal = xpathoriginal; +} +public String getObservacion() { + return observacion; +} +public void setObservacion(String observacion) { + this.observacion = observacion; +} +public String getUsuariocambio() { + return usuariocambio; +} +public void setUsuariocambio(String usuariocambio) { + this.usuariocambio = usuariocambio; +} +/**Fija el valor de xpath +@param pXpath nuevo Valor de xpath*/ +public void setXpath(String pXpath){ + xpath=pXpath; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmInspeccionArchivo))return false; + TarmInspeccionArchivo that = (TarmInspeccionArchivo) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmInspeccionArchivo +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmInspeccionArchivo +*/ +public Object createInstance(){ + TarmInspeccionArchivo instance=new TarmInspeccionArchivo(); + return instance; +} +/**Clona la entidad TarmInspeccionArchivo +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmInspeccionArchivo p=(TarmInspeccionArchivo)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmInvoiceHistory.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmInvoiceHistory.java new file mode 100644 index 0000000..d7b099b --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmInvoiceHistory.java @@ -0,0 +1,252 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package com.fp.persistence.parmas.soli; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; +import java.util.Date; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/** + * + * @author developer2 + */ +@Entity(name = "TarmInvoiceHistory") +@Table(name = "TARMINVOICEHISTORY") +public class TarmInvoiceHistory extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TarmInvoiceHistory + */ + @Id + @Column(name = "ID", nullable = false) + private Integer pk; + /** + * Codigo usuario + */ + @Column(name = "USERCODE", nullable = true) + private String usercode; + /** + * Fecha de generacion de la factura + */ + @Column(name = "REGISTRATIONDATE", nullable = true) + private Timestamp registrationdate; + /** + * codigo de solicitud de la cual se genero la factura + */ + @Column(name = "CSOLICITUD", nullable = true) + private String csolicitud; + /** + * Numero de solicitud ejem: SOL-OOOOOOOO + */ + @Column(name = "SOLICITUDNUMBER", nullable = true) + private String solicitudnumber; + /** + * Numero de tramite ejem: TRA-OOOOOOOO + */ + @Column(name = "TRAMITENUMBER", nullable = true) + private String tramitenumber; + /** + * Path en donde se genero el xml + */ + @Column(name = "PATHFILE", nullable = true) + private String pathfile; + /** + * contenido del xml por seguridad ante modificacion + */ + @Column(name = "CONTENTFILE", nullable = true) + private String contentfile; + /** + * Constructor + */ + public TarmInvoiceHistory() { + } + public TarmInvoiceHistory(Integer ppk) { + this(); + pk=ppk; + } + /** + * Getters y setters + */ + public int getHashValue() { + return hashValue; + } + + public void setHashValue(int hashValue) { + this.hashValue = hashValue; + } + + public Integer getPk() { + return pk; + } + + public void setPk(Integer pk) { + this.pk = pk; + } + + public String getUsercode() { + return usercode; + } + + public void setUsercode(String usercode) { + this.usercode = usercode; + } + + public Timestamp getRegistrationdate() { + return registrationdate; + } + + public void setRegistrationdate(Timestamp registrationdate) { + this.registrationdate = registrationdate; + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public String getSolicitudnumber() { + return solicitudnumber; + } + + public void setSolicitudnumber(String solicitudnumber) { + this.solicitudnumber = solicitudnumber; + } + + public String getTramitenumber() { + return tramitenumber; + } + + public void setTramitenumber(String tramitenumber) { + this.tramitenumber = tramitenumber; + } + + public String getPathfile() { + return pathfile; + } + + public void setPathfile(String pathfile) { + this.pathfile = pathfile; + } + + public String getContentfile() { + return contentfile; + } + + public void setContentfile(String contentfile) { + this.contentfile = contentfile; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TarmArmaPruebas + */ + public static TarmInvoiceHistory find(EntityManager pEntityManager, Object pKey) throws Exception { + TarmInvoiceHistory obj = pEntityManager.find(TarmInvoiceHistory.class, pKey); + return obj; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TarmInvoiceHistory)) { + return false; + } + TarmInvoiceHistory that = (TarmInvoiceHistory) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TarmArmaPruebas + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacion toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacion de la creacion de un bean en blanco + */ + public Object createInstance() { + TarmInvoiceHistory instance = new TarmInvoiceHistory(); + return instance; + } + + /** + * Clona la entidad TarmInvoiceHistory + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TarmInvoiceHistory p = (TarmInvoiceHistory) this.clone(); + return p; + } + +} \ No newline at end of file diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmOrdenTrabajo.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmOrdenTrabajo.java new file mode 100644 index 0000000..7291d3a --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmOrdenTrabajo.java @@ -0,0 +1,330 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMORDENTRABAJO*/ +@Entity(name="TarmOrdenTrabajo") +@Table(name="TARMORDENTRABAJO") +public class TarmOrdenTrabajo extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmOrdenTrabajo +*/ +@Id +@Column(name="CORDENTRABAJO" ,nullable=false, updatable=false) +private Long pk; +@Column(name="CSOLICITUD", nullable=true) + +/** +* Codigo de solicitud de controld e armas +*/ +private String csolicitud; + +@Column(name="CTRAMITE", nullable=true) + +/** +* null +*/ +private Long ctramite; + +@Column(name="FSOLICITUD", nullable=true) + +/** +* null +*/ +private Date fsolicitud; + +@Column(name="DOCUMENTOREFERENCIA", nullable=true) + +/** +* null +*/ +private String documentoreferencia; + +@Column(name="EMPRESASOLICITA", nullable=true) + +/** +* null +*/ +private String empresasolicita; + +@Column(name="DIRECCIONCOMISION", nullable=true) + +/** +* null +*/ +private String direccioncomision; + +@Column(name="RUTA", nullable=true) + +/** +* null +*/ +private String ruta; + +@Column(name="TIEMPOESTIMADO", nullable=true) + +/** +* null +*/ +private String tiempoestimado; + +@Column(name="FINICIO", nullable=true) + +/** +* null +*/ +private Date finicio; + +@Column(name="FFINALIZACION", nullable=true) + +/** +* null +*/ +private Date ffinalizacion; + +@Column(name="OBSERVACIONES", nullable=true) + +/** +* null +*/ +private String observaciones; + +/**Contructor por defecto*/ +public TarmOrdenTrabajo(){ +} +/**Contructor de TarmOrdenTrabajo +@param pPk Clave Primaria del entity +*/ +public TarmOrdenTrabajo(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmOrdenTrabajo +*/ +public static TarmOrdenTrabajo find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmOrdenTrabajo obj = pEntityManager.find(TarmOrdenTrabajo.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmOrdenTrabajo +@return El objeto que referencia a la Clave primaria de TarmOrdenTrabajo +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmOrdenTrabajo +@param pPk El objeto que referencia a la nueva Clave primaria de TarmOrdenTrabajo +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Obtiene el valor de ctramite +@return valor de ctramite*/ +public Long getCtramite(){ + return ctramite; +} +/**Fija el valor de ctramite +@param pCtramite nuevo Valor de ctramite*/ +public void setCtramite(Long pCtramite){ + ctramite=pCtramite; +} + +/**Obtiene el valor de fsolicitud +@return valor de fsolicitud*/ +public Date getFsolicitud(){ + return fsolicitud; +} +/**Fija el valor de fsolicitud +@param pFsolicitud nuevo Valor de fsolicitud*/ +public void setFsolicitud(Date pFsolicitud){ + fsolicitud=pFsolicitud; +} + +/**Obtiene el valor de documentoreferencia +@return valor de documentoreferencia*/ +public String getDocumentoreferencia(){ + return documentoreferencia; +} +/**Fija el valor de documentoreferencia +@param pDocumentoreferencia nuevo Valor de documentoreferencia*/ +public void setDocumentoreferencia(String pDocumentoreferencia){ + documentoreferencia=pDocumentoreferencia; +} + +/**Obtiene el valor de empresasolicita +@return valor de empresasolicita*/ +public String getEmpresasolicita(){ + return empresasolicita; +} +/**Fija el valor de empresasolicita +@param pEmpresasolicita nuevo Valor de empresasolicita*/ +public void setEmpresasolicita(String pEmpresasolicita){ + empresasolicita=pEmpresasolicita; +} + +/**Obtiene el valor de direccioncomision +@return valor de direccioncomision*/ +public String getDireccioncomision(){ + return direccioncomision; +} +/**Fija el valor de direccioncomision +@param pDireccioncomision nuevo Valor de direccioncomision*/ +public void setDireccioncomision(String pDireccioncomision){ + direccioncomision=pDireccioncomision; +} + +/**Obtiene el valor de ruta +@return valor de ruta*/ +public String getRuta(){ + return ruta; +} +/**Fija el valor de ruta +@param pRuta nuevo Valor de ruta*/ +public void setRuta(String pRuta){ + ruta=pRuta; +} + +/**Obtiene el valor de tiempoestimado +@return valor de tiempoestimado*/ +public String getTiempoestimado(){ + return tiempoestimado; +} +/**Fija el valor de tiempoestimado +@param pTiempoestimado nuevo Valor de tiempoestimado*/ +public void setTiempoestimado(String pTiempoestimado){ + tiempoestimado=pTiempoestimado; +} + +/**Obtiene el valor de finicio +@return valor de finicio*/ +public Date getFinicio(){ + return finicio; +} +/**Fija el valor de finicio +@param pFinicio nuevo Valor de finicio*/ +public void setFinicio(Date pFinicio){ + finicio=pFinicio; +} + +/**Obtiene el valor de ffinalizacion +@return valor de ffinalizacion*/ +public Date getFfinalizacion(){ + return ffinalizacion; +} +/**Fija el valor de ffinalizacion +@param pFfinalizacion nuevo Valor de ffinalizacion*/ +public void setFfinalizacion(Date pFfinalizacion){ + ffinalizacion=pFfinalizacion; +} + +/**Obtiene el valor de observaciones +@return valor de observaciones*/ +public String getObservaciones(){ + return observaciones; +} +/**Fija el valor de observaciones +@param pObservaciones nuevo Valor de observaciones*/ +public void setObservaciones(String pObservaciones){ + observaciones=pObservaciones; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmOrdenTrabajo))return false; + TarmOrdenTrabajo that = (TarmOrdenTrabajo) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmOrdenTrabajo +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmOrdenTrabajo +*/ +public Object createInstance(){ + TarmOrdenTrabajo instance=new TarmOrdenTrabajo(); + return instance; +} +/**Clona la entidad TarmOrdenTrabajo +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmOrdenTrabajo p=(TarmOrdenTrabajo)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmOrdenTrabajoCustodios.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmOrdenTrabajoCustodios.java new file mode 100644 index 0000000..026b29c --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmOrdenTrabajoCustodios.java @@ -0,0 +1,263 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMORDENTRABAJOCUSTODIOS*/ +@Entity(name="TarmOrdenTrabajoCustodios") +@Table(name="TARMORDENTRABAJOCUSTODIOS") +public class TarmOrdenTrabajoCustodios extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmOrdenTrabajoCustodios +*/ +@Id +@Column(name="CORDENTRABAJOCUSTODIOS" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CORDENTRABAJOCUSTODIOS"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.Long"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "16")}) +@GeneratedValue(generator = "seq_id") +private Long pk; +@Column(name="GRADO", nullable=true) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String grado; + +@Column(name="GRADOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String gradocodigo; + +@Column(name="CORDENTRABAJO", nullable=true) + +/** +* null +*/ +private Long cordentrabajo; + +@Column(name="CEDULACUSTODIO", nullable=true) + +/** +* null +*/ +private String cedulacustodio; + +@Column(name="NOMBRECUSTODIO", nullable=true) + +/** +* null +*/ +private String nombrecustodio; + +@Column(name="APELLIDOSCUSTIDIO", nullable=true) + +/** +* null +*/ +private String apellidoscustidio; + +@Column(name="OBSERVACIONES", nullable=true) + +/** +* null +*/ +private String observaciones; + +/**Contructor por defecto*/ +public TarmOrdenTrabajoCustodios(){ +} +/**Contructor de TarmOrdenTrabajoCustodios +@param pPk Clave Primaria del entity +*/ +public TarmOrdenTrabajoCustodios(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmOrdenTrabajoCustodios +*/ +public static TarmOrdenTrabajoCustodios find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmOrdenTrabajoCustodios obj = pEntityManager.find(TarmOrdenTrabajoCustodios.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmOrdenTrabajoCustodios +@return El objeto que referencia a la Clave primaria de TarmOrdenTrabajoCustodios +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmOrdenTrabajoCustodios +@param pPk El objeto que referencia a la nueva Clave primaria de TarmOrdenTrabajoCustodios +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de grado +@return valor de grado*/ +public String getGrado(){ + return grado; +} +/**Fija el valor de grado +@param pGrado nuevo Valor de grado*/ +public void setGrado(String pGrado){ + grado=pGrado; +} + +/**Obtiene el valor de gradocodigo +@return valor de gradocodigo*/ +public String getGradocodigo(){ + return gradocodigo; +} +/**Fija el valor de gradocodigo +@param pGradocodigo nuevo Valor de gradocodigo*/ +public void setGradocodigo(String pGradocodigo){ + gradocodigo=pGradocodigo; +} + +/**Obtiene el valor de cordentrabajo +@return valor de cordentrabajo*/ +public Long getCordentrabajo(){ + return cordentrabajo; +} +/**Fija el valor de cordentrabajo +@param pCordentrabajo nuevo Valor de cordentrabajo*/ +public void setCordentrabajo(Long pCordentrabajo){ + cordentrabajo=pCordentrabajo; +} + +/**Obtiene el valor de cedulacustodio +@return valor de cedulacustodio*/ +public String getCedulacustodio(){ + return cedulacustodio; +} +/**Fija el valor de cedulacustodio +@param pCedulacustodio nuevo Valor de cedulacustodio*/ +public void setCedulacustodio(String pCedulacustodio){ + cedulacustodio=pCedulacustodio; +} + +/**Obtiene el valor de nombrecustodio +@return valor de nombrecustodio*/ +public String getNombrecustodio(){ + return nombrecustodio; +} +/**Fija el valor de nombrecustodio +@param pNombrecustodio nuevo Valor de nombrecustodio*/ +public void setNombrecustodio(String pNombrecustodio){ + nombrecustodio=pNombrecustodio; +} + +/**Obtiene el valor de apellidoscustidio +@return valor de apellidoscustidio*/ +public String getApellidoscustidio(){ + return apellidoscustidio; +} +/**Fija el valor de apellidoscustidio +@param pApellidoscustidio nuevo Valor de apellidoscustidio*/ +public void setApellidoscustidio(String pApellidoscustidio){ + apellidoscustidio=pApellidoscustidio; +} + +/**Obtiene el valor de observaciones +@return valor de observaciones*/ +public String getObservaciones() { + return observaciones; +} + +/**Fija el valor de observaciones +@param pObservaciones nuevo Valor de observaciones*/ +public void setObservaciones(String observaciones) { + this.observaciones = observaciones; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmOrdenTrabajoCustodios))return false; + TarmOrdenTrabajoCustodios that = (TarmOrdenTrabajoCustodios) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmOrdenTrabajoCustodios +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmOrdenTrabajoCustodios +*/ +public Object createInstance(){ + TarmOrdenTrabajoCustodios instance=new TarmOrdenTrabajoCustodios(); + return instance; +} +/**Clona la entidad TarmOrdenTrabajoCustodios +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmOrdenTrabajoCustodios p=(TarmOrdenTrabajoCustodios)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSancionDecomiso.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSancionDecomiso.java new file mode 100644 index 0000000..39f9369 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSancionDecomiso.java @@ -0,0 +1,273 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMSANCIONDECOMISO*/ +@Entity(name="TarmSancionDecomiso") +@Table(name="TARMSANCIONDECOMISO") +public class TarmSancionDecomiso extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmSancionDecomiso +*/ +@EmbeddedId +private TarmSancionDecomisoKey pk; +@Column(name="FECHAINICIO", nullable=true) + +/** +* null +*/ +private Date fechainicio; + +@Column(name="NORESOLUCION", nullable=true) + +/** +* Numero de la sancion convertido. SAN-00codigo +*/ +private String noresolucion; + +@Column(name="CTIPOSANCION", nullable=true) + +/** +* Clave primaria de la tabla +*/ +private String ctiposancion; + +@Column(name="FECHAFINAL", nullable=true) + +/** +* Fecha en la que se cumple la sancin +*/ +private Date fechafinal; + +@Column(name="XPATH", nullable=true) + +/** +* xpath del archivo convetido +*/ +private String xpath; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona sancionada +*/ +private Integer personcode; + +@Column(name="CDOCUMENTO", nullable=true) + +/** +* null +*/ +private Long cdocumento; + +@Column(name="CARMA", nullable=true) + +/** +* Codigo de arma +*/ +private String carma; + +/**Contructor por defecto*/ +public TarmSancionDecomiso(){ +} +/**Contructor de TarmSancionDecomiso +@param pPk Clave Primaria del entity +*/ +public TarmSancionDecomiso(TarmSancionDecomisoKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmSancionDecomiso +*/ +public static TarmSancionDecomiso find(EntityManager pEntityManager,TarmSancionDecomisoKey pKey) throws Exception{ + TarmSancionDecomiso obj = pEntityManager.find(TarmSancionDecomiso.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmSancionDecomiso +@return El objeto que referencia a la Clave primaria de TarmSancionDecomiso +*/ +public TarmSancionDecomisoKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmSancionDecomiso +@param pPk El objeto que referencia a la nueva Clave primaria de TarmSancionDecomiso +*/ +public void setPk(TarmSancionDecomisoKey pPk){ + pk=pPk; +} +/**Obtiene el valor de fechainicio +@return valor de fechainicio*/ +public Date getFechainicio(){ + return fechainicio; +} +/**Fija el valor de fechainicio +@param pFechainicio nuevo Valor de fechainicio*/ +public void setFechainicio(Date pFechainicio){ + fechainicio=pFechainicio; +} + +/**Obtiene el valor de noresolucion +@return valor de noresolucion*/ +public String getNoresolucion(){ + return noresolucion; +} +/**Fija el valor de noresolucion +@param pNoresolucion nuevo Valor de noresolucion*/ +public void setNoresolucion(String pNoresolucion){ + noresolucion=pNoresolucion; +} + +/**Obtiene el valor de ctiposancion +@return valor de ctiposancion*/ +public String getCtiposancion(){ + return ctiposancion; +} +/**Fija el valor de ctiposancion +@param pCtiposancion nuevo Valor de ctiposancion*/ +public void setCtiposancion(String pCtiposancion){ + ctiposancion=pCtiposancion; +} + +/**Obtiene el valor de fechafinal +@return valor de fechafinal*/ +public Date getFechafinal(){ + return fechafinal; +} +/**Fija el valor de fechafinal +@param pFechafinal nuevo Valor de fechafinal*/ +public void setFechafinal(Date pFechafinal){ + fechafinal=pFechafinal; +} + +/**Obtiene el valor de xpath +@return valor de xpath*/ +public String getXpath(){ + return xpath; +} +/**Fija el valor de xpath +@param pXpath nuevo Valor de xpath*/ +public void setXpath(String pXpath){ + xpath=pXpath; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de cdocumento +@return valor de cdocumento*/ +public Long getCdocumento(){ + return cdocumento; +} +/**Fija el valor de cdocumento +@param pCdocumento nuevo Valor de cdocumento*/ +public void setCdocumento(Long pCdocumento){ + cdocumento=pCdocumento; +} + +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmSancionDecomiso))return false; + TarmSancionDecomiso that = (TarmSancionDecomiso) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmSancionDecomiso +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmSancionDecomiso +*/ +public Object createInstance(){ + TarmSancionDecomiso instance=new TarmSancionDecomiso(); + instance.setPk(new TarmSancionDecomisoKey()); + return instance; +} +/**Clona la entidad TarmSancionDecomiso +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmSancionDecomiso p=(TarmSancionDecomiso)this.clone(); + p.setPk((TarmSancionDecomisoKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSancionDecomisoKey.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSancionDecomisoKey.java new file mode 100644 index 0000000..c318c8b --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSancionDecomisoKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMSANCIONDECOMISO*/ +@Embeddable +public class TarmSancionDecomisoKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CSANCIONDECOMISO", nullable=false,updatable=false) + +/** +* Codigo de la sancion aplicada +*/ +private String csanciondecomiso; + +@Column(name="CDECOMISO", nullable=false,updatable=false) + +/** +* Codigo del decomiso asociado +*/ +private Long cdecomiso; + +/**Contructor por defecto*/ +public TarmSancionDecomisoKey(){} +/**Contructor de TarmSancionDecomisoKey +@param pCsanciondecomiso Codigo de la sancion aplicada +@param pCdecomiso Codigo del decomiso asociado +*/ +public TarmSancionDecomisoKey(String pCsanciondecomiso,Long pCdecomiso){ + csanciondecomiso=pCsanciondecomiso; + cdecomiso=pCdecomiso; +} +/**Obtiene el valor de csanciondecomiso +@return valor de csanciondecomiso*/ +public String getCsanciondecomiso(){ + return csanciondecomiso; +} +/**Fija el valor de csanciondecomiso +@param pCsanciondecomiso nuevo Valor de csanciondecomiso*/ +public void setCsanciondecomiso(String pCsanciondecomiso){ + csanciondecomiso=pCsanciondecomiso; +} + +/**Obtiene el valor de cdecomiso +@return valor de cdecomiso*/ +public Long getCdecomiso(){ + return cdecomiso; +} +/**Fija el valor de cdecomiso +@param pCdecomiso nuevo Valor de cdecomiso*/ +public void setCdecomiso(Long pCdecomiso){ + cdecomiso=pCdecomiso; +} + +/**Implementacion de la comparacion de TarmSancionDecomisoKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmSancionDecomisoKey))return false; + TarmSancionDecomisoKey that = (TarmSancionDecomisoKey) o; + if (this.getCsanciondecomiso() == null || that.getCsanciondecomiso() == null){ + return false; + } + if (! this.getCsanciondecomiso().equals(that.getCsanciondecomiso())){ + return false; + } + if (this.getCdecomiso() == null || that.getCdecomiso() == null){ + return false; + } + if (! this.getCdecomiso().equals(that.getCdecomiso())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmSancionDecomisoKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCsanciondecomiso() == null ? 0 : this.getCsanciondecomiso().hashCode()); + result = result * 37 + (this.getCdecomiso() == null ? 0 : this.getCdecomiso().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSancionRecomendacion.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSancionRecomendacion.java new file mode 100644 index 0000000..f47d3ac --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSancionRecomendacion.java @@ -0,0 +1,198 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMSANCIONRECOMENDACION*/ +@Entity(name="TarmSancionRecomendacion") +@Table(name="TARMSANCIONRECOMENDACION") +public class TarmSancionRecomendacion extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmSancionRecomendacion +*/ +@Id +@Column(name="CRECOMENDACION" ,nullable=false, updatable=false) +private String pk; +@Column(name="CDECOMISO", nullable=true) + +/** +* Codigo del Decomiso +*/ +private Long cdecomiso; + +@Column(name="CSANCIONDECOMISO", nullable=true) + +/** +* Codigo de la sancion ligada +*/ +private String csanciondecomiso; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de loggeada +*/ +private Integer personcode; + +@Column(name="RECOMENDACION", nullable=true) + +/** +* null +*/ +private String recomendacion; + +/**Contructor por defecto*/ +public TarmSancionRecomendacion(){ +} +/**Contructor de TarmSancionRecomendacion +@param pPk Clave Primaria del entity +*/ +public TarmSancionRecomendacion(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmSancionRecomendacion +*/ +public static TarmSancionRecomendacion find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmSancionRecomendacion obj = pEntityManager.find(TarmSancionRecomendacion.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmSancionRecomendacion +@return El objeto que referencia a la Clave primaria de TarmSancionRecomendacion +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmSancionRecomendacion +@param pPk El objeto que referencia a la nueva Clave primaria de TarmSancionRecomendacion +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de cdecomiso +@return valor de cdecomiso*/ +public Long getCdecomiso(){ + return cdecomiso; +} +/**Fija el valor de cdecomiso +@param pCdecomiso nuevo Valor de cdecomiso*/ +public void setCdecomiso(Long pCdecomiso){ + cdecomiso=pCdecomiso; +} + +/**Obtiene el valor de csanciondecomiso +@return valor de csanciondecomiso*/ +public String getCsanciondecomiso(){ + return csanciondecomiso; +} +/**Fija el valor de csanciondecomiso +@param pCsanciondecomiso nuevo Valor de csanciondecomiso*/ +public void setCsanciondecomiso(String pCsanciondecomiso){ + csanciondecomiso=pCsanciondecomiso; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de recomendacion +@return valor de recomendacion*/ +public String getRecomendacion(){ + return recomendacion; +} +/**Fija el valor de recomendacion +@param pRecomendacion nuevo Valor de recomendacion*/ +public void setRecomendacion(String pRecomendacion){ + recomendacion=pRecomendacion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmSancionRecomendacion))return false; + TarmSancionRecomendacion that = (TarmSancionRecomendacion) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmSancionRecomendacion +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmSancionRecomendacion +*/ +public Object createInstance(){ + TarmSancionRecomendacion instance=new TarmSancionRecomendacion(); + return instance; +} +/**Clona la entidad TarmSancionRecomendacion +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmSancionRecomendacion p=(TarmSancionRecomendacion)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitud.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitud.java new file mode 100644 index 0000000..7a98ac0 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitud.java @@ -0,0 +1,895 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Entity; + +import java.sql.Timestamp; + +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMSOLICITUD + */ +@Entity(name = "TarmSolicitud") +@Table(name = "TARMSOLICITUD") +public class TarmSolicitud extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TarmSolicitud + */ + @Id + @Column(name = "CSOLICITUD", nullable = false, updatable = false) + private String pk; + @Column(name = "LUGARORIGEN", nullable = true) + + /** + * null + */ + private String lugarorigen; + + @Column(name = "ORIGENADQUISICION", nullable = true) + + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String origenadquisicion; + + /** + * ------------------ CODIGO PARA EL TIPO DE PAGO --------------------- + */ + /* + @Column(name = "TIPOPAGO", nullable = true) + + private String tipopago; + + @Column(name = "TIPOPAGOCODIGO", nullable = true) + + private String tipopagocodigo; + + @Column(name = "CTRAMITE", nullable = true) + */ + /** + * null + */ + private Long ctramite; + + @Column(name = "CPROVINCIADESTINO", nullable = true) + + /** + * null + */ + private String cprovinciadestino; + + @Column(name = "LUGARDESTINO", nullable = true) + + /** + * null + */ + private String lugardestino; + + @Column(name = "FREAL", nullable = true) + + /** + * null + */ + private Timestamp freal; + + @Column(name = "MULTA", nullable = true) + + /** + * null + */ + private BigDecimal multa; + + @Column(name = "CPAISORIGEN", nullable = true) + + /** + * null + */ + private String cpaisorigen; + + @Column(name = "CPROVINCIAORIGEN", nullable = true) + + /** + * null + */ + private String cprovinciaorigen; + + @Column(name = "ESTADOCODIGO", nullable = true) + + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String estadocodigo; + + @Column(name = "OBSERVACION", nullable = true) + + /** + * null + */ + private String observacion; + + @Column(name = "CCANTONORIGEN", nullable = true) + + /** + * null + */ + private String ccantonorigen; + + @Column(name = "CCANTONDESTINO", nullable = true) + /** + * null + */ + private String ccantondestino; + + @Column(name = "ESTADO", nullable = true) + + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String estado; + + @Column(name = "FREGISTRO", nullable = true) + + /** + * null + */ + private Date fregistro; + + @Column(name = "NUMEROSOLICITUD", nullable = false) + + /** + * null + */ + private String numerosolicitud; + + @Column(name = "CPAISDESTINO", nullable = true) + + /** + * null + */ + private String cpaisdestino; + + @Column(name = "PERSONCODE", nullable = true) + + /** + * Codigo de persona + */ + private Integer personcode; + + @Column(name = "CCENTROCONTROL", nullable = true) + + /** + * Codigo de tipo de tramite + */ + private String ccentrocontrol; + + @Column(name = "ORIGENADQUISICIONCODIGO", nullable = true) + + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String origenadquisicioncodigo; + + @Column(name = "FVERIFICAREQUISITOS", nullable = true) + + /** + * Fecha en la que se verifica los requisitos de la solicitud + */ + private Date fverificarequisitos; + + @Column(name = "NUMEROCUSTODIOS", nullable = true) + + /** + * Indica el numero de custodios de la solicitud + */ + private Integer numerocustodios; + @Column(name = "NUMERODIASCUSTODIOS", nullable = true) + + /** + * Agregado la cantidad de dias que se utilizaran los custodios + */ + private Integer numerodiascustodios; + + @Column(name = "INICIOFLUJO", nullable = true) + /** + * null + */ + private String inicioFlujo; + + @Column(name = "AUCP", nullable = true) + /** + * Codigo de solicitud AUCP + */ + private String aucp; + + @Column(name = "XPATHACTA", nullable = true) + + /** + * null + */ + private String xpathacta; + + @Column(name = "TIPODOCUMENTOORIGEN", nullable = true) + + /** + * Codigo de catalogo 01 Cdula, 02 Ruc + */ + private String tipodocumentoorigen; + + @Column(name = "NUMERODOCUMENTOORIGEN", nullable = true) + + /** + * Nmero de documento de la persna o empresa que realiza la compra + */ + private String numerodocumentoorigen; + + @Column(name = "NOMBRERAZONSOCIALORIGEN", nullable = true) + /** + * Nombre de la persona o empresa de la compra + */ + private String nombrerazonsocialorigen; + + /** + * Contructor por defecto + */ + public TarmSolicitud() { + } + + /** + * Contructor de TarmSolicitud + * + * @param pPk Clave Primaria del entity + * @param pNumerosolicitud null + */ + public TarmSolicitud(String pPk, String pNumerosolicitud) { + this(); + pk = pPk; + numerosolicitud = pNumerosolicitud; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TarmSolicitud + */ + public static TarmSolicitud find(EntityManager pEntityManager, Object pKey) throws Exception { + TarmSolicitud obj = pEntityManager.find(TarmSolicitud.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TarmSolicitud + * + * @return El objeto que referencia a la Clave primaria de TarmSolicitud + */ + public String getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TarmSolicitud + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TarmSolicitud + */ + public void setPk(String pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de lugarorigen + * + * @return valor de lugarorigen + */ + public String getLugarorigen() { + return lugarorigen; + } + + /** + * Fija el valor de lugarorigen + * + * @param pLugarorigen nuevo Valor de lugarorigen + */ + public void setLugarorigen(String pLugarorigen) { + lugarorigen = pLugarorigen; + } + + /** + * Obtiene el valor de origenadquisicion + * + * @return valor de origenadquisicion + */ + public String getOrigenadquisicion() { + return origenadquisicion; + } + + /** + * Fija el valor de origenadquisicion + * + * @param pOrigenadquisicion nuevo Valor de origenadquisicion + */ + public void setOrigenadquisicion(String pOrigenadquisicion) { + origenadquisicion = pOrigenadquisicion; + } + + /** + * Obtiene el valor de ctramite + * + * @return valor de ctramite + */ + public Long getCtramite() { + return ctramite; + } + + /** + * Fija el valor de ctramite + * + * @param pCtramite nuevo Valor de ctramite + */ + public void setCtramite(Long pCtramite) { + ctramite = pCtramite; + } + + /** + * Obtiene el valor de cprovinciadestino + * + * @return valor de cprovinciadestino + */ + public String getCprovinciadestino() { + return cprovinciadestino; + } + + /** + * Fija el valor de cprovinciadestino + * + * @param pCprovinciadestino nuevo Valor de cprovinciadestino + */ + public void setCprovinciadestino(String pCprovinciadestino) { + cprovinciadestino = pCprovinciadestino; + } + + /** + * Obtiene el valor de lugardestino + * + * @return valor de lugardestino + */ + public String getLugardestino() { + return lugardestino; + } + + /** + * Fija el valor de lugardestino + * + * @param pLugardestino nuevo Valor de lugardestino + */ + public void setLugardestino(String pLugardestino) { + lugardestino = pLugardestino; + } + + /** + * Obtiene el valor de freal + * + * @return valor de freal + */ + public Timestamp getFreal() { + return freal; + } + + /** + * Fija el valor de freal + * + * @param pFreal nuevo Valor de freal + */ + public void setFreal(Timestamp pFreal) { + freal = pFreal; + } + + /** + * Obtiene el valor de multa + * + * @return valor de multa + */ + public BigDecimal getMulta() { + return multa; + } + + /** + * Fija el valor de multa + * + * @param pMulta nuevo Valor de multa + */ + public void setMulta(BigDecimal pMulta) { + multa = pMulta; + } + + /** + * Obtiene el valor de cpaisorigen + * + * @return valor de cpaisorigen + */ + public String getCpaisorigen() { + return cpaisorigen; + } + + /** + * Fija el valor de cpaisorigen + * + * @param pCpaisorigen nuevo Valor de cpaisorigen + */ + public void setCpaisorigen(String pCpaisorigen) { + cpaisorigen = pCpaisorigen; + } + + /** + * Obtiene el valor de cprovinciaorigen + * + * @return valor de cprovinciaorigen + */ + public String getCprovinciaorigen() { + return cprovinciaorigen; + } + + /** + * Fija el valor de cprovinciaorigen + * + * @param pCprovinciaorigen nuevo Valor de cprovinciaorigen + */ + public void setCprovinciaorigen(String pCprovinciaorigen) { + cprovinciaorigen = pCprovinciaorigen; + } + + /** + * Obtiene el valor de estadocodigo + * + * @return valor de estadocodigo + */ + public String getEstadocodigo() { + return estadocodigo; + } + + /** + * Fija el valor de estadocodigo + * + * @param pEstadocodigo nuevo Valor de estadocodigo + */ + public void setEstadocodigo(String pEstadocodigo) { + estadocodigo = pEstadocodigo; + } + + /** + * Obtiene el valor de observacion + * + * @return valor de observacion + */ + public String getObservacion() { + return observacion; + } + + /** + * Fija el valor de observacion + * + * @param pObservacion nuevo Valor de observacion + */ + public void setObservacion(String pObservacion) { + observacion = pObservacion; + } + + /** + * Obtiene el valor de ccantonorigen + * + * @return valor de ccantonorigen + */ + public String getCcantonorigen() { + return ccantonorigen; + } + + /** + * Fija el valor de ccantonorigen + * + * @param pCcantonorigen nuevo Valor de ccantonorigen + */ + public void setCcantonorigen(String pCcantonorigen) { + ccantonorigen = pCcantonorigen; + } + + /** + * Obtiene el valor de ccantondestino + * + * @return valor de ccantondestino + */ + public String getCcantondestino() { + return ccantondestino; + } + + /** + * Fija el valor de ccantondestino + * + * @param pCcantondestino nuevo Valor de ccantondestino + */ + public void setCcantondestino(String pCcantondestino) { + ccantondestino = pCcantondestino; + } + + /** + * Obtiene el valor de estado + * + * @return valor de estado + */ + public String getEstado() { + return estado; + } + + /** + * Fija el valor de estado + * + * @param pEstado nuevo Valor de estado + */ + public void setEstado(String pEstado) { + estado = pEstado; + } + + /** + * Obtiene el valor de fregistro + * + * @return valor de fregistro + */ + public Date getFregistro() { + return fregistro; + } + + /** + * Fija el valor de fregistro + * + * @param pFregistro nuevo Valor de fregistro + */ + public void setFregistro(Date pFregistro) { + fregistro = pFregistro; + } + + /** + * Obtiene el valor de numerosolicitud + * + * @return valor de numerosolicitud + */ + public String getNumerosolicitud() { + return numerosolicitud; + } + + /** + * Fija el valor de numerosolicitud + * + * @param pNumerosolicitud nuevo Valor de numerosolicitud + */ + public void setNumerosolicitud(String pNumerosolicitud) { + numerosolicitud = pNumerosolicitud; + } + + /** + * Obtiene el valor de cpaisdestino + * + * @return valor de cpaisdestino + */ + public String getCpaisdestino() { + return cpaisdestino; + } + + /** + * Fija el valor de cpaisdestino + * + * @param pCpaisdestino nuevo Valor de cpaisdestino + */ + public void setCpaisdestino(String pCpaisdestino) { + cpaisdestino = pCpaisdestino; + } + + /** + * Obtiene el valor de personcode + * + * @return valor de personcode + */ + public Integer getPersoncode() { + return personcode; + } + + /** + * Fija el valor de personcode + * + * @param pPersoncode nuevo Valor de personcode + */ + public void setPersoncode(Integer pPersoncode) { + personcode = pPersoncode; + } + + /** + * Obtiene el valor de ccentrocontrol + * + * @return valor de ccentrocontrol + */ + public String getCcentrocontrol() { + return ccentrocontrol; + } + + /** + * Fija el valor de ccentrocontrol + * + * @param pCcentrocontrol nuevo Valor de ccentrocontrol + */ + public void setCcentrocontrol(String pCcentrocontrol) { + ccentrocontrol = pCcentrocontrol; + } + + /** + * Obtiene el valor de origenadquisicioncodigo + * + * @return valor de origenadquisicioncodigo + */ + public String getOrigenadquisicioncodigo() { + return origenadquisicioncodigo; + } + + /** + * Fija el valor de origenadquisicioncodigo + * + * @param pOrigenadquisicioncodigo nuevo Valor de origenadquisicioncodigo + */ + public void setOrigenadquisicioncodigo(String pOrigenadquisicioncodigo) { + origenadquisicioncodigo = pOrigenadquisicioncodigo; + } + + /** + * Obtiene el valor de fverificarequisitos + * + * @return valor de fverificarequisitos + */ + public Date getFverificarequisitos() { + return fverificarequisitos; + } + + /** + * Fija el valor de fverificarequisitos + * + * @param pFverificarequisitos nuevo Valor de fverificarequisitos + */ + public void setFverificarequisitos(Date pFverificarequisitos) { + fverificarequisitos = pFverificarequisitos; + } + + /** + * Obtiene el valor de numerocustodios + * + * @return valor de numerocustodios + */ + public Integer getNumerocustodios() { + return numerocustodios; + } + + /** + * Fija el valor de numerocustodios + * + * @param pNumerocustodios nuevo Valor de numerocustodios + */ + public void setNumerocustodios(Integer pNumerocustodios) { + numerocustodios = pNumerocustodios; + } + + public void setNumerodiascustodios(Integer numerodiascustodios) { + this.numerodiascustodios = numerodiascustodios; + } + + public Integer getNumerodiascustodios() { + return numerodiascustodios; + } + + public String getInicioFlujo() { + return inicioFlujo; + } + + public void setInicioFlujo(String inicioFlujo) { + this.inicioFlujo = inicioFlujo; + } + + public String getAucp() { + return aucp; + } + + public void setAucp(String aucp) { + this.aucp = aucp; + } + + /** + * Geters y setters Tipo pago + */ + /** + public void setTipopago(String tipopago) { + this.tipopago = tipopago; + } + + public String getTipopago() { + return tipopago; + } + public String getTipopagocodigo() { + return tipopagocodigo; + } + + public void setTipopagocodigo(String tipopagocodigo) { + this.tipopagocodigo = tipopagocodigo; + } + * */ + + + /** + * Obtiene el valor de xpathacta + * + * @return valor de xpathacta + */ + public String getXpathacta() { + return xpathacta; + } + + /** + * Fija el valor de xpathacta + * + * @param xpathacta nuevo Valor de xpathacta + */ + public void setXpathacta(String xpathacta) { + this.xpathacta = xpathacta; + } + + /** + * Obtiene el valor de tipodocumento origen + * + * @return valor de tipodocumento + */ + public String getTipodocumentoorigen() { + return tipodocumentoorigen; + } + + /** + * Fija el valor de tipodocumento origen + * + * @param pTipodocumento nuevo Valor de tipodocumento + */ + public void setTipodocumentoorigen(String pTipodocumentoorigen) { + this.tipodocumentoorigen = pTipodocumentoorigen; + } + + /** + * Obtiene el valor de numerodocumento origen + * + * @return valor de numerodocumento + */ + public String getNumerodocumentoorigen() { + return numerodocumentoorigen; + } + + /** + * Fija el valor de numerodocumento origen + * + * @param pNumerodocumento nuevo Valor de numerodocumento + */ + public void setNumerodocumentoorigen(String pNumerodocumentoorigen) { + this.numerodocumentoorigen = pNumerodocumentoorigen; + } + + /** + * Obtiene el valor de nombrerazonsocial origen + * + * @return valor de nombrerazonsocial + */ + public String getNombrerazonsocialorigen() { + return nombrerazonsocialorigen; + } + + /** + * Fija el valor de nombrerazonsocial origen + * + * @param pNombrerazonsocial nuevo Valor de nombrerazonsocial + */ + public void setNombrerazonsocialorigen(String pNombrerazonsocialorigen) { + this.nombrerazonsocialorigen = pNombrerazonsocialorigen; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TarmSolicitud)) { + return false; + } + TarmSolicitud that = (TarmSolicitud) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TarmSolicitud + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacion toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacion de la creacion de un bean en blanco TarmSolicitud + */ + public Object createInstance() { + TarmSolicitud instance = new TarmSolicitud(); + return instance; + } + + /** + * Clona la entidad TarmSolicitud + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TarmSolicitud p = (TarmSolicitud) this.clone(); + return p; + } + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudAgenciaSucursal.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudAgenciaSucursal.java new file mode 100644 index 0000000..19086b4 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudAgenciaSucursal.java @@ -0,0 +1,163 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMSOLICITUDAGENCIASUCURSAL*/ +@Entity(name="TarmSolicitudAgenciaSucursal") +@Table(name="TARMSOLICITUDAGENCIASUCURSAL") +public class TarmSolicitudAgenciaSucursal extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmSolicitudAgenciaSucursal +*/ +@EmbeddedId +private TarmSolicitudAgenciaSucursalKey pk; +@Column(name="ESTADO", nullable=true) + +/** +* Estado de la agencia en el proceso de la solicitud +*/ +private String estado; + +@Column(name="ESTADOCODIGO", nullable=true) + +/** +* Codigo de tabla de catalogo +*/ +private String estadocodigo; + +/**Contructor por defecto*/ +public TarmSolicitudAgenciaSucursal(){ +} +/**Contructor de TarmSolicitudAgenciaSucursal +@param pPk Clave Primaria del entity +*/ +public TarmSolicitudAgenciaSucursal(TarmSolicitudAgenciaSucursalKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmSolicitudAgenciaSucursal +*/ +public static TarmSolicitudAgenciaSucursal find(EntityManager pEntityManager,TarmSolicitudAgenciaSucursalKey pKey) throws Exception{ + TarmSolicitudAgenciaSucursal obj = pEntityManager.find(TarmSolicitudAgenciaSucursal.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmSolicitudAgenciaSucursal +@return El objeto que referencia a la Clave primaria de TarmSolicitudAgenciaSucursal +*/ +public TarmSolicitudAgenciaSucursalKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmSolicitudAgenciaSucursal +@param pPk El objeto que referencia a la nueva Clave primaria de TarmSolicitudAgenciaSucursal +*/ +public void setPk(TarmSolicitudAgenciaSucursalKey pPk){ + pk=pPk; +} +/**Obtiene el valor de estado +@return valor de estado*/ +public String getEstado(){ + return estado; +} +/**Fija el valor de estado +@param pEstado nuevo Valor de estado*/ +public void setEstado(String pEstado){ + estado=pEstado; +} + +/**Obtiene el valor de estadocodigo +@return valor de estadocodigo*/ +public String getEstadocodigo(){ + return estadocodigo; +} +/**Fija el valor de estadocodigo +@param pEstadocodigo nuevo Valor de estadocodigo*/ +public void setEstadocodigo(String pEstadocodigo){ + estadocodigo=pEstadocodigo; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmSolicitudAgenciaSucursal))return false; + TarmSolicitudAgenciaSucursal that = (TarmSolicitudAgenciaSucursal) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmSolicitudAgenciaSucursal +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmSolicitudAgenciaSucursal +*/ +public Object createInstance(){ + TarmSolicitudAgenciaSucursal instance=new TarmSolicitudAgenciaSucursal(); + instance.setPk(new TarmSolicitudAgenciaSucursalKey()); + return instance; +} +/**Clona la entidad TarmSolicitudAgenciaSucursal +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmSolicitudAgenciaSucursal p=(TarmSolicitudAgenciaSucursal)this.clone(); + p.setPk((TarmSolicitudAgenciaSucursalKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudAgenciaSucursalKey.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudAgenciaSucursalKey.java new file mode 100644 index 0000000..5517f85 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudAgenciaSucursalKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMSOLICITUDAGENCIASUCURSAL*/ +@Embeddable +public class TarmSolicitudAgenciaSucursalKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CAGENCIA", nullable=false,updatable=false) + +/** +* null +*/ +private Long cagencia; + +@Column(name="CSOLICITUD", nullable=false,updatable=false) + +/** +* Codigo de solicitud de controld e armas +*/ +private String csolicitud; + +/**Contructor por defecto*/ +public TarmSolicitudAgenciaSucursalKey(){} +/**Contructor de TarmSolicitudAgenciaSucursalKey +@param pCagencia null +@param pCsolicitud Codigo de solicitud de controld e armas +*/ +public TarmSolicitudAgenciaSucursalKey(Long pCagencia,String pCsolicitud){ + cagencia=pCagencia; + csolicitud=pCsolicitud; +} +/**Obtiene el valor de cagencia +@return valor de cagencia*/ +public Long getCagencia(){ + return cagencia; +} +/**Fija el valor de cagencia +@param pCagencia nuevo Valor de cagencia*/ +public void setCagencia(Long pCagencia){ + cagencia=pCagencia; +} + +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Implementacion de la comparacion de TarmSolicitudAgenciaSucursalKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmSolicitudAgenciaSucursalKey))return false; + TarmSolicitudAgenciaSucursalKey that = (TarmSolicitudAgenciaSucursalKey) o; + if (this.getCagencia() == null || that.getCagencia() == null){ + return false; + } + if (! this.getCagencia().equals(that.getCagencia())){ + return false; + } + if (this.getCsolicitud() == null || that.getCsolicitud() == null){ + return false; + } + if (! this.getCsolicitud().equals(that.getCsolicitud())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmSolicitudAgenciaSucursalKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCagencia() == null ? 0 : this.getCagencia().hashCode()); + result = result * 37 + (this.getCsolicitud() == null ? 0 : this.getCsolicitud().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudArmas.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudArmas.java new file mode 100644 index 0000000..80d5451 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudArmas.java @@ -0,0 +1,186 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMSOLICITUDARMAS*/ +@Entity(name="TarmSolicitudArmas") +@Table(name="TARMSOLICITUDARMAS") +public class TarmSolicitudArmas extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmSolicitudArmas +*/ +@EmbeddedId +private TarmSolicitudArmasKey pk; +@Column(name="ENTREGADA", nullable=true) + +/** +* null +*/ +private String entregada; + +@Column(name="APROBADA", nullable=true) + +/** +* null +*/ +private String aprobada; + +@Column(name="PORDEVOLUCION", nullable=true) + +/** +* null +*/ +private String pordevolucion; + + +/**Contructor por defecto*/ +public TarmSolicitudArmas(){ +} +/**Contructor de TarmSolicitudArmas +@param pPk Clave Primaria del entity +*/ +public TarmSolicitudArmas(TarmSolicitudArmasKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmSolicitudArmas +*/ +public static TarmSolicitudArmas find(EntityManager pEntityManager,TarmSolicitudArmasKey pKey) throws Exception{ + TarmSolicitudArmas obj = pEntityManager.find(TarmSolicitudArmas.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmSolicitudArmas +@return El objeto que referencia a la Clave primaria de TarmSolicitudArmas +*/ +public TarmSolicitudArmasKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmSolicitudArmas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmSolicitudArmas +*/ +public void setPk(TarmSolicitudArmasKey pPk){ + pk=pPk; +} +/**Obtiene el valor de entregada +@return valor de entregada*/ +public String getEntregada(){ + return entregada; +} +/**Fija el valor de entregada +@param pEntregada nuevo Valor de entregada*/ +public void setEntregada(String pEntregada){ + entregada=pEntregada; +} + +/**Obtiene el valor de aprobada +@return valor de aprobada*/ +public String getAprobada(){ + return aprobada; +} +/**Fija el valor de aprobada +@param pAprobada nuevo Valor de aprobada*/ +public void setAprobada(String pAprobada){ + aprobada=pAprobada; +} + +/**Obtiene el valor de pordevolucion +@return valor de aprobada*/ +public String getPordevolucion() { + return pordevolucion; +} +/**Fija el valor de pordevlucion +@param pAprobada nuevo Valor de aprobada*/ +public void setPordevolucion(String pordevolucion) { + this.pordevolucion = pordevolucion; +} + + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmSolicitudArmas))return false; + TarmSolicitudArmas that = (TarmSolicitudArmas) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmSolicitudArmas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmSolicitudArmas +*/ +public Object createInstance(){ + TarmSolicitudArmas instance=new TarmSolicitudArmas(); + instance.setPk(new TarmSolicitudArmasKey()); + return instance; +} +/**Clona la entidad TarmSolicitudArmas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmSolicitudArmas p=(TarmSolicitudArmas)this.clone(); + p.setPk((TarmSolicitudArmasKey)this.pk.cloneMe()); + return p; +} + + + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudArmasKey.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudArmasKey.java new file mode 100644 index 0000000..4d029ea --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudArmasKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMSOLICITUDARMAS*/ +@Embeddable +public class TarmSolicitudArmasKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CSOLICITUD", nullable=false,updatable=false) + +/** +* Codigo de solicitud de controld e armas +*/ +private String csolicitud; + +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="CARMA", nullable=false,updatable=false) + +/** +* null +*/ +private String carma; + +/**Contructor por defecto*/ +public TarmSolicitudArmasKey(){} +/**Contructor de TarmSolicitudArmasKey +@param pCsolicitud Codigo de solicitud de controld e armas +@param pPersoncode Codigo de persona +@param pCarma null +*/ +public TarmSolicitudArmasKey(String pCsolicitud,Integer pPersoncode,String pCarma){ + csolicitud=pCsolicitud; + personcode=pPersoncode; + carma=pCarma; +} +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Implementacion de la comparacion de TarmSolicitudArmasKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmSolicitudArmasKey))return false; + TarmSolicitudArmasKey that = (TarmSolicitudArmasKey) o; + if (this.getCsolicitud() == null || that.getCsolicitud() == null){ + return false; + } + if (! this.getCsolicitud().equals(that.getCsolicitud())){ + return false; + } + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getCarma() == null || that.getCarma() == null){ + return false; + } + if (! this.getCarma().equals(that.getCarma())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmSolicitudArmasKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCsolicitud() == null ? 0 : this.getCsolicitud().hashCode()); + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getCarma() == null ? 0 : this.getCarma().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudDocumento.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudDocumento.java new file mode 100644 index 0000000..d895d6a --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudDocumento.java @@ -0,0 +1,183 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMSOLICITUDDOCUMENTO*/ +@Entity(name="TarmSolicitudDocumento") +@Table(name="TARMSOLICITUDDOCUMENTO") +public class TarmSolicitudDocumento extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmSolicitudDocumento +*/ +@EmbeddedId +private TarmSolicitudDocumentoKey pk; +@Column(name="CHKIMPRESION", nullable=true) + +/** +* null +*/ +private String chkimpresion; + +@Column(name="CHKCERTIFICADO", nullable=true) + +/** +* null +*/ +private String chkcertificado; + +@Column(name="VERIFICADO", nullable=true) + +/** +* null +*/ +private String verificado; + +/**Contructor por defecto*/ +public TarmSolicitudDocumento(){ +} +/**Contructor de TarmSolicitudDocumento +@param pPk Clave Primaria del entity +*/ +public TarmSolicitudDocumento(TarmSolicitudDocumentoKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmSolicitudDocumento +*/ +public static TarmSolicitudDocumento find(EntityManager pEntityManager,TarmSolicitudDocumentoKey pKey) throws Exception{ + TarmSolicitudDocumento obj = pEntityManager.find(TarmSolicitudDocumento.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmSolicitudDocumento +@return El objeto que referencia a la Clave primaria de TarmSolicitudDocumento +*/ +public TarmSolicitudDocumentoKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmSolicitudDocumento +@param pPk El objeto que referencia a la nueva Clave primaria de TarmSolicitudDocumento +*/ +public void setPk(TarmSolicitudDocumentoKey pPk){ + pk=pPk; +} +/**Obtiene el valor de chkimpresion +@return valor de chkimpresion*/ +public String getChkimpresion(){ + return chkimpresion; +} +/**Fija el valor de chkimpresion +@param pChkimpresion nuevo Valor de chkimpresion*/ +public void setChkimpresion(String pChkimpresion){ + chkimpresion=pChkimpresion; +} + +/**Obtiene el valor de chkcertificado +@return valor de chkcertificado*/ +public String getChkcertificado(){ + return chkcertificado; +} +/**Fija el valor de chkcertificado +@param pChkcertificado nuevo Valor de chkcertificado*/ +public void setChkcertificado(String pChkcertificado){ + chkcertificado=pChkcertificado; +} + +/**Obtiene el valor de verificado +@return valor de verificado*/ +public String getVerificado(){ + return verificado; +} +/**Fija el valor de verificado +@param pVerificado nuevo Valor de verificado*/ +public void setVerificado(String pVerificado){ + verificado=pVerificado; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmSolicitudDocumento))return false; + TarmSolicitudDocumento that = (TarmSolicitudDocumento) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmSolicitudDocumento +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmSolicitudDocumento +*/ +public Object createInstance(){ + TarmSolicitudDocumento instance=new TarmSolicitudDocumento(); + instance.setPk(new TarmSolicitudDocumentoKey()); + return instance; +} +/**Clona la entidad TarmSolicitudDocumento +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmSolicitudDocumento p=(TarmSolicitudDocumento)this.clone(); + p.setPk((TarmSolicitudDocumentoKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudDocumentoKey.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudDocumentoKey.java new file mode 100644 index 0000000..c21bbe0 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudDocumentoKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMSOLICITUDDOCUMENTO*/ +@Embeddable +public class TarmSolicitudDocumentoKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CDOCUMENTO", nullable=false,updatable=false) + +/** +* Codigo secuencial del documento habilitante +*/ +private Long cdocumento; + +@Column(name="CSOLICITUD", nullable=false,updatable=false) + +/** +* Codigo de solicitud +*/ +private String csolicitud; + +/**Contructor por defecto*/ +public TarmSolicitudDocumentoKey(){} +/**Contructor de TarmSolicitudDocumentoKey +@param pCdocumento Codigo secuencial del documento habilitante +@param pCsolicitud Codigo de solicitud +*/ +public TarmSolicitudDocumentoKey(Long pCdocumento,String pCsolicitud){ + cdocumento=pCdocumento; + csolicitud=pCsolicitud; +} +/**Obtiene el valor de cdocumento +@return valor de cdocumento*/ +public Long getCdocumento(){ + return cdocumento; +} +/**Fija el valor de cdocumento +@param pCdocumento nuevo Valor de cdocumento*/ +public void setCdocumento(Long pCdocumento){ + cdocumento=pCdocumento; +} + +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Implementacion de la comparacion de TarmSolicitudDocumentoKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmSolicitudDocumentoKey))return false; + TarmSolicitudDocumentoKey that = (TarmSolicitudDocumentoKey) o; + if (this.getCdocumento() == null || that.getCdocumento() == null){ + return false; + } + if (! this.getCdocumento().equals(that.getCdocumento())){ + return false; + } + if (this.getCsolicitud() == null || that.getCsolicitud() == null){ + return false; + } + if (! this.getCsolicitud().equals(that.getCsolicitud())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmSolicitudDocumentoKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCdocumento() == null ? 0 : this.getCdocumento().hashCode()); + result = result * 37 + (this.getCsolicitud() == null ? 0 : this.getCsolicitud().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudGuardias.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudGuardias.java new file mode 100644 index 0000000..1503915 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudGuardias.java @@ -0,0 +1,127 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMSOLICITUDGUARDIAS*/ +@Entity(name="TarmSolicitudGuardias") +@Table(name="TARMSOLICITUDGUARDIAS") +public class TarmSolicitudGuardias extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmSolicitudGuardias +*/ +@EmbeddedId +private TarmSolicitudGuardiasKey pk; +/**Contructor por defecto*/ +public TarmSolicitudGuardias(){ +} +/**Contructor de TarmSolicitudGuardias +@param pPk Clave Primaria del entity +*/ +public TarmSolicitudGuardias(TarmSolicitudGuardiasKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmSolicitudGuardias +*/ +public static TarmSolicitudGuardias find(EntityManager pEntityManager,TarmSolicitudGuardiasKey pKey) throws Exception{ + TarmSolicitudGuardias obj = pEntityManager.find(TarmSolicitudGuardias.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmSolicitudGuardias +@return El objeto que referencia a la Clave primaria de TarmSolicitudGuardias +*/ +public TarmSolicitudGuardiasKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmSolicitudGuardias +@param pPk El objeto que referencia a la nueva Clave primaria de TarmSolicitudGuardias +*/ +public void setPk(TarmSolicitudGuardiasKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmSolicitudGuardias))return false; + TarmSolicitudGuardias that = (TarmSolicitudGuardias) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmSolicitudGuardias +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmSolicitudGuardias +*/ +public Object createInstance(){ + TarmSolicitudGuardias instance=new TarmSolicitudGuardias(); + instance.setPk(new TarmSolicitudGuardiasKey()); + return instance; +} +/**Clona la entidad TarmSolicitudGuardias +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmSolicitudGuardias p=(TarmSolicitudGuardias)this.clone(); + p.setPk((TarmSolicitudGuardiasKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudGuardiasKey.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudGuardiasKey.java new file mode 100644 index 0000000..d8b3b5a --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudGuardiasKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMSOLICITUDGUARDIAS*/ +@Embeddable +public class TarmSolicitudGuardiasKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CSOLICITUD", nullable=false,updatable=false) + +/** +* Codigo de solicitud de controld e armas +*/ +private String csolicitud; + +@Column(name="CEMPRESA", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer cempresa; + +@Column(name="CGUARDIA", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer cguardia; + +/**Contructor por defecto*/ +public TarmSolicitudGuardiasKey(){} +/**Contructor de TarmSolicitudGuardiasKey +@param pCsolicitud Codigo de solicitud de controld e armas +@param pCempresa Codigo de persona +@param pCguardia Codigo de persona +*/ +public TarmSolicitudGuardiasKey(String pCsolicitud,Integer pCempresa,Integer pCguardia){ + csolicitud=pCsolicitud; + cempresa=pCempresa; + cguardia=pCguardia; +} +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Obtiene el valor de cempresa +@return valor de cempresa*/ +public Integer getCempresa(){ + return cempresa; +} +/**Fija el valor de cempresa +@param pCempresa nuevo Valor de cempresa*/ +public void setCempresa(Integer pCempresa){ + cempresa=pCempresa; +} + +/**Obtiene el valor de cguardia +@return valor de cguardia*/ +public Integer getCguardia(){ + return cguardia; +} +/**Fija el valor de cguardia +@param pCguardia nuevo Valor de cguardia*/ +public void setCguardia(Integer pCguardia){ + cguardia=pCguardia; +} + +/**Implementacion de la comparacion de TarmSolicitudGuardiasKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmSolicitudGuardiasKey))return false; + TarmSolicitudGuardiasKey that = (TarmSolicitudGuardiasKey) o; + if (this.getCsolicitud() == null || that.getCsolicitud() == null){ + return false; + } + if (! this.getCsolicitud().equals(that.getCsolicitud())){ + return false; + } + if (this.getCempresa() == null || that.getCempresa() == null){ + return false; + } + if (! this.getCempresa().equals(that.getCempresa())){ + return false; + } + if (this.getCguardia() == null || that.getCguardia() == null){ + return false; + } + if (! this.getCguardia().equals(that.getCguardia())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmSolicitudGuardiasKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCsolicitud() == null ? 0 : this.getCsolicitud().hashCode()); + result = result * 37 + (this.getCempresa() == null ? 0 : this.getCempresa().hashCode()); + result = result * 37 + (this.getCguardia() == null ? 0 : this.getCguardia().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudRequisitos.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudRequisitos.java new file mode 100644 index 0000000..5a96d0a --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudRequisitos.java @@ -0,0 +1,181 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMSOLICITUDREQUISITOS*/ +@Entity(name="TarmSolicitudRequisitos") +@Table(name="TARMSOLICITUDREQUISITOS") +public class TarmSolicitudRequisitos extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmSolicitudRequisitos +*/ +@EmbeddedId +private TarmSolicitudRequisitosKey pk; +@Column(name="CARGADO", nullable=true) + +/** +* null +*/ +private String cargado; + +@Column(name="XPATHREQUISITO", nullable=true) + +/** +* null +*/ +private String xpathrequisito; + +@Column(name="ESTADOVALIDACION", nullable=true) + +/** +* null +*/ +private String estadovalidacion; + +/**Contructor por defecto*/ +public TarmSolicitudRequisitos(){ +} +/**Contructor de TarmSolicitudRequisitos +@param pPk Clave Primaria del entity +*/ +public TarmSolicitudRequisitos(TarmSolicitudRequisitosKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmSolicitudRequisitos +*/ +public static TarmSolicitudRequisitos find(EntityManager pEntityManager,TarmSolicitudRequisitosKey pKey) throws Exception{ + TarmSolicitudRequisitos obj = pEntityManager.find(TarmSolicitudRequisitos.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmSolicitudRequisitos +@return El objeto que referencia a la Clave primaria de TarmSolicitudRequisitos +*/ +public TarmSolicitudRequisitosKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmSolicitudRequisitos +@param pPk El objeto que referencia a la nueva Clave primaria de TarmSolicitudRequisitos +*/ +public void setPk(TarmSolicitudRequisitosKey pPk){ + pk=pPk; +} +/**Obtiene el valor de cargado +@return valor de cargado*/ +public String getCargado(){ + return cargado; +} +/**Fija el valor de cargado +@param pCargado nuevo Valor de cargado*/ +public void setCargado(String pCargado){ + cargado=pCargado; +} + +/**Obtiene el valor de xpathrequisito +@return valor de xpathrequisito*/ +public String getXpathrequisito(){ + return xpathrequisito; +} +/**Fija el valor de xpathrequisito +@param pXpathrequisito nuevo Valor de xpathrequisito*/ +public void setXpathrequisito(String pXpathrequisito){ + xpathrequisito=pXpathrequisito; +} + +/**Obtiene el valor de estadovalidacion +@return valor de estadovalidacion*/ +public String getEstadovalidacion(){ + return estadovalidacion; +} +/**Fija el valor de estadovalidacion +@param pEstadovalidacion nuevo Valor de estadovalidacion*/ +public void setEstadovalidacion(String pEstadovalidacion){ + estadovalidacion=pEstadovalidacion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmSolicitudRequisitos))return false; + TarmSolicitudRequisitos that = (TarmSolicitudRequisitos) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmSolicitudRequisitos +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmSolicitudRequisitos +*/ +public Object createInstance(){ + TarmSolicitudRequisitos instance=new TarmSolicitudRequisitos(); + instance.setPk(new TarmSolicitudRequisitosKey()); + return instance; +} +/**Clona la entidad TarmSolicitudRequisitos +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmSolicitudRequisitos p=(TarmSolicitudRequisitos)this.clone(); + p.setPk((TarmSolicitudRequisitosKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudRequisitosKey.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudRequisitosKey.java new file mode 100644 index 0000000..f4de8d7 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudRequisitosKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMSOLICITUDREQUISITOS*/ +@Embeddable +public class TarmSolicitudRequisitosKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CSOLICITUD", nullable=false,updatable=false) + +/** +* Codigo de solicitud de controld e armas +*/ +private String csolicitud; + +@Column(name="CREQUISITO", nullable=false,updatable=false) + +/** +* Codigo de requisito +*/ +private String crequisito; + +@Column(name="CTRAMITE", nullable=false,updatable=false) + +/** +* null +*/ +private Long ctramite; + +/**Contructor por defecto*/ +public TarmSolicitudRequisitosKey(){} +/**Contructor de TarmSolicitudRequisitosKey +@param pCsolicitud Codigo de solicitud de controld e armas +@param pCrequisito Codigo de requisito +@param pCtramite null +*/ +public TarmSolicitudRequisitosKey(String pCsolicitud,String pCrequisito,Long pCtramite){ + csolicitud=pCsolicitud; + crequisito=pCrequisito; + ctramite=pCtramite; +} +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Obtiene el valor de crequisito +@return valor de crequisito*/ +public String getCrequisito(){ + return crequisito; +} +/**Fija el valor de crequisito +@param pCrequisito nuevo Valor de crequisito*/ +public void setCrequisito(String pCrequisito){ + crequisito=pCrequisito; +} + +/**Obtiene el valor de ctramite +@return valor de ctramite*/ +public Long getCtramite(){ + return ctramite; +} +/**Fija el valor de ctramite +@param pCtramite nuevo Valor de ctramite*/ +public void setCtramite(Long pCtramite){ + ctramite=pCtramite; +} + +/**Implementacion de la comparacion de TarmSolicitudRequisitosKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmSolicitudRequisitosKey))return false; + TarmSolicitudRequisitosKey that = (TarmSolicitudRequisitosKey) o; + if (this.getCsolicitud() == null || that.getCsolicitud() == null){ + return false; + } + if (! this.getCsolicitud().equals(that.getCsolicitud())){ + return false; + } + if (this.getCrequisito() == null || that.getCrequisito() == null){ + return false; + } + if (! this.getCrequisito().equals(that.getCrequisito())){ + return false; + } + if (this.getCtramite() == null || that.getCtramite() == null){ + return false; + } + if (! this.getCtramite().equals(that.getCtramite())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmSolicitudRequisitosKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCsolicitud() == null ? 0 : this.getCsolicitud().hashCode()); + result = result * 37 + (this.getCrequisito() == null ? 0 : this.getCrequisito().hashCode()); + result = result * 37 + (this.getCtramite() == null ? 0 : this.getCtramite().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudTramite.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudTramite.java new file mode 100644 index 0000000..c8bb823 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudTramite.java @@ -0,0 +1,518 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMSOLICITUDTRAMITE*/ +@Entity(name="TarmSolicitudTramite") +@Table(name="TARMSOLICITUDTRAMITE") +public class TarmSolicitudTramite extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmSolicitudTramite +*/ +@EmbeddedId +private TarmSolicitudTramiteKey pk; +@Column(name="NUMEROTRAMITE", nullable=true) + +/** +* null +*/ +private String numerotramite; + +@Column(name="VALOR", nullable=true) + +/** +* null +*/ +private BigDecimal valor; + +@Column(name="CANTIDAD", nullable=true) + +/** +* null +*/ +private Integer cantidad; + +@Column(name="NUMEROCOMPROBANTE", nullable=true) + +/** +* null +*/ +private String numerocomprobante; + +@Column(name="XPATHCOMPROBANTE", nullable=true) + +/** +* null +*/ +private String xpathcomprobante; + +@Column(name="XPATHRESOLUCION", nullable=true) + +/** +* null +*/ +private String xpathresolucion; + + +@Column(name="VALORVERIFICACION", nullable=true) + +/** +* null +*/ +private BigDecimal valorverificacion; + +@Column(name="FENTREGAARMAS", nullable=true) + +/** +* null +*/ +private Date fentregaarmas; + +@Column(name="VALORAPAGAR", nullable=true) + +/** +* null +*/ +private BigDecimal valorapagar; + +@Column(name="ESTADOTRAMITE", nullable=true) + +/** +* null +*/ +private String estadotramite; + +@Column(name="ESTADOTRAMITECODIGO", nullable=true) + +/** +* null +*/ +private String estadotramitecodigo; + +@Column(name="FECHACOMPROBANTE", nullable=true) + +/** +* null +*/ +private Date fechacomprobante; + +@Column(name="OBSERVACIONDEPOSITO", nullable=true) + +/** +* null +*/ +private String observaciondeposito; + +@Column(name="VALORVERIFICADO", nullable=true) + +/** +* null +*/ +private BigDecimal valorverificado; + + +@Column(name="OBSERVACIONNOVEDAD", nullable=true) + +/** +* null +*/ +private String observacionnovedad; + +@Column(name="VALORTRAMITEARMAS", nullable=true) + +/** +* Es el valor del tramite en caso de ser de tipo costo total o el valor del arma por el numero de armas en caso de ser de tipo costo parcial +*/ +private BigDecimal valortramitearmas; + +@Column(name="VALORMULTA", nullable=true) + +/** +* Es el valor de las multas no canceladas previas, que seran cobradas en este tramite +*/ +private BigDecimal valormulta; + +@Column(name="VALORCUSTODIOS", nullable=true) + +/** +* Es el valor del numero de custodios por el costo de cada custodio en ese tramite +*/ +private BigDecimal valorcustodios; + +@Column(name="INICIOFLUJO", nullable=true) +/** +* null +*/ +private String inicioFlujo; + +@Column(name="INCASHREPORT", nullable=true) +/** +* null +*/ +private String incashreport; + +@Column(name="XPATHCOMPROBANTEORIGINAL", nullable=true) + +/** +* null +*/ +private String xpathcomprobanteorignal; + +@Column(name="OBSERVACION", nullable=true) + +/** +* null +*/ +private String observacion; + +@Column(name="USUARIOCAMBIO", nullable=true) + +/** +* null +*/ +private String usuariocambio; + +/**Contructor por defecto*/ +public TarmSolicitudTramite(){ +} +/**Contructor de TarmSolicitudTramite +@param pPk Clave Primaria del entity +*/ +public TarmSolicitudTramite(TarmSolicitudTramiteKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmSolicitudTramite +*/ +public static TarmSolicitudTramite find(EntityManager pEntityManager,TarmSolicitudTramiteKey pKey) throws Exception{ + TarmSolicitudTramite obj = pEntityManager.find(TarmSolicitudTramite.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmSolicitudTramite +@return El objeto que referencia a la Clave primaria de TarmSolicitudTramite +*/ +public TarmSolicitudTramiteKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmSolicitudTramite +@param pPk El objeto que referencia a la nueva Clave primaria de TarmSolicitudTramite +*/ +public void setPk(TarmSolicitudTramiteKey pPk){ + pk=pPk; +} +/**Obtiene el valor de numerotramite +@return valor de numerotramite*/ +public String getNumerotramite(){ + return numerotramite; +} +/**Fija el valor de numerotramite +@param pNumerotramite nuevo Valor de numerotramite*/ +public void setNumerotramite(String pNumerotramite){ + numerotramite=pNumerotramite; +} + +/**Obtiene el valor de valor +@return valor de valor*/ +public BigDecimal getValor(){ + return valor; +} +/**Fija el valor de valor +@param pValor nuevo Valor de valor*/ +public void setValor(BigDecimal pValor){ + valor=pValor; +} + +/**Obtiene el valor de cantidad +@return valor de cantidad*/ +public Integer getCantidad(){ + return cantidad; +} +/**Fija el valor de cantidad +@param pCantidad nuevo Valor de cantidad*/ +public void setCantidad(Integer pCantidad){ + cantidad=pCantidad; +} + +/**Obtiene el valor de numerocomprobante +@return valor de numerocomprobante*/ +public String getNumerocomprobante(){ + return numerocomprobante; +} +/**Fija el valor de numerocomprobante +@param pNumerocomprobante nuevo Valor de numerocomprobante*/ +public void setNumerocomprobante(String pNumerocomprobante){ + numerocomprobante=pNumerocomprobante; +} + +/**Obtiene el valor de xpathcomprobante +@return valor de xpathcomprobante*/ +public String getXpathcomprobante(){ + return xpathcomprobante; +} +/**Fija el valor de xpathcomprobante +@param pXpathcomprobante nuevo Valor de xpathcomprobante*/ +public void setXpathcomprobante(String pXpathcomprobante){ + xpathcomprobante=pXpathcomprobante; +} + +/**Obtiene el valor de valorverificacion +@return valor de valorverificacion*/ +public BigDecimal getValorverificacion(){ + return valorverificacion; +} +/**Fija el valor de valorverificacion +@param pValorverificacion nuevo Valor de valorverificacion*/ +public void setValorverificacion(BigDecimal pValorverificacion){ + valorverificacion=pValorverificacion; +} + +/**Obtiene el valor de fentregaarmas +@return valor de fentregaarmas*/ +public Date getFentregaarmas(){ + return fentregaarmas; +} +/**Fija el valor de fentregaarmas +@param pFentregaarmas nuevo Valor de fentregaarmas*/ +public void setFentregaarmas(Date pFentregaarmas){ + fentregaarmas=pFentregaarmas; +} + +/**Obtiene el valor de valorapagar +@return valor de valorapagar*/ +public BigDecimal getValorapagar(){ + return valorapagar; +} +/**Fija el valor de valorapagar +@param pValorapagar nuevo Valor de valorapagar*/ +public void setValorapagar(BigDecimal pValorapagar){ + valorapagar=pValorapagar; +} + +/**Obtiene el valor de estadotramite +@return valor de estadotramite*/ +public String getEstadotramite(){ + return estadotramite; +} +/**Fija el valor de estadotramite +@param pEstadotramite nuevo Valor de estadotramite*/ +public void setEstadotramite(String pEstadotramite){ + estadotramite=pEstadotramite; +} + +/**Obtiene el valor de estadotramitecodigo +@return valor de estadotramitecodigo*/ +public String getEstadotramitecodigo(){ + return estadotramitecodigo; +} +/**Fija el valor de estadotramitecodigo +@param pEstadotramitecodigo nuevo Valor de estadotramitecodigo*/ +public void setEstadotramitecodigo(String pEstadotramitecodigo){ + estadotramitecodigo=pEstadotramitecodigo; +} + +/**Obtiene el valor de fechacomprobante +@return valor de fechacomprobante*/ +public Date getFechacomprobante(){ + return fechacomprobante; +} +/**Fija el valor de fechacomprobante +@param pFechacomprobante nuevo Valor de fechacomprobante*/ +public void setFechacomprobante(Date pFechacomprobante){ + fechacomprobante=pFechacomprobante; +} + +/**Obtiene el valor de observacion al verificar deposito +@return valor de observaciondeposito*/ +public String getObservaciondeposito(){ + return observaciondeposito; +} +/**Fija el valor de observacion al verificar deposito +@param pObservaciondeposito nuevo Valor de observaciondeposito*/ +public void setObservaciondeposito(String pObservaciondeposito){ + observaciondeposito=pObservaciondeposito; +} + +/**Obtiene el valor de valorverificado +@return valor de valorverificado*/ +public BigDecimal getValorverificado(){ + return valorverificado; +} +/**Fija el valor de valorverificado +@param pValorverificado nuevo Valor de valorverificado*/ +public void setValorverificado(BigDecimal pValorverificado){ + valorverificado=pValorverificado; +} + +/**Obtiene el valor de observacionnovedad +@return valor de observacionnovedad*/ +public String getObservacionnovedad() { + return observacionnovedad; +} +/**Fija el valor de observacionnovedad +@param pValorverificado nuevo Valor de observacionnovedad*/ +public void setObservacionnovedad(String observacionnovedad) { + this.observacionnovedad = observacionnovedad; +} + + +/**Obtiene el valor de valortramitearmas +@return valor de valortramitearmas*/ +public BigDecimal getValortramitearmas(){ + return valortramitearmas; +} +/**Fija el valor de valortramitearmas +@param pValortramitearmas nuevo Valor de valortramitearmas*/ +public void setValortramitearmas(BigDecimal pValortramitearmas){ + valortramitearmas=pValortramitearmas; +} +/**Obtiene el valor de valorcustodios +@return valor de valorcustodios*/ +public BigDecimal getValorcustodios(){ + return valorcustodios; +} +/**Fija el valor de valorcustodios +@param pValorcustodios nuevo Valor de valorcustodios*/ +public void setValorcustodios(BigDecimal pValorcustodios){ + valorcustodios=pValorcustodios; +} + +/**Obtiene el valor de valormulta +@return valor de valormulta*/ +public BigDecimal getValormulta(){ + return valormulta; +} +/**Fija el valor de valormulta +@param pValormulta nuevo Valor de valormulta*/ +public void setValormulta(BigDecimal pValormulta){ + valormulta=pValormulta; +} + + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmSolicitudTramite))return false; + TarmSolicitudTramite that = (TarmSolicitudTramite) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmSolicitudTramite +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmSolicitudTramite +*/ +public Object createInstance(){ + TarmSolicitudTramite instance=new TarmSolicitudTramite(); + instance.setPk(new TarmSolicitudTramiteKey()); + return instance; +} +/**Clona la entidad TarmSolicitudTramite +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmSolicitudTramite p=(TarmSolicitudTramite)this.clone(); + p.setPk((TarmSolicitudTramiteKey)this.pk.cloneMe()); + return p; +} +public String getInicioFlujo() { + return inicioFlujo; +} +public void setInicioFlujo(String inicioFlujo) { + this.inicioFlujo = inicioFlujo; +} +public String getIncashreport() { + return incashreport; +} +public void setIncashreport(String incashreport) { + this.incashreport = incashreport; +} +public String getXpathresolucion() { + return xpathresolucion; +} +public void setXpathresolucion(String xpathresolucion) { + this.xpathresolucion = xpathresolucion; +} +public String getXpathcomprobanteorignal() { + return xpathcomprobanteorignal; +} +public void setXpathcomprobanteorignal(String xpathcomprobanteorignal) { + this.xpathcomprobanteorignal = xpathcomprobanteorignal; +} +public String getObservacion() { + return observacion; +} +public void setObservacion(String observacion) { + this.observacion = observacion; +} +public String getUsuariocambio() { + return usuariocambio; +} +public void setUsuariocambio(String usuariocambio) { + this.usuariocambio = usuariocambio; +} + + + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudTramiteKey.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudTramiteKey.java new file mode 100644 index 0000000..2cfe6cb --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmSolicitudTramiteKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.parmas.soli; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TARMSOLICITUDTRAMITE*/ +@Embeddable +public class TarmSolicitudTramiteKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CSOLICITUD", nullable=false,updatable=false) + +/** +* Codigo de solicitud de controld e armas +*/ +private String csolicitud; + +@Column(name="CTRAMITE", nullable=false,updatable=false) + +/** +* null +*/ +private Long ctramite; + +/**Contructor por defecto*/ +public TarmSolicitudTramiteKey(){} +/**Contructor de TarmSolicitudTramiteKey +@param pCsolicitud Codigo de solicitud de controld e armas +@param pCtramite null +*/ +public TarmSolicitudTramiteKey(String pCsolicitud,Long pCtramite){ + csolicitud=pCsolicitud; + ctramite=pCtramite; +} +/**Obtiene el valor de csolicitud +@return valor de csolicitud*/ +public String getCsolicitud(){ + return csolicitud; +} +/**Fija el valor de csolicitud +@param pCsolicitud nuevo Valor de csolicitud*/ +public void setCsolicitud(String pCsolicitud){ + csolicitud=pCsolicitud; +} + +/**Obtiene el valor de ctramite +@return valor de ctramite*/ +public Long getCtramite(){ + return ctramite; +} +/**Fija el valor de ctramite +@param pCtramite nuevo Valor de ctramite*/ +public void setCtramite(Long pCtramite){ + ctramite=pCtramite; +} + +/**Implementacion de la comparacion de TarmSolicitudTramiteKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TarmSolicitudTramiteKey))return false; + TarmSolicitudTramiteKey that = (TarmSolicitudTramiteKey) o; + if (this.getCsolicitud() == null || that.getCsolicitud() == null){ + return false; + } + if (! this.getCsolicitud().equals(that.getCsolicitud())){ + return false; + } + if (this.getCtramite() == null || that.getCtramite() == null){ + return false; + } + if (! this.getCtramite().equals(that.getCtramite())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TarmSolicitudTramiteKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCsolicitud() == null ? 0 : this.getCsolicitud().hashCode()); + result = result * 37 + (this.getCtramite() == null ? 0 : this.getCtramite().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmTerminos.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmTerminos.java new file mode 100644 index 0000000..856d0c6 --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmTerminos.java @@ -0,0 +1,189 @@ +package com.fp.persistence.parmas.soli; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMTERMINOS*/ +@Entity(name="TarmTerminos") +@Table(name="TARMTERMINOS") +public class TarmTerminos extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmArmas +*/ +@Id +@Column(name="CTERMINOS" ,nullable=false, updatable=false) +private String pk; + +@Column(name="ACEPTA", nullable=true) + +/** +* null +*/ +private String acepta; + + +@Column(name="IDENTIFICACION", nullable=true) + +/** +* null +*/ +private String identificacion; + +@Column(name="DOCUMENTO", nullable=true) + +/** +* Partida arancelaria +*/ +private String documnto; + +@Column(name="FECHAREGISTRO", nullable=true) + +/** +*/ +private Date fecharegistro; + +/**Contructor por defecto*/ +public TarmTerminos(){ +} +/**Contructor de TarmArmas +@param pPk Clave Primaria del entity +*/ +public TarmTerminos(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmArmas +*/ +public static TarmTerminos find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmTerminos obj = pEntityManager.find(TarmTerminos.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmArmas +@return El objeto que referencia a la Clave primaria de TarmArmas +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmArmas +@param pPk El objeto que referencia a la nueva Clave primaria de TarmArmas +*/ +public void setPk(String pPk){ + pk=pPk; +} + + + +public int getHashValue() { + return hashValue; +} +public void setHashValue(int hashValue) { + this.hashValue = hashValue; +} +public String getAcepta() { + return acepta; +} +public void setAcepta(String acepta) { + this.acepta = acepta; +} + +public String getIdentificacion() { + return identificacion; +} +public void setIdentificacion(String identificacion) { + this.identificacion = identificacion; +} +public String getDocumnto() { + return documnto; +} +public void setDocumnto(String documnto) { + this.documnto = documnto; +} +public Date getFecharegistro() { + return fecharegistro; +} +public void setFecharegistro(Date fecharegistro) { + this.fecharegistro = fecharegistro; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmTerminos))return false; + TarmTerminos that = (TarmTerminos) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmArmas +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmArmas +*/ +public Object createInstance(){ + TarmTerminos instance=new TarmTerminos(); + return instance; +} +/**Clona la entidad TarmArmas +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmTerminos p=(TarmTerminos)this.clone(); + return p; +} + + +} diff --git a/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmTransaccionArmaBodega.java b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmTransaccionArmaBodega.java new file mode 100644 index 0000000..7ebda1e --- /dev/null +++ b/base/persistence/parmas/src/main/java/com/fp/persistence/parmas/soli/TarmTransaccionArmaBodega.java @@ -0,0 +1,260 @@ +package com.fp.persistence.parmas.soli; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TARMTRANSACCIONARMABODEGA*/ +@Entity(name="TarmTransaccionArmaBodega") +@Table(name="TARMTRANSACCIONARMABODEGA") +public class TarmTransaccionArmaBodega extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable, Log { +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TarmTransaccionArmaBodega +*/ +@Id +@Column(name="CTRANARMBODEGA" ,nullable=false, updatable=false) +/*@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CTRANARMBODEGA"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.Long"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "16")}) + @GeneratedValue(generator = "seq_id")*/ +private Long pk; +@Column(name="FECHA", nullable=true) + +/** +* fecha de registro +*/ +private Timestamp fecha; + +@Column(name="CDECOMISOARMATRANSACCION", nullable=true) + +/** +* codigo de la tabla tarmdecomisoarmatransaccion, se genera el codigo de envio y recepcion +*/ +private Long cdecomisoarmatransaccion; + +@Column(name="CARMA", nullable=true) + +/** +* codigo del arma +*/ +private String carma; + +@Column(name="OPERACION", nullable=true) + +/** +* Codigo de catalogo 01Recepcion, 02 Envio +*/ +private String operacion; + +@Column(name="OPERACIONCODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de operaciones +*/ +private String operacioncode; + +@Column(name="CCENTROCONTROLORIGEN", nullable=true) + +/** +* Codigo de centro de control de armas, bodega de origen +*/ +private String ccentrocontrolorigen; + +@Column(name="CCENTROCONTROLDESTINO", nullable=true) + +/** +* Codigo de centro de control de armas, bodega destino +*/ +private String ccentrocontroldestino; + +/**Contructor por defecto*/ +public TarmTransaccionArmaBodega(){ +} +/**Contructor de TarmTransaccionArmaBodega +@param pPk Clave Primaria del entity +*/ +public TarmTransaccionArmaBodega(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TarmTransaccionArmaBodega +*/ +public static TarmTransaccionArmaBodega find(EntityManager pEntityManager,Object pKey) throws Exception{ + TarmTransaccionArmaBodega obj = pEntityManager.find(TarmTransaccionArmaBodega.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TarmTransaccionArmaBodega +@return El objeto que referencia a la Clave primaria de TarmTransaccionArmaBodega +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TarmTransaccionArmaBodega +@param pPk El objeto que referencia a la nueva Clave primaria de TarmTransaccionArmaBodega +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de fecha +@return valor de fecha*/ +public Timestamp getFecha(){ + return fecha; +} +/**Fija el valor de fecha +@param pFecha nuevo Valor de fecha*/ +public void setFecha(Timestamp pFecha){ + fecha=pFecha; +} + +/**Obtiene el valor de cdecomisoarmatransaccion +@return valor de cdecomisoarmatransaccion*/ +public Long getCdecomisoarmatransaccion(){ + return cdecomisoarmatransaccion; +} +/**Fija el valor de cdecomisoarmatransaccion +@param pCdecomisoarmatransaccion nuevo Valor de cdecomisoarmatransaccion*/ +public void setCdecomisoarmatransaccion(Long pCdecomisoarmatransaccion){ + cdecomisoarmatransaccion=pCdecomisoarmatransaccion; +} + +/**Obtiene el valor de carma +@return valor de carma*/ +public String getCarma(){ + return carma; +} +/**Fija el valor de carma +@param pCarma nuevo Valor de carma*/ +public void setCarma(String pCarma){ + carma=pCarma; +} + +/**Obtiene el valor de operacion +@return valor de operacion*/ +public String getOperacion(){ + return operacion; +} +/**Fija el valor de operacion +@param pOperacion nuevo Valor de operacion*/ +public void setOperacion(String pOperacion){ + operacion=pOperacion; +} + +/**Obtiene el valor de operacioncode +@return valor de operacioncode*/ +public String getOperacioncode(){ + return operacioncode; +} +/**Fija el valor de operacioncode +@param pOperacioncode nuevo Valor de operacioncode*/ +public void setOperacioncode(String pOperacioncode){ + operacioncode=pOperacioncode; +} + +/**Obtiene el valor de ccentrocontrolorigen +@return valor de ccentrocontrolorigen*/ +public String getCcentrocontrolorigen(){ + return ccentrocontrolorigen; +} +/**Fija el valor de ccentrocontrolorigen +@param pCcentrocontrolorigen nuevo Valor de ccentrocontrolorigen*/ +public void setCcentrocontrolorigen(String pCcentrocontrolorigen){ + ccentrocontrolorigen=pCcentrocontrolorigen; +} + +/**Obtiene el valor de ccentrocontroldestino +@return valor de ccentrocontroldestino*/ +public String getCcentrocontroldestino(){ + return ccentrocontroldestino; +} +/**Fija el valor de ccentrocontroldestino +@param pCcentrocontroldestino nuevo Valor de ccentrocontroldestino*/ +public void setCcentrocontroldestino(String pCcentrocontroldestino){ + ccentrocontroldestino=pCcentrocontroldestino; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TarmTransaccionArmaBodega))return false; + TarmTransaccionArmaBodega that = (TarmTransaccionArmaBodega) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TarmTransaccionArmaBodega +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TarmTransaccionArmaBodega +*/ +public Object createInstance(){ + TarmTransaccionArmaBodega instance=new TarmTransaccionArmaBodega(); + return instance; +} +/**Clona la entidad TarmTransaccionArmaBodega +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TarmTransaccionArmaBodega p=(TarmTransaccionArmaBodega)this.clone(); + return p; +} +} diff --git a/base/persistence/parmas/src/main/java/ec/.svn/entries b/base/persistence/parmas/src/main/java/ec/.svn/entries new file mode 100644 index 0000000..35b6026 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/main/java/ec +svn://172.17.26.185/COMACO + + + +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +gob +dir + +gov +dir + diff --git a/base/persistence/parmas/src/main/java/ec/gob/.svn/entries b/base/persistence/parmas/src/main/java/ec/gob/.svn/entries new file mode 100644 index 0000000..1acd286 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/main/java/ec/gob +svn://172.17.26.185/COMACO + + + +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +registrocivil +dir + diff --git a/base/persistence/parmas/src/main/java/ec/gob/registrocivil/.svn/entries b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/.svn/entries new file mode 100644 index 0000000..7a8e860 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/main/java/ec/gob/registrocivil +svn://172.17.26.185/COMACO + + + +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +consultacedula +dir + diff --git a/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/entries b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/entries new file mode 100644 index 0000000..32c933d --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/entries @@ -0,0 +1,266 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula +svn://172.17.26.185/COMACO + + + +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +package-info.java +file + + + + +2022-07-28T03:40:27.425737Z +5950548b67d242747301d9f5e1548432 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +146 + +BusquedaPorCedulaResponse.java +file + + + + +2022-07-28T03:40:27.425737Z +f441944505bd8ce09c647948eb25ba0d +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1567 + +BusquedaPorCedula.java +file + + + + +2022-07-28T03:40:27.425737Z +5dda0fa8cf870ce94db3af68f17329ac +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +2897 + +Cedula.java +file + + + + +2022-07-28T03:40:27.426737Z +162c7e687adf50d40d6fc78b1c6bdc7e +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +15823 + +WsUpResponse.java +file + + + + +2022-07-28T03:40:27.426737Z +3ca25d83de6576fdfd639562ede01ad6 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1515 + +ObjectFactory.java +file + + + + +2022-07-28T03:40:27.426737Z +4094941de3897b32aabeb04dd4cfd6a6 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +4234 + +WsUp.java +file + + + + +2022-07-28T03:40:27.427737Z +5ca83a7e2173a9d02946ed7d04c5a491 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +742 + diff --git a/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/BusquedaPorCedula.java.svn-base b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/BusquedaPorCedula.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/BusquedaPorCedula.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/BusquedaPorCedulaResponse.java.svn-base b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/BusquedaPorCedulaResponse.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/BusquedaPorCedulaResponse.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/Cedula.java.svn-base b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/Cedula.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/Cedula.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/ObjectFactory.java.svn-base b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/ObjectFactory.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/ObjectFactory.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/WsUp.java.svn-base b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/WsUp.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/WsUp.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/WsUpResponse.java.svn-base b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/WsUpResponse.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/WsUpResponse.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/package-info.java.svn-base b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/package-info.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/package-info.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/BusquedaPorCedula.java.svn-base b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/BusquedaPorCedula.java.svn-base new file mode 100644 index 0000000..da0d887 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/BusquedaPorCedula.java.svn-base @@ -0,0 +1,118 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para BusquedaPorCedula complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="BusquedaPorCedula">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="Cedula" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Usuario" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Contrasenia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "BusquedaPorCedula", propOrder = { + "cedula", + "usuario", + "contrasenia" +}) +public class BusquedaPorCedula { + + @XmlElement(name = "Cedula") + protected String cedula; + @XmlElement(name = "Usuario") + protected String usuario; + @XmlElement(name = "Contrasenia") + protected String contrasenia; + + /** + * Obtiene el valor de la propiedad cedula. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCedula() { + return cedula; + } + + /** + * Define el valor de la propiedad cedula. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCedula(String value) { + this.cedula = value; + } + + /** + * Obtiene el valor de la propiedad usuario. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUsuario() { + return usuario; + } + + /** + * Define el valor de la propiedad usuario. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUsuario(String value) { + this.usuario = value; + } + + /** + * Obtiene el valor de la propiedad contrasenia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getContrasenia() { + return contrasenia; + } + + /** + * Define el valor de la propiedad contrasenia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setContrasenia(String value) { + this.contrasenia = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/BusquedaPorCedulaResponse.java.svn-base b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/BusquedaPorCedulaResponse.java.svn-base new file mode 100644 index 0000000..4b09b59 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/BusquedaPorCedulaResponse.java.svn-base @@ -0,0 +1,62 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para BusquedaPorCedulaResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="BusquedaPorCedulaResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://www.registrocivil.gob.ec/ConsultaCedula}cedula" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "BusquedaPorCedulaResponse", propOrder = { + "_return" +}) +public class BusquedaPorCedulaResponse { + + @XmlElement(name = "return") + protected Cedula _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link Cedula } + * + */ + public Cedula getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link Cedula } + * + */ + public void setReturn(Cedula value) { + this._return = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/Cedula.java.svn-base b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/Cedula.java.svn-base new file mode 100644 index 0000000..d1bc37d --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/Cedula.java.svn-base @@ -0,0 +1,622 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para cedula complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="cedula">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="CalleDomicilio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Cedula" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="CodigoError" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="CondicionCedulado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Conyuge" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Domicilio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Error" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="EstadoCivil" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="FechaCedulacion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="FechaNacimiento" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="FirmaElectronica" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Genero" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="IndividualDactilar" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Instruccion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="LugarNacimiento" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Nacionalidad" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="NombreMadre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="NombrePadre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Nombre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="NumeroDomicilio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Profesion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "cedula", propOrder = { + "calleDomicilio", + "cedula", + "codigoError", + "condicionCedulado", + "conyuge", + "domicilio", + "error", + "estadoCivil", + "fechaCedulacion", + "fechaNacimiento", + "firmaElectronica", + "genero", + "individualDactilar", + "instruccion", + "lugarNacimiento", + "nacionalidad", + "nombreMadre", + "nombrePadre", + "nombre", + "numeroDomicilio", + "profesion" +}) +public class Cedula { + + @XmlElement(name = "CalleDomicilio") + protected String calleDomicilio; + @XmlElement(name = "Cedula") + protected String cedula; + @XmlElement(name = "CodigoError") + protected String codigoError; + @XmlElement(name = "CondicionCedulado") + protected String condicionCedulado; + @XmlElement(name = "Conyuge") + protected String conyuge; + @XmlElement(name = "Domicilio") + protected String domicilio; + @XmlElement(name = "Error") + protected String error; + @XmlElement(name = "EstadoCivil") + protected String estadoCivil; + @XmlElement(name = "FechaCedulacion") + protected String fechaCedulacion; + @XmlElement(name = "FechaNacimiento") + protected String fechaNacimiento; + @XmlElement(name = "FirmaElectronica") + protected String firmaElectronica; + @XmlElement(name = "Genero") + protected String genero; + @XmlElement(name = "IndividualDactilar") + protected String individualDactilar; + @XmlElement(name = "Instruccion") + protected String instruccion; + @XmlElement(name = "LugarNacimiento") + protected String lugarNacimiento; + @XmlElement(name = "Nacionalidad") + protected String nacionalidad; + @XmlElement(name = "NombreMadre") + protected String nombreMadre; + @XmlElement(name = "NombrePadre") + protected String nombrePadre; + @XmlElement(name = "Nombre") + protected String nombre; + @XmlElement(name = "NumeroDomicilio") + protected String numeroDomicilio; + @XmlElement(name = "Profesion") + protected String profesion; + + /** + * Obtiene el valor de la propiedad calleDomicilio. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCalleDomicilio() { + return calleDomicilio; + } + + /** + * Define el valor de la propiedad calleDomicilio. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCalleDomicilio(String value) { + this.calleDomicilio = value; + } + + /** + * Obtiene el valor de la propiedad cedula. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCedula() { + return cedula; + } + + /** + * Define el valor de la propiedad cedula. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCedula(String value) { + this.cedula = value; + } + + /** + * Obtiene el valor de la propiedad codigoError. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodigoError() { + return codigoError; + } + + /** + * Define el valor de la propiedad codigoError. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodigoError(String value) { + this.codigoError = value; + } + + /** + * Obtiene el valor de la propiedad condicionCedulado. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCondicionCedulado() { + return condicionCedulado; + } + + /** + * Define el valor de la propiedad condicionCedulado. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCondicionCedulado(String value) { + this.condicionCedulado = value; + } + + /** + * Obtiene el valor de la propiedad conyuge. + * + * @return + * possible object is + * {@link String } + * + */ + public String getConyuge() { + return conyuge; + } + + /** + * Define el valor de la propiedad conyuge. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setConyuge(String value) { + this.conyuge = value; + } + + /** + * Obtiene el valor de la propiedad domicilio. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDomicilio() { + return domicilio; + } + + /** + * Define el valor de la propiedad domicilio. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDomicilio(String value) { + this.domicilio = value; + } + + /** + * Obtiene el valor de la propiedad error. + * + * @return + * possible object is + * {@link String } + * + */ + public String getError() { + return error; + } + + /** + * Define el valor de la propiedad error. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setError(String value) { + this.error = value; + } + + /** + * Obtiene el valor de la propiedad estadoCivil. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEstadoCivil() { + return estadoCivil; + } + + /** + * Define el valor de la propiedad estadoCivil. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEstadoCivil(String value) { + this.estadoCivil = value; + } + + /** + * Obtiene el valor de la propiedad fechaCedulacion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaCedulacion() { + return fechaCedulacion; + } + + /** + * Define el valor de la propiedad fechaCedulacion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaCedulacion(String value) { + this.fechaCedulacion = value; + } + + /** + * Obtiene el valor de la propiedad fechaNacimiento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaNacimiento() { + return fechaNacimiento; + } + + /** + * Define el valor de la propiedad fechaNacimiento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaNacimiento(String value) { + this.fechaNacimiento = value; + } + + /** + * Obtiene el valor de la propiedad firmaElectronica. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFirmaElectronica() { + return firmaElectronica; + } + + /** + * Define el valor de la propiedad firmaElectronica. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFirmaElectronica(String value) { + this.firmaElectronica = value; + } + + /** + * Obtiene el valor de la propiedad genero. + * + * @return + * possible object is + * {@link String } + * + */ + public String getGenero() { + return genero; + } + + /** + * Define el valor de la propiedad genero. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setGenero(String value) { + this.genero = value; + } + + /** + * Obtiene el valor de la propiedad individualDactilar. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIndividualDactilar() { + return individualDactilar; + } + + /** + * Define el valor de la propiedad individualDactilar. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIndividualDactilar(String individualDactilar) { + this.individualDactilar = individualDactilar; + } + + /** + * Obtiene el valor de la propiedad instruccion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getInstruccion() { + return instruccion; + } + + /** + * Define el valor de la propiedad instruccion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setInstruccion(String value) { + this.instruccion = value; + } + + /** + * Obtiene el valor de la propiedad lugarNacimiento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLugarNacimiento() { + return lugarNacimiento; + } + + /** + * Define el valor de la propiedad lugarNacimiento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLugarNacimiento(String value) { + this.lugarNacimiento = value; + } + + /** + * Obtiene el valor de la propiedad nacionalidad. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNacionalidad() { + return nacionalidad; + } + + /** + * Define el valor de la propiedad nacionalidad. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNacionalidad(String value) { + this.nacionalidad = value; + } + + /** + * Obtiene el valor de la propiedad nombreMadre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombreMadre() { + return nombreMadre; + } + + /** + * Define el valor de la propiedad nombreMadre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombreMadre(String value) { + this.nombreMadre = value; + } + + /** + * Obtiene el valor de la propiedad nombrePadre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombrePadre() { + return nombrePadre; + } + + /** + * Define el valor de la propiedad nombrePadre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombrePadre(String value) { + this.nombrePadre = value; + } + + /** + * Obtiene el valor de la propiedad nombre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombre() { + return nombre; + } + + /** + * Define el valor de la propiedad nombre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombre(String value) { + this.nombre = value; + } + + /** + * Obtiene el valor de la propiedad numeroDomicilio. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroDomicilio() { + return numeroDomicilio; + } + + /** + * Define el valor de la propiedad numeroDomicilio. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroDomicilio(String value) { + this.numeroDomicilio = value; + } + + /** + * Obtiene el valor de la propiedad profesion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getProfesion() { + return profesion; + } + + /** + * Define el valor de la propiedad profesion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setProfesion(String value) { + this.profesion = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/ObjectFactory.java.svn-base b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/ObjectFactory.java.svn-base new file mode 100644 index 0000000..abf82d2 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/ObjectFactory.java.svn-base @@ -0,0 +1,115 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the ec.gob.registrocivil.consultacedula package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _BusquedaPorCedula_QNAME = new QName("http://www.registrocivil.gob.ec/ConsultaCedula", "BusquedaPorCedula"); + private final static QName _WsUpResponse_QNAME = new QName("http://www.registrocivil.gob.ec/ConsultaCedula", "WsUpResponse"); + private final static QName _BusquedaPorCedulaResponse_QNAME = new QName("http://www.registrocivil.gob.ec/ConsultaCedula", "BusquedaPorCedulaResponse"); + private final static QName _WsUp_QNAME = new QName("http://www.registrocivil.gob.ec/ConsultaCedula", "WsUp"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: ec.gob.registrocivil.consultacedula + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link BusquedaPorCedula } + * + */ + public BusquedaPorCedula createBusquedaPorCedula() { + return new BusquedaPorCedula(); + } + + /** + * Create an instance of {@link WsUp } + * + */ + public WsUp createWsUp() { + return new WsUp(); + } + + /** + * Create an instance of {@link BusquedaPorCedulaResponse } + * + */ + public BusquedaPorCedulaResponse createBusquedaPorCedulaResponse() { + return new BusquedaPorCedulaResponse(); + } + + /** + * Create an instance of {@link WsUpResponse } + * + */ + public WsUpResponse createWsUpResponse() { + return new WsUpResponse(); + } + + /** + * Create an instance of {@link Cedula } + * + */ + public Cedula createCedula() { + return new Cedula(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link BusquedaPorCedula }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.registrocivil.gob.ec/ConsultaCedula", name = "BusquedaPorCedula") + public JAXBElement createBusquedaPorCedula(BusquedaPorCedula value) { + return new JAXBElement(_BusquedaPorCedula_QNAME, BusquedaPorCedula.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link WsUpResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.registrocivil.gob.ec/ConsultaCedula", name = "WsUpResponse") + public JAXBElement createWsUpResponse(WsUpResponse value) { + return new JAXBElement(_WsUpResponse_QNAME, WsUpResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link BusquedaPorCedulaResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.registrocivil.gob.ec/ConsultaCedula", name = "BusquedaPorCedulaResponse") + public JAXBElement createBusquedaPorCedulaResponse(BusquedaPorCedulaResponse value) { + return new JAXBElement(_BusquedaPorCedulaResponse_QNAME, BusquedaPorCedulaResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link WsUp }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.registrocivil.gob.ec/ConsultaCedula", name = "WsUp") + public JAXBElement createWsUp(WsUp value) { + return new JAXBElement(_WsUp_QNAME, WsUp.class, null, value); + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/WsUp.java.svn-base b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/WsUp.java.svn-base new file mode 100644 index 0000000..f03d290 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/WsUp.java.svn-base @@ -0,0 +1,32 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para WsUp complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="WsUp">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "WsUp") +public class WsUp { + + +} diff --git a/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/WsUpResponse.java.svn-base b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/WsUpResponse.java.svn-base new file mode 100644 index 0000000..44d62fa --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/WsUpResponse.java.svn-base @@ -0,0 +1,62 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para WsUpResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="WsUpResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://www.registrocivil.gob.ec/ConsultaCedula}cedula" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "WsUpResponse", propOrder = { + "_return" +}) +public class WsUpResponse { + + @XmlElement(name = "return") + protected Cedula _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link Cedula } + * + */ + public Cedula getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link Cedula } + * + */ + public void setReturn(Cedula value) { + this._return = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/package-info.java.svn-base b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..e1c1722 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.registrocivil.gob.ec/ConsultaCedula") +package ec.gob.registrocivil.consultacedula; diff --git a/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/BusquedaPorCedula.java b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/BusquedaPorCedula.java new file mode 100644 index 0000000..da0d887 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/BusquedaPorCedula.java @@ -0,0 +1,118 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para BusquedaPorCedula complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="BusquedaPorCedula">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="Cedula" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Usuario" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Contrasenia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "BusquedaPorCedula", propOrder = { + "cedula", + "usuario", + "contrasenia" +}) +public class BusquedaPorCedula { + + @XmlElement(name = "Cedula") + protected String cedula; + @XmlElement(name = "Usuario") + protected String usuario; + @XmlElement(name = "Contrasenia") + protected String contrasenia; + + /** + * Obtiene el valor de la propiedad cedula. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCedula() { + return cedula; + } + + /** + * Define el valor de la propiedad cedula. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCedula(String value) { + this.cedula = value; + } + + /** + * Obtiene el valor de la propiedad usuario. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUsuario() { + return usuario; + } + + /** + * Define el valor de la propiedad usuario. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUsuario(String value) { + this.usuario = value; + } + + /** + * Obtiene el valor de la propiedad contrasenia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getContrasenia() { + return contrasenia; + } + + /** + * Define el valor de la propiedad contrasenia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setContrasenia(String value) { + this.contrasenia = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/BusquedaPorCedulaResponse.java b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/BusquedaPorCedulaResponse.java new file mode 100644 index 0000000..4b09b59 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/BusquedaPorCedulaResponse.java @@ -0,0 +1,62 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para BusquedaPorCedulaResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="BusquedaPorCedulaResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://www.registrocivil.gob.ec/ConsultaCedula}cedula" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "BusquedaPorCedulaResponse", propOrder = { + "_return" +}) +public class BusquedaPorCedulaResponse { + + @XmlElement(name = "return") + protected Cedula _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link Cedula } + * + */ + public Cedula getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link Cedula } + * + */ + public void setReturn(Cedula value) { + this._return = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/Cedula.java b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/Cedula.java new file mode 100644 index 0000000..d1bc37d --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/Cedula.java @@ -0,0 +1,622 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para cedula complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="cedula">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="CalleDomicilio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Cedula" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="CodigoError" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="CondicionCedulado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Conyuge" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Domicilio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Error" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="EstadoCivil" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="FechaCedulacion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="FechaNacimiento" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="FirmaElectronica" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Genero" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="IndividualDactilar" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Instruccion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="LugarNacimiento" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Nacionalidad" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="NombreMadre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="NombrePadre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Nombre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="NumeroDomicilio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Profesion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "cedula", propOrder = { + "calleDomicilio", + "cedula", + "codigoError", + "condicionCedulado", + "conyuge", + "domicilio", + "error", + "estadoCivil", + "fechaCedulacion", + "fechaNacimiento", + "firmaElectronica", + "genero", + "individualDactilar", + "instruccion", + "lugarNacimiento", + "nacionalidad", + "nombreMadre", + "nombrePadre", + "nombre", + "numeroDomicilio", + "profesion" +}) +public class Cedula { + + @XmlElement(name = "CalleDomicilio") + protected String calleDomicilio; + @XmlElement(name = "Cedula") + protected String cedula; + @XmlElement(name = "CodigoError") + protected String codigoError; + @XmlElement(name = "CondicionCedulado") + protected String condicionCedulado; + @XmlElement(name = "Conyuge") + protected String conyuge; + @XmlElement(name = "Domicilio") + protected String domicilio; + @XmlElement(name = "Error") + protected String error; + @XmlElement(name = "EstadoCivil") + protected String estadoCivil; + @XmlElement(name = "FechaCedulacion") + protected String fechaCedulacion; + @XmlElement(name = "FechaNacimiento") + protected String fechaNacimiento; + @XmlElement(name = "FirmaElectronica") + protected String firmaElectronica; + @XmlElement(name = "Genero") + protected String genero; + @XmlElement(name = "IndividualDactilar") + protected String individualDactilar; + @XmlElement(name = "Instruccion") + protected String instruccion; + @XmlElement(name = "LugarNacimiento") + protected String lugarNacimiento; + @XmlElement(name = "Nacionalidad") + protected String nacionalidad; + @XmlElement(name = "NombreMadre") + protected String nombreMadre; + @XmlElement(name = "NombrePadre") + protected String nombrePadre; + @XmlElement(name = "Nombre") + protected String nombre; + @XmlElement(name = "NumeroDomicilio") + protected String numeroDomicilio; + @XmlElement(name = "Profesion") + protected String profesion; + + /** + * Obtiene el valor de la propiedad calleDomicilio. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCalleDomicilio() { + return calleDomicilio; + } + + /** + * Define el valor de la propiedad calleDomicilio. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCalleDomicilio(String value) { + this.calleDomicilio = value; + } + + /** + * Obtiene el valor de la propiedad cedula. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCedula() { + return cedula; + } + + /** + * Define el valor de la propiedad cedula. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCedula(String value) { + this.cedula = value; + } + + /** + * Obtiene el valor de la propiedad codigoError. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodigoError() { + return codigoError; + } + + /** + * Define el valor de la propiedad codigoError. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodigoError(String value) { + this.codigoError = value; + } + + /** + * Obtiene el valor de la propiedad condicionCedulado. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCondicionCedulado() { + return condicionCedulado; + } + + /** + * Define el valor de la propiedad condicionCedulado. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCondicionCedulado(String value) { + this.condicionCedulado = value; + } + + /** + * Obtiene el valor de la propiedad conyuge. + * + * @return + * possible object is + * {@link String } + * + */ + public String getConyuge() { + return conyuge; + } + + /** + * Define el valor de la propiedad conyuge. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setConyuge(String value) { + this.conyuge = value; + } + + /** + * Obtiene el valor de la propiedad domicilio. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDomicilio() { + return domicilio; + } + + /** + * Define el valor de la propiedad domicilio. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDomicilio(String value) { + this.domicilio = value; + } + + /** + * Obtiene el valor de la propiedad error. + * + * @return + * possible object is + * {@link String } + * + */ + public String getError() { + return error; + } + + /** + * Define el valor de la propiedad error. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setError(String value) { + this.error = value; + } + + /** + * Obtiene el valor de la propiedad estadoCivil. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEstadoCivil() { + return estadoCivil; + } + + /** + * Define el valor de la propiedad estadoCivil. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEstadoCivil(String value) { + this.estadoCivil = value; + } + + /** + * Obtiene el valor de la propiedad fechaCedulacion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaCedulacion() { + return fechaCedulacion; + } + + /** + * Define el valor de la propiedad fechaCedulacion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaCedulacion(String value) { + this.fechaCedulacion = value; + } + + /** + * Obtiene el valor de la propiedad fechaNacimiento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaNacimiento() { + return fechaNacimiento; + } + + /** + * Define el valor de la propiedad fechaNacimiento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaNacimiento(String value) { + this.fechaNacimiento = value; + } + + /** + * Obtiene el valor de la propiedad firmaElectronica. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFirmaElectronica() { + return firmaElectronica; + } + + /** + * Define el valor de la propiedad firmaElectronica. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFirmaElectronica(String value) { + this.firmaElectronica = value; + } + + /** + * Obtiene el valor de la propiedad genero. + * + * @return + * possible object is + * {@link String } + * + */ + public String getGenero() { + return genero; + } + + /** + * Define el valor de la propiedad genero. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setGenero(String value) { + this.genero = value; + } + + /** + * Obtiene el valor de la propiedad individualDactilar. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIndividualDactilar() { + return individualDactilar; + } + + /** + * Define el valor de la propiedad individualDactilar. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIndividualDactilar(String individualDactilar) { + this.individualDactilar = individualDactilar; + } + + /** + * Obtiene el valor de la propiedad instruccion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getInstruccion() { + return instruccion; + } + + /** + * Define el valor de la propiedad instruccion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setInstruccion(String value) { + this.instruccion = value; + } + + /** + * Obtiene el valor de la propiedad lugarNacimiento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLugarNacimiento() { + return lugarNacimiento; + } + + /** + * Define el valor de la propiedad lugarNacimiento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLugarNacimiento(String value) { + this.lugarNacimiento = value; + } + + /** + * Obtiene el valor de la propiedad nacionalidad. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNacionalidad() { + return nacionalidad; + } + + /** + * Define el valor de la propiedad nacionalidad. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNacionalidad(String value) { + this.nacionalidad = value; + } + + /** + * Obtiene el valor de la propiedad nombreMadre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombreMadre() { + return nombreMadre; + } + + /** + * Define el valor de la propiedad nombreMadre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombreMadre(String value) { + this.nombreMadre = value; + } + + /** + * Obtiene el valor de la propiedad nombrePadre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombrePadre() { + return nombrePadre; + } + + /** + * Define el valor de la propiedad nombrePadre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombrePadre(String value) { + this.nombrePadre = value; + } + + /** + * Obtiene el valor de la propiedad nombre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombre() { + return nombre; + } + + /** + * Define el valor de la propiedad nombre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombre(String value) { + this.nombre = value; + } + + /** + * Obtiene el valor de la propiedad numeroDomicilio. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroDomicilio() { + return numeroDomicilio; + } + + /** + * Define el valor de la propiedad numeroDomicilio. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroDomicilio(String value) { + this.numeroDomicilio = value; + } + + /** + * Obtiene el valor de la propiedad profesion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getProfesion() { + return profesion; + } + + /** + * Define el valor de la propiedad profesion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setProfesion(String value) { + this.profesion = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/ObjectFactory.java b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/ObjectFactory.java new file mode 100644 index 0000000..abf82d2 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/ObjectFactory.java @@ -0,0 +1,115 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the ec.gob.registrocivil.consultacedula package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _BusquedaPorCedula_QNAME = new QName("http://www.registrocivil.gob.ec/ConsultaCedula", "BusquedaPorCedula"); + private final static QName _WsUpResponse_QNAME = new QName("http://www.registrocivil.gob.ec/ConsultaCedula", "WsUpResponse"); + private final static QName _BusquedaPorCedulaResponse_QNAME = new QName("http://www.registrocivil.gob.ec/ConsultaCedula", "BusquedaPorCedulaResponse"); + private final static QName _WsUp_QNAME = new QName("http://www.registrocivil.gob.ec/ConsultaCedula", "WsUp"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: ec.gob.registrocivil.consultacedula + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link BusquedaPorCedula } + * + */ + public BusquedaPorCedula createBusquedaPorCedula() { + return new BusquedaPorCedula(); + } + + /** + * Create an instance of {@link WsUp } + * + */ + public WsUp createWsUp() { + return new WsUp(); + } + + /** + * Create an instance of {@link BusquedaPorCedulaResponse } + * + */ + public BusquedaPorCedulaResponse createBusquedaPorCedulaResponse() { + return new BusquedaPorCedulaResponse(); + } + + /** + * Create an instance of {@link WsUpResponse } + * + */ + public WsUpResponse createWsUpResponse() { + return new WsUpResponse(); + } + + /** + * Create an instance of {@link Cedula } + * + */ + public Cedula createCedula() { + return new Cedula(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link BusquedaPorCedula }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.registrocivil.gob.ec/ConsultaCedula", name = "BusquedaPorCedula") + public JAXBElement createBusquedaPorCedula(BusquedaPorCedula value) { + return new JAXBElement(_BusquedaPorCedula_QNAME, BusquedaPorCedula.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link WsUpResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.registrocivil.gob.ec/ConsultaCedula", name = "WsUpResponse") + public JAXBElement createWsUpResponse(WsUpResponse value) { + return new JAXBElement(_WsUpResponse_QNAME, WsUpResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link BusquedaPorCedulaResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.registrocivil.gob.ec/ConsultaCedula", name = "BusquedaPorCedulaResponse") + public JAXBElement createBusquedaPorCedulaResponse(BusquedaPorCedulaResponse value) { + return new JAXBElement(_BusquedaPorCedulaResponse_QNAME, BusquedaPorCedulaResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link WsUp }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.registrocivil.gob.ec/ConsultaCedula", name = "WsUp") + public JAXBElement createWsUp(WsUp value) { + return new JAXBElement(_WsUp_QNAME, WsUp.class, null, value); + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/WsUp.java b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/WsUp.java new file mode 100644 index 0000000..f03d290 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/WsUp.java @@ -0,0 +1,32 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para WsUp complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="WsUp">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "WsUp") +public class WsUp { + + +} diff --git a/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/WsUpResponse.java b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/WsUpResponse.java new file mode 100644 index 0000000..44d62fa --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/WsUpResponse.java @@ -0,0 +1,62 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para WsUpResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="WsUpResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://www.registrocivil.gob.ec/ConsultaCedula}cedula" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "WsUpResponse", propOrder = { + "_return" +}) +public class WsUpResponse { + + @XmlElement(name = "return") + protected Cedula _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link Cedula } + * + */ + public Cedula getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link Cedula } + * + */ + public void setReturn(Cedula value) { + this._return = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/package-info.java b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/package-info.java new file mode 100644 index 0000000..e1c1722 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gob/registrocivil/consultacedula/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.registrocivil.gob.ec/ConsultaCedula") +package ec.gob.registrocivil.consultacedula; diff --git a/base/persistence/parmas/src/main/java/ec/gov/.svn/entries b/base/persistence/parmas/src/main/java/ec/gov/.svn/entries new file mode 100644 index 0000000..0201d2f --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/main/java/ec/gov +svn://172.17.26.185/COMACO + + + +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +sri +dir + diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/.svn/entries b/base/persistence/parmas/src/main/java/ec/gov/sri/.svn/entries new file mode 100644 index 0000000..742c7f4 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/main/java/ec/gov/sri +svn://172.17.26.185/COMACO + + + +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +wsconsultacontribuyente +dir + diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/entries b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/entries new file mode 100644 index 0000000..85ee03f --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/entries @@ -0,0 +1,674 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente +svn://172.17.26.185/COMACO + + + +2022-04-19T02:46:02.772606Z +4667 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ContribuyenteOnLine.java +file + + + + +2022-07-28T03:40:27.590737Z +f115632345dc8cd0dafb8708e612c47b +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +8364 + +ObtenerCompleto.java +file + + + + +2022-07-28T03:40:27.591737Z +57dd3383617c14ae82b9d6d6b1e9a654 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +2126 + +UbicacionGeografica.java +file + + + + +2022-07-28T03:40:27.591737Z +fe6f2836eb8ee73bedf60d02199479fd +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +7285 + +ActividadEconomica.java +file + + + + +2022-07-28T03:40:27.592737Z +1693a7bf211371571e22c652173e58c5 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +9528 + +ObtenerSimple.java +file + + + + +2022-07-28T03:40:27.592737Z +3b32998ca92a4be17ceccb2195c03777 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +2118 + +ObtenerDatosResponse.java +file + + + + +2022-07-28T03:40:27.592737Z +ca5aa2980a3cb5b5321bc7ef45b3826e +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1619 + +Contador.java +file + + + + +2022-07-28T03:40:27.593738Z +700bb7945266e6c3c373ab906ea3e3ac +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +2625 + +AgenteRetencion.java +file + + + + +2022-07-28T03:40:27.593738Z +2bf618ff8cbafa74dd1596faa930fd2d +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1428 + +ListaBlanca.java +file + + + + +2022-07-28T03:40:27.593738Z +aefe8f81d066c327c5fdb8498e1b243b +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1412 + +ObtenerCompletoResponse.java +file + + + + +2022-07-28T03:40:27.594738Z +d6dd69c8eb6f7ce4254a58a2e8e3ed13 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1643 + +EstructuraOrganizacional.java +file + + + + +2022-07-28T03:40:27.594738Z +203fe5a7d1d044c7eeea74a5d4df5861 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +4036 + +RepresentanteLegal.java +file + + + + +2022-07-28T03:40:27.595738Z +2f57a0b0afb1533f9217e2600dbcd11f +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +2755 + +package-info.java +file + + + + +2022-07-28T03:40:27.595738Z +2fb476d4f82ec86c8fedbfd1b9b33745 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +140 + +TipoContribuyente.java +file + + + + +2022-07-28T03:40:27.595738Z +6b432d305483f28e6a82f97e2dcb8d0f +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +4563 + +ObtenerSimpleResponse.java +file + + + + +2022-07-28T03:40:27.596738Z +9e7f2fc099ed04bb15f834b52f66be0f +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1587 + +ObtenerDatos.java +file + + + + +2022-07-28T03:40:27.596738Z +ea731dd14b51355c4739742c895cdfab +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1443 + +Contribuyente.java +file + + + + +2022-07-28T03:40:27.596738Z +dd8855ccd7e0c83c9b7d943c430d23a4 +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +10867 + +ContribuyenteCompleto.java +file + + + + +2022-07-28T03:40:27.597738Z +6a22d8a9f81f2bed0bd96193213bbe0c +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +16145 + +ObjectFactory.java +file + + + + +2022-07-28T03:40:27.597738Z +e92bf722dfa873263f73a867b8314e0e +2022-04-19T02:46:02.772606Z +4667 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +7859 + diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ActividadEconomica.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ActividadEconomica.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ActividadEconomica.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/AgenteRetencion.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/AgenteRetencion.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/AgenteRetencion.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/Contador.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/Contador.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/Contador.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/Contribuyente.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/Contribuyente.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/Contribuyente.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ContribuyenteCompleto.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ContribuyenteCompleto.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ContribuyenteCompleto.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ContribuyenteOnLine.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ContribuyenteOnLine.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ContribuyenteOnLine.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/EstructuraOrganizacional.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/EstructuraOrganizacional.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/EstructuraOrganizacional.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ListaBlanca.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ListaBlanca.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ListaBlanca.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObjectFactory.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObjectFactory.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObjectFactory.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerCompleto.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerCompleto.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerCompleto.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerCompletoResponse.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerCompletoResponse.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerCompletoResponse.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerDatos.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerDatos.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerDatos.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerDatosResponse.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerDatosResponse.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerDatosResponse.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerSimple.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerSimple.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerSimple.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerSimpleResponse.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerSimpleResponse.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerSimpleResponse.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/RepresentanteLegal.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/RepresentanteLegal.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/RepresentanteLegal.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/TipoContribuyente.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/TipoContribuyente.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/TipoContribuyente.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/UbicacionGeografica.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/UbicacionGeografica.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/UbicacionGeografica.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/package-info.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/package-info.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/package-info.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ActividadEconomica.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ActividadEconomica.java.svn-base new file mode 100644 index 0000000..f87847e --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ActividadEconomica.java.svn-base @@ -0,0 +1,384 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para actividadEconomica complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="actividadEconomica">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="actividadGeneral" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN1Familia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN2Grupo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN3SubGrupo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN4Clase" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN5SubClase" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN6Actividad" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n1Familia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n2Grupo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n3SubGrupo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n4Clase" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n5SubClase" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n6Actividad" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "actividadEconomica", propOrder = { + "actividadGeneral", + "codN1Familia", + "codN2Grupo", + "codN3SubGrupo", + "codN4Clase", + "codN5SubClase", + "codN6Actividad", + "n1Familia", + "n2Grupo", + "n3SubGrupo", + "n4Clase", + "n5SubClase", + "n6Actividad" +}) +public class ActividadEconomica { + + protected String actividadGeneral; + protected String codN1Familia; + protected String codN2Grupo; + protected String codN3SubGrupo; + protected String codN4Clase; + protected String codN5SubClase; + protected String codN6Actividad; + protected String n1Familia; + protected String n2Grupo; + protected String n3SubGrupo; + protected String n4Clase; + protected String n5SubClase; + protected String n6Actividad; + + /** + * Obtiene el valor de la propiedad actividadGeneral. + * + * @return + * possible object is + * {@link String } + * + */ + public String getActividadGeneral() { + return actividadGeneral; + } + + /** + * Define el valor de la propiedad actividadGeneral. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setActividadGeneral(String value) { + this.actividadGeneral = value; + } + + /** + * Obtiene el valor de la propiedad codN1Familia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN1Familia() { + return codN1Familia; + } + + /** + * Define el valor de la propiedad codN1Familia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN1Familia(String value) { + this.codN1Familia = value; + } + + /** + * Obtiene el valor de la propiedad codN2Grupo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN2Grupo() { + return codN2Grupo; + } + + /** + * Define el valor de la propiedad codN2Grupo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN2Grupo(String value) { + this.codN2Grupo = value; + } + + /** + * Obtiene el valor de la propiedad codN3SubGrupo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN3SubGrupo() { + return codN3SubGrupo; + } + + /** + * Define el valor de la propiedad codN3SubGrupo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN3SubGrupo(String value) { + this.codN3SubGrupo = value; + } + + /** + * Obtiene el valor de la propiedad codN4Clase. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN4Clase() { + return codN4Clase; + } + + /** + * Define el valor de la propiedad codN4Clase. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN4Clase(String value) { + this.codN4Clase = value; + } + + /** + * Obtiene el valor de la propiedad codN5SubClase. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN5SubClase() { + return codN5SubClase; + } + + /** + * Define el valor de la propiedad codN5SubClase. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN5SubClase(String value) { + this.codN5SubClase = value; + } + + /** + * Obtiene el valor de la propiedad codN6Actividad. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN6Actividad() { + return codN6Actividad; + } + + /** + * Define el valor de la propiedad codN6Actividad. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN6Actividad(String value) { + this.codN6Actividad = value; + } + + /** + * Obtiene el valor de la propiedad n1Familia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN1Familia() { + return n1Familia; + } + + /** + * Define el valor de la propiedad n1Familia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN1Familia(String value) { + this.n1Familia = value; + } + + /** + * Obtiene el valor de la propiedad n2Grupo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN2Grupo() { + return n2Grupo; + } + + /** + * Define el valor de la propiedad n2Grupo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN2Grupo(String value) { + this.n2Grupo = value; + } + + /** + * Obtiene el valor de la propiedad n3SubGrupo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN3SubGrupo() { + return n3SubGrupo; + } + + /** + * Define el valor de la propiedad n3SubGrupo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN3SubGrupo(String value) { + this.n3SubGrupo = value; + } + + /** + * Obtiene el valor de la propiedad n4Clase. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN4Clase() { + return n4Clase; + } + + /** + * Define el valor de la propiedad n4Clase. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN4Clase(String value) { + this.n4Clase = value; + } + + /** + * Obtiene el valor de la propiedad n5SubClase. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN5SubClase() { + return n5SubClase; + } + + /** + * Define el valor de la propiedad n5SubClase. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN5SubClase(String value) { + this.n5SubClase = value; + } + + /** + * Obtiene el valor de la propiedad n6Actividad. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN6Actividad() { + return n6Actividad; + } + + /** + * Define el valor de la propiedad n6Actividad. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN6Actividad(String value) { + this.n6Actividad = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/AgenteRetencion.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/AgenteRetencion.java.svn-base new file mode 100644 index 0000000..3ed72ab --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/AgenteRetencion.java.svn-base @@ -0,0 +1,60 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para agenteRetencion complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="agenteRetencion">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="nombre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "agenteRetencion", propOrder = { + "nombre" +}) +public class AgenteRetencion { + + protected String nombre; + + /** + * Obtiene el valor de la propiedad nombre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombre() { + return nombre; + } + + /** + * Define el valor de la propiedad nombre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombre(String value) { + this.nombre = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/Contador.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/Contador.java.svn-base new file mode 100644 index 0000000..bc117c9 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/Contador.java.svn-base @@ -0,0 +1,114 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para contador complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="contador">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="cedula" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nombre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="ruc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "contador", propOrder = { + "cedula", + "nombre", + "ruc" +}) +public class Contador { + + protected String cedula; + protected String nombre; + protected String ruc; + + /** + * Obtiene el valor de la propiedad cedula. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCedula() { + return cedula; + } + + /** + * Define el valor de la propiedad cedula. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCedula(String value) { + this.cedula = value; + } + + /** + * Obtiene el valor de la propiedad nombre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombre() { + return nombre; + } + + /** + * Define el valor de la propiedad nombre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombre(String value) { + this.nombre = value; + } + + /** + * Obtiene el valor de la propiedad ruc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRuc() { + return ruc; + } + + /** + * Define el valor de la propiedad ruc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRuc(String value) { + this.ruc = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/Contribuyente.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/Contribuyente.java.svn-base new file mode 100644 index 0000000..408b415 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/Contribuyente.java.svn-base @@ -0,0 +1,416 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para contribuyente complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="contribuyente">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="actividadEconomica" type="{http://sri.gov.ec/wsConsultaContribuyente}actividadEconomica" minOccurs="0"/>
+ *         <element name="codClaseContrib" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codEstado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="desClaseContrib" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="desEstado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="direccionCorta" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="email" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nombreComercial" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="numeroRuc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="razonSocial" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="telefonoDomicilio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="telefonoTrabajo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="tipoContribuyente" type="{http://sri.gov.ec/wsConsultaContribuyente}tipoContribuyente" minOccurs="0"/>
+ *         <element name="ubicacionGeografica" type="{http://sri.gov.ec/wsConsultaContribuyente}ubicacionGeografica" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "contribuyente", propOrder = { + "actividadEconomica", + "codClaseContrib", + "codEstado", + "desClaseContrib", + "desEstado", + "direccionCorta", + "email", + "nombreComercial", + "numeroRuc", + "razonSocial", + "telefonoDomicilio", + "telefonoTrabajo", + "tipoContribuyente", + "ubicacionGeografica" +}) +@XmlSeeAlso({ + ContribuyenteOnLine.class, + ContribuyenteCompleto.class +}) +public class Contribuyente { + + protected ActividadEconomica actividadEconomica; + protected String codClaseContrib; + protected String codEstado; + protected String desClaseContrib; + protected String desEstado; + protected String direccionCorta; + protected String email; + protected String nombreComercial; + protected String numeroRuc; + protected String razonSocial; + protected String telefonoDomicilio; + protected String telefonoTrabajo; + protected TipoContribuyente tipoContribuyente; + protected UbicacionGeografica ubicacionGeografica; + + /** + * Obtiene el valor de la propiedad actividadEconomica. + * + * @return + * possible object is + * {@link ActividadEconomica } + * + */ + public ActividadEconomica getActividadEconomica() { + return actividadEconomica; + } + + /** + * Define el valor de la propiedad actividadEconomica. + * + * @param value + * allowed object is + * {@link ActividadEconomica } + * + */ + public void setActividadEconomica(ActividadEconomica value) { + this.actividadEconomica = value; + } + + /** + * Obtiene el valor de la propiedad codClaseContrib. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodClaseContrib() { + return codClaseContrib; + } + + /** + * Define el valor de la propiedad codClaseContrib. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodClaseContrib(String value) { + this.codClaseContrib = value; + } + + /** + * Obtiene el valor de la propiedad codEstado. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodEstado() { + return codEstado; + } + + /** + * Define el valor de la propiedad codEstado. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodEstado(String value) { + this.codEstado = value; + } + + /** + * Obtiene el valor de la propiedad desClaseContrib. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDesClaseContrib() { + return desClaseContrib; + } + + /** + * Define el valor de la propiedad desClaseContrib. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDesClaseContrib(String value) { + this.desClaseContrib = value; + } + + /** + * Obtiene el valor de la propiedad desEstado. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDesEstado() { + return desEstado; + } + + /** + * Define el valor de la propiedad desEstado. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDesEstado(String value) { + this.desEstado = value; + } + + /** + * Obtiene el valor de la propiedad direccionCorta. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDireccionCorta() { + return direccionCorta; + } + + /** + * Define el valor de la propiedad direccionCorta. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDireccionCorta(String value) { + this.direccionCorta = value; + } + + /** + * Obtiene el valor de la propiedad email. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEmail() { + return email; + } + + /** + * Define el valor de la propiedad email. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEmail(String value) { + this.email = value; + } + + /** + * Obtiene el valor de la propiedad nombreComercial. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombreComercial() { + return nombreComercial; + } + + /** + * Define el valor de la propiedad nombreComercial. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombreComercial(String value) { + this.nombreComercial = value; + } + + /** + * Obtiene el valor de la propiedad numeroRuc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroRuc() { + return numeroRuc; + } + + /** + * Define el valor de la propiedad numeroRuc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroRuc(String value) { + this.numeroRuc = value; + } + + /** + * Obtiene el valor de la propiedad razonSocial. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRazonSocial() { + return razonSocial; + } + + /** + * Define el valor de la propiedad razonSocial. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRazonSocial(String value) { + this.razonSocial = value; + } + + /** + * Obtiene el valor de la propiedad telefonoDomicilio. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTelefonoDomicilio() { + return telefonoDomicilio; + } + + /** + * Define el valor de la propiedad telefonoDomicilio. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTelefonoDomicilio(String value) { + this.telefonoDomicilio = value; + } + + /** + * Obtiene el valor de la propiedad telefonoTrabajo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTelefonoTrabajo() { + return telefonoTrabajo; + } + + /** + * Define el valor de la propiedad telefonoTrabajo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTelefonoTrabajo(String value) { + this.telefonoTrabajo = value; + } + + /** + * Obtiene el valor de la propiedad tipoContribuyente. + * + * @return + * possible object is + * {@link TipoContribuyente } + * + */ + public TipoContribuyente getTipoContribuyente() { + return tipoContribuyente; + } + + /** + * Define el valor de la propiedad tipoContribuyente. + * + * @param value + * allowed object is + * {@link TipoContribuyente } + * + */ + public void setTipoContribuyente(TipoContribuyente value) { + this.tipoContribuyente = value; + } + + /** + * Obtiene el valor de la propiedad ubicacionGeografica. + * + * @return + * possible object is + * {@link UbicacionGeografica } + * + */ + public UbicacionGeografica getUbicacionGeografica() { + return ubicacionGeografica; + } + + /** + * Define el valor de la propiedad ubicacionGeografica. + * + * @param value + * allowed object is + * {@link UbicacionGeografica } + * + */ + public void setUbicacionGeografica(UbicacionGeografica value) { + this.ubicacionGeografica = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ContribuyenteCompleto.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ContribuyenteCompleto.java.svn-base new file mode 100644 index 0000000..8514d32 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ContribuyenteCompleto.java.svn-base @@ -0,0 +1,575 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para contribuyenteCompleto complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="contribuyenteCompleto">
+ *   <complexContent>
+ *     <extension base="{http://sri.gov.ec/wsConsultaContribuyente}contribuyente">
+ *       <sequence>
+ *         <element name="agenteRetencion" type="{http://sri.gov.ec/wsConsultaContribuyente}agenteRetencion" minOccurs="0"/>
+ *         <element name="calificacionArtesanal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="contador" type="{http://sri.gov.ec/wsConsultaContribuyente}contador" minOccurs="0"/>
+ *         <element name="direccionLarga" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="estructuraOrganizacional" type="{http://sri.gov.ec/wsConsultaContribuyente}estructuraOrganizacional" minOccurs="0"/>
+ *         <element name="fax" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaAltaParaEspecial" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaCalificacionArtesanal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaCambioObligado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaInicioActividades" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaNacimiento" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaNotificacionEspeciales" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaUltimaDeclaracion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="listaBlanca" type="{http://sri.gov.ec/wsConsultaContribuyente}listaBlanca" minOccurs="0"/>
+ *         <element name="numeroCalificacionArtesanal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="obligadoContabilidad" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="representanteLegal" type="{http://sri.gov.ec/wsConsultaContribuyente}representanteLegal" minOccurs="0"/>
+ *         <element name="resolucionAltaParaEspecial" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="tipoCalificacionArtesanal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="ultimoPeriodoFiscalCumplido" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "contribuyenteCompleto", propOrder = { + "agenteRetencion", + "calificacionArtesanal", + "contador", + "direccionLarga", + "estructuraOrganizacional", + "fax", + "fechaAltaParaEspecial", + "fechaCalificacionArtesanal", + "fechaCambioObligado", + "fechaInicioActividades", + "fechaNacimiento", + "fechaNotificacionEspeciales", + "fechaUltimaDeclaracion", + "listaBlanca", + "numeroCalificacionArtesanal", + "obligadoContabilidad", + "representanteLegal", + "resolucionAltaParaEspecial", + "tipoCalificacionArtesanal", + "ultimoPeriodoFiscalCumplido" +}) +public class ContribuyenteCompleto + extends Contribuyente +{ + + protected AgenteRetencion agenteRetencion; + protected String calificacionArtesanal; + protected Contador contador; + protected String direccionLarga; + protected EstructuraOrganizacional estructuraOrganizacional; + protected String fax; + protected String fechaAltaParaEspecial; + protected String fechaCalificacionArtesanal; + protected String fechaCambioObligado; + protected String fechaInicioActividades; + protected String fechaNacimiento; + protected String fechaNotificacionEspeciales; + protected String fechaUltimaDeclaracion; + protected ListaBlanca listaBlanca; + protected String numeroCalificacionArtesanal; + protected String obligadoContabilidad; + protected RepresentanteLegal representanteLegal; + protected String resolucionAltaParaEspecial; + protected String tipoCalificacionArtesanal; + protected String ultimoPeriodoFiscalCumplido; + + /** + * Obtiene el valor de la propiedad agenteRetencion. + * + * @return + * possible object is + * {@link AgenteRetencion } + * + */ + public AgenteRetencion getAgenteRetencion() { + return agenteRetencion; + } + + /** + * Define el valor de la propiedad agenteRetencion. + * + * @param value + * allowed object is + * {@link AgenteRetencion } + * + */ + public void setAgenteRetencion(AgenteRetencion value) { + this.agenteRetencion = value; + } + + /** + * Obtiene el valor de la propiedad calificacionArtesanal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCalificacionArtesanal() { + return calificacionArtesanal; + } + + /** + * Define el valor de la propiedad calificacionArtesanal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCalificacionArtesanal(String value) { + this.calificacionArtesanal = value; + } + + /** + * Obtiene el valor de la propiedad contador. + * + * @return + * possible object is + * {@link Contador } + * + */ + public Contador getContador() { + return contador; + } + + /** + * Define el valor de la propiedad contador. + * + * @param value + * allowed object is + * {@link Contador } + * + */ + public void setContador(Contador value) { + this.contador = value; + } + + /** + * Obtiene el valor de la propiedad direccionLarga. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDireccionLarga() { + return direccionLarga; + } + + /** + * Define el valor de la propiedad direccionLarga. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDireccionLarga(String value) { + this.direccionLarga = value; + } + + /** + * Obtiene el valor de la propiedad estructuraOrganizacional. + * + * @return + * possible object is + * {@link EstructuraOrganizacional } + * + */ + public EstructuraOrganizacional getEstructuraOrganizacional() { + return estructuraOrganizacional; + } + + /** + * Define el valor de la propiedad estructuraOrganizacional. + * + * @param value + * allowed object is + * {@link EstructuraOrganizacional } + * + */ + public void setEstructuraOrganizacional(EstructuraOrganizacional value) { + this.estructuraOrganizacional = value; + } + + /** + * Obtiene el valor de la propiedad fax. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFax() { + return fax; + } + + /** + * Define el valor de la propiedad fax. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFax(String value) { + this.fax = value; + } + + /** + * Obtiene el valor de la propiedad fechaAltaParaEspecial. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaAltaParaEspecial() { + return fechaAltaParaEspecial; + } + + /** + * Define el valor de la propiedad fechaAltaParaEspecial. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaAltaParaEspecial(String value) { + this.fechaAltaParaEspecial = value; + } + + /** + * Obtiene el valor de la propiedad fechaCalificacionArtesanal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaCalificacionArtesanal() { + return fechaCalificacionArtesanal; + } + + /** + * Define el valor de la propiedad fechaCalificacionArtesanal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaCalificacionArtesanal(String value) { + this.fechaCalificacionArtesanal = value; + } + + /** + * Obtiene el valor de la propiedad fechaCambioObligado. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaCambioObligado() { + return fechaCambioObligado; + } + + /** + * Define el valor de la propiedad fechaCambioObligado. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaCambioObligado(String value) { + this.fechaCambioObligado = value; + } + + /** + * Obtiene el valor de la propiedad fechaInicioActividades. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaInicioActividades() { + return fechaInicioActividades; + } + + /** + * Define el valor de la propiedad fechaInicioActividades. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaInicioActividades(String value) { + this.fechaInicioActividades = value; + } + + /** + * Obtiene el valor de la propiedad fechaNacimiento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaNacimiento() { + return fechaNacimiento; + } + + /** + * Define el valor de la propiedad fechaNacimiento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaNacimiento(String value) { + this.fechaNacimiento = value; + } + + /** + * Obtiene el valor de la propiedad fechaNotificacionEspeciales. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaNotificacionEspeciales() { + return fechaNotificacionEspeciales; + } + + /** + * Define el valor de la propiedad fechaNotificacionEspeciales. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaNotificacionEspeciales(String value) { + this.fechaNotificacionEspeciales = value; + } + + /** + * Obtiene el valor de la propiedad fechaUltimaDeclaracion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaUltimaDeclaracion() { + return fechaUltimaDeclaracion; + } + + /** + * Define el valor de la propiedad fechaUltimaDeclaracion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaUltimaDeclaracion(String value) { + this.fechaUltimaDeclaracion = value; + } + + /** + * Obtiene el valor de la propiedad listaBlanca. + * + * @return + * possible object is + * {@link ListaBlanca } + * + */ + public ListaBlanca getListaBlanca() { + return listaBlanca; + } + + /** + * Define el valor de la propiedad listaBlanca. + * + * @param value + * allowed object is + * {@link ListaBlanca } + * + */ + public void setListaBlanca(ListaBlanca value) { + this.listaBlanca = value; + } + + /** + * Obtiene el valor de la propiedad numeroCalificacionArtesanal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroCalificacionArtesanal() { + return numeroCalificacionArtesanal; + } + + /** + * Define el valor de la propiedad numeroCalificacionArtesanal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroCalificacionArtesanal(String value) { + this.numeroCalificacionArtesanal = value; + } + + /** + * Obtiene el valor de la propiedad obligadoContabilidad. + * + * @return + * possible object is + * {@link String } + * + */ + public String getObligadoContabilidad() { + return obligadoContabilidad; + } + + /** + * Define el valor de la propiedad obligadoContabilidad. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setObligadoContabilidad(String value) { + this.obligadoContabilidad = value; + } + + /** + * Obtiene el valor de la propiedad representanteLegal. + * + * @return + * possible object is + * {@link RepresentanteLegal } + * + */ + public RepresentanteLegal getRepresentanteLegal() { + return representanteLegal; + } + + /** + * Define el valor de la propiedad representanteLegal. + * + * @param value + * allowed object is + * {@link RepresentanteLegal } + * + */ + public void setRepresentanteLegal(RepresentanteLegal value) { + this.representanteLegal = value; + } + + /** + * Obtiene el valor de la propiedad resolucionAltaParaEspecial. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResolucionAltaParaEspecial() { + return resolucionAltaParaEspecial; + } + + /** + * Define el valor de la propiedad resolucionAltaParaEspecial. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResolucionAltaParaEspecial(String value) { + this.resolucionAltaParaEspecial = value; + } + + /** + * Obtiene el valor de la propiedad tipoCalificacionArtesanal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTipoCalificacionArtesanal() { + return tipoCalificacionArtesanal; + } + + /** + * Define el valor de la propiedad tipoCalificacionArtesanal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTipoCalificacionArtesanal(String value) { + this.tipoCalificacionArtesanal = value; + } + + /** + * Obtiene el valor de la propiedad ultimoPeriodoFiscalCumplido. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUltimoPeriodoFiscalCumplido() { + return ultimoPeriodoFiscalCumplido; + } + + /** + * Define el valor de la propiedad ultimoPeriodoFiscalCumplido. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUltimoPeriodoFiscalCumplido(String value) { + this.ultimoPeriodoFiscalCumplido = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ContribuyenteOnLine.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ContribuyenteOnLine.java.svn-base new file mode 100644 index 0000000..e021464 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ContribuyenteOnLine.java.svn-base @@ -0,0 +1,332 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para contribuyenteOnLine complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="contribuyenteOnLine">
+ *   <complexContent>
+ *     <extension base="{http://sri.gov.ec/wsConsultaContribuyente}contribuyente">
+ *       <sequence>
+ *         <element name="actEcoPrin" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="activEstablec" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codActEcoPrin" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="desUbicaGeograf" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="descTipoContri" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaIniAct" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="idRepreLegal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nombreRepreLegal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="telefonos" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="tipoContri" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="ubicaGeograf" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "contribuyenteOnLine", propOrder = { + "actEcoPrin", + "activEstablec", + "codActEcoPrin", + "desUbicaGeograf", + "descTipoContri", + "fechaIniAct", + "idRepreLegal", + "nombreRepreLegal", + "telefonos", + "tipoContri", + "ubicaGeograf" +}) +public class ContribuyenteOnLine + extends Contribuyente +{ + + protected String actEcoPrin; + protected String activEstablec; + protected String codActEcoPrin; + protected String desUbicaGeograf; + protected String descTipoContri; + protected String fechaIniAct; + protected String idRepreLegal; + protected String nombreRepreLegal; + protected String telefonos; + protected String tipoContri; + protected String ubicaGeograf; + + /** + * Obtiene el valor de la propiedad actEcoPrin. + * + * @return + * possible object is + * {@link String } + * + */ + public String getActEcoPrin() { + return actEcoPrin; + } + + /** + * Define el valor de la propiedad actEcoPrin. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setActEcoPrin(String value) { + this.actEcoPrin = value; + } + + /** + * Obtiene el valor de la propiedad activEstablec. + * + * @return + * possible object is + * {@link String } + * + */ + public String getActivEstablec() { + return activEstablec; + } + + /** + * Define el valor de la propiedad activEstablec. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setActivEstablec(String value) { + this.activEstablec = value; + } + + /** + * Obtiene el valor de la propiedad codActEcoPrin. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodActEcoPrin() { + return codActEcoPrin; + } + + /** + * Define el valor de la propiedad codActEcoPrin. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodActEcoPrin(String value) { + this.codActEcoPrin = value; + } + + /** + * Obtiene el valor de la propiedad desUbicaGeograf. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDesUbicaGeograf() { + return desUbicaGeograf; + } + + /** + * Define el valor de la propiedad desUbicaGeograf. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDesUbicaGeograf(String value) { + this.desUbicaGeograf = value; + } + + /** + * Obtiene el valor de la propiedad descTipoContri. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDescTipoContri() { + return descTipoContri; + } + + /** + * Define el valor de la propiedad descTipoContri. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDescTipoContri(String value) { + this.descTipoContri = value; + } + + /** + * Obtiene el valor de la propiedad fechaIniAct. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaIniAct() { + return fechaIniAct; + } + + /** + * Define el valor de la propiedad fechaIniAct. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaIniAct(String value) { + this.fechaIniAct = value; + } + + /** + * Obtiene el valor de la propiedad idRepreLegal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIdRepreLegal() { + return idRepreLegal; + } + + /** + * Define el valor de la propiedad idRepreLegal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIdRepreLegal(String value) { + this.idRepreLegal = value; + } + + /** + * Obtiene el valor de la propiedad nombreRepreLegal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombreRepreLegal() { + return nombreRepreLegal; + } + + /** + * Define el valor de la propiedad nombreRepreLegal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombreRepreLegal(String value) { + this.nombreRepreLegal = value; + } + + /** + * Obtiene el valor de la propiedad telefonos. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTelefonos() { + return telefonos; + } + + /** + * Define el valor de la propiedad telefonos. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTelefonos(String value) { + this.telefonos = value; + } + + /** + * Obtiene el valor de la propiedad tipoContri. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTipoContri() { + return tipoContri; + } + + /** + * Define el valor de la propiedad tipoContri. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTipoContri(String value) { + this.tipoContri = value; + } + + /** + * Obtiene el valor de la propiedad ubicaGeograf. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUbicaGeograf() { + return ubicaGeograf; + } + + /** + * Define el valor de la propiedad ubicaGeograf. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUbicaGeograf(String value) { + this.ubicaGeograf = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/EstructuraOrganizacional.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/EstructuraOrganizacional.java.svn-base new file mode 100644 index 0000000..3d1af43 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/EstructuraOrganizacional.java.svn-base @@ -0,0 +1,160 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para estructuraOrganizacional complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="estructuraOrganizacional">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="codigoProvincia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codigoRegional" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="id" type="{http://www.w3.org/2001/XMLSchema}long"/>
+ *         <element name="nombreProvincia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nombreRegional" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "estructuraOrganizacional", propOrder = { + "codigoProvincia", + "codigoRegional", + "id", + "nombreProvincia", + "nombreRegional" +}) +public class EstructuraOrganizacional { + + protected String codigoProvincia; + protected String codigoRegional; + protected long id; + protected String nombreProvincia; + protected String nombreRegional; + + /** + * Obtiene el valor de la propiedad codigoProvincia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodigoProvincia() { + return codigoProvincia; + } + + /** + * Define el valor de la propiedad codigoProvincia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodigoProvincia(String value) { + this.codigoProvincia = value; + } + + /** + * Obtiene el valor de la propiedad codigoRegional. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodigoRegional() { + return codigoRegional; + } + + /** + * Define el valor de la propiedad codigoRegional. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodigoRegional(String value) { + this.codigoRegional = value; + } + + /** + * Obtiene el valor de la propiedad id. + * + */ + public long getId() { + return id; + } + + /** + * Define el valor de la propiedad id. + * + */ + public void setId(long value) { + this.id = value; + } + + /** + * Obtiene el valor de la propiedad nombreProvincia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombreProvincia() { + return nombreProvincia; + } + + /** + * Define el valor de la propiedad nombreProvincia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombreProvincia(String value) { + this.nombreProvincia = value; + } + + /** + * Obtiene el valor de la propiedad nombreRegional. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombreRegional() { + return nombreRegional; + } + + /** + * Define el valor de la propiedad nombreRegional. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombreRegional(String value) { + this.nombreRegional = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ListaBlanca.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ListaBlanca.java.svn-base new file mode 100644 index 0000000..e64a7e7 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ListaBlanca.java.svn-base @@ -0,0 +1,60 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para listaBlanca complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="listaBlanca">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="estado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "listaBlanca", propOrder = { + "estado" +}) +public class ListaBlanca { + + protected String estado; + + /** + * Obtiene el valor de la propiedad estado. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEstado() { + return estado; + } + + /** + * Define el valor de la propiedad estado. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEstado(String value) { + this.estado = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObjectFactory.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObjectFactory.java.svn-base new file mode 100644 index 0000000..1bc6b27 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObjectFactory.java.svn-base @@ -0,0 +1,231 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the ec.gov.sri.wsconsultacontribuyente package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _ObtenerSimple_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerSimple"); + private final static QName _ObtenerCompletoResponse_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerCompletoResponse"); + private final static QName _ObtenerCompleto_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerCompleto"); + private final static QName _ObtenerDatos_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerDatos"); + private final static QName _ObtenerSimpleResponse_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerSimpleResponse"); + private final static QName _ObtenerDatosResponse_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerDatosResponse"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: ec.gov.sri.wsconsultacontribuyente + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link ObtenerSimple } + * + */ + public ObtenerSimple createObtenerSimple() { + return new ObtenerSimple(); + } + + /** + * Create an instance of {@link ObtenerDatosResponse } + * + */ + public ObtenerDatosResponse createObtenerDatosResponse() { + return new ObtenerDatosResponse(); + } + + /** + * Create an instance of {@link ObtenerCompletoResponse } + * + */ + public ObtenerCompletoResponse createObtenerCompletoResponse() { + return new ObtenerCompletoResponse(); + } + + /** + * Create an instance of {@link ObtenerSimpleResponse } + * + */ + public ObtenerSimpleResponse createObtenerSimpleResponse() { + return new ObtenerSimpleResponse(); + } + + /** + * Create an instance of {@link ObtenerDatos } + * + */ + public ObtenerDatos createObtenerDatos() { + return new ObtenerDatos(); + } + + /** + * Create an instance of {@link ObtenerCompleto } + * + */ + public ObtenerCompleto createObtenerCompleto() { + return new ObtenerCompleto(); + } + + /** + * Create an instance of {@link ContribuyenteOnLine } + * + */ + public ContribuyenteOnLine createContribuyenteOnLine() { + return new ContribuyenteOnLine(); + } + + /** + * Create an instance of {@link AgenteRetencion } + * + */ + public AgenteRetencion createAgenteRetencion() { + return new AgenteRetencion(); + } + + /** + * Create an instance of {@link EstructuraOrganizacional } + * + */ + public EstructuraOrganizacional createEstructuraOrganizacional() { + return new EstructuraOrganizacional(); + } + + /** + * Create an instance of {@link ListaBlanca } + * + */ + public ListaBlanca createListaBlanca() { + return new ListaBlanca(); + } + + /** + * Create an instance of {@link RepresentanteLegal } + * + */ + public RepresentanteLegal createRepresentanteLegal() { + return new RepresentanteLegal(); + } + + /** + * Create an instance of {@link Contribuyente } + * + */ + public Contribuyente createContribuyente() { + return new Contribuyente(); + } + + /** + * Create an instance of {@link Contador } + * + */ + public Contador createContador() { + return new Contador(); + } + + /** + * Create an instance of {@link UbicacionGeografica } + * + */ + public UbicacionGeografica createUbicacionGeografica() { + return new UbicacionGeografica(); + } + + /** + * Create an instance of {@link ContribuyenteCompleto } + * + */ + public ContribuyenteCompleto createContribuyenteCompleto() { + return new ContribuyenteCompleto(); + } + + /** + * Create an instance of {@link ActividadEconomica } + * + */ + public ActividadEconomica createActividadEconomica() { + return new ActividadEconomica(); + } + + /** + * Create an instance of {@link TipoContribuyente } + * + */ + public TipoContribuyente createTipoContribuyente() { + return new TipoContribuyente(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerSimple }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerSimple") + public JAXBElement createObtenerSimple(ObtenerSimple value) { + return new JAXBElement(_ObtenerSimple_QNAME, ObtenerSimple.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerCompletoResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerCompletoResponse") + public JAXBElement createObtenerCompletoResponse(ObtenerCompletoResponse value) { + return new JAXBElement(_ObtenerCompletoResponse_QNAME, ObtenerCompletoResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerCompleto }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerCompleto") + public JAXBElement createObtenerCompleto(ObtenerCompleto value) { + return new JAXBElement(_ObtenerCompleto_QNAME, ObtenerCompleto.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerDatos }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerDatos") + public JAXBElement createObtenerDatos(ObtenerDatos value) { + return new JAXBElement(_ObtenerDatos_QNAME, ObtenerDatos.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerSimpleResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerSimpleResponse") + public JAXBElement createObtenerSimpleResponse(ObtenerSimpleResponse value) { + return new JAXBElement(_ObtenerSimpleResponse_QNAME, ObtenerSimpleResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerDatosResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerDatosResponse") + public JAXBElement createObtenerDatosResponse(ObtenerDatosResponse value) { + return new JAXBElement(_ObtenerDatosResponse_QNAME, ObtenerDatosResponse.class, null, value); + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerCompleto.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerCompleto.java.svn-base new file mode 100644 index 0000000..3b0fbc9 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerCompleto.java.svn-base @@ -0,0 +1,87 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerCompleto complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerCompleto">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="numeroRuc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fuenteDatos" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerCompleto", propOrder = { + "numeroRuc", + "fuenteDatos" +}) +public class ObtenerCompleto { + + protected String numeroRuc; + protected String fuenteDatos; + + /** + * Obtiene el valor de la propiedad numeroRuc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroRuc() { + return numeroRuc; + } + + /** + * Define el valor de la propiedad numeroRuc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroRuc(String value) { + this.numeroRuc = value; + } + + /** + * Obtiene el valor de la propiedad fuenteDatos. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFuenteDatos() { + return fuenteDatos; + } + + /** + * Define el valor de la propiedad fuenteDatos. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFuenteDatos(String value) { + this.fuenteDatos = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerCompletoResponse.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerCompletoResponse.java.svn-base new file mode 100644 index 0000000..9f6de96 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerCompletoResponse.java.svn-base @@ -0,0 +1,62 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerCompletoResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerCompletoResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://sri.gov.ec/wsConsultaContribuyente}contribuyenteCompleto" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerCompletoResponse", propOrder = { + "_return" +}) +public class ObtenerCompletoResponse { + + @XmlElement(name = "return") + protected ContribuyenteCompleto _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link ContribuyenteCompleto } + * + */ + public ContribuyenteCompleto getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link ContribuyenteCompleto } + * + */ + public void setReturn(ContribuyenteCompleto value) { + this._return = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerDatos.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerDatos.java.svn-base new file mode 100644 index 0000000..89b7627 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerDatos.java.svn-base @@ -0,0 +1,60 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerDatos complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerDatos">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="numeroRuc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerDatos", propOrder = { + "numeroRuc" +}) +public class ObtenerDatos { + + protected String numeroRuc; + + /** + * Obtiene el valor de la propiedad numeroRuc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroRuc() { + return numeroRuc; + } + + /** + * Define el valor de la propiedad numeroRuc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroRuc(String value) { + this.numeroRuc = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerDatosResponse.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerDatosResponse.java.svn-base new file mode 100644 index 0000000..d749f76 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerDatosResponse.java.svn-base @@ -0,0 +1,62 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerDatosResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerDatosResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://sri.gov.ec/wsConsultaContribuyente}contribuyenteOnLine" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerDatosResponse", propOrder = { + "_return" +}) +public class ObtenerDatosResponse { + + @XmlElement(name = "return") + protected ContribuyenteOnLine _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link ContribuyenteOnLine } + * + */ + public ContribuyenteOnLine getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link ContribuyenteOnLine } + * + */ + public void setReturn(ContribuyenteOnLine value) { + this._return = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerSimple.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerSimple.java.svn-base new file mode 100644 index 0000000..aaeef05 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerSimple.java.svn-base @@ -0,0 +1,87 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerSimple complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerSimple">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="numeroRuc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fuenteDatos" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerSimple", propOrder = { + "numeroRuc", + "fuenteDatos" +}) +public class ObtenerSimple { + + protected String numeroRuc; + protected String fuenteDatos; + + /** + * Obtiene el valor de la propiedad numeroRuc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroRuc() { + return numeroRuc; + } + + /** + * Define el valor de la propiedad numeroRuc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroRuc(String value) { + this.numeroRuc = value; + } + + /** + * Obtiene el valor de la propiedad fuenteDatos. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFuenteDatos() { + return fuenteDatos; + } + + /** + * Define el valor de la propiedad fuenteDatos. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFuenteDatos(String value) { + this.fuenteDatos = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerSimpleResponse.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerSimpleResponse.java.svn-base new file mode 100644 index 0000000..022a18b --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerSimpleResponse.java.svn-base @@ -0,0 +1,62 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerSimpleResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerSimpleResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://sri.gov.ec/wsConsultaContribuyente}contribuyente" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerSimpleResponse", propOrder = { + "_return" +}) +public class ObtenerSimpleResponse { + + @XmlElement(name = "return") + protected Contribuyente _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link Contribuyente } + * + */ + public Contribuyente getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link Contribuyente } + * + */ + public void setReturn(Contribuyente value) { + this._return = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/RepresentanteLegal.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/RepresentanteLegal.java.svn-base new file mode 100644 index 0000000..694f157 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/RepresentanteLegal.java.svn-base @@ -0,0 +1,114 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para representanteLegal complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="representanteLegal">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="cargo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="identificacion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nombre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "representanteLegal", propOrder = { + "cargo", + "identificacion", + "nombre" +}) +public class RepresentanteLegal { + + protected String cargo; + protected String identificacion; + protected String nombre; + + /** + * Obtiene el valor de la propiedad cargo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCargo() { + return cargo; + } + + /** + * Define el valor de la propiedad cargo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCargo(String value) { + this.cargo = value; + } + + /** + * Obtiene el valor de la propiedad identificacion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIdentificacion() { + return identificacion; + } + + /** + * Define el valor de la propiedad identificacion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIdentificacion(String value) { + this.identificacion = value; + } + + /** + * Obtiene el valor de la propiedad nombre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombre() { + return nombre; + } + + /** + * Define el valor de la propiedad nombre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombre(String value) { + this.nombre = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/TipoContribuyente.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/TipoContribuyente.java.svn-base new file mode 100644 index 0000000..337b0eb --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/TipoContribuyente.java.svn-base @@ -0,0 +1,195 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para tipoContribuyente complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="tipoContribuyente">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="id" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
+ *         <element name="nivel1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nivel2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nivel3" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nivel4" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="ultimoNivel" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "tipoContribuyente", propOrder = { + "id", + "nivel1", + "nivel2", + "nivel3", + "nivel4", + "ultimoNivel" +}) +public class TipoContribuyente { + + protected Long id; + protected String nivel1; + protected String nivel2; + protected String nivel3; + protected String nivel4; + protected String ultimoNivel; + + /** + * Obtiene el valor de la propiedad id. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getId() { + return id; + } + + /** + * Define el valor de la propiedad id. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setId(Long value) { + this.id = value; + } + + /** + * Obtiene el valor de la propiedad nivel1. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNivel1() { + return nivel1; + } + + /** + * Define el valor de la propiedad nivel1. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNivel1(String value) { + this.nivel1 = value; + } + + /** + * Obtiene el valor de la propiedad nivel2. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNivel2() { + return nivel2; + } + + /** + * Define el valor de la propiedad nivel2. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNivel2(String value) { + this.nivel2 = value; + } + + /** + * Obtiene el valor de la propiedad nivel3. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNivel3() { + return nivel3; + } + + /** + * Define el valor de la propiedad nivel3. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNivel3(String value) { + this.nivel3 = value; + } + + /** + * Obtiene el valor de la propiedad nivel4. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNivel4() { + return nivel4; + } + + /** + * Define el valor de la propiedad nivel4. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNivel4(String value) { + this.nivel4 = value; + } + + /** + * Obtiene el valor de la propiedad ultimoNivel. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUltimoNivel() { + return ultimoNivel; + } + + /** + * Define el valor de la propiedad ultimoNivel. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUltimoNivel(String value) { + this.ultimoNivel = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/UbicacionGeografica.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/UbicacionGeografica.java.svn-base new file mode 100644 index 0000000..b155226 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/UbicacionGeografica.java.svn-base @@ -0,0 +1,303 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para ubicacionGeografica complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="ubicacionGeografica">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="canton" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codCanton" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codPais" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codParroquia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codProvincia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codRegion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="pais" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="parroquia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="provincia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="region" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ubicacionGeografica", propOrder = { + "canton", + "codCanton", + "codPais", + "codParroquia", + "codProvincia", + "codRegion", + "pais", + "parroquia", + "provincia", + "region" +}) +public class UbicacionGeografica { + + protected String canton; + protected String codCanton; + protected String codPais; + protected String codParroquia; + protected String codProvincia; + protected String codRegion; + protected String pais; + protected String parroquia; + protected String provincia; + protected String region; + + /** + * Obtiene el valor de la propiedad canton. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCanton() { + return canton; + } + + /** + * Define el valor de la propiedad canton. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCanton(String value) { + this.canton = value; + } + + /** + * Obtiene el valor de la propiedad codCanton. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodCanton() { + return codCanton; + } + + /** + * Define el valor de la propiedad codCanton. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodCanton(String value) { + this.codCanton = value; + } + + /** + * Obtiene el valor de la propiedad codPais. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodPais() { + return codPais; + } + + /** + * Define el valor de la propiedad codPais. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodPais(String value) { + this.codPais = value; + } + + /** + * Obtiene el valor de la propiedad codParroquia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodParroquia() { + return codParroquia; + } + + /** + * Define el valor de la propiedad codParroquia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodParroquia(String value) { + this.codParroquia = value; + } + + /** + * Obtiene el valor de la propiedad codProvincia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodProvincia() { + return codProvincia; + } + + /** + * Define el valor de la propiedad codProvincia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodProvincia(String value) { + this.codProvincia = value; + } + + /** + * Obtiene el valor de la propiedad codRegion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodRegion() { + return codRegion; + } + + /** + * Define el valor de la propiedad codRegion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodRegion(String value) { + this.codRegion = value; + } + + /** + * Obtiene el valor de la propiedad pais. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPais() { + return pais; + } + + /** + * Define el valor de la propiedad pais. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPais(String value) { + this.pais = value; + } + + /** + * Obtiene el valor de la propiedad parroquia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getParroquia() { + return parroquia; + } + + /** + * Define el valor de la propiedad parroquia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setParroquia(String value) { + this.parroquia = value; + } + + /** + * Obtiene el valor de la propiedad provincia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getProvincia() { + return provincia; + } + + /** + * Define el valor de la propiedad provincia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setProvincia(String value) { + this.provincia = value; + } + + /** + * Obtiene el valor de la propiedad region. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRegion() { + return region; + } + + /** + * Define el valor de la propiedad region. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRegion(String value) { + this.region = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/package-info.java.svn-base b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..4878b6d --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://sri.gov.ec/wsConsultaContribuyente") +package ec.gov.sri.wsconsultacontribuyente; diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ActividadEconomica.java b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ActividadEconomica.java new file mode 100644 index 0000000..f87847e --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ActividadEconomica.java @@ -0,0 +1,384 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para actividadEconomica complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="actividadEconomica">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="actividadGeneral" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN1Familia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN2Grupo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN3SubGrupo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN4Clase" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN5SubClase" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN6Actividad" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n1Familia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n2Grupo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n3SubGrupo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n4Clase" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n5SubClase" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n6Actividad" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "actividadEconomica", propOrder = { + "actividadGeneral", + "codN1Familia", + "codN2Grupo", + "codN3SubGrupo", + "codN4Clase", + "codN5SubClase", + "codN6Actividad", + "n1Familia", + "n2Grupo", + "n3SubGrupo", + "n4Clase", + "n5SubClase", + "n6Actividad" +}) +public class ActividadEconomica { + + protected String actividadGeneral; + protected String codN1Familia; + protected String codN2Grupo; + protected String codN3SubGrupo; + protected String codN4Clase; + protected String codN5SubClase; + protected String codN6Actividad; + protected String n1Familia; + protected String n2Grupo; + protected String n3SubGrupo; + protected String n4Clase; + protected String n5SubClase; + protected String n6Actividad; + + /** + * Obtiene el valor de la propiedad actividadGeneral. + * + * @return + * possible object is + * {@link String } + * + */ + public String getActividadGeneral() { + return actividadGeneral; + } + + /** + * Define el valor de la propiedad actividadGeneral. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setActividadGeneral(String value) { + this.actividadGeneral = value; + } + + /** + * Obtiene el valor de la propiedad codN1Familia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN1Familia() { + return codN1Familia; + } + + /** + * Define el valor de la propiedad codN1Familia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN1Familia(String value) { + this.codN1Familia = value; + } + + /** + * Obtiene el valor de la propiedad codN2Grupo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN2Grupo() { + return codN2Grupo; + } + + /** + * Define el valor de la propiedad codN2Grupo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN2Grupo(String value) { + this.codN2Grupo = value; + } + + /** + * Obtiene el valor de la propiedad codN3SubGrupo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN3SubGrupo() { + return codN3SubGrupo; + } + + /** + * Define el valor de la propiedad codN3SubGrupo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN3SubGrupo(String value) { + this.codN3SubGrupo = value; + } + + /** + * Obtiene el valor de la propiedad codN4Clase. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN4Clase() { + return codN4Clase; + } + + /** + * Define el valor de la propiedad codN4Clase. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN4Clase(String value) { + this.codN4Clase = value; + } + + /** + * Obtiene el valor de la propiedad codN5SubClase. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN5SubClase() { + return codN5SubClase; + } + + /** + * Define el valor de la propiedad codN5SubClase. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN5SubClase(String value) { + this.codN5SubClase = value; + } + + /** + * Obtiene el valor de la propiedad codN6Actividad. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN6Actividad() { + return codN6Actividad; + } + + /** + * Define el valor de la propiedad codN6Actividad. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN6Actividad(String value) { + this.codN6Actividad = value; + } + + /** + * Obtiene el valor de la propiedad n1Familia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN1Familia() { + return n1Familia; + } + + /** + * Define el valor de la propiedad n1Familia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN1Familia(String value) { + this.n1Familia = value; + } + + /** + * Obtiene el valor de la propiedad n2Grupo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN2Grupo() { + return n2Grupo; + } + + /** + * Define el valor de la propiedad n2Grupo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN2Grupo(String value) { + this.n2Grupo = value; + } + + /** + * Obtiene el valor de la propiedad n3SubGrupo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN3SubGrupo() { + return n3SubGrupo; + } + + /** + * Define el valor de la propiedad n3SubGrupo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN3SubGrupo(String value) { + this.n3SubGrupo = value; + } + + /** + * Obtiene el valor de la propiedad n4Clase. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN4Clase() { + return n4Clase; + } + + /** + * Define el valor de la propiedad n4Clase. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN4Clase(String value) { + this.n4Clase = value; + } + + /** + * Obtiene el valor de la propiedad n5SubClase. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN5SubClase() { + return n5SubClase; + } + + /** + * Define el valor de la propiedad n5SubClase. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN5SubClase(String value) { + this.n5SubClase = value; + } + + /** + * Obtiene el valor de la propiedad n6Actividad. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN6Actividad() { + return n6Actividad; + } + + /** + * Define el valor de la propiedad n6Actividad. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN6Actividad(String value) { + this.n6Actividad = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/AgenteRetencion.java b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/AgenteRetencion.java new file mode 100644 index 0000000..3ed72ab --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/AgenteRetencion.java @@ -0,0 +1,60 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para agenteRetencion complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="agenteRetencion">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="nombre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "agenteRetencion", propOrder = { + "nombre" +}) +public class AgenteRetencion { + + protected String nombre; + + /** + * Obtiene el valor de la propiedad nombre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombre() { + return nombre; + } + + /** + * Define el valor de la propiedad nombre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombre(String value) { + this.nombre = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/Contador.java b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/Contador.java new file mode 100644 index 0000000..bc117c9 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/Contador.java @@ -0,0 +1,114 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para contador complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="contador">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="cedula" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nombre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="ruc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "contador", propOrder = { + "cedula", + "nombre", + "ruc" +}) +public class Contador { + + protected String cedula; + protected String nombre; + protected String ruc; + + /** + * Obtiene el valor de la propiedad cedula. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCedula() { + return cedula; + } + + /** + * Define el valor de la propiedad cedula. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCedula(String value) { + this.cedula = value; + } + + /** + * Obtiene el valor de la propiedad nombre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombre() { + return nombre; + } + + /** + * Define el valor de la propiedad nombre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombre(String value) { + this.nombre = value; + } + + /** + * Obtiene el valor de la propiedad ruc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRuc() { + return ruc; + } + + /** + * Define el valor de la propiedad ruc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRuc(String value) { + this.ruc = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/Contribuyente.java b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/Contribuyente.java new file mode 100644 index 0000000..408b415 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/Contribuyente.java @@ -0,0 +1,416 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para contribuyente complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="contribuyente">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="actividadEconomica" type="{http://sri.gov.ec/wsConsultaContribuyente}actividadEconomica" minOccurs="0"/>
+ *         <element name="codClaseContrib" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codEstado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="desClaseContrib" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="desEstado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="direccionCorta" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="email" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nombreComercial" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="numeroRuc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="razonSocial" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="telefonoDomicilio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="telefonoTrabajo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="tipoContribuyente" type="{http://sri.gov.ec/wsConsultaContribuyente}tipoContribuyente" minOccurs="0"/>
+ *         <element name="ubicacionGeografica" type="{http://sri.gov.ec/wsConsultaContribuyente}ubicacionGeografica" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "contribuyente", propOrder = { + "actividadEconomica", + "codClaseContrib", + "codEstado", + "desClaseContrib", + "desEstado", + "direccionCorta", + "email", + "nombreComercial", + "numeroRuc", + "razonSocial", + "telefonoDomicilio", + "telefonoTrabajo", + "tipoContribuyente", + "ubicacionGeografica" +}) +@XmlSeeAlso({ + ContribuyenteOnLine.class, + ContribuyenteCompleto.class +}) +public class Contribuyente { + + protected ActividadEconomica actividadEconomica; + protected String codClaseContrib; + protected String codEstado; + protected String desClaseContrib; + protected String desEstado; + protected String direccionCorta; + protected String email; + protected String nombreComercial; + protected String numeroRuc; + protected String razonSocial; + protected String telefonoDomicilio; + protected String telefonoTrabajo; + protected TipoContribuyente tipoContribuyente; + protected UbicacionGeografica ubicacionGeografica; + + /** + * Obtiene el valor de la propiedad actividadEconomica. + * + * @return + * possible object is + * {@link ActividadEconomica } + * + */ + public ActividadEconomica getActividadEconomica() { + return actividadEconomica; + } + + /** + * Define el valor de la propiedad actividadEconomica. + * + * @param value + * allowed object is + * {@link ActividadEconomica } + * + */ + public void setActividadEconomica(ActividadEconomica value) { + this.actividadEconomica = value; + } + + /** + * Obtiene el valor de la propiedad codClaseContrib. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodClaseContrib() { + return codClaseContrib; + } + + /** + * Define el valor de la propiedad codClaseContrib. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodClaseContrib(String value) { + this.codClaseContrib = value; + } + + /** + * Obtiene el valor de la propiedad codEstado. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodEstado() { + return codEstado; + } + + /** + * Define el valor de la propiedad codEstado. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodEstado(String value) { + this.codEstado = value; + } + + /** + * Obtiene el valor de la propiedad desClaseContrib. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDesClaseContrib() { + return desClaseContrib; + } + + /** + * Define el valor de la propiedad desClaseContrib. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDesClaseContrib(String value) { + this.desClaseContrib = value; + } + + /** + * Obtiene el valor de la propiedad desEstado. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDesEstado() { + return desEstado; + } + + /** + * Define el valor de la propiedad desEstado. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDesEstado(String value) { + this.desEstado = value; + } + + /** + * Obtiene el valor de la propiedad direccionCorta. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDireccionCorta() { + return direccionCorta; + } + + /** + * Define el valor de la propiedad direccionCorta. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDireccionCorta(String value) { + this.direccionCorta = value; + } + + /** + * Obtiene el valor de la propiedad email. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEmail() { + return email; + } + + /** + * Define el valor de la propiedad email. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEmail(String value) { + this.email = value; + } + + /** + * Obtiene el valor de la propiedad nombreComercial. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombreComercial() { + return nombreComercial; + } + + /** + * Define el valor de la propiedad nombreComercial. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombreComercial(String value) { + this.nombreComercial = value; + } + + /** + * Obtiene el valor de la propiedad numeroRuc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroRuc() { + return numeroRuc; + } + + /** + * Define el valor de la propiedad numeroRuc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroRuc(String value) { + this.numeroRuc = value; + } + + /** + * Obtiene el valor de la propiedad razonSocial. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRazonSocial() { + return razonSocial; + } + + /** + * Define el valor de la propiedad razonSocial. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRazonSocial(String value) { + this.razonSocial = value; + } + + /** + * Obtiene el valor de la propiedad telefonoDomicilio. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTelefonoDomicilio() { + return telefonoDomicilio; + } + + /** + * Define el valor de la propiedad telefonoDomicilio. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTelefonoDomicilio(String value) { + this.telefonoDomicilio = value; + } + + /** + * Obtiene el valor de la propiedad telefonoTrabajo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTelefonoTrabajo() { + return telefonoTrabajo; + } + + /** + * Define el valor de la propiedad telefonoTrabajo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTelefonoTrabajo(String value) { + this.telefonoTrabajo = value; + } + + /** + * Obtiene el valor de la propiedad tipoContribuyente. + * + * @return + * possible object is + * {@link TipoContribuyente } + * + */ + public TipoContribuyente getTipoContribuyente() { + return tipoContribuyente; + } + + /** + * Define el valor de la propiedad tipoContribuyente. + * + * @param value + * allowed object is + * {@link TipoContribuyente } + * + */ + public void setTipoContribuyente(TipoContribuyente value) { + this.tipoContribuyente = value; + } + + /** + * Obtiene el valor de la propiedad ubicacionGeografica. + * + * @return + * possible object is + * {@link UbicacionGeografica } + * + */ + public UbicacionGeografica getUbicacionGeografica() { + return ubicacionGeografica; + } + + /** + * Define el valor de la propiedad ubicacionGeografica. + * + * @param value + * allowed object is + * {@link UbicacionGeografica } + * + */ + public void setUbicacionGeografica(UbicacionGeografica value) { + this.ubicacionGeografica = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ContribuyenteCompleto.java b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ContribuyenteCompleto.java new file mode 100644 index 0000000..8514d32 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ContribuyenteCompleto.java @@ -0,0 +1,575 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para contribuyenteCompleto complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="contribuyenteCompleto">
+ *   <complexContent>
+ *     <extension base="{http://sri.gov.ec/wsConsultaContribuyente}contribuyente">
+ *       <sequence>
+ *         <element name="agenteRetencion" type="{http://sri.gov.ec/wsConsultaContribuyente}agenteRetencion" minOccurs="0"/>
+ *         <element name="calificacionArtesanal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="contador" type="{http://sri.gov.ec/wsConsultaContribuyente}contador" minOccurs="0"/>
+ *         <element name="direccionLarga" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="estructuraOrganizacional" type="{http://sri.gov.ec/wsConsultaContribuyente}estructuraOrganizacional" minOccurs="0"/>
+ *         <element name="fax" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaAltaParaEspecial" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaCalificacionArtesanal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaCambioObligado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaInicioActividades" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaNacimiento" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaNotificacionEspeciales" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaUltimaDeclaracion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="listaBlanca" type="{http://sri.gov.ec/wsConsultaContribuyente}listaBlanca" minOccurs="0"/>
+ *         <element name="numeroCalificacionArtesanal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="obligadoContabilidad" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="representanteLegal" type="{http://sri.gov.ec/wsConsultaContribuyente}representanteLegal" minOccurs="0"/>
+ *         <element name="resolucionAltaParaEspecial" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="tipoCalificacionArtesanal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="ultimoPeriodoFiscalCumplido" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "contribuyenteCompleto", propOrder = { + "agenteRetencion", + "calificacionArtesanal", + "contador", + "direccionLarga", + "estructuraOrganizacional", + "fax", + "fechaAltaParaEspecial", + "fechaCalificacionArtesanal", + "fechaCambioObligado", + "fechaInicioActividades", + "fechaNacimiento", + "fechaNotificacionEspeciales", + "fechaUltimaDeclaracion", + "listaBlanca", + "numeroCalificacionArtesanal", + "obligadoContabilidad", + "representanteLegal", + "resolucionAltaParaEspecial", + "tipoCalificacionArtesanal", + "ultimoPeriodoFiscalCumplido" +}) +public class ContribuyenteCompleto + extends Contribuyente +{ + + protected AgenteRetencion agenteRetencion; + protected String calificacionArtesanal; + protected Contador contador; + protected String direccionLarga; + protected EstructuraOrganizacional estructuraOrganizacional; + protected String fax; + protected String fechaAltaParaEspecial; + protected String fechaCalificacionArtesanal; + protected String fechaCambioObligado; + protected String fechaInicioActividades; + protected String fechaNacimiento; + protected String fechaNotificacionEspeciales; + protected String fechaUltimaDeclaracion; + protected ListaBlanca listaBlanca; + protected String numeroCalificacionArtesanal; + protected String obligadoContabilidad; + protected RepresentanteLegal representanteLegal; + protected String resolucionAltaParaEspecial; + protected String tipoCalificacionArtesanal; + protected String ultimoPeriodoFiscalCumplido; + + /** + * Obtiene el valor de la propiedad agenteRetencion. + * + * @return + * possible object is + * {@link AgenteRetencion } + * + */ + public AgenteRetencion getAgenteRetencion() { + return agenteRetencion; + } + + /** + * Define el valor de la propiedad agenteRetencion. + * + * @param value + * allowed object is + * {@link AgenteRetencion } + * + */ + public void setAgenteRetencion(AgenteRetencion value) { + this.agenteRetencion = value; + } + + /** + * Obtiene el valor de la propiedad calificacionArtesanal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCalificacionArtesanal() { + return calificacionArtesanal; + } + + /** + * Define el valor de la propiedad calificacionArtesanal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCalificacionArtesanal(String value) { + this.calificacionArtesanal = value; + } + + /** + * Obtiene el valor de la propiedad contador. + * + * @return + * possible object is + * {@link Contador } + * + */ + public Contador getContador() { + return contador; + } + + /** + * Define el valor de la propiedad contador. + * + * @param value + * allowed object is + * {@link Contador } + * + */ + public void setContador(Contador value) { + this.contador = value; + } + + /** + * Obtiene el valor de la propiedad direccionLarga. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDireccionLarga() { + return direccionLarga; + } + + /** + * Define el valor de la propiedad direccionLarga. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDireccionLarga(String value) { + this.direccionLarga = value; + } + + /** + * Obtiene el valor de la propiedad estructuraOrganizacional. + * + * @return + * possible object is + * {@link EstructuraOrganizacional } + * + */ + public EstructuraOrganizacional getEstructuraOrganizacional() { + return estructuraOrganizacional; + } + + /** + * Define el valor de la propiedad estructuraOrganizacional. + * + * @param value + * allowed object is + * {@link EstructuraOrganizacional } + * + */ + public void setEstructuraOrganizacional(EstructuraOrganizacional value) { + this.estructuraOrganizacional = value; + } + + /** + * Obtiene el valor de la propiedad fax. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFax() { + return fax; + } + + /** + * Define el valor de la propiedad fax. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFax(String value) { + this.fax = value; + } + + /** + * Obtiene el valor de la propiedad fechaAltaParaEspecial. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaAltaParaEspecial() { + return fechaAltaParaEspecial; + } + + /** + * Define el valor de la propiedad fechaAltaParaEspecial. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaAltaParaEspecial(String value) { + this.fechaAltaParaEspecial = value; + } + + /** + * Obtiene el valor de la propiedad fechaCalificacionArtesanal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaCalificacionArtesanal() { + return fechaCalificacionArtesanal; + } + + /** + * Define el valor de la propiedad fechaCalificacionArtesanal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaCalificacionArtesanal(String value) { + this.fechaCalificacionArtesanal = value; + } + + /** + * Obtiene el valor de la propiedad fechaCambioObligado. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaCambioObligado() { + return fechaCambioObligado; + } + + /** + * Define el valor de la propiedad fechaCambioObligado. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaCambioObligado(String value) { + this.fechaCambioObligado = value; + } + + /** + * Obtiene el valor de la propiedad fechaInicioActividades. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaInicioActividades() { + return fechaInicioActividades; + } + + /** + * Define el valor de la propiedad fechaInicioActividades. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaInicioActividades(String value) { + this.fechaInicioActividades = value; + } + + /** + * Obtiene el valor de la propiedad fechaNacimiento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaNacimiento() { + return fechaNacimiento; + } + + /** + * Define el valor de la propiedad fechaNacimiento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaNacimiento(String value) { + this.fechaNacimiento = value; + } + + /** + * Obtiene el valor de la propiedad fechaNotificacionEspeciales. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaNotificacionEspeciales() { + return fechaNotificacionEspeciales; + } + + /** + * Define el valor de la propiedad fechaNotificacionEspeciales. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaNotificacionEspeciales(String value) { + this.fechaNotificacionEspeciales = value; + } + + /** + * Obtiene el valor de la propiedad fechaUltimaDeclaracion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaUltimaDeclaracion() { + return fechaUltimaDeclaracion; + } + + /** + * Define el valor de la propiedad fechaUltimaDeclaracion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaUltimaDeclaracion(String value) { + this.fechaUltimaDeclaracion = value; + } + + /** + * Obtiene el valor de la propiedad listaBlanca. + * + * @return + * possible object is + * {@link ListaBlanca } + * + */ + public ListaBlanca getListaBlanca() { + return listaBlanca; + } + + /** + * Define el valor de la propiedad listaBlanca. + * + * @param value + * allowed object is + * {@link ListaBlanca } + * + */ + public void setListaBlanca(ListaBlanca value) { + this.listaBlanca = value; + } + + /** + * Obtiene el valor de la propiedad numeroCalificacionArtesanal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroCalificacionArtesanal() { + return numeroCalificacionArtesanal; + } + + /** + * Define el valor de la propiedad numeroCalificacionArtesanal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroCalificacionArtesanal(String value) { + this.numeroCalificacionArtesanal = value; + } + + /** + * Obtiene el valor de la propiedad obligadoContabilidad. + * + * @return + * possible object is + * {@link String } + * + */ + public String getObligadoContabilidad() { + return obligadoContabilidad; + } + + /** + * Define el valor de la propiedad obligadoContabilidad. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setObligadoContabilidad(String value) { + this.obligadoContabilidad = value; + } + + /** + * Obtiene el valor de la propiedad representanteLegal. + * + * @return + * possible object is + * {@link RepresentanteLegal } + * + */ + public RepresentanteLegal getRepresentanteLegal() { + return representanteLegal; + } + + /** + * Define el valor de la propiedad representanteLegal. + * + * @param value + * allowed object is + * {@link RepresentanteLegal } + * + */ + public void setRepresentanteLegal(RepresentanteLegal value) { + this.representanteLegal = value; + } + + /** + * Obtiene el valor de la propiedad resolucionAltaParaEspecial. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResolucionAltaParaEspecial() { + return resolucionAltaParaEspecial; + } + + /** + * Define el valor de la propiedad resolucionAltaParaEspecial. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResolucionAltaParaEspecial(String value) { + this.resolucionAltaParaEspecial = value; + } + + /** + * Obtiene el valor de la propiedad tipoCalificacionArtesanal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTipoCalificacionArtesanal() { + return tipoCalificacionArtesanal; + } + + /** + * Define el valor de la propiedad tipoCalificacionArtesanal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTipoCalificacionArtesanal(String value) { + this.tipoCalificacionArtesanal = value; + } + + /** + * Obtiene el valor de la propiedad ultimoPeriodoFiscalCumplido. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUltimoPeriodoFiscalCumplido() { + return ultimoPeriodoFiscalCumplido; + } + + /** + * Define el valor de la propiedad ultimoPeriodoFiscalCumplido. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUltimoPeriodoFiscalCumplido(String value) { + this.ultimoPeriodoFiscalCumplido = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ContribuyenteOnLine.java b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ContribuyenteOnLine.java new file mode 100644 index 0000000..e021464 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ContribuyenteOnLine.java @@ -0,0 +1,332 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para contribuyenteOnLine complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="contribuyenteOnLine">
+ *   <complexContent>
+ *     <extension base="{http://sri.gov.ec/wsConsultaContribuyente}contribuyente">
+ *       <sequence>
+ *         <element name="actEcoPrin" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="activEstablec" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codActEcoPrin" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="desUbicaGeograf" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="descTipoContri" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaIniAct" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="idRepreLegal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nombreRepreLegal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="telefonos" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="tipoContri" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="ubicaGeograf" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "contribuyenteOnLine", propOrder = { + "actEcoPrin", + "activEstablec", + "codActEcoPrin", + "desUbicaGeograf", + "descTipoContri", + "fechaIniAct", + "idRepreLegal", + "nombreRepreLegal", + "telefonos", + "tipoContri", + "ubicaGeograf" +}) +public class ContribuyenteOnLine + extends Contribuyente +{ + + protected String actEcoPrin; + protected String activEstablec; + protected String codActEcoPrin; + protected String desUbicaGeograf; + protected String descTipoContri; + protected String fechaIniAct; + protected String idRepreLegal; + protected String nombreRepreLegal; + protected String telefonos; + protected String tipoContri; + protected String ubicaGeograf; + + /** + * Obtiene el valor de la propiedad actEcoPrin. + * + * @return + * possible object is + * {@link String } + * + */ + public String getActEcoPrin() { + return actEcoPrin; + } + + /** + * Define el valor de la propiedad actEcoPrin. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setActEcoPrin(String value) { + this.actEcoPrin = value; + } + + /** + * Obtiene el valor de la propiedad activEstablec. + * + * @return + * possible object is + * {@link String } + * + */ + public String getActivEstablec() { + return activEstablec; + } + + /** + * Define el valor de la propiedad activEstablec. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setActivEstablec(String value) { + this.activEstablec = value; + } + + /** + * Obtiene el valor de la propiedad codActEcoPrin. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodActEcoPrin() { + return codActEcoPrin; + } + + /** + * Define el valor de la propiedad codActEcoPrin. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodActEcoPrin(String value) { + this.codActEcoPrin = value; + } + + /** + * Obtiene el valor de la propiedad desUbicaGeograf. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDesUbicaGeograf() { + return desUbicaGeograf; + } + + /** + * Define el valor de la propiedad desUbicaGeograf. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDesUbicaGeograf(String value) { + this.desUbicaGeograf = value; + } + + /** + * Obtiene el valor de la propiedad descTipoContri. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDescTipoContri() { + return descTipoContri; + } + + /** + * Define el valor de la propiedad descTipoContri. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDescTipoContri(String value) { + this.descTipoContri = value; + } + + /** + * Obtiene el valor de la propiedad fechaIniAct. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaIniAct() { + return fechaIniAct; + } + + /** + * Define el valor de la propiedad fechaIniAct. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaIniAct(String value) { + this.fechaIniAct = value; + } + + /** + * Obtiene el valor de la propiedad idRepreLegal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIdRepreLegal() { + return idRepreLegal; + } + + /** + * Define el valor de la propiedad idRepreLegal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIdRepreLegal(String value) { + this.idRepreLegal = value; + } + + /** + * Obtiene el valor de la propiedad nombreRepreLegal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombreRepreLegal() { + return nombreRepreLegal; + } + + /** + * Define el valor de la propiedad nombreRepreLegal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombreRepreLegal(String value) { + this.nombreRepreLegal = value; + } + + /** + * Obtiene el valor de la propiedad telefonos. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTelefonos() { + return telefonos; + } + + /** + * Define el valor de la propiedad telefonos. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTelefonos(String value) { + this.telefonos = value; + } + + /** + * Obtiene el valor de la propiedad tipoContri. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTipoContri() { + return tipoContri; + } + + /** + * Define el valor de la propiedad tipoContri. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTipoContri(String value) { + this.tipoContri = value; + } + + /** + * Obtiene el valor de la propiedad ubicaGeograf. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUbicaGeograf() { + return ubicaGeograf; + } + + /** + * Define el valor de la propiedad ubicaGeograf. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUbicaGeograf(String value) { + this.ubicaGeograf = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/EstructuraOrganizacional.java b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/EstructuraOrganizacional.java new file mode 100644 index 0000000..3d1af43 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/EstructuraOrganizacional.java @@ -0,0 +1,160 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para estructuraOrganizacional complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="estructuraOrganizacional">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="codigoProvincia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codigoRegional" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="id" type="{http://www.w3.org/2001/XMLSchema}long"/>
+ *         <element name="nombreProvincia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nombreRegional" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "estructuraOrganizacional", propOrder = { + "codigoProvincia", + "codigoRegional", + "id", + "nombreProvincia", + "nombreRegional" +}) +public class EstructuraOrganizacional { + + protected String codigoProvincia; + protected String codigoRegional; + protected long id; + protected String nombreProvincia; + protected String nombreRegional; + + /** + * Obtiene el valor de la propiedad codigoProvincia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodigoProvincia() { + return codigoProvincia; + } + + /** + * Define el valor de la propiedad codigoProvincia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodigoProvincia(String value) { + this.codigoProvincia = value; + } + + /** + * Obtiene el valor de la propiedad codigoRegional. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodigoRegional() { + return codigoRegional; + } + + /** + * Define el valor de la propiedad codigoRegional. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodigoRegional(String value) { + this.codigoRegional = value; + } + + /** + * Obtiene el valor de la propiedad id. + * + */ + public long getId() { + return id; + } + + /** + * Define el valor de la propiedad id. + * + */ + public void setId(long value) { + this.id = value; + } + + /** + * Obtiene el valor de la propiedad nombreProvincia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombreProvincia() { + return nombreProvincia; + } + + /** + * Define el valor de la propiedad nombreProvincia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombreProvincia(String value) { + this.nombreProvincia = value; + } + + /** + * Obtiene el valor de la propiedad nombreRegional. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombreRegional() { + return nombreRegional; + } + + /** + * Define el valor de la propiedad nombreRegional. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombreRegional(String value) { + this.nombreRegional = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ListaBlanca.java b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ListaBlanca.java new file mode 100644 index 0000000..e64a7e7 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ListaBlanca.java @@ -0,0 +1,60 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para listaBlanca complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="listaBlanca">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="estado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "listaBlanca", propOrder = { + "estado" +}) +public class ListaBlanca { + + protected String estado; + + /** + * Obtiene el valor de la propiedad estado. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEstado() { + return estado; + } + + /** + * Define el valor de la propiedad estado. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEstado(String value) { + this.estado = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObjectFactory.java b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObjectFactory.java new file mode 100644 index 0000000..1bc6b27 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObjectFactory.java @@ -0,0 +1,231 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the ec.gov.sri.wsconsultacontribuyente package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _ObtenerSimple_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerSimple"); + private final static QName _ObtenerCompletoResponse_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerCompletoResponse"); + private final static QName _ObtenerCompleto_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerCompleto"); + private final static QName _ObtenerDatos_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerDatos"); + private final static QName _ObtenerSimpleResponse_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerSimpleResponse"); + private final static QName _ObtenerDatosResponse_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerDatosResponse"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: ec.gov.sri.wsconsultacontribuyente + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link ObtenerSimple } + * + */ + public ObtenerSimple createObtenerSimple() { + return new ObtenerSimple(); + } + + /** + * Create an instance of {@link ObtenerDatosResponse } + * + */ + public ObtenerDatosResponse createObtenerDatosResponse() { + return new ObtenerDatosResponse(); + } + + /** + * Create an instance of {@link ObtenerCompletoResponse } + * + */ + public ObtenerCompletoResponse createObtenerCompletoResponse() { + return new ObtenerCompletoResponse(); + } + + /** + * Create an instance of {@link ObtenerSimpleResponse } + * + */ + public ObtenerSimpleResponse createObtenerSimpleResponse() { + return new ObtenerSimpleResponse(); + } + + /** + * Create an instance of {@link ObtenerDatos } + * + */ + public ObtenerDatos createObtenerDatos() { + return new ObtenerDatos(); + } + + /** + * Create an instance of {@link ObtenerCompleto } + * + */ + public ObtenerCompleto createObtenerCompleto() { + return new ObtenerCompleto(); + } + + /** + * Create an instance of {@link ContribuyenteOnLine } + * + */ + public ContribuyenteOnLine createContribuyenteOnLine() { + return new ContribuyenteOnLine(); + } + + /** + * Create an instance of {@link AgenteRetencion } + * + */ + public AgenteRetencion createAgenteRetencion() { + return new AgenteRetencion(); + } + + /** + * Create an instance of {@link EstructuraOrganizacional } + * + */ + public EstructuraOrganizacional createEstructuraOrganizacional() { + return new EstructuraOrganizacional(); + } + + /** + * Create an instance of {@link ListaBlanca } + * + */ + public ListaBlanca createListaBlanca() { + return new ListaBlanca(); + } + + /** + * Create an instance of {@link RepresentanteLegal } + * + */ + public RepresentanteLegal createRepresentanteLegal() { + return new RepresentanteLegal(); + } + + /** + * Create an instance of {@link Contribuyente } + * + */ + public Contribuyente createContribuyente() { + return new Contribuyente(); + } + + /** + * Create an instance of {@link Contador } + * + */ + public Contador createContador() { + return new Contador(); + } + + /** + * Create an instance of {@link UbicacionGeografica } + * + */ + public UbicacionGeografica createUbicacionGeografica() { + return new UbicacionGeografica(); + } + + /** + * Create an instance of {@link ContribuyenteCompleto } + * + */ + public ContribuyenteCompleto createContribuyenteCompleto() { + return new ContribuyenteCompleto(); + } + + /** + * Create an instance of {@link ActividadEconomica } + * + */ + public ActividadEconomica createActividadEconomica() { + return new ActividadEconomica(); + } + + /** + * Create an instance of {@link TipoContribuyente } + * + */ + public TipoContribuyente createTipoContribuyente() { + return new TipoContribuyente(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerSimple }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerSimple") + public JAXBElement createObtenerSimple(ObtenerSimple value) { + return new JAXBElement(_ObtenerSimple_QNAME, ObtenerSimple.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerCompletoResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerCompletoResponse") + public JAXBElement createObtenerCompletoResponse(ObtenerCompletoResponse value) { + return new JAXBElement(_ObtenerCompletoResponse_QNAME, ObtenerCompletoResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerCompleto }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerCompleto") + public JAXBElement createObtenerCompleto(ObtenerCompleto value) { + return new JAXBElement(_ObtenerCompleto_QNAME, ObtenerCompleto.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerDatos }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerDatos") + public JAXBElement createObtenerDatos(ObtenerDatos value) { + return new JAXBElement(_ObtenerDatos_QNAME, ObtenerDatos.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerSimpleResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerSimpleResponse") + public JAXBElement createObtenerSimpleResponse(ObtenerSimpleResponse value) { + return new JAXBElement(_ObtenerSimpleResponse_QNAME, ObtenerSimpleResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerDatosResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerDatosResponse") + public JAXBElement createObtenerDatosResponse(ObtenerDatosResponse value) { + return new JAXBElement(_ObtenerDatosResponse_QNAME, ObtenerDatosResponse.class, null, value); + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerCompleto.java b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerCompleto.java new file mode 100644 index 0000000..3b0fbc9 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerCompleto.java @@ -0,0 +1,87 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerCompleto complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerCompleto">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="numeroRuc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fuenteDatos" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerCompleto", propOrder = { + "numeroRuc", + "fuenteDatos" +}) +public class ObtenerCompleto { + + protected String numeroRuc; + protected String fuenteDatos; + + /** + * Obtiene el valor de la propiedad numeroRuc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroRuc() { + return numeroRuc; + } + + /** + * Define el valor de la propiedad numeroRuc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroRuc(String value) { + this.numeroRuc = value; + } + + /** + * Obtiene el valor de la propiedad fuenteDatos. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFuenteDatos() { + return fuenteDatos; + } + + /** + * Define el valor de la propiedad fuenteDatos. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFuenteDatos(String value) { + this.fuenteDatos = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerCompletoResponse.java b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerCompletoResponse.java new file mode 100644 index 0000000..9f6de96 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerCompletoResponse.java @@ -0,0 +1,62 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerCompletoResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerCompletoResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://sri.gov.ec/wsConsultaContribuyente}contribuyenteCompleto" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerCompletoResponse", propOrder = { + "_return" +}) +public class ObtenerCompletoResponse { + + @XmlElement(name = "return") + protected ContribuyenteCompleto _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link ContribuyenteCompleto } + * + */ + public ContribuyenteCompleto getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link ContribuyenteCompleto } + * + */ + public void setReturn(ContribuyenteCompleto value) { + this._return = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerDatos.java b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerDatos.java new file mode 100644 index 0000000..89b7627 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerDatos.java @@ -0,0 +1,60 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerDatos complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerDatos">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="numeroRuc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerDatos", propOrder = { + "numeroRuc" +}) +public class ObtenerDatos { + + protected String numeroRuc; + + /** + * Obtiene el valor de la propiedad numeroRuc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroRuc() { + return numeroRuc; + } + + /** + * Define el valor de la propiedad numeroRuc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroRuc(String value) { + this.numeroRuc = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerDatosResponse.java b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerDatosResponse.java new file mode 100644 index 0000000..d749f76 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerDatosResponse.java @@ -0,0 +1,62 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerDatosResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerDatosResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://sri.gov.ec/wsConsultaContribuyente}contribuyenteOnLine" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerDatosResponse", propOrder = { + "_return" +}) +public class ObtenerDatosResponse { + + @XmlElement(name = "return") + protected ContribuyenteOnLine _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link ContribuyenteOnLine } + * + */ + public ContribuyenteOnLine getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link ContribuyenteOnLine } + * + */ + public void setReturn(ContribuyenteOnLine value) { + this._return = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerSimple.java b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerSimple.java new file mode 100644 index 0000000..aaeef05 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerSimple.java @@ -0,0 +1,87 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerSimple complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerSimple">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="numeroRuc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fuenteDatos" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerSimple", propOrder = { + "numeroRuc", + "fuenteDatos" +}) +public class ObtenerSimple { + + protected String numeroRuc; + protected String fuenteDatos; + + /** + * Obtiene el valor de la propiedad numeroRuc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroRuc() { + return numeroRuc; + } + + /** + * Define el valor de la propiedad numeroRuc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroRuc(String value) { + this.numeroRuc = value; + } + + /** + * Obtiene el valor de la propiedad fuenteDatos. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFuenteDatos() { + return fuenteDatos; + } + + /** + * Define el valor de la propiedad fuenteDatos. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFuenteDatos(String value) { + this.fuenteDatos = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerSimpleResponse.java b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerSimpleResponse.java new file mode 100644 index 0000000..022a18b --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerSimpleResponse.java @@ -0,0 +1,62 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerSimpleResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerSimpleResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://sri.gov.ec/wsConsultaContribuyente}contribuyente" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerSimpleResponse", propOrder = { + "_return" +}) +public class ObtenerSimpleResponse { + + @XmlElement(name = "return") + protected Contribuyente _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link Contribuyente } + * + */ + public Contribuyente getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link Contribuyente } + * + */ + public void setReturn(Contribuyente value) { + this._return = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/RepresentanteLegal.java b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/RepresentanteLegal.java new file mode 100644 index 0000000..694f157 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/RepresentanteLegal.java @@ -0,0 +1,114 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para representanteLegal complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="representanteLegal">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="cargo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="identificacion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nombre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "representanteLegal", propOrder = { + "cargo", + "identificacion", + "nombre" +}) +public class RepresentanteLegal { + + protected String cargo; + protected String identificacion; + protected String nombre; + + /** + * Obtiene el valor de la propiedad cargo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCargo() { + return cargo; + } + + /** + * Define el valor de la propiedad cargo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCargo(String value) { + this.cargo = value; + } + + /** + * Obtiene el valor de la propiedad identificacion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIdentificacion() { + return identificacion; + } + + /** + * Define el valor de la propiedad identificacion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIdentificacion(String value) { + this.identificacion = value; + } + + /** + * Obtiene el valor de la propiedad nombre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombre() { + return nombre; + } + + /** + * Define el valor de la propiedad nombre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombre(String value) { + this.nombre = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/TipoContribuyente.java b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/TipoContribuyente.java new file mode 100644 index 0000000..337b0eb --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/TipoContribuyente.java @@ -0,0 +1,195 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para tipoContribuyente complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="tipoContribuyente">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="id" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
+ *         <element name="nivel1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nivel2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nivel3" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nivel4" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="ultimoNivel" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "tipoContribuyente", propOrder = { + "id", + "nivel1", + "nivel2", + "nivel3", + "nivel4", + "ultimoNivel" +}) +public class TipoContribuyente { + + protected Long id; + protected String nivel1; + protected String nivel2; + protected String nivel3; + protected String nivel4; + protected String ultimoNivel; + + /** + * Obtiene el valor de la propiedad id. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getId() { + return id; + } + + /** + * Define el valor de la propiedad id. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setId(Long value) { + this.id = value; + } + + /** + * Obtiene el valor de la propiedad nivel1. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNivel1() { + return nivel1; + } + + /** + * Define el valor de la propiedad nivel1. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNivel1(String value) { + this.nivel1 = value; + } + + /** + * Obtiene el valor de la propiedad nivel2. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNivel2() { + return nivel2; + } + + /** + * Define el valor de la propiedad nivel2. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNivel2(String value) { + this.nivel2 = value; + } + + /** + * Obtiene el valor de la propiedad nivel3. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNivel3() { + return nivel3; + } + + /** + * Define el valor de la propiedad nivel3. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNivel3(String value) { + this.nivel3 = value; + } + + /** + * Obtiene el valor de la propiedad nivel4. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNivel4() { + return nivel4; + } + + /** + * Define el valor de la propiedad nivel4. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNivel4(String value) { + this.nivel4 = value; + } + + /** + * Obtiene el valor de la propiedad ultimoNivel. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUltimoNivel() { + return ultimoNivel; + } + + /** + * Define el valor de la propiedad ultimoNivel. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUltimoNivel(String value) { + this.ultimoNivel = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/UbicacionGeografica.java b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/UbicacionGeografica.java new file mode 100644 index 0000000..b155226 --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/UbicacionGeografica.java @@ -0,0 +1,303 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para ubicacionGeografica complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="ubicacionGeografica">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="canton" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codCanton" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codPais" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codParroquia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codProvincia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codRegion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="pais" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="parroquia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="provincia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="region" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ubicacionGeografica", propOrder = { + "canton", + "codCanton", + "codPais", + "codParroquia", + "codProvincia", + "codRegion", + "pais", + "parroquia", + "provincia", + "region" +}) +public class UbicacionGeografica { + + protected String canton; + protected String codCanton; + protected String codPais; + protected String codParroquia; + protected String codProvincia; + protected String codRegion; + protected String pais; + protected String parroquia; + protected String provincia; + protected String region; + + /** + * Obtiene el valor de la propiedad canton. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCanton() { + return canton; + } + + /** + * Define el valor de la propiedad canton. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCanton(String value) { + this.canton = value; + } + + /** + * Obtiene el valor de la propiedad codCanton. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodCanton() { + return codCanton; + } + + /** + * Define el valor de la propiedad codCanton. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodCanton(String value) { + this.codCanton = value; + } + + /** + * Obtiene el valor de la propiedad codPais. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodPais() { + return codPais; + } + + /** + * Define el valor de la propiedad codPais. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodPais(String value) { + this.codPais = value; + } + + /** + * Obtiene el valor de la propiedad codParroquia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodParroquia() { + return codParroquia; + } + + /** + * Define el valor de la propiedad codParroquia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodParroquia(String value) { + this.codParroquia = value; + } + + /** + * Obtiene el valor de la propiedad codProvincia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodProvincia() { + return codProvincia; + } + + /** + * Define el valor de la propiedad codProvincia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodProvincia(String value) { + this.codProvincia = value; + } + + /** + * Obtiene el valor de la propiedad codRegion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodRegion() { + return codRegion; + } + + /** + * Define el valor de la propiedad codRegion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodRegion(String value) { + this.codRegion = value; + } + + /** + * Obtiene el valor de la propiedad pais. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPais() { + return pais; + } + + /** + * Define el valor de la propiedad pais. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPais(String value) { + this.pais = value; + } + + /** + * Obtiene el valor de la propiedad parroquia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getParroquia() { + return parroquia; + } + + /** + * Define el valor de la propiedad parroquia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setParroquia(String value) { + this.parroquia = value; + } + + /** + * Obtiene el valor de la propiedad provincia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getProvincia() { + return provincia; + } + + /** + * Define el valor de la propiedad provincia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setProvincia(String value) { + this.provincia = value; + } + + /** + * Obtiene el valor de la propiedad region. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRegion() { + return region; + } + + /** + * Define el valor de la propiedad region. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRegion(String value) { + this.region = value; + } + +} diff --git a/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/package-info.java b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/package-info.java new file mode 100644 index 0000000..4878b6d --- /dev/null +++ b/base/persistence/parmas/src/main/java/ec/gov/sri/wsconsultacontribuyente/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://sri.gov.ec/wsConsultaContribuyente") +package ec.gov.sri.wsconsultacontribuyente; diff --git a/base/persistence/parmas/src/test/.svn/entries b/base/persistence/parmas/src/test/.svn/entries new file mode 100644 index 0000000..f38e426 --- /dev/null +++ b/base/persistence/parmas/src/test/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + diff --git a/base/persistence/parmas/src/test/java/.svn/entries b/base/persistence/parmas/src/test/java/.svn/entries new file mode 100644 index 0000000..c023622 --- /dev/null +++ b/base/persistence/parmas/src/test/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/test/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/persistence/parmas/src/test/java/com/.svn/entries b/base/persistence/parmas/src/test/java/com/.svn/entries new file mode 100644 index 0000000..fe4320b --- /dev/null +++ b/base/persistence/parmas/src/test/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/test/java/com +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/persistence/parmas/src/test/java/com/fp/.svn/entries b/base/persistence/parmas/src/test/java/com/fp/.svn/entries new file mode 100644 index 0000000..fbb50a7 --- /dev/null +++ b/base/persistence/parmas/src/test/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/test/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +base +dir + diff --git a/base/persistence/parmas/src/test/java/com/fp/base/.svn/entries b/base/persistence/parmas/src/test/java/com/fp/base/.svn/entries new file mode 100644 index 0000000..919cd62 --- /dev/null +++ b/base/persistence/parmas/src/test/java/com/fp/base/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/test/java/com/fp/base +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +persistence +dir + diff --git a/base/persistence/parmas/src/test/java/com/fp/base/persistence/.svn/entries b/base/persistence/parmas/src/test/java/com/fp/base/persistence/.svn/entries new file mode 100644 index 0000000..3390f96 --- /dev/null +++ b/base/persistence/parmas/src/test/java/com/fp/base/persistence/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/parmas/src/test/java/com/fp/base/persistence +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/ArmaDto.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/ArmaDto.class new file mode 100644 index 0000000..8b7c026 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/ArmaDto.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/ColaImpresionDto.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/ColaImpresionDto.class new file mode 100644 index 0000000..b040eda Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/ColaImpresionDto.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/DatosArmaDto.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/DatosArmaDto.class new file mode 100644 index 0000000..bc0e510 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/DatosArmaDto.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/DatosSnapDto.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/DatosSnapDto.class new file mode 100644 index 0000000..a162f87 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/DatosSnapDto.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/DocumentoDto.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/DocumentoDto.class new file mode 100644 index 0000000..dabbd8a Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/DocumentoDto.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/ImagenDto.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/ImagenDto.class new file mode 100644 index 0000000..e226722 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/ImagenDto.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/InfoGuardiaDto.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/InfoGuardiaDto.class new file mode 100644 index 0000000..a723272 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/InfoGuardiaDto.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/JefeCentroControlDto.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/JefeCentroControlDto.class new file mode 100644 index 0000000..702983a Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/JefeCentroControlDto.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/PersonaDto.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/PersonaDto.class new file mode 100644 index 0000000..bd569fe Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/PersonaDto.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/TramiteDto.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/TramiteDto.class new file mode 100644 index 0000000..acb5103 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/dto/ws/TramiteDto.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/eval/TarmDetallePreguntas.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/eval/TarmDetallePreguntas.class new file mode 100644 index 0000000..44841fe Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/eval/TarmDetallePreguntas.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/eval/TarmEvaluacion.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/eval/TarmEvaluacion.class new file mode 100644 index 0000000..3e8dba3 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/eval/TarmEvaluacion.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/eval/TarmPreguntas.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/eval/TarmPreguntas.class new file mode 100644 index 0000000..bd4dc4a Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/eval/TarmPreguntas.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/eval/TarmRespuestas.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/eval/TarmRespuestas.class new file mode 100644 index 0000000..0ec2dcd Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/eval/TarmRespuestas.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmCarga.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmCarga.class new file mode 100644 index 0000000..721843c Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmCarga.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmCargaDetalle.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmCargaDetalle.class new file mode 100644 index 0000000..9fc6e68 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmCargaDetalle.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmCashManagementHistory.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmCashManagementHistory.class new file mode 100644 index 0000000..1ac7360 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmCashManagementHistory.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmDetalleImportacion.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmDetalleImportacion.class new file mode 100644 index 0000000..fe05f3a Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmDetalleImportacion.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmInventarioSubidoPorPersona.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmInventarioSubidoPorPersona.class new file mode 100644 index 0000000..d2f3914 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmInventarioSubidoPorPersona.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmInventarioSubidoPorPersonaKey.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmInventarioSubidoPorPersonaKey.class new file mode 100644 index 0000000..f1f7473 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmInventarioSubidoPorPersonaKey.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmMovimientoArmas.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmMovimientoArmas.class new file mode 100644 index 0000000..128c706 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmMovimientoArmas.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmRegistroArmas.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmRegistroArmas.class new file mode 100644 index 0000000..238009e Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmRegistroArmas.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmSolicitudImportacion.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmSolicitudImportacion.class new file mode 100644 index 0000000..daec4db Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmSolicitudImportacion.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmSolicitudImportacionKey.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmSolicitudImportacionKey.class new file mode 100644 index 0000000..834fd96 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmSolicitudImportacionKey.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmTotalPersona.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmTotalPersona.class new file mode 100644 index 0000000..a8e8cf7 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmTotalPersona.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmVentaArmaTem.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmVentaArmaTem.class new file mode 100644 index 0000000..f3f83d3 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/fun/TarmVentaArmaTem.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/ins/TarmPlanificacionInspeccion.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/ins/TarmPlanificacionInspeccion.class new file mode 100644 index 0000000..1366d2d Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/ins/TarmPlanificacionInspeccion.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/ins/TarmPlanificacionTramite.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/ins/TarmPlanificacionTramite.class new file mode 100644 index 0000000..1b28e36 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/ins/TarmPlanificacionTramite.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/inte/TarmColadeImpresion.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/inte/TarmColadeImpresion.class new file mode 100644 index 0000000..9d2e545 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/inte/TarmColadeImpresion.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/inte/TarmLectura.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/inte/TarmLectura.class new file mode 100644 index 0000000..1c55bad Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/inte/TarmLectura.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/inte/TarmLecturaDetalle.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/inte/TarmLecturaDetalle.class new file mode 100644 index 0000000..e85ecee Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/inte/TarmLecturaDetalle.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/inte/TarmLecturaDetalleKey.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/inte/TarmLecturaDetalleKey.class new file mode 100644 index 0000000..fd21e11 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/inte/TarmLecturaDetalleKey.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/inte/TarmTagArma.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/inte/TarmTagArma.class new file mode 100644 index 0000000..ab997f2 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/inte/TarmTagArma.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/inte/TarmTagArmaKey.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/inte/TarmTagArmaKey.class new file mode 100644 index 0000000..dea671f Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/inte/TarmTagArmaKey.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmCentroControl.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmCentroControl.class new file mode 100644 index 0000000..a84d12e Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmCentroControl.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmCentroControlJur.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmCentroControlJur.class new file mode 100644 index 0000000..cb2a7ef Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmCentroControlJur.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmComercianteCupo.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmComercianteCupo.class new file mode 100644 index 0000000..368486f Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmComercianteCupo.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmOrigenTramite.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmOrigenTramite.class new file mode 100644 index 0000000..69ba85a Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmOrigenTramite.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmOrigenTramiteKey.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmOrigenTramiteKey.class new file mode 100644 index 0000000..56c1fcb Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmOrigenTramiteKey.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmRequisito.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmRequisito.class new file mode 100644 index 0000000..2cb5d38 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmRequisito.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmRequisitoPorTipoTramite.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmRequisitoPorTipoTramite.class new file mode 100644 index 0000000..5c86242 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmRequisitoPorTipoTramite.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmRequisitoPorTipoTramiteKey.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmRequisitoPorTipoTramiteKey.class new file mode 100644 index 0000000..02db098 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmRequisitoPorTipoTramiteKey.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmSitioAlmacenamiento.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmSitioAlmacenamiento.class new file mode 100644 index 0000000..8c1bbea Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmSitioAlmacenamiento.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmTipoArmaExplosivo.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmTipoArmaExplosivo.class new file mode 100644 index 0000000..5d3ef9b Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmTipoArmaExplosivo.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmTipoSancion.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmTipoSancion.class new file mode 100644 index 0000000..682d9e6 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmTipoSancion.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmTipoTramite.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmTipoTramite.class new file mode 100644 index 0000000..e4e30f0 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmTipoTramite.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmTramite.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmTramite.class new file mode 100644 index 0000000..9b214ca Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmTramite.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmTramitesAtendidos.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmTramitesAtendidos.class new file mode 100644 index 0000000..8f886a1 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmTramitesAtendidos.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmUnidadTipo.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmUnidadTipo.class new file mode 100644 index 0000000..ab4a037 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmUnidadTipo.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmUnidadTipoKey.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmUnidadTipoKey.class new file mode 100644 index 0000000..f2ed089 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/param/TarmUnidadTipoKey.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/CashManagementDTO.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/CashManagementDTO.class new file mode 100644 index 0000000..bfb9a75 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/CashManagementDTO.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmAgenciaArma.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmAgenciaArma.class new file mode 100644 index 0000000..8ae6849 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmAgenciaArma.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmAgenciaArmaKey.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmAgenciaArmaKey.class new file mode 100644 index 0000000..4c8125b Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmAgenciaArmaKey.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmAgenciaSucursal.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmAgenciaSucursal.class new file mode 100644 index 0000000..5c993d3 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmAgenciaSucursal.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmArmaPruebas.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmArmaPruebas.class new file mode 100644 index 0000000..8602464 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmArmaPruebas.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmArmas.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmArmas.class new file mode 100644 index 0000000..70efec6 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmArmas.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmBodega.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmBodega.class new file mode 100644 index 0000000..13e4c4d Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmBodega.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmCabRepDestruirArmas.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmCabRepDestruirArmas.class new file mode 100644 index 0000000..c813cb3 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmCabRepDestruirArmas.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmCertificadoArmas.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmCertificadoArmas.class new file mode 100644 index 0000000..f5215d9 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmCertificadoArmas.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmCertificadoArmasKey.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmCertificadoArmasKey.class new file mode 100644 index 0000000..6764abd Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmCertificadoArmasKey.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmCertificadoFiscalia.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmCertificadoFiscalia.class new file mode 100644 index 0000000..7f541e7 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmCertificadoFiscalia.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmCustodiaTemporal.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmCustodiaTemporal.class new file mode 100644 index 0000000..5454b53 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmCustodiaTemporal.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmDecomiso.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmDecomiso.class new file mode 100644 index 0000000..be6105c Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmDecomiso.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmDecomisoArma.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmDecomisoArma.class new file mode 100644 index 0000000..1499348 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmDecomisoArma.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmDecomisoArmaTransaccion.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmDecomisoArmaTransaccion.class new file mode 100644 index 0000000..7a8648a Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmDecomisoArmaTransaccion.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmDetRepDestruirArmas.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmDetRepDestruirArmas.class new file mode 100644 index 0000000..c1b050b Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmDetRepDestruirArmas.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmDocumentoAlfresco.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmDocumentoAlfresco.class new file mode 100644 index 0000000..aa16400 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmDocumentoAlfresco.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmDocumentoHabilitante.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmDocumentoHabilitante.class new file mode 100644 index 0000000..8d71b6e Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmDocumentoHabilitante.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmDocumentoHabilitanteDetall.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmDocumentoHabilitanteDetall.class new file mode 100644 index 0000000..2882cc8 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmDocumentoHabilitanteDetall.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmGuardias.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmGuardias.class new file mode 100644 index 0000000..6a1d309 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmGuardias.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmInspeccion.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmInspeccion.class new file mode 100644 index 0000000..3ad8aef Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmInspeccion.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmInspeccionArchivo.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmInspeccionArchivo.class new file mode 100644 index 0000000..0552b06 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmInspeccionArchivo.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmInvoiceHistory.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmInvoiceHistory.class new file mode 100644 index 0000000..1a1220a Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmInvoiceHistory.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmOrdenTrabajo.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmOrdenTrabajo.class new file mode 100644 index 0000000..d590289 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmOrdenTrabajo.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmOrdenTrabajoCustodios.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmOrdenTrabajoCustodios.class new file mode 100644 index 0000000..9ee4769 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmOrdenTrabajoCustodios.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSancionDecomiso.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSancionDecomiso.class new file mode 100644 index 0000000..96a8fa6 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSancionDecomiso.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSancionDecomisoKey.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSancionDecomisoKey.class new file mode 100644 index 0000000..99f4b4d Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSancionDecomisoKey.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSancionRecomendacion.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSancionRecomendacion.class new file mode 100644 index 0000000..345c376 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSancionRecomendacion.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitud.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitud.class new file mode 100644 index 0000000..af7c73f Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitud.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudAgenciaSucursal.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudAgenciaSucursal.class new file mode 100644 index 0000000..dbf9471 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudAgenciaSucursal.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudAgenciaSucursalKey.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudAgenciaSucursalKey.class new file mode 100644 index 0000000..f5dc7a5 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudAgenciaSucursalKey.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudArmas.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudArmas.class new file mode 100644 index 0000000..b9bc3d0 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudArmas.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudArmasKey.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudArmasKey.class new file mode 100644 index 0000000..7336aa3 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudArmasKey.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudDocumento.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudDocumento.class new file mode 100644 index 0000000..adceb8b Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudDocumento.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudDocumentoKey.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudDocumentoKey.class new file mode 100644 index 0000000..6106678 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudDocumentoKey.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudGuardias.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudGuardias.class new file mode 100644 index 0000000..22fff81 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudGuardias.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudGuardiasKey.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudGuardiasKey.class new file mode 100644 index 0000000..51c5fbd Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudGuardiasKey.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudRequisitos.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudRequisitos.class new file mode 100644 index 0000000..5b9ae64 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudRequisitos.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudRequisitosKey.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudRequisitosKey.class new file mode 100644 index 0000000..5f05e8a Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudRequisitosKey.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudTramite.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudTramite.class new file mode 100644 index 0000000..038c8aa Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudTramite.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudTramiteKey.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudTramiteKey.class new file mode 100644 index 0000000..992aabd Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmSolicitudTramiteKey.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmTerminos.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmTerminos.class new file mode 100644 index 0000000..59ddab9 Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmTerminos.class differ diff --git a/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmTransaccionArmaBodega.class b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmTransaccionArmaBodega.class new file mode 100644 index 0000000..b69685e Binary files /dev/null and b/base/persistence/parmas/target/classes/com/fp/persistence/parmas/soli/TarmTransaccionArmaBodega.class differ diff --git a/base/persistence/parmas/target/classes/ec/gob/registrocivil/consultacedula/BusquedaPorCedula.class b/base/persistence/parmas/target/classes/ec/gob/registrocivil/consultacedula/BusquedaPorCedula.class new file mode 100644 index 0000000..c59f4bf Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gob/registrocivil/consultacedula/BusquedaPorCedula.class differ diff --git a/base/persistence/parmas/target/classes/ec/gob/registrocivil/consultacedula/BusquedaPorCedulaResponse.class b/base/persistence/parmas/target/classes/ec/gob/registrocivil/consultacedula/BusquedaPorCedulaResponse.class new file mode 100644 index 0000000..d0d191a Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gob/registrocivil/consultacedula/BusquedaPorCedulaResponse.class differ diff --git a/base/persistence/parmas/target/classes/ec/gob/registrocivil/consultacedula/Cedula.class b/base/persistence/parmas/target/classes/ec/gob/registrocivil/consultacedula/Cedula.class new file mode 100644 index 0000000..48a580a Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gob/registrocivil/consultacedula/Cedula.class differ diff --git a/base/persistence/parmas/target/classes/ec/gob/registrocivil/consultacedula/ObjectFactory.class b/base/persistence/parmas/target/classes/ec/gob/registrocivil/consultacedula/ObjectFactory.class new file mode 100644 index 0000000..a7c771a Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gob/registrocivil/consultacedula/ObjectFactory.class differ diff --git a/base/persistence/parmas/target/classes/ec/gob/registrocivil/consultacedula/WsUp.class b/base/persistence/parmas/target/classes/ec/gob/registrocivil/consultacedula/WsUp.class new file mode 100644 index 0000000..916725c Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gob/registrocivil/consultacedula/WsUp.class differ diff --git a/base/persistence/parmas/target/classes/ec/gob/registrocivil/consultacedula/WsUpResponse.class b/base/persistence/parmas/target/classes/ec/gob/registrocivil/consultacedula/WsUpResponse.class new file mode 100644 index 0000000..91a0a35 Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gob/registrocivil/consultacedula/WsUpResponse.class differ diff --git a/base/persistence/parmas/target/classes/ec/gob/registrocivil/consultacedula/package-info.class b/base/persistence/parmas/target/classes/ec/gob/registrocivil/consultacedula/package-info.class new file mode 100644 index 0000000..e6e8d8c Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gob/registrocivil/consultacedula/package-info.class differ diff --git a/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ActividadEconomica.class b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ActividadEconomica.class new file mode 100644 index 0000000..6ae8910 Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ActividadEconomica.class differ diff --git a/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/AgenteRetencion.class b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/AgenteRetencion.class new file mode 100644 index 0000000..d90a65f Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/AgenteRetencion.class differ diff --git a/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/Contador.class b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/Contador.class new file mode 100644 index 0000000..16d94a7 Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/Contador.class differ diff --git a/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/Contribuyente.class b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/Contribuyente.class new file mode 100644 index 0000000..4655aeb Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/Contribuyente.class differ diff --git a/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ContribuyenteCompleto.class b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ContribuyenteCompleto.class new file mode 100644 index 0000000..89fb6f0 Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ContribuyenteCompleto.class differ diff --git a/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ContribuyenteOnLine.class b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ContribuyenteOnLine.class new file mode 100644 index 0000000..b51a294 Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ContribuyenteOnLine.class differ diff --git a/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/EstructuraOrganizacional.class b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/EstructuraOrganizacional.class new file mode 100644 index 0000000..6afa481 Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/EstructuraOrganizacional.class differ diff --git a/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ListaBlanca.class b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ListaBlanca.class new file mode 100644 index 0000000..ae7db4c Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ListaBlanca.class differ diff --git a/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ObjectFactory.class b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ObjectFactory.class new file mode 100644 index 0000000..0bc7e9f Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ObjectFactory.class differ diff --git a/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ObtenerCompleto.class b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ObtenerCompleto.class new file mode 100644 index 0000000..d909b00 Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ObtenerCompleto.class differ diff --git a/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ObtenerCompletoResponse.class b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ObtenerCompletoResponse.class new file mode 100644 index 0000000..7c0678e Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ObtenerCompletoResponse.class differ diff --git a/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ObtenerDatos.class b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ObtenerDatos.class new file mode 100644 index 0000000..131cb7f Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ObtenerDatos.class differ diff --git a/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ObtenerDatosResponse.class b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ObtenerDatosResponse.class new file mode 100644 index 0000000..dbee726 Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ObtenerDatosResponse.class differ diff --git a/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ObtenerSimple.class b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ObtenerSimple.class new file mode 100644 index 0000000..68fb8e2 Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ObtenerSimple.class differ diff --git a/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ObtenerSimpleResponse.class b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ObtenerSimpleResponse.class new file mode 100644 index 0000000..036ac16 Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/ObtenerSimpleResponse.class differ diff --git a/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/RepresentanteLegal.class b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/RepresentanteLegal.class new file mode 100644 index 0000000..fed9f24 Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/RepresentanteLegal.class differ diff --git a/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/TipoContribuyente.class b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/TipoContribuyente.class new file mode 100644 index 0000000..7f86d91 Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/TipoContribuyente.class differ diff --git a/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/UbicacionGeografica.class b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/UbicacionGeografica.class new file mode 100644 index 0000000..3004186 Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/UbicacionGeografica.class differ diff --git a/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/package-info.class b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/package-info.class new file mode 100644 index 0000000..4b28b0a Binary files /dev/null and b/base/persistence/parmas/target/classes/ec/gov/sri/wsconsultacontribuyente/package-info.class differ diff --git a/base/persistence/parmas/target/maven-archiver/pom.properties b/base/persistence/parmas/target/maven-archiver/pom.properties new file mode 100644 index 0000000..1a0911d --- /dev/null +++ b/base/persistence/parmas/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:53:06 ECT 2022 +version=2.1 +groupId=com.fp.base.persistence +artifactId=parmas diff --git a/base/persistence/parmas/target/parmas-2.1.jar b/base/persistence/parmas/target/parmas-2.1.jar new file mode 100644 index 0000000..f7a90ce Binary files /dev/null and b/base/persistence/parmas/target/parmas-2.1.jar differ diff --git a/base/persistence/pbpm/.svn/dir-prop-base b/base/persistence/pbpm/.svn/dir-prop-base new file mode 100644 index 0000000..3e2a6f2 --- /dev/null +++ b/base/persistence/pbpm/.svn/dir-prop-base @@ -0,0 +1,9 @@ +K 10 +svn:ignore +V 37 +.classpath +.project +.settings +target + +END diff --git a/base/persistence/pbpm/.svn/entries b/base/persistence/pbpm/.svn/entries new file mode 100644 index 0000000..406bc94 --- /dev/null +++ b/base/persistence/pbpm/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pbpm +svn://172.17.26.185/COMACO + + + +2015-02-22T10:58:24.700720Z +3845 +cpiedra +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:32.762760Z +7e83ba32705e393f266d65be55846921 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +565 + diff --git a/base/persistence/pbpm/.svn/text-base/pom.xml.svn-base b/base/persistence/pbpm/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..560df05 --- /dev/null +++ b/base/persistence/pbpm/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,16 @@ + + + + persistence + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.persistence + pbpm + pbpm + + diff --git a/base/persistence/pbpm/pom.xml b/base/persistence/pbpm/pom.xml new file mode 100644 index 0000000..560df05 --- /dev/null +++ b/base/persistence/pbpm/pom.xml @@ -0,0 +1,16 @@ + + + + persistence + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.persistence + pbpm + pbpm + + diff --git a/base/persistence/pbpm/src/.svn/entries b/base/persistence/pbpm/src/.svn/entries new file mode 100644 index 0000000..17ed068 --- /dev/null +++ b/base/persistence/pbpm/src/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pbpm/src +svn://172.17.26.185/COMACO + + + +2015-02-22T10:58:24.700720Z +3845 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +main +dir + diff --git a/base/persistence/pbpm/src/main/.svn/entries b/base/persistence/pbpm/src/main/.svn/entries new file mode 100644 index 0000000..b23e3b0 --- /dev/null +++ b/base/persistence/pbpm/src/main/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pbpm/src/main +svn://172.17.26.185/COMACO + + + +2015-02-22T10:58:24.700720Z +3845 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/persistence/pbpm/src/main/java/.svn/entries b/base/persistence/pbpm/src/main/java/.svn/entries new file mode 100644 index 0000000..9aadc6c --- /dev/null +++ b/base/persistence/pbpm/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pbpm/src/main/java +svn://172.17.26.185/COMACO + + + +2015-02-22T10:58:24.700720Z +3845 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/persistence/pbpm/src/main/java/com/.svn/entries b/base/persistence/pbpm/src/main/java/com/.svn/entries new file mode 100644 index 0000000..e8a4b3d --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pbpm/src/main/java/com +svn://172.17.26.185/COMACO + + + +2015-02-22T10:58:24.700720Z +3845 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/persistence/pbpm/src/main/java/com/fp/.svn/entries b/base/persistence/pbpm/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..fe28f64 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pbpm/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2015-02-22T10:58:24.700720Z +3845 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +persistence +dir + diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/.svn/entries b/base/persistence/pbpm/src/main/java/com/fp/persistence/.svn/entries new file mode 100644 index 0000000..c73e877 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pbpm/src/main/java/com/fp/persistence +svn://172.17.26.185/COMACO + + + +2015-02-22T10:58:24.700720Z +3845 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +pbpm +dir + diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/.svn/entries b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/.svn/entries new file mode 100644 index 0000000..97f441b --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm +svn://172.17.26.185/COMACO + + + +2015-02-22T10:58:24.700720Z +3845 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +gene +dir + diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/entries b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/entries new file mode 100644 index 0000000..f5baf91 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/entries @@ -0,0 +1,742 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene +svn://172.17.26.185/COMACO + + + +2015-02-22T10:58:24.700720Z +3845 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TbpmActivitiesKey.java +file + + + + +2022-07-28T03:40:32.477759Z +1e86a7d0d6d991cb6e882b9404cf0fc4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4120 + +TbpmGroups.java +file + + + + +2022-07-28T03:40:32.477759Z +317f20c44509b7d3d4b4d595845a3d3b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4551 + +TbpmProcessVariablesKey.java +file + + + + +2022-07-28T03:40:32.477759Z +85446449fafb4ce2f7e593eb451aa8ce +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3282 + +TbpmField.java +file + + + + +2022-07-28T03:40:32.478759Z +45c3bec1e697b00a81f6b6b5d6ee8ebb +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4301 + +TbpmLogMail.java +file + + + + +2022-07-28T03:40:32.478759Z +5f8a0c47bbeae07140902b319a87a172 +2015-02-22T10:58:24.700720Z +3845 +cpiedra + + + + + + + + + + + + + + + + + + + + + +6361 + +TbpmFieldTransactionMaping.java +file + + + + +2022-07-28T03:40:32.478759Z +05d095f75093a0ec98ab2de34f949c52 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6657 + +TbpmGroupsKey.java +file + + + + +2022-07-28T03:40:32.478759Z +3f79bc47ac3fb69cb3e5322a21ebdbe9 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3311 + +TbpmFlows.java +file + + + + +2022-07-28T03:40:32.479759Z +b7bcd3628e4a5784561c9fc459d2a98c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4143 + +TbpmRules.java +file + + + + +2022-07-28T03:40:32.479759Z +a8197e49440c7de8ee113da07c203068 +2014-10-30T05:42:15.708160Z +2201 +dcruz + + + + + + + + + + + + + + + + + + + + + +12247 + +TbpmFieldTransactionMapingKey.java +file + + + + +2022-07-28T03:40:32.479759Z +da835abeb2b2f7382ca2ea5434c78fc8 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5514 + +TbpmGroupsUsers.java +file + + + + +2022-07-28T03:40:32.480759Z +e2142e79eab4726ee627415fd1edc812 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6978 + +TbpmFieldTransactionOrigin.java +file + + + + +2022-07-28T03:40:32.479759Z +11645cd640011d4c0f365de9646f34d8 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6751 + +TbpmProcessInstance.java +file + + + + +2022-07-28T03:40:32.480759Z +d347200eb68b636556fdc465fc64d11f +2014-10-30T05:43:34.974419Z +2203 +dcruz + + + + + + + + + + + + + + + + + + + + + +8228 + +TbpmFlowsKey.java +file + + + + +2022-07-28T03:40:32.480759Z +b53573b9c740afd06aa3299e80733cf9 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3234 + +TbpmRulesKey.java +file + + + + +2022-07-28T03:40:32.480759Z +ffd98034f8d48cb6d42567a03d86407b +2014-10-30T05:42:52.942414Z +2202 +dcruz + + + + + + + + + + + + + + + + + + + + + +3256 + +TbpmActivities.java +file + + + + +2022-07-28T03:40:32.481759Z +f0b292dc55ec861c64a9c3b13aff144d +2014-10-30T05:38:19.278054Z +2200 +dcruz + + + + + + + + + + + + + + + + + + + + + +10085 + +TbpmProcessVariables.java +file + + + + +2022-07-28T03:40:32.481759Z +bd5435dac6b6d969811c22e4024009a9 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5290 + +TbpmNotify.java +file + + + + +2022-07-28T03:40:32.481759Z +7db2f2eedda26308b2ba7a28237c4e21 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8076 + +TbpmTaskComments.java +file + + + + +2022-07-28T03:40:32.481759Z +6b3a457deadd31ab6754091b7e3f8e95 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4819 + +TbpmGroupsUsersKey.java +file + + + + +2022-07-28T03:40:32.482759Z +7c864a04ae09410f8850960561fd5315 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4055 + +TbpmFieldTransactionOriginKey.java +file + + + + +2022-07-28T03:40:32.482759Z +ffdd487c2547ef46cdd4b381dfdbec33 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5514 + diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmActivities.java.svn-base b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmActivities.java.svn-base new file mode 100644 index 0000000..f9c2c67 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmActivities.java.svn-base @@ -0,0 +1,446 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMACTIVITIES*/ +@Entity(name="TbpmActivities") +@Table(name="TBPMACTIVITIES") +public class TbpmActivities extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TbpmActivities +*/ +@EmbeddedId +private TbpmActivitiesKey pk; +@Column(name="USERCODE", nullable=true) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="GROUPCODE", nullable=true) + +/** +* Codigo de grupo de usuarios de un bpm +*/ +private String groupcode; + +@Column(name="COMPANYCODE", nullable=true) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="ACTION", nullable=true) + +/** +* Tipo de Asignacion +*/ +private String action; + +@Column(name="ADITIONALDATA", nullable=true) + +/** +* Variables adicionales +*/ +private String aditionaldata; + +@Column(name="COMPLETED", nullable=true) + +/** +* Fecha de finalizacion +*/ +private Timestamp completed; + +@Column(name="CREATED", nullable=true) + +/** +* Fecha de creacion +*/ +private Timestamp created; + +@Column(name="EXPECTEDTIME", nullable=true) + +/** +* Tiempo estimado +*/ +private Long expectedtime; + +@Column(name="TASKJOURNALID", nullable=true) + +/** +* Identificador de la transaccion de la Tarea +*/ +private String taskjournalid; + +@Column(name="RESPONSE", nullable=true) + +/** +* Respuesta +*/ +private String response; + +@Column(name="RULECODE", nullable=true) + +/** +* Codigo de la Regla asociada +*/ +private String rulecode; + +@Column(name="RULECODEDEFAULT", nullable=true) + +/** +* Codigo de la Regla adicional +*/ +private String rulecodedefault; + +@Column(name="STARTED", nullable=true) + +/** +* Iniciada +*/ +private Timestamp started; + +@Column(name="TASKID", nullable=true) + +/** +* Identificador de la Tarea +*/ +private Long taskid; + +@Column(name="MODULE", nullable=true) + +/** +* Modulo +*/ +private String module; + +@Column(name="TRANSACTION", nullable=true) + +/** +* Transaccion +*/ +private Long transaction; + +@Column(name="VERSION", nullable=true) + +/** +* Version de la transacion +*/ +private Long version; + +@Column(name="INTERNALCODE", nullable=true) + +/** +* Codigo Auxiliar +*/ +private String internalcode; + +/**Contructor por defecto*/ +public TbpmActivities(){ +} +/**Contructor de TbpmActivities +@param pPk Clave Primaria del entity +*/ +public TbpmActivities(TbpmActivitiesKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TbpmActivities +*/ +public static TbpmActivities find(EntityManager pEntityManager,TbpmActivitiesKey pKey) throws Exception{ + TbpmActivities obj = pEntityManager.find(TbpmActivities.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TbpmActivities +@return El objeto que referencia a la Clave primaria de TbpmActivities +*/ +public TbpmActivitiesKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TbpmActivities +@param pPk El objeto que referencia a la nueva Clave primaria de TbpmActivities +*/ +public void setPk(TbpmActivitiesKey pPk){ + pk=pPk; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de groupcode +@return valor de groupcode*/ +public String getGroupcode(){ + return groupcode; +} +/**Fija el valor de groupcode +@param pGroupcode nuevo Valor de groupcode*/ +public void setGroupcode(String pGroupcode){ + groupcode=pGroupcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de action +@return valor de action*/ +public String getAction(){ + return action; +} +/**Fija el valor de action +@param pAction nuevo Valor de action*/ +public void setAction(String pAction){ + action=pAction; +} + +/**Obtiene el valor de aditionaldata +@return valor de aditionaldata*/ +public String getAditionaldata(){ + return aditionaldata; +} +/**Fija el valor de aditionaldata +@param pAditionaldata nuevo Valor de aditionaldata*/ +public void setAditionaldata(String pAditionaldata){ + aditionaldata=pAditionaldata; +} + +/**Obtiene el valor de completed +@return valor de completed*/ +public Timestamp getCompleted(){ + return completed; +} +/**Fija el valor de completed +@param pCompleted nuevo Valor de completed*/ +public void setCompleted(Timestamp pCompleted){ + completed=pCompleted; +} + +/**Obtiene el valor de created +@return valor de created*/ +public Timestamp getCreated(){ + return created; +} +/**Fija el valor de created +@param pCreated nuevo Valor de created*/ +public void setCreated(Timestamp pCreated){ + created=pCreated; +} + +/**Obtiene el valor de expectedtime +@return valor de expectedtime*/ +public Long getExpectedtime(){ + return expectedtime; +} +/**Fija el valor de expectedtime +@param pExpectedtime nuevo Valor de expectedtime*/ +public void setExpectedtime(Long pExpectedtime){ + expectedtime=pExpectedtime; +} + +/**Obtiene el valor de taskjournalid +@return valor de taskjournalid*/ +public String getTaskjournalid(){ + return taskjournalid; +} +/**Fija el valor de taskjournalid +@param pTaskjournalid nuevo Valor de taskjournalid*/ +public void setTaskjournalid(String pTaskjournalid){ + taskjournalid=pTaskjournalid; +} + +/**Obtiene el valor de response +@return valor de response*/ +public String getResponse(){ + return response; +} +/**Fija el valor de response +@param pResponse nuevo Valor de response*/ +public void setResponse(String pResponse){ + response=pResponse; +} + +/**Obtiene el valor de rulecode +@return valor de rulecode*/ +public String getRulecode(){ + return rulecode; +} +/**Fija el valor de rulecode +@param pRulecode nuevo Valor de rulecode*/ +public void setRulecode(String pRulecode){ + rulecode=pRulecode; +} + +/**Obtiene el valor de rulecodedefault +@return valor de rulecodedefault*/ +public String getRulecodedefault(){ + return rulecodedefault; +} +/**Fija el valor de rulecodedefault +@param pRulecodedefault nuevo Valor de rulecodedefault*/ +public void setRulecodedefault(String pRulecodedefault){ + rulecodedefault=pRulecodedefault; +} + +/**Obtiene el valor de started +@return valor de started*/ +public Timestamp getStarted(){ + return started; +} +/**Fija el valor de started +@param pStarted nuevo Valor de started*/ +public void setStarted(Timestamp pStarted){ + started=pStarted; +} + +/**Obtiene el valor de taskid +@return valor de taskid*/ +public Long getTaskid(){ + return taskid; +} +/**Fija el valor de taskid +@param pTaskid nuevo Valor de taskid*/ +public void setTaskid(Long pTaskid){ + taskid=pTaskid; +} + +/**Obtiene el valor de module +@return valor de module*/ +public String getModule(){ + return module; +} +/**Fija el valor de module +@param pModule nuevo Valor de module*/ +public void setModule(String pModule){ + module=pModule; +} + +/**Obtiene el valor de transaction +@return valor de transaction*/ +public Long getTransaction(){ + return transaction; +} +/**Fija el valor de transaction +@param pTransaction nuevo Valor de transaction*/ +public void setTransaction(Long pTransaction){ + transaction=pTransaction; +} + +/**Obtiene el valor de version +@return valor de version*/ +public Long getVersion(){ + return version; +} +/**Fija el valor de version +@param pVersion nuevo Valor de version*/ +public void setVersion(Long pVersion){ + version=pVersion; +} + +/**Obtiene el valor de internalcode +@return valor de internalcode*/ +public String getInternalcode(){ + return internalcode; +} +/**Fija el valor de internalcode +@param pInternalcode nuevo Valor de internalcode*/ +public void setInternalcode(String pInternalcode){ + internalcode=pInternalcode; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TbpmActivities))return false; + TbpmActivities that = (TbpmActivities) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TbpmActivities +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TbpmActivities +*/ +public Object createInstance(){ + TbpmActivities instance=new TbpmActivities(); + instance.setPk(new TbpmActivitiesKey()); + return instance; +} +/**Clona la entidad TbpmActivities +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TbpmActivities p=(TbpmActivities)this.clone(); + p.setPk((TbpmActivitiesKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmActivitiesKey.java.svn-base b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmActivitiesKey.java.svn-base new file mode 100644 index 0000000..49fbc19 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmActivitiesKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TBPMACTIVITIES*/ +@Embeddable +public class TbpmActivitiesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="JOURNALID", nullable=false,updatable=false) + +/** +* Numero de mensaje asociado al a instacioa del flujo. +*/ +private String journalid; + +@Column(name="ACTIVITYNAME", nullable=false,updatable=false) + +/** +* Nombre de la Actividad +*/ +private String activityname; + +@Column(name="SEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de Actividades +*/ +private Integer sequence; + +/**Contructor por defecto*/ +public TbpmActivitiesKey(){} +/**Contructor de TbpmActivitiesKey +@param pJournalid Numero de mensaje asociado al a instacioa del flujo. +@param pActivityname Nombre de la Actividad +@param pSequence Secuencia de Actividades +*/ +public TbpmActivitiesKey(String pJournalid,String pActivityname,Integer pSequence){ + journalid=pJournalid; + activityname=pActivityname; + sequence=pSequence; +} +/**Obtiene el valor de journalid +@return valor de journalid*/ +public String getJournalid(){ + return journalid; +} +/**Fija el valor de journalid +@param pJournalid nuevo Valor de journalid*/ +public void setJournalid(String pJournalid){ + journalid=pJournalid; +} + +/**Obtiene el valor de activityname +@return valor de activityname*/ +public String getActivityname(){ + return activityname; +} +/**Fija el valor de activityname +@param pActivityname nuevo Valor de activityname*/ +public void setActivityname(String pActivityname){ + activityname=pActivityname; +} + +/**Obtiene el valor de sequence +@return valor de sequence*/ +public Integer getSequence(){ + return sequence; +} +/**Fija el valor de sequence +@param pSequence nuevo Valor de sequence*/ +public void setSequence(Integer pSequence){ + sequence=pSequence; +} + +/**Implementacion de la comparacion de TbpmActivitiesKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TbpmActivitiesKey))return false; + TbpmActivitiesKey that = (TbpmActivitiesKey) o; + if (this.getJournalid() == null || that.getJournalid() == null){ + return false; + } + if (! this.getJournalid().equals(that.getJournalid())){ + return false; + } + if (this.getActivityname() == null || that.getActivityname() == null){ + return false; + } + if (! this.getActivityname().equals(that.getActivityname())){ + return false; + } + if (this.getSequence() == null || that.getSequence() == null){ + return false; + } + if (! this.getSequence().equals(that.getSequence())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TbpmActivitiesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getJournalid() == null ? 0 : this.getJournalid().hashCode()); + result = result * 37 + (this.getActivityname() == null ? 0 : this.getActivityname().hashCode()); + result = result * 37 + (this.getSequence() == null ? 0 : this.getSequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmField.java.svn-base b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmField.java.svn-base new file mode 100644 index 0000000..4270a36 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmField.java.svn-base @@ -0,0 +1,160 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMFIELD*/ +@Entity(name="TbpmField") +@Table(name="TBPMFIELD") +public class TbpmField extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TbpmField +*/ +@Id +@Column(name="FIELDNAME" ,nullable=false, updatable=false) +private String pk; +@Version +@Column(name="RECORDVERSION", nullable=false) + +/** +* Codigo de session en las tablas del jbpm asociadas al flujo +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion de la utilizacion del campo. +*/ +private String description; + +/**Contructor por defecto*/ +public TbpmField(){ +} +/**Contructor de TbpmField +@param pPk Clave Primaria del entity +@param pRecordversion Codigo de session en las tablas del jbpm asociadas al flujo +*/ +public TbpmField(String pPk,Integer pRecordversion){ + this(); + pk=pPk; + recordversion=pRecordversion; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TbpmField +*/ +public static TbpmField find(EntityManager pEntityManager,Object pKey) throws Exception{ + TbpmField obj = pEntityManager.find(TbpmField.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TbpmField +@return El objeto que referencia a la Clave primaria de TbpmField +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TbpmField +@param pPk El objeto que referencia a la nueva Clave primaria de TbpmField +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TbpmField))return false; + TbpmField that = (TbpmField) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TbpmField +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TbpmField +*/ +public Object createInstance(){ + TbpmField instance=new TbpmField(); + return instance; +} +/**Clona la entidad TbpmField +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TbpmField p=(TbpmField)this.clone(); + return p; +} +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmFieldTransactionMaping.java.svn-base b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmFieldTransactionMaping.java.svn-base new file mode 100644 index 0000000..b2773f8 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmFieldTransactionMaping.java.svn-base @@ -0,0 +1,211 @@ +package com.fp.persistence.pbpm.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMFIELDTRANSACTIONMAPING */ +@Entity(name = "TbpmFieldTransactionMaping") +@Table(name = "TBPMFIELDTRANSACTIONMAPING") +public class TbpmFieldTransactionMaping extends com.fp.dto.AbstractDataTransport implements Serializable, + HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TbpmFieldTransactionMaping + */ + @EmbeddedId + private TbpmFieldTransactionMapingKey pk; + + @Column(name = "FIELDSCREEN", nullable = true) + /** + * Nombre del campo para la pantalla + */ + private String fieldscreen; + + /** Contructor por defecto */ + public TbpmFieldTransactionMaping() { + } + + /** + * Contructor de TbpmFieldTransactionMaping + * + * @param pPk Clave Primaria del entity + */ + public TbpmFieldTransactionMaping(TbpmFieldTransactionMapingKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TbpmFieldTransactionMaping + */ + public static TbpmFieldTransactionMaping find(EntityManager pEntityManager, TbpmFieldTransactionMapingKey pKey) + throws Exception { + TbpmFieldTransactionMaping obj = pEntityManager.find(TbpmFieldTransactionMaping.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TbpmFieldTransactionMaping + * + * @return El objeto que referencia a la Clave primaria de TbpmFieldTransactionMaping + */ + public TbpmFieldTransactionMapingKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TbpmFieldTransactionMaping + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TbpmFieldTransactionMaping + */ + public void setPk(TbpmFieldTransactionMapingKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de fieldscreen + * + * @return valor de fieldscreen + */ + public String getFieldscreen() { + return this.fieldscreen; + } + + /** + * Fija el valor de fieldscreen + * + * @param pFieldscreen nuevo Valor de fieldscreen + */ + public void setFieldscreen(String pFieldscreen) { + this.fieldscreen = pFieldscreen; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TbpmFieldTransactionMaping)) { + return false; + } + TbpmFieldTransactionMaping that = (TbpmFieldTransactionMaping) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TbpmFieldTransactionMaping + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementaci�n toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementaci�n de la creaci�n de un bean en blanco TbpmFieldTransactionMaping */ + @Override + public Object createInstance() { + TbpmFieldTransactionMaping instance = new TbpmFieldTransactionMaping(); + instance.setPk(new TbpmFieldTransactionMapingKey()); + return instance; + } + + /** + * Clona la entidad TbpmFieldTransactionMaping + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TbpmFieldTransactionMaping p = (TbpmFieldTransactionMaping) this.clone(); + p.setPk((TbpmFieldTransactionMapingKey) this.pk.cloneMe()); + return p; + } + + // Metodos manuales. + + /** Sentecia que entrega una lista de TbpmFieldTransactionOrigin dado un codigo de transaccion. */ + private static final String HQL_FIELDS = "from TbpmFieldTransactionMaping t where t.pk.transactionmodule = :module " + + "and t.pk.transactioncode = :transaction and t.pk.transactionversion = :version "; + + /** + * Metodo que entrega una lista de registros de la tabla TbpmFieldTransactionOrigin dado un codigo de transaccion. + * + * @param pEntityManager Referencia a la session de la base de datos. + * @param pGroupcode Codigo de grupo a obtener una lista de usuarios. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pModule, + Integer pTransaction, Integer pVersion) throws Exception { + Query qry = pEntityManager.createQuery(TbpmFieldTransactionMaping.HQL_FIELDS); + qry.setParameter("module", pModule); + qry.setParameter("transaction", pTransaction); + qry.setParameter("version", pVersion); + return qry.getResultList(); + + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmFieldTransactionMapingKey.java.svn-base b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmFieldTransactionMapingKey.java.svn-base new file mode 100644 index 0000000..4a80a3d --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmFieldTransactionMapingKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TBPMFIELDTRANSACTIONMAPING*/ +@Embeddable +public class TbpmFieldTransactionMapingKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="FIELDNAME", nullable=false,updatable=false) + +/** +* Numero de mensaje asociado al a instacioa del flujo. +*/ +private String fieldname; + +/**Contructor por defecto*/ +public TbpmFieldTransactionMapingKey(){} +/**Contructor de TbpmFieldTransactionMapingKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pFieldname Numero de mensaje asociado al a instacioa del flujo. +*/ +public TbpmFieldTransactionMapingKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,String pFieldname){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + fieldname=pFieldname; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de fieldname +@return valor de fieldname*/ +public String getFieldname(){ + return fieldname; +} +/**Fija el valor de fieldname +@param pFieldname nuevo Valor de fieldname*/ +public void setFieldname(String pFieldname){ + fieldname=pFieldname; +} + +/**Implementacin de la comparacin de TbpmFieldTransactionMapingKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TbpmFieldTransactionMapingKey))return false; + TbpmFieldTransactionMapingKey that = (TbpmFieldTransactionMapingKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getFieldname() == null || that.getFieldname() == null){ + return false; + } + if (! this.getFieldname().equals(that.getFieldname())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TbpmFieldTransactionMapingKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getFieldname() == null ? 0 : this.getFieldname().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmFieldTransactionOrigin.java.svn-base b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmFieldTransactionOrigin.java.svn-base new file mode 100644 index 0000000..48d2e5e --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmFieldTransactionOrigin.java.svn-base @@ -0,0 +1,211 @@ +package com.fp.persistence.pbpm.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMFIELDTRANSACTIONORIGIN */ +@Entity(name = "TbpmFieldTransactionOrigin") +@Table(name = "TBPMFIELDTRANSACTIONORIGIN") +public class TbpmFieldTransactionOrigin extends com.fp.dto.AbstractDataTransport implements Serializable, + HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TbpmFieldTransactionOrigin + */ + @EmbeddedId + private TbpmFieldTransactionOriginKey pk; + + @Column(name = "EXPRESIONLANGUAGE", nullable = true) + /** + * Expresion language que entrega el valor del campo + */ + private String expresionlanguage; + + /** Contructor por defecto */ + public TbpmFieldTransactionOrigin() { + } + + /** + * Contructor de TbpmFieldTransactionOrigin + * + * @param pPk Clave Primaria del entity + */ + public TbpmFieldTransactionOrigin(TbpmFieldTransactionOriginKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TbpmFieldTransactionOrigin + */ + public static TbpmFieldTransactionOrigin find(EntityManager pEntityManager, TbpmFieldTransactionOriginKey pKey) + throws Exception { + TbpmFieldTransactionOrigin obj = pEntityManager.find(TbpmFieldTransactionOrigin.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TbpmFieldTransactionOrigin + * + * @return El objeto que referencia a la Clave primaria de TbpmFieldTransactionOrigin + */ + public TbpmFieldTransactionOriginKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TbpmFieldTransactionOrigin + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TbpmFieldTransactionOrigin + */ + public void setPk(TbpmFieldTransactionOriginKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de expresionlanguage + * + * @return valor de expresionlanguage + */ + public String getExpresionlanguage() { + return this.expresionlanguage; + } + + /** + * Fija el valor de expresionlanguage + * + * @param pExpresionlanguage nuevo Valor de expresionlanguage + */ + public void setExpresionlanguage(String pExpresionlanguage) { + this.expresionlanguage = pExpresionlanguage; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TbpmFieldTransactionOrigin)) { + return false; + } + TbpmFieldTransactionOrigin that = (TbpmFieldTransactionOrigin) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TbpmFieldTransactionOrigin + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementaci�n toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementaci�n de la creaci�n de un bean en blanco TbpmFieldTransactionOrigin */ + @Override + public Object createInstance() { + TbpmFieldTransactionOrigin instance = new TbpmFieldTransactionOrigin(); + instance.setPk(new TbpmFieldTransactionOriginKey()); + return instance; + } + + /** + * Clona la entidad TbpmFieldTransactionOrigin + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TbpmFieldTransactionOrigin p = (TbpmFieldTransactionOrigin) this.clone(); + p.setPk((TbpmFieldTransactionOriginKey) this.pk.cloneMe()); + return p; + } + + // Metodos manuales. + + /** Sentecia que entrega una lista de TbpmFieldTransactionOrigin dado un codigo de transaccion. */ + private static final String HQL_FIELDS = "from TbpmFieldTransactionOrigin t where t.pk.transactionmodule = :module " + + "and t.pk.transactioncode = :transaction and t.pk.transactionversion = :version "; + + /** + * Metodo que entrega una lista de registros de la tabla TbpmFieldTransactionOrigin dado un codigo de transaccion. + * + * @param pEntityManager Referencia a la session de la base de datos. + * @param pGroupcode Codigo de grupo a obtener una lista de usuarios. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pModule, + Integer pTransaction, Integer pVersion) throws Exception { + Query qry = pEntityManager.createQuery(TbpmFieldTransactionOrigin.HQL_FIELDS); + qry.setParameter("module", pModule); + qry.setParameter("transaction", pTransaction); + qry.setParameter("version", pVersion); + return qry.getResultList(); + + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmFieldTransactionOriginKey.java.svn-base b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmFieldTransactionOriginKey.java.svn-base new file mode 100644 index 0000000..5a62143 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmFieldTransactionOriginKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TBPMFIELDTRANSACTIONORIGIN*/ +@Embeddable +public class TbpmFieldTransactionOriginKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="FIELDNAME", nullable=false,updatable=false) + +/** +* Numero de mensaje asociado al a instacioa del flujo. +*/ +private String fieldname; + +/**Contructor por defecto*/ +public TbpmFieldTransactionOriginKey(){} +/**Contructor de TbpmFieldTransactionOriginKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pFieldname Numero de mensaje asociado al a instacioa del flujo. +*/ +public TbpmFieldTransactionOriginKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,String pFieldname){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + fieldname=pFieldname; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de fieldname +@return valor de fieldname*/ +public String getFieldname(){ + return fieldname; +} +/**Fija el valor de fieldname +@param pFieldname nuevo Valor de fieldname*/ +public void setFieldname(String pFieldname){ + fieldname=pFieldname; +} + +/**Implementacin de la comparacin de TbpmFieldTransactionOriginKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TbpmFieldTransactionOriginKey))return false; + TbpmFieldTransactionOriginKey that = (TbpmFieldTransactionOriginKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getFieldname() == null || that.getFieldname() == null){ + return false; + } + if (! this.getFieldname().equals(that.getFieldname())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TbpmFieldTransactionOriginKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getFieldname() == null ? 0 : this.getFieldname().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmFlows.java.svn-base b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmFlows.java.svn-base new file mode 100644 index 0000000..a90bc22 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmFlows.java.svn-base @@ -0,0 +1,157 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMFLOWS*/ +@Entity(name="TbpmFlows") +@Table(name="TBPMFLOWS") +public class TbpmFlows extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TbpmFlows +*/ +@EmbeddedId +private TbpmFlowsKey pk; +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion del flujo +*/ +private String description; + +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistick locking del registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TbpmFlows(){ +} +/**Contructor de TbpmFlows +@param pPk Clave Primaria del entity +*/ +public TbpmFlows(TbpmFlowsKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TbpmFlows +*/ +public static TbpmFlows find(EntityManager pEntityManager,TbpmFlowsKey pKey) throws Exception{ + TbpmFlows obj = pEntityManager.find(TbpmFlows.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TbpmFlows +@return El objeto que referencia a la Clave primaria de TbpmFlows +*/ +public TbpmFlowsKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TbpmFlows +@param pPk El objeto que referencia a la nueva Clave primaria de TbpmFlows +*/ +public void setPk(TbpmFlowsKey pPk){ + pk=pPk; +} +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TbpmFlows))return false; + TbpmFlows that = (TbpmFlows) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TbpmFlows +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TbpmFlows +*/ +public Object createInstance(){ + TbpmFlows instance=new TbpmFlows(); + instance.setPk(new TbpmFlowsKey()); + return instance; +} +/**Clona la entidad TbpmFlows +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TbpmFlows p=(TbpmFlows)this.clone(); + p.setPk((TbpmFlowsKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmFlowsKey.java.svn-base b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmFlowsKey.java.svn-base new file mode 100644 index 0000000..d2a0a4e --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmFlowsKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TBPMFLOWS*/ +@Embeddable +public class TbpmFlowsKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="FLOWCODE", nullable=false,updatable=false) + +/** +* Codigo de flujo +*/ +private String flowcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TbpmFlowsKey(){} +/**Contructor de TbpmFlowsKey +@param pFlowcode Codigo de flujo +@param pCompanycode Codigo de compania +*/ +public TbpmFlowsKey(String pFlowcode,Integer pCompanycode){ + flowcode=pFlowcode; + companycode=pCompanycode; +} +/**Obtiene el valor de flowcode +@return valor de flowcode*/ +public String getFlowcode(){ + return flowcode; +} +/**Fija el valor de flowcode +@param pFlowcode nuevo Valor de flowcode*/ +public void setFlowcode(String pFlowcode){ + flowcode=pFlowcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacin de la comparacin de TbpmFlowsKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TbpmFlowsKey))return false; + TbpmFlowsKey that = (TbpmFlowsKey) o; + if (this.getFlowcode() == null || that.getFlowcode() == null){ + return false; + } + if (! this.getFlowcode().equals(that.getFlowcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TbpmFlowsKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getFlowcode() == null ? 0 : this.getFlowcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmGroups.java.svn-base b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmGroups.java.svn-base new file mode 100644 index 0000000..e1cffdb --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmGroups.java.svn-base @@ -0,0 +1,177 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMGROUPS*/ +@Entity(name="TbpmGroups") +@Table(name="TBPMGROUPS") +public class TbpmGroups extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TbpmGroups +*/ +@EmbeddedId +private TbpmGroupsKey pk; +@Column(name="DESCRIPTION", nullable=true) + +/** +* Detalle del grupo de usuario de bpm +*/ +private String description; + +@Column(name="EMAIL", nullable=true) + +/** +* Campo para el ingreso de email +*/ +private String email; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistick locking del registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TbpmGroups(){ +} +/**Contructor de TbpmGroups +@param pPk Clave Primaria del entity +*/ +public TbpmGroups(TbpmGroupsKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TbpmGroups +*/ +public static TbpmGroups find(EntityManager pEntityManager,TbpmGroupsKey pKey) throws Exception{ + TbpmGroups obj = pEntityManager.find(TbpmGroups.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TbpmGroups +@return El objeto que referencia a la Clave primaria de TbpmGroups +*/ +public TbpmGroupsKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TbpmGroups +@param pPk El objeto que referencia a la nueva Clave primaria de TbpmGroups +*/ +public void setPk(TbpmGroupsKey pPk){ + pk=pPk; +} +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de email +@return valor de email*/ +public String getEmail(){ + return email; +} +/**Fija el valor de email +@param pEmail nuevo Valor de email*/ +public void setEmail(String pEmail){ + email=pEmail; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TbpmGroups))return false; + TbpmGroups that = (TbpmGroups) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TbpmGroups +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TbpmGroups +*/ +public Object createInstance(){ + TbpmGroups instance=new TbpmGroups(); + instance.setPk(new TbpmGroupsKey()); + return instance; +} +/**Clona la entidad TbpmGroups +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TbpmGroups p=(TbpmGroups)this.clone(); + p.setPk((TbpmGroupsKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmGroupsKey.java.svn-base b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmGroupsKey.java.svn-base new file mode 100644 index 0000000..a6e7a52 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmGroupsKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TBPMGROUPS*/ +@Embeddable +public class TbpmGroupsKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="GROUPCODE", nullable=false,updatable=false) + +/** +* Codigo de grupo de usuarios de un bpm +*/ +private String groupcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TbpmGroupsKey(){} +/**Contructor de TbpmGroupsKey +@param pGroupcode Codigo de grupo de usuarios de un bpm +@param pCompanycode Codigo de compania +*/ +public TbpmGroupsKey(String pGroupcode,Integer pCompanycode){ + groupcode=pGroupcode; + companycode=pCompanycode; +} +/**Obtiene el valor de groupcode +@return valor de groupcode*/ +public String getGroupcode(){ + return groupcode; +} +/**Fija el valor de groupcode +@param pGroupcode nuevo Valor de groupcode*/ +public void setGroupcode(String pGroupcode){ + groupcode=pGroupcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacion de la comparacion de TbpmGroupsKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TbpmGroupsKey))return false; + TbpmGroupsKey that = (TbpmGroupsKey) o; + if (this.getGroupcode() == null || that.getGroupcode() == null){ + return false; + } + if (! this.getGroupcode().equals(that.getGroupcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TbpmGroupsKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getGroupcode() == null ? 0 : this.getGroupcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmGroupsUsers.java.svn-base b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmGroupsUsers.java.svn-base new file mode 100644 index 0000000..f9363de --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmGroupsUsers.java.svn-base @@ -0,0 +1,227 @@ +package com.fp.persistence.pbpm.gene; + +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMGROUPSUSERS + */ +@Entity(name = "TbpmGroupsUsers") +@Table(name = "TBPMGROUPSUSERS") +public class TbpmGroupsUsers extends com.fp.dto.AbstractDataTransport implements HibernateBean { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TbpmGroupsUsers + */ + @EmbeddedId + private TbpmGroupsUsersKey pk; + + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistick locking del registro + */ + private Integer recordversion; + + /** Contructor por defecto */ + public TbpmGroupsUsers() { + } + + /** + * Contructor de TbpmGroupsUsers + * + * @param pPk Clave Primaria del entity + */ + public TbpmGroupsUsers(TbpmGroupsUsersKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TbpmGroupsUsers + */ + public static TbpmGroupsUsers find(EntityManager pEntityManager, TbpmGroupsUsersKey pKey) throws Exception { + TbpmGroupsUsers obj = pEntityManager.find(TbpmGroupsUsers.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TbpmGroupsUsers + * + * @return El objeto que referencia a la Clave primaria de TbpmGroupsUsers + */ + public TbpmGroupsUsersKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TbpmGroupsUsers + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TbpmGroupsUsers + */ + public void setPk(TbpmGroupsUsersKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TbpmGroupsUsers)) { + return false; + } + TbpmGroupsUsers that = (TbpmGroupsUsers) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TbpmGroupsUsers + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementaci�n toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementaci�n de la creaci�n de un bean en blanco TbpmGroupsUsers */ + @Override + public Object createInstance() { + TbpmGroupsUsers instance = new TbpmGroupsUsers(); + instance.setPk(new TbpmGroupsUsersKey()); + return instance; + } + + /** + * Clona la entidad TbpmGroupsUsers + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TbpmGroupsUsers p = (TbpmGroupsUsers) this.clone(); + p.setPk((TbpmGroupsUsersKey) this.pk.cloneMe()); + return p; + } + + // Metodos manuales. + + /** Sentecia que entrega una lista de TbpmGroupsUsers dado un codigo de grupo. */ + private static final String HQL_USER = "from TbpmGroupsUsers t " + " where t.pk.groupcode = :groupcode order by t.pk.usercode "; + + /** Sentecia que entrega una lista de TbpmGroupsUsers dado un codigo de grupo. */ + private static final String HQL_GROUPS_BY_USER = "from TbpmGroupsUsers t " + " where t.pk.usercode = :user order by t.pk.usercode "; + + /** + * Metodo que entrega una lista de registros de la tabla TbpmGroupsUsers dado un codigo de grupo. + * + * @param pEntityManager Referencia a la session de la base de datos. + * @param pGroupcode Codigo de grupo a obtener una lista de usuarios. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pGroupcode) throws Exception { + List ldata = null; + Query qry = pEntityManager.createQuery(TbpmGroupsUsers.HQL_USER); + qry.setParameter("groupcode", pGroupcode); + ldata = qry.getResultList(); + return ldata; + } + + /** + * Metodo que entrega una lista de registros de la tabla TbpmGroupsUsers dado un codigo de grupo. + * + * @param pEntityManager Referencia a la session de la base de datos. + * @param pGroupcode Codigo de grupo a obtener una lista de usuarios. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findGroupsByUser(EntityManager pEntityManager, String pUser) throws Exception { + List ldata = null; + Query qry = pEntityManager.createQuery(TbpmGroupsUsers.HQL_GROUPS_BY_USER); + qry.setParameter("user", pUser); + ldata = qry.getResultList(); + return ldata; + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmGroupsUsersKey.java.svn-base b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmGroupsUsersKey.java.svn-base new file mode 100644 index 0000000..cda9b48 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmGroupsUsersKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TBPMGROUPSUSERS*/ +@Embeddable +public class TbpmGroupsUsersKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="GROUPCODE", nullable=false,updatable=false) + +/** +* Codigo de grupo de usuarios de un bpm +*/ +private String groupcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TbpmGroupsUsersKey(){} +/**Contructor de TbpmGroupsUsersKey +@param pUsercode Codigo de usuario +@param pGroupcode Codigo de grupo de usuarios de un bpm +@param pCompanycode Codigo de compania +*/ +public TbpmGroupsUsersKey(String pUsercode,String pGroupcode,Integer pCompanycode){ + usercode=pUsercode; + groupcode=pGroupcode; + companycode=pCompanycode; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de groupcode +@return valor de groupcode*/ +public String getGroupcode(){ + return groupcode; +} +/**Fija el valor de groupcode +@param pGroupcode nuevo Valor de groupcode*/ +public void setGroupcode(String pGroupcode){ + groupcode=pGroupcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacin de la comparacin de TbpmGroupsUsersKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TbpmGroupsUsersKey))return false; + TbpmGroupsUsersKey that = (TbpmGroupsUsersKey) o; + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getGroupcode() == null || that.getGroupcode() == null){ + return false; + } + if (! this.getGroupcode().equals(that.getGroupcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TbpmGroupsUsersKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getGroupcode() == null ? 0 : this.getGroupcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmLogMail.java.svn-base b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmLogMail.java.svn-base new file mode 100644 index 0000000..67bf305 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmLogMail.java.svn-base @@ -0,0 +1,241 @@ +package com.fp.persistence.pbpm.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMLOGMAIL*/ +@Entity(name="TbpmLogMail") +@Table(name="TBPMLOGMAIL") +public class TbpmLogMail extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TbpmLogMail +*/ +@Id +@Column(name="CLOGMAIL" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CLOGMAIL"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.Long"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "16")}) + @GeneratedValue(generator = "seq_id") +private Long pk; +@Column(name="ESTADO", nullable=true) + +/** +* Estado del envio del mail +*/ +private String estado; + +@Column(name="CORREO", nullable=true) + +/** +* Mail del destinatario +*/ +private String correo; + +@Column(name="FECHAREGISTRO", nullable=true) + +/** +* null +*/ +private Timestamp fecharegistro; + +@Column(name="ASUNTO", nullable=true) + +/** +* Asunto del correo que se esta enviando +*/ +private String asunto; + +@Column(name="CONTENIDO", nullable=true) + +/** +* Contenido del mensaje +*/ +private String contenido; + +@Column(name="DESCRIPCIONERROR", nullable=true) + +/** +* Descripcion del error, que se produjo al tratar de enviar el mail +*/ +private String descripcionerror; + +/**Contructor por defecto*/ +public TbpmLogMail(){ +} +/**Contructor de TbpmLogMail +@param pPk Clave Primaria del entity +*/ +public TbpmLogMail(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TbpmLogMail +*/ +public static TbpmLogMail find(EntityManager pEntityManager,Object pKey) throws Exception{ + TbpmLogMail obj = pEntityManager.find(TbpmLogMail.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TbpmLogMail +@return El objeto que referencia a la Clave primaria de TbpmLogMail +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TbpmLogMail +@param pPk El objeto que referencia a la nueva Clave primaria de TbpmLogMail +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de estado +@return valor de estado*/ +public String getEstado(){ + return estado; +} +/**Fija el valor de estado +@param pEstado nuevo Valor de estado*/ +public void setEstado(String pEstado){ + estado=pEstado; +} + +/**Obtiene el valor de correo +@return valor de correo*/ +public String getCorreo(){ + return correo; +} +/**Fija el valor de correo +@param pCorreo nuevo Valor de correo*/ +public void setCorreo(String pCorreo){ + correo=pCorreo; +} + +/**Obtiene el valor de fecharegistro +@return valor de fecharegistro*/ +public Timestamp getFecharegistro(){ + return fecharegistro; +} +/**Fija el valor de fecharegistro +@param pFecharegistro nuevo Valor de fecharegistro*/ +public void setFecharegistro(Timestamp pFecharegistro){ + fecharegistro=pFecharegistro; +} + +/**Obtiene el valor de asunto +@return valor de asunto*/ +public String getAsunto(){ + return asunto; +} +/**Fija el valor de asunto +@param pAsunto nuevo Valor de asunto*/ +public void setAsunto(String pAsunto){ + asunto=pAsunto; +} + +/**Obtiene el valor de contenido +@return valor de contenido*/ +public String getContenido(){ + return contenido; +} +/**Fija el valor de contenido +@param pContenido nuevo Valor de contenido*/ +public void setContenido(String pContenido){ + contenido=pContenido; +} + +/**Obtiene el valor de descripcionerror +@return valor de descripcionerror*/ +public String getDescripcionerror(){ + return descripcionerror; +} +/**Fija el valor de descripcionerror +@param pDescripcionerror nuevo Valor de descripcionerror*/ +public void setDescripcionerror(String pDescripcionerror){ + descripcionerror=pDescripcionerror; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TbpmLogMail))return false; + TbpmLogMail that = (TbpmLogMail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TbpmLogMail +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TbpmLogMail +*/ +public Object createInstance(){ + TbpmLogMail instance=new TbpmLogMail(); + return instance; +} +/**Clona la entidad TbpmLogMail +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TbpmLogMail p=(TbpmLogMail)this.clone(); + return p; +} +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmNotify.java.svn-base b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmNotify.java.svn-base new file mode 100644 index 0000000..c050890 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmNotify.java.svn-base @@ -0,0 +1,302 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; +import javax.persistence.GeneratedValue; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMNOTIFY*/ +@Entity(name="TbpmNotify") +@Table(name="TBPMNOTIFY") +public class TbpmNotify extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TbpmNotify +*/ +@Id +@Column(name="NOTIFYCODE" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "NOTIFYCODE"), @Parameter(name = "type", value = "java.lang.String"), + @Parameter(name = "fill", value = "0"), @Parameter(name = "length", value = "5") }) +@GeneratedValue(generator = "seq_id") +private String pk; +@Column(name="PROCESSCODE", nullable=false) + +/** +* Proceso en el que se encuentra el tramite para envio de notificacion +*/ +private String processcode; + +@Column(name="COMMENTS", nullable=false) + +/** +* El texto de la notificacin. +*/ +private String comments; + +@Column(name="NOTIFYTASK", nullable=false) + +/** +* null +*/ +private String notifytask; + +@Column(name="RESOLUTION", nullable=true) + +/** +* Nro de resolucion en caso de que se requiera +*/ +private String resolution; + +@Column(name="USERWHOREG", nullable=false) + +/** +* Usuario que registro la notificacion +*/ +private String userwhoreg; + +@Column(name="REGISTERDATE", nullable=false) + +/** +* Fecha de Registro +*/ +private Timestamp registerdate; + +@Column(name="NOTIFYTOCATALOG", nullable=true) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String notifytocatalog; + +@Column(name="NOTIFYTOCATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String notifytocatalogcode; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TbpmNotify(){ +} +/**Contructor de TbpmNotify +@param pPk Clave Primaria del entity +@param pProcesscode Proceso en el que se encuentra el tramite para envio de notificacion +@param pComments El texto de la notificacin. +@param pNotifytask null +@param pUserwhoreg Usuario que registro la notificacion +@param pRegisterdate Fecha de Registro +*/ +public TbpmNotify(String pPk,String pProcesscode,String pComments,String pNotifytask,String pUserwhoreg,Timestamp pRegisterdate){ + this(); + pk=pPk; + processcode=pProcesscode; + comments=pComments; + notifytask=pNotifytask; + userwhoreg=pUserwhoreg; + registerdate=pRegisterdate; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TbpmNotify +*/ +public static TbpmNotify find(EntityManager pEntityManager,Object pKey) throws Exception{ + TbpmNotify obj = pEntityManager.find(TbpmNotify.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TbpmNotify +@return El objeto que referencia a la Clave primaria de TbpmNotify +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TbpmNotify +@param pPk El objeto que referencia a la nueva Clave primaria de TbpmNotify +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de processcode +@return valor de processcode*/ +public String getProcesscode(){ + return processcode; +} +/**Fija el valor de processcode +@param pProcesscode nuevo Valor de processcode*/ +public void setProcesscode(String pProcesscode){ + processcode=pProcesscode; +} + +/**Obtiene el valor de comments +@return valor de comments*/ +public String getComments(){ + return comments; +} +/**Fija el valor de comments +@param pComments nuevo Valor de comments*/ +public void setComments(String pComments){ + comments=pComments; +} + +/**Obtiene el valor de notifytask +@return valor de notifytask*/ +public String getNotifytask(){ + return notifytask; +} +/**Fija el valor de notifytask +@param pNotifytask nuevo Valor de notifytask*/ +public void setNotifytask(String pNotifytask){ + notifytask=pNotifytask; +} + +/**Obtiene el valor de resolution +@return valor de resolution*/ +public String getResolution(){ + return resolution; +} +/**Fija el valor de resolution +@param pResolution nuevo Valor de resolution*/ +public void setResolution(String pResolution){ + resolution=pResolution; +} + +/**Obtiene el valor de userwhoreg +@return valor de userwhoreg*/ +public String getUserwhoreg(){ + return userwhoreg; +} +/**Fija el valor de userwhoreg +@param pUserwhoreg nuevo Valor de userwhoreg*/ +public void setUserwhoreg(String pUserwhoreg){ + userwhoreg=pUserwhoreg; +} + +/**Obtiene el valor de registerdate +@return valor de registerdate*/ +public Timestamp getRegisterdate(){ + return registerdate; +} +/**Fija el valor de registerdate +@param pRegisterdate nuevo Valor de registerdate*/ +public void setRegisterdate(Timestamp pRegisterdate){ + registerdate=pRegisterdate; +} + +/**Obtiene el valor de notifytocatalog +@return valor de notifytocatalog*/ +public String getNotifytocatalog(){ + return notifytocatalog; +} +/**Fija el valor de notifytocatalog +@param pNotifytocatalog nuevo Valor de notifytocatalog*/ +public void setNotifytocatalog(String pNotifytocatalog){ + notifytocatalog=pNotifytocatalog; +} + +/**Obtiene el valor de notifytocatalogcode +@return valor de notifytocatalogcode*/ +public String getNotifytocatalogcode(){ + return notifytocatalogcode; +} +/**Fija el valor de notifytocatalogcode +@param pNotifytocatalogcode nuevo Valor de notifytocatalogcode*/ +public void setNotifytocatalogcode(String pNotifytocatalogcode){ + notifytocatalogcode=pNotifytocatalogcode; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TbpmNotify))return false; + TbpmNotify that = (TbpmNotify) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TbpmNotify +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TbpmNotify +*/ +public Object createInstance(){ + TbpmNotify instance=new TbpmNotify(); + return instance; +} +/**Clona la entidad TbpmNotify +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TbpmNotify p=(TbpmNotify)this.clone(); + return p; +} +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmProcessInstance.java.svn-base b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmProcessInstance.java.svn-base new file mode 100644 index 0000000..c399d3f --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmProcessInstance.java.svn-base @@ -0,0 +1,313 @@ +package com.fp.persistence.pbpm.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMPROCESSINSTANCE */ +@Entity(name = "TbpmProcessInstance") +@Table(name = "TBPMPROCESSINSTANCE") +public class TbpmProcessInstance extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TbpmProcessInstance + */ + @Id + @Column(name = "JOURNALID", nullable = false, updatable = false) + private String pk; + + @Column(name = "SESSIONID", nullable = false) + /** + * Codigo de session en las tablas del jbpm asociadas al flujo + */ + private Integer sessionid; + + @Column(name = "PROCESSID", nullable = true) + /** + * Codigo de instancia de proceso asociado a un flujo + */ + private Long processid; + + @Column(name = "FINALIZED", nullable = true) + /** + * Y indica que el flujo esta filizado, N el flujo se esta en proceso + */ + private String finalized; + + @Column(name = "SNAPSHOT", nullable = true) + /** + * Referencia a la base de conocimiento empreada en la creacion del flujo + */ + private String snapshot; + + @Column(name = "CREATIONDATE", nullable = false) + /** + * Fecha de Creación + */ + private Date creationdate; + + @Column(name = "ENDDATE", nullable = true) + /** + * Fecha de Finalización + */ + private Date enddate; + + /** Contructor por defecto */ + public TbpmProcessInstance() { + } + + /** + * Contructor de TbpmProcessInstance + * + * @param pPk Clave Primaria del entity + * @param pSessionid Codigo de session en las tablas del jbpm asociadas al flujo + * @param pCreationdate Fecha de Creación + */ + public TbpmProcessInstance(String pPk, Integer pSessionid, Date pCreationdate) { + this(); + this.pk = pPk; + this.sessionid = pSessionid; + this.creationdate = pCreationdate; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TbpmProcessInstance + */ + public static TbpmProcessInstance find(EntityManager pEntityManager, Object pKey) throws Exception { + TbpmProcessInstance obj = pEntityManager.find(TbpmProcessInstance.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TbpmProcessInstance + * + * @return El objeto que referencia a la Clave primaria de TbpmProcessInstance + */ + public String getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TbpmProcessInstance + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TbpmProcessInstance + */ + public void setPk(String pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de sessionid + * + * @return valor de sessionid + */ + public Integer getSessionid() { + return this.sessionid; + } + + /** + * Fija el valor de sessionid + * + * @param pSessionid nuevo Valor de sessionid + */ + public void setSessionid(Integer pSessionid) { + this.sessionid = pSessionid; + } + + /** + * Obtiene el valor de processid + * + * @return valor de processid + */ + public Long getProcessid() { + return this.processid; + } + + /** + * Fija el valor de processid + * + * @param pProcessid nuevo Valor de processid + */ + public void setProcessid(Long pProcessid) { + this.processid = pProcessid; + } + + /** + * Obtiene el valor de finalized + * + * @return valor de finalized + */ + public String getFinalized() { + return this.finalized; + } + + /** + * Fija el valor de finalized + * + * @param pFinalized nuevo Valor de finalized + */ + public void setFinalized(String pFinalized) { + this.finalized = pFinalized; + } + + /** + * Obtiene el valor de snapshot + * + * @return valor de snapshot + */ + public String getSnapshot() { + return this.snapshot; + } + + /** + * Fija el valor de snapshot + * + * @param pSnapshot nuevo Valor de snapshot + */ + public void setSnapshot(String pSnapshot) { + this.snapshot = pSnapshot; + } + + /** + * Obtiene el valor de creationdate + * + * @return valor de creationdate + */ + public Date getCreationdate() { + return this.creationdate; + } + + /** + * Fija el valor de creationdate + * + * @param pCreationdate nuevo Valor de creationdate + */ + public void setCreationdate(Date pCreationdate) { + this.creationdate = pCreationdate; + } + + /** + * Obtiene el valor de enddate + * + * @return valor de enddate + */ + public Date getEnddate() { + return this.enddate; + } + + /** + * Fija el valor de enddate + * + * @param pEnddate nuevo Valor de enddate + */ + public void setEnddate(Date pEnddate) { + this.enddate = pEnddate; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TbpmProcessInstance)) { + return false; + } + TbpmProcessInstance that = (TbpmProcessInstance) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TbpmProcessInstance + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TbpmProcessInstance */ + @Override + public Object createInstance() { + TbpmProcessInstance instance = new TbpmProcessInstance(); + return instance; + } + + /** + * Clona la entidad TbpmProcessInstance + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TbpmProcessInstance p = (TbpmProcessInstance) this.clone(); + return p; + } + + public static TbpmProcessInstance findByProcessId(EntityManager pEntityManager, long pProcessId) throws Exception { + Query q = pEntityManager.createQuery("from TbpmProcessInstance p where p.processid=:pid"); + q.setParameter("pid", pProcessId); + return (TbpmProcessInstance) q.getSingleResult(); + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmProcessVariables.java.svn-base b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmProcessVariables.java.svn-base new file mode 100644 index 0000000..f12066c --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmProcessVariables.java.svn-base @@ -0,0 +1,186 @@ +package com.fp.persistence.pbpm.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Lob; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMPROCESSVARIABLES */ +@Entity(name = "TbpmProcessVariables") +@Table(name = "TBPMPROCESSVARIABLES") +public class TbpmProcessVariables extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TbpmProcessVariables + */ + @EmbeddedId + private TbpmProcessVariablesKey pk; + +// @Lob + @Column(name = "CONTENT", nullable = false) + /** + * Valor de la Variable en Formato JSON + */ + private String content; + + /** Contructor por defecto */ + public TbpmProcessVariables() { + } + + /** + * Contructor de TbpmProcessVariables + * + * @param pPk Clave Primaria del entity + * @param pContent Valor de la Variable en Formato JSON + */ + public TbpmProcessVariables(TbpmProcessVariablesKey pPk, String pContent) { + this(); + this.pk = pPk; + this.content = pContent; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TbpmProcessVariables + */ + public static TbpmProcessVariables find(EntityManager pEntityManager, TbpmProcessVariablesKey pKey) throws Exception { + TbpmProcessVariables obj = pEntityManager.find(TbpmProcessVariables.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TbpmProcessVariables + * + * @return El objeto que referencia a la Clave primaria de TbpmProcessVariables + */ + public TbpmProcessVariablesKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TbpmProcessVariables + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TbpmProcessVariables + */ + public void setPk(TbpmProcessVariablesKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de content + * + * @return valor de content + */ + public String getContent() { + return this.content; + } + + /** + * Fija el valor de content + * + * @param pContent nuevo Valor de content + */ + public void setContent(String pContent) { + this.content = pContent; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TbpmProcessVariables)) { + return false; + } + TbpmProcessVariables that = (TbpmProcessVariables) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TbpmProcessVariables + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TbpmProcessVariables */ + @Override + public Object createInstance() { + TbpmProcessVariables instance = new TbpmProcessVariables(); + instance.setPk(new TbpmProcessVariablesKey()); + return instance; + } + + /** + * Clona la entidad TbpmProcessVariables + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TbpmProcessVariables p = (TbpmProcessVariables) this.clone(); + p.setPk((TbpmProcessVariablesKey) this.pk.cloneMe()); + return p; + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmProcessVariablesKey.java.svn-base b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmProcessVariablesKey.java.svn-base new file mode 100644 index 0000000..0a4e6c0 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmProcessVariablesKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TBPMPROCESSVARIABLES*/ +@Embeddable +public class TbpmProcessVariablesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="JOURNALID", nullable=false,updatable=false) + +/** +* Numero de mensaje asociado al a instacioa del flujo. +*/ +private String journalid; + +@Column(name="NAME", nullable=false,updatable=false) + +/** +* Nombre de la Variable +*/ +private String name; + +/**Contructor por defecto*/ +public TbpmProcessVariablesKey(){} +/**Contructor de TbpmProcessVariablesKey +@param pJournalid Numero de mensaje asociado al a instacioa del flujo. +@param pName Nombre de la Variable +*/ +public TbpmProcessVariablesKey(String pJournalid,String pName){ + journalid=pJournalid; + name=pName; +} +/**Obtiene el valor de journalid +@return valor de journalid*/ +public String getJournalid(){ + return journalid; +} +/**Fija el valor de journalid +@param pJournalid nuevo Valor de journalid*/ +public void setJournalid(String pJournalid){ + journalid=pJournalid; +} + +/**Obtiene el valor de name +@return valor de name*/ +public String getName(){ + return name; +} +/**Fija el valor de name +@param pName nuevo Valor de name*/ +public void setName(String pName){ + name=pName; +} + +/**Implementacion de la comparacion de TbpmProcessVariablesKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TbpmProcessVariablesKey))return false; + TbpmProcessVariablesKey that = (TbpmProcessVariablesKey) o; + if (this.getJournalid() == null || that.getJournalid() == null){ + return false; + } + if (! this.getJournalid().equals(that.getJournalid())){ + return false; + } + if (this.getName() == null || that.getName() == null){ + return false; + } + if (! this.getName().equals(that.getName())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TbpmProcessVariablesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getJournalid() == null ? 0 : this.getJournalid().hashCode()); + result = result * 37 + (this.getName() == null ? 0 : this.getName().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmRules.java.svn-base b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmRules.java.svn-base new file mode 100644 index 0000000..9b48f78 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmRules.java.svn-base @@ -0,0 +1,473 @@ +package com.fp.persistence.pbpm.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.bpmlib.BPMException; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMRULES */ +@Entity(name = "TbpmRules") +@Table(name = "TBPMRULES") +public class TbpmRules extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TbpmRules + */ + @EmbeddedId + private TbpmRulesKey pk; + + @Column(name = "DESCRIPTION", nullable = true) + /** + * Detalle de lo que hace la regla de negocio + */ + private String description; + + @Column(name = "PACKAGENAME", nullable = true) + /** + * Paquete que contiene la regla de negocio + */ + private String packagename; + + @Column(name = "SNAPSHOT", nullable = true) + /** + * Imagen del paquete que contiene la regla de negocio + */ + private String snapshot; + + @Column(name = "ACTIVE", nullable = true) + /** + * Y Indica que la regla esta activa + */ + private String active; + + @Column(name = "REFRESH", nullable = true) + /** + * Y Indica que se asocia la regla a la base de conocimeintos antes de su ejecucion + */ + private String refresh; + + @Column(name = "PARAMETERTYPE", nullable = true) + /** + * Tipo de dato de parametro a validar ates de disparar la regla + */ + private String parametertype; + + @Column(name = "MESSAGECODE", nullable = true) + /** + * Codigo de plantilla de mensajes + */ + private Integer messagecode; + + @Column(name = "CONTENT", nullable = true) + /** + * null + */ + private byte[] content;; + + @Column(name = "PATH", nullable = true) + /** + * Ubicacion fisica de la regla o flujo + */ + private String path; + + @Column(name = "FILETYPE", nullable = true) + /** + * R Rule, F Flow + */ + private String filetype; + + /** Contructor por defecto */ + public TbpmRules() { + } + + /** + * Contructor de TbpmRules + * + * @param pPk Clave Primaria del entity + */ + public TbpmRules(TbpmRulesKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TbpmRules + */ + public static TbpmRules find(EntityManager pEntityManager, TbpmRulesKey pKey) throws Exception { + TbpmRules obj = pEntityManager.find(TbpmRules.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TbpmRules + * + * @return El objeto que referencia a la Clave primaria de TbpmRules + */ + public TbpmRulesKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TbpmRules + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TbpmRules + */ + public void setPk(TbpmRulesKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + /** + * Obtiene el valor de packagename + * + * @return valor de packagename + */ + public String getPackagename() { + return packagename; + } + + /** + * Fija el valor de packagename + * + * @param pPackagename nuevo Valor de packagename + */ + public void setPackagename(String pPackagename) { + packagename = pPackagename; + } + + /** + * Obtiene el valor de snapshot + * + * @return valor de snapshot + */ + public String getSnapshot() { + return snapshot; + } + + /** + * Fija el valor de snapshot + * + * @param pSnapshot nuevo Valor de snapshot + */ + public void setSnapshot(String pSnapshot) { + snapshot = pSnapshot; + } + + /** + * Obtiene el valor de active + * + * @return valor de active + */ + public String getActive() { + return active; + } + + /** + * Fija el valor de active + * + * @param pActive nuevo Valor de active + */ + public void setActive(String pActive) { + active = pActive; + } + + /** + * Obtiene el valor de refresh + * + * @return valor de refresh + */ + public String getRefresh() { + return refresh; + } + + /** + * Fija el valor de refresh + * + * @param pRefresh nuevo Valor de refresh + */ + public void setRefresh(String pRefresh) { + refresh = pRefresh; + } + + /** + * Obtiene el valor de parametertype + * + * @return valor de parametertype + */ + public String getParametertype() { + return parametertype; + } + + /** + * Fija el valor de parametertype + * + * @param pParametertype nuevo Valor de parametertype + */ + public void setParametertype(String pParametertype) { + parametertype = pParametertype; + } + + /** + * Obtiene el valor de messagecode + * + * @return valor de messagecode + */ + public Integer getMessagecode() { + return messagecode; + } + + /** + * Fija el valor de messagecode + * + * @param pMessagecode nuevo Valor de messagecode + */ + public void setMessagecode(Integer pMessagecode) { + messagecode = pMessagecode; + } + + /** + * Obtiene el valor de content + * + * @return valor de content + */ + public byte[] getContent() { + return content; + } + + /** + * Fija el valor de content + * + * @param pContent nuevo Valor de content + */ + public void setContent(byte[] pContent) { + content = pContent; + } + + /** + * Obtiene el valor de path + * + * @return valor de path + */ + public String getPath() { + return path; + } + + /** + * Fija el valor de path + * + * @param pPath nuevo Valor de path + */ + public void setPath(String pPath) { + path = pPath; + } + + /** + * Obtiene el valor de filetype + * + * @return valor de filetype + */ + public String getFiletype() { + return filetype; + } + + /** + * Fija el valor de filetype + * + * @param pFiletype nuevo Valor de filetype + */ + public void setFiletype(String pFiletype) { + filetype = pFiletype; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TbpmRules)) { + return false; + } + TbpmRules that = (TbpmRules) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TbpmRules + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TbpmRules */ + @Override + public Object createInstance() { + TbpmRules instance = new TbpmRules(); + instance.setPk(new TbpmRulesKey()); + return instance; + } + + /** + * Clona la entidad TbpmRules + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TbpmRules p = (TbpmRules) this.clone(); + p.setPk((TbpmRulesKey) this.pk.cloneMe()); + return p; + } + + // MANUALES + + /** Sentecia que entrega una lista de TbpmFieldTransactionOrigin dado un codigo de transaccion. */ + private static final String HQL_BY_SNAPSHOT = "from TbpmRules t where t.packagename = :pkg and t.snapshot = :snp and t.active = 'Y' "; + + /** + * Metodo que entrega una lista de registros de la tabla TbpmRules dado un paquete y snapshot. + * + * @param pEntityManager Referencia a la session de la base de datos. + * @param pPKG Nombre del Paquete. + * @param pSNP Nombre de la imagen. + * @return List + * @throws Exception + */ + public static TbpmRules find(EntityManager pEntityManager, String pPKG, String pSNP) throws Exception { + Query qry = pEntityManager.createQuery(TbpmRules.HQL_BY_SNAPSHOT); + qry.setParameter("pkg", pPKG); + qry.setParameter("snp", pSNP); + List l = qry.getResultList(); + // TbpmRules r = (TbpmRules) qry.getSingleResult(); + // if (r == null) { + if (l.isEmpty()) { + throw new BPMException("BPM-0003", "NO ESTA DISPONIBLE {0} {1}", pPKG, pSNP); + } + return l.get(0); + } + + /** + * Metodo que entrega una lista de registros de la tabla TbpmRules dado un paquete y snapshot. + * + * @param pEntityManager Referencia a la session de la base de datos. + * @param pPKG Nombre del Paquete. + * @param pSNP Nombre de la imagen. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findRules(EntityManager pEntityManager, String pPKG, String pSNP) throws Exception { + Query qry = pEntityManager.createQuery(TbpmRules.HQL_BY_SNAPSHOT); + qry.setParameter("pkg", pPKG); + qry.setParameter("snp", pSNP); + List l = qry.getResultList(); + // TbpmRules r = (TbpmRules) qry.getSingleResult(); + // if (r == null) { + if (l.isEmpty()) { + throw new BPMException("BPM-0003", "NO ESTA DISPONIBLE {0} {1}", pPKG, pSNP); + } + return l; + + } + + /** Sentecia que entrega una lista de TbpmFieldTransactionOrigin dado un codigo de transaccion. */ + private static final String HQL_TOTAL = "from TbpmRules t where t.active = 'Y' "; + + /** + * Metodo que entrega una lista de registros de la tabla TbpmRules dado un paquete y snapshot. + * + * @param pEntityManager Referencia a la session de la base de datos. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findRules(EntityManager pEntityManager) throws Exception { + Query qry = pEntityManager.createQuery(TbpmRules.HQL_TOTAL); + List l = qry.getResultList(); + if (l.isEmpty()) { + throw new BPMException("BPM-0003", "NO ESTA DISPONIBLE"); + } + return l; + } + +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmRulesKey.java.svn-base b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmRulesKey.java.svn-base new file mode 100644 index 0000000..0aa56ae --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmRulesKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TBPMRULES*/ +@Embeddable +public class TbpmRulesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="RULECODE", nullable=false,updatable=false) + +/** +* Codigo de regla de negocio +*/ +private String rulecode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TbpmRulesKey(){} +/**Contructor de TbpmRulesKey +@param pRulecode Codigo de regla de negocio +@param pCompanycode Codigo de compania +*/ +public TbpmRulesKey(String pRulecode,Integer pCompanycode){ + rulecode=pRulecode; + companycode=pCompanycode; +} +/**Obtiene el valor de rulecode +@return valor de rulecode*/ +public String getRulecode(){ + return rulecode; +} +/**Fija el valor de rulecode +@param pRulecode nuevo Valor de rulecode*/ +public void setRulecode(String pRulecode){ + rulecode=pRulecode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacion de la comparacion de TbpmRulesKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TbpmRulesKey))return false; + TbpmRulesKey that = (TbpmRulesKey) o; + if (this.getRulecode() == null || that.getRulecode() == null){ + return false; + } + if (! this.getRulecode().equals(that.getRulecode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TbpmRulesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getRulecode() == null ? 0 : this.getRulecode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmTaskComments.java.svn-base b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmTaskComments.java.svn-base new file mode 100644 index 0000000..dd3c993 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/.svn/text-base/TbpmTaskComments.java.svn-base @@ -0,0 +1,199 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMTASKCOMMENTS*/ +@Entity(name="TbpmTaskComments") +@Table(name="TBPMTASKCOMMENTS") +public class TbpmTaskComments extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TbpmTaskComments +*/ +@Id +@Column(name="ID" ,nullable=false, updatable=false) +private Long pk; +@Column(name="USERCODE", nullable=true) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="ADDED", nullable=false) + +/** +* Anadido +*/ +private Date added; + +@Column(name="TEXT", nullable=false) + +/** +* contenido +*/ +private String text; + +@Column(name="TASKID", nullable=false) + +/** +* tarea +*/ +private Long taskid; + +/**Contructor por defecto*/ +public TbpmTaskComments(){ +} +/**Contructor de TbpmTaskComments +@param pPk Clave Primaria del entity +@param pAdded Anadido +@param pText contenido +@param pTaskid tarea +*/ +public TbpmTaskComments(Long pPk,Date pAdded,String pText,Long pTaskid){ + this(); + pk=pPk; + added=pAdded; + text=pText; + taskid=pTaskid; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TbpmTaskComments +*/ +public static TbpmTaskComments find(EntityManager pEntityManager,Object pKey) throws Exception{ + TbpmTaskComments obj = pEntityManager.find(TbpmTaskComments.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TbpmTaskComments +@return El objeto que referencia a la Clave primaria de TbpmTaskComments +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TbpmTaskComments +@param pPk El objeto que referencia a la nueva Clave primaria de TbpmTaskComments +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de added +@return valor de added*/ +public Date getAdded(){ + return added; +} +/**Fija el valor de added +@param pAdded nuevo Valor de added*/ +public void setAdded(Date pAdded){ + added=pAdded; +} + +/**Obtiene el valor de text +@return valor de text*/ +public String getText(){ + return text; +} +/**Fija el valor de text +@param pText nuevo Valor de text*/ +public void setText(String pText){ + text=pText; +} + +/**Obtiene el valor de taskid +@return valor de taskid*/ +public Long getTaskid(){ + return taskid; +} +/**Fija el valor de taskid +@param pTaskid nuevo Valor de taskid*/ +public void setTaskid(Long pTaskid){ + taskid=pTaskid; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TbpmTaskComments))return false; + TbpmTaskComments that = (TbpmTaskComments) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TbpmTaskComments +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TbpmTaskComments +*/ +public Object createInstance(){ + TbpmTaskComments instance=new TbpmTaskComments(); + return instance; +} +/**Clona la entidad TbpmTaskComments +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TbpmTaskComments p=(TbpmTaskComments)this.clone(); + return p; +} +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmActivities.java b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmActivities.java new file mode 100644 index 0000000..f9c2c67 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmActivities.java @@ -0,0 +1,446 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMACTIVITIES*/ +@Entity(name="TbpmActivities") +@Table(name="TBPMACTIVITIES") +public class TbpmActivities extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TbpmActivities +*/ +@EmbeddedId +private TbpmActivitiesKey pk; +@Column(name="USERCODE", nullable=true) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="GROUPCODE", nullable=true) + +/** +* Codigo de grupo de usuarios de un bpm +*/ +private String groupcode; + +@Column(name="COMPANYCODE", nullable=true) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="ACTION", nullable=true) + +/** +* Tipo de Asignacion +*/ +private String action; + +@Column(name="ADITIONALDATA", nullable=true) + +/** +* Variables adicionales +*/ +private String aditionaldata; + +@Column(name="COMPLETED", nullable=true) + +/** +* Fecha de finalizacion +*/ +private Timestamp completed; + +@Column(name="CREATED", nullable=true) + +/** +* Fecha de creacion +*/ +private Timestamp created; + +@Column(name="EXPECTEDTIME", nullable=true) + +/** +* Tiempo estimado +*/ +private Long expectedtime; + +@Column(name="TASKJOURNALID", nullable=true) + +/** +* Identificador de la transaccion de la Tarea +*/ +private String taskjournalid; + +@Column(name="RESPONSE", nullable=true) + +/** +* Respuesta +*/ +private String response; + +@Column(name="RULECODE", nullable=true) + +/** +* Codigo de la Regla asociada +*/ +private String rulecode; + +@Column(name="RULECODEDEFAULT", nullable=true) + +/** +* Codigo de la Regla adicional +*/ +private String rulecodedefault; + +@Column(name="STARTED", nullable=true) + +/** +* Iniciada +*/ +private Timestamp started; + +@Column(name="TASKID", nullable=true) + +/** +* Identificador de la Tarea +*/ +private Long taskid; + +@Column(name="MODULE", nullable=true) + +/** +* Modulo +*/ +private String module; + +@Column(name="TRANSACTION", nullable=true) + +/** +* Transaccion +*/ +private Long transaction; + +@Column(name="VERSION", nullable=true) + +/** +* Version de la transacion +*/ +private Long version; + +@Column(name="INTERNALCODE", nullable=true) + +/** +* Codigo Auxiliar +*/ +private String internalcode; + +/**Contructor por defecto*/ +public TbpmActivities(){ +} +/**Contructor de TbpmActivities +@param pPk Clave Primaria del entity +*/ +public TbpmActivities(TbpmActivitiesKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TbpmActivities +*/ +public static TbpmActivities find(EntityManager pEntityManager,TbpmActivitiesKey pKey) throws Exception{ + TbpmActivities obj = pEntityManager.find(TbpmActivities.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TbpmActivities +@return El objeto que referencia a la Clave primaria de TbpmActivities +*/ +public TbpmActivitiesKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TbpmActivities +@param pPk El objeto que referencia a la nueva Clave primaria de TbpmActivities +*/ +public void setPk(TbpmActivitiesKey pPk){ + pk=pPk; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de groupcode +@return valor de groupcode*/ +public String getGroupcode(){ + return groupcode; +} +/**Fija el valor de groupcode +@param pGroupcode nuevo Valor de groupcode*/ +public void setGroupcode(String pGroupcode){ + groupcode=pGroupcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de action +@return valor de action*/ +public String getAction(){ + return action; +} +/**Fija el valor de action +@param pAction nuevo Valor de action*/ +public void setAction(String pAction){ + action=pAction; +} + +/**Obtiene el valor de aditionaldata +@return valor de aditionaldata*/ +public String getAditionaldata(){ + return aditionaldata; +} +/**Fija el valor de aditionaldata +@param pAditionaldata nuevo Valor de aditionaldata*/ +public void setAditionaldata(String pAditionaldata){ + aditionaldata=pAditionaldata; +} + +/**Obtiene el valor de completed +@return valor de completed*/ +public Timestamp getCompleted(){ + return completed; +} +/**Fija el valor de completed +@param pCompleted nuevo Valor de completed*/ +public void setCompleted(Timestamp pCompleted){ + completed=pCompleted; +} + +/**Obtiene el valor de created +@return valor de created*/ +public Timestamp getCreated(){ + return created; +} +/**Fija el valor de created +@param pCreated nuevo Valor de created*/ +public void setCreated(Timestamp pCreated){ + created=pCreated; +} + +/**Obtiene el valor de expectedtime +@return valor de expectedtime*/ +public Long getExpectedtime(){ + return expectedtime; +} +/**Fija el valor de expectedtime +@param pExpectedtime nuevo Valor de expectedtime*/ +public void setExpectedtime(Long pExpectedtime){ + expectedtime=pExpectedtime; +} + +/**Obtiene el valor de taskjournalid +@return valor de taskjournalid*/ +public String getTaskjournalid(){ + return taskjournalid; +} +/**Fija el valor de taskjournalid +@param pTaskjournalid nuevo Valor de taskjournalid*/ +public void setTaskjournalid(String pTaskjournalid){ + taskjournalid=pTaskjournalid; +} + +/**Obtiene el valor de response +@return valor de response*/ +public String getResponse(){ + return response; +} +/**Fija el valor de response +@param pResponse nuevo Valor de response*/ +public void setResponse(String pResponse){ + response=pResponse; +} + +/**Obtiene el valor de rulecode +@return valor de rulecode*/ +public String getRulecode(){ + return rulecode; +} +/**Fija el valor de rulecode +@param pRulecode nuevo Valor de rulecode*/ +public void setRulecode(String pRulecode){ + rulecode=pRulecode; +} + +/**Obtiene el valor de rulecodedefault +@return valor de rulecodedefault*/ +public String getRulecodedefault(){ + return rulecodedefault; +} +/**Fija el valor de rulecodedefault +@param pRulecodedefault nuevo Valor de rulecodedefault*/ +public void setRulecodedefault(String pRulecodedefault){ + rulecodedefault=pRulecodedefault; +} + +/**Obtiene el valor de started +@return valor de started*/ +public Timestamp getStarted(){ + return started; +} +/**Fija el valor de started +@param pStarted nuevo Valor de started*/ +public void setStarted(Timestamp pStarted){ + started=pStarted; +} + +/**Obtiene el valor de taskid +@return valor de taskid*/ +public Long getTaskid(){ + return taskid; +} +/**Fija el valor de taskid +@param pTaskid nuevo Valor de taskid*/ +public void setTaskid(Long pTaskid){ + taskid=pTaskid; +} + +/**Obtiene el valor de module +@return valor de module*/ +public String getModule(){ + return module; +} +/**Fija el valor de module +@param pModule nuevo Valor de module*/ +public void setModule(String pModule){ + module=pModule; +} + +/**Obtiene el valor de transaction +@return valor de transaction*/ +public Long getTransaction(){ + return transaction; +} +/**Fija el valor de transaction +@param pTransaction nuevo Valor de transaction*/ +public void setTransaction(Long pTransaction){ + transaction=pTransaction; +} + +/**Obtiene el valor de version +@return valor de version*/ +public Long getVersion(){ + return version; +} +/**Fija el valor de version +@param pVersion nuevo Valor de version*/ +public void setVersion(Long pVersion){ + version=pVersion; +} + +/**Obtiene el valor de internalcode +@return valor de internalcode*/ +public String getInternalcode(){ + return internalcode; +} +/**Fija el valor de internalcode +@param pInternalcode nuevo Valor de internalcode*/ +public void setInternalcode(String pInternalcode){ + internalcode=pInternalcode; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TbpmActivities))return false; + TbpmActivities that = (TbpmActivities) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TbpmActivities +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TbpmActivities +*/ +public Object createInstance(){ + TbpmActivities instance=new TbpmActivities(); + instance.setPk(new TbpmActivitiesKey()); + return instance; +} +/**Clona la entidad TbpmActivities +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TbpmActivities p=(TbpmActivities)this.clone(); + p.setPk((TbpmActivitiesKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmActivitiesKey.java b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmActivitiesKey.java new file mode 100644 index 0000000..49fbc19 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmActivitiesKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TBPMACTIVITIES*/ +@Embeddable +public class TbpmActivitiesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="JOURNALID", nullable=false,updatable=false) + +/** +* Numero de mensaje asociado al a instacioa del flujo. +*/ +private String journalid; + +@Column(name="ACTIVITYNAME", nullable=false,updatable=false) + +/** +* Nombre de la Actividad +*/ +private String activityname; + +@Column(name="SEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de Actividades +*/ +private Integer sequence; + +/**Contructor por defecto*/ +public TbpmActivitiesKey(){} +/**Contructor de TbpmActivitiesKey +@param pJournalid Numero de mensaje asociado al a instacioa del flujo. +@param pActivityname Nombre de la Actividad +@param pSequence Secuencia de Actividades +*/ +public TbpmActivitiesKey(String pJournalid,String pActivityname,Integer pSequence){ + journalid=pJournalid; + activityname=pActivityname; + sequence=pSequence; +} +/**Obtiene el valor de journalid +@return valor de journalid*/ +public String getJournalid(){ + return journalid; +} +/**Fija el valor de journalid +@param pJournalid nuevo Valor de journalid*/ +public void setJournalid(String pJournalid){ + journalid=pJournalid; +} + +/**Obtiene el valor de activityname +@return valor de activityname*/ +public String getActivityname(){ + return activityname; +} +/**Fija el valor de activityname +@param pActivityname nuevo Valor de activityname*/ +public void setActivityname(String pActivityname){ + activityname=pActivityname; +} + +/**Obtiene el valor de sequence +@return valor de sequence*/ +public Integer getSequence(){ + return sequence; +} +/**Fija el valor de sequence +@param pSequence nuevo Valor de sequence*/ +public void setSequence(Integer pSequence){ + sequence=pSequence; +} + +/**Implementacion de la comparacion de TbpmActivitiesKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TbpmActivitiesKey))return false; + TbpmActivitiesKey that = (TbpmActivitiesKey) o; + if (this.getJournalid() == null || that.getJournalid() == null){ + return false; + } + if (! this.getJournalid().equals(that.getJournalid())){ + return false; + } + if (this.getActivityname() == null || that.getActivityname() == null){ + return false; + } + if (! this.getActivityname().equals(that.getActivityname())){ + return false; + } + if (this.getSequence() == null || that.getSequence() == null){ + return false; + } + if (! this.getSequence().equals(that.getSequence())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TbpmActivitiesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getJournalid() == null ? 0 : this.getJournalid().hashCode()); + result = result * 37 + (this.getActivityname() == null ? 0 : this.getActivityname().hashCode()); + result = result * 37 + (this.getSequence() == null ? 0 : this.getSequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmField.java b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmField.java new file mode 100644 index 0000000..4270a36 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmField.java @@ -0,0 +1,160 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMFIELD*/ +@Entity(name="TbpmField") +@Table(name="TBPMFIELD") +public class TbpmField extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TbpmField +*/ +@Id +@Column(name="FIELDNAME" ,nullable=false, updatable=false) +private String pk; +@Version +@Column(name="RECORDVERSION", nullable=false) + +/** +* Codigo de session en las tablas del jbpm asociadas al flujo +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion de la utilizacion del campo. +*/ +private String description; + +/**Contructor por defecto*/ +public TbpmField(){ +} +/**Contructor de TbpmField +@param pPk Clave Primaria del entity +@param pRecordversion Codigo de session en las tablas del jbpm asociadas al flujo +*/ +public TbpmField(String pPk,Integer pRecordversion){ + this(); + pk=pPk; + recordversion=pRecordversion; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TbpmField +*/ +public static TbpmField find(EntityManager pEntityManager,Object pKey) throws Exception{ + TbpmField obj = pEntityManager.find(TbpmField.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TbpmField +@return El objeto que referencia a la Clave primaria de TbpmField +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TbpmField +@param pPk El objeto que referencia a la nueva Clave primaria de TbpmField +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TbpmField))return false; + TbpmField that = (TbpmField) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TbpmField +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TbpmField +*/ +public Object createInstance(){ + TbpmField instance=new TbpmField(); + return instance; +} +/**Clona la entidad TbpmField +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TbpmField p=(TbpmField)this.clone(); + return p; +} +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmFieldTransactionMaping.java b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmFieldTransactionMaping.java new file mode 100644 index 0000000..b2773f8 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmFieldTransactionMaping.java @@ -0,0 +1,211 @@ +package com.fp.persistence.pbpm.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMFIELDTRANSACTIONMAPING */ +@Entity(name = "TbpmFieldTransactionMaping") +@Table(name = "TBPMFIELDTRANSACTIONMAPING") +public class TbpmFieldTransactionMaping extends com.fp.dto.AbstractDataTransport implements Serializable, + HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TbpmFieldTransactionMaping + */ + @EmbeddedId + private TbpmFieldTransactionMapingKey pk; + + @Column(name = "FIELDSCREEN", nullable = true) + /** + * Nombre del campo para la pantalla + */ + private String fieldscreen; + + /** Contructor por defecto */ + public TbpmFieldTransactionMaping() { + } + + /** + * Contructor de TbpmFieldTransactionMaping + * + * @param pPk Clave Primaria del entity + */ + public TbpmFieldTransactionMaping(TbpmFieldTransactionMapingKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TbpmFieldTransactionMaping + */ + public static TbpmFieldTransactionMaping find(EntityManager pEntityManager, TbpmFieldTransactionMapingKey pKey) + throws Exception { + TbpmFieldTransactionMaping obj = pEntityManager.find(TbpmFieldTransactionMaping.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TbpmFieldTransactionMaping + * + * @return El objeto que referencia a la Clave primaria de TbpmFieldTransactionMaping + */ + public TbpmFieldTransactionMapingKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TbpmFieldTransactionMaping + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TbpmFieldTransactionMaping + */ + public void setPk(TbpmFieldTransactionMapingKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de fieldscreen + * + * @return valor de fieldscreen + */ + public String getFieldscreen() { + return this.fieldscreen; + } + + /** + * Fija el valor de fieldscreen + * + * @param pFieldscreen nuevo Valor de fieldscreen + */ + public void setFieldscreen(String pFieldscreen) { + this.fieldscreen = pFieldscreen; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TbpmFieldTransactionMaping)) { + return false; + } + TbpmFieldTransactionMaping that = (TbpmFieldTransactionMaping) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TbpmFieldTransactionMaping + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementaci�n toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementaci�n de la creaci�n de un bean en blanco TbpmFieldTransactionMaping */ + @Override + public Object createInstance() { + TbpmFieldTransactionMaping instance = new TbpmFieldTransactionMaping(); + instance.setPk(new TbpmFieldTransactionMapingKey()); + return instance; + } + + /** + * Clona la entidad TbpmFieldTransactionMaping + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TbpmFieldTransactionMaping p = (TbpmFieldTransactionMaping) this.clone(); + p.setPk((TbpmFieldTransactionMapingKey) this.pk.cloneMe()); + return p; + } + + // Metodos manuales. + + /** Sentecia que entrega una lista de TbpmFieldTransactionOrigin dado un codigo de transaccion. */ + private static final String HQL_FIELDS = "from TbpmFieldTransactionMaping t where t.pk.transactionmodule = :module " + + "and t.pk.transactioncode = :transaction and t.pk.transactionversion = :version "; + + /** + * Metodo que entrega una lista de registros de la tabla TbpmFieldTransactionOrigin dado un codigo de transaccion. + * + * @param pEntityManager Referencia a la session de la base de datos. + * @param pGroupcode Codigo de grupo a obtener una lista de usuarios. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pModule, + Integer pTransaction, Integer pVersion) throws Exception { + Query qry = pEntityManager.createQuery(TbpmFieldTransactionMaping.HQL_FIELDS); + qry.setParameter("module", pModule); + qry.setParameter("transaction", pTransaction); + qry.setParameter("version", pVersion); + return qry.getResultList(); + + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmFieldTransactionMapingKey.java b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmFieldTransactionMapingKey.java new file mode 100644 index 0000000..4a80a3d --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmFieldTransactionMapingKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TBPMFIELDTRANSACTIONMAPING*/ +@Embeddable +public class TbpmFieldTransactionMapingKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="FIELDNAME", nullable=false,updatable=false) + +/** +* Numero de mensaje asociado al a instacioa del flujo. +*/ +private String fieldname; + +/**Contructor por defecto*/ +public TbpmFieldTransactionMapingKey(){} +/**Contructor de TbpmFieldTransactionMapingKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pFieldname Numero de mensaje asociado al a instacioa del flujo. +*/ +public TbpmFieldTransactionMapingKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,String pFieldname){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + fieldname=pFieldname; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de fieldname +@return valor de fieldname*/ +public String getFieldname(){ + return fieldname; +} +/**Fija el valor de fieldname +@param pFieldname nuevo Valor de fieldname*/ +public void setFieldname(String pFieldname){ + fieldname=pFieldname; +} + +/**Implementacin de la comparacin de TbpmFieldTransactionMapingKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TbpmFieldTransactionMapingKey))return false; + TbpmFieldTransactionMapingKey that = (TbpmFieldTransactionMapingKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getFieldname() == null || that.getFieldname() == null){ + return false; + } + if (! this.getFieldname().equals(that.getFieldname())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TbpmFieldTransactionMapingKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getFieldname() == null ? 0 : this.getFieldname().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmFieldTransactionOrigin.java b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmFieldTransactionOrigin.java new file mode 100644 index 0000000..48d2e5e --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmFieldTransactionOrigin.java @@ -0,0 +1,211 @@ +package com.fp.persistence.pbpm.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMFIELDTRANSACTIONORIGIN */ +@Entity(name = "TbpmFieldTransactionOrigin") +@Table(name = "TBPMFIELDTRANSACTIONORIGIN") +public class TbpmFieldTransactionOrigin extends com.fp.dto.AbstractDataTransport implements Serializable, + HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TbpmFieldTransactionOrigin + */ + @EmbeddedId + private TbpmFieldTransactionOriginKey pk; + + @Column(name = "EXPRESIONLANGUAGE", nullable = true) + /** + * Expresion language que entrega el valor del campo + */ + private String expresionlanguage; + + /** Contructor por defecto */ + public TbpmFieldTransactionOrigin() { + } + + /** + * Contructor de TbpmFieldTransactionOrigin + * + * @param pPk Clave Primaria del entity + */ + public TbpmFieldTransactionOrigin(TbpmFieldTransactionOriginKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TbpmFieldTransactionOrigin + */ + public static TbpmFieldTransactionOrigin find(EntityManager pEntityManager, TbpmFieldTransactionOriginKey pKey) + throws Exception { + TbpmFieldTransactionOrigin obj = pEntityManager.find(TbpmFieldTransactionOrigin.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TbpmFieldTransactionOrigin + * + * @return El objeto que referencia a la Clave primaria de TbpmFieldTransactionOrigin + */ + public TbpmFieldTransactionOriginKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TbpmFieldTransactionOrigin + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TbpmFieldTransactionOrigin + */ + public void setPk(TbpmFieldTransactionOriginKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de expresionlanguage + * + * @return valor de expresionlanguage + */ + public String getExpresionlanguage() { + return this.expresionlanguage; + } + + /** + * Fija el valor de expresionlanguage + * + * @param pExpresionlanguage nuevo Valor de expresionlanguage + */ + public void setExpresionlanguage(String pExpresionlanguage) { + this.expresionlanguage = pExpresionlanguage; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TbpmFieldTransactionOrigin)) { + return false; + } + TbpmFieldTransactionOrigin that = (TbpmFieldTransactionOrigin) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TbpmFieldTransactionOrigin + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementaci�n toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementaci�n de la creaci�n de un bean en blanco TbpmFieldTransactionOrigin */ + @Override + public Object createInstance() { + TbpmFieldTransactionOrigin instance = new TbpmFieldTransactionOrigin(); + instance.setPk(new TbpmFieldTransactionOriginKey()); + return instance; + } + + /** + * Clona la entidad TbpmFieldTransactionOrigin + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TbpmFieldTransactionOrigin p = (TbpmFieldTransactionOrigin) this.clone(); + p.setPk((TbpmFieldTransactionOriginKey) this.pk.cloneMe()); + return p; + } + + // Metodos manuales. + + /** Sentecia que entrega una lista de TbpmFieldTransactionOrigin dado un codigo de transaccion. */ + private static final String HQL_FIELDS = "from TbpmFieldTransactionOrigin t where t.pk.transactionmodule = :module " + + "and t.pk.transactioncode = :transaction and t.pk.transactionversion = :version "; + + /** + * Metodo que entrega una lista de registros de la tabla TbpmFieldTransactionOrigin dado un codigo de transaccion. + * + * @param pEntityManager Referencia a la session de la base de datos. + * @param pGroupcode Codigo de grupo a obtener una lista de usuarios. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pModule, + Integer pTransaction, Integer pVersion) throws Exception { + Query qry = pEntityManager.createQuery(TbpmFieldTransactionOrigin.HQL_FIELDS); + qry.setParameter("module", pModule); + qry.setParameter("transaction", pTransaction); + qry.setParameter("version", pVersion); + return qry.getResultList(); + + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmFieldTransactionOriginKey.java b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmFieldTransactionOriginKey.java new file mode 100644 index 0000000..5a62143 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmFieldTransactionOriginKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TBPMFIELDTRANSACTIONORIGIN*/ +@Embeddable +public class TbpmFieldTransactionOriginKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="FIELDNAME", nullable=false,updatable=false) + +/** +* Numero de mensaje asociado al a instacioa del flujo. +*/ +private String fieldname; + +/**Contructor por defecto*/ +public TbpmFieldTransactionOriginKey(){} +/**Contructor de TbpmFieldTransactionOriginKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pFieldname Numero de mensaje asociado al a instacioa del flujo. +*/ +public TbpmFieldTransactionOriginKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,String pFieldname){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + fieldname=pFieldname; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de fieldname +@return valor de fieldname*/ +public String getFieldname(){ + return fieldname; +} +/**Fija el valor de fieldname +@param pFieldname nuevo Valor de fieldname*/ +public void setFieldname(String pFieldname){ + fieldname=pFieldname; +} + +/**Implementacin de la comparacin de TbpmFieldTransactionOriginKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TbpmFieldTransactionOriginKey))return false; + TbpmFieldTransactionOriginKey that = (TbpmFieldTransactionOriginKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getFieldname() == null || that.getFieldname() == null){ + return false; + } + if (! this.getFieldname().equals(that.getFieldname())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TbpmFieldTransactionOriginKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getFieldname() == null ? 0 : this.getFieldname().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmFlows.java b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmFlows.java new file mode 100644 index 0000000..a90bc22 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmFlows.java @@ -0,0 +1,157 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMFLOWS*/ +@Entity(name="TbpmFlows") +@Table(name="TBPMFLOWS") +public class TbpmFlows extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TbpmFlows +*/ +@EmbeddedId +private TbpmFlowsKey pk; +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion del flujo +*/ +private String description; + +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistick locking del registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TbpmFlows(){ +} +/**Contructor de TbpmFlows +@param pPk Clave Primaria del entity +*/ +public TbpmFlows(TbpmFlowsKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TbpmFlows +*/ +public static TbpmFlows find(EntityManager pEntityManager,TbpmFlowsKey pKey) throws Exception{ + TbpmFlows obj = pEntityManager.find(TbpmFlows.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TbpmFlows +@return El objeto que referencia a la Clave primaria de TbpmFlows +*/ +public TbpmFlowsKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TbpmFlows +@param pPk El objeto que referencia a la nueva Clave primaria de TbpmFlows +*/ +public void setPk(TbpmFlowsKey pPk){ + pk=pPk; +} +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TbpmFlows))return false; + TbpmFlows that = (TbpmFlows) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TbpmFlows +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TbpmFlows +*/ +public Object createInstance(){ + TbpmFlows instance=new TbpmFlows(); + instance.setPk(new TbpmFlowsKey()); + return instance; +} +/**Clona la entidad TbpmFlows +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TbpmFlows p=(TbpmFlows)this.clone(); + p.setPk((TbpmFlowsKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmFlowsKey.java b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmFlowsKey.java new file mode 100644 index 0000000..d2a0a4e --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmFlowsKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TBPMFLOWS*/ +@Embeddable +public class TbpmFlowsKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="FLOWCODE", nullable=false,updatable=false) + +/** +* Codigo de flujo +*/ +private String flowcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TbpmFlowsKey(){} +/**Contructor de TbpmFlowsKey +@param pFlowcode Codigo de flujo +@param pCompanycode Codigo de compania +*/ +public TbpmFlowsKey(String pFlowcode,Integer pCompanycode){ + flowcode=pFlowcode; + companycode=pCompanycode; +} +/**Obtiene el valor de flowcode +@return valor de flowcode*/ +public String getFlowcode(){ + return flowcode; +} +/**Fija el valor de flowcode +@param pFlowcode nuevo Valor de flowcode*/ +public void setFlowcode(String pFlowcode){ + flowcode=pFlowcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacin de la comparacin de TbpmFlowsKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TbpmFlowsKey))return false; + TbpmFlowsKey that = (TbpmFlowsKey) o; + if (this.getFlowcode() == null || that.getFlowcode() == null){ + return false; + } + if (! this.getFlowcode().equals(that.getFlowcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TbpmFlowsKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getFlowcode() == null ? 0 : this.getFlowcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmGroups.java b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmGroups.java new file mode 100644 index 0000000..e1cffdb --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmGroups.java @@ -0,0 +1,177 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMGROUPS*/ +@Entity(name="TbpmGroups") +@Table(name="TBPMGROUPS") +public class TbpmGroups extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TbpmGroups +*/ +@EmbeddedId +private TbpmGroupsKey pk; +@Column(name="DESCRIPTION", nullable=true) + +/** +* Detalle del grupo de usuario de bpm +*/ +private String description; + +@Column(name="EMAIL", nullable=true) + +/** +* Campo para el ingreso de email +*/ +private String email; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistick locking del registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TbpmGroups(){ +} +/**Contructor de TbpmGroups +@param pPk Clave Primaria del entity +*/ +public TbpmGroups(TbpmGroupsKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TbpmGroups +*/ +public static TbpmGroups find(EntityManager pEntityManager,TbpmGroupsKey pKey) throws Exception{ + TbpmGroups obj = pEntityManager.find(TbpmGroups.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TbpmGroups +@return El objeto que referencia a la Clave primaria de TbpmGroups +*/ +public TbpmGroupsKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TbpmGroups +@param pPk El objeto que referencia a la nueva Clave primaria de TbpmGroups +*/ +public void setPk(TbpmGroupsKey pPk){ + pk=pPk; +} +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de email +@return valor de email*/ +public String getEmail(){ + return email; +} +/**Fija el valor de email +@param pEmail nuevo Valor de email*/ +public void setEmail(String pEmail){ + email=pEmail; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TbpmGroups))return false; + TbpmGroups that = (TbpmGroups) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TbpmGroups +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TbpmGroups +*/ +public Object createInstance(){ + TbpmGroups instance=new TbpmGroups(); + instance.setPk(new TbpmGroupsKey()); + return instance; +} +/**Clona la entidad TbpmGroups +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TbpmGroups p=(TbpmGroups)this.clone(); + p.setPk((TbpmGroupsKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmGroupsKey.java b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmGroupsKey.java new file mode 100644 index 0000000..a6e7a52 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmGroupsKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TBPMGROUPS*/ +@Embeddable +public class TbpmGroupsKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="GROUPCODE", nullable=false,updatable=false) + +/** +* Codigo de grupo de usuarios de un bpm +*/ +private String groupcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TbpmGroupsKey(){} +/**Contructor de TbpmGroupsKey +@param pGroupcode Codigo de grupo de usuarios de un bpm +@param pCompanycode Codigo de compania +*/ +public TbpmGroupsKey(String pGroupcode,Integer pCompanycode){ + groupcode=pGroupcode; + companycode=pCompanycode; +} +/**Obtiene el valor de groupcode +@return valor de groupcode*/ +public String getGroupcode(){ + return groupcode; +} +/**Fija el valor de groupcode +@param pGroupcode nuevo Valor de groupcode*/ +public void setGroupcode(String pGroupcode){ + groupcode=pGroupcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacion de la comparacion de TbpmGroupsKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TbpmGroupsKey))return false; + TbpmGroupsKey that = (TbpmGroupsKey) o; + if (this.getGroupcode() == null || that.getGroupcode() == null){ + return false; + } + if (! this.getGroupcode().equals(that.getGroupcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TbpmGroupsKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getGroupcode() == null ? 0 : this.getGroupcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmGroupsUsers.java b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmGroupsUsers.java new file mode 100644 index 0000000..f9363de --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmGroupsUsers.java @@ -0,0 +1,227 @@ +package com.fp.persistence.pbpm.gene; + +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMGROUPSUSERS + */ +@Entity(name = "TbpmGroupsUsers") +@Table(name = "TBPMGROUPSUSERS") +public class TbpmGroupsUsers extends com.fp.dto.AbstractDataTransport implements HibernateBean { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TbpmGroupsUsers + */ + @EmbeddedId + private TbpmGroupsUsersKey pk; + + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistick locking del registro + */ + private Integer recordversion; + + /** Contructor por defecto */ + public TbpmGroupsUsers() { + } + + /** + * Contructor de TbpmGroupsUsers + * + * @param pPk Clave Primaria del entity + */ + public TbpmGroupsUsers(TbpmGroupsUsersKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TbpmGroupsUsers + */ + public static TbpmGroupsUsers find(EntityManager pEntityManager, TbpmGroupsUsersKey pKey) throws Exception { + TbpmGroupsUsers obj = pEntityManager.find(TbpmGroupsUsers.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TbpmGroupsUsers + * + * @return El objeto que referencia a la Clave primaria de TbpmGroupsUsers + */ + public TbpmGroupsUsersKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TbpmGroupsUsers + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TbpmGroupsUsers + */ + public void setPk(TbpmGroupsUsersKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TbpmGroupsUsers)) { + return false; + } + TbpmGroupsUsers that = (TbpmGroupsUsers) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TbpmGroupsUsers + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementaci�n toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementaci�n de la creaci�n de un bean en blanco TbpmGroupsUsers */ + @Override + public Object createInstance() { + TbpmGroupsUsers instance = new TbpmGroupsUsers(); + instance.setPk(new TbpmGroupsUsersKey()); + return instance; + } + + /** + * Clona la entidad TbpmGroupsUsers + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TbpmGroupsUsers p = (TbpmGroupsUsers) this.clone(); + p.setPk((TbpmGroupsUsersKey) this.pk.cloneMe()); + return p; + } + + // Metodos manuales. + + /** Sentecia que entrega una lista de TbpmGroupsUsers dado un codigo de grupo. */ + private static final String HQL_USER = "from TbpmGroupsUsers t " + " where t.pk.groupcode = :groupcode order by t.pk.usercode "; + + /** Sentecia que entrega una lista de TbpmGroupsUsers dado un codigo de grupo. */ + private static final String HQL_GROUPS_BY_USER = "from TbpmGroupsUsers t " + " where t.pk.usercode = :user order by t.pk.usercode "; + + /** + * Metodo que entrega una lista de registros de la tabla TbpmGroupsUsers dado un codigo de grupo. + * + * @param pEntityManager Referencia a la session de la base de datos. + * @param pGroupcode Codigo de grupo a obtener una lista de usuarios. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pGroupcode) throws Exception { + List ldata = null; + Query qry = pEntityManager.createQuery(TbpmGroupsUsers.HQL_USER); + qry.setParameter("groupcode", pGroupcode); + ldata = qry.getResultList(); + return ldata; + } + + /** + * Metodo que entrega una lista de registros de la tabla TbpmGroupsUsers dado un codigo de grupo. + * + * @param pEntityManager Referencia a la session de la base de datos. + * @param pGroupcode Codigo de grupo a obtener una lista de usuarios. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findGroupsByUser(EntityManager pEntityManager, String pUser) throws Exception { + List ldata = null; + Query qry = pEntityManager.createQuery(TbpmGroupsUsers.HQL_GROUPS_BY_USER); + qry.setParameter("user", pUser); + ldata = qry.getResultList(); + return ldata; + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmGroupsUsersKey.java b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmGroupsUsersKey.java new file mode 100644 index 0000000..cda9b48 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmGroupsUsersKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TBPMGROUPSUSERS*/ +@Embeddable +public class TbpmGroupsUsersKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="GROUPCODE", nullable=false,updatable=false) + +/** +* Codigo de grupo de usuarios de un bpm +*/ +private String groupcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TbpmGroupsUsersKey(){} +/**Contructor de TbpmGroupsUsersKey +@param pUsercode Codigo de usuario +@param pGroupcode Codigo de grupo de usuarios de un bpm +@param pCompanycode Codigo de compania +*/ +public TbpmGroupsUsersKey(String pUsercode,String pGroupcode,Integer pCompanycode){ + usercode=pUsercode; + groupcode=pGroupcode; + companycode=pCompanycode; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de groupcode +@return valor de groupcode*/ +public String getGroupcode(){ + return groupcode; +} +/**Fija el valor de groupcode +@param pGroupcode nuevo Valor de groupcode*/ +public void setGroupcode(String pGroupcode){ + groupcode=pGroupcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacin de la comparacin de TbpmGroupsUsersKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TbpmGroupsUsersKey))return false; + TbpmGroupsUsersKey that = (TbpmGroupsUsersKey) o; + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getGroupcode() == null || that.getGroupcode() == null){ + return false; + } + if (! this.getGroupcode().equals(that.getGroupcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TbpmGroupsUsersKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getGroupcode() == null ? 0 : this.getGroupcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmLogMail.java b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmLogMail.java new file mode 100644 index 0000000..67bf305 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmLogMail.java @@ -0,0 +1,241 @@ +package com.fp.persistence.pbpm.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMLOGMAIL*/ +@Entity(name="TbpmLogMail") +@Table(name="TBPMLOGMAIL") +public class TbpmLogMail extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TbpmLogMail +*/ +@Id +@Column(name="CLOGMAIL" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "CLOGMAIL"),//campo secuencial de la tabla + @Parameter(name = "type", value = "java.lang.Long"),// tipo de dato + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "16")}) + @GeneratedValue(generator = "seq_id") +private Long pk; +@Column(name="ESTADO", nullable=true) + +/** +* Estado del envio del mail +*/ +private String estado; + +@Column(name="CORREO", nullable=true) + +/** +* Mail del destinatario +*/ +private String correo; + +@Column(name="FECHAREGISTRO", nullable=true) + +/** +* null +*/ +private Timestamp fecharegistro; + +@Column(name="ASUNTO", nullable=true) + +/** +* Asunto del correo que se esta enviando +*/ +private String asunto; + +@Column(name="CONTENIDO", nullable=true) + +/** +* Contenido del mensaje +*/ +private String contenido; + +@Column(name="DESCRIPCIONERROR", nullable=true) + +/** +* Descripcion del error, que se produjo al tratar de enviar el mail +*/ +private String descripcionerror; + +/**Contructor por defecto*/ +public TbpmLogMail(){ +} +/**Contructor de TbpmLogMail +@param pPk Clave Primaria del entity +*/ +public TbpmLogMail(Long pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TbpmLogMail +*/ +public static TbpmLogMail find(EntityManager pEntityManager,Object pKey) throws Exception{ + TbpmLogMail obj = pEntityManager.find(TbpmLogMail.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TbpmLogMail +@return El objeto que referencia a la Clave primaria de TbpmLogMail +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TbpmLogMail +@param pPk El objeto que referencia a la nueva Clave primaria de TbpmLogMail +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de estado +@return valor de estado*/ +public String getEstado(){ + return estado; +} +/**Fija el valor de estado +@param pEstado nuevo Valor de estado*/ +public void setEstado(String pEstado){ + estado=pEstado; +} + +/**Obtiene el valor de correo +@return valor de correo*/ +public String getCorreo(){ + return correo; +} +/**Fija el valor de correo +@param pCorreo nuevo Valor de correo*/ +public void setCorreo(String pCorreo){ + correo=pCorreo; +} + +/**Obtiene el valor de fecharegistro +@return valor de fecharegistro*/ +public Timestamp getFecharegistro(){ + return fecharegistro; +} +/**Fija el valor de fecharegistro +@param pFecharegistro nuevo Valor de fecharegistro*/ +public void setFecharegistro(Timestamp pFecharegistro){ + fecharegistro=pFecharegistro; +} + +/**Obtiene el valor de asunto +@return valor de asunto*/ +public String getAsunto(){ + return asunto; +} +/**Fija el valor de asunto +@param pAsunto nuevo Valor de asunto*/ +public void setAsunto(String pAsunto){ + asunto=pAsunto; +} + +/**Obtiene el valor de contenido +@return valor de contenido*/ +public String getContenido(){ + return contenido; +} +/**Fija el valor de contenido +@param pContenido nuevo Valor de contenido*/ +public void setContenido(String pContenido){ + contenido=pContenido; +} + +/**Obtiene el valor de descripcionerror +@return valor de descripcionerror*/ +public String getDescripcionerror(){ + return descripcionerror; +} +/**Fija el valor de descripcionerror +@param pDescripcionerror nuevo Valor de descripcionerror*/ +public void setDescripcionerror(String pDescripcionerror){ + descripcionerror=pDescripcionerror; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TbpmLogMail))return false; + TbpmLogMail that = (TbpmLogMail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TbpmLogMail +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TbpmLogMail +*/ +public Object createInstance(){ + TbpmLogMail instance=new TbpmLogMail(); + return instance; +} +/**Clona la entidad TbpmLogMail +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TbpmLogMail p=(TbpmLogMail)this.clone(); + return p; +} +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmNotify.java b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmNotify.java new file mode 100644 index 0000000..c050890 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmNotify.java @@ -0,0 +1,302 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; +import javax.persistence.GeneratedValue; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMNOTIFY*/ +@Entity(name="TbpmNotify") +@Table(name="TBPMNOTIFY") +public class TbpmNotify extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TbpmNotify +*/ +@Id +@Column(name="NOTIFYCODE" ,nullable=false, updatable=false) +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "NOTIFYCODE"), @Parameter(name = "type", value = "java.lang.String"), + @Parameter(name = "fill", value = "0"), @Parameter(name = "length", value = "5") }) +@GeneratedValue(generator = "seq_id") +private String pk; +@Column(name="PROCESSCODE", nullable=false) + +/** +* Proceso en el que se encuentra el tramite para envio de notificacion +*/ +private String processcode; + +@Column(name="COMMENTS", nullable=false) + +/** +* El texto de la notificacin. +*/ +private String comments; + +@Column(name="NOTIFYTASK", nullable=false) + +/** +* null +*/ +private String notifytask; + +@Column(name="RESOLUTION", nullable=true) + +/** +* Nro de resolucion en caso de que se requiera +*/ +private String resolution; + +@Column(name="USERWHOREG", nullable=false) + +/** +* Usuario que registro la notificacion +*/ +private String userwhoreg; + +@Column(name="REGISTERDATE", nullable=false) + +/** +* Fecha de Registro +*/ +private Timestamp registerdate; + +@Column(name="NOTIFYTOCATALOG", nullable=true) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String notifytocatalog; + +@Column(name="NOTIFYTOCATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String notifytocatalogcode; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TbpmNotify(){ +} +/**Contructor de TbpmNotify +@param pPk Clave Primaria del entity +@param pProcesscode Proceso en el que se encuentra el tramite para envio de notificacion +@param pComments El texto de la notificacin. +@param pNotifytask null +@param pUserwhoreg Usuario que registro la notificacion +@param pRegisterdate Fecha de Registro +*/ +public TbpmNotify(String pPk,String pProcesscode,String pComments,String pNotifytask,String pUserwhoreg,Timestamp pRegisterdate){ + this(); + pk=pPk; + processcode=pProcesscode; + comments=pComments; + notifytask=pNotifytask; + userwhoreg=pUserwhoreg; + registerdate=pRegisterdate; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TbpmNotify +*/ +public static TbpmNotify find(EntityManager pEntityManager,Object pKey) throws Exception{ + TbpmNotify obj = pEntityManager.find(TbpmNotify.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TbpmNotify +@return El objeto que referencia a la Clave primaria de TbpmNotify +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TbpmNotify +@param pPk El objeto que referencia a la nueva Clave primaria de TbpmNotify +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de processcode +@return valor de processcode*/ +public String getProcesscode(){ + return processcode; +} +/**Fija el valor de processcode +@param pProcesscode nuevo Valor de processcode*/ +public void setProcesscode(String pProcesscode){ + processcode=pProcesscode; +} + +/**Obtiene el valor de comments +@return valor de comments*/ +public String getComments(){ + return comments; +} +/**Fija el valor de comments +@param pComments nuevo Valor de comments*/ +public void setComments(String pComments){ + comments=pComments; +} + +/**Obtiene el valor de notifytask +@return valor de notifytask*/ +public String getNotifytask(){ + return notifytask; +} +/**Fija el valor de notifytask +@param pNotifytask nuevo Valor de notifytask*/ +public void setNotifytask(String pNotifytask){ + notifytask=pNotifytask; +} + +/**Obtiene el valor de resolution +@return valor de resolution*/ +public String getResolution(){ + return resolution; +} +/**Fija el valor de resolution +@param pResolution nuevo Valor de resolution*/ +public void setResolution(String pResolution){ + resolution=pResolution; +} + +/**Obtiene el valor de userwhoreg +@return valor de userwhoreg*/ +public String getUserwhoreg(){ + return userwhoreg; +} +/**Fija el valor de userwhoreg +@param pUserwhoreg nuevo Valor de userwhoreg*/ +public void setUserwhoreg(String pUserwhoreg){ + userwhoreg=pUserwhoreg; +} + +/**Obtiene el valor de registerdate +@return valor de registerdate*/ +public Timestamp getRegisterdate(){ + return registerdate; +} +/**Fija el valor de registerdate +@param pRegisterdate nuevo Valor de registerdate*/ +public void setRegisterdate(Timestamp pRegisterdate){ + registerdate=pRegisterdate; +} + +/**Obtiene el valor de notifytocatalog +@return valor de notifytocatalog*/ +public String getNotifytocatalog(){ + return notifytocatalog; +} +/**Fija el valor de notifytocatalog +@param pNotifytocatalog nuevo Valor de notifytocatalog*/ +public void setNotifytocatalog(String pNotifytocatalog){ + notifytocatalog=pNotifytocatalog; +} + +/**Obtiene el valor de notifytocatalogcode +@return valor de notifytocatalogcode*/ +public String getNotifytocatalogcode(){ + return notifytocatalogcode; +} +/**Fija el valor de notifytocatalogcode +@param pNotifytocatalogcode nuevo Valor de notifytocatalogcode*/ +public void setNotifytocatalogcode(String pNotifytocatalogcode){ + notifytocatalogcode=pNotifytocatalogcode; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TbpmNotify))return false; + TbpmNotify that = (TbpmNotify) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TbpmNotify +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TbpmNotify +*/ +public Object createInstance(){ + TbpmNotify instance=new TbpmNotify(); + return instance; +} +/**Clona la entidad TbpmNotify +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TbpmNotify p=(TbpmNotify)this.clone(); + return p; +} +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmProcessInstance.java b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmProcessInstance.java new file mode 100644 index 0000000..c399d3f --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmProcessInstance.java @@ -0,0 +1,313 @@ +package com.fp.persistence.pbpm.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMPROCESSINSTANCE */ +@Entity(name = "TbpmProcessInstance") +@Table(name = "TBPMPROCESSINSTANCE") +public class TbpmProcessInstance extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TbpmProcessInstance + */ + @Id + @Column(name = "JOURNALID", nullable = false, updatable = false) + private String pk; + + @Column(name = "SESSIONID", nullable = false) + /** + * Codigo de session en las tablas del jbpm asociadas al flujo + */ + private Integer sessionid; + + @Column(name = "PROCESSID", nullable = true) + /** + * Codigo de instancia de proceso asociado a un flujo + */ + private Long processid; + + @Column(name = "FINALIZED", nullable = true) + /** + * Y indica que el flujo esta filizado, N el flujo se esta en proceso + */ + private String finalized; + + @Column(name = "SNAPSHOT", nullable = true) + /** + * Referencia a la base de conocimiento empreada en la creacion del flujo + */ + private String snapshot; + + @Column(name = "CREATIONDATE", nullable = false) + /** + * Fecha de Creación + */ + private Date creationdate; + + @Column(name = "ENDDATE", nullable = true) + /** + * Fecha de Finalización + */ + private Date enddate; + + /** Contructor por defecto */ + public TbpmProcessInstance() { + } + + /** + * Contructor de TbpmProcessInstance + * + * @param pPk Clave Primaria del entity + * @param pSessionid Codigo de session en las tablas del jbpm asociadas al flujo + * @param pCreationdate Fecha de Creación + */ + public TbpmProcessInstance(String pPk, Integer pSessionid, Date pCreationdate) { + this(); + this.pk = pPk; + this.sessionid = pSessionid; + this.creationdate = pCreationdate; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TbpmProcessInstance + */ + public static TbpmProcessInstance find(EntityManager pEntityManager, Object pKey) throws Exception { + TbpmProcessInstance obj = pEntityManager.find(TbpmProcessInstance.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TbpmProcessInstance + * + * @return El objeto que referencia a la Clave primaria de TbpmProcessInstance + */ + public String getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TbpmProcessInstance + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TbpmProcessInstance + */ + public void setPk(String pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de sessionid + * + * @return valor de sessionid + */ + public Integer getSessionid() { + return this.sessionid; + } + + /** + * Fija el valor de sessionid + * + * @param pSessionid nuevo Valor de sessionid + */ + public void setSessionid(Integer pSessionid) { + this.sessionid = pSessionid; + } + + /** + * Obtiene el valor de processid + * + * @return valor de processid + */ + public Long getProcessid() { + return this.processid; + } + + /** + * Fija el valor de processid + * + * @param pProcessid nuevo Valor de processid + */ + public void setProcessid(Long pProcessid) { + this.processid = pProcessid; + } + + /** + * Obtiene el valor de finalized + * + * @return valor de finalized + */ + public String getFinalized() { + return this.finalized; + } + + /** + * Fija el valor de finalized + * + * @param pFinalized nuevo Valor de finalized + */ + public void setFinalized(String pFinalized) { + this.finalized = pFinalized; + } + + /** + * Obtiene el valor de snapshot + * + * @return valor de snapshot + */ + public String getSnapshot() { + return this.snapshot; + } + + /** + * Fija el valor de snapshot + * + * @param pSnapshot nuevo Valor de snapshot + */ + public void setSnapshot(String pSnapshot) { + this.snapshot = pSnapshot; + } + + /** + * Obtiene el valor de creationdate + * + * @return valor de creationdate + */ + public Date getCreationdate() { + return this.creationdate; + } + + /** + * Fija el valor de creationdate + * + * @param pCreationdate nuevo Valor de creationdate + */ + public void setCreationdate(Date pCreationdate) { + this.creationdate = pCreationdate; + } + + /** + * Obtiene el valor de enddate + * + * @return valor de enddate + */ + public Date getEnddate() { + return this.enddate; + } + + /** + * Fija el valor de enddate + * + * @param pEnddate nuevo Valor de enddate + */ + public void setEnddate(Date pEnddate) { + this.enddate = pEnddate; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TbpmProcessInstance)) { + return false; + } + TbpmProcessInstance that = (TbpmProcessInstance) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TbpmProcessInstance + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TbpmProcessInstance */ + @Override + public Object createInstance() { + TbpmProcessInstance instance = new TbpmProcessInstance(); + return instance; + } + + /** + * Clona la entidad TbpmProcessInstance + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TbpmProcessInstance p = (TbpmProcessInstance) this.clone(); + return p; + } + + public static TbpmProcessInstance findByProcessId(EntityManager pEntityManager, long pProcessId) throws Exception { + Query q = pEntityManager.createQuery("from TbpmProcessInstance p where p.processid=:pid"); + q.setParameter("pid", pProcessId); + return (TbpmProcessInstance) q.getSingleResult(); + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmProcessVariables.java b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmProcessVariables.java new file mode 100644 index 0000000..f12066c --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmProcessVariables.java @@ -0,0 +1,186 @@ +package com.fp.persistence.pbpm.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Lob; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMPROCESSVARIABLES */ +@Entity(name = "TbpmProcessVariables") +@Table(name = "TBPMPROCESSVARIABLES") +public class TbpmProcessVariables extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TbpmProcessVariables + */ + @EmbeddedId + private TbpmProcessVariablesKey pk; + +// @Lob + @Column(name = "CONTENT", nullable = false) + /** + * Valor de la Variable en Formato JSON + */ + private String content; + + /** Contructor por defecto */ + public TbpmProcessVariables() { + } + + /** + * Contructor de TbpmProcessVariables + * + * @param pPk Clave Primaria del entity + * @param pContent Valor de la Variable en Formato JSON + */ + public TbpmProcessVariables(TbpmProcessVariablesKey pPk, String pContent) { + this(); + this.pk = pPk; + this.content = pContent; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TbpmProcessVariables + */ + public static TbpmProcessVariables find(EntityManager pEntityManager, TbpmProcessVariablesKey pKey) throws Exception { + TbpmProcessVariables obj = pEntityManager.find(TbpmProcessVariables.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TbpmProcessVariables + * + * @return El objeto que referencia a la Clave primaria de TbpmProcessVariables + */ + public TbpmProcessVariablesKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TbpmProcessVariables + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TbpmProcessVariables + */ + public void setPk(TbpmProcessVariablesKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de content + * + * @return valor de content + */ + public String getContent() { + return this.content; + } + + /** + * Fija el valor de content + * + * @param pContent nuevo Valor de content + */ + public void setContent(String pContent) { + this.content = pContent; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TbpmProcessVariables)) { + return false; + } + TbpmProcessVariables that = (TbpmProcessVariables) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TbpmProcessVariables + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TbpmProcessVariables */ + @Override + public Object createInstance() { + TbpmProcessVariables instance = new TbpmProcessVariables(); + instance.setPk(new TbpmProcessVariablesKey()); + return instance; + } + + /** + * Clona la entidad TbpmProcessVariables + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TbpmProcessVariables p = (TbpmProcessVariables) this.clone(); + p.setPk((TbpmProcessVariablesKey) this.pk.cloneMe()); + return p; + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmProcessVariablesKey.java b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmProcessVariablesKey.java new file mode 100644 index 0000000..0a4e6c0 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmProcessVariablesKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TBPMPROCESSVARIABLES*/ +@Embeddable +public class TbpmProcessVariablesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="JOURNALID", nullable=false,updatable=false) + +/** +* Numero de mensaje asociado al a instacioa del flujo. +*/ +private String journalid; + +@Column(name="NAME", nullable=false,updatable=false) + +/** +* Nombre de la Variable +*/ +private String name; + +/**Contructor por defecto*/ +public TbpmProcessVariablesKey(){} +/**Contructor de TbpmProcessVariablesKey +@param pJournalid Numero de mensaje asociado al a instacioa del flujo. +@param pName Nombre de la Variable +*/ +public TbpmProcessVariablesKey(String pJournalid,String pName){ + journalid=pJournalid; + name=pName; +} +/**Obtiene el valor de journalid +@return valor de journalid*/ +public String getJournalid(){ + return journalid; +} +/**Fija el valor de journalid +@param pJournalid nuevo Valor de journalid*/ +public void setJournalid(String pJournalid){ + journalid=pJournalid; +} + +/**Obtiene el valor de name +@return valor de name*/ +public String getName(){ + return name; +} +/**Fija el valor de name +@param pName nuevo Valor de name*/ +public void setName(String pName){ + name=pName; +} + +/**Implementacion de la comparacion de TbpmProcessVariablesKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TbpmProcessVariablesKey))return false; + TbpmProcessVariablesKey that = (TbpmProcessVariablesKey) o; + if (this.getJournalid() == null || that.getJournalid() == null){ + return false; + } + if (! this.getJournalid().equals(that.getJournalid())){ + return false; + } + if (this.getName() == null || that.getName() == null){ + return false; + } + if (! this.getName().equals(that.getName())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TbpmProcessVariablesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getJournalid() == null ? 0 : this.getJournalid().hashCode()); + result = result * 37 + (this.getName() == null ? 0 : this.getName().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmRules.java b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmRules.java new file mode 100644 index 0000000..9b48f78 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmRules.java @@ -0,0 +1,473 @@ +package com.fp.persistence.pbpm.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.bpmlib.BPMException; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMRULES */ +@Entity(name = "TbpmRules") +@Table(name = "TBPMRULES") +public class TbpmRules extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TbpmRules + */ + @EmbeddedId + private TbpmRulesKey pk; + + @Column(name = "DESCRIPTION", nullable = true) + /** + * Detalle de lo que hace la regla de negocio + */ + private String description; + + @Column(name = "PACKAGENAME", nullable = true) + /** + * Paquete que contiene la regla de negocio + */ + private String packagename; + + @Column(name = "SNAPSHOT", nullable = true) + /** + * Imagen del paquete que contiene la regla de negocio + */ + private String snapshot; + + @Column(name = "ACTIVE", nullable = true) + /** + * Y Indica que la regla esta activa + */ + private String active; + + @Column(name = "REFRESH", nullable = true) + /** + * Y Indica que se asocia la regla a la base de conocimeintos antes de su ejecucion + */ + private String refresh; + + @Column(name = "PARAMETERTYPE", nullable = true) + /** + * Tipo de dato de parametro a validar ates de disparar la regla + */ + private String parametertype; + + @Column(name = "MESSAGECODE", nullable = true) + /** + * Codigo de plantilla de mensajes + */ + private Integer messagecode; + + @Column(name = "CONTENT", nullable = true) + /** + * null + */ + private byte[] content;; + + @Column(name = "PATH", nullable = true) + /** + * Ubicacion fisica de la regla o flujo + */ + private String path; + + @Column(name = "FILETYPE", nullable = true) + /** + * R Rule, F Flow + */ + private String filetype; + + /** Contructor por defecto */ + public TbpmRules() { + } + + /** + * Contructor de TbpmRules + * + * @param pPk Clave Primaria del entity + */ + public TbpmRules(TbpmRulesKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TbpmRules + */ + public static TbpmRules find(EntityManager pEntityManager, TbpmRulesKey pKey) throws Exception { + TbpmRules obj = pEntityManager.find(TbpmRules.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TbpmRules + * + * @return El objeto que referencia a la Clave primaria de TbpmRules + */ + public TbpmRulesKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TbpmRules + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TbpmRules + */ + public void setPk(TbpmRulesKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + /** + * Obtiene el valor de packagename + * + * @return valor de packagename + */ + public String getPackagename() { + return packagename; + } + + /** + * Fija el valor de packagename + * + * @param pPackagename nuevo Valor de packagename + */ + public void setPackagename(String pPackagename) { + packagename = pPackagename; + } + + /** + * Obtiene el valor de snapshot + * + * @return valor de snapshot + */ + public String getSnapshot() { + return snapshot; + } + + /** + * Fija el valor de snapshot + * + * @param pSnapshot nuevo Valor de snapshot + */ + public void setSnapshot(String pSnapshot) { + snapshot = pSnapshot; + } + + /** + * Obtiene el valor de active + * + * @return valor de active + */ + public String getActive() { + return active; + } + + /** + * Fija el valor de active + * + * @param pActive nuevo Valor de active + */ + public void setActive(String pActive) { + active = pActive; + } + + /** + * Obtiene el valor de refresh + * + * @return valor de refresh + */ + public String getRefresh() { + return refresh; + } + + /** + * Fija el valor de refresh + * + * @param pRefresh nuevo Valor de refresh + */ + public void setRefresh(String pRefresh) { + refresh = pRefresh; + } + + /** + * Obtiene el valor de parametertype + * + * @return valor de parametertype + */ + public String getParametertype() { + return parametertype; + } + + /** + * Fija el valor de parametertype + * + * @param pParametertype nuevo Valor de parametertype + */ + public void setParametertype(String pParametertype) { + parametertype = pParametertype; + } + + /** + * Obtiene el valor de messagecode + * + * @return valor de messagecode + */ + public Integer getMessagecode() { + return messagecode; + } + + /** + * Fija el valor de messagecode + * + * @param pMessagecode nuevo Valor de messagecode + */ + public void setMessagecode(Integer pMessagecode) { + messagecode = pMessagecode; + } + + /** + * Obtiene el valor de content + * + * @return valor de content + */ + public byte[] getContent() { + return content; + } + + /** + * Fija el valor de content + * + * @param pContent nuevo Valor de content + */ + public void setContent(byte[] pContent) { + content = pContent; + } + + /** + * Obtiene el valor de path + * + * @return valor de path + */ + public String getPath() { + return path; + } + + /** + * Fija el valor de path + * + * @param pPath nuevo Valor de path + */ + public void setPath(String pPath) { + path = pPath; + } + + /** + * Obtiene el valor de filetype + * + * @return valor de filetype + */ + public String getFiletype() { + return filetype; + } + + /** + * Fija el valor de filetype + * + * @param pFiletype nuevo Valor de filetype + */ + public void setFiletype(String pFiletype) { + filetype = pFiletype; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TbpmRules)) { + return false; + } + TbpmRules that = (TbpmRules) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TbpmRules + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TbpmRules */ + @Override + public Object createInstance() { + TbpmRules instance = new TbpmRules(); + instance.setPk(new TbpmRulesKey()); + return instance; + } + + /** + * Clona la entidad TbpmRules + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TbpmRules p = (TbpmRules) this.clone(); + p.setPk((TbpmRulesKey) this.pk.cloneMe()); + return p; + } + + // MANUALES + + /** Sentecia que entrega una lista de TbpmFieldTransactionOrigin dado un codigo de transaccion. */ + private static final String HQL_BY_SNAPSHOT = "from TbpmRules t where t.packagename = :pkg and t.snapshot = :snp and t.active = 'Y' "; + + /** + * Metodo que entrega una lista de registros de la tabla TbpmRules dado un paquete y snapshot. + * + * @param pEntityManager Referencia a la session de la base de datos. + * @param pPKG Nombre del Paquete. + * @param pSNP Nombre de la imagen. + * @return List + * @throws Exception + */ + public static TbpmRules find(EntityManager pEntityManager, String pPKG, String pSNP) throws Exception { + Query qry = pEntityManager.createQuery(TbpmRules.HQL_BY_SNAPSHOT); + qry.setParameter("pkg", pPKG); + qry.setParameter("snp", pSNP); + List l = qry.getResultList(); + // TbpmRules r = (TbpmRules) qry.getSingleResult(); + // if (r == null) { + if (l.isEmpty()) { + throw new BPMException("BPM-0003", "NO ESTA DISPONIBLE {0} {1}", pPKG, pSNP); + } + return l.get(0); + } + + /** + * Metodo que entrega una lista de registros de la tabla TbpmRules dado un paquete y snapshot. + * + * @param pEntityManager Referencia a la session de la base de datos. + * @param pPKG Nombre del Paquete. + * @param pSNP Nombre de la imagen. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findRules(EntityManager pEntityManager, String pPKG, String pSNP) throws Exception { + Query qry = pEntityManager.createQuery(TbpmRules.HQL_BY_SNAPSHOT); + qry.setParameter("pkg", pPKG); + qry.setParameter("snp", pSNP); + List l = qry.getResultList(); + // TbpmRules r = (TbpmRules) qry.getSingleResult(); + // if (r == null) { + if (l.isEmpty()) { + throw new BPMException("BPM-0003", "NO ESTA DISPONIBLE {0} {1}", pPKG, pSNP); + } + return l; + + } + + /** Sentecia que entrega una lista de TbpmFieldTransactionOrigin dado un codigo de transaccion. */ + private static final String HQL_TOTAL = "from TbpmRules t where t.active = 'Y' "; + + /** + * Metodo que entrega una lista de registros de la tabla TbpmRules dado un paquete y snapshot. + * + * @param pEntityManager Referencia a la session de la base de datos. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findRules(EntityManager pEntityManager) throws Exception { + Query qry = pEntityManager.createQuery(TbpmRules.HQL_TOTAL); + List l = qry.getResultList(); + if (l.isEmpty()) { + throw new BPMException("BPM-0003", "NO ESTA DISPONIBLE"); + } + return l; + } + +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmRulesKey.java b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmRulesKey.java new file mode 100644 index 0000000..0aa56ae --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmRulesKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TBPMRULES*/ +@Embeddable +public class TbpmRulesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="RULECODE", nullable=false,updatable=false) + +/** +* Codigo de regla de negocio +*/ +private String rulecode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TbpmRulesKey(){} +/**Contructor de TbpmRulesKey +@param pRulecode Codigo de regla de negocio +@param pCompanycode Codigo de compania +*/ +public TbpmRulesKey(String pRulecode,Integer pCompanycode){ + rulecode=pRulecode; + companycode=pCompanycode; +} +/**Obtiene el valor de rulecode +@return valor de rulecode*/ +public String getRulecode(){ + return rulecode; +} +/**Fija el valor de rulecode +@param pRulecode nuevo Valor de rulecode*/ +public void setRulecode(String pRulecode){ + rulecode=pRulecode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacion de la comparacion de TbpmRulesKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TbpmRulesKey))return false; + TbpmRulesKey that = (TbpmRulesKey) o; + if (this.getRulecode() == null || that.getRulecode() == null){ + return false; + } + if (! this.getRulecode().equals(that.getRulecode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TbpmRulesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getRulecode() == null ? 0 : this.getRulecode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmTaskComments.java b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmTaskComments.java new file mode 100644 index 0000000..dd3c993 --- /dev/null +++ b/base/persistence/pbpm/src/main/java/com/fp/persistence/pbpm/gene/TbpmTaskComments.java @@ -0,0 +1,199 @@ +package com.fp.persistence.pbpm.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TBPMTASKCOMMENTS*/ +@Entity(name="TbpmTaskComments") +@Table(name="TBPMTASKCOMMENTS") +public class TbpmTaskComments extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TbpmTaskComments +*/ +@Id +@Column(name="ID" ,nullable=false, updatable=false) +private Long pk; +@Column(name="USERCODE", nullable=true) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="ADDED", nullable=false) + +/** +* Anadido +*/ +private Date added; + +@Column(name="TEXT", nullable=false) + +/** +* contenido +*/ +private String text; + +@Column(name="TASKID", nullable=false) + +/** +* tarea +*/ +private Long taskid; + +/**Contructor por defecto*/ +public TbpmTaskComments(){ +} +/**Contructor de TbpmTaskComments +@param pPk Clave Primaria del entity +@param pAdded Anadido +@param pText contenido +@param pTaskid tarea +*/ +public TbpmTaskComments(Long pPk,Date pAdded,String pText,Long pTaskid){ + this(); + pk=pPk; + added=pAdded; + text=pText; + taskid=pTaskid; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TbpmTaskComments +*/ +public static TbpmTaskComments find(EntityManager pEntityManager,Object pKey) throws Exception{ + TbpmTaskComments obj = pEntityManager.find(TbpmTaskComments.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TbpmTaskComments +@return El objeto que referencia a la Clave primaria de TbpmTaskComments +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TbpmTaskComments +@param pPk El objeto que referencia a la nueva Clave primaria de TbpmTaskComments +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de added +@return valor de added*/ +public Date getAdded(){ + return added; +} +/**Fija el valor de added +@param pAdded nuevo Valor de added*/ +public void setAdded(Date pAdded){ + added=pAdded; +} + +/**Obtiene el valor de text +@return valor de text*/ +public String getText(){ + return text; +} +/**Fija el valor de text +@param pText nuevo Valor de text*/ +public void setText(String pText){ + text=pText; +} + +/**Obtiene el valor de taskid +@return valor de taskid*/ +public Long getTaskid(){ + return taskid; +} +/**Fija el valor de taskid +@param pTaskid nuevo Valor de taskid*/ +public void setTaskid(Long pTaskid){ + taskid=pTaskid; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TbpmTaskComments))return false; + TbpmTaskComments that = (TbpmTaskComments) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TbpmTaskComments +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TbpmTaskComments +*/ +public Object createInstance(){ + TbpmTaskComments instance=new TbpmTaskComments(); + return instance; +} +/**Clona la entidad TbpmTaskComments +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TbpmTaskComments p=(TbpmTaskComments)this.clone(); + return p; +} +} diff --git a/base/persistence/pbpm/src/main/resources/.svn/entries b/base/persistence/pbpm/src/main/resources/.svn/entries new file mode 100644 index 0000000..a337835 --- /dev/null +++ b/base/persistence/pbpm/src/main/resources/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pbpm/src/main/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmActivities.class b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmActivities.class new file mode 100644 index 0000000..2a4d05b Binary files /dev/null and b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmActivities.class differ diff --git a/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmActivitiesKey.class b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmActivitiesKey.class new file mode 100644 index 0000000..6bca06b Binary files /dev/null and b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmActivitiesKey.class differ diff --git a/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmField.class b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmField.class new file mode 100644 index 0000000..24c328b Binary files /dev/null and b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmField.class differ diff --git a/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmFieldTransactionMaping.class b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmFieldTransactionMaping.class new file mode 100644 index 0000000..cdefc2b Binary files /dev/null and b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmFieldTransactionMaping.class differ diff --git a/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmFieldTransactionMapingKey.class b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmFieldTransactionMapingKey.class new file mode 100644 index 0000000..970b74c Binary files /dev/null and b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmFieldTransactionMapingKey.class differ diff --git a/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmFieldTransactionOrigin.class b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmFieldTransactionOrigin.class new file mode 100644 index 0000000..51fc80c Binary files /dev/null and b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmFieldTransactionOrigin.class differ diff --git a/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmFieldTransactionOriginKey.class b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmFieldTransactionOriginKey.class new file mode 100644 index 0000000..c77ecdd Binary files /dev/null and b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmFieldTransactionOriginKey.class differ diff --git a/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmFlows.class b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmFlows.class new file mode 100644 index 0000000..8a6bd09 Binary files /dev/null and b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmFlows.class differ diff --git a/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmFlowsKey.class b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmFlowsKey.class new file mode 100644 index 0000000..4dbff4c Binary files /dev/null and b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmFlowsKey.class differ diff --git a/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmGroups.class b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmGroups.class new file mode 100644 index 0000000..936daf1 Binary files /dev/null and b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmGroups.class differ diff --git a/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmGroupsKey.class b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmGroupsKey.class new file mode 100644 index 0000000..1deca73 Binary files /dev/null and b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmGroupsKey.class differ diff --git a/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmGroupsUsers.class b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmGroupsUsers.class new file mode 100644 index 0000000..9a96059 Binary files /dev/null and b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmGroupsUsers.class differ diff --git a/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmGroupsUsersKey.class b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmGroupsUsersKey.class new file mode 100644 index 0000000..a1f975d Binary files /dev/null and b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmGroupsUsersKey.class differ diff --git a/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmLogMail.class b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmLogMail.class new file mode 100644 index 0000000..c6aa028 Binary files /dev/null and b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmLogMail.class differ diff --git a/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmNotify.class b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmNotify.class new file mode 100644 index 0000000..8cb49f1 Binary files /dev/null and b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmNotify.class differ diff --git a/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmProcessInstance.class b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmProcessInstance.class new file mode 100644 index 0000000..59f8887 Binary files /dev/null and b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmProcessInstance.class differ diff --git a/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmProcessVariables.class b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmProcessVariables.class new file mode 100644 index 0000000..1d5cba8 Binary files /dev/null and b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmProcessVariables.class differ diff --git a/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmProcessVariablesKey.class b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmProcessVariablesKey.class new file mode 100644 index 0000000..ebca3cb Binary files /dev/null and b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmProcessVariablesKey.class differ diff --git a/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmRules.class b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmRules.class new file mode 100644 index 0000000..ec6fb2d Binary files /dev/null and b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmRules.class differ diff --git a/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmRulesKey.class b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmRulesKey.class new file mode 100644 index 0000000..4d70638 Binary files /dev/null and b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmRulesKey.class differ diff --git a/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmTaskComments.class b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmTaskComments.class new file mode 100644 index 0000000..ae67ecc Binary files /dev/null and b/base/persistence/pbpm/target/classes/com/fp/persistence/pbpm/gene/TbpmTaskComments.class differ diff --git a/base/persistence/pbpm/target/maven-archiver/pom.properties b/base/persistence/pbpm/target/maven-archiver/pom.properties new file mode 100644 index 0000000..b9bb411 --- /dev/null +++ b/base/persistence/pbpm/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:52:41 ECT 2022 +version=2.1 +groupId=com.fp.base.persistence +artifactId=pbpm diff --git a/base/persistence/pbpm/target/pbpm-2.1.jar b/base/persistence/pbpm/target/pbpm-2.1.jar new file mode 100644 index 0000000..b00bf0a Binary files /dev/null and b/base/persistence/pbpm/target/pbpm-2.1.jar differ diff --git a/base/persistence/pcustomer/.classpath b/base/persistence/pcustomer/.classpath new file mode 100644 index 0000000..161c246 --- /dev/null +++ b/base/persistence/pcustomer/.classpath @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/base/persistence/pcustomer/.pmd b/base/persistence/pcustomer/.pmd new file mode 100644 index 0000000..2f1733e --- /dev/null +++ b/base/persistence/pcustomer/.pmd @@ -0,0 +1,601 @@ + + + false + .ruleset + + + EmptyIfStmt + Basic Rules + + + EmptyWhileStmt + Basic Rules + + + EmptyTryBlock + Basic Rules + + + EmptyFinallyBlock + Basic Rules + + + EmptySwitchStatements + Basic Rules + + + JumbledIncrementer + Basic Rules + + + ForLoopShouldBeWhileLoop + Basic Rules + + + UnnecessaryConversionTemporary + Basic Rules + + + OverrideBothEqualsAndHashcode + Basic Rules + + + DoubleCheckedLocking + Basic Rules + + + ReturnFromFinallyBlock + Basic Rules + + + EmptySynchronizedBlock + Basic Rules + + + UnnecessaryReturn + Basic Rules + + + EmptyStaticInitializer + Basic Rules + + + UnconditionalIfStatement + Basic Rules + + + EmptyStatementNotInLoop + Basic Rules + + + BooleanInstantiation + Basic Rules + + + UnnecessaryFinalModifier + Basic Rules + + + CollapsibleIfStatements + Basic Rules + + + UselessOverridingMethod + Basic Rules + + + ClassCastExceptionWithToArray + Basic Rules + + + AvoidDecimalLiteralsInBigDecimalConstructor + Basic Rules + + + UselessOperationOnImmutable + Basic Rules + + + MisplacedNullCheck + Basic Rules + + + UnusedNullCheckInEquals + Basic Rules + + + AvoidThreadGroup + Basic Rules + + + BrokenNullCheck + Basic Rules + + + AvoidUsingOctalValues + Basic Rules + + + AvoidUsingHardCodedIP + Basic Rules + + + CheckResultSet + Basic Rules + + + AvoidMultipleUnaryOperators + Basic Rules + + + EmptyInitializer + Basic Rules + + + NPathComplexity + Code Size Rules + + + ExcessiveMethodLength + Code Size Rules + + + NcssMethodCount + Code Size Rules + + + NcssTypeCount + Code Size Rules + + + NcssConstructorCount + Code Size Rules + + + VariableNamingConventions + Naming Rules + + + MethodNamingConventions + Naming Rules + + + ClassNamingConventions + Naming Rules + + + AvoidDollarSigns + Naming Rules + + + MethodWithSameNameAsEnclosingClass + Naming Rules + + + SuspiciousHashcodeMethodName + Naming Rules + + + SuspiciousConstantFieldName + Naming Rules + + + SuspiciousEqualsMethodName + Naming Rules + + + AvoidFieldNameMatchingTypeName + Naming Rules + + + AvoidFieldNameMatchingMethodName + Naming Rules + + + NoPackage + Naming Rules + + + PackageCase + Naming Rules + + + MisleadingVariableName + Naming Rules + + + BooleanGetMethodName + Naming Rules + + + MoreThanOneLogger + Java Logging Rules + + + LoggerIsNotStaticFinal + Java Logging Rules + + + SystemPrintln + Java Logging Rules + + + AvoidPrintStackTrace + Java Logging Rules + + + IfStmtsMustUseBraces + Braces Rules + + + WhileLoopsMustUseBraces + Braces Rules + + + IfElseStmtsMustUseBraces + Braces Rules + + + ForLoopsMustUseBraces + Braces Rules + + + UseSingleton + Design Rules + + + SimplifyBooleanReturns + Design Rules + + + SimplifyBooleanExpressions + Design Rules + + + SwitchStmtsShouldHaveDefault + Design Rules + + + SwitchDensity + Design Rules + + + AccessorClassGeneration + Design Rules + + + FinalFieldCouldBeStatic + Design Rules + + + CloseResource + Design Rules + + + NonStaticInitializer + Design Rules + + + DefaultLabelNotLastInSwitchStmt + Design Rules + + + NonCaseLabelInSwitchStatement + Design Rules + + + OptimizableToArrayCall + Design Rules + + + BadComparison + Design Rules + + + EqualsNull + Design Rules + + + InstantiationToGetClass + Design Rules + + + IdempotentOperations + Design Rules + + + AvoidProtectedFieldInFinalClass + Design Rules + + + MissingStaticMethodInNonInstantiatableClass + Design Rules + + + MissingBreakInSwitch + Design Rules + + + UseNotifyAllInsteadOfNotify + Design Rules + + + AvoidInstanceofChecksInCatchClause + Design Rules + + + AbstractClassWithoutAbstractMethod + Design Rules + + + SimplifyConditional + Design Rules + + + CompareObjectsWithEquals + Design Rules + + + PositionLiteralsFirstInComparisons + Design Rules + + + UnnecessaryLocalBeforeReturn + Design Rules + + + NonThreadSafeSingleton + Design Rules + + + UncommentedEmptyMethod + Design Rules + + + AvoidConstantsInterface + Design Rules + + + UnsynchronizedStaticDateFormatter + Design Rules + + + PreserveStackTrace + Design Rules + + + UseCollectionIsEmpty + Design Rules + + + ClassWithOnlyPrivateConstructorsShouldBeFinal + Design Rules + + + EmptyMethodInAbstractClassShouldBeAbstract + Design Rules + + + SingularField + Design Rules + + + ReturnEmptyArrayRatherThanNull + Design Rules + + + AbstractClassWithoutAnyMethod + Design Rules + + + TooFewBranchesForASwitchStatement + Design Rules + + + ReplaceVectorWithList + Migration Rules + + + ReplaceHashtableWithMap + Migration Rules + + + ReplaceEnumerationWithIterator + Migration Rules + + + AvoidEnumAsIdentifier + Migration Rules + + + AvoidAssertAsIdentifier + Migration Rules + + + IntegerInstantiation + Migration Rules + + + ByteInstantiation + Migration Rules + + + ShortInstantiation + Migration Rules + + + LongInstantiation + Migration Rules + + + JUnit4TestShouldUseBeforeAnnotation + Migration Rules + + + JUnit4TestShouldUseAfterAnnotation + Migration Rules + + + JUnit4TestShouldUseTestAnnotation + Migration Rules + + + JUnit4SuitesShouldUseSuiteAnnotation + Migration Rules + + + JUnitUseExpected + Migration Rules + + + AvoidDuplicateLiterals + String and StringBuffer Rules + + + StringToString + String and StringBuffer Rules + + + InefficientStringBuffering + String and StringBuffer Rules + + + UnnecessaryCaseChange + String and StringBuffer Rules + + + UseStringBufferLength + String and StringBuffer Rules + + + AppendCharacterWithChar + String and StringBuffer Rules + + + ConsecutiveLiteralAppends + String and StringBuffer Rules + + + UseIndexOfChar + String and StringBuffer Rules + + + InefficientEmptyStringCheck + String and StringBuffer Rules + + + InsufficientStringBufferDeclaration + String and StringBuffer Rules + + + UselessStringValueOf + String and StringBuffer Rules + + + StringBufferInstantiationWithChar + String and StringBuffer Rules + + + UseEqualsToCompareStrings + String and StringBuffer Rules + + + AvoidStringBufferField + String and StringBuffer Rules + + + LooseCoupling + Type Resolution Rules + + + CloneMethodMustImplementCloneable + Type Resolution Rules + + + UnusedImports + Type Resolution Rules + + + UnnecessaryConstructor + Controversial Rules + + + UnusedModifier + Controversial Rules + + + AssignmentInOperand + Controversial Rules + + + AtLeastOneConstructor + Controversial Rules + + + DontImportSun + Controversial Rules + + + SuspiciousOctalEscape + Controversial Rules + + + DefaultPackage + Controversial Rules + + + BooleanInversion + Controversial Rules + + + AvoidFinalLocalVariable + Controversial Rules + + + AvoidUsingShortType + Controversial Rules + + + AvoidUsingVolatile + Controversial Rules + + + AvoidUsingNativeCode + Controversial Rules + + + AvoidAccessibilityAlteration + Controversial Rules + + + DoNotCallGarbageCollectionExplicitly + Controversial Rules + + + UnusedPrivateField + Unused Code Rules + + + UnusedLocalVariable + Unused Code Rules + + + UnusedPrivateMethod + Unused Code Rules + + + UnusedFormalParameter + Unused Code Rules + + + AvoidDeeplyNestedIfStmts + Design Rules + + + CyclomaticComplexity + Code Size Rules + + + false + true + diff --git a/base/persistence/pcustomer/.project b/base/persistence/pcustomer/.project new file mode 100644 index 0000000..cd8c738 --- /dev/null +++ b/base/persistence/pcustomer/.project @@ -0,0 +1,48 @@ + + + pcustomer + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + org.hibernate.eclipse.console.hibernateBuilder + + + + + org.eclipse.babel.editor.rbeBuilder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.hibernate.eclipse.console.hibernateNature + com.jaspersoft.studio.babel.editor.rbeNature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/base/persistence/pcustomer/.settings/.svn/entries b/base/persistence/pcustomer/.settings/.svn/entries new file mode 100644 index 0000000..661c7a8 --- /dev/null +++ b/base/persistence/pcustomer/.settings/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pcustomer/.settings +svn://172.17.26.185/COMACO + + + +2014-11-07T03:37:48.674062Z +2448 +ogarcia + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +org.eclipse.jdt.core.prefs +file + + + + +2022-07-28T03:40:25.600729Z +9c5661676ceb67312e95b170dcde2dda +2014-11-07T03:37:48.674062Z +2448 +ogarcia + + + + + + + + + + + + + + + + + + + + + +430 + +org.eclipse.m2e.core.prefs +file + + + + +2022-07-28T03:40:25.600729Z +66985cccd6a27c2401be11bc75d9ea23 +2014-11-07T03:37:48.674062Z +2448 +ogarcia + + + + + + + + + + + + + + + + + + + + + +90 + +org.eclipse.core.resources.prefs +file + + + + +2022-07-28T03:40:25.601729Z +470db6cc4f0d4d2f382befebd0b0b90c +2014-11-07T03:37:48.674062Z +2448 +ogarcia + + + + + + + + + + + + + + + + + + + + + +139 + +org.eclipse.wst.common.project.facet.core.xml +file + + + + +2022-07-28T03:40:25.601729Z +15f8d7ec0431c0a6fbea4f6ca024795b +2014-11-07T03:37:48.674062Z +2448 +ogarcia + + + + + + + + + + + + + + + + + + + + + +172 + +org.hibernate.eclipse.console.prefs +file + + + + +2022-07-28T03:40:25.601729Z +111170a7f7a4052d29b315f3504ffc72 +2014-11-07T03:37:48.674062Z +2448 +ogarcia + + + + + + + + + + + + + + + + + + + + + +80 + +org.eclipse.wst.common.component +file + + + + +2022-07-28T03:40:25.601729Z +59b1cf8529d45323f5e61b197e44e337 +2014-11-07T03:37:48.674062Z +2448 +ogarcia + + + + + + + + + + + + + + + + + + + + + +321 + diff --git a/base/persistence/pcustomer/.settings/.svn/text-base/org.eclipse.core.resources.prefs.svn-base b/base/persistence/pcustomer/.settings/.svn/text-base/org.eclipse.core.resources.prefs.svn-base new file mode 100644 index 0000000..89e6199 --- /dev/null +++ b/base/persistence/pcustomer/.settings/.svn/text-base/org.eclipse.core.resources.prefs.svn-base @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +encoding//src/main/java=ISO-8859-1 +encoding//src/main/resources=ISO-8859-1 +encoding/=ISO-8859-1 diff --git a/base/persistence/pcustomer/.settings/.svn/text-base/org.eclipse.jdt.core.prefs.svn-base b/base/persistence/pcustomer/.settings/.svn/text-base/org.eclipse.jdt.core.prefs.svn-base new file mode 100644 index 0000000..c788ee3 --- /dev/null +++ b/base/persistence/pcustomer/.settings/.svn/text-base/org.eclipse.jdt.core.prefs.svn-base @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/base/persistence/pcustomer/.settings/.svn/text-base/org.eclipse.m2e.core.prefs.svn-base b/base/persistence/pcustomer/.settings/.svn/text-base/org.eclipse.m2e.core.prefs.svn-base new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/base/persistence/pcustomer/.settings/.svn/text-base/org.eclipse.m2e.core.prefs.svn-base @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/base/persistence/pcustomer/.settings/.svn/text-base/org.eclipse.wst.common.component.svn-base b/base/persistence/pcustomer/.settings/.svn/text-base/org.eclipse.wst.common.component.svn-base new file mode 100644 index 0000000..f275d48 --- /dev/null +++ b/base/persistence/pcustomer/.settings/.svn/text-base/org.eclipse.wst.common.component.svn-base @@ -0,0 +1,6 @@ + + + + + + diff --git a/base/persistence/pcustomer/.settings/.svn/text-base/org.eclipse.wst.common.project.facet.core.xml.svn-base b/base/persistence/pcustomer/.settings/.svn/text-base/org.eclipse.wst.common.project.facet.core.xml.svn-base new file mode 100644 index 0000000..d788c0d --- /dev/null +++ b/base/persistence/pcustomer/.settings/.svn/text-base/org.eclipse.wst.common.project.facet.core.xml.svn-base @@ -0,0 +1,5 @@ + + + + + diff --git a/base/persistence/pcustomer/.settings/.svn/text-base/org.hibernate.eclipse.console.prefs.svn-base b/base/persistence/pcustomer/.settings/.svn/text-base/org.hibernate.eclipse.console.prefs.svn-base new file mode 100644 index 0000000..d9275ad --- /dev/null +++ b/base/persistence/pcustomer/.settings/.svn/text-base/org.hibernate.eclipse.console.prefs.svn-base @@ -0,0 +1,3 @@ +default.configuration= +eclipse.preferences.version=1 +hibernate3.enabled=true diff --git a/base/persistence/pcustomer/.settings/org.eclipse.core.resources.prefs b/base/persistence/pcustomer/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..89e6199 --- /dev/null +++ b/base/persistence/pcustomer/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +encoding//src/main/java=ISO-8859-1 +encoding//src/main/resources=ISO-8859-1 +encoding/=ISO-8859-1 diff --git a/base/persistence/pcustomer/.settings/org.eclipse.jdt.core.prefs b/base/persistence/pcustomer/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..c788ee3 --- /dev/null +++ b/base/persistence/pcustomer/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/base/persistence/pcustomer/.settings/org.eclipse.m2e.core.prefs b/base/persistence/pcustomer/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/base/persistence/pcustomer/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/base/persistence/pcustomer/.settings/org.eclipse.wst.common.component b/base/persistence/pcustomer/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..f275d48 --- /dev/null +++ b/base/persistence/pcustomer/.settings/org.eclipse.wst.common.component @@ -0,0 +1,6 @@ + + + + + + diff --git a/base/persistence/pcustomer/.settings/org.eclipse.wst.common.project.facet.core.xml b/base/persistence/pcustomer/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..d788c0d --- /dev/null +++ b/base/persistence/pcustomer/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/base/persistence/pcustomer/.settings/org.hibernate.eclipse.console.prefs b/base/persistence/pcustomer/.settings/org.hibernate.eclipse.console.prefs new file mode 100644 index 0000000..d9275ad --- /dev/null +++ b/base/persistence/pcustomer/.settings/org.hibernate.eclipse.console.prefs @@ -0,0 +1,3 @@ +default.configuration= +eclipse.preferences.version=1 +hibernate3.enabled=true diff --git a/base/persistence/pcustomer/.svn/dir-prop-base b/base/persistence/pcustomer/.svn/dir-prop-base new file mode 100644 index 0000000..40820ff --- /dev/null +++ b/base/persistence/pcustomer/.svn/dir-prop-base @@ -0,0 +1,6 @@ +K 10 +svn:ignore +V 7 +target + +END diff --git a/base/persistence/pcustomer/.svn/entries b/base/persistence/pcustomer/.svn/entries new file mode 100644 index 0000000..cd65d93 --- /dev/null +++ b/base/persistence/pcustomer/.svn/entries @@ -0,0 +1,170 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pcustomer +svn://172.17.26.185/COMACO + + + +2015-03-19T04:16:15.728436Z +3943 +dlopez +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +.classpath +file + + + + +2022-07-28T03:40:25.618729Z +ba44b13f85b61103751627c33bd39ff1 +2014-11-07T03:37:48.674062Z +2448 +ogarcia + + + + + + + + + + + + + + + + + + + + + +1299 + +.project +file + + + + +2022-07-28T03:40:25.619729Z +cb014121a85ec9828e657b74728b89ca +2014-11-07T03:37:48.674062Z +2448 +ogarcia + + + + + + + + + + + + + + + + + + + + + +1418 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:25.619729Z +ae4ddfe63de201c39ff0443755a1d22b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +805 + +.settings +dir + +.pmd +file + + + + +2022-07-28T03:40:25.619729Z +a005c8627d2a64c8f23720db011d5372 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +18996 + diff --git a/base/persistence/pcustomer/.svn/text-base/.classpath.svn-base b/base/persistence/pcustomer/.svn/text-base/.classpath.svn-base new file mode 100644 index 0000000..161c246 --- /dev/null +++ b/base/persistence/pcustomer/.svn/text-base/.classpath.svn-base @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/base/persistence/pcustomer/.svn/text-base/.pmd.svn-base b/base/persistence/pcustomer/.svn/text-base/.pmd.svn-base new file mode 100644 index 0000000..2f1733e --- /dev/null +++ b/base/persistence/pcustomer/.svn/text-base/.pmd.svn-base @@ -0,0 +1,601 @@ + + + false + .ruleset + + + EmptyIfStmt + Basic Rules + + + EmptyWhileStmt + Basic Rules + + + EmptyTryBlock + Basic Rules + + + EmptyFinallyBlock + Basic Rules + + + EmptySwitchStatements + Basic Rules + + + JumbledIncrementer + Basic Rules + + + ForLoopShouldBeWhileLoop + Basic Rules + + + UnnecessaryConversionTemporary + Basic Rules + + + OverrideBothEqualsAndHashcode + Basic Rules + + + DoubleCheckedLocking + Basic Rules + + + ReturnFromFinallyBlock + Basic Rules + + + EmptySynchronizedBlock + Basic Rules + + + UnnecessaryReturn + Basic Rules + + + EmptyStaticInitializer + Basic Rules + + + UnconditionalIfStatement + Basic Rules + + + EmptyStatementNotInLoop + Basic Rules + + + BooleanInstantiation + Basic Rules + + + UnnecessaryFinalModifier + Basic Rules + + + CollapsibleIfStatements + Basic Rules + + + UselessOverridingMethod + Basic Rules + + + ClassCastExceptionWithToArray + Basic Rules + + + AvoidDecimalLiteralsInBigDecimalConstructor + Basic Rules + + + UselessOperationOnImmutable + Basic Rules + + + MisplacedNullCheck + Basic Rules + + + UnusedNullCheckInEquals + Basic Rules + + + AvoidThreadGroup + Basic Rules + + + BrokenNullCheck + Basic Rules + + + AvoidUsingOctalValues + Basic Rules + + + AvoidUsingHardCodedIP + Basic Rules + + + CheckResultSet + Basic Rules + + + AvoidMultipleUnaryOperators + Basic Rules + + + EmptyInitializer + Basic Rules + + + NPathComplexity + Code Size Rules + + + ExcessiveMethodLength + Code Size Rules + + + NcssMethodCount + Code Size Rules + + + NcssTypeCount + Code Size Rules + + + NcssConstructorCount + Code Size Rules + + + VariableNamingConventions + Naming Rules + + + MethodNamingConventions + Naming Rules + + + ClassNamingConventions + Naming Rules + + + AvoidDollarSigns + Naming Rules + + + MethodWithSameNameAsEnclosingClass + Naming Rules + + + SuspiciousHashcodeMethodName + Naming Rules + + + SuspiciousConstantFieldName + Naming Rules + + + SuspiciousEqualsMethodName + Naming Rules + + + AvoidFieldNameMatchingTypeName + Naming Rules + + + AvoidFieldNameMatchingMethodName + Naming Rules + + + NoPackage + Naming Rules + + + PackageCase + Naming Rules + + + MisleadingVariableName + Naming Rules + + + BooleanGetMethodName + Naming Rules + + + MoreThanOneLogger + Java Logging Rules + + + LoggerIsNotStaticFinal + Java Logging Rules + + + SystemPrintln + Java Logging Rules + + + AvoidPrintStackTrace + Java Logging Rules + + + IfStmtsMustUseBraces + Braces Rules + + + WhileLoopsMustUseBraces + Braces Rules + + + IfElseStmtsMustUseBraces + Braces Rules + + + ForLoopsMustUseBraces + Braces Rules + + + UseSingleton + Design Rules + + + SimplifyBooleanReturns + Design Rules + + + SimplifyBooleanExpressions + Design Rules + + + SwitchStmtsShouldHaveDefault + Design Rules + + + SwitchDensity + Design Rules + + + AccessorClassGeneration + Design Rules + + + FinalFieldCouldBeStatic + Design Rules + + + CloseResource + Design Rules + + + NonStaticInitializer + Design Rules + + + DefaultLabelNotLastInSwitchStmt + Design Rules + + + NonCaseLabelInSwitchStatement + Design Rules + + + OptimizableToArrayCall + Design Rules + + + BadComparison + Design Rules + + + EqualsNull + Design Rules + + + InstantiationToGetClass + Design Rules + + + IdempotentOperations + Design Rules + + + AvoidProtectedFieldInFinalClass + Design Rules + + + MissingStaticMethodInNonInstantiatableClass + Design Rules + + + MissingBreakInSwitch + Design Rules + + + UseNotifyAllInsteadOfNotify + Design Rules + + + AvoidInstanceofChecksInCatchClause + Design Rules + + + AbstractClassWithoutAbstractMethod + Design Rules + + + SimplifyConditional + Design Rules + + + CompareObjectsWithEquals + Design Rules + + + PositionLiteralsFirstInComparisons + Design Rules + + + UnnecessaryLocalBeforeReturn + Design Rules + + + NonThreadSafeSingleton + Design Rules + + + UncommentedEmptyMethod + Design Rules + + + AvoidConstantsInterface + Design Rules + + + UnsynchronizedStaticDateFormatter + Design Rules + + + PreserveStackTrace + Design Rules + + + UseCollectionIsEmpty + Design Rules + + + ClassWithOnlyPrivateConstructorsShouldBeFinal + Design Rules + + + EmptyMethodInAbstractClassShouldBeAbstract + Design Rules + + + SingularField + Design Rules + + + ReturnEmptyArrayRatherThanNull + Design Rules + + + AbstractClassWithoutAnyMethod + Design Rules + + + TooFewBranchesForASwitchStatement + Design Rules + + + ReplaceVectorWithList + Migration Rules + + + ReplaceHashtableWithMap + Migration Rules + + + ReplaceEnumerationWithIterator + Migration Rules + + + AvoidEnumAsIdentifier + Migration Rules + + + AvoidAssertAsIdentifier + Migration Rules + + + IntegerInstantiation + Migration Rules + + + ByteInstantiation + Migration Rules + + + ShortInstantiation + Migration Rules + + + LongInstantiation + Migration Rules + + + JUnit4TestShouldUseBeforeAnnotation + Migration Rules + + + JUnit4TestShouldUseAfterAnnotation + Migration Rules + + + JUnit4TestShouldUseTestAnnotation + Migration Rules + + + JUnit4SuitesShouldUseSuiteAnnotation + Migration Rules + + + JUnitUseExpected + Migration Rules + + + AvoidDuplicateLiterals + String and StringBuffer Rules + + + StringToString + String and StringBuffer Rules + + + InefficientStringBuffering + String and StringBuffer Rules + + + UnnecessaryCaseChange + String and StringBuffer Rules + + + UseStringBufferLength + String and StringBuffer Rules + + + AppendCharacterWithChar + String and StringBuffer Rules + + + ConsecutiveLiteralAppends + String and StringBuffer Rules + + + UseIndexOfChar + String and StringBuffer Rules + + + InefficientEmptyStringCheck + String and StringBuffer Rules + + + InsufficientStringBufferDeclaration + String and StringBuffer Rules + + + UselessStringValueOf + String and StringBuffer Rules + + + StringBufferInstantiationWithChar + String and StringBuffer Rules + + + UseEqualsToCompareStrings + String and StringBuffer Rules + + + AvoidStringBufferField + String and StringBuffer Rules + + + LooseCoupling + Type Resolution Rules + + + CloneMethodMustImplementCloneable + Type Resolution Rules + + + UnusedImports + Type Resolution Rules + + + UnnecessaryConstructor + Controversial Rules + + + UnusedModifier + Controversial Rules + + + AssignmentInOperand + Controversial Rules + + + AtLeastOneConstructor + Controversial Rules + + + DontImportSun + Controversial Rules + + + SuspiciousOctalEscape + Controversial Rules + + + DefaultPackage + Controversial Rules + + + BooleanInversion + Controversial Rules + + + AvoidFinalLocalVariable + Controversial Rules + + + AvoidUsingShortType + Controversial Rules + + + AvoidUsingVolatile + Controversial Rules + + + AvoidUsingNativeCode + Controversial Rules + + + AvoidAccessibilityAlteration + Controversial Rules + + + DoNotCallGarbageCollectionExplicitly + Controversial Rules + + + UnusedPrivateField + Unused Code Rules + + + UnusedLocalVariable + Unused Code Rules + + + UnusedPrivateMethod + Unused Code Rules + + + UnusedFormalParameter + Unused Code Rules + + + AvoidDeeplyNestedIfStmts + Design Rules + + + CyclomaticComplexity + Code Size Rules + + + false + true + diff --git a/base/persistence/pcustomer/.svn/text-base/.project.svn-base b/base/persistence/pcustomer/.svn/text-base/.project.svn-base new file mode 100644 index 0000000..cd8c738 --- /dev/null +++ b/base/persistence/pcustomer/.svn/text-base/.project.svn-base @@ -0,0 +1,48 @@ + + + pcustomer + + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + org.hibernate.eclipse.console.hibernateBuilder + + + + + org.eclipse.babel.editor.rbeBuilder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.hibernate.eclipse.console.hibernateNature + com.jaspersoft.studio.babel.editor.rbeNature + org.eclipse.wst.common.project.facet.core.nature + + diff --git a/base/persistence/pcustomer/.svn/text-base/pom.xml.svn-base b/base/persistence/pcustomer/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..f3e92bb --- /dev/null +++ b/base/persistence/pcustomer/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,23 @@ + + + + persistence + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.persistence + pcustomer + pcustomer + + + com.fp.base.persistence + commondb + 2.1 + jar + + + diff --git a/base/persistence/pcustomer/pom.xml b/base/persistence/pcustomer/pom.xml new file mode 100644 index 0000000..f3e92bb --- /dev/null +++ b/base/persistence/pcustomer/pom.xml @@ -0,0 +1,23 @@ + + + + persistence + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.persistence + pcustomer + pcustomer + + + com.fp.base.persistence + commondb + 2.1 + jar + + + diff --git a/base/persistence/pcustomer/src/.svn/entries b/base/persistence/pcustomer/src/.svn/entries new file mode 100644 index 0000000..8a3dccb --- /dev/null +++ b/base/persistence/pcustomer/src/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pcustomer/src +svn://172.17.26.185/COMACO + + + +2015-03-19T04:16:15.728436Z +3943 +dlopez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +main +dir + diff --git a/base/persistence/pcustomer/src/main/.svn/entries b/base/persistence/pcustomer/src/main/.svn/entries new file mode 100644 index 0000000..ed1542e --- /dev/null +++ b/base/persistence/pcustomer/src/main/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pcustomer/src/main +svn://172.17.26.185/COMACO + + + +2015-03-19T04:16:15.728436Z +3943 +dlopez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/persistence/pcustomer/src/main/java/.svn/entries b/base/persistence/pcustomer/src/main/java/.svn/entries new file mode 100644 index 0000000..a48398a --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pcustomer/src/main/java +svn://172.17.26.185/COMACO + + + +2015-03-19T04:16:15.728436Z +3943 +dlopez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/persistence/pcustomer/src/main/java/com/.svn/entries b/base/persistence/pcustomer/src/main/java/com/.svn/entries new file mode 100644 index 0000000..883470d --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pcustomer/src/main/java/com +svn://172.17.26.185/COMACO + + + +2015-03-19T04:16:15.728436Z +3943 +dlopez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/persistence/pcustomer/src/main/java/com/fp/.svn/entries b/base/persistence/pcustomer/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..72a352a --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pcustomer/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2015-03-19T04:16:15.728436Z +3943 +dlopez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +persistence +dir + diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/.svn/entries b/base/persistence/pcustomer/src/main/java/com/fp/persistence/.svn/entries new file mode 100644 index 0000000..cfec8e0 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pcustomer/src/main/java/com/fp/persistence +svn://172.17.26.185/COMACO + + + +2015-03-19T04:16:15.728436Z +3943 +dlopez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +pcustomer +dir + diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/.svn/entries b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/.svn/entries new file mode 100644 index 0000000..153a491 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/.svn/entries @@ -0,0 +1,40 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer +svn://172.17.26.185/COMACO + + + +2015-03-19T04:16:15.728436Z +3943 +dlopez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +people +dir + +balance +dir + +company +dir + +gene +dir + diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/entries b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/entries new file mode 100644 index 0000000..b577d40 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/entries @@ -0,0 +1,334 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TcustPersonBalance.java +file + + + + +2022-07-28T03:40:25.225727Z +a4c20f78287634ac9bf027cee1508772 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9506 + +TcustBalanceKey.java +file + + + + +2022-07-28T03:40:25.225727Z +a380d9275df70b8ffeb750ef1e79e302 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3479 + +TcustBalanceAccount.java +file + + + + +2022-07-28T03:40:25.225727Z +0c7deae8655e8b887ceab953128a45d4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9863 + +TcustBalanceAccoLevel.java +file + + + + +2022-07-28T03:40:25.226727Z +d9912da9f03edd24bbe63a7c1447b151 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4634 + +TcustBalanceFinancialKey.java +file + + + + +2022-07-28T03:40:25.226727Z +5bb7d2eda41d7da3b59630f91f24f375 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6944 + +TcustBalance.java +file + + + + +2022-07-28T03:40:25.227727Z +463d3e27e13e9f2f23647e95ae343596 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3580 + +TcustPersonBalanceKey.java +file + + + + +2022-07-28T03:40:25.227727Z +96948cfb0a1852882edb3eae34e94f0c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6125 + +TcustBalanceFinancial.java +file + + + + +2022-07-28T03:40:25.227727Z +d550c11c99e3d75c4e3570f91b3a7ef5 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7596 + +TcustBalanceAccountKey.java +file + + + + +2022-07-28T03:40:25.227727Z +7d5244866e0cfa31ac4765550ae4f736 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4578 + diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustBalance.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustBalance.java.svn-base new file mode 100644 index 0000000..0b3e871 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustBalance.java.svn-base @@ -0,0 +1,122 @@ +package com.fp.persistence.pcustomer.balance; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTBALANCE*/ +@Entity(name="TcustBalance") +@Table(name="TCUSTBALANCE") +public class TcustBalance extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TcustBalance +*/ +@EmbeddedId +private TcustBalanceKey pk; +/**Contructor por defecto*/ +public TcustBalance(){ +} +/**Contructor de TcustBalance +@param pPk Clave Primaria del entity +*/ +public TcustBalance(TcustBalanceKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TcustBalance +*/ +public static TcustBalance find(EntityManager pEntityManager,TcustBalanceKey pKey) throws Exception{ + TcustBalance obj = pEntityManager.find(TcustBalance.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TcustBalance +@return El objeto que referencia a la Clave primaria de TcustBalance +*/ +public TcustBalanceKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TcustBalance +@param pPk El objeto que referencia a la nueva Clave primaria de TcustBalance +*/ +public void setPk(TcustBalanceKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TcustBalance))return false; + TcustBalance that = (TcustBalance) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TcustBalance +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TcustBalance +*/ +public Object createInstance(){ + TcustBalance instance=new TcustBalance(); + instance.setPk(new TcustBalanceKey()); + return instance; +} +/**Clona la entidad TcustBalance +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TcustBalance p=(TcustBalance)this.clone(); + p.setPk((TcustBalanceKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustBalanceAccoLevel.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustBalanceAccoLevel.java.svn-base new file mode 100644 index 0000000..3aadace --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustBalanceAccoLevel.java.svn-base @@ -0,0 +1,158 @@ +package com.fp.persistence.pcustomer.balance; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTBALANCEACCOLEVEL*/ +@Entity(name="TcustBalanceAccoLevel") +@Table(name="TCUSTBALANCEACCOLEVEL") +public class TcustBalanceAccoLevel extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TcustBalanceAccoLevel +*/ +@Id +@Column(name="ACCOLEVELCODE" ,nullable=false, updatable=false) +private Integer pk; +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion del nivel de cuenta de balance +*/ +private String description; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking del registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TcustBalanceAccoLevel(){ +} +/**Contructor de TcustBalanceAccoLevel +@param pPk Clave Primaria del entity +*/ +public TcustBalanceAccoLevel(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TcustBalanceAccoLevel +*/ +public static TcustBalanceAccoLevel find(EntityManager pEntityManager,Object pKey) throws Exception{ + TcustBalanceAccoLevel obj = pEntityManager.find(TcustBalanceAccoLevel.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TcustBalanceAccoLevel +@return El objeto que referencia a la Clave primaria de TcustBalanceAccoLevel +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TcustBalanceAccoLevel +@param pPk El objeto que referencia a la nueva Clave primaria de TcustBalanceAccoLevel +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TcustBalanceAccoLevel))return false; + TcustBalanceAccoLevel that = (TcustBalanceAccoLevel) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TcustBalanceAccoLevel +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TcustBalanceAccoLevel +*/ +public Object createInstance(){ + TcustBalanceAccoLevel instance=new TcustBalanceAccoLevel(); + return instance; +} +/**Clona la entidad TcustBalanceAccoLevel +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TcustBalanceAccoLevel p=(TcustBalanceAccoLevel)this.clone(); + return p; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustBalanceAccount.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustBalanceAccount.java.svn-base new file mode 100644 index 0000000..47adf4e --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustBalanceAccount.java.svn-base @@ -0,0 +1,305 @@ +package com.fp.persistence.pcustomer.balance; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTBALANCEACCOUNT*/ +@Entity(name = "TcustBalanceAccount") +@Table(name = "TCUSTBALANCEACCOUNT") +public class TcustBalanceAccount extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustBalanceAccount + */ + @EmbeddedId + private TcustBalanceAccountKey pk; + @Column(name = "ACCOLEVELCODE", nullable = true) + /** + * Codigo de nivel de cuenta de balance + */ + private Integer accolevelcode; + @Column(name = "ACCOUNTCATALOG", nullable = true) + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String accountcatalog; + @Column(name = "ACCOUNTCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String accountcatalogcode; + @Column(name = "DESCRIPTION", nullable = true) + /** + * Descripcion de la cuenta de balance + */ + private String description; + @Column(name = "SIGNACCOUNT", nullable = true) + /** + * S lleva signo la cuenta, N no lleva signo + */ + private String signaccount; + @Column(name = "SIGNVALUE", nullable = true) + /** + * Signo de la cuenta de balnace + */ + private String signvalue; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Manejo de optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "PARAMETERFILE", nullable = true) + /** + * null + */ + private String parameterfile; + + /**Contructor por defecto*/ + public TcustBalanceAccount() { + } + + /**Contructor de TcustBalanceAccount + @param pPk Clave Primaria del entity + */ + public TcustBalanceAccount(TcustBalanceAccountKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustBalanceAccount + */ + public static TcustBalanceAccount find(EntityManager pEntityManager, TcustBalanceAccountKey pKey) throws Exception { + TcustBalanceAccount obj = pEntityManager.find(TcustBalanceAccount.class, pKey); + return obj; + } + + /**Entrega la Clave primaria de TcustBalanceAccount + @return El objeto que referencia a la Clave primaria de TcustBalanceAccount + */ + public TcustBalanceAccountKey getPk() { + return pk; + } + + /**Fija un nuevo valor a la Clave primaria de TcustBalanceAccount + @param pPk El objeto que referencia a la nueva Clave primaria de TcustBalanceAccount + */ + public void setPk(TcustBalanceAccountKey pPk) { + pk = pPk; + } + + /**Obtiene el valor de accolevelcode + @return valor de accolevelcode*/ + public Integer getAccolevelcode() { + return accolevelcode; + } + + /**Fija el valor de accolevelcode + @param pAccolevelcode nuevo Valor de accolevelcode*/ + public void setAccolevelcode(Integer pAccolevelcode) { + accolevelcode = pAccolevelcode; + } + + /**Obtiene el valor de accountcatalog + @return valor de accountcatalog*/ + public String getAccountcatalog() { + return accountcatalog; + } + + /**Fija el valor de accountcatalog + @param pAccountcatalog nuevo Valor de accountcatalog*/ + public void setAccountcatalog(String pAccountcatalog) { + accountcatalog = pAccountcatalog; + } + + /**Obtiene el valor de accountcatalogcode + @return valor de accountcatalogcode*/ + public String getAccountcatalogcode() { + return accountcatalogcode; + } + + /**Fija el valor de accountcatalogcode + @param pAccountcatalogcode nuevo Valor de accountcatalogcode*/ + public void setAccountcatalogcode(String pAccountcatalogcode) { + accountcatalogcode = pAccountcatalogcode; + } + + /**Obtiene el valor de description + @return valor de description*/ + public String getDescription() { + return description; + } + + /**Fija el valor de description + @param pDescription nuevo Valor de description*/ + public void setDescription(String pDescription) { + description = pDescription; + } + + /**Obtiene el valor de signaccount + @return valor de signaccount*/ + public String getSignaccount() { + return signaccount; + } + + /**Fija el valor de signaccount + @param pSignaccount nuevo Valor de signaccount*/ + public void setSignaccount(String pSignaccount) { + signaccount = pSignaccount; + } + + /**Obtiene el valor de signvalue + @return valor de signvalue*/ + public String getSignvalue() { + return signvalue; + } + + /**Fija el valor de signvalue + @param pSignvalue nuevo Valor de signvalue*/ + public void setSignvalue(String pSignvalue) { + signvalue = pSignvalue; + } + + /**Obtiene el valor de recordversion + @return valor de recordversion*/ + public Integer getRecordversion() { + return recordversion; + } + + /**Fija el valor de recordversion + @param pRecordversion nuevo Valor de recordversion*/ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /**Obtiene el valor de parameterfile + @return valor de parameterfile*/ + public String getParameterfile() { + return parameterfile; + } + + /**Fija el valor de parameterfile + @param pParameterfile nuevo Valor de parameterfile*/ + public void setParameterfile(String pParameterfile) { + parameterfile = pParameterfile; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustBalanceAccount)) { + return false; + } + TcustBalanceAccount that = (TcustBalanceAccount) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /**Implementacion del metodo hashCode de la la entidad TcustBalanceAccount + @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /**Implementacion toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /**Implementacion de la creacion de un bean en blanco TcustBalanceAccount + */ + public Object createInstance() { + TcustBalanceAccount instance = new TcustBalanceAccount(); + instance.setPk(new TcustBalanceAccountKey()); + return instance; + } + + /**Clona la entidad TcustBalanceAccount + @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustBalanceAccount p = (TcustBalanceAccount) this.clone(); + p.setPk((TcustBalanceAccountKey) this.pk.cloneMe()); + return p; + } + /** + * jpql Que retorna un objeto TcustBalanceAccount a partir de un parametro + * especfico + */ + public static final String JPQL_GET_ACCOUNT_PARAMETER = "from TcustBalanceAccount t where t.parameterfile = :parameter"; + + /** + * Metodo que entrega el Objeto a partir de un campo especfico. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pParameterfile Campo especfico del bean. + * @return + * @throws Exception + */ + public static TcustBalanceAccount findPerParameter(EntityManager pEntityManager, String pParameterfile) throws Exception { + TcustBalanceAccount tcustBalanceAccount = null; + Query qry = pEntityManager.createQuery(JPQL_GET_ACCOUNT_PARAMETER); + qry.setParameter("parameter", pParameterfile); + try { + tcustBalanceAccount = (TcustBalanceAccount) qry.getSingleResult(); + } catch (NoResultException e) { + } + return tcustBalanceAccount; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustBalanceAccountKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustBalanceAccountKey.java.svn-base new file mode 100644 index 0000000..62bde05 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustBalanceAccountKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pcustomer.balance; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTBALANCEACCOUNT*/ +@Embeddable +public class TcustBalanceAccountKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNTCODE", nullable=false,updatable=false) + +/** +* Codigo de la cuenta de balance +*/ +private String accountcode; + +@Column(name="BALANCECATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String balancecatalog; + +@Column(name="BALANCECATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String balancecatalogcode; + +/**Contructor por defecto*/ +public TcustBalanceAccountKey(){} +/**Contructor de TcustBalanceAccountKey +@param pAccountcode Codigo de la cuenta de balance +@param pBalancecatalog Codigo de catalogo 01 Natural, 02 Juridico +@param pBalancecatalogcode Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +public TcustBalanceAccountKey(String pAccountcode,String pBalancecatalog,String pBalancecatalogcode){ + accountcode=pAccountcode; + balancecatalog=pBalancecatalog; + balancecatalogcode=pBalancecatalogcode; +} +/**Obtiene el valor de accountcode +@return valor de accountcode*/ +public String getAccountcode(){ + return accountcode; +} +/**Fija el valor de accountcode +@param pAccountcode nuevo Valor de accountcode*/ +public void setAccountcode(String pAccountcode){ + accountcode=pAccountcode; +} + +/**Obtiene el valor de balancecatalog +@return valor de balancecatalog*/ +public String getBalancecatalog(){ + return balancecatalog; +} +/**Fija el valor de balancecatalog +@param pBalancecatalog nuevo Valor de balancecatalog*/ +public void setBalancecatalog(String pBalancecatalog){ + balancecatalog=pBalancecatalog; +} + +/**Obtiene el valor de balancecatalogcode +@return valor de balancecatalogcode*/ +public String getBalancecatalogcode(){ + return balancecatalogcode; +} +/**Fija el valor de balancecatalogcode +@param pBalancecatalogcode nuevo Valor de balancecatalogcode*/ +public void setBalancecatalogcode(String pBalancecatalogcode){ + balancecatalogcode=pBalancecatalogcode; +} + +/**Implementacion de la comparacion de TcustBalanceAccountKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustBalanceAccountKey))return false; + TcustBalanceAccountKey that = (TcustBalanceAccountKey) o; + if (this.getAccountcode() == null || that.getAccountcode() == null){ + return false; + } + if (! this.getAccountcode().equals(that.getAccountcode())){ + return false; + } + if (this.getBalancecatalog() == null || that.getBalancecatalog() == null){ + return false; + } + if (! this.getBalancecatalog().equals(that.getBalancecatalog())){ + return false; + } + if (this.getBalancecatalogcode() == null || that.getBalancecatalogcode() == null){ + return false; + } + if (! this.getBalancecatalogcode().equals(that.getBalancecatalogcode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TcustBalanceAccountKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccountcode() == null ? 0 : this.getAccountcode().hashCode()); + result = result * 37 + (this.getBalancecatalog() == null ? 0 : this.getBalancecatalog().hashCode()); + result = result * 37 + (this.getBalancecatalogcode() == null ? 0 : this.getBalancecatalogcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustBalanceFinancial.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustBalanceFinancial.java.svn-base new file mode 100644 index 0000000..3dddec8 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustBalanceFinancial.java.svn-base @@ -0,0 +1,295 @@ +package com.fp.persistence.pcustomer.balance; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTBALANCEFINANCIAL + */ +@Entity(name = "TcustBalanceFinancial") +@Table(name = "TCUSTBALANCEFINANCIAL") +public class TcustBalanceFinancial extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TcustBalanceFinancial + */ + @EmbeddedId + private TcustBalanceFinancialKey pk; + + @Column(name = "VALUEACCOUNT", nullable = true) + /** + * Saldo de la cuenta en el balance + */ + private BigDecimal valueaccount; + + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el registro + */ + private String ingressuser; + + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del registro + */ + private String modifyuser; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + /** + * Contructor por defecto + */ + public TcustBalanceFinancial() { + } + + /** + * Contructor de TcustBalanceFinancial + * + * @param pPk Clave Primaria del entity + */ + public TcustBalanceFinancial(TcustBalanceFinancialKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustBalanceFinancial + */ + public static TcustBalanceFinancial find(EntityManager pEntityManager, TcustBalanceFinancialKey pKey) throws Exception { + TcustBalanceFinancial obj = pEntityManager.find(TcustBalanceFinancial.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustBalanceFinancial + * + * @return El objeto que referencia a la Clave primaria de TcustBalanceFinancial + */ + public TcustBalanceFinancialKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustBalanceFinancial + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TcustBalanceFinancial + */ + public void setPk(TcustBalanceFinancialKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de valueaccount + * + * @return valor de valueaccount + */ + public BigDecimal getValueaccount() { + return this.valueaccount; + } + + /** + * Fija el valor de valueaccount + * + * @param pValueaccount nuevo Valor de valueaccount + */ + public void setValueaccount(BigDecimal pValueaccount) { + this.valueaccount = pValueaccount; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return this.ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + this.ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return this.modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + this.modifyuser = pModifyuser; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustBalanceFinancial)) { + return false; + } + TcustBalanceFinancial that = (TcustBalanceFinancial) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementación del metodo hashCode de la la entidad TcustBalanceFinancial + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementación toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementación de la creación de un bean en blanco TcustBalanceFinancial + */ + @Override + public Object createInstance() { + TcustBalanceFinancial instance = new TcustBalanceFinancial(); + instance.setPk(new TcustBalanceFinancialKey()); + return instance; + } + + /** + * Clona la entidad TcustBalanceFinancial + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustBalanceFinancial p = (TcustBalanceFinancial) this.clone(); + p.setPk((TcustBalanceFinancialKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustBalanceFinancialKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustBalanceFinancialKey.java.svn-base new file mode 100644 index 0000000..572f211 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustBalanceFinancialKey.java.svn-base @@ -0,0 +1,238 @@ +package com.fp.persistence.pcustomer.balance; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TCUSTBALANCEFINANCIAL*/ +@Embeddable +public class TcustBalanceFinancialKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="ACCOUNTCODE", nullable=false,updatable=false) + +/** +* Codigo de la cuenta de balance +*/ +private String accountcode; + +@Column(name="BALANCECATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String balancecatalog; + +@Column(name="BALANCECATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String balancecatalogcode; + +@Column(name="BALANCEDATE", nullable=false,updatable=false) + +/** +* Fecha de balance +*/ +private Date balancedate; + +/**Contructor por defecto*/ +public TcustBalanceFinancialKey(){} +/**Contructor de TcustBalanceFinancialKey +@param pDateto Fecha hasta la cual esta vigente el registro +@param pPersoncode Codigo de persona +@param pAccountcode Codigo de la cuenta de balance +@param pBalancecatalog Codigo de catalogo 01 Natural, 02 Juridico +@param pBalancecatalogcode Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +@param pBalancedate Fecha de balance +*/ +public TcustBalanceFinancialKey(Timestamp pDateto,Integer pPersoncode,String pAccountcode,String pBalancecatalog,String pBalancecatalogcode,Date pBalancedate){ + dateto=pDateto; + personcode=pPersoncode; + accountcode=pAccountcode; + balancecatalog=pBalancecatalog; + balancecatalogcode=pBalancecatalogcode; + balancedate=pBalancedate; +} +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de accountcode +@return valor de accountcode*/ +public String getAccountcode(){ + return accountcode; +} +/**Fija el valor de accountcode +@param pAccountcode nuevo Valor de accountcode*/ +public void setAccountcode(String pAccountcode){ + accountcode=pAccountcode; +} + +/**Obtiene el valor de balancecatalog +@return valor de balancecatalog*/ +public String getBalancecatalog(){ + return balancecatalog; +} +/**Fija el valor de balancecatalog +@param pBalancecatalog nuevo Valor de balancecatalog*/ +public void setBalancecatalog(String pBalancecatalog){ + balancecatalog=pBalancecatalog; +} + +/**Obtiene el valor de balancecatalogcode +@return valor de balancecatalogcode*/ +public String getBalancecatalogcode(){ + return balancecatalogcode; +} +/**Fija el valor de balancecatalogcode +@param pBalancecatalogcode nuevo Valor de balancecatalogcode*/ +public void setBalancecatalogcode(String pBalancecatalogcode){ + balancecatalogcode=pBalancecatalogcode; +} + +/**Obtiene el valor de balancedate +@return valor de balancedate*/ +public Date getBalancedate(){ + return balancedate; +} +/**Fija el valor de balancedate +@param pBalancedate nuevo Valor de balancedate*/ +public void setBalancedate(Date pBalancedate){ + balancedate=pBalancedate; +} + +/**Implementación de la comparación de TcustBalanceFinancialKey +@param o Objeto de comparación +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustBalanceFinancialKey))return false; + TcustBalanceFinancialKey that = (TcustBalanceFinancialKey) o; + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getAccountcode() == null || that.getAccountcode() == null){ + return false; + } + if (! this.getAccountcode().equals(that.getAccountcode())){ + return false; + } + if (this.getBalancecatalog() == null || that.getBalancecatalog() == null){ + return false; + } + if (! this.getBalancecatalog().equals(that.getBalancecatalog())){ + return false; + } + if (this.getBalancecatalogcode() == null || that.getBalancecatalogcode() == null){ + return false; + } + if (! this.getBalancecatalogcode().equals(that.getBalancecatalogcode())){ + return false; + } + if (this.getBalancedate() == null || that.getBalancedate() == null){ + return false; + } + if (! this.getBalancedate().equals(that.getBalancedate())){ + return false; + } + return true; +} +/**Implementación del método hashCode bajo el patrón de Bloch +@return hashCode de la instancia TcustBalanceFinancialKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getAccountcode() == null ? 0 : this.getAccountcode().hashCode()); + result = result * 37 + (this.getBalancecatalog() == null ? 0 : this.getBalancecatalog().hashCode()); + result = result * 37 + (this.getBalancecatalogcode() == null ? 0 : this.getBalancecatalogcode().hashCode()); + result = result * 37 + (this.getBalancedate() == null ? 0 : this.getBalancedate().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementación toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustBalanceKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustBalanceKey.java.svn-base new file mode 100644 index 0000000..f3b7d65 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustBalanceKey.java.svn-base @@ -0,0 +1,125 @@ +package com.fp.persistence.pcustomer.balance; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TCUSTBALANCE*/ +@Embeddable +public class TcustBalanceKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="BALANCEDATE", nullable=false,updatable=false) + +/** +* Fecha de balance financiero +*/ +private Date balancedate; + +/**Contructor por defecto*/ +public TcustBalanceKey(){} +/**Contructor de TcustBalanceKey +@param pPersoncode Codigo de persona +@param pBalancedate Fecha de balance financiero +*/ +public TcustBalanceKey(Integer pPersoncode,Date pBalancedate){ + personcode=pPersoncode; + balancedate=pBalancedate; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de balancedate +@return valor de balancedate*/ +public Date getBalancedate(){ + return balancedate; +} +/**Fija el valor de balancedate +@param pBalancedate nuevo Valor de balancedate*/ +public void setBalancedate(Date pBalancedate){ + balancedate=pBalancedate; +} + +/**Implementacin de la comparacin de TcustBalanceKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustBalanceKey))return false; + TcustBalanceKey that = (TcustBalanceKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getBalancedate() == null || that.getBalancedate() == null){ + return false; + } + if (! this.getBalancedate().equals(that.getBalancedate())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustBalanceKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getBalancedate() == null ? 0 : this.getBalancedate().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustPersonBalance.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustPersonBalance.java.svn-base new file mode 100644 index 0000000..0e0646b --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustPersonBalance.java.svn-base @@ -0,0 +1,379 @@ +package com.fp.persistence.pcustomer.balance; + +import java.sql.Timestamp; +import com.fp.dto.hb.Log; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import javax.persistence.Entity; +import javax.persistence.EmbeddedId; +import com.fp.dto.hb.Cache; +import javax.persistence.EntityManager; +import javax.persistence.Column; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTPERSONBALANCE + */ +@Entity(name = "TcustPersonBalance") +@Table(name = "TCUSTPERSONBALANCE") +public class TcustPersonBalance extends com.fp.dto.AbstractDataTransport + implements Serializable, HibernateBean, Cloneable, Cache, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustPersonBalance + */ + @EmbeddedId + private TcustPersonBalanceKey pk; + @Column(name = "STATUSCATALOG", nullable = true) + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String statuscatalog; + @Column(name = "STATUSCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String statuscatalogcode; + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + @Column(name = "COMPANYCODE", nullable = true) + /** + * Codigo de compania + */ + private Integer companycode; + @Column(name = "CODE", nullable = true) + /** + * Codigo de imagen. + */ + private Integer code; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el registro + */ + private String ingressuser; + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del registro + */ + private String modifyuser; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + /** + * Contructor por defecto + */ + public TcustPersonBalance() { + } + + /** + * Contructor de TcustPersonBalance + * + * @param pPk Clave Primaria del entity + */ + public TcustPersonBalance(TcustPersonBalanceKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPersonBalance + */ + public static TcustPersonBalance find(EntityManager pEntityManager, TcustPersonBalanceKey pKey) throws Exception { + TcustPersonBalance obj = pEntityManager.find(TcustPersonBalance.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPersonBalance + * + * @return El objeto que referencia a la Clave primaria de + * TcustPersonBalance + */ + public TcustPersonBalanceKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPersonBalance + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustPersonBalance + */ + public void setPk(TcustPersonBalanceKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de statuscatalog + * + * @return valor de statuscatalog + */ + public String getStatuscatalog() { + return statuscatalog; + } + + /** + * Fija el valor de statuscatalog + * + * @param pStatuscatalog nuevo Valor de statuscatalog + */ + public void setStatuscatalog(String pStatuscatalog) { + statuscatalog = pStatuscatalog; + } + + /** + * Obtiene el valor de statuscatalogcode + * + * @return valor de statuscatalogcode + */ + public String getStatuscatalogcode() { + return statuscatalogcode; + } + + /** + * Fija el valor de statuscatalogcode + * + * @param pStatuscatalogcode nuevo Valor de statuscatalogcode + */ + public void setStatuscatalogcode(String pStatuscatalogcode) { + statuscatalogcode = pStatuscatalogcode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de companycode + * + * @return valor de companycode + */ + public Integer getCompanycode() { + return companycode; + } + + /** + * Fija el valor de companycode + * + * @param pCompanycode nuevo Valor de companycode + */ + public void setCompanycode(Integer pCompanycode) { + companycode = pCompanycode; + } + + /** + * Obtiene el valor de code + * + * @return valor de code + */ + public Integer getCode() { + return code; + } + + /** + * Fija el valor de code + * + * @param pCode nuevo Valor de code + */ + public void setCode(Integer pCode) { + code = pCode; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + datefrom = pDatefrom; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + modifyuser = pModifyuser; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPersonBalance)) { + return false; + } + TcustPersonBalance that = (TcustPersonBalance) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementación del metodo hashCode de la la entidad TcustPersonBalance + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementación toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementación de la creación de un bean en blanco TcustPersonBalance + */ + public Object createInstance() { + TcustPersonBalance instance = new TcustPersonBalance(); + instance.setPk(new TcustPersonBalanceKey()); + return instance; + } + + /** + * Clona la entidad TcustPersonBalance + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustPersonBalance p = (TcustPersonBalance) this.clone(); + p.setPk((TcustPersonBalanceKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustPersonBalanceKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustPersonBalanceKey.java.svn-base new file mode 100644 index 0000000..88dbea1 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/.svn/text-base/TcustPersonBalanceKey.java.svn-base @@ -0,0 +1,211 @@ +package com.fp.persistence.pcustomer.balance; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPERSONBALANCE*/ +@Embeddable +public class TcustPersonBalanceKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="BALANCEDATE", nullable=false,updatable=false) + +/** +* Fecha de balance +*/ +private Date balancedate; + +@Column(name="BALANCECATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String balancecatalog; + +@Column(name="BALANCECATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String balancecatalogcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TcustPersonBalanceKey(){} +/**Contructor de TcustPersonBalanceKey +@param pPersoncode Codigo de persona +@param pBalancedate Fecha de balance +@param pBalancecatalog Codigo de catalogo 01 Natural, 02 Juridico +@param pBalancecatalogcode Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +@param pDateto Fecha hasta la cual esta vigente el registro +*/ +public TcustPersonBalanceKey(Integer pPersoncode,Date pBalancedate,String pBalancecatalog,String pBalancecatalogcode,Timestamp pDateto){ + personcode=pPersoncode; + balancedate=pBalancedate; + balancecatalog=pBalancecatalog; + balancecatalogcode=pBalancecatalogcode; + dateto=pDateto; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de balancedate +@return valor de balancedate*/ +public Date getBalancedate(){ + return balancedate; +} +/**Fija el valor de balancedate +@param pBalancedate nuevo Valor de balancedate*/ +public void setBalancedate(Date pBalancedate){ + balancedate=pBalancedate; +} + +/**Obtiene el valor de balancecatalog +@return valor de balancecatalog*/ +public String getBalancecatalog(){ + return balancecatalog; +} +/**Fija el valor de balancecatalog +@param pBalancecatalog nuevo Valor de balancecatalog*/ +public void setBalancecatalog(String pBalancecatalog){ + balancecatalog=pBalancecatalog; +} + +/**Obtiene el valor de balancecatalogcode +@return valor de balancecatalogcode*/ +public String getBalancecatalogcode(){ + return balancecatalogcode; +} +/**Fija el valor de balancecatalogcode +@param pBalancecatalogcode nuevo Valor de balancecatalogcode*/ +public void setBalancecatalogcode(String pBalancecatalogcode){ + balancecatalogcode=pBalancecatalogcode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementación de la comparación de TcustPersonBalanceKey +@param o Objeto de comparación +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPersonBalanceKey))return false; + TcustPersonBalanceKey that = (TcustPersonBalanceKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getBalancedate() == null || that.getBalancedate() == null){ + return false; + } + if (! this.getBalancedate().equals(that.getBalancedate())){ + return false; + } + if (this.getBalancecatalog() == null || that.getBalancecatalog() == null){ + return false; + } + if (! this.getBalancecatalog().equals(that.getBalancecatalog())){ + return false; + } + if (this.getBalancecatalogcode() == null || that.getBalancecatalogcode() == null){ + return false; + } + if (! this.getBalancecatalogcode().equals(that.getBalancecatalogcode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementación del método hashCode bajo el patrón de Bloch +@return hashCode de la instancia TcustPersonBalanceKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getBalancedate() == null ? 0 : this.getBalancedate().hashCode()); + result = result * 37 + (this.getBalancecatalog() == null ? 0 : this.getBalancecatalog().hashCode()); + result = result * 37 + (this.getBalancecatalogcode() == null ? 0 : this.getBalancecatalogcode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementación toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustBalance.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustBalance.java new file mode 100644 index 0000000..0b3e871 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustBalance.java @@ -0,0 +1,122 @@ +package com.fp.persistence.pcustomer.balance; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTBALANCE*/ +@Entity(name="TcustBalance") +@Table(name="TCUSTBALANCE") +public class TcustBalance extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TcustBalance +*/ +@EmbeddedId +private TcustBalanceKey pk; +/**Contructor por defecto*/ +public TcustBalance(){ +} +/**Contructor de TcustBalance +@param pPk Clave Primaria del entity +*/ +public TcustBalance(TcustBalanceKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TcustBalance +*/ +public static TcustBalance find(EntityManager pEntityManager,TcustBalanceKey pKey) throws Exception{ + TcustBalance obj = pEntityManager.find(TcustBalance.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TcustBalance +@return El objeto que referencia a la Clave primaria de TcustBalance +*/ +public TcustBalanceKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TcustBalance +@param pPk El objeto que referencia a la nueva Clave primaria de TcustBalance +*/ +public void setPk(TcustBalanceKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TcustBalance))return false; + TcustBalance that = (TcustBalance) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TcustBalance +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TcustBalance +*/ +public Object createInstance(){ + TcustBalance instance=new TcustBalance(); + instance.setPk(new TcustBalanceKey()); + return instance; +} +/**Clona la entidad TcustBalance +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TcustBalance p=(TcustBalance)this.clone(); + p.setPk((TcustBalanceKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustBalanceAccoLevel.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustBalanceAccoLevel.java new file mode 100644 index 0000000..3aadace --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustBalanceAccoLevel.java @@ -0,0 +1,158 @@ +package com.fp.persistence.pcustomer.balance; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTBALANCEACCOLEVEL*/ +@Entity(name="TcustBalanceAccoLevel") +@Table(name="TCUSTBALANCEACCOLEVEL") +public class TcustBalanceAccoLevel extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TcustBalanceAccoLevel +*/ +@Id +@Column(name="ACCOLEVELCODE" ,nullable=false, updatable=false) +private Integer pk; +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion del nivel de cuenta de balance +*/ +private String description; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking del registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TcustBalanceAccoLevel(){ +} +/**Contructor de TcustBalanceAccoLevel +@param pPk Clave Primaria del entity +*/ +public TcustBalanceAccoLevel(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TcustBalanceAccoLevel +*/ +public static TcustBalanceAccoLevel find(EntityManager pEntityManager,Object pKey) throws Exception{ + TcustBalanceAccoLevel obj = pEntityManager.find(TcustBalanceAccoLevel.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TcustBalanceAccoLevel +@return El objeto que referencia a la Clave primaria de TcustBalanceAccoLevel +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TcustBalanceAccoLevel +@param pPk El objeto que referencia a la nueva Clave primaria de TcustBalanceAccoLevel +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TcustBalanceAccoLevel))return false; + TcustBalanceAccoLevel that = (TcustBalanceAccoLevel) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TcustBalanceAccoLevel +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TcustBalanceAccoLevel +*/ +public Object createInstance(){ + TcustBalanceAccoLevel instance=new TcustBalanceAccoLevel(); + return instance; +} +/**Clona la entidad TcustBalanceAccoLevel +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TcustBalanceAccoLevel p=(TcustBalanceAccoLevel)this.clone(); + return p; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustBalanceAccount.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustBalanceAccount.java new file mode 100644 index 0000000..47adf4e --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustBalanceAccount.java @@ -0,0 +1,305 @@ +package com.fp.persistence.pcustomer.balance; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTBALANCEACCOUNT*/ +@Entity(name = "TcustBalanceAccount") +@Table(name = "TCUSTBALANCEACCOUNT") +public class TcustBalanceAccount extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustBalanceAccount + */ + @EmbeddedId + private TcustBalanceAccountKey pk; + @Column(name = "ACCOLEVELCODE", nullable = true) + /** + * Codigo de nivel de cuenta de balance + */ + private Integer accolevelcode; + @Column(name = "ACCOUNTCATALOG", nullable = true) + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String accountcatalog; + @Column(name = "ACCOUNTCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String accountcatalogcode; + @Column(name = "DESCRIPTION", nullable = true) + /** + * Descripcion de la cuenta de balance + */ + private String description; + @Column(name = "SIGNACCOUNT", nullable = true) + /** + * S lleva signo la cuenta, N no lleva signo + */ + private String signaccount; + @Column(name = "SIGNVALUE", nullable = true) + /** + * Signo de la cuenta de balnace + */ + private String signvalue; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Manejo de optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "PARAMETERFILE", nullable = true) + /** + * null + */ + private String parameterfile; + + /**Contructor por defecto*/ + public TcustBalanceAccount() { + } + + /**Contructor de TcustBalanceAccount + @param pPk Clave Primaria del entity + */ + public TcustBalanceAccount(TcustBalanceAccountKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustBalanceAccount + */ + public static TcustBalanceAccount find(EntityManager pEntityManager, TcustBalanceAccountKey pKey) throws Exception { + TcustBalanceAccount obj = pEntityManager.find(TcustBalanceAccount.class, pKey); + return obj; + } + + /**Entrega la Clave primaria de TcustBalanceAccount + @return El objeto que referencia a la Clave primaria de TcustBalanceAccount + */ + public TcustBalanceAccountKey getPk() { + return pk; + } + + /**Fija un nuevo valor a la Clave primaria de TcustBalanceAccount + @param pPk El objeto que referencia a la nueva Clave primaria de TcustBalanceAccount + */ + public void setPk(TcustBalanceAccountKey pPk) { + pk = pPk; + } + + /**Obtiene el valor de accolevelcode + @return valor de accolevelcode*/ + public Integer getAccolevelcode() { + return accolevelcode; + } + + /**Fija el valor de accolevelcode + @param pAccolevelcode nuevo Valor de accolevelcode*/ + public void setAccolevelcode(Integer pAccolevelcode) { + accolevelcode = pAccolevelcode; + } + + /**Obtiene el valor de accountcatalog + @return valor de accountcatalog*/ + public String getAccountcatalog() { + return accountcatalog; + } + + /**Fija el valor de accountcatalog + @param pAccountcatalog nuevo Valor de accountcatalog*/ + public void setAccountcatalog(String pAccountcatalog) { + accountcatalog = pAccountcatalog; + } + + /**Obtiene el valor de accountcatalogcode + @return valor de accountcatalogcode*/ + public String getAccountcatalogcode() { + return accountcatalogcode; + } + + /**Fija el valor de accountcatalogcode + @param pAccountcatalogcode nuevo Valor de accountcatalogcode*/ + public void setAccountcatalogcode(String pAccountcatalogcode) { + accountcatalogcode = pAccountcatalogcode; + } + + /**Obtiene el valor de description + @return valor de description*/ + public String getDescription() { + return description; + } + + /**Fija el valor de description + @param pDescription nuevo Valor de description*/ + public void setDescription(String pDescription) { + description = pDescription; + } + + /**Obtiene el valor de signaccount + @return valor de signaccount*/ + public String getSignaccount() { + return signaccount; + } + + /**Fija el valor de signaccount + @param pSignaccount nuevo Valor de signaccount*/ + public void setSignaccount(String pSignaccount) { + signaccount = pSignaccount; + } + + /**Obtiene el valor de signvalue + @return valor de signvalue*/ + public String getSignvalue() { + return signvalue; + } + + /**Fija el valor de signvalue + @param pSignvalue nuevo Valor de signvalue*/ + public void setSignvalue(String pSignvalue) { + signvalue = pSignvalue; + } + + /**Obtiene el valor de recordversion + @return valor de recordversion*/ + public Integer getRecordversion() { + return recordversion; + } + + /**Fija el valor de recordversion + @param pRecordversion nuevo Valor de recordversion*/ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /**Obtiene el valor de parameterfile + @return valor de parameterfile*/ + public String getParameterfile() { + return parameterfile; + } + + /**Fija el valor de parameterfile + @param pParameterfile nuevo Valor de parameterfile*/ + public void setParameterfile(String pParameterfile) { + parameterfile = pParameterfile; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustBalanceAccount)) { + return false; + } + TcustBalanceAccount that = (TcustBalanceAccount) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /**Implementacion del metodo hashCode de la la entidad TcustBalanceAccount + @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /**Implementacion toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /**Implementacion de la creacion de un bean en blanco TcustBalanceAccount + */ + public Object createInstance() { + TcustBalanceAccount instance = new TcustBalanceAccount(); + instance.setPk(new TcustBalanceAccountKey()); + return instance; + } + + /**Clona la entidad TcustBalanceAccount + @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustBalanceAccount p = (TcustBalanceAccount) this.clone(); + p.setPk((TcustBalanceAccountKey) this.pk.cloneMe()); + return p; + } + /** + * jpql Que retorna un objeto TcustBalanceAccount a partir de un parametro + * especfico + */ + public static final String JPQL_GET_ACCOUNT_PARAMETER = "from TcustBalanceAccount t where t.parameterfile = :parameter"; + + /** + * Metodo que entrega el Objeto a partir de un campo especfico. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pParameterfile Campo especfico del bean. + * @return + * @throws Exception + */ + public static TcustBalanceAccount findPerParameter(EntityManager pEntityManager, String pParameterfile) throws Exception { + TcustBalanceAccount tcustBalanceAccount = null; + Query qry = pEntityManager.createQuery(JPQL_GET_ACCOUNT_PARAMETER); + qry.setParameter("parameter", pParameterfile); + try { + tcustBalanceAccount = (TcustBalanceAccount) qry.getSingleResult(); + } catch (NoResultException e) { + } + return tcustBalanceAccount; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustBalanceAccountKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustBalanceAccountKey.java new file mode 100644 index 0000000..62bde05 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustBalanceAccountKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pcustomer.balance; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTBALANCEACCOUNT*/ +@Embeddable +public class TcustBalanceAccountKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNTCODE", nullable=false,updatable=false) + +/** +* Codigo de la cuenta de balance +*/ +private String accountcode; + +@Column(name="BALANCECATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String balancecatalog; + +@Column(name="BALANCECATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String balancecatalogcode; + +/**Contructor por defecto*/ +public TcustBalanceAccountKey(){} +/**Contructor de TcustBalanceAccountKey +@param pAccountcode Codigo de la cuenta de balance +@param pBalancecatalog Codigo de catalogo 01 Natural, 02 Juridico +@param pBalancecatalogcode Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +public TcustBalanceAccountKey(String pAccountcode,String pBalancecatalog,String pBalancecatalogcode){ + accountcode=pAccountcode; + balancecatalog=pBalancecatalog; + balancecatalogcode=pBalancecatalogcode; +} +/**Obtiene el valor de accountcode +@return valor de accountcode*/ +public String getAccountcode(){ + return accountcode; +} +/**Fija el valor de accountcode +@param pAccountcode nuevo Valor de accountcode*/ +public void setAccountcode(String pAccountcode){ + accountcode=pAccountcode; +} + +/**Obtiene el valor de balancecatalog +@return valor de balancecatalog*/ +public String getBalancecatalog(){ + return balancecatalog; +} +/**Fija el valor de balancecatalog +@param pBalancecatalog nuevo Valor de balancecatalog*/ +public void setBalancecatalog(String pBalancecatalog){ + balancecatalog=pBalancecatalog; +} + +/**Obtiene el valor de balancecatalogcode +@return valor de balancecatalogcode*/ +public String getBalancecatalogcode(){ + return balancecatalogcode; +} +/**Fija el valor de balancecatalogcode +@param pBalancecatalogcode nuevo Valor de balancecatalogcode*/ +public void setBalancecatalogcode(String pBalancecatalogcode){ + balancecatalogcode=pBalancecatalogcode; +} + +/**Implementacion de la comparacion de TcustBalanceAccountKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustBalanceAccountKey))return false; + TcustBalanceAccountKey that = (TcustBalanceAccountKey) o; + if (this.getAccountcode() == null || that.getAccountcode() == null){ + return false; + } + if (! this.getAccountcode().equals(that.getAccountcode())){ + return false; + } + if (this.getBalancecatalog() == null || that.getBalancecatalog() == null){ + return false; + } + if (! this.getBalancecatalog().equals(that.getBalancecatalog())){ + return false; + } + if (this.getBalancecatalogcode() == null || that.getBalancecatalogcode() == null){ + return false; + } + if (! this.getBalancecatalogcode().equals(that.getBalancecatalogcode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TcustBalanceAccountKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccountcode() == null ? 0 : this.getAccountcode().hashCode()); + result = result * 37 + (this.getBalancecatalog() == null ? 0 : this.getBalancecatalog().hashCode()); + result = result * 37 + (this.getBalancecatalogcode() == null ? 0 : this.getBalancecatalogcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustBalanceFinancial.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustBalanceFinancial.java new file mode 100644 index 0000000..3dddec8 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustBalanceFinancial.java @@ -0,0 +1,295 @@ +package com.fp.persistence.pcustomer.balance; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTBALANCEFINANCIAL + */ +@Entity(name = "TcustBalanceFinancial") +@Table(name = "TCUSTBALANCEFINANCIAL") +public class TcustBalanceFinancial extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TcustBalanceFinancial + */ + @EmbeddedId + private TcustBalanceFinancialKey pk; + + @Column(name = "VALUEACCOUNT", nullable = true) + /** + * Saldo de la cuenta en el balance + */ + private BigDecimal valueaccount; + + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el registro + */ + private String ingressuser; + + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del registro + */ + private String modifyuser; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + /** + * Contructor por defecto + */ + public TcustBalanceFinancial() { + } + + /** + * Contructor de TcustBalanceFinancial + * + * @param pPk Clave Primaria del entity + */ + public TcustBalanceFinancial(TcustBalanceFinancialKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustBalanceFinancial + */ + public static TcustBalanceFinancial find(EntityManager pEntityManager, TcustBalanceFinancialKey pKey) throws Exception { + TcustBalanceFinancial obj = pEntityManager.find(TcustBalanceFinancial.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustBalanceFinancial + * + * @return El objeto que referencia a la Clave primaria de TcustBalanceFinancial + */ + public TcustBalanceFinancialKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustBalanceFinancial + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TcustBalanceFinancial + */ + public void setPk(TcustBalanceFinancialKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de valueaccount + * + * @return valor de valueaccount + */ + public BigDecimal getValueaccount() { + return this.valueaccount; + } + + /** + * Fija el valor de valueaccount + * + * @param pValueaccount nuevo Valor de valueaccount + */ + public void setValueaccount(BigDecimal pValueaccount) { + this.valueaccount = pValueaccount; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return this.ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + this.ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return this.modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + this.modifyuser = pModifyuser; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustBalanceFinancial)) { + return false; + } + TcustBalanceFinancial that = (TcustBalanceFinancial) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementación del metodo hashCode de la la entidad TcustBalanceFinancial + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementación toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementación de la creación de un bean en blanco TcustBalanceFinancial + */ + @Override + public Object createInstance() { + TcustBalanceFinancial instance = new TcustBalanceFinancial(); + instance.setPk(new TcustBalanceFinancialKey()); + return instance; + } + + /** + * Clona la entidad TcustBalanceFinancial + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustBalanceFinancial p = (TcustBalanceFinancial) this.clone(); + p.setPk((TcustBalanceFinancialKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustBalanceFinancialKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustBalanceFinancialKey.java new file mode 100644 index 0000000..572f211 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustBalanceFinancialKey.java @@ -0,0 +1,238 @@ +package com.fp.persistence.pcustomer.balance; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TCUSTBALANCEFINANCIAL*/ +@Embeddable +public class TcustBalanceFinancialKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="ACCOUNTCODE", nullable=false,updatable=false) + +/** +* Codigo de la cuenta de balance +*/ +private String accountcode; + +@Column(name="BALANCECATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String balancecatalog; + +@Column(name="BALANCECATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String balancecatalogcode; + +@Column(name="BALANCEDATE", nullable=false,updatable=false) + +/** +* Fecha de balance +*/ +private Date balancedate; + +/**Contructor por defecto*/ +public TcustBalanceFinancialKey(){} +/**Contructor de TcustBalanceFinancialKey +@param pDateto Fecha hasta la cual esta vigente el registro +@param pPersoncode Codigo de persona +@param pAccountcode Codigo de la cuenta de balance +@param pBalancecatalog Codigo de catalogo 01 Natural, 02 Juridico +@param pBalancecatalogcode Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +@param pBalancedate Fecha de balance +*/ +public TcustBalanceFinancialKey(Timestamp pDateto,Integer pPersoncode,String pAccountcode,String pBalancecatalog,String pBalancecatalogcode,Date pBalancedate){ + dateto=pDateto; + personcode=pPersoncode; + accountcode=pAccountcode; + balancecatalog=pBalancecatalog; + balancecatalogcode=pBalancecatalogcode; + balancedate=pBalancedate; +} +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de accountcode +@return valor de accountcode*/ +public String getAccountcode(){ + return accountcode; +} +/**Fija el valor de accountcode +@param pAccountcode nuevo Valor de accountcode*/ +public void setAccountcode(String pAccountcode){ + accountcode=pAccountcode; +} + +/**Obtiene el valor de balancecatalog +@return valor de balancecatalog*/ +public String getBalancecatalog(){ + return balancecatalog; +} +/**Fija el valor de balancecatalog +@param pBalancecatalog nuevo Valor de balancecatalog*/ +public void setBalancecatalog(String pBalancecatalog){ + balancecatalog=pBalancecatalog; +} + +/**Obtiene el valor de balancecatalogcode +@return valor de balancecatalogcode*/ +public String getBalancecatalogcode(){ + return balancecatalogcode; +} +/**Fija el valor de balancecatalogcode +@param pBalancecatalogcode nuevo Valor de balancecatalogcode*/ +public void setBalancecatalogcode(String pBalancecatalogcode){ + balancecatalogcode=pBalancecatalogcode; +} + +/**Obtiene el valor de balancedate +@return valor de balancedate*/ +public Date getBalancedate(){ + return balancedate; +} +/**Fija el valor de balancedate +@param pBalancedate nuevo Valor de balancedate*/ +public void setBalancedate(Date pBalancedate){ + balancedate=pBalancedate; +} + +/**Implementación de la comparación de TcustBalanceFinancialKey +@param o Objeto de comparación +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustBalanceFinancialKey))return false; + TcustBalanceFinancialKey that = (TcustBalanceFinancialKey) o; + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getAccountcode() == null || that.getAccountcode() == null){ + return false; + } + if (! this.getAccountcode().equals(that.getAccountcode())){ + return false; + } + if (this.getBalancecatalog() == null || that.getBalancecatalog() == null){ + return false; + } + if (! this.getBalancecatalog().equals(that.getBalancecatalog())){ + return false; + } + if (this.getBalancecatalogcode() == null || that.getBalancecatalogcode() == null){ + return false; + } + if (! this.getBalancecatalogcode().equals(that.getBalancecatalogcode())){ + return false; + } + if (this.getBalancedate() == null || that.getBalancedate() == null){ + return false; + } + if (! this.getBalancedate().equals(that.getBalancedate())){ + return false; + } + return true; +} +/**Implementación del método hashCode bajo el patrón de Bloch +@return hashCode de la instancia TcustBalanceFinancialKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getAccountcode() == null ? 0 : this.getAccountcode().hashCode()); + result = result * 37 + (this.getBalancecatalog() == null ? 0 : this.getBalancecatalog().hashCode()); + result = result * 37 + (this.getBalancecatalogcode() == null ? 0 : this.getBalancecatalogcode().hashCode()); + result = result * 37 + (this.getBalancedate() == null ? 0 : this.getBalancedate().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementación toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustBalanceKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustBalanceKey.java new file mode 100644 index 0000000..f3b7d65 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustBalanceKey.java @@ -0,0 +1,125 @@ +package com.fp.persistence.pcustomer.balance; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TCUSTBALANCE*/ +@Embeddable +public class TcustBalanceKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="BALANCEDATE", nullable=false,updatable=false) + +/** +* Fecha de balance financiero +*/ +private Date balancedate; + +/**Contructor por defecto*/ +public TcustBalanceKey(){} +/**Contructor de TcustBalanceKey +@param pPersoncode Codigo de persona +@param pBalancedate Fecha de balance financiero +*/ +public TcustBalanceKey(Integer pPersoncode,Date pBalancedate){ + personcode=pPersoncode; + balancedate=pBalancedate; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de balancedate +@return valor de balancedate*/ +public Date getBalancedate(){ + return balancedate; +} +/**Fija el valor de balancedate +@param pBalancedate nuevo Valor de balancedate*/ +public void setBalancedate(Date pBalancedate){ + balancedate=pBalancedate; +} + +/**Implementacin de la comparacin de TcustBalanceKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustBalanceKey))return false; + TcustBalanceKey that = (TcustBalanceKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getBalancedate() == null || that.getBalancedate() == null){ + return false; + } + if (! this.getBalancedate().equals(that.getBalancedate())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustBalanceKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getBalancedate() == null ? 0 : this.getBalancedate().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustPersonBalance.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustPersonBalance.java new file mode 100644 index 0000000..0e0646b --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustPersonBalance.java @@ -0,0 +1,379 @@ +package com.fp.persistence.pcustomer.balance; + +import java.sql.Timestamp; +import com.fp.dto.hb.Log; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import javax.persistence.Entity; +import javax.persistence.EmbeddedId; +import com.fp.dto.hb.Cache; +import javax.persistence.EntityManager; +import javax.persistence.Column; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTPERSONBALANCE + */ +@Entity(name = "TcustPersonBalance") +@Table(name = "TCUSTPERSONBALANCE") +public class TcustPersonBalance extends com.fp.dto.AbstractDataTransport + implements Serializable, HibernateBean, Cloneable, Cache, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustPersonBalance + */ + @EmbeddedId + private TcustPersonBalanceKey pk; + @Column(name = "STATUSCATALOG", nullable = true) + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String statuscatalog; + @Column(name = "STATUSCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String statuscatalogcode; + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + @Column(name = "COMPANYCODE", nullable = true) + /** + * Codigo de compania + */ + private Integer companycode; + @Column(name = "CODE", nullable = true) + /** + * Codigo de imagen. + */ + private Integer code; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el registro + */ + private String ingressuser; + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del registro + */ + private String modifyuser; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + /** + * Contructor por defecto + */ + public TcustPersonBalance() { + } + + /** + * Contructor de TcustPersonBalance + * + * @param pPk Clave Primaria del entity + */ + public TcustPersonBalance(TcustPersonBalanceKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPersonBalance + */ + public static TcustPersonBalance find(EntityManager pEntityManager, TcustPersonBalanceKey pKey) throws Exception { + TcustPersonBalance obj = pEntityManager.find(TcustPersonBalance.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPersonBalance + * + * @return El objeto que referencia a la Clave primaria de + * TcustPersonBalance + */ + public TcustPersonBalanceKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPersonBalance + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustPersonBalance + */ + public void setPk(TcustPersonBalanceKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de statuscatalog + * + * @return valor de statuscatalog + */ + public String getStatuscatalog() { + return statuscatalog; + } + + /** + * Fija el valor de statuscatalog + * + * @param pStatuscatalog nuevo Valor de statuscatalog + */ + public void setStatuscatalog(String pStatuscatalog) { + statuscatalog = pStatuscatalog; + } + + /** + * Obtiene el valor de statuscatalogcode + * + * @return valor de statuscatalogcode + */ + public String getStatuscatalogcode() { + return statuscatalogcode; + } + + /** + * Fija el valor de statuscatalogcode + * + * @param pStatuscatalogcode nuevo Valor de statuscatalogcode + */ + public void setStatuscatalogcode(String pStatuscatalogcode) { + statuscatalogcode = pStatuscatalogcode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de companycode + * + * @return valor de companycode + */ + public Integer getCompanycode() { + return companycode; + } + + /** + * Fija el valor de companycode + * + * @param pCompanycode nuevo Valor de companycode + */ + public void setCompanycode(Integer pCompanycode) { + companycode = pCompanycode; + } + + /** + * Obtiene el valor de code + * + * @return valor de code + */ + public Integer getCode() { + return code; + } + + /** + * Fija el valor de code + * + * @param pCode nuevo Valor de code + */ + public void setCode(Integer pCode) { + code = pCode; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + datefrom = pDatefrom; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + modifyuser = pModifyuser; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPersonBalance)) { + return false; + } + TcustPersonBalance that = (TcustPersonBalance) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementación del metodo hashCode de la la entidad TcustPersonBalance + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementación toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementación de la creación de un bean en blanco TcustPersonBalance + */ + public Object createInstance() { + TcustPersonBalance instance = new TcustPersonBalance(); + instance.setPk(new TcustPersonBalanceKey()); + return instance; + } + + /** + * Clona la entidad TcustPersonBalance + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustPersonBalance p = (TcustPersonBalance) this.clone(); + p.setPk((TcustPersonBalanceKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustPersonBalanceKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustPersonBalanceKey.java new file mode 100644 index 0000000..88dbea1 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/balance/TcustPersonBalanceKey.java @@ -0,0 +1,211 @@ +package com.fp.persistence.pcustomer.balance; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPERSONBALANCE*/ +@Embeddable +public class TcustPersonBalanceKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="BALANCEDATE", nullable=false,updatable=false) + +/** +* Fecha de balance +*/ +private Date balancedate; + +@Column(name="BALANCECATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String balancecatalog; + +@Column(name="BALANCECATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String balancecatalogcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TcustPersonBalanceKey(){} +/**Contructor de TcustPersonBalanceKey +@param pPersoncode Codigo de persona +@param pBalancedate Fecha de balance +@param pBalancecatalog Codigo de catalogo 01 Natural, 02 Juridico +@param pBalancecatalogcode Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +@param pDateto Fecha hasta la cual esta vigente el registro +*/ +public TcustPersonBalanceKey(Integer pPersoncode,Date pBalancedate,String pBalancecatalog,String pBalancecatalogcode,Timestamp pDateto){ + personcode=pPersoncode; + balancedate=pBalancedate; + balancecatalog=pBalancecatalog; + balancecatalogcode=pBalancecatalogcode; + dateto=pDateto; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de balancedate +@return valor de balancedate*/ +public Date getBalancedate(){ + return balancedate; +} +/**Fija el valor de balancedate +@param pBalancedate nuevo Valor de balancedate*/ +public void setBalancedate(Date pBalancedate){ + balancedate=pBalancedate; +} + +/**Obtiene el valor de balancecatalog +@return valor de balancecatalog*/ +public String getBalancecatalog(){ + return balancecatalog; +} +/**Fija el valor de balancecatalog +@param pBalancecatalog nuevo Valor de balancecatalog*/ +public void setBalancecatalog(String pBalancecatalog){ + balancecatalog=pBalancecatalog; +} + +/**Obtiene el valor de balancecatalogcode +@return valor de balancecatalogcode*/ +public String getBalancecatalogcode(){ + return balancecatalogcode; +} +/**Fija el valor de balancecatalogcode +@param pBalancecatalogcode nuevo Valor de balancecatalogcode*/ +public void setBalancecatalogcode(String pBalancecatalogcode){ + balancecatalogcode=pBalancecatalogcode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementación de la comparación de TcustPersonBalanceKey +@param o Objeto de comparación +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPersonBalanceKey))return false; + TcustPersonBalanceKey that = (TcustPersonBalanceKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getBalancedate() == null || that.getBalancedate() == null){ + return false; + } + if (! this.getBalancedate().equals(that.getBalancedate())){ + return false; + } + if (this.getBalancecatalog() == null || that.getBalancecatalog() == null){ + return false; + } + if (! this.getBalancecatalog().equals(that.getBalancecatalog())){ + return false; + } + if (this.getBalancecatalogcode() == null || that.getBalancecatalogcode() == null){ + return false; + } + if (! this.getBalancecatalogcode().equals(that.getBalancecatalogcode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementación del método hashCode bajo el patrón de Bloch +@return hashCode de la instancia TcustPersonBalanceKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getBalancedate() == null ? 0 : this.getBalancedate().hashCode()); + result = result * 37 + (this.getBalancecatalog() == null ? 0 : this.getBalancecatalog().hashCode()); + result = result * 37 + (this.getBalancecatalogcode() == null ? 0 : this.getBalancecatalogcode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementación toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/entries b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/entries new file mode 100644 index 0000000..9236ecc --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/entries @@ -0,0 +1,912 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company +svn://172.17.26.185/COMACO + + + +2014-11-11T07:08:22.962666Z +2603 +ogarcia + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TcustCompanyClientKey.java +file + + + + +2022-07-28T03:40:25.300728Z +81659d04ae4f372d19b09bf683753b59 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4461 + +TcustFamiliarlLink.java +file + + + + +2022-07-28T03:40:25.300728Z +5d83dacb02e07d9b4f5d6de9b55fee88 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +10188 + +TcustCompanyKey.java +file + + + + +2022-07-28T03:40:25.300728Z +d9126540f34547425c59203922133771 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3508 + +TcustCompanyProvider.java +file + + + + +2022-07-28T03:40:25.301728Z +ae9d0cd78881b301dfd18bcd7d2d2da6 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +13481 + +TcustFinancialInstitutions.java +file + + + + +2022-07-28T03:40:25.301728Z +d0ddafefe3547dedbd96ce51935a10b1 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4846 + +TcustSupervisor.java +file + + + + +2022-07-28T03:40:25.301728Z +d0441e3265f42e52b8ab72b0da991975 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5211 + +TcustEconomicGroupKey.java +file + + + + +2022-07-28T03:40:25.301728Z +3d56a2c7c26a1e170e450abc15bd9037 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4396 + +TcustCompanyManagers.java +file + + + + +2022-07-28T03:40:25.302728Z +f5c78df572f4d8c3d2726073822c26e5 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +12166 + +TcustCompanyFinancialKey.java +file + + + + +2022-07-28T03:40:25.302728Z +a20a4444571a07512d1ca79e71a437e7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3596 + +TcustCompanyBranch.java +file + + + + +2022-07-28T03:40:25.302728Z +76542d92bbc29e93bdb4889d73cc861e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9040 + +TcustAppraiser.java +file + + + + +2022-07-28T03:40:25.302728Z +845b1fc37f2c2210c2d2cf39bcdb670b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4613 + +TcustFamiliarlLinkKey.java +file + + + + +2022-07-28T03:40:25.303728Z +3b32b9d536ab1662e201b1a93bea9d0a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3577 + +TcustInsurance.java +file + + + + +2022-07-28T03:40:25.303728Z +df7cfd7e9a66ae3aef5528980c988a08 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4510 + +TcustNotaryOffice.java +file + + + + +2022-07-28T03:40:25.303728Z +5e69f6b1cddf067d67959755c5e10a27 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4588 + +TcustCompanyProducts.java +file + + + + +2022-07-28T03:40:25.303728Z +cccf04100adf64f64f41a26f9fc62b57 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +11818 + +TcustCompanyProviderKey.java +file + + + + +2022-07-28T03:40:25.304728Z +27ae2f7c5bedefde0e64c576a9453d01 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4531 + +TcustCompanyManagersKey.java +file + + + + +2022-07-28T03:40:25.304728Z +cd590c279283feb66aefa13f29561505 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6542 + +TcustCompanyBranchKey.java +file + + + + +2022-07-28T03:40:25.304728Z +be6d0e899e7500f4ddd98716687cfa79 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4465 + +TcustAppraiserKey.java +file + + + + +2022-07-28T03:40:25.305728Z +6d922b53515e1bf1c47550379ed202d1 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3470 + +TcustLegalLink.java +file + + + + +2022-07-28T03:40:25.305728Z +abc733cef10742884f5d48b1daad8a29 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9106 + +TcustCompanyProductsKey.java +file + + + + +2022-07-28T03:40:25.305728Z +edba6d4bbe0a0c2d68731665ad9a87a5 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4508 + +TcustCompanyClient.java +file + + + + +2022-07-28T03:40:25.305728Z +00b258744e08eef83052593f8d048799 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +13304 + +TcustCompany.java +file + + + + +2022-07-28T03:40:25.306728Z +297ec278ae4b70dfb5cfed4dcf12699f +2014-11-11T07:08:22.962666Z +2603 +ogarcia + + + + + + + + + + + + + + + + + + + + + +19533 + +TcustEconomicGroup.java +file + + + + +2022-07-28T03:40:25.306728Z +6e38db2ce8ba6116d26bb85f5d7612f0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7043 + +TcustCompanyFinancial.java +file + + + + +2022-07-28T03:40:25.306728Z +2eb61535fe467c801616d17cf029e629 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +17596 + +TcustLegalLinkKey.java +file + + + + +2022-07-28T03:40:25.307728Z +bbe5cea658b8d01a3c4fd22000073101 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5028 + diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustAppraiser.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustAppraiser.java.svn-base new file mode 100644 index 0000000..40a312a --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustAppraiser.java.svn-base @@ -0,0 +1,162 @@ +package com.fp.persistence.pcustomer.company; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import com.fp.dto.hb.Log; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTAPPRAISER + */ +@Entity(name = "TcustAppraiser") +@Table(name = "TCUSTAPPRAISER") +public class TcustAppraiser extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustAppraiser + */ + @EmbeddedId + private TcustAppraiserKey pk; + + /** + * Contructor por defecto + */ + public TcustAppraiser() { + } + + /** + * Contructor de TcustAppraiser + * + * @param pPk Clave Primaria del entity + */ + public TcustAppraiser(TcustAppraiserKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustAppraiser + */ + public static TcustAppraiser find(EntityManager pEntityManager, TcustAppraiserKey pKey) throws Exception { + TcustAppraiser obj = pEntityManager.find(TcustAppraiser.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustAppraiser + * + * @return El objeto que referencia a la Clave primaria de TcustAppraiser + */ + public TcustAppraiserKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustAppraiser + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustAppraiser + */ + public void setPk(TcustAppraiserKey pPk) { + pk = pPk; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustAppraiser)) { + return false; + } + TcustAppraiser that = (TcustAppraiser) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TcustAppraiser + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco TcustAppraiser + */ + public Object createInstance() { + TcustAppraiser instance = new TcustAppraiser(); + instance.setPk(new TcustAppraiserKey()); + return instance; + } + + /** + * Clona la entidad TcustAppraiser + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustAppraiser p = (TcustAppraiser) this.clone(); + p.setPk((TcustAppraiserKey) this.pk.cloneMe()); + return p; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustAppraiserKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustAppraiserKey.java.svn-base new file mode 100644 index 0000000..91dc3f0 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustAppraiserKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pcustomer.company; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTAPPRAISER*/ +@Embeddable +public class TcustAppraiserKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TcustAppraiserKey(){} +/**Contructor de TcustAppraiserKey +@param pPersoncode Codigo de persona +@param pCompanycode Codigo de compania +*/ +public TcustAppraiserKey(Integer pPersoncode,Integer pCompanycode){ + personcode=pPersoncode; + companycode=pCompanycode; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacin de la comparacin de TcustAppraiserKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustAppraiserKey))return false; + TcustAppraiserKey that = (TcustAppraiserKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustAppraiserKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompany.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompany.java.svn-base new file mode 100644 index 0000000..60419a3 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompany.java.svn-base @@ -0,0 +1,726 @@ +package com.fp.persistence.pcustomer.company; + +import java.sql.Timestamp; +import java.io.Serializable; +import javax.persistence.Table; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; +import javax.persistence.Version; +import javax.persistence.Entity; +import javax.persistence.EmbeddedId; +import javax.persistence.EntityManager; +import javax.persistence.Column; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTCOMPANY + */ +@Entity(name = "TcustCompany") +@Table(name = "TCUSTCOMPANY") +public class TcustCompany extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustCompany + */ + @EmbeddedId + private TcustCompanyKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro. + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro. + */ + private Integer recordversion; + @Column(name = "BUSINESSTYPECATALOG", nullable = true) + /** + * Codigo de catalogo de tipo de empresa, 1 Con fines de lucro, 2 Sin fines + * de lucro + */ + private String businesstypecatalog; + @Column(name = "BUSINESSTYPECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo de tipo de empresa BUSINESSTYPE + */ + private String businesstypecatalogcode; + @Column(name = "BUSINESSCLASSCATALOG", nullable = true) + /** + * Codigo de catalogo de clase de empresa 1, Pequenia, 2 Mediana + */ + private String businessclasscatalog; + @Column(name = "BUSINESSCLASSCATALOGCODE", nullable = true) + /** + * Codigo de catalogo de clase de empresa BUSINESSCLASS + */ + private String businessclasscatalogcode; + @Column(name = "INSTITUTIONTYPECATALOG", nullable = true) + /** + * Codigo de catalogo de tipo de institucion, 1 banco, 2 cooperativa, 3 + * grupo solidario + */ + private String institutiontypecatalog; + @Column(name = "INSTITUTIONTYPECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo de tipo de institucion INSTITUTIONTYPE + */ + private String institutiontypecatalogcode; + @Column(name = "OPERATIVESTATUSCATALOG", nullable = true) + /** + * Codigo de catalogo 1 Disuelto, 2 Suspendido, 3 Vigente + */ + private String operativestatuscatalog; + @Column(name = "OPERATIVESTATUSCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo OPERATIVESTATUS estatus operativo + */ + private String operativestatuscatalogcode; + @Column(name = "COMMERCIALREGISTER", nullable = true) + /** + * Numero de registro mercantil. + */ + private String commercialregister; + @Column(name = "EMPLOYERCODE", nullable = true) + /** + * Codigo de empleador + */ + private String employercode; + @Column(name = "CONSTITUTIONDATE", nullable = true) + /** + * Fecha de constitucion. + */ + private Date constitutiondate; + @Column(name = "EXPIRATIONDATE", nullable = true) + /** + * Fecha de vencimiento de la compania. + */ + private Date expirationdate; + @Column(name = "EMPLOYEENUMBER", nullable = true) + /** + * Numero de empleados + */ + private Integer employeenumber; + @Column(name = "NOMINALCAPITAL", nullable = true) + /** + * Capittal nominal. + */ + private BigDecimal nominalcapital; + @Column(name = "ORIGINALCAPITAL", nullable = true) + /** + * Capital original. + */ + private BigDecimal originalcapital; + @Column(name = "CONTRIBUTEDCAPITAL", nullable = true) + /** + * Capital suscrito + */ + private BigDecimal contributedcapital; + @Column(name = "CORPORATEPURPOSE", nullable = true) + /** + * Proposito general de la empresa. + */ + private String corporatepurpose; + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el cliente + */ + private String ingressuser; + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del cliente + */ + private String modifyuser; + @Column(name = "MEMBERSNUMBER", nullable = true) + /** + * Numero de socios + */ + private Integer membersnumber; + @Column(name = "LOGO", nullable = true) + /** + * Codigo de imagen + */ + private Integer logo; + + @Column(name = "PICTURE", nullable = true) + /** + * Imagen + */ + private byte[] picture; + + /** + * Contructor por defecto + */ + public TcustCompany() { + } + + /** + * Contructor de TcustCompany + * + * @param pPk Clave Primaria del entity + */ + public TcustCompany(TcustCompanyKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustCompany + */ + public static TcustCompany find(EntityManager pEntityManager, TcustCompanyKey pKey) throws Exception { + TcustCompany obj = pEntityManager.find(TcustCompany.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustCompany + * + * @return El objeto que referencia a la Clave primaria de TcustCompany + */ + public TcustCompanyKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustCompany + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustCompany + */ + public void setPk(TcustCompanyKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de businesstypecatalog + * + * @return valor de businesstypecatalog + */ + public String getBusinesstypecatalog() { + return businesstypecatalog; + } + + /** + * Fija el valor de businesstypecatalog + * + * @param pBusinesstypecatalog nuevo Valor de businesstypecatalog + */ + public void setBusinesstypecatalog(String pBusinesstypecatalog) { + businesstypecatalog = pBusinesstypecatalog; + } + + /** + * Obtiene el valor de businesstypecatalogcode + * + * @return valor de businesstypecatalogcode + */ + public String getBusinesstypecatalogcode() { + return businesstypecatalogcode; + } + + /** + * Fija el valor de businesstypecatalogcode + * + * @param pBusinesstypecatalogcode nuevo Valor de businesstypecatalogcode + */ + public void setBusinesstypecatalogcode(String pBusinesstypecatalogcode) { + businesstypecatalogcode = pBusinesstypecatalogcode; + } + + /** + * Obtiene el valor de businessclasscatalog + * + * @return valor de businessclasscatalog + */ + public String getBusinessclasscatalog() { + return businessclasscatalog; + } + + /** + * Fija el valor de businessclasscatalog + * + * @param pBusinessclasscatalog nuevo Valor de businessclasscatalog + */ + public void setBusinessclasscatalog(String pBusinessclasscatalog) { + businessclasscatalog = pBusinessclasscatalog; + } + + /** + * Obtiene el valor de businessclasscatalogcode + * + * @return valor de businessclasscatalogcode + */ + public String getBusinessclasscatalogcode() { + return businessclasscatalogcode; + } + + /** + * Fija el valor de businessclasscatalogcode + * + * @param pBusinessclasscatalogcode nuevo Valor de businessclasscatalogcode + */ + public void setBusinessclasscatalogcode(String pBusinessclasscatalogcode) { + businessclasscatalogcode = pBusinessclasscatalogcode; + } + + /** + * Obtiene el valor de institutiontypecatalog + * + * @return valor de institutiontypecatalog + */ + public String getInstitutiontypecatalog() { + return institutiontypecatalog; + } + + /** + * Fija el valor de institutiontypecatalog + * + * @param pInstitutiontypecatalog nuevo Valor de institutiontypecatalog + */ + public void setInstitutiontypecatalog(String pInstitutiontypecatalog) { + institutiontypecatalog = pInstitutiontypecatalog; + } + + /** + * Obtiene el valor de institutiontypecatalogcode + * + * @return valor de institutiontypecatalogcode + */ + public String getInstitutiontypecatalogcode() { + return institutiontypecatalogcode; + } + + /** + * Fija el valor de institutiontypecatalogcode + * + * @param pInstitutiontypecatalogcode nuevo Valor de + * institutiontypecatalogcode + */ + public void setInstitutiontypecatalogcode(String pInstitutiontypecatalogcode) { + institutiontypecatalogcode = pInstitutiontypecatalogcode; + } + + /** + * Obtiene el valor de operativestatuscatalog + * + * @return valor de operativestatuscatalog + */ + public String getOperativestatuscatalog() { + return operativestatuscatalog; + } + + /** + * Fija el valor de operativestatuscatalog + * + * @param pOperativestatuscatalog nuevo Valor de operativestatuscatalog + */ + public void setOperativestatuscatalog(String pOperativestatuscatalog) { + operativestatuscatalog = pOperativestatuscatalog; + } + + /** + * Obtiene el valor de operativestatuscatalogcode + * + * @return valor de operativestatuscatalogcode + */ + public String getOperativestatuscatalogcode() { + return operativestatuscatalogcode; + } + + /** + * Fija el valor de operativestatuscatalogcode + * + * @param pOperativestatuscatalogcode nuevo Valor de + * operativestatuscatalogcode + */ + public void setOperativestatuscatalogcode(String pOperativestatuscatalogcode) { + operativestatuscatalogcode = pOperativestatuscatalogcode; + } + + /** + * Obtiene el valor de commercialregister + * + * @return valor de commercialregister + */ + public String getCommercialregister() { + return commercialregister; + } + + /** + * Fija el valor de commercialregister + * + * @param pCommercialregister nuevo Valor de commercialregister + */ + public void setCommercialregister(String pCommercialregister) { + commercialregister = pCommercialregister; + } + + /** + * Obtiene el valor de employercode + * + * @return valor de employercode + */ + public String getEmployercode() { + return employercode; + } + + /** + * Fija el valor de employercode + * + * @param pEmployercode nuevo Valor de employercode + */ + public void setEmployercode(String pEmployercode) { + employercode = pEmployercode; + } + + /** + * Obtiene el valor de constitutiondate + * + * @return valor de constitutiondate + */ + public Date getConstitutiondate() { + return constitutiondate; + } + + /** + * Fija el valor de constitutiondate + * + * @param pConstitutiondate nuevo Valor de constitutiondate + */ + public void setConstitutiondate(Date pConstitutiondate) { + constitutiondate = pConstitutiondate; + } + + /** + * Obtiene el valor de expirationdate + * + * @return valor de expirationdate + */ + public Date getExpirationdate() { + return expirationdate; + } + + /** + * Fija el valor de expirationdate + * + * @param pExpirationdate nuevo Valor de expirationdate + */ + public void setExpirationdate(Date pExpirationdate) { + expirationdate = pExpirationdate; + } + + /** + * Obtiene el valor de employeenumber + * + * @return valor de employeenumber + */ + public Integer getEmployeenumber() { + return employeenumber; + } + + /** + * Fija el valor de employeenumber + * + * @param pEmployeenumber nuevo Valor de employeenumber + */ + public void setEmployeenumber(Integer pEmployeenumber) { + employeenumber = pEmployeenumber; + } + + /** + * Obtiene el valor de nominalcapital + * + * @return valor de nominalcapital + */ + public BigDecimal getNominalcapital() { + return nominalcapital; + } + + /** + * Fija el valor de nominalcapital + * + * @param pNominalcapital nuevo Valor de nominalcapital + */ + public void setNominalcapital(BigDecimal pNominalcapital) { + nominalcapital = pNominalcapital; + } + + /** + * Obtiene el valor de originalcapital + * + * @return valor de originalcapital + */ + public BigDecimal getOriginalcapital() { + return originalcapital; + } + + /** + * Fija el valor de originalcapital + * + * @param pOriginalcapital nuevo Valor de originalcapital + */ + public void setOriginalcapital(BigDecimal pOriginalcapital) { + originalcapital = pOriginalcapital; + } + + /** + * Obtiene el valor de contributedcapital + * + * @return valor de contributedcapital + */ + public BigDecimal getContributedcapital() { + return contributedcapital; + } + + /** + * Fija el valor de contributedcapital + * + * @param pContributedcapital nuevo Valor de contributedcapital + */ + public void setContributedcapital(BigDecimal pContributedcapital) { + contributedcapital = pContributedcapital; + } + + /** + * Obtiene el valor de corporatepurpose + * + * @return valor de corporatepurpose + */ + public String getCorporatepurpose() { + return corporatepurpose; + } + + /** + * Fija el valor de corporatepurpose + * + * @param pCorporatepurpose nuevo Valor de corporatepurpose + */ + public void setCorporatepurpose(String pCorporatepurpose) { + corporatepurpose = pCorporatepurpose; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + modifyuser = pModifyuser; + } + + /** + * Obtiene el valor de membersnumber + * + * @return valor de membersnumber + */ + public Integer getMembersnumber() { + return membersnumber; + } + + /** + * Fija el valor de membersnumber + * + * @param pMembersnumber nuevo Valor de membersnumber + */ + public void setMembersnumber(Integer pMembersnumber) { + membersnumber = pMembersnumber; + } + + /** + * Obtiene el valor de logo + * + * @return valor de logo + */ + public Integer getLogo() { + return logo; + } + + /** + * Fija el valor de logo + * + * @param pLogo nuevo Valor de logo + */ + public void setLogo(Integer pLogo) { + logo = pLogo; + } + + /** + * Obtiene el valor de la imagen + * @return valor de la imagen + */ + public byte[] getPicture() { + return picture; + } + + /** + * Fija el valor de la imagen + * @param pLogo nuevo Valor de la imagen + */ + public void setPicture(byte[] picture) { + this.picture = picture; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustCompany)) { + return false; + } + TcustCompany that = (TcustCompany) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TcustCompany + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco TcustCompany + */ + public Object createInstance() { + TcustCompany instance = new TcustCompany(); + instance.setPk(new TcustCompanyKey()); + return instance; + } + + /** + * Clona la entidad TcustCompany + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustCompany p = (TcustCompany) this.clone(); + p.setPk((TcustCompanyKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyBranch.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyBranch.java.svn-base new file mode 100644 index 0000000..b919893 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyBranch.java.svn-base @@ -0,0 +1,326 @@ +package com.fp.persistence.pcustomer.company; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTCOMPANYBRANCH + */ +@Entity(name = "TcustCompanyBranch") +@Table(name = "TCUSTCOMPANYBRANCH") +public class TcustCompanyBranch extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustCompanyBranch + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(BRANCHSEQUENCE),0)+1 from TCUSTCOMPANYBRANCH where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "branchsequence")}) + @GeneratedValue(generator = "seq_id") + private TcustCompanyBranchKey pk; + @Column(name = "DATEFROM", nullable = false) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "NAME", nullable = true) + /** + * Nombre de la sucursal y/o oficina de representyacion + */ + private String name; + @Column(name = "ADDRESSNUMBER", nullable = true) + /** + * Numero de direccion asociada a la sucursal + */ + private Integer addressnumber; + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el cliente + */ + private String ingressuser; + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del cliente + */ + private String modifyuser; + + /** + * Contructor por defecto + */ + public TcustCompanyBranch() { + } + + /** + * Contructor de TcustCompanyBranch + * + * @param pPk Clave Primaria del entity + * @param pDatefrom Fecha desde la cual esta vigente el registro + */ + public TcustCompanyBranch(TcustCompanyBranchKey pPk, Timestamp pDatefrom) { + this(); + this.pk = pPk; + this.datefrom = pDatefrom; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustCompanyBranch + */ + public static TcustCompanyBranch find(EntityManager pEntityManager, TcustCompanyBranchKey pKey) throws Exception { + TcustCompanyBranch obj = pEntityManager.find(TcustCompanyBranch.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustCompanyBranch + * + * @return El objeto que referencia a la Clave primaria de + * TcustCompanyBranch + */ + public TcustCompanyBranchKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustCompanyBranch + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustCompanyBranch + */ + public void setPk(TcustCompanyBranchKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de name + * + * @return valor de name + */ + public String getName() { + return this.name; + } + + /** + * Fija el valor de name + * + * @param pName nuevo Valor de name + */ + public void setName(String pName) { + this.name = pName; + } + + /** + * Obtiene el valor de addressnumber + * + * @return valor de addressnumber + */ + public Integer getAddressnumber() { + return this.addressnumber; + } + + /** + * Fija el valor de addressnumber + * + * @param pAddressnumber nuevo Valor de addressnumber + */ + public void setAddressnumber(Integer pAddressnumber) { + this.addressnumber = pAddressnumber; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return this.ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + this.ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return this.modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + this.modifyuser = pModifyuser; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustCompanyBranch)) { + return false; + } + TcustCompanyBranch that = (TcustCompanyBranch) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustCompanyBranch + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustCompanyBranch + */ + @Override + public Object createInstance() { + TcustCompanyBranch instance = new TcustCompanyBranch(); + instance.setPk(new TcustCompanyBranchKey()); + return instance; + } + + /** + * Clona la entidad TcustCompanyBranch + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustCompanyBranch p = (TcustCompanyBranch) this.clone(); + p.setPk((TcustCompanyBranchKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyBranchKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyBranchKey.java.svn-base new file mode 100644 index 0000000..1251532 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyBranchKey.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.company; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTCOMPANYBRANCH*/ +@Embeddable +public class TcustCompanyBranchKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="BRANCHSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del ingreso de la persona +*/ +private Integer branchsequence; + +/**Contructor por defecto*/ +public TcustCompanyBranchKey(){} +/**Contructor de TcustCompanyBranchKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pBranchsequence Secuencia del ingreso de la persona +*/ +public TcustCompanyBranchKey(Integer pPersoncode,Timestamp pDateto,Integer pBranchsequence){ + personcode=pPersoncode; + dateto=pDateto; + branchsequence=pBranchsequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de branchsequence +@return valor de branchsequence*/ +public Integer getBranchsequence(){ + return branchsequence; +} +/**Fija el valor de branchsequence +@param pBranchsequence nuevo Valor de branchsequence*/ +public void setBranchsequence(Integer pBranchsequence){ + branchsequence=pBranchsequence; +} + +/**Implementacin de la comparacin de TcustCompanyBranchKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustCompanyBranchKey))return false; + TcustCompanyBranchKey that = (TcustCompanyBranchKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getBranchsequence() == null || that.getBranchsequence() == null){ + return false; + } + if (! this.getBranchsequence().equals(that.getBranchsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustCompanyBranchKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getBranchsequence() == null ? 0 : this.getBranchsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyClient.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyClient.java.svn-base new file mode 100644 index 0000000..7fad682 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyClient.java.svn-base @@ -0,0 +1,489 @@ +package com.fp.persistence.pcustomer.company; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTCOMPANYCLIENT + */ +@Entity(name = "TcustCompanyClient") +@Table(name = "TCUSTCOMPANYCLIENT") +public class TcustCompanyClient extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustCompanyClient + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(CLIENTSEQUENCE),0)+1 from TCUSTCOMPANYCLIENT where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "clientsequence")}) + @GeneratedValue(generator = "seq_id") + private TcustCompanyClientKey pk; + @Column(name = "DATEFROM", nullable = false) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "CLIENTPERSONCODE", nullable = true) + /** + * Codigo de persona asociada al cliente de la empresa + */ + private Integer clientpersoncode; + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + @Column(name = "PAYMENTMETHODCATALOG", nullable = true) + /** + * Codigo de catalogo 1, efectivo, 2 cheque, 3 credito + */ + private String paymentmethodcatalog; + @Column(name = "PAYMENTMETHODCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo PAYMENTMETHOD de la forma de pago + */ + private String paymentmethodcatalogcode; + @Column(name = "MAXCREDIT", nullable = true) + /** + * Monto maximo de creditos. + */ + private BigDecimal maxcredit; + @Column(name = "ANNUALPURCHASE", nullable = true) + /** + * Monto de compras anuales del cliente en la compania + */ + private BigDecimal annualpurchase; + @Column(name = "CLIENTDATE", nullable = true) + /** + * Fecha desde la cual la persona es cliente de la compania + */ + private Date clientdate; + @Column(name = "NAME", nullable = true) + /** + * Nombre del cliente si no esta en la base de personas + */ + private String name; + @Column(name = "REMARK", nullable = true) + /** + * Comentarios + */ + private String remark; + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el cliente + */ + private String ingressuser; + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del cliente + */ + private String modifyuser; + + /** + * Contructor por defecto + */ + public TcustCompanyClient() { + } + + /** + * Contructor de TcustCompanyClient + * + * @param pPk Clave Primaria del entity + * @param pDatefrom Fecha desde la cual esta vigente el registro + */ + public TcustCompanyClient(TcustCompanyClientKey pPk, Timestamp pDatefrom) { + this(); + this.pk = pPk; + this.datefrom = pDatefrom; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustCompanyClient + */ + public static TcustCompanyClient find(EntityManager pEntityManager, TcustCompanyClientKey pKey) throws Exception { + TcustCompanyClient obj = pEntityManager.find(TcustCompanyClient.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustCompanyClient + * + * @return El objeto que referencia a la Clave primaria de + * TcustCompanyClient + */ + public TcustCompanyClientKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustCompanyClient + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustCompanyClient + */ + public void setPk(TcustCompanyClientKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de clientpersoncode + * + * @return valor de clientpersoncode + */ + public Integer getClientpersoncode() { + return this.clientpersoncode; + } + + /** + * Fija el valor de clientpersoncode + * + * @param pClientpersoncode nuevo Valor de clientpersoncode + */ + public void setClientpersoncode(Integer pClientpersoncode) { + this.clientpersoncode = pClientpersoncode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de paymentmethodcatalog + * + * @return valor de paymentmethodcatalog + */ + public String getPaymentmethodcatalog() { + return this.paymentmethodcatalog; + } + + /** + * Fija el valor de paymentmethodcatalog + * + * @param pPaymentmethodcatalog nuevo Valor de paymentmethodcatalog + */ + public void setPaymentmethodcatalog(String pPaymentmethodcatalog) { + this.paymentmethodcatalog = pPaymentmethodcatalog; + } + + /** + * Obtiene el valor de paymentmethodcatalogcode + * + * @return valor de paymentmethodcatalogcode + */ + public String getPaymentmethodcatalogcode() { + return this.paymentmethodcatalogcode; + } + + /** + * Fija el valor de paymentmethodcatalogcode + * + * @param pPaymentmethodcatalogcode nuevo Valor de paymentmethodcatalogcode + */ + public void setPaymentmethodcatalogcode(String pPaymentmethodcatalogcode) { + this.paymentmethodcatalogcode = pPaymentmethodcatalogcode; + } + + /** + * Obtiene el valor de maxcredit + * + * @return valor de maxcredit + */ + public BigDecimal getMaxcredit() { + return this.maxcredit; + } + + /** + * Fija el valor de maxcredit + * + * @param pMaxcredit nuevo Valor de maxcredit + */ + public void setMaxcredit(BigDecimal pMaxcredit) { + this.maxcredit = pMaxcredit; + } + + /** + * Obtiene el valor de annualpurchase + * + * @return valor de annualpurchase + */ + public BigDecimal getAnnualpurchase() { + return this.annualpurchase; + } + + /** + * Fija el valor de annualpurchase + * + * @param pAnnualpurchase nuevo Valor de annualpurchase + */ + public void setAnnualpurchase(BigDecimal pAnnualpurchase) { + this.annualpurchase = pAnnualpurchase; + } + + /** + * Obtiene el valor de clientdate + * + * @return valor de clientdate + */ + public Date getClientdate() { + return this.clientdate; + } + + /** + * Fija el valor de clientdate + * + * @param pClientdate nuevo Valor de clientdate + */ + public void setClientdate(Date pClientdate) { + this.clientdate = pClientdate; + } + + /** + * Obtiene el valor de name + * + * @return valor de name + */ + public String getName() { + return this.name; + } + + /** + * Fija el valor de name + * + * @param pName nuevo Valor de name + */ + public void setName(String pName) { + this.name = pName; + } + + /** + * Obtiene el valor de remark + * + * @return valor de remark + */ + public String getRemark() { + return this.remark; + } + + /** + * Fija el valor de remark + * + * @param pRemark nuevo Valor de remark + */ + public void setRemark(String pRemark) { + this.remark = pRemark; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return this.ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + this.ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return this.modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + this.modifyuser = pModifyuser; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustCompanyClient)) { + return false; + } + TcustCompanyClient that = (TcustCompanyClient) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustCompanyClient + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustCompanyClient + */ + @Override + public Object createInstance() { + TcustCompanyClient instance = new TcustCompanyClient(); + instance.setPk(new TcustCompanyClientKey()); + return instance; + } + + /** + * Clona la entidad TcustCompanyClient + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustCompanyClient p = (TcustCompanyClient) this.clone(); + p.setPk((TcustCompanyClientKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyClientKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyClientKey.java.svn-base new file mode 100644 index 0000000..9d63199 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyClientKey.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.company; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTCOMPANYCLIENT*/ +@Embeddable +public class TcustCompanyClientKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="CLIENTSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del ingreso del cliente +*/ +private Integer clientsequence; + +/**Contructor por defecto*/ +public TcustCompanyClientKey(){} +/**Contructor de TcustCompanyClientKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pClientsequence Secuencia del ingreso del cliente +*/ +public TcustCompanyClientKey(Integer pPersoncode,Timestamp pDateto,Integer pClientsequence){ + personcode=pPersoncode; + dateto=pDateto; + clientsequence=pClientsequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de clientsequence +@return valor de clientsequence*/ +public Integer getClientsequence(){ + return clientsequence; +} +/**Fija el valor de clientsequence +@param pClientsequence nuevo Valor de clientsequence*/ +public void setClientsequence(Integer pClientsequence){ + clientsequence=pClientsequence; +} + +/**Implementacin de la comparacin de TcustCompanyClientKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustCompanyClientKey))return false; + TcustCompanyClientKey that = (TcustCompanyClientKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getClientsequence() == null || that.getClientsequence() == null){ + return false; + } + if (! this.getClientsequence().equals(that.getClientsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustCompanyClientKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getClientsequence() == null ? 0 : this.getClientsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyFinancial.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyFinancial.java.svn-base new file mode 100644 index 0000000..a676593 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyFinancial.java.svn-base @@ -0,0 +1,662 @@ +package com.fp.persistence.pcustomer.company; + +import java.sql.Timestamp; +import java.io.Serializable; +import javax.persistence.Table; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; +import javax.persistence.Version; +import javax.persistence.Entity; +import javax.persistence.EmbeddedId; +import javax.persistence.EntityManager; +import javax.persistence.Column; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTCOMPANYFINANCIAL + */ +@Entity(name = "TcustCompanyFinancial") +@Table(name = "TCUSTCOMPANYFINANCIAL") +public class TcustCompanyFinancial extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustCompanyFinancial + */ + @EmbeddedId + private TcustCompanyFinancialKey pk; + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + @Column(name = "DATEFROM", nullable = false) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el cliente + */ + private String ingressuser; + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del cliente + */ + private String modifyuser; + @Column(name = "SITUATIONDATE", nullable = true) + /** + * Fecha a la cual se tiene actualizada la situacion financiera de la + * compania. + */ + private Date situationdate; + @Column(name = "SALESAMOUNT", nullable = true) + /** + * Monto ventas a la fecha de ingreso de la situacion financiera + */ + private BigDecimal salesamount; + @Column(name = "CURRENTASSETS", nullable = true) + /** + * Activos corrientes a la fecha de ingreso de la situacion financiera. + */ + private BigDecimal currentassets; + @Column(name = "FIXEDASSETS", nullable = true) + /** + * Activos fijos a la fecha de ingreso de la situacion financiera + */ + private BigDecimal fixedassets; + @Column(name = "TOTALASSETS", nullable = true) + /** + * Total de activos activos corrienets + activos fijos + cuentas por cobrar + * a la fecha de ingreso de la situacion financiera + */ + private BigDecimal totalassets; + @Column(name = "WORKINGCAPITAL", nullable = true) + /** + * Capital de trabajo a la fecha de ingreso de la situacion financiera + */ + private BigDecimal workingcapital; + @Column(name = "NETINCOME", nullable = true) + /** + * Utilidad neta a la fecha de ingreso de la situacion financiera. + */ + private BigDecimal netincome; + @Column(name = "CURRENTLIABILITIES", nullable = true) + /** + * Pasivos corrientes a la fecha de ingreso de la situacion financiera. + */ + private BigDecimal currentliabilities; + @Column(name = "PATRIMONY", nullable = true) + /** + * Patrimonio a la fecha de ingreso de la situacion financiera + */ + private BigDecimal patrimony; + @Column(name = "CASH", nullable = true) + /** + * Monto en caja y bancos a la fecha de ingreso de la situacion financiera + */ + private BigDecimal cash; + @Column(name = "INVENTORY", nullable = true) + /** + * Monto en productos para la venta en stock a la fecha de ingreso de la + * situacion financiera + */ + private BigDecimal inventory; + @Column(name = "LONGTERMDEBT", nullable = true) + /** + * Deuda a largo plazo a la fecha de ingreso de la situacion financiera + */ + private BigDecimal longtermdebt; + @Column(name = "GROSSRECEIPTS", nullable = true) + /** + * Ingreos brutos ventas netas + otros ingresos a la fecha de ingreso de la + * situacion financiera + */ + private BigDecimal grossreceipts; + @Column(name = "INTERESTOPAID", nullable = true) + /** + * Monto pagado en intereses a la fecha de ingreso de la situacion + * financiera + */ + private BigDecimal interestopaid; + @Column(name = "RETAINEDEARNINGS", nullable = true) + /** + * Ganancias retenidas a la fecha de ingreso de la situacion financiera + */ + private BigDecimal retainedearnings; + @Column(name = "SALESEXPENSE", nullable = true) + /** + * Costo de ventas a la fecha de ingreso de la situacion financiera + */ + private BigDecimal salesexpense; + + /** + * Contructor por defecto + */ + public TcustCompanyFinancial() { + } + + /** + * Contructor de TcustCompanyFinancial + * + * @param pPk Clave Primaria del entity + * @param pDatefrom Fecha desde la cual esta vigente el registro + */ + public TcustCompanyFinancial(TcustCompanyFinancialKey pPk, Timestamp pDatefrom) { + this(); + pk = pPk; + datefrom = pDatefrom; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustCompanyFinancial + */ + public static TcustCompanyFinancial find(EntityManager pEntityManager, TcustCompanyFinancialKey pKey) throws Exception { + TcustCompanyFinancial obj = pEntityManager.find(TcustCompanyFinancial.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustCompanyFinancial + * + * @return El objeto que referencia a la Clave primaria de + * TcustCompanyFinancial + */ + public TcustCompanyFinancialKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustCompanyFinancial + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustCompanyFinancial + */ + public void setPk(TcustCompanyFinancialKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + modifyuser = pModifyuser; + } + + /** + * Obtiene el valor de situationdate + * + * @return valor de situationdate + */ + public Date getSituationdate() { + return situationdate; + } + + /** + * Fija el valor de situationdate + * + * @param pSituationdate nuevo Valor de situationdate + */ + public void setSituationdate(Date pSituationdate) { + situationdate = pSituationdate; + } + + /** + * Obtiene el valor de salesamount + * + * @return valor de salesamount + */ + public BigDecimal getSalesamount() { + return salesamount; + } + + /** + * Fija el valor de salesamount + * + * @param pSalesamount nuevo Valor de salesamount + */ + public void setSalesamount(BigDecimal pSalesamount) { + salesamount = pSalesamount; + } + + /** + * Obtiene el valor de currentassets + * + * @return valor de currentassets + */ + public BigDecimal getCurrentassets() { + return currentassets; + } + + /** + * Fija el valor de currentassets + * + * @param pCurrentassets nuevo Valor de currentassets + */ + public void setCurrentassets(BigDecimal pCurrentassets) { + currentassets = pCurrentassets; + } + + /** + * Obtiene el valor de fixedassets + * + * @return valor de fixedassets + */ + public BigDecimal getFixedassets() { + return fixedassets; + } + + /** + * Fija el valor de fixedassets + * + * @param pFixedassets nuevo Valor de fixedassets + */ + public void setFixedassets(BigDecimal pFixedassets) { + fixedassets = pFixedassets; + } + + /** + * Obtiene el valor de totalassets + * + * @return valor de totalassets + */ + public BigDecimal getTotalassets() { + return totalassets; + } + + /** + * Fija el valor de totalassets + * + * @param pTotalassets nuevo Valor de totalassets + */ + public void setTotalassets(BigDecimal pTotalassets) { + totalassets = pTotalassets; + } + + /** + * Obtiene el valor de workingcapital + * + * @return valor de workingcapital + */ + public BigDecimal getWorkingcapital() { + return workingcapital; + } + + /** + * Fija el valor de workingcapital + * + * @param pWorkingcapital nuevo Valor de workingcapital + */ + public void setWorkingcapital(BigDecimal pWorkingcapital) { + workingcapital = pWorkingcapital; + } + + /** + * Obtiene el valor de netincome + * + * @return valor de netincome + */ + public BigDecimal getNetincome() { + return netincome; + } + + /** + * Fija el valor de netincome + * + * @param pNetincome nuevo Valor de netincome + */ + public void setNetincome(BigDecimal pNetincome) { + netincome = pNetincome; + } + + /** + * Obtiene el valor de currentliabilities + * + * @return valor de currentliabilities + */ + public BigDecimal getCurrentliabilities() { + return currentliabilities; + } + + /** + * Fija el valor de currentliabilities + * + * @param pCurrentliabilities nuevo Valor de currentliabilities + */ + public void setCurrentliabilities(BigDecimal pCurrentliabilities) { + currentliabilities = pCurrentliabilities; + } + + /** + * Obtiene el valor de patrimony + * + * @return valor de patrimony + */ + public BigDecimal getPatrimony() { + return patrimony; + } + + /** + * Fija el valor de patrimony + * + * @param pPatrimony nuevo Valor de patrimony + */ + public void setPatrimony(BigDecimal pPatrimony) { + patrimony = pPatrimony; + } + + /** + * Obtiene el valor de cash + * + * @return valor de cash + */ + public BigDecimal getCash() { + return cash; + } + + /** + * Fija el valor de cash + * + * @param pCash nuevo Valor de cash + */ + public void setCash(BigDecimal pCash) { + cash = pCash; + } + + /** + * Obtiene el valor de inventory + * + * @return valor de inventory + */ + public BigDecimal getInventory() { + return inventory; + } + + /** + * Fija el valor de inventory + * + * @param pInventory nuevo Valor de inventory + */ + public void setInventory(BigDecimal pInventory) { + inventory = pInventory; + } + + /** + * Obtiene el valor de longtermdebt + * + * @return valor de longtermdebt + */ + public BigDecimal getLongtermdebt() { + return longtermdebt; + } + + /** + * Fija el valor de longtermdebt + * + * @param pLongtermdebt nuevo Valor de longtermdebt + */ + public void setLongtermdebt(BigDecimal pLongtermdebt) { + longtermdebt = pLongtermdebt; + } + + /** + * Obtiene el valor de grossreceipts + * + * @return valor de grossreceipts + */ + public BigDecimal getGrossreceipts() { + return grossreceipts; + } + + /** + * Fija el valor de grossreceipts + * + * @param pGrossreceipts nuevo Valor de grossreceipts + */ + public void setGrossreceipts(BigDecimal pGrossreceipts) { + grossreceipts = pGrossreceipts; + } + + /** + * Obtiene el valor de interestopaid + * + * @return valor de interestopaid + */ + public BigDecimal getInterestopaid() { + return interestopaid; + } + + /** + * Fija el valor de interestopaid + * + * @param pInterestopaid nuevo Valor de interestopaid + */ + public void setInterestopaid(BigDecimal pInterestopaid) { + interestopaid = pInterestopaid; + } + + /** + * Obtiene el valor de retainedearnings + * + * @return valor de retainedearnings + */ + public BigDecimal getRetainedearnings() { + return retainedearnings; + } + + /** + * Fija el valor de retainedearnings + * + * @param pRetainedearnings nuevo Valor de retainedearnings + */ + public void setRetainedearnings(BigDecimal pRetainedearnings) { + retainedearnings = pRetainedearnings; + } + + /** + * Obtiene el valor de salesexpense + * + * @return valor de salesexpense + */ + public BigDecimal getSalesexpense() { + return salesexpense; + } + + /** + * Fija el valor de salesexpense + * + * @param pSalesexpense nuevo Valor de salesexpense + */ + public void setSalesexpense(BigDecimal pSalesexpense) { + salesexpense = pSalesexpense; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustCompanyFinancial)) { + return false; + } + TcustCompanyFinancial that = (TcustCompanyFinancial) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TcustCompanyFinancial + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco TcustCompanyFinancial + */ + public Object createInstance() { + TcustCompanyFinancial instance = new TcustCompanyFinancial(); + instance.setPk(new TcustCompanyFinancialKey()); + return instance; + } + + /** + * Clona la entidad TcustCompanyFinancial + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustCompanyFinancial p = (TcustCompanyFinancial) this.clone(); + p.setPk((TcustCompanyFinancialKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyFinancialKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyFinancialKey.java.svn-base new file mode 100644 index 0000000..96b44c2 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyFinancialKey.java.svn-base @@ -0,0 +1,129 @@ +package com.fp.persistence.pcustomer.company; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTCOMPANYFINANCIAL*/ +@Embeddable +public class TcustCompanyFinancialKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TcustCompanyFinancialKey(){} +/**Contructor de TcustCompanyFinancialKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +*/ +public TcustCompanyFinancialKey(Integer pPersoncode,Timestamp pDateto){ + personcode=pPersoncode; + dateto=pDateto; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TcustCompanyFinancialKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustCompanyFinancialKey))return false; + TcustCompanyFinancialKey that = (TcustCompanyFinancialKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustCompanyFinancialKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyKey.java.svn-base new file mode 100644 index 0000000..bb1a4e8 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyKey.java.svn-base @@ -0,0 +1,129 @@ +package com.fp.persistence.pcustomer.company; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTCOMPANY*/ +@Embeddable +public class TcustCompanyKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro. +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TcustCompanyKey(){} +/**Contructor de TcustCompanyKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro. +*/ +public TcustCompanyKey(Integer pPersoncode,Timestamp pDateto){ + personcode=pPersoncode; + dateto=pDateto; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TcustCompanyKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustCompanyKey))return false; + TcustCompanyKey that = (TcustCompanyKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustCompanyKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyManagers.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyManagers.java.svn-base new file mode 100644 index 0000000..0e2a757 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyManagers.java.svn-base @@ -0,0 +1,438 @@ +package com.fp.persistence.pcustomer.company; + +import com.fp.common.helper.Constant; +import java.sql.Timestamp; +import com.fp.dto.hb.Log; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import javax.persistence.Entity; +import javax.persistence.EmbeddedId; +import javax.persistence.EntityManager; +import javax.persistence.Column; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; +import java.util.List; +import javax.persistence.Query; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTCOMPANYMANAGERS + */ +@Entity(name = "TcustCompanyManagers") +@Table(name = "TCUSTCOMPANYMANAGERS") +public class TcustCompanyManagers extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustCompanyManagers + */ + @EmbeddedId + private TcustCompanyManagersKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "DESIGNATIONDATE", nullable = true) + /** + * Fecha de nombramiento + */ + private Date designationdate; + @Column(name = "EXPIRATIONDATE", nullable = true) + /** + * Fecha de vencimiento del nombramiento + */ + private Date expirationdate; + @Column(name = "REGISTERDATE", nullable = true) + /** + * Fecha en la que se incribe el nombramiento en los organismos de control, ejemoplo registro mercail, + * superintendencia de companias + */ + private Date registerdate; + @Column(name = "REMARK", nullable = true) + /** + * Comentario + */ + private String remark; + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el cliente + */ + private String ingressuser; + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del cliente + */ + private String modifyuser; + @Column(name = "ISREPRESENTLEGAL", nullable = true) + /** + * I dentifica si el directivo es el representante legal de la empresa + */ + private String isrepresentlegal; + @Column(name = "PARTICIPATION", nullable = true) + /** + * Porcentaje de particicion del socio dentro de la empresa. + */ + private BigDecimal participation; + + /** + * Contructor por defecto + */ + public TcustCompanyManagers() { + } + + /** + * Contructor de TcustCompanyManagers + * + * @param pPk Clave Primaria del entity + */ + public TcustCompanyManagers(TcustCompanyManagersKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustCompanyManagers + */ + public static TcustCompanyManagers find(EntityManager pEntityManager, TcustCompanyManagersKey pKey) throws Exception { + TcustCompanyManagers obj = pEntityManager.find(TcustCompanyManagers.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustCompanyManagers + * + * @return El objeto que referencia a la Clave primaria de TcustCompanyManagers + */ + public TcustCompanyManagersKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustCompanyManagers + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TcustCompanyManagers + */ + public void setPk(TcustCompanyManagersKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de designationdate + * + * @return valor de designationdate + */ + public Date getDesignationdate() { + return designationdate; + } + + /** + * Fija el valor de designationdate + * + * @param pDesignationdate nuevo Valor de designationdate + */ + public void setDesignationdate(Date pDesignationdate) { + designationdate = pDesignationdate; + } + + /** + * Obtiene el valor de expirationdate + * + * @return valor de expirationdate + */ + public Date getExpirationdate() { + return expirationdate; + } + + /** + * Fija el valor de expirationdate + * + * @param pExpirationdate nuevo Valor de expirationdate + */ + public void setExpirationdate(Date pExpirationdate) { + expirationdate = pExpirationdate; + } + + /** + * Obtiene el valor de registerdate + * + * @return valor de registerdate + */ + public Date getRegisterdate() { + return registerdate; + } + + /** + * Fija el valor de registerdate + * + * @param pRegisterdate nuevo Valor de registerdate + */ + public void setRegisterdate(Date pRegisterdate) { + registerdate = pRegisterdate; + } + + /** + * Obtiene el valor de remark + * + * @return valor de remark + */ + public String getRemark() { + return remark; + } + + /** + * Fija el valor de remark + * + * @param pRemark nuevo Valor de remark + */ + public void setRemark(String pRemark) { + remark = pRemark; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + modifyuser = pModifyuser; + } + + /** + * Obtiene el valor de isrepresentlegal + * + * @return valor de isrepresentlegal + */ + public String getIsrepresentlegal() { + return isrepresentlegal; + } + + /** + * Fija el valor de isrepresentlegal + * + * @param pIsrepresentlegal nuevo Valor de isrepresentlegal + */ + public void setIsrepresentlegal(String pIsrepresentlegal) { + isrepresentlegal = pIsrepresentlegal; + } + + /** + * Obtiene el valor de participation + * + * @return valor de participation + */ + public BigDecimal getParticipation() { + return participation; + } + + /** + * Fija el valor de participation + * + * @param pParticipation nuevo Valor de participation + */ + public void setParticipation(BigDecimal pParticipation) { + participation = pParticipation; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustCompanyManagers)) { + return false; + } + TcustCompanyManagers that = (TcustCompanyManagers) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TcustCompanyManagers + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacion toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacion de la creacion de un bean en blanco TcustCompanyManagers + */ + public Object createInstance() { + TcustCompanyManagers instance = new TcustCompanyManagers(); + instance.setPk(new TcustCompanyManagersKey()); + return instance; + } + + /** + * Clona la entidad TcustCompanyManagers + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustCompanyManagers p = (TcustCompanyManagers) this.clone(); + p.setPk((TcustCompanyManagersKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +//METODOS MANUALES. + private static final String JPQL_MANAGERS = "from TcustCompanyManagers c" + " where c.pk.personcode = :personcode " + + " and c.pk.dateto = :dateto "; + + /** + * Metodo que devuelve una lista de objetos TcustCompanyManagers dado el codigo de persona + * + * @param pEntityManager + * @param personcode codigo de persona + * @return List + * @throws Exception + */ + public static List find(EntityManager pEntityManager, Integer personcode) throws Exception { + List lcomManagers = null; + Query qry = pEntityManager.createQuery(TcustCompanyManagers.JPQL_MANAGERS); + qry.setParameter("personcode", personcode); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + lcomManagers = qry.getResultList(); + return lcomManagers; + } + //METODOS MANUALES + /** + * Sentencia que devuelve las excepciones de una solicitud. + */ + private static final String JPQL_SOL_TCUSTCOMPANYMANAGERS = "from TcustCompanyManagers tcustCompanyManagers " + + " where tcustCompanyManagers.pk.personcode = :personcode " + "and tcustCompanyManagers.pk.dateto = :dateto"; + + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findByPersonCode(EntityManager pEntityManager, Integer pPersonCode) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(TcustCompanyManagers.JPQL_SOL_TCUSTCOMPANYMANAGERS); + qry.setParameter("personcode", pPersonCode); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + lObjects = qry.getResultList(); + return lObjects; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyManagersKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyManagersKey.java.svn-base new file mode 100644 index 0000000..908a632 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyManagersKey.java.svn-base @@ -0,0 +1,210 @@ +package com.fp.persistence.pcustomer.company; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTCOMPANYMANAGERS*/ +@Embeddable +public class TcustCompanyManagersKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="MANAGERPERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona asociado al directivo de la empresa +*/ +private Integer managerpersoncode; + +@Column(name="APPOINTMENTCATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo de tipo de cargo, 1 Gerente, 2 Contador +*/ +private String appointmentcatalog; + +@Column(name="APPOINTMENTCATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo de tipo de empresa APPOINTMENT +*/ +private String appointmentcatalogcode; + +/**Contructor por defecto*/ +public TcustCompanyManagersKey(){} +/**Contructor de TcustCompanyManagersKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pManagerpersoncode Codigo de persona asociado al directivo de la empresa +@param pAppointmentcatalog Codigo de catalogo de tipo de cargo, 1 Gerente, 2 Contador +@param pAppointmentcatalogcode Codigo de tabla de catalogo de tipo de empresa APPOINTMENT +*/ +public TcustCompanyManagersKey(Integer pPersoncode,Timestamp pDateto,Integer pManagerpersoncode,String pAppointmentcatalog,String pAppointmentcatalogcode){ + personcode=pPersoncode; + dateto=pDateto; + managerpersoncode=pManagerpersoncode; + appointmentcatalog=pAppointmentcatalog; + appointmentcatalogcode=pAppointmentcatalogcode; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de managerpersoncode +@return valor de managerpersoncode*/ +public Integer getManagerpersoncode(){ + return managerpersoncode; +} +/**Fija el valor de managerpersoncode +@param pManagerpersoncode nuevo Valor de managerpersoncode*/ +public void setManagerpersoncode(Integer pManagerpersoncode){ + managerpersoncode=pManagerpersoncode; +} + +/**Obtiene el valor de appointmentcatalog +@return valor de appointmentcatalog*/ +public String getAppointmentcatalog(){ + return appointmentcatalog; +} +/**Fija el valor de appointmentcatalog +@param pAppointmentcatalog nuevo Valor de appointmentcatalog*/ +public void setAppointmentcatalog(String pAppointmentcatalog){ + appointmentcatalog=pAppointmentcatalog; +} + +/**Obtiene el valor de appointmentcatalogcode +@return valor de appointmentcatalogcode*/ +public String getAppointmentcatalogcode(){ + return appointmentcatalogcode; +} +/**Fija el valor de appointmentcatalogcode +@param pAppointmentcatalogcode nuevo Valor de appointmentcatalogcode*/ +public void setAppointmentcatalogcode(String pAppointmentcatalogcode){ + appointmentcatalogcode=pAppointmentcatalogcode; +} + +/**Implementacion de la comparacion de TcustCompanyManagersKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustCompanyManagersKey))return false; + TcustCompanyManagersKey that = (TcustCompanyManagersKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getManagerpersoncode() == null || that.getManagerpersoncode() == null){ + return false; + } + if (! this.getManagerpersoncode().equals(that.getManagerpersoncode())){ + return false; + } + if (this.getAppointmentcatalog() == null || that.getAppointmentcatalog() == null){ + return false; + } + if (! this.getAppointmentcatalog().equals(that.getAppointmentcatalog())){ + return false; + } + if (this.getAppointmentcatalogcode() == null || that.getAppointmentcatalogcode() == null){ + return false; + } + if (! this.getAppointmentcatalogcode().equals(that.getAppointmentcatalogcode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TcustCompanyManagersKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getManagerpersoncode() == null ? 0 : this.getManagerpersoncode().hashCode()); + result = result * 37 + (this.getAppointmentcatalog() == null ? 0 : this.getAppointmentcatalog().hashCode()); + result = result * 37 + (this.getAppointmentcatalogcode() == null ? 0 : this.getAppointmentcatalogcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyProducts.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyProducts.java.svn-base new file mode 100644 index 0000000..bef0217 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyProducts.java.svn-base @@ -0,0 +1,428 @@ +package com.fp.persistence.pcustomer.company; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTCOMPANYPRODUCTS + */ +@Entity(name = "TcustCompanyProducts") +@Table(name = "TCUSTCOMPANYPRODUCTS") +public class TcustCompanyProducts extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TcustCompanyProducts + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(PRODUCTSEQUENCE),0)+1 from TCUSTCOMPANYPRODUCTS where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "productsequence") }) + @GeneratedValue(generator = "seq_id") + private TcustCompanyProductsKey pk; + + @Column(name = "DATEFROM", nullable = false) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "MARKETINGTYPECATALOG", nullable = true) + /** + * Codigo de catalogo 1, masivo, 2 persona a persona, directa, tercerizada + */ + private String marketingtypecatalog; + + @Column(name = "MARKETINGTYPECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo MARKETINGTYPE, forma de comercializacion + */ + private String marketingtypecatalogcode; + + @Column(name = "ANNUALSALES", nullable = true) + /** + * Monto ventas anuales + */ + private BigDecimal annualsales; + + @Column(name = "PRODUCTDETAIL", nullable = true) + /** + * Descripcion del producto + */ + private String productdetail; + + @Column(name = "PERCENT", nullable = true) + /** + * Porcentaje de ventas del producto dentro de la empresa + */ + private BigDecimal percent; + + @Column(name = "ISSERVICE", nullable = true) + /** + * Y indica, que el producto es un servicio, N es un producto final o + * entrada para otro producto + */ + private String isservice; + + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el cliente + */ + private String ingressuser; + + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del cliente + */ + private String modifyuser; + + /** + * Contructor por defecto + */ + public TcustCompanyProducts() { + } + + /** + * Contructor de TcustCompanyProducts + * + * @param pPk Clave Primaria del entity + * @param pDatefrom Fecha desde la cual esta vigente el registro + */ + public TcustCompanyProducts(TcustCompanyProductsKey pPk, Timestamp pDatefrom) { + this(); + this.pk = pPk; + this.datefrom = pDatefrom; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustCompanyProducts + */ + public static TcustCompanyProducts find(EntityManager pEntityManager, TcustCompanyProductsKey pKey) throws Exception { + TcustCompanyProducts obj = pEntityManager.find(TcustCompanyProducts.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustCompanyProducts + * + * @return El objeto que referencia a la Clave primaria de TcustCompanyProducts + */ + public TcustCompanyProductsKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustCompanyProducts + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TcustCompanyProducts + */ + public void setPk(TcustCompanyProductsKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de marketingtypecatalog + * + * @return valor de marketingtypecatalog + */ + public String getMarketingtypecatalog() { + return this.marketingtypecatalog; + } + + /** + * Fija el valor de marketingtypecatalog + * + * @param pMarketingtypecatalog nuevo Valor de marketingtypecatalog + */ + public void setMarketingtypecatalog(String pMarketingtypecatalog) { + this.marketingtypecatalog = pMarketingtypecatalog; + } + + /** + * Obtiene el valor de marketingtypecatalogcode + * + * @return valor de marketingtypecatalogcode + */ + public String getMarketingtypecatalogcode() { + return this.marketingtypecatalogcode; + } + + /** + * Fija el valor de marketingtypecatalogcode + * + * @param pMarketingtypecatalogcode nuevo Valor de marketingtypecatalogcode + */ + public void setMarketingtypecatalogcode(String pMarketingtypecatalogcode) { + this.marketingtypecatalogcode = pMarketingtypecatalogcode; + } + + /** + * Obtiene el valor de annualsales + * + * @return valor de annualsales + */ + public BigDecimal getAnnualsales() { + return this.annualsales; + } + + /** + * Fija el valor de annualsales + * + * @param pAnnualsales nuevo Valor de annualsales + */ + public void setAnnualsales(BigDecimal pAnnualsales) { + this.annualsales = pAnnualsales; + } + + /** + * Obtiene el valor de productdetail + * + * @return valor de productdetail + */ + public String getProductdetail() { + return this.productdetail; + } + + /** + * Fija el valor de productdetail + * + * @param pProductdetail nuevo Valor de productdetail + */ + public void setProductdetail(String pProductdetail) { + this.productdetail = pProductdetail; + } + + /** + * Obtiene el valor de percent + * + * @return valor de percent + */ + public BigDecimal getPercent() { + return this.percent; + } + + /** + * Fija el valor de percent + * + * @param pPercent nuevo Valor de percent + */ + public void setPercent(BigDecimal pPercent) { + this.percent = pPercent; + } + + /** + * Obtiene el valor de isservice + * + * @return valor de isservice + */ + public String getIsservice() { + return this.isservice; + } + + /** + * Fija el valor de isservice + * + * @param pIsservice nuevo Valor de isservice + */ + public void setIsservice(String pIsservice) { + this.isservice = pIsservice; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return this.ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + this.ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return this.modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + this.modifyuser = pModifyuser; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustCompanyProducts)) { + return false; + } + TcustCompanyProducts that = (TcustCompanyProducts) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustCompanyProducts + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustCompanyProducts + */ + @Override + public Object createInstance() { + TcustCompanyProducts instance = new TcustCompanyProducts(); + instance.setPk(new TcustCompanyProductsKey()); + return instance; + } + + /** + * Clona la entidad TcustCompanyProducts + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustCompanyProducts p = (TcustCompanyProducts) this.clone(); + p.setPk((TcustCompanyProductsKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyProductsKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyProductsKey.java.svn-base new file mode 100644 index 0000000..01597ce --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyProductsKey.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.company; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTCOMPANYPRODUCTS*/ +@Embeddable +public class TcustCompanyProductsKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="PRODUCTSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del ingreso de la persona +*/ +private Integer productsequence; + +/**Contructor por defecto*/ +public TcustCompanyProductsKey(){} +/**Contructor de TcustCompanyProductsKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pProductsequence Secuencia del ingreso de la persona +*/ +public TcustCompanyProductsKey(Integer pPersoncode,Timestamp pDateto,Integer pProductsequence){ + personcode=pPersoncode; + dateto=pDateto; + productsequence=pProductsequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de productsequence +@return valor de productsequence*/ +public Integer getProductsequence(){ + return productsequence; +} +/**Fija el valor de productsequence +@param pProductsequence nuevo Valor de productsequence*/ +public void setProductsequence(Integer pProductsequence){ + productsequence=pProductsequence; +} + +/**Implementacin de la comparacin de TcustCompanyProductsKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustCompanyProductsKey))return false; + TcustCompanyProductsKey that = (TcustCompanyProductsKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getProductsequence() == null || that.getProductsequence() == null){ + return false; + } + if (! this.getProductsequence().equals(that.getProductsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustCompanyProductsKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getProductsequence() == null ? 0 : this.getProductsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyProvider.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyProvider.java.svn-base new file mode 100644 index 0000000..365db4b --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyProvider.java.svn-base @@ -0,0 +1,500 @@ +package com.fp.persistence.pcustomer.company; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTCOMPANYPROVIDER + */ +@Entity(name = "TcustCompanyProvider") +@Table(name = "TCUSTCOMPANYPROVIDER") +public class TcustCompanyProvider extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TcustCompanyProvider + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(PROVIDERSEQUENCE),0)+1 from TCUSTCOMPANYPROVIDER where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "providersequence") }) + @GeneratedValue(generator = "seq_id") + private TcustCompanyProviderKey pk; + + @Column(name = "DATEFROM", nullable = false) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "PROVIDERPERSONCODE", nullable = true) + /** + * Codigo de persona asociada al proveedor de la empresa + */ + private Integer providerpersoncode; + + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + + @Column(name = "PAYMENTMETHODCATALOG", nullable = true) + /** + * Codigo de catalogo 1, efectivo, 2 cheque, 3 credito + */ + private String paymentmethodcatalog; + + @Column(name = "PAYMENTMETHODCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo PAYMENTMETHOD de la forma de pago + */ + private String paymentmethodcatalogcode; + + @Column(name = "MAXCREDIT", nullable = true) + /** + * Monto maximo de creditos. + */ + private BigDecimal maxcredit; + + @Column(name = "ANNUALPURCHASE", nullable = true) + /** + * Monto de compras anuales de la compania al proveedor + */ + private BigDecimal annualpurchase; + + @Column(name = "PROVIDERDATE", nullable = true) + /** + * Fecha desde la cual la persona es proveedor de la compania + */ + private Date providerdate; + + @Column(name = "NAME", nullable = true) + /** + * Nombre del proveedor si no esta en la base de personas + */ + private String name; + + @Column(name = "REMARK", nullable = true) + /** + * Comentarios + */ + private String remark; + + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el cliente + */ + private String ingressuser; + + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del cliente + */ + private String modifyuser; + + /** + * Contructor por defecto + */ + public TcustCompanyProvider() { + } + + /** + * Contructor de TcustCompanyProvider + * + * @param pPk Clave Primaria del entity + * @param pDatefrom Fecha desde la cual esta vigente el registro + */ + public TcustCompanyProvider(TcustCompanyProviderKey pPk, Timestamp pDatefrom) { + this(); + this.pk = pPk; + this.datefrom = pDatefrom; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustCompanyProvider + */ + public static TcustCompanyProvider find(EntityManager pEntityManager, TcustCompanyProviderKey pKey) throws Exception { + TcustCompanyProvider obj = pEntityManager.find(TcustCompanyProvider.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustCompanyProvider + * + * @return El objeto que referencia a la Clave primaria de TcustCompanyProvider + */ + public TcustCompanyProviderKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustCompanyProvider + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TcustCompanyProvider + */ + public void setPk(TcustCompanyProviderKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de providerpersoncode + * + * @return valor de providerpersoncode + */ + public Integer getProviderpersoncode() { + return this.providerpersoncode; + } + + /** + * Fija el valor de providerpersoncode + * + * @param pProviderpersoncode nuevo Valor de providerpersoncode + */ + public void setProviderpersoncode(Integer pProviderpersoncode) { + this.providerpersoncode = pProviderpersoncode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de paymentmethodcatalog + * + * @return valor de paymentmethodcatalog + */ + public String getPaymentmethodcatalog() { + return this.paymentmethodcatalog; + } + + /** + * Fija el valor de paymentmethodcatalog + * + * @param pPaymentmethodcatalog nuevo Valor de paymentmethodcatalog + */ + public void setPaymentmethodcatalog(String pPaymentmethodcatalog) { + this.paymentmethodcatalog = pPaymentmethodcatalog; + } + + /** + * Obtiene el valor de paymentmethodcatalogcode + * + * @return valor de paymentmethodcatalogcode + */ + public String getPaymentmethodcatalogcode() { + return this.paymentmethodcatalogcode; + } + + /** + * Fija el valor de paymentmethodcatalogcode + * + * @param pPaymentmethodcatalogcode nuevo Valor de paymentmethodcatalogcode + */ + public void setPaymentmethodcatalogcode(String pPaymentmethodcatalogcode) { + this.paymentmethodcatalogcode = pPaymentmethodcatalogcode; + } + + /** + * Obtiene el valor de maxcredit + * + * @return valor de maxcredit + */ + public BigDecimal getMaxcredit() { + return this.maxcredit; + } + + /** + * Fija el valor de maxcredit + * + * @param pMaxcredit nuevo Valor de maxcredit + */ + public void setMaxcredit(BigDecimal pMaxcredit) { + this.maxcredit = pMaxcredit; + } + + /** + * Obtiene el valor de annualpurchase + * + * @return valor de annualpurchase + */ + public BigDecimal getAnnualpurchase() { + return this.annualpurchase; + } + + /** + * Fija el valor de annualpurchase + * + * @param pAnnualpurchase nuevo Valor de annualpurchase + */ + public void setAnnualpurchase(BigDecimal pAnnualpurchase) { + this.annualpurchase = pAnnualpurchase; + } + + /** + * Obtiene el valor de providerdate + * + * @return valor de providerdate + */ + public Date getProviderdate() { + return this.providerdate; + } + + /** + * Fija el valor de providerdate + * + * @param pProviderdate nuevo Valor de providerdate + */ + public void setProviderdate(Date pProviderdate) { + this.providerdate = pProviderdate; + } + + /** + * Obtiene el valor de name + * + * @return valor de name + */ + public String getName() { + return this.name; + } + + /** + * Fija el valor de name + * + * @param pName nuevo Valor de name + */ + public void setName(String pName) { + this.name = pName; + } + + /** + * Obtiene el valor de remark + * + * @return valor de remark + */ + public String getRemark() { + return this.remark; + } + + /** + * Fija el valor de remark + * + * @param pRemark nuevo Valor de remark + */ + public void setRemark(String pRemark) { + this.remark = pRemark; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return this.ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + this.ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return this.modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + this.modifyuser = pModifyuser; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustCompanyProvider)) { + return false; + } + TcustCompanyProvider that = (TcustCompanyProvider) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustCompanyProvider + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustCompanyProvider + */ + @Override + public Object createInstance() { + TcustCompanyProvider instance = new TcustCompanyProvider(); + instance.setPk(new TcustCompanyProviderKey()); + return instance; + } + + /** + * Clona la entidad TcustCompanyProvider + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustCompanyProvider p = (TcustCompanyProvider) this.clone(); + p.setPk((TcustCompanyProviderKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyProviderKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyProviderKey.java.svn-base new file mode 100644 index 0000000..2edcab8 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustCompanyProviderKey.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.company; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTCOMPANYPROVIDER*/ +@Embeddable +public class TcustCompanyProviderKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="PROVIDERSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del ingreso del proveedor +*/ +private Integer providersequence; + +/**Contructor por defecto*/ +public TcustCompanyProviderKey(){} +/**Contructor de TcustCompanyProviderKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pProvidersequence Secuencia del ingreso del proveedor +*/ +public TcustCompanyProviderKey(Integer pPersoncode,Timestamp pDateto,Integer pProvidersequence){ + personcode=pPersoncode; + dateto=pDateto; + providersequence=pProvidersequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de providersequence +@return valor de providersequence*/ +public Integer getProvidersequence(){ + return providersequence; +} +/**Fija el valor de providersequence +@param pProvidersequence nuevo Valor de providersequence*/ +public void setProvidersequence(Integer pProvidersequence){ + providersequence=pProvidersequence; +} + +/**Implementacin de la comparacin de TcustCompanyProviderKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustCompanyProviderKey))return false; + TcustCompanyProviderKey that = (TcustCompanyProviderKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getProvidersequence() == null || that.getProvidersequence() == null){ + return false; + } + if (! this.getProvidersequence().equals(that.getProvidersequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustCompanyProviderKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getProvidersequence() == null ? 0 : this.getProvidersequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustEconomicGroup.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustEconomicGroup.java.svn-base new file mode 100644 index 0000000..712ad09 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustEconomicGroup.java.svn-base @@ -0,0 +1,252 @@ +package com.fp.persistence.pcustomer.company; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTECONOMICGROUP*/ +@Entity(name="TcustEconomicGroup") +@Table(name="TCUSTECONOMICGROUP") +public class TcustEconomicGroup extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TcustEconomicGroup +*/ +@EmbeddedId +private TcustEconomicGroupKey pk; +@Column(name="LEGALLINKCATALOG", nullable=true) + +/** +* Codigo de catalogo PG1 Causales P01 y G01 +*/ +private String legallinkcatalog; + +@Column(name="LEGALLINKCATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo LEGALLINK vinculaciones legales +*/ +private String legallinkcatalogcode; + +@Version +@Column(name="RECORDVERSION", nullable=false) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="INGRESSDATE", nullable=true) + +/** +* Fecha de inicio de la vinculacion. +*/ +private Date ingressdate; + +@Column(name="EXITDATE", nullable=true) + +/** +* Fecha en la que finaliza la vinculacion de la persona. +*/ +private Date exitdate; + +@Column(name="INGRESSUSER", nullable=true) + +/** +* null +*/ +private String ingressuser; + +@Column(name="MODIFYUSER", nullable=true) + +/** +* Codigo de usuario que modifica datos del cliente +*/ +private String modifyuser; + +/**Contructor por defecto*/ +public TcustEconomicGroup(){ +} +/**Contructor de TcustEconomicGroup +@param pPk Clave Primaria del entity +@param pRecordversion Optimistic locking del registro +*/ +public TcustEconomicGroup(TcustEconomicGroupKey pPk,Integer pRecordversion){ + this(); + pk=pPk; + recordversion=pRecordversion; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TcustEconomicGroup +*/ +public static TcustEconomicGroup find(EntityManager pEntityManager,TcustEconomicGroupKey pKey) throws Exception{ + TcustEconomicGroup obj = pEntityManager.find(TcustEconomicGroup.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TcustEconomicGroup +@return El objeto que referencia a la Clave primaria de TcustEconomicGroup +*/ +public TcustEconomicGroupKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TcustEconomicGroup +@param pPk El objeto que referencia a la nueva Clave primaria de TcustEconomicGroup +*/ +public void setPk(TcustEconomicGroupKey pPk){ + pk=pPk; +} +/**Obtiene el valor de legallinkcatalog +@return valor de legallinkcatalog*/ +public String getLegallinkcatalog(){ + return legallinkcatalog; +} +/**Fija el valor de legallinkcatalog +@param pLegallinkcatalog nuevo Valor de legallinkcatalog*/ +public void setLegallinkcatalog(String pLegallinkcatalog){ + legallinkcatalog=pLegallinkcatalog; +} + +/**Obtiene el valor de legallinkcatalogcode +@return valor de legallinkcatalogcode*/ +public String getLegallinkcatalogcode(){ + return legallinkcatalogcode; +} +/**Fija el valor de legallinkcatalogcode +@param pLegallinkcatalogcode nuevo Valor de legallinkcatalogcode*/ +public void setLegallinkcatalogcode(String pLegallinkcatalogcode){ + legallinkcatalogcode=pLegallinkcatalogcode; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de ingressdate +@return valor de ingressdate*/ +public Date getIngressdate(){ + return ingressdate; +} +/**Fija el valor de ingressdate +@param pIngressdate nuevo Valor de ingressdate*/ +public void setIngressdate(Date pIngressdate){ + ingressdate=pIngressdate; +} + +/**Obtiene el valor de exitdate +@return valor de exitdate*/ +public Date getExitdate(){ + return exitdate; +} +/**Fija el valor de exitdate +@param pExitdate nuevo Valor de exitdate*/ +public void setExitdate(Date pExitdate){ + exitdate=pExitdate; +} + +/**Obtiene el valor de ingressuser +@return valor de ingressuser*/ +public String getIngressuser(){ + return ingressuser; +} +/**Fija el valor de ingressuser +@param pIngressuser nuevo Valor de ingressuser*/ +public void setIngressuser(String pIngressuser){ + ingressuser=pIngressuser; +} + +/**Obtiene el valor de modifyuser +@return valor de modifyuser*/ +public String getModifyuser(){ + return modifyuser; +} +/**Fija el valor de modifyuser +@param pModifyuser nuevo Valor de modifyuser*/ +public void setModifyuser(String pModifyuser){ + modifyuser=pModifyuser; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TcustEconomicGroup))return false; + TcustEconomicGroup that = (TcustEconomicGroup) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TcustEconomicGroup +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TcustEconomicGroup +*/ +public Object createInstance(){ + TcustEconomicGroup instance=new TcustEconomicGroup(); + instance.setPk(new TcustEconomicGroupKey()); + return instance; +} +/**Clona la entidad TcustEconomicGroup +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TcustEconomicGroup p=(TcustEconomicGroup)this.clone(); + p.setPk((TcustEconomicGroupKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustEconomicGroupKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustEconomicGroupKey.java.svn-base new file mode 100644 index 0000000..32f530a --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustEconomicGroupKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pcustomer.company; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTECONOMICGROUP*/ +@Embeddable +public class TcustEconomicGroupKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="GROUPPERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer grouppersoncode; + +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TcustEconomicGroupKey(){} +/**Contructor de TcustEconomicGroupKey +@param pGrouppersoncode Codigo de persona +@param pPersoncode Codigo de persona +@param pCompanycode Codigo de compania +*/ +public TcustEconomicGroupKey(Integer pGrouppersoncode,Integer pPersoncode,Integer pCompanycode){ + grouppersoncode=pGrouppersoncode; + personcode=pPersoncode; + companycode=pCompanycode; +} +/**Obtiene el valor de grouppersoncode +@return valor de grouppersoncode*/ +public Integer getGrouppersoncode(){ + return grouppersoncode; +} +/**Fija el valor de grouppersoncode +@param pGrouppersoncode nuevo Valor de grouppersoncode*/ +public void setGrouppersoncode(Integer pGrouppersoncode){ + grouppersoncode=pGrouppersoncode; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacin de la comparacin de TcustEconomicGroupKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustEconomicGroupKey))return false; + TcustEconomicGroupKey that = (TcustEconomicGroupKey) o; + if (this.getGrouppersoncode() == null || that.getGrouppersoncode() == null){ + return false; + } + if (! this.getGrouppersoncode().equals(that.getGrouppersoncode())){ + return false; + } + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustEconomicGroupKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getGrouppersoncode() == null ? 0 : this.getGrouppersoncode().hashCode()); + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustFamiliarlLink.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustFamiliarlLink.java.svn-base new file mode 100644 index 0000000..9f62dc9 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustFamiliarlLink.java.svn-base @@ -0,0 +1,337 @@ +package com.fp.persistence.pcustomer.company; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.util.List; +import javax.persistence.Query; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTFAMILIARLLINK + */ +@Entity(name = "TcustFamiliarlLink") +@Table(name = "TCUSTFAMILIARLLINK") +public class TcustFamiliarlLink extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustFamiliarlLink + */ + @EmbeddedId + private TcustFamiliarlLinkKey pk; + @Column(name = "FAMILIARLINKCATALOG", nullable = true) + /** + * Codigo de catalogo 1 Padre, 3 Madre, 3 Hermano/a, 4 Conyuge. + */ + private String familiarlinkcatalog; + @Column(name = "FAMILIARLINKCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo FAMILIARLINK, vinculaciones familiares + */ + private String familiarlinkcatalogcode; + @Version + @Column(name = "RECORDVERSION", nullable = false) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "PROPERTYDIVISION", nullable = true) + /** + * Y Indica que existe separacion de bienes, N mop existe separacion de + * bienes + */ + private String propertydivision; + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el cliente + */ + private String ingressuser; + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del cliente + */ + private String modifyuser; + //METODOS MANUALES + /** + * Sentencia que devuelve las excepciones de una solicitud. + */ + private static final String JPQL_SOL_TCUSTFAMILIARLINK = "from TcustFamiliarlLink tcustFamiliarLink " + + " where tcustFamiliarLink.pk.personcode = :personcode "; + /** + * + */ + private static final String JPQL_SOL_TCUSTFAMILIARLINKPERSONCODE = "from TcustFamiliarlLink tcustFamiliarLink " + + " where tcustFamiliarLink.pk.linkpersoncode = :personcode "; + + /** + * Contructor por defecto + */ + public TcustFamiliarlLink() { + } + + /** + * Contructor de TcustFamiliarlLink + * + * @param pPk Clave Primaria del entity + * @param pRecordversion Optimistic locking del registro + */ + public TcustFamiliarlLink(TcustFamiliarlLinkKey pPk, Integer pRecordversion) { + this(); + pk = pPk; + recordversion = pRecordversion; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustFamiliarlLink + */ + public static TcustFamiliarlLink find(EntityManager pEntityManager, TcustFamiliarlLinkKey pKey) throws Exception { + TcustFamiliarlLink obj = pEntityManager.find(TcustFamiliarlLink.class, pKey); + return obj; + } + + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findByPersonCode(EntityManager pEntityManager, Integer pPersonCode) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(TcustFamiliarlLink.JPQL_SOL_TCUSTFAMILIARLINK); + qry.setParameter("personcode", pPersonCode); + lObjects = qry.getResultList(); + return lObjects; + } + + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findByPersonCodeLink(EntityManager pEntityManager, Integer pPersonCodeLink) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(TcustFamiliarlLink.JPQL_SOL_TCUSTFAMILIARLINKPERSONCODE); + qry.setParameter("personcode", pPersonCodeLink); + lObjects = qry.getResultList(); + return lObjects; + } + + /** + * Entrega la Clave primaria de TcustFamiliarlLink + * + * @return El objeto que referencia a la Clave primaria de + * TcustFamiliarlLink + */ + public TcustFamiliarlLinkKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustFamiliarlLink + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustFamiliarlLink + */ + public void setPk(TcustFamiliarlLinkKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de familiarlinkcatalog + * + * @return valor de familiarlinkcatalog + */ + public String getFamiliarlinkcatalog() { + return familiarlinkcatalog; + } + + /** + * Fija el valor de familiarlinkcatalog + * + * @param pFamiliarlinkcatalog nuevo Valor de familiarlinkcatalog + */ + public void setFamiliarlinkcatalog(String pFamiliarlinkcatalog) { + familiarlinkcatalog = pFamiliarlinkcatalog; + } + + /** + * Obtiene el valor de familiarlinkcatalogcode + * + * @return valor de familiarlinkcatalogcode + */ + public String getFamiliarlinkcatalogcode() { + return familiarlinkcatalogcode; + } + + /** + * Fija el valor de familiarlinkcatalogcode + * + * @param pFamiliarlinkcatalogcode nuevo Valor de familiarlinkcatalogcode + */ + public void setFamiliarlinkcatalogcode(String pFamiliarlinkcatalogcode) { + familiarlinkcatalogcode = pFamiliarlinkcatalogcode; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de propertydivision + * + * @return valor de propertydivision + */ + public String getPropertydivision() { + return propertydivision; + } + + /** + * Fija el valor de propertydivision + * + * @param pPropertydivision nuevo Valor de propertydivision + */ + public void setPropertydivision(String pPropertydivision) { + propertydivision = pPropertydivision; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + modifyuser = pModifyuser; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustFamiliarlLink)) { + return false; + } + TcustFamiliarlLink that = (TcustFamiliarlLink) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TcustFamiliarlLink + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco TcustFamiliarlLink + */ + public Object createInstance() { + TcustFamiliarlLink instance = new TcustFamiliarlLink(); + instance.setPk(new TcustFamiliarlLinkKey()); + return instance; + } + + /** + * Clona la entidad TcustFamiliarlLink + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustFamiliarlLink p = (TcustFamiliarlLink) this.clone(); + p.setPk((TcustFamiliarlLinkKey) this.pk.cloneMe()); + return p; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustFamiliarlLinkKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustFamiliarlLinkKey.java.svn-base new file mode 100644 index 0000000..67ab20e --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustFamiliarlLinkKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pcustomer.company; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTFAMILIARLLINK*/ +@Embeddable +public class TcustFamiliarlLinkKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="LINKPERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer linkpersoncode; + +/**Contructor por defecto*/ +public TcustFamiliarlLinkKey(){} +/**Contructor de TcustFamiliarlLinkKey +@param pPersoncode Codigo de persona +@param pLinkpersoncode Codigo de persona +*/ +public TcustFamiliarlLinkKey(Integer pPersoncode,Integer pLinkpersoncode){ + personcode=pPersoncode; + linkpersoncode=pLinkpersoncode; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de linkpersoncode +@return valor de linkpersoncode*/ +public Integer getLinkpersoncode(){ + return linkpersoncode; +} +/**Fija el valor de linkpersoncode +@param pLinkpersoncode nuevo Valor de linkpersoncode*/ +public void setLinkpersoncode(Integer pLinkpersoncode){ + linkpersoncode=pLinkpersoncode; +} + +/**Implementacin de la comparacin de TcustFamiliarlLinkKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustFamiliarlLinkKey))return false; + TcustFamiliarlLinkKey that = (TcustFamiliarlLinkKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getLinkpersoncode() == null || that.getLinkpersoncode() == null){ + return false; + } + if (! this.getLinkpersoncode().equals(that.getLinkpersoncode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustFamiliarlLinkKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getLinkpersoncode() == null ? 0 : this.getLinkpersoncode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustFinancialInstitutions.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustFinancialInstitutions.java.svn-base new file mode 100644 index 0000000..ca97ed3 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustFinancialInstitutions.java.svn-base @@ -0,0 +1,164 @@ +package com.fp.persistence.pcustomer.company; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTFINANCIALINSTITUTIONS + */ +@Entity(name = "TcustFinancialInstitutions") +@Table(name = "TCUSTFINANCIALINSTITUTIONS") +public class TcustFinancialInstitutions extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustFinancialInstitutions + */ + @Id + @Column(name = "PERSONCODE", nullable = false, updatable = false) + private Integer pk; + + /** + * Contructor por defecto + */ + public TcustFinancialInstitutions() { + } + + /** + * Contructor de TcustFinancialInstitutions + * + * @param pPk Clave Primaria del entity + */ + public TcustFinancialInstitutions(Integer pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustFinancialInstitutions + */ + public static TcustFinancialInstitutions find(EntityManager pEntityManager, Object pKey) throws Exception { + TcustFinancialInstitutions obj = pEntityManager.find(TcustFinancialInstitutions.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustFinancialInstitutions + * + * @return El objeto que referencia a la Clave primaria de + * TcustFinancialInstitutions + */ + public Integer getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustFinancialInstitutions + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustFinancialInstitutions + */ + public void setPk(Integer pPk) { + pk = pPk; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustFinancialInstitutions)) { + return false; + } + TcustFinancialInstitutions that = (TcustFinancialInstitutions) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad + * TcustFinancialInstitutions + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco + * TcustFinancialInstitutions + */ + public Object createInstance() { + TcustFinancialInstitutions instance = new TcustFinancialInstitutions(); + return instance; + } + + /** + * Clona la entidad TcustFinancialInstitutions + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustFinancialInstitutions p = (TcustFinancialInstitutions) this.clone(); + return p; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustInsurance.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustInsurance.java.svn-base new file mode 100644 index 0000000..6d2ffd6 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustInsurance.java.svn-base @@ -0,0 +1,161 @@ +package com.fp.persistence.pcustomer.company; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTINSURANCE + */ +@Entity(name = "TcustInsurance") +@Table(name = "TCUSTINSURANCE") +public class TcustInsurance extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustInsurance + */ + @Id + @Column(name = "PERSONCODE", nullable = false, updatable = false) + private Integer pk; + + /** + * Contructor por defecto + */ + public TcustInsurance() { + } + + /** + * Contructor de TcustInsurance + * + * @param pPk Clave Primaria del entity + */ + public TcustInsurance(Integer pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustInsurance + */ + public static TcustInsurance find(EntityManager pEntityManager, Object pKey) throws Exception { + TcustInsurance obj = pEntityManager.find(TcustInsurance.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustInsurance + * + * @return El objeto que referencia a la Clave primaria de TcustInsurance + */ + public Integer getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustInsurance + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustInsurance + */ + public void setPk(Integer pPk) { + pk = pPk; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustInsurance)) { + return false; + } + TcustInsurance that = (TcustInsurance) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TcustInsurance + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco TcustInsurance + */ + public Object createInstance() { + TcustInsurance instance = new TcustInsurance(); + return instance; + } + + /** + * Clona la entidad TcustInsurance + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustInsurance p = (TcustInsurance) this.clone(); + return p; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustLegalLink.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustLegalLink.java.svn-base new file mode 100644 index 0000000..87d9337 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustLegalLink.java.svn-base @@ -0,0 +1,356 @@ +package com.fp.persistence.pcustomer.company; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTLEGALLINK + */ +@Entity(name = "TcustLegalLink") +@Table(name = "TCUSTLEGALLINK") +public class TcustLegalLink extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustLegalLink + */ + @EmbeddedId + private TcustLegalLinkKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro del telefono + */ + private Timestamp datefrom; + @Column(name = "LEGALLINKCATALOG", nullable = true) + /** + * Codigo de catalogo PG1 Causales P01 y G01 + */ + private String legallinkcatalog; + @Column(name = "LEGALLINKCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo LEGALLINK vinculaciones legales + */ + private String legallinkcatalogcode; + @Version + @Column(name = "RECORDVERSION", nullable = false) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "INGRESSDATE", nullable = true) + /** + * Fecha de inicio de la vinculacion. + */ + private Date ingressdate; + @Column(name = "EXITDATE", nullable = true) + /** + * Fecha en la que finaliza la vinculacion de la persona. + */ + private Date exitdate; + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el cliente + */ + private String ingressuser; + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del cliente + */ + private String modifyuser; + + /** + * Contructor por defecto + */ + public TcustLegalLink() { + } + + /** + * Contructor de TcustLegalLink + * + * @param pPk Clave Primaria del entity + * @param pRecordversion Optimistic locking del registro + */ + public TcustLegalLink(TcustLegalLinkKey pPk, Integer pRecordversion) { + this(); + pk = pPk; + recordversion = pRecordversion; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustLegalLink + */ + public static TcustLegalLink find(EntityManager pEntityManager, TcustLegalLinkKey pKey) throws Exception { + TcustLegalLink obj = pEntityManager.find(TcustLegalLink.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustLegalLink + * + * @return El objeto que referencia a la Clave primaria de TcustLegalLink + */ + public TcustLegalLinkKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustLegalLink + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustLegalLink + */ + public void setPk(TcustLegalLinkKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + datefrom = pDatefrom; + } + + /** + * Obtiene el valor de legallinkcatalog + * + * @return valor de legallinkcatalog + */ + public String getLegallinkcatalog() { + return legallinkcatalog; + } + + /** + * Fija el valor de legallinkcatalog + * + * @param pLegallinkcatalog nuevo Valor de legallinkcatalog + */ + public void setLegallinkcatalog(String pLegallinkcatalog) { + legallinkcatalog = pLegallinkcatalog; + } + + /** + * Obtiene el valor de legallinkcatalogcode + * + * @return valor de legallinkcatalogcode + */ + public String getLegallinkcatalogcode() { + return legallinkcatalogcode; + } + + /** + * Fija el valor de legallinkcatalogcode + * + * @param pLegallinkcatalogcode nuevo Valor de legallinkcatalogcode + */ + public void setLegallinkcatalogcode(String pLegallinkcatalogcode) { + legallinkcatalogcode = pLegallinkcatalogcode; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de ingressdate + * + * @return valor de ingressdate + */ + public Date getIngressdate() { + return ingressdate; + } + + /** + * Fija el valor de ingressdate + * + * @param pIngressdate nuevo Valor de ingressdate + */ + public void setIngressdate(Date pIngressdate) { + ingressdate = pIngressdate; + } + + /** + * Obtiene el valor de exitdate + * + * @return valor de exitdate + */ + public Date getExitdate() { + return exitdate; + } + + /** + * Fija el valor de exitdate + * + * @param pExitdate nuevo Valor de exitdate + */ + public void setExitdate(Date pExitdate) { + exitdate = pExitdate; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + modifyuser = pModifyuser; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustLegalLink)) { + return false; + } + TcustLegalLink that = (TcustLegalLink) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TcustLegalLink + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco TcustLegalLink + */ + public Object createInstance() { + TcustLegalLink instance = new TcustLegalLink(); + instance.setPk(new TcustLegalLinkKey()); + return instance; + } + + /** + * Clona la entidad TcustLegalLink + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustLegalLink p = (TcustLegalLink) this.clone(); + p.setPk((TcustLegalLinkKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustLegalLinkKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustLegalLinkKey.java.svn-base new file mode 100644 index 0000000..6e10352 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustLegalLinkKey.java.svn-base @@ -0,0 +1,183 @@ +package com.fp.persistence.pcustomer.company; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTLEGALLINK*/ +@Embeddable +public class TcustLegalLinkKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="LINKPERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer linkpersoncode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro del telefono +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TcustLegalLinkKey(){} +/**Contructor de TcustLegalLinkKey +@param pPersoncode Codigo de persona +@param pLinkpersoncode Codigo de persona +@param pCompanycode Codigo de compania +@param pDateto Fecha hasta la cual esta vigente el registro del telefono +*/ +public TcustLegalLinkKey(Integer pPersoncode,Integer pLinkpersoncode,Integer pCompanycode,Timestamp pDateto){ + personcode=pPersoncode; + linkpersoncode=pLinkpersoncode; + companycode=pCompanycode; + dateto=pDateto; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de linkpersoncode +@return valor de linkpersoncode*/ +public Integer getLinkpersoncode(){ + return linkpersoncode; +} +/**Fija el valor de linkpersoncode +@param pLinkpersoncode nuevo Valor de linkpersoncode*/ +public void setLinkpersoncode(Integer pLinkpersoncode){ + linkpersoncode=pLinkpersoncode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TcustLegalLinkKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustLegalLinkKey))return false; + TcustLegalLinkKey that = (TcustLegalLinkKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getLinkpersoncode() == null || that.getLinkpersoncode() == null){ + return false; + } + if (! this.getLinkpersoncode().equals(that.getLinkpersoncode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustLegalLinkKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getLinkpersoncode() == null ? 0 : this.getLinkpersoncode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustNotaryOffice.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustNotaryOffice.java.svn-base new file mode 100644 index 0000000..b28b73b --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustNotaryOffice.java.svn-base @@ -0,0 +1,161 @@ +package com.fp.persistence.pcustomer.company; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTNOTARYOFFICE + */ +@Entity(name = "TcustNotaryOffice") +@Table(name = "TCUSTNOTARYOFFICE") +public class TcustNotaryOffice extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustNotaryOffice + */ + @Id + @Column(name = "PERSONCODE", nullable = false, updatable = false) + private Integer pk; + + /** + * Contructor por defecto + */ + public TcustNotaryOffice() { + } + + /** + * Contructor de TcustNotaryOffice + * + * @param pPk Clave Primaria del entity + */ + public TcustNotaryOffice(Integer pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustNotaryOffice + */ + public static TcustNotaryOffice find(EntityManager pEntityManager, Object pKey) throws Exception { + TcustNotaryOffice obj = pEntityManager.find(TcustNotaryOffice.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustNotaryOffice + * + * @return El objeto que referencia a la Clave primaria de TcustNotaryOffice + */ + public Integer getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustNotaryOffice + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustNotaryOffice + */ + public void setPk(Integer pPk) { + pk = pPk; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustNotaryOffice)) { + return false; + } + TcustNotaryOffice that = (TcustNotaryOffice) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TcustNotaryOffice + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco TcustNotaryOffice + */ + public Object createInstance() { + TcustNotaryOffice instance = new TcustNotaryOffice(); + return instance; + } + + /** + * Clona la entidad TcustNotaryOffice + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustNotaryOffice p = (TcustNotaryOffice) this.clone(); + return p; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustSupervisor.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustSupervisor.java.svn-base new file mode 100644 index 0000000..6364000 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/.svn/text-base/TcustSupervisor.java.svn-base @@ -0,0 +1,193 @@ +package com.fp.persistence.pcustomer.company; + +import javax.persistence.Entity; +import com.fp.dto.hb.Log; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTSUPERVISOR*/ +@Entity(name="TcustSupervisor") +@Table(name="TCUSTSUPERVISOR") +public class TcustSupervisor extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TcustSupervisor +*/ +@Id +@Column(name="PERSONCODE" ,nullable=false, updatable=false) +private Integer pk; +@Column(name="CODEFILE", nullable=true) + +/** +* Codigo de imagen +*/ +private Integer codefile; + +@Column(name="SUPERVISORID", nullable=true) + +/** +* codigo fiscalizador +*/ +private String supervisorid; + +@Column(name="PERFORMANCE", nullable=true) + +/** +* Indice de desempeo +*/ +private Integer performance; + +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TcustSupervisor(){ +} +/**Contructor de TcustSupervisor +@param pPk Clave Primaria del entity +*/ +public TcustSupervisor(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TcustSupervisor +*/ +public static TcustSupervisor find(EntityManager pEntityManager,Object pKey) throws Exception{ + TcustSupervisor obj = pEntityManager.find(TcustSupervisor.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TcustSupervisor +@return El objeto que referencia a la Clave primaria de TcustSupervisor +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TcustSupervisor +@param pPk El objeto que referencia a la nueva Clave primaria de TcustSupervisor +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de codefile +@return valor de codefile*/ +public Integer getCodefile(){ + return codefile; +} +/**Fija el valor de codefile +@param pCodefile nuevo Valor de codefile*/ +public void setCodefile(Integer pCodefile){ + codefile=pCodefile; +} + +/**Obtiene el valor de supervisorid +@return valor de supervisorid*/ +public String getSupervisorid(){ + return supervisorid; +} +/**Fija el valor de supervisorid +@param pSupervisorid nuevo Valor de supervisorid*/ +public void setSupervisorid(String pSupervisorid){ + supervisorid=pSupervisorid; +} + +/**Obtiene el valor de performance +@return valor de performance*/ +public Integer getPerformance(){ + return performance; +} +/**Fija el valor de performance +@param pPerformance nuevo Valor de performance*/ +public void setPerformance(Integer pPerformance){ + performance=pPerformance; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TcustSupervisor))return false; + TcustSupervisor that = (TcustSupervisor) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TcustSupervisor +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TcustSupervisor +*/ +public Object createInstance(){ + TcustSupervisor instance=new TcustSupervisor(); + return instance; +} +/**Clona la entidad TcustSupervisor +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TcustSupervisor p=(TcustSupervisor)this.clone(); + return p; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustAppraiser.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustAppraiser.java new file mode 100644 index 0000000..40a312a --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustAppraiser.java @@ -0,0 +1,162 @@ +package com.fp.persistence.pcustomer.company; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import com.fp.dto.hb.Log; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTAPPRAISER + */ +@Entity(name = "TcustAppraiser") +@Table(name = "TCUSTAPPRAISER") +public class TcustAppraiser extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustAppraiser + */ + @EmbeddedId + private TcustAppraiserKey pk; + + /** + * Contructor por defecto + */ + public TcustAppraiser() { + } + + /** + * Contructor de TcustAppraiser + * + * @param pPk Clave Primaria del entity + */ + public TcustAppraiser(TcustAppraiserKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustAppraiser + */ + public static TcustAppraiser find(EntityManager pEntityManager, TcustAppraiserKey pKey) throws Exception { + TcustAppraiser obj = pEntityManager.find(TcustAppraiser.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustAppraiser + * + * @return El objeto que referencia a la Clave primaria de TcustAppraiser + */ + public TcustAppraiserKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustAppraiser + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustAppraiser + */ + public void setPk(TcustAppraiserKey pPk) { + pk = pPk; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustAppraiser)) { + return false; + } + TcustAppraiser that = (TcustAppraiser) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TcustAppraiser + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco TcustAppraiser + */ + public Object createInstance() { + TcustAppraiser instance = new TcustAppraiser(); + instance.setPk(new TcustAppraiserKey()); + return instance; + } + + /** + * Clona la entidad TcustAppraiser + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustAppraiser p = (TcustAppraiser) this.clone(); + p.setPk((TcustAppraiserKey) this.pk.cloneMe()); + return p; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustAppraiserKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustAppraiserKey.java new file mode 100644 index 0000000..91dc3f0 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustAppraiserKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pcustomer.company; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTAPPRAISER*/ +@Embeddable +public class TcustAppraiserKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TcustAppraiserKey(){} +/**Contructor de TcustAppraiserKey +@param pPersoncode Codigo de persona +@param pCompanycode Codigo de compania +*/ +public TcustAppraiserKey(Integer pPersoncode,Integer pCompanycode){ + personcode=pPersoncode; + companycode=pCompanycode; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacin de la comparacin de TcustAppraiserKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustAppraiserKey))return false; + TcustAppraiserKey that = (TcustAppraiserKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustAppraiserKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompany.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompany.java new file mode 100644 index 0000000..60419a3 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompany.java @@ -0,0 +1,726 @@ +package com.fp.persistence.pcustomer.company; + +import java.sql.Timestamp; +import java.io.Serializable; +import javax.persistence.Table; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; +import javax.persistence.Version; +import javax.persistence.Entity; +import javax.persistence.EmbeddedId; +import javax.persistence.EntityManager; +import javax.persistence.Column; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTCOMPANY + */ +@Entity(name = "TcustCompany") +@Table(name = "TCUSTCOMPANY") +public class TcustCompany extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustCompany + */ + @EmbeddedId + private TcustCompanyKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro. + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro. + */ + private Integer recordversion; + @Column(name = "BUSINESSTYPECATALOG", nullable = true) + /** + * Codigo de catalogo de tipo de empresa, 1 Con fines de lucro, 2 Sin fines + * de lucro + */ + private String businesstypecatalog; + @Column(name = "BUSINESSTYPECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo de tipo de empresa BUSINESSTYPE + */ + private String businesstypecatalogcode; + @Column(name = "BUSINESSCLASSCATALOG", nullable = true) + /** + * Codigo de catalogo de clase de empresa 1, Pequenia, 2 Mediana + */ + private String businessclasscatalog; + @Column(name = "BUSINESSCLASSCATALOGCODE", nullable = true) + /** + * Codigo de catalogo de clase de empresa BUSINESSCLASS + */ + private String businessclasscatalogcode; + @Column(name = "INSTITUTIONTYPECATALOG", nullable = true) + /** + * Codigo de catalogo de tipo de institucion, 1 banco, 2 cooperativa, 3 + * grupo solidario + */ + private String institutiontypecatalog; + @Column(name = "INSTITUTIONTYPECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo de tipo de institucion INSTITUTIONTYPE + */ + private String institutiontypecatalogcode; + @Column(name = "OPERATIVESTATUSCATALOG", nullable = true) + /** + * Codigo de catalogo 1 Disuelto, 2 Suspendido, 3 Vigente + */ + private String operativestatuscatalog; + @Column(name = "OPERATIVESTATUSCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo OPERATIVESTATUS estatus operativo + */ + private String operativestatuscatalogcode; + @Column(name = "COMMERCIALREGISTER", nullable = true) + /** + * Numero de registro mercantil. + */ + private String commercialregister; + @Column(name = "EMPLOYERCODE", nullable = true) + /** + * Codigo de empleador + */ + private String employercode; + @Column(name = "CONSTITUTIONDATE", nullable = true) + /** + * Fecha de constitucion. + */ + private Date constitutiondate; + @Column(name = "EXPIRATIONDATE", nullable = true) + /** + * Fecha de vencimiento de la compania. + */ + private Date expirationdate; + @Column(name = "EMPLOYEENUMBER", nullable = true) + /** + * Numero de empleados + */ + private Integer employeenumber; + @Column(name = "NOMINALCAPITAL", nullable = true) + /** + * Capittal nominal. + */ + private BigDecimal nominalcapital; + @Column(name = "ORIGINALCAPITAL", nullable = true) + /** + * Capital original. + */ + private BigDecimal originalcapital; + @Column(name = "CONTRIBUTEDCAPITAL", nullable = true) + /** + * Capital suscrito + */ + private BigDecimal contributedcapital; + @Column(name = "CORPORATEPURPOSE", nullable = true) + /** + * Proposito general de la empresa. + */ + private String corporatepurpose; + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el cliente + */ + private String ingressuser; + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del cliente + */ + private String modifyuser; + @Column(name = "MEMBERSNUMBER", nullable = true) + /** + * Numero de socios + */ + private Integer membersnumber; + @Column(name = "LOGO", nullable = true) + /** + * Codigo de imagen + */ + private Integer logo; + + @Column(name = "PICTURE", nullable = true) + /** + * Imagen + */ + private byte[] picture; + + /** + * Contructor por defecto + */ + public TcustCompany() { + } + + /** + * Contructor de TcustCompany + * + * @param pPk Clave Primaria del entity + */ + public TcustCompany(TcustCompanyKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustCompany + */ + public static TcustCompany find(EntityManager pEntityManager, TcustCompanyKey pKey) throws Exception { + TcustCompany obj = pEntityManager.find(TcustCompany.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustCompany + * + * @return El objeto que referencia a la Clave primaria de TcustCompany + */ + public TcustCompanyKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustCompany + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustCompany + */ + public void setPk(TcustCompanyKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de businesstypecatalog + * + * @return valor de businesstypecatalog + */ + public String getBusinesstypecatalog() { + return businesstypecatalog; + } + + /** + * Fija el valor de businesstypecatalog + * + * @param pBusinesstypecatalog nuevo Valor de businesstypecatalog + */ + public void setBusinesstypecatalog(String pBusinesstypecatalog) { + businesstypecatalog = pBusinesstypecatalog; + } + + /** + * Obtiene el valor de businesstypecatalogcode + * + * @return valor de businesstypecatalogcode + */ + public String getBusinesstypecatalogcode() { + return businesstypecatalogcode; + } + + /** + * Fija el valor de businesstypecatalogcode + * + * @param pBusinesstypecatalogcode nuevo Valor de businesstypecatalogcode + */ + public void setBusinesstypecatalogcode(String pBusinesstypecatalogcode) { + businesstypecatalogcode = pBusinesstypecatalogcode; + } + + /** + * Obtiene el valor de businessclasscatalog + * + * @return valor de businessclasscatalog + */ + public String getBusinessclasscatalog() { + return businessclasscatalog; + } + + /** + * Fija el valor de businessclasscatalog + * + * @param pBusinessclasscatalog nuevo Valor de businessclasscatalog + */ + public void setBusinessclasscatalog(String pBusinessclasscatalog) { + businessclasscatalog = pBusinessclasscatalog; + } + + /** + * Obtiene el valor de businessclasscatalogcode + * + * @return valor de businessclasscatalogcode + */ + public String getBusinessclasscatalogcode() { + return businessclasscatalogcode; + } + + /** + * Fija el valor de businessclasscatalogcode + * + * @param pBusinessclasscatalogcode nuevo Valor de businessclasscatalogcode + */ + public void setBusinessclasscatalogcode(String pBusinessclasscatalogcode) { + businessclasscatalogcode = pBusinessclasscatalogcode; + } + + /** + * Obtiene el valor de institutiontypecatalog + * + * @return valor de institutiontypecatalog + */ + public String getInstitutiontypecatalog() { + return institutiontypecatalog; + } + + /** + * Fija el valor de institutiontypecatalog + * + * @param pInstitutiontypecatalog nuevo Valor de institutiontypecatalog + */ + public void setInstitutiontypecatalog(String pInstitutiontypecatalog) { + institutiontypecatalog = pInstitutiontypecatalog; + } + + /** + * Obtiene el valor de institutiontypecatalogcode + * + * @return valor de institutiontypecatalogcode + */ + public String getInstitutiontypecatalogcode() { + return institutiontypecatalogcode; + } + + /** + * Fija el valor de institutiontypecatalogcode + * + * @param pInstitutiontypecatalogcode nuevo Valor de + * institutiontypecatalogcode + */ + public void setInstitutiontypecatalogcode(String pInstitutiontypecatalogcode) { + institutiontypecatalogcode = pInstitutiontypecatalogcode; + } + + /** + * Obtiene el valor de operativestatuscatalog + * + * @return valor de operativestatuscatalog + */ + public String getOperativestatuscatalog() { + return operativestatuscatalog; + } + + /** + * Fija el valor de operativestatuscatalog + * + * @param pOperativestatuscatalog nuevo Valor de operativestatuscatalog + */ + public void setOperativestatuscatalog(String pOperativestatuscatalog) { + operativestatuscatalog = pOperativestatuscatalog; + } + + /** + * Obtiene el valor de operativestatuscatalogcode + * + * @return valor de operativestatuscatalogcode + */ + public String getOperativestatuscatalogcode() { + return operativestatuscatalogcode; + } + + /** + * Fija el valor de operativestatuscatalogcode + * + * @param pOperativestatuscatalogcode nuevo Valor de + * operativestatuscatalogcode + */ + public void setOperativestatuscatalogcode(String pOperativestatuscatalogcode) { + operativestatuscatalogcode = pOperativestatuscatalogcode; + } + + /** + * Obtiene el valor de commercialregister + * + * @return valor de commercialregister + */ + public String getCommercialregister() { + return commercialregister; + } + + /** + * Fija el valor de commercialregister + * + * @param pCommercialregister nuevo Valor de commercialregister + */ + public void setCommercialregister(String pCommercialregister) { + commercialregister = pCommercialregister; + } + + /** + * Obtiene el valor de employercode + * + * @return valor de employercode + */ + public String getEmployercode() { + return employercode; + } + + /** + * Fija el valor de employercode + * + * @param pEmployercode nuevo Valor de employercode + */ + public void setEmployercode(String pEmployercode) { + employercode = pEmployercode; + } + + /** + * Obtiene el valor de constitutiondate + * + * @return valor de constitutiondate + */ + public Date getConstitutiondate() { + return constitutiondate; + } + + /** + * Fija el valor de constitutiondate + * + * @param pConstitutiondate nuevo Valor de constitutiondate + */ + public void setConstitutiondate(Date pConstitutiondate) { + constitutiondate = pConstitutiondate; + } + + /** + * Obtiene el valor de expirationdate + * + * @return valor de expirationdate + */ + public Date getExpirationdate() { + return expirationdate; + } + + /** + * Fija el valor de expirationdate + * + * @param pExpirationdate nuevo Valor de expirationdate + */ + public void setExpirationdate(Date pExpirationdate) { + expirationdate = pExpirationdate; + } + + /** + * Obtiene el valor de employeenumber + * + * @return valor de employeenumber + */ + public Integer getEmployeenumber() { + return employeenumber; + } + + /** + * Fija el valor de employeenumber + * + * @param pEmployeenumber nuevo Valor de employeenumber + */ + public void setEmployeenumber(Integer pEmployeenumber) { + employeenumber = pEmployeenumber; + } + + /** + * Obtiene el valor de nominalcapital + * + * @return valor de nominalcapital + */ + public BigDecimal getNominalcapital() { + return nominalcapital; + } + + /** + * Fija el valor de nominalcapital + * + * @param pNominalcapital nuevo Valor de nominalcapital + */ + public void setNominalcapital(BigDecimal pNominalcapital) { + nominalcapital = pNominalcapital; + } + + /** + * Obtiene el valor de originalcapital + * + * @return valor de originalcapital + */ + public BigDecimal getOriginalcapital() { + return originalcapital; + } + + /** + * Fija el valor de originalcapital + * + * @param pOriginalcapital nuevo Valor de originalcapital + */ + public void setOriginalcapital(BigDecimal pOriginalcapital) { + originalcapital = pOriginalcapital; + } + + /** + * Obtiene el valor de contributedcapital + * + * @return valor de contributedcapital + */ + public BigDecimal getContributedcapital() { + return contributedcapital; + } + + /** + * Fija el valor de contributedcapital + * + * @param pContributedcapital nuevo Valor de contributedcapital + */ + public void setContributedcapital(BigDecimal pContributedcapital) { + contributedcapital = pContributedcapital; + } + + /** + * Obtiene el valor de corporatepurpose + * + * @return valor de corporatepurpose + */ + public String getCorporatepurpose() { + return corporatepurpose; + } + + /** + * Fija el valor de corporatepurpose + * + * @param pCorporatepurpose nuevo Valor de corporatepurpose + */ + public void setCorporatepurpose(String pCorporatepurpose) { + corporatepurpose = pCorporatepurpose; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + modifyuser = pModifyuser; + } + + /** + * Obtiene el valor de membersnumber + * + * @return valor de membersnumber + */ + public Integer getMembersnumber() { + return membersnumber; + } + + /** + * Fija el valor de membersnumber + * + * @param pMembersnumber nuevo Valor de membersnumber + */ + public void setMembersnumber(Integer pMembersnumber) { + membersnumber = pMembersnumber; + } + + /** + * Obtiene el valor de logo + * + * @return valor de logo + */ + public Integer getLogo() { + return logo; + } + + /** + * Fija el valor de logo + * + * @param pLogo nuevo Valor de logo + */ + public void setLogo(Integer pLogo) { + logo = pLogo; + } + + /** + * Obtiene el valor de la imagen + * @return valor de la imagen + */ + public byte[] getPicture() { + return picture; + } + + /** + * Fija el valor de la imagen + * @param pLogo nuevo Valor de la imagen + */ + public void setPicture(byte[] picture) { + this.picture = picture; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustCompany)) { + return false; + } + TcustCompany that = (TcustCompany) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TcustCompany + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco TcustCompany + */ + public Object createInstance() { + TcustCompany instance = new TcustCompany(); + instance.setPk(new TcustCompanyKey()); + return instance; + } + + /** + * Clona la entidad TcustCompany + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustCompany p = (TcustCompany) this.clone(); + p.setPk((TcustCompanyKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyBranch.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyBranch.java new file mode 100644 index 0000000..b919893 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyBranch.java @@ -0,0 +1,326 @@ +package com.fp.persistence.pcustomer.company; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTCOMPANYBRANCH + */ +@Entity(name = "TcustCompanyBranch") +@Table(name = "TCUSTCOMPANYBRANCH") +public class TcustCompanyBranch extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustCompanyBranch + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(BRANCHSEQUENCE),0)+1 from TCUSTCOMPANYBRANCH where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "branchsequence")}) + @GeneratedValue(generator = "seq_id") + private TcustCompanyBranchKey pk; + @Column(name = "DATEFROM", nullable = false) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "NAME", nullable = true) + /** + * Nombre de la sucursal y/o oficina de representyacion + */ + private String name; + @Column(name = "ADDRESSNUMBER", nullable = true) + /** + * Numero de direccion asociada a la sucursal + */ + private Integer addressnumber; + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el cliente + */ + private String ingressuser; + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del cliente + */ + private String modifyuser; + + /** + * Contructor por defecto + */ + public TcustCompanyBranch() { + } + + /** + * Contructor de TcustCompanyBranch + * + * @param pPk Clave Primaria del entity + * @param pDatefrom Fecha desde la cual esta vigente el registro + */ + public TcustCompanyBranch(TcustCompanyBranchKey pPk, Timestamp pDatefrom) { + this(); + this.pk = pPk; + this.datefrom = pDatefrom; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustCompanyBranch + */ + public static TcustCompanyBranch find(EntityManager pEntityManager, TcustCompanyBranchKey pKey) throws Exception { + TcustCompanyBranch obj = pEntityManager.find(TcustCompanyBranch.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustCompanyBranch + * + * @return El objeto que referencia a la Clave primaria de + * TcustCompanyBranch + */ + public TcustCompanyBranchKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustCompanyBranch + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustCompanyBranch + */ + public void setPk(TcustCompanyBranchKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de name + * + * @return valor de name + */ + public String getName() { + return this.name; + } + + /** + * Fija el valor de name + * + * @param pName nuevo Valor de name + */ + public void setName(String pName) { + this.name = pName; + } + + /** + * Obtiene el valor de addressnumber + * + * @return valor de addressnumber + */ + public Integer getAddressnumber() { + return this.addressnumber; + } + + /** + * Fija el valor de addressnumber + * + * @param pAddressnumber nuevo Valor de addressnumber + */ + public void setAddressnumber(Integer pAddressnumber) { + this.addressnumber = pAddressnumber; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return this.ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + this.ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return this.modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + this.modifyuser = pModifyuser; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustCompanyBranch)) { + return false; + } + TcustCompanyBranch that = (TcustCompanyBranch) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustCompanyBranch + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustCompanyBranch + */ + @Override + public Object createInstance() { + TcustCompanyBranch instance = new TcustCompanyBranch(); + instance.setPk(new TcustCompanyBranchKey()); + return instance; + } + + /** + * Clona la entidad TcustCompanyBranch + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustCompanyBranch p = (TcustCompanyBranch) this.clone(); + p.setPk((TcustCompanyBranchKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyBranchKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyBranchKey.java new file mode 100644 index 0000000..1251532 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyBranchKey.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.company; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTCOMPANYBRANCH*/ +@Embeddable +public class TcustCompanyBranchKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="BRANCHSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del ingreso de la persona +*/ +private Integer branchsequence; + +/**Contructor por defecto*/ +public TcustCompanyBranchKey(){} +/**Contructor de TcustCompanyBranchKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pBranchsequence Secuencia del ingreso de la persona +*/ +public TcustCompanyBranchKey(Integer pPersoncode,Timestamp pDateto,Integer pBranchsequence){ + personcode=pPersoncode; + dateto=pDateto; + branchsequence=pBranchsequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de branchsequence +@return valor de branchsequence*/ +public Integer getBranchsequence(){ + return branchsequence; +} +/**Fija el valor de branchsequence +@param pBranchsequence nuevo Valor de branchsequence*/ +public void setBranchsequence(Integer pBranchsequence){ + branchsequence=pBranchsequence; +} + +/**Implementacin de la comparacin de TcustCompanyBranchKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustCompanyBranchKey))return false; + TcustCompanyBranchKey that = (TcustCompanyBranchKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getBranchsequence() == null || that.getBranchsequence() == null){ + return false; + } + if (! this.getBranchsequence().equals(that.getBranchsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustCompanyBranchKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getBranchsequence() == null ? 0 : this.getBranchsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyClient.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyClient.java new file mode 100644 index 0000000..7fad682 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyClient.java @@ -0,0 +1,489 @@ +package com.fp.persistence.pcustomer.company; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTCOMPANYCLIENT + */ +@Entity(name = "TcustCompanyClient") +@Table(name = "TCUSTCOMPANYCLIENT") +public class TcustCompanyClient extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustCompanyClient + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(CLIENTSEQUENCE),0)+1 from TCUSTCOMPANYCLIENT where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "clientsequence")}) + @GeneratedValue(generator = "seq_id") + private TcustCompanyClientKey pk; + @Column(name = "DATEFROM", nullable = false) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "CLIENTPERSONCODE", nullable = true) + /** + * Codigo de persona asociada al cliente de la empresa + */ + private Integer clientpersoncode; + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + @Column(name = "PAYMENTMETHODCATALOG", nullable = true) + /** + * Codigo de catalogo 1, efectivo, 2 cheque, 3 credito + */ + private String paymentmethodcatalog; + @Column(name = "PAYMENTMETHODCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo PAYMENTMETHOD de la forma de pago + */ + private String paymentmethodcatalogcode; + @Column(name = "MAXCREDIT", nullable = true) + /** + * Monto maximo de creditos. + */ + private BigDecimal maxcredit; + @Column(name = "ANNUALPURCHASE", nullable = true) + /** + * Monto de compras anuales del cliente en la compania + */ + private BigDecimal annualpurchase; + @Column(name = "CLIENTDATE", nullable = true) + /** + * Fecha desde la cual la persona es cliente de la compania + */ + private Date clientdate; + @Column(name = "NAME", nullable = true) + /** + * Nombre del cliente si no esta en la base de personas + */ + private String name; + @Column(name = "REMARK", nullable = true) + /** + * Comentarios + */ + private String remark; + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el cliente + */ + private String ingressuser; + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del cliente + */ + private String modifyuser; + + /** + * Contructor por defecto + */ + public TcustCompanyClient() { + } + + /** + * Contructor de TcustCompanyClient + * + * @param pPk Clave Primaria del entity + * @param pDatefrom Fecha desde la cual esta vigente el registro + */ + public TcustCompanyClient(TcustCompanyClientKey pPk, Timestamp pDatefrom) { + this(); + this.pk = pPk; + this.datefrom = pDatefrom; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustCompanyClient + */ + public static TcustCompanyClient find(EntityManager pEntityManager, TcustCompanyClientKey pKey) throws Exception { + TcustCompanyClient obj = pEntityManager.find(TcustCompanyClient.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustCompanyClient + * + * @return El objeto que referencia a la Clave primaria de + * TcustCompanyClient + */ + public TcustCompanyClientKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustCompanyClient + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustCompanyClient + */ + public void setPk(TcustCompanyClientKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de clientpersoncode + * + * @return valor de clientpersoncode + */ + public Integer getClientpersoncode() { + return this.clientpersoncode; + } + + /** + * Fija el valor de clientpersoncode + * + * @param pClientpersoncode nuevo Valor de clientpersoncode + */ + public void setClientpersoncode(Integer pClientpersoncode) { + this.clientpersoncode = pClientpersoncode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de paymentmethodcatalog + * + * @return valor de paymentmethodcatalog + */ + public String getPaymentmethodcatalog() { + return this.paymentmethodcatalog; + } + + /** + * Fija el valor de paymentmethodcatalog + * + * @param pPaymentmethodcatalog nuevo Valor de paymentmethodcatalog + */ + public void setPaymentmethodcatalog(String pPaymentmethodcatalog) { + this.paymentmethodcatalog = pPaymentmethodcatalog; + } + + /** + * Obtiene el valor de paymentmethodcatalogcode + * + * @return valor de paymentmethodcatalogcode + */ + public String getPaymentmethodcatalogcode() { + return this.paymentmethodcatalogcode; + } + + /** + * Fija el valor de paymentmethodcatalogcode + * + * @param pPaymentmethodcatalogcode nuevo Valor de paymentmethodcatalogcode + */ + public void setPaymentmethodcatalogcode(String pPaymentmethodcatalogcode) { + this.paymentmethodcatalogcode = pPaymentmethodcatalogcode; + } + + /** + * Obtiene el valor de maxcredit + * + * @return valor de maxcredit + */ + public BigDecimal getMaxcredit() { + return this.maxcredit; + } + + /** + * Fija el valor de maxcredit + * + * @param pMaxcredit nuevo Valor de maxcredit + */ + public void setMaxcredit(BigDecimal pMaxcredit) { + this.maxcredit = pMaxcredit; + } + + /** + * Obtiene el valor de annualpurchase + * + * @return valor de annualpurchase + */ + public BigDecimal getAnnualpurchase() { + return this.annualpurchase; + } + + /** + * Fija el valor de annualpurchase + * + * @param pAnnualpurchase nuevo Valor de annualpurchase + */ + public void setAnnualpurchase(BigDecimal pAnnualpurchase) { + this.annualpurchase = pAnnualpurchase; + } + + /** + * Obtiene el valor de clientdate + * + * @return valor de clientdate + */ + public Date getClientdate() { + return this.clientdate; + } + + /** + * Fija el valor de clientdate + * + * @param pClientdate nuevo Valor de clientdate + */ + public void setClientdate(Date pClientdate) { + this.clientdate = pClientdate; + } + + /** + * Obtiene el valor de name + * + * @return valor de name + */ + public String getName() { + return this.name; + } + + /** + * Fija el valor de name + * + * @param pName nuevo Valor de name + */ + public void setName(String pName) { + this.name = pName; + } + + /** + * Obtiene el valor de remark + * + * @return valor de remark + */ + public String getRemark() { + return this.remark; + } + + /** + * Fija el valor de remark + * + * @param pRemark nuevo Valor de remark + */ + public void setRemark(String pRemark) { + this.remark = pRemark; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return this.ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + this.ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return this.modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + this.modifyuser = pModifyuser; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustCompanyClient)) { + return false; + } + TcustCompanyClient that = (TcustCompanyClient) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustCompanyClient + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustCompanyClient + */ + @Override + public Object createInstance() { + TcustCompanyClient instance = new TcustCompanyClient(); + instance.setPk(new TcustCompanyClientKey()); + return instance; + } + + /** + * Clona la entidad TcustCompanyClient + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustCompanyClient p = (TcustCompanyClient) this.clone(); + p.setPk((TcustCompanyClientKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyClientKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyClientKey.java new file mode 100644 index 0000000..9d63199 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyClientKey.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.company; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTCOMPANYCLIENT*/ +@Embeddable +public class TcustCompanyClientKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="CLIENTSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del ingreso del cliente +*/ +private Integer clientsequence; + +/**Contructor por defecto*/ +public TcustCompanyClientKey(){} +/**Contructor de TcustCompanyClientKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pClientsequence Secuencia del ingreso del cliente +*/ +public TcustCompanyClientKey(Integer pPersoncode,Timestamp pDateto,Integer pClientsequence){ + personcode=pPersoncode; + dateto=pDateto; + clientsequence=pClientsequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de clientsequence +@return valor de clientsequence*/ +public Integer getClientsequence(){ + return clientsequence; +} +/**Fija el valor de clientsequence +@param pClientsequence nuevo Valor de clientsequence*/ +public void setClientsequence(Integer pClientsequence){ + clientsequence=pClientsequence; +} + +/**Implementacin de la comparacin de TcustCompanyClientKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustCompanyClientKey))return false; + TcustCompanyClientKey that = (TcustCompanyClientKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getClientsequence() == null || that.getClientsequence() == null){ + return false; + } + if (! this.getClientsequence().equals(that.getClientsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustCompanyClientKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getClientsequence() == null ? 0 : this.getClientsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyFinancial.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyFinancial.java new file mode 100644 index 0000000..a676593 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyFinancial.java @@ -0,0 +1,662 @@ +package com.fp.persistence.pcustomer.company; + +import java.sql.Timestamp; +import java.io.Serializable; +import javax.persistence.Table; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; +import javax.persistence.Version; +import javax.persistence.Entity; +import javax.persistence.EmbeddedId; +import javax.persistence.EntityManager; +import javax.persistence.Column; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTCOMPANYFINANCIAL + */ +@Entity(name = "TcustCompanyFinancial") +@Table(name = "TCUSTCOMPANYFINANCIAL") +public class TcustCompanyFinancial extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustCompanyFinancial + */ + @EmbeddedId + private TcustCompanyFinancialKey pk; + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + @Column(name = "DATEFROM", nullable = false) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el cliente + */ + private String ingressuser; + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del cliente + */ + private String modifyuser; + @Column(name = "SITUATIONDATE", nullable = true) + /** + * Fecha a la cual se tiene actualizada la situacion financiera de la + * compania. + */ + private Date situationdate; + @Column(name = "SALESAMOUNT", nullable = true) + /** + * Monto ventas a la fecha de ingreso de la situacion financiera + */ + private BigDecimal salesamount; + @Column(name = "CURRENTASSETS", nullable = true) + /** + * Activos corrientes a la fecha de ingreso de la situacion financiera. + */ + private BigDecimal currentassets; + @Column(name = "FIXEDASSETS", nullable = true) + /** + * Activos fijos a la fecha de ingreso de la situacion financiera + */ + private BigDecimal fixedassets; + @Column(name = "TOTALASSETS", nullable = true) + /** + * Total de activos activos corrienets + activos fijos + cuentas por cobrar + * a la fecha de ingreso de la situacion financiera + */ + private BigDecimal totalassets; + @Column(name = "WORKINGCAPITAL", nullable = true) + /** + * Capital de trabajo a la fecha de ingreso de la situacion financiera + */ + private BigDecimal workingcapital; + @Column(name = "NETINCOME", nullable = true) + /** + * Utilidad neta a la fecha de ingreso de la situacion financiera. + */ + private BigDecimal netincome; + @Column(name = "CURRENTLIABILITIES", nullable = true) + /** + * Pasivos corrientes a la fecha de ingreso de la situacion financiera. + */ + private BigDecimal currentliabilities; + @Column(name = "PATRIMONY", nullable = true) + /** + * Patrimonio a la fecha de ingreso de la situacion financiera + */ + private BigDecimal patrimony; + @Column(name = "CASH", nullable = true) + /** + * Monto en caja y bancos a la fecha de ingreso de la situacion financiera + */ + private BigDecimal cash; + @Column(name = "INVENTORY", nullable = true) + /** + * Monto en productos para la venta en stock a la fecha de ingreso de la + * situacion financiera + */ + private BigDecimal inventory; + @Column(name = "LONGTERMDEBT", nullable = true) + /** + * Deuda a largo plazo a la fecha de ingreso de la situacion financiera + */ + private BigDecimal longtermdebt; + @Column(name = "GROSSRECEIPTS", nullable = true) + /** + * Ingreos brutos ventas netas + otros ingresos a la fecha de ingreso de la + * situacion financiera + */ + private BigDecimal grossreceipts; + @Column(name = "INTERESTOPAID", nullable = true) + /** + * Monto pagado en intereses a la fecha de ingreso de la situacion + * financiera + */ + private BigDecimal interestopaid; + @Column(name = "RETAINEDEARNINGS", nullable = true) + /** + * Ganancias retenidas a la fecha de ingreso de la situacion financiera + */ + private BigDecimal retainedearnings; + @Column(name = "SALESEXPENSE", nullable = true) + /** + * Costo de ventas a la fecha de ingreso de la situacion financiera + */ + private BigDecimal salesexpense; + + /** + * Contructor por defecto + */ + public TcustCompanyFinancial() { + } + + /** + * Contructor de TcustCompanyFinancial + * + * @param pPk Clave Primaria del entity + * @param pDatefrom Fecha desde la cual esta vigente el registro + */ + public TcustCompanyFinancial(TcustCompanyFinancialKey pPk, Timestamp pDatefrom) { + this(); + pk = pPk; + datefrom = pDatefrom; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustCompanyFinancial + */ + public static TcustCompanyFinancial find(EntityManager pEntityManager, TcustCompanyFinancialKey pKey) throws Exception { + TcustCompanyFinancial obj = pEntityManager.find(TcustCompanyFinancial.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustCompanyFinancial + * + * @return El objeto que referencia a la Clave primaria de + * TcustCompanyFinancial + */ + public TcustCompanyFinancialKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustCompanyFinancial + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustCompanyFinancial + */ + public void setPk(TcustCompanyFinancialKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + modifyuser = pModifyuser; + } + + /** + * Obtiene el valor de situationdate + * + * @return valor de situationdate + */ + public Date getSituationdate() { + return situationdate; + } + + /** + * Fija el valor de situationdate + * + * @param pSituationdate nuevo Valor de situationdate + */ + public void setSituationdate(Date pSituationdate) { + situationdate = pSituationdate; + } + + /** + * Obtiene el valor de salesamount + * + * @return valor de salesamount + */ + public BigDecimal getSalesamount() { + return salesamount; + } + + /** + * Fija el valor de salesamount + * + * @param pSalesamount nuevo Valor de salesamount + */ + public void setSalesamount(BigDecimal pSalesamount) { + salesamount = pSalesamount; + } + + /** + * Obtiene el valor de currentassets + * + * @return valor de currentassets + */ + public BigDecimal getCurrentassets() { + return currentassets; + } + + /** + * Fija el valor de currentassets + * + * @param pCurrentassets nuevo Valor de currentassets + */ + public void setCurrentassets(BigDecimal pCurrentassets) { + currentassets = pCurrentassets; + } + + /** + * Obtiene el valor de fixedassets + * + * @return valor de fixedassets + */ + public BigDecimal getFixedassets() { + return fixedassets; + } + + /** + * Fija el valor de fixedassets + * + * @param pFixedassets nuevo Valor de fixedassets + */ + public void setFixedassets(BigDecimal pFixedassets) { + fixedassets = pFixedassets; + } + + /** + * Obtiene el valor de totalassets + * + * @return valor de totalassets + */ + public BigDecimal getTotalassets() { + return totalassets; + } + + /** + * Fija el valor de totalassets + * + * @param pTotalassets nuevo Valor de totalassets + */ + public void setTotalassets(BigDecimal pTotalassets) { + totalassets = pTotalassets; + } + + /** + * Obtiene el valor de workingcapital + * + * @return valor de workingcapital + */ + public BigDecimal getWorkingcapital() { + return workingcapital; + } + + /** + * Fija el valor de workingcapital + * + * @param pWorkingcapital nuevo Valor de workingcapital + */ + public void setWorkingcapital(BigDecimal pWorkingcapital) { + workingcapital = pWorkingcapital; + } + + /** + * Obtiene el valor de netincome + * + * @return valor de netincome + */ + public BigDecimal getNetincome() { + return netincome; + } + + /** + * Fija el valor de netincome + * + * @param pNetincome nuevo Valor de netincome + */ + public void setNetincome(BigDecimal pNetincome) { + netincome = pNetincome; + } + + /** + * Obtiene el valor de currentliabilities + * + * @return valor de currentliabilities + */ + public BigDecimal getCurrentliabilities() { + return currentliabilities; + } + + /** + * Fija el valor de currentliabilities + * + * @param pCurrentliabilities nuevo Valor de currentliabilities + */ + public void setCurrentliabilities(BigDecimal pCurrentliabilities) { + currentliabilities = pCurrentliabilities; + } + + /** + * Obtiene el valor de patrimony + * + * @return valor de patrimony + */ + public BigDecimal getPatrimony() { + return patrimony; + } + + /** + * Fija el valor de patrimony + * + * @param pPatrimony nuevo Valor de patrimony + */ + public void setPatrimony(BigDecimal pPatrimony) { + patrimony = pPatrimony; + } + + /** + * Obtiene el valor de cash + * + * @return valor de cash + */ + public BigDecimal getCash() { + return cash; + } + + /** + * Fija el valor de cash + * + * @param pCash nuevo Valor de cash + */ + public void setCash(BigDecimal pCash) { + cash = pCash; + } + + /** + * Obtiene el valor de inventory + * + * @return valor de inventory + */ + public BigDecimal getInventory() { + return inventory; + } + + /** + * Fija el valor de inventory + * + * @param pInventory nuevo Valor de inventory + */ + public void setInventory(BigDecimal pInventory) { + inventory = pInventory; + } + + /** + * Obtiene el valor de longtermdebt + * + * @return valor de longtermdebt + */ + public BigDecimal getLongtermdebt() { + return longtermdebt; + } + + /** + * Fija el valor de longtermdebt + * + * @param pLongtermdebt nuevo Valor de longtermdebt + */ + public void setLongtermdebt(BigDecimal pLongtermdebt) { + longtermdebt = pLongtermdebt; + } + + /** + * Obtiene el valor de grossreceipts + * + * @return valor de grossreceipts + */ + public BigDecimal getGrossreceipts() { + return grossreceipts; + } + + /** + * Fija el valor de grossreceipts + * + * @param pGrossreceipts nuevo Valor de grossreceipts + */ + public void setGrossreceipts(BigDecimal pGrossreceipts) { + grossreceipts = pGrossreceipts; + } + + /** + * Obtiene el valor de interestopaid + * + * @return valor de interestopaid + */ + public BigDecimal getInterestopaid() { + return interestopaid; + } + + /** + * Fija el valor de interestopaid + * + * @param pInterestopaid nuevo Valor de interestopaid + */ + public void setInterestopaid(BigDecimal pInterestopaid) { + interestopaid = pInterestopaid; + } + + /** + * Obtiene el valor de retainedearnings + * + * @return valor de retainedearnings + */ + public BigDecimal getRetainedearnings() { + return retainedearnings; + } + + /** + * Fija el valor de retainedearnings + * + * @param pRetainedearnings nuevo Valor de retainedearnings + */ + public void setRetainedearnings(BigDecimal pRetainedearnings) { + retainedearnings = pRetainedearnings; + } + + /** + * Obtiene el valor de salesexpense + * + * @return valor de salesexpense + */ + public BigDecimal getSalesexpense() { + return salesexpense; + } + + /** + * Fija el valor de salesexpense + * + * @param pSalesexpense nuevo Valor de salesexpense + */ + public void setSalesexpense(BigDecimal pSalesexpense) { + salesexpense = pSalesexpense; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustCompanyFinancial)) { + return false; + } + TcustCompanyFinancial that = (TcustCompanyFinancial) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TcustCompanyFinancial + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco TcustCompanyFinancial + */ + public Object createInstance() { + TcustCompanyFinancial instance = new TcustCompanyFinancial(); + instance.setPk(new TcustCompanyFinancialKey()); + return instance; + } + + /** + * Clona la entidad TcustCompanyFinancial + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustCompanyFinancial p = (TcustCompanyFinancial) this.clone(); + p.setPk((TcustCompanyFinancialKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyFinancialKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyFinancialKey.java new file mode 100644 index 0000000..96b44c2 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyFinancialKey.java @@ -0,0 +1,129 @@ +package com.fp.persistence.pcustomer.company; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTCOMPANYFINANCIAL*/ +@Embeddable +public class TcustCompanyFinancialKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TcustCompanyFinancialKey(){} +/**Contructor de TcustCompanyFinancialKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +*/ +public TcustCompanyFinancialKey(Integer pPersoncode,Timestamp pDateto){ + personcode=pPersoncode; + dateto=pDateto; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TcustCompanyFinancialKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustCompanyFinancialKey))return false; + TcustCompanyFinancialKey that = (TcustCompanyFinancialKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustCompanyFinancialKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyKey.java new file mode 100644 index 0000000..bb1a4e8 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyKey.java @@ -0,0 +1,129 @@ +package com.fp.persistence.pcustomer.company; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTCOMPANY*/ +@Embeddable +public class TcustCompanyKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro. +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TcustCompanyKey(){} +/**Contructor de TcustCompanyKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro. +*/ +public TcustCompanyKey(Integer pPersoncode,Timestamp pDateto){ + personcode=pPersoncode; + dateto=pDateto; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TcustCompanyKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustCompanyKey))return false; + TcustCompanyKey that = (TcustCompanyKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustCompanyKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyManagers.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyManagers.java new file mode 100644 index 0000000..0e2a757 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyManagers.java @@ -0,0 +1,438 @@ +package com.fp.persistence.pcustomer.company; + +import com.fp.common.helper.Constant; +import java.sql.Timestamp; +import com.fp.dto.hb.Log; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import javax.persistence.Entity; +import javax.persistence.EmbeddedId; +import javax.persistence.EntityManager; +import javax.persistence.Column; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; +import java.util.List; +import javax.persistence.Query; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTCOMPANYMANAGERS + */ +@Entity(name = "TcustCompanyManagers") +@Table(name = "TCUSTCOMPANYMANAGERS") +public class TcustCompanyManagers extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustCompanyManagers + */ + @EmbeddedId + private TcustCompanyManagersKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "DESIGNATIONDATE", nullable = true) + /** + * Fecha de nombramiento + */ + private Date designationdate; + @Column(name = "EXPIRATIONDATE", nullable = true) + /** + * Fecha de vencimiento del nombramiento + */ + private Date expirationdate; + @Column(name = "REGISTERDATE", nullable = true) + /** + * Fecha en la que se incribe el nombramiento en los organismos de control, ejemoplo registro mercail, + * superintendencia de companias + */ + private Date registerdate; + @Column(name = "REMARK", nullable = true) + /** + * Comentario + */ + private String remark; + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el cliente + */ + private String ingressuser; + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del cliente + */ + private String modifyuser; + @Column(name = "ISREPRESENTLEGAL", nullable = true) + /** + * I dentifica si el directivo es el representante legal de la empresa + */ + private String isrepresentlegal; + @Column(name = "PARTICIPATION", nullable = true) + /** + * Porcentaje de particicion del socio dentro de la empresa. + */ + private BigDecimal participation; + + /** + * Contructor por defecto + */ + public TcustCompanyManagers() { + } + + /** + * Contructor de TcustCompanyManagers + * + * @param pPk Clave Primaria del entity + */ + public TcustCompanyManagers(TcustCompanyManagersKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustCompanyManagers + */ + public static TcustCompanyManagers find(EntityManager pEntityManager, TcustCompanyManagersKey pKey) throws Exception { + TcustCompanyManagers obj = pEntityManager.find(TcustCompanyManagers.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustCompanyManagers + * + * @return El objeto que referencia a la Clave primaria de TcustCompanyManagers + */ + public TcustCompanyManagersKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustCompanyManagers + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TcustCompanyManagers + */ + public void setPk(TcustCompanyManagersKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de designationdate + * + * @return valor de designationdate + */ + public Date getDesignationdate() { + return designationdate; + } + + /** + * Fija el valor de designationdate + * + * @param pDesignationdate nuevo Valor de designationdate + */ + public void setDesignationdate(Date pDesignationdate) { + designationdate = pDesignationdate; + } + + /** + * Obtiene el valor de expirationdate + * + * @return valor de expirationdate + */ + public Date getExpirationdate() { + return expirationdate; + } + + /** + * Fija el valor de expirationdate + * + * @param pExpirationdate nuevo Valor de expirationdate + */ + public void setExpirationdate(Date pExpirationdate) { + expirationdate = pExpirationdate; + } + + /** + * Obtiene el valor de registerdate + * + * @return valor de registerdate + */ + public Date getRegisterdate() { + return registerdate; + } + + /** + * Fija el valor de registerdate + * + * @param pRegisterdate nuevo Valor de registerdate + */ + public void setRegisterdate(Date pRegisterdate) { + registerdate = pRegisterdate; + } + + /** + * Obtiene el valor de remark + * + * @return valor de remark + */ + public String getRemark() { + return remark; + } + + /** + * Fija el valor de remark + * + * @param pRemark nuevo Valor de remark + */ + public void setRemark(String pRemark) { + remark = pRemark; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + modifyuser = pModifyuser; + } + + /** + * Obtiene el valor de isrepresentlegal + * + * @return valor de isrepresentlegal + */ + public String getIsrepresentlegal() { + return isrepresentlegal; + } + + /** + * Fija el valor de isrepresentlegal + * + * @param pIsrepresentlegal nuevo Valor de isrepresentlegal + */ + public void setIsrepresentlegal(String pIsrepresentlegal) { + isrepresentlegal = pIsrepresentlegal; + } + + /** + * Obtiene el valor de participation + * + * @return valor de participation + */ + public BigDecimal getParticipation() { + return participation; + } + + /** + * Fija el valor de participation + * + * @param pParticipation nuevo Valor de participation + */ + public void setParticipation(BigDecimal pParticipation) { + participation = pParticipation; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustCompanyManagers)) { + return false; + } + TcustCompanyManagers that = (TcustCompanyManagers) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TcustCompanyManagers + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacion toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacion de la creacion de un bean en blanco TcustCompanyManagers + */ + public Object createInstance() { + TcustCompanyManagers instance = new TcustCompanyManagers(); + instance.setPk(new TcustCompanyManagersKey()); + return instance; + } + + /** + * Clona la entidad TcustCompanyManagers + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustCompanyManagers p = (TcustCompanyManagers) this.clone(); + p.setPk((TcustCompanyManagersKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +//METODOS MANUALES. + private static final String JPQL_MANAGERS = "from TcustCompanyManagers c" + " where c.pk.personcode = :personcode " + + " and c.pk.dateto = :dateto "; + + /** + * Metodo que devuelve una lista de objetos TcustCompanyManagers dado el codigo de persona + * + * @param pEntityManager + * @param personcode codigo de persona + * @return List + * @throws Exception + */ + public static List find(EntityManager pEntityManager, Integer personcode) throws Exception { + List lcomManagers = null; + Query qry = pEntityManager.createQuery(TcustCompanyManagers.JPQL_MANAGERS); + qry.setParameter("personcode", personcode); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + lcomManagers = qry.getResultList(); + return lcomManagers; + } + //METODOS MANUALES + /** + * Sentencia que devuelve las excepciones de una solicitud. + */ + private static final String JPQL_SOL_TCUSTCOMPANYMANAGERS = "from TcustCompanyManagers tcustCompanyManagers " + + " where tcustCompanyManagers.pk.personcode = :personcode " + "and tcustCompanyManagers.pk.dateto = :dateto"; + + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findByPersonCode(EntityManager pEntityManager, Integer pPersonCode) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(TcustCompanyManagers.JPQL_SOL_TCUSTCOMPANYMANAGERS); + qry.setParameter("personcode", pPersonCode); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + lObjects = qry.getResultList(); + return lObjects; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyManagersKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyManagersKey.java new file mode 100644 index 0000000..908a632 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyManagersKey.java @@ -0,0 +1,210 @@ +package com.fp.persistence.pcustomer.company; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTCOMPANYMANAGERS*/ +@Embeddable +public class TcustCompanyManagersKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="MANAGERPERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona asociado al directivo de la empresa +*/ +private Integer managerpersoncode; + +@Column(name="APPOINTMENTCATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo de tipo de cargo, 1 Gerente, 2 Contador +*/ +private String appointmentcatalog; + +@Column(name="APPOINTMENTCATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo de tipo de empresa APPOINTMENT +*/ +private String appointmentcatalogcode; + +/**Contructor por defecto*/ +public TcustCompanyManagersKey(){} +/**Contructor de TcustCompanyManagersKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pManagerpersoncode Codigo de persona asociado al directivo de la empresa +@param pAppointmentcatalog Codigo de catalogo de tipo de cargo, 1 Gerente, 2 Contador +@param pAppointmentcatalogcode Codigo de tabla de catalogo de tipo de empresa APPOINTMENT +*/ +public TcustCompanyManagersKey(Integer pPersoncode,Timestamp pDateto,Integer pManagerpersoncode,String pAppointmentcatalog,String pAppointmentcatalogcode){ + personcode=pPersoncode; + dateto=pDateto; + managerpersoncode=pManagerpersoncode; + appointmentcatalog=pAppointmentcatalog; + appointmentcatalogcode=pAppointmentcatalogcode; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de managerpersoncode +@return valor de managerpersoncode*/ +public Integer getManagerpersoncode(){ + return managerpersoncode; +} +/**Fija el valor de managerpersoncode +@param pManagerpersoncode nuevo Valor de managerpersoncode*/ +public void setManagerpersoncode(Integer pManagerpersoncode){ + managerpersoncode=pManagerpersoncode; +} + +/**Obtiene el valor de appointmentcatalog +@return valor de appointmentcatalog*/ +public String getAppointmentcatalog(){ + return appointmentcatalog; +} +/**Fija el valor de appointmentcatalog +@param pAppointmentcatalog nuevo Valor de appointmentcatalog*/ +public void setAppointmentcatalog(String pAppointmentcatalog){ + appointmentcatalog=pAppointmentcatalog; +} + +/**Obtiene el valor de appointmentcatalogcode +@return valor de appointmentcatalogcode*/ +public String getAppointmentcatalogcode(){ + return appointmentcatalogcode; +} +/**Fija el valor de appointmentcatalogcode +@param pAppointmentcatalogcode nuevo Valor de appointmentcatalogcode*/ +public void setAppointmentcatalogcode(String pAppointmentcatalogcode){ + appointmentcatalogcode=pAppointmentcatalogcode; +} + +/**Implementacion de la comparacion de TcustCompanyManagersKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustCompanyManagersKey))return false; + TcustCompanyManagersKey that = (TcustCompanyManagersKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getManagerpersoncode() == null || that.getManagerpersoncode() == null){ + return false; + } + if (! this.getManagerpersoncode().equals(that.getManagerpersoncode())){ + return false; + } + if (this.getAppointmentcatalog() == null || that.getAppointmentcatalog() == null){ + return false; + } + if (! this.getAppointmentcatalog().equals(that.getAppointmentcatalog())){ + return false; + } + if (this.getAppointmentcatalogcode() == null || that.getAppointmentcatalogcode() == null){ + return false; + } + if (! this.getAppointmentcatalogcode().equals(that.getAppointmentcatalogcode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TcustCompanyManagersKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getManagerpersoncode() == null ? 0 : this.getManagerpersoncode().hashCode()); + result = result * 37 + (this.getAppointmentcatalog() == null ? 0 : this.getAppointmentcatalog().hashCode()); + result = result * 37 + (this.getAppointmentcatalogcode() == null ? 0 : this.getAppointmentcatalogcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyProducts.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyProducts.java new file mode 100644 index 0000000..bef0217 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyProducts.java @@ -0,0 +1,428 @@ +package com.fp.persistence.pcustomer.company; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTCOMPANYPRODUCTS + */ +@Entity(name = "TcustCompanyProducts") +@Table(name = "TCUSTCOMPANYPRODUCTS") +public class TcustCompanyProducts extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TcustCompanyProducts + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(PRODUCTSEQUENCE),0)+1 from TCUSTCOMPANYPRODUCTS where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "productsequence") }) + @GeneratedValue(generator = "seq_id") + private TcustCompanyProductsKey pk; + + @Column(name = "DATEFROM", nullable = false) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "MARKETINGTYPECATALOG", nullable = true) + /** + * Codigo de catalogo 1, masivo, 2 persona a persona, directa, tercerizada + */ + private String marketingtypecatalog; + + @Column(name = "MARKETINGTYPECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo MARKETINGTYPE, forma de comercializacion + */ + private String marketingtypecatalogcode; + + @Column(name = "ANNUALSALES", nullable = true) + /** + * Monto ventas anuales + */ + private BigDecimal annualsales; + + @Column(name = "PRODUCTDETAIL", nullable = true) + /** + * Descripcion del producto + */ + private String productdetail; + + @Column(name = "PERCENT", nullable = true) + /** + * Porcentaje de ventas del producto dentro de la empresa + */ + private BigDecimal percent; + + @Column(name = "ISSERVICE", nullable = true) + /** + * Y indica, que el producto es un servicio, N es un producto final o + * entrada para otro producto + */ + private String isservice; + + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el cliente + */ + private String ingressuser; + + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del cliente + */ + private String modifyuser; + + /** + * Contructor por defecto + */ + public TcustCompanyProducts() { + } + + /** + * Contructor de TcustCompanyProducts + * + * @param pPk Clave Primaria del entity + * @param pDatefrom Fecha desde la cual esta vigente el registro + */ + public TcustCompanyProducts(TcustCompanyProductsKey pPk, Timestamp pDatefrom) { + this(); + this.pk = pPk; + this.datefrom = pDatefrom; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustCompanyProducts + */ + public static TcustCompanyProducts find(EntityManager pEntityManager, TcustCompanyProductsKey pKey) throws Exception { + TcustCompanyProducts obj = pEntityManager.find(TcustCompanyProducts.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustCompanyProducts + * + * @return El objeto que referencia a la Clave primaria de TcustCompanyProducts + */ + public TcustCompanyProductsKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustCompanyProducts + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TcustCompanyProducts + */ + public void setPk(TcustCompanyProductsKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de marketingtypecatalog + * + * @return valor de marketingtypecatalog + */ + public String getMarketingtypecatalog() { + return this.marketingtypecatalog; + } + + /** + * Fija el valor de marketingtypecatalog + * + * @param pMarketingtypecatalog nuevo Valor de marketingtypecatalog + */ + public void setMarketingtypecatalog(String pMarketingtypecatalog) { + this.marketingtypecatalog = pMarketingtypecatalog; + } + + /** + * Obtiene el valor de marketingtypecatalogcode + * + * @return valor de marketingtypecatalogcode + */ + public String getMarketingtypecatalogcode() { + return this.marketingtypecatalogcode; + } + + /** + * Fija el valor de marketingtypecatalogcode + * + * @param pMarketingtypecatalogcode nuevo Valor de marketingtypecatalogcode + */ + public void setMarketingtypecatalogcode(String pMarketingtypecatalogcode) { + this.marketingtypecatalogcode = pMarketingtypecatalogcode; + } + + /** + * Obtiene el valor de annualsales + * + * @return valor de annualsales + */ + public BigDecimal getAnnualsales() { + return this.annualsales; + } + + /** + * Fija el valor de annualsales + * + * @param pAnnualsales nuevo Valor de annualsales + */ + public void setAnnualsales(BigDecimal pAnnualsales) { + this.annualsales = pAnnualsales; + } + + /** + * Obtiene el valor de productdetail + * + * @return valor de productdetail + */ + public String getProductdetail() { + return this.productdetail; + } + + /** + * Fija el valor de productdetail + * + * @param pProductdetail nuevo Valor de productdetail + */ + public void setProductdetail(String pProductdetail) { + this.productdetail = pProductdetail; + } + + /** + * Obtiene el valor de percent + * + * @return valor de percent + */ + public BigDecimal getPercent() { + return this.percent; + } + + /** + * Fija el valor de percent + * + * @param pPercent nuevo Valor de percent + */ + public void setPercent(BigDecimal pPercent) { + this.percent = pPercent; + } + + /** + * Obtiene el valor de isservice + * + * @return valor de isservice + */ + public String getIsservice() { + return this.isservice; + } + + /** + * Fija el valor de isservice + * + * @param pIsservice nuevo Valor de isservice + */ + public void setIsservice(String pIsservice) { + this.isservice = pIsservice; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return this.ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + this.ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return this.modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + this.modifyuser = pModifyuser; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustCompanyProducts)) { + return false; + } + TcustCompanyProducts that = (TcustCompanyProducts) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustCompanyProducts + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustCompanyProducts + */ + @Override + public Object createInstance() { + TcustCompanyProducts instance = new TcustCompanyProducts(); + instance.setPk(new TcustCompanyProductsKey()); + return instance; + } + + /** + * Clona la entidad TcustCompanyProducts + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustCompanyProducts p = (TcustCompanyProducts) this.clone(); + p.setPk((TcustCompanyProductsKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyProductsKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyProductsKey.java new file mode 100644 index 0000000..01597ce --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyProductsKey.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.company; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTCOMPANYPRODUCTS*/ +@Embeddable +public class TcustCompanyProductsKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="PRODUCTSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del ingreso de la persona +*/ +private Integer productsequence; + +/**Contructor por defecto*/ +public TcustCompanyProductsKey(){} +/**Contructor de TcustCompanyProductsKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pProductsequence Secuencia del ingreso de la persona +*/ +public TcustCompanyProductsKey(Integer pPersoncode,Timestamp pDateto,Integer pProductsequence){ + personcode=pPersoncode; + dateto=pDateto; + productsequence=pProductsequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de productsequence +@return valor de productsequence*/ +public Integer getProductsequence(){ + return productsequence; +} +/**Fija el valor de productsequence +@param pProductsequence nuevo Valor de productsequence*/ +public void setProductsequence(Integer pProductsequence){ + productsequence=pProductsequence; +} + +/**Implementacin de la comparacin de TcustCompanyProductsKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustCompanyProductsKey))return false; + TcustCompanyProductsKey that = (TcustCompanyProductsKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getProductsequence() == null || that.getProductsequence() == null){ + return false; + } + if (! this.getProductsequence().equals(that.getProductsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustCompanyProductsKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getProductsequence() == null ? 0 : this.getProductsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyProvider.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyProvider.java new file mode 100644 index 0000000..365db4b --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyProvider.java @@ -0,0 +1,500 @@ +package com.fp.persistence.pcustomer.company; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTCOMPANYPROVIDER + */ +@Entity(name = "TcustCompanyProvider") +@Table(name = "TCUSTCOMPANYPROVIDER") +public class TcustCompanyProvider extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TcustCompanyProvider + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(PROVIDERSEQUENCE),0)+1 from TCUSTCOMPANYPROVIDER where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "providersequence") }) + @GeneratedValue(generator = "seq_id") + private TcustCompanyProviderKey pk; + + @Column(name = "DATEFROM", nullable = false) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "PROVIDERPERSONCODE", nullable = true) + /** + * Codigo de persona asociada al proveedor de la empresa + */ + private Integer providerpersoncode; + + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + + @Column(name = "PAYMENTMETHODCATALOG", nullable = true) + /** + * Codigo de catalogo 1, efectivo, 2 cheque, 3 credito + */ + private String paymentmethodcatalog; + + @Column(name = "PAYMENTMETHODCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo PAYMENTMETHOD de la forma de pago + */ + private String paymentmethodcatalogcode; + + @Column(name = "MAXCREDIT", nullable = true) + /** + * Monto maximo de creditos. + */ + private BigDecimal maxcredit; + + @Column(name = "ANNUALPURCHASE", nullable = true) + /** + * Monto de compras anuales de la compania al proveedor + */ + private BigDecimal annualpurchase; + + @Column(name = "PROVIDERDATE", nullable = true) + /** + * Fecha desde la cual la persona es proveedor de la compania + */ + private Date providerdate; + + @Column(name = "NAME", nullable = true) + /** + * Nombre del proveedor si no esta en la base de personas + */ + private String name; + + @Column(name = "REMARK", nullable = true) + /** + * Comentarios + */ + private String remark; + + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el cliente + */ + private String ingressuser; + + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del cliente + */ + private String modifyuser; + + /** + * Contructor por defecto + */ + public TcustCompanyProvider() { + } + + /** + * Contructor de TcustCompanyProvider + * + * @param pPk Clave Primaria del entity + * @param pDatefrom Fecha desde la cual esta vigente el registro + */ + public TcustCompanyProvider(TcustCompanyProviderKey pPk, Timestamp pDatefrom) { + this(); + this.pk = pPk; + this.datefrom = pDatefrom; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustCompanyProvider + */ + public static TcustCompanyProvider find(EntityManager pEntityManager, TcustCompanyProviderKey pKey) throws Exception { + TcustCompanyProvider obj = pEntityManager.find(TcustCompanyProvider.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustCompanyProvider + * + * @return El objeto que referencia a la Clave primaria de TcustCompanyProvider + */ + public TcustCompanyProviderKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustCompanyProvider + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TcustCompanyProvider + */ + public void setPk(TcustCompanyProviderKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de providerpersoncode + * + * @return valor de providerpersoncode + */ + public Integer getProviderpersoncode() { + return this.providerpersoncode; + } + + /** + * Fija el valor de providerpersoncode + * + * @param pProviderpersoncode nuevo Valor de providerpersoncode + */ + public void setProviderpersoncode(Integer pProviderpersoncode) { + this.providerpersoncode = pProviderpersoncode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de paymentmethodcatalog + * + * @return valor de paymentmethodcatalog + */ + public String getPaymentmethodcatalog() { + return this.paymentmethodcatalog; + } + + /** + * Fija el valor de paymentmethodcatalog + * + * @param pPaymentmethodcatalog nuevo Valor de paymentmethodcatalog + */ + public void setPaymentmethodcatalog(String pPaymentmethodcatalog) { + this.paymentmethodcatalog = pPaymentmethodcatalog; + } + + /** + * Obtiene el valor de paymentmethodcatalogcode + * + * @return valor de paymentmethodcatalogcode + */ + public String getPaymentmethodcatalogcode() { + return this.paymentmethodcatalogcode; + } + + /** + * Fija el valor de paymentmethodcatalogcode + * + * @param pPaymentmethodcatalogcode nuevo Valor de paymentmethodcatalogcode + */ + public void setPaymentmethodcatalogcode(String pPaymentmethodcatalogcode) { + this.paymentmethodcatalogcode = pPaymentmethodcatalogcode; + } + + /** + * Obtiene el valor de maxcredit + * + * @return valor de maxcredit + */ + public BigDecimal getMaxcredit() { + return this.maxcredit; + } + + /** + * Fija el valor de maxcredit + * + * @param pMaxcredit nuevo Valor de maxcredit + */ + public void setMaxcredit(BigDecimal pMaxcredit) { + this.maxcredit = pMaxcredit; + } + + /** + * Obtiene el valor de annualpurchase + * + * @return valor de annualpurchase + */ + public BigDecimal getAnnualpurchase() { + return this.annualpurchase; + } + + /** + * Fija el valor de annualpurchase + * + * @param pAnnualpurchase nuevo Valor de annualpurchase + */ + public void setAnnualpurchase(BigDecimal pAnnualpurchase) { + this.annualpurchase = pAnnualpurchase; + } + + /** + * Obtiene el valor de providerdate + * + * @return valor de providerdate + */ + public Date getProviderdate() { + return this.providerdate; + } + + /** + * Fija el valor de providerdate + * + * @param pProviderdate nuevo Valor de providerdate + */ + public void setProviderdate(Date pProviderdate) { + this.providerdate = pProviderdate; + } + + /** + * Obtiene el valor de name + * + * @return valor de name + */ + public String getName() { + return this.name; + } + + /** + * Fija el valor de name + * + * @param pName nuevo Valor de name + */ + public void setName(String pName) { + this.name = pName; + } + + /** + * Obtiene el valor de remark + * + * @return valor de remark + */ + public String getRemark() { + return this.remark; + } + + /** + * Fija el valor de remark + * + * @param pRemark nuevo Valor de remark + */ + public void setRemark(String pRemark) { + this.remark = pRemark; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return this.ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + this.ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return this.modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + this.modifyuser = pModifyuser; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustCompanyProvider)) { + return false; + } + TcustCompanyProvider that = (TcustCompanyProvider) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustCompanyProvider + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustCompanyProvider + */ + @Override + public Object createInstance() { + TcustCompanyProvider instance = new TcustCompanyProvider(); + instance.setPk(new TcustCompanyProviderKey()); + return instance; + } + + /** + * Clona la entidad TcustCompanyProvider + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustCompanyProvider p = (TcustCompanyProvider) this.clone(); + p.setPk((TcustCompanyProviderKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyProviderKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyProviderKey.java new file mode 100644 index 0000000..2edcab8 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustCompanyProviderKey.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.company; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTCOMPANYPROVIDER*/ +@Embeddable +public class TcustCompanyProviderKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="PROVIDERSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del ingreso del proveedor +*/ +private Integer providersequence; + +/**Contructor por defecto*/ +public TcustCompanyProviderKey(){} +/**Contructor de TcustCompanyProviderKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pProvidersequence Secuencia del ingreso del proveedor +*/ +public TcustCompanyProviderKey(Integer pPersoncode,Timestamp pDateto,Integer pProvidersequence){ + personcode=pPersoncode; + dateto=pDateto; + providersequence=pProvidersequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de providersequence +@return valor de providersequence*/ +public Integer getProvidersequence(){ + return providersequence; +} +/**Fija el valor de providersequence +@param pProvidersequence nuevo Valor de providersequence*/ +public void setProvidersequence(Integer pProvidersequence){ + providersequence=pProvidersequence; +} + +/**Implementacin de la comparacin de TcustCompanyProviderKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustCompanyProviderKey))return false; + TcustCompanyProviderKey that = (TcustCompanyProviderKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getProvidersequence() == null || that.getProvidersequence() == null){ + return false; + } + if (! this.getProvidersequence().equals(that.getProvidersequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustCompanyProviderKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getProvidersequence() == null ? 0 : this.getProvidersequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustEconomicGroup.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustEconomicGroup.java new file mode 100644 index 0000000..712ad09 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustEconomicGroup.java @@ -0,0 +1,252 @@ +package com.fp.persistence.pcustomer.company; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTECONOMICGROUP*/ +@Entity(name="TcustEconomicGroup") +@Table(name="TCUSTECONOMICGROUP") +public class TcustEconomicGroup extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TcustEconomicGroup +*/ +@EmbeddedId +private TcustEconomicGroupKey pk; +@Column(name="LEGALLINKCATALOG", nullable=true) + +/** +* Codigo de catalogo PG1 Causales P01 y G01 +*/ +private String legallinkcatalog; + +@Column(name="LEGALLINKCATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo LEGALLINK vinculaciones legales +*/ +private String legallinkcatalogcode; + +@Version +@Column(name="RECORDVERSION", nullable=false) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="INGRESSDATE", nullable=true) + +/** +* Fecha de inicio de la vinculacion. +*/ +private Date ingressdate; + +@Column(name="EXITDATE", nullable=true) + +/** +* Fecha en la que finaliza la vinculacion de la persona. +*/ +private Date exitdate; + +@Column(name="INGRESSUSER", nullable=true) + +/** +* null +*/ +private String ingressuser; + +@Column(name="MODIFYUSER", nullable=true) + +/** +* Codigo de usuario que modifica datos del cliente +*/ +private String modifyuser; + +/**Contructor por defecto*/ +public TcustEconomicGroup(){ +} +/**Contructor de TcustEconomicGroup +@param pPk Clave Primaria del entity +@param pRecordversion Optimistic locking del registro +*/ +public TcustEconomicGroup(TcustEconomicGroupKey pPk,Integer pRecordversion){ + this(); + pk=pPk; + recordversion=pRecordversion; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TcustEconomicGroup +*/ +public static TcustEconomicGroup find(EntityManager pEntityManager,TcustEconomicGroupKey pKey) throws Exception{ + TcustEconomicGroup obj = pEntityManager.find(TcustEconomicGroup.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TcustEconomicGroup +@return El objeto que referencia a la Clave primaria de TcustEconomicGroup +*/ +public TcustEconomicGroupKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TcustEconomicGroup +@param pPk El objeto que referencia a la nueva Clave primaria de TcustEconomicGroup +*/ +public void setPk(TcustEconomicGroupKey pPk){ + pk=pPk; +} +/**Obtiene el valor de legallinkcatalog +@return valor de legallinkcatalog*/ +public String getLegallinkcatalog(){ + return legallinkcatalog; +} +/**Fija el valor de legallinkcatalog +@param pLegallinkcatalog nuevo Valor de legallinkcatalog*/ +public void setLegallinkcatalog(String pLegallinkcatalog){ + legallinkcatalog=pLegallinkcatalog; +} + +/**Obtiene el valor de legallinkcatalogcode +@return valor de legallinkcatalogcode*/ +public String getLegallinkcatalogcode(){ + return legallinkcatalogcode; +} +/**Fija el valor de legallinkcatalogcode +@param pLegallinkcatalogcode nuevo Valor de legallinkcatalogcode*/ +public void setLegallinkcatalogcode(String pLegallinkcatalogcode){ + legallinkcatalogcode=pLegallinkcatalogcode; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de ingressdate +@return valor de ingressdate*/ +public Date getIngressdate(){ + return ingressdate; +} +/**Fija el valor de ingressdate +@param pIngressdate nuevo Valor de ingressdate*/ +public void setIngressdate(Date pIngressdate){ + ingressdate=pIngressdate; +} + +/**Obtiene el valor de exitdate +@return valor de exitdate*/ +public Date getExitdate(){ + return exitdate; +} +/**Fija el valor de exitdate +@param pExitdate nuevo Valor de exitdate*/ +public void setExitdate(Date pExitdate){ + exitdate=pExitdate; +} + +/**Obtiene el valor de ingressuser +@return valor de ingressuser*/ +public String getIngressuser(){ + return ingressuser; +} +/**Fija el valor de ingressuser +@param pIngressuser nuevo Valor de ingressuser*/ +public void setIngressuser(String pIngressuser){ + ingressuser=pIngressuser; +} + +/**Obtiene el valor de modifyuser +@return valor de modifyuser*/ +public String getModifyuser(){ + return modifyuser; +} +/**Fija el valor de modifyuser +@param pModifyuser nuevo Valor de modifyuser*/ +public void setModifyuser(String pModifyuser){ + modifyuser=pModifyuser; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TcustEconomicGroup))return false; + TcustEconomicGroup that = (TcustEconomicGroup) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TcustEconomicGroup +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TcustEconomicGroup +*/ +public Object createInstance(){ + TcustEconomicGroup instance=new TcustEconomicGroup(); + instance.setPk(new TcustEconomicGroupKey()); + return instance; +} +/**Clona la entidad TcustEconomicGroup +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TcustEconomicGroup p=(TcustEconomicGroup)this.clone(); + p.setPk((TcustEconomicGroupKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustEconomicGroupKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustEconomicGroupKey.java new file mode 100644 index 0000000..32f530a --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustEconomicGroupKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pcustomer.company; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTECONOMICGROUP*/ +@Embeddable +public class TcustEconomicGroupKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="GROUPPERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer grouppersoncode; + +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TcustEconomicGroupKey(){} +/**Contructor de TcustEconomicGroupKey +@param pGrouppersoncode Codigo de persona +@param pPersoncode Codigo de persona +@param pCompanycode Codigo de compania +*/ +public TcustEconomicGroupKey(Integer pGrouppersoncode,Integer pPersoncode,Integer pCompanycode){ + grouppersoncode=pGrouppersoncode; + personcode=pPersoncode; + companycode=pCompanycode; +} +/**Obtiene el valor de grouppersoncode +@return valor de grouppersoncode*/ +public Integer getGrouppersoncode(){ + return grouppersoncode; +} +/**Fija el valor de grouppersoncode +@param pGrouppersoncode nuevo Valor de grouppersoncode*/ +public void setGrouppersoncode(Integer pGrouppersoncode){ + grouppersoncode=pGrouppersoncode; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacin de la comparacin de TcustEconomicGroupKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustEconomicGroupKey))return false; + TcustEconomicGroupKey that = (TcustEconomicGroupKey) o; + if (this.getGrouppersoncode() == null || that.getGrouppersoncode() == null){ + return false; + } + if (! this.getGrouppersoncode().equals(that.getGrouppersoncode())){ + return false; + } + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustEconomicGroupKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getGrouppersoncode() == null ? 0 : this.getGrouppersoncode().hashCode()); + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustFamiliarlLink.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustFamiliarlLink.java new file mode 100644 index 0000000..9f62dc9 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustFamiliarlLink.java @@ -0,0 +1,337 @@ +package com.fp.persistence.pcustomer.company; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.util.List; +import javax.persistence.Query; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTFAMILIARLLINK + */ +@Entity(name = "TcustFamiliarlLink") +@Table(name = "TCUSTFAMILIARLLINK") +public class TcustFamiliarlLink extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustFamiliarlLink + */ + @EmbeddedId + private TcustFamiliarlLinkKey pk; + @Column(name = "FAMILIARLINKCATALOG", nullable = true) + /** + * Codigo de catalogo 1 Padre, 3 Madre, 3 Hermano/a, 4 Conyuge. + */ + private String familiarlinkcatalog; + @Column(name = "FAMILIARLINKCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo FAMILIARLINK, vinculaciones familiares + */ + private String familiarlinkcatalogcode; + @Version + @Column(name = "RECORDVERSION", nullable = false) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "PROPERTYDIVISION", nullable = true) + /** + * Y Indica que existe separacion de bienes, N mop existe separacion de + * bienes + */ + private String propertydivision; + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el cliente + */ + private String ingressuser; + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del cliente + */ + private String modifyuser; + //METODOS MANUALES + /** + * Sentencia que devuelve las excepciones de una solicitud. + */ + private static final String JPQL_SOL_TCUSTFAMILIARLINK = "from TcustFamiliarlLink tcustFamiliarLink " + + " where tcustFamiliarLink.pk.personcode = :personcode "; + /** + * + */ + private static final String JPQL_SOL_TCUSTFAMILIARLINKPERSONCODE = "from TcustFamiliarlLink tcustFamiliarLink " + + " where tcustFamiliarLink.pk.linkpersoncode = :personcode "; + + /** + * Contructor por defecto + */ + public TcustFamiliarlLink() { + } + + /** + * Contructor de TcustFamiliarlLink + * + * @param pPk Clave Primaria del entity + * @param pRecordversion Optimistic locking del registro + */ + public TcustFamiliarlLink(TcustFamiliarlLinkKey pPk, Integer pRecordversion) { + this(); + pk = pPk; + recordversion = pRecordversion; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustFamiliarlLink + */ + public static TcustFamiliarlLink find(EntityManager pEntityManager, TcustFamiliarlLinkKey pKey) throws Exception { + TcustFamiliarlLink obj = pEntityManager.find(TcustFamiliarlLink.class, pKey); + return obj; + } + + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findByPersonCode(EntityManager pEntityManager, Integer pPersonCode) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(TcustFamiliarlLink.JPQL_SOL_TCUSTFAMILIARLINK); + qry.setParameter("personcode", pPersonCode); + lObjects = qry.getResultList(); + return lObjects; + } + + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findByPersonCodeLink(EntityManager pEntityManager, Integer pPersonCodeLink) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(TcustFamiliarlLink.JPQL_SOL_TCUSTFAMILIARLINKPERSONCODE); + qry.setParameter("personcode", pPersonCodeLink); + lObjects = qry.getResultList(); + return lObjects; + } + + /** + * Entrega la Clave primaria de TcustFamiliarlLink + * + * @return El objeto que referencia a la Clave primaria de + * TcustFamiliarlLink + */ + public TcustFamiliarlLinkKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustFamiliarlLink + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustFamiliarlLink + */ + public void setPk(TcustFamiliarlLinkKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de familiarlinkcatalog + * + * @return valor de familiarlinkcatalog + */ + public String getFamiliarlinkcatalog() { + return familiarlinkcatalog; + } + + /** + * Fija el valor de familiarlinkcatalog + * + * @param pFamiliarlinkcatalog nuevo Valor de familiarlinkcatalog + */ + public void setFamiliarlinkcatalog(String pFamiliarlinkcatalog) { + familiarlinkcatalog = pFamiliarlinkcatalog; + } + + /** + * Obtiene el valor de familiarlinkcatalogcode + * + * @return valor de familiarlinkcatalogcode + */ + public String getFamiliarlinkcatalogcode() { + return familiarlinkcatalogcode; + } + + /** + * Fija el valor de familiarlinkcatalogcode + * + * @param pFamiliarlinkcatalogcode nuevo Valor de familiarlinkcatalogcode + */ + public void setFamiliarlinkcatalogcode(String pFamiliarlinkcatalogcode) { + familiarlinkcatalogcode = pFamiliarlinkcatalogcode; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de propertydivision + * + * @return valor de propertydivision + */ + public String getPropertydivision() { + return propertydivision; + } + + /** + * Fija el valor de propertydivision + * + * @param pPropertydivision nuevo Valor de propertydivision + */ + public void setPropertydivision(String pPropertydivision) { + propertydivision = pPropertydivision; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + modifyuser = pModifyuser; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustFamiliarlLink)) { + return false; + } + TcustFamiliarlLink that = (TcustFamiliarlLink) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TcustFamiliarlLink + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco TcustFamiliarlLink + */ + public Object createInstance() { + TcustFamiliarlLink instance = new TcustFamiliarlLink(); + instance.setPk(new TcustFamiliarlLinkKey()); + return instance; + } + + /** + * Clona la entidad TcustFamiliarlLink + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustFamiliarlLink p = (TcustFamiliarlLink) this.clone(); + p.setPk((TcustFamiliarlLinkKey) this.pk.cloneMe()); + return p; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustFamiliarlLinkKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustFamiliarlLinkKey.java new file mode 100644 index 0000000..67ab20e --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustFamiliarlLinkKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pcustomer.company; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTFAMILIARLLINK*/ +@Embeddable +public class TcustFamiliarlLinkKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="LINKPERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer linkpersoncode; + +/**Contructor por defecto*/ +public TcustFamiliarlLinkKey(){} +/**Contructor de TcustFamiliarlLinkKey +@param pPersoncode Codigo de persona +@param pLinkpersoncode Codigo de persona +*/ +public TcustFamiliarlLinkKey(Integer pPersoncode,Integer pLinkpersoncode){ + personcode=pPersoncode; + linkpersoncode=pLinkpersoncode; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de linkpersoncode +@return valor de linkpersoncode*/ +public Integer getLinkpersoncode(){ + return linkpersoncode; +} +/**Fija el valor de linkpersoncode +@param pLinkpersoncode nuevo Valor de linkpersoncode*/ +public void setLinkpersoncode(Integer pLinkpersoncode){ + linkpersoncode=pLinkpersoncode; +} + +/**Implementacin de la comparacin de TcustFamiliarlLinkKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustFamiliarlLinkKey))return false; + TcustFamiliarlLinkKey that = (TcustFamiliarlLinkKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getLinkpersoncode() == null || that.getLinkpersoncode() == null){ + return false; + } + if (! this.getLinkpersoncode().equals(that.getLinkpersoncode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustFamiliarlLinkKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getLinkpersoncode() == null ? 0 : this.getLinkpersoncode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustFinancialInstitutions.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustFinancialInstitutions.java new file mode 100644 index 0000000..ca97ed3 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustFinancialInstitutions.java @@ -0,0 +1,164 @@ +package com.fp.persistence.pcustomer.company; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTFINANCIALINSTITUTIONS + */ +@Entity(name = "TcustFinancialInstitutions") +@Table(name = "TCUSTFINANCIALINSTITUTIONS") +public class TcustFinancialInstitutions extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustFinancialInstitutions + */ + @Id + @Column(name = "PERSONCODE", nullable = false, updatable = false) + private Integer pk; + + /** + * Contructor por defecto + */ + public TcustFinancialInstitutions() { + } + + /** + * Contructor de TcustFinancialInstitutions + * + * @param pPk Clave Primaria del entity + */ + public TcustFinancialInstitutions(Integer pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustFinancialInstitutions + */ + public static TcustFinancialInstitutions find(EntityManager pEntityManager, Object pKey) throws Exception { + TcustFinancialInstitutions obj = pEntityManager.find(TcustFinancialInstitutions.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustFinancialInstitutions + * + * @return El objeto que referencia a la Clave primaria de + * TcustFinancialInstitutions + */ + public Integer getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustFinancialInstitutions + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustFinancialInstitutions + */ + public void setPk(Integer pPk) { + pk = pPk; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustFinancialInstitutions)) { + return false; + } + TcustFinancialInstitutions that = (TcustFinancialInstitutions) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad + * TcustFinancialInstitutions + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco + * TcustFinancialInstitutions + */ + public Object createInstance() { + TcustFinancialInstitutions instance = new TcustFinancialInstitutions(); + return instance; + } + + /** + * Clona la entidad TcustFinancialInstitutions + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustFinancialInstitutions p = (TcustFinancialInstitutions) this.clone(); + return p; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustInsurance.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustInsurance.java new file mode 100644 index 0000000..6d2ffd6 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustInsurance.java @@ -0,0 +1,161 @@ +package com.fp.persistence.pcustomer.company; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTINSURANCE + */ +@Entity(name = "TcustInsurance") +@Table(name = "TCUSTINSURANCE") +public class TcustInsurance extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustInsurance + */ + @Id + @Column(name = "PERSONCODE", nullable = false, updatable = false) + private Integer pk; + + /** + * Contructor por defecto + */ + public TcustInsurance() { + } + + /** + * Contructor de TcustInsurance + * + * @param pPk Clave Primaria del entity + */ + public TcustInsurance(Integer pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustInsurance + */ + public static TcustInsurance find(EntityManager pEntityManager, Object pKey) throws Exception { + TcustInsurance obj = pEntityManager.find(TcustInsurance.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustInsurance + * + * @return El objeto que referencia a la Clave primaria de TcustInsurance + */ + public Integer getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustInsurance + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustInsurance + */ + public void setPk(Integer pPk) { + pk = pPk; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustInsurance)) { + return false; + } + TcustInsurance that = (TcustInsurance) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TcustInsurance + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco TcustInsurance + */ + public Object createInstance() { + TcustInsurance instance = new TcustInsurance(); + return instance; + } + + /** + * Clona la entidad TcustInsurance + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustInsurance p = (TcustInsurance) this.clone(); + return p; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustLegalLink.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustLegalLink.java new file mode 100644 index 0000000..87d9337 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustLegalLink.java @@ -0,0 +1,356 @@ +package com.fp.persistence.pcustomer.company; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTLEGALLINK + */ +@Entity(name = "TcustLegalLink") +@Table(name = "TCUSTLEGALLINK") +public class TcustLegalLink extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustLegalLink + */ + @EmbeddedId + private TcustLegalLinkKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro del telefono + */ + private Timestamp datefrom; + @Column(name = "LEGALLINKCATALOG", nullable = true) + /** + * Codigo de catalogo PG1 Causales P01 y G01 + */ + private String legallinkcatalog; + @Column(name = "LEGALLINKCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo LEGALLINK vinculaciones legales + */ + private String legallinkcatalogcode; + @Version + @Column(name = "RECORDVERSION", nullable = false) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "INGRESSDATE", nullable = true) + /** + * Fecha de inicio de la vinculacion. + */ + private Date ingressdate; + @Column(name = "EXITDATE", nullable = true) + /** + * Fecha en la que finaliza la vinculacion de la persona. + */ + private Date exitdate; + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el cliente + */ + private String ingressuser; + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del cliente + */ + private String modifyuser; + + /** + * Contructor por defecto + */ + public TcustLegalLink() { + } + + /** + * Contructor de TcustLegalLink + * + * @param pPk Clave Primaria del entity + * @param pRecordversion Optimistic locking del registro + */ + public TcustLegalLink(TcustLegalLinkKey pPk, Integer pRecordversion) { + this(); + pk = pPk; + recordversion = pRecordversion; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustLegalLink + */ + public static TcustLegalLink find(EntityManager pEntityManager, TcustLegalLinkKey pKey) throws Exception { + TcustLegalLink obj = pEntityManager.find(TcustLegalLink.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustLegalLink + * + * @return El objeto que referencia a la Clave primaria de TcustLegalLink + */ + public TcustLegalLinkKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustLegalLink + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustLegalLink + */ + public void setPk(TcustLegalLinkKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + datefrom = pDatefrom; + } + + /** + * Obtiene el valor de legallinkcatalog + * + * @return valor de legallinkcatalog + */ + public String getLegallinkcatalog() { + return legallinkcatalog; + } + + /** + * Fija el valor de legallinkcatalog + * + * @param pLegallinkcatalog nuevo Valor de legallinkcatalog + */ + public void setLegallinkcatalog(String pLegallinkcatalog) { + legallinkcatalog = pLegallinkcatalog; + } + + /** + * Obtiene el valor de legallinkcatalogcode + * + * @return valor de legallinkcatalogcode + */ + public String getLegallinkcatalogcode() { + return legallinkcatalogcode; + } + + /** + * Fija el valor de legallinkcatalogcode + * + * @param pLegallinkcatalogcode nuevo Valor de legallinkcatalogcode + */ + public void setLegallinkcatalogcode(String pLegallinkcatalogcode) { + legallinkcatalogcode = pLegallinkcatalogcode; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de ingressdate + * + * @return valor de ingressdate + */ + public Date getIngressdate() { + return ingressdate; + } + + /** + * Fija el valor de ingressdate + * + * @param pIngressdate nuevo Valor de ingressdate + */ + public void setIngressdate(Date pIngressdate) { + ingressdate = pIngressdate; + } + + /** + * Obtiene el valor de exitdate + * + * @return valor de exitdate + */ + public Date getExitdate() { + return exitdate; + } + + /** + * Fija el valor de exitdate + * + * @param pExitdate nuevo Valor de exitdate + */ + public void setExitdate(Date pExitdate) { + exitdate = pExitdate; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + modifyuser = pModifyuser; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustLegalLink)) { + return false; + } + TcustLegalLink that = (TcustLegalLink) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TcustLegalLink + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco TcustLegalLink + */ + public Object createInstance() { + TcustLegalLink instance = new TcustLegalLink(); + instance.setPk(new TcustLegalLinkKey()); + return instance; + } + + /** + * Clona la entidad TcustLegalLink + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustLegalLink p = (TcustLegalLink) this.clone(); + p.setPk((TcustLegalLinkKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustLegalLinkKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustLegalLinkKey.java new file mode 100644 index 0000000..6e10352 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustLegalLinkKey.java @@ -0,0 +1,183 @@ +package com.fp.persistence.pcustomer.company; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTLEGALLINK*/ +@Embeddable +public class TcustLegalLinkKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="LINKPERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer linkpersoncode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro del telefono +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TcustLegalLinkKey(){} +/**Contructor de TcustLegalLinkKey +@param pPersoncode Codigo de persona +@param pLinkpersoncode Codigo de persona +@param pCompanycode Codigo de compania +@param pDateto Fecha hasta la cual esta vigente el registro del telefono +*/ +public TcustLegalLinkKey(Integer pPersoncode,Integer pLinkpersoncode,Integer pCompanycode,Timestamp pDateto){ + personcode=pPersoncode; + linkpersoncode=pLinkpersoncode; + companycode=pCompanycode; + dateto=pDateto; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de linkpersoncode +@return valor de linkpersoncode*/ +public Integer getLinkpersoncode(){ + return linkpersoncode; +} +/**Fija el valor de linkpersoncode +@param pLinkpersoncode nuevo Valor de linkpersoncode*/ +public void setLinkpersoncode(Integer pLinkpersoncode){ + linkpersoncode=pLinkpersoncode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TcustLegalLinkKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustLegalLinkKey))return false; + TcustLegalLinkKey that = (TcustLegalLinkKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getLinkpersoncode() == null || that.getLinkpersoncode() == null){ + return false; + } + if (! this.getLinkpersoncode().equals(that.getLinkpersoncode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustLegalLinkKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getLinkpersoncode() == null ? 0 : this.getLinkpersoncode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustNotaryOffice.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustNotaryOffice.java new file mode 100644 index 0000000..b28b73b --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustNotaryOffice.java @@ -0,0 +1,161 @@ +package com.fp.persistence.pcustomer.company; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTNOTARYOFFICE + */ +@Entity(name = "TcustNotaryOffice") +@Table(name = "TCUSTNOTARYOFFICE") +public class TcustNotaryOffice extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustNotaryOffice + */ + @Id + @Column(name = "PERSONCODE", nullable = false, updatable = false) + private Integer pk; + + /** + * Contructor por defecto + */ + public TcustNotaryOffice() { + } + + /** + * Contructor de TcustNotaryOffice + * + * @param pPk Clave Primaria del entity + */ + public TcustNotaryOffice(Integer pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustNotaryOffice + */ + public static TcustNotaryOffice find(EntityManager pEntityManager, Object pKey) throws Exception { + TcustNotaryOffice obj = pEntityManager.find(TcustNotaryOffice.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustNotaryOffice + * + * @return El objeto que referencia a la Clave primaria de TcustNotaryOffice + */ + public Integer getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustNotaryOffice + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustNotaryOffice + */ + public void setPk(Integer pPk) { + pk = pPk; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustNotaryOffice)) { + return false; + } + TcustNotaryOffice that = (TcustNotaryOffice) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TcustNotaryOffice + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco TcustNotaryOffice + */ + public Object createInstance() { + TcustNotaryOffice instance = new TcustNotaryOffice(); + return instance; + } + + /** + * Clona la entidad TcustNotaryOffice + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustNotaryOffice p = (TcustNotaryOffice) this.clone(); + return p; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustSupervisor.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustSupervisor.java new file mode 100644 index 0000000..6364000 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/company/TcustSupervisor.java @@ -0,0 +1,193 @@ +package com.fp.persistence.pcustomer.company; + +import javax.persistence.Entity; +import com.fp.dto.hb.Log; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTSUPERVISOR*/ +@Entity(name="TcustSupervisor") +@Table(name="TCUSTSUPERVISOR") +public class TcustSupervisor extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TcustSupervisor +*/ +@Id +@Column(name="PERSONCODE" ,nullable=false, updatable=false) +private Integer pk; +@Column(name="CODEFILE", nullable=true) + +/** +* Codigo de imagen +*/ +private Integer codefile; + +@Column(name="SUPERVISORID", nullable=true) + +/** +* codigo fiscalizador +*/ +private String supervisorid; + +@Column(name="PERFORMANCE", nullable=true) + +/** +* Indice de desempeo +*/ +private Integer performance; + +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TcustSupervisor(){ +} +/**Contructor de TcustSupervisor +@param pPk Clave Primaria del entity +*/ +public TcustSupervisor(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TcustSupervisor +*/ +public static TcustSupervisor find(EntityManager pEntityManager,Object pKey) throws Exception{ + TcustSupervisor obj = pEntityManager.find(TcustSupervisor.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TcustSupervisor +@return El objeto que referencia a la Clave primaria de TcustSupervisor +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TcustSupervisor +@param pPk El objeto que referencia a la nueva Clave primaria de TcustSupervisor +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de codefile +@return valor de codefile*/ +public Integer getCodefile(){ + return codefile; +} +/**Fija el valor de codefile +@param pCodefile nuevo Valor de codefile*/ +public void setCodefile(Integer pCodefile){ + codefile=pCodefile; +} + +/**Obtiene el valor de supervisorid +@return valor de supervisorid*/ +public String getSupervisorid(){ + return supervisorid; +} +/**Fija el valor de supervisorid +@param pSupervisorid nuevo Valor de supervisorid*/ +public void setSupervisorid(String pSupervisorid){ + supervisorid=pSupervisorid; +} + +/**Obtiene el valor de performance +@return valor de performance*/ +public Integer getPerformance(){ + return performance; +} +/**Fija el valor de performance +@param pPerformance nuevo Valor de performance*/ +public void setPerformance(Integer pPerformance){ + performance=pPerformance; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TcustSupervisor))return false; + TcustSupervisor that = (TcustSupervisor) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TcustSupervisor +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TcustSupervisor +*/ +public Object createInstance(){ + TcustSupervisor instance=new TcustSupervisor(); + return instance; +} +/**Clona la entidad TcustSupervisor +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TcustSupervisor p=(TcustSupervisor)this.clone(); + return p; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/entries b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/entries new file mode 100644 index 0000000..481c61e --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/entries @@ -0,0 +1,504 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene +svn://172.17.26.185/COMACO + + + +2015-03-19T04:16:15.728436Z +3943 +dlopez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TcustPersonAddress.java +file + + + + +2022-07-28T03:40:25.356728Z +6c78a8baef0bf93e40c028719be98d15 +2014-11-11T05:52:33.086071Z +2589 +cpiedra + + + + + + + + + + + + + + + + + + + + + +18846 + +TgeneActivity.java +file + + + + +2022-07-28T03:40:25.356728Z +4bbaaf7a70235a76095bf5bccc575e3b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6486 + +TcustPersonPhone.java +file + + + + +2022-07-28T03:40:25.357728Z +87808c8d3087a0dce59672080a0cf5aa +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +12196 + +TcustPersonBankReference.java +file + + + + +2022-07-28T03:40:25.357728Z +b17d1d6bca2212187114563f524cca64 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +14635 + +TcustPersonDetailKey.java +file + + + + +2022-07-28T03:40:25.357728Z +4d2ddcd593d5516475b44d92cdd9b063 +2014-09-12T09:18:40.142938Z +701 +dcruz + + + + + + + + + + + + + + + + + + + + + +3424 + +TcustPersonPersonalReferenceKey.java +file + + + + +2022-07-28T03:40:25.357728Z +3b6d2ff621fb1dce54dcf6650a7207c7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4527 + +TcustPersonAddressKey.java +file + + + + +2022-07-28T03:40:25.358728Z +d07f60eec0b5610e9abe9abc264c2449 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4353 + +TcustPerson.java +file + + + + +2022-07-28T03:40:25.358728Z +bac997660519ef9063bae5010fed9474 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3443 + +TcustPersonParametersId.java +file + + + + +2022-07-28T03:40:25.358728Z +929102ef530e79d795f1c17c2c440050 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5734 + +TcustPersonDetail.java +file + + + + +2022-07-28T03:40:25.358728Z +73dd7afe4cee9efe4dae19dd278b8cb3 +2015-03-19T04:16:15.728436Z +3943 +dlopez + + + + + + + + + + + + + + + + + + + + + +21635 + +TcustPersonPersonalReference.java +file + + + + +2022-07-28T03:40:25.359728Z +a28cc3fd9c56356e2ee77e7f2b38896c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +10878 + +TcustPersonPhoneKey.java +file + + + + +2022-07-28T03:40:25.359728Z +2fb0218697aeba323a8824ca294c784e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4443 + +TgeneCiiu.java +file + + + + +2022-07-28T03:40:25.359728Z +8641369bc5d01887ac866fb286fea0ee +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6167 + +TcustPersonBankReferenceKey.java +file + + + + +2022-07-28T03:40:25.359728Z +c6fc367fdfc3f645f89be896d7cd4575 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4639 + diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPerson.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPerson.java.svn-base new file mode 100644 index 0000000..641efcb --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPerson.java.svn-base @@ -0,0 +1,120 @@ +package com.fp.persistence.pcustomer.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPERSON*/ +@Entity(name="TcustPerson") +@Table(name="TCUSTPERSON") +public class TcustPerson extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TcustPerson +*/ +@Id +@Column(name="PERSONCODE" ,nullable=false, updatable=false) +private Integer pk; +/**Contructor por defecto*/ +public TcustPerson(){ +} +/**Contructor de TcustPerson +@param pPk Clave Primaria del entity +*/ +public TcustPerson(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TcustPerson +*/ +public static TcustPerson find(EntityManager pEntityManager,Object pKey) throws Exception{ + TcustPerson obj = pEntityManager.find(TcustPerson.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TcustPerson +@return El objeto que referencia a la Clave primaria de TcustPerson +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TcustPerson +@param pPk El objeto que referencia a la nueva Clave primaria de TcustPerson +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TcustPerson))return false; + TcustPerson that = (TcustPerson) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TcustPerson +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TcustPerson +*/ +public Object createInstance(){ + TcustPerson instance=new TcustPerson(); + return instance; +} +/**Clona la entidad TcustPerson +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TcustPerson p=(TcustPerson)this.clone(); + return p; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonAddress.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonAddress.java.svn-base new file mode 100644 index 0000000..64caa80 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonAddress.java.svn-base @@ -0,0 +1,701 @@ +package com.fp.persistence.pcustomer.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.GeneratedValue; +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPERSONADDRESS + */ +@Entity(name = "TcustPersonAddress") +@Table(name = "TCUSTPERSONADDRESS") +public class TcustPersonAddress extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TcustPersonAddress + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(ADDRESSNUMBER),0)+1 from TCUSTPERSONADDRESS where PERSONCODE = :personcode and DATETO = :dateto"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "personcode,pk.personcode;dateto,pk.dateto"), @Parameter(name = "field", value = "addressnumber") }) + @GeneratedValue(generator = "seq_id") + private TcustPersonAddressKey pk; + + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro de la direccion. + */ + private Timestamp datefrom; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Manejo de optimistic locking + */ + private Integer recordversion; + + @Column(name = "ADDRESSTYPECATALOG", nullable = true) + /** + * Codigo de catalogo 1 OFICINA, 2 DOMICILIO + */ + private String addresstypecatalog; + + @Column(name = "ADDRESSTYPECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo ADDRESSTYPE, codigo de tipo de saldo + */ + private String addresstypecatalogcode; + + @Column(name = "COUNTRYCODE", nullable = true) + /** + * Codigo de pa�s + */ + private String countrycode; + + @Column(name = "PROVINCECODE", nullable = true) + /** + * Codigo de provincia + */ + private String provincecode; + + @Column(name = "CANTONCODE", nullable = true) + /** + * Codigo de canton + */ + private String cantoncode; + + @Column(name = "CITYCODE", nullable = true) + /** + * Codigo de cuidad + */ + private String citycode; + + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario que crea el registro + */ + private String ingressusercode; + + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario que modifica el registro + */ + private String modifyusercode; + + @Column(name = "PRINCIPAL", nullable = true) + /** + * Y indica que es la direccion principal del cliente, N no es la direccion + * principal + */ + private String principal; + + @Column(name = "STREET", nullable = true) + /** + * Calle o avenida en la que se encuentra la direccion + */ + private String street; + + @Column(name = "STREETNUMBER", nullable = true) + /** + * Numero de casa o departamento + */ + private String streetnumber; + + @Column(name = "DEPARTMENT", nullable = true) + /** + * Numero de departamento + */ + private String department; + + @Column(name = "URBANIZATION", nullable = true) + /** + * Nombre del urbanizacion + */ + private String urbanization; + + @Column(name = "ADDRESS", nullable = true) + /** + * Texto libre de la direccion. + */ + private String address; + + @Column(name = "REMARK", nullable = true) + /** + * Comentarios, texto libre + */ + private String remark; + + @Column(name = "PARROQUIACODE", nullable = true) + /** + * Codigo de parroquia + */ + private String parroquiacode; + + /** + * Contructor por defecto + */ + public TcustPersonAddress() { + } + + /** + * Contructor de TcustPersonAddress + * + * @param pPk Clave Primaria del entity + */ + public TcustPersonAddress(TcustPersonAddressKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPersonAddress + */ + public static TcustPersonAddress find(EntityManager pEntityManager, TcustPersonAddressKey pKey) throws Exception { + TcustPersonAddress obj = pEntityManager.find(TcustPersonAddress.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPersonAddress + * + * @return El objeto que referencia a la Clave primaria de TcustPersonAddress + */ + public TcustPersonAddressKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPersonAddress + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TcustPersonAddress + */ + public void setPk(TcustPersonAddressKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de addresstypecatalog + * + * @return valor de addresstypecatalog + */ + public String getAddresstypecatalog() { + return this.addresstypecatalog; + } + + /** + * Fija el valor de addresstypecatalog + * + * @param pAddresstypecatalog nuevo Valor de addresstypecatalog + */ + public void setAddresstypecatalog(String pAddresstypecatalog) { + this.addresstypecatalog = pAddresstypecatalog; + } + + /** + * Obtiene el valor de addresstypecatalogcode + * + * @return valor de addresstypecatalogcode + */ + public String getAddresstypecatalogcode() { + return this.addresstypecatalogcode; + } + + /** + * Fija el valor de addresstypecatalogcode + * + * @param pAddresstypecatalogcode nuevo Valor de addresstypecatalogcode + */ + public void setAddresstypecatalogcode(String pAddresstypecatalogcode) { + this.addresstypecatalogcode = pAddresstypecatalogcode; + } + + /** + * Obtiene el valor de countrycode + * + * @return valor de countrycode + */ + public String getCountrycode() { + return this.countrycode; + } + + /** + * Fija el valor de countrycode + * + * @param pCountrycode nuevo Valor de countrycode + */ + public void setCountrycode(String pCountrycode) { + this.countrycode = pCountrycode; + } + + /** + * Obtiene el valor de provincecode + * + * @return valor de provincecode + */ + public String getProvincecode() { + return this.provincecode; + } + + /** + * Fija el valor de provincecode + * + * @param pProvincecode nuevo Valor de provincecode + */ + public void setProvincecode(String pProvincecode) { + this.provincecode = pProvincecode; + } + + /** + * Obtiene el valor de cantoncode + * + * @return valor de cantoncode + */ + public String getCantoncode() { + return this.cantoncode; + } + + /** + * Fija el valor de cantoncode + * + * @param pCantoncode nuevo Valor de cantoncode + */ + public void setCantoncode(String pCantoncode) { + this.cantoncode = pCantoncode; + } + + /** + * Obtiene el valor de citycode + * + * @return valor de citycode + */ + public String getCitycode() { + return this.citycode; + } + + /** + * Fija el valor de citycode + * + * @param pCitycode nuevo Valor de citycode + */ + public void setCitycode(String pCitycode) { + this.citycode = pCitycode; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + /** + * Obtiene el valor de principal + * + * @return valor de principal + */ + public String getPrincipal() { + return this.principal; + } + + /** + * Fija el valor de principal + * + * @param pPrincipal nuevo Valor de principal + */ + public void setPrincipal(String pPrincipal) { + this.principal = pPrincipal; + } + + /** + * Obtiene el valor de street + * + * @return valor de street + */ + public String getStreet() { + return this.street; + } + + /** + * Fija el valor de street + * + * @param pStreet nuevo Valor de street + */ + public void setStreet(String pStreet) { + this.street = pStreet; + } + + /** + * Obtiene el valor de streetnumber + * + * @return valor de streetnumber + */ + public String getStreetnumber() { + return this.streetnumber; + } + + /** + * Fija el valor de streetnumber + * + * @param pStreetnumber nuevo Valor de streetnumber + */ + public void setStreetnumber(String pStreetnumber) { + this.streetnumber = pStreetnumber; + } + + /** + * Obtiene el valor de department + * + * @return valor de department + */ + public String getDepartment() { + return this.department; + } + + /** + * Fija el valor de department + * + * @param pDepartment nuevo Valor de department + */ + public void setDepartment(String pDepartment) { + this.department = pDepartment; + } + + /** + * Obtiene el valor de urbanization + * + * @return valor de urbanization + */ + public String getUrbanization() { + return this.urbanization; + } + + /** + * Fija el valor de urbanization + * + * @param pUrbanization nuevo Valor de urbanization + */ + public void setUrbanization(String pUrbanization) { + this.urbanization = pUrbanization; + } + + /** + * Obtiene el valor de address + * + * @return valor de address + */ + public String getAddress() { + return this.address; + } + + /** + * Fija el valor de address + * + * @param pAddress nuevo Valor de address + */ + public void setAddress(String pAddress) { + this.address = pAddress; + } + + /** + * Obtiene el valor de remark + * + * @return valor de remark + */ + public String getRemark() { + return this.remark; + } + + /** + * Fija el valor de remark + * + * @param pRemark nuevo Valor de remark + */ + public void setRemark(String pRemark) { + this.remark = pRemark; + } + + /** + * Obtiene el valor de parroquiacode + * + * @return valor de parroquiacode + */ + public String getParroquiacode() { + return this.parroquiacode; + } + + /** + * Fija el valor de parroquiacode + * + * @param pParroquiacode nuevo Valor de parroquiacode + */ + public void setParroquiacode(String pParroquiacode) { + this.parroquiacode = pParroquiacode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPersonAddress)) { + return false; + } + TcustPersonAddress that = (TcustPersonAddress) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustPersonAddress + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustPersonAddress + */ + @Override + public Object createInstance() { + TcustPersonAddress instance = new TcustPersonAddress(); + instance.setPk(new TcustPersonAddressKey()); + return instance; + } + + /** + * Clona la entidad TcustPersonAddress + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPersonAddress p = (TcustPersonAddress) this.clone(); + p.setPk((TcustPersonAddressKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + + // Metodos manuales + private static final String JPQL_EMAIL = "from TcustPersonAddress t" + " where t.pk.personcode = :personcode " + " and t.pk.dateto = :dateto " + + " and t.addresstypecatalog = :addresstype "; + + /** + * Metodo que emtrega la direccion email de una persona, si existe mas de una direccion email asociada a una persona + * entrega la primera que encuentre en la base. + * + * @param pEntityManager Session de la base de datos + * @param pPersonCode Codigo de persona. + * @return String + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static String getEmail(EntityManager pEntityManager, Integer pPersonCode) throws Exception { + String email = null; + Query qry = pEntityManager.createQuery(TcustPersonAddress.JPQL_EMAIL); + qry.setParameter("personcode", pPersonCode); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + qry.setParameter("addresstype", "3"); + List ldata = qry.getResultList(); + if ((ldata == null) || ldata.isEmpty()) { + return email; + } + for (TcustPersonAddress obj : ldata) { + email = obj.getAddress(); + break; + } + return email; + } + + /** + * Sentencia que devuelve un registro vigente de TcustPersonAddress + */ + private static final String JPQL_PERSON_ADDRESS = "from TcustPersonAddress tcpa" + " where tcpa.pk.personcode = :personcode" + + " and tcpa.pk.addressnumber = :addressnumber" + " and tcpa.pk.dateto = :dateto"; + + /** + * Metodo que entrega datos de una Direccion definida en TcustPersonAddress. + * + * @param pEntityManager Session de la base de datos. + * @param personcode Codigo de la persona a quien pertenece la Direccion. + * @param addressnumber Numero de la direccion. + * @return tcustPersonAddress + * @throws Exception + */ + public static TcustPersonAddress findByPersonCode(EntityManager pEntityManager, Integer personcode, Integer addressnumber) throws Exception { + Query qry = pEntityManager.createQuery(TcustPersonAddress.JPQL_PERSON_ADDRESS); + qry.setParameter("personcode", personcode); + qry.setParameter("addressnumber", addressnumber); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + try { + return (TcustPersonAddress) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + + /** + * Sentencia que devuelve un registro vigente de TcustPersonAddress + */ + private static final String JPQL_PERSON = "from TcustPersonAddress tcpa" + " where tcpa.pk.personcode = :personcode" + + " and tcpa.pk.dateto = :dateto"; + + /** + * Metodo que entrega datos de una Direccion definida en TcustPersonAddress. + * + * @param pEntityManager Session de la base de datos. + * @param personcode Codigo de la persona a quien pertenece la Direccion. + * @param addressnumber Numero de la direccion. + * @return tcustPersonAddress + * @throws Exception + */ + public static List findByPersonCode(EntityManager pEntityManager, Integer personcode) throws Exception { + Query qry = pEntityManager.createQuery(TcustPersonAddress.JPQL_PERSON); + qry.setParameter("personcode", personcode); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + return qry.getResultList(); + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonAddressKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonAddressKey.java.svn-base new file mode 100644 index 0000000..4ee10fa --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonAddressKey.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPERSONADDRESS*/ +@Embeddable +public class TcustPersonAddressKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="ADDRESSNUMBER", nullable=false,updatable=false) + +/** +* Numero de direccion, secuencia por codigo de persona. +*/ +private Integer addressnumber; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro de la direccion. +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TcustPersonAddressKey(){} +/**Contructor de TcustPersonAddressKey +@param pPersoncode Codigo de persona +@param pAddressnumber Numero de direccion, secuencia por codigo de persona. +@param pDateto Fecha hasta la cual esta vigente el registro de la direccion. +*/ +public TcustPersonAddressKey(Integer pPersoncode,Integer pAddressnumber,Timestamp pDateto){ + personcode=pPersoncode; + addressnumber=pAddressnumber; + dateto=pDateto; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de addressnumber +@return valor de addressnumber*/ +public Integer getAddressnumber(){ + return addressnumber; +} +/**Fija el valor de addressnumber +@param pAddressnumber nuevo Valor de addressnumber*/ +public void setAddressnumber(Integer pAddressnumber){ + addressnumber=pAddressnumber; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TcustPersonAddressKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPersonAddressKey))return false; + TcustPersonAddressKey that = (TcustPersonAddressKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getAddressnumber() == null || that.getAddressnumber() == null){ + return false; + } + if (! this.getAddressnumber().equals(that.getAddressnumber())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPersonAddressKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getAddressnumber() == null ? 0 : this.getAddressnumber().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonBankReference.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonBankReference.java.svn-base new file mode 100644 index 0000000..7f3b798 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonBankReference.java.svn-base @@ -0,0 +1,534 @@ +package com.fp.persistence.pcustomer.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTPERSONBANKREFERENCE + */ +@Entity(name = "TcustPersonBankReference") +@Table(name = "TCUSTPERSONBANKREFERENCE") +public class TcustPersonBankReference extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustPersonBankReference + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(REFERENCESEQUENCE),0)+1 from TCUSTPERSONBANKREFERENCE where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "referencesequence")}) + @GeneratedValue(generator = "seq_id") + private TcustPersonBankReferenceKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro del telefono + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String ingressusercode; + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String modifyusercode; + @Column(name = "BANKPERSONCODE", nullable = true) + /** + * Codigo de persona asociada al banco de referencia de la persona + */ + private Integer bankpersoncode; + @Column(name = "NAME", nullable = true) + /** + * Nombre de la institucion fincniera asociada a la cuenta de referencia + */ + private String name; + @Column(name = "ACCOUNTTYPECATALOG", nullable = true) + /** + * Codigo de catalogo 1 Corriente, 2 Ahorro + */ + private String accounttypecatalog; + @Column(name = "ACCOUNTTYPECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo ACCOUNTTYPE de tipo de cuenta + */ + private String accounttypecatalogcode; + @Column(name = "ACCOUNTNUMBER", nullable = true) + /** + * Numero de cuenta, de referencia bancaria + */ + private String accountnumber; + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + @Column(name = "FIGURESNUMBER", nullable = true) + /** + * Numero de cifras de manejo + */ + private Integer figuresnumber; + @Column(name = "FIGURESCATALOG", nullable = true) + /** + * Codigo de catalogo 1 Altas, 2 medias, 3 bajas + */ + private String figurescatalog; + @Column(name = "FIGURESCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo FIGURES cifras de manejo + */ + private String figurescatalogcode; + @Column(name = "OPENINGDATE", nullable = true) + /** + * Fecha de apertura de la cuenta + */ + private Date openingdate; + @Column(name = "REMARK", nullable = true) + /** + * Observaciones + */ + private String remark; + + /** + * Contructor por defecto + */ + public TcustPersonBankReference() { + } + + /** + * Contructor de TcustPersonBankReference + * + * @param pPk Clave Primaria del entity + */ + public TcustPersonBankReference(TcustPersonBankReferenceKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPersonBankReference + */ + public static TcustPersonBankReference find(EntityManager pEntityManager, TcustPersonBankReferenceKey pKey) throws Exception { + TcustPersonBankReference obj = pEntityManager.find(TcustPersonBankReference.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPersonBankReference + * + * @return El objeto que referencia a la Clave primaria de + * TcustPersonBankReference + */ + public TcustPersonBankReferenceKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPersonBankReference + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustPersonBankReference + */ + public void setPk(TcustPersonBankReferenceKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + /** + * Obtiene el valor de bankpersoncode + * + * @return valor de bankpersoncode + */ + public Integer getBankpersoncode() { + return this.bankpersoncode; + } + + /** + * Fija el valor de bankpersoncode + * + * @param pBankpersoncode nuevo Valor de bankpersoncode + */ + public void setBankpersoncode(Integer pBankpersoncode) { + this.bankpersoncode = pBankpersoncode; + } + + /** + * Obtiene el valor de name + * + * @return valor de name + */ + public String getName() { + return this.name; + } + + /** + * Fija el valor de name + * + * @param pName nuevo Valor de name + */ + public void setName(String pName) { + this.name = pName; + } + + /** + * Obtiene el valor de accounttypecatalog + * + * @return valor de accounttypecatalog + */ + public String getAccounttypecatalog() { + return this.accounttypecatalog; + } + + /** + * Fija el valor de accounttypecatalog + * + * @param pAccounttypecatalog nuevo Valor de accounttypecatalog + */ + public void setAccounttypecatalog(String pAccounttypecatalog) { + this.accounttypecatalog = pAccounttypecatalog; + } + + /** + * Obtiene el valor de accounttypecatalogcode + * + * @return valor de accounttypecatalogcode + */ + public String getAccounttypecatalogcode() { + return this.accounttypecatalogcode; + } + + /** + * Fija el valor de accounttypecatalogcode + * + * @param pAccounttypecatalogcode nuevo Valor de accounttypecatalogcode + */ + public void setAccounttypecatalogcode(String pAccounttypecatalogcode) { + this.accounttypecatalogcode = pAccounttypecatalogcode; + } + + /** + * Obtiene el valor de accountnumber + * + * @return valor de accountnumber + */ + public String getAccountnumber() { + return this.accountnumber; + } + + /** + * Fija el valor de accountnumber + * + * @param pAccountnumber nuevo Valor de accountnumber + */ + public void setAccountnumber(String pAccountnumber) { + this.accountnumber = pAccountnumber; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de figuresnumber + * + * @return valor de figuresnumber + */ + public Integer getFiguresnumber() { + return this.figuresnumber; + } + + /** + * Fija el valor de figuresnumber + * + * @param pFiguresnumber nuevo Valor de figuresnumber + */ + public void setFiguresnumber(Integer pFiguresnumber) { + this.figuresnumber = pFiguresnumber; + } + + /** + * Obtiene el valor de figurescatalog + * + * @return valor de figurescatalog + */ + public String getFigurescatalog() { + return this.figurescatalog; + } + + /** + * Fija el valor de figurescatalog + * + * @param pFigurescatalog nuevo Valor de figurescatalog + */ + public void setFigurescatalog(String pFigurescatalog) { + this.figurescatalog = pFigurescatalog; + } + + /** + * Obtiene el valor de figurescatalogcode + * + * @return valor de figurescatalogcode + */ + public String getFigurescatalogcode() { + return this.figurescatalogcode; + } + + /** + * Fija el valor de figurescatalogcode + * + * @param pFigurescatalogcode nuevo Valor de figurescatalogcode + */ + public void setFigurescatalogcode(String pFigurescatalogcode) { + this.figurescatalogcode = pFigurescatalogcode; + } + + /** + * Obtiene el valor de openingdate + * + * @return valor de openingdate + */ + public Date getOpeningdate() { + return this.openingdate; + } + + /** + * Fija el valor de openingdate + * + * @param pOpeningdate nuevo Valor de openingdate + */ + public void setOpeningdate(Date pOpeningdate) { + this.openingdate = pOpeningdate; + } + + /** + * Obtiene el valor de remark + * + * @return valor de remark + */ + public String getRemark() { + return this.remark; + } + + /** + * Fija el valor de remark + * + * @param pRemark nuevo Valor de remark + */ + public void setRemark(String pRemark) { + this.remark = pRemark; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPersonBankReference)) { + return false; + } + TcustPersonBankReference that = (TcustPersonBankReference) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad + * TcustPersonBankReference + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco + * TcustPersonBankReference + */ + @Override + public Object createInstance() { + TcustPersonBankReference instance = new TcustPersonBankReference(); + instance.setPk(new TcustPersonBankReferenceKey()); + return instance; + } + + /** + * Clona la entidad TcustPersonBankReference + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPersonBankReference p = (TcustPersonBankReference) this.clone(); + p.setPk((TcustPersonBankReferenceKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonBankReferenceKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonBankReferenceKey.java.svn-base new file mode 100644 index 0000000..f85592f --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonBankReferenceKey.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPERSONBANKREFERENCE*/ +@Embeddable +public class TcustPersonBankReferenceKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="REFERENCESEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de referencias bancarias del cliente +*/ +private Integer referencesequence; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro del telefono +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TcustPersonBankReferenceKey(){} +/**Contructor de TcustPersonBankReferenceKey +@param pPersoncode Codigo de persona +@param pReferencesequence Secuencia de referencias bancarias del cliente +@param pDateto Fecha hasta la cual esta vigente el registro del telefono +*/ +public TcustPersonBankReferenceKey(Integer pPersoncode,Integer pReferencesequence,Timestamp pDateto){ + personcode=pPersoncode; + referencesequence=pReferencesequence; + dateto=pDateto; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de referencesequence +@return valor de referencesequence*/ +public Integer getReferencesequence(){ + return referencesequence; +} +/**Fija el valor de referencesequence +@param pReferencesequence nuevo Valor de referencesequence*/ +public void setReferencesequence(Integer pReferencesequence){ + referencesequence=pReferencesequence; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TcustPersonBankReferenceKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPersonBankReferenceKey))return false; + TcustPersonBankReferenceKey that = (TcustPersonBankReferenceKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getReferencesequence() == null || that.getReferencesequence() == null){ + return false; + } + if (! this.getReferencesequence().equals(that.getReferencesequence())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPersonBankReferenceKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getReferencesequence() == null ? 0 : this.getReferencesequence().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonDetail.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonDetail.java.svn-base new file mode 100644 index 0000000..8195705 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonDetail.java.svn-base @@ -0,0 +1,821 @@ +package com.fp.persistence.pcustomer.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; + +import java.sql.Timestamp; + +import com.fp.dto.hb.Log; + +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +import javax.persistence.NoResultException; + +import com.fp.general.exception.GeneralException; +import com.fp.common.helper.Constant; + +import javax.persistence.Query; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPERSONDETAIL*/ +@Entity(name="TcustPersonDetail") +@Table(name="TCUSTPERSONDETAIL") +public class TcustPersonDetail extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TcustPersonDetail +*/ +@EmbeddedId +private TcustPersonDetailKey pk; +@Version +@Column(name="RECORDVERSION", nullable=false) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DATEFROM", nullable=true) + +/** +* Fecha desde la cual esta vigente el registro +*/ +private Timestamp datefrom; + +@Column(name="NAME", nullable=false) + +/** +* Nombre Legal de la persona +*/ +private String name; + +@Column(name="NICKNAME", nullable=true) + +/** +* Nombre preferido +*/ +private String nickname; + +@Column(name="IDENTIFICATIONCATALOG", nullable=true) + +/** +* CED, Cedula, RUC ruc, PAS pasoporte etc. +*/ +private String identificationcatalog; + +@Column(name="IDENTIFICATIONCATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo IDENTIFICATION +*/ +private String identificationcatalogcode; + +@Column(name="IDENTIFICATION", nullable=false) + +/** +* Numero de cedula, ruc, pasaporte, etc.. +*/ +private String identification; + +@Column(name="INGRESSUSER", nullable=true) + +/** +* Codigo de usuario que crea el cliente +*/ +private String ingressuser; + +@Column(name="MODIFYUSER", nullable=true) + +/** +* Codigo de usuario que modifica datos del cliente +*/ +private String modifyuser; + +@Column(name="LANGUAGECODE", nullable=true) + +/** +* Codigo de idioma +*/ +private String languagecode; + +@Column(name="OFFICECODE", nullable=true) + +/** +* Codigo de oficina en la que se ingreso la persona. +*/ +private Integer officecode; + +@Column(name="BRANCHCODE", nullable=true) + +/** +* Codigo de sucursal en la que se ingreso la persona. +*/ +private Integer branchcode; + +@Column(name="COMPANYCODE", nullable=true) + +/** +* Codigo de compania al que pertenece la oficina +*/ +private Integer companycode; + +@Column(name="PERSONTYPECATALOG", nullable=true) + +/** +* Codigo de catalogo 1 Natural, 2 Juridico +*/ +private String persontypecatalog; + +@Column(name="PERSONTYPECATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo PERSONTYPE, de tipo de persona +*/ +private String persontypecatalogcode; + +@Column(name="REGISTERDATE", nullable=true) + +/** +* Fecha de ingreso inicial de la persona. +*/ +private Date registerdate; + +@Column(name="INNERSCORE", nullable=true) + +/** +* Calificacion interna del banco. +*/ +private String innerscore; + +@Column(name="PARTHNERNUMBER", nullable=true) + +/** +* Codigo de socio +*/ +private String parthnernumber; + +@Column(name="DATEEXPIDENTIFICATION", nullable=true) + +/** +* Fecha de caducidad del documento de identidad +*/ +private Date dateexpidentification; + +@Column(name="TAXEXEMPT", nullable=true) + +/** +* Excento de impuesto +*/ +private String taxexempt; + +@Column(name="CLIENTTYPECATALOG", nullable=true) + +/** +* Persona natural, Publica Financiera, Privada Financiera +*/ +private String clienttypecatalog; + +@Column(name="CLIENTTYPECATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo CLIENTTYPE Tipo de Cliente +*/ +private String clienttypecatalogcode; + +@Column(name="ECONOMICSECTORCATALOG", nullable=true) + +/** +* Tipos de Sector: Gobierno central, hogares, No residentes , Empresas +*/ +private String economicsectorcatalog; + +@Column(name="ECONOMICSECTORCATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo ECONOMICSECTOR Tipo de Sector +*/ +private String economicsectorcatalogcode; + +@Column(name="ACTIVITYCODE", nullable=true) + +/** +* Codigo de actividad +*/ +private String activitycode; + +@Column(name="ISMIGRATED", nullable=true) + +/** +* Y, indica que la informacion actual del cliente proviene de una migracion. +*/ +private String ismigrated; + +@Column(name="SBSEMPLOYEE", nullable=true) + +/** +* Codigo de empleado de la sbs +*/ +private String sbsemployee; + +@Column(name="SBSUSERCODE", nullable=true) + +/** +* Codigo de usuario utilizado en la sbs, se utiliza en la integracion con CAS +*/ +private String sbsusercode; + +@Column(name="LEGALREPRESENT", nullable=true) + +/** +* null +*/ +private String legalrepresent; + +@Column(name="LEGALREPRESENTIDENTIFICATION", nullable=true) + +/** +* null +*/ +private String legalrepresentidentification; + +@Column(name="MILITARYGRADE", nullable=true) + +/** +* Catalog del grado del militar en la tabla de catlogos +*/ +private String militarygrade; + +@Column(name="MILITARYGRADECODE", nullable=true) + +/** +* Catalogcode del grado del militar en la tabla de catlogos +*/ +private String militarygradecode; + +@Column(name="SIGN", nullable=true,length = 100000) + +/** +* Firma digital +*/ +private byte[] sign; + +@Column(name="PICTURE", nullable=true,length = 100000) + +/** +* Firma digital +*/ +private byte[] picture; + +@Column(name = "PHOTO", nullable = true) +/** + * Codigo de imagen + */ +private Integer photo; + +@Column(name="ECONIMICACT", nullable=true) + +/** +* Valor de la actividad economica +*/ +private String econimicact; + +/**Contructor por defecto*/ +public TcustPersonDetail(){ +} +/**Contructor de TcustPersonDetail +@param pPk Clave Primaria del entity +@param pRecordversion Optimistic locking del registro +@param pName Nombre Legal de la persona +@param pIdentification Numero de cedula, ruc, pasaporte, etc.. +*/ +public TcustPersonDetail(TcustPersonDetailKey pPk,Integer pRecordversion,String pName,String pIdentification){ + this(); + pk=pPk; + recordversion=pRecordversion; + name=pName; + identification=pIdentification; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TcustPersonDetail +*/ +public static TcustPersonDetail find(EntityManager pEntityManager,TcustPersonDetailKey pKey) throws Exception{ + TcustPersonDetail obj = pEntityManager.find(TcustPersonDetail.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TcustPersonDetail +@return El objeto que referencia a la Clave primaria de TcustPersonDetail +*/ +public TcustPersonDetailKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TcustPersonDetail +@param pPk El objeto que referencia a la nueva Clave primaria de TcustPersonDetail +*/ +public void setPk(TcustPersonDetailKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de datefrom +@return valor de datefrom*/ +public Timestamp getDatefrom(){ + return datefrom; +} +/**Fija el valor de datefrom +@param pDatefrom nuevo Valor de datefrom*/ +public void setDatefrom(Timestamp pDatefrom){ + datefrom=pDatefrom; +} + +/**Obtiene el valor de name +@return valor de name*/ +public String getName(){ + return name; +} +/**Fija el valor de name +@param pName nuevo Valor de name*/ +public void setName(String pName){ + name=pName; +} + +/**Obtiene el valor de nickname +@return valor de nickname*/ +public String getNickname(){ + return nickname; +} +/**Fija el valor de nickname +@param pNickname nuevo Valor de nickname*/ +public void setNickname(String pNickname){ + nickname=pNickname; +} + +/**Obtiene el valor de identificationcatalog +@return valor de identificationcatalog*/ +public String getIdentificationcatalog(){ + return identificationcatalog; +} +/**Fija el valor de identificationcatalog +@param pIdentificationcatalog nuevo Valor de identificationcatalog*/ +public void setIdentificationcatalog(String pIdentificationcatalog){ + identificationcatalog=pIdentificationcatalog; +} + +/**Obtiene el valor de identificationcatalogcode +@return valor de identificationcatalogcode*/ +public String getIdentificationcatalogcode(){ + return identificationcatalogcode; +} +/**Fija el valor de identificationcatalogcode +@param pIdentificationcatalogcode nuevo Valor de identificationcatalogcode*/ +public void setIdentificationcatalogcode(String pIdentificationcatalogcode){ + identificationcatalogcode=pIdentificationcatalogcode; +} + +/**Obtiene el valor de identification +@return valor de identification*/ +public String getIdentification(){ + return identification; +} +/**Fija el valor de identification +@param pIdentification nuevo Valor de identification*/ +public void setIdentification(String pIdentification){ + identification=pIdentification; +} + +/**Obtiene el valor de ingressuser +@return valor de ingressuser*/ +public String getIngressuser(){ + return ingressuser; +} +/**Fija el valor de ingressuser +@param pIngressuser nuevo Valor de ingressuser*/ +public void setIngressuser(String pIngressuser){ + ingressuser=pIngressuser; +} + +/**Obtiene el valor de modifyuser +@return valor de modifyuser*/ +public String getModifyuser(){ + return modifyuser; +} +/**Fija el valor de modifyuser +@param pModifyuser nuevo Valor de modifyuser*/ +public void setModifyuser(String pModifyuser){ + modifyuser=pModifyuser; +} + +/**Obtiene el valor de languagecode +@return valor de languagecode*/ +public String getLanguagecode(){ + return languagecode; +} +/**Fija el valor de languagecode +@param pLanguagecode nuevo Valor de languagecode*/ +public void setLanguagecode(String pLanguagecode){ + languagecode=pLanguagecode; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de persontypecatalog +@return valor de persontypecatalog*/ +public String getPersontypecatalog(){ + return persontypecatalog; +} +/**Fija el valor de persontypecatalog +@param pPersontypecatalog nuevo Valor de persontypecatalog*/ +public void setPersontypecatalog(String pPersontypecatalog){ + persontypecatalog=pPersontypecatalog; +} + +/**Obtiene el valor de persontypecatalogcode +@return valor de persontypecatalogcode*/ +public String getPersontypecatalogcode(){ + return persontypecatalogcode; +} +/**Fija el valor de persontypecatalogcode +@param pPersontypecatalogcode nuevo Valor de persontypecatalogcode*/ +public void setPersontypecatalogcode(String pPersontypecatalogcode){ + persontypecatalogcode=pPersontypecatalogcode; +} + +/**Obtiene el valor de registerdate +@return valor de registerdate*/ +public Date getRegisterdate(){ + return registerdate; +} +/**Fija el valor de registerdate +@param pRegisterdate nuevo Valor de registerdate*/ +public void setRegisterdate(Date pRegisterdate){ + registerdate=pRegisterdate; +} + +/**Obtiene el valor de innerscore +@return valor de innerscore*/ +public String getInnerscore(){ + return innerscore; +} +/**Fija el valor de innerscore +@param pInnerscore nuevo Valor de innerscore*/ +public void setInnerscore(String pInnerscore){ + innerscore=pInnerscore; +} + +/**Obtiene el valor de parthnernumber +@return valor de parthnernumber*/ +public String getParthnernumber(){ + return parthnernumber; +} +/**Fija el valor de parthnernumber +@param pParthnernumber nuevo Valor de parthnernumber*/ +public void setParthnernumber(String pParthnernumber){ + parthnernumber=pParthnernumber; +} + +/**Obtiene el valor de dateexpidentification +@return valor de dateexpidentification*/ +public Date getDateexpidentification(){ + return dateexpidentification; +} +/**Fija el valor de dateexpidentification +@param pDateexpidentification nuevo Valor de dateexpidentification*/ +public void setDateexpidentification(Date pDateexpidentification){ + dateexpidentification=pDateexpidentification; +} + +/**Obtiene el valor de taxexempt +@return valor de taxexempt*/ +public String getTaxexempt(){ + return taxexempt; +} +/**Fija el valor de taxexempt +@param pTaxexempt nuevo Valor de taxexempt*/ +public void setTaxexempt(String pTaxexempt){ + taxexempt=pTaxexempt; +} + +/**Obtiene el valor de clienttypecatalog +@return valor de clienttypecatalog*/ +public String getClienttypecatalog(){ + return clienttypecatalog; +} +/**Fija el valor de clienttypecatalog +@param pClienttypecatalog nuevo Valor de clienttypecatalog*/ +public void setClienttypecatalog(String pClienttypecatalog){ + clienttypecatalog=pClienttypecatalog; +} + +/**Obtiene el valor de clienttypecatalogcode +@return valor de clienttypecatalogcode*/ +public String getClienttypecatalogcode(){ + return clienttypecatalogcode; +} +/**Fija el valor de clienttypecatalogcode +@param pClienttypecatalogcode nuevo Valor de clienttypecatalogcode*/ +public void setClienttypecatalogcode(String pClienttypecatalogcode){ + clienttypecatalogcode=pClienttypecatalogcode; +} + +/**Obtiene el valor de economicsectorcatalog +@return valor de economicsectorcatalog*/ +public String getEconomicsectorcatalog(){ + return economicsectorcatalog; +} +/**Fija el valor de economicsectorcatalog +@param pEconomicsectorcatalog nuevo Valor de economicsectorcatalog*/ +public void setEconomicsectorcatalog(String pEconomicsectorcatalog){ + economicsectorcatalog=pEconomicsectorcatalog; +} + +/**Obtiene el valor de economicsectorcatalogcode +@return valor de economicsectorcatalogcode*/ +public String getEconomicsectorcatalogcode(){ + return economicsectorcatalogcode; +} +/**Fija el valor de economicsectorcatalogcode +@param pEconomicsectorcatalogcode nuevo Valor de economicsectorcatalogcode*/ +public void setEconomicsectorcatalogcode(String pEconomicsectorcatalogcode){ + economicsectorcatalogcode=pEconomicsectorcatalogcode; +} + +/**Obtiene el valor de activitycode +@return valor de activitycode*/ +public String getActivitycode(){ + return activitycode; +} +/**Fija el valor de activitycode +@param pActivitycode nuevo Valor de activitycode*/ +public void setActivitycode(String pActivitycode){ + activitycode=pActivitycode; +} + +/**Obtiene el valor de ismigrated +@return valor de ismigrated*/ +public String getIsmigrated(){ + return ismigrated; +} +/**Fija el valor de ismigrated +@param pIsmigrated nuevo Valor de ismigrated*/ +public void setIsmigrated(String pIsmigrated){ + ismigrated=pIsmigrated; +} + +/**Obtiene el valor de sbsemployee +@return valor de sbsemployee*/ +public String getSbsemployee(){ + return sbsemployee; +} +/**Fija el valor de sbsemployee +@param pSbsemployee nuevo Valor de sbsemployee*/ +public void setSbsemployee(String pSbsemployee){ + sbsemployee=pSbsemployee; +} + +/**Obtiene el valor de sbsusercode +@return valor de sbsusercode*/ +public String getSbsusercode(){ + return sbsusercode; +} +/**Fija el valor de sbsusercode +@param pSbsusercode nuevo Valor de sbsusercode*/ +public void setSbsusercode(String pSbsusercode){ + sbsusercode=pSbsusercode; +} + +/**Obtiene el valor de legalrepresent +@return valor de legalrepresent*/ +public String getLegalrepresent(){ + return legalrepresent; +} +/**Fija el valor de legalrepresent +@param pLegalrepresent nuevo Valor de legalrepresent*/ +public void setLegalrepresent(String pLegalrepresent){ + legalrepresent=pLegalrepresent; +} + +/**Obtiene el valor de legalrepresentidentification +@return valor de legalrepresentidentification*/ +public String getLegalrepresentidentification(){ + return legalrepresentidentification; +} +/**Fija el valor de legalrepresentidentification +@param pLegalrepresentidentification nuevo Valor de legalrepresentidentification*/ +public void setLegalrepresentidentification(String pLegalrepresentidentification){ + legalrepresentidentification=pLegalrepresentidentification; +} + +/**Obtiene el valor de militarygrade +@return valor de militarygrade*/ +public String getMilitarygrade(){ + return militarygrade; +} +/**Fija el valor de militarygrade +@param pMilitarygrade nuevo Valor de militarygrade*/ +public void setMilitarygrade(String pMilitarygrade){ + militarygrade=pMilitarygrade; +} + +/**Obtiene el valor de militarygradecode +@return valor de militarygradecode*/ +public String getMilitarygradecode(){ + return militarygradecode; +} +/**Fija el valor de militarygradecode +@param pMilitarygradecode nuevo Valor de militarygradecode*/ +public void setMilitarygradecode(String pMilitarygradecode){ + militarygradecode=pMilitarygradecode; +} + + +/**Obtiene el valor de sign +@return valor de sign*/ +public byte[] getSign() { + return sign; +} +/**Fija el valor de sign +@param pMilitarygradecode nuevo Valor de sign*/ +public void setSign(byte[] sign) { + this.sign = sign; +} + +/**Obtiene el valor de picture +@return valor de picture*/ +public byte[] getPicture() { + return picture; +} +/**Fija el valor de picture +@param pMilitarygradecode nuevo Valor de picture*/ +public void setPicture(byte[] picture) { + this.picture = picture; +} + +/**Obtiene el valor de photo +@return valor de photo*/ +public Integer getPhoto() { + return photo; +} +/**Fija el valor de v +@param pMilitarygradecode nuevo Valor de photo*/ +public void setPhoto(Integer photo) { + this.photo = photo; +} + + +/**Obtiene el valor de actividad economica +@return valor de econimicact*/ +public String getEconimicact() { + return econimicact; +} +/**Fija el valor de actividad economica +@param pEconimicact nuevo Valor de econimicact*/ +public void setEconimicact(String pEconimicact){ + this.econimicact=pEconimicact; +} + + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TcustPersonDetail))return false; + TcustPersonDetail that = (TcustPersonDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TcustPersonDetail +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TcustPersonDetail +*/ +public Object createInstance(){ + TcustPersonDetail instance=new TcustPersonDetail(); + instance.setPk(new TcustPersonDetailKey()); + return instance; +} +/**Clona la entidad TcustPersonDetail +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TcustPersonDetail p=(TcustPersonDetail)this.clone(); + p.setPk((TcustPersonDetailKey)this.pk.cloneMe()); + return p; +} +public Object getId() { + return this.pk; +} + +public static TcustPersonDetail find(EntityManager pEntityManager, Integer pPersonCode) + throws Exception + { + TcustPersonDetail tcustPersonDetail = null; + Query qry = pEntityManager.createQuery("from TcustPersonDetail tpd where tpd.pk.personcode = :personcode and tpd.pk.dateto = :dateto"); + + qry.setParameter("personcode", pPersonCode); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + try + { + tcustPersonDetail = (TcustPersonDetail)qry.getSingleResult(); + } + catch (NoResultException e) + { + throw new GeneralException("CUST-0001", "PERSONA NO DEFINIDA EN TCUSTPERSONDETAIL: PERSONCODE:{0}", new Object[] { pPersonCode }); + } + return tcustPersonDetail; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonDetailKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonDetailKey.java.svn-base new file mode 100644 index 0000000..489b476 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonDetailKey.java.svn-base @@ -0,0 +1,129 @@ +package com.fp.persistence.pcustomer.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPERSONDETAIL*/ +@Embeddable +public class TcustPersonDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TcustPersonDetailKey(){} +/**Contructor de TcustPersonDetailKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +*/ +public TcustPersonDetailKey(Integer pPersoncode,Timestamp pDateto){ + personcode=pPersoncode; + dateto=pDateto; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacion de la comparacion de TcustPersonDetailKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPersonDetailKey))return false; + TcustPersonDetailKey that = (TcustPersonDetailKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TcustPersonDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonParametersId.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonParametersId.java.svn-base new file mode 100644 index 0000000..763cd94 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonParametersId.java.svn-base @@ -0,0 +1,196 @@ +package com.fp.persistence.pcustomer.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPERSONPARAMETERSID*/ +@Entity(name="TcustPersonParametersId") +@Table(name="TCUSTPERSONPARAMETERSID") +public class TcustPersonParametersId extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TcustPersonParametersId +*/ +@Id +@Column(name="IDENTIFICATIONCATALOG" ,nullable=false, updatable=false) +private String pk; +@Column(name="IDENTIFICATIONCATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo IDENTIFICATION +*/ +private String identificationcatalogcode; + +@Column(name="MAXLENGTH", nullable=true) + +/** +* Tamao maximo del tipo de identificacion +*/ +private Integer maxlength; + +@Column(name="PERMITLETTER", nullable=true) + +/** +* Y si el tpo de identificacin permite letras N si no permite +*/ +private String permitletter; + +@Column(name="NAMEBEAN", nullable=true) + +/** +* Nombre del bean que contiene la rutina de validacion del tipo de identificacion +*/ +private String namebean; + +/**Contructor por defecto*/ +public TcustPersonParametersId(){ +} +/**Contructor de TcustPersonParametersId +@param pPk Clave Primaria del entity +*/ +public TcustPersonParametersId(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TcustPersonParametersId +*/ +public static TcustPersonParametersId find(EntityManager pEntityManager,Object pKey) throws Exception{ + TcustPersonParametersId obj = pEntityManager.find(TcustPersonParametersId.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TcustPersonParametersId +@return El objeto que referencia a la Clave primaria de TcustPersonParametersId +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TcustPersonParametersId +@param pPk El objeto que referencia a la nueva Clave primaria de TcustPersonParametersId +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de identificationcatalogcode +@return valor de identificationcatalogcode*/ +public String getIdentificationcatalogcode(){ + return identificationcatalogcode; +} +/**Fija el valor de identificationcatalogcode +@param pIdentificationcatalogcode nuevo Valor de identificationcatalogcode*/ +public void setIdentificationcatalogcode(String pIdentificationcatalogcode){ + identificationcatalogcode=pIdentificationcatalogcode; +} + +/**Obtiene el valor de maxlength +@return valor de maxlength*/ +public Integer getMaxlength(){ + return maxlength; +} +/**Fija el valor de maxlength +@param pMaxlength nuevo Valor de maxlength*/ +public void setMaxlength(Integer pMaxlength){ + maxlength=pMaxlength; +} + +/**Obtiene el valor de permitletter +@return valor de permitletter*/ +public String getPermitletter(){ + return permitletter; +} +/**Fija el valor de permitletter +@param pPermitletter nuevo Valor de permitletter*/ +public void setPermitletter(String pPermitletter){ + permitletter=pPermitletter; +} + +/**Obtiene el valor de namebean +@return valor de namebean*/ +public String getNamebean(){ + return namebean; +} +/**Fija el valor de namebean +@param pNamebean nuevo Valor de namebean*/ +public void setNamebean(String pNamebean){ + namebean=pNamebean; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TcustPersonParametersId))return false; + TcustPersonParametersId that = (TcustPersonParametersId) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TcustPersonParametersId +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TcustPersonParametersId +*/ +public Object createInstance(){ + TcustPersonParametersId instance=new TcustPersonParametersId(); + return instance; +} +/**Clona la entidad TcustPersonParametersId +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TcustPersonParametersId p=(TcustPersonParametersId)this.clone(); + return p; +} +public Object getId() { + return this.pk; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonPersonalReference.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonPersonalReference.java.svn-base new file mode 100644 index 0000000..302f7da --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonPersonalReference.java.svn-base @@ -0,0 +1,400 @@ +package com.fp.persistence.pcustomer.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPERSONPERSONALREFERENCE + */ +@Entity(name = "TcustPersonPersonalReference") +@Table(name = "TCUSTPERSONPERSONALREFERENCE") +public class TcustPersonPersonalReference extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TcustPersonPersonalReference + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(REFERENCESEQUENCE),0)+1 from TCUSTPERSONPERSONALREFERENCE where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "referencesequence") }) + @GeneratedValue(generator = "seq_id") + private TcustPersonPersonalReferenceKey pk; + + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro del telefono + */ + private Timestamp datefrom; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String ingressusercode; + + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String modifyusercode; + + @Column(name = "PERSONALREFCATALOG", nullable = true) + /** + * Codigo de catalogo 1 Padre, 2 Madre, 3 Hermano, 4 cuniado + */ + private String personalrefcatalog; + + @Column(name = "PERSONALREFCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo PERSONALREF , referencias de personas + */ + private String personalrefcatalogcode; + + @Column(name = "REFERENCEPERSONCODE", nullable = true) + /** + * Codigo de persona de referencia de la persona + */ + private Integer referencepersoncode; + + @Column(name = "NAME", nullable = true) + /** + * Nombre de la persona de referencia + */ + private String name; + + @Column(name = "REMARK", nullable = true) + /** + * Observaciones + */ + private String remark; + + /** + * Contructor por defecto + */ + public TcustPersonPersonalReference() { + } + + /** + * Contructor de TcustPersonPersonalReference + * + * @param pPk Clave Primaria del entity + */ + public TcustPersonPersonalReference(TcustPersonPersonalReferenceKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPersonPersonalReference + */ + public static TcustPersonPersonalReference find(EntityManager pEntityManager, TcustPersonPersonalReferenceKey pKey) throws Exception { + TcustPersonPersonalReference obj = pEntityManager.find(TcustPersonPersonalReference.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPersonPersonalReference + * + * @return El objeto que referencia a la Clave primaria de TcustPersonPersonalReference + */ + public TcustPersonPersonalReferenceKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPersonPersonalReference + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TcustPersonPersonalReference + */ + public void setPk(TcustPersonPersonalReferenceKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + /** + * Obtiene el valor de personalrefcatalog + * + * @return valor de personalrefcatalog + */ + public String getPersonalrefcatalog() { + return this.personalrefcatalog; + } + + /** + * Fija el valor de personalrefcatalog + * + * @param pPersonalrefcatalog nuevo Valor de personalrefcatalog + */ + public void setPersonalrefcatalog(String pPersonalrefcatalog) { + this.personalrefcatalog = pPersonalrefcatalog; + } + + /** + * Obtiene el valor de personalrefcatalogcode + * + * @return valor de personalrefcatalogcode + */ + public String getPersonalrefcatalogcode() { + return this.personalrefcatalogcode; + } + + /** + * Fija el valor de personalrefcatalogcode + * + * @param pPersonalrefcatalogcode nuevo Valor de personalrefcatalogcode + */ + public void setPersonalrefcatalogcode(String pPersonalrefcatalogcode) { + this.personalrefcatalogcode = pPersonalrefcatalogcode; + } + + /** + * Obtiene el valor de referencepersoncode + * + * @return valor de referencepersoncode + */ + public Integer getReferencepersoncode() { + return this.referencepersoncode; + } + + /** + * Fija el valor de referencepersoncode + * + * @param pReferencepersoncode nuevo Valor de referencepersoncode + */ + public void setReferencepersoncode(Integer pReferencepersoncode) { + this.referencepersoncode = pReferencepersoncode; + } + + /** + * Obtiene el valor de name + * + * @return valor de name + */ + public String getName() { + return this.name; + } + + /** + * Fija el valor de name + * + * @param pName nuevo Valor de name + */ + public void setName(String pName) { + this.name = pName; + } + + /** + * Obtiene el valor de remark + * + * @return valor de remark + */ + public String getRemark() { + return this.remark; + } + + /** + * Fija el valor de remark + * + * @param pRemark nuevo Valor de remark + */ + public void setRemark(String pRemark) { + this.remark = pRemark; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPersonPersonalReference)) { + return false; + } + TcustPersonPersonalReference that = (TcustPersonPersonalReference) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustPersonPersonalReference + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustPersonPersonalReference + */ + @Override + public Object createInstance() { + TcustPersonPersonalReference instance = new TcustPersonPersonalReference(); + instance.setPk(new TcustPersonPersonalReferenceKey()); + return instance; + } + + /** + * Clona la entidad TcustPersonPersonalReference + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPersonPersonalReference p = (TcustPersonPersonalReference) this.clone(); + p.setPk((TcustPersonPersonalReferenceKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonPersonalReferenceKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonPersonalReferenceKey.java.svn-base new file mode 100644 index 0000000..a94b790 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonPersonalReferenceKey.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPERSONPERSONALREFERENCE*/ +@Embeddable +public class TcustPersonPersonalReferenceKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="REFERENCESEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de referencias personales del cliente +*/ +private Integer referencesequence; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro del telefono +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TcustPersonPersonalReferenceKey(){} +/**Contructor de TcustPersonPersonalReferenceKey +@param pPersoncode Codigo de persona +@param pReferencesequence Secuencia de referencias personales del cliente +@param pDateto Fecha hasta la cual esta vigente el registro del telefono +*/ +public TcustPersonPersonalReferenceKey(Integer pPersoncode,Integer pReferencesequence,Timestamp pDateto){ + personcode=pPersoncode; + referencesequence=pReferencesequence; + dateto=pDateto; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de referencesequence +@return valor de referencesequence*/ +public Integer getReferencesequence(){ + return referencesequence; +} +/**Fija el valor de referencesequence +@param pReferencesequence nuevo Valor de referencesequence*/ +public void setReferencesequence(Integer pReferencesequence){ + referencesequence=pReferencesequence; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TcustPersonPersonalReferenceKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPersonPersonalReferenceKey))return false; + TcustPersonPersonalReferenceKey that = (TcustPersonPersonalReferenceKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getReferencesequence() == null || that.getReferencesequence() == null){ + return false; + } + if (! this.getReferencesequence().equals(that.getReferencesequence())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPersonPersonalReferenceKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getReferencesequence() == null ? 0 : this.getReferencesequence().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonPhone.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonPhone.java.svn-base new file mode 100644 index 0000000..5e74f10 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonPhone.java.svn-base @@ -0,0 +1,432 @@ +package com.fp.persistence.pcustomer.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTPERSONPHONE + */ +@Entity(name = "TcustPersonPhone") +@Table(name = "TCUSTPERSONPHONE") +public class TcustPersonPhone extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustPersonPhone + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(PHONESEQUENCE),0)+1 from TCUSTPERSONPHONE where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "phonesequence")}) + @GeneratedValue(generator = "seq_id") + private TcustPersonPhoneKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro del telefono + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "PHONETYPECATALOG", nullable = true) + /** + * Codigo de catalogo 1 Celular, 2 Fijo + */ + private String phonetypecatalog; + @Column(name = "PHONETYPECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo PHONETYPE + */ + private String phonetypecatalogcode; + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario que crea el registro + */ + private String ingressusercode; + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario que modifica el registro + */ + private String modifyusercode; + @Column(name = "ADDRESSNUMBER", nullable = true) + /** + * Numero de direccion asociada al telefono + */ + private Integer addressnumber; + @Column(name = "AREACODE", nullable = true) + /** + * Codigo de area del telefono + */ + private Integer areacode; + @Column(name = "PHONENUMBER", nullable = true) + /** + * Numero de telefono + */ + private String phonenumber; + @Column(name = "EXTENSION", nullable = true) + /** + * Codigo de extension del telefono + */ + private Integer extension; + + /** + * Contructor por defecto + */ + public TcustPersonPhone() { + } + + /** + * Contructor de TcustPersonPhone + * + * @param pPk Clave Primaria del entity + */ + public TcustPersonPhone(TcustPersonPhoneKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPersonPhone + */ + public static TcustPersonPhone find(EntityManager pEntityManager, TcustPersonPhoneKey pKey) throws Exception { + TcustPersonPhone obj = pEntityManager.find(TcustPersonPhone.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPersonPhone + * + * @return El objeto que referencia a la Clave primaria de TcustPersonPhone + */ + public TcustPersonPhoneKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPersonPhone + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustPersonPhone + */ + public void setPk(TcustPersonPhoneKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de phonetypecatalog + * + * @return valor de phonetypecatalog + */ + public String getPhonetypecatalog() { + return this.phonetypecatalog; + } + + /** + * Fija el valor de phonetypecatalog + * + * @param pPhonetypecatalog nuevo Valor de phonetypecatalog + */ + public void setPhonetypecatalog(String pPhonetypecatalog) { + this.phonetypecatalog = pPhonetypecatalog; + } + + /** + * Obtiene el valor de phonetypecatalogcode + * + * @return valor de phonetypecatalogcode + */ + public String getPhonetypecatalogcode() { + return this.phonetypecatalogcode; + } + + /** + * Fija el valor de phonetypecatalogcode + * + * @param pPhonetypecatalogcode nuevo Valor de phonetypecatalogcode + */ + public void setPhonetypecatalogcode(String pPhonetypecatalogcode) { + this.phonetypecatalogcode = pPhonetypecatalogcode; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + /** + * Obtiene el valor de addressnumber + * + * @return valor de addressnumber + */ + public Integer getAddressnumber() { + return this.addressnumber; + } + + /** + * Fija el valor de addressnumber + * + * @param pAddressnumber nuevo Valor de addressnumber + */ + public void setAddressnumber(Integer pAddressnumber) { + this.addressnumber = pAddressnumber; + } + + /** + * Obtiene el valor de areacode + * + * @return valor de areacode + */ + public Integer getAreacode() { + return this.areacode; + } + + /** + * Fija el valor de areacode + * + * @param pAreacode nuevo Valor de areacode + */ + public void setAreacode(Integer pAreacode) { + this.areacode = pAreacode; + } + + /** + * Obtiene el valor de phonenumber + * + * @return valor de phonenumber + */ + public String getPhonenumber() { + return this.phonenumber; + } + + /** + * Fija el valor de phonenumber + * + * @param pPhonenumber nuevo Valor de phonenumber + */ + public void setPhonenumber(String pPhonenumber) { + this.phonenumber = pPhonenumber; + } + + /** + * Obtiene el valor de extension + * + * @return valor de extension + */ + public Integer getExtension() { + return this.extension; + } + + /** + * Fija el valor de extension + * + * @param pExtension nuevo Valor de extension + */ + public void setExtension(Integer pExtension) { + this.extension = pExtension; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPersonPhone)) { + return false; + } + TcustPersonPhone that = (TcustPersonPhone) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustPersonPhone + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustPersonPhone + */ + @Override + public Object createInstance() { + TcustPersonPhone instance = new TcustPersonPhone(); + instance.setPk(new TcustPersonPhoneKey()); + return instance; + } + + /** + * Clona la entidad TcustPersonPhone + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPersonPhone p = (TcustPersonPhone) this.clone(); + p.setPk((TcustPersonPhoneKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + /** + * jpql Que retorna un objeto TcustPersonPhone a partir de un parametros + * espec�ficos + */ + public static final String JPQL_GET_ACCOUNT_PARAMETER = "from TcustPersonPhone t" + " where t.pk.personcode = :personcode " + + "and t.pk.dateto = :dateto "; + + public static List findPhones(EntityManager pEntityManager, Integer personcode, Timestamp dateto) throws Exception { + List lTcustPersonPhone = new ArrayList(); + Query qry = pEntityManager.createQuery(TcustPersonPhone.JPQL_GET_ACCOUNT_PARAMETER); + qry.setParameter("personcode", personcode); + qry.setParameter("dateto", dateto); + return lTcustPersonPhone = qry.getResultList(); + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonPhoneKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonPhoneKey.java.svn-base new file mode 100644 index 0000000..547db10 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TcustPersonPhoneKey.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPERSONPHONE*/ +@Embeddable +public class TcustPersonPhoneKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro del telefono +*/ +private Timestamp dateto; + +@Column(name="PHONESEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de telefonos del cliente +*/ +private Integer phonesequence; + +/**Contructor por defecto*/ +public TcustPersonPhoneKey(){} +/**Contructor de TcustPersonPhoneKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro del telefono +@param pPhonesequence Secuencia de telefonos del cliente +*/ +public TcustPersonPhoneKey(Integer pPersoncode,Timestamp pDateto,Integer pPhonesequence){ + personcode=pPersoncode; + dateto=pDateto; + phonesequence=pPhonesequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de phonesequence +@return valor de phonesequence*/ +public Integer getPhonesequence(){ + return phonesequence; +} +/**Fija el valor de phonesequence +@param pPhonesequence nuevo Valor de phonesequence*/ +public void setPhonesequence(Integer pPhonesequence){ + phonesequence=pPhonesequence; +} + +/**Implementacin de la comparacin de TcustPersonPhoneKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPersonPhoneKey))return false; + TcustPersonPhoneKey that = (TcustPersonPhoneKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getPhonesequence() == null || that.getPhonesequence() == null){ + return false; + } + if (! this.getPhonesequence().equals(that.getPhonesequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPersonPhoneKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getPhonesequence() == null ? 0 : this.getPhonesequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TgeneActivity.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TgeneActivity.java.svn-base new file mode 100644 index 0000000..90cd0ea --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TgeneActivity.java.svn-base @@ -0,0 +1,233 @@ +package com.fp.persistence.pcustomer.gene; + +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACTIVITY*/ +@Entity(name="TgeneActivity") +@Table(name="TGENEACTIVITY") +public class TgeneActivity extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneActivity +*/ +@Id +@Column(name="ACTIVITYCODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="SEGMENTTYPECATALOG", nullable=false) + +/** +* Codigo de catalogo 1 servicios, 2 minas 3 petrolesos +*/ +private String segmenttypecatalog; + +@Column(name="SEGMENTTYPECATALOGCODE", nullable=false) + +/** +* Codigo de tabla de catalogo SEGMENTTYPE tipo de segmento +*/ +private String segmenttypecatalogcode; + +@Column(name="CIIUCODE", nullable=true) + +/** +* Codigo de ciiu +*/ +private String ciiucode; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion de la actividad +*/ +private String description; + +@Column(name="MODIFYUSER", nullable=true) + +/** +* null +*/ +private String modifyuser; + +@Column(name="MODIFYDATE", nullable=true) + +/** +* null +*/ +private Timestamp modifydate; + +/**Contructor por defecto*/ +public TgeneActivity(){ +} +/**Contructor de TgeneActivity +@param pPk Clave Primaria del entity +@param pSegmenttypecatalog Codigo de catalogo 1 servicios, 2 minas 3 petrolesos +@param pSegmenttypecatalogcode Codigo de tabla de catalogo SEGMENTTYPE tipo de segmento +*/ +public TgeneActivity(String pPk,String pSegmenttypecatalog,String pSegmenttypecatalogcode){ + this(); + pk=pPk; + segmenttypecatalog=pSegmenttypecatalog; + segmenttypecatalogcode=pSegmenttypecatalogcode; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneActivity +*/ +public static TgeneActivity find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneActivity obj = pEntityManager.find(TgeneActivity.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneActivity +@return El objeto que referencia a la Clave primaria de TgeneActivity +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneActivity +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneActivity +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de segmenttypecatalog +@return valor de segmenttypecatalog*/ +public String getSegmenttypecatalog(){ + return segmenttypecatalog; +} +/**Fija el valor de segmenttypecatalog +@param pSegmenttypecatalog nuevo Valor de segmenttypecatalog*/ +public void setSegmenttypecatalog(String pSegmenttypecatalog){ + segmenttypecatalog=pSegmenttypecatalog; +} + +/**Obtiene el valor de segmenttypecatalogcode +@return valor de segmenttypecatalogcode*/ +public String getSegmenttypecatalogcode(){ + return segmenttypecatalogcode; +} +/**Fija el valor de segmenttypecatalogcode +@param pSegmenttypecatalogcode nuevo Valor de segmenttypecatalogcode*/ +public void setSegmenttypecatalogcode(String pSegmenttypecatalogcode){ + segmenttypecatalogcode=pSegmenttypecatalogcode; +} + +/**Obtiene el valor de ciiucode +@return valor de ciiucode*/ +public String getCiiucode(){ + return ciiucode; +} +/**Fija el valor de ciiucode +@param pCiiucode nuevo Valor de ciiucode*/ +public void setCiiucode(String pCiiucode){ + ciiucode=pCiiucode; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de modifyuser +@return valor de modifyuser*/ +public String getModifyuser(){ + return modifyuser; +} +/**Fija el valor de modifyuser +@param pModifyuser nuevo Valor de modifyuser*/ +public void setModifyuser(String pModifyuser){ + modifyuser=pModifyuser; +} + +/**Obtiene el valor de modifydate +@return valor de modifydate*/ +public Timestamp getModifydate(){ + return modifydate; +} +/**Fija el valor de modifydate +@param pModifydate nuevo Valor de modifydate*/ +public void setModifydate(Timestamp pModifydate){ + modifydate=pModifydate; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneActivity))return false; + TgeneActivity that = (TgeneActivity) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneActivity +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneActivity +*/ +public Object createInstance(){ + TgeneActivity instance=new TgeneActivity(); + return instance; +} +/**Clona la entidad TgeneActivity +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneActivity p=(TgeneActivity)this.clone(); + return p; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TgeneCiiu.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TgeneCiiu.java.svn-base new file mode 100644 index 0000000..c2d9f86 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/.svn/text-base/TgeneCiiu.java.svn-base @@ -0,0 +1,253 @@ +package com.fp.persistence.pcustomer.gene; + +import javax.persistence.Entity; +import com.fp.dto.hb.Log; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENECIIU + */ +@Entity(name = "TgeneCiiu") +@Table(name = "TGENECIIU") +public class TgeneCiiu extends com.fp.dto.AbstractDataTransport + implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneCiiu + */ + @Id + @Column(name = "CIIUCODE", nullable = false, updatable = false) + private String pk; + @Column(name = "DESCRIPTION", nullable = true) + /** + * Descripcion de la actividad + */ + private String description; + @Column(name = "LASTNODE", nullable = true) + /** + * Codigo del ultimo nodo + */ + private String lastnode; + @Column(name = "PARENTCODE", nullable = true) + /** + * Codigo de ciiu padre + */ + private String parentcode; + @Column(name = "LEVELCODE", nullable = true) + /** + * Codigo de nivel + */ + private Integer levelcode; + + /** + * Contructor por defecto + */ + public TgeneCiiu() { + } + + /** + * Contructor de TgeneCiiu + * + * @param pPk Clave Primaria del entity + */ + public TgeneCiiu(String pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneCiiu + */ + public static TgeneCiiu find(EntityManager pEntityManager, Object pKey) throws Exception { + TgeneCiiu obj = pEntityManager.find(TgeneCiiu.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneCiiu + * + * @return El objeto que referencia a la Clave primaria de TgeneCiiu + */ + public String getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneCiiu + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TgeneCiiu + */ + public void setPk(String pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + /** + * Obtiene el valor de lastnode + * + * @return valor de lastnode + */ + public String getLastnode() { + return lastnode; + } + + /** + * Fija el valor de lastnode + * + * @param pLastnode nuevo Valor de lastnode + */ + public void setLastnode(String pLastnode) { + lastnode = pLastnode; + } + + /** + * Obtiene el valor de parentcode + * + * @return valor de parentcode + */ + public String getParentcode() { + return parentcode; + } + + /** + * Fija el valor de parentcode + * + * @param pParentcode nuevo Valor de parentcode + */ + public void setParentcode(String pParentcode) { + parentcode = pParentcode; + } + + /** + * Obtiene el valor de levelcode + * + * @return valor de levelcode + */ + public Integer getLevelcode() { + return levelcode; + } + + /** + * Fija el valor de levelcode + * + * @param pLevelcode nuevo Valor de levelcode + */ + public void setLevelcode(Integer pLevelcode) { + levelcode = pLevelcode; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneCiiu)) { + return false; + } + TgeneCiiu that = (TgeneCiiu) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneCiiu + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco TgeneCiiu + */ + public Object createInstance() { + TgeneCiiu instance = new TgeneCiiu(); + return instance; + } + + /** + * Clona la entidad TgeneCiiu + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneCiiu p = (TgeneCiiu) this.clone(); + return p; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPerson.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPerson.java new file mode 100644 index 0000000..641efcb --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPerson.java @@ -0,0 +1,120 @@ +package com.fp.persistence.pcustomer.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPERSON*/ +@Entity(name="TcustPerson") +@Table(name="TCUSTPERSON") +public class TcustPerson extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TcustPerson +*/ +@Id +@Column(name="PERSONCODE" ,nullable=false, updatable=false) +private Integer pk; +/**Contructor por defecto*/ +public TcustPerson(){ +} +/**Contructor de TcustPerson +@param pPk Clave Primaria del entity +*/ +public TcustPerson(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TcustPerson +*/ +public static TcustPerson find(EntityManager pEntityManager,Object pKey) throws Exception{ + TcustPerson obj = pEntityManager.find(TcustPerson.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TcustPerson +@return El objeto que referencia a la Clave primaria de TcustPerson +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TcustPerson +@param pPk El objeto que referencia a la nueva Clave primaria de TcustPerson +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TcustPerson))return false; + TcustPerson that = (TcustPerson) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TcustPerson +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TcustPerson +*/ +public Object createInstance(){ + TcustPerson instance=new TcustPerson(); + return instance; +} +/**Clona la entidad TcustPerson +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TcustPerson p=(TcustPerson)this.clone(); + return p; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonAddress.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonAddress.java new file mode 100644 index 0000000..64caa80 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonAddress.java @@ -0,0 +1,701 @@ +package com.fp.persistence.pcustomer.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.GeneratedValue; +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPERSONADDRESS + */ +@Entity(name = "TcustPersonAddress") +@Table(name = "TCUSTPERSONADDRESS") +public class TcustPersonAddress extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TcustPersonAddress + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(ADDRESSNUMBER),0)+1 from TCUSTPERSONADDRESS where PERSONCODE = :personcode and DATETO = :dateto"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "personcode,pk.personcode;dateto,pk.dateto"), @Parameter(name = "field", value = "addressnumber") }) + @GeneratedValue(generator = "seq_id") + private TcustPersonAddressKey pk; + + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro de la direccion. + */ + private Timestamp datefrom; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Manejo de optimistic locking + */ + private Integer recordversion; + + @Column(name = "ADDRESSTYPECATALOG", nullable = true) + /** + * Codigo de catalogo 1 OFICINA, 2 DOMICILIO + */ + private String addresstypecatalog; + + @Column(name = "ADDRESSTYPECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo ADDRESSTYPE, codigo de tipo de saldo + */ + private String addresstypecatalogcode; + + @Column(name = "COUNTRYCODE", nullable = true) + /** + * Codigo de pa�s + */ + private String countrycode; + + @Column(name = "PROVINCECODE", nullable = true) + /** + * Codigo de provincia + */ + private String provincecode; + + @Column(name = "CANTONCODE", nullable = true) + /** + * Codigo de canton + */ + private String cantoncode; + + @Column(name = "CITYCODE", nullable = true) + /** + * Codigo de cuidad + */ + private String citycode; + + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario que crea el registro + */ + private String ingressusercode; + + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario que modifica el registro + */ + private String modifyusercode; + + @Column(name = "PRINCIPAL", nullable = true) + /** + * Y indica que es la direccion principal del cliente, N no es la direccion + * principal + */ + private String principal; + + @Column(name = "STREET", nullable = true) + /** + * Calle o avenida en la que se encuentra la direccion + */ + private String street; + + @Column(name = "STREETNUMBER", nullable = true) + /** + * Numero de casa o departamento + */ + private String streetnumber; + + @Column(name = "DEPARTMENT", nullable = true) + /** + * Numero de departamento + */ + private String department; + + @Column(name = "URBANIZATION", nullable = true) + /** + * Nombre del urbanizacion + */ + private String urbanization; + + @Column(name = "ADDRESS", nullable = true) + /** + * Texto libre de la direccion. + */ + private String address; + + @Column(name = "REMARK", nullable = true) + /** + * Comentarios, texto libre + */ + private String remark; + + @Column(name = "PARROQUIACODE", nullable = true) + /** + * Codigo de parroquia + */ + private String parroquiacode; + + /** + * Contructor por defecto + */ + public TcustPersonAddress() { + } + + /** + * Contructor de TcustPersonAddress + * + * @param pPk Clave Primaria del entity + */ + public TcustPersonAddress(TcustPersonAddressKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPersonAddress + */ + public static TcustPersonAddress find(EntityManager pEntityManager, TcustPersonAddressKey pKey) throws Exception { + TcustPersonAddress obj = pEntityManager.find(TcustPersonAddress.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPersonAddress + * + * @return El objeto que referencia a la Clave primaria de TcustPersonAddress + */ + public TcustPersonAddressKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPersonAddress + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TcustPersonAddress + */ + public void setPk(TcustPersonAddressKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de addresstypecatalog + * + * @return valor de addresstypecatalog + */ + public String getAddresstypecatalog() { + return this.addresstypecatalog; + } + + /** + * Fija el valor de addresstypecatalog + * + * @param pAddresstypecatalog nuevo Valor de addresstypecatalog + */ + public void setAddresstypecatalog(String pAddresstypecatalog) { + this.addresstypecatalog = pAddresstypecatalog; + } + + /** + * Obtiene el valor de addresstypecatalogcode + * + * @return valor de addresstypecatalogcode + */ + public String getAddresstypecatalogcode() { + return this.addresstypecatalogcode; + } + + /** + * Fija el valor de addresstypecatalogcode + * + * @param pAddresstypecatalogcode nuevo Valor de addresstypecatalogcode + */ + public void setAddresstypecatalogcode(String pAddresstypecatalogcode) { + this.addresstypecatalogcode = pAddresstypecatalogcode; + } + + /** + * Obtiene el valor de countrycode + * + * @return valor de countrycode + */ + public String getCountrycode() { + return this.countrycode; + } + + /** + * Fija el valor de countrycode + * + * @param pCountrycode nuevo Valor de countrycode + */ + public void setCountrycode(String pCountrycode) { + this.countrycode = pCountrycode; + } + + /** + * Obtiene el valor de provincecode + * + * @return valor de provincecode + */ + public String getProvincecode() { + return this.provincecode; + } + + /** + * Fija el valor de provincecode + * + * @param pProvincecode nuevo Valor de provincecode + */ + public void setProvincecode(String pProvincecode) { + this.provincecode = pProvincecode; + } + + /** + * Obtiene el valor de cantoncode + * + * @return valor de cantoncode + */ + public String getCantoncode() { + return this.cantoncode; + } + + /** + * Fija el valor de cantoncode + * + * @param pCantoncode nuevo Valor de cantoncode + */ + public void setCantoncode(String pCantoncode) { + this.cantoncode = pCantoncode; + } + + /** + * Obtiene el valor de citycode + * + * @return valor de citycode + */ + public String getCitycode() { + return this.citycode; + } + + /** + * Fija el valor de citycode + * + * @param pCitycode nuevo Valor de citycode + */ + public void setCitycode(String pCitycode) { + this.citycode = pCitycode; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + /** + * Obtiene el valor de principal + * + * @return valor de principal + */ + public String getPrincipal() { + return this.principal; + } + + /** + * Fija el valor de principal + * + * @param pPrincipal nuevo Valor de principal + */ + public void setPrincipal(String pPrincipal) { + this.principal = pPrincipal; + } + + /** + * Obtiene el valor de street + * + * @return valor de street + */ + public String getStreet() { + return this.street; + } + + /** + * Fija el valor de street + * + * @param pStreet nuevo Valor de street + */ + public void setStreet(String pStreet) { + this.street = pStreet; + } + + /** + * Obtiene el valor de streetnumber + * + * @return valor de streetnumber + */ + public String getStreetnumber() { + return this.streetnumber; + } + + /** + * Fija el valor de streetnumber + * + * @param pStreetnumber nuevo Valor de streetnumber + */ + public void setStreetnumber(String pStreetnumber) { + this.streetnumber = pStreetnumber; + } + + /** + * Obtiene el valor de department + * + * @return valor de department + */ + public String getDepartment() { + return this.department; + } + + /** + * Fija el valor de department + * + * @param pDepartment nuevo Valor de department + */ + public void setDepartment(String pDepartment) { + this.department = pDepartment; + } + + /** + * Obtiene el valor de urbanization + * + * @return valor de urbanization + */ + public String getUrbanization() { + return this.urbanization; + } + + /** + * Fija el valor de urbanization + * + * @param pUrbanization nuevo Valor de urbanization + */ + public void setUrbanization(String pUrbanization) { + this.urbanization = pUrbanization; + } + + /** + * Obtiene el valor de address + * + * @return valor de address + */ + public String getAddress() { + return this.address; + } + + /** + * Fija el valor de address + * + * @param pAddress nuevo Valor de address + */ + public void setAddress(String pAddress) { + this.address = pAddress; + } + + /** + * Obtiene el valor de remark + * + * @return valor de remark + */ + public String getRemark() { + return this.remark; + } + + /** + * Fija el valor de remark + * + * @param pRemark nuevo Valor de remark + */ + public void setRemark(String pRemark) { + this.remark = pRemark; + } + + /** + * Obtiene el valor de parroquiacode + * + * @return valor de parroquiacode + */ + public String getParroquiacode() { + return this.parroquiacode; + } + + /** + * Fija el valor de parroquiacode + * + * @param pParroquiacode nuevo Valor de parroquiacode + */ + public void setParroquiacode(String pParroquiacode) { + this.parroquiacode = pParroquiacode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPersonAddress)) { + return false; + } + TcustPersonAddress that = (TcustPersonAddress) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustPersonAddress + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustPersonAddress + */ + @Override + public Object createInstance() { + TcustPersonAddress instance = new TcustPersonAddress(); + instance.setPk(new TcustPersonAddressKey()); + return instance; + } + + /** + * Clona la entidad TcustPersonAddress + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPersonAddress p = (TcustPersonAddress) this.clone(); + p.setPk((TcustPersonAddressKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + + // Metodos manuales + private static final String JPQL_EMAIL = "from TcustPersonAddress t" + " where t.pk.personcode = :personcode " + " and t.pk.dateto = :dateto " + + " and t.addresstypecatalog = :addresstype "; + + /** + * Metodo que emtrega la direccion email de una persona, si existe mas de una direccion email asociada a una persona + * entrega la primera que encuentre en la base. + * + * @param pEntityManager Session de la base de datos + * @param pPersonCode Codigo de persona. + * @return String + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static String getEmail(EntityManager pEntityManager, Integer pPersonCode) throws Exception { + String email = null; + Query qry = pEntityManager.createQuery(TcustPersonAddress.JPQL_EMAIL); + qry.setParameter("personcode", pPersonCode); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + qry.setParameter("addresstype", "3"); + List ldata = qry.getResultList(); + if ((ldata == null) || ldata.isEmpty()) { + return email; + } + for (TcustPersonAddress obj : ldata) { + email = obj.getAddress(); + break; + } + return email; + } + + /** + * Sentencia que devuelve un registro vigente de TcustPersonAddress + */ + private static final String JPQL_PERSON_ADDRESS = "from TcustPersonAddress tcpa" + " where tcpa.pk.personcode = :personcode" + + " and tcpa.pk.addressnumber = :addressnumber" + " and tcpa.pk.dateto = :dateto"; + + /** + * Metodo que entrega datos de una Direccion definida en TcustPersonAddress. + * + * @param pEntityManager Session de la base de datos. + * @param personcode Codigo de la persona a quien pertenece la Direccion. + * @param addressnumber Numero de la direccion. + * @return tcustPersonAddress + * @throws Exception + */ + public static TcustPersonAddress findByPersonCode(EntityManager pEntityManager, Integer personcode, Integer addressnumber) throws Exception { + Query qry = pEntityManager.createQuery(TcustPersonAddress.JPQL_PERSON_ADDRESS); + qry.setParameter("personcode", personcode); + qry.setParameter("addressnumber", addressnumber); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + try { + return (TcustPersonAddress) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + + /** + * Sentencia que devuelve un registro vigente de TcustPersonAddress + */ + private static final String JPQL_PERSON = "from TcustPersonAddress tcpa" + " where tcpa.pk.personcode = :personcode" + + " and tcpa.pk.dateto = :dateto"; + + /** + * Metodo que entrega datos de una Direccion definida en TcustPersonAddress. + * + * @param pEntityManager Session de la base de datos. + * @param personcode Codigo de la persona a quien pertenece la Direccion. + * @param addressnumber Numero de la direccion. + * @return tcustPersonAddress + * @throws Exception + */ + public static List findByPersonCode(EntityManager pEntityManager, Integer personcode) throws Exception { + Query qry = pEntityManager.createQuery(TcustPersonAddress.JPQL_PERSON); + qry.setParameter("personcode", personcode); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + return qry.getResultList(); + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonAddressKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonAddressKey.java new file mode 100644 index 0000000..4ee10fa --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonAddressKey.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPERSONADDRESS*/ +@Embeddable +public class TcustPersonAddressKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="ADDRESSNUMBER", nullable=false,updatable=false) + +/** +* Numero de direccion, secuencia por codigo de persona. +*/ +private Integer addressnumber; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro de la direccion. +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TcustPersonAddressKey(){} +/**Contructor de TcustPersonAddressKey +@param pPersoncode Codigo de persona +@param pAddressnumber Numero de direccion, secuencia por codigo de persona. +@param pDateto Fecha hasta la cual esta vigente el registro de la direccion. +*/ +public TcustPersonAddressKey(Integer pPersoncode,Integer pAddressnumber,Timestamp pDateto){ + personcode=pPersoncode; + addressnumber=pAddressnumber; + dateto=pDateto; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de addressnumber +@return valor de addressnumber*/ +public Integer getAddressnumber(){ + return addressnumber; +} +/**Fija el valor de addressnumber +@param pAddressnumber nuevo Valor de addressnumber*/ +public void setAddressnumber(Integer pAddressnumber){ + addressnumber=pAddressnumber; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TcustPersonAddressKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPersonAddressKey))return false; + TcustPersonAddressKey that = (TcustPersonAddressKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getAddressnumber() == null || that.getAddressnumber() == null){ + return false; + } + if (! this.getAddressnumber().equals(that.getAddressnumber())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPersonAddressKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getAddressnumber() == null ? 0 : this.getAddressnumber().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonBankReference.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonBankReference.java new file mode 100644 index 0000000..7f3b798 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonBankReference.java @@ -0,0 +1,534 @@ +package com.fp.persistence.pcustomer.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTPERSONBANKREFERENCE + */ +@Entity(name = "TcustPersonBankReference") +@Table(name = "TCUSTPERSONBANKREFERENCE") +public class TcustPersonBankReference extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustPersonBankReference + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(REFERENCESEQUENCE),0)+1 from TCUSTPERSONBANKREFERENCE where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "referencesequence")}) + @GeneratedValue(generator = "seq_id") + private TcustPersonBankReferenceKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro del telefono + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String ingressusercode; + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String modifyusercode; + @Column(name = "BANKPERSONCODE", nullable = true) + /** + * Codigo de persona asociada al banco de referencia de la persona + */ + private Integer bankpersoncode; + @Column(name = "NAME", nullable = true) + /** + * Nombre de la institucion fincniera asociada a la cuenta de referencia + */ + private String name; + @Column(name = "ACCOUNTTYPECATALOG", nullable = true) + /** + * Codigo de catalogo 1 Corriente, 2 Ahorro + */ + private String accounttypecatalog; + @Column(name = "ACCOUNTTYPECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo ACCOUNTTYPE de tipo de cuenta + */ + private String accounttypecatalogcode; + @Column(name = "ACCOUNTNUMBER", nullable = true) + /** + * Numero de cuenta, de referencia bancaria + */ + private String accountnumber; + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + @Column(name = "FIGURESNUMBER", nullable = true) + /** + * Numero de cifras de manejo + */ + private Integer figuresnumber; + @Column(name = "FIGURESCATALOG", nullable = true) + /** + * Codigo de catalogo 1 Altas, 2 medias, 3 bajas + */ + private String figurescatalog; + @Column(name = "FIGURESCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo FIGURES cifras de manejo + */ + private String figurescatalogcode; + @Column(name = "OPENINGDATE", nullable = true) + /** + * Fecha de apertura de la cuenta + */ + private Date openingdate; + @Column(name = "REMARK", nullable = true) + /** + * Observaciones + */ + private String remark; + + /** + * Contructor por defecto + */ + public TcustPersonBankReference() { + } + + /** + * Contructor de TcustPersonBankReference + * + * @param pPk Clave Primaria del entity + */ + public TcustPersonBankReference(TcustPersonBankReferenceKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPersonBankReference + */ + public static TcustPersonBankReference find(EntityManager pEntityManager, TcustPersonBankReferenceKey pKey) throws Exception { + TcustPersonBankReference obj = pEntityManager.find(TcustPersonBankReference.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPersonBankReference + * + * @return El objeto que referencia a la Clave primaria de + * TcustPersonBankReference + */ + public TcustPersonBankReferenceKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPersonBankReference + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustPersonBankReference + */ + public void setPk(TcustPersonBankReferenceKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + /** + * Obtiene el valor de bankpersoncode + * + * @return valor de bankpersoncode + */ + public Integer getBankpersoncode() { + return this.bankpersoncode; + } + + /** + * Fija el valor de bankpersoncode + * + * @param pBankpersoncode nuevo Valor de bankpersoncode + */ + public void setBankpersoncode(Integer pBankpersoncode) { + this.bankpersoncode = pBankpersoncode; + } + + /** + * Obtiene el valor de name + * + * @return valor de name + */ + public String getName() { + return this.name; + } + + /** + * Fija el valor de name + * + * @param pName nuevo Valor de name + */ + public void setName(String pName) { + this.name = pName; + } + + /** + * Obtiene el valor de accounttypecatalog + * + * @return valor de accounttypecatalog + */ + public String getAccounttypecatalog() { + return this.accounttypecatalog; + } + + /** + * Fija el valor de accounttypecatalog + * + * @param pAccounttypecatalog nuevo Valor de accounttypecatalog + */ + public void setAccounttypecatalog(String pAccounttypecatalog) { + this.accounttypecatalog = pAccounttypecatalog; + } + + /** + * Obtiene el valor de accounttypecatalogcode + * + * @return valor de accounttypecatalogcode + */ + public String getAccounttypecatalogcode() { + return this.accounttypecatalogcode; + } + + /** + * Fija el valor de accounttypecatalogcode + * + * @param pAccounttypecatalogcode nuevo Valor de accounttypecatalogcode + */ + public void setAccounttypecatalogcode(String pAccounttypecatalogcode) { + this.accounttypecatalogcode = pAccounttypecatalogcode; + } + + /** + * Obtiene el valor de accountnumber + * + * @return valor de accountnumber + */ + public String getAccountnumber() { + return this.accountnumber; + } + + /** + * Fija el valor de accountnumber + * + * @param pAccountnumber nuevo Valor de accountnumber + */ + public void setAccountnumber(String pAccountnumber) { + this.accountnumber = pAccountnumber; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de figuresnumber + * + * @return valor de figuresnumber + */ + public Integer getFiguresnumber() { + return this.figuresnumber; + } + + /** + * Fija el valor de figuresnumber + * + * @param pFiguresnumber nuevo Valor de figuresnumber + */ + public void setFiguresnumber(Integer pFiguresnumber) { + this.figuresnumber = pFiguresnumber; + } + + /** + * Obtiene el valor de figurescatalog + * + * @return valor de figurescatalog + */ + public String getFigurescatalog() { + return this.figurescatalog; + } + + /** + * Fija el valor de figurescatalog + * + * @param pFigurescatalog nuevo Valor de figurescatalog + */ + public void setFigurescatalog(String pFigurescatalog) { + this.figurescatalog = pFigurescatalog; + } + + /** + * Obtiene el valor de figurescatalogcode + * + * @return valor de figurescatalogcode + */ + public String getFigurescatalogcode() { + return this.figurescatalogcode; + } + + /** + * Fija el valor de figurescatalogcode + * + * @param pFigurescatalogcode nuevo Valor de figurescatalogcode + */ + public void setFigurescatalogcode(String pFigurescatalogcode) { + this.figurescatalogcode = pFigurescatalogcode; + } + + /** + * Obtiene el valor de openingdate + * + * @return valor de openingdate + */ + public Date getOpeningdate() { + return this.openingdate; + } + + /** + * Fija el valor de openingdate + * + * @param pOpeningdate nuevo Valor de openingdate + */ + public void setOpeningdate(Date pOpeningdate) { + this.openingdate = pOpeningdate; + } + + /** + * Obtiene el valor de remark + * + * @return valor de remark + */ + public String getRemark() { + return this.remark; + } + + /** + * Fija el valor de remark + * + * @param pRemark nuevo Valor de remark + */ + public void setRemark(String pRemark) { + this.remark = pRemark; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPersonBankReference)) { + return false; + } + TcustPersonBankReference that = (TcustPersonBankReference) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad + * TcustPersonBankReference + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco + * TcustPersonBankReference + */ + @Override + public Object createInstance() { + TcustPersonBankReference instance = new TcustPersonBankReference(); + instance.setPk(new TcustPersonBankReferenceKey()); + return instance; + } + + /** + * Clona la entidad TcustPersonBankReference + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPersonBankReference p = (TcustPersonBankReference) this.clone(); + p.setPk((TcustPersonBankReferenceKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonBankReferenceKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonBankReferenceKey.java new file mode 100644 index 0000000..f85592f --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonBankReferenceKey.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPERSONBANKREFERENCE*/ +@Embeddable +public class TcustPersonBankReferenceKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="REFERENCESEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de referencias bancarias del cliente +*/ +private Integer referencesequence; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro del telefono +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TcustPersonBankReferenceKey(){} +/**Contructor de TcustPersonBankReferenceKey +@param pPersoncode Codigo de persona +@param pReferencesequence Secuencia de referencias bancarias del cliente +@param pDateto Fecha hasta la cual esta vigente el registro del telefono +*/ +public TcustPersonBankReferenceKey(Integer pPersoncode,Integer pReferencesequence,Timestamp pDateto){ + personcode=pPersoncode; + referencesequence=pReferencesequence; + dateto=pDateto; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de referencesequence +@return valor de referencesequence*/ +public Integer getReferencesequence(){ + return referencesequence; +} +/**Fija el valor de referencesequence +@param pReferencesequence nuevo Valor de referencesequence*/ +public void setReferencesequence(Integer pReferencesequence){ + referencesequence=pReferencesequence; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TcustPersonBankReferenceKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPersonBankReferenceKey))return false; + TcustPersonBankReferenceKey that = (TcustPersonBankReferenceKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getReferencesequence() == null || that.getReferencesequence() == null){ + return false; + } + if (! this.getReferencesequence().equals(that.getReferencesequence())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPersonBankReferenceKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getReferencesequence() == null ? 0 : this.getReferencesequence().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonDetail.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonDetail.java new file mode 100644 index 0000000..8195705 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonDetail.java @@ -0,0 +1,821 @@ +package com.fp.persistence.pcustomer.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; + +import java.sql.Timestamp; + +import com.fp.dto.hb.Log; + +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +import javax.persistence.NoResultException; + +import com.fp.general.exception.GeneralException; +import com.fp.common.helper.Constant; + +import javax.persistence.Query; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPERSONDETAIL*/ +@Entity(name="TcustPersonDetail") +@Table(name="TCUSTPERSONDETAIL") +public class TcustPersonDetail extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TcustPersonDetail +*/ +@EmbeddedId +private TcustPersonDetailKey pk; +@Version +@Column(name="RECORDVERSION", nullable=false) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DATEFROM", nullable=true) + +/** +* Fecha desde la cual esta vigente el registro +*/ +private Timestamp datefrom; + +@Column(name="NAME", nullable=false) + +/** +* Nombre Legal de la persona +*/ +private String name; + +@Column(name="NICKNAME", nullable=true) + +/** +* Nombre preferido +*/ +private String nickname; + +@Column(name="IDENTIFICATIONCATALOG", nullable=true) + +/** +* CED, Cedula, RUC ruc, PAS pasoporte etc. +*/ +private String identificationcatalog; + +@Column(name="IDENTIFICATIONCATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo IDENTIFICATION +*/ +private String identificationcatalogcode; + +@Column(name="IDENTIFICATION", nullable=false) + +/** +* Numero de cedula, ruc, pasaporte, etc.. +*/ +private String identification; + +@Column(name="INGRESSUSER", nullable=true) + +/** +* Codigo de usuario que crea el cliente +*/ +private String ingressuser; + +@Column(name="MODIFYUSER", nullable=true) + +/** +* Codigo de usuario que modifica datos del cliente +*/ +private String modifyuser; + +@Column(name="LANGUAGECODE", nullable=true) + +/** +* Codigo de idioma +*/ +private String languagecode; + +@Column(name="OFFICECODE", nullable=true) + +/** +* Codigo de oficina en la que se ingreso la persona. +*/ +private Integer officecode; + +@Column(name="BRANCHCODE", nullable=true) + +/** +* Codigo de sucursal en la que se ingreso la persona. +*/ +private Integer branchcode; + +@Column(name="COMPANYCODE", nullable=true) + +/** +* Codigo de compania al que pertenece la oficina +*/ +private Integer companycode; + +@Column(name="PERSONTYPECATALOG", nullable=true) + +/** +* Codigo de catalogo 1 Natural, 2 Juridico +*/ +private String persontypecatalog; + +@Column(name="PERSONTYPECATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo PERSONTYPE, de tipo de persona +*/ +private String persontypecatalogcode; + +@Column(name="REGISTERDATE", nullable=true) + +/** +* Fecha de ingreso inicial de la persona. +*/ +private Date registerdate; + +@Column(name="INNERSCORE", nullable=true) + +/** +* Calificacion interna del banco. +*/ +private String innerscore; + +@Column(name="PARTHNERNUMBER", nullable=true) + +/** +* Codigo de socio +*/ +private String parthnernumber; + +@Column(name="DATEEXPIDENTIFICATION", nullable=true) + +/** +* Fecha de caducidad del documento de identidad +*/ +private Date dateexpidentification; + +@Column(name="TAXEXEMPT", nullable=true) + +/** +* Excento de impuesto +*/ +private String taxexempt; + +@Column(name="CLIENTTYPECATALOG", nullable=true) + +/** +* Persona natural, Publica Financiera, Privada Financiera +*/ +private String clienttypecatalog; + +@Column(name="CLIENTTYPECATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo CLIENTTYPE Tipo de Cliente +*/ +private String clienttypecatalogcode; + +@Column(name="ECONOMICSECTORCATALOG", nullable=true) + +/** +* Tipos de Sector: Gobierno central, hogares, No residentes , Empresas +*/ +private String economicsectorcatalog; + +@Column(name="ECONOMICSECTORCATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo ECONOMICSECTOR Tipo de Sector +*/ +private String economicsectorcatalogcode; + +@Column(name="ACTIVITYCODE", nullable=true) + +/** +* Codigo de actividad +*/ +private String activitycode; + +@Column(name="ISMIGRATED", nullable=true) + +/** +* Y, indica que la informacion actual del cliente proviene de una migracion. +*/ +private String ismigrated; + +@Column(name="SBSEMPLOYEE", nullable=true) + +/** +* Codigo de empleado de la sbs +*/ +private String sbsemployee; + +@Column(name="SBSUSERCODE", nullable=true) + +/** +* Codigo de usuario utilizado en la sbs, se utiliza en la integracion con CAS +*/ +private String sbsusercode; + +@Column(name="LEGALREPRESENT", nullable=true) + +/** +* null +*/ +private String legalrepresent; + +@Column(name="LEGALREPRESENTIDENTIFICATION", nullable=true) + +/** +* null +*/ +private String legalrepresentidentification; + +@Column(name="MILITARYGRADE", nullable=true) + +/** +* Catalog del grado del militar en la tabla de catlogos +*/ +private String militarygrade; + +@Column(name="MILITARYGRADECODE", nullable=true) + +/** +* Catalogcode del grado del militar en la tabla de catlogos +*/ +private String militarygradecode; + +@Column(name="SIGN", nullable=true,length = 100000) + +/** +* Firma digital +*/ +private byte[] sign; + +@Column(name="PICTURE", nullable=true,length = 100000) + +/** +* Firma digital +*/ +private byte[] picture; + +@Column(name = "PHOTO", nullable = true) +/** + * Codigo de imagen + */ +private Integer photo; + +@Column(name="ECONIMICACT", nullable=true) + +/** +* Valor de la actividad economica +*/ +private String econimicact; + +/**Contructor por defecto*/ +public TcustPersonDetail(){ +} +/**Contructor de TcustPersonDetail +@param pPk Clave Primaria del entity +@param pRecordversion Optimistic locking del registro +@param pName Nombre Legal de la persona +@param pIdentification Numero de cedula, ruc, pasaporte, etc.. +*/ +public TcustPersonDetail(TcustPersonDetailKey pPk,Integer pRecordversion,String pName,String pIdentification){ + this(); + pk=pPk; + recordversion=pRecordversion; + name=pName; + identification=pIdentification; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TcustPersonDetail +*/ +public static TcustPersonDetail find(EntityManager pEntityManager,TcustPersonDetailKey pKey) throws Exception{ + TcustPersonDetail obj = pEntityManager.find(TcustPersonDetail.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TcustPersonDetail +@return El objeto que referencia a la Clave primaria de TcustPersonDetail +*/ +public TcustPersonDetailKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TcustPersonDetail +@param pPk El objeto que referencia a la nueva Clave primaria de TcustPersonDetail +*/ +public void setPk(TcustPersonDetailKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de datefrom +@return valor de datefrom*/ +public Timestamp getDatefrom(){ + return datefrom; +} +/**Fija el valor de datefrom +@param pDatefrom nuevo Valor de datefrom*/ +public void setDatefrom(Timestamp pDatefrom){ + datefrom=pDatefrom; +} + +/**Obtiene el valor de name +@return valor de name*/ +public String getName(){ + return name; +} +/**Fija el valor de name +@param pName nuevo Valor de name*/ +public void setName(String pName){ + name=pName; +} + +/**Obtiene el valor de nickname +@return valor de nickname*/ +public String getNickname(){ + return nickname; +} +/**Fija el valor de nickname +@param pNickname nuevo Valor de nickname*/ +public void setNickname(String pNickname){ + nickname=pNickname; +} + +/**Obtiene el valor de identificationcatalog +@return valor de identificationcatalog*/ +public String getIdentificationcatalog(){ + return identificationcatalog; +} +/**Fija el valor de identificationcatalog +@param pIdentificationcatalog nuevo Valor de identificationcatalog*/ +public void setIdentificationcatalog(String pIdentificationcatalog){ + identificationcatalog=pIdentificationcatalog; +} + +/**Obtiene el valor de identificationcatalogcode +@return valor de identificationcatalogcode*/ +public String getIdentificationcatalogcode(){ + return identificationcatalogcode; +} +/**Fija el valor de identificationcatalogcode +@param pIdentificationcatalogcode nuevo Valor de identificationcatalogcode*/ +public void setIdentificationcatalogcode(String pIdentificationcatalogcode){ + identificationcatalogcode=pIdentificationcatalogcode; +} + +/**Obtiene el valor de identification +@return valor de identification*/ +public String getIdentification(){ + return identification; +} +/**Fija el valor de identification +@param pIdentification nuevo Valor de identification*/ +public void setIdentification(String pIdentification){ + identification=pIdentification; +} + +/**Obtiene el valor de ingressuser +@return valor de ingressuser*/ +public String getIngressuser(){ + return ingressuser; +} +/**Fija el valor de ingressuser +@param pIngressuser nuevo Valor de ingressuser*/ +public void setIngressuser(String pIngressuser){ + ingressuser=pIngressuser; +} + +/**Obtiene el valor de modifyuser +@return valor de modifyuser*/ +public String getModifyuser(){ + return modifyuser; +} +/**Fija el valor de modifyuser +@param pModifyuser nuevo Valor de modifyuser*/ +public void setModifyuser(String pModifyuser){ + modifyuser=pModifyuser; +} + +/**Obtiene el valor de languagecode +@return valor de languagecode*/ +public String getLanguagecode(){ + return languagecode; +} +/**Fija el valor de languagecode +@param pLanguagecode nuevo Valor de languagecode*/ +public void setLanguagecode(String pLanguagecode){ + languagecode=pLanguagecode; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de persontypecatalog +@return valor de persontypecatalog*/ +public String getPersontypecatalog(){ + return persontypecatalog; +} +/**Fija el valor de persontypecatalog +@param pPersontypecatalog nuevo Valor de persontypecatalog*/ +public void setPersontypecatalog(String pPersontypecatalog){ + persontypecatalog=pPersontypecatalog; +} + +/**Obtiene el valor de persontypecatalogcode +@return valor de persontypecatalogcode*/ +public String getPersontypecatalogcode(){ + return persontypecatalogcode; +} +/**Fija el valor de persontypecatalogcode +@param pPersontypecatalogcode nuevo Valor de persontypecatalogcode*/ +public void setPersontypecatalogcode(String pPersontypecatalogcode){ + persontypecatalogcode=pPersontypecatalogcode; +} + +/**Obtiene el valor de registerdate +@return valor de registerdate*/ +public Date getRegisterdate(){ + return registerdate; +} +/**Fija el valor de registerdate +@param pRegisterdate nuevo Valor de registerdate*/ +public void setRegisterdate(Date pRegisterdate){ + registerdate=pRegisterdate; +} + +/**Obtiene el valor de innerscore +@return valor de innerscore*/ +public String getInnerscore(){ + return innerscore; +} +/**Fija el valor de innerscore +@param pInnerscore nuevo Valor de innerscore*/ +public void setInnerscore(String pInnerscore){ + innerscore=pInnerscore; +} + +/**Obtiene el valor de parthnernumber +@return valor de parthnernumber*/ +public String getParthnernumber(){ + return parthnernumber; +} +/**Fija el valor de parthnernumber +@param pParthnernumber nuevo Valor de parthnernumber*/ +public void setParthnernumber(String pParthnernumber){ + parthnernumber=pParthnernumber; +} + +/**Obtiene el valor de dateexpidentification +@return valor de dateexpidentification*/ +public Date getDateexpidentification(){ + return dateexpidentification; +} +/**Fija el valor de dateexpidentification +@param pDateexpidentification nuevo Valor de dateexpidentification*/ +public void setDateexpidentification(Date pDateexpidentification){ + dateexpidentification=pDateexpidentification; +} + +/**Obtiene el valor de taxexempt +@return valor de taxexempt*/ +public String getTaxexempt(){ + return taxexempt; +} +/**Fija el valor de taxexempt +@param pTaxexempt nuevo Valor de taxexempt*/ +public void setTaxexempt(String pTaxexempt){ + taxexempt=pTaxexempt; +} + +/**Obtiene el valor de clienttypecatalog +@return valor de clienttypecatalog*/ +public String getClienttypecatalog(){ + return clienttypecatalog; +} +/**Fija el valor de clienttypecatalog +@param pClienttypecatalog nuevo Valor de clienttypecatalog*/ +public void setClienttypecatalog(String pClienttypecatalog){ + clienttypecatalog=pClienttypecatalog; +} + +/**Obtiene el valor de clienttypecatalogcode +@return valor de clienttypecatalogcode*/ +public String getClienttypecatalogcode(){ + return clienttypecatalogcode; +} +/**Fija el valor de clienttypecatalogcode +@param pClienttypecatalogcode nuevo Valor de clienttypecatalogcode*/ +public void setClienttypecatalogcode(String pClienttypecatalogcode){ + clienttypecatalogcode=pClienttypecatalogcode; +} + +/**Obtiene el valor de economicsectorcatalog +@return valor de economicsectorcatalog*/ +public String getEconomicsectorcatalog(){ + return economicsectorcatalog; +} +/**Fija el valor de economicsectorcatalog +@param pEconomicsectorcatalog nuevo Valor de economicsectorcatalog*/ +public void setEconomicsectorcatalog(String pEconomicsectorcatalog){ + economicsectorcatalog=pEconomicsectorcatalog; +} + +/**Obtiene el valor de economicsectorcatalogcode +@return valor de economicsectorcatalogcode*/ +public String getEconomicsectorcatalogcode(){ + return economicsectorcatalogcode; +} +/**Fija el valor de economicsectorcatalogcode +@param pEconomicsectorcatalogcode nuevo Valor de economicsectorcatalogcode*/ +public void setEconomicsectorcatalogcode(String pEconomicsectorcatalogcode){ + economicsectorcatalogcode=pEconomicsectorcatalogcode; +} + +/**Obtiene el valor de activitycode +@return valor de activitycode*/ +public String getActivitycode(){ + return activitycode; +} +/**Fija el valor de activitycode +@param pActivitycode nuevo Valor de activitycode*/ +public void setActivitycode(String pActivitycode){ + activitycode=pActivitycode; +} + +/**Obtiene el valor de ismigrated +@return valor de ismigrated*/ +public String getIsmigrated(){ + return ismigrated; +} +/**Fija el valor de ismigrated +@param pIsmigrated nuevo Valor de ismigrated*/ +public void setIsmigrated(String pIsmigrated){ + ismigrated=pIsmigrated; +} + +/**Obtiene el valor de sbsemployee +@return valor de sbsemployee*/ +public String getSbsemployee(){ + return sbsemployee; +} +/**Fija el valor de sbsemployee +@param pSbsemployee nuevo Valor de sbsemployee*/ +public void setSbsemployee(String pSbsemployee){ + sbsemployee=pSbsemployee; +} + +/**Obtiene el valor de sbsusercode +@return valor de sbsusercode*/ +public String getSbsusercode(){ + return sbsusercode; +} +/**Fija el valor de sbsusercode +@param pSbsusercode nuevo Valor de sbsusercode*/ +public void setSbsusercode(String pSbsusercode){ + sbsusercode=pSbsusercode; +} + +/**Obtiene el valor de legalrepresent +@return valor de legalrepresent*/ +public String getLegalrepresent(){ + return legalrepresent; +} +/**Fija el valor de legalrepresent +@param pLegalrepresent nuevo Valor de legalrepresent*/ +public void setLegalrepresent(String pLegalrepresent){ + legalrepresent=pLegalrepresent; +} + +/**Obtiene el valor de legalrepresentidentification +@return valor de legalrepresentidentification*/ +public String getLegalrepresentidentification(){ + return legalrepresentidentification; +} +/**Fija el valor de legalrepresentidentification +@param pLegalrepresentidentification nuevo Valor de legalrepresentidentification*/ +public void setLegalrepresentidentification(String pLegalrepresentidentification){ + legalrepresentidentification=pLegalrepresentidentification; +} + +/**Obtiene el valor de militarygrade +@return valor de militarygrade*/ +public String getMilitarygrade(){ + return militarygrade; +} +/**Fija el valor de militarygrade +@param pMilitarygrade nuevo Valor de militarygrade*/ +public void setMilitarygrade(String pMilitarygrade){ + militarygrade=pMilitarygrade; +} + +/**Obtiene el valor de militarygradecode +@return valor de militarygradecode*/ +public String getMilitarygradecode(){ + return militarygradecode; +} +/**Fija el valor de militarygradecode +@param pMilitarygradecode nuevo Valor de militarygradecode*/ +public void setMilitarygradecode(String pMilitarygradecode){ + militarygradecode=pMilitarygradecode; +} + + +/**Obtiene el valor de sign +@return valor de sign*/ +public byte[] getSign() { + return sign; +} +/**Fija el valor de sign +@param pMilitarygradecode nuevo Valor de sign*/ +public void setSign(byte[] sign) { + this.sign = sign; +} + +/**Obtiene el valor de picture +@return valor de picture*/ +public byte[] getPicture() { + return picture; +} +/**Fija el valor de picture +@param pMilitarygradecode nuevo Valor de picture*/ +public void setPicture(byte[] picture) { + this.picture = picture; +} + +/**Obtiene el valor de photo +@return valor de photo*/ +public Integer getPhoto() { + return photo; +} +/**Fija el valor de v +@param pMilitarygradecode nuevo Valor de photo*/ +public void setPhoto(Integer photo) { + this.photo = photo; +} + + +/**Obtiene el valor de actividad economica +@return valor de econimicact*/ +public String getEconimicact() { + return econimicact; +} +/**Fija el valor de actividad economica +@param pEconimicact nuevo Valor de econimicact*/ +public void setEconimicact(String pEconimicact){ + this.econimicact=pEconimicact; +} + + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TcustPersonDetail))return false; + TcustPersonDetail that = (TcustPersonDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TcustPersonDetail +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TcustPersonDetail +*/ +public Object createInstance(){ + TcustPersonDetail instance=new TcustPersonDetail(); + instance.setPk(new TcustPersonDetailKey()); + return instance; +} +/**Clona la entidad TcustPersonDetail +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TcustPersonDetail p=(TcustPersonDetail)this.clone(); + p.setPk((TcustPersonDetailKey)this.pk.cloneMe()); + return p; +} +public Object getId() { + return this.pk; +} + +public static TcustPersonDetail find(EntityManager pEntityManager, Integer pPersonCode) + throws Exception + { + TcustPersonDetail tcustPersonDetail = null; + Query qry = pEntityManager.createQuery("from TcustPersonDetail tpd where tpd.pk.personcode = :personcode and tpd.pk.dateto = :dateto"); + + qry.setParameter("personcode", pPersonCode); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + try + { + tcustPersonDetail = (TcustPersonDetail)qry.getSingleResult(); + } + catch (NoResultException e) + { + throw new GeneralException("CUST-0001", "PERSONA NO DEFINIDA EN TCUSTPERSONDETAIL: PERSONCODE:{0}", new Object[] { pPersonCode }); + } + return tcustPersonDetail; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonDetailKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonDetailKey.java new file mode 100644 index 0000000..489b476 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonDetailKey.java @@ -0,0 +1,129 @@ +package com.fp.persistence.pcustomer.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPERSONDETAIL*/ +@Embeddable +public class TcustPersonDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TcustPersonDetailKey(){} +/**Contructor de TcustPersonDetailKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +*/ +public TcustPersonDetailKey(Integer pPersoncode,Timestamp pDateto){ + personcode=pPersoncode; + dateto=pDateto; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacion de la comparacion de TcustPersonDetailKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPersonDetailKey))return false; + TcustPersonDetailKey that = (TcustPersonDetailKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TcustPersonDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonParametersId.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonParametersId.java new file mode 100644 index 0000000..763cd94 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonParametersId.java @@ -0,0 +1,196 @@ +package com.fp.persistence.pcustomer.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPERSONPARAMETERSID*/ +@Entity(name="TcustPersonParametersId") +@Table(name="TCUSTPERSONPARAMETERSID") +public class TcustPersonParametersId extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TcustPersonParametersId +*/ +@Id +@Column(name="IDENTIFICATIONCATALOG" ,nullable=false, updatable=false) +private String pk; +@Column(name="IDENTIFICATIONCATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo IDENTIFICATION +*/ +private String identificationcatalogcode; + +@Column(name="MAXLENGTH", nullable=true) + +/** +* Tamao maximo del tipo de identificacion +*/ +private Integer maxlength; + +@Column(name="PERMITLETTER", nullable=true) + +/** +* Y si el tpo de identificacin permite letras N si no permite +*/ +private String permitletter; + +@Column(name="NAMEBEAN", nullable=true) + +/** +* Nombre del bean que contiene la rutina de validacion del tipo de identificacion +*/ +private String namebean; + +/**Contructor por defecto*/ +public TcustPersonParametersId(){ +} +/**Contructor de TcustPersonParametersId +@param pPk Clave Primaria del entity +*/ +public TcustPersonParametersId(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TcustPersonParametersId +*/ +public static TcustPersonParametersId find(EntityManager pEntityManager,Object pKey) throws Exception{ + TcustPersonParametersId obj = pEntityManager.find(TcustPersonParametersId.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TcustPersonParametersId +@return El objeto que referencia a la Clave primaria de TcustPersonParametersId +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TcustPersonParametersId +@param pPk El objeto que referencia a la nueva Clave primaria de TcustPersonParametersId +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de identificationcatalogcode +@return valor de identificationcatalogcode*/ +public String getIdentificationcatalogcode(){ + return identificationcatalogcode; +} +/**Fija el valor de identificationcatalogcode +@param pIdentificationcatalogcode nuevo Valor de identificationcatalogcode*/ +public void setIdentificationcatalogcode(String pIdentificationcatalogcode){ + identificationcatalogcode=pIdentificationcatalogcode; +} + +/**Obtiene el valor de maxlength +@return valor de maxlength*/ +public Integer getMaxlength(){ + return maxlength; +} +/**Fija el valor de maxlength +@param pMaxlength nuevo Valor de maxlength*/ +public void setMaxlength(Integer pMaxlength){ + maxlength=pMaxlength; +} + +/**Obtiene el valor de permitletter +@return valor de permitletter*/ +public String getPermitletter(){ + return permitletter; +} +/**Fija el valor de permitletter +@param pPermitletter nuevo Valor de permitletter*/ +public void setPermitletter(String pPermitletter){ + permitletter=pPermitletter; +} + +/**Obtiene el valor de namebean +@return valor de namebean*/ +public String getNamebean(){ + return namebean; +} +/**Fija el valor de namebean +@param pNamebean nuevo Valor de namebean*/ +public void setNamebean(String pNamebean){ + namebean=pNamebean; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TcustPersonParametersId))return false; + TcustPersonParametersId that = (TcustPersonParametersId) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TcustPersonParametersId +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TcustPersonParametersId +*/ +public Object createInstance(){ + TcustPersonParametersId instance=new TcustPersonParametersId(); + return instance; +} +/**Clona la entidad TcustPersonParametersId +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TcustPersonParametersId p=(TcustPersonParametersId)this.clone(); + return p; +} +public Object getId() { + return this.pk; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonPersonalReference.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonPersonalReference.java new file mode 100644 index 0000000..302f7da --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonPersonalReference.java @@ -0,0 +1,400 @@ +package com.fp.persistence.pcustomer.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPERSONPERSONALREFERENCE + */ +@Entity(name = "TcustPersonPersonalReference") +@Table(name = "TCUSTPERSONPERSONALREFERENCE") +public class TcustPersonPersonalReference extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TcustPersonPersonalReference + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(REFERENCESEQUENCE),0)+1 from TCUSTPERSONPERSONALREFERENCE where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "referencesequence") }) + @GeneratedValue(generator = "seq_id") + private TcustPersonPersonalReferenceKey pk; + + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro del telefono + */ + private Timestamp datefrom; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String ingressusercode; + + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String modifyusercode; + + @Column(name = "PERSONALREFCATALOG", nullable = true) + /** + * Codigo de catalogo 1 Padre, 2 Madre, 3 Hermano, 4 cuniado + */ + private String personalrefcatalog; + + @Column(name = "PERSONALREFCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo PERSONALREF , referencias de personas + */ + private String personalrefcatalogcode; + + @Column(name = "REFERENCEPERSONCODE", nullable = true) + /** + * Codigo de persona de referencia de la persona + */ + private Integer referencepersoncode; + + @Column(name = "NAME", nullable = true) + /** + * Nombre de la persona de referencia + */ + private String name; + + @Column(name = "REMARK", nullable = true) + /** + * Observaciones + */ + private String remark; + + /** + * Contructor por defecto + */ + public TcustPersonPersonalReference() { + } + + /** + * Contructor de TcustPersonPersonalReference + * + * @param pPk Clave Primaria del entity + */ + public TcustPersonPersonalReference(TcustPersonPersonalReferenceKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPersonPersonalReference + */ + public static TcustPersonPersonalReference find(EntityManager pEntityManager, TcustPersonPersonalReferenceKey pKey) throws Exception { + TcustPersonPersonalReference obj = pEntityManager.find(TcustPersonPersonalReference.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPersonPersonalReference + * + * @return El objeto que referencia a la Clave primaria de TcustPersonPersonalReference + */ + public TcustPersonPersonalReferenceKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPersonPersonalReference + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TcustPersonPersonalReference + */ + public void setPk(TcustPersonPersonalReferenceKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + /** + * Obtiene el valor de personalrefcatalog + * + * @return valor de personalrefcatalog + */ + public String getPersonalrefcatalog() { + return this.personalrefcatalog; + } + + /** + * Fija el valor de personalrefcatalog + * + * @param pPersonalrefcatalog nuevo Valor de personalrefcatalog + */ + public void setPersonalrefcatalog(String pPersonalrefcatalog) { + this.personalrefcatalog = pPersonalrefcatalog; + } + + /** + * Obtiene el valor de personalrefcatalogcode + * + * @return valor de personalrefcatalogcode + */ + public String getPersonalrefcatalogcode() { + return this.personalrefcatalogcode; + } + + /** + * Fija el valor de personalrefcatalogcode + * + * @param pPersonalrefcatalogcode nuevo Valor de personalrefcatalogcode + */ + public void setPersonalrefcatalogcode(String pPersonalrefcatalogcode) { + this.personalrefcatalogcode = pPersonalrefcatalogcode; + } + + /** + * Obtiene el valor de referencepersoncode + * + * @return valor de referencepersoncode + */ + public Integer getReferencepersoncode() { + return this.referencepersoncode; + } + + /** + * Fija el valor de referencepersoncode + * + * @param pReferencepersoncode nuevo Valor de referencepersoncode + */ + public void setReferencepersoncode(Integer pReferencepersoncode) { + this.referencepersoncode = pReferencepersoncode; + } + + /** + * Obtiene el valor de name + * + * @return valor de name + */ + public String getName() { + return this.name; + } + + /** + * Fija el valor de name + * + * @param pName nuevo Valor de name + */ + public void setName(String pName) { + this.name = pName; + } + + /** + * Obtiene el valor de remark + * + * @return valor de remark + */ + public String getRemark() { + return this.remark; + } + + /** + * Fija el valor de remark + * + * @param pRemark nuevo Valor de remark + */ + public void setRemark(String pRemark) { + this.remark = pRemark; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPersonPersonalReference)) { + return false; + } + TcustPersonPersonalReference that = (TcustPersonPersonalReference) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustPersonPersonalReference + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustPersonPersonalReference + */ + @Override + public Object createInstance() { + TcustPersonPersonalReference instance = new TcustPersonPersonalReference(); + instance.setPk(new TcustPersonPersonalReferenceKey()); + return instance; + } + + /** + * Clona la entidad TcustPersonPersonalReference + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPersonPersonalReference p = (TcustPersonPersonalReference) this.clone(); + p.setPk((TcustPersonPersonalReferenceKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonPersonalReferenceKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonPersonalReferenceKey.java new file mode 100644 index 0000000..a94b790 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonPersonalReferenceKey.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPERSONPERSONALREFERENCE*/ +@Embeddable +public class TcustPersonPersonalReferenceKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="REFERENCESEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de referencias personales del cliente +*/ +private Integer referencesequence; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro del telefono +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TcustPersonPersonalReferenceKey(){} +/**Contructor de TcustPersonPersonalReferenceKey +@param pPersoncode Codigo de persona +@param pReferencesequence Secuencia de referencias personales del cliente +@param pDateto Fecha hasta la cual esta vigente el registro del telefono +*/ +public TcustPersonPersonalReferenceKey(Integer pPersoncode,Integer pReferencesequence,Timestamp pDateto){ + personcode=pPersoncode; + referencesequence=pReferencesequence; + dateto=pDateto; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de referencesequence +@return valor de referencesequence*/ +public Integer getReferencesequence(){ + return referencesequence; +} +/**Fija el valor de referencesequence +@param pReferencesequence nuevo Valor de referencesequence*/ +public void setReferencesequence(Integer pReferencesequence){ + referencesequence=pReferencesequence; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TcustPersonPersonalReferenceKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPersonPersonalReferenceKey))return false; + TcustPersonPersonalReferenceKey that = (TcustPersonPersonalReferenceKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getReferencesequence() == null || that.getReferencesequence() == null){ + return false; + } + if (! this.getReferencesequence().equals(that.getReferencesequence())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPersonPersonalReferenceKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getReferencesequence() == null ? 0 : this.getReferencesequence().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonPhone.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonPhone.java new file mode 100644 index 0000000..5e74f10 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonPhone.java @@ -0,0 +1,432 @@ +package com.fp.persistence.pcustomer.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTPERSONPHONE + */ +@Entity(name = "TcustPersonPhone") +@Table(name = "TCUSTPERSONPHONE") +public class TcustPersonPhone extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustPersonPhone + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(PHONESEQUENCE),0)+1 from TCUSTPERSONPHONE where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "phonesequence")}) + @GeneratedValue(generator = "seq_id") + private TcustPersonPhoneKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro del telefono + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "PHONETYPECATALOG", nullable = true) + /** + * Codigo de catalogo 1 Celular, 2 Fijo + */ + private String phonetypecatalog; + @Column(name = "PHONETYPECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo PHONETYPE + */ + private String phonetypecatalogcode; + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario que crea el registro + */ + private String ingressusercode; + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario que modifica el registro + */ + private String modifyusercode; + @Column(name = "ADDRESSNUMBER", nullable = true) + /** + * Numero de direccion asociada al telefono + */ + private Integer addressnumber; + @Column(name = "AREACODE", nullable = true) + /** + * Codigo de area del telefono + */ + private Integer areacode; + @Column(name = "PHONENUMBER", nullable = true) + /** + * Numero de telefono + */ + private String phonenumber; + @Column(name = "EXTENSION", nullable = true) + /** + * Codigo de extension del telefono + */ + private Integer extension; + + /** + * Contructor por defecto + */ + public TcustPersonPhone() { + } + + /** + * Contructor de TcustPersonPhone + * + * @param pPk Clave Primaria del entity + */ + public TcustPersonPhone(TcustPersonPhoneKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPersonPhone + */ + public static TcustPersonPhone find(EntityManager pEntityManager, TcustPersonPhoneKey pKey) throws Exception { + TcustPersonPhone obj = pEntityManager.find(TcustPersonPhone.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPersonPhone + * + * @return El objeto que referencia a la Clave primaria de TcustPersonPhone + */ + public TcustPersonPhoneKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPersonPhone + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustPersonPhone + */ + public void setPk(TcustPersonPhoneKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de phonetypecatalog + * + * @return valor de phonetypecatalog + */ + public String getPhonetypecatalog() { + return this.phonetypecatalog; + } + + /** + * Fija el valor de phonetypecatalog + * + * @param pPhonetypecatalog nuevo Valor de phonetypecatalog + */ + public void setPhonetypecatalog(String pPhonetypecatalog) { + this.phonetypecatalog = pPhonetypecatalog; + } + + /** + * Obtiene el valor de phonetypecatalogcode + * + * @return valor de phonetypecatalogcode + */ + public String getPhonetypecatalogcode() { + return this.phonetypecatalogcode; + } + + /** + * Fija el valor de phonetypecatalogcode + * + * @param pPhonetypecatalogcode nuevo Valor de phonetypecatalogcode + */ + public void setPhonetypecatalogcode(String pPhonetypecatalogcode) { + this.phonetypecatalogcode = pPhonetypecatalogcode; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + /** + * Obtiene el valor de addressnumber + * + * @return valor de addressnumber + */ + public Integer getAddressnumber() { + return this.addressnumber; + } + + /** + * Fija el valor de addressnumber + * + * @param pAddressnumber nuevo Valor de addressnumber + */ + public void setAddressnumber(Integer pAddressnumber) { + this.addressnumber = pAddressnumber; + } + + /** + * Obtiene el valor de areacode + * + * @return valor de areacode + */ + public Integer getAreacode() { + return this.areacode; + } + + /** + * Fija el valor de areacode + * + * @param pAreacode nuevo Valor de areacode + */ + public void setAreacode(Integer pAreacode) { + this.areacode = pAreacode; + } + + /** + * Obtiene el valor de phonenumber + * + * @return valor de phonenumber + */ + public String getPhonenumber() { + return this.phonenumber; + } + + /** + * Fija el valor de phonenumber + * + * @param pPhonenumber nuevo Valor de phonenumber + */ + public void setPhonenumber(String pPhonenumber) { + this.phonenumber = pPhonenumber; + } + + /** + * Obtiene el valor de extension + * + * @return valor de extension + */ + public Integer getExtension() { + return this.extension; + } + + /** + * Fija el valor de extension + * + * @param pExtension nuevo Valor de extension + */ + public void setExtension(Integer pExtension) { + this.extension = pExtension; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPersonPhone)) { + return false; + } + TcustPersonPhone that = (TcustPersonPhone) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustPersonPhone + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustPersonPhone + */ + @Override + public Object createInstance() { + TcustPersonPhone instance = new TcustPersonPhone(); + instance.setPk(new TcustPersonPhoneKey()); + return instance; + } + + /** + * Clona la entidad TcustPersonPhone + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPersonPhone p = (TcustPersonPhone) this.clone(); + p.setPk((TcustPersonPhoneKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + /** + * jpql Que retorna un objeto TcustPersonPhone a partir de un parametros + * espec�ficos + */ + public static final String JPQL_GET_ACCOUNT_PARAMETER = "from TcustPersonPhone t" + " where t.pk.personcode = :personcode " + + "and t.pk.dateto = :dateto "; + + public static List findPhones(EntityManager pEntityManager, Integer personcode, Timestamp dateto) throws Exception { + List lTcustPersonPhone = new ArrayList(); + Query qry = pEntityManager.createQuery(TcustPersonPhone.JPQL_GET_ACCOUNT_PARAMETER); + qry.setParameter("personcode", personcode); + qry.setParameter("dateto", dateto); + return lTcustPersonPhone = qry.getResultList(); + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonPhoneKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonPhoneKey.java new file mode 100644 index 0000000..547db10 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TcustPersonPhoneKey.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPERSONPHONE*/ +@Embeddable +public class TcustPersonPhoneKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro del telefono +*/ +private Timestamp dateto; + +@Column(name="PHONESEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de telefonos del cliente +*/ +private Integer phonesequence; + +/**Contructor por defecto*/ +public TcustPersonPhoneKey(){} +/**Contructor de TcustPersonPhoneKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro del telefono +@param pPhonesequence Secuencia de telefonos del cliente +*/ +public TcustPersonPhoneKey(Integer pPersoncode,Timestamp pDateto,Integer pPhonesequence){ + personcode=pPersoncode; + dateto=pDateto; + phonesequence=pPhonesequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de phonesequence +@return valor de phonesequence*/ +public Integer getPhonesequence(){ + return phonesequence; +} +/**Fija el valor de phonesequence +@param pPhonesequence nuevo Valor de phonesequence*/ +public void setPhonesequence(Integer pPhonesequence){ + phonesequence=pPhonesequence; +} + +/**Implementacin de la comparacin de TcustPersonPhoneKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPersonPhoneKey))return false; + TcustPersonPhoneKey that = (TcustPersonPhoneKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getPhonesequence() == null || that.getPhonesequence() == null){ + return false; + } + if (! this.getPhonesequence().equals(that.getPhonesequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPersonPhoneKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getPhonesequence() == null ? 0 : this.getPhonesequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TgeneActivity.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TgeneActivity.java new file mode 100644 index 0000000..90cd0ea --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TgeneActivity.java @@ -0,0 +1,233 @@ +package com.fp.persistence.pcustomer.gene; + +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACTIVITY*/ +@Entity(name="TgeneActivity") +@Table(name="TGENEACTIVITY") +public class TgeneActivity extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneActivity +*/ +@Id +@Column(name="ACTIVITYCODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="SEGMENTTYPECATALOG", nullable=false) + +/** +* Codigo de catalogo 1 servicios, 2 minas 3 petrolesos +*/ +private String segmenttypecatalog; + +@Column(name="SEGMENTTYPECATALOGCODE", nullable=false) + +/** +* Codigo de tabla de catalogo SEGMENTTYPE tipo de segmento +*/ +private String segmenttypecatalogcode; + +@Column(name="CIIUCODE", nullable=true) + +/** +* Codigo de ciiu +*/ +private String ciiucode; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion de la actividad +*/ +private String description; + +@Column(name="MODIFYUSER", nullable=true) + +/** +* null +*/ +private String modifyuser; + +@Column(name="MODIFYDATE", nullable=true) + +/** +* null +*/ +private Timestamp modifydate; + +/**Contructor por defecto*/ +public TgeneActivity(){ +} +/**Contructor de TgeneActivity +@param pPk Clave Primaria del entity +@param pSegmenttypecatalog Codigo de catalogo 1 servicios, 2 minas 3 petrolesos +@param pSegmenttypecatalogcode Codigo de tabla de catalogo SEGMENTTYPE tipo de segmento +*/ +public TgeneActivity(String pPk,String pSegmenttypecatalog,String pSegmenttypecatalogcode){ + this(); + pk=pPk; + segmenttypecatalog=pSegmenttypecatalog; + segmenttypecatalogcode=pSegmenttypecatalogcode; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneActivity +*/ +public static TgeneActivity find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneActivity obj = pEntityManager.find(TgeneActivity.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneActivity +@return El objeto que referencia a la Clave primaria de TgeneActivity +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneActivity +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneActivity +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de segmenttypecatalog +@return valor de segmenttypecatalog*/ +public String getSegmenttypecatalog(){ + return segmenttypecatalog; +} +/**Fija el valor de segmenttypecatalog +@param pSegmenttypecatalog nuevo Valor de segmenttypecatalog*/ +public void setSegmenttypecatalog(String pSegmenttypecatalog){ + segmenttypecatalog=pSegmenttypecatalog; +} + +/**Obtiene el valor de segmenttypecatalogcode +@return valor de segmenttypecatalogcode*/ +public String getSegmenttypecatalogcode(){ + return segmenttypecatalogcode; +} +/**Fija el valor de segmenttypecatalogcode +@param pSegmenttypecatalogcode nuevo Valor de segmenttypecatalogcode*/ +public void setSegmenttypecatalogcode(String pSegmenttypecatalogcode){ + segmenttypecatalogcode=pSegmenttypecatalogcode; +} + +/**Obtiene el valor de ciiucode +@return valor de ciiucode*/ +public String getCiiucode(){ + return ciiucode; +} +/**Fija el valor de ciiucode +@param pCiiucode nuevo Valor de ciiucode*/ +public void setCiiucode(String pCiiucode){ + ciiucode=pCiiucode; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de modifyuser +@return valor de modifyuser*/ +public String getModifyuser(){ + return modifyuser; +} +/**Fija el valor de modifyuser +@param pModifyuser nuevo Valor de modifyuser*/ +public void setModifyuser(String pModifyuser){ + modifyuser=pModifyuser; +} + +/**Obtiene el valor de modifydate +@return valor de modifydate*/ +public Timestamp getModifydate(){ + return modifydate; +} +/**Fija el valor de modifydate +@param pModifydate nuevo Valor de modifydate*/ +public void setModifydate(Timestamp pModifydate){ + modifydate=pModifydate; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneActivity))return false; + TgeneActivity that = (TgeneActivity) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneActivity +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneActivity +*/ +public Object createInstance(){ + TgeneActivity instance=new TgeneActivity(); + return instance; +} +/**Clona la entidad TgeneActivity +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneActivity p=(TgeneActivity)this.clone(); + return p; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TgeneCiiu.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TgeneCiiu.java new file mode 100644 index 0000000..c2d9f86 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/gene/TgeneCiiu.java @@ -0,0 +1,253 @@ +package com.fp.persistence.pcustomer.gene; + +import javax.persistence.Entity; +import com.fp.dto.hb.Log; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENECIIU + */ +@Entity(name = "TgeneCiiu") +@Table(name = "TGENECIIU") +public class TgeneCiiu extends com.fp.dto.AbstractDataTransport + implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneCiiu + */ + @Id + @Column(name = "CIIUCODE", nullable = false, updatable = false) + private String pk; + @Column(name = "DESCRIPTION", nullable = true) + /** + * Descripcion de la actividad + */ + private String description; + @Column(name = "LASTNODE", nullable = true) + /** + * Codigo del ultimo nodo + */ + private String lastnode; + @Column(name = "PARENTCODE", nullable = true) + /** + * Codigo de ciiu padre + */ + private String parentcode; + @Column(name = "LEVELCODE", nullable = true) + /** + * Codigo de nivel + */ + private Integer levelcode; + + /** + * Contructor por defecto + */ + public TgeneCiiu() { + } + + /** + * Contructor de TgeneCiiu + * + * @param pPk Clave Primaria del entity + */ + public TgeneCiiu(String pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneCiiu + */ + public static TgeneCiiu find(EntityManager pEntityManager, Object pKey) throws Exception { + TgeneCiiu obj = pEntityManager.find(TgeneCiiu.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneCiiu + * + * @return El objeto que referencia a la Clave primaria de TgeneCiiu + */ + public String getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneCiiu + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TgeneCiiu + */ + public void setPk(String pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + /** + * Obtiene el valor de lastnode + * + * @return valor de lastnode + */ + public String getLastnode() { + return lastnode; + } + + /** + * Fija el valor de lastnode + * + * @param pLastnode nuevo Valor de lastnode + */ + public void setLastnode(String pLastnode) { + lastnode = pLastnode; + } + + /** + * Obtiene el valor de parentcode + * + * @return valor de parentcode + */ + public String getParentcode() { + return parentcode; + } + + /** + * Fija el valor de parentcode + * + * @param pParentcode nuevo Valor de parentcode + */ + public void setParentcode(String pParentcode) { + parentcode = pParentcode; + } + + /** + * Obtiene el valor de levelcode + * + * @return valor de levelcode + */ + public Integer getLevelcode() { + return levelcode; + } + + /** + * Fija el valor de levelcode + * + * @param pLevelcode nuevo Valor de levelcode + */ + public void setLevelcode(Integer pLevelcode) { + levelcode = pLevelcode; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneCiiu)) { + return false; + } + TgeneCiiu that = (TgeneCiiu) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneCiiu + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco TgeneCiiu + */ + public Object createInstance() { + TgeneCiiu instance = new TgeneCiiu(); + return instance; + } + + /** + * Clona la entidad TgeneCiiu + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneCiiu p = (TgeneCiiu) this.clone(); + return p; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/entries b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/entries new file mode 100644 index 0000000..633fbd5 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/entries @@ -0,0 +1,844 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people +svn://172.17.26.185/COMACO + + + +2014-09-18T12:29:01.681947Z +932 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TcustPeopleAditionalDataKey.java +file + + + + +2022-07-28T03:40:25.168727Z +0b31d821f07602f58de1381ca1e336f9 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3625 + +TcustPeopleJob.java +file + + + + +2022-07-28T03:40:25.169727Z +696f6169741ede5f31a2e2d2de0b3f25 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +13683 + +TcustPeopleIncome.java +file + + + + +2022-07-28T03:40:25.169727Z +564441a256334bdde78504a81ae06749 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +11392 + +TcustPeopleTradereferencesKey.java +file + + + + +2022-07-28T03:40:25.168727Z +789efbf1c4af484967c3db5d8ddf793f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4523 + +TcustPeopleAssociation.java +file + + + + +2022-07-28T03:40:25.169727Z +ff88cd2c073f2ba3a0a911e57a70af29 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9607 + +TcustPeopleOtherAssetsKey.java +file + + + + +2022-07-28T03:40:25.169727Z +3d5219ee065d97a80b83bccd6451122c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4504 + +TcustPeople.java +file + + + + +2022-07-28T03:40:25.170727Z +bda8e00acef82e6dbd7a584b40bed433 +2014-09-18T12:29:01.681947Z +932 +dcruz + + + + + + + + + + + + + + + + + + + + + +16328 + +TcustPeopleRealAssetsKey.java +file + + + + +2022-07-28T03:40:25.170727Z +f6c4bd36865347f9292903379bbd922b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4338 + +TcustPeopleVehicle.java +file + + + + +2022-07-28T03:40:25.170727Z +d771c835397079d5cb2396a9e029da75 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +18144 + +TcustPeopleJobKey.java +file + + + + +2022-07-28T03:40:25.171727Z +f779cd01405996a427ad8eef024dfca4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4327 + +TcustPeopleIncomeKey.java +file + + + + +2022-07-28T03:40:25.171727Z +fb87ff3b379d4cafe34b4309f4f0d13e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4454 + +TcustPeopleAssociationKey.java +file + + + + +2022-07-28T03:40:25.171727Z +e8be9cc838727bbcc38387f136565714 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4467 + +TcustPeopleKey.java +file + + + + +2022-07-28T03:40:25.172727Z +8f402868d9c82f928c2aa82db3f58e98 +2014-09-18T12:29:01.681947Z +932 +dcruz + + + + + + + + + + + + + + + + + + + + + +3366 + +TcustPeopleVehicleKey.java +file + + + + +2022-07-28T03:40:25.171727Z +b1334c22ebc3bfc322eca225b15e9561 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4505 + +TcustPeopleLoan.java +file + + + + +2022-07-28T03:40:25.172727Z +a9780273f77caa08fac8103f48cdc8ed +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +15342 + +TcustPeopleFixedIncome.java +file + + + + +2022-07-28T03:40:25.172727Z +686ee09ccbbb2fb4bda88d644b323f8a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +13984 + +TcustPeopleExpenses.java +file + + + + +2022-07-28T03:40:25.172727Z +4802719941efde7e785dadfdee43de63 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +11520 + +TcustPeopleAditionalData.java +file + + + + +2022-07-28T03:40:25.173727Z +91f038628cceed10e18c91a396a854a5 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +12759 + +TcustPeopleTradereferences.java +file + + + + +2022-07-28T03:40:25.173727Z +301f7bde8e5fa907fedac13565ce852e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +15334 + +TcustPeopleLoanKey.java +file + + + + +2022-07-28T03:40:25.173727Z +13c15ab2cc7c879ccbb6cc306e6a329e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4232 + +TcustPeopleFixedIncomeKey.java +file + + + + +2022-07-28T03:40:25.173727Z +d2689c1600f6e2ca0c9521c2b8cfd115 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4463 + +TcustPeopleExpensesKey.java +file + + + + +2022-07-28T03:40:25.174727Z +3fd517b1c53683a96e62813a96dd3aaa +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4493 + +TcustPeopleOtherAssets.java +file + + + + +2022-07-28T03:40:25.174727Z +7db150376e28f3a02e07ee65295d63a7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +14659 + +TcustPeopleRealAssets.java +file + + + + +2022-07-28T03:40:25.174727Z +c2dc37d34e7d5031b0f39d100de9b558 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +17171 + diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeople.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeople.java.svn-base new file mode 100644 index 0000000..3385ff1 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeople.java.svn-base @@ -0,0 +1,652 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import com.fp.dto.hb.Log; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import javax.persistence.Entity; +import javax.persistence.EmbeddedId; +import javax.persistence.EntityManager; +import javax.persistence.Column; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPEOPLE*/ +@Entity(name="TcustPeople") +@Table(name="TCUSTPEOPLE") +public class TcustPeople extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TcustPeople +*/ +@EmbeddedId +private TcustPeopleKey pk; +@Column(name="DATEFROM", nullable=true) + +/** +* Fecha desde la cual esta vigente el registro +*/ +private Timestamp datefrom; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="LASTNAME", nullable=true) + +/** +* Primer apellido +*/ +private String lastname; + +@Column(name="SURENAME", nullable=true) + +/** +* Segundo apellido +*/ +private String surename; + +@Column(name="FIRSTNAME", nullable=true) + +/** +* Primer Nombre +*/ +private String firstname; + +@Column(name="MIDDLENAME", nullable=true) + +/** +* Segundo Nombre +*/ +private String middlename; + +@Column(name="MARITALNAME", nullable=true) + +/** +* Apellido de casada +*/ +private String maritalname; + +@Column(name="GENDER", nullable=true) + +/** +* Gnero +*/ +private String gender; + +@Column(name="BIRTHDATE", nullable=true) + +/** +* Fecha de Nacimiento +*/ +private Date birthdate; + +@Column(name="MARITALSTATUSCATALOG", nullable=true) + +/** +* Codigo de catalogo de estados civiles, 1 soltero, 2 casado, +*/ +private String maritalstatuscatalog; + +@Column(name="MARITALSTATUSCATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo de estado civil MARITALSTATUS +*/ +private String maritalstatuscatalogcode; + +@Column(name="PROFESSIONCATALOG", nullable=true) + +/** +* Codigo de catalogo de profesiones 1, an=bogado, 2 doctor +*/ +private String professioncatalog; + +@Column(name="PROFESSIONCATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo de profesiones PROFESSION +*/ +private String professioncatalogcode; + +@Column(name="EDUCATIONLEVELCATALOG", nullable=true) + +/** +* Codigo de catalogo del nivel de educacion 1, basica, 2 superior +*/ +private String educationlevelcatalog; + +@Column(name="EDUCATIONLEVELCATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo del nivel de educacion EDUCATIONLEVEL +*/ +private String educationlevelcatalogcode; + +@Column(name="BIRTHCOUNTRYCODE", nullable=true) + +/** +* Codigo de pas de nacimiento +*/ +private String birthcountrycode; + +@Column(name="BIRTHPROVINCECODE", nullable=true) + +/** +* Codigo de provincia de nacimiento +*/ +private String birthprovincecode; + +@Column(name="BIRTHCANTONCODE", nullable=true) + +/** +* Codigo de canton +*/ +private String birthcantoncode; + +@Column(name="BIRTHCITYCODE", nullable=true) + +/** +* Codigo de cuidad de nacimiento +*/ +private String birthcitycode; + +@Column(name="SIGNATURECODE", nullable=true) + +/** +* Codigo de imagen de la firma del cliente. +*/ +private Integer signaturecode; + +@Column(name="PHOTOCODE", nullable=true) + +/** +* Codigo de imagen de la foto del cliente. +*/ +private Integer photocode; + +@Column(name="INGRESSUSERCODE", nullable=true) + +/** +* Codigo de usuario +*/ +private String ingressusercode; + +@Column(name="MODIFYUSERCODE", nullable=true) + +/** +* Codigo de usuario +*/ +private String modifyusercode; + +@Column(name="NACIONALITY", nullable=true) + +/** +* Nacionalidad de la persona +*/ +private String nacionality; + +@Column(name="NOTACTIVITYCATALOG", nullable=true) + +/** +* Actividad no economica Estudiante, Jubilado, Ama de casa +*/ +private String notactivitycatalog; + +@Column(name="NOTACTIVITYCATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo NOTACTIVITYEC Actividad no economica +*/ +private String notactivitycatalogcode; + +@Column(name="CODIGOSIB", nullable=true) + +/** +* Codigo de la SIB +*/ +private Integer codigosib; + +@Column(name="BIRTHPARROQUIACODE", nullable=true) + +/** +* Codigo de parroquia de nacimiento +*/ +private String birthparroquiacode; + +@Column(name="HEIGHT", nullable=true) + +/** +* null +*/ +private BigDecimal height; + +/**Contructor por defecto*/ +public TcustPeople(){ +} +/**Contructor de TcustPeople +@param pPk Clave Primaria del entity +*/ +public TcustPeople(TcustPeopleKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TcustPeople +*/ +public static TcustPeople find(EntityManager pEntityManager,TcustPeopleKey pKey) throws Exception{ + TcustPeople obj = pEntityManager.find(TcustPeople.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TcustPeople +@return El objeto que referencia a la Clave primaria de TcustPeople +*/ +public TcustPeopleKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TcustPeople +@param pPk El objeto que referencia a la nueva Clave primaria de TcustPeople +*/ +public void setPk(TcustPeopleKey pPk){ + pk=pPk; +} +/**Obtiene el valor de datefrom +@return valor de datefrom*/ +public Timestamp getDatefrom(){ + return datefrom; +} +/**Fija el valor de datefrom +@param pDatefrom nuevo Valor de datefrom*/ +public void setDatefrom(Timestamp pDatefrom){ + datefrom=pDatefrom; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de lastname +@return valor de lastname*/ +public String getLastname(){ + return lastname; +} +/**Fija el valor de lastname +@param pLastname nuevo Valor de lastname*/ +public void setLastname(String pLastname){ + lastname=pLastname; +} + +/**Obtiene el valor de surename +@return valor de surename*/ +public String getSurename(){ + return surename; +} +/**Fija el valor de surename +@param pSurename nuevo Valor de surename*/ +public void setSurename(String pSurename){ + surename=pSurename; +} + +/**Obtiene el valor de firstname +@return valor de firstname*/ +public String getFirstname(){ + return firstname; +} +/**Fija el valor de firstname +@param pFirstname nuevo Valor de firstname*/ +public void setFirstname(String pFirstname){ + firstname=pFirstname; +} + +/**Obtiene el valor de middlename +@return valor de middlename*/ +public String getMiddlename(){ + return middlename; +} +/**Fija el valor de middlename +@param pMiddlename nuevo Valor de middlename*/ +public void setMiddlename(String pMiddlename){ + middlename=pMiddlename; +} + +/**Obtiene el valor de maritalname +@return valor de maritalname*/ +public String getMaritalname(){ + return maritalname; +} +/**Fija el valor de maritalname +@param pMaritalname nuevo Valor de maritalname*/ +public void setMaritalname(String pMaritalname){ + maritalname=pMaritalname; +} + +/**Obtiene el valor de gender +@return valor de gender*/ +public String getGender(){ + return gender; +} +/**Fija el valor de gender +@param pGender nuevo Valor de gender*/ +public void setGender(String pGender){ + gender=pGender; +} + +/**Obtiene el valor de birthdate +@return valor de birthdate*/ +public Date getBirthdate(){ + return birthdate; +} +/**Fija el valor de birthdate +@param pBirthdate nuevo Valor de birthdate*/ +public void setBirthdate(Date pBirthdate){ + birthdate=pBirthdate; +} + +/**Obtiene el valor de maritalstatuscatalog +@return valor de maritalstatuscatalog*/ +public String getMaritalstatuscatalog(){ + return maritalstatuscatalog; +} +/**Fija el valor de maritalstatuscatalog +@param pMaritalstatuscatalog nuevo Valor de maritalstatuscatalog*/ +public void setMaritalstatuscatalog(String pMaritalstatuscatalog){ + maritalstatuscatalog=pMaritalstatuscatalog; +} + +/**Obtiene el valor de maritalstatuscatalogcode +@return valor de maritalstatuscatalogcode*/ +public String getMaritalstatuscatalogcode(){ + return maritalstatuscatalogcode; +} +/**Fija el valor de maritalstatuscatalogcode +@param pMaritalstatuscatalogcode nuevo Valor de maritalstatuscatalogcode*/ +public void setMaritalstatuscatalogcode(String pMaritalstatuscatalogcode){ + maritalstatuscatalogcode=pMaritalstatuscatalogcode; +} + +/**Obtiene el valor de professioncatalog +@return valor de professioncatalog*/ +public String getProfessioncatalog(){ + return professioncatalog; +} +/**Fija el valor de professioncatalog +@param pProfessioncatalog nuevo Valor de professioncatalog*/ +public void setProfessioncatalog(String pProfessioncatalog){ + professioncatalog=pProfessioncatalog; +} + +/**Obtiene el valor de professioncatalogcode +@return valor de professioncatalogcode*/ +public String getProfessioncatalogcode(){ + return professioncatalogcode; +} +/**Fija el valor de professioncatalogcode +@param pProfessioncatalogcode nuevo Valor de professioncatalogcode*/ +public void setProfessioncatalogcode(String pProfessioncatalogcode){ + professioncatalogcode=pProfessioncatalogcode; +} + +/**Obtiene el valor de educationlevelcatalog +@return valor de educationlevelcatalog*/ +public String getEducationlevelcatalog(){ + return educationlevelcatalog; +} +/**Fija el valor de educationlevelcatalog +@param pEducationlevelcatalog nuevo Valor de educationlevelcatalog*/ +public void setEducationlevelcatalog(String pEducationlevelcatalog){ + educationlevelcatalog=pEducationlevelcatalog; +} + +/**Obtiene el valor de educationlevelcatalogcode +@return valor de educationlevelcatalogcode*/ +public String getEducationlevelcatalogcode(){ + return educationlevelcatalogcode; +} +/**Fija el valor de educationlevelcatalogcode +@param pEducationlevelcatalogcode nuevo Valor de educationlevelcatalogcode*/ +public void setEducationlevelcatalogcode(String pEducationlevelcatalogcode){ + educationlevelcatalogcode=pEducationlevelcatalogcode; +} + +/**Obtiene el valor de birthcountrycode +@return valor de birthcountrycode*/ +public String getBirthcountrycode(){ + return birthcountrycode; +} +/**Fija el valor de birthcountrycode +@param pBirthcountrycode nuevo Valor de birthcountrycode*/ +public void setBirthcountrycode(String pBirthcountrycode){ + birthcountrycode=pBirthcountrycode; +} + +/**Obtiene el valor de birthprovincecode +@return valor de birthprovincecode*/ +public String getBirthprovincecode(){ + return birthprovincecode; +} +/**Fija el valor de birthprovincecode +@param pBirthprovincecode nuevo Valor de birthprovincecode*/ +public void setBirthprovincecode(String pBirthprovincecode){ + birthprovincecode=pBirthprovincecode; +} + +/**Obtiene el valor de birthcantoncode +@return valor de birthcantoncode*/ +public String getBirthcantoncode(){ + return birthcantoncode; +} +/**Fija el valor de birthcantoncode +@param pBirthcantoncode nuevo Valor de birthcantoncode*/ +public void setBirthcantoncode(String pBirthcantoncode){ + birthcantoncode=pBirthcantoncode; +} + +/**Obtiene el valor de birthcitycode +@return valor de birthcitycode*/ +public String getBirthcitycode(){ + return birthcitycode; +} +/**Fija el valor de birthcitycode +@param pBirthcitycode nuevo Valor de birthcitycode*/ +public void setBirthcitycode(String pBirthcitycode){ + birthcitycode=pBirthcitycode; +} + +/**Obtiene el valor de signaturecode +@return valor de signaturecode*/ +public Integer getSignaturecode(){ + return signaturecode; +} +/**Fija el valor de signaturecode +@param pSignaturecode nuevo Valor de signaturecode*/ +public void setSignaturecode(Integer pSignaturecode){ + signaturecode=pSignaturecode; +} + +/**Obtiene el valor de photocode +@return valor de photocode*/ +public Integer getPhotocode(){ + return photocode; +} +/**Fija el valor de photocode +@param pPhotocode nuevo Valor de photocode*/ +public void setPhotocode(Integer pPhotocode){ + photocode=pPhotocode; +} + +/**Obtiene el valor de ingressusercode +@return valor de ingressusercode*/ +public String getIngressusercode(){ + return ingressusercode; +} +/**Fija el valor de ingressusercode +@param pIngressusercode nuevo Valor de ingressusercode*/ +public void setIngressusercode(String pIngressusercode){ + ingressusercode=pIngressusercode; +} + +/**Obtiene el valor de modifyusercode +@return valor de modifyusercode*/ +public String getModifyusercode(){ + return modifyusercode; +} +/**Fija el valor de modifyusercode +@param pModifyusercode nuevo Valor de modifyusercode*/ +public void setModifyusercode(String pModifyusercode){ + modifyusercode=pModifyusercode; +} + +/**Obtiene el valor de nacionality +@return valor de nacionality*/ +public String getNacionality(){ + return nacionality; +} +/**Fija el valor de nacionality +@param pNacionality nuevo Valor de nacionality*/ +public void setNacionality(String pNacionality){ + nacionality=pNacionality; +} + +/**Obtiene el valor de notactivitycatalog +@return valor de notactivitycatalog*/ +public String getNotactivitycatalog(){ + return notactivitycatalog; +} +/**Fija el valor de notactivitycatalog +@param pNotactivitycatalog nuevo Valor de notactivitycatalog*/ +public void setNotactivitycatalog(String pNotactivitycatalog){ + notactivitycatalog=pNotactivitycatalog; +} + +/**Obtiene el valor de notactivitycatalogcode +@return valor de notactivitycatalogcode*/ +public String getNotactivitycatalogcode(){ + return notactivitycatalogcode; +} +/**Fija el valor de notactivitycatalogcode +@param pNotactivitycatalogcode nuevo Valor de notactivitycatalogcode*/ +public void setNotactivitycatalogcode(String pNotactivitycatalogcode){ + notactivitycatalogcode=pNotactivitycatalogcode; +} + +/**Obtiene el valor de codigosib +@return valor de codigosib*/ +public Integer getCodigosib(){ + return codigosib; +} +/**Fija el valor de codigosib +@param pCodigosib nuevo Valor de codigosib*/ +public void setCodigosib(Integer pCodigosib){ + codigosib=pCodigosib; +} + +/**Obtiene el valor de birthparroquiacode +@return valor de birthparroquiacode*/ +public String getBirthparroquiacode(){ + return birthparroquiacode; +} +/**Fija el valor de birthparroquiacode +@param pBirthparroquiacode nuevo Valor de birthparroquiacode*/ +public void setBirthparroquiacode(String pBirthparroquiacode){ + birthparroquiacode=pBirthparroquiacode; +} + +/**Obtiene el valor de height +@return valor de height*/ +public BigDecimal getHeight(){ + return height; +} +/**Fija el valor de height +@param pHeight nuevo Valor de height*/ +public void setHeight(BigDecimal pHeight){ + height=pHeight; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TcustPeople))return false; + TcustPeople that = (TcustPeople) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TcustPeople +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TcustPeople +*/ +public Object createInstance(){ + TcustPeople instance=new TcustPeople(); + instance.setPk(new TcustPeopleKey()); + return instance; +} +/**Clona la entidad TcustPeople +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TcustPeople p=(TcustPeople)this.clone(); + p.setPk((TcustPeopleKey)this.pk.cloneMe()); + return p; +} +public Object getId() { + return this.pk; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleAditionalData.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleAditionalData.java.svn-base new file mode 100644 index 0000000..f9dcbe8 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleAditionalData.java.svn-base @@ -0,0 +1,435 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import com.fp.dto.hb.Log; +import java.io.Serializable; +import javax.persistence.Table; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import javax.persistence.Entity; +import javax.persistence.EmbeddedId; +import javax.persistence.EntityManager; +import javax.persistence.Column; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPEOPLEADITIONALDATA*/ +@Entity(name="TcustPeopleAditionalData") +@Table(name="TCUSTPEOPLEADITIONALDATA") +public class TcustPeopleAditionalData extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TcustPeopleAditionalData +*/ +@EmbeddedId +private TcustPeopleAditionalDataKey pk; +@Column(name="DATEFROM", nullable=true) + +/** +* Fecha desde la cual esta vigente el registro +*/ +private Timestamp datefrom; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="HOMETYPECATALOG", nullable=true) + +/** +* Codigo de catalogo P Propia, A alquidada, F familiares +*/ +private String hometypecatalog; + +@Column(name="HOMETYPECATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo HOMETYPE tipo de vivienda. +*/ +private String hometypecatalogcode; + +@Column(name="IDENTIFICATIONCATALOG", nullable=true) + +/** +* Codigo de catalogo CED cedula, RUC ruc identificacion adicional del cliente. +*/ +private String identificationcatalog; + +@Column(name="IDENTIFICATIONCATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo IDENTIFICATION tipo de identificacion +*/ +private String identificationcatalogcode; + +@Column(name="IDENTIFICATION", nullable=true) + +/** +* Numero de cedula, ruc, pasaporte, etc.. +*/ +private String identification; + +@Column(name="JOBRELATIONSHIPCATALOG", nullable=true) + +/** +* Codigo de catalogo 1 dependiente, 2 Independiente, 3 jubilado +*/ +private String jobrelationshipcatalog; + +@Column(name="JOBRELATIONSHIPCATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo JOBRELATIONSHIP relacion labolar +*/ +private String jobrelationshipcatalogcode; + +@Column(name="WORKERSNUMBER", nullable=true) + +/** +* Numero de empledos. +*/ +private Integer workersnumber; + +@Column(name="DEPENDENTSNUMBER", nullable=true) + +/** +* Numero de dependientes. +*/ +private Integer dependentsnumber; + +@Column(name="INGRESSUSERCODE", nullable=true) + +/** +* Codigo de usuario +*/ +private String ingressusercode; + +@Column(name="MODIFYUSERCODE", nullable=true) + +/** +* Codigo de usuario +*/ +private String modifyusercode; + +@Column(name="HOMEVALUE", nullable=true) + +/** +* Valor de la vivienda +*/ +private BigDecimal homevalue; + +@Column(name="HOMERESIDENCETIME", nullable=true) + +/** +* Aos de residencia en la vivienda actual +*/ +private Integer homeresidencetime; + +@Column(name="MAINSOURCEINCOMECATALOG", nullable=true) + +/** +* null +*/ +private String mainsourceincomecatalog; + +@Column(name="MAINSOURCEINCOMECATALOGCODE", nullable=true) + +/** +* null +*/ +private String mainsourceincomecatalogcode; + +/**Contructor por defecto*/ +public TcustPeopleAditionalData(){ +} +/**Contructor de TcustPeopleAditionalData +@param pPk Clave Primaria del entity +*/ +public TcustPeopleAditionalData(TcustPeopleAditionalDataKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TcustPeopleAditionalData +*/ +public static TcustPeopleAditionalData find(EntityManager pEntityManager,TcustPeopleAditionalDataKey pKey) throws Exception{ + TcustPeopleAditionalData obj = pEntityManager.find(TcustPeopleAditionalData.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TcustPeopleAditionalData +@return El objeto que referencia a la Clave primaria de TcustPeopleAditionalData +*/ +public TcustPeopleAditionalDataKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TcustPeopleAditionalData +@param pPk El objeto que referencia a la nueva Clave primaria de TcustPeopleAditionalData +*/ +public void setPk(TcustPeopleAditionalDataKey pPk){ + pk=pPk; +} +/**Obtiene el valor de datefrom +@return valor de datefrom*/ +public Timestamp getDatefrom(){ + return datefrom; +} +/**Fija el valor de datefrom +@param pDatefrom nuevo Valor de datefrom*/ +public void setDatefrom(Timestamp pDatefrom){ + datefrom=pDatefrom; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de hometypecatalog +@return valor de hometypecatalog*/ +public String getHometypecatalog(){ + return hometypecatalog; +} +/**Fija el valor de hometypecatalog +@param pHometypecatalog nuevo Valor de hometypecatalog*/ +public void setHometypecatalog(String pHometypecatalog){ + hometypecatalog=pHometypecatalog; +} + +/**Obtiene el valor de hometypecatalogcode +@return valor de hometypecatalogcode*/ +public String getHometypecatalogcode(){ + return hometypecatalogcode; +} +/**Fija el valor de hometypecatalogcode +@param pHometypecatalogcode nuevo Valor de hometypecatalogcode*/ +public void setHometypecatalogcode(String pHometypecatalogcode){ + hometypecatalogcode=pHometypecatalogcode; +} + +/**Obtiene el valor de identificationcatalog +@return valor de identificationcatalog*/ +public String getIdentificationcatalog(){ + return identificationcatalog; +} +/**Fija el valor de identificationcatalog +@param pIdentificationcatalog nuevo Valor de identificationcatalog*/ +public void setIdentificationcatalog(String pIdentificationcatalog){ + identificationcatalog=pIdentificationcatalog; +} + +/**Obtiene el valor de identificationcatalogcode +@return valor de identificationcatalogcode*/ +public String getIdentificationcatalogcode(){ + return identificationcatalogcode; +} +/**Fija el valor de identificationcatalogcode +@param pIdentificationcatalogcode nuevo Valor de identificationcatalogcode*/ +public void setIdentificationcatalogcode(String pIdentificationcatalogcode){ + identificationcatalogcode=pIdentificationcatalogcode; +} + +/**Obtiene el valor de identification +@return valor de identification*/ +public String getIdentification(){ + return identification; +} +/**Fija el valor de identification +@param pIdentification nuevo Valor de identification*/ +public void setIdentification(String pIdentification){ + identification=pIdentification; +} + +/**Obtiene el valor de jobrelationshipcatalog +@return valor de jobrelationshipcatalog*/ +public String getJobrelationshipcatalog(){ + return jobrelationshipcatalog; +} +/**Fija el valor de jobrelationshipcatalog +@param pJobrelationshipcatalog nuevo Valor de jobrelationshipcatalog*/ +public void setJobrelationshipcatalog(String pJobrelationshipcatalog){ + jobrelationshipcatalog=pJobrelationshipcatalog; +} + +/**Obtiene el valor de jobrelationshipcatalogcode +@return valor de jobrelationshipcatalogcode*/ +public String getJobrelationshipcatalogcode(){ + return jobrelationshipcatalogcode; +} +/**Fija el valor de jobrelationshipcatalogcode +@param pJobrelationshipcatalogcode nuevo Valor de jobrelationshipcatalogcode*/ +public void setJobrelationshipcatalogcode(String pJobrelationshipcatalogcode){ + jobrelationshipcatalogcode=pJobrelationshipcatalogcode; +} + +/**Obtiene el valor de workersnumber +@return valor de workersnumber*/ +public Integer getWorkersnumber(){ + return workersnumber; +} +/**Fija el valor de workersnumber +@param pWorkersnumber nuevo Valor de workersnumber*/ +public void setWorkersnumber(Integer pWorkersnumber){ + workersnumber=pWorkersnumber; +} + +/**Obtiene el valor de dependentsnumber +@return valor de dependentsnumber*/ +public Integer getDependentsnumber(){ + return dependentsnumber; +} +/**Fija el valor de dependentsnumber +@param pDependentsnumber nuevo Valor de dependentsnumber*/ +public void setDependentsnumber(Integer pDependentsnumber){ + dependentsnumber=pDependentsnumber; +} + +/**Obtiene el valor de ingressusercode +@return valor de ingressusercode*/ +public String getIngressusercode(){ + return ingressusercode; +} +/**Fija el valor de ingressusercode +@param pIngressusercode nuevo Valor de ingressusercode*/ +public void setIngressusercode(String pIngressusercode){ + ingressusercode=pIngressusercode; +} + +/**Obtiene el valor de modifyusercode +@return valor de modifyusercode*/ +public String getModifyusercode(){ + return modifyusercode; +} +/**Fija el valor de modifyusercode +@param pModifyusercode nuevo Valor de modifyusercode*/ +public void setModifyusercode(String pModifyusercode){ + modifyusercode=pModifyusercode; +} + +/**Obtiene el valor de homevalue +@return valor de homevalue*/ +public BigDecimal getHomevalue(){ + return homevalue; +} +/**Fija el valor de homevalue +@param pHomevalue nuevo Valor de homevalue*/ +public void setHomevalue(BigDecimal pHomevalue){ + homevalue=pHomevalue; +} + +/**Obtiene el valor de homeresidencetime +@return valor de homeresidencetime*/ +public Integer getHomeresidencetime(){ + return homeresidencetime; +} +/**Fija el valor de homeresidencetime +@param pHomeresidencetime nuevo Valor de homeresidencetime*/ +public void setHomeresidencetime(Integer pHomeresidencetime){ + homeresidencetime=pHomeresidencetime; +} + +/**Obtiene el valor de mainsourceincomecatalog +@return valor de mainsourceincomecatalog*/ +public String getMainsourceincomecatalog(){ + return mainsourceincomecatalog; +} +/**Fija el valor de mainsourceincomecatalog +@param pMainsourceincomecatalog nuevo Valor de mainsourceincomecatalog*/ +public void setMainsourceincomecatalog(String pMainsourceincomecatalog){ + mainsourceincomecatalog=pMainsourceincomecatalog; +} + +/**Obtiene el valor de mainsourceincomecatalogcode +@return valor de mainsourceincomecatalogcode*/ +public String getMainsourceincomecatalogcode(){ + return mainsourceincomecatalogcode; +} +/**Fija el valor de mainsourceincomecatalogcode +@param pMainsourceincomecatalogcode nuevo Valor de mainsourceincomecatalogcode*/ +public void setMainsourceincomecatalogcode(String pMainsourceincomecatalogcode){ + mainsourceincomecatalogcode=pMainsourceincomecatalogcode; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TcustPeopleAditionalData))return false; + TcustPeopleAditionalData that = (TcustPeopleAditionalData) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TcustPeopleAditionalData +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TcustPeopleAditionalData +*/ +public Object createInstance(){ + TcustPeopleAditionalData instance=new TcustPeopleAditionalData(); + instance.setPk(new TcustPeopleAditionalDataKey()); + return instance; +} +/**Clona la entidad TcustPeopleAditionalData +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TcustPeopleAditionalData p=(TcustPeopleAditionalData)this.clone(); + p.setPk((TcustPeopleAditionalDataKey)this.pk.cloneMe()); + return p; +} +public Object getId() { + return this.pk; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleAditionalDataKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleAditionalDataKey.java.svn-base new file mode 100644 index 0000000..83fc268 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleAditionalDataKey.java.svn-base @@ -0,0 +1,129 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLEADITIONALDATA*/ +@Embeddable +public class TcustPeopleAditionalDataKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TcustPeopleAditionalDataKey(){} +/**Contructor de TcustPeopleAditionalDataKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +*/ +public TcustPeopleAditionalDataKey(Integer pPersoncode,Timestamp pDateto){ + personcode=pPersoncode; + dateto=pDateto; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacion de la comparacion de TcustPeopleAditionalDataKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleAditionalDataKey))return false; + TcustPeopleAditionalDataKey that = (TcustPeopleAditionalDataKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TcustPeopleAditionalDataKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleAssociation.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleAssociation.java.svn-base new file mode 100644 index 0000000..4e52229 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleAssociation.java.svn-base @@ -0,0 +1,352 @@ +package com.fp.persistence.pcustomer.people; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPEOPLEASSOCIATION + */ +@Entity(name = "TcustPeopleAssociation") +@Table(name = "TCUSTPEOPLEASSOCIATION") +public class TcustPeopleAssociation extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TcustPeopleAssociation + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(ASSOCIATIONSEQUENCE),0)+1 from TCUSTPEOPLEASSOCIATION where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "associationsequence") }) + @GeneratedValue(generator = "seq_id") + private TcustPeopleAssociationKey pk; + + @Column(name = "ASSOCIATIONPERSONCODE", nullable = true) + /** + * Codigo de persona asiganado a la asociacion + */ + private Integer associationpersoncode; + + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "ASSOCIATIONNAME", nullable = true) + /** + * Nombre de la asociacion cuando no esta definida como una persona + */ + private String associationname; + + @Column(name = "ASSOCIATIONCODE", nullable = true) + /** + * Codigo de registro o de asociacion de la persona + */ + private String associationcode; + + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el cliente + */ + private String ingressuser; + + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del cliente + */ + private String modifyuser; + + /** + * Contructor por defecto + */ + public TcustPeopleAssociation() { + } + + /** + * Contructor de TcustPeopleAssociation + * + * @param pPk Clave Primaria del entity + */ + public TcustPeopleAssociation(TcustPeopleAssociationKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPeopleAssociation + */ + public static TcustPeopleAssociation find(EntityManager pEntityManager, TcustPeopleAssociationKey pKey) throws Exception { + TcustPeopleAssociation obj = pEntityManager.find(TcustPeopleAssociation.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPeopleAssociation + * + * @return El objeto que referencia a la Clave primaria de TcustPeopleAssociation + */ + public TcustPeopleAssociationKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPeopleAssociation + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TcustPeopleAssociation + */ + public void setPk(TcustPeopleAssociationKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de associationpersoncode + * + * @return valor de associationpersoncode + */ + public Integer getAssociationpersoncode() { + return this.associationpersoncode; + } + + /** + * Fija el valor de associationpersoncode + * + * @param pAssociationpersoncode nuevo Valor de associationpersoncode + */ + public void setAssociationpersoncode(Integer pAssociationpersoncode) { + this.associationpersoncode = pAssociationpersoncode; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de associationname + * + * @return valor de associationname + */ + public String getAssociationname() { + return this.associationname; + } + + /** + * Fija el valor de associationname + * + * @param pAssociationname nuevo Valor de associationname + */ + public void setAssociationname(String pAssociationname) { + this.associationname = pAssociationname; + } + + /** + * Obtiene el valor de associationcode + * + * @return valor de associationcode + */ + public String getAssociationcode() { + return this.associationcode; + } + + /** + * Fija el valor de associationcode + * + * @param pAssociationcode nuevo Valor de associationcode + */ + public void setAssociationcode(String pAssociationcode) { + this.associationcode = pAssociationcode; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return this.ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + this.ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return this.modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + this.modifyuser = pModifyuser; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPeopleAssociation)) { + return false; + } + TcustPeopleAssociation that = (TcustPeopleAssociation) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustPeopleAssociation + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustPeopleAssociation + */ + @Override + public Object createInstance() { + TcustPeopleAssociation instance = new TcustPeopleAssociation(); + instance.setPk(new TcustPeopleAssociationKey()); + return instance; + } + + /** + * Clona la entidad TcustPeopleAssociation + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPeopleAssociation p = (TcustPeopleAssociation) this.clone(); + p.setPk((TcustPeopleAssociationKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleAssociationKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleAssociationKey.java.svn-base new file mode 100644 index 0000000..3da3528 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleAssociationKey.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLEASSOCIATION*/ +@Embeddable +public class TcustPeopleAssociationKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="ASSOCIATIONSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de asociacion de la persona +*/ +private Integer associationsequence; + +/**Contructor por defecto*/ +public TcustPeopleAssociationKey(){} +/**Contructor de TcustPeopleAssociationKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pAssociationsequence Secuencia de asociacion de la persona +*/ +public TcustPeopleAssociationKey(Integer pPersoncode,Timestamp pDateto,Integer pAssociationsequence){ + personcode=pPersoncode; + dateto=pDateto; + associationsequence=pAssociationsequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de associationsequence +@return valor de associationsequence*/ +public Integer getAssociationsequence(){ + return associationsequence; +} +/**Fija el valor de associationsequence +@param pAssociationsequence nuevo Valor de associationsequence*/ +public void setAssociationsequence(Integer pAssociationsequence){ + associationsequence=pAssociationsequence; +} + +/**Implementacin de la comparacin de TcustPeopleAssociationKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleAssociationKey))return false; + TcustPeopleAssociationKey that = (TcustPeopleAssociationKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getAssociationsequence() == null || that.getAssociationsequence() == null){ + return false; + } + if (! this.getAssociationsequence().equals(that.getAssociationsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPeopleAssociationKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getAssociationsequence() == null ? 0 : this.getAssociationsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleExpenses.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleExpenses.java.svn-base new file mode 100644 index 0000000..fd34ffc --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleExpenses.java.svn-base @@ -0,0 +1,419 @@ +package com.fp.persistence.pcustomer.people; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTPEOPLEEXPENSES + */ +@Entity(name = "TcustPeopleExpenses") +@Table(name = "TCUSTPEOPLEEXPENSES") +public class TcustPeopleExpenses extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustPeopleExpenses + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(EXPENSESEQUENCE),0)+1 from TCUSTPEOPLEEXPENSES where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "expensesequence")}) + @GeneratedValue(generator = "seq_id") + private TcustPeopleExpensesKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "EXPENSESCATALOG", nullable = true) + /** + * Codigo de catalogo de gastos 1 alimentacion, 2 cuota prestamos, 3 + * alimentacion + */ + private String expensescatalog; + @Column(name = "EXPENSESCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo EXPENSES + */ + private String expensescatalogcode; + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + @Column(name = "AMOUNT", nullable = true) + /** + * Valor del gasto mensual + */ + private BigDecimal amount; + @Column(name = "ISFIXVALUE", nullable = true) + /** + * Y indica que un valor de gasto fijo, N no es un gasto fijo + */ + private String isfixvalue; + @Column(name = "VERIFIEDAMOUNT", nullable = true) + /** + * Monto verificado por una persona de la institucion financiera + */ + private BigDecimal verifiedamount; + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String ingressusercode; + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String modifyusercode; + + /** + * Contructor por defecto + */ + public TcustPeopleExpenses() { + } + + /** + * Contructor de TcustPeopleExpenses + * + * @param pPk Clave Primaria del entity + */ + public TcustPeopleExpenses(TcustPeopleExpensesKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPeopleExpenses + */ + public static TcustPeopleExpenses find(EntityManager pEntityManager, TcustPeopleExpensesKey pKey) throws Exception { + TcustPeopleExpenses obj = pEntityManager.find(TcustPeopleExpenses.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPeopleExpenses + * + * @return El objeto que referencia a la Clave primaria de + * TcustPeopleExpenses + */ + public TcustPeopleExpensesKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPeopleExpenses + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustPeopleExpenses + */ + public void setPk(TcustPeopleExpensesKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de expensescatalog + * + * @return valor de expensescatalog + */ + public String getExpensescatalog() { + return this.expensescatalog; + } + + /** + * Fija el valor de expensescatalog + * + * @param pExpensescatalog nuevo Valor de expensescatalog + */ + public void setExpensescatalog(String pExpensescatalog) { + this.expensescatalog = pExpensescatalog; + } + + /** + * Obtiene el valor de expensescatalogcode + * + * @return valor de expensescatalogcode + */ + public String getExpensescatalogcode() { + return this.expensescatalogcode; + } + + /** + * Fija el valor de expensescatalogcode + * + * @param pExpensescatalogcode nuevo Valor de expensescatalogcode + */ + public void setExpensescatalogcode(String pExpensescatalogcode) { + this.expensescatalogcode = pExpensescatalogcode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de amount + * + * @return valor de amount + */ + public BigDecimal getAmount() { + return this.amount; + } + + /** + * Fija el valor de amount + * + * @param pAmount nuevo Valor de amount + */ + public void setAmount(BigDecimal pAmount) { + this.amount = pAmount; + } + + /** + * Obtiene el valor de isfixvalue + * + * @return valor de isfixvalue + */ + public String getIsfixvalue() { + return this.isfixvalue; + } + + /** + * Fija el valor de isfixvalue + * + * @param pIsfixvalue nuevo Valor de isfixvalue + */ + public void setIsfixvalue(String pIsfixvalue) { + this.isfixvalue = pIsfixvalue; + } + + /** + * Obtiene el valor de verifiedamount + * + * @return valor de verifiedamount + */ + public BigDecimal getVerifiedamount() { + return this.verifiedamount; + } + + /** + * Fija el valor de verifiedamount + * + * @param pVerifiedamount nuevo Valor de verifiedamount + */ + public void setVerifiedamount(BigDecimal pVerifiedamount) { + this.verifiedamount = pVerifiedamount; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPeopleExpenses)) { + return false; + } + TcustPeopleExpenses that = (TcustPeopleExpenses) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustPeopleExpenses + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco + * TcustPeopleExpenses + */ + @Override + public Object createInstance() { + TcustPeopleExpenses instance = new TcustPeopleExpenses(); + instance.setPk(new TcustPeopleExpensesKey()); + return instance; + } + + /** + * Clona la entidad TcustPeopleExpenses + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPeopleExpenses p = (TcustPeopleExpenses) this.clone(); + p.setPk((TcustPeopleExpensesKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleExpensesKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleExpensesKey.java.svn-base new file mode 100644 index 0000000..6848a8f --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleExpensesKey.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLEEXPENSES*/ +@Embeddable +public class TcustPeopleExpensesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="EXPENSESEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del gasto de la persona +*/ +private Integer expensesequence; + +/**Contructor por defecto*/ +public TcustPeopleExpensesKey(){} +/**Contructor de TcustPeopleExpensesKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pExpensesequence Secuencia del gasto de la persona +*/ +public TcustPeopleExpensesKey(Integer pPersoncode,Timestamp pDateto,Integer pExpensesequence){ + personcode=pPersoncode; + dateto=pDateto; + expensesequence=pExpensesequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de expensesequence +@return valor de expensesequence*/ +public Integer getExpensesequence(){ + return expensesequence; +} +/**Fija el valor de expensesequence +@param pExpensesequence nuevo Valor de expensesequence*/ +public void setExpensesequence(Integer pExpensesequence){ + expensesequence=pExpensesequence; +} + +/**Implementacin de la comparacin de TcustPeopleExpensesKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleExpensesKey))return false; + TcustPeopleExpensesKey that = (TcustPeopleExpensesKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getExpensesequence() == null || that.getExpensesequence() == null){ + return false; + } + if (! this.getExpensesequence().equals(that.getExpensesequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPeopleExpensesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getExpensesequence() == null ? 0 : this.getExpensesequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleFixedIncome.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleFixedIncome.java.svn-base new file mode 100644 index 0000000..51d4d11 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleFixedIncome.java.svn-base @@ -0,0 +1,549 @@ +package com.fp.persistence.pcustomer.people; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPEOPLEFIXEDINCOME + */ +@Entity(name = "TcustPeopleFixedIncome") +@Table(name = "TCUSTPEOPLEFIXEDINCOME") +public class TcustPeopleFixedIncome extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TcustPeopleFixedIncome + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(FIXEDINCOMESEQUENCE),0)+1 from TCUSTPEOPLEFIXEDINCOME where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "fixedincomesequence") }) + @GeneratedValue(generator = "seq_id") + private TcustPeopleFixedIncomeKey pk; + + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "FIXEDINCOMECATALOG", nullable = true) + /** + * Codigo de catalogo 1 Bonos del banco central, 2 Poliza, 3 Certificado de + * inversion + */ + private String fixedincomecatalog; + + @Column(name = "FIXEDINCOMECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo FIXEDINCOME tipo de inversion + */ + private String fixedincomecatalogcode; + + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + + @Column(name = "BANKPERSONCODE", nullable = true) + /** + * Codigo de persona asociado a la institucion fincnaiera en la cual el + * cliente matiene la inversion + */ + private Integer bankpersoncode; + + @Column(name = "BANKNAME", nullable = true) + /** + * Nombre de la institucion financiera en la cual el cliente mantiene la + * operacion de renta + */ + private String bankname; + + @Column(name = "ORIGINALAMONT", nullable = true) + /** + * Monto original de la inversion + */ + private BigDecimal originalamont; + + @Column(name = "RATE", nullable = true) + /** + * Tada de la inversion. + */ + private BigDecimal rate; + + @Column(name = "BALANCE", nullable = true) + /** + * Saldo de la inversion. + */ + private BigDecimal balance; + + @Column(name = "BALANCEDATE", nullable = true) + /** + * Fecha a la cual se ingresa el saldo de la inversion. + */ + private Date balancedate; + + @Column(name = "EXPIRATIONDATE", nullable = true) + /** + * Fecha de vencimiento de la inversion. + */ + private Date expirationdate; + + @Column(name = "REMARK", nullable = true) + /** + * Comentario. + */ + private String remark; + + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String ingressusercode; + + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String modifyusercode; + + /** + * Contructor por defecto + */ + public TcustPeopleFixedIncome() { + } + + /** + * Contructor de TcustPeopleFixedIncome + * + * @param pPk Clave Primaria del entity + */ + public TcustPeopleFixedIncome(TcustPeopleFixedIncomeKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPeopleFixedIncome + */ + public static TcustPeopleFixedIncome find(EntityManager pEntityManager, TcustPeopleFixedIncomeKey pKey) throws Exception { + TcustPeopleFixedIncome obj = pEntityManager.find(TcustPeopleFixedIncome.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPeopleFixedIncome + * + * @return El objeto que referencia a la Clave primaria de TcustPeopleFixedIncome + */ + public TcustPeopleFixedIncomeKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPeopleFixedIncome + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TcustPeopleFixedIncome + */ + public void setPk(TcustPeopleFixedIncomeKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de fixedincomecatalog + * + * @return valor de fixedincomecatalog + */ + public String getFixedincomecatalog() { + return this.fixedincomecatalog; + } + + /** + * Fija el valor de fixedincomecatalog + * + * @param pFixedincomecatalog nuevo Valor de fixedincomecatalog + */ + public void setFixedincomecatalog(String pFixedincomecatalog) { + this.fixedincomecatalog = pFixedincomecatalog; + } + + /** + * Obtiene el valor de fixedincomecatalogcode + * + * @return valor de fixedincomecatalogcode + */ + public String getFixedincomecatalogcode() { + return this.fixedincomecatalogcode; + } + + /** + * Fija el valor de fixedincomecatalogcode + * + * @param pFixedincomecatalogcode nuevo Valor de fixedincomecatalogcode + */ + public void setFixedincomecatalogcode(String pFixedincomecatalogcode) { + this.fixedincomecatalogcode = pFixedincomecatalogcode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de bankpersoncode + * + * @return valor de bankpersoncode + */ + public Integer getBankpersoncode() { + return this.bankpersoncode; + } + + /** + * Fija el valor de bankpersoncode + * + * @param pBankpersoncode nuevo Valor de bankpersoncode + */ + public void setBankpersoncode(Integer pBankpersoncode) { + this.bankpersoncode = pBankpersoncode; + } + + /** + * Obtiene el valor de bankname + * + * @return valor de bankname + */ + public String getBankname() { + return this.bankname; + } + + /** + * Fija el valor de bankname + * + * @param pBankname nuevo Valor de bankname + */ + public void setBankname(String pBankname) { + this.bankname = pBankname; + } + + /** + * Obtiene el valor de originalamont + * + * @return valor de originalamont + */ + public BigDecimal getOriginalamont() { + return this.originalamont; + } + + /** + * Fija el valor de originalamont + * + * @param pOriginalamont nuevo Valor de originalamont + */ + public void setOriginalamont(BigDecimal pOriginalamont) { + this.originalamont = pOriginalamont; + } + + /** + * Obtiene el valor de rate + * + * @return valor de rate + */ + public BigDecimal getRate() { + return this.rate; + } + + /** + * Fija el valor de rate + * + * @param pRate nuevo Valor de rate + */ + public void setRate(BigDecimal pRate) { + this.rate = pRate; + } + + /** + * Obtiene el valor de balance + * + * @return valor de balance + */ + public BigDecimal getBalance() { + return this.balance; + } + + /** + * Fija el valor de balance + * + * @param pBalance nuevo Valor de balance + */ + public void setBalance(BigDecimal pBalance) { + this.balance = pBalance; + } + + /** + * Obtiene el valor de balancedate + * + * @return valor de balancedate + */ + public Date getBalancedate() { + return this.balancedate; + } + + /** + * Fija el valor de balancedate + * + * @param pBalancedate nuevo Valor de balancedate + */ + public void setBalancedate(Date pBalancedate) { + this.balancedate = pBalancedate; + } + + /** + * Obtiene el valor de expirationdate + * + * @return valor de expirationdate + */ + public Date getExpirationdate() { + return this.expirationdate; + } + + /** + * Fija el valor de expirationdate + * + * @param pExpirationdate nuevo Valor de expirationdate + */ + public void setExpirationdate(Date pExpirationdate) { + this.expirationdate = pExpirationdate; + } + + /** + * Obtiene el valor de remark + * + * @return valor de remark + */ + public String getRemark() { + return this.remark; + } + + /** + * Fija el valor de remark + * + * @param pRemark nuevo Valor de remark + */ + public void setRemark(String pRemark) { + this.remark = pRemark; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPeopleFixedIncome)) { + return false; + } + TcustPeopleFixedIncome that = (TcustPeopleFixedIncome) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustPeopleFixedIncome + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustPeopleFixedIncome + */ + @Override + public Object createInstance() { + TcustPeopleFixedIncome instance = new TcustPeopleFixedIncome(); + instance.setPk(new TcustPeopleFixedIncomeKey()); + return instance; + } + + /** + * Clona la entidad TcustPeopleFixedIncome + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPeopleFixedIncome p = (TcustPeopleFixedIncome) this.clone(); + p.setPk((TcustPeopleFixedIncomeKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleFixedIncomeKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleFixedIncomeKey.java.svn-base new file mode 100644 index 0000000..134a02e --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleFixedIncomeKey.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLEFIXEDINCOME*/ +@Embeddable +public class TcustPeopleFixedIncomeKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="FIXEDINCOMESEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del ingreso de la persona +*/ +private Integer fixedincomesequence; + +/**Contructor por defecto*/ +public TcustPeopleFixedIncomeKey(){} +/**Contructor de TcustPeopleFixedIncomeKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pFixedincomesequence Secuencia del ingreso de la persona +*/ +public TcustPeopleFixedIncomeKey(Integer pPersoncode,Timestamp pDateto,Integer pFixedincomesequence){ + personcode=pPersoncode; + dateto=pDateto; + fixedincomesequence=pFixedincomesequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de fixedincomesequence +@return valor de fixedincomesequence*/ +public Integer getFixedincomesequence(){ + return fixedincomesequence; +} +/**Fija el valor de fixedincomesequence +@param pFixedincomesequence nuevo Valor de fixedincomesequence*/ +public void setFixedincomesequence(Integer pFixedincomesequence){ + fixedincomesequence=pFixedincomesequence; +} + +/**Implementacin de la comparacin de TcustPeopleFixedIncomeKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleFixedIncomeKey))return false; + TcustPeopleFixedIncomeKey that = (TcustPeopleFixedIncomeKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getFixedincomesequence() == null || that.getFixedincomesequence() == null){ + return false; + } + if (! this.getFixedincomesequence().equals(that.getFixedincomesequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPeopleFixedIncomeKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getFixedincomesequence() == null ? 0 : this.getFixedincomesequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleIncome.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleIncome.java.svn-base new file mode 100644 index 0000000..e2ce444 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleIncome.java.svn-base @@ -0,0 +1,416 @@ +package com.fp.persistence.pcustomer.people; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTPEOPLEINCOME + */ +@Entity(name = "TcustPeopleIncome") +@Table(name = "TCUSTPEOPLEINCOME") +public class TcustPeopleIncome extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustPeopleIncome + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(INCOMESEQUENCE),0)+1 from TCUSTPEOPLEINCOME where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "incomesequence")}) + @GeneratedValue(generator = "seq_id") + private TcustPeopleIncomeKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "INCOMESCATALOG", nullable = true) + /** + * Codigo de catalogo de ingresos 1 sueldo, 2 comisiones + */ + private String incomescatalog; + @Column(name = "INCOMESCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo INCOMES DE INGRESOS + */ + private String incomescatalogcode; + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + @Column(name = "AMOUNT", nullable = true) + /** + * Valor del ingreso mensual + */ + private BigDecimal amount; + @Column(name = "ISFIXVALUE", nullable = true) + /** + * Y indica que un valor de ingreso fijo, N no es un ingreso fijo + */ + private String isfixvalue; + @Column(name = "VERIFIEDAMOUNT", nullable = true) + /** + * Monto verificado por una persona de la institucion financiera + */ + private BigDecimal verifiedamount; + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String ingressusercode; + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String modifyusercode; + + /** + * Contructor por defecto + */ + public TcustPeopleIncome() { + } + + /** + * Contructor de TcustPeopleIncome + * + * @param pPk Clave Primaria del entity + */ + public TcustPeopleIncome(TcustPeopleIncomeKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPeopleIncome + */ + public static TcustPeopleIncome find(EntityManager pEntityManager, TcustPeopleIncomeKey pKey) throws Exception { + TcustPeopleIncome obj = pEntityManager.find(TcustPeopleIncome.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPeopleIncome + * + * @return El objeto que referencia a la Clave primaria de TcustPeopleIncome + */ + public TcustPeopleIncomeKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPeopleIncome + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustPeopleIncome + */ + public void setPk(TcustPeopleIncomeKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de incomescatalog + * + * @return valor de incomescatalog + */ + public String getIncomescatalog() { + return this.incomescatalog; + } + + /** + * Fija el valor de incomescatalog + * + * @param pIncomescatalog nuevo Valor de incomescatalog + */ + public void setIncomescatalog(String pIncomescatalog) { + this.incomescatalog = pIncomescatalog; + } + + /** + * Obtiene el valor de incomescatalogcode + * + * @return valor de incomescatalogcode + */ + public String getIncomescatalogcode() { + return this.incomescatalogcode; + } + + /** + * Fija el valor de incomescatalogcode + * + * @param pIncomescatalogcode nuevo Valor de incomescatalogcode + */ + public void setIncomescatalogcode(String pIncomescatalogcode) { + this.incomescatalogcode = pIncomescatalogcode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de amount + * + * @return valor de amount + */ + public BigDecimal getAmount() { + return this.amount; + } + + /** + * Fija el valor de amount + * + * @param pAmount nuevo Valor de amount + */ + public void setAmount(BigDecimal pAmount) { + this.amount = pAmount; + } + + /** + * Obtiene el valor de isfixvalue + * + * @return valor de isfixvalue + */ + public String getIsfixvalue() { + return this.isfixvalue; + } + + /** + * Fija el valor de isfixvalue + * + * @param pIsfixvalue nuevo Valor de isfixvalue + */ + public void setIsfixvalue(String pIsfixvalue) { + this.isfixvalue = pIsfixvalue; + } + + /** + * Obtiene el valor de verifiedamount + * + * @return valor de verifiedamount + */ + public BigDecimal getVerifiedamount() { + return this.verifiedamount; + } + + /** + * Fija el valor de verifiedamount + * + * @param pVerifiedamount nuevo Valor de verifiedamount + */ + public void setVerifiedamount(BigDecimal pVerifiedamount) { + this.verifiedamount = pVerifiedamount; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPeopleIncome)) { + return false; + } + TcustPeopleIncome that = (TcustPeopleIncome) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustPeopleIncome + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustPeopleIncome + */ + @Override + public Object createInstance() { + TcustPeopleIncome instance = new TcustPeopleIncome(); + instance.setPk(new TcustPeopleIncomeKey()); + return instance; + } + + /** + * Clona la entidad TcustPeopleIncome + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPeopleIncome p = (TcustPeopleIncome) this.clone(); + p.setPk((TcustPeopleIncomeKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleIncomeKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleIncomeKey.java.svn-base new file mode 100644 index 0000000..3394ddb --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleIncomeKey.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLEINCOME*/ +@Embeddable +public class TcustPeopleIncomeKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="INCOMESEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del ingreso de la persona +*/ +private Integer incomesequence; + +/**Contructor por defecto*/ +public TcustPeopleIncomeKey(){} +/**Contructor de TcustPeopleIncomeKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pIncomesequence Secuencia del ingreso de la persona +*/ +public TcustPeopleIncomeKey(Integer pPersoncode,Timestamp pDateto,Integer pIncomesequence){ + personcode=pPersoncode; + dateto=pDateto; + incomesequence=pIncomesequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de incomesequence +@return valor de incomesequence*/ +public Integer getIncomesequence(){ + return incomesequence; +} +/**Fija el valor de incomesequence +@param pIncomesequence nuevo Valor de incomesequence*/ +public void setIncomesequence(Integer pIncomesequence){ + incomesequence=pIncomesequence; +} + +/**Implementacin de la comparacin de TcustPeopleIncomeKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleIncomeKey))return false; + TcustPeopleIncomeKey that = (TcustPeopleIncomeKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getIncomesequence() == null || that.getIncomesequence() == null){ + return false; + } + if (! this.getIncomesequence().equals(that.getIncomesequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPeopleIncomeKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getIncomesequence() == null ? 0 : this.getIncomesequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleJob.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleJob.java.svn-base new file mode 100644 index 0000000..d723d3d --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleJob.java.svn-base @@ -0,0 +1,508 @@ +package com.fp.persistence.pcustomer.people; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTPEOPLEJOB + */ +@Entity(name = "TcustPeopleJob") +@Table(name = "TCUSTPEOPLEJOB") +public class TcustPeopleJob extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustPeopleJob + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(JOBSEQUENCE),0)+1 from TCUSTPEOPLEJOB where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "jobsequence")}) + @GeneratedValue(generator = "seq_id") + private TcustPeopleJobKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "EMPLOYERPERSONCODE", nullable = true) + /** + * Codigo de persona empleadora + */ + private Integer employerpersoncode; + @Column(name = "JOBCATALOG", nullable = true) + /** + * Codigo de catalogo 1, Gerente, 2 Chofer, 3 Cajero + */ + private String jobcatalog; + @Column(name = "JOBCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo de cargos de personas naturales JOB + */ + private String jobcatalogcode; + @Column(name = "AGREEMENTTYPECATALOG", nullable = true) + /** + * Codigo de contrato, 1 indefinido, 2 un a�o , 3 tres meses etc. + */ + private String agreementtypecatalog; + @Column(name = "AGREEMENTTYPECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo AGREEMENTTYPE tipo de contrato + */ + private String agreementtypecatalogcode; + @Column(name = "ENTRYDATE", nullable = true) + /** + * Fecha de ingreso al trabajo + */ + private Date entrydate; + @Column(name = "DEPARTUREDATE", nullable = true) + /** + * Fecha de salida del trabajo + */ + private Date departuredate; + @Column(name = "EMPLOYERNAME", nullable = true) + /** + * Nombre del empleador + */ + private String employername; + @Column(name = "ISOWNER", nullable = true) + /** + * Y indica que es duenio de la empresa. + */ + private String isowner; + @Column(name = "ADDRESS", nullable = true) + /** + * Numero de direccion asociada al trabajo + */ + private Integer address; + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String ingressusercode; + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String modifyusercode; + + /** + * Contructor por defecto + */ + public TcustPeopleJob() { + } + + /** + * Contructor de TcustPeopleJob + * + * @param pPk Clave Primaria del entity + */ + public TcustPeopleJob(TcustPeopleJobKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPeopleJob + */ + public static TcustPeopleJob find(EntityManager pEntityManager, TcustPeopleJobKey pKey) throws Exception { + TcustPeopleJob obj = pEntityManager.find(TcustPeopleJob.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPeopleJob + * + * @return El objeto que referencia a la Clave primaria de TcustPeopleJob + */ + public TcustPeopleJobKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPeopleJob + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustPeopleJob + */ + public void setPk(TcustPeopleJobKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de employerpersoncode + * + * @return valor de employerpersoncode + */ + public Integer getEmployerpersoncode() { + return this.employerpersoncode; + } + + /** + * Fija el valor de employerpersoncode + * + * @param pEmployerpersoncode nuevo Valor de employerpersoncode + */ + public void setEmployerpersoncode(Integer pEmployerpersoncode) { + this.employerpersoncode = pEmployerpersoncode; + } + + /** + * Obtiene el valor de jobcatalog + * + * @return valor de jobcatalog + */ + public String getJobcatalog() { + return this.jobcatalog; + } + + /** + * Fija el valor de jobcatalog + * + * @param pJobcatalog nuevo Valor de jobcatalog + */ + public void setJobcatalog(String pJobcatalog) { + this.jobcatalog = pJobcatalog; + } + + /** + * Obtiene el valor de jobcatalogcode + * + * @return valor de jobcatalogcode + */ + public String getJobcatalogcode() { + return this.jobcatalogcode; + } + + /** + * Fija el valor de jobcatalogcode + * + * @param pJobcatalogcode nuevo Valor de jobcatalogcode + */ + public void setJobcatalogcode(String pJobcatalogcode) { + this.jobcatalogcode = pJobcatalogcode; + } + + /** + * Obtiene el valor de agreementtypecatalog + * + * @return valor de agreementtypecatalog + */ + public String getAgreementtypecatalog() { + return this.agreementtypecatalog; + } + + /** + * Fija el valor de agreementtypecatalog + * + * @param pAgreementtypecatalog nuevo Valor de agreementtypecatalog + */ + public void setAgreementtypecatalog(String pAgreementtypecatalog) { + this.agreementtypecatalog = pAgreementtypecatalog; + } + + /** + * Obtiene el valor de agreementtypecatalogcode + * + * @return valor de agreementtypecatalogcode + */ + public String getAgreementtypecatalogcode() { + return this.agreementtypecatalogcode; + } + + /** + * Fija el valor de agreementtypecatalogcode + * + * @param pAgreementtypecatalogcode nuevo Valor de agreementtypecatalogcode + */ + public void setAgreementtypecatalogcode(String pAgreementtypecatalogcode) { + this.agreementtypecatalogcode = pAgreementtypecatalogcode; + } + + /** + * Obtiene el valor de entrydate + * + * @return valor de entrydate + */ + public Date getEntrydate() { + return this.entrydate; + } + + /** + * Fija el valor de entrydate + * + * @param pEntrydate nuevo Valor de entrydate + */ + public void setEntrydate(Date pEntrydate) { + this.entrydate = pEntrydate; + } + + /** + * Obtiene el valor de departuredate + * + * @return valor de departuredate + */ + public Date getDeparturedate() { + return this.departuredate; + } + + /** + * Fija el valor de departuredate + * + * @param pDeparturedate nuevo Valor de departuredate + */ + public void setDeparturedate(Date pDeparturedate) { + this.departuredate = pDeparturedate; + } + + /** + * Obtiene el valor de employername + * + * @return valor de employername + */ + public String getEmployername() { + return this.employername; + } + + /** + * Fija el valor de employername + * + * @param pEmployername nuevo Valor de employername + */ + public void setEmployername(String pEmployername) { + this.employername = pEmployername; + } + + /** + * Obtiene el valor de isowner + * + * @return valor de isowner + */ + public String getIsowner() { + return this.isowner; + } + + /** + * Fija el valor de isowner + * + * @param pIsowner nuevo Valor de isowner + */ + public void setIsowner(String pIsowner) { + this.isowner = pIsowner; + } + + /** + * Obtiene el valor de address + * + * @return valor de address + */ + public Integer getAddress() { + return this.address; + } + + /** + * Fija el valor de address + * + * @param pAddress nuevo Valor de address + */ + public void setAddress(Integer pAddress) { + this.address = pAddress; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPeopleJob)) { + return false; + } + TcustPeopleJob that = (TcustPeopleJob) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustPeopleJob + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustPeopleJob + */ + @Override + public Object createInstance() { + TcustPeopleJob instance = new TcustPeopleJob(); + instance.setPk(new TcustPeopleJobKey()); + return instance; + } + + /** + * Clona la entidad TcustPeopleJob + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPeopleJob p = (TcustPeopleJob) this.clone(); + p.setPk((TcustPeopleJobKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleJobKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleJobKey.java.svn-base new file mode 100644 index 0000000..fced40a --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleJobKey.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLEJOB*/ +@Embeddable +public class TcustPeopleJobKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="JOBSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del trabajo +*/ +private Integer jobsequence; + +/**Contructor por defecto*/ +public TcustPeopleJobKey(){} +/**Contructor de TcustPeopleJobKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pJobsequence Secuencia del trabajo +*/ +public TcustPeopleJobKey(Integer pPersoncode,Timestamp pDateto,Integer pJobsequence){ + personcode=pPersoncode; + dateto=pDateto; + jobsequence=pJobsequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de jobsequence +@return valor de jobsequence*/ +public Integer getJobsequence(){ + return jobsequence; +} +/**Fija el valor de jobsequence +@param pJobsequence nuevo Valor de jobsequence*/ +public void setJobsequence(Integer pJobsequence){ + jobsequence=pJobsequence; +} + +/**Implementacin de la comparacin de TcustPeopleJobKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleJobKey))return false; + TcustPeopleJobKey that = (TcustPeopleJobKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getJobsequence() == null || that.getJobsequence() == null){ + return false; + } + if (! this.getJobsequence().equals(that.getJobsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPeopleJobKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getJobsequence() == null ? 0 : this.getJobsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleKey.java.svn-base new file mode 100644 index 0000000..3da7c3e --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleKey.java.svn-base @@ -0,0 +1,129 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLE*/ +@Embeddable +public class TcustPeopleKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TcustPeopleKey(){} +/**Contructor de TcustPeopleKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +*/ +public TcustPeopleKey(Integer pPersoncode,Timestamp pDateto){ + personcode=pPersoncode; + dateto=pDateto; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacion de la comparacion de TcustPeopleKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleKey))return false; + TcustPeopleKey that = (TcustPeopleKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TcustPeopleKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleLoan.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleLoan.java.svn-base new file mode 100644 index 0000000..f5d24a4 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleLoan.java.svn-base @@ -0,0 +1,568 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import com.fp.dto.hb.Log; +import java.io.Serializable; +import javax.persistence.Table; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import javax.persistence.Entity; +import javax.persistence.EmbeddedId; +import javax.persistence.EntityManager; +import javax.persistence.Column; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; +import javax.persistence.*; +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPEOPLELOAN + */ +@Entity(name = "TcustPeopleLoan") +@Table(name = "TCUSTPEOPLELOAN") +public class TcustPeopleLoan extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustPeopleLoan + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(LOANSEQUENCE),0)+1 from TCUSTPEOPLELOAN where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "loansequence")}) + @GeneratedValue(generator = "seq_id") + private TcustPeopleLoanKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "CREDITRATINGCATALOG", nullable = true) + /** + * Codigo de catalogo 1, normal, 2 deficiente, dudoso, 3 perdida + */ + private String creditratingcatalog; + @Column(name = "CREDITRATINGCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo CREDITRATING, de la calificacion de creditos + */ + private String creditratingcatalogcode; + @Column(name = "CREDITTYPECLIENTCATALOG", nullable = true) + /** + * Tipos de credito + */ + private String credittypeclientcatalog; + @Column(name = "CREDITTYPECLIENTCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo CREDITTYPECLIENT, para tipos de crédito + */ + private String credittypeclientcatalogcode; + @Column(name = "FREQUENCYCLIENTCATALOG", nullable = true) + /** + * Tipos de credito + */ + private String frequencyclientcatalog; + @Column(name = "FREQUENCYCLIENTCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo FREQUENCYCLIENT, para frecuencias en clientes + */ + private String frequencyclientcatalogcode; + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + @Column(name = "BANKPERSONCODE", nullable = true) + /** + * Codigo de persona asociado a la institucion fincnaiera en la cual el cliente matiene el prestamo + */ + private Integer bankpersoncode; + @Column(name = "BANKNAME", nullable = true) + /** + * Nombre de la institucion financiera en la cual el cliente mantiene la operacion + */ + private String bankname; + @Column(name = "ORIGINALAMONT", nullable = true) + /** + * Monto original del prestamo + */ + private BigDecimal originalamont; + @Column(name = "BALANCE", nullable = true) + /** + * Saldo del prestamo. + */ + private BigDecimal balance; + @Column(name = "BALANCEDATE", nullable = true) + /** + * Fecha a la cual se ingresa el saldo del prestamo + */ + private Date balancedate; + @Column(name = "QUOTAAMOUNT", nullable = true) + /** + * Valor de la cuota, de acuerdo a la frecuencia de pago + */ + private BigDecimal quotaamount; + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String ingressusercode; + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String modifyusercode; + + /** + * Contructor por defecto + */ + public TcustPeopleLoan() { + } + + /** + * Contructor de TcustPeopleLoan + * + * @param pPk Clave Primaria del entity + */ + public TcustPeopleLoan(TcustPeopleLoanKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPeopleLoan + */ + public static TcustPeopleLoan find(EntityManager pEntityManager, TcustPeopleLoanKey pKey) throws Exception { + TcustPeopleLoan obj = pEntityManager.find(TcustPeopleLoan.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPeopleLoan + * + * @return El objeto que referencia a la Clave primaria de TcustPeopleLoan + */ + public TcustPeopleLoanKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPeopleLoan + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TcustPeopleLoan + */ + public void setPk(TcustPeopleLoanKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de creditratingcatalog + * + * @return valor de creditratingcatalog + */ + public String getCreditratingcatalog() { + return creditratingcatalog; + } + + /** + * Fija el valor de creditratingcatalog + * + * @param pCreditratingcatalog nuevo Valor de creditratingcatalog + */ + public void setCreditratingcatalog(String pCreditratingcatalog) { + creditratingcatalog = pCreditratingcatalog; + } + + /** + * Obtiene el valor de creditratingcatalogcode + * + * @return valor de creditratingcatalogcode + */ + public String getCreditratingcatalogcode() { + return creditratingcatalogcode; + } + + /** + * Fija el valor de creditratingcatalogcode + * + * @param pCreditratingcatalogcode nuevo Valor de creditratingcatalogcode + */ + public void setCreditratingcatalogcode(String pCreditratingcatalogcode) { + creditratingcatalogcode = pCreditratingcatalogcode; + } + + /** + * Obtiene el valor de credittypeclientcatalog + * + * @return valor de credittypeclientcatalog + */ + public String getCredittypeclientcatalog() { + return credittypeclientcatalog; + } + + /** + * Fija el valor de credittypeclientcatalog + * + * @param pCredittypeclientcatalog nuevo Valor de credittypeclientcatalog + */ + public void setCredittypeclientcatalog(String pCredittypeclientcatalog) { + credittypeclientcatalog = pCredittypeclientcatalog; + } + + /** + * Obtiene el valor de credittypeclientcatalogcode + * + * @return valor de credittypeclientcatalogcode + */ + public String getCredittypeclientcatalogcode() { + return credittypeclientcatalogcode; + } + + /** + * Fija el valor de credittypeclientcatalogcode + * + * @param pCredittypeclientcatalogcode nuevo Valor de credittypeclientcatalogcode + */ + public void setCredittypeclientcatalogcode(String pCredittypeclientcatalogcode) { + credittypeclientcatalogcode = pCredittypeclientcatalogcode; + } + + /** + * Obtiene el valor de frequencyclientcatalog + * + * @return valor de frequencyclientcatalog + */ + public String getFrequencyclientcatalog() { + return frequencyclientcatalog; + } + + /** + * Fija el valor de frequencyclientcatalog + * + * @param pFrequencyclientcatalog nuevo Valor de frequencyclientcatalog + */ + public void setFrequencyclientcatalog(String pFrequencyclientcatalog) { + frequencyclientcatalog = pFrequencyclientcatalog; + } + + /** + * Obtiene el valor de frequencyclientcatalogcode + * + * @return valor de frequencyclientcatalogcode + */ + public String getFrequencyclientcatalogcode() { + return frequencyclientcatalogcode; + } + + /** + * Fija el valor de frequencyclientcatalogcode + * + * @param pFrequencyclientcatalogcode nuevo Valor de frequencyclientcatalogcode + */ + public void setFrequencyclientcatalogcode(String pFrequencyclientcatalogcode) { + frequencyclientcatalogcode = pFrequencyclientcatalogcode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de bankpersoncode + * + * @return valor de bankpersoncode + */ + public Integer getBankpersoncode() { + return bankpersoncode; + } + + /** + * Fija el valor de bankpersoncode + * + * @param pBankpersoncode nuevo Valor de bankpersoncode + */ + public void setBankpersoncode(Integer pBankpersoncode) { + bankpersoncode = pBankpersoncode; + } + + /** + * Obtiene el valor de bankname + * + * @return valor de bankname + */ + public String getBankname() { + return bankname; + } + + /** + * Fija el valor de bankname + * + * @param pBankname nuevo Valor de bankname + */ + public void setBankname(String pBankname) { + bankname = pBankname; + } + + /** + * Obtiene el valor de originalamont + * + * @return valor de originalamont + */ + public BigDecimal getOriginalamont() { + return originalamont; + } + + /** + * Fija el valor de originalamont + * + * @param pOriginalamont nuevo Valor de originalamont + */ + public void setOriginalamont(BigDecimal pOriginalamont) { + originalamont = pOriginalamont; + } + + /** + * Obtiene el valor de balance + * + * @return valor de balance + */ + public BigDecimal getBalance() { + return balance; + } + + /** + * Fija el valor de balance + * + * @param pBalance nuevo Valor de balance + */ + public void setBalance(BigDecimal pBalance) { + balance = pBalance; + } + + /** + * Obtiene el valor de balancedate + * + * @return valor de balancedate + */ + public Date getBalancedate() { + return balancedate; + } + + /** + * Fija el valor de balancedate + * + * @param pBalancedate nuevo Valor de balancedate + */ + public void setBalancedate(Date pBalancedate) { + balancedate = pBalancedate; + } + + /** + * Obtiene el valor de quotaamount + * + * @return valor de quotaamount + */ + public BigDecimal getQuotaamount() { + return quotaamount; + } + + /** + * Fija el valor de quotaamount + * + * @param pQuotaamount nuevo Valor de quotaamount + */ + public void setQuotaamount(BigDecimal pQuotaamount) { + quotaamount = pQuotaamount; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + modifyusercode = pModifyusercode; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPeopleLoan)) { + return false; + } + TcustPeopleLoan that = (TcustPeopleLoan) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TcustPeopleLoan + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacion toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacion de la creacion de un bean en blanco TcustPeopleLoan + */ + public Object createInstance() { + TcustPeopleLoan instance = new TcustPeopleLoan(); + instance.setPk(new TcustPeopleLoanKey()); + return instance; + } + + /** + * Clona la entidad TcustPeopleLoan + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustPeopleLoan p = (TcustPeopleLoan) this.clone(); + p.setPk((TcustPeopleLoanKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleLoanKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleLoanKey.java.svn-base new file mode 100644 index 0000000..3ec6776 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleLoanKey.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLELOAN*/ +@Embeddable +public class TcustPeopleLoanKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="LOANSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del ingreso de la persona +*/ +private Integer loansequence; + +/**Contructor por defecto*/ +public TcustPeopleLoanKey(){} +/**Contructor de TcustPeopleLoanKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pLoansequence Secuencia del ingreso de la persona +*/ +public TcustPeopleLoanKey(Integer pPersoncode,Timestamp pDateto,Integer pLoansequence){ + personcode=pPersoncode; + dateto=pDateto; + loansequence=pLoansequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de loansequence +@return valor de loansequence*/ +public Integer getLoansequence(){ + return loansequence; +} +/**Fija el valor de loansequence +@param pLoansequence nuevo Valor de loansequence*/ +public void setLoansequence(Integer pLoansequence){ + loansequence=pLoansequence; +} + +/**Implementacion de la comparacion de TcustPeopleLoanKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleLoanKey))return false; + TcustPeopleLoanKey that = (TcustPeopleLoanKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getLoansequence() == null || that.getLoansequence() == null){ + return false; + } + if (! this.getLoansequence().equals(that.getLoansequence())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TcustPeopleLoanKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getLoansequence() == null ? 0 : this.getLoansequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleOtherAssets.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleOtherAssets.java.svn-base new file mode 100644 index 0000000..295404b --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleOtherAssets.java.svn-base @@ -0,0 +1,546 @@ +package com.fp.persistence.pcustomer.people; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPEOPLEOTHERASSETS + */ +@Entity(name = "TcustPeopleOtherAssets") +@Table(name = "TCUSTPEOPLEOTHERASSETS") +public class TcustPeopleOtherAssets extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TcustPeopleOtherAssets + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(ASSETSSEQUENCE),0)+1 from TCUSTPEOPLEOTHERASSETS where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "assetssequence") }) + @GeneratedValue(generator = "seq_id") + private TcustPeopleOtherAssetsKey pk; + + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "PROPERTYTYPECATALOG", nullable = true) + /** + * Codigo de catalogo 1, CASA, 2 OFICINA, 3 JOYAS + */ + private String propertytypecatalog; + + @Column(name = "PROPERTYTYPECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo PROPERTYTYPE, DEL TIPO DE BIEN + */ + private String propertytypecatalogcode; + + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + + @Column(name = "ASSESSMENT", nullable = true) + /** + * Valor del avaluo del bien + */ + private BigDecimal assessment; + + @Column(name = "ASSESSMENTDATE", nullable = true) + /** + * Fecha de avaluo. + */ + private Date assessmentdate; + + @Column(name = "MORTGAGEAMOUNT", nullable = true) + /** + * Monto original de la hipoteca + */ + private BigDecimal mortgageamount; + + @Column(name = "MORTGAGEDATE", nullable = true) + /** + * Fecha de la hipoteca + */ + private Date mortgagedate; + + @Column(name = "MORTGAGEBALANCE", nullable = true) + /** + * Saldo de la hipoteca + */ + private BigDecimal mortgagebalance; + + @Column(name = "MORTGAGEPERSONCODE", nullable = true) + /** + * Codigo de persona a la que esta hipotecado el bien + */ + private Integer mortgagepersoncode; + + @Column(name = "MORTGAGENAME", nullable = true) + /** + * Nombre de la entidad poseedora de la hipoteca + */ + private String mortgagename; + + @Column(name = "REMARK", nullable = true) + /** + * Comentario + */ + private String remark; + + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String ingressusercode; + + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String modifyusercode; + + /** + * Contructor por defecto + */ + public TcustPeopleOtherAssets() { + } + + /** + * Contructor de TcustPeopleOtherAssets + * + * @param pPk Clave Primaria del entity + */ + public TcustPeopleOtherAssets(TcustPeopleOtherAssetsKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPeopleOtherAssets + */ + public static TcustPeopleOtherAssets find(EntityManager pEntityManager, TcustPeopleOtherAssetsKey pKey) throws Exception { + TcustPeopleOtherAssets obj = pEntityManager.find(TcustPeopleOtherAssets.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPeopleOtherAssets + * + * @return El objeto que referencia a la Clave primaria de TcustPeopleOtherAssets + */ + public TcustPeopleOtherAssetsKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPeopleOtherAssets + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TcustPeopleOtherAssets + */ + public void setPk(TcustPeopleOtherAssetsKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de propertytypecatalog + * + * @return valor de propertytypecatalog + */ + public String getPropertytypecatalog() { + return this.propertytypecatalog; + } + + /** + * Fija el valor de propertytypecatalog + * + * @param pPropertytypecatalog nuevo Valor de propertytypecatalog + */ + public void setPropertytypecatalog(String pPropertytypecatalog) { + this.propertytypecatalog = pPropertytypecatalog; + } + + /** + * Obtiene el valor de propertytypecatalogcode + * + * @return valor de propertytypecatalogcode + */ + public String getPropertytypecatalogcode() { + return this.propertytypecatalogcode; + } + + /** + * Fija el valor de propertytypecatalogcode + * + * @param pPropertytypecatalogcode nuevo Valor de propertytypecatalogcode + */ + public void setPropertytypecatalogcode(String pPropertytypecatalogcode) { + this.propertytypecatalogcode = pPropertytypecatalogcode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de assessment + * + * @return valor de assessment + */ + public BigDecimal getAssessment() { + return this.assessment; + } + + /** + * Fija el valor de assessment + * + * @param pAssessment nuevo Valor de assessment + */ + public void setAssessment(BigDecimal pAssessment) { + this.assessment = pAssessment; + } + + /** + * Obtiene el valor de assessmentdate + * + * @return valor de assessmentdate + */ + public Date getAssessmentdate() { + return this.assessmentdate; + } + + /** + * Fija el valor de assessmentdate + * + * @param pAssessmentdate nuevo Valor de assessmentdate + */ + public void setAssessmentdate(Date pAssessmentdate) { + this.assessmentdate = pAssessmentdate; + } + + /** + * Obtiene el valor de mortgageamount + * + * @return valor de mortgageamount + */ + public BigDecimal getMortgageamount() { + return this.mortgageamount; + } + + /** + * Fija el valor de mortgageamount + * + * @param pMortgageamount nuevo Valor de mortgageamount + */ + public void setMortgageamount(BigDecimal pMortgageamount) { + this.mortgageamount = pMortgageamount; + } + + /** + * Obtiene el valor de mortgagedate + * + * @return valor de mortgagedate + */ + public Date getMortgagedate() { + return this.mortgagedate; + } + + /** + * Fija el valor de mortgagedate + * + * @param pMortgagedate nuevo Valor de mortgagedate + */ + public void setMortgagedate(Date pMortgagedate) { + this.mortgagedate = pMortgagedate; + } + + /** + * Obtiene el valor de mortgagebalance + * + * @return valor de mortgagebalance + */ + public BigDecimal getMortgagebalance() { + return this.mortgagebalance; + } + + /** + * Fija el valor de mortgagebalance + * + * @param pMortgagebalance nuevo Valor de mortgagebalance + */ + public void setMortgagebalance(BigDecimal pMortgagebalance) { + this.mortgagebalance = pMortgagebalance; + } + + /** + * Obtiene el valor de mortgagepersoncode + * + * @return valor de mortgagepersoncode + */ + public Integer getMortgagepersoncode() { + return this.mortgagepersoncode; + } + + /** + * Fija el valor de mortgagepersoncode + * + * @param pMortgagepersoncode nuevo Valor de mortgagepersoncode + */ + public void setMortgagepersoncode(Integer pMortgagepersoncode) { + this.mortgagepersoncode = pMortgagepersoncode; + } + + /** + * Obtiene el valor de mortgagename + * + * @return valor de mortgagename + */ + public String getMortgagename() { + return this.mortgagename; + } + + /** + * Fija el valor de mortgagename + * + * @param pMortgagename nuevo Valor de mortgagename + */ + public void setMortgagename(String pMortgagename) { + this.mortgagename = pMortgagename; + } + + /** + * Obtiene el valor de remark + * + * @return valor de remark + */ + public String getRemark() { + return this.remark; + } + + /** + * Fija el valor de remark + * + * @param pRemark nuevo Valor de remark + */ + public void setRemark(String pRemark) { + this.remark = pRemark; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPeopleOtherAssets)) { + return false; + } + TcustPeopleOtherAssets that = (TcustPeopleOtherAssets) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustPeopleOtherAssets + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustPeopleOtherAssets + */ + @Override + public Object createInstance() { + TcustPeopleOtherAssets instance = new TcustPeopleOtherAssets(); + instance.setPk(new TcustPeopleOtherAssetsKey()); + return instance; + } + + /** + * Clona la entidad TcustPeopleOtherAssets + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPeopleOtherAssets p = (TcustPeopleOtherAssets) this.clone(); + p.setPk((TcustPeopleOtherAssetsKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleOtherAssetsKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleOtherAssetsKey.java.svn-base new file mode 100644 index 0000000..e50643f --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleOtherAssetsKey.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLEOTHERASSETS*/ +@Embeddable +public class TcustPeopleOtherAssetsKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="ASSETSSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del ingreso de la persona +*/ +private Integer assetssequence; + +/**Contructor por defecto*/ +public TcustPeopleOtherAssetsKey(){} +/**Contructor de TcustPeopleOtherAssetsKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pAssetssequence Secuencia del ingreso de la persona +*/ +public TcustPeopleOtherAssetsKey(Integer pPersoncode,Timestamp pDateto,Integer pAssetssequence){ + personcode=pPersoncode; + dateto=pDateto; + assetssequence=pAssetssequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de assetssequence +@return valor de assetssequence*/ +public Integer getAssetssequence(){ + return assetssequence; +} +/**Fija el valor de assetssequence +@param pAssetssequence nuevo Valor de assetssequence*/ +public void setAssetssequence(Integer pAssetssequence){ + assetssequence=pAssetssequence; +} + +/**Implementacin de la comparacin de TcustPeopleOtherAssetsKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleOtherAssetsKey))return false; + TcustPeopleOtherAssetsKey that = (TcustPeopleOtherAssetsKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getAssetssequence() == null || that.getAssetssequence() == null){ + return false; + } + if (! this.getAssetssequence().equals(that.getAssetssequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPeopleOtherAssetsKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getAssetssequence() == null ? 0 : this.getAssetssequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleRealAssets.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleRealAssets.java.svn-base new file mode 100644 index 0000000..3ad0159 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleRealAssets.java.svn-base @@ -0,0 +1,674 @@ +package com.fp.persistence.pcustomer.people; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTPEOPLEREALASSETS + */ +@Entity(name = "TcustPeopleRealAssets") +@Table(name = "TCUSTPEOPLEREALASSETS") +public class TcustPeopleRealAssets extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustPeopleRealAssets + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(ASSETSSEQUENCE),0)+1 from TCUSTPEOPLEREALASSETS where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "assetssequence")}) + @GeneratedValue(generator = "seq_id") + private TcustPeopleRealAssetsKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "REALASSETSTYPECATALOG", nullable = true) + /** + * Codigo de catalogo de tipos de bien 1, casa, 2 oficina, 3 terreno + */ + private String realassetstypecatalog; + @Column(name = "REALASSETSTYPECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo REALASSETSTYPE, del tipo de bien + */ + private String realassetstypecatalogcode; + @Column(name = "COUNTRYCODE", nullable = true) + /** + * Codigo de pais + */ + private String countrycode; + @Column(name = "PROVINCECODE", nullable = true) + /** + * Codigo de provincia + */ + private String provincecode; + @Column(name = "CANTONCODE", nullable = true) + /** + * Codigo de canton + */ + private String cantoncode; + @Column(name = "CITYCODE", nullable = true) + /** + * Codigo de cuidad + */ + private String citycode; + @Column(name = "LOCATION", nullable = true) + /** + * Ubicacion de la propiedad + */ + private String location; + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + @Column(name = "ASSESSMENT", nullable = true) + /** + * Valor del avaluo del bien + */ + private BigDecimal assessment; + @Column(name = "ASSESSMENTDATE", nullable = true) + /** + * Fecha de avaluo. + */ + private Date assessmentdate; + @Column(name = "MORTGAGEAMOUNT", nullable = true) + /** + * Monto original de la hipoteca + */ + private BigDecimal mortgageamount; + @Column(name = "MORTGAGEDATE", nullable = true) + /** + * Fecha de la hipoteca + */ + private Date mortgagedate; + @Column(name = "MORTGAGEBALANCE", nullable = true) + /** + * Saldo de la hipoteca + */ + private BigDecimal mortgagebalance; + @Column(name = "MORTGAGEPERSONCODE", nullable = true) + /** + * Codigo de persona a la que esta hipotecado el bien + */ + private Integer mortgagepersoncode; + @Column(name = "PARROQUIACODE", nullable = true) + /** + * Codigo de parroquia + */ + private String parroquiacode; + @Column(name = "MORTGAGENAME", nullable = true) + /** + * Nombre de la entidad poseedora de la hipoteca + */ + private String mortgagename; + @Column(name = "REMARK", nullable = true) + /** + * Comentario + */ + private String remark; + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String ingressusercode; + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String modifyusercode; + + /** + * Contructor por defecto + */ + public TcustPeopleRealAssets() { + } + + /** + * Contructor de TcustPeopleRealAssets + * + * @param pPk Clave Primaria del entity + */ + public TcustPeopleRealAssets(TcustPeopleRealAssetsKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPeopleRealAssets + */ + public static TcustPeopleRealAssets find(EntityManager pEntityManager, TcustPeopleRealAssetsKey pKey) throws Exception { + TcustPeopleRealAssets obj = pEntityManager.find(TcustPeopleRealAssets.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPeopleRealAssets + * + * @return El objeto que referencia a la Clave primaria de + * TcustPeopleRealAssets + */ + public TcustPeopleRealAssetsKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPeopleRealAssets + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustPeopleRealAssets + */ + public void setPk(TcustPeopleRealAssetsKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de realassetstypecatalog + * + * @return valor de realassetstypecatalog + */ + public String getRealassetstypecatalog() { + return this.realassetstypecatalog; + } + + /** + * Fija el valor de realassetstypecatalog + * + * @param pRealassetstypecatalog nuevo Valor de realassetstypecatalog + */ + public void setRealassetstypecatalog(String pRealassetstypecatalog) { + this.realassetstypecatalog = pRealassetstypecatalog; + } + + /** + * Obtiene el valor de realassetstypecatalogcode + * + * @return valor de realassetstypecatalogcode + */ + public String getRealassetstypecatalogcode() { + return this.realassetstypecatalogcode; + } + + /** + * Fija el valor de realassetstypecatalogcode + * + * @param pRealassetstypecatalogcode nuevo Valor de + * realassetstypecatalogcode + */ + public void setRealassetstypecatalogcode(String pRealassetstypecatalogcode) { + this.realassetstypecatalogcode = pRealassetstypecatalogcode; + } + + /** + * Obtiene el valor de countrycode + * + * @return valor de countrycode + */ + public String getCountrycode() { + return this.countrycode; + } + + /** + * Fija el valor de countrycode + * + * @param pCountrycode nuevo Valor de countrycode + */ + public void setCountrycode(String pCountrycode) { + this.countrycode = pCountrycode; + } + + /** + * Obtiene el valor de provincecode + * + * @return valor de provincecode + */ + public String getProvincecode() { + return this.provincecode; + } + + /** + * Fija el valor de provincecode + * + * @param pProvincecode nuevo Valor de provincecode + */ + public void setProvincecode(String pProvincecode) { + this.provincecode = pProvincecode; + } + + /** + * Obtiene el valor de cantoncode + * + * @return valor de cantoncode + */ + public String getCantoncode() { + return this.cantoncode; + } + + /** + * Fija el valor de cantoncode + * + * @param pCantoncode nuevo Valor de cantoncode + */ + public void setCantoncode(String pCantoncode) { + this.cantoncode = pCantoncode; + } + + /** + * Obtiene el valor de citycode + * + * @return valor de citycode + */ + public String getCitycode() { + return this.citycode; + } + + /** + * Fija el valor de citycode + * + * @param pCitycode nuevo Valor de citycode + */ + public void setCitycode(String pCitycode) { + this.citycode = pCitycode; + } + + /** + * Obtiene el valor de location + * + * @return valor de location + */ + public String getLocation() { + return this.location; + } + + /** + * Fija el valor de location + * + * @param pLocation nuevo Valor de location + */ + public void setLocation(String pLocation) { + this.location = pLocation; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de assessment + * + * @return valor de assessment + */ + public BigDecimal getAssessment() { + return this.assessment; + } + + /** + * Fija el valor de assessment + * + * @param pAssessment nuevo Valor de assessment + */ + public void setAssessment(BigDecimal pAssessment) { + this.assessment = pAssessment; + } + + /** + * Obtiene el valor de assessmentdate + * + * @return valor de assessmentdate + */ + public Date getAssessmentdate() { + return this.assessmentdate; + } + + /** + * Fija el valor de assessmentdate + * + * @param pAssessmentdate nuevo Valor de assessmentdate + */ + public void setAssessmentdate(Date pAssessmentdate) { + this.assessmentdate = pAssessmentdate; + } + + /** + * Obtiene el valor de mortgageamount + * + * @return valor de mortgageamount + */ + public BigDecimal getMortgageamount() { + return this.mortgageamount; + } + + /** + * Fija el valor de mortgageamount + * + * @param pMortgageamount nuevo Valor de mortgageamount + */ + public void setMortgageamount(BigDecimal pMortgageamount) { + this.mortgageamount = pMortgageamount; + } + + /** + * Obtiene el valor de mortgagedate + * + * @return valor de mortgagedate + */ + public Date getMortgagedate() { + return this.mortgagedate; + } + + /** + * Fija el valor de mortgagedate + * + * @param pMortgagedate nuevo Valor de mortgagedate + */ + public void setMortgagedate(Date pMortgagedate) { + this.mortgagedate = pMortgagedate; + } + + /** + * Obtiene el valor de mortgagebalance + * + * @return valor de mortgagebalance + */ + public BigDecimal getMortgagebalance() { + return this.mortgagebalance; + } + + /** + * Fija el valor de mortgagebalance + * + * @param pMortgagebalance nuevo Valor de mortgagebalance + */ + public void setMortgagebalance(BigDecimal pMortgagebalance) { + this.mortgagebalance = pMortgagebalance; + } + + /** + * Obtiene el valor de mortgagepersoncode + * + * @return valor de mortgagepersoncode + */ + public Integer getMortgagepersoncode() { + return this.mortgagepersoncode; + } + + /** + * Fija el valor de mortgagepersoncode + * + * @param pMortgagepersoncode nuevo Valor de mortgagepersoncode + */ + public void setMortgagepersoncode(Integer pMortgagepersoncode) { + this.mortgagepersoncode = pMortgagepersoncode; + } + + /** + * Obtiene el valor de parroquiacode + * + * @return valor de parroquiacode + */ + public String getParroquiacode() { + return this.parroquiacode; + } + + /** + * Fija el valor de parroquiacode + * + * @param pParroquiacode nuevo Valor de parroquiacode + */ + public void setParroquiacode(String pParroquiacode) { + this.parroquiacode = pParroquiacode; + } + + /** + * Obtiene el valor de mortgagename + * + * @return valor de mortgagename + */ + public String getMortgagename() { + return this.mortgagename; + } + + /** + * Fija el valor de mortgagename + * + * @param pMortgagename nuevo Valor de mortgagename + */ + public void setMortgagename(String pMortgagename) { + this.mortgagename = pMortgagename; + } + + /** + * Obtiene el valor de remark + * + * @return valor de remark + */ + public String getRemark() { + return this.remark; + } + + /** + * Fija el valor de remark + * + * @param pRemark nuevo Valor de remark + */ + public void setRemark(String pRemark) { + this.remark = pRemark; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPeopleRealAssets)) { + return false; + } + TcustPeopleRealAssets that = (TcustPeopleRealAssets) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad + * TcustPeopleRealAssets + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco + * TcustPeopleRealAssets + */ + @Override + public Object createInstance() { + TcustPeopleRealAssets instance = new TcustPeopleRealAssets(); + instance.setPk(new TcustPeopleRealAssetsKey()); + return instance; + } + + /** + * Clona la entidad TcustPeopleRealAssets + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPeopleRealAssets p = (TcustPeopleRealAssets) this.clone(); + p.setPk((TcustPeopleRealAssetsKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleRealAssetsKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleRealAssetsKey.java.svn-base new file mode 100644 index 0000000..63abc5b --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleRealAssetsKey.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLEREALASSETS*/ +@Embeddable +public class TcustPeopleRealAssetsKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="ASSETSSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del ingreso de la persona +*/ +private Integer assetssequence; + +/**Contructor por defecto*/ +public TcustPeopleRealAssetsKey(){} +/**Contructor de TcustPeopleRealAssetsKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pAssetssequence Secuencia del ingreso de la persona +*/ +public TcustPeopleRealAssetsKey(Integer pPersoncode,Timestamp pDateto,Integer pAssetssequence){ + personcode=pPersoncode; + dateto=pDateto; + assetssequence=pAssetssequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de assetssequence +@return valor de assetssequence*/ +public Integer getAssetssequence(){ + return assetssequence; +} +/**Fija el valor de assetssequence +@param pAssetssequence nuevo Valor de assetssequence*/ +public void setAssetssequence(Integer pAssetssequence){ + assetssequence=pAssetssequence; +} + +/**Implementacin de la comparacin de TcustPeopleRealAssetsKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleRealAssetsKey))return false; + TcustPeopleRealAssetsKey that = (TcustPeopleRealAssetsKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getAssetssequence() == null || that.getAssetssequence() == null){ + return false; + } + if (! this.getAssetssequence().equals(that.getAssetssequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPeopleRealAssetsKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getAssetssequence() == null ? 0 : this.getAssetssequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleTradereferences.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleTradereferences.java.svn-base new file mode 100644 index 0000000..d79c115 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleTradereferences.java.svn-base @@ -0,0 +1,573 @@ +package com.fp.persistence.pcustomer.people; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPEOPLETRADEREFERENCES + */ +@Entity(name = "TcustPeopleTradereferences") +@Table(name = "TCUSTPEOPLETRADEREFERENCES") +public class TcustPeopleTradereferences extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TcustPeopleTradereferences + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(TRADESEQUENCE),0)+1 from TCUSTPEOPLETRADEREFERENCES where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "tradesequence") }) + @GeneratedValue(generator = "seq_id") + private TcustPeopleTradereferencesKey pk; + + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "ITEM", nullable = true) + /** + * Descripcion del articulo comprado. + */ + private String item; + + @Column(name = "PURCHASEYEAR", nullable = true) + /** + * Anio en que se realizo la compra + */ + private String purchaseyear; + + @Column(name = "PAYMENTMETHODCATALOG", nullable = true) + /** + * Codigo de catalogo de metodo de pago 1 Efectivo, 2 Cheques, 3 tarjeta de + * credito + */ + private String paymentmethodcatalog; + + @Column(name = "PAYMENTMETHODCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo PAYMENTMETHOD, metodo de pago + */ + private String paymentmethodcatalogcode; + + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda de la compra + */ + private String currencycode; + + @Column(name = "AMOUNT", nullable = true) + /** + * Monto total de la compra + */ + private BigDecimal amount; + + @Column(name = "INPUTAMOUNT", nullable = true) + /** + * Monto de entrada + */ + private BigDecimal inputamount; + + @Column(name = "QUOTASNUMBER", nullable = true) + /** + * Numero de cuotas pactadas si se compro a plazo + */ + private Integer quotasnumber; + + @Column(name = "QUOTAVALUE", nullable = true) + /** + * Monto de la cuota pactada + */ + private BigDecimal quotavalue; + + @Column(name = "TRADEPERSONCODE", nullable = true) + /** + * Codigo de persona asociada a la empresa casa cmercial en donde el cliente + * realizo la compra + */ + private Integer tradepersoncode; + + @Column(name = "TRADENAME", nullable = true) + /** + * Nombre del establesimiento comercial, si no esta registrado en la base de + * personas + */ + private String tradename; + + @Column(name = "TRADEPHONE", nullable = true) + /** + * Telefono asociado al establesimiento comercial si no esta registrado como + * una persona + */ + private String tradephone; + + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String ingressusercode; + + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String modifyusercode; + + /** + * Contructor por defecto + */ + public TcustPeopleTradereferences() { + } + + /** + * Contructor de TcustPeopleTradereferences + * + * @param pPk Clave Primaria del entity + */ + public TcustPeopleTradereferences(TcustPeopleTradereferencesKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPeopleTradereferences + */ + public static TcustPeopleTradereferences find(EntityManager pEntityManager, TcustPeopleTradereferencesKey pKey) throws Exception { + TcustPeopleTradereferences obj = pEntityManager.find(TcustPeopleTradereferences.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPeopleTradereferences + * + * @return El objeto que referencia a la Clave primaria de TcustPeopleTradereferences + */ + public TcustPeopleTradereferencesKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPeopleTradereferences + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TcustPeopleTradereferences + */ + public void setPk(TcustPeopleTradereferencesKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de item + * + * @return valor de item + */ + public String getItem() { + return this.item; + } + + /** + * Fija el valor de item + * + * @param pItem nuevo Valor de item + */ + public void setItem(String pItem) { + this.item = pItem; + } + + /** + * Obtiene el valor de purchaseyear + * + * @return valor de purchaseyear + */ + public String getPurchaseyear() { + return this.purchaseyear; + } + + /** + * Fija el valor de purchaseyear + * + * @param pPurchaseyear nuevo Valor de purchaseyear + */ + public void setPurchaseyear(String pPurchaseyear) { + this.purchaseyear = pPurchaseyear; + } + + /** + * Obtiene el valor de paymentmethodcatalog + * + * @return valor de paymentmethodcatalog + */ + public String getPaymentmethodcatalog() { + return this.paymentmethodcatalog; + } + + /** + * Fija el valor de paymentmethodcatalog + * + * @param pPaymentmethodcatalog nuevo Valor de paymentmethodcatalog + */ + public void setPaymentmethodcatalog(String pPaymentmethodcatalog) { + this.paymentmethodcatalog = pPaymentmethodcatalog; + } + + /** + * Obtiene el valor de paymentmethodcatalogcode + * + * @return valor de paymentmethodcatalogcode + */ + public String getPaymentmethodcatalogcode() { + return this.paymentmethodcatalogcode; + } + + /** + * Fija el valor de paymentmethodcatalogcode + * + * @param pPaymentmethodcatalogcode nuevo Valor de paymentmethodcatalogcode + */ + public void setPaymentmethodcatalogcode(String pPaymentmethodcatalogcode) { + this.paymentmethodcatalogcode = pPaymentmethodcatalogcode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de amount + * + * @return valor de amount + */ + public BigDecimal getAmount() { + return this.amount; + } + + /** + * Fija el valor de amount + * + * @param pAmount nuevo Valor de amount + */ + public void setAmount(BigDecimal pAmount) { + this.amount = pAmount; + } + + /** + * Obtiene el valor de inputamount + * + * @return valor de inputamount + */ + public BigDecimal getInputamount() { + return this.inputamount; + } + + /** + * Fija el valor de inputamount + * + * @param pInputamount nuevo Valor de inputamount + */ + public void setInputamount(BigDecimal pInputamount) { + this.inputamount = pInputamount; + } + + /** + * Obtiene el valor de quotasnumber + * + * @return valor de quotasnumber + */ + public Integer getQuotasnumber() { + return this.quotasnumber; + } + + /** + * Fija el valor de quotasnumber + * + * @param pQuotasnumber nuevo Valor de quotasnumber + */ + public void setQuotasnumber(Integer pQuotasnumber) { + this.quotasnumber = pQuotasnumber; + } + + /** + * Obtiene el valor de quotavalue + * + * @return valor de quotavalue + */ + public BigDecimal getQuotavalue() { + return this.quotavalue; + } + + /** + * Fija el valor de quotavalue + * + * @param pQuotavalue nuevo Valor de quotavalue + */ + public void setQuotavalue(BigDecimal pQuotavalue) { + this.quotavalue = pQuotavalue; + } + + /** + * Obtiene el valor de tradepersoncode + * + * @return valor de tradepersoncode + */ + public Integer getTradepersoncode() { + return this.tradepersoncode; + } + + /** + * Fija el valor de tradepersoncode + * + * @param pTradepersoncode nuevo Valor de tradepersoncode + */ + public void setTradepersoncode(Integer pTradepersoncode) { + this.tradepersoncode = pTradepersoncode; + } + + /** + * Obtiene el valor de tradename + * + * @return valor de tradename + */ + public String getTradename() { + return this.tradename; + } + + /** + * Fija el valor de tradename + * + * @param pTradename nuevo Valor de tradename + */ + public void setTradename(String pTradename) { + this.tradename = pTradename; + } + + /** + * Obtiene el valor de tradephone + * + * @return valor de tradephone + */ + public String getTradephone() { + return this.tradephone; + } + + /** + * Fija el valor de tradephone + * + * @param pTradephone nuevo Valor de tradephone + */ + public void setTradephone(String pTradephone) { + this.tradephone = pTradephone; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPeopleTradereferences)) { + return false; + } + TcustPeopleTradereferences that = (TcustPeopleTradereferences) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustPeopleTradereferences + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustPeopleTradereferences + */ + @Override + public Object createInstance() { + TcustPeopleTradereferences instance = new TcustPeopleTradereferences(); + instance.setPk(new TcustPeopleTradereferencesKey()); + return instance; + } + + /** + * Clona la entidad TcustPeopleTradereferences + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPeopleTradereferences p = (TcustPeopleTradereferences) this.clone(); + p.setPk((TcustPeopleTradereferencesKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleTradereferencesKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleTradereferencesKey.java.svn-base new file mode 100644 index 0000000..ce18acf --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleTradereferencesKey.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLETRADEREFERENCES*/ +@Embeddable +public class TcustPeopleTradereferencesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="TRADESEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de la referencia comercial +*/ +private Integer tradesequence; + +/**Contructor por defecto*/ +public TcustPeopleTradereferencesKey(){} +/**Contructor de TcustPeopleTradereferencesKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pTradesequence Secuencia de la referencia comercial +*/ +public TcustPeopleTradereferencesKey(Integer pPersoncode,Timestamp pDateto,Integer pTradesequence){ + personcode=pPersoncode; + dateto=pDateto; + tradesequence=pTradesequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de tradesequence +@return valor de tradesequence*/ +public Integer getTradesequence(){ + return tradesequence; +} +/**Fija el valor de tradesequence +@param pTradesequence nuevo Valor de tradesequence*/ +public void setTradesequence(Integer pTradesequence){ + tradesequence=pTradesequence; +} + +/**Implementacin de la comparacin de TcustPeopleTradereferencesKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleTradereferencesKey))return false; + TcustPeopleTradereferencesKey that = (TcustPeopleTradereferencesKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getTradesequence() == null || that.getTradesequence() == null){ + return false; + } + if (! this.getTradesequence().equals(that.getTradesequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPeopleTradereferencesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getTradesequence() == null ? 0 : this.getTradesequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleVehicle.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleVehicle.java.svn-base new file mode 100644 index 0000000..24ba3bf --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleVehicle.java.svn-base @@ -0,0 +1,694 @@ +package com.fp.persistence.pcustomer.people; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTPEOPLEVEHICLE + */ +@Entity(name = "TcustPeopleVehicle") +@Table(name = "TCUSTPEOPLEVEHICLE") +public class TcustPeopleVehicle extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustPeopleVehicle + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(VEHICLESEQUENCE),0)+1 from TCUSTPEOPLEVEHICLE where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "vehiclesequence")}) + @GeneratedValue(generator = "seq_id") + private TcustPeopleVehicleKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "VEHICLETYPECATALOG", nullable = true) + /** + * Codigo de catalogo 1 sedan, 2 coupe, 3 camioneta, 4 furgoneta, 5 suv + */ + private String vehicletypecatalog; + @Column(name = "VEHICLETYPECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo VEHICLETYPE tipo de vehiculo + */ + private String vehicletypecatalogcode; + @Column(name = "CARBRANDSCATALOG", nullable = true) + /** + * Codigo de catalogo 1, chevrolet, 2 Bmw, 3 Audi, 4 Ferrari + */ + private String carbrandscatalog; + @Column(name = "CARBRANDSCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo CARBRANDS, marca de auto + */ + private String carbrandscatalogcode; + @Column(name = "MODEL", nullable = true) + /** + * Modelo del vehiculo, ejemplo marca Mazda, modelo 323 + */ + private String model; + @Column(name = "YEAR", nullable = true) + /** + * Anio de fabricacion del vehiculo + */ + private String year; + @Column(name = "MOTORID", nullable = true) + /** + * Numero de motor + */ + private String motorid; + @Column(name = "PLATE", nullable = true) + /** + * Numero de placa + */ + private String plate; + @Column(name = "COLOR", nullable = true) + /** + * Color del vehiculo + */ + private String color; + @Column(name = "ASSESSMENT", nullable = true) + /** + * Avaluo del vehiculo + */ + private BigDecimal assessment; + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + @Column(name = "INPUNTAMOUNT", nullable = true) + /** + * Valor de entrada + */ + private BigDecimal inpuntamount; + @Column(name = "PLEDGEDAMOUNT", nullable = true) + /** + * Valor financiado sobre el cual se constiruye la prenda + */ + private BigDecimal pledgedamount; + @Column(name = "PLEDGEDDATE", nullable = true) + /** + * Saldo del financiamiento + */ + private Date pledgeddate; + @Column(name = "PLEDGEDBALANCE", nullable = true) + /** + * Fecha en la que se ingreso el saldo de la deuda. + */ + private BigDecimal pledgedbalance; + @Column(name = "PLEDGEDPERSONCODE", nullable = true) + /** + * Codigo de persona poseedora de la prena del vehiculo + */ + private Integer pledgedpersoncode; + @Column(name = "PLEDGEDNAME", nullable = true) + /** + * Nombre la entidad beneficiaria de la prenda. + */ + private String pledgedname; + @Column(name = "REMARK", nullable = true) + /** + * Comentario, texto libre. + */ + private String remark; + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String ingressusercode; + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String modifyusercode; + + /** + * Contructor por defecto + */ + public TcustPeopleVehicle() { + } + + /** + * Contructor de TcustPeopleVehicle + * + * @param pPk Clave Primaria del entity + */ + public TcustPeopleVehicle(TcustPeopleVehicleKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPeopleVehicle + */ + public static TcustPeopleVehicle find(EntityManager pEntityManager, TcustPeopleVehicleKey pKey) throws Exception { + TcustPeopleVehicle obj = pEntityManager.find(TcustPeopleVehicle.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPeopleVehicle + * + * @return El objeto que referencia a la Clave primaria de + * TcustPeopleVehicle + */ + public TcustPeopleVehicleKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPeopleVehicle + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustPeopleVehicle + */ + public void setPk(TcustPeopleVehicleKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de vehicletypecatalog + * + * @return valor de vehicletypecatalog + */ + public String getVehicletypecatalog() { + return this.vehicletypecatalog; + } + + /** + * Fija el valor de vehicletypecatalog + * + * @param pVehicletypecatalog nuevo Valor de vehicletypecatalog + */ + public void setVehicletypecatalog(String pVehicletypecatalog) { + this.vehicletypecatalog = pVehicletypecatalog; + } + + /** + * Obtiene el valor de vehicletypecatalogcode + * + * @return valor de vehicletypecatalogcode + */ + public String getVehicletypecatalogcode() { + return this.vehicletypecatalogcode; + } + + /** + * Fija el valor de vehicletypecatalogcode + * + * @param pVehicletypecatalogcode nuevo Valor de vehicletypecatalogcode + */ + public void setVehicletypecatalogcode(String pVehicletypecatalogcode) { + this.vehicletypecatalogcode = pVehicletypecatalogcode; + } + + /** + * Obtiene el valor de carbrandscatalog + * + * @return valor de carbrandscatalog + */ + public String getCarbrandscatalog() { + return this.carbrandscatalog; + } + + /** + * Fija el valor de carbrandscatalog + * + * @param pCarbrandscatalog nuevo Valor de carbrandscatalog + */ + public void setCarbrandscatalog(String pCarbrandscatalog) { + this.carbrandscatalog = pCarbrandscatalog; + } + + /** + * Obtiene el valor de carbrandscatalogcode + * + * @return valor de carbrandscatalogcode + */ + public String getCarbrandscatalogcode() { + return this.carbrandscatalogcode; + } + + /** + * Fija el valor de carbrandscatalogcode + * + * @param pCarbrandscatalogcode nuevo Valor de carbrandscatalogcode + */ + public void setCarbrandscatalogcode(String pCarbrandscatalogcode) { + this.carbrandscatalogcode = pCarbrandscatalogcode; + } + + /** + * Obtiene el valor de model + * + * @return valor de model + */ + public String getModel() { + return this.model; + } + + /** + * Fija el valor de model + * + * @param pModel nuevo Valor de model + */ + public void setModel(String pModel) { + this.model = pModel; + } + + /** + * Obtiene el valor de year + * + * @return valor de year + */ + public String getYear() { + return this.year; + } + + /** + * Fija el valor de year + * + * @param pYear nuevo Valor de year + */ + public void setYear(String pYear) { + this.year = pYear; + } + + /** + * Obtiene el valor de motorid + * + * @return valor de motorid + */ + public String getMotorid() { + return this.motorid; + } + + /** + * Fija el valor de motorid + * + * @param pMotorid nuevo Valor de motorid + */ + public void setMotorid(String pMotorid) { + this.motorid = pMotorid; + } + + /** + * Obtiene el valor de plate + * + * @return valor de plate + */ + public String getPlate() { + return this.plate; + } + + /** + * Fija el valor de plate + * + * @param pPlate nuevo Valor de plate + */ + public void setPlate(String pPlate) { + this.plate = pPlate; + } + + /** + * Obtiene el valor de color + * + * @return valor de color + */ + public String getColor() { + return this.color; + } + + /** + * Fija el valor de color + * + * @param pColor nuevo Valor de color + */ + public void setColor(String pColor) { + this.color = pColor; + } + + /** + * Obtiene el valor de assessment + * + * @return valor de assessment + */ + public BigDecimal getAssessment() { + return this.assessment; + } + + /** + * Fija el valor de assessment + * + * @param pAssessment nuevo Valor de assessment + */ + public void setAssessment(BigDecimal pAssessment) { + this.assessment = pAssessment; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de inpuntamount + * + * @return valor de inpuntamount + */ + public BigDecimal getInpuntamount() { + return this.inpuntamount; + } + + /** + * Fija el valor de inpuntamount + * + * @param pInpuntamount nuevo Valor de inpuntamount + */ + public void setInpuntamount(BigDecimal pInpuntamount) { + this.inpuntamount = pInpuntamount; + } + + /** + * Obtiene el valor de pledgedamount + * + * @return valor de pledgedamount + */ + public BigDecimal getPledgedamount() { + return this.pledgedamount; + } + + /** + * Fija el valor de pledgedamount + * + * @param pPledgedamount nuevo Valor de pledgedamount + */ + public void setPledgedamount(BigDecimal pPledgedamount) { + this.pledgedamount = pPledgedamount; + } + + /** + * Obtiene el valor de pledgeddate + * + * @return valor de pledgeddate + */ + public Date getPledgeddate() { + return this.pledgeddate; + } + + /** + * Fija el valor de pledgeddate + * + * @param pPledgeddate nuevo Valor de pledgeddate + */ + public void setPledgeddate(Date pPledgeddate) { + this.pledgeddate = pPledgeddate; + } + + /** + * Obtiene el valor de pledgedbalance + * + * @return valor de pledgedbalance + */ + public BigDecimal getPledgedbalance() { + return this.pledgedbalance; + } + + /** + * Fija el valor de pledgedbalance + * + * @param pPledgedbalance nuevo Valor de pledgedbalance + */ + public void setPledgedbalance(BigDecimal pPledgedbalance) { + this.pledgedbalance = pPledgedbalance; + } + + /** + * Obtiene el valor de pledgedpersoncode + * + * @return valor de pledgedpersoncode + */ + public Integer getPledgedpersoncode() { + return this.pledgedpersoncode; + } + + /** + * Fija el valor de pledgedpersoncode + * + * @param pPledgedpersoncode nuevo Valor de pledgedpersoncode + */ + public void setPledgedpersoncode(Integer pPledgedpersoncode) { + this.pledgedpersoncode = pPledgedpersoncode; + } + + /** + * Obtiene el valor de pledgedname + * + * @return valor de pledgedname + */ + public String getPledgedname() { + return this.pledgedname; + } + + /** + * Fija el valor de pledgedname + * + * @param pPledgedname nuevo Valor de pledgedname + */ + public void setPledgedname(String pPledgedname) { + this.pledgedname = pPledgedname; + } + + /** + * Obtiene el valor de remark + * + * @return valor de remark + */ + public String getRemark() { + return this.remark; + } + + /** + * Fija el valor de remark + * + * @param pRemark nuevo Valor de remark + */ + public void setRemark(String pRemark) { + this.remark = pRemark; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPeopleVehicle)) { + return false; + } + TcustPeopleVehicle that = (TcustPeopleVehicle) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustPeopleVehicle + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustPeopleVehicle + */ + @Override + public Object createInstance() { + TcustPeopleVehicle instance = new TcustPeopleVehicle(); + instance.setPk(new TcustPeopleVehicleKey()); + return instance; + } + + /** + * Clona la entidad TcustPeopleVehicle + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPeopleVehicle p = (TcustPeopleVehicle) this.clone(); + p.setPk((TcustPeopleVehicleKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleVehicleKey.java.svn-base b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleVehicleKey.java.svn-base new file mode 100644 index 0000000..9441c5a --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/.svn/text-base/TcustPeopleVehicleKey.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLEVEHICLE*/ +@Embeddable +public class TcustPeopleVehicleKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="VEHICLESEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de vehiculo asociado a una persona +*/ +private Integer vehiclesequence; + +/**Contructor por defecto*/ +public TcustPeopleVehicleKey(){} +/**Contructor de TcustPeopleVehicleKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pVehiclesequence Secuencia de vehiculo asociado a una persona +*/ +public TcustPeopleVehicleKey(Integer pPersoncode,Timestamp pDateto,Integer pVehiclesequence){ + personcode=pPersoncode; + dateto=pDateto; + vehiclesequence=pVehiclesequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de vehiclesequence +@return valor de vehiclesequence*/ +public Integer getVehiclesequence(){ + return vehiclesequence; +} +/**Fija el valor de vehiclesequence +@param pVehiclesequence nuevo Valor de vehiclesequence*/ +public void setVehiclesequence(Integer pVehiclesequence){ + vehiclesequence=pVehiclesequence; +} + +/**Implementacin de la comparacin de TcustPeopleVehicleKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleVehicleKey))return false; + TcustPeopleVehicleKey that = (TcustPeopleVehicleKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getVehiclesequence() == null || that.getVehiclesequence() == null){ + return false; + } + if (! this.getVehiclesequence().equals(that.getVehiclesequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPeopleVehicleKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getVehiclesequence() == null ? 0 : this.getVehiclesequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeople.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeople.java new file mode 100644 index 0000000..3385ff1 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeople.java @@ -0,0 +1,652 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import com.fp.dto.hb.Log; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import javax.persistence.Entity; +import javax.persistence.EmbeddedId; +import javax.persistence.EntityManager; +import javax.persistence.Column; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPEOPLE*/ +@Entity(name="TcustPeople") +@Table(name="TCUSTPEOPLE") +public class TcustPeople extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TcustPeople +*/ +@EmbeddedId +private TcustPeopleKey pk; +@Column(name="DATEFROM", nullable=true) + +/** +* Fecha desde la cual esta vigente el registro +*/ +private Timestamp datefrom; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="LASTNAME", nullable=true) + +/** +* Primer apellido +*/ +private String lastname; + +@Column(name="SURENAME", nullable=true) + +/** +* Segundo apellido +*/ +private String surename; + +@Column(name="FIRSTNAME", nullable=true) + +/** +* Primer Nombre +*/ +private String firstname; + +@Column(name="MIDDLENAME", nullable=true) + +/** +* Segundo Nombre +*/ +private String middlename; + +@Column(name="MARITALNAME", nullable=true) + +/** +* Apellido de casada +*/ +private String maritalname; + +@Column(name="GENDER", nullable=true) + +/** +* Gnero +*/ +private String gender; + +@Column(name="BIRTHDATE", nullable=true) + +/** +* Fecha de Nacimiento +*/ +private Date birthdate; + +@Column(name="MARITALSTATUSCATALOG", nullable=true) + +/** +* Codigo de catalogo de estados civiles, 1 soltero, 2 casado, +*/ +private String maritalstatuscatalog; + +@Column(name="MARITALSTATUSCATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo de estado civil MARITALSTATUS +*/ +private String maritalstatuscatalogcode; + +@Column(name="PROFESSIONCATALOG", nullable=true) + +/** +* Codigo de catalogo de profesiones 1, an=bogado, 2 doctor +*/ +private String professioncatalog; + +@Column(name="PROFESSIONCATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo de profesiones PROFESSION +*/ +private String professioncatalogcode; + +@Column(name="EDUCATIONLEVELCATALOG", nullable=true) + +/** +* Codigo de catalogo del nivel de educacion 1, basica, 2 superior +*/ +private String educationlevelcatalog; + +@Column(name="EDUCATIONLEVELCATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo del nivel de educacion EDUCATIONLEVEL +*/ +private String educationlevelcatalogcode; + +@Column(name="BIRTHCOUNTRYCODE", nullable=true) + +/** +* Codigo de pas de nacimiento +*/ +private String birthcountrycode; + +@Column(name="BIRTHPROVINCECODE", nullable=true) + +/** +* Codigo de provincia de nacimiento +*/ +private String birthprovincecode; + +@Column(name="BIRTHCANTONCODE", nullable=true) + +/** +* Codigo de canton +*/ +private String birthcantoncode; + +@Column(name="BIRTHCITYCODE", nullable=true) + +/** +* Codigo de cuidad de nacimiento +*/ +private String birthcitycode; + +@Column(name="SIGNATURECODE", nullable=true) + +/** +* Codigo de imagen de la firma del cliente. +*/ +private Integer signaturecode; + +@Column(name="PHOTOCODE", nullable=true) + +/** +* Codigo de imagen de la foto del cliente. +*/ +private Integer photocode; + +@Column(name="INGRESSUSERCODE", nullable=true) + +/** +* Codigo de usuario +*/ +private String ingressusercode; + +@Column(name="MODIFYUSERCODE", nullable=true) + +/** +* Codigo de usuario +*/ +private String modifyusercode; + +@Column(name="NACIONALITY", nullable=true) + +/** +* Nacionalidad de la persona +*/ +private String nacionality; + +@Column(name="NOTACTIVITYCATALOG", nullable=true) + +/** +* Actividad no economica Estudiante, Jubilado, Ama de casa +*/ +private String notactivitycatalog; + +@Column(name="NOTACTIVITYCATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo NOTACTIVITYEC Actividad no economica +*/ +private String notactivitycatalogcode; + +@Column(name="CODIGOSIB", nullable=true) + +/** +* Codigo de la SIB +*/ +private Integer codigosib; + +@Column(name="BIRTHPARROQUIACODE", nullable=true) + +/** +* Codigo de parroquia de nacimiento +*/ +private String birthparroquiacode; + +@Column(name="HEIGHT", nullable=true) + +/** +* null +*/ +private BigDecimal height; + +/**Contructor por defecto*/ +public TcustPeople(){ +} +/**Contructor de TcustPeople +@param pPk Clave Primaria del entity +*/ +public TcustPeople(TcustPeopleKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TcustPeople +*/ +public static TcustPeople find(EntityManager pEntityManager,TcustPeopleKey pKey) throws Exception{ + TcustPeople obj = pEntityManager.find(TcustPeople.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TcustPeople +@return El objeto que referencia a la Clave primaria de TcustPeople +*/ +public TcustPeopleKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TcustPeople +@param pPk El objeto que referencia a la nueva Clave primaria de TcustPeople +*/ +public void setPk(TcustPeopleKey pPk){ + pk=pPk; +} +/**Obtiene el valor de datefrom +@return valor de datefrom*/ +public Timestamp getDatefrom(){ + return datefrom; +} +/**Fija el valor de datefrom +@param pDatefrom nuevo Valor de datefrom*/ +public void setDatefrom(Timestamp pDatefrom){ + datefrom=pDatefrom; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de lastname +@return valor de lastname*/ +public String getLastname(){ + return lastname; +} +/**Fija el valor de lastname +@param pLastname nuevo Valor de lastname*/ +public void setLastname(String pLastname){ + lastname=pLastname; +} + +/**Obtiene el valor de surename +@return valor de surename*/ +public String getSurename(){ + return surename; +} +/**Fija el valor de surename +@param pSurename nuevo Valor de surename*/ +public void setSurename(String pSurename){ + surename=pSurename; +} + +/**Obtiene el valor de firstname +@return valor de firstname*/ +public String getFirstname(){ + return firstname; +} +/**Fija el valor de firstname +@param pFirstname nuevo Valor de firstname*/ +public void setFirstname(String pFirstname){ + firstname=pFirstname; +} + +/**Obtiene el valor de middlename +@return valor de middlename*/ +public String getMiddlename(){ + return middlename; +} +/**Fija el valor de middlename +@param pMiddlename nuevo Valor de middlename*/ +public void setMiddlename(String pMiddlename){ + middlename=pMiddlename; +} + +/**Obtiene el valor de maritalname +@return valor de maritalname*/ +public String getMaritalname(){ + return maritalname; +} +/**Fija el valor de maritalname +@param pMaritalname nuevo Valor de maritalname*/ +public void setMaritalname(String pMaritalname){ + maritalname=pMaritalname; +} + +/**Obtiene el valor de gender +@return valor de gender*/ +public String getGender(){ + return gender; +} +/**Fija el valor de gender +@param pGender nuevo Valor de gender*/ +public void setGender(String pGender){ + gender=pGender; +} + +/**Obtiene el valor de birthdate +@return valor de birthdate*/ +public Date getBirthdate(){ + return birthdate; +} +/**Fija el valor de birthdate +@param pBirthdate nuevo Valor de birthdate*/ +public void setBirthdate(Date pBirthdate){ + birthdate=pBirthdate; +} + +/**Obtiene el valor de maritalstatuscatalog +@return valor de maritalstatuscatalog*/ +public String getMaritalstatuscatalog(){ + return maritalstatuscatalog; +} +/**Fija el valor de maritalstatuscatalog +@param pMaritalstatuscatalog nuevo Valor de maritalstatuscatalog*/ +public void setMaritalstatuscatalog(String pMaritalstatuscatalog){ + maritalstatuscatalog=pMaritalstatuscatalog; +} + +/**Obtiene el valor de maritalstatuscatalogcode +@return valor de maritalstatuscatalogcode*/ +public String getMaritalstatuscatalogcode(){ + return maritalstatuscatalogcode; +} +/**Fija el valor de maritalstatuscatalogcode +@param pMaritalstatuscatalogcode nuevo Valor de maritalstatuscatalogcode*/ +public void setMaritalstatuscatalogcode(String pMaritalstatuscatalogcode){ + maritalstatuscatalogcode=pMaritalstatuscatalogcode; +} + +/**Obtiene el valor de professioncatalog +@return valor de professioncatalog*/ +public String getProfessioncatalog(){ + return professioncatalog; +} +/**Fija el valor de professioncatalog +@param pProfessioncatalog nuevo Valor de professioncatalog*/ +public void setProfessioncatalog(String pProfessioncatalog){ + professioncatalog=pProfessioncatalog; +} + +/**Obtiene el valor de professioncatalogcode +@return valor de professioncatalogcode*/ +public String getProfessioncatalogcode(){ + return professioncatalogcode; +} +/**Fija el valor de professioncatalogcode +@param pProfessioncatalogcode nuevo Valor de professioncatalogcode*/ +public void setProfessioncatalogcode(String pProfessioncatalogcode){ + professioncatalogcode=pProfessioncatalogcode; +} + +/**Obtiene el valor de educationlevelcatalog +@return valor de educationlevelcatalog*/ +public String getEducationlevelcatalog(){ + return educationlevelcatalog; +} +/**Fija el valor de educationlevelcatalog +@param pEducationlevelcatalog nuevo Valor de educationlevelcatalog*/ +public void setEducationlevelcatalog(String pEducationlevelcatalog){ + educationlevelcatalog=pEducationlevelcatalog; +} + +/**Obtiene el valor de educationlevelcatalogcode +@return valor de educationlevelcatalogcode*/ +public String getEducationlevelcatalogcode(){ + return educationlevelcatalogcode; +} +/**Fija el valor de educationlevelcatalogcode +@param pEducationlevelcatalogcode nuevo Valor de educationlevelcatalogcode*/ +public void setEducationlevelcatalogcode(String pEducationlevelcatalogcode){ + educationlevelcatalogcode=pEducationlevelcatalogcode; +} + +/**Obtiene el valor de birthcountrycode +@return valor de birthcountrycode*/ +public String getBirthcountrycode(){ + return birthcountrycode; +} +/**Fija el valor de birthcountrycode +@param pBirthcountrycode nuevo Valor de birthcountrycode*/ +public void setBirthcountrycode(String pBirthcountrycode){ + birthcountrycode=pBirthcountrycode; +} + +/**Obtiene el valor de birthprovincecode +@return valor de birthprovincecode*/ +public String getBirthprovincecode(){ + return birthprovincecode; +} +/**Fija el valor de birthprovincecode +@param pBirthprovincecode nuevo Valor de birthprovincecode*/ +public void setBirthprovincecode(String pBirthprovincecode){ + birthprovincecode=pBirthprovincecode; +} + +/**Obtiene el valor de birthcantoncode +@return valor de birthcantoncode*/ +public String getBirthcantoncode(){ + return birthcantoncode; +} +/**Fija el valor de birthcantoncode +@param pBirthcantoncode nuevo Valor de birthcantoncode*/ +public void setBirthcantoncode(String pBirthcantoncode){ + birthcantoncode=pBirthcantoncode; +} + +/**Obtiene el valor de birthcitycode +@return valor de birthcitycode*/ +public String getBirthcitycode(){ + return birthcitycode; +} +/**Fija el valor de birthcitycode +@param pBirthcitycode nuevo Valor de birthcitycode*/ +public void setBirthcitycode(String pBirthcitycode){ + birthcitycode=pBirthcitycode; +} + +/**Obtiene el valor de signaturecode +@return valor de signaturecode*/ +public Integer getSignaturecode(){ + return signaturecode; +} +/**Fija el valor de signaturecode +@param pSignaturecode nuevo Valor de signaturecode*/ +public void setSignaturecode(Integer pSignaturecode){ + signaturecode=pSignaturecode; +} + +/**Obtiene el valor de photocode +@return valor de photocode*/ +public Integer getPhotocode(){ + return photocode; +} +/**Fija el valor de photocode +@param pPhotocode nuevo Valor de photocode*/ +public void setPhotocode(Integer pPhotocode){ + photocode=pPhotocode; +} + +/**Obtiene el valor de ingressusercode +@return valor de ingressusercode*/ +public String getIngressusercode(){ + return ingressusercode; +} +/**Fija el valor de ingressusercode +@param pIngressusercode nuevo Valor de ingressusercode*/ +public void setIngressusercode(String pIngressusercode){ + ingressusercode=pIngressusercode; +} + +/**Obtiene el valor de modifyusercode +@return valor de modifyusercode*/ +public String getModifyusercode(){ + return modifyusercode; +} +/**Fija el valor de modifyusercode +@param pModifyusercode nuevo Valor de modifyusercode*/ +public void setModifyusercode(String pModifyusercode){ + modifyusercode=pModifyusercode; +} + +/**Obtiene el valor de nacionality +@return valor de nacionality*/ +public String getNacionality(){ + return nacionality; +} +/**Fija el valor de nacionality +@param pNacionality nuevo Valor de nacionality*/ +public void setNacionality(String pNacionality){ + nacionality=pNacionality; +} + +/**Obtiene el valor de notactivitycatalog +@return valor de notactivitycatalog*/ +public String getNotactivitycatalog(){ + return notactivitycatalog; +} +/**Fija el valor de notactivitycatalog +@param pNotactivitycatalog nuevo Valor de notactivitycatalog*/ +public void setNotactivitycatalog(String pNotactivitycatalog){ + notactivitycatalog=pNotactivitycatalog; +} + +/**Obtiene el valor de notactivitycatalogcode +@return valor de notactivitycatalogcode*/ +public String getNotactivitycatalogcode(){ + return notactivitycatalogcode; +} +/**Fija el valor de notactivitycatalogcode +@param pNotactivitycatalogcode nuevo Valor de notactivitycatalogcode*/ +public void setNotactivitycatalogcode(String pNotactivitycatalogcode){ + notactivitycatalogcode=pNotactivitycatalogcode; +} + +/**Obtiene el valor de codigosib +@return valor de codigosib*/ +public Integer getCodigosib(){ + return codigosib; +} +/**Fija el valor de codigosib +@param pCodigosib nuevo Valor de codigosib*/ +public void setCodigosib(Integer pCodigosib){ + codigosib=pCodigosib; +} + +/**Obtiene el valor de birthparroquiacode +@return valor de birthparroquiacode*/ +public String getBirthparroquiacode(){ + return birthparroquiacode; +} +/**Fija el valor de birthparroquiacode +@param pBirthparroquiacode nuevo Valor de birthparroquiacode*/ +public void setBirthparroquiacode(String pBirthparroquiacode){ + birthparroquiacode=pBirthparroquiacode; +} + +/**Obtiene el valor de height +@return valor de height*/ +public BigDecimal getHeight(){ + return height; +} +/**Fija el valor de height +@param pHeight nuevo Valor de height*/ +public void setHeight(BigDecimal pHeight){ + height=pHeight; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TcustPeople))return false; + TcustPeople that = (TcustPeople) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TcustPeople +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TcustPeople +*/ +public Object createInstance(){ + TcustPeople instance=new TcustPeople(); + instance.setPk(new TcustPeopleKey()); + return instance; +} +/**Clona la entidad TcustPeople +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TcustPeople p=(TcustPeople)this.clone(); + p.setPk((TcustPeopleKey)this.pk.cloneMe()); + return p; +} +public Object getId() { + return this.pk; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleAditionalData.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleAditionalData.java new file mode 100644 index 0000000..f9dcbe8 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleAditionalData.java @@ -0,0 +1,435 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import com.fp.dto.hb.Log; +import java.io.Serializable; +import javax.persistence.Table; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import javax.persistence.Entity; +import javax.persistence.EmbeddedId; +import javax.persistence.EntityManager; +import javax.persistence.Column; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPEOPLEADITIONALDATA*/ +@Entity(name="TcustPeopleAditionalData") +@Table(name="TCUSTPEOPLEADITIONALDATA") +public class TcustPeopleAditionalData extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TcustPeopleAditionalData +*/ +@EmbeddedId +private TcustPeopleAditionalDataKey pk; +@Column(name="DATEFROM", nullable=true) + +/** +* Fecha desde la cual esta vigente el registro +*/ +private Timestamp datefrom; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="HOMETYPECATALOG", nullable=true) + +/** +* Codigo de catalogo P Propia, A alquidada, F familiares +*/ +private String hometypecatalog; + +@Column(name="HOMETYPECATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo HOMETYPE tipo de vivienda. +*/ +private String hometypecatalogcode; + +@Column(name="IDENTIFICATIONCATALOG", nullable=true) + +/** +* Codigo de catalogo CED cedula, RUC ruc identificacion adicional del cliente. +*/ +private String identificationcatalog; + +@Column(name="IDENTIFICATIONCATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo IDENTIFICATION tipo de identificacion +*/ +private String identificationcatalogcode; + +@Column(name="IDENTIFICATION", nullable=true) + +/** +* Numero de cedula, ruc, pasaporte, etc.. +*/ +private String identification; + +@Column(name="JOBRELATIONSHIPCATALOG", nullable=true) + +/** +* Codigo de catalogo 1 dependiente, 2 Independiente, 3 jubilado +*/ +private String jobrelationshipcatalog; + +@Column(name="JOBRELATIONSHIPCATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo JOBRELATIONSHIP relacion labolar +*/ +private String jobrelationshipcatalogcode; + +@Column(name="WORKERSNUMBER", nullable=true) + +/** +* Numero de empledos. +*/ +private Integer workersnumber; + +@Column(name="DEPENDENTSNUMBER", nullable=true) + +/** +* Numero de dependientes. +*/ +private Integer dependentsnumber; + +@Column(name="INGRESSUSERCODE", nullable=true) + +/** +* Codigo de usuario +*/ +private String ingressusercode; + +@Column(name="MODIFYUSERCODE", nullable=true) + +/** +* Codigo de usuario +*/ +private String modifyusercode; + +@Column(name="HOMEVALUE", nullable=true) + +/** +* Valor de la vivienda +*/ +private BigDecimal homevalue; + +@Column(name="HOMERESIDENCETIME", nullable=true) + +/** +* Aos de residencia en la vivienda actual +*/ +private Integer homeresidencetime; + +@Column(name="MAINSOURCEINCOMECATALOG", nullable=true) + +/** +* null +*/ +private String mainsourceincomecatalog; + +@Column(name="MAINSOURCEINCOMECATALOGCODE", nullable=true) + +/** +* null +*/ +private String mainsourceincomecatalogcode; + +/**Contructor por defecto*/ +public TcustPeopleAditionalData(){ +} +/**Contructor de TcustPeopleAditionalData +@param pPk Clave Primaria del entity +*/ +public TcustPeopleAditionalData(TcustPeopleAditionalDataKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TcustPeopleAditionalData +*/ +public static TcustPeopleAditionalData find(EntityManager pEntityManager,TcustPeopleAditionalDataKey pKey) throws Exception{ + TcustPeopleAditionalData obj = pEntityManager.find(TcustPeopleAditionalData.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TcustPeopleAditionalData +@return El objeto que referencia a la Clave primaria de TcustPeopleAditionalData +*/ +public TcustPeopleAditionalDataKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TcustPeopleAditionalData +@param pPk El objeto que referencia a la nueva Clave primaria de TcustPeopleAditionalData +*/ +public void setPk(TcustPeopleAditionalDataKey pPk){ + pk=pPk; +} +/**Obtiene el valor de datefrom +@return valor de datefrom*/ +public Timestamp getDatefrom(){ + return datefrom; +} +/**Fija el valor de datefrom +@param pDatefrom nuevo Valor de datefrom*/ +public void setDatefrom(Timestamp pDatefrom){ + datefrom=pDatefrom; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de hometypecatalog +@return valor de hometypecatalog*/ +public String getHometypecatalog(){ + return hometypecatalog; +} +/**Fija el valor de hometypecatalog +@param pHometypecatalog nuevo Valor de hometypecatalog*/ +public void setHometypecatalog(String pHometypecatalog){ + hometypecatalog=pHometypecatalog; +} + +/**Obtiene el valor de hometypecatalogcode +@return valor de hometypecatalogcode*/ +public String getHometypecatalogcode(){ + return hometypecatalogcode; +} +/**Fija el valor de hometypecatalogcode +@param pHometypecatalogcode nuevo Valor de hometypecatalogcode*/ +public void setHometypecatalogcode(String pHometypecatalogcode){ + hometypecatalogcode=pHometypecatalogcode; +} + +/**Obtiene el valor de identificationcatalog +@return valor de identificationcatalog*/ +public String getIdentificationcatalog(){ + return identificationcatalog; +} +/**Fija el valor de identificationcatalog +@param pIdentificationcatalog nuevo Valor de identificationcatalog*/ +public void setIdentificationcatalog(String pIdentificationcatalog){ + identificationcatalog=pIdentificationcatalog; +} + +/**Obtiene el valor de identificationcatalogcode +@return valor de identificationcatalogcode*/ +public String getIdentificationcatalogcode(){ + return identificationcatalogcode; +} +/**Fija el valor de identificationcatalogcode +@param pIdentificationcatalogcode nuevo Valor de identificationcatalogcode*/ +public void setIdentificationcatalogcode(String pIdentificationcatalogcode){ + identificationcatalogcode=pIdentificationcatalogcode; +} + +/**Obtiene el valor de identification +@return valor de identification*/ +public String getIdentification(){ + return identification; +} +/**Fija el valor de identification +@param pIdentification nuevo Valor de identification*/ +public void setIdentification(String pIdentification){ + identification=pIdentification; +} + +/**Obtiene el valor de jobrelationshipcatalog +@return valor de jobrelationshipcatalog*/ +public String getJobrelationshipcatalog(){ + return jobrelationshipcatalog; +} +/**Fija el valor de jobrelationshipcatalog +@param pJobrelationshipcatalog nuevo Valor de jobrelationshipcatalog*/ +public void setJobrelationshipcatalog(String pJobrelationshipcatalog){ + jobrelationshipcatalog=pJobrelationshipcatalog; +} + +/**Obtiene el valor de jobrelationshipcatalogcode +@return valor de jobrelationshipcatalogcode*/ +public String getJobrelationshipcatalogcode(){ + return jobrelationshipcatalogcode; +} +/**Fija el valor de jobrelationshipcatalogcode +@param pJobrelationshipcatalogcode nuevo Valor de jobrelationshipcatalogcode*/ +public void setJobrelationshipcatalogcode(String pJobrelationshipcatalogcode){ + jobrelationshipcatalogcode=pJobrelationshipcatalogcode; +} + +/**Obtiene el valor de workersnumber +@return valor de workersnumber*/ +public Integer getWorkersnumber(){ + return workersnumber; +} +/**Fija el valor de workersnumber +@param pWorkersnumber nuevo Valor de workersnumber*/ +public void setWorkersnumber(Integer pWorkersnumber){ + workersnumber=pWorkersnumber; +} + +/**Obtiene el valor de dependentsnumber +@return valor de dependentsnumber*/ +public Integer getDependentsnumber(){ + return dependentsnumber; +} +/**Fija el valor de dependentsnumber +@param pDependentsnumber nuevo Valor de dependentsnumber*/ +public void setDependentsnumber(Integer pDependentsnumber){ + dependentsnumber=pDependentsnumber; +} + +/**Obtiene el valor de ingressusercode +@return valor de ingressusercode*/ +public String getIngressusercode(){ + return ingressusercode; +} +/**Fija el valor de ingressusercode +@param pIngressusercode nuevo Valor de ingressusercode*/ +public void setIngressusercode(String pIngressusercode){ + ingressusercode=pIngressusercode; +} + +/**Obtiene el valor de modifyusercode +@return valor de modifyusercode*/ +public String getModifyusercode(){ + return modifyusercode; +} +/**Fija el valor de modifyusercode +@param pModifyusercode nuevo Valor de modifyusercode*/ +public void setModifyusercode(String pModifyusercode){ + modifyusercode=pModifyusercode; +} + +/**Obtiene el valor de homevalue +@return valor de homevalue*/ +public BigDecimal getHomevalue(){ + return homevalue; +} +/**Fija el valor de homevalue +@param pHomevalue nuevo Valor de homevalue*/ +public void setHomevalue(BigDecimal pHomevalue){ + homevalue=pHomevalue; +} + +/**Obtiene el valor de homeresidencetime +@return valor de homeresidencetime*/ +public Integer getHomeresidencetime(){ + return homeresidencetime; +} +/**Fija el valor de homeresidencetime +@param pHomeresidencetime nuevo Valor de homeresidencetime*/ +public void setHomeresidencetime(Integer pHomeresidencetime){ + homeresidencetime=pHomeresidencetime; +} + +/**Obtiene el valor de mainsourceincomecatalog +@return valor de mainsourceincomecatalog*/ +public String getMainsourceincomecatalog(){ + return mainsourceincomecatalog; +} +/**Fija el valor de mainsourceincomecatalog +@param pMainsourceincomecatalog nuevo Valor de mainsourceincomecatalog*/ +public void setMainsourceincomecatalog(String pMainsourceincomecatalog){ + mainsourceincomecatalog=pMainsourceincomecatalog; +} + +/**Obtiene el valor de mainsourceincomecatalogcode +@return valor de mainsourceincomecatalogcode*/ +public String getMainsourceincomecatalogcode(){ + return mainsourceincomecatalogcode; +} +/**Fija el valor de mainsourceincomecatalogcode +@param pMainsourceincomecatalogcode nuevo Valor de mainsourceincomecatalogcode*/ +public void setMainsourceincomecatalogcode(String pMainsourceincomecatalogcode){ + mainsourceincomecatalogcode=pMainsourceincomecatalogcode; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TcustPeopleAditionalData))return false; + TcustPeopleAditionalData that = (TcustPeopleAditionalData) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TcustPeopleAditionalData +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TcustPeopleAditionalData +*/ +public Object createInstance(){ + TcustPeopleAditionalData instance=new TcustPeopleAditionalData(); + instance.setPk(new TcustPeopleAditionalDataKey()); + return instance; +} +/**Clona la entidad TcustPeopleAditionalData +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TcustPeopleAditionalData p=(TcustPeopleAditionalData)this.clone(); + p.setPk((TcustPeopleAditionalDataKey)this.pk.cloneMe()); + return p; +} +public Object getId() { + return this.pk; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleAditionalDataKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleAditionalDataKey.java new file mode 100644 index 0000000..83fc268 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleAditionalDataKey.java @@ -0,0 +1,129 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLEADITIONALDATA*/ +@Embeddable +public class TcustPeopleAditionalDataKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TcustPeopleAditionalDataKey(){} +/**Contructor de TcustPeopleAditionalDataKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +*/ +public TcustPeopleAditionalDataKey(Integer pPersoncode,Timestamp pDateto){ + personcode=pPersoncode; + dateto=pDateto; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacion de la comparacion de TcustPeopleAditionalDataKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleAditionalDataKey))return false; + TcustPeopleAditionalDataKey that = (TcustPeopleAditionalDataKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TcustPeopleAditionalDataKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleAssociation.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleAssociation.java new file mode 100644 index 0000000..4e52229 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleAssociation.java @@ -0,0 +1,352 @@ +package com.fp.persistence.pcustomer.people; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPEOPLEASSOCIATION + */ +@Entity(name = "TcustPeopleAssociation") +@Table(name = "TCUSTPEOPLEASSOCIATION") +public class TcustPeopleAssociation extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TcustPeopleAssociation + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(ASSOCIATIONSEQUENCE),0)+1 from TCUSTPEOPLEASSOCIATION where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "associationsequence") }) + @GeneratedValue(generator = "seq_id") + private TcustPeopleAssociationKey pk; + + @Column(name = "ASSOCIATIONPERSONCODE", nullable = true) + /** + * Codigo de persona asiganado a la asociacion + */ + private Integer associationpersoncode; + + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "ASSOCIATIONNAME", nullable = true) + /** + * Nombre de la asociacion cuando no esta definida como una persona + */ + private String associationname; + + @Column(name = "ASSOCIATIONCODE", nullable = true) + /** + * Codigo de registro o de asociacion de la persona + */ + private String associationcode; + + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que crea el cliente + */ + private String ingressuser; + + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifica datos del cliente + */ + private String modifyuser; + + /** + * Contructor por defecto + */ + public TcustPeopleAssociation() { + } + + /** + * Contructor de TcustPeopleAssociation + * + * @param pPk Clave Primaria del entity + */ + public TcustPeopleAssociation(TcustPeopleAssociationKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPeopleAssociation + */ + public static TcustPeopleAssociation find(EntityManager pEntityManager, TcustPeopleAssociationKey pKey) throws Exception { + TcustPeopleAssociation obj = pEntityManager.find(TcustPeopleAssociation.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPeopleAssociation + * + * @return El objeto que referencia a la Clave primaria de TcustPeopleAssociation + */ + public TcustPeopleAssociationKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPeopleAssociation + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TcustPeopleAssociation + */ + public void setPk(TcustPeopleAssociationKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de associationpersoncode + * + * @return valor de associationpersoncode + */ + public Integer getAssociationpersoncode() { + return this.associationpersoncode; + } + + /** + * Fija el valor de associationpersoncode + * + * @param pAssociationpersoncode nuevo Valor de associationpersoncode + */ + public void setAssociationpersoncode(Integer pAssociationpersoncode) { + this.associationpersoncode = pAssociationpersoncode; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de associationname + * + * @return valor de associationname + */ + public String getAssociationname() { + return this.associationname; + } + + /** + * Fija el valor de associationname + * + * @param pAssociationname nuevo Valor de associationname + */ + public void setAssociationname(String pAssociationname) { + this.associationname = pAssociationname; + } + + /** + * Obtiene el valor de associationcode + * + * @return valor de associationcode + */ + public String getAssociationcode() { + return this.associationcode; + } + + /** + * Fija el valor de associationcode + * + * @param pAssociationcode nuevo Valor de associationcode + */ + public void setAssociationcode(String pAssociationcode) { + this.associationcode = pAssociationcode; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return this.ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + this.ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return this.modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + this.modifyuser = pModifyuser; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPeopleAssociation)) { + return false; + } + TcustPeopleAssociation that = (TcustPeopleAssociation) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustPeopleAssociation + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustPeopleAssociation + */ + @Override + public Object createInstance() { + TcustPeopleAssociation instance = new TcustPeopleAssociation(); + instance.setPk(new TcustPeopleAssociationKey()); + return instance; + } + + /** + * Clona la entidad TcustPeopleAssociation + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPeopleAssociation p = (TcustPeopleAssociation) this.clone(); + p.setPk((TcustPeopleAssociationKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleAssociationKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleAssociationKey.java new file mode 100644 index 0000000..3da3528 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleAssociationKey.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLEASSOCIATION*/ +@Embeddable +public class TcustPeopleAssociationKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="ASSOCIATIONSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de asociacion de la persona +*/ +private Integer associationsequence; + +/**Contructor por defecto*/ +public TcustPeopleAssociationKey(){} +/**Contructor de TcustPeopleAssociationKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pAssociationsequence Secuencia de asociacion de la persona +*/ +public TcustPeopleAssociationKey(Integer pPersoncode,Timestamp pDateto,Integer pAssociationsequence){ + personcode=pPersoncode; + dateto=pDateto; + associationsequence=pAssociationsequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de associationsequence +@return valor de associationsequence*/ +public Integer getAssociationsequence(){ + return associationsequence; +} +/**Fija el valor de associationsequence +@param pAssociationsequence nuevo Valor de associationsequence*/ +public void setAssociationsequence(Integer pAssociationsequence){ + associationsequence=pAssociationsequence; +} + +/**Implementacin de la comparacin de TcustPeopleAssociationKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleAssociationKey))return false; + TcustPeopleAssociationKey that = (TcustPeopleAssociationKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getAssociationsequence() == null || that.getAssociationsequence() == null){ + return false; + } + if (! this.getAssociationsequence().equals(that.getAssociationsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPeopleAssociationKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getAssociationsequence() == null ? 0 : this.getAssociationsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleExpenses.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleExpenses.java new file mode 100644 index 0000000..fd34ffc --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleExpenses.java @@ -0,0 +1,419 @@ +package com.fp.persistence.pcustomer.people; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTPEOPLEEXPENSES + */ +@Entity(name = "TcustPeopleExpenses") +@Table(name = "TCUSTPEOPLEEXPENSES") +public class TcustPeopleExpenses extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustPeopleExpenses + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(EXPENSESEQUENCE),0)+1 from TCUSTPEOPLEEXPENSES where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "expensesequence")}) + @GeneratedValue(generator = "seq_id") + private TcustPeopleExpensesKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "EXPENSESCATALOG", nullable = true) + /** + * Codigo de catalogo de gastos 1 alimentacion, 2 cuota prestamos, 3 + * alimentacion + */ + private String expensescatalog; + @Column(name = "EXPENSESCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo EXPENSES + */ + private String expensescatalogcode; + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + @Column(name = "AMOUNT", nullable = true) + /** + * Valor del gasto mensual + */ + private BigDecimal amount; + @Column(name = "ISFIXVALUE", nullable = true) + /** + * Y indica que un valor de gasto fijo, N no es un gasto fijo + */ + private String isfixvalue; + @Column(name = "VERIFIEDAMOUNT", nullable = true) + /** + * Monto verificado por una persona de la institucion financiera + */ + private BigDecimal verifiedamount; + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String ingressusercode; + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String modifyusercode; + + /** + * Contructor por defecto + */ + public TcustPeopleExpenses() { + } + + /** + * Contructor de TcustPeopleExpenses + * + * @param pPk Clave Primaria del entity + */ + public TcustPeopleExpenses(TcustPeopleExpensesKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPeopleExpenses + */ + public static TcustPeopleExpenses find(EntityManager pEntityManager, TcustPeopleExpensesKey pKey) throws Exception { + TcustPeopleExpenses obj = pEntityManager.find(TcustPeopleExpenses.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPeopleExpenses + * + * @return El objeto que referencia a la Clave primaria de + * TcustPeopleExpenses + */ + public TcustPeopleExpensesKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPeopleExpenses + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustPeopleExpenses + */ + public void setPk(TcustPeopleExpensesKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de expensescatalog + * + * @return valor de expensescatalog + */ + public String getExpensescatalog() { + return this.expensescatalog; + } + + /** + * Fija el valor de expensescatalog + * + * @param pExpensescatalog nuevo Valor de expensescatalog + */ + public void setExpensescatalog(String pExpensescatalog) { + this.expensescatalog = pExpensescatalog; + } + + /** + * Obtiene el valor de expensescatalogcode + * + * @return valor de expensescatalogcode + */ + public String getExpensescatalogcode() { + return this.expensescatalogcode; + } + + /** + * Fija el valor de expensescatalogcode + * + * @param pExpensescatalogcode nuevo Valor de expensescatalogcode + */ + public void setExpensescatalogcode(String pExpensescatalogcode) { + this.expensescatalogcode = pExpensescatalogcode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de amount + * + * @return valor de amount + */ + public BigDecimal getAmount() { + return this.amount; + } + + /** + * Fija el valor de amount + * + * @param pAmount nuevo Valor de amount + */ + public void setAmount(BigDecimal pAmount) { + this.amount = pAmount; + } + + /** + * Obtiene el valor de isfixvalue + * + * @return valor de isfixvalue + */ + public String getIsfixvalue() { + return this.isfixvalue; + } + + /** + * Fija el valor de isfixvalue + * + * @param pIsfixvalue nuevo Valor de isfixvalue + */ + public void setIsfixvalue(String pIsfixvalue) { + this.isfixvalue = pIsfixvalue; + } + + /** + * Obtiene el valor de verifiedamount + * + * @return valor de verifiedamount + */ + public BigDecimal getVerifiedamount() { + return this.verifiedamount; + } + + /** + * Fija el valor de verifiedamount + * + * @param pVerifiedamount nuevo Valor de verifiedamount + */ + public void setVerifiedamount(BigDecimal pVerifiedamount) { + this.verifiedamount = pVerifiedamount; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPeopleExpenses)) { + return false; + } + TcustPeopleExpenses that = (TcustPeopleExpenses) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustPeopleExpenses + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco + * TcustPeopleExpenses + */ + @Override + public Object createInstance() { + TcustPeopleExpenses instance = new TcustPeopleExpenses(); + instance.setPk(new TcustPeopleExpensesKey()); + return instance; + } + + /** + * Clona la entidad TcustPeopleExpenses + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPeopleExpenses p = (TcustPeopleExpenses) this.clone(); + p.setPk((TcustPeopleExpensesKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleExpensesKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleExpensesKey.java new file mode 100644 index 0000000..6848a8f --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleExpensesKey.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLEEXPENSES*/ +@Embeddable +public class TcustPeopleExpensesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="EXPENSESEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del gasto de la persona +*/ +private Integer expensesequence; + +/**Contructor por defecto*/ +public TcustPeopleExpensesKey(){} +/**Contructor de TcustPeopleExpensesKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pExpensesequence Secuencia del gasto de la persona +*/ +public TcustPeopleExpensesKey(Integer pPersoncode,Timestamp pDateto,Integer pExpensesequence){ + personcode=pPersoncode; + dateto=pDateto; + expensesequence=pExpensesequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de expensesequence +@return valor de expensesequence*/ +public Integer getExpensesequence(){ + return expensesequence; +} +/**Fija el valor de expensesequence +@param pExpensesequence nuevo Valor de expensesequence*/ +public void setExpensesequence(Integer pExpensesequence){ + expensesequence=pExpensesequence; +} + +/**Implementacin de la comparacin de TcustPeopleExpensesKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleExpensesKey))return false; + TcustPeopleExpensesKey that = (TcustPeopleExpensesKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getExpensesequence() == null || that.getExpensesequence() == null){ + return false; + } + if (! this.getExpensesequence().equals(that.getExpensesequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPeopleExpensesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getExpensesequence() == null ? 0 : this.getExpensesequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleFixedIncome.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleFixedIncome.java new file mode 100644 index 0000000..51d4d11 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleFixedIncome.java @@ -0,0 +1,549 @@ +package com.fp.persistence.pcustomer.people; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPEOPLEFIXEDINCOME + */ +@Entity(name = "TcustPeopleFixedIncome") +@Table(name = "TCUSTPEOPLEFIXEDINCOME") +public class TcustPeopleFixedIncome extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TcustPeopleFixedIncome + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(FIXEDINCOMESEQUENCE),0)+1 from TCUSTPEOPLEFIXEDINCOME where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "fixedincomesequence") }) + @GeneratedValue(generator = "seq_id") + private TcustPeopleFixedIncomeKey pk; + + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "FIXEDINCOMECATALOG", nullable = true) + /** + * Codigo de catalogo 1 Bonos del banco central, 2 Poliza, 3 Certificado de + * inversion + */ + private String fixedincomecatalog; + + @Column(name = "FIXEDINCOMECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo FIXEDINCOME tipo de inversion + */ + private String fixedincomecatalogcode; + + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + + @Column(name = "BANKPERSONCODE", nullable = true) + /** + * Codigo de persona asociado a la institucion fincnaiera en la cual el + * cliente matiene la inversion + */ + private Integer bankpersoncode; + + @Column(name = "BANKNAME", nullable = true) + /** + * Nombre de la institucion financiera en la cual el cliente mantiene la + * operacion de renta + */ + private String bankname; + + @Column(name = "ORIGINALAMONT", nullable = true) + /** + * Monto original de la inversion + */ + private BigDecimal originalamont; + + @Column(name = "RATE", nullable = true) + /** + * Tada de la inversion. + */ + private BigDecimal rate; + + @Column(name = "BALANCE", nullable = true) + /** + * Saldo de la inversion. + */ + private BigDecimal balance; + + @Column(name = "BALANCEDATE", nullable = true) + /** + * Fecha a la cual se ingresa el saldo de la inversion. + */ + private Date balancedate; + + @Column(name = "EXPIRATIONDATE", nullable = true) + /** + * Fecha de vencimiento de la inversion. + */ + private Date expirationdate; + + @Column(name = "REMARK", nullable = true) + /** + * Comentario. + */ + private String remark; + + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String ingressusercode; + + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String modifyusercode; + + /** + * Contructor por defecto + */ + public TcustPeopleFixedIncome() { + } + + /** + * Contructor de TcustPeopleFixedIncome + * + * @param pPk Clave Primaria del entity + */ + public TcustPeopleFixedIncome(TcustPeopleFixedIncomeKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPeopleFixedIncome + */ + public static TcustPeopleFixedIncome find(EntityManager pEntityManager, TcustPeopleFixedIncomeKey pKey) throws Exception { + TcustPeopleFixedIncome obj = pEntityManager.find(TcustPeopleFixedIncome.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPeopleFixedIncome + * + * @return El objeto que referencia a la Clave primaria de TcustPeopleFixedIncome + */ + public TcustPeopleFixedIncomeKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPeopleFixedIncome + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TcustPeopleFixedIncome + */ + public void setPk(TcustPeopleFixedIncomeKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de fixedincomecatalog + * + * @return valor de fixedincomecatalog + */ + public String getFixedincomecatalog() { + return this.fixedincomecatalog; + } + + /** + * Fija el valor de fixedincomecatalog + * + * @param pFixedincomecatalog nuevo Valor de fixedincomecatalog + */ + public void setFixedincomecatalog(String pFixedincomecatalog) { + this.fixedincomecatalog = pFixedincomecatalog; + } + + /** + * Obtiene el valor de fixedincomecatalogcode + * + * @return valor de fixedincomecatalogcode + */ + public String getFixedincomecatalogcode() { + return this.fixedincomecatalogcode; + } + + /** + * Fija el valor de fixedincomecatalogcode + * + * @param pFixedincomecatalogcode nuevo Valor de fixedincomecatalogcode + */ + public void setFixedincomecatalogcode(String pFixedincomecatalogcode) { + this.fixedincomecatalogcode = pFixedincomecatalogcode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de bankpersoncode + * + * @return valor de bankpersoncode + */ + public Integer getBankpersoncode() { + return this.bankpersoncode; + } + + /** + * Fija el valor de bankpersoncode + * + * @param pBankpersoncode nuevo Valor de bankpersoncode + */ + public void setBankpersoncode(Integer pBankpersoncode) { + this.bankpersoncode = pBankpersoncode; + } + + /** + * Obtiene el valor de bankname + * + * @return valor de bankname + */ + public String getBankname() { + return this.bankname; + } + + /** + * Fija el valor de bankname + * + * @param pBankname nuevo Valor de bankname + */ + public void setBankname(String pBankname) { + this.bankname = pBankname; + } + + /** + * Obtiene el valor de originalamont + * + * @return valor de originalamont + */ + public BigDecimal getOriginalamont() { + return this.originalamont; + } + + /** + * Fija el valor de originalamont + * + * @param pOriginalamont nuevo Valor de originalamont + */ + public void setOriginalamont(BigDecimal pOriginalamont) { + this.originalamont = pOriginalamont; + } + + /** + * Obtiene el valor de rate + * + * @return valor de rate + */ + public BigDecimal getRate() { + return this.rate; + } + + /** + * Fija el valor de rate + * + * @param pRate nuevo Valor de rate + */ + public void setRate(BigDecimal pRate) { + this.rate = pRate; + } + + /** + * Obtiene el valor de balance + * + * @return valor de balance + */ + public BigDecimal getBalance() { + return this.balance; + } + + /** + * Fija el valor de balance + * + * @param pBalance nuevo Valor de balance + */ + public void setBalance(BigDecimal pBalance) { + this.balance = pBalance; + } + + /** + * Obtiene el valor de balancedate + * + * @return valor de balancedate + */ + public Date getBalancedate() { + return this.balancedate; + } + + /** + * Fija el valor de balancedate + * + * @param pBalancedate nuevo Valor de balancedate + */ + public void setBalancedate(Date pBalancedate) { + this.balancedate = pBalancedate; + } + + /** + * Obtiene el valor de expirationdate + * + * @return valor de expirationdate + */ + public Date getExpirationdate() { + return this.expirationdate; + } + + /** + * Fija el valor de expirationdate + * + * @param pExpirationdate nuevo Valor de expirationdate + */ + public void setExpirationdate(Date pExpirationdate) { + this.expirationdate = pExpirationdate; + } + + /** + * Obtiene el valor de remark + * + * @return valor de remark + */ + public String getRemark() { + return this.remark; + } + + /** + * Fija el valor de remark + * + * @param pRemark nuevo Valor de remark + */ + public void setRemark(String pRemark) { + this.remark = pRemark; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPeopleFixedIncome)) { + return false; + } + TcustPeopleFixedIncome that = (TcustPeopleFixedIncome) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustPeopleFixedIncome + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustPeopleFixedIncome + */ + @Override + public Object createInstance() { + TcustPeopleFixedIncome instance = new TcustPeopleFixedIncome(); + instance.setPk(new TcustPeopleFixedIncomeKey()); + return instance; + } + + /** + * Clona la entidad TcustPeopleFixedIncome + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPeopleFixedIncome p = (TcustPeopleFixedIncome) this.clone(); + p.setPk((TcustPeopleFixedIncomeKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleFixedIncomeKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleFixedIncomeKey.java new file mode 100644 index 0000000..134a02e --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleFixedIncomeKey.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLEFIXEDINCOME*/ +@Embeddable +public class TcustPeopleFixedIncomeKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="FIXEDINCOMESEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del ingreso de la persona +*/ +private Integer fixedincomesequence; + +/**Contructor por defecto*/ +public TcustPeopleFixedIncomeKey(){} +/**Contructor de TcustPeopleFixedIncomeKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pFixedincomesequence Secuencia del ingreso de la persona +*/ +public TcustPeopleFixedIncomeKey(Integer pPersoncode,Timestamp pDateto,Integer pFixedincomesequence){ + personcode=pPersoncode; + dateto=pDateto; + fixedincomesequence=pFixedincomesequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de fixedincomesequence +@return valor de fixedincomesequence*/ +public Integer getFixedincomesequence(){ + return fixedincomesequence; +} +/**Fija el valor de fixedincomesequence +@param pFixedincomesequence nuevo Valor de fixedincomesequence*/ +public void setFixedincomesequence(Integer pFixedincomesequence){ + fixedincomesequence=pFixedincomesequence; +} + +/**Implementacin de la comparacin de TcustPeopleFixedIncomeKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleFixedIncomeKey))return false; + TcustPeopleFixedIncomeKey that = (TcustPeopleFixedIncomeKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getFixedincomesequence() == null || that.getFixedincomesequence() == null){ + return false; + } + if (! this.getFixedincomesequence().equals(that.getFixedincomesequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPeopleFixedIncomeKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getFixedincomesequence() == null ? 0 : this.getFixedincomesequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleIncome.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleIncome.java new file mode 100644 index 0000000..e2ce444 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleIncome.java @@ -0,0 +1,416 @@ +package com.fp.persistence.pcustomer.people; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTPEOPLEINCOME + */ +@Entity(name = "TcustPeopleIncome") +@Table(name = "TCUSTPEOPLEINCOME") +public class TcustPeopleIncome extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustPeopleIncome + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(INCOMESEQUENCE),0)+1 from TCUSTPEOPLEINCOME where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "incomesequence")}) + @GeneratedValue(generator = "seq_id") + private TcustPeopleIncomeKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "INCOMESCATALOG", nullable = true) + /** + * Codigo de catalogo de ingresos 1 sueldo, 2 comisiones + */ + private String incomescatalog; + @Column(name = "INCOMESCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo INCOMES DE INGRESOS + */ + private String incomescatalogcode; + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + @Column(name = "AMOUNT", nullable = true) + /** + * Valor del ingreso mensual + */ + private BigDecimal amount; + @Column(name = "ISFIXVALUE", nullable = true) + /** + * Y indica que un valor de ingreso fijo, N no es un ingreso fijo + */ + private String isfixvalue; + @Column(name = "VERIFIEDAMOUNT", nullable = true) + /** + * Monto verificado por una persona de la institucion financiera + */ + private BigDecimal verifiedamount; + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String ingressusercode; + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String modifyusercode; + + /** + * Contructor por defecto + */ + public TcustPeopleIncome() { + } + + /** + * Contructor de TcustPeopleIncome + * + * @param pPk Clave Primaria del entity + */ + public TcustPeopleIncome(TcustPeopleIncomeKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPeopleIncome + */ + public static TcustPeopleIncome find(EntityManager pEntityManager, TcustPeopleIncomeKey pKey) throws Exception { + TcustPeopleIncome obj = pEntityManager.find(TcustPeopleIncome.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPeopleIncome + * + * @return El objeto que referencia a la Clave primaria de TcustPeopleIncome + */ + public TcustPeopleIncomeKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPeopleIncome + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustPeopleIncome + */ + public void setPk(TcustPeopleIncomeKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de incomescatalog + * + * @return valor de incomescatalog + */ + public String getIncomescatalog() { + return this.incomescatalog; + } + + /** + * Fija el valor de incomescatalog + * + * @param pIncomescatalog nuevo Valor de incomescatalog + */ + public void setIncomescatalog(String pIncomescatalog) { + this.incomescatalog = pIncomescatalog; + } + + /** + * Obtiene el valor de incomescatalogcode + * + * @return valor de incomescatalogcode + */ + public String getIncomescatalogcode() { + return this.incomescatalogcode; + } + + /** + * Fija el valor de incomescatalogcode + * + * @param pIncomescatalogcode nuevo Valor de incomescatalogcode + */ + public void setIncomescatalogcode(String pIncomescatalogcode) { + this.incomescatalogcode = pIncomescatalogcode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de amount + * + * @return valor de amount + */ + public BigDecimal getAmount() { + return this.amount; + } + + /** + * Fija el valor de amount + * + * @param pAmount nuevo Valor de amount + */ + public void setAmount(BigDecimal pAmount) { + this.amount = pAmount; + } + + /** + * Obtiene el valor de isfixvalue + * + * @return valor de isfixvalue + */ + public String getIsfixvalue() { + return this.isfixvalue; + } + + /** + * Fija el valor de isfixvalue + * + * @param pIsfixvalue nuevo Valor de isfixvalue + */ + public void setIsfixvalue(String pIsfixvalue) { + this.isfixvalue = pIsfixvalue; + } + + /** + * Obtiene el valor de verifiedamount + * + * @return valor de verifiedamount + */ + public BigDecimal getVerifiedamount() { + return this.verifiedamount; + } + + /** + * Fija el valor de verifiedamount + * + * @param pVerifiedamount nuevo Valor de verifiedamount + */ + public void setVerifiedamount(BigDecimal pVerifiedamount) { + this.verifiedamount = pVerifiedamount; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPeopleIncome)) { + return false; + } + TcustPeopleIncome that = (TcustPeopleIncome) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustPeopleIncome + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustPeopleIncome + */ + @Override + public Object createInstance() { + TcustPeopleIncome instance = new TcustPeopleIncome(); + instance.setPk(new TcustPeopleIncomeKey()); + return instance; + } + + /** + * Clona la entidad TcustPeopleIncome + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPeopleIncome p = (TcustPeopleIncome) this.clone(); + p.setPk((TcustPeopleIncomeKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleIncomeKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleIncomeKey.java new file mode 100644 index 0000000..3394ddb --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleIncomeKey.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLEINCOME*/ +@Embeddable +public class TcustPeopleIncomeKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="INCOMESEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del ingreso de la persona +*/ +private Integer incomesequence; + +/**Contructor por defecto*/ +public TcustPeopleIncomeKey(){} +/**Contructor de TcustPeopleIncomeKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pIncomesequence Secuencia del ingreso de la persona +*/ +public TcustPeopleIncomeKey(Integer pPersoncode,Timestamp pDateto,Integer pIncomesequence){ + personcode=pPersoncode; + dateto=pDateto; + incomesequence=pIncomesequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de incomesequence +@return valor de incomesequence*/ +public Integer getIncomesequence(){ + return incomesequence; +} +/**Fija el valor de incomesequence +@param pIncomesequence nuevo Valor de incomesequence*/ +public void setIncomesequence(Integer pIncomesequence){ + incomesequence=pIncomesequence; +} + +/**Implementacin de la comparacin de TcustPeopleIncomeKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleIncomeKey))return false; + TcustPeopleIncomeKey that = (TcustPeopleIncomeKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getIncomesequence() == null || that.getIncomesequence() == null){ + return false; + } + if (! this.getIncomesequence().equals(that.getIncomesequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPeopleIncomeKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getIncomesequence() == null ? 0 : this.getIncomesequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleJob.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleJob.java new file mode 100644 index 0000000..d723d3d --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleJob.java @@ -0,0 +1,508 @@ +package com.fp.persistence.pcustomer.people; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTPEOPLEJOB + */ +@Entity(name = "TcustPeopleJob") +@Table(name = "TCUSTPEOPLEJOB") +public class TcustPeopleJob extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustPeopleJob + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(JOBSEQUENCE),0)+1 from TCUSTPEOPLEJOB where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "jobsequence")}) + @GeneratedValue(generator = "seq_id") + private TcustPeopleJobKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "EMPLOYERPERSONCODE", nullable = true) + /** + * Codigo de persona empleadora + */ + private Integer employerpersoncode; + @Column(name = "JOBCATALOG", nullable = true) + /** + * Codigo de catalogo 1, Gerente, 2 Chofer, 3 Cajero + */ + private String jobcatalog; + @Column(name = "JOBCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo de cargos de personas naturales JOB + */ + private String jobcatalogcode; + @Column(name = "AGREEMENTTYPECATALOG", nullable = true) + /** + * Codigo de contrato, 1 indefinido, 2 un a�o , 3 tres meses etc. + */ + private String agreementtypecatalog; + @Column(name = "AGREEMENTTYPECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo AGREEMENTTYPE tipo de contrato + */ + private String agreementtypecatalogcode; + @Column(name = "ENTRYDATE", nullable = true) + /** + * Fecha de ingreso al trabajo + */ + private Date entrydate; + @Column(name = "DEPARTUREDATE", nullable = true) + /** + * Fecha de salida del trabajo + */ + private Date departuredate; + @Column(name = "EMPLOYERNAME", nullable = true) + /** + * Nombre del empleador + */ + private String employername; + @Column(name = "ISOWNER", nullable = true) + /** + * Y indica que es duenio de la empresa. + */ + private String isowner; + @Column(name = "ADDRESS", nullable = true) + /** + * Numero de direccion asociada al trabajo + */ + private Integer address; + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String ingressusercode; + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String modifyusercode; + + /** + * Contructor por defecto + */ + public TcustPeopleJob() { + } + + /** + * Contructor de TcustPeopleJob + * + * @param pPk Clave Primaria del entity + */ + public TcustPeopleJob(TcustPeopleJobKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPeopleJob + */ + public static TcustPeopleJob find(EntityManager pEntityManager, TcustPeopleJobKey pKey) throws Exception { + TcustPeopleJob obj = pEntityManager.find(TcustPeopleJob.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPeopleJob + * + * @return El objeto que referencia a la Clave primaria de TcustPeopleJob + */ + public TcustPeopleJobKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPeopleJob + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustPeopleJob + */ + public void setPk(TcustPeopleJobKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de employerpersoncode + * + * @return valor de employerpersoncode + */ + public Integer getEmployerpersoncode() { + return this.employerpersoncode; + } + + /** + * Fija el valor de employerpersoncode + * + * @param pEmployerpersoncode nuevo Valor de employerpersoncode + */ + public void setEmployerpersoncode(Integer pEmployerpersoncode) { + this.employerpersoncode = pEmployerpersoncode; + } + + /** + * Obtiene el valor de jobcatalog + * + * @return valor de jobcatalog + */ + public String getJobcatalog() { + return this.jobcatalog; + } + + /** + * Fija el valor de jobcatalog + * + * @param pJobcatalog nuevo Valor de jobcatalog + */ + public void setJobcatalog(String pJobcatalog) { + this.jobcatalog = pJobcatalog; + } + + /** + * Obtiene el valor de jobcatalogcode + * + * @return valor de jobcatalogcode + */ + public String getJobcatalogcode() { + return this.jobcatalogcode; + } + + /** + * Fija el valor de jobcatalogcode + * + * @param pJobcatalogcode nuevo Valor de jobcatalogcode + */ + public void setJobcatalogcode(String pJobcatalogcode) { + this.jobcatalogcode = pJobcatalogcode; + } + + /** + * Obtiene el valor de agreementtypecatalog + * + * @return valor de agreementtypecatalog + */ + public String getAgreementtypecatalog() { + return this.agreementtypecatalog; + } + + /** + * Fija el valor de agreementtypecatalog + * + * @param pAgreementtypecatalog nuevo Valor de agreementtypecatalog + */ + public void setAgreementtypecatalog(String pAgreementtypecatalog) { + this.agreementtypecatalog = pAgreementtypecatalog; + } + + /** + * Obtiene el valor de agreementtypecatalogcode + * + * @return valor de agreementtypecatalogcode + */ + public String getAgreementtypecatalogcode() { + return this.agreementtypecatalogcode; + } + + /** + * Fija el valor de agreementtypecatalogcode + * + * @param pAgreementtypecatalogcode nuevo Valor de agreementtypecatalogcode + */ + public void setAgreementtypecatalogcode(String pAgreementtypecatalogcode) { + this.agreementtypecatalogcode = pAgreementtypecatalogcode; + } + + /** + * Obtiene el valor de entrydate + * + * @return valor de entrydate + */ + public Date getEntrydate() { + return this.entrydate; + } + + /** + * Fija el valor de entrydate + * + * @param pEntrydate nuevo Valor de entrydate + */ + public void setEntrydate(Date pEntrydate) { + this.entrydate = pEntrydate; + } + + /** + * Obtiene el valor de departuredate + * + * @return valor de departuredate + */ + public Date getDeparturedate() { + return this.departuredate; + } + + /** + * Fija el valor de departuredate + * + * @param pDeparturedate nuevo Valor de departuredate + */ + public void setDeparturedate(Date pDeparturedate) { + this.departuredate = pDeparturedate; + } + + /** + * Obtiene el valor de employername + * + * @return valor de employername + */ + public String getEmployername() { + return this.employername; + } + + /** + * Fija el valor de employername + * + * @param pEmployername nuevo Valor de employername + */ + public void setEmployername(String pEmployername) { + this.employername = pEmployername; + } + + /** + * Obtiene el valor de isowner + * + * @return valor de isowner + */ + public String getIsowner() { + return this.isowner; + } + + /** + * Fija el valor de isowner + * + * @param pIsowner nuevo Valor de isowner + */ + public void setIsowner(String pIsowner) { + this.isowner = pIsowner; + } + + /** + * Obtiene el valor de address + * + * @return valor de address + */ + public Integer getAddress() { + return this.address; + } + + /** + * Fija el valor de address + * + * @param pAddress nuevo Valor de address + */ + public void setAddress(Integer pAddress) { + this.address = pAddress; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPeopleJob)) { + return false; + } + TcustPeopleJob that = (TcustPeopleJob) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustPeopleJob + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustPeopleJob + */ + @Override + public Object createInstance() { + TcustPeopleJob instance = new TcustPeopleJob(); + instance.setPk(new TcustPeopleJobKey()); + return instance; + } + + /** + * Clona la entidad TcustPeopleJob + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPeopleJob p = (TcustPeopleJob) this.clone(); + p.setPk((TcustPeopleJobKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleJobKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleJobKey.java new file mode 100644 index 0000000..fced40a --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleJobKey.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLEJOB*/ +@Embeddable +public class TcustPeopleJobKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="JOBSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del trabajo +*/ +private Integer jobsequence; + +/**Contructor por defecto*/ +public TcustPeopleJobKey(){} +/**Contructor de TcustPeopleJobKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pJobsequence Secuencia del trabajo +*/ +public TcustPeopleJobKey(Integer pPersoncode,Timestamp pDateto,Integer pJobsequence){ + personcode=pPersoncode; + dateto=pDateto; + jobsequence=pJobsequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de jobsequence +@return valor de jobsequence*/ +public Integer getJobsequence(){ + return jobsequence; +} +/**Fija el valor de jobsequence +@param pJobsequence nuevo Valor de jobsequence*/ +public void setJobsequence(Integer pJobsequence){ + jobsequence=pJobsequence; +} + +/**Implementacin de la comparacin de TcustPeopleJobKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleJobKey))return false; + TcustPeopleJobKey that = (TcustPeopleJobKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getJobsequence() == null || that.getJobsequence() == null){ + return false; + } + if (! this.getJobsequence().equals(that.getJobsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPeopleJobKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getJobsequence() == null ? 0 : this.getJobsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleKey.java new file mode 100644 index 0000000..3da7c3e --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleKey.java @@ -0,0 +1,129 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLE*/ +@Embeddable +public class TcustPeopleKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TcustPeopleKey(){} +/**Contructor de TcustPeopleKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +*/ +public TcustPeopleKey(Integer pPersoncode,Timestamp pDateto){ + personcode=pPersoncode; + dateto=pDateto; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacion de la comparacion de TcustPeopleKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleKey))return false; + TcustPeopleKey that = (TcustPeopleKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TcustPeopleKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleLoan.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleLoan.java new file mode 100644 index 0000000..f5d24a4 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleLoan.java @@ -0,0 +1,568 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import com.fp.dto.hb.Log; +import java.io.Serializable; +import javax.persistence.Table; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import javax.persistence.Entity; +import javax.persistence.EmbeddedId; +import javax.persistence.EntityManager; +import javax.persistence.Column; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; +import javax.persistence.*; +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPEOPLELOAN + */ +@Entity(name = "TcustPeopleLoan") +@Table(name = "TCUSTPEOPLELOAN") +public class TcustPeopleLoan extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustPeopleLoan + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(LOANSEQUENCE),0)+1 from TCUSTPEOPLELOAN where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "loansequence")}) + @GeneratedValue(generator = "seq_id") + private TcustPeopleLoanKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "CREDITRATINGCATALOG", nullable = true) + /** + * Codigo de catalogo 1, normal, 2 deficiente, dudoso, 3 perdida + */ + private String creditratingcatalog; + @Column(name = "CREDITRATINGCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo CREDITRATING, de la calificacion de creditos + */ + private String creditratingcatalogcode; + @Column(name = "CREDITTYPECLIENTCATALOG", nullable = true) + /** + * Tipos de credito + */ + private String credittypeclientcatalog; + @Column(name = "CREDITTYPECLIENTCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo CREDITTYPECLIENT, para tipos de crédito + */ + private String credittypeclientcatalogcode; + @Column(name = "FREQUENCYCLIENTCATALOG", nullable = true) + /** + * Tipos de credito + */ + private String frequencyclientcatalog; + @Column(name = "FREQUENCYCLIENTCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo FREQUENCYCLIENT, para frecuencias en clientes + */ + private String frequencyclientcatalogcode; + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + @Column(name = "BANKPERSONCODE", nullable = true) + /** + * Codigo de persona asociado a la institucion fincnaiera en la cual el cliente matiene el prestamo + */ + private Integer bankpersoncode; + @Column(name = "BANKNAME", nullable = true) + /** + * Nombre de la institucion financiera en la cual el cliente mantiene la operacion + */ + private String bankname; + @Column(name = "ORIGINALAMONT", nullable = true) + /** + * Monto original del prestamo + */ + private BigDecimal originalamont; + @Column(name = "BALANCE", nullable = true) + /** + * Saldo del prestamo. + */ + private BigDecimal balance; + @Column(name = "BALANCEDATE", nullable = true) + /** + * Fecha a la cual se ingresa el saldo del prestamo + */ + private Date balancedate; + @Column(name = "QUOTAAMOUNT", nullable = true) + /** + * Valor de la cuota, de acuerdo a la frecuencia de pago + */ + private BigDecimal quotaamount; + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String ingressusercode; + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String modifyusercode; + + /** + * Contructor por defecto + */ + public TcustPeopleLoan() { + } + + /** + * Contructor de TcustPeopleLoan + * + * @param pPk Clave Primaria del entity + */ + public TcustPeopleLoan(TcustPeopleLoanKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPeopleLoan + */ + public static TcustPeopleLoan find(EntityManager pEntityManager, TcustPeopleLoanKey pKey) throws Exception { + TcustPeopleLoan obj = pEntityManager.find(TcustPeopleLoan.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPeopleLoan + * + * @return El objeto que referencia a la Clave primaria de TcustPeopleLoan + */ + public TcustPeopleLoanKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPeopleLoan + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TcustPeopleLoan + */ + public void setPk(TcustPeopleLoanKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de creditratingcatalog + * + * @return valor de creditratingcatalog + */ + public String getCreditratingcatalog() { + return creditratingcatalog; + } + + /** + * Fija el valor de creditratingcatalog + * + * @param pCreditratingcatalog nuevo Valor de creditratingcatalog + */ + public void setCreditratingcatalog(String pCreditratingcatalog) { + creditratingcatalog = pCreditratingcatalog; + } + + /** + * Obtiene el valor de creditratingcatalogcode + * + * @return valor de creditratingcatalogcode + */ + public String getCreditratingcatalogcode() { + return creditratingcatalogcode; + } + + /** + * Fija el valor de creditratingcatalogcode + * + * @param pCreditratingcatalogcode nuevo Valor de creditratingcatalogcode + */ + public void setCreditratingcatalogcode(String pCreditratingcatalogcode) { + creditratingcatalogcode = pCreditratingcatalogcode; + } + + /** + * Obtiene el valor de credittypeclientcatalog + * + * @return valor de credittypeclientcatalog + */ + public String getCredittypeclientcatalog() { + return credittypeclientcatalog; + } + + /** + * Fija el valor de credittypeclientcatalog + * + * @param pCredittypeclientcatalog nuevo Valor de credittypeclientcatalog + */ + public void setCredittypeclientcatalog(String pCredittypeclientcatalog) { + credittypeclientcatalog = pCredittypeclientcatalog; + } + + /** + * Obtiene el valor de credittypeclientcatalogcode + * + * @return valor de credittypeclientcatalogcode + */ + public String getCredittypeclientcatalogcode() { + return credittypeclientcatalogcode; + } + + /** + * Fija el valor de credittypeclientcatalogcode + * + * @param pCredittypeclientcatalogcode nuevo Valor de credittypeclientcatalogcode + */ + public void setCredittypeclientcatalogcode(String pCredittypeclientcatalogcode) { + credittypeclientcatalogcode = pCredittypeclientcatalogcode; + } + + /** + * Obtiene el valor de frequencyclientcatalog + * + * @return valor de frequencyclientcatalog + */ + public String getFrequencyclientcatalog() { + return frequencyclientcatalog; + } + + /** + * Fija el valor de frequencyclientcatalog + * + * @param pFrequencyclientcatalog nuevo Valor de frequencyclientcatalog + */ + public void setFrequencyclientcatalog(String pFrequencyclientcatalog) { + frequencyclientcatalog = pFrequencyclientcatalog; + } + + /** + * Obtiene el valor de frequencyclientcatalogcode + * + * @return valor de frequencyclientcatalogcode + */ + public String getFrequencyclientcatalogcode() { + return frequencyclientcatalogcode; + } + + /** + * Fija el valor de frequencyclientcatalogcode + * + * @param pFrequencyclientcatalogcode nuevo Valor de frequencyclientcatalogcode + */ + public void setFrequencyclientcatalogcode(String pFrequencyclientcatalogcode) { + frequencyclientcatalogcode = pFrequencyclientcatalogcode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de bankpersoncode + * + * @return valor de bankpersoncode + */ + public Integer getBankpersoncode() { + return bankpersoncode; + } + + /** + * Fija el valor de bankpersoncode + * + * @param pBankpersoncode nuevo Valor de bankpersoncode + */ + public void setBankpersoncode(Integer pBankpersoncode) { + bankpersoncode = pBankpersoncode; + } + + /** + * Obtiene el valor de bankname + * + * @return valor de bankname + */ + public String getBankname() { + return bankname; + } + + /** + * Fija el valor de bankname + * + * @param pBankname nuevo Valor de bankname + */ + public void setBankname(String pBankname) { + bankname = pBankname; + } + + /** + * Obtiene el valor de originalamont + * + * @return valor de originalamont + */ + public BigDecimal getOriginalamont() { + return originalamont; + } + + /** + * Fija el valor de originalamont + * + * @param pOriginalamont nuevo Valor de originalamont + */ + public void setOriginalamont(BigDecimal pOriginalamont) { + originalamont = pOriginalamont; + } + + /** + * Obtiene el valor de balance + * + * @return valor de balance + */ + public BigDecimal getBalance() { + return balance; + } + + /** + * Fija el valor de balance + * + * @param pBalance nuevo Valor de balance + */ + public void setBalance(BigDecimal pBalance) { + balance = pBalance; + } + + /** + * Obtiene el valor de balancedate + * + * @return valor de balancedate + */ + public Date getBalancedate() { + return balancedate; + } + + /** + * Fija el valor de balancedate + * + * @param pBalancedate nuevo Valor de balancedate + */ + public void setBalancedate(Date pBalancedate) { + balancedate = pBalancedate; + } + + /** + * Obtiene el valor de quotaamount + * + * @return valor de quotaamount + */ + public BigDecimal getQuotaamount() { + return quotaamount; + } + + /** + * Fija el valor de quotaamount + * + * @param pQuotaamount nuevo Valor de quotaamount + */ + public void setQuotaamount(BigDecimal pQuotaamount) { + quotaamount = pQuotaamount; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + modifyusercode = pModifyusercode; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPeopleLoan)) { + return false; + } + TcustPeopleLoan that = (TcustPeopleLoan) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TcustPeopleLoan + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacion toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacion de la creacion de un bean en blanco TcustPeopleLoan + */ + public Object createInstance() { + TcustPeopleLoan instance = new TcustPeopleLoan(); + instance.setPk(new TcustPeopleLoanKey()); + return instance; + } + + /** + * Clona la entidad TcustPeopleLoan + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TcustPeopleLoan p = (TcustPeopleLoan) this.clone(); + p.setPk((TcustPeopleLoanKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleLoanKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleLoanKey.java new file mode 100644 index 0000000..3ec6776 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleLoanKey.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLELOAN*/ +@Embeddable +public class TcustPeopleLoanKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="LOANSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del ingreso de la persona +*/ +private Integer loansequence; + +/**Contructor por defecto*/ +public TcustPeopleLoanKey(){} +/**Contructor de TcustPeopleLoanKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pLoansequence Secuencia del ingreso de la persona +*/ +public TcustPeopleLoanKey(Integer pPersoncode,Timestamp pDateto,Integer pLoansequence){ + personcode=pPersoncode; + dateto=pDateto; + loansequence=pLoansequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de loansequence +@return valor de loansequence*/ +public Integer getLoansequence(){ + return loansequence; +} +/**Fija el valor de loansequence +@param pLoansequence nuevo Valor de loansequence*/ +public void setLoansequence(Integer pLoansequence){ + loansequence=pLoansequence; +} + +/**Implementacion de la comparacion de TcustPeopleLoanKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleLoanKey))return false; + TcustPeopleLoanKey that = (TcustPeopleLoanKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getLoansequence() == null || that.getLoansequence() == null){ + return false; + } + if (! this.getLoansequence().equals(that.getLoansequence())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TcustPeopleLoanKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getLoansequence() == null ? 0 : this.getLoansequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleOtherAssets.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleOtherAssets.java new file mode 100644 index 0000000..295404b --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleOtherAssets.java @@ -0,0 +1,546 @@ +package com.fp.persistence.pcustomer.people; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPEOPLEOTHERASSETS + */ +@Entity(name = "TcustPeopleOtherAssets") +@Table(name = "TCUSTPEOPLEOTHERASSETS") +public class TcustPeopleOtherAssets extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TcustPeopleOtherAssets + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(ASSETSSEQUENCE),0)+1 from TCUSTPEOPLEOTHERASSETS where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "assetssequence") }) + @GeneratedValue(generator = "seq_id") + private TcustPeopleOtherAssetsKey pk; + + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "PROPERTYTYPECATALOG", nullable = true) + /** + * Codigo de catalogo 1, CASA, 2 OFICINA, 3 JOYAS + */ + private String propertytypecatalog; + + @Column(name = "PROPERTYTYPECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo PROPERTYTYPE, DEL TIPO DE BIEN + */ + private String propertytypecatalogcode; + + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + + @Column(name = "ASSESSMENT", nullable = true) + /** + * Valor del avaluo del bien + */ + private BigDecimal assessment; + + @Column(name = "ASSESSMENTDATE", nullable = true) + /** + * Fecha de avaluo. + */ + private Date assessmentdate; + + @Column(name = "MORTGAGEAMOUNT", nullable = true) + /** + * Monto original de la hipoteca + */ + private BigDecimal mortgageamount; + + @Column(name = "MORTGAGEDATE", nullable = true) + /** + * Fecha de la hipoteca + */ + private Date mortgagedate; + + @Column(name = "MORTGAGEBALANCE", nullable = true) + /** + * Saldo de la hipoteca + */ + private BigDecimal mortgagebalance; + + @Column(name = "MORTGAGEPERSONCODE", nullable = true) + /** + * Codigo de persona a la que esta hipotecado el bien + */ + private Integer mortgagepersoncode; + + @Column(name = "MORTGAGENAME", nullable = true) + /** + * Nombre de la entidad poseedora de la hipoteca + */ + private String mortgagename; + + @Column(name = "REMARK", nullable = true) + /** + * Comentario + */ + private String remark; + + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String ingressusercode; + + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String modifyusercode; + + /** + * Contructor por defecto + */ + public TcustPeopleOtherAssets() { + } + + /** + * Contructor de TcustPeopleOtherAssets + * + * @param pPk Clave Primaria del entity + */ + public TcustPeopleOtherAssets(TcustPeopleOtherAssetsKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPeopleOtherAssets + */ + public static TcustPeopleOtherAssets find(EntityManager pEntityManager, TcustPeopleOtherAssetsKey pKey) throws Exception { + TcustPeopleOtherAssets obj = pEntityManager.find(TcustPeopleOtherAssets.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPeopleOtherAssets + * + * @return El objeto que referencia a la Clave primaria de TcustPeopleOtherAssets + */ + public TcustPeopleOtherAssetsKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPeopleOtherAssets + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TcustPeopleOtherAssets + */ + public void setPk(TcustPeopleOtherAssetsKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de propertytypecatalog + * + * @return valor de propertytypecatalog + */ + public String getPropertytypecatalog() { + return this.propertytypecatalog; + } + + /** + * Fija el valor de propertytypecatalog + * + * @param pPropertytypecatalog nuevo Valor de propertytypecatalog + */ + public void setPropertytypecatalog(String pPropertytypecatalog) { + this.propertytypecatalog = pPropertytypecatalog; + } + + /** + * Obtiene el valor de propertytypecatalogcode + * + * @return valor de propertytypecatalogcode + */ + public String getPropertytypecatalogcode() { + return this.propertytypecatalogcode; + } + + /** + * Fija el valor de propertytypecatalogcode + * + * @param pPropertytypecatalogcode nuevo Valor de propertytypecatalogcode + */ + public void setPropertytypecatalogcode(String pPropertytypecatalogcode) { + this.propertytypecatalogcode = pPropertytypecatalogcode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de assessment + * + * @return valor de assessment + */ + public BigDecimal getAssessment() { + return this.assessment; + } + + /** + * Fija el valor de assessment + * + * @param pAssessment nuevo Valor de assessment + */ + public void setAssessment(BigDecimal pAssessment) { + this.assessment = pAssessment; + } + + /** + * Obtiene el valor de assessmentdate + * + * @return valor de assessmentdate + */ + public Date getAssessmentdate() { + return this.assessmentdate; + } + + /** + * Fija el valor de assessmentdate + * + * @param pAssessmentdate nuevo Valor de assessmentdate + */ + public void setAssessmentdate(Date pAssessmentdate) { + this.assessmentdate = pAssessmentdate; + } + + /** + * Obtiene el valor de mortgageamount + * + * @return valor de mortgageamount + */ + public BigDecimal getMortgageamount() { + return this.mortgageamount; + } + + /** + * Fija el valor de mortgageamount + * + * @param pMortgageamount nuevo Valor de mortgageamount + */ + public void setMortgageamount(BigDecimal pMortgageamount) { + this.mortgageamount = pMortgageamount; + } + + /** + * Obtiene el valor de mortgagedate + * + * @return valor de mortgagedate + */ + public Date getMortgagedate() { + return this.mortgagedate; + } + + /** + * Fija el valor de mortgagedate + * + * @param pMortgagedate nuevo Valor de mortgagedate + */ + public void setMortgagedate(Date pMortgagedate) { + this.mortgagedate = pMortgagedate; + } + + /** + * Obtiene el valor de mortgagebalance + * + * @return valor de mortgagebalance + */ + public BigDecimal getMortgagebalance() { + return this.mortgagebalance; + } + + /** + * Fija el valor de mortgagebalance + * + * @param pMortgagebalance nuevo Valor de mortgagebalance + */ + public void setMortgagebalance(BigDecimal pMortgagebalance) { + this.mortgagebalance = pMortgagebalance; + } + + /** + * Obtiene el valor de mortgagepersoncode + * + * @return valor de mortgagepersoncode + */ + public Integer getMortgagepersoncode() { + return this.mortgagepersoncode; + } + + /** + * Fija el valor de mortgagepersoncode + * + * @param pMortgagepersoncode nuevo Valor de mortgagepersoncode + */ + public void setMortgagepersoncode(Integer pMortgagepersoncode) { + this.mortgagepersoncode = pMortgagepersoncode; + } + + /** + * Obtiene el valor de mortgagename + * + * @return valor de mortgagename + */ + public String getMortgagename() { + return this.mortgagename; + } + + /** + * Fija el valor de mortgagename + * + * @param pMortgagename nuevo Valor de mortgagename + */ + public void setMortgagename(String pMortgagename) { + this.mortgagename = pMortgagename; + } + + /** + * Obtiene el valor de remark + * + * @return valor de remark + */ + public String getRemark() { + return this.remark; + } + + /** + * Fija el valor de remark + * + * @param pRemark nuevo Valor de remark + */ + public void setRemark(String pRemark) { + this.remark = pRemark; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPeopleOtherAssets)) { + return false; + } + TcustPeopleOtherAssets that = (TcustPeopleOtherAssets) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustPeopleOtherAssets + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustPeopleOtherAssets + */ + @Override + public Object createInstance() { + TcustPeopleOtherAssets instance = new TcustPeopleOtherAssets(); + instance.setPk(new TcustPeopleOtherAssetsKey()); + return instance; + } + + /** + * Clona la entidad TcustPeopleOtherAssets + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPeopleOtherAssets p = (TcustPeopleOtherAssets) this.clone(); + p.setPk((TcustPeopleOtherAssetsKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleOtherAssetsKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleOtherAssetsKey.java new file mode 100644 index 0000000..e50643f --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleOtherAssetsKey.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLEOTHERASSETS*/ +@Embeddable +public class TcustPeopleOtherAssetsKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="ASSETSSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del ingreso de la persona +*/ +private Integer assetssequence; + +/**Contructor por defecto*/ +public TcustPeopleOtherAssetsKey(){} +/**Contructor de TcustPeopleOtherAssetsKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pAssetssequence Secuencia del ingreso de la persona +*/ +public TcustPeopleOtherAssetsKey(Integer pPersoncode,Timestamp pDateto,Integer pAssetssequence){ + personcode=pPersoncode; + dateto=pDateto; + assetssequence=pAssetssequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de assetssequence +@return valor de assetssequence*/ +public Integer getAssetssequence(){ + return assetssequence; +} +/**Fija el valor de assetssequence +@param pAssetssequence nuevo Valor de assetssequence*/ +public void setAssetssequence(Integer pAssetssequence){ + assetssequence=pAssetssequence; +} + +/**Implementacin de la comparacin de TcustPeopleOtherAssetsKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleOtherAssetsKey))return false; + TcustPeopleOtherAssetsKey that = (TcustPeopleOtherAssetsKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getAssetssequence() == null || that.getAssetssequence() == null){ + return false; + } + if (! this.getAssetssequence().equals(that.getAssetssequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPeopleOtherAssetsKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getAssetssequence() == null ? 0 : this.getAssetssequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleRealAssets.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleRealAssets.java new file mode 100644 index 0000000..3ad0159 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleRealAssets.java @@ -0,0 +1,674 @@ +package com.fp.persistence.pcustomer.people; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTPEOPLEREALASSETS + */ +@Entity(name = "TcustPeopleRealAssets") +@Table(name = "TCUSTPEOPLEREALASSETS") +public class TcustPeopleRealAssets extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustPeopleRealAssets + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(ASSETSSEQUENCE),0)+1 from TCUSTPEOPLEREALASSETS where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "assetssequence")}) + @GeneratedValue(generator = "seq_id") + private TcustPeopleRealAssetsKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "REALASSETSTYPECATALOG", nullable = true) + /** + * Codigo de catalogo de tipos de bien 1, casa, 2 oficina, 3 terreno + */ + private String realassetstypecatalog; + @Column(name = "REALASSETSTYPECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo REALASSETSTYPE, del tipo de bien + */ + private String realassetstypecatalogcode; + @Column(name = "COUNTRYCODE", nullable = true) + /** + * Codigo de pais + */ + private String countrycode; + @Column(name = "PROVINCECODE", nullable = true) + /** + * Codigo de provincia + */ + private String provincecode; + @Column(name = "CANTONCODE", nullable = true) + /** + * Codigo de canton + */ + private String cantoncode; + @Column(name = "CITYCODE", nullable = true) + /** + * Codigo de cuidad + */ + private String citycode; + @Column(name = "LOCATION", nullable = true) + /** + * Ubicacion de la propiedad + */ + private String location; + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + @Column(name = "ASSESSMENT", nullable = true) + /** + * Valor del avaluo del bien + */ + private BigDecimal assessment; + @Column(name = "ASSESSMENTDATE", nullable = true) + /** + * Fecha de avaluo. + */ + private Date assessmentdate; + @Column(name = "MORTGAGEAMOUNT", nullable = true) + /** + * Monto original de la hipoteca + */ + private BigDecimal mortgageamount; + @Column(name = "MORTGAGEDATE", nullable = true) + /** + * Fecha de la hipoteca + */ + private Date mortgagedate; + @Column(name = "MORTGAGEBALANCE", nullable = true) + /** + * Saldo de la hipoteca + */ + private BigDecimal mortgagebalance; + @Column(name = "MORTGAGEPERSONCODE", nullable = true) + /** + * Codigo de persona a la que esta hipotecado el bien + */ + private Integer mortgagepersoncode; + @Column(name = "PARROQUIACODE", nullable = true) + /** + * Codigo de parroquia + */ + private String parroquiacode; + @Column(name = "MORTGAGENAME", nullable = true) + /** + * Nombre de la entidad poseedora de la hipoteca + */ + private String mortgagename; + @Column(name = "REMARK", nullable = true) + /** + * Comentario + */ + private String remark; + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String ingressusercode; + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String modifyusercode; + + /** + * Contructor por defecto + */ + public TcustPeopleRealAssets() { + } + + /** + * Contructor de TcustPeopleRealAssets + * + * @param pPk Clave Primaria del entity + */ + public TcustPeopleRealAssets(TcustPeopleRealAssetsKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPeopleRealAssets + */ + public static TcustPeopleRealAssets find(EntityManager pEntityManager, TcustPeopleRealAssetsKey pKey) throws Exception { + TcustPeopleRealAssets obj = pEntityManager.find(TcustPeopleRealAssets.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPeopleRealAssets + * + * @return El objeto que referencia a la Clave primaria de + * TcustPeopleRealAssets + */ + public TcustPeopleRealAssetsKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPeopleRealAssets + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustPeopleRealAssets + */ + public void setPk(TcustPeopleRealAssetsKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de realassetstypecatalog + * + * @return valor de realassetstypecatalog + */ + public String getRealassetstypecatalog() { + return this.realassetstypecatalog; + } + + /** + * Fija el valor de realassetstypecatalog + * + * @param pRealassetstypecatalog nuevo Valor de realassetstypecatalog + */ + public void setRealassetstypecatalog(String pRealassetstypecatalog) { + this.realassetstypecatalog = pRealassetstypecatalog; + } + + /** + * Obtiene el valor de realassetstypecatalogcode + * + * @return valor de realassetstypecatalogcode + */ + public String getRealassetstypecatalogcode() { + return this.realassetstypecatalogcode; + } + + /** + * Fija el valor de realassetstypecatalogcode + * + * @param pRealassetstypecatalogcode nuevo Valor de + * realassetstypecatalogcode + */ + public void setRealassetstypecatalogcode(String pRealassetstypecatalogcode) { + this.realassetstypecatalogcode = pRealassetstypecatalogcode; + } + + /** + * Obtiene el valor de countrycode + * + * @return valor de countrycode + */ + public String getCountrycode() { + return this.countrycode; + } + + /** + * Fija el valor de countrycode + * + * @param pCountrycode nuevo Valor de countrycode + */ + public void setCountrycode(String pCountrycode) { + this.countrycode = pCountrycode; + } + + /** + * Obtiene el valor de provincecode + * + * @return valor de provincecode + */ + public String getProvincecode() { + return this.provincecode; + } + + /** + * Fija el valor de provincecode + * + * @param pProvincecode nuevo Valor de provincecode + */ + public void setProvincecode(String pProvincecode) { + this.provincecode = pProvincecode; + } + + /** + * Obtiene el valor de cantoncode + * + * @return valor de cantoncode + */ + public String getCantoncode() { + return this.cantoncode; + } + + /** + * Fija el valor de cantoncode + * + * @param pCantoncode nuevo Valor de cantoncode + */ + public void setCantoncode(String pCantoncode) { + this.cantoncode = pCantoncode; + } + + /** + * Obtiene el valor de citycode + * + * @return valor de citycode + */ + public String getCitycode() { + return this.citycode; + } + + /** + * Fija el valor de citycode + * + * @param pCitycode nuevo Valor de citycode + */ + public void setCitycode(String pCitycode) { + this.citycode = pCitycode; + } + + /** + * Obtiene el valor de location + * + * @return valor de location + */ + public String getLocation() { + return this.location; + } + + /** + * Fija el valor de location + * + * @param pLocation nuevo Valor de location + */ + public void setLocation(String pLocation) { + this.location = pLocation; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de assessment + * + * @return valor de assessment + */ + public BigDecimal getAssessment() { + return this.assessment; + } + + /** + * Fija el valor de assessment + * + * @param pAssessment nuevo Valor de assessment + */ + public void setAssessment(BigDecimal pAssessment) { + this.assessment = pAssessment; + } + + /** + * Obtiene el valor de assessmentdate + * + * @return valor de assessmentdate + */ + public Date getAssessmentdate() { + return this.assessmentdate; + } + + /** + * Fija el valor de assessmentdate + * + * @param pAssessmentdate nuevo Valor de assessmentdate + */ + public void setAssessmentdate(Date pAssessmentdate) { + this.assessmentdate = pAssessmentdate; + } + + /** + * Obtiene el valor de mortgageamount + * + * @return valor de mortgageamount + */ + public BigDecimal getMortgageamount() { + return this.mortgageamount; + } + + /** + * Fija el valor de mortgageamount + * + * @param pMortgageamount nuevo Valor de mortgageamount + */ + public void setMortgageamount(BigDecimal pMortgageamount) { + this.mortgageamount = pMortgageamount; + } + + /** + * Obtiene el valor de mortgagedate + * + * @return valor de mortgagedate + */ + public Date getMortgagedate() { + return this.mortgagedate; + } + + /** + * Fija el valor de mortgagedate + * + * @param pMortgagedate nuevo Valor de mortgagedate + */ + public void setMortgagedate(Date pMortgagedate) { + this.mortgagedate = pMortgagedate; + } + + /** + * Obtiene el valor de mortgagebalance + * + * @return valor de mortgagebalance + */ + public BigDecimal getMortgagebalance() { + return this.mortgagebalance; + } + + /** + * Fija el valor de mortgagebalance + * + * @param pMortgagebalance nuevo Valor de mortgagebalance + */ + public void setMortgagebalance(BigDecimal pMortgagebalance) { + this.mortgagebalance = pMortgagebalance; + } + + /** + * Obtiene el valor de mortgagepersoncode + * + * @return valor de mortgagepersoncode + */ + public Integer getMortgagepersoncode() { + return this.mortgagepersoncode; + } + + /** + * Fija el valor de mortgagepersoncode + * + * @param pMortgagepersoncode nuevo Valor de mortgagepersoncode + */ + public void setMortgagepersoncode(Integer pMortgagepersoncode) { + this.mortgagepersoncode = pMortgagepersoncode; + } + + /** + * Obtiene el valor de parroquiacode + * + * @return valor de parroquiacode + */ + public String getParroquiacode() { + return this.parroquiacode; + } + + /** + * Fija el valor de parroquiacode + * + * @param pParroquiacode nuevo Valor de parroquiacode + */ + public void setParroquiacode(String pParroquiacode) { + this.parroquiacode = pParroquiacode; + } + + /** + * Obtiene el valor de mortgagename + * + * @return valor de mortgagename + */ + public String getMortgagename() { + return this.mortgagename; + } + + /** + * Fija el valor de mortgagename + * + * @param pMortgagename nuevo Valor de mortgagename + */ + public void setMortgagename(String pMortgagename) { + this.mortgagename = pMortgagename; + } + + /** + * Obtiene el valor de remark + * + * @return valor de remark + */ + public String getRemark() { + return this.remark; + } + + /** + * Fija el valor de remark + * + * @param pRemark nuevo Valor de remark + */ + public void setRemark(String pRemark) { + this.remark = pRemark; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPeopleRealAssets)) { + return false; + } + TcustPeopleRealAssets that = (TcustPeopleRealAssets) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad + * TcustPeopleRealAssets + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco + * TcustPeopleRealAssets + */ + @Override + public Object createInstance() { + TcustPeopleRealAssets instance = new TcustPeopleRealAssets(); + instance.setPk(new TcustPeopleRealAssetsKey()); + return instance; + } + + /** + * Clona la entidad TcustPeopleRealAssets + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPeopleRealAssets p = (TcustPeopleRealAssets) this.clone(); + p.setPk((TcustPeopleRealAssetsKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleRealAssetsKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleRealAssetsKey.java new file mode 100644 index 0000000..63abc5b --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleRealAssetsKey.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLEREALASSETS*/ +@Embeddable +public class TcustPeopleRealAssetsKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="ASSETSSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del ingreso de la persona +*/ +private Integer assetssequence; + +/**Contructor por defecto*/ +public TcustPeopleRealAssetsKey(){} +/**Contructor de TcustPeopleRealAssetsKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pAssetssequence Secuencia del ingreso de la persona +*/ +public TcustPeopleRealAssetsKey(Integer pPersoncode,Timestamp pDateto,Integer pAssetssequence){ + personcode=pPersoncode; + dateto=pDateto; + assetssequence=pAssetssequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de assetssequence +@return valor de assetssequence*/ +public Integer getAssetssequence(){ + return assetssequence; +} +/**Fija el valor de assetssequence +@param pAssetssequence nuevo Valor de assetssequence*/ +public void setAssetssequence(Integer pAssetssequence){ + assetssequence=pAssetssequence; +} + +/**Implementacin de la comparacin de TcustPeopleRealAssetsKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleRealAssetsKey))return false; + TcustPeopleRealAssetsKey that = (TcustPeopleRealAssetsKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getAssetssequence() == null || that.getAssetssequence() == null){ + return false; + } + if (! this.getAssetssequence().equals(that.getAssetssequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPeopleRealAssetsKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getAssetssequence() == null ? 0 : this.getAssetssequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleTradereferences.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleTradereferences.java new file mode 100644 index 0000000..d79c115 --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleTradereferences.java @@ -0,0 +1,573 @@ +package com.fp.persistence.pcustomer.people; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TCUSTPEOPLETRADEREFERENCES + */ +@Entity(name = "TcustPeopleTradereferences") +@Table(name = "TCUSTPEOPLETRADEREFERENCES") +public class TcustPeopleTradereferences extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TcustPeopleTradereferences + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(TRADESEQUENCE),0)+1 from TCUSTPEOPLETRADEREFERENCES where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "tradesequence") }) + @GeneratedValue(generator = "seq_id") + private TcustPeopleTradereferencesKey pk; + + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "ITEM", nullable = true) + /** + * Descripcion del articulo comprado. + */ + private String item; + + @Column(name = "PURCHASEYEAR", nullable = true) + /** + * Anio en que se realizo la compra + */ + private String purchaseyear; + + @Column(name = "PAYMENTMETHODCATALOG", nullable = true) + /** + * Codigo de catalogo de metodo de pago 1 Efectivo, 2 Cheques, 3 tarjeta de + * credito + */ + private String paymentmethodcatalog; + + @Column(name = "PAYMENTMETHODCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo PAYMENTMETHOD, metodo de pago + */ + private String paymentmethodcatalogcode; + + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda de la compra + */ + private String currencycode; + + @Column(name = "AMOUNT", nullable = true) + /** + * Monto total de la compra + */ + private BigDecimal amount; + + @Column(name = "INPUTAMOUNT", nullable = true) + /** + * Monto de entrada + */ + private BigDecimal inputamount; + + @Column(name = "QUOTASNUMBER", nullable = true) + /** + * Numero de cuotas pactadas si se compro a plazo + */ + private Integer quotasnumber; + + @Column(name = "QUOTAVALUE", nullable = true) + /** + * Monto de la cuota pactada + */ + private BigDecimal quotavalue; + + @Column(name = "TRADEPERSONCODE", nullable = true) + /** + * Codigo de persona asociada a la empresa casa cmercial en donde el cliente + * realizo la compra + */ + private Integer tradepersoncode; + + @Column(name = "TRADENAME", nullable = true) + /** + * Nombre del establesimiento comercial, si no esta registrado en la base de + * personas + */ + private String tradename; + + @Column(name = "TRADEPHONE", nullable = true) + /** + * Telefono asociado al establesimiento comercial si no esta registrado como + * una persona + */ + private String tradephone; + + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String ingressusercode; + + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String modifyusercode; + + /** + * Contructor por defecto + */ + public TcustPeopleTradereferences() { + } + + /** + * Contructor de TcustPeopleTradereferences + * + * @param pPk Clave Primaria del entity + */ + public TcustPeopleTradereferences(TcustPeopleTradereferencesKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPeopleTradereferences + */ + public static TcustPeopleTradereferences find(EntityManager pEntityManager, TcustPeopleTradereferencesKey pKey) throws Exception { + TcustPeopleTradereferences obj = pEntityManager.find(TcustPeopleTradereferences.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPeopleTradereferences + * + * @return El objeto que referencia a la Clave primaria de TcustPeopleTradereferences + */ + public TcustPeopleTradereferencesKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPeopleTradereferences + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TcustPeopleTradereferences + */ + public void setPk(TcustPeopleTradereferencesKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de item + * + * @return valor de item + */ + public String getItem() { + return this.item; + } + + /** + * Fija el valor de item + * + * @param pItem nuevo Valor de item + */ + public void setItem(String pItem) { + this.item = pItem; + } + + /** + * Obtiene el valor de purchaseyear + * + * @return valor de purchaseyear + */ + public String getPurchaseyear() { + return this.purchaseyear; + } + + /** + * Fija el valor de purchaseyear + * + * @param pPurchaseyear nuevo Valor de purchaseyear + */ + public void setPurchaseyear(String pPurchaseyear) { + this.purchaseyear = pPurchaseyear; + } + + /** + * Obtiene el valor de paymentmethodcatalog + * + * @return valor de paymentmethodcatalog + */ + public String getPaymentmethodcatalog() { + return this.paymentmethodcatalog; + } + + /** + * Fija el valor de paymentmethodcatalog + * + * @param pPaymentmethodcatalog nuevo Valor de paymentmethodcatalog + */ + public void setPaymentmethodcatalog(String pPaymentmethodcatalog) { + this.paymentmethodcatalog = pPaymentmethodcatalog; + } + + /** + * Obtiene el valor de paymentmethodcatalogcode + * + * @return valor de paymentmethodcatalogcode + */ + public String getPaymentmethodcatalogcode() { + return this.paymentmethodcatalogcode; + } + + /** + * Fija el valor de paymentmethodcatalogcode + * + * @param pPaymentmethodcatalogcode nuevo Valor de paymentmethodcatalogcode + */ + public void setPaymentmethodcatalogcode(String pPaymentmethodcatalogcode) { + this.paymentmethodcatalogcode = pPaymentmethodcatalogcode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de amount + * + * @return valor de amount + */ + public BigDecimal getAmount() { + return this.amount; + } + + /** + * Fija el valor de amount + * + * @param pAmount nuevo Valor de amount + */ + public void setAmount(BigDecimal pAmount) { + this.amount = pAmount; + } + + /** + * Obtiene el valor de inputamount + * + * @return valor de inputamount + */ + public BigDecimal getInputamount() { + return this.inputamount; + } + + /** + * Fija el valor de inputamount + * + * @param pInputamount nuevo Valor de inputamount + */ + public void setInputamount(BigDecimal pInputamount) { + this.inputamount = pInputamount; + } + + /** + * Obtiene el valor de quotasnumber + * + * @return valor de quotasnumber + */ + public Integer getQuotasnumber() { + return this.quotasnumber; + } + + /** + * Fija el valor de quotasnumber + * + * @param pQuotasnumber nuevo Valor de quotasnumber + */ + public void setQuotasnumber(Integer pQuotasnumber) { + this.quotasnumber = pQuotasnumber; + } + + /** + * Obtiene el valor de quotavalue + * + * @return valor de quotavalue + */ + public BigDecimal getQuotavalue() { + return this.quotavalue; + } + + /** + * Fija el valor de quotavalue + * + * @param pQuotavalue nuevo Valor de quotavalue + */ + public void setQuotavalue(BigDecimal pQuotavalue) { + this.quotavalue = pQuotavalue; + } + + /** + * Obtiene el valor de tradepersoncode + * + * @return valor de tradepersoncode + */ + public Integer getTradepersoncode() { + return this.tradepersoncode; + } + + /** + * Fija el valor de tradepersoncode + * + * @param pTradepersoncode nuevo Valor de tradepersoncode + */ + public void setTradepersoncode(Integer pTradepersoncode) { + this.tradepersoncode = pTradepersoncode; + } + + /** + * Obtiene el valor de tradename + * + * @return valor de tradename + */ + public String getTradename() { + return this.tradename; + } + + /** + * Fija el valor de tradename + * + * @param pTradename nuevo Valor de tradename + */ + public void setTradename(String pTradename) { + this.tradename = pTradename; + } + + /** + * Obtiene el valor de tradephone + * + * @return valor de tradephone + */ + public String getTradephone() { + return this.tradephone; + } + + /** + * Fija el valor de tradephone + * + * @param pTradephone nuevo Valor de tradephone + */ + public void setTradephone(String pTradephone) { + this.tradephone = pTradephone; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPeopleTradereferences)) { + return false; + } + TcustPeopleTradereferences that = (TcustPeopleTradereferences) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustPeopleTradereferences + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustPeopleTradereferences + */ + @Override + public Object createInstance() { + TcustPeopleTradereferences instance = new TcustPeopleTradereferences(); + instance.setPk(new TcustPeopleTradereferencesKey()); + return instance; + } + + /** + * Clona la entidad TcustPeopleTradereferences + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPeopleTradereferences p = (TcustPeopleTradereferences) this.clone(); + p.setPk((TcustPeopleTradereferencesKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleTradereferencesKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleTradereferencesKey.java new file mode 100644 index 0000000..ce18acf --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleTradereferencesKey.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLETRADEREFERENCES*/ +@Embeddable +public class TcustPeopleTradereferencesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="TRADESEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de la referencia comercial +*/ +private Integer tradesequence; + +/**Contructor por defecto*/ +public TcustPeopleTradereferencesKey(){} +/**Contructor de TcustPeopleTradereferencesKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pTradesequence Secuencia de la referencia comercial +*/ +public TcustPeopleTradereferencesKey(Integer pPersoncode,Timestamp pDateto,Integer pTradesequence){ + personcode=pPersoncode; + dateto=pDateto; + tradesequence=pTradesequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de tradesequence +@return valor de tradesequence*/ +public Integer getTradesequence(){ + return tradesequence; +} +/**Fija el valor de tradesequence +@param pTradesequence nuevo Valor de tradesequence*/ +public void setTradesequence(Integer pTradesequence){ + tradesequence=pTradesequence; +} + +/**Implementacin de la comparacin de TcustPeopleTradereferencesKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleTradereferencesKey))return false; + TcustPeopleTradereferencesKey that = (TcustPeopleTradereferencesKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getTradesequence() == null || that.getTradesequence() == null){ + return false; + } + if (! this.getTradesequence().equals(that.getTradesequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPeopleTradereferencesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getTradesequence() == null ? 0 : this.getTradesequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleVehicle.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleVehicle.java new file mode 100644 index 0000000..24ba3bf --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleVehicle.java @@ -0,0 +1,694 @@ +package com.fp.persistence.pcustomer.people; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TCUSTPEOPLEVEHICLE + */ +@Entity(name = "TcustPeopleVehicle") +@Table(name = "TCUSTPEOPLEVEHICLE") +public class TcustPeopleVehicle extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TcustPeopleVehicle + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(VEHICLESEQUENCE),0)+1 from TCUSTPEOPLEVEHICLE where personcode=:code"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "code,pk.personcode"), + @Parameter(name = "field", value = "vehiclesequence")}) + @GeneratedValue(generator = "seq_id") + private TcustPeopleVehicleKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "VEHICLETYPECATALOG", nullable = true) + /** + * Codigo de catalogo 1 sedan, 2 coupe, 3 camioneta, 4 furgoneta, 5 suv + */ + private String vehicletypecatalog; + @Column(name = "VEHICLETYPECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo VEHICLETYPE tipo de vehiculo + */ + private String vehicletypecatalogcode; + @Column(name = "CARBRANDSCATALOG", nullable = true) + /** + * Codigo de catalogo 1, chevrolet, 2 Bmw, 3 Audi, 4 Ferrari + */ + private String carbrandscatalog; + @Column(name = "CARBRANDSCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo CARBRANDS, marca de auto + */ + private String carbrandscatalogcode; + @Column(name = "MODEL", nullable = true) + /** + * Modelo del vehiculo, ejemplo marca Mazda, modelo 323 + */ + private String model; + @Column(name = "YEAR", nullable = true) + /** + * Anio de fabricacion del vehiculo + */ + private String year; + @Column(name = "MOTORID", nullable = true) + /** + * Numero de motor + */ + private String motorid; + @Column(name = "PLATE", nullable = true) + /** + * Numero de placa + */ + private String plate; + @Column(name = "COLOR", nullable = true) + /** + * Color del vehiculo + */ + private String color; + @Column(name = "ASSESSMENT", nullable = true) + /** + * Avaluo del vehiculo + */ + private BigDecimal assessment; + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + @Column(name = "INPUNTAMOUNT", nullable = true) + /** + * Valor de entrada + */ + private BigDecimal inpuntamount; + @Column(name = "PLEDGEDAMOUNT", nullable = true) + /** + * Valor financiado sobre el cual se constiruye la prenda + */ + private BigDecimal pledgedamount; + @Column(name = "PLEDGEDDATE", nullable = true) + /** + * Saldo del financiamiento + */ + private Date pledgeddate; + @Column(name = "PLEDGEDBALANCE", nullable = true) + /** + * Fecha en la que se ingreso el saldo de la deuda. + */ + private BigDecimal pledgedbalance; + @Column(name = "PLEDGEDPERSONCODE", nullable = true) + /** + * Codigo de persona poseedora de la prena del vehiculo + */ + private Integer pledgedpersoncode; + @Column(name = "PLEDGEDNAME", nullable = true) + /** + * Nombre la entidad beneficiaria de la prenda. + */ + private String pledgedname; + @Column(name = "REMARK", nullable = true) + /** + * Comentario, texto libre. + */ + private String remark; + @Column(name = "INGRESSUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String ingressusercode; + @Column(name = "MODIFYUSERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String modifyusercode; + + /** + * Contructor por defecto + */ + public TcustPeopleVehicle() { + } + + /** + * Contructor de TcustPeopleVehicle + * + * @param pPk Clave Primaria del entity + */ + public TcustPeopleVehicle(TcustPeopleVehicleKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TcustPeopleVehicle + */ + public static TcustPeopleVehicle find(EntityManager pEntityManager, TcustPeopleVehicleKey pKey) throws Exception { + TcustPeopleVehicle obj = pEntityManager.find(TcustPeopleVehicle.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TcustPeopleVehicle + * + * @return El objeto que referencia a la Clave primaria de + * TcustPeopleVehicle + */ + public TcustPeopleVehicleKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TcustPeopleVehicle + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TcustPeopleVehicle + */ + public void setPk(TcustPeopleVehicleKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de vehicletypecatalog + * + * @return valor de vehicletypecatalog + */ + public String getVehicletypecatalog() { + return this.vehicletypecatalog; + } + + /** + * Fija el valor de vehicletypecatalog + * + * @param pVehicletypecatalog nuevo Valor de vehicletypecatalog + */ + public void setVehicletypecatalog(String pVehicletypecatalog) { + this.vehicletypecatalog = pVehicletypecatalog; + } + + /** + * Obtiene el valor de vehicletypecatalogcode + * + * @return valor de vehicletypecatalogcode + */ + public String getVehicletypecatalogcode() { + return this.vehicletypecatalogcode; + } + + /** + * Fija el valor de vehicletypecatalogcode + * + * @param pVehicletypecatalogcode nuevo Valor de vehicletypecatalogcode + */ + public void setVehicletypecatalogcode(String pVehicletypecatalogcode) { + this.vehicletypecatalogcode = pVehicletypecatalogcode; + } + + /** + * Obtiene el valor de carbrandscatalog + * + * @return valor de carbrandscatalog + */ + public String getCarbrandscatalog() { + return this.carbrandscatalog; + } + + /** + * Fija el valor de carbrandscatalog + * + * @param pCarbrandscatalog nuevo Valor de carbrandscatalog + */ + public void setCarbrandscatalog(String pCarbrandscatalog) { + this.carbrandscatalog = pCarbrandscatalog; + } + + /** + * Obtiene el valor de carbrandscatalogcode + * + * @return valor de carbrandscatalogcode + */ + public String getCarbrandscatalogcode() { + return this.carbrandscatalogcode; + } + + /** + * Fija el valor de carbrandscatalogcode + * + * @param pCarbrandscatalogcode nuevo Valor de carbrandscatalogcode + */ + public void setCarbrandscatalogcode(String pCarbrandscatalogcode) { + this.carbrandscatalogcode = pCarbrandscatalogcode; + } + + /** + * Obtiene el valor de model + * + * @return valor de model + */ + public String getModel() { + return this.model; + } + + /** + * Fija el valor de model + * + * @param pModel nuevo Valor de model + */ + public void setModel(String pModel) { + this.model = pModel; + } + + /** + * Obtiene el valor de year + * + * @return valor de year + */ + public String getYear() { + return this.year; + } + + /** + * Fija el valor de year + * + * @param pYear nuevo Valor de year + */ + public void setYear(String pYear) { + this.year = pYear; + } + + /** + * Obtiene el valor de motorid + * + * @return valor de motorid + */ + public String getMotorid() { + return this.motorid; + } + + /** + * Fija el valor de motorid + * + * @param pMotorid nuevo Valor de motorid + */ + public void setMotorid(String pMotorid) { + this.motorid = pMotorid; + } + + /** + * Obtiene el valor de plate + * + * @return valor de plate + */ + public String getPlate() { + return this.plate; + } + + /** + * Fija el valor de plate + * + * @param pPlate nuevo Valor de plate + */ + public void setPlate(String pPlate) { + this.plate = pPlate; + } + + /** + * Obtiene el valor de color + * + * @return valor de color + */ + public String getColor() { + return this.color; + } + + /** + * Fija el valor de color + * + * @param pColor nuevo Valor de color + */ + public void setColor(String pColor) { + this.color = pColor; + } + + /** + * Obtiene el valor de assessment + * + * @return valor de assessment + */ + public BigDecimal getAssessment() { + return this.assessment; + } + + /** + * Fija el valor de assessment + * + * @param pAssessment nuevo Valor de assessment + */ + public void setAssessment(BigDecimal pAssessment) { + this.assessment = pAssessment; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de inpuntamount + * + * @return valor de inpuntamount + */ + public BigDecimal getInpuntamount() { + return this.inpuntamount; + } + + /** + * Fija el valor de inpuntamount + * + * @param pInpuntamount nuevo Valor de inpuntamount + */ + public void setInpuntamount(BigDecimal pInpuntamount) { + this.inpuntamount = pInpuntamount; + } + + /** + * Obtiene el valor de pledgedamount + * + * @return valor de pledgedamount + */ + public BigDecimal getPledgedamount() { + return this.pledgedamount; + } + + /** + * Fija el valor de pledgedamount + * + * @param pPledgedamount nuevo Valor de pledgedamount + */ + public void setPledgedamount(BigDecimal pPledgedamount) { + this.pledgedamount = pPledgedamount; + } + + /** + * Obtiene el valor de pledgeddate + * + * @return valor de pledgeddate + */ + public Date getPledgeddate() { + return this.pledgeddate; + } + + /** + * Fija el valor de pledgeddate + * + * @param pPledgeddate nuevo Valor de pledgeddate + */ + public void setPledgeddate(Date pPledgeddate) { + this.pledgeddate = pPledgeddate; + } + + /** + * Obtiene el valor de pledgedbalance + * + * @return valor de pledgedbalance + */ + public BigDecimal getPledgedbalance() { + return this.pledgedbalance; + } + + /** + * Fija el valor de pledgedbalance + * + * @param pPledgedbalance nuevo Valor de pledgedbalance + */ + public void setPledgedbalance(BigDecimal pPledgedbalance) { + this.pledgedbalance = pPledgedbalance; + } + + /** + * Obtiene el valor de pledgedpersoncode + * + * @return valor de pledgedpersoncode + */ + public Integer getPledgedpersoncode() { + return this.pledgedpersoncode; + } + + /** + * Fija el valor de pledgedpersoncode + * + * @param pPledgedpersoncode nuevo Valor de pledgedpersoncode + */ + public void setPledgedpersoncode(Integer pPledgedpersoncode) { + this.pledgedpersoncode = pPledgedpersoncode; + } + + /** + * Obtiene el valor de pledgedname + * + * @return valor de pledgedname + */ + public String getPledgedname() { + return this.pledgedname; + } + + /** + * Fija el valor de pledgedname + * + * @param pPledgedname nuevo Valor de pledgedname + */ + public void setPledgedname(String pPledgedname) { + this.pledgedname = pPledgedname; + } + + /** + * Obtiene el valor de remark + * + * @return valor de remark + */ + public String getRemark() { + return this.remark; + } + + /** + * Fija el valor de remark + * + * @param pRemark nuevo Valor de remark + */ + public void setRemark(String pRemark) { + this.remark = pRemark; + } + + /** + * Obtiene el valor de ingressusercode + * + * @return valor de ingressusercode + */ + public String getIngressusercode() { + return this.ingressusercode; + } + + /** + * Fija el valor de ingressusercode + * + * @param pIngressusercode nuevo Valor de ingressusercode + */ + public void setIngressusercode(String pIngressusercode) { + this.ingressusercode = pIngressusercode; + } + + /** + * Obtiene el valor de modifyusercode + * + * @return valor de modifyusercode + */ + public String getModifyusercode() { + return this.modifyusercode; + } + + /** + * Fija el valor de modifyusercode + * + * @param pModifyusercode nuevo Valor de modifyusercode + */ + public void setModifyusercode(String pModifyusercode) { + this.modifyusercode = pModifyusercode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TcustPeopleVehicle)) { + return false; + } + TcustPeopleVehicle that = (TcustPeopleVehicle) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementaci�n del metodo hashCode de la la entidad TcustPeopleVehicle + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementaci�n de la creaci�n de un bean en blanco TcustPeopleVehicle + */ + @Override + public Object createInstance() { + TcustPeopleVehicle instance = new TcustPeopleVehicle(); + instance.setPk(new TcustPeopleVehicleKey()); + return instance; + } + + /** + * Clona la entidad TcustPeopleVehicle + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TcustPeopleVehicle p = (TcustPeopleVehicle) this.clone(); + p.setPk((TcustPeopleVehicleKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } +} diff --git a/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleVehicleKey.java b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleVehicleKey.java new file mode 100644 index 0000000..9441c5a --- /dev/null +++ b/base/persistence/pcustomer/src/main/java/com/fp/persistence/pcustomer/people/TcustPeopleVehicleKey.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pcustomer.people; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TCUSTPEOPLEVEHICLE*/ +@Embeddable +public class TcustPeopleVehicleKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +@Column(name="VEHICLESEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de vehiculo asociado a una persona +*/ +private Integer vehiclesequence; + +/**Contructor por defecto*/ +public TcustPeopleVehicleKey(){} +/**Contructor de TcustPeopleVehicleKey +@param pPersoncode Codigo de persona +@param pDateto Fecha hasta la cual esta vigente el registro +@param pVehiclesequence Secuencia de vehiculo asociado a una persona +*/ +public TcustPeopleVehicleKey(Integer pPersoncode,Timestamp pDateto,Integer pVehiclesequence){ + personcode=pPersoncode; + dateto=pDateto; + vehiclesequence=pVehiclesequence; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de vehiclesequence +@return valor de vehiclesequence*/ +public Integer getVehiclesequence(){ + return vehiclesequence; +} +/**Fija el valor de vehiclesequence +@param pVehiclesequence nuevo Valor de vehiclesequence*/ +public void setVehiclesequence(Integer pVehiclesequence){ + vehiclesequence=pVehiclesequence; +} + +/**Implementacin de la comparacin de TcustPeopleVehicleKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TcustPeopleVehicleKey))return false; + TcustPeopleVehicleKey that = (TcustPeopleVehicleKey) o; + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getVehiclesequence() == null || that.getVehiclesequence() == null){ + return false; + } + if (! this.getVehiclesequence().equals(that.getVehiclesequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TcustPeopleVehicleKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getVehiclesequence() == null ? 0 : this.getVehiclesequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pcustomer/src/main/resources/.svn/entries b/base/persistence/pcustomer/src/main/resources/.svn/entries new file mode 100644 index 0000000..15373de --- /dev/null +++ b/base/persistence/pcustomer/src/main/resources/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pcustomer/src/main/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustBalance.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustBalance.class new file mode 100644 index 0000000..865f5b7 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustBalance.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustBalanceAccoLevel.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustBalanceAccoLevel.class new file mode 100644 index 0000000..48a912b Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustBalanceAccoLevel.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustBalanceAccount.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustBalanceAccount.class new file mode 100644 index 0000000..045c275 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustBalanceAccount.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustBalanceAccountKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustBalanceAccountKey.class new file mode 100644 index 0000000..d26d8dc Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustBalanceAccountKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustBalanceFinancial.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustBalanceFinancial.class new file mode 100644 index 0000000..cf75551 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustBalanceFinancial.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustBalanceFinancialKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustBalanceFinancialKey.class new file mode 100644 index 0000000..3184acf Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustBalanceFinancialKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustBalanceKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustBalanceKey.class new file mode 100644 index 0000000..ca13ede Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustBalanceKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustPersonBalance.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustPersonBalance.class new file mode 100644 index 0000000..d5208e6 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustPersonBalance.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustPersonBalanceKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustPersonBalanceKey.class new file mode 100644 index 0000000..f7ecdbe Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/balance/TcustPersonBalanceKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustAppraiser.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustAppraiser.class new file mode 100644 index 0000000..f06aa99 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustAppraiser.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustAppraiserKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustAppraiserKey.class new file mode 100644 index 0000000..3faba20 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustAppraiserKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompany.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompany.class new file mode 100644 index 0000000..4572579 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompany.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyBranch.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyBranch.class new file mode 100644 index 0000000..5c5c942 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyBranch.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyBranchKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyBranchKey.class new file mode 100644 index 0000000..5419964 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyBranchKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyClient.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyClient.class new file mode 100644 index 0000000..778aefd Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyClient.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyClientKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyClientKey.class new file mode 100644 index 0000000..8674b4e Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyClientKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyFinancial.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyFinancial.class new file mode 100644 index 0000000..112c66d Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyFinancial.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyFinancialKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyFinancialKey.class new file mode 100644 index 0000000..9cbe32f Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyFinancialKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyKey.class new file mode 100644 index 0000000..5b51b45 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyManagers.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyManagers.class new file mode 100644 index 0000000..bfab96d Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyManagers.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyManagersKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyManagersKey.class new file mode 100644 index 0000000..70fb797 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyManagersKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyProducts.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyProducts.class new file mode 100644 index 0000000..c6066b9 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyProducts.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyProductsKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyProductsKey.class new file mode 100644 index 0000000..40efc2e Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyProductsKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyProvider.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyProvider.class new file mode 100644 index 0000000..dfb0373 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyProvider.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyProviderKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyProviderKey.class new file mode 100644 index 0000000..b9d678c Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustCompanyProviderKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustEconomicGroup.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustEconomicGroup.class new file mode 100644 index 0000000..6714ec3 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustEconomicGroup.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustEconomicGroupKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustEconomicGroupKey.class new file mode 100644 index 0000000..b51fc3b Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustEconomicGroupKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustFamiliarlLink.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustFamiliarlLink.class new file mode 100644 index 0000000..f0d47c3 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustFamiliarlLink.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustFamiliarlLinkKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustFamiliarlLinkKey.class new file mode 100644 index 0000000..8866387 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustFamiliarlLinkKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustFinancialInstitutions.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustFinancialInstitutions.class new file mode 100644 index 0000000..0083255 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustFinancialInstitutions.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustInsurance.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustInsurance.class new file mode 100644 index 0000000..33b2da2 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustInsurance.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustLegalLink.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustLegalLink.class new file mode 100644 index 0000000..b65fc1d Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustLegalLink.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustLegalLinkKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustLegalLinkKey.class new file mode 100644 index 0000000..a79f363 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustLegalLinkKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustNotaryOffice.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustNotaryOffice.class new file mode 100644 index 0000000..5aaecab Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustNotaryOffice.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustSupervisor.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustSupervisor.class new file mode 100644 index 0000000..d809951 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/company/TcustSupervisor.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPerson.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPerson.class new file mode 100644 index 0000000..8b6896c Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPerson.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonAddress.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonAddress.class new file mode 100644 index 0000000..c0a127b Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonAddress.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonAddressKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonAddressKey.class new file mode 100644 index 0000000..677d17b Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonAddressKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonBankReference.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonBankReference.class new file mode 100644 index 0000000..f350b3f Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonBankReference.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonBankReferenceKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonBankReferenceKey.class new file mode 100644 index 0000000..a146a62 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonBankReferenceKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonDetail.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonDetail.class new file mode 100644 index 0000000..314947f Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonDetail.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonDetailKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonDetailKey.class new file mode 100644 index 0000000..ad109ec Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonDetailKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonParametersId.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonParametersId.class new file mode 100644 index 0000000..e6c3423 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonParametersId.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonPersonalReference.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonPersonalReference.class new file mode 100644 index 0000000..1f793ab Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonPersonalReference.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonPersonalReferenceKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonPersonalReferenceKey.class new file mode 100644 index 0000000..57997d7 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonPersonalReferenceKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonPhone.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonPhone.class new file mode 100644 index 0000000..4624e07 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonPhone.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonPhoneKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonPhoneKey.class new file mode 100644 index 0000000..e86c854 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TcustPersonPhoneKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TgeneActivity.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TgeneActivity.class new file mode 100644 index 0000000..7ff5d37 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TgeneActivity.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TgeneCiiu.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TgeneCiiu.class new file mode 100644 index 0000000..3ea3efe Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/gene/TgeneCiiu.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeople.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeople.class new file mode 100644 index 0000000..55c7521 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeople.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleAditionalData.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleAditionalData.class new file mode 100644 index 0000000..172dda7 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleAditionalData.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleAditionalDataKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleAditionalDataKey.class new file mode 100644 index 0000000..70c5ecd Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleAditionalDataKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleAssociation.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleAssociation.class new file mode 100644 index 0000000..f129f0c Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleAssociation.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleAssociationKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleAssociationKey.class new file mode 100644 index 0000000..8c86208 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleAssociationKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleExpenses.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleExpenses.class new file mode 100644 index 0000000..48befab Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleExpenses.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleExpensesKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleExpensesKey.class new file mode 100644 index 0000000..e8be673 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleExpensesKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleFixedIncome.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleFixedIncome.class new file mode 100644 index 0000000..d5e1fa5 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleFixedIncome.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleFixedIncomeKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleFixedIncomeKey.class new file mode 100644 index 0000000..385d5a8 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleFixedIncomeKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleIncome.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleIncome.class new file mode 100644 index 0000000..9d3cd12 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleIncome.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleIncomeKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleIncomeKey.class new file mode 100644 index 0000000..67008a6 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleIncomeKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleJob.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleJob.class new file mode 100644 index 0000000..1630259 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleJob.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleJobKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleJobKey.class new file mode 100644 index 0000000..8f633af Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleJobKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleKey.class new file mode 100644 index 0000000..58a705c Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleLoan.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleLoan.class new file mode 100644 index 0000000..1374766 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleLoan.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleLoanKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleLoanKey.class new file mode 100644 index 0000000..abb104c Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleLoanKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleOtherAssets.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleOtherAssets.class new file mode 100644 index 0000000..3041d15 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleOtherAssets.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleOtherAssetsKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleOtherAssetsKey.class new file mode 100644 index 0000000..5baad6b Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleOtherAssetsKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleRealAssets.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleRealAssets.class new file mode 100644 index 0000000..4481dac Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleRealAssets.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleRealAssetsKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleRealAssetsKey.class new file mode 100644 index 0000000..f233853 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleRealAssetsKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleTradereferences.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleTradereferences.class new file mode 100644 index 0000000..bf6698b Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleTradereferences.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleTradereferencesKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleTradereferencesKey.class new file mode 100644 index 0000000..1a9b873 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleTradereferencesKey.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleVehicle.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleVehicle.class new file mode 100644 index 0000000..dfdd4d9 Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleVehicle.class differ diff --git a/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleVehicleKey.class b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleVehicleKey.class new file mode 100644 index 0000000..30be0ac Binary files /dev/null and b/base/persistence/pcustomer/target/classes/com/fp/persistence/pcustomer/people/TcustPeopleVehicleKey.class differ diff --git a/base/persistence/pcustomer/target/maven-archiver/pom.properties b/base/persistence/pcustomer/target/maven-archiver/pom.properties new file mode 100644 index 0000000..53d24eb --- /dev/null +++ b/base/persistence/pcustomer/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:52:52 ECT 2022 +version=2.1 +groupId=com.fp.base.persistence +artifactId=pcustomer diff --git a/base/persistence/pcustomer/target/pcustomer-2.1.jar b/base/persistence/pcustomer/target/pcustomer-2.1.jar new file mode 100644 index 0000000..11f3dcc Binary files /dev/null and b/base/persistence/pcustomer/target/pcustomer-2.1.jar differ diff --git a/base/persistence/pfirmas/.svn/dir-prop-base b/base/persistence/pfirmas/.svn/dir-prop-base new file mode 100644 index 0000000..40820ff --- /dev/null +++ b/base/persistence/pfirmas/.svn/dir-prop-base @@ -0,0 +1,6 @@ +K 10 +svn:ignore +V 7 +target + +END diff --git a/base/persistence/pfirmas/.svn/entries b/base/persistence/pfirmas/.svn/entries new file mode 100644 index 0000000..0178021 --- /dev/null +++ b/base/persistence/pfirmas/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pfirmas +svn://172.17.26.185/COMACO + + + +2014-10-17T05:34:35.839741Z +1670 +jvaca +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:26.042731Z +75eb8ea009d126c0655aac162d347e0f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +549 + diff --git a/base/persistence/pfirmas/.svn/text-base/pom.xml.svn-base b/base/persistence/pfirmas/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..66a9bb2 --- /dev/null +++ b/base/persistence/pfirmas/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,17 @@ + + + 4.0.0 + + + com.fp.base + persistence + 2.1 + + com.fp.base.persistence + pfirmas + pfirmas + + + + diff --git a/base/persistence/pfirmas/pom.xml b/base/persistence/pfirmas/pom.xml new file mode 100644 index 0000000..66a9bb2 --- /dev/null +++ b/base/persistence/pfirmas/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + + com.fp.base + persistence + 2.1 + + com.fp.base.persistence + pfirmas + pfirmas + + + + diff --git a/base/persistence/pfirmas/src/.svn/entries b/base/persistence/pfirmas/src/.svn/entries new file mode 100644 index 0000000..decaaed --- /dev/null +++ b/base/persistence/pfirmas/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pfirmas/src +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/base/persistence/pfirmas/src/main/.svn/entries b/base/persistence/pfirmas/src/main/.svn/entries new file mode 100644 index 0000000..31b5a11 --- /dev/null +++ b/base/persistence/pfirmas/src/main/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pfirmas/src/main +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + diff --git a/base/persistence/pfirmas/src/main/java/.svn/entries b/base/persistence/pfirmas/src/main/java/.svn/entries new file mode 100644 index 0000000..b14e768 --- /dev/null +++ b/base/persistence/pfirmas/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pfirmas/src/main/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/persistence/pfirmas/src/main/java/com/.svn/entries b/base/persistence/pfirmas/src/main/java/com/.svn/entries new file mode 100644 index 0000000..ec61bd0 --- /dev/null +++ b/base/persistence/pfirmas/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pfirmas/src/main/java/com +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/persistence/pfirmas/src/main/java/com/fp/.svn/entries b/base/persistence/pfirmas/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..155d060 --- /dev/null +++ b/base/persistence/pfirmas/src/main/java/com/fp/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pfirmas/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +persistence +dir + +base +dir + diff --git a/base/persistence/pfirmas/src/main/java/com/fp/base/.svn/entries b/base/persistence/pfirmas/src/main/java/com/fp/base/.svn/entries new file mode 100644 index 0000000..4470c6c --- /dev/null +++ b/base/persistence/pfirmas/src/main/java/com/fp/base/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pfirmas/src/main/java/com/fp/base +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +persistence +dir + diff --git a/base/persistence/pfirmas/src/main/java/com/fp/base/persistence/.svn/entries b/base/persistence/pfirmas/src/main/java/com/fp/base/persistence/.svn/entries new file mode 100644 index 0000000..1f899ae --- /dev/null +++ b/base/persistence/pfirmas/src/main/java/com/fp/base/persistence/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pfirmas/src/main/java/com/fp/base/persistence +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TfirmDatosFirmante.java +file + + + + +2022-07-28T03:40:25.926730Z +eae15fc1fdafba5db3e4098b32bbbbd4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3469 + diff --git a/base/persistence/pfirmas/src/main/java/com/fp/base/persistence/.svn/text-base/TfirmDatosFirmante.java.svn-base b/base/persistence/pfirmas/src/main/java/com/fp/base/persistence/.svn/text-base/TfirmDatosFirmante.java.svn-base new file mode 100644 index 0000000..834a37c --- /dev/null +++ b/base/persistence/pfirmas/src/main/java/com/fp/base/persistence/.svn/text-base/TfirmDatosFirmante.java.svn-base @@ -0,0 +1,172 @@ +package com.fp.base.persistence; + +import java.io.Serializable; +import java.util.Date; + +import com.fp.dto.AbstractDataTransport; + +/** + * Clase que contiene los datos del usuario que es dueno de la firma y en la cual + * + * @author dcruz + * + */ +public class TfirmDatosFirmante extends AbstractDataTransport implements + Serializable, Cloneable { + + private static final long serialVersionUID = 4232773513442100177L; + private String aliasCertificado; + private String identificacion; + private String nombre; + private String apellido1; + private String apellido2; + private String cargo; + private String institucion; + private String direccion; + private String telefono; + private String ciudad; + private String razonSocial; + private String ruc; + private Date fechaInicioVigencia; + private Date fechaVigencia; + + public TfirmDatosFirmante(){} + + public TfirmDatosFirmante(String identificacion, String nombre, + String apellido1, String apellido2, String cargo, + String institucion, String direccion, String telefono, + String ciudad, String razonSocial, String ruc) { + super(); + this.identificacion = identificacion; + this.nombre = nombre; + this.apellido1 = apellido1; + this.apellido2 = apellido2; + this.cargo = cargo; + this.institucion = institucion; + this.direccion = direccion; + this.telefono = telefono; + this.ciudad = ciudad; + this.razonSocial = razonSocial; + this.ruc = ruc; + } + + + + public String getIdentificacion() { + return identificacion; + } + + public void setIdentificacion(String identificacion) { + this.identificacion = identificacion; + } + + public String getNombre() { + return nombre; + } + + public void setNombre(String nombre) { + this.nombre = nombre; + } + + public String getApellido1() { + return apellido1; + } + + public void setApellido1(String apellido1) { + this.apellido1 = apellido1; + } + + public String getApellido2() { + return apellido2; + } + + public void setApellido2(String apellido2) { + this.apellido2 = apellido2; + } + + public String getCargo() { + return cargo; + } + + public void setCargo(String cargo) { + this.cargo = cargo; + } + + public String getInstitucion() { + return institucion; + } + + public void setInstitucion(String institucion) { + this.institucion = institucion; + } + + public String getDireccion() { + return direccion; + } + + public void setDireccion(String direccion) { + this.direccion = direccion; + } + + public String getTelefono() { + return telefono; + } + + public void setTelefono(String telefono) { + this.telefono = telefono; + } + + public String getCiudad() { + return ciudad; + } + + public void setCiudad(String ciudad) { + this.ciudad = ciudad; + } + + public String getRazonSocial() { + return razonSocial; + } + + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + public String getRuc() { + return ruc; + } + + public void setRuc(String ruc) { + this.ruc = ruc; + } + + @Override + public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); + } + + public Date getFechaVigencia() { + return fechaVigencia; + } + + public void setFechaVigencia(Date fechaVigencia) { + this.fechaVigencia = fechaVigencia; + } + + public Date getFechaInicioVigencia() { + return fechaInicioVigencia; + } + + public void setFechaInicioVigencia(Date fechaInicioVigencia) { + this.fechaInicioVigencia = fechaInicioVigencia; + } + + public String getAliasCertificado() { + return aliasCertificado; + } + + public void setAliasCertificado(String aliasCertificado) { + this.aliasCertificado = aliasCertificado; + } + +} diff --git a/base/persistence/pfirmas/src/main/java/com/fp/base/persistence/TfirmDatosFirmante.java b/base/persistence/pfirmas/src/main/java/com/fp/base/persistence/TfirmDatosFirmante.java new file mode 100644 index 0000000..834a37c --- /dev/null +++ b/base/persistence/pfirmas/src/main/java/com/fp/base/persistence/TfirmDatosFirmante.java @@ -0,0 +1,172 @@ +package com.fp.base.persistence; + +import java.io.Serializable; +import java.util.Date; + +import com.fp.dto.AbstractDataTransport; + +/** + * Clase que contiene los datos del usuario que es dueno de la firma y en la cual + * + * @author dcruz + * + */ +public class TfirmDatosFirmante extends AbstractDataTransport implements + Serializable, Cloneable { + + private static final long serialVersionUID = 4232773513442100177L; + private String aliasCertificado; + private String identificacion; + private String nombre; + private String apellido1; + private String apellido2; + private String cargo; + private String institucion; + private String direccion; + private String telefono; + private String ciudad; + private String razonSocial; + private String ruc; + private Date fechaInicioVigencia; + private Date fechaVigencia; + + public TfirmDatosFirmante(){} + + public TfirmDatosFirmante(String identificacion, String nombre, + String apellido1, String apellido2, String cargo, + String institucion, String direccion, String telefono, + String ciudad, String razonSocial, String ruc) { + super(); + this.identificacion = identificacion; + this.nombre = nombre; + this.apellido1 = apellido1; + this.apellido2 = apellido2; + this.cargo = cargo; + this.institucion = institucion; + this.direccion = direccion; + this.telefono = telefono; + this.ciudad = ciudad; + this.razonSocial = razonSocial; + this.ruc = ruc; + } + + + + public String getIdentificacion() { + return identificacion; + } + + public void setIdentificacion(String identificacion) { + this.identificacion = identificacion; + } + + public String getNombre() { + return nombre; + } + + public void setNombre(String nombre) { + this.nombre = nombre; + } + + public String getApellido1() { + return apellido1; + } + + public void setApellido1(String apellido1) { + this.apellido1 = apellido1; + } + + public String getApellido2() { + return apellido2; + } + + public void setApellido2(String apellido2) { + this.apellido2 = apellido2; + } + + public String getCargo() { + return cargo; + } + + public void setCargo(String cargo) { + this.cargo = cargo; + } + + public String getInstitucion() { + return institucion; + } + + public void setInstitucion(String institucion) { + this.institucion = institucion; + } + + public String getDireccion() { + return direccion; + } + + public void setDireccion(String direccion) { + this.direccion = direccion; + } + + public String getTelefono() { + return telefono; + } + + public void setTelefono(String telefono) { + this.telefono = telefono; + } + + public String getCiudad() { + return ciudad; + } + + public void setCiudad(String ciudad) { + this.ciudad = ciudad; + } + + public String getRazonSocial() { + return razonSocial; + } + + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + public String getRuc() { + return ruc; + } + + public void setRuc(String ruc) { + this.ruc = ruc; + } + + @Override + public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); + } + + public Date getFechaVigencia() { + return fechaVigencia; + } + + public void setFechaVigencia(Date fechaVigencia) { + this.fechaVigencia = fechaVigencia; + } + + public Date getFechaInicioVigencia() { + return fechaInicioVigencia; + } + + public void setFechaInicioVigencia(Date fechaInicioVigencia) { + this.fechaInicioVigencia = fechaInicioVigencia; + } + + public String getAliasCertificado() { + return aliasCertificado; + } + + public void setAliasCertificado(String aliasCertificado) { + this.aliasCertificado = aliasCertificado; + } + +} diff --git a/base/persistence/pfirmas/src/main/java/com/fp/persistence/.svn/entries b/base/persistence/pfirmas/src/main/java/com/fp/persistence/.svn/entries new file mode 100644 index 0000000..9b3c6ac --- /dev/null +++ b/base/persistence/pfirmas/src/main/java/com/fp/persistence/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pfirmas/src/main/java/com/fp/persistence +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +pfirmas +dir + diff --git a/base/persistence/pfirmas/src/main/java/com/fp/persistence/pfirmas/.svn/entries b/base/persistence/pfirmas/src/main/java/com/fp/persistence/pfirmas/.svn/entries new file mode 100644 index 0000000..5add308 --- /dev/null +++ b/base/persistence/pfirmas/src/main/java/com/fp/persistence/pfirmas/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pfirmas/src/main/java/com/fp/persistence/pfirmas +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +param +dir + diff --git a/base/persistence/pfirmas/src/main/java/com/fp/persistence/pfirmas/param/.svn/entries b/base/persistence/pfirmas/src/main/java/com/fp/persistence/pfirmas/param/.svn/entries new file mode 100644 index 0000000..d218137 --- /dev/null +++ b/base/persistence/pfirmas/src/main/java/com/fp/persistence/pfirmas/param/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pfirmas/src/main/java/com/fp/persistence/pfirmas/param +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TfirmCertificadoKey.java +file + + + + +2022-07-28T03:40:25.896730Z +8f408816f51db382715e557cb2d4e203 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3641 + +TfirmCertificado.java +file + + + + +2022-07-28T03:40:25.896730Z +d6d675c3e06dcbbd059c811261099efb +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5449 + diff --git a/base/persistence/pfirmas/src/main/java/com/fp/persistence/pfirmas/param/.svn/text-base/TfirmCertificado.java.svn-base b/base/persistence/pfirmas/src/main/java/com/fp/persistence/pfirmas/param/.svn/text-base/TfirmCertificado.java.svn-base new file mode 100644 index 0000000..315c11a --- /dev/null +++ b/base/persistence/pfirmas/src/main/java/com/fp/persistence/pfirmas/param/.svn/text-base/TfirmCertificado.java.svn-base @@ -0,0 +1,198 @@ +package com.fp.persistence.pfirmas.param; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TFIRMCERTIFICADO*/ +@Entity(name="TfirmCertificado") +@Table(name="TFIRMCERTIFICADO") +public class TfirmCertificado extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TfirmCertificado +*/ +@EmbeddedId +private TfirmCertificadoKey pk; +@Column(name="FVIGENCIA", nullable=false) + +/** +* Fecha de vigencia del certificado. +*/ +private Date fvigencia; + +@Column(name="FINGRESO", nullable=false) + +/** +* Fecha de creacion del registro. +*/ +private Date fingreso; + +@Column(name="CODIGOUSUARIO", nullable=true) + +/** +* Codigo de usuario al que se asocia el certificado. +*/ +private String codigousuario; + +@Column(name="CARGO", nullable=true) + +/** +* Nombre del cargo asociado al usuario +*/ +private String cargo; + +/**Contructor por defecto*/ +public TfirmCertificado(){ +} +/**Contructor de TfirmCertificado +@param pPk Clave Primaria del entity +@param pFvigencia Fecha de vigencia del certificado. +@param pFingreso Fecha de creacion del registro. +*/ +public TfirmCertificado(TfirmCertificadoKey pPk,Date pFvigencia,Date pFingreso){ + this(); + pk=pPk; + fvigencia=pFvigencia; + fingreso=pFingreso; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TfirmCertificado +*/ +public static TfirmCertificado find(EntityManager pEntityManager,TfirmCertificadoKey pKey) throws Exception{ + TfirmCertificado obj = pEntityManager.find(TfirmCertificado.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TfirmCertificado +@return El objeto que referencia a la Clave primaria de TfirmCertificado +*/ +public TfirmCertificadoKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TfirmCertificado +@param pPk El objeto que referencia a la nueva Clave primaria de TfirmCertificado +*/ +public void setPk(TfirmCertificadoKey pPk){ + pk=pPk; +} +/**Obtiene el valor de fvigencia +@return valor de fvigencia*/ +public Date getFvigencia(){ + return fvigencia; +} +/**Fija el valor de fvigencia +@param pFvigencia nuevo Valor de fvigencia*/ +public void setFvigencia(Date pFvigencia){ + fvigencia=pFvigencia; +} + +/**Obtiene el valor de fingreso +@return valor de fingreso*/ +public Date getFingreso(){ + return fingreso; +} +/**Fija el valor de fingreso +@param pFingreso nuevo Valor de fingreso*/ +public void setFingreso(Date pFingreso){ + fingreso=pFingreso; +} + +/**Obtiene el valor de codigousuario +@return valor de codigousuario*/ +public String getCodigousuario(){ + return codigousuario; +} +/**Fija el valor de codigousuario +@param pCodigousuario nuevo Valor de codigousuario*/ +public void setCodigousuario(String pCodigousuario){ + codigousuario=pCodigousuario; +} + +/**Obtiene el valor de cargo +@return valor de cargo*/ +public String getCargo(){ + return cargo; +} +/**Fija el valor de cargo +@param pCargo nuevo Valor de cargo*/ +public void setCargo(String pCargo){ + cargo=pCargo; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TfirmCertificado))return false; + TfirmCertificado that = (TfirmCertificado) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TfirmCertificado +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TfirmCertificado +*/ +public Object createInstance(){ + TfirmCertificado instance=new TfirmCertificado(); + instance.setPk(new TfirmCertificadoKey()); + return instance; +} +/**Clona la entidad TfirmCertificado +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TfirmCertificado p=(TfirmCertificado)this.clone(); + p.setPk((TfirmCertificadoKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pfirmas/src/main/java/com/fp/persistence/pfirmas/param/.svn/text-base/TfirmCertificadoKey.java.svn-base b/base/persistence/pfirmas/src/main/java/com/fp/persistence/pfirmas/param/.svn/text-base/TfirmCertificadoKey.java.svn-base new file mode 100644 index 0000000..8a42616 --- /dev/null +++ b/base/persistence/pfirmas/src/main/java/com/fp/persistence/pfirmas/param/.svn/text-base/TfirmCertificadoKey.java.svn-base @@ -0,0 +1,125 @@ +package com.fp.persistence.pfirmas.param; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TFIRMCERTIFICADO*/ +@Embeddable +public class TfirmCertificadoKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="IDCERTIFICADO", nullable=false,updatable=false) + +/** +* Id del certificado que viene desde el banco central +*/ +private String idcertificado; + +@Column(name="FCADUCIDAD", nullable=false,updatable=false) + +/** +* Fecha de caducidad del certificado. +*/ +private Date fcaducidad; + +/**Contructor por defecto*/ +public TfirmCertificadoKey(){} +/**Contructor de TfirmCertificadoKey +@param pIdcertificado Id del certificado que viene desde el banco central +@param pFcaducidad Fecha de caducidad del certificado. +*/ +public TfirmCertificadoKey(String pIdcertificado,Date pFcaducidad){ + idcertificado=pIdcertificado; + fcaducidad=pFcaducidad; +} +/**Obtiene el valor de idcertificado +@return valor de idcertificado*/ +public String getIdcertificado(){ + return idcertificado; +} +/**Fija el valor de idcertificado +@param pIdcertificado nuevo Valor de idcertificado*/ +public void setIdcertificado(String pIdcertificado){ + idcertificado=pIdcertificado; +} + +/**Obtiene el valor de fcaducidad +@return valor de fcaducidad*/ +public Date getFcaducidad(){ + return fcaducidad; +} +/**Fija el valor de fcaducidad +@param pFcaducidad nuevo Valor de fcaducidad*/ +public void setFcaducidad(Date pFcaducidad){ + fcaducidad=pFcaducidad; +} + +/**Implementacion de la comparacion de TfirmCertificadoKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TfirmCertificadoKey))return false; + TfirmCertificadoKey that = (TfirmCertificadoKey) o; + if (this.getIdcertificado() == null || that.getIdcertificado() == null){ + return false; + } + if (! this.getIdcertificado().equals(that.getIdcertificado())){ + return false; + } + if (this.getFcaducidad() == null || that.getFcaducidad() == null){ + return false; + } + if (! this.getFcaducidad().equals(that.getFcaducidad())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TfirmCertificadoKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getIdcertificado() == null ? 0 : this.getIdcertificado().hashCode()); + result = result * 37 + (this.getFcaducidad() == null ? 0 : this.getFcaducidad().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pfirmas/src/main/java/com/fp/persistence/pfirmas/param/TfirmCertificado.java b/base/persistence/pfirmas/src/main/java/com/fp/persistence/pfirmas/param/TfirmCertificado.java new file mode 100644 index 0000000..315c11a --- /dev/null +++ b/base/persistence/pfirmas/src/main/java/com/fp/persistence/pfirmas/param/TfirmCertificado.java @@ -0,0 +1,198 @@ +package com.fp.persistence.pfirmas.param; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TFIRMCERTIFICADO*/ +@Entity(name="TfirmCertificado") +@Table(name="TFIRMCERTIFICADO") +public class TfirmCertificado extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TfirmCertificado +*/ +@EmbeddedId +private TfirmCertificadoKey pk; +@Column(name="FVIGENCIA", nullable=false) + +/** +* Fecha de vigencia del certificado. +*/ +private Date fvigencia; + +@Column(name="FINGRESO", nullable=false) + +/** +* Fecha de creacion del registro. +*/ +private Date fingreso; + +@Column(name="CODIGOUSUARIO", nullable=true) + +/** +* Codigo de usuario al que se asocia el certificado. +*/ +private String codigousuario; + +@Column(name="CARGO", nullable=true) + +/** +* Nombre del cargo asociado al usuario +*/ +private String cargo; + +/**Contructor por defecto*/ +public TfirmCertificado(){ +} +/**Contructor de TfirmCertificado +@param pPk Clave Primaria del entity +@param pFvigencia Fecha de vigencia del certificado. +@param pFingreso Fecha de creacion del registro. +*/ +public TfirmCertificado(TfirmCertificadoKey pPk,Date pFvigencia,Date pFingreso){ + this(); + pk=pPk; + fvigencia=pFvigencia; + fingreso=pFingreso; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TfirmCertificado +*/ +public static TfirmCertificado find(EntityManager pEntityManager,TfirmCertificadoKey pKey) throws Exception{ + TfirmCertificado obj = pEntityManager.find(TfirmCertificado.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TfirmCertificado +@return El objeto que referencia a la Clave primaria de TfirmCertificado +*/ +public TfirmCertificadoKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TfirmCertificado +@param pPk El objeto que referencia a la nueva Clave primaria de TfirmCertificado +*/ +public void setPk(TfirmCertificadoKey pPk){ + pk=pPk; +} +/**Obtiene el valor de fvigencia +@return valor de fvigencia*/ +public Date getFvigencia(){ + return fvigencia; +} +/**Fija el valor de fvigencia +@param pFvigencia nuevo Valor de fvigencia*/ +public void setFvigencia(Date pFvigencia){ + fvigencia=pFvigencia; +} + +/**Obtiene el valor de fingreso +@return valor de fingreso*/ +public Date getFingreso(){ + return fingreso; +} +/**Fija el valor de fingreso +@param pFingreso nuevo Valor de fingreso*/ +public void setFingreso(Date pFingreso){ + fingreso=pFingreso; +} + +/**Obtiene el valor de codigousuario +@return valor de codigousuario*/ +public String getCodigousuario(){ + return codigousuario; +} +/**Fija el valor de codigousuario +@param pCodigousuario nuevo Valor de codigousuario*/ +public void setCodigousuario(String pCodigousuario){ + codigousuario=pCodigousuario; +} + +/**Obtiene el valor de cargo +@return valor de cargo*/ +public String getCargo(){ + return cargo; +} +/**Fija el valor de cargo +@param pCargo nuevo Valor de cargo*/ +public void setCargo(String pCargo){ + cargo=pCargo; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TfirmCertificado))return false; + TfirmCertificado that = (TfirmCertificado) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TfirmCertificado +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TfirmCertificado +*/ +public Object createInstance(){ + TfirmCertificado instance=new TfirmCertificado(); + instance.setPk(new TfirmCertificadoKey()); + return instance; +} +/**Clona la entidad TfirmCertificado +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TfirmCertificado p=(TfirmCertificado)this.clone(); + p.setPk((TfirmCertificadoKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pfirmas/src/main/java/com/fp/persistence/pfirmas/param/TfirmCertificadoKey.java b/base/persistence/pfirmas/src/main/java/com/fp/persistence/pfirmas/param/TfirmCertificadoKey.java new file mode 100644 index 0000000..8a42616 --- /dev/null +++ b/base/persistence/pfirmas/src/main/java/com/fp/persistence/pfirmas/param/TfirmCertificadoKey.java @@ -0,0 +1,125 @@ +package com.fp.persistence.pfirmas.param; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TFIRMCERTIFICADO*/ +@Embeddable +public class TfirmCertificadoKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="IDCERTIFICADO", nullable=false,updatable=false) + +/** +* Id del certificado que viene desde el banco central +*/ +private String idcertificado; + +@Column(name="FCADUCIDAD", nullable=false,updatable=false) + +/** +* Fecha de caducidad del certificado. +*/ +private Date fcaducidad; + +/**Contructor por defecto*/ +public TfirmCertificadoKey(){} +/**Contructor de TfirmCertificadoKey +@param pIdcertificado Id del certificado que viene desde el banco central +@param pFcaducidad Fecha de caducidad del certificado. +*/ +public TfirmCertificadoKey(String pIdcertificado,Date pFcaducidad){ + idcertificado=pIdcertificado; + fcaducidad=pFcaducidad; +} +/**Obtiene el valor de idcertificado +@return valor de idcertificado*/ +public String getIdcertificado(){ + return idcertificado; +} +/**Fija el valor de idcertificado +@param pIdcertificado nuevo Valor de idcertificado*/ +public void setIdcertificado(String pIdcertificado){ + idcertificado=pIdcertificado; +} + +/**Obtiene el valor de fcaducidad +@return valor de fcaducidad*/ +public Date getFcaducidad(){ + return fcaducidad; +} +/**Fija el valor de fcaducidad +@param pFcaducidad nuevo Valor de fcaducidad*/ +public void setFcaducidad(Date pFcaducidad){ + fcaducidad=pFcaducidad; +} + +/**Implementacion de la comparacion de TfirmCertificadoKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TfirmCertificadoKey))return false; + TfirmCertificadoKey that = (TfirmCertificadoKey) o; + if (this.getIdcertificado() == null || that.getIdcertificado() == null){ + return false; + } + if (! this.getIdcertificado().equals(that.getIdcertificado())){ + return false; + } + if (this.getFcaducidad() == null || that.getFcaducidad() == null){ + return false; + } + if (! this.getFcaducidad().equals(that.getFcaducidad())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TfirmCertificadoKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getIdcertificado() == null ? 0 : this.getIdcertificado().hashCode()); + result = result * 37 + (this.getFcaducidad() == null ? 0 : this.getFcaducidad().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pfirmas/src/test/.svn/entries b/base/persistence/pfirmas/src/test/.svn/entries new file mode 100644 index 0000000..14fea82 --- /dev/null +++ b/base/persistence/pfirmas/src/test/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pfirmas/src/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + diff --git a/base/persistence/pfirmas/src/test/java/.svn/entries b/base/persistence/pfirmas/src/test/java/.svn/entries new file mode 100644 index 0000000..af78567 --- /dev/null +++ b/base/persistence/pfirmas/src/test/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pfirmas/src/test/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/persistence/pfirmas/src/test/java/com/.svn/entries b/base/persistence/pfirmas/src/test/java/com/.svn/entries new file mode 100644 index 0000000..25b4162 --- /dev/null +++ b/base/persistence/pfirmas/src/test/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pfirmas/src/test/java/com +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/persistence/pfirmas/src/test/java/com/fp/.svn/entries b/base/persistence/pfirmas/src/test/java/com/fp/.svn/entries new file mode 100644 index 0000000..652b8f4 --- /dev/null +++ b/base/persistence/pfirmas/src/test/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pfirmas/src/test/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +base +dir + diff --git a/base/persistence/pfirmas/src/test/java/com/fp/base/.svn/entries b/base/persistence/pfirmas/src/test/java/com/fp/base/.svn/entries new file mode 100644 index 0000000..c2476c6 --- /dev/null +++ b/base/persistence/pfirmas/src/test/java/com/fp/base/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pfirmas/src/test/java/com/fp/base +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +persistence +dir + diff --git a/base/persistence/pfirmas/src/test/java/com/fp/base/persistence/.svn/entries b/base/persistence/pfirmas/src/test/java/com/fp/base/persistence/.svn/entries new file mode 100644 index 0000000..006c07a --- /dev/null +++ b/base/persistence/pfirmas/src/test/java/com/fp/base/persistence/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pfirmas/src/test/java/com/fp/base/persistence +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/persistence/pfirmas/target/classes/com/fp/base/persistence/TfirmDatosFirmante.class b/base/persistence/pfirmas/target/classes/com/fp/base/persistence/TfirmDatosFirmante.class new file mode 100644 index 0000000..e971a01 Binary files /dev/null and b/base/persistence/pfirmas/target/classes/com/fp/base/persistence/TfirmDatosFirmante.class differ diff --git a/base/persistence/pfirmas/target/classes/com/fp/persistence/pfirmas/param/TfirmCertificado.class b/base/persistence/pfirmas/target/classes/com/fp/persistence/pfirmas/param/TfirmCertificado.class new file mode 100644 index 0000000..bcf3dc6 Binary files /dev/null and b/base/persistence/pfirmas/target/classes/com/fp/persistence/pfirmas/param/TfirmCertificado.class differ diff --git a/base/persistence/pfirmas/target/classes/com/fp/persistence/pfirmas/param/TfirmCertificadoKey.class b/base/persistence/pfirmas/target/classes/com/fp/persistence/pfirmas/param/TfirmCertificadoKey.class new file mode 100644 index 0000000..5b26169 Binary files /dev/null and b/base/persistence/pfirmas/target/classes/com/fp/persistence/pfirmas/param/TfirmCertificadoKey.class differ diff --git a/base/persistence/pfirmas/target/maven-archiver/pom.properties b/base/persistence/pfirmas/target/maven-archiver/pom.properties new file mode 100644 index 0000000..8e31171 --- /dev/null +++ b/base/persistence/pfirmas/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:53:03 ECT 2022 +version=2.1 +groupId=com.fp.base.persistence +artifactId=pfirmas diff --git a/base/persistence/pfirmas/target/pfirmas-2.1.jar b/base/persistence/pfirmas/target/pfirmas-2.1.jar new file mode 100644 index 0000000..2a69293 Binary files /dev/null and b/base/persistence/pfirmas/target/pfirmas-2.1.jar differ diff --git a/base/persistence/pgeneral/.pmd b/base/persistence/pgeneral/.pmd new file mode 100644 index 0000000..2f1733e --- /dev/null +++ b/base/persistence/pgeneral/.pmd @@ -0,0 +1,601 @@ + + + false + .ruleset + + + EmptyIfStmt + Basic Rules + + + EmptyWhileStmt + Basic Rules + + + EmptyTryBlock + Basic Rules + + + EmptyFinallyBlock + Basic Rules + + + EmptySwitchStatements + Basic Rules + + + JumbledIncrementer + Basic Rules + + + ForLoopShouldBeWhileLoop + Basic Rules + + + UnnecessaryConversionTemporary + Basic Rules + + + OverrideBothEqualsAndHashcode + Basic Rules + + + DoubleCheckedLocking + Basic Rules + + + ReturnFromFinallyBlock + Basic Rules + + + EmptySynchronizedBlock + Basic Rules + + + UnnecessaryReturn + Basic Rules + + + EmptyStaticInitializer + Basic Rules + + + UnconditionalIfStatement + Basic Rules + + + EmptyStatementNotInLoop + Basic Rules + + + BooleanInstantiation + Basic Rules + + + UnnecessaryFinalModifier + Basic Rules + + + CollapsibleIfStatements + Basic Rules + + + UselessOverridingMethod + Basic Rules + + + ClassCastExceptionWithToArray + Basic Rules + + + AvoidDecimalLiteralsInBigDecimalConstructor + Basic Rules + + + UselessOperationOnImmutable + Basic Rules + + + MisplacedNullCheck + Basic Rules + + + UnusedNullCheckInEquals + Basic Rules + + + AvoidThreadGroup + Basic Rules + + + BrokenNullCheck + Basic Rules + + + AvoidUsingOctalValues + Basic Rules + + + AvoidUsingHardCodedIP + Basic Rules + + + CheckResultSet + Basic Rules + + + AvoidMultipleUnaryOperators + Basic Rules + + + EmptyInitializer + Basic Rules + + + NPathComplexity + Code Size Rules + + + ExcessiveMethodLength + Code Size Rules + + + NcssMethodCount + Code Size Rules + + + NcssTypeCount + Code Size Rules + + + NcssConstructorCount + Code Size Rules + + + VariableNamingConventions + Naming Rules + + + MethodNamingConventions + Naming Rules + + + ClassNamingConventions + Naming Rules + + + AvoidDollarSigns + Naming Rules + + + MethodWithSameNameAsEnclosingClass + Naming Rules + + + SuspiciousHashcodeMethodName + Naming Rules + + + SuspiciousConstantFieldName + Naming Rules + + + SuspiciousEqualsMethodName + Naming Rules + + + AvoidFieldNameMatchingTypeName + Naming Rules + + + AvoidFieldNameMatchingMethodName + Naming Rules + + + NoPackage + Naming Rules + + + PackageCase + Naming Rules + + + MisleadingVariableName + Naming Rules + + + BooleanGetMethodName + Naming Rules + + + MoreThanOneLogger + Java Logging Rules + + + LoggerIsNotStaticFinal + Java Logging Rules + + + SystemPrintln + Java Logging Rules + + + AvoidPrintStackTrace + Java Logging Rules + + + IfStmtsMustUseBraces + Braces Rules + + + WhileLoopsMustUseBraces + Braces Rules + + + IfElseStmtsMustUseBraces + Braces Rules + + + ForLoopsMustUseBraces + Braces Rules + + + UseSingleton + Design Rules + + + SimplifyBooleanReturns + Design Rules + + + SimplifyBooleanExpressions + Design Rules + + + SwitchStmtsShouldHaveDefault + Design Rules + + + SwitchDensity + Design Rules + + + AccessorClassGeneration + Design Rules + + + FinalFieldCouldBeStatic + Design Rules + + + CloseResource + Design Rules + + + NonStaticInitializer + Design Rules + + + DefaultLabelNotLastInSwitchStmt + Design Rules + + + NonCaseLabelInSwitchStatement + Design Rules + + + OptimizableToArrayCall + Design Rules + + + BadComparison + Design Rules + + + EqualsNull + Design Rules + + + InstantiationToGetClass + Design Rules + + + IdempotentOperations + Design Rules + + + AvoidProtectedFieldInFinalClass + Design Rules + + + MissingStaticMethodInNonInstantiatableClass + Design Rules + + + MissingBreakInSwitch + Design Rules + + + UseNotifyAllInsteadOfNotify + Design Rules + + + AvoidInstanceofChecksInCatchClause + Design Rules + + + AbstractClassWithoutAbstractMethod + Design Rules + + + SimplifyConditional + Design Rules + + + CompareObjectsWithEquals + Design Rules + + + PositionLiteralsFirstInComparisons + Design Rules + + + UnnecessaryLocalBeforeReturn + Design Rules + + + NonThreadSafeSingleton + Design Rules + + + UncommentedEmptyMethod + Design Rules + + + AvoidConstantsInterface + Design Rules + + + UnsynchronizedStaticDateFormatter + Design Rules + + + PreserveStackTrace + Design Rules + + + UseCollectionIsEmpty + Design Rules + + + ClassWithOnlyPrivateConstructorsShouldBeFinal + Design Rules + + + EmptyMethodInAbstractClassShouldBeAbstract + Design Rules + + + SingularField + Design Rules + + + ReturnEmptyArrayRatherThanNull + Design Rules + + + AbstractClassWithoutAnyMethod + Design Rules + + + TooFewBranchesForASwitchStatement + Design Rules + + + ReplaceVectorWithList + Migration Rules + + + ReplaceHashtableWithMap + Migration Rules + + + ReplaceEnumerationWithIterator + Migration Rules + + + AvoidEnumAsIdentifier + Migration Rules + + + AvoidAssertAsIdentifier + Migration Rules + + + IntegerInstantiation + Migration Rules + + + ByteInstantiation + Migration Rules + + + ShortInstantiation + Migration Rules + + + LongInstantiation + Migration Rules + + + JUnit4TestShouldUseBeforeAnnotation + Migration Rules + + + JUnit4TestShouldUseAfterAnnotation + Migration Rules + + + JUnit4TestShouldUseTestAnnotation + Migration Rules + + + JUnit4SuitesShouldUseSuiteAnnotation + Migration Rules + + + JUnitUseExpected + Migration Rules + + + AvoidDuplicateLiterals + String and StringBuffer Rules + + + StringToString + String and StringBuffer Rules + + + InefficientStringBuffering + String and StringBuffer Rules + + + UnnecessaryCaseChange + String and StringBuffer Rules + + + UseStringBufferLength + String and StringBuffer Rules + + + AppendCharacterWithChar + String and StringBuffer Rules + + + ConsecutiveLiteralAppends + String and StringBuffer Rules + + + UseIndexOfChar + String and StringBuffer Rules + + + InefficientEmptyStringCheck + String and StringBuffer Rules + + + InsufficientStringBufferDeclaration + String and StringBuffer Rules + + + UselessStringValueOf + String and StringBuffer Rules + + + StringBufferInstantiationWithChar + String and StringBuffer Rules + + + UseEqualsToCompareStrings + String and StringBuffer Rules + + + AvoidStringBufferField + String and StringBuffer Rules + + + LooseCoupling + Type Resolution Rules + + + CloneMethodMustImplementCloneable + Type Resolution Rules + + + UnusedImports + Type Resolution Rules + + + UnnecessaryConstructor + Controversial Rules + + + UnusedModifier + Controversial Rules + + + AssignmentInOperand + Controversial Rules + + + AtLeastOneConstructor + Controversial Rules + + + DontImportSun + Controversial Rules + + + SuspiciousOctalEscape + Controversial Rules + + + DefaultPackage + Controversial Rules + + + BooleanInversion + Controversial Rules + + + AvoidFinalLocalVariable + Controversial Rules + + + AvoidUsingShortType + Controversial Rules + + + AvoidUsingVolatile + Controversial Rules + + + AvoidUsingNativeCode + Controversial Rules + + + AvoidAccessibilityAlteration + Controversial Rules + + + DoNotCallGarbageCollectionExplicitly + Controversial Rules + + + UnusedPrivateField + Unused Code Rules + + + UnusedLocalVariable + Unused Code Rules + + + UnusedPrivateMethod + Unused Code Rules + + + UnusedFormalParameter + Unused Code Rules + + + AvoidDeeplyNestedIfStmts + Design Rules + + + CyclomaticComplexity + Code Size Rules + + + false + true + diff --git a/base/persistence/pgeneral/.settings/.svn/entries b/base/persistence/pgeneral/.settings/.svn/entries new file mode 100644 index 0000000..01520e8 --- /dev/null +++ b/base/persistence/pgeneral/.settings/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/.settings +svn://172.17.26.185/COMACO + + + +2016-01-05T15:14:18.810030Z +4365 +cvasquez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/persistence/pgeneral/.svn/dir-prop-base b/base/persistence/pgeneral/.svn/dir-prop-base new file mode 100644 index 0000000..40820ff --- /dev/null +++ b/base/persistence/pgeneral/.svn/dir-prop-base @@ -0,0 +1,6 @@ +K 10 +svn:ignore +V 7 +target + +END diff --git a/base/persistence/pgeneral/.svn/entries b/base/persistence/pgeneral/.svn/entries new file mode 100644 index 0000000..52954d8 --- /dev/null +++ b/base/persistence/pgeneral/.svn/entries @@ -0,0 +1,102 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral +svn://172.17.26.185/COMACO + + + +2016-01-21T17:28:58.351554Z +4400 +cvasquez +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:30.797751Z +a962d5458c39d047e09cf705e34fdc9b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +556 + +.settings +dir + +.pmd +file + + + + +2022-07-28T03:40:30.797751Z +a005c8627d2a64c8f23720db011d5372 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +18996 + diff --git a/base/persistence/pgeneral/.svn/text-base/.pmd.svn-base b/base/persistence/pgeneral/.svn/text-base/.pmd.svn-base new file mode 100644 index 0000000..2f1733e --- /dev/null +++ b/base/persistence/pgeneral/.svn/text-base/.pmd.svn-base @@ -0,0 +1,601 @@ + + + false + .ruleset + + + EmptyIfStmt + Basic Rules + + + EmptyWhileStmt + Basic Rules + + + EmptyTryBlock + Basic Rules + + + EmptyFinallyBlock + Basic Rules + + + EmptySwitchStatements + Basic Rules + + + JumbledIncrementer + Basic Rules + + + ForLoopShouldBeWhileLoop + Basic Rules + + + UnnecessaryConversionTemporary + Basic Rules + + + OverrideBothEqualsAndHashcode + Basic Rules + + + DoubleCheckedLocking + Basic Rules + + + ReturnFromFinallyBlock + Basic Rules + + + EmptySynchronizedBlock + Basic Rules + + + UnnecessaryReturn + Basic Rules + + + EmptyStaticInitializer + Basic Rules + + + UnconditionalIfStatement + Basic Rules + + + EmptyStatementNotInLoop + Basic Rules + + + BooleanInstantiation + Basic Rules + + + UnnecessaryFinalModifier + Basic Rules + + + CollapsibleIfStatements + Basic Rules + + + UselessOverridingMethod + Basic Rules + + + ClassCastExceptionWithToArray + Basic Rules + + + AvoidDecimalLiteralsInBigDecimalConstructor + Basic Rules + + + UselessOperationOnImmutable + Basic Rules + + + MisplacedNullCheck + Basic Rules + + + UnusedNullCheckInEquals + Basic Rules + + + AvoidThreadGroup + Basic Rules + + + BrokenNullCheck + Basic Rules + + + AvoidUsingOctalValues + Basic Rules + + + AvoidUsingHardCodedIP + Basic Rules + + + CheckResultSet + Basic Rules + + + AvoidMultipleUnaryOperators + Basic Rules + + + EmptyInitializer + Basic Rules + + + NPathComplexity + Code Size Rules + + + ExcessiveMethodLength + Code Size Rules + + + NcssMethodCount + Code Size Rules + + + NcssTypeCount + Code Size Rules + + + NcssConstructorCount + Code Size Rules + + + VariableNamingConventions + Naming Rules + + + MethodNamingConventions + Naming Rules + + + ClassNamingConventions + Naming Rules + + + AvoidDollarSigns + Naming Rules + + + MethodWithSameNameAsEnclosingClass + Naming Rules + + + SuspiciousHashcodeMethodName + Naming Rules + + + SuspiciousConstantFieldName + Naming Rules + + + SuspiciousEqualsMethodName + Naming Rules + + + AvoidFieldNameMatchingTypeName + Naming Rules + + + AvoidFieldNameMatchingMethodName + Naming Rules + + + NoPackage + Naming Rules + + + PackageCase + Naming Rules + + + MisleadingVariableName + Naming Rules + + + BooleanGetMethodName + Naming Rules + + + MoreThanOneLogger + Java Logging Rules + + + LoggerIsNotStaticFinal + Java Logging Rules + + + SystemPrintln + Java Logging Rules + + + AvoidPrintStackTrace + Java Logging Rules + + + IfStmtsMustUseBraces + Braces Rules + + + WhileLoopsMustUseBraces + Braces Rules + + + IfElseStmtsMustUseBraces + Braces Rules + + + ForLoopsMustUseBraces + Braces Rules + + + UseSingleton + Design Rules + + + SimplifyBooleanReturns + Design Rules + + + SimplifyBooleanExpressions + Design Rules + + + SwitchStmtsShouldHaveDefault + Design Rules + + + SwitchDensity + Design Rules + + + AccessorClassGeneration + Design Rules + + + FinalFieldCouldBeStatic + Design Rules + + + CloseResource + Design Rules + + + NonStaticInitializer + Design Rules + + + DefaultLabelNotLastInSwitchStmt + Design Rules + + + NonCaseLabelInSwitchStatement + Design Rules + + + OptimizableToArrayCall + Design Rules + + + BadComparison + Design Rules + + + EqualsNull + Design Rules + + + InstantiationToGetClass + Design Rules + + + IdempotentOperations + Design Rules + + + AvoidProtectedFieldInFinalClass + Design Rules + + + MissingStaticMethodInNonInstantiatableClass + Design Rules + + + MissingBreakInSwitch + Design Rules + + + UseNotifyAllInsteadOfNotify + Design Rules + + + AvoidInstanceofChecksInCatchClause + Design Rules + + + AbstractClassWithoutAbstractMethod + Design Rules + + + SimplifyConditional + Design Rules + + + CompareObjectsWithEquals + Design Rules + + + PositionLiteralsFirstInComparisons + Design Rules + + + UnnecessaryLocalBeforeReturn + Design Rules + + + NonThreadSafeSingleton + Design Rules + + + UncommentedEmptyMethod + Design Rules + + + AvoidConstantsInterface + Design Rules + + + UnsynchronizedStaticDateFormatter + Design Rules + + + PreserveStackTrace + Design Rules + + + UseCollectionIsEmpty + Design Rules + + + ClassWithOnlyPrivateConstructorsShouldBeFinal + Design Rules + + + EmptyMethodInAbstractClassShouldBeAbstract + Design Rules + + + SingularField + Design Rules + + + ReturnEmptyArrayRatherThanNull + Design Rules + + + AbstractClassWithoutAnyMethod + Design Rules + + + TooFewBranchesForASwitchStatement + Design Rules + + + ReplaceVectorWithList + Migration Rules + + + ReplaceHashtableWithMap + Migration Rules + + + ReplaceEnumerationWithIterator + Migration Rules + + + AvoidEnumAsIdentifier + Migration Rules + + + AvoidAssertAsIdentifier + Migration Rules + + + IntegerInstantiation + Migration Rules + + + ByteInstantiation + Migration Rules + + + ShortInstantiation + Migration Rules + + + LongInstantiation + Migration Rules + + + JUnit4TestShouldUseBeforeAnnotation + Migration Rules + + + JUnit4TestShouldUseAfterAnnotation + Migration Rules + + + JUnit4TestShouldUseTestAnnotation + Migration Rules + + + JUnit4SuitesShouldUseSuiteAnnotation + Migration Rules + + + JUnitUseExpected + Migration Rules + + + AvoidDuplicateLiterals + String and StringBuffer Rules + + + StringToString + String and StringBuffer Rules + + + InefficientStringBuffering + String and StringBuffer Rules + + + UnnecessaryCaseChange + String and StringBuffer Rules + + + UseStringBufferLength + String and StringBuffer Rules + + + AppendCharacterWithChar + String and StringBuffer Rules + + + ConsecutiveLiteralAppends + String and StringBuffer Rules + + + UseIndexOfChar + String and StringBuffer Rules + + + InefficientEmptyStringCheck + String and StringBuffer Rules + + + InsufficientStringBufferDeclaration + String and StringBuffer Rules + + + UselessStringValueOf + String and StringBuffer Rules + + + StringBufferInstantiationWithChar + String and StringBuffer Rules + + + UseEqualsToCompareStrings + String and StringBuffer Rules + + + AvoidStringBufferField + String and StringBuffer Rules + + + LooseCoupling + Type Resolution Rules + + + CloneMethodMustImplementCloneable + Type Resolution Rules + + + UnusedImports + Type Resolution Rules + + + UnnecessaryConstructor + Controversial Rules + + + UnusedModifier + Controversial Rules + + + AssignmentInOperand + Controversial Rules + + + AtLeastOneConstructor + Controversial Rules + + + DontImportSun + Controversial Rules + + + SuspiciousOctalEscape + Controversial Rules + + + DefaultPackage + Controversial Rules + + + BooleanInversion + Controversial Rules + + + AvoidFinalLocalVariable + Controversial Rules + + + AvoidUsingShortType + Controversial Rules + + + AvoidUsingVolatile + Controversial Rules + + + AvoidUsingNativeCode + Controversial Rules + + + AvoidAccessibilityAlteration + Controversial Rules + + + DoNotCallGarbageCollectionExplicitly + Controversial Rules + + + UnusedPrivateField + Unused Code Rules + + + UnusedLocalVariable + Unused Code Rules + + + UnusedPrivateMethod + Unused Code Rules + + + UnusedFormalParameter + Unused Code Rules + + + AvoidDeeplyNestedIfStmts + Design Rules + + + CyclomaticComplexity + Code Size Rules + + + false + true + diff --git a/base/persistence/pgeneral/.svn/text-base/pom.xml.svn-base b/base/persistence/pgeneral/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..867c49b --- /dev/null +++ b/base/persistence/pgeneral/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,16 @@ + + + + persistence + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.persistence + pgeneral + pgeneral + + diff --git a/base/persistence/pgeneral/pom.xml b/base/persistence/pgeneral/pom.xml new file mode 100644 index 0000000..867c49b --- /dev/null +++ b/base/persistence/pgeneral/pom.xml @@ -0,0 +1,16 @@ + + + + persistence + com.fp.base + 2.1 + + 4.0.0 + com.fp.base.persistence + pgeneral + pgeneral + + diff --git a/base/persistence/pgeneral/src/.svn/entries b/base/persistence/pgeneral/src/.svn/entries new file mode 100644 index 0000000..d9f991b --- /dev/null +++ b/base/persistence/pgeneral/src/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src +svn://172.17.26.185/COMACO + + + +2016-01-21T17:28:58.351554Z +4400 +cvasquez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +main +dir + diff --git a/base/persistence/pgeneral/src/main/.svn/entries b/base/persistence/pgeneral/src/main/.svn/entries new file mode 100644 index 0000000..3e0856c --- /dev/null +++ b/base/persistence/pgeneral/src/main/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main +svn://172.17.26.185/COMACO + + + +2016-01-21T17:28:58.351554Z +4400 +cvasquez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/base/persistence/pgeneral/src/main/java/.svn/entries b/base/persistence/pgeneral/src/main/java/.svn/entries new file mode 100644 index 0000000..6fb1e99 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java +svn://172.17.26.185/COMACO + + + +2016-01-21T17:28:58.351554Z +4400 +cvasquez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/persistence/pgeneral/src/main/java/com/.svn/entries b/base/persistence/pgeneral/src/main/java/com/.svn/entries new file mode 100644 index 0000000..1d8a30e --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com +svn://172.17.26.185/COMACO + + + +2016-01-21T17:28:58.351554Z +4400 +cvasquez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..b03199b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2016-01-21T17:28:58.351554Z +4400 +cvasquez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +persistence +dir + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/.svn/entries new file mode 100644 index 0000000..65425d1 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence +svn://172.17.26.185/COMACO + + + +2016-01-21T17:28:58.351554Z +4400 +cvasquez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +pgeneral +dir + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/.svn/entries new file mode 100644 index 0000000..8ebf899 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/.svn/entries @@ -0,0 +1,115 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral +svn://172.17.26.185/COMACO + + + +2016-01-21T17:28:58.351554Z +4400 +cvasquez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +product +dir + +log +dir + +batch +dir + +image +dir + +receive +dir + +dict +dir + +message +dir + +msg +dir + +prov +dir + +trans +dir + +seq +dir + +charge +dir + +installment +dir + +vault +dir + +schedule +dir + +transf +dir + +excel +dir + +auth +dir + +proc +dir + +menu +dir + +acco +dir + +report +dir + +score +dir + +page +dir + +date +dir + +gene +dir + +result +dir + +safe +dir + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/entries new file mode 100644 index 0000000..9e3e15f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/entries @@ -0,0 +1,1592 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneAccountLocalHold.java +file + + + + +2022-07-28T03:40:29.982748Z +4c23e8740b5f00604abc07042012eac1 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +13952 + +TgeneAccoNumStructureKey.java +file + + + + +2022-07-28T03:40:29.982748Z +42e61a45101a2d300a86a8d766bad363 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4935 + +TgeneSequentialModule.java +file + + + + +2022-07-28T03:40:29.982748Z +449416c479ab812072f8930afcf85a54 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4744 + +TgeneTransAccountStatusKey.java +file + + + + +2022-07-28T03:40:29.983748Z +8cb4a504d82d8484bbd726c1a9c74047 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5619 + +TgeneSequStruct.java +file + + + + +2022-07-28T03:40:29.983748Z +06922ab882d2785e03e6638622c1627e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4205 + +TgeneAccountDebitOpening.java +file + + + + +2022-07-28T03:40:29.983748Z +f8a014bb82a7b78a3088a96842b07ac4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8842 + +TgeneAccountForDebitKey.java +file + + + + +2022-07-28T03:40:29.983748Z +a4de3824cecfee47972abc4b74d55f80 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4265 + +TgeneAccountPayable.java +file + + + + +2022-07-28T03:40:29.984748Z +45f49927f1d456a553a04ff8707532ce +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6466 + +TgeneAccount.java +file + + + + +2022-07-28T03:40:29.984748Z +c1b8caeb1e625de381d0d204177785ea +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +33859 + +TgeneWarrantyAccountKey.java +file + + + + +2022-07-28T03:40:29.984748Z +3d342afb753246f4d8920ea5ff7b51fb +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5375 + +TgeneAccountForCredit.java +file + + + + +2022-07-28T03:40:29.984748Z +d7c45829bb1f24bc51cad5249a22ae17 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +10224 + +TgeneAccountLiquidation.java +file + + + + +2022-07-28T03:40:29.985748Z +eac6eb47278cce164a7184de79dc3e7f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9728 + +TgeneSolicitudeCredit.java +file + + + + +2022-07-28T03:40:29.985748Z +eb2a1ba6dacb827918110e223469d174 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8304 + +TgeneTransAccountOperStatKey.java +file + + + + +2022-07-28T03:40:29.985748Z +9908d37698d1c9f7a7d84e3c65d9992c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5826 + +TgeneAccountNumber.java +file + + + + +2022-07-28T03:40:29.986748Z +abad1043704e269572f288102783c956 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6614 + +TgeneSequStructDetail.java +file + + + + +2022-07-28T03:40:29.985748Z +97187e91e2f2e5ba1da1b8175c977bc6 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5465 + +TgeneAccoNumStructure.java +file + + + + +2022-07-28T03:40:29.986748Z +c55f88e55beab601f52f5868c384a040 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7663 + +TgeneAccountCreditOpening.java +file + + + + +2022-07-28T03:40:29.986748Z +f2189fcf9bca5e4d83b052f08f09cd48 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9557 + +TgeneAccountLiquidationKey.java +file + + + + +2022-07-28T03:40:29.987748Z +d962d93ebf54f552fa38acd824b98574 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9354 + +TgeneSolicitudeCreditKey.java +file + + + + +2022-07-28T03:40:29.987748Z +8b259e1986e4d2f77d07cf866616b174 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4686 + +TgeneTransAccountStatus.java +file + + + + +2022-07-28T03:40:29.986748Z +fdde34a6ab6114dc396e480e7694a68d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7460 + +TgeneAccountStatusKey.java +file + + + + +2022-07-28T03:40:29.987748Z +3c7bfc032e02078ca31326ab75bf7915 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3471 + +TgeneAccountNumberKey.java +file + + + + +2022-07-28T03:40:29.988748Z +891b6023ef3972b91e75a1c890a68a96 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3570 + +TgeneSequStructDetailKey.java +file + + + + +2022-07-28T03:40:29.987748Z +d533d474a6ff43eacd3d4522688362f9 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5094 + +TgeneAccountRemittanceHold.java +file + + + + +2022-07-28T03:40:29.988748Z +25673658f5f5006114170d9c0ef845a8 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +10080 + +TgeneSolicitudeForCreditKey.java +file + + + + +2022-07-28T03:40:29.988748Z +2a5fbf3213dd6695f5474249e54f99f2 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4716 + +TgeneAccountCreditOpeningKey.java +file + + + + +2022-07-28T03:40:29.988748Z +7936662fdb8b7326831cfb8883176337 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4338 + +TgeneSolicitudeForDebit.java +file + + + + +2022-07-28T03:40:29.989748Z +06d4b0417efabc0f248c006dc16f4f18 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7004 + +TgeneWarrantyAccount.java +file + + + + +2022-07-28T03:40:29.989748Z +4bdb9ee1d52820dcdee3702d5f3bcd2b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +12607 + +TgeneAccountSequence.java +file + + + + +2022-07-28T03:40:29.989748Z +9f3403d0aeff41e89ae641a97949730a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +11271 + +TgeneTransAccountOperStat.java +file + + + + +2022-07-28T03:40:29.990748Z +a3bd8839361b2bdf2efd784e28c0b5c6 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7435 + +TgeneBaseAccount.java +file + + + + +2022-07-28T03:40:29.990748Z +59b9aa93f3c2236f4807d5f8649fc7fe +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4071 + +TgeneAccountLocalHoldKey.java +file + + + + +2022-07-28T03:40:29.990748Z +94b4054a490c5a21c068ee535b655075 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5193 + +TgeneAccountCredit.java +file + + + + +2022-07-28T03:40:29.990748Z +52927be54faff729223348b82e2b6867 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9115 + +TgeneAccountRemittanceHoldKey.java +file + + + + +2022-07-28T03:40:29.991748Z +2d98961b2c09de0b6b52a81448a6bf42 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5243 + +TgeneSolicitudeForDebitKey.java +file + + + + +2022-07-28T03:40:29.991748Z +dab2a0ea42a4c1d8237c235b0f5898e3 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4679 + +TgeneAccountDebitOpeningKey.java +file + + + + +2022-07-28T03:40:29.991748Z +0e99f17359afc4d3cd1765ee6020164d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4301 + +TgeneAccountSequenceKey.java +file + + + + +2022-07-28T03:40:29.991748Z +54713bfe7fe465a33122062c778b14e1 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3466 + +TgeneBaseAccountKey.java +file + + + + +2022-07-28T03:40:29.992748Z +0075f4c8f504120e592198a59e495c3b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3375 + +TgeneAccountStatus.java +file + + + + +2022-07-28T03:40:29.992748Z +2386441e6ef5d04ac928eee753b134c9 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5332 + +TgeneAccountCreditKey.java +file + + + + +2022-07-28T03:40:29.992748Z +e67c2f62f9c6e69906c797c56825b73c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5124 + +TgeneAccountPayableKey.java +file + + + + +2022-07-28T03:40:29.992748Z +b89bd74799b0c5d2512b404a2adad7cd +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3433 + +TgeneAccountKey.java +file + + + + +2022-07-28T03:40:29.992748Z +7dfb81d1deff89695cc27e3da3f08979 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4235 + +TgeneSolicitudeForCredit.java +file + + + + +2022-07-28T03:40:29.993748Z +40e838b0e329e78875b220e21d39d43c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9611 + +TgeneAccountForCreditKey.java +file + + + + +2022-07-28T03:40:29.993748Z +65716f7ebd7a24fe031e558e101cf4a3 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4298 + +TgeneAccountForDebit.java +file + + + + +2022-07-28T03:40:29.993748Z +f927b4d0b4954e93655e99dea6b8589c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7166 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccoNumStructure.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccoNumStructure.java.svn-base new file mode 100644 index 0000000..db88a23 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccoNumStructure.java.svn-base @@ -0,0 +1,260 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCONUMSTRUCTURE */ +@Entity(name = "TgeneAccoNumStructure") +@Table(name = "TGENEACCONUMSTRUCTURE") +public class TgeneAccoNumStructure extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneAccoNumStructure + */ + @EmbeddedId + private TgeneAccoNumStructureKey pk; + + @Column(name = "SIZEFIELD", nullable = false) + /** + * Campo que almacena la longitud del campo que es parte del numero de cuenta + */ + private Integer sizefield; + + @Column(name = "ORDERFIELD", nullable = false) + /** + * Campo que almacena el orden del campo que sera parte del numero de cuenta + */ + private Integer orderfield; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + /** Contructor por defecto */ + public TgeneAccoNumStructure() { + } + + /** + * Contructor de TgeneAccoNumStructure + * + * @param pPk Clave Primaria del entity + * @param pSizefield Campo que almacena la longitud del campo que es parte del numero de cuenta + * @param pOrderfield Campo que almacena el orden del campo que sera parte del numero de cuenta + */ + public TgeneAccoNumStructure(TgeneAccoNumStructureKey pPk, Integer pSizefield, Integer pOrderfield) { + this(); + this.pk = pPk; + this.sizefield = pSizefield; + this.orderfield = pOrderfield; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneAccoNumStructure + */ + public static TgeneAccoNumStructure find(EntityManager pEntityManager, TgeneAccoNumStructureKey pKey) throws Exception { + TgeneAccoNumStructure obj = pEntityManager.find(TgeneAccoNumStructure.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneAccoNumStructure + * + * @return El objeto que referencia a la Clave primaria de TgeneAccoNumStructure + */ + public TgeneAccoNumStructureKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneAccoNumStructure + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccoNumStructure + */ + public void setPk(TgeneAccoNumStructureKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de sizefield + * + * @return valor de sizefield + */ + public Integer getSizefield() { + return this.sizefield; + } + + /** + * Fija el valor de sizefield + * + * @param pSizefield nuevo Valor de sizefield + */ + public void setSizefield(Integer pSizefield) { + this.sizefield = pSizefield; + } + + /** + * Obtiene el valor de orderfield + * + * @return valor de orderfield + */ + public Integer getOrderfield() { + return this.orderfield; + } + + /** + * Fija el valor de orderfield + * + * @param pOrderfield nuevo Valor de orderfield + */ + public void setOrderfield(Integer pOrderfield) { + this.orderfield = pOrderfield; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneAccoNumStructure)) { + return false; + } + TgeneAccoNumStructure that = (TgeneAccoNumStructure) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneAccoNumStructure + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneAccoNumStructure */ + @Override + public Object createInstance() { + TgeneAccoNumStructure instance = new TgeneAccoNumStructure(); + instance.setPk(new TgeneAccoNumStructureKey()); + return instance; + } + + /** + * Clona la entidad TgeneAccoNumStructure + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneAccoNumStructure p = (TgeneAccoNumStructure) this.clone(); + p.setPk((TgeneAccoNumStructureKey) this.pk.cloneMe()); + return p; + } + + // METODOS MANUALES + /** + * Sentencia que obtiene un registro de TgeneAccoNumStructure con la definicion de estructura para crear un numero + * de cuenta. + */ + private static final String JPQL = "from TgeneAccoNumStructure t " + " where t.pk.modulecode = :modulecode order by t.orderfield"; + + /** + * Metodo que entrega la defincion de una cuenta por modulo. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pModule Codigo de modulo + * @return TgeneAccountSequence + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pModule) throws Exception { + Query qry = pEntityManager.createQuery(TgeneAccoNumStructure.JPQL); + qry.setParameter("modulecode", pModule); + return qry.getResultList(); + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccoNumStructureKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccoNumStructureKey.java.svn-base new file mode 100644 index 0000000..87384c8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccoNumStructureKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCONUMSTRUCTURE*/ +@Embeddable +public class TgeneAccoNumStructureKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="STRUCTUREACCOUNTCATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo - EMPRESA, OFICINA, PRODUCTO, ETC. +*/ +private String structureaccountcatalog; + +@Column(name="STRUCTUREACCOUNTCATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo - FIELDSSTRUCTURE +*/ +private String structureaccountcatalogcode; + +/**Contructor por defecto*/ +public TgeneAccoNumStructureKey(){} +/**Contructor de TgeneAccoNumStructureKey +@param pModulecode Codigo de modulo +@param pStructureaccountcatalog Codigo de catalogo - EMPRESA, OFICINA, PRODUCTO, ETC. +@param pStructureaccountcatalogcode Codigo de tabla de catalogo - FIELDSSTRUCTURE +*/ +public TgeneAccoNumStructureKey(String pModulecode,String pStructureaccountcatalog,String pStructureaccountcatalogcode){ + modulecode=pModulecode; + structureaccountcatalog=pStructureaccountcatalog; + structureaccountcatalogcode=pStructureaccountcatalogcode; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de structureaccountcatalog +@return valor de structureaccountcatalog*/ +public String getStructureaccountcatalog(){ + return structureaccountcatalog; +} +/**Fija el valor de structureaccountcatalog +@param pStructureaccountcatalog nuevo Valor de structureaccountcatalog*/ +public void setStructureaccountcatalog(String pStructureaccountcatalog){ + structureaccountcatalog=pStructureaccountcatalog; +} + +/**Obtiene el valor de structureaccountcatalogcode +@return valor de structureaccountcatalogcode*/ +public String getStructureaccountcatalogcode(){ + return structureaccountcatalogcode; +} +/**Fija el valor de structureaccountcatalogcode +@param pStructureaccountcatalogcode nuevo Valor de structureaccountcatalogcode*/ +public void setStructureaccountcatalogcode(String pStructureaccountcatalogcode){ + structureaccountcatalogcode=pStructureaccountcatalogcode; +} + +/**Implementacin de la comparacin de TgeneAccoNumStructureKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccoNumStructureKey))return false; + TgeneAccoNumStructureKey that = (TgeneAccoNumStructureKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getStructureaccountcatalog() == null || that.getStructureaccountcatalog() == null){ + return false; + } + if (! this.getStructureaccountcatalog().equals(that.getStructureaccountcatalog())){ + return false; + } + if (this.getStructureaccountcatalogcode() == null || that.getStructureaccountcatalogcode() == null){ + return false; + } + if (! this.getStructureaccountcatalogcode().equals(that.getStructureaccountcatalogcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccoNumStructureKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getStructureaccountcatalog() == null ? 0 : this.getStructureaccountcatalog().hashCode()); + result = result * 37 + (this.getStructureaccountcatalogcode() == null ? 0 : this.getStructureaccountcatalogcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccount.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccount.java.svn-base new file mode 100644 index 0000000..aef9455 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccount.java.svn-base @@ -0,0 +1,1114 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.LockModeType; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.common.helper.Constant; +import com.fp.core.exception.CoreException; +import com.fp.dto.hb.HibernateBean; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNT + */ +@Entity(name = "TgeneAccount") +@Table(name = "TGENEACCOUNT") +public class TgeneAccount extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneAccount + */ + @EmbeddedId + private TgeneAccountKey pk; + + @Column(name = "DATEFROM", nullable = false) + /** + * Fecha desde la cual esta vigente el registro con datos de la cuenta. + */ + private Timestamp datefrom; + + @Column(name = "ACCOUNTNAME", nullable = true) + /** + * Nombre de la cuenta + */ + private String accountname; + + @Column(name = "PERSONCODE", nullable = true) + /** + * Codigo de persona principal de la cuenta + */ + private Integer personcode; + + @Column(name = "MODULECODE", nullable = true) + /** + * Codigo de modulo al que pertenece la cuenta + */ + private String modulecode; + + @Column(name = "PRODUCTCODE", nullable = true) + /** + * Codigo de producto + */ + private String productcode; + + @Column(name = "SUBPRODUCTCODE", nullable = true) + /** + * Codigo de subproducto + */ + private String subproductcode; + + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + + @Column(name = "OFFICECODE", nullable = true) + /** + * Codigo de oficina a la que pertenece la cuenta + */ + private Integer officecode; + + @Column(name = "BRANCHCODE", nullable = true) + /** + * Codigo de sucursal a la que pertenece la cuenta + */ + private Integer branchcode; + + @Column(name = "OPENOFFICECODE", nullable = true) + /** + * Codigo de oficina de apertura de la cuenta + */ + private Integer openofficecode; + + @Column(name = "OPENBRANCHCODE", nullable = true) + /** + * Codigo de sucursal de apertura de la cuenta + */ + private Integer openbranchcode; + + @Column(name = "ACCOUNTSTATUSCODE", nullable = true) + /** + * Estatus de cuenta + */ + private String accountstatuscode; + + @Column(name = "OFFICER", nullable = true) + /** + * Codigo de usuario oficial de cuenta + */ + private String officer; + + @Column(name = "OPENINGUSERCODE", nullable = true) + /** + * Codigo de usuario de apertura de la cuenta + */ + private String openingusercode; + + @Column(name = "PERSONSCORECATALOG", nullable = true) + /** + * Codigo de catalogo que contiene la calificacion del cliente A, B, C, D, E + */ + private String personscorecatalog; + + @Column(name = "PERSONCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo 011 Codigo de tabla de calificaciones de cleinte + */ + private String personcatalogcode; + + @Column(name = "CHARGECATALOG", nullable = true) + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String chargecatalog; + + @Column(name = "CHARGECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String chargecatalogcode; + + @Column(name = "RATECATALOG", nullable = true) + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String ratecatalog; + + @Column(name = "RATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String ratecatalogcode; + + @Column(name = "CREDITTYPECODE", nullable = true) + /** + * Codigo de tipo de credito + */ + private String credittypecode; + + @Column(name = "OPERATIVCONDITION", nullable = true) + /** + * Codigo de condicion operativa. + */ + private String operativcondition; + + @Column(name = "OPERATIONSTATUS", nullable = true) + /** + * Codigo de estatus de la operacion, ORI (Original), REF (refinanciada), RES (restructurada) + */ + private String operationstatus; + + @Column(name = "MOTIVESTATUSCATALOG", nullable = true) + /** + * Codigo de catalogo 1 Voluntario, Orden de Gerencia, 3 Orden de la SIB + */ + private String motivestatuscatalog; + + @Column(name = "MOTIVESTATUSCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo MOTIVESTATUS + */ + private String motivestatuscatalogcode; + + @Column(name = "SECURITYLEVEL", nullable = true) + /** + * Nivel de seguridad de la cuenta + */ + private Integer securitylevel; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "JOURNALID", nullable = true) + /** + * Numero de mensaje con el cual se cambio algun campo del registro + */ + private String journalid; + + @Column(name = "OLDJOURNALID", nullable = true) + /** + * NUmero de mensaje anterior con el que se cambio algun campo de la cuenta + */ + private String oldjournalid; + + /** Contructor por defecto */ + public TgeneAccount() { + } + + /** + * Contructor de TgeneAccount + * + * @param pPk Clave Primaria del entity + * @param pDatefrom Fecha desde la cual esta vigente el registro con datos de la cuenta. + */ + public TgeneAccount(TgeneAccountKey pPk, Timestamp pDatefrom) { + this(); + this.pk = pPk; + this.datefrom = pDatefrom; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneAccount + */ + public static TgeneAccount find(EntityManager pEntityManager, TgeneAccountKey pKey) throws Exception { + TgeneAccount obj = pEntityManager.find(TgeneAccount.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneAccount + * + * @return El objeto que referencia a la Clave primaria de TgeneAccount + */ + public TgeneAccountKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneAccount + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccount + */ + public void setPk(TgeneAccountKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de accountname + * + * @return valor de accountname + */ + public String getAccountname() { + return this.accountname; + } + + /** + * Fija el valor de accountname + * + * @param pAccountname nuevo Valor de accountname + */ + public void setAccountname(String pAccountname) { + this.accountname = pAccountname; + } + + /** + * Obtiene el valor de personcode + * + * @return valor de personcode + */ + public Integer getPersoncode() { + return this.personcode; + } + + /** + * Fija el valor de personcode + * + * @param pPersoncode nuevo Valor de personcode + */ + public void setPersoncode(Integer pPersoncode) { + this.personcode = pPersoncode; + } + + /** + * Obtiene el valor de modulecode + * + * @return valor de modulecode + */ + public String getModulecode() { + return this.modulecode; + } + + /** + * Fija el valor de modulecode + * + * @param pModulecode nuevo Valor de modulecode + */ + public void setModulecode(String pModulecode) { + this.modulecode = pModulecode; + } + + /** + * Obtiene el valor de productcode + * + * @return valor de productcode + */ + public String getProductcode() { + return this.productcode; + } + + /** + * Fija el valor de productcode + * + * @param pProductcode nuevo Valor de productcode + */ + public void setProductcode(String pProductcode) { + this.productcode = pProductcode; + } + + /** + * Obtiene el valor de subproductcode + * + * @return valor de subproductcode + */ + public String getSubproductcode() { + return this.subproductcode; + } + + /** + * Fija el valor de subproductcode + * + * @param pSubproductcode nuevo Valor de subproductcode + */ + public void setSubproductcode(String pSubproductcode) { + this.subproductcode = pSubproductcode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de officecode + * + * @return valor de officecode + */ + public Integer getOfficecode() { + return this.officecode; + } + + /** + * Fija el valor de officecode + * + * @param pOfficecode nuevo Valor de officecode + */ + public void setOfficecode(Integer pOfficecode) { + this.officecode = pOfficecode; + } + + /** + * Obtiene el valor de branchcode + * + * @return valor de branchcode + */ + public Integer getBranchcode() { + return this.branchcode; + } + + /** + * Fija el valor de branchcode + * + * @param pBranchcode nuevo Valor de branchcode + */ + public void setBranchcode(Integer pBranchcode) { + this.branchcode = pBranchcode; + } + + /** + * Obtiene el valor de openofficecode + * + * @return valor de openofficecode + */ + public Integer getOpenofficecode() { + return this.openofficecode; + } + + /** + * Fija el valor de openofficecode + * + * @param pOpenofficecode nuevo Valor de openofficecode + */ + public void setOpenofficecode(Integer pOpenofficecode) { + this.openofficecode = pOpenofficecode; + } + + /** + * Obtiene el valor de openbranchcode + * + * @return valor de openbranchcode + */ + public Integer getOpenbranchcode() { + return this.openbranchcode; + } + + /** + * Fija el valor de openbranchcode + * + * @param pOpenbranchcode nuevo Valor de openbranchcode + */ + public void setOpenbranchcode(Integer pOpenbranchcode) { + this.openbranchcode = pOpenbranchcode; + } + + /** + * Obtiene el valor de accountstatuscode + * + * @return valor de accountstatuscode + */ + public String getAccountstatuscode() { + return this.accountstatuscode; + } + + /** + * Fija el valor de accountstatuscode + * + * @param pAccountstatuscode nuevo Valor de accountstatuscode + */ + public void setAccountstatuscode(String pAccountstatuscode) { + this.accountstatuscode = pAccountstatuscode; + } + + /** + * Obtiene el valor de officer + * + * @return valor de officer + */ + public String getOfficer() { + return this.officer; + } + + /** + * Fija el valor de officer + * + * @param pOfficer nuevo Valor de officer + */ + public void setOfficer(String pOfficer) { + this.officer = pOfficer; + } + + /** + * Obtiene el valor de openingusercode + * + * @return valor de openingusercode + */ + public String getOpeningusercode() { + return this.openingusercode; + } + + /** + * Fija el valor de openingusercode + * + * @param pOpeningusercode nuevo Valor de openingusercode + */ + public void setOpeningusercode(String pOpeningusercode) { + this.openingusercode = pOpeningusercode; + } + + /** + * Obtiene el valor de personscorecatalog + * + * @return valor de personscorecatalog + */ + public String getPersonscorecatalog() { + return this.personscorecatalog; + } + + /** + * Fija el valor de personscorecatalog + * + * @param pPersonscorecatalog nuevo Valor de personscorecatalog + */ + public void setPersonscorecatalog(String pPersonscorecatalog) { + this.personscorecatalog = pPersonscorecatalog; + } + + /** + * Obtiene el valor de personcatalogcode + * + * @return valor de personcatalogcode + */ + public String getPersoncatalogcode() { + return this.personcatalogcode; + } + + /** + * Fija el valor de personcatalogcode + * + * @param pPersoncatalogcode nuevo Valor de personcatalogcode + */ + public void setPersoncatalogcode(String pPersoncatalogcode) { + this.personcatalogcode = pPersoncatalogcode; + } + + /** + * Obtiene el valor de chargecatalog + * + * @return valor de chargecatalog + */ + public String getChargecatalog() { + return this.chargecatalog; + } + + /** + * Fija el valor de chargecatalog + * + * @param pChargecatalog nuevo Valor de chargecatalog + */ + public void setChargecatalog(String pChargecatalog) { + this.chargecatalog = pChargecatalog; + } + + /** + * Obtiene el valor de chargecatalogcode + * + * @return valor de chargecatalogcode + */ + public String getChargecatalogcode() { + return this.chargecatalogcode; + } + + /** + * Fija el valor de chargecatalogcode + * + * @param pChargecatalogcode nuevo Valor de chargecatalogcode + */ + public void setChargecatalogcode(String pChargecatalogcode) { + this.chargecatalogcode = pChargecatalogcode; + } + + /** + * Obtiene el valor de ratecatalog + * + * @return valor de ratecatalog + */ + public String getRatecatalog() { + return this.ratecatalog; + } + + /** + * Fija el valor de ratecatalog + * + * @param pRatecatalog nuevo Valor de ratecatalog + */ + public void setRatecatalog(String pRatecatalog) { + this.ratecatalog = pRatecatalog; + } + + /** + * Obtiene el valor de ratecatalogcode + * + * @return valor de ratecatalogcode + */ + public String getRatecatalogcode() { + return this.ratecatalogcode; + } + + /** + * Fija el valor de ratecatalogcode + * + * @param pRatecatalogcode nuevo Valor de ratecatalogcode + */ + public void setRatecatalogcode(String pRatecatalogcode) { + this.ratecatalogcode = pRatecatalogcode; + } + + /** + * Obtiene el valor de credittypecode + * + * @return valor de credittypecode + */ + public String getCredittypecode() { + return this.credittypecode; + } + + /** + * Fija el valor de credittypecode + * + * @param pCredittypecode nuevo Valor de credittypecode + */ + public void setCredittypecode(String pCredittypecode) { + this.credittypecode = pCredittypecode; + } + + /** + * Obtiene el valor de operativcondition + * + * @return valor de operativcondition + */ + public String getOperativcondition() { + return this.operativcondition; + } + + /** + * Fija el valor de operativcondition + * + * @param pOperativcondition nuevo Valor de operativcondition + */ + public void setOperativcondition(String pOperativcondition) { + this.operativcondition = pOperativcondition; + } + + /** + * Obtiene el valor de operationstatus + * + * @return valor de operationstatus + */ + public String getOperationstatus() { + return this.operationstatus; + } + + /** + * Fija el valor de operationstatus + * + * @param pOperationstatus nuevo Valor de operationstatus + */ + public void setOperationstatus(String pOperationstatus) { + this.operationstatus = pOperationstatus; + } + + /** + * Obtiene el valor de motivestatuscatalog + * + * @return valor de motivestatuscatalog + */ + public String getMotivestatuscatalog() { + return this.motivestatuscatalog; + } + + /** + * Fija el valor de motivestatuscatalog + * + * @param pMotivestatuscatalog nuevo Valor de motivestatuscatalog + */ + public void setMotivestatuscatalog(String pMotivestatuscatalog) { + this.motivestatuscatalog = pMotivestatuscatalog; + } + + /** + * Obtiene el valor de motivestatuscatalogcode + * + * @return valor de motivestatuscatalogcode + */ + public String getMotivestatuscatalogcode() { + return this.motivestatuscatalogcode; + } + + /** + * Fija el valor de motivestatuscatalogcode + * + * @param pMotivestatuscatalogcode nuevo Valor de motivestatuscatalogcode + */ + public void setMotivestatuscatalogcode(String pMotivestatuscatalogcode) { + this.motivestatuscatalogcode = pMotivestatuscatalogcode; + } + + /** + * Obtiene el valor de securitylevel + * + * @return valor de securitylevel + */ + public Integer getSecuritylevel() { + return this.securitylevel; + } + + /** + * Fija el valor de securitylevel + * + * @param pSecuritylevel nuevo Valor de securitylevel + */ + public void setSecuritylevel(Integer pSecuritylevel) { + this.securitylevel = pSecuritylevel; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de journalid + * + * @return valor de journalid + */ + public String getJournalid() { + return this.journalid; + } + + /** + * Fija el valor de journalid + * + * @param pJournalid nuevo Valor de journalid + */ + public void setJournalid(String pJournalid) { + this.journalid = pJournalid; + } + + /** + * Obtiene el valor de oldjournalid + * + * @return valor de oldjournalid + */ + public String getOldjournalid() { + return this.oldjournalid; + } + + /** + * Fija el valor de oldjournalid + * + * @param pOldjournalid nuevo Valor de oldjournalid + */ + public void setOldjournalid(String pOldjournalid) { + this.oldjournalid = pOldjournalid; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneAccount)) { + return false; + } + TgeneAccount that = (TgeneAccount) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneAccount + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneAccount */ + @Override + public Object createInstance() { + TgeneAccount instance = new TgeneAccount(); + instance.setPk(new TgeneAccountKey()); + return instance; + } + + /** + * Clona la entidad TgeneAccount + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneAccount p = (TgeneAccount) this.clone(); + p.setPk((TgeneAccountKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + + // METODOS MANUALES + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pAccount Numero de cuenta. + * @param pCompany Codigo de compania al que pertenece la cuenta. + * @return TgeneAccount + */ + public static TgeneAccount findVigenteWhitlock(EntityManager pEntityManager, String pAccount, Integer pCompany) throws Exception { + if (!Constant.isOracleDialect(pEntityManager)) { + TgeneAccount.lockBaseAccount(pEntityManager, pAccount, pCompany); + } + TgeneAccountKey key = new TgeneAccountKey(pAccount, pCompany, Constant.getDefaultExpiryTimestamp()); + TgeneAccount obj = pEntityManager.find(TgeneAccount.class, key, LockModeType.PESSIMISTIC_READ); + if (obj == null) { + throw new CoreException("CORE-0007", "CUENTA NO EXISTE: {0} COMPANIA {1}", pAccount, pCompany); + } + return obj; + } + + /** + * Bloquea el registro en la base de datos para garantizar una solo actualizacion de saldos. + * + * @param pEntityManager Referencia a una session de base de datos. + * @param pAccount Numero de cuenta. + * @param pCompany Codigo de compania al que pertenece la cuenta. + * @throws Exception + */ + private static void lockBaseAccount(EntityManager pEntityManager, String pAccount, Integer pCompany) throws Exception { + Query qry = pEntityManager.createQuery("update TgeneBaseAccount set lockdb = 'Y' where pk.account = :account and pk.company = :company"); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + qry.executeUpdate(); + } + + /** + * Sentencia que devuelve datos generales de la cuneta de la tabla TgeneAccount. + */ + private static final String HQL_ACCOUNT_MESSAGE = "from TgeneAccount t " + " where t.pk.account = :account " + " and t.pk.company = :company " + + " and t.journalid = :journalid "; + + /** + * Entrega datos generales de la cuenta. + * + * @param pAccount Numero de cuenta. + * @param pCompany Codigo de compania. + * @param pJournalid Numero de mensaje a obtener la cuenta. + * @return TgeneAccount + * @throws Exception + */ + public static TgeneAccount findByJournalId(EntityManager pEntityManager, String pAccount, Integer pCompany, String pJournalid) throws Exception { + TgeneAccount tgeneAccount = null; + Query qry = pEntityManager.createQuery(HQL_ACCOUNT_MESSAGE); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + qry.setParameter("journalid", pJournalid); + try { + tgeneAccount = (TgeneAccount) qry.getSingleResult(); + } catch (NoResultException e) { + throw new CoreException("CORE-0007", "CUENTA NO EXISTE: {1} COMPANIA {2}", pAccount, pCompany); + } + return tgeneAccount; + } + + /** + * Sentencia que devuelve datos generales de la cuneta de la tabla TgeneAccount. + */ + private static final String HQL_ACCOUNT_MESSAGE_ = "from TgeneAccount t " + " where t.journalid = :journalid "; + + /** + * Entrega datos generales de la cuenta. + * + * @param pAccount Numero de cuenta. + * @param pCompany Codigo de compania. + * @param pJournalid Numero de mensaje a obtener la cuenta. + * @return TgeneAccount + * @throws Exception + */ + public static TgeneAccount findByJournalId(EntityManager pEntityManager, String pJournalid) throws Exception { + TgeneAccount tgeneAccount = null; + Query qry = pEntityManager.createQuery(HQL_ACCOUNT_MESSAGE_); + qry.setParameter("journalid", pJournalid); + try { + tgeneAccount = (TgeneAccount) qry.getSingleResult(); + } catch (NoResultException e) { + throw new CoreException("CORE-0007", "CUENTA NO EXISTE PARA EL MENSAJE: {1} ", pJournalid); + } + return tgeneAccount; + } + + /** + * Sentencia que devuelve datos generales de la cuenta de la tabla TgeneAccount. + */ + private static final String HQL_ACCOUNT_OLD_MESSAGE = "from TgeneAccount t " + " where t.pk.account = :account " + + " and t.pk.company = :company " + " and t.oldjournalid = :oldjournalid "; + + /** + * Entrega datos generales de la cuenta. + * + * @param pAccount Numero de cuenta. + * @param pCompany Codigo de compania. + * @param pJournalid Numero de mensaje a obtener la cuenta. + * @return TgeneAccount + * @throws Exception + */ + public static TgeneAccount findByOldJournalid(EntityManager pEntityManager, String pAccount, Integer pCompany, String pOldJournalid) + throws Exception { + TgeneAccount tgeneAccount = null; + Query qry = pEntityManager.createQuery(HQL_ACCOUNT_OLD_MESSAGE); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + qry.setParameter("oldjournalid", pOldJournalid); + try { + tgeneAccount = (TgeneAccount) qry.getSingleResult(); + } catch (NoResultException e) { + throw new CoreException("CORE-0007", "CUENTA NO EXISTE: {1} COMPANIA {2}", pAccount, pCompany); + } + return tgeneAccount; + } + + /** Sentencia que devuelve una lista de cuentas dado el codigo de persona. */ + private static final String HQL_LIST_ACCOUNT_BY_PERSONCODE = "from TgeneAccount t " + " where t.pk.dateto = :dateto " + + " and t.pk.company = :company " + " and t.personcode = :personcode "; + + /** + * Metodo que entrega una lidta de cuentas dado un codigo de persona. + * + * @param pEntityManager Sessiond e la base de datos. + * @param pCompany Codigo de compania. + * @param pPersoncode Codigo de persona. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, Integer pCompany, Integer pPersoncode) throws Exception { + List ldata = null; + Query qry = pEntityManager.createQuery(HQL_LIST_ACCOUNT_BY_PERSONCODE); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + qry.setParameter("company", pCompany); + qry.setParameter("personcode", pPersoncode); + ldata = qry.getResultList(); + return ldata; + } + + /** + * Sentencia que devuelve un registro de la tabla TgeneAccount + */ + private static final String JPQL_TGENE_ACCOUNT = "from TgeneAccount tga" + " where tga.pk.account = :account" + + " and tga.pk.company = :company" + " and tga.pk.dateto = :dateto"; + + /** + * Metodo que devuelve un registro de la tabla TGENEACCOUNT + * + * @param account Numero de la cuenta + * @param company Compania a la que pertenece la cuenta + * @param dateto Fecha de vigencia de la tarjeta + * @return + */ + public static TgeneAccount findByFechaVigenciaTarjeta(EntityManager pEntityManager, String account, Integer company, Timestamp dateto) + throws Exception { + Query qry = pEntityManager.createQuery(TgeneAccount.JPQL_TGENE_ACCOUNT); + qry.setParameter("account", account); + qry.setParameter("company", company); + qry.setParameter("dateto", dateto); + try { + return (TgeneAccount) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + + private static final String JPQL_CURRENT_BY_PRODUCT = "from TgeneAccount tga " + + "where tga.modulecode = :modulecode and tga.productcode = :productcode " + + "and tga.subproductcode IN (:subproductcode) and tga.pk.dateto = :dateto " + + "and tga.personcode = :personcode and tga.accountstatuscode = :accountstatuscode"; + + /** + * Permite obtener las cuentas deprstamos que esten en estado vigente a partir de los codigos de productos de + * reestructuracion + * + * @param entityManager Administrador de entidades y persistencia + * @param moduleCode Codigo de modulo + * @param productCode Codigo de producto + * @param subProductCode Codigo de subproducto + * @param personCode Codigo de persona + * @return lista de objetos de tipo {@link TgeneAccount} con el resultado de la operacion + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findCurrentByProduct(EntityManager entityManager, String moduleCode, String productCode, + List subProductCode, Integer personCode) throws Exception { + List result = null; + + Query qry = entityManager.createQuery(TgeneAccount.JPQL_CURRENT_BY_PRODUCT); + qry.setParameter(com.fp.common.helper.Constant.VMODULECODE, moduleCode); + qry.setParameter(com.fp.common.helper.Constant.VPRODUCTCODE, productCode); + qry.setParameter(com.fp.common.helper.Constant.VSUBPRODUCTCODE, subProductCode); + qry.setParameter(com.fp.common.helper.Constant.VDATETO, Constant.getDefaultExpiryDate()); + qry.setParameter("personcode", personCode); + qry.setParameter("accountstatuscode", "VIG"); + + result = qry.getResultList(); + + return result; + } + + private static final String JPQL_CURRENT_BY_ACCOUNT = "from TgeneAccount tga " + + "where tga.modulecode = :modulecode and tga.productcode = :productcode " + + "and tga.pk.account IN (:account) and tga.pk.dateto = :dateto " + + "and tga.currencycode = :currencycode and tga.accountstatuscode = :accountstatuscode"; + + /** + * Permite obtener las cuentas deprstamos que esten en estado vigente a partir de los codigos de cuentas de + * prestamo + * + * @param entityManager Administrador de entidades y persistencia + * @param moduleCode Codigo de modulo + * @param productCode Codigo de producto + * @param account Lista de Strings con las cuentas a consultar + * @param currencyCode Codigo de modeda + * @return lista de objetos de tipo {@link TgeneAccount} con el resultado de la operacion + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findCurrentByAccount(EntityManager entityManager, String moduleCode, String productCode, List account, + String currencyCode) throws Exception { + List result = null; + + Query qry = entityManager.createQuery(TgeneAccount.JPQL_CURRENT_BY_ACCOUNT); + qry.setParameter(com.fp.common.helper.Constant.VMODULECODE, moduleCode); + qry.setParameter(com.fp.common.helper.Constant.VPRODUCTCODE, productCode); + qry.setParameter(com.fp.common.helper.Constant.VACCOUNT, account); + qry.setParameter(com.fp.common.helper.Constant.VDATETO, Constant.getDefaultExpiryDate()); + qry.setParameter(com.fp.common.helper.Constant.VCURRENCYCODE, currencyCode); + qry.setParameter("accountstatuscode", "VIG"); + + result = qry.getResultList(); + + return result; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountCredit.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountCredit.java.svn-base new file mode 100644 index 0000000..a329268 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountCredit.java.svn-base @@ -0,0 +1,339 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTCREDIT*/ +@Entity(name="TgeneAccountCredit") +@Table(name="TGENEACCOUNTCREDIT") +public class TgeneAccountCredit extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountCredit +*/ +@EmbeddedId +private TgeneAccountCreditKey pk; +@Column(name="QUOTANUMBER", nullable=true) + +/** +* Numero de cuota, a pagar se utiliza en la transaccion de pago en caja sea en efectivo o cheques. +*/ +private Integer quotanumber; + +@Column(name="CREDIT", nullable=true) + +/** +* Indica que el pago se realiaza con credito a una cuenta. +*/ +private String credit; + +@Column(name="CASH", nullable=true) + +/** +* Indica que el pago se realiaza en efectivo. +*/ +private String cash; + +@Column(name="CHECKS", nullable=true) + +/** +* Indica que el pago se realiaza en cheque. +*/ +private String checks; + +@Column(name="CURRENCY", nullable=true) + +/** +* Codigo de moneda de la cuenta de la operacion. +*/ +private String currency; + +@Column(name="VALUE", nullable=true) + +/** +* El valor esta expresado en la moneda de la cuenta, del prestamo, plazo fijo etc.. +*/ +private BigDecimal value; + +@Column(name="CREDITACCOUNT", nullable=true) + +/** +* Numero de cuenta a acreditar cuando el cargo se cobra con debito a la cuenta. +*/ +private String creditaccount; + +@Column(name="CREDITACCOUNTINGCODE", nullable=true) + +/** +* Codigo contable a acreditar cuando el cargo se cobra con debito a la cuenta. +*/ +private String creditaccountingcode; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Si el valor se entrega en efectivo o cheque y el benefiniciario esta en las tablas de clientes, en el campo va el codigo de persona asociado. +*/ +private Integer personcode; + +@Column(name="IDBENEFICIARY", nullable=true) + +/** +* Si el beneficiario no esta registrado en la tabla de personas, en el campo va la identificacion del venceficiario. +*/ +private String idbeneficiary; + +@Column(name="BENEFICIARYNAME", nullable=true) + +/** +* Nombre del beneficiario. +*/ +private String beneficiaryname; + +@Column(name="JOURNALID", nullable=true) + +/** +* Numero de mensaje con el que realizo el pago. +*/ +private String journalid; + +/**Contructor por defecto*/ +public TgeneAccountCredit(){ +} +/**Contructor de TgeneAccountCredit +@param pPk Clave Primaria del entity +*/ +public TgeneAccountCredit(TgeneAccountCreditKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountCredit +*/ +public static TgeneAccountCredit find(EntityManager pEntityManager,TgeneAccountCreditKey pKey) throws Exception{ + TgeneAccountCredit obj = pEntityManager.find(TgeneAccountCredit.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountCredit +@return El objeto que referencia a la Clave primaria de TgeneAccountCredit +*/ +public TgeneAccountCreditKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountCredit +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountCredit +*/ +public void setPk(TgeneAccountCreditKey pPk){ + pk=pPk; +} +/**Obtiene el valor de quotanumber +@return valor de quotanumber*/ +public Integer getQuotanumber(){ + return quotanumber; +} +/**Fija el valor de quotanumber +@param pQuotanumber nuevo Valor de quotanumber*/ +public void setQuotanumber(Integer pQuotanumber){ + quotanumber=pQuotanumber; +} + +/**Obtiene el valor de credit +@return valor de credit*/ +public String getCredit(){ + return credit; +} +/**Fija el valor de credit +@param pCredit nuevo Valor de credit*/ +public void setCredit(String pCredit){ + credit=pCredit; +} + +/**Obtiene el valor de cash +@return valor de cash*/ +public String getCash(){ + return cash; +} +/**Fija el valor de cash +@param pCash nuevo Valor de cash*/ +public void setCash(String pCash){ + cash=pCash; +} + +/**Obtiene el valor de checks +@return valor de checks*/ +public String getChecks(){ + return checks; +} +/**Fija el valor de checks +@param pChecks nuevo Valor de checks*/ +public void setChecks(String pChecks){ + checks=pChecks; +} + +/**Obtiene el valor de currency +@return valor de currency*/ +public String getCurrency(){ + return currency; +} +/**Fija el valor de currency +@param pCurrency nuevo Valor de currency*/ +public void setCurrency(String pCurrency){ + currency=pCurrency; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +/**Obtiene el valor de creditaccount +@return valor de creditaccount*/ +public String getCreditaccount(){ + return creditaccount; +} +/**Fija el valor de creditaccount +@param pCreditaccount nuevo Valor de creditaccount*/ +public void setCreditaccount(String pCreditaccount){ + creditaccount=pCreditaccount; +} + +/**Obtiene el valor de creditaccountingcode +@return valor de creditaccountingcode*/ +public String getCreditaccountingcode(){ + return creditaccountingcode; +} +/**Fija el valor de creditaccountingcode +@param pCreditaccountingcode nuevo Valor de creditaccountingcode*/ +public void setCreditaccountingcode(String pCreditaccountingcode){ + creditaccountingcode=pCreditaccountingcode; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de idbeneficiary +@return valor de idbeneficiary*/ +public String getIdbeneficiary(){ + return idbeneficiary; +} +/**Fija el valor de idbeneficiary +@param pIdbeneficiary nuevo Valor de idbeneficiary*/ +public void setIdbeneficiary(String pIdbeneficiary){ + idbeneficiary=pIdbeneficiary; +} + +/**Obtiene el valor de beneficiaryname +@return valor de beneficiaryname*/ +public String getBeneficiaryname(){ + return beneficiaryname; +} +/**Fija el valor de beneficiaryname +@param pBeneficiaryname nuevo Valor de beneficiaryname*/ +public void setBeneficiaryname(String pBeneficiaryname){ + beneficiaryname=pBeneficiaryname; +} + +/**Obtiene el valor de journalid +@return valor de journalid*/ +public String getJournalid(){ + return journalid; +} +/**Fija el valor de journalid +@param pJournalid nuevo Valor de journalid*/ +public void setJournalid(String pJournalid){ + journalid=pJournalid; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountCredit))return false; + TgeneAccountCredit that = (TgeneAccountCredit) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountCredit +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountCredit +*/ +public Object createInstance(){ + TgeneAccountCredit instance=new TgeneAccountCredit(); + instance.setPk(new TgeneAccountCreditKey()); + return instance; +} +/**Clona la entidad TgeneAccountCredit +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountCredit p=(TgeneAccountCredit)this.clone(); + p.setPk((TgeneAccountCreditKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountCreditKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountCreditKey.java.svn-base new file mode 100644 index 0000000..eda4371 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountCreditKey.java.svn-base @@ -0,0 +1,179 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTCREDIT*/ +@Embeddable +public class TgeneAccountCreditKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="CREATIONDATE", nullable=false,updatable=false) + +/** +* Fecha de creacion del registro. +*/ +private Date creationdate; + +@Column(name="CREDITSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del credito. +*/ +private Integer creditsequence; + +/**Contructor por defecto*/ +public TgeneAccountCreditKey(){} +/**Contructor de TgeneAccountCreditKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pCreationdate Fecha de creacion del registro. +@param pCreditsequence Secuencia del credito. +*/ +public TgeneAccountCreditKey(String pAccount,Integer pCompany,Date pCreationdate,Integer pCreditsequence){ + account=pAccount; + company=pCompany; + creationdate=pCreationdate; + creditsequence=pCreditsequence; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de creationdate +@return valor de creationdate*/ +public Date getCreationdate(){ + return creationdate; +} +/**Fija el valor de creationdate +@param pCreationdate nuevo Valor de creationdate*/ +public void setCreationdate(Date pCreationdate){ + creationdate=pCreationdate; +} + +/**Obtiene el valor de creditsequence +@return valor de creditsequence*/ +public Integer getCreditsequence(){ + return creditsequence; +} +/**Fija el valor de creditsequence +@param pCreditsequence nuevo Valor de creditsequence*/ +public void setCreditsequence(Integer pCreditsequence){ + creditsequence=pCreditsequence; +} + +/**Implementacin de la comparacin de TgeneAccountCreditKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountCreditKey))return false; + TgeneAccountCreditKey that = (TgeneAccountCreditKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getCreationdate() == null || that.getCreationdate() == null){ + return false; + } + if (! this.getCreationdate().equals(that.getCreationdate())){ + return false; + } + if (this.getCreditsequence() == null || that.getCreditsequence() == null){ + return false; + } + if (! this.getCreditsequence().equals(that.getCreditsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountCreditKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getCreationdate() == null ? 0 : this.getCreationdate().hashCode()); + result = result * 37 + (this.getCreditsequence() == null ? 0 : this.getCreditsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountCreditOpening.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountCreditOpening.java.svn-base new file mode 100644 index 0000000..0224055 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountCreditOpening.java.svn-base @@ -0,0 +1,332 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTCREDITOPENING*/ +@Entity(name="TgeneAccountCreditOpening") +@Table(name="TGENEACCOUNTCREDITOPENING") +public class TgeneAccountCreditOpening extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountCreditOpening +*/ +@EmbeddedId +private TgeneAccountCreditOpeningKey pk; +@Column(name="CASH", nullable=true) + +/** +* Indica que el pago se realiaza en efectivo. +*/ +private String cash; + +@Column(name="CHECKS", nullable=true) + +/** +* Indica que el pago se realiaza en cheque. +*/ +private String checks; + +@Column(name="CREDIT", nullable=true) + +/** +* Indica que el pago se realiaza con credito a una cuenta. +*/ +private String credit; + +@Column(name="CREDITACCOUNT", nullable=true) + +/** +* Numero de cuenta a acreditar cuando el cargo se cobra con debito a la cuenta. +*/ +private String creditaccount; + +@Column(name="CREDITACCOUNTINGCODE", nullable=true) + +/** +* Codigo contable a acreditar cuando el cargo se cobra con debito a la cuenta. +*/ +private String creditaccountingcode; + +@Column(name="CURRENCY", nullable=true) + +/** +* Codigo de moneda de la cuenta de la operacion. +*/ +private String currency; + +@Column(name="VALUE", nullable=true) + +/** +* El valor esta expresado en la moneda de la cuenta, del prestamo, plazo fijo etc.. +*/ +private BigDecimal value; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Si el valor se entrega en efectivo o cheque y el benefiniciario esta en las tablas de clientes, en el campo va el codigo de persona asociado. +*/ +private Integer personcode; + +@Column(name="IDBENEFICIARY", nullable=true) + +/** +* Si el beneficiario no esta registrado en la tabla de personas, en el campo va la identificacion del venceficiario. +*/ +private String idbeneficiary; + +@Column(name="BENEFICIARYNAME", nullable=true) + +/** +* Nombre del beneficiario. +*/ +private String beneficiaryname; + +/**Contructor por defecto*/ +public TgeneAccountCreditOpening(){ +} +/**Contructor de TgeneAccountCreditOpening +@param pPk Clave Primaria del entity +*/ +public TgeneAccountCreditOpening(TgeneAccountCreditOpeningKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountCreditOpening +*/ +public static TgeneAccountCreditOpening find(EntityManager pEntityManager,TgeneAccountCreditOpeningKey pKey) throws Exception{ + TgeneAccountCreditOpening obj = pEntityManager.find(TgeneAccountCreditOpening.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountCreditOpening +@return El objeto que referencia a la Clave primaria de TgeneAccountCreditOpening +*/ +public TgeneAccountCreditOpeningKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountCreditOpening +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountCreditOpening +*/ +public void setPk(TgeneAccountCreditOpeningKey pPk){ + pk=pPk; +} +/**Obtiene el valor de cash +@return valor de cash*/ +public String getCash(){ + return cash; +} +/**Fija el valor de cash +@param pCash nuevo Valor de cash*/ +public void setCash(String pCash){ + cash=pCash; +} + +/**Obtiene el valor de checks +@return valor de checks*/ +public String getChecks(){ + return checks; +} +/**Fija el valor de checks +@param pChecks nuevo Valor de checks*/ +public void setChecks(String pChecks){ + checks=pChecks; +} + +/**Obtiene el valor de credit +@return valor de credit*/ +public String getCredit(){ + return credit; +} +/**Fija el valor de credit +@param pCredit nuevo Valor de credit*/ +public void setCredit(String pCredit){ + credit=pCredit; +} + +/**Obtiene el valor de creditaccount +@return valor de creditaccount*/ +public String getCreditaccount(){ + return creditaccount; +} +/**Fija el valor de creditaccount +@param pCreditaccount nuevo Valor de creditaccount*/ +public void setCreditaccount(String pCreditaccount){ + creditaccount=pCreditaccount; +} + +/**Obtiene el valor de creditaccountingcode +@return valor de creditaccountingcode*/ +public String getCreditaccountingcode(){ + return creditaccountingcode; +} +/**Fija el valor de creditaccountingcode +@param pCreditaccountingcode nuevo Valor de creditaccountingcode*/ +public void setCreditaccountingcode(String pCreditaccountingcode){ + creditaccountingcode=pCreditaccountingcode; +} + +/**Obtiene el valor de currency +@return valor de currency*/ +public String getCurrency(){ + return currency; +} +/**Fija el valor de currency +@param pCurrency nuevo Valor de currency*/ +public void setCurrency(String pCurrency){ + currency=pCurrency; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de idbeneficiary +@return valor de idbeneficiary*/ +public String getIdbeneficiary(){ + return idbeneficiary; +} +/**Fija el valor de idbeneficiary +@param pIdbeneficiary nuevo Valor de idbeneficiary*/ +public void setIdbeneficiary(String pIdbeneficiary){ + idbeneficiary=pIdbeneficiary; +} + +/**Obtiene el valor de beneficiaryname +@return valor de beneficiaryname*/ +public String getBeneficiaryname(){ + return beneficiaryname; +} +/**Fija el valor de beneficiaryname +@param pBeneficiaryname nuevo Valor de beneficiaryname*/ +public void setBeneficiaryname(String pBeneficiaryname){ + beneficiaryname=pBeneficiaryname; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountCreditOpening))return false; + TgeneAccountCreditOpening that = (TgeneAccountCreditOpening) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountCreditOpening +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountCreditOpening +*/ +public Object createInstance(){ + TgeneAccountCreditOpening instance=new TgeneAccountCreditOpening(); + instance.setPk(new TgeneAccountCreditOpeningKey()); + return instance; +} +/**Clona la entidad TgeneAccountCreditOpening +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountCreditOpening p=(TgeneAccountCreditOpening)this.clone(); + p.setPk((TgeneAccountCreditOpeningKey)this.pk.cloneMe()); + return p; +} + + //Metodos manuales + /**Sentencia que devuelve uan lista con los valores a entregar al cliente asociados a una cuenta.*/ + private static final String HQL_ACCO_CREDIT_OPENING = + " from TgeneAccountCreditOpening t " + + " where t.pk.account = :account "+ + " and t.pk.company = :company "+ + " order by t.pk.creditsequence "; + + /** + * Metodo que entrega una lista de valores a entregar al cliente, en la aperturad e una operacion. + * @param pAccount Numero de cuenta. + * @param pCompany Codigo de compania a la que pertenece la cuenta. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager,String pAccount,Integer pCompany) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_ACCO_CREDIT_OPENING); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountCreditOpeningKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountCreditOpeningKey.java.svn-base new file mode 100644 index 0000000..894015b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountCreditOpeningKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTCREDITOPENING*/ +@Embeddable +public class TgeneAccountCreditOpeningKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="CREDITSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del credito. +*/ +private Integer creditsequence; + +/**Contructor por defecto*/ +public TgeneAccountCreditOpeningKey(){} +/**Contructor de TgeneAccountCreditOpeningKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pCreditsequence Secuencia del credito. +*/ +public TgeneAccountCreditOpeningKey(String pAccount,Integer pCompany,Integer pCreditsequence){ + account=pAccount; + company=pCompany; + creditsequence=pCreditsequence; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de creditsequence +@return valor de creditsequence*/ +public Integer getCreditsequence(){ + return creditsequence; +} +/**Fija el valor de creditsequence +@param pCreditsequence nuevo Valor de creditsequence*/ +public void setCreditsequence(Integer pCreditsequence){ + creditsequence=pCreditsequence; +} + +/**Implementacin de la comparacin de TgeneAccountCreditOpeningKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountCreditOpeningKey))return false; + TgeneAccountCreditOpeningKey that = (TgeneAccountCreditOpeningKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getCreditsequence() == null || that.getCreditsequence() == null){ + return false; + } + if (! this.getCreditsequence().equals(that.getCreditsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountCreditOpeningKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getCreditsequence() == null ? 0 : this.getCreditsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountDebitOpening.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountDebitOpening.java.svn-base new file mode 100644 index 0000000..b0eb4d5 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountDebitOpening.java.svn-base @@ -0,0 +1,313 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTDEBITOPENING*/ +@Entity(name="TgeneAccountDebitOpening") +@Table(name="TGENEACCOUNTDEBITOPENING") +public class TgeneAccountDebitOpening extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountDebitOpening +*/ +@EmbeddedId +private TgeneAccountDebitOpeningKey pk; +@Column(name="CASH", nullable=true) + +/** +* Indica que el cargo se realiaza en efectivo. +*/ +private String cash; + +@Column(name="CHECKS", nullable=true) + +/** +* Indica que el cargo se realiaza en cheque. +*/ +private String checks; + +@Column(name="DEBIT", nullable=true) + +/** +* Indica que el cargo se realiaza con debito a la cuenta. +*/ +private String debit; + +@Column(name="DEBITACCOUNT", nullable=true) + +/** +* Numero de cuenta a debitar cuando el cargo se cobra con debito a la cuenta. +*/ +private String debitaccount; + +@Column(name="ACCOUNTMODULE", nullable=true) + +/** +* Codigo de modulo al que pertenece la cuenta a debitar +*/ +private String accountmodule; + +@Column(name="DEBITACCOUNTINGCODE", nullable=true) + +/** +* Codigo contable cuando el cargo se cobra con debito a la cuenta. +*/ +private String debitaccountingcode; + +@Column(name="CURRENCY", nullable=true) + +/** +* Codigo de moneda de la cuenta de la operacion. +*/ +private String currency; + +@Column(name="VALUE", nullable=true) + +/** +* Valor en la moneda de la cuenta, la compra venta se hace en funcion a la moneda de la cuenta debito +*/ +private BigDecimal value; + +@Column(name="JOURNALID", nullable=true) + +/** +* Numero de mensaje con el que se realizo el financiero. +*/ +private String journalid; + +/**Contructor por defecto*/ +public TgeneAccountDebitOpening(){ +} +/**Contructor de TgeneAccountDebitOpening +@param pPk Clave Primaria del entity +*/ +public TgeneAccountDebitOpening(TgeneAccountDebitOpeningKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountDebitOpening +*/ +public static TgeneAccountDebitOpening find(EntityManager pEntityManager,TgeneAccountDebitOpeningKey pKey) throws Exception{ + TgeneAccountDebitOpening obj = pEntityManager.find(TgeneAccountDebitOpening.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountDebitOpening +@return El objeto que referencia a la Clave primaria de TgeneAccountDebitOpening +*/ +public TgeneAccountDebitOpeningKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountDebitOpening +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountDebitOpening +*/ +public void setPk(TgeneAccountDebitOpeningKey pPk){ + pk=pPk; +} +/**Obtiene el valor de cash +@return valor de cash*/ +public String getCash(){ + return cash; +} +/**Fija el valor de cash +@param pCash nuevo Valor de cash*/ +public void setCash(String pCash){ + cash=pCash; +} + +/**Obtiene el valor de checks +@return valor de checks*/ +public String getChecks(){ + return checks; +} +/**Fija el valor de checks +@param pChecks nuevo Valor de checks*/ +public void setChecks(String pChecks){ + checks=pChecks; +} + +/**Obtiene el valor de debit +@return valor de debit*/ +public String getDebit(){ + return debit; +} +/**Fija el valor de debit +@param pDebit nuevo Valor de debit*/ +public void setDebit(String pDebit){ + debit=pDebit; +} + +/**Obtiene el valor de debitaccount +@return valor de debitaccount*/ +public String getDebitaccount(){ + return debitaccount; +} +/**Fija el valor de debitaccount +@param pDebitaccount nuevo Valor de debitaccount*/ +public void setDebitaccount(String pDebitaccount){ + debitaccount=pDebitaccount; +} + +/**Obtiene el valor de accountmodule +@return valor de accountmodule*/ +public String getAccountmodule(){ + return accountmodule; +} +/**Fija el valor de accountmodule +@param pAccountmodule nuevo Valor de accountmodule*/ +public void setAccountmodule(String pAccountmodule){ + accountmodule=pAccountmodule; +} + +/**Obtiene el valor de debitaccountingcode +@return valor de debitaccountingcode*/ +public String getDebitaccountingcode(){ + return debitaccountingcode; +} +/**Fija el valor de debitaccountingcode +@param pDebitaccountingcode nuevo Valor de debitaccountingcode*/ +public void setDebitaccountingcode(String pDebitaccountingcode){ + debitaccountingcode=pDebitaccountingcode; +} + +/**Obtiene el valor de currency +@return valor de currency*/ +public String getCurrency(){ + return currency; +} +/**Fija el valor de currency +@param pCurrency nuevo Valor de currency*/ +public void setCurrency(String pCurrency){ + currency=pCurrency; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +/**Obtiene el valor de journalid +@return valor de value*/ +public String getJournalid(){ + return journalid; +} +/**Fija el valor de journalid +@param journalid nuevo Valor de journalid*/ +public void setJournalid(String pJournalid){ + journalid=pJournalid; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountDebitOpening))return false; + TgeneAccountDebitOpening that = (TgeneAccountDebitOpening) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountDebitOpening +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountDebitOpening +*/ +public Object createInstance(){ + TgeneAccountDebitOpening instance=new TgeneAccountDebitOpening(); + instance.setPk(new TgeneAccountDebitOpeningKey()); + return instance; +} +/**Clona la entidad TgeneAccountDebitOpening +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountDebitOpening p=(TgeneAccountDebitOpening)this.clone(); + p.setPk((TgeneAccountDebitOpeningKey)this.pk.cloneMe()); + return p; +} + //Metodos manuales. + /**Sentencia que devuelve uan lista con los valores de cargos asociados a una solicitud.*/ + private static final String HQL_ACCO_DEBIT_OPENING = + "from TgeneAccountDebitOpening t " + + " where t.pk.account = :account "+ + " and t.pk.company = :company "+ + " order by t.pk.debitsequence "; + + /** + * Metodo que entrega una lista de valores a cobrar al cliente, en la aperturad e una operacion. + * @param pAccount Numero de cuenta. + * @param pCompany Codigo de compania a la que pertenece la cuenta. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager,String pAccount,Integer pCompany) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_ACCO_DEBIT_OPENING); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountDebitOpeningKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountDebitOpeningKey.java.svn-base new file mode 100644 index 0000000..bf0eee1 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountDebitOpeningKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTDEBITOPENING*/ +@Embeddable +public class TgeneAccountDebitOpeningKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="DEBITSEQUENCE", nullable=false,updatable=false) + +/** +* Sequencia de debito. +*/ +private Integer debitsequence; + +/**Contructor por defecto*/ +public TgeneAccountDebitOpeningKey(){} +/**Contructor de TgeneAccountDebitOpeningKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pDebitsequence Sequencia de debito. +*/ +public TgeneAccountDebitOpeningKey(String pAccount,Integer pCompany,Integer pDebitsequence){ + account=pAccount; + company=pCompany; + debitsequence=pDebitsequence; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de debitsequence +@return valor de debitsequence*/ +public Integer getDebitsequence(){ + return debitsequence; +} +/**Fija el valor de debitsequence +@param pDebitsequence nuevo Valor de debitsequence*/ +public void setDebitsequence(Integer pDebitsequence){ + debitsequence=pDebitsequence; +} + +/**Implementacin de la comparacin de TgeneAccountDebitOpeningKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountDebitOpeningKey))return false; + TgeneAccountDebitOpeningKey that = (TgeneAccountDebitOpeningKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getDebitsequence() == null || that.getDebitsequence() == null){ + return false; + } + if (! this.getDebitsequence().equals(that.getDebitsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountDebitOpeningKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getDebitsequence() == null ? 0 : this.getDebitsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountForCredit.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountForCredit.java.svn-base new file mode 100644 index 0000000..8166320 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountForCredit.java.svn-base @@ -0,0 +1,401 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTFORCREDIT */ +@Entity(name = "TgeneAccountForCredit") +@Table(name = "TGENEACCOUNTFORCREDIT") +public class TgeneAccountForCredit extends com.fp.dto.AbstractDataTransport + implements + Serializable, + HibernateBean, + Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneAccountForCredit + */ + @EmbeddedId + private TgeneAccountForCreditKey pk; + @Column(name = "CASH", nullable = true) + /** + * Indica que el pago se realiaza en efectivo. + */ + private String cash; + + @Column(name = "CHECKS", nullable = true) + /** + * Indica que el pago se realiaza en cheque. + */ + private String checks; + + @Column(name = "CREDIT", nullable = true) + /** + * Indica que el pago se realiaza con credito a una cuenta. + */ + private String credit; + + @Column(name = "CREDITACCOUNT", nullable = true) + /** + * Numero de cuenta a acreditar cuando el cargo se cobra con debito a la cuenta. + */ + private String creditaccount; + + @Column(name = "CREDITACCOUNTINGCODE", nullable = true) + /** + * Codigo contable a acreditar cuando el cargo se cobra con debito a la cuenta. + */ + private String creditaccountingcode; + + @Column(name = "CURRENCY", nullable = true) + /** + * Codigo de moneda de la cuenta de la operacion. + */ + private String currency; + + @Column(name = "VALUE", nullable = true) + /** + * El valor esta expresado en la moneda de la cuenta, del prestamo, plazo fijo etc.. + */ + private BigDecimal value; + + @Column(name = "PERSONCODE", nullable = true) + /** + * Si el valor se entrega en efectivo o cheque y el benefiniciario esta en las tablas de clientes, en el campo va el codigo de persona asociado. + */ + private Integer personcode; + + @Column(name = "IDBENEFICIARY", nullable = true) + /** + * Si el beneficiario no esta registrado en la tabla de personas, en el campo va la identificacion del venceficiario. + */ + private String idbeneficiary; + + @Column(name = "BENEFICIARYNAME", nullable = true) + /** + * Nombre del beneficiario. + */ + private String beneficiaryname; + + /** Contructor por defecto */ + public TgeneAccountForCredit() { + } + /** + * Contructor de TgeneAccountForCredit + * + * @param pPk Clave Primaria del entity + */ + public TgeneAccountForCredit(TgeneAccountForCreditKey pPk) { + this(); + pk = pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneAccountForCredit + */ + public static TgeneAccountForCredit find(EntityManager pEntityManager, TgeneAccountForCreditKey pKey) + throws Exception { + TgeneAccountForCredit obj = pEntityManager.find(TgeneAccountForCredit.class, pKey); + return obj; + } + /** + * Entrega la Clave primaria de TgeneAccountForCredit + * + * @return El objeto que referencia a la Clave primaria de TgeneAccountForCredit + */ + public TgeneAccountForCreditKey getPk() { + return pk; + } + /** + * Fija un nuevo valor a la Clave primaria de TgeneAccountForCredit + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountForCredit + */ + public void setPk(TgeneAccountForCreditKey pPk) { + pk = pPk; + } + /** + * Obtiene el valor de cash + * + * @return valor de cash + */ + public String getCash() { + return cash; + } + /** + * Fija el valor de cash + * + * @param pCash nuevo Valor de cash + */ + public void setCash(String pCash) { + cash = pCash; + } + + /** + * Obtiene el valor de checks + * + * @return valor de checks + */ + public String getChecks() { + return checks; + } + /** + * Fija el valor de checks + * + * @param pChecks nuevo Valor de checks + */ + public void setChecks(String pChecks) { + checks = pChecks; + } + + /** + * Obtiene el valor de credit + * + * @return valor de credit + */ + public String getCredit() { + return credit; + } + /** + * Fija el valor de credit + * + * @param pCredit nuevo Valor de credit + */ + public void setCredit(String pCredit) { + credit = pCredit; + } + + /** + * Obtiene el valor de creditaccount + * + * @return valor de creditaccount + */ + public String getCreditaccount() { + return creditaccount; + } + /** + * Fija el valor de creditaccount + * + * @param pCreditaccount nuevo Valor de creditaccount + */ + public void setCreditaccount(String pCreditaccount) { + creditaccount = pCreditaccount; + } + + /** + * Obtiene el valor de creditaccountingcode + * + * @return valor de creditaccountingcode + */ + public String getCreditaccountingcode() { + return creditaccountingcode; + } + /** + * Fija el valor de creditaccountingcode + * + * @param pCreditaccountingcode nuevo Valor de creditaccountingcode + */ + public void setCreditaccountingcode(String pCreditaccountingcode) { + creditaccountingcode = pCreditaccountingcode; + } + + /** + * Obtiene el valor de currency + * + * @return valor de currency + */ + public String getCurrency() { + return currency; + } + /** + * Fija el valor de currency + * + * @param pCurrency nuevo Valor de currency + */ + public void setCurrency(String pCurrency) { + currency = pCurrency; + } + + /** + * Obtiene el valor de value + * + * @return valor de value + */ + public BigDecimal getValue() { + return value; + } + /** + * Fija el valor de value + * + * @param pValue nuevo Valor de value + */ + public void setValue(BigDecimal pValue) { + value = pValue; + } + + /** + * Obtiene el valor de personcode + * + * @return valor de personcode + */ + public Integer getPersoncode() { + return personcode; + } + /** + * Fija el valor de personcode + * + * @param pPersoncode nuevo Valor de personcode + */ + public void setPersoncode(Integer pPersoncode) { + personcode = pPersoncode; + } + + /** + * Obtiene el valor de idbeneficiary + * + * @return valor de idbeneficiary + */ + public String getIdbeneficiary() { + return idbeneficiary; + } + /** + * Fija el valor de idbeneficiary + * + * @param pIdbeneficiary nuevo Valor de idbeneficiary + */ + public void setIdbeneficiary(String pIdbeneficiary) { + idbeneficiary = pIdbeneficiary; + } + + /** + * Obtiene el valor de beneficiaryname + * + * @return valor de beneficiaryname + */ + public String getBeneficiaryname() { + return beneficiaryname; + } + /** + * Fija el valor de beneficiaryname + * + * @param pBeneficiaryname nuevo Valor de beneficiaryname + */ + public void setBeneficiaryname(String pBeneficiaryname) { + beneficiaryname = pBeneficiaryname; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneAccountForCredit)) + return false; + TgeneAccountForCredit that = (TgeneAccountForCredit) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /** + * Implementacin del metodo hashCode de la la entidad TgeneAccountForCredit + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + /** Implementacin de la creacin de un bean en blanco TgeneAccountForCredit */ + public Object createInstance() { + TgeneAccountForCredit instance = new TgeneAccountForCredit(); + instance.setPk(new TgeneAccountForCreditKey()); + return instance; + } + /** + * Clona la entidad TgeneAccountForCredit + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneAccountForCredit p = (TgeneAccountForCredit) this.clone(); + p.setPk((TgeneAccountForCreditKey) this.pk.cloneMe()); + return p; + } + + //Metodos manuales. + /** Sentencia que devuelve datos de la tabla TgeneAccountForCredit.*/ + private static final String HQL_ACCOUNT_FOR_CREDIT = + "from TgeneAccountForCredit tafc " + + " where tafc.pk.account = :account "+ + " and tafc.pk.company = :company "+ + " order by tafc.pk.creditsequence "; + + /** + * Entrega datos de cuentas a acreditar ejemplo definicion de la forma de pago de certificado de deposito. + * @param pAccount Numero de cuenta. + * @param pCompany Codigo de compania. + * @return List + * @throws Exception + */ + @SuppressWarnings(Constant.VUNCHECKED) + public static List find(EntityManager pEntityManager, + String pAccount,Integer pCompany) throws Exception { + List lcredit = null; + Query qry = pEntityManager.createQuery(HQL_ACCOUNT_FOR_CREDIT); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + lcredit = qry.getResultList(); + return lcredit; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountForCreditKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountForCreditKey.java.svn-base new file mode 100644 index 0000000..cb1da7c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountForCreditKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTFORCREDIT*/ +@Embeddable +public class TgeneAccountForCreditKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="CREDITSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del credito. +*/ +private Integer creditsequence; + +/**Contructor por defecto*/ +public TgeneAccountForCreditKey(){} +/**Contructor de TgeneAccountForCreditKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pCreditsequence Secuencia del credito. +*/ +public TgeneAccountForCreditKey(String pAccount,Integer pCompany,Integer pCreditsequence){ + account=pAccount; + company=pCompany; + creditsequence=pCreditsequence; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de creditsequence +@return valor de creditsequence*/ +public Integer getCreditsequence(){ + return creditsequence; +} +/**Fija el valor de creditsequence +@param pCreditsequence nuevo Valor de creditsequence*/ +public void setCreditsequence(Integer pCreditsequence){ + creditsequence=pCreditsequence; +} + +/**Implementacin de la comparacin de TgeneAccountForCreditKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountForCreditKey))return false; + TgeneAccountForCreditKey that = (TgeneAccountForCreditKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getCreditsequence() == null || that.getCreditsequence() == null){ + return false; + } + if (! this.getCreditsequence().equals(that.getCreditsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountForCreditKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getCreditsequence() == null ? 0 : this.getCreditsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountForDebit.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountForDebit.java.svn-base new file mode 100644 index 0000000..ebf7785 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountForDebit.java.svn-base @@ -0,0 +1,262 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTFORDEBIT */ +@Entity(name = "TgeneAccountForDebit") +@Table(name = "TGENEACCOUNTFORDEBIT") +public class TgeneAccountForDebit extends com.fp.dto.AbstractDataTransport + implements + Serializable, + HibernateBean, + Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneAccountForDebit + */ + @EmbeddedId + private TgeneAccountForDebitKey pk; + @Column(name = "DEBITACCOUNT", nullable = true) + /** + * Numero de cuenta a debitar cuando el cargo se cobra con debito a la cuenta. + */ + private String debitaccount; + + @Column(name = "DEBITACCOUNTINGCODE", nullable = true) + /** + * Codigo contable cuando el cargo se cobra con debito a la cuenta. + */ + private String debitaccountingcode; + + @Column(name = "CURRENCY", nullable = true) + /** + * Codigo de moneda de la cuenta de la operacion. + */ + private String currency; + + @Column(name = "VALUE", nullable = true) + /** + * Valor en la moneda de la cuenta, la compra venta se hace en funcion a la moneda de la cuenta debito + */ + private BigDecimal value; + + /** Contructor por defecto */ + public TgeneAccountForDebit() { + } + /** + * Contructor de TgeneAccountForDebit + * + * @param pPk Clave Primaria del entity + */ + public TgeneAccountForDebit(TgeneAccountForDebitKey pPk) { + this(); + pk = pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneAccountForDebit + */ + public static TgeneAccountForDebit find(EntityManager pEntityManager, TgeneAccountForDebitKey pKey) + throws Exception { + TgeneAccountForDebit obj = pEntityManager.find(TgeneAccountForDebit.class, pKey); + return obj; + } + /** + * Entrega la Clave primaria de TgeneAccountForDebit + * + * @return El objeto que referencia a la Clave primaria de TgeneAccountForDebit + */ + public TgeneAccountForDebitKey getPk() { + return pk; + } + /** + * Fija un nuevo valor a la Clave primaria de TgeneAccountForDebit + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountForDebit + */ + public void setPk(TgeneAccountForDebitKey pPk) { + pk = pPk; + } + /** + * Obtiene el valor de debitaccount + * + * @return valor de debitaccount + */ + public String getDebitaccount() { + return debitaccount; + } + /** + * Fija el valor de debitaccount + * + * @param pDebitaccount nuevo Valor de debitaccount + */ + public void setDebitaccount(String pDebitaccount) { + debitaccount = pDebitaccount; + } + + /** + * Obtiene el valor de debitaccountingcode + * + * @return valor de debitaccountingcode + */ + public String getDebitaccountingcode() { + return debitaccountingcode; + } + /** + * Fija el valor de debitaccountingcode + * + * @param pDebitaccountingcode nuevo Valor de debitaccountingcode + */ + public void setDebitaccountingcode(String pDebitaccountingcode) { + debitaccountingcode = pDebitaccountingcode; + } + + /** + * Obtiene el valor de currency + * + * @return valor de currency + */ + public String getCurrency() { + return currency; + } + /** + * Fija el valor de currency + * + * @param pCurrency nuevo Valor de currency + */ + public void setCurrency(String pCurrency) { + currency = pCurrency; + } + + /** + * Obtiene el valor de value + * + * @return valor de value + */ + public BigDecimal getValue() { + return value; + } + /** + * Fija el valor de value + * + * @param pValue nuevo Valor de value + */ + public void setValue(BigDecimal pValue) { + value = pValue; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneAccountForDebit)) + return false; + TgeneAccountForDebit that = (TgeneAccountForDebit) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /** + * Implementacin del metodo hashCode de la la entidad TgeneAccountForDebit + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + /** Implementacin de la creacin de un bean en blanco TgeneAccountForDebit */ + public Object createInstance() { + TgeneAccountForDebit instance = new TgeneAccountForDebit(); + instance.setPk(new TgeneAccountForDebitKey()); + return instance; + } + /** + * Clona la entidad TgeneAccountForDebit + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneAccountForDebit p = (TgeneAccountForDebit) this.clone(); + p.setPk((TgeneAccountForDebitKey) this.pk.cloneMe()); + return p; + } + + //Metodos manuales + /** Sentencia que devuelve datos de la tabla TgeneAccountForDebit.*/ + private static final String HQL_ACCOUNT_FOR_DEBIT = + "from TgeneAccountForDebit tafd " + + " where tafd.pk.account = :account "+ + " and tafd.pk.company = :company "; + + /** + * Entrega datos de cuentas a debitar para cancelar el valor de la cuneta. + * @param pAccount Numero de cuenta. + * @param pCompany Codigo de compania. + * @return List + * @throws Exception + */ + @SuppressWarnings(Constant.VUNCHECKED) + public static List find(EntityManager pEntityManager, + String pAccount,Integer pCompany) throws Exception { + List ldebits = null; + Query qry = pEntityManager.createQuery(HQL_ACCOUNT_FOR_DEBIT); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + ldebits = qry.getResultList(); + return ldebits; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountForDebitKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountForDebitKey.java.svn-base new file mode 100644 index 0000000..a400089 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountForDebitKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTFORDEBIT*/ +@Embeddable +public class TgeneAccountForDebitKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertenece la cuenta. +*/ +private Integer company; + +@Column(name="DEBITSEQUENCE", nullable=false,updatable=false) + +/** +* Sequencia de debito. +*/ +private Integer debitsequence; + +/**Contructor por defecto*/ +public TgeneAccountForDebitKey(){} +/**Contructor de TgeneAccountForDebitKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertenece la cuenta. +@param pDebitsequence Sequencia de debito. +*/ +public TgeneAccountForDebitKey(String pAccount,Integer pCompany,Integer pDebitsequence){ + account=pAccount; + company=pCompany; + debitsequence=pDebitsequence; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de debitsequence +@return valor de debitsequence*/ +public Integer getDebitsequence(){ + return debitsequence; +} +/**Fija el valor de debitsequence +@param pDebitsequence nuevo Valor de debitsequence*/ +public void setDebitsequence(Integer pDebitsequence){ + debitsequence=pDebitsequence; +} + +/**Implementacin de la comparacin de TgeneAccountForDebitKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountForDebitKey))return false; + TgeneAccountForDebitKey that = (TgeneAccountForDebitKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getDebitsequence() == null || that.getDebitsequence() == null){ + return false; + } + if (! this.getDebitsequence().equals(that.getDebitsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountForDebitKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getDebitsequence() == null ? 0 : this.getDebitsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountKey.java.svn-base new file mode 100644 index 0000000..2fb6440 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountKey.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pgeneral.acco; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNT*/ +@Embeddable +public class TgeneAccountKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro con datos de la cuenta. +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TgeneAccountKey(){} +/**Contructor de TgeneAccountKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pDateto Fecha hasta la cual esta vigente el registro con datos de la cuenta. +*/ +public TgeneAccountKey(String pAccount,Integer pCompany,Timestamp pDateto){ + account=pAccount; + company=pCompany; + dateto=pDateto; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TgeneAccountKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountKey))return false; + TgeneAccountKey that = (TgeneAccountKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountLiquidation.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountLiquidation.java.svn-base new file mode 100644 index 0000000..31fe675 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountLiquidation.java.svn-base @@ -0,0 +1,332 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTLIQUIDATION*/ +@Entity(name="TgeneAccountLiquidation") +@Table(name="TGENEACCOUNTLIQUIDATION") +public class TgeneAccountLiquidation extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountLiquidation +*/ +@EmbeddedId +private TgeneAccountLiquidationKey pk; +@Column(name="BASEAMOUNTBALANCETYPE", nullable=true) + +/** +* Tipo de saldo del cual se toma el monto para calcular el tarifario. +*/ +private String baseamountbalancetype; + +@Column(name="BASEAMOUNTBALANCEGROUP", nullable=true) + +/** +* Grupo de balance del tipo de saldo del cual se toma el monto para calcular el tarifario. +*/ +private String baseamountbalancegroup; + +@Column(name="CALCULATEORDER", nullable=true) + +/** +* CALCULATEORDER +*/ +private Integer calculateorder; + +@Column(name="NEGOTIABLE", nullable=true) + +/** +* Indica si la tasa se puede negociar con el cliente el valor y las condiciones del cargo +*/ +private String negotiable; + +@Column(name="INCREASE", nullable=true) + +/** +* Indica que incrementa el valor de capital con el cual se genera la tabla de pagos +*/ +private String increase; + +@Column(name="DECREASE", nullable=true) + +/** +* Indica que disminuye el valor de capital con el cual se genera la tabla de pagos +*/ +private String decrease; + +@Column(name="DECREASEDISBURSEMENT", nullable=true) + +/** +* Indica que el valor del cargo se descuenta del monto a entregar al cliente +*/ +private String decreasedisbursement; + +@Column(name="CASH", nullable=true) + +/** +* Indica que el valor se cobra en efectivo. +*/ +private String cash; + +@Column(name="DEBITACCOUNT", nullable=true) + +/** +* Indica que el valor se cobra con debito a una cuneta, esta puede ser cuenta contable o cuenta a la vista +*/ +private String debitaccount; + +@Column(name="VALUE", nullable=true) + +/** +* Valor del cargo en la moneda de la operacion +*/ +private BigDecimal value; + +/**Contructor por defecto*/ +public TgeneAccountLiquidation(){ +} +/**Contructor de TgeneAccountLiquidation +@param pPk Clave Primaria del entity +*/ +public TgeneAccountLiquidation(TgeneAccountLiquidationKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountLiquidation +*/ +public static TgeneAccountLiquidation find(EntityManager pEntityManager,TgeneAccountLiquidationKey pKey) throws Exception{ + TgeneAccountLiquidation obj = pEntityManager.find(TgeneAccountLiquidation.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountLiquidation +@return El objeto que referencia a la Clave primaria de TgeneAccountLiquidation +*/ +public TgeneAccountLiquidationKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountLiquidation +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountLiquidation +*/ +public void setPk(TgeneAccountLiquidationKey pPk){ + pk=pPk; +} +/**Obtiene el valor de baseamountbalancetype +@return valor de baseamountbalancetype*/ +public String getBaseamountbalancetype(){ + return baseamountbalancetype; +} +/**Fija el valor de baseamountbalancetype +@param pBaseamountbalancetype nuevo Valor de baseamountbalancetype*/ +public void setBaseamountbalancetype(String pBaseamountbalancetype){ + baseamountbalancetype=pBaseamountbalancetype; +} + +/**Obtiene el valor de baseamountbalancegroup +@return valor de baseamountbalancegroup*/ +public String getBaseamountbalancegroup(){ + return baseamountbalancegroup; +} +/**Fija el valor de baseamountbalancegroup +@param pBaseamountbalancegroup nuevo Valor de baseamountbalancegroup*/ +public void setBaseamountbalancegroup(String pBaseamountbalancegroup){ + baseamountbalancegroup=pBaseamountbalancegroup; +} + +/**Obtiene el valor de calculateorder +@return valor de calculateorder*/ +public Integer getCalculateorder(){ + return calculateorder; +} +/**Fija el valor de calculateorder +@param pCalculateorder nuevo Valor de calculateorder*/ +public void setCalculateorder(Integer pCalculateorder){ + calculateorder=pCalculateorder; +} + +/**Obtiene el valor de negotiable +@return valor de negotiable*/ +public String getNegotiable(){ + return negotiable; +} +/**Fija el valor de negotiable +@param pNegotiable nuevo Valor de negotiable*/ +public void setNegotiable(String pNegotiable){ + negotiable=pNegotiable; +} + +/**Obtiene el valor de increase +@return valor de increase*/ +public String getIncrease(){ + return increase; +} +/**Fija el valor de increase +@param pIncrease nuevo Valor de increase*/ +public void setIncrease(String pIncrease){ + increase=pIncrease; +} + +/**Obtiene el valor de decrease +@return valor de decrease*/ +public String getDecrease(){ + return decrease; +} +/**Fija el valor de decrease +@param pDecrease nuevo Valor de decrease*/ +public void setDecrease(String pDecrease){ + decrease=pDecrease; +} + +/**Obtiene el valor de decreasedisbursement +@return valor de decreasedisbursement*/ +public String getDecreasedisbursement(){ + return decreasedisbursement; +} +/**Fija el valor de decreasedisbursement +@param pDecreasedisbursement nuevo Valor de decreasedisbursement*/ +public void setDecreasedisbursement(String pDecreasedisbursement){ + decreasedisbursement=pDecreasedisbursement; +} + +/**Obtiene el valor de cash +@return valor de cash*/ +public String getCash(){ + return cash; +} +/**Fija el valor de cash +@param pCash nuevo Valor de cash*/ +public void setCash(String pCash){ + cash=pCash; +} + +/**Obtiene el valor de debitaccount +@return valor de debitaccount*/ +public String getDebitaccount(){ + return debitaccount; +} +/**Fija el valor de debitaccount +@param pDebitaccount nuevo Valor de debitaccount*/ +public void setDebitaccount(String pDebitaccount){ + debitaccount=pDebitaccount; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountLiquidation))return false; + TgeneAccountLiquidation that = (TgeneAccountLiquidation) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountLiquidation +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountLiquidation +*/ +public Object createInstance(){ + TgeneAccountLiquidation instance=new TgeneAccountLiquidation(); + instance.setPk(new TgeneAccountLiquidationKey()); + return instance; +} +/**Clona la entidad TgeneAccountLiquidation +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountLiquidation p=(TgeneAccountLiquidation)this.clone(); + p.setPk((TgeneAccountLiquidationKey)this.pk.cloneMe()); + return p; +} + + //Metodos manuales. + /**Sentencia que devuelve uan lista de cargos de liquidacion asociados a una cuenta.*/ + private static final String HQL_ACCO_LIQUIDATION = + " from TgeneAccountLiquidation t " + + " where t.pk.account = :account "+ + " and t.pk.company = :company "; + + /** + * Metodo que entrega una lista de valores a entregar al cliente, en la aperturad e una operacion. + * @param pAccount Numero de cuenta. + * @param pCompany Codigo de compania a la que pertenece la cuenta. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, + String pAccount,Integer pCompany) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_ACCO_LIQUIDATION); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountLiquidationKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountLiquidationKey.java.svn-base new file mode 100644 index 0000000..9ab8d1c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountLiquidationKey.java.svn-base @@ -0,0 +1,313 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTLIQUIDATION*/ +@Embeddable +public class TgeneAccountLiquidationKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. de valores a cobrar en la liquidacion de una operacion +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +/**Contructor por defecto*/ +public TgeneAccountLiquidationKey(){} +/**Contructor de TgeneAccountLiquidationKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pStatuscode Estatus de cuenta +@param pCurrencycode Codigo de moneda +@param pBalancetype Cdigo de tipo de saldo. de valores a cobrar en la liquidacion de una operacion +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +public TgeneAccountLiquidationKey(String pAccount,Integer pCompany,String pModulecode,String pProductcode,String pSubproductcode,String pStatuscode,String pCurrencycode,String pBalancetype,String pBalancegroup){ + account=pAccount; + company=pCompany; + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + statuscode=pStatuscode; + currencycode=pCurrencycode; + balancetype=pBalancetype; + balancegroup=pBalancegroup; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Implementacin de la comparacin de TgeneAccountLiquidationKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountLiquidationKey))return false; + TgeneAccountLiquidationKey that = (TgeneAccountLiquidationKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountLiquidationKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountLocalHold.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountLocalHold.java.svn-base new file mode 100644 index 0000000..ca7d3a3 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountLocalHold.java.svn-base @@ -0,0 +1,521 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTLOCALHOLD */ +@Entity(name = "TgeneAccountLocalHold") +@Table(name = "TGENEACCOUNTLOCALHOLD") +public class TgeneAccountLocalHold extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneAccountLocalHold + */ + @EmbeddedId + private TgeneAccountLocalHoldKey pk; + + @Column(name = "ACCOUNTMODULE", nullable = true) + /** + * Codigo de modulo al que pertenece la cuenta depositada. + */ + private String accountmodule; + + @Column(name = "OFFICECODE", nullable = true) + /** + * Codigo de oficina + */ + private Integer officecode; + + @Column(name = "BRANCHCODE", nullable = true) + /** + * Codigo de sucursal + */ + private Integer branchcode; + + @Column(name = "ACCOUNTINGDATE", nullable = true) + /** + * Fecha contable con la cual se crea el registro de cheques locales + */ + private Date accountingdate; + + @Column(name = "OWNACCOUNT", nullable = true) + /** + * Numero de cuenta duenia del cheque + */ + private String ownaccount; + + @Column(name = "CHECKNUMBER", nullable = true) + /** + * Numero de cheque + */ + private Integer checknumber; + + @Column(name = "CHECKVALUE", nullable = true) + /** + * Valor del cheque, si no existe numero de cheque y el deposito se recibe cheque es el valor total de cheques. + */ + private BigDecimal checkvalue; + + @Column(name = "TRANSITROUTE", nullable = true) + /** + * Codigo de ruta transito asociada al cheque + */ + private String transitroute; + + @Column(name = "DATETORELEASE", nullable = true) + /** + * Fecha en la que se tiene que confirma los fondos en la cuenta depositada. + */ + private Date datetorelease; + + @Column(name = "RELEASED", nullable = true) + /** + * Y indica que el cheque esta confirmado. + */ + private String released; + + @Column(name = "RELEASEDDATE", nullable = true) + /** + * Fecha de confirmacion de fondos en la cuenta depositada + */ + private Date releaseddate; + + @Column(name = "RETURNED", nullable = true) + /** + * Indica, si el cheque esta devuelto. + */ + private String returned; + + @Column(name = "RETURNEDDATE", nullable = true) + /** + * Fecha en la que se devolvio el cheque. + */ + private Date returneddate; + + @Column(name = "JOURNALID", nullable = true) + /** + * Numero de mensaje con el que se registra los datos del cheque + */ + private String journalid; + + /** Contructor por defecto */ + public TgeneAccountLocalHold() { + } + + /** + * Contructor de TgeneAccountLocalHold + * + * @param pPk Clave Primaria del entity + */ + public TgeneAccountLocalHold(TgeneAccountLocalHoldKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneAccountLocalHold + */ + public static TgeneAccountLocalHold find(EntityManager pEntityManager, TgeneAccountLocalHoldKey pKey) throws Exception { + TgeneAccountLocalHold obj = pEntityManager.find(TgeneAccountLocalHold.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneAccountLocalHold + * + * @return El objeto que referencia a la Clave primaria de TgeneAccountLocalHold + */ + public TgeneAccountLocalHoldKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneAccountLocalHold + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountLocalHold + */ + public void setPk(TgeneAccountLocalHoldKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de accountmodule + * + * @return valor de accountmodule + */ + public String getAccountmodule() { + return this.accountmodule; + } + + /** + * Fija el valor de accountmodule + * + * @param pAccountmodule nuevo Valor de accountmodule + */ + public void setAccountmodule(String pAccountmodule) { + this.accountmodule = pAccountmodule; + } + + /** + * Obtiene el valor de officecode + * + * @return valor de officecode + */ + public Integer getOfficecode() { + return this.officecode; + } + + /** + * Fija el valor de officecode + * + * @param pOfficecode nuevo Valor de officecode + */ + public void setOfficecode(Integer pOfficecode) { + this.officecode = pOfficecode; + } + + /** + * Obtiene el valor de branchcode + * + * @return valor de branchcode + */ + public Integer getBranchcode() { + return this.branchcode; + } + + /** + * Fija el valor de branchcode + * + * @param pBranchcode nuevo Valor de branchcode + */ + public void setBranchcode(Integer pBranchcode) { + this.branchcode = pBranchcode; + } + + /** + * Obtiene el valor de accountingdate + * + * @return valor de accountingdate + */ + public Date getAccountingdate() { + return this.accountingdate; + } + + /** + * Fija el valor de accountingdate + * + * @param pAccountingdate nuevo Valor de accountingdate + */ + public void setAccountingdate(Date pAccountingdate) { + this.accountingdate = pAccountingdate; + } + + /** + * Obtiene el valor de ownaccount + * + * @return valor de ownaccount + */ + public String getOwnaccount() { + return this.ownaccount; + } + + /** + * Fija el valor de ownaccount + * + * @param pOwnaccount nuevo Valor de ownaccount + */ + public void setOwnaccount(String pOwnaccount) { + this.ownaccount = pOwnaccount; + } + + /** + * Obtiene el valor de checknumber + * + * @return valor de checknumber + */ + public Integer getChecknumber() { + return this.checknumber; + } + + /** + * Fija el valor de checknumber + * + * @param pChecknumber nuevo Valor de checknumber + */ + public void setChecknumber(Integer pChecknumber) { + this.checknumber = pChecknumber; + } + + /** + * Obtiene el valor de checkvalue + * + * @return valor de checkvalue + */ + public BigDecimal getCheckvalue() { + return this.checkvalue; + } + + /** + * Fija el valor de checkvalue + * + * @param pCheckvalue nuevo Valor de checkvalue + */ + public void setCheckvalue(BigDecimal pCheckvalue) { + this.checkvalue = pCheckvalue; + } + + /** + * Obtiene el valor de transitroute + * + * @return valor de transitroute + */ + public String getTransitroute() { + return this.transitroute; + } + + /** + * Fija el valor de transitroute + * + * @param pTransitroute nuevo Valor de transitroute + */ + public void setTransitroute(String pTransitroute) { + this.transitroute = pTransitroute; + } + + /** + * Obtiene el valor de datetorelease + * + * @return valor de datetorelease + */ + public Date getDatetorelease() { + return this.datetorelease; + } + + /** + * Fija el valor de datetorelease + * + * @param pDatetorelease nuevo Valor de datetorelease + */ + public void setDatetorelease(Date pDatetorelease) { + this.datetorelease = pDatetorelease; + } + + /** + * Obtiene el valor de released + * + * @return valor de released + */ + public String getReleased() { + return this.released; + } + + /** + * Fija el valor de released + * + * @param pReleased nuevo Valor de released + */ + public void setReleased(String pReleased) { + this.released = pReleased; + } + + /** + * Obtiene el valor de releaseddate + * + * @return valor de releaseddate + */ + public Date getReleaseddate() { + return this.releaseddate; + } + + /** + * Fija el valor de releaseddate + * + * @param pReleaseddate nuevo Valor de releaseddate + */ + public void setReleaseddate(Date pReleaseddate) { + this.releaseddate = pReleaseddate; + } + + /** + * Obtiene el valor de returned + * + * @return valor de returned + */ + public String getReturned() { + return this.returned; + } + + /** + * Fija el valor de returned + * + * @param pReturned nuevo Valor de returned + */ + public void setReturned(String pReturned) { + this.returned = pReturned; + } + + /** + * Obtiene el valor de returneddate + * + * @return valor de returneddate + */ + public Date getReturneddate() { + return this.returneddate; + } + + /** + * Fija el valor de returneddate + * + * @param pReturneddate nuevo Valor de returneddate + */ + public void setReturneddate(Date pReturneddate) { + this.returneddate = pReturneddate; + } + + /** + * Obtiene el valor de journalid + * + * @return valor de journalid + */ + public String getJournalid() { + return this.journalid; + } + + /** + * Fija el valor de journalid + * + * @param pJournalid nuevo Valor de journalid + */ + public void setJournalid(String pJournalid) { + this.journalid = pJournalid; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneAccountLocalHold)) { + return false; + } + TgeneAccountLocalHold that = (TgeneAccountLocalHold) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneAccountLocalHold + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneAccountLocalHold */ + @Override + public Object createInstance() { + TgeneAccountLocalHold instance = new TgeneAccountLocalHold(); + instance.setPk(new TgeneAccountLocalHoldKey()); + return instance; + } + + /** + * Clona la entidad TgeneAccountLocalHold + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneAccountLocalHold p = (TgeneAccountLocalHold) this.clone(); + p.setPk((TgeneAccountLocalHoldKey) this.pk.cloneMe()); + return p; + } + + // METODOS MANUALES + /** Sentencia que entrega los datos de un registro de TgeneAccountLocalHold, dado un numero de mensaje. */ + private static final String JPQL_LOCAL_HOLD = "from TgeneAccountLocalHold t " + " where t.journalid = :journalid "; + + /** + * Metodo que entrega datos de TgeneAccountLocalHold dado un numero de mensaje. + * + * @param pEntityManager Session de la base de datos. + * @param pJournalid Numero de mensaje a obtener TgeneAccountLocalHold. + * @return TgeneAccountLocalHold + * @throws Exception + */ + public static TgeneAccountLocalHold findByJournalId(EntityManager pEntityManager, String pJournalid) throws Exception { + Query qry = pEntityManager.createQuery(TgeneAccountLocalHold.JPQL_LOCAL_HOLD); + qry.setParameter("journalid", pJournalid); + try { + return (TgeneAccountLocalHold) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountLocalHoldKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountLocalHoldKey.java.svn-base new file mode 100644 index 0000000..8a78100 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountLocalHoldKey.java.svn-base @@ -0,0 +1,179 @@ +package com.fp.persistence.pgeneral.acco; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTLOCALHOLD*/ +@Embeddable +public class TgeneAccountLocalHoldKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="PARTITIONDB", nullable=false,updatable=false) + +/** +* Y, Indica que el registro se encuentra en una particion vigente, N el registro no esta en la particion vigente. +*/ +private String partitiondb; + +@Column(name="REALDATE", nullable=true, insertable=false) + +/** +* Fecha real de carga de registro +*/ +private Timestamp realdate; + +/**Contructor por defecto*/ +public TgeneAccountLocalHoldKey(){} +/**Contructor de TgeneAccountLocalHoldKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pPartitiondb Y, Indica que el registro se encuentra en una particion vigente, N el registro no esta en la particion vigente. +@param pRealdate Fecha real de carga de registro +*/ +public TgeneAccountLocalHoldKey(String pAccount,Integer pCompany,String pPartitiondb,Timestamp pRealdate){ + account=pAccount; + company=pCompany; + partitiondb=pPartitiondb; + realdate=pRealdate; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de partitiondb +@return valor de partitiondb*/ +public String getPartitiondb(){ + return partitiondb; +} +/**Fija el valor de partitiondb +@param pPartitiondb nuevo Valor de partitiondb*/ +public void setPartitiondb(String pPartitiondb){ + partitiondb=pPartitiondb; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Timestamp getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Timestamp pRealdate){ + realdate=pRealdate; +} + +/**Implementacin de la comparacin de TgeneAccountLocalHoldKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountLocalHoldKey))return false; + TgeneAccountLocalHoldKey that = (TgeneAccountLocalHoldKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getPartitiondb() == null || that.getPartitiondb() == null){ + return false; + } + if (! this.getPartitiondb().equals(that.getPartitiondb())){ + return false; + } + if (this.getRealdate() == null || that.getRealdate() == null){ + return false; + } + if (! this.getRealdate().equals(that.getRealdate())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountLocalHoldKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getPartitiondb() == null ? 0 : this.getPartitiondb().hashCode()); + result = result * 37 + (this.getRealdate() == null ? 0 : this.getRealdate().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountNumber.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountNumber.java.svn-base new file mode 100644 index 0000000..cb3fdbe --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountNumber.java.svn-base @@ -0,0 +1,213 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.LockModeType; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.common.exception.CommonException; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTNUMBER*/ +@Entity(name="TgeneAccountNumber") +@Table(name="TGENEACCOUNTNUMBER") +public class TgeneAccountNumber extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountNumber +*/ +@EmbeddedId +private TgeneAccountNumberKey pk; +@Column(name="PRODUCTCODE", nullable=true) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="CURRENCYCODE", nullable=true) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="ACCOUNTNUMBER", nullable=false) + +/** +* Consecutivo de cuenta +*/ +private String accountnumber; + +/**Contructor por defecto*/ +public TgeneAccountNumber(){ +} +/**Contructor de TgeneAccountNumber +@param pPk Clave Primaria del entity +@param pAccountnumber Consecutivo de cuenta +*/ +public TgeneAccountNumber(TgeneAccountNumberKey pPk,String pAccountnumber){ + this(); + pk=pPk; + accountnumber=pAccountnumber; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountNumber +*/ +public static TgeneAccountNumber find(EntityManager pEntityManager,TgeneAccountNumberKey pKey) throws Exception{ + TgeneAccountNumber obj = pEntityManager.find(TgeneAccountNumber.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountNumber +@return El objeto que referencia a la Clave primaria de TgeneAccountNumber +*/ +public TgeneAccountNumberKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountNumber +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountNumber +*/ +public void setPk(TgeneAccountNumberKey pPk){ + pk=pPk; +} +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de accountnumber +@return valor de accountnumber*/ +public String getAccountnumber(){ + return accountnumber; +} +/**Fija el valor de accountnumber +@param pAccountnumber nuevo Valor de accountnumber*/ +public void setAccountnumber(String pAccountnumber){ + accountnumber=pAccountnumber; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountNumber))return false; + TgeneAccountNumber that = (TgeneAccountNumber) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountNumber +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountNumber +*/ +public Object createInstance(){ + TgeneAccountNumber instance=new TgeneAccountNumber(); + instance.setPk(new TgeneAccountNumberKey()); + return instance; +} +/**Clona la entidad TgeneAccountNumber +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountNumber p=(TgeneAccountNumber)this.clone(); + p.setPk((TgeneAccountNumberKey)this.pk.cloneMe()); + return p; +} + + //METODOS MANUALES + /**Sentencia que obtiene un registro de TgeneAccountNumber con la secuencia de numeros de cuenta.*/ + private static final String HQL = "from com.fp.persistence.pgeneral.acco.TgeneAccountNumber t "+ + " where t.pk.modulecode = :modulecode "+ + " and coalesce(productcode,:productcode) = :productcode "+ + " and coalesce(currencycode,:currencycode) = :currencycode "; + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pModule Codigo de modulo + * @param pProduct Codigo de producto + * @param pCurrency Codigo de moneda + * @return TgeneAccountNumber + */ + public static TgeneAccountNumber findWithhold(EntityManager pEntityManager,String pModule, + String pProduct,String pCurrency) throws Exception{ + TgeneAccountNumber tgeneAccountNumber = null; + Query qry = pEntityManager.createQuery(HQL); + qry.setParameter("modulecode", pModule); + qry.setParameter("productcode", pProduct); + qry.setParameter("currencycode", pCurrency); + qry.setLockMode(LockModeType.PESSIMISTIC_READ); + tgeneAccountNumber = (TgeneAccountNumber)qry.getSingleResult(); + if(tgeneAccountNumber == null){ + throw new CommonException("CORE-0025","SECUENCIA DE CUENTA NO DEFINIDA EN TGENEACCOUNTNUMBER MODULO: {}",pModule); + } + return tgeneAccountNumber; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountNumberKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountNumberKey.java.svn-base new file mode 100644 index 0000000..46d628b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountNumberKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTNUMBER*/ +@Embeddable +public class TgeneAccountNumberKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="ACCOUNTSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia +*/ +private String accountsequence; + +/**Contructor por defecto*/ +public TgeneAccountNumberKey(){} +/**Contructor de TgeneAccountNumberKey +@param pModulecode Codigo de modulo +@param pAccountsequence Secuencia +*/ +public TgeneAccountNumberKey(String pModulecode,String pAccountsequence){ + modulecode=pModulecode; + accountsequence=pAccountsequence; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de accountsequence +@return valor de accountsequence*/ +public String getAccountsequence(){ + return accountsequence; +} +/**Fija el valor de accountsequence +@param pAccountsequence nuevo Valor de accountsequence*/ +public void setAccountsequence(String pAccountsequence){ + accountsequence=pAccountsequence; +} + +/**Implementacin de la comparacin de TgeneAccountNumberKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountNumberKey))return false; + TgeneAccountNumberKey that = (TgeneAccountNumberKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getAccountsequence() == null || that.getAccountsequence() == null){ + return false; + } + if (! this.getAccountsequence().equals(that.getAccountsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountNumberKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getAccountsequence() == null ? 0 : this.getAccountsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountPayable.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountPayable.java.svn-base new file mode 100644 index 0000000..fd706a8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountPayable.java.svn-base @@ -0,0 +1,210 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTPAYABLE */ +@Entity(name = "TgeneAccountPayable") +@Table(name = "TGENEACCOUNTPAYABLE") +public class TgeneAccountPayable extends com.fp.dto.AbstractDataBalanceTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneAccountPayable + */ + @EmbeddedId + private TgeneAccountPayableKey pk; + + @Column(name = "BALANCE", nullable = true) + /** + * Saldo de la cuenta por pagar. + */ + private BigDecimal balance; + + /** Contructor por defecto */ + public TgeneAccountPayable() { + } + + /** + * Contructor de TgeneAccountPayable + * + * @param pPk Clave Primaria del entity + */ + public TgeneAccountPayable(TgeneAccountPayableKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneAccountPayable + */ + public static TgeneAccountPayable find(EntityManager pEntityManager, TgeneAccountPayableKey pKey) throws Exception { + TgeneAccountPayable obj = pEntityManager.find(TgeneAccountPayable.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneAccountPayable + * + * @return El objeto que referencia a la Clave primaria de TgeneAccountPayable + */ + public TgeneAccountPayableKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneAccountPayable + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountPayable + */ + public void setPk(TgeneAccountPayableKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de balance + * + * @return valor de balance + */ + public BigDecimal getBalance() { + return this.balance; + } + + /** + * Fija el valor de balance + * + * @param pBalance nuevo Valor de balance + */ + public void setBalance(BigDecimal pBalance) { + this.balance = pBalance; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneAccountPayable)) { + return false; + } + TgeneAccountPayable that = (TgeneAccountPayable) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneAccountPayable + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneAccountPayable */ + @Override + public Object createInstance() { + TgeneAccountPayable instance = new TgeneAccountPayable(); + instance.setPk(new TgeneAccountPayableKey()); + return instance; + } + + /** + * Clona la entidad TgeneAccountPayable + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneAccountPayable p = (TgeneAccountPayable) this.clone(); + p.setPk((TgeneAccountPayableKey) this.pk.cloneMe()); + return p; + } + + // METODOS MANUALES + /** Sentencia que devuelve saldos de cuentas por pagar. */ + private static final String JPQL_PAYABLE = "from TgeneAccountPayable t " + " where t.pk.account = :account " + " and t.pk.company = :company "; + + /** + * Entrega un registro de saldos de cuentas por pagar. + * + * @param pEntityManager Session de la base de datos. + * @param pAccount Numero de cuenta. + * @param pCompany Codigo de compania a la que pertenece la cuenta. + * @return TgeneAccountPayable + * @throws Exception + */ + public static TgeneAccountPayable findByAccountNumber(EntityManager pEntityManager, String pAccount, Integer pCompany) throws Exception { + Query qry = pEntityManager.createQuery(TgeneAccountPayable.JPQL_PAYABLE); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + try { + return (TgeneAccountPayable) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountPayableKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountPayableKey.java.svn-base new file mode 100644 index 0000000..50b3689 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountPayableKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTPAYABLE*/ +@Embeddable +public class TgeneAccountPayableKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta por pagar. +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertenece la cuenta. +*/ +private Integer company; + +/**Contructor por defecto*/ +public TgeneAccountPayableKey(){} +/**Contructor de TgeneAccountPayableKey +@param pAccount Numero de cuenta por pagar. +@param pCompany Codigo de compania a la que pertenece la cuenta. +*/ +public TgeneAccountPayableKey(String pAccount,Integer pCompany){ + account=pAccount; + company=pCompany; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Implementacin de la comparacin de TgeneAccountPayableKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountPayableKey))return false; + TgeneAccountPayableKey that = (TgeneAccountPayableKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountPayableKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountRemittanceHold.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountRemittanceHold.java.svn-base new file mode 100644 index 0000000..78d1328 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountRemittanceHold.java.svn-base @@ -0,0 +1,376 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTREMITTANCEHOLD*/ +@Entity(name="TgeneAccountRemittanceHold") +@Table(name="TGENEACCOUNTREMITTANCEHOLD") +public class TgeneAccountRemittanceHold extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountRemittanceHold +*/ +@EmbeddedId +private TgeneAccountRemittanceHoldKey pk; +@Column(name="REMITTANCENUMBER", nullable=true) + +/** +* Numero de carta remesa +*/ +private String remittancenumber; + +@Column(name="OFFICECODE", nullable=true) + +/** +* Codigo de oficina +*/ +private Integer officecode; + +@Column(name="BRANCHCODE", nullable=true) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="ACCOUNTINGDATE", nullable=true) + +/** +* Fecha contable con la cual se crea el registro de cheques locales +*/ +private Date accountingdate; + +@Column(name="OWNACCOUNT", nullable=true) + +/** +* Numero de cuenta duenia del cheque +*/ +private String ownaccount; + +@Column(name="CHECKNUMBER", nullable=true) + +/** +* Numero de cheque +*/ +private Integer checknumber; + +@Column(name="CHECKVALUE", nullable=true) + +/** +* Valor del cheque, si no existe numero de cheque y el deposito se recibe cheque es el valor total de cheques. +*/ +private BigDecimal checkvalue; + +@Column(name="TRANSITROUTE", nullable=true) + +/** +* Codigo de ruta transito asociada al cheque +*/ +private String transitroute; + +@Column(name="DATETORELEASE", nullable=true) + +/** +* Fecha en la que se tiene que confirma los fondos en la cuenta depositada. +*/ +private Date datetorelease; + +@Column(name="RELEASE", nullable=true) + +/** +* Y indica que el cheque esta confirmado. +*/ +private String release; + +@Column(name="RELEASEDATE", nullable=true) + +/** +* Fecha de confirmacion de fondos en la cuenta depositada +*/ +private Date releasedate; + +@Column(name="RETURNED", nullable=true) + +/** +* Indica, si el cheque esta devuelto. +*/ +private String returned; + +@Column(name="RETURNEDDATE", nullable=true) + +/** +* Fecha en la que se devolvio el cheque. +*/ +private Date returneddate; + +@Column(name="JOURNALID", nullable=true) + +/** +* Numero de mensaje con el que se registra los datos del cheque +*/ +private String journalid; + +/**Contructor por defecto*/ +public TgeneAccountRemittanceHold(){ +} +/**Contructor de TgeneAccountRemittanceHold +@param pPk Clave Primaria del entity +*/ +public TgeneAccountRemittanceHold(TgeneAccountRemittanceHoldKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountRemittanceHold +*/ +public static TgeneAccountRemittanceHold find(EntityManager pEntityManager,TgeneAccountRemittanceHoldKey pKey) throws Exception{ + TgeneAccountRemittanceHold obj = pEntityManager.find(TgeneAccountRemittanceHold.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountRemittanceHold +@return El objeto que referencia a la Clave primaria de TgeneAccountRemittanceHold +*/ +public TgeneAccountRemittanceHoldKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountRemittanceHold +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountRemittanceHold +*/ +public void setPk(TgeneAccountRemittanceHoldKey pPk){ + pk=pPk; +} +/**Obtiene el valor de remittancenumber +@return valor de remittancenumber*/ +public String getRemittancenumber(){ + return remittancenumber; +} +/**Fija el valor de remittancenumber +@param pRemittancenumber nuevo Valor de remittancenumber*/ +public void setRemittancenumber(String pRemittancenumber){ + remittancenumber=pRemittancenumber; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de accountingdate +@return valor de accountingdate*/ +public Date getAccountingdate(){ + return accountingdate; +} +/**Fija el valor de accountingdate +@param pAccountingdate nuevo Valor de accountingdate*/ +public void setAccountingdate(Date pAccountingdate){ + accountingdate=pAccountingdate; +} + +/**Obtiene el valor de ownaccount +@return valor de ownaccount*/ +public String getOwnaccount(){ + return ownaccount; +} +/**Fija el valor de ownaccount +@param pOwnaccount nuevo Valor de ownaccount*/ +public void setOwnaccount(String pOwnaccount){ + ownaccount=pOwnaccount; +} + +/**Obtiene el valor de checknumber +@return valor de checknumber*/ +public Integer getChecknumber(){ + return checknumber; +} +/**Fija el valor de checknumber +@param pChecknumber nuevo Valor de checknumber*/ +public void setChecknumber(Integer pChecknumber){ + checknumber=pChecknumber; +} + +/**Obtiene el valor de checkvalue +@return valor de checkvalue*/ +public BigDecimal getCheckvalue(){ + return checkvalue; +} +/**Fija el valor de checkvalue +@param pCheckvalue nuevo Valor de checkvalue*/ +public void setCheckvalue(BigDecimal pCheckvalue){ + checkvalue=pCheckvalue; +} + +/**Obtiene el valor de transitroute +@return valor de transitroute*/ +public String getTransitroute(){ + return transitroute; +} +/**Fija el valor de transitroute +@param pTransitroute nuevo Valor de transitroute*/ +public void setTransitroute(String pTransitroute){ + transitroute=pTransitroute; +} + +/**Obtiene el valor de datetorelease +@return valor de datetorelease*/ +public Date getDatetorelease(){ + return datetorelease; +} +/**Fija el valor de datetorelease +@param pDatetorelease nuevo Valor de datetorelease*/ +public void setDatetorelease(Date pDatetorelease){ + datetorelease=pDatetorelease; +} + +/**Obtiene el valor de release +@return valor de release*/ +public String getRelease(){ + return release; +} +/**Fija el valor de release +@param pRelease nuevo Valor de release*/ +public void setRelease(String pRelease){ + release=pRelease; +} + +/**Obtiene el valor de releasedate +@return valor de releasedate*/ +public Date getReleasedate(){ + return releasedate; +} +/**Fija el valor de releasedate +@param pReleasedate nuevo Valor de releasedate*/ +public void setReleasedate(Date pReleasedate){ + releasedate=pReleasedate; +} + +/**Obtiene el valor de returned +@return valor de returned*/ +public String getReturned(){ + return returned; +} +/**Fija el valor de returned +@param pReturned nuevo Valor de returned*/ +public void setReturned(String pReturned){ + returned=pReturned; +} + +/**Obtiene el valor de returneddate +@return valor de returneddate*/ +public Date getReturneddate(){ + return returneddate; +} +/**Fija el valor de returneddate +@param pReturneddate nuevo Valor de returneddate*/ +public void setReturneddate(Date pReturneddate){ + returneddate=pReturneddate; +} + +/**Obtiene el valor de journalid +@return valor de journalid*/ +public String getJournalid(){ + return journalid; +} +/**Fija el valor de journalid +@param pJournalid nuevo Valor de journalid*/ +public void setJournalid(String pJournalid){ + journalid=pJournalid; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountRemittanceHold))return false; + TgeneAccountRemittanceHold that = (TgeneAccountRemittanceHold) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountRemittanceHold +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountRemittanceHold +*/ +public Object createInstance(){ + TgeneAccountRemittanceHold instance=new TgeneAccountRemittanceHold(); + instance.setPk(new TgeneAccountRemittanceHoldKey()); + return instance; +} +/**Clona la entidad TgeneAccountRemittanceHold +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountRemittanceHold p=(TgeneAccountRemittanceHold)this.clone(); + p.setPk((TgeneAccountRemittanceHoldKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountRemittanceHoldKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountRemittanceHoldKey.java.svn-base new file mode 100644 index 0000000..107ec07 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountRemittanceHoldKey.java.svn-base @@ -0,0 +1,179 @@ +package com.fp.persistence.pgeneral.acco; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTREMITTANCEHOLD*/ +@Embeddable +public class TgeneAccountRemittanceHoldKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="PARTITIONDB", nullable=false,updatable=false) + +/** +* Y, Indica que el registro se encuentra en una particion vigente, N el registro no esta en la particion vigente. +*/ +private String partitiondb; + +@Column(name="REALDATE", nullable=true, insertable=false) + +/** +* Fecha real de carga de registro +*/ +private Timestamp realdate; + +/**Contructor por defecto*/ +public TgeneAccountRemittanceHoldKey(){} +/**Contructor de TgeneAccountRemittanceHoldKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pPartitiondb Y, Indica que el registro se encuentra en una particion vigente, N el registro no esta en la particion vigente. +@param pRealdate Fecha real de carga de registro +*/ +public TgeneAccountRemittanceHoldKey(String pAccount,Integer pCompany,String pPartitiondb,Timestamp pRealdate){ + account=pAccount; + company=pCompany; + partitiondb=pPartitiondb; + realdate=pRealdate; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de partitiondb +@return valor de partitiondb*/ +public String getPartitiondb(){ + return partitiondb; +} +/**Fija el valor de partitiondb +@param pPartitiondb nuevo Valor de partitiondb*/ +public void setPartitiondb(String pPartitiondb){ + partitiondb=pPartitiondb; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Timestamp getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Timestamp pRealdate){ + realdate=pRealdate; +} + +/**Implementacin de la comparacin de TgeneAccountRemittanceHoldKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountRemittanceHoldKey))return false; + TgeneAccountRemittanceHoldKey that = (TgeneAccountRemittanceHoldKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getPartitiondb() == null || that.getPartitiondb() == null){ + return false; + } + if (! this.getPartitiondb().equals(that.getPartitiondb())){ + return false; + } + if (this.getRealdate() == null || that.getRealdate() == null){ + return false; + } + if (! this.getRealdate().equals(that.getRealdate())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountRemittanceHoldKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getPartitiondb() == null ? 0 : this.getPartitiondb().hashCode()); + result = result * 37 + (this.getRealdate() == null ? 0 : this.getRealdate().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountSequence.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountSequence.java.svn-base new file mode 100644 index 0000000..cb7293e --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountSequence.java.svn-base @@ -0,0 +1,368 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.LockModeType; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.exception.CommonException; +import com.fp.dto.hb.HibernateBean; +import com.fp.general.exception.GeneralException; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTSEQUENCE */ +@Entity(name = "TgeneAccountSequence") +@Table(name = "TGENEACCOUNTSEQUENCE") +public class TgeneAccountSequence extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneAccountSequence + */ + @EmbeddedId + private TgeneAccountSequenceKey pk; + + @Column(name = "PRODUCTCODE", nullable = true) + /** + * Codigo de producto + */ + private String productcode; + + @Column(name = "SUBPRODUCTCODE", nullable = true) + /** + * Codigo de subproducto + */ + private String subproductcode; + + @Column(name = "OFFICECODE", nullable = true) + /** + * Codigo de oficina + */ + private Integer officecode; + + @Column(name = "BRANCHCODE", nullable = true) + /** + * Codigo de sucursal + */ + private Integer branchcode; + + @Column(name = "COMPANYCODE", nullable = true) + /** + * Codigo de compania al que pertenece la oficina + */ + private Integer companycode; + + @Column(name = "SEQUENTIALNUMBER", nullable = false) + /** + * Consecutivo de cuenta + */ + private String sequentialnumber; + + /** Contructor por defecto */ + public TgeneAccountSequence() { + } + + /** + * Contructor de TgeneAccountSequence + * + * @param pPk Clave Primaria del entity + * @param pSequentialnumber Consecutivo de cuenta + */ + public TgeneAccountSequence(TgeneAccountSequenceKey pPk, String pSequentialnumber) { + this(); + this.pk = pPk; + this.sequentialnumber = pSequentialnumber; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneAccountSequence + */ + public static TgeneAccountSequence find(EntityManager pEntityManager, TgeneAccountSequenceKey pKey) throws Exception { + TgeneAccountSequence obj = pEntityManager.find(TgeneAccountSequence.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneAccountSequence + * + * @return El objeto que referencia a la Clave primaria de TgeneAccountSequence + */ + public TgeneAccountSequenceKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneAccountSequence + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountSequence + */ + public void setPk(TgeneAccountSequenceKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de productcode + * + * @return valor de productcode + */ + public String getProductcode() { + return this.productcode; + } + + /** + * Fija el valor de productcode + * + * @param pProductcode nuevo Valor de productcode + */ + public void setProductcode(String pProductcode) { + this.productcode = pProductcode; + } + + /** + * Obtiene el valor de subproductcode + * + * @return valor de subproductcode + */ + public String getSubproductcode() { + return this.subproductcode; + } + + /** + * Fija el valor de subproductcode + * + * @param pSubproductcode nuevo Valor de subproductcode + */ + public void setSubproductcode(String pSubproductcode) { + this.subproductcode = pSubproductcode; + } + + /** + * Obtiene el valor de officecode + * + * @return valor de officecode + */ + public Integer getOfficecode() { + return this.officecode; + } + + /** + * Fija el valor de officecode + * + * @param pOfficecode nuevo Valor de officecode + */ + public void setOfficecode(Integer pOfficecode) { + this.officecode = pOfficecode; + } + + /** + * Obtiene el valor de branchcode + * + * @return valor de branchcode + */ + public Integer getBranchcode() { + return this.branchcode; + } + + /** + * Fija el valor de branchcode + * + * @param pBranchcode nuevo Valor de branchcode + */ + public void setBranchcode(Integer pBranchcode) { + this.branchcode = pBranchcode; + } + + /** + * Obtiene el valor de companycode + * + * @return valor de companycode + */ + public Integer getCompanycode() { + return this.companycode; + } + + /** + * Fija el valor de companycode + * + * @param pCompanycode nuevo Valor de companycode + */ + public void setCompanycode(Integer pCompanycode) { + this.companycode = pCompanycode; + } + + /** + * Obtiene el valor de sequentialnumber + * + * @return valor de sequentialnumber + */ + public String getSequentialnumber() { + return this.sequentialnumber; + } + + /** + * Fija el valor de sequentialnumber + * + * @param pSequentialnumber nuevo Valor de sequentialnumber + */ + public void setSequentialnumber(String pSequentialnumber) { + this.sequentialnumber = pSequentialnumber; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneAccountSequence)) { + return false; + } + TgeneAccountSequence that = (TgeneAccountSequence) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneAccountSequence + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneAccountSequence */ + @Override + public Object createInstance() { + TgeneAccountSequence instance = new TgeneAccountSequence(); + instance.setPk(new TgeneAccountSequenceKey()); + return instance; + } + + /** + * Clona la entidad TgeneAccountSequence + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneAccountSequence p = (TgeneAccountSequence) this.clone(); + p.setPk((TgeneAccountSequenceKey) this.pk.cloneMe()); + return p; + } + + + // METODOS MANUALES + + /** Sentencia que obtiene un registro de TgeneAccountSequence con la secuencia de numeros de cuenta. */ + private static final String HQL = "from TgeneAccountSequence t " + " where t.pk.modulecode = :modulecode " + + " and coalesce(productcode,:productcode) = :productcode " + " and coalesce(subproductcode,:subproductcode) = :subproductcode " + + " and coalesce(officecode,:officecode) = :officecode " + " and coalesce(branchcode,:branchcode) = :branchcode " + + " and coalesce(companycode,:companycode) = :companycode "; + + /** Sentencia que obtiene la cuenta de secuencias en TgeneAccountSequence por modulo. */ + private static final String HQL_SEQ = "select count(t.pk.modulecode) " + " from TgeneAccountSequence t " + " where t.pk.modulecode = :modulecode "; + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pModule Codigo de modulo + * @param pProduct Codigo de producto + * @param pSubproduct Codigo de sub producto + * @param pBranchcode Codigo de sucursal + * @param pOfficecode Codigo de oficina + * @param pCompany Codigo de compania + * @return TgeneAccountSequence + */ + public static TgeneAccountSequence findWithhold(EntityManager pEntityManager, String pModule, String pProduct, String pSubproduct, + Integer pBranch, Integer pOffice, Integer pCompany) throws Exception { + Query qry = pEntityManager.createQuery(TgeneAccountSequence.HQL); + qry.setParameter("modulecode", pModule); + qry.setParameter("productcode", pProduct); + qry.setParameter("subproductcode", pSubproduct); + qry.setParameter("branchcode", pBranch); + qry.setParameter("officecode", pOffice); + qry.setParameter("companycode", pCompany); + qry.setLockMode(LockModeType.PESSIMISTIC_READ); + try { + return (TgeneAccountSequence) qry.getSingleResult(); + } catch (NoResultException e) { + throw new CommonException("CORE-0025", "SECUENCIA DE CUENTA NO DEFINIDA EN TGENEACCOUNTSEQUENCE MODULO: {0}", pModule); + } + } + + /** + * Metodo que entrega la cuenta de secuencias en TgeneAccountSequence por modulo. Devuelve '0' si no hay ningun registro + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pModule Codigo de modulo + * @return Numero de secuencias por modulo + */ + public static String getAmountSequences(EntityManager pEntityManager, String pModule) throws Exception { + Query qry = pEntityManager.createQuery(TgeneAccountSequence.HQL_SEQ); + qry.setParameter("modulecode", pModule); + try { + return qry.getSingleResult().toString(); + } catch (NoResultException e) { + throw new GeneralException("CORE-0025", "SECUENCIA DE CUENTA NO DEFINIDA EN TGENEACCOUNTSEQUENCE MODULO: {}", pModule); + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountSequenceKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountSequenceKey.java.svn-base new file mode 100644 index 0000000..88d49fe --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountSequenceKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTSEQUENCE*/ +@Embeddable +public class TgeneAccountSequenceKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="ACCOUNTSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia +*/ +private String accountsequence; + +/**Contructor por defecto*/ +public TgeneAccountSequenceKey(){} +/**Contructor de TgeneAccountSequenceKey +@param pModulecode Codigo de modulo +@param pAccountsequence Secuencia +*/ +public TgeneAccountSequenceKey(String pModulecode,String pAccountsequence){ + modulecode=pModulecode; + accountsequence=pAccountsequence; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de accountsequence +@return valor de accountsequence*/ +public String getAccountsequence(){ + return accountsequence; +} +/**Fija el valor de accountsequence +@param pAccountsequence nuevo Valor de accountsequence*/ +public void setAccountsequence(String pAccountsequence){ + accountsequence=pAccountsequence; +} + +/**Implementacin de la comparacin de TgeneAccountSequenceKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountSequenceKey))return false; + TgeneAccountSequenceKey that = (TgeneAccountSequenceKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getAccountsequence() == null || that.getAccountsequence() == null){ + return false; + } + if (! this.getAccountsequence().equals(that.getAccountsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountSequenceKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getAccountsequence() == null ? 0 : this.getAccountsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountStatus.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountStatus.java.svn-base new file mode 100644 index 0000000..32e35b0 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountStatus.java.svn-base @@ -0,0 +1,181 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTSTATUS*/ +@Entity(name="TgeneAccountStatus") +@Table(name="TGENEACCOUNTSTATUS") +public class TgeneAccountStatus extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountStatus +*/ +@EmbeddedId +private TgeneAccountStatusKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="ISACCOUNTSTATUS", nullable=true) + +/** +* Indica si es un estatus de cuenta, en vista un estatus es de un sobregiro pero de una cuenta +*/ +private String isaccountstatus; + +@Column(name="DESCRIPTION", nullable=false) + +/** +* Descripcion del estatus de la cuenta +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneAccountStatus(){ +} +/**Contructor de TgeneAccountStatus +@param pPk Clave Primaria del entity +@param pDescription Descripcion del estatus de la cuenta +*/ +public TgeneAccountStatus(TgeneAccountStatusKey pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountStatus +*/ +public static TgeneAccountStatus find(EntityManager pEntityManager,TgeneAccountStatusKey pKey) throws Exception{ + TgeneAccountStatus obj = pEntityManager.find(TgeneAccountStatus.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountStatus +@return El objeto que referencia a la Clave primaria de TgeneAccountStatus +*/ +public TgeneAccountStatusKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountStatus +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountStatus +*/ +public void setPk(TgeneAccountStatusKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de isaccountstatus +@return valor de isaccountstatus*/ +public String getIsaccountstatus(){ + return isaccountstatus; +} +/**Fija el valor de isaccountstatus +@param pIsaccountstatus nuevo Valor de isaccountstatus*/ +public void setIsaccountstatus(String pIsaccountstatus){ + isaccountstatus=pIsaccountstatus; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountStatus))return false; + TgeneAccountStatus that = (TgeneAccountStatus) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountStatus +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountStatus +*/ +public Object createInstance(){ + TgeneAccountStatus instance=new TgeneAccountStatus(); + instance.setPk(new TgeneAccountStatusKey()); + return instance; +} +/**Clona la entidad TgeneAccountStatus +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountStatus p=(TgeneAccountStatus)this.clone(); + p.setPk((TgeneAccountStatusKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountStatusKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountStatusKey.java.svn-base new file mode 100644 index 0000000..a7a709d --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneAccountStatusKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTSTATUS*/ +@Embeddable +public class TgeneAccountStatusKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +/**Contructor por defecto*/ +public TgeneAccountStatusKey(){} +/**Contructor de TgeneAccountStatusKey +@param pModulecode Codigo de modulo +@param pStatuscode Estatus de cuenta +*/ +public TgeneAccountStatusKey(String pModulecode,String pStatuscode){ + modulecode=pModulecode; + statuscode=pStatuscode; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Implementacin de la comparacin de TgeneAccountStatusKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountStatusKey))return false; + TgeneAccountStatusKey that = (TgeneAccountStatusKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountStatusKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneBaseAccount.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneBaseAccount.java.svn-base new file mode 100644 index 0000000..dd72943 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneBaseAccount.java.svn-base @@ -0,0 +1,139 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEBASEACCOUNT*/ +@Entity(name="TgeneBaseAccount") +@Table(name="TGENEBASEACCOUNT") +public class TgeneBaseAccount extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneBaseAccount +*/ +@EmbeddedId +private TgeneBaseAccountKey pk; +@Column(name="LOCKDB", nullable=true) + +/** +* Marca utilizada en el control de actualizacion de saldos de cuentas +*/ +private String lockdb; + +/**Contructor por defecto*/ +public TgeneBaseAccount(){ +} +/**Contructor de TgeneBaseAccount +@param pPk Clave Primaria del entity +*/ +public TgeneBaseAccount(TgeneBaseAccountKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneBaseAccount +*/ +public static TgeneBaseAccount find(EntityManager pEntityManager,TgeneBaseAccountKey pKey) throws Exception{ + TgeneBaseAccount obj = pEntityManager.find(TgeneBaseAccount.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneBaseAccount +@return El objeto que referencia a la Clave primaria de TgeneBaseAccount +*/ +public TgeneBaseAccountKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneBaseAccount +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneBaseAccount +*/ +public void setPk(TgeneBaseAccountKey pPk){ + pk=pPk; +} +/**Obtiene el valor de lockdb +@return valor de lockdb*/ +public String getLockdb(){ + return lockdb; +} +/**Fija el valor de lockdb +@param pLockdb nuevo Valor de lockdb*/ +public void setLockdb(String pLockdb){ + lockdb=pLockdb; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneBaseAccount))return false; + TgeneBaseAccount that = (TgeneBaseAccount) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneBaseAccount +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneBaseAccount +*/ +public Object createInstance(){ + TgeneBaseAccount instance=new TgeneBaseAccount(); + instance.setPk(new TgeneBaseAccountKey()); + return instance; +} +/**Clona la entidad TgeneBaseAccount +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneBaseAccount p=(TgeneBaseAccount)this.clone(); + p.setPk((TgeneBaseAccountKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneBaseAccountKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneBaseAccountKey.java.svn-base new file mode 100644 index 0000000..9b50dc0 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneBaseAccountKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEBASEACCOUNT*/ +@Embeddable +public class TgeneBaseAccountKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +/**Contructor por defecto*/ +public TgeneBaseAccountKey(){} +/**Contructor de TgeneBaseAccountKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +*/ +public TgeneBaseAccountKey(String pAccount,Integer pCompany){ + account=pAccount; + company=pCompany; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Implementacin de la comparacin de TgeneBaseAccountKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneBaseAccountKey))return false; + TgeneBaseAccountKey that = (TgeneBaseAccountKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneBaseAccountKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSequStruct.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSequStruct.java.svn-base new file mode 100644 index 0000000..4ac4755 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSequStruct.java.svn-base @@ -0,0 +1,140 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESEQUSTRUCT*/ +@Entity(name="TgeneSequStruct") +@Table(name="TGENESEQUSTRUCT") +public class TgeneSequStruct extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSequStruct +*/ +@Id +@Column(name="SEQUCODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="SEQUDESCRIPTION", nullable=false) + +/** +* Campo que almacena la descripcion del secuencial de un numero de cuenta +*/ +private String sequdescription; + +/**Contructor por defecto*/ +public TgeneSequStruct(){ +} +/**Contructor de TgeneSequStruct +@param pPk Clave Primaria del entity +@param pSequdescription Campo que almacena la descripcion del secuencial de un numero de cuenta +*/ +public TgeneSequStruct(String pPk,String pSequdescription){ + this(); + pk=pPk; + sequdescription=pSequdescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSequStruct +*/ +public static TgeneSequStruct find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneSequStruct obj = pEntityManager.find(TgeneSequStruct.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSequStruct +@return El objeto que referencia a la Clave primaria de TgeneSequStruct +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSequStruct +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSequStruct +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de sequdescription +@return valor de sequdescription*/ +public String getSequdescription(){ + return sequdescription; +} +/**Fija el valor de sequdescription +@param pSequdescription nuevo Valor de sequdescription*/ +public void setSequdescription(String pSequdescription){ + sequdescription=pSequdescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSequStruct))return false; + TgeneSequStruct that = (TgeneSequStruct) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSequStruct +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSequStruct +*/ +public Object createInstance(){ + TgeneSequStruct instance=new TgeneSequStruct(); + return instance; +} +/**Clona la entidad TgeneSequStruct +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSequStruct p=(TgeneSequStruct)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSequStructDetail.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSequStructDetail.java.svn-base new file mode 100644 index 0000000..a97435d --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSequStructDetail.java.svn-base @@ -0,0 +1,168 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.LockModeType; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESEQUSTRUCTDETAIL*/ +@Entity(name="TgeneSequStructDetail") +@Table(name="TGENESEQUSTRUCTDETAIL") +public class TgeneSequStructDetail extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneSequStructDetail + */ + @EmbeddedId + private TgeneSequStructDetailKey pk; + @Version + @Column(name="RECORDVERSION", nullable=true) + + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + /**Contructor por defecto*/ + public TgeneSequStructDetail(){ + } + /**Contructor de TgeneSequStructDetail + @param pPk Clave Primaria del entity + */ + public TgeneSequStructDetail(TgeneSequStructDetailKey pPk){ + this(); + pk=pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSequStructDetail + */ + public static TgeneSequStructDetail find(EntityManager pEntityManager,TgeneSequStructDetailKey pKey) throws Exception{ + TgeneSequStructDetail obj = pEntityManager.find(TgeneSequStructDetail.class,pKey); + return obj; + } + /**Entrega la Clave primaria de TgeneSequStructDetail + @return El objeto que referencia a la Clave primaria de TgeneSequStructDetail + */ + public TgeneSequStructDetailKey getPk(){ + return pk; + } + /**Fija un nuevo valor a la Clave primaria de TgeneSequStructDetail + @param pPk El objeto que referencia a la nueva Clave primaria de TgeneSequStructDetail + */ + public void setPk(TgeneSequStructDetailKey pPk){ + pk=pPk; + } + /**Obtiene el valor de recordversion + @return valor de recordversion*/ + public Integer getRecordversion(){ + return recordversion; + } + /**Fija el valor de recordversion + @param pRecordversion nuevo Valor de recordversion*/ + public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; + } + + public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSequStructDetail))return false; + TgeneSequStructDetail that = (TgeneSequStructDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /**Implementacin del metodo hashCode de la la entidad TgeneSequStructDetail + @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /**Implementacin toString + */ + public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } + /**Implementacin de la creacin de un bean en blanco TgeneSequStructDetail + */ + public Object createInstance(){ + TgeneSequStructDetail instance=new TgeneSequStructDetail(); + instance.setPk(new TgeneSequStructDetailKey()); + return instance; + } + /**Clona la entidad TgeneSequStructDetail + @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException{ + TgeneSequStructDetail p=(TgeneSequStructDetail)this.clone(); + p.setPk((TgeneSequStructDetailKey)this.pk.cloneMe()); + return p; + } + + // METODOS MANUALES + /** + * Sentencia que obtiene la estructura de secuencial para crear un numero de cuenta. + */ + private static final String JPQL = "from TgeneSequStructDetail t " + " where t.pk.sequcode = :sequcode"; + + /** + * Metodo que entrega la estructura de secuencial para un numero de cuenta + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pSequcode Codigo del secuencial + * @return TgeneSequStructDetail + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pSecucode) throws Exception { + Query qry = pEntityManager.createQuery(TgeneSequStructDetail.JPQL); + qry.setParameter("sequcode", pSecucode); + qry.setLockMode(LockModeType.PESSIMISTIC_READ); + return qry.getResultList(); + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSequStructDetailKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSequStructDetailKey.java.svn-base new file mode 100644 index 0000000..26d2ee2 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSequStructDetailKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESEQUSTRUCTDETAIL*/ +@Embeddable +public class TgeneSequStructDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SEQUCODE", nullable=false,updatable=false) + +/** +* Campo que almacena el codigo del secuencial +*/ +private String sequcode; + +@Column(name="STRUCTUREACCOUNTCATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo - EMPRESA, OFICINA, PRODUCTO, ETC. +*/ +private String structureaccountcatalog; + +@Column(name="STRUCTUREACCOUNTCATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo - FIELDSSTRUCTURE +*/ +private String structureaccountcatalogcode; + +/**Contructor por defecto*/ +public TgeneSequStructDetailKey(){} +/**Contructor de TgeneSequStructDetailKey +@param pSequcode Campo que almacena el codigo del secuencial +@param pStructureaccountcatalog Codigo de catalogo - EMPRESA, OFICINA, PRODUCTO, ETC. +@param pStructureaccountcatalogcode Codigo de tabla de catalogo - FIELDSSTRUCTURE +*/ +public TgeneSequStructDetailKey(String pSequcode,String pStructureaccountcatalog,String pStructureaccountcatalogcode){ + sequcode=pSequcode; + structureaccountcatalog=pStructureaccountcatalog; + structureaccountcatalogcode=pStructureaccountcatalogcode; +} +/**Obtiene el valor de sequcode +@return valor de sequcode*/ +public String getSequcode(){ + return sequcode; +} +/**Fija el valor de sequcode +@param pSequcode nuevo Valor de sequcode*/ +public void setSequcode(String pSequcode){ + sequcode=pSequcode; +} + +/**Obtiene el valor de structureaccountcatalog +@return valor de structureaccountcatalog*/ +public String getStructureaccountcatalog(){ + return structureaccountcatalog; +} +/**Fija el valor de structureaccountcatalog +@param pStructureaccountcatalog nuevo Valor de structureaccountcatalog*/ +public void setStructureaccountcatalog(String pStructureaccountcatalog){ + structureaccountcatalog=pStructureaccountcatalog; +} + +/**Obtiene el valor de structureaccountcatalogcode +@return valor de structureaccountcatalogcode*/ +public String getStructureaccountcatalogcode(){ + return structureaccountcatalogcode; +} +/**Fija el valor de structureaccountcatalogcode +@param pStructureaccountcatalogcode nuevo Valor de structureaccountcatalogcode*/ +public void setStructureaccountcatalogcode(String pStructureaccountcatalogcode){ + structureaccountcatalogcode=pStructureaccountcatalogcode; +} + +/**Implementacin de la comparacin de TgeneSequStructDetailKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSequStructDetailKey))return false; + TgeneSequStructDetailKey that = (TgeneSequStructDetailKey) o; + if (this.getSequcode() == null || that.getSequcode() == null){ + return false; + } + if (! this.getSequcode().equals(that.getSequcode())){ + return false; + } + if (this.getStructureaccountcatalog() == null || that.getStructureaccountcatalog() == null){ + return false; + } + if (! this.getStructureaccountcatalog().equals(that.getStructureaccountcatalog())){ + return false; + } + if (this.getStructureaccountcatalogcode() == null || that.getStructureaccountcatalogcode() == null){ + return false; + } + if (! this.getStructureaccountcatalogcode().equals(that.getStructureaccountcatalogcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSequStructDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSequcode() == null ? 0 : this.getSequcode().hashCode()); + result = result * 37 + (this.getStructureaccountcatalog() == null ? 0 : this.getStructureaccountcatalog().hashCode()); + result = result * 37 + (this.getStructureaccountcatalogcode() == null ? 0 : this.getStructureaccountcatalogcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSequentialModule.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSequentialModule.java.svn-base new file mode 100644 index 0000000..6c50a75 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSequentialModule.java.svn-base @@ -0,0 +1,161 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESEQUENTIALMODULE*/ +@Entity(name="TgeneSequentialModule") +@Table(name="TGENESEQUENTIALMODULE") +public class TgeneSequentialModule extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneSequentialModule + */ + @Id + @Column(name="MODULECODE" ,nullable=false, updatable=false) + private String pk; + @Column(name="SEQUCODE", nullable=true) + + /** + * Campo que almacena el codigo del secuencial de un numero de cuenta + */ + private String sequcode; + + @Version + @Column(name="RECORDVERSION", nullable=true) + + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + /**Contructor por defecto*/ + public TgeneSequentialModule(){ + } + /**Contructor de TgeneSequentialModule + @param pPk Clave Primaria del entity + */ + public TgeneSequentialModule(String pPk){ + this(); + pk=pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSequentialModule + */ + public static TgeneSequentialModule find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneSequentialModule obj = pEntityManager.find(TgeneSequentialModule.class,pKey); + return obj; + } + /**Entrega la Clave primaria de TgeneSequentialModule + @return El objeto que referencia a la Clave primaria de TgeneSequentialModule + */ + public String getPk(){ + return pk; + } + /**Fija un nuevo valor a la Clave primaria de TgeneSequentialModule + @param pPk El objeto que referencia a la nueva Clave primaria de TgeneSequentialModule + */ + public void setPk(String pPk){ + pk=pPk; + } + /**Obtiene el valor de sequcode + @return valor de sequcode*/ + public String getSequcode(){ + return sequcode; + } + /**Fija el valor de sequcode + @param pSequcode nuevo Valor de sequcode*/ + public void setSequcode(String pSequcode){ + sequcode=pSequcode; + } + + /**Obtiene el valor de recordversion + @return valor de recordversion*/ + public Integer getRecordversion(){ + return recordversion; + } + /**Fija el valor de recordversion + @param pRecordversion nuevo Valor de recordversion*/ + public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; + } + + public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSequentialModule))return false; + TgeneSequentialModule that = (TgeneSequentialModule) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /**Implementacin del metodo hashCode de la la entidad TgeneSequentialModule + @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /**Implementacin toString + */ + public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } + /**Implementacin de la creacin de un bean en blanco TgeneSequentialModule + */ + public Object createInstance(){ + TgeneSequentialModule instance=new TgeneSequentialModule(); + return instance; + } + /**Clona la entidad TgeneSequentialModule + @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException{ + TgeneSequentialModule p=(TgeneSequentialModule)this.clone(); + return p; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSolicitudeCredit.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSolicitudeCredit.java.svn-base new file mode 100644 index 0000000..784f1e7 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSolicitudeCredit.java.svn-base @@ -0,0 +1,302 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDECREDIT*/ +@Entity(name="TgeneSolicitudeCredit") +@Table(name="TGENESOLICITUDECREDIT") +public class TgeneSolicitudeCredit extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeCredit +*/ +@EmbeddedId +private TgeneSolicitudeCreditKey pk; +@Column(name="CASH", nullable=true) + +/** +* Indica que el pago se realiaza en efectivo. +*/ +private String cash; + +@Column(name="CHECKS", nullable=true) + +/** +* Indica que el pago se realiaza en cheque. +*/ +private String checks; + +@Column(name="CREDIT", nullable=true) + +/** +* Indica que el pago se realiaza con credito a una cuenta. +*/ +private String credit; + +@Column(name="CREDITACCOUNT", nullable=true) + +/** +* Numero de cuenta a acreditar cuando el cargo se cobra con debito a la cuenta. +*/ +private String creditaccount; + +@Column(name="CREDITACCOUNTINGCODE", nullable=true) + +/** +* Codigo contable a acreditar cuando el cargo se cobra con debito a la cuenta. +*/ +private String creditaccountingcode; + +@Column(name="CURRENCY", nullable=true) + +/** +* Codigo de moneda de la cuenta de la operacion. +*/ +private String currency; + +@Column(name="VALUE", nullable=true) + +/** +* El valor esta expresado en la moneda de la cuenta, del prestamo, plazo fijo etc.. +*/ +private BigDecimal value; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Si el valor se entrega en efectivo o cheque y el benefiniciario esta en las tablas de clientes, en el campo va el codigo de persona asociado. +*/ +private Integer personcode; + +@Column(name="IDBENEFICIARY", nullable=true) + +/** +* Si el beneficiario no esta registrado en la tabla de personas, en el campo va la identificacion del venceficiario. +*/ +private String idbeneficiary; + +@Column(name="BENEFICIARYNAME", nullable=true) + +/** +* Nombre del beneficiario. +*/ +private String beneficiaryname; + +/**Contructor por defecto*/ +public TgeneSolicitudeCredit(){ +} +/**Contructor de TgeneSolicitudeCredit +@param pPk Clave Primaria del entity +*/ +public TgeneSolicitudeCredit(TgeneSolicitudeCreditKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSolicitudeCredit +*/ +public static TgeneSolicitudeCredit find(EntityManager pEntityManager,TgeneSolicitudeCreditKey pKey) throws Exception{ + TgeneSolicitudeCredit obj = pEntityManager.find(TgeneSolicitudeCredit.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSolicitudeCredit +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeCredit +*/ +public TgeneSolicitudeCreditKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeCredit +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeCredit +*/ +public void setPk(TgeneSolicitudeCreditKey pPk){ + pk=pPk; +} +/**Obtiene el valor de cash +@return valor de cash*/ +public String getCash(){ + return cash; +} +/**Fija el valor de cash +@param pCash nuevo Valor de cash*/ +public void setCash(String pCash){ + cash=pCash; +} + +/**Obtiene el valor de checks +@return valor de checks*/ +public String getChecks(){ + return checks; +} +/**Fija el valor de checks +@param pChecks nuevo Valor de checks*/ +public void setChecks(String pChecks){ + checks=pChecks; +} + +/**Obtiene el valor de credit +@return valor de credit*/ +public String getCredit(){ + return credit; +} +/**Fija el valor de credit +@param pCredit nuevo Valor de credit*/ +public void setCredit(String pCredit){ + credit=pCredit; +} + +/**Obtiene el valor de creditaccount +@return valor de creditaccount*/ +public String getCreditaccount(){ + return creditaccount; +} +/**Fija el valor de creditaccount +@param pCreditaccount nuevo Valor de creditaccount*/ +public void setCreditaccount(String pCreditaccount){ + creditaccount=pCreditaccount; +} + +/**Obtiene el valor de creditaccountingcode +@return valor de creditaccountingcode*/ +public String getCreditaccountingcode(){ + return creditaccountingcode; +} +/**Fija el valor de creditaccountingcode +@param pCreditaccountingcode nuevo Valor de creditaccountingcode*/ +public void setCreditaccountingcode(String pCreditaccountingcode){ + creditaccountingcode=pCreditaccountingcode; +} + +/**Obtiene el valor de currency +@return valor de currency*/ +public String getCurrency(){ + return currency; +} +/**Fija el valor de currency +@param pCurrency nuevo Valor de currency*/ +public void setCurrency(String pCurrency){ + currency=pCurrency; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de idbeneficiary +@return valor de idbeneficiary*/ +public String getIdbeneficiary(){ + return idbeneficiary; +} +/**Fija el valor de idbeneficiary +@param pIdbeneficiary nuevo Valor de idbeneficiary*/ +public void setIdbeneficiary(String pIdbeneficiary){ + idbeneficiary=pIdbeneficiary; +} + +/**Obtiene el valor de beneficiaryname +@return valor de beneficiaryname*/ +public String getBeneficiaryname(){ + return beneficiaryname; +} +/**Fija el valor de beneficiaryname +@param pBeneficiaryname nuevo Valor de beneficiaryname*/ +public void setBeneficiaryname(String pBeneficiaryname){ + beneficiaryname=pBeneficiaryname; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeCredit))return false; + TgeneSolicitudeCredit that = (TgeneSolicitudeCredit) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeCredit +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSolicitudeCredit +*/ +public Object createInstance(){ + TgeneSolicitudeCredit instance=new TgeneSolicitudeCredit(); + instance.setPk(new TgeneSolicitudeCreditKey()); + return instance; +} +/**Clona la entidad TgeneSolicitudeCredit +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeCredit p=(TgeneSolicitudeCredit)this.clone(); + p.setPk((TgeneSolicitudeCreditKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSolicitudeCreditKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSolicitudeCreditKey.java.svn-base new file mode 100644 index 0000000..8405151 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSolicitudeCreditKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDECREDIT*/ +@Embeddable +public class TgeneSolicitudeCreditKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="CREDITSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del credito. +*/ +private Integer creditsequence; + +/**Contructor por defecto*/ +public TgeneSolicitudeCreditKey(){} +/**Contructor de TgeneSolicitudeCreditKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pCreditsequence Secuencia del credito. +*/ +public TgeneSolicitudeCreditKey(String pSolicitudnumber,Integer pSolicitudsequence,Integer pCreditsequence){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + creditsequence=pCreditsequence; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de creditsequence +@return valor de creditsequence*/ +public Integer getCreditsequence(){ + return creditsequence; +} +/**Fija el valor de creditsequence +@param pCreditsequence nuevo Valor de creditsequence*/ +public void setCreditsequence(Integer pCreditsequence){ + creditsequence=pCreditsequence; +} + +/**Implementacin de la comparacin de TgeneSolicitudeCreditKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeCreditKey))return false; + TgeneSolicitudeCreditKey that = (TgeneSolicitudeCreditKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getCreditsequence() == null || that.getCreditsequence() == null){ + return false; + } + if (! this.getCreditsequence().equals(that.getCreditsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeCreditKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getCreditsequence() == null ? 0 : this.getCreditsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSolicitudeForCredit.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSolicitudeForCredit.java.svn-base new file mode 100644 index 0000000..87acb01 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSolicitudeForCredit.java.svn-base @@ -0,0 +1,332 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDEFORCREDIT*/ +@Entity(name="TgeneSolicitudeForCredit") +@Table(name="TGENESOLICITUDEFORCREDIT") +public class TgeneSolicitudeForCredit extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeForCredit +*/ +@EmbeddedId +private TgeneSolicitudeForCreditKey pk; +@Column(name="CASH", nullable=true) + +/** +* Indica que el pago se realiaza en efectivo. +*/ +private String cash; + +@Column(name="CHECKS", nullable=true) + +/** +* Indica que el pago se realiaza en cheque. +*/ +private String checks; + +@Column(name="CREDIT", nullable=true) + +/** +* Indica que el pago se realiaza con credito a una cuenta. +*/ +private String credit; + +@Column(name="CREDITACCOUNT", nullable=true) + +/** +* Numero de cuenta a acreditar cuando el cargo se cobra con debito a la cuenta. +*/ +private String creditaccount; + +@Column(name="CREDITACCOUNTINGCODE", nullable=true) + +/** +* Codigo contable a acreditar cuando el cargo se cobra con debito a la cuenta. +*/ +private String creditaccountingcode; + +@Column(name="CURRENCY", nullable=true) + +/** +* Codigo de moneda de la cuenta de la operacion. +*/ +private String currency; + +@Column(name="VALUE", nullable=true) + +/** +* El valor esta expresado en la moneda de la cuenta, del prestamo, plazo fijo etc.. +*/ +private BigDecimal value; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Si el valor se entrega en efectivo o cheque y el benefiniciario esta en las tablas de clientes, en el campo va el codigo de persona asociado. +*/ +private Integer personcode; + +@Column(name="IDBENEFICIARY", nullable=true) + +/** +* Si el beneficiario no esta registrado en la tabla de personas, en el campo va la identificacion del venceficiario. +*/ +private String idbeneficiary; + +@Column(name="BENEFICIARYNAME", nullable=true) + +/** +* Nombre del beneficiario. +*/ +private String beneficiaryname; + +/**Contructor por defecto*/ +public TgeneSolicitudeForCredit(){ +} +/**Contructor de TgeneSolicitudeForCredit +@param pPk Clave Primaria del entity +*/ +public TgeneSolicitudeForCredit(TgeneSolicitudeForCreditKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSolicitudeForCredit +*/ +public static TgeneSolicitudeForCredit find(EntityManager pEntityManager,TgeneSolicitudeForCreditKey pKey) throws Exception{ + TgeneSolicitudeForCredit obj = pEntityManager.find(TgeneSolicitudeForCredit.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSolicitudeForCredit +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeForCredit +*/ +public TgeneSolicitudeForCreditKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeForCredit +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeForCredit +*/ +public void setPk(TgeneSolicitudeForCreditKey pPk){ + pk=pPk; +} +/**Obtiene el valor de cash +@return valor de cash*/ +public String getCash(){ + return cash; +} +/**Fija el valor de cash +@param pCash nuevo Valor de cash*/ +public void setCash(String pCash){ + cash=pCash; +} + +/**Obtiene el valor de checks +@return valor de checks*/ +public String getChecks(){ + return checks; +} +/**Fija el valor de checks +@param pChecks nuevo Valor de checks*/ +public void setChecks(String pChecks){ + checks=pChecks; +} + +/**Obtiene el valor de credit +@return valor de credit*/ +public String getCredit(){ + return credit; +} +/**Fija el valor de credit +@param pCredit nuevo Valor de credit*/ +public void setCredit(String pCredit){ + credit=pCredit; +} + +/**Obtiene el valor de creditaccount +@return valor de creditaccount*/ +public String getCreditaccount(){ + return creditaccount; +} +/**Fija el valor de creditaccount +@param pCreditaccount nuevo Valor de creditaccount*/ +public void setCreditaccount(String pCreditaccount){ + creditaccount=pCreditaccount; +} + +/**Obtiene el valor de creditaccountingcode +@return valor de creditaccountingcode*/ +public String getCreditaccountingcode(){ + return creditaccountingcode; +} +/**Fija el valor de creditaccountingcode +@param pCreditaccountingcode nuevo Valor de creditaccountingcode*/ +public void setCreditaccountingcode(String pCreditaccountingcode){ + creditaccountingcode=pCreditaccountingcode; +} + +/**Obtiene el valor de currency +@return valor de currency*/ +public String getCurrency(){ + return currency; +} +/**Fija el valor de currency +@param pCurrency nuevo Valor de currency*/ +public void setCurrency(String pCurrency){ + currency=pCurrency; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de idbeneficiary +@return valor de idbeneficiary*/ +public String getIdbeneficiary(){ + return idbeneficiary; +} +/**Fija el valor de idbeneficiary +@param pIdbeneficiary nuevo Valor de idbeneficiary*/ +public void setIdbeneficiary(String pIdbeneficiary){ + idbeneficiary=pIdbeneficiary; +} + +/**Obtiene el valor de beneficiaryname +@return valor de beneficiaryname*/ +public String getBeneficiaryname(){ + return beneficiaryname; +} +/**Fija el valor de beneficiaryname +@param pBeneficiaryname nuevo Valor de beneficiaryname*/ +public void setBeneficiaryname(String pBeneficiaryname){ + beneficiaryname=pBeneficiaryname; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeForCredit))return false; + TgeneSolicitudeForCredit that = (TgeneSolicitudeForCredit) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeForCredit +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSolicitudeForCredit +*/ +public Object createInstance(){ + TgeneSolicitudeForCredit instance=new TgeneSolicitudeForCredit(); + instance.setPk(new TgeneSolicitudeForCreditKey()); + return instance; +} +/**Clona la entidad TgeneSolicitudeForCredit +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeForCredit p=(TgeneSolicitudeForCredit)this.clone(); + p.setPk((TgeneSolicitudeForCreditKey)this.pk.cloneMe()); + return p; +} + + //Metodos manuales + /**Sentencia que devuelve uan lista con los valores de cuentas para creditos asociadas a una solicitud.*/ + private static final String HQL_SOLICITUDE_FORCREDIT = + "from TgeneSolicitudeForCredit t " + + " where t.pk.solicitudnumber = :solicitudnumber "+ + " and t.pk.solicitudsequence = :solicitudsequence "+ + " order by t.pk.creditsequence "; + + /** + * Metodo que entrega una lista de valores a acreditar al cliente, en procesos batch. + * @param pSolicitudNumber Numero de solicitud. + * @param pSolicitudSequence Secuencia dentro de la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager,String pSolicitudNumber,Integer pSolicitudSequence) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_SOLICITUDE_FORCREDIT); + qry.setParameter("solicitudnumber", pSolicitudNumber); + qry.setParameter("solicitudsequence", pSolicitudSequence); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSolicitudeForCreditKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSolicitudeForCreditKey.java.svn-base new file mode 100644 index 0000000..07dd5c5 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSolicitudeForCreditKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDEFORCREDIT*/ +@Embeddable +public class TgeneSolicitudeForCreditKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="CREDITSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del credito. +*/ +private Integer creditsequence; + +/**Contructor por defecto*/ +public TgeneSolicitudeForCreditKey(){} +/**Contructor de TgeneSolicitudeForCreditKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pCreditsequence Secuencia del credito. +*/ +public TgeneSolicitudeForCreditKey(String pSolicitudnumber,Integer pSolicitudsequence,Integer pCreditsequence){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + creditsequence=pCreditsequence; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de creditsequence +@return valor de creditsequence*/ +public Integer getCreditsequence(){ + return creditsequence; +} +/**Fija el valor de creditsequence +@param pCreditsequence nuevo Valor de creditsequence*/ +public void setCreditsequence(Integer pCreditsequence){ + creditsequence=pCreditsequence; +} + +/**Implementacin de la comparacin de TgeneSolicitudeForCreditKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeForCreditKey))return false; + TgeneSolicitudeForCreditKey that = (TgeneSolicitudeForCreditKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getCreditsequence() == null || that.getCreditsequence() == null){ + return false; + } + if (! this.getCreditsequence().equals(that.getCreditsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeForCreditKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getCreditsequence() == null ? 0 : this.getCreditsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSolicitudeForDebit.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSolicitudeForDebit.java.svn-base new file mode 100644 index 0000000..5061463 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSolicitudeForDebit.java.svn-base @@ -0,0 +1,225 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDEFORDEBIT*/ +@Entity(name="TgeneSolicitudeForDebit") +@Table(name="TGENESOLICITUDEFORDEBIT") +public class TgeneSolicitudeForDebit extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeForDebit +*/ +@EmbeddedId +private TgeneSolicitudeForDebitKey pk; +@Column(name="DEBITACCOUNT", nullable=true) + +/** +* Numero de cuenta a debitar cuando el cargo se cobra con debito a la cuenta. +*/ +private String debitaccount; + +@Column(name="DEBITACCOUNTINGCODE", nullable=true) + +/** +* Codigo contable cuando el cargo se cobra con debito a la cuenta. +*/ +private String debitaccountingcode; + +@Column(name="CURRENCY", nullable=true) + +/** +* Codigo de moneda de la cuenta de la operacion. +*/ +private String currency; + +@Column(name="VALUE", nullable=true) + +/** +* Valor en la moneda de la cuenta, la compra venta se hace en funcion a la moneda de la cuenta debito +*/ +private BigDecimal value; + +/**Contructor por defecto*/ +public TgeneSolicitudeForDebit(){ +} +/**Contructor de TgeneSolicitudeForDebit +@param pPk Clave Primaria del entity +*/ +public TgeneSolicitudeForDebit(TgeneSolicitudeForDebitKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSolicitudeForDebit +*/ +public static TgeneSolicitudeForDebit find(EntityManager pEntityManager,TgeneSolicitudeForDebitKey pKey) throws Exception{ + TgeneSolicitudeForDebit obj = pEntityManager.find(TgeneSolicitudeForDebit.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSolicitudeForDebit +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeForDebit +*/ +public TgeneSolicitudeForDebitKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeForDebit +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeForDebit +*/ +public void setPk(TgeneSolicitudeForDebitKey pPk){ + pk=pPk; +} +/**Obtiene el valor de debitaccount +@return valor de debitaccount*/ +public String getDebitaccount(){ + return debitaccount; +} +/**Fija el valor de debitaccount +@param pDebitaccount nuevo Valor de debitaccount*/ +public void setDebitaccount(String pDebitaccount){ + debitaccount=pDebitaccount; +} + +/**Obtiene el valor de debitaccountingcode +@return valor de debitaccountingcode*/ +public String getDebitaccountingcode(){ + return debitaccountingcode; +} +/**Fija el valor de debitaccountingcode +@param pDebitaccountingcode nuevo Valor de debitaccountingcode*/ +public void setDebitaccountingcode(String pDebitaccountingcode){ + debitaccountingcode=pDebitaccountingcode; +} + +/**Obtiene el valor de currency +@return valor de currency*/ +public String getCurrency(){ + return currency; +} +/**Fija el valor de currency +@param pCurrency nuevo Valor de currency*/ +public void setCurrency(String pCurrency){ + currency=pCurrency; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeForDebit))return false; + TgeneSolicitudeForDebit that = (TgeneSolicitudeForDebit) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeForDebit +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSolicitudeForDebit +*/ +public Object createInstance(){ + TgeneSolicitudeForDebit instance=new TgeneSolicitudeForDebit(); + instance.setPk(new TgeneSolicitudeForDebitKey()); + return instance; +} +/**Clona la entidad TgeneSolicitudeForDebit +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeForDebit p=(TgeneSolicitudeForDebit)this.clone(); + p.setPk((TgeneSolicitudeForDebitKey)this.pk.cloneMe()); + return p; +} + + //Metodos manuales. + /**Sentencia que devuelve uan lista con los valores de cuentas para debitos asociadas a una solicitud.*/ + private static final String HQL_SOLICITUDE_FORDEBIT = + "from TgeneSolicitudeForDebit tsd " + + " where tsd.pk.solicitudnumber = :solicitudnumber "+ + " and tsd.pk.solicitudsequence = :solicitudsequence "+ + " order by tsd.pk.debitsequence "; + + /** + * Metodo que entrega una lista de valores a cobrar al cliente, en la aperturad e una operacion. + * @param pSolicitudNumber Numero de solicitud. + * @param pSolicitudSequence Secuencia dentro de la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, + String pSolicitudNumber,Integer pSolicitudSequence) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_SOLICITUDE_FORDEBIT); + qry.setParameter("solicitudnumber", pSolicitudNumber); + qry.setParameter("solicitudsequence", pSolicitudSequence); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSolicitudeForDebitKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSolicitudeForDebitKey.java.svn-base new file mode 100644 index 0000000..706afff --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneSolicitudeForDebitKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDEFORDEBIT*/ +@Embeddable +public class TgeneSolicitudeForDebitKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="DEBITSEQUENCE", nullable=false,updatable=false) + +/** +* Sequencia de debito. +*/ +private Integer debitsequence; + +/**Contructor por defecto*/ +public TgeneSolicitudeForDebitKey(){} +/**Contructor de TgeneSolicitudeForDebitKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pDebitsequence Sequencia de debito. +*/ +public TgeneSolicitudeForDebitKey(String pSolicitudnumber,Integer pSolicitudsequence,Integer pDebitsequence){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + debitsequence=pDebitsequence; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de debitsequence +@return valor de debitsequence*/ +public Integer getDebitsequence(){ + return debitsequence; +} +/**Fija el valor de debitsequence +@param pDebitsequence nuevo Valor de debitsequence*/ +public void setDebitsequence(Integer pDebitsequence){ + debitsequence=pDebitsequence; +} + +/**Implementacin de la comparacin de TgeneSolicitudeForDebitKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeForDebitKey))return false; + TgeneSolicitudeForDebitKey that = (TgeneSolicitudeForDebitKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getDebitsequence() == null || that.getDebitsequence() == null){ + return false; + } + if (! this.getDebitsequence().equals(that.getDebitsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeForDebitKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getDebitsequence() == null ? 0 : this.getDebitsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneTransAccountOperStat.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneTransAccountOperStat.java.svn-base new file mode 100644 index 0000000..02262f5 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneTransAccountOperStat.java.svn-base @@ -0,0 +1,249 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.helper.Constant; +import com.fp.demandeposit.exception.DemandDepositException; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACCOUNTOPERSTAT */ +@Entity(name = "TgeneTransAccountOperStat") +@Table(name = "TGENETRANSACCOUNTOPERSTAT") +public class TgeneTransAccountOperStat extends com.fp.dto.AbstractDataTransport + implements + Serializable, + HibernateBean, + Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneTransAccountOperStat + */ + @EmbeddedId + private TgeneTransAccountOperStatKey pk; + @Column(name = "EVALUATETRUE", nullable = true) + /** + * Y, Indica que el estatus actual del ceque tiene que estar en esta condicion, N, el estatus actual del cheque no tiene que estar en la condicion del registro + */ + private String evaluatetrue; + + @Column(name = "VALIDATEDEBIT", nullable = true) + /** + * Y, Indica que valida cuenta debito + */ + private String validatedebit; + + @Column(name = "VALIDATECREDIT", nullable = true) + /** + * Y, Indica que valida la cuenta credito + */ + private String validatecredit; + + /** Contructor por defecto */ + public TgeneTransAccountOperStat() { + } + /** + * Contructor de TgeneTransAccountOperStat + * + * @param pPk Clave Primaria del entity + */ + public TgeneTransAccountOperStat(TgeneTransAccountOperStatKey pPk) { + this(); + pk = pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneTransAccountOperStat + */ + public static TgeneTransAccountOperStat find(EntityManager pEntityManager, TgeneTransAccountOperStatKey pKey) + throws Exception { + TgeneTransAccountOperStat obj = pEntityManager.find(TgeneTransAccountOperStat.class, pKey); + return obj; + } + /** + * Entrega la Clave primaria de TgeneTransAccountOperStat + * + * @return El objeto que referencia a la Clave primaria de TgeneTransAccountOperStat + */ + public TgeneTransAccountOperStatKey getPk() { + return pk; + } + /** + * Fija un nuevo valor a la Clave primaria de TgeneTransAccountOperStat + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransAccountOperStat + */ + public void setPk(TgeneTransAccountOperStatKey pPk) { + pk = pPk; + } + /** + * Obtiene el valor de evaluatetrue + * + * @return valor de evaluatetrue + */ + public String getEvaluatetrue() { + return evaluatetrue; + } + /** + * Fija el valor de evaluatetrue + * + * @param pEvaluatetrue nuevo Valor de evaluatetrue + */ + public void setEvaluatetrue(String pEvaluatetrue) { + evaluatetrue = pEvaluatetrue; + } + + /** + * Obtiene el valor de validatedebit + * + * @return valor de validatedebit + */ + public String getValidatedebit() { + return validatedebit; + } + /** + * Fija el valor de validatedebit + * + * @param pValidatedebit nuevo Valor de validatedebit + */ + public void setValidatedebit(String pValidatedebit) { + validatedebit = pValidatedebit; + } + + /** + * Obtiene el valor de validatecredit + * + * @return valor de validatecredit + */ + public String getValidatecredit() { + return validatecredit; + } + /** + * Fija el valor de validatecredit + * + * @param pValidatecredit nuevo Valor de validatecredit + */ + public void setValidatecredit(String pValidatecredit) { + validatecredit = pValidatecredit; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneTransAccountOperStat)) + return false; + TgeneTransAccountOperStat that = (TgeneTransAccountOperStat) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /** + * Implementacin del metodo hashCode de la la entidad TgeneTransAccountOperStat + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + /** Implementacin de la creacin de un bean en blanco TgeneTransAccountOperStat */ + public Object createInstance() { + TgeneTransAccountOperStat instance = new TgeneTransAccountOperStat(); + instance.setPk(new TgeneTransAccountOperStatKey()); + return instance; + } + /** + * Clona la entidad TgeneTransAccountOperStat + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneTransAccountOperStat p = (TgeneTransAccountOperStat) this.clone(); + p.setPk((TgeneTransAccountOperStatKey) this.pk.cloneMe()); + return p; + } + + //Metodos manuales. + /** Sentencia que devuelve lista de registros de TgeneTransAccountOperStat.*/ + private static final String HQL_TRAN_ACCOUNT_OPER = + " from TgeneTransAccountOperStat t " + + " where t.pk.transactionmodule = :module " + + " and t.pk.transactioncode = :code " + + " and t.pk.transactionversion = :version " ; + + /** + * Metodo que entrega datos de condicion operativa de cuentas por transaccion. + * @param pEntityManager Referencia a la session de la base de datos. + * @param pModule Codigo de modulo. + * @param pTransaction Codigo de transaccion. + * @param pVersion Codigo de version de transaccion. + * @return List + * @throws Exception + */ + @SuppressWarnings(Constant.VUNCHECKED) + public static List find(EntityManager pEntityManager,String pModule,Integer pTransaction, + Integer pVersion) throws Exception { + List lobj = null; + Query qry = pEntityManager.createQuery(HQL_TRAN_ACCOUNT_OPER); + qry.setParameter("module", pModule); + qry.setParameter("code", pTransaction); + qry.setParameter("version", pVersion); + lobj = qry.getResultList(); + if(lobj.isEmpty()){ + throw new DemandDepositException("CORE-0049","CONDICION OPERATIVA DE CUENTA NO DEFINO EN TGENETRANSACCOUNTOPERSTAT: MODULE: {0} TRAN: {1} VER: {2}", + pModule,pTransaction,pVersion); + } + return lobj; + } + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneTransAccountOperStatKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneTransAccountOperStatKey.java.svn-base new file mode 100644 index 0000000..6d8ab41 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneTransAccountOperStatKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACCOUNTOPERSTAT*/ +@Embeddable +public class TgeneTransAccountOperStatKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="OPERATIVCONDITION", nullable=false,updatable=false) + +/** +* Codigo de condicion operativa. +*/ +private String operativcondition; + +/**Contructor por defecto*/ +public TgeneTransAccountOperStatKey(){} +/**Contructor de TgeneTransAccountOperStatKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pOperativcondition Codigo de condicion operativa. +*/ +public TgeneTransAccountOperStatKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,String pOperativcondition){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + operativcondition=pOperativcondition; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de operativcondition +@return valor de operativcondition*/ +public String getOperativcondition(){ + return operativcondition; +} +/**Fija el valor de operativcondition +@param pOperativcondition nuevo Valor de operativcondition*/ +public void setOperativcondition(String pOperativcondition){ + operativcondition=pOperativcondition; +} + +/**Implementacin de la comparacin de TgeneTransAccountOperStatKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransAccountOperStatKey))return false; + TgeneTransAccountOperStatKey that = (TgeneTransAccountOperStatKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getOperativcondition() == null || that.getOperativcondition() == null){ + return false; + } + if (! this.getOperativcondition().equals(that.getOperativcondition())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransAccountOperStatKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getOperativcondition() == null ? 0 : this.getOperativcondition().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneTransAccountStatus.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneTransAccountStatus.java.svn-base new file mode 100644 index 0000000..fa3e7dd --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneTransAccountStatus.java.svn-base @@ -0,0 +1,247 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.helper.Constant; +import com.fp.demandeposit.exception.DemandDepositException; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACCOUNTSTATUS */ +@Entity(name = "TgeneTransAccountStatus") +@Table(name = "TGENETRANSACCOUNTSTATUS") +public class TgeneTransAccountStatus extends com.fp.dto.AbstractDataTransport + implements + Serializable, + HibernateBean, + Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneTransAccountStatus + */ + @EmbeddedId + private TgeneTransAccountStatusKey pk; + @Column(name = "EVALUATETRUE", nullable = true) + /** + * Y, Indica que el estatus actual del ceque tiene que estar en esta condicion, N, el estatus actual del cheque no tiene que estar en la condicion del registro + */ + private String evaluatetrue; + + @Column(name = "VALIDATEDEBIT", nullable = true) + /** + * Y, Indica que valida cuenta debito + */ + private String validatedebit; + + @Column(name = "VALIDATECREDIT", nullable = true) + /** + * Y, Indica que valida la cuenta credito + */ + private String validatecredit; + + /** Contructor por defecto */ + public TgeneTransAccountStatus() { + } + /** + * Contructor de TgeneTransAccountStatus + * + * @param pPk Clave Primaria del entity + */ + public TgeneTransAccountStatus(TgeneTransAccountStatusKey pPk) { + this(); + pk = pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneTransAccountStatus + */ + public static TgeneTransAccountStatus find(EntityManager pEntityManager, TgeneTransAccountStatusKey pKey) + throws Exception { + TgeneTransAccountStatus obj = pEntityManager.find(TgeneTransAccountStatus.class, pKey); + return obj; + } + /** + * Entrega la Clave primaria de TgeneTransAccountStatus + * + * @return El objeto que referencia a la Clave primaria de TgeneTransAccountStatus + */ + public TgeneTransAccountStatusKey getPk() { + return pk; + } + /** + * Fija un nuevo valor a la Clave primaria de TgeneTransAccountStatus + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransAccountStatus + */ + public void setPk(TgeneTransAccountStatusKey pPk) { + pk = pPk; + } + /** + * Obtiene el valor de evaluatetrue + * + * @return valor de evaluatetrue + */ + public String getEvaluatetrue() { + return evaluatetrue; + } + /** + * Fija el valor de evaluatetrue + * + * @param pEvaluatetrue nuevo Valor de evaluatetrue + */ + public void setEvaluatetrue(String pEvaluatetrue) { + evaluatetrue = pEvaluatetrue; + } + + /** + * Obtiene el valor de validatedebit + * + * @return valor de validatedebit + */ + public String getValidatedebit() { + return validatedebit; + } + /** + * Fija el valor de validatedebit + * + * @param pValidatedebit nuevo Valor de validatedebit + */ + public void setValidatedebit(String pValidatedebit) { + validatedebit = pValidatedebit; + } + + /** + * Obtiene el valor de validatecredit + * + * @return valor de validatecredit + */ + public String getValidatecredit() { + return validatecredit; + } + /** + * Fija el valor de validatecredit + * + * @param pValidatecredit nuevo Valor de validatecredit + */ + public void setValidatecredit(String pValidatecredit) { + validatecredit = pValidatecredit; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneTransAccountStatus)) + return false; + TgeneTransAccountStatus that = (TgeneTransAccountStatus) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /** + * Implementacin del metodo hashCode de la la entidad TgeneTransAccountStatus + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + /** Implementacin de la creacin de un bean en blanco TgeneTransAccountStatus */ + public Object createInstance() { + TgeneTransAccountStatus instance = new TgeneTransAccountStatus(); + instance.setPk(new TgeneTransAccountStatusKey()); + return instance; + } + /** + * Clona la entidad TgeneTransAccountStatus + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneTransAccountStatus p = (TgeneTransAccountStatus) this.clone(); + p.setPk((TgeneTransAccountStatusKey) this.pk.cloneMe()); + return p; + } + + //Metodos manuales. + /** Sentencia que devuelve lista de registros de TgeneTransAccountStatus.*/ + private static final String HQL_TRAN_ACCOUNT_STATUS = + " from TgeneTransAccountStatus ttranaccostat " + + " where ttranaccostat.pk.transactionmodule = :transactionmodule " + + " and ttranaccostat.pk.transactioncode = :transactioncode " + + " and ttranaccostat.pk.transactionversion = :transactionversion " ; + + /** + * Metodo que entrega datos de estatus de cuentas por transaccion. + * @param pEntityManager Referencia a la session de la base de datos. + * @param pModule Codigo de modulo. + * @param pTransaction Codigo de transaccion. + * @param pVersion Codigo de version de transaccion. + * @return List + * @throws Exception + */ + @SuppressWarnings(Constant.VUNCHECKED) + public static List find(EntityManager pEntityManager,String pModule,Integer pTransaction, + Integer pVersion) throws Exception { + List status = null; + Query qry = pEntityManager.createQuery(HQL_TRAN_ACCOUNT_STATUS); + qry.setParameter("transactionmodule", pModule); + qry.setParameter("transactioncode", pTransaction); + qry.setParameter("transactionversion", pVersion); + status = qry.getResultList(); + if(status.isEmpty()){ + throw new DemandDepositException("CORE-0043","ESTATUS DE CUENTA NO DEFINO EN TGENETRANSACCOUNTSTATUS: {0} MODULE: {1} TRAN: {2} VER: {2}", + pModule,pTransaction,pVersion); + } + return status; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneTransAccountStatusKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneTransAccountStatusKey.java.svn-base new file mode 100644 index 0000000..c70a82c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneTransAccountStatusKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACCOUNTSTATUS*/ +@Embeddable +public class TgeneTransAccountStatusKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +/**Contructor por defecto*/ +public TgeneTransAccountStatusKey(){} +/**Contructor de TgeneTransAccountStatusKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pStatuscode Estatus de cuenta +*/ +public TgeneTransAccountStatusKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,String pStatuscode){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + statuscode=pStatuscode; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Implementacin de la comparacin de TgeneTransAccountStatusKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransAccountStatusKey))return false; + TgeneTransAccountStatusKey that = (TgeneTransAccountStatusKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransAccountStatusKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneWarrantyAccount.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneWarrantyAccount.java.svn-base new file mode 100644 index 0000000..53deb90 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneWarrantyAccount.java.svn-base @@ -0,0 +1,345 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.List; +import javax.persistence.Query; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEWARRANTYACCOUNT*/ +@Entity(name = "TgeneWarrantyAccount") +@Table(name = "TGENEWARRANTYACCOUNT") +public class TgeneWarrantyAccount extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneWarrantyAccount + */ + @EmbeddedId + private TgeneWarrantyAccountKey pk; + @Column(name = "SOLICITUDNUMBER", nullable = false) + /** + * Numero de solicitud + */ + private String solicitudnumber; + @Column(name = "SOLICITUDSEQUENCE", nullable = false) + /** + * secuencia interna de solicitud + */ + private Integer solicitudsequence; + @Column(name = "WARRANTYSEQUENCE", nullable = false) + /** + * Secuencia interna de la solicitud de la garantia. + */ + private Integer warrantysequence; + @Column(name = "PERSONCODE", nullable = false) + /** + * Codigo de persona asociada a una garantia existente, o codigo de persona al cual se le asocia una nueva garantia. + */ + private Integer personcode; + @Column(name = "WARRANTYTYPE", nullable = true) + /** + * Codigo de tipo de garantia + */ + private String warrantytype; + @Column(name = "PROPERTYTYPE", nullable = true) + /** + * Tipo de bien, Edficaciones + */ + private String propertytype; + @Column(name = "GUARANTEEVALUE", nullable = true) + /** + * Valor garantizado, una operacion puede estar avalada o garantiza por mas de una garantia. + */ + private BigDecimal guaranteevalue; + + /**Contructor por defecto*/ + public TgeneWarrantyAccount() { + } + + /**Contructor de TgeneWarrantyAccount + @param pPk Clave Primaria del entity + @param pSolicitudnumber Numero de solicitud + @param pSolicitudsequence secuencia interna de solicitud + @param pWarrantysequence Secuencia interna de la solicitud de la garantia. + @param pPersoncode Codigo de persona asociada a una garantia existente, o codigo de persona al cual se le asocia una nueva garantia. + */ + public TgeneWarrantyAccount(TgeneWarrantyAccountKey pPk, String pSolicitudnumber, Integer pSolicitudsequence, Integer pWarrantysequence, Integer pPersoncode) { + this(); + pk = pPk; + solicitudnumber = pSolicitudnumber; + solicitudsequence = pSolicitudsequence; + warrantysequence = pWarrantysequence; + personcode = pPersoncode; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneWarrantyAccount + */ + public static TgeneWarrantyAccount find(EntityManager pEntityManager, TgeneWarrantyAccountKey pKey) throws Exception { + TgeneWarrantyAccount obj = pEntityManager.find(TgeneWarrantyAccount.class, pKey); + return obj; + } + + /**Entrega la Clave primaria de TgeneWarrantyAccount + @return El objeto que referencia a la Clave primaria de TgeneWarrantyAccount + */ + public TgeneWarrantyAccountKey getPk() { + return pk; + } + + /**Fija un nuevo valor a la Clave primaria de TgeneWarrantyAccount + @param pPk El objeto que referencia a la nueva Clave primaria de TgeneWarrantyAccount + */ + public void setPk(TgeneWarrantyAccountKey pPk) { + pk = pPk; + } + + /**Obtiene el valor de solicitudnumber + @return valor de solicitudnumber*/ + public String getSolicitudnumber() { + return solicitudnumber; + } + + /**Fija el valor de solicitudnumber + @param pSolicitudnumber nuevo Valor de solicitudnumber*/ + public void setSolicitudnumber(String pSolicitudnumber) { + solicitudnumber = pSolicitudnumber; + } + + /**Obtiene el valor de solicitudsequence + @return valor de solicitudsequence*/ + public Integer getSolicitudsequence() { + return solicitudsequence; + } + + /**Fija el valor de solicitudsequence + @param pSolicitudsequence nuevo Valor de solicitudsequence*/ + public void setSolicitudsequence(Integer pSolicitudsequence) { + solicitudsequence = pSolicitudsequence; + } + + /**Obtiene el valor de warrantysequence + @return valor de warrantysequence*/ + public Integer getWarrantysequence() { + return warrantysequence; + } + + /**Fija el valor de warrantysequence + @param pWarrantysequence nuevo Valor de warrantysequence*/ + public void setWarrantysequence(Integer pWarrantysequence) { + warrantysequence = pWarrantysequence; + } + + /**Obtiene el valor de personcode + @return valor de personcode*/ + public Integer getPersoncode() { + return personcode; + } + + /**Fija el valor de personcode + @param pPersoncode nuevo Valor de personcode*/ + public void setPersoncode(Integer pPersoncode) { + personcode = pPersoncode; + } + + /**Obtiene el valor de warrantytype + @return valor de warrantytype*/ + public String getWarrantytype() { + return warrantytype; + } + + /**Fija el valor de warrantytype + @param pWarrantytype nuevo Valor de warrantytype*/ + public void setWarrantytype(String pWarrantytype) { + warrantytype = pWarrantytype; + } + + /**Obtiene el valor de propertytype + @return valor de propertytype*/ + public String getPropertytype() { + return propertytype; + } + + /**Fija el valor de propertytype + @param pPropertytype nuevo Valor de propertytype*/ + public void setPropertytype(String pPropertytype) { + propertytype = pPropertytype; + } + + /**Obtiene el valor de guaranteevalue + @return valor de guaranteevalue*/ + public BigDecimal getGuaranteevalue() { + return guaranteevalue; + } + + /**Fija el valor de guaranteevalue + @param pGuaranteevalue nuevo Valor de guaranteevalue*/ + public void setGuaranteevalue(BigDecimal pGuaranteevalue) { + guaranteevalue = pGuaranteevalue; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneWarrantyAccount)) { + return false; + } + TgeneWarrantyAccount that = (TgeneWarrantyAccount) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /**Implementacin del metodo hashCode de la la entidad TgeneWarrantyAccount + @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /**Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /**Implementacin de la creacin de un bean en blanco TgeneWarrantyAccount + */ + public Object createInstance() { + TgeneWarrantyAccount instance = new TgeneWarrantyAccount(); + instance.setPk(new TgeneWarrantyAccountKey()); + return instance; + } + + /**Clona la entidad TgeneWarrantyAccount + @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneWarrantyAccount p = (TgeneWarrantyAccount) this.clone(); + p.setPk((TgeneWarrantyAccountKey) this.pk.cloneMe()); + return p; + } +//METODOS MANUALES + /** Sentencia que entrega datos de TgeneWarrantyAccount, par el un numero de garantia. */ + private static final String JPQL_WARR_ACCO = "from TgeneWarrantyAccount gwa where gwa.pk.warraccount= :warraccount" + + " and gwa.pk.company= :companycod and gwa.pk.warrcompany= :companycod "; + + /** + * Metodo que devuelve una lista de TgeneWarrantyAccount dado el numero de cuenta de un prestamo. + * @param pEntityManager Session de la base de datos. + * @param company Codigo de la compania. + * @param warracco Numero de la garantia. + * @return List + * @throws Exception + */ + public static List find(EntityManager pEntityManager, Integer company, String warracco) throws Exception { + List lwarrantAccount = new ArrayList(); + Query qry = pEntityManager.createQuery(TgeneWarrantyAccount.JPQL_WARR_ACCO); + qry.setParameter("companycod", company); + qry.setParameter("warraccount", warracco); + lwarrantAccount = (List) qry.getResultList(); + return lwarrantAccount; + } + /** Sentencia que entrega datos de TgeneWarrantyAccount, dado el numero de la operacion. */ + private static final String JPQL_ACCO_OPERAT = "from TgeneWarrantyAccount gwa where gwa.pk.account= :account" + + " and gwa.pk.company= :companycod and gwa.pk.warrcompany= :companycod "; + + /** + * Metodo que devuelve una lista de TgeneWarrantyAccount dado el numero de cuenta asociado a una garantia + * @param pEntityManager Session de la base de datos. + * @param company Codigo de la compania. + * @param account Numero de la garantia. + * @return List + * @throws Exception + */ + public static List findPerAccount(EntityManager pEntityManager, Integer company, String account) throws Exception { + List lwarrantAccount = new ArrayList(); + Query qry = pEntityManager.createQuery(TgeneWarrantyAccount.JPQL_ACCO_OPERAT); + qry.setParameter("companycod", company); + qry.setParameter("account", account); + lwarrantAccount = (List) qry.getResultList(); + return lwarrantAccount; + } + + /** + * Sentencia que entrega datos de TgeneWarrantyAccount, par el un numero de + * cuenta respaldada por una garantia. + */ + private static final String JPQL_ACCOUNT = " from TgeneWarrantyAccount gwa " + + " where gwa.pk.account= :accountparam " + + " and gwa.pk.company= :companyparam"; + + /** + * + * @param pEntityManager Session de la base de datos. + * @param company Codigo de la compania. + * @param account Numero de la garantia. + * @return List + * @throws Exception + */ + public static List findByAccount( + EntityManager pEntityManager, Integer company, String account) + throws Exception { + List lwarrantAccount = new ArrayList(); + Query qry = pEntityManager + .createQuery(TgeneWarrantyAccount.JPQL_ACCOUNT); + qry.setParameter("companyparam", company); + qry.setParameter("accountparam", account); + lwarrantAccount = (List) qry.getResultList(); + return lwarrantAccount; + } + + + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneWarrantyAccountKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneWarrantyAccountKey.java.svn-base new file mode 100644 index 0000000..6f613c2 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/.svn/text-base/TgeneWarrantyAccountKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEWARRANTYACCOUNT*/ +@Embeddable +public class TgeneWarrantyAccountKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* No de Cuenta de un Prestamo o Linea de Credito +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta del prestamo o linea de credito +*/ +private Integer company; + +@Column(name="WARRACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta asociado a una garantia, si la misma garantia esta avalando mas de una operacion. +*/ +private String warraccount; + +@Column(name="WARRCOMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta de la garantia. +*/ +private Integer warrcompany; + +/**Contructor por defecto*/ +public TgeneWarrantyAccountKey(){} +/**Contructor de TgeneWarrantyAccountKey +@param pAccount No de Cuenta de un Prestamo o Linea de Credito +@param pCompany Codigo de compania a la que pertence la cuenta del prestamo o linea de credito +@param pWarraccount Numero de cuenta asociado a una garantia, si la misma garantia esta avalando mas de una operacion. +@param pWarrcompany Codigo de compania a la que pertence la cuenta de la garantia. +*/ +public TgeneWarrantyAccountKey(String pAccount,Integer pCompany,String pWarraccount,Integer pWarrcompany){ + account=pAccount; + company=pCompany; + warraccount=pWarraccount; + warrcompany=pWarrcompany; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de warraccount +@return valor de warraccount*/ +public String getWarraccount(){ + return warraccount; +} +/**Fija el valor de warraccount +@param pWarraccount nuevo Valor de warraccount*/ +public void setWarraccount(String pWarraccount){ + warraccount=pWarraccount; +} + +/**Obtiene el valor de warrcompany +@return valor de warrcompany*/ +public Integer getWarrcompany(){ + return warrcompany; +} +/**Fija el valor de warrcompany +@param pWarrcompany nuevo Valor de warrcompany*/ +public void setWarrcompany(Integer pWarrcompany){ + warrcompany=pWarrcompany; +} + +/**Implementacin de la comparacin de TgeneWarrantyAccountKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneWarrantyAccountKey))return false; + TgeneWarrantyAccountKey that = (TgeneWarrantyAccountKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getWarraccount() == null || that.getWarraccount() == null){ + return false; + } + if (! this.getWarraccount().equals(that.getWarraccount())){ + return false; + } + if (this.getWarrcompany() == null || that.getWarrcompany() == null){ + return false; + } + if (! this.getWarrcompany().equals(that.getWarrcompany())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneWarrantyAccountKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getWarraccount() == null ? 0 : this.getWarraccount().hashCode()); + result = result * 37 + (this.getWarrcompany() == null ? 0 : this.getWarrcompany().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccoNumStructure.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccoNumStructure.java new file mode 100644 index 0000000..db88a23 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccoNumStructure.java @@ -0,0 +1,260 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCONUMSTRUCTURE */ +@Entity(name = "TgeneAccoNumStructure") +@Table(name = "TGENEACCONUMSTRUCTURE") +public class TgeneAccoNumStructure extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneAccoNumStructure + */ + @EmbeddedId + private TgeneAccoNumStructureKey pk; + + @Column(name = "SIZEFIELD", nullable = false) + /** + * Campo que almacena la longitud del campo que es parte del numero de cuenta + */ + private Integer sizefield; + + @Column(name = "ORDERFIELD", nullable = false) + /** + * Campo que almacena el orden del campo que sera parte del numero de cuenta + */ + private Integer orderfield; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + /** Contructor por defecto */ + public TgeneAccoNumStructure() { + } + + /** + * Contructor de TgeneAccoNumStructure + * + * @param pPk Clave Primaria del entity + * @param pSizefield Campo que almacena la longitud del campo que es parte del numero de cuenta + * @param pOrderfield Campo que almacena el orden del campo que sera parte del numero de cuenta + */ + public TgeneAccoNumStructure(TgeneAccoNumStructureKey pPk, Integer pSizefield, Integer pOrderfield) { + this(); + this.pk = pPk; + this.sizefield = pSizefield; + this.orderfield = pOrderfield; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneAccoNumStructure + */ + public static TgeneAccoNumStructure find(EntityManager pEntityManager, TgeneAccoNumStructureKey pKey) throws Exception { + TgeneAccoNumStructure obj = pEntityManager.find(TgeneAccoNumStructure.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneAccoNumStructure + * + * @return El objeto que referencia a la Clave primaria de TgeneAccoNumStructure + */ + public TgeneAccoNumStructureKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneAccoNumStructure + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccoNumStructure + */ + public void setPk(TgeneAccoNumStructureKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de sizefield + * + * @return valor de sizefield + */ + public Integer getSizefield() { + return this.sizefield; + } + + /** + * Fija el valor de sizefield + * + * @param pSizefield nuevo Valor de sizefield + */ + public void setSizefield(Integer pSizefield) { + this.sizefield = pSizefield; + } + + /** + * Obtiene el valor de orderfield + * + * @return valor de orderfield + */ + public Integer getOrderfield() { + return this.orderfield; + } + + /** + * Fija el valor de orderfield + * + * @param pOrderfield nuevo Valor de orderfield + */ + public void setOrderfield(Integer pOrderfield) { + this.orderfield = pOrderfield; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneAccoNumStructure)) { + return false; + } + TgeneAccoNumStructure that = (TgeneAccoNumStructure) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneAccoNumStructure + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneAccoNumStructure */ + @Override + public Object createInstance() { + TgeneAccoNumStructure instance = new TgeneAccoNumStructure(); + instance.setPk(new TgeneAccoNumStructureKey()); + return instance; + } + + /** + * Clona la entidad TgeneAccoNumStructure + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneAccoNumStructure p = (TgeneAccoNumStructure) this.clone(); + p.setPk((TgeneAccoNumStructureKey) this.pk.cloneMe()); + return p; + } + + // METODOS MANUALES + /** + * Sentencia que obtiene un registro de TgeneAccoNumStructure con la definicion de estructura para crear un numero + * de cuenta. + */ + private static final String JPQL = "from TgeneAccoNumStructure t " + " where t.pk.modulecode = :modulecode order by t.orderfield"; + + /** + * Metodo que entrega la defincion de una cuenta por modulo. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pModule Codigo de modulo + * @return TgeneAccountSequence + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pModule) throws Exception { + Query qry = pEntityManager.createQuery(TgeneAccoNumStructure.JPQL); + qry.setParameter("modulecode", pModule); + return qry.getResultList(); + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccoNumStructureKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccoNumStructureKey.java new file mode 100644 index 0000000..87384c8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccoNumStructureKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCONUMSTRUCTURE*/ +@Embeddable +public class TgeneAccoNumStructureKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="STRUCTUREACCOUNTCATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo - EMPRESA, OFICINA, PRODUCTO, ETC. +*/ +private String structureaccountcatalog; + +@Column(name="STRUCTUREACCOUNTCATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo - FIELDSSTRUCTURE +*/ +private String structureaccountcatalogcode; + +/**Contructor por defecto*/ +public TgeneAccoNumStructureKey(){} +/**Contructor de TgeneAccoNumStructureKey +@param pModulecode Codigo de modulo +@param pStructureaccountcatalog Codigo de catalogo - EMPRESA, OFICINA, PRODUCTO, ETC. +@param pStructureaccountcatalogcode Codigo de tabla de catalogo - FIELDSSTRUCTURE +*/ +public TgeneAccoNumStructureKey(String pModulecode,String pStructureaccountcatalog,String pStructureaccountcatalogcode){ + modulecode=pModulecode; + structureaccountcatalog=pStructureaccountcatalog; + structureaccountcatalogcode=pStructureaccountcatalogcode; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de structureaccountcatalog +@return valor de structureaccountcatalog*/ +public String getStructureaccountcatalog(){ + return structureaccountcatalog; +} +/**Fija el valor de structureaccountcatalog +@param pStructureaccountcatalog nuevo Valor de structureaccountcatalog*/ +public void setStructureaccountcatalog(String pStructureaccountcatalog){ + structureaccountcatalog=pStructureaccountcatalog; +} + +/**Obtiene el valor de structureaccountcatalogcode +@return valor de structureaccountcatalogcode*/ +public String getStructureaccountcatalogcode(){ + return structureaccountcatalogcode; +} +/**Fija el valor de structureaccountcatalogcode +@param pStructureaccountcatalogcode nuevo Valor de structureaccountcatalogcode*/ +public void setStructureaccountcatalogcode(String pStructureaccountcatalogcode){ + structureaccountcatalogcode=pStructureaccountcatalogcode; +} + +/**Implementacin de la comparacin de TgeneAccoNumStructureKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccoNumStructureKey))return false; + TgeneAccoNumStructureKey that = (TgeneAccoNumStructureKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getStructureaccountcatalog() == null || that.getStructureaccountcatalog() == null){ + return false; + } + if (! this.getStructureaccountcatalog().equals(that.getStructureaccountcatalog())){ + return false; + } + if (this.getStructureaccountcatalogcode() == null || that.getStructureaccountcatalogcode() == null){ + return false; + } + if (! this.getStructureaccountcatalogcode().equals(that.getStructureaccountcatalogcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccoNumStructureKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getStructureaccountcatalog() == null ? 0 : this.getStructureaccountcatalog().hashCode()); + result = result * 37 + (this.getStructureaccountcatalogcode() == null ? 0 : this.getStructureaccountcatalogcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccount.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccount.java new file mode 100644 index 0000000..aef9455 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccount.java @@ -0,0 +1,1114 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.LockModeType; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.common.helper.Constant; +import com.fp.core.exception.CoreException; +import com.fp.dto.hb.HibernateBean; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNT + */ +@Entity(name = "TgeneAccount") +@Table(name = "TGENEACCOUNT") +public class TgeneAccount extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneAccount + */ + @EmbeddedId + private TgeneAccountKey pk; + + @Column(name = "DATEFROM", nullable = false) + /** + * Fecha desde la cual esta vigente el registro con datos de la cuenta. + */ + private Timestamp datefrom; + + @Column(name = "ACCOUNTNAME", nullable = true) + /** + * Nombre de la cuenta + */ + private String accountname; + + @Column(name = "PERSONCODE", nullable = true) + /** + * Codigo de persona principal de la cuenta + */ + private Integer personcode; + + @Column(name = "MODULECODE", nullable = true) + /** + * Codigo de modulo al que pertenece la cuenta + */ + private String modulecode; + + @Column(name = "PRODUCTCODE", nullable = true) + /** + * Codigo de producto + */ + private String productcode; + + @Column(name = "SUBPRODUCTCODE", nullable = true) + /** + * Codigo de subproducto + */ + private String subproductcode; + + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + + @Column(name = "OFFICECODE", nullable = true) + /** + * Codigo de oficina a la que pertenece la cuenta + */ + private Integer officecode; + + @Column(name = "BRANCHCODE", nullable = true) + /** + * Codigo de sucursal a la que pertenece la cuenta + */ + private Integer branchcode; + + @Column(name = "OPENOFFICECODE", nullable = true) + /** + * Codigo de oficina de apertura de la cuenta + */ + private Integer openofficecode; + + @Column(name = "OPENBRANCHCODE", nullable = true) + /** + * Codigo de sucursal de apertura de la cuenta + */ + private Integer openbranchcode; + + @Column(name = "ACCOUNTSTATUSCODE", nullable = true) + /** + * Estatus de cuenta + */ + private String accountstatuscode; + + @Column(name = "OFFICER", nullable = true) + /** + * Codigo de usuario oficial de cuenta + */ + private String officer; + + @Column(name = "OPENINGUSERCODE", nullable = true) + /** + * Codigo de usuario de apertura de la cuenta + */ + private String openingusercode; + + @Column(name = "PERSONSCORECATALOG", nullable = true) + /** + * Codigo de catalogo que contiene la calificacion del cliente A, B, C, D, E + */ + private String personscorecatalog; + + @Column(name = "PERSONCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo 011 Codigo de tabla de calificaciones de cleinte + */ + private String personcatalogcode; + + @Column(name = "CHARGECATALOG", nullable = true) + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String chargecatalog; + + @Column(name = "CHARGECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String chargecatalogcode; + + @Column(name = "RATECATALOG", nullable = true) + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String ratecatalog; + + @Column(name = "RATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String ratecatalogcode; + + @Column(name = "CREDITTYPECODE", nullable = true) + /** + * Codigo de tipo de credito + */ + private String credittypecode; + + @Column(name = "OPERATIVCONDITION", nullable = true) + /** + * Codigo de condicion operativa. + */ + private String operativcondition; + + @Column(name = "OPERATIONSTATUS", nullable = true) + /** + * Codigo de estatus de la operacion, ORI (Original), REF (refinanciada), RES (restructurada) + */ + private String operationstatus; + + @Column(name = "MOTIVESTATUSCATALOG", nullable = true) + /** + * Codigo de catalogo 1 Voluntario, Orden de Gerencia, 3 Orden de la SIB + */ + private String motivestatuscatalog; + + @Column(name = "MOTIVESTATUSCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo MOTIVESTATUS + */ + private String motivestatuscatalogcode; + + @Column(name = "SECURITYLEVEL", nullable = true) + /** + * Nivel de seguridad de la cuenta + */ + private Integer securitylevel; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "JOURNALID", nullable = true) + /** + * Numero de mensaje con el cual se cambio algun campo del registro + */ + private String journalid; + + @Column(name = "OLDJOURNALID", nullable = true) + /** + * NUmero de mensaje anterior con el que se cambio algun campo de la cuenta + */ + private String oldjournalid; + + /** Contructor por defecto */ + public TgeneAccount() { + } + + /** + * Contructor de TgeneAccount + * + * @param pPk Clave Primaria del entity + * @param pDatefrom Fecha desde la cual esta vigente el registro con datos de la cuenta. + */ + public TgeneAccount(TgeneAccountKey pPk, Timestamp pDatefrom) { + this(); + this.pk = pPk; + this.datefrom = pDatefrom; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneAccount + */ + public static TgeneAccount find(EntityManager pEntityManager, TgeneAccountKey pKey) throws Exception { + TgeneAccount obj = pEntityManager.find(TgeneAccount.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneAccount + * + * @return El objeto que referencia a la Clave primaria de TgeneAccount + */ + public TgeneAccountKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneAccount + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccount + */ + public void setPk(TgeneAccountKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de accountname + * + * @return valor de accountname + */ + public String getAccountname() { + return this.accountname; + } + + /** + * Fija el valor de accountname + * + * @param pAccountname nuevo Valor de accountname + */ + public void setAccountname(String pAccountname) { + this.accountname = pAccountname; + } + + /** + * Obtiene el valor de personcode + * + * @return valor de personcode + */ + public Integer getPersoncode() { + return this.personcode; + } + + /** + * Fija el valor de personcode + * + * @param pPersoncode nuevo Valor de personcode + */ + public void setPersoncode(Integer pPersoncode) { + this.personcode = pPersoncode; + } + + /** + * Obtiene el valor de modulecode + * + * @return valor de modulecode + */ + public String getModulecode() { + return this.modulecode; + } + + /** + * Fija el valor de modulecode + * + * @param pModulecode nuevo Valor de modulecode + */ + public void setModulecode(String pModulecode) { + this.modulecode = pModulecode; + } + + /** + * Obtiene el valor de productcode + * + * @return valor de productcode + */ + public String getProductcode() { + return this.productcode; + } + + /** + * Fija el valor de productcode + * + * @param pProductcode nuevo Valor de productcode + */ + public void setProductcode(String pProductcode) { + this.productcode = pProductcode; + } + + /** + * Obtiene el valor de subproductcode + * + * @return valor de subproductcode + */ + public String getSubproductcode() { + return this.subproductcode; + } + + /** + * Fija el valor de subproductcode + * + * @param pSubproductcode nuevo Valor de subproductcode + */ + public void setSubproductcode(String pSubproductcode) { + this.subproductcode = pSubproductcode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de officecode + * + * @return valor de officecode + */ + public Integer getOfficecode() { + return this.officecode; + } + + /** + * Fija el valor de officecode + * + * @param pOfficecode nuevo Valor de officecode + */ + public void setOfficecode(Integer pOfficecode) { + this.officecode = pOfficecode; + } + + /** + * Obtiene el valor de branchcode + * + * @return valor de branchcode + */ + public Integer getBranchcode() { + return this.branchcode; + } + + /** + * Fija el valor de branchcode + * + * @param pBranchcode nuevo Valor de branchcode + */ + public void setBranchcode(Integer pBranchcode) { + this.branchcode = pBranchcode; + } + + /** + * Obtiene el valor de openofficecode + * + * @return valor de openofficecode + */ + public Integer getOpenofficecode() { + return this.openofficecode; + } + + /** + * Fija el valor de openofficecode + * + * @param pOpenofficecode nuevo Valor de openofficecode + */ + public void setOpenofficecode(Integer pOpenofficecode) { + this.openofficecode = pOpenofficecode; + } + + /** + * Obtiene el valor de openbranchcode + * + * @return valor de openbranchcode + */ + public Integer getOpenbranchcode() { + return this.openbranchcode; + } + + /** + * Fija el valor de openbranchcode + * + * @param pOpenbranchcode nuevo Valor de openbranchcode + */ + public void setOpenbranchcode(Integer pOpenbranchcode) { + this.openbranchcode = pOpenbranchcode; + } + + /** + * Obtiene el valor de accountstatuscode + * + * @return valor de accountstatuscode + */ + public String getAccountstatuscode() { + return this.accountstatuscode; + } + + /** + * Fija el valor de accountstatuscode + * + * @param pAccountstatuscode nuevo Valor de accountstatuscode + */ + public void setAccountstatuscode(String pAccountstatuscode) { + this.accountstatuscode = pAccountstatuscode; + } + + /** + * Obtiene el valor de officer + * + * @return valor de officer + */ + public String getOfficer() { + return this.officer; + } + + /** + * Fija el valor de officer + * + * @param pOfficer nuevo Valor de officer + */ + public void setOfficer(String pOfficer) { + this.officer = pOfficer; + } + + /** + * Obtiene el valor de openingusercode + * + * @return valor de openingusercode + */ + public String getOpeningusercode() { + return this.openingusercode; + } + + /** + * Fija el valor de openingusercode + * + * @param pOpeningusercode nuevo Valor de openingusercode + */ + public void setOpeningusercode(String pOpeningusercode) { + this.openingusercode = pOpeningusercode; + } + + /** + * Obtiene el valor de personscorecatalog + * + * @return valor de personscorecatalog + */ + public String getPersonscorecatalog() { + return this.personscorecatalog; + } + + /** + * Fija el valor de personscorecatalog + * + * @param pPersonscorecatalog nuevo Valor de personscorecatalog + */ + public void setPersonscorecatalog(String pPersonscorecatalog) { + this.personscorecatalog = pPersonscorecatalog; + } + + /** + * Obtiene el valor de personcatalogcode + * + * @return valor de personcatalogcode + */ + public String getPersoncatalogcode() { + return this.personcatalogcode; + } + + /** + * Fija el valor de personcatalogcode + * + * @param pPersoncatalogcode nuevo Valor de personcatalogcode + */ + public void setPersoncatalogcode(String pPersoncatalogcode) { + this.personcatalogcode = pPersoncatalogcode; + } + + /** + * Obtiene el valor de chargecatalog + * + * @return valor de chargecatalog + */ + public String getChargecatalog() { + return this.chargecatalog; + } + + /** + * Fija el valor de chargecatalog + * + * @param pChargecatalog nuevo Valor de chargecatalog + */ + public void setChargecatalog(String pChargecatalog) { + this.chargecatalog = pChargecatalog; + } + + /** + * Obtiene el valor de chargecatalogcode + * + * @return valor de chargecatalogcode + */ + public String getChargecatalogcode() { + return this.chargecatalogcode; + } + + /** + * Fija el valor de chargecatalogcode + * + * @param pChargecatalogcode nuevo Valor de chargecatalogcode + */ + public void setChargecatalogcode(String pChargecatalogcode) { + this.chargecatalogcode = pChargecatalogcode; + } + + /** + * Obtiene el valor de ratecatalog + * + * @return valor de ratecatalog + */ + public String getRatecatalog() { + return this.ratecatalog; + } + + /** + * Fija el valor de ratecatalog + * + * @param pRatecatalog nuevo Valor de ratecatalog + */ + public void setRatecatalog(String pRatecatalog) { + this.ratecatalog = pRatecatalog; + } + + /** + * Obtiene el valor de ratecatalogcode + * + * @return valor de ratecatalogcode + */ + public String getRatecatalogcode() { + return this.ratecatalogcode; + } + + /** + * Fija el valor de ratecatalogcode + * + * @param pRatecatalogcode nuevo Valor de ratecatalogcode + */ + public void setRatecatalogcode(String pRatecatalogcode) { + this.ratecatalogcode = pRatecatalogcode; + } + + /** + * Obtiene el valor de credittypecode + * + * @return valor de credittypecode + */ + public String getCredittypecode() { + return this.credittypecode; + } + + /** + * Fija el valor de credittypecode + * + * @param pCredittypecode nuevo Valor de credittypecode + */ + public void setCredittypecode(String pCredittypecode) { + this.credittypecode = pCredittypecode; + } + + /** + * Obtiene el valor de operativcondition + * + * @return valor de operativcondition + */ + public String getOperativcondition() { + return this.operativcondition; + } + + /** + * Fija el valor de operativcondition + * + * @param pOperativcondition nuevo Valor de operativcondition + */ + public void setOperativcondition(String pOperativcondition) { + this.operativcondition = pOperativcondition; + } + + /** + * Obtiene el valor de operationstatus + * + * @return valor de operationstatus + */ + public String getOperationstatus() { + return this.operationstatus; + } + + /** + * Fija el valor de operationstatus + * + * @param pOperationstatus nuevo Valor de operationstatus + */ + public void setOperationstatus(String pOperationstatus) { + this.operationstatus = pOperationstatus; + } + + /** + * Obtiene el valor de motivestatuscatalog + * + * @return valor de motivestatuscatalog + */ + public String getMotivestatuscatalog() { + return this.motivestatuscatalog; + } + + /** + * Fija el valor de motivestatuscatalog + * + * @param pMotivestatuscatalog nuevo Valor de motivestatuscatalog + */ + public void setMotivestatuscatalog(String pMotivestatuscatalog) { + this.motivestatuscatalog = pMotivestatuscatalog; + } + + /** + * Obtiene el valor de motivestatuscatalogcode + * + * @return valor de motivestatuscatalogcode + */ + public String getMotivestatuscatalogcode() { + return this.motivestatuscatalogcode; + } + + /** + * Fija el valor de motivestatuscatalogcode + * + * @param pMotivestatuscatalogcode nuevo Valor de motivestatuscatalogcode + */ + public void setMotivestatuscatalogcode(String pMotivestatuscatalogcode) { + this.motivestatuscatalogcode = pMotivestatuscatalogcode; + } + + /** + * Obtiene el valor de securitylevel + * + * @return valor de securitylevel + */ + public Integer getSecuritylevel() { + return this.securitylevel; + } + + /** + * Fija el valor de securitylevel + * + * @param pSecuritylevel nuevo Valor de securitylevel + */ + public void setSecuritylevel(Integer pSecuritylevel) { + this.securitylevel = pSecuritylevel; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de journalid + * + * @return valor de journalid + */ + public String getJournalid() { + return this.journalid; + } + + /** + * Fija el valor de journalid + * + * @param pJournalid nuevo Valor de journalid + */ + public void setJournalid(String pJournalid) { + this.journalid = pJournalid; + } + + /** + * Obtiene el valor de oldjournalid + * + * @return valor de oldjournalid + */ + public String getOldjournalid() { + return this.oldjournalid; + } + + /** + * Fija el valor de oldjournalid + * + * @param pOldjournalid nuevo Valor de oldjournalid + */ + public void setOldjournalid(String pOldjournalid) { + this.oldjournalid = pOldjournalid; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneAccount)) { + return false; + } + TgeneAccount that = (TgeneAccount) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneAccount + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneAccount */ + @Override + public Object createInstance() { + TgeneAccount instance = new TgeneAccount(); + instance.setPk(new TgeneAccountKey()); + return instance; + } + + /** + * Clona la entidad TgeneAccount + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneAccount p = (TgeneAccount) this.clone(); + p.setPk((TgeneAccountKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + + // METODOS MANUALES + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pAccount Numero de cuenta. + * @param pCompany Codigo de compania al que pertenece la cuenta. + * @return TgeneAccount + */ + public static TgeneAccount findVigenteWhitlock(EntityManager pEntityManager, String pAccount, Integer pCompany) throws Exception { + if (!Constant.isOracleDialect(pEntityManager)) { + TgeneAccount.lockBaseAccount(pEntityManager, pAccount, pCompany); + } + TgeneAccountKey key = new TgeneAccountKey(pAccount, pCompany, Constant.getDefaultExpiryTimestamp()); + TgeneAccount obj = pEntityManager.find(TgeneAccount.class, key, LockModeType.PESSIMISTIC_READ); + if (obj == null) { + throw new CoreException("CORE-0007", "CUENTA NO EXISTE: {0} COMPANIA {1}", pAccount, pCompany); + } + return obj; + } + + /** + * Bloquea el registro en la base de datos para garantizar una solo actualizacion de saldos. + * + * @param pEntityManager Referencia a una session de base de datos. + * @param pAccount Numero de cuenta. + * @param pCompany Codigo de compania al que pertenece la cuenta. + * @throws Exception + */ + private static void lockBaseAccount(EntityManager pEntityManager, String pAccount, Integer pCompany) throws Exception { + Query qry = pEntityManager.createQuery("update TgeneBaseAccount set lockdb = 'Y' where pk.account = :account and pk.company = :company"); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + qry.executeUpdate(); + } + + /** + * Sentencia que devuelve datos generales de la cuneta de la tabla TgeneAccount. + */ + private static final String HQL_ACCOUNT_MESSAGE = "from TgeneAccount t " + " where t.pk.account = :account " + " and t.pk.company = :company " + + " and t.journalid = :journalid "; + + /** + * Entrega datos generales de la cuenta. + * + * @param pAccount Numero de cuenta. + * @param pCompany Codigo de compania. + * @param pJournalid Numero de mensaje a obtener la cuenta. + * @return TgeneAccount + * @throws Exception + */ + public static TgeneAccount findByJournalId(EntityManager pEntityManager, String pAccount, Integer pCompany, String pJournalid) throws Exception { + TgeneAccount tgeneAccount = null; + Query qry = pEntityManager.createQuery(HQL_ACCOUNT_MESSAGE); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + qry.setParameter("journalid", pJournalid); + try { + tgeneAccount = (TgeneAccount) qry.getSingleResult(); + } catch (NoResultException e) { + throw new CoreException("CORE-0007", "CUENTA NO EXISTE: {1} COMPANIA {2}", pAccount, pCompany); + } + return tgeneAccount; + } + + /** + * Sentencia que devuelve datos generales de la cuneta de la tabla TgeneAccount. + */ + private static final String HQL_ACCOUNT_MESSAGE_ = "from TgeneAccount t " + " where t.journalid = :journalid "; + + /** + * Entrega datos generales de la cuenta. + * + * @param pAccount Numero de cuenta. + * @param pCompany Codigo de compania. + * @param pJournalid Numero de mensaje a obtener la cuenta. + * @return TgeneAccount + * @throws Exception + */ + public static TgeneAccount findByJournalId(EntityManager pEntityManager, String pJournalid) throws Exception { + TgeneAccount tgeneAccount = null; + Query qry = pEntityManager.createQuery(HQL_ACCOUNT_MESSAGE_); + qry.setParameter("journalid", pJournalid); + try { + tgeneAccount = (TgeneAccount) qry.getSingleResult(); + } catch (NoResultException e) { + throw new CoreException("CORE-0007", "CUENTA NO EXISTE PARA EL MENSAJE: {1} ", pJournalid); + } + return tgeneAccount; + } + + /** + * Sentencia que devuelve datos generales de la cuenta de la tabla TgeneAccount. + */ + private static final String HQL_ACCOUNT_OLD_MESSAGE = "from TgeneAccount t " + " where t.pk.account = :account " + + " and t.pk.company = :company " + " and t.oldjournalid = :oldjournalid "; + + /** + * Entrega datos generales de la cuenta. + * + * @param pAccount Numero de cuenta. + * @param pCompany Codigo de compania. + * @param pJournalid Numero de mensaje a obtener la cuenta. + * @return TgeneAccount + * @throws Exception + */ + public static TgeneAccount findByOldJournalid(EntityManager pEntityManager, String pAccount, Integer pCompany, String pOldJournalid) + throws Exception { + TgeneAccount tgeneAccount = null; + Query qry = pEntityManager.createQuery(HQL_ACCOUNT_OLD_MESSAGE); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + qry.setParameter("oldjournalid", pOldJournalid); + try { + tgeneAccount = (TgeneAccount) qry.getSingleResult(); + } catch (NoResultException e) { + throw new CoreException("CORE-0007", "CUENTA NO EXISTE: {1} COMPANIA {2}", pAccount, pCompany); + } + return tgeneAccount; + } + + /** Sentencia que devuelve una lista de cuentas dado el codigo de persona. */ + private static final String HQL_LIST_ACCOUNT_BY_PERSONCODE = "from TgeneAccount t " + " where t.pk.dateto = :dateto " + + " and t.pk.company = :company " + " and t.personcode = :personcode "; + + /** + * Metodo que entrega una lidta de cuentas dado un codigo de persona. + * + * @param pEntityManager Sessiond e la base de datos. + * @param pCompany Codigo de compania. + * @param pPersoncode Codigo de persona. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, Integer pCompany, Integer pPersoncode) throws Exception { + List ldata = null; + Query qry = pEntityManager.createQuery(HQL_LIST_ACCOUNT_BY_PERSONCODE); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + qry.setParameter("company", pCompany); + qry.setParameter("personcode", pPersoncode); + ldata = qry.getResultList(); + return ldata; + } + + /** + * Sentencia que devuelve un registro de la tabla TgeneAccount + */ + private static final String JPQL_TGENE_ACCOUNT = "from TgeneAccount tga" + " where tga.pk.account = :account" + + " and tga.pk.company = :company" + " and tga.pk.dateto = :dateto"; + + /** + * Metodo que devuelve un registro de la tabla TGENEACCOUNT + * + * @param account Numero de la cuenta + * @param company Compania a la que pertenece la cuenta + * @param dateto Fecha de vigencia de la tarjeta + * @return + */ + public static TgeneAccount findByFechaVigenciaTarjeta(EntityManager pEntityManager, String account, Integer company, Timestamp dateto) + throws Exception { + Query qry = pEntityManager.createQuery(TgeneAccount.JPQL_TGENE_ACCOUNT); + qry.setParameter("account", account); + qry.setParameter("company", company); + qry.setParameter("dateto", dateto); + try { + return (TgeneAccount) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + + private static final String JPQL_CURRENT_BY_PRODUCT = "from TgeneAccount tga " + + "where tga.modulecode = :modulecode and tga.productcode = :productcode " + + "and tga.subproductcode IN (:subproductcode) and tga.pk.dateto = :dateto " + + "and tga.personcode = :personcode and tga.accountstatuscode = :accountstatuscode"; + + /** + * Permite obtener las cuentas deprstamos que esten en estado vigente a partir de los codigos de productos de + * reestructuracion + * + * @param entityManager Administrador de entidades y persistencia + * @param moduleCode Codigo de modulo + * @param productCode Codigo de producto + * @param subProductCode Codigo de subproducto + * @param personCode Codigo de persona + * @return lista de objetos de tipo {@link TgeneAccount} con el resultado de la operacion + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findCurrentByProduct(EntityManager entityManager, String moduleCode, String productCode, + List subProductCode, Integer personCode) throws Exception { + List result = null; + + Query qry = entityManager.createQuery(TgeneAccount.JPQL_CURRENT_BY_PRODUCT); + qry.setParameter(com.fp.common.helper.Constant.VMODULECODE, moduleCode); + qry.setParameter(com.fp.common.helper.Constant.VPRODUCTCODE, productCode); + qry.setParameter(com.fp.common.helper.Constant.VSUBPRODUCTCODE, subProductCode); + qry.setParameter(com.fp.common.helper.Constant.VDATETO, Constant.getDefaultExpiryDate()); + qry.setParameter("personcode", personCode); + qry.setParameter("accountstatuscode", "VIG"); + + result = qry.getResultList(); + + return result; + } + + private static final String JPQL_CURRENT_BY_ACCOUNT = "from TgeneAccount tga " + + "where tga.modulecode = :modulecode and tga.productcode = :productcode " + + "and tga.pk.account IN (:account) and tga.pk.dateto = :dateto " + + "and tga.currencycode = :currencycode and tga.accountstatuscode = :accountstatuscode"; + + /** + * Permite obtener las cuentas deprstamos que esten en estado vigente a partir de los codigos de cuentas de + * prestamo + * + * @param entityManager Administrador de entidades y persistencia + * @param moduleCode Codigo de modulo + * @param productCode Codigo de producto + * @param account Lista de Strings con las cuentas a consultar + * @param currencyCode Codigo de modeda + * @return lista de objetos de tipo {@link TgeneAccount} con el resultado de la operacion + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findCurrentByAccount(EntityManager entityManager, String moduleCode, String productCode, List account, + String currencyCode) throws Exception { + List result = null; + + Query qry = entityManager.createQuery(TgeneAccount.JPQL_CURRENT_BY_ACCOUNT); + qry.setParameter(com.fp.common.helper.Constant.VMODULECODE, moduleCode); + qry.setParameter(com.fp.common.helper.Constant.VPRODUCTCODE, productCode); + qry.setParameter(com.fp.common.helper.Constant.VACCOUNT, account); + qry.setParameter(com.fp.common.helper.Constant.VDATETO, Constant.getDefaultExpiryDate()); + qry.setParameter(com.fp.common.helper.Constant.VCURRENCYCODE, currencyCode); + qry.setParameter("accountstatuscode", "VIG"); + + result = qry.getResultList(); + + return result; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountCredit.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountCredit.java new file mode 100644 index 0000000..a329268 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountCredit.java @@ -0,0 +1,339 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTCREDIT*/ +@Entity(name="TgeneAccountCredit") +@Table(name="TGENEACCOUNTCREDIT") +public class TgeneAccountCredit extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountCredit +*/ +@EmbeddedId +private TgeneAccountCreditKey pk; +@Column(name="QUOTANUMBER", nullable=true) + +/** +* Numero de cuota, a pagar se utiliza en la transaccion de pago en caja sea en efectivo o cheques. +*/ +private Integer quotanumber; + +@Column(name="CREDIT", nullable=true) + +/** +* Indica que el pago se realiaza con credito a una cuenta. +*/ +private String credit; + +@Column(name="CASH", nullable=true) + +/** +* Indica que el pago se realiaza en efectivo. +*/ +private String cash; + +@Column(name="CHECKS", nullable=true) + +/** +* Indica que el pago se realiaza en cheque. +*/ +private String checks; + +@Column(name="CURRENCY", nullable=true) + +/** +* Codigo de moneda de la cuenta de la operacion. +*/ +private String currency; + +@Column(name="VALUE", nullable=true) + +/** +* El valor esta expresado en la moneda de la cuenta, del prestamo, plazo fijo etc.. +*/ +private BigDecimal value; + +@Column(name="CREDITACCOUNT", nullable=true) + +/** +* Numero de cuenta a acreditar cuando el cargo se cobra con debito a la cuenta. +*/ +private String creditaccount; + +@Column(name="CREDITACCOUNTINGCODE", nullable=true) + +/** +* Codigo contable a acreditar cuando el cargo se cobra con debito a la cuenta. +*/ +private String creditaccountingcode; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Si el valor se entrega en efectivo o cheque y el benefiniciario esta en las tablas de clientes, en el campo va el codigo de persona asociado. +*/ +private Integer personcode; + +@Column(name="IDBENEFICIARY", nullable=true) + +/** +* Si el beneficiario no esta registrado en la tabla de personas, en el campo va la identificacion del venceficiario. +*/ +private String idbeneficiary; + +@Column(name="BENEFICIARYNAME", nullable=true) + +/** +* Nombre del beneficiario. +*/ +private String beneficiaryname; + +@Column(name="JOURNALID", nullable=true) + +/** +* Numero de mensaje con el que realizo el pago. +*/ +private String journalid; + +/**Contructor por defecto*/ +public TgeneAccountCredit(){ +} +/**Contructor de TgeneAccountCredit +@param pPk Clave Primaria del entity +*/ +public TgeneAccountCredit(TgeneAccountCreditKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountCredit +*/ +public static TgeneAccountCredit find(EntityManager pEntityManager,TgeneAccountCreditKey pKey) throws Exception{ + TgeneAccountCredit obj = pEntityManager.find(TgeneAccountCredit.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountCredit +@return El objeto que referencia a la Clave primaria de TgeneAccountCredit +*/ +public TgeneAccountCreditKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountCredit +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountCredit +*/ +public void setPk(TgeneAccountCreditKey pPk){ + pk=pPk; +} +/**Obtiene el valor de quotanumber +@return valor de quotanumber*/ +public Integer getQuotanumber(){ + return quotanumber; +} +/**Fija el valor de quotanumber +@param pQuotanumber nuevo Valor de quotanumber*/ +public void setQuotanumber(Integer pQuotanumber){ + quotanumber=pQuotanumber; +} + +/**Obtiene el valor de credit +@return valor de credit*/ +public String getCredit(){ + return credit; +} +/**Fija el valor de credit +@param pCredit nuevo Valor de credit*/ +public void setCredit(String pCredit){ + credit=pCredit; +} + +/**Obtiene el valor de cash +@return valor de cash*/ +public String getCash(){ + return cash; +} +/**Fija el valor de cash +@param pCash nuevo Valor de cash*/ +public void setCash(String pCash){ + cash=pCash; +} + +/**Obtiene el valor de checks +@return valor de checks*/ +public String getChecks(){ + return checks; +} +/**Fija el valor de checks +@param pChecks nuevo Valor de checks*/ +public void setChecks(String pChecks){ + checks=pChecks; +} + +/**Obtiene el valor de currency +@return valor de currency*/ +public String getCurrency(){ + return currency; +} +/**Fija el valor de currency +@param pCurrency nuevo Valor de currency*/ +public void setCurrency(String pCurrency){ + currency=pCurrency; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +/**Obtiene el valor de creditaccount +@return valor de creditaccount*/ +public String getCreditaccount(){ + return creditaccount; +} +/**Fija el valor de creditaccount +@param pCreditaccount nuevo Valor de creditaccount*/ +public void setCreditaccount(String pCreditaccount){ + creditaccount=pCreditaccount; +} + +/**Obtiene el valor de creditaccountingcode +@return valor de creditaccountingcode*/ +public String getCreditaccountingcode(){ + return creditaccountingcode; +} +/**Fija el valor de creditaccountingcode +@param pCreditaccountingcode nuevo Valor de creditaccountingcode*/ +public void setCreditaccountingcode(String pCreditaccountingcode){ + creditaccountingcode=pCreditaccountingcode; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de idbeneficiary +@return valor de idbeneficiary*/ +public String getIdbeneficiary(){ + return idbeneficiary; +} +/**Fija el valor de idbeneficiary +@param pIdbeneficiary nuevo Valor de idbeneficiary*/ +public void setIdbeneficiary(String pIdbeneficiary){ + idbeneficiary=pIdbeneficiary; +} + +/**Obtiene el valor de beneficiaryname +@return valor de beneficiaryname*/ +public String getBeneficiaryname(){ + return beneficiaryname; +} +/**Fija el valor de beneficiaryname +@param pBeneficiaryname nuevo Valor de beneficiaryname*/ +public void setBeneficiaryname(String pBeneficiaryname){ + beneficiaryname=pBeneficiaryname; +} + +/**Obtiene el valor de journalid +@return valor de journalid*/ +public String getJournalid(){ + return journalid; +} +/**Fija el valor de journalid +@param pJournalid nuevo Valor de journalid*/ +public void setJournalid(String pJournalid){ + journalid=pJournalid; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountCredit))return false; + TgeneAccountCredit that = (TgeneAccountCredit) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountCredit +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountCredit +*/ +public Object createInstance(){ + TgeneAccountCredit instance=new TgeneAccountCredit(); + instance.setPk(new TgeneAccountCreditKey()); + return instance; +} +/**Clona la entidad TgeneAccountCredit +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountCredit p=(TgeneAccountCredit)this.clone(); + p.setPk((TgeneAccountCreditKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountCreditKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountCreditKey.java new file mode 100644 index 0000000..eda4371 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountCreditKey.java @@ -0,0 +1,179 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTCREDIT*/ +@Embeddable +public class TgeneAccountCreditKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="CREATIONDATE", nullable=false,updatable=false) + +/** +* Fecha de creacion del registro. +*/ +private Date creationdate; + +@Column(name="CREDITSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del credito. +*/ +private Integer creditsequence; + +/**Contructor por defecto*/ +public TgeneAccountCreditKey(){} +/**Contructor de TgeneAccountCreditKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pCreationdate Fecha de creacion del registro. +@param pCreditsequence Secuencia del credito. +*/ +public TgeneAccountCreditKey(String pAccount,Integer pCompany,Date pCreationdate,Integer pCreditsequence){ + account=pAccount; + company=pCompany; + creationdate=pCreationdate; + creditsequence=pCreditsequence; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de creationdate +@return valor de creationdate*/ +public Date getCreationdate(){ + return creationdate; +} +/**Fija el valor de creationdate +@param pCreationdate nuevo Valor de creationdate*/ +public void setCreationdate(Date pCreationdate){ + creationdate=pCreationdate; +} + +/**Obtiene el valor de creditsequence +@return valor de creditsequence*/ +public Integer getCreditsequence(){ + return creditsequence; +} +/**Fija el valor de creditsequence +@param pCreditsequence nuevo Valor de creditsequence*/ +public void setCreditsequence(Integer pCreditsequence){ + creditsequence=pCreditsequence; +} + +/**Implementacin de la comparacin de TgeneAccountCreditKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountCreditKey))return false; + TgeneAccountCreditKey that = (TgeneAccountCreditKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getCreationdate() == null || that.getCreationdate() == null){ + return false; + } + if (! this.getCreationdate().equals(that.getCreationdate())){ + return false; + } + if (this.getCreditsequence() == null || that.getCreditsequence() == null){ + return false; + } + if (! this.getCreditsequence().equals(that.getCreditsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountCreditKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getCreationdate() == null ? 0 : this.getCreationdate().hashCode()); + result = result * 37 + (this.getCreditsequence() == null ? 0 : this.getCreditsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountCreditOpening.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountCreditOpening.java new file mode 100644 index 0000000..0224055 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountCreditOpening.java @@ -0,0 +1,332 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTCREDITOPENING*/ +@Entity(name="TgeneAccountCreditOpening") +@Table(name="TGENEACCOUNTCREDITOPENING") +public class TgeneAccountCreditOpening extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountCreditOpening +*/ +@EmbeddedId +private TgeneAccountCreditOpeningKey pk; +@Column(name="CASH", nullable=true) + +/** +* Indica que el pago se realiaza en efectivo. +*/ +private String cash; + +@Column(name="CHECKS", nullable=true) + +/** +* Indica que el pago se realiaza en cheque. +*/ +private String checks; + +@Column(name="CREDIT", nullable=true) + +/** +* Indica que el pago se realiaza con credito a una cuenta. +*/ +private String credit; + +@Column(name="CREDITACCOUNT", nullable=true) + +/** +* Numero de cuenta a acreditar cuando el cargo se cobra con debito a la cuenta. +*/ +private String creditaccount; + +@Column(name="CREDITACCOUNTINGCODE", nullable=true) + +/** +* Codigo contable a acreditar cuando el cargo se cobra con debito a la cuenta. +*/ +private String creditaccountingcode; + +@Column(name="CURRENCY", nullable=true) + +/** +* Codigo de moneda de la cuenta de la operacion. +*/ +private String currency; + +@Column(name="VALUE", nullable=true) + +/** +* El valor esta expresado en la moneda de la cuenta, del prestamo, plazo fijo etc.. +*/ +private BigDecimal value; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Si el valor se entrega en efectivo o cheque y el benefiniciario esta en las tablas de clientes, en el campo va el codigo de persona asociado. +*/ +private Integer personcode; + +@Column(name="IDBENEFICIARY", nullable=true) + +/** +* Si el beneficiario no esta registrado en la tabla de personas, en el campo va la identificacion del venceficiario. +*/ +private String idbeneficiary; + +@Column(name="BENEFICIARYNAME", nullable=true) + +/** +* Nombre del beneficiario. +*/ +private String beneficiaryname; + +/**Contructor por defecto*/ +public TgeneAccountCreditOpening(){ +} +/**Contructor de TgeneAccountCreditOpening +@param pPk Clave Primaria del entity +*/ +public TgeneAccountCreditOpening(TgeneAccountCreditOpeningKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountCreditOpening +*/ +public static TgeneAccountCreditOpening find(EntityManager pEntityManager,TgeneAccountCreditOpeningKey pKey) throws Exception{ + TgeneAccountCreditOpening obj = pEntityManager.find(TgeneAccountCreditOpening.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountCreditOpening +@return El objeto que referencia a la Clave primaria de TgeneAccountCreditOpening +*/ +public TgeneAccountCreditOpeningKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountCreditOpening +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountCreditOpening +*/ +public void setPk(TgeneAccountCreditOpeningKey pPk){ + pk=pPk; +} +/**Obtiene el valor de cash +@return valor de cash*/ +public String getCash(){ + return cash; +} +/**Fija el valor de cash +@param pCash nuevo Valor de cash*/ +public void setCash(String pCash){ + cash=pCash; +} + +/**Obtiene el valor de checks +@return valor de checks*/ +public String getChecks(){ + return checks; +} +/**Fija el valor de checks +@param pChecks nuevo Valor de checks*/ +public void setChecks(String pChecks){ + checks=pChecks; +} + +/**Obtiene el valor de credit +@return valor de credit*/ +public String getCredit(){ + return credit; +} +/**Fija el valor de credit +@param pCredit nuevo Valor de credit*/ +public void setCredit(String pCredit){ + credit=pCredit; +} + +/**Obtiene el valor de creditaccount +@return valor de creditaccount*/ +public String getCreditaccount(){ + return creditaccount; +} +/**Fija el valor de creditaccount +@param pCreditaccount nuevo Valor de creditaccount*/ +public void setCreditaccount(String pCreditaccount){ + creditaccount=pCreditaccount; +} + +/**Obtiene el valor de creditaccountingcode +@return valor de creditaccountingcode*/ +public String getCreditaccountingcode(){ + return creditaccountingcode; +} +/**Fija el valor de creditaccountingcode +@param pCreditaccountingcode nuevo Valor de creditaccountingcode*/ +public void setCreditaccountingcode(String pCreditaccountingcode){ + creditaccountingcode=pCreditaccountingcode; +} + +/**Obtiene el valor de currency +@return valor de currency*/ +public String getCurrency(){ + return currency; +} +/**Fija el valor de currency +@param pCurrency nuevo Valor de currency*/ +public void setCurrency(String pCurrency){ + currency=pCurrency; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de idbeneficiary +@return valor de idbeneficiary*/ +public String getIdbeneficiary(){ + return idbeneficiary; +} +/**Fija el valor de idbeneficiary +@param pIdbeneficiary nuevo Valor de idbeneficiary*/ +public void setIdbeneficiary(String pIdbeneficiary){ + idbeneficiary=pIdbeneficiary; +} + +/**Obtiene el valor de beneficiaryname +@return valor de beneficiaryname*/ +public String getBeneficiaryname(){ + return beneficiaryname; +} +/**Fija el valor de beneficiaryname +@param pBeneficiaryname nuevo Valor de beneficiaryname*/ +public void setBeneficiaryname(String pBeneficiaryname){ + beneficiaryname=pBeneficiaryname; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountCreditOpening))return false; + TgeneAccountCreditOpening that = (TgeneAccountCreditOpening) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountCreditOpening +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountCreditOpening +*/ +public Object createInstance(){ + TgeneAccountCreditOpening instance=new TgeneAccountCreditOpening(); + instance.setPk(new TgeneAccountCreditOpeningKey()); + return instance; +} +/**Clona la entidad TgeneAccountCreditOpening +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountCreditOpening p=(TgeneAccountCreditOpening)this.clone(); + p.setPk((TgeneAccountCreditOpeningKey)this.pk.cloneMe()); + return p; +} + + //Metodos manuales + /**Sentencia que devuelve uan lista con los valores a entregar al cliente asociados a una cuenta.*/ + private static final String HQL_ACCO_CREDIT_OPENING = + " from TgeneAccountCreditOpening t " + + " where t.pk.account = :account "+ + " and t.pk.company = :company "+ + " order by t.pk.creditsequence "; + + /** + * Metodo que entrega una lista de valores a entregar al cliente, en la aperturad e una operacion. + * @param pAccount Numero de cuenta. + * @param pCompany Codigo de compania a la que pertenece la cuenta. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager,String pAccount,Integer pCompany) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_ACCO_CREDIT_OPENING); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountCreditOpeningKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountCreditOpeningKey.java new file mode 100644 index 0000000..894015b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountCreditOpeningKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTCREDITOPENING*/ +@Embeddable +public class TgeneAccountCreditOpeningKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="CREDITSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del credito. +*/ +private Integer creditsequence; + +/**Contructor por defecto*/ +public TgeneAccountCreditOpeningKey(){} +/**Contructor de TgeneAccountCreditOpeningKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pCreditsequence Secuencia del credito. +*/ +public TgeneAccountCreditOpeningKey(String pAccount,Integer pCompany,Integer pCreditsequence){ + account=pAccount; + company=pCompany; + creditsequence=pCreditsequence; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de creditsequence +@return valor de creditsequence*/ +public Integer getCreditsequence(){ + return creditsequence; +} +/**Fija el valor de creditsequence +@param pCreditsequence nuevo Valor de creditsequence*/ +public void setCreditsequence(Integer pCreditsequence){ + creditsequence=pCreditsequence; +} + +/**Implementacin de la comparacin de TgeneAccountCreditOpeningKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountCreditOpeningKey))return false; + TgeneAccountCreditOpeningKey that = (TgeneAccountCreditOpeningKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getCreditsequence() == null || that.getCreditsequence() == null){ + return false; + } + if (! this.getCreditsequence().equals(that.getCreditsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountCreditOpeningKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getCreditsequence() == null ? 0 : this.getCreditsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountDebitOpening.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountDebitOpening.java new file mode 100644 index 0000000..b0eb4d5 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountDebitOpening.java @@ -0,0 +1,313 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTDEBITOPENING*/ +@Entity(name="TgeneAccountDebitOpening") +@Table(name="TGENEACCOUNTDEBITOPENING") +public class TgeneAccountDebitOpening extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountDebitOpening +*/ +@EmbeddedId +private TgeneAccountDebitOpeningKey pk; +@Column(name="CASH", nullable=true) + +/** +* Indica que el cargo se realiaza en efectivo. +*/ +private String cash; + +@Column(name="CHECKS", nullable=true) + +/** +* Indica que el cargo se realiaza en cheque. +*/ +private String checks; + +@Column(name="DEBIT", nullable=true) + +/** +* Indica que el cargo se realiaza con debito a la cuenta. +*/ +private String debit; + +@Column(name="DEBITACCOUNT", nullable=true) + +/** +* Numero de cuenta a debitar cuando el cargo se cobra con debito a la cuenta. +*/ +private String debitaccount; + +@Column(name="ACCOUNTMODULE", nullable=true) + +/** +* Codigo de modulo al que pertenece la cuenta a debitar +*/ +private String accountmodule; + +@Column(name="DEBITACCOUNTINGCODE", nullable=true) + +/** +* Codigo contable cuando el cargo se cobra con debito a la cuenta. +*/ +private String debitaccountingcode; + +@Column(name="CURRENCY", nullable=true) + +/** +* Codigo de moneda de la cuenta de la operacion. +*/ +private String currency; + +@Column(name="VALUE", nullable=true) + +/** +* Valor en la moneda de la cuenta, la compra venta se hace en funcion a la moneda de la cuenta debito +*/ +private BigDecimal value; + +@Column(name="JOURNALID", nullable=true) + +/** +* Numero de mensaje con el que se realizo el financiero. +*/ +private String journalid; + +/**Contructor por defecto*/ +public TgeneAccountDebitOpening(){ +} +/**Contructor de TgeneAccountDebitOpening +@param pPk Clave Primaria del entity +*/ +public TgeneAccountDebitOpening(TgeneAccountDebitOpeningKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountDebitOpening +*/ +public static TgeneAccountDebitOpening find(EntityManager pEntityManager,TgeneAccountDebitOpeningKey pKey) throws Exception{ + TgeneAccountDebitOpening obj = pEntityManager.find(TgeneAccountDebitOpening.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountDebitOpening +@return El objeto que referencia a la Clave primaria de TgeneAccountDebitOpening +*/ +public TgeneAccountDebitOpeningKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountDebitOpening +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountDebitOpening +*/ +public void setPk(TgeneAccountDebitOpeningKey pPk){ + pk=pPk; +} +/**Obtiene el valor de cash +@return valor de cash*/ +public String getCash(){ + return cash; +} +/**Fija el valor de cash +@param pCash nuevo Valor de cash*/ +public void setCash(String pCash){ + cash=pCash; +} + +/**Obtiene el valor de checks +@return valor de checks*/ +public String getChecks(){ + return checks; +} +/**Fija el valor de checks +@param pChecks nuevo Valor de checks*/ +public void setChecks(String pChecks){ + checks=pChecks; +} + +/**Obtiene el valor de debit +@return valor de debit*/ +public String getDebit(){ + return debit; +} +/**Fija el valor de debit +@param pDebit nuevo Valor de debit*/ +public void setDebit(String pDebit){ + debit=pDebit; +} + +/**Obtiene el valor de debitaccount +@return valor de debitaccount*/ +public String getDebitaccount(){ + return debitaccount; +} +/**Fija el valor de debitaccount +@param pDebitaccount nuevo Valor de debitaccount*/ +public void setDebitaccount(String pDebitaccount){ + debitaccount=pDebitaccount; +} + +/**Obtiene el valor de accountmodule +@return valor de accountmodule*/ +public String getAccountmodule(){ + return accountmodule; +} +/**Fija el valor de accountmodule +@param pAccountmodule nuevo Valor de accountmodule*/ +public void setAccountmodule(String pAccountmodule){ + accountmodule=pAccountmodule; +} + +/**Obtiene el valor de debitaccountingcode +@return valor de debitaccountingcode*/ +public String getDebitaccountingcode(){ + return debitaccountingcode; +} +/**Fija el valor de debitaccountingcode +@param pDebitaccountingcode nuevo Valor de debitaccountingcode*/ +public void setDebitaccountingcode(String pDebitaccountingcode){ + debitaccountingcode=pDebitaccountingcode; +} + +/**Obtiene el valor de currency +@return valor de currency*/ +public String getCurrency(){ + return currency; +} +/**Fija el valor de currency +@param pCurrency nuevo Valor de currency*/ +public void setCurrency(String pCurrency){ + currency=pCurrency; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +/**Obtiene el valor de journalid +@return valor de value*/ +public String getJournalid(){ + return journalid; +} +/**Fija el valor de journalid +@param journalid nuevo Valor de journalid*/ +public void setJournalid(String pJournalid){ + journalid=pJournalid; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountDebitOpening))return false; + TgeneAccountDebitOpening that = (TgeneAccountDebitOpening) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountDebitOpening +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountDebitOpening +*/ +public Object createInstance(){ + TgeneAccountDebitOpening instance=new TgeneAccountDebitOpening(); + instance.setPk(new TgeneAccountDebitOpeningKey()); + return instance; +} +/**Clona la entidad TgeneAccountDebitOpening +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountDebitOpening p=(TgeneAccountDebitOpening)this.clone(); + p.setPk((TgeneAccountDebitOpeningKey)this.pk.cloneMe()); + return p; +} + //Metodos manuales. + /**Sentencia que devuelve uan lista con los valores de cargos asociados a una solicitud.*/ + private static final String HQL_ACCO_DEBIT_OPENING = + "from TgeneAccountDebitOpening t " + + " where t.pk.account = :account "+ + " and t.pk.company = :company "+ + " order by t.pk.debitsequence "; + + /** + * Metodo que entrega una lista de valores a cobrar al cliente, en la aperturad e una operacion. + * @param pAccount Numero de cuenta. + * @param pCompany Codigo de compania a la que pertenece la cuenta. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager,String pAccount,Integer pCompany) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_ACCO_DEBIT_OPENING); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountDebitOpeningKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountDebitOpeningKey.java new file mode 100644 index 0000000..bf0eee1 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountDebitOpeningKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTDEBITOPENING*/ +@Embeddable +public class TgeneAccountDebitOpeningKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="DEBITSEQUENCE", nullable=false,updatable=false) + +/** +* Sequencia de debito. +*/ +private Integer debitsequence; + +/**Contructor por defecto*/ +public TgeneAccountDebitOpeningKey(){} +/**Contructor de TgeneAccountDebitOpeningKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pDebitsequence Sequencia de debito. +*/ +public TgeneAccountDebitOpeningKey(String pAccount,Integer pCompany,Integer pDebitsequence){ + account=pAccount; + company=pCompany; + debitsequence=pDebitsequence; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de debitsequence +@return valor de debitsequence*/ +public Integer getDebitsequence(){ + return debitsequence; +} +/**Fija el valor de debitsequence +@param pDebitsequence nuevo Valor de debitsequence*/ +public void setDebitsequence(Integer pDebitsequence){ + debitsequence=pDebitsequence; +} + +/**Implementacin de la comparacin de TgeneAccountDebitOpeningKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountDebitOpeningKey))return false; + TgeneAccountDebitOpeningKey that = (TgeneAccountDebitOpeningKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getDebitsequence() == null || that.getDebitsequence() == null){ + return false; + } + if (! this.getDebitsequence().equals(that.getDebitsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountDebitOpeningKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getDebitsequence() == null ? 0 : this.getDebitsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountForCredit.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountForCredit.java new file mode 100644 index 0000000..8166320 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountForCredit.java @@ -0,0 +1,401 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTFORCREDIT */ +@Entity(name = "TgeneAccountForCredit") +@Table(name = "TGENEACCOUNTFORCREDIT") +public class TgeneAccountForCredit extends com.fp.dto.AbstractDataTransport + implements + Serializable, + HibernateBean, + Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneAccountForCredit + */ + @EmbeddedId + private TgeneAccountForCreditKey pk; + @Column(name = "CASH", nullable = true) + /** + * Indica que el pago se realiaza en efectivo. + */ + private String cash; + + @Column(name = "CHECKS", nullable = true) + /** + * Indica que el pago se realiaza en cheque. + */ + private String checks; + + @Column(name = "CREDIT", nullable = true) + /** + * Indica que el pago se realiaza con credito a una cuenta. + */ + private String credit; + + @Column(name = "CREDITACCOUNT", nullable = true) + /** + * Numero de cuenta a acreditar cuando el cargo se cobra con debito a la cuenta. + */ + private String creditaccount; + + @Column(name = "CREDITACCOUNTINGCODE", nullable = true) + /** + * Codigo contable a acreditar cuando el cargo se cobra con debito a la cuenta. + */ + private String creditaccountingcode; + + @Column(name = "CURRENCY", nullable = true) + /** + * Codigo de moneda de la cuenta de la operacion. + */ + private String currency; + + @Column(name = "VALUE", nullable = true) + /** + * El valor esta expresado en la moneda de la cuenta, del prestamo, plazo fijo etc.. + */ + private BigDecimal value; + + @Column(name = "PERSONCODE", nullable = true) + /** + * Si el valor se entrega en efectivo o cheque y el benefiniciario esta en las tablas de clientes, en el campo va el codigo de persona asociado. + */ + private Integer personcode; + + @Column(name = "IDBENEFICIARY", nullable = true) + /** + * Si el beneficiario no esta registrado en la tabla de personas, en el campo va la identificacion del venceficiario. + */ + private String idbeneficiary; + + @Column(name = "BENEFICIARYNAME", nullable = true) + /** + * Nombre del beneficiario. + */ + private String beneficiaryname; + + /** Contructor por defecto */ + public TgeneAccountForCredit() { + } + /** + * Contructor de TgeneAccountForCredit + * + * @param pPk Clave Primaria del entity + */ + public TgeneAccountForCredit(TgeneAccountForCreditKey pPk) { + this(); + pk = pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneAccountForCredit + */ + public static TgeneAccountForCredit find(EntityManager pEntityManager, TgeneAccountForCreditKey pKey) + throws Exception { + TgeneAccountForCredit obj = pEntityManager.find(TgeneAccountForCredit.class, pKey); + return obj; + } + /** + * Entrega la Clave primaria de TgeneAccountForCredit + * + * @return El objeto que referencia a la Clave primaria de TgeneAccountForCredit + */ + public TgeneAccountForCreditKey getPk() { + return pk; + } + /** + * Fija un nuevo valor a la Clave primaria de TgeneAccountForCredit + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountForCredit + */ + public void setPk(TgeneAccountForCreditKey pPk) { + pk = pPk; + } + /** + * Obtiene el valor de cash + * + * @return valor de cash + */ + public String getCash() { + return cash; + } + /** + * Fija el valor de cash + * + * @param pCash nuevo Valor de cash + */ + public void setCash(String pCash) { + cash = pCash; + } + + /** + * Obtiene el valor de checks + * + * @return valor de checks + */ + public String getChecks() { + return checks; + } + /** + * Fija el valor de checks + * + * @param pChecks nuevo Valor de checks + */ + public void setChecks(String pChecks) { + checks = pChecks; + } + + /** + * Obtiene el valor de credit + * + * @return valor de credit + */ + public String getCredit() { + return credit; + } + /** + * Fija el valor de credit + * + * @param pCredit nuevo Valor de credit + */ + public void setCredit(String pCredit) { + credit = pCredit; + } + + /** + * Obtiene el valor de creditaccount + * + * @return valor de creditaccount + */ + public String getCreditaccount() { + return creditaccount; + } + /** + * Fija el valor de creditaccount + * + * @param pCreditaccount nuevo Valor de creditaccount + */ + public void setCreditaccount(String pCreditaccount) { + creditaccount = pCreditaccount; + } + + /** + * Obtiene el valor de creditaccountingcode + * + * @return valor de creditaccountingcode + */ + public String getCreditaccountingcode() { + return creditaccountingcode; + } + /** + * Fija el valor de creditaccountingcode + * + * @param pCreditaccountingcode nuevo Valor de creditaccountingcode + */ + public void setCreditaccountingcode(String pCreditaccountingcode) { + creditaccountingcode = pCreditaccountingcode; + } + + /** + * Obtiene el valor de currency + * + * @return valor de currency + */ + public String getCurrency() { + return currency; + } + /** + * Fija el valor de currency + * + * @param pCurrency nuevo Valor de currency + */ + public void setCurrency(String pCurrency) { + currency = pCurrency; + } + + /** + * Obtiene el valor de value + * + * @return valor de value + */ + public BigDecimal getValue() { + return value; + } + /** + * Fija el valor de value + * + * @param pValue nuevo Valor de value + */ + public void setValue(BigDecimal pValue) { + value = pValue; + } + + /** + * Obtiene el valor de personcode + * + * @return valor de personcode + */ + public Integer getPersoncode() { + return personcode; + } + /** + * Fija el valor de personcode + * + * @param pPersoncode nuevo Valor de personcode + */ + public void setPersoncode(Integer pPersoncode) { + personcode = pPersoncode; + } + + /** + * Obtiene el valor de idbeneficiary + * + * @return valor de idbeneficiary + */ + public String getIdbeneficiary() { + return idbeneficiary; + } + /** + * Fija el valor de idbeneficiary + * + * @param pIdbeneficiary nuevo Valor de idbeneficiary + */ + public void setIdbeneficiary(String pIdbeneficiary) { + idbeneficiary = pIdbeneficiary; + } + + /** + * Obtiene el valor de beneficiaryname + * + * @return valor de beneficiaryname + */ + public String getBeneficiaryname() { + return beneficiaryname; + } + /** + * Fija el valor de beneficiaryname + * + * @param pBeneficiaryname nuevo Valor de beneficiaryname + */ + public void setBeneficiaryname(String pBeneficiaryname) { + beneficiaryname = pBeneficiaryname; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneAccountForCredit)) + return false; + TgeneAccountForCredit that = (TgeneAccountForCredit) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /** + * Implementacin del metodo hashCode de la la entidad TgeneAccountForCredit + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + /** Implementacin de la creacin de un bean en blanco TgeneAccountForCredit */ + public Object createInstance() { + TgeneAccountForCredit instance = new TgeneAccountForCredit(); + instance.setPk(new TgeneAccountForCreditKey()); + return instance; + } + /** + * Clona la entidad TgeneAccountForCredit + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneAccountForCredit p = (TgeneAccountForCredit) this.clone(); + p.setPk((TgeneAccountForCreditKey) this.pk.cloneMe()); + return p; + } + + //Metodos manuales. + /** Sentencia que devuelve datos de la tabla TgeneAccountForCredit.*/ + private static final String HQL_ACCOUNT_FOR_CREDIT = + "from TgeneAccountForCredit tafc " + + " where tafc.pk.account = :account "+ + " and tafc.pk.company = :company "+ + " order by tafc.pk.creditsequence "; + + /** + * Entrega datos de cuentas a acreditar ejemplo definicion de la forma de pago de certificado de deposito. + * @param pAccount Numero de cuenta. + * @param pCompany Codigo de compania. + * @return List + * @throws Exception + */ + @SuppressWarnings(Constant.VUNCHECKED) + public static List find(EntityManager pEntityManager, + String pAccount,Integer pCompany) throws Exception { + List lcredit = null; + Query qry = pEntityManager.createQuery(HQL_ACCOUNT_FOR_CREDIT); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + lcredit = qry.getResultList(); + return lcredit; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountForCreditKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountForCreditKey.java new file mode 100644 index 0000000..cb1da7c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountForCreditKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTFORCREDIT*/ +@Embeddable +public class TgeneAccountForCreditKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="CREDITSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del credito. +*/ +private Integer creditsequence; + +/**Contructor por defecto*/ +public TgeneAccountForCreditKey(){} +/**Contructor de TgeneAccountForCreditKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pCreditsequence Secuencia del credito. +*/ +public TgeneAccountForCreditKey(String pAccount,Integer pCompany,Integer pCreditsequence){ + account=pAccount; + company=pCompany; + creditsequence=pCreditsequence; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de creditsequence +@return valor de creditsequence*/ +public Integer getCreditsequence(){ + return creditsequence; +} +/**Fija el valor de creditsequence +@param pCreditsequence nuevo Valor de creditsequence*/ +public void setCreditsequence(Integer pCreditsequence){ + creditsequence=pCreditsequence; +} + +/**Implementacin de la comparacin de TgeneAccountForCreditKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountForCreditKey))return false; + TgeneAccountForCreditKey that = (TgeneAccountForCreditKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getCreditsequence() == null || that.getCreditsequence() == null){ + return false; + } + if (! this.getCreditsequence().equals(that.getCreditsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountForCreditKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getCreditsequence() == null ? 0 : this.getCreditsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountForDebit.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountForDebit.java new file mode 100644 index 0000000..ebf7785 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountForDebit.java @@ -0,0 +1,262 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTFORDEBIT */ +@Entity(name = "TgeneAccountForDebit") +@Table(name = "TGENEACCOUNTFORDEBIT") +public class TgeneAccountForDebit extends com.fp.dto.AbstractDataTransport + implements + Serializable, + HibernateBean, + Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneAccountForDebit + */ + @EmbeddedId + private TgeneAccountForDebitKey pk; + @Column(name = "DEBITACCOUNT", nullable = true) + /** + * Numero de cuenta a debitar cuando el cargo se cobra con debito a la cuenta. + */ + private String debitaccount; + + @Column(name = "DEBITACCOUNTINGCODE", nullable = true) + /** + * Codigo contable cuando el cargo se cobra con debito a la cuenta. + */ + private String debitaccountingcode; + + @Column(name = "CURRENCY", nullable = true) + /** + * Codigo de moneda de la cuenta de la operacion. + */ + private String currency; + + @Column(name = "VALUE", nullable = true) + /** + * Valor en la moneda de la cuenta, la compra venta se hace en funcion a la moneda de la cuenta debito + */ + private BigDecimal value; + + /** Contructor por defecto */ + public TgeneAccountForDebit() { + } + /** + * Contructor de TgeneAccountForDebit + * + * @param pPk Clave Primaria del entity + */ + public TgeneAccountForDebit(TgeneAccountForDebitKey pPk) { + this(); + pk = pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneAccountForDebit + */ + public static TgeneAccountForDebit find(EntityManager pEntityManager, TgeneAccountForDebitKey pKey) + throws Exception { + TgeneAccountForDebit obj = pEntityManager.find(TgeneAccountForDebit.class, pKey); + return obj; + } + /** + * Entrega la Clave primaria de TgeneAccountForDebit + * + * @return El objeto que referencia a la Clave primaria de TgeneAccountForDebit + */ + public TgeneAccountForDebitKey getPk() { + return pk; + } + /** + * Fija un nuevo valor a la Clave primaria de TgeneAccountForDebit + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountForDebit + */ + public void setPk(TgeneAccountForDebitKey pPk) { + pk = pPk; + } + /** + * Obtiene el valor de debitaccount + * + * @return valor de debitaccount + */ + public String getDebitaccount() { + return debitaccount; + } + /** + * Fija el valor de debitaccount + * + * @param pDebitaccount nuevo Valor de debitaccount + */ + public void setDebitaccount(String pDebitaccount) { + debitaccount = pDebitaccount; + } + + /** + * Obtiene el valor de debitaccountingcode + * + * @return valor de debitaccountingcode + */ + public String getDebitaccountingcode() { + return debitaccountingcode; + } + /** + * Fija el valor de debitaccountingcode + * + * @param pDebitaccountingcode nuevo Valor de debitaccountingcode + */ + public void setDebitaccountingcode(String pDebitaccountingcode) { + debitaccountingcode = pDebitaccountingcode; + } + + /** + * Obtiene el valor de currency + * + * @return valor de currency + */ + public String getCurrency() { + return currency; + } + /** + * Fija el valor de currency + * + * @param pCurrency nuevo Valor de currency + */ + public void setCurrency(String pCurrency) { + currency = pCurrency; + } + + /** + * Obtiene el valor de value + * + * @return valor de value + */ + public BigDecimal getValue() { + return value; + } + /** + * Fija el valor de value + * + * @param pValue nuevo Valor de value + */ + public void setValue(BigDecimal pValue) { + value = pValue; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneAccountForDebit)) + return false; + TgeneAccountForDebit that = (TgeneAccountForDebit) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /** + * Implementacin del metodo hashCode de la la entidad TgeneAccountForDebit + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + /** Implementacin de la creacin de un bean en blanco TgeneAccountForDebit */ + public Object createInstance() { + TgeneAccountForDebit instance = new TgeneAccountForDebit(); + instance.setPk(new TgeneAccountForDebitKey()); + return instance; + } + /** + * Clona la entidad TgeneAccountForDebit + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneAccountForDebit p = (TgeneAccountForDebit) this.clone(); + p.setPk((TgeneAccountForDebitKey) this.pk.cloneMe()); + return p; + } + + //Metodos manuales + /** Sentencia que devuelve datos de la tabla TgeneAccountForDebit.*/ + private static final String HQL_ACCOUNT_FOR_DEBIT = + "from TgeneAccountForDebit tafd " + + " where tafd.pk.account = :account "+ + " and tafd.pk.company = :company "; + + /** + * Entrega datos de cuentas a debitar para cancelar el valor de la cuneta. + * @param pAccount Numero de cuenta. + * @param pCompany Codigo de compania. + * @return List + * @throws Exception + */ + @SuppressWarnings(Constant.VUNCHECKED) + public static List find(EntityManager pEntityManager, + String pAccount,Integer pCompany) throws Exception { + List ldebits = null; + Query qry = pEntityManager.createQuery(HQL_ACCOUNT_FOR_DEBIT); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + ldebits = qry.getResultList(); + return ldebits; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountForDebitKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountForDebitKey.java new file mode 100644 index 0000000..a400089 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountForDebitKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTFORDEBIT*/ +@Embeddable +public class TgeneAccountForDebitKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertenece la cuenta. +*/ +private Integer company; + +@Column(name="DEBITSEQUENCE", nullable=false,updatable=false) + +/** +* Sequencia de debito. +*/ +private Integer debitsequence; + +/**Contructor por defecto*/ +public TgeneAccountForDebitKey(){} +/**Contructor de TgeneAccountForDebitKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertenece la cuenta. +@param pDebitsequence Sequencia de debito. +*/ +public TgeneAccountForDebitKey(String pAccount,Integer pCompany,Integer pDebitsequence){ + account=pAccount; + company=pCompany; + debitsequence=pDebitsequence; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de debitsequence +@return valor de debitsequence*/ +public Integer getDebitsequence(){ + return debitsequence; +} +/**Fija el valor de debitsequence +@param pDebitsequence nuevo Valor de debitsequence*/ +public void setDebitsequence(Integer pDebitsequence){ + debitsequence=pDebitsequence; +} + +/**Implementacin de la comparacin de TgeneAccountForDebitKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountForDebitKey))return false; + TgeneAccountForDebitKey that = (TgeneAccountForDebitKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getDebitsequence() == null || that.getDebitsequence() == null){ + return false; + } + if (! this.getDebitsequence().equals(that.getDebitsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountForDebitKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getDebitsequence() == null ? 0 : this.getDebitsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountKey.java new file mode 100644 index 0000000..2fb6440 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountKey.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pgeneral.acco; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNT*/ +@Embeddable +public class TgeneAccountKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro con datos de la cuenta. +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TgeneAccountKey(){} +/**Contructor de TgeneAccountKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pDateto Fecha hasta la cual esta vigente el registro con datos de la cuenta. +*/ +public TgeneAccountKey(String pAccount,Integer pCompany,Timestamp pDateto){ + account=pAccount; + company=pCompany; + dateto=pDateto; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TgeneAccountKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountKey))return false; + TgeneAccountKey that = (TgeneAccountKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountLiquidation.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountLiquidation.java new file mode 100644 index 0000000..31fe675 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountLiquidation.java @@ -0,0 +1,332 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTLIQUIDATION*/ +@Entity(name="TgeneAccountLiquidation") +@Table(name="TGENEACCOUNTLIQUIDATION") +public class TgeneAccountLiquidation extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountLiquidation +*/ +@EmbeddedId +private TgeneAccountLiquidationKey pk; +@Column(name="BASEAMOUNTBALANCETYPE", nullable=true) + +/** +* Tipo de saldo del cual se toma el monto para calcular el tarifario. +*/ +private String baseamountbalancetype; + +@Column(name="BASEAMOUNTBALANCEGROUP", nullable=true) + +/** +* Grupo de balance del tipo de saldo del cual se toma el monto para calcular el tarifario. +*/ +private String baseamountbalancegroup; + +@Column(name="CALCULATEORDER", nullable=true) + +/** +* CALCULATEORDER +*/ +private Integer calculateorder; + +@Column(name="NEGOTIABLE", nullable=true) + +/** +* Indica si la tasa se puede negociar con el cliente el valor y las condiciones del cargo +*/ +private String negotiable; + +@Column(name="INCREASE", nullable=true) + +/** +* Indica que incrementa el valor de capital con el cual se genera la tabla de pagos +*/ +private String increase; + +@Column(name="DECREASE", nullable=true) + +/** +* Indica que disminuye el valor de capital con el cual se genera la tabla de pagos +*/ +private String decrease; + +@Column(name="DECREASEDISBURSEMENT", nullable=true) + +/** +* Indica que el valor del cargo se descuenta del monto a entregar al cliente +*/ +private String decreasedisbursement; + +@Column(name="CASH", nullable=true) + +/** +* Indica que el valor se cobra en efectivo. +*/ +private String cash; + +@Column(name="DEBITACCOUNT", nullable=true) + +/** +* Indica que el valor se cobra con debito a una cuneta, esta puede ser cuenta contable o cuenta a la vista +*/ +private String debitaccount; + +@Column(name="VALUE", nullable=true) + +/** +* Valor del cargo en la moneda de la operacion +*/ +private BigDecimal value; + +/**Contructor por defecto*/ +public TgeneAccountLiquidation(){ +} +/**Contructor de TgeneAccountLiquidation +@param pPk Clave Primaria del entity +*/ +public TgeneAccountLiquidation(TgeneAccountLiquidationKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountLiquidation +*/ +public static TgeneAccountLiquidation find(EntityManager pEntityManager,TgeneAccountLiquidationKey pKey) throws Exception{ + TgeneAccountLiquidation obj = pEntityManager.find(TgeneAccountLiquidation.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountLiquidation +@return El objeto que referencia a la Clave primaria de TgeneAccountLiquidation +*/ +public TgeneAccountLiquidationKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountLiquidation +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountLiquidation +*/ +public void setPk(TgeneAccountLiquidationKey pPk){ + pk=pPk; +} +/**Obtiene el valor de baseamountbalancetype +@return valor de baseamountbalancetype*/ +public String getBaseamountbalancetype(){ + return baseamountbalancetype; +} +/**Fija el valor de baseamountbalancetype +@param pBaseamountbalancetype nuevo Valor de baseamountbalancetype*/ +public void setBaseamountbalancetype(String pBaseamountbalancetype){ + baseamountbalancetype=pBaseamountbalancetype; +} + +/**Obtiene el valor de baseamountbalancegroup +@return valor de baseamountbalancegroup*/ +public String getBaseamountbalancegroup(){ + return baseamountbalancegroup; +} +/**Fija el valor de baseamountbalancegroup +@param pBaseamountbalancegroup nuevo Valor de baseamountbalancegroup*/ +public void setBaseamountbalancegroup(String pBaseamountbalancegroup){ + baseamountbalancegroup=pBaseamountbalancegroup; +} + +/**Obtiene el valor de calculateorder +@return valor de calculateorder*/ +public Integer getCalculateorder(){ + return calculateorder; +} +/**Fija el valor de calculateorder +@param pCalculateorder nuevo Valor de calculateorder*/ +public void setCalculateorder(Integer pCalculateorder){ + calculateorder=pCalculateorder; +} + +/**Obtiene el valor de negotiable +@return valor de negotiable*/ +public String getNegotiable(){ + return negotiable; +} +/**Fija el valor de negotiable +@param pNegotiable nuevo Valor de negotiable*/ +public void setNegotiable(String pNegotiable){ + negotiable=pNegotiable; +} + +/**Obtiene el valor de increase +@return valor de increase*/ +public String getIncrease(){ + return increase; +} +/**Fija el valor de increase +@param pIncrease nuevo Valor de increase*/ +public void setIncrease(String pIncrease){ + increase=pIncrease; +} + +/**Obtiene el valor de decrease +@return valor de decrease*/ +public String getDecrease(){ + return decrease; +} +/**Fija el valor de decrease +@param pDecrease nuevo Valor de decrease*/ +public void setDecrease(String pDecrease){ + decrease=pDecrease; +} + +/**Obtiene el valor de decreasedisbursement +@return valor de decreasedisbursement*/ +public String getDecreasedisbursement(){ + return decreasedisbursement; +} +/**Fija el valor de decreasedisbursement +@param pDecreasedisbursement nuevo Valor de decreasedisbursement*/ +public void setDecreasedisbursement(String pDecreasedisbursement){ + decreasedisbursement=pDecreasedisbursement; +} + +/**Obtiene el valor de cash +@return valor de cash*/ +public String getCash(){ + return cash; +} +/**Fija el valor de cash +@param pCash nuevo Valor de cash*/ +public void setCash(String pCash){ + cash=pCash; +} + +/**Obtiene el valor de debitaccount +@return valor de debitaccount*/ +public String getDebitaccount(){ + return debitaccount; +} +/**Fija el valor de debitaccount +@param pDebitaccount nuevo Valor de debitaccount*/ +public void setDebitaccount(String pDebitaccount){ + debitaccount=pDebitaccount; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountLiquidation))return false; + TgeneAccountLiquidation that = (TgeneAccountLiquidation) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountLiquidation +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountLiquidation +*/ +public Object createInstance(){ + TgeneAccountLiquidation instance=new TgeneAccountLiquidation(); + instance.setPk(new TgeneAccountLiquidationKey()); + return instance; +} +/**Clona la entidad TgeneAccountLiquidation +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountLiquidation p=(TgeneAccountLiquidation)this.clone(); + p.setPk((TgeneAccountLiquidationKey)this.pk.cloneMe()); + return p; +} + + //Metodos manuales. + /**Sentencia que devuelve uan lista de cargos de liquidacion asociados a una cuenta.*/ + private static final String HQL_ACCO_LIQUIDATION = + " from TgeneAccountLiquidation t " + + " where t.pk.account = :account "+ + " and t.pk.company = :company "; + + /** + * Metodo que entrega una lista de valores a entregar al cliente, en la aperturad e una operacion. + * @param pAccount Numero de cuenta. + * @param pCompany Codigo de compania a la que pertenece la cuenta. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, + String pAccount,Integer pCompany) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_ACCO_LIQUIDATION); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountLiquidationKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountLiquidationKey.java new file mode 100644 index 0000000..9ab8d1c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountLiquidationKey.java @@ -0,0 +1,313 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTLIQUIDATION*/ +@Embeddable +public class TgeneAccountLiquidationKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. de valores a cobrar en la liquidacion de una operacion +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +/**Contructor por defecto*/ +public TgeneAccountLiquidationKey(){} +/**Contructor de TgeneAccountLiquidationKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pStatuscode Estatus de cuenta +@param pCurrencycode Codigo de moneda +@param pBalancetype Cdigo de tipo de saldo. de valores a cobrar en la liquidacion de una operacion +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +public TgeneAccountLiquidationKey(String pAccount,Integer pCompany,String pModulecode,String pProductcode,String pSubproductcode,String pStatuscode,String pCurrencycode,String pBalancetype,String pBalancegroup){ + account=pAccount; + company=pCompany; + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + statuscode=pStatuscode; + currencycode=pCurrencycode; + balancetype=pBalancetype; + balancegroup=pBalancegroup; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Implementacin de la comparacin de TgeneAccountLiquidationKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountLiquidationKey))return false; + TgeneAccountLiquidationKey that = (TgeneAccountLiquidationKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountLiquidationKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountLocalHold.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountLocalHold.java new file mode 100644 index 0000000..ca7d3a3 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountLocalHold.java @@ -0,0 +1,521 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTLOCALHOLD */ +@Entity(name = "TgeneAccountLocalHold") +@Table(name = "TGENEACCOUNTLOCALHOLD") +public class TgeneAccountLocalHold extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneAccountLocalHold + */ + @EmbeddedId + private TgeneAccountLocalHoldKey pk; + + @Column(name = "ACCOUNTMODULE", nullable = true) + /** + * Codigo de modulo al que pertenece la cuenta depositada. + */ + private String accountmodule; + + @Column(name = "OFFICECODE", nullable = true) + /** + * Codigo de oficina + */ + private Integer officecode; + + @Column(name = "BRANCHCODE", nullable = true) + /** + * Codigo de sucursal + */ + private Integer branchcode; + + @Column(name = "ACCOUNTINGDATE", nullable = true) + /** + * Fecha contable con la cual se crea el registro de cheques locales + */ + private Date accountingdate; + + @Column(name = "OWNACCOUNT", nullable = true) + /** + * Numero de cuenta duenia del cheque + */ + private String ownaccount; + + @Column(name = "CHECKNUMBER", nullable = true) + /** + * Numero de cheque + */ + private Integer checknumber; + + @Column(name = "CHECKVALUE", nullable = true) + /** + * Valor del cheque, si no existe numero de cheque y el deposito se recibe cheque es el valor total de cheques. + */ + private BigDecimal checkvalue; + + @Column(name = "TRANSITROUTE", nullable = true) + /** + * Codigo de ruta transito asociada al cheque + */ + private String transitroute; + + @Column(name = "DATETORELEASE", nullable = true) + /** + * Fecha en la que se tiene que confirma los fondos en la cuenta depositada. + */ + private Date datetorelease; + + @Column(name = "RELEASED", nullable = true) + /** + * Y indica que el cheque esta confirmado. + */ + private String released; + + @Column(name = "RELEASEDDATE", nullable = true) + /** + * Fecha de confirmacion de fondos en la cuenta depositada + */ + private Date releaseddate; + + @Column(name = "RETURNED", nullable = true) + /** + * Indica, si el cheque esta devuelto. + */ + private String returned; + + @Column(name = "RETURNEDDATE", nullable = true) + /** + * Fecha en la que se devolvio el cheque. + */ + private Date returneddate; + + @Column(name = "JOURNALID", nullable = true) + /** + * Numero de mensaje con el que se registra los datos del cheque + */ + private String journalid; + + /** Contructor por defecto */ + public TgeneAccountLocalHold() { + } + + /** + * Contructor de TgeneAccountLocalHold + * + * @param pPk Clave Primaria del entity + */ + public TgeneAccountLocalHold(TgeneAccountLocalHoldKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneAccountLocalHold + */ + public static TgeneAccountLocalHold find(EntityManager pEntityManager, TgeneAccountLocalHoldKey pKey) throws Exception { + TgeneAccountLocalHold obj = pEntityManager.find(TgeneAccountLocalHold.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneAccountLocalHold + * + * @return El objeto que referencia a la Clave primaria de TgeneAccountLocalHold + */ + public TgeneAccountLocalHoldKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneAccountLocalHold + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountLocalHold + */ + public void setPk(TgeneAccountLocalHoldKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de accountmodule + * + * @return valor de accountmodule + */ + public String getAccountmodule() { + return this.accountmodule; + } + + /** + * Fija el valor de accountmodule + * + * @param pAccountmodule nuevo Valor de accountmodule + */ + public void setAccountmodule(String pAccountmodule) { + this.accountmodule = pAccountmodule; + } + + /** + * Obtiene el valor de officecode + * + * @return valor de officecode + */ + public Integer getOfficecode() { + return this.officecode; + } + + /** + * Fija el valor de officecode + * + * @param pOfficecode nuevo Valor de officecode + */ + public void setOfficecode(Integer pOfficecode) { + this.officecode = pOfficecode; + } + + /** + * Obtiene el valor de branchcode + * + * @return valor de branchcode + */ + public Integer getBranchcode() { + return this.branchcode; + } + + /** + * Fija el valor de branchcode + * + * @param pBranchcode nuevo Valor de branchcode + */ + public void setBranchcode(Integer pBranchcode) { + this.branchcode = pBranchcode; + } + + /** + * Obtiene el valor de accountingdate + * + * @return valor de accountingdate + */ + public Date getAccountingdate() { + return this.accountingdate; + } + + /** + * Fija el valor de accountingdate + * + * @param pAccountingdate nuevo Valor de accountingdate + */ + public void setAccountingdate(Date pAccountingdate) { + this.accountingdate = pAccountingdate; + } + + /** + * Obtiene el valor de ownaccount + * + * @return valor de ownaccount + */ + public String getOwnaccount() { + return this.ownaccount; + } + + /** + * Fija el valor de ownaccount + * + * @param pOwnaccount nuevo Valor de ownaccount + */ + public void setOwnaccount(String pOwnaccount) { + this.ownaccount = pOwnaccount; + } + + /** + * Obtiene el valor de checknumber + * + * @return valor de checknumber + */ + public Integer getChecknumber() { + return this.checknumber; + } + + /** + * Fija el valor de checknumber + * + * @param pChecknumber nuevo Valor de checknumber + */ + public void setChecknumber(Integer pChecknumber) { + this.checknumber = pChecknumber; + } + + /** + * Obtiene el valor de checkvalue + * + * @return valor de checkvalue + */ + public BigDecimal getCheckvalue() { + return this.checkvalue; + } + + /** + * Fija el valor de checkvalue + * + * @param pCheckvalue nuevo Valor de checkvalue + */ + public void setCheckvalue(BigDecimal pCheckvalue) { + this.checkvalue = pCheckvalue; + } + + /** + * Obtiene el valor de transitroute + * + * @return valor de transitroute + */ + public String getTransitroute() { + return this.transitroute; + } + + /** + * Fija el valor de transitroute + * + * @param pTransitroute nuevo Valor de transitroute + */ + public void setTransitroute(String pTransitroute) { + this.transitroute = pTransitroute; + } + + /** + * Obtiene el valor de datetorelease + * + * @return valor de datetorelease + */ + public Date getDatetorelease() { + return this.datetorelease; + } + + /** + * Fija el valor de datetorelease + * + * @param pDatetorelease nuevo Valor de datetorelease + */ + public void setDatetorelease(Date pDatetorelease) { + this.datetorelease = pDatetorelease; + } + + /** + * Obtiene el valor de released + * + * @return valor de released + */ + public String getReleased() { + return this.released; + } + + /** + * Fija el valor de released + * + * @param pReleased nuevo Valor de released + */ + public void setReleased(String pReleased) { + this.released = pReleased; + } + + /** + * Obtiene el valor de releaseddate + * + * @return valor de releaseddate + */ + public Date getReleaseddate() { + return this.releaseddate; + } + + /** + * Fija el valor de releaseddate + * + * @param pReleaseddate nuevo Valor de releaseddate + */ + public void setReleaseddate(Date pReleaseddate) { + this.releaseddate = pReleaseddate; + } + + /** + * Obtiene el valor de returned + * + * @return valor de returned + */ + public String getReturned() { + return this.returned; + } + + /** + * Fija el valor de returned + * + * @param pReturned nuevo Valor de returned + */ + public void setReturned(String pReturned) { + this.returned = pReturned; + } + + /** + * Obtiene el valor de returneddate + * + * @return valor de returneddate + */ + public Date getReturneddate() { + return this.returneddate; + } + + /** + * Fija el valor de returneddate + * + * @param pReturneddate nuevo Valor de returneddate + */ + public void setReturneddate(Date pReturneddate) { + this.returneddate = pReturneddate; + } + + /** + * Obtiene el valor de journalid + * + * @return valor de journalid + */ + public String getJournalid() { + return this.journalid; + } + + /** + * Fija el valor de journalid + * + * @param pJournalid nuevo Valor de journalid + */ + public void setJournalid(String pJournalid) { + this.journalid = pJournalid; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneAccountLocalHold)) { + return false; + } + TgeneAccountLocalHold that = (TgeneAccountLocalHold) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneAccountLocalHold + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneAccountLocalHold */ + @Override + public Object createInstance() { + TgeneAccountLocalHold instance = new TgeneAccountLocalHold(); + instance.setPk(new TgeneAccountLocalHoldKey()); + return instance; + } + + /** + * Clona la entidad TgeneAccountLocalHold + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneAccountLocalHold p = (TgeneAccountLocalHold) this.clone(); + p.setPk((TgeneAccountLocalHoldKey) this.pk.cloneMe()); + return p; + } + + // METODOS MANUALES + /** Sentencia que entrega los datos de un registro de TgeneAccountLocalHold, dado un numero de mensaje. */ + private static final String JPQL_LOCAL_HOLD = "from TgeneAccountLocalHold t " + " where t.journalid = :journalid "; + + /** + * Metodo que entrega datos de TgeneAccountLocalHold dado un numero de mensaje. + * + * @param pEntityManager Session de la base de datos. + * @param pJournalid Numero de mensaje a obtener TgeneAccountLocalHold. + * @return TgeneAccountLocalHold + * @throws Exception + */ + public static TgeneAccountLocalHold findByJournalId(EntityManager pEntityManager, String pJournalid) throws Exception { + Query qry = pEntityManager.createQuery(TgeneAccountLocalHold.JPQL_LOCAL_HOLD); + qry.setParameter("journalid", pJournalid); + try { + return (TgeneAccountLocalHold) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountLocalHoldKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountLocalHoldKey.java new file mode 100644 index 0000000..8a78100 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountLocalHoldKey.java @@ -0,0 +1,179 @@ +package com.fp.persistence.pgeneral.acco; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTLOCALHOLD*/ +@Embeddable +public class TgeneAccountLocalHoldKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="PARTITIONDB", nullable=false,updatable=false) + +/** +* Y, Indica que el registro se encuentra en una particion vigente, N el registro no esta en la particion vigente. +*/ +private String partitiondb; + +@Column(name="REALDATE", nullable=true, insertable=false) + +/** +* Fecha real de carga de registro +*/ +private Timestamp realdate; + +/**Contructor por defecto*/ +public TgeneAccountLocalHoldKey(){} +/**Contructor de TgeneAccountLocalHoldKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pPartitiondb Y, Indica que el registro se encuentra en una particion vigente, N el registro no esta en la particion vigente. +@param pRealdate Fecha real de carga de registro +*/ +public TgeneAccountLocalHoldKey(String pAccount,Integer pCompany,String pPartitiondb,Timestamp pRealdate){ + account=pAccount; + company=pCompany; + partitiondb=pPartitiondb; + realdate=pRealdate; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de partitiondb +@return valor de partitiondb*/ +public String getPartitiondb(){ + return partitiondb; +} +/**Fija el valor de partitiondb +@param pPartitiondb nuevo Valor de partitiondb*/ +public void setPartitiondb(String pPartitiondb){ + partitiondb=pPartitiondb; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Timestamp getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Timestamp pRealdate){ + realdate=pRealdate; +} + +/**Implementacin de la comparacin de TgeneAccountLocalHoldKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountLocalHoldKey))return false; + TgeneAccountLocalHoldKey that = (TgeneAccountLocalHoldKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getPartitiondb() == null || that.getPartitiondb() == null){ + return false; + } + if (! this.getPartitiondb().equals(that.getPartitiondb())){ + return false; + } + if (this.getRealdate() == null || that.getRealdate() == null){ + return false; + } + if (! this.getRealdate().equals(that.getRealdate())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountLocalHoldKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getPartitiondb() == null ? 0 : this.getPartitiondb().hashCode()); + result = result * 37 + (this.getRealdate() == null ? 0 : this.getRealdate().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountNumber.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountNumber.java new file mode 100644 index 0000000..cb3fdbe --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountNumber.java @@ -0,0 +1,213 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.LockModeType; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.common.exception.CommonException; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTNUMBER*/ +@Entity(name="TgeneAccountNumber") +@Table(name="TGENEACCOUNTNUMBER") +public class TgeneAccountNumber extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountNumber +*/ +@EmbeddedId +private TgeneAccountNumberKey pk; +@Column(name="PRODUCTCODE", nullable=true) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="CURRENCYCODE", nullable=true) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="ACCOUNTNUMBER", nullable=false) + +/** +* Consecutivo de cuenta +*/ +private String accountnumber; + +/**Contructor por defecto*/ +public TgeneAccountNumber(){ +} +/**Contructor de TgeneAccountNumber +@param pPk Clave Primaria del entity +@param pAccountnumber Consecutivo de cuenta +*/ +public TgeneAccountNumber(TgeneAccountNumberKey pPk,String pAccountnumber){ + this(); + pk=pPk; + accountnumber=pAccountnumber; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountNumber +*/ +public static TgeneAccountNumber find(EntityManager pEntityManager,TgeneAccountNumberKey pKey) throws Exception{ + TgeneAccountNumber obj = pEntityManager.find(TgeneAccountNumber.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountNumber +@return El objeto que referencia a la Clave primaria de TgeneAccountNumber +*/ +public TgeneAccountNumberKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountNumber +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountNumber +*/ +public void setPk(TgeneAccountNumberKey pPk){ + pk=pPk; +} +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de accountnumber +@return valor de accountnumber*/ +public String getAccountnumber(){ + return accountnumber; +} +/**Fija el valor de accountnumber +@param pAccountnumber nuevo Valor de accountnumber*/ +public void setAccountnumber(String pAccountnumber){ + accountnumber=pAccountnumber; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountNumber))return false; + TgeneAccountNumber that = (TgeneAccountNumber) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountNumber +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountNumber +*/ +public Object createInstance(){ + TgeneAccountNumber instance=new TgeneAccountNumber(); + instance.setPk(new TgeneAccountNumberKey()); + return instance; +} +/**Clona la entidad TgeneAccountNumber +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountNumber p=(TgeneAccountNumber)this.clone(); + p.setPk((TgeneAccountNumberKey)this.pk.cloneMe()); + return p; +} + + //METODOS MANUALES + /**Sentencia que obtiene un registro de TgeneAccountNumber con la secuencia de numeros de cuenta.*/ + private static final String HQL = "from com.fp.persistence.pgeneral.acco.TgeneAccountNumber t "+ + " where t.pk.modulecode = :modulecode "+ + " and coalesce(productcode,:productcode) = :productcode "+ + " and coalesce(currencycode,:currencycode) = :currencycode "; + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pModule Codigo de modulo + * @param pProduct Codigo de producto + * @param pCurrency Codigo de moneda + * @return TgeneAccountNumber + */ + public static TgeneAccountNumber findWithhold(EntityManager pEntityManager,String pModule, + String pProduct,String pCurrency) throws Exception{ + TgeneAccountNumber tgeneAccountNumber = null; + Query qry = pEntityManager.createQuery(HQL); + qry.setParameter("modulecode", pModule); + qry.setParameter("productcode", pProduct); + qry.setParameter("currencycode", pCurrency); + qry.setLockMode(LockModeType.PESSIMISTIC_READ); + tgeneAccountNumber = (TgeneAccountNumber)qry.getSingleResult(); + if(tgeneAccountNumber == null){ + throw new CommonException("CORE-0025","SECUENCIA DE CUENTA NO DEFINIDA EN TGENEACCOUNTNUMBER MODULO: {}",pModule); + } + return tgeneAccountNumber; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountNumberKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountNumberKey.java new file mode 100644 index 0000000..46d628b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountNumberKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTNUMBER*/ +@Embeddable +public class TgeneAccountNumberKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="ACCOUNTSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia +*/ +private String accountsequence; + +/**Contructor por defecto*/ +public TgeneAccountNumberKey(){} +/**Contructor de TgeneAccountNumberKey +@param pModulecode Codigo de modulo +@param pAccountsequence Secuencia +*/ +public TgeneAccountNumberKey(String pModulecode,String pAccountsequence){ + modulecode=pModulecode; + accountsequence=pAccountsequence; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de accountsequence +@return valor de accountsequence*/ +public String getAccountsequence(){ + return accountsequence; +} +/**Fija el valor de accountsequence +@param pAccountsequence nuevo Valor de accountsequence*/ +public void setAccountsequence(String pAccountsequence){ + accountsequence=pAccountsequence; +} + +/**Implementacin de la comparacin de TgeneAccountNumberKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountNumberKey))return false; + TgeneAccountNumberKey that = (TgeneAccountNumberKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getAccountsequence() == null || that.getAccountsequence() == null){ + return false; + } + if (! this.getAccountsequence().equals(that.getAccountsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountNumberKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getAccountsequence() == null ? 0 : this.getAccountsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountPayable.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountPayable.java new file mode 100644 index 0000000..fd706a8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountPayable.java @@ -0,0 +1,210 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTPAYABLE */ +@Entity(name = "TgeneAccountPayable") +@Table(name = "TGENEACCOUNTPAYABLE") +public class TgeneAccountPayable extends com.fp.dto.AbstractDataBalanceTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneAccountPayable + */ + @EmbeddedId + private TgeneAccountPayableKey pk; + + @Column(name = "BALANCE", nullable = true) + /** + * Saldo de la cuenta por pagar. + */ + private BigDecimal balance; + + /** Contructor por defecto */ + public TgeneAccountPayable() { + } + + /** + * Contructor de TgeneAccountPayable + * + * @param pPk Clave Primaria del entity + */ + public TgeneAccountPayable(TgeneAccountPayableKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneAccountPayable + */ + public static TgeneAccountPayable find(EntityManager pEntityManager, TgeneAccountPayableKey pKey) throws Exception { + TgeneAccountPayable obj = pEntityManager.find(TgeneAccountPayable.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneAccountPayable + * + * @return El objeto que referencia a la Clave primaria de TgeneAccountPayable + */ + public TgeneAccountPayableKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneAccountPayable + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountPayable + */ + public void setPk(TgeneAccountPayableKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de balance + * + * @return valor de balance + */ + public BigDecimal getBalance() { + return this.balance; + } + + /** + * Fija el valor de balance + * + * @param pBalance nuevo Valor de balance + */ + public void setBalance(BigDecimal pBalance) { + this.balance = pBalance; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneAccountPayable)) { + return false; + } + TgeneAccountPayable that = (TgeneAccountPayable) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneAccountPayable + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneAccountPayable */ + @Override + public Object createInstance() { + TgeneAccountPayable instance = new TgeneAccountPayable(); + instance.setPk(new TgeneAccountPayableKey()); + return instance; + } + + /** + * Clona la entidad TgeneAccountPayable + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneAccountPayable p = (TgeneAccountPayable) this.clone(); + p.setPk((TgeneAccountPayableKey) this.pk.cloneMe()); + return p; + } + + // METODOS MANUALES + /** Sentencia que devuelve saldos de cuentas por pagar. */ + private static final String JPQL_PAYABLE = "from TgeneAccountPayable t " + " where t.pk.account = :account " + " and t.pk.company = :company "; + + /** + * Entrega un registro de saldos de cuentas por pagar. + * + * @param pEntityManager Session de la base de datos. + * @param pAccount Numero de cuenta. + * @param pCompany Codigo de compania a la que pertenece la cuenta. + * @return TgeneAccountPayable + * @throws Exception + */ + public static TgeneAccountPayable findByAccountNumber(EntityManager pEntityManager, String pAccount, Integer pCompany) throws Exception { + Query qry = pEntityManager.createQuery(TgeneAccountPayable.JPQL_PAYABLE); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + try { + return (TgeneAccountPayable) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountPayableKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountPayableKey.java new file mode 100644 index 0000000..50b3689 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountPayableKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTPAYABLE*/ +@Embeddable +public class TgeneAccountPayableKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta por pagar. +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertenece la cuenta. +*/ +private Integer company; + +/**Contructor por defecto*/ +public TgeneAccountPayableKey(){} +/**Contructor de TgeneAccountPayableKey +@param pAccount Numero de cuenta por pagar. +@param pCompany Codigo de compania a la que pertenece la cuenta. +*/ +public TgeneAccountPayableKey(String pAccount,Integer pCompany){ + account=pAccount; + company=pCompany; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Implementacin de la comparacin de TgeneAccountPayableKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountPayableKey))return false; + TgeneAccountPayableKey that = (TgeneAccountPayableKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountPayableKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountRemittanceHold.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountRemittanceHold.java new file mode 100644 index 0000000..78d1328 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountRemittanceHold.java @@ -0,0 +1,376 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTREMITTANCEHOLD*/ +@Entity(name="TgeneAccountRemittanceHold") +@Table(name="TGENEACCOUNTREMITTANCEHOLD") +public class TgeneAccountRemittanceHold extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountRemittanceHold +*/ +@EmbeddedId +private TgeneAccountRemittanceHoldKey pk; +@Column(name="REMITTANCENUMBER", nullable=true) + +/** +* Numero de carta remesa +*/ +private String remittancenumber; + +@Column(name="OFFICECODE", nullable=true) + +/** +* Codigo de oficina +*/ +private Integer officecode; + +@Column(name="BRANCHCODE", nullable=true) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="ACCOUNTINGDATE", nullable=true) + +/** +* Fecha contable con la cual se crea el registro de cheques locales +*/ +private Date accountingdate; + +@Column(name="OWNACCOUNT", nullable=true) + +/** +* Numero de cuenta duenia del cheque +*/ +private String ownaccount; + +@Column(name="CHECKNUMBER", nullable=true) + +/** +* Numero de cheque +*/ +private Integer checknumber; + +@Column(name="CHECKVALUE", nullable=true) + +/** +* Valor del cheque, si no existe numero de cheque y el deposito se recibe cheque es el valor total de cheques. +*/ +private BigDecimal checkvalue; + +@Column(name="TRANSITROUTE", nullable=true) + +/** +* Codigo de ruta transito asociada al cheque +*/ +private String transitroute; + +@Column(name="DATETORELEASE", nullable=true) + +/** +* Fecha en la que se tiene que confirma los fondos en la cuenta depositada. +*/ +private Date datetorelease; + +@Column(name="RELEASE", nullable=true) + +/** +* Y indica que el cheque esta confirmado. +*/ +private String release; + +@Column(name="RELEASEDATE", nullable=true) + +/** +* Fecha de confirmacion de fondos en la cuenta depositada +*/ +private Date releasedate; + +@Column(name="RETURNED", nullable=true) + +/** +* Indica, si el cheque esta devuelto. +*/ +private String returned; + +@Column(name="RETURNEDDATE", nullable=true) + +/** +* Fecha en la que se devolvio el cheque. +*/ +private Date returneddate; + +@Column(name="JOURNALID", nullable=true) + +/** +* Numero de mensaje con el que se registra los datos del cheque +*/ +private String journalid; + +/**Contructor por defecto*/ +public TgeneAccountRemittanceHold(){ +} +/**Contructor de TgeneAccountRemittanceHold +@param pPk Clave Primaria del entity +*/ +public TgeneAccountRemittanceHold(TgeneAccountRemittanceHoldKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountRemittanceHold +*/ +public static TgeneAccountRemittanceHold find(EntityManager pEntityManager,TgeneAccountRemittanceHoldKey pKey) throws Exception{ + TgeneAccountRemittanceHold obj = pEntityManager.find(TgeneAccountRemittanceHold.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountRemittanceHold +@return El objeto que referencia a la Clave primaria de TgeneAccountRemittanceHold +*/ +public TgeneAccountRemittanceHoldKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountRemittanceHold +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountRemittanceHold +*/ +public void setPk(TgeneAccountRemittanceHoldKey pPk){ + pk=pPk; +} +/**Obtiene el valor de remittancenumber +@return valor de remittancenumber*/ +public String getRemittancenumber(){ + return remittancenumber; +} +/**Fija el valor de remittancenumber +@param pRemittancenumber nuevo Valor de remittancenumber*/ +public void setRemittancenumber(String pRemittancenumber){ + remittancenumber=pRemittancenumber; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de accountingdate +@return valor de accountingdate*/ +public Date getAccountingdate(){ + return accountingdate; +} +/**Fija el valor de accountingdate +@param pAccountingdate nuevo Valor de accountingdate*/ +public void setAccountingdate(Date pAccountingdate){ + accountingdate=pAccountingdate; +} + +/**Obtiene el valor de ownaccount +@return valor de ownaccount*/ +public String getOwnaccount(){ + return ownaccount; +} +/**Fija el valor de ownaccount +@param pOwnaccount nuevo Valor de ownaccount*/ +public void setOwnaccount(String pOwnaccount){ + ownaccount=pOwnaccount; +} + +/**Obtiene el valor de checknumber +@return valor de checknumber*/ +public Integer getChecknumber(){ + return checknumber; +} +/**Fija el valor de checknumber +@param pChecknumber nuevo Valor de checknumber*/ +public void setChecknumber(Integer pChecknumber){ + checknumber=pChecknumber; +} + +/**Obtiene el valor de checkvalue +@return valor de checkvalue*/ +public BigDecimal getCheckvalue(){ + return checkvalue; +} +/**Fija el valor de checkvalue +@param pCheckvalue nuevo Valor de checkvalue*/ +public void setCheckvalue(BigDecimal pCheckvalue){ + checkvalue=pCheckvalue; +} + +/**Obtiene el valor de transitroute +@return valor de transitroute*/ +public String getTransitroute(){ + return transitroute; +} +/**Fija el valor de transitroute +@param pTransitroute nuevo Valor de transitroute*/ +public void setTransitroute(String pTransitroute){ + transitroute=pTransitroute; +} + +/**Obtiene el valor de datetorelease +@return valor de datetorelease*/ +public Date getDatetorelease(){ + return datetorelease; +} +/**Fija el valor de datetorelease +@param pDatetorelease nuevo Valor de datetorelease*/ +public void setDatetorelease(Date pDatetorelease){ + datetorelease=pDatetorelease; +} + +/**Obtiene el valor de release +@return valor de release*/ +public String getRelease(){ + return release; +} +/**Fija el valor de release +@param pRelease nuevo Valor de release*/ +public void setRelease(String pRelease){ + release=pRelease; +} + +/**Obtiene el valor de releasedate +@return valor de releasedate*/ +public Date getReleasedate(){ + return releasedate; +} +/**Fija el valor de releasedate +@param pReleasedate nuevo Valor de releasedate*/ +public void setReleasedate(Date pReleasedate){ + releasedate=pReleasedate; +} + +/**Obtiene el valor de returned +@return valor de returned*/ +public String getReturned(){ + return returned; +} +/**Fija el valor de returned +@param pReturned nuevo Valor de returned*/ +public void setReturned(String pReturned){ + returned=pReturned; +} + +/**Obtiene el valor de returneddate +@return valor de returneddate*/ +public Date getReturneddate(){ + return returneddate; +} +/**Fija el valor de returneddate +@param pReturneddate nuevo Valor de returneddate*/ +public void setReturneddate(Date pReturneddate){ + returneddate=pReturneddate; +} + +/**Obtiene el valor de journalid +@return valor de journalid*/ +public String getJournalid(){ + return journalid; +} +/**Fija el valor de journalid +@param pJournalid nuevo Valor de journalid*/ +public void setJournalid(String pJournalid){ + journalid=pJournalid; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountRemittanceHold))return false; + TgeneAccountRemittanceHold that = (TgeneAccountRemittanceHold) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountRemittanceHold +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountRemittanceHold +*/ +public Object createInstance(){ + TgeneAccountRemittanceHold instance=new TgeneAccountRemittanceHold(); + instance.setPk(new TgeneAccountRemittanceHoldKey()); + return instance; +} +/**Clona la entidad TgeneAccountRemittanceHold +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountRemittanceHold p=(TgeneAccountRemittanceHold)this.clone(); + p.setPk((TgeneAccountRemittanceHoldKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountRemittanceHoldKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountRemittanceHoldKey.java new file mode 100644 index 0000000..107ec07 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountRemittanceHoldKey.java @@ -0,0 +1,179 @@ +package com.fp.persistence.pgeneral.acco; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTREMITTANCEHOLD*/ +@Embeddable +public class TgeneAccountRemittanceHoldKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="PARTITIONDB", nullable=false,updatable=false) + +/** +* Y, Indica que el registro se encuentra en una particion vigente, N el registro no esta en la particion vigente. +*/ +private String partitiondb; + +@Column(name="REALDATE", nullable=true, insertable=false) + +/** +* Fecha real de carga de registro +*/ +private Timestamp realdate; + +/**Contructor por defecto*/ +public TgeneAccountRemittanceHoldKey(){} +/**Contructor de TgeneAccountRemittanceHoldKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pPartitiondb Y, Indica que el registro se encuentra en una particion vigente, N el registro no esta en la particion vigente. +@param pRealdate Fecha real de carga de registro +*/ +public TgeneAccountRemittanceHoldKey(String pAccount,Integer pCompany,String pPartitiondb,Timestamp pRealdate){ + account=pAccount; + company=pCompany; + partitiondb=pPartitiondb; + realdate=pRealdate; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de partitiondb +@return valor de partitiondb*/ +public String getPartitiondb(){ + return partitiondb; +} +/**Fija el valor de partitiondb +@param pPartitiondb nuevo Valor de partitiondb*/ +public void setPartitiondb(String pPartitiondb){ + partitiondb=pPartitiondb; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Timestamp getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Timestamp pRealdate){ + realdate=pRealdate; +} + +/**Implementacin de la comparacin de TgeneAccountRemittanceHoldKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountRemittanceHoldKey))return false; + TgeneAccountRemittanceHoldKey that = (TgeneAccountRemittanceHoldKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getPartitiondb() == null || that.getPartitiondb() == null){ + return false; + } + if (! this.getPartitiondb().equals(that.getPartitiondb())){ + return false; + } + if (this.getRealdate() == null || that.getRealdate() == null){ + return false; + } + if (! this.getRealdate().equals(that.getRealdate())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountRemittanceHoldKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getPartitiondb() == null ? 0 : this.getPartitiondb().hashCode()); + result = result * 37 + (this.getRealdate() == null ? 0 : this.getRealdate().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountSequence.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountSequence.java new file mode 100644 index 0000000..cb7293e --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountSequence.java @@ -0,0 +1,368 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.LockModeType; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.exception.CommonException; +import com.fp.dto.hb.HibernateBean; +import com.fp.general.exception.GeneralException; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTSEQUENCE */ +@Entity(name = "TgeneAccountSequence") +@Table(name = "TGENEACCOUNTSEQUENCE") +public class TgeneAccountSequence extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneAccountSequence + */ + @EmbeddedId + private TgeneAccountSequenceKey pk; + + @Column(name = "PRODUCTCODE", nullable = true) + /** + * Codigo de producto + */ + private String productcode; + + @Column(name = "SUBPRODUCTCODE", nullable = true) + /** + * Codigo de subproducto + */ + private String subproductcode; + + @Column(name = "OFFICECODE", nullable = true) + /** + * Codigo de oficina + */ + private Integer officecode; + + @Column(name = "BRANCHCODE", nullable = true) + /** + * Codigo de sucursal + */ + private Integer branchcode; + + @Column(name = "COMPANYCODE", nullable = true) + /** + * Codigo de compania al que pertenece la oficina + */ + private Integer companycode; + + @Column(name = "SEQUENTIALNUMBER", nullable = false) + /** + * Consecutivo de cuenta + */ + private String sequentialnumber; + + /** Contructor por defecto */ + public TgeneAccountSequence() { + } + + /** + * Contructor de TgeneAccountSequence + * + * @param pPk Clave Primaria del entity + * @param pSequentialnumber Consecutivo de cuenta + */ + public TgeneAccountSequence(TgeneAccountSequenceKey pPk, String pSequentialnumber) { + this(); + this.pk = pPk; + this.sequentialnumber = pSequentialnumber; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneAccountSequence + */ + public static TgeneAccountSequence find(EntityManager pEntityManager, TgeneAccountSequenceKey pKey) throws Exception { + TgeneAccountSequence obj = pEntityManager.find(TgeneAccountSequence.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneAccountSequence + * + * @return El objeto que referencia a la Clave primaria de TgeneAccountSequence + */ + public TgeneAccountSequenceKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneAccountSequence + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountSequence + */ + public void setPk(TgeneAccountSequenceKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de productcode + * + * @return valor de productcode + */ + public String getProductcode() { + return this.productcode; + } + + /** + * Fija el valor de productcode + * + * @param pProductcode nuevo Valor de productcode + */ + public void setProductcode(String pProductcode) { + this.productcode = pProductcode; + } + + /** + * Obtiene el valor de subproductcode + * + * @return valor de subproductcode + */ + public String getSubproductcode() { + return this.subproductcode; + } + + /** + * Fija el valor de subproductcode + * + * @param pSubproductcode nuevo Valor de subproductcode + */ + public void setSubproductcode(String pSubproductcode) { + this.subproductcode = pSubproductcode; + } + + /** + * Obtiene el valor de officecode + * + * @return valor de officecode + */ + public Integer getOfficecode() { + return this.officecode; + } + + /** + * Fija el valor de officecode + * + * @param pOfficecode nuevo Valor de officecode + */ + public void setOfficecode(Integer pOfficecode) { + this.officecode = pOfficecode; + } + + /** + * Obtiene el valor de branchcode + * + * @return valor de branchcode + */ + public Integer getBranchcode() { + return this.branchcode; + } + + /** + * Fija el valor de branchcode + * + * @param pBranchcode nuevo Valor de branchcode + */ + public void setBranchcode(Integer pBranchcode) { + this.branchcode = pBranchcode; + } + + /** + * Obtiene el valor de companycode + * + * @return valor de companycode + */ + public Integer getCompanycode() { + return this.companycode; + } + + /** + * Fija el valor de companycode + * + * @param pCompanycode nuevo Valor de companycode + */ + public void setCompanycode(Integer pCompanycode) { + this.companycode = pCompanycode; + } + + /** + * Obtiene el valor de sequentialnumber + * + * @return valor de sequentialnumber + */ + public String getSequentialnumber() { + return this.sequentialnumber; + } + + /** + * Fija el valor de sequentialnumber + * + * @param pSequentialnumber nuevo Valor de sequentialnumber + */ + public void setSequentialnumber(String pSequentialnumber) { + this.sequentialnumber = pSequentialnumber; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneAccountSequence)) { + return false; + } + TgeneAccountSequence that = (TgeneAccountSequence) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneAccountSequence + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneAccountSequence */ + @Override + public Object createInstance() { + TgeneAccountSequence instance = new TgeneAccountSequence(); + instance.setPk(new TgeneAccountSequenceKey()); + return instance; + } + + /** + * Clona la entidad TgeneAccountSequence + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneAccountSequence p = (TgeneAccountSequence) this.clone(); + p.setPk((TgeneAccountSequenceKey) this.pk.cloneMe()); + return p; + } + + + // METODOS MANUALES + + /** Sentencia que obtiene un registro de TgeneAccountSequence con la secuencia de numeros de cuenta. */ + private static final String HQL = "from TgeneAccountSequence t " + " where t.pk.modulecode = :modulecode " + + " and coalesce(productcode,:productcode) = :productcode " + " and coalesce(subproductcode,:subproductcode) = :subproductcode " + + " and coalesce(officecode,:officecode) = :officecode " + " and coalesce(branchcode,:branchcode) = :branchcode " + + " and coalesce(companycode,:companycode) = :companycode "; + + /** Sentencia que obtiene la cuenta de secuencias en TgeneAccountSequence por modulo. */ + private static final String HQL_SEQ = "select count(t.pk.modulecode) " + " from TgeneAccountSequence t " + " where t.pk.modulecode = :modulecode "; + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pModule Codigo de modulo + * @param pProduct Codigo de producto + * @param pSubproduct Codigo de sub producto + * @param pBranchcode Codigo de sucursal + * @param pOfficecode Codigo de oficina + * @param pCompany Codigo de compania + * @return TgeneAccountSequence + */ + public static TgeneAccountSequence findWithhold(EntityManager pEntityManager, String pModule, String pProduct, String pSubproduct, + Integer pBranch, Integer pOffice, Integer pCompany) throws Exception { + Query qry = pEntityManager.createQuery(TgeneAccountSequence.HQL); + qry.setParameter("modulecode", pModule); + qry.setParameter("productcode", pProduct); + qry.setParameter("subproductcode", pSubproduct); + qry.setParameter("branchcode", pBranch); + qry.setParameter("officecode", pOffice); + qry.setParameter("companycode", pCompany); + qry.setLockMode(LockModeType.PESSIMISTIC_READ); + try { + return (TgeneAccountSequence) qry.getSingleResult(); + } catch (NoResultException e) { + throw new CommonException("CORE-0025", "SECUENCIA DE CUENTA NO DEFINIDA EN TGENEACCOUNTSEQUENCE MODULO: {0}", pModule); + } + } + + /** + * Metodo que entrega la cuenta de secuencias en TgeneAccountSequence por modulo. Devuelve '0' si no hay ningun registro + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pModule Codigo de modulo + * @return Numero de secuencias por modulo + */ + public static String getAmountSequences(EntityManager pEntityManager, String pModule) throws Exception { + Query qry = pEntityManager.createQuery(TgeneAccountSequence.HQL_SEQ); + qry.setParameter("modulecode", pModule); + try { + return qry.getSingleResult().toString(); + } catch (NoResultException e) { + throw new GeneralException("CORE-0025", "SECUENCIA DE CUENTA NO DEFINIDA EN TGENEACCOUNTSEQUENCE MODULO: {}", pModule); + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountSequenceKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountSequenceKey.java new file mode 100644 index 0000000..88d49fe --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountSequenceKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTSEQUENCE*/ +@Embeddable +public class TgeneAccountSequenceKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="ACCOUNTSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia +*/ +private String accountsequence; + +/**Contructor por defecto*/ +public TgeneAccountSequenceKey(){} +/**Contructor de TgeneAccountSequenceKey +@param pModulecode Codigo de modulo +@param pAccountsequence Secuencia +*/ +public TgeneAccountSequenceKey(String pModulecode,String pAccountsequence){ + modulecode=pModulecode; + accountsequence=pAccountsequence; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de accountsequence +@return valor de accountsequence*/ +public String getAccountsequence(){ + return accountsequence; +} +/**Fija el valor de accountsequence +@param pAccountsequence nuevo Valor de accountsequence*/ +public void setAccountsequence(String pAccountsequence){ + accountsequence=pAccountsequence; +} + +/**Implementacin de la comparacin de TgeneAccountSequenceKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountSequenceKey))return false; + TgeneAccountSequenceKey that = (TgeneAccountSequenceKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getAccountsequence() == null || that.getAccountsequence() == null){ + return false; + } + if (! this.getAccountsequence().equals(that.getAccountsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountSequenceKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getAccountsequence() == null ? 0 : this.getAccountsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountStatus.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountStatus.java new file mode 100644 index 0000000..32e35b0 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountStatus.java @@ -0,0 +1,181 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTSTATUS*/ +@Entity(name="TgeneAccountStatus") +@Table(name="TGENEACCOUNTSTATUS") +public class TgeneAccountStatus extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountStatus +*/ +@EmbeddedId +private TgeneAccountStatusKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="ISACCOUNTSTATUS", nullable=true) + +/** +* Indica si es un estatus de cuenta, en vista un estatus es de un sobregiro pero de una cuenta +*/ +private String isaccountstatus; + +@Column(name="DESCRIPTION", nullable=false) + +/** +* Descripcion del estatus de la cuenta +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneAccountStatus(){ +} +/**Contructor de TgeneAccountStatus +@param pPk Clave Primaria del entity +@param pDescription Descripcion del estatus de la cuenta +*/ +public TgeneAccountStatus(TgeneAccountStatusKey pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountStatus +*/ +public static TgeneAccountStatus find(EntityManager pEntityManager,TgeneAccountStatusKey pKey) throws Exception{ + TgeneAccountStatus obj = pEntityManager.find(TgeneAccountStatus.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountStatus +@return El objeto que referencia a la Clave primaria de TgeneAccountStatus +*/ +public TgeneAccountStatusKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountStatus +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountStatus +*/ +public void setPk(TgeneAccountStatusKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de isaccountstatus +@return valor de isaccountstatus*/ +public String getIsaccountstatus(){ + return isaccountstatus; +} +/**Fija el valor de isaccountstatus +@param pIsaccountstatus nuevo Valor de isaccountstatus*/ +public void setIsaccountstatus(String pIsaccountstatus){ + isaccountstatus=pIsaccountstatus; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountStatus))return false; + TgeneAccountStatus that = (TgeneAccountStatus) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountStatus +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountStatus +*/ +public Object createInstance(){ + TgeneAccountStatus instance=new TgeneAccountStatus(); + instance.setPk(new TgeneAccountStatusKey()); + return instance; +} +/**Clona la entidad TgeneAccountStatus +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountStatus p=(TgeneAccountStatus)this.clone(); + p.setPk((TgeneAccountStatusKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountStatusKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountStatusKey.java new file mode 100644 index 0000000..a7a709d --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneAccountStatusKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTSTATUS*/ +@Embeddable +public class TgeneAccountStatusKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +/**Contructor por defecto*/ +public TgeneAccountStatusKey(){} +/**Contructor de TgeneAccountStatusKey +@param pModulecode Codigo de modulo +@param pStatuscode Estatus de cuenta +*/ +public TgeneAccountStatusKey(String pModulecode,String pStatuscode){ + modulecode=pModulecode; + statuscode=pStatuscode; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Implementacin de la comparacin de TgeneAccountStatusKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountStatusKey))return false; + TgeneAccountStatusKey that = (TgeneAccountStatusKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountStatusKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneBaseAccount.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneBaseAccount.java new file mode 100644 index 0000000..dd72943 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneBaseAccount.java @@ -0,0 +1,139 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEBASEACCOUNT*/ +@Entity(name="TgeneBaseAccount") +@Table(name="TGENEBASEACCOUNT") +public class TgeneBaseAccount extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneBaseAccount +*/ +@EmbeddedId +private TgeneBaseAccountKey pk; +@Column(name="LOCKDB", nullable=true) + +/** +* Marca utilizada en el control de actualizacion de saldos de cuentas +*/ +private String lockdb; + +/**Contructor por defecto*/ +public TgeneBaseAccount(){ +} +/**Contructor de TgeneBaseAccount +@param pPk Clave Primaria del entity +*/ +public TgeneBaseAccount(TgeneBaseAccountKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneBaseAccount +*/ +public static TgeneBaseAccount find(EntityManager pEntityManager,TgeneBaseAccountKey pKey) throws Exception{ + TgeneBaseAccount obj = pEntityManager.find(TgeneBaseAccount.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneBaseAccount +@return El objeto que referencia a la Clave primaria de TgeneBaseAccount +*/ +public TgeneBaseAccountKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneBaseAccount +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneBaseAccount +*/ +public void setPk(TgeneBaseAccountKey pPk){ + pk=pPk; +} +/**Obtiene el valor de lockdb +@return valor de lockdb*/ +public String getLockdb(){ + return lockdb; +} +/**Fija el valor de lockdb +@param pLockdb nuevo Valor de lockdb*/ +public void setLockdb(String pLockdb){ + lockdb=pLockdb; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneBaseAccount))return false; + TgeneBaseAccount that = (TgeneBaseAccount) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneBaseAccount +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneBaseAccount +*/ +public Object createInstance(){ + TgeneBaseAccount instance=new TgeneBaseAccount(); + instance.setPk(new TgeneBaseAccountKey()); + return instance; +} +/**Clona la entidad TgeneBaseAccount +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneBaseAccount p=(TgeneBaseAccount)this.clone(); + p.setPk((TgeneBaseAccountKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneBaseAccountKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneBaseAccountKey.java new file mode 100644 index 0000000..9b50dc0 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneBaseAccountKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEBASEACCOUNT*/ +@Embeddable +public class TgeneBaseAccountKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +/**Contructor por defecto*/ +public TgeneBaseAccountKey(){} +/**Contructor de TgeneBaseAccountKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +*/ +public TgeneBaseAccountKey(String pAccount,Integer pCompany){ + account=pAccount; + company=pCompany; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Implementacin de la comparacin de TgeneBaseAccountKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneBaseAccountKey))return false; + TgeneBaseAccountKey that = (TgeneBaseAccountKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneBaseAccountKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSequStruct.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSequStruct.java new file mode 100644 index 0000000..4ac4755 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSequStruct.java @@ -0,0 +1,140 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESEQUSTRUCT*/ +@Entity(name="TgeneSequStruct") +@Table(name="TGENESEQUSTRUCT") +public class TgeneSequStruct extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSequStruct +*/ +@Id +@Column(name="SEQUCODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="SEQUDESCRIPTION", nullable=false) + +/** +* Campo que almacena la descripcion del secuencial de un numero de cuenta +*/ +private String sequdescription; + +/**Contructor por defecto*/ +public TgeneSequStruct(){ +} +/**Contructor de TgeneSequStruct +@param pPk Clave Primaria del entity +@param pSequdescription Campo que almacena la descripcion del secuencial de un numero de cuenta +*/ +public TgeneSequStruct(String pPk,String pSequdescription){ + this(); + pk=pPk; + sequdescription=pSequdescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSequStruct +*/ +public static TgeneSequStruct find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneSequStruct obj = pEntityManager.find(TgeneSequStruct.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSequStruct +@return El objeto que referencia a la Clave primaria de TgeneSequStruct +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSequStruct +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSequStruct +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de sequdescription +@return valor de sequdescription*/ +public String getSequdescription(){ + return sequdescription; +} +/**Fija el valor de sequdescription +@param pSequdescription nuevo Valor de sequdescription*/ +public void setSequdescription(String pSequdescription){ + sequdescription=pSequdescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSequStruct))return false; + TgeneSequStruct that = (TgeneSequStruct) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSequStruct +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSequStruct +*/ +public Object createInstance(){ + TgeneSequStruct instance=new TgeneSequStruct(); + return instance; +} +/**Clona la entidad TgeneSequStruct +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSequStruct p=(TgeneSequStruct)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSequStructDetail.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSequStructDetail.java new file mode 100644 index 0000000..a97435d --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSequStructDetail.java @@ -0,0 +1,168 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.LockModeType; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESEQUSTRUCTDETAIL*/ +@Entity(name="TgeneSequStructDetail") +@Table(name="TGENESEQUSTRUCTDETAIL") +public class TgeneSequStructDetail extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneSequStructDetail + */ + @EmbeddedId + private TgeneSequStructDetailKey pk; + @Version + @Column(name="RECORDVERSION", nullable=true) + + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + /**Contructor por defecto*/ + public TgeneSequStructDetail(){ + } + /**Contructor de TgeneSequStructDetail + @param pPk Clave Primaria del entity + */ + public TgeneSequStructDetail(TgeneSequStructDetailKey pPk){ + this(); + pk=pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSequStructDetail + */ + public static TgeneSequStructDetail find(EntityManager pEntityManager,TgeneSequStructDetailKey pKey) throws Exception{ + TgeneSequStructDetail obj = pEntityManager.find(TgeneSequStructDetail.class,pKey); + return obj; + } + /**Entrega la Clave primaria de TgeneSequStructDetail + @return El objeto que referencia a la Clave primaria de TgeneSequStructDetail + */ + public TgeneSequStructDetailKey getPk(){ + return pk; + } + /**Fija un nuevo valor a la Clave primaria de TgeneSequStructDetail + @param pPk El objeto que referencia a la nueva Clave primaria de TgeneSequStructDetail + */ + public void setPk(TgeneSequStructDetailKey pPk){ + pk=pPk; + } + /**Obtiene el valor de recordversion + @return valor de recordversion*/ + public Integer getRecordversion(){ + return recordversion; + } + /**Fija el valor de recordversion + @param pRecordversion nuevo Valor de recordversion*/ + public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; + } + + public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSequStructDetail))return false; + TgeneSequStructDetail that = (TgeneSequStructDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /**Implementacin del metodo hashCode de la la entidad TgeneSequStructDetail + @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /**Implementacin toString + */ + public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } + /**Implementacin de la creacin de un bean en blanco TgeneSequStructDetail + */ + public Object createInstance(){ + TgeneSequStructDetail instance=new TgeneSequStructDetail(); + instance.setPk(new TgeneSequStructDetailKey()); + return instance; + } + /**Clona la entidad TgeneSequStructDetail + @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException{ + TgeneSequStructDetail p=(TgeneSequStructDetail)this.clone(); + p.setPk((TgeneSequStructDetailKey)this.pk.cloneMe()); + return p; + } + + // METODOS MANUALES + /** + * Sentencia que obtiene la estructura de secuencial para crear un numero de cuenta. + */ + private static final String JPQL = "from TgeneSequStructDetail t " + " where t.pk.sequcode = :sequcode"; + + /** + * Metodo que entrega la estructura de secuencial para un numero de cuenta + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pSequcode Codigo del secuencial + * @return TgeneSequStructDetail + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pSecucode) throws Exception { + Query qry = pEntityManager.createQuery(TgeneSequStructDetail.JPQL); + qry.setParameter("sequcode", pSecucode); + qry.setLockMode(LockModeType.PESSIMISTIC_READ); + return qry.getResultList(); + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSequStructDetailKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSequStructDetailKey.java new file mode 100644 index 0000000..26d2ee2 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSequStructDetailKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESEQUSTRUCTDETAIL*/ +@Embeddable +public class TgeneSequStructDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SEQUCODE", nullable=false,updatable=false) + +/** +* Campo que almacena el codigo del secuencial +*/ +private String sequcode; + +@Column(name="STRUCTUREACCOUNTCATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo - EMPRESA, OFICINA, PRODUCTO, ETC. +*/ +private String structureaccountcatalog; + +@Column(name="STRUCTUREACCOUNTCATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo - FIELDSSTRUCTURE +*/ +private String structureaccountcatalogcode; + +/**Contructor por defecto*/ +public TgeneSequStructDetailKey(){} +/**Contructor de TgeneSequStructDetailKey +@param pSequcode Campo que almacena el codigo del secuencial +@param pStructureaccountcatalog Codigo de catalogo - EMPRESA, OFICINA, PRODUCTO, ETC. +@param pStructureaccountcatalogcode Codigo de tabla de catalogo - FIELDSSTRUCTURE +*/ +public TgeneSequStructDetailKey(String pSequcode,String pStructureaccountcatalog,String pStructureaccountcatalogcode){ + sequcode=pSequcode; + structureaccountcatalog=pStructureaccountcatalog; + structureaccountcatalogcode=pStructureaccountcatalogcode; +} +/**Obtiene el valor de sequcode +@return valor de sequcode*/ +public String getSequcode(){ + return sequcode; +} +/**Fija el valor de sequcode +@param pSequcode nuevo Valor de sequcode*/ +public void setSequcode(String pSequcode){ + sequcode=pSequcode; +} + +/**Obtiene el valor de structureaccountcatalog +@return valor de structureaccountcatalog*/ +public String getStructureaccountcatalog(){ + return structureaccountcatalog; +} +/**Fija el valor de structureaccountcatalog +@param pStructureaccountcatalog nuevo Valor de structureaccountcatalog*/ +public void setStructureaccountcatalog(String pStructureaccountcatalog){ + structureaccountcatalog=pStructureaccountcatalog; +} + +/**Obtiene el valor de structureaccountcatalogcode +@return valor de structureaccountcatalogcode*/ +public String getStructureaccountcatalogcode(){ + return structureaccountcatalogcode; +} +/**Fija el valor de structureaccountcatalogcode +@param pStructureaccountcatalogcode nuevo Valor de structureaccountcatalogcode*/ +public void setStructureaccountcatalogcode(String pStructureaccountcatalogcode){ + structureaccountcatalogcode=pStructureaccountcatalogcode; +} + +/**Implementacin de la comparacin de TgeneSequStructDetailKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSequStructDetailKey))return false; + TgeneSequStructDetailKey that = (TgeneSequStructDetailKey) o; + if (this.getSequcode() == null || that.getSequcode() == null){ + return false; + } + if (! this.getSequcode().equals(that.getSequcode())){ + return false; + } + if (this.getStructureaccountcatalog() == null || that.getStructureaccountcatalog() == null){ + return false; + } + if (! this.getStructureaccountcatalog().equals(that.getStructureaccountcatalog())){ + return false; + } + if (this.getStructureaccountcatalogcode() == null || that.getStructureaccountcatalogcode() == null){ + return false; + } + if (! this.getStructureaccountcatalogcode().equals(that.getStructureaccountcatalogcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSequStructDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSequcode() == null ? 0 : this.getSequcode().hashCode()); + result = result * 37 + (this.getStructureaccountcatalog() == null ? 0 : this.getStructureaccountcatalog().hashCode()); + result = result * 37 + (this.getStructureaccountcatalogcode() == null ? 0 : this.getStructureaccountcatalogcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSequentialModule.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSequentialModule.java new file mode 100644 index 0000000..6c50a75 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSequentialModule.java @@ -0,0 +1,161 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESEQUENTIALMODULE*/ +@Entity(name="TgeneSequentialModule") +@Table(name="TGENESEQUENTIALMODULE") +public class TgeneSequentialModule extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneSequentialModule + */ + @Id + @Column(name="MODULECODE" ,nullable=false, updatable=false) + private String pk; + @Column(name="SEQUCODE", nullable=true) + + /** + * Campo que almacena el codigo del secuencial de un numero de cuenta + */ + private String sequcode; + + @Version + @Column(name="RECORDVERSION", nullable=true) + + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + /**Contructor por defecto*/ + public TgeneSequentialModule(){ + } + /**Contructor de TgeneSequentialModule + @param pPk Clave Primaria del entity + */ + public TgeneSequentialModule(String pPk){ + this(); + pk=pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSequentialModule + */ + public static TgeneSequentialModule find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneSequentialModule obj = pEntityManager.find(TgeneSequentialModule.class,pKey); + return obj; + } + /**Entrega la Clave primaria de TgeneSequentialModule + @return El objeto que referencia a la Clave primaria de TgeneSequentialModule + */ + public String getPk(){ + return pk; + } + /**Fija un nuevo valor a la Clave primaria de TgeneSequentialModule + @param pPk El objeto que referencia a la nueva Clave primaria de TgeneSequentialModule + */ + public void setPk(String pPk){ + pk=pPk; + } + /**Obtiene el valor de sequcode + @return valor de sequcode*/ + public String getSequcode(){ + return sequcode; + } + /**Fija el valor de sequcode + @param pSequcode nuevo Valor de sequcode*/ + public void setSequcode(String pSequcode){ + sequcode=pSequcode; + } + + /**Obtiene el valor de recordversion + @return valor de recordversion*/ + public Integer getRecordversion(){ + return recordversion; + } + /**Fija el valor de recordversion + @param pRecordversion nuevo Valor de recordversion*/ + public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; + } + + public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSequentialModule))return false; + TgeneSequentialModule that = (TgeneSequentialModule) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /**Implementacin del metodo hashCode de la la entidad TgeneSequentialModule + @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /**Implementacin toString + */ + public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } + /**Implementacin de la creacin de un bean en blanco TgeneSequentialModule + */ + public Object createInstance(){ + TgeneSequentialModule instance=new TgeneSequentialModule(); + return instance; + } + /**Clona la entidad TgeneSequentialModule + @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException{ + TgeneSequentialModule p=(TgeneSequentialModule)this.clone(); + return p; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSolicitudeCredit.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSolicitudeCredit.java new file mode 100644 index 0000000..784f1e7 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSolicitudeCredit.java @@ -0,0 +1,302 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDECREDIT*/ +@Entity(name="TgeneSolicitudeCredit") +@Table(name="TGENESOLICITUDECREDIT") +public class TgeneSolicitudeCredit extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeCredit +*/ +@EmbeddedId +private TgeneSolicitudeCreditKey pk; +@Column(name="CASH", nullable=true) + +/** +* Indica que el pago se realiaza en efectivo. +*/ +private String cash; + +@Column(name="CHECKS", nullable=true) + +/** +* Indica que el pago se realiaza en cheque. +*/ +private String checks; + +@Column(name="CREDIT", nullable=true) + +/** +* Indica que el pago se realiaza con credito a una cuenta. +*/ +private String credit; + +@Column(name="CREDITACCOUNT", nullable=true) + +/** +* Numero de cuenta a acreditar cuando el cargo se cobra con debito a la cuenta. +*/ +private String creditaccount; + +@Column(name="CREDITACCOUNTINGCODE", nullable=true) + +/** +* Codigo contable a acreditar cuando el cargo se cobra con debito a la cuenta. +*/ +private String creditaccountingcode; + +@Column(name="CURRENCY", nullable=true) + +/** +* Codigo de moneda de la cuenta de la operacion. +*/ +private String currency; + +@Column(name="VALUE", nullable=true) + +/** +* El valor esta expresado en la moneda de la cuenta, del prestamo, plazo fijo etc.. +*/ +private BigDecimal value; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Si el valor se entrega en efectivo o cheque y el benefiniciario esta en las tablas de clientes, en el campo va el codigo de persona asociado. +*/ +private Integer personcode; + +@Column(name="IDBENEFICIARY", nullable=true) + +/** +* Si el beneficiario no esta registrado en la tabla de personas, en el campo va la identificacion del venceficiario. +*/ +private String idbeneficiary; + +@Column(name="BENEFICIARYNAME", nullable=true) + +/** +* Nombre del beneficiario. +*/ +private String beneficiaryname; + +/**Contructor por defecto*/ +public TgeneSolicitudeCredit(){ +} +/**Contructor de TgeneSolicitudeCredit +@param pPk Clave Primaria del entity +*/ +public TgeneSolicitudeCredit(TgeneSolicitudeCreditKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSolicitudeCredit +*/ +public static TgeneSolicitudeCredit find(EntityManager pEntityManager,TgeneSolicitudeCreditKey pKey) throws Exception{ + TgeneSolicitudeCredit obj = pEntityManager.find(TgeneSolicitudeCredit.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSolicitudeCredit +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeCredit +*/ +public TgeneSolicitudeCreditKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeCredit +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeCredit +*/ +public void setPk(TgeneSolicitudeCreditKey pPk){ + pk=pPk; +} +/**Obtiene el valor de cash +@return valor de cash*/ +public String getCash(){ + return cash; +} +/**Fija el valor de cash +@param pCash nuevo Valor de cash*/ +public void setCash(String pCash){ + cash=pCash; +} + +/**Obtiene el valor de checks +@return valor de checks*/ +public String getChecks(){ + return checks; +} +/**Fija el valor de checks +@param pChecks nuevo Valor de checks*/ +public void setChecks(String pChecks){ + checks=pChecks; +} + +/**Obtiene el valor de credit +@return valor de credit*/ +public String getCredit(){ + return credit; +} +/**Fija el valor de credit +@param pCredit nuevo Valor de credit*/ +public void setCredit(String pCredit){ + credit=pCredit; +} + +/**Obtiene el valor de creditaccount +@return valor de creditaccount*/ +public String getCreditaccount(){ + return creditaccount; +} +/**Fija el valor de creditaccount +@param pCreditaccount nuevo Valor de creditaccount*/ +public void setCreditaccount(String pCreditaccount){ + creditaccount=pCreditaccount; +} + +/**Obtiene el valor de creditaccountingcode +@return valor de creditaccountingcode*/ +public String getCreditaccountingcode(){ + return creditaccountingcode; +} +/**Fija el valor de creditaccountingcode +@param pCreditaccountingcode nuevo Valor de creditaccountingcode*/ +public void setCreditaccountingcode(String pCreditaccountingcode){ + creditaccountingcode=pCreditaccountingcode; +} + +/**Obtiene el valor de currency +@return valor de currency*/ +public String getCurrency(){ + return currency; +} +/**Fija el valor de currency +@param pCurrency nuevo Valor de currency*/ +public void setCurrency(String pCurrency){ + currency=pCurrency; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de idbeneficiary +@return valor de idbeneficiary*/ +public String getIdbeneficiary(){ + return idbeneficiary; +} +/**Fija el valor de idbeneficiary +@param pIdbeneficiary nuevo Valor de idbeneficiary*/ +public void setIdbeneficiary(String pIdbeneficiary){ + idbeneficiary=pIdbeneficiary; +} + +/**Obtiene el valor de beneficiaryname +@return valor de beneficiaryname*/ +public String getBeneficiaryname(){ + return beneficiaryname; +} +/**Fija el valor de beneficiaryname +@param pBeneficiaryname nuevo Valor de beneficiaryname*/ +public void setBeneficiaryname(String pBeneficiaryname){ + beneficiaryname=pBeneficiaryname; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeCredit))return false; + TgeneSolicitudeCredit that = (TgeneSolicitudeCredit) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeCredit +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSolicitudeCredit +*/ +public Object createInstance(){ + TgeneSolicitudeCredit instance=new TgeneSolicitudeCredit(); + instance.setPk(new TgeneSolicitudeCreditKey()); + return instance; +} +/**Clona la entidad TgeneSolicitudeCredit +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeCredit p=(TgeneSolicitudeCredit)this.clone(); + p.setPk((TgeneSolicitudeCreditKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSolicitudeCreditKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSolicitudeCreditKey.java new file mode 100644 index 0000000..8405151 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSolicitudeCreditKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDECREDIT*/ +@Embeddable +public class TgeneSolicitudeCreditKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="CREDITSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del credito. +*/ +private Integer creditsequence; + +/**Contructor por defecto*/ +public TgeneSolicitudeCreditKey(){} +/**Contructor de TgeneSolicitudeCreditKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pCreditsequence Secuencia del credito. +*/ +public TgeneSolicitudeCreditKey(String pSolicitudnumber,Integer pSolicitudsequence,Integer pCreditsequence){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + creditsequence=pCreditsequence; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de creditsequence +@return valor de creditsequence*/ +public Integer getCreditsequence(){ + return creditsequence; +} +/**Fija el valor de creditsequence +@param pCreditsequence nuevo Valor de creditsequence*/ +public void setCreditsequence(Integer pCreditsequence){ + creditsequence=pCreditsequence; +} + +/**Implementacin de la comparacin de TgeneSolicitudeCreditKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeCreditKey))return false; + TgeneSolicitudeCreditKey that = (TgeneSolicitudeCreditKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getCreditsequence() == null || that.getCreditsequence() == null){ + return false; + } + if (! this.getCreditsequence().equals(that.getCreditsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeCreditKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getCreditsequence() == null ? 0 : this.getCreditsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForCredit.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForCredit.java new file mode 100644 index 0000000..87acb01 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForCredit.java @@ -0,0 +1,332 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDEFORCREDIT*/ +@Entity(name="TgeneSolicitudeForCredit") +@Table(name="TGENESOLICITUDEFORCREDIT") +public class TgeneSolicitudeForCredit extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeForCredit +*/ +@EmbeddedId +private TgeneSolicitudeForCreditKey pk; +@Column(name="CASH", nullable=true) + +/** +* Indica que el pago se realiaza en efectivo. +*/ +private String cash; + +@Column(name="CHECKS", nullable=true) + +/** +* Indica que el pago se realiaza en cheque. +*/ +private String checks; + +@Column(name="CREDIT", nullable=true) + +/** +* Indica que el pago se realiaza con credito a una cuenta. +*/ +private String credit; + +@Column(name="CREDITACCOUNT", nullable=true) + +/** +* Numero de cuenta a acreditar cuando el cargo se cobra con debito a la cuenta. +*/ +private String creditaccount; + +@Column(name="CREDITACCOUNTINGCODE", nullable=true) + +/** +* Codigo contable a acreditar cuando el cargo se cobra con debito a la cuenta. +*/ +private String creditaccountingcode; + +@Column(name="CURRENCY", nullable=true) + +/** +* Codigo de moneda de la cuenta de la operacion. +*/ +private String currency; + +@Column(name="VALUE", nullable=true) + +/** +* El valor esta expresado en la moneda de la cuenta, del prestamo, plazo fijo etc.. +*/ +private BigDecimal value; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Si el valor se entrega en efectivo o cheque y el benefiniciario esta en las tablas de clientes, en el campo va el codigo de persona asociado. +*/ +private Integer personcode; + +@Column(name="IDBENEFICIARY", nullable=true) + +/** +* Si el beneficiario no esta registrado en la tabla de personas, en el campo va la identificacion del venceficiario. +*/ +private String idbeneficiary; + +@Column(name="BENEFICIARYNAME", nullable=true) + +/** +* Nombre del beneficiario. +*/ +private String beneficiaryname; + +/**Contructor por defecto*/ +public TgeneSolicitudeForCredit(){ +} +/**Contructor de TgeneSolicitudeForCredit +@param pPk Clave Primaria del entity +*/ +public TgeneSolicitudeForCredit(TgeneSolicitudeForCreditKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSolicitudeForCredit +*/ +public static TgeneSolicitudeForCredit find(EntityManager pEntityManager,TgeneSolicitudeForCreditKey pKey) throws Exception{ + TgeneSolicitudeForCredit obj = pEntityManager.find(TgeneSolicitudeForCredit.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSolicitudeForCredit +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeForCredit +*/ +public TgeneSolicitudeForCreditKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeForCredit +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeForCredit +*/ +public void setPk(TgeneSolicitudeForCreditKey pPk){ + pk=pPk; +} +/**Obtiene el valor de cash +@return valor de cash*/ +public String getCash(){ + return cash; +} +/**Fija el valor de cash +@param pCash nuevo Valor de cash*/ +public void setCash(String pCash){ + cash=pCash; +} + +/**Obtiene el valor de checks +@return valor de checks*/ +public String getChecks(){ + return checks; +} +/**Fija el valor de checks +@param pChecks nuevo Valor de checks*/ +public void setChecks(String pChecks){ + checks=pChecks; +} + +/**Obtiene el valor de credit +@return valor de credit*/ +public String getCredit(){ + return credit; +} +/**Fija el valor de credit +@param pCredit nuevo Valor de credit*/ +public void setCredit(String pCredit){ + credit=pCredit; +} + +/**Obtiene el valor de creditaccount +@return valor de creditaccount*/ +public String getCreditaccount(){ + return creditaccount; +} +/**Fija el valor de creditaccount +@param pCreditaccount nuevo Valor de creditaccount*/ +public void setCreditaccount(String pCreditaccount){ + creditaccount=pCreditaccount; +} + +/**Obtiene el valor de creditaccountingcode +@return valor de creditaccountingcode*/ +public String getCreditaccountingcode(){ + return creditaccountingcode; +} +/**Fija el valor de creditaccountingcode +@param pCreditaccountingcode nuevo Valor de creditaccountingcode*/ +public void setCreditaccountingcode(String pCreditaccountingcode){ + creditaccountingcode=pCreditaccountingcode; +} + +/**Obtiene el valor de currency +@return valor de currency*/ +public String getCurrency(){ + return currency; +} +/**Fija el valor de currency +@param pCurrency nuevo Valor de currency*/ +public void setCurrency(String pCurrency){ + currency=pCurrency; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de idbeneficiary +@return valor de idbeneficiary*/ +public String getIdbeneficiary(){ + return idbeneficiary; +} +/**Fija el valor de idbeneficiary +@param pIdbeneficiary nuevo Valor de idbeneficiary*/ +public void setIdbeneficiary(String pIdbeneficiary){ + idbeneficiary=pIdbeneficiary; +} + +/**Obtiene el valor de beneficiaryname +@return valor de beneficiaryname*/ +public String getBeneficiaryname(){ + return beneficiaryname; +} +/**Fija el valor de beneficiaryname +@param pBeneficiaryname nuevo Valor de beneficiaryname*/ +public void setBeneficiaryname(String pBeneficiaryname){ + beneficiaryname=pBeneficiaryname; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeForCredit))return false; + TgeneSolicitudeForCredit that = (TgeneSolicitudeForCredit) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeForCredit +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSolicitudeForCredit +*/ +public Object createInstance(){ + TgeneSolicitudeForCredit instance=new TgeneSolicitudeForCredit(); + instance.setPk(new TgeneSolicitudeForCreditKey()); + return instance; +} +/**Clona la entidad TgeneSolicitudeForCredit +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeForCredit p=(TgeneSolicitudeForCredit)this.clone(); + p.setPk((TgeneSolicitudeForCreditKey)this.pk.cloneMe()); + return p; +} + + //Metodos manuales + /**Sentencia que devuelve uan lista con los valores de cuentas para creditos asociadas a una solicitud.*/ + private static final String HQL_SOLICITUDE_FORCREDIT = + "from TgeneSolicitudeForCredit t " + + " where t.pk.solicitudnumber = :solicitudnumber "+ + " and t.pk.solicitudsequence = :solicitudsequence "+ + " order by t.pk.creditsequence "; + + /** + * Metodo que entrega una lista de valores a acreditar al cliente, en procesos batch. + * @param pSolicitudNumber Numero de solicitud. + * @param pSolicitudSequence Secuencia dentro de la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager,String pSolicitudNumber,Integer pSolicitudSequence) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_SOLICITUDE_FORCREDIT); + qry.setParameter("solicitudnumber", pSolicitudNumber); + qry.setParameter("solicitudsequence", pSolicitudSequence); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForCreditKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForCreditKey.java new file mode 100644 index 0000000..07dd5c5 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForCreditKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDEFORCREDIT*/ +@Embeddable +public class TgeneSolicitudeForCreditKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="CREDITSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del credito. +*/ +private Integer creditsequence; + +/**Contructor por defecto*/ +public TgeneSolicitudeForCreditKey(){} +/**Contructor de TgeneSolicitudeForCreditKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pCreditsequence Secuencia del credito. +*/ +public TgeneSolicitudeForCreditKey(String pSolicitudnumber,Integer pSolicitudsequence,Integer pCreditsequence){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + creditsequence=pCreditsequence; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de creditsequence +@return valor de creditsequence*/ +public Integer getCreditsequence(){ + return creditsequence; +} +/**Fija el valor de creditsequence +@param pCreditsequence nuevo Valor de creditsequence*/ +public void setCreditsequence(Integer pCreditsequence){ + creditsequence=pCreditsequence; +} + +/**Implementacin de la comparacin de TgeneSolicitudeForCreditKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeForCreditKey))return false; + TgeneSolicitudeForCreditKey that = (TgeneSolicitudeForCreditKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getCreditsequence() == null || that.getCreditsequence() == null){ + return false; + } + if (! this.getCreditsequence().equals(that.getCreditsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeForCreditKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getCreditsequence() == null ? 0 : this.getCreditsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForDebit.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForDebit.java new file mode 100644 index 0000000..5061463 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForDebit.java @@ -0,0 +1,225 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDEFORDEBIT*/ +@Entity(name="TgeneSolicitudeForDebit") +@Table(name="TGENESOLICITUDEFORDEBIT") +public class TgeneSolicitudeForDebit extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeForDebit +*/ +@EmbeddedId +private TgeneSolicitudeForDebitKey pk; +@Column(name="DEBITACCOUNT", nullable=true) + +/** +* Numero de cuenta a debitar cuando el cargo se cobra con debito a la cuenta. +*/ +private String debitaccount; + +@Column(name="DEBITACCOUNTINGCODE", nullable=true) + +/** +* Codigo contable cuando el cargo se cobra con debito a la cuenta. +*/ +private String debitaccountingcode; + +@Column(name="CURRENCY", nullable=true) + +/** +* Codigo de moneda de la cuenta de la operacion. +*/ +private String currency; + +@Column(name="VALUE", nullable=true) + +/** +* Valor en la moneda de la cuenta, la compra venta se hace en funcion a la moneda de la cuenta debito +*/ +private BigDecimal value; + +/**Contructor por defecto*/ +public TgeneSolicitudeForDebit(){ +} +/**Contructor de TgeneSolicitudeForDebit +@param pPk Clave Primaria del entity +*/ +public TgeneSolicitudeForDebit(TgeneSolicitudeForDebitKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSolicitudeForDebit +*/ +public static TgeneSolicitudeForDebit find(EntityManager pEntityManager,TgeneSolicitudeForDebitKey pKey) throws Exception{ + TgeneSolicitudeForDebit obj = pEntityManager.find(TgeneSolicitudeForDebit.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSolicitudeForDebit +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeForDebit +*/ +public TgeneSolicitudeForDebitKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeForDebit +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeForDebit +*/ +public void setPk(TgeneSolicitudeForDebitKey pPk){ + pk=pPk; +} +/**Obtiene el valor de debitaccount +@return valor de debitaccount*/ +public String getDebitaccount(){ + return debitaccount; +} +/**Fija el valor de debitaccount +@param pDebitaccount nuevo Valor de debitaccount*/ +public void setDebitaccount(String pDebitaccount){ + debitaccount=pDebitaccount; +} + +/**Obtiene el valor de debitaccountingcode +@return valor de debitaccountingcode*/ +public String getDebitaccountingcode(){ + return debitaccountingcode; +} +/**Fija el valor de debitaccountingcode +@param pDebitaccountingcode nuevo Valor de debitaccountingcode*/ +public void setDebitaccountingcode(String pDebitaccountingcode){ + debitaccountingcode=pDebitaccountingcode; +} + +/**Obtiene el valor de currency +@return valor de currency*/ +public String getCurrency(){ + return currency; +} +/**Fija el valor de currency +@param pCurrency nuevo Valor de currency*/ +public void setCurrency(String pCurrency){ + currency=pCurrency; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeForDebit))return false; + TgeneSolicitudeForDebit that = (TgeneSolicitudeForDebit) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeForDebit +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSolicitudeForDebit +*/ +public Object createInstance(){ + TgeneSolicitudeForDebit instance=new TgeneSolicitudeForDebit(); + instance.setPk(new TgeneSolicitudeForDebitKey()); + return instance; +} +/**Clona la entidad TgeneSolicitudeForDebit +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeForDebit p=(TgeneSolicitudeForDebit)this.clone(); + p.setPk((TgeneSolicitudeForDebitKey)this.pk.cloneMe()); + return p; +} + + //Metodos manuales. + /**Sentencia que devuelve uan lista con los valores de cuentas para debitos asociadas a una solicitud.*/ + private static final String HQL_SOLICITUDE_FORDEBIT = + "from TgeneSolicitudeForDebit tsd " + + " where tsd.pk.solicitudnumber = :solicitudnumber "+ + " and tsd.pk.solicitudsequence = :solicitudsequence "+ + " order by tsd.pk.debitsequence "; + + /** + * Metodo que entrega una lista de valores a cobrar al cliente, en la aperturad e una operacion. + * @param pSolicitudNumber Numero de solicitud. + * @param pSolicitudSequence Secuencia dentro de la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, + String pSolicitudNumber,Integer pSolicitudSequence) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_SOLICITUDE_FORDEBIT); + qry.setParameter("solicitudnumber", pSolicitudNumber); + qry.setParameter("solicitudsequence", pSolicitudSequence); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForDebitKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForDebitKey.java new file mode 100644 index 0000000..706afff --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForDebitKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDEFORDEBIT*/ +@Embeddable +public class TgeneSolicitudeForDebitKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="DEBITSEQUENCE", nullable=false,updatable=false) + +/** +* Sequencia de debito. +*/ +private Integer debitsequence; + +/**Contructor por defecto*/ +public TgeneSolicitudeForDebitKey(){} +/**Contructor de TgeneSolicitudeForDebitKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pDebitsequence Sequencia de debito. +*/ +public TgeneSolicitudeForDebitKey(String pSolicitudnumber,Integer pSolicitudsequence,Integer pDebitsequence){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + debitsequence=pDebitsequence; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de debitsequence +@return valor de debitsequence*/ +public Integer getDebitsequence(){ + return debitsequence; +} +/**Fija el valor de debitsequence +@param pDebitsequence nuevo Valor de debitsequence*/ +public void setDebitsequence(Integer pDebitsequence){ + debitsequence=pDebitsequence; +} + +/**Implementacin de la comparacin de TgeneSolicitudeForDebitKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeForDebitKey))return false; + TgeneSolicitudeForDebitKey that = (TgeneSolicitudeForDebitKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getDebitsequence() == null || that.getDebitsequence() == null){ + return false; + } + if (! this.getDebitsequence().equals(that.getDebitsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeForDebitKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getDebitsequence() == null ? 0 : this.getDebitsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneTransAccountOperStat.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneTransAccountOperStat.java new file mode 100644 index 0000000..02262f5 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneTransAccountOperStat.java @@ -0,0 +1,249 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.helper.Constant; +import com.fp.demandeposit.exception.DemandDepositException; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACCOUNTOPERSTAT */ +@Entity(name = "TgeneTransAccountOperStat") +@Table(name = "TGENETRANSACCOUNTOPERSTAT") +public class TgeneTransAccountOperStat extends com.fp.dto.AbstractDataTransport + implements + Serializable, + HibernateBean, + Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneTransAccountOperStat + */ + @EmbeddedId + private TgeneTransAccountOperStatKey pk; + @Column(name = "EVALUATETRUE", nullable = true) + /** + * Y, Indica que el estatus actual del ceque tiene que estar en esta condicion, N, el estatus actual del cheque no tiene que estar en la condicion del registro + */ + private String evaluatetrue; + + @Column(name = "VALIDATEDEBIT", nullable = true) + /** + * Y, Indica que valida cuenta debito + */ + private String validatedebit; + + @Column(name = "VALIDATECREDIT", nullable = true) + /** + * Y, Indica que valida la cuenta credito + */ + private String validatecredit; + + /** Contructor por defecto */ + public TgeneTransAccountOperStat() { + } + /** + * Contructor de TgeneTransAccountOperStat + * + * @param pPk Clave Primaria del entity + */ + public TgeneTransAccountOperStat(TgeneTransAccountOperStatKey pPk) { + this(); + pk = pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneTransAccountOperStat + */ + public static TgeneTransAccountOperStat find(EntityManager pEntityManager, TgeneTransAccountOperStatKey pKey) + throws Exception { + TgeneTransAccountOperStat obj = pEntityManager.find(TgeneTransAccountOperStat.class, pKey); + return obj; + } + /** + * Entrega la Clave primaria de TgeneTransAccountOperStat + * + * @return El objeto que referencia a la Clave primaria de TgeneTransAccountOperStat + */ + public TgeneTransAccountOperStatKey getPk() { + return pk; + } + /** + * Fija un nuevo valor a la Clave primaria de TgeneTransAccountOperStat + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransAccountOperStat + */ + public void setPk(TgeneTransAccountOperStatKey pPk) { + pk = pPk; + } + /** + * Obtiene el valor de evaluatetrue + * + * @return valor de evaluatetrue + */ + public String getEvaluatetrue() { + return evaluatetrue; + } + /** + * Fija el valor de evaluatetrue + * + * @param pEvaluatetrue nuevo Valor de evaluatetrue + */ + public void setEvaluatetrue(String pEvaluatetrue) { + evaluatetrue = pEvaluatetrue; + } + + /** + * Obtiene el valor de validatedebit + * + * @return valor de validatedebit + */ + public String getValidatedebit() { + return validatedebit; + } + /** + * Fija el valor de validatedebit + * + * @param pValidatedebit nuevo Valor de validatedebit + */ + public void setValidatedebit(String pValidatedebit) { + validatedebit = pValidatedebit; + } + + /** + * Obtiene el valor de validatecredit + * + * @return valor de validatecredit + */ + public String getValidatecredit() { + return validatecredit; + } + /** + * Fija el valor de validatecredit + * + * @param pValidatecredit nuevo Valor de validatecredit + */ + public void setValidatecredit(String pValidatecredit) { + validatecredit = pValidatecredit; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneTransAccountOperStat)) + return false; + TgeneTransAccountOperStat that = (TgeneTransAccountOperStat) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /** + * Implementacin del metodo hashCode de la la entidad TgeneTransAccountOperStat + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + /** Implementacin de la creacin de un bean en blanco TgeneTransAccountOperStat */ + public Object createInstance() { + TgeneTransAccountOperStat instance = new TgeneTransAccountOperStat(); + instance.setPk(new TgeneTransAccountOperStatKey()); + return instance; + } + /** + * Clona la entidad TgeneTransAccountOperStat + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneTransAccountOperStat p = (TgeneTransAccountOperStat) this.clone(); + p.setPk((TgeneTransAccountOperStatKey) this.pk.cloneMe()); + return p; + } + + //Metodos manuales. + /** Sentencia que devuelve lista de registros de TgeneTransAccountOperStat.*/ + private static final String HQL_TRAN_ACCOUNT_OPER = + " from TgeneTransAccountOperStat t " + + " where t.pk.transactionmodule = :module " + + " and t.pk.transactioncode = :code " + + " and t.pk.transactionversion = :version " ; + + /** + * Metodo que entrega datos de condicion operativa de cuentas por transaccion. + * @param pEntityManager Referencia a la session de la base de datos. + * @param pModule Codigo de modulo. + * @param pTransaction Codigo de transaccion. + * @param pVersion Codigo de version de transaccion. + * @return List + * @throws Exception + */ + @SuppressWarnings(Constant.VUNCHECKED) + public static List find(EntityManager pEntityManager,String pModule,Integer pTransaction, + Integer pVersion) throws Exception { + List lobj = null; + Query qry = pEntityManager.createQuery(HQL_TRAN_ACCOUNT_OPER); + qry.setParameter("module", pModule); + qry.setParameter("code", pTransaction); + qry.setParameter("version", pVersion); + lobj = qry.getResultList(); + if(lobj.isEmpty()){ + throw new DemandDepositException("CORE-0049","CONDICION OPERATIVA DE CUENTA NO DEFINO EN TGENETRANSACCOUNTOPERSTAT: MODULE: {0} TRAN: {1} VER: {2}", + pModule,pTransaction,pVersion); + } + return lobj; + } + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneTransAccountOperStatKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneTransAccountOperStatKey.java new file mode 100644 index 0000000..6d8ab41 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneTransAccountOperStatKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACCOUNTOPERSTAT*/ +@Embeddable +public class TgeneTransAccountOperStatKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="OPERATIVCONDITION", nullable=false,updatable=false) + +/** +* Codigo de condicion operativa. +*/ +private String operativcondition; + +/**Contructor por defecto*/ +public TgeneTransAccountOperStatKey(){} +/**Contructor de TgeneTransAccountOperStatKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pOperativcondition Codigo de condicion operativa. +*/ +public TgeneTransAccountOperStatKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,String pOperativcondition){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + operativcondition=pOperativcondition; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de operativcondition +@return valor de operativcondition*/ +public String getOperativcondition(){ + return operativcondition; +} +/**Fija el valor de operativcondition +@param pOperativcondition nuevo Valor de operativcondition*/ +public void setOperativcondition(String pOperativcondition){ + operativcondition=pOperativcondition; +} + +/**Implementacin de la comparacin de TgeneTransAccountOperStatKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransAccountOperStatKey))return false; + TgeneTransAccountOperStatKey that = (TgeneTransAccountOperStatKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getOperativcondition() == null || that.getOperativcondition() == null){ + return false; + } + if (! this.getOperativcondition().equals(that.getOperativcondition())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransAccountOperStatKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getOperativcondition() == null ? 0 : this.getOperativcondition().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneTransAccountStatus.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneTransAccountStatus.java new file mode 100644 index 0000000..fa3e7dd --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneTransAccountStatus.java @@ -0,0 +1,247 @@ +package com.fp.persistence.pgeneral.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.helper.Constant; +import com.fp.demandeposit.exception.DemandDepositException; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACCOUNTSTATUS */ +@Entity(name = "TgeneTransAccountStatus") +@Table(name = "TGENETRANSACCOUNTSTATUS") +public class TgeneTransAccountStatus extends com.fp.dto.AbstractDataTransport + implements + Serializable, + HibernateBean, + Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneTransAccountStatus + */ + @EmbeddedId + private TgeneTransAccountStatusKey pk; + @Column(name = "EVALUATETRUE", nullable = true) + /** + * Y, Indica que el estatus actual del ceque tiene que estar en esta condicion, N, el estatus actual del cheque no tiene que estar en la condicion del registro + */ + private String evaluatetrue; + + @Column(name = "VALIDATEDEBIT", nullable = true) + /** + * Y, Indica que valida cuenta debito + */ + private String validatedebit; + + @Column(name = "VALIDATECREDIT", nullable = true) + /** + * Y, Indica que valida la cuenta credito + */ + private String validatecredit; + + /** Contructor por defecto */ + public TgeneTransAccountStatus() { + } + /** + * Contructor de TgeneTransAccountStatus + * + * @param pPk Clave Primaria del entity + */ + public TgeneTransAccountStatus(TgeneTransAccountStatusKey pPk) { + this(); + pk = pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneTransAccountStatus + */ + public static TgeneTransAccountStatus find(EntityManager pEntityManager, TgeneTransAccountStatusKey pKey) + throws Exception { + TgeneTransAccountStatus obj = pEntityManager.find(TgeneTransAccountStatus.class, pKey); + return obj; + } + /** + * Entrega la Clave primaria de TgeneTransAccountStatus + * + * @return El objeto que referencia a la Clave primaria de TgeneTransAccountStatus + */ + public TgeneTransAccountStatusKey getPk() { + return pk; + } + /** + * Fija un nuevo valor a la Clave primaria de TgeneTransAccountStatus + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransAccountStatus + */ + public void setPk(TgeneTransAccountStatusKey pPk) { + pk = pPk; + } + /** + * Obtiene el valor de evaluatetrue + * + * @return valor de evaluatetrue + */ + public String getEvaluatetrue() { + return evaluatetrue; + } + /** + * Fija el valor de evaluatetrue + * + * @param pEvaluatetrue nuevo Valor de evaluatetrue + */ + public void setEvaluatetrue(String pEvaluatetrue) { + evaluatetrue = pEvaluatetrue; + } + + /** + * Obtiene el valor de validatedebit + * + * @return valor de validatedebit + */ + public String getValidatedebit() { + return validatedebit; + } + /** + * Fija el valor de validatedebit + * + * @param pValidatedebit nuevo Valor de validatedebit + */ + public void setValidatedebit(String pValidatedebit) { + validatedebit = pValidatedebit; + } + + /** + * Obtiene el valor de validatecredit + * + * @return valor de validatecredit + */ + public String getValidatecredit() { + return validatecredit; + } + /** + * Fija el valor de validatecredit + * + * @param pValidatecredit nuevo Valor de validatecredit + */ + public void setValidatecredit(String pValidatecredit) { + validatecredit = pValidatecredit; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneTransAccountStatus)) + return false; + TgeneTransAccountStatus that = (TgeneTransAccountStatus) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /** + * Implementacin del metodo hashCode de la la entidad TgeneTransAccountStatus + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + /** Implementacin de la creacin de un bean en blanco TgeneTransAccountStatus */ + public Object createInstance() { + TgeneTransAccountStatus instance = new TgeneTransAccountStatus(); + instance.setPk(new TgeneTransAccountStatusKey()); + return instance; + } + /** + * Clona la entidad TgeneTransAccountStatus + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneTransAccountStatus p = (TgeneTransAccountStatus) this.clone(); + p.setPk((TgeneTransAccountStatusKey) this.pk.cloneMe()); + return p; + } + + //Metodos manuales. + /** Sentencia que devuelve lista de registros de TgeneTransAccountStatus.*/ + private static final String HQL_TRAN_ACCOUNT_STATUS = + " from TgeneTransAccountStatus ttranaccostat " + + " where ttranaccostat.pk.transactionmodule = :transactionmodule " + + " and ttranaccostat.pk.transactioncode = :transactioncode " + + " and ttranaccostat.pk.transactionversion = :transactionversion " ; + + /** + * Metodo que entrega datos de estatus de cuentas por transaccion. + * @param pEntityManager Referencia a la session de la base de datos. + * @param pModule Codigo de modulo. + * @param pTransaction Codigo de transaccion. + * @param pVersion Codigo de version de transaccion. + * @return List + * @throws Exception + */ + @SuppressWarnings(Constant.VUNCHECKED) + public static List find(EntityManager pEntityManager,String pModule,Integer pTransaction, + Integer pVersion) throws Exception { + List status = null; + Query qry = pEntityManager.createQuery(HQL_TRAN_ACCOUNT_STATUS); + qry.setParameter("transactionmodule", pModule); + qry.setParameter("transactioncode", pTransaction); + qry.setParameter("transactionversion", pVersion); + status = qry.getResultList(); + if(status.isEmpty()){ + throw new DemandDepositException("CORE-0043","ESTATUS DE CUENTA NO DEFINO EN TGENETRANSACCOUNTSTATUS: {0} MODULE: {1} TRAN: {2} VER: {2}", + pModule,pTransaction,pVersion); + } + return status; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneTransAccountStatusKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneTransAccountStatusKey.java new file mode 100644 index 0000000..c70a82c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneTransAccountStatusKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACCOUNTSTATUS*/ +@Embeddable +public class TgeneTransAccountStatusKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +/**Contructor por defecto*/ +public TgeneTransAccountStatusKey(){} +/**Contructor de TgeneTransAccountStatusKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pStatuscode Estatus de cuenta +*/ +public TgeneTransAccountStatusKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,String pStatuscode){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + statuscode=pStatuscode; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Implementacin de la comparacin de TgeneTransAccountStatusKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransAccountStatusKey))return false; + TgeneTransAccountStatusKey that = (TgeneTransAccountStatusKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransAccountStatusKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneWarrantyAccount.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneWarrantyAccount.java new file mode 100644 index 0000000..53deb90 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneWarrantyAccount.java @@ -0,0 +1,345 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.List; +import javax.persistence.Query; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEWARRANTYACCOUNT*/ +@Entity(name = "TgeneWarrantyAccount") +@Table(name = "TGENEWARRANTYACCOUNT") +public class TgeneWarrantyAccount extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneWarrantyAccount + */ + @EmbeddedId + private TgeneWarrantyAccountKey pk; + @Column(name = "SOLICITUDNUMBER", nullable = false) + /** + * Numero de solicitud + */ + private String solicitudnumber; + @Column(name = "SOLICITUDSEQUENCE", nullable = false) + /** + * secuencia interna de solicitud + */ + private Integer solicitudsequence; + @Column(name = "WARRANTYSEQUENCE", nullable = false) + /** + * Secuencia interna de la solicitud de la garantia. + */ + private Integer warrantysequence; + @Column(name = "PERSONCODE", nullable = false) + /** + * Codigo de persona asociada a una garantia existente, o codigo de persona al cual se le asocia una nueva garantia. + */ + private Integer personcode; + @Column(name = "WARRANTYTYPE", nullable = true) + /** + * Codigo de tipo de garantia + */ + private String warrantytype; + @Column(name = "PROPERTYTYPE", nullable = true) + /** + * Tipo de bien, Edficaciones + */ + private String propertytype; + @Column(name = "GUARANTEEVALUE", nullable = true) + /** + * Valor garantizado, una operacion puede estar avalada o garantiza por mas de una garantia. + */ + private BigDecimal guaranteevalue; + + /**Contructor por defecto*/ + public TgeneWarrantyAccount() { + } + + /**Contructor de TgeneWarrantyAccount + @param pPk Clave Primaria del entity + @param pSolicitudnumber Numero de solicitud + @param pSolicitudsequence secuencia interna de solicitud + @param pWarrantysequence Secuencia interna de la solicitud de la garantia. + @param pPersoncode Codigo de persona asociada a una garantia existente, o codigo de persona al cual se le asocia una nueva garantia. + */ + public TgeneWarrantyAccount(TgeneWarrantyAccountKey pPk, String pSolicitudnumber, Integer pSolicitudsequence, Integer pWarrantysequence, Integer pPersoncode) { + this(); + pk = pPk; + solicitudnumber = pSolicitudnumber; + solicitudsequence = pSolicitudsequence; + warrantysequence = pWarrantysequence; + personcode = pPersoncode; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneWarrantyAccount + */ + public static TgeneWarrantyAccount find(EntityManager pEntityManager, TgeneWarrantyAccountKey pKey) throws Exception { + TgeneWarrantyAccount obj = pEntityManager.find(TgeneWarrantyAccount.class, pKey); + return obj; + } + + /**Entrega la Clave primaria de TgeneWarrantyAccount + @return El objeto que referencia a la Clave primaria de TgeneWarrantyAccount + */ + public TgeneWarrantyAccountKey getPk() { + return pk; + } + + /**Fija un nuevo valor a la Clave primaria de TgeneWarrantyAccount + @param pPk El objeto que referencia a la nueva Clave primaria de TgeneWarrantyAccount + */ + public void setPk(TgeneWarrantyAccountKey pPk) { + pk = pPk; + } + + /**Obtiene el valor de solicitudnumber + @return valor de solicitudnumber*/ + public String getSolicitudnumber() { + return solicitudnumber; + } + + /**Fija el valor de solicitudnumber + @param pSolicitudnumber nuevo Valor de solicitudnumber*/ + public void setSolicitudnumber(String pSolicitudnumber) { + solicitudnumber = pSolicitudnumber; + } + + /**Obtiene el valor de solicitudsequence + @return valor de solicitudsequence*/ + public Integer getSolicitudsequence() { + return solicitudsequence; + } + + /**Fija el valor de solicitudsequence + @param pSolicitudsequence nuevo Valor de solicitudsequence*/ + public void setSolicitudsequence(Integer pSolicitudsequence) { + solicitudsequence = pSolicitudsequence; + } + + /**Obtiene el valor de warrantysequence + @return valor de warrantysequence*/ + public Integer getWarrantysequence() { + return warrantysequence; + } + + /**Fija el valor de warrantysequence + @param pWarrantysequence nuevo Valor de warrantysequence*/ + public void setWarrantysequence(Integer pWarrantysequence) { + warrantysequence = pWarrantysequence; + } + + /**Obtiene el valor de personcode + @return valor de personcode*/ + public Integer getPersoncode() { + return personcode; + } + + /**Fija el valor de personcode + @param pPersoncode nuevo Valor de personcode*/ + public void setPersoncode(Integer pPersoncode) { + personcode = pPersoncode; + } + + /**Obtiene el valor de warrantytype + @return valor de warrantytype*/ + public String getWarrantytype() { + return warrantytype; + } + + /**Fija el valor de warrantytype + @param pWarrantytype nuevo Valor de warrantytype*/ + public void setWarrantytype(String pWarrantytype) { + warrantytype = pWarrantytype; + } + + /**Obtiene el valor de propertytype + @return valor de propertytype*/ + public String getPropertytype() { + return propertytype; + } + + /**Fija el valor de propertytype + @param pPropertytype nuevo Valor de propertytype*/ + public void setPropertytype(String pPropertytype) { + propertytype = pPropertytype; + } + + /**Obtiene el valor de guaranteevalue + @return valor de guaranteevalue*/ + public BigDecimal getGuaranteevalue() { + return guaranteevalue; + } + + /**Fija el valor de guaranteevalue + @param pGuaranteevalue nuevo Valor de guaranteevalue*/ + public void setGuaranteevalue(BigDecimal pGuaranteevalue) { + guaranteevalue = pGuaranteevalue; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneWarrantyAccount)) { + return false; + } + TgeneWarrantyAccount that = (TgeneWarrantyAccount) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /**Implementacin del metodo hashCode de la la entidad TgeneWarrantyAccount + @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /**Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /**Implementacin de la creacin de un bean en blanco TgeneWarrantyAccount + */ + public Object createInstance() { + TgeneWarrantyAccount instance = new TgeneWarrantyAccount(); + instance.setPk(new TgeneWarrantyAccountKey()); + return instance; + } + + /**Clona la entidad TgeneWarrantyAccount + @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneWarrantyAccount p = (TgeneWarrantyAccount) this.clone(); + p.setPk((TgeneWarrantyAccountKey) this.pk.cloneMe()); + return p; + } +//METODOS MANUALES + /** Sentencia que entrega datos de TgeneWarrantyAccount, par el un numero de garantia. */ + private static final String JPQL_WARR_ACCO = "from TgeneWarrantyAccount gwa where gwa.pk.warraccount= :warraccount" + + " and gwa.pk.company= :companycod and gwa.pk.warrcompany= :companycod "; + + /** + * Metodo que devuelve una lista de TgeneWarrantyAccount dado el numero de cuenta de un prestamo. + * @param pEntityManager Session de la base de datos. + * @param company Codigo de la compania. + * @param warracco Numero de la garantia. + * @return List + * @throws Exception + */ + public static List find(EntityManager pEntityManager, Integer company, String warracco) throws Exception { + List lwarrantAccount = new ArrayList(); + Query qry = pEntityManager.createQuery(TgeneWarrantyAccount.JPQL_WARR_ACCO); + qry.setParameter("companycod", company); + qry.setParameter("warraccount", warracco); + lwarrantAccount = (List) qry.getResultList(); + return lwarrantAccount; + } + /** Sentencia que entrega datos de TgeneWarrantyAccount, dado el numero de la operacion. */ + private static final String JPQL_ACCO_OPERAT = "from TgeneWarrantyAccount gwa where gwa.pk.account= :account" + + " and gwa.pk.company= :companycod and gwa.pk.warrcompany= :companycod "; + + /** + * Metodo que devuelve una lista de TgeneWarrantyAccount dado el numero de cuenta asociado a una garantia + * @param pEntityManager Session de la base de datos. + * @param company Codigo de la compania. + * @param account Numero de la garantia. + * @return List + * @throws Exception + */ + public static List findPerAccount(EntityManager pEntityManager, Integer company, String account) throws Exception { + List lwarrantAccount = new ArrayList(); + Query qry = pEntityManager.createQuery(TgeneWarrantyAccount.JPQL_ACCO_OPERAT); + qry.setParameter("companycod", company); + qry.setParameter("account", account); + lwarrantAccount = (List) qry.getResultList(); + return lwarrantAccount; + } + + /** + * Sentencia que entrega datos de TgeneWarrantyAccount, par el un numero de + * cuenta respaldada por una garantia. + */ + private static final String JPQL_ACCOUNT = " from TgeneWarrantyAccount gwa " + + " where gwa.pk.account= :accountparam " + + " and gwa.pk.company= :companyparam"; + + /** + * + * @param pEntityManager Session de la base de datos. + * @param company Codigo de la compania. + * @param account Numero de la garantia. + * @return List + * @throws Exception + */ + public static List findByAccount( + EntityManager pEntityManager, Integer company, String account) + throws Exception { + List lwarrantAccount = new ArrayList(); + Query qry = pEntityManager + .createQuery(TgeneWarrantyAccount.JPQL_ACCOUNT); + qry.setParameter("companyparam", company); + qry.setParameter("accountparam", account); + lwarrantAccount = (List) qry.getResultList(); + return lwarrantAccount; + } + + + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneWarrantyAccountKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneWarrantyAccountKey.java new file mode 100644 index 0000000..6f613c2 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/acco/TgeneWarrantyAccountKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.acco; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEWARRANTYACCOUNT*/ +@Embeddable +public class TgeneWarrantyAccountKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* No de Cuenta de un Prestamo o Linea de Credito +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta del prestamo o linea de credito +*/ +private Integer company; + +@Column(name="WARRACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta asociado a una garantia, si la misma garantia esta avalando mas de una operacion. +*/ +private String warraccount; + +@Column(name="WARRCOMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta de la garantia. +*/ +private Integer warrcompany; + +/**Contructor por defecto*/ +public TgeneWarrantyAccountKey(){} +/**Contructor de TgeneWarrantyAccountKey +@param pAccount No de Cuenta de un Prestamo o Linea de Credito +@param pCompany Codigo de compania a la que pertence la cuenta del prestamo o linea de credito +@param pWarraccount Numero de cuenta asociado a una garantia, si la misma garantia esta avalando mas de una operacion. +@param pWarrcompany Codigo de compania a la que pertence la cuenta de la garantia. +*/ +public TgeneWarrantyAccountKey(String pAccount,Integer pCompany,String pWarraccount,Integer pWarrcompany){ + account=pAccount; + company=pCompany; + warraccount=pWarraccount; + warrcompany=pWarrcompany; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de warraccount +@return valor de warraccount*/ +public String getWarraccount(){ + return warraccount; +} +/**Fija el valor de warraccount +@param pWarraccount nuevo Valor de warraccount*/ +public void setWarraccount(String pWarraccount){ + warraccount=pWarraccount; +} + +/**Obtiene el valor de warrcompany +@return valor de warrcompany*/ +public Integer getWarrcompany(){ + return warrcompany; +} +/**Fija el valor de warrcompany +@param pWarrcompany nuevo Valor de warrcompany*/ +public void setWarrcompany(Integer pWarrcompany){ + warrcompany=pWarrcompany; +} + +/**Implementacin de la comparacin de TgeneWarrantyAccountKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneWarrantyAccountKey))return false; + TgeneWarrantyAccountKey that = (TgeneWarrantyAccountKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getWarraccount() == null || that.getWarraccount() == null){ + return false; + } + if (! this.getWarraccount().equals(that.getWarraccount())){ + return false; + } + if (this.getWarrcompany() == null || that.getWarrcompany() == null){ + return false; + } + if (! this.getWarrcompany().equals(that.getWarrcompany())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneWarrantyAccountKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getWarraccount() == null ? 0 : this.getWarraccount().hashCode()); + result = result * 37 + (this.getWarrcompany() == null ? 0 : this.getWarrcompany().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/.svn/entries new file mode 100644 index 0000000..b9b93a2 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneSolicitudeClientdata.java +file + + + + +2022-07-28T03:40:29.792747Z +545ac6ab9406afc4fec030c46f29ddae +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +10528 + +TgeneSolicitudeExceptionsKey.java +file + + + + +2022-07-28T03:40:29.792747Z +f63195a1b6951162db112a20731c5394 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6359 + +TgeneExceptions.java +file + + + + +2022-07-28T03:40:29.792747Z +1524a9a8bc553d4c21fc68ad8cc4cff8 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7644 + +TgeneSolicitudeClientdataKey.java +file + + + + +2022-07-28T03:40:29.793747Z +1c6aa043591b7326fb9d9aceef6550a6 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5380 + +TgeneSolicitudeExceptions.java +file + + + + +2022-07-28T03:40:29.793747Z +6d944d15ac14986a57a29d7b8e7244e4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9065 + +TgeneExceptionsKey.java +file + + + + +2022-07-28T03:40:29.793747Z +cb39261905bb4d63c39bfd7e85e767c8 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7650 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/.svn/text-base/TgeneExceptions.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/.svn/text-base/TgeneExceptions.java.svn-base new file mode 100644 index 0000000..8e6d5d5 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/.svn/text-base/TgeneExceptions.java.svn-base @@ -0,0 +1,268 @@ +package com.fp.persistence.pgeneral.auth; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEEXCEPTIONS*/ +@Entity(name="TgeneExceptions") +@Table(name="TGENEEXCEPTIONS") +public class TgeneExceptions extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneExceptions +*/ +@EmbeddedId +private TgeneExceptionsKey pk; +@Column(name="PROFILECODE", nullable=true) + +/** +* Codigo de perfil de usuario +*/ +private String profilecode; + +@Column(name="CONDITION", nullable=true) + +/** +* Condicion a evaluar +*/ +private String condition; + +@Column(name="STRINGVALUE", nullable=true) + +/** +* Valor a compar con el dato del campo +*/ +private String stringvalue; + +@Column(name="NUMERICVALUE", nullable=true) + +/** +* Valor a compar con el dato del campo +*/ +private BigDecimal numericvalue; + +@Column(name="TITLE", nullable=true) + +/** +* Titulo de la condicion a generar, ejemplo MONTO > 100 +*/ +private String title; + +@Column(name="COMMAND", nullable=true) + +/** +* Clase que genera una condicion especial, ejemplo nacionalidad = ECUATORIANA +*/ +private String command; + +/**Contructor por defecto*/ +public TgeneExceptions(){ +} +/**Contructor de TgeneExceptions +@param pPk Clave Primaria del entity +*/ +public TgeneExceptions(TgeneExceptionsKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneExceptions +*/ +public static TgeneExceptions find(EntityManager pEntityManager,TgeneExceptionsKey pKey) throws Exception{ + TgeneExceptions obj = pEntityManager.find(TgeneExceptions.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneExceptions +@return El objeto que referencia a la Clave primaria de TgeneExceptions +*/ +public TgeneExceptionsKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneExceptions +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneExceptions +*/ +public void setPk(TgeneExceptionsKey pPk){ + pk=pPk; +} +/**Obtiene el valor de profilecode +@return valor de profilecode*/ +public String getProfilecode(){ + return profilecode; +} +/**Fija el valor de profilecode +@param pProfilecode nuevo Valor de profilecode*/ +public void setProfilecode(String pProfilecode){ + profilecode=pProfilecode; +} + +/**Obtiene el valor de condition +@return valor de condition*/ +public String getCondition(){ + return condition; +} +/**Fija el valor de condition +@param pCondition nuevo Valor de condition*/ +public void setCondition(String pCondition){ + condition=pCondition; +} + +/**Obtiene el valor de stringvalue +@return valor de stringvalue*/ +public String getStringvalue(){ + return stringvalue; +} +/**Fija el valor de stringvalue +@param pStringvalue nuevo Valor de stringvalue*/ +public void setStringvalue(String pStringvalue){ + stringvalue=pStringvalue; +} + +/**Obtiene el valor de numericvalue +@return valor de numericvalue*/ +public BigDecimal getNumericvalue(){ + return numericvalue; +} +/**Fija el valor de numericvalue +@param pNumericvalue nuevo Valor de numericvalue*/ +public void setNumericvalue(BigDecimal pNumericvalue){ + numericvalue=pNumericvalue; +} + +/**Obtiene el valor de title +@return valor de title*/ +public String getTitle(){ + return title; +} +/**Fija el valor de title +@param pTitle nuevo Valor de title*/ +public void setTitle(String pTitle){ + title=pTitle; +} + +/**Obtiene el valor de command +@return valor de command*/ +public String getCommand(){ + return command; +} +/**Fija el valor de command +@param pCommand nuevo Valor de command*/ +public void setCommand(String pCommand){ + command=pCommand; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneExceptions))return false; + TgeneExceptions that = (TgeneExceptions) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneExceptions +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneExceptions +*/ +public Object createInstance(){ + TgeneExceptions instance=new TgeneExceptions(); + instance.setPk(new TgeneExceptionsKey()); + return instance; +} +/**Clona la entidad TgeneExceptions +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneExceptions p=(TgeneExceptions)this.clone(); + p.setPk((TgeneExceptionsKey)this.pk.cloneMe()); + return p; +} + + //Metodos manuales. + /**Sentencia que devuelve la definicion de excepciones que requieren autorizacion, por subproducto moneda.*/ + private static final String HQL_EXCEPTIONS = + "from TgeneExceptions texception " + + " where texception.pk.modulecode = :modulecode "+ + " and texception.pk.productcode = :productcode "+ + " and texception.pk.subproductcode = :subproductcode "+ + " and texception.pk.currencycode = :currencycode "+ + " order by texception.pk.exceptionorder "; + + /** + * Entrega una lista de excepciones de solicitud definidas por subproducto moneda, con la cual + * se generan excepciones a autorizar en una solicitud. + * @param pModuleCode Codigo de modulo. + * @param pProductCode Codigo de product. + * @param pSubproductCode Codigo de subproducto. + * @param pCurrencyCode Codigo de moneda. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager,String pModuleCode,String pProductCode, + String pSubproductCode,String pCurrencyCode) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_EXCEPTIONS); + qry.setParameter("modulecode", pModuleCode); + qry.setParameter("productcode", pProductCode); + qry.setParameter("subproductcode", pSubproductCode); + qry.setParameter("currencycode", pCurrencyCode); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/.svn/text-base/TgeneExceptionsKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/.svn/text-base/TgeneExceptionsKey.java.svn-base new file mode 100644 index 0000000..8bfdab2 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/.svn/text-base/TgeneExceptionsKey.java.svn-base @@ -0,0 +1,259 @@ +package com.fp.persistence.pgeneral.auth; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEEXCEPTIONS*/ +@Embeddable +public class TgeneExceptionsKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="BEAN", nullable=false,updatable=false) + +/** +* Bean del cual se obtiene el valor del atributo a evaluar +*/ +private String bean; + +@Column(name="ATTRIBUTE", nullable=false,updatable=false) + +/** +* Atributo a obtener el valor para aplicar la condicion y comparar con el dato del campo valor +*/ +private String attribute; + +@Column(name="EXCEPTIONORDER", nullable=false,updatable=false) + +/** +* Orden de generacion de autorizaciones +*/ +private Integer exceptionorder; + +/**Contructor por defecto*/ +public TgeneExceptionsKey(){} +/**Contructor de TgeneExceptionsKey +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pCurrencycode Codigo de moneda +@param pBean Bean del cual se obtiene el valor del atributo a evaluar +@param pAttribute Atributo a obtener el valor para aplicar la condicion y comparar con el dato del campo valor +@param pExceptionorder Orden de generacion de autorizaciones +*/ +public TgeneExceptionsKey(String pModulecode,String pProductcode,String pSubproductcode,String pCurrencycode,String pBean,String pAttribute,Integer pExceptionorder){ + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + currencycode=pCurrencycode; + bean=pBean; + attribute=pAttribute; + exceptionorder=pExceptionorder; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de bean +@return valor de bean*/ +public String getBean(){ + return bean; +} +/**Fija el valor de bean +@param pBean nuevo Valor de bean*/ +public void setBean(String pBean){ + bean=pBean; +} + +/**Obtiene el valor de attribute +@return valor de attribute*/ +public String getAttribute(){ + return attribute; +} +/**Fija el valor de attribute +@param pAttribute nuevo Valor de attribute*/ +public void setAttribute(String pAttribute){ + attribute=pAttribute; +} + +/**Obtiene el valor de exceptionorder +@return valor de exceptionorder*/ +public Integer getExceptionorder(){ + return exceptionorder; +} +/**Fija el valor de exceptionorder +@param pExceptionorder nuevo Valor de exceptionorder*/ +public void setExceptionorder(Integer pExceptionorder){ + exceptionorder=pExceptionorder; +} + +/**Implementacin de la comparacin de TgeneExceptionsKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneExceptionsKey))return false; + TgeneExceptionsKey that = (TgeneExceptionsKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getBean() == null || that.getBean() == null){ + return false; + } + if (! this.getBean().equals(that.getBean())){ + return false; + } + if (this.getAttribute() == null || that.getAttribute() == null){ + return false; + } + if (! this.getAttribute().equals(that.getAttribute())){ + return false; + } + if (this.getExceptionorder() == null || that.getExceptionorder() == null){ + return false; + } + if (! this.getExceptionorder().equals(that.getExceptionorder())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneExceptionsKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getBean() == null ? 0 : this.getBean().hashCode()); + result = result * 37 + (this.getAttribute() == null ? 0 : this.getAttribute().hashCode()); + result = result * 37 + (this.getExceptionorder() == null ? 0 : this.getExceptionorder().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/.svn/text-base/TgeneSolicitudeClientdata.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/.svn/text-base/TgeneSolicitudeClientdata.java.svn-base new file mode 100644 index 0000000..90a123b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/.svn/text-base/TgeneSolicitudeClientdata.java.svn-base @@ -0,0 +1,341 @@ +package com.fp.persistence.pgeneral.auth; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDECLIENTDATA */ +@Entity(name = "TgeneSolicitudeClientdata") +@Table(name = "TGENESOLICITUDECLIENTDATA") +public class TgeneSolicitudeClientdata extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneSolicitudeClientdata + */ + @EmbeddedId + private TgeneSolicitudeClientdataKey pk; + + @Column(name = "USERCODE", nullable = true) + /** + * Codigo de usuario que verifica la informacion del cliente + */ + private String usercode; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro. + */ + private Integer recordversion; + + @Column(name = "CHECKED", nullable = true) + /** + * Y indica que la informacion fue verificada. N la informacion no esta verificada. + */ + private String checked; + + @Column(name = "CHECKDATE", nullable = true) + /** + * Fecha de verificacion de la informacion. + */ + private Date checkdate; + + @Column(name = "PRESENTATIONORDER", nullable = true) + /** + * Orden de presentacion + */ + private Integer presentationorder; + + /** Contructor por defecto */ + public TgeneSolicitudeClientdata() { + } + + /** + * Contructor de TgeneSolicitudeClientdata + * + * @param pPk Clave Primaria del entity + */ + public TgeneSolicitudeClientdata(TgeneSolicitudeClientdataKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSolicitudeClientdata + */ + public static TgeneSolicitudeClientdata find(EntityManager pEntityManager, TgeneSolicitudeClientdataKey pKey) throws Exception { + TgeneSolicitudeClientdata obj = pEntityManager.find(TgeneSolicitudeClientdata.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneSolicitudeClientdata + * + * @return El objeto que referencia a la Clave primaria de TgeneSolicitudeClientdata + */ + public TgeneSolicitudeClientdataKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneSolicitudeClientdata + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeClientdata + */ + public void setPk(TgeneSolicitudeClientdataKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de usercode + * + * @return valor de usercode + */ + public String getUsercode() { + return this.usercode; + } + + /** + * Fija el valor de usercode + * + * @param pUsercode nuevo Valor de usercode + */ + public void setUsercode(String pUsercode) { + this.usercode = pUsercode; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de checked + * + * @return valor de checked + */ + public String getChecked() { + return this.checked; + } + + /** + * Fija el valor de checked + * + * @param pChecked nuevo Valor de checked + */ + public void setChecked(String pChecked) { + this.checked = pChecked; + } + + /** + * Obtiene el valor de checkdate + * + * @return valor de checkdate + */ + public Date getCheckdate() { + return this.checkdate; + } + + /** + * Fija el valor de checkdate + * + * @param pCheckdate nuevo Valor de checkdate + */ + public void setCheckdate(Date pCheckdate) { + this.checkdate = pCheckdate; + } + + /** + * Obtiene el valor de presentationorder + * + * @return valor de presentationorder + */ + public Integer getPresentationorder() { + return this.presentationorder; + } + + /** + * Fija el valor de presentationorder + * + * @param pPresentationorder nuevo Valor de presentationorder + */ + public void setPresentationorder(Integer pPresentationorder) { + this.presentationorder = pPresentationorder; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneSolicitudeClientdata)) { + return false; + } + TgeneSolicitudeClientdata that = (TgeneSolicitudeClientdata) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneSolicitudeClientdata + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneSolicitudeClientdata */ + @Override + public Object createInstance() { + TgeneSolicitudeClientdata instance = new TgeneSolicitudeClientdata(); + instance.setPk(new TgeneSolicitudeClientdataKey()); + return instance; + } + + /** + * Clona la entidad TgeneSolicitudeClientdata + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneSolicitudeClientdata p = (TgeneSolicitudeClientdata) this.clone(); + p.setPk((TgeneSolicitudeClientdataKey) this.pk.cloneMe()); + return p; + } + + // Metodos manuales. + /** Sentencia que entrga una lista de registros de TgeneSolicitudeClientdata. */ + private static String JPQL = "from TgeneSolicitudeClientdata t where t.pk.solicitudnumber = :solicitudnumber and t.pk.solicitudsequence = :solicitudsequence"; + + /** + * Entrega una lista de {@link TgeneSolicitudeClientdata} dado el numero de solicitud y la secuencia de la + * solicitud. + * + * @param pEntityManager Referencia a la session de la base de datos. + * @param pSolicitudenumber Numero de solicitud. + * @param pSolicitudesequence Secuencia interna de la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pSolicitudenumber, Integer pSolicitudesequence) + throws Exception { + Query qry = pEntityManager.createQuery(TgeneSolicitudeClientdata.JPQL); + qry.setParameter("solicitudnumber", pSolicitudenumber); + qry.setParameter("solicitudsequence", pSolicitudesequence); + return qry.getResultList(); + + } + + + /** + * Sentencia SQL que devuelve un objeto de tipo TgeneSolicitudeClientdata + */ + private static final String JPQL_SOLICITUDE_CLIENT_DATA = "from TgeneSolicitudeClientdata tgs " + + " where tgs.pk.solicitudnumber = :solicitudnumber " + " and tgs.pk.solicitudsequence = :solicitudsequence " + + " and tgs.pk.title = :title " + " and tgs.pk.personcode = :personcode"; + /** + * Metodo que devuelve un objeto de tipo TgeneSolicitudeClientdata + * + * @param solicitudnumber + * @param solicitudsequence + * @param title + * @param personcode + * @return + * @throws Exception + */ + public static TgeneSolicitudeClientdata find(EntityManager pEntityManager, String solicitudnumber, Integer solicitudsequence, String title, Integer personcode) + throws Exception { + Query qry = pEntityManager.createQuery(TgeneSolicitudeClientdata.JPQL_SOLICITUDE_CLIENT_DATA); + qry.setParameter("solicitudnumber", solicitudnumber); + qry.setParameter("solicitudsequence", solicitudsequence); + qry.setParameter("title", title); + qry.setParameter("personcode", personcode); + try { + return (TgeneSolicitudeClientdata) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/.svn/text-base/TgeneSolicitudeClientdataKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/.svn/text-base/TgeneSolicitudeClientdataKey.java.svn-base new file mode 100644 index 0000000..5e5d556 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/.svn/text-base/TgeneSolicitudeClientdataKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.auth; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDECLIENTDATA*/ +@Embeddable +public class TgeneSolicitudeClientdataKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="TITLE", nullable=false,updatable=false) + +/** +* Codigo de informacion de clientes requerido. +*/ +private String title; + +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona asociado a la solicitud. +*/ +private Integer personcode; + +/**Contructor por defecto*/ +public TgeneSolicitudeClientdataKey(){} +/**Contructor de TgeneSolicitudeClientdataKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pTitle Codigo de informacion de clientes requerido. +@param pPersoncode Codigo de persona asociado a la solicitud. +*/ +public TgeneSolicitudeClientdataKey(String pSolicitudnumber,Integer pSolicitudsequence,String pTitle,Integer pPersoncode){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + title=pTitle; + personcode=pPersoncode; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de title +@return valor de title*/ +public String getTitle(){ + return title; +} +/**Fija el valor de title +@param pTitle nuevo Valor de title*/ +public void setTitle(String pTitle){ + title=pTitle; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Implementacin de la comparacin de TgeneSolicitudeClientdataKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeClientdataKey))return false; + TgeneSolicitudeClientdataKey that = (TgeneSolicitudeClientdataKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getTitle() == null || that.getTitle() == null){ + return false; + } + if (! this.getTitle().equals(that.getTitle())){ + return false; + } + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeClientdataKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getTitle() == null ? 0 : this.getTitle().hashCode()); + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/.svn/text-base/TgeneSolicitudeExceptions.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/.svn/text-base/TgeneSolicitudeExceptions.java.svn-base new file mode 100644 index 0000000..188f778 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/.svn/text-base/TgeneSolicitudeExceptions.java.svn-base @@ -0,0 +1,315 @@ +package com.fp.persistence.pgeneral.auth; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.persistence.commondb.exception.CommondbException; + +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDEEXCEPTIONS*/ +@Entity(name="TgeneSolicitudeExceptions") +@Table(name="TGENESOLICITUDEEXCEPTIONS") +public class TgeneSolicitudeExceptions extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeExceptions +*/ +@EmbeddedId +private TgeneSolicitudeExceptionsKey pk; +@Column(name="PROFILECODE", nullable=true) + +/** +* Codigo de perfil de usuario +*/ +private String profilecode; + +@Column(name="USERCODE", nullable=true) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="MODULECODE", nullable=true) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="STATUSCODE", nullable=true) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +@Column(name="CONDITION", nullable=true) + +/** +* Condicion a evaluar +*/ +private String condition; + +@Column(name="STRINGVALUE", nullable=true) + +/** +* Valor a compar con el dato del campo +*/ +private String stringvalue; + +@Column(name="NUMERICVALUE", nullable=true) + +/** +* Valor a compar con el dato del campo +*/ +private BigDecimal numericvalue; + +@Column(name="EXCEPTION", nullable=true) + +/** +* Mensaje compuesto por el titulo de la excepcion condicion y valor +*/ +private String exception; + +@Column(name="OBSERVATTION", nullable=true) + +/** +* Texto libre del usuario que aprueba o niega la excepcion +*/ +private String observattion; + +/**Contructor por defecto*/ +public TgeneSolicitudeExceptions(){ +} +/**Contructor de TgeneSolicitudeExceptions +@param pPk Clave Primaria del entity +*/ +public TgeneSolicitudeExceptions(TgeneSolicitudeExceptionsKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSolicitudeExceptions +*/ +public static TgeneSolicitudeExceptions find(EntityManager pEntityManager,TgeneSolicitudeExceptionsKey pKey) throws Exception{ + TgeneSolicitudeExceptions obj = pEntityManager.find(TgeneSolicitudeExceptions.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSolicitudeExceptions +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeExceptions +*/ +public TgeneSolicitudeExceptionsKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeExceptions +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeExceptions +*/ +public void setPk(TgeneSolicitudeExceptionsKey pPk){ + pk=pPk; +} +/**Obtiene el valor de profilecode +@return valor de profilecode*/ +public String getProfilecode(){ + return profilecode; +} +/**Fija el valor de profilecode +@param pProfilecode nuevo Valor de profilecode*/ +public void setProfilecode(String pProfilecode){ + profilecode=pProfilecode; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Obtiene el valor de condition +@return valor de condition*/ +public String getCondition(){ + return condition; +} +/**Fija el valor de condition +@param pCondition nuevo Valor de condition*/ +public void setCondition(String pCondition){ + condition=pCondition; +} + +/**Obtiene el valor de stringvalue +@return valor de stringvalue*/ +public String getStringvalue(){ + return stringvalue; +} +/**Fija el valor de stringvalue +@param pStringvalue nuevo Valor de stringvalue*/ +public void setStringvalue(String pStringvalue){ + stringvalue=pStringvalue; +} + +/**Obtiene el valor de numericvalue +@return valor de numericvalue*/ +public BigDecimal getNumericvalue(){ + return numericvalue; +} +/**Fija el valor de numericvalue +@param pNumericvalue nuevo Valor de numericvalue*/ +public void setNumericvalue(BigDecimal pNumericvalue){ + numericvalue=pNumericvalue; +} + +/**Obtiene el valor de exception +@return valor de exception*/ +public String getException(){ + return exception; +} +/**Fija el valor de exception +@param pException nuevo Valor de exception*/ +public void setException(String pException){ + exception=pException; +} + +/**Obtiene el valor de observattion +@return valor de observattion*/ +public String getObservattion(){ + return observattion; +} +/**Fija el valor de observattion +@param pObservattion nuevo Valor de observattion*/ +public void setObservattion(String pObservattion){ + observattion=pObservattion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeExceptions))return false; + TgeneSolicitudeExceptions that = (TgeneSolicitudeExceptions) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeExceptions +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSolicitudeExceptions +*/ +public Object createInstance(){ + TgeneSolicitudeExceptions instance=new TgeneSolicitudeExceptions(); + instance.setPk(new TgeneSolicitudeExceptionsKey()); + return instance; +} +/**Clona la entidad TgeneSolicitudeExceptions +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeExceptions p=(TgeneSolicitudeExceptions)this.clone(); + p.setPk((TgeneSolicitudeExceptionsKey)this.pk.cloneMe()); + return p; +} + + //METODOS MANUALES + /** Sentencia que devuelve las excepciones de una solicitud. */ + private static final String JPQL_SOLICITUDE_EXCEPTIONS = "from TgeneSolicitudeExceptions solexe " + + " where solexe.pk.solicitudnumber = :solicitudnumber " + " and solexe.pk.solicitudsequence = :solicitudsequence " + + " order by solexe.pk.exceptionorder "; + /** + * Entrega una lista de excepciones de solicitud. + * + * @param pSolicitudenumber Numero de solicitud. + * @param pSolicitudesequence Secuencia interna de la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findBySolicitudeNumber(EntityManager pEntityManager, String pSolicitudenumber, Integer pSolicitudesequence) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(TgeneSolicitudeExceptions.JPQL_SOLICITUDE_EXCEPTIONS); + qry.setParameter("solicitudnumber", pSolicitudenumber); + qry.setParameter("solicitudsequence", pSolicitudesequence); + lObjects = qry.getResultList(); + return lObjects; + } + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/.svn/text-base/TgeneSolicitudeExceptionsKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/.svn/text-base/TgeneSolicitudeExceptionsKey.java.svn-base new file mode 100644 index 0000000..7a72238 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/.svn/text-base/TgeneSolicitudeExceptionsKey.java.svn-base @@ -0,0 +1,205 @@ +package com.fp.persistence.pgeneral.auth; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDEEXCEPTIONS*/ +@Embeddable +public class TgeneSolicitudeExceptionsKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="BEAN", nullable=false,updatable=false) + +/** +* Bean del cual se obtiene el valor del atributo a evaluar +*/ +private String bean; + +@Column(name="ATTRIBUTE", nullable=false,updatable=false) + +/** +* Atributo a obtener el valor para aplicar la condicion y comparar con el dato del campo valor +*/ +private String attribute; + +@Column(name="EXCEPTIONORDER", nullable=false,updatable=false) + +/** +* Orden de generacion de autorizaciones +*/ +private Integer exceptionorder; + +/**Contructor por defecto*/ +public TgeneSolicitudeExceptionsKey(){} +/**Contructor de TgeneSolicitudeExceptionsKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pBean Bean del cual se obtiene el valor del atributo a evaluar +@param pAttribute Atributo a obtener el valor para aplicar la condicion y comparar con el dato del campo valor +@param pExceptionorder Orden de generacion de autorizaciones +*/ +public TgeneSolicitudeExceptionsKey(String pSolicitudnumber,Integer pSolicitudsequence,String pBean,String pAttribute,Integer pExceptionorder){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + bean=pBean; + attribute=pAttribute; + exceptionorder=pExceptionorder; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de bean +@return valor de bean*/ +public String getBean(){ + return bean; +} +/**Fija el valor de bean +@param pBean nuevo Valor de bean*/ +public void setBean(String pBean){ + bean=pBean; +} + +/**Obtiene el valor de attribute +@return valor de attribute*/ +public String getAttribute(){ + return attribute; +} +/**Fija el valor de attribute +@param pAttribute nuevo Valor de attribute*/ +public void setAttribute(String pAttribute){ + attribute=pAttribute; +} + +/**Obtiene el valor de exceptionorder +@return valor de exceptionorder*/ +public Integer getExceptionorder(){ + return exceptionorder; +} +/**Fija el valor de exceptionorder +@param pExceptionorder nuevo Valor de exceptionorder*/ +public void setExceptionorder(Integer pExceptionorder){ + exceptionorder=pExceptionorder; +} + +/**Implementacin de la comparacin de TgeneSolicitudeExceptionsKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeExceptionsKey))return false; + TgeneSolicitudeExceptionsKey that = (TgeneSolicitudeExceptionsKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getBean() == null || that.getBean() == null){ + return false; + } + if (! this.getBean().equals(that.getBean())){ + return false; + } + if (this.getAttribute() == null || that.getAttribute() == null){ + return false; + } + if (! this.getAttribute().equals(that.getAttribute())){ + return false; + } + if (this.getExceptionorder() == null || that.getExceptionorder() == null){ + return false; + } + if (! this.getExceptionorder().equals(that.getExceptionorder())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeExceptionsKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getBean() == null ? 0 : this.getBean().hashCode()); + result = result * 37 + (this.getAttribute() == null ? 0 : this.getAttribute().hashCode()); + result = result * 37 + (this.getExceptionorder() == null ? 0 : this.getExceptionorder().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/TgeneExceptions.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/TgeneExceptions.java new file mode 100644 index 0000000..8e6d5d5 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/TgeneExceptions.java @@ -0,0 +1,268 @@ +package com.fp.persistence.pgeneral.auth; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEEXCEPTIONS*/ +@Entity(name="TgeneExceptions") +@Table(name="TGENEEXCEPTIONS") +public class TgeneExceptions extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneExceptions +*/ +@EmbeddedId +private TgeneExceptionsKey pk; +@Column(name="PROFILECODE", nullable=true) + +/** +* Codigo de perfil de usuario +*/ +private String profilecode; + +@Column(name="CONDITION", nullable=true) + +/** +* Condicion a evaluar +*/ +private String condition; + +@Column(name="STRINGVALUE", nullable=true) + +/** +* Valor a compar con el dato del campo +*/ +private String stringvalue; + +@Column(name="NUMERICVALUE", nullable=true) + +/** +* Valor a compar con el dato del campo +*/ +private BigDecimal numericvalue; + +@Column(name="TITLE", nullable=true) + +/** +* Titulo de la condicion a generar, ejemplo MONTO > 100 +*/ +private String title; + +@Column(name="COMMAND", nullable=true) + +/** +* Clase que genera una condicion especial, ejemplo nacionalidad = ECUATORIANA +*/ +private String command; + +/**Contructor por defecto*/ +public TgeneExceptions(){ +} +/**Contructor de TgeneExceptions +@param pPk Clave Primaria del entity +*/ +public TgeneExceptions(TgeneExceptionsKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneExceptions +*/ +public static TgeneExceptions find(EntityManager pEntityManager,TgeneExceptionsKey pKey) throws Exception{ + TgeneExceptions obj = pEntityManager.find(TgeneExceptions.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneExceptions +@return El objeto que referencia a la Clave primaria de TgeneExceptions +*/ +public TgeneExceptionsKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneExceptions +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneExceptions +*/ +public void setPk(TgeneExceptionsKey pPk){ + pk=pPk; +} +/**Obtiene el valor de profilecode +@return valor de profilecode*/ +public String getProfilecode(){ + return profilecode; +} +/**Fija el valor de profilecode +@param pProfilecode nuevo Valor de profilecode*/ +public void setProfilecode(String pProfilecode){ + profilecode=pProfilecode; +} + +/**Obtiene el valor de condition +@return valor de condition*/ +public String getCondition(){ + return condition; +} +/**Fija el valor de condition +@param pCondition nuevo Valor de condition*/ +public void setCondition(String pCondition){ + condition=pCondition; +} + +/**Obtiene el valor de stringvalue +@return valor de stringvalue*/ +public String getStringvalue(){ + return stringvalue; +} +/**Fija el valor de stringvalue +@param pStringvalue nuevo Valor de stringvalue*/ +public void setStringvalue(String pStringvalue){ + stringvalue=pStringvalue; +} + +/**Obtiene el valor de numericvalue +@return valor de numericvalue*/ +public BigDecimal getNumericvalue(){ + return numericvalue; +} +/**Fija el valor de numericvalue +@param pNumericvalue nuevo Valor de numericvalue*/ +public void setNumericvalue(BigDecimal pNumericvalue){ + numericvalue=pNumericvalue; +} + +/**Obtiene el valor de title +@return valor de title*/ +public String getTitle(){ + return title; +} +/**Fija el valor de title +@param pTitle nuevo Valor de title*/ +public void setTitle(String pTitle){ + title=pTitle; +} + +/**Obtiene el valor de command +@return valor de command*/ +public String getCommand(){ + return command; +} +/**Fija el valor de command +@param pCommand nuevo Valor de command*/ +public void setCommand(String pCommand){ + command=pCommand; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneExceptions))return false; + TgeneExceptions that = (TgeneExceptions) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneExceptions +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneExceptions +*/ +public Object createInstance(){ + TgeneExceptions instance=new TgeneExceptions(); + instance.setPk(new TgeneExceptionsKey()); + return instance; +} +/**Clona la entidad TgeneExceptions +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneExceptions p=(TgeneExceptions)this.clone(); + p.setPk((TgeneExceptionsKey)this.pk.cloneMe()); + return p; +} + + //Metodos manuales. + /**Sentencia que devuelve la definicion de excepciones que requieren autorizacion, por subproducto moneda.*/ + private static final String HQL_EXCEPTIONS = + "from TgeneExceptions texception " + + " where texception.pk.modulecode = :modulecode "+ + " and texception.pk.productcode = :productcode "+ + " and texception.pk.subproductcode = :subproductcode "+ + " and texception.pk.currencycode = :currencycode "+ + " order by texception.pk.exceptionorder "; + + /** + * Entrega una lista de excepciones de solicitud definidas por subproducto moneda, con la cual + * se generan excepciones a autorizar en una solicitud. + * @param pModuleCode Codigo de modulo. + * @param pProductCode Codigo de product. + * @param pSubproductCode Codigo de subproducto. + * @param pCurrencyCode Codigo de moneda. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager,String pModuleCode,String pProductCode, + String pSubproductCode,String pCurrencyCode) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_EXCEPTIONS); + qry.setParameter("modulecode", pModuleCode); + qry.setParameter("productcode", pProductCode); + qry.setParameter("subproductcode", pSubproductCode); + qry.setParameter("currencycode", pCurrencyCode); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/TgeneExceptionsKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/TgeneExceptionsKey.java new file mode 100644 index 0000000..8bfdab2 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/TgeneExceptionsKey.java @@ -0,0 +1,259 @@ +package com.fp.persistence.pgeneral.auth; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEEXCEPTIONS*/ +@Embeddable +public class TgeneExceptionsKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="BEAN", nullable=false,updatable=false) + +/** +* Bean del cual se obtiene el valor del atributo a evaluar +*/ +private String bean; + +@Column(name="ATTRIBUTE", nullable=false,updatable=false) + +/** +* Atributo a obtener el valor para aplicar la condicion y comparar con el dato del campo valor +*/ +private String attribute; + +@Column(name="EXCEPTIONORDER", nullable=false,updatable=false) + +/** +* Orden de generacion de autorizaciones +*/ +private Integer exceptionorder; + +/**Contructor por defecto*/ +public TgeneExceptionsKey(){} +/**Contructor de TgeneExceptionsKey +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pCurrencycode Codigo de moneda +@param pBean Bean del cual se obtiene el valor del atributo a evaluar +@param pAttribute Atributo a obtener el valor para aplicar la condicion y comparar con el dato del campo valor +@param pExceptionorder Orden de generacion de autorizaciones +*/ +public TgeneExceptionsKey(String pModulecode,String pProductcode,String pSubproductcode,String pCurrencycode,String pBean,String pAttribute,Integer pExceptionorder){ + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + currencycode=pCurrencycode; + bean=pBean; + attribute=pAttribute; + exceptionorder=pExceptionorder; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de bean +@return valor de bean*/ +public String getBean(){ + return bean; +} +/**Fija el valor de bean +@param pBean nuevo Valor de bean*/ +public void setBean(String pBean){ + bean=pBean; +} + +/**Obtiene el valor de attribute +@return valor de attribute*/ +public String getAttribute(){ + return attribute; +} +/**Fija el valor de attribute +@param pAttribute nuevo Valor de attribute*/ +public void setAttribute(String pAttribute){ + attribute=pAttribute; +} + +/**Obtiene el valor de exceptionorder +@return valor de exceptionorder*/ +public Integer getExceptionorder(){ + return exceptionorder; +} +/**Fija el valor de exceptionorder +@param pExceptionorder nuevo Valor de exceptionorder*/ +public void setExceptionorder(Integer pExceptionorder){ + exceptionorder=pExceptionorder; +} + +/**Implementacin de la comparacin de TgeneExceptionsKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneExceptionsKey))return false; + TgeneExceptionsKey that = (TgeneExceptionsKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getBean() == null || that.getBean() == null){ + return false; + } + if (! this.getBean().equals(that.getBean())){ + return false; + } + if (this.getAttribute() == null || that.getAttribute() == null){ + return false; + } + if (! this.getAttribute().equals(that.getAttribute())){ + return false; + } + if (this.getExceptionorder() == null || that.getExceptionorder() == null){ + return false; + } + if (! this.getExceptionorder().equals(that.getExceptionorder())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneExceptionsKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getBean() == null ? 0 : this.getBean().hashCode()); + result = result * 37 + (this.getAttribute() == null ? 0 : this.getAttribute().hashCode()); + result = result * 37 + (this.getExceptionorder() == null ? 0 : this.getExceptionorder().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/TgeneSolicitudeClientdata.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/TgeneSolicitudeClientdata.java new file mode 100644 index 0000000..90a123b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/TgeneSolicitudeClientdata.java @@ -0,0 +1,341 @@ +package com.fp.persistence.pgeneral.auth; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDECLIENTDATA */ +@Entity(name = "TgeneSolicitudeClientdata") +@Table(name = "TGENESOLICITUDECLIENTDATA") +public class TgeneSolicitudeClientdata extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneSolicitudeClientdata + */ + @EmbeddedId + private TgeneSolicitudeClientdataKey pk; + + @Column(name = "USERCODE", nullable = true) + /** + * Codigo de usuario que verifica la informacion del cliente + */ + private String usercode; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro. + */ + private Integer recordversion; + + @Column(name = "CHECKED", nullable = true) + /** + * Y indica que la informacion fue verificada. N la informacion no esta verificada. + */ + private String checked; + + @Column(name = "CHECKDATE", nullable = true) + /** + * Fecha de verificacion de la informacion. + */ + private Date checkdate; + + @Column(name = "PRESENTATIONORDER", nullable = true) + /** + * Orden de presentacion + */ + private Integer presentationorder; + + /** Contructor por defecto */ + public TgeneSolicitudeClientdata() { + } + + /** + * Contructor de TgeneSolicitudeClientdata + * + * @param pPk Clave Primaria del entity + */ + public TgeneSolicitudeClientdata(TgeneSolicitudeClientdataKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSolicitudeClientdata + */ + public static TgeneSolicitudeClientdata find(EntityManager pEntityManager, TgeneSolicitudeClientdataKey pKey) throws Exception { + TgeneSolicitudeClientdata obj = pEntityManager.find(TgeneSolicitudeClientdata.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneSolicitudeClientdata + * + * @return El objeto que referencia a la Clave primaria de TgeneSolicitudeClientdata + */ + public TgeneSolicitudeClientdataKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneSolicitudeClientdata + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeClientdata + */ + public void setPk(TgeneSolicitudeClientdataKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de usercode + * + * @return valor de usercode + */ + public String getUsercode() { + return this.usercode; + } + + /** + * Fija el valor de usercode + * + * @param pUsercode nuevo Valor de usercode + */ + public void setUsercode(String pUsercode) { + this.usercode = pUsercode; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de checked + * + * @return valor de checked + */ + public String getChecked() { + return this.checked; + } + + /** + * Fija el valor de checked + * + * @param pChecked nuevo Valor de checked + */ + public void setChecked(String pChecked) { + this.checked = pChecked; + } + + /** + * Obtiene el valor de checkdate + * + * @return valor de checkdate + */ + public Date getCheckdate() { + return this.checkdate; + } + + /** + * Fija el valor de checkdate + * + * @param pCheckdate nuevo Valor de checkdate + */ + public void setCheckdate(Date pCheckdate) { + this.checkdate = pCheckdate; + } + + /** + * Obtiene el valor de presentationorder + * + * @return valor de presentationorder + */ + public Integer getPresentationorder() { + return this.presentationorder; + } + + /** + * Fija el valor de presentationorder + * + * @param pPresentationorder nuevo Valor de presentationorder + */ + public void setPresentationorder(Integer pPresentationorder) { + this.presentationorder = pPresentationorder; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneSolicitudeClientdata)) { + return false; + } + TgeneSolicitudeClientdata that = (TgeneSolicitudeClientdata) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneSolicitudeClientdata + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneSolicitudeClientdata */ + @Override + public Object createInstance() { + TgeneSolicitudeClientdata instance = new TgeneSolicitudeClientdata(); + instance.setPk(new TgeneSolicitudeClientdataKey()); + return instance; + } + + /** + * Clona la entidad TgeneSolicitudeClientdata + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneSolicitudeClientdata p = (TgeneSolicitudeClientdata) this.clone(); + p.setPk((TgeneSolicitudeClientdataKey) this.pk.cloneMe()); + return p; + } + + // Metodos manuales. + /** Sentencia que entrga una lista de registros de TgeneSolicitudeClientdata. */ + private static String JPQL = "from TgeneSolicitudeClientdata t where t.pk.solicitudnumber = :solicitudnumber and t.pk.solicitudsequence = :solicitudsequence"; + + /** + * Entrega una lista de {@link TgeneSolicitudeClientdata} dado el numero de solicitud y la secuencia de la + * solicitud. + * + * @param pEntityManager Referencia a la session de la base de datos. + * @param pSolicitudenumber Numero de solicitud. + * @param pSolicitudesequence Secuencia interna de la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pSolicitudenumber, Integer pSolicitudesequence) + throws Exception { + Query qry = pEntityManager.createQuery(TgeneSolicitudeClientdata.JPQL); + qry.setParameter("solicitudnumber", pSolicitudenumber); + qry.setParameter("solicitudsequence", pSolicitudesequence); + return qry.getResultList(); + + } + + + /** + * Sentencia SQL que devuelve un objeto de tipo TgeneSolicitudeClientdata + */ + private static final String JPQL_SOLICITUDE_CLIENT_DATA = "from TgeneSolicitudeClientdata tgs " + + " where tgs.pk.solicitudnumber = :solicitudnumber " + " and tgs.pk.solicitudsequence = :solicitudsequence " + + " and tgs.pk.title = :title " + " and tgs.pk.personcode = :personcode"; + /** + * Metodo que devuelve un objeto de tipo TgeneSolicitudeClientdata + * + * @param solicitudnumber + * @param solicitudsequence + * @param title + * @param personcode + * @return + * @throws Exception + */ + public static TgeneSolicitudeClientdata find(EntityManager pEntityManager, String solicitudnumber, Integer solicitudsequence, String title, Integer personcode) + throws Exception { + Query qry = pEntityManager.createQuery(TgeneSolicitudeClientdata.JPQL_SOLICITUDE_CLIENT_DATA); + qry.setParameter("solicitudnumber", solicitudnumber); + qry.setParameter("solicitudsequence", solicitudsequence); + qry.setParameter("title", title); + qry.setParameter("personcode", personcode); + try { + return (TgeneSolicitudeClientdata) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/TgeneSolicitudeClientdataKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/TgeneSolicitudeClientdataKey.java new file mode 100644 index 0000000..5e5d556 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/TgeneSolicitudeClientdataKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.auth; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDECLIENTDATA*/ +@Embeddable +public class TgeneSolicitudeClientdataKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="TITLE", nullable=false,updatable=false) + +/** +* Codigo de informacion de clientes requerido. +*/ +private String title; + +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona asociado a la solicitud. +*/ +private Integer personcode; + +/**Contructor por defecto*/ +public TgeneSolicitudeClientdataKey(){} +/**Contructor de TgeneSolicitudeClientdataKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pTitle Codigo de informacion de clientes requerido. +@param pPersoncode Codigo de persona asociado a la solicitud. +*/ +public TgeneSolicitudeClientdataKey(String pSolicitudnumber,Integer pSolicitudsequence,String pTitle,Integer pPersoncode){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + title=pTitle; + personcode=pPersoncode; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de title +@return valor de title*/ +public String getTitle(){ + return title; +} +/**Fija el valor de title +@param pTitle nuevo Valor de title*/ +public void setTitle(String pTitle){ + title=pTitle; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Implementacin de la comparacin de TgeneSolicitudeClientdataKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeClientdataKey))return false; + TgeneSolicitudeClientdataKey that = (TgeneSolicitudeClientdataKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getTitle() == null || that.getTitle() == null){ + return false; + } + if (! this.getTitle().equals(that.getTitle())){ + return false; + } + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeClientdataKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getTitle() == null ? 0 : this.getTitle().hashCode()); + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/TgeneSolicitudeExceptions.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/TgeneSolicitudeExceptions.java new file mode 100644 index 0000000..188f778 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/TgeneSolicitudeExceptions.java @@ -0,0 +1,315 @@ +package com.fp.persistence.pgeneral.auth; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.persistence.commondb.exception.CommondbException; + +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDEEXCEPTIONS*/ +@Entity(name="TgeneSolicitudeExceptions") +@Table(name="TGENESOLICITUDEEXCEPTIONS") +public class TgeneSolicitudeExceptions extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeExceptions +*/ +@EmbeddedId +private TgeneSolicitudeExceptionsKey pk; +@Column(name="PROFILECODE", nullable=true) + +/** +* Codigo de perfil de usuario +*/ +private String profilecode; + +@Column(name="USERCODE", nullable=true) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="MODULECODE", nullable=true) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="STATUSCODE", nullable=true) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +@Column(name="CONDITION", nullable=true) + +/** +* Condicion a evaluar +*/ +private String condition; + +@Column(name="STRINGVALUE", nullable=true) + +/** +* Valor a compar con el dato del campo +*/ +private String stringvalue; + +@Column(name="NUMERICVALUE", nullable=true) + +/** +* Valor a compar con el dato del campo +*/ +private BigDecimal numericvalue; + +@Column(name="EXCEPTION", nullable=true) + +/** +* Mensaje compuesto por el titulo de la excepcion condicion y valor +*/ +private String exception; + +@Column(name="OBSERVATTION", nullable=true) + +/** +* Texto libre del usuario que aprueba o niega la excepcion +*/ +private String observattion; + +/**Contructor por defecto*/ +public TgeneSolicitudeExceptions(){ +} +/**Contructor de TgeneSolicitudeExceptions +@param pPk Clave Primaria del entity +*/ +public TgeneSolicitudeExceptions(TgeneSolicitudeExceptionsKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSolicitudeExceptions +*/ +public static TgeneSolicitudeExceptions find(EntityManager pEntityManager,TgeneSolicitudeExceptionsKey pKey) throws Exception{ + TgeneSolicitudeExceptions obj = pEntityManager.find(TgeneSolicitudeExceptions.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSolicitudeExceptions +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeExceptions +*/ +public TgeneSolicitudeExceptionsKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeExceptions +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeExceptions +*/ +public void setPk(TgeneSolicitudeExceptionsKey pPk){ + pk=pPk; +} +/**Obtiene el valor de profilecode +@return valor de profilecode*/ +public String getProfilecode(){ + return profilecode; +} +/**Fija el valor de profilecode +@param pProfilecode nuevo Valor de profilecode*/ +public void setProfilecode(String pProfilecode){ + profilecode=pProfilecode; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Obtiene el valor de condition +@return valor de condition*/ +public String getCondition(){ + return condition; +} +/**Fija el valor de condition +@param pCondition nuevo Valor de condition*/ +public void setCondition(String pCondition){ + condition=pCondition; +} + +/**Obtiene el valor de stringvalue +@return valor de stringvalue*/ +public String getStringvalue(){ + return stringvalue; +} +/**Fija el valor de stringvalue +@param pStringvalue nuevo Valor de stringvalue*/ +public void setStringvalue(String pStringvalue){ + stringvalue=pStringvalue; +} + +/**Obtiene el valor de numericvalue +@return valor de numericvalue*/ +public BigDecimal getNumericvalue(){ + return numericvalue; +} +/**Fija el valor de numericvalue +@param pNumericvalue nuevo Valor de numericvalue*/ +public void setNumericvalue(BigDecimal pNumericvalue){ + numericvalue=pNumericvalue; +} + +/**Obtiene el valor de exception +@return valor de exception*/ +public String getException(){ + return exception; +} +/**Fija el valor de exception +@param pException nuevo Valor de exception*/ +public void setException(String pException){ + exception=pException; +} + +/**Obtiene el valor de observattion +@return valor de observattion*/ +public String getObservattion(){ + return observattion; +} +/**Fija el valor de observattion +@param pObservattion nuevo Valor de observattion*/ +public void setObservattion(String pObservattion){ + observattion=pObservattion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeExceptions))return false; + TgeneSolicitudeExceptions that = (TgeneSolicitudeExceptions) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeExceptions +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSolicitudeExceptions +*/ +public Object createInstance(){ + TgeneSolicitudeExceptions instance=new TgeneSolicitudeExceptions(); + instance.setPk(new TgeneSolicitudeExceptionsKey()); + return instance; +} +/**Clona la entidad TgeneSolicitudeExceptions +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeExceptions p=(TgeneSolicitudeExceptions)this.clone(); + p.setPk((TgeneSolicitudeExceptionsKey)this.pk.cloneMe()); + return p; +} + + //METODOS MANUALES + /** Sentencia que devuelve las excepciones de una solicitud. */ + private static final String JPQL_SOLICITUDE_EXCEPTIONS = "from TgeneSolicitudeExceptions solexe " + + " where solexe.pk.solicitudnumber = :solicitudnumber " + " and solexe.pk.solicitudsequence = :solicitudsequence " + + " order by solexe.pk.exceptionorder "; + /** + * Entrega una lista de excepciones de solicitud. + * + * @param pSolicitudenumber Numero de solicitud. + * @param pSolicitudesequence Secuencia interna de la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findBySolicitudeNumber(EntityManager pEntityManager, String pSolicitudenumber, Integer pSolicitudesequence) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(TgeneSolicitudeExceptions.JPQL_SOLICITUDE_EXCEPTIONS); + qry.setParameter("solicitudnumber", pSolicitudenumber); + qry.setParameter("solicitudsequence", pSolicitudesequence); + lObjects = qry.getResultList(); + return lObjects; + } + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/TgeneSolicitudeExceptionsKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/TgeneSolicitudeExceptionsKey.java new file mode 100644 index 0000000..7a72238 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/auth/TgeneSolicitudeExceptionsKey.java @@ -0,0 +1,205 @@ +package com.fp.persistence.pgeneral.auth; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDEEXCEPTIONS*/ +@Embeddable +public class TgeneSolicitudeExceptionsKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="BEAN", nullable=false,updatable=false) + +/** +* Bean del cual se obtiene el valor del atributo a evaluar +*/ +private String bean; + +@Column(name="ATTRIBUTE", nullable=false,updatable=false) + +/** +* Atributo a obtener el valor para aplicar la condicion y comparar con el dato del campo valor +*/ +private String attribute; + +@Column(name="EXCEPTIONORDER", nullable=false,updatable=false) + +/** +* Orden de generacion de autorizaciones +*/ +private Integer exceptionorder; + +/**Contructor por defecto*/ +public TgeneSolicitudeExceptionsKey(){} +/**Contructor de TgeneSolicitudeExceptionsKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pBean Bean del cual se obtiene el valor del atributo a evaluar +@param pAttribute Atributo a obtener el valor para aplicar la condicion y comparar con el dato del campo valor +@param pExceptionorder Orden de generacion de autorizaciones +*/ +public TgeneSolicitudeExceptionsKey(String pSolicitudnumber,Integer pSolicitudsequence,String pBean,String pAttribute,Integer pExceptionorder){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + bean=pBean; + attribute=pAttribute; + exceptionorder=pExceptionorder; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de bean +@return valor de bean*/ +public String getBean(){ + return bean; +} +/**Fija el valor de bean +@param pBean nuevo Valor de bean*/ +public void setBean(String pBean){ + bean=pBean; +} + +/**Obtiene el valor de attribute +@return valor de attribute*/ +public String getAttribute(){ + return attribute; +} +/**Fija el valor de attribute +@param pAttribute nuevo Valor de attribute*/ +public void setAttribute(String pAttribute){ + attribute=pAttribute; +} + +/**Obtiene el valor de exceptionorder +@return valor de exceptionorder*/ +public Integer getExceptionorder(){ + return exceptionorder; +} +/**Fija el valor de exceptionorder +@param pExceptionorder nuevo Valor de exceptionorder*/ +public void setExceptionorder(Integer pExceptionorder){ + exceptionorder=pExceptionorder; +} + +/**Implementacin de la comparacin de TgeneSolicitudeExceptionsKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeExceptionsKey))return false; + TgeneSolicitudeExceptionsKey that = (TgeneSolicitudeExceptionsKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getBean() == null || that.getBean() == null){ + return false; + } + if (! this.getBean().equals(that.getBean())){ + return false; + } + if (this.getAttribute() == null || that.getAttribute() == null){ + return false; + } + if (! this.getAttribute().equals(that.getAttribute())){ + return false; + } + if (this.getExceptionorder() == null || that.getExceptionorder() == null){ + return false; + } + if (! this.getExceptionorder().equals(that.getExceptionorder())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeExceptionsKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getBean() == null ? 0 : this.getBean().hashCode()); + result = result * 37 + (this.getAttribute() == null ? 0 : this.getAttribute().hashCode()); + result = result * 37 + (this.getExceptionorder() == null ? 0 : this.getExceptionorder().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/entries new file mode 100644 index 0000000..0f47395 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/entries @@ -0,0 +1,504 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneBatchLogKey.java +file + + + + +2022-07-28T03:40:29.143744Z +43151ba5eeaf70275a6d3468b3b75d88 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4305 + +TgeneAccountBatchProcess.java +file + + + + +2022-07-28T03:40:29.144744Z +ecb1007b1bd284b17af944b2f40e6900 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3973 + +TgeneBatchPreviousProcess.java +file + + + + +2022-07-28T03:40:29.144744Z +47b51ac7742b688accaa49a56487312f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6623 + +TgeneBatchLogPreviousProcess.java +file + + + + +2022-07-28T03:40:29.144744Z +363540362775676d66ef8233074eaca7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6853 + +TgeneBatchProcess.java +file + + + + +2022-07-28T03:40:29.144744Z +abff3e72de858da11f2a0b34eb606c4a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6860 + +TgeneBatch.java +file + + + + +2022-07-28T03:40:29.145744Z +e952654cb33fe8d210c3d39f1e1c4e7d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4709 + +TgeneAccountBatchStatus.java +file + + + + +2022-07-28T03:40:29.145744Z +1125f64e89c971737cea9d7b0b1730bf +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6390 + +TgeneBatchLog.java +file + + + + +2022-07-28T03:40:29.145744Z +c9d63aa2a80d4d43aba4e7026fa46cc1 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +13525 + +TgeneAccountBatchProcessKey.java +file + + + + +2022-07-28T03:40:29.145744Z +2662d704734da9378bfe680455986d32 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8774 + +TgeneBatchPreviousProcessKey.java +file + + + + +2022-07-28T03:40:29.146744Z +a109038cd6631371b68471f613bd23ff +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6472 + +TgeneBatchLogPreviousProcessKey.java +file + + + + +2022-07-28T03:40:29.146744Z +c5828e053b2f38a9c9a95ff4ecb99662 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5220 + +TgeneBatchProcessKey.java +file + + + + +2022-07-28T03:40:29.146744Z +7cb5544c90ba693153266b80bfeb5914 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6392 + +TgeneBatchKey.java +file + + + + +2022-07-28T03:40:29.147744Z +dfcc28493895bc80dc256ab3689bcb85 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5488 + +TgeneAccountBatchStatusKey.java +file + + + + +2022-07-28T03:40:29.147744Z +2674174537c6c4bef72132aea61459bc +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8119 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneAccountBatchProcess.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneAccountBatchProcess.java.svn-base new file mode 100644 index 0000000..97094ef --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneAccountBatchProcess.java.svn-base @@ -0,0 +1,122 @@ +package com.fp.persistence.pgeneral.batch; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTBATCHPROCESS*/ +@Entity(name="TgeneAccountBatchProcess") +@Table(name="TGENEACCOUNTBATCHPROCESS") +public class TgeneAccountBatchProcess extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountBatchProcess +*/ +@EmbeddedId +private TgeneAccountBatchProcessKey pk; +/**Contructor por defecto*/ +public TgeneAccountBatchProcess(){ +} +/**Contructor de TgeneAccountBatchProcess +@param pPk Clave Primaria del entity +*/ +public TgeneAccountBatchProcess(TgeneAccountBatchProcessKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountBatchProcess +*/ +public static TgeneAccountBatchProcess find(EntityManager pEntityManager,TgeneAccountBatchProcessKey pKey) throws Exception{ + TgeneAccountBatchProcess obj = pEntityManager.find(TgeneAccountBatchProcess.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountBatchProcess +@return El objeto que referencia a la Clave primaria de TgeneAccountBatchProcess +*/ +public TgeneAccountBatchProcessKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountBatchProcess +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountBatchProcess +*/ +public void setPk(TgeneAccountBatchProcessKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountBatchProcess))return false; + TgeneAccountBatchProcess that = (TgeneAccountBatchProcess) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountBatchProcess +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountBatchProcess +*/ +public Object createInstance(){ + TgeneAccountBatchProcess instance=new TgeneAccountBatchProcess(); + instance.setPk(new TgeneAccountBatchProcessKey()); + return instance; +} +/**Clona la entidad TgeneAccountBatchProcess +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountBatchProcess p=(TgeneAccountBatchProcess)this.clone(); + p.setPk((TgeneAccountBatchProcessKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneAccountBatchProcessKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneAccountBatchProcessKey.java.svn-base new file mode 100644 index 0000000..e719cd5 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneAccountBatchProcessKey.java.svn-base @@ -0,0 +1,287 @@ +package com.fp.persistence.pgeneral.batch; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTBATCHPROCESS*/ +@Embeddable +public class TgeneAccountBatchProcessKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="PROCESSDATE", nullable=false,updatable=false) + +/** +* Fecha de proceso de la ejecucion del batch. +*/ +private Date processdate; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="ACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de accion a ajecutar, ejm, CAPITALIZE, CUT +*/ +private String actioncode; + +/**Contructor por defecto*/ +public TgeneAccountBatchProcessKey(){} +/**Contructor de TgeneAccountBatchProcessKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pProcessdate Fecha de proceso de la ejecucion del batch. +@param pModulecode Codigo de modulo +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pActioncode Codigo de accion a ajecutar, ejm, CAPITALIZE, CUT +*/ +public TgeneAccountBatchProcessKey(String pAccount,Integer pCompany,Date pProcessdate,String pModulecode,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,String pActioncode){ + account=pAccount; + company=pCompany; + processdate=pProcessdate; + modulecode=pModulecode; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + actioncode=pActioncode; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de processdate +@return valor de processdate*/ +public Date getProcessdate(){ + return processdate; +} +/**Fija el valor de processdate +@param pProcessdate nuevo Valor de processdate*/ +public void setProcessdate(Date pProcessdate){ + processdate=pProcessdate; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de actioncode +@return valor de actioncode*/ +public String getActioncode(){ + return actioncode; +} +/**Fija el valor de actioncode +@param pActioncode nuevo Valor de actioncode*/ +public void setActioncode(String pActioncode){ + actioncode=pActioncode; +} + +/**Implementacin de la comparacin de TgeneAccountBatchProcessKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountBatchProcessKey))return false; + TgeneAccountBatchProcessKey that = (TgeneAccountBatchProcessKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getProcessdate() == null || that.getProcessdate() == null){ + return false; + } + if (! this.getProcessdate().equals(that.getProcessdate())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getActioncode() == null || that.getActioncode() == null){ + return false; + } + if (! this.getActioncode().equals(that.getActioncode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountBatchProcessKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getProcessdate() == null ? 0 : this.getProcessdate().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getActioncode() == null ? 0 : this.getActioncode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneAccountBatchStatus.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneAccountBatchStatus.java.svn-base new file mode 100644 index 0000000..d974c10 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneAccountBatchStatus.java.svn-base @@ -0,0 +1,215 @@ +package com.fp.persistence.pgeneral.batch; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTBATCHSTATUS*/ +@Entity(name="TgeneAccountBatchStatus") +@Table(name="TGENEACCOUNTBATCHSTATUS") +public class TgeneAccountBatchStatus extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountBatchStatus +*/ +@EmbeddedId +private TgeneAccountBatchStatusKey pk; +@Column(name="RESULTCODE", nullable=false) + +/** +* Codigo de resultado de ejecucion de todos los procesos para la cuenta. +*/ +private String resultcode; + +@Column(name="USERMESSAGE", nullable=true) + +/** +* Mensaje de usuario resultante del proceso de batch para la cuenta. +*/ +private String usermessage; + +@Column(name="TECHNICALMESSAGE", nullable=true) + +/** +* Mensaje tecnico, se llena si la transaccion tiene un resultado diferente de ok. +*/ +private String technicalmessage; + +@Column(name="REALDATE", nullable=true, insertable=false) + +/** +* Fecha real de proceso de la cuenta. +*/ +private Timestamp realdate; + +@Column(name="ACTIONCODE", nullable=true) + +/** +* Si se presenta un error, en el campo se almacena la accion en la se presento el error +*/ +private String actioncode; + +/**Contructor por defecto*/ +public TgeneAccountBatchStatus(){ +} +/**Contructor de TgeneAccountBatchStatus +@param pPk Clave Primaria del entity +@param pResultcode Codigo de resultado de ejecucion de todos los procesos para la cuenta. +*/ +public TgeneAccountBatchStatus(TgeneAccountBatchStatusKey pPk,String pResultcode){ + this(); + pk=pPk; + resultcode=pResultcode; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountBatchStatus +*/ +public static TgeneAccountBatchStatus find(EntityManager pEntityManager,TgeneAccountBatchStatusKey pKey) throws Exception{ + TgeneAccountBatchStatus obj = pEntityManager.find(TgeneAccountBatchStatus.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountBatchStatus +@return El objeto que referencia a la Clave primaria de TgeneAccountBatchStatus +*/ +public TgeneAccountBatchStatusKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountBatchStatus +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountBatchStatus +*/ +public void setPk(TgeneAccountBatchStatusKey pPk){ + pk=pPk; +} +/**Obtiene el valor de resultcode +@return valor de resultcode*/ +public String getResultcode(){ + return resultcode; +} +/**Fija el valor de resultcode +@param pResultcode nuevo Valor de resultcode*/ +public void setResultcode(String pResultcode){ + resultcode=pResultcode; +} + +/**Obtiene el valor de usermessage +@return valor de usermessage*/ +public String getUsermessage(){ + return usermessage; +} +/**Fija el valor de usermessage +@param pUsermessage nuevo Valor de usermessage*/ +public void setUsermessage(String pUsermessage){ + usermessage=pUsermessage; +} + +/**Obtiene el valor de technicalmessage +@return valor de technicalmessage*/ +public String getTechnicalmessage(){ + return technicalmessage; +} +/**Fija el valor de technicalmessage +@param pTechnicalmessage nuevo Valor de technicalmessage*/ +public void setTechnicalmessage(String pTechnicalmessage){ + technicalmessage=pTechnicalmessage; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Timestamp getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Timestamp pRealdate){ + realdate=pRealdate; +} + +/**Obtiene el valor de actioncode +@return valor de actioncode*/ +public String getActioncode(){ + return actioncode; +} +/**Fija el valor de actioncode +@param pActioncode nuevo Valor de actioncode*/ +public void setActioncode(String pActioncode){ + actioncode=pActioncode; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountBatchStatus))return false; + TgeneAccountBatchStatus that = (TgeneAccountBatchStatus) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountBatchStatus +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountBatchStatus +*/ +public Object createInstance(){ + TgeneAccountBatchStatus instance=new TgeneAccountBatchStatus(); + instance.setPk(new TgeneAccountBatchStatusKey()); + return instance; +} +/**Clona la entidad TgeneAccountBatchStatus +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountBatchStatus p=(TgeneAccountBatchStatus)this.clone(); + p.setPk((TgeneAccountBatchStatusKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneAccountBatchStatusKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneAccountBatchStatusKey.java.svn-base new file mode 100644 index 0000000..3c23994 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneAccountBatchStatusKey.java.svn-base @@ -0,0 +1,260 @@ +package com.fp.persistence.pgeneral.batch; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTBATCHSTATUS*/ +@Embeddable +public class TgeneAccountBatchStatusKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="PROCESSDATE", nullable=false,updatable=false) + +/** +* Si los proceso a ejecutar en el fin de dia no tienen errores se almacena la proxima fecha contable, este campo se utiliza en el non stop +*/ +private Date processdate; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +/**Contructor por defecto*/ +public TgeneAccountBatchStatusKey(){} +/**Contructor de TgeneAccountBatchStatusKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pProcessdate Si los proceso a ejecutar en el fin de dia no tienen errores se almacena la proxima fecha contable, este campo se utiliza en el non stop +@param pModulecode Codigo de modulo +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +*/ +public TgeneAccountBatchStatusKey(String pAccount,Integer pCompany,Date pProcessdate,String pModulecode,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion){ + account=pAccount; + company=pCompany; + processdate=pProcessdate; + modulecode=pModulecode; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de processdate +@return valor de processdate*/ +public Date getProcessdate(){ + return processdate; +} +/**Fija el valor de processdate +@param pProcessdate nuevo Valor de processdate*/ +public void setProcessdate(Date pProcessdate){ + processdate=pProcessdate; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Implementacin de la comparacin de TgeneAccountBatchStatusKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountBatchStatusKey))return false; + TgeneAccountBatchStatusKey that = (TgeneAccountBatchStatusKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getProcessdate() == null || that.getProcessdate() == null){ + return false; + } + if (! this.getProcessdate().equals(that.getProcessdate())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountBatchStatusKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getProcessdate() == null ? 0 : this.getProcessdate().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatch.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatch.java.svn-base new file mode 100644 index 0000000..4bbc032 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatch.java.svn-base @@ -0,0 +1,175 @@ +package com.fp.persistence.pgeneral.batch; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEBATCH*/ +@Entity(name="TgeneBatch") +@Table(name="TGENEBATCH") +public class TgeneBatch extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneBatch +*/ +@EmbeddedId +private TgeneBatchKey pk; +@Column(name="ACTIVE", nullable=true) + +/** +* Y se ejecuta la regla al ejecutar el fin de dia, N no se ejecuta la regla al ejecutar el fin de dia. +*/ +private String active; + +@Column(name="PROCESSORDER", nullable=true) + +/** +* Orden de ejecucion de modulo +*/ +private Integer processorder; + +@Column(name="THREADS", nullable=true) + +/** +* Numero de hilos a levantar por modulo. +*/ +private Integer threads; + +/**Contructor por defecto*/ +public TgeneBatch(){ +} +/**Contructor de TgeneBatch +@param pPk Clave Primaria del entity +*/ +public TgeneBatch(TgeneBatchKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneBatch +*/ +public static TgeneBatch find(EntityManager pEntityManager,TgeneBatchKey pKey) throws Exception{ + TgeneBatch obj = pEntityManager.find(TgeneBatch.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneBatch +@return El objeto que referencia a la Clave primaria de TgeneBatch +*/ +public TgeneBatchKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneBatch +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneBatch +*/ +public void setPk(TgeneBatchKey pPk){ + pk=pPk; +} +/**Obtiene el valor de active +@return valor de active*/ +public String getActive(){ + return active; +} +/**Fija el valor de active +@param pActive nuevo Valor de active*/ +public void setActive(String pActive){ + active=pActive; +} + +/**Obtiene el valor de processorder +@return valor de processorder*/ +public Integer getProcessorder(){ + return processorder; +} +/**Fija el valor de processorder +@param pProcessorder nuevo Valor de processorder*/ +public void setProcessorder(Integer pProcessorder){ + processorder=pProcessorder; +} + +/**Obtiene el valor de threads +@return valor de threads*/ +public Integer getThreads(){ + return threads; +} +/**Fija el valor de threads +@param pThreads nuevo Valor de threads*/ +public void setThreads(Integer pThreads){ + threads=pThreads; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneBatch))return false; + TgeneBatch that = (TgeneBatch) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneBatch +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneBatch +*/ +public Object createInstance(){ + TgeneBatch instance=new TgeneBatch(); + instance.setPk(new TgeneBatchKey()); + return instance; +} +/**Clona la entidad TgeneBatch +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneBatch p=(TgeneBatch)this.clone(); + p.setPk((TgeneBatchKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchKey.java.svn-base new file mode 100644 index 0000000..f3c9790 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.batch; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEBATCH*/ +@Embeddable +public class TgeneBatchKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +/**Contructor por defecto*/ +public TgeneBatchKey(){} +/**Contructor de TgeneBatchKey +@param pModulecode Codigo de modulo +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +*/ +public TgeneBatchKey(String pModulecode,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion){ + modulecode=pModulecode; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Implementacin de la comparacin de TgeneBatchKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneBatchKey))return false; + TgeneBatchKey that = (TgeneBatchKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneBatchKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchLog.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchLog.java.svn-base new file mode 100644 index 0000000..8ef6201 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchLog.java.svn-base @@ -0,0 +1,465 @@ +package com.fp.persistence.pgeneral.batch; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEBATCHLOG */ +@Entity(name = "TgeneBatchLog") +@Table(name = "TGENEBATCHLOG") +public class TgeneBatchLog extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneBatchLog + */ + @EmbeddedId + private TgeneBatchLogKey pk; + + @Column(name = "TRANSACTIONMODULE", nullable = true) + /** + * Modulo al que pertence la transaccion + */ + private String transactionmodule; + + @Column(name = "TRANSACTIONCODE", nullable = true) + /** + * Codigo de transaccion dentro del modulo + */ + private Integer transactioncode; + + @Column(name = "TRANSACTIONVERSION", nullable = true) + /** + * Version de transaccion + */ + private Integer transactionversion; + + @Column(name = "FINITDATE", nullable = true) + /** + * Fecha real de inicio de ejecucin del batch + */ + private Timestamp finitdate; + + @Column(name = "FENDDATE", nullable = true) + /** + * Fecha fin real de ejecucin del batch + */ + private Timestamp fenddate; + + @Column(name = "TOTAL", nullable = true) + /** + * Nmero total de cuentas a procesar + */ + private Integer total; + + @Column(name = "EXECUTED", nullable = true) + /** + * Nmero total de cuentas ejecutadas + */ + private Integer executed; + + @Column(name = "TOTALOK", nullable = true) + /** + * Nmero de cuentas ejecutadas exitosamente + */ + private Integer totalok; + + @Column(name = "TOTALERROR", nullable = true) + /** + * Nmero de cuentas ejecutadas con error + */ + private Integer totalerror; + + /** Contructor por defecto */ + public TgeneBatchLog() { + } + + /** + * Contructor de TgeneBatchLog + * + * @param pPk Clave Primaria del entity + */ + public TgeneBatchLog(TgeneBatchLogKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneBatchLog + */ + public static TgeneBatchLog find(EntityManager pEntityManager, TgeneBatchLogKey pKey) throws Exception { + TgeneBatchLog obj = pEntityManager.find(TgeneBatchLog.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneBatchLog + * + * @return El objeto que referencia a la Clave primaria de TgeneBatchLog + */ + public TgeneBatchLogKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneBatchLog + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneBatchLog + */ + public void setPk(TgeneBatchLogKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de transactionmodule + * + * @return valor de transactionmodule + */ + public String getTransactionmodule() { + return this.transactionmodule; + } + + /** + * Fija el valor de transactionmodule + * + * @param pTransactionmodule nuevo Valor de transactionmodule + */ + public void setTransactionmodule(String pTransactionmodule) { + this.transactionmodule = pTransactionmodule; + } + + /** + * Obtiene el valor de transactioncode + * + * @return valor de transactioncode + */ + public Integer getTransactioncode() { + return this.transactioncode; + } + + /** + * Fija el valor de transactioncode + * + * @param pTransactioncode nuevo Valor de transactioncode + */ + public void setTransactioncode(Integer pTransactioncode) { + this.transactioncode = pTransactioncode; + } + + /** + * Obtiene el valor de transactionversion + * + * @return valor de transactionversion + */ + public Integer getTransactionversion() { + return this.transactionversion; + } + + /** + * Fija el valor de transactionversion + * + * @param pTransactionversion nuevo Valor de transactionversion + */ + public void setTransactionversion(Integer pTransactionversion) { + this.transactionversion = pTransactionversion; + } + + /** + * Obtiene el valor de finitdate + * + * @return valor de finitdate + */ + public Timestamp getFinitdate() { + return this.finitdate; + } + + /** + * Fija el valor de finitdate + * + * @param pFinitdate nuevo Valor de finitdate + */ + public void setFinitdate(Timestamp pFinitdate) { + this.finitdate = pFinitdate; + } + + /** + * Obtiene el valor de fenddate + * + * @return valor de fenddate + */ + public Timestamp getFenddate() { + return this.fenddate; + } + + /** + * Fija el valor de fenddate + * + * @param pFenddate nuevo Valor de fenddate + */ + public void setFenddate(Timestamp pFenddate) { + this.fenddate = pFenddate; + } + + /** + * Obtiene el valor de total + * + * @return valor de total + */ + public Integer getTotal() { + return this.total; + } + + /** + * Fija el valor de total + * + * @param pTotal nuevo Valor de total + */ + public void setTotal(Integer pTotal) { + this.total = pTotal; + } + + /** + * Obtiene el valor de executed + * + * @return valor de executed + */ + public Integer getExecuted() { + return this.executed; + } + + /** + * Fija el valor de executed + * + * @param pExecuted nuevo Valor de executed + */ + public void setExecuted(Integer pExecuted) { + this.executed = pExecuted; + } + + /** + * Obtiene el valor de totalok + * + * @return valor de totalok + */ + public Integer getTotalok() { + return this.totalok; + } + + /** + * Fija el valor de totalok + * + * @param pTotalok nuevo Valor de totalok + */ + public void setTotalok(Integer pTotalok) { + this.totalok = pTotalok; + } + + /** + * Obtiene el valor de totalerror + * + * @return valor de totalerror + */ + public Integer getTotalerror() { + return this.totalerror; + } + + /** + * Fija el valor de totalerror + * + * @param pTotalerror nuevo Valor de totalerror + */ + public void setTotalerror(Integer pTotalerror) { + this.totalerror = pTotalerror; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneBatchLog)) { + return false; + } + TgeneBatchLog that = (TgeneBatchLog) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneBatchLog + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneBatchLog */ + @Override + public Object createInstance() { + TgeneBatchLog instance = new TgeneBatchLog(); + instance.setPk(new TgeneBatchLogKey()); + return instance; + } + + /** + * Clona la entidad TgeneBatchLog + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneBatchLog p = (TgeneBatchLog) this.clone(); + p.setPk((TgeneBatchLogKey) this.pk.cloneMe()); + return p; + } + + // METODOS MANUALES + private static final String JPQL_BATCH_IN_EXECUTION = "from TgeneBatchLog t " + + "where t.transactionmodule = :transactionmodule and t.transactioncode = :transactioncode " + + "and t.transactionversion =:transactionversion and t.pk.processdate = :processdate and t.fenddate is null "; + + /** + * Metodo que retorna un registro que representa si un batch est en ejecucion dada la fecha de proceso + * + * @param pEntityManager + * @param transactionmodule + * @param transactioncode + * @param transactionversion + * @param processdate + * @return + * @throws Exception + */ + public static TgeneBatchLog findBatchInExecution(EntityManager pEntityManager, Date processdate, String transactionmodule, + Integer transactioncode, Integer transactionversion) throws Exception { + TgeneBatchLog tgeneBatchLog = null; + Query qry = pEntityManager.createQuery(TgeneBatchLog.JPQL_BATCH_IN_EXECUTION); + qry.setParameter("processdate", processdate); + qry.setParameter("transactionmodule", transactionmodule); + qry.setParameter("transactioncode", transactioncode); + qry.setParameter("transactionversion", transactionversion); + + try { + tgeneBatchLog = (TgeneBatchLog) qry.getSingleResult(); + } catch (NoResultException e) { + } + return tgeneBatchLog; + } + + private static final String JPQL_PENDING_BATCH_BY_MODULE = "from TgeneBatchLog t " + + "where t.pk.processdate = :processdate and t.pk.journalid = :journalid and t.pk.modulecode = :modulecode and t.fenddate is null "; + + /** + * Metodo que retorna un registro que representa si un batch est en ejecucion dada la fecha de proceso + * + * @param pEntityManager + * @param transactionmodule + * @param transactioncode + * @param transactionversion + * @param processdate + * @return + * @throws Exception + */ + public static TgeneBatchLog findPendingBatchByModule(EntityManager pEntityManager, Date processdate, String journalid, String modulecode) + throws Exception { + TgeneBatchLog tgeneBatchLog = null; + Query qry = pEntityManager.createQuery(TgeneBatchLog.JPQL_PENDING_BATCH_BY_MODULE); + qry.setParameter("processdate", processdate); + qry.setParameter("journalid", journalid); + qry.setParameter("modulecode", modulecode); + try { + tgeneBatchLog = (TgeneBatchLog) qry.getSingleResult(); + } catch (NoResultException e) { + } + return tgeneBatchLog; + } + + private static final String JPQL_BATCH_BY_JOURNALID = "from TgeneBatchLog t " + + "where t.pk.processdate = :processdate and t.pk.journalid = :journalid "; + + /** + * Metodo que retorna un registro que representa si un batch est en ejecucion dada la fecha de proceso + * + * @param pEntityManager + * @param transactionmodule + * @param transactioncode + * @param transactionversion + * @param processdate + * @return + * @throws Exception + */ + public static TgeneBatchLog findBatchByJournalid(EntityManager pEntityManager, Date processdate, String modulecode, String journalid) + throws Exception { + TgeneBatchLog tgeneBatchLog = null; + Query qry = pEntityManager.createQuery(TgeneBatchLog.JPQL_BATCH_BY_JOURNALID); + qry.setParameter("processdate", processdate); + qry.setParameter("journalid", journalid); + try { + tgeneBatchLog = (TgeneBatchLog) qry.getSingleResult(); + } catch (NoResultException e) { + } + return tgeneBatchLog; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchLogKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchLogKey.java.svn-base new file mode 100644 index 0000000..8fd5d90 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchLogKey.java.svn-base @@ -0,0 +1,152 @@ +package com.fp.persistence.pgeneral.batch; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEBATCHLOG*/ +@Embeddable +public class TgeneBatchLogKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PROCESSDATE", nullable=false,updatable=false) + +/** +* Fecha contable de ejecucin del batch +*/ +private Timestamp processdate; + +@Column(name="JOURNALID", nullable=false,updatable=false) + +/** +* Journalid de la ejecucin del batch +*/ +private String journalid; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +/**Contructor por defecto*/ +public TgeneBatchLogKey(){} +/**Contructor de TgeneBatchLogKey +@param pProcessdate Fecha contable de ejecucin del batch +@param pJournalid Journalid de la ejecucin del batch +@param pModulecode Codigo de modulo +*/ +public TgeneBatchLogKey(Timestamp pProcessdate,String pJournalid,String pModulecode){ + processdate=pProcessdate; + journalid=pJournalid; + modulecode=pModulecode; +} +/**Obtiene el valor de processdate +@return valor de processdate*/ +public Timestamp getProcessdate(){ + return processdate; +} +/**Fija el valor de processdate +@param pProcessdate nuevo Valor de processdate*/ +public void setProcessdate(Timestamp pProcessdate){ + processdate=pProcessdate; +} + +/**Obtiene el valor de journalid +@return valor de journalid*/ +public String getJournalid(){ + return journalid; +} +/**Fija el valor de journalid +@param pJournalid nuevo Valor de journalid*/ +public void setJournalid(String pJournalid){ + journalid=pJournalid; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Implementacion de la comparacion de TgeneBatchLogKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneBatchLogKey))return false; + TgeneBatchLogKey that = (TgeneBatchLogKey) o; + if (this.getProcessdate() == null || that.getProcessdate() == null){ + return false; + } + if (! this.getProcessdate().equals(that.getProcessdate())){ + return false; + } + if (this.getJournalid() == null || that.getJournalid() == null){ + return false; + } + if (! this.getJournalid().equals(that.getJournalid())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneBatchLogKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getProcessdate() == null ? 0 : this.getProcessdate().hashCode()); + result = result * 37 + (this.getJournalid() == null ? 0 : this.getJournalid().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchLogPreviousProcess.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchLogPreviousProcess.java.svn-base new file mode 100644 index 0000000..f4bba45 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchLogPreviousProcess.java.svn-base @@ -0,0 +1,218 @@ +package com.fp.persistence.pgeneral.batch; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEBATCHLOGPREVIOUSPROCESS*/ +@Entity(name="TgeneBatchLogPreviousProcess") +@Table(name="TGENEBATCHLOGPREVIOUSPROCESS") +public class TgeneBatchLogPreviousProcess extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneBatchLogPreviousProcess +*/ +@EmbeddedId +private TgeneBatchLogPreviousProcessKey pk; +@Column(name="TRANSACTIONMODULE", nullable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="RESULTCODE", nullable=true) + +/** +* Codigo de resultado de la insersin de las cuentas +*/ +private String resultcode; + +@Column(name="USERMESSAGE", nullable=true) + +/** +* Mensaje tecnico, se llena si la transaccion tiene un resultado diferente de ok. +*/ +private String usermessage; + +/**Contructor por defecto*/ +public TgeneBatchLogPreviousProcess(){ +} +/**Contructor de TgeneBatchLogPreviousProcess +@param pPk Clave Primaria del entity +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +*/ +public TgeneBatchLogPreviousProcess(TgeneBatchLogPreviousProcessKey pPk,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion){ + this(); + pk=pPk; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneBatchLogPreviousProcess +*/ +public static TgeneBatchLogPreviousProcess find(EntityManager pEntityManager,TgeneBatchLogPreviousProcessKey pKey) throws Exception{ + TgeneBatchLogPreviousProcess obj = pEntityManager.find(TgeneBatchLogPreviousProcess.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneBatchLogPreviousProcess +@return El objeto que referencia a la Clave primaria de TgeneBatchLogPreviousProcess +*/ +public TgeneBatchLogPreviousProcessKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneBatchLogPreviousProcess +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneBatchLogPreviousProcess +*/ +public void setPk(TgeneBatchLogPreviousProcessKey pPk){ + pk=pPk; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de resultcode +@return valor de resultcode*/ +public String getResultcode(){ + return resultcode; +} +/**Fija el valor de resultcode +@param pResultcode nuevo Valor de resultcode*/ +public void setResultcode(String pResultcode){ + resultcode=pResultcode; +} + +/**Obtiene el valor de usermessage +@return valor de usermessage*/ +public String getUsermessage(){ + return usermessage; +} +/**Fija el valor de usermessage +@param pUsermessage nuevo Valor de usermessage*/ +public void setUsermessage(String pUsermessage){ + usermessage=pUsermessage; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneBatchLogPreviousProcess))return false; + TgeneBatchLogPreviousProcess that = (TgeneBatchLogPreviousProcess) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneBatchLogPreviousProcess +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneBatchLogPreviousProcess +*/ +public Object createInstance(){ + TgeneBatchLogPreviousProcess instance=new TgeneBatchLogPreviousProcess(); + instance.setPk(new TgeneBatchLogPreviousProcessKey()); + return instance; +} +/**Clona la entidad TgeneBatchLogPreviousProcess +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneBatchLogPreviousProcess p=(TgeneBatchLogPreviousProcess)this.clone(); + p.setPk((TgeneBatchLogPreviousProcessKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchLogPreviousProcessKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchLogPreviousProcessKey.java.svn-base new file mode 100644 index 0000000..b861b49 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchLogPreviousProcessKey.java.svn-base @@ -0,0 +1,179 @@ +package com.fp.persistence.pgeneral.batch; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEBATCHLOGPREVIOUSPROCESS*/ +@Embeddable +public class TgeneBatchLogPreviousProcessKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PROCESSDATE", nullable=false,updatable=false) + +/** +* Fecha contable de ejecucin del batch +*/ +private Timestamp processdate; + +@Column(name="JOURNALID", nullable=false,updatable=false) + +/** +* Journalid de la ejecucin del batch +*/ +private String journalid; + +@Column(name="ACTIONCODE", nullable=false,updatable=false) + +/** +* Cdigo de accion +*/ +private String actioncode; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +/**Contructor por defecto*/ +public TgeneBatchLogPreviousProcessKey(){} +/**Contructor de TgeneBatchLogPreviousProcessKey +@param pProcessdate Fecha contable de ejecucin del batch +@param pJournalid Journalid de la ejecucin del batch +@param pActioncode Cdigo de accion +@param pModulecode Codigo de modulo +*/ +public TgeneBatchLogPreviousProcessKey(Timestamp pProcessdate,String pJournalid,String pActioncode,String pModulecode){ + processdate=pProcessdate; + journalid=pJournalid; + actioncode=pActioncode; + modulecode=pModulecode; +} +/**Obtiene el valor de processdate +@return valor de processdate*/ +public Timestamp getProcessdate(){ + return processdate; +} +/**Fija el valor de processdate +@param pProcessdate nuevo Valor de processdate*/ +public void setProcessdate(Timestamp pProcessdate){ + processdate=pProcessdate; +} + +/**Obtiene el valor de journalid +@return valor de journalid*/ +public String getJournalid(){ + return journalid; +} +/**Fija el valor de journalid +@param pJournalid nuevo Valor de journalid*/ +public void setJournalid(String pJournalid){ + journalid=pJournalid; +} + +/**Obtiene el valor de actioncode +@return valor de actioncode*/ +public String getActioncode(){ + return actioncode; +} +/**Fija el valor de actioncode +@param pActioncode nuevo Valor de actioncode*/ +public void setActioncode(String pActioncode){ + actioncode=pActioncode; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Implementacion de la comparacion de TgeneBatchLogPreviousProcessKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneBatchLogPreviousProcessKey))return false; + TgeneBatchLogPreviousProcessKey that = (TgeneBatchLogPreviousProcessKey) o; + if (this.getProcessdate() == null || that.getProcessdate() == null){ + return false; + } + if (! this.getProcessdate().equals(that.getProcessdate())){ + return false; + } + if (this.getJournalid() == null || that.getJournalid() == null){ + return false; + } + if (! this.getJournalid().equals(that.getJournalid())){ + return false; + } + if (this.getActioncode() == null || that.getActioncode() == null){ + return false; + } + if (! this.getActioncode().equals(that.getActioncode())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneBatchLogPreviousProcessKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getProcessdate() == null ? 0 : this.getProcessdate().hashCode()); + result = result * 37 + (this.getJournalid() == null ? 0 : this.getJournalid().hashCode()); + result = result * 37 + (this.getActioncode() == null ? 0 : this.getActioncode().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchPreviousProcess.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchPreviousProcess.java.svn-base new file mode 100644 index 0000000..22a70d3 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchPreviousProcess.java.svn-base @@ -0,0 +1,213 @@ +package com.fp.persistence.pgeneral.batch; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEBATCHPREVIOUSPROCESS*/ +@Entity(name="TgeneBatchPreviousProcess") +@Table(name="TGENEBATCHPREVIOUSPROCESS") +public class TgeneBatchPreviousProcess extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneBatchPreviousProcess +*/ +@EmbeddedId +private TgeneBatchPreviousProcessKey pk; +@Column(name="CATALOGTYPEPROCESS", nullable=true) + +/** +* Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia +*/ +private String catalogtypeprocess; + +@Column(name="CATALOGCODETYPEPROCESS", nullable=true) + +/** +* Codigo de tabla de catalogo del proceso de negocio de la aplicacion +*/ +private String catalogcodetypeprocess; + +@Column(name="PROCESSORDER", nullable=true) + +/** +* Orden de proceso de la regla. +*/ +private Integer processorder; + +@Column(name="ACTIONCODE", nullable=false) + +/** +* Codigo de accion a ajecutar, ejm, CAPITALIZE, CUT +*/ +private String actioncode; + +@Column(name="ACTIVE", nullable=true) + +/** +* Y se ejecuta la regla al ejecutar el fin de dia, N no se ejecuta la regla al ejecutar el fin de dia. +*/ +private String active; + +/**Contructor por defecto*/ +public TgeneBatchPreviousProcess(){ +} +/**Contructor de TgeneBatchPreviousProcess +@param pPk Clave Primaria del entity +@param pActioncode Codigo de accion a ajecutar, ejm, CAPITALIZE, CUT +*/ +public TgeneBatchPreviousProcess(TgeneBatchPreviousProcessKey pPk,String pActioncode){ + this(); + pk=pPk; + actioncode=pActioncode; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneBatchPreviousProcess +*/ +public static TgeneBatchPreviousProcess find(EntityManager pEntityManager,TgeneBatchPreviousProcessKey pKey) throws Exception{ + TgeneBatchPreviousProcess obj = pEntityManager.find(TgeneBatchPreviousProcess.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneBatchPreviousProcess +@return El objeto que referencia a la Clave primaria de TgeneBatchPreviousProcess +*/ +public TgeneBatchPreviousProcessKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneBatchPreviousProcess +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneBatchPreviousProcess +*/ +public void setPk(TgeneBatchPreviousProcessKey pPk){ + pk=pPk; +} +/**Obtiene el valor de catalogtypeprocess +@return valor de catalogtypeprocess*/ +public String getCatalogtypeprocess(){ + return catalogtypeprocess; +} +/**Fija el valor de catalogtypeprocess +@param pCatalogtypeprocess nuevo Valor de catalogtypeprocess*/ +public void setCatalogtypeprocess(String pCatalogtypeprocess){ + catalogtypeprocess=pCatalogtypeprocess; +} + +/**Obtiene el valor de catalogcodetypeprocess +@return valor de catalogcodetypeprocess*/ +public String getCatalogcodetypeprocess(){ + return catalogcodetypeprocess; +} +/**Fija el valor de catalogcodetypeprocess +@param pCatalogcodetypeprocess nuevo Valor de catalogcodetypeprocess*/ +public void setCatalogcodetypeprocess(String pCatalogcodetypeprocess){ + catalogcodetypeprocess=pCatalogcodetypeprocess; +} + +/**Obtiene el valor de processorder +@return valor de processorder*/ +public Integer getProcessorder(){ + return processorder; +} +/**Fija el valor de processorder +@param pProcessorder nuevo Valor de processorder*/ +public void setProcessorder(Integer pProcessorder){ + processorder=pProcessorder; +} + +/**Obtiene el valor de actioncode +@return valor de actioncode*/ +public String getActioncode(){ + return actioncode; +} +/**Fija el valor de actioncode +@param pActioncode nuevo Valor de actioncode*/ +public void setActioncode(String pActioncode){ + actioncode=pActioncode; +} + +/**Obtiene el valor de active +@return valor de active*/ +public String getActive(){ + return active; +} +/**Fija el valor de active +@param pActive nuevo Valor de active*/ +public void setActive(String pActive){ + active=pActive; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneBatchPreviousProcess))return false; + TgeneBatchPreviousProcess that = (TgeneBatchPreviousProcess) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneBatchPreviousProcess +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneBatchPreviousProcess +*/ +public Object createInstance(){ + TgeneBatchPreviousProcess instance=new TgeneBatchPreviousProcess(); + instance.setPk(new TgeneBatchPreviousProcessKey()); + return instance; +} +/**Clona la entidad TgeneBatchPreviousProcess +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneBatchPreviousProcess p=(TgeneBatchPreviousProcess)this.clone(); + p.setPk((TgeneBatchPreviousProcessKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchPreviousProcessKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchPreviousProcessKey.java.svn-base new file mode 100644 index 0000000..b3b1e77 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchPreviousProcessKey.java.svn-base @@ -0,0 +1,205 @@ +package com.fp.persistence.pgeneral.batch; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEBATCHPREVIOUSPROCESS*/ +@Embeddable +public class TgeneBatchPreviousProcessKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="PROCESSCODE", nullable=false,updatable=false) + +/** +* Paquete clase de un comando a ejecutar. +*/ +private String processcode; + +/**Contructor por defecto*/ +public TgeneBatchPreviousProcessKey(){} +/**Contructor de TgeneBatchPreviousProcessKey +@param pModulecode Codigo de modulo +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pProcesscode Paquete clase de un comando a ejecutar. +*/ +public TgeneBatchPreviousProcessKey(String pModulecode,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,String pProcesscode){ + modulecode=pModulecode; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + processcode=pProcesscode; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de processcode +@return valor de processcode*/ +public String getProcesscode(){ + return processcode; +} +/**Fija el valor de processcode +@param pProcesscode nuevo Valor de processcode*/ +public void setProcesscode(String pProcesscode){ + processcode=pProcesscode; +} + +/**Implementacin de la comparacin de TgeneBatchPreviousProcessKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneBatchPreviousProcessKey))return false; + TgeneBatchPreviousProcessKey that = (TgeneBatchPreviousProcessKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getProcesscode() == null || that.getProcesscode() == null){ + return false; + } + if (! this.getProcesscode().equals(that.getProcesscode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneBatchPreviousProcessKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getProcesscode() == null ? 0 : this.getProcesscode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchProcess.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchProcess.java.svn-base new file mode 100644 index 0000000..f83aea1 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchProcess.java.svn-base @@ -0,0 +1,219 @@ +package com.fp.persistence.pgeneral.batch; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEBATCHPROCESS*/ +@Entity(name="TgeneBatchProcess") +@Table(name="TGENEBATCHPROCESS") +public class TgeneBatchProcess extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneBatchProcess +*/ +@EmbeddedId +private TgeneBatchProcessKey pk; +@Column(name="CATALOGTYPEPROCESS", nullable=false) + +/** +* Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia +*/ +private String catalogtypeprocess; + +@Column(name="CATALOGCODETYPEPROCESS", nullable=false) + +/** +* Codigo de tabla de catalogo del proceso de negocio de la aplicacion +*/ +private String catalogcodetypeprocess; + +@Column(name="PROCESSORDER", nullable=true) + +/** +* Orden de proceso de la regla. +*/ +private Integer processorder; + +@Column(name="ACTIONCODE", nullable=false) + +/** +* Codigo de accion a ajecutar, ejm, CAPITALIZE, CUT +*/ +private String actioncode; + +@Column(name="ACTIVE", nullable=true) + +/** +* Y se ejecuta la regla al ejecutar el fin de dia, N no se ejecuta la regla al ejecutar el fin de dia. +*/ +private String active; + +/**Contructor por defecto*/ +public TgeneBatchProcess(){ +} +/**Contructor de TgeneBatchProcess +@param pPk Clave Primaria del entity +@param pCatalogtypeprocess Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia +@param pCatalogcodetypeprocess Codigo de tabla de catalogo del proceso de negocio de la aplicacion +@param pActioncode Codigo de accion a ajecutar, ejm, CAPITALIZE, CUT +*/ +public TgeneBatchProcess(TgeneBatchProcessKey pPk,String pCatalogtypeprocess,String pCatalogcodetypeprocess,String pActioncode){ + this(); + pk=pPk; + catalogtypeprocess=pCatalogtypeprocess; + catalogcodetypeprocess=pCatalogcodetypeprocess; + actioncode=pActioncode; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneBatchProcess +*/ +public static TgeneBatchProcess find(EntityManager pEntityManager,TgeneBatchProcessKey pKey) throws Exception{ + TgeneBatchProcess obj = pEntityManager.find(TgeneBatchProcess.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneBatchProcess +@return El objeto que referencia a la Clave primaria de TgeneBatchProcess +*/ +public TgeneBatchProcessKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneBatchProcess +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneBatchProcess +*/ +public void setPk(TgeneBatchProcessKey pPk){ + pk=pPk; +} +/**Obtiene el valor de catalogtypeprocess +@return valor de catalogtypeprocess*/ +public String getCatalogtypeprocess(){ + return catalogtypeprocess; +} +/**Fija el valor de catalogtypeprocess +@param pCatalogtypeprocess nuevo Valor de catalogtypeprocess*/ +public void setCatalogtypeprocess(String pCatalogtypeprocess){ + catalogtypeprocess=pCatalogtypeprocess; +} + +/**Obtiene el valor de catalogcodetypeprocess +@return valor de catalogcodetypeprocess*/ +public String getCatalogcodetypeprocess(){ + return catalogcodetypeprocess; +} +/**Fija el valor de catalogcodetypeprocess +@param pCatalogcodetypeprocess nuevo Valor de catalogcodetypeprocess*/ +public void setCatalogcodetypeprocess(String pCatalogcodetypeprocess){ + catalogcodetypeprocess=pCatalogcodetypeprocess; +} + +/**Obtiene el valor de processorder +@return valor de processorder*/ +public Integer getProcessorder(){ + return processorder; +} +/**Fija el valor de processorder +@param pProcessorder nuevo Valor de processorder*/ +public void setProcessorder(Integer pProcessorder){ + processorder=pProcessorder; +} + +/**Obtiene el valor de actioncode +@return valor de actioncode*/ +public String getActioncode(){ + return actioncode; +} +/**Fija el valor de actioncode +@param pActioncode nuevo Valor de actioncode*/ +public void setActioncode(String pActioncode){ + actioncode=pActioncode; +} + +/**Obtiene el valor de active +@return valor de active*/ +public String getActive(){ + return active; +} +/**Fija el valor de active +@param pActive nuevo Valor de active*/ +public void setActive(String pActive){ + active=pActive; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneBatchProcess))return false; + TgeneBatchProcess that = (TgeneBatchProcess) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneBatchProcess +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneBatchProcess +*/ +public Object createInstance(){ + TgeneBatchProcess instance=new TgeneBatchProcess(); + instance.setPk(new TgeneBatchProcessKey()); + return instance; +} +/**Clona la entidad TgeneBatchProcess +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneBatchProcess p=(TgeneBatchProcess)this.clone(); + p.setPk((TgeneBatchProcessKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchProcessKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchProcessKey.java.svn-base new file mode 100644 index 0000000..a6f069a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/.svn/text-base/TgeneBatchProcessKey.java.svn-base @@ -0,0 +1,205 @@ +package com.fp.persistence.pgeneral.batch; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEBATCHPROCESS*/ +@Embeddable +public class TgeneBatchProcessKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="PROCESSCODE", nullable=false,updatable=false) + +/** +* Paquete clase de un comando a ejecutar. +*/ +private String processcode; + +/**Contructor por defecto*/ +public TgeneBatchProcessKey(){} +/**Contructor de TgeneBatchProcessKey +@param pModulecode Codigo de modulo +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pProcesscode Paquete clase de un comando a ejecutar. +*/ +public TgeneBatchProcessKey(String pModulecode,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,String pProcesscode){ + modulecode=pModulecode; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + processcode=pProcesscode; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de processcode +@return valor de processcode*/ +public String getProcesscode(){ + return processcode; +} +/**Fija el valor de processcode +@param pProcesscode nuevo Valor de processcode*/ +public void setProcesscode(String pProcesscode){ + processcode=pProcesscode; +} + +/**Implementacin de la comparacin de TgeneBatchProcessKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneBatchProcessKey))return false; + TgeneBatchProcessKey that = (TgeneBatchProcessKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getProcesscode() == null || that.getProcesscode() == null){ + return false; + } + if (! this.getProcesscode().equals(that.getProcesscode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneBatchProcessKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getProcesscode() == null ? 0 : this.getProcesscode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneAccountBatchProcess.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneAccountBatchProcess.java new file mode 100644 index 0000000..97094ef --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneAccountBatchProcess.java @@ -0,0 +1,122 @@ +package com.fp.persistence.pgeneral.batch; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTBATCHPROCESS*/ +@Entity(name="TgeneAccountBatchProcess") +@Table(name="TGENEACCOUNTBATCHPROCESS") +public class TgeneAccountBatchProcess extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountBatchProcess +*/ +@EmbeddedId +private TgeneAccountBatchProcessKey pk; +/**Contructor por defecto*/ +public TgeneAccountBatchProcess(){ +} +/**Contructor de TgeneAccountBatchProcess +@param pPk Clave Primaria del entity +*/ +public TgeneAccountBatchProcess(TgeneAccountBatchProcessKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountBatchProcess +*/ +public static TgeneAccountBatchProcess find(EntityManager pEntityManager,TgeneAccountBatchProcessKey pKey) throws Exception{ + TgeneAccountBatchProcess obj = pEntityManager.find(TgeneAccountBatchProcess.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountBatchProcess +@return El objeto que referencia a la Clave primaria de TgeneAccountBatchProcess +*/ +public TgeneAccountBatchProcessKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountBatchProcess +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountBatchProcess +*/ +public void setPk(TgeneAccountBatchProcessKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountBatchProcess))return false; + TgeneAccountBatchProcess that = (TgeneAccountBatchProcess) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountBatchProcess +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountBatchProcess +*/ +public Object createInstance(){ + TgeneAccountBatchProcess instance=new TgeneAccountBatchProcess(); + instance.setPk(new TgeneAccountBatchProcessKey()); + return instance; +} +/**Clona la entidad TgeneAccountBatchProcess +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountBatchProcess p=(TgeneAccountBatchProcess)this.clone(); + p.setPk((TgeneAccountBatchProcessKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneAccountBatchProcessKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneAccountBatchProcessKey.java new file mode 100644 index 0000000..e719cd5 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneAccountBatchProcessKey.java @@ -0,0 +1,287 @@ +package com.fp.persistence.pgeneral.batch; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTBATCHPROCESS*/ +@Embeddable +public class TgeneAccountBatchProcessKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="PROCESSDATE", nullable=false,updatable=false) + +/** +* Fecha de proceso de la ejecucion del batch. +*/ +private Date processdate; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="ACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de accion a ajecutar, ejm, CAPITALIZE, CUT +*/ +private String actioncode; + +/**Contructor por defecto*/ +public TgeneAccountBatchProcessKey(){} +/**Contructor de TgeneAccountBatchProcessKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pProcessdate Fecha de proceso de la ejecucion del batch. +@param pModulecode Codigo de modulo +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pActioncode Codigo de accion a ajecutar, ejm, CAPITALIZE, CUT +*/ +public TgeneAccountBatchProcessKey(String pAccount,Integer pCompany,Date pProcessdate,String pModulecode,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,String pActioncode){ + account=pAccount; + company=pCompany; + processdate=pProcessdate; + modulecode=pModulecode; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + actioncode=pActioncode; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de processdate +@return valor de processdate*/ +public Date getProcessdate(){ + return processdate; +} +/**Fija el valor de processdate +@param pProcessdate nuevo Valor de processdate*/ +public void setProcessdate(Date pProcessdate){ + processdate=pProcessdate; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de actioncode +@return valor de actioncode*/ +public String getActioncode(){ + return actioncode; +} +/**Fija el valor de actioncode +@param pActioncode nuevo Valor de actioncode*/ +public void setActioncode(String pActioncode){ + actioncode=pActioncode; +} + +/**Implementacin de la comparacin de TgeneAccountBatchProcessKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountBatchProcessKey))return false; + TgeneAccountBatchProcessKey that = (TgeneAccountBatchProcessKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getProcessdate() == null || that.getProcessdate() == null){ + return false; + } + if (! this.getProcessdate().equals(that.getProcessdate())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getActioncode() == null || that.getActioncode() == null){ + return false; + } + if (! this.getActioncode().equals(that.getActioncode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountBatchProcessKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getProcessdate() == null ? 0 : this.getProcessdate().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getActioncode() == null ? 0 : this.getActioncode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneAccountBatchStatus.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneAccountBatchStatus.java new file mode 100644 index 0000000..d974c10 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneAccountBatchStatus.java @@ -0,0 +1,215 @@ +package com.fp.persistence.pgeneral.batch; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTBATCHSTATUS*/ +@Entity(name="TgeneAccountBatchStatus") +@Table(name="TGENEACCOUNTBATCHSTATUS") +public class TgeneAccountBatchStatus extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountBatchStatus +*/ +@EmbeddedId +private TgeneAccountBatchStatusKey pk; +@Column(name="RESULTCODE", nullable=false) + +/** +* Codigo de resultado de ejecucion de todos los procesos para la cuenta. +*/ +private String resultcode; + +@Column(name="USERMESSAGE", nullable=true) + +/** +* Mensaje de usuario resultante del proceso de batch para la cuenta. +*/ +private String usermessage; + +@Column(name="TECHNICALMESSAGE", nullable=true) + +/** +* Mensaje tecnico, se llena si la transaccion tiene un resultado diferente de ok. +*/ +private String technicalmessage; + +@Column(name="REALDATE", nullable=true, insertable=false) + +/** +* Fecha real de proceso de la cuenta. +*/ +private Timestamp realdate; + +@Column(name="ACTIONCODE", nullable=true) + +/** +* Si se presenta un error, en el campo se almacena la accion en la se presento el error +*/ +private String actioncode; + +/**Contructor por defecto*/ +public TgeneAccountBatchStatus(){ +} +/**Contructor de TgeneAccountBatchStatus +@param pPk Clave Primaria del entity +@param pResultcode Codigo de resultado de ejecucion de todos los procesos para la cuenta. +*/ +public TgeneAccountBatchStatus(TgeneAccountBatchStatusKey pPk,String pResultcode){ + this(); + pk=pPk; + resultcode=pResultcode; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountBatchStatus +*/ +public static TgeneAccountBatchStatus find(EntityManager pEntityManager,TgeneAccountBatchStatusKey pKey) throws Exception{ + TgeneAccountBatchStatus obj = pEntityManager.find(TgeneAccountBatchStatus.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountBatchStatus +@return El objeto que referencia a la Clave primaria de TgeneAccountBatchStatus +*/ +public TgeneAccountBatchStatusKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountBatchStatus +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountBatchStatus +*/ +public void setPk(TgeneAccountBatchStatusKey pPk){ + pk=pPk; +} +/**Obtiene el valor de resultcode +@return valor de resultcode*/ +public String getResultcode(){ + return resultcode; +} +/**Fija el valor de resultcode +@param pResultcode nuevo Valor de resultcode*/ +public void setResultcode(String pResultcode){ + resultcode=pResultcode; +} + +/**Obtiene el valor de usermessage +@return valor de usermessage*/ +public String getUsermessage(){ + return usermessage; +} +/**Fija el valor de usermessage +@param pUsermessage nuevo Valor de usermessage*/ +public void setUsermessage(String pUsermessage){ + usermessage=pUsermessage; +} + +/**Obtiene el valor de technicalmessage +@return valor de technicalmessage*/ +public String getTechnicalmessage(){ + return technicalmessage; +} +/**Fija el valor de technicalmessage +@param pTechnicalmessage nuevo Valor de technicalmessage*/ +public void setTechnicalmessage(String pTechnicalmessage){ + technicalmessage=pTechnicalmessage; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Timestamp getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Timestamp pRealdate){ + realdate=pRealdate; +} + +/**Obtiene el valor de actioncode +@return valor de actioncode*/ +public String getActioncode(){ + return actioncode; +} +/**Fija el valor de actioncode +@param pActioncode nuevo Valor de actioncode*/ +public void setActioncode(String pActioncode){ + actioncode=pActioncode; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountBatchStatus))return false; + TgeneAccountBatchStatus that = (TgeneAccountBatchStatus) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountBatchStatus +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountBatchStatus +*/ +public Object createInstance(){ + TgeneAccountBatchStatus instance=new TgeneAccountBatchStatus(); + instance.setPk(new TgeneAccountBatchStatusKey()); + return instance; +} +/**Clona la entidad TgeneAccountBatchStatus +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountBatchStatus p=(TgeneAccountBatchStatus)this.clone(); + p.setPk((TgeneAccountBatchStatusKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneAccountBatchStatusKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneAccountBatchStatusKey.java new file mode 100644 index 0000000..3c23994 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneAccountBatchStatusKey.java @@ -0,0 +1,260 @@ +package com.fp.persistence.pgeneral.batch; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTBATCHSTATUS*/ +@Embeddable +public class TgeneAccountBatchStatusKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="PROCESSDATE", nullable=false,updatable=false) + +/** +* Si los proceso a ejecutar en el fin de dia no tienen errores se almacena la proxima fecha contable, este campo se utiliza en el non stop +*/ +private Date processdate; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +/**Contructor por defecto*/ +public TgeneAccountBatchStatusKey(){} +/**Contructor de TgeneAccountBatchStatusKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pProcessdate Si los proceso a ejecutar en el fin de dia no tienen errores se almacena la proxima fecha contable, este campo se utiliza en el non stop +@param pModulecode Codigo de modulo +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +*/ +public TgeneAccountBatchStatusKey(String pAccount,Integer pCompany,Date pProcessdate,String pModulecode,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion){ + account=pAccount; + company=pCompany; + processdate=pProcessdate; + modulecode=pModulecode; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de processdate +@return valor de processdate*/ +public Date getProcessdate(){ + return processdate; +} +/**Fija el valor de processdate +@param pProcessdate nuevo Valor de processdate*/ +public void setProcessdate(Date pProcessdate){ + processdate=pProcessdate; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Implementacin de la comparacin de TgeneAccountBatchStatusKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountBatchStatusKey))return false; + TgeneAccountBatchStatusKey that = (TgeneAccountBatchStatusKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getProcessdate() == null || that.getProcessdate() == null){ + return false; + } + if (! this.getProcessdate().equals(that.getProcessdate())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountBatchStatusKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getProcessdate() == null ? 0 : this.getProcessdate().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatch.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatch.java new file mode 100644 index 0000000..4bbc032 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatch.java @@ -0,0 +1,175 @@ +package com.fp.persistence.pgeneral.batch; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEBATCH*/ +@Entity(name="TgeneBatch") +@Table(name="TGENEBATCH") +public class TgeneBatch extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneBatch +*/ +@EmbeddedId +private TgeneBatchKey pk; +@Column(name="ACTIVE", nullable=true) + +/** +* Y se ejecuta la regla al ejecutar el fin de dia, N no se ejecuta la regla al ejecutar el fin de dia. +*/ +private String active; + +@Column(name="PROCESSORDER", nullable=true) + +/** +* Orden de ejecucion de modulo +*/ +private Integer processorder; + +@Column(name="THREADS", nullable=true) + +/** +* Numero de hilos a levantar por modulo. +*/ +private Integer threads; + +/**Contructor por defecto*/ +public TgeneBatch(){ +} +/**Contructor de TgeneBatch +@param pPk Clave Primaria del entity +*/ +public TgeneBatch(TgeneBatchKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneBatch +*/ +public static TgeneBatch find(EntityManager pEntityManager,TgeneBatchKey pKey) throws Exception{ + TgeneBatch obj = pEntityManager.find(TgeneBatch.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneBatch +@return El objeto que referencia a la Clave primaria de TgeneBatch +*/ +public TgeneBatchKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneBatch +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneBatch +*/ +public void setPk(TgeneBatchKey pPk){ + pk=pPk; +} +/**Obtiene el valor de active +@return valor de active*/ +public String getActive(){ + return active; +} +/**Fija el valor de active +@param pActive nuevo Valor de active*/ +public void setActive(String pActive){ + active=pActive; +} + +/**Obtiene el valor de processorder +@return valor de processorder*/ +public Integer getProcessorder(){ + return processorder; +} +/**Fija el valor de processorder +@param pProcessorder nuevo Valor de processorder*/ +public void setProcessorder(Integer pProcessorder){ + processorder=pProcessorder; +} + +/**Obtiene el valor de threads +@return valor de threads*/ +public Integer getThreads(){ + return threads; +} +/**Fija el valor de threads +@param pThreads nuevo Valor de threads*/ +public void setThreads(Integer pThreads){ + threads=pThreads; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneBatch))return false; + TgeneBatch that = (TgeneBatch) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneBatch +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneBatch +*/ +public Object createInstance(){ + TgeneBatch instance=new TgeneBatch(); + instance.setPk(new TgeneBatchKey()); + return instance; +} +/**Clona la entidad TgeneBatch +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneBatch p=(TgeneBatch)this.clone(); + p.setPk((TgeneBatchKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchKey.java new file mode 100644 index 0000000..f3c9790 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.batch; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEBATCH*/ +@Embeddable +public class TgeneBatchKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +/**Contructor por defecto*/ +public TgeneBatchKey(){} +/**Contructor de TgeneBatchKey +@param pModulecode Codigo de modulo +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +*/ +public TgeneBatchKey(String pModulecode,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion){ + modulecode=pModulecode; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Implementacin de la comparacin de TgeneBatchKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneBatchKey))return false; + TgeneBatchKey that = (TgeneBatchKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneBatchKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchLog.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchLog.java new file mode 100644 index 0000000..8ef6201 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchLog.java @@ -0,0 +1,465 @@ +package com.fp.persistence.pgeneral.batch; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEBATCHLOG */ +@Entity(name = "TgeneBatchLog") +@Table(name = "TGENEBATCHLOG") +public class TgeneBatchLog extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneBatchLog + */ + @EmbeddedId + private TgeneBatchLogKey pk; + + @Column(name = "TRANSACTIONMODULE", nullable = true) + /** + * Modulo al que pertence la transaccion + */ + private String transactionmodule; + + @Column(name = "TRANSACTIONCODE", nullable = true) + /** + * Codigo de transaccion dentro del modulo + */ + private Integer transactioncode; + + @Column(name = "TRANSACTIONVERSION", nullable = true) + /** + * Version de transaccion + */ + private Integer transactionversion; + + @Column(name = "FINITDATE", nullable = true) + /** + * Fecha real de inicio de ejecucin del batch + */ + private Timestamp finitdate; + + @Column(name = "FENDDATE", nullable = true) + /** + * Fecha fin real de ejecucin del batch + */ + private Timestamp fenddate; + + @Column(name = "TOTAL", nullable = true) + /** + * Nmero total de cuentas a procesar + */ + private Integer total; + + @Column(name = "EXECUTED", nullable = true) + /** + * Nmero total de cuentas ejecutadas + */ + private Integer executed; + + @Column(name = "TOTALOK", nullable = true) + /** + * Nmero de cuentas ejecutadas exitosamente + */ + private Integer totalok; + + @Column(name = "TOTALERROR", nullable = true) + /** + * Nmero de cuentas ejecutadas con error + */ + private Integer totalerror; + + /** Contructor por defecto */ + public TgeneBatchLog() { + } + + /** + * Contructor de TgeneBatchLog + * + * @param pPk Clave Primaria del entity + */ + public TgeneBatchLog(TgeneBatchLogKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneBatchLog + */ + public static TgeneBatchLog find(EntityManager pEntityManager, TgeneBatchLogKey pKey) throws Exception { + TgeneBatchLog obj = pEntityManager.find(TgeneBatchLog.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneBatchLog + * + * @return El objeto que referencia a la Clave primaria de TgeneBatchLog + */ + public TgeneBatchLogKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneBatchLog + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneBatchLog + */ + public void setPk(TgeneBatchLogKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de transactionmodule + * + * @return valor de transactionmodule + */ + public String getTransactionmodule() { + return this.transactionmodule; + } + + /** + * Fija el valor de transactionmodule + * + * @param pTransactionmodule nuevo Valor de transactionmodule + */ + public void setTransactionmodule(String pTransactionmodule) { + this.transactionmodule = pTransactionmodule; + } + + /** + * Obtiene el valor de transactioncode + * + * @return valor de transactioncode + */ + public Integer getTransactioncode() { + return this.transactioncode; + } + + /** + * Fija el valor de transactioncode + * + * @param pTransactioncode nuevo Valor de transactioncode + */ + public void setTransactioncode(Integer pTransactioncode) { + this.transactioncode = pTransactioncode; + } + + /** + * Obtiene el valor de transactionversion + * + * @return valor de transactionversion + */ + public Integer getTransactionversion() { + return this.transactionversion; + } + + /** + * Fija el valor de transactionversion + * + * @param pTransactionversion nuevo Valor de transactionversion + */ + public void setTransactionversion(Integer pTransactionversion) { + this.transactionversion = pTransactionversion; + } + + /** + * Obtiene el valor de finitdate + * + * @return valor de finitdate + */ + public Timestamp getFinitdate() { + return this.finitdate; + } + + /** + * Fija el valor de finitdate + * + * @param pFinitdate nuevo Valor de finitdate + */ + public void setFinitdate(Timestamp pFinitdate) { + this.finitdate = pFinitdate; + } + + /** + * Obtiene el valor de fenddate + * + * @return valor de fenddate + */ + public Timestamp getFenddate() { + return this.fenddate; + } + + /** + * Fija el valor de fenddate + * + * @param pFenddate nuevo Valor de fenddate + */ + public void setFenddate(Timestamp pFenddate) { + this.fenddate = pFenddate; + } + + /** + * Obtiene el valor de total + * + * @return valor de total + */ + public Integer getTotal() { + return this.total; + } + + /** + * Fija el valor de total + * + * @param pTotal nuevo Valor de total + */ + public void setTotal(Integer pTotal) { + this.total = pTotal; + } + + /** + * Obtiene el valor de executed + * + * @return valor de executed + */ + public Integer getExecuted() { + return this.executed; + } + + /** + * Fija el valor de executed + * + * @param pExecuted nuevo Valor de executed + */ + public void setExecuted(Integer pExecuted) { + this.executed = pExecuted; + } + + /** + * Obtiene el valor de totalok + * + * @return valor de totalok + */ + public Integer getTotalok() { + return this.totalok; + } + + /** + * Fija el valor de totalok + * + * @param pTotalok nuevo Valor de totalok + */ + public void setTotalok(Integer pTotalok) { + this.totalok = pTotalok; + } + + /** + * Obtiene el valor de totalerror + * + * @return valor de totalerror + */ + public Integer getTotalerror() { + return this.totalerror; + } + + /** + * Fija el valor de totalerror + * + * @param pTotalerror nuevo Valor de totalerror + */ + public void setTotalerror(Integer pTotalerror) { + this.totalerror = pTotalerror; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneBatchLog)) { + return false; + } + TgeneBatchLog that = (TgeneBatchLog) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneBatchLog + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneBatchLog */ + @Override + public Object createInstance() { + TgeneBatchLog instance = new TgeneBatchLog(); + instance.setPk(new TgeneBatchLogKey()); + return instance; + } + + /** + * Clona la entidad TgeneBatchLog + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneBatchLog p = (TgeneBatchLog) this.clone(); + p.setPk((TgeneBatchLogKey) this.pk.cloneMe()); + return p; + } + + // METODOS MANUALES + private static final String JPQL_BATCH_IN_EXECUTION = "from TgeneBatchLog t " + + "where t.transactionmodule = :transactionmodule and t.transactioncode = :transactioncode " + + "and t.transactionversion =:transactionversion and t.pk.processdate = :processdate and t.fenddate is null "; + + /** + * Metodo que retorna un registro que representa si un batch est en ejecucion dada la fecha de proceso + * + * @param pEntityManager + * @param transactionmodule + * @param transactioncode + * @param transactionversion + * @param processdate + * @return + * @throws Exception + */ + public static TgeneBatchLog findBatchInExecution(EntityManager pEntityManager, Date processdate, String transactionmodule, + Integer transactioncode, Integer transactionversion) throws Exception { + TgeneBatchLog tgeneBatchLog = null; + Query qry = pEntityManager.createQuery(TgeneBatchLog.JPQL_BATCH_IN_EXECUTION); + qry.setParameter("processdate", processdate); + qry.setParameter("transactionmodule", transactionmodule); + qry.setParameter("transactioncode", transactioncode); + qry.setParameter("transactionversion", transactionversion); + + try { + tgeneBatchLog = (TgeneBatchLog) qry.getSingleResult(); + } catch (NoResultException e) { + } + return tgeneBatchLog; + } + + private static final String JPQL_PENDING_BATCH_BY_MODULE = "from TgeneBatchLog t " + + "where t.pk.processdate = :processdate and t.pk.journalid = :journalid and t.pk.modulecode = :modulecode and t.fenddate is null "; + + /** + * Metodo que retorna un registro que representa si un batch est en ejecucion dada la fecha de proceso + * + * @param pEntityManager + * @param transactionmodule + * @param transactioncode + * @param transactionversion + * @param processdate + * @return + * @throws Exception + */ + public static TgeneBatchLog findPendingBatchByModule(EntityManager pEntityManager, Date processdate, String journalid, String modulecode) + throws Exception { + TgeneBatchLog tgeneBatchLog = null; + Query qry = pEntityManager.createQuery(TgeneBatchLog.JPQL_PENDING_BATCH_BY_MODULE); + qry.setParameter("processdate", processdate); + qry.setParameter("journalid", journalid); + qry.setParameter("modulecode", modulecode); + try { + tgeneBatchLog = (TgeneBatchLog) qry.getSingleResult(); + } catch (NoResultException e) { + } + return tgeneBatchLog; + } + + private static final String JPQL_BATCH_BY_JOURNALID = "from TgeneBatchLog t " + + "where t.pk.processdate = :processdate and t.pk.journalid = :journalid "; + + /** + * Metodo que retorna un registro que representa si un batch est en ejecucion dada la fecha de proceso + * + * @param pEntityManager + * @param transactionmodule + * @param transactioncode + * @param transactionversion + * @param processdate + * @return + * @throws Exception + */ + public static TgeneBatchLog findBatchByJournalid(EntityManager pEntityManager, Date processdate, String modulecode, String journalid) + throws Exception { + TgeneBatchLog tgeneBatchLog = null; + Query qry = pEntityManager.createQuery(TgeneBatchLog.JPQL_BATCH_BY_JOURNALID); + qry.setParameter("processdate", processdate); + qry.setParameter("journalid", journalid); + try { + tgeneBatchLog = (TgeneBatchLog) qry.getSingleResult(); + } catch (NoResultException e) { + } + return tgeneBatchLog; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchLogKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchLogKey.java new file mode 100644 index 0000000..8fd5d90 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchLogKey.java @@ -0,0 +1,152 @@ +package com.fp.persistence.pgeneral.batch; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEBATCHLOG*/ +@Embeddable +public class TgeneBatchLogKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PROCESSDATE", nullable=false,updatable=false) + +/** +* Fecha contable de ejecucin del batch +*/ +private Timestamp processdate; + +@Column(name="JOURNALID", nullable=false,updatable=false) + +/** +* Journalid de la ejecucin del batch +*/ +private String journalid; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +/**Contructor por defecto*/ +public TgeneBatchLogKey(){} +/**Contructor de TgeneBatchLogKey +@param pProcessdate Fecha contable de ejecucin del batch +@param pJournalid Journalid de la ejecucin del batch +@param pModulecode Codigo de modulo +*/ +public TgeneBatchLogKey(Timestamp pProcessdate,String pJournalid,String pModulecode){ + processdate=pProcessdate; + journalid=pJournalid; + modulecode=pModulecode; +} +/**Obtiene el valor de processdate +@return valor de processdate*/ +public Timestamp getProcessdate(){ + return processdate; +} +/**Fija el valor de processdate +@param pProcessdate nuevo Valor de processdate*/ +public void setProcessdate(Timestamp pProcessdate){ + processdate=pProcessdate; +} + +/**Obtiene el valor de journalid +@return valor de journalid*/ +public String getJournalid(){ + return journalid; +} +/**Fija el valor de journalid +@param pJournalid nuevo Valor de journalid*/ +public void setJournalid(String pJournalid){ + journalid=pJournalid; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Implementacion de la comparacion de TgeneBatchLogKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneBatchLogKey))return false; + TgeneBatchLogKey that = (TgeneBatchLogKey) o; + if (this.getProcessdate() == null || that.getProcessdate() == null){ + return false; + } + if (! this.getProcessdate().equals(that.getProcessdate())){ + return false; + } + if (this.getJournalid() == null || that.getJournalid() == null){ + return false; + } + if (! this.getJournalid().equals(that.getJournalid())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneBatchLogKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getProcessdate() == null ? 0 : this.getProcessdate().hashCode()); + result = result * 37 + (this.getJournalid() == null ? 0 : this.getJournalid().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchLogPreviousProcess.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchLogPreviousProcess.java new file mode 100644 index 0000000..f4bba45 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchLogPreviousProcess.java @@ -0,0 +1,218 @@ +package com.fp.persistence.pgeneral.batch; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEBATCHLOGPREVIOUSPROCESS*/ +@Entity(name="TgeneBatchLogPreviousProcess") +@Table(name="TGENEBATCHLOGPREVIOUSPROCESS") +public class TgeneBatchLogPreviousProcess extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneBatchLogPreviousProcess +*/ +@EmbeddedId +private TgeneBatchLogPreviousProcessKey pk; +@Column(name="TRANSACTIONMODULE", nullable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="RESULTCODE", nullable=true) + +/** +* Codigo de resultado de la insersin de las cuentas +*/ +private String resultcode; + +@Column(name="USERMESSAGE", nullable=true) + +/** +* Mensaje tecnico, se llena si la transaccion tiene un resultado diferente de ok. +*/ +private String usermessage; + +/**Contructor por defecto*/ +public TgeneBatchLogPreviousProcess(){ +} +/**Contructor de TgeneBatchLogPreviousProcess +@param pPk Clave Primaria del entity +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +*/ +public TgeneBatchLogPreviousProcess(TgeneBatchLogPreviousProcessKey pPk,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion){ + this(); + pk=pPk; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneBatchLogPreviousProcess +*/ +public static TgeneBatchLogPreviousProcess find(EntityManager pEntityManager,TgeneBatchLogPreviousProcessKey pKey) throws Exception{ + TgeneBatchLogPreviousProcess obj = pEntityManager.find(TgeneBatchLogPreviousProcess.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneBatchLogPreviousProcess +@return El objeto que referencia a la Clave primaria de TgeneBatchLogPreviousProcess +*/ +public TgeneBatchLogPreviousProcessKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneBatchLogPreviousProcess +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneBatchLogPreviousProcess +*/ +public void setPk(TgeneBatchLogPreviousProcessKey pPk){ + pk=pPk; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de resultcode +@return valor de resultcode*/ +public String getResultcode(){ + return resultcode; +} +/**Fija el valor de resultcode +@param pResultcode nuevo Valor de resultcode*/ +public void setResultcode(String pResultcode){ + resultcode=pResultcode; +} + +/**Obtiene el valor de usermessage +@return valor de usermessage*/ +public String getUsermessage(){ + return usermessage; +} +/**Fija el valor de usermessage +@param pUsermessage nuevo Valor de usermessage*/ +public void setUsermessage(String pUsermessage){ + usermessage=pUsermessage; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneBatchLogPreviousProcess))return false; + TgeneBatchLogPreviousProcess that = (TgeneBatchLogPreviousProcess) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneBatchLogPreviousProcess +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneBatchLogPreviousProcess +*/ +public Object createInstance(){ + TgeneBatchLogPreviousProcess instance=new TgeneBatchLogPreviousProcess(); + instance.setPk(new TgeneBatchLogPreviousProcessKey()); + return instance; +} +/**Clona la entidad TgeneBatchLogPreviousProcess +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneBatchLogPreviousProcess p=(TgeneBatchLogPreviousProcess)this.clone(); + p.setPk((TgeneBatchLogPreviousProcessKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchLogPreviousProcessKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchLogPreviousProcessKey.java new file mode 100644 index 0000000..b861b49 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchLogPreviousProcessKey.java @@ -0,0 +1,179 @@ +package com.fp.persistence.pgeneral.batch; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEBATCHLOGPREVIOUSPROCESS*/ +@Embeddable +public class TgeneBatchLogPreviousProcessKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PROCESSDATE", nullable=false,updatable=false) + +/** +* Fecha contable de ejecucin del batch +*/ +private Timestamp processdate; + +@Column(name="JOURNALID", nullable=false,updatable=false) + +/** +* Journalid de la ejecucin del batch +*/ +private String journalid; + +@Column(name="ACTIONCODE", nullable=false,updatable=false) + +/** +* Cdigo de accion +*/ +private String actioncode; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +/**Contructor por defecto*/ +public TgeneBatchLogPreviousProcessKey(){} +/**Contructor de TgeneBatchLogPreviousProcessKey +@param pProcessdate Fecha contable de ejecucin del batch +@param pJournalid Journalid de la ejecucin del batch +@param pActioncode Cdigo de accion +@param pModulecode Codigo de modulo +*/ +public TgeneBatchLogPreviousProcessKey(Timestamp pProcessdate,String pJournalid,String pActioncode,String pModulecode){ + processdate=pProcessdate; + journalid=pJournalid; + actioncode=pActioncode; + modulecode=pModulecode; +} +/**Obtiene el valor de processdate +@return valor de processdate*/ +public Timestamp getProcessdate(){ + return processdate; +} +/**Fija el valor de processdate +@param pProcessdate nuevo Valor de processdate*/ +public void setProcessdate(Timestamp pProcessdate){ + processdate=pProcessdate; +} + +/**Obtiene el valor de journalid +@return valor de journalid*/ +public String getJournalid(){ + return journalid; +} +/**Fija el valor de journalid +@param pJournalid nuevo Valor de journalid*/ +public void setJournalid(String pJournalid){ + journalid=pJournalid; +} + +/**Obtiene el valor de actioncode +@return valor de actioncode*/ +public String getActioncode(){ + return actioncode; +} +/**Fija el valor de actioncode +@param pActioncode nuevo Valor de actioncode*/ +public void setActioncode(String pActioncode){ + actioncode=pActioncode; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Implementacion de la comparacion de TgeneBatchLogPreviousProcessKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneBatchLogPreviousProcessKey))return false; + TgeneBatchLogPreviousProcessKey that = (TgeneBatchLogPreviousProcessKey) o; + if (this.getProcessdate() == null || that.getProcessdate() == null){ + return false; + } + if (! this.getProcessdate().equals(that.getProcessdate())){ + return false; + } + if (this.getJournalid() == null || that.getJournalid() == null){ + return false; + } + if (! this.getJournalid().equals(that.getJournalid())){ + return false; + } + if (this.getActioncode() == null || that.getActioncode() == null){ + return false; + } + if (! this.getActioncode().equals(that.getActioncode())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneBatchLogPreviousProcessKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getProcessdate() == null ? 0 : this.getProcessdate().hashCode()); + result = result * 37 + (this.getJournalid() == null ? 0 : this.getJournalid().hashCode()); + result = result * 37 + (this.getActioncode() == null ? 0 : this.getActioncode().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchPreviousProcess.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchPreviousProcess.java new file mode 100644 index 0000000..22a70d3 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchPreviousProcess.java @@ -0,0 +1,213 @@ +package com.fp.persistence.pgeneral.batch; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEBATCHPREVIOUSPROCESS*/ +@Entity(name="TgeneBatchPreviousProcess") +@Table(name="TGENEBATCHPREVIOUSPROCESS") +public class TgeneBatchPreviousProcess extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneBatchPreviousProcess +*/ +@EmbeddedId +private TgeneBatchPreviousProcessKey pk; +@Column(name="CATALOGTYPEPROCESS", nullable=true) + +/** +* Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia +*/ +private String catalogtypeprocess; + +@Column(name="CATALOGCODETYPEPROCESS", nullable=true) + +/** +* Codigo de tabla de catalogo del proceso de negocio de la aplicacion +*/ +private String catalogcodetypeprocess; + +@Column(name="PROCESSORDER", nullable=true) + +/** +* Orden de proceso de la regla. +*/ +private Integer processorder; + +@Column(name="ACTIONCODE", nullable=false) + +/** +* Codigo de accion a ajecutar, ejm, CAPITALIZE, CUT +*/ +private String actioncode; + +@Column(name="ACTIVE", nullable=true) + +/** +* Y se ejecuta la regla al ejecutar el fin de dia, N no se ejecuta la regla al ejecutar el fin de dia. +*/ +private String active; + +/**Contructor por defecto*/ +public TgeneBatchPreviousProcess(){ +} +/**Contructor de TgeneBatchPreviousProcess +@param pPk Clave Primaria del entity +@param pActioncode Codigo de accion a ajecutar, ejm, CAPITALIZE, CUT +*/ +public TgeneBatchPreviousProcess(TgeneBatchPreviousProcessKey pPk,String pActioncode){ + this(); + pk=pPk; + actioncode=pActioncode; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneBatchPreviousProcess +*/ +public static TgeneBatchPreviousProcess find(EntityManager pEntityManager,TgeneBatchPreviousProcessKey pKey) throws Exception{ + TgeneBatchPreviousProcess obj = pEntityManager.find(TgeneBatchPreviousProcess.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneBatchPreviousProcess +@return El objeto que referencia a la Clave primaria de TgeneBatchPreviousProcess +*/ +public TgeneBatchPreviousProcessKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneBatchPreviousProcess +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneBatchPreviousProcess +*/ +public void setPk(TgeneBatchPreviousProcessKey pPk){ + pk=pPk; +} +/**Obtiene el valor de catalogtypeprocess +@return valor de catalogtypeprocess*/ +public String getCatalogtypeprocess(){ + return catalogtypeprocess; +} +/**Fija el valor de catalogtypeprocess +@param pCatalogtypeprocess nuevo Valor de catalogtypeprocess*/ +public void setCatalogtypeprocess(String pCatalogtypeprocess){ + catalogtypeprocess=pCatalogtypeprocess; +} + +/**Obtiene el valor de catalogcodetypeprocess +@return valor de catalogcodetypeprocess*/ +public String getCatalogcodetypeprocess(){ + return catalogcodetypeprocess; +} +/**Fija el valor de catalogcodetypeprocess +@param pCatalogcodetypeprocess nuevo Valor de catalogcodetypeprocess*/ +public void setCatalogcodetypeprocess(String pCatalogcodetypeprocess){ + catalogcodetypeprocess=pCatalogcodetypeprocess; +} + +/**Obtiene el valor de processorder +@return valor de processorder*/ +public Integer getProcessorder(){ + return processorder; +} +/**Fija el valor de processorder +@param pProcessorder nuevo Valor de processorder*/ +public void setProcessorder(Integer pProcessorder){ + processorder=pProcessorder; +} + +/**Obtiene el valor de actioncode +@return valor de actioncode*/ +public String getActioncode(){ + return actioncode; +} +/**Fija el valor de actioncode +@param pActioncode nuevo Valor de actioncode*/ +public void setActioncode(String pActioncode){ + actioncode=pActioncode; +} + +/**Obtiene el valor de active +@return valor de active*/ +public String getActive(){ + return active; +} +/**Fija el valor de active +@param pActive nuevo Valor de active*/ +public void setActive(String pActive){ + active=pActive; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneBatchPreviousProcess))return false; + TgeneBatchPreviousProcess that = (TgeneBatchPreviousProcess) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneBatchPreviousProcess +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneBatchPreviousProcess +*/ +public Object createInstance(){ + TgeneBatchPreviousProcess instance=new TgeneBatchPreviousProcess(); + instance.setPk(new TgeneBatchPreviousProcessKey()); + return instance; +} +/**Clona la entidad TgeneBatchPreviousProcess +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneBatchPreviousProcess p=(TgeneBatchPreviousProcess)this.clone(); + p.setPk((TgeneBatchPreviousProcessKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchPreviousProcessKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchPreviousProcessKey.java new file mode 100644 index 0000000..b3b1e77 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchPreviousProcessKey.java @@ -0,0 +1,205 @@ +package com.fp.persistence.pgeneral.batch; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEBATCHPREVIOUSPROCESS*/ +@Embeddable +public class TgeneBatchPreviousProcessKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="PROCESSCODE", nullable=false,updatable=false) + +/** +* Paquete clase de un comando a ejecutar. +*/ +private String processcode; + +/**Contructor por defecto*/ +public TgeneBatchPreviousProcessKey(){} +/**Contructor de TgeneBatchPreviousProcessKey +@param pModulecode Codigo de modulo +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pProcesscode Paquete clase de un comando a ejecutar. +*/ +public TgeneBatchPreviousProcessKey(String pModulecode,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,String pProcesscode){ + modulecode=pModulecode; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + processcode=pProcesscode; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de processcode +@return valor de processcode*/ +public String getProcesscode(){ + return processcode; +} +/**Fija el valor de processcode +@param pProcesscode nuevo Valor de processcode*/ +public void setProcesscode(String pProcesscode){ + processcode=pProcesscode; +} + +/**Implementacin de la comparacin de TgeneBatchPreviousProcessKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneBatchPreviousProcessKey))return false; + TgeneBatchPreviousProcessKey that = (TgeneBatchPreviousProcessKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getProcesscode() == null || that.getProcesscode() == null){ + return false; + } + if (! this.getProcesscode().equals(that.getProcesscode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneBatchPreviousProcessKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getProcesscode() == null ? 0 : this.getProcesscode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchProcess.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchProcess.java new file mode 100644 index 0000000..f83aea1 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchProcess.java @@ -0,0 +1,219 @@ +package com.fp.persistence.pgeneral.batch; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEBATCHPROCESS*/ +@Entity(name="TgeneBatchProcess") +@Table(name="TGENEBATCHPROCESS") +public class TgeneBatchProcess extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneBatchProcess +*/ +@EmbeddedId +private TgeneBatchProcessKey pk; +@Column(name="CATALOGTYPEPROCESS", nullable=false) + +/** +* Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia +*/ +private String catalogtypeprocess; + +@Column(name="CATALOGCODETYPEPROCESS", nullable=false) + +/** +* Codigo de tabla de catalogo del proceso de negocio de la aplicacion +*/ +private String catalogcodetypeprocess; + +@Column(name="PROCESSORDER", nullable=true) + +/** +* Orden de proceso de la regla. +*/ +private Integer processorder; + +@Column(name="ACTIONCODE", nullable=false) + +/** +* Codigo de accion a ajecutar, ejm, CAPITALIZE, CUT +*/ +private String actioncode; + +@Column(name="ACTIVE", nullable=true) + +/** +* Y se ejecuta la regla al ejecutar el fin de dia, N no se ejecuta la regla al ejecutar el fin de dia. +*/ +private String active; + +/**Contructor por defecto*/ +public TgeneBatchProcess(){ +} +/**Contructor de TgeneBatchProcess +@param pPk Clave Primaria del entity +@param pCatalogtypeprocess Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia +@param pCatalogcodetypeprocess Codigo de tabla de catalogo del proceso de negocio de la aplicacion +@param pActioncode Codigo de accion a ajecutar, ejm, CAPITALIZE, CUT +*/ +public TgeneBatchProcess(TgeneBatchProcessKey pPk,String pCatalogtypeprocess,String pCatalogcodetypeprocess,String pActioncode){ + this(); + pk=pPk; + catalogtypeprocess=pCatalogtypeprocess; + catalogcodetypeprocess=pCatalogcodetypeprocess; + actioncode=pActioncode; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneBatchProcess +*/ +public static TgeneBatchProcess find(EntityManager pEntityManager,TgeneBatchProcessKey pKey) throws Exception{ + TgeneBatchProcess obj = pEntityManager.find(TgeneBatchProcess.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneBatchProcess +@return El objeto que referencia a la Clave primaria de TgeneBatchProcess +*/ +public TgeneBatchProcessKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneBatchProcess +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneBatchProcess +*/ +public void setPk(TgeneBatchProcessKey pPk){ + pk=pPk; +} +/**Obtiene el valor de catalogtypeprocess +@return valor de catalogtypeprocess*/ +public String getCatalogtypeprocess(){ + return catalogtypeprocess; +} +/**Fija el valor de catalogtypeprocess +@param pCatalogtypeprocess nuevo Valor de catalogtypeprocess*/ +public void setCatalogtypeprocess(String pCatalogtypeprocess){ + catalogtypeprocess=pCatalogtypeprocess; +} + +/**Obtiene el valor de catalogcodetypeprocess +@return valor de catalogcodetypeprocess*/ +public String getCatalogcodetypeprocess(){ + return catalogcodetypeprocess; +} +/**Fija el valor de catalogcodetypeprocess +@param pCatalogcodetypeprocess nuevo Valor de catalogcodetypeprocess*/ +public void setCatalogcodetypeprocess(String pCatalogcodetypeprocess){ + catalogcodetypeprocess=pCatalogcodetypeprocess; +} + +/**Obtiene el valor de processorder +@return valor de processorder*/ +public Integer getProcessorder(){ + return processorder; +} +/**Fija el valor de processorder +@param pProcessorder nuevo Valor de processorder*/ +public void setProcessorder(Integer pProcessorder){ + processorder=pProcessorder; +} + +/**Obtiene el valor de actioncode +@return valor de actioncode*/ +public String getActioncode(){ + return actioncode; +} +/**Fija el valor de actioncode +@param pActioncode nuevo Valor de actioncode*/ +public void setActioncode(String pActioncode){ + actioncode=pActioncode; +} + +/**Obtiene el valor de active +@return valor de active*/ +public String getActive(){ + return active; +} +/**Fija el valor de active +@param pActive nuevo Valor de active*/ +public void setActive(String pActive){ + active=pActive; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneBatchProcess))return false; + TgeneBatchProcess that = (TgeneBatchProcess) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneBatchProcess +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneBatchProcess +*/ +public Object createInstance(){ + TgeneBatchProcess instance=new TgeneBatchProcess(); + instance.setPk(new TgeneBatchProcessKey()); + return instance; +} +/**Clona la entidad TgeneBatchProcess +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneBatchProcess p=(TgeneBatchProcess)this.clone(); + p.setPk((TgeneBatchProcessKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchProcessKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchProcessKey.java new file mode 100644 index 0000000..a6f069a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/batch/TgeneBatchProcessKey.java @@ -0,0 +1,205 @@ +package com.fp.persistence.pgeneral.batch; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEBATCHPROCESS*/ +@Embeddable +public class TgeneBatchProcessKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="PROCESSCODE", nullable=false,updatable=false) + +/** +* Paquete clase de un comando a ejecutar. +*/ +private String processcode; + +/**Contructor por defecto*/ +public TgeneBatchProcessKey(){} +/**Contructor de TgeneBatchProcessKey +@param pModulecode Codigo de modulo +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pProcesscode Paquete clase de un comando a ejecutar. +*/ +public TgeneBatchProcessKey(String pModulecode,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,String pProcesscode){ + modulecode=pModulecode; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + processcode=pProcesscode; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de processcode +@return valor de processcode*/ +public String getProcesscode(){ + return processcode; +} +/**Fija el valor de processcode +@param pProcesscode nuevo Valor de processcode*/ +public void setProcesscode(String pProcesscode){ + processcode=pProcesscode; +} + +/**Implementacin de la comparacin de TgeneBatchProcessKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneBatchProcessKey))return false; + TgeneBatchProcessKey that = (TgeneBatchProcessKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getProcesscode() == null || that.getProcesscode() == null){ + return false; + } + if (! this.getProcesscode().equals(that.getProcesscode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneBatchProcessKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getProcesscode() == null ? 0 : this.getProcesscode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/entries new file mode 100644 index 0000000..0a2385b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/entries @@ -0,0 +1,300 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneCharges.java +file + + + + +2022-07-28T03:40:29.594746Z +50a5be234729f70a376f47a321276e18 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +14508 + +TgeneChargesCheckbookKey.java +file + + + + +2022-07-28T03:40:29.594746Z +c7ede86f4798fc8de17919ec490ccf3f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5898 + +TgeneSubProductChargesKey.java +file + + + + +2022-07-28T03:40:29.594746Z +4efba98235d2d66df117554c6972be9a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9601 + +TgeneChargesGroupKey.java +file + + + + +2022-07-28T03:40:29.594746Z +a6b977fb358cd97aca23414ff3322aee +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9695 + +TgeneChargesCheckbook.java +file + + + + +2022-07-28T03:40:29.595746Z +610241b65e744d932290037c6bffe2fa +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4745 + +TgeneChargesKey.java +file + + + + +2022-07-28T03:40:29.595746Z +aef2d73441706405b01af2993127f126 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7804 + +TgeneSubProductCharges.java +file + + + + +2022-07-28T03:40:29.595746Z +d926c20b0debf87b555cd7520fc5fa64 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +18963 + +TgeneChargesGroup.java +file + + + + +2022-07-28T03:40:29.595746Z +76677f23d94938f6c090b3aed92deb83 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9168 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneCharges.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneCharges.java.svn-base new file mode 100644 index 0000000..9f74f99 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneCharges.java.svn-base @@ -0,0 +1,461 @@ +package com.fp.persistence.pgeneral.charge; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECHARGES */ +@Entity(name = "TgeneCharges") +@Table(name = "TGENECHARGES") +public class TgeneCharges extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneCharges + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(RATESEQUENCE),0)+1 from TGENECHARGES " + "where BALANCETYPE=:btype " + + "and BALANCEGROUP=:bgroup " + "and MODULECODE=:modulecode " + "and STATUSCODE=:statuscode " + "and COMPANYCODE=:companycode " + + "and CURRENCYCODE = :currencycode"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "btype,pk.balancetype;bgroup,pk.balancegroup;modulecode,pk.modulecode;statuscode,pk.statuscode;companycode,pk.companycode;currencycode,pk.currencycode"), + @Parameter(name = "field", value = "ratesequence") }) + @GeneratedValue(generator = "seq_id") + private TgeneChargesKey pk; + + @Column(name = "CHARGECURRENCYCODE", nullable = true) + /** + * Codigo de moneda en la que esta expresado el cargo + */ + private String chargecurrencycode; + + @Column(name = "RATE", nullable = true) + /** + * Tasa anual a aplicar + */ + private BigDecimal rate; + + @Column(name = "PERCENT", nullable = true) + /** + * Porcentaje flat a aplicar + */ + private BigDecimal percent; + + @Column(name = "MINVALUE", nullable = true) + /** + * Valor minimo a cobrar + */ + private BigDecimal minvalue; + + @Column(name = "MAXVALUE", nullable = true) + /** + * Valor maximo a cobrar + */ + private BigDecimal maxvalue; + + @Column(name = "MINAMOUNT", nullable = true) + /** + * Monto minimo para buscar el cargo + */ + private BigDecimal minamount; + + @Column(name = "MAXAMOUNT", nullable = true) + /** + * Monto maximo para buscar el cargo + */ + private BigDecimal maxamount; + + /** Contructor por defecto */ + public TgeneCharges() { + } + + /** + * Contructor de TgeneCharges + * + * @param pPk Clave Primaria del entity + */ + public TgeneCharges(TgeneChargesKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneCharges + */ + public static TgeneCharges find(EntityManager pEntityManager, TgeneChargesKey pKey) throws Exception { + TgeneCharges obj = pEntityManager.find(TgeneCharges.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneCharges + * + * @return El objeto que referencia a la Clave primaria de TgeneCharges + */ + public TgeneChargesKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneCharges + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneCharges + */ + public void setPk(TgeneChargesKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de chargecurrencycode + * + * @return valor de chargecurrencycode + */ + public String getChargecurrencycode() { + return this.chargecurrencycode; + } + + /** + * Fija el valor de chargecurrencycode + * + * @param pChargecurrencycode nuevo Valor de chargecurrencycode + */ + public void setChargecurrencycode(String pChargecurrencycode) { + this.chargecurrencycode = pChargecurrencycode; + } + + /** + * Obtiene el valor de rate + * + * @return valor de rate + */ + public BigDecimal getRate() { + return this.rate; + } + + /** + * Fija el valor de rate + * + * @param pRate nuevo Valor de rate + */ + public void setRate(BigDecimal pRate) { + this.rate = pRate; + } + + /** + * Obtiene el valor de percent + * + * @return valor de percent + */ + public BigDecimal getPercent() { + return this.percent; + } + + /** + * Fija el valor de percent + * + * @param pPercent nuevo Valor de percent + */ + public void setPercent(BigDecimal pPercent) { + this.percent = pPercent; + } + + /** + * Obtiene el valor de minvalue + * + * @return valor de minvalue + */ + public BigDecimal getMinvalue() { + return this.minvalue; + } + + /** + * Fija el valor de minvalue + * + * @param pMinvalue nuevo Valor de minvalue + */ + public void setMinvalue(BigDecimal pMinvalue) { + this.minvalue = pMinvalue; + } + + /** + * Obtiene el valor de maxvalue + * + * @return valor de maxvalue + */ + public BigDecimal getMaxvalue() { + return this.maxvalue; + } + + /** + * Fija el valor de maxvalue + * + * @param pMaxvalue nuevo Valor de maxvalue + */ + public void setMaxvalue(BigDecimal pMaxvalue) { + this.maxvalue = pMaxvalue; + } + + /** + * Obtiene el valor de minamount + * + * @return valor de minamount + */ + public BigDecimal getMinamount() { + return this.minamount; + } + + /** + * Fija el valor de minamount + * + * @param pMinamount nuevo Valor de minamount + */ + public void setMinamount(BigDecimal pMinamount) { + this.minamount = pMinamount; + } + + /** + * Obtiene el valor de maxamount + * + * @return valor de maxamount + */ + public BigDecimal getMaxamount() { + return this.maxamount; + } + + /** + * Fija el valor de maxamount + * + * @param pMaxamount nuevo Valor de maxamount + */ + public void setMaxamount(BigDecimal pMaxamount) { + this.maxamount = pMaxamount; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneCharges)) { + return false; + } + TgeneCharges that = (TgeneCharges) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneCharges + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneCharges */ + @Override + public Object createInstance() { + TgeneCharges instance = new TgeneCharges(); + instance.setPk(new TgeneChargesKey()); + return instance; + } + + /** + * Clona la entidad TgeneCharges + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneCharges p = (TgeneCharges) this.clone(); + p.setPk((TgeneChargesKey) this.pk.cloneMe()); + return p; + } + + // Metodos manuales + + public boolean equalsWithoutSequence(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneCharges)) { + return false; + } + TgeneCharges that = (TgeneCharges) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + + TgeneChargesKey thispk = this.getPk(); + TgeneChargesKey thatpk = that.getPk(); + + if (thatpk == null) { + return false; + } + if (!(thatpk instanceof TgeneChargesKey)) { + return false; + } + if ((thispk.getBalancetype() == null) || (thatpk.getBalancetype() == null)) { + return false; + } + if (!thispk.getBalancetype().equals(thatpk.getBalancetype())) { + return false; + } + if ((thispk.getBalancegroup() == null) || (thatpk.getBalancegroup() == null)) { + return false; + } + if (!thispk.getBalancegroup().equals(thatpk.getBalancegroup())) { + return false; + } + if ((thispk.getModulecode() == null) || (thatpk.getModulecode() == null)) { + return false; + } + if (!thispk.getModulecode().equals(thatpk.getModulecode())) { + return false; + } + if ((thispk.getStatuscode() == null) || (thatpk.getStatuscode() == null)) { + return false; + } + if (!thispk.getStatuscode().equals(thatpk.getStatuscode())) { + return false; + } + if ((thispk.getCompanycode() == null) || (thatpk.getCompanycode() == null)) { + return false; + } + if (!thispk.getCompanycode().equals(thatpk.getCompanycode())) { + return false; + } + if ((thispk.getCurrencycode() == null) || (thatpk.getCurrencycode() == null)) { + return false; + } + if (!thispk.getCurrencycode().equals(thatpk.getCurrencycode())) { + return false; + } + return true; + } + + /** Sentencia que devuelve un registro de TgeneCharges. */ + private static final String HQL_CHARGES = "from TgeneCharges tcharges " + " where tcharges.pk.balancetype = :balancetype " + + " and tcharges.pk.balancegroup = :balancegroup " + " and tcharges.pk.modulecode = :modulecode " + + " and tcharges.pk.statuscode = :statuscode " + " and tcharges.pk.companycode = :companycode " + + " and tcharges.pk.currencycode = :currencycode " + " and :amount between tcharges.minamount and tcharges.maxamount "; + + /** + * Metodo que entrega la definicion de cargos generales. + * + * @param pBalanceType Codigo de tipo de saldo a entregar buscar cargo. + * @param pBanceGroup Codigo de tipo grupo de balance a entregar buscar cargo. + * @param pModuleCode Codigo de modulo asociado al estatus de la cuenta a buscar el cargo. + * @param pStatusCode Codigo de estatus de la cuenta a buscar el saldo. + * @param pComapny Codigo de compania de la cuenta a buscar le cargo. + * @param pCurrency Codigo de moneda de la cuenta a buscar le cargo. + * @param pAmount Monto base con el cual se obtiene el cargo. + * @return TgeneCharges + * @throws Exception + */ + public static TgeneCharges find(EntityManager pEntitymanager, String pBalanceType, String pBanceGroup, String pModuleCode, String pStatusCode, + Integer pComapny, String pCurrency, BigDecimal pAmount) throws Exception { + TgeneCharges obj = null; + Query qry = pEntitymanager.createQuery(TgeneCharges.HQL_CHARGES); + qry.setParameter("balancetype", pBalanceType); + qry.setParameter("balancegroup", pBanceGroup); + qry.setParameter("modulecode", pModuleCode); + qry.setParameter("statuscode", pStatusCode); + qry.setParameter("companycode", pComapny); + qry.setParameter("currencycode", pCurrency); + qry.setParameter("amount", pAmount); + try { + obj = (TgeneCharges) qry.getSingleResult(); + } catch (NoResultException e) { + return obj; + } + return obj; + } + + /** Sentencia que devuelve una lista de TgeneSubProductCharges por compania. */ + private static final String JQL_CHARGES_BY_MODULE = "from TgeneCharges tchar " + " where tchar.pk.modulecode = :modulecode "; + + /** + * Metodo que entrega la definicion de cargos definidos por subproducto. + * + * @param pCompany Codigo de compania. + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findByModule(EntityManager pEntityManager, String pModuleCode) { + List list = null; + Query qry = pEntityManager.createQuery(TgeneCharges.JQL_CHARGES_BY_MODULE); + qry.setParameter("modulecode", pModuleCode); + list = qry.getResultList(); + return list; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneChargesCheckbook.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneChargesCheckbook.java.svn-base new file mode 100644 index 0000000..921c40f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneChargesCheckbook.java.svn-base @@ -0,0 +1,158 @@ +package com.fp.persistence.pgeneral.charge; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECHARGESCHECKBOOK*/ +@Entity(name="TgeneChargesCheckbook") +@Table(name="TGENECHARGESCHECKBOOK") +public class TgeneChargesCheckbook extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneChargesCheckbook +*/ +@EmbeddedId +private TgeneChargesCheckbookKey pk; +@Column(name="CHARGECURRENCYCODE", nullable=true) + +/** +* Codigo de moneda en la que esta expresado el cargo +*/ +private String chargecurrencycode; + +@Column(name="VALUE", nullable=true) + +/** +* Costo de la chequera +*/ +private BigDecimal value; + +/**Contructor por defecto*/ +public TgeneChargesCheckbook(){ +} +/**Contructor de TgeneChargesCheckbook +@param pPk Clave Primaria del entity +*/ +public TgeneChargesCheckbook(TgeneChargesCheckbookKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneChargesCheckbook +*/ +public static TgeneChargesCheckbook find(EntityManager pEntityManager,TgeneChargesCheckbookKey pKey) throws Exception{ + TgeneChargesCheckbook obj = pEntityManager.find(TgeneChargesCheckbook.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneChargesCheckbook +@return El objeto que referencia a la Clave primaria de TgeneChargesCheckbook +*/ +public TgeneChargesCheckbookKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneChargesCheckbook +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneChargesCheckbook +*/ +public void setPk(TgeneChargesCheckbookKey pPk){ + pk=pPk; +} +/**Obtiene el valor de chargecurrencycode +@return valor de chargecurrencycode*/ +public String getChargecurrencycode(){ + return chargecurrencycode; +} +/**Fija el valor de chargecurrencycode +@param pChargecurrencycode nuevo Valor de chargecurrencycode*/ +public void setChargecurrencycode(String pChargecurrencycode){ + chargecurrencycode=pChargecurrencycode; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneChargesCheckbook))return false; + TgeneChargesCheckbook that = (TgeneChargesCheckbook) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneChargesCheckbook +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneChargesCheckbook +*/ +public Object createInstance(){ + TgeneChargesCheckbook instance=new TgeneChargesCheckbook(); + instance.setPk(new TgeneChargesCheckbookKey()); + return instance; +} +/**Clona la entidad TgeneChargesCheckbook +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneChargesCheckbook p=(TgeneChargesCheckbook)this.clone(); + p.setPk((TgeneChargesCheckbookKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneChargesCheckbookKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneChargesCheckbookKey.java.svn-base new file mode 100644 index 0000000..0b069b8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneChargesCheckbookKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.charge; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENECHARGESCHECKBOOK*/ +@Embeddable +public class TgeneChargesCheckbookKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CHECKBOOKTYPECATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo ejemlo con talon de 50 cheques. +*/ +private String checkbooktypecatalog; + +@Column(name="CHECKBOOKTYPECATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo de tipo de chequeras CHECKBOOKTYPE +*/ +private String checkbooktypecatalogcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda de la cuenta, asociada a la chequera. +*/ +private String currencycode; + +/**Contructor por defecto*/ +public TgeneChargesCheckbookKey(){} +/**Contructor de TgeneChargesCheckbookKey +@param pCheckbooktypecatalog Codigo de catalogo ejemlo con talon de 50 cheques. +@param pCheckbooktypecatalogcode Codigo de tabla de catalogo de tipo de chequeras CHECKBOOKTYPE +@param pCompanycode Codigo de compania +@param pCurrencycode Codigo de moneda de la cuenta, asociada a la chequera. +*/ +public TgeneChargesCheckbookKey(String pCheckbooktypecatalog,String pCheckbooktypecatalogcode,Integer pCompanycode,String pCurrencycode){ + checkbooktypecatalog=pCheckbooktypecatalog; + checkbooktypecatalogcode=pCheckbooktypecatalogcode; + companycode=pCompanycode; + currencycode=pCurrencycode; +} +/**Obtiene el valor de checkbooktypecatalog +@return valor de checkbooktypecatalog*/ +public String getCheckbooktypecatalog(){ + return checkbooktypecatalog; +} +/**Fija el valor de checkbooktypecatalog +@param pCheckbooktypecatalog nuevo Valor de checkbooktypecatalog*/ +public void setCheckbooktypecatalog(String pCheckbooktypecatalog){ + checkbooktypecatalog=pCheckbooktypecatalog; +} + +/**Obtiene el valor de checkbooktypecatalogcode +@return valor de checkbooktypecatalogcode*/ +public String getCheckbooktypecatalogcode(){ + return checkbooktypecatalogcode; +} +/**Fija el valor de checkbooktypecatalogcode +@param pCheckbooktypecatalogcode nuevo Valor de checkbooktypecatalogcode*/ +public void setCheckbooktypecatalogcode(String pCheckbooktypecatalogcode){ + checkbooktypecatalogcode=pCheckbooktypecatalogcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Implementacin de la comparacin de TgeneChargesCheckbookKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneChargesCheckbookKey))return false; + TgeneChargesCheckbookKey that = (TgeneChargesCheckbookKey) o; + if (this.getCheckbooktypecatalog() == null || that.getCheckbooktypecatalog() == null){ + return false; + } + if (! this.getCheckbooktypecatalog().equals(that.getCheckbooktypecatalog())){ + return false; + } + if (this.getCheckbooktypecatalogcode() == null || that.getCheckbooktypecatalogcode() == null){ + return false; + } + if (! this.getCheckbooktypecatalogcode().equals(that.getCheckbooktypecatalogcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneChargesCheckbookKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCheckbooktypecatalog() == null ? 0 : this.getCheckbooktypecatalog().hashCode()); + result = result * 37 + (this.getCheckbooktypecatalogcode() == null ? 0 : this.getCheckbooktypecatalogcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneChargesGroup.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneChargesGroup.java.svn-base new file mode 100644 index 0000000..7b5e195 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneChargesGroup.java.svn-base @@ -0,0 +1,331 @@ +package com.fp.persistence.pgeneral.charge; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECHARGESGROUP */ +@Entity(name = "TgeneChargesGroup") +@Table(name = "TGENECHARGESGROUP") +public class TgeneChargesGroup extends com.fp.dto.AbstractDataTransport + implements + Serializable, + HibernateBean, + Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneChargesGroup + */ + @EmbeddedId + private TgeneChargesGroupKey pk; + @Column(name = "CHARGECURRENCYCODE", nullable = true) + /** + * Codigo de moneda en la que esta expresado el cargo + */ + private String chargecurrencycode; + + @Column(name = "RATE", nullable = true) + /** + * Tasa anual a aplicar + */ + private BigDecimal rate; + + @Column(name = "PERCENT", nullable = true) + /** + * Porcentaje flat a aplicar + */ + private BigDecimal percent; + + @Column(name = "MINVALUE", nullable = true) + /** + * Valor minimo a cobrar + */ + private BigDecimal minvalue; + + @Column(name = "MAXVALUE", nullable = true) + /** + * Valor maximo a cobrar + */ + private BigDecimal maxvalue; + + @Column(name = "MAXAMOUNT", nullable = true) + /** + * Monto maximo para buscar el cargo + */ + private BigDecimal maxamount; + + /** Contructor por defecto */ + public TgeneChargesGroup() { + } + /** + * Contructor de TgeneChargesGroup + * + * @param pPk Clave Primaria del entity + */ + public TgeneChargesGroup(TgeneChargesGroupKey pPk) { + this(); + pk = pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneChargesGroup + */ + public static TgeneChargesGroup find(EntityManager pEntityManager, TgeneChargesGroupKey pKey) throws Exception { + TgeneChargesGroup obj = pEntityManager.find(TgeneChargesGroup.class, pKey); + return obj; + } + /** + * Entrega la Clave primaria de TgeneChargesGroup + * + * @return El objeto que referencia a la Clave primaria de TgeneChargesGroup + */ + public TgeneChargesGroupKey getPk() { + return pk; + } + /** + * Fija un nuevo valor a la Clave primaria de TgeneChargesGroup + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneChargesGroup + */ + public void setPk(TgeneChargesGroupKey pPk) { + pk = pPk; + } + /** + * Obtiene el valor de chargecurrencycode + * + * @return valor de chargecurrencycode + */ + public String getChargecurrencycode() { + return chargecurrencycode; + } + /** + * Fija el valor de chargecurrencycode + * + * @param pChargecurrencycode nuevo Valor de chargecurrencycode + */ + public void setChargecurrencycode(String pChargecurrencycode) { + chargecurrencycode = pChargecurrencycode; + } + + /** + * Obtiene el valor de rate + * + * @return valor de rate + */ + public BigDecimal getRate() { + return rate; + } + /** + * Fija el valor de rate + * + * @param pRate nuevo Valor de rate + */ + public void setRate(BigDecimal pRate) { + rate = pRate; + } + + /** + * Obtiene el valor de percent + * + * @return valor de percent + */ + public BigDecimal getPercent() { + return percent; + } + /** + * Fija el valor de percent + * + * @param pPercent nuevo Valor de percent + */ + public void setPercent(BigDecimal pPercent) { + percent = pPercent; + } + + /** + * Obtiene el valor de minvalue + * + * @return valor de minvalue + */ + public BigDecimal getMinvalue() { + return minvalue; + } + /** + * Fija el valor de minvalue + * + * @param pMinvalue nuevo Valor de minvalue + */ + public void setMinvalue(BigDecimal pMinvalue) { + minvalue = pMinvalue; + } + + /** + * Obtiene el valor de maxvalue + * + * @return valor de maxvalue + */ + public BigDecimal getMaxvalue() { + return maxvalue; + } + /** + * Fija el valor de maxvalue + * + * @param pMaxvalue nuevo Valor de maxvalue + */ + public void setMaxvalue(BigDecimal pMaxvalue) { + maxvalue = pMaxvalue; + } + + /** + * Obtiene el valor de maxamount + * + * @return valor de maxamount + */ + public BigDecimal getMaxamount() { + return maxamount; + } + /** + * Fija el valor de maxamount + * + * @param pMaxamount nuevo Valor de maxamount + */ + public void setMaxamount(BigDecimal pMaxamount) { + maxamount = pMaxamount; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneChargesGroup)) + return false; + TgeneChargesGroup that = (TgeneChargesGroup) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /** + * Implementacin del metodo hashCode de la la entidad TgeneChargesGroup + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + /** Implementacin de la creacin de un bean en blanco TgeneChargesGroup */ + public Object createInstance() { + TgeneChargesGroup instance = new TgeneChargesGroup(); + instance.setPk(new TgeneChargesGroupKey()); + return instance; + } + /** + * Clona la entidad TgeneChargesGroup + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneChargesGroup p = (TgeneChargesGroup) this.clone(); + p.setPk((TgeneChargesGroupKey) this.pk.cloneMe()); + return p; + } + + //Metodos manuales. + /** Sentencia que devuelve un registro de TgeneChargesGroup.*/ + private static final String HQL_CHARGES_GROUP = + "from TgeneChargesGroup tchargrp " + + " where tchargrp.pk.catalog = :catalog " + + " and tchargrp.pk.catalogcode = :catalogcode "+ + " and tchargrp.pk.balancetype = :balancetype "+ + " and tchargrp.pk.balancegroup = :balancegroup "+ + " and tchargrp.pk.modulecode = :modulecode "+ + " and tchargrp.pk.statuscode = :statuscode "+ + " and tchargrp.pk.companycode = :companycode "+ + " and tchargrp.pk.currencycode = :currencycode "+ + " and :amount between tchargrp.pk.minamount and tchargrp.maxamount "; + + + /** + * Metodo que entrega la definicion de cargos de grupos de clientes. + * @param pCatalog Codigo de aagrupacion de cargos, Empleados, Clientes vip + * @param pCatalogCode Codigo de catalogo de agrupacion de cargos (CHARGES) + * @param pBalanceType Codigo de tipo de saldo a entregar buscar cargo. + * @param pBanceGroup Codigo de tipo grupo de balance a entregar buscar cargo. + * @param pModuleCode Codigo de modulo asociado al estatus de la cuenta a buscar el cargo. + * @param pStatusCode Codigo de estatus de la cuenta a buscar el saldo. + * @param pCompany Codigo de compania de la cuenta a buscar le cargo. + * @param pCurrency Codigo de moneda de la cuenta a buscar le cargo. + * @param pAmount Monto base con el cual se obtiene el cargo. + * @return TgeneChargesGroup + * @throws Exception + */ + public static TgeneChargesGroup find(EntityManager pEntityManager,String pCatalog,String pCatalogCode,String pBalanceType, + String pBanceGroup,String pModuleCode,String pStatusCode,Integer pCompany,String pCurrency,BigDecimal pAmount) throws Exception { + TgeneChargesGroup obj = null; + Query qry = pEntityManager.createQuery(HQL_CHARGES_GROUP); + qry.setParameter("catalog", pCatalog); + qry.setParameter("catalogcode", pCatalog); + qry.setParameter("balancetype", pCatalog); + qry.setParameter("balancegroup", pCatalog); + qry.setParameter("modulecode", pCatalog); + qry.setParameter("statuscode", pCatalog); + qry.setParameter("companycode", pCatalog); + qry.setParameter("currencycode", pCatalog); + qry.setParameter("amount", pCatalog); + try { + obj = (TgeneChargesGroup)qry.getSingleResult(); + } catch (NoResultException e) { + return obj; + } + return obj; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneChargesGroupKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneChargesGroupKey.java.svn-base new file mode 100644 index 0000000..b38d691 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneChargesGroupKey.java.svn-base @@ -0,0 +1,314 @@ +package com.fp.persistence.pgeneral.charge; + +import javax.persistence.Column; +import java.io.Serializable; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENECHARGESGROUP*/ +@Embeddable +public class TgeneChargesGroupKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CHARGECATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo EMPLOYEE, VIP etc +*/ +private String chargecatalog; + +@Column(name="CHARGECATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo (CHARGES) +*/ +private String chargecatalogcode; + +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda de la cuenta +*/ +private String currencycode; + +@Column(name="MINAMOUNT", nullable=false,updatable=false) + +/** +* Monto minimo para buscar el cargo +*/ +private BigDecimal minamount; + +/**Contructor por defecto*/ +public TgeneChargesGroupKey(){} +/**Contructor de TgeneChargesGroupKey +@param pChargecatalog Codigo de catalogo EMPLOYEE, VIP etc +@param pChargecatalogcode Codigo de tabla de catalogo (CHARGES) +@param pBalancetype Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +@param pModulecode Codigo de modulo +@param pStatuscode Estatus de cuenta +@param pCompanycode Codigo de compania +@param pCurrencycode Codigo de moneda de la cuenta +@param pMinamount Monto minimo para buscar el cargo +*/ +public TgeneChargesGroupKey(String pChargecatalog,String pChargecatalogcode,String pBalancetype,String pBalancegroup,String pModulecode,String pStatuscode,Integer pCompanycode,String pCurrencycode,BigDecimal pMinamount){ + chargecatalog=pChargecatalog; + chargecatalogcode=pChargecatalogcode; + balancetype=pBalancetype; + balancegroup=pBalancegroup; + modulecode=pModulecode; + statuscode=pStatuscode; + companycode=pCompanycode; + currencycode=pCurrencycode; + minamount=pMinamount; +} +/**Obtiene el valor de chargecatalog +@return valor de chargecatalog*/ +public String getChargecatalog(){ + return chargecatalog; +} +/**Fija el valor de chargecatalog +@param pChargecatalog nuevo Valor de chargecatalog*/ +public void setChargecatalog(String pChargecatalog){ + chargecatalog=pChargecatalog; +} + +/**Obtiene el valor de chargecatalogcode +@return valor de chargecatalogcode*/ +public String getChargecatalogcode(){ + return chargecatalogcode; +} +/**Fija el valor de chargecatalogcode +@param pChargecatalogcode nuevo Valor de chargecatalogcode*/ +public void setChargecatalogcode(String pChargecatalogcode){ + chargecatalogcode=pChargecatalogcode; +} + +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de minamount +@return valor de minamount*/ +public BigDecimal getMinamount(){ + return minamount; +} +/**Fija el valor de minamount +@param pMinamount nuevo Valor de minamount*/ +public void setMinamount(BigDecimal pMinamount){ + minamount=pMinamount; +} + +/**Implementacin de la comparacin de TgeneChargesGroupKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneChargesGroupKey))return false; + TgeneChargesGroupKey that = (TgeneChargesGroupKey) o; + if (this.getChargecatalog() == null || that.getChargecatalog() == null){ + return false; + } + if (! this.getChargecatalog().equals(that.getChargecatalog())){ + return false; + } + if (this.getChargecatalogcode() == null || that.getChargecatalogcode() == null){ + return false; + } + if (! this.getChargecatalogcode().equals(that.getChargecatalogcode())){ + return false; + } + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getMinamount() == null || that.getMinamount() == null){ + return false; + } + if (! this.getMinamount().equals(that.getMinamount())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneChargesGroupKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getChargecatalog() == null ? 0 : this.getChargecatalog().hashCode()); + result = result * 37 + (this.getChargecatalogcode() == null ? 0 : this.getChargecatalogcode().hashCode()); + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getMinamount() == null ? 0 : this.getMinamount().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneChargesKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneChargesKey.java.svn-base new file mode 100644 index 0000000..01b61e6 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneChargesKey.java.svn-base @@ -0,0 +1,259 @@ +package com.fp.persistence.pgeneral.charge; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENECHARGES*/ +@Embeddable +public class TgeneChargesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda de la cuenta +*/ +private String currencycode; + +@Column(name="RATESEQUENCE", nullable=false,updatable=false) + +/** +* Secuencial para tasas +*/ +private Integer ratesequence; + +/**Contructor por defecto*/ +public TgeneChargesKey(){} +/**Contructor de TgeneChargesKey +@param pBalancetype Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +@param pModulecode Codigo de modulo +@param pStatuscode Estatus de cuenta +@param pCompanycode Codigo de compania +@param pCurrencycode Codigo de moneda de la cuenta +@param pRatesequence Secuencial para tasas +*/ +public TgeneChargesKey(String pBalancetype,String pBalancegroup,String pModulecode,String pStatuscode,Integer pCompanycode,String pCurrencycode,Integer pRatesequence){ + balancetype=pBalancetype; + balancegroup=pBalancegroup; + modulecode=pModulecode; + statuscode=pStatuscode; + companycode=pCompanycode; + currencycode=pCurrencycode; + ratesequence=pRatesequence; +} +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de ratesequence +@return valor de ratesequence*/ +public Integer getRatesequence(){ + return ratesequence; +} +/**Fija el valor de ratesequence +@param pRatesequence nuevo Valor de ratesequence*/ +public void setRatesequence(Integer pRatesequence){ + ratesequence=pRatesequence; +} + +/**Implementacion de la comparacion de TgeneChargesKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneChargesKey))return false; + TgeneChargesKey that = (TgeneChargesKey) o; + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getRatesequence() == null || that.getRatesequence() == null){ + return false; + } + if (! this.getRatesequence().equals(that.getRatesequence())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneChargesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getRatesequence() == null ? 0 : this.getRatesequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneSubProductCharges.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneSubProductCharges.java.svn-base new file mode 100644 index 0000000..b12a6e7 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneSubProductCharges.java.svn-base @@ -0,0 +1,534 @@ +package com.fp.persistence.pgeneral.charge; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESUBPRODUCTCHARGES */ +@Entity(name = "TgeneSubProductCharges") +@Table(name = "TGENESUBPRODUCTCHARGES") +public class TgeneSubProductCharges extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneSubProductCharges + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(RATESEQUENCE),0)+1 from TGENESUBPRODUCTCHARGES " + "where BALANCETYPE=:btype " + + "and BALANCEGROUP=:bgroup " + "and MODULECODE=:modulecode " + "and PRODUCTCODE=:productcode " + + "and SUBPRODUCTCODE=:subproductcode " + "and STATUSCODE=:statuscode " + "and COMPANYCODE=:companycode " + + "and CURRENCYCODE = :currencycode"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "btype,pk.balancetype;bgroup,pk.balancegroup;modulecode,pk.modulecode;productcode,pk.productcode;subproductcode,pk.subproductcode;statuscode,pk.statuscode;companycode,pk.companycode;currencycode,pk.currencycode"), + @Parameter(name = "field", value = "ratesequence") }) + @GeneratedValue(generator = "seq_id") + private TgeneSubProductChargesKey pk; + + @Column(name = "CHARGECURRENCYCODE", nullable = true) + /** + * Codigo de moneda en la que esta expresado el cargo + */ + private String chargecurrencycode; + + @Column(name = "RATE", nullable = true) + /** + * Tasa anual a aplicar + */ + private BigDecimal rate; + + @Column(name = "PERCENT", nullable = true) + /** + * Porcentaje flat a aplicar + */ + private BigDecimal percent; + + @Column(name = "MINVALUE", nullable = true) + /** + * Valor minimo a cobrar + */ + private BigDecimal minvalue; + + @Column(name = "MAXVALUE", nullable = true) + /** + * Valor maximo a cobrar + */ + private BigDecimal maxvalue; + + @Column(name = "MINAMOUNT", nullable = false) + /** + * Monto minimo para buscar el cargo + */ + private BigDecimal minamount; + + @Column(name = "MAXAMOUNT", nullable = true) + /** + * Monto maximo para buscar el cargo + */ + private BigDecimal maxamount; + + /** Contructor por defecto */ + public TgeneSubProductCharges() { + } + + /** + * Contructor de TgeneSubProductCharges + * + * @param pPk Clave Primaria del entity + * @param pMinamount Monto minimo para buscar el cargo + */ + public TgeneSubProductCharges(TgeneSubProductChargesKey pPk, BigDecimal pMinamount) { + this(); + this.pk = pPk; + this.minamount = pMinamount; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSubProductCharges + */ + public static TgeneSubProductCharges find(EntityManager pEntityManager, TgeneSubProductChargesKey pKey) throws Exception { + TgeneSubProductCharges obj = pEntityManager.find(TgeneSubProductCharges.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneSubProductCharges + * + * @return El objeto que referencia a la Clave primaria de TgeneSubProductCharges + */ + public TgeneSubProductChargesKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneSubProductCharges + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneSubProductCharges + */ + public void setPk(TgeneSubProductChargesKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de chargecurrencycode + * + * @return valor de chargecurrencycode + */ + public String getChargecurrencycode() { + return this.chargecurrencycode; + } + + /** + * Fija el valor de chargecurrencycode + * + * @param pChargecurrencycode nuevo Valor de chargecurrencycode + */ + public void setChargecurrencycode(String pChargecurrencycode) { + this.chargecurrencycode = pChargecurrencycode; + } + + /** + * Obtiene el valor de rate + * + * @return valor de rate + */ + public BigDecimal getRate() { + return this.rate; + } + + /** + * Fija el valor de rate + * + * @param pRate nuevo Valor de rate + */ + public void setRate(BigDecimal pRate) { + this.rate = pRate; + } + + /** + * Obtiene el valor de percent + * + * @return valor de percent + */ + public BigDecimal getPercent() { + return this.percent; + } + + /** + * Fija el valor de percent + * + * @param pPercent nuevo Valor de percent + */ + public void setPercent(BigDecimal pPercent) { + this.percent = pPercent; + } + + /** + * Obtiene el valor de minvalue + * + * @return valor de minvalue + */ + public BigDecimal getMinvalue() { + return this.minvalue; + } + + /** + * Fija el valor de minvalue + * + * @param pMinvalue nuevo Valor de minvalue + */ + public void setMinvalue(BigDecimal pMinvalue) { + this.minvalue = pMinvalue; + } + + /** + * Obtiene el valor de maxvalue + * + * @return valor de maxvalue + */ + public BigDecimal getMaxvalue() { + return this.maxvalue; + } + + /** + * Fija el valor de maxvalue + * + * @param pMaxvalue nuevo Valor de maxvalue + */ + public void setMaxvalue(BigDecimal pMaxvalue) { + this.maxvalue = pMaxvalue; + } + + /** + * Obtiene el valor de minamount + * + * @return valor de minamount + */ + public BigDecimal getMinamount() { + return this.minamount; + } + + /** + * Fija el valor de minamount + * + * @param pMinamount nuevo Valor de minamount + */ + public void setMinamount(BigDecimal pMinamount) { + this.minamount = pMinamount; + } + + /** + * Obtiene el valor de maxamount + * + * @return valor de maxamount + */ + public BigDecimal getMaxamount() { + return this.maxamount; + } + + /** + * Fija el valor de maxamount + * + * @param pMaxamount nuevo Valor de maxamount + */ + public void setMaxamount(BigDecimal pMaxamount) { + this.maxamount = pMaxamount; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneSubProductCharges)) { + return false; + } + TgeneSubProductCharges that = (TgeneSubProductCharges) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneSubProductCharges + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneSubProductCharges */ + @Override + public Object createInstance() { + TgeneSubProductCharges instance = new TgeneSubProductCharges(); + instance.setPk(new TgeneSubProductChargesKey()); + return instance; + } + + /** + * Clona la entidad TgeneSubProductCharges + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneSubProductCharges p = (TgeneSubProductCharges) this.clone(); + p.setPk((TgeneSubProductChargesKey) this.pk.cloneMe()); + return p; + } + + // Metodos manuales. + + public boolean equalsWithoutSequence(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneSubProductCharges)) { + return false; + } + TgeneSubProductCharges that = (TgeneSubProductCharges) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + + TgeneSubProductChargesKey thispk = this.getPk(); + TgeneSubProductChargesKey thatpk = that.getPk(); + + if (thatpk == null) { + return false; + } + if (!(thatpk instanceof TgeneSubProductChargesKey)) { + return false; + } + if ((thispk.getBalancetype() == null) || (thatpk.getBalancetype() == null)) { + return false; + } + if (!thispk.getBalancetype().equals(thatpk.getBalancetype())) { + return false; + } + if ((thispk.getBalancegroup() == null) || (thatpk.getBalancegroup() == null)) { + return false; + } + if (!thispk.getBalancegroup().equals(thatpk.getBalancegroup())) { + return false; + } + if ((thispk.getModulecode() == null) || (thatpk.getModulecode() == null)) { + return false; + } + if (!thispk.getModulecode().equals(thatpk.getModulecode())) { + return false; + } + if ((thispk.getProductcode() == null) || (thatpk.getProductcode() == null)) { + return false; + } + if (!thispk.getProductcode().equals(thatpk.getProductcode())) { + return false; + } + if ((thispk.getSubproductcode() == null) || (thatpk.getSubproductcode() == null)) { + return false; + } + if (!thispk.getSubproductcode().equals(thatpk.getSubproductcode())) { + return false; + } + if ((thispk.getStatuscode() == null) || (thatpk.getStatuscode() == null)) { + return false; + } + if (!thispk.getStatuscode().equals(thatpk.getStatuscode())) { + return false; + } + if ((thispk.getCompanycode() == null) || (thatpk.getCompanycode() == null)) { + return false; + } + if (!thispk.getCompanycode().equals(thatpk.getCompanycode())) { + return false; + } + if ((thispk.getCurrencycode() == null) || (thatpk.getCurrencycode() == null)) { + return false; + } + if (!thispk.getCurrencycode().equals(thatpk.getCurrencycode())) { + return false; + } + + return true; + } + + /** Sentencia que devuelve un registro de TgeneSubProductCharges. */ + private static final String HQL_CHARGES_SUBPRODUCT = "from TgeneSubProductCharges tsubpchar " + + " where tsubpchar.pk.balancetype = :balancetype " + " and tsubpchar.pk.balancegroup = :balancegroup " + + " and tsubpchar.pk.modulecode = :modulecode " + " and tsubpchar.pk.productcode = :productcode " + + " and tsubpchar.pk.subproductcode = :subproductcode " + " and tsubpchar.pk.statuscode = :statuscode " + + " and tsubpchar.pk.companycode = :companycode " + " and tsubpchar.pk.currencycode = :currencycode " + + " and :amount between tsubpchar.minamount and tsubpchar.maxamount "; + + /** + * Metodo que entrega la definicion de cargos definidos por subproducto. + * + * @param pBalanceType Codigo de tipo de saldo a entregar buscar cargo. + * @param pBanceGroup Codigo de tipo grupo de balance a entregar buscar cargo. + * @param pModuleCode Codigo de modulo asociado al estatus y producto de la cuenta a buscar el cargo. + * @param pProduct Codigo de producto de la cuenta a buscar el cargo. + * @param pSubProduct Codigo de sub producto de la cuenta a buscar el cargo. + * @param pStatusCode Codigo de estatus de la cuenta a buscar el saldo. + * @param pCompany Codigo de compania de la cuenta a buscar le cargo. + * @param pCurrency Codigo de moneda de la cuenta a buscar le cargo. + * @param pAmount Monto base a obtener el cargo. + * @return TgeneSubProductCharges + * @throws Exception + */ + public static final TgeneSubProductCharges find(EntityManager pEntityManager, String pBalanceType, String pBanceGroup, String pModuleCode, + String pProduct, String pSubProduct, String pStatusCode, Integer pCompany, String pCurrency, BigDecimal pAmount) throws Exception { + TgeneSubProductCharges obj = null; + Query qry = pEntityManager.createQuery(TgeneSubProductCharges.HQL_CHARGES_SUBPRODUCT); + qry.setParameter("balancetype", pBalanceType); + qry.setParameter("balancegroup", pBanceGroup); + qry.setParameter("modulecode", pModuleCode); + qry.setParameter("productcode", pProduct); + qry.setParameter("subproductcode", pSubProduct); + qry.setParameter("statuscode", pStatusCode); + qry.setParameter("companycode", pCompany); + qry.setParameter("currencycode", pCurrency); + qry.setParameter("amount", pAmount); + try { + obj = (TgeneSubProductCharges) qry.getSingleResult(); + } catch (NoResultException e) { + return obj; + } + return obj; + } + + /** Sentencia que devuelve un registro de TgeneSubProductCharges. */ + private static final String JQL_CHARGES = "from TgeneSubProductCharges tsubpchar " + " where tsubpchar.pk.modulecode = :modulecode " + + " and tsubpchar.pk.productcode = :productcode " + " and tsubpchar.pk.subproductcode = :subproductcode "; + + /** + * Metodo que entrega la definicion de cargos definidos por subproducto. + * + * @param pBalanceType Codigo de tipo de saldo a entregar buscar cargo. + * @param pBanceGroup Codigo de tipo grupo de balance a entregar buscar cargo. + * @param pModuleCode Codigo de modulo asociado al estatus y producto de la cuenta a buscar el cargo. + * @param pProduct Codigo de producto de la cuenta a buscar el cargo. + * @param pSubProduct Codigo de sub producto de la cuenta a buscar el cargo. + * @param pStatusCode Codigo de estatus de la cuenta a buscar el saldo. + * @param pCompany Codigo de compania de la cuenta a buscar le cargo. + * @param pCurrency Codigo de moneda de la cuenta a buscar le cargo. + * @param pAmount Monto base a obtener el cargo. + * @return TgeneSubProductCharges + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static final List find(EntityManager pEntityManager, String pModuleCode, String pProduct, String pSubProduct) + throws Exception { + Query qry = pEntityManager.createQuery(TgeneSubProductCharges.JQL_CHARGES); + qry.setParameter("modulecode", pModuleCode); + qry.setParameter("productcode", pProduct); + qry.setParameter("subproductcode", pSubProduct); + + return qry.getResultList(); + } + + /** Sentencia que devuelve una lista de TgeneSubProductCharges por compania. */ + private static final String HQL_CHARGES_SUBPRODUCT_BY_COMPANY = "from TgeneSubProductCharges tspc " + + " where tspc.pk.companycode = :companycode "; + + /** + * Metodo que entrega la definicion de cargos definidos por subproducto. + * + * @param pCompany Codigo de compania. + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findByCompany(EntityManager pEntityManager, Integer pCompany) { + List list = null; + Query qry = pEntityManager.createQuery(TgeneSubProductCharges.HQL_CHARGES_SUBPRODUCT_BY_COMPANY); + qry.setParameter("companycode", pCompany); + list = qry.getResultList(); + return list; + } + + /** Sentencia que devuelve una lista de TgeneSubProductCharges por compania. */ + private static final String JQL_CHARGES_SUBPRODUCT_BY_MODULE = "from TgeneSubProductCharges tsubpchar " + + " where tsubpchar.pk.modulecode = :modulecode "; + + /** + * Metodo que entrega la definicion de cargos definidos por subproducto. + * + * @param pCompany Codigo de compania. + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findByModule(EntityManager pEntityManager, String pModuleCode) { + List list = null; + Query qry = pEntityManager.createQuery(TgeneSubProductCharges.JQL_CHARGES_SUBPRODUCT_BY_MODULE); + qry.setParameter("modulecode", pModuleCode); + list = qry.getResultList(); + return list; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneSubProductChargesKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneSubProductChargesKey.java.svn-base new file mode 100644 index 0000000..ab5b913 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/.svn/text-base/TgeneSubProductChargesKey.java.svn-base @@ -0,0 +1,313 @@ +package com.fp.persistence.pgeneral.charge; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESUBPRODUCTCHARGES*/ +@Embeddable +public class TgeneSubProductChargesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda de la cuenta +*/ +private String currencycode; + +@Column(name="RATESEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia para las tasas por subproducto +*/ +private Integer ratesequence; + +/**Contructor por defecto*/ +public TgeneSubProductChargesKey(){} +/**Contructor de TgeneSubProductChargesKey +@param pBalancetype Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pStatuscode Estatus de cuenta +@param pCompanycode Codigo de compania +@param pCurrencycode Codigo de moneda de la cuenta +@param pRatesequence Secuencia para las tasas por subproducto +*/ +public TgeneSubProductChargesKey(String pBalancetype,String pBalancegroup,String pModulecode,String pProductcode,String pSubproductcode,String pStatuscode,Integer pCompanycode,String pCurrencycode,Integer pRatesequence){ + balancetype=pBalancetype; + balancegroup=pBalancegroup; + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + statuscode=pStatuscode; + companycode=pCompanycode; + currencycode=pCurrencycode; + ratesequence=pRatesequence; +} +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de ratesequence +@return valor de ratesequence*/ +public Integer getRatesequence(){ + return ratesequence; +} +/**Fija el valor de ratesequence +@param pRatesequence nuevo Valor de ratesequence*/ +public void setRatesequence(Integer pRatesequence){ + ratesequence=pRatesequence; +} + +/**Implementacion de la comparacion de TgeneSubProductChargesKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSubProductChargesKey))return false; + TgeneSubProductChargesKey that = (TgeneSubProductChargesKey) o; + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getRatesequence() == null || that.getRatesequence() == null){ + return false; + } + if (! this.getRatesequence().equals(that.getRatesequence())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneSubProductChargesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getRatesequence() == null ? 0 : this.getRatesequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneCharges.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneCharges.java new file mode 100644 index 0000000..9f74f99 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneCharges.java @@ -0,0 +1,461 @@ +package com.fp.persistence.pgeneral.charge; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECHARGES */ +@Entity(name = "TgeneCharges") +@Table(name = "TGENECHARGES") +public class TgeneCharges extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneCharges + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(RATESEQUENCE),0)+1 from TGENECHARGES " + "where BALANCETYPE=:btype " + + "and BALANCEGROUP=:bgroup " + "and MODULECODE=:modulecode " + "and STATUSCODE=:statuscode " + "and COMPANYCODE=:companycode " + + "and CURRENCYCODE = :currencycode"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "btype,pk.balancetype;bgroup,pk.balancegroup;modulecode,pk.modulecode;statuscode,pk.statuscode;companycode,pk.companycode;currencycode,pk.currencycode"), + @Parameter(name = "field", value = "ratesequence") }) + @GeneratedValue(generator = "seq_id") + private TgeneChargesKey pk; + + @Column(name = "CHARGECURRENCYCODE", nullable = true) + /** + * Codigo de moneda en la que esta expresado el cargo + */ + private String chargecurrencycode; + + @Column(name = "RATE", nullable = true) + /** + * Tasa anual a aplicar + */ + private BigDecimal rate; + + @Column(name = "PERCENT", nullable = true) + /** + * Porcentaje flat a aplicar + */ + private BigDecimal percent; + + @Column(name = "MINVALUE", nullable = true) + /** + * Valor minimo a cobrar + */ + private BigDecimal minvalue; + + @Column(name = "MAXVALUE", nullable = true) + /** + * Valor maximo a cobrar + */ + private BigDecimal maxvalue; + + @Column(name = "MINAMOUNT", nullable = true) + /** + * Monto minimo para buscar el cargo + */ + private BigDecimal minamount; + + @Column(name = "MAXAMOUNT", nullable = true) + /** + * Monto maximo para buscar el cargo + */ + private BigDecimal maxamount; + + /** Contructor por defecto */ + public TgeneCharges() { + } + + /** + * Contructor de TgeneCharges + * + * @param pPk Clave Primaria del entity + */ + public TgeneCharges(TgeneChargesKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneCharges + */ + public static TgeneCharges find(EntityManager pEntityManager, TgeneChargesKey pKey) throws Exception { + TgeneCharges obj = pEntityManager.find(TgeneCharges.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneCharges + * + * @return El objeto que referencia a la Clave primaria de TgeneCharges + */ + public TgeneChargesKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneCharges + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneCharges + */ + public void setPk(TgeneChargesKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de chargecurrencycode + * + * @return valor de chargecurrencycode + */ + public String getChargecurrencycode() { + return this.chargecurrencycode; + } + + /** + * Fija el valor de chargecurrencycode + * + * @param pChargecurrencycode nuevo Valor de chargecurrencycode + */ + public void setChargecurrencycode(String pChargecurrencycode) { + this.chargecurrencycode = pChargecurrencycode; + } + + /** + * Obtiene el valor de rate + * + * @return valor de rate + */ + public BigDecimal getRate() { + return this.rate; + } + + /** + * Fija el valor de rate + * + * @param pRate nuevo Valor de rate + */ + public void setRate(BigDecimal pRate) { + this.rate = pRate; + } + + /** + * Obtiene el valor de percent + * + * @return valor de percent + */ + public BigDecimal getPercent() { + return this.percent; + } + + /** + * Fija el valor de percent + * + * @param pPercent nuevo Valor de percent + */ + public void setPercent(BigDecimal pPercent) { + this.percent = pPercent; + } + + /** + * Obtiene el valor de minvalue + * + * @return valor de minvalue + */ + public BigDecimal getMinvalue() { + return this.minvalue; + } + + /** + * Fija el valor de minvalue + * + * @param pMinvalue nuevo Valor de minvalue + */ + public void setMinvalue(BigDecimal pMinvalue) { + this.minvalue = pMinvalue; + } + + /** + * Obtiene el valor de maxvalue + * + * @return valor de maxvalue + */ + public BigDecimal getMaxvalue() { + return this.maxvalue; + } + + /** + * Fija el valor de maxvalue + * + * @param pMaxvalue nuevo Valor de maxvalue + */ + public void setMaxvalue(BigDecimal pMaxvalue) { + this.maxvalue = pMaxvalue; + } + + /** + * Obtiene el valor de minamount + * + * @return valor de minamount + */ + public BigDecimal getMinamount() { + return this.minamount; + } + + /** + * Fija el valor de minamount + * + * @param pMinamount nuevo Valor de minamount + */ + public void setMinamount(BigDecimal pMinamount) { + this.minamount = pMinamount; + } + + /** + * Obtiene el valor de maxamount + * + * @return valor de maxamount + */ + public BigDecimal getMaxamount() { + return this.maxamount; + } + + /** + * Fija el valor de maxamount + * + * @param pMaxamount nuevo Valor de maxamount + */ + public void setMaxamount(BigDecimal pMaxamount) { + this.maxamount = pMaxamount; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneCharges)) { + return false; + } + TgeneCharges that = (TgeneCharges) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneCharges + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneCharges */ + @Override + public Object createInstance() { + TgeneCharges instance = new TgeneCharges(); + instance.setPk(new TgeneChargesKey()); + return instance; + } + + /** + * Clona la entidad TgeneCharges + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneCharges p = (TgeneCharges) this.clone(); + p.setPk((TgeneChargesKey) this.pk.cloneMe()); + return p; + } + + // Metodos manuales + + public boolean equalsWithoutSequence(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneCharges)) { + return false; + } + TgeneCharges that = (TgeneCharges) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + + TgeneChargesKey thispk = this.getPk(); + TgeneChargesKey thatpk = that.getPk(); + + if (thatpk == null) { + return false; + } + if (!(thatpk instanceof TgeneChargesKey)) { + return false; + } + if ((thispk.getBalancetype() == null) || (thatpk.getBalancetype() == null)) { + return false; + } + if (!thispk.getBalancetype().equals(thatpk.getBalancetype())) { + return false; + } + if ((thispk.getBalancegroup() == null) || (thatpk.getBalancegroup() == null)) { + return false; + } + if (!thispk.getBalancegroup().equals(thatpk.getBalancegroup())) { + return false; + } + if ((thispk.getModulecode() == null) || (thatpk.getModulecode() == null)) { + return false; + } + if (!thispk.getModulecode().equals(thatpk.getModulecode())) { + return false; + } + if ((thispk.getStatuscode() == null) || (thatpk.getStatuscode() == null)) { + return false; + } + if (!thispk.getStatuscode().equals(thatpk.getStatuscode())) { + return false; + } + if ((thispk.getCompanycode() == null) || (thatpk.getCompanycode() == null)) { + return false; + } + if (!thispk.getCompanycode().equals(thatpk.getCompanycode())) { + return false; + } + if ((thispk.getCurrencycode() == null) || (thatpk.getCurrencycode() == null)) { + return false; + } + if (!thispk.getCurrencycode().equals(thatpk.getCurrencycode())) { + return false; + } + return true; + } + + /** Sentencia que devuelve un registro de TgeneCharges. */ + private static final String HQL_CHARGES = "from TgeneCharges tcharges " + " where tcharges.pk.balancetype = :balancetype " + + " and tcharges.pk.balancegroup = :balancegroup " + " and tcharges.pk.modulecode = :modulecode " + + " and tcharges.pk.statuscode = :statuscode " + " and tcharges.pk.companycode = :companycode " + + " and tcharges.pk.currencycode = :currencycode " + " and :amount between tcharges.minamount and tcharges.maxamount "; + + /** + * Metodo que entrega la definicion de cargos generales. + * + * @param pBalanceType Codigo de tipo de saldo a entregar buscar cargo. + * @param pBanceGroup Codigo de tipo grupo de balance a entregar buscar cargo. + * @param pModuleCode Codigo de modulo asociado al estatus de la cuenta a buscar el cargo. + * @param pStatusCode Codigo de estatus de la cuenta a buscar el saldo. + * @param pComapny Codigo de compania de la cuenta a buscar le cargo. + * @param pCurrency Codigo de moneda de la cuenta a buscar le cargo. + * @param pAmount Monto base con el cual se obtiene el cargo. + * @return TgeneCharges + * @throws Exception + */ + public static TgeneCharges find(EntityManager pEntitymanager, String pBalanceType, String pBanceGroup, String pModuleCode, String pStatusCode, + Integer pComapny, String pCurrency, BigDecimal pAmount) throws Exception { + TgeneCharges obj = null; + Query qry = pEntitymanager.createQuery(TgeneCharges.HQL_CHARGES); + qry.setParameter("balancetype", pBalanceType); + qry.setParameter("balancegroup", pBanceGroup); + qry.setParameter("modulecode", pModuleCode); + qry.setParameter("statuscode", pStatusCode); + qry.setParameter("companycode", pComapny); + qry.setParameter("currencycode", pCurrency); + qry.setParameter("amount", pAmount); + try { + obj = (TgeneCharges) qry.getSingleResult(); + } catch (NoResultException e) { + return obj; + } + return obj; + } + + /** Sentencia que devuelve una lista de TgeneSubProductCharges por compania. */ + private static final String JQL_CHARGES_BY_MODULE = "from TgeneCharges tchar " + " where tchar.pk.modulecode = :modulecode "; + + /** + * Metodo que entrega la definicion de cargos definidos por subproducto. + * + * @param pCompany Codigo de compania. + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findByModule(EntityManager pEntityManager, String pModuleCode) { + List list = null; + Query qry = pEntityManager.createQuery(TgeneCharges.JQL_CHARGES_BY_MODULE); + qry.setParameter("modulecode", pModuleCode); + list = qry.getResultList(); + return list; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneChargesCheckbook.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneChargesCheckbook.java new file mode 100644 index 0000000..921c40f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneChargesCheckbook.java @@ -0,0 +1,158 @@ +package com.fp.persistence.pgeneral.charge; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECHARGESCHECKBOOK*/ +@Entity(name="TgeneChargesCheckbook") +@Table(name="TGENECHARGESCHECKBOOK") +public class TgeneChargesCheckbook extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneChargesCheckbook +*/ +@EmbeddedId +private TgeneChargesCheckbookKey pk; +@Column(name="CHARGECURRENCYCODE", nullable=true) + +/** +* Codigo de moneda en la que esta expresado el cargo +*/ +private String chargecurrencycode; + +@Column(name="VALUE", nullable=true) + +/** +* Costo de la chequera +*/ +private BigDecimal value; + +/**Contructor por defecto*/ +public TgeneChargesCheckbook(){ +} +/**Contructor de TgeneChargesCheckbook +@param pPk Clave Primaria del entity +*/ +public TgeneChargesCheckbook(TgeneChargesCheckbookKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneChargesCheckbook +*/ +public static TgeneChargesCheckbook find(EntityManager pEntityManager,TgeneChargesCheckbookKey pKey) throws Exception{ + TgeneChargesCheckbook obj = pEntityManager.find(TgeneChargesCheckbook.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneChargesCheckbook +@return El objeto que referencia a la Clave primaria de TgeneChargesCheckbook +*/ +public TgeneChargesCheckbookKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneChargesCheckbook +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneChargesCheckbook +*/ +public void setPk(TgeneChargesCheckbookKey pPk){ + pk=pPk; +} +/**Obtiene el valor de chargecurrencycode +@return valor de chargecurrencycode*/ +public String getChargecurrencycode(){ + return chargecurrencycode; +} +/**Fija el valor de chargecurrencycode +@param pChargecurrencycode nuevo Valor de chargecurrencycode*/ +public void setChargecurrencycode(String pChargecurrencycode){ + chargecurrencycode=pChargecurrencycode; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneChargesCheckbook))return false; + TgeneChargesCheckbook that = (TgeneChargesCheckbook) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneChargesCheckbook +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneChargesCheckbook +*/ +public Object createInstance(){ + TgeneChargesCheckbook instance=new TgeneChargesCheckbook(); + instance.setPk(new TgeneChargesCheckbookKey()); + return instance; +} +/**Clona la entidad TgeneChargesCheckbook +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneChargesCheckbook p=(TgeneChargesCheckbook)this.clone(); + p.setPk((TgeneChargesCheckbookKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneChargesCheckbookKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneChargesCheckbookKey.java new file mode 100644 index 0000000..0b069b8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneChargesCheckbookKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.charge; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENECHARGESCHECKBOOK*/ +@Embeddable +public class TgeneChargesCheckbookKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CHECKBOOKTYPECATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo ejemlo con talon de 50 cheques. +*/ +private String checkbooktypecatalog; + +@Column(name="CHECKBOOKTYPECATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo de tipo de chequeras CHECKBOOKTYPE +*/ +private String checkbooktypecatalogcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda de la cuenta, asociada a la chequera. +*/ +private String currencycode; + +/**Contructor por defecto*/ +public TgeneChargesCheckbookKey(){} +/**Contructor de TgeneChargesCheckbookKey +@param pCheckbooktypecatalog Codigo de catalogo ejemlo con talon de 50 cheques. +@param pCheckbooktypecatalogcode Codigo de tabla de catalogo de tipo de chequeras CHECKBOOKTYPE +@param pCompanycode Codigo de compania +@param pCurrencycode Codigo de moneda de la cuenta, asociada a la chequera. +*/ +public TgeneChargesCheckbookKey(String pCheckbooktypecatalog,String pCheckbooktypecatalogcode,Integer pCompanycode,String pCurrencycode){ + checkbooktypecatalog=pCheckbooktypecatalog; + checkbooktypecatalogcode=pCheckbooktypecatalogcode; + companycode=pCompanycode; + currencycode=pCurrencycode; +} +/**Obtiene el valor de checkbooktypecatalog +@return valor de checkbooktypecatalog*/ +public String getCheckbooktypecatalog(){ + return checkbooktypecatalog; +} +/**Fija el valor de checkbooktypecatalog +@param pCheckbooktypecatalog nuevo Valor de checkbooktypecatalog*/ +public void setCheckbooktypecatalog(String pCheckbooktypecatalog){ + checkbooktypecatalog=pCheckbooktypecatalog; +} + +/**Obtiene el valor de checkbooktypecatalogcode +@return valor de checkbooktypecatalogcode*/ +public String getCheckbooktypecatalogcode(){ + return checkbooktypecatalogcode; +} +/**Fija el valor de checkbooktypecatalogcode +@param pCheckbooktypecatalogcode nuevo Valor de checkbooktypecatalogcode*/ +public void setCheckbooktypecatalogcode(String pCheckbooktypecatalogcode){ + checkbooktypecatalogcode=pCheckbooktypecatalogcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Implementacin de la comparacin de TgeneChargesCheckbookKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneChargesCheckbookKey))return false; + TgeneChargesCheckbookKey that = (TgeneChargesCheckbookKey) o; + if (this.getCheckbooktypecatalog() == null || that.getCheckbooktypecatalog() == null){ + return false; + } + if (! this.getCheckbooktypecatalog().equals(that.getCheckbooktypecatalog())){ + return false; + } + if (this.getCheckbooktypecatalogcode() == null || that.getCheckbooktypecatalogcode() == null){ + return false; + } + if (! this.getCheckbooktypecatalogcode().equals(that.getCheckbooktypecatalogcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneChargesCheckbookKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCheckbooktypecatalog() == null ? 0 : this.getCheckbooktypecatalog().hashCode()); + result = result * 37 + (this.getCheckbooktypecatalogcode() == null ? 0 : this.getCheckbooktypecatalogcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneChargesGroup.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneChargesGroup.java new file mode 100644 index 0000000..7b5e195 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneChargesGroup.java @@ -0,0 +1,331 @@ +package com.fp.persistence.pgeneral.charge; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECHARGESGROUP */ +@Entity(name = "TgeneChargesGroup") +@Table(name = "TGENECHARGESGROUP") +public class TgeneChargesGroup extends com.fp.dto.AbstractDataTransport + implements + Serializable, + HibernateBean, + Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneChargesGroup + */ + @EmbeddedId + private TgeneChargesGroupKey pk; + @Column(name = "CHARGECURRENCYCODE", nullable = true) + /** + * Codigo de moneda en la que esta expresado el cargo + */ + private String chargecurrencycode; + + @Column(name = "RATE", nullable = true) + /** + * Tasa anual a aplicar + */ + private BigDecimal rate; + + @Column(name = "PERCENT", nullable = true) + /** + * Porcentaje flat a aplicar + */ + private BigDecimal percent; + + @Column(name = "MINVALUE", nullable = true) + /** + * Valor minimo a cobrar + */ + private BigDecimal minvalue; + + @Column(name = "MAXVALUE", nullable = true) + /** + * Valor maximo a cobrar + */ + private BigDecimal maxvalue; + + @Column(name = "MAXAMOUNT", nullable = true) + /** + * Monto maximo para buscar el cargo + */ + private BigDecimal maxamount; + + /** Contructor por defecto */ + public TgeneChargesGroup() { + } + /** + * Contructor de TgeneChargesGroup + * + * @param pPk Clave Primaria del entity + */ + public TgeneChargesGroup(TgeneChargesGroupKey pPk) { + this(); + pk = pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneChargesGroup + */ + public static TgeneChargesGroup find(EntityManager pEntityManager, TgeneChargesGroupKey pKey) throws Exception { + TgeneChargesGroup obj = pEntityManager.find(TgeneChargesGroup.class, pKey); + return obj; + } + /** + * Entrega la Clave primaria de TgeneChargesGroup + * + * @return El objeto que referencia a la Clave primaria de TgeneChargesGroup + */ + public TgeneChargesGroupKey getPk() { + return pk; + } + /** + * Fija un nuevo valor a la Clave primaria de TgeneChargesGroup + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneChargesGroup + */ + public void setPk(TgeneChargesGroupKey pPk) { + pk = pPk; + } + /** + * Obtiene el valor de chargecurrencycode + * + * @return valor de chargecurrencycode + */ + public String getChargecurrencycode() { + return chargecurrencycode; + } + /** + * Fija el valor de chargecurrencycode + * + * @param pChargecurrencycode nuevo Valor de chargecurrencycode + */ + public void setChargecurrencycode(String pChargecurrencycode) { + chargecurrencycode = pChargecurrencycode; + } + + /** + * Obtiene el valor de rate + * + * @return valor de rate + */ + public BigDecimal getRate() { + return rate; + } + /** + * Fija el valor de rate + * + * @param pRate nuevo Valor de rate + */ + public void setRate(BigDecimal pRate) { + rate = pRate; + } + + /** + * Obtiene el valor de percent + * + * @return valor de percent + */ + public BigDecimal getPercent() { + return percent; + } + /** + * Fija el valor de percent + * + * @param pPercent nuevo Valor de percent + */ + public void setPercent(BigDecimal pPercent) { + percent = pPercent; + } + + /** + * Obtiene el valor de minvalue + * + * @return valor de minvalue + */ + public BigDecimal getMinvalue() { + return minvalue; + } + /** + * Fija el valor de minvalue + * + * @param pMinvalue nuevo Valor de minvalue + */ + public void setMinvalue(BigDecimal pMinvalue) { + minvalue = pMinvalue; + } + + /** + * Obtiene el valor de maxvalue + * + * @return valor de maxvalue + */ + public BigDecimal getMaxvalue() { + return maxvalue; + } + /** + * Fija el valor de maxvalue + * + * @param pMaxvalue nuevo Valor de maxvalue + */ + public void setMaxvalue(BigDecimal pMaxvalue) { + maxvalue = pMaxvalue; + } + + /** + * Obtiene el valor de maxamount + * + * @return valor de maxamount + */ + public BigDecimal getMaxamount() { + return maxamount; + } + /** + * Fija el valor de maxamount + * + * @param pMaxamount nuevo Valor de maxamount + */ + public void setMaxamount(BigDecimal pMaxamount) { + maxamount = pMaxamount; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneChargesGroup)) + return false; + TgeneChargesGroup that = (TgeneChargesGroup) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /** + * Implementacin del metodo hashCode de la la entidad TgeneChargesGroup + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + /** Implementacin de la creacin de un bean en blanco TgeneChargesGroup */ + public Object createInstance() { + TgeneChargesGroup instance = new TgeneChargesGroup(); + instance.setPk(new TgeneChargesGroupKey()); + return instance; + } + /** + * Clona la entidad TgeneChargesGroup + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneChargesGroup p = (TgeneChargesGroup) this.clone(); + p.setPk((TgeneChargesGroupKey) this.pk.cloneMe()); + return p; + } + + //Metodos manuales. + /** Sentencia que devuelve un registro de TgeneChargesGroup.*/ + private static final String HQL_CHARGES_GROUP = + "from TgeneChargesGroup tchargrp " + + " where tchargrp.pk.catalog = :catalog " + + " and tchargrp.pk.catalogcode = :catalogcode "+ + " and tchargrp.pk.balancetype = :balancetype "+ + " and tchargrp.pk.balancegroup = :balancegroup "+ + " and tchargrp.pk.modulecode = :modulecode "+ + " and tchargrp.pk.statuscode = :statuscode "+ + " and tchargrp.pk.companycode = :companycode "+ + " and tchargrp.pk.currencycode = :currencycode "+ + " and :amount between tchargrp.pk.minamount and tchargrp.maxamount "; + + + /** + * Metodo que entrega la definicion de cargos de grupos de clientes. + * @param pCatalog Codigo de aagrupacion de cargos, Empleados, Clientes vip + * @param pCatalogCode Codigo de catalogo de agrupacion de cargos (CHARGES) + * @param pBalanceType Codigo de tipo de saldo a entregar buscar cargo. + * @param pBanceGroup Codigo de tipo grupo de balance a entregar buscar cargo. + * @param pModuleCode Codigo de modulo asociado al estatus de la cuenta a buscar el cargo. + * @param pStatusCode Codigo de estatus de la cuenta a buscar el saldo. + * @param pCompany Codigo de compania de la cuenta a buscar le cargo. + * @param pCurrency Codigo de moneda de la cuenta a buscar le cargo. + * @param pAmount Monto base con el cual se obtiene el cargo. + * @return TgeneChargesGroup + * @throws Exception + */ + public static TgeneChargesGroup find(EntityManager pEntityManager,String pCatalog,String pCatalogCode,String pBalanceType, + String pBanceGroup,String pModuleCode,String pStatusCode,Integer pCompany,String pCurrency,BigDecimal pAmount) throws Exception { + TgeneChargesGroup obj = null; + Query qry = pEntityManager.createQuery(HQL_CHARGES_GROUP); + qry.setParameter("catalog", pCatalog); + qry.setParameter("catalogcode", pCatalog); + qry.setParameter("balancetype", pCatalog); + qry.setParameter("balancegroup", pCatalog); + qry.setParameter("modulecode", pCatalog); + qry.setParameter("statuscode", pCatalog); + qry.setParameter("companycode", pCatalog); + qry.setParameter("currencycode", pCatalog); + qry.setParameter("amount", pCatalog); + try { + obj = (TgeneChargesGroup)qry.getSingleResult(); + } catch (NoResultException e) { + return obj; + } + return obj; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneChargesGroupKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneChargesGroupKey.java new file mode 100644 index 0000000..b38d691 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneChargesGroupKey.java @@ -0,0 +1,314 @@ +package com.fp.persistence.pgeneral.charge; + +import javax.persistence.Column; +import java.io.Serializable; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENECHARGESGROUP*/ +@Embeddable +public class TgeneChargesGroupKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CHARGECATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo EMPLOYEE, VIP etc +*/ +private String chargecatalog; + +@Column(name="CHARGECATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo (CHARGES) +*/ +private String chargecatalogcode; + +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda de la cuenta +*/ +private String currencycode; + +@Column(name="MINAMOUNT", nullable=false,updatable=false) + +/** +* Monto minimo para buscar el cargo +*/ +private BigDecimal minamount; + +/**Contructor por defecto*/ +public TgeneChargesGroupKey(){} +/**Contructor de TgeneChargesGroupKey +@param pChargecatalog Codigo de catalogo EMPLOYEE, VIP etc +@param pChargecatalogcode Codigo de tabla de catalogo (CHARGES) +@param pBalancetype Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +@param pModulecode Codigo de modulo +@param pStatuscode Estatus de cuenta +@param pCompanycode Codigo de compania +@param pCurrencycode Codigo de moneda de la cuenta +@param pMinamount Monto minimo para buscar el cargo +*/ +public TgeneChargesGroupKey(String pChargecatalog,String pChargecatalogcode,String pBalancetype,String pBalancegroup,String pModulecode,String pStatuscode,Integer pCompanycode,String pCurrencycode,BigDecimal pMinamount){ + chargecatalog=pChargecatalog; + chargecatalogcode=pChargecatalogcode; + balancetype=pBalancetype; + balancegroup=pBalancegroup; + modulecode=pModulecode; + statuscode=pStatuscode; + companycode=pCompanycode; + currencycode=pCurrencycode; + minamount=pMinamount; +} +/**Obtiene el valor de chargecatalog +@return valor de chargecatalog*/ +public String getChargecatalog(){ + return chargecatalog; +} +/**Fija el valor de chargecatalog +@param pChargecatalog nuevo Valor de chargecatalog*/ +public void setChargecatalog(String pChargecatalog){ + chargecatalog=pChargecatalog; +} + +/**Obtiene el valor de chargecatalogcode +@return valor de chargecatalogcode*/ +public String getChargecatalogcode(){ + return chargecatalogcode; +} +/**Fija el valor de chargecatalogcode +@param pChargecatalogcode nuevo Valor de chargecatalogcode*/ +public void setChargecatalogcode(String pChargecatalogcode){ + chargecatalogcode=pChargecatalogcode; +} + +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de minamount +@return valor de minamount*/ +public BigDecimal getMinamount(){ + return minamount; +} +/**Fija el valor de minamount +@param pMinamount nuevo Valor de minamount*/ +public void setMinamount(BigDecimal pMinamount){ + minamount=pMinamount; +} + +/**Implementacin de la comparacin de TgeneChargesGroupKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneChargesGroupKey))return false; + TgeneChargesGroupKey that = (TgeneChargesGroupKey) o; + if (this.getChargecatalog() == null || that.getChargecatalog() == null){ + return false; + } + if (! this.getChargecatalog().equals(that.getChargecatalog())){ + return false; + } + if (this.getChargecatalogcode() == null || that.getChargecatalogcode() == null){ + return false; + } + if (! this.getChargecatalogcode().equals(that.getChargecatalogcode())){ + return false; + } + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getMinamount() == null || that.getMinamount() == null){ + return false; + } + if (! this.getMinamount().equals(that.getMinamount())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneChargesGroupKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getChargecatalog() == null ? 0 : this.getChargecatalog().hashCode()); + result = result * 37 + (this.getChargecatalogcode() == null ? 0 : this.getChargecatalogcode().hashCode()); + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getMinamount() == null ? 0 : this.getMinamount().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneChargesKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneChargesKey.java new file mode 100644 index 0000000..01b61e6 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneChargesKey.java @@ -0,0 +1,259 @@ +package com.fp.persistence.pgeneral.charge; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENECHARGES*/ +@Embeddable +public class TgeneChargesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda de la cuenta +*/ +private String currencycode; + +@Column(name="RATESEQUENCE", nullable=false,updatable=false) + +/** +* Secuencial para tasas +*/ +private Integer ratesequence; + +/**Contructor por defecto*/ +public TgeneChargesKey(){} +/**Contructor de TgeneChargesKey +@param pBalancetype Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +@param pModulecode Codigo de modulo +@param pStatuscode Estatus de cuenta +@param pCompanycode Codigo de compania +@param pCurrencycode Codigo de moneda de la cuenta +@param pRatesequence Secuencial para tasas +*/ +public TgeneChargesKey(String pBalancetype,String pBalancegroup,String pModulecode,String pStatuscode,Integer pCompanycode,String pCurrencycode,Integer pRatesequence){ + balancetype=pBalancetype; + balancegroup=pBalancegroup; + modulecode=pModulecode; + statuscode=pStatuscode; + companycode=pCompanycode; + currencycode=pCurrencycode; + ratesequence=pRatesequence; +} +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de ratesequence +@return valor de ratesequence*/ +public Integer getRatesequence(){ + return ratesequence; +} +/**Fija el valor de ratesequence +@param pRatesequence nuevo Valor de ratesequence*/ +public void setRatesequence(Integer pRatesequence){ + ratesequence=pRatesequence; +} + +/**Implementacion de la comparacion de TgeneChargesKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneChargesKey))return false; + TgeneChargesKey that = (TgeneChargesKey) o; + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getRatesequence() == null || that.getRatesequence() == null){ + return false; + } + if (! this.getRatesequence().equals(that.getRatesequence())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneChargesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getRatesequence() == null ? 0 : this.getRatesequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneSubProductCharges.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneSubProductCharges.java new file mode 100644 index 0000000..b12a6e7 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneSubProductCharges.java @@ -0,0 +1,534 @@ +package com.fp.persistence.pgeneral.charge; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESUBPRODUCTCHARGES */ +@Entity(name = "TgeneSubProductCharges") +@Table(name = "TGENESUBPRODUCTCHARGES") +public class TgeneSubProductCharges extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneSubProductCharges + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(RATESEQUENCE),0)+1 from TGENESUBPRODUCTCHARGES " + "where BALANCETYPE=:btype " + + "and BALANCEGROUP=:bgroup " + "and MODULECODE=:modulecode " + "and PRODUCTCODE=:productcode " + + "and SUBPRODUCTCODE=:subproductcode " + "and STATUSCODE=:statuscode " + "and COMPANYCODE=:companycode " + + "and CURRENCYCODE = :currencycode"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "btype,pk.balancetype;bgroup,pk.balancegroup;modulecode,pk.modulecode;productcode,pk.productcode;subproductcode,pk.subproductcode;statuscode,pk.statuscode;companycode,pk.companycode;currencycode,pk.currencycode"), + @Parameter(name = "field", value = "ratesequence") }) + @GeneratedValue(generator = "seq_id") + private TgeneSubProductChargesKey pk; + + @Column(name = "CHARGECURRENCYCODE", nullable = true) + /** + * Codigo de moneda en la que esta expresado el cargo + */ + private String chargecurrencycode; + + @Column(name = "RATE", nullable = true) + /** + * Tasa anual a aplicar + */ + private BigDecimal rate; + + @Column(name = "PERCENT", nullable = true) + /** + * Porcentaje flat a aplicar + */ + private BigDecimal percent; + + @Column(name = "MINVALUE", nullable = true) + /** + * Valor minimo a cobrar + */ + private BigDecimal minvalue; + + @Column(name = "MAXVALUE", nullable = true) + /** + * Valor maximo a cobrar + */ + private BigDecimal maxvalue; + + @Column(name = "MINAMOUNT", nullable = false) + /** + * Monto minimo para buscar el cargo + */ + private BigDecimal minamount; + + @Column(name = "MAXAMOUNT", nullable = true) + /** + * Monto maximo para buscar el cargo + */ + private BigDecimal maxamount; + + /** Contructor por defecto */ + public TgeneSubProductCharges() { + } + + /** + * Contructor de TgeneSubProductCharges + * + * @param pPk Clave Primaria del entity + * @param pMinamount Monto minimo para buscar el cargo + */ + public TgeneSubProductCharges(TgeneSubProductChargesKey pPk, BigDecimal pMinamount) { + this(); + this.pk = pPk; + this.minamount = pMinamount; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSubProductCharges + */ + public static TgeneSubProductCharges find(EntityManager pEntityManager, TgeneSubProductChargesKey pKey) throws Exception { + TgeneSubProductCharges obj = pEntityManager.find(TgeneSubProductCharges.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneSubProductCharges + * + * @return El objeto que referencia a la Clave primaria de TgeneSubProductCharges + */ + public TgeneSubProductChargesKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneSubProductCharges + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneSubProductCharges + */ + public void setPk(TgeneSubProductChargesKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de chargecurrencycode + * + * @return valor de chargecurrencycode + */ + public String getChargecurrencycode() { + return this.chargecurrencycode; + } + + /** + * Fija el valor de chargecurrencycode + * + * @param pChargecurrencycode nuevo Valor de chargecurrencycode + */ + public void setChargecurrencycode(String pChargecurrencycode) { + this.chargecurrencycode = pChargecurrencycode; + } + + /** + * Obtiene el valor de rate + * + * @return valor de rate + */ + public BigDecimal getRate() { + return this.rate; + } + + /** + * Fija el valor de rate + * + * @param pRate nuevo Valor de rate + */ + public void setRate(BigDecimal pRate) { + this.rate = pRate; + } + + /** + * Obtiene el valor de percent + * + * @return valor de percent + */ + public BigDecimal getPercent() { + return this.percent; + } + + /** + * Fija el valor de percent + * + * @param pPercent nuevo Valor de percent + */ + public void setPercent(BigDecimal pPercent) { + this.percent = pPercent; + } + + /** + * Obtiene el valor de minvalue + * + * @return valor de minvalue + */ + public BigDecimal getMinvalue() { + return this.minvalue; + } + + /** + * Fija el valor de minvalue + * + * @param pMinvalue nuevo Valor de minvalue + */ + public void setMinvalue(BigDecimal pMinvalue) { + this.minvalue = pMinvalue; + } + + /** + * Obtiene el valor de maxvalue + * + * @return valor de maxvalue + */ + public BigDecimal getMaxvalue() { + return this.maxvalue; + } + + /** + * Fija el valor de maxvalue + * + * @param pMaxvalue nuevo Valor de maxvalue + */ + public void setMaxvalue(BigDecimal pMaxvalue) { + this.maxvalue = pMaxvalue; + } + + /** + * Obtiene el valor de minamount + * + * @return valor de minamount + */ + public BigDecimal getMinamount() { + return this.minamount; + } + + /** + * Fija el valor de minamount + * + * @param pMinamount nuevo Valor de minamount + */ + public void setMinamount(BigDecimal pMinamount) { + this.minamount = pMinamount; + } + + /** + * Obtiene el valor de maxamount + * + * @return valor de maxamount + */ + public BigDecimal getMaxamount() { + return this.maxamount; + } + + /** + * Fija el valor de maxamount + * + * @param pMaxamount nuevo Valor de maxamount + */ + public void setMaxamount(BigDecimal pMaxamount) { + this.maxamount = pMaxamount; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneSubProductCharges)) { + return false; + } + TgeneSubProductCharges that = (TgeneSubProductCharges) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneSubProductCharges + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneSubProductCharges */ + @Override + public Object createInstance() { + TgeneSubProductCharges instance = new TgeneSubProductCharges(); + instance.setPk(new TgeneSubProductChargesKey()); + return instance; + } + + /** + * Clona la entidad TgeneSubProductCharges + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneSubProductCharges p = (TgeneSubProductCharges) this.clone(); + p.setPk((TgeneSubProductChargesKey) this.pk.cloneMe()); + return p; + } + + // Metodos manuales. + + public boolean equalsWithoutSequence(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneSubProductCharges)) { + return false; + } + TgeneSubProductCharges that = (TgeneSubProductCharges) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + + TgeneSubProductChargesKey thispk = this.getPk(); + TgeneSubProductChargesKey thatpk = that.getPk(); + + if (thatpk == null) { + return false; + } + if (!(thatpk instanceof TgeneSubProductChargesKey)) { + return false; + } + if ((thispk.getBalancetype() == null) || (thatpk.getBalancetype() == null)) { + return false; + } + if (!thispk.getBalancetype().equals(thatpk.getBalancetype())) { + return false; + } + if ((thispk.getBalancegroup() == null) || (thatpk.getBalancegroup() == null)) { + return false; + } + if (!thispk.getBalancegroup().equals(thatpk.getBalancegroup())) { + return false; + } + if ((thispk.getModulecode() == null) || (thatpk.getModulecode() == null)) { + return false; + } + if (!thispk.getModulecode().equals(thatpk.getModulecode())) { + return false; + } + if ((thispk.getProductcode() == null) || (thatpk.getProductcode() == null)) { + return false; + } + if (!thispk.getProductcode().equals(thatpk.getProductcode())) { + return false; + } + if ((thispk.getSubproductcode() == null) || (thatpk.getSubproductcode() == null)) { + return false; + } + if (!thispk.getSubproductcode().equals(thatpk.getSubproductcode())) { + return false; + } + if ((thispk.getStatuscode() == null) || (thatpk.getStatuscode() == null)) { + return false; + } + if (!thispk.getStatuscode().equals(thatpk.getStatuscode())) { + return false; + } + if ((thispk.getCompanycode() == null) || (thatpk.getCompanycode() == null)) { + return false; + } + if (!thispk.getCompanycode().equals(thatpk.getCompanycode())) { + return false; + } + if ((thispk.getCurrencycode() == null) || (thatpk.getCurrencycode() == null)) { + return false; + } + if (!thispk.getCurrencycode().equals(thatpk.getCurrencycode())) { + return false; + } + + return true; + } + + /** Sentencia que devuelve un registro de TgeneSubProductCharges. */ + private static final String HQL_CHARGES_SUBPRODUCT = "from TgeneSubProductCharges tsubpchar " + + " where tsubpchar.pk.balancetype = :balancetype " + " and tsubpchar.pk.balancegroup = :balancegroup " + + " and tsubpchar.pk.modulecode = :modulecode " + " and tsubpchar.pk.productcode = :productcode " + + " and tsubpchar.pk.subproductcode = :subproductcode " + " and tsubpchar.pk.statuscode = :statuscode " + + " and tsubpchar.pk.companycode = :companycode " + " and tsubpchar.pk.currencycode = :currencycode " + + " and :amount between tsubpchar.minamount and tsubpchar.maxamount "; + + /** + * Metodo que entrega la definicion de cargos definidos por subproducto. + * + * @param pBalanceType Codigo de tipo de saldo a entregar buscar cargo. + * @param pBanceGroup Codigo de tipo grupo de balance a entregar buscar cargo. + * @param pModuleCode Codigo de modulo asociado al estatus y producto de la cuenta a buscar el cargo. + * @param pProduct Codigo de producto de la cuenta a buscar el cargo. + * @param pSubProduct Codigo de sub producto de la cuenta a buscar el cargo. + * @param pStatusCode Codigo de estatus de la cuenta a buscar el saldo. + * @param pCompany Codigo de compania de la cuenta a buscar le cargo. + * @param pCurrency Codigo de moneda de la cuenta a buscar le cargo. + * @param pAmount Monto base a obtener el cargo. + * @return TgeneSubProductCharges + * @throws Exception + */ + public static final TgeneSubProductCharges find(EntityManager pEntityManager, String pBalanceType, String pBanceGroup, String pModuleCode, + String pProduct, String pSubProduct, String pStatusCode, Integer pCompany, String pCurrency, BigDecimal pAmount) throws Exception { + TgeneSubProductCharges obj = null; + Query qry = pEntityManager.createQuery(TgeneSubProductCharges.HQL_CHARGES_SUBPRODUCT); + qry.setParameter("balancetype", pBalanceType); + qry.setParameter("balancegroup", pBanceGroup); + qry.setParameter("modulecode", pModuleCode); + qry.setParameter("productcode", pProduct); + qry.setParameter("subproductcode", pSubProduct); + qry.setParameter("statuscode", pStatusCode); + qry.setParameter("companycode", pCompany); + qry.setParameter("currencycode", pCurrency); + qry.setParameter("amount", pAmount); + try { + obj = (TgeneSubProductCharges) qry.getSingleResult(); + } catch (NoResultException e) { + return obj; + } + return obj; + } + + /** Sentencia que devuelve un registro de TgeneSubProductCharges. */ + private static final String JQL_CHARGES = "from TgeneSubProductCharges tsubpchar " + " where tsubpchar.pk.modulecode = :modulecode " + + " and tsubpchar.pk.productcode = :productcode " + " and tsubpchar.pk.subproductcode = :subproductcode "; + + /** + * Metodo que entrega la definicion de cargos definidos por subproducto. + * + * @param pBalanceType Codigo de tipo de saldo a entregar buscar cargo. + * @param pBanceGroup Codigo de tipo grupo de balance a entregar buscar cargo. + * @param pModuleCode Codigo de modulo asociado al estatus y producto de la cuenta a buscar el cargo. + * @param pProduct Codigo de producto de la cuenta a buscar el cargo. + * @param pSubProduct Codigo de sub producto de la cuenta a buscar el cargo. + * @param pStatusCode Codigo de estatus de la cuenta a buscar el saldo. + * @param pCompany Codigo de compania de la cuenta a buscar le cargo. + * @param pCurrency Codigo de moneda de la cuenta a buscar le cargo. + * @param pAmount Monto base a obtener el cargo. + * @return TgeneSubProductCharges + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static final List find(EntityManager pEntityManager, String pModuleCode, String pProduct, String pSubProduct) + throws Exception { + Query qry = pEntityManager.createQuery(TgeneSubProductCharges.JQL_CHARGES); + qry.setParameter("modulecode", pModuleCode); + qry.setParameter("productcode", pProduct); + qry.setParameter("subproductcode", pSubProduct); + + return qry.getResultList(); + } + + /** Sentencia que devuelve una lista de TgeneSubProductCharges por compania. */ + private static final String HQL_CHARGES_SUBPRODUCT_BY_COMPANY = "from TgeneSubProductCharges tspc " + + " where tspc.pk.companycode = :companycode "; + + /** + * Metodo que entrega la definicion de cargos definidos por subproducto. + * + * @param pCompany Codigo de compania. + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findByCompany(EntityManager pEntityManager, Integer pCompany) { + List list = null; + Query qry = pEntityManager.createQuery(TgeneSubProductCharges.HQL_CHARGES_SUBPRODUCT_BY_COMPANY); + qry.setParameter("companycode", pCompany); + list = qry.getResultList(); + return list; + } + + /** Sentencia que devuelve una lista de TgeneSubProductCharges por compania. */ + private static final String JQL_CHARGES_SUBPRODUCT_BY_MODULE = "from TgeneSubProductCharges tsubpchar " + + " where tsubpchar.pk.modulecode = :modulecode "; + + /** + * Metodo que entrega la definicion de cargos definidos por subproducto. + * + * @param pCompany Codigo de compania. + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findByModule(EntityManager pEntityManager, String pModuleCode) { + List list = null; + Query qry = pEntityManager.createQuery(TgeneSubProductCharges.JQL_CHARGES_SUBPRODUCT_BY_MODULE); + qry.setParameter("modulecode", pModuleCode); + list = qry.getResultList(); + return list; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneSubProductChargesKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneSubProductChargesKey.java new file mode 100644 index 0000000..ab5b913 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/charge/TgeneSubProductChargesKey.java @@ -0,0 +1,313 @@ +package com.fp.persistence.pgeneral.charge; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESUBPRODUCTCHARGES*/ +@Embeddable +public class TgeneSubProductChargesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda de la cuenta +*/ +private String currencycode; + +@Column(name="RATESEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia para las tasas por subproducto +*/ +private Integer ratesequence; + +/**Contructor por defecto*/ +public TgeneSubProductChargesKey(){} +/**Contructor de TgeneSubProductChargesKey +@param pBalancetype Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pStatuscode Estatus de cuenta +@param pCompanycode Codigo de compania +@param pCurrencycode Codigo de moneda de la cuenta +@param pRatesequence Secuencia para las tasas por subproducto +*/ +public TgeneSubProductChargesKey(String pBalancetype,String pBalancegroup,String pModulecode,String pProductcode,String pSubproductcode,String pStatuscode,Integer pCompanycode,String pCurrencycode,Integer pRatesequence){ + balancetype=pBalancetype; + balancegroup=pBalancegroup; + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + statuscode=pStatuscode; + companycode=pCompanycode; + currencycode=pCurrencycode; + ratesequence=pRatesequence; +} +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de ratesequence +@return valor de ratesequence*/ +public Integer getRatesequence(){ + return ratesequence; +} +/**Fija el valor de ratesequence +@param pRatesequence nuevo Valor de ratesequence*/ +public void setRatesequence(Integer pRatesequence){ + ratesequence=pRatesequence; +} + +/**Implementacion de la comparacion de TgeneSubProductChargesKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSubProductChargesKey))return false; + TgeneSubProductChargesKey that = (TgeneSubProductChargesKey) o; + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getRatesequence() == null || that.getRatesequence() == null){ + return false; + } + if (! this.getRatesequence().equals(that.getRatesequence())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneSubProductChargesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getRatesequence() == null ? 0 : this.getRatesequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/.svn/entries new file mode 100644 index 0000000..4d3bd02 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneAccountingDateBranchKey.java +file + + + + +2022-07-28T03:40:30.174749Z +a944495ee8adf93ca493ef8596a5faa0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3636 + +TgeneAccountingDateKey.java +file + + + + +2022-07-28T03:40:30.174749Z +b47f410451578a36b7ceba3c633482a6 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4310 + +TgeneNotAccountingDayKey.java +file + + + + +2022-07-28T03:40:30.174749Z +18c3657530c0f3817314c0c8ef72dcc3 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3393 + +TgeneAccountingDateBranch.java +file + + + + +2022-07-28T03:40:30.174749Z +1b015cfd9bf247c368e23e8540255104 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7278 + +TgeneAccountingDate.java +file + + + + +2022-07-28T03:40:30.175749Z +6d90706c41def8481f6a0bfff0c5819b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4647 + +TgeneNotAccountingDay.java +file + + + + +2022-07-28T03:40:30.175749Z +01557bb2605c8196bab49ccfa1f632af +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5682 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/.svn/text-base/TgeneAccountingDate.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/.svn/text-base/TgeneAccountingDate.java.svn-base new file mode 100644 index 0000000..c04bebe --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/.svn/text-base/TgeneAccountingDate.java.svn-base @@ -0,0 +1,158 @@ +package com.fp.persistence.pgeneral.date; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTINGDATE*/ +@Entity(name="TgeneAccountingDate") +@Table(name="TGENEACCOUNTINGDATE") +public class TgeneAccountingDate extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountingDate +*/ +@EmbeddedId +private TgeneAccountingDateKey pk; +@Column(name="ACCOUNTINGDATE", nullable=true) + +/** +* Fecha contable. +*/ +private Date accountingdate; + +@Column(name="WORKINGDATE", nullable=true) + +/** +* Fecha de proceso o de trabajo +*/ +private Date workingdate; + +/**Contructor por defecto*/ +public TgeneAccountingDate(){ +} +/**Contructor de TgeneAccountingDate +@param pPk Clave Primaria del entity +*/ +public TgeneAccountingDate(TgeneAccountingDateKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountingDate +*/ +public static TgeneAccountingDate find(EntityManager pEntityManager,TgeneAccountingDateKey pKey) throws Exception{ + TgeneAccountingDate obj = pEntityManager.find(TgeneAccountingDate.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountingDate +@return El objeto que referencia a la Clave primaria de TgeneAccountingDate +*/ +public TgeneAccountingDateKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountingDate +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountingDate +*/ +public void setPk(TgeneAccountingDateKey pPk){ + pk=pPk; +} +/**Obtiene el valor de accountingdate +@return valor de accountingdate*/ +public Date getAccountingdate(){ + return accountingdate; +} +/**Fija el valor de accountingdate +@param pAccountingdate nuevo Valor de accountingdate*/ +public void setAccountingdate(Date pAccountingdate){ + accountingdate=pAccountingdate; +} + +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountingDate))return false; + TgeneAccountingDate that = (TgeneAccountingDate) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountingDate +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountingDate +*/ +public Object createInstance(){ + TgeneAccountingDate instance=new TgeneAccountingDate(); + instance.setPk(new TgeneAccountingDateKey()); + return instance; +} +/**Clona la entidad TgeneAccountingDate +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountingDate p=(TgeneAccountingDate)this.clone(); + p.setPk((TgeneAccountingDateKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/.svn/text-base/TgeneAccountingDateBranch.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/.svn/text-base/TgeneAccountingDateBranch.java.svn-base new file mode 100644 index 0000000..c6172fe --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/.svn/text-base/TgeneAccountingDateBranch.java.svn-base @@ -0,0 +1,252 @@ +package com.fp.persistence.pgeneral.date; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTINGDATEBRANCH*/ +@Entity(name="TgeneAccountingDateBranch") +@Table(name="TGENEACCOUNTINGDATEBRANCH") +public class TgeneAccountingDateBranch extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountingDateBranch +*/ +@EmbeddedId +private TgeneAccountingDateBranchKey pk; +@Column(name="USERCODE", nullable=true) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="REALDATE", nullable=true) + +/** +* Fecha real o calendario +*/ +private Date realdate; + +@Column(name="ACCOUNTINGDATE", nullable=false) + +/** +* Fecha contable de la sucursal +*/ +private Date accountingdate; + +@Column(name="WORKINGDATE", nullable=true) + +/** +* Fecha de trabajo de la aplicacion +*/ +private Date workingdate; + +@Column(name="PREVIOUSACCOUNTINGDATE", nullable=true) + +/** +* Fecha contable anterior a la fecha contable actual +*/ +private Date previousaccountingdate; + +@Column(name="NEXTACCOUNTINGDATE", nullable=true) + +/** +* Proxima fecha contable a la fecha contable actual +*/ +private Date nextaccountingdate; + +/**Contructor por defecto*/ +public TgeneAccountingDateBranch(){ +} +/**Contructor de TgeneAccountingDateBranch +@param pPk Clave Primaria del entity +@param pAccountingdate Fecha contable de la sucursal +*/ +public TgeneAccountingDateBranch(TgeneAccountingDateBranchKey pPk,Date pAccountingdate){ + this(); + pk=pPk; + accountingdate=pAccountingdate; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountingDateBranch +*/ +public static TgeneAccountingDateBranch find(EntityManager pEntityManager,TgeneAccountingDateBranchKey pKey) throws Exception{ + TgeneAccountingDateBranch obj = pEntityManager.find(TgeneAccountingDateBranch.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountingDateBranch +@return El objeto que referencia a la Clave primaria de TgeneAccountingDateBranch +*/ +public TgeneAccountingDateBranchKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountingDateBranch +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountingDateBranch +*/ +public void setPk(TgeneAccountingDateBranchKey pPk){ + pk=pPk; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Date getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Date pRealdate){ + realdate=pRealdate; +} + +/**Obtiene el valor de accountingdate +@return valor de accountingdate*/ +public Date getAccountingdate(){ + return accountingdate; +} +/**Fija el valor de accountingdate +@param pAccountingdate nuevo Valor de accountingdate*/ +public void setAccountingdate(Date pAccountingdate){ + accountingdate=pAccountingdate; +} + +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +/**Obtiene el valor de previousaccountingdate +@return valor de previousaccountingdate*/ +public Date getPreviousaccountingdate(){ + return previousaccountingdate; +} +/**Fija el valor de previousaccountingdate +@param pPreviousaccountingdate nuevo Valor de previousaccountingdate*/ +public void setPreviousaccountingdate(Date pPreviousaccountingdate){ + previousaccountingdate=pPreviousaccountingdate; +} + +/**Obtiene el valor de nextaccountingdate +@return valor de nextaccountingdate*/ +public Date getNextaccountingdate(){ + return nextaccountingdate; +} +/**Fija el valor de nextaccountingdate +@param pNextaccountingdate nuevo Valor de nextaccountingdate*/ +public void setNextaccountingdate(Date pNextaccountingdate){ + nextaccountingdate=pNextaccountingdate; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountingDateBranch))return false; + TgeneAccountingDateBranch that = (TgeneAccountingDateBranch) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountingDateBranch +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountingDateBranch +*/ +public Object createInstance(){ + TgeneAccountingDateBranch instance=new TgeneAccountingDateBranch(); + instance.setPk(new TgeneAccountingDateBranchKey()); + return instance; +} +/**Clona la entidad TgeneAccountingDateBranch +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountingDateBranch p=(TgeneAccountingDateBranch)this.clone(); + p.setPk((TgeneAccountingDateBranchKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/.svn/text-base/TgeneAccountingDateBranchKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/.svn/text-base/TgeneAccountingDateBranchKey.java.svn-base new file mode 100644 index 0000000..dcc5f17 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/.svn/text-base/TgeneAccountingDateBranchKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.date; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTINGDATEBRANCH*/ +@Embeddable +public class TgeneAccountingDateBranchKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="BRANCHCODE", nullable=false,updatable=false) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania al que pertenece la sucursal +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TgeneAccountingDateBranchKey(){} +/**Contructor de TgeneAccountingDateBranchKey +@param pBranchcode Codigo de sucursal +@param pCompanycode Codigo de compania al que pertenece la sucursal +*/ +public TgeneAccountingDateBranchKey(Integer pBranchcode,Integer pCompanycode){ + branchcode=pBranchcode; + companycode=pCompanycode; +} +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacin de la comparacin de TgeneAccountingDateBranchKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountingDateBranchKey))return false; + TgeneAccountingDateBranchKey that = (TgeneAccountingDateBranchKey) o; + if (this.getBranchcode() == null || that.getBranchcode() == null){ + return false; + } + if (! this.getBranchcode().equals(that.getBranchcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountingDateBranchKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getBranchcode() == null ? 0 : this.getBranchcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/.svn/text-base/TgeneAccountingDateKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/.svn/text-base/TgeneAccountingDateKey.java.svn-base new file mode 100644 index 0000000..48d1f7a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/.svn/text-base/TgeneAccountingDateKey.java.svn-base @@ -0,0 +1,152 @@ +package com.fp.persistence.pgeneral.date; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTINGDATE*/ +@Embeddable +public class TgeneAccountingDateKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="BRANCHCODE", nullable=false,updatable=false) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania al que pertenece la sucursal +*/ +private Integer companycode; + +@Column(name="REALDATE", nullable=false,updatable=false) + +/** +* Fecha calendario +*/ +private Date realdate; + +/**Contructor por defecto*/ +public TgeneAccountingDateKey(){} +/**Contructor de TgeneAccountingDateKey +@param pBranchcode Codigo de sucursal +@param pCompanycode Codigo de compania al que pertenece la sucursal +@param pRealdate Fecha calendario +*/ +public TgeneAccountingDateKey(Integer pBranchcode,Integer pCompanycode,Date pRealdate){ + branchcode=pBranchcode; + companycode=pCompanycode; + realdate=pRealdate; +} +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Date getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Date pRealdate){ + realdate=pRealdate; +} + +/**Implementacin de la comparacin de TgeneAccountingDateKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountingDateKey))return false; + TgeneAccountingDateKey that = (TgeneAccountingDateKey) o; + if (this.getBranchcode() == null || that.getBranchcode() == null){ + return false; + } + if (! this.getBranchcode().equals(that.getBranchcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getRealdate() == null || that.getRealdate() == null){ + return false; + } + if (! this.getRealdate().equals(that.getRealdate())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountingDateKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getBranchcode() == null ? 0 : this.getBranchcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getRealdate() == null ? 0 : this.getRealdate().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/.svn/text-base/TgeneNotAccountingDay.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/.svn/text-base/TgeneNotAccountingDay.java.svn-base new file mode 100644 index 0000000..2ff4223 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/.svn/text-base/TgeneNotAccountingDay.java.svn-base @@ -0,0 +1,219 @@ +package com.fp.persistence.pgeneral.date; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Transient; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENENOTACCOUNTINGDAY + */ +@Entity(name = "TgeneNotAccountingDay") +@Table(name = "TGENENOTACCOUNTINGDAY") +public class TgeneNotAccountingDay extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, + Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneNotAccountingDay + */ + @EmbeddedId + private TgeneNotAccountingDayKey pk; + @Column(name = "CATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo MONTHS, Asociado a los meses del anio + */ + private String catalogcode; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + /** Contructor por defecto */ + public TgeneNotAccountingDay() { + } + + /** + * Contructor de TgeneNotAccountingDay + * + * @param pPk Clave Primaria del entity + */ + public TgeneNotAccountingDay(TgeneNotAccountingDayKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneNotAccountingDay + */ + public static TgeneNotAccountingDay find(EntityManager pEntityManager, TgeneNotAccountingDayKey pKey) + throws Exception { + TgeneNotAccountingDay obj = pEntityManager.find(TgeneNotAccountingDay.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneNotAccountingDay + * + * @return El objeto que referencia a la Clave primaria de + * TgeneNotAccountingDay + */ + public TgeneNotAccountingDayKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneNotAccountingDay + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TgeneNotAccountingDay + */ + public void setPk(TgeneNotAccountingDayKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de catalogcode + * + * @return valor de catalogcode + */ + public String getCatalogcode() { + return catalogcode; + } + + /** + * Fija el valor de catalogcode + * + * @param pCatalogcode nuevo Valor de catalogcode + */ + public void setCatalogcode(String pCatalogcode) { + catalogcode = pCatalogcode; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneNotAccountingDay)) + return false; + TgeneNotAccountingDay that = (TgeneNotAccountingDay) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneNotAccountingDay + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneNotAccountingDay */ + public Object createInstance() { + TgeneNotAccountingDay instance = new TgeneNotAccountingDay(); + instance.setPk(new TgeneNotAccountingDayKey()); + return instance; + } + + /** + * Clona la entidad TgeneNotAccountingDay + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneNotAccountingDay p = (TgeneNotAccountingDay) this.clone(); + p.setPk((TgeneNotAccountingDayKey) this.pk.cloneMe()); + return p; + } + + //METODOS MANUALES + + /** + * Metodo que entrega una lista de dias no contables por mes. + */ + @SuppressWarnings("unchecked") + public static List findAll(EntityManager pEntityManager) throws Exception { + List obj = null; + Query qry = pEntityManager.createQuery("from TgeneNotAccountingDay t order by t.pk.catalog, t.pk.day "); + obj = qry.getResultList(); + return obj; + } + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/.svn/text-base/TgeneNotAccountingDayKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/.svn/text-base/TgeneNotAccountingDayKey.java.svn-base new file mode 100644 index 0000000..df4d894 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/.svn/text-base/TgeneNotAccountingDayKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.date; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENENOTACCOUNTINGDAY*/ +@Embeddable +public class TgeneNotAccountingDayKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 0 Enero, 1 Febreo, 2 Marzo +*/ +private String catalog; + +@Column(name="DAY", nullable=false,updatable=false) + +/** +* Dia del mes que no se considera como contable +*/ +private Integer day; + +/**Contructor por defecto*/ +public TgeneNotAccountingDayKey(){} +/**Contructor de TgeneNotAccountingDayKey +@param pCatalog Codigo de catalogo 0 Enero, 1 Febreo, 2 Marzo +@param pDay Dia del mes que no se considera como contable +*/ +public TgeneNotAccountingDayKey(String pCatalog,Integer pDay){ + catalog=pCatalog; + day=pDay; +} +/**Obtiene el valor de catalog +@return valor de catalog*/ +public String getCatalog(){ + return catalog; +} +/**Fija el valor de catalog +@param pCatalog nuevo Valor de catalog*/ +public void setCatalog(String pCatalog){ + catalog=pCatalog; +} + +/**Obtiene el valor de day +@return valor de day*/ +public Integer getDay(){ + return day; +} +/**Fija el valor de day +@param pDay nuevo Valor de day*/ +public void setDay(Integer pDay){ + day=pDay; +} + +/**Implementacin de la comparacin de TgeneNotAccountingDayKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneNotAccountingDayKey))return false; + TgeneNotAccountingDayKey that = (TgeneNotAccountingDayKey) o; + if (this.getCatalog() == null || that.getCatalog() == null){ + return false; + } + if (! this.getCatalog().equals(that.getCatalog())){ + return false; + } + if (this.getDay() == null || that.getDay() == null){ + return false; + } + if (! this.getDay().equals(that.getDay())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneNotAccountingDayKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCatalog() == null ? 0 : this.getCatalog().hashCode()); + result = result * 37 + (this.getDay() == null ? 0 : this.getDay().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/TgeneAccountingDate.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/TgeneAccountingDate.java new file mode 100644 index 0000000..c04bebe --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/TgeneAccountingDate.java @@ -0,0 +1,158 @@ +package com.fp.persistence.pgeneral.date; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTINGDATE*/ +@Entity(name="TgeneAccountingDate") +@Table(name="TGENEACCOUNTINGDATE") +public class TgeneAccountingDate extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountingDate +*/ +@EmbeddedId +private TgeneAccountingDateKey pk; +@Column(name="ACCOUNTINGDATE", nullable=true) + +/** +* Fecha contable. +*/ +private Date accountingdate; + +@Column(name="WORKINGDATE", nullable=true) + +/** +* Fecha de proceso o de trabajo +*/ +private Date workingdate; + +/**Contructor por defecto*/ +public TgeneAccountingDate(){ +} +/**Contructor de TgeneAccountingDate +@param pPk Clave Primaria del entity +*/ +public TgeneAccountingDate(TgeneAccountingDateKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountingDate +*/ +public static TgeneAccountingDate find(EntityManager pEntityManager,TgeneAccountingDateKey pKey) throws Exception{ + TgeneAccountingDate obj = pEntityManager.find(TgeneAccountingDate.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountingDate +@return El objeto que referencia a la Clave primaria de TgeneAccountingDate +*/ +public TgeneAccountingDateKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountingDate +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountingDate +*/ +public void setPk(TgeneAccountingDateKey pPk){ + pk=pPk; +} +/**Obtiene el valor de accountingdate +@return valor de accountingdate*/ +public Date getAccountingdate(){ + return accountingdate; +} +/**Fija el valor de accountingdate +@param pAccountingdate nuevo Valor de accountingdate*/ +public void setAccountingdate(Date pAccountingdate){ + accountingdate=pAccountingdate; +} + +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountingDate))return false; + TgeneAccountingDate that = (TgeneAccountingDate) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountingDate +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountingDate +*/ +public Object createInstance(){ + TgeneAccountingDate instance=new TgeneAccountingDate(); + instance.setPk(new TgeneAccountingDateKey()); + return instance; +} +/**Clona la entidad TgeneAccountingDate +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountingDate p=(TgeneAccountingDate)this.clone(); + p.setPk((TgeneAccountingDateKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/TgeneAccountingDateBranch.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/TgeneAccountingDateBranch.java new file mode 100644 index 0000000..c6172fe --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/TgeneAccountingDateBranch.java @@ -0,0 +1,252 @@ +package com.fp.persistence.pgeneral.date; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTINGDATEBRANCH*/ +@Entity(name="TgeneAccountingDateBranch") +@Table(name="TGENEACCOUNTINGDATEBRANCH") +public class TgeneAccountingDateBranch extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountingDateBranch +*/ +@EmbeddedId +private TgeneAccountingDateBranchKey pk; +@Column(name="USERCODE", nullable=true) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="REALDATE", nullable=true) + +/** +* Fecha real o calendario +*/ +private Date realdate; + +@Column(name="ACCOUNTINGDATE", nullable=false) + +/** +* Fecha contable de la sucursal +*/ +private Date accountingdate; + +@Column(name="WORKINGDATE", nullable=true) + +/** +* Fecha de trabajo de la aplicacion +*/ +private Date workingdate; + +@Column(name="PREVIOUSACCOUNTINGDATE", nullable=true) + +/** +* Fecha contable anterior a la fecha contable actual +*/ +private Date previousaccountingdate; + +@Column(name="NEXTACCOUNTINGDATE", nullable=true) + +/** +* Proxima fecha contable a la fecha contable actual +*/ +private Date nextaccountingdate; + +/**Contructor por defecto*/ +public TgeneAccountingDateBranch(){ +} +/**Contructor de TgeneAccountingDateBranch +@param pPk Clave Primaria del entity +@param pAccountingdate Fecha contable de la sucursal +*/ +public TgeneAccountingDateBranch(TgeneAccountingDateBranchKey pPk,Date pAccountingdate){ + this(); + pk=pPk; + accountingdate=pAccountingdate; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountingDateBranch +*/ +public static TgeneAccountingDateBranch find(EntityManager pEntityManager,TgeneAccountingDateBranchKey pKey) throws Exception{ + TgeneAccountingDateBranch obj = pEntityManager.find(TgeneAccountingDateBranch.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountingDateBranch +@return El objeto que referencia a la Clave primaria de TgeneAccountingDateBranch +*/ +public TgeneAccountingDateBranchKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountingDateBranch +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountingDateBranch +*/ +public void setPk(TgeneAccountingDateBranchKey pPk){ + pk=pPk; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Date getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Date pRealdate){ + realdate=pRealdate; +} + +/**Obtiene el valor de accountingdate +@return valor de accountingdate*/ +public Date getAccountingdate(){ + return accountingdate; +} +/**Fija el valor de accountingdate +@param pAccountingdate nuevo Valor de accountingdate*/ +public void setAccountingdate(Date pAccountingdate){ + accountingdate=pAccountingdate; +} + +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +/**Obtiene el valor de previousaccountingdate +@return valor de previousaccountingdate*/ +public Date getPreviousaccountingdate(){ + return previousaccountingdate; +} +/**Fija el valor de previousaccountingdate +@param pPreviousaccountingdate nuevo Valor de previousaccountingdate*/ +public void setPreviousaccountingdate(Date pPreviousaccountingdate){ + previousaccountingdate=pPreviousaccountingdate; +} + +/**Obtiene el valor de nextaccountingdate +@return valor de nextaccountingdate*/ +public Date getNextaccountingdate(){ + return nextaccountingdate; +} +/**Fija el valor de nextaccountingdate +@param pNextaccountingdate nuevo Valor de nextaccountingdate*/ +public void setNextaccountingdate(Date pNextaccountingdate){ + nextaccountingdate=pNextaccountingdate; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountingDateBranch))return false; + TgeneAccountingDateBranch that = (TgeneAccountingDateBranch) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountingDateBranch +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountingDateBranch +*/ +public Object createInstance(){ + TgeneAccountingDateBranch instance=new TgeneAccountingDateBranch(); + instance.setPk(new TgeneAccountingDateBranchKey()); + return instance; +} +/**Clona la entidad TgeneAccountingDateBranch +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountingDateBranch p=(TgeneAccountingDateBranch)this.clone(); + p.setPk((TgeneAccountingDateBranchKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/TgeneAccountingDateBranchKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/TgeneAccountingDateBranchKey.java new file mode 100644 index 0000000..dcc5f17 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/TgeneAccountingDateBranchKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.date; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTINGDATEBRANCH*/ +@Embeddable +public class TgeneAccountingDateBranchKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="BRANCHCODE", nullable=false,updatable=false) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania al que pertenece la sucursal +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TgeneAccountingDateBranchKey(){} +/**Contructor de TgeneAccountingDateBranchKey +@param pBranchcode Codigo de sucursal +@param pCompanycode Codigo de compania al que pertenece la sucursal +*/ +public TgeneAccountingDateBranchKey(Integer pBranchcode,Integer pCompanycode){ + branchcode=pBranchcode; + companycode=pCompanycode; +} +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacin de la comparacin de TgeneAccountingDateBranchKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountingDateBranchKey))return false; + TgeneAccountingDateBranchKey that = (TgeneAccountingDateBranchKey) o; + if (this.getBranchcode() == null || that.getBranchcode() == null){ + return false; + } + if (! this.getBranchcode().equals(that.getBranchcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountingDateBranchKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getBranchcode() == null ? 0 : this.getBranchcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/TgeneAccountingDateKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/TgeneAccountingDateKey.java new file mode 100644 index 0000000..48d1f7a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/TgeneAccountingDateKey.java @@ -0,0 +1,152 @@ +package com.fp.persistence.pgeneral.date; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTINGDATE*/ +@Embeddable +public class TgeneAccountingDateKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="BRANCHCODE", nullable=false,updatable=false) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania al que pertenece la sucursal +*/ +private Integer companycode; + +@Column(name="REALDATE", nullable=false,updatable=false) + +/** +* Fecha calendario +*/ +private Date realdate; + +/**Contructor por defecto*/ +public TgeneAccountingDateKey(){} +/**Contructor de TgeneAccountingDateKey +@param pBranchcode Codigo de sucursal +@param pCompanycode Codigo de compania al que pertenece la sucursal +@param pRealdate Fecha calendario +*/ +public TgeneAccountingDateKey(Integer pBranchcode,Integer pCompanycode,Date pRealdate){ + branchcode=pBranchcode; + companycode=pCompanycode; + realdate=pRealdate; +} +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Date getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Date pRealdate){ + realdate=pRealdate; +} + +/**Implementacin de la comparacin de TgeneAccountingDateKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountingDateKey))return false; + TgeneAccountingDateKey that = (TgeneAccountingDateKey) o; + if (this.getBranchcode() == null || that.getBranchcode() == null){ + return false; + } + if (! this.getBranchcode().equals(that.getBranchcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getRealdate() == null || that.getRealdate() == null){ + return false; + } + if (! this.getRealdate().equals(that.getRealdate())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountingDateKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getBranchcode() == null ? 0 : this.getBranchcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getRealdate() == null ? 0 : this.getRealdate().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/TgeneNotAccountingDay.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/TgeneNotAccountingDay.java new file mode 100644 index 0000000..2ff4223 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/TgeneNotAccountingDay.java @@ -0,0 +1,219 @@ +package com.fp.persistence.pgeneral.date; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Transient; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENENOTACCOUNTINGDAY + */ +@Entity(name = "TgeneNotAccountingDay") +@Table(name = "TGENENOTACCOUNTINGDAY") +public class TgeneNotAccountingDay extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, + Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneNotAccountingDay + */ + @EmbeddedId + private TgeneNotAccountingDayKey pk; + @Column(name = "CATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo MONTHS, Asociado a los meses del anio + */ + private String catalogcode; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + /** Contructor por defecto */ + public TgeneNotAccountingDay() { + } + + /** + * Contructor de TgeneNotAccountingDay + * + * @param pPk Clave Primaria del entity + */ + public TgeneNotAccountingDay(TgeneNotAccountingDayKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneNotAccountingDay + */ + public static TgeneNotAccountingDay find(EntityManager pEntityManager, TgeneNotAccountingDayKey pKey) + throws Exception { + TgeneNotAccountingDay obj = pEntityManager.find(TgeneNotAccountingDay.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneNotAccountingDay + * + * @return El objeto que referencia a la Clave primaria de + * TgeneNotAccountingDay + */ + public TgeneNotAccountingDayKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneNotAccountingDay + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TgeneNotAccountingDay + */ + public void setPk(TgeneNotAccountingDayKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de catalogcode + * + * @return valor de catalogcode + */ + public String getCatalogcode() { + return catalogcode; + } + + /** + * Fija el valor de catalogcode + * + * @param pCatalogcode nuevo Valor de catalogcode + */ + public void setCatalogcode(String pCatalogcode) { + catalogcode = pCatalogcode; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneNotAccountingDay)) + return false; + TgeneNotAccountingDay that = (TgeneNotAccountingDay) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneNotAccountingDay + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneNotAccountingDay */ + public Object createInstance() { + TgeneNotAccountingDay instance = new TgeneNotAccountingDay(); + instance.setPk(new TgeneNotAccountingDayKey()); + return instance; + } + + /** + * Clona la entidad TgeneNotAccountingDay + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneNotAccountingDay p = (TgeneNotAccountingDay) this.clone(); + p.setPk((TgeneNotAccountingDayKey) this.pk.cloneMe()); + return p; + } + + //METODOS MANUALES + + /** + * Metodo que entrega una lista de dias no contables por mes. + */ + @SuppressWarnings("unchecked") + public static List findAll(EntityManager pEntityManager) throws Exception { + List obj = null; + Query qry = pEntityManager.createQuery("from TgeneNotAccountingDay t order by t.pk.catalog, t.pk.day "); + obj = qry.getResultList(); + return obj; + } + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/TgeneNotAccountingDayKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/TgeneNotAccountingDayKey.java new file mode 100644 index 0000000..df4d894 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/date/TgeneNotAccountingDayKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.date; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENENOTACCOUNTINGDAY*/ +@Embeddable +public class TgeneNotAccountingDayKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 0 Enero, 1 Febreo, 2 Marzo +*/ +private String catalog; + +@Column(name="DAY", nullable=false,updatable=false) + +/** +* Dia del mes que no se considera como contable +*/ +private Integer day; + +/**Contructor por defecto*/ +public TgeneNotAccountingDayKey(){} +/**Contructor de TgeneNotAccountingDayKey +@param pCatalog Codigo de catalogo 0 Enero, 1 Febreo, 2 Marzo +@param pDay Dia del mes que no se considera como contable +*/ +public TgeneNotAccountingDayKey(String pCatalog,Integer pDay){ + catalog=pCatalog; + day=pDay; +} +/**Obtiene el valor de catalog +@return valor de catalog*/ +public String getCatalog(){ + return catalog; +} +/**Fija el valor de catalog +@param pCatalog nuevo Valor de catalog*/ +public void setCatalog(String pCatalog){ + catalog=pCatalog; +} + +/**Obtiene el valor de day +@return valor de day*/ +public Integer getDay(){ + return day; +} +/**Fija el valor de day +@param pDay nuevo Valor de day*/ +public void setDay(Integer pDay){ + day=pDay; +} + +/**Implementacin de la comparacin de TgeneNotAccountingDayKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneNotAccountingDayKey))return false; + TgeneNotAccountingDayKey that = (TgeneNotAccountingDayKey) o; + if (this.getCatalog() == null || that.getCatalog() == null){ + return false; + } + if (! this.getCatalog().equals(that.getCatalog())){ + return false; + } + if (this.getDay() == null || that.getDay() == null){ + return false; + } + if (! this.getDay().equals(that.getDay())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneNotAccountingDayKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCatalog() == null ? 0 : this.getCatalog().hashCode()); + result = result * 37 + (this.getDay() == null ? 0 : this.getDay().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/dict/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/dict/.svn/entries new file mode 100644 index 0000000..26628ee --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/dict/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/dict +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneDictionaryKey.java +file + + + + +2022-07-28T03:40:29.351745Z +f6a588630152a02739dafd19b48bfb00 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3550 + +TgeneDictionary.java +file + + + + +2022-07-28T03:40:29.351745Z +e68b88152bcd9e9470d94e2e58e27c21 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4529 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/dict/.svn/text-base/TgeneDictionary.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/dict/.svn/text-base/TgeneDictionary.java.svn-base new file mode 100644 index 0000000..87b3ad0 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/dict/.svn/text-base/TgeneDictionary.java.svn-base @@ -0,0 +1,159 @@ +package com.fp.persistence.pgeneral.dict; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEDICTIONARY*/ +@Entity(name="TgeneDictionary") +@Table(name="TGENEDICTIONARY") +public class TgeneDictionary extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneDictionary +*/ +@EmbeddedId +private TgeneDictionaryKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* null +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneDictionary(){ +} +/**Contructor de TgeneDictionary +@param pPk Clave Primaria del entity +*/ +public TgeneDictionary(TgeneDictionaryKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneDictionary +*/ +public static TgeneDictionary find(EntityManager pEntityManager,TgeneDictionaryKey pKey) throws Exception{ + TgeneDictionary obj = pEntityManager.find(TgeneDictionary.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneDictionary +@return El objeto que referencia a la Clave primaria de TgeneDictionary +*/ +public TgeneDictionaryKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneDictionary +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneDictionary +*/ +public void setPk(TgeneDictionaryKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneDictionary))return false; + TgeneDictionary that = (TgeneDictionary) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneDictionary +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneDictionary +*/ +public Object createInstance(){ + TgeneDictionary instance=new TgeneDictionary(); + instance.setPk(new TgeneDictionaryKey()); + return instance; +} +/**Clona la entidad TgeneDictionary +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneDictionary p=(TgeneDictionary)this.clone(); + p.setPk((TgeneDictionaryKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/dict/.svn/text-base/TgeneDictionaryKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/dict/.svn/text-base/TgeneDictionaryKey.java.svn-base new file mode 100644 index 0000000..7d2c3fe --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/dict/.svn/text-base/TgeneDictionaryKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.dict; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEDICTIONARY*/ +@Embeddable +public class TgeneDictionaryKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TABLENAME", nullable=false,updatable=false) + +/** +* Nombre de la tabla asociada al diccionario +*/ +private String tablename; + +@Column(name="COLUMNNAME", nullable=false,updatable=false) + +/** +* Nombre de la columna que almacena condiciones especiales. +*/ +private String columnname; + +/**Contructor por defecto*/ +public TgeneDictionaryKey(){} +/**Contructor de TgeneDictionaryKey +@param pTablename Nombre de la tabla asociada al diccionario +@param pColumnname Nombre de la columna que almacena condiciones especiales. +*/ +public TgeneDictionaryKey(String pTablename,String pColumnname){ + tablename=pTablename; + columnname=pColumnname; +} +/**Obtiene el valor de tablename +@return valor de tablename*/ +public String getTablename(){ + return tablename; +} +/**Fija el valor de tablename +@param pTablename nuevo Valor de tablename*/ +public void setTablename(String pTablename){ + tablename=pTablename; +} + +/**Obtiene el valor de columnname +@return valor de columnname*/ +public String getColumnname(){ + return columnname; +} +/**Fija el valor de columnname +@param pColumnname nuevo Valor de columnname*/ +public void setColumnname(String pColumnname){ + columnname=pColumnname; +} + +/**Implementacin de la comparacin de TgeneDictionaryKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneDictionaryKey))return false; + TgeneDictionaryKey that = (TgeneDictionaryKey) o; + if (this.getTablename() == null || that.getTablename() == null){ + return false; + } + if (! this.getTablename().equals(that.getTablename())){ + return false; + } + if (this.getColumnname() == null || that.getColumnname() == null){ + return false; + } + if (! this.getColumnname().equals(that.getColumnname())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneDictionaryKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTablename() == null ? 0 : this.getTablename().hashCode()); + result = result * 37 + (this.getColumnname() == null ? 0 : this.getColumnname().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/dict/TgeneDictionary.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/dict/TgeneDictionary.java new file mode 100644 index 0000000..87b3ad0 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/dict/TgeneDictionary.java @@ -0,0 +1,159 @@ +package com.fp.persistence.pgeneral.dict; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEDICTIONARY*/ +@Entity(name="TgeneDictionary") +@Table(name="TGENEDICTIONARY") +public class TgeneDictionary extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneDictionary +*/ +@EmbeddedId +private TgeneDictionaryKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* null +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneDictionary(){ +} +/**Contructor de TgeneDictionary +@param pPk Clave Primaria del entity +*/ +public TgeneDictionary(TgeneDictionaryKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneDictionary +*/ +public static TgeneDictionary find(EntityManager pEntityManager,TgeneDictionaryKey pKey) throws Exception{ + TgeneDictionary obj = pEntityManager.find(TgeneDictionary.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneDictionary +@return El objeto que referencia a la Clave primaria de TgeneDictionary +*/ +public TgeneDictionaryKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneDictionary +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneDictionary +*/ +public void setPk(TgeneDictionaryKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneDictionary))return false; + TgeneDictionary that = (TgeneDictionary) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneDictionary +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneDictionary +*/ +public Object createInstance(){ + TgeneDictionary instance=new TgeneDictionary(); + instance.setPk(new TgeneDictionaryKey()); + return instance; +} +/**Clona la entidad TgeneDictionary +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneDictionary p=(TgeneDictionary)this.clone(); + p.setPk((TgeneDictionaryKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/dict/TgeneDictionaryKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/dict/TgeneDictionaryKey.java new file mode 100644 index 0000000..7d2c3fe --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/dict/TgeneDictionaryKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.dict; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEDICTIONARY*/ +@Embeddable +public class TgeneDictionaryKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TABLENAME", nullable=false,updatable=false) + +/** +* Nombre de la tabla asociada al diccionario +*/ +private String tablename; + +@Column(name="COLUMNNAME", nullable=false,updatable=false) + +/** +* Nombre de la columna que almacena condiciones especiales. +*/ +private String columnname; + +/**Contructor por defecto*/ +public TgeneDictionaryKey(){} +/**Contructor de TgeneDictionaryKey +@param pTablename Nombre de la tabla asociada al diccionario +@param pColumnname Nombre de la columna que almacena condiciones especiales. +*/ +public TgeneDictionaryKey(String pTablename,String pColumnname){ + tablename=pTablename; + columnname=pColumnname; +} +/**Obtiene el valor de tablename +@return valor de tablename*/ +public String getTablename(){ + return tablename; +} +/**Fija el valor de tablename +@param pTablename nuevo Valor de tablename*/ +public void setTablename(String pTablename){ + tablename=pTablename; +} + +/**Obtiene el valor de columnname +@return valor de columnname*/ +public String getColumnname(){ + return columnname; +} +/**Fija el valor de columnname +@param pColumnname nuevo Valor de columnname*/ +public void setColumnname(String pColumnname){ + columnname=pColumnname; +} + +/**Implementacin de la comparacin de TgeneDictionaryKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneDictionaryKey))return false; + TgeneDictionaryKey that = (TgeneDictionaryKey) o; + if (this.getTablename() == null || that.getTablename() == null){ + return false; + } + if (! this.getTablename().equals(that.getTablename())){ + return false; + } + if (this.getColumnname() == null || that.getColumnname() == null){ + return false; + } + if (! this.getColumnname().equals(that.getColumnname())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneDictionaryKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTablename() == null ? 0 : this.getTablename().hashCode()); + result = result * 37 + (this.getColumnname() == null ? 0 : this.getColumnname().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/excel/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/excel/.svn/entries new file mode 100644 index 0000000..e6070a4 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/excel/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/excel +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneReadExcel.java +file + + + + +2022-07-28T03:40:29.752747Z +219edd0a26f2e4682dcb2329badd20f6 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5507 + +TgeneFileType.java +file + + + + +2022-07-28T03:40:29.752747Z +31ad6e2c5203a452f4d78428d96acf63 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4573 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/excel/.svn/text-base/TgeneFileType.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/excel/.svn/text-base/TgeneFileType.java.svn-base new file mode 100644 index 0000000..76d50f2 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/excel/.svn/text-base/TgeneFileType.java.svn-base @@ -0,0 +1,176 @@ +package com.fp.persistence.pgeneral.excel; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEFILETYPE*/ +@Entity(name="TgeneFileType") +@Table(name="TGENEFILETYPE") +public class TgeneFileType extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneFileType +*/ +@Id +@Column(name="FILECODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripción del tipo de dato +*/ +private String description; + +@Column(name="MANAGED", nullable=true) + +/** +* Manejado por internamente +*/ +private String managed; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistick locking del registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TgeneFileType(){ +} +/**Contructor de TgeneFileType +@param pPk Clave Primaria del entity +*/ +public TgeneFileType(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneFileType +*/ +public static TgeneFileType find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneFileType obj = pEntityManager.find(TgeneFileType.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneFileType +@return El objeto que referencia a la Clave primaria de TgeneFileType +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneFileType +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneFileType +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de managed +@return valor de managed*/ +public String getManaged(){ + return managed; +} +/**Fija el valor de managed +@param pManaged nuevo Valor de managed*/ +public void setManaged(String pManaged){ + managed=pManaged; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneFileType))return false; + TgeneFileType that = (TgeneFileType) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneFileType +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneFileType +*/ +public Object createInstance(){ + TgeneFileType instance=new TgeneFileType(); + return instance; +} +/**Clona la entidad TgeneFileType +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneFileType p=(TgeneFileType)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/excel/.svn/text-base/TgeneReadExcel.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/excel/.svn/text-base/TgeneReadExcel.java.svn-base new file mode 100644 index 0000000..ee6d98f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/excel/.svn/text-base/TgeneReadExcel.java.svn-base @@ -0,0 +1,210 @@ +package com.fp.persistence.pgeneral.excel; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEREADEXCEL*/ +@Entity(name="TgeneReadExcel") +@Table(name="TGENEREADEXCEL") +public class TgeneReadExcel extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneReadExcel +*/ +@Id +@Column(name="FILECODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="FIRSTROW", nullable=true) + +/** +* Primera fila del archivo a leer +*/ +private Integer firstrow; + +@Column(name="MAXROW", nullable=true) + +/** +* ltima fila del archivo a leer +*/ +private Integer maxrow; + +@Column(name="FIRSTCOLUMN", nullable=true) + +/** +* Primera columna del archivo a leer +*/ +private Integer firstcolumn; + +@Column(name="MAXCOLUM", nullable=true) + +/** +* ltima columan del archivo a leer +*/ +private Integer maxcolum; + +@Column(name="CLASSNAME", nullable=true) + +/** +* Paquete clase de negocio que se encarga de manipular la lista de objetos que fueron ledos del excel +*/ +private String classname; + +/**Contructor por defecto*/ +public TgeneReadExcel(){ +} +/**Contructor de TgeneReadExcel +@param pPk Clave Primaria del entity +*/ +public TgeneReadExcel(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneReadExcel +*/ +public static TgeneReadExcel find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneReadExcel obj = pEntityManager.find(TgeneReadExcel.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneReadExcel +@return El objeto que referencia a la Clave primaria de TgeneReadExcel +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneReadExcel +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneReadExcel +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de firstrow +@return valor de firstrow*/ +public Integer getFirstrow(){ + return firstrow; +} +/**Fija el valor de firstrow +@param pFirstrow nuevo Valor de firstrow*/ +public void setFirstrow(Integer pFirstrow){ + firstrow=pFirstrow; +} + +/**Obtiene el valor de maxrow +@return valor de maxrow*/ +public Integer getMaxrow(){ + return maxrow; +} +/**Fija el valor de maxrow +@param pMaxrow nuevo Valor de maxrow*/ +public void setMaxrow(Integer pMaxrow){ + maxrow=pMaxrow; +} + +/**Obtiene el valor de firstcolumn +@return valor de firstcolumn*/ +public Integer getFirstcolumn(){ + return firstcolumn; +} +/**Fija el valor de firstcolumn +@param pFirstcolumn nuevo Valor de firstcolumn*/ +public void setFirstcolumn(Integer pFirstcolumn){ + firstcolumn=pFirstcolumn; +} + +/**Obtiene el valor de maxcolum +@return valor de maxcolum*/ +public Integer getMaxcolum(){ + return maxcolum; +} +/**Fija el valor de maxcolum +@param pMaxcolum nuevo Valor de maxcolum*/ +public void setMaxcolum(Integer pMaxcolum){ + maxcolum=pMaxcolum; +} + +/**Obtiene el valor de classname +@return valor de classname*/ +public String getClassname(){ + return classname; +} +/**Fija el valor de classname +@param pClassname nuevo Valor de classname*/ +public void setClassname(String pClassname){ + classname=pClassname; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneReadExcel))return false; + TgeneReadExcel that = (TgeneReadExcel) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneReadExcel +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneReadExcel +*/ +public Object createInstance(){ + TgeneReadExcel instance=new TgeneReadExcel(); + return instance; +} +/**Clona la entidad TgeneReadExcel +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneReadExcel p=(TgeneReadExcel)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/excel/TgeneFileType.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/excel/TgeneFileType.java new file mode 100644 index 0000000..76d50f2 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/excel/TgeneFileType.java @@ -0,0 +1,176 @@ +package com.fp.persistence.pgeneral.excel; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEFILETYPE*/ +@Entity(name="TgeneFileType") +@Table(name="TGENEFILETYPE") +public class TgeneFileType extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneFileType +*/ +@Id +@Column(name="FILECODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripción del tipo de dato +*/ +private String description; + +@Column(name="MANAGED", nullable=true) + +/** +* Manejado por internamente +*/ +private String managed; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistick locking del registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TgeneFileType(){ +} +/**Contructor de TgeneFileType +@param pPk Clave Primaria del entity +*/ +public TgeneFileType(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneFileType +*/ +public static TgeneFileType find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneFileType obj = pEntityManager.find(TgeneFileType.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneFileType +@return El objeto que referencia a la Clave primaria de TgeneFileType +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneFileType +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneFileType +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de managed +@return valor de managed*/ +public String getManaged(){ + return managed; +} +/**Fija el valor de managed +@param pManaged nuevo Valor de managed*/ +public void setManaged(String pManaged){ + managed=pManaged; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneFileType))return false; + TgeneFileType that = (TgeneFileType) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneFileType +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneFileType +*/ +public Object createInstance(){ + TgeneFileType instance=new TgeneFileType(); + return instance; +} +/**Clona la entidad TgeneFileType +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneFileType p=(TgeneFileType)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/excel/TgeneReadExcel.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/excel/TgeneReadExcel.java new file mode 100644 index 0000000..ee6d98f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/excel/TgeneReadExcel.java @@ -0,0 +1,210 @@ +package com.fp.persistence.pgeneral.excel; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEREADEXCEL*/ +@Entity(name="TgeneReadExcel") +@Table(name="TGENEREADEXCEL") +public class TgeneReadExcel extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneReadExcel +*/ +@Id +@Column(name="FILECODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="FIRSTROW", nullable=true) + +/** +* Primera fila del archivo a leer +*/ +private Integer firstrow; + +@Column(name="MAXROW", nullable=true) + +/** +* ltima fila del archivo a leer +*/ +private Integer maxrow; + +@Column(name="FIRSTCOLUMN", nullable=true) + +/** +* Primera columna del archivo a leer +*/ +private Integer firstcolumn; + +@Column(name="MAXCOLUM", nullable=true) + +/** +* ltima columan del archivo a leer +*/ +private Integer maxcolum; + +@Column(name="CLASSNAME", nullable=true) + +/** +* Paquete clase de negocio que se encarga de manipular la lista de objetos que fueron ledos del excel +*/ +private String classname; + +/**Contructor por defecto*/ +public TgeneReadExcel(){ +} +/**Contructor de TgeneReadExcel +@param pPk Clave Primaria del entity +*/ +public TgeneReadExcel(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneReadExcel +*/ +public static TgeneReadExcel find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneReadExcel obj = pEntityManager.find(TgeneReadExcel.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneReadExcel +@return El objeto que referencia a la Clave primaria de TgeneReadExcel +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneReadExcel +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneReadExcel +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de firstrow +@return valor de firstrow*/ +public Integer getFirstrow(){ + return firstrow; +} +/**Fija el valor de firstrow +@param pFirstrow nuevo Valor de firstrow*/ +public void setFirstrow(Integer pFirstrow){ + firstrow=pFirstrow; +} + +/**Obtiene el valor de maxrow +@return valor de maxrow*/ +public Integer getMaxrow(){ + return maxrow; +} +/**Fija el valor de maxrow +@param pMaxrow nuevo Valor de maxrow*/ +public void setMaxrow(Integer pMaxrow){ + maxrow=pMaxrow; +} + +/**Obtiene el valor de firstcolumn +@return valor de firstcolumn*/ +public Integer getFirstcolumn(){ + return firstcolumn; +} +/**Fija el valor de firstcolumn +@param pFirstcolumn nuevo Valor de firstcolumn*/ +public void setFirstcolumn(Integer pFirstcolumn){ + firstcolumn=pFirstcolumn; +} + +/**Obtiene el valor de maxcolum +@return valor de maxcolum*/ +public Integer getMaxcolum(){ + return maxcolum; +} +/**Fija el valor de maxcolum +@param pMaxcolum nuevo Valor de maxcolum*/ +public void setMaxcolum(Integer pMaxcolum){ + maxcolum=pMaxcolum; +} + +/**Obtiene el valor de classname +@return valor de classname*/ +public String getClassname(){ + return classname; +} +/**Fija el valor de classname +@param pClassname nuevo Valor de classname*/ +public void setClassname(String pClassname){ + classname=pClassname; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneReadExcel))return false; + TgeneReadExcel that = (TgeneReadExcel) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneReadExcel +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneReadExcel +*/ +public Object createInstance(){ + TgeneReadExcel instance=new TgeneReadExcel(); + return instance; +} +/**Clona la entidad TgeneReadExcel +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneReadExcel p=(TgeneReadExcel)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/entries new file mode 100644 index 0000000..b9ba147 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/entries @@ -0,0 +1,3870 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneCreditType.java +file + + + + +2022-07-28T03:40:30.366749Z +b4540c6bd1569516bc51b141529b9651 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5403 + +TgeneSolicitudeNumber.java +file + + + + +2022-07-28T03:40:30.366749Z +8423c5d0b6f77f303e0916fdc5979447 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3850 + +TgeneOperativeConditionKey.java +file + + + + +2022-07-28T03:40:30.367749Z +ec5254b8cebb8e7b278d061c7c0d4a94 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3708 + +TgeneTellerTransferHeaderKey.java +file + + + + +2022-07-28T03:40:30.366749Z +a147574d3482a2aba685bea992799177 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5466 + +TgeneCurrencyRateKey.java +file + + + + +2022-07-28T03:40:30.367749Z +cd46f47f2f4aaaaafa08709797477715 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3628 + +TgeneRevokeSolicitude.java +file + + + + +2022-07-28T03:40:30.367749Z +8b63131dc5e5ad64a83d4f87d3a7f5f0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5200 + +TgeneAccountInstallRates.java +file + + + + +2022-07-28T03:40:30.368749Z +ac2b74d7839dd8224ca60a6580401d6f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +19731 + +TgeneCanton.java +file + + + + +2022-07-28T03:40:30.368749Z +da873e6ab1f503d3b4dc7c2b3ed52a2b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4424 + +TgeneDenomination.java +file + + + + +2022-07-28T03:40:30.368749Z +fca5333004bd259d7501e390770ab778 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3748 + +TgeneTransactionQueryKey.java +file + + + + +2022-07-28T03:40:30.368749Z +c43b2c52622f3a3a9b8ffd6557aef00b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5393 + +TgeneSolicitudeNumberKey.java +file + + + + +2022-07-28T03:40:30.369750Z +815d7ed6a30535f94bfdda96430cb8ec +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3813 + +TgeneBalanceType.java +file + + + + +2022-07-28T03:40:30.369750Z +22c359d7eb19c622b746028cb63156a3 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5781 + +TgeneLabelKey.java +file + + + + +2022-07-28T03:40:30.370750Z +28caa2108081a05a0055b0d09abac640 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4114 + +TgeneSolicitudeCreditOpeningKey.java +file + + + + +2022-07-28T03:40:30.369750Z +89ee6429fd929f0f70634516050f2859 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4904 + +TgeneSolicitudeInstallCharges.java +file + + + + +2022-07-28T03:40:30.369750Z +c0e091f0cab5d42d49c07b7a810d3eed +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7892 + +TgeneConsepLog.java +file + + + + +2022-07-28T03:40:30.370750Z +7a5aee0427b4bddce553ec2c5e6fddde +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +12737 + +TgeneCurrency.java +file + + + + +2022-07-28T03:40:30.370750Z +1da96804704c3435eb5ef8130063d625 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4973 + +TgeneTellerTransfer.java +file + + + + +2022-07-28T03:40:30.370750Z +d3e2483d41ccb1333bf07eef480dd9bd +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6262 + +TgeneTechnicalPatrimony.java +file + + + + +2022-07-28T03:40:30.371750Z +5d816e5b408a86fdc25c4b162e5b191c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5319 + +TgeneCashCloseDetailKey.java +file + + + + +2022-07-28T03:40:30.371750Z +b25709a961e951ac2e0fe55ce563d0d9 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9532 + +TgeneTransactionMix.java +file + + + + +2022-07-28T03:40:30.371750Z +bd2484c5c7a56a6cb0e22fe6547c5b1d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +11661 + +TgeneOfficeKey.java +file + + + + +2022-07-28T03:40:30.371750Z +cbe098384621ebe86dfd9735bdf79a11 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4265 + +TgeneSolicitudeDebitOpeningKey.java +file + + + + +2022-07-28T03:40:30.372750Z +424de9564f3cd33b645e108fcc88910a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4869 + +TgeneCurrencyRate.java +file + + + + +2022-07-28T03:40:30.372750Z +601fe163d732bb5c103b05d2467e87e2 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5526 + +OptmListaNegra.java +file + + + + +2022-07-28T03:40:30.372750Z +d180a3d5da1eeb36a59e32b6b6831586 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +15543 + +TgeneTechnicalPatrimonyKey.java +file + + + + +2022-07-28T03:40:30.372750Z +553b2b8ac42e7afde3cfd00a72c70bf7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3683 + +TgeneCity.java +file + + + + +2022-07-28T03:40:30.373750Z +cb733de8938486249d03788192015141 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4275 + +TgeneArea.java +file + + + + +2022-07-28T03:40:30.373750Z +9de2d4603348e7d1a70608aef4663245 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4355 + +TgeneSolicitudeStatus.java +file + + + + +2022-07-28T03:40:30.373750Z +e56747fd7449814cd18026321a478926 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4872 + +ABSTgeneSolicitudeRelationship.java +file + + + + +2022-07-28T03:40:30.373750Z +08d7c3b50a305ed29aa94a7f3239e67d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6590 + +TgeneCashCloseHeader.java +file + + + + +2022-07-28T03:40:30.374750Z +af8227c1696dd26e94257a3b92bf0483 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +11765 + +TgeneTellerTransferDetail.java +file + + + + +2022-07-28T03:40:30.374750Z +131a8c95af92b5ea5eb5428de2800a5f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6774 + +TgeneAccountInstallCharges.java +file + + + + +2022-07-28T03:40:30.374750Z +ad76eafeab695c9c70661cfb6bfb7c26 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6435 + +TgeneLanguage.java +file + + + + +2022-07-28T03:40:30.375750Z +a8d3d9ced3e52e0ac11e698c891f1dbd +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3991 + +TgeneCurrencyRateGroup.java +file + + + + +2022-07-28T03:40:30.375750Z +e08295ca0647bb9276fce7e1f73c3f38 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5731 + +TgeneServices.java +file + + + + +2022-07-28T03:40:30.375750Z +d23eef0e9639d4e7a0a0333435d832cc +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5643 + +TgeneTransactionMixPages.java +file + + + + +2022-07-28T03:40:30.375750Z +933f3d23da990b28c2b965b9627edc27 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4833 + +TgeneProvince.java +file + + + + +2022-07-28T03:40:30.376750Z +54fec1b1c662e756cca1c6b6df71cc79 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4574 + +TgeneCashCloseHeaderKey.java +file + + + + +2022-07-28T03:40:30.376750Z +d0f88eb77e4a1131610a37d22312fd94 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7680 + +TgeneConsep.java +file + + + + +2022-07-28T03:40:30.376750Z +57046797cca6d39082c163631e04d19a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +12942 + +TgeneRevokeSolicitudeKey.java +file + + + + +2022-07-28T03:40:30.376750Z +46b1d0aab7ea34a117f817bedbd163c4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3825 + +TgeneDenominationKey.java +file + + + + +2022-07-28T03:40:30.377750Z +aaad2cf5e505988f4804ff06d28bd735 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5090 + +TgeneCatalogDetailTest.java +file + + + + +2022-07-28T03:40:30.377750Z +ee141a9ac67bd3eedc4f8d09cff617a4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5676 + +TgeneTellerBalance.java +file + + + + +2022-07-28T03:40:30.377750Z +620948b6e716e55685bbda7b17ed0e04 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7023 + +TgeneProvinceKey.java +file + + + + +2022-07-28T03:40:30.378750Z +4ee437291ba1897858e6253d1234fcc3 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3490 + +TgeneSolicitudeRelationshipKey.java +file + + + + +2022-07-28T03:40:30.378750Z +5a6393db9fc198b7f0170b0fbfd2d48d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4644 + +TgeneTransactionReportLink.java +file + + + + +2022-07-28T03:40:30.378750Z +003a340e9dca5f103ea0707a50541364 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5049 + +TgeneFrequency.java +file + + + + +2022-07-28T03:40:30.379750Z +b688e4c39efc150770d4c929c4e10f44 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4973 + +TgeneSolicitudeInstallChargesKey.java +file + + + + +2022-07-28T03:40:30.378750Z +69316172f8516dc747a8cccbf1691bd2 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9854 + +TgeneCountry.java +file + + + + +2022-07-28T03:40:30.379750Z +2447c8202001d47aa6ef7b3769c6b7bd +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5684 + +TgeneOperationStatus.java +file + + + + +2022-07-28T03:40:30.380750Z +4677d869d026a45c04c9afdb3f934a15 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4747 + +TgeneConceptKey.java +file + + + + +2022-07-28T03:40:30.380750Z +6d775fbc365c81e69849135169c6e9fe +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3509 + +TgeneCashClose.java +file + + + + +2022-07-28T03:40:30.380750Z +6ff68ea7bcfacd5246058ad7512a8f90 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3642 + +TgeneQueryProcess.java +file + + + + +2022-07-28T03:40:30.379750Z +cc8b8c4a2fce97862e7b83b1080a3257 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6645 + +TgeneSolicitude.java +file + + + + +2022-07-28T03:40:30.379750Z +0a47bcf004a9f6acfe1c972ae94e51f4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +26429 + +TgeneTellerTransferKey.java +file + + + + +2022-07-28T03:40:30.380750Z +470b9bc23a51760b8cdf19e1aad01cf6 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4554 + +TgeneCatalogDetailTestKey.java +file + + + + +2022-07-28T03:40:30.381750Z +ef2dd5019a7ca6248e22fd8c8373d7bd +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3617 + +TgeneTellerBalanceKey.java +file + + + + +2022-07-28T03:40:30.381750Z +36a7b20679fcaf156b0d8ff32f8adb41 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4274 + +TgeneTransactionQuery.java +file + + + + +2022-07-28T03:40:30.381750Z +8437a7eb5e3b86bdd4abb62f0235f8f5 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8119 + +TgeneEntity.java +file + + + + +2022-07-28T03:40:30.382750Z +60e9e688411e89128e912ad858ee1a00 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8557 + +TgeneParametersKey.java +file + + + + +2022-07-28T03:40:30.382750Z +6a4be54be32cfc308ce36d786a81f4ab +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3340 + +TgeneParroquiaKey.java +file + + + + +2022-07-28T03:40:30.382750Z +fb821b3866cb2d35634b5750d74ed56d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4927 + +TgeneUserSolicitudeNumber.java +file + + + + +2022-07-28T03:40:30.381750Z +cc305154d7383c8fc8293b11450cc814 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4289 + +TgeneLabel.java +file + + + + +2022-07-28T03:40:30.382750Z +abf87868994aec88a11e08d509edf389 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6613 + +TgeneSolicitudeCreditOpening.java +file + + + + +2022-07-28T03:40:30.383750Z +affb189678bf8507f34a9406191be232 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9885 + +TgeneSolicitudeLiquidationKey.java +file + + + + +2022-07-28T03:40:30.383750Z +d1c09baada024306a5f3291ba4cebf04 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9772 + +TgeneCityKey.java +file + + + + +2022-07-28T03:40:30.383750Z +afa62f86ff063ccf045ae580375d2c39 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4756 + +TgeneAreaKey.java +file + + + + +2022-07-28T03:40:30.383750Z +18e8d7c569b14b05020b4adcdc18e30f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3434 + +TgeneSolicitudeStatusKey.java +file + + + + +2022-07-28T03:40:30.384750Z +f0dfba3a90744c0ea6a6fa872094b0fa +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3513 + +TgeneBalanceTypeDetailKey.java +file + + + + +2022-07-28T03:40:30.384750Z +6a6e9b6d79abf8f70235454bc926d6e2 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3912 + +TgeneSolicitudeRelationship.java +file + + + + +2022-07-28T03:40:30.384750Z +9bc1df777a494d3297a96551ca5410d2 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8910 + +TgeneAccountRelationshipKey.java +file + + + + +2022-07-28T03:40:30.384750Z +799151269bcdcdd2885ad6c30edc90fe +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4226 + +TgeneCashCloseDetail.java +file + + + + +2022-07-28T03:40:30.385750Z +d8eda38b93c7236e883972ef657be30b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4605 + +TgeneAccountInstallChargesKey.java +file + + + + +2022-07-28T03:40:30.385750Z +7dafbef279ef8594f6bdbc78dcf90875 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6376 + +TgeneCatalogEquivalenceDet.java +file + + + + +2022-07-28T03:40:30.385750Z +1076198af5c70cc78771b715e3785301 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +12991 + +TgeneOffice.java +file + + + + +2022-07-28T03:40:30.385750Z +1bcc54ad5c00be10ed943e7bfe9a050d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8930 + +TgeneBranch.java +file + + + + +2022-07-28T03:40:30.386750Z +6da7a151d6b2d7c267bde63ee2b9aa9d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6117 + +TgeneBalanceTypeKey.java +file + + + + +2022-07-28T03:40:30.386750Z +eccaf9639bc1946f30e61e247f141026 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3852 + +TgeneBalanceGroup.java +file + + + + +2022-07-28T03:40:30.386750Z +22b3173f528241e921ffe2677e866da4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5615 + +TgeneSolicitudeInstallRatesKey.java +file + + + + +2022-07-28T03:40:30.387750Z +32cd512e93f8a97ac9a1d8e169f259b0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9347 + +TgeneBranchKey.java +file + + + + +2022-07-28T03:40:30.387750Z +8926124c626a5ccebe16ebe12d4b52e7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3496 + +TgeneFunctions.java +file + + + + +2022-07-28T03:40:30.387750Z +124a3cac48877cd401a736f554d3c637 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6263 + +TgeneBalanceTypeDetail.java +file + + + + +2022-07-28T03:40:30.387750Z +8f6f53841c352f392fb1b2b34004576e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7705 + +TgeneCatalog.java +file + + + + +2022-07-28T03:40:30.388750Z +413238b4979146a502bca0f5bd0b553a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4471 + +TgeneTransactionMixKey.java +file + + + + +2022-07-28T03:40:30.388750Z +212045469d9a64f58a0731ee675ad1ca +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4171 + +TgeneOperationStatusKey.java +file + + + + +2022-07-28T03:40:30.388750Z +76dcd04328182ae3bcd97df45866caf6 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3752 + +TgeneOfficer.java +file + + + + +2022-07-28T03:40:30.388750Z +9cafccdae6d60473c9e953dbd27e7685 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3553 + +TgeneCashCloseKey.java +file + + + + +2022-07-28T03:40:30.389750Z +ccc174e372871b4aad43f729f969ca4e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6766 + +TgeneQueryProcessKey.java +file + + + + +2022-07-28T03:40:30.389750Z +2e463ced75c7cd74ed52b94c880d8848 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3416 + +TgeneSolicitudeKey.java +file + + + + +2022-07-28T03:40:30.389750Z +4d8a103d93bc0555a13e6238c41513e8 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4631 + +TgeneAccountRelationship.java +file + + + + +2022-07-28T03:40:30.389750Z +e2518e4daed9d2979ae5e32815e983f3 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +14097 + +TgeneEntityKey.java +file + + + + +2022-07-28T03:40:30.390750Z +c4aa127cb4ec51b2cce63842caeb6fbc +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3264 + +TgeneOfficerKey.java +file + + + + +2022-07-28T03:40:30.390750Z +e6dc9984cb50e222297cb52409c95fdd +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5820 + +TgeneTellerTransferDetailKey.java +file + + + + +2022-07-28T03:40:30.390750Z +ff735d7d53fb68e04f062cc38ebbc762 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7320 + +TgeneWildcard.java +file + + + + +2022-07-28T03:40:30.390750Z +423bca93495f0d69fbb3099d620c04a0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6734 + +TgeneSolicitudeInstallRates.java +file + + + + +2022-07-28T03:40:30.391750Z +49c82e280df7fecca56a06946550e74b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +18458 + +TgeneConcept.java +file + + + + +2022-07-28T03:40:30.391750Z +6139831cb5dd39042387cdc8dcc77c39 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4822 + +TgeneChannels.java +file + + + + +2022-07-28T03:40:30.391750Z +f51e5f3119a486ec0a7bfea24ebd2d01 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4398 + +TgeneAccountInstallRatesKey.java +file + + + + +2022-07-28T03:40:30.392750Z +aa51f22db4099b4507dd0cbcd37b9084 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6630 + +TgeneCantonKey.java +file + + + + +2022-07-28T03:40:30.392750Z +bb51b3ee4193df0eb522bd50f8217e5e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4235 + +TgeneCurrencyRateGroupKey.java +file + + + + +2022-07-28T03:40:30.392750Z +362dbc4d11e5dab41675c26c5e627e98 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5896 + +TgeneCatalogEquivalence.java +file + + + + +2022-07-28T03:40:30.392750Z +aebc3f8d84f97faa5df55bf0785630d7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4678 + +TgeneSolicitudeDebitOpening.java +file + + + + +2022-07-28T03:40:30.393750Z +45da21c46f6d73725d5584ddbd8364fd +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8853 + +TgeneTransactionMixPagesKey.java +file + + + + +2022-07-28T03:40:30.393750Z +141d5313c4a3bf73b1884d3f9550af75 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4862 + +TgeneCatalogDetail.java +file + + + + +2022-07-28T03:40:30.393750Z +3f9a1b00415f08bd79ca89fd6307cd61 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7083 + +TgeneParameters.java +file + + + + +2022-07-28T03:40:30.393750Z +adbed023059810f1eb50e3eba8b2d356 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4935 + +TgeneParroquia.java +file + + + + +2022-07-28T03:40:30.394750Z +28cecbce00d81e5c4d1aac860e6fb240 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4355 + +TgeneOperativeCondition.java +file + + + + +2022-07-28T03:40:30.394750Z +7b284e8871f56840fbea1936971c38b0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4834 + +TgeneTellerTransferHeader.java +file + + + + +2022-07-28T03:40:30.394750Z +c83624e7b64607b9d553ae92f2d15c90 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +16094 + +TgeneCompany.java +file + + + + +2022-07-28T03:40:30.394750Z +ef3ce141ffa42e5ee0db49c6df355ac8 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6823 + +TgeneCatalogDetailKey.java +file + + + + +2022-07-28T03:40:30.395750Z +e59b7f5b4995196a4d2b7d748bad31a7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3453 + +TgeneSolicitudeLiquidation.java +file + + + + +2022-07-28T03:40:30.395750Z +96cfb24303bbf5fc00e7112e05348279 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9947 + +TgeneTransactionReportLinkKey.java +file + + + + +2022-07-28T03:40:30.395750Z +ce7b7fedac6eeda3c19e099c6568fb5c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5678 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/ABSTgeneSolicitudeRelationship.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/ABSTgeneSolicitudeRelationship.java.svn-base new file mode 100644 index 0000000..9f7a691 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/ABSTgeneSolicitudeRelationship.java.svn-base @@ -0,0 +1,239 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDERELATIONSHIP*/ +@Entity(name="ABSTgeneSolicitudeRelationship") +@Table(name="TGENESOLICITUDERELATIONSHIP") +public abstract class ABSTgeneSolicitudeRelationship extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeRelationship +*/ +@EmbeddedId +private TgeneSolicitudeRelationshipKey pk; +@Column(name="MODULECODE", nullable=true) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="RELATIONSHIPCODE", nullable=true) + +/** +* Codigo de relacion de la cuenta con el cliente +*/ +private String relationshipcode; + +@Column(name="ISPRINCIPAL", nullable=true) + +/** +* Indica si el codigo de relacion es principal, en este caso el codigo de cliente se asocia a la tabla tgeneaccount +*/ +private String isprincipal; + +@Column(name="PRIORITY", nullable=true) + +/** +* Prioridad del cleinte con la solicitud. +*/ +private Integer priority; + +@Column(name="CONDITION", nullable=true) + +/** +* Codicion del cliente con la solicitud. +*/ +private String condition; + +@Column(name="PARTICIPATION", nullable=true) + +/** +* Porcentaje de participacion del cliente con la solicitud. +*/ +private BigDecimal participation; + +@Column(name="ADDRESSNUMBER", nullable=true) + +/** +* Direccion asociada +*/ +private Integer addressnumber; + +@Column(name="PERSONTYPE", nullable=true) + +/** +* 1, Persona natural, 2 Persona Juridica. +*/ +private String persontype; + +/**Entrega la Clave primaria de TgeneSolicitudeRelationship +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeRelationship +*/ +public TgeneSolicitudeRelationshipKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeRelationship +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeRelationship +*/ +public void setPk(TgeneSolicitudeRelationshipKey pPk){ + pk=pPk; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de relationshipcode +@return valor de relationshipcode*/ +public String getRelationshipcode(){ + return relationshipcode; +} +/**Fija el valor de relationshipcode +@param pRelationshipcode nuevo Valor de relationshipcode*/ +public void setRelationshipcode(String pRelationshipcode){ + relationshipcode=pRelationshipcode; +} + +/**Obtiene el valor de isprincipal +@return valor de isprincipal*/ +public String getIsprincipal(){ + return isprincipal; +} +/**Fija el valor de isprincipal +@param pIsprincipal nuevo Valor de isprincipal*/ +public void setIsprincipal(String pIsprincipal){ + isprincipal=pIsprincipal; +} + +/**Obtiene el valor de priority +@return valor de priority*/ +public Integer getPriority(){ + return priority; +} +/**Fija el valor de priority +@param pPriority nuevo Valor de priority*/ +public void setPriority(Integer pPriority){ + priority=pPriority; +} + +/**Obtiene el valor de condition +@return valor de condition*/ +public String getCondition(){ + return condition; +} +/**Fija el valor de condition +@param pCondition nuevo Valor de condition*/ +public void setCondition(String pCondition){ + condition=pCondition; +} + +/**Obtiene el valor de participation +@return valor de participation*/ +public BigDecimal getParticipation(){ + return participation; +} +/**Fija el valor de participation +@param pParticipation nuevo Valor de participation*/ +public void setParticipation(BigDecimal pParticipation){ + participation=pParticipation; +} + +/**Obtiene el valor de addressnumber +@return valor de addressnumber*/ +public Integer getAddressnumber(){ + return addressnumber; +} +/**Fija el valor de addressnumber +@param pAddressnumber nuevo Valor de addressnumber*/ +public void setAddressnumber(Integer pAddressnumber){ + addressnumber=pAddressnumber; +} + +/**Obtiene el valor de persontype +@return valor de persontype*/ +public String getPersontype(){ + return persontype; +} +/**Fija el valor de persontype +@param pPersontype nuevo Valor de persontype*/ +public void setPersontype(String pPersontype){ + persontype=pPersontype; +} + +/**Implementacin de la comparacin de la entidad TgeneSolicitudeRelationship +@param rhs Elemento de Comparacin +@return el resultado de la comparacin +*/ +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeRelationship))return false; + TgeneSolicitudeRelationship that = (TgeneSolicitudeRelationship) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeRelationship +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeRelationship p=(TgeneSolicitudeRelationship)this.clone(); + p.setPk((TgeneSolicitudeRelationshipKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/OptmListaNegra.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/OptmListaNegra.java.svn-base new file mode 100644 index 0000000..c15daca --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/OptmListaNegra.java.svn-base @@ -0,0 +1,582 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; +import java.util.List; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla OPTMLISTANEGRA*/ +@Entity(name="OptmListaNegra") +@Table(name="OPTMLISTANEGRA") +public class OptmListaNegra extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad OptmListaNegra + */ + @Id + @Column(name="ID_LISTANEGRA" ,nullable=false, updatable=false) + private String pk; + @Column(name="PARTMREGIONCOD", nullable=true) + + /** + * Region donde se encuentra registrada la informacin + */ + private String partmregioncod; + + @Column(name="PARTMSUCCOD", nullable=true) + + /** + * Sucursal donde se encuentra registrada la informacin + */ + private String partmsuccod; + + @Column(name="PARTMAGECOD", nullable=true) + + /** + * Agencia donde se encuentra registrada la informacin + */ + private String partmagecod; + + @Column(name="PARTMUNIADMCOD", nullable=true) + + /** + * Departamento donde se encuentra registrada la informacin + */ + private String partmuniadmcod; + + @Column(name="NOMBRE", nullable=true) + + /** + * Nombre de la persona registrada en dicha lista + */ + private String nombre; + + @Column(name="APELLIDO", nullable=true) + + /** + * Apellido de la persona registrada en dicha lista + */ + private String apellido; + + @Column(name="ID_TIPLISNEG", nullable=true) + + /** + * Tipo de Registro codigo Tipo llista (Sindicado,Homonimo) + */ + private Long id_tiplisneg; + + @Column(name="ESTADO", nullable=true) + + /** + * Estado del registro + */ + private String estado; + + @Column(name="FEC_ING_LISNEG", nullable=true) + + /** + * Fecha de registro en la lista negra + */ + private Date fec_ing_lisneg; + + @Column(name="PERMITIR_TRX", nullable=true) + + /** + * Bandera que identifica si el registro es bloque o advertencia + */ + private String permitir_trx; + + @Column(name="IDENTIFICACION", nullable=true) + + /** + * Identificacin de la persona registrada en dicha lista + */ + private String identificacion; + + @Column(name="PARTMCIUDADCOD", nullable=true) + + /** + * Ciudad donde esta registrado segn el CONSEP + */ + private String partmciudadcod; + + @Column(name="FEC_ING_CARGO", nullable=true) + + /** + * Fecha en el que se subio el archivo al sistema + */ + private Date fec_ing_cargo; + + @Column(name="FEC_SAL_CARGO", nullable=true) + + /** + * Fecha en la que se dio de baja del sistema + */ + private Date fec_sal_cargo; + + @Column(name="ID_CARGO", nullable=true) + + /** + * Cdigo del cargo que realizo la actualizacin + */ + private Integer id_cargo; + + @Column(name="ULT_ESTADO", nullable=true) + + /** + * Ultimo estado + */ + private String ult_estado; + + @Column(name="FEC_SAL_LISNEG", nullable=true) + + /** + * Fecha de salida del registro de lista negra + */ + private Date fec_sal_lisneg; + + @Column(name="USU_INGRESA", nullable=true) + + /** + * Usuario que ingreso el registro + */ + private String usu_ingresa; + + @Column(name="USU_MODIFICA", nullable=true) + + /** + * Usuario que modifico el registro + */ + private String usu_modifica; + + @Column(name="FEC_MODIFICA", nullable=true) + + /** + * Fecha de modificacin + */ + private Date fec_modifica; + + @Column(name="ARCHIVO_ORIG", nullable=true) + + /** + * Nombre del archivo plano de la lista negra + */ + private String archivo_orig; + + @Column(name="OBSERVACIONLP", nullable=true) + + /** + * Observaciones del archivo subido + */ + private String observacionlp; + + @Column(name="ID_TIPLISPROPIAS", nullable=true) + + /** + * Identificador de listas propias (actualmente no implementado) + */ + private Long id_tiplispropias; + + @Column(name="OBSERVACION", nullable=true) + + /** + * Observaciones del registro + */ + private String observacion; + + /**Contructor por defecto*/ + public OptmListaNegra(){ + } + /**Contructor de OptmListaNegra + @param pPk Clave Primaria del entity + */ + public OptmListaNegra(String pPk){ + this(); + pk=pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return OptmListaNegra + */ + public static OptmListaNegra find(EntityManager pEntityManager,Object pKey) throws Exception{ + OptmListaNegra obj = pEntityManager.find(OptmListaNegra.class,pKey); + return obj; + } + /**Entrega la Clave primaria de OptmListaNegra + @return El objeto que referencia a la Clave primaria de OptmListaNegra + */ + public String getPk(){ + return pk; + } + /**Fija un nuevo valor a la Clave primaria de OptmListaNegra + @param pPk El objeto que referencia a la nueva Clave primaria de OptmListaNegra + */ + public void setPk(String pPk){ + pk=pPk; + } + /**Obtiene el valor de partmregioncod + @return valor de partmregioncod*/ + public String getPartmregioncod(){ + return partmregioncod; + } + /**Fija el valor de partmregioncod + @param pPartmregioncod nuevo Valor de partmregioncod*/ + public void setPartmregioncod(String pPartmregioncod){ + partmregioncod=pPartmregioncod; + } + + /**Obtiene el valor de partmsuccod + @return valor de partmsuccod*/ + public String getPartmsuccod(){ + return partmsuccod; + } + /**Fija el valor de partmsuccod + @param pPartmsuccod nuevo Valor de partmsuccod*/ + public void setPartmsuccod(String pPartmsuccod){ + partmsuccod=pPartmsuccod; + } + + /**Obtiene el valor de partmagecod + @return valor de partmagecod*/ + public String getPartmagecod(){ + return partmagecod; + } + /**Fija el valor de partmagecod + @param pPartmagecod nuevo Valor de partmagecod*/ + public void setPartmagecod(String pPartmagecod){ + partmagecod=pPartmagecod; + } + + /**Obtiene el valor de partmuniadmcod + @return valor de partmuniadmcod*/ + public String getPartmuniadmcod(){ + return partmuniadmcod; + } + /**Fija el valor de partmuniadmcod + @param pPartmuniadmcod nuevo Valor de partmuniadmcod*/ + public void setPartmuniadmcod(String pPartmuniadmcod){ + partmuniadmcod=pPartmuniadmcod; + } + + /**Obtiene el valor de nombre + @return valor de nombre*/ + public String getNombre(){ + return nombre; + } + /**Fija el valor de nombre + @param pNombre nuevo Valor de nombre*/ + public void setNombre(String pNombre){ + nombre=pNombre; + } + + /**Obtiene el valor de apellido + @return valor de apellido*/ + public String getApellido(){ + return apellido; + } + /**Fija el valor de apellido + @param pApellido nuevo Valor de apellido*/ + public void setApellido(String pApellido){ + apellido=pApellido; + } + + /**Obtiene el valor de id_tiplisneg + @return valor de id_tiplisneg*/ + public Long getId_tiplisneg(){ + return id_tiplisneg; + } + /**Fija el valor de id_tiplisneg + @param pId_tiplisneg nuevo Valor de id_tiplisneg*/ + public void setId_tiplisneg(Long pId_tiplisneg){ + id_tiplisneg=pId_tiplisneg; + } + + /**Obtiene el valor de estado + @return valor de estado*/ + public String getEstado(){ + return estado; + } + /**Fija el valor de estado + @param pEstado nuevo Valor de estado*/ + public void setEstado(String pEstado){ + estado=pEstado; + } + + /**Obtiene el valor de fec_ing_lisneg + @return valor de fec_ing_lisneg*/ + public Date getFec_ing_lisneg(){ + return fec_ing_lisneg; + } + /**Fija el valor de fec_ing_lisneg + @param pFec_ing_lisneg nuevo Valor de fec_ing_lisneg*/ + public void setFec_ing_lisneg(Date pFec_ing_lisneg){ + fec_ing_lisneg=pFec_ing_lisneg; + } + + /**Obtiene el valor de permitir_trx + @return valor de permitir_trx*/ + public String getPermitir_trx(){ + return permitir_trx; + } + /**Fija el valor de permitir_trx + @param pPermitir_trx nuevo Valor de permitir_trx*/ + public void setPermitir_trx(String pPermitir_trx){ + permitir_trx=pPermitir_trx; + } + + /**Obtiene el valor de identificacion + @return valor de identificacion*/ + public String getIdentificacion(){ + return identificacion; + } + /**Fija el valor de identificacion + @param pIdentificacion nuevo Valor de identificacion*/ + public void setIdentificacion(String pIdentificacion){ + identificacion=pIdentificacion; + } + + /**Obtiene el valor de partmciudadcod + @return valor de partmciudadcod*/ + public String getPartmciudadcod(){ + return partmciudadcod; + } + /**Fija el valor de partmciudadcod + @param pPartmciudadcod nuevo Valor de partmciudadcod*/ + public void setPartmciudadcod(String pPartmciudadcod){ + partmciudadcod=pPartmciudadcod; + } + + /**Obtiene el valor de fec_ing_cargo + @return valor de fec_ing_cargo*/ + public Date getFec_ing_cargo(){ + return fec_ing_cargo; + } + /**Fija el valor de fec_ing_cargo + @param pFec_ing_cargo nuevo Valor de fec_ing_cargo*/ + public void setFec_ing_cargo(Date pFec_ing_cargo){ + fec_ing_cargo=pFec_ing_cargo; + } + + /**Obtiene el valor de fec_sal_cargo + @return valor de fec_sal_cargo*/ + public Date getFec_sal_cargo(){ + return fec_sal_cargo; + } + /**Fija el valor de fec_sal_cargo + @param pFec_sal_cargo nuevo Valor de fec_sal_cargo*/ + public void setFec_sal_cargo(Date pFec_sal_cargo){ + fec_sal_cargo=pFec_sal_cargo; + } + + /**Obtiene el valor de id_cargo + @return valor de id_cargo*/ + public Integer getId_cargo(){ + return id_cargo; + } + /**Fija el valor de id_cargo + @param pId_cargo nuevo Valor de id_cargo*/ + public void setId_cargo(Integer pId_cargo){ + id_cargo=pId_cargo; + } + + /**Obtiene el valor de ult_estado + @return valor de ult_estado*/ + public String getUlt_estado(){ + return ult_estado; + } + /**Fija el valor de ult_estado + @param pUlt_estado nuevo Valor de ult_estado*/ + public void setUlt_estado(String pUlt_estado){ + ult_estado=pUlt_estado; + } + + /**Obtiene el valor de fec_sal_lisneg + @return valor de fec_sal_lisneg*/ + public Date getFec_sal_lisneg(){ + return fec_sal_lisneg; + } + /**Fija el valor de fec_sal_lisneg + @param pFec_sal_lisneg nuevo Valor de fec_sal_lisneg*/ + public void setFec_sal_lisneg(Date pFec_sal_lisneg){ + fec_sal_lisneg=pFec_sal_lisneg; + } + + /**Obtiene el valor de usu_ingresa + @return valor de usu_ingresa*/ + public String getUsu_ingresa(){ + return usu_ingresa; + } + /**Fija el valor de usu_ingresa + @param pUsu_ingresa nuevo Valor de usu_ingresa*/ + public void setUsu_ingresa(String pUsu_ingresa){ + usu_ingresa=pUsu_ingresa; + } + + /**Obtiene el valor de usu_modifica + @return valor de usu_modifica*/ + public String getUsu_modifica(){ + return usu_modifica; + } + /**Fija el valor de usu_modifica + @param pUsu_modifica nuevo Valor de usu_modifica*/ + public void setUsu_modifica(String pUsu_modifica){ + usu_modifica=pUsu_modifica; + } + + /**Obtiene el valor de fec_modifica + @return valor de fec_modifica*/ + public Date getFec_modifica(){ + return fec_modifica; + } + /**Fija el valor de fec_modifica + @param pFec_modifica nuevo Valor de fec_modifica*/ + public void setFec_modifica(Date pFec_modifica){ + fec_modifica=pFec_modifica; + } + + /**Obtiene el valor de archivo_orig + @return valor de archivo_orig*/ + public String getArchivo_orig(){ + return archivo_orig; + } + /**Fija el valor de archivo_orig + @param pArchivo_orig nuevo Valor de archivo_orig*/ + public void setArchivo_orig(String pArchivo_orig){ + archivo_orig=pArchivo_orig; + } + + /**Obtiene el valor de observacionlp + @return valor de observacionlp*/ + public String getObservacionlp(){ + return observacionlp; + } + /**Fija el valor de observacionlp + @param pObservacionlp nuevo Valor de observacionlp*/ + public void setObservacionlp(String pObservacionlp){ + observacionlp=pObservacionlp; + } + + /**Obtiene el valor de id_tiplispropias + @return valor de id_tiplispropias*/ + public Long getId_tiplispropias(){ + return id_tiplispropias; + } + /**Fija el valor de id_tiplispropias + @param pId_tiplispropias nuevo Valor de id_tiplispropias*/ + public void setId_tiplispropias(Long pId_tiplispropias){ + id_tiplispropias=pId_tiplispropias; + } + + /**Obtiene el valor de observacion + @return valor de observacion*/ + public String getObservacion(){ + return observacion; + } + /**Fija el valor de observacion + @param pObservacion nuevo Valor de observacion*/ + public void setObservacion(String pObservacion){ + observacion=pObservacion; + } + + public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof OptmListaNegra))return false; + OptmListaNegra that = (OptmListaNegra) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /**Implementacin del metodo hashCode de la la entidad OptmListaNegra + @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /**Implementacin toString + */ + public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } + /**Implementacin de la creacin de un bean en blanco OptmListaNegra + */ + public Object createInstance(){ + OptmListaNegra instance=new OptmListaNegra(); + return instance; + } + /**Clona la entidad OptmListaNegra + @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException{ + OptmListaNegra p=(OptmListaNegra)this.clone(); + return p; + } + + + // Metodos manuales + + /** Sentencia que devuelve una lista de personas dado el nmero de identificacin.*/ + private static final String HQL_LIST_CONSEP_BY_IDENTIFICATION = + "from OptmListaNegra t " + + " where t.identificacion = :identifica " + + " and t.id_tiplisneg in('1','2')"; + + /** + * Metodo que entrega una lista de personas dado un nmero de identificacin. + * @param pEntityManager Sesion de la base de datos + * @param pIdentification Nmero de identificacin + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pIdentification) throws Exception { + List lneg = null; + Query qry = pEntityManager.createQuery(HQL_LIST_CONSEP_BY_IDENTIFICATION); + qry.setParameter("identifica", pIdentification); + lneg = qry.getResultList(); + return lneg; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneAccountInstallCharges.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneAccountInstallCharges.java.svn-base new file mode 100644 index 0000000..0aa5882 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneAccountInstallCharges.java.svn-base @@ -0,0 +1,198 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTINSTALLCHARGES*/ +@Entity(name="TgeneAccountInstallCharges") +@Table(name="TGENEACCOUNTINSTALLCHARGES") +public class TgeneAccountInstallCharges extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountInstallCharges +*/ +@EmbeddedId +private TgeneAccountInstallChargesKey pk; +@Column(name="DATEFROM", nullable=false) + +/** +* Fecha desde la cual esta definido el valor de cargos a asociar a las cuentas en regeneracion de tablas +*/ +private Timestamp datefrom; + +@Column(name="VALUE", nullable=true) + +/** +* Valor del cargo en la moneda de la operacion +*/ +private BigDecimal value; + +/**Contructor por defecto*/ +public TgeneAccountInstallCharges(){ +} +/**Contructor de TgeneAccountInstallCharges +@param pPk Clave Primaria del entity +@param pDatefrom Fecha desde la cual esta definido el valor de cargos a asociar a las cuentas en regeneracion de tablas +*/ +public TgeneAccountInstallCharges(TgeneAccountInstallChargesKey pPk,Timestamp pDatefrom){ + this(); + pk=pPk; + datefrom=pDatefrom; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountInstallCharges +*/ +public static TgeneAccountInstallCharges find(EntityManager pEntityManager,TgeneAccountInstallChargesKey pKey) throws Exception{ + TgeneAccountInstallCharges obj = pEntityManager.find(TgeneAccountInstallCharges.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountInstallCharges +@return El objeto que referencia a la Clave primaria de TgeneAccountInstallCharges +*/ +public TgeneAccountInstallChargesKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountInstallCharges +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountInstallCharges +*/ +public void setPk(TgeneAccountInstallChargesKey pPk){ + pk=pPk; +} +/**Obtiene el valor de datefrom +@return valor de datefrom*/ +public Timestamp getDatefrom(){ + return datefrom; +} +/**Fija el valor de datefrom +@param pDatefrom nuevo Valor de datefrom*/ +public void setDatefrom(Timestamp pDatefrom){ + datefrom=pDatefrom; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountInstallCharges))return false; + TgeneAccountInstallCharges that = (TgeneAccountInstallCharges) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountInstallCharges +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountInstallCharges +*/ +public Object createInstance(){ + TgeneAccountInstallCharges instance=new TgeneAccountInstallCharges(); + instance.setPk(new TgeneAccountInstallChargesKey()); + return instance; +} +/**Clona la entidad TgeneAccountInstallCharges +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountInstallCharges p=(TgeneAccountInstallCharges)this.clone(); + p.setPk((TgeneAccountInstallChargesKey)this.pk.cloneMe()); + return p; +} +public Object getId() { + return this.pk; +} + + //Metodos manuales. + /**Sentencia que devuelve la definicion de cargos a adicionar a la tabla de amortizacion.*/ + private static final String HQL_ACCOUNT_INSTALLMENT_CHARGES = + "from TgeneAccountInstallCharges taccoinstchr " + + " where taccoinstchr.pk.account = :account " + + " and taccoinstchr.pk.company = :company " + + " and taccoinstchr.pk.dateto = :dateto "; + + /** + * Metodo que entrega una lista con los cargos a adicionar a la tabla de amortizacion para una cuenta. + * @param pAccount Numero de cuenta. + * @param pCompany Compania a la que pertenece la cuenta. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager,String pAccount, + Integer pCompany) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_ACCOUNT_INSTALLMENT_CHARGES); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + lObjects = qry.getResultList(); + return lObjects; + } + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneAccountInstallChargesKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneAccountInstallChargesKey.java.svn-base new file mode 100644 index 0000000..a2d2184 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneAccountInstallChargesKey.java.svn-base @@ -0,0 +1,210 @@ +package com.fp.persistence.pgeneral.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTINSTALLCHARGES*/ +@Embeddable +public class TgeneAccountInstallChargesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta definido el valor de cargos a asociar a las cuentas en regeneracion de tablas +*/ +private Timestamp dateto; + +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +/**Contructor por defecto*/ +public TgeneAccountInstallChargesKey(){} +/**Contructor de TgeneAccountInstallChargesKey +@param pAccount Numero de cuenta +@param pDateto Fecha hasta la cual esta definido el valor de cargos a asociar a las cuentas en regeneracion de tablas +@param pBalancetype Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +@param pCompany Codigo de compania a la que pertence la cuenta +*/ +public TgeneAccountInstallChargesKey(String pAccount,Timestamp pDateto,String pBalancetype,String pBalancegroup,Integer pCompany){ + account=pAccount; + dateto=pDateto; + balancetype=pBalancetype; + balancegroup=pBalancegroup; + company=pCompany; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Implementacin de la comparacin de TgeneAccountInstallChargesKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountInstallChargesKey))return false; + TgeneAccountInstallChargesKey that = (TgeneAccountInstallChargesKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountInstallChargesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneAccountInstallRates.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneAccountInstallRates.java.svn-base new file mode 100644 index 0000000..4e05b48 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneAccountInstallRates.java.svn-base @@ -0,0 +1,696 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTINSTALLRATES */ +@Entity(name = "TgeneAccountInstallRates") +@Table(name = "TGENEACCOUNTINSTALLRATES") +public class TgeneAccountInstallRates extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneAccountInstallRates + */ + @EmbeddedId + private TgeneAccountInstallRatesKey pk; + + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta definido el registro de tasas que se aplican en una operacio + */ + private Timestamp datefrom; + + @Column(name = "BASERATECATALOG", nullable = true) + /** + * Codigo de catalogo de tasas base, BCE tasa banco central + */ + private String baseratecatalog; + + @Column(name = "BASERATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo BASERATE + */ + private String baseratecatalogcode; + + @Column(name = "PRINCIPALBALANCETYPE", nullable = true) + /** + * Cdigo de tipo de capital sobre el cual se aplica una tasa y se calcula un valor a provisionar + */ + private String principalbalancetype; + + @Column(name = "PRINCIPALBALANCEGROUP", nullable = true) + /** + * Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor + */ + private String principalbalancegroup; + + @Column(name = "NEGOTIABLE", nullable = true) + /** + * Indica si la tasa se puede negociar con el cliente + */ + private String negotiable; + + @Column(name = "BASERATE", nullable = true) + /** + * Tasa base + */ + private BigDecimal baserate; + + @Column(name = "MARGIN", nullable = true) + /** + * Margen a aplicar dado el operador + */ + private BigDecimal margin; + + @Column(name = "OPERATOR", nullable = true) + /** + * Operador a aplicar sobre la tasa base, +, - , % + */ + private String operator; + + @Column(name = "RATE", nullable = true) + /** + * Tasa total con la cual se calcula provisiones y tabla de pagos + */ + private BigDecimal rate; + + @Column(name = "EFFECTIVERATE", nullable = true) + /** + * Tasa efectiva + */ + private BigDecimal effectiverate; + + @Column(name = "WORKINGDATE", nullable = true) + /** + * Fecha en la que se produjo un cambio + */ + private Date workingdate; + + @Column(name = "REASON", nullable = true) + /** + * Motivo por el que se produjo el cambio: DES (desembolso) , etc + */ + private String reason; + + @Column(name = "READJUSTMENTOPERATOR", nullable = true) + /** + * Operador que se utilizara el momento del reajuste + */ + private String readjustmentoperator; + + @Column(name = "READJUSTMENTMARGIN", nullable = true) + /** + * Margen a aplicar en el reajuste + */ + private BigDecimal readjustmentmargin; + + @Column(name = "CALCULATEDRATE", nullable = true) + /** + * Tasa que se genero al calcular el reajuste. Esta tasa no necesariamente se aplicara, puesto que puede ser mayor que el maximo permitido por la tasa base. + */ + private BigDecimal calculatedrate; + + @Column(name = "ISNOMINALRATE", nullable = true) + /** + * Y, Indica que la defincion de la tasa base es efectiva, en este caso se calcula la tasa nominal, N la tasa base es nominal en este caso se calcula la tasa efectiva. + */ + private String isnominalrate; + + @Column(name = "READJUSTBASERATECATALOG", nullable = true) + /** + * Codigo de catalogo de tasas base de reajuste, BCE tasa banco central + */ + private String readjustbaseratecatalog; + + @Column(name = "READJUSTBASERATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo BASERATE + */ + private String readjustbaseratecatalogcode; + + @Column(name = "MAXBASERATECATALOG", nullable = true) + /** + * Codigo de catalogo de tasas base maxima, BCE tasa banco central + */ + private String maxbaseratecatalog; + + @Column(name = "MAXBASERATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo BASERATE + */ + private String maxbaseratecatalogcode; + + /** Contructor por defecto */ + public TgeneAccountInstallRates() { + } + + /** + * Contructor de TgeneAccountInstallRates + * + * @param pPk Clave Primaria del entity + */ + public TgeneAccountInstallRates(TgeneAccountInstallRatesKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneAccountInstallRates + */ + public static TgeneAccountInstallRates find(EntityManager pEntityManager, TgeneAccountInstallRatesKey pKey) throws Exception { + TgeneAccountInstallRates obj = pEntityManager.find(TgeneAccountInstallRates.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneAccountInstallRates + * + * @return El objeto que referencia a la Clave primaria de TgeneAccountInstallRates + */ + public TgeneAccountInstallRatesKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneAccountInstallRates + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountInstallRates + */ + public void setPk(TgeneAccountInstallRatesKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de baseratecatalog + * + * @return valor de baseratecatalog + */ + public String getBaseratecatalog() { + return this.baseratecatalog; + } + + /** + * Fija el valor de baseratecatalog + * + * @param pBaseratecatalog nuevo Valor de baseratecatalog + */ + public void setBaseratecatalog(String pBaseratecatalog) { + this.baseratecatalog = pBaseratecatalog; + } + + /** + * Obtiene el valor de baseratecatalogcode + * + * @return valor de baseratecatalogcode + */ + public String getBaseratecatalogcode() { + return this.baseratecatalogcode; + } + + /** + * Fija el valor de baseratecatalogcode + * + * @param pBaseratecatalogcode nuevo Valor de baseratecatalogcode + */ + public void setBaseratecatalogcode(String pBaseratecatalogcode) { + this.baseratecatalogcode = pBaseratecatalogcode; + } + + /** + * Obtiene el valor de principalbalancetype + * + * @return valor de principalbalancetype + */ + public String getPrincipalbalancetype() { + return this.principalbalancetype; + } + + /** + * Fija el valor de principalbalancetype + * + * @param pPrincipalbalancetype nuevo Valor de principalbalancetype + */ + public void setPrincipalbalancetype(String pPrincipalbalancetype) { + this.principalbalancetype = pPrincipalbalancetype; + } + + /** + * Obtiene el valor de principalbalancegroup + * + * @return valor de principalbalancegroup + */ + public String getPrincipalbalancegroup() { + return this.principalbalancegroup; + } + + /** + * Fija el valor de principalbalancegroup + * + * @param pPrincipalbalancegroup nuevo Valor de principalbalancegroup + */ + public void setPrincipalbalancegroup(String pPrincipalbalancegroup) { + this.principalbalancegroup = pPrincipalbalancegroup; + } + + /** + * Obtiene el valor de negotiable + * + * @return valor de negotiable + */ + public String getNegotiable() { + return this.negotiable; + } + + /** + * Fija el valor de negotiable + * + * @param pNegotiable nuevo Valor de negotiable + */ + public void setNegotiable(String pNegotiable) { + this.negotiable = pNegotiable; + } + + /** + * Obtiene el valor de baserate + * + * @return valor de baserate + */ + public BigDecimal getBaserate() { + return this.baserate; + } + + /** + * Fija el valor de baserate + * + * @param pBaserate nuevo Valor de baserate + */ + public void setBaserate(BigDecimal pBaserate) { + this.baserate = pBaserate; + } + + /** + * Obtiene el valor de margin + * + * @return valor de margin + */ + public BigDecimal getMargin() { + return this.margin; + } + + /** + * Fija el valor de margin + * + * @param pMargin nuevo Valor de margin + */ + public void setMargin(BigDecimal pMargin) { + this.margin = pMargin; + } + + /** + * Obtiene el valor de operator + * + * @return valor de operator + */ + public String getOperator() { + return this.operator; + } + + /** + * Fija el valor de operator + * + * @param pOperator nuevo Valor de operator + */ + public void setOperator(String pOperator) { + this.operator = pOperator; + } + + /** + * Obtiene el valor de rate + * + * @return valor de rate + */ + public BigDecimal getRate() { + return this.rate; + } + + /** + * Fija el valor de rate + * + * @param pRate nuevo Valor de rate + */ + public void setRate(BigDecimal pRate) { + this.rate = pRate; + } + + /** + * Obtiene el valor de effectiverate + * + * @return valor de effectiverate + */ + public BigDecimal getEffectiverate() { + return this.effectiverate; + } + + /** + * Fija el valor de effectiverate + * + * @param pEffectiverate nuevo Valor de effectiverate + */ + public void setEffectiverate(BigDecimal pEffectiverate) { + this.effectiverate = pEffectiverate; + } + + /** + * Obtiene el valor de workingdate + * + * @return valor de workingdate + */ + public Date getWorkingdate() { + return this.workingdate; + } + + /** + * Fija el valor de workingdate + * + * @param pWorkingdate nuevo Valor de workingdate + */ + public void setWorkingdate(Date pWorkingdate) { + this.workingdate = pWorkingdate; + } + + /** + * Obtiene el valor de reason + * + * @return valor de reason + */ + public String getReason() { + return this.reason; + } + + /** + * Fija el valor de reason + * + * @param pReason nuevo Valor de reason + */ + public void setReason(String pReason) { + this.reason = pReason; + } + + /** + * Obtiene el valor de readjustmentoperator + * + * @return valor de readjustmentoperator + */ + public String getReadjustmentoperator() { + return this.readjustmentoperator; + } + + /** + * Fija el valor de readjustmentoperator + * + * @param pReadjustmentoperator nuevo Valor de readjustmentoperator + */ + public void setReadjustmentoperator(String pReadjustmentoperator) { + this.readjustmentoperator = pReadjustmentoperator; + } + + /** + * Obtiene el valor de readjustmentmargin + * + * @return valor de readjustmentmargin + */ + public BigDecimal getReadjustmentmargin() { + return this.readjustmentmargin; + } + + /** + * Fija el valor de readjustmentmargin + * + * @param pReadjustmentmargin nuevo Valor de readjustmentmargin + */ + public void setReadjustmentmargin(BigDecimal pReadjustmentmargin) { + this.readjustmentmargin = pReadjustmentmargin; + } + + /** + * Obtiene el valor de calculatedrate + * + * @return valor de calculatedrate + */ + public BigDecimal getCalculatedrate() { + return this.calculatedrate; + } + + /** + * Fija el valor de calculatedrate + * + * @param pCalculatedrate nuevo Valor de calculatedrate + */ + public void setCalculatedrate(BigDecimal pCalculatedrate) { + this.calculatedrate = pCalculatedrate; + } + + /** + * Obtiene el valor de isnominalrate + * + * @return valor de isnominalrate + */ + public String getIsnominalrate() { + return this.isnominalrate; + } + + /** + * Fija el valor de isnominalrate + * + * @param pIsnominalrate nuevo Valor de isnominalrate + */ + public void setIsnominalrate(String pIsnominalrate) { + this.isnominalrate = pIsnominalrate; + } + + /** + * Obtiene el valor de readjustbaseratecatalog + * + * @return valor de readjustbaseratecatalog + */ + public String getReadjustbaseratecatalog() { + return this.readjustbaseratecatalog; + } + + /** + * Fija el valor de readjustbaseratecatalog + * + * @param pReadjustbaseratecatalog nuevo Valor de readjustbaseratecatalog + */ + public void setReadjustbaseratecatalog(String pReadjustbaseratecatalog) { + this.readjustbaseratecatalog = pReadjustbaseratecatalog; + } + + /** + * Obtiene el valor de readjustbaseratecatalogcode + * + * @return valor de readjustbaseratecatalogcode + */ + public String getReadjustbaseratecatalogcode() { + return this.readjustbaseratecatalogcode; + } + + /** + * Fija el valor de readjustbaseratecatalogcode + * + * @param pReadjustbaseratecatalogcode nuevo Valor de readjustbaseratecatalogcode + */ + public void setReadjustbaseratecatalogcode(String pReadjustbaseratecatalogcode) { + this.readjustbaseratecatalogcode = pReadjustbaseratecatalogcode; + } + + /** + * Obtiene el valor de maxbaseratecatalog + * + * @return valor de maxbaseratecatalog + */ + public String getMaxbaseratecatalog() { + return this.maxbaseratecatalog; + } + + /** + * Fija el valor de maxbaseratecatalog + * + * @param pMaxbaseratecatalog nuevo Valor de maxbaseratecatalog + */ + public void setMaxbaseratecatalog(String pMaxbaseratecatalog) { + this.maxbaseratecatalog = pMaxbaseratecatalog; + } + + /** + * Obtiene el valor de maxbaseratecatalogcode + * + * @return valor de maxbaseratecatalogcode + */ + public String getMaxbaseratecatalogcode() { + return this.maxbaseratecatalogcode; + } + + /** + * Fija el valor de maxbaseratecatalogcode + * + * @param pMaxbaseratecatalogcode nuevo Valor de maxbaseratecatalogcode + */ + public void setMaxbaseratecatalogcode(String pMaxbaseratecatalogcode) { + this.maxbaseratecatalogcode = pMaxbaseratecatalogcode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneAccountInstallRates)) { + return false; + } + TgeneAccountInstallRates that = (TgeneAccountInstallRates) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneAccountInstallRates + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneAccountInstallRates */ + @Override + public Object createInstance() { + TgeneAccountInstallRates instance = new TgeneAccountInstallRates(); + instance.setPk(new TgeneAccountInstallRatesKey()); + return instance; + } + + /** + * Clona la entidad TgeneAccountInstallRates + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneAccountInstallRates p = (TgeneAccountInstallRates) this.clone(); + p.setPk((TgeneAccountInstallRatesKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + + // Metodos manuales. + + /** Sentencia que devuelve la definicion de valores a provisionar asociados de una cuenta. */ + private static final String HQL_ACCOUNT_RATES = "from TgeneAccountInstallRates taccoinstrate " + " where taccoinstrate.pk.account = :account " + + " and taccoinstrate.pk.company = :company " + " and taccoinstrate.pk.dateto = :dateto "; + + /** + * Metodo que entrega una lista con los tipos de saldos a calcular tabla de amortizacion para una cuenta. + * + * @param pAccount Numero de cuenta. + * @param pCompany Compania a la que pertenece la cuenta. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pAccount, Integer pCompany) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_ACCOUNT_RATES); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + qry.setParameter("dateto", com.fp.common.helper.Constant.getDefaultExpiryDate()); + lObjects = qry.getResultList(); + return lObjects; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneAccountInstallRatesKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneAccountInstallRatesKey.java.svn-base new file mode 100644 index 0000000..dcd1ad9 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneAccountInstallRatesKey.java.svn-base @@ -0,0 +1,210 @@ +package com.fp.persistence.pgeneral.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTINSTALLRATES*/ +@Embeddable +public class TgeneAccountInstallRatesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta definido el registro de tasas que se aplican en una operacion +*/ +private Timestamp dateto; + +@Column(name="INTERESTBALANCETYPE", nullable=false,updatable=false) + +/** +* Codigo de tipo de saldo que provisiona en la tabla de cuotas. +*/ +private String interestbalancetype; + +@Column(name="INTERESTBALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String interestbalancegroup; + +/**Contructor por defecto*/ +public TgeneAccountInstallRatesKey(){} +/**Contructor de TgeneAccountInstallRatesKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pDateto Fecha hasta la cual esta definido el registro de tasas que se aplican en una operacion +@param pInterestbalancetype Codigo de tipo de saldo que provisiona en la tabla de cuotas. +@param pInterestbalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +public TgeneAccountInstallRatesKey(String pAccount,Integer pCompany,Timestamp pDateto,String pInterestbalancetype,String pInterestbalancegroup){ + account=pAccount; + company=pCompany; + dateto=pDateto; + interestbalancetype=pInterestbalancetype; + interestbalancegroup=pInterestbalancegroup; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de interestbalancetype +@return valor de interestbalancetype*/ +public String getInterestbalancetype(){ + return interestbalancetype; +} +/**Fija el valor de interestbalancetype +@param pInterestbalancetype nuevo Valor de interestbalancetype*/ +public void setInterestbalancetype(String pInterestbalancetype){ + interestbalancetype=pInterestbalancetype; +} + +/**Obtiene el valor de interestbalancegroup +@return valor de interestbalancegroup*/ +public String getInterestbalancegroup(){ + return interestbalancegroup; +} +/**Fija el valor de interestbalancegroup +@param pInterestbalancegroup nuevo Valor de interestbalancegroup*/ +public void setInterestbalancegroup(String pInterestbalancegroup){ + interestbalancegroup=pInterestbalancegroup; +} + +/**Implementacion de la comparacion de TgeneAccountInstallRatesKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountInstallRatesKey))return false; + TgeneAccountInstallRatesKey that = (TgeneAccountInstallRatesKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getInterestbalancetype() == null || that.getInterestbalancetype() == null){ + return false; + } + if (! this.getInterestbalancetype().equals(that.getInterestbalancetype())){ + return false; + } + if (this.getInterestbalancegroup() == null || that.getInterestbalancegroup() == null){ + return false; + } + if (! this.getInterestbalancegroup().equals(that.getInterestbalancegroup())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneAccountInstallRatesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getInterestbalancetype() == null ? 0 : this.getInterestbalancetype().hashCode()); + result = result * 37 + (this.getInterestbalancegroup() == null ? 0 : this.getInterestbalancegroup().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneAccountRelationship.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneAccountRelationship.java.svn-base new file mode 100644 index 0000000..ca39072 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneAccountRelationship.java.svn-base @@ -0,0 +1,378 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTRELATIONSHIP*/ +@Entity(name = "TgeneAccountRelationship") +@Table(name = "TGENEACCOUNTRELATIONSHIP") +public class TgeneAccountRelationship extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneAccountRelationship + */ + @EmbeddedId + private TgeneAccountRelationshipKey pk; + @Column(name = "MODULECODE", nullable = true) + /** + * Codigo de modulo + */ + private String modulecode; + @Column(name = "RELATIONSHIPCODE", nullable = true) + /** + * Codigo de relacion de la cuenta con el cliente + */ + private String relationshipcode; + @Column(name = "ISPRINCIPAL", nullable = true) + /** + * Indica si el codigo de relacion es principal, en este caso el codigo de cliente se asocia a la tabla tgeneaccount + */ + private String isprincipal; + @Column(name = "PRIORITY", nullable = true) + /** + * Prioridad del cliente en la cuenta. + */ + private Integer priority; + @Column(name = "CONDITION", nullable = true) + /** + * Condicion del cliente con la cuenta + */ + private String condition; + @Column(name = "PARTICIPATION", nullable = true) + /** + * Porcentaje de participacion del cliente con la solicitud. + */ + private BigDecimal participation; + @Column(name = "PERSONTYPE", nullable = true) + /** + * 1 Persona natural, 2 Persona Juridica. + */ + private String persontype; + + /**Contructor por defecto*/ + public TgeneAccountRelationship() { + } + + /**Contructor de TgeneAccountRelationship + @param pPk Clave Primaria del entity + */ + public TgeneAccountRelationship(TgeneAccountRelationshipKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneAccountRelationship + */ + public static TgeneAccountRelationship find(EntityManager pEntityManager, TgeneAccountRelationshipKey pKey) throws Exception { + TgeneAccountRelationship obj = pEntityManager.find(TgeneAccountRelationship.class, pKey); + return obj; + } + + /**Entrega la Clave primaria de TgeneAccountRelationship + @return El objeto que referencia a la Clave primaria de TgeneAccountRelationship + */ + public TgeneAccountRelationshipKey getPk() { + return this.pk; + } + + /**Fija un nuevo valor a la Clave primaria de TgeneAccountRelationship + @param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountRelationship + */ + public void setPk(TgeneAccountRelationshipKey pPk) { + this.pk = pPk; + } + + /**Obtiene el valor de modulecode + @return valor de modulecode*/ + public String getModulecode() { + return this.modulecode; + } + + /**Fija el valor de modulecode + @param pModulecode nuevo Valor de modulecode*/ + public void setModulecode(String pModulecode) { + this.modulecode = pModulecode; + } + + /**Obtiene el valor de relationshipcode + @return valor de relationshipcode*/ + public String getRelationshipcode() { + return this.relationshipcode; + } + + /**Fija el valor de relationshipcode + @param pRelationshipcode nuevo Valor de relationshipcode*/ + public void setRelationshipcode(String pRelationshipcode) { + this.relationshipcode = pRelationshipcode; + } + + /**Obtiene el valor de isprincipal + @return valor de isprincipal*/ + public String getIsprincipal() { + return this.isprincipal; + } + + /**Fija el valor de isprincipal + @param pIsprincipal nuevo Valor de isprincipal*/ + public void setIsprincipal(String pIsprincipal) { + this.isprincipal = pIsprincipal; + } + + /**Obtiene el valor de priority + @return valor de priority*/ + public Integer getPriority() { + return this.priority; + } + + /**Fija el valor de priority + @param pPriority nuevo Valor de priority*/ + public void setPriority(Integer pPriority) { + this.priority = pPriority; + } + + /**Obtiene el valor de condition + @return valor de condition*/ + public String getCondition() { + return this.condition; + } + + /**Fija el valor de condition + @param pCondition nuevo Valor de condition*/ + public void setCondition(String pCondition) { + this.condition = pCondition; + } + + /**Obtiene el valor de participation + @return valor de participation*/ + public BigDecimal getParticipation() { + return this.participation; + } + + /**Fija el valor de participation + @param pParticipation nuevo Valor de participation*/ + public void setParticipation(BigDecimal pParticipation) { + this.participation = pParticipation; + } + + /**Obtiene el valor de persontype + @return valor de persontype*/ + public String getPersontype() { + return this.persontype; + } + + /**Fija el valor de persontype + @param pPersontype nuevo Valor de persontype*/ + public void setPersontype(String pPersontype) { + this.persontype = pPersontype; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneAccountRelationship)) { + return false; + } + TgeneAccountRelationship that = (TgeneAccountRelationship) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /**Implementaci�n del metodo hashCode de la la entidad TgeneAccountRelationship + @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /**Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /**Implementaci�n de la creaci�n de un bean en blanco TgeneAccountRelationship + */ + @Override + public Object createInstance() { + TgeneAccountRelationship instance = new TgeneAccountRelationship(); + instance.setPk(new TgeneAccountRelationshipKey()); + return instance; + } + + /**Clona la entidad TgeneAccountRelationship + @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneAccountRelationship p = (TgeneAccountRelationship) this.clone(); + p.setPk((TgeneAccountRelationshipKey) this.pk.cloneMe()); + return p; + } + //METODOS MANUALES + /** Sentencia que devuelve las productos de un cliente. */ + private static final String JPQL_ACC_RELATIONSHIP = "from TgeneAccountRelationship solrel " + + " where solrel.modulecode = :modulecode " + " and solrel.pk.personcode = :personcode "; + /** Sentencia que devuelve las productos de un cliente dado el companycode. */ + private static final String JPQL_ACC_RELATIONSHIP_COMPANY = "from TgeneAccountRelationship solrel " + + " where solrel.modulecode = :modulecode " + " and solrel.pk.personcode = :personcode " + " and solrel.pk.company = :companycode "; + + /** + * Entrega los cuentas de un cliente dado el módulo + * + * @param pModulecode Codigo del modulo. + * @param pPersoncode Codigo del cliente. + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findbyclient(EntityManager pEntityManager, String pModulecode, Integer pPersoncode) { + List lAccounts = null; + Query qry = pEntityManager.createQuery(TgeneAccountRelationship.JPQL_ACC_RELATIONSHIP); + qry.setParameter("modulecode", pModulecode); + qry.setParameter("personcode", pPersoncode); + lAccounts = qry.getResultList(); + return lAccounts; + } + + /** + * Entrega los cuentas de un cliente dado el módulo + * + * @param pModulecode Codigo del modulo. + * @param pPersoncode Codigo del cliente. + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findbyCompany(EntityManager pEntityManager, String pModulecode, Integer pPersoncode, Integer pCompanycode) { + List lAccounts = null; + Query qry = pEntityManager.createQuery(TgeneAccountRelationship.JPQL_ACC_RELATIONSHIP_COMPANY); + qry.setParameter("modulecode", pModulecode); + qry.setParameter("personcode", pPersoncode); + qry.setParameter("companycode", pCompanycode); + lAccounts = qry.getResultList(); + return lAccounts; + } + + /** Sentencia que devuelve las productos de un cliente. */ + private static final String JPQL_ACC_CLIENTS = "from TgeneAccountRelationship accrel " + + " where accrel.pk.account = :account " + " and accrel.pk.company = :company "; + /** + * Entrega los clientes asociados a una cuenta + * + * @param paccount Cuenta. + * @param pcompany compania de la cuenta + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findbyAccount(EntityManager pEntityManager,String pAccount, Integer pCompany) { + List lAccounts = null; + Query qry = pEntityManager.createQuery(TgeneAccountRelationship.JPQL_ACC_CLIENTS); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + lAccounts = qry.getResultList(); + return lAccounts; + } + + /** Sentencia que devuelve las productos de un cliente. */ + private static final String JPQL_ACC_RELATIONSHIP_PRINCIPAL = " from TgeneAccountRelationship rel " + + "where rel.modulecode = :strCrFacilityProduct and rel.pk.personcode = :pPersoncode " + + "and rel.isprincipal = :clientype and rel.pk.company = :pcompany and rel.pk.account in " + + "( select cfdet.pk.account from TcreditFacilityDetail cfdet where cfdet.pk.modulecode = :pModulecode " + + "and cfdet.pk.productcode = :productcode and cfdet.pk.subproductcode = :subproductcode " + + "and cfdet.pk.company = :pcompany and cfdet.pk.currencycode = :currencycode)"; + + /** + * Findbyclient. + * + * @param pEntityManager the entity manager + * @param pcompany the pcompany + * @param pModulecode the modulecode + * @param productcode the productcode + * @param subproductcode the subproductcode + * @param currencycode the currencycode + * @param pPersoncode the personcode + * @param pisprincipal the pisprincipal + * @return the list + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findbyclient(EntityManager pEntityManager, Integer pcompany, String pModulecode, String productcode, + String subproductcode, String currencycode, Integer pPersoncode, boolean pisprincipal) { + List lAccounts = null; + + String strCrFacilityProduct = "16"; + String strclienttype = !pisprincipal ? "N" : "Y"; + + Query qry = pEntityManager.createQuery(TgeneAccountRelationship.JPQL_ACC_RELATIONSHIP_PRINCIPAL); + qry.setParameter("pcompany", pcompany); + qry.setParameter("pModulecode", pModulecode); + qry.setParameter("productcode", productcode); + qry.setParameter("subproductcode", subproductcode); + qry.setParameter("currencycode", currencycode); + qry.setParameter("pPersoncode", pPersoncode); + qry.setParameter("strCrFacilityProduct", strCrFacilityProduct); + qry.setParameter("clientype", strclienttype); + + lAccounts = qry.getResultList(); + return lAccounts; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneAccountRelationshipKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneAccountRelationshipKey.java.svn-base new file mode 100644 index 0000000..0d1afe2 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneAccountRelationshipKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTRELATIONSHIP*/ +@Embeddable +public class TgeneAccountRelationshipKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +/**Contructor por defecto*/ +public TgeneAccountRelationshipKey(){} +/**Contructor de TgeneAccountRelationshipKey +@param pAccount Numero de cuenta +@param pPersoncode Codigo de persona +@param pCompany Codigo de compania a la que pertence la cuenta +*/ +public TgeneAccountRelationshipKey(String pAccount,Integer pPersoncode,Integer pCompany){ + account=pAccount; + personcode=pPersoncode; + company=pCompany; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Implementacin de la comparacin de TgeneAccountRelationshipKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountRelationshipKey))return false; + TgeneAccountRelationshipKey that = (TgeneAccountRelationshipKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountRelationshipKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneArea.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneArea.java.svn-base new file mode 100644 index 0000000..c0b85e4 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneArea.java.svn-base @@ -0,0 +1,159 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEAREA*/ +@Entity(name="TgeneArea") +@Table(name="TGENEAREA") +public class TgeneArea extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneArea +*/ +@EmbeddedId +private TgeneAreaKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPCTION", nullable=true) + +/** +* Nombre del area +*/ +private String descripction; + +/**Contructor por defecto*/ +public TgeneArea(){ +} +/**Contructor de TgeneArea +@param pPk Clave Primaria del entity +*/ +public TgeneArea(TgeneAreaKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneArea +*/ +public static TgeneArea find(EntityManager pEntityManager,TgeneAreaKey pKey) throws Exception{ + TgeneArea obj = pEntityManager.find(TgeneArea.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneArea +@return El objeto que referencia a la Clave primaria de TgeneArea +*/ +public TgeneAreaKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneArea +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneArea +*/ +public void setPk(TgeneAreaKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de descripction +@return valor de descripction*/ +public String getDescripction(){ + return descripction; +} +/**Fija el valor de descripction +@param pDescripction nuevo Valor de descripction*/ +public void setDescripction(String pDescripction){ + descripction=pDescripction; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneArea))return false; + TgeneArea that = (TgeneArea) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneArea +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneArea +*/ +public Object createInstance(){ + TgeneArea instance=new TgeneArea(); + instance.setPk(new TgeneAreaKey()); + return instance; +} +/**Clona la entidad TgeneArea +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneArea p=(TgeneArea)this.clone(); + p.setPk((TgeneAreaKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneAreaKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneAreaKey.java.svn-base new file mode 100644 index 0000000..d2e3688 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneAreaKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEAREA*/ +@Embeddable +public class TgeneAreaKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertenece el departamento +*/ +private Integer companycode; + +@Column(name="AREACODE", nullable=false,updatable=false) + +/** +* Codigo de area +*/ +private Integer areacode; + +/**Contructor por defecto*/ +public TgeneAreaKey(){} +/**Contructor de TgeneAreaKey +@param pCompanycode Codigo de compania a la que pertenece el departamento +@param pAreacode Codigo de area +*/ +public TgeneAreaKey(Integer pCompanycode,Integer pAreacode){ + companycode=pCompanycode; + areacode=pAreacode; +} +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de areacode +@return valor de areacode*/ +public Integer getAreacode(){ + return areacode; +} +/**Fija el valor de areacode +@param pAreacode nuevo Valor de areacode*/ +public void setAreacode(Integer pAreacode){ + areacode=pAreacode; +} + +/**Implementacin de la comparacin de TgeneAreaKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAreaKey))return false; + TgeneAreaKey that = (TgeneAreaKey) o; + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getAreacode() == null || that.getAreacode() == null){ + return false; + } + if (! this.getAreacode().equals(that.getAreacode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAreaKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getAreacode() == null ? 0 : this.getAreacode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneBalanceGroup.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneBalanceGroup.java.svn-base new file mode 100644 index 0000000..bdc3fb3 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneBalanceGroup.java.svn-base @@ -0,0 +1,200 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEBALANCEGROUP*/ +@Entity(name="TgeneBalanceGroup") +@Table(name="TGENEBALANCEGROUP") +public class TgeneBalanceGroup extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneBalanceGroup +*/ +@Id +@Column(name="BALANCEGROUP" ,nullable=false, updatable=false) +private String pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="ISADD", nullable=false) + +/** +* Indica que lado de la transaccion relaliza la suma, ejemplo en activos suma D, pasivos suma C +*/ +private String isadd; + +@Column(name="DESCRIPTION", nullable=false) + +/** +* Descripcion del grupo de balance +*/ +private String description; + +@Column(name="OPPOSITE", nullable=true) + +/** +* Codigo de grupo de balance que se afecta por el contrario ejl Balancegroup 61, opposite 62 +*/ +private String opposite; + +/**Contructor por defecto*/ +public TgeneBalanceGroup(){ +} +/**Contructor de TgeneBalanceGroup +@param pPk Clave Primaria del entity +@param pIsadd Indica que lado de la transaccion relaliza la suma, ejemplo en activos suma D, pasivos suma C +@param pDescription Descripcion del grupo de balance +*/ +public TgeneBalanceGroup(String pPk,String pIsadd,String pDescription){ + this(); + pk=pPk; + isadd=pIsadd; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneBalanceGroup +*/ +public static TgeneBalanceGroup find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneBalanceGroup obj = pEntityManager.find(TgeneBalanceGroup.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneBalanceGroup +@return El objeto que referencia a la Clave primaria de TgeneBalanceGroup +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneBalanceGroup +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneBalanceGroup +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de isadd +@return valor de isadd*/ +public String getIsadd(){ + return isadd; +} +/**Fija el valor de isadd +@param pIsadd nuevo Valor de isadd*/ +public void setIsadd(String pIsadd){ + isadd=pIsadd; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de opposite +@return valor de opposite*/ +public String getOpposite(){ + return opposite; +} +/**Fija el valor de opposite +@param pOpposite nuevo Valor de opposite*/ +public void setOpposite(String pOpposite){ + opposite=pOpposite; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneBalanceGroup))return false; + TgeneBalanceGroup that = (TgeneBalanceGroup) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneBalanceGroup +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneBalanceGroup +*/ +public Object createInstance(){ + TgeneBalanceGroup instance=new TgeneBalanceGroup(); + return instance; +} +/**Clona la entidad TgeneBalanceGroup +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneBalanceGroup p=(TgeneBalanceGroup)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneBalanceType.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneBalanceType.java.svn-base new file mode 100644 index 0000000..631106f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneBalanceType.java.svn-base @@ -0,0 +1,197 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEBALANCETYPE*/ +@Entity(name="TgeneBalanceType") +@Table(name="TGENEBALANCETYPE") +public class TgeneBalanceType extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneBalanceType +*/ +@EmbeddedId +private TgeneBalanceTypeKey pk; +@Column(name="DESCRIPTION", nullable=false) + +/** +* Descripcin del tipo de saldo +*/ +private String description; + +@Column(name="BALANCECATEGORY", nullable=true) + +/** +* Categoria del tipo de saldo, Interes, Capita; Seguros, Cargos, Impuestos etc, +*/ +private String balancecategory; + +@Column(name="MODULECODE", nullable=true) + +/** +* Codigo de modulo al que pertenece el tipo de saldo. +*/ +private String modulecode; + +@Column(name="CHARGEFORINSTALLMENT", nullable=true) + +/** +* Y indica que el cargo sirve para incluir en tablas de amortizacion, N el cargo no va a tablas de amortizacion. +*/ +private String chargeforinstallment; + +/**Contructor por defecto*/ +public TgeneBalanceType(){ +} +/**Contructor de TgeneBalanceType +@param pPk Clave Primaria del entity +@param pDescription Descripcin del tipo de saldo +*/ +public TgeneBalanceType(TgeneBalanceTypeKey pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneBalanceType +*/ +public static TgeneBalanceType find(EntityManager pEntityManager,TgeneBalanceTypeKey pKey) throws Exception{ + TgeneBalanceType obj = pEntityManager.find(TgeneBalanceType.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneBalanceType +@return El objeto que referencia a la Clave primaria de TgeneBalanceType +*/ +public TgeneBalanceTypeKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneBalanceType +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneBalanceType +*/ +public void setPk(TgeneBalanceTypeKey pPk){ + pk=pPk; +} +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de balancecategory +@return valor de balancecategory*/ +public String getBalancecategory(){ + return balancecategory; +} +/**Fija el valor de balancecategory +@param pBalancecategory nuevo Valor de balancecategory*/ +public void setBalancecategory(String pBalancecategory){ + balancecategory=pBalancecategory; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de chargeforinstallment +@return valor de chargeforinstallment*/ +public String getChargeforinstallment(){ + return chargeforinstallment; +} +/**Fija el valor de chargeforinstallment +@param pChargeforinstallment nuevo Valor de chargeforinstallment*/ +public void setChargeforinstallment(String pChargeforinstallment){ + chargeforinstallment=pChargeforinstallment; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneBalanceType))return false; + TgeneBalanceType that = (TgeneBalanceType) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneBalanceType +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneBalanceType +*/ +public Object createInstance(){ + TgeneBalanceType instance=new TgeneBalanceType(); + instance.setPk(new TgeneBalanceTypeKey()); + return instance; +} +/**Clona la entidad TgeneBalanceType +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneBalanceType p=(TgeneBalanceType)this.clone(); + p.setPk((TgeneBalanceTypeKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneBalanceTypeDetail.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneBalanceTypeDetail.java.svn-base new file mode 100644 index 0000000..3174975 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneBalanceTypeDetail.java.svn-base @@ -0,0 +1,269 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEBALANCETYPEDETAIL*/ +@Entity(name="TgeneBalanceTypeDetail") +@Table(name="TGENEBALANCETYPEDETAIL") +public class TgeneBalanceTypeDetail extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneBalanceTypeDetail +*/ +@EmbeddedId +private TgeneBalanceTypeDetailKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de bloqueo optimista del registro +*/ +private Integer recordversion; + +@Column(name="COMMANDBALANCE", nullable=true) + +/** +* Clase que se encarga de la actualizacin de saldos +*/ +private String commandbalance; + +@Column(name="FIELDNAME", nullable=true) + +/** +* Campo que actualiza la actualiza en el commandbalance asociado al tipo de saldo, Ejemplo cash, Locked +*/ +private String fieldname; + +@Column(name="ACCOUNTINGCODE", nullable=true) + +/** +* Codigo contable asociado al tipo de saldo grupo de balance, Ejemplo 2101PPMMEE01 o 51040101 +*/ +private String accountingcode; + +@Column(name="MANAGECACHE", nullable=true) + +/** +* Indica si el registro se almacena en cache del servidor de aplicaciones. +*/ +private String managecache; + +@Column(name="ISPROVISON", nullable=true) + +/** +* Indica que en valor del tipo de saldo es resultado del calculo de provisiones +*/ +private String isprovison; + +@Column(name="CALCULATEPROVISION", nullable=true) + +/** +* Indica si se calcula accruales sobre el saldo asociado al tipo de saldo +*/ +private String calculateprovision; + +@Column(name="BRANCHAMONG", nullable=true) + +/** +* null +*/ +private String branchamong; + +/**Contructor por defecto*/ +public TgeneBalanceTypeDetail(){ +} +/**Contructor de TgeneBalanceTypeDetail +@param pPk Clave Primaria del entity +*/ +public TgeneBalanceTypeDetail(TgeneBalanceTypeDetailKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneBalanceTypeDetail +*/ +public static TgeneBalanceTypeDetail find(EntityManager pEntityManager,TgeneBalanceTypeDetailKey pKey) throws Exception{ + TgeneBalanceTypeDetail obj = pEntityManager.find(TgeneBalanceTypeDetail.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneBalanceTypeDetail +@return El objeto que referencia a la Clave primaria de TgeneBalanceTypeDetail +*/ +public TgeneBalanceTypeDetailKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneBalanceTypeDetail +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneBalanceTypeDetail +*/ +public void setPk(TgeneBalanceTypeDetailKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de commandbalance +@return valor de commandbalance*/ +public String getCommandbalance(){ + return commandbalance; +} +/**Fija el valor de commandbalance +@param pCommandbalance nuevo Valor de commandbalance*/ +public void setCommandbalance(String pCommandbalance){ + commandbalance=pCommandbalance; +} + +/**Obtiene el valor de fieldname +@return valor de fieldname*/ +public String getFieldname(){ + return fieldname; +} +/**Fija el valor de fieldname +@param pFieldname nuevo Valor de fieldname*/ +public void setFieldname(String pFieldname){ + fieldname=pFieldname; +} + +/**Obtiene el valor de accountingcode +@return valor de accountingcode*/ +public String getAccountingcode(){ + return accountingcode; +} +/**Fija el valor de accountingcode +@param pAccountingcode nuevo Valor de accountingcode*/ +public void setAccountingcode(String pAccountingcode){ + accountingcode=pAccountingcode; +} + +/**Obtiene el valor de managecache +@return valor de managecache*/ +public String getManagecache(){ + return managecache; +} +/**Fija el valor de managecache +@param pManagecache nuevo Valor de managecache*/ +public void setManagecache(String pManagecache){ + managecache=pManagecache; +} + +/**Obtiene el valor de isprovison +@return valor de isprovison*/ +public String getIsprovison(){ + return isprovison; +} +/**Fija el valor de isprovison +@param pIsprovison nuevo Valor de isprovison*/ +public void setIsprovison(String pIsprovison){ + isprovison=pIsprovison; +} + +/**Obtiene el valor de calculateprovision +@return valor de calculateprovision*/ +public String getCalculateprovision(){ + return calculateprovision; +} +/**Fija el valor de calculateprovision +@param pCalculateprovision nuevo Valor de calculateprovision*/ +public void setCalculateprovision(String pCalculateprovision){ + calculateprovision=pCalculateprovision; +} + +/**Obtiene el valor de branchamong +@return valor de branchamong*/ +public String getBranchamong(){ + return branchamong; +} +/**Fija el valor de branchamong +@param pBranchamong nuevo Valor de branchamong*/ +public void setBranchamong(String pBranchamong){ + branchamong=pBranchamong; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneBalanceTypeDetail))return false; + TgeneBalanceTypeDetail that = (TgeneBalanceTypeDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneBalanceTypeDetail +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneBalanceTypeDetail +*/ +public Object createInstance(){ + TgeneBalanceTypeDetail instance=new TgeneBalanceTypeDetail(); + instance.setPk(new TgeneBalanceTypeDetailKey()); + return instance; +} +/**Clona la entidad TgeneBalanceTypeDetail +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneBalanceTypeDetail p=(TgeneBalanceTypeDetail)this.clone(); + p.setPk((TgeneBalanceTypeDetailKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneBalanceTypeDetailKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneBalanceTypeDetailKey.java.svn-base new file mode 100644 index 0000000..2a487e1 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneBalanceTypeDetailKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEBALANCETYPEDETAIL*/ +@Embeddable +public class TgeneBalanceTypeDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +/**Contructor por defecto*/ +public TgeneBalanceTypeDetailKey(){} +/**Contructor de TgeneBalanceTypeDetailKey +@param pBalancetype Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +public TgeneBalanceTypeDetailKey(String pBalancetype,String pBalancegroup){ + balancetype=pBalancetype; + balancegroup=pBalancegroup; +} +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Implementacin de la comparacin de TgeneBalanceTypeDetailKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneBalanceTypeDetailKey))return false; + TgeneBalanceTypeDetailKey that = (TgeneBalanceTypeDetailKey) o; + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneBalanceTypeDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneBalanceTypeKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneBalanceTypeKey.java.svn-base new file mode 100644 index 0000000..157434a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneBalanceTypeKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEBALANCETYPE*/ +@Embeddable +public class TgeneBalanceTypeKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +/**Contructor por defecto*/ +public TgeneBalanceTypeKey(){} +/**Contructor de TgeneBalanceTypeKey +@param pBalancetype Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +public TgeneBalanceTypeKey(String pBalancetype,String pBalancegroup){ + balancetype=pBalancetype; + balancegroup=pBalancegroup; +} +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Implementacin de la comparacin de TgeneBalanceTypeKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneBalanceTypeKey))return false; + TgeneBalanceTypeKey that = (TgeneBalanceTypeKey) o; + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneBalanceTypeKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneBranch.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneBranch.java.svn-base new file mode 100644 index 0000000..825b6bd --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneBranch.java.svn-base @@ -0,0 +1,238 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; +import com.fp.general.exception.GeneralException; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENEBRANCH + */ +@Entity(name = "TgeneBranch") +@Table(name = "TGENEBRANCH") +public class TgeneBranch extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneBranch + */ + @EmbeddedId + private TgeneBranchKey pk; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "DESCRIPTION", nullable = true) + /** + * Nombre de la sucursal + */ + private String description; + + /** Contructor por defecto */ + public TgeneBranch() { + } + + /** + * Contructor de TgeneBranch + * + * @param pPk + * Clave Primaria del entity + */ + public TgeneBranch(TgeneBranchKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager + * referencia de la session a obtener datos del bean. + * @param pKey + * Caleve primaria del bean. + * @return TgeneBranch + */ + public static TgeneBranch find(EntityManager pEntityManager, + TgeneBranchKey pKey) throws Exception { + TgeneBranch obj = pEntityManager.find(TgeneBranch.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneBranch + * + * @return El objeto que referencia a la Clave primaria de TgeneBranch + */ + public TgeneBranchKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneBranch + * + * @param pPk + * El objeto que referencia a la nueva Clave primaria de + * TgeneBranch + */ + public void setPk(TgeneBranchKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion + * nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription + * nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneBranch)) + return false; + TgeneBranch that = (TgeneBranch) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneBranch + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 + || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneBranch */ + public Object createInstance() { + TgeneBranch instance = new TgeneBranch(); + instance.setPk(new TgeneBranchKey()); + return instance; + } + + /** + * Clona la entidad TgeneBranch + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneBranch p = (TgeneBranch) this.clone(); + p.setPk((TgeneBranchKey) this.pk.cloneMe()); + return p; + } + + //Metodos manuales. + /** Sentencia que devuelve un registro de TgeneBranch.*/ + private static final String JPQL_BRANCH = + "from TgeneBranch tb " + + " where tb.pk.branchcode = :branch " + + " and tb.pk.companycode = :company "; + + /** + * Metodo que entrega datos de una sucursal definidos en TgeneBranch. + * @param pBranch Codigo de sucursal. + * @param pCompany Compania a la que pertenece la cuenta. + * @return TgeneBranch + * @throws Exception + */ + public static TgeneBranch find(EntityManager pEntityManager ,Integer pBranch, Integer pCompany) throws Exception { + Query qry = pEntityManager.createQuery(JPQL_BRANCH); + qry.setParameter("branch", pBranch); + qry.setParameter("company", pCompany); + try { + return (TgeneBranch) qry.getSingleResult(); + } catch (NoResultException e) { + throw new GeneralException("GENE-0001", "SUCURSAL NO DEFINIDA EN TGENEBRANCH: BRANCH:{0} COMPANY:{1}", + pBranch, pCompany); + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneBranchKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneBranchKey.java.svn-base new file mode 100644 index 0000000..0a31e06 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneBranchKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEBRANCH*/ +@Embeddable +public class TgeneBranchKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="BRANCHCODE", nullable=false,updatable=false) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania al que pertenece la sucursal +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TgeneBranchKey(){} +/**Contructor de TgeneBranchKey +@param pBranchcode Codigo de sucursal +@param pCompanycode Codigo de compania al que pertenece la sucursal +*/ +public TgeneBranchKey(Integer pBranchcode,Integer pCompanycode){ + branchcode=pBranchcode; + companycode=pCompanycode; +} +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacin de la comparacin de TgeneBranchKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneBranchKey))return false; + TgeneBranchKey that = (TgeneBranchKey) o; + if (this.getBranchcode() == null || that.getBranchcode() == null){ + return false; + } + if (! this.getBranchcode().equals(that.getBranchcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneBranchKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getBranchcode() == null ? 0 : this.getBranchcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCanton.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCanton.java.svn-base new file mode 100644 index 0000000..1e935db --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCanton.java.svn-base @@ -0,0 +1,159 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECANTON*/ +@Entity(name="TgeneCanton") +@Table(name="TGENECANTON") +public class TgeneCanton extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCanton +*/ +@EmbeddedId +private TgeneCantonKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion default del canton. +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneCanton(){ +} +/**Contructor de TgeneCanton +@param pPk Clave Primaria del entity +*/ +public TgeneCanton(TgeneCantonKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCanton +*/ +public static TgeneCanton find(EntityManager pEntityManager,TgeneCantonKey pKey) throws Exception{ + TgeneCanton obj = pEntityManager.find(TgeneCanton.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCanton +@return El objeto que referencia a la Clave primaria de TgeneCanton +*/ +public TgeneCantonKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCanton +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCanton +*/ +public void setPk(TgeneCantonKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCanton))return false; + TgeneCanton that = (TgeneCanton) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneCanton +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneCanton +*/ +public Object createInstance(){ + TgeneCanton instance=new TgeneCanton(); + instance.setPk(new TgeneCantonKey()); + return instance; +} +/**Clona la entidad TgeneCanton +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCanton p=(TgeneCanton)this.clone(); + p.setPk((TgeneCantonKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCantonKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCantonKey.java.svn-base new file mode 100644 index 0000000..c56cc6d --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCantonKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENECANTON*/ +@Embeddable +public class TgeneCantonKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COUNTRYCODE", nullable=false,updatable=false) + +/** +* Codigo de pais +*/ +private String countrycode; + +@Column(name="PROVINCECODE", nullable=false,updatable=false) + +/** +* Codigo de provincia +*/ +private String provincecode; + +@Column(name="CANTONCODE", nullable=false,updatable=false) + +/** +* Codigo de canton +*/ +private String cantoncode; + +/**Contructor por defecto*/ +public TgeneCantonKey(){} +/**Contructor de TgeneCantonKey +@param pCountrycode Codigo de pais +@param pProvincecode Codigo de provincia +@param pCantoncode Codigo de canton +*/ +public TgeneCantonKey(String pCountrycode,String pProvincecode,String pCantoncode){ + countrycode=pCountrycode; + provincecode=pProvincecode; + cantoncode=pCantoncode; +} +/**Obtiene el valor de countrycode +@return valor de countrycode*/ +public String getCountrycode(){ + return countrycode; +} +/**Fija el valor de countrycode +@param pCountrycode nuevo Valor de countrycode*/ +public void setCountrycode(String pCountrycode){ + countrycode=pCountrycode; +} + +/**Obtiene el valor de provincecode +@return valor de provincecode*/ +public String getProvincecode(){ + return provincecode; +} +/**Fija el valor de provincecode +@param pProvincecode nuevo Valor de provincecode*/ +public void setProvincecode(String pProvincecode){ + provincecode=pProvincecode; +} + +/**Obtiene el valor de cantoncode +@return valor de cantoncode*/ +public String getCantoncode(){ + return cantoncode; +} +/**Fija el valor de cantoncode +@param pCantoncode nuevo Valor de cantoncode*/ +public void setCantoncode(String pCantoncode){ + cantoncode=pCantoncode; +} + +/**Implementacin de la comparacin de TgeneCantonKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneCantonKey))return false; + TgeneCantonKey that = (TgeneCantonKey) o; + if (this.getCountrycode() == null || that.getCountrycode() == null){ + return false; + } + if (! this.getCountrycode().equals(that.getCountrycode())){ + return false; + } + if (this.getProvincecode() == null || that.getProvincecode() == null){ + return false; + } + if (! this.getProvincecode().equals(that.getProvincecode())){ + return false; + } + if (this.getCantoncode() == null || that.getCantoncode() == null){ + return false; + } + if (! this.getCantoncode().equals(that.getCantoncode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneCantonKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCountrycode() == null ? 0 : this.getCountrycode().hashCode()); + result = result * 37 + (this.getProvincecode() == null ? 0 : this.getProvincecode().hashCode()); + result = result * 37 + (this.getCantoncode() == null ? 0 : this.getCantoncode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCashClose.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCashClose.java.svn-base new file mode 100644 index 0000000..1d47c7b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCashClose.java.svn-base @@ -0,0 +1,122 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECASHCLOSE*/ +@Entity(name="TgeneCashClose") +@Table(name="TGENECASHCLOSE") +public class TgeneCashClose extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCashClose +*/ +@EmbeddedId +private TgeneCashCloseKey pk; +/**Contructor por defecto*/ +public TgeneCashClose(){ +} +/**Contructor de TgeneCashClose +@param pPk Clave Primaria del entity +*/ +public TgeneCashClose(TgeneCashCloseKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCashClose +*/ +public static TgeneCashClose find(EntityManager pEntityManager,TgeneCashCloseKey pKey) throws Exception{ + TgeneCashClose obj = pEntityManager.find(TgeneCashClose.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCashClose +@return El objeto que referencia a la Clave primaria de TgeneCashClose +*/ +public TgeneCashCloseKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCashClose +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCashClose +*/ +public void setPk(TgeneCashCloseKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCashClose))return false; + TgeneCashClose that = (TgeneCashClose) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneCashClose +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneCashClose +*/ +public Object createInstance(){ + TgeneCashClose instance=new TgeneCashClose(); + instance.setPk(new TgeneCashCloseKey()); + return instance; +} +/**Clona la entidad TgeneCashClose +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCashClose p=(TgeneCashClose)this.clone(); + p.setPk((TgeneCashCloseKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCashCloseDetail.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCashCloseDetail.java.svn-base new file mode 100644 index 0000000..3e67032 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCashCloseDetail.java.svn-base @@ -0,0 +1,159 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECASHCLOSEDETAIL*/ +@Entity(name="TgeneCashCloseDetail") +@Table(name="TGENECASHCLOSEDETAIL") +public class TgeneCashCloseDetail extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCashCloseDetail +*/ +@EmbeddedId +private TgeneCashCloseDetailKey pk; +@Column(name="QUANTITY", nullable=true) + +/** +* Numero de billetes o monedas por denominacion +*/ +private Integer quantity; + +@Column(name="TOTAL", nullable=true) + +/** +* Total de la denominacion +*/ +private BigDecimal total; + +/**Contructor por defecto*/ +public TgeneCashCloseDetail(){ +} +/**Contructor de TgeneCashCloseDetail +@param pPk Clave Primaria del entity +*/ +public TgeneCashCloseDetail(TgeneCashCloseDetailKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCashCloseDetail +*/ +public static TgeneCashCloseDetail find(EntityManager pEntityManager,TgeneCashCloseDetailKey pKey) throws Exception{ + TgeneCashCloseDetail obj = pEntityManager.find(TgeneCashCloseDetail.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCashCloseDetail +@return El objeto que referencia a la Clave primaria de TgeneCashCloseDetail +*/ +public TgeneCashCloseDetailKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCashCloseDetail +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCashCloseDetail +*/ +public void setPk(TgeneCashCloseDetailKey pPk){ + pk=pPk; +} +/**Obtiene el valor de quantity +@return valor de quantity*/ +public Integer getQuantity(){ + return quantity; +} +/**Fija el valor de quantity +@param pQuantity nuevo Valor de quantity*/ +public void setQuantity(Integer pQuantity){ + quantity=pQuantity; +} + +/**Obtiene el valor de total +@return valor de total*/ +public BigDecimal getTotal(){ + return total; +} +/**Fija el valor de total +@param pTotal nuevo Valor de total*/ +public void setTotal(BigDecimal pTotal){ + total=pTotal; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCashCloseDetail))return false; + TgeneCashCloseDetail that = (TgeneCashCloseDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneCashCloseDetail +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneCashCloseDetail +*/ +public Object createInstance(){ + TgeneCashCloseDetail instance=new TgeneCashCloseDetail(); + instance.setPk(new TgeneCashCloseDetailKey()); + return instance; +} +/**Clona la entidad TgeneCashCloseDetail +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCashCloseDetail p=(TgeneCashCloseDetail)this.clone(); + p.setPk((TgeneCashCloseDetailKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCashCloseDetailKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCashCloseDetailKey.java.svn-base new file mode 100644 index 0000000..6f3d8df --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCashCloseDetailKey.java.svn-base @@ -0,0 +1,315 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENECASHCLOSEDETAIL*/ +@Embeddable +public class TgeneCashCloseDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="WORKINGDATE", nullable=false,updatable=false) + +/** +* Fecha de trabajo en la cual se origina la transferencia +*/ +private Date workingdate; + +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario que origina la transferencia +*/ +private String usercode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="OFFICECODE", nullable=false,updatable=false) + +/** +* Codigo de oficina +*/ +private Integer officecode; + +@Column(name="BRANCHCODE", nullable=false,updatable=false) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania al que pertenece la oficina +*/ +private Integer companycode; + +@Column(name="CATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String catalog; + +@Column(name="CATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String catalogcode; + +@Column(name="DENOMINATIONVALUE", nullable=false,updatable=false) + +/** +* Valor de la denominacion, ejemplo billetes de 100, 50, 20,10 etc +*/ +private BigDecimal denominationvalue; + +/**Contructor por defecto*/ +public TgeneCashCloseDetailKey(){} +/**Contructor de TgeneCashCloseDetailKey +@param pWorkingdate Fecha de trabajo en la cual se origina la transferencia +@param pUsercode Codigo de usuario que origina la transferencia +@param pCurrencycode Codigo de moneda +@param pOfficecode Codigo de oficina +@param pBranchcode Codigo de sucursal +@param pCompanycode Codigo de compania al que pertenece la oficina +@param pCatalog Codigo de catalogo 01 Natural, 02 Juridico +@param pCatalogcode Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +@param pDenominationvalue Valor de la denominacion, ejemplo billetes de 100, 50, 20,10 etc +*/ +public TgeneCashCloseDetailKey(Date pWorkingdate,String pUsercode,String pCurrencycode,Integer pOfficecode,Integer pBranchcode,Integer pCompanycode,String pCatalog,String pCatalogcode,BigDecimal pDenominationvalue){ + workingdate=pWorkingdate; + usercode=pUsercode; + currencycode=pCurrencycode; + officecode=pOfficecode; + branchcode=pBranchcode; + companycode=pCompanycode; + catalog=pCatalog; + catalogcode=pCatalogcode; + denominationvalue=pDenominationvalue; +} +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de catalog +@return valor de catalog*/ +public String getCatalog(){ + return catalog; +} +/**Fija el valor de catalog +@param pCatalog nuevo Valor de catalog*/ +public void setCatalog(String pCatalog){ + catalog=pCatalog; +} + +/**Obtiene el valor de catalogcode +@return valor de catalogcode*/ +public String getCatalogcode(){ + return catalogcode; +} +/**Fija el valor de catalogcode +@param pCatalogcode nuevo Valor de catalogcode*/ +public void setCatalogcode(String pCatalogcode){ + catalogcode=pCatalogcode; +} + +/**Obtiene el valor de denominationvalue +@return valor de denominationvalue*/ +public BigDecimal getDenominationvalue(){ + return denominationvalue; +} +/**Fija el valor de denominationvalue +@param pDenominationvalue nuevo Valor de denominationvalue*/ +public void setDenominationvalue(BigDecimal pDenominationvalue){ + denominationvalue=pDenominationvalue; +} + +/**Implementacin de la comparacin de TgeneCashCloseDetailKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneCashCloseDetailKey))return false; + TgeneCashCloseDetailKey that = (TgeneCashCloseDetailKey) o; + if (this.getWorkingdate() == null || that.getWorkingdate() == null){ + return false; + } + if (! this.getWorkingdate().equals(that.getWorkingdate())){ + return false; + } + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getOfficecode() == null || that.getOfficecode() == null){ + return false; + } + if (! this.getOfficecode().equals(that.getOfficecode())){ + return false; + } + if (this.getBranchcode() == null || that.getBranchcode() == null){ + return false; + } + if (! this.getBranchcode().equals(that.getBranchcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getCatalog() == null || that.getCatalog() == null){ + return false; + } + if (! this.getCatalog().equals(that.getCatalog())){ + return false; + } + if (this.getCatalogcode() == null || that.getCatalogcode() == null){ + return false; + } + if (! this.getCatalogcode().equals(that.getCatalogcode())){ + return false; + } + if (this.getDenominationvalue() == null || that.getDenominationvalue() == null){ + return false; + } + if (! this.getDenominationvalue().equals(that.getDenominationvalue())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneCashCloseDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getWorkingdate() == null ? 0 : this.getWorkingdate().hashCode()); + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getOfficecode() == null ? 0 : this.getOfficecode().hashCode()); + result = result * 37 + (this.getBranchcode() == null ? 0 : this.getBranchcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getCatalog() == null ? 0 : this.getCatalog().hashCode()); + result = result * 37 + (this.getCatalogcode() == null ? 0 : this.getCatalogcode().hashCode()); + result = result * 37 + (this.getDenominationvalue() == null ? 0 : this.getDenominationvalue().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCashCloseHeader.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCashCloseHeader.java.svn-base new file mode 100644 index 0000000..2f8eb6a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCashCloseHeader.java.svn-base @@ -0,0 +1,365 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECASHCLOSEHEADER */ +@Entity(name = "TgeneCashCloseHeader") +@Table(name = "TGENECASHCLOSEHEADER") +public class TgeneCashCloseHeader extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneCashCloseHeader + */ + @EmbeddedId + private TgeneCashCloseHeaderKey pk; + + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + + @Column(name = "STATUSCATALOG", nullable = true) + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String statuscatalog; + + @Column(name = "STATUSCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String statuscatalogcode; + + @Column(name = "TOTAL", nullable = true) + /** + * Monto total del cierre de caja por moneda + */ + private BigDecimal total; + + @Column(name = "JOURNALID", nullable = true) + /** + * Numero de mensaje con el que se genera el financiero. + */ + private String journalid; + + /** Contructor por defecto */ + public TgeneCashCloseHeader() { + } + + /** + * Contructor de TgeneCashCloseHeader + * + * @param pPk Clave Primaria del entity + */ + public TgeneCashCloseHeader(TgeneCashCloseHeaderKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneCashCloseHeader + */ + public static TgeneCashCloseHeader find(EntityManager pEntityManager, TgeneCashCloseHeaderKey pKey) throws Exception { + TgeneCashCloseHeader obj = pEntityManager.find(TgeneCashCloseHeader.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneCashCloseHeader + * + * @return El objeto que referencia a la Clave primaria de TgeneCashCloseHeader + */ + public TgeneCashCloseHeaderKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneCashCloseHeader + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneCashCloseHeader + */ + public void setPk(TgeneCashCloseHeaderKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de statuscatalog + * + * @return valor de statuscatalog + */ + public String getStatuscatalog() { + return this.statuscatalog; + } + + /** + * Fija el valor de statuscatalog + * + * @param pStatuscatalog nuevo Valor de statuscatalog + */ + public void setStatuscatalog(String pStatuscatalog) { + this.statuscatalog = pStatuscatalog; + } + + /** + * Obtiene el valor de statuscatalogcode + * + * @return valor de statuscatalogcode + */ + public String getStatuscatalogcode() { + return this.statuscatalogcode; + } + + /** + * Fija el valor de statuscatalogcode + * + * @param pStatuscatalogcode nuevo Valor de statuscatalogcode + */ + public void setStatuscatalogcode(String pStatuscatalogcode) { + this.statuscatalogcode = pStatuscatalogcode; + } + + /** + * Obtiene el valor de total + * + * @return valor de total + */ + public BigDecimal getTotal() { + return this.total; + } + + /** + * Fija el valor de total + * + * @param pTotal nuevo Valor de total + */ + public void setTotal(BigDecimal pTotal) { + this.total = pTotal; + } + + /** + * Obtiene el valor de journalid + * + * @return valor de journalid + */ + public String getJournalid() { + return this.journalid; + } + + /** + * Fija el valor de journalid + * + * @param pJournalid nuevo Valor de journalid + */ + public void setJournalid(String pJournalid) { + this.journalid = pJournalid; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneCashCloseHeader)) { + return false; + } + TgeneCashCloseHeader that = (TgeneCashCloseHeader) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneCashCloseHeader + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneCashCloseHeader */ + @Override + public Object createInstance() { + TgeneCashCloseHeader instance = new TgeneCashCloseHeader(); + instance.setPk(new TgeneCashCloseHeaderKey()); + return instance; + } + + /** + * Clona la entidad TgeneCashCloseHeader + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneCashCloseHeader p = (TgeneCashCloseHeader) this.clone(); + p.setPk((TgeneCashCloseHeaderKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + + // METODOS MANUALES + /** Sentencia que entrega la los datos de TgeneCashCloseHeader */ + private static final String JPQL_CASH_CLOSE_HEADER = " from TgeneCashCloseHeader cch" + " where cch.pk.workingdate = :workingdate" + + " and cch.pk.usercode = :usercode" + " and cch.pk.currencycode = :currencycode" + " and cch.pk.officecode = :officecode" + + " and cch.pk.branchcode = :branchcode" + " and cch.pk.companycode = :companycode" + " and cch.pk.dateto = :dateto"; + + /** + * Metodo que entrega los datos de TgeneCashCloseHeader + * + * @param pEntityManager Session de la base de datos. + * @param workingdate Fecha de trabajo + * @param usercode Codigo de usuario + * @param currencycode Codigo de moneda + * @param companycode Codigo de compania + * @param branchcode Codigo de sucursal + * @param officecode Codigo de oficina + * @return + * @throws Exception + */ + public static TgeneCashCloseHeader find(EntityManager pEntityManager, Date workingdate, String usercode, String currencycode, + Integer companycode, Integer branchcode, Integer officecode) throws Exception { + Query qry = pEntityManager.createQuery(TgeneCashCloseHeader.JPQL_CASH_CLOSE_HEADER); + qry.setParameter(Constant.VWORKINGDATE, workingdate); + qry.setParameter("usercode", usercode); + qry.setParameter("currencycode", currencycode); + qry.setParameter("officecode", officecode); + qry.setParameter("branchcode", branchcode); + qry.setParameter("companycode", companycode); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + try { + return (TgeneCashCloseHeader) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + + /** + * Sentencia que entrega la los datos de TgeneCashCloseHeader + */ + private static final String JPQL_CASH_CLOSE_HEADER_WITH_STATUS = " from TgeneCashCloseHeader cch" + " where cch.pk.workingdate = :workingdate" + + " and cch.pk.usercode = :usercode" + " and cch.pk.currencycode = :currencycode" + " and cch.pk.officecode = :officecode" + + " and cch.pk.branchcode = :branchcode" + " and cch.pk.companycode = :companycode" + " and cch.pk.dateto = :dateto" + + " and cch.statuscatalog = :statuscatalog"; + + /** + * Metodo que entrega los datos de TgeneCashCloseHeader, dada la fecha de trabajo, usuario y secuencia. + * + * @param pEntityManager Session de la base de datos. + * @param workingdate Fecha de trabajo + * @param usercode Codigo de usuario + * @param workingdate + * @param currencycode + * @param companycode + * @param branchcode + * @param officecode + * @return + * @throws Exception + */ + public static TgeneCashCloseHeader find(EntityManager pEntityManager, String usercode, String statuscatalog, Date workingdate, + String currencycode, Integer companycode, Integer branchcode, Integer officecode) throws Exception { + Query qry = pEntityManager.createQuery(TgeneCashCloseHeader.JPQL_CASH_CLOSE_HEADER_WITH_STATUS); + qry.setParameter(Constant.VWORKINGDATE, workingdate); + qry.setParameter("usercode", usercode); + qry.setParameter("currencycode", currencycode); + qry.setParameter("officecode", officecode); + qry.setParameter("branchcode", branchcode); + qry.setParameter("companycode", companycode); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + qry.setParameter("statuscatalog", statuscatalog); + try { + return (TgeneCashCloseHeader) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCashCloseHeaderKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCashCloseHeaderKey.java.svn-base new file mode 100644 index 0000000..16d2027 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCashCloseHeaderKey.java.svn-base @@ -0,0 +1,265 @@ +package com.fp.persistence.pgeneral.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENECASHCLOSEHEADER*/ +@Embeddable +public class TgeneCashCloseHeaderKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="WORKINGDATE", nullable=false,updatable=false) + +/** +* Fecha de trabajo en la cual se origina la transferencia +*/ +private Date workingdate; + +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario que origina la transferencia +*/ +private String usercode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="OFFICECODE", nullable=false,updatable=false) + +/** +* Codigo de oficina +*/ +private Integer officecode; + +@Column(name="BRANCHCODE", nullable=false,updatable=false) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania al que pertenece la oficina +*/ +private Integer companycode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro. +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TgeneCashCloseHeaderKey(){} +/**Contructor de TgeneCashCloseHeaderKey +@param pWorkingdate Fecha de trabajo en la cual se origina la transferencia +@param pUsercode Codigo de usuario que origina la transferencia +@param pCurrencycode Codigo de moneda +@param pOfficecode Codigo de oficina +@param pBranchcode Codigo de sucursal +@param pCompanycode Codigo de compania al que pertenece la oficina +@param pDateto Fecha hasta la cual esta vigente el registro. +*/ +public TgeneCashCloseHeaderKey(Date pWorkingdate,String pUsercode,String pCurrencycode,Integer pOfficecode,Integer pBranchcode,Integer pCompanycode,Timestamp pDateto){ + workingdate=pWorkingdate; + usercode=pUsercode; + currencycode=pCurrencycode; + officecode=pOfficecode; + branchcode=pBranchcode; + companycode=pCompanycode; + dateto=pDateto; +} +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TgeneCashCloseHeaderKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneCashCloseHeaderKey))return false; + TgeneCashCloseHeaderKey that = (TgeneCashCloseHeaderKey) o; + if (this.getWorkingdate() == null || that.getWorkingdate() == null){ + return false; + } + if (! this.getWorkingdate().equals(that.getWorkingdate())){ + return false; + } + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getOfficecode() == null || that.getOfficecode() == null){ + return false; + } + if (! this.getOfficecode().equals(that.getOfficecode())){ + return false; + } + if (this.getBranchcode() == null || that.getBranchcode() == null){ + return false; + } + if (! this.getBranchcode().equals(that.getBranchcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneCashCloseHeaderKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getWorkingdate() == null ? 0 : this.getWorkingdate().hashCode()); + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getOfficecode() == null ? 0 : this.getOfficecode().hashCode()); + result = result * 37 + (this.getBranchcode() == null ? 0 : this.getBranchcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCashCloseKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCashCloseKey.java.svn-base new file mode 100644 index 0000000..746b851 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCashCloseKey.java.svn-base @@ -0,0 +1,233 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENECASHCLOSE*/ +@Embeddable +public class TgeneCashCloseKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="WORKINGDATE", nullable=false,updatable=false) + +/** +* Fecha de trabajo en la cual se origina la transferencia +*/ +private Date workingdate; + +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario que origina la transferencia +*/ +private String usercode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="OFFICECODE", nullable=false,updatable=false) + +/** +* Codigo de oficina +*/ +private Integer officecode; + +@Column(name="BRANCHCODE", nullable=false,updatable=false) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania al que pertenece la oficina +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TgeneCashCloseKey(){} +/**Contructor de TgeneCashCloseKey +@param pWorkingdate Fecha de trabajo en la cual se origina la transferencia +@param pUsercode Codigo de usuario que origina la transferencia +@param pCurrencycode Codigo de moneda +@param pOfficecode Codigo de oficina +@param pBranchcode Codigo de sucursal +@param pCompanycode Codigo de compania al que pertenece la oficina +*/ +public TgeneCashCloseKey(Date pWorkingdate,String pUsercode,String pCurrencycode,Integer pOfficecode,Integer pBranchcode,Integer pCompanycode){ + workingdate=pWorkingdate; + usercode=pUsercode; + currencycode=pCurrencycode; + officecode=pOfficecode; + branchcode=pBranchcode; + companycode=pCompanycode; +} +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacin de la comparacin de TgeneCashCloseKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneCashCloseKey))return false; + TgeneCashCloseKey that = (TgeneCashCloseKey) o; + if (this.getWorkingdate() == null || that.getWorkingdate() == null){ + return false; + } + if (! this.getWorkingdate().equals(that.getWorkingdate())){ + return false; + } + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getOfficecode() == null || that.getOfficecode() == null){ + return false; + } + if (! this.getOfficecode().equals(that.getOfficecode())){ + return false; + } + if (this.getBranchcode() == null || that.getBranchcode() == null){ + return false; + } + if (! this.getBranchcode().equals(that.getBranchcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneCashCloseKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getWorkingdate() == null ? 0 : this.getWorkingdate().hashCode()); + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getOfficecode() == null ? 0 : this.getOfficecode().hashCode()); + result = result * 37 + (this.getBranchcode() == null ? 0 : this.getBranchcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCatalog.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCatalog.java.svn-base new file mode 100644 index 0000000..85b646c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCatalog.java.svn-base @@ -0,0 +1,160 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECATALOG*/ +@Entity(name="TgeneCatalog") +@Table(name="TGENECATALOG") +public class TgeneCatalog extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCatalog +*/ +@Id +@Column(name="CATALOGCODE" ,nullable=false, updatable=false) +private String pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=false) + +/** +* Nombre de la tabla de catalogo +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneCatalog(){ +} +/**Contructor de TgeneCatalog +@param pPk Clave Primaria del entity +@param pDescription Nombre de la tabla de catalogo +*/ +public TgeneCatalog(String pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCatalog +*/ +public static TgeneCatalog find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneCatalog obj = pEntityManager.find(TgeneCatalog.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCatalog +@return El objeto que referencia a la Clave primaria de TgeneCatalog +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCatalog +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCatalog +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCatalog))return false; + TgeneCatalog that = (TgeneCatalog) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneCatalog +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneCatalog +*/ +public Object createInstance(){ + TgeneCatalog instance=new TgeneCatalog(); + return instance; +} +/**Clona la entidad TgeneCatalog +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCatalog p=(TgeneCatalog)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCatalogDetail.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCatalogDetail.java.svn-base new file mode 100644 index 0000000..fea3d66 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCatalogDetail.java.svn-base @@ -0,0 +1,259 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECATALOGDETAIL */ +@Entity(name = "TgeneCatalogDetail") +@Table(name = "TGENECATALOGDETAIL") +public class TgeneCatalogDetail extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Cache { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneCatalogDetail + */ + @EmbeddedId + private TgeneCatalogDetailKey pk; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "DESCRIPTION", nullable = false) + /** + * Descripcion del catalogo + */ + private String description; + + @Column(name = "LEGALCODE", nullable = true) + /** + * Codigo del organismo de control + */ + private String legalcode; + + /** Contructor por defecto */ + public TgeneCatalogDetail() { + } + + /** + * Contructor de TgeneCatalogDetail + * + * @param pPk Clave Primaria del entity + * @param pDescription Descripcion del catalogo + */ + public TgeneCatalogDetail(TgeneCatalogDetailKey pPk, String pDescription) { + this(); + pk = pPk; + description = pDescription; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneCatalogDetail + */ + public static TgeneCatalogDetail find(EntityManager pEntityManager, TgeneCatalogDetailKey pKey) throws Exception { + TgeneCatalogDetail obj = pEntityManager.find(TgeneCatalogDetail.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneCatalogDetail + * + * @return El objeto que referencia a la Clave primaria de TgeneCatalogDetail + */ + public TgeneCatalogDetailKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneCatalogDetail + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneCatalogDetail + */ + public void setPk(TgeneCatalogDetailKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + /** + * Obtiene el valor de legalcode + * + * @return valor de legalcode + */ + public String getLegalcode() { + return legalcode; + } + + /** + * Fija el valor de legalcode + * + * @param pLegalcode nuevo Valor de legalcode + */ + public void setLegalcode(String pLegalcode) { + legalcode = pLegalcode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneCatalogDetail)) { + return false; + } + TgeneCatalogDetail that = (TgeneCatalogDetail) rhs; + if (getPk() == null || that.getPk() == null) { + return false; + } + return getPk().equals(that.getPk()); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneCatalogDetail + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (hashValue == 0) { + int result = 17; + if (getPk() == null) { + result = super.hashCode(); + } else { + result = getPk().hashCode(); + } + hashValue = result; + } + return hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneCatalogDetail */ + @Override + public Object createInstance() { + TgeneCatalogDetail instance = new TgeneCatalogDetail(); + instance.setPk(new TgeneCatalogDetailKey()); + return instance; + } + + /** + * Clona la entidad TgeneCatalogDetail + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneCatalogDetail p = (TgeneCatalogDetail) clone(); + p.setPk((TgeneCatalogDetailKey) pk.cloneMe()); + return p; + } + + /* Mtodos manuales */ + + /** Sentencia para seleccionar una lista de catalogos */ + private static final String JPQL_CATALOG_LIST = " from TgeneCatalogDetail t " + " where t.pk.catalogcode = :catalogcode "; + + /** + * Mtodo que selecciona una lista de catalogos dado el cdigo del catalogo + * + * @param entityManager + * @param pCatalogcode Cdigo del catalogo + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager entityManager, String pCatalogcode) throws Exception { + Query qry = entityManager.createQuery(JPQL_CATALOG_LIST); + qry.setParameter("catalogcode", pCatalogcode); + + return qry.getResultList(); + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCatalogDetailKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCatalogDetailKey.java.svn-base new file mode 100644 index 0000000..8b6dc82 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCatalogDetailKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENECATALOGDETAIL*/ +@Embeddable +public class TgeneCatalogDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String catalog; + +@Column(name="CATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String catalogcode; + +/**Contructor por defecto*/ +public TgeneCatalogDetailKey(){} +/**Contructor de TgeneCatalogDetailKey +@param pCatalog Codigo de catalogo 01 Natural, 02 Juridico +@param pCatalogcode Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +public TgeneCatalogDetailKey(String pCatalog,String pCatalogcode){ + catalog=pCatalog; + catalogcode=pCatalogcode; +} +/**Obtiene el valor de catalog +@return valor de catalog*/ +public String getCatalog(){ + return catalog; +} +/**Fija el valor de catalog +@param pCatalog nuevo Valor de catalog*/ +public void setCatalog(String pCatalog){ + catalog=pCatalog; +} + +/**Obtiene el valor de catalogcode +@return valor de catalogcode*/ +public String getCatalogcode(){ + return catalogcode; +} +/**Fija el valor de catalogcode +@param pCatalogcode nuevo Valor de catalogcode*/ +public void setCatalogcode(String pCatalogcode){ + catalogcode=pCatalogcode; +} + +/**Implementacin de la comparacin de TgeneCatalogDetailKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneCatalogDetailKey))return false; + TgeneCatalogDetailKey that = (TgeneCatalogDetailKey) o; + if (this.getCatalog() == null || that.getCatalog() == null){ + return false; + } + if (! this.getCatalog().equals(that.getCatalog())){ + return false; + } + if (this.getCatalogcode() == null || that.getCatalogcode() == null){ + return false; + } + if (! this.getCatalogcode().equals(that.getCatalogcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneCatalogDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCatalog() == null ? 0 : this.getCatalog().hashCode()); + result = result * 37 + (this.getCatalogcode() == null ? 0 : this.getCatalogcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCatalogDetailTest.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCatalogDetailTest.java.svn-base new file mode 100644 index 0000000..411b414 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCatalogDetailTest.java.svn-base @@ -0,0 +1,198 @@ +package com.fp.persistence.pgeneral.gene; + +import com.fp.dto.hb.Cache; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECATALOGDETAILTEST*/ +@Entity(name="TgeneCatalogDetailTest") +@Table(name="TGENECATALOGDETAILTEST") +public class TgeneCatalogDetailTest extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCatalogDetailTest +*/ +@EmbeddedId +private TgeneCatalogDetailTestKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=false) + +/** +* Descripcion del catalogo +*/ +private String description; + +@Column(name="LEGALCODE", nullable=true) + +/** +* Codigo del organismo de control +*/ +private String legalcode; + +@Column(name="IDALFRESCO", nullable=true) + +/** +* null +*/ +private String idalfresco; + +/**Contructor por defecto*/ +public TgeneCatalogDetailTest(){ +} +/**Contructor de TgeneCatalogDetailTest +@param pPk Clave Primaria del entity +@param pDescription Descripcion del catalogo +*/ +public TgeneCatalogDetailTest(TgeneCatalogDetailTestKey pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCatalogDetailTest +*/ +public static TgeneCatalogDetailTest find(EntityManager pEntityManager,TgeneCatalogDetailTestKey pKey) throws Exception{ + TgeneCatalogDetailTest obj = pEntityManager.find(TgeneCatalogDetailTest.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCatalogDetailTest +@return El objeto que referencia a la Clave primaria de TgeneCatalogDetailTest +*/ +public TgeneCatalogDetailTestKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCatalogDetailTest +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCatalogDetailTest +*/ +public void setPk(TgeneCatalogDetailTestKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de legalcode +@return valor de legalcode*/ +public String getLegalcode(){ + return legalcode; +} +/**Fija el valor de legalcode +@param pLegalcode nuevo Valor de legalcode*/ +public void setLegalcode(String pLegalcode){ + legalcode=pLegalcode; +} + +/**Obtiene el valor de idalfresco +@return valor de idalfresco*/ +public String getIdalfresco(){ + return idalfresco; +} +/**Fija el valor de idalfresco +@param pIdalfresco nuevo Valor de idalfresco*/ +public void setIdalfresco(String pIdalfresco){ + idalfresco=pIdalfresco; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCatalogDetailTest))return false; + TgeneCatalogDetailTest that = (TgeneCatalogDetailTest) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneCatalogDetailTest +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneCatalogDetailTest +*/ +public Object createInstance(){ + TgeneCatalogDetailTest instance=new TgeneCatalogDetailTest(); + instance.setPk(new TgeneCatalogDetailTestKey()); + return instance; +} +/**Clona la entidad TgeneCatalogDetailTest +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCatalogDetailTest p=(TgeneCatalogDetailTest)this.clone(); + p.setPk((TgeneCatalogDetailTestKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCatalogDetailTestKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCatalogDetailTestKey.java.svn-base new file mode 100644 index 0000000..79e3437 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCatalogDetailTestKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENECATALOGDETAILTEST*/ +@Embeddable +public class TgeneCatalogDetailTestKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String catalog; + +@Column(name="CATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String catalogcode; + +/**Contructor por defecto*/ +public TgeneCatalogDetailTestKey(){} +/**Contructor de TgeneCatalogDetailTestKey +@param pCatalog Codigo de catalogo 01 Natural, 02 Juridico +@param pCatalogcode Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +public TgeneCatalogDetailTestKey(String pCatalog,String pCatalogcode){ + catalog=pCatalog; + catalogcode=pCatalogcode; +} +/**Obtiene el valor de catalog +@return valor de catalog*/ +public String getCatalog(){ + return catalog; +} +/**Fija el valor de catalog +@param pCatalog nuevo Valor de catalog*/ +public void setCatalog(String pCatalog){ + catalog=pCatalog; +} + +/**Obtiene el valor de catalogcode +@return valor de catalogcode*/ +public String getCatalogcode(){ + return catalogcode; +} +/**Fija el valor de catalogcode +@param pCatalogcode nuevo Valor de catalogcode*/ +public void setCatalogcode(String pCatalogcode){ + catalogcode=pCatalogcode; +} + +/**Implementacion de la comparacion de TgeneCatalogDetailTestKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneCatalogDetailTestKey))return false; + TgeneCatalogDetailTestKey that = (TgeneCatalogDetailTestKey) o; + if (this.getCatalog() == null || that.getCatalog() == null){ + return false; + } + if (! this.getCatalog().equals(that.getCatalog())){ + return false; + } + if (this.getCatalogcode() == null || that.getCatalogcode() == null){ + return false; + } + if (! this.getCatalogcode().equals(that.getCatalogcode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneCatalogDetailTestKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCatalog() == null ? 0 : this.getCatalog().hashCode()); + result = result * 37 + (this.getCatalogcode() == null ? 0 : this.getCatalogcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCatalogEquivalence.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCatalogEquivalence.java.svn-base new file mode 100644 index 0000000..f1de611 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCatalogEquivalence.java.svn-base @@ -0,0 +1,160 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECATALOGEQUIVALENCE*/ +@Entity(name="TgeneCatalogEquivalence") +@Table(name="TGENECATALOGEQUIVALENCE") +public class TgeneCatalogEquivalence extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCatalogEquivalence +*/ +@Id +@Column(name="CATALOGCECODE" ,nullable=false, updatable=false) +private String pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* null +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=false) + +/** +* null +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneCatalogEquivalence(){ +} +/**Contructor de TgeneCatalogEquivalence +@param pPk Clave Primaria del entity +@param pDescription null +*/ +public TgeneCatalogEquivalence(String pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCatalogEquivalence +*/ +public static TgeneCatalogEquivalence find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneCatalogEquivalence obj = pEntityManager.find(TgeneCatalogEquivalence.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCatalogEquivalence +@return El objeto que referencia a la Clave primaria de TgeneCatalogEquivalence +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCatalogEquivalence +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCatalogEquivalence +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCatalogEquivalence))return false; + TgeneCatalogEquivalence that = (TgeneCatalogEquivalence) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneCatalogEquivalence +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneCatalogEquivalence +*/ +public Object createInstance(){ + TgeneCatalogEquivalence instance=new TgeneCatalogEquivalence(); + return instance; +} +/**Clona la entidad TgeneCatalogEquivalence +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCatalogEquivalence p=(TgeneCatalogEquivalence)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCatalogEquivalenceDet.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCatalogEquivalenceDet.java.svn-base new file mode 100644 index 0000000..47a8e78 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCatalogEquivalenceDet.java.svn-base @@ -0,0 +1,465 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECATALOGEQUIVALENCEDET */ +@Entity(name = "TgeneCatalogEquivalenceDet") +@Table(name = "TGENECATALOGEQUIVALENCEDET") +public class TgeneCatalogEquivalenceDet extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + // CAMPO MANUAL private Long pk; + /** + * Clave primaria de la Entidad TgeneCatalogEquivalenceDet + */ + @Id + @Column(name = "ID", nullable = false, updatable = false) + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "IDCATALOGEQUIV"), + @Parameter(name = "type", value = "java.lang.Long"), + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "5") }) + + @GeneratedValue(generator = "seq_id") + private Long pk; + + @Column(name = "CATALOGCECODE", nullable = false) + /** + * CATALOGO DE ENTIDAD DE CONTROL + */ + private String catalogcecode; + + @Column(name = "CATALOGCE", nullable = false) + /** + * VALOR CATALOGO ENTIDAD DE CONTROL + */ + private String catalogce; + + @Column(name = "DESCATALOGCE", nullable = true) + /** + * DESCRIPCION VALOR CATALOGO ENTIDAD DE CONTROL + */ + private String descatalogce; + + @Column(name = "ORIGINCATALOGCODE", nullable = true) + /** + * CATALOGO ORIGEN (MAIA) + */ + private String origincatalogcode; + + @Column(name = "ORIGINCATALOG", nullable = false) + /** + * VALOR CATALOGO ORIGEN (MAIA) + */ + private String origincatalog; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * VERSION DEL REGISTRO + */ + private Integer recordversion; + + @Column(name = "ORIGINCATALOGCODE_N1", nullable = true) + /** + * null + */ + private String origincatalogcode_n1; + + @Column(name = "ORIGINCATALOG_N1", nullable = true) + /** + * null + */ + private String origincatalog_n1; + + @Column(name = "ORIGINCATALOGCODE_N2", nullable = true) + /** + * null + */ + private String origincatalogcode_n2; + + @Column(name = "ORIGINCATALOG_N2", nullable = true) + /** + * null + */ + private String origincatalog_n2; + + @Column(name = "ORIGINCATALOGCODE_N3", nullable = true) + /** + * null + */ + private String origincatalogcode_n3; + + @Column(name = "ORIGINCATALOG_N3", nullable = true) + /** + * null + */ + private String origincatalog_n3; + + /** Contructor por defecto */ + public TgeneCatalogEquivalenceDet() { + } + + /** + * Contructor de TgeneCatalogEquivalenceDet + * + * @param pPk Clave Primaria del entity + * @param pCatalogcecode CATALOGO DE ENTIDAD DE CONTROL + * @param pCatalogce VALOR CATALOGO ENTIDAD DE CONTROL + * @param pOrigincatalog VALOR CATALOGO ORIGEN (MAIA) + */ + public TgeneCatalogEquivalenceDet(Long pPk, String pCatalogcecode, String pCatalogce, String pOrigincatalog) { + this(); + this.pk = pPk; + this.catalogcecode = pCatalogcecode; + this.catalogce = pCatalogce; + this.origincatalog = pOrigincatalog; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneCatalogEquivalenceDet + */ + public static TgeneCatalogEquivalenceDet find(EntityManager pEntityManager, Object pKey) throws Exception { + TgeneCatalogEquivalenceDet obj = pEntityManager.find(TgeneCatalogEquivalenceDet.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneCatalogEquivalenceDet + * + * @return El objeto que referencia a la Clave primaria de TgeneCatalogEquivalenceDet + */ + public Long getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneCatalogEquivalenceDet + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneCatalogEquivalenceDet + */ + public void setPk(Long pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de catalogcecode + * + * @return valor de catalogcecode + */ + public String getCatalogcecode() { + return this.catalogcecode; + } + + /** + * Fija el valor de catalogcecode + * + * @param pCatalogcecode nuevo Valor de catalogcecode + */ + public void setCatalogcecode(String pCatalogcecode) { + this.catalogcecode = pCatalogcecode; + } + + /** + * Obtiene el valor de catalogce + * + * @return valor de catalogce + */ + public String getCatalogce() { + return this.catalogce; + } + + /** + * Fija el valor de catalogce + * + * @param pCatalogce nuevo Valor de catalogce + */ + public void setCatalogce(String pCatalogce) { + this.catalogce = pCatalogce; + } + + /** + * Obtiene el valor de descatalogce + * + * @return valor de descatalogce + */ + public String getDescatalogce() { + return this.descatalogce; + } + + /** + * Fija el valor de descatalogce + * + * @param pDescatalogce nuevo Valor de descatalogce + */ + public void setDescatalogce(String pDescatalogce) { + this.descatalogce = pDescatalogce; + } + + /** + * Obtiene el valor de origincatalogcode + * + * @return valor de origincatalogcode + */ + public String getOrigincatalogcode() { + return this.origincatalogcode; + } + + /** + * Fija el valor de origincatalogcode + * + * @param pOrigincatalogcode nuevo Valor de origincatalogcode + */ + public void setOrigincatalogcode(String pOrigincatalogcode) { + this.origincatalogcode = pOrigincatalogcode; + } + + /** + * Obtiene el valor de origincatalog + * + * @return valor de origincatalog + */ + public String getOrigincatalog() { + return this.origincatalog; + } + + /** + * Fija el valor de origincatalog + * + * @param pOrigincatalog nuevo Valor de origincatalog + */ + public void setOrigincatalog(String pOrigincatalog) { + this.origincatalog = pOrigincatalog; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de origincatalogcode_n1 + * + * @return valor de origincatalogcode_n1 + */ + public String getOrigincatalogcode_n1() { + return this.origincatalogcode_n1; + } + + /** + * Fija el valor de origincatalogcode_n1 + * + * @param pOrigincatalogcode_n1 nuevo Valor de origincatalogcode_n1 + */ + public void setOrigincatalogcode_n1(String pOrigincatalogcode_n1) { + this.origincatalogcode_n1 = pOrigincatalogcode_n1; + } + + /** + * Obtiene el valor de origincatalog_n1 + * + * @return valor de origincatalog_n1 + */ + public String getOrigincatalog_n1() { + return this.origincatalog_n1; + } + + /** + * Fija el valor de origincatalog_n1 + * + * @param pOrigincatalog_n1 nuevo Valor de origincatalog_n1 + */ + public void setOrigincatalog_n1(String pOrigincatalog_n1) { + this.origincatalog_n1 = pOrigincatalog_n1; + } + + /** + * Obtiene el valor de origincatalogcode_n2 + * + * @return valor de origincatalogcode_n2 + */ + public String getOrigincatalogcode_n2() { + return this.origincatalogcode_n2; + } + + /** + * Fija el valor de origincatalogcode_n2 + * + * @param pOrigincatalogcode_n2 nuevo Valor de origincatalogcode_n2 + */ + public void setOrigincatalogcode_n2(String pOrigincatalogcode_n2) { + this.origincatalogcode_n2 = pOrigincatalogcode_n2; + } + + /** + * Obtiene el valor de origincatalog_n2 + * + * @return valor de origincatalog_n2 + */ + public String getOrigincatalog_n2() { + return this.origincatalog_n2; + } + + /** + * Fija el valor de origincatalog_n2 + * + * @param pOrigincatalog_n2 nuevo Valor de origincatalog_n2 + */ + public void setOrigincatalog_n2(String pOrigincatalog_n2) { + this.origincatalog_n2 = pOrigincatalog_n2; + } + + /** + * Obtiene el valor de origincatalogcode_n3 + * + * @return valor de origincatalogcode_n3 + */ + public String getOrigincatalogcode_n3() { + return this.origincatalogcode_n3; + } + + /** + * Fija el valor de origincatalogcode_n3 + * + * @param pOrigincatalogcode_n3 nuevo Valor de origincatalogcode_n3 + */ + public void setOrigincatalogcode_n3(String pOrigincatalogcode_n3) { + this.origincatalogcode_n3 = pOrigincatalogcode_n3; + } + + /** + * Obtiene el valor de origincatalog_n3 + * + * @return valor de origincatalog_n3 + */ + public String getOrigincatalog_n3() { + return this.origincatalog_n3; + } + + /** + * Fija el valor de origincatalog_n3 + * + * @param pOrigincatalog_n3 nuevo Valor de origincatalog_n3 + */ + public void setOrigincatalog_n3(String pOrigincatalog_n3) { + this.origincatalog_n3 = pOrigincatalog_n3; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneCatalogEquivalenceDet)) { + return false; + } + TgeneCatalogEquivalenceDet that = (TgeneCatalogEquivalenceDet) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneCatalogEquivalenceDet + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneCatalogEquivalenceDet */ + @Override + public Object createInstance() { + TgeneCatalogEquivalenceDet instance = new TgeneCatalogEquivalenceDet(); + return instance; + } + + /** + * Clona la entidad TgeneCatalogEquivalenceDet + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneCatalogEquivalenceDet p = (TgeneCatalogEquivalenceDet) this.clone(); + return p; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneChannels.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneChannels.java.svn-base new file mode 100644 index 0000000..2f599f6 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneChannels.java.svn-base @@ -0,0 +1,158 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECHANNELS*/ +@Entity(name="TgeneChannels") +@Table(name="TGENECHANNELS") +public class TgeneChannels extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneChannels +*/ +@Id +@Column(name="CHANNELCODE" ,nullable=false, updatable=false) +private String pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro. +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion default del registro. +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneChannels(){ +} +/**Contructor de TgeneChannels +@param pPk Clave Primaria del entity +*/ +public TgeneChannels(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneChannels +*/ +public static TgeneChannels find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneChannels obj = pEntityManager.find(TgeneChannels.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneChannels +@return El objeto que referencia a la Clave primaria de TgeneChannels +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneChannels +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneChannels +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneChannels))return false; + TgeneChannels that = (TgeneChannels) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneChannels +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneChannels +*/ +public Object createInstance(){ + TgeneChannels instance=new TgeneChannels(); + return instance; +} +/**Clona la entidad TgeneChannels +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneChannels p=(TgeneChannels)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCity.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCity.java.svn-base new file mode 100644 index 0000000..400bbaf --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCity.java.svn-base @@ -0,0 +1,161 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECITY*/ +@Entity(name="TgeneCity") +@Table(name="TGENECITY") +public class TgeneCity extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCity +*/ +@EmbeddedId +private TgeneCityKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=false) + +/** +* Nombre de la cuidad +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneCity(){ +} +/**Contructor de TgeneCity +@param pPk Clave Primaria del entity +@param pDescription Nombre de la cuidad +*/ +public TgeneCity(TgeneCityKey pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCity +*/ +public static TgeneCity find(EntityManager pEntityManager,TgeneCityKey pKey) throws Exception{ + TgeneCity obj = pEntityManager.find(TgeneCity.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCity +@return El objeto que referencia a la Clave primaria de TgeneCity +*/ +public TgeneCityKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCity +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCity +*/ +public void setPk(TgeneCityKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCity))return false; + TgeneCity that = (TgeneCity) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneCity +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneCity +*/ +public Object createInstance(){ + TgeneCity instance=new TgeneCity(); + instance.setPk(new TgeneCityKey()); + return instance; +} +/**Clona la entidad TgeneCity +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCity p=(TgeneCity)this.clone(); + p.setPk((TgeneCityKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCityKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCityKey.java.svn-base new file mode 100644 index 0000000..93631d3 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCityKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENECITY*/ +@Embeddable +public class TgeneCityKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COUNTRYCODE", nullable=false,updatable=false) + +/** +* Codigo de pais +*/ +private String countrycode; + +@Column(name="PROVINCECODE", nullable=false,updatable=false) + +/** +* Codigo de provincia +*/ +private String provincecode; + +@Column(name="CANTONCODE", nullable=false,updatable=false) + +/** +* Codigo de canton +*/ +private String cantoncode; + +@Column(name="CITYCODE", nullable=false,updatable=false) + +/** +* Codigo de cuidad +*/ +private String citycode; + +/**Contructor por defecto*/ +public TgeneCityKey(){} +/**Contructor de TgeneCityKey +@param pCountrycode Codigo de pais +@param pProvincecode Codigo de provincia +@param pCantoncode Codigo de canton +@param pCitycode Codigo de cuidad +*/ +public TgeneCityKey(String pCountrycode,String pProvincecode,String pCantoncode,String pCitycode){ + countrycode=pCountrycode; + provincecode=pProvincecode; + cantoncode=pCantoncode; + citycode=pCitycode; +} +/**Obtiene el valor de countrycode +@return valor de countrycode*/ +public String getCountrycode(){ + return countrycode; +} +/**Fija el valor de countrycode +@param pCountrycode nuevo Valor de countrycode*/ +public void setCountrycode(String pCountrycode){ + countrycode=pCountrycode; +} + +/**Obtiene el valor de provincecode +@return valor de provincecode*/ +public String getProvincecode(){ + return provincecode; +} +/**Fija el valor de provincecode +@param pProvincecode nuevo Valor de provincecode*/ +public void setProvincecode(String pProvincecode){ + provincecode=pProvincecode; +} + +/**Obtiene el valor de cantoncode +@return valor de cantoncode*/ +public String getCantoncode(){ + return cantoncode; +} +/**Fija el valor de cantoncode +@param pCantoncode nuevo Valor de cantoncode*/ +public void setCantoncode(String pCantoncode){ + cantoncode=pCantoncode; +} + +/**Obtiene el valor de citycode +@return valor de citycode*/ +public String getCitycode(){ + return citycode; +} +/**Fija el valor de citycode +@param pCitycode nuevo Valor de citycode*/ +public void setCitycode(String pCitycode){ + citycode=pCitycode; +} + +/**Implementacion de la comparacion de TgeneCityKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneCityKey))return false; + TgeneCityKey that = (TgeneCityKey) o; + if (this.getCountrycode() == null || that.getCountrycode() == null){ + return false; + } + if (! this.getCountrycode().equals(that.getCountrycode())){ + return false; + } + if (this.getProvincecode() == null || that.getProvincecode() == null){ + return false; + } + if (! this.getProvincecode().equals(that.getProvincecode())){ + return false; + } + if (this.getCantoncode() == null || that.getCantoncode() == null){ + return false; + } + if (! this.getCantoncode().equals(that.getCantoncode())){ + return false; + } + if (this.getCitycode() == null || that.getCitycode() == null){ + return false; + } + if (! this.getCitycode().equals(that.getCitycode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneCityKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCountrycode() == null ? 0 : this.getCountrycode().hashCode()); + result = result * 37 + (this.getProvincecode() == null ? 0 : this.getProvincecode().hashCode()); + result = result * 37 + (this.getCantoncode() == null ? 0 : this.getCantoncode().hashCode()); + result = result * 37 + (this.getCitycode() == null ? 0 : this.getCitycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCompany.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCompany.java.svn-base new file mode 100644 index 0000000..ad583c3 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCompany.java.svn-base @@ -0,0 +1,293 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Transient; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENECOMPANY + */ +@Entity(name = "TgeneCompany") +@Table(name = "TGENECOMPANY") +public class TgeneCompany extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable,Cache { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneCompany + */ + @Id + @Column(name = "COMPANYCODE", nullable = false, updatable = false) + private Integer pk; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "LEGALCURRENCY", nullable = true) + /** + * Moneda oficial de la compania. + */ + private String legalcurrency; + + @Column(name = "PERSONCODE", nullable = true) + /** + * Codigo de persona + */ + private Integer personcode; + + @Column(name = "ACTIVE", nullable = true) + /** + * Y indica que la compania esta activa + */ + private String active; + + @Column(name = "ACCOSERVER", nullable = true) + /** + * Y indica que ejecuta el servidor contable, N no ejecuta + */ + private String accoserver; + + /** Contructor por defecto */ + public TgeneCompany() { + } + + /** + * Contructor de TgeneCompany + * + * @param pPk Clave Primaria del entity + */ + public TgeneCompany(Integer pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneCompany + */ + public static TgeneCompany find(EntityManager pEntityManager, Object pKey) throws Exception { + TgeneCompany obj = pEntityManager.find(TgeneCompany.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneCompany + * + * @return El objeto que referencia a la Clave primaria de TgeneCompany + */ + public Integer getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneCompany + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TgeneCompany + */ + public void setPk(Integer pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de legalcurrency + * + * @return valor de legalcurrency + */ + public String getLegalcurrency() { + return legalcurrency; + } + + /** + * Fija el valor de legalcurrency + * + * @param pLegalcurrency nuevo Valor de legalcurrency + */ + public void setLegalcurrency(String pLegalcurrency) { + legalcurrency = pLegalcurrency; + } + + /** + * Obtiene el valor de personcode + * + * @return valor de personcode + */ + public Integer getPersoncode() { + return personcode; + } + + /** + * Fija el valor de personcode + * + * @param pPersoncode nuevo Valor de personcode + */ + public void setPersoncode(Integer pPersoncode) { + personcode = pPersoncode; + } + + /** + * Obtiene el valor de active + * + * @return valor de active + */ + public String getActive() { + return active; + } + + /** + * Fija el valor de active + * + * @param pActive nuevo Valor de active + */ + public void setActive(String pActive) { + active = pActive; + } + + /** + * Obtiene el valor de accoserver + * + * @return valor de accoserver + */ + public String getAccoserver() { + return accoserver; + } + + /** + * Fija el valor de accoserver + * + * @param pAccoserver nuevo Valor de accoserver + */ + public void setAccoserver(String pAccoserver) { + accoserver = pAccoserver; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneCompany)) + return false; + TgeneCompany that = (TgeneCompany) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneCompany + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneCompany */ + public Object createInstance() { + TgeneCompany instance = new TgeneCompany(); + return instance; + } + + /** + * Clona la entidad TgeneCompany + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneCompany p = (TgeneCompany) this.clone(); + return p; + } + + + //METODOS MANUALES + + private static final String sql ="from TgeneCompany t where t.active = 'Y' "; + + /** + * Metodo que entrega una lista de companias que estan definidas en la aplicacion. + * @param pEntityManager Referecnia a una session de base de datos. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager) throws Exception{ + List ldata = null; + Query qry = pEntityManager.createQuery(sql); + ldata = qry.getResultList(); + return ldata; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneConcept.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneConcept.java.svn-base new file mode 100644 index 0000000..9174544 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneConcept.java.svn-base @@ -0,0 +1,177 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECONCEPT*/ +@Entity(name="TgeneConcept") +@Table(name="TGENECONCEPT") +public class TgeneConcept extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneConcept +*/ +@EmbeddedId +private TgeneConceptKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking +*/ +private Integer recordversion; + +@Column(name="DEBITO", nullable=true) + +/** +* Indica si el concepto se utiliza en el debito o credito +*/ +private String debito; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion del concepto +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneConcept(){ +} +/**Contructor de TgeneConcept +@param pPk Clave Primaria del entity +*/ +public TgeneConcept(TgeneConceptKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneConcept +*/ +public static TgeneConcept find(EntityManager pEntityManager,TgeneConceptKey pKey) throws Exception{ + TgeneConcept obj = pEntityManager.find(TgeneConcept.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneConcept +@return El objeto que referencia a la Clave primaria de TgeneConcept +*/ +public TgeneConceptKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneConcept +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneConcept +*/ +public void setPk(TgeneConceptKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de debito +@return valor de debito*/ +public String getDebito(){ + return debito; +} +/**Fija el valor de debito +@param pDebito nuevo Valor de debito*/ +public void setDebito(String pDebito){ + debito=pDebito; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneConcept))return false; + TgeneConcept that = (TgeneConcept) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneConcept +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneConcept +*/ +public Object createInstance(){ + TgeneConcept instance=new TgeneConcept(); + instance.setPk(new TgeneConceptKey()); + return instance; +} +/**Clona la entidad TgeneConcept +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneConcept p=(TgeneConcept)this.clone(); + p.setPk((TgeneConceptKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneConceptKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneConceptKey.java.svn-base new file mode 100644 index 0000000..8574d11 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneConceptKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENECONCEPT*/ +@Embeddable +public class TgeneConceptKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CONCEPTMODULE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String conceptmodule; + +@Column(name="CONCEPTCODE", nullable=false,updatable=false) + +/** +* Codigo de concepto +*/ +private Integer conceptcode; + +/**Contructor por defecto*/ +public TgeneConceptKey(){} +/**Contructor de TgeneConceptKey +@param pConceptmodule Codigo de modulo +@param pConceptcode Codigo de concepto +*/ +public TgeneConceptKey(String pConceptmodule,Integer pConceptcode){ + conceptmodule=pConceptmodule; + conceptcode=pConceptcode; +} +/**Obtiene el valor de conceptmodule +@return valor de conceptmodule*/ +public String getConceptmodule(){ + return conceptmodule; +} +/**Fija el valor de conceptmodule +@param pConceptmodule nuevo Valor de conceptmodule*/ +public void setConceptmodule(String pConceptmodule){ + conceptmodule=pConceptmodule; +} + +/**Obtiene el valor de conceptcode +@return valor de conceptcode*/ +public Integer getConceptcode(){ + return conceptcode; +} +/**Fija el valor de conceptcode +@param pConceptcode nuevo Valor de conceptcode*/ +public void setConceptcode(Integer pConceptcode){ + conceptcode=pConceptcode; +} + +/**Implementacin de la comparacin de TgeneConceptKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneConceptKey))return false; + TgeneConceptKey that = (TgeneConceptKey) o; + if (this.getConceptmodule() == null || that.getConceptmodule() == null){ + return false; + } + if (! this.getConceptmodule().equals(that.getConceptmodule())){ + return false; + } + if (this.getConceptcode() == null || that.getConceptcode() == null){ + return false; + } + if (! this.getConceptcode().equals(that.getConceptcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneConceptKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getConceptmodule() == null ? 0 : this.getConceptmodule().hashCode()); + result = result * 37 + (this.getConceptcode() == null ? 0 : this.getConceptcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneConsep.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneConsep.java.svn-base new file mode 100644 index 0000000..3089766 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneConsep.java.svn-base @@ -0,0 +1,556 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECONSEP*/ +@Entity(name="TgeneConsep") +@Table(name="TGENECONSEP") +public class TgeneConsep extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneConsep +*/ +@Id +@Column(name="ID_LISTANEGRA_" ,nullable=false, updatable=false) +private String pk; +@Column(name="PARTMREGIONCOD", nullable=true) + +/** +* Codigo del negocio +*/ +private String partmregioncod; + +@Column(name="PARTMSUCCOD", nullable=true) + +/** +* Clase que se encarga de iniciar o detener el servicio +*/ +private String partmsuccod; + +@Column(name="PARTMAGECOD", nullable=true) + +/** +* Y, Indica que el servicio se levanta al moemento de subir el servidor de aplicaciones +*/ +private String partmagecod; + +@Column(name="PARTMUNIADMCOD", nullable=true) + +/** +* null +*/ +private String partmuniadmcod; + +@Column(name="NOMBRE", nullable=true) + +/** +* Nombre de la persona +*/ +private String nombre; + +@Column(name="APELLIDO", nullable=true) + +/** +* Apellido de la persona + +*/ +private String apellido; + +@Column(name="ID_TIPLISNEG", nullable=true) + +/** +* Codigo Tipo llista (Sindicado,Homonimo) +*/ +private Long id_tiplisneg; + +@Column(name="ESTADO", nullable=true) + +/** +* null +*/ +private String estado; + +@Column(name="FEC_ING_LISNEG", nullable=true) + +/** +* Fecha en que se registro en lista CONSEP +*/ +private Date fec_ing_lisneg; + +@Column(name="PERMITIR_TRX", nullable=true) + +/** +* null +*/ +private String permitir_trx; + +@Column(name="IDENTIFICACION", nullable=true) + +/** +* Identificacion (RUC, C.I. ,Pasaporte) +*/ +private String identificacion; + +@Column(name="PARTMCIUDADCOD", nullable=true) + +/** +* Codigo de la ciudad a la que pertenece +*/ +private String partmciudadcod; + +@Column(name="FEC_ING_CARGO", nullable=true) + +/** +* Fecha de ingreso al cargo + +*/ +private Date fec_ing_cargo; + +@Column(name="FEC_SAL_CARGO", nullable=true) + +/** +* Fecha de salida al cargo +*/ +private Date fec_sal_cargo; + +@Column(name="ID_CARGO", nullable=true) + +/** +* Codigo del cargo de la persona +*/ +private Integer id_cargo; + +@Column(name="ULT_ESTADO", nullable=true) + +/** +* null +*/ +private String ult_estado; + +@Column(name="FEC_SAL_LISNEG", nullable=true) + +/** +* Fecha de salida de la lista de CONSEP +*/ +private Date fec_sal_lisneg; + +@Column(name="USU_INGRESA", nullable=true) + +/** +* Usuario que ingreso el registro + +*/ +private String usu_ingresa; + +@Column(name="USU_MODIFICA", nullable=true) + +/** +* Usuario que modifico el registro +*/ +private String usu_modifica; + +@Column(name="FEC_MODIFICA", nullable=true) + +/** +* Fecha en la que se modifico el registro +*/ +private Date fec_modifica; + +@Column(name="ARCHIVO_ORIG", nullable=true) + +/** +* null +*/ +private String archivo_orig; + +@Column(name="OBSERVACIONLP", nullable=true) + +/** +* null +*/ +private String observacionlp; + +@Column(name="ID_TIPLISPROPIAS", nullable=true) + +/** +* null +*/ +private Long id_tiplispropias; + +@Column(name="OBSERVACION", nullable=true) + +/** +* Observaciones de la persona +*/ +private String observacion; + +/**Contructor por defecto*/ +public TgeneConsep(){ +} +/**Contructor de TgeneConsep +@param pPk Clave Primaria del entity +*/ +public TgeneConsep(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneConsep +*/ +public static TgeneConsep find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneConsep obj = pEntityManager.find(TgeneConsep.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneConsep +@return El objeto que referencia a la Clave primaria de TgeneConsep +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneConsep +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneConsep +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de partmregioncod +@return valor de partmregioncod*/ +public String getPartmregioncod(){ + return partmregioncod; +} +/**Fija el valor de partmregioncod +@param pPartmregioncod nuevo Valor de partmregioncod*/ +public void setPartmregioncod(String pPartmregioncod){ + partmregioncod=pPartmregioncod; +} + +/**Obtiene el valor de partmsuccod +@return valor de partmsuccod*/ +public String getPartmsuccod(){ + return partmsuccod; +} +/**Fija el valor de partmsuccod +@param pPartmsuccod nuevo Valor de partmsuccod*/ +public void setPartmsuccod(String pPartmsuccod){ + partmsuccod=pPartmsuccod; +} + +/**Obtiene el valor de partmagecod +@return valor de partmagecod*/ +public String getPartmagecod(){ + return partmagecod; +} +/**Fija el valor de partmagecod +@param pPartmagecod nuevo Valor de partmagecod*/ +public void setPartmagecod(String pPartmagecod){ + partmagecod=pPartmagecod; +} + +/**Obtiene el valor de partmuniadmcod +@return valor de partmuniadmcod*/ +public String getPartmuniadmcod(){ + return partmuniadmcod; +} +/**Fija el valor de partmuniadmcod +@param pPartmuniadmcod nuevo Valor de partmuniadmcod*/ +public void setPartmuniadmcod(String pPartmuniadmcod){ + partmuniadmcod=pPartmuniadmcod; +} + +/**Obtiene el valor de nombre +@return valor de nombre*/ +public String getNombre(){ + return nombre; +} +/**Fija el valor de nombre +@param pNombre nuevo Valor de nombre*/ +public void setNombre(String pNombre){ + nombre=pNombre; +} + +/**Obtiene el valor de apellido +@return valor de apellido*/ +public String getApellido(){ + return apellido; +} +/**Fija el valor de apellido +@param pApellido nuevo Valor de apellido*/ +public void setApellido(String pApellido){ + apellido=pApellido; +} + +/**Obtiene el valor de id_tiplisneg +@return valor de id_tiplisneg*/ +public Long getId_tiplisneg(){ + return id_tiplisneg; +} +/**Fija el valor de id_tiplisneg +@param pId_tiplisneg nuevo Valor de id_tiplisneg*/ +public void setId_tiplisneg(Long pId_tiplisneg){ + id_tiplisneg=pId_tiplisneg; +} + +/**Obtiene el valor de estado +@return valor de estado*/ +public String getEstado(){ + return estado; +} +/**Fija el valor de estado +@param pEstado nuevo Valor de estado*/ +public void setEstado(String pEstado){ + estado=pEstado; +} + +/**Obtiene el valor de fec_ing_lisneg +@return valor de fec_ing_lisneg*/ +public Date getFec_ing_lisneg(){ + return fec_ing_lisneg; +} +/**Fija el valor de fec_ing_lisneg +@param pFec_ing_lisneg nuevo Valor de fec_ing_lisneg*/ +public void setFec_ing_lisneg(Date pFec_ing_lisneg){ + fec_ing_lisneg=pFec_ing_lisneg; +} + +/**Obtiene el valor de permitir_trx +@return valor de permitir_trx*/ +public String getPermitir_trx(){ + return permitir_trx; +} +/**Fija el valor de permitir_trx +@param pPermitir_trx nuevo Valor de permitir_trx*/ +public void setPermitir_trx(String pPermitir_trx){ + permitir_trx=pPermitir_trx; +} + +/**Obtiene el valor de identificacion +@return valor de identificacion*/ +public String getIdentificacion(){ + return identificacion; +} +/**Fija el valor de identificacion +@param pIdentificacion nuevo Valor de identificacion*/ +public void setIdentificacion(String pIdentificacion){ + identificacion=pIdentificacion; +} + +/**Obtiene el valor de partmciudadcod +@return valor de partmciudadcod*/ +public String getPartmciudadcod(){ + return partmciudadcod; +} +/**Fija el valor de partmciudadcod +@param pPartmciudadcod nuevo Valor de partmciudadcod*/ +public void setPartmciudadcod(String pPartmciudadcod){ + partmciudadcod=pPartmciudadcod; +} + +/**Obtiene el valor de fec_ing_cargo +@return valor de fec_ing_cargo*/ +public Date getFec_ing_cargo(){ + return fec_ing_cargo; +} +/**Fija el valor de fec_ing_cargo +@param pFec_ing_cargo nuevo Valor de fec_ing_cargo*/ +public void setFec_ing_cargo(Date pFec_ing_cargo){ + fec_ing_cargo=pFec_ing_cargo; +} + +/**Obtiene el valor de fec_sal_cargo +@return valor de fec_sal_cargo*/ +public Date getFec_sal_cargo(){ + return fec_sal_cargo; +} +/**Fija el valor de fec_sal_cargo +@param pFec_sal_cargo nuevo Valor de fec_sal_cargo*/ +public void setFec_sal_cargo(Date pFec_sal_cargo){ + fec_sal_cargo=pFec_sal_cargo; +} + +/**Obtiene el valor de id_cargo +@return valor de id_cargo*/ +public Integer getId_cargo(){ + return id_cargo; +} +/**Fija el valor de id_cargo +@param pId_cargo nuevo Valor de id_cargo*/ +public void setId_cargo(Integer pId_cargo){ + id_cargo=pId_cargo; +} + +/**Obtiene el valor de ult_estado +@return valor de ult_estado*/ +public String getUlt_estado(){ + return ult_estado; +} +/**Fija el valor de ult_estado +@param pUlt_estado nuevo Valor de ult_estado*/ +public void setUlt_estado(String pUlt_estado){ + ult_estado=pUlt_estado; +} + +/**Obtiene el valor de fec_sal_lisneg +@return valor de fec_sal_lisneg*/ +public Date getFec_sal_lisneg(){ + return fec_sal_lisneg; +} +/**Fija el valor de fec_sal_lisneg +@param pFec_sal_lisneg nuevo Valor de fec_sal_lisneg*/ +public void setFec_sal_lisneg(Date pFec_sal_lisneg){ + fec_sal_lisneg=pFec_sal_lisneg; +} + +/**Obtiene el valor de usu_ingresa +@return valor de usu_ingresa*/ +public String getUsu_ingresa(){ + return usu_ingresa; +} +/**Fija el valor de usu_ingresa +@param pUsu_ingresa nuevo Valor de usu_ingresa*/ +public void setUsu_ingresa(String pUsu_ingresa){ + usu_ingresa=pUsu_ingresa; +} + +/**Obtiene el valor de usu_modifica +@return valor de usu_modifica*/ +public String getUsu_modifica(){ + return usu_modifica; +} +/**Fija el valor de usu_modifica +@param pUsu_modifica nuevo Valor de usu_modifica*/ +public void setUsu_modifica(String pUsu_modifica){ + usu_modifica=pUsu_modifica; +} + +/**Obtiene el valor de fec_modifica +@return valor de fec_modifica*/ +public Date getFec_modifica(){ + return fec_modifica; +} +/**Fija el valor de fec_modifica +@param pFec_modifica nuevo Valor de fec_modifica*/ +public void setFec_modifica(Date pFec_modifica){ + fec_modifica=pFec_modifica; +} + +/**Obtiene el valor de archivo_orig +@return valor de archivo_orig*/ +public String getArchivo_orig(){ + return archivo_orig; +} +/**Fija el valor de archivo_orig +@param pArchivo_orig nuevo Valor de archivo_orig*/ +public void setArchivo_orig(String pArchivo_orig){ + archivo_orig=pArchivo_orig; +} + +/**Obtiene el valor de observacionlp +@return valor de observacionlp*/ +public String getObservacionlp(){ + return observacionlp; +} +/**Fija el valor de observacionlp +@param pObservacionlp nuevo Valor de observacionlp*/ +public void setObservacionlp(String pObservacionlp){ + observacionlp=pObservacionlp; +} + +/**Obtiene el valor de id_tiplispropias +@return valor de id_tiplispropias*/ +public Long getId_tiplispropias(){ + return id_tiplispropias; +} +/**Fija el valor de id_tiplispropias +@param pId_tiplispropias nuevo Valor de id_tiplispropias*/ +public void setId_tiplispropias(Long pId_tiplispropias){ + id_tiplispropias=pId_tiplispropias; +} + +/**Obtiene el valor de observacion +@return valor de observacion*/ +public String getObservacion(){ + return observacion; +} +/**Fija el valor de observacion +@param pObservacion nuevo Valor de observacion*/ +public void setObservacion(String pObservacion){ + observacion=pObservacion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneConsep))return false; + TgeneConsep that = (TgeneConsep) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementación del metodo hashCode de la la entidad TgeneConsep +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementación toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementación de la creación de un bean en blanco TgeneConsep +*/ +public Object createInstance(){ + TgeneConsep instance=new TgeneConsep(); + return instance; +} +/**Clona la entidad TgeneConsep +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneConsep p=(TgeneConsep)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneConsepLog.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneConsepLog.java.svn-base new file mode 100644 index 0000000..57144ae --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneConsepLog.java.svn-base @@ -0,0 +1,509 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; +import java.util.List; +import javax.persistence.Query; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENECONSEPLOG + */ +@Entity(name = "TgeneConsepLog") +@Table(name = "TGENECONSEPLOG") +public class TgeneConsepLog extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneConsepLog + */ + @Id + @Column(name = "ID_LOG", nullable = false, updatable = false) + private Integer pk; + @Column(name = "IDENTIFICACION", nullable = true) + /** + * Numero de identificaion del cliente (RUC, CI, Pasaporte) + */ + private String identificacion; + @Column(name = "NOMBRE_PRIM", nullable = true) + /** + * Primer nombre del cliente + */ + private String nombre_prim; + @Column(name = "NOMBRE_SEG", nullable = true) + /** + * Segundo nombre del cliente + */ + private String nombre_seg; + @Column(name = "APELLIDO_PRIM", nullable = true) + /** + * Primer apellido del cliente + */ + private String apellido_prim; + @Column(name = "APELLIDO_SEG", nullable = true) + /** + * Segundo apellido del cliente opcional + */ + private String apellido_seg; + @Column(name = "ID_LISTANEGRA", nullable = true) + /** + * Identificador de la lista negra (CONSEP) + */ + private String id_listanegra; + @Column(name = "ID_TIPLISNEG", nullable = true) + /** + * Codigo del tipo CONSEP 1,2(SindicadoHomonimo,) respectivamente + */ + private Long id_tiplisneg; + @Column(name = "FEC_ING_LISNEG", nullable = true) + /** + * Fecha de regsitro en la tabla de CONSEP + */ + private Date fec_ing_lisneg; + @Column(name = "USUARIO_COD", nullable = true) + /** + * Codigo de usuario que aplica la transaccion + */ + private String usuario_cod; + @Column(name = "FEC_TRANSACCION", nullable = true) + /** + * Fecha que se ingreso a la transaccion + */ + private Timestamp fec_transaccion; + @Column(name = "TERMINAL", nullable = true) + /** + * Terminal desde donde se ingresos al aplicativo + */ + private String terminal; + @Column(name = "TRANSACCION", nullable = true) + /** + * Tipo de transaccion N, U (nuevo o actualizacion) respectivamente + */ + private String transaccion; + @Column(name = "CREACION_CLI", nullable = true) + /** + * En la transaccion actual se creo un nuevo cliente si/no (S/N) + */ + private String creacion_cli; + @Column(name = "ACTUALIZACION_CLI", nullable = true) + /** + * En la transaccion actual se realizo una actualizacion del cliente si/no + * (S/N) + */ + private String actualizacion_cli; + @Column(name = "CONSTANCIA_CONSEP", nullable = true) + /** + * La persona se encuentra en la lista de CONSEP si/no (S/N) + */ + private String constancia_consep; + + /** + * Contructor por defecto + */ + public TgeneConsepLog() { + } + + /** + * Contructor de TgeneConsepLog + * + * @param pPk Clave Primaria del entity + */ + public TgeneConsepLog(Integer pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneConsepLog + */ + public static TgeneConsepLog find(EntityManager pEntityManager, Object pKey) throws Exception { + TgeneConsepLog obj = pEntityManager.find(TgeneConsepLog.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneConsepLog + * + * @return El objeto que referencia a la Clave primaria de TgeneConsepLog + */ + public Integer getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneConsepLog + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TgeneConsepLog + */ + public void setPk(Integer pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de identificacion + * + * @return valor de identificacion + */ + public String getIdentificacion() { + return identificacion; + } + + /** + * Fija el valor de identificacion + * + * @param pIdentificacion nuevo Valor de identificacion + */ + public void setIdentificacion(String pIdentificacion) { + identificacion = pIdentificacion; + } + + /** + * Obtiene el valor de nombre_prim + * + * @return valor de nombre_prim + */ + public String getNombre_prim() { + return nombre_prim; + } + + /** + * Fija el valor de nombre_prim + * + * @param pNombre_prim nuevo Valor de nombre_prim + */ + public void setNombre_prim(String pNombre_prim) { + nombre_prim = pNombre_prim; + } + + /** + * Obtiene el valor de nombre_seg + * + * @return valor de nombre_seg + */ + public String getNombre_seg() { + return nombre_seg; + } + + /** + * Fija el valor de nombre_seg + * + * @param pNombre_seg nuevo Valor de nombre_seg + */ + public void setNombre_seg(String pNombre_seg) { + nombre_seg = pNombre_seg; + } + + /** + * Obtiene el valor de apellido_prim + * + * @return valor de apellido_prim + */ + public String getApellido_prim() { + return apellido_prim; + } + + /** + * Fija el valor de apellido_prim + * + * @param pApellido_prim nuevo Valor de apellido_prim + */ + public void setApellido_prim(String pApellido_prim) { + apellido_prim = pApellido_prim; + } + + /** + * Obtiene el valor de apellido_seg + * + * @return valor de apellido_seg + */ + public String getApellido_seg() { + return apellido_seg; + } + + /** + * Fija el valor de apellido_seg + * + * @param pApellido_seg nuevo Valor de apellido_seg + */ + public void setApellido_seg(String pApellido_seg) { + apellido_seg = pApellido_seg; + } + + /** + * Obtiene el valor de id_listanegra + * + * @return valor de id_listanegra + */ + public String getId_listanegra() { + return id_listanegra; + } + + /** + * Fija el valor de id_listanegra + * + * @param pId_listanegra nuevo Valor de id_listanegra + */ + public void setId_listanegra(String pId_listanegra) { + id_listanegra = pId_listanegra; + } + + /** + * Obtiene el valor de id_tiplisneg + * + * @return valor de id_tiplisneg + */ + public Long getId_tiplisneg() { + return id_tiplisneg; + } + + /** + * Fija el valor de id_tiplisneg + * + * @param pId_tiplisneg nuevo Valor de id_tiplisneg + */ + public void setId_tiplisneg(Long pId_tiplisneg) { + id_tiplisneg = pId_tiplisneg; + } + + /** + * Obtiene el valor de fec_ing_lisneg + * + * @return valor de fec_ing_lisneg + */ + public Date getFec_ing_lisneg() { + return fec_ing_lisneg; + } + + /** + * Fija el valor de fec_ing_lisneg + * + * @param pFec_ing_lisneg nuevo Valor de fec_ing_lisneg + */ + public void setFec_ing_lisneg(Date pFec_ing_lisneg) { + fec_ing_lisneg = pFec_ing_lisneg; + } + + /** + * Obtiene el valor de usuario_cod + * + * @return valor de usuario_cod + */ + public String getUsuario_cod() { + return usuario_cod; + } + + /** + * Fija el valor de usuario_cod + * + * @param pUsuario_cod nuevo Valor de usuario_cod + */ + public void setUsuario_cod(String pUsuario_cod) { + usuario_cod = pUsuario_cod; + } + + /** + * Obtiene el valor de fec_transaccion + * + * @return valor de fec_transaccion + */ + public Timestamp getFec_transaccion() { + return fec_transaccion; + } + + /** + * Fija el valor de fec_transaccion + * + * @param pFec_transaccion nuevo Valor de fec_transaccion + */ + public void setFec_transaccion(Timestamp pFec_transaccion) { + fec_transaccion = pFec_transaccion; + } + + /** + * Obtiene el valor de terminal + * + * @return valor de terminal + */ + public String getTerminal() { + return terminal; + } + + /** + * Fija el valor de terminal + * + * @param pTerminal nuevo Valor de terminal + */ + public void setTerminal(String pTerminal) { + terminal = pTerminal; + } + + /** + * Obtiene el valor de transaccion + * + * @return valor de transaccion + */ + public String getTransaccion() { + return transaccion; + } + + /** + * Fija el valor de transaccion + * + * @param pTransaccion nuevo Valor de transaccion + */ + public void setTransaccion(String pTransaccion) { + transaccion = pTransaccion; + } + + /** + * Obtiene el valor de creacion_cli + * + * @return valor de creacion_cli + */ + public String getCreacion_cli() { + return creacion_cli; + } + + /** + * Fija el valor de creacion_cli + * + * @param pCreacion_cli nuevo Valor de creacion_cli + */ + public void setCreacion_cli(String pCreacion_cli) { + creacion_cli = pCreacion_cli; + } + + /** + * Obtiene el valor de actualizacion_cli + * + * @return valor de actualizacion_cli + */ + public String getActualizacion_cli() { + return actualizacion_cli; + } + + /** + * Fija el valor de actualizacion_cli + * + * @param pActualizacion_cli nuevo Valor de actualizacion_cli + */ + public void setActualizacion_cli(String pActualizacion_cli) { + actualizacion_cli = pActualizacion_cli; + } + + /** + * Obtiene el valor de constancia_consep + * + * @return valor de constancia_consep + */ + public String getConstancia_consep() { + return constancia_consep; + } + + /** + * Fija el valor de constancia_consep + * + * @param pConstancia_consep nuevo Valor de constancia_consep + */ + public void setConstancia_consep(String pConstancia_consep) { + constancia_consep = pConstancia_consep; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneConsepLog)) { + return false; + } + TgeneConsepLog that = (TgeneConsepLog) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneConsepLog + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco TgeneConsepLog + */ + public Object createInstance() { + TgeneConsepLog instance = new TgeneConsepLog(); + return instance; + } + + /** + * Clona la entidad TgeneConsepLog + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneConsepLog p = (TgeneConsepLog) this.clone(); + return p; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCountry.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCountry.java.svn-base new file mode 100644 index 0000000..aed4b8c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCountry.java.svn-base @@ -0,0 +1,216 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECOUNTRY*/ +@Entity(name="TgeneCountry") +@Table(name="TGENECOUNTRY") +public class TgeneCountry extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCountry +*/ +@Id +@Column(name="COUNTRYCODE" ,nullable=false, updatable=false) +private String pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="INITIALS", nullable=true) + +/** +* Siglas del pais +*/ +private String initials; + +@Column(name="AREACODE", nullable=true) + +/** +* Codigo de area del pais +*/ +private Integer areacode; + +@Column(name="DESCRIPTION", nullable=false) + +/** +* Nombre del pais +*/ +private String description; + +@Column(name="CITIZENSHIP", nullable=false) + +/** +* Nacionalidad asociada al pais +*/ +private String citizenship; + +/**Contructor por defecto*/ +public TgeneCountry(){ +} +/**Contructor de TgeneCountry +@param pPk Clave Primaria del entity +@param pDescription Nombre del pais +@param pCitizenship Nacionalidad asociada al pais +*/ +public TgeneCountry(String pPk,String pDescription,String pCitizenship){ + this(); + pk=pPk; + description=pDescription; + citizenship=pCitizenship; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCountry +*/ +public static TgeneCountry find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneCountry obj = pEntityManager.find(TgeneCountry.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCountry +@return El objeto que referencia a la Clave primaria de TgeneCountry +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCountry +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCountry +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de initials +@return valor de initials*/ +public String getInitials(){ + return initials; +} +/**Fija el valor de initials +@param pInitials nuevo Valor de initials*/ +public void setInitials(String pInitials){ + initials=pInitials; +} + +/**Obtiene el valor de areacode +@return valor de areacode*/ +public Integer getAreacode(){ + return areacode; +} +/**Fija el valor de areacode +@param pAreacode nuevo Valor de areacode*/ +public void setAreacode(Integer pAreacode){ + areacode=pAreacode; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de citizenship +@return valor de citizenship*/ +public String getCitizenship(){ + return citizenship; +} +/**Fija el valor de citizenship +@param pCitizenship nuevo Valor de citizenship*/ +public void setCitizenship(String pCitizenship){ + citizenship=pCitizenship; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCountry))return false; + TgeneCountry that = (TgeneCountry) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneCountry +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneCountry +*/ +public Object createInstance(){ + TgeneCountry instance=new TgeneCountry(); + return instance; +} +/**Clona la entidad TgeneCountry +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCountry p=(TgeneCountry)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCreditType.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCreditType.java.svn-base new file mode 100644 index 0000000..cbe5b70 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCreditType.java.svn-base @@ -0,0 +1,194 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECREDITTYPE*/ +@Entity(name="TgeneCreditType") +@Table(name="TGENECREDITTYPE") +public class TgeneCreditType extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCreditType +*/ +@Id +@Column(name="CREDITTYPECODE" ,nullable=false, updatable=false) +private String pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion default del tipo de credito +*/ +private String description; + +@Column(name="GRACEDAYS", nullable=true) + +/** +* Dias de gracia para paso a vencido de la cuota +*/ +private Integer gracedays; + +@Column(name="CREDITGRACEDAYS", nullable=true) + +/** +* Dias de gracia para pasar todas las cuotas a vencido, depende de la primera cuota vencida +*/ +private Integer creditgracedays; + +/**Contructor por defecto*/ +public TgeneCreditType(){ +} +/**Contructor de TgeneCreditType +@param pPk Clave Primaria del entity +*/ +public TgeneCreditType(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCreditType +*/ +public static TgeneCreditType find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneCreditType obj = pEntityManager.find(TgeneCreditType.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCreditType +@return El objeto que referencia a la Clave primaria de TgeneCreditType +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCreditType +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCreditType +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de gracedays +@return valor de gracedays*/ +public Integer getGracedays(){ + return gracedays; +} +/**Fija el valor de gracedays +@param pGracedays nuevo Valor de gracedays*/ +public void setGracedays(Integer pGracedays){ + gracedays=pGracedays; +} + +/**Obtiene el valor de creditgracedays +@return valor de creditgracedays*/ +public Integer getCreditgracedays(){ + return creditgracedays; +} +/**Fija el valor de creditgracedays +@param pCreditgracedays nuevo Valor de creditgracedays*/ +public void setCreditgracedays(Integer pCreditgracedays){ + creditgracedays=pCreditgracedays; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCreditType))return false; + TgeneCreditType that = (TgeneCreditType) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneCreditType +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneCreditType +*/ +public Object createInstance(){ + TgeneCreditType instance=new TgeneCreditType(); + return instance; +} +/**Clona la entidad TgeneCreditType +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCreditType p=(TgeneCreditType)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCurrency.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCurrency.java.svn-base new file mode 100644 index 0000000..444833e --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCurrency.java.svn-base @@ -0,0 +1,180 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECURRENCY*/ +@Entity(name="TgeneCurrency") +@Table(name="TGENECURRENCY") +public class TgeneCurrency extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCurrency +*/ +@Id +@Column(name="CURRENCYCODE" ,nullable=false, updatable=false) +private String pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="PRESISION", nullable=false) + +/** +* Numero de decimales de la moneda +*/ +private Integer presision; + +@Column(name="DESCRIPTION", nullable=false) + +/** +* Descripcion de la moneda +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneCurrency(){ +} +/**Contructor de TgeneCurrency +@param pPk Clave Primaria del entity +@param pPresision Numero de decimales de la moneda +@param pDescription Descripcion de la moneda +*/ +public TgeneCurrency(String pPk,Integer pPresision,String pDescription){ + this(); + pk=pPk; + presision=pPresision; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCurrency +*/ +public static TgeneCurrency find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneCurrency obj = pEntityManager.find(TgeneCurrency.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCurrency +@return El objeto que referencia a la Clave primaria de TgeneCurrency +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCurrency +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCurrency +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de presision +@return valor de presision*/ +public Integer getPresision(){ + return presision; +} +/**Fija el valor de presision +@param pPresision nuevo Valor de presision*/ +public void setPresision(Integer pPresision){ + presision=pPresision; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCurrency))return false; + TgeneCurrency that = (TgeneCurrency) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneCurrency +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneCurrency +*/ +public Object createInstance(){ + TgeneCurrency instance=new TgeneCurrency(); + return instance; +} +/**Clona la entidad TgeneCurrency +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCurrency p=(TgeneCurrency)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCurrencyRate.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCurrencyRate.java.svn-base new file mode 100644 index 0000000..1d18e2c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCurrencyRate.java.svn-base @@ -0,0 +1,200 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECURRENCYRATE*/ +@Entity(name="TgeneCurrencyRate") +@Table(name="TGENECURRENCYRATE") +public class TgeneCurrencyRate extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCurrencyRate +*/ +@EmbeddedId +private TgeneCurrencyRateKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="BUYRATE", nullable=true) + +/** +* Cotizacion de compra asociada a la moneda +*/ +private BigDecimal buyrate; + +@Column(name="SELLRATE", nullable=true) + +/** +* Cotizacion de venta asociada a la moneda +*/ +private BigDecimal sellrate; + +@Column(name="DATEFROM", nullable=true) + +/** +* Fecha desde la cual estan viegnetes las cotizaciones de las monedas. +*/ +private Timestamp datefrom; + +/**Contructor por defecto*/ +public TgeneCurrencyRate(){ +} +/**Contructor de TgeneCurrencyRate +@param pPk Clave Primaria del entity +*/ +public TgeneCurrencyRate(TgeneCurrencyRateKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCurrencyRate +*/ +public static TgeneCurrencyRate find(EntityManager pEntityManager,TgeneCurrencyRateKey pKey) throws Exception{ + TgeneCurrencyRate obj = pEntityManager.find(TgeneCurrencyRate.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCurrencyRate +@return El objeto que referencia a la Clave primaria de TgeneCurrencyRate +*/ +public TgeneCurrencyRateKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCurrencyRate +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCurrencyRate +*/ +public void setPk(TgeneCurrencyRateKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de buyrate +@return valor de buyrate*/ +public BigDecimal getBuyrate(){ + return buyrate; +} +/**Fija el valor de buyrate +@param pBuyrate nuevo Valor de buyrate*/ +public void setBuyrate(BigDecimal pBuyrate){ + buyrate=pBuyrate; +} + +/**Obtiene el valor de sellrate +@return valor de sellrate*/ +public BigDecimal getSellrate(){ + return sellrate; +} +/**Fija el valor de sellrate +@param pSellrate nuevo Valor de sellrate*/ +public void setSellrate(BigDecimal pSellrate){ + sellrate=pSellrate; +} + +/**Obtiene el valor de datefrom +@return valor de datefrom*/ +public Timestamp getDatefrom(){ + return datefrom; +} +/**Fija el valor de datefrom +@param pDatefrom nuevo Valor de datefrom*/ +public void setDatefrom(Timestamp pDatefrom){ + datefrom=pDatefrom; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCurrencyRate))return false; + TgeneCurrencyRate that = (TgeneCurrencyRate) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneCurrencyRate +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneCurrencyRate +*/ +public Object createInstance(){ + TgeneCurrencyRate instance=new TgeneCurrencyRate(); + instance.setPk(new TgeneCurrencyRateKey()); + return instance; +} +/**Clona la entidad TgeneCurrencyRate +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCurrencyRate p=(TgeneCurrencyRate)this.clone(); + p.setPk((TgeneCurrencyRateKey)this.pk.cloneMe()); + return p; +} +public Object getId() { + return this.pk; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCurrencyRateGroup.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCurrencyRateGroup.java.svn-base new file mode 100644 index 0000000..6e04a1e --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCurrencyRateGroup.java.svn-base @@ -0,0 +1,200 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECURRENCYRATEGROUP*/ +@Entity(name="TgeneCurrencyRateGroup") +@Table(name="TGENECURRENCYRATEGROUP") +public class TgeneCurrencyRateGroup extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCurrencyRateGroup +*/ +@EmbeddedId +private TgeneCurrencyRateGroupKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejod e optimistick locking del registro +*/ +private Integer recordversion; + +@Column(name="DATEFROM", nullable=true) + +/** +* Fecha desde la cual estan vigentes las cotizaciones de las monedas. +*/ +private Timestamp datefrom; + +@Column(name="BUYRATE", nullable=true) + +/** +* Cotizacion de compro de la moneda respecto a la moneda local +*/ +private BigDecimal buyrate; + +@Column(name="SELLRATE", nullable=true) + +/** +* Cotizacion de venta de la moneda respecto a la moneda local. +*/ +private BigDecimal sellrate; + +/**Contructor por defecto*/ +public TgeneCurrencyRateGroup(){ +} +/**Contructor de TgeneCurrencyRateGroup +@param pPk Clave Primaria del entity +*/ +public TgeneCurrencyRateGroup(TgeneCurrencyRateGroupKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCurrencyRateGroup +*/ +public static TgeneCurrencyRateGroup find(EntityManager pEntityManager,TgeneCurrencyRateGroupKey pKey) throws Exception{ + TgeneCurrencyRateGroup obj = pEntityManager.find(TgeneCurrencyRateGroup.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCurrencyRateGroup +@return El objeto que referencia a la Clave primaria de TgeneCurrencyRateGroup +*/ +public TgeneCurrencyRateGroupKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCurrencyRateGroup +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCurrencyRateGroup +*/ +public void setPk(TgeneCurrencyRateGroupKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de datefrom +@return valor de datefrom*/ +public Timestamp getDatefrom(){ + return datefrom; +} +/**Fija el valor de datefrom +@param pDatefrom nuevo Valor de datefrom*/ +public void setDatefrom(Timestamp pDatefrom){ + datefrom=pDatefrom; +} + +/**Obtiene el valor de buyrate +@return valor de buyrate*/ +public BigDecimal getBuyrate(){ + return buyrate; +} +/**Fija el valor de buyrate +@param pBuyrate nuevo Valor de buyrate*/ +public void setBuyrate(BigDecimal pBuyrate){ + buyrate=pBuyrate; +} + +/**Obtiene el valor de sellrate +@return valor de sellrate*/ +public BigDecimal getSellrate(){ + return sellrate; +} +/**Fija el valor de sellrate +@param pSellrate nuevo Valor de sellrate*/ +public void setSellrate(BigDecimal pSellrate){ + sellrate=pSellrate; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCurrencyRateGroup))return false; + TgeneCurrencyRateGroup that = (TgeneCurrencyRateGroup) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneCurrencyRateGroup +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneCurrencyRateGroup +*/ +public Object createInstance(){ + TgeneCurrencyRateGroup instance=new TgeneCurrencyRateGroup(); + instance.setPk(new TgeneCurrencyRateGroupKey()); + return instance; +} +/**Clona la entidad TgeneCurrencyRateGroup +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCurrencyRateGroup p=(TgeneCurrencyRateGroup)this.clone(); + p.setPk((TgeneCurrencyRateGroupKey)this.pk.cloneMe()); + return p; +} +public Object getId() { + return this.pk; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCurrencyRateGroupKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCurrencyRateGroupKey.java.svn-base new file mode 100644 index 0000000..4bf7fa6 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCurrencyRateGroupKey.java.svn-base @@ -0,0 +1,183 @@ +package com.fp.persistence.pgeneral.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENECURRENCYRATEGROUP*/ +@Embeddable +public class TgeneCurrencyRateGroupKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CURRENCYRATECATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo de cotizacion de moendas EMP Empleados +*/ +private String currencyratecatalog; + +@Column(name="CURRENCYRATECATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de catalogo de grupos de cotizacion de monedas CURRENCYGROUP +*/ +private String currencyratecatalogcode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente la cotizacion de la moneda +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TgeneCurrencyRateGroupKey(){} +/**Contructor de TgeneCurrencyRateGroupKey +@param pCurrencyratecatalog Codigo de catalogo de cotizacion de moendas EMP Empleados +@param pCurrencyratecatalogcode Codigo de catalogo de grupos de cotizacion de monedas CURRENCYGROUP +@param pCurrencycode Codigo de moneda +@param pDateto Fecha hasta la cual esta vigente la cotizacion de la moneda +*/ +public TgeneCurrencyRateGroupKey(String pCurrencyratecatalog,String pCurrencyratecatalogcode,String pCurrencycode,Timestamp pDateto){ + currencyratecatalog=pCurrencyratecatalog; + currencyratecatalogcode=pCurrencyratecatalogcode; + currencycode=pCurrencycode; + dateto=pDateto; +} +/**Obtiene el valor de currencyratecatalog +@return valor de currencyratecatalog*/ +public String getCurrencyratecatalog(){ + return currencyratecatalog; +} +/**Fija el valor de currencyratecatalog +@param pCurrencyratecatalog nuevo Valor de currencyratecatalog*/ +public void setCurrencyratecatalog(String pCurrencyratecatalog){ + currencyratecatalog=pCurrencyratecatalog; +} + +/**Obtiene el valor de currencyratecatalogcode +@return valor de currencyratecatalogcode*/ +public String getCurrencyratecatalogcode(){ + return currencyratecatalogcode; +} +/**Fija el valor de currencyratecatalogcode +@param pCurrencyratecatalogcode nuevo Valor de currencyratecatalogcode*/ +public void setCurrencyratecatalogcode(String pCurrencyratecatalogcode){ + currencyratecatalogcode=pCurrencyratecatalogcode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TgeneCurrencyRateGroupKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneCurrencyRateGroupKey))return false; + TgeneCurrencyRateGroupKey that = (TgeneCurrencyRateGroupKey) o; + if (this.getCurrencyratecatalog() == null || that.getCurrencyratecatalog() == null){ + return false; + } + if (! this.getCurrencyratecatalog().equals(that.getCurrencyratecatalog())){ + return false; + } + if (this.getCurrencyratecatalogcode() == null || that.getCurrencyratecatalogcode() == null){ + return false; + } + if (! this.getCurrencyratecatalogcode().equals(that.getCurrencyratecatalogcode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneCurrencyRateGroupKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCurrencyratecatalog() == null ? 0 : this.getCurrencyratecatalog().hashCode()); + result = result * 37 + (this.getCurrencyratecatalogcode() == null ? 0 : this.getCurrencyratecatalogcode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCurrencyRateKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCurrencyRateKey.java.svn-base new file mode 100644 index 0000000..4fb1a2c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneCurrencyRateKey.java.svn-base @@ -0,0 +1,129 @@ +package com.fp.persistence.pgeneral.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENECURRENCYRATE*/ +@Embeddable +public class TgeneCurrencyRateKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente las cotizaciones de la moneda +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TgeneCurrencyRateKey(){} +/**Contructor de TgeneCurrencyRateKey +@param pCurrencycode Codigo de moneda +@param pDateto Fecha hasta la cual esta vigente las cotizaciones de la moneda +*/ +public TgeneCurrencyRateKey(String pCurrencycode,Timestamp pDateto){ + currencycode=pCurrencycode; + dateto=pDateto; +} +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TgeneCurrencyRateKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneCurrencyRateKey))return false; + TgeneCurrencyRateKey that = (TgeneCurrencyRateKey) o; + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneCurrencyRateKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneDenomination.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneDenomination.java.svn-base new file mode 100644 index 0000000..48d6043 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneDenomination.java.svn-base @@ -0,0 +1,122 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEDENOMINATION*/ +@Entity(name="TgeneDenomination") +@Table(name="TGENEDENOMINATION") +public class TgeneDenomination extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneDenomination +*/ +@EmbeddedId +private TgeneDenominationKey pk; +/**Contructor por defecto*/ +public TgeneDenomination(){ +} +/**Contructor de TgeneDenomination +@param pPk Clave Primaria del entity +*/ +public TgeneDenomination(TgeneDenominationKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneDenomination +*/ +public static TgeneDenomination find(EntityManager pEntityManager,TgeneDenominationKey pKey) throws Exception{ + TgeneDenomination obj = pEntityManager.find(TgeneDenomination.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneDenomination +@return El objeto que referencia a la Clave primaria de TgeneDenomination +*/ +public TgeneDenominationKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneDenomination +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneDenomination +*/ +public void setPk(TgeneDenominationKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneDenomination))return false; + TgeneDenomination that = (TgeneDenomination) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneDenomination +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneDenomination +*/ +public Object createInstance(){ + TgeneDenomination instance=new TgeneDenomination(); + instance.setPk(new TgeneDenominationKey()); + return instance; +} +/**Clona la entidad TgeneDenomination +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneDenomination p=(TgeneDenomination)this.clone(); + p.setPk((TgeneDenominationKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneDenominationKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneDenominationKey.java.svn-base new file mode 100644 index 0000000..7eb845d --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneDenominationKey.java.svn-base @@ -0,0 +1,179 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEDENOMINATION*/ +@Embeddable +public class TgeneDenominationKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="CATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String catalog; + +@Column(name="CATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String catalogcode; + +@Column(name="VALUE", nullable=false,updatable=false) + +/** +* Valor de la denominacion +*/ +private BigDecimal value; + +/**Contructor por defecto*/ +public TgeneDenominationKey(){} +/**Contructor de TgeneDenominationKey +@param pCurrencycode Codigo de moneda +@param pCatalog Codigo de catalogo 01 Natural, 02 Juridico +@param pCatalogcode Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +@param pValue Valor de la denominacion +*/ +public TgeneDenominationKey(String pCurrencycode,String pCatalog,String pCatalogcode,BigDecimal pValue){ + currencycode=pCurrencycode; + catalog=pCatalog; + catalogcode=pCatalogcode; + value=pValue; +} +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de catalog +@return valor de catalog*/ +public String getCatalog(){ + return catalog; +} +/**Fija el valor de catalog +@param pCatalog nuevo Valor de catalog*/ +public void setCatalog(String pCatalog){ + catalog=pCatalog; +} + +/**Obtiene el valor de catalogcode +@return valor de catalogcode*/ +public String getCatalogcode(){ + return catalogcode; +} +/**Fija el valor de catalogcode +@param pCatalogcode nuevo Valor de catalogcode*/ +public void setCatalogcode(String pCatalogcode){ + catalogcode=pCatalogcode; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +/**Implementacin de la comparacin de TgeneDenominationKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneDenominationKey))return false; + TgeneDenominationKey that = (TgeneDenominationKey) o; + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getCatalog() == null || that.getCatalog() == null){ + return false; + } + if (! this.getCatalog().equals(that.getCatalog())){ + return false; + } + if (this.getCatalogcode() == null || that.getCatalogcode() == null){ + return false; + } + if (! this.getCatalogcode().equals(that.getCatalogcode())){ + return false; + } + if (this.getValue() == null || that.getValue() == null){ + return false; + } + if (! this.getValue().equals(that.getValue())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneDenominationKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getCatalog() == null ? 0 : this.getCatalog().hashCode()); + result = result * 37 + (this.getCatalogcode() == null ? 0 : this.getCatalogcode().hashCode()); + result = result * 37 + (this.getValue() == null ? 0 : this.getValue().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneEntity.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneEntity.java.svn-base new file mode 100644 index 0000000..541489c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneEntity.java.svn-base @@ -0,0 +1,327 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEENTITY*/ +@Entity(name="TgeneEntity") +@Table(name="TGENEENTITY") +public class TgeneEntity extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneEntity +*/ +@EmbeddedId +private TgeneEntityKey pk; +@Column(name="PROJECT", nullable=true) + +/** +* Projecto en el cual se maneja el bean. +*/ +private String project; + +@Column(name="PAC", nullable=false) + +/** +* Nombre del subpaquete en el cual se creara la clase +*/ +private String pac; + +@Column(name="JAVAEXTENDS", nullable=true) + +/** +* Indica si el bean extiende de alguna clase en particular +*/ +private String javaextends; + +@Column(name="JAVAIMPLEMENTS", nullable=true) + +/** +* Indica si la clase implementa alguna clase en particular +*/ +private String javaimplements; + +@Column(name="CREATEREFERENCES", nullable=false) + +/** +* Indica si el entity genera referencias a entities padre. +*/ +private String createreferences; + +@Column(name="OPTIMISTICLOCKING", nullable=false) + +/** +* Indca si en enity lleva control de bloqueo optimista +*/ +private String optimisticlocking; + +@Column(name="HISTORY", nullable=false) + +/** +* Indica si el entity maneja historia. +*/ +private String history; + +@Column(name="AUTOIMPORT", nullable=true) + +/** +* Indica +*/ +private String autoimport; + +@Column(name="INMANUAL", nullable=true) + +/** +* Indica que la clase tiene implementados metodos manualmete y no se puede generar el bean automaticamente. +*/ +private String inmanual; + +@Column(name="CACHE", nullable=true) + +/** +* Indica que la tabla manaja cache, si se da mantenimiento se limpia el cache de la tabla +*/ +private String cache; + +@Column(name="LOG", nullable=true) + +/** +* Indica que la tabla manaja auditoria de cambios +*/ +private String log; + +/**Contructor por defecto*/ +public TgeneEntity(){ +} +/**Contructor de TgeneEntity +@param pPk Clave Primaria del entity +@param pPac Nombre del subpaquete en el cual se creara la clase +@param pCreatereferences Indica si el entity genera referencias a entities padre. +@param pOptimisticlocking Indca si en enity lleva control de bloqueo optimista +@param pHistory Indica si el entity maneja historia. +*/ +public TgeneEntity(TgeneEntityKey pPk,String pPac,String pCreatereferences,String pOptimisticlocking,String pHistory){ + this(); + pk=pPk; + pac=pPac; + createreferences=pCreatereferences; + optimisticlocking=pOptimisticlocking; + history=pHistory; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneEntity +*/ +public static TgeneEntity find(EntityManager pEntityManager,TgeneEntityKey pKey) throws Exception{ + TgeneEntity obj = pEntityManager.find(TgeneEntity.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneEntity +@return El objeto que referencia a la Clave primaria de TgeneEntity +*/ +public TgeneEntityKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneEntity +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneEntity +*/ +public void setPk(TgeneEntityKey pPk){ + pk=pPk; +} +/**Obtiene el valor de project +@return valor de project*/ +public String getProject(){ + return project; +} +/**Fija el valor de project +@param pProject nuevo Valor de project*/ +public void setProject(String pProject){ + project=pProject; +} + +/**Obtiene el valor de pac +@return valor de pac*/ +public String getPac(){ + return pac; +} +/**Fija el valor de pac +@param pPac nuevo Valor de pac*/ +public void setPac(String pPac){ + pac=pPac; +} + +/**Obtiene el valor de javaextends +@return valor de javaextends*/ +public String getJavaextends(){ + return javaextends; +} +/**Fija el valor de javaextends +@param pJavaextends nuevo Valor de javaextends*/ +public void setJavaextends(String pJavaextends){ + javaextends=pJavaextends; +} + +/**Obtiene el valor de javaimplements +@return valor de javaimplements*/ +public String getJavaimplements(){ + return javaimplements; +} +/**Fija el valor de javaimplements +@param pJavaimplements nuevo Valor de javaimplements*/ +public void setJavaimplements(String pJavaimplements){ + javaimplements=pJavaimplements; +} + +/**Obtiene el valor de createreferences +@return valor de createreferences*/ +public String getCreatereferences(){ + return createreferences; +} +/**Fija el valor de createreferences +@param pCreatereferences nuevo Valor de createreferences*/ +public void setCreatereferences(String pCreatereferences){ + createreferences=pCreatereferences; +} + +/**Obtiene el valor de optimisticlocking +@return valor de optimisticlocking*/ +public String getOptimisticlocking(){ + return optimisticlocking; +} +/**Fija el valor de optimisticlocking +@param pOptimisticlocking nuevo Valor de optimisticlocking*/ +public void setOptimisticlocking(String pOptimisticlocking){ + optimisticlocking=pOptimisticlocking; +} + +/**Obtiene el valor de history +@return valor de history*/ +public String getHistory(){ + return history; +} +/**Fija el valor de history +@param pHistory nuevo Valor de history*/ +public void setHistory(String pHistory){ + history=pHistory; +} + +/**Obtiene el valor de autoimport +@return valor de autoimport*/ +public String getAutoimport(){ + return autoimport; +} +/**Fija el valor de autoimport +@param pAutoimport nuevo Valor de autoimport*/ +public void setAutoimport(String pAutoimport){ + autoimport=pAutoimport; +} + +/**Obtiene el valor de inmanual +@return valor de inmanual*/ +public String getInmanual(){ + return inmanual; +} +/**Fija el valor de inmanual +@param pInmanual nuevo Valor de inmanual*/ +public void setInmanual(String pInmanual){ + inmanual=pInmanual; +} + +/**Obtiene el valor de cache +@return valor de cache*/ +public String getCache(){ + return cache; +} +/**Fija el valor de cache +@param pCache nuevo Valor de cache*/ +public void setCache(String pCache){ + cache=pCache; +} + +/**Obtiene el valor de log +@return valor de log*/ +public String getLog(){ + return log; +} +/**Fija el valor de log +@param pLog nuevo Valor de log*/ +public void setLog(String pLog){ + log=pLog; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneEntity))return false; + TgeneEntity that = (TgeneEntity) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneEntity +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneEntity +*/ +public Object createInstance(){ + TgeneEntity instance=new TgeneEntity(); + instance.setPk(new TgeneEntityKey()); + return instance; +} +/**Clona la entidad TgeneEntity +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneEntity p=(TgeneEntity)this.clone(); + p.setPk((TgeneEntityKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneEntityKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneEntityKey.java.svn-base new file mode 100644 index 0000000..fd31b1a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneEntityKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEENTITY*/ +@Embeddable +public class TgeneEntityKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TNAME", nullable=false,updatable=false) + +/** +* Nombre de la tabla en el diccionario de datos +*/ +private String tname; + +@Column(name="ENTITY", nullable=false,updatable=false) + +/** +* Nombre del bean a crear +*/ +private String entity; + +/**Contructor por defecto*/ +public TgeneEntityKey(){} +/**Contructor de TgeneEntityKey +@param pTname Nombre de la tabla en el diccionario de datos +@param pEntity Nombre del bean a crear +*/ +public TgeneEntityKey(String pTname,String pEntity){ + tname=pTname; + entity=pEntity; +} +/**Obtiene el valor de tname +@return valor de tname*/ +public String getTname(){ + return tname; +} +/**Fija el valor de tname +@param pTname nuevo Valor de tname*/ +public void setTname(String pTname){ + tname=pTname; +} + +/**Obtiene el valor de entity +@return valor de entity*/ +public String getEntity(){ + return entity; +} +/**Fija el valor de entity +@param pEntity nuevo Valor de entity*/ +public void setEntity(String pEntity){ + entity=pEntity; +} + +/**Implementacin de la comparacin de TgeneEntityKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneEntityKey))return false; + TgeneEntityKey that = (TgeneEntityKey) o; + if (this.getTname() == null || that.getTname() == null){ + return false; + } + if (! this.getTname().equals(that.getTname())){ + return false; + } + if (this.getEntity() == null || that.getEntity() == null){ + return false; + } + if (! this.getEntity().equals(that.getEntity())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneEntityKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTname() == null ? 0 : this.getTname().hashCode()); + result = result * 37 + (this.getEntity() == null ? 0 : this.getEntity().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneFrequency.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneFrequency.java.svn-base new file mode 100644 index 0000000..df496d3 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneFrequency.java.svn-base @@ -0,0 +1,180 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEFREQUENCY*/ +@Entity(name="TgeneFrequency") +@Table(name="TGENEFREQUENCY") +public class TgeneFrequency extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneFrequency +*/ +@Id +@Column(name="FRECQENCYCODE" ,nullable=false, updatable=false) +private Integer pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DAYS", nullable=false) + +/** +* Numero de dias del cliclo diario 1 dia, mensula 30 dias +*/ +private Integer days; + +@Column(name="DESCRIPTION", nullable=false) + +/** +* Descripcion de la frecuencia +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneFrequency(){ +} +/**Contructor de TgeneFrequency +@param pPk Clave Primaria del entity +@param pDays Numero de dias del cliclo diario 1 dia, mensula 30 dias +@param pDescription Descripcion de la frecuencia +*/ +public TgeneFrequency(Integer pPk,Integer pDays,String pDescription){ + this(); + pk=pPk; + days=pDays; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneFrequency +*/ +public static TgeneFrequency find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneFrequency obj = pEntityManager.find(TgeneFrequency.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneFrequency +@return El objeto que referencia a la Clave primaria de TgeneFrequency +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneFrequency +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneFrequency +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de days +@return valor de days*/ +public Integer getDays(){ + return days; +} +/**Fija el valor de days +@param pDays nuevo Valor de days*/ +public void setDays(Integer pDays){ + days=pDays; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneFrequency))return false; + TgeneFrequency that = (TgeneFrequency) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneFrequency +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneFrequency +*/ +public Object createInstance(){ + TgeneFrequency instance=new TgeneFrequency(); + return instance; +} +/**Clona la entidad TgeneFrequency +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneFrequency p=(TgeneFrequency)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneFunctions.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneFunctions.java.svn-base new file mode 100644 index 0000000..f5248f2 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneFunctions.java.svn-base @@ -0,0 +1,244 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEFUNCTIONS */ +@Entity(name = "TgeneFunctions") +@Table(name = "TGENEFUNCTIONS") +public class TgeneFunctions extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneFunctions + */ + @Id + @Column(name = "NAME", nullable = false, updatable = false) + private String pk; + + @Column(name = "CLASSNAME", nullable = false) + /** + * NOMBRE DE LA CLASE + */ + private String classname; + + @Column(name = "DESCRIPTION", nullable = true) + private String description; + + @Column(name = "ACTIVE", nullable = true) + /** + * ESTADO DE LA FUNCION + */ + private String active; + + public String getDescription() { + return this.description; + } + + public void setDescription(String pDescription) { + this.description = pDescription; + } + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * MANEJO DE OPTIMISTIC LOCKING + */ + private Integer recordversion; + + /** Contructor por defecto */ + public TgeneFunctions() { + } + + /** + * Contructor de TgeneFunctions + * + * @param pPk Clave Primaria del entity + * @param pClassname NOMBRE DE LA CLASE + */ + public TgeneFunctions(String pPk, String pClassname) { + this(); + this.pk = pPk; + this.classname = pClassname; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneFunctions + */ + public static TgeneFunctions find(EntityManager pEntityManager, Object pKey) throws Exception { + TgeneFunctions obj = pEntityManager.find(TgeneFunctions.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneFunctions + * + * @return El objeto que referencia a la Clave primaria de TgeneFunctions + */ + public String getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneFunctions + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneFunctions + */ + public void setPk(String pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de classname + * + * @return valor de classname + */ + public String getClassname() { + return this.classname; + } + + /** + * Fija el valor de classname + * + * @param pClassname nuevo Valor de classname + */ + public void setClassname(String pClassname) { + this.classname = pClassname; + } + + /** + * Obtiene el valor de active + * + * @return valor de active + */ + public String getActive() { + return this.active; + } + + /** + * Fija el valor de active + * + * @param pActive nuevo Valor de active + */ + public void setActive(String pActive) { + this.active = pActive; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneFunctions)) { + return false; + } + TgeneFunctions that = (TgeneFunctions) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneFunctions + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneFunctions */ + @Override + public Object createInstance() { + TgeneFunctions instance = new TgeneFunctions(); + return instance; + } + + /** + * Clona la entidad TgeneFunctions + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneFunctions p = (TgeneFunctions) this.clone(); + return p; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneLabel.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneLabel.java.svn-base new file mode 100644 index 0000000..a5ee04e --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneLabel.java.svn-base @@ -0,0 +1,219 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import java.util.List; +import javax.persistence.Query; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENELABEL*/ +@Entity(name = "TgeneLabel") +@Table(name = "TGENELABEL") +public class TgeneLabel extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneLabel + */ + @EmbeddedId + private TgeneLabelKey pk; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "TYPE", nullable = true) + /** + * null + */ + private String type; + @Column(name = "DESCRIPTION", nullable = true) + /** + * null + */ + private String description; + + /**Contructor por defecto*/ + public TgeneLabel() { + } + + /**Contructor de TgeneLabel + @param pPk Clave Primaria del entity + */ + public TgeneLabel(TgeneLabelKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneLabel + */ + public static TgeneLabel find(EntityManager pEntityManager, TgeneLabelKey pKey) throws Exception { + TgeneLabel obj = pEntityManager.find(TgeneLabel.class, pKey); + return obj; + } + + /**Entrega la Clave primaria de TgeneLabel + @return El objeto que referencia a la Clave primaria de TgeneLabel + */ + public TgeneLabelKey getPk() { + return pk; + } + + /**Fija un nuevo valor a la Clave primaria de TgeneLabel + @param pPk El objeto que referencia a la nueva Clave primaria de TgeneLabel + */ + public void setPk(TgeneLabelKey pPk) { + pk = pPk; + } + + /**Obtiene el valor de recordversion + @return valor de recordversion*/ + public Integer getRecordversion() { + return recordversion; + } + + /**Fija el valor de recordversion + @param pRecordversion nuevo Valor de recordversion*/ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /**Obtiene el valor de type + @return valor de type*/ + public String getType() { + return type; + } + + /**Fija el valor de type + @param pType nuevo Valor de type*/ + public void setType(String pType) { + type = pType; + } + + /**Obtiene el valor de description + @return valor de description*/ + public String getDescription() { + return description; + } + + /**Fija el valor de description + @param pDescription nuevo Valor de description*/ + public void setDescription(String pDescription) { + description = pDescription; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneLabel)) { + return false; + } + TgeneLabel that = (TgeneLabel) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /**Implementacin del metodo hashCode de la la entidad TgeneLabel + @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /**Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /**Implementacin de la creacin de un bean en blanco TgeneLabel + */ + public Object createInstance() { + TgeneLabel instance = new TgeneLabel(); + instance.setPk(new TgeneLabelKey()); + return instance; + } + + /**Clona la entidad TgeneLabel + @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneLabel p = (TgeneLabel) this.clone(); + p.setPk((TgeneLabelKey) this.pk.cloneMe()); + return p; + } + //METODOS MANUALES + private static final String SQL = + "from TgeneLabel tl" + + " where tl.pk.languagecode = :languagecode" + + " and tl.pk.channelcode = :channelcode"; + + /** + * Metodo que devuelve la lista de eiquetas a ser utilizadas en la aplicacin + * @param pEntityManager + * @param languagecode + * @param channelcode + * @return + * @throws Exception + */ + public static List getTgeneLabel(EntityManager pEntityManager, + String languagecode, String channelcode) throws Exception { + List lTgeneLabel = null; + Query qry = pEntityManager.createQuery(SQL); + qry.setParameter("languagecode", languagecode); + qry.setParameter("channelcode", channelcode); + lTgeneLabel = qry.getResultList(); + return lTgeneLabel; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneLabelKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneLabelKey.java.svn-base new file mode 100644 index 0000000..5d5828f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneLabelKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENELABEL*/ +@Embeddable +public class TgeneLabelKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="LABEL", nullable=false,updatable=false) + +/** +* Codigo de etiqueta +*/ +private String label; + +@Column(name="LANGUAGECODE", nullable=false,updatable=false) + +/** +* Codigo de idioma +*/ +private String languagecode; + +@Column(name="CHANNELCODE", nullable=false,updatable=false) + +/** +* Codigo de canal. +*/ +private String channelcode; + +/**Contructor por defecto*/ +public TgeneLabelKey(){} +/**Contructor de TgeneLabelKey +@param pLabel Codigo de etiqueta +@param pLanguagecode Codigo de idioma +@param pChannelcode Codigo de canal. +*/ +public TgeneLabelKey(String pLabel,String pLanguagecode,String pChannelcode){ + label=pLabel; + languagecode=pLanguagecode; + channelcode=pChannelcode; +} +/**Obtiene el valor de label +@return valor de label*/ +public String getLabel(){ + return label; +} +/**Fija el valor de label +@param pLabel nuevo Valor de label*/ +public void setLabel(String pLabel){ + label=pLabel; +} + +/**Obtiene el valor de languagecode +@return valor de languagecode*/ +public String getLanguagecode(){ + return languagecode; +} +/**Fija el valor de languagecode +@param pLanguagecode nuevo Valor de languagecode*/ +public void setLanguagecode(String pLanguagecode){ + languagecode=pLanguagecode; +} + +/**Obtiene el valor de channelcode +@return valor de channelcode*/ +public String getChannelcode(){ + return channelcode; +} +/**Fija el valor de channelcode +@param pChannelcode nuevo Valor de channelcode*/ +public void setChannelcode(String pChannelcode){ + channelcode=pChannelcode; +} + +/**Implementacin de la comparacin de TgeneLabelKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneLabelKey))return false; + TgeneLabelKey that = (TgeneLabelKey) o; + if (this.getLabel() == null || that.getLabel() == null){ + return false; + } + if (! this.getLabel().equals(that.getLabel())){ + return false; + } + if (this.getLanguagecode() == null || that.getLanguagecode() == null){ + return false; + } + if (! this.getLanguagecode().equals(that.getLanguagecode())){ + return false; + } + if (this.getChannelcode() == null || that.getChannelcode() == null){ + return false; + } + if (! this.getChannelcode().equals(that.getChannelcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneLabelKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getLabel() == null ? 0 : this.getLabel().hashCode()); + result = result * 37 + (this.getLanguagecode() == null ? 0 : this.getLanguagecode().hashCode()); + result = result * 37 + (this.getChannelcode() == null ? 0 : this.getChannelcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneLanguage.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneLanguage.java.svn-base new file mode 100644 index 0000000..78cb762 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneLanguage.java.svn-base @@ -0,0 +1,140 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENELANGUAGE*/ +@Entity(name="TgeneLanguage") +@Table(name="TGENELANGUAGE") +public class TgeneLanguage extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneLanguage +*/ +@Id +@Column(name="LANGUAGECODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="DESCRIPTION", nullable=false) + +/** +* Descripcion del idioma +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneLanguage(){ +} +/**Contructor de TgeneLanguage +@param pPk Clave Primaria del entity +@param pDescription Descripcion del idioma +*/ +public TgeneLanguage(String pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneLanguage +*/ +public static TgeneLanguage find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneLanguage obj = pEntityManager.find(TgeneLanguage.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneLanguage +@return El objeto que referencia a la Clave primaria de TgeneLanguage +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneLanguage +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneLanguage +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneLanguage))return false; + TgeneLanguage that = (TgeneLanguage) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneLanguage +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneLanguage +*/ +public Object createInstance(){ + TgeneLanguage instance=new TgeneLanguage(); + return instance; +} +/**Clona la entidad TgeneLanguage +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneLanguage p=(TgeneLanguage)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOffice.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOffice.java.svn-base new file mode 100644 index 0000000..7f9765c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOffice.java.svn-base @@ -0,0 +1,355 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; +import com.fp.general.exception.GeneralException; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEOFFICE */ +@Entity(name = "TgeneOffice") +@Table(name = "TGENEOFFICE") +public class TgeneOffice extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneOffice + */ + @EmbeddedId + private TgeneOfficeKey pk; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "DESCRIPTION", nullable = true) + /** + * Nombre de la oficina + */ + private String description; + + @Column(name = "COUNTRYCODE", nullable = true) + /** + * Codigo de pais + */ + private String countrycode; + + @Column(name = "PROVINCECODE", nullable = true) + /** + * Codigo de provincia + */ + private String provincecode; + + @Column(name = "CITYCODE", nullable = true) + /** + * Codigo de cuidad + */ + private String citycode; + + @Column(name = "ADDRESS", nullable = true) + /** + * Dieccion de la oficina. + */ + private String address; + + @Column(name = "PHONE", nullable = true) + /** + * Numero de telefono asociado a la oficina. + */ + private String phone; + + @Column(name = "CANTONCODE", nullable = true) + /** + * Codigo de canton + */ + private String cantoncode; + + /** Contructor por defecto */ + public TgeneOffice() { + } + + /** + * Contructor de TgeneOffice + * + * @param pPk Clave Primaria del entity + */ + public TgeneOffice(TgeneOfficeKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneOffice + */ + public static TgeneOffice find(EntityManager pEntityManager, TgeneOfficeKey pKey) throws Exception { + TgeneOffice obj = pEntityManager.find(TgeneOffice.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneOffice + * + * @return El objeto que referencia a la Clave primaria de TgeneOffice + */ + public TgeneOfficeKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneOffice + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneOffice + */ + public void setPk(TgeneOfficeKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return this.description; + } + + /** + * Fija el valor de description + * + * @param pDescription nuevo Valor de description + */ + public void setDescription(String pDescription) { + this.description = pDescription; + } + + /** + * Obtiene el valor de countrycode + * + * @return valor de countrycode + */ + public String getCountrycode() { + return this.countrycode; + } + + /** + * Fija el valor de countrycode + * + * @param pCountrycode nuevo Valor de countrycode + */ + public void setCountrycode(String pCountrycode) { + this.countrycode = pCountrycode; + } + + /** + * Obtiene el valor de provincecode + * + * @return valor de provincecode + */ + public String getProvincecode() { + return this.provincecode; + } + + /** + * Fija el valor de provincecode + * + * @param pProvincecode nuevo Valor de provincecode + */ + public void setProvincecode(String pProvincecode) { + this.provincecode = pProvincecode; + } + + /** + * Obtiene el valor de citycode + * + * @return valor de citycode + */ + public String getCitycode() { + return this.citycode; + } + + /** + * Fija el valor de citycode + * + * @param pCitycode nuevo Valor de citycode + */ + public void setCitycode(String pCitycode) { + this.citycode = pCitycode; + } + + /** + * Obtiene el valor de address + * + * @return valor de address + */ + public String getAddress() { + return this.address; + } + + /** + * Fija el valor de address + * + * @param pAddress nuevo Valor de address + */ + public void setAddress(String pAddress) { + this.address = pAddress; + } + + /** + * Obtiene el valor de phone + * + * @return valor de phone + */ + public String getPhone() { + return this.phone; + } + + /** + * Fija el valor de phone + * + * @param pPhone nuevo Valor de phone + */ + public void setPhone(String pPhone) { + this.phone = pPhone; + } + + /** + * Obtiene el valor de cantoncode + * + * @return valor de cantoncode + */ + public String getCantoncode() { + return this.cantoncode; + } + + /** + * Fija el valor de cantoncode + * + * @param pCantoncode nuevo Valor de cantoncode + */ + public void setCantoncode(String pCantoncode) { + this.cantoncode = pCantoncode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneOffice)) { + return false; + } + TgeneOffice that = (TgeneOffice) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneOffice + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneOffice */ + @Override + public Object createInstance() { + TgeneOffice instance = new TgeneOffice(); + instance.setPk(new TgeneOfficeKey()); + return instance; + } + + /** + * Clona la entidad TgeneOffice + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneOffice p = (TgeneOffice) this.clone(); + p.setPk((TgeneOfficeKey) this.pk.cloneMe()); + return p; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOfficeKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOfficeKey.java.svn-base new file mode 100644 index 0000000..59200aa --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOfficeKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEOFFICE*/ +@Embeddable +public class TgeneOfficeKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="OFFICECODE", nullable=false,updatable=false) + +/** +* Codigo de oficina +*/ +private Integer officecode; + +@Column(name="BRANCHCODE", nullable=false,updatable=false) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania al que pertenece la oficina +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TgeneOfficeKey(){} +/**Contructor de TgeneOfficeKey +@param pOfficecode Codigo de oficina +@param pBranchcode Codigo de sucursal +@param pCompanycode Codigo de compania al que pertenece la oficina +*/ +public TgeneOfficeKey(Integer pOfficecode,Integer pBranchcode,Integer pCompanycode){ + officecode=pOfficecode; + branchcode=pBranchcode; + companycode=pCompanycode; +} +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacion de la comparacion de TgeneOfficeKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneOfficeKey))return false; + TgeneOfficeKey that = (TgeneOfficeKey) o; + if (this.getOfficecode() == null || that.getOfficecode() == null){ + return false; + } + if (! this.getOfficecode().equals(that.getOfficecode())){ + return false; + } + if (this.getBranchcode() == null || that.getBranchcode() == null){ + return false; + } + if (! this.getBranchcode().equals(that.getBranchcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneOfficeKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getOfficecode() == null ? 0 : this.getOfficecode().hashCode()); + result = result * 37 + (this.getBranchcode() == null ? 0 : this.getBranchcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOfficer.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOfficer.java.svn-base new file mode 100644 index 0000000..ca264cb --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOfficer.java.svn-base @@ -0,0 +1,121 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEOFFICER*/ +@Entity(name="TgeneOfficer") +@Table(name="TGENEOFFICER") +public class TgeneOfficer extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneOfficer +*/ +@EmbeddedId +private TgeneOfficerKey pk; +/**Contructor por defecto*/ +public TgeneOfficer(){ +} +/**Contructor de TgeneOfficer +@param pPk Clave Primaria del entity +*/ +public TgeneOfficer(TgeneOfficerKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneOfficer +*/ +public static TgeneOfficer find(EntityManager pEntityManager,TgeneOfficerKey pKey) throws Exception{ + TgeneOfficer obj = pEntityManager.find(TgeneOfficer.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneOfficer +@return El objeto que referencia a la Clave primaria de TgeneOfficer +*/ +public TgeneOfficerKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneOfficer +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneOfficer +*/ +public void setPk(TgeneOfficerKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneOfficer))return false; + TgeneOfficer that = (TgeneOfficer) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneOfficer +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneOfficer +*/ +public Object createInstance(){ + TgeneOfficer instance=new TgeneOfficer(); + instance.setPk(new TgeneOfficerKey()); + return instance; +} +/**Clona la entidad TgeneOfficer +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneOfficer p=(TgeneOfficer)this.clone(); + p.setPk((TgeneOfficerKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOfficerKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOfficerKey.java.svn-base new file mode 100644 index 0000000..2ba368a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOfficerKey.java.svn-base @@ -0,0 +1,205 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEOFFICER*/ +@Embeddable +public class TgeneOfficerKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +/**Contructor por defecto*/ +public TgeneOfficerKey(){} +/**Contructor de TgeneOfficerKey +@param pUsercode Codigo de usuario +@param pCompanycode Codigo de compania +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +*/ +public TgeneOfficerKey(String pUsercode,Integer pCompanycode,String pModulecode,String pProductcode,String pSubproductcode){ + usercode=pUsercode; + companycode=pCompanycode; + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Implementacin de la comparacin de TgeneOfficerKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneOfficerKey))return false; + TgeneOfficerKey that = (TgeneOfficerKey) o; + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneOfficerKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOperationStatus.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOperationStatus.java.svn-base new file mode 100644 index 0000000..a4b0fb6 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOperationStatus.java.svn-base @@ -0,0 +1,159 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEOPERATIONSTATUS*/ +@Entity(name="TgeneOperationStatus") +@Table(name="TGENEOPERATIONSTATUS") +public class TgeneOperationStatus extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneOperationStatus +*/ +@EmbeddedId +private TgeneOperationStatusKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion default del codigo de status de la operacion. +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneOperationStatus(){ +} +/**Contructor de TgeneOperationStatus +@param pPk Clave Primaria del entity +*/ +public TgeneOperationStatus(TgeneOperationStatusKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneOperationStatus +*/ +public static TgeneOperationStatus find(EntityManager pEntityManager,TgeneOperationStatusKey pKey) throws Exception{ + TgeneOperationStatus obj = pEntityManager.find(TgeneOperationStatus.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneOperationStatus +@return El objeto que referencia a la Clave primaria de TgeneOperationStatus +*/ +public TgeneOperationStatusKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneOperationStatus +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneOperationStatus +*/ +public void setPk(TgeneOperationStatusKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneOperationStatus))return false; + TgeneOperationStatus that = (TgeneOperationStatus) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneOperationStatus +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneOperationStatus +*/ +public Object createInstance(){ + TgeneOperationStatus instance=new TgeneOperationStatus(); + instance.setPk(new TgeneOperationStatusKey()); + return instance; +} +/**Clona la entidad TgeneOperationStatus +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneOperationStatus p=(TgeneOperationStatus)this.clone(); + p.setPk((TgeneOperationStatusKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOperationStatusKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOperationStatusKey.java.svn-base new file mode 100644 index 0000000..5a43da7 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOperationStatusKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEOPERATIONSTATUS*/ +@Embeddable +public class TgeneOperationStatusKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="OPERATIONSTATUS", nullable=false,updatable=false) + +/** +* Codigo de estatus de la operacion, ORI (Original), REF (refinanciada), RES (restructurada) +*/ +private String operationstatus; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +/**Contructor por defecto*/ +public TgeneOperationStatusKey(){} +/**Contructor de TgeneOperationStatusKey +@param pOperationstatus Codigo de estatus de la operacion, ORI (Original), REF (refinanciada), RES (restructurada) +@param pModulecode Codigo de modulo +*/ +public TgeneOperationStatusKey(String pOperationstatus,String pModulecode){ + operationstatus=pOperationstatus; + modulecode=pModulecode; +} +/**Obtiene el valor de operationstatus +@return valor de operationstatus*/ +public String getOperationstatus(){ + return operationstatus; +} +/**Fija el valor de operationstatus +@param pOperationstatus nuevo Valor de operationstatus*/ +public void setOperationstatus(String pOperationstatus){ + operationstatus=pOperationstatus; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Implementacin de la comparacin de TgeneOperationStatusKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneOperationStatusKey))return false; + TgeneOperationStatusKey that = (TgeneOperationStatusKey) o; + if (this.getOperationstatus() == null || that.getOperationstatus() == null){ + return false; + } + if (! this.getOperationstatus().equals(that.getOperationstatus())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneOperationStatusKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getOperationstatus() == null ? 0 : this.getOperationstatus().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOperativeCondition.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOperativeCondition.java.svn-base new file mode 100644 index 0000000..972d1e1 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOperativeCondition.java.svn-base @@ -0,0 +1,159 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEOPERATIVECONDITION*/ +@Entity(name="TgeneOperativeCondition") +@Table(name="TGENEOPERATIVECONDITION") +public class TgeneOperativeCondition extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneOperativeCondition +*/ +@EmbeddedId +private TgeneOperativeConditionKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion del codigo de condicion operativa +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneOperativeCondition(){ +} +/**Contructor de TgeneOperativeCondition +@param pPk Clave Primaria del entity +*/ +public TgeneOperativeCondition(TgeneOperativeConditionKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneOperativeCondition +*/ +public static TgeneOperativeCondition find(EntityManager pEntityManager,TgeneOperativeConditionKey pKey) throws Exception{ + TgeneOperativeCondition obj = pEntityManager.find(TgeneOperativeCondition.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneOperativeCondition +@return El objeto que referencia a la Clave primaria de TgeneOperativeCondition +*/ +public TgeneOperativeConditionKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneOperativeCondition +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneOperativeCondition +*/ +public void setPk(TgeneOperativeConditionKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneOperativeCondition))return false; + TgeneOperativeCondition that = (TgeneOperativeCondition) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneOperativeCondition +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneOperativeCondition +*/ +public Object createInstance(){ + TgeneOperativeCondition instance=new TgeneOperativeCondition(); + instance.setPk(new TgeneOperativeConditionKey()); + return instance; +} +/**Clona la entidad TgeneOperativeCondition +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneOperativeCondition p=(TgeneOperativeCondition)this.clone(); + p.setPk((TgeneOperativeConditionKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOperativeConditionKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOperativeConditionKey.java.svn-base new file mode 100644 index 0000000..41db126 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneOperativeConditionKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEOPERATIVECONDITION*/ +@Embeddable +public class TgeneOperativeConditionKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="OPERATIVCONDITION", nullable=false,updatable=false) + +/** +* Codigo de condicion operativa. +*/ +private String operativcondition; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +/**Contructor por defecto*/ +public TgeneOperativeConditionKey(){} +/**Contructor de TgeneOperativeConditionKey +@param pOperativcondition Codigo de condicion operativa. +@param pModulecode Codigo de modulo +*/ +public TgeneOperativeConditionKey(String pOperativcondition,String pModulecode){ + operativcondition=pOperativcondition; + modulecode=pModulecode; +} +/**Obtiene el valor de operativcondition +@return valor de operativcondition*/ +public String getOperativcondition(){ + return operativcondition; +} +/**Fija el valor de operativcondition +@param pOperativcondition nuevo Valor de operativcondition*/ +public void setOperativcondition(String pOperativcondition){ + operativcondition=pOperativcondition; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Implementacin de la comparacin de TgeneOperativeConditionKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneOperativeConditionKey))return false; + TgeneOperativeConditionKey that = (TgeneOperativeConditionKey) o; + if (this.getOperativcondition() == null || that.getOperativcondition() == null){ + return false; + } + if (! this.getOperativcondition().equals(that.getOperativcondition())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneOperativeConditionKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getOperativcondition() == null ? 0 : this.getOperativcondition().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneParameters.java.netbeans-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneParameters.java.netbeans-base new file mode 100644 index 0000000..83c0024 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneParameters.java.netbeans-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEPARAMETERS*/ +@Entity(name="TgeneParameters") +@Table(name="TGENEPARAMETERS") +public class TgeneParameters extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneParameters +*/ +@EmbeddedId +private TgeneParametersKey pk; +@Column(name="TEXTVALUE", nullable=true) + +/** +* Valor texto del parametro. +*/ +private String textvalue; + +@Column(name="NUMBERVALUE", nullable=true) + +/** +* Valor numero del parametro. +*/ +private BigDecimal numbervalue; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion del parametro +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneParameters(){ +} +/**Contructor de TgeneParameters +@param pPk Clave Primaria del entity +*/ +public TgeneParameters(TgeneParametersKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneParameters +*/ +public static TgeneParameters find(EntityManager pEntityManager,TgeneParametersKey pKey) throws Exception{ + TgeneParameters obj = pEntityManager.find(TgeneParameters.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneParameters +@return El objeto que referencia a la Clave primaria de TgeneParameters +*/ +public TgeneParametersKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneParameters +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneParameters +*/ +public void setPk(TgeneParametersKey pPk){ + pk=pPk; +} +/**Obtiene el valor de textvalue +@return valor de textvalue*/ +public String getTextvalue(){ + return textvalue; +} +/**Fija el valor de textvalue +@param pTextvalue nuevo Valor de textvalue*/ +public void setTextvalue(String pTextvalue){ + textvalue=pTextvalue; +} + +/**Obtiene el valor de numbervalue +@return valor de numbervalue*/ +public BigDecimal getNumbervalue(){ + return numbervalue; +} +/**Fija el valor de numbervalue +@param pNumbervalue nuevo Valor de numbervalue*/ +public void setNumbervalue(BigDecimal pNumbervalue){ + numbervalue=pNumbervalue; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneParameters))return false; + TgeneParameters that = (TgeneParameters) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneParameters +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneParameters +*/ +public Object createInstance(){ + TgeneParameters instance=new TgeneParameters(); + instance.setPk(new TgeneParametersKey()); + return instance; +} +/**Clona la entidad TgeneParameters +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneParameters p=(TgeneParameters)this.clone(); + p.setPk((TgeneParametersKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneParameters.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneParameters.java.svn-base new file mode 100644 index 0000000..83c0024 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneParameters.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEPARAMETERS*/ +@Entity(name="TgeneParameters") +@Table(name="TGENEPARAMETERS") +public class TgeneParameters extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneParameters +*/ +@EmbeddedId +private TgeneParametersKey pk; +@Column(name="TEXTVALUE", nullable=true) + +/** +* Valor texto del parametro. +*/ +private String textvalue; + +@Column(name="NUMBERVALUE", nullable=true) + +/** +* Valor numero del parametro. +*/ +private BigDecimal numbervalue; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion del parametro +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneParameters(){ +} +/**Contructor de TgeneParameters +@param pPk Clave Primaria del entity +*/ +public TgeneParameters(TgeneParametersKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneParameters +*/ +public static TgeneParameters find(EntityManager pEntityManager,TgeneParametersKey pKey) throws Exception{ + TgeneParameters obj = pEntityManager.find(TgeneParameters.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneParameters +@return El objeto que referencia a la Clave primaria de TgeneParameters +*/ +public TgeneParametersKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneParameters +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneParameters +*/ +public void setPk(TgeneParametersKey pPk){ + pk=pPk; +} +/**Obtiene el valor de textvalue +@return valor de textvalue*/ +public String getTextvalue(){ + return textvalue; +} +/**Fija el valor de textvalue +@param pTextvalue nuevo Valor de textvalue*/ +public void setTextvalue(String pTextvalue){ + textvalue=pTextvalue; +} + +/**Obtiene el valor de numbervalue +@return valor de numbervalue*/ +public BigDecimal getNumbervalue(){ + return numbervalue; +} +/**Fija el valor de numbervalue +@param pNumbervalue nuevo Valor de numbervalue*/ +public void setNumbervalue(BigDecimal pNumbervalue){ + numbervalue=pNumbervalue; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneParameters))return false; + TgeneParameters that = (TgeneParameters) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneParameters +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneParameters +*/ +public Object createInstance(){ + TgeneParameters instance=new TgeneParameters(); + instance.setPk(new TgeneParametersKey()); + return instance; +} +/**Clona la entidad TgeneParameters +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneParameters p=(TgeneParameters)this.clone(); + p.setPk((TgeneParametersKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneParametersKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneParametersKey.java.svn-base new file mode 100644 index 0000000..7b6dd2c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneParametersKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEPARAMETERS*/ +@Embeddable +public class TgeneParametersKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CODE", nullable=false,updatable=false) + +/** +* Codigo del parametro +*/ +private String code; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TgeneParametersKey(){} +/**Contructor de TgeneParametersKey +@param pCode Codigo del parametro +@param pCompanycode Codigo de compania +*/ +public TgeneParametersKey(String pCode,Integer pCompanycode){ + code=pCode; + companycode=pCompanycode; +} +/**Obtiene el valor de code +@return valor de code*/ +public String getCode(){ + return code; +} +/**Fija el valor de code +@param pCode nuevo Valor de code*/ +public void setCode(String pCode){ + code=pCode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacin de la comparacin de TgeneParametersKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneParametersKey))return false; + TgeneParametersKey that = (TgeneParametersKey) o; + if (this.getCode() == null || that.getCode() == null){ + return false; + } + if (! this.getCode().equals(that.getCode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneParametersKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCode() == null ? 0 : this.getCode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneParroquia.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneParroquia.java.svn-base new file mode 100644 index 0000000..e72b910 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneParroquia.java.svn-base @@ -0,0 +1,159 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEPARROQUIA*/ +@Entity(name="TgeneParroquia") +@Table(name="TGENEPARROQUIA") +public class TgeneParroquia extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneParroquia +*/ +@EmbeddedId +private TgeneParroquiaKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Nombre de la parroquia +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneParroquia(){ +} +/**Contructor de TgeneParroquia +@param pPk Clave Primaria del entity +*/ +public TgeneParroquia(TgeneParroquiaKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneParroquia +*/ +public static TgeneParroquia find(EntityManager pEntityManager,TgeneParroquiaKey pKey) throws Exception{ + TgeneParroquia obj = pEntityManager.find(TgeneParroquia.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneParroquia +@return El objeto que referencia a la Clave primaria de TgeneParroquia +*/ +public TgeneParroquiaKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneParroquia +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneParroquia +*/ +public void setPk(TgeneParroquiaKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneParroquia))return false; + TgeneParroquia that = (TgeneParroquia) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneParroquia +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneParroquia +*/ +public Object createInstance(){ + TgeneParroquia instance=new TgeneParroquia(); + instance.setPk(new TgeneParroquiaKey()); + return instance; +} +/**Clona la entidad TgeneParroquia +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneParroquia p=(TgeneParroquia)this.clone(); + p.setPk((TgeneParroquiaKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneParroquiaKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneParroquiaKey.java.svn-base new file mode 100644 index 0000000..1796ef5 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneParroquiaKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEPARROQUIA*/ +@Embeddable +public class TgeneParroquiaKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COUNTRYCODE", nullable=false,updatable=false) + +/** +* Codigo de pais +*/ +private String countrycode; + +@Column(name="PROVINCECODE", nullable=false,updatable=false) + +/** +* Codigo de provincia +*/ +private String provincecode; + +@Column(name="CANTONCODE", nullable=false,updatable=false) + +/** +* Codigo de canton +*/ +private String cantoncode; + +@Column(name="PARROQUIACODE", nullable=false,updatable=false) + +/** +* Codigo de parroquia +*/ +private String parroquiacode; + +/**Contructor por defecto*/ +public TgeneParroquiaKey(){} +/**Contructor de TgeneParroquiaKey +@param pCountrycode Codigo de pais +@param pProvincecode Codigo de provincia +@param pCantoncode Codigo de canton +@param pParroquiacode Codigo de parroquia +*/ +public TgeneParroquiaKey(String pCountrycode,String pProvincecode,String pCantoncode,String pParroquiacode){ + countrycode=pCountrycode; + provincecode=pProvincecode; + cantoncode=pCantoncode; + parroquiacode=pParroquiacode; +} +/**Obtiene el valor de countrycode +@return valor de countrycode*/ +public String getCountrycode(){ + return countrycode; +} +/**Fija el valor de countrycode +@param pCountrycode nuevo Valor de countrycode*/ +public void setCountrycode(String pCountrycode){ + countrycode=pCountrycode; +} + +/**Obtiene el valor de provincecode +@return valor de provincecode*/ +public String getProvincecode(){ + return provincecode; +} +/**Fija el valor de provincecode +@param pProvincecode nuevo Valor de provincecode*/ +public void setProvincecode(String pProvincecode){ + provincecode=pProvincecode; +} + +/**Obtiene el valor de cantoncode +@return valor de cantoncode*/ +public String getCantoncode(){ + return cantoncode; +} +/**Fija el valor de cantoncode +@param pCantoncode nuevo Valor de cantoncode*/ +public void setCantoncode(String pCantoncode){ + cantoncode=pCantoncode; +} + +/**Obtiene el valor de parroquiacode +@return valor de parroquiacode*/ +public String getParroquiacode(){ + return parroquiacode; +} +/**Fija el valor de parroquiacode +@param pParroquiacode nuevo Valor de parroquiacode*/ +public void setParroquiacode(String pParroquiacode){ + parroquiacode=pParroquiacode; +} + +/**Implementacin de la comparacin de TgeneParroquiaKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneParroquiaKey))return false; + TgeneParroquiaKey that = (TgeneParroquiaKey) o; + if (this.getCountrycode() == null || that.getCountrycode() == null){ + return false; + } + if (! this.getCountrycode().equals(that.getCountrycode())){ + return false; + } + if (this.getProvincecode() == null || that.getProvincecode() == null){ + return false; + } + if (! this.getProvincecode().equals(that.getProvincecode())){ + return false; + } + if (this.getCantoncode() == null || that.getCantoncode() == null){ + return false; + } + if (! this.getCantoncode().equals(that.getCantoncode())){ + return false; + } + if (this.getParroquiacode() == null || that.getParroquiacode() == null){ + return false; + } + if (! this.getParroquiacode().equals(that.getParroquiacode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneParroquiaKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCountrycode() == null ? 0 : this.getCountrycode().hashCode()); + result = result * 37 + (this.getProvincecode() == null ? 0 : this.getProvincecode().hashCode()); + result = result * 37 + (this.getCantoncode() == null ? 0 : this.getCantoncode().hashCode()); + result = result * 37 + (this.getParroquiacode() == null ? 0 : this.getParroquiacode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneProvince.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneProvince.java.svn-base new file mode 100644 index 0000000..56028ed --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneProvince.java.svn-base @@ -0,0 +1,161 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEPROVINCE*/ +@Entity(name="TgeneProvince") +@Table(name="TGENEPROVINCE") +public class TgeneProvince extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneProvince +*/ +@EmbeddedId +private TgeneProvinceKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=false) + +/** +* Nombre de la provincia +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneProvince(){ +} +/**Contructor de TgeneProvince +@param pPk Clave Primaria del entity +@param pDescription Nombre de la provincia +*/ +public TgeneProvince(TgeneProvinceKey pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneProvince +*/ +public static TgeneProvince find(EntityManager pEntityManager,TgeneProvinceKey pKey) throws Exception{ + TgeneProvince obj = pEntityManager.find(TgeneProvince.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneProvince +@return El objeto que referencia a la Clave primaria de TgeneProvince +*/ +public TgeneProvinceKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneProvince +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneProvince +*/ +public void setPk(TgeneProvinceKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneProvince))return false; + TgeneProvince that = (TgeneProvince) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneProvince +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneProvince +*/ +public Object createInstance(){ + TgeneProvince instance=new TgeneProvince(); + instance.setPk(new TgeneProvinceKey()); + return instance; +} +/**Clona la entidad TgeneProvince +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneProvince p=(TgeneProvince)this.clone(); + p.setPk((TgeneProvinceKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneProvinceKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneProvinceKey.java.svn-base new file mode 100644 index 0000000..d7d1f91 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneProvinceKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEPROVINCE*/ +@Embeddable +public class TgeneProvinceKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COUNTRYCODE", nullable=false,updatable=false) + +/** +* Codigo de pais +*/ +private String countrycode; + +@Column(name="PROVINCECODE", nullable=false,updatable=false) + +/** +* Codigo de provincia +*/ +private String provincecode; + +/**Contructor por defecto*/ +public TgeneProvinceKey(){} +/**Contructor de TgeneProvinceKey +@param pCountrycode Codigo de pais +@param pProvincecode Codigo de provincia +*/ +public TgeneProvinceKey(String pCountrycode,String pProvincecode){ + countrycode=pCountrycode; + provincecode=pProvincecode; +} +/**Obtiene el valor de countrycode +@return valor de countrycode*/ +public String getCountrycode(){ + return countrycode; +} +/**Fija el valor de countrycode +@param pCountrycode nuevo Valor de countrycode*/ +public void setCountrycode(String pCountrycode){ + countrycode=pCountrycode; +} + +/**Obtiene el valor de provincecode +@return valor de provincecode*/ +public String getProvincecode(){ + return provincecode; +} +/**Fija el valor de provincecode +@param pProvincecode nuevo Valor de provincecode*/ +public void setProvincecode(String pProvincecode){ + provincecode=pProvincecode; +} + +/**Implementacin de la comparacin de TgeneProvinceKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneProvinceKey))return false; + TgeneProvinceKey that = (TgeneProvinceKey) o; + if (this.getCountrycode() == null || that.getCountrycode() == null){ + return false; + } + if (! this.getCountrycode().equals(that.getCountrycode())){ + return false; + } + if (this.getProvincecode() == null || that.getProvincecode() == null){ + return false; + } + if (! this.getProvincecode().equals(that.getProvincecode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneProvinceKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCountrycode() == null ? 0 : this.getCountrycode().hashCode()); + result = result * 37 + (this.getProvincecode() == null ? 0 : this.getProvincecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneQueryProcess.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneQueryProcess.java.svn-base new file mode 100644 index 0000000..3777891 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneQueryProcess.java.svn-base @@ -0,0 +1,227 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEQUERYPROCESS*/ +@Entity(name="TgeneQueryProcess") +@Table(name="TGENEQUERYPROCESS") +public class TgeneQueryProcess extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneQueryProcess +*/ +@EmbeddedId +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(SEQUENCE),0)+1 from TGENEQUERYPROCESS " + + "where QUERYCODE=:querycode "), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "querycode,pk.querycode"), + @Parameter(name = "field", value = "sequence") }) +@GeneratedValue(generator = "seq_id") +private TgeneQueryProcessKey pk; +@Column(name="PROCESSCODE", nullable=true) + +/** +* Paquete clase de un comando a ejecutar. +*/ +private String processcode; + +@Column(name="CATALOGTYPEPROCESS", nullable=true) + +/** +* Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia +*/ +private String catalogtypeprocess; + +@Column(name="CATALOGCODETYPEPROCESS", nullable=true) + +/** +* Codigo de tabla de catalogo del proceso de negocio de la aplicacion +*/ +private String catalogcodetypeprocess; + +@Column(name="EXECUTIONORDER", nullable=true) + +/** +* orden de ejecucion de la regla de negocio. +*/ +private Integer executionorder; + +@Column(name="STATUS", nullable=true) + +/** +* A indica que la regla esta activa, I regla Inactiva +*/ +private String status; + +/**Contructor por defecto*/ +public TgeneQueryProcess(){ +} +/**Contructor de TgeneQueryProcess +@param pPk Clave Primaria del entity +*/ +public TgeneQueryProcess(TgeneQueryProcessKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneQueryProcess +*/ +public static TgeneQueryProcess find(EntityManager pEntityManager,TgeneQueryProcessKey pKey) throws Exception{ + TgeneQueryProcess obj = pEntityManager.find(TgeneQueryProcess.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneQueryProcess +@return El objeto que referencia a la Clave primaria de TgeneQueryProcess +*/ +public TgeneQueryProcessKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneQueryProcess +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneQueryProcess +*/ +public void setPk(TgeneQueryProcessKey pPk){ + pk=pPk; +} +/**Obtiene el valor de processcode +@return valor de processcode*/ +public String getProcesscode(){ + return processcode; +} +/**Fija el valor de processcode +@param pProcesscode nuevo Valor de processcode*/ +public void setProcesscode(String pProcesscode){ + processcode=pProcesscode; +} + +/**Obtiene el valor de catalogtypeprocess +@return valor de catalogtypeprocess*/ +public String getCatalogtypeprocess(){ + return catalogtypeprocess; +} +/**Fija el valor de catalogtypeprocess +@param pCatalogtypeprocess nuevo Valor de catalogtypeprocess*/ +public void setCatalogtypeprocess(String pCatalogtypeprocess){ + catalogtypeprocess=pCatalogtypeprocess; +} + +/**Obtiene el valor de catalogcodetypeprocess +@return valor de catalogcodetypeprocess*/ +public String getCatalogcodetypeprocess(){ + return catalogcodetypeprocess; +} +/**Fija el valor de catalogcodetypeprocess +@param pCatalogcodetypeprocess nuevo Valor de catalogcodetypeprocess*/ +public void setCatalogcodetypeprocess(String pCatalogcodetypeprocess){ + catalogcodetypeprocess=pCatalogcodetypeprocess; +} + +/**Obtiene el valor de executionorder +@return valor de executionorder*/ +public Integer getExecutionorder(){ + return executionorder; +} +/**Fija el valor de executionorder +@param pExecutionorder nuevo Valor de executionorder*/ +public void setExecutionorder(Integer pExecutionorder){ + executionorder=pExecutionorder; +} + +/**Obtiene el valor de status +@return valor de status*/ +public String getStatus(){ + return status; +} +/**Fija el valor de status +@param pStatus nuevo Valor de status*/ +public void setStatus(String pStatus){ + status=pStatus; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneQueryProcess))return false; + TgeneQueryProcess that = (TgeneQueryProcess) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneQueryProcess +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneQueryProcess +*/ +public Object createInstance(){ + TgeneQueryProcess instance=new TgeneQueryProcess(); + instance.setPk(new TgeneQueryProcessKey()); + return instance; +} +/**Clona la entidad TgeneQueryProcess +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneQueryProcess p=(TgeneQueryProcess)this.clone(); + p.setPk((TgeneQueryProcessKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneQueryProcessKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneQueryProcessKey.java.svn-base new file mode 100644 index 0000000..8f53cde --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneQueryProcessKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEQUERYPROCESS*/ +@Embeddable +public class TgeneQueryProcessKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="QUERYCODE", nullable=false,updatable=false) + +/** +* Codigo de query que se encarga de completar datos de una consulta o lista de valores +*/ +private String querycode; + +@Column(name="SEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del comando +*/ +private Integer sequence; + +/**Contructor por defecto*/ +public TgeneQueryProcessKey(){} +/**Contructor de TgeneQueryProcessKey +@param pQuerycode Codigo de query que se encarga de completar datos de una consulta o lista de valores +@param pSequence Secuencia del comando +*/ +public TgeneQueryProcessKey(String pQuerycode,Integer pSequence){ + querycode=pQuerycode; + sequence=pSequence; +} +/**Obtiene el valor de querycode +@return valor de querycode*/ +public String getQuerycode(){ + return querycode; +} +/**Fija el valor de querycode +@param pQuerycode nuevo Valor de querycode*/ +public void setQuerycode(String pQuerycode){ + querycode=pQuerycode; +} + +/**Obtiene el valor de sequence +@return valor de sequence*/ +public Integer getSequence(){ + return sequence; +} +/**Fija el valor de sequence +@param pSequence nuevo Valor de sequence*/ +public void setSequence(Integer pSequence){ + sequence=pSequence; +} + +/**Implementacin de la comparacin de TgeneQueryProcessKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneQueryProcessKey))return false; + TgeneQueryProcessKey that = (TgeneQueryProcessKey) o; + if (this.getQuerycode() == null || that.getQuerycode() == null){ + return false; + } + if (! this.getQuerycode().equals(that.getQuerycode())){ + return false; + } + if (this.getSequence() == null || that.getSequence() == null){ + return false; + } + if (! this.getSequence().equals(that.getSequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneQueryProcessKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getQuerycode() == null ? 0 : this.getQuerycode().hashCode()); + result = result * 37 + (this.getSequence() == null ? 0 : this.getSequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneRevokeSolicitude.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneRevokeSolicitude.java.svn-base new file mode 100644 index 0000000..13859e9 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneRevokeSolicitude.java.svn-base @@ -0,0 +1,180 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEREVOKESOLICITUDE*/ +@Entity(name="TgeneRevokeSolicitude") +@Table(name="TGENEREVOKESOLICITUDE") +public class TgeneRevokeSolicitude extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneRevokeSolicitude +*/ +@EmbeddedId +private TgeneRevokeSolicitudeKey pk; +@Column(name="ACCOUNT", nullable=true) + +/** +* Numero de cuenta asociado a la solicitud +*/ +private String account; + +@Column(name="REMARK", nullable=false) + +/** +* Motivo de anulacion de la solicitud +*/ +private String remark; + +@Column(name="WORKINGDATE", nullable=false) + +/** +* Fecha de trabajo de la aplicacion +*/ +private Date workingdate; + +/**Contructor por defecto*/ +public TgeneRevokeSolicitude(){ +} +/**Contructor de TgeneRevokeSolicitude +@param pPk Clave Primaria del entity +@param pRemark Motivo de anulacion de la solicitud +@param pWorkingdate Fecha de trabajo de la aplicacion +*/ +public TgeneRevokeSolicitude(TgeneRevokeSolicitudeKey pPk,String pRemark,Date pWorkingdate){ + this(); + pk=pPk; + remark=pRemark; + workingdate=pWorkingdate; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneRevokeSolicitude +*/ +public static TgeneRevokeSolicitude find(EntityManager pEntityManager,TgeneRevokeSolicitudeKey pKey) throws Exception{ + TgeneRevokeSolicitude obj = pEntityManager.find(TgeneRevokeSolicitude.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneRevokeSolicitude +@return El objeto que referencia a la Clave primaria de TgeneRevokeSolicitude +*/ +public TgeneRevokeSolicitudeKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneRevokeSolicitude +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneRevokeSolicitude +*/ +public void setPk(TgeneRevokeSolicitudeKey pPk){ + pk=pPk; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de remark +@return valor de remark*/ +public String getRemark(){ + return remark; +} +/**Fija el valor de remark +@param pRemark nuevo Valor de remark*/ +public void setRemark(String pRemark){ + remark=pRemark; +} + +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneRevokeSolicitude))return false; + TgeneRevokeSolicitude that = (TgeneRevokeSolicitude) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneRevokeSolicitude +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneRevokeSolicitude +*/ +public Object createInstance(){ + TgeneRevokeSolicitude instance=new TgeneRevokeSolicitude(); + instance.setPk(new TgeneRevokeSolicitudeKey()); + return instance; +} +/**Clona la entidad TgeneRevokeSolicitude +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneRevokeSolicitude p=(TgeneRevokeSolicitude)this.clone(); + p.setPk((TgeneRevokeSolicitudeKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneRevokeSolicitudeKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneRevokeSolicitudeKey.java.svn-base new file mode 100644 index 0000000..65e6bbb --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneRevokeSolicitudeKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEREVOKESOLICITUDE*/ +@Embeddable +public class TgeneRevokeSolicitudeKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero unico de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +/**Contructor por defecto*/ +public TgeneRevokeSolicitudeKey(){} +/**Contructor de TgeneRevokeSolicitudeKey +@param pSolicitudnumber Numero unico de solicitud +@param pSolicitudsequence Secuencia interna de solicitud +*/ +public TgeneRevokeSolicitudeKey(String pSolicitudnumber,Integer pSolicitudsequence){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Implementacion de la comparacion de TgeneRevokeSolicitudeKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneRevokeSolicitudeKey))return false; + TgeneRevokeSolicitudeKey that = (TgeneRevokeSolicitudeKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneRevokeSolicitudeKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneServices.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneServices.java.svn-base new file mode 100644 index 0000000..1fce10b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneServices.java.svn-base @@ -0,0 +1,250 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Transient; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENESERVICES + */ +@Entity(name = "TgeneServices") +@Table(name = "TGENESERVICES") +public class TgeneServices extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneServices + */ + @Id + @Column(name = "SERVICECODE", nullable = false, updatable = false) + private String pk; + @Column(name = "DESCRIPTION", nullable = true) + /** + * Nombre del servicio + */ + private String description; + + @Column(name = "CLASSNAME", nullable = true) + /** + * Clase que se encarga de iniciar o detener el servicio + */ + private String classname; + + @Column(name = "AUTOMATIC", nullable = true) + /** + * Y, Indica que el servicio se levanta al moemento de subir el servidor de aplicaciones + */ + private String automatic; + + /** Contructor por defecto */ + public TgeneServices() { + } + + /** + * Contructor de TgeneServices + * + * @param pPk + * Clave Primaria del entity + */ + public TgeneServices(String pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager + * referencia de la session a obtener datos del bean. + * @param pKey + * Caleve primaria del bean. + * @return TgeneServices + */ + public static TgeneServices find(EntityManager pEntityManager, Object pKey) + throws Exception { + TgeneServices obj = pEntityManager.find(TgeneServices.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneServices + * + * @return El objeto que referencia a la Clave primaria de TgeneServices + */ + public String getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneServices + * + * @param pPk + * El objeto que referencia a la nueva Clave primaria de + * TgeneServices + */ + public void setPk(String pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription + * nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + /** + * Obtiene el valor de classname + * + * @return valor de classname + */ + public String getClassname() { + return classname; + } + + /** + * Fija el valor de classname + * + * @param pClassname + * nuevo Valor de classname + */ + public void setClassname(String pClassname) { + classname = pClassname; + } + + /** + * Obtiene el valor de automatic + * + * @return valor de automatic + */ + public String getAutomatic() { + return automatic; + } + + /** + * Fija el valor de automatic + * + * @param pAutomatic + * nuevo Valor de automatic + */ + public void setAutomatic(String pAutomatic) { + automatic = pAutomatic; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneServices)) + return false; + TgeneServices that = (TgeneServices) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneServices + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 + || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneServices */ + public Object createInstance() { + TgeneServices instance = new TgeneServices(); + return instance; + } + + /** + * Clona la entidad TgeneServices + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneServices p = (TgeneServices) this.clone(); + return p; + } + + //Metodos manuales + private static String JPQL = " from TgeneServices "; + + /** + * Metodo que entrega una lista de servicios a subir al servidor de aplicacion. + * @param pEntityManager + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager) throws Exception { + List ldata = null; + Query qry = pEntityManager.createQuery(JPQL); + ldata = qry.getResultList(); + return ldata; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitude.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitude.java.svn-base new file mode 100644 index 0000000..2dba468 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitude.java.svn-base @@ -0,0 +1,917 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDE + */ +@Entity(name = "TgeneSolicitude") +@Table(name = "TGENESOLICITUDE") +public class TgeneSolicitude extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneSolicitude + */ + @EmbeddedId + private TgeneSolicitudeKey pk; + + @Column(name = "DATEFROM", nullable = false) + /** + * Fecha desde la cual esta vigente el registro de solicitud + */ + private Timestamp datefrom; + + @Column(name = "ACCOUNT", nullable = true) + /** + * Numero de cuenta asociado a la solicitud + */ + private String account; + + @Column(name = "COMPANY", nullable = false) + /** + * Codigo de compania a la que pertence la cuenta + */ + private Integer company; + + @Column(name = "CURRENCYCODE", nullable = false) + /** + * Codigo de moneda + */ + private String currencycode; + + @Column(name = "ACCOUNTNAME", nullable = true) + /** + * Nombre de la cuenta + */ + private String accountname; + + @Column(name = "PERSONCODE", nullable = true) + /** + * Codigo de persona principal de la cuenta + */ + private Integer personcode; + + @Column(name = "MODULECODE", nullable = true) + /** + * Codigo de modulo al que pertenece la cuenta + */ + private String modulecode; + + @Column(name = "STATUSCODE", nullable = true) + /** + * Estatus de la solicitud + */ + private String statuscode; + + @Column(name = "OFFICECODE", nullable = true) + /** + * Codigo de oficina a la que pertenece la cuenta + */ + private Integer officecode; + + @Column(name = "BRANCHCODE", nullable = true) + /** + * Codigo de sucursal a la que pertenece la cuenta + */ + private Integer branchcode; + + @Column(name = "OPENOFFICECODE", nullable = true) + /** + * Codigo de oficina de apertura de la cuenta + */ + private Integer openofficecode; + + @Column(name = "OPENBRANCHCODE", nullable = true) + /** + * Codigo de sucursal de apertura de la cuenta + */ + private Integer openbranchcode; + + @Column(name = "OPENINGUSERCODE", nullable = true) + /** + * Codigo de usuario de apertura de la cuenta + */ + private String openingusercode; + + @Column(name = "CHARGECATALOG", nullable = true) + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String chargecatalog; + + @Column(name = "CHARGECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String chargecatalogcode; + + @Column(name = "RATECATALOG", nullable = true) + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String ratecatalog; + + @Column(name = "RATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String ratecatalogcode; + + @Column(name = "CREDITTYPECODE", nullable = true) + /** + * Codigo de tipo de credito + */ + private String credittypecode; + + @Column(name = "PRODUCTCODE", nullable = true) + /** + * Codigo de producto + */ + private String productcode; + + @Column(name = "SUBPRODUCTCODE", nullable = true) + /** + * Codigo de subproducto + */ + private String subproductcode; + + @Column(name = "OFFICER", nullable = true) + /** + * Codigo de usuario oficial de cuenta + */ + private String officer; + + @Column(name = "SECURITYLEVEL", nullable = true) + /** + * Nivel de seguridad de la cuenta + */ + private Integer securitylevel; + + @Column(name = "JOURNALID", nullable = true) + /** + * Numero de mensaje con el que se modifico el registro vigente + */ + private String journalid; + + @Column(name = "OLDJOURNALID", nullable = true) + /** + * Numero de mensaje anterior + */ + private String oldjournalid; + + /** + * Contructor por defecto + */ + public TgeneSolicitude() { + } + + /** + * Contructor de TgeneSolicitude + * + * @param pPk Clave Primaria del entity + * @param pDatefrom Fecha desde la cual esta vigente el registro de solicitud + * @param pCompany Codigo de compania a la que pertence la cuenta + * @param pCurrencycode Codigo de moneda + */ + public TgeneSolicitude(TgeneSolicitudeKey pPk, Timestamp pDatefrom, Integer pCompany, String pCurrencycode) { + this(); + this.pk = pPk; + this.datefrom = pDatefrom; + this.company = pCompany; + this.currencycode = pCurrencycode; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSolicitude + */ + public static TgeneSolicitude find(EntityManager pEntityManager, TgeneSolicitudeKey pKey) throws Exception { + TgeneSolicitude obj = pEntityManager.find(TgeneSolicitude.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneSolicitude + * + * @return El objeto que referencia a la Clave primaria de TgeneSolicitude + */ + public TgeneSolicitudeKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneSolicitude + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitude + */ + public void setPk(TgeneSolicitudeKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de account + * + * @return valor de account + */ + public String getAccount() { + return this.account; + } + + /** + * Fija el valor de account + * + * @param pAccount nuevo Valor de account + */ + public void setAccount(String pAccount) { + this.account = pAccount; + } + + /** + * Obtiene el valor de company + * + * @return valor de company + */ + public Integer getCompany() { + return this.company; + } + + /** + * Fija el valor de company + * + * @param pCompany nuevo Valor de company + */ + public void setCompany(Integer pCompany) { + this.company = pCompany; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de accountname + * + * @return valor de accountname + */ + public String getAccountname() { + return this.accountname; + } + + /** + * Fija el valor de accountname + * + * @param pAccountname nuevo Valor de accountname + */ + public void setAccountname(String pAccountname) { + this.accountname = pAccountname; + } + + /** + * Obtiene el valor de personcode + * + * @return valor de personcode + */ + public Integer getPersoncode() { + return this.personcode; + } + + /** + * Fija el valor de personcode + * + * @param pPersoncode nuevo Valor de personcode + */ + public void setPersoncode(Integer pPersoncode) { + this.personcode = pPersoncode; + } + + /** + * Obtiene el valor de modulecode + * + * @return valor de modulecode + */ + public String getModulecode() { + return this.modulecode; + } + + /** + * Fija el valor de modulecode + * + * @param pModulecode nuevo Valor de modulecode + */ + public void setModulecode(String pModulecode) { + this.modulecode = pModulecode; + } + + /** + * Obtiene el valor de statuscode + * + * @return valor de statuscode + */ + public String getStatuscode() { + return this.statuscode; + } + + /** + * Fija el valor de statuscode + * + * @param pStatuscode nuevo Valor de statuscode + */ + public void setStatuscode(String pStatuscode) { + this.statuscode = pStatuscode; + } + + /** + * Obtiene el valor de officecode + * + * @return valor de officecode + */ + public Integer getOfficecode() { + return this.officecode; + } + + /** + * Fija el valor de officecode + * + * @param pOfficecode nuevo Valor de officecode + */ + public void setOfficecode(Integer pOfficecode) { + this.officecode = pOfficecode; + } + + /** + * Obtiene el valor de branchcode + * + * @return valor de branchcode + */ + public Integer getBranchcode() { + return this.branchcode; + } + + /** + * Fija el valor de branchcode + * + * @param pBranchcode nuevo Valor de branchcode + */ + public void setBranchcode(Integer pBranchcode) { + this.branchcode = pBranchcode; + } + + /** + * Obtiene el valor de openofficecode + * + * @return valor de openofficecode + */ + public Integer getOpenofficecode() { + return this.openofficecode; + } + + /** + * Fija el valor de openofficecode + * + * @param pOpenofficecode nuevo Valor de openofficecode + */ + public void setOpenofficecode(Integer pOpenofficecode) { + this.openofficecode = pOpenofficecode; + } + + /** + * Obtiene el valor de openbranchcode + * + * @return valor de openbranchcode + */ + public Integer getOpenbranchcode() { + return this.openbranchcode; + } + + /** + * Fija el valor de openbranchcode + * + * @param pOpenbranchcode nuevo Valor de openbranchcode + */ + public void setOpenbranchcode(Integer pOpenbranchcode) { + this.openbranchcode = pOpenbranchcode; + } + + /** + * Obtiene el valor de openingusercode + * + * @return valor de openingusercode + */ + public String getOpeningusercode() { + return this.openingusercode; + } + + /** + * Fija el valor de openingusercode + * + * @param pOpeningusercode nuevo Valor de openingusercode + */ + public void setOpeningusercode(String pOpeningusercode) { + this.openingusercode = pOpeningusercode; + } + + /** + * Obtiene el valor de chargecatalog + * + * @return valor de chargecatalog + */ + public String getChargecatalog() { + return this.chargecatalog; + } + + /** + * Fija el valor de chargecatalog + * + * @param pChargecatalog nuevo Valor de chargecatalog + */ + public void setChargecatalog(String pChargecatalog) { + this.chargecatalog = pChargecatalog; + } + + /** + * Obtiene el valor de chargecatalogcode + * + * @return valor de chargecatalogcode + */ + public String getChargecatalogcode() { + return this.chargecatalogcode; + } + + /** + * Fija el valor de chargecatalogcode + * + * @param pChargecatalogcode nuevo Valor de chargecatalogcode + */ + public void setChargecatalogcode(String pChargecatalogcode) { + this.chargecatalogcode = pChargecatalogcode; + } + + /** + * Obtiene el valor de ratecatalog + * + * @return valor de ratecatalog + */ + public String getRatecatalog() { + return this.ratecatalog; + } + + /** + * Fija el valor de ratecatalog + * + * @param pRatecatalog nuevo Valor de ratecatalog + */ + public void setRatecatalog(String pRatecatalog) { + this.ratecatalog = pRatecatalog; + } + + /** + * Obtiene el valor de ratecatalogcode + * + * @return valor de ratecatalogcode + */ + public String getRatecatalogcode() { + return this.ratecatalogcode; + } + + /** + * Fija el valor de ratecatalogcode + * + * @param pRatecatalogcode nuevo Valor de ratecatalogcode + */ + public void setRatecatalogcode(String pRatecatalogcode) { + this.ratecatalogcode = pRatecatalogcode; + } + + /** + * Obtiene el valor de credittypecode + * + * @return valor de credittypecode + */ + public String getCredittypecode() { + return this.credittypecode; + } + + /** + * Fija el valor de credittypecode + * + * @param pCredittypecode nuevo Valor de credittypecode + */ + public void setCredittypecode(String pCredittypecode) { + this.credittypecode = pCredittypecode; + } + + /** + * Obtiene el valor de productcode + * + * @return valor de productcode + */ + public String getProductcode() { + return this.productcode; + } + + /** + * Fija el valor de productcode + * + * @param pProductcode nuevo Valor de productcode + */ + public void setProductcode(String pProductcode) { + this.productcode = pProductcode; + } + + /** + * Obtiene el valor de subproductcode + * + * @return valor de subproductcode + */ + public String getSubproductcode() { + return this.subproductcode; + } + + /** + * Fija el valor de subproductcode + * + * @param pSubproductcode nuevo Valor de subproductcode + */ + public void setSubproductcode(String pSubproductcode) { + this.subproductcode = pSubproductcode; + } + + /** + * Obtiene el valor de officer + * + * @return valor de officer + */ + public String getOfficer() { + return this.officer; + } + + /** + * Fija el valor de officer + * + * @param pOfficer nuevo Valor de officer + */ + public void setOfficer(String pOfficer) { + this.officer = pOfficer; + } + + /** + * Obtiene el valor de securitylevel + * + * @return valor de securitylevel + */ + public Integer getSecuritylevel() { + return this.securitylevel; + } + + /** + * Fija el valor de securitylevel + * + * @param pSecuritylevel nuevo Valor de securitylevel + */ + public void setSecuritylevel(Integer pSecuritylevel) { + this.securitylevel = pSecuritylevel; + } + + /** + * Obtiene el valor de journalid + * + * @return valor de journalid + */ + public String getJournalid() { + return this.journalid; + } + + /** + * Fija el valor de journalid + * + * @param pJournalid nuevo Valor de journalid + */ + public void setJournalid(String pJournalid) { + this.journalid = pJournalid; + } + + /** + * Obtiene el valor de oldjournalid + * + * @return valor de oldjournalid + */ + public String getOldjournalid() { + return this.oldjournalid; + } + + /** + * Fija el valor de oldjournalid + * + * @param pOldjournalid nuevo Valor de oldjournalid + */ + public void setOldjournalid(String pOldjournalid) { + this.oldjournalid = pOldjournalid; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneSolicitude)) { + return false; + } + TgeneSolicitude that = (TgeneSolicitude) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneSolicitude + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacion toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacion de la creacion de un bean en blanco TgeneSolicitude + */ + @Override + public Object createInstance() { + TgeneSolicitude instance = new TgeneSolicitude(); + instance.setPk(new TgeneSolicitudeKey()); + return instance; + } + + /** + * Clona la entidad TgeneSolicitude + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneSolicitude p = (TgeneSolicitude) this.clone(); + p.setPk((TgeneSolicitudeKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + + // METODOS MANUALES + /** + * Sentencia SQL que obtiene un objeto de tipo TgeneSolicitude + */ + private static final String JPQL_SOLICITUDE = "from TgeneSolicitude tgs" + " where tgs.pk.solicitudnumber = :solicitudnumber" + + " and tgs.pk.solicitudsequence = :solicitudsequence" + " and tgs.pk.dateto = :dateto"; + + /** + * Metodo que devuelve un objeto de tipo TgeneSolicitude + * + * @param solicitudnumber + * @param solicitudsequence + * @return + * @throws Exception + */ + public static TgeneSolicitude find(EntityManager pEntityManager, String solicitudnumber, Integer solicitudsequence) throws Exception { + Query qry = pEntityManager.createQuery(TgeneSolicitude.JPQL_SOLICITUDE); + qry.setParameter("solicitudnumber", solicitudnumber); + qry.setParameter("solicitudsequence", solicitudsequence); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + try { + return (TgeneSolicitude) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + + /** + * Sentencia SQL que obtiene un objeto de tipo TgeneSolicitude por codigo modulo + */ + private static final String JPQL_SOLICITUDE_WITHOUT_DISB_BY_ACCOUNT = "from TgeneSolicitude sol where (coalesce(sol.account, 'null') = 'null'" + + " or sol.account in(select acc.pk.account from TgeneAccount acc where acc.accountstatuscode!='VIG' and acc.pk.dateto = :dateto ))" + + "and sol.statuscode in('ENT', 'APR') and sol.modulecode = :modulecode and sol.account = :account and sol.pk.dateto = :dateto"; + + /** + * Metodo que devuelve una lista de TgeneSolicitude nuevas y que no tengan cuentas con estado VIG por codigo de + * cuenta + * + * @param pEntityManager + * @param moduleCode + * @param accountNumber + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findWithoutDisbursementByAccount(EntityManager pEntityManager, String moduleCode, String accountNumber, + Integer page, Integer recordperpage) throws Exception { + Query qry = pEntityManager.createQuery(TgeneSolicitude.JPQL_SOLICITUDE_WITHOUT_DISB_BY_ACCOUNT); + qry.setParameter("modulecode", moduleCode); + qry.setParameter("account", accountNumber); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + if ((page != null) && (recordperpage != null) && (page >= 0) && (recordperpage > 0)) { + if (page > 1) { + qry.setFirstResult((page - 1) * recordperpage); + } + qry.setMaxResults(recordperpage); + } + return qry.getResultList(); + } + + /** + * Sentencia SQL que obtiene un objeto de tipo TgeneSolicitude por codigo de persona + */ + private static final String JPQL_SOLICITUDE_WITHOUT_DISB_BY_PERSON = "from TgeneSolicitude sol where (coalesce(sol.account, 'null') = 'null'" + + " or sol.account in(select acc.pk.account from TgeneAccount acc where acc.accountstatuscode!='VIG' and acc.pk.dateto = :dateto ))" + + "and sol.statuscode in('ENT', 'APR') and sol.modulecode = :modulecode and sol.personcode = :personcode and sol.pk.dateto = :dateto"; + + /** + * Metodo que devuelve una lista de TgeneSolicitude nuevas y que no tengan cuentas con estado VIG por codigo de + * persona + * + * @param pEntityManager + * @param moduleCode + * @param personCode + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findWithoutDisbursementByPerson(EntityManager pEntityManager, String moduleCode, Integer personCode, + Integer page, Integer recordperpage) throws Exception { + Query qry = pEntityManager.createQuery(TgeneSolicitude.JPQL_SOLICITUDE_WITHOUT_DISB_BY_PERSON); + qry.setParameter("modulecode", moduleCode); + qry.setParameter("personcode", personCode); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + if ((page != null) && (recordperpage != null) && (page >= 0) && (recordperpage > 0)) { + if (page > 1) { + qry.setFirstResult((page - 1) * recordperpage); + } + qry.setMaxResults(recordperpage); + } + return qry.getResultList(); + } + + /** + * Sentencia SQL que consulta retorna la solicitud dada una cuenta y estatus + */ + private static final String JPQL_SOLICITUDE_BY_ACCOUNT_AND_STATUS = "from TgeneSolicitude sol " + " where sol.account = :account " + + " and sol.company = :company " + " and sol.statuscode = :statuscode and sol.pk.dateto = :dateto"; + + /** + * Sentencia SQL que consulta retorna la solicitud dada una cuenta + */ + private static final String JPQL_SOLICITUDE_BY_ACCOUNT = "from TgeneSolicitude sol " + " where sol.account = :account " + + " and sol.company = :company " + " and sol.pk.dateto = :dateto"; + + /** + * Metodo que devuelve una solicitud por medio de la cuenta que ha creado y el estado de la solicitud + * + * @param pEntityManager + * @param paccount + * @param pcompany + * @param status + * @return + * @throws Exception + */ + public static TgeneSolicitude findByAccountAndStatus(EntityManager pEntityManager, String paccount, Integer pcompany, String status) + throws Exception { + Query qry = pEntityManager.createQuery(TgeneSolicitude.JPQL_SOLICITUDE_BY_ACCOUNT_AND_STATUS); + qry.setParameter("account", paccount); + qry.setParameter("company", pcompany); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + qry.setParameter("statuscode", status); + qry.setMaxResults(1); + if (qry.getResultList().isEmpty()) { + return null; + } + return (TgeneSolicitude) qry.getResultList().get(0); + } + + /** + * Metodo que devuelve una solicitud por medio de la cuenta que ha creado + * + * @param pEntityManager + * @param paccount + * @param pcompany + * @return + * @throws Exception + */ + public static TgeneSolicitude findByAccount(EntityManager pEntityManager, String paccount, Integer pcompany) throws Exception { + Query qry = pEntityManager.createQuery(TgeneSolicitude.JPQL_SOLICITUDE_BY_ACCOUNT); + qry.setParameter("account", paccount); + qry.setParameter("company", pcompany); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + qry.setMaxResults(1); + return (TgeneSolicitude) qry.getResultList().get(0); + } + + private static final String JPQL_SOLICITUDE_APPDATE = " select min(datefrom) from TgeneSolicitude sol " + + " where sol.pk.solicitudnumber = :solicitudnumber" + " and sol.company = :company "; + + public static Date findApplicationDate(EntityManager pEntityManager, String solicitudnumber, Integer company) { + Query qry = pEntityManager.createQuery(TgeneSolicitude.JPQL_SOLICITUDE_APPDATE); + qry.setParameter("solicitudnumber", solicitudnumber); + qry.setParameter("company", company); + Timestamp obj = (Timestamp) qry.getSingleResult(); + return new Date(obj.getTime()); + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeCreditOpening.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeCreditOpening.java.svn-base new file mode 100644 index 0000000..4e1c68a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeCreditOpening.java.svn-base @@ -0,0 +1,332 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDECREDITOPENING*/ +@Entity(name="TgeneSolicitudeCreditOpening") +@Table(name="TGENESOLICITUDECREDITOPENING") +public class TgeneSolicitudeCreditOpening extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeCreditOpening +*/ +@EmbeddedId +private TgeneSolicitudeCreditOpeningKey pk; +@Column(name="CURRENCYCODE", nullable=true) + +/** +* Codigo de moneda en la que esta expresado el valor a aplicar dependiendo al forma de debito +*/ +private String currencycode; + +@Column(name="CASH", nullable=true) + +/** +* Indica que el valor se entrega en efectivo. +*/ +private String cash; + +@Column(name="CHECKS", nullable=true) + +/** +* Indica que el valor se entrega en cheques. +*/ +private String checks; + +@Column(name="CREDIT", nullable=true) + +/** +* Indica que el valor se entrega con credito a uan cuenta o credito a un codigo contable. +*/ +private String credit; + +@Column(name="CREDITACCOUNT", nullable=true) + +/** +* Numero de cuenta a la vista a realizar el credito, si la moneda de la cuenta es diferente a la moneda en la cual esta expresado el valor se tiene que hacer la compra venta de divisas +*/ +private String creditaccount; + +@Column(name="CREDITACCOUNTINGCODE", nullable=true) + +/** +* Codigo contable a relaizar el credito. +*/ +private String creditaccountingcode; + +@Column(name="VALUE", nullable=true) + +/** +* Valor en la moneda de la solicitud, la compra venta se hace en funcion a la moneda de la cuenta credito +*/ +private BigDecimal value; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona a emitir el cheque +*/ +private Integer personcode; + +@Column(name="IDBENEFICIARY", nullable=true) + +/** +* Si no esta registrado como cliente, identificacion del beneficiario del cheque +*/ +private String idbeneficiary; + +@Column(name="BENEFICIARYNAME", nullable=true) + +/** +* Nombre del beneficiario del cheque. +*/ +private String beneficiaryname; + +/**Contructor por defecto*/ +public TgeneSolicitudeCreditOpening(){ +} +/**Contructor de TgeneSolicitudeCreditOpening +@param pPk Clave Primaria del entity +*/ +public TgeneSolicitudeCreditOpening(TgeneSolicitudeCreditOpeningKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSolicitudeCreditOpening +*/ +public static TgeneSolicitudeCreditOpening find(EntityManager pEntityManager,TgeneSolicitudeCreditOpeningKey pKey) throws Exception{ + TgeneSolicitudeCreditOpening obj = pEntityManager.find(TgeneSolicitudeCreditOpening.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSolicitudeCreditOpening +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeCreditOpening +*/ +public TgeneSolicitudeCreditOpeningKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeCreditOpening +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeCreditOpening +*/ +public void setPk(TgeneSolicitudeCreditOpeningKey pPk){ + pk=pPk; +} +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de cash +@return valor de cash*/ +public String getCash(){ + return cash; +} +/**Fija el valor de cash +@param pCash nuevo Valor de cash*/ +public void setCash(String pCash){ + cash=pCash; +} + +/**Obtiene el valor de checks +@return valor de checks*/ +public String getChecks(){ + return checks; +} +/**Fija el valor de checks +@param pChecks nuevo Valor de checks*/ +public void setChecks(String pChecks){ + checks=pChecks; +} + +/**Obtiene el valor de credit +@return valor de credit*/ +public String getCredit(){ + return credit; +} +/**Fija el valor de credit +@param pCredit nuevo Valor de credit*/ +public void setCredit(String pCredit){ + credit=pCredit; +} + +/**Obtiene el valor de creditaccount +@return valor de creditaccount*/ +public String getCreditaccount(){ + return creditaccount; +} +/**Fija el valor de creditaccount +@param pCreditaccount nuevo Valor de creditaccount*/ +public void setCreditaccount(String pCreditaccount){ + creditaccount=pCreditaccount; +} + +/**Obtiene el valor de creditaccountingcode +@return valor de creditaccountingcode*/ +public String getCreditaccountingcode(){ + return creditaccountingcode; +} +/**Fija el valor de creditaccountingcode +@param pCreditaccountingcode nuevo Valor de creditaccountingcode*/ +public void setCreditaccountingcode(String pCreditaccountingcode){ + creditaccountingcode=pCreditaccountingcode; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de idbeneficiary +@return valor de idbeneficiary*/ +public String getIdbeneficiary(){ + return idbeneficiary; +} +/**Fija el valor de idbeneficiary +@param pIdbeneficiary nuevo Valor de idbeneficiary*/ +public void setIdbeneficiary(String pIdbeneficiary){ + idbeneficiary=pIdbeneficiary; +} + +/**Obtiene el valor de beneficiaryname +@return valor de beneficiaryname*/ +public String getBeneficiaryname(){ + return beneficiaryname; +} +/**Fija el valor de beneficiaryname +@param pBeneficiaryname nuevo Valor de beneficiaryname*/ +public void setBeneficiaryname(String pBeneficiaryname){ + beneficiaryname=pBeneficiaryname; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeCreditOpening))return false; + TgeneSolicitudeCreditOpening that = (TgeneSolicitudeCreditOpening) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeCreditOpening +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSolicitudeCreditOpening +*/ +public Object createInstance(){ + TgeneSolicitudeCreditOpening instance=new TgeneSolicitudeCreditOpening(); + instance.setPk(new TgeneSolicitudeCreditOpeningKey()); + return instance; +} +/**Clona la entidad TgeneSolicitudeCreditOpening +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeCreditOpening p=(TgeneSolicitudeCreditOpening)this.clone(); + p.setPk((TgeneSolicitudeCreditOpeningKey)this.pk.cloneMe()); + return p; +} + //Metodos manuales. + /**Sentencia que devuelve uan lista con los valores a entregar al cliente asociados a una solicitud.*/ + private static final String HQL_SOLICITUDE_CREDIT = + " from TgeneSolicitudeCreditOpening t " + + " where t.pk.solicitudnumber = :solicitudnumber "+ + " and t.pk.solicitudsequence = :solicitudsequence "+ + " order by t.pk.creditsequence "; + + /** + * Metodo que entrega una lista de valores a entregar al cliente, en la aperturad e una operacion. + * @param pSolicitudNumber Numero de solicitud. + * @param pSolicitudSequence Secuencia dentro de la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List find(EntityManager pEntityManager, + String pSolicitudNumber,Integer pSolicitudSequence) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_SOLICITUDE_CREDIT); + qry.setParameter("solicitudnumber", pSolicitudNumber); + qry.setParameter("solicitudsequence", pSolicitudSequence); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeCreditOpeningKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeCreditOpeningKey.java.svn-base new file mode 100644 index 0000000..e5d1c1b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeCreditOpeningKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDECREDITOPENING*/ +@Embeddable +public class TgeneSolicitudeCreditOpeningKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="CREDITSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de debito, utilizada para formar el pk y permitir ingresar varias opciones de credito. +*/ +private Integer creditsequence; + +/**Contructor por defecto*/ +public TgeneSolicitudeCreditOpeningKey(){} +/**Contructor de TgeneSolicitudeCreditOpeningKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pCreditsequence Secuencia de debito, utilizada para formar el pk y permitir ingresar varias opciones de credito. +*/ +public TgeneSolicitudeCreditOpeningKey(String pSolicitudnumber,Integer pSolicitudsequence,Integer pCreditsequence){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + creditsequence=pCreditsequence; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de creditsequence +@return valor de creditsequence*/ +public Integer getCreditsequence(){ + return creditsequence; +} +/**Fija el valor de creditsequence +@param pCreditsequence nuevo Valor de creditsequence*/ +public void setCreditsequence(Integer pCreditsequence){ + creditsequence=pCreditsequence; +} + +/**Implementacin de la comparacin de TgeneSolicitudeCreditOpeningKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeCreditOpeningKey))return false; + TgeneSolicitudeCreditOpeningKey that = (TgeneSolicitudeCreditOpeningKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getCreditsequence() == null || that.getCreditsequence() == null){ + return false; + } + if (! this.getCreditsequence().equals(that.getCreditsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeCreditOpeningKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getCreditsequence() == null ? 0 : this.getCreditsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeDebitOpening.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeDebitOpening.java.svn-base new file mode 100644 index 0000000..a70f66f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeDebitOpening.java.svn-base @@ -0,0 +1,297 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDEDEBITOPENING*/ +@Entity(name="TgeneSolicitudeDebitOpening") +@Table(name="TGENESOLICITUDEDEBITOPENING") +public class TgeneSolicitudeDebitOpening extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeDebitOpening +*/ +@EmbeddedId +private TgeneSolicitudeDebitOpeningKey pk; +@Column(name="CURRENCYCODE", nullable=true) + +/** +* Codigo de moneda en la que esta expresado el valor a aplicar dependiendo al forma de debito +*/ +private String currencycode; + +@Column(name="CASH", nullable=true) + +/** +* Indica que el valor se cobra en efectivo. +*/ +private String cash; + +@Column(name="CHECKS", nullable=true) + +/** +* Indica que el valor se cobra en cheques. +*/ +private String checks; + +@Column(name="DEBIT", nullable=true) + +/** +* Indica que el valor se cobra con debito a uan cuenta o debito a un codigo contable. +*/ +private String debit; + +@Column(name="DEBITACCOUNT", nullable=true) + +/** +* Numero de cuenta a la vista a debitar, si la moneda de la cuenta es diferente a la moneda en la cual esta expresado el valor se tiene que hacer la compra venta de divisas +*/ +private String debitaccount; + +@Column(name="ACCOUNTMODULE", nullable=true) + +/** +* Codigo de modulo al que pertenece la cuenta +*/ +private String accountmodule; + +@Column(name="DEBITACCOUNTINGCODE", nullable=true) + +/** +* Codigo contable a relaizar el debito de la cuenta. +*/ +private String debitaccountingcode; + +@Column(name="VALUE", nullable=true) + +/** +* Valor en la moneda de la solicitud, la compra venta se hace en funcion a la moneda de la cuenta debito +*/ +private BigDecimal value; + +/**Contructor por defecto*/ +public TgeneSolicitudeDebitOpening(){ +} +/**Contructor de TgeneSolicitudeDebitOpening +@param pPk Clave Primaria del entity +*/ +public TgeneSolicitudeDebitOpening(TgeneSolicitudeDebitOpeningKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSolicitudeDebitOpening +*/ +public static TgeneSolicitudeDebitOpening find(EntityManager pEntityManager,TgeneSolicitudeDebitOpeningKey pKey) throws Exception{ + TgeneSolicitudeDebitOpening obj = pEntityManager.find(TgeneSolicitudeDebitOpening.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSolicitudeDebitOpening +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeDebitOpening +*/ +public TgeneSolicitudeDebitOpeningKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeDebitOpening +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeDebitOpening +*/ +public void setPk(TgeneSolicitudeDebitOpeningKey pPk){ + pk=pPk; +} +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de cash +@return valor de cash*/ +public String getCash(){ + return cash; +} +/**Fija el valor de cash +@param pCash nuevo Valor de cash*/ +public void setCash(String pCash){ + cash=pCash; +} + +/**Obtiene el valor de checks +@return valor de checks*/ +public String getChecks(){ + return checks; +} +/**Fija el valor de checks +@param pChecks nuevo Valor de checks*/ +public void setChecks(String pChecks){ + checks=pChecks; +} + +/**Obtiene el valor de debit +@return valor de debit*/ +public String getDebit(){ + return debit; +} +/**Fija el valor de debit +@param pDebit nuevo Valor de debit*/ +public void setDebit(String pDebit){ + debit=pDebit; +} + +/**Obtiene el valor de debitaccount +@return valor de debitaccount*/ +public String getDebitaccount(){ + return debitaccount; +} +/**Fija el valor de debitaccount +@param pDebitaccount nuevo Valor de debitaccount*/ +public void setDebitaccount(String pDebitaccount){ + debitaccount=pDebitaccount; +} + +/**Obtiene el valor de accountmodule +@return valor de accountmodule*/ +public String getAccountmodule(){ + return accountmodule; +} +/**Fija el valor de accountmodule +@param pAccountmodule nuevo Valor de accountmodule*/ +public void setAccountmodule(String pAccountmodule){ + accountmodule=pAccountmodule; +} + +/**Obtiene el valor de debitaccountingcode +@return valor de debitaccountingcode*/ +public String getDebitaccountingcode(){ + return debitaccountingcode; +} +/**Fija el valor de debitaccountingcode +@param pDebitaccountingcode nuevo Valor de debitaccountingcode*/ +public void setDebitaccountingcode(String pDebitaccountingcode){ + debitaccountingcode=pDebitaccountingcode; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeDebitOpening))return false; + TgeneSolicitudeDebitOpening that = (TgeneSolicitudeDebitOpening) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeDebitOpening +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSolicitudeDebitOpening +*/ +public Object createInstance(){ + TgeneSolicitudeDebitOpening instance=new TgeneSolicitudeDebitOpening(); + instance.setPk(new TgeneSolicitudeDebitOpeningKey()); + return instance; +} +/**Clona la entidad TgeneSolicitudeDebitOpening +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeDebitOpening p=(TgeneSolicitudeDebitOpening)this.clone(); + p.setPk((TgeneSolicitudeDebitOpeningKey)this.pk.cloneMe()); + return p; +} + + //Metodos manuales + /**Sentencia que devuelve uan lista con los valores de cargos asociados a una solicitud.*/ + private static final String HQL_SOLICITUDE_DEBIT = + "from TgeneSolicitudeDebitOpening tsdo " + + " where tsdo.pk.solicitudnumber = :solicitudnumber "+ + " and tsdo.pk.solicitudsequence = :solicitudsequence "+ + " order by tsdo.pk.debitsequence "; + + /** + * Metodo que entrega una lista de valores a cobrar al cliente, en la aperturad e una operacion. + * @param pSolicitudNumber Numero de solicitud. + * @param pSolicitudSequence Secuencia dentro de la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager,String pSolicitudNumber, + Integer pSolicitudSequence) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_SOLICITUDE_DEBIT); + qry.setParameter("solicitudnumber", pSolicitudNumber); + qry.setParameter("solicitudsequence", pSolicitudSequence); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeDebitOpeningKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeDebitOpeningKey.java.svn-base new file mode 100644 index 0000000..ebf28ad --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeDebitOpeningKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDEDEBITOPENING*/ +@Embeddable +public class TgeneSolicitudeDebitOpeningKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="DEBITSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de debito, utilizada para formar el pk y permitir ingresar varias opciones de debito. +*/ +private Integer debitsequence; + +/**Contructor por defecto*/ +public TgeneSolicitudeDebitOpeningKey(){} +/**Contructor de TgeneSolicitudeDebitOpeningKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pDebitsequence Secuencia de debito, utilizada para formar el pk y permitir ingresar varias opciones de debito. +*/ +public TgeneSolicitudeDebitOpeningKey(String pSolicitudnumber,Integer pSolicitudsequence,Integer pDebitsequence){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + debitsequence=pDebitsequence; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de debitsequence +@return valor de debitsequence*/ +public Integer getDebitsequence(){ + return debitsequence; +} +/**Fija el valor de debitsequence +@param pDebitsequence nuevo Valor de debitsequence*/ +public void setDebitsequence(Integer pDebitsequence){ + debitsequence=pDebitsequence; +} + +/**Implementacin de la comparacin de TgeneSolicitudeDebitOpeningKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeDebitOpeningKey))return false; + TgeneSolicitudeDebitOpeningKey that = (TgeneSolicitudeDebitOpeningKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getDebitsequence() == null || that.getDebitsequence() == null){ + return false; + } + if (! this.getDebitsequence().equals(that.getDebitsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeDebitOpeningKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getDebitsequence() == null ? 0 : this.getDebitsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeInstallCharges.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeInstallCharges.java.svn-base new file mode 100644 index 0000000..b046cc9 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeInstallCharges.java.svn-base @@ -0,0 +1,242 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDEINSTALLCHARGES*/ +@Entity(name="TgeneSolicitudeInstallCharges") +@Table(name="TGENESOLICITUDEINSTALLCHARGES") +public class TgeneSolicitudeInstallCharges extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeInstallCharges +*/ +@EmbeddedId +private TgeneSolicitudeInstallChargesKey pk; +@Column(name="BASEAMOUNTBALANCETYPE", nullable=true) + +/** +* Tipo de saldo del cual se toma el monto para calcular el tarifario. +*/ +private String baseamountbalancetype; + +@Column(name="BASEAMOUNTBALANCEGROUP", nullable=true) + +/** +* Grupo de balance del tipo de saldo del cual se toma el monto para calcular el tarifario. +*/ +private String baseamountbalancegroup; + +@Column(name="CALCULATEORDER", nullable=true) + +/** +* Orden de calculo de los cargos. +*/ +private Integer calculateorder; + +@Column(name="NEGOTIABLE", nullable=true) + +/** +* Indica si la tasa se puede negociar con el cliente el valor y las condiciones del cargo +*/ +private String negotiable; + +@Column(name="VALUE", nullable=true) + +/** +* Valor del cargo en la moneda de la operacion +*/ +private BigDecimal value; + +/**Contructor por defecto*/ +public TgeneSolicitudeInstallCharges(){ +} +/**Contructor de TgeneSolicitudeInstallCharges +@param pPk Clave Primaria del entity +*/ +public TgeneSolicitudeInstallCharges(TgeneSolicitudeInstallChargesKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSolicitudeInstallCharges +*/ +public static TgeneSolicitudeInstallCharges find(EntityManager pEntityManager,TgeneSolicitudeInstallChargesKey pKey) throws Exception{ + TgeneSolicitudeInstallCharges obj = pEntityManager.find(TgeneSolicitudeInstallCharges.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSolicitudeInstallCharges +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeInstallCharges +*/ +public TgeneSolicitudeInstallChargesKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeInstallCharges +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeInstallCharges +*/ +public void setPk(TgeneSolicitudeInstallChargesKey pPk){ + pk=pPk; +} +/**Obtiene el valor de baseamountbalancetype +@return valor de baseamountbalancetype*/ +public String getBaseamountbalancetype(){ + return baseamountbalancetype; +} +/**Fija el valor de baseamountbalancetype +@param pBaseamountbalancetype nuevo Valor de baseamountbalancetype*/ +public void setBaseamountbalancetype(String pBaseamountbalancetype){ + baseamountbalancetype=pBaseamountbalancetype; +} + +/**Obtiene el valor de baseamountbalancegroup +@return valor de baseamountbalancegroup*/ +public String getBaseamountbalancegroup(){ + return baseamountbalancegroup; +} +/**Fija el valor de baseamountbalancegroup +@param pBaseamountbalancegroup nuevo Valor de baseamountbalancegroup*/ +public void setBaseamountbalancegroup(String pBaseamountbalancegroup){ + baseamountbalancegroup=pBaseamountbalancegroup; +} + +/**Obtiene el valor de calculateorder +@return valor de calculateorder*/ +public Integer getCalculateorder(){ + return calculateorder; +} +/**Fija el valor de calculateorder +@param pCalculateorder nuevo Valor de calculateorder*/ +public void setCalculateorder(Integer pCalculateorder){ + calculateorder=pCalculateorder; +} + +/**Obtiene el valor de negotiable +@return valor de negotiable*/ +public String getNegotiable(){ + return negotiable; +} +/**Fija el valor de negotiable +@param pNegotiable nuevo Valor de negotiable*/ +public void setNegotiable(String pNegotiable){ + negotiable=pNegotiable; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeInstallCharges))return false; + TgeneSolicitudeInstallCharges that = (TgeneSolicitudeInstallCharges) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeInstallCharges +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSolicitudeInstallCharges +*/ +public Object createInstance(){ + TgeneSolicitudeInstallCharges instance=new TgeneSolicitudeInstallCharges(); + instance.setPk(new TgeneSolicitudeInstallChargesKey()); + return instance; +} +/**Clona la entidad TgeneSolicitudeInstallCharges +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeInstallCharges p=(TgeneSolicitudeInstallCharges)this.clone(); + p.setPk((TgeneSolicitudeInstallChargesKey)this.pk.cloneMe()); + return p; +} + + //Metodos manuales. + /**Sentencia que devuelve la definicion de cargos a adicionar a la tabla de amortizacion.*/ + private static final String HQL_SOLICITUDE_INSTALLMENT_CHARGES = + "from TgeneSolicitudeInstallCharges t " + + " where t.pk.solicitudnumber = :solicitudnumber " + + " and t.pk.solicitudsequence = :solicitudsequence "; + + /** + * Metodo que entrega una lista con los cargos a adicionar a la tabla de amortizacion para una solicitud. + * @param pSolicitudeNumber Numero de solicitud. + * @param pSolicitudeSequence Secuencia interna de la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager,String pSolicitudeNumber, + Integer pSolicitudeSequence) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_SOLICITUDE_INSTALLMENT_CHARGES); + qry.setParameter("solicitudnumber", pSolicitudeNumber); + qry.setParameter("solicitudsequence", pSolicitudeSequence); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeInstallChargesKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeInstallChargesKey.java.svn-base new file mode 100644 index 0000000..f524d43 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeInstallChargesKey.java.svn-base @@ -0,0 +1,313 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDEINSTALLCHARGES*/ +@Embeddable +public class TgeneSolicitudeInstallChargesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda de la cuenta +*/ +private String currencycode; + +/**Contructor por defecto*/ +public TgeneSolicitudeInstallChargesKey(){} +/**Contructor de TgeneSolicitudeInstallChargesKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pBalancetype Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pStatuscode Estatus de cuenta +@param pCurrencycode Codigo de moneda de la cuenta +*/ +public TgeneSolicitudeInstallChargesKey(String pSolicitudnumber,Integer pSolicitudsequence,String pBalancetype,String pBalancegroup,String pModulecode,String pProductcode,String pSubproductcode,String pStatuscode,String pCurrencycode){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + balancetype=pBalancetype; + balancegroup=pBalancegroup; + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + statuscode=pStatuscode; + currencycode=pCurrencycode; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Implementacin de la comparacin de TgeneSolicitudeInstallChargesKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeInstallChargesKey))return false; + TgeneSolicitudeInstallChargesKey that = (TgeneSolicitudeInstallChargesKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeInstallChargesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeInstallRates.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeInstallRates.java.svn-base new file mode 100644 index 0000000..8d64682 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeInstallRates.java.svn-base @@ -0,0 +1,641 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDEINSTALLRATES */ +@Entity(name = "TgeneSolicitudeInstallRates") +@Table(name = "TGENESOLICITUDEINSTALLRATES") +public class TgeneSolicitudeInstallRates extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneSolicitudeInstallRates + */ + @EmbeddedId + private TgeneSolicitudeInstallRatesKey pk; + + @Column(name = "BASERATECATALOG", nullable = true) + /** + * Codigo de catalogo de tasas base, BCE tasa banco central + */ + private String baseratecatalog; + + @Column(name = "BASERATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo BASERATE + */ + private String baseratecatalogcode; + + @Column(name = "PRINCIPALBALANCETYPE", nullable = true) + /** + * Cdigo de tipo de capital sobre el cual se aplica una tasa y se calcula un valor a provisionar + */ + private String principalbalancetype; + + @Column(name = "PRINCIPALBALANCEGROUP", nullable = true) + /** + * Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor + */ + private String principalbalancegroup; + + @Column(name = "NEGOTIABLE", nullable = true) + /** + * Indica si la tasa se puede negociar con el cliente + */ + private String negotiable; + + @Column(name = "BASERATE", nullable = true) + /** + * Tasa base + */ + private BigDecimal baserate; + + @Column(name = "MARGIN", nullable = true) + /** + * Margen a aplicar dado el operador + */ + private BigDecimal margin; + + @Column(name = "OPERATOR", nullable = true) + /** + * Operador a aplicar sobre la tasa base, +, - , % + */ + private String operator; + + @Column(name = "RATE", nullable = true) + /** + * Tasa total con la cual se calcula provisiones y tabla de pagos + */ + private BigDecimal rate; + + @Column(name = "READJUSTMENTOPERATOR", nullable = true) + /** + * Operador que se utilizara el momento del reajuste + */ + private String readjustmentoperator; + + @Column(name = "READJUSTMENTMARGIN", nullable = true) + /** + * Margen a aplicar en el reajuste + */ + private BigDecimal readjustmentmargin; + + @Column(name = "EFFECTIVERATE", nullable = true) + /** + * Tasa Efectiva + */ + private BigDecimal effectiverate; + + @Column(name = "ISNOMINALRATE", nullable = true) + /** + * Y, Indica que la defincion de la tasa base es efectiva, en este caso se calcula la tasa nominal, N la tasa base es nominal en este caso se calcula la tasa efectiva. + */ + private String isnominalrate; + + @Column(name = "READJUSTBASERATECATALOG", nullable = true) + /** + * Codigo de catalogo de tasas base de reajuste, BCE tasa banco central + */ + private String readjustbaseratecatalog; + + @Column(name = "READJUSTBASERATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo BASERATE + */ + private String readjustbaseratecatalogcode; + + @Column(name = "MAXBASERATECATALOG", nullable = true) + /** + * Codigo de catalogo de tasas base maxima, BCE tasa banco central + */ + private String maxbaseratecatalog; + + @Column(name = "MAXBASERATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo BASERATE + */ + private String maxbaseratecatalogcode; + + @Column(name = "MINRATE", nullable = true) + /** + * Minimo permitido en la negociacion del prestamo + */ + private BigDecimal minrate; + + @Column(name = "MAXRATE", nullable = true) + /** + * Maximo permitido en la negociacion del prestamo + */ + private BigDecimal maxrate; + + /** Contructor por defecto */ + public TgeneSolicitudeInstallRates() { + } + + /** + * Contructor de TgeneSolicitudeInstallRates + * + * @param pPk Clave Primaria del entity + */ + public TgeneSolicitudeInstallRates(TgeneSolicitudeInstallRatesKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSolicitudeInstallRates + */ + public static TgeneSolicitudeInstallRates find(EntityManager pEntityManager, TgeneSolicitudeInstallRatesKey pKey) throws Exception { + TgeneSolicitudeInstallRates obj = pEntityManager.find(TgeneSolicitudeInstallRates.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneSolicitudeInstallRates + * + * @return El objeto que referencia a la Clave primaria de TgeneSolicitudeInstallRates + */ + public TgeneSolicitudeInstallRatesKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneSolicitudeInstallRates + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeInstallRates + */ + public void setPk(TgeneSolicitudeInstallRatesKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de baseratecatalog + * + * @return valor de baseratecatalog + */ + public String getBaseratecatalog() { + return this.baseratecatalog; + } + + /** + * Fija el valor de baseratecatalog + * + * @param pBaseratecatalog nuevo Valor de baseratecatalog + */ + public void setBaseratecatalog(String pBaseratecatalog) { + this.baseratecatalog = pBaseratecatalog; + } + + /** + * Obtiene el valor de baseratecatalogcode + * + * @return valor de baseratecatalogcode + */ + public String getBaseratecatalogcode() { + return this.baseratecatalogcode; + } + + /** + * Fija el valor de baseratecatalogcode + * + * @param pBaseratecatalogcode nuevo Valor de baseratecatalogcode + */ + public void setBaseratecatalogcode(String pBaseratecatalogcode) { + this.baseratecatalogcode = pBaseratecatalogcode; + } + + /** + * Obtiene el valor de principalbalancetype + * + * @return valor de principalbalancetype + */ + public String getPrincipalbalancetype() { + return this.principalbalancetype; + } + + /** + * Fija el valor de principalbalancetype + * + * @param pPrincipalbalancetype nuevo Valor de principalbalancetype + */ + public void setPrincipalbalancetype(String pPrincipalbalancetype) { + this.principalbalancetype = pPrincipalbalancetype; + } + + /** + * Obtiene el valor de principalbalancegroup + * + * @return valor de principalbalancegroup + */ + public String getPrincipalbalancegroup() { + return this.principalbalancegroup; + } + + /** + * Fija el valor de principalbalancegroup + * + * @param pPrincipalbalancegroup nuevo Valor de principalbalancegroup + */ + public void setPrincipalbalancegroup(String pPrincipalbalancegroup) { + this.principalbalancegroup = pPrincipalbalancegroup; + } + + /** + * Obtiene el valor de negotiable + * + * @return valor de negotiable + */ + public String getNegotiable() { + return this.negotiable; + } + + /** + * Fija el valor de negotiable + * + * @param pNegotiable nuevo Valor de negotiable + */ + public void setNegotiable(String pNegotiable) { + this.negotiable = pNegotiable; + } + + /** + * Obtiene el valor de baserate + * + * @return valor de baserate + */ + public BigDecimal getBaserate() { + return this.baserate; + } + + /** + * Fija el valor de baserate + * + * @param pBaserate nuevo Valor de baserate + */ + public void setBaserate(BigDecimal pBaserate) { + this.baserate = pBaserate; + } + + /** + * Obtiene el valor de margin + * + * @return valor de margin + */ + public BigDecimal getMargin() { + return this.margin; + } + + /** + * Fija el valor de margin + * + * @param pMargin nuevo Valor de margin + */ + public void setMargin(BigDecimal pMargin) { + this.margin = pMargin; + } + + /** + * Obtiene el valor de operator + * + * @return valor de operator + */ + public String getOperator() { + return this.operator; + } + + /** + * Fija el valor de operator + * + * @param pOperator nuevo Valor de operator + */ + public void setOperator(String pOperator) { + this.operator = pOperator; + } + + /** + * Obtiene el valor de rate + * + * @return valor de rate + */ + public BigDecimal getRate() { + return this.rate; + } + + /** + * Fija el valor de rate + * + * @param pRate nuevo Valor de rate + */ + public void setRate(BigDecimal pRate) { + this.rate = pRate; + } + + /** + * Obtiene el valor de readjustmentoperator + * + * @return valor de readjustmentoperator + */ + public String getReadjustmentoperator() { + return this.readjustmentoperator; + } + + /** + * Fija el valor de readjustmentoperator + * + * @param pReadjustmentoperator nuevo Valor de readjustmentoperator + */ + public void setReadjustmentoperator(String pReadjustmentoperator) { + this.readjustmentoperator = pReadjustmentoperator; + } + + /** + * Obtiene el valor de readjustmentmargin + * + * @return valor de readjustmentmargin + */ + public BigDecimal getReadjustmentmargin() { + return this.readjustmentmargin; + } + + /** + * Fija el valor de readjustmentmargin + * + * @param pReadjustmentmargin nuevo Valor de readjustmentmargin + */ + public void setReadjustmentmargin(BigDecimal pReadjustmentmargin) { + this.readjustmentmargin = pReadjustmentmargin; + } + + /** + * Obtiene el valor de effectiverate + * + * @return valor de effectiverate + */ + public BigDecimal getEffectiverate() { + return this.effectiverate; + } + + /** + * Fija el valor de effectiverate + * + * @param pEffectiverate nuevo Valor de effectiverate + */ + public void setEffectiverate(BigDecimal pEffectiverate) { + this.effectiverate = pEffectiverate; + } + + /** + * Obtiene el valor de isnominalrate + * + * @return valor de isnominalrate + */ + public String getIsnominalrate() { + return this.isnominalrate; + } + + /** + * Fija el valor de isnominalrate + * + * @param pIsnominalrate nuevo Valor de isnominalrate + */ + public void setIsnominalrate(String pIsnominalrate) { + this.isnominalrate = pIsnominalrate; + } + + /** + * Obtiene el valor de readjustbaseratecatalog + * + * @return valor de readjustbaseratecatalog + */ + public String getReadjustbaseratecatalog() { + return this.readjustbaseratecatalog; + } + + /** + * Fija el valor de readjustbaseratecatalog + * + * @param pReadjustbaseratecatalog nuevo Valor de readjustbaseratecatalog + */ + public void setReadjustbaseratecatalog(String pReadjustbaseratecatalog) { + this.readjustbaseratecatalog = pReadjustbaseratecatalog; + } + + /** + * Obtiene el valor de readjustbaseratecatalogcode + * + * @return valor de readjustbaseratecatalogcode + */ + public String getReadjustbaseratecatalogcode() { + return this.readjustbaseratecatalogcode; + } + + /** + * Fija el valor de readjustbaseratecatalogcode + * + * @param pReadjustbaseratecatalogcode nuevo Valor de readjustbaseratecatalogcode + */ + public void setReadjustbaseratecatalogcode(String pReadjustbaseratecatalogcode) { + this.readjustbaseratecatalogcode = pReadjustbaseratecatalogcode; + } + + /** + * Obtiene el valor de maxbaseratecatalog + * + * @return valor de maxbaseratecatalog + */ + public String getMaxbaseratecatalog() { + return this.maxbaseratecatalog; + } + + /** + * Fija el valor de maxbaseratecatalog + * + * @param pMaxbaseratecatalog nuevo Valor de maxbaseratecatalog + */ + public void setMaxbaseratecatalog(String pMaxbaseratecatalog) { + this.maxbaseratecatalog = pMaxbaseratecatalog; + } + + /** + * Obtiene el valor de maxbaseratecatalogcode + * + * @return valor de maxbaseratecatalogcode + */ + public String getMaxbaseratecatalogcode() { + return this.maxbaseratecatalogcode; + } + + /** + * Fija el valor de maxbaseratecatalogcode + * + * @param pMaxbaseratecatalogcode nuevo Valor de maxbaseratecatalogcode + */ + public void setMaxbaseratecatalogcode(String pMaxbaseratecatalogcode) { + this.maxbaseratecatalogcode = pMaxbaseratecatalogcode; + } + + /** + * Obtiene el valor de minrate + * + * @return valor de minrate + */ + public BigDecimal getMinrate() { + return this.minrate; + } + + /** + * Fija el valor de minrate + * + * @param pMinrate nuevo Valor de minrate + */ + public void setMinrate(BigDecimal pMinrate) { + this.minrate = pMinrate; + } + + /** + * Obtiene el valor de maxrate + * + * @return valor de maxrate + */ + public BigDecimal getMaxrate() { + return this.maxrate; + } + + /** + * Fija el valor de maxrate + * + * @param pMaxrate nuevo Valor de maxrate + */ + public void setMaxrate(BigDecimal pMaxrate) { + this.maxrate = pMaxrate; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneSolicitudeInstallRates)) { + return false; + } + TgeneSolicitudeInstallRates that = (TgeneSolicitudeInstallRates) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneSolicitudeInstallRates + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneSolicitudeInstallRates */ + @Override + public Object createInstance() { + TgeneSolicitudeInstallRates instance = new TgeneSolicitudeInstallRates(); + instance.setPk(new TgeneSolicitudeInstallRatesKey()); + return instance; + } + + /** + * Clona la entidad TgeneSolicitudeInstallRates + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneSolicitudeInstallRates p = (TgeneSolicitudeInstallRates) this.clone(); + p.setPk((TgeneSolicitudeInstallRatesKey) this.pk.cloneMe()); + return p; + } + + // Metodos manuales. + /** Sentencia que devuelve la definicion de valores a provisionar asociados de una solicitud. */ + private static final String HQL_SOLICITUDE_INSTALLMENT_RATES = "from TgeneSolicitudeInstallRates tsolinstrate " + + " where tsolinstrate.pk.solicitudnumber = :solicitudnumber " + " and tsolinstrate.pk.solicitudsequence = :solicitudsequence "; + + /** + * Metodo que entrega una lista con los tipos de saldos a calcular tabla de amortizacion para una solicitud. + * + * @param pSolicitudeNumber Numero de solicitud. + * @param pSolicitudeSequence Secuencia interna de la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pSolicitudeNumber, Integer pSolicitudeSequence) + throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(TgeneSolicitudeInstallRates.HQL_SOLICITUDE_INSTALLMENT_RATES); + qry.setParameter("solicitudnumber", pSolicitudeNumber); + qry.setParameter("solicitudsequence", pSolicitudeSequence); + lObjects = qry.getResultList(); + return lObjects; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeInstallRatesKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeInstallRatesKey.java.svn-base new file mode 100644 index 0000000..67f6dfc --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeInstallRatesKey.java.svn-base @@ -0,0 +1,286 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDEINSTALLRATES*/ +@Embeddable +public class TgeneSolicitudeInstallRatesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="INTERESTBALANCETYPE", nullable=false,updatable=false) + +/** +* Codigo de tipo de saldo que provisiona en la tabla de cuotas. +*/ +private String interestbalancetype; + +@Column(name="INTERESTBALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String interestbalancegroup; + +/**Contructor por defecto*/ +public TgeneSolicitudeInstallRatesKey(){} +/**Contructor de TgeneSolicitudeInstallRatesKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pCurrencycode Codigo de moneda +@param pInterestbalancetype Codigo de tipo de saldo que provisiona en la tabla de cuotas. +@param pInterestbalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +public TgeneSolicitudeInstallRatesKey(String pSolicitudnumber,Integer pSolicitudsequence,String pModulecode,String pProductcode,String pSubproductcode,String pCurrencycode,String pInterestbalancetype,String pInterestbalancegroup){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + currencycode=pCurrencycode; + interestbalancetype=pInterestbalancetype; + interestbalancegroup=pInterestbalancegroup; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de interestbalancetype +@return valor de interestbalancetype*/ +public String getInterestbalancetype(){ + return interestbalancetype; +} +/**Fija el valor de interestbalancetype +@param pInterestbalancetype nuevo Valor de interestbalancetype*/ +public void setInterestbalancetype(String pInterestbalancetype){ + interestbalancetype=pInterestbalancetype; +} + +/**Obtiene el valor de interestbalancegroup +@return valor de interestbalancegroup*/ +public String getInterestbalancegroup(){ + return interestbalancegroup; +} +/**Fija el valor de interestbalancegroup +@param pInterestbalancegroup nuevo Valor de interestbalancegroup*/ +public void setInterestbalancegroup(String pInterestbalancegroup){ + interestbalancegroup=pInterestbalancegroup; +} + +/**Implementacion de la comparacion de TgeneSolicitudeInstallRatesKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeInstallRatesKey))return false; + TgeneSolicitudeInstallRatesKey that = (TgeneSolicitudeInstallRatesKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getInterestbalancetype() == null || that.getInterestbalancetype() == null){ + return false; + } + if (! this.getInterestbalancetype().equals(that.getInterestbalancetype())){ + return false; + } + if (this.getInterestbalancegroup() == null || that.getInterestbalancegroup() == null){ + return false; + } + if (! this.getInterestbalancegroup().equals(that.getInterestbalancegroup())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneSolicitudeInstallRatesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getInterestbalancetype() == null ? 0 : this.getInterestbalancetype().hashCode()); + result = result * 37 + (this.getInterestbalancegroup() == null ? 0 : this.getInterestbalancegroup().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeKey.java.svn-base new file mode 100644 index 0000000..5e6ba12 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeKey.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pgeneral.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDE*/ +@Embeddable +public class TgeneSolicitudeKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro de solicitud +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TgeneSolicitudeKey(){} +/**Contructor de TgeneSolicitudeKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pDateto Fecha hasta la cual esta vigente el registro de solicitud +*/ +public TgeneSolicitudeKey(String pSolicitudnumber,Integer pSolicitudsequence,Timestamp pDateto){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + dateto=pDateto; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacion de la comparacion de TgeneSolicitudeKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeKey))return false; + TgeneSolicitudeKey that = (TgeneSolicitudeKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneSolicitudeKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeLiquidation.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeLiquidation.java.svn-base new file mode 100644 index 0000000..0577441 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeLiquidation.java.svn-base @@ -0,0 +1,333 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDELIQUIDATION*/ +@Entity(name="TgeneSolicitudeLiquidation") +@Table(name="TGENESOLICITUDELIQUIDATION") +public class TgeneSolicitudeLiquidation extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeLiquidation +*/ +@EmbeddedId +private TgeneSolicitudeLiquidationKey pk; +@Column(name="BASEAMOUNTBALANCETYPE", nullable=true) + +/** +* Tipo de saldo del cual se toma el monto para calcular el tarifario. +*/ +private String baseamountbalancetype; + +@Column(name="BASEAMOUNTBALANCEGROUP", nullable=true) + +/** +* Grupo de balance del tipo de saldo del cual se toma el monto para calcular el tarifario. +*/ +private String baseamountbalancegroup; + +@Column(name="CALCULATEORDER", nullable=true) + +/** +* CALCULATEORDER +*/ +private Integer calculateorder; + +@Column(name="NEGOTIABLE", nullable=true) + +/** +* Indica si la tasa se puede negociar con el cliente el valor y las condiciones del cargo +*/ +private String negotiable; + +@Column(name="INCREASE", nullable=true) + +/** +* Indica que incrementa el valor de capital con el cual se genera la tabla de pagos +*/ +private String increase; + +@Column(name="DECREASE", nullable=true) + +/** +* Indica que disminuye el valor de capital con el cual se genera la tabla de pagos +*/ +private String decrease; + +@Column(name="DECREASEDISBURSEMENT", nullable=true) + +/** +* Indica que el valor del cargo se descuenta del monto a entregar al cliente +*/ +private String decreasedisbursement; + +@Column(name="CASH", nullable=true) + +/** +* Indica que el valor se cobra en efectivo. +*/ +private String cash; + +@Column(name="DEBITACCOUNT", nullable=true) + +/** +* Indica que el valor se cobra con debito a una cuneta, esta puede ser cuenta contable o cuenta a la vista +*/ +private String debitaccount; + +@Column(name="VALUE", nullable=true) + +/** +* Valor del cargo en la moneda de la operacion +*/ +private BigDecimal value; + +/**Contructor por defecto*/ +public TgeneSolicitudeLiquidation(){ +} +/**Contructor de TgeneSolicitudeLiquidation +@param pPk Clave Primaria del entity +*/ +public TgeneSolicitudeLiquidation(TgeneSolicitudeLiquidationKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSolicitudeLiquidation +*/ +public static TgeneSolicitudeLiquidation find(EntityManager pEntityManager,TgeneSolicitudeLiquidationKey pKey) throws Exception{ + TgeneSolicitudeLiquidation obj = pEntityManager.find(TgeneSolicitudeLiquidation.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSolicitudeLiquidation +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeLiquidation +*/ +public TgeneSolicitudeLiquidationKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeLiquidation +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeLiquidation +*/ +public void setPk(TgeneSolicitudeLiquidationKey pPk){ + pk=pPk; +} +/**Obtiene el valor de baseamountbalancetype +@return valor de baseamountbalancetype*/ +public String getBaseamountbalancetype(){ + return baseamountbalancetype; +} +/**Fija el valor de baseamountbalancetype +@param pBaseamountbalancetype nuevo Valor de baseamountbalancetype*/ +public void setBaseamountbalancetype(String pBaseamountbalancetype){ + baseamountbalancetype=pBaseamountbalancetype; +} + +/**Obtiene el valor de baseamountbalancegroup +@return valor de baseamountbalancegroup*/ +public String getBaseamountbalancegroup(){ + return baseamountbalancegroup; +} +/**Fija el valor de baseamountbalancegroup +@param pBaseamountbalancegroup nuevo Valor de baseamountbalancegroup*/ +public void setBaseamountbalancegroup(String pBaseamountbalancegroup){ + baseamountbalancegroup=pBaseamountbalancegroup; +} + +/**Obtiene el valor de calculateorder +@return valor de calculateorder*/ +public Integer getCalculateorder(){ + return calculateorder; +} +/**Fija el valor de calculateorder +@param pCalculateorder nuevo Valor de calculateorder*/ +public void setCalculateorder(Integer pCalculateorder){ + calculateorder=pCalculateorder; +} + +/**Obtiene el valor de negotiable +@return valor de negotiable*/ +public String getNegotiable(){ + return negotiable; +} +/**Fija el valor de negotiable +@param pNegotiable nuevo Valor de negotiable*/ +public void setNegotiable(String pNegotiable){ + negotiable=pNegotiable; +} + +/**Obtiene el valor de increase +@return valor de increase*/ +public String getIncrease(){ + return increase; +} +/**Fija el valor de increase +@param pIncrease nuevo Valor de increase*/ +public void setIncrease(String pIncrease){ + increase=pIncrease; +} + +/**Obtiene el valor de decrease +@return valor de decrease*/ +public String getDecrease(){ + return decrease; +} +/**Fija el valor de decrease +@param pDecrease nuevo Valor de decrease*/ +public void setDecrease(String pDecrease){ + decrease=pDecrease; +} + +/**Obtiene el valor de decreasedisbursement +@return valor de decreasedisbursement*/ +public String getDecreasedisbursement(){ + return decreasedisbursement; +} +/**Fija el valor de decreasedisbursement +@param pDecreasedisbursement nuevo Valor de decreasedisbursement*/ +public void setDecreasedisbursement(String pDecreasedisbursement){ + decreasedisbursement=pDecreasedisbursement; +} + +/**Obtiene el valor de cash +@return valor de cash*/ +public String getCash(){ + return cash; +} +/**Fija el valor de cash +@param pCash nuevo Valor de cash*/ +public void setCash(String pCash){ + cash=pCash; +} + +/**Obtiene el valor de debitaccount +@return valor de debitaccount*/ +public String getDebitaccount(){ + return debitaccount; +} +/**Fija el valor de debitaccount +@param pDebitaccount nuevo Valor de debitaccount*/ +public void setDebitaccount(String pDebitaccount){ + debitaccount=pDebitaccount; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeLiquidation))return false; + TgeneSolicitudeLiquidation that = (TgeneSolicitudeLiquidation) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeLiquidation +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSolicitudeLiquidation +*/ +public Object createInstance(){ + TgeneSolicitudeLiquidation instance=new TgeneSolicitudeLiquidation(); + instance.setPk(new TgeneSolicitudeLiquidationKey()); + return instance; +} +/**Clona la entidad TgeneSolicitudeLiquidation +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeLiquidation p=(TgeneSolicitudeLiquidation)this.clone(); + p.setPk((TgeneSolicitudeLiquidationKey)this.pk.cloneMe()); + return p; +} + + //Metodos manuales. + /**Sentencia que devuelve uan lista con los valores a entregar al cliente asociados a una solicitud.*/ + private static final String HQL_SOLICITUDE_LIQUIDATION = + " from TgeneSolicitudeLiquidation t " + + " where t.pk.solicitudnumber = :solicitudnumber "+ + " and t.pk.solicitudsequence = :solicitudsequence "; + + /** + * Metodo que entrega una lista con los cargos de liquidacion de una solicitud. + * @param pSolicitudNumber Numero de solicitud. + * @param pSolicitudSequence Secuencia dentro de la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, + String pSolicitudNumber,Integer pSolicitudSequence) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_SOLICITUDE_LIQUIDATION); + qry.setParameter("solicitudnumber", pSolicitudNumber); + qry.setParameter("solicitudsequence", pSolicitudSequence); + lObjects = qry.getResultList(); + return lObjects; + } + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeLiquidationKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeLiquidationKey.java.svn-base new file mode 100644 index 0000000..f3adb5c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeLiquidationKey.java.svn-base @@ -0,0 +1,313 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDELIQUIDATION*/ +@Embeddable +public class TgeneSolicitudeLiquidationKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. de valores a cobrar en la liquidacion de una operacion +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +/**Contructor por defecto*/ +public TgeneSolicitudeLiquidationKey(){} +/**Contructor de TgeneSolicitudeLiquidationKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pStatuscode Estatus de cuenta +@param pCurrencycode Codigo de moneda +@param pBalancetype Cdigo de tipo de saldo. de valores a cobrar en la liquidacion de una operacion +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +public TgeneSolicitudeLiquidationKey(String pSolicitudnumber,Integer pSolicitudsequence,String pModulecode,String pProductcode,String pSubproductcode,String pStatuscode,String pCurrencycode,String pBalancetype,String pBalancegroup){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + statuscode=pStatuscode; + currencycode=pCurrencycode; + balancetype=pBalancetype; + balancegroup=pBalancegroup; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Implementacin de la comparacin de TgeneSolicitudeLiquidationKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeLiquidationKey))return false; + TgeneSolicitudeLiquidationKey that = (TgeneSolicitudeLiquidationKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeLiquidationKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeNumber.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeNumber.java.svn-base new file mode 100644 index 0000000..124a09c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeNumber.java.svn-base @@ -0,0 +1,121 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDENUMBER*/ +@Entity(name="TgeneSolicitudeNumber") +@Table(name="TGENESOLICITUDENUMBER") +public class TgeneSolicitudeNumber extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeNumber +*/ +@EmbeddedId +private TgeneSolicitudeNumberKey pk; +/**Contructor por defecto*/ +public TgeneSolicitudeNumber(){ +} +/**Contructor de TgeneSolicitudeNumber +@param pPk Clave Primaria del entity +*/ +public TgeneSolicitudeNumber(TgeneSolicitudeNumberKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSolicitudeNumber +*/ +public static TgeneSolicitudeNumber find(EntityManager pEntityManager,TgeneSolicitudeNumberKey pKey) throws Exception{ + TgeneSolicitudeNumber obj = pEntityManager.find(TgeneSolicitudeNumber.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSolicitudeNumber +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeNumber +*/ +public TgeneSolicitudeNumberKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeNumber +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeNumber +*/ +public void setPk(TgeneSolicitudeNumberKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeNumber))return false; + TgeneSolicitudeNumber that = (TgeneSolicitudeNumber) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeNumber +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSolicitudeNumber +*/ +public Object createInstance(){ + TgeneSolicitudeNumber instance=new TgeneSolicitudeNumber(); + instance.setPk(new TgeneSolicitudeNumberKey()); + return instance; +} +/**Clona la entidad TgeneSolicitudeNumber +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeNumber p=(TgeneSolicitudeNumber)this.clone(); + p.setPk((TgeneSolicitudeNumberKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeNumberKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeNumberKey.java.svn-base new file mode 100644 index 0000000..c2f0197 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeNumberKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDENUMBER*/ +@Embeddable +public class TgeneSolicitudeNumberKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +/**Contructor por defecto*/ +public TgeneSolicitudeNumberKey(){} +/**Contructor de TgeneSolicitudeNumberKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +*/ +public TgeneSolicitudeNumberKey(String pSolicitudnumber,Integer pSolicitudsequence){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Implementacin de la comparacin de TgeneSolicitudeNumberKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeNumberKey))return false; + TgeneSolicitudeNumberKey that = (TgeneSolicitudeNumberKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeNumberKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeRelationship.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeRelationship.java.svn-base new file mode 100644 index 0000000..dea174d --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeRelationship.java.svn-base @@ -0,0 +1,294 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.persistence.commondb.exception.CommondbException; + +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDERELATIONSHIP*/ +@Entity(name="TgeneSolicitudeRelationship") +@Table(name="TGENESOLICITUDERELATIONSHIP") +public class TgeneSolicitudeRelationship extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeRelationship +*/ +@EmbeddedId +private TgeneSolicitudeRelationshipKey pk; +@Column(name="MODULECODE", nullable=true) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="RELATIONSHIPCODE", nullable=true) + +/** +* Codigo de relacion de la cuenta con el cliente +*/ +private String relationshipcode; + +@Column(name="ISPRINCIPAL", nullable=true) + +/** +* Indica si el codigo de relacion es principal, en este caso el codigo de cliente se asocia a la tabla tgeneaccount +*/ +private String isprincipal; + +@Column(name="PRIORITY", nullable=true) + +/** +* Prioridad del cleinte con la solicitud. +*/ +private Integer priority; + +@Column(name="CONDITION", nullable=true) + +/** +* Codicion del cliente con la solicitud. +*/ +private String condition; + +@Column(name="PARTICIPATION", nullable=true) + +/** +* Porcentaje de participacion del cliente con la solicitud. +*/ +private BigDecimal participation; + +@Column(name="ADDRESSNUMBER", nullable=true) + +/** +* Direccion asociada +*/ +private Integer addressnumber; + +@Column(name="PERSONTYPE", nullable=true) + +/** +* 1, Persona natural, 2 Persona Juridica. +*/ +private String persontype; + +/**Contructor por defecto*/ +public TgeneSolicitudeRelationship(){ +} +/**Contructor de TgeneSolicitudeRelationship +@param pPk Clave Primaria del entity +*/ +public TgeneSolicitudeRelationship(TgeneSolicitudeRelationshipKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSolicitudeRelationship +*/ +public static TgeneSolicitudeRelationship find(EntityManager pEntityManager,TgeneSolicitudeRelationshipKey pKey) throws Exception{ + TgeneSolicitudeRelationship obj = pEntityManager.find(TgeneSolicitudeRelationship.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSolicitudeRelationship +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeRelationship +*/ +public TgeneSolicitudeRelationshipKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeRelationship +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeRelationship +*/ +public void setPk(TgeneSolicitudeRelationshipKey pPk){ + pk=pPk; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de relationshipcode +@return valor de relationshipcode*/ +public String getRelationshipcode(){ + return relationshipcode; +} +/**Fija el valor de relationshipcode +@param pRelationshipcode nuevo Valor de relationshipcode*/ +public void setRelationshipcode(String pRelationshipcode){ + relationshipcode=pRelationshipcode; +} + +/**Obtiene el valor de isprincipal +@return valor de isprincipal*/ +public String getIsprincipal(){ + return isprincipal; +} +/**Fija el valor de isprincipal +@param pIsprincipal nuevo Valor de isprincipal*/ +public void setIsprincipal(String pIsprincipal){ + isprincipal=pIsprincipal; +} + +/**Obtiene el valor de priority +@return valor de priority*/ +public Integer getPriority(){ + return priority; +} +/**Fija el valor de priority +@param pPriority nuevo Valor de priority*/ +public void setPriority(Integer pPriority){ + priority=pPriority; +} + +/**Obtiene el valor de condition +@return valor de condition*/ +public String getCondition(){ + return condition; +} +/**Fija el valor de condition +@param pCondition nuevo Valor de condition*/ +public void setCondition(String pCondition){ + condition=pCondition; +} + +/**Obtiene el valor de participation +@return valor de participation*/ +public BigDecimal getParticipation(){ + return participation; +} +/**Fija el valor de participation +@param pParticipation nuevo Valor de participation*/ +public void setParticipation(BigDecimal pParticipation){ + participation=pParticipation; +} + +/**Obtiene el valor de addressnumber +@return valor de addressnumber*/ +public Integer getAddressnumber(){ + return addressnumber; +} +/**Fija el valor de addressnumber +@param pAddressnumber nuevo Valor de addressnumber*/ +public void setAddressnumber(Integer pAddressnumber){ + addressnumber=pAddressnumber; +} + +/**Obtiene el valor de persontype +@return valor de persontype*/ +public String getPersontype(){ + return persontype; +} +/**Fija el valor de persontype +@param pPersontype nuevo Valor de persontype*/ +public void setPersontype(String pPersontype){ + persontype=pPersontype; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeRelationship))return false; + TgeneSolicitudeRelationship that = (TgeneSolicitudeRelationship) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeRelationship +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSolicitudeRelationship +*/ +public Object createInstance(){ + TgeneSolicitudeRelationship instance=new TgeneSolicitudeRelationship(); + instance.setPk(new TgeneSolicitudeRelationshipKey()); + return instance; +} +/**Clona la entidad TgeneSolicitudeRelationship +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeRelationship p=(TgeneSolicitudeRelationship)this.clone(); + p.setPk((TgeneSolicitudeRelationshipKey)this.pk.cloneMe()); + return p; +} + + //METODOS MANUALES + /** Sentencia que devuelve las excepciones de una solicitud. */ + private static final String JPQL_SOL_RELATIONSHIP = "from TgeneSolicitudeRelationship solrel " + + " where solrel.pk.solicitudnumber = :solicitudnumber " + " and solrel.pk.solicitudsequence = :solicitudsequence "; + /** + * Entrega una lista de clientes relacionados a la solicitud. + * + * @param pSolicitudenumber Numero de solicitud. + * @param pSolicitudesequence Secuencia interna de la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findBySolicitudeNumber(EntityManager pEntityManager, String pSolicitudenumber, Integer pSolicitudesequence) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(TgeneSolicitudeRelationship.JPQL_SOL_RELATIONSHIP); + qry.setParameter("solicitudnumber", pSolicitudenumber); + qry.setParameter("solicitudsequence", pSolicitudesequence); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeRelationshipKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeRelationshipKey.java.svn-base new file mode 100644 index 0000000..2079f42 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeRelationshipKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDERELATIONSHIP*/ +@Embeddable +public class TgeneSolicitudeRelationshipKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +/**Contructor por defecto*/ +public TgeneSolicitudeRelationshipKey(){} +/**Contructor de TgeneSolicitudeRelationshipKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pPersoncode Codigo de persona +*/ +public TgeneSolicitudeRelationshipKey(String pSolicitudnumber,Integer pSolicitudsequence,Integer pPersoncode){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + personcode=pPersoncode; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Implementacin de la comparacin de TgeneSolicitudeRelationshipKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeRelationshipKey))return false; + TgeneSolicitudeRelationshipKey that = (TgeneSolicitudeRelationshipKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeRelationshipKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeStatus.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeStatus.java.svn-base new file mode 100644 index 0000000..d0ee7d4 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeStatus.java.svn-base @@ -0,0 +1,161 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDESTATUS*/ +@Entity(name="TgeneSolicitudeStatus") +@Table(name="TGENESOLICITUDESTATUS") +public class TgeneSolicitudeStatus extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeStatus +*/ +@EmbeddedId +private TgeneSolicitudeStatusKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=false) + +/** +* Descripcion del estatus de la solicitud +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneSolicitudeStatus(){ +} +/**Contructor de TgeneSolicitudeStatus +@param pPk Clave Primaria del entity +@param pDescription Descripcion del estatus de la solicitud +*/ +public TgeneSolicitudeStatus(TgeneSolicitudeStatusKey pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSolicitudeStatus +*/ +public static TgeneSolicitudeStatus find(EntityManager pEntityManager,TgeneSolicitudeStatusKey pKey) throws Exception{ + TgeneSolicitudeStatus obj = pEntityManager.find(TgeneSolicitudeStatus.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSolicitudeStatus +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeStatus +*/ +public TgeneSolicitudeStatusKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeStatus +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeStatus +*/ +public void setPk(TgeneSolicitudeStatusKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeStatus))return false; + TgeneSolicitudeStatus that = (TgeneSolicitudeStatus) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeStatus +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSolicitudeStatus +*/ +public Object createInstance(){ + TgeneSolicitudeStatus instance=new TgeneSolicitudeStatus(); + instance.setPk(new TgeneSolicitudeStatusKey()); + return instance; +} +/**Clona la entidad TgeneSolicitudeStatus +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeStatus p=(TgeneSolicitudeStatus)this.clone(); + p.setPk((TgeneSolicitudeStatusKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeStatusKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeStatusKey.java.svn-base new file mode 100644 index 0000000..5876792 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneSolicitudeStatusKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDESTATUS*/ +@Embeddable +public class TgeneSolicitudeStatusKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de la solicitud +*/ +private String statuscode; + +/**Contructor por defecto*/ +public TgeneSolicitudeStatusKey(){} +/**Contructor de TgeneSolicitudeStatusKey +@param pModulecode Codigo de modulo +@param pStatuscode Estatus de la solicitud +*/ +public TgeneSolicitudeStatusKey(String pModulecode,String pStatuscode){ + modulecode=pModulecode; + statuscode=pStatuscode; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Implementacin de la comparacin de TgeneSolicitudeStatusKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeStatusKey))return false; + TgeneSolicitudeStatusKey that = (TgeneSolicitudeStatusKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeStatusKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTechnicalPatrimony.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTechnicalPatrimony.java.svn-base new file mode 100644 index 0000000..5aef101 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTechnicalPatrimony.java.svn-base @@ -0,0 +1,182 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETECHNICALPATRIMONY*/ +@Entity(name="TgeneTechnicalPatrimony") +@Table(name="TGENETECHNICALPATRIMONY") +public class TgeneTechnicalPatrimony extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTechnicalPatrimony +*/ +@EmbeddedId +private TgeneTechnicalPatrimonyKey pk; +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="AMOUNT", nullable=true) + +/** +* Monto del patrimonio tcnico +*/ +private BigDecimal amount; + +@Column(name="DATEFROM", nullable=false) + +/** +* Fecha desde la cual esta vigente el registro de datos del prestamo +*/ +private Timestamp datefrom; + +/**Contructor por defecto*/ +public TgeneTechnicalPatrimony(){ +} +/**Contructor de TgeneTechnicalPatrimony +@param pPk Clave Primaria del entity +@param pDatefrom Fecha desde la cual esta vigente el registro de datos del prestamo +*/ +public TgeneTechnicalPatrimony(TgeneTechnicalPatrimonyKey pPk,Timestamp pDatefrom){ + this(); + pk=pPk; + datefrom=pDatefrom; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTechnicalPatrimony +*/ +public static TgeneTechnicalPatrimony find(EntityManager pEntityManager,TgeneTechnicalPatrimonyKey pKey) throws Exception{ + TgeneTechnicalPatrimony obj = pEntityManager.find(TgeneTechnicalPatrimony.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTechnicalPatrimony +@return El objeto que referencia a la Clave primaria de TgeneTechnicalPatrimony +*/ +public TgeneTechnicalPatrimonyKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTechnicalPatrimony +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTechnicalPatrimony +*/ +public void setPk(TgeneTechnicalPatrimonyKey pPk){ + pk=pPk; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de amount +@return valor de amount*/ +public BigDecimal getAmount(){ + return amount; +} +/**Fija el valor de amount +@param pAmount nuevo Valor de amount*/ +public void setAmount(BigDecimal pAmount){ + amount=pAmount; +} + +/**Obtiene el valor de datefrom +@return valor de datefrom*/ +public Timestamp getDatefrom(){ + return datefrom; +} +/**Fija el valor de datefrom +@param pDatefrom nuevo Valor de datefrom*/ +public void setDatefrom(Timestamp pDatefrom){ + datefrom=pDatefrom; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTechnicalPatrimony))return false; + TgeneTechnicalPatrimony that = (TgeneTechnicalPatrimony) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneTechnicalPatrimony +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneTechnicalPatrimony +*/ +public Object createInstance(){ + TgeneTechnicalPatrimony instance=new TgeneTechnicalPatrimony(); + instance.setPk(new TgeneTechnicalPatrimonyKey()); + return instance; +} +/**Clona la entidad TgeneTechnicalPatrimony +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTechnicalPatrimony p=(TgeneTechnicalPatrimony)this.clone(); + p.setPk((TgeneTechnicalPatrimonyKey)this.pk.cloneMe()); + return p; +} +public Object getId() { + return this.pk; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTechnicalPatrimonyKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTechnicalPatrimonyKey.java.svn-base new file mode 100644 index 0000000..1e7b116 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTechnicalPatrimonyKey.java.svn-base @@ -0,0 +1,129 @@ +package com.fp.persistence.pgeneral.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETECHNICALPATRIMONY*/ +@Embeddable +public class TgeneTechnicalPatrimonyKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro de datos del prestamo. +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TgeneTechnicalPatrimonyKey(){} +/**Contructor de TgeneTechnicalPatrimonyKey +@param pCompanycode Codigo de compania +@param pDateto Fecha hasta la cual esta vigente el registro de datos del prestamo. +*/ +public TgeneTechnicalPatrimonyKey(Integer pCompanycode,Timestamp pDateto){ + companycode=pCompanycode; + dateto=pDateto; +} +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacion de la comparacion de TgeneTechnicalPatrimonyKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTechnicalPatrimonyKey))return false; + TgeneTechnicalPatrimonyKey that = (TgeneTechnicalPatrimonyKey) o; + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneTechnicalPatrimonyKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerBalance.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerBalance.java.svn-base new file mode 100644 index 0000000..18a0565 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerBalance.java.svn-base @@ -0,0 +1,271 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETELLERBALANCE*/ +@Entity(name="TgeneTellerBalance") +@Table(name="TGENETELLERBALANCE") +public class TgeneTellerBalance extends com.fp.dto.AbstractDataBalanceTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTellerBalance +*/ +@EmbeddedId +private TgeneTellerBalanceKey pk; +@Column(name="BALANCE", nullable=true) + +/** +* Saldo de la caja para la fecha de trabajo, usuario y moneda. +*/ +private BigDecimal balance; + +@Column(name="DEBITS", nullable=true) + +/** +* Total de debitos de caja. +*/ +private BigDecimal debits; + +@Column(name="CREDITS", nullable=true) + +/** +* Total de creditos de caja. +*/ +private BigDecimal credits; + +@Column(name="OWNCHECKS", nullable=true) + +/** +* Saldo en cheques propios. +*/ +private BigDecimal ownchecks; + +@Column(name="LOCALCHECKS", nullable=true) + +/** +* Saldo en cheques locales. +*/ +private BigDecimal localchecks; + +@Column(name="REMCHECKS", nullable=true) + +/** +* Saldo en cheques de remesas. +*/ +private BigDecimal remchecks; + +@Column(name="PLACESCHECKS", nullable=true) + +/** +* Saldo en cheques otras plazas. +*/ +private BigDecimal placeschecks; + +@Column(name="ISCLOSED", nullable=true) + +/** +* Y, indica que el cierre de caja ya fue ejecutado y el cajero no puede ejecutar mas transacciones. +*/ +private String isclosed; + +/**Contructor por defecto*/ +public TgeneTellerBalance(){ +} +/**Contructor de TgeneTellerBalance +@param pPk Clave Primaria del entity +*/ +public TgeneTellerBalance(TgeneTellerBalanceKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTellerBalance +*/ +public static TgeneTellerBalance find(EntityManager pEntityManager,TgeneTellerBalanceKey pKey) throws Exception{ + TgeneTellerBalance obj = pEntityManager.find(TgeneTellerBalance.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTellerBalance +@return El objeto que referencia a la Clave primaria de TgeneTellerBalance +*/ +public TgeneTellerBalanceKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTellerBalance +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTellerBalance +*/ +public void setPk(TgeneTellerBalanceKey pPk){ + pk=pPk; +} +/**Obtiene el valor de balance +@return valor de balance*/ +public BigDecimal getBalance(){ + return balance; +} +/**Fija el valor de balance +@param pBalance nuevo Valor de balance*/ +public void setBalance(BigDecimal pBalance){ + balance=pBalance; +} + +/**Obtiene el valor de debits +@return valor de debits*/ +public BigDecimal getDebits(){ + return debits; +} +/**Fija el valor de debits +@param pDebits nuevo Valor de debits*/ +public void setDebits(BigDecimal pDebits){ + debits=pDebits; +} + +/**Obtiene el valor de credits +@return valor de credits*/ +public BigDecimal getCredits(){ + return credits; +} +/**Fija el valor de credits +@param pCredits nuevo Valor de credits*/ +public void setCredits(BigDecimal pCredits){ + credits=pCredits; +} + +/**Obtiene el valor de ownchecks +@return valor de ownchecks*/ +public BigDecimal getOwnchecks(){ + return ownchecks; +} +/**Fija el valor de ownchecks +@param pOwnchecks nuevo Valor de ownchecks*/ +public void setOwnchecks(BigDecimal pOwnchecks){ + ownchecks=pOwnchecks; +} + +/**Obtiene el valor de localchecks +@return valor de localchecks*/ +public BigDecimal getLocalchecks(){ + return localchecks; +} +/**Fija el valor de localchecks +@param pLocalchecks nuevo Valor de localchecks*/ +public void setLocalchecks(BigDecimal pLocalchecks){ + localchecks=pLocalchecks; +} + +/**Obtiene el valor de remchecks +@return valor de remchecks*/ +public BigDecimal getRemchecks(){ + return remchecks; +} +/**Fija el valor de remchecks +@param pRemchecks nuevo Valor de remchecks*/ +public void setRemchecks(BigDecimal pRemchecks){ + remchecks=pRemchecks; +} + +/**Obtiene el valor de placeschecks +@return valor de placeschecks*/ +public BigDecimal getPlaceschecks(){ + return placeschecks; +} +/**Fija el valor de placeschecks +@param pPlaceschecks nuevo Valor de placeschecks*/ +public void setPlaceschecks(BigDecimal pPlaceschecks){ + placeschecks=pPlaceschecks; +} + +/**Obtiene el valor de isclosed +@return valor de isclosed*/ +public String getIsclosed(){ + return isclosed; +} +/**Fija el valor de isclosed +@param pIsclosed nuevo Valor de isclosed*/ +public void setIsclosed(String pIsclosed){ + isclosed=pIsclosed; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTellerBalance))return false; + TgeneTellerBalance that = (TgeneTellerBalance) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTellerBalance +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTellerBalance +*/ +public Object createInstance(){ + TgeneTellerBalance instance=new TgeneTellerBalance(); + instance.setPk(new TgeneTellerBalanceKey()); + return instance; +} +/**Clona la entidad TgeneTellerBalance +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTellerBalance p=(TgeneTellerBalance)this.clone(); + p.setPk((TgeneTellerBalanceKey)this.pk.cloneMe()); + return p; +} + + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerBalanceKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerBalanceKey.java.svn-base new file mode 100644 index 0000000..01b9b4f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerBalanceKey.java.svn-base @@ -0,0 +1,152 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENETELLERBALANCE*/ +@Embeddable +public class TgeneTellerBalanceKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="WORKINGDATE", nullable=false,updatable=false) + +/** +* Fecha de trabajo +*/ +private Date workingdate; + +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +/**Contructor por defecto*/ +public TgeneTellerBalanceKey(){} +/**Contructor de TgeneTellerBalanceKey +@param pWorkingdate Fecha de trabajo +@param pUsercode Codigo de usuario +@param pCurrencycode Codigo de moneda +*/ +public TgeneTellerBalanceKey(Date pWorkingdate,String pUsercode,String pCurrencycode){ + workingdate=pWorkingdate; + usercode=pUsercode; + currencycode=pCurrencycode; +} +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Implementacin de la comparacin de TgeneTellerBalanceKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTellerBalanceKey))return false; + TgeneTellerBalanceKey that = (TgeneTellerBalanceKey) o; + if (this.getWorkingdate() == null || that.getWorkingdate() == null){ + return false; + } + if (! this.getWorkingdate().equals(that.getWorkingdate())){ + return false; + } + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTellerBalanceKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getWorkingdate() == null ? 0 : this.getWorkingdate().hashCode()); + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerTransfer.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerTransfer.java.svn-base new file mode 100644 index 0000000..ccce3b9 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerTransfer.java.svn-base @@ -0,0 +1,194 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.SQLQuery; +import org.hibernate.Session; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETELLERTRANSFER */ +@Entity(name = "TgeneTellerTransfer") +@Table(name = "TGENETELLERTRANSFER") +public class TgeneTellerTransfer extends com.fp.dto.AbstractDataTransport + implements + Serializable, + HibernateBean, + Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneTellerTransfer + */ + @EmbeddedId + private TgeneTellerTransferKey pk; + /** Contructor por defecto */ + public TgeneTellerTransfer() { + } + /** + * Contructor de TgeneTellerTransfer + * + * @param pPk Clave Primaria del entity + */ + public TgeneTellerTransfer(TgeneTellerTransferKey pPk) { + this(); + pk = pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneTellerTransfer + */ + public static TgeneTellerTransfer find(EntityManager pEntityManager, TgeneTellerTransferKey pKey) throws Exception { + TgeneTellerTransfer obj = pEntityManager.find(TgeneTellerTransfer.class, pKey); + return obj; + } + /** + * Entrega la Clave primaria de TgeneTellerTransfer + * + * @return El objeto que referencia a la Clave primaria de TgeneTellerTransfer + */ + public TgeneTellerTransferKey getPk() { + return pk; + } + /** + * Fija un nuevo valor a la Clave primaria de TgeneTellerTransfer + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneTellerTransfer + */ + public void setPk(TgeneTellerTransferKey pPk) { + pk = pPk; + } + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneTellerTransfer)) + return false; + TgeneTellerTransfer that = (TgeneTellerTransfer) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /** + * Implementacin del metodo hashCode de la la entidad TgeneTellerTransfer + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + /** Implementacin de la creacin de un bean en blanco TgeneTellerTransfer */ + public Object createInstance() { + TgeneTellerTransfer instance = new TgeneTellerTransfer(); + instance.setPk(new TgeneTellerTransferKey()); + return instance; + } + /** + * Clona la entidad TgeneTellerTransfer + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneTellerTransfer p = (TgeneTellerTransfer) this.clone(); + p.setPk((TgeneTellerTransferKey) this.pk.cloneMe()); + return p; + } + //Metodos manuales. + + /**sentencia que elimina TgeneTellerTransfer*/ + private static final String DEL_TRANSF = + " delete from TGENETELLERTRANSFER t " + + " where t.WORKINGDATE = :workingdate " + + " and t.USERCODE = :usercode " + + " and t.TRANSFERNUMBER = :transfernumber"; + + /** + * Elimina un registro de la tabla para el usuario, fecha de trabajo y numero de transferencia. + * @param pEntityManager Referencia la session de la base de datos. + * @param pWorkingdate Fecha de trabajo. + * @param pUser Codigo de usuario. + * @param pTransfernumber Numero de transferencia. + * @throws Exception + */ + public static void delete(EntityManager pEntityManager,Date pWorkingdate,String pUser,Integer pTransfernumber) throws Exception { + //Elimina TgeneTellerTransfer + Session s = (Session)pEntityManager.getDelegate(); + SQLQuery sqldet = s.createSQLQuery(DEL_TRANSF); + sqldet.setDate("workingdate", pWorkingdate); + sqldet.setString("usercode", pUser); + sqldet.setInteger("transfernumber", pTransfernumber); + sqldet.executeUpdate(); + } + + /**sentencia que obtiene la secuencia por fecha de trabajo, usuario.*/ + private static final String SQL = "select coalesce( max(TRANSFERNUMBER),0) from TGENETELLERTRANSFER " + + " where WORKINGDATE = :workingdate and USERCODE = :usercode "; + + /** + * Entrega la secuencia de transferencia. + * @param pWorkingDate Fecha de trabajo. + * @param pUsercode Codigo de usuario. + * @return Integer + * @throws Exception + */ + public static Integer getTransfernumber(EntityManager pEntityManager,Date pWorkingDate, String pUsercode) throws Exception { + Integer transfernumber = null; + Session s = (Session)pEntityManager.getDelegate(); + SQLQuery sql = s.createSQLQuery(SQL); + sql.setDate("workingdate", pWorkingDate); + sql.setString("usercode", pUsercode); + transfernumber = Integer.parseInt(sql.uniqueResult().toString()); + transfernumber++; + return transfernumber; + } + + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerTransferDetail.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerTransferDetail.java.svn-base new file mode 100644 index 0000000..1a7651e --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerTransferDetail.java.svn-base @@ -0,0 +1,226 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; +import com.fp.teller.exception.TellerException; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETELLERTRANSFERDETAIL */ +@Entity(name = "TgeneTellerTransferDetail") +@Table(name = "TGENETELLERTRANSFERDETAIL") +public class TgeneTellerTransferDetail extends com.fp.dto.AbstractDataTransport + implements + Serializable, + HibernateBean, + Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneTellerTransferDetail + */ + @EmbeddedId + private TgeneTellerTransferDetailKey pk; + @Column(name = "QUANTITY", nullable = true) + /** + * Numero de billetes o monedas por denominacion + */ + private Integer quantity; + + @Column(name = "TOTAL", nullable = true) + /** + * Total de la denominacion + */ + private BigDecimal total; + + /** Contructor por defecto */ + public TgeneTellerTransferDetail() { + } + /** + * Contructor de TgeneTellerTransferDetail + * + * @param pPk Clave Primaria del entity + */ + public TgeneTellerTransferDetail(TgeneTellerTransferDetailKey pPk) { + this(); + pk = pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneTellerTransferDetail + */ + public static TgeneTellerTransferDetail find(EntityManager pEntityManager, TgeneTellerTransferDetailKey pKey) + throws Exception { + TgeneTellerTransferDetail obj = pEntityManager.find(TgeneTellerTransferDetail.class, pKey); + return obj; + } + /** + * Entrega la Clave primaria de TgeneTellerTransferDetail + * + * @return El objeto que referencia a la Clave primaria de TgeneTellerTransferDetail + */ + public TgeneTellerTransferDetailKey getPk() { + return pk; + } + /** + * Fija un nuevo valor a la Clave primaria de TgeneTellerTransferDetail + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneTellerTransferDetail + */ + public void setPk(TgeneTellerTransferDetailKey pPk) { + pk = pPk; + } + /** + * Obtiene el valor de quantity + * + * @return valor de quantity + */ + public Integer getQuantity() { + return quantity; + } + /** + * Fija el valor de quantity + * + * @param pQuantity nuevo Valor de quantity + */ + public void setQuantity(Integer pQuantity) { + quantity = pQuantity; + } + + /** + * Obtiene el valor de total + * + * @return valor de total + */ + public BigDecimal getTotal() { + return total; + } + /** + * Fija el valor de total + * + * @param pTotal nuevo Valor de total + */ + public void setTotal(BigDecimal pTotal) { + total = pTotal; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneTellerTransferDetail)) + return false; + TgeneTellerTransferDetail that = (TgeneTellerTransferDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /** + * Implementacin del metodo hashCode de la la entidad TgeneTellerTransferDetail + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + /** Implementacin de la creacin de un bean en blanco TgeneTellerTransferDetail */ + public Object createInstance() { + TgeneTellerTransferDetail instance = new TgeneTellerTransferDetail(); + instance.setPk(new TgeneTellerTransferDetailKey()); + return instance; + } + /** + * Clona la entidad TgeneTellerTransferDetail + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneTellerTransferDetail p = (TgeneTellerTransferDetail) this.clone(); + p.setPk((TgeneTellerTransferDetailKey) this.pk.cloneMe()); + return p; + } + + //Metodos manuales. + /**Sentencia que entrega la los datos de TgeneTellerTransferDetail*/ + private static final String HQL_TELLER_TRANSFER_DETAIL = + " from TgeneTellerTransferDetail tgtd" + + " where tgtd.pk.workingdate = :workingdate" + + " and tgtd.pk.usercode = :usercode" + + " and tgtd.pk.transfernumber = :transfernumber"; + + /** + * Metodo que entrega los datos de TgeneTellerTransferDetail, dada la fecha de trabajo, usuario y secuencia. + * @param workingdate Fecha de trabajo. + * @param usercode Codigo de usuario. + * @param transfernumber Numero de transferencia. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, + Date workingdate, String usercode, Integer transfernumber) throws Exception{ + List ldata = null; + Query qry = pEntityManager.createQuery(HQL_TELLER_TRANSFER_DETAIL); + qry.setParameter("workingdate", workingdate); + qry.setParameter("usercode", usercode); + qry.setParameter("transfernumber", transfernumber); + ldata = qry.getResultList(); + if(ldata == null){ + throw new TellerException("TELLER-0001", "TRANSFERENCIA NO DEFINIDA EN TGENETELLERTRANSFERHEADER TRANSFERNUMBER:{0} USERCODE:{1} WORKINGDATE:{2}", transfernumber, usercode, workingdate); + } + return ldata; + } + + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerTransferDetailKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerTransferDetailKey.java.svn-base new file mode 100644 index 0000000..7489bca --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerTransferDetailKey.java.svn-base @@ -0,0 +1,234 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENETELLERTRANSFERDETAIL*/ +@Embeddable +public class TgeneTellerTransferDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario que origina la transferencia +*/ +private String usercode; + +@Column(name="WORKINGDATE", nullable=false,updatable=false) + +/** +* Fecha de trabajo en la cual se origina la transferencia +*/ +private Date workingdate; + +@Column(name="TRANSFERNUMBER", nullable=false,updatable=false) + +/** +* Secuencia de transferencia para el usuaio fecha de trabajo +*/ +private Integer transfernumber; + +@Column(name="CATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String catalog; + +@Column(name="CATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String catalogcode; + +@Column(name="DENOMINATIONVALUE", nullable=false,updatable=false) + +/** +* Valor de la denominacion, ejemplo billetes de 100, 50, 20,10 etc +*/ +private BigDecimal denominationvalue; + +/**Contructor por defecto*/ +public TgeneTellerTransferDetailKey(){} +/**Contructor de TgeneTellerTransferDetailKey +@param pUsercode Codigo de usuario que origina la transferencia +@param pWorkingdate Fecha de trabajo en la cual se origina la transferencia +@param pTransfernumber Secuencia de transferencia para el usuaio fecha de trabajo +@param pCatalog Codigo de catalogo 01 Natural, 02 Juridico +@param pCatalogcode Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +@param pDenominationvalue Valor de la denominacion, ejemplo billetes de 100, 50, 20,10 etc +*/ +public TgeneTellerTransferDetailKey(String pUsercode,Date pWorkingdate,Integer pTransfernumber,String pCatalog,String pCatalogcode,BigDecimal pDenominationvalue){ + usercode=pUsercode; + workingdate=pWorkingdate; + transfernumber=pTransfernumber; + catalog=pCatalog; + catalogcode=pCatalogcode; + denominationvalue=pDenominationvalue; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +/**Obtiene el valor de transfernumber +@return valor de transfernumber*/ +public Integer getTransfernumber(){ + return transfernumber; +} +/**Fija el valor de transfernumber +@param pTransfernumber nuevo Valor de transfernumber*/ +public void setTransfernumber(Integer pTransfernumber){ + transfernumber=pTransfernumber; +} + +/**Obtiene el valor de catalog +@return valor de catalog*/ +public String getCatalog(){ + return catalog; +} +/**Fija el valor de catalog +@param pCatalog nuevo Valor de catalog*/ +public void setCatalog(String pCatalog){ + catalog=pCatalog; +} + +/**Obtiene el valor de catalogcode +@return valor de catalogcode*/ +public String getCatalogcode(){ + return catalogcode; +} +/**Fija el valor de catalogcode +@param pCatalogcode nuevo Valor de catalogcode*/ +public void setCatalogcode(String pCatalogcode){ + catalogcode=pCatalogcode; +} + +/**Obtiene el valor de denominationvalue +@return valor de denominationvalue*/ +public BigDecimal getDenominationvalue(){ + return denominationvalue; +} +/**Fija el valor de denominationvalue +@param pDenominationvalue nuevo Valor de denominationvalue*/ +public void setDenominationvalue(BigDecimal pDenominationvalue){ + denominationvalue=pDenominationvalue; +} + +/**Implementacin de la comparacin de TgeneTellerTransferDetailKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTellerTransferDetailKey))return false; + TgeneTellerTransferDetailKey that = (TgeneTellerTransferDetailKey) o; + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getWorkingdate() == null || that.getWorkingdate() == null){ + return false; + } + if (! this.getWorkingdate().equals(that.getWorkingdate())){ + return false; + } + if (this.getTransfernumber() == null || that.getTransfernumber() == null){ + return false; + } + if (! this.getTransfernumber().equals(that.getTransfernumber())){ + return false; + } + if (this.getCatalog() == null || that.getCatalog() == null){ + return false; + } + if (! this.getCatalog().equals(that.getCatalog())){ + return false; + } + if (this.getCatalogcode() == null || that.getCatalogcode() == null){ + return false; + } + if (! this.getCatalogcode().equals(that.getCatalogcode())){ + return false; + } + if (this.getDenominationvalue() == null || that.getDenominationvalue() == null){ + return false; + } + if (! this.getDenominationvalue().equals(that.getDenominationvalue())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTellerTransferDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getWorkingdate() == null ? 0 : this.getWorkingdate().hashCode()); + result = result * 37 + (this.getTransfernumber() == null ? 0 : this.getTransfernumber().hashCode()); + result = result * 37 + (this.getCatalog() == null ? 0 : this.getCatalog().hashCode()); + result = result * 37 + (this.getCatalogcode() == null ? 0 : this.getCatalogcode().hashCode()); + result = result * 37 + (this.getDenominationvalue() == null ? 0 : this.getDenominationvalue().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerTransferHeader.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerTransferHeader.java.svn-base new file mode 100644 index 0000000..2f8c01c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerTransferHeader.java.svn-base @@ -0,0 +1,574 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.SQLQuery; +import org.hibernate.Session; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; +import com.fp.teller.exception.TellerException; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETELLERTRANSFERHEADER */ +@Entity(name = "TgeneTellerTransferHeader") +@Table(name = "TGENETELLERTRANSFERHEADER") +public class TgeneTellerTransferHeader extends com.fp.dto.AbstractDataTransport + implements + Serializable, + HibernateBean, + Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneTellerTransferHeader + */ + @EmbeddedId + private TgeneTellerTransferHeaderKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Numero de mensaje con el que se procersa el financiero. + */ + private Timestamp datefrom; + + @Column(name = "CURRENCYCODE", nullable = false) + /** + * Codigo de moneda + */ + private String currencycode; + + @Column(name = "OFFICECODE", nullable = false) + /** + * Codigo de oficina origen + */ + private Integer officecode; + + @Column(name = "BRANCHCODE", nullable = false) + /** + * Codigo de sucursal origen + */ + private Integer branchcode; + + @Column(name = "COMPANYCODE", nullable = false) + /** + * Codigo de compania al que pertenece la oficina + */ + private Integer companycode; + + @Column(name = "DESTINYUSERCODE", nullable = true) + /** + * Codigo de usuario destino + */ + private String destinyusercode; + + @Column(name = "DESTINYOFFICECODE", nullable = true) + /** + * Codigo de oficina destino + */ + private Integer destinyofficecode; + + @Column(name = "DESTINYBRANCHCODE", nullable = true) + /** + * Codigo de sucursal destino + */ + private Integer destinybranchcode; + + @Column(name = "STATUSCATALOG", nullable = true) + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String statuscatalog; + + @Column(name = "STATUSCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String statuscatalogcode; + + @Column(name = "ISVAULT", nullable = true) + /** + * Y indica que la transferencia de saldos en de Boveda + */ + private String isvault; + + @Column(name = "TOTAL", nullable = true) + /** + * Monto total de la transaccion + */ + private BigDecimal total; + + @Column(name = "JOURNALID", nullable = true) + /** + * Numero de mensaje con el que se procersa el financiero. + */ + private String journalid; + + @Column(name = "OLDJOURNALID", nullable = true) + /** + * Numero de mensaje anterior se utiliza en los reversos. + */ + private String oldjournalid; + + + /** Contructor por defecto */ + public TgeneTellerTransferHeader() { + } + /** + * Contructor de TgeneTellerTransferHeader + * + * @param pPk Clave Primaria del entity + * @param pCurrencycode Codigo de moneda + * @param pOfficecode Codigo de oficina origen + * @param pBranchcode Codigo de sucursal origen + * @param pCompanycode Codigo de compania al que pertenece la oficina + */ + public TgeneTellerTransferHeader(TgeneTellerTransferHeaderKey pPk, String pCurrencycode, Integer pOfficecode, + Integer pBranchcode, Integer pCompanycode) { + this(); + pk = pPk; + currencycode = pCurrencycode; + officecode = pOfficecode; + branchcode = pBranchcode; + companycode = pCompanycode; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneTellerTransferHeader + */ + public static TgeneTellerTransferHeader find(EntityManager pEntityManager, TgeneTellerTransferHeaderKey pKey) + throws Exception { + TgeneTellerTransferHeader obj = pEntityManager.find(TgeneTellerTransferHeader.class, pKey); + return obj; + } + /** + * Entrega la Clave primaria de TgeneTellerTransferHeader + * + * @return El objeto que referencia a la Clave primaria de TgeneTellerTransferHeader + */ + public TgeneTellerTransferHeaderKey getPk() { + return pk; + } + /** + * Fija un nuevo valor a la Clave primaria de TgeneTellerTransferHeader + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneTellerTransferHeader + */ + public void setPk(TgeneTellerTransferHeaderKey pPk) { + pk = pPk; + } + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return datefrom; + } + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + datefrom = pDatefrom; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return currencycode; + } + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de officecode + * + * @return valor de officecode + */ + public Integer getOfficecode() { + return officecode; + } + /** + * Fija el valor de officecode + * + * @param pOfficecode nuevo Valor de officecode + */ + public void setOfficecode(Integer pOfficecode) { + officecode = pOfficecode; + } + + /** + * Obtiene el valor de branchcode + * + * @return valor de branchcode + */ + public Integer getBranchcode() { + return branchcode; + } + /** + * Fija el valor de branchcode + * + * @param pBranchcode nuevo Valor de branchcode + */ + public void setBranchcode(Integer pBranchcode) { + branchcode = pBranchcode; + } + + /** + * Obtiene el valor de companycode + * + * @return valor de companycode + */ + public Integer getCompanycode() { + return companycode; + } + /** + * Fija el valor de companycode + * + * @param pCompanycode nuevo Valor de companycode + */ + public void setCompanycode(Integer pCompanycode) { + companycode = pCompanycode; + } + + /** + * Obtiene el valor de destinyusercode + * + * @return valor de destinyusercode + */ + public String getDestinyusercode() { + return destinyusercode; + } + /** + * Fija el valor de destinyusercode + * + * @param pDestinyusercode nuevo Valor de destinyusercode + */ + public void setDestinyusercode(String pDestinyusercode) { + destinyusercode = pDestinyusercode; + } + + /** + * Obtiene el valor de destinyofficecode + * + * @return valor de destinyofficecode + */ + public Integer getDestinyofficecode() { + return destinyofficecode; + } + /** + * Fija el valor de destinyofficecode + * + * @param pDestinyofficecode nuevo Valor de destinyofficecode + */ + public void setDestinyofficecode(Integer pDestinyofficecode) { + destinyofficecode = pDestinyofficecode; + } + + /** + * Obtiene el valor de destinybranchcode + * + * @return valor de destinybranchcode + */ + public Integer getDestinybranchcode() { + return destinybranchcode; + } + /** + * Fija el valor de destinybranchcode + * + * @param pDestinybranchcode nuevo Valor de destinybranchcode + */ + public void setDestinybranchcode(Integer pDestinybranchcode) { + destinybranchcode = pDestinybranchcode; + } + + /** + * Obtiene el valor de statuscatalog + * + * @return valor de statuscatalog + */ + public String getStatuscatalog() { + return statuscatalog; + } + /** + * Fija el valor de statuscatalog + * + * @param pStatuscatalog nuevo Valor de statuscatalog + */ + public void setStatuscatalog(String pStatuscatalog) { + statuscatalog = pStatuscatalog; + } + + /** + * Obtiene el valor de statuscatalogcode + * + * @return valor de statuscatalogcode + */ + public String getStatuscatalogcode() { + return statuscatalogcode; + } + /** + * Fija el valor de statuscatalogcode + * + * @param pStatuscatalogcode nuevo Valor de statuscatalogcode + */ + public void setStatuscatalogcode(String pStatuscatalogcode) { + statuscatalogcode = pStatuscatalogcode; + } + + /** + * Obtiene el valor de isvault + * + * @return valor de isvault + */ + public String getIsvault() { + return isvault; + } + /** + * Fija el valor de isvault + * + * @param pIsvault nuevo Valor de isvault + */ + public void setIsvault(String pIsvault) { + isvault = pIsvault; + } + + /** + * Obtiene el valor de total + * + * @return valor de total + */ + public BigDecimal getTotal() { + return total; + } + /** + * Fija el valor de total + * + * @param pTotal nuevo Valor de total + */ + public void setTotal(BigDecimal pTotal) { + total = pTotal; + } + + /** + * Obtiene el valor de journalid + * + * @return valor de journalid + */ + public String getJournalid() { + return journalid; + } + /** + * Fija el valor de journalid + * + * @param pJournalid nuevo Valor de journalid + */ + public void setJournalid(String pJournalid) { + journalid = pJournalid; + } + + /** + * Obtiene el valor de oldjournalid + * + * @return valor de oldjournalid + */ + public String getOldjournalid() { + return oldjournalid; + } + /** + * Fija el valor de oldjournalid + * + * @param pOldjournalid nuevo Valor de oldjournalid + */ + public void setOldjournalid(String pOldjournalid) { + oldjournalid = pOldjournalid; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneTellerTransferHeader)) + return false; + TgeneTellerTransferHeader that = (TgeneTellerTransferHeader) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /** + * Implementacin del metodo hashCode de la la entidad TgeneTellerTransferHeader + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + /** Implementacin de la creacin de un bean en blanco TgeneTellerTransferHeader */ + public Object createInstance() { + TgeneTellerTransferHeader instance = new TgeneTellerTransferHeader(); + instance.setPk(new TgeneTellerTransferHeaderKey()); + return instance; + } + /** + * Clona la entidad TgeneTellerTransferHeader + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneTellerTransferHeader p = (TgeneTellerTransferHeader) this.clone(); + p.setPk((TgeneTellerTransferHeaderKey) this.pk.cloneMe()); + return p; + } + public Object getId() { + return this.pk; + } + + // metodos manuales. + /** Sentencia que entrega la los datos de TgeneTellerTransferHeader */ + private static final String HQL_TELLER_TRANSFER_HEADER_JID = " from TgeneTellerTransferHeader tgth" + + " where tgth.pk.workingdate = :workingdate" + " and tgth.journalid = :journalid"; + + /** + * Metodo que entrega los datos de TgeneTellerTransferHeader, dada la fecha de trabajo y el journalid. + * @param pEntityManager Referecia a la session de la base de datos. + * @param pWorkingdate Fecha de trabajo. + * @param pJournalid Numero de journal. + * @param isold Indica si obtiene el registro de journalid o de oldjournalid. + * @return TgeneTellerTransferHeader + * @throws Exception + */ + public static TgeneTellerTransferHeader find(EntityManager pEntityManager,Date pWorkingdate, String pJournalid) + throws Exception { + TgeneTellerTransferHeader tgeneTellerTransferHeader = null; + Query qry = pEntityManager.createQuery(HQL_TELLER_TRANSFER_HEADER_JID); + qry.setParameter("workingdate", pWorkingdate); + qry.setParameter("journalid", pJournalid); + try { + tgeneTellerTransferHeader = (TgeneTellerTransferHeader)qry.getSingleResult(); + } catch (NoResultException e) { + return tgeneTellerTransferHeader; + } + return tgeneTellerTransferHeader; + } + + + + /**sentencia que elimina TgeneTellerTransferHeader*/ + private static final String DEL_TRANSF_HEAD = + " delete from TGENETELLERTRANSFERHEADER t " + + " where t.WORKINGDATE = :workingdate " + + " and t.USERCODE = :usercode " + + " and t.TRANSFERNUMBER = :transfernumber"; + + /** + * Elimina un registro de la tabla para el usuario, fecha de trabajo y numero de transferencia. + * @param pEntityManager Referencia la session de la base de datos. + * @param pWorkingdate Fecha de trabajo. + * @param pUser Codigo de usuario. + * @param pTransfernumber Numero de transferencia. + * @throws Exception + */ + public static void delete(EntityManager pEntityManager,Date pWorkingdate,String pUser,Integer pTransfernumber) throws Exception { + //Elimina TgeneTellerTransferHeader + Session s = (Session)pEntityManager.getDelegate(); + SQLQuery sqldet = s.createSQLQuery(DEL_TRANSF_HEAD); + sqldet.setDate("workingdate", pWorkingdate); + sqldet.setString("usercode", pUser); + sqldet.setInteger("transfernumber", pTransfernumber); + sqldet.executeUpdate(); + } + + + + /**Sentencia que entrega la los datos de TgeneTellerTransferHeader*/ + private static final String JPQL_TELLER_TRANSFER_HEADER = + " from TgeneTellerTransferHeader tgth" + + " where tgth.pk.workingdate = :workingdate" + + " and tgth.pk.usercode = :usercode" + + " and tgth.pk.transfernumber = :transfernumber"; + /** + * Metodo que entrega los datos de TgeneTellerTransferHeader, dada la fecha de trabajo, usuario y numero de transferencia. + * + * @param pEntityManager Session de la base de datos. + * @param workingdate Fecha de trabajo. + * @param usercode Codigo de usuario. + * @param transfernumber Numero de transferencia. + * @return TgeneTellerTransferHeader + * @throws Exception + */ + public static TgeneTellerTransferHeader find(EntityManager pEntityManager, Date workingdate, String usercode, Integer transfernumber) throws Exception{ + TgeneTellerTransferHeader tgeneTellerTransferHeader = null; + Query qry = pEntityManager.createQuery(TgeneTellerTransferHeader.JPQL_TELLER_TRANSFER_HEADER); + qry.setParameter(Constant.VWORKINGDATE, workingdate); + qry.setParameter("usercode", usercode); + qry.setParameter("transfernumber", transfernumber); + try { + tgeneTellerTransferHeader = (TgeneTellerTransferHeader) qry.getSingleResult(); + } catch (NoResultException e) { + throw new TellerException("TELLER-0001", "TRANSFERENCIA NO DEFINIDA EN TGENETELLERTRANSFERHEADER TRANSFERNUMBER:{0} USERCODE:{1} WORKINGDATE:{2}", transfernumber, usercode, workingdate); + } + return tgeneTellerTransferHeader; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerTransferHeaderKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerTransferHeaderKey.java.svn-base new file mode 100644 index 0000000..ca12537 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerTransferHeaderKey.java.svn-base @@ -0,0 +1,184 @@ +package com.fp.persistence.pgeneral.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENETELLERTRANSFERHEADER*/ +@Embeddable +public class TgeneTellerTransferHeaderKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="WORKINGDATE", nullable=false,updatable=false) + +/** +* Fecha de trabajo en la cual se origina la transferencia +*/ +private Date workingdate; + +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario que origina la transferencia +*/ +private String usercode; + +@Column(name="TRANSFERNUMBER", nullable=false,updatable=false) + +/** +* Secuencia de transferencia para el usuaio fecha de trabajo +*/ +private Integer transfernumber; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TgeneTellerTransferHeaderKey(){} +/**Contructor de TgeneTellerTransferHeaderKey +@param pWorkingdate Fecha de trabajo en la cual se origina la transferencia +@param pUsercode Codigo de usuario que origina la transferencia +@param pTransfernumber Secuencia de transferencia para el usuaio fecha de trabajo +@param pDateto Fecha hasta la cual esta vigente el registro +*/ +public TgeneTellerTransferHeaderKey(Date pWorkingdate,String pUsercode,Integer pTransfernumber,Timestamp pDateto){ + workingdate=pWorkingdate; + usercode=pUsercode; + transfernumber=pTransfernumber; + dateto=pDateto; +} +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de transfernumber +@return valor de transfernumber*/ +public Integer getTransfernumber(){ + return transfernumber; +} +/**Fija el valor de transfernumber +@param pTransfernumber nuevo Valor de transfernumber*/ +public void setTransfernumber(Integer pTransfernumber){ + transfernumber=pTransfernumber; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TgeneTellerTransferHeaderKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTellerTransferHeaderKey))return false; + TgeneTellerTransferHeaderKey that = (TgeneTellerTransferHeaderKey) o; + if (this.getWorkingdate() == null || that.getWorkingdate() == null){ + return false; + } + if (! this.getWorkingdate().equals(that.getWorkingdate())){ + return false; + } + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getTransfernumber() == null || that.getTransfernumber() == null){ + return false; + } + if (! this.getTransfernumber().equals(that.getTransfernumber())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTellerTransferHeaderKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getWorkingdate() == null ? 0 : this.getWorkingdate().hashCode()); + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getTransfernumber() == null ? 0 : this.getTransfernumber().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerTransferKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerTransferKey.java.svn-base new file mode 100644 index 0000000..05f6179 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTellerTransferKey.java.svn-base @@ -0,0 +1,152 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENETELLERTRANSFER*/ +@Embeddable +public class TgeneTellerTransferKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario que origina la transferencia +*/ +private String usercode; + +@Column(name="WORKINGDATE", nullable=false,updatable=false) + +/** +* Fecha de trabajo en la cual se origina la transferencia +*/ +private Date workingdate; + +@Column(name="TRANSFERNUMBER", nullable=false,updatable=false) + +/** +* Secuencia de transferencia para el usuaio fecha de trabajo +*/ +private Integer transfernumber; + +/**Contructor por defecto*/ +public TgeneTellerTransferKey(){} +/**Contructor de TgeneTellerTransferKey +@param pUsercode Codigo de usuario que origina la transferencia +@param pWorkingdate Fecha de trabajo en la cual se origina la transferencia +@param pTransfernumber Secuencia de transferencia para el usuaio fecha de trabajo +*/ +public TgeneTellerTransferKey(String pUsercode,Date pWorkingdate,Integer pTransfernumber){ + usercode=pUsercode; + workingdate=pWorkingdate; + transfernumber=pTransfernumber; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +/**Obtiene el valor de transfernumber +@return valor de transfernumber*/ +public Integer getTransfernumber(){ + return transfernumber; +} +/**Fija el valor de transfernumber +@param pTransfernumber nuevo Valor de transfernumber*/ +public void setTransfernumber(Integer pTransfernumber){ + transfernumber=pTransfernumber; +} + +/**Implementacin de la comparacin de TgeneTellerTransferKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTellerTransferKey))return false; + TgeneTellerTransferKey that = (TgeneTellerTransferKey) o; + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getWorkingdate() == null || that.getWorkingdate() == null){ + return false; + } + if (! this.getWorkingdate().equals(that.getWorkingdate())){ + return false; + } + if (this.getTransfernumber() == null || that.getTransfernumber() == null){ + return false; + } + if (! this.getTransfernumber().equals(that.getTransfernumber())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTellerTransferKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getWorkingdate() == null ? 0 : this.getWorkingdate().hashCode()); + result = result * 37 + (this.getTransfernumber() == null ? 0 : this.getTransfernumber().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionMix.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionMix.java.svn-base new file mode 100644 index 0000000..64f4ee3 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionMix.java.svn-base @@ -0,0 +1,432 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONMIX */ +@Entity(name = "TgeneTransactionMix") +@Table(name = "TGENETRANSACTIONMIX") +public class TgeneTransactionMix extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneTransactionMix + */ + @EmbeddedId + private TgeneTransactionMixKey pk; + + @Column(name = "PERSONCODE", nullable = true) + /** + * Codigo de persona + */ + private Integer personcode; + + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + + @Column(name = "OFFICECODE", nullable = true) + /** + * Codigo de oficina + */ + private Integer officecode; + + @Column(name = "BRANCHCODE", nullable = true) + /** + * Codigo de sucursal + */ + private Integer branchcode; + + @Column(name = "COMPANYCODE", nullable = true) + /** + * Codigo de compania al que pertenece la oficina + */ + private Integer companycode; + + @Column(name = "ACCOUNTINGDATE", nullable = true) + /** + * null + */ + private Date accountingdate; + + @Column(name = "CASH", nullable = true) + /** + * null + */ + private BigDecimal cash; + + @Column(name = "CHECKS", nullable = true) + /** + * null + */ + private BigDecimal checks; + + @Column(name = "CASHBALANCE", nullable = true) + /** + * null + */ + private BigDecimal cashbalance; + + @Column(name = "CHECKBALANCE", nullable = true) + /** + * null + */ + private BigDecimal checkbalance; + + /** Contructor por defecto */ + public TgeneTransactionMix() { + } + + /** + * Contructor de TgeneTransactionMix + * + * @param pPk Clave Primaria del entity + */ + public TgeneTransactionMix(TgeneTransactionMixKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneTransactionMix + */ + public static TgeneTransactionMix find(EntityManager pEntityManager, TgeneTransactionMixKey pKey) throws Exception { + TgeneTransactionMix obj = pEntityManager.find(TgeneTransactionMix.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneTransactionMix + * + * @return El objeto que referencia a la Clave primaria de TgeneTransactionMix + */ + public TgeneTransactionMixKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneTransactionMix + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionMix + */ + public void setPk(TgeneTransactionMixKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de personcode + * + * @return valor de personcode + */ + public Integer getPersoncode() { + return this.personcode; + } + + /** + * Fija el valor de personcode + * + * @param pPersoncode nuevo Valor de personcode + */ + public void setPersoncode(Integer pPersoncode) { + this.personcode = pPersoncode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de officecode + * + * @return valor de officecode + */ + public Integer getOfficecode() { + return this.officecode; + } + + /** + * Fija el valor de officecode + * + * @param pOfficecode nuevo Valor de officecode + */ + public void setOfficecode(Integer pOfficecode) { + this.officecode = pOfficecode; + } + + /** + * Obtiene el valor de branchcode + * + * @return valor de branchcode + */ + public Integer getBranchcode() { + return this.branchcode; + } + + /** + * Fija el valor de branchcode + * + * @param pBranchcode nuevo Valor de branchcode + */ + public void setBranchcode(Integer pBranchcode) { + this.branchcode = pBranchcode; + } + + /** + * Obtiene el valor de companycode + * + * @return valor de companycode + */ + public Integer getCompanycode() { + return this.companycode; + } + + /** + * Fija el valor de companycode + * + * @param pCompanycode nuevo Valor de companycode + */ + public void setCompanycode(Integer pCompanycode) { + this.companycode = pCompanycode; + } + + /** + * Obtiene el valor de accountingdate + * + * @return valor de accountingdate + */ + public Date getAccountingdate() { + return this.accountingdate; + } + + /** + * Fija el valor de accountingdate + * + * @param pAccountingdate nuevo Valor de accountingdate + */ + public void setAccountingdate(Date pAccountingdate) { + this.accountingdate = pAccountingdate; + } + + /** + * Obtiene el valor de cash + * + * @return valor de cash + */ + public BigDecimal getCash() { + return this.cash; + } + + /** + * Fija el valor de cash + * + * @param pCash nuevo Valor de cash + */ + public void setCash(BigDecimal pCash) { + this.cash = pCash; + } + + /** + * Obtiene el valor de checks + * + * @return valor de checks + */ + public BigDecimal getChecks() { + return this.checks; + } + + /** + * Fija el valor de checks + * + * @param pChecks nuevo Valor de checks + */ + public void setChecks(BigDecimal pChecks) { + this.checks = pChecks; + } + + /** + * Obtiene el valor de cashbalance + * + * @return valor de cashbalance + */ + public BigDecimal getCashbalance() { + return this.cashbalance; + } + + /** + * Fija el valor de cashbalance + * + * @param pCashbalance nuevo Valor de cashbalance + */ + public void setCashbalance(BigDecimal pCashbalance) { + this.cashbalance = pCashbalance; + } + + /** + * Obtiene el valor de checkbalance + * + * @return valor de checkbalance + */ + public BigDecimal getCheckbalance() { + return this.checkbalance; + } + + /** + * Fija el valor de checkbalance + * + * @param pCheckbalance nuevo Valor de checkbalance + */ + public void setCheckbalance(BigDecimal pCheckbalance) { + this.checkbalance = pCheckbalance; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneTransactionMix)) { + return false; + } + TgeneTransactionMix that = (TgeneTransactionMix) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneTransactionMix + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneTransactionMix */ + @Override + public Object createInstance() { + TgeneTransactionMix instance = new TgeneTransactionMix(); + instance.setPk(new TgeneTransactionMixKey()); + return instance; + } + + /** + * Clona la entidad TgeneTransactionMix + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneTransactionMix p = (TgeneTransactionMix) this.clone(); + p.setPk((TgeneTransactionMixKey) this.pk.cloneMe()); + return p; + } + + // METODOS MANUALES + /** Sentencia que entrega datos de TgeneTransactionMix, para la fecha de tarbajo, usuario y numero de caja multiple. */ + private static final String JPQL_TRANS_MIX = " from TgeneTransactionMix tmix" + " where tmix.pk.workingdate = :workingdate " + + " and tmix.pk.usercode = :user" + " and tmix.pk.mixnumber = :mixnumber "; + + /** + * Metodo que entrega un registro de TgeneTransactionMix, dada la fecha de trabajo, codigo de usuario y secuencia de + * caja multiple, que se calcula por fecha de trabajo y usuario. + * + * @param pEntityManager Session de la base de datos. + * @param pWorkingdate Fecha de trabajo. + * @param pUser Codigo de usuario. + * @param pMixnumber Secuencia de caja multiple. + * @return TgeneTransactionMix + * @throws Exception + */ + public static TgeneTransactionMix find(EntityManager pEntityManager, Date pWorkingdate, String pUser, Integer pMixnumber) throws Exception { + Query qry = pEntityManager.createQuery(TgeneTransactionMix.JPQL_TRANS_MIX); + qry.setParameter(Constant.VWORKINGDATE, pWorkingdate); + qry.setParameter("user", pUser); + qry.setParameter("mixnumber", pMixnumber); + try { + return (TgeneTransactionMix) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionMixKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionMixKey.java.svn-base new file mode 100644 index 0000000..d124dae --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionMixKey.java.svn-base @@ -0,0 +1,152 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONMIX*/ +@Embeddable +public class TgeneTransactionMixKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="WORKINGDATE", nullable=false,updatable=false) + +/** +* null +*/ +private Date workingdate; + +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="MIXNUMBER", nullable=false,updatable=false) + +/** +* null +*/ +private Integer mixnumber; + +/**Contructor por defecto*/ +public TgeneTransactionMixKey(){} +/**Contructor de TgeneTransactionMixKey +@param pWorkingdate null +@param pUsercode Codigo de usuario +@param pMixnumber null +*/ +public TgeneTransactionMixKey(Date pWorkingdate,String pUsercode,Integer pMixnumber){ + workingdate=pWorkingdate; + usercode=pUsercode; + mixnumber=pMixnumber; +} +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de mixnumber +@return valor de mixnumber*/ +public Integer getMixnumber(){ + return mixnumber; +} +/**Fija el valor de mixnumber +@param pMixnumber nuevo Valor de mixnumber*/ +public void setMixnumber(Integer pMixnumber){ + mixnumber=pMixnumber; +} + +/**Implementacin de la comparacin de TgeneTransactionMixKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionMixKey))return false; + TgeneTransactionMixKey that = (TgeneTransactionMixKey) o; + if (this.getWorkingdate() == null || that.getWorkingdate() == null){ + return false; + } + if (! this.getWorkingdate().equals(that.getWorkingdate())){ + return false; + } + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getMixnumber() == null || that.getMixnumber() == null){ + return false; + } + if (! this.getMixnumber().equals(that.getMixnumber())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransactionMixKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getWorkingdate() == null ? 0 : this.getWorkingdate().hashCode()); + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getMixnumber() == null ? 0 : this.getMixnumber().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionMixPages.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionMixPages.java.svn-base new file mode 100644 index 0000000..66d4ccf --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionMixPages.java.svn-base @@ -0,0 +1,157 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONMIXPAGES*/ +@Entity(name="TgeneTransactionMixPages") +@Table(name="TGENETRANSACTIONMIXPAGES") +public class TgeneTransactionMixPages extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransactionMixPages +*/ +@EmbeddedId +private TgeneTransactionMixPagesKey pk; +@Column(name="ORIGIN", nullable=true) + +/** +* Y Indica que la transaccion sirve para fondeo del efectivo, N resta los fondos +*/ +private String origin; + +@Column(name="PRESENTATIONORDER", nullable=true) + +/** +* Orden de presentacion +*/ +private Integer presentationorder; + +/**Contructor por defecto*/ +public TgeneTransactionMixPages(){ +} +/**Contructor de TgeneTransactionMixPages +@param pPk Clave Primaria del entity +*/ +public TgeneTransactionMixPages(TgeneTransactionMixPagesKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionMixPages +*/ +public static TgeneTransactionMixPages find(EntityManager pEntityManager,TgeneTransactionMixPagesKey pKey) throws Exception{ + TgeneTransactionMixPages obj = pEntityManager.find(TgeneTransactionMixPages.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionMixPages +@return El objeto que referencia a la Clave primaria de TgeneTransactionMixPages +*/ +public TgeneTransactionMixPagesKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionMixPages +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionMixPages +*/ +public void setPk(TgeneTransactionMixPagesKey pPk){ + pk=pPk; +} +/**Obtiene el valor de origin +@return valor de origin*/ +public String getOrigin(){ + return origin; +} +/**Fija el valor de origin +@param pOrigin nuevo Valor de origin*/ +public void setOrigin(String pOrigin){ + origin=pOrigin; +} + +/**Obtiene el valor de presentationorder +@return valor de presentationorder*/ +public Integer getPresentationorder(){ + return presentationorder; +} +/**Fija el valor de presentationorder +@param pPresentationorder nuevo Valor de presentationorder*/ +public void setPresentationorder(Integer pPresentationorder){ + presentationorder=pPresentationorder; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionMixPages))return false; + TgeneTransactionMixPages that = (TgeneTransactionMixPages) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTransactionMixPages +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTransactionMixPages +*/ +public Object createInstance(){ + TgeneTransactionMixPages instance=new TgeneTransactionMixPages(); + instance.setPk(new TgeneTransactionMixPagesKey()); + return instance; +} +/**Clona la entidad TgeneTransactionMixPages +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionMixPages p=(TgeneTransactionMixPages)this.clone(); + p.setPk((TgeneTransactionMixPagesKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionMixPagesKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionMixPagesKey.java.svn-base new file mode 100644 index 0000000..80ff26b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionMixPagesKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONMIXPAGES*/ +@Embeddable +public class TgeneTransactionMixPagesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +/**Contructor por defecto*/ +public TgeneTransactionMixPagesKey(){} +/**Contructor de TgeneTransactionMixPagesKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +*/ +public TgeneTransactionMixPagesKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Implementacin de la comparacin de TgeneTransactionMixPagesKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionMixPagesKey))return false; + TgeneTransactionMixPagesKey that = (TgeneTransactionMixPagesKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransactionMixPagesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionQuery.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionQuery.java.svn-base new file mode 100644 index 0000000..2b0a787 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionQuery.java.svn-base @@ -0,0 +1,282 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONQUERY*/ +@Entity(name="TgeneTransactionQuery") +@Table(name="TGENETRANSACTIONQUERY") +public class TgeneTransactionQuery extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransactionQuery +*/ +@EmbeddedId +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(SEQUENCE),0)+1 from TGENETRANSACTIONQUERY " + + "where TRANSACTIONMODULE=:transactionmodule " + "and TRANSACTIONCODE=:transactioncode " + + "and TRANSACTIONVERSION=:transactionversion "), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "transactionmodule,pk.transactionmodule;transactioncode,pk.transactioncode;transactionversion,pk.transactionversion"), + @Parameter(name = "field", value = "sequence") }) +@GeneratedValue(generator = "seq_id") +private TgeneTransactionQueryKey pk; +@Column(name="PROCESSCODE", nullable=true) + +/** +* Paquete clase de un comando a ejecutar. +*/ +private String processcode; + +@Column(name="CATALOGTYPEPROCESS", nullable=true) + +/** +* Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia +*/ +private String catalogtypeprocess; + +@Column(name="CATALOGCODETYPEPROCESS", nullable=true) + +/** +* Codigo de tabla de catalogo del proceso de negocio de la aplicacion +*/ +private String catalogcodetypeprocess; + +@Column(name="EXECUTIONORDER", nullable=true) + +/** +* orden de ejecucion de la regla de negocio. +*/ +private Integer executionorder; + +@Column(name="STATUS", nullable=true) + +/** +* A indica que la regla esta activa, I regla Inactiva +*/ +private String status; + +@Column(name="ISFLOW", nullable=true) + +/** +* Y Indica que el origen de ejecucion del componente es un flujo del bpm +*/ +private String isflow; + +@Column(name="RULENAME", nullable=true) + +/** +* Nombre de la regla a ejecutar +*/ +private String rulename; + +@Column(name="PROCESSNAME", nullable=true) + +/** +* Nombre del flujo bpm a ejecutar +*/ +private String processname; + +/**Contructor por defecto*/ +public TgeneTransactionQuery(){ +} +/**Contructor de TgeneTransactionQuery +@param pPk Clave Primaria del entity +*/ +public TgeneTransactionQuery(TgeneTransactionQueryKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionQuery +*/ +public static TgeneTransactionQuery find(EntityManager pEntityManager,TgeneTransactionQueryKey pKey) throws Exception{ + TgeneTransactionQuery obj = pEntityManager.find(TgeneTransactionQuery.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionQuery +@return El objeto que referencia a la Clave primaria de TgeneTransactionQuery +*/ +public TgeneTransactionQueryKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionQuery +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionQuery +*/ +public void setPk(TgeneTransactionQueryKey pPk){ + pk=pPk; +} +/**Obtiene el valor de processcode +@return valor de processcode*/ +public String getProcesscode(){ + return processcode; +} +/**Fija el valor de processcode +@param pProcesscode nuevo Valor de processcode*/ +public void setProcesscode(String pProcesscode){ + processcode=pProcesscode; +} + +/**Obtiene el valor de catalogtypeprocess +@return valor de catalogtypeprocess*/ +public String getCatalogtypeprocess(){ + return catalogtypeprocess; +} +/**Fija el valor de catalogtypeprocess +@param pCatalogtypeprocess nuevo Valor de catalogtypeprocess*/ +public void setCatalogtypeprocess(String pCatalogtypeprocess){ + catalogtypeprocess=pCatalogtypeprocess; +} + +/**Obtiene el valor de catalogcodetypeprocess +@return valor de catalogcodetypeprocess*/ +public String getCatalogcodetypeprocess(){ + return catalogcodetypeprocess; +} +/**Fija el valor de catalogcodetypeprocess +@param pCatalogcodetypeprocess nuevo Valor de catalogcodetypeprocess*/ +public void setCatalogcodetypeprocess(String pCatalogcodetypeprocess){ + catalogcodetypeprocess=pCatalogcodetypeprocess; +} + +/**Obtiene el valor de executionorder +@return valor de executionorder*/ +public Integer getExecutionorder(){ + return executionorder; +} +/**Fija el valor de executionorder +@param pExecutionorder nuevo Valor de executionorder*/ +public void setExecutionorder(Integer pExecutionorder){ + executionorder=pExecutionorder; +} + +/**Obtiene el valor de status +@return valor de status*/ +public String getStatus(){ + return status; +} +/**Fija el valor de status +@param pStatus nuevo Valor de status*/ +public void setStatus(String pStatus){ + status=pStatus; +} + +/**Obtiene el valor de isflow +@return valor de isflow*/ +public String getIsflow(){ + return isflow; +} +/**Fija el valor de isflow +@param pIsflow nuevo Valor de isflow*/ +public void setIsflow(String pIsflow){ + isflow=pIsflow; +} + +/**Obtiene el valor de rulename +@return valor de rulename*/ +public String getRulename(){ + return rulename; +} +/**Fija el valor de rulename +@param pRulename nuevo Valor de rulename*/ +public void setRulename(String pRulename){ + rulename=pRulename; +} + +/**Obtiene el valor de processname +@return valor de processname*/ +public String getProcessname(){ + return processname; +} +/**Fija el valor de processname +@param pProcessname nuevo Valor de processname*/ +public void setProcessname(String pProcessname){ + processname=pProcessname; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionQuery))return false; + TgeneTransactionQuery that = (TgeneTransactionQuery) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTransactionQuery +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTransactionQuery +*/ +public Object createInstance(){ + TgeneTransactionQuery instance=new TgeneTransactionQuery(); + instance.setPk(new TgeneTransactionQueryKey()); + return instance; +} +/**Clona la entidad TgeneTransactionQuery +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionQuery p=(TgeneTransactionQuery)this.clone(); + p.setPk((TgeneTransactionQueryKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionQueryKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionQueryKey.java.svn-base new file mode 100644 index 0000000..3f92a46 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionQueryKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONQUERY*/ +@Embeddable +public class TgeneTransactionQueryKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="SEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de la consulta +*/ +private Integer sequence; + +/**Contructor por defecto*/ +public TgeneTransactionQueryKey(){} +/**Contructor de TgeneTransactionQueryKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pSequence Secuencia de la consulta +*/ +public TgeneTransactionQueryKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,Integer pSequence){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + sequence=pSequence; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de sequence +@return valor de sequence*/ +public Integer getSequence(){ + return sequence; +} +/**Fija el valor de sequence +@param pSequence nuevo Valor de sequence*/ +public void setSequence(Integer pSequence){ + sequence=pSequence; +} + +/**Implementacin de la comparacin de TgeneTransactionQueryKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionQueryKey))return false; + TgeneTransactionQueryKey that = (TgeneTransactionQueryKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getSequence() == null || that.getSequence() == null){ + return false; + } + if (! this.getSequence().equals(that.getSequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransactionQueryKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getSequence() == null ? 0 : this.getSequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionReportLink.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionReportLink.java.svn-base new file mode 100644 index 0000000..a97cb61 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionReportLink.java.svn-base @@ -0,0 +1,160 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONREPORTLINK*/ +@Entity(name="TgeneTransactionReportLink") +@Table(name="TGENETRANSACTIONREPORTLINK") +public class TgeneTransactionReportLink extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransactionReportLink +*/ +@EmbeddedId +private TgeneTransactionReportLinkKey pk; +@Column(name="PERSISTENCEUNIT", nullable=true) + +/** +* Nombre del persistence unit, si esta en null toma la coneccion por defecto de la compania +*/ +private String persistenceunit; + +@Column(name="REPORTNAME", nullable=false) + +/** +* Nombre del reporte +*/ +private String reportname; + +/**Contructor por defecto*/ +public TgeneTransactionReportLink(){ +} +/**Contructor de TgeneTransactionReportLink +@param pPk Clave Primaria del entity +@param pReportname Nombre del reporte +*/ +public TgeneTransactionReportLink(TgeneTransactionReportLinkKey pPk,String pReportname){ + this(); + pk=pPk; + reportname=pReportname; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionReportLink +*/ +public static TgeneTransactionReportLink find(EntityManager pEntityManager,TgeneTransactionReportLinkKey pKey) throws Exception{ + TgeneTransactionReportLink obj = pEntityManager.find(TgeneTransactionReportLink.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionReportLink +@return El objeto que referencia a la Clave primaria de TgeneTransactionReportLink +*/ +public TgeneTransactionReportLinkKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionReportLink +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionReportLink +*/ +public void setPk(TgeneTransactionReportLinkKey pPk){ + pk=pPk; +} +/**Obtiene el valor de persistenceunit +@return valor de persistenceunit*/ +public String getPersistenceunit(){ + return persistenceunit; +} +/**Fija el valor de persistenceunit +@param pPersistenceunit nuevo Valor de persistenceunit*/ +public void setPersistenceunit(String pPersistenceunit){ + persistenceunit=pPersistenceunit; +} + +/**Obtiene el valor de reportname +@return valor de reportname*/ +public String getReportname(){ + return reportname; +} +/**Fija el valor de reportname +@param pReportname nuevo Valor de reportname*/ +public void setReportname(String pReportname){ + reportname=pReportname; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionReportLink))return false; + TgeneTransactionReportLink that = (TgeneTransactionReportLink) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTransactionReportLink +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTransactionReportLink +*/ +public Object createInstance(){ + TgeneTransactionReportLink instance=new TgeneTransactionReportLink(); + instance.setPk(new TgeneTransactionReportLinkKey()); + return instance; +} +/**Clona la entidad TgeneTransactionReportLink +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionReportLink p=(TgeneTransactionReportLink)this.clone(); + p.setPk((TgeneTransactionReportLinkKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionReportLinkKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionReportLinkKey.java.svn-base new file mode 100644 index 0000000..f10e1df --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneTransactionReportLinkKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONREPORTLINK*/ +@Embeddable +public class TgeneTransactionReportLinkKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TgeneTransactionReportLinkKey(){} +/**Contructor de TgeneTransactionReportLinkKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pCompanycode Codigo de compania +*/ +public TgeneTransactionReportLinkKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,Integer pCompanycode){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + companycode=pCompanycode; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacin de la comparacin de TgeneTransactionReportLinkKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionReportLinkKey))return false; + TgeneTransactionReportLinkKey that = (TgeneTransactionReportLinkKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransactionReportLinkKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneUserSolicitudeNumber.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneUserSolicitudeNumber.java.svn-base new file mode 100644 index 0000000..f4a0953 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneUserSolicitudeNumber.java.svn-base @@ -0,0 +1,138 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEUSERSOLICITUDENUMBER*/ +@Entity(name="TgeneUserSolicitudeNumber") +@Table(name="TGENEUSERSOLICITUDENUMBER") +public class TgeneUserSolicitudeNumber extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneUserSolicitudeNumber +*/ +@Id +@Column(name="USERCODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="SOLICITUDNUMBER", nullable=true) + +/** +* Numero de secuencia de solicitud asociada al usuario. +*/ +private String solicitudnumber; + +/**Contructor por defecto*/ +public TgeneUserSolicitudeNumber(){ +} +/**Contructor de TgeneUserSolicitudeNumber +@param pPk Clave Primaria del entity +*/ +public TgeneUserSolicitudeNumber(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneUserSolicitudeNumber +*/ +public static TgeneUserSolicitudeNumber find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneUserSolicitudeNumber obj = pEntityManager.find(TgeneUserSolicitudeNumber.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneUserSolicitudeNumber +@return El objeto que referencia a la Clave primaria de TgeneUserSolicitudeNumber +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneUserSolicitudeNumber +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneUserSolicitudeNumber +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneUserSolicitudeNumber))return false; + TgeneUserSolicitudeNumber that = (TgeneUserSolicitudeNumber) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneUserSolicitudeNumber +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneUserSolicitudeNumber +*/ +public Object createInstance(){ + TgeneUserSolicitudeNumber instance=new TgeneUserSolicitudeNumber(); + return instance; +} +/**Clona la entidad TgeneUserSolicitudeNumber +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneUserSolicitudeNumber p=(TgeneUserSolicitudeNumber)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneWildcard.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneWildcard.java.svn-base new file mode 100644 index 0000000..bce5b94 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/.svn/text-base/TgeneWildcard.java.svn-base @@ -0,0 +1,251 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Transient; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEWILDCARD */ +@Entity(name = "TgeneWildcard") +@Table(name = "TGENEWILDCARD") +public class TgeneWildcard extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Cache { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneWildcard + */ + @Id + @Column(name = "WILDCARD", nullable = false, updatable = false) + private String pk; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "PROCESSCODE", nullable = true) + /** + * null + */ + private String processcode; + + @Column(name = "CATALOGTYPEPROCESS", nullable = true) + /** + * Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia + */ + private String catalogtypeprocess; + + @Column(name = "CATALOGCODETYPEPROCESS", nullable = true) + /** + * Codigo de tabla de catalogo del proceso de negocio de la aplicacion + */ + private String catalogcodetypeprocess; + + /** Contructor por defecto */ + public TgeneWildcard() { + } + /** + * Contructor de TgeneWildcard + * + * @param pPk Clave Primaria del entity + */ + public TgeneWildcard(String pPk) { + this(); + pk = pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneWildcard + */ + public static TgeneWildcard find(EntityManager pEntityManager, Object pKey) throws Exception { + TgeneWildcard obj = pEntityManager.find(TgeneWildcard.class, pKey); + return obj; + } + /** + * Entrega la Clave primaria de TgeneWildcard + * + * @return El objeto que referencia a la Clave primaria de TgeneWildcard + */ + public String getPk() { + return pk; + } + /** + * Fija un nuevo valor a la Clave primaria de TgeneWildcard + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneWildcard + */ + public void setPk(String pPk) { + pk = pPk; + } + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de processcode + * + * @return valor de processcode + */ + public String getProcesscode() { + return processcode; + } + /** + * Fija el valor de processcode + * + * @param pProcesscode nuevo Valor de processcode + */ + public void setProcesscode(String pProcesscode) { + processcode = pProcesscode; + } + + /** + * Obtiene el valor de catalogtypeprocess + * + * @return valor de catalogtypeprocess + */ + public String getCatalogtypeprocess() { + return catalogtypeprocess; + } + /** + * Fija el valor de catalogtypeprocess + * + * @param pCatalogtypeprocess nuevo Valor de catalogtypeprocess + */ + public void setCatalogtypeprocess(String pCatalogtypeprocess) { + catalogtypeprocess = pCatalogtypeprocess; + } + + /** + * Obtiene el valor de catalogcodetypeprocess + * + * @return valor de catalogcodetypeprocess + */ + public String getCatalogcodetypeprocess() { + return catalogcodetypeprocess; + } + /** + * Fija el valor de catalogcodetypeprocess + * + * @param pCatalogcodetypeprocess nuevo Valor de catalogcodetypeprocess + */ + public void setCatalogcodetypeprocess(String pCatalogcodetypeprocess) { + catalogcodetypeprocess = pCatalogcodetypeprocess; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneWildcard)) + return false; + TgeneWildcard that = (TgeneWildcard) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /** + * Implementacin del metodo hashCode de la la entidad TgeneWildcard + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + /** Implementacin de la creacin de un bean en blanco TgeneWildcard */ + public Object createInstance() { + TgeneWildcard instance = new TgeneWildcard(); + return instance; + } + /** + * Clona la entidad TgeneWildcard + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneWildcard p = (TgeneWildcard) this.clone(); + return p; + } + + //Metodos manuales. + + private static String HQL = "from TgeneWildcard " ; + + /** + * Metodo que entrega una lista de clases que resuelven los comodines contables. + * @param pEntityManager referencia a la session de la base de datos. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findAll(EntityManager pEntityManager) throws Exception { + Query qry = pEntityManager.createQuery(HQL); + List ldata = null; + ldata = qry.getResultList(); + return ldata; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/ABSTgeneSolicitudeRelationship.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/ABSTgeneSolicitudeRelationship.java new file mode 100644 index 0000000..9f7a691 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/ABSTgeneSolicitudeRelationship.java @@ -0,0 +1,239 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDERELATIONSHIP*/ +@Entity(name="ABSTgeneSolicitudeRelationship") +@Table(name="TGENESOLICITUDERELATIONSHIP") +public abstract class ABSTgeneSolicitudeRelationship extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeRelationship +*/ +@EmbeddedId +private TgeneSolicitudeRelationshipKey pk; +@Column(name="MODULECODE", nullable=true) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="RELATIONSHIPCODE", nullable=true) + +/** +* Codigo de relacion de la cuenta con el cliente +*/ +private String relationshipcode; + +@Column(name="ISPRINCIPAL", nullable=true) + +/** +* Indica si el codigo de relacion es principal, en este caso el codigo de cliente se asocia a la tabla tgeneaccount +*/ +private String isprincipal; + +@Column(name="PRIORITY", nullable=true) + +/** +* Prioridad del cleinte con la solicitud. +*/ +private Integer priority; + +@Column(name="CONDITION", nullable=true) + +/** +* Codicion del cliente con la solicitud. +*/ +private String condition; + +@Column(name="PARTICIPATION", nullable=true) + +/** +* Porcentaje de participacion del cliente con la solicitud. +*/ +private BigDecimal participation; + +@Column(name="ADDRESSNUMBER", nullable=true) + +/** +* Direccion asociada +*/ +private Integer addressnumber; + +@Column(name="PERSONTYPE", nullable=true) + +/** +* 1, Persona natural, 2 Persona Juridica. +*/ +private String persontype; + +/**Entrega la Clave primaria de TgeneSolicitudeRelationship +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeRelationship +*/ +public TgeneSolicitudeRelationshipKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeRelationship +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeRelationship +*/ +public void setPk(TgeneSolicitudeRelationshipKey pPk){ + pk=pPk; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de relationshipcode +@return valor de relationshipcode*/ +public String getRelationshipcode(){ + return relationshipcode; +} +/**Fija el valor de relationshipcode +@param pRelationshipcode nuevo Valor de relationshipcode*/ +public void setRelationshipcode(String pRelationshipcode){ + relationshipcode=pRelationshipcode; +} + +/**Obtiene el valor de isprincipal +@return valor de isprincipal*/ +public String getIsprincipal(){ + return isprincipal; +} +/**Fija el valor de isprincipal +@param pIsprincipal nuevo Valor de isprincipal*/ +public void setIsprincipal(String pIsprincipal){ + isprincipal=pIsprincipal; +} + +/**Obtiene el valor de priority +@return valor de priority*/ +public Integer getPriority(){ + return priority; +} +/**Fija el valor de priority +@param pPriority nuevo Valor de priority*/ +public void setPriority(Integer pPriority){ + priority=pPriority; +} + +/**Obtiene el valor de condition +@return valor de condition*/ +public String getCondition(){ + return condition; +} +/**Fija el valor de condition +@param pCondition nuevo Valor de condition*/ +public void setCondition(String pCondition){ + condition=pCondition; +} + +/**Obtiene el valor de participation +@return valor de participation*/ +public BigDecimal getParticipation(){ + return participation; +} +/**Fija el valor de participation +@param pParticipation nuevo Valor de participation*/ +public void setParticipation(BigDecimal pParticipation){ + participation=pParticipation; +} + +/**Obtiene el valor de addressnumber +@return valor de addressnumber*/ +public Integer getAddressnumber(){ + return addressnumber; +} +/**Fija el valor de addressnumber +@param pAddressnumber nuevo Valor de addressnumber*/ +public void setAddressnumber(Integer pAddressnumber){ + addressnumber=pAddressnumber; +} + +/**Obtiene el valor de persontype +@return valor de persontype*/ +public String getPersontype(){ + return persontype; +} +/**Fija el valor de persontype +@param pPersontype nuevo Valor de persontype*/ +public void setPersontype(String pPersontype){ + persontype=pPersontype; +} + +/**Implementacin de la comparacin de la entidad TgeneSolicitudeRelationship +@param rhs Elemento de Comparacin +@return el resultado de la comparacin +*/ +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeRelationship))return false; + TgeneSolicitudeRelationship that = (TgeneSolicitudeRelationship) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeRelationship +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeRelationship p=(TgeneSolicitudeRelationship)this.clone(); + p.setPk((TgeneSolicitudeRelationshipKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/OptmListaNegra.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/OptmListaNegra.java new file mode 100644 index 0000000..c15daca --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/OptmListaNegra.java @@ -0,0 +1,582 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; +import java.util.List; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla OPTMLISTANEGRA*/ +@Entity(name="OptmListaNegra") +@Table(name="OPTMLISTANEGRA") +public class OptmListaNegra extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad OptmListaNegra + */ + @Id + @Column(name="ID_LISTANEGRA" ,nullable=false, updatable=false) + private String pk; + @Column(name="PARTMREGIONCOD", nullable=true) + + /** + * Region donde se encuentra registrada la informacin + */ + private String partmregioncod; + + @Column(name="PARTMSUCCOD", nullable=true) + + /** + * Sucursal donde se encuentra registrada la informacin + */ + private String partmsuccod; + + @Column(name="PARTMAGECOD", nullable=true) + + /** + * Agencia donde se encuentra registrada la informacin + */ + private String partmagecod; + + @Column(name="PARTMUNIADMCOD", nullable=true) + + /** + * Departamento donde se encuentra registrada la informacin + */ + private String partmuniadmcod; + + @Column(name="NOMBRE", nullable=true) + + /** + * Nombre de la persona registrada en dicha lista + */ + private String nombre; + + @Column(name="APELLIDO", nullable=true) + + /** + * Apellido de la persona registrada en dicha lista + */ + private String apellido; + + @Column(name="ID_TIPLISNEG", nullable=true) + + /** + * Tipo de Registro codigo Tipo llista (Sindicado,Homonimo) + */ + private Long id_tiplisneg; + + @Column(name="ESTADO", nullable=true) + + /** + * Estado del registro + */ + private String estado; + + @Column(name="FEC_ING_LISNEG", nullable=true) + + /** + * Fecha de registro en la lista negra + */ + private Date fec_ing_lisneg; + + @Column(name="PERMITIR_TRX", nullable=true) + + /** + * Bandera que identifica si el registro es bloque o advertencia + */ + private String permitir_trx; + + @Column(name="IDENTIFICACION", nullable=true) + + /** + * Identificacin de la persona registrada en dicha lista + */ + private String identificacion; + + @Column(name="PARTMCIUDADCOD", nullable=true) + + /** + * Ciudad donde esta registrado segn el CONSEP + */ + private String partmciudadcod; + + @Column(name="FEC_ING_CARGO", nullable=true) + + /** + * Fecha en el que se subio el archivo al sistema + */ + private Date fec_ing_cargo; + + @Column(name="FEC_SAL_CARGO", nullable=true) + + /** + * Fecha en la que se dio de baja del sistema + */ + private Date fec_sal_cargo; + + @Column(name="ID_CARGO", nullable=true) + + /** + * Cdigo del cargo que realizo la actualizacin + */ + private Integer id_cargo; + + @Column(name="ULT_ESTADO", nullable=true) + + /** + * Ultimo estado + */ + private String ult_estado; + + @Column(name="FEC_SAL_LISNEG", nullable=true) + + /** + * Fecha de salida del registro de lista negra + */ + private Date fec_sal_lisneg; + + @Column(name="USU_INGRESA", nullable=true) + + /** + * Usuario que ingreso el registro + */ + private String usu_ingresa; + + @Column(name="USU_MODIFICA", nullable=true) + + /** + * Usuario que modifico el registro + */ + private String usu_modifica; + + @Column(name="FEC_MODIFICA", nullable=true) + + /** + * Fecha de modificacin + */ + private Date fec_modifica; + + @Column(name="ARCHIVO_ORIG", nullable=true) + + /** + * Nombre del archivo plano de la lista negra + */ + private String archivo_orig; + + @Column(name="OBSERVACIONLP", nullable=true) + + /** + * Observaciones del archivo subido + */ + private String observacionlp; + + @Column(name="ID_TIPLISPROPIAS", nullable=true) + + /** + * Identificador de listas propias (actualmente no implementado) + */ + private Long id_tiplispropias; + + @Column(name="OBSERVACION", nullable=true) + + /** + * Observaciones del registro + */ + private String observacion; + + /**Contructor por defecto*/ + public OptmListaNegra(){ + } + /**Contructor de OptmListaNegra + @param pPk Clave Primaria del entity + */ + public OptmListaNegra(String pPk){ + this(); + pk=pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return OptmListaNegra + */ + public static OptmListaNegra find(EntityManager pEntityManager,Object pKey) throws Exception{ + OptmListaNegra obj = pEntityManager.find(OptmListaNegra.class,pKey); + return obj; + } + /**Entrega la Clave primaria de OptmListaNegra + @return El objeto que referencia a la Clave primaria de OptmListaNegra + */ + public String getPk(){ + return pk; + } + /**Fija un nuevo valor a la Clave primaria de OptmListaNegra + @param pPk El objeto que referencia a la nueva Clave primaria de OptmListaNegra + */ + public void setPk(String pPk){ + pk=pPk; + } + /**Obtiene el valor de partmregioncod + @return valor de partmregioncod*/ + public String getPartmregioncod(){ + return partmregioncod; + } + /**Fija el valor de partmregioncod + @param pPartmregioncod nuevo Valor de partmregioncod*/ + public void setPartmregioncod(String pPartmregioncod){ + partmregioncod=pPartmregioncod; + } + + /**Obtiene el valor de partmsuccod + @return valor de partmsuccod*/ + public String getPartmsuccod(){ + return partmsuccod; + } + /**Fija el valor de partmsuccod + @param pPartmsuccod nuevo Valor de partmsuccod*/ + public void setPartmsuccod(String pPartmsuccod){ + partmsuccod=pPartmsuccod; + } + + /**Obtiene el valor de partmagecod + @return valor de partmagecod*/ + public String getPartmagecod(){ + return partmagecod; + } + /**Fija el valor de partmagecod + @param pPartmagecod nuevo Valor de partmagecod*/ + public void setPartmagecod(String pPartmagecod){ + partmagecod=pPartmagecod; + } + + /**Obtiene el valor de partmuniadmcod + @return valor de partmuniadmcod*/ + public String getPartmuniadmcod(){ + return partmuniadmcod; + } + /**Fija el valor de partmuniadmcod + @param pPartmuniadmcod nuevo Valor de partmuniadmcod*/ + public void setPartmuniadmcod(String pPartmuniadmcod){ + partmuniadmcod=pPartmuniadmcod; + } + + /**Obtiene el valor de nombre + @return valor de nombre*/ + public String getNombre(){ + return nombre; + } + /**Fija el valor de nombre + @param pNombre nuevo Valor de nombre*/ + public void setNombre(String pNombre){ + nombre=pNombre; + } + + /**Obtiene el valor de apellido + @return valor de apellido*/ + public String getApellido(){ + return apellido; + } + /**Fija el valor de apellido + @param pApellido nuevo Valor de apellido*/ + public void setApellido(String pApellido){ + apellido=pApellido; + } + + /**Obtiene el valor de id_tiplisneg + @return valor de id_tiplisneg*/ + public Long getId_tiplisneg(){ + return id_tiplisneg; + } + /**Fija el valor de id_tiplisneg + @param pId_tiplisneg nuevo Valor de id_tiplisneg*/ + public void setId_tiplisneg(Long pId_tiplisneg){ + id_tiplisneg=pId_tiplisneg; + } + + /**Obtiene el valor de estado + @return valor de estado*/ + public String getEstado(){ + return estado; + } + /**Fija el valor de estado + @param pEstado nuevo Valor de estado*/ + public void setEstado(String pEstado){ + estado=pEstado; + } + + /**Obtiene el valor de fec_ing_lisneg + @return valor de fec_ing_lisneg*/ + public Date getFec_ing_lisneg(){ + return fec_ing_lisneg; + } + /**Fija el valor de fec_ing_lisneg + @param pFec_ing_lisneg nuevo Valor de fec_ing_lisneg*/ + public void setFec_ing_lisneg(Date pFec_ing_lisneg){ + fec_ing_lisneg=pFec_ing_lisneg; + } + + /**Obtiene el valor de permitir_trx + @return valor de permitir_trx*/ + public String getPermitir_trx(){ + return permitir_trx; + } + /**Fija el valor de permitir_trx + @param pPermitir_trx nuevo Valor de permitir_trx*/ + public void setPermitir_trx(String pPermitir_trx){ + permitir_trx=pPermitir_trx; + } + + /**Obtiene el valor de identificacion + @return valor de identificacion*/ + public String getIdentificacion(){ + return identificacion; + } + /**Fija el valor de identificacion + @param pIdentificacion nuevo Valor de identificacion*/ + public void setIdentificacion(String pIdentificacion){ + identificacion=pIdentificacion; + } + + /**Obtiene el valor de partmciudadcod + @return valor de partmciudadcod*/ + public String getPartmciudadcod(){ + return partmciudadcod; + } + /**Fija el valor de partmciudadcod + @param pPartmciudadcod nuevo Valor de partmciudadcod*/ + public void setPartmciudadcod(String pPartmciudadcod){ + partmciudadcod=pPartmciudadcod; + } + + /**Obtiene el valor de fec_ing_cargo + @return valor de fec_ing_cargo*/ + public Date getFec_ing_cargo(){ + return fec_ing_cargo; + } + /**Fija el valor de fec_ing_cargo + @param pFec_ing_cargo nuevo Valor de fec_ing_cargo*/ + public void setFec_ing_cargo(Date pFec_ing_cargo){ + fec_ing_cargo=pFec_ing_cargo; + } + + /**Obtiene el valor de fec_sal_cargo + @return valor de fec_sal_cargo*/ + public Date getFec_sal_cargo(){ + return fec_sal_cargo; + } + /**Fija el valor de fec_sal_cargo + @param pFec_sal_cargo nuevo Valor de fec_sal_cargo*/ + public void setFec_sal_cargo(Date pFec_sal_cargo){ + fec_sal_cargo=pFec_sal_cargo; + } + + /**Obtiene el valor de id_cargo + @return valor de id_cargo*/ + public Integer getId_cargo(){ + return id_cargo; + } + /**Fija el valor de id_cargo + @param pId_cargo nuevo Valor de id_cargo*/ + public void setId_cargo(Integer pId_cargo){ + id_cargo=pId_cargo; + } + + /**Obtiene el valor de ult_estado + @return valor de ult_estado*/ + public String getUlt_estado(){ + return ult_estado; + } + /**Fija el valor de ult_estado + @param pUlt_estado nuevo Valor de ult_estado*/ + public void setUlt_estado(String pUlt_estado){ + ult_estado=pUlt_estado; + } + + /**Obtiene el valor de fec_sal_lisneg + @return valor de fec_sal_lisneg*/ + public Date getFec_sal_lisneg(){ + return fec_sal_lisneg; + } + /**Fija el valor de fec_sal_lisneg + @param pFec_sal_lisneg nuevo Valor de fec_sal_lisneg*/ + public void setFec_sal_lisneg(Date pFec_sal_lisneg){ + fec_sal_lisneg=pFec_sal_lisneg; + } + + /**Obtiene el valor de usu_ingresa + @return valor de usu_ingresa*/ + public String getUsu_ingresa(){ + return usu_ingresa; + } + /**Fija el valor de usu_ingresa + @param pUsu_ingresa nuevo Valor de usu_ingresa*/ + public void setUsu_ingresa(String pUsu_ingresa){ + usu_ingresa=pUsu_ingresa; + } + + /**Obtiene el valor de usu_modifica + @return valor de usu_modifica*/ + public String getUsu_modifica(){ + return usu_modifica; + } + /**Fija el valor de usu_modifica + @param pUsu_modifica nuevo Valor de usu_modifica*/ + public void setUsu_modifica(String pUsu_modifica){ + usu_modifica=pUsu_modifica; + } + + /**Obtiene el valor de fec_modifica + @return valor de fec_modifica*/ + public Date getFec_modifica(){ + return fec_modifica; + } + /**Fija el valor de fec_modifica + @param pFec_modifica nuevo Valor de fec_modifica*/ + public void setFec_modifica(Date pFec_modifica){ + fec_modifica=pFec_modifica; + } + + /**Obtiene el valor de archivo_orig + @return valor de archivo_orig*/ + public String getArchivo_orig(){ + return archivo_orig; + } + /**Fija el valor de archivo_orig + @param pArchivo_orig nuevo Valor de archivo_orig*/ + public void setArchivo_orig(String pArchivo_orig){ + archivo_orig=pArchivo_orig; + } + + /**Obtiene el valor de observacionlp + @return valor de observacionlp*/ + public String getObservacionlp(){ + return observacionlp; + } + /**Fija el valor de observacionlp + @param pObservacionlp nuevo Valor de observacionlp*/ + public void setObservacionlp(String pObservacionlp){ + observacionlp=pObservacionlp; + } + + /**Obtiene el valor de id_tiplispropias + @return valor de id_tiplispropias*/ + public Long getId_tiplispropias(){ + return id_tiplispropias; + } + /**Fija el valor de id_tiplispropias + @param pId_tiplispropias nuevo Valor de id_tiplispropias*/ + public void setId_tiplispropias(Long pId_tiplispropias){ + id_tiplispropias=pId_tiplispropias; + } + + /**Obtiene el valor de observacion + @return valor de observacion*/ + public String getObservacion(){ + return observacion; + } + /**Fija el valor de observacion + @param pObservacion nuevo Valor de observacion*/ + public void setObservacion(String pObservacion){ + observacion=pObservacion; + } + + public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof OptmListaNegra))return false; + OptmListaNegra that = (OptmListaNegra) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /**Implementacin del metodo hashCode de la la entidad OptmListaNegra + @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /**Implementacin toString + */ + public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } + /**Implementacin de la creacin de un bean en blanco OptmListaNegra + */ + public Object createInstance(){ + OptmListaNegra instance=new OptmListaNegra(); + return instance; + } + /**Clona la entidad OptmListaNegra + @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException{ + OptmListaNegra p=(OptmListaNegra)this.clone(); + return p; + } + + + // Metodos manuales + + /** Sentencia que devuelve una lista de personas dado el nmero de identificacin.*/ + private static final String HQL_LIST_CONSEP_BY_IDENTIFICATION = + "from OptmListaNegra t " + + " where t.identificacion = :identifica " + + " and t.id_tiplisneg in('1','2')"; + + /** + * Metodo que entrega una lista de personas dado un nmero de identificacin. + * @param pEntityManager Sesion de la base de datos + * @param pIdentification Nmero de identificacin + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pIdentification) throws Exception { + List lneg = null; + Query qry = pEntityManager.createQuery(HQL_LIST_CONSEP_BY_IDENTIFICATION); + qry.setParameter("identifica", pIdentification); + lneg = qry.getResultList(); + return lneg; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneAccountInstallCharges.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneAccountInstallCharges.java new file mode 100644 index 0000000..0aa5882 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneAccountInstallCharges.java @@ -0,0 +1,198 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTINSTALLCHARGES*/ +@Entity(name="TgeneAccountInstallCharges") +@Table(name="TGENEACCOUNTINSTALLCHARGES") +public class TgeneAccountInstallCharges extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountInstallCharges +*/ +@EmbeddedId +private TgeneAccountInstallChargesKey pk; +@Column(name="DATEFROM", nullable=false) + +/** +* Fecha desde la cual esta definido el valor de cargos a asociar a las cuentas en regeneracion de tablas +*/ +private Timestamp datefrom; + +@Column(name="VALUE", nullable=true) + +/** +* Valor del cargo en la moneda de la operacion +*/ +private BigDecimal value; + +/**Contructor por defecto*/ +public TgeneAccountInstallCharges(){ +} +/**Contructor de TgeneAccountInstallCharges +@param pPk Clave Primaria del entity +@param pDatefrom Fecha desde la cual esta definido el valor de cargos a asociar a las cuentas en regeneracion de tablas +*/ +public TgeneAccountInstallCharges(TgeneAccountInstallChargesKey pPk,Timestamp pDatefrom){ + this(); + pk=pPk; + datefrom=pDatefrom; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountInstallCharges +*/ +public static TgeneAccountInstallCharges find(EntityManager pEntityManager,TgeneAccountInstallChargesKey pKey) throws Exception{ + TgeneAccountInstallCharges obj = pEntityManager.find(TgeneAccountInstallCharges.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountInstallCharges +@return El objeto que referencia a la Clave primaria de TgeneAccountInstallCharges +*/ +public TgeneAccountInstallChargesKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountInstallCharges +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountInstallCharges +*/ +public void setPk(TgeneAccountInstallChargesKey pPk){ + pk=pPk; +} +/**Obtiene el valor de datefrom +@return valor de datefrom*/ +public Timestamp getDatefrom(){ + return datefrom; +} +/**Fija el valor de datefrom +@param pDatefrom nuevo Valor de datefrom*/ +public void setDatefrom(Timestamp pDatefrom){ + datefrom=pDatefrom; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountInstallCharges))return false; + TgeneAccountInstallCharges that = (TgeneAccountInstallCharges) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneAccountInstallCharges +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneAccountInstallCharges +*/ +public Object createInstance(){ + TgeneAccountInstallCharges instance=new TgeneAccountInstallCharges(); + instance.setPk(new TgeneAccountInstallChargesKey()); + return instance; +} +/**Clona la entidad TgeneAccountInstallCharges +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountInstallCharges p=(TgeneAccountInstallCharges)this.clone(); + p.setPk((TgeneAccountInstallChargesKey)this.pk.cloneMe()); + return p; +} +public Object getId() { + return this.pk; +} + + //Metodos manuales. + /**Sentencia que devuelve la definicion de cargos a adicionar a la tabla de amortizacion.*/ + private static final String HQL_ACCOUNT_INSTALLMENT_CHARGES = + "from TgeneAccountInstallCharges taccoinstchr " + + " where taccoinstchr.pk.account = :account " + + " and taccoinstchr.pk.company = :company " + + " and taccoinstchr.pk.dateto = :dateto "; + + /** + * Metodo que entrega una lista con los cargos a adicionar a la tabla de amortizacion para una cuenta. + * @param pAccount Numero de cuenta. + * @param pCompany Compania a la que pertenece la cuenta. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager,String pAccount, + Integer pCompany) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_ACCOUNT_INSTALLMENT_CHARGES); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + lObjects = qry.getResultList(); + return lObjects; + } + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneAccountInstallChargesKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneAccountInstallChargesKey.java new file mode 100644 index 0000000..a2d2184 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneAccountInstallChargesKey.java @@ -0,0 +1,210 @@ +package com.fp.persistence.pgeneral.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTINSTALLCHARGES*/ +@Embeddable +public class TgeneAccountInstallChargesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta definido el valor de cargos a asociar a las cuentas en regeneracion de tablas +*/ +private Timestamp dateto; + +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +/**Contructor por defecto*/ +public TgeneAccountInstallChargesKey(){} +/**Contructor de TgeneAccountInstallChargesKey +@param pAccount Numero de cuenta +@param pDateto Fecha hasta la cual esta definido el valor de cargos a asociar a las cuentas en regeneracion de tablas +@param pBalancetype Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +@param pCompany Codigo de compania a la que pertence la cuenta +*/ +public TgeneAccountInstallChargesKey(String pAccount,Timestamp pDateto,String pBalancetype,String pBalancegroup,Integer pCompany){ + account=pAccount; + dateto=pDateto; + balancetype=pBalancetype; + balancegroup=pBalancegroup; + company=pCompany; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Implementacin de la comparacin de TgeneAccountInstallChargesKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountInstallChargesKey))return false; + TgeneAccountInstallChargesKey that = (TgeneAccountInstallChargesKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountInstallChargesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneAccountInstallRates.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneAccountInstallRates.java new file mode 100644 index 0000000..4e05b48 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneAccountInstallRates.java @@ -0,0 +1,696 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTINSTALLRATES */ +@Entity(name = "TgeneAccountInstallRates") +@Table(name = "TGENEACCOUNTINSTALLRATES") +public class TgeneAccountInstallRates extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneAccountInstallRates + */ + @EmbeddedId + private TgeneAccountInstallRatesKey pk; + + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta definido el registro de tasas que se aplican en una operacio + */ + private Timestamp datefrom; + + @Column(name = "BASERATECATALOG", nullable = true) + /** + * Codigo de catalogo de tasas base, BCE tasa banco central + */ + private String baseratecatalog; + + @Column(name = "BASERATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo BASERATE + */ + private String baseratecatalogcode; + + @Column(name = "PRINCIPALBALANCETYPE", nullable = true) + /** + * Cdigo de tipo de capital sobre el cual se aplica una tasa y se calcula un valor a provisionar + */ + private String principalbalancetype; + + @Column(name = "PRINCIPALBALANCEGROUP", nullable = true) + /** + * Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor + */ + private String principalbalancegroup; + + @Column(name = "NEGOTIABLE", nullable = true) + /** + * Indica si la tasa se puede negociar con el cliente + */ + private String negotiable; + + @Column(name = "BASERATE", nullable = true) + /** + * Tasa base + */ + private BigDecimal baserate; + + @Column(name = "MARGIN", nullable = true) + /** + * Margen a aplicar dado el operador + */ + private BigDecimal margin; + + @Column(name = "OPERATOR", nullable = true) + /** + * Operador a aplicar sobre la tasa base, +, - , % + */ + private String operator; + + @Column(name = "RATE", nullable = true) + /** + * Tasa total con la cual se calcula provisiones y tabla de pagos + */ + private BigDecimal rate; + + @Column(name = "EFFECTIVERATE", nullable = true) + /** + * Tasa efectiva + */ + private BigDecimal effectiverate; + + @Column(name = "WORKINGDATE", nullable = true) + /** + * Fecha en la que se produjo un cambio + */ + private Date workingdate; + + @Column(name = "REASON", nullable = true) + /** + * Motivo por el que se produjo el cambio: DES (desembolso) , etc + */ + private String reason; + + @Column(name = "READJUSTMENTOPERATOR", nullable = true) + /** + * Operador que se utilizara el momento del reajuste + */ + private String readjustmentoperator; + + @Column(name = "READJUSTMENTMARGIN", nullable = true) + /** + * Margen a aplicar en el reajuste + */ + private BigDecimal readjustmentmargin; + + @Column(name = "CALCULATEDRATE", nullable = true) + /** + * Tasa que se genero al calcular el reajuste. Esta tasa no necesariamente se aplicara, puesto que puede ser mayor que el maximo permitido por la tasa base. + */ + private BigDecimal calculatedrate; + + @Column(name = "ISNOMINALRATE", nullable = true) + /** + * Y, Indica que la defincion de la tasa base es efectiva, en este caso se calcula la tasa nominal, N la tasa base es nominal en este caso se calcula la tasa efectiva. + */ + private String isnominalrate; + + @Column(name = "READJUSTBASERATECATALOG", nullable = true) + /** + * Codigo de catalogo de tasas base de reajuste, BCE tasa banco central + */ + private String readjustbaseratecatalog; + + @Column(name = "READJUSTBASERATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo BASERATE + */ + private String readjustbaseratecatalogcode; + + @Column(name = "MAXBASERATECATALOG", nullable = true) + /** + * Codigo de catalogo de tasas base maxima, BCE tasa banco central + */ + private String maxbaseratecatalog; + + @Column(name = "MAXBASERATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo BASERATE + */ + private String maxbaseratecatalogcode; + + /** Contructor por defecto */ + public TgeneAccountInstallRates() { + } + + /** + * Contructor de TgeneAccountInstallRates + * + * @param pPk Clave Primaria del entity + */ + public TgeneAccountInstallRates(TgeneAccountInstallRatesKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneAccountInstallRates + */ + public static TgeneAccountInstallRates find(EntityManager pEntityManager, TgeneAccountInstallRatesKey pKey) throws Exception { + TgeneAccountInstallRates obj = pEntityManager.find(TgeneAccountInstallRates.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneAccountInstallRates + * + * @return El objeto que referencia a la Clave primaria de TgeneAccountInstallRates + */ + public TgeneAccountInstallRatesKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneAccountInstallRates + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountInstallRates + */ + public void setPk(TgeneAccountInstallRatesKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de baseratecatalog + * + * @return valor de baseratecatalog + */ + public String getBaseratecatalog() { + return this.baseratecatalog; + } + + /** + * Fija el valor de baseratecatalog + * + * @param pBaseratecatalog nuevo Valor de baseratecatalog + */ + public void setBaseratecatalog(String pBaseratecatalog) { + this.baseratecatalog = pBaseratecatalog; + } + + /** + * Obtiene el valor de baseratecatalogcode + * + * @return valor de baseratecatalogcode + */ + public String getBaseratecatalogcode() { + return this.baseratecatalogcode; + } + + /** + * Fija el valor de baseratecatalogcode + * + * @param pBaseratecatalogcode nuevo Valor de baseratecatalogcode + */ + public void setBaseratecatalogcode(String pBaseratecatalogcode) { + this.baseratecatalogcode = pBaseratecatalogcode; + } + + /** + * Obtiene el valor de principalbalancetype + * + * @return valor de principalbalancetype + */ + public String getPrincipalbalancetype() { + return this.principalbalancetype; + } + + /** + * Fija el valor de principalbalancetype + * + * @param pPrincipalbalancetype nuevo Valor de principalbalancetype + */ + public void setPrincipalbalancetype(String pPrincipalbalancetype) { + this.principalbalancetype = pPrincipalbalancetype; + } + + /** + * Obtiene el valor de principalbalancegroup + * + * @return valor de principalbalancegroup + */ + public String getPrincipalbalancegroup() { + return this.principalbalancegroup; + } + + /** + * Fija el valor de principalbalancegroup + * + * @param pPrincipalbalancegroup nuevo Valor de principalbalancegroup + */ + public void setPrincipalbalancegroup(String pPrincipalbalancegroup) { + this.principalbalancegroup = pPrincipalbalancegroup; + } + + /** + * Obtiene el valor de negotiable + * + * @return valor de negotiable + */ + public String getNegotiable() { + return this.negotiable; + } + + /** + * Fija el valor de negotiable + * + * @param pNegotiable nuevo Valor de negotiable + */ + public void setNegotiable(String pNegotiable) { + this.negotiable = pNegotiable; + } + + /** + * Obtiene el valor de baserate + * + * @return valor de baserate + */ + public BigDecimal getBaserate() { + return this.baserate; + } + + /** + * Fija el valor de baserate + * + * @param pBaserate nuevo Valor de baserate + */ + public void setBaserate(BigDecimal pBaserate) { + this.baserate = pBaserate; + } + + /** + * Obtiene el valor de margin + * + * @return valor de margin + */ + public BigDecimal getMargin() { + return this.margin; + } + + /** + * Fija el valor de margin + * + * @param pMargin nuevo Valor de margin + */ + public void setMargin(BigDecimal pMargin) { + this.margin = pMargin; + } + + /** + * Obtiene el valor de operator + * + * @return valor de operator + */ + public String getOperator() { + return this.operator; + } + + /** + * Fija el valor de operator + * + * @param pOperator nuevo Valor de operator + */ + public void setOperator(String pOperator) { + this.operator = pOperator; + } + + /** + * Obtiene el valor de rate + * + * @return valor de rate + */ + public BigDecimal getRate() { + return this.rate; + } + + /** + * Fija el valor de rate + * + * @param pRate nuevo Valor de rate + */ + public void setRate(BigDecimal pRate) { + this.rate = pRate; + } + + /** + * Obtiene el valor de effectiverate + * + * @return valor de effectiverate + */ + public BigDecimal getEffectiverate() { + return this.effectiverate; + } + + /** + * Fija el valor de effectiverate + * + * @param pEffectiverate nuevo Valor de effectiverate + */ + public void setEffectiverate(BigDecimal pEffectiverate) { + this.effectiverate = pEffectiverate; + } + + /** + * Obtiene el valor de workingdate + * + * @return valor de workingdate + */ + public Date getWorkingdate() { + return this.workingdate; + } + + /** + * Fija el valor de workingdate + * + * @param pWorkingdate nuevo Valor de workingdate + */ + public void setWorkingdate(Date pWorkingdate) { + this.workingdate = pWorkingdate; + } + + /** + * Obtiene el valor de reason + * + * @return valor de reason + */ + public String getReason() { + return this.reason; + } + + /** + * Fija el valor de reason + * + * @param pReason nuevo Valor de reason + */ + public void setReason(String pReason) { + this.reason = pReason; + } + + /** + * Obtiene el valor de readjustmentoperator + * + * @return valor de readjustmentoperator + */ + public String getReadjustmentoperator() { + return this.readjustmentoperator; + } + + /** + * Fija el valor de readjustmentoperator + * + * @param pReadjustmentoperator nuevo Valor de readjustmentoperator + */ + public void setReadjustmentoperator(String pReadjustmentoperator) { + this.readjustmentoperator = pReadjustmentoperator; + } + + /** + * Obtiene el valor de readjustmentmargin + * + * @return valor de readjustmentmargin + */ + public BigDecimal getReadjustmentmargin() { + return this.readjustmentmargin; + } + + /** + * Fija el valor de readjustmentmargin + * + * @param pReadjustmentmargin nuevo Valor de readjustmentmargin + */ + public void setReadjustmentmargin(BigDecimal pReadjustmentmargin) { + this.readjustmentmargin = pReadjustmentmargin; + } + + /** + * Obtiene el valor de calculatedrate + * + * @return valor de calculatedrate + */ + public BigDecimal getCalculatedrate() { + return this.calculatedrate; + } + + /** + * Fija el valor de calculatedrate + * + * @param pCalculatedrate nuevo Valor de calculatedrate + */ + public void setCalculatedrate(BigDecimal pCalculatedrate) { + this.calculatedrate = pCalculatedrate; + } + + /** + * Obtiene el valor de isnominalrate + * + * @return valor de isnominalrate + */ + public String getIsnominalrate() { + return this.isnominalrate; + } + + /** + * Fija el valor de isnominalrate + * + * @param pIsnominalrate nuevo Valor de isnominalrate + */ + public void setIsnominalrate(String pIsnominalrate) { + this.isnominalrate = pIsnominalrate; + } + + /** + * Obtiene el valor de readjustbaseratecatalog + * + * @return valor de readjustbaseratecatalog + */ + public String getReadjustbaseratecatalog() { + return this.readjustbaseratecatalog; + } + + /** + * Fija el valor de readjustbaseratecatalog + * + * @param pReadjustbaseratecatalog nuevo Valor de readjustbaseratecatalog + */ + public void setReadjustbaseratecatalog(String pReadjustbaseratecatalog) { + this.readjustbaseratecatalog = pReadjustbaseratecatalog; + } + + /** + * Obtiene el valor de readjustbaseratecatalogcode + * + * @return valor de readjustbaseratecatalogcode + */ + public String getReadjustbaseratecatalogcode() { + return this.readjustbaseratecatalogcode; + } + + /** + * Fija el valor de readjustbaseratecatalogcode + * + * @param pReadjustbaseratecatalogcode nuevo Valor de readjustbaseratecatalogcode + */ + public void setReadjustbaseratecatalogcode(String pReadjustbaseratecatalogcode) { + this.readjustbaseratecatalogcode = pReadjustbaseratecatalogcode; + } + + /** + * Obtiene el valor de maxbaseratecatalog + * + * @return valor de maxbaseratecatalog + */ + public String getMaxbaseratecatalog() { + return this.maxbaseratecatalog; + } + + /** + * Fija el valor de maxbaseratecatalog + * + * @param pMaxbaseratecatalog nuevo Valor de maxbaseratecatalog + */ + public void setMaxbaseratecatalog(String pMaxbaseratecatalog) { + this.maxbaseratecatalog = pMaxbaseratecatalog; + } + + /** + * Obtiene el valor de maxbaseratecatalogcode + * + * @return valor de maxbaseratecatalogcode + */ + public String getMaxbaseratecatalogcode() { + return this.maxbaseratecatalogcode; + } + + /** + * Fija el valor de maxbaseratecatalogcode + * + * @param pMaxbaseratecatalogcode nuevo Valor de maxbaseratecatalogcode + */ + public void setMaxbaseratecatalogcode(String pMaxbaseratecatalogcode) { + this.maxbaseratecatalogcode = pMaxbaseratecatalogcode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneAccountInstallRates)) { + return false; + } + TgeneAccountInstallRates that = (TgeneAccountInstallRates) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneAccountInstallRates + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneAccountInstallRates */ + @Override + public Object createInstance() { + TgeneAccountInstallRates instance = new TgeneAccountInstallRates(); + instance.setPk(new TgeneAccountInstallRatesKey()); + return instance; + } + + /** + * Clona la entidad TgeneAccountInstallRates + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneAccountInstallRates p = (TgeneAccountInstallRates) this.clone(); + p.setPk((TgeneAccountInstallRatesKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + + // Metodos manuales. + + /** Sentencia que devuelve la definicion de valores a provisionar asociados de una cuenta. */ + private static final String HQL_ACCOUNT_RATES = "from TgeneAccountInstallRates taccoinstrate " + " where taccoinstrate.pk.account = :account " + + " and taccoinstrate.pk.company = :company " + " and taccoinstrate.pk.dateto = :dateto "; + + /** + * Metodo que entrega una lista con los tipos de saldos a calcular tabla de amortizacion para una cuenta. + * + * @param pAccount Numero de cuenta. + * @param pCompany Compania a la que pertenece la cuenta. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pAccount, Integer pCompany) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_ACCOUNT_RATES); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + qry.setParameter("dateto", com.fp.common.helper.Constant.getDefaultExpiryDate()); + lObjects = qry.getResultList(); + return lObjects; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneAccountInstallRatesKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneAccountInstallRatesKey.java new file mode 100644 index 0000000..dcd1ad9 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneAccountInstallRatesKey.java @@ -0,0 +1,210 @@ +package com.fp.persistence.pgeneral.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTINSTALLRATES*/ +@Embeddable +public class TgeneAccountInstallRatesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta definido el registro de tasas que se aplican en una operacion +*/ +private Timestamp dateto; + +@Column(name="INTERESTBALANCETYPE", nullable=false,updatable=false) + +/** +* Codigo de tipo de saldo que provisiona en la tabla de cuotas. +*/ +private String interestbalancetype; + +@Column(name="INTERESTBALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String interestbalancegroup; + +/**Contructor por defecto*/ +public TgeneAccountInstallRatesKey(){} +/**Contructor de TgeneAccountInstallRatesKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pDateto Fecha hasta la cual esta definido el registro de tasas que se aplican en una operacion +@param pInterestbalancetype Codigo de tipo de saldo que provisiona en la tabla de cuotas. +@param pInterestbalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +public TgeneAccountInstallRatesKey(String pAccount,Integer pCompany,Timestamp pDateto,String pInterestbalancetype,String pInterestbalancegroup){ + account=pAccount; + company=pCompany; + dateto=pDateto; + interestbalancetype=pInterestbalancetype; + interestbalancegroup=pInterestbalancegroup; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de interestbalancetype +@return valor de interestbalancetype*/ +public String getInterestbalancetype(){ + return interestbalancetype; +} +/**Fija el valor de interestbalancetype +@param pInterestbalancetype nuevo Valor de interestbalancetype*/ +public void setInterestbalancetype(String pInterestbalancetype){ + interestbalancetype=pInterestbalancetype; +} + +/**Obtiene el valor de interestbalancegroup +@return valor de interestbalancegroup*/ +public String getInterestbalancegroup(){ + return interestbalancegroup; +} +/**Fija el valor de interestbalancegroup +@param pInterestbalancegroup nuevo Valor de interestbalancegroup*/ +public void setInterestbalancegroup(String pInterestbalancegroup){ + interestbalancegroup=pInterestbalancegroup; +} + +/**Implementacion de la comparacion de TgeneAccountInstallRatesKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountInstallRatesKey))return false; + TgeneAccountInstallRatesKey that = (TgeneAccountInstallRatesKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getInterestbalancetype() == null || that.getInterestbalancetype() == null){ + return false; + } + if (! this.getInterestbalancetype().equals(that.getInterestbalancetype())){ + return false; + } + if (this.getInterestbalancegroup() == null || that.getInterestbalancegroup() == null){ + return false; + } + if (! this.getInterestbalancegroup().equals(that.getInterestbalancegroup())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneAccountInstallRatesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getInterestbalancetype() == null ? 0 : this.getInterestbalancetype().hashCode()); + result = result * 37 + (this.getInterestbalancegroup() == null ? 0 : this.getInterestbalancegroup().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneAccountRelationship.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneAccountRelationship.java new file mode 100644 index 0000000..ca39072 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneAccountRelationship.java @@ -0,0 +1,378 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTRELATIONSHIP*/ +@Entity(name = "TgeneAccountRelationship") +@Table(name = "TGENEACCOUNTRELATIONSHIP") +public class TgeneAccountRelationship extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneAccountRelationship + */ + @EmbeddedId + private TgeneAccountRelationshipKey pk; + @Column(name = "MODULECODE", nullable = true) + /** + * Codigo de modulo + */ + private String modulecode; + @Column(name = "RELATIONSHIPCODE", nullable = true) + /** + * Codigo de relacion de la cuenta con el cliente + */ + private String relationshipcode; + @Column(name = "ISPRINCIPAL", nullable = true) + /** + * Indica si el codigo de relacion es principal, en este caso el codigo de cliente se asocia a la tabla tgeneaccount + */ + private String isprincipal; + @Column(name = "PRIORITY", nullable = true) + /** + * Prioridad del cliente en la cuenta. + */ + private Integer priority; + @Column(name = "CONDITION", nullable = true) + /** + * Condicion del cliente con la cuenta + */ + private String condition; + @Column(name = "PARTICIPATION", nullable = true) + /** + * Porcentaje de participacion del cliente con la solicitud. + */ + private BigDecimal participation; + @Column(name = "PERSONTYPE", nullable = true) + /** + * 1 Persona natural, 2 Persona Juridica. + */ + private String persontype; + + /**Contructor por defecto*/ + public TgeneAccountRelationship() { + } + + /**Contructor de TgeneAccountRelationship + @param pPk Clave Primaria del entity + */ + public TgeneAccountRelationship(TgeneAccountRelationshipKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneAccountRelationship + */ + public static TgeneAccountRelationship find(EntityManager pEntityManager, TgeneAccountRelationshipKey pKey) throws Exception { + TgeneAccountRelationship obj = pEntityManager.find(TgeneAccountRelationship.class, pKey); + return obj; + } + + /**Entrega la Clave primaria de TgeneAccountRelationship + @return El objeto que referencia a la Clave primaria de TgeneAccountRelationship + */ + public TgeneAccountRelationshipKey getPk() { + return this.pk; + } + + /**Fija un nuevo valor a la Clave primaria de TgeneAccountRelationship + @param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountRelationship + */ + public void setPk(TgeneAccountRelationshipKey pPk) { + this.pk = pPk; + } + + /**Obtiene el valor de modulecode + @return valor de modulecode*/ + public String getModulecode() { + return this.modulecode; + } + + /**Fija el valor de modulecode + @param pModulecode nuevo Valor de modulecode*/ + public void setModulecode(String pModulecode) { + this.modulecode = pModulecode; + } + + /**Obtiene el valor de relationshipcode + @return valor de relationshipcode*/ + public String getRelationshipcode() { + return this.relationshipcode; + } + + /**Fija el valor de relationshipcode + @param pRelationshipcode nuevo Valor de relationshipcode*/ + public void setRelationshipcode(String pRelationshipcode) { + this.relationshipcode = pRelationshipcode; + } + + /**Obtiene el valor de isprincipal + @return valor de isprincipal*/ + public String getIsprincipal() { + return this.isprincipal; + } + + /**Fija el valor de isprincipal + @param pIsprincipal nuevo Valor de isprincipal*/ + public void setIsprincipal(String pIsprincipal) { + this.isprincipal = pIsprincipal; + } + + /**Obtiene el valor de priority + @return valor de priority*/ + public Integer getPriority() { + return this.priority; + } + + /**Fija el valor de priority + @param pPriority nuevo Valor de priority*/ + public void setPriority(Integer pPriority) { + this.priority = pPriority; + } + + /**Obtiene el valor de condition + @return valor de condition*/ + public String getCondition() { + return this.condition; + } + + /**Fija el valor de condition + @param pCondition nuevo Valor de condition*/ + public void setCondition(String pCondition) { + this.condition = pCondition; + } + + /**Obtiene el valor de participation + @return valor de participation*/ + public BigDecimal getParticipation() { + return this.participation; + } + + /**Fija el valor de participation + @param pParticipation nuevo Valor de participation*/ + public void setParticipation(BigDecimal pParticipation) { + this.participation = pParticipation; + } + + /**Obtiene el valor de persontype + @return valor de persontype*/ + public String getPersontype() { + return this.persontype; + } + + /**Fija el valor de persontype + @param pPersontype nuevo Valor de persontype*/ + public void setPersontype(String pPersontype) { + this.persontype = pPersontype; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneAccountRelationship)) { + return false; + } + TgeneAccountRelationship that = (TgeneAccountRelationship) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /**Implementaci�n del metodo hashCode de la la entidad TgeneAccountRelationship + @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /**Implementaci�n toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /**Implementaci�n de la creaci�n de un bean en blanco TgeneAccountRelationship + */ + @Override + public Object createInstance() { + TgeneAccountRelationship instance = new TgeneAccountRelationship(); + instance.setPk(new TgeneAccountRelationshipKey()); + return instance; + } + + /**Clona la entidad TgeneAccountRelationship + @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneAccountRelationship p = (TgeneAccountRelationship) this.clone(); + p.setPk((TgeneAccountRelationshipKey) this.pk.cloneMe()); + return p; + } + //METODOS MANUALES + /** Sentencia que devuelve las productos de un cliente. */ + private static final String JPQL_ACC_RELATIONSHIP = "from TgeneAccountRelationship solrel " + + " where solrel.modulecode = :modulecode " + " and solrel.pk.personcode = :personcode "; + /** Sentencia que devuelve las productos de un cliente dado el companycode. */ + private static final String JPQL_ACC_RELATIONSHIP_COMPANY = "from TgeneAccountRelationship solrel " + + " where solrel.modulecode = :modulecode " + " and solrel.pk.personcode = :personcode " + " and solrel.pk.company = :companycode "; + + /** + * Entrega los cuentas de un cliente dado el módulo + * + * @param pModulecode Codigo del modulo. + * @param pPersoncode Codigo del cliente. + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findbyclient(EntityManager pEntityManager, String pModulecode, Integer pPersoncode) { + List lAccounts = null; + Query qry = pEntityManager.createQuery(TgeneAccountRelationship.JPQL_ACC_RELATIONSHIP); + qry.setParameter("modulecode", pModulecode); + qry.setParameter("personcode", pPersoncode); + lAccounts = qry.getResultList(); + return lAccounts; + } + + /** + * Entrega los cuentas de un cliente dado el módulo + * + * @param pModulecode Codigo del modulo. + * @param pPersoncode Codigo del cliente. + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findbyCompany(EntityManager pEntityManager, String pModulecode, Integer pPersoncode, Integer pCompanycode) { + List lAccounts = null; + Query qry = pEntityManager.createQuery(TgeneAccountRelationship.JPQL_ACC_RELATIONSHIP_COMPANY); + qry.setParameter("modulecode", pModulecode); + qry.setParameter("personcode", pPersoncode); + qry.setParameter("companycode", pCompanycode); + lAccounts = qry.getResultList(); + return lAccounts; + } + + /** Sentencia que devuelve las productos de un cliente. */ + private static final String JPQL_ACC_CLIENTS = "from TgeneAccountRelationship accrel " + + " where accrel.pk.account = :account " + " and accrel.pk.company = :company "; + /** + * Entrega los clientes asociados a una cuenta + * + * @param paccount Cuenta. + * @param pcompany compania de la cuenta + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findbyAccount(EntityManager pEntityManager,String pAccount, Integer pCompany) { + List lAccounts = null; + Query qry = pEntityManager.createQuery(TgeneAccountRelationship.JPQL_ACC_CLIENTS); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + lAccounts = qry.getResultList(); + return lAccounts; + } + + /** Sentencia que devuelve las productos de un cliente. */ + private static final String JPQL_ACC_RELATIONSHIP_PRINCIPAL = " from TgeneAccountRelationship rel " + + "where rel.modulecode = :strCrFacilityProduct and rel.pk.personcode = :pPersoncode " + + "and rel.isprincipal = :clientype and rel.pk.company = :pcompany and rel.pk.account in " + + "( select cfdet.pk.account from TcreditFacilityDetail cfdet where cfdet.pk.modulecode = :pModulecode " + + "and cfdet.pk.productcode = :productcode and cfdet.pk.subproductcode = :subproductcode " + + "and cfdet.pk.company = :pcompany and cfdet.pk.currencycode = :currencycode)"; + + /** + * Findbyclient. + * + * @param pEntityManager the entity manager + * @param pcompany the pcompany + * @param pModulecode the modulecode + * @param productcode the productcode + * @param subproductcode the subproductcode + * @param currencycode the currencycode + * @param pPersoncode the personcode + * @param pisprincipal the pisprincipal + * @return the list + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findbyclient(EntityManager pEntityManager, Integer pcompany, String pModulecode, String productcode, + String subproductcode, String currencycode, Integer pPersoncode, boolean pisprincipal) { + List lAccounts = null; + + String strCrFacilityProduct = "16"; + String strclienttype = !pisprincipal ? "N" : "Y"; + + Query qry = pEntityManager.createQuery(TgeneAccountRelationship.JPQL_ACC_RELATIONSHIP_PRINCIPAL); + qry.setParameter("pcompany", pcompany); + qry.setParameter("pModulecode", pModulecode); + qry.setParameter("productcode", productcode); + qry.setParameter("subproductcode", subproductcode); + qry.setParameter("currencycode", currencycode); + qry.setParameter("pPersoncode", pPersoncode); + qry.setParameter("strCrFacilityProduct", strCrFacilityProduct); + qry.setParameter("clientype", strclienttype); + + lAccounts = qry.getResultList(); + return lAccounts; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneAccountRelationshipKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneAccountRelationshipKey.java new file mode 100644 index 0000000..0d1afe2 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneAccountRelationshipKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTRELATIONSHIP*/ +@Embeddable +public class TgeneAccountRelationshipKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +/**Contructor por defecto*/ +public TgeneAccountRelationshipKey(){} +/**Contructor de TgeneAccountRelationshipKey +@param pAccount Numero de cuenta +@param pPersoncode Codigo de persona +@param pCompany Codigo de compania a la que pertence la cuenta +*/ +public TgeneAccountRelationshipKey(String pAccount,Integer pPersoncode,Integer pCompany){ + account=pAccount; + personcode=pPersoncode; + company=pCompany; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Implementacin de la comparacin de TgeneAccountRelationshipKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountRelationshipKey))return false; + TgeneAccountRelationshipKey that = (TgeneAccountRelationshipKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAccountRelationshipKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneArea.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneArea.java new file mode 100644 index 0000000..c0b85e4 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneArea.java @@ -0,0 +1,159 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEAREA*/ +@Entity(name="TgeneArea") +@Table(name="TGENEAREA") +public class TgeneArea extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneArea +*/ +@EmbeddedId +private TgeneAreaKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPCTION", nullable=true) + +/** +* Nombre del area +*/ +private String descripction; + +/**Contructor por defecto*/ +public TgeneArea(){ +} +/**Contructor de TgeneArea +@param pPk Clave Primaria del entity +*/ +public TgeneArea(TgeneAreaKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneArea +*/ +public static TgeneArea find(EntityManager pEntityManager,TgeneAreaKey pKey) throws Exception{ + TgeneArea obj = pEntityManager.find(TgeneArea.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneArea +@return El objeto que referencia a la Clave primaria de TgeneArea +*/ +public TgeneAreaKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneArea +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneArea +*/ +public void setPk(TgeneAreaKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de descripction +@return valor de descripction*/ +public String getDescripction(){ + return descripction; +} +/**Fija el valor de descripction +@param pDescripction nuevo Valor de descripction*/ +public void setDescripction(String pDescripction){ + descripction=pDescripction; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneArea))return false; + TgeneArea that = (TgeneArea) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneArea +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneArea +*/ +public Object createInstance(){ + TgeneArea instance=new TgeneArea(); + instance.setPk(new TgeneAreaKey()); + return instance; +} +/**Clona la entidad TgeneArea +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneArea p=(TgeneArea)this.clone(); + p.setPk((TgeneAreaKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneAreaKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneAreaKey.java new file mode 100644 index 0000000..d2e3688 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneAreaKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEAREA*/ +@Embeddable +public class TgeneAreaKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertenece el departamento +*/ +private Integer companycode; + +@Column(name="AREACODE", nullable=false,updatable=false) + +/** +* Codigo de area +*/ +private Integer areacode; + +/**Contructor por defecto*/ +public TgeneAreaKey(){} +/**Contructor de TgeneAreaKey +@param pCompanycode Codigo de compania a la que pertenece el departamento +@param pAreacode Codigo de area +*/ +public TgeneAreaKey(Integer pCompanycode,Integer pAreacode){ + companycode=pCompanycode; + areacode=pAreacode; +} +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de areacode +@return valor de areacode*/ +public Integer getAreacode(){ + return areacode; +} +/**Fija el valor de areacode +@param pAreacode nuevo Valor de areacode*/ +public void setAreacode(Integer pAreacode){ + areacode=pAreacode; +} + +/**Implementacin de la comparacin de TgeneAreaKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAreaKey))return false; + TgeneAreaKey that = (TgeneAreaKey) o; + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getAreacode() == null || that.getAreacode() == null){ + return false; + } + if (! this.getAreacode().equals(that.getAreacode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneAreaKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getAreacode() == null ? 0 : this.getAreacode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneBalanceGroup.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneBalanceGroup.java new file mode 100644 index 0000000..bdc3fb3 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneBalanceGroup.java @@ -0,0 +1,200 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEBALANCEGROUP*/ +@Entity(name="TgeneBalanceGroup") +@Table(name="TGENEBALANCEGROUP") +public class TgeneBalanceGroup extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneBalanceGroup +*/ +@Id +@Column(name="BALANCEGROUP" ,nullable=false, updatable=false) +private String pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="ISADD", nullable=false) + +/** +* Indica que lado de la transaccion relaliza la suma, ejemplo en activos suma D, pasivos suma C +*/ +private String isadd; + +@Column(name="DESCRIPTION", nullable=false) + +/** +* Descripcion del grupo de balance +*/ +private String description; + +@Column(name="OPPOSITE", nullable=true) + +/** +* Codigo de grupo de balance que se afecta por el contrario ejl Balancegroup 61, opposite 62 +*/ +private String opposite; + +/**Contructor por defecto*/ +public TgeneBalanceGroup(){ +} +/**Contructor de TgeneBalanceGroup +@param pPk Clave Primaria del entity +@param pIsadd Indica que lado de la transaccion relaliza la suma, ejemplo en activos suma D, pasivos suma C +@param pDescription Descripcion del grupo de balance +*/ +public TgeneBalanceGroup(String pPk,String pIsadd,String pDescription){ + this(); + pk=pPk; + isadd=pIsadd; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneBalanceGroup +*/ +public static TgeneBalanceGroup find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneBalanceGroup obj = pEntityManager.find(TgeneBalanceGroup.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneBalanceGroup +@return El objeto que referencia a la Clave primaria de TgeneBalanceGroup +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneBalanceGroup +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneBalanceGroup +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de isadd +@return valor de isadd*/ +public String getIsadd(){ + return isadd; +} +/**Fija el valor de isadd +@param pIsadd nuevo Valor de isadd*/ +public void setIsadd(String pIsadd){ + isadd=pIsadd; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de opposite +@return valor de opposite*/ +public String getOpposite(){ + return opposite; +} +/**Fija el valor de opposite +@param pOpposite nuevo Valor de opposite*/ +public void setOpposite(String pOpposite){ + opposite=pOpposite; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneBalanceGroup))return false; + TgeneBalanceGroup that = (TgeneBalanceGroup) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneBalanceGroup +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneBalanceGroup +*/ +public Object createInstance(){ + TgeneBalanceGroup instance=new TgeneBalanceGroup(); + return instance; +} +/**Clona la entidad TgeneBalanceGroup +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneBalanceGroup p=(TgeneBalanceGroup)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneBalanceType.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneBalanceType.java new file mode 100644 index 0000000..631106f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneBalanceType.java @@ -0,0 +1,197 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEBALANCETYPE*/ +@Entity(name="TgeneBalanceType") +@Table(name="TGENEBALANCETYPE") +public class TgeneBalanceType extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneBalanceType +*/ +@EmbeddedId +private TgeneBalanceTypeKey pk; +@Column(name="DESCRIPTION", nullable=false) + +/** +* Descripcin del tipo de saldo +*/ +private String description; + +@Column(name="BALANCECATEGORY", nullable=true) + +/** +* Categoria del tipo de saldo, Interes, Capita; Seguros, Cargos, Impuestos etc, +*/ +private String balancecategory; + +@Column(name="MODULECODE", nullable=true) + +/** +* Codigo de modulo al que pertenece el tipo de saldo. +*/ +private String modulecode; + +@Column(name="CHARGEFORINSTALLMENT", nullable=true) + +/** +* Y indica que el cargo sirve para incluir en tablas de amortizacion, N el cargo no va a tablas de amortizacion. +*/ +private String chargeforinstallment; + +/**Contructor por defecto*/ +public TgeneBalanceType(){ +} +/**Contructor de TgeneBalanceType +@param pPk Clave Primaria del entity +@param pDescription Descripcin del tipo de saldo +*/ +public TgeneBalanceType(TgeneBalanceTypeKey pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneBalanceType +*/ +public static TgeneBalanceType find(EntityManager pEntityManager,TgeneBalanceTypeKey pKey) throws Exception{ + TgeneBalanceType obj = pEntityManager.find(TgeneBalanceType.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneBalanceType +@return El objeto que referencia a la Clave primaria de TgeneBalanceType +*/ +public TgeneBalanceTypeKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneBalanceType +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneBalanceType +*/ +public void setPk(TgeneBalanceTypeKey pPk){ + pk=pPk; +} +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de balancecategory +@return valor de balancecategory*/ +public String getBalancecategory(){ + return balancecategory; +} +/**Fija el valor de balancecategory +@param pBalancecategory nuevo Valor de balancecategory*/ +public void setBalancecategory(String pBalancecategory){ + balancecategory=pBalancecategory; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de chargeforinstallment +@return valor de chargeforinstallment*/ +public String getChargeforinstallment(){ + return chargeforinstallment; +} +/**Fija el valor de chargeforinstallment +@param pChargeforinstallment nuevo Valor de chargeforinstallment*/ +public void setChargeforinstallment(String pChargeforinstallment){ + chargeforinstallment=pChargeforinstallment; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneBalanceType))return false; + TgeneBalanceType that = (TgeneBalanceType) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneBalanceType +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneBalanceType +*/ +public Object createInstance(){ + TgeneBalanceType instance=new TgeneBalanceType(); + instance.setPk(new TgeneBalanceTypeKey()); + return instance; +} +/**Clona la entidad TgeneBalanceType +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneBalanceType p=(TgeneBalanceType)this.clone(); + p.setPk((TgeneBalanceTypeKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneBalanceTypeDetail.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneBalanceTypeDetail.java new file mode 100644 index 0000000..3174975 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneBalanceTypeDetail.java @@ -0,0 +1,269 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEBALANCETYPEDETAIL*/ +@Entity(name="TgeneBalanceTypeDetail") +@Table(name="TGENEBALANCETYPEDETAIL") +public class TgeneBalanceTypeDetail extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneBalanceTypeDetail +*/ +@EmbeddedId +private TgeneBalanceTypeDetailKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de bloqueo optimista del registro +*/ +private Integer recordversion; + +@Column(name="COMMANDBALANCE", nullable=true) + +/** +* Clase que se encarga de la actualizacin de saldos +*/ +private String commandbalance; + +@Column(name="FIELDNAME", nullable=true) + +/** +* Campo que actualiza la actualiza en el commandbalance asociado al tipo de saldo, Ejemplo cash, Locked +*/ +private String fieldname; + +@Column(name="ACCOUNTINGCODE", nullable=true) + +/** +* Codigo contable asociado al tipo de saldo grupo de balance, Ejemplo 2101PPMMEE01 o 51040101 +*/ +private String accountingcode; + +@Column(name="MANAGECACHE", nullable=true) + +/** +* Indica si el registro se almacena en cache del servidor de aplicaciones. +*/ +private String managecache; + +@Column(name="ISPROVISON", nullable=true) + +/** +* Indica que en valor del tipo de saldo es resultado del calculo de provisiones +*/ +private String isprovison; + +@Column(name="CALCULATEPROVISION", nullable=true) + +/** +* Indica si se calcula accruales sobre el saldo asociado al tipo de saldo +*/ +private String calculateprovision; + +@Column(name="BRANCHAMONG", nullable=true) + +/** +* null +*/ +private String branchamong; + +/**Contructor por defecto*/ +public TgeneBalanceTypeDetail(){ +} +/**Contructor de TgeneBalanceTypeDetail +@param pPk Clave Primaria del entity +*/ +public TgeneBalanceTypeDetail(TgeneBalanceTypeDetailKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneBalanceTypeDetail +*/ +public static TgeneBalanceTypeDetail find(EntityManager pEntityManager,TgeneBalanceTypeDetailKey pKey) throws Exception{ + TgeneBalanceTypeDetail obj = pEntityManager.find(TgeneBalanceTypeDetail.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneBalanceTypeDetail +@return El objeto que referencia a la Clave primaria de TgeneBalanceTypeDetail +*/ +public TgeneBalanceTypeDetailKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneBalanceTypeDetail +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneBalanceTypeDetail +*/ +public void setPk(TgeneBalanceTypeDetailKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de commandbalance +@return valor de commandbalance*/ +public String getCommandbalance(){ + return commandbalance; +} +/**Fija el valor de commandbalance +@param pCommandbalance nuevo Valor de commandbalance*/ +public void setCommandbalance(String pCommandbalance){ + commandbalance=pCommandbalance; +} + +/**Obtiene el valor de fieldname +@return valor de fieldname*/ +public String getFieldname(){ + return fieldname; +} +/**Fija el valor de fieldname +@param pFieldname nuevo Valor de fieldname*/ +public void setFieldname(String pFieldname){ + fieldname=pFieldname; +} + +/**Obtiene el valor de accountingcode +@return valor de accountingcode*/ +public String getAccountingcode(){ + return accountingcode; +} +/**Fija el valor de accountingcode +@param pAccountingcode nuevo Valor de accountingcode*/ +public void setAccountingcode(String pAccountingcode){ + accountingcode=pAccountingcode; +} + +/**Obtiene el valor de managecache +@return valor de managecache*/ +public String getManagecache(){ + return managecache; +} +/**Fija el valor de managecache +@param pManagecache nuevo Valor de managecache*/ +public void setManagecache(String pManagecache){ + managecache=pManagecache; +} + +/**Obtiene el valor de isprovison +@return valor de isprovison*/ +public String getIsprovison(){ + return isprovison; +} +/**Fija el valor de isprovison +@param pIsprovison nuevo Valor de isprovison*/ +public void setIsprovison(String pIsprovison){ + isprovison=pIsprovison; +} + +/**Obtiene el valor de calculateprovision +@return valor de calculateprovision*/ +public String getCalculateprovision(){ + return calculateprovision; +} +/**Fija el valor de calculateprovision +@param pCalculateprovision nuevo Valor de calculateprovision*/ +public void setCalculateprovision(String pCalculateprovision){ + calculateprovision=pCalculateprovision; +} + +/**Obtiene el valor de branchamong +@return valor de branchamong*/ +public String getBranchamong(){ + return branchamong; +} +/**Fija el valor de branchamong +@param pBranchamong nuevo Valor de branchamong*/ +public void setBranchamong(String pBranchamong){ + branchamong=pBranchamong; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneBalanceTypeDetail))return false; + TgeneBalanceTypeDetail that = (TgeneBalanceTypeDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneBalanceTypeDetail +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneBalanceTypeDetail +*/ +public Object createInstance(){ + TgeneBalanceTypeDetail instance=new TgeneBalanceTypeDetail(); + instance.setPk(new TgeneBalanceTypeDetailKey()); + return instance; +} +/**Clona la entidad TgeneBalanceTypeDetail +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneBalanceTypeDetail p=(TgeneBalanceTypeDetail)this.clone(); + p.setPk((TgeneBalanceTypeDetailKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneBalanceTypeDetailKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneBalanceTypeDetailKey.java new file mode 100644 index 0000000..2a487e1 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneBalanceTypeDetailKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEBALANCETYPEDETAIL*/ +@Embeddable +public class TgeneBalanceTypeDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +/**Contructor por defecto*/ +public TgeneBalanceTypeDetailKey(){} +/**Contructor de TgeneBalanceTypeDetailKey +@param pBalancetype Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +public TgeneBalanceTypeDetailKey(String pBalancetype,String pBalancegroup){ + balancetype=pBalancetype; + balancegroup=pBalancegroup; +} +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Implementacin de la comparacin de TgeneBalanceTypeDetailKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneBalanceTypeDetailKey))return false; + TgeneBalanceTypeDetailKey that = (TgeneBalanceTypeDetailKey) o; + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneBalanceTypeDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneBalanceTypeKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneBalanceTypeKey.java new file mode 100644 index 0000000..157434a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneBalanceTypeKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEBALANCETYPE*/ +@Embeddable +public class TgeneBalanceTypeKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +/**Contructor por defecto*/ +public TgeneBalanceTypeKey(){} +/**Contructor de TgeneBalanceTypeKey +@param pBalancetype Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +public TgeneBalanceTypeKey(String pBalancetype,String pBalancegroup){ + balancetype=pBalancetype; + balancegroup=pBalancegroup; +} +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Implementacin de la comparacin de TgeneBalanceTypeKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneBalanceTypeKey))return false; + TgeneBalanceTypeKey that = (TgeneBalanceTypeKey) o; + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneBalanceTypeKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneBranch.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneBranch.java new file mode 100644 index 0000000..825b6bd --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneBranch.java @@ -0,0 +1,238 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; +import com.fp.general.exception.GeneralException; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENEBRANCH + */ +@Entity(name = "TgeneBranch") +@Table(name = "TGENEBRANCH") +public class TgeneBranch extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneBranch + */ + @EmbeddedId + private TgeneBranchKey pk; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "DESCRIPTION", nullable = true) + /** + * Nombre de la sucursal + */ + private String description; + + /** Contructor por defecto */ + public TgeneBranch() { + } + + /** + * Contructor de TgeneBranch + * + * @param pPk + * Clave Primaria del entity + */ + public TgeneBranch(TgeneBranchKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager + * referencia de la session a obtener datos del bean. + * @param pKey + * Caleve primaria del bean. + * @return TgeneBranch + */ + public static TgeneBranch find(EntityManager pEntityManager, + TgeneBranchKey pKey) throws Exception { + TgeneBranch obj = pEntityManager.find(TgeneBranch.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneBranch + * + * @return El objeto que referencia a la Clave primaria de TgeneBranch + */ + public TgeneBranchKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneBranch + * + * @param pPk + * El objeto que referencia a la nueva Clave primaria de + * TgeneBranch + */ + public void setPk(TgeneBranchKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion + * nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription + * nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneBranch)) + return false; + TgeneBranch that = (TgeneBranch) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneBranch + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 + || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneBranch */ + public Object createInstance() { + TgeneBranch instance = new TgeneBranch(); + instance.setPk(new TgeneBranchKey()); + return instance; + } + + /** + * Clona la entidad TgeneBranch + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneBranch p = (TgeneBranch) this.clone(); + p.setPk((TgeneBranchKey) this.pk.cloneMe()); + return p; + } + + //Metodos manuales. + /** Sentencia que devuelve un registro de TgeneBranch.*/ + private static final String JPQL_BRANCH = + "from TgeneBranch tb " + + " where tb.pk.branchcode = :branch " + + " and tb.pk.companycode = :company "; + + /** + * Metodo que entrega datos de una sucursal definidos en TgeneBranch. + * @param pBranch Codigo de sucursal. + * @param pCompany Compania a la que pertenece la cuenta. + * @return TgeneBranch + * @throws Exception + */ + public static TgeneBranch find(EntityManager pEntityManager ,Integer pBranch, Integer pCompany) throws Exception { + Query qry = pEntityManager.createQuery(JPQL_BRANCH); + qry.setParameter("branch", pBranch); + qry.setParameter("company", pCompany); + try { + return (TgeneBranch) qry.getSingleResult(); + } catch (NoResultException e) { + throw new GeneralException("GENE-0001", "SUCURSAL NO DEFINIDA EN TGENEBRANCH: BRANCH:{0} COMPANY:{1}", + pBranch, pCompany); + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneBranchKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneBranchKey.java new file mode 100644 index 0000000..0a31e06 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneBranchKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEBRANCH*/ +@Embeddable +public class TgeneBranchKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="BRANCHCODE", nullable=false,updatable=false) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania al que pertenece la sucursal +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TgeneBranchKey(){} +/**Contructor de TgeneBranchKey +@param pBranchcode Codigo de sucursal +@param pCompanycode Codigo de compania al que pertenece la sucursal +*/ +public TgeneBranchKey(Integer pBranchcode,Integer pCompanycode){ + branchcode=pBranchcode; + companycode=pCompanycode; +} +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacin de la comparacin de TgeneBranchKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneBranchKey))return false; + TgeneBranchKey that = (TgeneBranchKey) o; + if (this.getBranchcode() == null || that.getBranchcode() == null){ + return false; + } + if (! this.getBranchcode().equals(that.getBranchcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneBranchKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getBranchcode() == null ? 0 : this.getBranchcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCanton.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCanton.java new file mode 100644 index 0000000..1e935db --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCanton.java @@ -0,0 +1,159 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECANTON*/ +@Entity(name="TgeneCanton") +@Table(name="TGENECANTON") +public class TgeneCanton extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCanton +*/ +@EmbeddedId +private TgeneCantonKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion default del canton. +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneCanton(){ +} +/**Contructor de TgeneCanton +@param pPk Clave Primaria del entity +*/ +public TgeneCanton(TgeneCantonKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCanton +*/ +public static TgeneCanton find(EntityManager pEntityManager,TgeneCantonKey pKey) throws Exception{ + TgeneCanton obj = pEntityManager.find(TgeneCanton.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCanton +@return El objeto que referencia a la Clave primaria de TgeneCanton +*/ +public TgeneCantonKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCanton +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCanton +*/ +public void setPk(TgeneCantonKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCanton))return false; + TgeneCanton that = (TgeneCanton) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneCanton +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneCanton +*/ +public Object createInstance(){ + TgeneCanton instance=new TgeneCanton(); + instance.setPk(new TgeneCantonKey()); + return instance; +} +/**Clona la entidad TgeneCanton +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCanton p=(TgeneCanton)this.clone(); + p.setPk((TgeneCantonKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCantonKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCantonKey.java new file mode 100644 index 0000000..c56cc6d --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCantonKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENECANTON*/ +@Embeddable +public class TgeneCantonKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COUNTRYCODE", nullable=false,updatable=false) + +/** +* Codigo de pais +*/ +private String countrycode; + +@Column(name="PROVINCECODE", nullable=false,updatable=false) + +/** +* Codigo de provincia +*/ +private String provincecode; + +@Column(name="CANTONCODE", nullable=false,updatable=false) + +/** +* Codigo de canton +*/ +private String cantoncode; + +/**Contructor por defecto*/ +public TgeneCantonKey(){} +/**Contructor de TgeneCantonKey +@param pCountrycode Codigo de pais +@param pProvincecode Codigo de provincia +@param pCantoncode Codigo de canton +*/ +public TgeneCantonKey(String pCountrycode,String pProvincecode,String pCantoncode){ + countrycode=pCountrycode; + provincecode=pProvincecode; + cantoncode=pCantoncode; +} +/**Obtiene el valor de countrycode +@return valor de countrycode*/ +public String getCountrycode(){ + return countrycode; +} +/**Fija el valor de countrycode +@param pCountrycode nuevo Valor de countrycode*/ +public void setCountrycode(String pCountrycode){ + countrycode=pCountrycode; +} + +/**Obtiene el valor de provincecode +@return valor de provincecode*/ +public String getProvincecode(){ + return provincecode; +} +/**Fija el valor de provincecode +@param pProvincecode nuevo Valor de provincecode*/ +public void setProvincecode(String pProvincecode){ + provincecode=pProvincecode; +} + +/**Obtiene el valor de cantoncode +@return valor de cantoncode*/ +public String getCantoncode(){ + return cantoncode; +} +/**Fija el valor de cantoncode +@param pCantoncode nuevo Valor de cantoncode*/ +public void setCantoncode(String pCantoncode){ + cantoncode=pCantoncode; +} + +/**Implementacin de la comparacin de TgeneCantonKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneCantonKey))return false; + TgeneCantonKey that = (TgeneCantonKey) o; + if (this.getCountrycode() == null || that.getCountrycode() == null){ + return false; + } + if (! this.getCountrycode().equals(that.getCountrycode())){ + return false; + } + if (this.getProvincecode() == null || that.getProvincecode() == null){ + return false; + } + if (! this.getProvincecode().equals(that.getProvincecode())){ + return false; + } + if (this.getCantoncode() == null || that.getCantoncode() == null){ + return false; + } + if (! this.getCantoncode().equals(that.getCantoncode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneCantonKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCountrycode() == null ? 0 : this.getCountrycode().hashCode()); + result = result * 37 + (this.getProvincecode() == null ? 0 : this.getProvincecode().hashCode()); + result = result * 37 + (this.getCantoncode() == null ? 0 : this.getCantoncode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCashClose.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCashClose.java new file mode 100644 index 0000000..1d47c7b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCashClose.java @@ -0,0 +1,122 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECASHCLOSE*/ +@Entity(name="TgeneCashClose") +@Table(name="TGENECASHCLOSE") +public class TgeneCashClose extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCashClose +*/ +@EmbeddedId +private TgeneCashCloseKey pk; +/**Contructor por defecto*/ +public TgeneCashClose(){ +} +/**Contructor de TgeneCashClose +@param pPk Clave Primaria del entity +*/ +public TgeneCashClose(TgeneCashCloseKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCashClose +*/ +public static TgeneCashClose find(EntityManager pEntityManager,TgeneCashCloseKey pKey) throws Exception{ + TgeneCashClose obj = pEntityManager.find(TgeneCashClose.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCashClose +@return El objeto que referencia a la Clave primaria de TgeneCashClose +*/ +public TgeneCashCloseKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCashClose +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCashClose +*/ +public void setPk(TgeneCashCloseKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCashClose))return false; + TgeneCashClose that = (TgeneCashClose) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneCashClose +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneCashClose +*/ +public Object createInstance(){ + TgeneCashClose instance=new TgeneCashClose(); + instance.setPk(new TgeneCashCloseKey()); + return instance; +} +/**Clona la entidad TgeneCashClose +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCashClose p=(TgeneCashClose)this.clone(); + p.setPk((TgeneCashCloseKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCashCloseDetail.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCashCloseDetail.java new file mode 100644 index 0000000..3e67032 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCashCloseDetail.java @@ -0,0 +1,159 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECASHCLOSEDETAIL*/ +@Entity(name="TgeneCashCloseDetail") +@Table(name="TGENECASHCLOSEDETAIL") +public class TgeneCashCloseDetail extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCashCloseDetail +*/ +@EmbeddedId +private TgeneCashCloseDetailKey pk; +@Column(name="QUANTITY", nullable=true) + +/** +* Numero de billetes o monedas por denominacion +*/ +private Integer quantity; + +@Column(name="TOTAL", nullable=true) + +/** +* Total de la denominacion +*/ +private BigDecimal total; + +/**Contructor por defecto*/ +public TgeneCashCloseDetail(){ +} +/**Contructor de TgeneCashCloseDetail +@param pPk Clave Primaria del entity +*/ +public TgeneCashCloseDetail(TgeneCashCloseDetailKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCashCloseDetail +*/ +public static TgeneCashCloseDetail find(EntityManager pEntityManager,TgeneCashCloseDetailKey pKey) throws Exception{ + TgeneCashCloseDetail obj = pEntityManager.find(TgeneCashCloseDetail.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCashCloseDetail +@return El objeto que referencia a la Clave primaria de TgeneCashCloseDetail +*/ +public TgeneCashCloseDetailKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCashCloseDetail +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCashCloseDetail +*/ +public void setPk(TgeneCashCloseDetailKey pPk){ + pk=pPk; +} +/**Obtiene el valor de quantity +@return valor de quantity*/ +public Integer getQuantity(){ + return quantity; +} +/**Fija el valor de quantity +@param pQuantity nuevo Valor de quantity*/ +public void setQuantity(Integer pQuantity){ + quantity=pQuantity; +} + +/**Obtiene el valor de total +@return valor de total*/ +public BigDecimal getTotal(){ + return total; +} +/**Fija el valor de total +@param pTotal nuevo Valor de total*/ +public void setTotal(BigDecimal pTotal){ + total=pTotal; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCashCloseDetail))return false; + TgeneCashCloseDetail that = (TgeneCashCloseDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneCashCloseDetail +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneCashCloseDetail +*/ +public Object createInstance(){ + TgeneCashCloseDetail instance=new TgeneCashCloseDetail(); + instance.setPk(new TgeneCashCloseDetailKey()); + return instance; +} +/**Clona la entidad TgeneCashCloseDetail +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCashCloseDetail p=(TgeneCashCloseDetail)this.clone(); + p.setPk((TgeneCashCloseDetailKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCashCloseDetailKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCashCloseDetailKey.java new file mode 100644 index 0000000..6f3d8df --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCashCloseDetailKey.java @@ -0,0 +1,315 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENECASHCLOSEDETAIL*/ +@Embeddable +public class TgeneCashCloseDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="WORKINGDATE", nullable=false,updatable=false) + +/** +* Fecha de trabajo en la cual se origina la transferencia +*/ +private Date workingdate; + +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario que origina la transferencia +*/ +private String usercode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="OFFICECODE", nullable=false,updatable=false) + +/** +* Codigo de oficina +*/ +private Integer officecode; + +@Column(name="BRANCHCODE", nullable=false,updatable=false) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania al que pertenece la oficina +*/ +private Integer companycode; + +@Column(name="CATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String catalog; + +@Column(name="CATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String catalogcode; + +@Column(name="DENOMINATIONVALUE", nullable=false,updatable=false) + +/** +* Valor de la denominacion, ejemplo billetes de 100, 50, 20,10 etc +*/ +private BigDecimal denominationvalue; + +/**Contructor por defecto*/ +public TgeneCashCloseDetailKey(){} +/**Contructor de TgeneCashCloseDetailKey +@param pWorkingdate Fecha de trabajo en la cual se origina la transferencia +@param pUsercode Codigo de usuario que origina la transferencia +@param pCurrencycode Codigo de moneda +@param pOfficecode Codigo de oficina +@param pBranchcode Codigo de sucursal +@param pCompanycode Codigo de compania al que pertenece la oficina +@param pCatalog Codigo de catalogo 01 Natural, 02 Juridico +@param pCatalogcode Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +@param pDenominationvalue Valor de la denominacion, ejemplo billetes de 100, 50, 20,10 etc +*/ +public TgeneCashCloseDetailKey(Date pWorkingdate,String pUsercode,String pCurrencycode,Integer pOfficecode,Integer pBranchcode,Integer pCompanycode,String pCatalog,String pCatalogcode,BigDecimal pDenominationvalue){ + workingdate=pWorkingdate; + usercode=pUsercode; + currencycode=pCurrencycode; + officecode=pOfficecode; + branchcode=pBranchcode; + companycode=pCompanycode; + catalog=pCatalog; + catalogcode=pCatalogcode; + denominationvalue=pDenominationvalue; +} +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de catalog +@return valor de catalog*/ +public String getCatalog(){ + return catalog; +} +/**Fija el valor de catalog +@param pCatalog nuevo Valor de catalog*/ +public void setCatalog(String pCatalog){ + catalog=pCatalog; +} + +/**Obtiene el valor de catalogcode +@return valor de catalogcode*/ +public String getCatalogcode(){ + return catalogcode; +} +/**Fija el valor de catalogcode +@param pCatalogcode nuevo Valor de catalogcode*/ +public void setCatalogcode(String pCatalogcode){ + catalogcode=pCatalogcode; +} + +/**Obtiene el valor de denominationvalue +@return valor de denominationvalue*/ +public BigDecimal getDenominationvalue(){ + return denominationvalue; +} +/**Fija el valor de denominationvalue +@param pDenominationvalue nuevo Valor de denominationvalue*/ +public void setDenominationvalue(BigDecimal pDenominationvalue){ + denominationvalue=pDenominationvalue; +} + +/**Implementacin de la comparacin de TgeneCashCloseDetailKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneCashCloseDetailKey))return false; + TgeneCashCloseDetailKey that = (TgeneCashCloseDetailKey) o; + if (this.getWorkingdate() == null || that.getWorkingdate() == null){ + return false; + } + if (! this.getWorkingdate().equals(that.getWorkingdate())){ + return false; + } + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getOfficecode() == null || that.getOfficecode() == null){ + return false; + } + if (! this.getOfficecode().equals(that.getOfficecode())){ + return false; + } + if (this.getBranchcode() == null || that.getBranchcode() == null){ + return false; + } + if (! this.getBranchcode().equals(that.getBranchcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getCatalog() == null || that.getCatalog() == null){ + return false; + } + if (! this.getCatalog().equals(that.getCatalog())){ + return false; + } + if (this.getCatalogcode() == null || that.getCatalogcode() == null){ + return false; + } + if (! this.getCatalogcode().equals(that.getCatalogcode())){ + return false; + } + if (this.getDenominationvalue() == null || that.getDenominationvalue() == null){ + return false; + } + if (! this.getDenominationvalue().equals(that.getDenominationvalue())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneCashCloseDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getWorkingdate() == null ? 0 : this.getWorkingdate().hashCode()); + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getOfficecode() == null ? 0 : this.getOfficecode().hashCode()); + result = result * 37 + (this.getBranchcode() == null ? 0 : this.getBranchcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getCatalog() == null ? 0 : this.getCatalog().hashCode()); + result = result * 37 + (this.getCatalogcode() == null ? 0 : this.getCatalogcode().hashCode()); + result = result * 37 + (this.getDenominationvalue() == null ? 0 : this.getDenominationvalue().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCashCloseHeader.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCashCloseHeader.java new file mode 100644 index 0000000..2f8eb6a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCashCloseHeader.java @@ -0,0 +1,365 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECASHCLOSEHEADER */ +@Entity(name = "TgeneCashCloseHeader") +@Table(name = "TGENECASHCLOSEHEADER") +public class TgeneCashCloseHeader extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneCashCloseHeader + */ + @EmbeddedId + private TgeneCashCloseHeaderKey pk; + + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el registro + */ + private Timestamp datefrom; + + @Column(name = "STATUSCATALOG", nullable = true) + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String statuscatalog; + + @Column(name = "STATUSCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String statuscatalogcode; + + @Column(name = "TOTAL", nullable = true) + /** + * Monto total del cierre de caja por moneda + */ + private BigDecimal total; + + @Column(name = "JOURNALID", nullable = true) + /** + * Numero de mensaje con el que se genera el financiero. + */ + private String journalid; + + /** Contructor por defecto */ + public TgeneCashCloseHeader() { + } + + /** + * Contructor de TgeneCashCloseHeader + * + * @param pPk Clave Primaria del entity + */ + public TgeneCashCloseHeader(TgeneCashCloseHeaderKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneCashCloseHeader + */ + public static TgeneCashCloseHeader find(EntityManager pEntityManager, TgeneCashCloseHeaderKey pKey) throws Exception { + TgeneCashCloseHeader obj = pEntityManager.find(TgeneCashCloseHeader.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneCashCloseHeader + * + * @return El objeto que referencia a la Clave primaria de TgeneCashCloseHeader + */ + public TgeneCashCloseHeaderKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneCashCloseHeader + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneCashCloseHeader + */ + public void setPk(TgeneCashCloseHeaderKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de statuscatalog + * + * @return valor de statuscatalog + */ + public String getStatuscatalog() { + return this.statuscatalog; + } + + /** + * Fija el valor de statuscatalog + * + * @param pStatuscatalog nuevo Valor de statuscatalog + */ + public void setStatuscatalog(String pStatuscatalog) { + this.statuscatalog = pStatuscatalog; + } + + /** + * Obtiene el valor de statuscatalogcode + * + * @return valor de statuscatalogcode + */ + public String getStatuscatalogcode() { + return this.statuscatalogcode; + } + + /** + * Fija el valor de statuscatalogcode + * + * @param pStatuscatalogcode nuevo Valor de statuscatalogcode + */ + public void setStatuscatalogcode(String pStatuscatalogcode) { + this.statuscatalogcode = pStatuscatalogcode; + } + + /** + * Obtiene el valor de total + * + * @return valor de total + */ + public BigDecimal getTotal() { + return this.total; + } + + /** + * Fija el valor de total + * + * @param pTotal nuevo Valor de total + */ + public void setTotal(BigDecimal pTotal) { + this.total = pTotal; + } + + /** + * Obtiene el valor de journalid + * + * @return valor de journalid + */ + public String getJournalid() { + return this.journalid; + } + + /** + * Fija el valor de journalid + * + * @param pJournalid nuevo Valor de journalid + */ + public void setJournalid(String pJournalid) { + this.journalid = pJournalid; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneCashCloseHeader)) { + return false; + } + TgeneCashCloseHeader that = (TgeneCashCloseHeader) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneCashCloseHeader + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneCashCloseHeader */ + @Override + public Object createInstance() { + TgeneCashCloseHeader instance = new TgeneCashCloseHeader(); + instance.setPk(new TgeneCashCloseHeaderKey()); + return instance; + } + + /** + * Clona la entidad TgeneCashCloseHeader + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneCashCloseHeader p = (TgeneCashCloseHeader) this.clone(); + p.setPk((TgeneCashCloseHeaderKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + + // METODOS MANUALES + /** Sentencia que entrega la los datos de TgeneCashCloseHeader */ + private static final String JPQL_CASH_CLOSE_HEADER = " from TgeneCashCloseHeader cch" + " where cch.pk.workingdate = :workingdate" + + " and cch.pk.usercode = :usercode" + " and cch.pk.currencycode = :currencycode" + " and cch.pk.officecode = :officecode" + + " and cch.pk.branchcode = :branchcode" + " and cch.pk.companycode = :companycode" + " and cch.pk.dateto = :dateto"; + + /** + * Metodo que entrega los datos de TgeneCashCloseHeader + * + * @param pEntityManager Session de la base de datos. + * @param workingdate Fecha de trabajo + * @param usercode Codigo de usuario + * @param currencycode Codigo de moneda + * @param companycode Codigo de compania + * @param branchcode Codigo de sucursal + * @param officecode Codigo de oficina + * @return + * @throws Exception + */ + public static TgeneCashCloseHeader find(EntityManager pEntityManager, Date workingdate, String usercode, String currencycode, + Integer companycode, Integer branchcode, Integer officecode) throws Exception { + Query qry = pEntityManager.createQuery(TgeneCashCloseHeader.JPQL_CASH_CLOSE_HEADER); + qry.setParameter(Constant.VWORKINGDATE, workingdate); + qry.setParameter("usercode", usercode); + qry.setParameter("currencycode", currencycode); + qry.setParameter("officecode", officecode); + qry.setParameter("branchcode", branchcode); + qry.setParameter("companycode", companycode); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + try { + return (TgeneCashCloseHeader) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + + /** + * Sentencia que entrega la los datos de TgeneCashCloseHeader + */ + private static final String JPQL_CASH_CLOSE_HEADER_WITH_STATUS = " from TgeneCashCloseHeader cch" + " where cch.pk.workingdate = :workingdate" + + " and cch.pk.usercode = :usercode" + " and cch.pk.currencycode = :currencycode" + " and cch.pk.officecode = :officecode" + + " and cch.pk.branchcode = :branchcode" + " and cch.pk.companycode = :companycode" + " and cch.pk.dateto = :dateto" + + " and cch.statuscatalog = :statuscatalog"; + + /** + * Metodo que entrega los datos de TgeneCashCloseHeader, dada la fecha de trabajo, usuario y secuencia. + * + * @param pEntityManager Session de la base de datos. + * @param workingdate Fecha de trabajo + * @param usercode Codigo de usuario + * @param workingdate + * @param currencycode + * @param companycode + * @param branchcode + * @param officecode + * @return + * @throws Exception + */ + public static TgeneCashCloseHeader find(EntityManager pEntityManager, String usercode, String statuscatalog, Date workingdate, + String currencycode, Integer companycode, Integer branchcode, Integer officecode) throws Exception { + Query qry = pEntityManager.createQuery(TgeneCashCloseHeader.JPQL_CASH_CLOSE_HEADER_WITH_STATUS); + qry.setParameter(Constant.VWORKINGDATE, workingdate); + qry.setParameter("usercode", usercode); + qry.setParameter("currencycode", currencycode); + qry.setParameter("officecode", officecode); + qry.setParameter("branchcode", branchcode); + qry.setParameter("companycode", companycode); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + qry.setParameter("statuscatalog", statuscatalog); + try { + return (TgeneCashCloseHeader) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCashCloseHeaderKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCashCloseHeaderKey.java new file mode 100644 index 0000000..16d2027 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCashCloseHeaderKey.java @@ -0,0 +1,265 @@ +package com.fp.persistence.pgeneral.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENECASHCLOSEHEADER*/ +@Embeddable +public class TgeneCashCloseHeaderKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="WORKINGDATE", nullable=false,updatable=false) + +/** +* Fecha de trabajo en la cual se origina la transferencia +*/ +private Date workingdate; + +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario que origina la transferencia +*/ +private String usercode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="OFFICECODE", nullable=false,updatable=false) + +/** +* Codigo de oficina +*/ +private Integer officecode; + +@Column(name="BRANCHCODE", nullable=false,updatable=false) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania al que pertenece la oficina +*/ +private Integer companycode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro. +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TgeneCashCloseHeaderKey(){} +/**Contructor de TgeneCashCloseHeaderKey +@param pWorkingdate Fecha de trabajo en la cual se origina la transferencia +@param pUsercode Codigo de usuario que origina la transferencia +@param pCurrencycode Codigo de moneda +@param pOfficecode Codigo de oficina +@param pBranchcode Codigo de sucursal +@param pCompanycode Codigo de compania al que pertenece la oficina +@param pDateto Fecha hasta la cual esta vigente el registro. +*/ +public TgeneCashCloseHeaderKey(Date pWorkingdate,String pUsercode,String pCurrencycode,Integer pOfficecode,Integer pBranchcode,Integer pCompanycode,Timestamp pDateto){ + workingdate=pWorkingdate; + usercode=pUsercode; + currencycode=pCurrencycode; + officecode=pOfficecode; + branchcode=pBranchcode; + companycode=pCompanycode; + dateto=pDateto; +} +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TgeneCashCloseHeaderKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneCashCloseHeaderKey))return false; + TgeneCashCloseHeaderKey that = (TgeneCashCloseHeaderKey) o; + if (this.getWorkingdate() == null || that.getWorkingdate() == null){ + return false; + } + if (! this.getWorkingdate().equals(that.getWorkingdate())){ + return false; + } + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getOfficecode() == null || that.getOfficecode() == null){ + return false; + } + if (! this.getOfficecode().equals(that.getOfficecode())){ + return false; + } + if (this.getBranchcode() == null || that.getBranchcode() == null){ + return false; + } + if (! this.getBranchcode().equals(that.getBranchcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneCashCloseHeaderKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getWorkingdate() == null ? 0 : this.getWorkingdate().hashCode()); + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getOfficecode() == null ? 0 : this.getOfficecode().hashCode()); + result = result * 37 + (this.getBranchcode() == null ? 0 : this.getBranchcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCashCloseKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCashCloseKey.java new file mode 100644 index 0000000..746b851 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCashCloseKey.java @@ -0,0 +1,233 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENECASHCLOSE*/ +@Embeddable +public class TgeneCashCloseKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="WORKINGDATE", nullable=false,updatable=false) + +/** +* Fecha de trabajo en la cual se origina la transferencia +*/ +private Date workingdate; + +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario que origina la transferencia +*/ +private String usercode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="OFFICECODE", nullable=false,updatable=false) + +/** +* Codigo de oficina +*/ +private Integer officecode; + +@Column(name="BRANCHCODE", nullable=false,updatable=false) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania al que pertenece la oficina +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TgeneCashCloseKey(){} +/**Contructor de TgeneCashCloseKey +@param pWorkingdate Fecha de trabajo en la cual se origina la transferencia +@param pUsercode Codigo de usuario que origina la transferencia +@param pCurrencycode Codigo de moneda +@param pOfficecode Codigo de oficina +@param pBranchcode Codigo de sucursal +@param pCompanycode Codigo de compania al que pertenece la oficina +*/ +public TgeneCashCloseKey(Date pWorkingdate,String pUsercode,String pCurrencycode,Integer pOfficecode,Integer pBranchcode,Integer pCompanycode){ + workingdate=pWorkingdate; + usercode=pUsercode; + currencycode=pCurrencycode; + officecode=pOfficecode; + branchcode=pBranchcode; + companycode=pCompanycode; +} +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacin de la comparacin de TgeneCashCloseKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneCashCloseKey))return false; + TgeneCashCloseKey that = (TgeneCashCloseKey) o; + if (this.getWorkingdate() == null || that.getWorkingdate() == null){ + return false; + } + if (! this.getWorkingdate().equals(that.getWorkingdate())){ + return false; + } + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getOfficecode() == null || that.getOfficecode() == null){ + return false; + } + if (! this.getOfficecode().equals(that.getOfficecode())){ + return false; + } + if (this.getBranchcode() == null || that.getBranchcode() == null){ + return false; + } + if (! this.getBranchcode().equals(that.getBranchcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneCashCloseKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getWorkingdate() == null ? 0 : this.getWorkingdate().hashCode()); + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getOfficecode() == null ? 0 : this.getOfficecode().hashCode()); + result = result * 37 + (this.getBranchcode() == null ? 0 : this.getBranchcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCatalog.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCatalog.java new file mode 100644 index 0000000..85b646c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCatalog.java @@ -0,0 +1,160 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECATALOG*/ +@Entity(name="TgeneCatalog") +@Table(name="TGENECATALOG") +public class TgeneCatalog extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCatalog +*/ +@Id +@Column(name="CATALOGCODE" ,nullable=false, updatable=false) +private String pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=false) + +/** +* Nombre de la tabla de catalogo +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneCatalog(){ +} +/**Contructor de TgeneCatalog +@param pPk Clave Primaria del entity +@param pDescription Nombre de la tabla de catalogo +*/ +public TgeneCatalog(String pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCatalog +*/ +public static TgeneCatalog find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneCatalog obj = pEntityManager.find(TgeneCatalog.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCatalog +@return El objeto que referencia a la Clave primaria de TgeneCatalog +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCatalog +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCatalog +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCatalog))return false; + TgeneCatalog that = (TgeneCatalog) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneCatalog +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneCatalog +*/ +public Object createInstance(){ + TgeneCatalog instance=new TgeneCatalog(); + return instance; +} +/**Clona la entidad TgeneCatalog +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCatalog p=(TgeneCatalog)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCatalogDetail.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCatalogDetail.java new file mode 100644 index 0000000..fea3d66 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCatalogDetail.java @@ -0,0 +1,259 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECATALOGDETAIL */ +@Entity(name = "TgeneCatalogDetail") +@Table(name = "TGENECATALOGDETAIL") +public class TgeneCatalogDetail extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Cache { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneCatalogDetail + */ + @EmbeddedId + private TgeneCatalogDetailKey pk; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "DESCRIPTION", nullable = false) + /** + * Descripcion del catalogo + */ + private String description; + + @Column(name = "LEGALCODE", nullable = true) + /** + * Codigo del organismo de control + */ + private String legalcode; + + /** Contructor por defecto */ + public TgeneCatalogDetail() { + } + + /** + * Contructor de TgeneCatalogDetail + * + * @param pPk Clave Primaria del entity + * @param pDescription Descripcion del catalogo + */ + public TgeneCatalogDetail(TgeneCatalogDetailKey pPk, String pDescription) { + this(); + pk = pPk; + description = pDescription; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneCatalogDetail + */ + public static TgeneCatalogDetail find(EntityManager pEntityManager, TgeneCatalogDetailKey pKey) throws Exception { + TgeneCatalogDetail obj = pEntityManager.find(TgeneCatalogDetail.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneCatalogDetail + * + * @return El objeto que referencia a la Clave primaria de TgeneCatalogDetail + */ + public TgeneCatalogDetailKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneCatalogDetail + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneCatalogDetail + */ + public void setPk(TgeneCatalogDetailKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + /** + * Obtiene el valor de legalcode + * + * @return valor de legalcode + */ + public String getLegalcode() { + return legalcode; + } + + /** + * Fija el valor de legalcode + * + * @param pLegalcode nuevo Valor de legalcode + */ + public void setLegalcode(String pLegalcode) { + legalcode = pLegalcode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneCatalogDetail)) { + return false; + } + TgeneCatalogDetail that = (TgeneCatalogDetail) rhs; + if (getPk() == null || that.getPk() == null) { + return false; + } + return getPk().equals(that.getPk()); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneCatalogDetail + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (hashValue == 0) { + int result = 17; + if (getPk() == null) { + result = super.hashCode(); + } else { + result = getPk().hashCode(); + } + hashValue = result; + } + return hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneCatalogDetail */ + @Override + public Object createInstance() { + TgeneCatalogDetail instance = new TgeneCatalogDetail(); + instance.setPk(new TgeneCatalogDetailKey()); + return instance; + } + + /** + * Clona la entidad TgeneCatalogDetail + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneCatalogDetail p = (TgeneCatalogDetail) clone(); + p.setPk((TgeneCatalogDetailKey) pk.cloneMe()); + return p; + } + + /* Mtodos manuales */ + + /** Sentencia para seleccionar una lista de catalogos */ + private static final String JPQL_CATALOG_LIST = " from TgeneCatalogDetail t " + " where t.pk.catalogcode = :catalogcode "; + + /** + * Mtodo que selecciona una lista de catalogos dado el cdigo del catalogo + * + * @param entityManager + * @param pCatalogcode Cdigo del catalogo + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager entityManager, String pCatalogcode) throws Exception { + Query qry = entityManager.createQuery(JPQL_CATALOG_LIST); + qry.setParameter("catalogcode", pCatalogcode); + + return qry.getResultList(); + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCatalogDetailKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCatalogDetailKey.java new file mode 100644 index 0000000..8b6dc82 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCatalogDetailKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENECATALOGDETAIL*/ +@Embeddable +public class TgeneCatalogDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String catalog; + +@Column(name="CATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String catalogcode; + +/**Contructor por defecto*/ +public TgeneCatalogDetailKey(){} +/**Contructor de TgeneCatalogDetailKey +@param pCatalog Codigo de catalogo 01 Natural, 02 Juridico +@param pCatalogcode Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +public TgeneCatalogDetailKey(String pCatalog,String pCatalogcode){ + catalog=pCatalog; + catalogcode=pCatalogcode; +} +/**Obtiene el valor de catalog +@return valor de catalog*/ +public String getCatalog(){ + return catalog; +} +/**Fija el valor de catalog +@param pCatalog nuevo Valor de catalog*/ +public void setCatalog(String pCatalog){ + catalog=pCatalog; +} + +/**Obtiene el valor de catalogcode +@return valor de catalogcode*/ +public String getCatalogcode(){ + return catalogcode; +} +/**Fija el valor de catalogcode +@param pCatalogcode nuevo Valor de catalogcode*/ +public void setCatalogcode(String pCatalogcode){ + catalogcode=pCatalogcode; +} + +/**Implementacin de la comparacin de TgeneCatalogDetailKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneCatalogDetailKey))return false; + TgeneCatalogDetailKey that = (TgeneCatalogDetailKey) o; + if (this.getCatalog() == null || that.getCatalog() == null){ + return false; + } + if (! this.getCatalog().equals(that.getCatalog())){ + return false; + } + if (this.getCatalogcode() == null || that.getCatalogcode() == null){ + return false; + } + if (! this.getCatalogcode().equals(that.getCatalogcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneCatalogDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCatalog() == null ? 0 : this.getCatalog().hashCode()); + result = result * 37 + (this.getCatalogcode() == null ? 0 : this.getCatalogcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCatalogDetailTest.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCatalogDetailTest.java new file mode 100644 index 0000000..411b414 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCatalogDetailTest.java @@ -0,0 +1,198 @@ +package com.fp.persistence.pgeneral.gene; + +import com.fp.dto.hb.Cache; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECATALOGDETAILTEST*/ +@Entity(name="TgeneCatalogDetailTest") +@Table(name="TGENECATALOGDETAILTEST") +public class TgeneCatalogDetailTest extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCatalogDetailTest +*/ +@EmbeddedId +private TgeneCatalogDetailTestKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=false) + +/** +* Descripcion del catalogo +*/ +private String description; + +@Column(name="LEGALCODE", nullable=true) + +/** +* Codigo del organismo de control +*/ +private String legalcode; + +@Column(name="IDALFRESCO", nullable=true) + +/** +* null +*/ +private String idalfresco; + +/**Contructor por defecto*/ +public TgeneCatalogDetailTest(){ +} +/**Contructor de TgeneCatalogDetailTest +@param pPk Clave Primaria del entity +@param pDescription Descripcion del catalogo +*/ +public TgeneCatalogDetailTest(TgeneCatalogDetailTestKey pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCatalogDetailTest +*/ +public static TgeneCatalogDetailTest find(EntityManager pEntityManager,TgeneCatalogDetailTestKey pKey) throws Exception{ + TgeneCatalogDetailTest obj = pEntityManager.find(TgeneCatalogDetailTest.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCatalogDetailTest +@return El objeto que referencia a la Clave primaria de TgeneCatalogDetailTest +*/ +public TgeneCatalogDetailTestKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCatalogDetailTest +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCatalogDetailTest +*/ +public void setPk(TgeneCatalogDetailTestKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de legalcode +@return valor de legalcode*/ +public String getLegalcode(){ + return legalcode; +} +/**Fija el valor de legalcode +@param pLegalcode nuevo Valor de legalcode*/ +public void setLegalcode(String pLegalcode){ + legalcode=pLegalcode; +} + +/**Obtiene el valor de idalfresco +@return valor de idalfresco*/ +public String getIdalfresco(){ + return idalfresco; +} +/**Fija el valor de idalfresco +@param pIdalfresco nuevo Valor de idalfresco*/ +public void setIdalfresco(String pIdalfresco){ + idalfresco=pIdalfresco; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCatalogDetailTest))return false; + TgeneCatalogDetailTest that = (TgeneCatalogDetailTest) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneCatalogDetailTest +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneCatalogDetailTest +*/ +public Object createInstance(){ + TgeneCatalogDetailTest instance=new TgeneCatalogDetailTest(); + instance.setPk(new TgeneCatalogDetailTestKey()); + return instance; +} +/**Clona la entidad TgeneCatalogDetailTest +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCatalogDetailTest p=(TgeneCatalogDetailTest)this.clone(); + p.setPk((TgeneCatalogDetailTestKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCatalogDetailTestKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCatalogDetailTestKey.java new file mode 100644 index 0000000..79e3437 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCatalogDetailTestKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENECATALOGDETAILTEST*/ +@Embeddable +public class TgeneCatalogDetailTestKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String catalog; + +@Column(name="CATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String catalogcode; + +/**Contructor por defecto*/ +public TgeneCatalogDetailTestKey(){} +/**Contructor de TgeneCatalogDetailTestKey +@param pCatalog Codigo de catalogo 01 Natural, 02 Juridico +@param pCatalogcode Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +public TgeneCatalogDetailTestKey(String pCatalog,String pCatalogcode){ + catalog=pCatalog; + catalogcode=pCatalogcode; +} +/**Obtiene el valor de catalog +@return valor de catalog*/ +public String getCatalog(){ + return catalog; +} +/**Fija el valor de catalog +@param pCatalog nuevo Valor de catalog*/ +public void setCatalog(String pCatalog){ + catalog=pCatalog; +} + +/**Obtiene el valor de catalogcode +@return valor de catalogcode*/ +public String getCatalogcode(){ + return catalogcode; +} +/**Fija el valor de catalogcode +@param pCatalogcode nuevo Valor de catalogcode*/ +public void setCatalogcode(String pCatalogcode){ + catalogcode=pCatalogcode; +} + +/**Implementacion de la comparacion de TgeneCatalogDetailTestKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneCatalogDetailTestKey))return false; + TgeneCatalogDetailTestKey that = (TgeneCatalogDetailTestKey) o; + if (this.getCatalog() == null || that.getCatalog() == null){ + return false; + } + if (! this.getCatalog().equals(that.getCatalog())){ + return false; + } + if (this.getCatalogcode() == null || that.getCatalogcode() == null){ + return false; + } + if (! this.getCatalogcode().equals(that.getCatalogcode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneCatalogDetailTestKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCatalog() == null ? 0 : this.getCatalog().hashCode()); + result = result * 37 + (this.getCatalogcode() == null ? 0 : this.getCatalogcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCatalogEquivalence.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCatalogEquivalence.java new file mode 100644 index 0000000..f1de611 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCatalogEquivalence.java @@ -0,0 +1,160 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECATALOGEQUIVALENCE*/ +@Entity(name="TgeneCatalogEquivalence") +@Table(name="TGENECATALOGEQUIVALENCE") +public class TgeneCatalogEquivalence extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCatalogEquivalence +*/ +@Id +@Column(name="CATALOGCECODE" ,nullable=false, updatable=false) +private String pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* null +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=false) + +/** +* null +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneCatalogEquivalence(){ +} +/**Contructor de TgeneCatalogEquivalence +@param pPk Clave Primaria del entity +@param pDescription null +*/ +public TgeneCatalogEquivalence(String pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCatalogEquivalence +*/ +public static TgeneCatalogEquivalence find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneCatalogEquivalence obj = pEntityManager.find(TgeneCatalogEquivalence.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCatalogEquivalence +@return El objeto que referencia a la Clave primaria de TgeneCatalogEquivalence +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCatalogEquivalence +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCatalogEquivalence +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCatalogEquivalence))return false; + TgeneCatalogEquivalence that = (TgeneCatalogEquivalence) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneCatalogEquivalence +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneCatalogEquivalence +*/ +public Object createInstance(){ + TgeneCatalogEquivalence instance=new TgeneCatalogEquivalence(); + return instance; +} +/**Clona la entidad TgeneCatalogEquivalence +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCatalogEquivalence p=(TgeneCatalogEquivalence)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCatalogEquivalenceDet.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCatalogEquivalenceDet.java new file mode 100644 index 0000000..47a8e78 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCatalogEquivalenceDet.java @@ -0,0 +1,465 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECATALOGEQUIVALENCEDET */ +@Entity(name = "TgeneCatalogEquivalenceDet") +@Table(name = "TGENECATALOGEQUIVALENCEDET") +public class TgeneCatalogEquivalenceDet extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + // CAMPO MANUAL private Long pk; + /** + * Clave primaria de la Entidad TgeneCatalogEquivalenceDet + */ + @Id + @Column(name = "ID", nullable = false, updatable = false) + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SequenceKey", parameters = { + @Parameter(name = "name", value = "IDCATALOGEQUIV"), + @Parameter(name = "type", value = "java.lang.Long"), + @Parameter(name = "fill", value = "0"), + @Parameter(name = "length", value = "5") }) + + @GeneratedValue(generator = "seq_id") + private Long pk; + + @Column(name = "CATALOGCECODE", nullable = false) + /** + * CATALOGO DE ENTIDAD DE CONTROL + */ + private String catalogcecode; + + @Column(name = "CATALOGCE", nullable = false) + /** + * VALOR CATALOGO ENTIDAD DE CONTROL + */ + private String catalogce; + + @Column(name = "DESCATALOGCE", nullable = true) + /** + * DESCRIPCION VALOR CATALOGO ENTIDAD DE CONTROL + */ + private String descatalogce; + + @Column(name = "ORIGINCATALOGCODE", nullable = true) + /** + * CATALOGO ORIGEN (MAIA) + */ + private String origincatalogcode; + + @Column(name = "ORIGINCATALOG", nullable = false) + /** + * VALOR CATALOGO ORIGEN (MAIA) + */ + private String origincatalog; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * VERSION DEL REGISTRO + */ + private Integer recordversion; + + @Column(name = "ORIGINCATALOGCODE_N1", nullable = true) + /** + * null + */ + private String origincatalogcode_n1; + + @Column(name = "ORIGINCATALOG_N1", nullable = true) + /** + * null + */ + private String origincatalog_n1; + + @Column(name = "ORIGINCATALOGCODE_N2", nullable = true) + /** + * null + */ + private String origincatalogcode_n2; + + @Column(name = "ORIGINCATALOG_N2", nullable = true) + /** + * null + */ + private String origincatalog_n2; + + @Column(name = "ORIGINCATALOGCODE_N3", nullable = true) + /** + * null + */ + private String origincatalogcode_n3; + + @Column(name = "ORIGINCATALOG_N3", nullable = true) + /** + * null + */ + private String origincatalog_n3; + + /** Contructor por defecto */ + public TgeneCatalogEquivalenceDet() { + } + + /** + * Contructor de TgeneCatalogEquivalenceDet + * + * @param pPk Clave Primaria del entity + * @param pCatalogcecode CATALOGO DE ENTIDAD DE CONTROL + * @param pCatalogce VALOR CATALOGO ENTIDAD DE CONTROL + * @param pOrigincatalog VALOR CATALOGO ORIGEN (MAIA) + */ + public TgeneCatalogEquivalenceDet(Long pPk, String pCatalogcecode, String pCatalogce, String pOrigincatalog) { + this(); + this.pk = pPk; + this.catalogcecode = pCatalogcecode; + this.catalogce = pCatalogce; + this.origincatalog = pOrigincatalog; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneCatalogEquivalenceDet + */ + public static TgeneCatalogEquivalenceDet find(EntityManager pEntityManager, Object pKey) throws Exception { + TgeneCatalogEquivalenceDet obj = pEntityManager.find(TgeneCatalogEquivalenceDet.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneCatalogEquivalenceDet + * + * @return El objeto que referencia a la Clave primaria de TgeneCatalogEquivalenceDet + */ + public Long getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneCatalogEquivalenceDet + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneCatalogEquivalenceDet + */ + public void setPk(Long pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de catalogcecode + * + * @return valor de catalogcecode + */ + public String getCatalogcecode() { + return this.catalogcecode; + } + + /** + * Fija el valor de catalogcecode + * + * @param pCatalogcecode nuevo Valor de catalogcecode + */ + public void setCatalogcecode(String pCatalogcecode) { + this.catalogcecode = pCatalogcecode; + } + + /** + * Obtiene el valor de catalogce + * + * @return valor de catalogce + */ + public String getCatalogce() { + return this.catalogce; + } + + /** + * Fija el valor de catalogce + * + * @param pCatalogce nuevo Valor de catalogce + */ + public void setCatalogce(String pCatalogce) { + this.catalogce = pCatalogce; + } + + /** + * Obtiene el valor de descatalogce + * + * @return valor de descatalogce + */ + public String getDescatalogce() { + return this.descatalogce; + } + + /** + * Fija el valor de descatalogce + * + * @param pDescatalogce nuevo Valor de descatalogce + */ + public void setDescatalogce(String pDescatalogce) { + this.descatalogce = pDescatalogce; + } + + /** + * Obtiene el valor de origincatalogcode + * + * @return valor de origincatalogcode + */ + public String getOrigincatalogcode() { + return this.origincatalogcode; + } + + /** + * Fija el valor de origincatalogcode + * + * @param pOrigincatalogcode nuevo Valor de origincatalogcode + */ + public void setOrigincatalogcode(String pOrigincatalogcode) { + this.origincatalogcode = pOrigincatalogcode; + } + + /** + * Obtiene el valor de origincatalog + * + * @return valor de origincatalog + */ + public String getOrigincatalog() { + return this.origincatalog; + } + + /** + * Fija el valor de origincatalog + * + * @param pOrigincatalog nuevo Valor de origincatalog + */ + public void setOrigincatalog(String pOrigincatalog) { + this.origincatalog = pOrigincatalog; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de origincatalogcode_n1 + * + * @return valor de origincatalogcode_n1 + */ + public String getOrigincatalogcode_n1() { + return this.origincatalogcode_n1; + } + + /** + * Fija el valor de origincatalogcode_n1 + * + * @param pOrigincatalogcode_n1 nuevo Valor de origincatalogcode_n1 + */ + public void setOrigincatalogcode_n1(String pOrigincatalogcode_n1) { + this.origincatalogcode_n1 = pOrigincatalogcode_n1; + } + + /** + * Obtiene el valor de origincatalog_n1 + * + * @return valor de origincatalog_n1 + */ + public String getOrigincatalog_n1() { + return this.origincatalog_n1; + } + + /** + * Fija el valor de origincatalog_n1 + * + * @param pOrigincatalog_n1 nuevo Valor de origincatalog_n1 + */ + public void setOrigincatalog_n1(String pOrigincatalog_n1) { + this.origincatalog_n1 = pOrigincatalog_n1; + } + + /** + * Obtiene el valor de origincatalogcode_n2 + * + * @return valor de origincatalogcode_n2 + */ + public String getOrigincatalogcode_n2() { + return this.origincatalogcode_n2; + } + + /** + * Fija el valor de origincatalogcode_n2 + * + * @param pOrigincatalogcode_n2 nuevo Valor de origincatalogcode_n2 + */ + public void setOrigincatalogcode_n2(String pOrigincatalogcode_n2) { + this.origincatalogcode_n2 = pOrigincatalogcode_n2; + } + + /** + * Obtiene el valor de origincatalog_n2 + * + * @return valor de origincatalog_n2 + */ + public String getOrigincatalog_n2() { + return this.origincatalog_n2; + } + + /** + * Fija el valor de origincatalog_n2 + * + * @param pOrigincatalog_n2 nuevo Valor de origincatalog_n2 + */ + public void setOrigincatalog_n2(String pOrigincatalog_n2) { + this.origincatalog_n2 = pOrigincatalog_n2; + } + + /** + * Obtiene el valor de origincatalogcode_n3 + * + * @return valor de origincatalogcode_n3 + */ + public String getOrigincatalogcode_n3() { + return this.origincatalogcode_n3; + } + + /** + * Fija el valor de origincatalogcode_n3 + * + * @param pOrigincatalogcode_n3 nuevo Valor de origincatalogcode_n3 + */ + public void setOrigincatalogcode_n3(String pOrigincatalogcode_n3) { + this.origincatalogcode_n3 = pOrigincatalogcode_n3; + } + + /** + * Obtiene el valor de origincatalog_n3 + * + * @return valor de origincatalog_n3 + */ + public String getOrigincatalog_n3() { + return this.origincatalog_n3; + } + + /** + * Fija el valor de origincatalog_n3 + * + * @param pOrigincatalog_n3 nuevo Valor de origincatalog_n3 + */ + public void setOrigincatalog_n3(String pOrigincatalog_n3) { + this.origincatalog_n3 = pOrigincatalog_n3; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneCatalogEquivalenceDet)) { + return false; + } + TgeneCatalogEquivalenceDet that = (TgeneCatalogEquivalenceDet) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneCatalogEquivalenceDet + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneCatalogEquivalenceDet */ + @Override + public Object createInstance() { + TgeneCatalogEquivalenceDet instance = new TgeneCatalogEquivalenceDet(); + return instance; + } + + /** + * Clona la entidad TgeneCatalogEquivalenceDet + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneCatalogEquivalenceDet p = (TgeneCatalogEquivalenceDet) this.clone(); + return p; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneChannels.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneChannels.java new file mode 100644 index 0000000..2f599f6 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneChannels.java @@ -0,0 +1,158 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECHANNELS*/ +@Entity(name="TgeneChannels") +@Table(name="TGENECHANNELS") +public class TgeneChannels extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneChannels +*/ +@Id +@Column(name="CHANNELCODE" ,nullable=false, updatable=false) +private String pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro. +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion default del registro. +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneChannels(){ +} +/**Contructor de TgeneChannels +@param pPk Clave Primaria del entity +*/ +public TgeneChannels(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneChannels +*/ +public static TgeneChannels find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneChannels obj = pEntityManager.find(TgeneChannels.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneChannels +@return El objeto que referencia a la Clave primaria de TgeneChannels +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneChannels +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneChannels +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneChannels))return false; + TgeneChannels that = (TgeneChannels) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneChannels +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneChannels +*/ +public Object createInstance(){ + TgeneChannels instance=new TgeneChannels(); + return instance; +} +/**Clona la entidad TgeneChannels +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneChannels p=(TgeneChannels)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCity.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCity.java new file mode 100644 index 0000000..6ed38c7 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCity.java @@ -0,0 +1,165 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECITY*/ +@Entity(name="TgeneCity") +@Table(name="TGENECITY") +public class TgeneCity extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCity +*/ +@EmbeddedId +private TgeneCityKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=false) + +/** +* Nombre de la cuidad +*/ +private String description; + + + +/**Contructor por defecto*/ +public TgeneCity(){ +} +/**Contructor de TgeneCity +@param pPk Clave Primaria del entity +@param pDescription Nombre de la cuidad +*/ +public TgeneCity(TgeneCityKey pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCity +*/ +public static TgeneCity find(EntityManager pEntityManager,TgeneCityKey pKey) throws Exception{ + TgeneCity obj = pEntityManager.find(TgeneCity.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCity +@return El objeto que referencia a la Clave primaria de TgeneCity +*/ +public TgeneCityKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCity +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCity +*/ +public void setPk(TgeneCityKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + + + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCity))return false; + TgeneCity that = (TgeneCity) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneCity +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneCity +*/ +public Object createInstance(){ + TgeneCity instance=new TgeneCity(); + instance.setPk(new TgeneCityKey()); + return instance; +} +/**Clona la entidad TgeneCity +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCity p=(TgeneCity)this.clone(); + p.setPk((TgeneCityKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCityKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCityKey.java new file mode 100644 index 0000000..93631d3 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCityKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENECITY*/ +@Embeddable +public class TgeneCityKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COUNTRYCODE", nullable=false,updatable=false) + +/** +* Codigo de pais +*/ +private String countrycode; + +@Column(name="PROVINCECODE", nullable=false,updatable=false) + +/** +* Codigo de provincia +*/ +private String provincecode; + +@Column(name="CANTONCODE", nullable=false,updatable=false) + +/** +* Codigo de canton +*/ +private String cantoncode; + +@Column(name="CITYCODE", nullable=false,updatable=false) + +/** +* Codigo de cuidad +*/ +private String citycode; + +/**Contructor por defecto*/ +public TgeneCityKey(){} +/**Contructor de TgeneCityKey +@param pCountrycode Codigo de pais +@param pProvincecode Codigo de provincia +@param pCantoncode Codigo de canton +@param pCitycode Codigo de cuidad +*/ +public TgeneCityKey(String pCountrycode,String pProvincecode,String pCantoncode,String pCitycode){ + countrycode=pCountrycode; + provincecode=pProvincecode; + cantoncode=pCantoncode; + citycode=pCitycode; +} +/**Obtiene el valor de countrycode +@return valor de countrycode*/ +public String getCountrycode(){ + return countrycode; +} +/**Fija el valor de countrycode +@param pCountrycode nuevo Valor de countrycode*/ +public void setCountrycode(String pCountrycode){ + countrycode=pCountrycode; +} + +/**Obtiene el valor de provincecode +@return valor de provincecode*/ +public String getProvincecode(){ + return provincecode; +} +/**Fija el valor de provincecode +@param pProvincecode nuevo Valor de provincecode*/ +public void setProvincecode(String pProvincecode){ + provincecode=pProvincecode; +} + +/**Obtiene el valor de cantoncode +@return valor de cantoncode*/ +public String getCantoncode(){ + return cantoncode; +} +/**Fija el valor de cantoncode +@param pCantoncode nuevo Valor de cantoncode*/ +public void setCantoncode(String pCantoncode){ + cantoncode=pCantoncode; +} + +/**Obtiene el valor de citycode +@return valor de citycode*/ +public String getCitycode(){ + return citycode; +} +/**Fija el valor de citycode +@param pCitycode nuevo Valor de citycode*/ +public void setCitycode(String pCitycode){ + citycode=pCitycode; +} + +/**Implementacion de la comparacion de TgeneCityKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneCityKey))return false; + TgeneCityKey that = (TgeneCityKey) o; + if (this.getCountrycode() == null || that.getCountrycode() == null){ + return false; + } + if (! this.getCountrycode().equals(that.getCountrycode())){ + return false; + } + if (this.getProvincecode() == null || that.getProvincecode() == null){ + return false; + } + if (! this.getProvincecode().equals(that.getProvincecode())){ + return false; + } + if (this.getCantoncode() == null || that.getCantoncode() == null){ + return false; + } + if (! this.getCantoncode().equals(that.getCantoncode())){ + return false; + } + if (this.getCitycode() == null || that.getCitycode() == null){ + return false; + } + if (! this.getCitycode().equals(that.getCitycode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneCityKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCountrycode() == null ? 0 : this.getCountrycode().hashCode()); + result = result * 37 + (this.getProvincecode() == null ? 0 : this.getProvincecode().hashCode()); + result = result * 37 + (this.getCantoncode() == null ? 0 : this.getCantoncode().hashCode()); + result = result * 37 + (this.getCitycode() == null ? 0 : this.getCitycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCompany.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCompany.java new file mode 100644 index 0000000..ad583c3 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCompany.java @@ -0,0 +1,293 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Transient; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENECOMPANY + */ +@Entity(name = "TgeneCompany") +@Table(name = "TGENECOMPANY") +public class TgeneCompany extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable,Cache { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneCompany + */ + @Id + @Column(name = "COMPANYCODE", nullable = false, updatable = false) + private Integer pk; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "LEGALCURRENCY", nullable = true) + /** + * Moneda oficial de la compania. + */ + private String legalcurrency; + + @Column(name = "PERSONCODE", nullable = true) + /** + * Codigo de persona + */ + private Integer personcode; + + @Column(name = "ACTIVE", nullable = true) + /** + * Y indica que la compania esta activa + */ + private String active; + + @Column(name = "ACCOSERVER", nullable = true) + /** + * Y indica que ejecuta el servidor contable, N no ejecuta + */ + private String accoserver; + + /** Contructor por defecto */ + public TgeneCompany() { + } + + /** + * Contructor de TgeneCompany + * + * @param pPk Clave Primaria del entity + */ + public TgeneCompany(Integer pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneCompany + */ + public static TgeneCompany find(EntityManager pEntityManager, Object pKey) throws Exception { + TgeneCompany obj = pEntityManager.find(TgeneCompany.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneCompany + * + * @return El objeto que referencia a la Clave primaria de TgeneCompany + */ + public Integer getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneCompany + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TgeneCompany + */ + public void setPk(Integer pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de legalcurrency + * + * @return valor de legalcurrency + */ + public String getLegalcurrency() { + return legalcurrency; + } + + /** + * Fija el valor de legalcurrency + * + * @param pLegalcurrency nuevo Valor de legalcurrency + */ + public void setLegalcurrency(String pLegalcurrency) { + legalcurrency = pLegalcurrency; + } + + /** + * Obtiene el valor de personcode + * + * @return valor de personcode + */ + public Integer getPersoncode() { + return personcode; + } + + /** + * Fija el valor de personcode + * + * @param pPersoncode nuevo Valor de personcode + */ + public void setPersoncode(Integer pPersoncode) { + personcode = pPersoncode; + } + + /** + * Obtiene el valor de active + * + * @return valor de active + */ + public String getActive() { + return active; + } + + /** + * Fija el valor de active + * + * @param pActive nuevo Valor de active + */ + public void setActive(String pActive) { + active = pActive; + } + + /** + * Obtiene el valor de accoserver + * + * @return valor de accoserver + */ + public String getAccoserver() { + return accoserver; + } + + /** + * Fija el valor de accoserver + * + * @param pAccoserver nuevo Valor de accoserver + */ + public void setAccoserver(String pAccoserver) { + accoserver = pAccoserver; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneCompany)) + return false; + TgeneCompany that = (TgeneCompany) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneCompany + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneCompany */ + public Object createInstance() { + TgeneCompany instance = new TgeneCompany(); + return instance; + } + + /** + * Clona la entidad TgeneCompany + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneCompany p = (TgeneCompany) this.clone(); + return p; + } + + + //METODOS MANUALES + + private static final String sql ="from TgeneCompany t where t.active = 'Y' "; + + /** + * Metodo que entrega una lista de companias que estan definidas en la aplicacion. + * @param pEntityManager Referecnia a una session de base de datos. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager) throws Exception{ + List ldata = null; + Query qry = pEntityManager.createQuery(sql); + ldata = qry.getResultList(); + return ldata; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneConcept.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneConcept.java new file mode 100644 index 0000000..9174544 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneConcept.java @@ -0,0 +1,177 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECONCEPT*/ +@Entity(name="TgeneConcept") +@Table(name="TGENECONCEPT") +public class TgeneConcept extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneConcept +*/ +@EmbeddedId +private TgeneConceptKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking +*/ +private Integer recordversion; + +@Column(name="DEBITO", nullable=true) + +/** +* Indica si el concepto se utiliza en el debito o credito +*/ +private String debito; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion del concepto +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneConcept(){ +} +/**Contructor de TgeneConcept +@param pPk Clave Primaria del entity +*/ +public TgeneConcept(TgeneConceptKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneConcept +*/ +public static TgeneConcept find(EntityManager pEntityManager,TgeneConceptKey pKey) throws Exception{ + TgeneConcept obj = pEntityManager.find(TgeneConcept.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneConcept +@return El objeto que referencia a la Clave primaria de TgeneConcept +*/ +public TgeneConceptKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneConcept +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneConcept +*/ +public void setPk(TgeneConceptKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de debito +@return valor de debito*/ +public String getDebito(){ + return debito; +} +/**Fija el valor de debito +@param pDebito nuevo Valor de debito*/ +public void setDebito(String pDebito){ + debito=pDebito; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneConcept))return false; + TgeneConcept that = (TgeneConcept) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneConcept +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneConcept +*/ +public Object createInstance(){ + TgeneConcept instance=new TgeneConcept(); + instance.setPk(new TgeneConceptKey()); + return instance; +} +/**Clona la entidad TgeneConcept +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneConcept p=(TgeneConcept)this.clone(); + p.setPk((TgeneConceptKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneConceptKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneConceptKey.java new file mode 100644 index 0000000..8574d11 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneConceptKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENECONCEPT*/ +@Embeddable +public class TgeneConceptKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CONCEPTMODULE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String conceptmodule; + +@Column(name="CONCEPTCODE", nullable=false,updatable=false) + +/** +* Codigo de concepto +*/ +private Integer conceptcode; + +/**Contructor por defecto*/ +public TgeneConceptKey(){} +/**Contructor de TgeneConceptKey +@param pConceptmodule Codigo de modulo +@param pConceptcode Codigo de concepto +*/ +public TgeneConceptKey(String pConceptmodule,Integer pConceptcode){ + conceptmodule=pConceptmodule; + conceptcode=pConceptcode; +} +/**Obtiene el valor de conceptmodule +@return valor de conceptmodule*/ +public String getConceptmodule(){ + return conceptmodule; +} +/**Fija el valor de conceptmodule +@param pConceptmodule nuevo Valor de conceptmodule*/ +public void setConceptmodule(String pConceptmodule){ + conceptmodule=pConceptmodule; +} + +/**Obtiene el valor de conceptcode +@return valor de conceptcode*/ +public Integer getConceptcode(){ + return conceptcode; +} +/**Fija el valor de conceptcode +@param pConceptcode nuevo Valor de conceptcode*/ +public void setConceptcode(Integer pConceptcode){ + conceptcode=pConceptcode; +} + +/**Implementacin de la comparacin de TgeneConceptKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneConceptKey))return false; + TgeneConceptKey that = (TgeneConceptKey) o; + if (this.getConceptmodule() == null || that.getConceptmodule() == null){ + return false; + } + if (! this.getConceptmodule().equals(that.getConceptmodule())){ + return false; + } + if (this.getConceptcode() == null || that.getConceptcode() == null){ + return false; + } + if (! this.getConceptcode().equals(that.getConceptcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneConceptKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getConceptmodule() == null ? 0 : this.getConceptmodule().hashCode()); + result = result * 37 + (this.getConceptcode() == null ? 0 : this.getConceptcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneConsep.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneConsep.java new file mode 100644 index 0000000..3089766 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneConsep.java @@ -0,0 +1,556 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECONSEP*/ +@Entity(name="TgeneConsep") +@Table(name="TGENECONSEP") +public class TgeneConsep extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneConsep +*/ +@Id +@Column(name="ID_LISTANEGRA_" ,nullable=false, updatable=false) +private String pk; +@Column(name="PARTMREGIONCOD", nullable=true) + +/** +* Codigo del negocio +*/ +private String partmregioncod; + +@Column(name="PARTMSUCCOD", nullable=true) + +/** +* Clase que se encarga de iniciar o detener el servicio +*/ +private String partmsuccod; + +@Column(name="PARTMAGECOD", nullable=true) + +/** +* Y, Indica que el servicio se levanta al moemento de subir el servidor de aplicaciones +*/ +private String partmagecod; + +@Column(name="PARTMUNIADMCOD", nullable=true) + +/** +* null +*/ +private String partmuniadmcod; + +@Column(name="NOMBRE", nullable=true) + +/** +* Nombre de la persona +*/ +private String nombre; + +@Column(name="APELLIDO", nullable=true) + +/** +* Apellido de la persona + +*/ +private String apellido; + +@Column(name="ID_TIPLISNEG", nullable=true) + +/** +* Codigo Tipo llista (Sindicado,Homonimo) +*/ +private Long id_tiplisneg; + +@Column(name="ESTADO", nullable=true) + +/** +* null +*/ +private String estado; + +@Column(name="FEC_ING_LISNEG", nullable=true) + +/** +* Fecha en que se registro en lista CONSEP +*/ +private Date fec_ing_lisneg; + +@Column(name="PERMITIR_TRX", nullable=true) + +/** +* null +*/ +private String permitir_trx; + +@Column(name="IDENTIFICACION", nullable=true) + +/** +* Identificacion (RUC, C.I. ,Pasaporte) +*/ +private String identificacion; + +@Column(name="PARTMCIUDADCOD", nullable=true) + +/** +* Codigo de la ciudad a la que pertenece +*/ +private String partmciudadcod; + +@Column(name="FEC_ING_CARGO", nullable=true) + +/** +* Fecha de ingreso al cargo + +*/ +private Date fec_ing_cargo; + +@Column(name="FEC_SAL_CARGO", nullable=true) + +/** +* Fecha de salida al cargo +*/ +private Date fec_sal_cargo; + +@Column(name="ID_CARGO", nullable=true) + +/** +* Codigo del cargo de la persona +*/ +private Integer id_cargo; + +@Column(name="ULT_ESTADO", nullable=true) + +/** +* null +*/ +private String ult_estado; + +@Column(name="FEC_SAL_LISNEG", nullable=true) + +/** +* Fecha de salida de la lista de CONSEP +*/ +private Date fec_sal_lisneg; + +@Column(name="USU_INGRESA", nullable=true) + +/** +* Usuario que ingreso el registro + +*/ +private String usu_ingresa; + +@Column(name="USU_MODIFICA", nullable=true) + +/** +* Usuario que modifico el registro +*/ +private String usu_modifica; + +@Column(name="FEC_MODIFICA", nullable=true) + +/** +* Fecha en la que se modifico el registro +*/ +private Date fec_modifica; + +@Column(name="ARCHIVO_ORIG", nullable=true) + +/** +* null +*/ +private String archivo_orig; + +@Column(name="OBSERVACIONLP", nullable=true) + +/** +* null +*/ +private String observacionlp; + +@Column(name="ID_TIPLISPROPIAS", nullable=true) + +/** +* null +*/ +private Long id_tiplispropias; + +@Column(name="OBSERVACION", nullable=true) + +/** +* Observaciones de la persona +*/ +private String observacion; + +/**Contructor por defecto*/ +public TgeneConsep(){ +} +/**Contructor de TgeneConsep +@param pPk Clave Primaria del entity +*/ +public TgeneConsep(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneConsep +*/ +public static TgeneConsep find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneConsep obj = pEntityManager.find(TgeneConsep.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneConsep +@return El objeto que referencia a la Clave primaria de TgeneConsep +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneConsep +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneConsep +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de partmregioncod +@return valor de partmregioncod*/ +public String getPartmregioncod(){ + return partmregioncod; +} +/**Fija el valor de partmregioncod +@param pPartmregioncod nuevo Valor de partmregioncod*/ +public void setPartmregioncod(String pPartmregioncod){ + partmregioncod=pPartmregioncod; +} + +/**Obtiene el valor de partmsuccod +@return valor de partmsuccod*/ +public String getPartmsuccod(){ + return partmsuccod; +} +/**Fija el valor de partmsuccod +@param pPartmsuccod nuevo Valor de partmsuccod*/ +public void setPartmsuccod(String pPartmsuccod){ + partmsuccod=pPartmsuccod; +} + +/**Obtiene el valor de partmagecod +@return valor de partmagecod*/ +public String getPartmagecod(){ + return partmagecod; +} +/**Fija el valor de partmagecod +@param pPartmagecod nuevo Valor de partmagecod*/ +public void setPartmagecod(String pPartmagecod){ + partmagecod=pPartmagecod; +} + +/**Obtiene el valor de partmuniadmcod +@return valor de partmuniadmcod*/ +public String getPartmuniadmcod(){ + return partmuniadmcod; +} +/**Fija el valor de partmuniadmcod +@param pPartmuniadmcod nuevo Valor de partmuniadmcod*/ +public void setPartmuniadmcod(String pPartmuniadmcod){ + partmuniadmcod=pPartmuniadmcod; +} + +/**Obtiene el valor de nombre +@return valor de nombre*/ +public String getNombre(){ + return nombre; +} +/**Fija el valor de nombre +@param pNombre nuevo Valor de nombre*/ +public void setNombre(String pNombre){ + nombre=pNombre; +} + +/**Obtiene el valor de apellido +@return valor de apellido*/ +public String getApellido(){ + return apellido; +} +/**Fija el valor de apellido +@param pApellido nuevo Valor de apellido*/ +public void setApellido(String pApellido){ + apellido=pApellido; +} + +/**Obtiene el valor de id_tiplisneg +@return valor de id_tiplisneg*/ +public Long getId_tiplisneg(){ + return id_tiplisneg; +} +/**Fija el valor de id_tiplisneg +@param pId_tiplisneg nuevo Valor de id_tiplisneg*/ +public void setId_tiplisneg(Long pId_tiplisneg){ + id_tiplisneg=pId_tiplisneg; +} + +/**Obtiene el valor de estado +@return valor de estado*/ +public String getEstado(){ + return estado; +} +/**Fija el valor de estado +@param pEstado nuevo Valor de estado*/ +public void setEstado(String pEstado){ + estado=pEstado; +} + +/**Obtiene el valor de fec_ing_lisneg +@return valor de fec_ing_lisneg*/ +public Date getFec_ing_lisneg(){ + return fec_ing_lisneg; +} +/**Fija el valor de fec_ing_lisneg +@param pFec_ing_lisneg nuevo Valor de fec_ing_lisneg*/ +public void setFec_ing_lisneg(Date pFec_ing_lisneg){ + fec_ing_lisneg=pFec_ing_lisneg; +} + +/**Obtiene el valor de permitir_trx +@return valor de permitir_trx*/ +public String getPermitir_trx(){ + return permitir_trx; +} +/**Fija el valor de permitir_trx +@param pPermitir_trx nuevo Valor de permitir_trx*/ +public void setPermitir_trx(String pPermitir_trx){ + permitir_trx=pPermitir_trx; +} + +/**Obtiene el valor de identificacion +@return valor de identificacion*/ +public String getIdentificacion(){ + return identificacion; +} +/**Fija el valor de identificacion +@param pIdentificacion nuevo Valor de identificacion*/ +public void setIdentificacion(String pIdentificacion){ + identificacion=pIdentificacion; +} + +/**Obtiene el valor de partmciudadcod +@return valor de partmciudadcod*/ +public String getPartmciudadcod(){ + return partmciudadcod; +} +/**Fija el valor de partmciudadcod +@param pPartmciudadcod nuevo Valor de partmciudadcod*/ +public void setPartmciudadcod(String pPartmciudadcod){ + partmciudadcod=pPartmciudadcod; +} + +/**Obtiene el valor de fec_ing_cargo +@return valor de fec_ing_cargo*/ +public Date getFec_ing_cargo(){ + return fec_ing_cargo; +} +/**Fija el valor de fec_ing_cargo +@param pFec_ing_cargo nuevo Valor de fec_ing_cargo*/ +public void setFec_ing_cargo(Date pFec_ing_cargo){ + fec_ing_cargo=pFec_ing_cargo; +} + +/**Obtiene el valor de fec_sal_cargo +@return valor de fec_sal_cargo*/ +public Date getFec_sal_cargo(){ + return fec_sal_cargo; +} +/**Fija el valor de fec_sal_cargo +@param pFec_sal_cargo nuevo Valor de fec_sal_cargo*/ +public void setFec_sal_cargo(Date pFec_sal_cargo){ + fec_sal_cargo=pFec_sal_cargo; +} + +/**Obtiene el valor de id_cargo +@return valor de id_cargo*/ +public Integer getId_cargo(){ + return id_cargo; +} +/**Fija el valor de id_cargo +@param pId_cargo nuevo Valor de id_cargo*/ +public void setId_cargo(Integer pId_cargo){ + id_cargo=pId_cargo; +} + +/**Obtiene el valor de ult_estado +@return valor de ult_estado*/ +public String getUlt_estado(){ + return ult_estado; +} +/**Fija el valor de ult_estado +@param pUlt_estado nuevo Valor de ult_estado*/ +public void setUlt_estado(String pUlt_estado){ + ult_estado=pUlt_estado; +} + +/**Obtiene el valor de fec_sal_lisneg +@return valor de fec_sal_lisneg*/ +public Date getFec_sal_lisneg(){ + return fec_sal_lisneg; +} +/**Fija el valor de fec_sal_lisneg +@param pFec_sal_lisneg nuevo Valor de fec_sal_lisneg*/ +public void setFec_sal_lisneg(Date pFec_sal_lisneg){ + fec_sal_lisneg=pFec_sal_lisneg; +} + +/**Obtiene el valor de usu_ingresa +@return valor de usu_ingresa*/ +public String getUsu_ingresa(){ + return usu_ingresa; +} +/**Fija el valor de usu_ingresa +@param pUsu_ingresa nuevo Valor de usu_ingresa*/ +public void setUsu_ingresa(String pUsu_ingresa){ + usu_ingresa=pUsu_ingresa; +} + +/**Obtiene el valor de usu_modifica +@return valor de usu_modifica*/ +public String getUsu_modifica(){ + return usu_modifica; +} +/**Fija el valor de usu_modifica +@param pUsu_modifica nuevo Valor de usu_modifica*/ +public void setUsu_modifica(String pUsu_modifica){ + usu_modifica=pUsu_modifica; +} + +/**Obtiene el valor de fec_modifica +@return valor de fec_modifica*/ +public Date getFec_modifica(){ + return fec_modifica; +} +/**Fija el valor de fec_modifica +@param pFec_modifica nuevo Valor de fec_modifica*/ +public void setFec_modifica(Date pFec_modifica){ + fec_modifica=pFec_modifica; +} + +/**Obtiene el valor de archivo_orig +@return valor de archivo_orig*/ +public String getArchivo_orig(){ + return archivo_orig; +} +/**Fija el valor de archivo_orig +@param pArchivo_orig nuevo Valor de archivo_orig*/ +public void setArchivo_orig(String pArchivo_orig){ + archivo_orig=pArchivo_orig; +} + +/**Obtiene el valor de observacionlp +@return valor de observacionlp*/ +public String getObservacionlp(){ + return observacionlp; +} +/**Fija el valor de observacionlp +@param pObservacionlp nuevo Valor de observacionlp*/ +public void setObservacionlp(String pObservacionlp){ + observacionlp=pObservacionlp; +} + +/**Obtiene el valor de id_tiplispropias +@return valor de id_tiplispropias*/ +public Long getId_tiplispropias(){ + return id_tiplispropias; +} +/**Fija el valor de id_tiplispropias +@param pId_tiplispropias nuevo Valor de id_tiplispropias*/ +public void setId_tiplispropias(Long pId_tiplispropias){ + id_tiplispropias=pId_tiplispropias; +} + +/**Obtiene el valor de observacion +@return valor de observacion*/ +public String getObservacion(){ + return observacion; +} +/**Fija el valor de observacion +@param pObservacion nuevo Valor de observacion*/ +public void setObservacion(String pObservacion){ + observacion=pObservacion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneConsep))return false; + TgeneConsep that = (TgeneConsep) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementación del metodo hashCode de la la entidad TgeneConsep +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementación toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementación de la creación de un bean en blanco TgeneConsep +*/ +public Object createInstance(){ + TgeneConsep instance=new TgeneConsep(); + return instance; +} +/**Clona la entidad TgeneConsep +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneConsep p=(TgeneConsep)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneConsepLog.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneConsepLog.java new file mode 100644 index 0000000..57144ae --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneConsepLog.java @@ -0,0 +1,509 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; +import java.util.List; +import javax.persistence.Query; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENECONSEPLOG + */ +@Entity(name = "TgeneConsepLog") +@Table(name = "TGENECONSEPLOG") +public class TgeneConsepLog extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneConsepLog + */ + @Id + @Column(name = "ID_LOG", nullable = false, updatable = false) + private Integer pk; + @Column(name = "IDENTIFICACION", nullable = true) + /** + * Numero de identificaion del cliente (RUC, CI, Pasaporte) + */ + private String identificacion; + @Column(name = "NOMBRE_PRIM", nullable = true) + /** + * Primer nombre del cliente + */ + private String nombre_prim; + @Column(name = "NOMBRE_SEG", nullable = true) + /** + * Segundo nombre del cliente + */ + private String nombre_seg; + @Column(name = "APELLIDO_PRIM", nullable = true) + /** + * Primer apellido del cliente + */ + private String apellido_prim; + @Column(name = "APELLIDO_SEG", nullable = true) + /** + * Segundo apellido del cliente opcional + */ + private String apellido_seg; + @Column(name = "ID_LISTANEGRA", nullable = true) + /** + * Identificador de la lista negra (CONSEP) + */ + private String id_listanegra; + @Column(name = "ID_TIPLISNEG", nullable = true) + /** + * Codigo del tipo CONSEP 1,2(SindicadoHomonimo,) respectivamente + */ + private Long id_tiplisneg; + @Column(name = "FEC_ING_LISNEG", nullable = true) + /** + * Fecha de regsitro en la tabla de CONSEP + */ + private Date fec_ing_lisneg; + @Column(name = "USUARIO_COD", nullable = true) + /** + * Codigo de usuario que aplica la transaccion + */ + private String usuario_cod; + @Column(name = "FEC_TRANSACCION", nullable = true) + /** + * Fecha que se ingreso a la transaccion + */ + private Timestamp fec_transaccion; + @Column(name = "TERMINAL", nullable = true) + /** + * Terminal desde donde se ingresos al aplicativo + */ + private String terminal; + @Column(name = "TRANSACCION", nullable = true) + /** + * Tipo de transaccion N, U (nuevo o actualizacion) respectivamente + */ + private String transaccion; + @Column(name = "CREACION_CLI", nullable = true) + /** + * En la transaccion actual se creo un nuevo cliente si/no (S/N) + */ + private String creacion_cli; + @Column(name = "ACTUALIZACION_CLI", nullable = true) + /** + * En la transaccion actual se realizo una actualizacion del cliente si/no + * (S/N) + */ + private String actualizacion_cli; + @Column(name = "CONSTANCIA_CONSEP", nullable = true) + /** + * La persona se encuentra en la lista de CONSEP si/no (S/N) + */ + private String constancia_consep; + + /** + * Contructor por defecto + */ + public TgeneConsepLog() { + } + + /** + * Contructor de TgeneConsepLog + * + * @param pPk Clave Primaria del entity + */ + public TgeneConsepLog(Integer pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneConsepLog + */ + public static TgeneConsepLog find(EntityManager pEntityManager, Object pKey) throws Exception { + TgeneConsepLog obj = pEntityManager.find(TgeneConsepLog.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneConsepLog + * + * @return El objeto que referencia a la Clave primaria de TgeneConsepLog + */ + public Integer getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneConsepLog + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TgeneConsepLog + */ + public void setPk(Integer pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de identificacion + * + * @return valor de identificacion + */ + public String getIdentificacion() { + return identificacion; + } + + /** + * Fija el valor de identificacion + * + * @param pIdentificacion nuevo Valor de identificacion + */ + public void setIdentificacion(String pIdentificacion) { + identificacion = pIdentificacion; + } + + /** + * Obtiene el valor de nombre_prim + * + * @return valor de nombre_prim + */ + public String getNombre_prim() { + return nombre_prim; + } + + /** + * Fija el valor de nombre_prim + * + * @param pNombre_prim nuevo Valor de nombre_prim + */ + public void setNombre_prim(String pNombre_prim) { + nombre_prim = pNombre_prim; + } + + /** + * Obtiene el valor de nombre_seg + * + * @return valor de nombre_seg + */ + public String getNombre_seg() { + return nombre_seg; + } + + /** + * Fija el valor de nombre_seg + * + * @param pNombre_seg nuevo Valor de nombre_seg + */ + public void setNombre_seg(String pNombre_seg) { + nombre_seg = pNombre_seg; + } + + /** + * Obtiene el valor de apellido_prim + * + * @return valor de apellido_prim + */ + public String getApellido_prim() { + return apellido_prim; + } + + /** + * Fija el valor de apellido_prim + * + * @param pApellido_prim nuevo Valor de apellido_prim + */ + public void setApellido_prim(String pApellido_prim) { + apellido_prim = pApellido_prim; + } + + /** + * Obtiene el valor de apellido_seg + * + * @return valor de apellido_seg + */ + public String getApellido_seg() { + return apellido_seg; + } + + /** + * Fija el valor de apellido_seg + * + * @param pApellido_seg nuevo Valor de apellido_seg + */ + public void setApellido_seg(String pApellido_seg) { + apellido_seg = pApellido_seg; + } + + /** + * Obtiene el valor de id_listanegra + * + * @return valor de id_listanegra + */ + public String getId_listanegra() { + return id_listanegra; + } + + /** + * Fija el valor de id_listanegra + * + * @param pId_listanegra nuevo Valor de id_listanegra + */ + public void setId_listanegra(String pId_listanegra) { + id_listanegra = pId_listanegra; + } + + /** + * Obtiene el valor de id_tiplisneg + * + * @return valor de id_tiplisneg + */ + public Long getId_tiplisneg() { + return id_tiplisneg; + } + + /** + * Fija el valor de id_tiplisneg + * + * @param pId_tiplisneg nuevo Valor de id_tiplisneg + */ + public void setId_tiplisneg(Long pId_tiplisneg) { + id_tiplisneg = pId_tiplisneg; + } + + /** + * Obtiene el valor de fec_ing_lisneg + * + * @return valor de fec_ing_lisneg + */ + public Date getFec_ing_lisneg() { + return fec_ing_lisneg; + } + + /** + * Fija el valor de fec_ing_lisneg + * + * @param pFec_ing_lisneg nuevo Valor de fec_ing_lisneg + */ + public void setFec_ing_lisneg(Date pFec_ing_lisneg) { + fec_ing_lisneg = pFec_ing_lisneg; + } + + /** + * Obtiene el valor de usuario_cod + * + * @return valor de usuario_cod + */ + public String getUsuario_cod() { + return usuario_cod; + } + + /** + * Fija el valor de usuario_cod + * + * @param pUsuario_cod nuevo Valor de usuario_cod + */ + public void setUsuario_cod(String pUsuario_cod) { + usuario_cod = pUsuario_cod; + } + + /** + * Obtiene el valor de fec_transaccion + * + * @return valor de fec_transaccion + */ + public Timestamp getFec_transaccion() { + return fec_transaccion; + } + + /** + * Fija el valor de fec_transaccion + * + * @param pFec_transaccion nuevo Valor de fec_transaccion + */ + public void setFec_transaccion(Timestamp pFec_transaccion) { + fec_transaccion = pFec_transaccion; + } + + /** + * Obtiene el valor de terminal + * + * @return valor de terminal + */ + public String getTerminal() { + return terminal; + } + + /** + * Fija el valor de terminal + * + * @param pTerminal nuevo Valor de terminal + */ + public void setTerminal(String pTerminal) { + terminal = pTerminal; + } + + /** + * Obtiene el valor de transaccion + * + * @return valor de transaccion + */ + public String getTransaccion() { + return transaccion; + } + + /** + * Fija el valor de transaccion + * + * @param pTransaccion nuevo Valor de transaccion + */ + public void setTransaccion(String pTransaccion) { + transaccion = pTransaccion; + } + + /** + * Obtiene el valor de creacion_cli + * + * @return valor de creacion_cli + */ + public String getCreacion_cli() { + return creacion_cli; + } + + /** + * Fija el valor de creacion_cli + * + * @param pCreacion_cli nuevo Valor de creacion_cli + */ + public void setCreacion_cli(String pCreacion_cli) { + creacion_cli = pCreacion_cli; + } + + /** + * Obtiene el valor de actualizacion_cli + * + * @return valor de actualizacion_cli + */ + public String getActualizacion_cli() { + return actualizacion_cli; + } + + /** + * Fija el valor de actualizacion_cli + * + * @param pActualizacion_cli nuevo Valor de actualizacion_cli + */ + public void setActualizacion_cli(String pActualizacion_cli) { + actualizacion_cli = pActualizacion_cli; + } + + /** + * Obtiene el valor de constancia_consep + * + * @return valor de constancia_consep + */ + public String getConstancia_consep() { + return constancia_consep; + } + + /** + * Fija el valor de constancia_consep + * + * @param pConstancia_consep nuevo Valor de constancia_consep + */ + public void setConstancia_consep(String pConstancia_consep) { + constancia_consep = pConstancia_consep; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneConsepLog)) { + return false; + } + TgeneConsepLog that = (TgeneConsepLog) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneConsepLog + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco TgeneConsepLog + */ + public Object createInstance() { + TgeneConsepLog instance = new TgeneConsepLog(); + return instance; + } + + /** + * Clona la entidad TgeneConsepLog + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneConsepLog p = (TgeneConsepLog) this.clone(); + return p; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCountry.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCountry.java new file mode 100644 index 0000000..aed4b8c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCountry.java @@ -0,0 +1,216 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECOUNTRY*/ +@Entity(name="TgeneCountry") +@Table(name="TGENECOUNTRY") +public class TgeneCountry extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCountry +*/ +@Id +@Column(name="COUNTRYCODE" ,nullable=false, updatable=false) +private String pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="INITIALS", nullable=true) + +/** +* Siglas del pais +*/ +private String initials; + +@Column(name="AREACODE", nullable=true) + +/** +* Codigo de area del pais +*/ +private Integer areacode; + +@Column(name="DESCRIPTION", nullable=false) + +/** +* Nombre del pais +*/ +private String description; + +@Column(name="CITIZENSHIP", nullable=false) + +/** +* Nacionalidad asociada al pais +*/ +private String citizenship; + +/**Contructor por defecto*/ +public TgeneCountry(){ +} +/**Contructor de TgeneCountry +@param pPk Clave Primaria del entity +@param pDescription Nombre del pais +@param pCitizenship Nacionalidad asociada al pais +*/ +public TgeneCountry(String pPk,String pDescription,String pCitizenship){ + this(); + pk=pPk; + description=pDescription; + citizenship=pCitizenship; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCountry +*/ +public static TgeneCountry find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneCountry obj = pEntityManager.find(TgeneCountry.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCountry +@return El objeto que referencia a la Clave primaria de TgeneCountry +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCountry +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCountry +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de initials +@return valor de initials*/ +public String getInitials(){ + return initials; +} +/**Fija el valor de initials +@param pInitials nuevo Valor de initials*/ +public void setInitials(String pInitials){ + initials=pInitials; +} + +/**Obtiene el valor de areacode +@return valor de areacode*/ +public Integer getAreacode(){ + return areacode; +} +/**Fija el valor de areacode +@param pAreacode nuevo Valor de areacode*/ +public void setAreacode(Integer pAreacode){ + areacode=pAreacode; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de citizenship +@return valor de citizenship*/ +public String getCitizenship(){ + return citizenship; +} +/**Fija el valor de citizenship +@param pCitizenship nuevo Valor de citizenship*/ +public void setCitizenship(String pCitizenship){ + citizenship=pCitizenship; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCountry))return false; + TgeneCountry that = (TgeneCountry) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneCountry +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneCountry +*/ +public Object createInstance(){ + TgeneCountry instance=new TgeneCountry(); + return instance; +} +/**Clona la entidad TgeneCountry +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCountry p=(TgeneCountry)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCreditType.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCreditType.java new file mode 100644 index 0000000..cbe5b70 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCreditType.java @@ -0,0 +1,194 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECREDITTYPE*/ +@Entity(name="TgeneCreditType") +@Table(name="TGENECREDITTYPE") +public class TgeneCreditType extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCreditType +*/ +@Id +@Column(name="CREDITTYPECODE" ,nullable=false, updatable=false) +private String pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion default del tipo de credito +*/ +private String description; + +@Column(name="GRACEDAYS", nullable=true) + +/** +* Dias de gracia para paso a vencido de la cuota +*/ +private Integer gracedays; + +@Column(name="CREDITGRACEDAYS", nullable=true) + +/** +* Dias de gracia para pasar todas las cuotas a vencido, depende de la primera cuota vencida +*/ +private Integer creditgracedays; + +/**Contructor por defecto*/ +public TgeneCreditType(){ +} +/**Contructor de TgeneCreditType +@param pPk Clave Primaria del entity +*/ +public TgeneCreditType(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCreditType +*/ +public static TgeneCreditType find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneCreditType obj = pEntityManager.find(TgeneCreditType.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCreditType +@return El objeto que referencia a la Clave primaria de TgeneCreditType +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCreditType +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCreditType +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de gracedays +@return valor de gracedays*/ +public Integer getGracedays(){ + return gracedays; +} +/**Fija el valor de gracedays +@param pGracedays nuevo Valor de gracedays*/ +public void setGracedays(Integer pGracedays){ + gracedays=pGracedays; +} + +/**Obtiene el valor de creditgracedays +@return valor de creditgracedays*/ +public Integer getCreditgracedays(){ + return creditgracedays; +} +/**Fija el valor de creditgracedays +@param pCreditgracedays nuevo Valor de creditgracedays*/ +public void setCreditgracedays(Integer pCreditgracedays){ + creditgracedays=pCreditgracedays; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCreditType))return false; + TgeneCreditType that = (TgeneCreditType) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneCreditType +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneCreditType +*/ +public Object createInstance(){ + TgeneCreditType instance=new TgeneCreditType(); + return instance; +} +/**Clona la entidad TgeneCreditType +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCreditType p=(TgeneCreditType)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCurrency.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCurrency.java new file mode 100644 index 0000000..444833e --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCurrency.java @@ -0,0 +1,180 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECURRENCY*/ +@Entity(name="TgeneCurrency") +@Table(name="TGENECURRENCY") +public class TgeneCurrency extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCurrency +*/ +@Id +@Column(name="CURRENCYCODE" ,nullable=false, updatable=false) +private String pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="PRESISION", nullable=false) + +/** +* Numero de decimales de la moneda +*/ +private Integer presision; + +@Column(name="DESCRIPTION", nullable=false) + +/** +* Descripcion de la moneda +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneCurrency(){ +} +/**Contructor de TgeneCurrency +@param pPk Clave Primaria del entity +@param pPresision Numero de decimales de la moneda +@param pDescription Descripcion de la moneda +*/ +public TgeneCurrency(String pPk,Integer pPresision,String pDescription){ + this(); + pk=pPk; + presision=pPresision; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCurrency +*/ +public static TgeneCurrency find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneCurrency obj = pEntityManager.find(TgeneCurrency.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCurrency +@return El objeto que referencia a la Clave primaria de TgeneCurrency +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCurrency +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCurrency +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de presision +@return valor de presision*/ +public Integer getPresision(){ + return presision; +} +/**Fija el valor de presision +@param pPresision nuevo Valor de presision*/ +public void setPresision(Integer pPresision){ + presision=pPresision; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCurrency))return false; + TgeneCurrency that = (TgeneCurrency) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneCurrency +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneCurrency +*/ +public Object createInstance(){ + TgeneCurrency instance=new TgeneCurrency(); + return instance; +} +/**Clona la entidad TgeneCurrency +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCurrency p=(TgeneCurrency)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCurrencyRate.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCurrencyRate.java new file mode 100644 index 0000000..1d18e2c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCurrencyRate.java @@ -0,0 +1,200 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECURRENCYRATE*/ +@Entity(name="TgeneCurrencyRate") +@Table(name="TGENECURRENCYRATE") +public class TgeneCurrencyRate extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCurrencyRate +*/ +@EmbeddedId +private TgeneCurrencyRateKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="BUYRATE", nullable=true) + +/** +* Cotizacion de compra asociada a la moneda +*/ +private BigDecimal buyrate; + +@Column(name="SELLRATE", nullable=true) + +/** +* Cotizacion de venta asociada a la moneda +*/ +private BigDecimal sellrate; + +@Column(name="DATEFROM", nullable=true) + +/** +* Fecha desde la cual estan viegnetes las cotizaciones de las monedas. +*/ +private Timestamp datefrom; + +/**Contructor por defecto*/ +public TgeneCurrencyRate(){ +} +/**Contructor de TgeneCurrencyRate +@param pPk Clave Primaria del entity +*/ +public TgeneCurrencyRate(TgeneCurrencyRateKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCurrencyRate +*/ +public static TgeneCurrencyRate find(EntityManager pEntityManager,TgeneCurrencyRateKey pKey) throws Exception{ + TgeneCurrencyRate obj = pEntityManager.find(TgeneCurrencyRate.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCurrencyRate +@return El objeto que referencia a la Clave primaria de TgeneCurrencyRate +*/ +public TgeneCurrencyRateKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCurrencyRate +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCurrencyRate +*/ +public void setPk(TgeneCurrencyRateKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de buyrate +@return valor de buyrate*/ +public BigDecimal getBuyrate(){ + return buyrate; +} +/**Fija el valor de buyrate +@param pBuyrate nuevo Valor de buyrate*/ +public void setBuyrate(BigDecimal pBuyrate){ + buyrate=pBuyrate; +} + +/**Obtiene el valor de sellrate +@return valor de sellrate*/ +public BigDecimal getSellrate(){ + return sellrate; +} +/**Fija el valor de sellrate +@param pSellrate nuevo Valor de sellrate*/ +public void setSellrate(BigDecimal pSellrate){ + sellrate=pSellrate; +} + +/**Obtiene el valor de datefrom +@return valor de datefrom*/ +public Timestamp getDatefrom(){ + return datefrom; +} +/**Fija el valor de datefrom +@param pDatefrom nuevo Valor de datefrom*/ +public void setDatefrom(Timestamp pDatefrom){ + datefrom=pDatefrom; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCurrencyRate))return false; + TgeneCurrencyRate that = (TgeneCurrencyRate) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneCurrencyRate +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneCurrencyRate +*/ +public Object createInstance(){ + TgeneCurrencyRate instance=new TgeneCurrencyRate(); + instance.setPk(new TgeneCurrencyRateKey()); + return instance; +} +/**Clona la entidad TgeneCurrencyRate +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCurrencyRate p=(TgeneCurrencyRate)this.clone(); + p.setPk((TgeneCurrencyRateKey)this.pk.cloneMe()); + return p; +} +public Object getId() { + return this.pk; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCurrencyRateGroup.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCurrencyRateGroup.java new file mode 100644 index 0000000..6e04a1e --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCurrencyRateGroup.java @@ -0,0 +1,200 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENECURRENCYRATEGROUP*/ +@Entity(name="TgeneCurrencyRateGroup") +@Table(name="TGENECURRENCYRATEGROUP") +public class TgeneCurrencyRateGroup extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneCurrencyRateGroup +*/ +@EmbeddedId +private TgeneCurrencyRateGroupKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejod e optimistick locking del registro +*/ +private Integer recordversion; + +@Column(name="DATEFROM", nullable=true) + +/** +* Fecha desde la cual estan vigentes las cotizaciones de las monedas. +*/ +private Timestamp datefrom; + +@Column(name="BUYRATE", nullable=true) + +/** +* Cotizacion de compro de la moneda respecto a la moneda local +*/ +private BigDecimal buyrate; + +@Column(name="SELLRATE", nullable=true) + +/** +* Cotizacion de venta de la moneda respecto a la moneda local. +*/ +private BigDecimal sellrate; + +/**Contructor por defecto*/ +public TgeneCurrencyRateGroup(){ +} +/**Contructor de TgeneCurrencyRateGroup +@param pPk Clave Primaria del entity +*/ +public TgeneCurrencyRateGroup(TgeneCurrencyRateGroupKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneCurrencyRateGroup +*/ +public static TgeneCurrencyRateGroup find(EntityManager pEntityManager,TgeneCurrencyRateGroupKey pKey) throws Exception{ + TgeneCurrencyRateGroup obj = pEntityManager.find(TgeneCurrencyRateGroup.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneCurrencyRateGroup +@return El objeto que referencia a la Clave primaria de TgeneCurrencyRateGroup +*/ +public TgeneCurrencyRateGroupKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneCurrencyRateGroup +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneCurrencyRateGroup +*/ +public void setPk(TgeneCurrencyRateGroupKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de datefrom +@return valor de datefrom*/ +public Timestamp getDatefrom(){ + return datefrom; +} +/**Fija el valor de datefrom +@param pDatefrom nuevo Valor de datefrom*/ +public void setDatefrom(Timestamp pDatefrom){ + datefrom=pDatefrom; +} + +/**Obtiene el valor de buyrate +@return valor de buyrate*/ +public BigDecimal getBuyrate(){ + return buyrate; +} +/**Fija el valor de buyrate +@param pBuyrate nuevo Valor de buyrate*/ +public void setBuyrate(BigDecimal pBuyrate){ + buyrate=pBuyrate; +} + +/**Obtiene el valor de sellrate +@return valor de sellrate*/ +public BigDecimal getSellrate(){ + return sellrate; +} +/**Fija el valor de sellrate +@param pSellrate nuevo Valor de sellrate*/ +public void setSellrate(BigDecimal pSellrate){ + sellrate=pSellrate; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneCurrencyRateGroup))return false; + TgeneCurrencyRateGroup that = (TgeneCurrencyRateGroup) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneCurrencyRateGroup +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneCurrencyRateGroup +*/ +public Object createInstance(){ + TgeneCurrencyRateGroup instance=new TgeneCurrencyRateGroup(); + instance.setPk(new TgeneCurrencyRateGroupKey()); + return instance; +} +/**Clona la entidad TgeneCurrencyRateGroup +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneCurrencyRateGroup p=(TgeneCurrencyRateGroup)this.clone(); + p.setPk((TgeneCurrencyRateGroupKey)this.pk.cloneMe()); + return p; +} +public Object getId() { + return this.pk; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCurrencyRateGroupKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCurrencyRateGroupKey.java new file mode 100644 index 0000000..4bf7fa6 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCurrencyRateGroupKey.java @@ -0,0 +1,183 @@ +package com.fp.persistence.pgeneral.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENECURRENCYRATEGROUP*/ +@Embeddable +public class TgeneCurrencyRateGroupKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CURRENCYRATECATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo de cotizacion de moendas EMP Empleados +*/ +private String currencyratecatalog; + +@Column(name="CURRENCYRATECATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de catalogo de grupos de cotizacion de monedas CURRENCYGROUP +*/ +private String currencyratecatalogcode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente la cotizacion de la moneda +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TgeneCurrencyRateGroupKey(){} +/**Contructor de TgeneCurrencyRateGroupKey +@param pCurrencyratecatalog Codigo de catalogo de cotizacion de moendas EMP Empleados +@param pCurrencyratecatalogcode Codigo de catalogo de grupos de cotizacion de monedas CURRENCYGROUP +@param pCurrencycode Codigo de moneda +@param pDateto Fecha hasta la cual esta vigente la cotizacion de la moneda +*/ +public TgeneCurrencyRateGroupKey(String pCurrencyratecatalog,String pCurrencyratecatalogcode,String pCurrencycode,Timestamp pDateto){ + currencyratecatalog=pCurrencyratecatalog; + currencyratecatalogcode=pCurrencyratecatalogcode; + currencycode=pCurrencycode; + dateto=pDateto; +} +/**Obtiene el valor de currencyratecatalog +@return valor de currencyratecatalog*/ +public String getCurrencyratecatalog(){ + return currencyratecatalog; +} +/**Fija el valor de currencyratecatalog +@param pCurrencyratecatalog nuevo Valor de currencyratecatalog*/ +public void setCurrencyratecatalog(String pCurrencyratecatalog){ + currencyratecatalog=pCurrencyratecatalog; +} + +/**Obtiene el valor de currencyratecatalogcode +@return valor de currencyratecatalogcode*/ +public String getCurrencyratecatalogcode(){ + return currencyratecatalogcode; +} +/**Fija el valor de currencyratecatalogcode +@param pCurrencyratecatalogcode nuevo Valor de currencyratecatalogcode*/ +public void setCurrencyratecatalogcode(String pCurrencyratecatalogcode){ + currencyratecatalogcode=pCurrencyratecatalogcode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TgeneCurrencyRateGroupKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneCurrencyRateGroupKey))return false; + TgeneCurrencyRateGroupKey that = (TgeneCurrencyRateGroupKey) o; + if (this.getCurrencyratecatalog() == null || that.getCurrencyratecatalog() == null){ + return false; + } + if (! this.getCurrencyratecatalog().equals(that.getCurrencyratecatalog())){ + return false; + } + if (this.getCurrencyratecatalogcode() == null || that.getCurrencyratecatalogcode() == null){ + return false; + } + if (! this.getCurrencyratecatalogcode().equals(that.getCurrencyratecatalogcode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneCurrencyRateGroupKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCurrencyratecatalog() == null ? 0 : this.getCurrencyratecatalog().hashCode()); + result = result * 37 + (this.getCurrencyratecatalogcode() == null ? 0 : this.getCurrencyratecatalogcode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCurrencyRateKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCurrencyRateKey.java new file mode 100644 index 0000000..4fb1a2c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneCurrencyRateKey.java @@ -0,0 +1,129 @@ +package com.fp.persistence.pgeneral.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENECURRENCYRATE*/ +@Embeddable +public class TgeneCurrencyRateKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente las cotizaciones de la moneda +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TgeneCurrencyRateKey(){} +/**Contructor de TgeneCurrencyRateKey +@param pCurrencycode Codigo de moneda +@param pDateto Fecha hasta la cual esta vigente las cotizaciones de la moneda +*/ +public TgeneCurrencyRateKey(String pCurrencycode,Timestamp pDateto){ + currencycode=pCurrencycode; + dateto=pDateto; +} +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TgeneCurrencyRateKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneCurrencyRateKey))return false; + TgeneCurrencyRateKey that = (TgeneCurrencyRateKey) o; + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneCurrencyRateKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneDenomination.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneDenomination.java new file mode 100644 index 0000000..48d6043 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneDenomination.java @@ -0,0 +1,122 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEDENOMINATION*/ +@Entity(name="TgeneDenomination") +@Table(name="TGENEDENOMINATION") +public class TgeneDenomination extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneDenomination +*/ +@EmbeddedId +private TgeneDenominationKey pk; +/**Contructor por defecto*/ +public TgeneDenomination(){ +} +/**Contructor de TgeneDenomination +@param pPk Clave Primaria del entity +*/ +public TgeneDenomination(TgeneDenominationKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneDenomination +*/ +public static TgeneDenomination find(EntityManager pEntityManager,TgeneDenominationKey pKey) throws Exception{ + TgeneDenomination obj = pEntityManager.find(TgeneDenomination.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneDenomination +@return El objeto que referencia a la Clave primaria de TgeneDenomination +*/ +public TgeneDenominationKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneDenomination +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneDenomination +*/ +public void setPk(TgeneDenominationKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneDenomination))return false; + TgeneDenomination that = (TgeneDenomination) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneDenomination +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneDenomination +*/ +public Object createInstance(){ + TgeneDenomination instance=new TgeneDenomination(); + instance.setPk(new TgeneDenominationKey()); + return instance; +} +/**Clona la entidad TgeneDenomination +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneDenomination p=(TgeneDenomination)this.clone(); + p.setPk((TgeneDenominationKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneDenominationKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneDenominationKey.java new file mode 100644 index 0000000..7eb845d --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneDenominationKey.java @@ -0,0 +1,179 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEDENOMINATION*/ +@Embeddable +public class TgeneDenominationKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="CATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String catalog; + +@Column(name="CATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String catalogcode; + +@Column(name="VALUE", nullable=false,updatable=false) + +/** +* Valor de la denominacion +*/ +private BigDecimal value; + +/**Contructor por defecto*/ +public TgeneDenominationKey(){} +/**Contructor de TgeneDenominationKey +@param pCurrencycode Codigo de moneda +@param pCatalog Codigo de catalogo 01 Natural, 02 Juridico +@param pCatalogcode Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +@param pValue Valor de la denominacion +*/ +public TgeneDenominationKey(String pCurrencycode,String pCatalog,String pCatalogcode,BigDecimal pValue){ + currencycode=pCurrencycode; + catalog=pCatalog; + catalogcode=pCatalogcode; + value=pValue; +} +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de catalog +@return valor de catalog*/ +public String getCatalog(){ + return catalog; +} +/**Fija el valor de catalog +@param pCatalog nuevo Valor de catalog*/ +public void setCatalog(String pCatalog){ + catalog=pCatalog; +} + +/**Obtiene el valor de catalogcode +@return valor de catalogcode*/ +public String getCatalogcode(){ + return catalogcode; +} +/**Fija el valor de catalogcode +@param pCatalogcode nuevo Valor de catalogcode*/ +public void setCatalogcode(String pCatalogcode){ + catalogcode=pCatalogcode; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +/**Implementacin de la comparacin de TgeneDenominationKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneDenominationKey))return false; + TgeneDenominationKey that = (TgeneDenominationKey) o; + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getCatalog() == null || that.getCatalog() == null){ + return false; + } + if (! this.getCatalog().equals(that.getCatalog())){ + return false; + } + if (this.getCatalogcode() == null || that.getCatalogcode() == null){ + return false; + } + if (! this.getCatalogcode().equals(that.getCatalogcode())){ + return false; + } + if (this.getValue() == null || that.getValue() == null){ + return false; + } + if (! this.getValue().equals(that.getValue())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneDenominationKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getCatalog() == null ? 0 : this.getCatalog().hashCode()); + result = result * 37 + (this.getCatalogcode() == null ? 0 : this.getCatalogcode().hashCode()); + result = result * 37 + (this.getValue() == null ? 0 : this.getValue().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneEntity.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneEntity.java new file mode 100644 index 0000000..541489c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneEntity.java @@ -0,0 +1,327 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEENTITY*/ +@Entity(name="TgeneEntity") +@Table(name="TGENEENTITY") +public class TgeneEntity extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneEntity +*/ +@EmbeddedId +private TgeneEntityKey pk; +@Column(name="PROJECT", nullable=true) + +/** +* Projecto en el cual se maneja el bean. +*/ +private String project; + +@Column(name="PAC", nullable=false) + +/** +* Nombre del subpaquete en el cual se creara la clase +*/ +private String pac; + +@Column(name="JAVAEXTENDS", nullable=true) + +/** +* Indica si el bean extiende de alguna clase en particular +*/ +private String javaextends; + +@Column(name="JAVAIMPLEMENTS", nullable=true) + +/** +* Indica si la clase implementa alguna clase en particular +*/ +private String javaimplements; + +@Column(name="CREATEREFERENCES", nullable=false) + +/** +* Indica si el entity genera referencias a entities padre. +*/ +private String createreferences; + +@Column(name="OPTIMISTICLOCKING", nullable=false) + +/** +* Indca si en enity lleva control de bloqueo optimista +*/ +private String optimisticlocking; + +@Column(name="HISTORY", nullable=false) + +/** +* Indica si el entity maneja historia. +*/ +private String history; + +@Column(name="AUTOIMPORT", nullable=true) + +/** +* Indica +*/ +private String autoimport; + +@Column(name="INMANUAL", nullable=true) + +/** +* Indica que la clase tiene implementados metodos manualmete y no se puede generar el bean automaticamente. +*/ +private String inmanual; + +@Column(name="CACHE", nullable=true) + +/** +* Indica que la tabla manaja cache, si se da mantenimiento se limpia el cache de la tabla +*/ +private String cache; + +@Column(name="LOG", nullable=true) + +/** +* Indica que la tabla manaja auditoria de cambios +*/ +private String log; + +/**Contructor por defecto*/ +public TgeneEntity(){ +} +/**Contructor de TgeneEntity +@param pPk Clave Primaria del entity +@param pPac Nombre del subpaquete en el cual se creara la clase +@param pCreatereferences Indica si el entity genera referencias a entities padre. +@param pOptimisticlocking Indca si en enity lleva control de bloqueo optimista +@param pHistory Indica si el entity maneja historia. +*/ +public TgeneEntity(TgeneEntityKey pPk,String pPac,String pCreatereferences,String pOptimisticlocking,String pHistory){ + this(); + pk=pPk; + pac=pPac; + createreferences=pCreatereferences; + optimisticlocking=pOptimisticlocking; + history=pHistory; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneEntity +*/ +public static TgeneEntity find(EntityManager pEntityManager,TgeneEntityKey pKey) throws Exception{ + TgeneEntity obj = pEntityManager.find(TgeneEntity.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneEntity +@return El objeto que referencia a la Clave primaria de TgeneEntity +*/ +public TgeneEntityKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneEntity +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneEntity +*/ +public void setPk(TgeneEntityKey pPk){ + pk=pPk; +} +/**Obtiene el valor de project +@return valor de project*/ +public String getProject(){ + return project; +} +/**Fija el valor de project +@param pProject nuevo Valor de project*/ +public void setProject(String pProject){ + project=pProject; +} + +/**Obtiene el valor de pac +@return valor de pac*/ +public String getPac(){ + return pac; +} +/**Fija el valor de pac +@param pPac nuevo Valor de pac*/ +public void setPac(String pPac){ + pac=pPac; +} + +/**Obtiene el valor de javaextends +@return valor de javaextends*/ +public String getJavaextends(){ + return javaextends; +} +/**Fija el valor de javaextends +@param pJavaextends nuevo Valor de javaextends*/ +public void setJavaextends(String pJavaextends){ + javaextends=pJavaextends; +} + +/**Obtiene el valor de javaimplements +@return valor de javaimplements*/ +public String getJavaimplements(){ + return javaimplements; +} +/**Fija el valor de javaimplements +@param pJavaimplements nuevo Valor de javaimplements*/ +public void setJavaimplements(String pJavaimplements){ + javaimplements=pJavaimplements; +} + +/**Obtiene el valor de createreferences +@return valor de createreferences*/ +public String getCreatereferences(){ + return createreferences; +} +/**Fija el valor de createreferences +@param pCreatereferences nuevo Valor de createreferences*/ +public void setCreatereferences(String pCreatereferences){ + createreferences=pCreatereferences; +} + +/**Obtiene el valor de optimisticlocking +@return valor de optimisticlocking*/ +public String getOptimisticlocking(){ + return optimisticlocking; +} +/**Fija el valor de optimisticlocking +@param pOptimisticlocking nuevo Valor de optimisticlocking*/ +public void setOptimisticlocking(String pOptimisticlocking){ + optimisticlocking=pOptimisticlocking; +} + +/**Obtiene el valor de history +@return valor de history*/ +public String getHistory(){ + return history; +} +/**Fija el valor de history +@param pHistory nuevo Valor de history*/ +public void setHistory(String pHistory){ + history=pHistory; +} + +/**Obtiene el valor de autoimport +@return valor de autoimport*/ +public String getAutoimport(){ + return autoimport; +} +/**Fija el valor de autoimport +@param pAutoimport nuevo Valor de autoimport*/ +public void setAutoimport(String pAutoimport){ + autoimport=pAutoimport; +} + +/**Obtiene el valor de inmanual +@return valor de inmanual*/ +public String getInmanual(){ + return inmanual; +} +/**Fija el valor de inmanual +@param pInmanual nuevo Valor de inmanual*/ +public void setInmanual(String pInmanual){ + inmanual=pInmanual; +} + +/**Obtiene el valor de cache +@return valor de cache*/ +public String getCache(){ + return cache; +} +/**Fija el valor de cache +@param pCache nuevo Valor de cache*/ +public void setCache(String pCache){ + cache=pCache; +} + +/**Obtiene el valor de log +@return valor de log*/ +public String getLog(){ + return log; +} +/**Fija el valor de log +@param pLog nuevo Valor de log*/ +public void setLog(String pLog){ + log=pLog; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneEntity))return false; + TgeneEntity that = (TgeneEntity) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneEntity +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneEntity +*/ +public Object createInstance(){ + TgeneEntity instance=new TgeneEntity(); + instance.setPk(new TgeneEntityKey()); + return instance; +} +/**Clona la entidad TgeneEntity +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneEntity p=(TgeneEntity)this.clone(); + p.setPk((TgeneEntityKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneEntityKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneEntityKey.java new file mode 100644 index 0000000..fd31b1a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneEntityKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEENTITY*/ +@Embeddable +public class TgeneEntityKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TNAME", nullable=false,updatable=false) + +/** +* Nombre de la tabla en el diccionario de datos +*/ +private String tname; + +@Column(name="ENTITY", nullable=false,updatable=false) + +/** +* Nombre del bean a crear +*/ +private String entity; + +/**Contructor por defecto*/ +public TgeneEntityKey(){} +/**Contructor de TgeneEntityKey +@param pTname Nombre de la tabla en el diccionario de datos +@param pEntity Nombre del bean a crear +*/ +public TgeneEntityKey(String pTname,String pEntity){ + tname=pTname; + entity=pEntity; +} +/**Obtiene el valor de tname +@return valor de tname*/ +public String getTname(){ + return tname; +} +/**Fija el valor de tname +@param pTname nuevo Valor de tname*/ +public void setTname(String pTname){ + tname=pTname; +} + +/**Obtiene el valor de entity +@return valor de entity*/ +public String getEntity(){ + return entity; +} +/**Fija el valor de entity +@param pEntity nuevo Valor de entity*/ +public void setEntity(String pEntity){ + entity=pEntity; +} + +/**Implementacin de la comparacin de TgeneEntityKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneEntityKey))return false; + TgeneEntityKey that = (TgeneEntityKey) o; + if (this.getTname() == null || that.getTname() == null){ + return false; + } + if (! this.getTname().equals(that.getTname())){ + return false; + } + if (this.getEntity() == null || that.getEntity() == null){ + return false; + } + if (! this.getEntity().equals(that.getEntity())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneEntityKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTname() == null ? 0 : this.getTname().hashCode()); + result = result * 37 + (this.getEntity() == null ? 0 : this.getEntity().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneFrequency.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneFrequency.java new file mode 100644 index 0000000..df496d3 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneFrequency.java @@ -0,0 +1,180 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEFREQUENCY*/ +@Entity(name="TgeneFrequency") +@Table(name="TGENEFREQUENCY") +public class TgeneFrequency extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneFrequency +*/ +@Id +@Column(name="FRECQENCYCODE" ,nullable=false, updatable=false) +private Integer pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DAYS", nullable=false) + +/** +* Numero de dias del cliclo diario 1 dia, mensula 30 dias +*/ +private Integer days; + +@Column(name="DESCRIPTION", nullable=false) + +/** +* Descripcion de la frecuencia +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneFrequency(){ +} +/**Contructor de TgeneFrequency +@param pPk Clave Primaria del entity +@param pDays Numero de dias del cliclo diario 1 dia, mensula 30 dias +@param pDescription Descripcion de la frecuencia +*/ +public TgeneFrequency(Integer pPk,Integer pDays,String pDescription){ + this(); + pk=pPk; + days=pDays; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneFrequency +*/ +public static TgeneFrequency find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneFrequency obj = pEntityManager.find(TgeneFrequency.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneFrequency +@return El objeto que referencia a la Clave primaria de TgeneFrequency +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneFrequency +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneFrequency +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de days +@return valor de days*/ +public Integer getDays(){ + return days; +} +/**Fija el valor de days +@param pDays nuevo Valor de days*/ +public void setDays(Integer pDays){ + days=pDays; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneFrequency))return false; + TgeneFrequency that = (TgeneFrequency) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneFrequency +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneFrequency +*/ +public Object createInstance(){ + TgeneFrequency instance=new TgeneFrequency(); + return instance; +} +/**Clona la entidad TgeneFrequency +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneFrequency p=(TgeneFrequency)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneFunctions.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneFunctions.java new file mode 100644 index 0000000..f5248f2 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneFunctions.java @@ -0,0 +1,244 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEFUNCTIONS */ +@Entity(name = "TgeneFunctions") +@Table(name = "TGENEFUNCTIONS") +public class TgeneFunctions extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneFunctions + */ + @Id + @Column(name = "NAME", nullable = false, updatable = false) + private String pk; + + @Column(name = "CLASSNAME", nullable = false) + /** + * NOMBRE DE LA CLASE + */ + private String classname; + + @Column(name = "DESCRIPTION", nullable = true) + private String description; + + @Column(name = "ACTIVE", nullable = true) + /** + * ESTADO DE LA FUNCION + */ + private String active; + + public String getDescription() { + return this.description; + } + + public void setDescription(String pDescription) { + this.description = pDescription; + } + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * MANEJO DE OPTIMISTIC LOCKING + */ + private Integer recordversion; + + /** Contructor por defecto */ + public TgeneFunctions() { + } + + /** + * Contructor de TgeneFunctions + * + * @param pPk Clave Primaria del entity + * @param pClassname NOMBRE DE LA CLASE + */ + public TgeneFunctions(String pPk, String pClassname) { + this(); + this.pk = pPk; + this.classname = pClassname; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneFunctions + */ + public static TgeneFunctions find(EntityManager pEntityManager, Object pKey) throws Exception { + TgeneFunctions obj = pEntityManager.find(TgeneFunctions.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneFunctions + * + * @return El objeto que referencia a la Clave primaria de TgeneFunctions + */ + public String getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneFunctions + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneFunctions + */ + public void setPk(String pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de classname + * + * @return valor de classname + */ + public String getClassname() { + return this.classname; + } + + /** + * Fija el valor de classname + * + * @param pClassname nuevo Valor de classname + */ + public void setClassname(String pClassname) { + this.classname = pClassname; + } + + /** + * Obtiene el valor de active + * + * @return valor de active + */ + public String getActive() { + return this.active; + } + + /** + * Fija el valor de active + * + * @param pActive nuevo Valor de active + */ + public void setActive(String pActive) { + this.active = pActive; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneFunctions)) { + return false; + } + TgeneFunctions that = (TgeneFunctions) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneFunctions + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneFunctions */ + @Override + public Object createInstance() { + TgeneFunctions instance = new TgeneFunctions(); + return instance; + } + + /** + * Clona la entidad TgeneFunctions + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneFunctions p = (TgeneFunctions) this.clone(); + return p; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneLabel.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneLabel.java new file mode 100644 index 0000000..a5ee04e --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneLabel.java @@ -0,0 +1,219 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import java.util.List; +import javax.persistence.Query; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENELABEL*/ +@Entity(name = "TgeneLabel") +@Table(name = "TGENELABEL") +public class TgeneLabel extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneLabel + */ + @EmbeddedId + private TgeneLabelKey pk; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "TYPE", nullable = true) + /** + * null + */ + private String type; + @Column(name = "DESCRIPTION", nullable = true) + /** + * null + */ + private String description; + + /**Contructor por defecto*/ + public TgeneLabel() { + } + + /**Contructor de TgeneLabel + @param pPk Clave Primaria del entity + */ + public TgeneLabel(TgeneLabelKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneLabel + */ + public static TgeneLabel find(EntityManager pEntityManager, TgeneLabelKey pKey) throws Exception { + TgeneLabel obj = pEntityManager.find(TgeneLabel.class, pKey); + return obj; + } + + /**Entrega la Clave primaria de TgeneLabel + @return El objeto que referencia a la Clave primaria de TgeneLabel + */ + public TgeneLabelKey getPk() { + return pk; + } + + /**Fija un nuevo valor a la Clave primaria de TgeneLabel + @param pPk El objeto que referencia a la nueva Clave primaria de TgeneLabel + */ + public void setPk(TgeneLabelKey pPk) { + pk = pPk; + } + + /**Obtiene el valor de recordversion + @return valor de recordversion*/ + public Integer getRecordversion() { + return recordversion; + } + + /**Fija el valor de recordversion + @param pRecordversion nuevo Valor de recordversion*/ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /**Obtiene el valor de type + @return valor de type*/ + public String getType() { + return type; + } + + /**Fija el valor de type + @param pType nuevo Valor de type*/ + public void setType(String pType) { + type = pType; + } + + /**Obtiene el valor de description + @return valor de description*/ + public String getDescription() { + return description; + } + + /**Fija el valor de description + @param pDescription nuevo Valor de description*/ + public void setDescription(String pDescription) { + description = pDescription; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneLabel)) { + return false; + } + TgeneLabel that = (TgeneLabel) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /**Implementacin del metodo hashCode de la la entidad TgeneLabel + @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /**Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /**Implementacin de la creacin de un bean en blanco TgeneLabel + */ + public Object createInstance() { + TgeneLabel instance = new TgeneLabel(); + instance.setPk(new TgeneLabelKey()); + return instance; + } + + /**Clona la entidad TgeneLabel + @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneLabel p = (TgeneLabel) this.clone(); + p.setPk((TgeneLabelKey) this.pk.cloneMe()); + return p; + } + //METODOS MANUALES + private static final String SQL = + "from TgeneLabel tl" + + " where tl.pk.languagecode = :languagecode" + + " and tl.pk.channelcode = :channelcode"; + + /** + * Metodo que devuelve la lista de eiquetas a ser utilizadas en la aplicacin + * @param pEntityManager + * @param languagecode + * @param channelcode + * @return + * @throws Exception + */ + public static List getTgeneLabel(EntityManager pEntityManager, + String languagecode, String channelcode) throws Exception { + List lTgeneLabel = null; + Query qry = pEntityManager.createQuery(SQL); + qry.setParameter("languagecode", languagecode); + qry.setParameter("channelcode", channelcode); + lTgeneLabel = qry.getResultList(); + return lTgeneLabel; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneLabelKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneLabelKey.java new file mode 100644 index 0000000..5d5828f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneLabelKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENELABEL*/ +@Embeddable +public class TgeneLabelKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="LABEL", nullable=false,updatable=false) + +/** +* Codigo de etiqueta +*/ +private String label; + +@Column(name="LANGUAGECODE", nullable=false,updatable=false) + +/** +* Codigo de idioma +*/ +private String languagecode; + +@Column(name="CHANNELCODE", nullable=false,updatable=false) + +/** +* Codigo de canal. +*/ +private String channelcode; + +/**Contructor por defecto*/ +public TgeneLabelKey(){} +/**Contructor de TgeneLabelKey +@param pLabel Codigo de etiqueta +@param pLanguagecode Codigo de idioma +@param pChannelcode Codigo de canal. +*/ +public TgeneLabelKey(String pLabel,String pLanguagecode,String pChannelcode){ + label=pLabel; + languagecode=pLanguagecode; + channelcode=pChannelcode; +} +/**Obtiene el valor de label +@return valor de label*/ +public String getLabel(){ + return label; +} +/**Fija el valor de label +@param pLabel nuevo Valor de label*/ +public void setLabel(String pLabel){ + label=pLabel; +} + +/**Obtiene el valor de languagecode +@return valor de languagecode*/ +public String getLanguagecode(){ + return languagecode; +} +/**Fija el valor de languagecode +@param pLanguagecode nuevo Valor de languagecode*/ +public void setLanguagecode(String pLanguagecode){ + languagecode=pLanguagecode; +} + +/**Obtiene el valor de channelcode +@return valor de channelcode*/ +public String getChannelcode(){ + return channelcode; +} +/**Fija el valor de channelcode +@param pChannelcode nuevo Valor de channelcode*/ +public void setChannelcode(String pChannelcode){ + channelcode=pChannelcode; +} + +/**Implementacin de la comparacin de TgeneLabelKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneLabelKey))return false; + TgeneLabelKey that = (TgeneLabelKey) o; + if (this.getLabel() == null || that.getLabel() == null){ + return false; + } + if (! this.getLabel().equals(that.getLabel())){ + return false; + } + if (this.getLanguagecode() == null || that.getLanguagecode() == null){ + return false; + } + if (! this.getLanguagecode().equals(that.getLanguagecode())){ + return false; + } + if (this.getChannelcode() == null || that.getChannelcode() == null){ + return false; + } + if (! this.getChannelcode().equals(that.getChannelcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneLabelKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getLabel() == null ? 0 : this.getLabel().hashCode()); + result = result * 37 + (this.getLanguagecode() == null ? 0 : this.getLanguagecode().hashCode()); + result = result * 37 + (this.getChannelcode() == null ? 0 : this.getChannelcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneLanguage.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneLanguage.java new file mode 100644 index 0000000..78cb762 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneLanguage.java @@ -0,0 +1,140 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENELANGUAGE*/ +@Entity(name="TgeneLanguage") +@Table(name="TGENELANGUAGE") +public class TgeneLanguage extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneLanguage +*/ +@Id +@Column(name="LANGUAGECODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="DESCRIPTION", nullable=false) + +/** +* Descripcion del idioma +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneLanguage(){ +} +/**Contructor de TgeneLanguage +@param pPk Clave Primaria del entity +@param pDescription Descripcion del idioma +*/ +public TgeneLanguage(String pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneLanguage +*/ +public static TgeneLanguage find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneLanguage obj = pEntityManager.find(TgeneLanguage.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneLanguage +@return El objeto que referencia a la Clave primaria de TgeneLanguage +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneLanguage +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneLanguage +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneLanguage))return false; + TgeneLanguage that = (TgeneLanguage) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneLanguage +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneLanguage +*/ +public Object createInstance(){ + TgeneLanguage instance=new TgeneLanguage(); + return instance; +} +/**Clona la entidad TgeneLanguage +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneLanguage p=(TgeneLanguage)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOffice.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOffice.java new file mode 100644 index 0000000..7f9765c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOffice.java @@ -0,0 +1,355 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; +import com.fp.general.exception.GeneralException; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEOFFICE */ +@Entity(name = "TgeneOffice") +@Table(name = "TGENEOFFICE") +public class TgeneOffice extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneOffice + */ + @EmbeddedId + private TgeneOfficeKey pk; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "DESCRIPTION", nullable = true) + /** + * Nombre de la oficina + */ + private String description; + + @Column(name = "COUNTRYCODE", nullable = true) + /** + * Codigo de pais + */ + private String countrycode; + + @Column(name = "PROVINCECODE", nullable = true) + /** + * Codigo de provincia + */ + private String provincecode; + + @Column(name = "CITYCODE", nullable = true) + /** + * Codigo de cuidad + */ + private String citycode; + + @Column(name = "ADDRESS", nullable = true) + /** + * Dieccion de la oficina. + */ + private String address; + + @Column(name = "PHONE", nullable = true) + /** + * Numero de telefono asociado a la oficina. + */ + private String phone; + + @Column(name = "CANTONCODE", nullable = true) + /** + * Codigo de canton + */ + private String cantoncode; + + /** Contructor por defecto */ + public TgeneOffice() { + } + + /** + * Contructor de TgeneOffice + * + * @param pPk Clave Primaria del entity + */ + public TgeneOffice(TgeneOfficeKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneOffice + */ + public static TgeneOffice find(EntityManager pEntityManager, TgeneOfficeKey pKey) throws Exception { + TgeneOffice obj = pEntityManager.find(TgeneOffice.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneOffice + * + * @return El objeto que referencia a la Clave primaria de TgeneOffice + */ + public TgeneOfficeKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneOffice + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneOffice + */ + public void setPk(TgeneOfficeKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return this.description; + } + + /** + * Fija el valor de description + * + * @param pDescription nuevo Valor de description + */ + public void setDescription(String pDescription) { + this.description = pDescription; + } + + /** + * Obtiene el valor de countrycode + * + * @return valor de countrycode + */ + public String getCountrycode() { + return this.countrycode; + } + + /** + * Fija el valor de countrycode + * + * @param pCountrycode nuevo Valor de countrycode + */ + public void setCountrycode(String pCountrycode) { + this.countrycode = pCountrycode; + } + + /** + * Obtiene el valor de provincecode + * + * @return valor de provincecode + */ + public String getProvincecode() { + return this.provincecode; + } + + /** + * Fija el valor de provincecode + * + * @param pProvincecode nuevo Valor de provincecode + */ + public void setProvincecode(String pProvincecode) { + this.provincecode = pProvincecode; + } + + /** + * Obtiene el valor de citycode + * + * @return valor de citycode + */ + public String getCitycode() { + return this.citycode; + } + + /** + * Fija el valor de citycode + * + * @param pCitycode nuevo Valor de citycode + */ + public void setCitycode(String pCitycode) { + this.citycode = pCitycode; + } + + /** + * Obtiene el valor de address + * + * @return valor de address + */ + public String getAddress() { + return this.address; + } + + /** + * Fija el valor de address + * + * @param pAddress nuevo Valor de address + */ + public void setAddress(String pAddress) { + this.address = pAddress; + } + + /** + * Obtiene el valor de phone + * + * @return valor de phone + */ + public String getPhone() { + return this.phone; + } + + /** + * Fija el valor de phone + * + * @param pPhone nuevo Valor de phone + */ + public void setPhone(String pPhone) { + this.phone = pPhone; + } + + /** + * Obtiene el valor de cantoncode + * + * @return valor de cantoncode + */ + public String getCantoncode() { + return this.cantoncode; + } + + /** + * Fija el valor de cantoncode + * + * @param pCantoncode nuevo Valor de cantoncode + */ + public void setCantoncode(String pCantoncode) { + this.cantoncode = pCantoncode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneOffice)) { + return false; + } + TgeneOffice that = (TgeneOffice) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneOffice + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneOffice */ + @Override + public Object createInstance() { + TgeneOffice instance = new TgeneOffice(); + instance.setPk(new TgeneOfficeKey()); + return instance; + } + + /** + * Clona la entidad TgeneOffice + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneOffice p = (TgeneOffice) this.clone(); + p.setPk((TgeneOfficeKey) this.pk.cloneMe()); + return p; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOfficeKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOfficeKey.java new file mode 100644 index 0000000..59200aa --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOfficeKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEOFFICE*/ +@Embeddable +public class TgeneOfficeKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="OFFICECODE", nullable=false,updatable=false) + +/** +* Codigo de oficina +*/ +private Integer officecode; + +@Column(name="BRANCHCODE", nullable=false,updatable=false) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania al que pertenece la oficina +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TgeneOfficeKey(){} +/**Contructor de TgeneOfficeKey +@param pOfficecode Codigo de oficina +@param pBranchcode Codigo de sucursal +@param pCompanycode Codigo de compania al que pertenece la oficina +*/ +public TgeneOfficeKey(Integer pOfficecode,Integer pBranchcode,Integer pCompanycode){ + officecode=pOfficecode; + branchcode=pBranchcode; + companycode=pCompanycode; +} +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacion de la comparacion de TgeneOfficeKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneOfficeKey))return false; + TgeneOfficeKey that = (TgeneOfficeKey) o; + if (this.getOfficecode() == null || that.getOfficecode() == null){ + return false; + } + if (! this.getOfficecode().equals(that.getOfficecode())){ + return false; + } + if (this.getBranchcode() == null || that.getBranchcode() == null){ + return false; + } + if (! this.getBranchcode().equals(that.getBranchcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneOfficeKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getOfficecode() == null ? 0 : this.getOfficecode().hashCode()); + result = result * 37 + (this.getBranchcode() == null ? 0 : this.getBranchcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOfficer.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOfficer.java new file mode 100644 index 0000000..ca264cb --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOfficer.java @@ -0,0 +1,121 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEOFFICER*/ +@Entity(name="TgeneOfficer") +@Table(name="TGENEOFFICER") +public class TgeneOfficer extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneOfficer +*/ +@EmbeddedId +private TgeneOfficerKey pk; +/**Contructor por defecto*/ +public TgeneOfficer(){ +} +/**Contructor de TgeneOfficer +@param pPk Clave Primaria del entity +*/ +public TgeneOfficer(TgeneOfficerKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneOfficer +*/ +public static TgeneOfficer find(EntityManager pEntityManager,TgeneOfficerKey pKey) throws Exception{ + TgeneOfficer obj = pEntityManager.find(TgeneOfficer.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneOfficer +@return El objeto que referencia a la Clave primaria de TgeneOfficer +*/ +public TgeneOfficerKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneOfficer +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneOfficer +*/ +public void setPk(TgeneOfficerKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneOfficer))return false; + TgeneOfficer that = (TgeneOfficer) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneOfficer +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneOfficer +*/ +public Object createInstance(){ + TgeneOfficer instance=new TgeneOfficer(); + instance.setPk(new TgeneOfficerKey()); + return instance; +} +/**Clona la entidad TgeneOfficer +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneOfficer p=(TgeneOfficer)this.clone(); + p.setPk((TgeneOfficerKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOfficerKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOfficerKey.java new file mode 100644 index 0000000..2ba368a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOfficerKey.java @@ -0,0 +1,205 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEOFFICER*/ +@Embeddable +public class TgeneOfficerKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +/**Contructor por defecto*/ +public TgeneOfficerKey(){} +/**Contructor de TgeneOfficerKey +@param pUsercode Codigo de usuario +@param pCompanycode Codigo de compania +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +*/ +public TgeneOfficerKey(String pUsercode,Integer pCompanycode,String pModulecode,String pProductcode,String pSubproductcode){ + usercode=pUsercode; + companycode=pCompanycode; + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Implementacin de la comparacin de TgeneOfficerKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneOfficerKey))return false; + TgeneOfficerKey that = (TgeneOfficerKey) o; + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneOfficerKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOperationStatus.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOperationStatus.java new file mode 100644 index 0000000..a4b0fb6 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOperationStatus.java @@ -0,0 +1,159 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEOPERATIONSTATUS*/ +@Entity(name="TgeneOperationStatus") +@Table(name="TGENEOPERATIONSTATUS") +public class TgeneOperationStatus extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneOperationStatus +*/ +@EmbeddedId +private TgeneOperationStatusKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion default del codigo de status de la operacion. +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneOperationStatus(){ +} +/**Contructor de TgeneOperationStatus +@param pPk Clave Primaria del entity +*/ +public TgeneOperationStatus(TgeneOperationStatusKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneOperationStatus +*/ +public static TgeneOperationStatus find(EntityManager pEntityManager,TgeneOperationStatusKey pKey) throws Exception{ + TgeneOperationStatus obj = pEntityManager.find(TgeneOperationStatus.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneOperationStatus +@return El objeto que referencia a la Clave primaria de TgeneOperationStatus +*/ +public TgeneOperationStatusKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneOperationStatus +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneOperationStatus +*/ +public void setPk(TgeneOperationStatusKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneOperationStatus))return false; + TgeneOperationStatus that = (TgeneOperationStatus) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneOperationStatus +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneOperationStatus +*/ +public Object createInstance(){ + TgeneOperationStatus instance=new TgeneOperationStatus(); + instance.setPk(new TgeneOperationStatusKey()); + return instance; +} +/**Clona la entidad TgeneOperationStatus +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneOperationStatus p=(TgeneOperationStatus)this.clone(); + p.setPk((TgeneOperationStatusKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOperationStatusKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOperationStatusKey.java new file mode 100644 index 0000000..5a43da7 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOperationStatusKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEOPERATIONSTATUS*/ +@Embeddable +public class TgeneOperationStatusKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="OPERATIONSTATUS", nullable=false,updatable=false) + +/** +* Codigo de estatus de la operacion, ORI (Original), REF (refinanciada), RES (restructurada) +*/ +private String operationstatus; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +/**Contructor por defecto*/ +public TgeneOperationStatusKey(){} +/**Contructor de TgeneOperationStatusKey +@param pOperationstatus Codigo de estatus de la operacion, ORI (Original), REF (refinanciada), RES (restructurada) +@param pModulecode Codigo de modulo +*/ +public TgeneOperationStatusKey(String pOperationstatus,String pModulecode){ + operationstatus=pOperationstatus; + modulecode=pModulecode; +} +/**Obtiene el valor de operationstatus +@return valor de operationstatus*/ +public String getOperationstatus(){ + return operationstatus; +} +/**Fija el valor de operationstatus +@param pOperationstatus nuevo Valor de operationstatus*/ +public void setOperationstatus(String pOperationstatus){ + operationstatus=pOperationstatus; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Implementacin de la comparacin de TgeneOperationStatusKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneOperationStatusKey))return false; + TgeneOperationStatusKey that = (TgeneOperationStatusKey) o; + if (this.getOperationstatus() == null || that.getOperationstatus() == null){ + return false; + } + if (! this.getOperationstatus().equals(that.getOperationstatus())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneOperationStatusKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getOperationstatus() == null ? 0 : this.getOperationstatus().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOperativeCondition.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOperativeCondition.java new file mode 100644 index 0000000..972d1e1 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOperativeCondition.java @@ -0,0 +1,159 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEOPERATIVECONDITION*/ +@Entity(name="TgeneOperativeCondition") +@Table(name="TGENEOPERATIVECONDITION") +public class TgeneOperativeCondition extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneOperativeCondition +*/ +@EmbeddedId +private TgeneOperativeConditionKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion del codigo de condicion operativa +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneOperativeCondition(){ +} +/**Contructor de TgeneOperativeCondition +@param pPk Clave Primaria del entity +*/ +public TgeneOperativeCondition(TgeneOperativeConditionKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneOperativeCondition +*/ +public static TgeneOperativeCondition find(EntityManager pEntityManager,TgeneOperativeConditionKey pKey) throws Exception{ + TgeneOperativeCondition obj = pEntityManager.find(TgeneOperativeCondition.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneOperativeCondition +@return El objeto que referencia a la Clave primaria de TgeneOperativeCondition +*/ +public TgeneOperativeConditionKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneOperativeCondition +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneOperativeCondition +*/ +public void setPk(TgeneOperativeConditionKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneOperativeCondition))return false; + TgeneOperativeCondition that = (TgeneOperativeCondition) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneOperativeCondition +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneOperativeCondition +*/ +public Object createInstance(){ + TgeneOperativeCondition instance=new TgeneOperativeCondition(); + instance.setPk(new TgeneOperativeConditionKey()); + return instance; +} +/**Clona la entidad TgeneOperativeCondition +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneOperativeCondition p=(TgeneOperativeCondition)this.clone(); + p.setPk((TgeneOperativeConditionKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOperativeConditionKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOperativeConditionKey.java new file mode 100644 index 0000000..41db126 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneOperativeConditionKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEOPERATIVECONDITION*/ +@Embeddable +public class TgeneOperativeConditionKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="OPERATIVCONDITION", nullable=false,updatable=false) + +/** +* Codigo de condicion operativa. +*/ +private String operativcondition; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +/**Contructor por defecto*/ +public TgeneOperativeConditionKey(){} +/**Contructor de TgeneOperativeConditionKey +@param pOperativcondition Codigo de condicion operativa. +@param pModulecode Codigo de modulo +*/ +public TgeneOperativeConditionKey(String pOperativcondition,String pModulecode){ + operativcondition=pOperativcondition; + modulecode=pModulecode; +} +/**Obtiene el valor de operativcondition +@return valor de operativcondition*/ +public String getOperativcondition(){ + return operativcondition; +} +/**Fija el valor de operativcondition +@param pOperativcondition nuevo Valor de operativcondition*/ +public void setOperativcondition(String pOperativcondition){ + operativcondition=pOperativcondition; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Implementacin de la comparacin de TgeneOperativeConditionKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneOperativeConditionKey))return false; + TgeneOperativeConditionKey that = (TgeneOperativeConditionKey) o; + if (this.getOperativcondition() == null || that.getOperativcondition() == null){ + return false; + } + if (! this.getOperativcondition().equals(that.getOperativcondition())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneOperativeConditionKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getOperativcondition() == null ? 0 : this.getOperativcondition().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneParameters.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneParameters.java new file mode 100644 index 0000000..83c0024 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneParameters.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEPARAMETERS*/ +@Entity(name="TgeneParameters") +@Table(name="TGENEPARAMETERS") +public class TgeneParameters extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneParameters +*/ +@EmbeddedId +private TgeneParametersKey pk; +@Column(name="TEXTVALUE", nullable=true) + +/** +* Valor texto del parametro. +*/ +private String textvalue; + +@Column(name="NUMBERVALUE", nullable=true) + +/** +* Valor numero del parametro. +*/ +private BigDecimal numbervalue; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion del parametro +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneParameters(){ +} +/**Contructor de TgeneParameters +@param pPk Clave Primaria del entity +*/ +public TgeneParameters(TgeneParametersKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneParameters +*/ +public static TgeneParameters find(EntityManager pEntityManager,TgeneParametersKey pKey) throws Exception{ + TgeneParameters obj = pEntityManager.find(TgeneParameters.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneParameters +@return El objeto que referencia a la Clave primaria de TgeneParameters +*/ +public TgeneParametersKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneParameters +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneParameters +*/ +public void setPk(TgeneParametersKey pPk){ + pk=pPk; +} +/**Obtiene el valor de textvalue +@return valor de textvalue*/ +public String getTextvalue(){ + return textvalue; +} +/**Fija el valor de textvalue +@param pTextvalue nuevo Valor de textvalue*/ +public void setTextvalue(String pTextvalue){ + textvalue=pTextvalue; +} + +/**Obtiene el valor de numbervalue +@return valor de numbervalue*/ +public BigDecimal getNumbervalue(){ + return numbervalue; +} +/**Fija el valor de numbervalue +@param pNumbervalue nuevo Valor de numbervalue*/ +public void setNumbervalue(BigDecimal pNumbervalue){ + numbervalue=pNumbervalue; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneParameters))return false; + TgeneParameters that = (TgeneParameters) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneParameters +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneParameters +*/ +public Object createInstance(){ + TgeneParameters instance=new TgeneParameters(); + instance.setPk(new TgeneParametersKey()); + return instance; +} +/**Clona la entidad TgeneParameters +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneParameters p=(TgeneParameters)this.clone(); + p.setPk((TgeneParametersKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneParametersKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneParametersKey.java new file mode 100644 index 0000000..7b6dd2c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneParametersKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEPARAMETERS*/ +@Embeddable +public class TgeneParametersKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CODE", nullable=false,updatable=false) + +/** +* Codigo del parametro +*/ +private String code; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TgeneParametersKey(){} +/**Contructor de TgeneParametersKey +@param pCode Codigo del parametro +@param pCompanycode Codigo de compania +*/ +public TgeneParametersKey(String pCode,Integer pCompanycode){ + code=pCode; + companycode=pCompanycode; +} +/**Obtiene el valor de code +@return valor de code*/ +public String getCode(){ + return code; +} +/**Fija el valor de code +@param pCode nuevo Valor de code*/ +public void setCode(String pCode){ + code=pCode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacin de la comparacin de TgeneParametersKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneParametersKey))return false; + TgeneParametersKey that = (TgeneParametersKey) o; + if (this.getCode() == null || that.getCode() == null){ + return false; + } + if (! this.getCode().equals(that.getCode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneParametersKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCode() == null ? 0 : this.getCode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneParroquia.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneParroquia.java new file mode 100644 index 0000000..e72b910 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneParroquia.java @@ -0,0 +1,159 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEPARROQUIA*/ +@Entity(name="TgeneParroquia") +@Table(name="TGENEPARROQUIA") +public class TgeneParroquia extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneParroquia +*/ +@EmbeddedId +private TgeneParroquiaKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Nombre de la parroquia +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneParroquia(){ +} +/**Contructor de TgeneParroquia +@param pPk Clave Primaria del entity +*/ +public TgeneParroquia(TgeneParroquiaKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneParroquia +*/ +public static TgeneParroquia find(EntityManager pEntityManager,TgeneParroquiaKey pKey) throws Exception{ + TgeneParroquia obj = pEntityManager.find(TgeneParroquia.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneParroquia +@return El objeto que referencia a la Clave primaria de TgeneParroquia +*/ +public TgeneParroquiaKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneParroquia +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneParroquia +*/ +public void setPk(TgeneParroquiaKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneParroquia))return false; + TgeneParroquia that = (TgeneParroquia) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneParroquia +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneParroquia +*/ +public Object createInstance(){ + TgeneParroquia instance=new TgeneParroquia(); + instance.setPk(new TgeneParroquiaKey()); + return instance; +} +/**Clona la entidad TgeneParroquia +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneParroquia p=(TgeneParroquia)this.clone(); + p.setPk((TgeneParroquiaKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneParroquiaKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneParroquiaKey.java new file mode 100644 index 0000000..1796ef5 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneParroquiaKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEPARROQUIA*/ +@Embeddable +public class TgeneParroquiaKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COUNTRYCODE", nullable=false,updatable=false) + +/** +* Codigo de pais +*/ +private String countrycode; + +@Column(name="PROVINCECODE", nullable=false,updatable=false) + +/** +* Codigo de provincia +*/ +private String provincecode; + +@Column(name="CANTONCODE", nullable=false,updatable=false) + +/** +* Codigo de canton +*/ +private String cantoncode; + +@Column(name="PARROQUIACODE", nullable=false,updatable=false) + +/** +* Codigo de parroquia +*/ +private String parroquiacode; + +/**Contructor por defecto*/ +public TgeneParroquiaKey(){} +/**Contructor de TgeneParroquiaKey +@param pCountrycode Codigo de pais +@param pProvincecode Codigo de provincia +@param pCantoncode Codigo de canton +@param pParroquiacode Codigo de parroquia +*/ +public TgeneParroquiaKey(String pCountrycode,String pProvincecode,String pCantoncode,String pParroquiacode){ + countrycode=pCountrycode; + provincecode=pProvincecode; + cantoncode=pCantoncode; + parroquiacode=pParroquiacode; +} +/**Obtiene el valor de countrycode +@return valor de countrycode*/ +public String getCountrycode(){ + return countrycode; +} +/**Fija el valor de countrycode +@param pCountrycode nuevo Valor de countrycode*/ +public void setCountrycode(String pCountrycode){ + countrycode=pCountrycode; +} + +/**Obtiene el valor de provincecode +@return valor de provincecode*/ +public String getProvincecode(){ + return provincecode; +} +/**Fija el valor de provincecode +@param pProvincecode nuevo Valor de provincecode*/ +public void setProvincecode(String pProvincecode){ + provincecode=pProvincecode; +} + +/**Obtiene el valor de cantoncode +@return valor de cantoncode*/ +public String getCantoncode(){ + return cantoncode; +} +/**Fija el valor de cantoncode +@param pCantoncode nuevo Valor de cantoncode*/ +public void setCantoncode(String pCantoncode){ + cantoncode=pCantoncode; +} + +/**Obtiene el valor de parroquiacode +@return valor de parroquiacode*/ +public String getParroquiacode(){ + return parroquiacode; +} +/**Fija el valor de parroquiacode +@param pParroquiacode nuevo Valor de parroquiacode*/ +public void setParroquiacode(String pParroquiacode){ + parroquiacode=pParroquiacode; +} + +/**Implementacin de la comparacin de TgeneParroquiaKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneParroquiaKey))return false; + TgeneParroquiaKey that = (TgeneParroquiaKey) o; + if (this.getCountrycode() == null || that.getCountrycode() == null){ + return false; + } + if (! this.getCountrycode().equals(that.getCountrycode())){ + return false; + } + if (this.getProvincecode() == null || that.getProvincecode() == null){ + return false; + } + if (! this.getProvincecode().equals(that.getProvincecode())){ + return false; + } + if (this.getCantoncode() == null || that.getCantoncode() == null){ + return false; + } + if (! this.getCantoncode().equals(that.getCantoncode())){ + return false; + } + if (this.getParroquiacode() == null || that.getParroquiacode() == null){ + return false; + } + if (! this.getParroquiacode().equals(that.getParroquiacode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneParroquiaKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCountrycode() == null ? 0 : this.getCountrycode().hashCode()); + result = result * 37 + (this.getProvincecode() == null ? 0 : this.getProvincecode().hashCode()); + result = result * 37 + (this.getCantoncode() == null ? 0 : this.getCantoncode().hashCode()); + result = result * 37 + (this.getParroquiacode() == null ? 0 : this.getParroquiacode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneProvince.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneProvince.java new file mode 100644 index 0000000..56028ed --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneProvince.java @@ -0,0 +1,161 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEPROVINCE*/ +@Entity(name="TgeneProvince") +@Table(name="TGENEPROVINCE") +public class TgeneProvince extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneProvince +*/ +@EmbeddedId +private TgeneProvinceKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=false) + +/** +* Nombre de la provincia +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneProvince(){ +} +/**Contructor de TgeneProvince +@param pPk Clave Primaria del entity +@param pDescription Nombre de la provincia +*/ +public TgeneProvince(TgeneProvinceKey pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneProvince +*/ +public static TgeneProvince find(EntityManager pEntityManager,TgeneProvinceKey pKey) throws Exception{ + TgeneProvince obj = pEntityManager.find(TgeneProvince.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneProvince +@return El objeto que referencia a la Clave primaria de TgeneProvince +*/ +public TgeneProvinceKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneProvince +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneProvince +*/ +public void setPk(TgeneProvinceKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneProvince))return false; + TgeneProvince that = (TgeneProvince) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneProvince +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneProvince +*/ +public Object createInstance(){ + TgeneProvince instance=new TgeneProvince(); + instance.setPk(new TgeneProvinceKey()); + return instance; +} +/**Clona la entidad TgeneProvince +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneProvince p=(TgeneProvince)this.clone(); + p.setPk((TgeneProvinceKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneProvinceKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneProvinceKey.java new file mode 100644 index 0000000..d7d1f91 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneProvinceKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEPROVINCE*/ +@Embeddable +public class TgeneProvinceKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COUNTRYCODE", nullable=false,updatable=false) + +/** +* Codigo de pais +*/ +private String countrycode; + +@Column(name="PROVINCECODE", nullable=false,updatable=false) + +/** +* Codigo de provincia +*/ +private String provincecode; + +/**Contructor por defecto*/ +public TgeneProvinceKey(){} +/**Contructor de TgeneProvinceKey +@param pCountrycode Codigo de pais +@param pProvincecode Codigo de provincia +*/ +public TgeneProvinceKey(String pCountrycode,String pProvincecode){ + countrycode=pCountrycode; + provincecode=pProvincecode; +} +/**Obtiene el valor de countrycode +@return valor de countrycode*/ +public String getCountrycode(){ + return countrycode; +} +/**Fija el valor de countrycode +@param pCountrycode nuevo Valor de countrycode*/ +public void setCountrycode(String pCountrycode){ + countrycode=pCountrycode; +} + +/**Obtiene el valor de provincecode +@return valor de provincecode*/ +public String getProvincecode(){ + return provincecode; +} +/**Fija el valor de provincecode +@param pProvincecode nuevo Valor de provincecode*/ +public void setProvincecode(String pProvincecode){ + provincecode=pProvincecode; +} + +/**Implementacin de la comparacin de TgeneProvinceKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneProvinceKey))return false; + TgeneProvinceKey that = (TgeneProvinceKey) o; + if (this.getCountrycode() == null || that.getCountrycode() == null){ + return false; + } + if (! this.getCountrycode().equals(that.getCountrycode())){ + return false; + } + if (this.getProvincecode() == null || that.getProvincecode() == null){ + return false; + } + if (! this.getProvincecode().equals(that.getProvincecode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneProvinceKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCountrycode() == null ? 0 : this.getCountrycode().hashCode()); + result = result * 37 + (this.getProvincecode() == null ? 0 : this.getProvincecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneQueryProcess.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneQueryProcess.java new file mode 100644 index 0000000..3777891 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneQueryProcess.java @@ -0,0 +1,227 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEQUERYPROCESS*/ +@Entity(name="TgeneQueryProcess") +@Table(name="TGENEQUERYPROCESS") +public class TgeneQueryProcess extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneQueryProcess +*/ +@EmbeddedId +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(SEQUENCE),0)+1 from TGENEQUERYPROCESS " + + "where QUERYCODE=:querycode "), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "querycode,pk.querycode"), + @Parameter(name = "field", value = "sequence") }) +@GeneratedValue(generator = "seq_id") +private TgeneQueryProcessKey pk; +@Column(name="PROCESSCODE", nullable=true) + +/** +* Paquete clase de un comando a ejecutar. +*/ +private String processcode; + +@Column(name="CATALOGTYPEPROCESS", nullable=true) + +/** +* Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia +*/ +private String catalogtypeprocess; + +@Column(name="CATALOGCODETYPEPROCESS", nullable=true) + +/** +* Codigo de tabla de catalogo del proceso de negocio de la aplicacion +*/ +private String catalogcodetypeprocess; + +@Column(name="EXECUTIONORDER", nullable=true) + +/** +* orden de ejecucion de la regla de negocio. +*/ +private Integer executionorder; + +@Column(name="STATUS", nullable=true) + +/** +* A indica que la regla esta activa, I regla Inactiva +*/ +private String status; + +/**Contructor por defecto*/ +public TgeneQueryProcess(){ +} +/**Contructor de TgeneQueryProcess +@param pPk Clave Primaria del entity +*/ +public TgeneQueryProcess(TgeneQueryProcessKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneQueryProcess +*/ +public static TgeneQueryProcess find(EntityManager pEntityManager,TgeneQueryProcessKey pKey) throws Exception{ + TgeneQueryProcess obj = pEntityManager.find(TgeneQueryProcess.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneQueryProcess +@return El objeto que referencia a la Clave primaria de TgeneQueryProcess +*/ +public TgeneQueryProcessKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneQueryProcess +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneQueryProcess +*/ +public void setPk(TgeneQueryProcessKey pPk){ + pk=pPk; +} +/**Obtiene el valor de processcode +@return valor de processcode*/ +public String getProcesscode(){ + return processcode; +} +/**Fija el valor de processcode +@param pProcesscode nuevo Valor de processcode*/ +public void setProcesscode(String pProcesscode){ + processcode=pProcesscode; +} + +/**Obtiene el valor de catalogtypeprocess +@return valor de catalogtypeprocess*/ +public String getCatalogtypeprocess(){ + return catalogtypeprocess; +} +/**Fija el valor de catalogtypeprocess +@param pCatalogtypeprocess nuevo Valor de catalogtypeprocess*/ +public void setCatalogtypeprocess(String pCatalogtypeprocess){ + catalogtypeprocess=pCatalogtypeprocess; +} + +/**Obtiene el valor de catalogcodetypeprocess +@return valor de catalogcodetypeprocess*/ +public String getCatalogcodetypeprocess(){ + return catalogcodetypeprocess; +} +/**Fija el valor de catalogcodetypeprocess +@param pCatalogcodetypeprocess nuevo Valor de catalogcodetypeprocess*/ +public void setCatalogcodetypeprocess(String pCatalogcodetypeprocess){ + catalogcodetypeprocess=pCatalogcodetypeprocess; +} + +/**Obtiene el valor de executionorder +@return valor de executionorder*/ +public Integer getExecutionorder(){ + return executionorder; +} +/**Fija el valor de executionorder +@param pExecutionorder nuevo Valor de executionorder*/ +public void setExecutionorder(Integer pExecutionorder){ + executionorder=pExecutionorder; +} + +/**Obtiene el valor de status +@return valor de status*/ +public String getStatus(){ + return status; +} +/**Fija el valor de status +@param pStatus nuevo Valor de status*/ +public void setStatus(String pStatus){ + status=pStatus; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneQueryProcess))return false; + TgeneQueryProcess that = (TgeneQueryProcess) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneQueryProcess +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneQueryProcess +*/ +public Object createInstance(){ + TgeneQueryProcess instance=new TgeneQueryProcess(); + instance.setPk(new TgeneQueryProcessKey()); + return instance; +} +/**Clona la entidad TgeneQueryProcess +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneQueryProcess p=(TgeneQueryProcess)this.clone(); + p.setPk((TgeneQueryProcessKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneQueryProcessKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneQueryProcessKey.java new file mode 100644 index 0000000..8f53cde --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneQueryProcessKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEQUERYPROCESS*/ +@Embeddable +public class TgeneQueryProcessKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="QUERYCODE", nullable=false,updatable=false) + +/** +* Codigo de query que se encarga de completar datos de una consulta o lista de valores +*/ +private String querycode; + +@Column(name="SEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del comando +*/ +private Integer sequence; + +/**Contructor por defecto*/ +public TgeneQueryProcessKey(){} +/**Contructor de TgeneQueryProcessKey +@param pQuerycode Codigo de query que se encarga de completar datos de una consulta o lista de valores +@param pSequence Secuencia del comando +*/ +public TgeneQueryProcessKey(String pQuerycode,Integer pSequence){ + querycode=pQuerycode; + sequence=pSequence; +} +/**Obtiene el valor de querycode +@return valor de querycode*/ +public String getQuerycode(){ + return querycode; +} +/**Fija el valor de querycode +@param pQuerycode nuevo Valor de querycode*/ +public void setQuerycode(String pQuerycode){ + querycode=pQuerycode; +} + +/**Obtiene el valor de sequence +@return valor de sequence*/ +public Integer getSequence(){ + return sequence; +} +/**Fija el valor de sequence +@param pSequence nuevo Valor de sequence*/ +public void setSequence(Integer pSequence){ + sequence=pSequence; +} + +/**Implementacin de la comparacin de TgeneQueryProcessKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneQueryProcessKey))return false; + TgeneQueryProcessKey that = (TgeneQueryProcessKey) o; + if (this.getQuerycode() == null || that.getQuerycode() == null){ + return false; + } + if (! this.getQuerycode().equals(that.getQuerycode())){ + return false; + } + if (this.getSequence() == null || that.getSequence() == null){ + return false; + } + if (! this.getSequence().equals(that.getSequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneQueryProcessKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getQuerycode() == null ? 0 : this.getQuerycode().hashCode()); + result = result * 37 + (this.getSequence() == null ? 0 : this.getSequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneRevokeSolicitude.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneRevokeSolicitude.java new file mode 100644 index 0000000..13859e9 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneRevokeSolicitude.java @@ -0,0 +1,180 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEREVOKESOLICITUDE*/ +@Entity(name="TgeneRevokeSolicitude") +@Table(name="TGENEREVOKESOLICITUDE") +public class TgeneRevokeSolicitude extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneRevokeSolicitude +*/ +@EmbeddedId +private TgeneRevokeSolicitudeKey pk; +@Column(name="ACCOUNT", nullable=true) + +/** +* Numero de cuenta asociado a la solicitud +*/ +private String account; + +@Column(name="REMARK", nullable=false) + +/** +* Motivo de anulacion de la solicitud +*/ +private String remark; + +@Column(name="WORKINGDATE", nullable=false) + +/** +* Fecha de trabajo de la aplicacion +*/ +private Date workingdate; + +/**Contructor por defecto*/ +public TgeneRevokeSolicitude(){ +} +/**Contructor de TgeneRevokeSolicitude +@param pPk Clave Primaria del entity +@param pRemark Motivo de anulacion de la solicitud +@param pWorkingdate Fecha de trabajo de la aplicacion +*/ +public TgeneRevokeSolicitude(TgeneRevokeSolicitudeKey pPk,String pRemark,Date pWorkingdate){ + this(); + pk=pPk; + remark=pRemark; + workingdate=pWorkingdate; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneRevokeSolicitude +*/ +public static TgeneRevokeSolicitude find(EntityManager pEntityManager,TgeneRevokeSolicitudeKey pKey) throws Exception{ + TgeneRevokeSolicitude obj = pEntityManager.find(TgeneRevokeSolicitude.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneRevokeSolicitude +@return El objeto que referencia a la Clave primaria de TgeneRevokeSolicitude +*/ +public TgeneRevokeSolicitudeKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneRevokeSolicitude +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneRevokeSolicitude +*/ +public void setPk(TgeneRevokeSolicitudeKey pPk){ + pk=pPk; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de remark +@return valor de remark*/ +public String getRemark(){ + return remark; +} +/**Fija el valor de remark +@param pRemark nuevo Valor de remark*/ +public void setRemark(String pRemark){ + remark=pRemark; +} + +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneRevokeSolicitude))return false; + TgeneRevokeSolicitude that = (TgeneRevokeSolicitude) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneRevokeSolicitude +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneRevokeSolicitude +*/ +public Object createInstance(){ + TgeneRevokeSolicitude instance=new TgeneRevokeSolicitude(); + instance.setPk(new TgeneRevokeSolicitudeKey()); + return instance; +} +/**Clona la entidad TgeneRevokeSolicitude +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneRevokeSolicitude p=(TgeneRevokeSolicitude)this.clone(); + p.setPk((TgeneRevokeSolicitudeKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneRevokeSolicitudeKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneRevokeSolicitudeKey.java new file mode 100644 index 0000000..65e6bbb --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneRevokeSolicitudeKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEREVOKESOLICITUDE*/ +@Embeddable +public class TgeneRevokeSolicitudeKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero unico de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +/**Contructor por defecto*/ +public TgeneRevokeSolicitudeKey(){} +/**Contructor de TgeneRevokeSolicitudeKey +@param pSolicitudnumber Numero unico de solicitud +@param pSolicitudsequence Secuencia interna de solicitud +*/ +public TgeneRevokeSolicitudeKey(String pSolicitudnumber,Integer pSolicitudsequence){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Implementacion de la comparacion de TgeneRevokeSolicitudeKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneRevokeSolicitudeKey))return false; + TgeneRevokeSolicitudeKey that = (TgeneRevokeSolicitudeKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneRevokeSolicitudeKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneServices.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneServices.java new file mode 100644 index 0000000..1fce10b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneServices.java @@ -0,0 +1,250 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Transient; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENESERVICES + */ +@Entity(name = "TgeneServices") +@Table(name = "TGENESERVICES") +public class TgeneServices extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneServices + */ + @Id + @Column(name = "SERVICECODE", nullable = false, updatable = false) + private String pk; + @Column(name = "DESCRIPTION", nullable = true) + /** + * Nombre del servicio + */ + private String description; + + @Column(name = "CLASSNAME", nullable = true) + /** + * Clase que se encarga de iniciar o detener el servicio + */ + private String classname; + + @Column(name = "AUTOMATIC", nullable = true) + /** + * Y, Indica que el servicio se levanta al moemento de subir el servidor de aplicaciones + */ + private String automatic; + + /** Contructor por defecto */ + public TgeneServices() { + } + + /** + * Contructor de TgeneServices + * + * @param pPk + * Clave Primaria del entity + */ + public TgeneServices(String pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager + * referencia de la session a obtener datos del bean. + * @param pKey + * Caleve primaria del bean. + * @return TgeneServices + */ + public static TgeneServices find(EntityManager pEntityManager, Object pKey) + throws Exception { + TgeneServices obj = pEntityManager.find(TgeneServices.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneServices + * + * @return El objeto que referencia a la Clave primaria de TgeneServices + */ + public String getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneServices + * + * @param pPk + * El objeto que referencia a la nueva Clave primaria de + * TgeneServices + */ + public void setPk(String pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription + * nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + /** + * Obtiene el valor de classname + * + * @return valor de classname + */ + public String getClassname() { + return classname; + } + + /** + * Fija el valor de classname + * + * @param pClassname + * nuevo Valor de classname + */ + public void setClassname(String pClassname) { + classname = pClassname; + } + + /** + * Obtiene el valor de automatic + * + * @return valor de automatic + */ + public String getAutomatic() { + return automatic; + } + + /** + * Fija el valor de automatic + * + * @param pAutomatic + * nuevo Valor de automatic + */ + public void setAutomatic(String pAutomatic) { + automatic = pAutomatic; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneServices)) + return false; + TgeneServices that = (TgeneServices) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneServices + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 + || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneServices */ + public Object createInstance() { + TgeneServices instance = new TgeneServices(); + return instance; + } + + /** + * Clona la entidad TgeneServices + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneServices p = (TgeneServices) this.clone(); + return p; + } + + //Metodos manuales + private static String JPQL = " from TgeneServices "; + + /** + * Metodo que entrega una lista de servicios a subir al servidor de aplicacion. + * @param pEntityManager + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager) throws Exception { + List ldata = null; + Query qry = pEntityManager.createQuery(JPQL); + ldata = qry.getResultList(); + return ldata; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitude.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitude.java new file mode 100644 index 0000000..2dba468 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitude.java @@ -0,0 +1,917 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDE + */ +@Entity(name = "TgeneSolicitude") +@Table(name = "TGENESOLICITUDE") +public class TgeneSolicitude extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneSolicitude + */ + @EmbeddedId + private TgeneSolicitudeKey pk; + + @Column(name = "DATEFROM", nullable = false) + /** + * Fecha desde la cual esta vigente el registro de solicitud + */ + private Timestamp datefrom; + + @Column(name = "ACCOUNT", nullable = true) + /** + * Numero de cuenta asociado a la solicitud + */ + private String account; + + @Column(name = "COMPANY", nullable = false) + /** + * Codigo de compania a la que pertence la cuenta + */ + private Integer company; + + @Column(name = "CURRENCYCODE", nullable = false) + /** + * Codigo de moneda + */ + private String currencycode; + + @Column(name = "ACCOUNTNAME", nullable = true) + /** + * Nombre de la cuenta + */ + private String accountname; + + @Column(name = "PERSONCODE", nullable = true) + /** + * Codigo de persona principal de la cuenta + */ + private Integer personcode; + + @Column(name = "MODULECODE", nullable = true) + /** + * Codigo de modulo al que pertenece la cuenta + */ + private String modulecode; + + @Column(name = "STATUSCODE", nullable = true) + /** + * Estatus de la solicitud + */ + private String statuscode; + + @Column(name = "OFFICECODE", nullable = true) + /** + * Codigo de oficina a la que pertenece la cuenta + */ + private Integer officecode; + + @Column(name = "BRANCHCODE", nullable = true) + /** + * Codigo de sucursal a la que pertenece la cuenta + */ + private Integer branchcode; + + @Column(name = "OPENOFFICECODE", nullable = true) + /** + * Codigo de oficina de apertura de la cuenta + */ + private Integer openofficecode; + + @Column(name = "OPENBRANCHCODE", nullable = true) + /** + * Codigo de sucursal de apertura de la cuenta + */ + private Integer openbranchcode; + + @Column(name = "OPENINGUSERCODE", nullable = true) + /** + * Codigo de usuario de apertura de la cuenta + */ + private String openingusercode; + + @Column(name = "CHARGECATALOG", nullable = true) + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String chargecatalog; + + @Column(name = "CHARGECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String chargecatalogcode; + + @Column(name = "RATECATALOG", nullable = true) + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String ratecatalog; + + @Column(name = "RATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String ratecatalogcode; + + @Column(name = "CREDITTYPECODE", nullable = true) + /** + * Codigo de tipo de credito + */ + private String credittypecode; + + @Column(name = "PRODUCTCODE", nullable = true) + /** + * Codigo de producto + */ + private String productcode; + + @Column(name = "SUBPRODUCTCODE", nullable = true) + /** + * Codigo de subproducto + */ + private String subproductcode; + + @Column(name = "OFFICER", nullable = true) + /** + * Codigo de usuario oficial de cuenta + */ + private String officer; + + @Column(name = "SECURITYLEVEL", nullable = true) + /** + * Nivel de seguridad de la cuenta + */ + private Integer securitylevel; + + @Column(name = "JOURNALID", nullable = true) + /** + * Numero de mensaje con el que se modifico el registro vigente + */ + private String journalid; + + @Column(name = "OLDJOURNALID", nullable = true) + /** + * Numero de mensaje anterior + */ + private String oldjournalid; + + /** + * Contructor por defecto + */ + public TgeneSolicitude() { + } + + /** + * Contructor de TgeneSolicitude + * + * @param pPk Clave Primaria del entity + * @param pDatefrom Fecha desde la cual esta vigente el registro de solicitud + * @param pCompany Codigo de compania a la que pertence la cuenta + * @param pCurrencycode Codigo de moneda + */ + public TgeneSolicitude(TgeneSolicitudeKey pPk, Timestamp pDatefrom, Integer pCompany, String pCurrencycode) { + this(); + this.pk = pPk; + this.datefrom = pDatefrom; + this.company = pCompany; + this.currencycode = pCurrencycode; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSolicitude + */ + public static TgeneSolicitude find(EntityManager pEntityManager, TgeneSolicitudeKey pKey) throws Exception { + TgeneSolicitude obj = pEntityManager.find(TgeneSolicitude.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneSolicitude + * + * @return El objeto que referencia a la Clave primaria de TgeneSolicitude + */ + public TgeneSolicitudeKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneSolicitude + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitude + */ + public void setPk(TgeneSolicitudeKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de account + * + * @return valor de account + */ + public String getAccount() { + return this.account; + } + + /** + * Fija el valor de account + * + * @param pAccount nuevo Valor de account + */ + public void setAccount(String pAccount) { + this.account = pAccount; + } + + /** + * Obtiene el valor de company + * + * @return valor de company + */ + public Integer getCompany() { + return this.company; + } + + /** + * Fija el valor de company + * + * @param pCompany nuevo Valor de company + */ + public void setCompany(Integer pCompany) { + this.company = pCompany; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de accountname + * + * @return valor de accountname + */ + public String getAccountname() { + return this.accountname; + } + + /** + * Fija el valor de accountname + * + * @param pAccountname nuevo Valor de accountname + */ + public void setAccountname(String pAccountname) { + this.accountname = pAccountname; + } + + /** + * Obtiene el valor de personcode + * + * @return valor de personcode + */ + public Integer getPersoncode() { + return this.personcode; + } + + /** + * Fija el valor de personcode + * + * @param pPersoncode nuevo Valor de personcode + */ + public void setPersoncode(Integer pPersoncode) { + this.personcode = pPersoncode; + } + + /** + * Obtiene el valor de modulecode + * + * @return valor de modulecode + */ + public String getModulecode() { + return this.modulecode; + } + + /** + * Fija el valor de modulecode + * + * @param pModulecode nuevo Valor de modulecode + */ + public void setModulecode(String pModulecode) { + this.modulecode = pModulecode; + } + + /** + * Obtiene el valor de statuscode + * + * @return valor de statuscode + */ + public String getStatuscode() { + return this.statuscode; + } + + /** + * Fija el valor de statuscode + * + * @param pStatuscode nuevo Valor de statuscode + */ + public void setStatuscode(String pStatuscode) { + this.statuscode = pStatuscode; + } + + /** + * Obtiene el valor de officecode + * + * @return valor de officecode + */ + public Integer getOfficecode() { + return this.officecode; + } + + /** + * Fija el valor de officecode + * + * @param pOfficecode nuevo Valor de officecode + */ + public void setOfficecode(Integer pOfficecode) { + this.officecode = pOfficecode; + } + + /** + * Obtiene el valor de branchcode + * + * @return valor de branchcode + */ + public Integer getBranchcode() { + return this.branchcode; + } + + /** + * Fija el valor de branchcode + * + * @param pBranchcode nuevo Valor de branchcode + */ + public void setBranchcode(Integer pBranchcode) { + this.branchcode = pBranchcode; + } + + /** + * Obtiene el valor de openofficecode + * + * @return valor de openofficecode + */ + public Integer getOpenofficecode() { + return this.openofficecode; + } + + /** + * Fija el valor de openofficecode + * + * @param pOpenofficecode nuevo Valor de openofficecode + */ + public void setOpenofficecode(Integer pOpenofficecode) { + this.openofficecode = pOpenofficecode; + } + + /** + * Obtiene el valor de openbranchcode + * + * @return valor de openbranchcode + */ + public Integer getOpenbranchcode() { + return this.openbranchcode; + } + + /** + * Fija el valor de openbranchcode + * + * @param pOpenbranchcode nuevo Valor de openbranchcode + */ + public void setOpenbranchcode(Integer pOpenbranchcode) { + this.openbranchcode = pOpenbranchcode; + } + + /** + * Obtiene el valor de openingusercode + * + * @return valor de openingusercode + */ + public String getOpeningusercode() { + return this.openingusercode; + } + + /** + * Fija el valor de openingusercode + * + * @param pOpeningusercode nuevo Valor de openingusercode + */ + public void setOpeningusercode(String pOpeningusercode) { + this.openingusercode = pOpeningusercode; + } + + /** + * Obtiene el valor de chargecatalog + * + * @return valor de chargecatalog + */ + public String getChargecatalog() { + return this.chargecatalog; + } + + /** + * Fija el valor de chargecatalog + * + * @param pChargecatalog nuevo Valor de chargecatalog + */ + public void setChargecatalog(String pChargecatalog) { + this.chargecatalog = pChargecatalog; + } + + /** + * Obtiene el valor de chargecatalogcode + * + * @return valor de chargecatalogcode + */ + public String getChargecatalogcode() { + return this.chargecatalogcode; + } + + /** + * Fija el valor de chargecatalogcode + * + * @param pChargecatalogcode nuevo Valor de chargecatalogcode + */ + public void setChargecatalogcode(String pChargecatalogcode) { + this.chargecatalogcode = pChargecatalogcode; + } + + /** + * Obtiene el valor de ratecatalog + * + * @return valor de ratecatalog + */ + public String getRatecatalog() { + return this.ratecatalog; + } + + /** + * Fija el valor de ratecatalog + * + * @param pRatecatalog nuevo Valor de ratecatalog + */ + public void setRatecatalog(String pRatecatalog) { + this.ratecatalog = pRatecatalog; + } + + /** + * Obtiene el valor de ratecatalogcode + * + * @return valor de ratecatalogcode + */ + public String getRatecatalogcode() { + return this.ratecatalogcode; + } + + /** + * Fija el valor de ratecatalogcode + * + * @param pRatecatalogcode nuevo Valor de ratecatalogcode + */ + public void setRatecatalogcode(String pRatecatalogcode) { + this.ratecatalogcode = pRatecatalogcode; + } + + /** + * Obtiene el valor de credittypecode + * + * @return valor de credittypecode + */ + public String getCredittypecode() { + return this.credittypecode; + } + + /** + * Fija el valor de credittypecode + * + * @param pCredittypecode nuevo Valor de credittypecode + */ + public void setCredittypecode(String pCredittypecode) { + this.credittypecode = pCredittypecode; + } + + /** + * Obtiene el valor de productcode + * + * @return valor de productcode + */ + public String getProductcode() { + return this.productcode; + } + + /** + * Fija el valor de productcode + * + * @param pProductcode nuevo Valor de productcode + */ + public void setProductcode(String pProductcode) { + this.productcode = pProductcode; + } + + /** + * Obtiene el valor de subproductcode + * + * @return valor de subproductcode + */ + public String getSubproductcode() { + return this.subproductcode; + } + + /** + * Fija el valor de subproductcode + * + * @param pSubproductcode nuevo Valor de subproductcode + */ + public void setSubproductcode(String pSubproductcode) { + this.subproductcode = pSubproductcode; + } + + /** + * Obtiene el valor de officer + * + * @return valor de officer + */ + public String getOfficer() { + return this.officer; + } + + /** + * Fija el valor de officer + * + * @param pOfficer nuevo Valor de officer + */ + public void setOfficer(String pOfficer) { + this.officer = pOfficer; + } + + /** + * Obtiene el valor de securitylevel + * + * @return valor de securitylevel + */ + public Integer getSecuritylevel() { + return this.securitylevel; + } + + /** + * Fija el valor de securitylevel + * + * @param pSecuritylevel nuevo Valor de securitylevel + */ + public void setSecuritylevel(Integer pSecuritylevel) { + this.securitylevel = pSecuritylevel; + } + + /** + * Obtiene el valor de journalid + * + * @return valor de journalid + */ + public String getJournalid() { + return this.journalid; + } + + /** + * Fija el valor de journalid + * + * @param pJournalid nuevo Valor de journalid + */ + public void setJournalid(String pJournalid) { + this.journalid = pJournalid; + } + + /** + * Obtiene el valor de oldjournalid + * + * @return valor de oldjournalid + */ + public String getOldjournalid() { + return this.oldjournalid; + } + + /** + * Fija el valor de oldjournalid + * + * @param pOldjournalid nuevo Valor de oldjournalid + */ + public void setOldjournalid(String pOldjournalid) { + this.oldjournalid = pOldjournalid; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneSolicitude)) { + return false; + } + TgeneSolicitude that = (TgeneSolicitude) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneSolicitude + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacion toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacion de la creacion de un bean en blanco TgeneSolicitude + */ + @Override + public Object createInstance() { + TgeneSolicitude instance = new TgeneSolicitude(); + instance.setPk(new TgeneSolicitudeKey()); + return instance; + } + + /** + * Clona la entidad TgeneSolicitude + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneSolicitude p = (TgeneSolicitude) this.clone(); + p.setPk((TgeneSolicitudeKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + + // METODOS MANUALES + /** + * Sentencia SQL que obtiene un objeto de tipo TgeneSolicitude + */ + private static final String JPQL_SOLICITUDE = "from TgeneSolicitude tgs" + " where tgs.pk.solicitudnumber = :solicitudnumber" + + " and tgs.pk.solicitudsequence = :solicitudsequence" + " and tgs.pk.dateto = :dateto"; + + /** + * Metodo que devuelve un objeto de tipo TgeneSolicitude + * + * @param solicitudnumber + * @param solicitudsequence + * @return + * @throws Exception + */ + public static TgeneSolicitude find(EntityManager pEntityManager, String solicitudnumber, Integer solicitudsequence) throws Exception { + Query qry = pEntityManager.createQuery(TgeneSolicitude.JPQL_SOLICITUDE); + qry.setParameter("solicitudnumber", solicitudnumber); + qry.setParameter("solicitudsequence", solicitudsequence); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + try { + return (TgeneSolicitude) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + + /** + * Sentencia SQL que obtiene un objeto de tipo TgeneSolicitude por codigo modulo + */ + private static final String JPQL_SOLICITUDE_WITHOUT_DISB_BY_ACCOUNT = "from TgeneSolicitude sol where (coalesce(sol.account, 'null') = 'null'" + + " or sol.account in(select acc.pk.account from TgeneAccount acc where acc.accountstatuscode!='VIG' and acc.pk.dateto = :dateto ))" + + "and sol.statuscode in('ENT', 'APR') and sol.modulecode = :modulecode and sol.account = :account and sol.pk.dateto = :dateto"; + + /** + * Metodo que devuelve una lista de TgeneSolicitude nuevas y que no tengan cuentas con estado VIG por codigo de + * cuenta + * + * @param pEntityManager + * @param moduleCode + * @param accountNumber + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findWithoutDisbursementByAccount(EntityManager pEntityManager, String moduleCode, String accountNumber, + Integer page, Integer recordperpage) throws Exception { + Query qry = pEntityManager.createQuery(TgeneSolicitude.JPQL_SOLICITUDE_WITHOUT_DISB_BY_ACCOUNT); + qry.setParameter("modulecode", moduleCode); + qry.setParameter("account", accountNumber); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + if ((page != null) && (recordperpage != null) && (page >= 0) && (recordperpage > 0)) { + if (page > 1) { + qry.setFirstResult((page - 1) * recordperpage); + } + qry.setMaxResults(recordperpage); + } + return qry.getResultList(); + } + + /** + * Sentencia SQL que obtiene un objeto de tipo TgeneSolicitude por codigo de persona + */ + private static final String JPQL_SOLICITUDE_WITHOUT_DISB_BY_PERSON = "from TgeneSolicitude sol where (coalesce(sol.account, 'null') = 'null'" + + " or sol.account in(select acc.pk.account from TgeneAccount acc where acc.accountstatuscode!='VIG' and acc.pk.dateto = :dateto ))" + + "and sol.statuscode in('ENT', 'APR') and sol.modulecode = :modulecode and sol.personcode = :personcode and sol.pk.dateto = :dateto"; + + /** + * Metodo que devuelve una lista de TgeneSolicitude nuevas y que no tengan cuentas con estado VIG por codigo de + * persona + * + * @param pEntityManager + * @param moduleCode + * @param personCode + * @return + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findWithoutDisbursementByPerson(EntityManager pEntityManager, String moduleCode, Integer personCode, + Integer page, Integer recordperpage) throws Exception { + Query qry = pEntityManager.createQuery(TgeneSolicitude.JPQL_SOLICITUDE_WITHOUT_DISB_BY_PERSON); + qry.setParameter("modulecode", moduleCode); + qry.setParameter("personcode", personCode); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + if ((page != null) && (recordperpage != null) && (page >= 0) && (recordperpage > 0)) { + if (page > 1) { + qry.setFirstResult((page - 1) * recordperpage); + } + qry.setMaxResults(recordperpage); + } + return qry.getResultList(); + } + + /** + * Sentencia SQL que consulta retorna la solicitud dada una cuenta y estatus + */ + private static final String JPQL_SOLICITUDE_BY_ACCOUNT_AND_STATUS = "from TgeneSolicitude sol " + " where sol.account = :account " + + " and sol.company = :company " + " and sol.statuscode = :statuscode and sol.pk.dateto = :dateto"; + + /** + * Sentencia SQL que consulta retorna la solicitud dada una cuenta + */ + private static final String JPQL_SOLICITUDE_BY_ACCOUNT = "from TgeneSolicitude sol " + " where sol.account = :account " + + " and sol.company = :company " + " and sol.pk.dateto = :dateto"; + + /** + * Metodo que devuelve una solicitud por medio de la cuenta que ha creado y el estado de la solicitud + * + * @param pEntityManager + * @param paccount + * @param pcompany + * @param status + * @return + * @throws Exception + */ + public static TgeneSolicitude findByAccountAndStatus(EntityManager pEntityManager, String paccount, Integer pcompany, String status) + throws Exception { + Query qry = pEntityManager.createQuery(TgeneSolicitude.JPQL_SOLICITUDE_BY_ACCOUNT_AND_STATUS); + qry.setParameter("account", paccount); + qry.setParameter("company", pcompany); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + qry.setParameter("statuscode", status); + qry.setMaxResults(1); + if (qry.getResultList().isEmpty()) { + return null; + } + return (TgeneSolicitude) qry.getResultList().get(0); + } + + /** + * Metodo que devuelve una solicitud por medio de la cuenta que ha creado + * + * @param pEntityManager + * @param paccount + * @param pcompany + * @return + * @throws Exception + */ + public static TgeneSolicitude findByAccount(EntityManager pEntityManager, String paccount, Integer pcompany) throws Exception { + Query qry = pEntityManager.createQuery(TgeneSolicitude.JPQL_SOLICITUDE_BY_ACCOUNT); + qry.setParameter("account", paccount); + qry.setParameter("company", pcompany); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + qry.setMaxResults(1); + return (TgeneSolicitude) qry.getResultList().get(0); + } + + private static final String JPQL_SOLICITUDE_APPDATE = " select min(datefrom) from TgeneSolicitude sol " + + " where sol.pk.solicitudnumber = :solicitudnumber" + " and sol.company = :company "; + + public static Date findApplicationDate(EntityManager pEntityManager, String solicitudnumber, Integer company) { + Query qry = pEntityManager.createQuery(TgeneSolicitude.JPQL_SOLICITUDE_APPDATE); + qry.setParameter("solicitudnumber", solicitudnumber); + qry.setParameter("company", company); + Timestamp obj = (Timestamp) qry.getSingleResult(); + return new Date(obj.getTime()); + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeCreditOpening.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeCreditOpening.java new file mode 100644 index 0000000..4e1c68a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeCreditOpening.java @@ -0,0 +1,332 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDECREDITOPENING*/ +@Entity(name="TgeneSolicitudeCreditOpening") +@Table(name="TGENESOLICITUDECREDITOPENING") +public class TgeneSolicitudeCreditOpening extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeCreditOpening +*/ +@EmbeddedId +private TgeneSolicitudeCreditOpeningKey pk; +@Column(name="CURRENCYCODE", nullable=true) + +/** +* Codigo de moneda en la que esta expresado el valor a aplicar dependiendo al forma de debito +*/ +private String currencycode; + +@Column(name="CASH", nullable=true) + +/** +* Indica que el valor se entrega en efectivo. +*/ +private String cash; + +@Column(name="CHECKS", nullable=true) + +/** +* Indica que el valor se entrega en cheques. +*/ +private String checks; + +@Column(name="CREDIT", nullable=true) + +/** +* Indica que el valor se entrega con credito a uan cuenta o credito a un codigo contable. +*/ +private String credit; + +@Column(name="CREDITACCOUNT", nullable=true) + +/** +* Numero de cuenta a la vista a realizar el credito, si la moneda de la cuenta es diferente a la moneda en la cual esta expresado el valor se tiene que hacer la compra venta de divisas +*/ +private String creditaccount; + +@Column(name="CREDITACCOUNTINGCODE", nullable=true) + +/** +* Codigo contable a relaizar el credito. +*/ +private String creditaccountingcode; + +@Column(name="VALUE", nullable=true) + +/** +* Valor en la moneda de la solicitud, la compra venta se hace en funcion a la moneda de la cuenta credito +*/ +private BigDecimal value; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona a emitir el cheque +*/ +private Integer personcode; + +@Column(name="IDBENEFICIARY", nullable=true) + +/** +* Si no esta registrado como cliente, identificacion del beneficiario del cheque +*/ +private String idbeneficiary; + +@Column(name="BENEFICIARYNAME", nullable=true) + +/** +* Nombre del beneficiario del cheque. +*/ +private String beneficiaryname; + +/**Contructor por defecto*/ +public TgeneSolicitudeCreditOpening(){ +} +/**Contructor de TgeneSolicitudeCreditOpening +@param pPk Clave Primaria del entity +*/ +public TgeneSolicitudeCreditOpening(TgeneSolicitudeCreditOpeningKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSolicitudeCreditOpening +*/ +public static TgeneSolicitudeCreditOpening find(EntityManager pEntityManager,TgeneSolicitudeCreditOpeningKey pKey) throws Exception{ + TgeneSolicitudeCreditOpening obj = pEntityManager.find(TgeneSolicitudeCreditOpening.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSolicitudeCreditOpening +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeCreditOpening +*/ +public TgeneSolicitudeCreditOpeningKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeCreditOpening +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeCreditOpening +*/ +public void setPk(TgeneSolicitudeCreditOpeningKey pPk){ + pk=pPk; +} +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de cash +@return valor de cash*/ +public String getCash(){ + return cash; +} +/**Fija el valor de cash +@param pCash nuevo Valor de cash*/ +public void setCash(String pCash){ + cash=pCash; +} + +/**Obtiene el valor de checks +@return valor de checks*/ +public String getChecks(){ + return checks; +} +/**Fija el valor de checks +@param pChecks nuevo Valor de checks*/ +public void setChecks(String pChecks){ + checks=pChecks; +} + +/**Obtiene el valor de credit +@return valor de credit*/ +public String getCredit(){ + return credit; +} +/**Fija el valor de credit +@param pCredit nuevo Valor de credit*/ +public void setCredit(String pCredit){ + credit=pCredit; +} + +/**Obtiene el valor de creditaccount +@return valor de creditaccount*/ +public String getCreditaccount(){ + return creditaccount; +} +/**Fija el valor de creditaccount +@param pCreditaccount nuevo Valor de creditaccount*/ +public void setCreditaccount(String pCreditaccount){ + creditaccount=pCreditaccount; +} + +/**Obtiene el valor de creditaccountingcode +@return valor de creditaccountingcode*/ +public String getCreditaccountingcode(){ + return creditaccountingcode; +} +/**Fija el valor de creditaccountingcode +@param pCreditaccountingcode nuevo Valor de creditaccountingcode*/ +public void setCreditaccountingcode(String pCreditaccountingcode){ + creditaccountingcode=pCreditaccountingcode; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de idbeneficiary +@return valor de idbeneficiary*/ +public String getIdbeneficiary(){ + return idbeneficiary; +} +/**Fija el valor de idbeneficiary +@param pIdbeneficiary nuevo Valor de idbeneficiary*/ +public void setIdbeneficiary(String pIdbeneficiary){ + idbeneficiary=pIdbeneficiary; +} + +/**Obtiene el valor de beneficiaryname +@return valor de beneficiaryname*/ +public String getBeneficiaryname(){ + return beneficiaryname; +} +/**Fija el valor de beneficiaryname +@param pBeneficiaryname nuevo Valor de beneficiaryname*/ +public void setBeneficiaryname(String pBeneficiaryname){ + beneficiaryname=pBeneficiaryname; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeCreditOpening))return false; + TgeneSolicitudeCreditOpening that = (TgeneSolicitudeCreditOpening) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeCreditOpening +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSolicitudeCreditOpening +*/ +public Object createInstance(){ + TgeneSolicitudeCreditOpening instance=new TgeneSolicitudeCreditOpening(); + instance.setPk(new TgeneSolicitudeCreditOpeningKey()); + return instance; +} +/**Clona la entidad TgeneSolicitudeCreditOpening +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeCreditOpening p=(TgeneSolicitudeCreditOpening)this.clone(); + p.setPk((TgeneSolicitudeCreditOpeningKey)this.pk.cloneMe()); + return p; +} + //Metodos manuales. + /**Sentencia que devuelve uan lista con los valores a entregar al cliente asociados a una solicitud.*/ + private static final String HQL_SOLICITUDE_CREDIT = + " from TgeneSolicitudeCreditOpening t " + + " where t.pk.solicitudnumber = :solicitudnumber "+ + " and t.pk.solicitudsequence = :solicitudsequence "+ + " order by t.pk.creditsequence "; + + /** + * Metodo que entrega una lista de valores a entregar al cliente, en la aperturad e una operacion. + * @param pSolicitudNumber Numero de solicitud. + * @param pSolicitudSequence Secuencia dentro de la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List find(EntityManager pEntityManager, + String pSolicitudNumber,Integer pSolicitudSequence) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_SOLICITUDE_CREDIT); + qry.setParameter("solicitudnumber", pSolicitudNumber); + qry.setParameter("solicitudsequence", pSolicitudSequence); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeCreditOpeningKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeCreditOpeningKey.java new file mode 100644 index 0000000..e5d1c1b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeCreditOpeningKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDECREDITOPENING*/ +@Embeddable +public class TgeneSolicitudeCreditOpeningKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="CREDITSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de debito, utilizada para formar el pk y permitir ingresar varias opciones de credito. +*/ +private Integer creditsequence; + +/**Contructor por defecto*/ +public TgeneSolicitudeCreditOpeningKey(){} +/**Contructor de TgeneSolicitudeCreditOpeningKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pCreditsequence Secuencia de debito, utilizada para formar el pk y permitir ingresar varias opciones de credito. +*/ +public TgeneSolicitudeCreditOpeningKey(String pSolicitudnumber,Integer pSolicitudsequence,Integer pCreditsequence){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + creditsequence=pCreditsequence; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de creditsequence +@return valor de creditsequence*/ +public Integer getCreditsequence(){ + return creditsequence; +} +/**Fija el valor de creditsequence +@param pCreditsequence nuevo Valor de creditsequence*/ +public void setCreditsequence(Integer pCreditsequence){ + creditsequence=pCreditsequence; +} + +/**Implementacin de la comparacin de TgeneSolicitudeCreditOpeningKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeCreditOpeningKey))return false; + TgeneSolicitudeCreditOpeningKey that = (TgeneSolicitudeCreditOpeningKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getCreditsequence() == null || that.getCreditsequence() == null){ + return false; + } + if (! this.getCreditsequence().equals(that.getCreditsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeCreditOpeningKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getCreditsequence() == null ? 0 : this.getCreditsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeDebitOpening.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeDebitOpening.java new file mode 100644 index 0000000..a70f66f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeDebitOpening.java @@ -0,0 +1,297 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDEDEBITOPENING*/ +@Entity(name="TgeneSolicitudeDebitOpening") +@Table(name="TGENESOLICITUDEDEBITOPENING") +public class TgeneSolicitudeDebitOpening extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeDebitOpening +*/ +@EmbeddedId +private TgeneSolicitudeDebitOpeningKey pk; +@Column(name="CURRENCYCODE", nullable=true) + +/** +* Codigo de moneda en la que esta expresado el valor a aplicar dependiendo al forma de debito +*/ +private String currencycode; + +@Column(name="CASH", nullable=true) + +/** +* Indica que el valor se cobra en efectivo. +*/ +private String cash; + +@Column(name="CHECKS", nullable=true) + +/** +* Indica que el valor se cobra en cheques. +*/ +private String checks; + +@Column(name="DEBIT", nullable=true) + +/** +* Indica que el valor se cobra con debito a uan cuenta o debito a un codigo contable. +*/ +private String debit; + +@Column(name="DEBITACCOUNT", nullable=true) + +/** +* Numero de cuenta a la vista a debitar, si la moneda de la cuenta es diferente a la moneda en la cual esta expresado el valor se tiene que hacer la compra venta de divisas +*/ +private String debitaccount; + +@Column(name="ACCOUNTMODULE", nullable=true) + +/** +* Codigo de modulo al que pertenece la cuenta +*/ +private String accountmodule; + +@Column(name="DEBITACCOUNTINGCODE", nullable=true) + +/** +* Codigo contable a relaizar el debito de la cuenta. +*/ +private String debitaccountingcode; + +@Column(name="VALUE", nullable=true) + +/** +* Valor en la moneda de la solicitud, la compra venta se hace en funcion a la moneda de la cuenta debito +*/ +private BigDecimal value; + +/**Contructor por defecto*/ +public TgeneSolicitudeDebitOpening(){ +} +/**Contructor de TgeneSolicitudeDebitOpening +@param pPk Clave Primaria del entity +*/ +public TgeneSolicitudeDebitOpening(TgeneSolicitudeDebitOpeningKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSolicitudeDebitOpening +*/ +public static TgeneSolicitudeDebitOpening find(EntityManager pEntityManager,TgeneSolicitudeDebitOpeningKey pKey) throws Exception{ + TgeneSolicitudeDebitOpening obj = pEntityManager.find(TgeneSolicitudeDebitOpening.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSolicitudeDebitOpening +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeDebitOpening +*/ +public TgeneSolicitudeDebitOpeningKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeDebitOpening +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeDebitOpening +*/ +public void setPk(TgeneSolicitudeDebitOpeningKey pPk){ + pk=pPk; +} +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de cash +@return valor de cash*/ +public String getCash(){ + return cash; +} +/**Fija el valor de cash +@param pCash nuevo Valor de cash*/ +public void setCash(String pCash){ + cash=pCash; +} + +/**Obtiene el valor de checks +@return valor de checks*/ +public String getChecks(){ + return checks; +} +/**Fija el valor de checks +@param pChecks nuevo Valor de checks*/ +public void setChecks(String pChecks){ + checks=pChecks; +} + +/**Obtiene el valor de debit +@return valor de debit*/ +public String getDebit(){ + return debit; +} +/**Fija el valor de debit +@param pDebit nuevo Valor de debit*/ +public void setDebit(String pDebit){ + debit=pDebit; +} + +/**Obtiene el valor de debitaccount +@return valor de debitaccount*/ +public String getDebitaccount(){ + return debitaccount; +} +/**Fija el valor de debitaccount +@param pDebitaccount nuevo Valor de debitaccount*/ +public void setDebitaccount(String pDebitaccount){ + debitaccount=pDebitaccount; +} + +/**Obtiene el valor de accountmodule +@return valor de accountmodule*/ +public String getAccountmodule(){ + return accountmodule; +} +/**Fija el valor de accountmodule +@param pAccountmodule nuevo Valor de accountmodule*/ +public void setAccountmodule(String pAccountmodule){ + accountmodule=pAccountmodule; +} + +/**Obtiene el valor de debitaccountingcode +@return valor de debitaccountingcode*/ +public String getDebitaccountingcode(){ + return debitaccountingcode; +} +/**Fija el valor de debitaccountingcode +@param pDebitaccountingcode nuevo Valor de debitaccountingcode*/ +public void setDebitaccountingcode(String pDebitaccountingcode){ + debitaccountingcode=pDebitaccountingcode; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeDebitOpening))return false; + TgeneSolicitudeDebitOpening that = (TgeneSolicitudeDebitOpening) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeDebitOpening +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSolicitudeDebitOpening +*/ +public Object createInstance(){ + TgeneSolicitudeDebitOpening instance=new TgeneSolicitudeDebitOpening(); + instance.setPk(new TgeneSolicitudeDebitOpeningKey()); + return instance; +} +/**Clona la entidad TgeneSolicitudeDebitOpening +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeDebitOpening p=(TgeneSolicitudeDebitOpening)this.clone(); + p.setPk((TgeneSolicitudeDebitOpeningKey)this.pk.cloneMe()); + return p; +} + + //Metodos manuales + /**Sentencia que devuelve uan lista con los valores de cargos asociados a una solicitud.*/ + private static final String HQL_SOLICITUDE_DEBIT = + "from TgeneSolicitudeDebitOpening tsdo " + + " where tsdo.pk.solicitudnumber = :solicitudnumber "+ + " and tsdo.pk.solicitudsequence = :solicitudsequence "+ + " order by tsdo.pk.debitsequence "; + + /** + * Metodo que entrega una lista de valores a cobrar al cliente, en la aperturad e una operacion. + * @param pSolicitudNumber Numero de solicitud. + * @param pSolicitudSequence Secuencia dentro de la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager,String pSolicitudNumber, + Integer pSolicitudSequence) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_SOLICITUDE_DEBIT); + qry.setParameter("solicitudnumber", pSolicitudNumber); + qry.setParameter("solicitudsequence", pSolicitudSequence); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeDebitOpeningKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeDebitOpeningKey.java new file mode 100644 index 0000000..ebf28ad --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeDebitOpeningKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDEDEBITOPENING*/ +@Embeddable +public class TgeneSolicitudeDebitOpeningKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="DEBITSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de debito, utilizada para formar el pk y permitir ingresar varias opciones de debito. +*/ +private Integer debitsequence; + +/**Contructor por defecto*/ +public TgeneSolicitudeDebitOpeningKey(){} +/**Contructor de TgeneSolicitudeDebitOpeningKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pDebitsequence Secuencia de debito, utilizada para formar el pk y permitir ingresar varias opciones de debito. +*/ +public TgeneSolicitudeDebitOpeningKey(String pSolicitudnumber,Integer pSolicitudsequence,Integer pDebitsequence){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + debitsequence=pDebitsequence; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de debitsequence +@return valor de debitsequence*/ +public Integer getDebitsequence(){ + return debitsequence; +} +/**Fija el valor de debitsequence +@param pDebitsequence nuevo Valor de debitsequence*/ +public void setDebitsequence(Integer pDebitsequence){ + debitsequence=pDebitsequence; +} + +/**Implementacin de la comparacin de TgeneSolicitudeDebitOpeningKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeDebitOpeningKey))return false; + TgeneSolicitudeDebitOpeningKey that = (TgeneSolicitudeDebitOpeningKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getDebitsequence() == null || that.getDebitsequence() == null){ + return false; + } + if (! this.getDebitsequence().equals(that.getDebitsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeDebitOpeningKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getDebitsequence() == null ? 0 : this.getDebitsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallCharges.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallCharges.java new file mode 100644 index 0000000..b046cc9 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallCharges.java @@ -0,0 +1,242 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDEINSTALLCHARGES*/ +@Entity(name="TgeneSolicitudeInstallCharges") +@Table(name="TGENESOLICITUDEINSTALLCHARGES") +public class TgeneSolicitudeInstallCharges extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeInstallCharges +*/ +@EmbeddedId +private TgeneSolicitudeInstallChargesKey pk; +@Column(name="BASEAMOUNTBALANCETYPE", nullable=true) + +/** +* Tipo de saldo del cual se toma el monto para calcular el tarifario. +*/ +private String baseamountbalancetype; + +@Column(name="BASEAMOUNTBALANCEGROUP", nullable=true) + +/** +* Grupo de balance del tipo de saldo del cual se toma el monto para calcular el tarifario. +*/ +private String baseamountbalancegroup; + +@Column(name="CALCULATEORDER", nullable=true) + +/** +* Orden de calculo de los cargos. +*/ +private Integer calculateorder; + +@Column(name="NEGOTIABLE", nullable=true) + +/** +* Indica si la tasa se puede negociar con el cliente el valor y las condiciones del cargo +*/ +private String negotiable; + +@Column(name="VALUE", nullable=true) + +/** +* Valor del cargo en la moneda de la operacion +*/ +private BigDecimal value; + +/**Contructor por defecto*/ +public TgeneSolicitudeInstallCharges(){ +} +/**Contructor de TgeneSolicitudeInstallCharges +@param pPk Clave Primaria del entity +*/ +public TgeneSolicitudeInstallCharges(TgeneSolicitudeInstallChargesKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSolicitudeInstallCharges +*/ +public static TgeneSolicitudeInstallCharges find(EntityManager pEntityManager,TgeneSolicitudeInstallChargesKey pKey) throws Exception{ + TgeneSolicitudeInstallCharges obj = pEntityManager.find(TgeneSolicitudeInstallCharges.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSolicitudeInstallCharges +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeInstallCharges +*/ +public TgeneSolicitudeInstallChargesKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeInstallCharges +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeInstallCharges +*/ +public void setPk(TgeneSolicitudeInstallChargesKey pPk){ + pk=pPk; +} +/**Obtiene el valor de baseamountbalancetype +@return valor de baseamountbalancetype*/ +public String getBaseamountbalancetype(){ + return baseamountbalancetype; +} +/**Fija el valor de baseamountbalancetype +@param pBaseamountbalancetype nuevo Valor de baseamountbalancetype*/ +public void setBaseamountbalancetype(String pBaseamountbalancetype){ + baseamountbalancetype=pBaseamountbalancetype; +} + +/**Obtiene el valor de baseamountbalancegroup +@return valor de baseamountbalancegroup*/ +public String getBaseamountbalancegroup(){ + return baseamountbalancegroup; +} +/**Fija el valor de baseamountbalancegroup +@param pBaseamountbalancegroup nuevo Valor de baseamountbalancegroup*/ +public void setBaseamountbalancegroup(String pBaseamountbalancegroup){ + baseamountbalancegroup=pBaseamountbalancegroup; +} + +/**Obtiene el valor de calculateorder +@return valor de calculateorder*/ +public Integer getCalculateorder(){ + return calculateorder; +} +/**Fija el valor de calculateorder +@param pCalculateorder nuevo Valor de calculateorder*/ +public void setCalculateorder(Integer pCalculateorder){ + calculateorder=pCalculateorder; +} + +/**Obtiene el valor de negotiable +@return valor de negotiable*/ +public String getNegotiable(){ + return negotiable; +} +/**Fija el valor de negotiable +@param pNegotiable nuevo Valor de negotiable*/ +public void setNegotiable(String pNegotiable){ + negotiable=pNegotiable; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeInstallCharges))return false; + TgeneSolicitudeInstallCharges that = (TgeneSolicitudeInstallCharges) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeInstallCharges +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSolicitudeInstallCharges +*/ +public Object createInstance(){ + TgeneSolicitudeInstallCharges instance=new TgeneSolicitudeInstallCharges(); + instance.setPk(new TgeneSolicitudeInstallChargesKey()); + return instance; +} +/**Clona la entidad TgeneSolicitudeInstallCharges +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeInstallCharges p=(TgeneSolicitudeInstallCharges)this.clone(); + p.setPk((TgeneSolicitudeInstallChargesKey)this.pk.cloneMe()); + return p; +} + + //Metodos manuales. + /**Sentencia que devuelve la definicion de cargos a adicionar a la tabla de amortizacion.*/ + private static final String HQL_SOLICITUDE_INSTALLMENT_CHARGES = + "from TgeneSolicitudeInstallCharges t " + + " where t.pk.solicitudnumber = :solicitudnumber " + + " and t.pk.solicitudsequence = :solicitudsequence "; + + /** + * Metodo que entrega una lista con los cargos a adicionar a la tabla de amortizacion para una solicitud. + * @param pSolicitudeNumber Numero de solicitud. + * @param pSolicitudeSequence Secuencia interna de la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager,String pSolicitudeNumber, + Integer pSolicitudeSequence) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_SOLICITUDE_INSTALLMENT_CHARGES); + qry.setParameter("solicitudnumber", pSolicitudeNumber); + qry.setParameter("solicitudsequence", pSolicitudeSequence); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallChargesKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallChargesKey.java new file mode 100644 index 0000000..f524d43 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallChargesKey.java @@ -0,0 +1,313 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDEINSTALLCHARGES*/ +@Embeddable +public class TgeneSolicitudeInstallChargesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda de la cuenta +*/ +private String currencycode; + +/**Contructor por defecto*/ +public TgeneSolicitudeInstallChargesKey(){} +/**Contructor de TgeneSolicitudeInstallChargesKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pBalancetype Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pStatuscode Estatus de cuenta +@param pCurrencycode Codigo de moneda de la cuenta +*/ +public TgeneSolicitudeInstallChargesKey(String pSolicitudnumber,Integer pSolicitudsequence,String pBalancetype,String pBalancegroup,String pModulecode,String pProductcode,String pSubproductcode,String pStatuscode,String pCurrencycode){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + balancetype=pBalancetype; + balancegroup=pBalancegroup; + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + statuscode=pStatuscode; + currencycode=pCurrencycode; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Implementacin de la comparacin de TgeneSolicitudeInstallChargesKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeInstallChargesKey))return false; + TgeneSolicitudeInstallChargesKey that = (TgeneSolicitudeInstallChargesKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeInstallChargesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallRates.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallRates.java new file mode 100644 index 0000000..8d64682 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallRates.java @@ -0,0 +1,641 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDEINSTALLRATES */ +@Entity(name = "TgeneSolicitudeInstallRates") +@Table(name = "TGENESOLICITUDEINSTALLRATES") +public class TgeneSolicitudeInstallRates extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneSolicitudeInstallRates + */ + @EmbeddedId + private TgeneSolicitudeInstallRatesKey pk; + + @Column(name = "BASERATECATALOG", nullable = true) + /** + * Codigo de catalogo de tasas base, BCE tasa banco central + */ + private String baseratecatalog; + + @Column(name = "BASERATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo BASERATE + */ + private String baseratecatalogcode; + + @Column(name = "PRINCIPALBALANCETYPE", nullable = true) + /** + * Cdigo de tipo de capital sobre el cual se aplica una tasa y se calcula un valor a provisionar + */ + private String principalbalancetype; + + @Column(name = "PRINCIPALBALANCEGROUP", nullable = true) + /** + * Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor + */ + private String principalbalancegroup; + + @Column(name = "NEGOTIABLE", nullable = true) + /** + * Indica si la tasa se puede negociar con el cliente + */ + private String negotiable; + + @Column(name = "BASERATE", nullable = true) + /** + * Tasa base + */ + private BigDecimal baserate; + + @Column(name = "MARGIN", nullable = true) + /** + * Margen a aplicar dado el operador + */ + private BigDecimal margin; + + @Column(name = "OPERATOR", nullable = true) + /** + * Operador a aplicar sobre la tasa base, +, - , % + */ + private String operator; + + @Column(name = "RATE", nullable = true) + /** + * Tasa total con la cual se calcula provisiones y tabla de pagos + */ + private BigDecimal rate; + + @Column(name = "READJUSTMENTOPERATOR", nullable = true) + /** + * Operador que se utilizara el momento del reajuste + */ + private String readjustmentoperator; + + @Column(name = "READJUSTMENTMARGIN", nullable = true) + /** + * Margen a aplicar en el reajuste + */ + private BigDecimal readjustmentmargin; + + @Column(name = "EFFECTIVERATE", nullable = true) + /** + * Tasa Efectiva + */ + private BigDecimal effectiverate; + + @Column(name = "ISNOMINALRATE", nullable = true) + /** + * Y, Indica que la defincion de la tasa base es efectiva, en este caso se calcula la tasa nominal, N la tasa base es nominal en este caso se calcula la tasa efectiva. + */ + private String isnominalrate; + + @Column(name = "READJUSTBASERATECATALOG", nullable = true) + /** + * Codigo de catalogo de tasas base de reajuste, BCE tasa banco central + */ + private String readjustbaseratecatalog; + + @Column(name = "READJUSTBASERATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo BASERATE + */ + private String readjustbaseratecatalogcode; + + @Column(name = "MAXBASERATECATALOG", nullable = true) + /** + * Codigo de catalogo de tasas base maxima, BCE tasa banco central + */ + private String maxbaseratecatalog; + + @Column(name = "MAXBASERATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo BASERATE + */ + private String maxbaseratecatalogcode; + + @Column(name = "MINRATE", nullable = true) + /** + * Minimo permitido en la negociacion del prestamo + */ + private BigDecimal minrate; + + @Column(name = "MAXRATE", nullable = true) + /** + * Maximo permitido en la negociacion del prestamo + */ + private BigDecimal maxrate; + + /** Contructor por defecto */ + public TgeneSolicitudeInstallRates() { + } + + /** + * Contructor de TgeneSolicitudeInstallRates + * + * @param pPk Clave Primaria del entity + */ + public TgeneSolicitudeInstallRates(TgeneSolicitudeInstallRatesKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSolicitudeInstallRates + */ + public static TgeneSolicitudeInstallRates find(EntityManager pEntityManager, TgeneSolicitudeInstallRatesKey pKey) throws Exception { + TgeneSolicitudeInstallRates obj = pEntityManager.find(TgeneSolicitudeInstallRates.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneSolicitudeInstallRates + * + * @return El objeto que referencia a la Clave primaria de TgeneSolicitudeInstallRates + */ + public TgeneSolicitudeInstallRatesKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneSolicitudeInstallRates + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeInstallRates + */ + public void setPk(TgeneSolicitudeInstallRatesKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de baseratecatalog + * + * @return valor de baseratecatalog + */ + public String getBaseratecatalog() { + return this.baseratecatalog; + } + + /** + * Fija el valor de baseratecatalog + * + * @param pBaseratecatalog nuevo Valor de baseratecatalog + */ + public void setBaseratecatalog(String pBaseratecatalog) { + this.baseratecatalog = pBaseratecatalog; + } + + /** + * Obtiene el valor de baseratecatalogcode + * + * @return valor de baseratecatalogcode + */ + public String getBaseratecatalogcode() { + return this.baseratecatalogcode; + } + + /** + * Fija el valor de baseratecatalogcode + * + * @param pBaseratecatalogcode nuevo Valor de baseratecatalogcode + */ + public void setBaseratecatalogcode(String pBaseratecatalogcode) { + this.baseratecatalogcode = pBaseratecatalogcode; + } + + /** + * Obtiene el valor de principalbalancetype + * + * @return valor de principalbalancetype + */ + public String getPrincipalbalancetype() { + return this.principalbalancetype; + } + + /** + * Fija el valor de principalbalancetype + * + * @param pPrincipalbalancetype nuevo Valor de principalbalancetype + */ + public void setPrincipalbalancetype(String pPrincipalbalancetype) { + this.principalbalancetype = pPrincipalbalancetype; + } + + /** + * Obtiene el valor de principalbalancegroup + * + * @return valor de principalbalancegroup + */ + public String getPrincipalbalancegroup() { + return this.principalbalancegroup; + } + + /** + * Fija el valor de principalbalancegroup + * + * @param pPrincipalbalancegroup nuevo Valor de principalbalancegroup + */ + public void setPrincipalbalancegroup(String pPrincipalbalancegroup) { + this.principalbalancegroup = pPrincipalbalancegroup; + } + + /** + * Obtiene el valor de negotiable + * + * @return valor de negotiable + */ + public String getNegotiable() { + return this.negotiable; + } + + /** + * Fija el valor de negotiable + * + * @param pNegotiable nuevo Valor de negotiable + */ + public void setNegotiable(String pNegotiable) { + this.negotiable = pNegotiable; + } + + /** + * Obtiene el valor de baserate + * + * @return valor de baserate + */ + public BigDecimal getBaserate() { + return this.baserate; + } + + /** + * Fija el valor de baserate + * + * @param pBaserate nuevo Valor de baserate + */ + public void setBaserate(BigDecimal pBaserate) { + this.baserate = pBaserate; + } + + /** + * Obtiene el valor de margin + * + * @return valor de margin + */ + public BigDecimal getMargin() { + return this.margin; + } + + /** + * Fija el valor de margin + * + * @param pMargin nuevo Valor de margin + */ + public void setMargin(BigDecimal pMargin) { + this.margin = pMargin; + } + + /** + * Obtiene el valor de operator + * + * @return valor de operator + */ + public String getOperator() { + return this.operator; + } + + /** + * Fija el valor de operator + * + * @param pOperator nuevo Valor de operator + */ + public void setOperator(String pOperator) { + this.operator = pOperator; + } + + /** + * Obtiene el valor de rate + * + * @return valor de rate + */ + public BigDecimal getRate() { + return this.rate; + } + + /** + * Fija el valor de rate + * + * @param pRate nuevo Valor de rate + */ + public void setRate(BigDecimal pRate) { + this.rate = pRate; + } + + /** + * Obtiene el valor de readjustmentoperator + * + * @return valor de readjustmentoperator + */ + public String getReadjustmentoperator() { + return this.readjustmentoperator; + } + + /** + * Fija el valor de readjustmentoperator + * + * @param pReadjustmentoperator nuevo Valor de readjustmentoperator + */ + public void setReadjustmentoperator(String pReadjustmentoperator) { + this.readjustmentoperator = pReadjustmentoperator; + } + + /** + * Obtiene el valor de readjustmentmargin + * + * @return valor de readjustmentmargin + */ + public BigDecimal getReadjustmentmargin() { + return this.readjustmentmargin; + } + + /** + * Fija el valor de readjustmentmargin + * + * @param pReadjustmentmargin nuevo Valor de readjustmentmargin + */ + public void setReadjustmentmargin(BigDecimal pReadjustmentmargin) { + this.readjustmentmargin = pReadjustmentmargin; + } + + /** + * Obtiene el valor de effectiverate + * + * @return valor de effectiverate + */ + public BigDecimal getEffectiverate() { + return this.effectiverate; + } + + /** + * Fija el valor de effectiverate + * + * @param pEffectiverate nuevo Valor de effectiverate + */ + public void setEffectiverate(BigDecimal pEffectiverate) { + this.effectiverate = pEffectiverate; + } + + /** + * Obtiene el valor de isnominalrate + * + * @return valor de isnominalrate + */ + public String getIsnominalrate() { + return this.isnominalrate; + } + + /** + * Fija el valor de isnominalrate + * + * @param pIsnominalrate nuevo Valor de isnominalrate + */ + public void setIsnominalrate(String pIsnominalrate) { + this.isnominalrate = pIsnominalrate; + } + + /** + * Obtiene el valor de readjustbaseratecatalog + * + * @return valor de readjustbaseratecatalog + */ + public String getReadjustbaseratecatalog() { + return this.readjustbaseratecatalog; + } + + /** + * Fija el valor de readjustbaseratecatalog + * + * @param pReadjustbaseratecatalog nuevo Valor de readjustbaseratecatalog + */ + public void setReadjustbaseratecatalog(String pReadjustbaseratecatalog) { + this.readjustbaseratecatalog = pReadjustbaseratecatalog; + } + + /** + * Obtiene el valor de readjustbaseratecatalogcode + * + * @return valor de readjustbaseratecatalogcode + */ + public String getReadjustbaseratecatalogcode() { + return this.readjustbaseratecatalogcode; + } + + /** + * Fija el valor de readjustbaseratecatalogcode + * + * @param pReadjustbaseratecatalogcode nuevo Valor de readjustbaseratecatalogcode + */ + public void setReadjustbaseratecatalogcode(String pReadjustbaseratecatalogcode) { + this.readjustbaseratecatalogcode = pReadjustbaseratecatalogcode; + } + + /** + * Obtiene el valor de maxbaseratecatalog + * + * @return valor de maxbaseratecatalog + */ + public String getMaxbaseratecatalog() { + return this.maxbaseratecatalog; + } + + /** + * Fija el valor de maxbaseratecatalog + * + * @param pMaxbaseratecatalog nuevo Valor de maxbaseratecatalog + */ + public void setMaxbaseratecatalog(String pMaxbaseratecatalog) { + this.maxbaseratecatalog = pMaxbaseratecatalog; + } + + /** + * Obtiene el valor de maxbaseratecatalogcode + * + * @return valor de maxbaseratecatalogcode + */ + public String getMaxbaseratecatalogcode() { + return this.maxbaseratecatalogcode; + } + + /** + * Fija el valor de maxbaseratecatalogcode + * + * @param pMaxbaseratecatalogcode nuevo Valor de maxbaseratecatalogcode + */ + public void setMaxbaseratecatalogcode(String pMaxbaseratecatalogcode) { + this.maxbaseratecatalogcode = pMaxbaseratecatalogcode; + } + + /** + * Obtiene el valor de minrate + * + * @return valor de minrate + */ + public BigDecimal getMinrate() { + return this.minrate; + } + + /** + * Fija el valor de minrate + * + * @param pMinrate nuevo Valor de minrate + */ + public void setMinrate(BigDecimal pMinrate) { + this.minrate = pMinrate; + } + + /** + * Obtiene el valor de maxrate + * + * @return valor de maxrate + */ + public BigDecimal getMaxrate() { + return this.maxrate; + } + + /** + * Fija el valor de maxrate + * + * @param pMaxrate nuevo Valor de maxrate + */ + public void setMaxrate(BigDecimal pMaxrate) { + this.maxrate = pMaxrate; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneSolicitudeInstallRates)) { + return false; + } + TgeneSolicitudeInstallRates that = (TgeneSolicitudeInstallRates) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneSolicitudeInstallRates + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneSolicitudeInstallRates */ + @Override + public Object createInstance() { + TgeneSolicitudeInstallRates instance = new TgeneSolicitudeInstallRates(); + instance.setPk(new TgeneSolicitudeInstallRatesKey()); + return instance; + } + + /** + * Clona la entidad TgeneSolicitudeInstallRates + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneSolicitudeInstallRates p = (TgeneSolicitudeInstallRates) this.clone(); + p.setPk((TgeneSolicitudeInstallRatesKey) this.pk.cloneMe()); + return p; + } + + // Metodos manuales. + /** Sentencia que devuelve la definicion de valores a provisionar asociados de una solicitud. */ + private static final String HQL_SOLICITUDE_INSTALLMENT_RATES = "from TgeneSolicitudeInstallRates tsolinstrate " + + " where tsolinstrate.pk.solicitudnumber = :solicitudnumber " + " and tsolinstrate.pk.solicitudsequence = :solicitudsequence "; + + /** + * Metodo que entrega una lista con los tipos de saldos a calcular tabla de amortizacion para una solicitud. + * + * @param pSolicitudeNumber Numero de solicitud. + * @param pSolicitudeSequence Secuencia interna de la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pSolicitudeNumber, Integer pSolicitudeSequence) + throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(TgeneSolicitudeInstallRates.HQL_SOLICITUDE_INSTALLMENT_RATES); + qry.setParameter("solicitudnumber", pSolicitudeNumber); + qry.setParameter("solicitudsequence", pSolicitudeSequence); + lObjects = qry.getResultList(); + return lObjects; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallRatesKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallRatesKey.java new file mode 100644 index 0000000..67f6dfc --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallRatesKey.java @@ -0,0 +1,286 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDEINSTALLRATES*/ +@Embeddable +public class TgeneSolicitudeInstallRatesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="INTERESTBALANCETYPE", nullable=false,updatable=false) + +/** +* Codigo de tipo de saldo que provisiona en la tabla de cuotas. +*/ +private String interestbalancetype; + +@Column(name="INTERESTBALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String interestbalancegroup; + +/**Contructor por defecto*/ +public TgeneSolicitudeInstallRatesKey(){} +/**Contructor de TgeneSolicitudeInstallRatesKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pCurrencycode Codigo de moneda +@param pInterestbalancetype Codigo de tipo de saldo que provisiona en la tabla de cuotas. +@param pInterestbalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +public TgeneSolicitudeInstallRatesKey(String pSolicitudnumber,Integer pSolicitudsequence,String pModulecode,String pProductcode,String pSubproductcode,String pCurrencycode,String pInterestbalancetype,String pInterestbalancegroup){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + currencycode=pCurrencycode; + interestbalancetype=pInterestbalancetype; + interestbalancegroup=pInterestbalancegroup; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de interestbalancetype +@return valor de interestbalancetype*/ +public String getInterestbalancetype(){ + return interestbalancetype; +} +/**Fija el valor de interestbalancetype +@param pInterestbalancetype nuevo Valor de interestbalancetype*/ +public void setInterestbalancetype(String pInterestbalancetype){ + interestbalancetype=pInterestbalancetype; +} + +/**Obtiene el valor de interestbalancegroup +@return valor de interestbalancegroup*/ +public String getInterestbalancegroup(){ + return interestbalancegroup; +} +/**Fija el valor de interestbalancegroup +@param pInterestbalancegroup nuevo Valor de interestbalancegroup*/ +public void setInterestbalancegroup(String pInterestbalancegroup){ + interestbalancegroup=pInterestbalancegroup; +} + +/**Implementacion de la comparacion de TgeneSolicitudeInstallRatesKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeInstallRatesKey))return false; + TgeneSolicitudeInstallRatesKey that = (TgeneSolicitudeInstallRatesKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getInterestbalancetype() == null || that.getInterestbalancetype() == null){ + return false; + } + if (! this.getInterestbalancetype().equals(that.getInterestbalancetype())){ + return false; + } + if (this.getInterestbalancegroup() == null || that.getInterestbalancegroup() == null){ + return false; + } + if (! this.getInterestbalancegroup().equals(that.getInterestbalancegroup())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneSolicitudeInstallRatesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getInterestbalancetype() == null ? 0 : this.getInterestbalancetype().hashCode()); + result = result * 37 + (this.getInterestbalancegroup() == null ? 0 : this.getInterestbalancegroup().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeKey.java new file mode 100644 index 0000000..5e6ba12 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeKey.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pgeneral.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDE*/ +@Embeddable +public class TgeneSolicitudeKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro de solicitud +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TgeneSolicitudeKey(){} +/**Contructor de TgeneSolicitudeKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pDateto Fecha hasta la cual esta vigente el registro de solicitud +*/ +public TgeneSolicitudeKey(String pSolicitudnumber,Integer pSolicitudsequence,Timestamp pDateto){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + dateto=pDateto; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacion de la comparacion de TgeneSolicitudeKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeKey))return false; + TgeneSolicitudeKey that = (TgeneSolicitudeKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneSolicitudeKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeLiquidation.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeLiquidation.java new file mode 100644 index 0000000..0577441 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeLiquidation.java @@ -0,0 +1,333 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDELIQUIDATION*/ +@Entity(name="TgeneSolicitudeLiquidation") +@Table(name="TGENESOLICITUDELIQUIDATION") +public class TgeneSolicitudeLiquidation extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeLiquidation +*/ +@EmbeddedId +private TgeneSolicitudeLiquidationKey pk; +@Column(name="BASEAMOUNTBALANCETYPE", nullable=true) + +/** +* Tipo de saldo del cual se toma el monto para calcular el tarifario. +*/ +private String baseamountbalancetype; + +@Column(name="BASEAMOUNTBALANCEGROUP", nullable=true) + +/** +* Grupo de balance del tipo de saldo del cual se toma el monto para calcular el tarifario. +*/ +private String baseamountbalancegroup; + +@Column(name="CALCULATEORDER", nullable=true) + +/** +* CALCULATEORDER +*/ +private Integer calculateorder; + +@Column(name="NEGOTIABLE", nullable=true) + +/** +* Indica si la tasa se puede negociar con el cliente el valor y las condiciones del cargo +*/ +private String negotiable; + +@Column(name="INCREASE", nullable=true) + +/** +* Indica que incrementa el valor de capital con el cual se genera la tabla de pagos +*/ +private String increase; + +@Column(name="DECREASE", nullable=true) + +/** +* Indica que disminuye el valor de capital con el cual se genera la tabla de pagos +*/ +private String decrease; + +@Column(name="DECREASEDISBURSEMENT", nullable=true) + +/** +* Indica que el valor del cargo se descuenta del monto a entregar al cliente +*/ +private String decreasedisbursement; + +@Column(name="CASH", nullable=true) + +/** +* Indica que el valor se cobra en efectivo. +*/ +private String cash; + +@Column(name="DEBITACCOUNT", nullable=true) + +/** +* Indica que el valor se cobra con debito a una cuneta, esta puede ser cuenta contable o cuenta a la vista +*/ +private String debitaccount; + +@Column(name="VALUE", nullable=true) + +/** +* Valor del cargo en la moneda de la operacion +*/ +private BigDecimal value; + +/**Contructor por defecto*/ +public TgeneSolicitudeLiquidation(){ +} +/**Contructor de TgeneSolicitudeLiquidation +@param pPk Clave Primaria del entity +*/ +public TgeneSolicitudeLiquidation(TgeneSolicitudeLiquidationKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSolicitudeLiquidation +*/ +public static TgeneSolicitudeLiquidation find(EntityManager pEntityManager,TgeneSolicitudeLiquidationKey pKey) throws Exception{ + TgeneSolicitudeLiquidation obj = pEntityManager.find(TgeneSolicitudeLiquidation.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSolicitudeLiquidation +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeLiquidation +*/ +public TgeneSolicitudeLiquidationKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeLiquidation +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeLiquidation +*/ +public void setPk(TgeneSolicitudeLiquidationKey pPk){ + pk=pPk; +} +/**Obtiene el valor de baseamountbalancetype +@return valor de baseamountbalancetype*/ +public String getBaseamountbalancetype(){ + return baseamountbalancetype; +} +/**Fija el valor de baseamountbalancetype +@param pBaseamountbalancetype nuevo Valor de baseamountbalancetype*/ +public void setBaseamountbalancetype(String pBaseamountbalancetype){ + baseamountbalancetype=pBaseamountbalancetype; +} + +/**Obtiene el valor de baseamountbalancegroup +@return valor de baseamountbalancegroup*/ +public String getBaseamountbalancegroup(){ + return baseamountbalancegroup; +} +/**Fija el valor de baseamountbalancegroup +@param pBaseamountbalancegroup nuevo Valor de baseamountbalancegroup*/ +public void setBaseamountbalancegroup(String pBaseamountbalancegroup){ + baseamountbalancegroup=pBaseamountbalancegroup; +} + +/**Obtiene el valor de calculateorder +@return valor de calculateorder*/ +public Integer getCalculateorder(){ + return calculateorder; +} +/**Fija el valor de calculateorder +@param pCalculateorder nuevo Valor de calculateorder*/ +public void setCalculateorder(Integer pCalculateorder){ + calculateorder=pCalculateorder; +} + +/**Obtiene el valor de negotiable +@return valor de negotiable*/ +public String getNegotiable(){ + return negotiable; +} +/**Fija el valor de negotiable +@param pNegotiable nuevo Valor de negotiable*/ +public void setNegotiable(String pNegotiable){ + negotiable=pNegotiable; +} + +/**Obtiene el valor de increase +@return valor de increase*/ +public String getIncrease(){ + return increase; +} +/**Fija el valor de increase +@param pIncrease nuevo Valor de increase*/ +public void setIncrease(String pIncrease){ + increase=pIncrease; +} + +/**Obtiene el valor de decrease +@return valor de decrease*/ +public String getDecrease(){ + return decrease; +} +/**Fija el valor de decrease +@param pDecrease nuevo Valor de decrease*/ +public void setDecrease(String pDecrease){ + decrease=pDecrease; +} + +/**Obtiene el valor de decreasedisbursement +@return valor de decreasedisbursement*/ +public String getDecreasedisbursement(){ + return decreasedisbursement; +} +/**Fija el valor de decreasedisbursement +@param pDecreasedisbursement nuevo Valor de decreasedisbursement*/ +public void setDecreasedisbursement(String pDecreasedisbursement){ + decreasedisbursement=pDecreasedisbursement; +} + +/**Obtiene el valor de cash +@return valor de cash*/ +public String getCash(){ + return cash; +} +/**Fija el valor de cash +@param pCash nuevo Valor de cash*/ +public void setCash(String pCash){ + cash=pCash; +} + +/**Obtiene el valor de debitaccount +@return valor de debitaccount*/ +public String getDebitaccount(){ + return debitaccount; +} +/**Fija el valor de debitaccount +@param pDebitaccount nuevo Valor de debitaccount*/ +public void setDebitaccount(String pDebitaccount){ + debitaccount=pDebitaccount; +} + +/**Obtiene el valor de value +@return valor de value*/ +public BigDecimal getValue(){ + return value; +} +/**Fija el valor de value +@param pValue nuevo Valor de value*/ +public void setValue(BigDecimal pValue){ + value=pValue; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeLiquidation))return false; + TgeneSolicitudeLiquidation that = (TgeneSolicitudeLiquidation) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeLiquidation +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSolicitudeLiquidation +*/ +public Object createInstance(){ + TgeneSolicitudeLiquidation instance=new TgeneSolicitudeLiquidation(); + instance.setPk(new TgeneSolicitudeLiquidationKey()); + return instance; +} +/**Clona la entidad TgeneSolicitudeLiquidation +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeLiquidation p=(TgeneSolicitudeLiquidation)this.clone(); + p.setPk((TgeneSolicitudeLiquidationKey)this.pk.cloneMe()); + return p; +} + + //Metodos manuales. + /**Sentencia que devuelve uan lista con los valores a entregar al cliente asociados a una solicitud.*/ + private static final String HQL_SOLICITUDE_LIQUIDATION = + " from TgeneSolicitudeLiquidation t " + + " where t.pk.solicitudnumber = :solicitudnumber "+ + " and t.pk.solicitudsequence = :solicitudsequence "; + + /** + * Metodo que entrega una lista con los cargos de liquidacion de una solicitud. + * @param pSolicitudNumber Numero de solicitud. + * @param pSolicitudSequence Secuencia dentro de la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, + String pSolicitudNumber,Integer pSolicitudSequence) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_SOLICITUDE_LIQUIDATION); + qry.setParameter("solicitudnumber", pSolicitudNumber); + qry.setParameter("solicitudsequence", pSolicitudSequence); + lObjects = qry.getResultList(); + return lObjects; + } + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeLiquidationKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeLiquidationKey.java new file mode 100644 index 0000000..f3adb5c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeLiquidationKey.java @@ -0,0 +1,313 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDELIQUIDATION*/ +@Embeddable +public class TgeneSolicitudeLiquidationKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. de valores a cobrar en la liquidacion de una operacion +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +/**Contructor por defecto*/ +public TgeneSolicitudeLiquidationKey(){} +/**Contructor de TgeneSolicitudeLiquidationKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pStatuscode Estatus de cuenta +@param pCurrencycode Codigo de moneda +@param pBalancetype Cdigo de tipo de saldo. de valores a cobrar en la liquidacion de una operacion +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +public TgeneSolicitudeLiquidationKey(String pSolicitudnumber,Integer pSolicitudsequence,String pModulecode,String pProductcode,String pSubproductcode,String pStatuscode,String pCurrencycode,String pBalancetype,String pBalancegroup){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + statuscode=pStatuscode; + currencycode=pCurrencycode; + balancetype=pBalancetype; + balancegroup=pBalancegroup; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Implementacin de la comparacin de TgeneSolicitudeLiquidationKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeLiquidationKey))return false; + TgeneSolicitudeLiquidationKey that = (TgeneSolicitudeLiquidationKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeLiquidationKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeNumber.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeNumber.java new file mode 100644 index 0000000..124a09c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeNumber.java @@ -0,0 +1,121 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDENUMBER*/ +@Entity(name="TgeneSolicitudeNumber") +@Table(name="TGENESOLICITUDENUMBER") +public class TgeneSolicitudeNumber extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeNumber +*/ +@EmbeddedId +private TgeneSolicitudeNumberKey pk; +/**Contructor por defecto*/ +public TgeneSolicitudeNumber(){ +} +/**Contructor de TgeneSolicitudeNumber +@param pPk Clave Primaria del entity +*/ +public TgeneSolicitudeNumber(TgeneSolicitudeNumberKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSolicitudeNumber +*/ +public static TgeneSolicitudeNumber find(EntityManager pEntityManager,TgeneSolicitudeNumberKey pKey) throws Exception{ + TgeneSolicitudeNumber obj = pEntityManager.find(TgeneSolicitudeNumber.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSolicitudeNumber +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeNumber +*/ +public TgeneSolicitudeNumberKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeNumber +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeNumber +*/ +public void setPk(TgeneSolicitudeNumberKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeNumber))return false; + TgeneSolicitudeNumber that = (TgeneSolicitudeNumber) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeNumber +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSolicitudeNumber +*/ +public Object createInstance(){ + TgeneSolicitudeNumber instance=new TgeneSolicitudeNumber(); + instance.setPk(new TgeneSolicitudeNumberKey()); + return instance; +} +/**Clona la entidad TgeneSolicitudeNumber +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeNumber p=(TgeneSolicitudeNumber)this.clone(); + p.setPk((TgeneSolicitudeNumberKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeNumberKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeNumberKey.java new file mode 100644 index 0000000..c2f0197 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeNumberKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDENUMBER*/ +@Embeddable +public class TgeneSolicitudeNumberKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +/**Contructor por defecto*/ +public TgeneSolicitudeNumberKey(){} +/**Contructor de TgeneSolicitudeNumberKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +*/ +public TgeneSolicitudeNumberKey(String pSolicitudnumber,Integer pSolicitudsequence){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Implementacin de la comparacin de TgeneSolicitudeNumberKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeNumberKey))return false; + TgeneSolicitudeNumberKey that = (TgeneSolicitudeNumberKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeNumberKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeRelationship.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeRelationship.java new file mode 100644 index 0000000..dea174d --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeRelationship.java @@ -0,0 +1,294 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.persistence.commondb.exception.CommondbException; + +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDERELATIONSHIP*/ +@Entity(name="TgeneSolicitudeRelationship") +@Table(name="TGENESOLICITUDERELATIONSHIP") +public class TgeneSolicitudeRelationship extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeRelationship +*/ +@EmbeddedId +private TgeneSolicitudeRelationshipKey pk; +@Column(name="MODULECODE", nullable=true) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="RELATIONSHIPCODE", nullable=true) + +/** +* Codigo de relacion de la cuenta con el cliente +*/ +private String relationshipcode; + +@Column(name="ISPRINCIPAL", nullable=true) + +/** +* Indica si el codigo de relacion es principal, en este caso el codigo de cliente se asocia a la tabla tgeneaccount +*/ +private String isprincipal; + +@Column(name="PRIORITY", nullable=true) + +/** +* Prioridad del cleinte con la solicitud. +*/ +private Integer priority; + +@Column(name="CONDITION", nullable=true) + +/** +* Codicion del cliente con la solicitud. +*/ +private String condition; + +@Column(name="PARTICIPATION", nullable=true) + +/** +* Porcentaje de participacion del cliente con la solicitud. +*/ +private BigDecimal participation; + +@Column(name="ADDRESSNUMBER", nullable=true) + +/** +* Direccion asociada +*/ +private Integer addressnumber; + +@Column(name="PERSONTYPE", nullable=true) + +/** +* 1, Persona natural, 2 Persona Juridica. +*/ +private String persontype; + +/**Contructor por defecto*/ +public TgeneSolicitudeRelationship(){ +} +/**Contructor de TgeneSolicitudeRelationship +@param pPk Clave Primaria del entity +*/ +public TgeneSolicitudeRelationship(TgeneSolicitudeRelationshipKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSolicitudeRelationship +*/ +public static TgeneSolicitudeRelationship find(EntityManager pEntityManager,TgeneSolicitudeRelationshipKey pKey) throws Exception{ + TgeneSolicitudeRelationship obj = pEntityManager.find(TgeneSolicitudeRelationship.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSolicitudeRelationship +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeRelationship +*/ +public TgeneSolicitudeRelationshipKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeRelationship +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeRelationship +*/ +public void setPk(TgeneSolicitudeRelationshipKey pPk){ + pk=pPk; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de relationshipcode +@return valor de relationshipcode*/ +public String getRelationshipcode(){ + return relationshipcode; +} +/**Fija el valor de relationshipcode +@param pRelationshipcode nuevo Valor de relationshipcode*/ +public void setRelationshipcode(String pRelationshipcode){ + relationshipcode=pRelationshipcode; +} + +/**Obtiene el valor de isprincipal +@return valor de isprincipal*/ +public String getIsprincipal(){ + return isprincipal; +} +/**Fija el valor de isprincipal +@param pIsprincipal nuevo Valor de isprincipal*/ +public void setIsprincipal(String pIsprincipal){ + isprincipal=pIsprincipal; +} + +/**Obtiene el valor de priority +@return valor de priority*/ +public Integer getPriority(){ + return priority; +} +/**Fija el valor de priority +@param pPriority nuevo Valor de priority*/ +public void setPriority(Integer pPriority){ + priority=pPriority; +} + +/**Obtiene el valor de condition +@return valor de condition*/ +public String getCondition(){ + return condition; +} +/**Fija el valor de condition +@param pCondition nuevo Valor de condition*/ +public void setCondition(String pCondition){ + condition=pCondition; +} + +/**Obtiene el valor de participation +@return valor de participation*/ +public BigDecimal getParticipation(){ + return participation; +} +/**Fija el valor de participation +@param pParticipation nuevo Valor de participation*/ +public void setParticipation(BigDecimal pParticipation){ + participation=pParticipation; +} + +/**Obtiene el valor de addressnumber +@return valor de addressnumber*/ +public Integer getAddressnumber(){ + return addressnumber; +} +/**Fija el valor de addressnumber +@param pAddressnumber nuevo Valor de addressnumber*/ +public void setAddressnumber(Integer pAddressnumber){ + addressnumber=pAddressnumber; +} + +/**Obtiene el valor de persontype +@return valor de persontype*/ +public String getPersontype(){ + return persontype; +} +/**Fija el valor de persontype +@param pPersontype nuevo Valor de persontype*/ +public void setPersontype(String pPersontype){ + persontype=pPersontype; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeRelationship))return false; + TgeneSolicitudeRelationship that = (TgeneSolicitudeRelationship) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeRelationship +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSolicitudeRelationship +*/ +public Object createInstance(){ + TgeneSolicitudeRelationship instance=new TgeneSolicitudeRelationship(); + instance.setPk(new TgeneSolicitudeRelationshipKey()); + return instance; +} +/**Clona la entidad TgeneSolicitudeRelationship +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeRelationship p=(TgeneSolicitudeRelationship)this.clone(); + p.setPk((TgeneSolicitudeRelationshipKey)this.pk.cloneMe()); + return p; +} + + //METODOS MANUALES + /** Sentencia que devuelve las excepciones de una solicitud. */ + private static final String JPQL_SOL_RELATIONSHIP = "from TgeneSolicitudeRelationship solrel " + + " where solrel.pk.solicitudnumber = :solicitudnumber " + " and solrel.pk.solicitudsequence = :solicitudsequence "; + /** + * Entrega una lista de clientes relacionados a la solicitud. + * + * @param pSolicitudenumber Numero de solicitud. + * @param pSolicitudesequence Secuencia interna de la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findBySolicitudeNumber(EntityManager pEntityManager, String pSolicitudenumber, Integer pSolicitudesequence) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(TgeneSolicitudeRelationship.JPQL_SOL_RELATIONSHIP); + qry.setParameter("solicitudnumber", pSolicitudenumber); + qry.setParameter("solicitudsequence", pSolicitudesequence); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeRelationshipKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeRelationshipKey.java new file mode 100644 index 0000000..2079f42 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeRelationshipKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDERELATIONSHIP*/ +@Embeddable +public class TgeneSolicitudeRelationshipKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SOLICITUDNUMBER", nullable=false,updatable=false) + +/** +* Numero de solicitud +*/ +private String solicitudnumber; + +@Column(name="SOLICITUDSEQUENCE", nullable=false,updatable=false) + +/** +* secuencia interna de solicitud +*/ +private Integer solicitudsequence; + +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona +*/ +private Integer personcode; + +/**Contructor por defecto*/ +public TgeneSolicitudeRelationshipKey(){} +/**Contructor de TgeneSolicitudeRelationshipKey +@param pSolicitudnumber Numero de solicitud +@param pSolicitudsequence secuencia interna de solicitud +@param pPersoncode Codigo de persona +*/ +public TgeneSolicitudeRelationshipKey(String pSolicitudnumber,Integer pSolicitudsequence,Integer pPersoncode){ + solicitudnumber=pSolicitudnumber; + solicitudsequence=pSolicitudsequence; + personcode=pPersoncode; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +/**Obtiene el valor de solicitudsequence +@return valor de solicitudsequence*/ +public Integer getSolicitudsequence(){ + return solicitudsequence; +} +/**Fija el valor de solicitudsequence +@param pSolicitudsequence nuevo Valor de solicitudsequence*/ +public void setSolicitudsequence(Integer pSolicitudsequence){ + solicitudsequence=pSolicitudsequence; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Implementacin de la comparacin de TgeneSolicitudeRelationshipKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeRelationshipKey))return false; + TgeneSolicitudeRelationshipKey that = (TgeneSolicitudeRelationshipKey) o; + if (this.getSolicitudnumber() == null || that.getSolicitudnumber() == null){ + return false; + } + if (! this.getSolicitudnumber().equals(that.getSolicitudnumber())){ + return false; + } + if (this.getSolicitudsequence() == null || that.getSolicitudsequence() == null){ + return false; + } + if (! this.getSolicitudsequence().equals(that.getSolicitudsequence())){ + return false; + } + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeRelationshipKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getSolicitudnumber() == null ? 0 : this.getSolicitudnumber().hashCode()); + result = result * 37 + (this.getSolicitudsequence() == null ? 0 : this.getSolicitudsequence().hashCode()); + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeStatus.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeStatus.java new file mode 100644 index 0000000..d0ee7d4 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeStatus.java @@ -0,0 +1,161 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESOLICITUDESTATUS*/ +@Entity(name="TgeneSolicitudeStatus") +@Table(name="TGENESOLICITUDESTATUS") +public class TgeneSolicitudeStatus extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSolicitudeStatus +*/ +@EmbeddedId +private TgeneSolicitudeStatusKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=false) + +/** +* Descripcion del estatus de la solicitud +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneSolicitudeStatus(){ +} +/**Contructor de TgeneSolicitudeStatus +@param pPk Clave Primaria del entity +@param pDescription Descripcion del estatus de la solicitud +*/ +public TgeneSolicitudeStatus(TgeneSolicitudeStatusKey pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSolicitudeStatus +*/ +public static TgeneSolicitudeStatus find(EntityManager pEntityManager,TgeneSolicitudeStatusKey pKey) throws Exception{ + TgeneSolicitudeStatus obj = pEntityManager.find(TgeneSolicitudeStatus.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSolicitudeStatus +@return El objeto que referencia a la Clave primaria de TgeneSolicitudeStatus +*/ +public TgeneSolicitudeStatusKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSolicitudeStatus +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSolicitudeStatus +*/ +public void setPk(TgeneSolicitudeStatusKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSolicitudeStatus))return false; + TgeneSolicitudeStatus that = (TgeneSolicitudeStatus) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSolicitudeStatus +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSolicitudeStatus +*/ +public Object createInstance(){ + TgeneSolicitudeStatus instance=new TgeneSolicitudeStatus(); + instance.setPk(new TgeneSolicitudeStatusKey()); + return instance; +} +/**Clona la entidad TgeneSolicitudeStatus +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSolicitudeStatus p=(TgeneSolicitudeStatus)this.clone(); + p.setPk((TgeneSolicitudeStatusKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeStatusKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeStatusKey.java new file mode 100644 index 0000000..5876792 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneSolicitudeStatusKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESOLICITUDESTATUS*/ +@Embeddable +public class TgeneSolicitudeStatusKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de la solicitud +*/ +private String statuscode; + +/**Contructor por defecto*/ +public TgeneSolicitudeStatusKey(){} +/**Contructor de TgeneSolicitudeStatusKey +@param pModulecode Codigo de modulo +@param pStatuscode Estatus de la solicitud +*/ +public TgeneSolicitudeStatusKey(String pModulecode,String pStatuscode){ + modulecode=pModulecode; + statuscode=pStatuscode; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Implementacin de la comparacin de TgeneSolicitudeStatusKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSolicitudeStatusKey))return false; + TgeneSolicitudeStatusKey that = (TgeneSolicitudeStatusKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSolicitudeStatusKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTechnicalPatrimony.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTechnicalPatrimony.java new file mode 100644 index 0000000..5aef101 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTechnicalPatrimony.java @@ -0,0 +1,182 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETECHNICALPATRIMONY*/ +@Entity(name="TgeneTechnicalPatrimony") +@Table(name="TGENETECHNICALPATRIMONY") +public class TgeneTechnicalPatrimony extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTechnicalPatrimony +*/ +@EmbeddedId +private TgeneTechnicalPatrimonyKey pk; +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="AMOUNT", nullable=true) + +/** +* Monto del patrimonio tcnico +*/ +private BigDecimal amount; + +@Column(name="DATEFROM", nullable=false) + +/** +* Fecha desde la cual esta vigente el registro de datos del prestamo +*/ +private Timestamp datefrom; + +/**Contructor por defecto*/ +public TgeneTechnicalPatrimony(){ +} +/**Contructor de TgeneTechnicalPatrimony +@param pPk Clave Primaria del entity +@param pDatefrom Fecha desde la cual esta vigente el registro de datos del prestamo +*/ +public TgeneTechnicalPatrimony(TgeneTechnicalPatrimonyKey pPk,Timestamp pDatefrom){ + this(); + pk=pPk; + datefrom=pDatefrom; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTechnicalPatrimony +*/ +public static TgeneTechnicalPatrimony find(EntityManager pEntityManager,TgeneTechnicalPatrimonyKey pKey) throws Exception{ + TgeneTechnicalPatrimony obj = pEntityManager.find(TgeneTechnicalPatrimony.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTechnicalPatrimony +@return El objeto que referencia a la Clave primaria de TgeneTechnicalPatrimony +*/ +public TgeneTechnicalPatrimonyKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTechnicalPatrimony +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTechnicalPatrimony +*/ +public void setPk(TgeneTechnicalPatrimonyKey pPk){ + pk=pPk; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de amount +@return valor de amount*/ +public BigDecimal getAmount(){ + return amount; +} +/**Fija el valor de amount +@param pAmount nuevo Valor de amount*/ +public void setAmount(BigDecimal pAmount){ + amount=pAmount; +} + +/**Obtiene el valor de datefrom +@return valor de datefrom*/ +public Timestamp getDatefrom(){ + return datefrom; +} +/**Fija el valor de datefrom +@param pDatefrom nuevo Valor de datefrom*/ +public void setDatefrom(Timestamp pDatefrom){ + datefrom=pDatefrom; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTechnicalPatrimony))return false; + TgeneTechnicalPatrimony that = (TgeneTechnicalPatrimony) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneTechnicalPatrimony +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneTechnicalPatrimony +*/ +public Object createInstance(){ + TgeneTechnicalPatrimony instance=new TgeneTechnicalPatrimony(); + instance.setPk(new TgeneTechnicalPatrimonyKey()); + return instance; +} +/**Clona la entidad TgeneTechnicalPatrimony +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTechnicalPatrimony p=(TgeneTechnicalPatrimony)this.clone(); + p.setPk((TgeneTechnicalPatrimonyKey)this.pk.cloneMe()); + return p; +} +public Object getId() { + return this.pk; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTechnicalPatrimonyKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTechnicalPatrimonyKey.java new file mode 100644 index 0000000..1e7b116 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTechnicalPatrimonyKey.java @@ -0,0 +1,129 @@ +package com.fp.persistence.pgeneral.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETECHNICALPATRIMONY*/ +@Embeddable +public class TgeneTechnicalPatrimonyKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro de datos del prestamo. +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TgeneTechnicalPatrimonyKey(){} +/**Contructor de TgeneTechnicalPatrimonyKey +@param pCompanycode Codigo de compania +@param pDateto Fecha hasta la cual esta vigente el registro de datos del prestamo. +*/ +public TgeneTechnicalPatrimonyKey(Integer pCompanycode,Timestamp pDateto){ + companycode=pCompanycode; + dateto=pDateto; +} +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacion de la comparacion de TgeneTechnicalPatrimonyKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTechnicalPatrimonyKey))return false; + TgeneTechnicalPatrimonyKey that = (TgeneTechnicalPatrimonyKey) o; + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneTechnicalPatrimonyKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerBalance.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerBalance.java new file mode 100644 index 0000000..18a0565 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerBalance.java @@ -0,0 +1,271 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETELLERBALANCE*/ +@Entity(name="TgeneTellerBalance") +@Table(name="TGENETELLERBALANCE") +public class TgeneTellerBalance extends com.fp.dto.AbstractDataBalanceTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTellerBalance +*/ +@EmbeddedId +private TgeneTellerBalanceKey pk; +@Column(name="BALANCE", nullable=true) + +/** +* Saldo de la caja para la fecha de trabajo, usuario y moneda. +*/ +private BigDecimal balance; + +@Column(name="DEBITS", nullable=true) + +/** +* Total de debitos de caja. +*/ +private BigDecimal debits; + +@Column(name="CREDITS", nullable=true) + +/** +* Total de creditos de caja. +*/ +private BigDecimal credits; + +@Column(name="OWNCHECKS", nullable=true) + +/** +* Saldo en cheques propios. +*/ +private BigDecimal ownchecks; + +@Column(name="LOCALCHECKS", nullable=true) + +/** +* Saldo en cheques locales. +*/ +private BigDecimal localchecks; + +@Column(name="REMCHECKS", nullable=true) + +/** +* Saldo en cheques de remesas. +*/ +private BigDecimal remchecks; + +@Column(name="PLACESCHECKS", nullable=true) + +/** +* Saldo en cheques otras plazas. +*/ +private BigDecimal placeschecks; + +@Column(name="ISCLOSED", nullable=true) + +/** +* Y, indica que el cierre de caja ya fue ejecutado y el cajero no puede ejecutar mas transacciones. +*/ +private String isclosed; + +/**Contructor por defecto*/ +public TgeneTellerBalance(){ +} +/**Contructor de TgeneTellerBalance +@param pPk Clave Primaria del entity +*/ +public TgeneTellerBalance(TgeneTellerBalanceKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTellerBalance +*/ +public static TgeneTellerBalance find(EntityManager pEntityManager,TgeneTellerBalanceKey pKey) throws Exception{ + TgeneTellerBalance obj = pEntityManager.find(TgeneTellerBalance.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTellerBalance +@return El objeto que referencia a la Clave primaria de TgeneTellerBalance +*/ +public TgeneTellerBalanceKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTellerBalance +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTellerBalance +*/ +public void setPk(TgeneTellerBalanceKey pPk){ + pk=pPk; +} +/**Obtiene el valor de balance +@return valor de balance*/ +public BigDecimal getBalance(){ + return balance; +} +/**Fija el valor de balance +@param pBalance nuevo Valor de balance*/ +public void setBalance(BigDecimal pBalance){ + balance=pBalance; +} + +/**Obtiene el valor de debits +@return valor de debits*/ +public BigDecimal getDebits(){ + return debits; +} +/**Fija el valor de debits +@param pDebits nuevo Valor de debits*/ +public void setDebits(BigDecimal pDebits){ + debits=pDebits; +} + +/**Obtiene el valor de credits +@return valor de credits*/ +public BigDecimal getCredits(){ + return credits; +} +/**Fija el valor de credits +@param pCredits nuevo Valor de credits*/ +public void setCredits(BigDecimal pCredits){ + credits=pCredits; +} + +/**Obtiene el valor de ownchecks +@return valor de ownchecks*/ +public BigDecimal getOwnchecks(){ + return ownchecks; +} +/**Fija el valor de ownchecks +@param pOwnchecks nuevo Valor de ownchecks*/ +public void setOwnchecks(BigDecimal pOwnchecks){ + ownchecks=pOwnchecks; +} + +/**Obtiene el valor de localchecks +@return valor de localchecks*/ +public BigDecimal getLocalchecks(){ + return localchecks; +} +/**Fija el valor de localchecks +@param pLocalchecks nuevo Valor de localchecks*/ +public void setLocalchecks(BigDecimal pLocalchecks){ + localchecks=pLocalchecks; +} + +/**Obtiene el valor de remchecks +@return valor de remchecks*/ +public BigDecimal getRemchecks(){ + return remchecks; +} +/**Fija el valor de remchecks +@param pRemchecks nuevo Valor de remchecks*/ +public void setRemchecks(BigDecimal pRemchecks){ + remchecks=pRemchecks; +} + +/**Obtiene el valor de placeschecks +@return valor de placeschecks*/ +public BigDecimal getPlaceschecks(){ + return placeschecks; +} +/**Fija el valor de placeschecks +@param pPlaceschecks nuevo Valor de placeschecks*/ +public void setPlaceschecks(BigDecimal pPlaceschecks){ + placeschecks=pPlaceschecks; +} + +/**Obtiene el valor de isclosed +@return valor de isclosed*/ +public String getIsclosed(){ + return isclosed; +} +/**Fija el valor de isclosed +@param pIsclosed nuevo Valor de isclosed*/ +public void setIsclosed(String pIsclosed){ + isclosed=pIsclosed; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTellerBalance))return false; + TgeneTellerBalance that = (TgeneTellerBalance) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTellerBalance +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTellerBalance +*/ +public Object createInstance(){ + TgeneTellerBalance instance=new TgeneTellerBalance(); + instance.setPk(new TgeneTellerBalanceKey()); + return instance; +} +/**Clona la entidad TgeneTellerBalance +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTellerBalance p=(TgeneTellerBalance)this.clone(); + p.setPk((TgeneTellerBalanceKey)this.pk.cloneMe()); + return p; +} + + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerBalanceKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerBalanceKey.java new file mode 100644 index 0000000..01b9b4f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerBalanceKey.java @@ -0,0 +1,152 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENETELLERBALANCE*/ +@Embeddable +public class TgeneTellerBalanceKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="WORKINGDATE", nullable=false,updatable=false) + +/** +* Fecha de trabajo +*/ +private Date workingdate; + +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +/**Contructor por defecto*/ +public TgeneTellerBalanceKey(){} +/**Contructor de TgeneTellerBalanceKey +@param pWorkingdate Fecha de trabajo +@param pUsercode Codigo de usuario +@param pCurrencycode Codigo de moneda +*/ +public TgeneTellerBalanceKey(Date pWorkingdate,String pUsercode,String pCurrencycode){ + workingdate=pWorkingdate; + usercode=pUsercode; + currencycode=pCurrencycode; +} +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Implementacin de la comparacin de TgeneTellerBalanceKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTellerBalanceKey))return false; + TgeneTellerBalanceKey that = (TgeneTellerBalanceKey) o; + if (this.getWorkingdate() == null || that.getWorkingdate() == null){ + return false; + } + if (! this.getWorkingdate().equals(that.getWorkingdate())){ + return false; + } + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTellerBalanceKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getWorkingdate() == null ? 0 : this.getWorkingdate().hashCode()); + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerTransfer.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerTransfer.java new file mode 100644 index 0000000..ccce3b9 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerTransfer.java @@ -0,0 +1,194 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.SQLQuery; +import org.hibernate.Session; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETELLERTRANSFER */ +@Entity(name = "TgeneTellerTransfer") +@Table(name = "TGENETELLERTRANSFER") +public class TgeneTellerTransfer extends com.fp.dto.AbstractDataTransport + implements + Serializable, + HibernateBean, + Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneTellerTransfer + */ + @EmbeddedId + private TgeneTellerTransferKey pk; + /** Contructor por defecto */ + public TgeneTellerTransfer() { + } + /** + * Contructor de TgeneTellerTransfer + * + * @param pPk Clave Primaria del entity + */ + public TgeneTellerTransfer(TgeneTellerTransferKey pPk) { + this(); + pk = pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneTellerTransfer + */ + public static TgeneTellerTransfer find(EntityManager pEntityManager, TgeneTellerTransferKey pKey) throws Exception { + TgeneTellerTransfer obj = pEntityManager.find(TgeneTellerTransfer.class, pKey); + return obj; + } + /** + * Entrega la Clave primaria de TgeneTellerTransfer + * + * @return El objeto que referencia a la Clave primaria de TgeneTellerTransfer + */ + public TgeneTellerTransferKey getPk() { + return pk; + } + /** + * Fija un nuevo valor a la Clave primaria de TgeneTellerTransfer + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneTellerTransfer + */ + public void setPk(TgeneTellerTransferKey pPk) { + pk = pPk; + } + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneTellerTransfer)) + return false; + TgeneTellerTransfer that = (TgeneTellerTransfer) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /** + * Implementacin del metodo hashCode de la la entidad TgeneTellerTransfer + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + /** Implementacin de la creacin de un bean en blanco TgeneTellerTransfer */ + public Object createInstance() { + TgeneTellerTransfer instance = new TgeneTellerTransfer(); + instance.setPk(new TgeneTellerTransferKey()); + return instance; + } + /** + * Clona la entidad TgeneTellerTransfer + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneTellerTransfer p = (TgeneTellerTransfer) this.clone(); + p.setPk((TgeneTellerTransferKey) this.pk.cloneMe()); + return p; + } + //Metodos manuales. + + /**sentencia que elimina TgeneTellerTransfer*/ + private static final String DEL_TRANSF = + " delete from TGENETELLERTRANSFER t " + + " where t.WORKINGDATE = :workingdate " + + " and t.USERCODE = :usercode " + + " and t.TRANSFERNUMBER = :transfernumber"; + + /** + * Elimina un registro de la tabla para el usuario, fecha de trabajo y numero de transferencia. + * @param pEntityManager Referencia la session de la base de datos. + * @param pWorkingdate Fecha de trabajo. + * @param pUser Codigo de usuario. + * @param pTransfernumber Numero de transferencia. + * @throws Exception + */ + public static void delete(EntityManager pEntityManager,Date pWorkingdate,String pUser,Integer pTransfernumber) throws Exception { + //Elimina TgeneTellerTransfer + Session s = (Session)pEntityManager.getDelegate(); + SQLQuery sqldet = s.createSQLQuery(DEL_TRANSF); + sqldet.setDate("workingdate", pWorkingdate); + sqldet.setString("usercode", pUser); + sqldet.setInteger("transfernumber", pTransfernumber); + sqldet.executeUpdate(); + } + + /**sentencia que obtiene la secuencia por fecha de trabajo, usuario.*/ + private static final String SQL = "select coalesce( max(TRANSFERNUMBER),0) from TGENETELLERTRANSFER " + + " where WORKINGDATE = :workingdate and USERCODE = :usercode "; + + /** + * Entrega la secuencia de transferencia. + * @param pWorkingDate Fecha de trabajo. + * @param pUsercode Codigo de usuario. + * @return Integer + * @throws Exception + */ + public static Integer getTransfernumber(EntityManager pEntityManager,Date pWorkingDate, String pUsercode) throws Exception { + Integer transfernumber = null; + Session s = (Session)pEntityManager.getDelegate(); + SQLQuery sql = s.createSQLQuery(SQL); + sql.setDate("workingdate", pWorkingDate); + sql.setString("usercode", pUsercode); + transfernumber = Integer.parseInt(sql.uniqueResult().toString()); + transfernumber++; + return transfernumber; + } + + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerTransferDetail.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerTransferDetail.java new file mode 100644 index 0000000..1a7651e --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerTransferDetail.java @@ -0,0 +1,226 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; +import com.fp.teller.exception.TellerException; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETELLERTRANSFERDETAIL */ +@Entity(name = "TgeneTellerTransferDetail") +@Table(name = "TGENETELLERTRANSFERDETAIL") +public class TgeneTellerTransferDetail extends com.fp.dto.AbstractDataTransport + implements + Serializable, + HibernateBean, + Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneTellerTransferDetail + */ + @EmbeddedId + private TgeneTellerTransferDetailKey pk; + @Column(name = "QUANTITY", nullable = true) + /** + * Numero de billetes o monedas por denominacion + */ + private Integer quantity; + + @Column(name = "TOTAL", nullable = true) + /** + * Total de la denominacion + */ + private BigDecimal total; + + /** Contructor por defecto */ + public TgeneTellerTransferDetail() { + } + /** + * Contructor de TgeneTellerTransferDetail + * + * @param pPk Clave Primaria del entity + */ + public TgeneTellerTransferDetail(TgeneTellerTransferDetailKey pPk) { + this(); + pk = pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneTellerTransferDetail + */ + public static TgeneTellerTransferDetail find(EntityManager pEntityManager, TgeneTellerTransferDetailKey pKey) + throws Exception { + TgeneTellerTransferDetail obj = pEntityManager.find(TgeneTellerTransferDetail.class, pKey); + return obj; + } + /** + * Entrega la Clave primaria de TgeneTellerTransferDetail + * + * @return El objeto que referencia a la Clave primaria de TgeneTellerTransferDetail + */ + public TgeneTellerTransferDetailKey getPk() { + return pk; + } + /** + * Fija un nuevo valor a la Clave primaria de TgeneTellerTransferDetail + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneTellerTransferDetail + */ + public void setPk(TgeneTellerTransferDetailKey pPk) { + pk = pPk; + } + /** + * Obtiene el valor de quantity + * + * @return valor de quantity + */ + public Integer getQuantity() { + return quantity; + } + /** + * Fija el valor de quantity + * + * @param pQuantity nuevo Valor de quantity + */ + public void setQuantity(Integer pQuantity) { + quantity = pQuantity; + } + + /** + * Obtiene el valor de total + * + * @return valor de total + */ + public BigDecimal getTotal() { + return total; + } + /** + * Fija el valor de total + * + * @param pTotal nuevo Valor de total + */ + public void setTotal(BigDecimal pTotal) { + total = pTotal; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneTellerTransferDetail)) + return false; + TgeneTellerTransferDetail that = (TgeneTellerTransferDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /** + * Implementacin del metodo hashCode de la la entidad TgeneTellerTransferDetail + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + /** Implementacin de la creacin de un bean en blanco TgeneTellerTransferDetail */ + public Object createInstance() { + TgeneTellerTransferDetail instance = new TgeneTellerTransferDetail(); + instance.setPk(new TgeneTellerTransferDetailKey()); + return instance; + } + /** + * Clona la entidad TgeneTellerTransferDetail + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneTellerTransferDetail p = (TgeneTellerTransferDetail) this.clone(); + p.setPk((TgeneTellerTransferDetailKey) this.pk.cloneMe()); + return p; + } + + //Metodos manuales. + /**Sentencia que entrega la los datos de TgeneTellerTransferDetail*/ + private static final String HQL_TELLER_TRANSFER_DETAIL = + " from TgeneTellerTransferDetail tgtd" + + " where tgtd.pk.workingdate = :workingdate" + + " and tgtd.pk.usercode = :usercode" + + " and tgtd.pk.transfernumber = :transfernumber"; + + /** + * Metodo que entrega los datos de TgeneTellerTransferDetail, dada la fecha de trabajo, usuario y secuencia. + * @param workingdate Fecha de trabajo. + * @param usercode Codigo de usuario. + * @param transfernumber Numero de transferencia. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, + Date workingdate, String usercode, Integer transfernumber) throws Exception{ + List ldata = null; + Query qry = pEntityManager.createQuery(HQL_TELLER_TRANSFER_DETAIL); + qry.setParameter("workingdate", workingdate); + qry.setParameter("usercode", usercode); + qry.setParameter("transfernumber", transfernumber); + ldata = qry.getResultList(); + if(ldata == null){ + throw new TellerException("TELLER-0001", "TRANSFERENCIA NO DEFINIDA EN TGENETELLERTRANSFERHEADER TRANSFERNUMBER:{0} USERCODE:{1} WORKINGDATE:{2}", transfernumber, usercode, workingdate); + } + return ldata; + } + + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerTransferDetailKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerTransferDetailKey.java new file mode 100644 index 0000000..7489bca --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerTransferDetailKey.java @@ -0,0 +1,234 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENETELLERTRANSFERDETAIL*/ +@Embeddable +public class TgeneTellerTransferDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario que origina la transferencia +*/ +private String usercode; + +@Column(name="WORKINGDATE", nullable=false,updatable=false) + +/** +* Fecha de trabajo en la cual se origina la transferencia +*/ +private Date workingdate; + +@Column(name="TRANSFERNUMBER", nullable=false,updatable=false) + +/** +* Secuencia de transferencia para el usuaio fecha de trabajo +*/ +private Integer transfernumber; + +@Column(name="CATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String catalog; + +@Column(name="CATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String catalogcode; + +@Column(name="DENOMINATIONVALUE", nullable=false,updatable=false) + +/** +* Valor de la denominacion, ejemplo billetes de 100, 50, 20,10 etc +*/ +private BigDecimal denominationvalue; + +/**Contructor por defecto*/ +public TgeneTellerTransferDetailKey(){} +/**Contructor de TgeneTellerTransferDetailKey +@param pUsercode Codigo de usuario que origina la transferencia +@param pWorkingdate Fecha de trabajo en la cual se origina la transferencia +@param pTransfernumber Secuencia de transferencia para el usuaio fecha de trabajo +@param pCatalog Codigo de catalogo 01 Natural, 02 Juridico +@param pCatalogcode Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +@param pDenominationvalue Valor de la denominacion, ejemplo billetes de 100, 50, 20,10 etc +*/ +public TgeneTellerTransferDetailKey(String pUsercode,Date pWorkingdate,Integer pTransfernumber,String pCatalog,String pCatalogcode,BigDecimal pDenominationvalue){ + usercode=pUsercode; + workingdate=pWorkingdate; + transfernumber=pTransfernumber; + catalog=pCatalog; + catalogcode=pCatalogcode; + denominationvalue=pDenominationvalue; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +/**Obtiene el valor de transfernumber +@return valor de transfernumber*/ +public Integer getTransfernumber(){ + return transfernumber; +} +/**Fija el valor de transfernumber +@param pTransfernumber nuevo Valor de transfernumber*/ +public void setTransfernumber(Integer pTransfernumber){ + transfernumber=pTransfernumber; +} + +/**Obtiene el valor de catalog +@return valor de catalog*/ +public String getCatalog(){ + return catalog; +} +/**Fija el valor de catalog +@param pCatalog nuevo Valor de catalog*/ +public void setCatalog(String pCatalog){ + catalog=pCatalog; +} + +/**Obtiene el valor de catalogcode +@return valor de catalogcode*/ +public String getCatalogcode(){ + return catalogcode; +} +/**Fija el valor de catalogcode +@param pCatalogcode nuevo Valor de catalogcode*/ +public void setCatalogcode(String pCatalogcode){ + catalogcode=pCatalogcode; +} + +/**Obtiene el valor de denominationvalue +@return valor de denominationvalue*/ +public BigDecimal getDenominationvalue(){ + return denominationvalue; +} +/**Fija el valor de denominationvalue +@param pDenominationvalue nuevo Valor de denominationvalue*/ +public void setDenominationvalue(BigDecimal pDenominationvalue){ + denominationvalue=pDenominationvalue; +} + +/**Implementacin de la comparacin de TgeneTellerTransferDetailKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTellerTransferDetailKey))return false; + TgeneTellerTransferDetailKey that = (TgeneTellerTransferDetailKey) o; + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getWorkingdate() == null || that.getWorkingdate() == null){ + return false; + } + if (! this.getWorkingdate().equals(that.getWorkingdate())){ + return false; + } + if (this.getTransfernumber() == null || that.getTransfernumber() == null){ + return false; + } + if (! this.getTransfernumber().equals(that.getTransfernumber())){ + return false; + } + if (this.getCatalog() == null || that.getCatalog() == null){ + return false; + } + if (! this.getCatalog().equals(that.getCatalog())){ + return false; + } + if (this.getCatalogcode() == null || that.getCatalogcode() == null){ + return false; + } + if (! this.getCatalogcode().equals(that.getCatalogcode())){ + return false; + } + if (this.getDenominationvalue() == null || that.getDenominationvalue() == null){ + return false; + } + if (! this.getDenominationvalue().equals(that.getDenominationvalue())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTellerTransferDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getWorkingdate() == null ? 0 : this.getWorkingdate().hashCode()); + result = result * 37 + (this.getTransfernumber() == null ? 0 : this.getTransfernumber().hashCode()); + result = result * 37 + (this.getCatalog() == null ? 0 : this.getCatalog().hashCode()); + result = result * 37 + (this.getCatalogcode() == null ? 0 : this.getCatalogcode().hashCode()); + result = result * 37 + (this.getDenominationvalue() == null ? 0 : this.getDenominationvalue().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerTransferHeader.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerTransferHeader.java new file mode 100644 index 0000000..2f8c01c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerTransferHeader.java @@ -0,0 +1,574 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.SQLQuery; +import org.hibernate.Session; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; +import com.fp.teller.exception.TellerException; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETELLERTRANSFERHEADER */ +@Entity(name = "TgeneTellerTransferHeader") +@Table(name = "TGENETELLERTRANSFERHEADER") +public class TgeneTellerTransferHeader extends com.fp.dto.AbstractDataTransport + implements + Serializable, + HibernateBean, + Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneTellerTransferHeader + */ + @EmbeddedId + private TgeneTellerTransferHeaderKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Numero de mensaje con el que se procersa el financiero. + */ + private Timestamp datefrom; + + @Column(name = "CURRENCYCODE", nullable = false) + /** + * Codigo de moneda + */ + private String currencycode; + + @Column(name = "OFFICECODE", nullable = false) + /** + * Codigo de oficina origen + */ + private Integer officecode; + + @Column(name = "BRANCHCODE", nullable = false) + /** + * Codigo de sucursal origen + */ + private Integer branchcode; + + @Column(name = "COMPANYCODE", nullable = false) + /** + * Codigo de compania al que pertenece la oficina + */ + private Integer companycode; + + @Column(name = "DESTINYUSERCODE", nullable = true) + /** + * Codigo de usuario destino + */ + private String destinyusercode; + + @Column(name = "DESTINYOFFICECODE", nullable = true) + /** + * Codigo de oficina destino + */ + private Integer destinyofficecode; + + @Column(name = "DESTINYBRANCHCODE", nullable = true) + /** + * Codigo de sucursal destino + */ + private Integer destinybranchcode; + + @Column(name = "STATUSCATALOG", nullable = true) + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String statuscatalog; + + @Column(name = "STATUSCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String statuscatalogcode; + + @Column(name = "ISVAULT", nullable = true) + /** + * Y indica que la transferencia de saldos en de Boveda + */ + private String isvault; + + @Column(name = "TOTAL", nullable = true) + /** + * Monto total de la transaccion + */ + private BigDecimal total; + + @Column(name = "JOURNALID", nullable = true) + /** + * Numero de mensaje con el que se procersa el financiero. + */ + private String journalid; + + @Column(name = "OLDJOURNALID", nullable = true) + /** + * Numero de mensaje anterior se utiliza en los reversos. + */ + private String oldjournalid; + + + /** Contructor por defecto */ + public TgeneTellerTransferHeader() { + } + /** + * Contructor de TgeneTellerTransferHeader + * + * @param pPk Clave Primaria del entity + * @param pCurrencycode Codigo de moneda + * @param pOfficecode Codigo de oficina origen + * @param pBranchcode Codigo de sucursal origen + * @param pCompanycode Codigo de compania al que pertenece la oficina + */ + public TgeneTellerTransferHeader(TgeneTellerTransferHeaderKey pPk, String pCurrencycode, Integer pOfficecode, + Integer pBranchcode, Integer pCompanycode) { + this(); + pk = pPk; + currencycode = pCurrencycode; + officecode = pOfficecode; + branchcode = pBranchcode; + companycode = pCompanycode; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneTellerTransferHeader + */ + public static TgeneTellerTransferHeader find(EntityManager pEntityManager, TgeneTellerTransferHeaderKey pKey) + throws Exception { + TgeneTellerTransferHeader obj = pEntityManager.find(TgeneTellerTransferHeader.class, pKey); + return obj; + } + /** + * Entrega la Clave primaria de TgeneTellerTransferHeader + * + * @return El objeto que referencia a la Clave primaria de TgeneTellerTransferHeader + */ + public TgeneTellerTransferHeaderKey getPk() { + return pk; + } + /** + * Fija un nuevo valor a la Clave primaria de TgeneTellerTransferHeader + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneTellerTransferHeader + */ + public void setPk(TgeneTellerTransferHeaderKey pPk) { + pk = pPk; + } + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return datefrom; + } + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + datefrom = pDatefrom; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return currencycode; + } + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de officecode + * + * @return valor de officecode + */ + public Integer getOfficecode() { + return officecode; + } + /** + * Fija el valor de officecode + * + * @param pOfficecode nuevo Valor de officecode + */ + public void setOfficecode(Integer pOfficecode) { + officecode = pOfficecode; + } + + /** + * Obtiene el valor de branchcode + * + * @return valor de branchcode + */ + public Integer getBranchcode() { + return branchcode; + } + /** + * Fija el valor de branchcode + * + * @param pBranchcode nuevo Valor de branchcode + */ + public void setBranchcode(Integer pBranchcode) { + branchcode = pBranchcode; + } + + /** + * Obtiene el valor de companycode + * + * @return valor de companycode + */ + public Integer getCompanycode() { + return companycode; + } + /** + * Fija el valor de companycode + * + * @param pCompanycode nuevo Valor de companycode + */ + public void setCompanycode(Integer pCompanycode) { + companycode = pCompanycode; + } + + /** + * Obtiene el valor de destinyusercode + * + * @return valor de destinyusercode + */ + public String getDestinyusercode() { + return destinyusercode; + } + /** + * Fija el valor de destinyusercode + * + * @param pDestinyusercode nuevo Valor de destinyusercode + */ + public void setDestinyusercode(String pDestinyusercode) { + destinyusercode = pDestinyusercode; + } + + /** + * Obtiene el valor de destinyofficecode + * + * @return valor de destinyofficecode + */ + public Integer getDestinyofficecode() { + return destinyofficecode; + } + /** + * Fija el valor de destinyofficecode + * + * @param pDestinyofficecode nuevo Valor de destinyofficecode + */ + public void setDestinyofficecode(Integer pDestinyofficecode) { + destinyofficecode = pDestinyofficecode; + } + + /** + * Obtiene el valor de destinybranchcode + * + * @return valor de destinybranchcode + */ + public Integer getDestinybranchcode() { + return destinybranchcode; + } + /** + * Fija el valor de destinybranchcode + * + * @param pDestinybranchcode nuevo Valor de destinybranchcode + */ + public void setDestinybranchcode(Integer pDestinybranchcode) { + destinybranchcode = pDestinybranchcode; + } + + /** + * Obtiene el valor de statuscatalog + * + * @return valor de statuscatalog + */ + public String getStatuscatalog() { + return statuscatalog; + } + /** + * Fija el valor de statuscatalog + * + * @param pStatuscatalog nuevo Valor de statuscatalog + */ + public void setStatuscatalog(String pStatuscatalog) { + statuscatalog = pStatuscatalog; + } + + /** + * Obtiene el valor de statuscatalogcode + * + * @return valor de statuscatalogcode + */ + public String getStatuscatalogcode() { + return statuscatalogcode; + } + /** + * Fija el valor de statuscatalogcode + * + * @param pStatuscatalogcode nuevo Valor de statuscatalogcode + */ + public void setStatuscatalogcode(String pStatuscatalogcode) { + statuscatalogcode = pStatuscatalogcode; + } + + /** + * Obtiene el valor de isvault + * + * @return valor de isvault + */ + public String getIsvault() { + return isvault; + } + /** + * Fija el valor de isvault + * + * @param pIsvault nuevo Valor de isvault + */ + public void setIsvault(String pIsvault) { + isvault = pIsvault; + } + + /** + * Obtiene el valor de total + * + * @return valor de total + */ + public BigDecimal getTotal() { + return total; + } + /** + * Fija el valor de total + * + * @param pTotal nuevo Valor de total + */ + public void setTotal(BigDecimal pTotal) { + total = pTotal; + } + + /** + * Obtiene el valor de journalid + * + * @return valor de journalid + */ + public String getJournalid() { + return journalid; + } + /** + * Fija el valor de journalid + * + * @param pJournalid nuevo Valor de journalid + */ + public void setJournalid(String pJournalid) { + journalid = pJournalid; + } + + /** + * Obtiene el valor de oldjournalid + * + * @return valor de oldjournalid + */ + public String getOldjournalid() { + return oldjournalid; + } + /** + * Fija el valor de oldjournalid + * + * @param pOldjournalid nuevo Valor de oldjournalid + */ + public void setOldjournalid(String pOldjournalid) { + oldjournalid = pOldjournalid; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneTellerTransferHeader)) + return false; + TgeneTellerTransferHeader that = (TgeneTellerTransferHeader) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /** + * Implementacin del metodo hashCode de la la entidad TgeneTellerTransferHeader + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + /** Implementacin de la creacin de un bean en blanco TgeneTellerTransferHeader */ + public Object createInstance() { + TgeneTellerTransferHeader instance = new TgeneTellerTransferHeader(); + instance.setPk(new TgeneTellerTransferHeaderKey()); + return instance; + } + /** + * Clona la entidad TgeneTellerTransferHeader + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneTellerTransferHeader p = (TgeneTellerTransferHeader) this.clone(); + p.setPk((TgeneTellerTransferHeaderKey) this.pk.cloneMe()); + return p; + } + public Object getId() { + return this.pk; + } + + // metodos manuales. + /** Sentencia que entrega la los datos de TgeneTellerTransferHeader */ + private static final String HQL_TELLER_TRANSFER_HEADER_JID = " from TgeneTellerTransferHeader tgth" + + " where tgth.pk.workingdate = :workingdate" + " and tgth.journalid = :journalid"; + + /** + * Metodo que entrega los datos de TgeneTellerTransferHeader, dada la fecha de trabajo y el journalid. + * @param pEntityManager Referecia a la session de la base de datos. + * @param pWorkingdate Fecha de trabajo. + * @param pJournalid Numero de journal. + * @param isold Indica si obtiene el registro de journalid o de oldjournalid. + * @return TgeneTellerTransferHeader + * @throws Exception + */ + public static TgeneTellerTransferHeader find(EntityManager pEntityManager,Date pWorkingdate, String pJournalid) + throws Exception { + TgeneTellerTransferHeader tgeneTellerTransferHeader = null; + Query qry = pEntityManager.createQuery(HQL_TELLER_TRANSFER_HEADER_JID); + qry.setParameter("workingdate", pWorkingdate); + qry.setParameter("journalid", pJournalid); + try { + tgeneTellerTransferHeader = (TgeneTellerTransferHeader)qry.getSingleResult(); + } catch (NoResultException e) { + return tgeneTellerTransferHeader; + } + return tgeneTellerTransferHeader; + } + + + + /**sentencia que elimina TgeneTellerTransferHeader*/ + private static final String DEL_TRANSF_HEAD = + " delete from TGENETELLERTRANSFERHEADER t " + + " where t.WORKINGDATE = :workingdate " + + " and t.USERCODE = :usercode " + + " and t.TRANSFERNUMBER = :transfernumber"; + + /** + * Elimina un registro de la tabla para el usuario, fecha de trabajo y numero de transferencia. + * @param pEntityManager Referencia la session de la base de datos. + * @param pWorkingdate Fecha de trabajo. + * @param pUser Codigo de usuario. + * @param pTransfernumber Numero de transferencia. + * @throws Exception + */ + public static void delete(EntityManager pEntityManager,Date pWorkingdate,String pUser,Integer pTransfernumber) throws Exception { + //Elimina TgeneTellerTransferHeader + Session s = (Session)pEntityManager.getDelegate(); + SQLQuery sqldet = s.createSQLQuery(DEL_TRANSF_HEAD); + sqldet.setDate("workingdate", pWorkingdate); + sqldet.setString("usercode", pUser); + sqldet.setInteger("transfernumber", pTransfernumber); + sqldet.executeUpdate(); + } + + + + /**Sentencia que entrega la los datos de TgeneTellerTransferHeader*/ + private static final String JPQL_TELLER_TRANSFER_HEADER = + " from TgeneTellerTransferHeader tgth" + + " where tgth.pk.workingdate = :workingdate" + + " and tgth.pk.usercode = :usercode" + + " and tgth.pk.transfernumber = :transfernumber"; + /** + * Metodo que entrega los datos de TgeneTellerTransferHeader, dada la fecha de trabajo, usuario y numero de transferencia. + * + * @param pEntityManager Session de la base de datos. + * @param workingdate Fecha de trabajo. + * @param usercode Codigo de usuario. + * @param transfernumber Numero de transferencia. + * @return TgeneTellerTransferHeader + * @throws Exception + */ + public static TgeneTellerTransferHeader find(EntityManager pEntityManager, Date workingdate, String usercode, Integer transfernumber) throws Exception{ + TgeneTellerTransferHeader tgeneTellerTransferHeader = null; + Query qry = pEntityManager.createQuery(TgeneTellerTransferHeader.JPQL_TELLER_TRANSFER_HEADER); + qry.setParameter(Constant.VWORKINGDATE, workingdate); + qry.setParameter("usercode", usercode); + qry.setParameter("transfernumber", transfernumber); + try { + tgeneTellerTransferHeader = (TgeneTellerTransferHeader) qry.getSingleResult(); + } catch (NoResultException e) { + throw new TellerException("TELLER-0001", "TRANSFERENCIA NO DEFINIDA EN TGENETELLERTRANSFERHEADER TRANSFERNUMBER:{0} USERCODE:{1} WORKINGDATE:{2}", transfernumber, usercode, workingdate); + } + return tgeneTellerTransferHeader; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerTransferHeaderKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerTransferHeaderKey.java new file mode 100644 index 0000000..ca12537 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerTransferHeaderKey.java @@ -0,0 +1,184 @@ +package com.fp.persistence.pgeneral.gene; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENETELLERTRANSFERHEADER*/ +@Embeddable +public class TgeneTellerTransferHeaderKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="WORKINGDATE", nullable=false,updatable=false) + +/** +* Fecha de trabajo en la cual se origina la transferencia +*/ +private Date workingdate; + +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario que origina la transferencia +*/ +private String usercode; + +@Column(name="TRANSFERNUMBER", nullable=false,updatable=false) + +/** +* Secuencia de transferencia para el usuaio fecha de trabajo +*/ +private Integer transfernumber; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TgeneTellerTransferHeaderKey(){} +/**Contructor de TgeneTellerTransferHeaderKey +@param pWorkingdate Fecha de trabajo en la cual se origina la transferencia +@param pUsercode Codigo de usuario que origina la transferencia +@param pTransfernumber Secuencia de transferencia para el usuaio fecha de trabajo +@param pDateto Fecha hasta la cual esta vigente el registro +*/ +public TgeneTellerTransferHeaderKey(Date pWorkingdate,String pUsercode,Integer pTransfernumber,Timestamp pDateto){ + workingdate=pWorkingdate; + usercode=pUsercode; + transfernumber=pTransfernumber; + dateto=pDateto; +} +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de transfernumber +@return valor de transfernumber*/ +public Integer getTransfernumber(){ + return transfernumber; +} +/**Fija el valor de transfernumber +@param pTransfernumber nuevo Valor de transfernumber*/ +public void setTransfernumber(Integer pTransfernumber){ + transfernumber=pTransfernumber; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TgeneTellerTransferHeaderKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTellerTransferHeaderKey))return false; + TgeneTellerTransferHeaderKey that = (TgeneTellerTransferHeaderKey) o; + if (this.getWorkingdate() == null || that.getWorkingdate() == null){ + return false; + } + if (! this.getWorkingdate().equals(that.getWorkingdate())){ + return false; + } + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getTransfernumber() == null || that.getTransfernumber() == null){ + return false; + } + if (! this.getTransfernumber().equals(that.getTransfernumber())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTellerTransferHeaderKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getWorkingdate() == null ? 0 : this.getWorkingdate().hashCode()); + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getTransfernumber() == null ? 0 : this.getTransfernumber().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerTransferKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerTransferKey.java new file mode 100644 index 0000000..05f6179 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTellerTransferKey.java @@ -0,0 +1,152 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENETELLERTRANSFER*/ +@Embeddable +public class TgeneTellerTransferKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario que origina la transferencia +*/ +private String usercode; + +@Column(name="WORKINGDATE", nullable=false,updatable=false) + +/** +* Fecha de trabajo en la cual se origina la transferencia +*/ +private Date workingdate; + +@Column(name="TRANSFERNUMBER", nullable=false,updatable=false) + +/** +* Secuencia de transferencia para el usuaio fecha de trabajo +*/ +private Integer transfernumber; + +/**Contructor por defecto*/ +public TgeneTellerTransferKey(){} +/**Contructor de TgeneTellerTransferKey +@param pUsercode Codigo de usuario que origina la transferencia +@param pWorkingdate Fecha de trabajo en la cual se origina la transferencia +@param pTransfernumber Secuencia de transferencia para el usuaio fecha de trabajo +*/ +public TgeneTellerTransferKey(String pUsercode,Date pWorkingdate,Integer pTransfernumber){ + usercode=pUsercode; + workingdate=pWorkingdate; + transfernumber=pTransfernumber; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +/**Obtiene el valor de transfernumber +@return valor de transfernumber*/ +public Integer getTransfernumber(){ + return transfernumber; +} +/**Fija el valor de transfernumber +@param pTransfernumber nuevo Valor de transfernumber*/ +public void setTransfernumber(Integer pTransfernumber){ + transfernumber=pTransfernumber; +} + +/**Implementacin de la comparacin de TgeneTellerTransferKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTellerTransferKey))return false; + TgeneTellerTransferKey that = (TgeneTellerTransferKey) o; + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getWorkingdate() == null || that.getWorkingdate() == null){ + return false; + } + if (! this.getWorkingdate().equals(that.getWorkingdate())){ + return false; + } + if (this.getTransfernumber() == null || that.getTransfernumber() == null){ + return false; + } + if (! this.getTransfernumber().equals(that.getTransfernumber())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTellerTransferKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getWorkingdate() == null ? 0 : this.getWorkingdate().hashCode()); + result = result * 37 + (this.getTransfernumber() == null ? 0 : this.getTransfernumber().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionMix.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionMix.java new file mode 100644 index 0000000..64f4ee3 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionMix.java @@ -0,0 +1,432 @@ +package com.fp.persistence.pgeneral.gene; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONMIX */ +@Entity(name = "TgeneTransactionMix") +@Table(name = "TGENETRANSACTIONMIX") +public class TgeneTransactionMix extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneTransactionMix + */ + @EmbeddedId + private TgeneTransactionMixKey pk; + + @Column(name = "PERSONCODE", nullable = true) + /** + * Codigo de persona + */ + private Integer personcode; + + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + + @Column(name = "OFFICECODE", nullable = true) + /** + * Codigo de oficina + */ + private Integer officecode; + + @Column(name = "BRANCHCODE", nullable = true) + /** + * Codigo de sucursal + */ + private Integer branchcode; + + @Column(name = "COMPANYCODE", nullable = true) + /** + * Codigo de compania al que pertenece la oficina + */ + private Integer companycode; + + @Column(name = "ACCOUNTINGDATE", nullable = true) + /** + * null + */ + private Date accountingdate; + + @Column(name = "CASH", nullable = true) + /** + * null + */ + private BigDecimal cash; + + @Column(name = "CHECKS", nullable = true) + /** + * null + */ + private BigDecimal checks; + + @Column(name = "CASHBALANCE", nullable = true) + /** + * null + */ + private BigDecimal cashbalance; + + @Column(name = "CHECKBALANCE", nullable = true) + /** + * null + */ + private BigDecimal checkbalance; + + /** Contructor por defecto */ + public TgeneTransactionMix() { + } + + /** + * Contructor de TgeneTransactionMix + * + * @param pPk Clave Primaria del entity + */ + public TgeneTransactionMix(TgeneTransactionMixKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneTransactionMix + */ + public static TgeneTransactionMix find(EntityManager pEntityManager, TgeneTransactionMixKey pKey) throws Exception { + TgeneTransactionMix obj = pEntityManager.find(TgeneTransactionMix.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneTransactionMix + * + * @return El objeto que referencia a la Clave primaria de TgeneTransactionMix + */ + public TgeneTransactionMixKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneTransactionMix + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionMix + */ + public void setPk(TgeneTransactionMixKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de personcode + * + * @return valor de personcode + */ + public Integer getPersoncode() { + return this.personcode; + } + + /** + * Fija el valor de personcode + * + * @param pPersoncode nuevo Valor de personcode + */ + public void setPersoncode(Integer pPersoncode) { + this.personcode = pPersoncode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de officecode + * + * @return valor de officecode + */ + public Integer getOfficecode() { + return this.officecode; + } + + /** + * Fija el valor de officecode + * + * @param pOfficecode nuevo Valor de officecode + */ + public void setOfficecode(Integer pOfficecode) { + this.officecode = pOfficecode; + } + + /** + * Obtiene el valor de branchcode + * + * @return valor de branchcode + */ + public Integer getBranchcode() { + return this.branchcode; + } + + /** + * Fija el valor de branchcode + * + * @param pBranchcode nuevo Valor de branchcode + */ + public void setBranchcode(Integer pBranchcode) { + this.branchcode = pBranchcode; + } + + /** + * Obtiene el valor de companycode + * + * @return valor de companycode + */ + public Integer getCompanycode() { + return this.companycode; + } + + /** + * Fija el valor de companycode + * + * @param pCompanycode nuevo Valor de companycode + */ + public void setCompanycode(Integer pCompanycode) { + this.companycode = pCompanycode; + } + + /** + * Obtiene el valor de accountingdate + * + * @return valor de accountingdate + */ + public Date getAccountingdate() { + return this.accountingdate; + } + + /** + * Fija el valor de accountingdate + * + * @param pAccountingdate nuevo Valor de accountingdate + */ + public void setAccountingdate(Date pAccountingdate) { + this.accountingdate = pAccountingdate; + } + + /** + * Obtiene el valor de cash + * + * @return valor de cash + */ + public BigDecimal getCash() { + return this.cash; + } + + /** + * Fija el valor de cash + * + * @param pCash nuevo Valor de cash + */ + public void setCash(BigDecimal pCash) { + this.cash = pCash; + } + + /** + * Obtiene el valor de checks + * + * @return valor de checks + */ + public BigDecimal getChecks() { + return this.checks; + } + + /** + * Fija el valor de checks + * + * @param pChecks nuevo Valor de checks + */ + public void setChecks(BigDecimal pChecks) { + this.checks = pChecks; + } + + /** + * Obtiene el valor de cashbalance + * + * @return valor de cashbalance + */ + public BigDecimal getCashbalance() { + return this.cashbalance; + } + + /** + * Fija el valor de cashbalance + * + * @param pCashbalance nuevo Valor de cashbalance + */ + public void setCashbalance(BigDecimal pCashbalance) { + this.cashbalance = pCashbalance; + } + + /** + * Obtiene el valor de checkbalance + * + * @return valor de checkbalance + */ + public BigDecimal getCheckbalance() { + return this.checkbalance; + } + + /** + * Fija el valor de checkbalance + * + * @param pCheckbalance nuevo Valor de checkbalance + */ + public void setCheckbalance(BigDecimal pCheckbalance) { + this.checkbalance = pCheckbalance; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneTransactionMix)) { + return false; + } + TgeneTransactionMix that = (TgeneTransactionMix) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneTransactionMix + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneTransactionMix */ + @Override + public Object createInstance() { + TgeneTransactionMix instance = new TgeneTransactionMix(); + instance.setPk(new TgeneTransactionMixKey()); + return instance; + } + + /** + * Clona la entidad TgeneTransactionMix + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneTransactionMix p = (TgeneTransactionMix) this.clone(); + p.setPk((TgeneTransactionMixKey) this.pk.cloneMe()); + return p; + } + + // METODOS MANUALES + /** Sentencia que entrega datos de TgeneTransactionMix, para la fecha de tarbajo, usuario y numero de caja multiple. */ + private static final String JPQL_TRANS_MIX = " from TgeneTransactionMix tmix" + " where tmix.pk.workingdate = :workingdate " + + " and tmix.pk.usercode = :user" + " and tmix.pk.mixnumber = :mixnumber "; + + /** + * Metodo que entrega un registro de TgeneTransactionMix, dada la fecha de trabajo, codigo de usuario y secuencia de + * caja multiple, que se calcula por fecha de trabajo y usuario. + * + * @param pEntityManager Session de la base de datos. + * @param pWorkingdate Fecha de trabajo. + * @param pUser Codigo de usuario. + * @param pMixnumber Secuencia de caja multiple. + * @return TgeneTransactionMix + * @throws Exception + */ + public static TgeneTransactionMix find(EntityManager pEntityManager, Date pWorkingdate, String pUser, Integer pMixnumber) throws Exception { + Query qry = pEntityManager.createQuery(TgeneTransactionMix.JPQL_TRANS_MIX); + qry.setParameter(Constant.VWORKINGDATE, pWorkingdate); + qry.setParameter("user", pUser); + qry.setParameter("mixnumber", pMixnumber); + try { + return (TgeneTransactionMix) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionMixKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionMixKey.java new file mode 100644 index 0000000..d124dae --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionMixKey.java @@ -0,0 +1,152 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONMIX*/ +@Embeddable +public class TgeneTransactionMixKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="WORKINGDATE", nullable=false,updatable=false) + +/** +* null +*/ +private Date workingdate; + +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="MIXNUMBER", nullable=false,updatable=false) + +/** +* null +*/ +private Integer mixnumber; + +/**Contructor por defecto*/ +public TgeneTransactionMixKey(){} +/**Contructor de TgeneTransactionMixKey +@param pWorkingdate null +@param pUsercode Codigo de usuario +@param pMixnumber null +*/ +public TgeneTransactionMixKey(Date pWorkingdate,String pUsercode,Integer pMixnumber){ + workingdate=pWorkingdate; + usercode=pUsercode; + mixnumber=pMixnumber; +} +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de mixnumber +@return valor de mixnumber*/ +public Integer getMixnumber(){ + return mixnumber; +} +/**Fija el valor de mixnumber +@param pMixnumber nuevo Valor de mixnumber*/ +public void setMixnumber(Integer pMixnumber){ + mixnumber=pMixnumber; +} + +/**Implementacin de la comparacin de TgeneTransactionMixKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionMixKey))return false; + TgeneTransactionMixKey that = (TgeneTransactionMixKey) o; + if (this.getWorkingdate() == null || that.getWorkingdate() == null){ + return false; + } + if (! this.getWorkingdate().equals(that.getWorkingdate())){ + return false; + } + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getMixnumber() == null || that.getMixnumber() == null){ + return false; + } + if (! this.getMixnumber().equals(that.getMixnumber())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransactionMixKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getWorkingdate() == null ? 0 : this.getWorkingdate().hashCode()); + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getMixnumber() == null ? 0 : this.getMixnumber().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionMixPages.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionMixPages.java new file mode 100644 index 0000000..66d4ccf --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionMixPages.java @@ -0,0 +1,157 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONMIXPAGES*/ +@Entity(name="TgeneTransactionMixPages") +@Table(name="TGENETRANSACTIONMIXPAGES") +public class TgeneTransactionMixPages extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransactionMixPages +*/ +@EmbeddedId +private TgeneTransactionMixPagesKey pk; +@Column(name="ORIGIN", nullable=true) + +/** +* Y Indica que la transaccion sirve para fondeo del efectivo, N resta los fondos +*/ +private String origin; + +@Column(name="PRESENTATIONORDER", nullable=true) + +/** +* Orden de presentacion +*/ +private Integer presentationorder; + +/**Contructor por defecto*/ +public TgeneTransactionMixPages(){ +} +/**Contructor de TgeneTransactionMixPages +@param pPk Clave Primaria del entity +*/ +public TgeneTransactionMixPages(TgeneTransactionMixPagesKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionMixPages +*/ +public static TgeneTransactionMixPages find(EntityManager pEntityManager,TgeneTransactionMixPagesKey pKey) throws Exception{ + TgeneTransactionMixPages obj = pEntityManager.find(TgeneTransactionMixPages.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionMixPages +@return El objeto que referencia a la Clave primaria de TgeneTransactionMixPages +*/ +public TgeneTransactionMixPagesKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionMixPages +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionMixPages +*/ +public void setPk(TgeneTransactionMixPagesKey pPk){ + pk=pPk; +} +/**Obtiene el valor de origin +@return valor de origin*/ +public String getOrigin(){ + return origin; +} +/**Fija el valor de origin +@param pOrigin nuevo Valor de origin*/ +public void setOrigin(String pOrigin){ + origin=pOrigin; +} + +/**Obtiene el valor de presentationorder +@return valor de presentationorder*/ +public Integer getPresentationorder(){ + return presentationorder; +} +/**Fija el valor de presentationorder +@param pPresentationorder nuevo Valor de presentationorder*/ +public void setPresentationorder(Integer pPresentationorder){ + presentationorder=pPresentationorder; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionMixPages))return false; + TgeneTransactionMixPages that = (TgeneTransactionMixPages) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTransactionMixPages +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTransactionMixPages +*/ +public Object createInstance(){ + TgeneTransactionMixPages instance=new TgeneTransactionMixPages(); + instance.setPk(new TgeneTransactionMixPagesKey()); + return instance; +} +/**Clona la entidad TgeneTransactionMixPages +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionMixPages p=(TgeneTransactionMixPages)this.clone(); + p.setPk((TgeneTransactionMixPagesKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionMixPagesKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionMixPagesKey.java new file mode 100644 index 0000000..80ff26b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionMixPagesKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONMIXPAGES*/ +@Embeddable +public class TgeneTransactionMixPagesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +/**Contructor por defecto*/ +public TgeneTransactionMixPagesKey(){} +/**Contructor de TgeneTransactionMixPagesKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +*/ +public TgeneTransactionMixPagesKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Implementacin de la comparacin de TgeneTransactionMixPagesKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionMixPagesKey))return false; + TgeneTransactionMixPagesKey that = (TgeneTransactionMixPagesKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransactionMixPagesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionQuery.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionQuery.java new file mode 100644 index 0000000..2b0a787 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionQuery.java @@ -0,0 +1,282 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONQUERY*/ +@Entity(name="TgeneTransactionQuery") +@Table(name="TGENETRANSACTIONQUERY") +public class TgeneTransactionQuery extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransactionQuery +*/ +@EmbeddedId +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(SEQUENCE),0)+1 from TGENETRANSACTIONQUERY " + + "where TRANSACTIONMODULE=:transactionmodule " + "and TRANSACTIONCODE=:transactioncode " + + "and TRANSACTIONVERSION=:transactionversion "), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "transactionmodule,pk.transactionmodule;transactioncode,pk.transactioncode;transactionversion,pk.transactionversion"), + @Parameter(name = "field", value = "sequence") }) +@GeneratedValue(generator = "seq_id") +private TgeneTransactionQueryKey pk; +@Column(name="PROCESSCODE", nullable=true) + +/** +* Paquete clase de un comando a ejecutar. +*/ +private String processcode; + +@Column(name="CATALOGTYPEPROCESS", nullable=true) + +/** +* Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia +*/ +private String catalogtypeprocess; + +@Column(name="CATALOGCODETYPEPROCESS", nullable=true) + +/** +* Codigo de tabla de catalogo del proceso de negocio de la aplicacion +*/ +private String catalogcodetypeprocess; + +@Column(name="EXECUTIONORDER", nullable=true) + +/** +* orden de ejecucion de la regla de negocio. +*/ +private Integer executionorder; + +@Column(name="STATUS", nullable=true) + +/** +* A indica que la regla esta activa, I regla Inactiva +*/ +private String status; + +@Column(name="ISFLOW", nullable=true) + +/** +* Y Indica que el origen de ejecucion del componente es un flujo del bpm +*/ +private String isflow; + +@Column(name="RULENAME", nullable=true) + +/** +* Nombre de la regla a ejecutar +*/ +private String rulename; + +@Column(name="PROCESSNAME", nullable=true) + +/** +* Nombre del flujo bpm a ejecutar +*/ +private String processname; + +/**Contructor por defecto*/ +public TgeneTransactionQuery(){ +} +/**Contructor de TgeneTransactionQuery +@param pPk Clave Primaria del entity +*/ +public TgeneTransactionQuery(TgeneTransactionQueryKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionQuery +*/ +public static TgeneTransactionQuery find(EntityManager pEntityManager,TgeneTransactionQueryKey pKey) throws Exception{ + TgeneTransactionQuery obj = pEntityManager.find(TgeneTransactionQuery.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionQuery +@return El objeto que referencia a la Clave primaria de TgeneTransactionQuery +*/ +public TgeneTransactionQueryKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionQuery +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionQuery +*/ +public void setPk(TgeneTransactionQueryKey pPk){ + pk=pPk; +} +/**Obtiene el valor de processcode +@return valor de processcode*/ +public String getProcesscode(){ + return processcode; +} +/**Fija el valor de processcode +@param pProcesscode nuevo Valor de processcode*/ +public void setProcesscode(String pProcesscode){ + processcode=pProcesscode; +} + +/**Obtiene el valor de catalogtypeprocess +@return valor de catalogtypeprocess*/ +public String getCatalogtypeprocess(){ + return catalogtypeprocess; +} +/**Fija el valor de catalogtypeprocess +@param pCatalogtypeprocess nuevo Valor de catalogtypeprocess*/ +public void setCatalogtypeprocess(String pCatalogtypeprocess){ + catalogtypeprocess=pCatalogtypeprocess; +} + +/**Obtiene el valor de catalogcodetypeprocess +@return valor de catalogcodetypeprocess*/ +public String getCatalogcodetypeprocess(){ + return catalogcodetypeprocess; +} +/**Fija el valor de catalogcodetypeprocess +@param pCatalogcodetypeprocess nuevo Valor de catalogcodetypeprocess*/ +public void setCatalogcodetypeprocess(String pCatalogcodetypeprocess){ + catalogcodetypeprocess=pCatalogcodetypeprocess; +} + +/**Obtiene el valor de executionorder +@return valor de executionorder*/ +public Integer getExecutionorder(){ + return executionorder; +} +/**Fija el valor de executionorder +@param pExecutionorder nuevo Valor de executionorder*/ +public void setExecutionorder(Integer pExecutionorder){ + executionorder=pExecutionorder; +} + +/**Obtiene el valor de status +@return valor de status*/ +public String getStatus(){ + return status; +} +/**Fija el valor de status +@param pStatus nuevo Valor de status*/ +public void setStatus(String pStatus){ + status=pStatus; +} + +/**Obtiene el valor de isflow +@return valor de isflow*/ +public String getIsflow(){ + return isflow; +} +/**Fija el valor de isflow +@param pIsflow nuevo Valor de isflow*/ +public void setIsflow(String pIsflow){ + isflow=pIsflow; +} + +/**Obtiene el valor de rulename +@return valor de rulename*/ +public String getRulename(){ + return rulename; +} +/**Fija el valor de rulename +@param pRulename nuevo Valor de rulename*/ +public void setRulename(String pRulename){ + rulename=pRulename; +} + +/**Obtiene el valor de processname +@return valor de processname*/ +public String getProcessname(){ + return processname; +} +/**Fija el valor de processname +@param pProcessname nuevo Valor de processname*/ +public void setProcessname(String pProcessname){ + processname=pProcessname; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionQuery))return false; + TgeneTransactionQuery that = (TgeneTransactionQuery) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTransactionQuery +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTransactionQuery +*/ +public Object createInstance(){ + TgeneTransactionQuery instance=new TgeneTransactionQuery(); + instance.setPk(new TgeneTransactionQueryKey()); + return instance; +} +/**Clona la entidad TgeneTransactionQuery +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionQuery p=(TgeneTransactionQuery)this.clone(); + p.setPk((TgeneTransactionQueryKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionQueryKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionQueryKey.java new file mode 100644 index 0000000..3f92a46 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionQueryKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONQUERY*/ +@Embeddable +public class TgeneTransactionQueryKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="SEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de la consulta +*/ +private Integer sequence; + +/**Contructor por defecto*/ +public TgeneTransactionQueryKey(){} +/**Contructor de TgeneTransactionQueryKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pSequence Secuencia de la consulta +*/ +public TgeneTransactionQueryKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,Integer pSequence){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + sequence=pSequence; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de sequence +@return valor de sequence*/ +public Integer getSequence(){ + return sequence; +} +/**Fija el valor de sequence +@param pSequence nuevo Valor de sequence*/ +public void setSequence(Integer pSequence){ + sequence=pSequence; +} + +/**Implementacin de la comparacin de TgeneTransactionQueryKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionQueryKey))return false; + TgeneTransactionQueryKey that = (TgeneTransactionQueryKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getSequence() == null || that.getSequence() == null){ + return false; + } + if (! this.getSequence().equals(that.getSequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransactionQueryKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getSequence() == null ? 0 : this.getSequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionReportLink.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionReportLink.java new file mode 100644 index 0000000..a97cb61 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionReportLink.java @@ -0,0 +1,160 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONREPORTLINK*/ +@Entity(name="TgeneTransactionReportLink") +@Table(name="TGENETRANSACTIONREPORTLINK") +public class TgeneTransactionReportLink extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransactionReportLink +*/ +@EmbeddedId +private TgeneTransactionReportLinkKey pk; +@Column(name="PERSISTENCEUNIT", nullable=true) + +/** +* Nombre del persistence unit, si esta en null toma la coneccion por defecto de la compania +*/ +private String persistenceunit; + +@Column(name="REPORTNAME", nullable=false) + +/** +* Nombre del reporte +*/ +private String reportname; + +/**Contructor por defecto*/ +public TgeneTransactionReportLink(){ +} +/**Contructor de TgeneTransactionReportLink +@param pPk Clave Primaria del entity +@param pReportname Nombre del reporte +*/ +public TgeneTransactionReportLink(TgeneTransactionReportLinkKey pPk,String pReportname){ + this(); + pk=pPk; + reportname=pReportname; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionReportLink +*/ +public static TgeneTransactionReportLink find(EntityManager pEntityManager,TgeneTransactionReportLinkKey pKey) throws Exception{ + TgeneTransactionReportLink obj = pEntityManager.find(TgeneTransactionReportLink.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionReportLink +@return El objeto que referencia a la Clave primaria de TgeneTransactionReportLink +*/ +public TgeneTransactionReportLinkKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionReportLink +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionReportLink +*/ +public void setPk(TgeneTransactionReportLinkKey pPk){ + pk=pPk; +} +/**Obtiene el valor de persistenceunit +@return valor de persistenceunit*/ +public String getPersistenceunit(){ + return persistenceunit; +} +/**Fija el valor de persistenceunit +@param pPersistenceunit nuevo Valor de persistenceunit*/ +public void setPersistenceunit(String pPersistenceunit){ + persistenceunit=pPersistenceunit; +} + +/**Obtiene el valor de reportname +@return valor de reportname*/ +public String getReportname(){ + return reportname; +} +/**Fija el valor de reportname +@param pReportname nuevo Valor de reportname*/ +public void setReportname(String pReportname){ + reportname=pReportname; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionReportLink))return false; + TgeneTransactionReportLink that = (TgeneTransactionReportLink) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTransactionReportLink +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTransactionReportLink +*/ +public Object createInstance(){ + TgeneTransactionReportLink instance=new TgeneTransactionReportLink(); + instance.setPk(new TgeneTransactionReportLinkKey()); + return instance; +} +/**Clona la entidad TgeneTransactionReportLink +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionReportLink p=(TgeneTransactionReportLink)this.clone(); + p.setPk((TgeneTransactionReportLinkKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionReportLinkKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionReportLinkKey.java new file mode 100644 index 0000000..f10e1df --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneTransactionReportLinkKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONREPORTLINK*/ +@Embeddable +public class TgeneTransactionReportLinkKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TgeneTransactionReportLinkKey(){} +/**Contructor de TgeneTransactionReportLinkKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pCompanycode Codigo de compania +*/ +public TgeneTransactionReportLinkKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,Integer pCompanycode){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + companycode=pCompanycode; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacin de la comparacin de TgeneTransactionReportLinkKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionReportLinkKey))return false; + TgeneTransactionReportLinkKey that = (TgeneTransactionReportLinkKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransactionReportLinkKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneUserSolicitudeNumber.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneUserSolicitudeNumber.java new file mode 100644 index 0000000..f4a0953 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneUserSolicitudeNumber.java @@ -0,0 +1,138 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEUSERSOLICITUDENUMBER*/ +@Entity(name="TgeneUserSolicitudeNumber") +@Table(name="TGENEUSERSOLICITUDENUMBER") +public class TgeneUserSolicitudeNumber extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneUserSolicitudeNumber +*/ +@Id +@Column(name="USERCODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="SOLICITUDNUMBER", nullable=true) + +/** +* Numero de secuencia de solicitud asociada al usuario. +*/ +private String solicitudnumber; + +/**Contructor por defecto*/ +public TgeneUserSolicitudeNumber(){ +} +/**Contructor de TgeneUserSolicitudeNumber +@param pPk Clave Primaria del entity +*/ +public TgeneUserSolicitudeNumber(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneUserSolicitudeNumber +*/ +public static TgeneUserSolicitudeNumber find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneUserSolicitudeNumber obj = pEntityManager.find(TgeneUserSolicitudeNumber.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneUserSolicitudeNumber +@return El objeto que referencia a la Clave primaria de TgeneUserSolicitudeNumber +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneUserSolicitudeNumber +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneUserSolicitudeNumber +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de solicitudnumber +@return valor de solicitudnumber*/ +public String getSolicitudnumber(){ + return solicitudnumber; +} +/**Fija el valor de solicitudnumber +@param pSolicitudnumber nuevo Valor de solicitudnumber*/ +public void setSolicitudnumber(String pSolicitudnumber){ + solicitudnumber=pSolicitudnumber; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneUserSolicitudeNumber))return false; + TgeneUserSolicitudeNumber that = (TgeneUserSolicitudeNumber) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneUserSolicitudeNumber +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneUserSolicitudeNumber +*/ +public Object createInstance(){ + TgeneUserSolicitudeNumber instance=new TgeneUserSolicitudeNumber(); + return instance; +} +/**Clona la entidad TgeneUserSolicitudeNumber +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneUserSolicitudeNumber p=(TgeneUserSolicitudeNumber)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneWildcard.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneWildcard.java new file mode 100644 index 0000000..bce5b94 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/gene/TgeneWildcard.java @@ -0,0 +1,251 @@ +package com.fp.persistence.pgeneral.gene; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Transient; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEWILDCARD */ +@Entity(name = "TgeneWildcard") +@Table(name = "TGENEWILDCARD") +public class TgeneWildcard extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Cache { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneWildcard + */ + @Id + @Column(name = "WILDCARD", nullable = false, updatable = false) + private String pk; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "PROCESSCODE", nullable = true) + /** + * null + */ + private String processcode; + + @Column(name = "CATALOGTYPEPROCESS", nullable = true) + /** + * Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia + */ + private String catalogtypeprocess; + + @Column(name = "CATALOGCODETYPEPROCESS", nullable = true) + /** + * Codigo de tabla de catalogo del proceso de negocio de la aplicacion + */ + private String catalogcodetypeprocess; + + /** Contructor por defecto */ + public TgeneWildcard() { + } + /** + * Contructor de TgeneWildcard + * + * @param pPk Clave Primaria del entity + */ + public TgeneWildcard(String pPk) { + this(); + pk = pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneWildcard + */ + public static TgeneWildcard find(EntityManager pEntityManager, Object pKey) throws Exception { + TgeneWildcard obj = pEntityManager.find(TgeneWildcard.class, pKey); + return obj; + } + /** + * Entrega la Clave primaria de TgeneWildcard + * + * @return El objeto que referencia a la Clave primaria de TgeneWildcard + */ + public String getPk() { + return pk; + } + /** + * Fija un nuevo valor a la Clave primaria de TgeneWildcard + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneWildcard + */ + public void setPk(String pPk) { + pk = pPk; + } + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de processcode + * + * @return valor de processcode + */ + public String getProcesscode() { + return processcode; + } + /** + * Fija el valor de processcode + * + * @param pProcesscode nuevo Valor de processcode + */ + public void setProcesscode(String pProcesscode) { + processcode = pProcesscode; + } + + /** + * Obtiene el valor de catalogtypeprocess + * + * @return valor de catalogtypeprocess + */ + public String getCatalogtypeprocess() { + return catalogtypeprocess; + } + /** + * Fija el valor de catalogtypeprocess + * + * @param pCatalogtypeprocess nuevo Valor de catalogtypeprocess + */ + public void setCatalogtypeprocess(String pCatalogtypeprocess) { + catalogtypeprocess = pCatalogtypeprocess; + } + + /** + * Obtiene el valor de catalogcodetypeprocess + * + * @return valor de catalogcodetypeprocess + */ + public String getCatalogcodetypeprocess() { + return catalogcodetypeprocess; + } + /** + * Fija el valor de catalogcodetypeprocess + * + * @param pCatalogcodetypeprocess nuevo Valor de catalogcodetypeprocess + */ + public void setCatalogcodetypeprocess(String pCatalogcodetypeprocess) { + catalogcodetypeprocess = pCatalogcodetypeprocess; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneWildcard)) + return false; + TgeneWildcard that = (TgeneWildcard) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /** + * Implementacin del metodo hashCode de la la entidad TgeneWildcard + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + /** Implementacin de la creacin de un bean en blanco TgeneWildcard */ + public Object createInstance() { + TgeneWildcard instance = new TgeneWildcard(); + return instance; + } + /** + * Clona la entidad TgeneWildcard + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneWildcard p = (TgeneWildcard) this.clone(); + return p; + } + + //Metodos manuales. + + private static String HQL = "from TgeneWildcard " ; + + /** + * Metodo que entrega una lista de clases que resuelven los comodines contables. + * @param pEntityManager referencia a la session de la base de datos. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findAll(EntityManager pEntityManager) throws Exception { + Query qry = pEntityManager.createQuery(HQL); + List ldata = null; + ldata = qry.getResultList(); + return ldata; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/image/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/image/.svn/entries new file mode 100644 index 0000000..b6c38d4 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/image/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/image +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneFilesDetailKey.java +file + + + + +2022-07-28T03:40:29.319745Z +b3789e6e4979a97f7e382523e4ce4591 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3282 + +TgeneFiles.java +file + + + + +2022-07-28T03:40:29.319745Z +aad9bae8f7064111070b7eacee21f080 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3411 + +TgeneFilesDetail.java +file + + + + +2022-07-28T03:40:29.319745Z +6092ef74785099e4bf0c6fb8a796bf0f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7711 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/image/.svn/text-base/TgeneFiles.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/image/.svn/text-base/TgeneFiles.java.svn-base new file mode 100644 index 0000000..685b614 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/image/.svn/text-base/TgeneFiles.java.svn-base @@ -0,0 +1,120 @@ +package com.fp.persistence.pgeneral.image; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEFILES*/ +@Entity(name="TgeneFiles") +@Table(name="TGENEFILES") +public class TgeneFiles extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneFiles +*/ +@Id +@Column(name="CODE" ,nullable=false, updatable=false) +private Integer pk; +/**Contructor por defecto*/ +public TgeneFiles(){ +} +/**Contructor de TgeneFiles +@param pPk Clave Primaria del entity +*/ +public TgeneFiles(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneFiles +*/ +public static TgeneFiles find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneFiles obj = pEntityManager.find(TgeneFiles.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneFiles +@return El objeto que referencia a la Clave primaria de TgeneFiles +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneFiles +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneFiles +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneFiles))return false; + TgeneFiles that = (TgeneFiles) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneFiles +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneFiles +*/ +public Object createInstance(){ + TgeneFiles instance=new TgeneFiles(); + return instance; +} +/**Clona la entidad TgeneFiles +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneFiles p=(TgeneFiles)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/image/.svn/text-base/TgeneFilesDetail.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/image/.svn/text-base/TgeneFilesDetail.java.svn-base new file mode 100644 index 0000000..42b99bc --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/image/.svn/text-base/TgeneFilesDetail.java.svn-base @@ -0,0 +1,325 @@ +package com.fp.persistence.pgeneral.image; + +import java.sql.Timestamp; +import com.fp.dto.hb.Log; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Entity; +import javax.persistence.EmbeddedId; +import javax.persistence.EntityManager; +import javax.persistence.Column; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEFILESDETAIL*/ +@Entity(name="TgeneFilesDetail") +@Table(name="TGENEFILESDETAIL") +public class TgeneFilesDetail extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneFilesDetail +*/ +@EmbeddedId +private TgeneFilesDetailKey pk; +@Column(name="IMAGE", nullable=true) + +/** +* Imagen +*/ +private byte[] image; + +@Column(name="EXTENSION", nullable=true) + +/** +* Extension de la imagen. +*/ +private String extension; + +@Column(name="DATEFROM", nullable=true) + +/** +* Fecha desde la cual esta vigenete el registro de la imagen +*/ +private Timestamp datefrom; + +@Column(name="IMAGESIZE", nullable=true) + +/** +* Tamaño en bytes de la imagen +*/ +private Integer imagesize; + +@Column(name="CAPTUREDATE", nullable=true) + +/** +* Fecha de captura de la imagen. +*/ +private Date capturedate; + +@Column(name="INGRESSUSER", nullable=true) + +/** +* Codigo de usuario que ingreso la imagen +*/ +private String ingressuser; + +@Column(name="MODIFYUSER", nullable=true) + +/** +* Codigo de usuario que modificio la imagen +*/ +private String modifyuser; + +@Column(name="ORIGINCODE", nullable=true) + +/** +* Codigo de imagen +*/ +private Integer origincode; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion +*/ +private String description; + +@Column(name="CONTENTTYPE", nullable=true) + +/** +* Tipo de contenido +*/ +private String contenttype; + +@Column(name="NAME", nullable=true) + +/** +* null +*/ +private String name; + +/**Contructor por defecto*/ +public TgeneFilesDetail(){ +} +/**Contructor de TgeneFilesDetail +@param pPk Clave Primaria del entity +*/ +public TgeneFilesDetail(TgeneFilesDetailKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneFilesDetail +*/ +public static TgeneFilesDetail find(EntityManager pEntityManager,TgeneFilesDetailKey pKey) throws Exception{ + TgeneFilesDetail obj = pEntityManager.find(TgeneFilesDetail.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneFilesDetail +@return El objeto que referencia a la Clave primaria de TgeneFilesDetail +*/ +public TgeneFilesDetailKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneFilesDetail +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneFilesDetail +*/ +public void setPk(TgeneFilesDetailKey pPk){ + pk=pPk; +} +/**Obtiene el valor de image +@return valor de image*/ +public byte[] getImage(){ + return image; +} +/**Fija el valor de image +@param pImage nuevo Valor de image*/ +public void setImage(byte[] pImage){ + image=pImage; +} + +/**Obtiene el valor de extension +@return valor de extension*/ +public String getExtension(){ + return extension; +} +/**Fija el valor de extension +@param pExtension nuevo Valor de extension*/ +public void setExtension(String pExtension){ + extension=pExtension; +} + +/**Obtiene el valor de datefrom +@return valor de datefrom*/ +public Timestamp getDatefrom(){ + return datefrom; +} +/**Fija el valor de datefrom +@param pDatefrom nuevo Valor de datefrom*/ +public void setDatefrom(Timestamp pDatefrom){ + datefrom=pDatefrom; +} + +/**Obtiene el valor de imagesize +@return valor de imagesize*/ +public Integer getImagesize(){ + return imagesize; +} +/**Fija el valor de imagesize +@param pImagesize nuevo Valor de imagesize*/ +public void setImagesize(Integer pImagesize){ + imagesize=pImagesize; +} + +/**Obtiene el valor de capturedate +@return valor de capturedate*/ +public Date getCapturedate(){ + return capturedate; +} +/**Fija el valor de capturedate +@param pCapturedate nuevo Valor de capturedate*/ +public void setCapturedate(Date pCapturedate){ + capturedate=pCapturedate; +} + +/**Obtiene el valor de ingressuser +@return valor de ingressuser*/ +public String getIngressuser(){ + return ingressuser; +} +/**Fija el valor de ingressuser +@param pIngressuser nuevo Valor de ingressuser*/ +public void setIngressuser(String pIngressuser){ + ingressuser=pIngressuser; +} + +/**Obtiene el valor de modifyuser +@return valor de modifyuser*/ +public String getModifyuser(){ + return modifyuser; +} +/**Fija el valor de modifyuser +@param pModifyuser nuevo Valor de modifyuser*/ +public void setModifyuser(String pModifyuser){ + modifyuser=pModifyuser; +} + +/**Obtiene el valor de origincode +@return valor de origincode*/ +public Integer getOrigincode(){ + return origincode; +} +/**Fija el valor de origincode +@param pOrigincode nuevo Valor de origincode*/ +public void setOrigincode(Integer pOrigincode){ + origincode=pOrigincode; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de contenttype +@return valor de contenttype*/ +public String getContenttype(){ + return contenttype; +} +/**Fija el valor de contenttype +@param pContenttype nuevo Valor de contenttype*/ +public void setContenttype(String pContenttype){ + contenttype=pContenttype; +} + +/**Obtiene el valor de name +@return valor de name*/ +public String getName(){ + return name; +} +/**Fija el valor de name +@param pName nuevo Valor de name*/ +public void setName(String pName){ + name=pName; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneFilesDetail))return false; + TgeneFilesDetail that = (TgeneFilesDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneFilesDetail +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneFilesDetail +*/ +public Object createInstance(){ + TgeneFilesDetail instance=new TgeneFilesDetail(); + instance.setPk(new TgeneFilesDetailKey()); + return instance; +} +/**Clona la entidad TgeneFilesDetail +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneFilesDetail p=(TgeneFilesDetail)this.clone(); + p.setPk((TgeneFilesDetailKey)this.pk.cloneMe()); + return p; +} +public Object getId() { + return this.pk; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/image/.svn/text-base/TgeneFilesDetailKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/image/.svn/text-base/TgeneFilesDetailKey.java.svn-base new file mode 100644 index 0000000..321ece4 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/image/.svn/text-base/TgeneFilesDetailKey.java.svn-base @@ -0,0 +1,129 @@ +package com.fp.persistence.pgeneral.image; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEFILESDETAIL*/ +@Embeddable +public class TgeneFilesDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CODE", nullable=false,updatable=false) + +/** +* Codigo de imagen. +*/ +private Integer code; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esrta vigente el registro. +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TgeneFilesDetailKey(){} +/**Contructor de TgeneFilesDetailKey +@param pCode Codigo de imagen. +@param pDateto Fecha hasta la cual esrta vigente el registro. +*/ +public TgeneFilesDetailKey(Integer pCode,Timestamp pDateto){ + code=pCode; + dateto=pDateto; +} +/**Obtiene el valor de code +@return valor de code*/ +public Integer getCode(){ + return code; +} +/**Fija el valor de code +@param pCode nuevo Valor de code*/ +public void setCode(Integer pCode){ + code=pCode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacion de la comparacion de TgeneFilesDetailKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneFilesDetailKey))return false; + TgeneFilesDetailKey that = (TgeneFilesDetailKey) o; + if (this.getCode() == null || that.getCode() == null){ + return false; + } + if (! this.getCode().equals(that.getCode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneFilesDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCode() == null ? 0 : this.getCode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/image/TgeneFiles.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/image/TgeneFiles.java new file mode 100644 index 0000000..685b614 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/image/TgeneFiles.java @@ -0,0 +1,120 @@ +package com.fp.persistence.pgeneral.image; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEFILES*/ +@Entity(name="TgeneFiles") +@Table(name="TGENEFILES") +public class TgeneFiles extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneFiles +*/ +@Id +@Column(name="CODE" ,nullable=false, updatable=false) +private Integer pk; +/**Contructor por defecto*/ +public TgeneFiles(){ +} +/**Contructor de TgeneFiles +@param pPk Clave Primaria del entity +*/ +public TgeneFiles(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneFiles +*/ +public static TgeneFiles find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneFiles obj = pEntityManager.find(TgeneFiles.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneFiles +@return El objeto que referencia a la Clave primaria de TgeneFiles +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneFiles +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneFiles +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneFiles))return false; + TgeneFiles that = (TgeneFiles) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneFiles +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneFiles +*/ +public Object createInstance(){ + TgeneFiles instance=new TgeneFiles(); + return instance; +} +/**Clona la entidad TgeneFiles +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneFiles p=(TgeneFiles)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/image/TgeneFilesDetail.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/image/TgeneFilesDetail.java new file mode 100644 index 0000000..42b99bc --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/image/TgeneFilesDetail.java @@ -0,0 +1,325 @@ +package com.fp.persistence.pgeneral.image; + +import java.sql.Timestamp; +import com.fp.dto.hb.Log; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Entity; +import javax.persistence.EmbeddedId; +import javax.persistence.EntityManager; +import javax.persistence.Column; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEFILESDETAIL*/ +@Entity(name="TgeneFilesDetail") +@Table(name="TGENEFILESDETAIL") +public class TgeneFilesDetail extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneFilesDetail +*/ +@EmbeddedId +private TgeneFilesDetailKey pk; +@Column(name="IMAGE", nullable=true) + +/** +* Imagen +*/ +private byte[] image; + +@Column(name="EXTENSION", nullable=true) + +/** +* Extension de la imagen. +*/ +private String extension; + +@Column(name="DATEFROM", nullable=true) + +/** +* Fecha desde la cual esta vigenete el registro de la imagen +*/ +private Timestamp datefrom; + +@Column(name="IMAGESIZE", nullable=true) + +/** +* Tamaño en bytes de la imagen +*/ +private Integer imagesize; + +@Column(name="CAPTUREDATE", nullable=true) + +/** +* Fecha de captura de la imagen. +*/ +private Date capturedate; + +@Column(name="INGRESSUSER", nullable=true) + +/** +* Codigo de usuario que ingreso la imagen +*/ +private String ingressuser; + +@Column(name="MODIFYUSER", nullable=true) + +/** +* Codigo de usuario que modificio la imagen +*/ +private String modifyuser; + +@Column(name="ORIGINCODE", nullable=true) + +/** +* Codigo de imagen +*/ +private Integer origincode; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion +*/ +private String description; + +@Column(name="CONTENTTYPE", nullable=true) + +/** +* Tipo de contenido +*/ +private String contenttype; + +@Column(name="NAME", nullable=true) + +/** +* null +*/ +private String name; + +/**Contructor por defecto*/ +public TgeneFilesDetail(){ +} +/**Contructor de TgeneFilesDetail +@param pPk Clave Primaria del entity +*/ +public TgeneFilesDetail(TgeneFilesDetailKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneFilesDetail +*/ +public static TgeneFilesDetail find(EntityManager pEntityManager,TgeneFilesDetailKey pKey) throws Exception{ + TgeneFilesDetail obj = pEntityManager.find(TgeneFilesDetail.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneFilesDetail +@return El objeto que referencia a la Clave primaria de TgeneFilesDetail +*/ +public TgeneFilesDetailKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneFilesDetail +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneFilesDetail +*/ +public void setPk(TgeneFilesDetailKey pPk){ + pk=pPk; +} +/**Obtiene el valor de image +@return valor de image*/ +public byte[] getImage(){ + return image; +} +/**Fija el valor de image +@param pImage nuevo Valor de image*/ +public void setImage(byte[] pImage){ + image=pImage; +} + +/**Obtiene el valor de extension +@return valor de extension*/ +public String getExtension(){ + return extension; +} +/**Fija el valor de extension +@param pExtension nuevo Valor de extension*/ +public void setExtension(String pExtension){ + extension=pExtension; +} + +/**Obtiene el valor de datefrom +@return valor de datefrom*/ +public Timestamp getDatefrom(){ + return datefrom; +} +/**Fija el valor de datefrom +@param pDatefrom nuevo Valor de datefrom*/ +public void setDatefrom(Timestamp pDatefrom){ + datefrom=pDatefrom; +} + +/**Obtiene el valor de imagesize +@return valor de imagesize*/ +public Integer getImagesize(){ + return imagesize; +} +/**Fija el valor de imagesize +@param pImagesize nuevo Valor de imagesize*/ +public void setImagesize(Integer pImagesize){ + imagesize=pImagesize; +} + +/**Obtiene el valor de capturedate +@return valor de capturedate*/ +public Date getCapturedate(){ + return capturedate; +} +/**Fija el valor de capturedate +@param pCapturedate nuevo Valor de capturedate*/ +public void setCapturedate(Date pCapturedate){ + capturedate=pCapturedate; +} + +/**Obtiene el valor de ingressuser +@return valor de ingressuser*/ +public String getIngressuser(){ + return ingressuser; +} +/**Fija el valor de ingressuser +@param pIngressuser nuevo Valor de ingressuser*/ +public void setIngressuser(String pIngressuser){ + ingressuser=pIngressuser; +} + +/**Obtiene el valor de modifyuser +@return valor de modifyuser*/ +public String getModifyuser(){ + return modifyuser; +} +/**Fija el valor de modifyuser +@param pModifyuser nuevo Valor de modifyuser*/ +public void setModifyuser(String pModifyuser){ + modifyuser=pModifyuser; +} + +/**Obtiene el valor de origincode +@return valor de origincode*/ +public Integer getOrigincode(){ + return origincode; +} +/**Fija el valor de origincode +@param pOrigincode nuevo Valor de origincode*/ +public void setOrigincode(Integer pOrigincode){ + origincode=pOrigincode; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de contenttype +@return valor de contenttype*/ +public String getContenttype(){ + return contenttype; +} +/**Fija el valor de contenttype +@param pContenttype nuevo Valor de contenttype*/ +public void setContenttype(String pContenttype){ + contenttype=pContenttype; +} + +/**Obtiene el valor de name +@return valor de name*/ +public String getName(){ + return name; +} +/**Fija el valor de name +@param pName nuevo Valor de name*/ +public void setName(String pName){ + name=pName; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneFilesDetail))return false; + TgeneFilesDetail that = (TgeneFilesDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneFilesDetail +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneFilesDetail +*/ +public Object createInstance(){ + TgeneFilesDetail instance=new TgeneFilesDetail(); + instance.setPk(new TgeneFilesDetailKey()); + return instance; +} +/**Clona la entidad TgeneFilesDetail +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneFilesDetail p=(TgeneFilesDetail)this.clone(); + p.setPk((TgeneFilesDetailKey)this.pk.cloneMe()); + return p; +} +public Object getId() { + return this.pk; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/image/TgeneFilesDetailKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/image/TgeneFilesDetailKey.java new file mode 100644 index 0000000..321ece4 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/image/TgeneFilesDetailKey.java @@ -0,0 +1,129 @@ +package com.fp.persistence.pgeneral.image; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEFILESDETAIL*/ +@Embeddable +public class TgeneFilesDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CODE", nullable=false,updatable=false) + +/** +* Codigo de imagen. +*/ +private Integer code; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esrta vigente el registro. +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TgeneFilesDetailKey(){} +/**Contructor de TgeneFilesDetailKey +@param pCode Codigo de imagen. +@param pDateto Fecha hasta la cual esrta vigente el registro. +*/ +public TgeneFilesDetailKey(Integer pCode,Timestamp pDateto){ + code=pCode; + dateto=pDateto; +} +/**Obtiene el valor de code +@return valor de code*/ +public Integer getCode(){ + return code; +} +/**Fija el valor de code +@param pCode nuevo Valor de code*/ +public void setCode(Integer pCode){ + code=pCode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacion de la comparacion de TgeneFilesDetailKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneFilesDetailKey))return false; + TgeneFilesDetailKey that = (TgeneFilesDetailKey) o; + if (this.getCode() == null || that.getCode() == null){ + return false; + } + if (! this.getCode().equals(that.getCode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneFilesDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCode() == null ? 0 : this.getCode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/installment/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/installment/.svn/entries new file mode 100644 index 0000000..51ce799 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/installment/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/installment +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneInstallmentType.java +file + + + + +2022-07-28T03:40:29.618746Z +909cb857a704a5b0e75ef5ff5e74be22 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5137 + +TgeneInstallmentTypeKey.java +file + + + + +2022-07-28T03:40:29.618746Z +a2bdd96f24408cb0e7d66712c452c0c8 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3747 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/installment/.svn/text-base/TgeneInstallmentType.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/installment/.svn/text-base/TgeneInstallmentType.java.svn-base new file mode 100644 index 0000000..7c452cf --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/installment/.svn/text-base/TgeneInstallmentType.java.svn-base @@ -0,0 +1,177 @@ +package com.fp.persistence.pgeneral.installment; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEINSTALLMENTTYPE*/ +@Entity(name="TgeneInstallmentType") +@Table(name="TGENEINSTALLMENTTYPE") +public class TgeneInstallmentType extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneInstallmentType +*/ +@EmbeddedId +private TgeneInstallmentTypeKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion default del tipo de tabla de pagos +*/ +private String description; + +@Column(name="COMMAND", nullable=true) + +/** +* Comando encargado de la generacion de tabla de pagos +*/ +private String command; + +/**Contructor por defecto*/ +public TgeneInstallmentType(){ +} +/**Contructor de TgeneInstallmentType +@param pPk Clave Primaria del entity +*/ +public TgeneInstallmentType(TgeneInstallmentTypeKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneInstallmentType +*/ +public static TgeneInstallmentType find(EntityManager pEntityManager,TgeneInstallmentTypeKey pKey) throws Exception{ + TgeneInstallmentType obj = pEntityManager.find(TgeneInstallmentType.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneInstallmentType +@return El objeto que referencia a la Clave primaria de TgeneInstallmentType +*/ +public TgeneInstallmentTypeKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneInstallmentType +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneInstallmentType +*/ +public void setPk(TgeneInstallmentTypeKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de command +@return valor de command*/ +public String getCommand(){ + return command; +} +/**Fija el valor de command +@param pCommand nuevo Valor de command*/ +public void setCommand(String pCommand){ + command=pCommand; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneInstallmentType))return false; + TgeneInstallmentType that = (TgeneInstallmentType) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneInstallmentType +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneInstallmentType +*/ +public Object createInstance(){ + TgeneInstallmentType instance=new TgeneInstallmentType(); + instance.setPk(new TgeneInstallmentTypeKey()); + return instance; +} +/**Clona la entidad TgeneInstallmentType +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneInstallmentType p=(TgeneInstallmentType)this.clone(); + p.setPk((TgeneInstallmentTypeKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/installment/.svn/text-base/TgeneInstallmentTypeKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/installment/.svn/text-base/TgeneInstallmentTypeKey.java.svn-base new file mode 100644 index 0000000..49fec30 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/installment/.svn/text-base/TgeneInstallmentTypeKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.installment; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEINSTALLMENTTYPE*/ +@Embeddable +public class TgeneInstallmentTypeKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="INSTALLMENTTYPE", nullable=false,updatable=false) + +/** +* Codigo de tipo de tabla de amortizacion +*/ +private String installmenttype; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo asociado al comando de tabla de amortizacion +*/ +private String modulecode; + +/**Contructor por defecto*/ +public TgeneInstallmentTypeKey(){} +/**Contructor de TgeneInstallmentTypeKey +@param pInstallmenttype Codigo de tipo de tabla de amortizacion +@param pModulecode Codigo de modulo asociado al comando de tabla de amortizacion +*/ +public TgeneInstallmentTypeKey(String pInstallmenttype,String pModulecode){ + installmenttype=pInstallmenttype; + modulecode=pModulecode; +} +/**Obtiene el valor de installmenttype +@return valor de installmenttype*/ +public String getInstallmenttype(){ + return installmenttype; +} +/**Fija el valor de installmenttype +@param pInstallmenttype nuevo Valor de installmenttype*/ +public void setInstallmenttype(String pInstallmenttype){ + installmenttype=pInstallmenttype; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Implementacin de la comparacin de TgeneInstallmentTypeKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneInstallmentTypeKey))return false; + TgeneInstallmentTypeKey that = (TgeneInstallmentTypeKey) o; + if (this.getInstallmenttype() == null || that.getInstallmenttype() == null){ + return false; + } + if (! this.getInstallmenttype().equals(that.getInstallmenttype())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneInstallmentTypeKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getInstallmenttype() == null ? 0 : this.getInstallmenttype().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/installment/TgeneInstallmentType.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/installment/TgeneInstallmentType.java new file mode 100644 index 0000000..7c452cf --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/installment/TgeneInstallmentType.java @@ -0,0 +1,177 @@ +package com.fp.persistence.pgeneral.installment; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEINSTALLMENTTYPE*/ +@Entity(name="TgeneInstallmentType") +@Table(name="TGENEINSTALLMENTTYPE") +public class TgeneInstallmentType extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneInstallmentType +*/ +@EmbeddedId +private TgeneInstallmentTypeKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion default del tipo de tabla de pagos +*/ +private String description; + +@Column(name="COMMAND", nullable=true) + +/** +* Comando encargado de la generacion de tabla de pagos +*/ +private String command; + +/**Contructor por defecto*/ +public TgeneInstallmentType(){ +} +/**Contructor de TgeneInstallmentType +@param pPk Clave Primaria del entity +*/ +public TgeneInstallmentType(TgeneInstallmentTypeKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneInstallmentType +*/ +public static TgeneInstallmentType find(EntityManager pEntityManager,TgeneInstallmentTypeKey pKey) throws Exception{ + TgeneInstallmentType obj = pEntityManager.find(TgeneInstallmentType.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneInstallmentType +@return El objeto que referencia a la Clave primaria de TgeneInstallmentType +*/ +public TgeneInstallmentTypeKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneInstallmentType +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneInstallmentType +*/ +public void setPk(TgeneInstallmentTypeKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de command +@return valor de command*/ +public String getCommand(){ + return command; +} +/**Fija el valor de command +@param pCommand nuevo Valor de command*/ +public void setCommand(String pCommand){ + command=pCommand; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneInstallmentType))return false; + TgeneInstallmentType that = (TgeneInstallmentType) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneInstallmentType +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneInstallmentType +*/ +public Object createInstance(){ + TgeneInstallmentType instance=new TgeneInstallmentType(); + instance.setPk(new TgeneInstallmentTypeKey()); + return instance; +} +/**Clona la entidad TgeneInstallmentType +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneInstallmentType p=(TgeneInstallmentType)this.clone(); + p.setPk((TgeneInstallmentTypeKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/installment/TgeneInstallmentTypeKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/installment/TgeneInstallmentTypeKey.java new file mode 100644 index 0000000..49fec30 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/installment/TgeneInstallmentTypeKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.installment; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEINSTALLMENTTYPE*/ +@Embeddable +public class TgeneInstallmentTypeKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="INSTALLMENTTYPE", nullable=false,updatable=false) + +/** +* Codigo de tipo de tabla de amortizacion +*/ +private String installmenttype; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo asociado al comando de tabla de amortizacion +*/ +private String modulecode; + +/**Contructor por defecto*/ +public TgeneInstallmentTypeKey(){} +/**Contructor de TgeneInstallmentTypeKey +@param pInstallmenttype Codigo de tipo de tabla de amortizacion +@param pModulecode Codigo de modulo asociado al comando de tabla de amortizacion +*/ +public TgeneInstallmentTypeKey(String pInstallmenttype,String pModulecode){ + installmenttype=pInstallmenttype; + modulecode=pModulecode; +} +/**Obtiene el valor de installmenttype +@return valor de installmenttype*/ +public String getInstallmenttype(){ + return installmenttype; +} +/**Fija el valor de installmenttype +@param pInstallmenttype nuevo Valor de installmenttype*/ +public void setInstallmenttype(String pInstallmenttype){ + installmenttype=pInstallmenttype; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Implementacin de la comparacin de TgeneInstallmentTypeKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneInstallmentTypeKey))return false; + TgeneInstallmentTypeKey that = (TgeneInstallmentTypeKey) o; + if (this.getInstallmenttype() == null || that.getInstallmenttype() == null){ + return false; + } + if (! this.getInstallmenttype().equals(that.getInstallmenttype())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneInstallmentTypeKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getInstallmenttype() == null ? 0 : this.getInstallmenttype().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/log/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/log/.svn/entries new file mode 100644 index 0000000..bd32ba5 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/log/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/log +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneTransactionLog.java +file + + + + +2022-07-28T03:40:29.184744Z +11c3f99302aed2f1f6b1673d5eac9265 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +13098 + +TgeneTransactionMessage.java +file + + + + +2022-07-28T03:40:29.184744Z +63716847148e1915fd2bb40152ac4fa6 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4506 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/log/.svn/text-base/TgeneTransactionLog.java.netbeans-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/log/.svn/text-base/TgeneTransactionLog.java.netbeans-base new file mode 100644 index 0000000..29f0b9c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/log/.svn/text-base/TgeneTransactionLog.java.netbeans-base @@ -0,0 +1,507 @@ +package com.fp.persistence.pgeneral.log; + +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONLOG*/ +@Entity(name="TgeneTransactionLog") +@Table(name="TGENETRANSACTIONLOG") +public class TgeneTransactionLog extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransactionLog +*/ +@Id +@Column(name="JOURNALID" ,nullable=false, updatable=false) +private String pk; +@Column(name="TRANSACTIONMODULE", nullable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="ACCOUNTINGDATE", nullable=true) + +/** +* Fecha contable en la que se ejecuta la transaccion +*/ +private Date accountingdate; + +@Column(name="SERVER", nullable=true) + +/** +* Nombre del servidor de applicaicones desde el cual se ejecuta una transaccion +*/ +private String server; + +@Column(name="REALDATE", nullable=true) + +/** +* Fecha real de ejecucion de una transaccion +*/ +private Timestamp realdate; + +@Column(name="COMPANYCODE", nullable=true) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="BRANCHCODE", nullable=true) + +/** +* Codigo de sucursal de ejecucion de la transaccion. +*/ +private Integer branchcode; + +@Column(name="OFFICECODE", nullable=true) + +/** +* Codigo de oficina de ejecucion de la transaccion +*/ +private Integer officecode; + +@Column(name="TERMINALCODE", nullable=true) + +/** +* Codigo de terminal desde el cual se ejecuto la transaccion. +*/ +private String terminalcode; + +@Column(name="USERCODE", nullable=true) + +/** +* Codigo de usuario que ejecuta la transaccion +*/ +private String usercode; + +@Column(name="DURATION", nullable=true) + +/** +* Tiempo que toma la ejeciucion de la transaccion +*/ +private BigDecimal duration; + +@Column(name="RESULTCODE", nullable=true) + +/** +* Codigo de resultado de ejecucion de la transaccion. +*/ +private String resultcode; + +@Column(name="USERMESSAGE", nullable=true) + +/** +* Mensaje de usuario resultado de la ejecucion de la transaccion. +*/ +private String usermessage; + +@Column(name="ACCOUNT", nullable=true) + +/** +* Numero de cuenta que se afecta en una transaccion +*/ +private String account; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona asociado a la cuenta +*/ +private Integer personcode; + +@Column(name="SOLICITUDENUMBER", nullable=true) + +/** +* Nuemero de solicitud +*/ +private String solicitudenumber; + +@Column(name="METHOD", nullable=true) + +/** +* Metod que origina la ejecucion de la transaccion, Save, Query, Reporte +*/ +private String method; + +@Column(name="ADITIONALDATA", nullable=true) + +/** +* Texto libre +*/ +private String aditionaldata; + +@Column(name="BROWSER", nullable=true) + +/** +* Navegador de trabajo +*/ +private String browser; + +@Column(name="OPERATIVSYSTEM", nullable=true) + +/** +* Sistema operativo de la mquina cliente +*/ +private String operativsystem; + +/**Contructor por defecto*/ +public TgeneTransactionLog(){ +} +/**Contructor de TgeneTransactionLog +@param pPk Clave Primaria del entity +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +*/ +public TgeneTransactionLog(String pPk,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion){ + this(); + pk=pPk; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionLog +*/ +public static TgeneTransactionLog find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneTransactionLog obj = pEntityManager.find(TgeneTransactionLog.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionLog +@return El objeto que referencia a la Clave primaria de TgeneTransactionLog +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionLog +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionLog +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de accountingdate +@return valor de accountingdate*/ +public Date getAccountingdate(){ + return accountingdate; +} +/**Fija el valor de accountingdate +@param pAccountingdate nuevo Valor de accountingdate*/ +public void setAccountingdate(Date pAccountingdate){ + accountingdate=pAccountingdate; +} + +/**Obtiene el valor de server +@return valor de server*/ +public String getServer(){ + return server; +} +/**Fija el valor de server +@param pServer nuevo Valor de server*/ +public void setServer(String pServer){ + server=pServer; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Timestamp getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Timestamp pRealdate){ + realdate=pRealdate; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de terminalcode +@return valor de terminalcode*/ +public String getTerminalcode(){ + return terminalcode; +} +/**Fija el valor de terminalcode +@param pTerminalcode nuevo Valor de terminalcode*/ +public void setTerminalcode(String pTerminalcode){ + terminalcode=pTerminalcode; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de duration +@return valor de duration*/ +public BigDecimal getDuration(){ + return duration; +} +/**Fija el valor de duration +@param pDuration nuevo Valor de duration*/ +public void setDuration(BigDecimal pDuration){ + duration=pDuration; +} + +/**Obtiene el valor de resultcode +@return valor de resultcode*/ +public String getResultcode(){ + return resultcode; +} +/**Fija el valor de resultcode +@param pResultcode nuevo Valor de resultcode*/ +public void setResultcode(String pResultcode){ + resultcode=pResultcode; +} + +/**Obtiene el valor de usermessage +@return valor de usermessage*/ +public String getUsermessage(){ + return usermessage; +} +/**Fija el valor de usermessage +@param pUsermessage nuevo Valor de usermessage*/ +public void setUsermessage(String pUsermessage){ + usermessage=pUsermessage; +} + +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de solicitudenumber +@return valor de solicitudenumber*/ +public String getSolicitudenumber(){ + return solicitudenumber; +} +/**Fija el valor de solicitudenumber +@param pSolicitudenumber nuevo Valor de solicitudenumber*/ +public void setSolicitudenumber(String pSolicitudenumber){ + solicitudenumber=pSolicitudenumber; +} + +/**Obtiene el valor de method +@return valor de method*/ +public String getMethod(){ + return method; +} +/**Fija el valor de method +@param pMethod nuevo Valor de method*/ +public void setMethod(String pMethod){ + method=pMethod; +} + +/**Obtiene el valor de aditionaldata +@return valor de aditionaldata*/ +public String getAditionaldata(){ + return aditionaldata; +} +/**Fija el valor de aditionaldata +@param pAditionaldata nuevo Valor de aditionaldata*/ +public void setAditionaldata(String pAditionaldata){ + aditionaldata=pAditionaldata; +} + +/**Obtiene el valor de browser +@return valor de browser*/ +public String getBrowser(){ + return browser; +} +/**Fija el valor de browser +@param pBrowser nuevo Valor de browser*/ +public void setBrowser(String pBrowser){ + browser=pBrowser; +} + +/**Obtiene el valor de operativsystem +@return valor de operativsystem*/ +public String getOperativsystem(){ + return operativsystem; +} +/**Fija el valor de operativsystem +@param pOperativsystem nuevo Valor de operativsystem*/ +public void setOperativsystem(String pOperativsystem){ + operativsystem=pOperativsystem; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionLog))return false; + TgeneTransactionLog that = (TgeneTransactionLog) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneTransactionLog +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneTransactionLog +*/ +public Object createInstance(){ + TgeneTransactionLog instance=new TgeneTransactionLog(); + return instance; +} +/**Clona la entidad TgeneTransactionLog +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionLog p=(TgeneTransactionLog)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/log/.svn/text-base/TgeneTransactionLog.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/log/.svn/text-base/TgeneTransactionLog.java.svn-base new file mode 100644 index 0000000..29f0b9c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/log/.svn/text-base/TgeneTransactionLog.java.svn-base @@ -0,0 +1,507 @@ +package com.fp.persistence.pgeneral.log; + +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONLOG*/ +@Entity(name="TgeneTransactionLog") +@Table(name="TGENETRANSACTIONLOG") +public class TgeneTransactionLog extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransactionLog +*/ +@Id +@Column(name="JOURNALID" ,nullable=false, updatable=false) +private String pk; +@Column(name="TRANSACTIONMODULE", nullable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="ACCOUNTINGDATE", nullable=true) + +/** +* Fecha contable en la que se ejecuta la transaccion +*/ +private Date accountingdate; + +@Column(name="SERVER", nullable=true) + +/** +* Nombre del servidor de applicaicones desde el cual se ejecuta una transaccion +*/ +private String server; + +@Column(name="REALDATE", nullable=true) + +/** +* Fecha real de ejecucion de una transaccion +*/ +private Timestamp realdate; + +@Column(name="COMPANYCODE", nullable=true) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="BRANCHCODE", nullable=true) + +/** +* Codigo de sucursal de ejecucion de la transaccion. +*/ +private Integer branchcode; + +@Column(name="OFFICECODE", nullable=true) + +/** +* Codigo de oficina de ejecucion de la transaccion +*/ +private Integer officecode; + +@Column(name="TERMINALCODE", nullable=true) + +/** +* Codigo de terminal desde el cual se ejecuto la transaccion. +*/ +private String terminalcode; + +@Column(name="USERCODE", nullable=true) + +/** +* Codigo de usuario que ejecuta la transaccion +*/ +private String usercode; + +@Column(name="DURATION", nullable=true) + +/** +* Tiempo que toma la ejeciucion de la transaccion +*/ +private BigDecimal duration; + +@Column(name="RESULTCODE", nullable=true) + +/** +* Codigo de resultado de ejecucion de la transaccion. +*/ +private String resultcode; + +@Column(name="USERMESSAGE", nullable=true) + +/** +* Mensaje de usuario resultado de la ejecucion de la transaccion. +*/ +private String usermessage; + +@Column(name="ACCOUNT", nullable=true) + +/** +* Numero de cuenta que se afecta en una transaccion +*/ +private String account; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona asociado a la cuenta +*/ +private Integer personcode; + +@Column(name="SOLICITUDENUMBER", nullable=true) + +/** +* Nuemero de solicitud +*/ +private String solicitudenumber; + +@Column(name="METHOD", nullable=true) + +/** +* Metod que origina la ejecucion de la transaccion, Save, Query, Reporte +*/ +private String method; + +@Column(name="ADITIONALDATA", nullable=true) + +/** +* Texto libre +*/ +private String aditionaldata; + +@Column(name="BROWSER", nullable=true) + +/** +* Navegador de trabajo +*/ +private String browser; + +@Column(name="OPERATIVSYSTEM", nullable=true) + +/** +* Sistema operativo de la mquina cliente +*/ +private String operativsystem; + +/**Contructor por defecto*/ +public TgeneTransactionLog(){ +} +/**Contructor de TgeneTransactionLog +@param pPk Clave Primaria del entity +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +*/ +public TgeneTransactionLog(String pPk,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion){ + this(); + pk=pPk; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionLog +*/ +public static TgeneTransactionLog find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneTransactionLog obj = pEntityManager.find(TgeneTransactionLog.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionLog +@return El objeto que referencia a la Clave primaria de TgeneTransactionLog +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionLog +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionLog +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de accountingdate +@return valor de accountingdate*/ +public Date getAccountingdate(){ + return accountingdate; +} +/**Fija el valor de accountingdate +@param pAccountingdate nuevo Valor de accountingdate*/ +public void setAccountingdate(Date pAccountingdate){ + accountingdate=pAccountingdate; +} + +/**Obtiene el valor de server +@return valor de server*/ +public String getServer(){ + return server; +} +/**Fija el valor de server +@param pServer nuevo Valor de server*/ +public void setServer(String pServer){ + server=pServer; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Timestamp getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Timestamp pRealdate){ + realdate=pRealdate; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de terminalcode +@return valor de terminalcode*/ +public String getTerminalcode(){ + return terminalcode; +} +/**Fija el valor de terminalcode +@param pTerminalcode nuevo Valor de terminalcode*/ +public void setTerminalcode(String pTerminalcode){ + terminalcode=pTerminalcode; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de duration +@return valor de duration*/ +public BigDecimal getDuration(){ + return duration; +} +/**Fija el valor de duration +@param pDuration nuevo Valor de duration*/ +public void setDuration(BigDecimal pDuration){ + duration=pDuration; +} + +/**Obtiene el valor de resultcode +@return valor de resultcode*/ +public String getResultcode(){ + return resultcode; +} +/**Fija el valor de resultcode +@param pResultcode nuevo Valor de resultcode*/ +public void setResultcode(String pResultcode){ + resultcode=pResultcode; +} + +/**Obtiene el valor de usermessage +@return valor de usermessage*/ +public String getUsermessage(){ + return usermessage; +} +/**Fija el valor de usermessage +@param pUsermessage nuevo Valor de usermessage*/ +public void setUsermessage(String pUsermessage){ + usermessage=pUsermessage; +} + +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de solicitudenumber +@return valor de solicitudenumber*/ +public String getSolicitudenumber(){ + return solicitudenumber; +} +/**Fija el valor de solicitudenumber +@param pSolicitudenumber nuevo Valor de solicitudenumber*/ +public void setSolicitudenumber(String pSolicitudenumber){ + solicitudenumber=pSolicitudenumber; +} + +/**Obtiene el valor de method +@return valor de method*/ +public String getMethod(){ + return method; +} +/**Fija el valor de method +@param pMethod nuevo Valor de method*/ +public void setMethod(String pMethod){ + method=pMethod; +} + +/**Obtiene el valor de aditionaldata +@return valor de aditionaldata*/ +public String getAditionaldata(){ + return aditionaldata; +} +/**Fija el valor de aditionaldata +@param pAditionaldata nuevo Valor de aditionaldata*/ +public void setAditionaldata(String pAditionaldata){ + aditionaldata=pAditionaldata; +} + +/**Obtiene el valor de browser +@return valor de browser*/ +public String getBrowser(){ + return browser; +} +/**Fija el valor de browser +@param pBrowser nuevo Valor de browser*/ +public void setBrowser(String pBrowser){ + browser=pBrowser; +} + +/**Obtiene el valor de operativsystem +@return valor de operativsystem*/ +public String getOperativsystem(){ + return operativsystem; +} +/**Fija el valor de operativsystem +@param pOperativsystem nuevo Valor de operativsystem*/ +public void setOperativsystem(String pOperativsystem){ + operativsystem=pOperativsystem; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionLog))return false; + TgeneTransactionLog that = (TgeneTransactionLog) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneTransactionLog +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneTransactionLog +*/ +public Object createInstance(){ + TgeneTransactionLog instance=new TgeneTransactionLog(); + return instance; +} +/**Clona la entidad TgeneTransactionLog +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionLog p=(TgeneTransactionLog)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/log/.svn/text-base/TgeneTransactionMessage.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/log/.svn/text-base/TgeneTransactionMessage.java.svn-base new file mode 100644 index 0000000..02702e8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/log/.svn/text-base/TgeneTransactionMessage.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pgeneral.log; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONMESSAGE*/ +@Entity(name="TgeneTransactionMessage") +@Table(name="TGENETRANSACTIONMESSAGE") +public class TgeneTransactionMessage extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransactionMessage +*/ +@Id +@Column(name="JOURNALID" ,nullable=false, updatable=false) +private String pk; +@Column(name="DATAIN", nullable=true) + +/** +* Datos de entrada de ejecucion de la transaccion. +*/ +private String datain; + +@Column(name="DATAOUT", nullable=true) + +/** +* Datos de salida resltado de la ejecucion de la transaccion. +*/ +private String dataout; + +/**Contructor por defecto*/ +public TgeneTransactionMessage(){ +} +/**Contructor de TgeneTransactionMessage +@param pPk Clave Primaria del entity +*/ +public TgeneTransactionMessage(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionMessage +*/ +public static TgeneTransactionMessage find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneTransactionMessage obj = pEntityManager.find(TgeneTransactionMessage.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionMessage +@return El objeto que referencia a la Clave primaria de TgeneTransactionMessage +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionMessage +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionMessage +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de datain +@return valor de datain*/ +public String getDatain(){ + return datain; +} +/**Fija el valor de datain +@param pDatain nuevo Valor de datain*/ +public void setDatain(String pDatain){ + datain=pDatain; +} + +/**Obtiene el valor de dataout +@return valor de dataout*/ +public String getDataout(){ + return dataout; +} +/**Fija el valor de dataout +@param pDataout nuevo Valor de dataout*/ +public void setDataout(String pDataout){ + dataout=pDataout; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionMessage))return false; + TgeneTransactionMessage that = (TgeneTransactionMessage) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTransactionMessage +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTransactionMessage +*/ +public Object createInstance(){ + TgeneTransactionMessage instance=new TgeneTransactionMessage(); + return instance; +} +/**Clona la entidad TgeneTransactionMessage +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionMessage p=(TgeneTransactionMessage)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/log/TgeneTransactionLog.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/log/TgeneTransactionLog.java new file mode 100644 index 0000000..29f0b9c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/log/TgeneTransactionLog.java @@ -0,0 +1,507 @@ +package com.fp.persistence.pgeneral.log; + +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONLOG*/ +@Entity(name="TgeneTransactionLog") +@Table(name="TGENETRANSACTIONLOG") +public class TgeneTransactionLog extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransactionLog +*/ +@Id +@Column(name="JOURNALID" ,nullable=false, updatable=false) +private String pk; +@Column(name="TRANSACTIONMODULE", nullable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="ACCOUNTINGDATE", nullable=true) + +/** +* Fecha contable en la que se ejecuta la transaccion +*/ +private Date accountingdate; + +@Column(name="SERVER", nullable=true) + +/** +* Nombre del servidor de applicaicones desde el cual se ejecuta una transaccion +*/ +private String server; + +@Column(name="REALDATE", nullable=true) + +/** +* Fecha real de ejecucion de una transaccion +*/ +private Timestamp realdate; + +@Column(name="COMPANYCODE", nullable=true) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="BRANCHCODE", nullable=true) + +/** +* Codigo de sucursal de ejecucion de la transaccion. +*/ +private Integer branchcode; + +@Column(name="OFFICECODE", nullable=true) + +/** +* Codigo de oficina de ejecucion de la transaccion +*/ +private Integer officecode; + +@Column(name="TERMINALCODE", nullable=true) + +/** +* Codigo de terminal desde el cual se ejecuto la transaccion. +*/ +private String terminalcode; + +@Column(name="USERCODE", nullable=true) + +/** +* Codigo de usuario que ejecuta la transaccion +*/ +private String usercode; + +@Column(name="DURATION", nullable=true) + +/** +* Tiempo que toma la ejeciucion de la transaccion +*/ +private BigDecimal duration; + +@Column(name="RESULTCODE", nullable=true) + +/** +* Codigo de resultado de ejecucion de la transaccion. +*/ +private String resultcode; + +@Column(name="USERMESSAGE", nullable=true) + +/** +* Mensaje de usuario resultado de la ejecucion de la transaccion. +*/ +private String usermessage; + +@Column(name="ACCOUNT", nullable=true) + +/** +* Numero de cuenta que se afecta en una transaccion +*/ +private String account; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona asociado a la cuenta +*/ +private Integer personcode; + +@Column(name="SOLICITUDENUMBER", nullable=true) + +/** +* Nuemero de solicitud +*/ +private String solicitudenumber; + +@Column(name="METHOD", nullable=true) + +/** +* Metod que origina la ejecucion de la transaccion, Save, Query, Reporte +*/ +private String method; + +@Column(name="ADITIONALDATA", nullable=true) + +/** +* Texto libre +*/ +private String aditionaldata; + +@Column(name="BROWSER", nullable=true) + +/** +* Navegador de trabajo +*/ +private String browser; + +@Column(name="OPERATIVSYSTEM", nullable=true) + +/** +* Sistema operativo de la mquina cliente +*/ +private String operativsystem; + +/**Contructor por defecto*/ +public TgeneTransactionLog(){ +} +/**Contructor de TgeneTransactionLog +@param pPk Clave Primaria del entity +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +*/ +public TgeneTransactionLog(String pPk,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion){ + this(); + pk=pPk; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionLog +*/ +public static TgeneTransactionLog find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneTransactionLog obj = pEntityManager.find(TgeneTransactionLog.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionLog +@return El objeto que referencia a la Clave primaria de TgeneTransactionLog +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionLog +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionLog +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de accountingdate +@return valor de accountingdate*/ +public Date getAccountingdate(){ + return accountingdate; +} +/**Fija el valor de accountingdate +@param pAccountingdate nuevo Valor de accountingdate*/ +public void setAccountingdate(Date pAccountingdate){ + accountingdate=pAccountingdate; +} + +/**Obtiene el valor de server +@return valor de server*/ +public String getServer(){ + return server; +} +/**Fija el valor de server +@param pServer nuevo Valor de server*/ +public void setServer(String pServer){ + server=pServer; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Timestamp getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Timestamp pRealdate){ + realdate=pRealdate; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de terminalcode +@return valor de terminalcode*/ +public String getTerminalcode(){ + return terminalcode; +} +/**Fija el valor de terminalcode +@param pTerminalcode nuevo Valor de terminalcode*/ +public void setTerminalcode(String pTerminalcode){ + terminalcode=pTerminalcode; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de duration +@return valor de duration*/ +public BigDecimal getDuration(){ + return duration; +} +/**Fija el valor de duration +@param pDuration nuevo Valor de duration*/ +public void setDuration(BigDecimal pDuration){ + duration=pDuration; +} + +/**Obtiene el valor de resultcode +@return valor de resultcode*/ +public String getResultcode(){ + return resultcode; +} +/**Fija el valor de resultcode +@param pResultcode nuevo Valor de resultcode*/ +public void setResultcode(String pResultcode){ + resultcode=pResultcode; +} + +/**Obtiene el valor de usermessage +@return valor de usermessage*/ +public String getUsermessage(){ + return usermessage; +} +/**Fija el valor de usermessage +@param pUsermessage nuevo Valor de usermessage*/ +public void setUsermessage(String pUsermessage){ + usermessage=pUsermessage; +} + +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de solicitudenumber +@return valor de solicitudenumber*/ +public String getSolicitudenumber(){ + return solicitudenumber; +} +/**Fija el valor de solicitudenumber +@param pSolicitudenumber nuevo Valor de solicitudenumber*/ +public void setSolicitudenumber(String pSolicitudenumber){ + solicitudenumber=pSolicitudenumber; +} + +/**Obtiene el valor de method +@return valor de method*/ +public String getMethod(){ + return method; +} +/**Fija el valor de method +@param pMethod nuevo Valor de method*/ +public void setMethod(String pMethod){ + method=pMethod; +} + +/**Obtiene el valor de aditionaldata +@return valor de aditionaldata*/ +public String getAditionaldata(){ + return aditionaldata; +} +/**Fija el valor de aditionaldata +@param pAditionaldata nuevo Valor de aditionaldata*/ +public void setAditionaldata(String pAditionaldata){ + aditionaldata=pAditionaldata; +} + +/**Obtiene el valor de browser +@return valor de browser*/ +public String getBrowser(){ + return browser; +} +/**Fija el valor de browser +@param pBrowser nuevo Valor de browser*/ +public void setBrowser(String pBrowser){ + browser=pBrowser; +} + +/**Obtiene el valor de operativsystem +@return valor de operativsystem*/ +public String getOperativsystem(){ + return operativsystem; +} +/**Fija el valor de operativsystem +@param pOperativsystem nuevo Valor de operativsystem*/ +public void setOperativsystem(String pOperativsystem){ + operativsystem=pOperativsystem; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionLog))return false; + TgeneTransactionLog that = (TgeneTransactionLog) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneTransactionLog +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneTransactionLog +*/ +public Object createInstance(){ + TgeneTransactionLog instance=new TgeneTransactionLog(); + return instance; +} +/**Clona la entidad TgeneTransactionLog +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionLog p=(TgeneTransactionLog)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/log/TgeneTransactionMessage.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/log/TgeneTransactionMessage.java new file mode 100644 index 0000000..02702e8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/log/TgeneTransactionMessage.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pgeneral.log; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONMESSAGE*/ +@Entity(name="TgeneTransactionMessage") +@Table(name="TGENETRANSACTIONMESSAGE") +public class TgeneTransactionMessage extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransactionMessage +*/ +@Id +@Column(name="JOURNALID" ,nullable=false, updatable=false) +private String pk; +@Column(name="DATAIN", nullable=true) + +/** +* Datos de entrada de ejecucion de la transaccion. +*/ +private String datain; + +@Column(name="DATAOUT", nullable=true) + +/** +* Datos de salida resltado de la ejecucion de la transaccion. +*/ +private String dataout; + +/**Contructor por defecto*/ +public TgeneTransactionMessage(){ +} +/**Contructor de TgeneTransactionMessage +@param pPk Clave Primaria del entity +*/ +public TgeneTransactionMessage(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionMessage +*/ +public static TgeneTransactionMessage find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneTransactionMessage obj = pEntityManager.find(TgeneTransactionMessage.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionMessage +@return El objeto que referencia a la Clave primaria de TgeneTransactionMessage +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionMessage +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionMessage +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de datain +@return valor de datain*/ +public String getDatain(){ + return datain; +} +/**Fija el valor de datain +@param pDatain nuevo Valor de datain*/ +public void setDatain(String pDatain){ + datain=pDatain; +} + +/**Obtiene el valor de dataout +@return valor de dataout*/ +public String getDataout(){ + return dataout; +} +/**Fija el valor de dataout +@param pDataout nuevo Valor de dataout*/ +public void setDataout(String pDataout){ + dataout=pDataout; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionMessage))return false; + TgeneTransactionMessage that = (TgeneTransactionMessage) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTransactionMessage +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTransactionMessage +*/ +public Object createInstance(){ + TgeneTransactionMessage instance=new TgeneTransactionMessage(); + return instance; +} +/**Clona la entidad TgeneTransactionMessage +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionMessage p=(TgeneTransactionMessage)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/entries new file mode 100644 index 0000000..b397094 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/entries @@ -0,0 +1,504 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneMenuLevel.java +file + + + + +2022-07-28T03:40:29.878747Z +8d99c2d2ec15ea0dfb12c99d21a02025 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5642 + +TgeneMenuSubLevelDescKey.java +file + + + + +2022-07-28T03:40:29.878747Z +2dc09053e6bbb25e59001585efa17da0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4988 + +TgeneMenuSubLevelKey.java +file + + + + +2022-07-28T03:40:29.879747Z +519adb8d46309bde3934a8cdcc7826c5 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4137 + +TgeneMenuLevelTran.java +file + + + + +2022-07-28T03:40:29.879747Z +4552248552bf21cdca23f6b28261e247 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5553 + +TgeneMenu.java +file + + + + +2022-07-28T03:40:29.879747Z +21b49a99053658ce3102af917b66308d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3800 + +TgeneMenuLevelDescKey.java +file + + + + +2022-07-28T03:40:29.879747Z +031a9b5c73bf129517b737fe190d6199 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4231 + +TgeneMenuSubLevelTranKey.java +file + + + + +2022-07-28T03:40:29.880747Z +a192e9d188fdbc9bb9b6579af6ad88b4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7040 + +TgeneMenuLevelKey.java +file + + + + +2022-07-28T03:40:29.880747Z +698a2e9cce3b76b80972529c3bcca8a9 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3382 + +TgeneMenuProfile.java +file + + + + +2022-07-28T03:40:29.880747Z +50c6a634c55de54b3e52ad75f19c89e5 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4819 + +TgeneMenuSubLevelDesc.java +file + + + + +2022-07-28T03:40:29.880747Z +cd2b63de13fc510dbb88219b9bbe767d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6160 + +TgeneMenuSubLevel.java +file + + + + +2022-07-28T03:40:29.881747Z +faaea36cb2bddca4194d2434e522a7d4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5436 + +TgeneMenuLevelTranKey.java +file + + + + +2022-07-28T03:40:29.881747Z +0bdd68692dc3d59891bb08ae94ccd318 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6285 + +TgeneMenuLevelDesc.java +file + + + + +2022-07-28T03:40:29.881747Z +15401ee00c6488129d7becd84a246ac4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5890 + +TgeneMenuSubLevelTran.java +file + + + + +2022-07-28T03:40:29.881747Z +6ee4550dab295494f1d67b5224bc3d43 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4336 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenu.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenu.java.svn-base new file mode 100644 index 0000000..664a97e --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenu.java.svn-base @@ -0,0 +1,138 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMENU*/ +@Entity(name="TgeneMenu") +@Table(name="TGENEMENU") +public class TgeneMenu extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneMenu +*/ +@Id +@Column(name="MENUCODE" ,nullable=false, updatable=false) +private Integer pk; +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion default del menu +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneMenu(){ +} +/**Contructor de TgeneMenu +@param pPk Clave Primaria del entity +*/ +public TgeneMenu(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneMenu +*/ +public static TgeneMenu find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneMenu obj = pEntityManager.find(TgeneMenu.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneMenu +@return El objeto que referencia a la Clave primaria de TgeneMenu +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneMenu +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneMenu +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneMenu))return false; + TgeneMenu that = (TgeneMenu) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneMenu +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneMenu +*/ +public Object createInstance(){ + TgeneMenu instance=new TgeneMenu(); + return instance; +} +/**Clona la entidad TgeneMenu +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneMenu p=(TgeneMenu)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuLevel.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuLevel.java.svn-base new file mode 100644 index 0000000..8aa43f1 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuLevel.java.svn-base @@ -0,0 +1,186 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.core.exception.CoreException; +import com.fp.dto.hb.HibernateBean; +import com.fp.persistence.commondb.exception.CommondbException; + +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMENULEVEL*/ +@Entity(name="TgeneMenuLevel") +@Table(name="TGENEMENULEVEL") +public class TgeneMenuLevel extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneMenuLevel +*/ +@EmbeddedId +private TgeneMenuLevelKey pk; +@Column(name="PRESENTATIONORDER", nullable=true) + +/** +* Orden de presentacion de la agrupacion en el primer nivel del menu +*/ +private Integer presentationorder; + +@Column(name="HAVESUBLEVEL", nullable=true) + +/** +* Y, Indica que tiene un subnivel de menu. +*/ +private String havesublevel; + +/**Contructor por defecto*/ +public TgeneMenuLevel(){ +} +/**Contructor de TgeneMenuLevel +@param pPk Clave Primaria del entity +*/ +public TgeneMenuLevel(TgeneMenuLevelKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneMenuLevel +*/ +public static TgeneMenuLevel find(EntityManager pEntityManager,TgeneMenuLevelKey pKey) throws Exception{ + TgeneMenuLevel obj = pEntityManager.find(TgeneMenuLevel.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneMenuLevel +@return El objeto que referencia a la Clave primaria de TgeneMenuLevel +*/ +public TgeneMenuLevelKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneMenuLevel +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneMenuLevel +*/ +public void setPk(TgeneMenuLevelKey pPk){ + pk=pPk; +} +/**Obtiene el valor de presentationorder +@return valor de presentationorder*/ +public Integer getPresentationorder(){ + return presentationorder; +} +/**Fija el valor de presentationorder +@param pPresentationorder nuevo Valor de presentationorder*/ +public void setPresentationorder(Integer pPresentationorder){ + presentationorder=pPresentationorder; +} + +/**Obtiene el valor de havesublevel +@return valor de havesublevel*/ +public String getHavesublevel(){ + return havesublevel; +} +/**Fija el valor de havesublevel +@param pHavesublevel nuevo Valor de havesublevel*/ +public void setHavesublevel(String pHavesublevel){ + havesublevel=pHavesublevel; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneMenuLevel))return false; + TgeneMenuLevel that = (TgeneMenuLevel) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneMenuLevel +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneMenuLevel +*/ +public Object createInstance(){ + TgeneMenuLevel instance=new TgeneMenuLevel(); + instance.setPk(new TgeneMenuLevelKey()); + return instance; +} +/**Clona la entidad TgeneMenuLevel +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneMenuLevel p=(TgeneMenuLevel)this.clone(); + p.setPk((TgeneMenuLevelKey)this.pk.cloneMe()); + return p; +} + + //METODOS MANUALES + /** Sentencia que devuelve un registro de TgeneMenuLevel. */ + private static final String JPQL_MENU_LEVEL = "from TgeneMenuLevel tmg " + " where tmg.pk.menucode = :menucode" + + " order by tmg.presentationorder "; + /** + * Metodo que entrega la definicion del primer nivel del menu. + * + * @param pMenucode Codigo de menu. + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findByMenuCode(EntityManager pEntityManager, Integer pMenucode) throws Exception { + List lmenu = null; + Query qry = pEntityManager.createQuery(TgeneMenuLevel.JPQL_MENU_LEVEL); + qry.setParameter("menucode", pMenucode); + lmenu = qry.getResultList(); + return lmenu; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuLevelDesc.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuLevelDesc.java.svn-base new file mode 100644 index 0000000..bc6d605 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuLevelDesc.java.svn-base @@ -0,0 +1,188 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; + +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMENULEVELDESC*/ +@Entity(name="TgeneMenuLevelDesc") +@Table(name="TGENEMENULEVELDESC") +public class TgeneMenuLevelDesc extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneMenuLevelDesc +*/ +@EmbeddedId +private TgeneMenuLevelDescKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion por idioma de la agrupacion del menu +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneMenuLevelDesc(){ +} +/**Contructor de TgeneMenuLevelDesc +@param pPk Clave Primaria del entity +*/ +public TgeneMenuLevelDesc(TgeneMenuLevelDescKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneMenuLevelDesc +*/ +public static TgeneMenuLevelDesc find(EntityManager pEntityManager,TgeneMenuLevelDescKey pKey) throws Exception{ + TgeneMenuLevelDesc obj = pEntityManager.find(TgeneMenuLevelDesc.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneMenuLevelDesc +@return El objeto que referencia a la Clave primaria de TgeneMenuLevelDesc +*/ +public TgeneMenuLevelDescKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneMenuLevelDesc +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneMenuLevelDesc +*/ +public void setPk(TgeneMenuLevelDescKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneMenuLevelDesc))return false; + TgeneMenuLevelDesc that = (TgeneMenuLevelDesc) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneMenuLevelDesc +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneMenuLevelDesc +*/ +public Object createInstance(){ + TgeneMenuLevelDesc instance=new TgeneMenuLevelDesc(); + instance.setPk(new TgeneMenuLevelDescKey()); + return instance; +} +/**Clona la entidad TgeneMenuLevelDesc +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneMenuLevelDesc p=(TgeneMenuLevelDesc)this.clone(); + p.setPk((TgeneMenuLevelDescKey)this.pk.cloneMe()); + return p; +} + + //METODOS MANUALES + /** Sentencia que devuelve un registro de TgeneMenuLevelDesc. */ + private static final String JPQL_MENU_GRUP_DESC = "from TgeneMenuLevelDesc tmgd" + " where tmgd.pk.menucode = :menucode" + + " and tmgd.pk.levelcode = :levelcode" + " and tmgd.pk.languagecode = :languagecode"; + /** + * Metodo que entrega descripcion del primer nivel del menu. + * + * @param pmenucode Codigo de menu. + * @param pLevel Codigo de nivel. + * @param planguagecode Codigo de lenguaje del usuario. + * @return TgeneMenuLevelDesc + * @throws Exception + */ + public static TgeneMenuLevelDesc find(EntityManager pEntityManager, Integer pmenucode, Integer pLevel, String planguagecode) throws Exception { + Query qry = pEntityManager.createQuery(TgeneMenuLevelDesc.JPQL_MENU_GRUP_DESC); + qry.setParameter("menucode", pmenucode); + qry.setParameter("levelcode", pLevel); + qry.setParameter("languagecode", planguagecode); + try { + return (TgeneMenuLevelDesc) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuLevelDescKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuLevelDescKey.java.svn-base new file mode 100644 index 0000000..4ef6319 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuLevelDescKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEMENULEVELDESC*/ +@Embeddable +public class TgeneMenuLevelDescKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MENUCODE", nullable=false,updatable=false) + +/** +* Codigo de menu +*/ +private Integer menucode; + +@Column(name="LEVELCODE", nullable=false,updatable=false) + +/** +* Codigo de nivel del menu +*/ +private Integer levelcode; + +@Column(name="LANGUAGECODE", nullable=false,updatable=false) + +/** +* Codigo de idioma +*/ +private String languagecode; + +/**Contructor por defecto*/ +public TgeneMenuLevelDescKey(){} +/**Contructor de TgeneMenuLevelDescKey +@param pMenucode Codigo de menu +@param pLevelcode Codigo de nivel del menu +@param pLanguagecode Codigo de idioma +*/ +public TgeneMenuLevelDescKey(Integer pMenucode,Integer pLevelcode,String pLanguagecode){ + menucode=pMenucode; + levelcode=pLevelcode; + languagecode=pLanguagecode; +} +/**Obtiene el valor de menucode +@return valor de menucode*/ +public Integer getMenucode(){ + return menucode; +} +/**Fija el valor de menucode +@param pMenucode nuevo Valor de menucode*/ +public void setMenucode(Integer pMenucode){ + menucode=pMenucode; +} + +/**Obtiene el valor de levelcode +@return valor de levelcode*/ +public Integer getLevelcode(){ + return levelcode; +} +/**Fija el valor de levelcode +@param pLevelcode nuevo Valor de levelcode*/ +public void setLevelcode(Integer pLevelcode){ + levelcode=pLevelcode; +} + +/**Obtiene el valor de languagecode +@return valor de languagecode*/ +public String getLanguagecode(){ + return languagecode; +} +/**Fija el valor de languagecode +@param pLanguagecode nuevo Valor de languagecode*/ +public void setLanguagecode(String pLanguagecode){ + languagecode=pLanguagecode; +} + +/**Implementacin de la comparacin de TgeneMenuLevelDescKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneMenuLevelDescKey))return false; + TgeneMenuLevelDescKey that = (TgeneMenuLevelDescKey) o; + if (this.getMenucode() == null || that.getMenucode() == null){ + return false; + } + if (! this.getMenucode().equals(that.getMenucode())){ + return false; + } + if (this.getLevelcode() == null || that.getLevelcode() == null){ + return false; + } + if (! this.getLevelcode().equals(that.getLevelcode())){ + return false; + } + if (this.getLanguagecode() == null || that.getLanguagecode() == null){ + return false; + } + if (! this.getLanguagecode().equals(that.getLanguagecode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneMenuLevelDescKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getMenucode() == null ? 0 : this.getMenucode().hashCode()); + result = result * 37 + (this.getLevelcode() == null ? 0 : this.getLevelcode().hashCode()); + result = result * 37 + (this.getLanguagecode() == null ? 0 : this.getLanguagecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuLevelKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuLevelKey.java.svn-base new file mode 100644 index 0000000..98102b2 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuLevelKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEMENULEVEL*/ +@Embeddable +public class TgeneMenuLevelKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MENUCODE", nullable=false,updatable=false) + +/** +* Codigo de menu +*/ +private Integer menucode; + +@Column(name="LEVELCODE", nullable=false,updatable=false) + +/** +* Codigo de nivel del menu. +*/ +private Integer levelcode; + +/**Contructor por defecto*/ +public TgeneMenuLevelKey(){} +/**Contructor de TgeneMenuLevelKey +@param pMenucode Codigo de menu +@param pLevelcode Codigo de nivel del menu. +*/ +public TgeneMenuLevelKey(Integer pMenucode,Integer pLevelcode){ + menucode=pMenucode; + levelcode=pLevelcode; +} +/**Obtiene el valor de menucode +@return valor de menucode*/ +public Integer getMenucode(){ + return menucode; +} +/**Fija el valor de menucode +@param pMenucode nuevo Valor de menucode*/ +public void setMenucode(Integer pMenucode){ + menucode=pMenucode; +} + +/**Obtiene el valor de levelcode +@return valor de levelcode*/ +public Integer getLevelcode(){ + return levelcode; +} +/**Fija el valor de levelcode +@param pLevelcode nuevo Valor de levelcode*/ +public void setLevelcode(Integer pLevelcode){ + levelcode=pLevelcode; +} + +/**Implementacin de la comparacin de TgeneMenuLevelKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneMenuLevelKey))return false; + TgeneMenuLevelKey that = (TgeneMenuLevelKey) o; + if (this.getMenucode() == null || that.getMenucode() == null){ + return false; + } + if (! this.getMenucode().equals(that.getMenucode())){ + return false; + } + if (this.getLevelcode() == null || that.getLevelcode() == null){ + return false; + } + if (! this.getLevelcode().equals(that.getLevelcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneMenuLevelKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getMenucode() == null ? 0 : this.getMenucode().hashCode()); + result = result * 37 + (this.getLevelcode() == null ? 0 : this.getLevelcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuLevelTran.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuLevelTran.java.svn-base new file mode 100644 index 0000000..767c9f4 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuLevelTran.java.svn-base @@ -0,0 +1,168 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.persistence.commondb.exception.CommondbException; + +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMENULEVELTRAN*/ +@Entity(name="TgeneMenuLevelTran") +@Table(name="TGENEMENULEVELTRAN") +public class TgeneMenuLevelTran extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneMenuLevelTran +*/ +@EmbeddedId +private TgeneMenuLevelTranKey pk; +@Column(name="PRESENTATIONORDER", nullable=true) + +/** +* Orden de presentacion de las transacciones dentro de la agrupacion que forma parte delprimer nivel del menu. +*/ +private Integer presentationorder; + +/**Contructor por defecto*/ +public TgeneMenuLevelTran(){ +} +/**Contructor de TgeneMenuLevelTran +@param pPk Clave Primaria del entity +*/ +public TgeneMenuLevelTran(TgeneMenuLevelTranKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneMenuLevelTran +*/ +public static TgeneMenuLevelTran find(EntityManager pEntityManager,TgeneMenuLevelTranKey pKey) throws Exception{ + TgeneMenuLevelTran obj = pEntityManager.find(TgeneMenuLevelTran.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneMenuLevelTran +@return El objeto que referencia a la Clave primaria de TgeneMenuLevelTran +*/ +public TgeneMenuLevelTranKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneMenuLevelTran +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneMenuLevelTran +*/ +public void setPk(TgeneMenuLevelTranKey pPk){ + pk=pPk; +} +/**Obtiene el valor de presentationorder +@return valor de presentationorder*/ +public Integer getPresentationorder(){ + return presentationorder; +} +/**Fija el valor de presentationorder +@param pPresentationorder nuevo Valor de presentationorder*/ +public void setPresentationorder(Integer pPresentationorder){ + presentationorder=pPresentationorder; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneMenuLevelTran))return false; + TgeneMenuLevelTran that = (TgeneMenuLevelTran) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneMenuLevelTran +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneMenuLevelTran +*/ +public Object createInstance(){ + TgeneMenuLevelTran instance=new TgeneMenuLevelTran(); + instance.setPk(new TgeneMenuLevelTranKey()); + return instance; +} +/**Clona la entidad TgeneMenuLevelTran +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneMenuLevelTran p=(TgeneMenuLevelTran)this.clone(); + p.setPk((TgeneMenuLevelTranKey)this.pk.cloneMe()); + return p; +} + + //METODOS MANUALES + /** Sentencia que devuelve un registro de TgeneMenuGroup. */ + private static final String JPQL_MENUGRP_TRAN = "from TgeneMenuLevelTran tmgt " + " where tmgt.pk.menucode = :menucode" + + " and tmgt.pk.groupcode = :groupcode" + " order by tmgt.pk.transactionmodule,tmgt.pk.transactioncode "; + /** + * Metodo que entrega transacciones asociadas al codigo de menu y codigo de nivel. + * + * @param pMenucode Codigo de menu. + * @param pLevel Codigo de Nivel. + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findByCodeMenuNivel(EntityManager pEntityManager, Integer pMenucode, Integer pLevel) throws Exception { + List lmenu = null; + Query qry = pEntityManager.createQuery(TgeneMenuLevelTran.JPQL_MENUGRP_TRAN); + qry.setParameter("menucode", pMenucode); + qry.setParameter("groupcode", pLevel); + lmenu = qry.getResultList(); + return lmenu; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuLevelTranKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuLevelTranKey.java.svn-base new file mode 100644 index 0000000..bad775a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuLevelTranKey.java.svn-base @@ -0,0 +1,205 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEMENULEVELTRAN*/ +@Embeddable +public class TgeneMenuLevelTranKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MENUCODE", nullable=false,updatable=false) + +/** +* Codigo de menu +*/ +private Integer menucode; + +@Column(name="LEVELCODE", nullable=false,updatable=false) + +/** +* Codigo de nivel del menu. +*/ +private Integer levelcode; + +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +/**Contructor por defecto*/ +public TgeneMenuLevelTranKey(){} +/**Contructor de TgeneMenuLevelTranKey +@param pMenucode Codigo de menu +@param pLevelcode Codigo de nivel del menu. +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +*/ +public TgeneMenuLevelTranKey(Integer pMenucode,Integer pLevelcode,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion){ + menucode=pMenucode; + levelcode=pLevelcode; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; +} +/**Obtiene el valor de menucode +@return valor de menucode*/ +public Integer getMenucode(){ + return menucode; +} +/**Fija el valor de menucode +@param pMenucode nuevo Valor de menucode*/ +public void setMenucode(Integer pMenucode){ + menucode=pMenucode; +} + +/**Obtiene el valor de levelcode +@return valor de levelcode*/ +public Integer getLevelcode(){ + return levelcode; +} +/**Fija el valor de levelcode +@param pLevelcode nuevo Valor de levelcode*/ +public void setLevelcode(Integer pLevelcode){ + levelcode=pLevelcode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Implementacin de la comparacin de TgeneMenuLevelTranKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneMenuLevelTranKey))return false; + TgeneMenuLevelTranKey that = (TgeneMenuLevelTranKey) o; + if (this.getMenucode() == null || that.getMenucode() == null){ + return false; + } + if (! this.getMenucode().equals(that.getMenucode())){ + return false; + } + if (this.getLevelcode() == null || that.getLevelcode() == null){ + return false; + } + if (! this.getLevelcode().equals(that.getLevelcode())){ + return false; + } + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneMenuLevelTranKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getMenucode() == null ? 0 : this.getMenucode().hashCode()); + result = result * 37 + (this.getLevelcode() == null ? 0 : this.getLevelcode().hashCode()); + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuProfile.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuProfile.java.svn-base new file mode 100644 index 0000000..b884c2f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuProfile.java.svn-base @@ -0,0 +1,163 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; + +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMENUPROFILE*/ +@Entity(name="TgeneMenuProfile") +@Table(name="TGENEMENUPROFILE") +public class TgeneMenuProfile extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneMenuProfile +*/ +@Id +@Column(name="PROFILECODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="MENUCODE", nullable=true) + +/** +* Cdigo del tem de men +*/ +private Integer menucode; + +/**Contructor por defecto*/ +public TgeneMenuProfile(){ +} +/**Contructor de TgeneMenuProfile +@param pPk Clave Primaria del entity +*/ +public TgeneMenuProfile(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneMenuProfile +*/ +public static TgeneMenuProfile find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneMenuProfile obj = pEntityManager.find(TgeneMenuProfile.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneMenuProfile +@return El objeto que referencia a la Clave primaria de TgeneMenuProfile +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneMenuProfile +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneMenuProfile +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de menucode +@return valor de menucode*/ +public Integer getMenucode(){ + return menucode; +} +/**Fija el valor de menucode +@param pMenucode nuevo Valor de menucode*/ +public void setMenucode(Integer pMenucode){ + menucode=pMenucode; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneMenuProfile))return false; + TgeneMenuProfile that = (TgeneMenuProfile) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneMenuProfile +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneMenuProfile +*/ +public Object createInstance(){ + TgeneMenuProfile instance=new TgeneMenuProfile(); + return instance; +} +/**Clona la entidad TgeneMenuProfile +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneMenuProfile p=(TgeneMenuProfile)this.clone(); + return p; +} + + //METODOS MANUALES + /** Sentencia que devuelve un registro de TgeneMenuProfile. */ + private static final String JPQL_MENU_PROFILE = "from TgeneMenuProfile tmp " + " where tmp.pk = :profilecode"; + /** + * Metodo que entrega datos de TgeneMenuProfile. + * + * @param pProfile Codigo de perfil del usuario. + * @return TgeneMenuProfile + * @throws Exception + */ + public static TgeneMenuProfile findByCodePerfilUsuario(EntityManager pEntityManager, String pProfile) throws Exception { + Query qry = pEntityManager.createQuery(TgeneMenuProfile.JPQL_MENU_PROFILE); + qry.setParameter("profilecode", pProfile); + try { + return (TgeneMenuProfile) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuSubLevel.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuSubLevel.java.svn-base new file mode 100644 index 0000000..c32b0bd --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuSubLevel.java.svn-base @@ -0,0 +1,168 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.persistence.commondb.exception.CommondbException; + +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMENUSUBLEVEL*/ +@Entity(name="TgeneMenuSubLevel") +@Table(name="TGENEMENUSUBLEVEL") +public class TgeneMenuSubLevel extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneMenuSubLevel +*/ +@EmbeddedId +private TgeneMenuSubLevelKey pk; +@Column(name="PRESENTATIONORDER", nullable=true) + +/** +* Orden de presentacion de la agrupacion en el primer nivel del menu +*/ +private Integer presentationorder; + +/**Contructor por defecto*/ +public TgeneMenuSubLevel(){ +} +/**Contructor de TgeneMenuSubLevel +@param pPk Clave Primaria del entity +*/ +public TgeneMenuSubLevel(TgeneMenuSubLevelKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneMenuSubLevel +*/ +public static TgeneMenuSubLevel find(EntityManager pEntityManager,TgeneMenuSubLevelKey pKey) throws Exception{ + TgeneMenuSubLevel obj = pEntityManager.find(TgeneMenuSubLevel.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneMenuSubLevel +@return El objeto que referencia a la Clave primaria de TgeneMenuSubLevel +*/ +public TgeneMenuSubLevelKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneMenuSubLevel +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneMenuSubLevel +*/ +public void setPk(TgeneMenuSubLevelKey pPk){ + pk=pPk; +} +/**Obtiene el valor de presentationorder +@return valor de presentationorder*/ +public Integer getPresentationorder(){ + return presentationorder; +} +/**Fija el valor de presentationorder +@param pPresentationorder nuevo Valor de presentationorder*/ +public void setPresentationorder(Integer pPresentationorder){ + presentationorder=pPresentationorder; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneMenuSubLevel))return false; + TgeneMenuSubLevel that = (TgeneMenuSubLevel) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneMenuSubLevel +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneMenuSubLevel +*/ +public Object createInstance(){ + TgeneMenuSubLevel instance=new TgeneMenuSubLevel(); + instance.setPk(new TgeneMenuSubLevelKey()); + return instance; +} +/**Clona la entidad TgeneMenuSubLevel +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneMenuSubLevel p=(TgeneMenuSubLevel)this.clone(); + p.setPk((TgeneMenuSubLevelKey)this.pk.cloneMe()); + return p; +} + + //METODOS MANUALES + /** Sentencia que devuelve un registro de TgeneMenuSubLevel. */ + private static final String JPQL_MENU_SUB_LEVEL = "from TgeneMenuSubLevel tmsl " + " where tmsl.pk.menucode = :menucode" + + " and tmsl.pk.levelcode = :levelcode " + " order by tmsl.presentationorder "; + /** + * Metodo que entrega uns lista de definicion del menu de segundo nivel. + * + * @param pMenucode Codigo de menu. + * @param pLevel Codigo del primer nivel. + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List find(EntityManager pEntityManager, Integer pMenucode, Integer pLevel) throws Exception { + List lmenu = null; + Query qry = pEntityManager.createQuery(TgeneMenuSubLevel.JPQL_MENU_SUB_LEVEL); + qry.setParameter("menucode", pMenucode); + qry.setParameter("levelcode", pLevel); + lmenu = qry.getResultList(); + return lmenu; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuSubLevelDesc.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuSubLevelDesc.java.svn-base new file mode 100644 index 0000000..086366a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuSubLevelDesc.java.svn-base @@ -0,0 +1,192 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; + +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMENUSUBLEVELDESC*/ +@Entity(name="TgeneMenuSubLevelDesc") +@Table(name="TGENEMENUSUBLEVELDESC") +public class TgeneMenuSubLevelDesc extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneMenuSubLevelDesc +*/ +@EmbeddedId +private TgeneMenuSubLevelDescKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion del sub nivel +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneMenuSubLevelDesc(){ +} +/**Contructor de TgeneMenuSubLevelDesc +@param pPk Clave Primaria del entity +*/ +public TgeneMenuSubLevelDesc(TgeneMenuSubLevelDescKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneMenuSubLevelDesc +*/ +public static TgeneMenuSubLevelDesc find(EntityManager pEntityManager,TgeneMenuSubLevelDescKey pKey) throws Exception{ + TgeneMenuSubLevelDesc obj = pEntityManager.find(TgeneMenuSubLevelDesc.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneMenuSubLevelDesc +@return El objeto que referencia a la Clave primaria de TgeneMenuSubLevelDesc +*/ +public TgeneMenuSubLevelDescKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneMenuSubLevelDesc +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneMenuSubLevelDesc +*/ +public void setPk(TgeneMenuSubLevelDescKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneMenuSubLevelDesc))return false; + TgeneMenuSubLevelDesc that = (TgeneMenuSubLevelDesc) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneMenuSubLevelDesc +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneMenuSubLevelDesc +*/ +public Object createInstance(){ + TgeneMenuSubLevelDesc instance=new TgeneMenuSubLevelDesc(); + instance.setPk(new TgeneMenuSubLevelDescKey()); + return instance; +} +/**Clona la entidad TgeneMenuSubLevelDesc +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneMenuSubLevelDesc p=(TgeneMenuSubLevelDesc)this.clone(); + p.setPk((TgeneMenuSubLevelDescKey)this.pk.cloneMe()); + return p; +} + + //METODOS MANUALES + /** Sentencia que devuelve un registro de TgeneMenuSubLevelDesc. */ + private static final String JPQL_MENU_SLEVEL_DESC = "from TgeneMenuSubLevelDesc tsld" + " where tsld.pk.menucode = :menucode" + + " and tsld.pk.levelcode = :levelcode" + " and tsld.pk.sublevel = :sublevel" + " and tsld.pk.languagecode = :languagecode"; + /** + * Metodo que emtrega la descripcion de un subnivel del menu. + * + * @param pmenucode Codigo de menu. + * @param pLevel Codigo de nivel de menu. + * @param pSublevel Codigo de subnivel de menu. + * @param planguagecode Codigo de lenguaje. + * @return TgeneMenuSubLevelDesc + * @throws Exception + */ + public static TgeneMenuSubLevelDesc find(EntityManager pEntityManager, Integer pmenucode, Integer pLevel, Integer pSublevel, String planguagecode) + throws Exception { + Query qry = pEntityManager.createQuery(TgeneMenuSubLevelDesc.JPQL_MENU_SLEVEL_DESC); + qry.setParameter("menucode", pmenucode); + qry.setParameter("levelcode", pLevel); + qry.setParameter("sublevel", pSublevel); + qry.setParameter("languagecode", planguagecode); + try { + return (TgeneMenuSubLevelDesc) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuSubLevelDescKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuSubLevelDescKey.java.svn-base new file mode 100644 index 0000000..47f069f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuSubLevelDescKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEMENUSUBLEVELDESC*/ +@Embeddable +public class TgeneMenuSubLevelDescKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MENUCODE", nullable=false,updatable=false) + +/** +* Codigo de menu +*/ +private Integer menucode; + +@Column(name="LEVELCODE", nullable=false,updatable=false) + +/** +* Codigo de nivel del menu. +*/ +private Integer levelcode; + +@Column(name="SUBLEVEL", nullable=false,updatable=false) + +/** +* Sub grupo de menu +*/ +private Integer sublevel; + +@Column(name="LANGUAGECODE", nullable=false,updatable=false) + +/** +* Codigo de idioma +*/ +private String languagecode; + +/**Contructor por defecto*/ +public TgeneMenuSubLevelDescKey(){} +/**Contructor de TgeneMenuSubLevelDescKey +@param pMenucode Codigo de menu +@param pLevelcode Codigo de nivel del menu. +@param pSublevel Sub grupo de menu +@param pLanguagecode Codigo de idioma +*/ +public TgeneMenuSubLevelDescKey(Integer pMenucode,Integer pLevelcode,Integer pSublevel,String pLanguagecode){ + menucode=pMenucode; + levelcode=pLevelcode; + sublevel=pSublevel; + languagecode=pLanguagecode; +} +/**Obtiene el valor de menucode +@return valor de menucode*/ +public Integer getMenucode(){ + return menucode; +} +/**Fija el valor de menucode +@param pMenucode nuevo Valor de menucode*/ +public void setMenucode(Integer pMenucode){ + menucode=pMenucode; +} + +/**Obtiene el valor de levelcode +@return valor de levelcode*/ +public Integer getLevelcode(){ + return levelcode; +} +/**Fija el valor de levelcode +@param pLevelcode nuevo Valor de levelcode*/ +public void setLevelcode(Integer pLevelcode){ + levelcode=pLevelcode; +} + +/**Obtiene el valor de sublevel +@return valor de sublevel*/ +public Integer getSublevel(){ + return sublevel; +} +/**Fija el valor de sublevel +@param pSublevel nuevo Valor de sublevel*/ +public void setSublevel(Integer pSublevel){ + sublevel=pSublevel; +} + +/**Obtiene el valor de languagecode +@return valor de languagecode*/ +public String getLanguagecode(){ + return languagecode; +} +/**Fija el valor de languagecode +@param pLanguagecode nuevo Valor de languagecode*/ +public void setLanguagecode(String pLanguagecode){ + languagecode=pLanguagecode; +} + +/**Implementacin de la comparacin de TgeneMenuSubLevelDescKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneMenuSubLevelDescKey))return false; + TgeneMenuSubLevelDescKey that = (TgeneMenuSubLevelDescKey) o; + if (this.getMenucode() == null || that.getMenucode() == null){ + return false; + } + if (! this.getMenucode().equals(that.getMenucode())){ + return false; + } + if (this.getLevelcode() == null || that.getLevelcode() == null){ + return false; + } + if (! this.getLevelcode().equals(that.getLevelcode())){ + return false; + } + if (this.getSublevel() == null || that.getSublevel() == null){ + return false; + } + if (! this.getSublevel().equals(that.getSublevel())){ + return false; + } + if (this.getLanguagecode() == null || that.getLanguagecode() == null){ + return false; + } + if (! this.getLanguagecode().equals(that.getLanguagecode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneMenuSubLevelDescKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getMenucode() == null ? 0 : this.getMenucode().hashCode()); + result = result * 37 + (this.getLevelcode() == null ? 0 : this.getLevelcode().hashCode()); + result = result * 37 + (this.getSublevel() == null ? 0 : this.getSublevel().hashCode()); + result = result * 37 + (this.getLanguagecode() == null ? 0 : this.getLanguagecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuSubLevelKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuSubLevelKey.java.svn-base new file mode 100644 index 0000000..7d79a34 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuSubLevelKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEMENUSUBLEVEL*/ +@Embeddable +public class TgeneMenuSubLevelKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MENUCODE", nullable=false,updatable=false) + +/** +* Codigo de menu +*/ +private Integer menucode; + +@Column(name="LEVELCODE", nullable=false,updatable=false) + +/** +* Codigo de nivel del menu. +*/ +private Integer levelcode; + +@Column(name="SUBLEVEL", nullable=false,updatable=false) + +/** +* Sub grupo de menu +*/ +private Integer sublevel; + +/**Contructor por defecto*/ +public TgeneMenuSubLevelKey(){} +/**Contructor de TgeneMenuSubLevelKey +@param pMenucode Codigo de menu +@param pLevelcode Codigo de nivel del menu. +@param pSublevel Sub grupo de menu +*/ +public TgeneMenuSubLevelKey(Integer pMenucode,Integer pLevelcode,Integer pSublevel){ + menucode=pMenucode; + levelcode=pLevelcode; + sublevel=pSublevel; +} +/**Obtiene el valor de menucode +@return valor de menucode*/ +public Integer getMenucode(){ + return menucode; +} +/**Fija el valor de menucode +@param pMenucode nuevo Valor de menucode*/ +public void setMenucode(Integer pMenucode){ + menucode=pMenucode; +} + +/**Obtiene el valor de levelcode +@return valor de levelcode*/ +public Integer getLevelcode(){ + return levelcode; +} +/**Fija el valor de levelcode +@param pLevelcode nuevo Valor de levelcode*/ +public void setLevelcode(Integer pLevelcode){ + levelcode=pLevelcode; +} + +/**Obtiene el valor de sublevel +@return valor de sublevel*/ +public Integer getSublevel(){ + return sublevel; +} +/**Fija el valor de sublevel +@param pSublevel nuevo Valor de sublevel*/ +public void setSublevel(Integer pSublevel){ + sublevel=pSublevel; +} + +/**Implementacin de la comparacin de TgeneMenuSubLevelKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneMenuSubLevelKey))return false; + TgeneMenuSubLevelKey that = (TgeneMenuSubLevelKey) o; + if (this.getMenucode() == null || that.getMenucode() == null){ + return false; + } + if (! this.getMenucode().equals(that.getMenucode())){ + return false; + } + if (this.getLevelcode() == null || that.getLevelcode() == null){ + return false; + } + if (! this.getLevelcode().equals(that.getLevelcode())){ + return false; + } + if (this.getSublevel() == null || that.getSublevel() == null){ + return false; + } + if (! this.getSublevel().equals(that.getSublevel())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneMenuSubLevelKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getMenucode() == null ? 0 : this.getMenucode().hashCode()); + result = result * 37 + (this.getLevelcode() == null ? 0 : this.getLevelcode().hashCode()); + result = result * 37 + (this.getSublevel() == null ? 0 : this.getSublevel().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuSubLevelTran.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuSubLevelTran.java.svn-base new file mode 100644 index 0000000..272bd49 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuSubLevelTran.java.svn-base @@ -0,0 +1,139 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMENUSUBLEVELTRAN*/ +@Entity(name="TgeneMenuSubLevelTran") +@Table(name="TGENEMENUSUBLEVELTRAN") +public class TgeneMenuSubLevelTran extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneMenuSubLevelTran +*/ +@EmbeddedId +private TgeneMenuSubLevelTranKey pk; +@Column(name="PRESENTATIONORDER", nullable=true) + +/** +* Orden de presentacion +*/ +private Integer presentationorder; + +/**Contructor por defecto*/ +public TgeneMenuSubLevelTran(){ +} +/**Contructor de TgeneMenuSubLevelTran +@param pPk Clave Primaria del entity +*/ +public TgeneMenuSubLevelTran(TgeneMenuSubLevelTranKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneMenuSubLevelTran +*/ +public static TgeneMenuSubLevelTran find(EntityManager pEntityManager,TgeneMenuSubLevelTranKey pKey) throws Exception{ + TgeneMenuSubLevelTran obj = pEntityManager.find(TgeneMenuSubLevelTran.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneMenuSubLevelTran +@return El objeto que referencia a la Clave primaria de TgeneMenuSubLevelTran +*/ +public TgeneMenuSubLevelTranKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneMenuSubLevelTran +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneMenuSubLevelTran +*/ +public void setPk(TgeneMenuSubLevelTranKey pPk){ + pk=pPk; +} +/**Obtiene el valor de presentationorder +@return valor de presentationorder*/ +public Integer getPresentationorder(){ + return presentationorder; +} +/**Fija el valor de presentationorder +@param pPresentationorder nuevo Valor de presentationorder*/ +public void setPresentationorder(Integer pPresentationorder){ + presentationorder=pPresentationorder; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneMenuSubLevelTran))return false; + TgeneMenuSubLevelTran that = (TgeneMenuSubLevelTran) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneMenuSubLevelTran +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneMenuSubLevelTran +*/ +public Object createInstance(){ + TgeneMenuSubLevelTran instance=new TgeneMenuSubLevelTran(); + instance.setPk(new TgeneMenuSubLevelTranKey()); + return instance; +} +/**Clona la entidad TgeneMenuSubLevelTran +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneMenuSubLevelTran p=(TgeneMenuSubLevelTran)this.clone(); + p.setPk((TgeneMenuSubLevelTranKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuSubLevelTranKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuSubLevelTranKey.java.svn-base new file mode 100644 index 0000000..081535e --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/.svn/text-base/TgeneMenuSubLevelTranKey.java.svn-base @@ -0,0 +1,232 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEMENUSUBLEVELTRAN*/ +@Embeddable +public class TgeneMenuSubLevelTranKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MENUCODE", nullable=false,updatable=false) + +/** +* Codigo de menu +*/ +private Integer menucode; + +@Column(name="LEVELCODE", nullable=false,updatable=false) + +/** +* Codigo de nivel del menu. +*/ +private Integer levelcode; + +@Column(name="SUBLEVEL", nullable=false,updatable=false) + +/** +* Sub grupo de menu +*/ +private Integer sublevel; + +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +/**Contructor por defecto*/ +public TgeneMenuSubLevelTranKey(){} +/**Contructor de TgeneMenuSubLevelTranKey +@param pMenucode Codigo de menu +@param pLevelcode Codigo de nivel del menu. +@param pSublevel Sub grupo de menu +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +*/ +public TgeneMenuSubLevelTranKey(Integer pMenucode,Integer pLevelcode,Integer pSublevel,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion){ + menucode=pMenucode; + levelcode=pLevelcode; + sublevel=pSublevel; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; +} +/**Obtiene el valor de menucode +@return valor de menucode*/ +public Integer getMenucode(){ + return menucode; +} +/**Fija el valor de menucode +@param pMenucode nuevo Valor de menucode*/ +public void setMenucode(Integer pMenucode){ + menucode=pMenucode; +} + +/**Obtiene el valor de levelcode +@return valor de levelcode*/ +public Integer getLevelcode(){ + return levelcode; +} +/**Fija el valor de levelcode +@param pLevelcode nuevo Valor de levelcode*/ +public void setLevelcode(Integer pLevelcode){ + levelcode=pLevelcode; +} + +/**Obtiene el valor de sublevel +@return valor de sublevel*/ +public Integer getSublevel(){ + return sublevel; +} +/**Fija el valor de sublevel +@param pSublevel nuevo Valor de sublevel*/ +public void setSublevel(Integer pSublevel){ + sublevel=pSublevel; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Implementacin de la comparacin de TgeneMenuSubLevelTranKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneMenuSubLevelTranKey))return false; + TgeneMenuSubLevelTranKey that = (TgeneMenuSubLevelTranKey) o; + if (this.getMenucode() == null || that.getMenucode() == null){ + return false; + } + if (! this.getMenucode().equals(that.getMenucode())){ + return false; + } + if (this.getLevelcode() == null || that.getLevelcode() == null){ + return false; + } + if (! this.getLevelcode().equals(that.getLevelcode())){ + return false; + } + if (this.getSublevel() == null || that.getSublevel() == null){ + return false; + } + if (! this.getSublevel().equals(that.getSublevel())){ + return false; + } + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneMenuSubLevelTranKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getMenucode() == null ? 0 : this.getMenucode().hashCode()); + result = result * 37 + (this.getLevelcode() == null ? 0 : this.getLevelcode().hashCode()); + result = result * 37 + (this.getSublevel() == null ? 0 : this.getSublevel().hashCode()); + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenu.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenu.java new file mode 100644 index 0000000..664a97e --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenu.java @@ -0,0 +1,138 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMENU*/ +@Entity(name="TgeneMenu") +@Table(name="TGENEMENU") +public class TgeneMenu extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneMenu +*/ +@Id +@Column(name="MENUCODE" ,nullable=false, updatable=false) +private Integer pk; +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion default del menu +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneMenu(){ +} +/**Contructor de TgeneMenu +@param pPk Clave Primaria del entity +*/ +public TgeneMenu(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneMenu +*/ +public static TgeneMenu find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneMenu obj = pEntityManager.find(TgeneMenu.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneMenu +@return El objeto que referencia a la Clave primaria de TgeneMenu +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneMenu +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneMenu +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneMenu))return false; + TgeneMenu that = (TgeneMenu) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneMenu +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneMenu +*/ +public Object createInstance(){ + TgeneMenu instance=new TgeneMenu(); + return instance; +} +/**Clona la entidad TgeneMenu +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneMenu p=(TgeneMenu)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuLevel.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuLevel.java new file mode 100644 index 0000000..8aa43f1 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuLevel.java @@ -0,0 +1,186 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.core.exception.CoreException; +import com.fp.dto.hb.HibernateBean; +import com.fp.persistence.commondb.exception.CommondbException; + +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMENULEVEL*/ +@Entity(name="TgeneMenuLevel") +@Table(name="TGENEMENULEVEL") +public class TgeneMenuLevel extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneMenuLevel +*/ +@EmbeddedId +private TgeneMenuLevelKey pk; +@Column(name="PRESENTATIONORDER", nullable=true) + +/** +* Orden de presentacion de la agrupacion en el primer nivel del menu +*/ +private Integer presentationorder; + +@Column(name="HAVESUBLEVEL", nullable=true) + +/** +* Y, Indica que tiene un subnivel de menu. +*/ +private String havesublevel; + +/**Contructor por defecto*/ +public TgeneMenuLevel(){ +} +/**Contructor de TgeneMenuLevel +@param pPk Clave Primaria del entity +*/ +public TgeneMenuLevel(TgeneMenuLevelKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneMenuLevel +*/ +public static TgeneMenuLevel find(EntityManager pEntityManager,TgeneMenuLevelKey pKey) throws Exception{ + TgeneMenuLevel obj = pEntityManager.find(TgeneMenuLevel.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneMenuLevel +@return El objeto que referencia a la Clave primaria de TgeneMenuLevel +*/ +public TgeneMenuLevelKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneMenuLevel +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneMenuLevel +*/ +public void setPk(TgeneMenuLevelKey pPk){ + pk=pPk; +} +/**Obtiene el valor de presentationorder +@return valor de presentationorder*/ +public Integer getPresentationorder(){ + return presentationorder; +} +/**Fija el valor de presentationorder +@param pPresentationorder nuevo Valor de presentationorder*/ +public void setPresentationorder(Integer pPresentationorder){ + presentationorder=pPresentationorder; +} + +/**Obtiene el valor de havesublevel +@return valor de havesublevel*/ +public String getHavesublevel(){ + return havesublevel; +} +/**Fija el valor de havesublevel +@param pHavesublevel nuevo Valor de havesublevel*/ +public void setHavesublevel(String pHavesublevel){ + havesublevel=pHavesublevel; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneMenuLevel))return false; + TgeneMenuLevel that = (TgeneMenuLevel) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneMenuLevel +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneMenuLevel +*/ +public Object createInstance(){ + TgeneMenuLevel instance=new TgeneMenuLevel(); + instance.setPk(new TgeneMenuLevelKey()); + return instance; +} +/**Clona la entidad TgeneMenuLevel +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneMenuLevel p=(TgeneMenuLevel)this.clone(); + p.setPk((TgeneMenuLevelKey)this.pk.cloneMe()); + return p; +} + + //METODOS MANUALES + /** Sentencia que devuelve un registro de TgeneMenuLevel. */ + private static final String JPQL_MENU_LEVEL = "from TgeneMenuLevel tmg " + " where tmg.pk.menucode = :menucode" + + " order by tmg.presentationorder "; + /** + * Metodo que entrega la definicion del primer nivel del menu. + * + * @param pMenucode Codigo de menu. + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findByMenuCode(EntityManager pEntityManager, Integer pMenucode) throws Exception { + List lmenu = null; + Query qry = pEntityManager.createQuery(TgeneMenuLevel.JPQL_MENU_LEVEL); + qry.setParameter("menucode", pMenucode); + lmenu = qry.getResultList(); + return lmenu; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuLevelDesc.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuLevelDesc.java new file mode 100644 index 0000000..bc6d605 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuLevelDesc.java @@ -0,0 +1,188 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; + +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMENULEVELDESC*/ +@Entity(name="TgeneMenuLevelDesc") +@Table(name="TGENEMENULEVELDESC") +public class TgeneMenuLevelDesc extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneMenuLevelDesc +*/ +@EmbeddedId +private TgeneMenuLevelDescKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion por idioma de la agrupacion del menu +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneMenuLevelDesc(){ +} +/**Contructor de TgeneMenuLevelDesc +@param pPk Clave Primaria del entity +*/ +public TgeneMenuLevelDesc(TgeneMenuLevelDescKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneMenuLevelDesc +*/ +public static TgeneMenuLevelDesc find(EntityManager pEntityManager,TgeneMenuLevelDescKey pKey) throws Exception{ + TgeneMenuLevelDesc obj = pEntityManager.find(TgeneMenuLevelDesc.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneMenuLevelDesc +@return El objeto que referencia a la Clave primaria de TgeneMenuLevelDesc +*/ +public TgeneMenuLevelDescKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneMenuLevelDesc +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneMenuLevelDesc +*/ +public void setPk(TgeneMenuLevelDescKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneMenuLevelDesc))return false; + TgeneMenuLevelDesc that = (TgeneMenuLevelDesc) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneMenuLevelDesc +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneMenuLevelDesc +*/ +public Object createInstance(){ + TgeneMenuLevelDesc instance=new TgeneMenuLevelDesc(); + instance.setPk(new TgeneMenuLevelDescKey()); + return instance; +} +/**Clona la entidad TgeneMenuLevelDesc +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneMenuLevelDesc p=(TgeneMenuLevelDesc)this.clone(); + p.setPk((TgeneMenuLevelDescKey)this.pk.cloneMe()); + return p; +} + + //METODOS MANUALES + /** Sentencia que devuelve un registro de TgeneMenuLevelDesc. */ + private static final String JPQL_MENU_GRUP_DESC = "from TgeneMenuLevelDesc tmgd" + " where tmgd.pk.menucode = :menucode" + + " and tmgd.pk.levelcode = :levelcode" + " and tmgd.pk.languagecode = :languagecode"; + /** + * Metodo que entrega descripcion del primer nivel del menu. + * + * @param pmenucode Codigo de menu. + * @param pLevel Codigo de nivel. + * @param planguagecode Codigo de lenguaje del usuario. + * @return TgeneMenuLevelDesc + * @throws Exception + */ + public static TgeneMenuLevelDesc find(EntityManager pEntityManager, Integer pmenucode, Integer pLevel, String planguagecode) throws Exception { + Query qry = pEntityManager.createQuery(TgeneMenuLevelDesc.JPQL_MENU_GRUP_DESC); + qry.setParameter("menucode", pmenucode); + qry.setParameter("levelcode", pLevel); + qry.setParameter("languagecode", planguagecode); + try { + return (TgeneMenuLevelDesc) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuLevelDescKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuLevelDescKey.java new file mode 100644 index 0000000..4ef6319 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuLevelDescKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEMENULEVELDESC*/ +@Embeddable +public class TgeneMenuLevelDescKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MENUCODE", nullable=false,updatable=false) + +/** +* Codigo de menu +*/ +private Integer menucode; + +@Column(name="LEVELCODE", nullable=false,updatable=false) + +/** +* Codigo de nivel del menu +*/ +private Integer levelcode; + +@Column(name="LANGUAGECODE", nullable=false,updatable=false) + +/** +* Codigo de idioma +*/ +private String languagecode; + +/**Contructor por defecto*/ +public TgeneMenuLevelDescKey(){} +/**Contructor de TgeneMenuLevelDescKey +@param pMenucode Codigo de menu +@param pLevelcode Codigo de nivel del menu +@param pLanguagecode Codigo de idioma +*/ +public TgeneMenuLevelDescKey(Integer pMenucode,Integer pLevelcode,String pLanguagecode){ + menucode=pMenucode; + levelcode=pLevelcode; + languagecode=pLanguagecode; +} +/**Obtiene el valor de menucode +@return valor de menucode*/ +public Integer getMenucode(){ + return menucode; +} +/**Fija el valor de menucode +@param pMenucode nuevo Valor de menucode*/ +public void setMenucode(Integer pMenucode){ + menucode=pMenucode; +} + +/**Obtiene el valor de levelcode +@return valor de levelcode*/ +public Integer getLevelcode(){ + return levelcode; +} +/**Fija el valor de levelcode +@param pLevelcode nuevo Valor de levelcode*/ +public void setLevelcode(Integer pLevelcode){ + levelcode=pLevelcode; +} + +/**Obtiene el valor de languagecode +@return valor de languagecode*/ +public String getLanguagecode(){ + return languagecode; +} +/**Fija el valor de languagecode +@param pLanguagecode nuevo Valor de languagecode*/ +public void setLanguagecode(String pLanguagecode){ + languagecode=pLanguagecode; +} + +/**Implementacin de la comparacin de TgeneMenuLevelDescKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneMenuLevelDescKey))return false; + TgeneMenuLevelDescKey that = (TgeneMenuLevelDescKey) o; + if (this.getMenucode() == null || that.getMenucode() == null){ + return false; + } + if (! this.getMenucode().equals(that.getMenucode())){ + return false; + } + if (this.getLevelcode() == null || that.getLevelcode() == null){ + return false; + } + if (! this.getLevelcode().equals(that.getLevelcode())){ + return false; + } + if (this.getLanguagecode() == null || that.getLanguagecode() == null){ + return false; + } + if (! this.getLanguagecode().equals(that.getLanguagecode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneMenuLevelDescKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getMenucode() == null ? 0 : this.getMenucode().hashCode()); + result = result * 37 + (this.getLevelcode() == null ? 0 : this.getLevelcode().hashCode()); + result = result * 37 + (this.getLanguagecode() == null ? 0 : this.getLanguagecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuLevelKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuLevelKey.java new file mode 100644 index 0000000..98102b2 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuLevelKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEMENULEVEL*/ +@Embeddable +public class TgeneMenuLevelKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MENUCODE", nullable=false,updatable=false) + +/** +* Codigo de menu +*/ +private Integer menucode; + +@Column(name="LEVELCODE", nullable=false,updatable=false) + +/** +* Codigo de nivel del menu. +*/ +private Integer levelcode; + +/**Contructor por defecto*/ +public TgeneMenuLevelKey(){} +/**Contructor de TgeneMenuLevelKey +@param pMenucode Codigo de menu +@param pLevelcode Codigo de nivel del menu. +*/ +public TgeneMenuLevelKey(Integer pMenucode,Integer pLevelcode){ + menucode=pMenucode; + levelcode=pLevelcode; +} +/**Obtiene el valor de menucode +@return valor de menucode*/ +public Integer getMenucode(){ + return menucode; +} +/**Fija el valor de menucode +@param pMenucode nuevo Valor de menucode*/ +public void setMenucode(Integer pMenucode){ + menucode=pMenucode; +} + +/**Obtiene el valor de levelcode +@return valor de levelcode*/ +public Integer getLevelcode(){ + return levelcode; +} +/**Fija el valor de levelcode +@param pLevelcode nuevo Valor de levelcode*/ +public void setLevelcode(Integer pLevelcode){ + levelcode=pLevelcode; +} + +/**Implementacin de la comparacin de TgeneMenuLevelKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneMenuLevelKey))return false; + TgeneMenuLevelKey that = (TgeneMenuLevelKey) o; + if (this.getMenucode() == null || that.getMenucode() == null){ + return false; + } + if (! this.getMenucode().equals(that.getMenucode())){ + return false; + } + if (this.getLevelcode() == null || that.getLevelcode() == null){ + return false; + } + if (! this.getLevelcode().equals(that.getLevelcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneMenuLevelKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getMenucode() == null ? 0 : this.getMenucode().hashCode()); + result = result * 37 + (this.getLevelcode() == null ? 0 : this.getLevelcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuLevelTran.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuLevelTran.java new file mode 100644 index 0000000..767c9f4 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuLevelTran.java @@ -0,0 +1,168 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.persistence.commondb.exception.CommondbException; + +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMENULEVELTRAN*/ +@Entity(name="TgeneMenuLevelTran") +@Table(name="TGENEMENULEVELTRAN") +public class TgeneMenuLevelTran extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneMenuLevelTran +*/ +@EmbeddedId +private TgeneMenuLevelTranKey pk; +@Column(name="PRESENTATIONORDER", nullable=true) + +/** +* Orden de presentacion de las transacciones dentro de la agrupacion que forma parte delprimer nivel del menu. +*/ +private Integer presentationorder; + +/**Contructor por defecto*/ +public TgeneMenuLevelTran(){ +} +/**Contructor de TgeneMenuLevelTran +@param pPk Clave Primaria del entity +*/ +public TgeneMenuLevelTran(TgeneMenuLevelTranKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneMenuLevelTran +*/ +public static TgeneMenuLevelTran find(EntityManager pEntityManager,TgeneMenuLevelTranKey pKey) throws Exception{ + TgeneMenuLevelTran obj = pEntityManager.find(TgeneMenuLevelTran.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneMenuLevelTran +@return El objeto que referencia a la Clave primaria de TgeneMenuLevelTran +*/ +public TgeneMenuLevelTranKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneMenuLevelTran +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneMenuLevelTran +*/ +public void setPk(TgeneMenuLevelTranKey pPk){ + pk=pPk; +} +/**Obtiene el valor de presentationorder +@return valor de presentationorder*/ +public Integer getPresentationorder(){ + return presentationorder; +} +/**Fija el valor de presentationorder +@param pPresentationorder nuevo Valor de presentationorder*/ +public void setPresentationorder(Integer pPresentationorder){ + presentationorder=pPresentationorder; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneMenuLevelTran))return false; + TgeneMenuLevelTran that = (TgeneMenuLevelTran) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneMenuLevelTran +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneMenuLevelTran +*/ +public Object createInstance(){ + TgeneMenuLevelTran instance=new TgeneMenuLevelTran(); + instance.setPk(new TgeneMenuLevelTranKey()); + return instance; +} +/**Clona la entidad TgeneMenuLevelTran +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneMenuLevelTran p=(TgeneMenuLevelTran)this.clone(); + p.setPk((TgeneMenuLevelTranKey)this.pk.cloneMe()); + return p; +} + + //METODOS MANUALES + /** Sentencia que devuelve un registro de TgeneMenuGroup. */ + private static final String JPQL_MENUGRP_TRAN = "from TgeneMenuLevelTran tmgt " + " where tmgt.pk.menucode = :menucode" + + " and tmgt.pk.groupcode = :groupcode" + " order by tmgt.pk.transactionmodule,tmgt.pk.transactioncode "; + /** + * Metodo que entrega transacciones asociadas al codigo de menu y codigo de nivel. + * + * @param pMenucode Codigo de menu. + * @param pLevel Codigo de Nivel. + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List findByCodeMenuNivel(EntityManager pEntityManager, Integer pMenucode, Integer pLevel) throws Exception { + List lmenu = null; + Query qry = pEntityManager.createQuery(TgeneMenuLevelTran.JPQL_MENUGRP_TRAN); + qry.setParameter("menucode", pMenucode); + qry.setParameter("groupcode", pLevel); + lmenu = qry.getResultList(); + return lmenu; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuLevelTranKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuLevelTranKey.java new file mode 100644 index 0000000..bad775a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuLevelTranKey.java @@ -0,0 +1,205 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEMENULEVELTRAN*/ +@Embeddable +public class TgeneMenuLevelTranKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MENUCODE", nullable=false,updatable=false) + +/** +* Codigo de menu +*/ +private Integer menucode; + +@Column(name="LEVELCODE", nullable=false,updatable=false) + +/** +* Codigo de nivel del menu. +*/ +private Integer levelcode; + +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +/**Contructor por defecto*/ +public TgeneMenuLevelTranKey(){} +/**Contructor de TgeneMenuLevelTranKey +@param pMenucode Codigo de menu +@param pLevelcode Codigo de nivel del menu. +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +*/ +public TgeneMenuLevelTranKey(Integer pMenucode,Integer pLevelcode,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion){ + menucode=pMenucode; + levelcode=pLevelcode; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; +} +/**Obtiene el valor de menucode +@return valor de menucode*/ +public Integer getMenucode(){ + return menucode; +} +/**Fija el valor de menucode +@param pMenucode nuevo Valor de menucode*/ +public void setMenucode(Integer pMenucode){ + menucode=pMenucode; +} + +/**Obtiene el valor de levelcode +@return valor de levelcode*/ +public Integer getLevelcode(){ + return levelcode; +} +/**Fija el valor de levelcode +@param pLevelcode nuevo Valor de levelcode*/ +public void setLevelcode(Integer pLevelcode){ + levelcode=pLevelcode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Implementacin de la comparacin de TgeneMenuLevelTranKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneMenuLevelTranKey))return false; + TgeneMenuLevelTranKey that = (TgeneMenuLevelTranKey) o; + if (this.getMenucode() == null || that.getMenucode() == null){ + return false; + } + if (! this.getMenucode().equals(that.getMenucode())){ + return false; + } + if (this.getLevelcode() == null || that.getLevelcode() == null){ + return false; + } + if (! this.getLevelcode().equals(that.getLevelcode())){ + return false; + } + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneMenuLevelTranKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getMenucode() == null ? 0 : this.getMenucode().hashCode()); + result = result * 37 + (this.getLevelcode() == null ? 0 : this.getLevelcode().hashCode()); + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuProfile.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuProfile.java new file mode 100644 index 0000000..b884c2f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuProfile.java @@ -0,0 +1,163 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; + +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMENUPROFILE*/ +@Entity(name="TgeneMenuProfile") +@Table(name="TGENEMENUPROFILE") +public class TgeneMenuProfile extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneMenuProfile +*/ +@Id +@Column(name="PROFILECODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="MENUCODE", nullable=true) + +/** +* Cdigo del tem de men +*/ +private Integer menucode; + +/**Contructor por defecto*/ +public TgeneMenuProfile(){ +} +/**Contructor de TgeneMenuProfile +@param pPk Clave Primaria del entity +*/ +public TgeneMenuProfile(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneMenuProfile +*/ +public static TgeneMenuProfile find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneMenuProfile obj = pEntityManager.find(TgeneMenuProfile.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneMenuProfile +@return El objeto que referencia a la Clave primaria de TgeneMenuProfile +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneMenuProfile +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneMenuProfile +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de menucode +@return valor de menucode*/ +public Integer getMenucode(){ + return menucode; +} +/**Fija el valor de menucode +@param pMenucode nuevo Valor de menucode*/ +public void setMenucode(Integer pMenucode){ + menucode=pMenucode; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneMenuProfile))return false; + TgeneMenuProfile that = (TgeneMenuProfile) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneMenuProfile +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneMenuProfile +*/ +public Object createInstance(){ + TgeneMenuProfile instance=new TgeneMenuProfile(); + return instance; +} +/**Clona la entidad TgeneMenuProfile +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneMenuProfile p=(TgeneMenuProfile)this.clone(); + return p; +} + + //METODOS MANUALES + /** Sentencia que devuelve un registro de TgeneMenuProfile. */ + private static final String JPQL_MENU_PROFILE = "from TgeneMenuProfile tmp " + " where tmp.pk = :profilecode"; + /** + * Metodo que entrega datos de TgeneMenuProfile. + * + * @param pProfile Codigo de perfil del usuario. + * @return TgeneMenuProfile + * @throws Exception + */ + public static TgeneMenuProfile findByCodePerfilUsuario(EntityManager pEntityManager, String pProfile) throws Exception { + Query qry = pEntityManager.createQuery(TgeneMenuProfile.JPQL_MENU_PROFILE); + qry.setParameter("profilecode", pProfile); + try { + return (TgeneMenuProfile) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevel.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevel.java new file mode 100644 index 0000000..c32b0bd --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevel.java @@ -0,0 +1,168 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.persistence.commondb.exception.CommondbException; + +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMENUSUBLEVEL*/ +@Entity(name="TgeneMenuSubLevel") +@Table(name="TGENEMENUSUBLEVEL") +public class TgeneMenuSubLevel extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneMenuSubLevel +*/ +@EmbeddedId +private TgeneMenuSubLevelKey pk; +@Column(name="PRESENTATIONORDER", nullable=true) + +/** +* Orden de presentacion de la agrupacion en el primer nivel del menu +*/ +private Integer presentationorder; + +/**Contructor por defecto*/ +public TgeneMenuSubLevel(){ +} +/**Contructor de TgeneMenuSubLevel +@param pPk Clave Primaria del entity +*/ +public TgeneMenuSubLevel(TgeneMenuSubLevelKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneMenuSubLevel +*/ +public static TgeneMenuSubLevel find(EntityManager pEntityManager,TgeneMenuSubLevelKey pKey) throws Exception{ + TgeneMenuSubLevel obj = pEntityManager.find(TgeneMenuSubLevel.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneMenuSubLevel +@return El objeto que referencia a la Clave primaria de TgeneMenuSubLevel +*/ +public TgeneMenuSubLevelKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneMenuSubLevel +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneMenuSubLevel +*/ +public void setPk(TgeneMenuSubLevelKey pPk){ + pk=pPk; +} +/**Obtiene el valor de presentationorder +@return valor de presentationorder*/ +public Integer getPresentationorder(){ + return presentationorder; +} +/**Fija el valor de presentationorder +@param pPresentationorder nuevo Valor de presentationorder*/ +public void setPresentationorder(Integer pPresentationorder){ + presentationorder=pPresentationorder; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneMenuSubLevel))return false; + TgeneMenuSubLevel that = (TgeneMenuSubLevel) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneMenuSubLevel +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneMenuSubLevel +*/ +public Object createInstance(){ + TgeneMenuSubLevel instance=new TgeneMenuSubLevel(); + instance.setPk(new TgeneMenuSubLevelKey()); + return instance; +} +/**Clona la entidad TgeneMenuSubLevel +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneMenuSubLevel p=(TgeneMenuSubLevel)this.clone(); + p.setPk((TgeneMenuSubLevelKey)this.pk.cloneMe()); + return p; +} + + //METODOS MANUALES + /** Sentencia que devuelve un registro de TgeneMenuSubLevel. */ + private static final String JPQL_MENU_SUB_LEVEL = "from TgeneMenuSubLevel tmsl " + " where tmsl.pk.menucode = :menucode" + + " and tmsl.pk.levelcode = :levelcode " + " order by tmsl.presentationorder "; + /** + * Metodo que entrega uns lista de definicion del menu de segundo nivel. + * + * @param pMenucode Codigo de menu. + * @param pLevel Codigo del primer nivel. + * @return List + * @throws Exception + */ + @SuppressWarnings(com.fp.common.helper.Constant.VUNCHECKED) + public static List find(EntityManager pEntityManager, Integer pMenucode, Integer pLevel) throws Exception { + List lmenu = null; + Query qry = pEntityManager.createQuery(TgeneMenuSubLevel.JPQL_MENU_SUB_LEVEL); + qry.setParameter("menucode", pMenucode); + qry.setParameter("levelcode", pLevel); + lmenu = qry.getResultList(); + return lmenu; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelDesc.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelDesc.java new file mode 100644 index 0000000..086366a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelDesc.java @@ -0,0 +1,192 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; + +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMENUSUBLEVELDESC*/ +@Entity(name="TgeneMenuSubLevelDesc") +@Table(name="TGENEMENUSUBLEVELDESC") +public class TgeneMenuSubLevelDesc extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneMenuSubLevelDesc +*/ +@EmbeddedId +private TgeneMenuSubLevelDescKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion del sub nivel +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneMenuSubLevelDesc(){ +} +/**Contructor de TgeneMenuSubLevelDesc +@param pPk Clave Primaria del entity +*/ +public TgeneMenuSubLevelDesc(TgeneMenuSubLevelDescKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneMenuSubLevelDesc +*/ +public static TgeneMenuSubLevelDesc find(EntityManager pEntityManager,TgeneMenuSubLevelDescKey pKey) throws Exception{ + TgeneMenuSubLevelDesc obj = pEntityManager.find(TgeneMenuSubLevelDesc.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneMenuSubLevelDesc +@return El objeto que referencia a la Clave primaria de TgeneMenuSubLevelDesc +*/ +public TgeneMenuSubLevelDescKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneMenuSubLevelDesc +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneMenuSubLevelDesc +*/ +public void setPk(TgeneMenuSubLevelDescKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneMenuSubLevelDesc))return false; + TgeneMenuSubLevelDesc that = (TgeneMenuSubLevelDesc) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneMenuSubLevelDesc +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneMenuSubLevelDesc +*/ +public Object createInstance(){ + TgeneMenuSubLevelDesc instance=new TgeneMenuSubLevelDesc(); + instance.setPk(new TgeneMenuSubLevelDescKey()); + return instance; +} +/**Clona la entidad TgeneMenuSubLevelDesc +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneMenuSubLevelDesc p=(TgeneMenuSubLevelDesc)this.clone(); + p.setPk((TgeneMenuSubLevelDescKey)this.pk.cloneMe()); + return p; +} + + //METODOS MANUALES + /** Sentencia que devuelve un registro de TgeneMenuSubLevelDesc. */ + private static final String JPQL_MENU_SLEVEL_DESC = "from TgeneMenuSubLevelDesc tsld" + " where tsld.pk.menucode = :menucode" + + " and tsld.pk.levelcode = :levelcode" + " and tsld.pk.sublevel = :sublevel" + " and tsld.pk.languagecode = :languagecode"; + /** + * Metodo que emtrega la descripcion de un subnivel del menu. + * + * @param pmenucode Codigo de menu. + * @param pLevel Codigo de nivel de menu. + * @param pSublevel Codigo de subnivel de menu. + * @param planguagecode Codigo de lenguaje. + * @return TgeneMenuSubLevelDesc + * @throws Exception + */ + public static TgeneMenuSubLevelDesc find(EntityManager pEntityManager, Integer pmenucode, Integer pLevel, Integer pSublevel, String planguagecode) + throws Exception { + Query qry = pEntityManager.createQuery(TgeneMenuSubLevelDesc.JPQL_MENU_SLEVEL_DESC); + qry.setParameter("menucode", pmenucode); + qry.setParameter("levelcode", pLevel); + qry.setParameter("sublevel", pSublevel); + qry.setParameter("languagecode", planguagecode); + try { + return (TgeneMenuSubLevelDesc) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelDescKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelDescKey.java new file mode 100644 index 0000000..47f069f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelDescKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEMENUSUBLEVELDESC*/ +@Embeddable +public class TgeneMenuSubLevelDescKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MENUCODE", nullable=false,updatable=false) + +/** +* Codigo de menu +*/ +private Integer menucode; + +@Column(name="LEVELCODE", nullable=false,updatable=false) + +/** +* Codigo de nivel del menu. +*/ +private Integer levelcode; + +@Column(name="SUBLEVEL", nullable=false,updatable=false) + +/** +* Sub grupo de menu +*/ +private Integer sublevel; + +@Column(name="LANGUAGECODE", nullable=false,updatable=false) + +/** +* Codigo de idioma +*/ +private String languagecode; + +/**Contructor por defecto*/ +public TgeneMenuSubLevelDescKey(){} +/**Contructor de TgeneMenuSubLevelDescKey +@param pMenucode Codigo de menu +@param pLevelcode Codigo de nivel del menu. +@param pSublevel Sub grupo de menu +@param pLanguagecode Codigo de idioma +*/ +public TgeneMenuSubLevelDescKey(Integer pMenucode,Integer pLevelcode,Integer pSublevel,String pLanguagecode){ + menucode=pMenucode; + levelcode=pLevelcode; + sublevel=pSublevel; + languagecode=pLanguagecode; +} +/**Obtiene el valor de menucode +@return valor de menucode*/ +public Integer getMenucode(){ + return menucode; +} +/**Fija el valor de menucode +@param pMenucode nuevo Valor de menucode*/ +public void setMenucode(Integer pMenucode){ + menucode=pMenucode; +} + +/**Obtiene el valor de levelcode +@return valor de levelcode*/ +public Integer getLevelcode(){ + return levelcode; +} +/**Fija el valor de levelcode +@param pLevelcode nuevo Valor de levelcode*/ +public void setLevelcode(Integer pLevelcode){ + levelcode=pLevelcode; +} + +/**Obtiene el valor de sublevel +@return valor de sublevel*/ +public Integer getSublevel(){ + return sublevel; +} +/**Fija el valor de sublevel +@param pSublevel nuevo Valor de sublevel*/ +public void setSublevel(Integer pSublevel){ + sublevel=pSublevel; +} + +/**Obtiene el valor de languagecode +@return valor de languagecode*/ +public String getLanguagecode(){ + return languagecode; +} +/**Fija el valor de languagecode +@param pLanguagecode nuevo Valor de languagecode*/ +public void setLanguagecode(String pLanguagecode){ + languagecode=pLanguagecode; +} + +/**Implementacin de la comparacin de TgeneMenuSubLevelDescKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneMenuSubLevelDescKey))return false; + TgeneMenuSubLevelDescKey that = (TgeneMenuSubLevelDescKey) o; + if (this.getMenucode() == null || that.getMenucode() == null){ + return false; + } + if (! this.getMenucode().equals(that.getMenucode())){ + return false; + } + if (this.getLevelcode() == null || that.getLevelcode() == null){ + return false; + } + if (! this.getLevelcode().equals(that.getLevelcode())){ + return false; + } + if (this.getSublevel() == null || that.getSublevel() == null){ + return false; + } + if (! this.getSublevel().equals(that.getSublevel())){ + return false; + } + if (this.getLanguagecode() == null || that.getLanguagecode() == null){ + return false; + } + if (! this.getLanguagecode().equals(that.getLanguagecode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneMenuSubLevelDescKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getMenucode() == null ? 0 : this.getMenucode().hashCode()); + result = result * 37 + (this.getLevelcode() == null ? 0 : this.getLevelcode().hashCode()); + result = result * 37 + (this.getSublevel() == null ? 0 : this.getSublevel().hashCode()); + result = result * 37 + (this.getLanguagecode() == null ? 0 : this.getLanguagecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelKey.java new file mode 100644 index 0000000..7d79a34 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEMENUSUBLEVEL*/ +@Embeddable +public class TgeneMenuSubLevelKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MENUCODE", nullable=false,updatable=false) + +/** +* Codigo de menu +*/ +private Integer menucode; + +@Column(name="LEVELCODE", nullable=false,updatable=false) + +/** +* Codigo de nivel del menu. +*/ +private Integer levelcode; + +@Column(name="SUBLEVEL", nullable=false,updatable=false) + +/** +* Sub grupo de menu +*/ +private Integer sublevel; + +/**Contructor por defecto*/ +public TgeneMenuSubLevelKey(){} +/**Contructor de TgeneMenuSubLevelKey +@param pMenucode Codigo de menu +@param pLevelcode Codigo de nivel del menu. +@param pSublevel Sub grupo de menu +*/ +public TgeneMenuSubLevelKey(Integer pMenucode,Integer pLevelcode,Integer pSublevel){ + menucode=pMenucode; + levelcode=pLevelcode; + sublevel=pSublevel; +} +/**Obtiene el valor de menucode +@return valor de menucode*/ +public Integer getMenucode(){ + return menucode; +} +/**Fija el valor de menucode +@param pMenucode nuevo Valor de menucode*/ +public void setMenucode(Integer pMenucode){ + menucode=pMenucode; +} + +/**Obtiene el valor de levelcode +@return valor de levelcode*/ +public Integer getLevelcode(){ + return levelcode; +} +/**Fija el valor de levelcode +@param pLevelcode nuevo Valor de levelcode*/ +public void setLevelcode(Integer pLevelcode){ + levelcode=pLevelcode; +} + +/**Obtiene el valor de sublevel +@return valor de sublevel*/ +public Integer getSublevel(){ + return sublevel; +} +/**Fija el valor de sublevel +@param pSublevel nuevo Valor de sublevel*/ +public void setSublevel(Integer pSublevel){ + sublevel=pSublevel; +} + +/**Implementacin de la comparacin de TgeneMenuSubLevelKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneMenuSubLevelKey))return false; + TgeneMenuSubLevelKey that = (TgeneMenuSubLevelKey) o; + if (this.getMenucode() == null || that.getMenucode() == null){ + return false; + } + if (! this.getMenucode().equals(that.getMenucode())){ + return false; + } + if (this.getLevelcode() == null || that.getLevelcode() == null){ + return false; + } + if (! this.getLevelcode().equals(that.getLevelcode())){ + return false; + } + if (this.getSublevel() == null || that.getSublevel() == null){ + return false; + } + if (! this.getSublevel().equals(that.getSublevel())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneMenuSubLevelKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getMenucode() == null ? 0 : this.getMenucode().hashCode()); + result = result * 37 + (this.getLevelcode() == null ? 0 : this.getLevelcode().hashCode()); + result = result * 37 + (this.getSublevel() == null ? 0 : this.getSublevel().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelTran.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelTran.java new file mode 100644 index 0000000..272bd49 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelTran.java @@ -0,0 +1,139 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMENUSUBLEVELTRAN*/ +@Entity(name="TgeneMenuSubLevelTran") +@Table(name="TGENEMENUSUBLEVELTRAN") +public class TgeneMenuSubLevelTran extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneMenuSubLevelTran +*/ +@EmbeddedId +private TgeneMenuSubLevelTranKey pk; +@Column(name="PRESENTATIONORDER", nullable=true) + +/** +* Orden de presentacion +*/ +private Integer presentationorder; + +/**Contructor por defecto*/ +public TgeneMenuSubLevelTran(){ +} +/**Contructor de TgeneMenuSubLevelTran +@param pPk Clave Primaria del entity +*/ +public TgeneMenuSubLevelTran(TgeneMenuSubLevelTranKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneMenuSubLevelTran +*/ +public static TgeneMenuSubLevelTran find(EntityManager pEntityManager,TgeneMenuSubLevelTranKey pKey) throws Exception{ + TgeneMenuSubLevelTran obj = pEntityManager.find(TgeneMenuSubLevelTran.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneMenuSubLevelTran +@return El objeto que referencia a la Clave primaria de TgeneMenuSubLevelTran +*/ +public TgeneMenuSubLevelTranKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneMenuSubLevelTran +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneMenuSubLevelTran +*/ +public void setPk(TgeneMenuSubLevelTranKey pPk){ + pk=pPk; +} +/**Obtiene el valor de presentationorder +@return valor de presentationorder*/ +public Integer getPresentationorder(){ + return presentationorder; +} +/**Fija el valor de presentationorder +@param pPresentationorder nuevo Valor de presentationorder*/ +public void setPresentationorder(Integer pPresentationorder){ + presentationorder=pPresentationorder; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneMenuSubLevelTran))return false; + TgeneMenuSubLevelTran that = (TgeneMenuSubLevelTran) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneMenuSubLevelTran +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneMenuSubLevelTran +*/ +public Object createInstance(){ + TgeneMenuSubLevelTran instance=new TgeneMenuSubLevelTran(); + instance.setPk(new TgeneMenuSubLevelTranKey()); + return instance; +} +/**Clona la entidad TgeneMenuSubLevelTran +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneMenuSubLevelTran p=(TgeneMenuSubLevelTran)this.clone(); + p.setPk((TgeneMenuSubLevelTranKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelTranKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelTranKey.java new file mode 100644 index 0000000..081535e --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelTranKey.java @@ -0,0 +1,232 @@ +package com.fp.persistence.pgeneral.menu; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEMENUSUBLEVELTRAN*/ +@Embeddable +public class TgeneMenuSubLevelTranKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MENUCODE", nullable=false,updatable=false) + +/** +* Codigo de menu +*/ +private Integer menucode; + +@Column(name="LEVELCODE", nullable=false,updatable=false) + +/** +* Codigo de nivel del menu. +*/ +private Integer levelcode; + +@Column(name="SUBLEVEL", nullable=false,updatable=false) + +/** +* Sub grupo de menu +*/ +private Integer sublevel; + +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +/**Contructor por defecto*/ +public TgeneMenuSubLevelTranKey(){} +/**Contructor de TgeneMenuSubLevelTranKey +@param pMenucode Codigo de menu +@param pLevelcode Codigo de nivel del menu. +@param pSublevel Sub grupo de menu +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +*/ +public TgeneMenuSubLevelTranKey(Integer pMenucode,Integer pLevelcode,Integer pSublevel,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion){ + menucode=pMenucode; + levelcode=pLevelcode; + sublevel=pSublevel; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; +} +/**Obtiene el valor de menucode +@return valor de menucode*/ +public Integer getMenucode(){ + return menucode; +} +/**Fija el valor de menucode +@param pMenucode nuevo Valor de menucode*/ +public void setMenucode(Integer pMenucode){ + menucode=pMenucode; +} + +/**Obtiene el valor de levelcode +@return valor de levelcode*/ +public Integer getLevelcode(){ + return levelcode; +} +/**Fija el valor de levelcode +@param pLevelcode nuevo Valor de levelcode*/ +public void setLevelcode(Integer pLevelcode){ + levelcode=pLevelcode; +} + +/**Obtiene el valor de sublevel +@return valor de sublevel*/ +public Integer getSublevel(){ + return sublevel; +} +/**Fija el valor de sublevel +@param pSublevel nuevo Valor de sublevel*/ +public void setSublevel(Integer pSublevel){ + sublevel=pSublevel; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Implementacin de la comparacin de TgeneMenuSubLevelTranKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneMenuSubLevelTranKey))return false; + TgeneMenuSubLevelTranKey that = (TgeneMenuSubLevelTranKey) o; + if (this.getMenucode() == null || that.getMenucode() == null){ + return false; + } + if (! this.getMenucode().equals(that.getMenucode())){ + return false; + } + if (this.getLevelcode() == null || that.getLevelcode() == null){ + return false; + } + if (! this.getLevelcode().equals(that.getLevelcode())){ + return false; + } + if (this.getSublevel() == null || that.getSublevel() == null){ + return false; + } + if (! this.getSublevel().equals(that.getSublevel())){ + return false; + } + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneMenuSubLevelTranKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getMenucode() == null ? 0 : this.getMenucode().hashCode()); + result = result * 37 + (this.getLevelcode() == null ? 0 : this.getLevelcode().hashCode()); + result = result * 37 + (this.getSublevel() == null ? 0 : this.getSublevel().hashCode()); + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/message/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/message/.svn/entries new file mode 100644 index 0000000..a240e8a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/message/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/message +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneMessageTemplatesDesc.java +file + + + + +2022-07-28T03:40:29.386745Z +9d9afeedf70194b7407089fa38c766fd +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6493 + +TgeneMessageTemplates.java +file + + + + +2022-07-28T03:40:29.386745Z +73263db2ebfb96f77f614992f008f2e9 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4462 + +TgeneMessageTemplatesDescKey.java +file + + + + +2022-07-28T03:40:29.387745Z +f77360429e24a91fd0445ec53e0d3692 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3360 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/message/.svn/text-base/TgeneMessageTemplates.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/message/.svn/text-base/TgeneMessageTemplates.java.svn-base new file mode 100644 index 0000000..f432219 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/message/.svn/text-base/TgeneMessageTemplates.java.svn-base @@ -0,0 +1,158 @@ +package com.fp.persistence.pgeneral.message; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMESSAGETEMPLATES*/ +@Entity(name="TgeneMessageTemplates") +@Table(name="TGENEMESSAGETEMPLATES") +public class TgeneMessageTemplates extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneMessageTemplates +*/ +@Id +@Column(name="CODE" ,nullable=false, updatable=false) +private Integer pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistick locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion default de la plantilla del mensaje +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneMessageTemplates(){ +} +/**Contructor de TgeneMessageTemplates +@param pPk Clave Primaria del entity +*/ +public TgeneMessageTemplates(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneMessageTemplates +*/ +public static TgeneMessageTemplates find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneMessageTemplates obj = pEntityManager.find(TgeneMessageTemplates.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneMessageTemplates +@return El objeto que referencia a la Clave primaria de TgeneMessageTemplates +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneMessageTemplates +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneMessageTemplates +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneMessageTemplates))return false; + TgeneMessageTemplates that = (TgeneMessageTemplates) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneMessageTemplates +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneMessageTemplates +*/ +public Object createInstance(){ + TgeneMessageTemplates instance=new TgeneMessageTemplates(); + return instance; +} +/**Clona la entidad TgeneMessageTemplates +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneMessageTemplates p=(TgeneMessageTemplates)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/message/.svn/text-base/TgeneMessageTemplatesDesc.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/message/.svn/text-base/TgeneMessageTemplatesDesc.java.svn-base new file mode 100644 index 0000000..3ef17bd --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/message/.svn/text-base/TgeneMessageTemplatesDesc.java.svn-base @@ -0,0 +1,233 @@ +package com.fp.persistence.pgeneral.message; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Lob; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMESSAGETEMPLATESDESC */ +@Entity(name = "TgeneMessageTemplatesDesc") +@Table(name = "TGENEMESSAGETEMPLATESDESC") +public class TgeneMessageTemplatesDesc extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneMessageTemplatesDesc + */ + @EmbeddedId + private TgeneMessageTemplatesDescKey pk; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistick locking del registro + */ + private Integer recordversion; + + @Column(name = "DESCRIPTION", nullable = true) + /** + * Descripcion default de la plantilla del mensaje + */ + private String description; + + @Column(name = "TEMPLATE", nullable = true) + /** + * Plantilla del mensaje + */ + private String template; + + /** Contructor por defecto */ + public TgeneMessageTemplatesDesc() { + } + + /** + * Contructor de TgeneMessageTemplatesDesc + * + * @param pPk Clave Primaria del entity + */ + public TgeneMessageTemplatesDesc(TgeneMessageTemplatesDescKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneMessageTemplatesDesc + */ + public static TgeneMessageTemplatesDesc find(EntityManager pEntityManager, TgeneMessageTemplatesDescKey pKey) throws Exception { + TgeneMessageTemplatesDesc obj = pEntityManager.find(TgeneMessageTemplatesDesc.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneMessageTemplatesDesc + * + * @return El objeto que referencia a la Clave primaria de TgeneMessageTemplatesDesc + */ + public TgeneMessageTemplatesDescKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneMessageTemplatesDesc + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneMessageTemplatesDesc + */ + public void setPk(TgeneMessageTemplatesDescKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return this.description; + } + + /** + * Fija el valor de description + * + * @param pDescription nuevo Valor de description + */ + public void setDescription(String pDescription) { + this.description = pDescription; + } + + /** + * Obtiene el valor de template + * + * @return valor de template + */ + public String getTemplate() { + return this.template; + } + + /** + * Fija el valor de template + * + * @param pTemplate nuevo Valor de template + */ + public void setTemplate(String pTemplate) { + this.template = pTemplate; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneMessageTemplatesDesc)) { + return false; + } + TgeneMessageTemplatesDesc that = (TgeneMessageTemplatesDesc) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneMessageTemplatesDesc + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneMessageTemplatesDesc */ + @Override + public Object createInstance() { + TgeneMessageTemplatesDesc instance = new TgeneMessageTemplatesDesc(); + instance.setPk(new TgeneMessageTemplatesDescKey()); + return instance; + } + + /** + * Clona la entidad TgeneMessageTemplatesDesc + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneMessageTemplatesDesc p = (TgeneMessageTemplatesDesc) this.clone(); + p.setPk((TgeneMessageTemplatesDescKey) this.pk.cloneMe()); + return p; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/message/.svn/text-base/TgeneMessageTemplatesDescKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/message/.svn/text-base/TgeneMessageTemplatesDescKey.java.svn-base new file mode 100644 index 0000000..4fa1b05 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/message/.svn/text-base/TgeneMessageTemplatesDescKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.message; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEMESSAGETEMPLATESDESC*/ +@Embeddable +public class TgeneMessageTemplatesDescKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CODE", nullable=false,updatable=false) + +/** +* Codigo de plantilla de mensajes +*/ +private Integer code; + +@Column(name="LANGUAGECODE", nullable=false,updatable=false) + +/** +* Codigo de idioma +*/ +private String languagecode; + +/**Contructor por defecto*/ +public TgeneMessageTemplatesDescKey(){} +/**Contructor de TgeneMessageTemplatesDescKey +@param pCode Codigo de plantilla de mensajes +@param pLanguagecode Codigo de idioma +*/ +public TgeneMessageTemplatesDescKey(Integer pCode,String pLanguagecode){ + code=pCode; + languagecode=pLanguagecode; +} +/**Obtiene el valor de code +@return valor de code*/ +public Integer getCode(){ + return code; +} +/**Fija el valor de code +@param pCode nuevo Valor de code*/ +public void setCode(Integer pCode){ + code=pCode; +} + +/**Obtiene el valor de languagecode +@return valor de languagecode*/ +public String getLanguagecode(){ + return languagecode; +} +/**Fija el valor de languagecode +@param pLanguagecode nuevo Valor de languagecode*/ +public void setLanguagecode(String pLanguagecode){ + languagecode=pLanguagecode; +} + +/**Implementacin de la comparacin de TgeneMessageTemplatesDescKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneMessageTemplatesDescKey))return false; + TgeneMessageTemplatesDescKey that = (TgeneMessageTemplatesDescKey) o; + if (this.getCode() == null || that.getCode() == null){ + return false; + } + if (! this.getCode().equals(that.getCode())){ + return false; + } + if (this.getLanguagecode() == null || that.getLanguagecode() == null){ + return false; + } + if (! this.getLanguagecode().equals(that.getLanguagecode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneMessageTemplatesDescKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCode() == null ? 0 : this.getCode().hashCode()); + result = result * 37 + (this.getLanguagecode() == null ? 0 : this.getLanguagecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/message/TgeneMessageTemplates.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/message/TgeneMessageTemplates.java new file mode 100644 index 0000000..f432219 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/message/TgeneMessageTemplates.java @@ -0,0 +1,158 @@ +package com.fp.persistence.pgeneral.message; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMESSAGETEMPLATES*/ +@Entity(name="TgeneMessageTemplates") +@Table(name="TGENEMESSAGETEMPLATES") +public class TgeneMessageTemplates extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneMessageTemplates +*/ +@Id +@Column(name="CODE" ,nullable=false, updatable=false) +private Integer pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistick locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion default de la plantilla del mensaje +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneMessageTemplates(){ +} +/**Contructor de TgeneMessageTemplates +@param pPk Clave Primaria del entity +*/ +public TgeneMessageTemplates(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneMessageTemplates +*/ +public static TgeneMessageTemplates find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneMessageTemplates obj = pEntityManager.find(TgeneMessageTemplates.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneMessageTemplates +@return El objeto que referencia a la Clave primaria de TgeneMessageTemplates +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneMessageTemplates +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneMessageTemplates +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneMessageTemplates))return false; + TgeneMessageTemplates that = (TgeneMessageTemplates) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneMessageTemplates +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneMessageTemplates +*/ +public Object createInstance(){ + TgeneMessageTemplates instance=new TgeneMessageTemplates(); + return instance; +} +/**Clona la entidad TgeneMessageTemplates +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneMessageTemplates p=(TgeneMessageTemplates)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/message/TgeneMessageTemplatesDesc.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/message/TgeneMessageTemplatesDesc.java new file mode 100644 index 0000000..3ef17bd --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/message/TgeneMessageTemplatesDesc.java @@ -0,0 +1,233 @@ +package com.fp.persistence.pgeneral.message; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Lob; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMESSAGETEMPLATESDESC */ +@Entity(name = "TgeneMessageTemplatesDesc") +@Table(name = "TGENEMESSAGETEMPLATESDESC") +public class TgeneMessageTemplatesDesc extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneMessageTemplatesDesc + */ + @EmbeddedId + private TgeneMessageTemplatesDescKey pk; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistick locking del registro + */ + private Integer recordversion; + + @Column(name = "DESCRIPTION", nullable = true) + /** + * Descripcion default de la plantilla del mensaje + */ + private String description; + + @Column(name = "TEMPLATE", nullable = true) + /** + * Plantilla del mensaje + */ + private String template; + + /** Contructor por defecto */ + public TgeneMessageTemplatesDesc() { + } + + /** + * Contructor de TgeneMessageTemplatesDesc + * + * @param pPk Clave Primaria del entity + */ + public TgeneMessageTemplatesDesc(TgeneMessageTemplatesDescKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneMessageTemplatesDesc + */ + public static TgeneMessageTemplatesDesc find(EntityManager pEntityManager, TgeneMessageTemplatesDescKey pKey) throws Exception { + TgeneMessageTemplatesDesc obj = pEntityManager.find(TgeneMessageTemplatesDesc.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneMessageTemplatesDesc + * + * @return El objeto que referencia a la Clave primaria de TgeneMessageTemplatesDesc + */ + public TgeneMessageTemplatesDescKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneMessageTemplatesDesc + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneMessageTemplatesDesc + */ + public void setPk(TgeneMessageTemplatesDescKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return this.description; + } + + /** + * Fija el valor de description + * + * @param pDescription nuevo Valor de description + */ + public void setDescription(String pDescription) { + this.description = pDescription; + } + + /** + * Obtiene el valor de template + * + * @return valor de template + */ + public String getTemplate() { + return this.template; + } + + /** + * Fija el valor de template + * + * @param pTemplate nuevo Valor de template + */ + public void setTemplate(String pTemplate) { + this.template = pTemplate; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneMessageTemplatesDesc)) { + return false; + } + TgeneMessageTemplatesDesc that = (TgeneMessageTemplatesDesc) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneMessageTemplatesDesc + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneMessageTemplatesDesc */ + @Override + public Object createInstance() { + TgeneMessageTemplatesDesc instance = new TgeneMessageTemplatesDesc(); + instance.setPk(new TgeneMessageTemplatesDescKey()); + return instance; + } + + /** + * Clona la entidad TgeneMessageTemplatesDesc + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneMessageTemplatesDesc p = (TgeneMessageTemplatesDesc) this.clone(); + p.setPk((TgeneMessageTemplatesDescKey) this.pk.cloneMe()); + return p; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/message/TgeneMessageTemplatesDescKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/message/TgeneMessageTemplatesDescKey.java new file mode 100644 index 0000000..4fa1b05 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/message/TgeneMessageTemplatesDescKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.message; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEMESSAGETEMPLATESDESC*/ +@Embeddable +public class TgeneMessageTemplatesDescKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CODE", nullable=false,updatable=false) + +/** +* Codigo de plantilla de mensajes +*/ +private Integer code; + +@Column(name="LANGUAGECODE", nullable=false,updatable=false) + +/** +* Codigo de idioma +*/ +private String languagecode; + +/**Contructor por defecto*/ +public TgeneMessageTemplatesDescKey(){} +/**Contructor de TgeneMessageTemplatesDescKey +@param pCode Codigo de plantilla de mensajes +@param pLanguagecode Codigo de idioma +*/ +public TgeneMessageTemplatesDescKey(Integer pCode,String pLanguagecode){ + code=pCode; + languagecode=pLanguagecode; +} +/**Obtiene el valor de code +@return valor de code*/ +public Integer getCode(){ + return code; +} +/**Fija el valor de code +@param pCode nuevo Valor de code*/ +public void setCode(Integer pCode){ + code=pCode; +} + +/**Obtiene el valor de languagecode +@return valor de languagecode*/ +public String getLanguagecode(){ + return languagecode; +} +/**Fija el valor de languagecode +@param pLanguagecode nuevo Valor de languagecode*/ +public void setLanguagecode(String pLanguagecode){ + languagecode=pLanguagecode; +} + +/**Implementacin de la comparacin de TgeneMessageTemplatesDescKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneMessageTemplatesDescKey))return false; + TgeneMessageTemplatesDescKey that = (TgeneMessageTemplatesDescKey) o; + if (this.getCode() == null || that.getCode() == null){ + return false; + } + if (! this.getCode().equals(that.getCode())){ + return false; + } + if (this.getLanguagecode() == null || that.getLanguagecode() == null){ + return false; + } + if (! this.getLanguagecode().equals(that.getLanguagecode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneMessageTemplatesDescKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCode() == null ? 0 : this.getCode().hashCode()); + result = result * 37 + (this.getLanguagecode() == null ? 0 : this.getLanguagecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/.svn/entries new file mode 100644 index 0000000..398f9d4 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/.svn/entries @@ -0,0 +1,198 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneMessageStructureHeader.java +file + + + + +2022-07-28T03:40:29.439745Z +479a90227766d5ac9fba8c8b2d171e6e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +11449 + +TgeneMessageStructureData.java +file + + + + +2022-07-28T03:40:29.439745Z +9cad336153264e79d65f62669077e277 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +11369 + +TgeneMessageStructure.java +file + + + + +2022-07-28T03:40:29.439745Z +4de7777259f10c280b718c54ebdc9f2c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9267 + +TgeneMessageStructureHeaderKey.java +file + + + + +2022-07-28T03:40:29.439745Z +a70e620f25ce0d61c7da826d449bac98 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3553 + +TgeneMessageStructureDataKey.java +file + + + + +2022-07-28T03:40:29.440745Z +176ecb59c2467f2c23d96e802298b1b6 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3533 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/.svn/text-base/TgeneMessageStructure.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/.svn/text-base/TgeneMessageStructure.java.svn-base new file mode 100644 index 0000000..f7ff950 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/.svn/text-base/TgeneMessageStructure.java.svn-base @@ -0,0 +1,339 @@ +package com.fp.persistence.pgeneral.msg; + +import javax.persistence.Entity; +import com.fp.dto.hb.Log; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMESSAGESTRUCTURE*/ +@Entity(name="TgeneMessageStructure") +@Table(name="TGENEMESSAGESTRUCTURE") +public class TgeneMessageStructure extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneMessageStructure +*/ +@Id +@Column(name="STRUCTURECODE" ,nullable=false, updatable=false) +private String pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion de la estructuura, propisito de la estructura +*/ +private String description; + +@Column(name="HAVEHEADER", nullable=true) + +/** +* Y indica que el archivo tiene cabecera, N el archivo no tiene cabecera. +*/ +private String haveheader; + +@Column(name="HEADERLENGTH", nullable=true) + +/** +* Longitud del header si tiene header, puede tener longitud o caracter de finalizacion. +*/ +private Integer headerlength; + +@Column(name="HEADERSEPARATOR", nullable=true) + +/** +* Serador de campos del header. +*/ +private String headerseparator; + +@Column(name="ENDDATACHARACTER", nullable=true) + +/** +* Caracter de finalizacion de un registro de datos. +*/ +private String enddatacharacter; + +@Column(name="RECORDLENGTH", nullable=true) + +/** +* Longuitud de un registro de datos. +*/ +private Integer recordlength; + +@Column(name="RECORDSEPARATOR", nullable=true) + +/** +* Separador de campos de datos. +*/ +private String recordseparator; + +@Column(name="FORMATDATE", nullable=true) + +/** +* Formato de fecha que llega en los registros puede ser del header o de la data. +*/ +private String formatdate; + +@Column(name="FORMATTIME", nullable=true) + +/** +* Formato de tiempo, horas minutos, segundos +*/ +private String formattime; + +@Column(name="HEADERCLASS", nullable=true) + +/** +* Clase que se encarga de manipular el header, ejemplo almacenar los datos en una tabla. +*/ +private String headerclass; + +@Column(name="DETAILCLASS", nullable=true) + +/** +* Clase que se encarga de manipular los registros de datos, ejemplo almacenar los datos en una tabla. +*/ +private String detailclass; + +/**Contructor por defecto*/ +public TgeneMessageStructure(){ +} +/**Contructor de TgeneMessageStructure +@param pPk Clave Primaria del entity +*/ +public TgeneMessageStructure(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneMessageStructure +*/ +public static TgeneMessageStructure find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneMessageStructure obj = pEntityManager.find(TgeneMessageStructure.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneMessageStructure +@return El objeto que referencia a la Clave primaria de TgeneMessageStructure +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneMessageStructure +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneMessageStructure +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de haveheader +@return valor de haveheader*/ +public String getHaveheader(){ + return haveheader; +} +/**Fija el valor de haveheader +@param pHaveheader nuevo Valor de haveheader*/ +public void setHaveheader(String pHaveheader){ + haveheader=pHaveheader; +} + +/**Obtiene el valor de headerlength +@return valor de headerlength*/ +public Integer getHeaderlength(){ + return headerlength; +} +/**Fija el valor de headerlength +@param pHeaderlength nuevo Valor de headerlength*/ +public void setHeaderlength(Integer pHeaderlength){ + headerlength=pHeaderlength; +} + +/**Obtiene el valor de headerseparator +@return valor de headerseparator*/ +public String getHeaderseparator(){ + return headerseparator; +} +/**Fija el valor de headerseparator +@param pHeaderseparator nuevo Valor de headerseparator*/ +public void setHeaderseparator(String pHeaderseparator){ + headerseparator=pHeaderseparator; +} + +/**Obtiene el valor de enddatacharacter +@return valor de enddatacharacter*/ +public String getEnddatacharacter(){ + return enddatacharacter; +} +/**Fija el valor de enddatacharacter +@param pEnddatacharacter nuevo Valor de enddatacharacter*/ +public void setEnddatacharacter(String pEnddatacharacter){ + enddatacharacter=pEnddatacharacter; +} + +/**Obtiene el valor de recordlength +@return valor de recordlength*/ +public Integer getRecordlength(){ + return recordlength; +} +/**Fija el valor de recordlength +@param pRecordlength nuevo Valor de recordlength*/ +public void setRecordlength(Integer pRecordlength){ + recordlength=pRecordlength; +} + +/**Obtiene el valor de recordseparator +@return valor de recordseparator*/ +public String getRecordseparator(){ + return recordseparator; +} +/**Fija el valor de recordseparator +@param pRecordseparator nuevo Valor de recordseparator*/ +public void setRecordseparator(String pRecordseparator){ + recordseparator=pRecordseparator; +} + +/**Obtiene el valor de formatdate +@return valor de formatdate*/ +public String getFormatdate(){ + return formatdate; +} +/**Fija el valor de formatdate +@param pFormatdate nuevo Valor de formatdate*/ +public void setFormatdate(String pFormatdate){ + formatdate=pFormatdate; +} + +/**Obtiene el valor de formattime +@return valor de formattime*/ +public String getFormattime(){ + return formattime; +} +/**Fija el valor de formattime +@param pFormattime nuevo Valor de formattime*/ +public void setFormattime(String pFormattime){ + formattime=pFormattime; +} + +/**Obtiene el valor de headerclass +@return valor de headerclass*/ +public String getHeaderclass(){ + return headerclass; +} +/**Fija el valor de headerclass +@param pHeaderclass nuevo Valor de headerclass*/ +public void setHeaderclass(String pHeaderclass){ + headerclass=pHeaderclass; +} + +/**Obtiene el valor de detailclass +@return valor de detailclass*/ +public String getDetailclass(){ + return detailclass; +} +/**Fija el valor de detailclass +@param pDetailclass nuevo Valor de detailclass*/ +public void setDetailclass(String pDetailclass){ + detailclass=pDetailclass; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneMessageStructure))return false; + TgeneMessageStructure that = (TgeneMessageStructure) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneMessageStructure +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneMessageStructure +*/ +public Object createInstance(){ + TgeneMessageStructure instance=new TgeneMessageStructure(); + return instance; +} +/**Clona la entidad TgeneMessageStructure +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneMessageStructure p=(TgeneMessageStructure)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/.svn/text-base/TgeneMessageStructureData.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/.svn/text-base/TgeneMessageStructureData.java.svn-base new file mode 100644 index 0000000..0435aa4 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/.svn/text-base/TgeneMessageStructureData.java.svn-base @@ -0,0 +1,474 @@ +package com.fp.persistence.pgeneral.msg; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENEMESSAGESTRUCTUREDATA + */ +@Entity(name = "TgeneMessageStructureData") +@Table(name = "TGENEMESSAGESTRUCTUREDATA") +public class TgeneMessageStructureData extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, + Cloneable, Log { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneMessageStructureData + */ + @EmbeddedId + private TgeneMessageStructureDataKey pk; + @Column(name = "DESCRIPTION", nullable = true) + /** + * Nombre de la columna dentro del archivo + */ + private String description; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "DATATYPE", nullable = false) + /** + * Tipo de dato del campo, sirve para verificar si es un numero no se ingrese caracteres. + */ + private String datatype; + + @Column(name = "LENGTH", nullable = true) + /** + * Longitud de lectura del campo. + */ + private Integer length; + + @Column(name = "REQUIRED", nullable = true) + /** + * Y si el campo es requerido + */ + private String required; + + @Column(name = "INITPOSITION", nullable = true) + /** + * Si el campo no maneja separadores, aqui se define la posicion inicial del registro. + */ + private Integer initposition; + + @Column(name = "ENDPOSITION", nullable = true) + /** + * Si el campo no maneja separadores, aqui se define la posicion final del registro. + */ + private Integer endposition; + + @Column(name = "DECIMALNUMBER", nullable = true) + /** + * Numero de decimales + */ + private Integer decimalnumber; + + @Column(name = "INITVALUE", nullable = true) + /** + * Valor por defecto o inicial del campo. + */ + private String initvalue; + + @Column(name = "FILLERCHARACTER", nullable = true) + /** + * Caracter de relleno del campo + */ + private String fillercharacter; + + @Column(name = "LEFTREFILLER", nullable = true) + /** + * Y indica que el campo se rellena a la izquiera con el caracter de relleno hasta completar la longitud del campo. + */ + private String leftrefiller; + + @Column(name = "ATTRIBUTE", nullable = true) + /** + * Nombre del campo asociado a un bean. + */ + private String attribute; + + /** Contructor por defecto */ + public TgeneMessageStructureData() { + } + + /** + * Contructor de TgeneMessageStructureData + * + * @param pPk Clave Primaria del entity + * @param pDatatype Tipo de dato del campo, sirve para verificar si es un + * numero no se ingrese caracteres. + */ + public TgeneMessageStructureData(TgeneMessageStructureDataKey pPk, String pDatatype) { + this(); + pk = pPk; + datatype = pDatatype; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneMessageStructureData + */ + public static TgeneMessageStructureData find(EntityManager pEntityManager, TgeneMessageStructureDataKey pKey) + throws Exception { + TgeneMessageStructureData obj = pEntityManager.find(TgeneMessageStructureData.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneMessageStructureData + * + * @return El objeto que referencia a la Clave primaria de + * TgeneMessageStructureData + */ + public TgeneMessageStructureDataKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneMessageStructureData + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TgeneMessageStructureData + */ + public void setPk(TgeneMessageStructureDataKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de datatype + * + * @return valor de datatype + */ + public String getDatatype() { + return datatype; + } + + /** + * Fija el valor de datatype + * + * @param pDatatype nuevo Valor de datatype + */ + public void setDatatype(String pDatatype) { + datatype = pDatatype; + } + + /** + * Obtiene el valor de length + * + * @return valor de length + */ + public Integer getLength() { + return length; + } + + /** + * Fija el valor de length + * + * @param pLength nuevo Valor de length + */ + public void setLength(Integer pLength) { + length = pLength; + } + + /** + * Obtiene el valor de required + * + * @return valor de required + */ + public String getRequired() { + return required; + } + + /** + * Fija el valor de required + * + * @param pRequired nuevo Valor de required + */ + public void setRequired(String pRequired) { + required = pRequired; + } + + /** + * Obtiene el valor de initposition + * + * @return valor de initposition + */ + public Integer getInitposition() { + return initposition; + } + + /** + * Fija el valor de initposition + * + * @param pInitposition nuevo Valor de initposition + */ + public void setInitposition(Integer pInitposition) { + initposition = pInitposition; + } + + /** + * Obtiene el valor de endposition + * + * @return valor de endposition + */ + public Integer getEndposition() { + return endposition; + } + + /** + * Fija el valor de endposition + * + * @param pEndposition nuevo Valor de endposition + */ + public void setEndposition(Integer pEndposition) { + endposition = pEndposition; + } + + /** + * Obtiene el valor de decimalnumber + * + * @return valor de decimalnumber + */ + public Integer getDecimalnumber() { + return decimalnumber; + } + + /** + * Fija el valor de decimalnumber + * + * @param pDecimalnumber nuevo Valor de decimalnumber + */ + public void setDecimalnumber(Integer pDecimalnumber) { + decimalnumber = pDecimalnumber; + } + + /** + * Obtiene el valor de initvalue + * + * @return valor de initvalue + */ + public String getInitvalue() { + return initvalue; + } + + /** + * Fija el valor de initvalue + * + * @param pInitvalue nuevo Valor de initvalue + */ + public void setInitvalue(String pInitvalue) { + initvalue = pInitvalue; + } + + /** + * Obtiene el valor de fillercharacter + * + * @return valor de fillercharacter + */ + public String getFillercharacter() { + return fillercharacter; + } + + /** + * Fija el valor de fillercharacter + * + * @param pFillercharacter nuevo Valor de fillercharacter + */ + public void setFillercharacter(String pFillercharacter) { + fillercharacter = pFillercharacter; + } + + /** + * Obtiene el valor de leftrefiller + * + * @return valor de leftrefiller + */ + public String getLeftrefiller() { + return leftrefiller; + } + + /** + * Fija el valor de leftrefiller + * + * @param pLeftrefiller nuevo Valor de leftrefiller + */ + public void setLeftrefiller(String pLeftrefiller) { + leftrefiller = pLeftrefiller; + } + + /** + * Obtiene el valor de attribute + * + * @return valor de attribute + */ + public String getAttribute() { + return attribute; + } + + /** + * Fija el valor de attribute + * + * @param pAttribute nuevo Valor de attribute + */ + public void setAttribute(String pAttribute) { + attribute = pAttribute; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneMessageStructureData)) + return false; + TgeneMessageStructureData that = (TgeneMessageStructureData) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad + * TgeneMessageStructureData + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco + * TgeneMessageStructureData + */ + public Object createInstance() { + TgeneMessageStructureData instance = new TgeneMessageStructureData(); + instance.setPk(new TgeneMessageStructureDataKey()); + return instance; + } + + /** + * Clona la entidad TgeneMessageStructureData + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneMessageStructureData p = (TgeneMessageStructureData) this.clone(); + p.setPk((TgeneMessageStructureDataKey) this.pk.cloneMe()); + return p; + } + + //METODOS MANUALES + private static final String HQL_WITH_FILTER = + "from TgeneMessageStructureData tb " + + " where tb.pk.structurecode = :structurecode " + + " order by tb.pk.code "; + + /** + * Metodo que devuelve una lista de objetos TgeneMessageStructureData + * @param pEntityManager + * @param structurecode Codigo de estructura + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String structurecode) throws Exception { + List lStructure = null; + Query qry = pEntityManager.createQuery(HQL_WITH_FILTER); + qry.setParameter("structurecode", structurecode); + lStructure = qry.getResultList(); + return lStructure; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/.svn/text-base/TgeneMessageStructureDataKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/.svn/text-base/TgeneMessageStructureDataKey.java.svn-base new file mode 100644 index 0000000..3262cf8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/.svn/text-base/TgeneMessageStructureDataKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.msg; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEMESSAGESTRUCTUREDATA*/ +@Embeddable +public class TgeneMessageStructureDataKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="STRUCTURECODE", nullable=false,updatable=false) + +/** +* Codigo de estructura de mensaje +*/ +private String structurecode; + +@Column(name="CODE", nullable=false,updatable=false) + +/** +* Codigo de estructura de mensaje +*/ +private Integer code; + +/**Contructor por defecto*/ +public TgeneMessageStructureDataKey(){} +/**Contructor de TgeneMessageStructureDataKey +@param pStructurecode Codigo de estructura de mensaje +@param pCode Codigo de estructura de mensaje +*/ +public TgeneMessageStructureDataKey(String pStructurecode,Integer pCode){ + structurecode=pStructurecode; + code=pCode; +} +/**Obtiene el valor de structurecode +@return valor de structurecode*/ +public String getStructurecode(){ + return structurecode; +} +/**Fija el valor de structurecode +@param pStructurecode nuevo Valor de structurecode*/ +public void setStructurecode(String pStructurecode){ + structurecode=pStructurecode; +} + +/**Obtiene el valor de code +@return valor de code*/ +public Integer getCode(){ + return code; +} +/**Fija el valor de code +@param pCode nuevo Valor de code*/ +public void setCode(Integer pCode){ + code=pCode; +} + +/**Implementacin de la comparacin de TgeneMessageStructureDataKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneMessageStructureDataKey))return false; + TgeneMessageStructureDataKey that = (TgeneMessageStructureDataKey) o; + if (this.getStructurecode() == null || that.getStructurecode() == null){ + return false; + } + if (! this.getStructurecode().equals(that.getStructurecode())){ + return false; + } + if (this.getCode() == null || that.getCode() == null){ + return false; + } + if (! this.getCode().equals(that.getCode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneMessageStructureDataKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getStructurecode() == null ? 0 : this.getStructurecode().hashCode()); + result = result * 37 + (this.getCode() == null ? 0 : this.getCode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/.svn/text-base/TgeneMessageStructureHeader.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/.svn/text-base/TgeneMessageStructureHeader.java.svn-base new file mode 100644 index 0000000..d33a099 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/.svn/text-base/TgeneMessageStructureHeader.java.svn-base @@ -0,0 +1,474 @@ +package com.fp.persistence.pgeneral.msg; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENEMESSAGESTRUCTUREHEADER + */ +@Entity(name = "TgeneMessageStructureHeader") +@Table(name = "TGENEMESSAGESTRUCTUREHEADER") +public class TgeneMessageStructureHeader extends com.fp.dto.AbstractDataTransport implements Serializable, + HibernateBean, Cloneable, Log { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneMessageStructureHeader + */ + @EmbeddedId + private TgeneMessageStructureHeaderKey pk; + @Column(name = "DESCRIPTION", nullable = true) + /** + * Nombre de la columna dentro del archivo + */ + private String description; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "DATATYPE", nullable = false) + /** + * Tipo de dato del campo, sirve para verificar si es un numero no se ingrese caracteres. + */ + private String datatype; + + @Column(name = "LENGTH", nullable = true) + /** + * Longitud de lectura del campo. + */ + private Integer length; + + @Column(name = "REQUIRED", nullable = true) + /** + * Y si el campo es requerido + */ + private String required; + + @Column(name = "INITPOSITION", nullable = true) + /** + * Si el campo no maneja separadores, aqui se define la posicion inicial del registro. + */ + private Integer initposition; + + @Column(name = "ENDPOSITION", nullable = true) + /** + * Si el campo no maneja separadores, aqui se define la posicion final del registro. + */ + private Integer endposition; + + @Column(name = "DECIMALNUMBER", nullable = true) + /** + * Numero de decimales + */ + private Integer decimalnumber; + + @Column(name = "INITVALUE", nullable = true) + /** + * Valor por defecto o inicial del campo. + */ + private String initvalue; + + @Column(name = "FILLERCHARACTER", nullable = true) + /** + * Caracter de relleno del campo + */ + private String fillercharacter; + + @Column(name = "LEFTREFILLER", nullable = true) + /** + * Y indica que el campo se rellena a la izquiera con el caracter de relleno hasta completar la longitud del campo. + */ + private String leftrefiller; + + @Column(name = "ATTRIBUTE", nullable = true) + /** + * Nombre del campo asociado a un bean. + */ + private String attribute; + + /** Contructor por defecto */ + public TgeneMessageStructureHeader() { + } + + /** + * Contructor de TgeneMessageStructureHeader + * + * @param pPk Clave Primaria del entity + * @param pDatatype Tipo de dato del campo, sirve para verificar si es un + * numero no se ingrese caracteres. + */ + public TgeneMessageStructureHeader(TgeneMessageStructureHeaderKey pPk, String pDatatype) { + this(); + pk = pPk; + datatype = pDatatype; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneMessageStructureHeader + */ + public static TgeneMessageStructureHeader find(EntityManager pEntityManager, TgeneMessageStructureHeaderKey pKey) + throws Exception { + TgeneMessageStructureHeader obj = pEntityManager.find(TgeneMessageStructureHeader.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneMessageStructureHeader + * + * @return El objeto que referencia a la Clave primaria de + * TgeneMessageStructureHeader + */ + public TgeneMessageStructureHeaderKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneMessageStructureHeader + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TgeneMessageStructureHeader + */ + public void setPk(TgeneMessageStructureHeaderKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de datatype + * + * @return valor de datatype + */ + public String getDatatype() { + return datatype; + } + + /** + * Fija el valor de datatype + * + * @param pDatatype nuevo Valor de datatype + */ + public void setDatatype(String pDatatype) { + datatype = pDatatype; + } + + /** + * Obtiene el valor de length + * + * @return valor de length + */ + public Integer getLength() { + return length; + } + + /** + * Fija el valor de length + * + * @param pLength nuevo Valor de length + */ + public void setLength(Integer pLength) { + length = pLength; + } + + /** + * Obtiene el valor de required + * + * @return valor de required + */ + public String getRequired() { + return required; + } + + /** + * Fija el valor de required + * + * @param pRequired nuevo Valor de required + */ + public void setRequired(String pRequired) { + required = pRequired; + } + + /** + * Obtiene el valor de initposition + * + * @return valor de initposition + */ + public Integer getInitposition() { + return initposition; + } + + /** + * Fija el valor de initposition + * + * @param pInitposition nuevo Valor de initposition + */ + public void setInitposition(Integer pInitposition) { + initposition = pInitposition; + } + + /** + * Obtiene el valor de endposition + * + * @return valor de endposition + */ + public Integer getEndposition() { + return endposition; + } + + /** + * Fija el valor de endposition + * + * @param pEndposition nuevo Valor de endposition + */ + public void setEndposition(Integer pEndposition) { + endposition = pEndposition; + } + + /** + * Obtiene el valor de decimalnumber + * + * @return valor de decimalnumber + */ + public Integer getDecimalnumber() { + return decimalnumber; + } + + /** + * Fija el valor de decimalnumber + * + * @param pDecimalnumber nuevo Valor de decimalnumber + */ + public void setDecimalnumber(Integer pDecimalnumber) { + decimalnumber = pDecimalnumber; + } + + /** + * Obtiene el valor de initvalue + * + * @return valor de initvalue + */ + public String getInitvalue() { + return initvalue; + } + + /** + * Fija el valor de initvalue + * + * @param pInitvalue nuevo Valor de initvalue + */ + public void setInitvalue(String pInitvalue) { + initvalue = pInitvalue; + } + + /** + * Obtiene el valor de fillercharacter + * + * @return valor de fillercharacter + */ + public String getFillercharacter() { + return fillercharacter; + } + + /** + * Fija el valor de fillercharacter + * + * @param pFillercharacter nuevo Valor de fillercharacter + */ + public void setFillercharacter(String pFillercharacter) { + fillercharacter = pFillercharacter; + } + + /** + * Obtiene el valor de leftrefiller + * + * @return valor de leftrefiller + */ + public String getLeftrefiller() { + return leftrefiller; + } + + /** + * Fija el valor de leftrefiller + * + * @param pLeftrefiller nuevo Valor de leftrefiller + */ + public void setLeftrefiller(String pLeftrefiller) { + leftrefiller = pLeftrefiller; + } + + /** + * Obtiene el valor de attribute + * + * @return valor de attribute + */ + public String getAttribute() { + return attribute; + } + + /** + * Fija el valor de attribute + * + * @param pAttribute nuevo Valor de attribute + */ + public void setAttribute(String pAttribute) { + attribute = pAttribute; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneMessageStructureHeader)) + return false; + TgeneMessageStructureHeader that = (TgeneMessageStructureHeader) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad + * TgeneMessageStructureHeader + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco + * TgeneMessageStructureHeader + */ + public Object createInstance() { + TgeneMessageStructureHeader instance = new TgeneMessageStructureHeader(); + instance.setPk(new TgeneMessageStructureHeaderKey()); + return instance; + } + + /** + * Clona la entidad TgeneMessageStructureHeader + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneMessageStructureHeader p = (TgeneMessageStructureHeader) this.clone(); + p.setPk((TgeneMessageStructureHeaderKey) this.pk.cloneMe()); + return p; + } + + //METODOS MANUALES + private static final String HQL_WITH_FILTER = + "from TgeneMessageStructureHeader tb " + + " where tb.pk.structurecode = :structurecode " + + " order by tb.pk.code "; + + /** + * Metodo que devuelve una lista de objetos TgeneMessageStructureHeader + * @param pEntityManager + * @param structurecode Codigo de estructura + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String structurecode) throws Exception { + List lStructure = null; + Query qry = pEntityManager.createQuery(HQL_WITH_FILTER); + qry.setParameter("structurecode", structurecode); + lStructure = qry.getResultList(); + return lStructure; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/.svn/text-base/TgeneMessageStructureHeaderKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/.svn/text-base/TgeneMessageStructureHeaderKey.java.svn-base new file mode 100644 index 0000000..2b8d5c4 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/.svn/text-base/TgeneMessageStructureHeaderKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.msg; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEMESSAGESTRUCTUREHEADER*/ +@Embeddable +public class TgeneMessageStructureHeaderKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="STRUCTURECODE", nullable=false,updatable=false) + +/** +* Codigo de estructura de mensaje +*/ +private String structurecode; + +@Column(name="CODE", nullable=false,updatable=false) + +/** +* Codigo de estructura de mensaje +*/ +private Integer code; + +/**Contructor por defecto*/ +public TgeneMessageStructureHeaderKey(){} +/**Contructor de TgeneMessageStructureHeaderKey +@param pStructurecode Codigo de estructura de mensaje +@param pCode Codigo de estructura de mensaje +*/ +public TgeneMessageStructureHeaderKey(String pStructurecode,Integer pCode){ + structurecode=pStructurecode; + code=pCode; +} +/**Obtiene el valor de structurecode +@return valor de structurecode*/ +public String getStructurecode(){ + return structurecode; +} +/**Fija el valor de structurecode +@param pStructurecode nuevo Valor de structurecode*/ +public void setStructurecode(String pStructurecode){ + structurecode=pStructurecode; +} + +/**Obtiene el valor de code +@return valor de code*/ +public Integer getCode(){ + return code; +} +/**Fija el valor de code +@param pCode nuevo Valor de code*/ +public void setCode(Integer pCode){ + code=pCode; +} + +/**Implementacin de la comparacin de TgeneMessageStructureHeaderKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneMessageStructureHeaderKey))return false; + TgeneMessageStructureHeaderKey that = (TgeneMessageStructureHeaderKey) o; + if (this.getStructurecode() == null || that.getStructurecode() == null){ + return false; + } + if (! this.getStructurecode().equals(that.getStructurecode())){ + return false; + } + if (this.getCode() == null || that.getCode() == null){ + return false; + } + if (! this.getCode().equals(that.getCode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneMessageStructureHeaderKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getStructurecode() == null ? 0 : this.getStructurecode().hashCode()); + result = result * 37 + (this.getCode() == null ? 0 : this.getCode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/TgeneMessageStructure.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/TgeneMessageStructure.java new file mode 100644 index 0000000..f7ff950 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/TgeneMessageStructure.java @@ -0,0 +1,339 @@ +package com.fp.persistence.pgeneral.msg; + +import javax.persistence.Entity; +import com.fp.dto.hb.Log; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMESSAGESTRUCTURE*/ +@Entity(name="TgeneMessageStructure") +@Table(name="TGENEMESSAGESTRUCTURE") +public class TgeneMessageStructure extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneMessageStructure +*/ +@Id +@Column(name="STRUCTURECODE" ,nullable=false, updatable=false) +private String pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion de la estructuura, propisito de la estructura +*/ +private String description; + +@Column(name="HAVEHEADER", nullable=true) + +/** +* Y indica que el archivo tiene cabecera, N el archivo no tiene cabecera. +*/ +private String haveheader; + +@Column(name="HEADERLENGTH", nullable=true) + +/** +* Longitud del header si tiene header, puede tener longitud o caracter de finalizacion. +*/ +private Integer headerlength; + +@Column(name="HEADERSEPARATOR", nullable=true) + +/** +* Serador de campos del header. +*/ +private String headerseparator; + +@Column(name="ENDDATACHARACTER", nullable=true) + +/** +* Caracter de finalizacion de un registro de datos. +*/ +private String enddatacharacter; + +@Column(name="RECORDLENGTH", nullable=true) + +/** +* Longuitud de un registro de datos. +*/ +private Integer recordlength; + +@Column(name="RECORDSEPARATOR", nullable=true) + +/** +* Separador de campos de datos. +*/ +private String recordseparator; + +@Column(name="FORMATDATE", nullable=true) + +/** +* Formato de fecha que llega en los registros puede ser del header o de la data. +*/ +private String formatdate; + +@Column(name="FORMATTIME", nullable=true) + +/** +* Formato de tiempo, horas minutos, segundos +*/ +private String formattime; + +@Column(name="HEADERCLASS", nullable=true) + +/** +* Clase que se encarga de manipular el header, ejemplo almacenar los datos en una tabla. +*/ +private String headerclass; + +@Column(name="DETAILCLASS", nullable=true) + +/** +* Clase que se encarga de manipular los registros de datos, ejemplo almacenar los datos en una tabla. +*/ +private String detailclass; + +/**Contructor por defecto*/ +public TgeneMessageStructure(){ +} +/**Contructor de TgeneMessageStructure +@param pPk Clave Primaria del entity +*/ +public TgeneMessageStructure(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneMessageStructure +*/ +public static TgeneMessageStructure find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneMessageStructure obj = pEntityManager.find(TgeneMessageStructure.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneMessageStructure +@return El objeto que referencia a la Clave primaria de TgeneMessageStructure +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneMessageStructure +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneMessageStructure +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de haveheader +@return valor de haveheader*/ +public String getHaveheader(){ + return haveheader; +} +/**Fija el valor de haveheader +@param pHaveheader nuevo Valor de haveheader*/ +public void setHaveheader(String pHaveheader){ + haveheader=pHaveheader; +} + +/**Obtiene el valor de headerlength +@return valor de headerlength*/ +public Integer getHeaderlength(){ + return headerlength; +} +/**Fija el valor de headerlength +@param pHeaderlength nuevo Valor de headerlength*/ +public void setHeaderlength(Integer pHeaderlength){ + headerlength=pHeaderlength; +} + +/**Obtiene el valor de headerseparator +@return valor de headerseparator*/ +public String getHeaderseparator(){ + return headerseparator; +} +/**Fija el valor de headerseparator +@param pHeaderseparator nuevo Valor de headerseparator*/ +public void setHeaderseparator(String pHeaderseparator){ + headerseparator=pHeaderseparator; +} + +/**Obtiene el valor de enddatacharacter +@return valor de enddatacharacter*/ +public String getEnddatacharacter(){ + return enddatacharacter; +} +/**Fija el valor de enddatacharacter +@param pEnddatacharacter nuevo Valor de enddatacharacter*/ +public void setEnddatacharacter(String pEnddatacharacter){ + enddatacharacter=pEnddatacharacter; +} + +/**Obtiene el valor de recordlength +@return valor de recordlength*/ +public Integer getRecordlength(){ + return recordlength; +} +/**Fija el valor de recordlength +@param pRecordlength nuevo Valor de recordlength*/ +public void setRecordlength(Integer pRecordlength){ + recordlength=pRecordlength; +} + +/**Obtiene el valor de recordseparator +@return valor de recordseparator*/ +public String getRecordseparator(){ + return recordseparator; +} +/**Fija el valor de recordseparator +@param pRecordseparator nuevo Valor de recordseparator*/ +public void setRecordseparator(String pRecordseparator){ + recordseparator=pRecordseparator; +} + +/**Obtiene el valor de formatdate +@return valor de formatdate*/ +public String getFormatdate(){ + return formatdate; +} +/**Fija el valor de formatdate +@param pFormatdate nuevo Valor de formatdate*/ +public void setFormatdate(String pFormatdate){ + formatdate=pFormatdate; +} + +/**Obtiene el valor de formattime +@return valor de formattime*/ +public String getFormattime(){ + return formattime; +} +/**Fija el valor de formattime +@param pFormattime nuevo Valor de formattime*/ +public void setFormattime(String pFormattime){ + formattime=pFormattime; +} + +/**Obtiene el valor de headerclass +@return valor de headerclass*/ +public String getHeaderclass(){ + return headerclass; +} +/**Fija el valor de headerclass +@param pHeaderclass nuevo Valor de headerclass*/ +public void setHeaderclass(String pHeaderclass){ + headerclass=pHeaderclass; +} + +/**Obtiene el valor de detailclass +@return valor de detailclass*/ +public String getDetailclass(){ + return detailclass; +} +/**Fija el valor de detailclass +@param pDetailclass nuevo Valor de detailclass*/ +public void setDetailclass(String pDetailclass){ + detailclass=pDetailclass; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneMessageStructure))return false; + TgeneMessageStructure that = (TgeneMessageStructure) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneMessageStructure +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneMessageStructure +*/ +public Object createInstance(){ + TgeneMessageStructure instance=new TgeneMessageStructure(); + return instance; +} +/**Clona la entidad TgeneMessageStructure +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneMessageStructure p=(TgeneMessageStructure)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/TgeneMessageStructureData.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/TgeneMessageStructureData.java new file mode 100644 index 0000000..0435aa4 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/TgeneMessageStructureData.java @@ -0,0 +1,474 @@ +package com.fp.persistence.pgeneral.msg; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENEMESSAGESTRUCTUREDATA + */ +@Entity(name = "TgeneMessageStructureData") +@Table(name = "TGENEMESSAGESTRUCTUREDATA") +public class TgeneMessageStructureData extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, + Cloneable, Log { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneMessageStructureData + */ + @EmbeddedId + private TgeneMessageStructureDataKey pk; + @Column(name = "DESCRIPTION", nullable = true) + /** + * Nombre de la columna dentro del archivo + */ + private String description; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "DATATYPE", nullable = false) + /** + * Tipo de dato del campo, sirve para verificar si es un numero no se ingrese caracteres. + */ + private String datatype; + + @Column(name = "LENGTH", nullable = true) + /** + * Longitud de lectura del campo. + */ + private Integer length; + + @Column(name = "REQUIRED", nullable = true) + /** + * Y si el campo es requerido + */ + private String required; + + @Column(name = "INITPOSITION", nullable = true) + /** + * Si el campo no maneja separadores, aqui se define la posicion inicial del registro. + */ + private Integer initposition; + + @Column(name = "ENDPOSITION", nullable = true) + /** + * Si el campo no maneja separadores, aqui se define la posicion final del registro. + */ + private Integer endposition; + + @Column(name = "DECIMALNUMBER", nullable = true) + /** + * Numero de decimales + */ + private Integer decimalnumber; + + @Column(name = "INITVALUE", nullable = true) + /** + * Valor por defecto o inicial del campo. + */ + private String initvalue; + + @Column(name = "FILLERCHARACTER", nullable = true) + /** + * Caracter de relleno del campo + */ + private String fillercharacter; + + @Column(name = "LEFTREFILLER", nullable = true) + /** + * Y indica que el campo se rellena a la izquiera con el caracter de relleno hasta completar la longitud del campo. + */ + private String leftrefiller; + + @Column(name = "ATTRIBUTE", nullable = true) + /** + * Nombre del campo asociado a un bean. + */ + private String attribute; + + /** Contructor por defecto */ + public TgeneMessageStructureData() { + } + + /** + * Contructor de TgeneMessageStructureData + * + * @param pPk Clave Primaria del entity + * @param pDatatype Tipo de dato del campo, sirve para verificar si es un + * numero no se ingrese caracteres. + */ + public TgeneMessageStructureData(TgeneMessageStructureDataKey pPk, String pDatatype) { + this(); + pk = pPk; + datatype = pDatatype; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneMessageStructureData + */ + public static TgeneMessageStructureData find(EntityManager pEntityManager, TgeneMessageStructureDataKey pKey) + throws Exception { + TgeneMessageStructureData obj = pEntityManager.find(TgeneMessageStructureData.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneMessageStructureData + * + * @return El objeto que referencia a la Clave primaria de + * TgeneMessageStructureData + */ + public TgeneMessageStructureDataKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneMessageStructureData + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TgeneMessageStructureData + */ + public void setPk(TgeneMessageStructureDataKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de datatype + * + * @return valor de datatype + */ + public String getDatatype() { + return datatype; + } + + /** + * Fija el valor de datatype + * + * @param pDatatype nuevo Valor de datatype + */ + public void setDatatype(String pDatatype) { + datatype = pDatatype; + } + + /** + * Obtiene el valor de length + * + * @return valor de length + */ + public Integer getLength() { + return length; + } + + /** + * Fija el valor de length + * + * @param pLength nuevo Valor de length + */ + public void setLength(Integer pLength) { + length = pLength; + } + + /** + * Obtiene el valor de required + * + * @return valor de required + */ + public String getRequired() { + return required; + } + + /** + * Fija el valor de required + * + * @param pRequired nuevo Valor de required + */ + public void setRequired(String pRequired) { + required = pRequired; + } + + /** + * Obtiene el valor de initposition + * + * @return valor de initposition + */ + public Integer getInitposition() { + return initposition; + } + + /** + * Fija el valor de initposition + * + * @param pInitposition nuevo Valor de initposition + */ + public void setInitposition(Integer pInitposition) { + initposition = pInitposition; + } + + /** + * Obtiene el valor de endposition + * + * @return valor de endposition + */ + public Integer getEndposition() { + return endposition; + } + + /** + * Fija el valor de endposition + * + * @param pEndposition nuevo Valor de endposition + */ + public void setEndposition(Integer pEndposition) { + endposition = pEndposition; + } + + /** + * Obtiene el valor de decimalnumber + * + * @return valor de decimalnumber + */ + public Integer getDecimalnumber() { + return decimalnumber; + } + + /** + * Fija el valor de decimalnumber + * + * @param pDecimalnumber nuevo Valor de decimalnumber + */ + public void setDecimalnumber(Integer pDecimalnumber) { + decimalnumber = pDecimalnumber; + } + + /** + * Obtiene el valor de initvalue + * + * @return valor de initvalue + */ + public String getInitvalue() { + return initvalue; + } + + /** + * Fija el valor de initvalue + * + * @param pInitvalue nuevo Valor de initvalue + */ + public void setInitvalue(String pInitvalue) { + initvalue = pInitvalue; + } + + /** + * Obtiene el valor de fillercharacter + * + * @return valor de fillercharacter + */ + public String getFillercharacter() { + return fillercharacter; + } + + /** + * Fija el valor de fillercharacter + * + * @param pFillercharacter nuevo Valor de fillercharacter + */ + public void setFillercharacter(String pFillercharacter) { + fillercharacter = pFillercharacter; + } + + /** + * Obtiene el valor de leftrefiller + * + * @return valor de leftrefiller + */ + public String getLeftrefiller() { + return leftrefiller; + } + + /** + * Fija el valor de leftrefiller + * + * @param pLeftrefiller nuevo Valor de leftrefiller + */ + public void setLeftrefiller(String pLeftrefiller) { + leftrefiller = pLeftrefiller; + } + + /** + * Obtiene el valor de attribute + * + * @return valor de attribute + */ + public String getAttribute() { + return attribute; + } + + /** + * Fija el valor de attribute + * + * @param pAttribute nuevo Valor de attribute + */ + public void setAttribute(String pAttribute) { + attribute = pAttribute; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneMessageStructureData)) + return false; + TgeneMessageStructureData that = (TgeneMessageStructureData) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad + * TgeneMessageStructureData + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco + * TgeneMessageStructureData + */ + public Object createInstance() { + TgeneMessageStructureData instance = new TgeneMessageStructureData(); + instance.setPk(new TgeneMessageStructureDataKey()); + return instance; + } + + /** + * Clona la entidad TgeneMessageStructureData + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneMessageStructureData p = (TgeneMessageStructureData) this.clone(); + p.setPk((TgeneMessageStructureDataKey) this.pk.cloneMe()); + return p; + } + + //METODOS MANUALES + private static final String HQL_WITH_FILTER = + "from TgeneMessageStructureData tb " + + " where tb.pk.structurecode = :structurecode " + + " order by tb.pk.code "; + + /** + * Metodo que devuelve una lista de objetos TgeneMessageStructureData + * @param pEntityManager + * @param structurecode Codigo de estructura + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String structurecode) throws Exception { + List lStructure = null; + Query qry = pEntityManager.createQuery(HQL_WITH_FILTER); + qry.setParameter("structurecode", structurecode); + lStructure = qry.getResultList(); + return lStructure; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/TgeneMessageStructureDataKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/TgeneMessageStructureDataKey.java new file mode 100644 index 0000000..3262cf8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/TgeneMessageStructureDataKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.msg; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEMESSAGESTRUCTUREDATA*/ +@Embeddable +public class TgeneMessageStructureDataKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="STRUCTURECODE", nullable=false,updatable=false) + +/** +* Codigo de estructura de mensaje +*/ +private String structurecode; + +@Column(name="CODE", nullable=false,updatable=false) + +/** +* Codigo de estructura de mensaje +*/ +private Integer code; + +/**Contructor por defecto*/ +public TgeneMessageStructureDataKey(){} +/**Contructor de TgeneMessageStructureDataKey +@param pStructurecode Codigo de estructura de mensaje +@param pCode Codigo de estructura de mensaje +*/ +public TgeneMessageStructureDataKey(String pStructurecode,Integer pCode){ + structurecode=pStructurecode; + code=pCode; +} +/**Obtiene el valor de structurecode +@return valor de structurecode*/ +public String getStructurecode(){ + return structurecode; +} +/**Fija el valor de structurecode +@param pStructurecode nuevo Valor de structurecode*/ +public void setStructurecode(String pStructurecode){ + structurecode=pStructurecode; +} + +/**Obtiene el valor de code +@return valor de code*/ +public Integer getCode(){ + return code; +} +/**Fija el valor de code +@param pCode nuevo Valor de code*/ +public void setCode(Integer pCode){ + code=pCode; +} + +/**Implementacin de la comparacin de TgeneMessageStructureDataKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneMessageStructureDataKey))return false; + TgeneMessageStructureDataKey that = (TgeneMessageStructureDataKey) o; + if (this.getStructurecode() == null || that.getStructurecode() == null){ + return false; + } + if (! this.getStructurecode().equals(that.getStructurecode())){ + return false; + } + if (this.getCode() == null || that.getCode() == null){ + return false; + } + if (! this.getCode().equals(that.getCode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneMessageStructureDataKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getStructurecode() == null ? 0 : this.getStructurecode().hashCode()); + result = result * 37 + (this.getCode() == null ? 0 : this.getCode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/TgeneMessageStructureHeader.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/TgeneMessageStructureHeader.java new file mode 100644 index 0000000..d33a099 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/TgeneMessageStructureHeader.java @@ -0,0 +1,474 @@ +package com.fp.persistence.pgeneral.msg; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENEMESSAGESTRUCTUREHEADER + */ +@Entity(name = "TgeneMessageStructureHeader") +@Table(name = "TGENEMESSAGESTRUCTUREHEADER") +public class TgeneMessageStructureHeader extends com.fp.dto.AbstractDataTransport implements Serializable, + HibernateBean, Cloneable, Log { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneMessageStructureHeader + */ + @EmbeddedId + private TgeneMessageStructureHeaderKey pk; + @Column(name = "DESCRIPTION", nullable = true) + /** + * Nombre de la columna dentro del archivo + */ + private String description; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "DATATYPE", nullable = false) + /** + * Tipo de dato del campo, sirve para verificar si es un numero no se ingrese caracteres. + */ + private String datatype; + + @Column(name = "LENGTH", nullable = true) + /** + * Longitud de lectura del campo. + */ + private Integer length; + + @Column(name = "REQUIRED", nullable = true) + /** + * Y si el campo es requerido + */ + private String required; + + @Column(name = "INITPOSITION", nullable = true) + /** + * Si el campo no maneja separadores, aqui se define la posicion inicial del registro. + */ + private Integer initposition; + + @Column(name = "ENDPOSITION", nullable = true) + /** + * Si el campo no maneja separadores, aqui se define la posicion final del registro. + */ + private Integer endposition; + + @Column(name = "DECIMALNUMBER", nullable = true) + /** + * Numero de decimales + */ + private Integer decimalnumber; + + @Column(name = "INITVALUE", nullable = true) + /** + * Valor por defecto o inicial del campo. + */ + private String initvalue; + + @Column(name = "FILLERCHARACTER", nullable = true) + /** + * Caracter de relleno del campo + */ + private String fillercharacter; + + @Column(name = "LEFTREFILLER", nullable = true) + /** + * Y indica que el campo se rellena a la izquiera con el caracter de relleno hasta completar la longitud del campo. + */ + private String leftrefiller; + + @Column(name = "ATTRIBUTE", nullable = true) + /** + * Nombre del campo asociado a un bean. + */ + private String attribute; + + /** Contructor por defecto */ + public TgeneMessageStructureHeader() { + } + + /** + * Contructor de TgeneMessageStructureHeader + * + * @param pPk Clave Primaria del entity + * @param pDatatype Tipo de dato del campo, sirve para verificar si es un + * numero no se ingrese caracteres. + */ + public TgeneMessageStructureHeader(TgeneMessageStructureHeaderKey pPk, String pDatatype) { + this(); + pk = pPk; + datatype = pDatatype; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneMessageStructureHeader + */ + public static TgeneMessageStructureHeader find(EntityManager pEntityManager, TgeneMessageStructureHeaderKey pKey) + throws Exception { + TgeneMessageStructureHeader obj = pEntityManager.find(TgeneMessageStructureHeader.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneMessageStructureHeader + * + * @return El objeto que referencia a la Clave primaria de + * TgeneMessageStructureHeader + */ + public TgeneMessageStructureHeaderKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneMessageStructureHeader + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TgeneMessageStructureHeader + */ + public void setPk(TgeneMessageStructureHeaderKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de datatype + * + * @return valor de datatype + */ + public String getDatatype() { + return datatype; + } + + /** + * Fija el valor de datatype + * + * @param pDatatype nuevo Valor de datatype + */ + public void setDatatype(String pDatatype) { + datatype = pDatatype; + } + + /** + * Obtiene el valor de length + * + * @return valor de length + */ + public Integer getLength() { + return length; + } + + /** + * Fija el valor de length + * + * @param pLength nuevo Valor de length + */ + public void setLength(Integer pLength) { + length = pLength; + } + + /** + * Obtiene el valor de required + * + * @return valor de required + */ + public String getRequired() { + return required; + } + + /** + * Fija el valor de required + * + * @param pRequired nuevo Valor de required + */ + public void setRequired(String pRequired) { + required = pRequired; + } + + /** + * Obtiene el valor de initposition + * + * @return valor de initposition + */ + public Integer getInitposition() { + return initposition; + } + + /** + * Fija el valor de initposition + * + * @param pInitposition nuevo Valor de initposition + */ + public void setInitposition(Integer pInitposition) { + initposition = pInitposition; + } + + /** + * Obtiene el valor de endposition + * + * @return valor de endposition + */ + public Integer getEndposition() { + return endposition; + } + + /** + * Fija el valor de endposition + * + * @param pEndposition nuevo Valor de endposition + */ + public void setEndposition(Integer pEndposition) { + endposition = pEndposition; + } + + /** + * Obtiene el valor de decimalnumber + * + * @return valor de decimalnumber + */ + public Integer getDecimalnumber() { + return decimalnumber; + } + + /** + * Fija el valor de decimalnumber + * + * @param pDecimalnumber nuevo Valor de decimalnumber + */ + public void setDecimalnumber(Integer pDecimalnumber) { + decimalnumber = pDecimalnumber; + } + + /** + * Obtiene el valor de initvalue + * + * @return valor de initvalue + */ + public String getInitvalue() { + return initvalue; + } + + /** + * Fija el valor de initvalue + * + * @param pInitvalue nuevo Valor de initvalue + */ + public void setInitvalue(String pInitvalue) { + initvalue = pInitvalue; + } + + /** + * Obtiene el valor de fillercharacter + * + * @return valor de fillercharacter + */ + public String getFillercharacter() { + return fillercharacter; + } + + /** + * Fija el valor de fillercharacter + * + * @param pFillercharacter nuevo Valor de fillercharacter + */ + public void setFillercharacter(String pFillercharacter) { + fillercharacter = pFillercharacter; + } + + /** + * Obtiene el valor de leftrefiller + * + * @return valor de leftrefiller + */ + public String getLeftrefiller() { + return leftrefiller; + } + + /** + * Fija el valor de leftrefiller + * + * @param pLeftrefiller nuevo Valor de leftrefiller + */ + public void setLeftrefiller(String pLeftrefiller) { + leftrefiller = pLeftrefiller; + } + + /** + * Obtiene el valor de attribute + * + * @return valor de attribute + */ + public String getAttribute() { + return attribute; + } + + /** + * Fija el valor de attribute + * + * @param pAttribute nuevo Valor de attribute + */ + public void setAttribute(String pAttribute) { + attribute = pAttribute; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneMessageStructureHeader)) + return false; + TgeneMessageStructureHeader that = (TgeneMessageStructureHeader) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad + * TgeneMessageStructureHeader + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacin de la creacin de un bean en blanco + * TgeneMessageStructureHeader + */ + public Object createInstance() { + TgeneMessageStructureHeader instance = new TgeneMessageStructureHeader(); + instance.setPk(new TgeneMessageStructureHeaderKey()); + return instance; + } + + /** + * Clona la entidad TgeneMessageStructureHeader + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneMessageStructureHeader p = (TgeneMessageStructureHeader) this.clone(); + p.setPk((TgeneMessageStructureHeaderKey) this.pk.cloneMe()); + return p; + } + + //METODOS MANUALES + private static final String HQL_WITH_FILTER = + "from TgeneMessageStructureHeader tb " + + " where tb.pk.structurecode = :structurecode " + + " order by tb.pk.code "; + + /** + * Metodo que devuelve una lista de objetos TgeneMessageStructureHeader + * @param pEntityManager + * @param structurecode Codigo de estructura + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String structurecode) throws Exception { + List lStructure = null; + Query qry = pEntityManager.createQuery(HQL_WITH_FILTER); + qry.setParameter("structurecode", structurecode); + lStructure = qry.getResultList(); + return lStructure; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/TgeneMessageStructureHeaderKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/TgeneMessageStructureHeaderKey.java new file mode 100644 index 0000000..2b8d5c4 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/msg/TgeneMessageStructureHeaderKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.msg; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEMESSAGESTRUCTUREHEADER*/ +@Embeddable +public class TgeneMessageStructureHeaderKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="STRUCTURECODE", nullable=false,updatable=false) + +/** +* Codigo de estructura de mensaje +*/ +private String structurecode; + +@Column(name="CODE", nullable=false,updatable=false) + +/** +* Codigo de estructura de mensaje +*/ +private Integer code; + +/**Contructor por defecto*/ +public TgeneMessageStructureHeaderKey(){} +/**Contructor de TgeneMessageStructureHeaderKey +@param pStructurecode Codigo de estructura de mensaje +@param pCode Codigo de estructura de mensaje +*/ +public TgeneMessageStructureHeaderKey(String pStructurecode,Integer pCode){ + structurecode=pStructurecode; + code=pCode; +} +/**Obtiene el valor de structurecode +@return valor de structurecode*/ +public String getStructurecode(){ + return structurecode; +} +/**Fija el valor de structurecode +@param pStructurecode nuevo Valor de structurecode*/ +public void setStructurecode(String pStructurecode){ + structurecode=pStructurecode; +} + +/**Obtiene el valor de code +@return valor de code*/ +public Integer getCode(){ + return code; +} +/**Fija el valor de code +@param pCode nuevo Valor de code*/ +public void setCode(Integer pCode){ + code=pCode; +} + +/**Implementacin de la comparacin de TgeneMessageStructureHeaderKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneMessageStructureHeaderKey))return false; + TgeneMessageStructureHeaderKey that = (TgeneMessageStructureHeaderKey) o; + if (this.getStructurecode() == null || that.getStructurecode() == null){ + return false; + } + if (! this.getStructurecode().equals(that.getStructurecode())){ + return false; + } + if (this.getCode() == null || that.getCode() == null){ + return false; + } + if (! this.getCode().equals(that.getCode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneMessageStructureHeaderKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getStructurecode() == null ? 0 : this.getStructurecode().hashCode()); + result = result * 37 + (this.getCode() == null ? 0 : this.getCode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/.svn/entries new file mode 100644 index 0000000..00cca54 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/.svn/entries @@ -0,0 +1,164 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page +svn://172.17.26.185/COMACO + + + +2015-02-20T11:05:06.934139Z +3833 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneTransactionPagesKey.java +file + + + + +2022-07-28T03:40:30.138749Z +25d1a0b95a09fa307790db22f380b0b0 +2015-02-20T11:05:06.934139Z +3833 +cpiedra + + + + + + + + + + + + + + + + + + + + + +5675 + +TgeneSubproductPagesKey.java +file + + + + +2022-07-28T03:40:30.138749Z +d49d01aa80bb9163f6d959cf9867ae9e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7830 + +TgeneTransactionPages.java +file + + + + +2022-07-28T03:40:30.138749Z +50299884d5bad2ef24b9257cab580fee +2015-02-20T11:05:06.934139Z +3833 +cpiedra + + + + + + + + + + + + + + + + + + + + + +8414 + +TgeneSubproductPages.java +file + + + + +2022-07-28T03:40:30.139749Z +47465a8ac00f862117d2261920eca908 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7015 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/.svn/text-base/TgeneSubproductPages.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/.svn/text-base/TgeneSubproductPages.java.svn-base new file mode 100644 index 0000000..8b1db09 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/.svn/text-base/TgeneSubproductPages.java.svn-base @@ -0,0 +1,267 @@ +package com.fp.persistence.pgeneral.page; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESUBPRODUCTPAGES*/ +@Entity(name="TgeneSubproductPages") +@Table(name="TGENESUBPRODUCTPAGES") +public class TgeneSubproductPages extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSubproductPages +*/ +@EmbeddedId +private TgeneSubproductPagesKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="PRESENTATIONORDER", nullable=true) + +/** +* Orden de preentacion de la pagina en la pantalla +*/ +private Integer presentationorder; + +@Column(name="PAGE", nullable=true) + +/** +* Nombre de la pagina asociada al tab +*/ +private String page; + +@Column(name="TITLE", nullable=true) + +/** +* Titulo del tab +*/ +private String title; + +@Column(name="QUERYFUNCTION", nullable=true) + +/** +* Nombre de la funcion de la pagina que ejecuta la consulta +*/ +private String queryfunction; + +@Column(name="SAVEFUNCTION", nullable=true) + +/** +* Nombre de la funcion que se encarga de hacer el commit de la pagina +*/ +private String savefunction; + +@Column(name="ACTIVE", nullable=true) + +/** +* Y Indica que la pagina esta activa +*/ +private String active; + +@Column(name="AUTODOWNLOAD", nullable=true) + +/** +* Y Indica que la definicon de la pagina tiene un autodownload y no espera a que se presione un click en el tab para descargar la pagina +*/ +private String autodownload; + +/**Contructor por defecto*/ +public TgeneSubproductPages(){ +} +/**Contructor de TgeneSubproductPages +@param pPk Clave Primaria del entity +*/ +public TgeneSubproductPages(TgeneSubproductPagesKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSubproductPages +*/ +public static TgeneSubproductPages find(EntityManager pEntityManager,TgeneSubproductPagesKey pKey) throws Exception{ + TgeneSubproductPages obj = pEntityManager.find(TgeneSubproductPages.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSubproductPages +@return El objeto que referencia a la Clave primaria de TgeneSubproductPages +*/ +public TgeneSubproductPagesKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSubproductPages +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSubproductPages +*/ +public void setPk(TgeneSubproductPagesKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de presentationorder +@return valor de presentationorder*/ +public Integer getPresentationorder(){ + return presentationorder; +} +/**Fija el valor de presentationorder +@param pPresentationorder nuevo Valor de presentationorder*/ +public void setPresentationorder(Integer pPresentationorder){ + presentationorder=pPresentationorder; +} + +/**Obtiene el valor de page +@return valor de page*/ +public String getPage(){ + return page; +} +/**Fija el valor de page +@param pPage nuevo Valor de page*/ +public void setPage(String pPage){ + page=pPage; +} + +/**Obtiene el valor de title +@return valor de title*/ +public String getTitle(){ + return title; +} +/**Fija el valor de title +@param pTitle nuevo Valor de title*/ +public void setTitle(String pTitle){ + title=pTitle; +} + +/**Obtiene el valor de queryfunction +@return valor de queryfunction*/ +public String getQueryfunction(){ + return queryfunction; +} +/**Fija el valor de queryfunction +@param pQueryfunction nuevo Valor de queryfunction*/ +public void setQueryfunction(String pQueryfunction){ + queryfunction=pQueryfunction; +} + +/**Obtiene el valor de savefunction +@return valor de savefunction*/ +public String getSavefunction(){ + return savefunction; +} +/**Fija el valor de savefunction +@param pSavefunction nuevo Valor de savefunction*/ +public void setSavefunction(String pSavefunction){ + savefunction=pSavefunction; +} + +/**Obtiene el valor de active +@return valor de active*/ +public String getActive(){ + return active; +} +/**Fija el valor de active +@param pActive nuevo Valor de active*/ +public void setActive(String pActive){ + active=pActive; +} + +/**Obtiene el valor de autodownload +@return valor de autodownload*/ +public String getAutodownload(){ + return autodownload; +} +/**Fija el valor de autodownload +@param pAutodownload nuevo Valor de autodownload*/ +public void setAutodownload(String pAutodownload){ + autodownload=pAutodownload; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSubproductPages))return false; + TgeneSubproductPages that = (TgeneSubproductPages) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSubproductPages +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSubproductPages +*/ +public Object createInstance(){ + TgeneSubproductPages instance=new TgeneSubproductPages(); + instance.setPk(new TgeneSubproductPagesKey()); + return instance; +} +/**Clona la entidad TgeneSubproductPages +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSubproductPages p=(TgeneSubproductPages)this.clone(); + p.setPk((TgeneSubproductPagesKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/.svn/text-base/TgeneSubproductPagesKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/.svn/text-base/TgeneSubproductPagesKey.java.svn-base new file mode 100644 index 0000000..08adb04 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/.svn/text-base/TgeneSubproductPagesKey.java.svn-base @@ -0,0 +1,259 @@ +package com.fp.persistence.pgeneral.page; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESUBPRODUCTPAGES*/ +@Embeddable +public class TgeneSubproductPagesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="SEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del registro ulizada cuando la transaccion tiene mas de una pagina +*/ +private Integer sequence; + +/**Contructor por defecto*/ +public TgeneSubproductPagesKey(){} +/**Contructor de TgeneSubproductPagesKey +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pSequence Secuencia del registro ulizada cuando la transaccion tiene mas de una pagina +*/ +public TgeneSubproductPagesKey(String pModulecode,String pProductcode,String pSubproductcode,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,Integer pSequence){ + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + sequence=pSequence; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de sequence +@return valor de sequence*/ +public Integer getSequence(){ + return sequence; +} +/**Fija el valor de sequence +@param pSequence nuevo Valor de sequence*/ +public void setSequence(Integer pSequence){ + sequence=pSequence; +} + +/**Implementacin de la comparacin de TgeneSubproductPagesKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSubproductPagesKey))return false; + TgeneSubproductPagesKey that = (TgeneSubproductPagesKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getSequence() == null || that.getSequence() == null){ + return false; + } + if (! this.getSequence().equals(that.getSequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSubproductPagesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getSequence() == null ? 0 : this.getSequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/.svn/text-base/TgeneTransactionPages.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/.svn/text-base/TgeneTransactionPages.java.svn-base new file mode 100644 index 0000000..9c31796 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/.svn/text-base/TgeneTransactionPages.java.svn-base @@ -0,0 +1,321 @@ +package com.fp.persistence.pgeneral.page; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONPAGES*/ +@Entity(name="TgeneTransactionPages") +@Table(name="TGENETRANSACTIONPAGES") +public class TgeneTransactionPages extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransactionPages +*/ +@EmbeddedId +private TgeneTransactionPagesKey pk; +@Column(name="CONTROLLER", nullable=true) + +/** +* null +*/ +private String controller; + +@Column(name="ACTIVE", nullable=true) + +/** +* Y Indica que la pagina esta activa +*/ +private String active; + +@Column(name="AUTODOWNLOAD", nullable=true) + +/** +* Y Indica que la definicon de la pagina tiene un autodownload y no espera a que se presione un click en el tab para descargar la pagina +*/ +private String autodownload; + +@Column(name="PAGEJSF", nullable=true) + +/** +* null +*/ +private String pagejsf; + +@Column(name="PRESENTATIONORDER", nullable=true) + +/** +* Orden de preentacion de la pagina en la pantalla +*/ +private Integer presentationorder; + +@Column(name="PAGE", nullable=true) + +/** +* Nombre de la pagina asociada al tab +*/ +private String page; + +@Column(name="TITLE", nullable=true) + +/** +* Titulo del tab +*/ +private String title; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* null +*/ +private String description; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="QUERYFUNCTION", nullable=true) + +/** +* Nombre de la funcion de la pagina que ejecuta la consulta +*/ +private String queryfunction; + +@Column(name="SAVEFUNCTION", nullable=true) + +/** +* Nombre de la funcion que se encarga de hacer el commit de la pagina +*/ +private String savefunction; + +/**Contructor por defecto*/ +public TgeneTransactionPages(){ +} +/**Contructor de TgeneTransactionPages +@param pPk Clave Primaria del entity +*/ +public TgeneTransactionPages(TgeneTransactionPagesKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionPages +*/ +public static TgeneTransactionPages find(EntityManager pEntityManager,TgeneTransactionPagesKey pKey) throws Exception{ + TgeneTransactionPages obj = pEntityManager.find(TgeneTransactionPages.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionPages +@return El objeto que referencia a la Clave primaria de TgeneTransactionPages +*/ +public TgeneTransactionPagesKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionPages +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionPages +*/ +public void setPk(TgeneTransactionPagesKey pPk){ + pk=pPk; +} +/**Obtiene el valor de controller +@return valor de controller*/ +public String getController(){ + return controller; +} +/**Fija el valor de controller +@param pController nuevo Valor de controller*/ +public void setController(String pController){ + controller=pController; +} + +/**Obtiene el valor de active +@return valor de active*/ +public String getActive(){ + return active; +} +/**Fija el valor de active +@param pActive nuevo Valor de active*/ +public void setActive(String pActive){ + active=pActive; +} + +/**Obtiene el valor de autodownload +@return valor de autodownload*/ +public String getAutodownload(){ + return autodownload; +} +/**Fija el valor de autodownload +@param pAutodownload nuevo Valor de autodownload*/ +public void setAutodownload(String pAutodownload){ + autodownload=pAutodownload; +} + +/**Obtiene el valor de pagejsf +@return valor de pagejsf*/ +public String getPagejsf(){ + return pagejsf; +} +/**Fija el valor de pagejsf +@param pPagejsf nuevo Valor de pagejsf*/ +public void setPagejsf(String pPagejsf){ + pagejsf=pPagejsf; +} + +/**Obtiene el valor de presentationorder +@return valor de presentationorder*/ +public Integer getPresentationorder(){ + return presentationorder; +} +/**Fija el valor de presentationorder +@param pPresentationorder nuevo Valor de presentationorder*/ +public void setPresentationorder(Integer pPresentationorder){ + presentationorder=pPresentationorder; +} + +/**Obtiene el valor de page +@return valor de page*/ +public String getPage(){ + return page; +} +/**Fija el valor de page +@param pPage nuevo Valor de page*/ +public void setPage(String pPage){ + page=pPage; +} + +/**Obtiene el valor de title +@return valor de title*/ +public String getTitle(){ + return title; +} +/**Fija el valor de title +@param pTitle nuevo Valor de title*/ +public void setTitle(String pTitle){ + title=pTitle; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de queryfunction +@return valor de queryfunction*/ +public String getQueryfunction(){ + return queryfunction; +} +/**Fija el valor de queryfunction +@param pQueryfunction nuevo Valor de queryfunction*/ +public void setQueryfunction(String pQueryfunction){ + queryfunction=pQueryfunction; +} + +/**Obtiene el valor de savefunction +@return valor de savefunction*/ +public String getSavefunction(){ + return savefunction; +} +/**Fija el valor de savefunction +@param pSavefunction nuevo Valor de savefunction*/ +public void setSavefunction(String pSavefunction){ + savefunction=pSavefunction; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionPages))return false; + TgeneTransactionPages that = (TgeneTransactionPages) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneTransactionPages +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneTransactionPages +*/ +public Object createInstance(){ + TgeneTransactionPages instance=new TgeneTransactionPages(); + instance.setPk(new TgeneTransactionPagesKey()); + return instance; +} +/**Clona la entidad TgeneTransactionPages +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionPages p=(TgeneTransactionPages)this.clone(); + p.setPk((TgeneTransactionPagesKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/.svn/text-base/TgeneTransactionPagesKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/.svn/text-base/TgeneTransactionPagesKey.java.svn-base new file mode 100644 index 0000000..f62f55f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/.svn/text-base/TgeneTransactionPagesKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.page; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONPAGES*/ +@Embeddable +public class TgeneTransactionPagesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="SEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del registro ulizada cuando la transaccion tiene mas de una pagina +*/ +private Integer sequence; + +/**Contructor por defecto*/ +public TgeneTransactionPagesKey(){} +/**Contructor de TgeneTransactionPagesKey +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactionversion Version de transaccion +@param pSequence Secuencia del registro ulizada cuando la transaccion tiene mas de una pagina +*/ +public TgeneTransactionPagesKey(Integer pTransactioncode,String pTransactionmodule,Integer pTransactionversion,Integer pSequence){ + transactioncode=pTransactioncode; + transactionmodule=pTransactionmodule; + transactionversion=pTransactionversion; + sequence=pSequence; +} +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de sequence +@return valor de sequence*/ +public Integer getSequence(){ + return sequence; +} +/**Fija el valor de sequence +@param pSequence nuevo Valor de sequence*/ +public void setSequence(Integer pSequence){ + sequence=pSequence; +} + +/**Implementacion de la comparacion de TgeneTransactionPagesKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionPagesKey))return false; + TgeneTransactionPagesKey that = (TgeneTransactionPagesKey) o; + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getSequence() == null || that.getSequence() == null){ + return false; + } + if (! this.getSequence().equals(that.getSequence())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneTransactionPagesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getSequence() == null ? 0 : this.getSequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/TgeneSubproductPages.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/TgeneSubproductPages.java new file mode 100644 index 0000000..8b1db09 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/TgeneSubproductPages.java @@ -0,0 +1,267 @@ +package com.fp.persistence.pgeneral.page; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESUBPRODUCTPAGES*/ +@Entity(name="TgeneSubproductPages") +@Table(name="TGENESUBPRODUCTPAGES") +public class TgeneSubproductPages extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSubproductPages +*/ +@EmbeddedId +private TgeneSubproductPagesKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="PRESENTATIONORDER", nullable=true) + +/** +* Orden de preentacion de la pagina en la pantalla +*/ +private Integer presentationorder; + +@Column(name="PAGE", nullable=true) + +/** +* Nombre de la pagina asociada al tab +*/ +private String page; + +@Column(name="TITLE", nullable=true) + +/** +* Titulo del tab +*/ +private String title; + +@Column(name="QUERYFUNCTION", nullable=true) + +/** +* Nombre de la funcion de la pagina que ejecuta la consulta +*/ +private String queryfunction; + +@Column(name="SAVEFUNCTION", nullable=true) + +/** +* Nombre de la funcion que se encarga de hacer el commit de la pagina +*/ +private String savefunction; + +@Column(name="ACTIVE", nullable=true) + +/** +* Y Indica que la pagina esta activa +*/ +private String active; + +@Column(name="AUTODOWNLOAD", nullable=true) + +/** +* Y Indica que la definicon de la pagina tiene un autodownload y no espera a que se presione un click en el tab para descargar la pagina +*/ +private String autodownload; + +/**Contructor por defecto*/ +public TgeneSubproductPages(){ +} +/**Contructor de TgeneSubproductPages +@param pPk Clave Primaria del entity +*/ +public TgeneSubproductPages(TgeneSubproductPagesKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSubproductPages +*/ +public static TgeneSubproductPages find(EntityManager pEntityManager,TgeneSubproductPagesKey pKey) throws Exception{ + TgeneSubproductPages obj = pEntityManager.find(TgeneSubproductPages.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSubproductPages +@return El objeto que referencia a la Clave primaria de TgeneSubproductPages +*/ +public TgeneSubproductPagesKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSubproductPages +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSubproductPages +*/ +public void setPk(TgeneSubproductPagesKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de presentationorder +@return valor de presentationorder*/ +public Integer getPresentationorder(){ + return presentationorder; +} +/**Fija el valor de presentationorder +@param pPresentationorder nuevo Valor de presentationorder*/ +public void setPresentationorder(Integer pPresentationorder){ + presentationorder=pPresentationorder; +} + +/**Obtiene el valor de page +@return valor de page*/ +public String getPage(){ + return page; +} +/**Fija el valor de page +@param pPage nuevo Valor de page*/ +public void setPage(String pPage){ + page=pPage; +} + +/**Obtiene el valor de title +@return valor de title*/ +public String getTitle(){ + return title; +} +/**Fija el valor de title +@param pTitle nuevo Valor de title*/ +public void setTitle(String pTitle){ + title=pTitle; +} + +/**Obtiene el valor de queryfunction +@return valor de queryfunction*/ +public String getQueryfunction(){ + return queryfunction; +} +/**Fija el valor de queryfunction +@param pQueryfunction nuevo Valor de queryfunction*/ +public void setQueryfunction(String pQueryfunction){ + queryfunction=pQueryfunction; +} + +/**Obtiene el valor de savefunction +@return valor de savefunction*/ +public String getSavefunction(){ + return savefunction; +} +/**Fija el valor de savefunction +@param pSavefunction nuevo Valor de savefunction*/ +public void setSavefunction(String pSavefunction){ + savefunction=pSavefunction; +} + +/**Obtiene el valor de active +@return valor de active*/ +public String getActive(){ + return active; +} +/**Fija el valor de active +@param pActive nuevo Valor de active*/ +public void setActive(String pActive){ + active=pActive; +} + +/**Obtiene el valor de autodownload +@return valor de autodownload*/ +public String getAutodownload(){ + return autodownload; +} +/**Fija el valor de autodownload +@param pAutodownload nuevo Valor de autodownload*/ +public void setAutodownload(String pAutodownload){ + autodownload=pAutodownload; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSubproductPages))return false; + TgeneSubproductPages that = (TgeneSubproductPages) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSubproductPages +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSubproductPages +*/ +public Object createInstance(){ + TgeneSubproductPages instance=new TgeneSubproductPages(); + instance.setPk(new TgeneSubproductPagesKey()); + return instance; +} +/**Clona la entidad TgeneSubproductPages +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSubproductPages p=(TgeneSubproductPages)this.clone(); + p.setPk((TgeneSubproductPagesKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/TgeneSubproductPagesKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/TgeneSubproductPagesKey.java new file mode 100644 index 0000000..08adb04 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/TgeneSubproductPagesKey.java @@ -0,0 +1,259 @@ +package com.fp.persistence.pgeneral.page; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESUBPRODUCTPAGES*/ +@Embeddable +public class TgeneSubproductPagesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="SEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del registro ulizada cuando la transaccion tiene mas de una pagina +*/ +private Integer sequence; + +/**Contructor por defecto*/ +public TgeneSubproductPagesKey(){} +/**Contructor de TgeneSubproductPagesKey +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pSequence Secuencia del registro ulizada cuando la transaccion tiene mas de una pagina +*/ +public TgeneSubproductPagesKey(String pModulecode,String pProductcode,String pSubproductcode,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,Integer pSequence){ + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + sequence=pSequence; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de sequence +@return valor de sequence*/ +public Integer getSequence(){ + return sequence; +} +/**Fija el valor de sequence +@param pSequence nuevo Valor de sequence*/ +public void setSequence(Integer pSequence){ + sequence=pSequence; +} + +/**Implementacin de la comparacin de TgeneSubproductPagesKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSubproductPagesKey))return false; + TgeneSubproductPagesKey that = (TgeneSubproductPagesKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getSequence() == null || that.getSequence() == null){ + return false; + } + if (! this.getSequence().equals(that.getSequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSubproductPagesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getSequence() == null ? 0 : this.getSequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/TgeneTransactionPages.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/TgeneTransactionPages.java new file mode 100644 index 0000000..9c31796 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/TgeneTransactionPages.java @@ -0,0 +1,321 @@ +package com.fp.persistence.pgeneral.page; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONPAGES*/ +@Entity(name="TgeneTransactionPages") +@Table(name="TGENETRANSACTIONPAGES") +public class TgeneTransactionPages extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransactionPages +*/ +@EmbeddedId +private TgeneTransactionPagesKey pk; +@Column(name="CONTROLLER", nullable=true) + +/** +* null +*/ +private String controller; + +@Column(name="ACTIVE", nullable=true) + +/** +* Y Indica que la pagina esta activa +*/ +private String active; + +@Column(name="AUTODOWNLOAD", nullable=true) + +/** +* Y Indica que la definicon de la pagina tiene un autodownload y no espera a que se presione un click en el tab para descargar la pagina +*/ +private String autodownload; + +@Column(name="PAGEJSF", nullable=true) + +/** +* null +*/ +private String pagejsf; + +@Column(name="PRESENTATIONORDER", nullable=true) + +/** +* Orden de preentacion de la pagina en la pantalla +*/ +private Integer presentationorder; + +@Column(name="PAGE", nullable=true) + +/** +* Nombre de la pagina asociada al tab +*/ +private String page; + +@Column(name="TITLE", nullable=true) + +/** +* Titulo del tab +*/ +private String title; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* null +*/ +private String description; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="QUERYFUNCTION", nullable=true) + +/** +* Nombre de la funcion de la pagina que ejecuta la consulta +*/ +private String queryfunction; + +@Column(name="SAVEFUNCTION", nullable=true) + +/** +* Nombre de la funcion que se encarga de hacer el commit de la pagina +*/ +private String savefunction; + +/**Contructor por defecto*/ +public TgeneTransactionPages(){ +} +/**Contructor de TgeneTransactionPages +@param pPk Clave Primaria del entity +*/ +public TgeneTransactionPages(TgeneTransactionPagesKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionPages +*/ +public static TgeneTransactionPages find(EntityManager pEntityManager,TgeneTransactionPagesKey pKey) throws Exception{ + TgeneTransactionPages obj = pEntityManager.find(TgeneTransactionPages.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionPages +@return El objeto que referencia a la Clave primaria de TgeneTransactionPages +*/ +public TgeneTransactionPagesKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionPages +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionPages +*/ +public void setPk(TgeneTransactionPagesKey pPk){ + pk=pPk; +} +/**Obtiene el valor de controller +@return valor de controller*/ +public String getController(){ + return controller; +} +/**Fija el valor de controller +@param pController nuevo Valor de controller*/ +public void setController(String pController){ + controller=pController; +} + +/**Obtiene el valor de active +@return valor de active*/ +public String getActive(){ + return active; +} +/**Fija el valor de active +@param pActive nuevo Valor de active*/ +public void setActive(String pActive){ + active=pActive; +} + +/**Obtiene el valor de autodownload +@return valor de autodownload*/ +public String getAutodownload(){ + return autodownload; +} +/**Fija el valor de autodownload +@param pAutodownload nuevo Valor de autodownload*/ +public void setAutodownload(String pAutodownload){ + autodownload=pAutodownload; +} + +/**Obtiene el valor de pagejsf +@return valor de pagejsf*/ +public String getPagejsf(){ + return pagejsf; +} +/**Fija el valor de pagejsf +@param pPagejsf nuevo Valor de pagejsf*/ +public void setPagejsf(String pPagejsf){ + pagejsf=pPagejsf; +} + +/**Obtiene el valor de presentationorder +@return valor de presentationorder*/ +public Integer getPresentationorder(){ + return presentationorder; +} +/**Fija el valor de presentationorder +@param pPresentationorder nuevo Valor de presentationorder*/ +public void setPresentationorder(Integer pPresentationorder){ + presentationorder=pPresentationorder; +} + +/**Obtiene el valor de page +@return valor de page*/ +public String getPage(){ + return page; +} +/**Fija el valor de page +@param pPage nuevo Valor de page*/ +public void setPage(String pPage){ + page=pPage; +} + +/**Obtiene el valor de title +@return valor de title*/ +public String getTitle(){ + return title; +} +/**Fija el valor de title +@param pTitle nuevo Valor de title*/ +public void setTitle(String pTitle){ + title=pTitle; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de queryfunction +@return valor de queryfunction*/ +public String getQueryfunction(){ + return queryfunction; +} +/**Fija el valor de queryfunction +@param pQueryfunction nuevo Valor de queryfunction*/ +public void setQueryfunction(String pQueryfunction){ + queryfunction=pQueryfunction; +} + +/**Obtiene el valor de savefunction +@return valor de savefunction*/ +public String getSavefunction(){ + return savefunction; +} +/**Fija el valor de savefunction +@param pSavefunction nuevo Valor de savefunction*/ +public void setSavefunction(String pSavefunction){ + savefunction=pSavefunction; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionPages))return false; + TgeneTransactionPages that = (TgeneTransactionPages) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneTransactionPages +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneTransactionPages +*/ +public Object createInstance(){ + TgeneTransactionPages instance=new TgeneTransactionPages(); + instance.setPk(new TgeneTransactionPagesKey()); + return instance; +} +/**Clona la entidad TgeneTransactionPages +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionPages p=(TgeneTransactionPages)this.clone(); + p.setPk((TgeneTransactionPagesKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/TgeneTransactionPagesKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/TgeneTransactionPagesKey.java new file mode 100644 index 0000000..f62f55f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/page/TgeneTransactionPagesKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.page; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONPAGES*/ +@Embeddable +public class TgeneTransactionPagesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="SEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del registro ulizada cuando la transaccion tiene mas de una pagina +*/ +private Integer sequence; + +/**Contructor por defecto*/ +public TgeneTransactionPagesKey(){} +/**Contructor de TgeneTransactionPagesKey +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactionversion Version de transaccion +@param pSequence Secuencia del registro ulizada cuando la transaccion tiene mas de una pagina +*/ +public TgeneTransactionPagesKey(Integer pTransactioncode,String pTransactionmodule,Integer pTransactionversion,Integer pSequence){ + transactioncode=pTransactioncode; + transactionmodule=pTransactionmodule; + transactionversion=pTransactionversion; + sequence=pSequence; +} +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de sequence +@return valor de sequence*/ +public Integer getSequence(){ + return sequence; +} +/**Fija el valor de sequence +@param pSequence nuevo Valor de sequence*/ +public void setSequence(Integer pSequence){ + sequence=pSequence; +} + +/**Implementacion de la comparacion de TgeneTransactionPagesKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionPagesKey))return false; + TgeneTransactionPagesKey that = (TgeneTransactionPagesKey) o; + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getSequence() == null || that.getSequence() == null){ + return false; + } + if (! this.getSequence().equals(that.getSequence())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneTransactionPagesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getSequence() == null ? 0 : this.getSequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/proc/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/proc/.svn/entries new file mode 100644 index 0000000..ed1ea18 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/proc/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/proc +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneProcess.java +file + + + + +2022-07-28T03:40:29.826747Z +2e08bd878794dc63fb8037bc4dd51fb8 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4492 + +TgeneProcessKey.java +file + + + + +2022-07-28T03:40:29.826747Z +a21a2c74aac2b5325baf2e5eafcf8f01 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5139 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/proc/.svn/text-base/TgeneProcess.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/proc/.svn/text-base/TgeneProcess.java.svn-base new file mode 100644 index 0000000..3b25356 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/proc/.svn/text-base/TgeneProcess.java.svn-base @@ -0,0 +1,159 @@ +package com.fp.persistence.pgeneral.proc; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEPROCESS*/ +@Entity(name="TgeneProcess") +@Table(name="TGENEPROCESS") +public class TgeneProcess extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneProcess +*/ +@EmbeddedId +private TgeneProcessKey pk; +@Column(name="DESCRIPTION", nullable=false) + +/** +* Descricin generral de las actividades que realiza el comando +*/ +private String description; + +@Column(name="SHORTDESC", nullable=true) + +/** +* null +*/ +private String shortdesc; + +/**Contructor por defecto*/ +public TgeneProcess(){ +} +/**Contructor de TgeneProcess +@param pPk Clave Primaria del entity +@param pDescription Descricin generral de las actividades que realiza el comando +*/ +public TgeneProcess(TgeneProcessKey pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneProcess +*/ +public static TgeneProcess find(EntityManager pEntityManager,TgeneProcessKey pKey) throws Exception{ + TgeneProcess obj = pEntityManager.find(TgeneProcess.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneProcess +@return El objeto que referencia a la Clave primaria de TgeneProcess +*/ +public TgeneProcessKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneProcess +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneProcess +*/ +public void setPk(TgeneProcessKey pPk){ + pk=pPk; +} +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de shortdesc +@return valor de shortdesc*/ +public String getShortdesc(){ + return shortdesc; +} +/**Fija el valor de shortdesc +@param pShortdesc nuevo Valor de shortdesc*/ +public void setShortdesc(String pShortdesc){ + shortdesc=pShortdesc; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneProcess))return false; + TgeneProcess that = (TgeneProcess) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneProcess +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneProcess +*/ +public Object createInstance(){ + TgeneProcess instance=new TgeneProcess(); + instance.setPk(new TgeneProcessKey()); + return instance; +} +/**Clona la entidad TgeneProcess +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneProcess p=(TgeneProcess)this.clone(); + p.setPk((TgeneProcessKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/proc/.svn/text-base/TgeneProcessKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/proc/.svn/text-base/TgeneProcessKey.java.svn-base new file mode 100644 index 0000000..eab5c05 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/proc/.svn/text-base/TgeneProcessKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.proc; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEPROCESS*/ +@Embeddable +public class TgeneProcessKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PROCESSCODE", nullable=false,updatable=false) + +/** +* Paquete clase de un comando a ejecutar. +*/ +private String processcode; + +@Column(name="CATALOGTYPEPROCESS", nullable=false,updatable=false) + +/** +* Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia +*/ +private String catalogtypeprocess; + +@Column(name="CATALOGCODETYPEPROCESS", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo del proceso de negocio de la aplicacion +*/ +private String catalogcodetypeprocess; + +/**Contructor por defecto*/ +public TgeneProcessKey(){} +/**Contructor de TgeneProcessKey +@param pProcesscode Paquete clase de un comando a ejecutar. +@param pCatalogtypeprocess Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia +@param pCatalogcodetypeprocess Codigo de tabla de catalogo del proceso de negocio de la aplicacion +*/ +public TgeneProcessKey(String pProcesscode,String pCatalogtypeprocess,String pCatalogcodetypeprocess){ + processcode=pProcesscode; + catalogtypeprocess=pCatalogtypeprocess; + catalogcodetypeprocess=pCatalogcodetypeprocess; +} +/**Obtiene el valor de processcode +@return valor de processcode*/ +public String getProcesscode(){ + return processcode; +} +/**Fija el valor de processcode +@param pProcesscode nuevo Valor de processcode*/ +public void setProcesscode(String pProcesscode){ + processcode=pProcesscode; +} + +/**Obtiene el valor de catalogtypeprocess +@return valor de catalogtypeprocess*/ +public String getCatalogtypeprocess(){ + return catalogtypeprocess; +} +/**Fija el valor de catalogtypeprocess +@param pCatalogtypeprocess nuevo Valor de catalogtypeprocess*/ +public void setCatalogtypeprocess(String pCatalogtypeprocess){ + catalogtypeprocess=pCatalogtypeprocess; +} + +/**Obtiene el valor de catalogcodetypeprocess +@return valor de catalogcodetypeprocess*/ +public String getCatalogcodetypeprocess(){ + return catalogcodetypeprocess; +} +/**Fija el valor de catalogcodetypeprocess +@param pCatalogcodetypeprocess nuevo Valor de catalogcodetypeprocess*/ +public void setCatalogcodetypeprocess(String pCatalogcodetypeprocess){ + catalogcodetypeprocess=pCatalogcodetypeprocess; +} + +/**Implementacin de la comparacin de TgeneProcessKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneProcessKey))return false; + TgeneProcessKey that = (TgeneProcessKey) o; + if (this.getProcesscode() == null || that.getProcesscode() == null){ + return false; + } + if (! this.getProcesscode().equals(that.getProcesscode())){ + return false; + } + if (this.getCatalogtypeprocess() == null || that.getCatalogtypeprocess() == null){ + return false; + } + if (! this.getCatalogtypeprocess().equals(that.getCatalogtypeprocess())){ + return false; + } + if (this.getCatalogcodetypeprocess() == null || that.getCatalogcodetypeprocess() == null){ + return false; + } + if (! this.getCatalogcodetypeprocess().equals(that.getCatalogcodetypeprocess())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneProcessKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getProcesscode() == null ? 0 : this.getProcesscode().hashCode()); + result = result * 37 + (this.getCatalogtypeprocess() == null ? 0 : this.getCatalogtypeprocess().hashCode()); + result = result * 37 + (this.getCatalogcodetypeprocess() == null ? 0 : this.getCatalogcodetypeprocess().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/proc/TgeneProcess.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/proc/TgeneProcess.java new file mode 100644 index 0000000..3b25356 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/proc/TgeneProcess.java @@ -0,0 +1,159 @@ +package com.fp.persistence.pgeneral.proc; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEPROCESS*/ +@Entity(name="TgeneProcess") +@Table(name="TGENEPROCESS") +public class TgeneProcess extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneProcess +*/ +@EmbeddedId +private TgeneProcessKey pk; +@Column(name="DESCRIPTION", nullable=false) + +/** +* Descricin generral de las actividades que realiza el comando +*/ +private String description; + +@Column(name="SHORTDESC", nullable=true) + +/** +* null +*/ +private String shortdesc; + +/**Contructor por defecto*/ +public TgeneProcess(){ +} +/**Contructor de TgeneProcess +@param pPk Clave Primaria del entity +@param pDescription Descricin generral de las actividades que realiza el comando +*/ +public TgeneProcess(TgeneProcessKey pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneProcess +*/ +public static TgeneProcess find(EntityManager pEntityManager,TgeneProcessKey pKey) throws Exception{ + TgeneProcess obj = pEntityManager.find(TgeneProcess.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneProcess +@return El objeto que referencia a la Clave primaria de TgeneProcess +*/ +public TgeneProcessKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneProcess +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneProcess +*/ +public void setPk(TgeneProcessKey pPk){ + pk=pPk; +} +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de shortdesc +@return valor de shortdesc*/ +public String getShortdesc(){ + return shortdesc; +} +/**Fija el valor de shortdesc +@param pShortdesc nuevo Valor de shortdesc*/ +public void setShortdesc(String pShortdesc){ + shortdesc=pShortdesc; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneProcess))return false; + TgeneProcess that = (TgeneProcess) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneProcess +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneProcess +*/ +public Object createInstance(){ + TgeneProcess instance=new TgeneProcess(); + instance.setPk(new TgeneProcessKey()); + return instance; +} +/**Clona la entidad TgeneProcess +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneProcess p=(TgeneProcess)this.clone(); + p.setPk((TgeneProcessKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/proc/TgeneProcessKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/proc/TgeneProcessKey.java new file mode 100644 index 0000000..eab5c05 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/proc/TgeneProcessKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.proc; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEPROCESS*/ +@Embeddable +public class TgeneProcessKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PROCESSCODE", nullable=false,updatable=false) + +/** +* Paquete clase de un comando a ejecutar. +*/ +private String processcode; + +@Column(name="CATALOGTYPEPROCESS", nullable=false,updatable=false) + +/** +* Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia +*/ +private String catalogtypeprocess; + +@Column(name="CATALOGCODETYPEPROCESS", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo del proceso de negocio de la aplicacion +*/ +private String catalogcodetypeprocess; + +/**Contructor por defecto*/ +public TgeneProcessKey(){} +/**Contructor de TgeneProcessKey +@param pProcesscode Paquete clase de un comando a ejecutar. +@param pCatalogtypeprocess Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia +@param pCatalogcodetypeprocess Codigo de tabla de catalogo del proceso de negocio de la aplicacion +*/ +public TgeneProcessKey(String pProcesscode,String pCatalogtypeprocess,String pCatalogcodetypeprocess){ + processcode=pProcesscode; + catalogtypeprocess=pCatalogtypeprocess; + catalogcodetypeprocess=pCatalogcodetypeprocess; +} +/**Obtiene el valor de processcode +@return valor de processcode*/ +public String getProcesscode(){ + return processcode; +} +/**Fija el valor de processcode +@param pProcesscode nuevo Valor de processcode*/ +public void setProcesscode(String pProcesscode){ + processcode=pProcesscode; +} + +/**Obtiene el valor de catalogtypeprocess +@return valor de catalogtypeprocess*/ +public String getCatalogtypeprocess(){ + return catalogtypeprocess; +} +/**Fija el valor de catalogtypeprocess +@param pCatalogtypeprocess nuevo Valor de catalogtypeprocess*/ +public void setCatalogtypeprocess(String pCatalogtypeprocess){ + catalogtypeprocess=pCatalogtypeprocess; +} + +/**Obtiene el valor de catalogcodetypeprocess +@return valor de catalogcodetypeprocess*/ +public String getCatalogcodetypeprocess(){ + return catalogcodetypeprocess; +} +/**Fija el valor de catalogcodetypeprocess +@param pCatalogcodetypeprocess nuevo Valor de catalogcodetypeprocess*/ +public void setCatalogcodetypeprocess(String pCatalogcodetypeprocess){ + catalogcodetypeprocess=pCatalogcodetypeprocess; +} + +/**Implementacin de la comparacin de TgeneProcessKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneProcessKey))return false; + TgeneProcessKey that = (TgeneProcessKey) o; + if (this.getProcesscode() == null || that.getProcesscode() == null){ + return false; + } + if (! this.getProcesscode().equals(that.getProcesscode())){ + return false; + } + if (this.getCatalogtypeprocess() == null || that.getCatalogtypeprocess() == null){ + return false; + } + if (! this.getCatalogtypeprocess().equals(that.getCatalogtypeprocess())){ + return false; + } + if (this.getCatalogcodetypeprocess() == null || that.getCatalogcodetypeprocess() == null){ + return false; + } + if (! this.getCatalogcodetypeprocess().equals(that.getCatalogcodetypeprocess())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneProcessKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getProcesscode() == null ? 0 : this.getProcesscode().hashCode()); + result = result * 37 + (this.getCatalogtypeprocess() == null ? 0 : this.getCatalogtypeprocess().hashCode()); + result = result * 37 + (this.getCatalogcodetypeprocess() == null ? 0 : this.getCatalogcodetypeprocess().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/entries new file mode 100644 index 0000000..ff579d9 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/entries @@ -0,0 +1,473 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneSubProductCurrencyKey.java +file + + + + +2022-07-28T03:40:29.091744Z +7853f10a6fe66908be650912cc94a88c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5227 + +TgeneProduct.java +file + + + + +2022-07-28T03:40:29.091744Z +25cdc4b873e3a888c747bd279424cfac +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6173 + +TgeneSubprodClientDataKey.java +file + + + + +2022-07-28T03:40:29.091744Z +f307eb6e27ff506b764572e85e00124d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8173 + +TgeneSubprodInstallTypeKey.java +file + + + + +2022-07-28T03:40:29.091744Z +cc8bd26f9075f9174ea978d2af6194e3 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5342 + +TgeneProductRelationship.java +file + + + + +2022-07-28T03:40:29.092744Z +c4a1b1344ade69aa4158a16103d4387e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4449 + +TgeneSubProductKey.java +file + + + + +2022-07-28T03:40:29.092744Z +c56ff88f0dae8c6f6ffd39df9b63dd2c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4336 + +TgeneModule.java +file + + + + +2022-07-28T03:40:29.092744Z +71aa69559c5240665729930960df26b6 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5779 + +TgeneSubProductCurrency.java +file + + + + +2022-07-28T03:40:29.092744Z +e74394f9e735aec6370f394a0e24c84d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3919 + +TgeneSubprodClientData.java +file + + + + +2022-07-28T03:40:29.093744Z +a634c5936a7ee1374bec1de715ab766d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +12752 + +TgeneSubprodInstallType.java +file + + + + +2022-07-28T03:40:29.093744Z +c8cfc189f80cddcb0540a8052b3737bb +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4408 + +rate +dir + +TgeneProductKey.java +file + + + + +2022-07-28T03:40:29.093744Z +8e5baabd9b02395fcdee9839a7d0eb85 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3439 + +TgeneSubProduct.java +file + + + + +2022-07-28T03:40:29.093744Z +e9a9fe318831b2fe71945b22e34fec0f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7010 + +TgeneProductRelationshipKey.java +file + + + + +2022-07-28T03:40:29.094744Z +d1045e6909fdf3b7949f21e314e4adc6 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3730 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneModule.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneModule.java.svn-base new file mode 100644 index 0000000..5df5aa5 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneModule.java.svn-base @@ -0,0 +1,206 @@ +package com.fp.persistence.pgeneral.product; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMODULE*/ +@Entity(name="TgeneModule") +@Table(name="TGENEMODULE") +public class TgeneModule extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneModule + */ + @Id + @Column(name="MODULECODE" ,nullable=false, updatable=false) + private String pk; + @Version + @Column(name="RECORDVERSION", nullable=true) + + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name="DESCRIPTION", nullable=false) + + /** + * Descripcion del modulo + */ + private String description; + + @Column(name="ISVISIBLE", nullable=true) + + /** + * null + */ + private String isvisible; + + /**Contructor por defecto*/ + public TgeneModule(){ + } + /**Contructor de TgeneModule + @param pPk Clave Primaria del entity + @param pDescription Descripcion del modulo + */ + public TgeneModule(String pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneModule + */ + public static TgeneModule find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneModule obj = pEntityManager.find(TgeneModule.class,pKey); + return obj; + } + /**Entrega la Clave primaria de TgeneModule + @return El objeto que referencia a la Clave primaria de TgeneModule + */ + public String getPk(){ + return pk; + } + /**Fija un nuevo valor a la Clave primaria de TgeneModule + @param pPk El objeto que referencia a la nueva Clave primaria de TgeneModule + */ + public void setPk(String pPk){ + pk=pPk; + } + /**Obtiene el valor de recordversion + @return valor de recordversion*/ + public Integer getRecordversion(){ + return recordversion; + } + /**Fija el valor de recordversion + @param pRecordversion nuevo Valor de recordversion*/ + public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; + } + + /**Obtiene el valor de description + @return valor de description*/ + public String getDescription(){ + return description; + } + /**Fija el valor de description + @param pDescription nuevo Valor de description*/ + public void setDescription(String pDescription){ + description=pDescription; + } + + /**Obtiene el valor de isvisible + @return valor de isvisible*/ + public String getIsvisible(){ + return isvisible; + } + /**Fija el valor de isvisible + @param pIsvisible nuevo Valor de isvisible*/ + public void setIsvisible(String pIsvisible){ + isvisible=pIsvisible; + } + + public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneModule))return false; + TgeneModule that = (TgeneModule) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /**Implementacin del metodo hashCode de la la entidad TgeneModule + @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /**Implementacin toString + */ + public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } + /**Implementacin de la creacin de un bean en blanco TgeneModule + */ + public Object createInstance(){ + TgeneModule instance=new TgeneModule(); + return instance; + } + /**Clona la entidad TgeneModule + @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException{ + TgeneModule p=(TgeneModule)this.clone(); + return p; + } + + //Metodos manuales + + /** + * Sentencia que devuelve un registro de TgeneModule. + */ + private static final String JPQL_TGENE_MODULE = + "from TgeneModule tmod " + + " where tmod.pk = :modulecode"; + + /** + * Metodo que obtiene datos de un registro del modulo. + * @param pModulecode Codigo de modulo a obtener datos de la base. + * @return TgeneModule + * @throws Exception + */ + public static TgeneModule find(EntityManager pEntityManager,String pModulecode) throws Exception { + Query qry = pEntityManager.createQuery(JPQL_TGENE_MODULE); + qry.setParameter("modulecode", pModulecode); + try { + return (TgeneModule) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneProduct.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneProduct.java.svn-base new file mode 100644 index 0000000..d570912 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneProduct.java.svn-base @@ -0,0 +1,242 @@ +package com.fp.persistence.pgeneral.product; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENEPRODUCT + */ +@Entity(name = "TgeneProduct") +@Table(name = "TGENEPRODUCT") +public class TgeneProduct extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneProduct + */ + @EmbeddedId + private TgeneProductKey pk; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "DESCRIPTION", nullable = false) + /** + * Nombre del producto + */ + private String description; + + /** Contructor por defecto */ + public TgeneProduct() { + } + + /** + * Contructor de TgeneProduct + * + * @param pPk + * Clave Primaria del entity + * @param pDescription + * Nombre del producto + */ + public TgeneProduct(TgeneProductKey pPk, String pDescription) { + this(); + pk = pPk; + description = pDescription; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager + * referencia de la session a obtener datos del bean. + * @param pKey + * Caleve primaria del bean. + * @return TgeneProduct + */ + public static TgeneProduct find(EntityManager pEntityManager, + TgeneProductKey pKey) throws Exception { + TgeneProduct obj = pEntityManager.find(TgeneProduct.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneProduct + * + * @return El objeto que referencia a la Clave primaria de TgeneProduct + */ + public TgeneProductKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneProduct + * + * @param pPk + * El objeto que referencia a la nueva Clave primaria de + * TgeneProduct + */ + public void setPk(TgeneProductKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion + * nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription + * nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneProduct)) + return false; + TgeneProduct that = (TgeneProduct) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneProduct + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 + || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneProduct */ + public Object createInstance() { + TgeneProduct instance = new TgeneProduct(); + instance.setPk(new TgeneProductKey()); + return instance; + } + + /** + * Clona la entidad TgeneProduct + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneProduct p = (TgeneProduct) this.clone(); + p.setPk((TgeneProductKey) this.pk.cloneMe()); + return p; + } + + //Metodos manuales. + /** + * Sentencia que devuelve un registro de TgeneProduct. + */ + private static final String JPQL_TGENE_PRODUCT = + "from TgeneProduct tprod " + + " where tprod.pk.modulecode = :modulecode " + + " and tprod.pk.productcode = :productcode "; + + /** + * Metodo que obtiene datos de un registro del producto. + * @param pModulecode Codigo de modulo a obtener datos de la base. + * @param pProductcode Codigo de producto a obtener datos de la base. + * @return TgeneProduct + * @throws Exception + */ + public static TgeneProduct find(EntityManager pEntityManager,String pModulecode, String pProductcode) throws Exception { + Query qry = pEntityManager.createQuery(JPQL_TGENE_PRODUCT); + qry.setParameter("modulecode", pModulecode); + qry.setParameter("productcode", pProductcode); + try { + return (TgeneProduct) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneProductKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneProductKey.java.svn-base new file mode 100644 index 0000000..7e641fe --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneProductKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.product; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEPRODUCT*/ +@Embeddable +public class TgeneProductKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +/**Contructor por defecto*/ +public TgeneProductKey(){} +/**Contructor de TgeneProductKey +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +*/ +public TgeneProductKey(String pModulecode,String pProductcode){ + modulecode=pModulecode; + productcode=pProductcode; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Implementacin de la comparacin de TgeneProductKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneProductKey))return false; + TgeneProductKey that = (TgeneProductKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneProductKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneProductRelationship.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneProductRelationship.java.svn-base new file mode 100644 index 0000000..c0b1589 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneProductRelationship.java.svn-base @@ -0,0 +1,139 @@ +package com.fp.persistence.pgeneral.product; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEPRODUCTRELATIONSHIP*/ +@Entity(name="TgeneProductRelationship") +@Table(name="TGENEPRODUCTRELATIONSHIP") +public class TgeneProductRelationship extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneProductRelationship +*/ +@EmbeddedId +private TgeneProductRelationshipKey pk; +@Column(name="ISPRINCIPAL", nullable=true) + +/** +* Indica si el codigo de relacion es principal, en este caso el codigo de cliente se asocia a la tabla tgeneaccount +*/ +private String isprincipal; + +/**Contructor por defecto*/ +public TgeneProductRelationship(){ +} +/**Contructor de TgeneProductRelationship +@param pPk Clave Primaria del entity +*/ +public TgeneProductRelationship(TgeneProductRelationshipKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneProductRelationship +*/ +public static TgeneProductRelationship find(EntityManager pEntityManager,TgeneProductRelationshipKey pKey) throws Exception{ + TgeneProductRelationship obj = pEntityManager.find(TgeneProductRelationship.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneProductRelationship +@return El objeto que referencia a la Clave primaria de TgeneProductRelationship +*/ +public TgeneProductRelationshipKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneProductRelationship +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneProductRelationship +*/ +public void setPk(TgeneProductRelationshipKey pPk){ + pk=pPk; +} +/**Obtiene el valor de isprincipal +@return valor de isprincipal*/ +public String getIsprincipal(){ + return isprincipal; +} +/**Fija el valor de isprincipal +@param pIsprincipal nuevo Valor de isprincipal*/ +public void setIsprincipal(String pIsprincipal){ + isprincipal=pIsprincipal; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneProductRelationship))return false; + TgeneProductRelationship that = (TgeneProductRelationship) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneProductRelationship +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneProductRelationship +*/ +public Object createInstance(){ + TgeneProductRelationship instance=new TgeneProductRelationship(); + instance.setPk(new TgeneProductRelationshipKey()); + return instance; +} +/**Clona la entidad TgeneProductRelationship +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneProductRelationship p=(TgeneProductRelationship)this.clone(); + p.setPk((TgeneProductRelationshipKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneProductRelationshipKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneProductRelationshipKey.java.svn-base new file mode 100644 index 0000000..c656031 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneProductRelationshipKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.product; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEPRODUCTRELATIONSHIP*/ +@Embeddable +public class TgeneProductRelationshipKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="RELATIONSHIPCODE", nullable=false,updatable=false) + +/** +* Codigo de relacion de la cuenta con el cliente +*/ +private String relationshipcode; + +/**Contructor por defecto*/ +public TgeneProductRelationshipKey(){} +/**Contructor de TgeneProductRelationshipKey +@param pModulecode Codigo de modulo +@param pRelationshipcode Codigo de relacion de la cuenta con el cliente +*/ +public TgeneProductRelationshipKey(String pModulecode,String pRelationshipcode){ + modulecode=pModulecode; + relationshipcode=pRelationshipcode; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de relationshipcode +@return valor de relationshipcode*/ +public String getRelationshipcode(){ + return relationshipcode; +} +/**Fija el valor de relationshipcode +@param pRelationshipcode nuevo Valor de relationshipcode*/ +public void setRelationshipcode(String pRelationshipcode){ + relationshipcode=pRelationshipcode; +} + +/**Implementacin de la comparacin de TgeneProductRelationshipKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneProductRelationshipKey))return false; + TgeneProductRelationshipKey that = (TgeneProductRelationshipKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getRelationshipcode() == null || that.getRelationshipcode() == null){ + return false; + } + if (! this.getRelationshipcode().equals(that.getRelationshipcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneProductRelationshipKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getRelationshipcode() == null ? 0 : this.getRelationshipcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubProduct.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubProduct.java.svn-base new file mode 100644 index 0000000..b187472 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubProduct.java.svn-base @@ -0,0 +1,270 @@ +package com.fp.persistence.pgeneral.product; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENESUBPRODUCT + */ +@Entity(name = "TgeneSubProduct") +@Table(name = "TGENESUBPRODUCT") +public class TgeneSubProduct extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneSubProduct + */ + @EmbeddedId + private TgeneSubProductKey pk; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "INITIALS", nullable = true) + /** + * Siglas del producto + */ + private String initials; + + @Column(name = "DESCRIPTION", nullable = false) + /** + * Descripcion del sub producto. + */ + private String description; + + /** Contructor por defecto */ + public TgeneSubProduct() { + } + + /** + * Contructor de TgeneSubProduct + * + * @param pPk + * Clave Primaria del entity + * @param pDescription + * Descripcion del sub producto. + */ + public TgeneSubProduct(TgeneSubProductKey pPk, String pDescription) { + this(); + pk = pPk; + description = pDescription; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager + * referencia de la session a obtener datos del bean. + * @param pKey + * Caleve primaria del bean. + * @return TgeneSubProduct + */ + public static TgeneSubProduct find(EntityManager pEntityManager, + TgeneSubProductKey pKey) throws Exception { + TgeneSubProduct obj = pEntityManager.find(TgeneSubProduct.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneSubProduct + * + * @return El objeto que referencia a la Clave primaria de TgeneSubProduct + */ + public TgeneSubProductKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneSubProduct + * + * @param pPk + * El objeto que referencia a la nueva Clave primaria de + * TgeneSubProduct + */ + public void setPk(TgeneSubProductKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion + * nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de initials + * + * @return valor de initials + */ + public String getInitials() { + return initials; + } + + /** + * Fija el valor de initials + * + * @param pInitials + * nuevo Valor de initials + */ + public void setInitials(String pInitials) { + initials = pInitials; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription + * nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneSubProduct)) + return false; + TgeneSubProduct that = (TgeneSubProduct) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneSubProduct + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 + || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneSubProduct */ + public Object createInstance() { + TgeneSubProduct instance = new TgeneSubProduct(); + instance.setPk(new TgeneSubProductKey()); + return instance; + } + + /** + * Clona la entidad TgeneSubProduct + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneSubProduct p = (TgeneSubProduct) this.clone(); + p.setPk((TgeneSubProductKey) this.pk.cloneMe()); + return p; + } + + //Metodos manuales + /** + * Sentencia que devuelve un registro de TgeneSubProduct. + */ + private static final String JPQL_TGENE_SUBPRODUCT = + "from TgeneSubProduct tsubprod " + + " where tsubprod.pk.modulecode = :modulecode " + + " and tsubprod.pk.productcode = :productcode " + + " and tsubprod.pk.subproductcode = :subproductcode "; + + /** + * Metodo que obtiene datos de un registro del subproducto. + * @param pModulecode Codigo de modulo a obtener datos de la base. + * @param pProductcode Codigo de producto a obtener datos de la base. + * @param pSubproductcode Codigo de subproducto a obtener datos de la base. + * @return TgeneSubProduct + * @throws Exception + */ + public static TgeneSubProduct find(EntityManager pEntityManager,String pModulecode, String pProductcode, String pSubproductcode) throws Exception { + Query qry = pEntityManager.createQuery(JPQL_TGENE_SUBPRODUCT); + qry.setParameter("modulecode", pModulecode); + qry.setParameter("productcode", pProductcode); + qry.setParameter("subproductcode", pSubproductcode); + try { + return (TgeneSubProduct) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubProductCurrency.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubProductCurrency.java.svn-base new file mode 100644 index 0000000..785cd52 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubProductCurrency.java.svn-base @@ -0,0 +1,121 @@ +package com.fp.persistence.pgeneral.product; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESUBPRODUCTCURRENCY*/ +@Entity(name="TgeneSubProductCurrency") +@Table(name="TGENESUBPRODUCTCURRENCY") +public class TgeneSubProductCurrency extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSubProductCurrency +*/ +@EmbeddedId +private TgeneSubProductCurrencyKey pk; +/**Contructor por defecto*/ +public TgeneSubProductCurrency(){ +} +/**Contructor de TgeneSubProductCurrency +@param pPk Clave Primaria del entity +*/ +public TgeneSubProductCurrency(TgeneSubProductCurrencyKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSubProductCurrency +*/ +public static TgeneSubProductCurrency find(EntityManager pEntityManager,TgeneSubProductCurrencyKey pKey) throws Exception{ + TgeneSubProductCurrency obj = pEntityManager.find(TgeneSubProductCurrency.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSubProductCurrency +@return El objeto que referencia a la Clave primaria de TgeneSubProductCurrency +*/ +public TgeneSubProductCurrencyKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSubProductCurrency +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSubProductCurrency +*/ +public void setPk(TgeneSubProductCurrencyKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSubProductCurrency))return false; + TgeneSubProductCurrency that = (TgeneSubProductCurrency) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSubProductCurrency +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSubProductCurrency +*/ +public Object createInstance(){ + TgeneSubProductCurrency instance=new TgeneSubProductCurrency(); + instance.setPk(new TgeneSubProductCurrencyKey()); + return instance; +} +/**Clona la entidad TgeneSubProductCurrency +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSubProductCurrency p=(TgeneSubProductCurrency)this.clone(); + p.setPk((TgeneSubProductCurrencyKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubProductCurrencyKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubProductCurrencyKey.java.svn-base new file mode 100644 index 0000000..7464218 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubProductCurrencyKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.product; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESUBPRODUCTCURRENCY*/ +@Embeddable +public class TgeneSubProductCurrencyKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +/**Contructor por defecto*/ +public TgeneSubProductCurrencyKey(){} +/**Contructor de TgeneSubProductCurrencyKey +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pCurrencycode Codigo de moneda +*/ +public TgeneSubProductCurrencyKey(String pModulecode,String pProductcode,String pSubproductcode,String pCurrencycode){ + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + currencycode=pCurrencycode; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Implementacin de la comparacin de TgeneSubProductCurrencyKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSubProductCurrencyKey))return false; + TgeneSubProductCurrencyKey that = (TgeneSubProductCurrencyKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSubProductCurrencyKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubProductKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubProductKey.java.svn-base new file mode 100644 index 0000000..56ea262 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubProductKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.product; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESUBPRODUCT*/ +@Embeddable +public class TgeneSubProductKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +/**Contructor por defecto*/ +public TgeneSubProductKey(){} +/**Contructor de TgeneSubProductKey +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +*/ +public TgeneSubProductKey(String pModulecode,String pProductcode,String pSubproductcode){ + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Implementacin de la comparacin de TgeneSubProductKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSubProductKey))return false; + TgeneSubProductKey that = (TgeneSubProductKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSubProductKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubprodClientData.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubprodClientData.java.svn-base new file mode 100644 index 0000000..4ae3134 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubprodClientData.java.svn-base @@ -0,0 +1,358 @@ +package com.fp.persistence.pgeneral.product; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESUBPRODCLIENTDATA */ +@Entity(name = "TgeneSubprodClientData") +@Table(name = "TGENESUBPRODCLIENTDATA") +public class TgeneSubprodClientData extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneSubprodClientData + */ + @EmbeddedId + private TgeneSubprodClientDataKey pk; + + @Column(name = "MODIFIABLE", nullable = true) + /** + * Y indica que la informacion del cliente es modificable en la transaccion de verificaciond e informacion de clientes. + */ + private String modifiable; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro. + */ + private Integer recordversion; + + @Column(name = "ACTIVE", nullable = true) + /** + * Y indica que la validacion de la pagina esta activa. + */ + private String active; + + @Column(name = "PRESENTATIONORDER", nullable = true) + /** + * Orden de presentacion + */ + private Integer presentationorder; + + /** Contructor por defecto */ + public TgeneSubprodClientData() { + } + + /** + * Contructor de TgeneSubprodClientData + * + * @param pPk Clave Primaria del entity + */ + public TgeneSubprodClientData(TgeneSubprodClientDataKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSubprodClientData + */ + public static TgeneSubprodClientData find(EntityManager pEntityManager, TgeneSubprodClientDataKey pKey) throws Exception { + TgeneSubprodClientData obj = pEntityManager.find(TgeneSubprodClientData.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneSubprodClientData + * + * @return El objeto que referencia a la Clave primaria de TgeneSubprodClientData + */ + public TgeneSubprodClientDataKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneSubprodClientData + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneSubprodClientData + */ + public void setPk(TgeneSubprodClientDataKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de modifiable + * + * @return valor de modifiable + */ + public String getModifiable() { + return this.modifiable; + } + + /** + * Fija el valor de modifiable + * + * @param pModifiable nuevo Valor de modifiable + */ + public void setModifiable(String pModifiable) { + this.modifiable = pModifiable; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de active + * + * @return valor de active + */ + public String getActive() { + return this.active; + } + + /** + * Fija el valor de active + * + * @param pActive nuevo Valor de active + */ + public void setActive(String pActive) { + this.active = pActive; + } + + /** + * Obtiene el valor de presentationorder + * + * @return valor de presentationorder + */ + public Integer getPresentationorder() { + return this.presentationorder; + } + + /** + * Fija el valor de presentationorder + * + * @param pPresentationorder nuevo Valor de presentationorder + */ + public void setPresentationorder(Integer pPresentationorder) { + this.presentationorder = pPresentationorder; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneSubprodClientData)) { + return false; + } + TgeneSubprodClientData that = (TgeneSubprodClientData) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneSubprodClientData + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneSubprodClientData */ + @Override + public Object createInstance() { + TgeneSubprodClientData instance = new TgeneSubprodClientData(); + instance.setPk(new TgeneSubprodClientDataKey()); + return instance; + } + + /** + * Clona la entidad TgeneSubprodClientData + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneSubprodClientData p = (TgeneSubprodClientData) this.clone(); + p.setPk((TgeneSubprodClientDataKey) this.pk.cloneMe()); + return p; + } + + // METODOS MANUALES + /** Sentencia que devuelve la definicion datos de clientes requeridos para aprobar una solicitud. */ + private static final String JPQL_SUBPROD_CLIENT_DATA = "from TgeneSubprodClientData tcd " + " where tcd.pk.modulecode = :modulecode " + + " and tcd.pk.productcode = :productcode " + " and tcd.pk.subproductcode = :subproductcode " + + " and tcd.pk.persontypecatalog = :persontype " + " and tcd.pk.relationshipcode = :relationshipcode " + + " order by tcd.presentationorder "; + + /** + * Metodo que entrega una lista de datos requeridos de clientes por producto. + * + * @param pModuleCode Codigo de modulo. + * @param pProductCode Codigo de producto. + * @param pSubproductCode Codigo de subproducto. + * @param pPersontype Tipo de persona. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findByProduct(EntityManager pEntityManager, String pModuleCode, String pProductCode, + String pSubproductCode, String pPersontype, String pRelationshipcode) throws Exception { + List ldata = null; + Query qry = pEntityManager.createQuery(TgeneSubprodClientData.JPQL_SUBPROD_CLIENT_DATA); + qry.setParameter(com.fp.common.helper.Constant.VMODULECODE, pModuleCode); + qry.setParameter(com.fp.common.helper.Constant.VPRODUCTCODE, pProductCode); + qry.setParameter(com.fp.common.helper.Constant.VSUBPRODUCTCODE, pSubproductCode); + qry.setParameter("persontype", pPersontype); + qry.setParameter("relationshipcode", pRelationshipcode); + ldata = qry.getResultList(); + return ldata; + } + + /** Sentencia que devuelve la definicion datos de clientes requeridos para aprobar una solicitud. */ + private static final String JPQL_SUBPROD_CLIENT_DATA_ACTIVE = "from TgeneSubprodClientData tcd " + " where tcd.pk.modulecode = :modulecode " + + " and tcd.pk.productcode = :productcode " + " and tcd.pk.subproductcode = :subproductcode " + + " and tcd.pk.persontypecatalog = :persontype " + " and tcd.pk.relationshipcode = :relationshipcode " + " and tcd.active = 'Y' " + + " order by tcd.presentationorder "; + + /** + * Metodo que entrega una lista de datos requeridos de clientes por producto. + * + * @param pModuleCode Codigo de modulo. + * @param pProductCode Codigo de producto. + * @param pSubproductCode Codigo de subproducto. + * @param pPersontype Tipo de persona. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findByProductActive(EntityManager pEntityManager, String pModuleCode, String pProductCode, + String pSubproductCode, String pPersontype, String pRelationshipcode) throws Exception { + List ldata = null; + Query qry = pEntityManager.createQuery(TgeneSubprodClientData.JPQL_SUBPROD_CLIENT_DATA_ACTIVE); + qry.setParameter(com.fp.common.helper.Constant.VMODULECODE, pModuleCode); + qry.setParameter(com.fp.common.helper.Constant.VPRODUCTCODE, pProductCode); + qry.setParameter(com.fp.common.helper.Constant.VSUBPRODUCTCODE, pSubproductCode); + qry.setParameter("persontype", pPersontype); + qry.setParameter("relationshipcode", pRelationshipcode); + ldata = qry.getResultList(); + return ldata; + } + + /** + * Sentencia SQL que obtiene un objeto de tipo TgeneSolicitude + */ + private static final String JPQL_SUBPRODUCT_CLIENT_DATA = "from TgeneSubprodClientData tgs" + " where tgs.pk.modulecode = :modulecode" + + " and tgs.pk.productcode = :productcode" + " and tgs.pk.subproductcode = :subproductcode" + + " and tgs.pk.persontypecatalog = :persontypecatalog" + " and tgs.pk.persontypecatalogcode = :persontypecatalogcode" + + " and tgs.pk.relationshipcode = :relationshipcode" + " and tgs.pk.title = :title"; + + /** + * Metodo que devuelve un objeto de tipo TgeneSubprodClientData + * + * @param modulecode + * @param productcode + * @param subproductcode + * @param persontype + * @param relationshipcode + * @param title + * @return + * @throws Exception + */ + public static TgeneSubprodClientData find(EntityManager pEntityManager, String modulecode, String productcode, String subproductcode, + String persontype, String relationshipcode, String title) throws Exception { + Query qry = pEntityManager.createQuery(TgeneSubprodClientData.JPQL_SUBPRODUCT_CLIENT_DATA); + qry.setParameter("modulecode", modulecode); + qry.setParameter("productcode", productcode); + qry.setParameter("subproductcode", subproductcode); + qry.setParameter("persontypecatalog", persontype); + qry.setParameter("persontypecatalogcode", "PERSONTYPE"); + qry.setParameter("relationshipcode", relationshipcode); + qry.setParameter("title", title); + try { + return (TgeneSubprodClientData) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubprodClientDataKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubprodClientDataKey.java.svn-base new file mode 100644 index 0000000..7323ad8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubprodClientDataKey.java.svn-base @@ -0,0 +1,259 @@ +package com.fp.persistence.pgeneral.product; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESUBPRODCLIENTDATA*/ +@Embeddable +public class TgeneSubprodClientDataKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="PERSONTYPECATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String persontypecatalog; + +@Column(name="PERSONTYPECATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String persontypecatalogcode; + +@Column(name="RELATIONSHIPCODE", nullable=false,updatable=false) + +/** +* Codigo de relacion de la cuenta con el cliente +*/ +private String relationshipcode; + +@Column(name="TITLE", nullable=false,updatable=false) + +/** +* Codigo de informacion de clientes requerido. +*/ +private String title; + +/**Contructor por defecto*/ +public TgeneSubprodClientDataKey(){} +/**Contructor de TgeneSubprodClientDataKey +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pPersontypecatalog Codigo de catalogo 01 Natural, 02 Juridico +@param pPersontypecatalogcode Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +@param pRelationshipcode Codigo de relacion de la cuenta con el cliente +@param pTitle Codigo de informacion de clientes requerido. +*/ +public TgeneSubprodClientDataKey(String pModulecode,String pProductcode,String pSubproductcode,String pPersontypecatalog,String pPersontypecatalogcode,String pRelationshipcode,String pTitle){ + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + persontypecatalog=pPersontypecatalog; + persontypecatalogcode=pPersontypecatalogcode; + relationshipcode=pRelationshipcode; + title=pTitle; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de persontypecatalog +@return valor de persontypecatalog*/ +public String getPersontypecatalog(){ + return persontypecatalog; +} +/**Fija el valor de persontypecatalog +@param pPersontypecatalog nuevo Valor de persontypecatalog*/ +public void setPersontypecatalog(String pPersontypecatalog){ + persontypecatalog=pPersontypecatalog; +} + +/**Obtiene el valor de persontypecatalogcode +@return valor de persontypecatalogcode*/ +public String getPersontypecatalogcode(){ + return persontypecatalogcode; +} +/**Fija el valor de persontypecatalogcode +@param pPersontypecatalogcode nuevo Valor de persontypecatalogcode*/ +public void setPersontypecatalogcode(String pPersontypecatalogcode){ + persontypecatalogcode=pPersontypecatalogcode; +} + +/**Obtiene el valor de relationshipcode +@return valor de relationshipcode*/ +public String getRelationshipcode(){ + return relationshipcode; +} +/**Fija el valor de relationshipcode +@param pRelationshipcode nuevo Valor de relationshipcode*/ +public void setRelationshipcode(String pRelationshipcode){ + relationshipcode=pRelationshipcode; +} + +/**Obtiene el valor de title +@return valor de title*/ +public String getTitle(){ + return title; +} +/**Fija el valor de title +@param pTitle nuevo Valor de title*/ +public void setTitle(String pTitle){ + title=pTitle; +} + +/**Implementacin de la comparacin de TgeneSubprodClientDataKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSubprodClientDataKey))return false; + TgeneSubprodClientDataKey that = (TgeneSubprodClientDataKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getPersontypecatalog() == null || that.getPersontypecatalog() == null){ + return false; + } + if (! this.getPersontypecatalog().equals(that.getPersontypecatalog())){ + return false; + } + if (this.getPersontypecatalogcode() == null || that.getPersontypecatalogcode() == null){ + return false; + } + if (! this.getPersontypecatalogcode().equals(that.getPersontypecatalogcode())){ + return false; + } + if (this.getRelationshipcode() == null || that.getRelationshipcode() == null){ + return false; + } + if (! this.getRelationshipcode().equals(that.getRelationshipcode())){ + return false; + } + if (this.getTitle() == null || that.getTitle() == null){ + return false; + } + if (! this.getTitle().equals(that.getTitle())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSubprodClientDataKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getPersontypecatalog() == null ? 0 : this.getPersontypecatalog().hashCode()); + result = result * 37 + (this.getPersontypecatalogcode() == null ? 0 : this.getPersontypecatalogcode().hashCode()); + result = result * 37 + (this.getRelationshipcode() == null ? 0 : this.getRelationshipcode().hashCode()); + result = result * 37 + (this.getTitle() == null ? 0 : this.getTitle().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubprodInstallType.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubprodInstallType.java.svn-base new file mode 100644 index 0000000..e26d2d8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubprodInstallType.java.svn-base @@ -0,0 +1,141 @@ +package com.fp.persistence.pgeneral.product; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESUBPRODINSTALLTYPE*/ +@Entity(name="TgeneSubprodInstallType") +@Table(name="TGENESUBPRODINSTALLTYPE") +public class TgeneSubprodInstallType extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSubprodInstallType +*/ +@EmbeddedId +private TgeneSubprodInstallTypeKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TgeneSubprodInstallType(){ +} +/**Contructor de TgeneSubprodInstallType +@param pPk Clave Primaria del entity +*/ +public TgeneSubprodInstallType(TgeneSubprodInstallTypeKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSubprodInstallType +*/ +public static TgeneSubprodInstallType find(EntityManager pEntityManager,TgeneSubprodInstallTypeKey pKey) throws Exception{ + TgeneSubprodInstallType obj = pEntityManager.find(TgeneSubprodInstallType.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSubprodInstallType +@return El objeto que referencia a la Clave primaria de TgeneSubprodInstallType +*/ +public TgeneSubprodInstallTypeKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSubprodInstallType +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSubprodInstallType +*/ +public void setPk(TgeneSubprodInstallTypeKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSubprodInstallType))return false; + TgeneSubprodInstallType that = (TgeneSubprodInstallType) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSubprodInstallType +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSubprodInstallType +*/ +public Object createInstance(){ + TgeneSubprodInstallType instance=new TgeneSubprodInstallType(); + instance.setPk(new TgeneSubprodInstallTypeKey()); + return instance; +} +/**Clona la entidad TgeneSubprodInstallType +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSubprodInstallType p=(TgeneSubprodInstallType)this.clone(); + p.setPk((TgeneSubprodInstallTypeKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubprodInstallTypeKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubprodInstallTypeKey.java.svn-base new file mode 100644 index 0000000..39feb99 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/.svn/text-base/TgeneSubprodInstallTypeKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.product; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESUBPRODINSTALLTYPE*/ +@Embeddable +public class TgeneSubprodInstallTypeKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="INSTALLMENTTYPE", nullable=false,updatable=false) + +/** +* Codigo de tipo de tabla de amortizacion +*/ +private String installmenttype; + +/**Contructor por defecto*/ +public TgeneSubprodInstallTypeKey(){} +/**Contructor de TgeneSubprodInstallTypeKey +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pInstallmenttype Codigo de tipo de tabla de amortizacion +*/ +public TgeneSubprodInstallTypeKey(String pModulecode,String pProductcode,String pSubproductcode,String pInstallmenttype){ + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + installmenttype=pInstallmenttype; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de installmenttype +@return valor de installmenttype*/ +public String getInstallmenttype(){ + return installmenttype; +} +/**Fija el valor de installmenttype +@param pInstallmenttype nuevo Valor de installmenttype*/ +public void setInstallmenttype(String pInstallmenttype){ + installmenttype=pInstallmenttype; +} + +/**Implementacin de la comparacin de TgeneSubprodInstallTypeKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSubprodInstallTypeKey))return false; + TgeneSubprodInstallTypeKey that = (TgeneSubprodInstallTypeKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getInstallmenttype() == null || that.getInstallmenttype() == null){ + return false; + } + if (! this.getInstallmenttype().equals(that.getInstallmenttype())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSubprodInstallTypeKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getInstallmenttype() == null ? 0 : this.getInstallmenttype().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneModule.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneModule.java new file mode 100644 index 0000000..5df5aa5 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneModule.java @@ -0,0 +1,206 @@ +package com.fp.persistence.pgeneral.product; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMODULE*/ +@Entity(name="TgeneModule") +@Table(name="TGENEMODULE") +public class TgeneModule extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneModule + */ + @Id + @Column(name="MODULECODE" ,nullable=false, updatable=false) + private String pk; + @Version + @Column(name="RECORDVERSION", nullable=true) + + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name="DESCRIPTION", nullable=false) + + /** + * Descripcion del modulo + */ + private String description; + + @Column(name="ISVISIBLE", nullable=true) + + /** + * null + */ + private String isvisible; + + /**Contructor por defecto*/ + public TgeneModule(){ + } + /**Contructor de TgeneModule + @param pPk Clave Primaria del entity + @param pDescription Descripcion del modulo + */ + public TgeneModule(String pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneModule + */ + public static TgeneModule find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneModule obj = pEntityManager.find(TgeneModule.class,pKey); + return obj; + } + /**Entrega la Clave primaria de TgeneModule + @return El objeto que referencia a la Clave primaria de TgeneModule + */ + public String getPk(){ + return pk; + } + /**Fija un nuevo valor a la Clave primaria de TgeneModule + @param pPk El objeto que referencia a la nueva Clave primaria de TgeneModule + */ + public void setPk(String pPk){ + pk=pPk; + } + /**Obtiene el valor de recordversion + @return valor de recordversion*/ + public Integer getRecordversion(){ + return recordversion; + } + /**Fija el valor de recordversion + @param pRecordversion nuevo Valor de recordversion*/ + public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; + } + + /**Obtiene el valor de description + @return valor de description*/ + public String getDescription(){ + return description; + } + /**Fija el valor de description + @param pDescription nuevo Valor de description*/ + public void setDescription(String pDescription){ + description=pDescription; + } + + /**Obtiene el valor de isvisible + @return valor de isvisible*/ + public String getIsvisible(){ + return isvisible; + } + /**Fija el valor de isvisible + @param pIsvisible nuevo Valor de isvisible*/ + public void setIsvisible(String pIsvisible){ + isvisible=pIsvisible; + } + + public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneModule))return false; + TgeneModule that = (TgeneModule) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /**Implementacin del metodo hashCode de la la entidad TgeneModule + @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /**Implementacin toString + */ + public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } + /**Implementacin de la creacin de un bean en blanco TgeneModule + */ + public Object createInstance(){ + TgeneModule instance=new TgeneModule(); + return instance; + } + /**Clona la entidad TgeneModule + @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException{ + TgeneModule p=(TgeneModule)this.clone(); + return p; + } + + //Metodos manuales + + /** + * Sentencia que devuelve un registro de TgeneModule. + */ + private static final String JPQL_TGENE_MODULE = + "from TgeneModule tmod " + + " where tmod.pk = :modulecode"; + + /** + * Metodo que obtiene datos de un registro del modulo. + * @param pModulecode Codigo de modulo a obtener datos de la base. + * @return TgeneModule + * @throws Exception + */ + public static TgeneModule find(EntityManager pEntityManager,String pModulecode) throws Exception { + Query qry = pEntityManager.createQuery(JPQL_TGENE_MODULE); + qry.setParameter("modulecode", pModulecode); + try { + return (TgeneModule) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneProduct.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneProduct.java new file mode 100644 index 0000000..d570912 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneProduct.java @@ -0,0 +1,242 @@ +package com.fp.persistence.pgeneral.product; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENEPRODUCT + */ +@Entity(name = "TgeneProduct") +@Table(name = "TGENEPRODUCT") +public class TgeneProduct extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneProduct + */ + @EmbeddedId + private TgeneProductKey pk; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "DESCRIPTION", nullable = false) + /** + * Nombre del producto + */ + private String description; + + /** Contructor por defecto */ + public TgeneProduct() { + } + + /** + * Contructor de TgeneProduct + * + * @param pPk + * Clave Primaria del entity + * @param pDescription + * Nombre del producto + */ + public TgeneProduct(TgeneProductKey pPk, String pDescription) { + this(); + pk = pPk; + description = pDescription; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager + * referencia de la session a obtener datos del bean. + * @param pKey + * Caleve primaria del bean. + * @return TgeneProduct + */ + public static TgeneProduct find(EntityManager pEntityManager, + TgeneProductKey pKey) throws Exception { + TgeneProduct obj = pEntityManager.find(TgeneProduct.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneProduct + * + * @return El objeto que referencia a la Clave primaria de TgeneProduct + */ + public TgeneProductKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneProduct + * + * @param pPk + * El objeto que referencia a la nueva Clave primaria de + * TgeneProduct + */ + public void setPk(TgeneProductKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion + * nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription + * nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneProduct)) + return false; + TgeneProduct that = (TgeneProduct) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneProduct + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 + || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneProduct */ + public Object createInstance() { + TgeneProduct instance = new TgeneProduct(); + instance.setPk(new TgeneProductKey()); + return instance; + } + + /** + * Clona la entidad TgeneProduct + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneProduct p = (TgeneProduct) this.clone(); + p.setPk((TgeneProductKey) this.pk.cloneMe()); + return p; + } + + //Metodos manuales. + /** + * Sentencia que devuelve un registro de TgeneProduct. + */ + private static final String JPQL_TGENE_PRODUCT = + "from TgeneProduct tprod " + + " where tprod.pk.modulecode = :modulecode " + + " and tprod.pk.productcode = :productcode "; + + /** + * Metodo que obtiene datos de un registro del producto. + * @param pModulecode Codigo de modulo a obtener datos de la base. + * @param pProductcode Codigo de producto a obtener datos de la base. + * @return TgeneProduct + * @throws Exception + */ + public static TgeneProduct find(EntityManager pEntityManager,String pModulecode, String pProductcode) throws Exception { + Query qry = pEntityManager.createQuery(JPQL_TGENE_PRODUCT); + qry.setParameter("modulecode", pModulecode); + qry.setParameter("productcode", pProductcode); + try { + return (TgeneProduct) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneProductKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneProductKey.java new file mode 100644 index 0000000..7e641fe --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneProductKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.product; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEPRODUCT*/ +@Embeddable +public class TgeneProductKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +/**Contructor por defecto*/ +public TgeneProductKey(){} +/**Contructor de TgeneProductKey +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +*/ +public TgeneProductKey(String pModulecode,String pProductcode){ + modulecode=pModulecode; + productcode=pProductcode; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Implementacin de la comparacin de TgeneProductKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneProductKey))return false; + TgeneProductKey that = (TgeneProductKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneProductKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneProductRelationship.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneProductRelationship.java new file mode 100644 index 0000000..c0b1589 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneProductRelationship.java @@ -0,0 +1,139 @@ +package com.fp.persistence.pgeneral.product; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEPRODUCTRELATIONSHIP*/ +@Entity(name="TgeneProductRelationship") +@Table(name="TGENEPRODUCTRELATIONSHIP") +public class TgeneProductRelationship extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneProductRelationship +*/ +@EmbeddedId +private TgeneProductRelationshipKey pk; +@Column(name="ISPRINCIPAL", nullable=true) + +/** +* Indica si el codigo de relacion es principal, en este caso el codigo de cliente se asocia a la tabla tgeneaccount +*/ +private String isprincipal; + +/**Contructor por defecto*/ +public TgeneProductRelationship(){ +} +/**Contructor de TgeneProductRelationship +@param pPk Clave Primaria del entity +*/ +public TgeneProductRelationship(TgeneProductRelationshipKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneProductRelationship +*/ +public static TgeneProductRelationship find(EntityManager pEntityManager,TgeneProductRelationshipKey pKey) throws Exception{ + TgeneProductRelationship obj = pEntityManager.find(TgeneProductRelationship.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneProductRelationship +@return El objeto que referencia a la Clave primaria de TgeneProductRelationship +*/ +public TgeneProductRelationshipKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneProductRelationship +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneProductRelationship +*/ +public void setPk(TgeneProductRelationshipKey pPk){ + pk=pPk; +} +/**Obtiene el valor de isprincipal +@return valor de isprincipal*/ +public String getIsprincipal(){ + return isprincipal; +} +/**Fija el valor de isprincipal +@param pIsprincipal nuevo Valor de isprincipal*/ +public void setIsprincipal(String pIsprincipal){ + isprincipal=pIsprincipal; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneProductRelationship))return false; + TgeneProductRelationship that = (TgeneProductRelationship) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneProductRelationship +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneProductRelationship +*/ +public Object createInstance(){ + TgeneProductRelationship instance=new TgeneProductRelationship(); + instance.setPk(new TgeneProductRelationshipKey()); + return instance; +} +/**Clona la entidad TgeneProductRelationship +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneProductRelationship p=(TgeneProductRelationship)this.clone(); + p.setPk((TgeneProductRelationshipKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneProductRelationshipKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneProductRelationshipKey.java new file mode 100644 index 0000000..c656031 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneProductRelationshipKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.product; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEPRODUCTRELATIONSHIP*/ +@Embeddable +public class TgeneProductRelationshipKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="RELATIONSHIPCODE", nullable=false,updatable=false) + +/** +* Codigo de relacion de la cuenta con el cliente +*/ +private String relationshipcode; + +/**Contructor por defecto*/ +public TgeneProductRelationshipKey(){} +/**Contructor de TgeneProductRelationshipKey +@param pModulecode Codigo de modulo +@param pRelationshipcode Codigo de relacion de la cuenta con el cliente +*/ +public TgeneProductRelationshipKey(String pModulecode,String pRelationshipcode){ + modulecode=pModulecode; + relationshipcode=pRelationshipcode; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de relationshipcode +@return valor de relationshipcode*/ +public String getRelationshipcode(){ + return relationshipcode; +} +/**Fija el valor de relationshipcode +@param pRelationshipcode nuevo Valor de relationshipcode*/ +public void setRelationshipcode(String pRelationshipcode){ + relationshipcode=pRelationshipcode; +} + +/**Implementacin de la comparacin de TgeneProductRelationshipKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneProductRelationshipKey))return false; + TgeneProductRelationshipKey that = (TgeneProductRelationshipKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getRelationshipcode() == null || that.getRelationshipcode() == null){ + return false; + } + if (! this.getRelationshipcode().equals(that.getRelationshipcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneProductRelationshipKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getRelationshipcode() == null ? 0 : this.getRelationshipcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubProduct.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubProduct.java new file mode 100644 index 0000000..b187472 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubProduct.java @@ -0,0 +1,270 @@ +package com.fp.persistence.pgeneral.product; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENESUBPRODUCT + */ +@Entity(name = "TgeneSubProduct") +@Table(name = "TGENESUBPRODUCT") +public class TgeneSubProduct extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneSubProduct + */ + @EmbeddedId + private TgeneSubProductKey pk; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "INITIALS", nullable = true) + /** + * Siglas del producto + */ + private String initials; + + @Column(name = "DESCRIPTION", nullable = false) + /** + * Descripcion del sub producto. + */ + private String description; + + /** Contructor por defecto */ + public TgeneSubProduct() { + } + + /** + * Contructor de TgeneSubProduct + * + * @param pPk + * Clave Primaria del entity + * @param pDescription + * Descripcion del sub producto. + */ + public TgeneSubProduct(TgeneSubProductKey pPk, String pDescription) { + this(); + pk = pPk; + description = pDescription; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager + * referencia de la session a obtener datos del bean. + * @param pKey + * Caleve primaria del bean. + * @return TgeneSubProduct + */ + public static TgeneSubProduct find(EntityManager pEntityManager, + TgeneSubProductKey pKey) throws Exception { + TgeneSubProduct obj = pEntityManager.find(TgeneSubProduct.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneSubProduct + * + * @return El objeto que referencia a la Clave primaria de TgeneSubProduct + */ + public TgeneSubProductKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneSubProduct + * + * @param pPk + * El objeto que referencia a la nueva Clave primaria de + * TgeneSubProduct + */ + public void setPk(TgeneSubProductKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion + * nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de initials + * + * @return valor de initials + */ + public String getInitials() { + return initials; + } + + /** + * Fija el valor de initials + * + * @param pInitials + * nuevo Valor de initials + */ + public void setInitials(String pInitials) { + initials = pInitials; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription + * nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneSubProduct)) + return false; + TgeneSubProduct that = (TgeneSubProduct) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneSubProduct + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 + || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneSubProduct */ + public Object createInstance() { + TgeneSubProduct instance = new TgeneSubProduct(); + instance.setPk(new TgeneSubProductKey()); + return instance; + } + + /** + * Clona la entidad TgeneSubProduct + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneSubProduct p = (TgeneSubProduct) this.clone(); + p.setPk((TgeneSubProductKey) this.pk.cloneMe()); + return p; + } + + //Metodos manuales + /** + * Sentencia que devuelve un registro de TgeneSubProduct. + */ + private static final String JPQL_TGENE_SUBPRODUCT = + "from TgeneSubProduct tsubprod " + + " where tsubprod.pk.modulecode = :modulecode " + + " and tsubprod.pk.productcode = :productcode " + + " and tsubprod.pk.subproductcode = :subproductcode "; + + /** + * Metodo que obtiene datos de un registro del subproducto. + * @param pModulecode Codigo de modulo a obtener datos de la base. + * @param pProductcode Codigo de producto a obtener datos de la base. + * @param pSubproductcode Codigo de subproducto a obtener datos de la base. + * @return TgeneSubProduct + * @throws Exception + */ + public static TgeneSubProduct find(EntityManager pEntityManager,String pModulecode, String pProductcode, String pSubproductcode) throws Exception { + Query qry = pEntityManager.createQuery(JPQL_TGENE_SUBPRODUCT); + qry.setParameter("modulecode", pModulecode); + qry.setParameter("productcode", pProductcode); + qry.setParameter("subproductcode", pSubproductcode); + try { + return (TgeneSubProduct) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubProductCurrency.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubProductCurrency.java new file mode 100644 index 0000000..785cd52 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubProductCurrency.java @@ -0,0 +1,121 @@ +package com.fp.persistence.pgeneral.product; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESUBPRODUCTCURRENCY*/ +@Entity(name="TgeneSubProductCurrency") +@Table(name="TGENESUBPRODUCTCURRENCY") +public class TgeneSubProductCurrency extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSubProductCurrency +*/ +@EmbeddedId +private TgeneSubProductCurrencyKey pk; +/**Contructor por defecto*/ +public TgeneSubProductCurrency(){ +} +/**Contructor de TgeneSubProductCurrency +@param pPk Clave Primaria del entity +*/ +public TgeneSubProductCurrency(TgeneSubProductCurrencyKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSubProductCurrency +*/ +public static TgeneSubProductCurrency find(EntityManager pEntityManager,TgeneSubProductCurrencyKey pKey) throws Exception{ + TgeneSubProductCurrency obj = pEntityManager.find(TgeneSubProductCurrency.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSubProductCurrency +@return El objeto que referencia a la Clave primaria de TgeneSubProductCurrency +*/ +public TgeneSubProductCurrencyKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSubProductCurrency +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSubProductCurrency +*/ +public void setPk(TgeneSubProductCurrencyKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSubProductCurrency))return false; + TgeneSubProductCurrency that = (TgeneSubProductCurrency) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSubProductCurrency +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSubProductCurrency +*/ +public Object createInstance(){ + TgeneSubProductCurrency instance=new TgeneSubProductCurrency(); + instance.setPk(new TgeneSubProductCurrencyKey()); + return instance; +} +/**Clona la entidad TgeneSubProductCurrency +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSubProductCurrency p=(TgeneSubProductCurrency)this.clone(); + p.setPk((TgeneSubProductCurrencyKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubProductCurrencyKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubProductCurrencyKey.java new file mode 100644 index 0000000..7464218 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubProductCurrencyKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.product; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESUBPRODUCTCURRENCY*/ +@Embeddable +public class TgeneSubProductCurrencyKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +/**Contructor por defecto*/ +public TgeneSubProductCurrencyKey(){} +/**Contructor de TgeneSubProductCurrencyKey +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pCurrencycode Codigo de moneda +*/ +public TgeneSubProductCurrencyKey(String pModulecode,String pProductcode,String pSubproductcode,String pCurrencycode){ + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + currencycode=pCurrencycode; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Implementacin de la comparacin de TgeneSubProductCurrencyKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSubProductCurrencyKey))return false; + TgeneSubProductCurrencyKey that = (TgeneSubProductCurrencyKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSubProductCurrencyKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubProductKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubProductKey.java new file mode 100644 index 0000000..56ea262 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubProductKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.product; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESUBPRODUCT*/ +@Embeddable +public class TgeneSubProductKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +/**Contructor por defecto*/ +public TgeneSubProductKey(){} +/**Contructor de TgeneSubProductKey +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +*/ +public TgeneSubProductKey(String pModulecode,String pProductcode,String pSubproductcode){ + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Implementacin de la comparacin de TgeneSubProductKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSubProductKey))return false; + TgeneSubProductKey that = (TgeneSubProductKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSubProductKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubprodClientData.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubprodClientData.java new file mode 100644 index 0000000..4ae3134 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubprodClientData.java @@ -0,0 +1,358 @@ +package com.fp.persistence.pgeneral.product; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESUBPRODCLIENTDATA */ +@Entity(name = "TgeneSubprodClientData") +@Table(name = "TGENESUBPRODCLIENTDATA") +public class TgeneSubprodClientData extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneSubprodClientData + */ + @EmbeddedId + private TgeneSubprodClientDataKey pk; + + @Column(name = "MODIFIABLE", nullable = true) + /** + * Y indica que la informacion del cliente es modificable en la transaccion de verificaciond e informacion de clientes. + */ + private String modifiable; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro. + */ + private Integer recordversion; + + @Column(name = "ACTIVE", nullable = true) + /** + * Y indica que la validacion de la pagina esta activa. + */ + private String active; + + @Column(name = "PRESENTATIONORDER", nullable = true) + /** + * Orden de presentacion + */ + private Integer presentationorder; + + /** Contructor por defecto */ + public TgeneSubprodClientData() { + } + + /** + * Contructor de TgeneSubprodClientData + * + * @param pPk Clave Primaria del entity + */ + public TgeneSubprodClientData(TgeneSubprodClientDataKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSubprodClientData + */ + public static TgeneSubprodClientData find(EntityManager pEntityManager, TgeneSubprodClientDataKey pKey) throws Exception { + TgeneSubprodClientData obj = pEntityManager.find(TgeneSubprodClientData.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneSubprodClientData + * + * @return El objeto que referencia a la Clave primaria de TgeneSubprodClientData + */ + public TgeneSubprodClientDataKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneSubprodClientData + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneSubprodClientData + */ + public void setPk(TgeneSubprodClientDataKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de modifiable + * + * @return valor de modifiable + */ + public String getModifiable() { + return this.modifiable; + } + + /** + * Fija el valor de modifiable + * + * @param pModifiable nuevo Valor de modifiable + */ + public void setModifiable(String pModifiable) { + this.modifiable = pModifiable; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de active + * + * @return valor de active + */ + public String getActive() { + return this.active; + } + + /** + * Fija el valor de active + * + * @param pActive nuevo Valor de active + */ + public void setActive(String pActive) { + this.active = pActive; + } + + /** + * Obtiene el valor de presentationorder + * + * @return valor de presentationorder + */ + public Integer getPresentationorder() { + return this.presentationorder; + } + + /** + * Fija el valor de presentationorder + * + * @param pPresentationorder nuevo Valor de presentationorder + */ + public void setPresentationorder(Integer pPresentationorder) { + this.presentationorder = pPresentationorder; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneSubprodClientData)) { + return false; + } + TgeneSubprodClientData that = (TgeneSubprodClientData) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneSubprodClientData + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneSubprodClientData */ + @Override + public Object createInstance() { + TgeneSubprodClientData instance = new TgeneSubprodClientData(); + instance.setPk(new TgeneSubprodClientDataKey()); + return instance; + } + + /** + * Clona la entidad TgeneSubprodClientData + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneSubprodClientData p = (TgeneSubprodClientData) this.clone(); + p.setPk((TgeneSubprodClientDataKey) this.pk.cloneMe()); + return p; + } + + // METODOS MANUALES + /** Sentencia que devuelve la definicion datos de clientes requeridos para aprobar una solicitud. */ + private static final String JPQL_SUBPROD_CLIENT_DATA = "from TgeneSubprodClientData tcd " + " where tcd.pk.modulecode = :modulecode " + + " and tcd.pk.productcode = :productcode " + " and tcd.pk.subproductcode = :subproductcode " + + " and tcd.pk.persontypecatalog = :persontype " + " and tcd.pk.relationshipcode = :relationshipcode " + + " order by tcd.presentationorder "; + + /** + * Metodo que entrega una lista de datos requeridos de clientes por producto. + * + * @param pModuleCode Codigo de modulo. + * @param pProductCode Codigo de producto. + * @param pSubproductCode Codigo de subproducto. + * @param pPersontype Tipo de persona. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findByProduct(EntityManager pEntityManager, String pModuleCode, String pProductCode, + String pSubproductCode, String pPersontype, String pRelationshipcode) throws Exception { + List ldata = null; + Query qry = pEntityManager.createQuery(TgeneSubprodClientData.JPQL_SUBPROD_CLIENT_DATA); + qry.setParameter(com.fp.common.helper.Constant.VMODULECODE, pModuleCode); + qry.setParameter(com.fp.common.helper.Constant.VPRODUCTCODE, pProductCode); + qry.setParameter(com.fp.common.helper.Constant.VSUBPRODUCTCODE, pSubproductCode); + qry.setParameter("persontype", pPersontype); + qry.setParameter("relationshipcode", pRelationshipcode); + ldata = qry.getResultList(); + return ldata; + } + + /** Sentencia que devuelve la definicion datos de clientes requeridos para aprobar una solicitud. */ + private static final String JPQL_SUBPROD_CLIENT_DATA_ACTIVE = "from TgeneSubprodClientData tcd " + " where tcd.pk.modulecode = :modulecode " + + " and tcd.pk.productcode = :productcode " + " and tcd.pk.subproductcode = :subproductcode " + + " and tcd.pk.persontypecatalog = :persontype " + " and tcd.pk.relationshipcode = :relationshipcode " + " and tcd.active = 'Y' " + + " order by tcd.presentationorder "; + + /** + * Metodo que entrega una lista de datos requeridos de clientes por producto. + * + * @param pModuleCode Codigo de modulo. + * @param pProductCode Codigo de producto. + * @param pSubproductCode Codigo de subproducto. + * @param pPersontype Tipo de persona. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findByProductActive(EntityManager pEntityManager, String pModuleCode, String pProductCode, + String pSubproductCode, String pPersontype, String pRelationshipcode) throws Exception { + List ldata = null; + Query qry = pEntityManager.createQuery(TgeneSubprodClientData.JPQL_SUBPROD_CLIENT_DATA_ACTIVE); + qry.setParameter(com.fp.common.helper.Constant.VMODULECODE, pModuleCode); + qry.setParameter(com.fp.common.helper.Constant.VPRODUCTCODE, pProductCode); + qry.setParameter(com.fp.common.helper.Constant.VSUBPRODUCTCODE, pSubproductCode); + qry.setParameter("persontype", pPersontype); + qry.setParameter("relationshipcode", pRelationshipcode); + ldata = qry.getResultList(); + return ldata; + } + + /** + * Sentencia SQL que obtiene un objeto de tipo TgeneSolicitude + */ + private static final String JPQL_SUBPRODUCT_CLIENT_DATA = "from TgeneSubprodClientData tgs" + " where tgs.pk.modulecode = :modulecode" + + " and tgs.pk.productcode = :productcode" + " and tgs.pk.subproductcode = :subproductcode" + + " and tgs.pk.persontypecatalog = :persontypecatalog" + " and tgs.pk.persontypecatalogcode = :persontypecatalogcode" + + " and tgs.pk.relationshipcode = :relationshipcode" + " and tgs.pk.title = :title"; + + /** + * Metodo que devuelve un objeto de tipo TgeneSubprodClientData + * + * @param modulecode + * @param productcode + * @param subproductcode + * @param persontype + * @param relationshipcode + * @param title + * @return + * @throws Exception + */ + public static TgeneSubprodClientData find(EntityManager pEntityManager, String modulecode, String productcode, String subproductcode, + String persontype, String relationshipcode, String title) throws Exception { + Query qry = pEntityManager.createQuery(TgeneSubprodClientData.JPQL_SUBPRODUCT_CLIENT_DATA); + qry.setParameter("modulecode", modulecode); + qry.setParameter("productcode", productcode); + qry.setParameter("subproductcode", subproductcode); + qry.setParameter("persontypecatalog", persontype); + qry.setParameter("persontypecatalogcode", "PERSONTYPE"); + qry.setParameter("relationshipcode", relationshipcode); + qry.setParameter("title", title); + try { + return (TgeneSubprodClientData) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubprodClientDataKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubprodClientDataKey.java new file mode 100644 index 0000000..7323ad8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubprodClientDataKey.java @@ -0,0 +1,259 @@ +package com.fp.persistence.pgeneral.product; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESUBPRODCLIENTDATA*/ +@Embeddable +public class TgeneSubprodClientDataKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="PERSONTYPECATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String persontypecatalog; + +@Column(name="PERSONTYPECATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String persontypecatalogcode; + +@Column(name="RELATIONSHIPCODE", nullable=false,updatable=false) + +/** +* Codigo de relacion de la cuenta con el cliente +*/ +private String relationshipcode; + +@Column(name="TITLE", nullable=false,updatable=false) + +/** +* Codigo de informacion de clientes requerido. +*/ +private String title; + +/**Contructor por defecto*/ +public TgeneSubprodClientDataKey(){} +/**Contructor de TgeneSubprodClientDataKey +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pPersontypecatalog Codigo de catalogo 01 Natural, 02 Juridico +@param pPersontypecatalogcode Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +@param pRelationshipcode Codigo de relacion de la cuenta con el cliente +@param pTitle Codigo de informacion de clientes requerido. +*/ +public TgeneSubprodClientDataKey(String pModulecode,String pProductcode,String pSubproductcode,String pPersontypecatalog,String pPersontypecatalogcode,String pRelationshipcode,String pTitle){ + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + persontypecatalog=pPersontypecatalog; + persontypecatalogcode=pPersontypecatalogcode; + relationshipcode=pRelationshipcode; + title=pTitle; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de persontypecatalog +@return valor de persontypecatalog*/ +public String getPersontypecatalog(){ + return persontypecatalog; +} +/**Fija el valor de persontypecatalog +@param pPersontypecatalog nuevo Valor de persontypecatalog*/ +public void setPersontypecatalog(String pPersontypecatalog){ + persontypecatalog=pPersontypecatalog; +} + +/**Obtiene el valor de persontypecatalogcode +@return valor de persontypecatalogcode*/ +public String getPersontypecatalogcode(){ + return persontypecatalogcode; +} +/**Fija el valor de persontypecatalogcode +@param pPersontypecatalogcode nuevo Valor de persontypecatalogcode*/ +public void setPersontypecatalogcode(String pPersontypecatalogcode){ + persontypecatalogcode=pPersontypecatalogcode; +} + +/**Obtiene el valor de relationshipcode +@return valor de relationshipcode*/ +public String getRelationshipcode(){ + return relationshipcode; +} +/**Fija el valor de relationshipcode +@param pRelationshipcode nuevo Valor de relationshipcode*/ +public void setRelationshipcode(String pRelationshipcode){ + relationshipcode=pRelationshipcode; +} + +/**Obtiene el valor de title +@return valor de title*/ +public String getTitle(){ + return title; +} +/**Fija el valor de title +@param pTitle nuevo Valor de title*/ +public void setTitle(String pTitle){ + title=pTitle; +} + +/**Implementacin de la comparacin de TgeneSubprodClientDataKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSubprodClientDataKey))return false; + TgeneSubprodClientDataKey that = (TgeneSubprodClientDataKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getPersontypecatalog() == null || that.getPersontypecatalog() == null){ + return false; + } + if (! this.getPersontypecatalog().equals(that.getPersontypecatalog())){ + return false; + } + if (this.getPersontypecatalogcode() == null || that.getPersontypecatalogcode() == null){ + return false; + } + if (! this.getPersontypecatalogcode().equals(that.getPersontypecatalogcode())){ + return false; + } + if (this.getRelationshipcode() == null || that.getRelationshipcode() == null){ + return false; + } + if (! this.getRelationshipcode().equals(that.getRelationshipcode())){ + return false; + } + if (this.getTitle() == null || that.getTitle() == null){ + return false; + } + if (! this.getTitle().equals(that.getTitle())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSubprodClientDataKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getPersontypecatalog() == null ? 0 : this.getPersontypecatalog().hashCode()); + result = result * 37 + (this.getPersontypecatalogcode() == null ? 0 : this.getPersontypecatalogcode().hashCode()); + result = result * 37 + (this.getRelationshipcode() == null ? 0 : this.getRelationshipcode().hashCode()); + result = result * 37 + (this.getTitle() == null ? 0 : this.getTitle().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubprodInstallType.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubprodInstallType.java new file mode 100644 index 0000000..e26d2d8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubprodInstallType.java @@ -0,0 +1,141 @@ +package com.fp.persistence.pgeneral.product; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESUBPRODINSTALLTYPE*/ +@Entity(name="TgeneSubprodInstallType") +@Table(name="TGENESUBPRODINSTALLTYPE") +public class TgeneSubprodInstallType extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSubprodInstallType +*/ +@EmbeddedId +private TgeneSubprodInstallTypeKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TgeneSubprodInstallType(){ +} +/**Contructor de TgeneSubprodInstallType +@param pPk Clave Primaria del entity +*/ +public TgeneSubprodInstallType(TgeneSubprodInstallTypeKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSubprodInstallType +*/ +public static TgeneSubprodInstallType find(EntityManager pEntityManager,TgeneSubprodInstallTypeKey pKey) throws Exception{ + TgeneSubprodInstallType obj = pEntityManager.find(TgeneSubprodInstallType.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSubprodInstallType +@return El objeto que referencia a la Clave primaria de TgeneSubprodInstallType +*/ +public TgeneSubprodInstallTypeKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSubprodInstallType +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSubprodInstallType +*/ +public void setPk(TgeneSubprodInstallTypeKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSubprodInstallType))return false; + TgeneSubprodInstallType that = (TgeneSubprodInstallType) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSubprodInstallType +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSubprodInstallType +*/ +public Object createInstance(){ + TgeneSubprodInstallType instance=new TgeneSubprodInstallType(); + instance.setPk(new TgeneSubprodInstallTypeKey()); + return instance; +} +/**Clona la entidad TgeneSubprodInstallType +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSubprodInstallType p=(TgeneSubprodInstallType)this.clone(); + p.setPk((TgeneSubprodInstallTypeKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubprodInstallTypeKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubprodInstallTypeKey.java new file mode 100644 index 0000000..39feb99 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/TgeneSubprodInstallTypeKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.product; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESUBPRODINSTALLTYPE*/ +@Embeddable +public class TgeneSubprodInstallTypeKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="INSTALLMENTTYPE", nullable=false,updatable=false) + +/** +* Codigo de tipo de tabla de amortizacion +*/ +private String installmenttype; + +/**Contructor por defecto*/ +public TgeneSubprodInstallTypeKey(){} +/**Contructor de TgeneSubprodInstallTypeKey +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pInstallmenttype Codigo de tipo de tabla de amortizacion +*/ +public TgeneSubprodInstallTypeKey(String pModulecode,String pProductcode,String pSubproductcode,String pInstallmenttype){ + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + installmenttype=pInstallmenttype; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de installmenttype +@return valor de installmenttype*/ +public String getInstallmenttype(){ + return installmenttype; +} +/**Fija el valor de installmenttype +@param pInstallmenttype nuevo Valor de installmenttype*/ +public void setInstallmenttype(String pInstallmenttype){ + installmenttype=pInstallmenttype; +} + +/**Implementacin de la comparacin de TgeneSubprodInstallTypeKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSubprodInstallTypeKey))return false; + TgeneSubprodInstallTypeKey that = (TgeneSubprodInstallTypeKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getInstallmenttype() == null || that.getInstallmenttype() == null){ + return false; + } + if (! this.getInstallmenttype().equals(that.getInstallmenttype())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSubprodInstallTypeKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getInstallmenttype() == null ? 0 : this.getInstallmenttype().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/entries new file mode 100644 index 0000000..c25f115 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/entries @@ -0,0 +1,572 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneSubProductInstallmentRatesKey.java +file + + + + +2022-07-28T03:40:29.061744Z +a300bb9b84d41665128b76239423f6e7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7547 + +TgeneSegmentRate.java +file + + + + +2022-07-28T03:40:29.061744Z +d4f7bf194293b3c4fff9641a150e896e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +12526 + +TgeneSubProductRateKey.java +file + + + + +2022-07-28T03:40:29.061744Z +0f1ce914f9026c9f29c2b8e5538b1bec +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8936 + +TgeneBaseRateDetailKey.java +file + + + + +2022-07-28T03:40:29.061744Z +69f8cff5dfb17c6c9040dbb16e090dd0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5533 + +TgeneBaseRate.java +file + + + + +2022-07-28T03:40:29.062744Z +c51ae68fdab7498aba9e3902ed04e047 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3594 + +TgeneSegmentRateKey.java +file + + + + +2022-07-28T03:40:29.062744Z +0712bf68602af675e576a6f6a63d217a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9319 + +TgeneRatesGroup.java +file + + + + +2022-07-28T03:40:29.062744Z +6d902d45ed8ecd52414a39cfa005840e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6995 + +TgeneSubProductLiquidation.java +file + + + + +2022-07-28T03:40:29.062744Z +943ea5356287d31af142277b562a2748 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9891 + +TgeneBaseRateKey.java +file + + + + +2022-07-28T03:40:29.063744Z +745bca38019715ee21fa829ffa4cdf3c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4682 + +TgeneSubProductInstallmentCharges.java +file + + + + +2022-07-28T03:40:29.063744Z +0ca4f8eb1a46a15e9f2b19ad422777b0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8601 + +TgeneSubProductInstallmentRates.java +file + + + + +2022-07-28T03:40:29.063744Z +80459a5d6b4838071ff0cefaa6e0024f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +11773 + +TgeneRatesGroupKey.java +file + + + + +2022-07-28T03:40:29.063744Z +d7f2c972aeb36e55bd3779adc8d32660 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9083 + +TgeneSubProductRate.java +file + + + + +2022-07-28T03:40:29.064744Z +4c5e34a6571321fd4cfebada85ac1e99 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +22331 + +TgeneSubProductLiquidationKey.java +file + + + + +2022-07-28T03:40:29.064744Z +1949e68ad3c9b33406b712c2187c6152 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7936 + +TgeneBaseRateDetail.java +file + + + + +2022-07-28T03:40:29.064744Z +0ec9a5a3c29575ce9d7cf0af015ea766 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +13355 + +TgeneSubProductInstallmentChargesKey.java +file + + + + +2022-07-28T03:40:29.065744Z +b9d8c915d4c7c34c7f8f8cd29dd9ff8e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8054 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneBaseRate.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneBaseRate.java.svn-base new file mode 100644 index 0000000..948c1a4 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneBaseRate.java.svn-base @@ -0,0 +1,121 @@ +package com.fp.persistence.pgeneral.product.rate; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEBASERATE*/ +@Entity(name="TgeneBaseRate") +@Table(name="TGENEBASERATE") +public class TgeneBaseRate extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneBaseRate +*/ +@EmbeddedId +private TgeneBaseRateKey pk; +/**Contructor por defecto*/ +public TgeneBaseRate(){ +} +/**Contructor de TgeneBaseRate +@param pPk Clave Primaria del entity +*/ +public TgeneBaseRate(TgeneBaseRateKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneBaseRate +*/ +public static TgeneBaseRate find(EntityManager pEntityManager,TgeneBaseRateKey pKey) throws Exception{ + TgeneBaseRate obj = pEntityManager.find(TgeneBaseRate.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneBaseRate +@return El objeto que referencia a la Clave primaria de TgeneBaseRate +*/ +public TgeneBaseRateKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneBaseRate +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneBaseRate +*/ +public void setPk(TgeneBaseRateKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneBaseRate))return false; + TgeneBaseRate that = (TgeneBaseRate) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneBaseRate +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneBaseRate +*/ +public Object createInstance(){ + TgeneBaseRate instance=new TgeneBaseRate(); + instance.setPk(new TgeneBaseRateKey()); + return instance; +} +/**Clona la entidad TgeneBaseRate +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneBaseRate p=(TgeneBaseRate)this.clone(); + p.setPk((TgeneBaseRateKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneBaseRateDetail.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneBaseRateDetail.java.svn-base new file mode 100644 index 0000000..5f7907b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneBaseRateDetail.java.svn-base @@ -0,0 +1,404 @@ +package com.fp.persistence.pgeneral.product.rate; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; +import javax.persistence.GeneratedValue; +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENEBASERATEDETAIL + */ +@Entity(name = "TgeneBaseRateDetail") +@Table(name = "TGENEBASERATEDETAIL") +public class TgeneBaseRateDetail extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Cache, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneBaseRateDetail + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(RATESEQUENCE),0)+1 from TGENEBASERATEDETAIL where BASERATECATALOG=:baseratecatalog and BASERATECATALOGCODE=:baseratecatalogcode and CURRENCYCODE=:currencycode"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "baseratecatalog,pk.baseratecatalog;baseratecatalogcode,pk.baseratecatalogcode;currencycode,pk.currencycode"), + @Parameter(name = "field", value = "ratesequence")}) + @GeneratedValue(generator = "seq_id") + private TgeneBaseRateDetailKey pk; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Manejo de optimistic locking + */ + private Integer recordversion; + @Column(name = "RATE", nullable = true) + /** + * Tasa asociada + */ + private BigDecimal rate; + @Column(name = "NOMINALRATE", nullable = false) + /** + * Y, Indica que el tipo de tasa referencial es nominal, N el tipo de tasa + * es efectiva. + */ + private String nominalrate; + @Column(name = "VALIDITYRATE", nullable = false) + /** + * Fecha desde la cual esta vigente la defincion de la tasa base. + */ + private Date validityrate; + @Column(name = "EXPIRATIONDATE", nullable = false) + /** + * Fecha hasta la cual esta vigente la definicion de la tasa base. + */ + private Date expirationdate; + + /** + * Contructor por defecto + */ + public TgeneBaseRateDetail() { + } + + /** + * Contructor de TgeneBaseRateDetail + * + * @param pPk Clave Primaria del entity + * @param pNominalrate Y, Indica que el tipo de tasa referencial es nominal, + * N el tipo de tasa es efectiva. + * @param pValidityrate Fecha desde la cual esta vigente la defincion de la + * tasa base. + * @param pExpirationdate Fecha hasta la cual esta vigente la definicion de + * la tasa base. + */ + public TgeneBaseRateDetail(TgeneBaseRateDetailKey pPk, String pNominalrate, Date pValidityrate, Date pExpirationdate) { + this(); + this.pk = pPk; + this.nominalrate = pNominalrate; + this.validityrate = pValidityrate; + this.expirationdate = pExpirationdate; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneBaseRateDetail + */ + public static TgeneBaseRateDetail find(EntityManager pEntityManager, TgeneBaseRateDetailKey pKey) throws Exception { + TgeneBaseRateDetail obj = pEntityManager.find(TgeneBaseRateDetail.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneBaseRateDetail + * + * @return El objeto que referencia a la Clave primaria de + * TgeneBaseRateDetail + */ + public TgeneBaseRateDetailKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneBaseRateDetail + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TgeneBaseRateDetail + */ + public void setPk(TgeneBaseRateDetailKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de rate + * + * @return valor de rate + */ + public BigDecimal getRate() { + return this.rate; + } + + /** + * Fija el valor de rate + * + * @param pRate nuevo Valor de rate + */ + public void setRate(BigDecimal pRate) { + this.rate = pRate; + } + + /** + * Obtiene el valor de nominalrate + * + * @return valor de nominalrate + */ + public String getNominalrate() { + return this.nominalrate; + } + + /** + * Fija el valor de nominalrate + * + * @param pNominalrate nuevo Valor de nominalrate + */ + public void setNominalrate(String pNominalrate) { + this.nominalrate = pNominalrate; + } + + /** + * Obtiene el valor de validityrate + * + * @return valor de validityrate + */ + public Date getValidityrate() { + return this.validityrate; + } + + /** + * Fija el valor de validityrate + * + * @param pValidityrate nuevo Valor de validityrate + */ + public void setValidityrate(Date pValidityrate) { + this.validityrate = pValidityrate; + } + + /** + * Obtiene el valor de expirationdate + * + * @return valor de expirationdate + */ + public Date getExpirationdate() { + return this.expirationdate; + } + + /** + * Fija el valor de expirationdate + * + * @param pExpirationdate nuevo Valor de expirationdate + */ + public void setExpirationdate(Date pExpirationdate) { + this.expirationdate = pExpirationdate; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneBaseRateDetail)) { + return false; + } + TgeneBaseRateDetail that = (TgeneBaseRateDetail) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneBaseRateDetail + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacion toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacion de la creacion de un bean en blanco TgeneBaseRateDetail + */ + @Override + public Object createInstance() { + TgeneBaseRateDetail instance = new TgeneBaseRateDetail(); + instance.setPk(new TgeneBaseRateDetailKey()); + return instance; + } + + /** + * Clona la entidad TgeneBaseRateDetail + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneBaseRateDetail p = (TgeneBaseRateDetail) this.clone(); + p.setPk((TgeneBaseRateDetailKey) this.pk.cloneMe()); + return p; + } + + // METODOS MANUALES + public boolean equalsWithoutRateSequence(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneBaseRateDetail)) { + return false; + } + TgeneBaseRateDetail that = (TgeneBaseRateDetail) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + // Validacion de claves primarias + TgeneBaseRateDetailKey thatpk = that.getPk(); + TgeneBaseRateDetailKey thispk = this.getPk(); + + if (thatpk == null) { + return false; + } + if (!(thatpk instanceof TgeneBaseRateDetailKey)) { + return false; + } + if ((thispk.getBaseratecatalog() == null) || (thatpk.getBaseratecatalog() == null)) { + return false; + } + if (!thispk.getBaseratecatalog().equals(thatpk.getBaseratecatalog())) { + return false; + } + if ((thispk.getBaseratecatalogcode() == null) || (thatpk.getBaseratecatalogcode() == null)) { + return false; + } + if (!thispk.getBaseratecatalogcode().equals(thatpk.getBaseratecatalogcode())) { + return false; + } + if ((thispk.getCurrencycode() == null) || (thatpk.getCurrencycode() == null)) { + return false; + } + if (!thispk.getCurrencycode().equals(thatpk.getCurrencycode())) { + return false; + } + + return true; + } + private static final String JPQL_RATEDETAIL = " from TgeneBaseRateDetail tdet " + " where tdet.pk.currencycode = :currencycode " + + " and tdet.pk.baseratecatalog = :baseratecatalog" + " and tdet.pk.baseratecatalogcode = :baseratecatalogcode"; + + /** + * Metodo que entrega una lista de datos requeridos de clientes por + * producto. + * + * @param pModuleCode Codigo de modulo. + * @param pProductCode Codigo de producto. + * @param pSubproductCode Codigo de subproducto. + * @param pPersontype Tipo de persona. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String currencycode, String baseratecatalog, String baseratecatalogcode) + throws Exception { + List ldata = null; + Query qry = pEntityManager.createQuery(TgeneBaseRateDetail.JPQL_RATEDETAIL); + qry.setParameter("currencycode", currencycode); + qry.setParameter("baseratecatalog", baseratecatalog); + qry.setParameter("baseratecatalogcode", baseratecatalogcode); + ldata = qry.getResultList(); + return ldata; + } + private static final String JPQL_RATEDETAIL_VIGENTS = " from TgeneBaseRateDetail tdet " + " where tdet.pk.currencycode = :currencycode " + + " and tdet.pk.baseratecatalog = :baseratecatalog" + + " and tdet.pk.baseratecatalogcode = :baseratecatalogcode and tdet.expirationdate>=:workingdate"; + + /** + * Metodo que entrega una lista de datos requeridos de clientes por + * producto. + * + * @param pModuleCode Codigo de modulo. + * @param pProductCode Codigo de producto. + * @param pSubproductCode Codigo de subproducto. + * @param pPersontype Tipo de persona. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findVigents(EntityManager pEntityManager, String currencycode, String baseratecatalog, + String baseratecatalogcode, Date workingdate) throws Exception { + Query qry = pEntityManager.createQuery(TgeneBaseRateDetail.JPQL_RATEDETAIL_VIGENTS); + qry.setParameter("currencycode", currencycode); + qry.setParameter("baseratecatalog", baseratecatalog); + qry.setParameter("baseratecatalogcode", baseratecatalogcode); + qry.setParameter("workingdate", workingdate); + return qry.getResultList(); + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneBaseRateDetailKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneBaseRateDetailKey.java.svn-base new file mode 100644 index 0000000..2ffc5b0 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneBaseRateDetailKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.product.rate; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEBASERATEDETAIL*/ +@Embeddable +public class TgeneBaseRateDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="BASERATECATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo de tasas base, BCE tasa banco central +*/ +private String baseratecatalog; + +@Column(name="BASERATECATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo BASERATE +*/ +private String baseratecatalogcode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="RATESEQUENCE", nullable=false,updatable=false) + +/** +* null +*/ +private Integer ratesequence; + +/**Contructor por defecto*/ +public TgeneBaseRateDetailKey(){} +/**Contructor de TgeneBaseRateDetailKey +@param pBaseratecatalog Codigo de catalogo de tasas base, BCE tasa banco central +@param pBaseratecatalogcode Codigo de tabla de catalogo BASERATE +@param pCurrencycode Codigo de moneda +@param pRatesequence null +*/ +public TgeneBaseRateDetailKey(String pBaseratecatalog,String pBaseratecatalogcode,String pCurrencycode,Integer pRatesequence){ + baseratecatalog=pBaseratecatalog; + baseratecatalogcode=pBaseratecatalogcode; + currencycode=pCurrencycode; + ratesequence=pRatesequence; +} +/**Obtiene el valor de baseratecatalog +@return valor de baseratecatalog*/ +public String getBaseratecatalog(){ + return baseratecatalog; +} +/**Fija el valor de baseratecatalog +@param pBaseratecatalog nuevo Valor de baseratecatalog*/ +public void setBaseratecatalog(String pBaseratecatalog){ + baseratecatalog=pBaseratecatalog; +} + +/**Obtiene el valor de baseratecatalogcode +@return valor de baseratecatalogcode*/ +public String getBaseratecatalogcode(){ + return baseratecatalogcode; +} +/**Fija el valor de baseratecatalogcode +@param pBaseratecatalogcode nuevo Valor de baseratecatalogcode*/ +public void setBaseratecatalogcode(String pBaseratecatalogcode){ + baseratecatalogcode=pBaseratecatalogcode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de ratesequence +@return valor de ratesequence*/ +public Integer getRatesequence(){ + return ratesequence; +} +/**Fija el valor de ratesequence +@param pRatesequence nuevo Valor de ratesequence*/ +public void setRatesequence(Integer pRatesequence){ + ratesequence=pRatesequence; +} + +/**Implementacion de la comparacion de TgeneBaseRateDetailKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneBaseRateDetailKey))return false; + TgeneBaseRateDetailKey that = (TgeneBaseRateDetailKey) o; + if (this.getBaseratecatalog() == null || that.getBaseratecatalog() == null){ + return false; + } + if (! this.getBaseratecatalog().equals(that.getBaseratecatalog())){ + return false; + } + if (this.getBaseratecatalogcode() == null || that.getBaseratecatalogcode() == null){ + return false; + } + if (! this.getBaseratecatalogcode().equals(that.getBaseratecatalogcode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getRatesequence() == null || that.getRatesequence() == null){ + return false; + } + if (! this.getRatesequence().equals(that.getRatesequence())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneBaseRateDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getBaseratecatalog() == null ? 0 : this.getBaseratecatalog().hashCode()); + result = result * 37 + (this.getBaseratecatalogcode() == null ? 0 : this.getBaseratecatalogcode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getRatesequence() == null ? 0 : this.getRatesequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneBaseRateKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneBaseRateKey.java.svn-base new file mode 100644 index 0000000..eefa4fa --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneBaseRateKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.product.rate; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEBASERATE*/ +@Embeddable +public class TgeneBaseRateKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="BASERATECATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo de tasas base, BCE tasa banco central +*/ +private String baseratecatalog; + +@Column(name="BASERATECATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo BASERATE +*/ +private String baseratecatalogcode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +/**Contructor por defecto*/ +public TgeneBaseRateKey(){} +/**Contructor de TgeneBaseRateKey +@param pBaseratecatalog Codigo de catalogo de tasas base, BCE tasa banco central +@param pBaseratecatalogcode Codigo de tabla de catalogo BASERATE +@param pCurrencycode Codigo de moneda +*/ +public TgeneBaseRateKey(String pBaseratecatalog,String pBaseratecatalogcode,String pCurrencycode){ + baseratecatalog=pBaseratecatalog; + baseratecatalogcode=pBaseratecatalogcode; + currencycode=pCurrencycode; +} +/**Obtiene el valor de baseratecatalog +@return valor de baseratecatalog*/ +public String getBaseratecatalog(){ + return baseratecatalog; +} +/**Fija el valor de baseratecatalog +@param pBaseratecatalog nuevo Valor de baseratecatalog*/ +public void setBaseratecatalog(String pBaseratecatalog){ + baseratecatalog=pBaseratecatalog; +} + +/**Obtiene el valor de baseratecatalogcode +@return valor de baseratecatalogcode*/ +public String getBaseratecatalogcode(){ + return baseratecatalogcode; +} +/**Fija el valor de baseratecatalogcode +@param pBaseratecatalogcode nuevo Valor de baseratecatalogcode*/ +public void setBaseratecatalogcode(String pBaseratecatalogcode){ + baseratecatalogcode=pBaseratecatalogcode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Implementacion de la comparacion de TgeneBaseRateKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneBaseRateKey))return false; + TgeneBaseRateKey that = (TgeneBaseRateKey) o; + if (this.getBaseratecatalog() == null || that.getBaseratecatalog() == null){ + return false; + } + if (! this.getBaseratecatalog().equals(that.getBaseratecatalog())){ + return false; + } + if (this.getBaseratecatalogcode() == null || that.getBaseratecatalogcode() == null){ + return false; + } + if (! this.getBaseratecatalogcode().equals(that.getBaseratecatalogcode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneBaseRateKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getBaseratecatalog() == null ? 0 : this.getBaseratecatalog().hashCode()); + result = result * 37 + (this.getBaseratecatalogcode() == null ? 0 : this.getBaseratecatalogcode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneRatesGroup.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneRatesGroup.java.svn-base new file mode 100644 index 0000000..c7b8346 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneRatesGroup.java.svn-base @@ -0,0 +1,254 @@ +package com.fp.persistence.pgeneral.product.rate; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENERATESGROUP*/ +@Entity(name="TgeneRatesGroup") +@Table(name="TGENERATESGROUP") +public class TgeneRatesGroup extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneRatesGroup +*/ +@EmbeddedId +private TgeneRatesGroupKey pk; +@Column(name="BASERATECATALOG", nullable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String baseratecatalog; + +@Column(name="BASERATECATALOGCODE", nullable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String baseratecatalogcode; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking +*/ +private Integer recordversion; + +@Column(name="MAXTERM", nullable=true) + +/** +* Plazo maximo +*/ +private Integer maxterm; + +@Column(name="MAXAMOUNT", nullable=true) + +/** +* Monto Maximo +*/ +private BigDecimal maxamount; + +@Column(name="MARGIN", nullable=true) + +/** +* Margen a aplicar dado el operador +*/ +private BigDecimal margin; + +@Column(name="OPERATOR", nullable=true) + +/** +* Operador a aplicar sobre la tasa base, +, - , % +*/ +private String operator; + +/**Contructor por defecto*/ +public TgeneRatesGroup(){ +} +/**Contructor de TgeneRatesGroup +@param pPk Clave Primaria del entity +@param pBaseratecatalog Codigo de catalogo 01 Natural, 02 Juridico +@param pBaseratecatalogcode Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +public TgeneRatesGroup(TgeneRatesGroupKey pPk,String pBaseratecatalog,String pBaseratecatalogcode){ + this(); + pk=pPk; + baseratecatalog=pBaseratecatalog; + baseratecatalogcode=pBaseratecatalogcode; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneRatesGroup +*/ +public static TgeneRatesGroup find(EntityManager pEntityManager,TgeneRatesGroupKey pKey) throws Exception{ + TgeneRatesGroup obj = pEntityManager.find(TgeneRatesGroup.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneRatesGroup +@return El objeto que referencia a la Clave primaria de TgeneRatesGroup +*/ +public TgeneRatesGroupKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneRatesGroup +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneRatesGroup +*/ +public void setPk(TgeneRatesGroupKey pPk){ + pk=pPk; +} +/**Obtiene el valor de baseratecatalog +@return valor de baseratecatalog*/ +public String getBaseratecatalog(){ + return baseratecatalog; +} +/**Fija el valor de baseratecatalog +@param pBaseratecatalog nuevo Valor de baseratecatalog*/ +public void setBaseratecatalog(String pBaseratecatalog){ + baseratecatalog=pBaseratecatalog; +} + +/**Obtiene el valor de baseratecatalogcode +@return valor de baseratecatalogcode*/ +public String getBaseratecatalogcode(){ + return baseratecatalogcode; +} +/**Fija el valor de baseratecatalogcode +@param pBaseratecatalogcode nuevo Valor de baseratecatalogcode*/ +public void setBaseratecatalogcode(String pBaseratecatalogcode){ + baseratecatalogcode=pBaseratecatalogcode; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de maxterm +@return valor de maxterm*/ +public Integer getMaxterm(){ + return maxterm; +} +/**Fija el valor de maxterm +@param pMaxterm nuevo Valor de maxterm*/ +public void setMaxterm(Integer pMaxterm){ + maxterm=pMaxterm; +} + +/**Obtiene el valor de maxamount +@return valor de maxamount*/ +public BigDecimal getMaxamount(){ + return maxamount; +} +/**Fija el valor de maxamount +@param pMaxamount nuevo Valor de maxamount*/ +public void setMaxamount(BigDecimal pMaxamount){ + maxamount=pMaxamount; +} + +/**Obtiene el valor de margin +@return valor de margin*/ +public BigDecimal getMargin(){ + return margin; +} +/**Fija el valor de margin +@param pMargin nuevo Valor de margin*/ +public void setMargin(BigDecimal pMargin){ + margin=pMargin; +} + +/**Obtiene el valor de operator +@return valor de operator*/ +public String getOperator(){ + return operator; +} +/**Fija el valor de operator +@param pOperator nuevo Valor de operator*/ +public void setOperator(String pOperator){ + operator=pOperator; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneRatesGroup))return false; + TgeneRatesGroup that = (TgeneRatesGroup) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneRatesGroup +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneRatesGroup +*/ +public Object createInstance(){ + TgeneRatesGroup instance=new TgeneRatesGroup(); + instance.setPk(new TgeneRatesGroupKey()); + return instance; +} +/**Clona la entidad TgeneRatesGroup +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneRatesGroup p=(TgeneRatesGroup)this.clone(); + p.setPk((TgeneRatesGroupKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneRatesGroupKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneRatesGroupKey.java.svn-base new file mode 100644 index 0000000..d00f405 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneRatesGroupKey.java.svn-base @@ -0,0 +1,287 @@ +package com.fp.persistence.pgeneral.product.rate; + +import javax.persistence.Column; +import java.io.Serializable; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENERATESGROUP*/ +@Embeddable +public class TgeneRatesGroupKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="INTERESTBALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String interestbalancetype; + +@Column(name="INTERESTBALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String interestbalancegroup; + +@Column(name="RATECATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo VIP, EMP empleado +*/ +private String ratecatalog; + +@Column(name="RATECATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo de grupo de tasas RATES +*/ +private String ratecatalogcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="MINTERM", nullable=false,updatable=false) + +/** +* Plazo minnimo +*/ +private Integer minterm; + +@Column(name="MINAMOUNT", nullable=false,updatable=false) + +/** +* Monto minimo +*/ +private BigDecimal minamount; + +/**Contructor por defecto*/ +public TgeneRatesGroupKey(){} +/**Contructor de TgeneRatesGroupKey +@param pInterestbalancetype Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pInterestbalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +@param pRatecatalog Codigo de catalogo VIP, EMP empleado +@param pRatecatalogcode Codigo de tabla de catalogo de grupo de tasas RATES +@param pCompanycode Codigo de compania +@param pCurrencycode Codigo de moneda +@param pMinterm Plazo minnimo +@param pMinamount Monto minimo +*/ +public TgeneRatesGroupKey(String pInterestbalancetype,String pInterestbalancegroup,String pRatecatalog,String pRatecatalogcode,Integer pCompanycode,String pCurrencycode,Integer pMinterm,BigDecimal pMinamount){ + interestbalancetype=pInterestbalancetype; + interestbalancegroup=pInterestbalancegroup; + ratecatalog=pRatecatalog; + ratecatalogcode=pRatecatalogcode; + companycode=pCompanycode; + currencycode=pCurrencycode; + minterm=pMinterm; + minamount=pMinamount; +} +/**Obtiene el valor de interestbalancetype +@return valor de interestbalancetype*/ +public String getInterestbalancetype(){ + return interestbalancetype; +} +/**Fija el valor de interestbalancetype +@param pInterestbalancetype nuevo Valor de interestbalancetype*/ +public void setInterestbalancetype(String pInterestbalancetype){ + interestbalancetype=pInterestbalancetype; +} + +/**Obtiene el valor de interestbalancegroup +@return valor de interestbalancegroup*/ +public String getInterestbalancegroup(){ + return interestbalancegroup; +} +/**Fija el valor de interestbalancegroup +@param pInterestbalancegroup nuevo Valor de interestbalancegroup*/ +public void setInterestbalancegroup(String pInterestbalancegroup){ + interestbalancegroup=pInterestbalancegroup; +} + +/**Obtiene el valor de ratecatalog +@return valor de ratecatalog*/ +public String getRatecatalog(){ + return ratecatalog; +} +/**Fija el valor de ratecatalog +@param pRatecatalog nuevo Valor de ratecatalog*/ +public void setRatecatalog(String pRatecatalog){ + ratecatalog=pRatecatalog; +} + +/**Obtiene el valor de ratecatalogcode +@return valor de ratecatalogcode*/ +public String getRatecatalogcode(){ + return ratecatalogcode; +} +/**Fija el valor de ratecatalogcode +@param pRatecatalogcode nuevo Valor de ratecatalogcode*/ +public void setRatecatalogcode(String pRatecatalogcode){ + ratecatalogcode=pRatecatalogcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de minterm +@return valor de minterm*/ +public Integer getMinterm(){ + return minterm; +} +/**Fija el valor de minterm +@param pMinterm nuevo Valor de minterm*/ +public void setMinterm(Integer pMinterm){ + minterm=pMinterm; +} + +/**Obtiene el valor de minamount +@return valor de minamount*/ +public BigDecimal getMinamount(){ + return minamount; +} +/**Fija el valor de minamount +@param pMinamount nuevo Valor de minamount*/ +public void setMinamount(BigDecimal pMinamount){ + minamount=pMinamount; +} + +/**Implementacin de la comparacin de TgeneRatesGroupKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneRatesGroupKey))return false; + TgeneRatesGroupKey that = (TgeneRatesGroupKey) o; + if (this.getInterestbalancetype() == null || that.getInterestbalancetype() == null){ + return false; + } + if (! this.getInterestbalancetype().equals(that.getInterestbalancetype())){ + return false; + } + if (this.getInterestbalancegroup() == null || that.getInterestbalancegroup() == null){ + return false; + } + if (! this.getInterestbalancegroup().equals(that.getInterestbalancegroup())){ + return false; + } + if (this.getRatecatalog() == null || that.getRatecatalog() == null){ + return false; + } + if (! this.getRatecatalog().equals(that.getRatecatalog())){ + return false; + } + if (this.getRatecatalogcode() == null || that.getRatecatalogcode() == null){ + return false; + } + if (! this.getRatecatalogcode().equals(that.getRatecatalogcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getMinterm() == null || that.getMinterm() == null){ + return false; + } + if (! this.getMinterm().equals(that.getMinterm())){ + return false; + } + if (this.getMinamount() == null || that.getMinamount() == null){ + return false; + } + if (! this.getMinamount().equals(that.getMinamount())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneRatesGroupKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getInterestbalancetype() == null ? 0 : this.getInterestbalancetype().hashCode()); + result = result * 37 + (this.getInterestbalancegroup() == null ? 0 : this.getInterestbalancegroup().hashCode()); + result = result * 37 + (this.getRatecatalog() == null ? 0 : this.getRatecatalog().hashCode()); + result = result * 37 + (this.getRatecatalogcode() == null ? 0 : this.getRatecatalogcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getMinterm() == null ? 0 : this.getMinterm().hashCode()); + result = result * 37 + (this.getMinamount() == null ? 0 : this.getMinamount().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSegmentRate.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSegmentRate.java.svn-base new file mode 100644 index 0000000..367b859 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSegmentRate.java.svn-base @@ -0,0 +1,377 @@ +package com.fp.persistence.pgeneral.product.rate; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.util.List; +import javax.persistence.Query; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESEGMENTRATE*/ +@Entity(name = "TgeneSegmentRate") +@Table(name = "TGENESEGMENTRATE") +public class TgeneSegmentRate extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneSegmentRate + */ + @EmbeddedId + private TgeneSegmentRateKey pk; + @Column(name = "BASERATECATALOG", nullable = false) + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String baseratecatalog; + @Column(name = "BASERATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String baseratecatalogcode; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Manejo de optimistic locking + */ + private Integer recordversion; + @Column(name = "MAXTERM", nullable = false) + /** + * Plazo maximo + */ + private Integer maxterm; + @Column(name = "MAXAMOUNT", nullable = true) + /** + * Monto Maximo + */ + private BigDecimal maxamount; + @Column(name = "MARGIN", nullable = true) + /** + * Margen a aplicar dado el operador + */ + private BigDecimal margin; + @Column(name = "OPERATOR", nullable = true) + /** + * Operador a aplicar sobre la tasa base, +, - , % + */ + private String operator; + @Column(name = "READJUSTMENTOPERATOR", nullable = true) + /** + * Operador que se utilizara el momento del reajuste + */ + private String readjustmentoperator; + @Column(name = "READJUSTMENTMARGIN", nullable = true) + /** + * Margen a aplicar en el reajuste + */ + private BigDecimal readjustmentmargin; + @Column(name = "MINRATE", nullable = true) + /** + * Minimo permitido en la negociacion del prestamo + */ + private BigDecimal minrate; + @Column(name = "MAXRATE", nullable = true) + /** + * Maximo permitido en la negociacion del prestamo + */ + private BigDecimal maxrate; + + /**Contructor por defecto*/ + public TgeneSegmentRate() { + } + + /**Contructor de TgeneSegmentRate + @param pPk Clave Primaria del entity + @param pBaseratecatalog Codigo de catalogo 01 Natural, 02 Juridico + @param pMaxterm Plazo maximo + */ + public TgeneSegmentRate(TgeneSegmentRateKey pPk, String pBaseratecatalog, Integer pMaxterm) { + this(); + pk = pPk; + baseratecatalog = pBaseratecatalog; + maxterm = pMaxterm; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSegmentRate + */ + public static TgeneSegmentRate find(EntityManager pEntityManager, TgeneSegmentRateKey pKey) throws Exception { + TgeneSegmentRate obj = pEntityManager.find(TgeneSegmentRate.class, pKey); + return obj; + } + /** + * Mtodos manuales + * INTERESTBALANCETYPE + * interestbalancetype + * INTERESTBALANCEGROUP + * interestbalancegroup + * CREDITSEGMENTCATALOG + * creditsegmentcatalog + */ + private static final String JPQL_SOL_TGENESEGMENTRATE = + " from TgeneSegmentRate tgenesr " + + "where " + + "tgenesr.pk.interestbalancetype = :interestbalancetype and " + + "tgenesr.pk.interestbalancegroup = :interestbalancegroup and " + + "tgenesr.pk.currencycode = :currencycode and " + + "tgenesr.pk.companycode = :companycode and " + + "tgenesr.pk.creditsegmentcatalog = :creditsegmentcatalog and " + + "tgenesr.pk.minterm <= :term and tgenesr.maxterm >= :term and " + + "tgenesr.pk.minamount <= :amount and tgenesr.maxamount >= :amount"; + + /** + * Metodo que entrega datos para consultar el segmento monto plazo y tipo de saldo. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSegmentRate + */ + @SuppressWarnings("unchecked") + public static List findBySegment(EntityManager pEntityManager, String pInterestbalancetype, String pInterestbalancegroup, String pCreditsegmentcatalog, Integer pCompany, String pCurrencycode,Integer pTerm,BigDecimal pAmount) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(TgeneSegmentRate.JPQL_SOL_TGENESEGMENTRATE); + qry.setParameter("interestbalancetype", pInterestbalancetype); + qry.setParameter("interestbalancegroup", pInterestbalancegroup); + qry.setParameter("creditsegmentcatalog", pCreditsegmentcatalog); + qry.setParameter("companycode", pCompany); + qry.setParameter("currencycode", pCurrencycode); + qry.setParameter("term", pTerm); + qry.setParameter("amount", pAmount); + lObjects = qry.getResultList(); + return lObjects; + } + + /**Entrega la Clave primaria de TgeneSegmentRate + @return El objeto que referencia a la Clave primaria de TgeneSegmentRate + */ + public TgeneSegmentRateKey getPk() { + return pk; + } + + /**Fija un nuevo valor a la Clave primaria de TgeneSegmentRate + @param pPk El objeto que referencia a la nueva Clave primaria de TgeneSegmentRate + */ + public void setPk(TgeneSegmentRateKey pPk) { + pk = pPk; + } + + /**Obtiene el valor de baseratecatalog + @return valor de baseratecatalog*/ + public String getBaseratecatalog() { + return baseratecatalog; + } + + /**Fija el valor de baseratecatalog + @param pBaseratecatalog nuevo Valor de baseratecatalog*/ + public void setBaseratecatalog(String pBaseratecatalog) { + baseratecatalog = pBaseratecatalog; + } + + /**Obtiene el valor de baseratecatalogcode + @return valor de baseratecatalogcode*/ + public String getBaseratecatalogcode() { + return baseratecatalogcode; + } + + /**Fija el valor de baseratecatalogcode + @param pBaseratecatalogcode nuevo Valor de baseratecatalogcode*/ + public void setBaseratecatalogcode(String pBaseratecatalogcode) { + baseratecatalogcode = pBaseratecatalogcode; + } + + /**Obtiene el valor de recordversion + @return valor de recordversion*/ + public Integer getRecordversion() { + return recordversion; + } + + /**Fija el valor de recordversion + @param pRecordversion nuevo Valor de recordversion*/ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /**Obtiene el valor de maxterm + @return valor de maxterm*/ + public Integer getMaxterm() { + return maxterm; + } + + /**Fija el valor de maxterm + @param pMaxterm nuevo Valor de maxterm*/ + public void setMaxterm(Integer pMaxterm) { + maxterm = pMaxterm; + } + + /**Obtiene el valor de maxamount + @return valor de maxamount*/ + public BigDecimal getMaxamount() { + return maxamount; + } + + /**Fija el valor de maxamount + @param pMaxamount nuevo Valor de maxamount*/ + public void setMaxamount(BigDecimal pMaxamount) { + maxamount = pMaxamount; + } + + /**Obtiene el valor de margin + @return valor de margin*/ + public BigDecimal getMargin() { + return margin; + } + + /**Fija el valor de margin + @param pMargin nuevo Valor de margin*/ + public void setMargin(BigDecimal pMargin) { + margin = pMargin; + } + + /**Obtiene el valor de operator + @return valor de operator*/ + public String getOperator() { + return operator; + } + + /**Fija el valor de operator + @param pOperator nuevo Valor de operator*/ + public void setOperator(String pOperator) { + operator = pOperator; + } + + /**Obtiene el valor de readjustmentoperator + @return valor de readjustmentoperator*/ + public String getReadjustmentoperator() { + return readjustmentoperator; + } + + /**Fija el valor de readjustmentoperator + @param pReadjustmentoperator nuevo Valor de readjustmentoperator*/ + public void setReadjustmentoperator(String pReadjustmentoperator) { + readjustmentoperator = pReadjustmentoperator; + } + + /**Obtiene el valor de readjustmentmargin + @return valor de readjustmentmargin*/ + public BigDecimal getReadjustmentmargin() { + return readjustmentmargin; + } + + /**Fija el valor de readjustmentmargin + @param pReadjustmentmargin nuevo Valor de readjustmentmargin*/ + public void setReadjustmentmargin(BigDecimal pReadjustmentmargin) { + readjustmentmargin = pReadjustmentmargin; + } + + /**Obtiene el valor de minrate + @return valor de minrate*/ + public BigDecimal getMinrate() { + return minrate; + } + + /**Fija el valor de minrate + @param pMinrate nuevo Valor de minrate*/ + public void setMinrate(BigDecimal pMinrate) { + minrate = pMinrate; + } + + /**Obtiene el valor de maxrate + @return valor de maxrate*/ + public BigDecimal getMaxrate() { + return maxrate; + } + + /**Fija el valor de maxrate + @param pMaxrate nuevo Valor de maxrate*/ + public void setMaxrate(BigDecimal pMaxrate) { + maxrate = pMaxrate; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneSegmentRate)) { + return false; + } + TgeneSegmentRate that = (TgeneSegmentRate) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /**Implementacion del metodo hashCode de la la entidad TgeneSegmentRate + @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /**Implementacion toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /**Implementacion de la creacion de un bean en blanco TgeneSegmentRate + */ + public Object createInstance() { + TgeneSegmentRate instance = new TgeneSegmentRate(); + instance.setPk(new TgeneSegmentRateKey()); + return instance; + } + + /**Clona la entidad TgeneSegmentRate + @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneSegmentRate p = (TgeneSegmentRate) this.clone(); + p.setPk((TgeneSegmentRateKey) this.pk.cloneMe()); + return p; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSegmentRateKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSegmentRateKey.java.svn-base new file mode 100644 index 0000000..838f16f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSegmentRateKey.java.svn-base @@ -0,0 +1,287 @@ +package com.fp.persistence.pgeneral.product.rate; + +import javax.persistence.Column; +import java.io.Serializable; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESEGMENTRATE*/ +@Embeddable +public class TgeneSegmentRateKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="INTERESTBALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo de interes a calcular. +*/ +private String interestbalancetype; + +@Column(name="INTERESTBALANCEGROUP", nullable=false,updatable=false) + +/** +* Cdigo de grupo de balance del tipo de saldo. +*/ +private String interestbalancegroup; + +@Column(name="CREDITSEGMENTCATALOG", nullable=false,updatable=false) + +/** +* Segmento asociado al tipo de producto de prestamo +*/ +private String creditsegmentcatalog; + +@Column(name="CREDITSEGMENTCATALOGCODE", nullable=false,updatable=false) + +/** +* Catalogo asociado al segmento de producto de prestamo +*/ +private String creditsegmentcatalogcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="MINTERM", nullable=false,updatable=false) + +/** +* Plazo minnimo +*/ +private Integer minterm; + +@Column(name="MINAMOUNT", nullable=false,updatable=false) + +/** +* Monto minimo +*/ +private BigDecimal minamount; + +/**Contructor por defecto*/ +public TgeneSegmentRateKey(){} +/**Contructor de TgeneSegmentRateKey +@param pInterestbalancetype Cdigo de tipo de saldo de interes a calcular. +@param pInterestbalancegroup Cdigo de grupo de balance del tipo de saldo. +@param pCreditsegmentcatalog Segmento asociado al tipo de producto de prestamo +@param pCreditsegmentcatalogcode Catalogo asociado al segmento de producto de prestamo +@param pCompanycode Codigo de compania +@param pCurrencycode Codigo de moneda +@param pMinterm Plazo minnimo +@param pMinamount Monto minimo +*/ +public TgeneSegmentRateKey(String pInterestbalancetype,String pInterestbalancegroup,String pCreditsegmentcatalog,String pCreditsegmentcatalogcode,Integer pCompanycode,String pCurrencycode,Integer pMinterm,BigDecimal pMinamount){ + interestbalancetype=pInterestbalancetype; + interestbalancegroup=pInterestbalancegroup; + creditsegmentcatalog=pCreditsegmentcatalog; + creditsegmentcatalogcode=pCreditsegmentcatalogcode; + companycode=pCompanycode; + currencycode=pCurrencycode; + minterm=pMinterm; + minamount=pMinamount; +} +/**Obtiene el valor de interestbalancetype +@return valor de interestbalancetype*/ +public String getInterestbalancetype(){ + return interestbalancetype; +} +/**Fija el valor de interestbalancetype +@param pInterestbalancetype nuevo Valor de interestbalancetype*/ +public void setInterestbalancetype(String pInterestbalancetype){ + interestbalancetype=pInterestbalancetype; +} + +/**Obtiene el valor de interestbalancegroup +@return valor de interestbalancegroup*/ +public String getInterestbalancegroup(){ + return interestbalancegroup; +} +/**Fija el valor de interestbalancegroup +@param pInterestbalancegroup nuevo Valor de interestbalancegroup*/ +public void setInterestbalancegroup(String pInterestbalancegroup){ + interestbalancegroup=pInterestbalancegroup; +} + +/**Obtiene el valor de creditsegmentcatalog +@return valor de creditsegmentcatalog*/ +public String getCreditsegmentcatalog(){ + return creditsegmentcatalog; +} +/**Fija el valor de creditsegmentcatalog +@param pCreditsegmentcatalog nuevo Valor de creditsegmentcatalog*/ +public void setCreditsegmentcatalog(String pCreditsegmentcatalog){ + creditsegmentcatalog=pCreditsegmentcatalog; +} + +/**Obtiene el valor de creditsegmentcatalogcode +@return valor de creditsegmentcatalogcode*/ +public String getCreditsegmentcatalogcode(){ + return creditsegmentcatalogcode; +} +/**Fija el valor de creditsegmentcatalogcode +@param pCreditsegmentcatalogcode nuevo Valor de creditsegmentcatalogcode*/ +public void setCreditsegmentcatalogcode(String pCreditsegmentcatalogcode){ + creditsegmentcatalogcode=pCreditsegmentcatalogcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de minterm +@return valor de minterm*/ +public Integer getMinterm(){ + return minterm; +} +/**Fija el valor de minterm +@param pMinterm nuevo Valor de minterm*/ +public void setMinterm(Integer pMinterm){ + minterm=pMinterm; +} + +/**Obtiene el valor de minamount +@return valor de minamount*/ +public BigDecimal getMinamount(){ + return minamount; +} +/**Fija el valor de minamount +@param pMinamount nuevo Valor de minamount*/ +public void setMinamount(BigDecimal pMinamount){ + minamount=pMinamount; +} + +/**Implementacion de la comparacion de TgeneSegmentRateKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSegmentRateKey))return false; + TgeneSegmentRateKey that = (TgeneSegmentRateKey) o; + if (this.getInterestbalancetype() == null || that.getInterestbalancetype() == null){ + return false; + } + if (! this.getInterestbalancetype().equals(that.getInterestbalancetype())){ + return false; + } + if (this.getInterestbalancegroup() == null || that.getInterestbalancegroup() == null){ + return false; + } + if (! this.getInterestbalancegroup().equals(that.getInterestbalancegroup())){ + return false; + } + if (this.getCreditsegmentcatalog() == null || that.getCreditsegmentcatalog() == null){ + return false; + } + if (! this.getCreditsegmentcatalog().equals(that.getCreditsegmentcatalog())){ + return false; + } + if (this.getCreditsegmentcatalogcode() == null || that.getCreditsegmentcatalogcode() == null){ + return false; + } + if (! this.getCreditsegmentcatalogcode().equals(that.getCreditsegmentcatalogcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getMinterm() == null || that.getMinterm() == null){ + return false; + } + if (! this.getMinterm().equals(that.getMinterm())){ + return false; + } + if (this.getMinamount() == null || that.getMinamount() == null){ + return false; + } + if (! this.getMinamount().equals(that.getMinamount())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneSegmentRateKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getInterestbalancetype() == null ? 0 : this.getInterestbalancetype().hashCode()); + result = result * 37 + (this.getInterestbalancegroup() == null ? 0 : this.getInterestbalancegroup().hashCode()); + result = result * 37 + (this.getCreditsegmentcatalog() == null ? 0 : this.getCreditsegmentcatalog().hashCode()); + result = result * 37 + (this.getCreditsegmentcatalogcode() == null ? 0 : this.getCreditsegmentcatalogcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getMinterm() == null ? 0 : this.getMinterm().hashCode()); + result = result * 37 + (this.getMinamount() == null ? 0 : this.getMinamount().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductInstallmentCharges.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductInstallmentCharges.java.svn-base new file mode 100644 index 0000000..1145e35 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductInstallmentCharges.java.svn-base @@ -0,0 +1,253 @@ +package com.fp.persistence.pgeneral.product.rate; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESUBPRODUCTINSTALLCHARGES*/ +@Entity(name="TgeneSubProductInstallmentCharges") +@Table(name="TGENESUBPRODUCTINSTALLCHARGES") +public class TgeneSubProductInstallmentCharges extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSubProductInstallmentCharges +*/ +@EmbeddedId +private TgeneSubProductInstallmentChargesKey pk; +@Column(name="CALCULTATEORDER", nullable=true) + +/** +* Orden de calculo de los cargos. +*/ +private Integer calcultateorder; + +@Column(name="BASEAMOUNTBALANCETYPE", nullable=true) + +/** +* Tipo de saldo del cual se toma el monto para calcular el tarifario. +*/ +private String baseamountbalancetype; + +@Column(name="BASEAMOUNTBALANCEGROUP", nullable=true) + +/** +* Grupo de balance asociado al tipo de saldo del cual se toma el monto para calcular el tarifario. +*/ +private String baseamountbalancegroup; + +@Column(name="NEGOTIABLE", nullable=true) + +/** +* Indica si la tasa se puede negociar con el cliente el valor y las condiciones del cargo +*/ +private String negotiable; + +@Column(name="ACTIVE", nullable=true) + +/** +* null +*/ +private String active; + +/**Contructor por defecto*/ +public TgeneSubProductInstallmentCharges(){ +} +/**Contructor de TgeneSubProductInstallmentCharges +@param pPk Clave Primaria del entity +*/ +public TgeneSubProductInstallmentCharges(TgeneSubProductInstallmentChargesKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSubProductInstallmentCharges +*/ +public static TgeneSubProductInstallmentCharges find(EntityManager pEntityManager,TgeneSubProductInstallmentChargesKey pKey) throws Exception{ + TgeneSubProductInstallmentCharges obj = pEntityManager.find(TgeneSubProductInstallmentCharges.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSubProductInstallmentCharges +@return El objeto que referencia a la Clave primaria de TgeneSubProductInstallmentCharges +*/ +public TgeneSubProductInstallmentChargesKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSubProductInstallmentCharges +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSubProductInstallmentCharges +*/ +public void setPk(TgeneSubProductInstallmentChargesKey pPk){ + pk=pPk; +} +/**Obtiene el valor de calcultateorder +@return valor de calcultateorder*/ +public Integer getCalcultateorder(){ + return calcultateorder; +} +/**Fija el valor de calcultateorder +@param pCalcultateorder nuevo Valor de calcultateorder*/ +public void setCalcultateorder(Integer pCalcultateorder){ + calcultateorder=pCalcultateorder; +} + +/**Obtiene el valor de baseamountbalancetype +@return valor de baseamountbalancetype*/ +public String getBaseamountbalancetype(){ + return baseamountbalancetype; +} +/**Fija el valor de baseamountbalancetype +@param pBaseamountbalancetype nuevo Valor de baseamountbalancetype*/ +public void setBaseamountbalancetype(String pBaseamountbalancetype){ + baseamountbalancetype=pBaseamountbalancetype; +} + +/**Obtiene el valor de baseamountbalancegroup +@return valor de baseamountbalancegroup*/ +public String getBaseamountbalancegroup(){ + return baseamountbalancegroup; +} +/**Fija el valor de baseamountbalancegroup +@param pBaseamountbalancegroup nuevo Valor de baseamountbalancegroup*/ +public void setBaseamountbalancegroup(String pBaseamountbalancegroup){ + baseamountbalancegroup=pBaseamountbalancegroup; +} + +/**Obtiene el valor de negotiable +@return valor de negotiable*/ +public String getNegotiable(){ + return negotiable; +} +/**Fija el valor de negotiable +@param pNegotiable nuevo Valor de negotiable*/ +public void setNegotiable(String pNegotiable){ + negotiable=pNegotiable; +} + +/**Obtiene el valor de active +@return valor de active*/ +public String getActive(){ + return active; +} +/**Fija el valor de active +@param pActive nuevo Valor de active*/ +public void setActive(String pActive){ + active=pActive; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSubProductInstallmentCharges))return false; + TgeneSubProductInstallmentCharges that = (TgeneSubProductInstallmentCharges) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSubProductInstallmentCharges +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSubProductInstallmentCharges +*/ +public Object createInstance(){ + TgeneSubProductInstallmentCharges instance=new TgeneSubProductInstallmentCharges(); + instance.setPk(new TgeneSubProductInstallmentChargesKey()); + return instance; +} +/**Clona la entidad TgeneSubProductInstallmentCharges +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSubProductInstallmentCharges p=(TgeneSubProductInstallmentCharges)this.clone(); + p.setPk((TgeneSubProductInstallmentChargesKey)this.pk.cloneMe()); + return p; +} + + //Metodos manuales. + /**Sentencia que devuelve la definicion de cargos asociados al producto de una solicitud.*/ + private static final String HQL_INSTALLMENT_CHARGES = + "from TgeneSubProductInstallmentCharges tinstcharg " + + " where tinstcharg.pk.modulecode = :modulecode "+ + " and tinstcharg.pk.productcode = :productcode "+ + " and tinstcharg.pk.subproductcode = :subproductcode "+ + " and tinstcharg.pk.statuscode = :statuscode "+ + " and tinstcharg.pk.currencycode = :currencycode "+ + " and tinstcharg.active = 'Y' " ; + + + /** + * Entrega una lista de cargos asociados a una tabla de amortizacion. + * @param pModuleCode Codigo de modulo a obtener cargos asociados a la solicitud. + * @param pProductCode Codigo de producto a obtener cargos asociados a la solicitud. + * @param pSubproductCode Codigo de subproducto a obtener cargos asociados a la solicitud. + * @param pStatusCode Codigo de status a obtener cargos asociados a la solicitud. + * @param pCurrencyCode Codigo de moneda a obtener cargos asociados a la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, + String pModuleCode,String pProductCode, + String pSubproductCode,String pStatusCode,String pCurrencyCode) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_INSTALLMENT_CHARGES); + qry.setParameter("modulecode", pModuleCode); + qry.setParameter("productcode", pProductCode); + qry.setParameter("subproductcode", pSubproductCode); + qry.setParameter("statuscode", pStatusCode); + qry.setParameter("currencycode", pCurrencyCode); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductInstallmentChargesKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductInstallmentChargesKey.java.svn-base new file mode 100644 index 0000000..c33db4a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductInstallmentChargesKey.java.svn-base @@ -0,0 +1,259 @@ +package com.fp.persistence.pgeneral.product.rate; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESUBPRODUCTINSTALLCHARGES*/ +@Embeddable +public class TgeneSubProductInstallmentChargesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda de la cuenta +*/ +private String currencycode; + +/**Contructor por defecto*/ +public TgeneSubProductInstallmentChargesKey(){} +/**Contructor de TgeneSubProductInstallmentChargesKey +@param pBalancetype Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pStatuscode Estatus de cuenta +@param pCurrencycode Codigo de moneda de la cuenta +*/ +public TgeneSubProductInstallmentChargesKey(String pBalancetype,String pBalancegroup,String pModulecode,String pProductcode,String pSubproductcode,String pStatuscode,String pCurrencycode){ + balancetype=pBalancetype; + balancegroup=pBalancegroup; + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + statuscode=pStatuscode; + currencycode=pCurrencycode; +} +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Implementacin de la comparacin de TgeneSubProductInstallmentChargesKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSubProductInstallmentChargesKey))return false; + TgeneSubProductInstallmentChargesKey that = (TgeneSubProductInstallmentChargesKey) o; + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSubProductInstallmentChargesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductInstallmentRates.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductInstallmentRates.java.svn-base new file mode 100644 index 0000000..1a5d054 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductInstallmentRates.java.svn-base @@ -0,0 +1,317 @@ +package com.fp.persistence.pgeneral.product.rate; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESUBPRODUCTINSTALLRATES */ +@Entity(name = "TgeneSubProductInstallmentRates") +@Table(name = "TGENESUBPRODUCTINSTALLRATES") +public class TgeneSubProductInstallmentRates extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneSubProductInstallmentRates + */ + @EmbeddedId + private TgeneSubProductInstallmentRatesKey pk; + + @Column(name = "PRINCIPALBALANCETYPE", nullable = true) + /** + * Cdigo de tipo de capital sobre el cual se aplica una tasa y se calcula un valor a provisionar + */ + private String principalbalancetype; + + @Column(name = "PRINCIPALBALANCEGROUP", nullable = true) + /** + * Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor + */ + private String principalbalancegroup; + + @Column(name = "NEGOTIABLE", nullable = true) + /** + * Indica si la tasa se puede negociar con el cliente + */ + private String negotiable; + + @Column(name = "ACTIVE", nullable = true) + /** + * null + */ + private String active; + + /** Contructor por defecto */ + public TgeneSubProductInstallmentRates() { + } + + /** + * Contructor de TgeneSubProductInstallmentRates + * + * @param pPk Clave Primaria del entity + */ + public TgeneSubProductInstallmentRates(TgeneSubProductInstallmentRatesKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSubProductInstallmentRates + */ + public static TgeneSubProductInstallmentRates find(EntityManager pEntityManager, TgeneSubProductInstallmentRatesKey pKey) throws Exception { + TgeneSubProductInstallmentRates obj = pEntityManager.find(TgeneSubProductInstallmentRates.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneSubProductInstallmentRates + * + * @return El objeto que referencia a la Clave primaria de TgeneSubProductInstallmentRates + */ + public TgeneSubProductInstallmentRatesKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneSubProductInstallmentRates + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneSubProductInstallmentRates + */ + public void setPk(TgeneSubProductInstallmentRatesKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de principalbalancetype + * + * @return valor de principalbalancetype + */ + public String getPrincipalbalancetype() { + return this.principalbalancetype; + } + + /** + * Fija el valor de principalbalancetype + * + * @param pPrincipalbalancetype nuevo Valor de principalbalancetype + */ + public void setPrincipalbalancetype(String pPrincipalbalancetype) { + this.principalbalancetype = pPrincipalbalancetype; + } + + /** + * Obtiene el valor de principalbalancegroup + * + * @return valor de principalbalancegroup + */ + public String getPrincipalbalancegroup() { + return this.principalbalancegroup; + } + + /** + * Fija el valor de principalbalancegroup + * + * @param pPrincipalbalancegroup nuevo Valor de principalbalancegroup + */ + public void setPrincipalbalancegroup(String pPrincipalbalancegroup) { + this.principalbalancegroup = pPrincipalbalancegroup; + } + + /** + * Obtiene el valor de negotiable + * + * @return valor de negotiable + */ + public String getNegotiable() { + return this.negotiable; + } + + /** + * Fija el valor de negotiable + * + * @param pNegotiable nuevo Valor de negotiable + */ + public void setNegotiable(String pNegotiable) { + this.negotiable = pNegotiable; + } + + /** + * Obtiene el valor de active + * + * @return valor de active + */ + public String getActive() { + return this.active; + } + + /** + * Fija el valor de active + * + * @param pActive nuevo Valor de active + */ + public void setActive(String pActive) { + this.active = pActive; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneSubProductInstallmentRates)) { + return false; + } + TgeneSubProductInstallmentRates that = (TgeneSubProductInstallmentRates) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneSubProductInstallmentRates + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneSubProductInstallmentRates */ + @Override + public Object createInstance() { + TgeneSubProductInstallmentRates instance = new TgeneSubProductInstallmentRates(); + instance.setPk(new TgeneSubProductInstallmentRatesKey()); + return instance; + } + + /** + * Clona la entidad TgeneSubProductInstallmentRates + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneSubProductInstallmentRates p = (TgeneSubProductInstallmentRates) this.clone(); + p.setPk((TgeneSubProductInstallmentRatesKey) this.pk.cloneMe()); + return p; + } + + // Metodos manuales. + /** Sentencia que devuelve la definicion de valores a provisionar asociados al producto de una solicitud. */ + private static final String HQL_INSTALLMENT_RATES = "from TgeneSubProductInstallmentRates t " + " where t.pk.modulecode = :modulecode " + + " and t.pk.productcode = :productcode " + " and t.pk.subproductcode = :subproductcode " + " and t.pk.currencycode = :currencycode " + + " and t.active = 'Y' "; + + /** + * Entrega una lista de cargos asociados a una tabla de amortizacion, estos se pueden cobrar en la cuota, + * incrementar el valor del credito, o el cliente puede pagar en caja o con debito a la cuenta. + * + * @param pModuleCode Codigo de modulo a obtener valores a provisionar asociados a la solicitud. + * @param pProductCode Codigo de producto a obtener valores a provisionar asociados a la solicitud. + * @param pSubproductCode Codigo de subproducto a obtener valores a provisionar asociados a la solicitud. + * @param pCurrencyCode Codigo de moneda a obtener valores a provisionar asociados a la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pModuleCode, String pProductCode, + String pSubproductCode, String pCurrencyCode) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_INSTALLMENT_RATES); + qry.setParameter("modulecode", pModuleCode); + qry.setParameter("productcode", pProductCode); + qry.setParameter("subproductcode", pSubproductCode); + qry.setParameter("currencycode", pCurrencyCode); + lObjects = qry.getResultList(); + return lObjects; + } + + /** Sentencia que devuelve la definicion de valores a provisionar asociados al producto de una solicitud. */ + private static final String HQL_INSTALLMENT_RATES_BTYPE = "from TgeneSubProductInstallmentRates t " + " where t.pk.modulecode = :modulecode " + + " and t.pk.productcode = :productcode " + " and t.pk.subproductcode = :subproductcode " + " and t.pk.currencycode = :currencycode " + + " and t.principalbalancetype = :btype " + " and t.principalbalancegroup = :bgroup " + " and t.active = 'Y' "; + + /** + * Entrega una lista de cargos asociados a una tabla de amortizacion, estos se pueden cobrar en la cuota, + * incrementar el valor del credito, o el cliente puede pagar en caja o con debito a la cuenta. + * + * @param pModuleCode Codigo de modulo a obtener valores a provisionar asociados a la solicitud. + * @param pProductCode Codigo de producto a obtener valores a provisionar asociados a la solicitud. + * @param pSubproductCode Codigo de subproducto a obtener valores a provisionar asociados a la solicitud. + * @param pCurrencyCode Codigo de moneda a obtener valores a provisionar asociados a la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pModuleCode, String pProductCode, + String pSubproductCode, String pCurrencyCode, String pBalanceType, String pBalanceGroup) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_INSTALLMENT_RATES_BTYPE); + qry.setParameter("modulecode", pModuleCode); + qry.setParameter("productcode", pProductCode); + qry.setParameter("subproductcode", pSubproductCode); + qry.setParameter("currencycode", pCurrencyCode); + qry.setParameter("btype", pBalanceType); + qry.setParameter("bgroup", pBalanceGroup); + lObjects = qry.getResultList(); + return lObjects; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductInstallmentRatesKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductInstallmentRatesKey.java.svn-base new file mode 100644 index 0000000..c15effb --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductInstallmentRatesKey.java.svn-base @@ -0,0 +1,232 @@ +package com.fp.persistence.pgeneral.product.rate; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESUBPRODUCTINSTALLRATES*/ +@Embeddable +public class TgeneSubProductInstallmentRatesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="INTERESTBALANCETYPE", nullable=false,updatable=false) + +/** +* Codigo de tipo de saldo que provisiona en la tabla de cuotas. +*/ +private String interestbalancetype; + +@Column(name="INTERESTBALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String interestbalancegroup; + +/**Contructor por defecto*/ +public TgeneSubProductInstallmentRatesKey(){} +/**Contructor de TgeneSubProductInstallmentRatesKey +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pCurrencycode Codigo de moneda +@param pInterestbalancetype Codigo de tipo de saldo que provisiona en la tabla de cuotas. +@param pInterestbalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +public TgeneSubProductInstallmentRatesKey(String pModulecode,String pProductcode,String pSubproductcode,String pCurrencycode,String pInterestbalancetype,String pInterestbalancegroup){ + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + currencycode=pCurrencycode; + interestbalancetype=pInterestbalancetype; + interestbalancegroup=pInterestbalancegroup; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de interestbalancetype +@return valor de interestbalancetype*/ +public String getInterestbalancetype(){ + return interestbalancetype; +} +/**Fija el valor de interestbalancetype +@param pInterestbalancetype nuevo Valor de interestbalancetype*/ +public void setInterestbalancetype(String pInterestbalancetype){ + interestbalancetype=pInterestbalancetype; +} + +/**Obtiene el valor de interestbalancegroup +@return valor de interestbalancegroup*/ +public String getInterestbalancegroup(){ + return interestbalancegroup; +} +/**Fija el valor de interestbalancegroup +@param pInterestbalancegroup nuevo Valor de interestbalancegroup*/ +public void setInterestbalancegroup(String pInterestbalancegroup){ + interestbalancegroup=pInterestbalancegroup; +} + +/**Implementacin de la comparacin de TgeneSubProductInstallmentRatesKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSubProductInstallmentRatesKey))return false; + TgeneSubProductInstallmentRatesKey that = (TgeneSubProductInstallmentRatesKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getInterestbalancetype() == null || that.getInterestbalancetype() == null){ + return false; + } + if (! this.getInterestbalancetype().equals(that.getInterestbalancetype())){ + return false; + } + if (this.getInterestbalancegroup() == null || that.getInterestbalancegroup() == null){ + return false; + } + if (! this.getInterestbalancegroup().equals(that.getInterestbalancegroup())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSubProductInstallmentRatesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getInterestbalancetype() == null ? 0 : this.getInterestbalancetype().hashCode()); + result = result * 37 + (this.getInterestbalancegroup() == null ? 0 : this.getInterestbalancegroup().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductLiquidation.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductLiquidation.java.svn-base new file mode 100644 index 0000000..c4ea167 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductLiquidation.java.svn-base @@ -0,0 +1,308 @@ +package com.fp.persistence.pgeneral.product.rate; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESUBPRODUCTLIQUIDATION*/ +@Entity(name="TgeneSubProductLiquidation") +@Table(name="TGENESUBPRODUCTLIQUIDATION") +public class TgeneSubProductLiquidation extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSubProductLiquidation +*/ +@EmbeddedId +private TgeneSubProductLiquidationKey pk; +@Column(name="CALCULATEORDER", nullable=true) + +/** +* Orden de calculo de los cargos. +*/ +private Integer calculateorder; + +@Column(name="BASEAMOUNTBALANCETYPE", nullable=true) + +/** +* Tipo de saldo del cual se toma el monto para calcular el tarifario. +*/ +private String baseamountbalancetype; + +@Column(name="BASEAMOUNTBALANCEGROUP", nullable=true) + +/** +* Grupo de balance del tipo de saldo del cual se toma el monto para calcular el tarifario. +*/ +private String baseamountbalancegroup; + +@Column(name="NEGOTIABLE", nullable=true) + +/** +* Indica si la tasa se puede negociar con el cliente el valor y las condiciones del cargo +*/ +private String negotiable; + +@Column(name="INCREASE", nullable=true) + +/** +* Indica que incrementa el valor de capital con el cual se genera la tabla de pagos +*/ +private String increase; + +@Column(name="DECREASE", nullable=true) + +/** +* Indica que disminuye el valor de capital con el cual se genera la tabla de pagos +*/ +private String decrease; + +@Column(name="DECREASEDISBURSEMENT", nullable=true) + +/** +* Indica que el valor del cargo se descuenta del monto a entregar al cliente +*/ +private String decreasedisbursement; + +@Column(name="ACTIVE", nullable=true) + +/** +* null +*/ +private String active; + +/**Contructor por defecto*/ +public TgeneSubProductLiquidation(){ +} +/**Contructor de TgeneSubProductLiquidation +@param pPk Clave Primaria del entity +*/ +public TgeneSubProductLiquidation(TgeneSubProductLiquidationKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSubProductLiquidation +*/ +public static TgeneSubProductLiquidation find(EntityManager pEntityManager,TgeneSubProductLiquidationKey pKey) throws Exception{ + TgeneSubProductLiquidation obj = pEntityManager.find(TgeneSubProductLiquidation.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSubProductLiquidation +@return El objeto que referencia a la Clave primaria de TgeneSubProductLiquidation +*/ +public TgeneSubProductLiquidationKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSubProductLiquidation +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSubProductLiquidation +*/ +public void setPk(TgeneSubProductLiquidationKey pPk){ + pk=pPk; +} +/**Obtiene el valor de calculateorder +@return valor de calculateorder*/ +public Integer getCalculateorder(){ + return calculateorder; +} +/**Fija el valor de calculateorder +@param pCalculateorder nuevo Valor de calculateorder*/ +public void setCalculateorder(Integer pCalculateorder){ + calculateorder=pCalculateorder; +} + +/**Obtiene el valor de baseamountbalancetype +@return valor de baseamountbalancetype*/ +public String getBaseamountbalancetype(){ + return baseamountbalancetype; +} +/**Fija el valor de baseamountbalancetype +@param pBaseamountbalancetype nuevo Valor de baseamountbalancetype*/ +public void setBaseamountbalancetype(String pBaseamountbalancetype){ + baseamountbalancetype=pBaseamountbalancetype; +} + +/**Obtiene el valor de baseamountbalancegroup +@return valor de baseamountbalancegroup*/ +public String getBaseamountbalancegroup(){ + return baseamountbalancegroup; +} +/**Fija el valor de baseamountbalancegroup +@param pBaseamountbalancegroup nuevo Valor de baseamountbalancegroup*/ +public void setBaseamountbalancegroup(String pBaseamountbalancegroup){ + baseamountbalancegroup=pBaseamountbalancegroup; +} + +/**Obtiene el valor de negotiable +@return valor de negotiable*/ +public String getNegotiable(){ + return negotiable; +} +/**Fija el valor de negotiable +@param pNegotiable nuevo Valor de negotiable*/ +public void setNegotiable(String pNegotiable){ + negotiable=pNegotiable; +} + +/**Obtiene el valor de increase +@return valor de increase*/ +public String getIncrease(){ + return increase; +} +/**Fija el valor de increase +@param pIncrease nuevo Valor de increase*/ +public void setIncrease(String pIncrease){ + increase=pIncrease; +} + +/**Obtiene el valor de decrease +@return valor de decrease*/ +public String getDecrease(){ + return decrease; +} +/**Fija el valor de decrease +@param pDecrease nuevo Valor de decrease*/ +public void setDecrease(String pDecrease){ + decrease=pDecrease; +} + +/**Obtiene el valor de decreasedisbursement +@return valor de decreasedisbursement*/ +public String getDecreasedisbursement(){ + return decreasedisbursement; +} +/**Fija el valor de decreasedisbursement +@param pDecreasedisbursement nuevo Valor de decreasedisbursement*/ +public void setDecreasedisbursement(String pDecreasedisbursement){ + decreasedisbursement=pDecreasedisbursement; +} + +/**Obtiene el valor de active +@return valor de active*/ +public String getActive(){ + return active; +} +/**Fija el valor de active +@param pActive nuevo Valor de active*/ +public void setActive(String pActive){ + active=pActive; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSubProductLiquidation))return false; + TgeneSubProductLiquidation that = (TgeneSubProductLiquidation) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSubProductLiquidation +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSubProductLiquidation +*/ +public Object createInstance(){ + TgeneSubProductLiquidation instance=new TgeneSubProductLiquidation(); + instance.setPk(new TgeneSubProductLiquidationKey()); + return instance; +} +/**Clona la entidad TgeneSubProductLiquidation +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSubProductLiquidation p=(TgeneSubProductLiquidation)this.clone(); + p.setPk((TgeneSubProductLiquidationKey)this.pk.cloneMe()); + return p; +} + + //Metodos manuales. + /**Sentencia que devuelve la definicion de cargos asociados al producto de una solicitud.*/ + private static final String HQL_LIQUIDATION_CHARGES = + "from TgeneSubProductLiquidation tprodliq " + + " where tprodliq.pk.modulecode = :modulecode "+ + " and tprodliq.pk.productcode = :productcode "+ + " and tprodliq.pk.subproductcode = :subproductcode "+ + " and tprodliq.pk.statuscode = :statuscode "+ + " and tprodliq.pk.currencycode = :currencycode "+ + " and tprodliq.active = 'Y' "; + + + /** + * Entrega una lista de cargos asociados a solicitud estos se pueden incrementar el valor del credito, o el + * cliente puede pagar en caja o con debito a la cuenta, o disminuir del valor a entregar al cliente. + * @param pModuleCode Codigo de modulo a obtener cargos asociados a la solicitud. + * @param pProductCode Codigo de producto a obtener cargos asociados a la solicitud. + * @param pSubproductCode Codigo de subproducto a obtener cargos asociados a la solicitud. + * @param pStatusCode Codigo de status a obtener cargos asociados a la solicitud. + * @param pCurrencyCode Codigo de moneda a obtener cargos asociados a la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, + String pModuleCode,String pProductCode, + String pSubproductCode,String pStatusCode,String pCurrencyCode) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_LIQUIDATION_CHARGES); + qry.setParameter("modulecode", pModuleCode); + qry.setParameter("productcode", pProductCode); + qry.setParameter("subproductcode", pSubproductCode); + qry.setParameter("statuscode", pStatusCode); + qry.setParameter("currencycode", pCurrencyCode); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductLiquidationKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductLiquidationKey.java.svn-base new file mode 100644 index 0000000..34574d8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductLiquidationKey.java.svn-base @@ -0,0 +1,259 @@ +package com.fp.persistence.pgeneral.product.rate; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESUBPRODUCTLIQUIDATION*/ +@Embeddable +public class TgeneSubProductLiquidationKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. de valores a cobrar en la liquidacion de una operacion +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +/**Contructor por defecto*/ +public TgeneSubProductLiquidationKey(){} +/**Contructor de TgeneSubProductLiquidationKey +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pStatuscode Estatus de cuenta +@param pCurrencycode Codigo de moneda +@param pBalancetype Cdigo de tipo de saldo. de valores a cobrar en la liquidacion de una operacion +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +public TgeneSubProductLiquidationKey(String pModulecode,String pProductcode,String pSubproductcode,String pStatuscode,String pCurrencycode,String pBalancetype,String pBalancegroup){ + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + statuscode=pStatuscode; + currencycode=pCurrencycode; + balancetype=pBalancetype; + balancegroup=pBalancegroup; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Implementacin de la comparacin de TgeneSubProductLiquidationKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSubProductLiquidationKey))return false; + TgeneSubProductLiquidationKey that = (TgeneSubProductLiquidationKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSubProductLiquidationKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductRate.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductRate.java.svn-base new file mode 100644 index 0000000..7d7f785 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductRate.java.svn-base @@ -0,0 +1,721 @@ +package com.fp.persistence.pgeneral.product.rate; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESUBPRODUCTRATE */ +@Entity(name = "TgeneSubProductRate") +@Table(name = "TGENESUBPRODUCTRATE") +public class TgeneSubProductRate extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Cache { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneSubProductRate + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(RATESEQUENCE),0)+1 from TGENESUBPRODUCTRATE " + "where PRODUCTCODE=:procode " + + "and SUBPRODUCTCODE=:sprcode " + "and CURRENCYCODE=:curcode " + "and INTERESTBALANCETYPE=:interestbt " + + "and COMPANYCODE=:comcode " + "and INTERESTBALANCEGROUP=:interestbg " + "and MODULECODE=:modcode"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "procode,pk.productcode;sprcode,pk.subproductcode;curcode,pk.currencycode;interestbt,pk.interestbalancetype;comcode,pk.companycode;interestbg,pk.interestbalancegroup;modcode,pk.modulecode"), + @Parameter(name = "field", value = "ratesequence") }) + @GeneratedValue(generator = "seq_id") + private TgeneSubProductRateKey pk; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Manejo de optimistic locking + */ + private Integer recordversion; + + @Column(name = "BASERATECATALOG", nullable = true) + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String baseratecatalog; + + @Column(name = "BASERATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String baseratecatalogcode; + + @Column(name = "MARGIN", nullable = true) + /** + * Margen a aplicar dado el operador + */ + private BigDecimal margin; + + @Column(name = "OPERATOR", nullable = true) + /** + * Operador a aplicar sobre la tasa base, +, - , % + */ + private String operator; + + @Column(name = "MINTERM", nullable = false) + /** + * Plazo minnimo + */ + private Integer minterm; + + @Column(name = "MAXTERM", nullable = true) + /** + * Plazo maximo + */ + private Integer maxterm; + + @Column(name = "MINAMOUNT", nullable = false) + /** + * Monto minimo + */ + private BigDecimal minamount; + + @Column(name = "MAXAMOUNT", nullable = true) + /** + * Monto Maximo + */ + private BigDecimal maxamount; + + @Column(name = "MINRATE", nullable = true) + /** + * Minimo permitido en la negociacion del prestamo + */ + private BigDecimal minrate; + + @Column(name = "MAXRATE", nullable = true) + /** + * Maximo permitido en la negociacion del prestamo + */ + private BigDecimal maxrate; + + @Column(name = "READJUSTBASERATECATALOG", nullable = true) + /** + * Codigo de catalogo de tasas base de reajuste, BCE tasa banco central + */ + private String readjustbaseratecatalog; + + @Column(name = "READJUSTBASERATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo BASERATE + */ + private String readjustbaseratecatalogcode; + + @Column(name = "READJUSTMENTOPERATOR", nullable = true) + /** + * Operador que se utilizara el momento del reajuste + */ + private String readjustmentoperator; + + @Column(name = "READJUSTMENTMARGIN", nullable = true) + /** + * Margen a aplicar en el reajuste + */ + private BigDecimal readjustmentmargin; + + @Column(name = "MAXBASERATECATALOG", nullable = true) + /** + * Codigo de catalogo de tasas base maxima, BCE tasa banco central + */ + private String maxbaseratecatalog; + + @Column(name = "MAXBASERATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo BASERATE + */ + private String maxbaseratecatalogcode; + + /** Contructor por defecto */ + public TgeneSubProductRate() { + } + + /** + * Contructor de TgeneSubProductRate + * + * @param pPk Clave Primaria del entity + * @param pMinterm Plazo minnimo + * @param pMinamount Monto minimo + */ + public TgeneSubProductRate(TgeneSubProductRateKey pPk, Integer pMinterm, BigDecimal pMinamount) { + this(); + this.pk = pPk; + this.minterm = pMinterm; + this.minamount = pMinamount; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSubProductRate + */ + public static TgeneSubProductRate find(EntityManager pEntityManager, TgeneSubProductRateKey pKey) throws Exception { + TgeneSubProductRate obj = pEntityManager.find(TgeneSubProductRate.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneSubProductRate + * + * @return El objeto que referencia a la Clave primaria de TgeneSubProductRate + */ + public TgeneSubProductRateKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneSubProductRate + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneSubProductRate + */ + public void setPk(TgeneSubProductRateKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de baseratecatalog + * + * @return valor de baseratecatalog + */ + public String getBaseratecatalog() { + return this.baseratecatalog; + } + + /** + * Fija el valor de baseratecatalog + * + * @param pBaseratecatalog nuevo Valor de baseratecatalog + */ + public void setBaseratecatalog(String pBaseratecatalog) { + this.baseratecatalog = pBaseratecatalog; + } + + /** + * Obtiene el valor de baseratecatalogcode + * + * @return valor de baseratecatalogcode + */ + public String getBaseratecatalogcode() { + return this.baseratecatalogcode; + } + + /** + * Fija el valor de baseratecatalogcode + * + * @param pBaseratecatalogcode nuevo Valor de baseratecatalogcode + */ + public void setBaseratecatalogcode(String pBaseratecatalogcode) { + this.baseratecatalogcode = pBaseratecatalogcode; + } + + /** + * Obtiene el valor de margin + * + * @return valor de margin + */ + public BigDecimal getMargin() { + return this.margin; + } + + /** + * Fija el valor de margin + * + * @param pMargin nuevo Valor de margin + */ + public void setMargin(BigDecimal pMargin) { + this.margin = pMargin; + } + + /** + * Obtiene el valor de operator + * + * @return valor de operator + */ + public String getOperator() { + return this.operator; + } + + /** + * Fija el valor de operator + * + * @param pOperator nuevo Valor de operator + */ + public void setOperator(String pOperator) { + this.operator = pOperator; + } + + /** + * Obtiene el valor de minterm + * + * @return valor de minterm + */ + public Integer getMinterm() { + return this.minterm; + } + + /** + * Fija el valor de minterm + * + * @param pMinterm nuevo Valor de minterm + */ + public void setMinterm(Integer pMinterm) { + this.minterm = pMinterm; + } + + /** + * Obtiene el valor de maxterm + * + * @return valor de maxterm + */ + public Integer getMaxterm() { + return this.maxterm; + } + + /** + * Fija el valor de maxterm + * + * @param pMaxterm nuevo Valor de maxterm + */ + public void setMaxterm(Integer pMaxterm) { + this.maxterm = pMaxterm; + } + + /** + * Obtiene el valor de minamount + * + * @return valor de minamount + */ + public BigDecimal getMinamount() { + return this.minamount; + } + + /** + * Fija el valor de minamount + * + * @param pMinamount nuevo Valor de minamount + */ + public void setMinamount(BigDecimal pMinamount) { + this.minamount = pMinamount; + } + + /** + * Obtiene el valor de maxamount + * + * @return valor de maxamount + */ + public BigDecimal getMaxamount() { + return this.maxamount; + } + + /** + * Fija el valor de maxamount + * + * @param pMaxamount nuevo Valor de maxamount + */ + public void setMaxamount(BigDecimal pMaxamount) { + this.maxamount = pMaxamount; + } + + /** + * Obtiene el valor de minrate + * + * @return valor de minrate + */ + public BigDecimal getMinrate() { + return this.minrate; + } + + /** + * Fija el valor de minrate + * + * @param pMinrate nuevo Valor de minrate + */ + public void setMinrate(BigDecimal pMinrate) { + this.minrate = pMinrate; + } + + /** + * Obtiene el valor de maxrate + * + * @return valor de maxrate + */ + public BigDecimal getMaxrate() { + return this.maxrate; + } + + /** + * Fija el valor de maxrate + * + * @param pMaxrate nuevo Valor de maxrate + */ + public void setMaxrate(BigDecimal pMaxrate) { + this.maxrate = pMaxrate; + } + + /** + * Obtiene el valor de readjustbaseratecatalog + * + * @return valor de readjustbaseratecatalog + */ + public String getReadjustbaseratecatalog() { + return this.readjustbaseratecatalog; + } + + /** + * Fija el valor de readjustbaseratecatalog + * + * @param pReadjustbaseratecatalog nuevo Valor de readjustbaseratecatalog + */ + public void setReadjustbaseratecatalog(String pReadjustbaseratecatalog) { + this.readjustbaseratecatalog = pReadjustbaseratecatalog; + } + + /** + * Obtiene el valor de readjustbaseratecatalogcode + * + * @return valor de readjustbaseratecatalogcode + */ + public String getReadjustbaseratecatalogcode() { + return this.readjustbaseratecatalogcode; + } + + /** + * Fija el valor de readjustbaseratecatalogcode + * + * @param pReadjustbaseratecatalogcode nuevo Valor de readjustbaseratecatalogcode + */ + public void setReadjustbaseratecatalogcode(String pReadjustbaseratecatalogcode) { + this.readjustbaseratecatalogcode = pReadjustbaseratecatalogcode; + } + + /** + * Obtiene el valor de readjustmentoperator + * + * @return valor de readjustmentoperator + */ + public String getReadjustmentoperator() { + return this.readjustmentoperator; + } + + /** + * Fija el valor de readjustmentoperator + * + * @param pReadjustmentoperator nuevo Valor de readjustmentoperator + */ + public void setReadjustmentoperator(String pReadjustmentoperator) { + this.readjustmentoperator = pReadjustmentoperator; + } + + /** + * Obtiene el valor de readjustmentmargin + * + * @return valor de readjustmentmargin + */ + public BigDecimal getReadjustmentmargin() { + return this.readjustmentmargin; + } + + /** + * Fija el valor de readjustmentmargin + * + * @param pReadjustmentmargin nuevo Valor de readjustmentmargin + */ + public void setReadjustmentmargin(BigDecimal pReadjustmentmargin) { + this.readjustmentmargin = pReadjustmentmargin; + } + + /** + * Obtiene el valor de maxbaseratecatalog + * + * @return valor de maxbaseratecatalog + */ + public String getMaxbaseratecatalog() { + return this.maxbaseratecatalog; + } + + /** + * Fija el valor de maxbaseratecatalog + * + * @param pMaxbaseratecatalog nuevo Valor de maxbaseratecatalog + */ + public void setMaxbaseratecatalog(String pMaxbaseratecatalog) { + this.maxbaseratecatalog = pMaxbaseratecatalog; + } + + /** + * Obtiene el valor de maxbaseratecatalogcode + * + * @return valor de maxbaseratecatalogcode + */ + public String getMaxbaseratecatalogcode() { + return this.maxbaseratecatalogcode; + } + + /** + * Fija el valor de maxbaseratecatalogcode + * + * @param pMaxbaseratecatalogcode nuevo Valor de maxbaseratecatalogcode + */ + public void setMaxbaseratecatalogcode(String pMaxbaseratecatalogcode) { + this.maxbaseratecatalogcode = pMaxbaseratecatalogcode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneSubProductRate)) { + return false; + } + TgeneSubProductRate that = (TgeneSubProductRate) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneSubProductRate + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneSubProductRate */ + @Override + public Object createInstance() { + TgeneSubProductRate instance = new TgeneSubProductRate(); + instance.setPk(new TgeneSubProductRateKey()); + return instance; + } + + /** + * Clona la entidad TgeneSubProductRate + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneSubProductRate p = (TgeneSubProductRate) this.clone(); + p.setPk((TgeneSubProductRateKey) this.pk.cloneMe()); + return p; + } + + // Metodos manuales. + public boolean equalsWithoutSequence(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneSubProductRate)) { + return false; + } + TgeneSubProductRate that = (TgeneSubProductRate) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + + TgeneSubProductRateKey thispk = this.getPk(); + TgeneSubProductRateKey thatpk = that.getPk(); + + if (thatpk == null) { + return false; + } + if (!(thatpk instanceof TgeneSubProductRateKey)) { + return false; + } + if ((thispk.getModulecode() == null) || (thatpk.getModulecode() == null)) { + return false; + } + if (!thispk.getModulecode().equals(thatpk.getModulecode())) { + return false; + } + if ((thispk.getProductcode() == null) || (thatpk.getProductcode() == null)) { + return false; + } + if (!thispk.getProductcode().equals(thatpk.getProductcode())) { + return false; + } + if ((thispk.getSubproductcode() == null) || (thatpk.getSubproductcode() == null)) { + return false; + } + if (!thispk.getSubproductcode().equals(thatpk.getSubproductcode())) { + return false; + } + if ((thispk.getCurrencycode() == null) || (thatpk.getCurrencycode() == null)) { + return false; + } + if (!thispk.getCurrencycode().equals(thatpk.getCurrencycode())) { + return false; + } + if ((thispk.getInterestbalancetype() == null) || (thatpk.getInterestbalancetype() == null)) { + return false; + } + if (!thispk.getInterestbalancetype().equals(thatpk.getInterestbalancetype())) { + return false; + } + if ((thispk.getCompanycode() == null) || (thatpk.getCompanycode() == null)) { + return false; + } + if (!thispk.getCompanycode().equals(thatpk.getCompanycode())) { + return false; + } + if ((thispk.getInterestbalancegroup() == null) || (thatpk.getInterestbalancegroup() == null)) { + return false; + } + if (!thispk.getInterestbalancegroup().equals(thatpk.getInterestbalancegroup())) { + return false; + } + + return true; + } + + /** Sentencia que devuelve una lista de TgeneSubPproductRate. */ + private static final String HQL_SUBPRODUCT_RATE = "from TgeneSubProductRate tsubprate " + + " where tsubprate.pk.interestbalancetype = :interestbalancetype " + " and tsubprate.pk.interestbalancegroup = :interestbalancegroup " + + " and tsubprate.pk.modulecode = :modulecode " + " and tsubprate.pk.productcode = :productcode " + + " and tsubprate.pk.subproductcode = :subproductcode " + " and tsubprate.pk.companycode = :companycode " + + " and tsubprate.pk.currencycode = :currencycode "; + + /** + * Metodo que entrega una lista de tasas definidas por subproducto compania. + * + * @param pEntityManager Referencia a la session de la base de datos. + * @param pInterestbalancetype Tipo de saldo. + * @param pInterestbalancegroup Grupo de balance. + * @param pModule Codigo de modulo. + * @param pProduct Codigo de producto. + * @param pSubProduct Codigo de subproducto. + * @param pCompany Codigo de compania. + * @param pCurrency Codigo de moneda. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static final List find(EntityManager pEntityManager, String pInterestbalancetype, String pInterestbalancegroup, + String pModule, String pProduct, String pSubProduct, Integer pCompany, String pCurrency) throws Exception { + List lRates = null; + Query qry = pEntityManager.createQuery(TgeneSubProductRate.HQL_SUBPRODUCT_RATE); + qry.setParameter("interestbalancetype", pInterestbalancetype); + qry.setParameter("interestbalancegroup", pInterestbalancegroup); + qry.setParameter("modulecode", pModule); + qry.setParameter("productcode", pProduct); + qry.setParameter("subproductcode", pSubProduct); + qry.setParameter("companycode", pCompany); + qry.setParameter("currencycode", pCurrency); + lRates = qry.getResultList(); + return lRates; + } + + /** Sentencia que devuelve un registro de TgeneSubProductCharges. */ + private static final String JQL_RATES = "from TgeneSubProductRate tsubpchar " + " where tsubpchar.pk.modulecode = :modulecode " + + " and tsubpchar.pk.productcode = :productcode " + " and tsubpchar.pk.subproductcode = :subproductcode " + + " and tsubpchar.pk.currencycode = :currencycode " + " and tsubpchar.pk.companycode = :companycode "; + + /** + * + * @param pEntityManager + * @param pModuleCode + * @param pProduct + * @param pSubProduct + * @return + * @throws Exception + */ + + @SuppressWarnings("unchecked") + public static final List find(EntityManager pEntityManager, String pModuleCode, String pProduct, String pSubProduct, + String pCurrencyCode, Integer pCompanyCode) throws Exception { + Query qry = pEntityManager.createQuery(TgeneSubProductRate.JQL_RATES); + qry.setParameter("modulecode", pModuleCode); + qry.setParameter("productcode", pProduct); + qry.setParameter("subproductcode", pSubProduct); + qry.setParameter("currencycode", pCurrencyCode); + qry.setParameter("companycode", pCompanyCode); + + return qry.getResultList(); + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductRateKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductRateKey.java.svn-base new file mode 100644 index 0000000..e499be1 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/.svn/text-base/TgeneSubProductRateKey.java.svn-base @@ -0,0 +1,286 @@ +package com.fp.persistence.pgeneral.product.rate; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESUBPRODUCTRATE*/ +@Embeddable +public class TgeneSubProductRateKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="INTERESTBALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo de interes a calcular. +*/ +private String interestbalancetype; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="INTERESTBALANCEGROUP", nullable=false,updatable=false) + +/** +* Cdigo de grupo de balance del tipo de saldo. +*/ +private String interestbalancegroup; + +@Column(name="RATESEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia para las tasas por subproducto +*/ +private Integer ratesequence; + +/**Contructor por defecto*/ +public TgeneSubProductRateKey(){} +/**Contructor de TgeneSubProductRateKey +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pCurrencycode Codigo de moneda +@param pInterestbalancetype Cdigo de tipo de saldo de interes a calcular. +@param pCompanycode Codigo de compania +@param pInterestbalancegroup Cdigo de grupo de balance del tipo de saldo. +@param pRatesequence Secuencia para las tasas por subproducto +*/ +public TgeneSubProductRateKey(String pModulecode,String pProductcode,String pSubproductcode,String pCurrencycode,String pInterestbalancetype,Integer pCompanycode,String pInterestbalancegroup,Integer pRatesequence){ + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + currencycode=pCurrencycode; + interestbalancetype=pInterestbalancetype; + companycode=pCompanycode; + interestbalancegroup=pInterestbalancegroup; + ratesequence=pRatesequence; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de interestbalancetype +@return valor de interestbalancetype*/ +public String getInterestbalancetype(){ + return interestbalancetype; +} +/**Fija el valor de interestbalancetype +@param pInterestbalancetype nuevo Valor de interestbalancetype*/ +public void setInterestbalancetype(String pInterestbalancetype){ + interestbalancetype=pInterestbalancetype; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de interestbalancegroup +@return valor de interestbalancegroup*/ +public String getInterestbalancegroup(){ + return interestbalancegroup; +} +/**Fija el valor de interestbalancegroup +@param pInterestbalancegroup nuevo Valor de interestbalancegroup*/ +public void setInterestbalancegroup(String pInterestbalancegroup){ + interestbalancegroup=pInterestbalancegroup; +} + +/**Obtiene el valor de ratesequence +@return valor de ratesequence*/ +public Integer getRatesequence(){ + return ratesequence; +} +/**Fija el valor de ratesequence +@param pRatesequence nuevo Valor de ratesequence*/ +public void setRatesequence(Integer pRatesequence){ + ratesequence=pRatesequence; +} + +/**Implementacion de la comparacion de TgeneSubProductRateKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSubProductRateKey))return false; + TgeneSubProductRateKey that = (TgeneSubProductRateKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getInterestbalancetype() == null || that.getInterestbalancetype() == null){ + return false; + } + if (! this.getInterestbalancetype().equals(that.getInterestbalancetype())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getInterestbalancegroup() == null || that.getInterestbalancegroup() == null){ + return false; + } + if (! this.getInterestbalancegroup().equals(that.getInterestbalancegroup())){ + return false; + } + if (this.getRatesequence() == null || that.getRatesequence() == null){ + return false; + } + if (! this.getRatesequence().equals(that.getRatesequence())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneSubProductRateKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getInterestbalancetype() == null ? 0 : this.getInterestbalancetype().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getInterestbalancegroup() == null ? 0 : this.getInterestbalancegroup().hashCode()); + result = result * 37 + (this.getRatesequence() == null ? 0 : this.getRatesequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneBaseRate.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneBaseRate.java new file mode 100644 index 0000000..948c1a4 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneBaseRate.java @@ -0,0 +1,121 @@ +package com.fp.persistence.pgeneral.product.rate; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEBASERATE*/ +@Entity(name="TgeneBaseRate") +@Table(name="TGENEBASERATE") +public class TgeneBaseRate extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneBaseRate +*/ +@EmbeddedId +private TgeneBaseRateKey pk; +/**Contructor por defecto*/ +public TgeneBaseRate(){ +} +/**Contructor de TgeneBaseRate +@param pPk Clave Primaria del entity +*/ +public TgeneBaseRate(TgeneBaseRateKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneBaseRate +*/ +public static TgeneBaseRate find(EntityManager pEntityManager,TgeneBaseRateKey pKey) throws Exception{ + TgeneBaseRate obj = pEntityManager.find(TgeneBaseRate.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneBaseRate +@return El objeto que referencia a la Clave primaria de TgeneBaseRate +*/ +public TgeneBaseRateKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneBaseRate +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneBaseRate +*/ +public void setPk(TgeneBaseRateKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneBaseRate))return false; + TgeneBaseRate that = (TgeneBaseRate) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneBaseRate +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneBaseRate +*/ +public Object createInstance(){ + TgeneBaseRate instance=new TgeneBaseRate(); + instance.setPk(new TgeneBaseRateKey()); + return instance; +} +/**Clona la entidad TgeneBaseRate +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneBaseRate p=(TgeneBaseRate)this.clone(); + p.setPk((TgeneBaseRateKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneBaseRateDetail.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneBaseRateDetail.java new file mode 100644 index 0000000..5f7907b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneBaseRateDetail.java @@ -0,0 +1,404 @@ +package com.fp.persistence.pgeneral.product.rate; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; +import javax.persistence.GeneratedValue; +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENEBASERATEDETAIL + */ +@Entity(name = "TgeneBaseRateDetail") +@Table(name = "TGENEBASERATEDETAIL") +public class TgeneBaseRateDetail extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Cache, Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneBaseRateDetail + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(RATESEQUENCE),0)+1 from TGENEBASERATEDETAIL where BASERATECATALOG=:baseratecatalog and BASERATECATALOGCODE=:baseratecatalogcode and CURRENCYCODE=:currencycode"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "baseratecatalog,pk.baseratecatalog;baseratecatalogcode,pk.baseratecatalogcode;currencycode,pk.currencycode"), + @Parameter(name = "field", value = "ratesequence")}) + @GeneratedValue(generator = "seq_id") + private TgeneBaseRateDetailKey pk; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Manejo de optimistic locking + */ + private Integer recordversion; + @Column(name = "RATE", nullable = true) + /** + * Tasa asociada + */ + private BigDecimal rate; + @Column(name = "NOMINALRATE", nullable = false) + /** + * Y, Indica que el tipo de tasa referencial es nominal, N el tipo de tasa + * es efectiva. + */ + private String nominalrate; + @Column(name = "VALIDITYRATE", nullable = false) + /** + * Fecha desde la cual esta vigente la defincion de la tasa base. + */ + private Date validityrate; + @Column(name = "EXPIRATIONDATE", nullable = false) + /** + * Fecha hasta la cual esta vigente la definicion de la tasa base. + */ + private Date expirationdate; + + /** + * Contructor por defecto + */ + public TgeneBaseRateDetail() { + } + + /** + * Contructor de TgeneBaseRateDetail + * + * @param pPk Clave Primaria del entity + * @param pNominalrate Y, Indica que el tipo de tasa referencial es nominal, + * N el tipo de tasa es efectiva. + * @param pValidityrate Fecha desde la cual esta vigente la defincion de la + * tasa base. + * @param pExpirationdate Fecha hasta la cual esta vigente la definicion de + * la tasa base. + */ + public TgeneBaseRateDetail(TgeneBaseRateDetailKey pPk, String pNominalrate, Date pValidityrate, Date pExpirationdate) { + this(); + this.pk = pPk; + this.nominalrate = pNominalrate; + this.validityrate = pValidityrate; + this.expirationdate = pExpirationdate; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneBaseRateDetail + */ + public static TgeneBaseRateDetail find(EntityManager pEntityManager, TgeneBaseRateDetailKey pKey) throws Exception { + TgeneBaseRateDetail obj = pEntityManager.find(TgeneBaseRateDetail.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneBaseRateDetail + * + * @return El objeto que referencia a la Clave primaria de + * TgeneBaseRateDetail + */ + public TgeneBaseRateDetailKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneBaseRateDetail + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TgeneBaseRateDetail + */ + public void setPk(TgeneBaseRateDetailKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de rate + * + * @return valor de rate + */ + public BigDecimal getRate() { + return this.rate; + } + + /** + * Fija el valor de rate + * + * @param pRate nuevo Valor de rate + */ + public void setRate(BigDecimal pRate) { + this.rate = pRate; + } + + /** + * Obtiene el valor de nominalrate + * + * @return valor de nominalrate + */ + public String getNominalrate() { + return this.nominalrate; + } + + /** + * Fija el valor de nominalrate + * + * @param pNominalrate nuevo Valor de nominalrate + */ + public void setNominalrate(String pNominalrate) { + this.nominalrate = pNominalrate; + } + + /** + * Obtiene el valor de validityrate + * + * @return valor de validityrate + */ + public Date getValidityrate() { + return this.validityrate; + } + + /** + * Fija el valor de validityrate + * + * @param pValidityrate nuevo Valor de validityrate + */ + public void setValidityrate(Date pValidityrate) { + this.validityrate = pValidityrate; + } + + /** + * Obtiene el valor de expirationdate + * + * @return valor de expirationdate + */ + public Date getExpirationdate() { + return this.expirationdate; + } + + /** + * Fija el valor de expirationdate + * + * @param pExpirationdate nuevo Valor de expirationdate + */ + public void setExpirationdate(Date pExpirationdate) { + this.expirationdate = pExpirationdate; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneBaseRateDetail)) { + return false; + } + TgeneBaseRateDetail that = (TgeneBaseRateDetail) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneBaseRateDetail + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacion toString + */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacion de la creacion de un bean en blanco TgeneBaseRateDetail + */ + @Override + public Object createInstance() { + TgeneBaseRateDetail instance = new TgeneBaseRateDetail(); + instance.setPk(new TgeneBaseRateDetailKey()); + return instance; + } + + /** + * Clona la entidad TgeneBaseRateDetail + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneBaseRateDetail p = (TgeneBaseRateDetail) this.clone(); + p.setPk((TgeneBaseRateDetailKey) this.pk.cloneMe()); + return p; + } + + // METODOS MANUALES + public boolean equalsWithoutRateSequence(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneBaseRateDetail)) { + return false; + } + TgeneBaseRateDetail that = (TgeneBaseRateDetail) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + // Validacion de claves primarias + TgeneBaseRateDetailKey thatpk = that.getPk(); + TgeneBaseRateDetailKey thispk = this.getPk(); + + if (thatpk == null) { + return false; + } + if (!(thatpk instanceof TgeneBaseRateDetailKey)) { + return false; + } + if ((thispk.getBaseratecatalog() == null) || (thatpk.getBaseratecatalog() == null)) { + return false; + } + if (!thispk.getBaseratecatalog().equals(thatpk.getBaseratecatalog())) { + return false; + } + if ((thispk.getBaseratecatalogcode() == null) || (thatpk.getBaseratecatalogcode() == null)) { + return false; + } + if (!thispk.getBaseratecatalogcode().equals(thatpk.getBaseratecatalogcode())) { + return false; + } + if ((thispk.getCurrencycode() == null) || (thatpk.getCurrencycode() == null)) { + return false; + } + if (!thispk.getCurrencycode().equals(thatpk.getCurrencycode())) { + return false; + } + + return true; + } + private static final String JPQL_RATEDETAIL = " from TgeneBaseRateDetail tdet " + " where tdet.pk.currencycode = :currencycode " + + " and tdet.pk.baseratecatalog = :baseratecatalog" + " and tdet.pk.baseratecatalogcode = :baseratecatalogcode"; + + /** + * Metodo que entrega una lista de datos requeridos de clientes por + * producto. + * + * @param pModuleCode Codigo de modulo. + * @param pProductCode Codigo de producto. + * @param pSubproductCode Codigo de subproducto. + * @param pPersontype Tipo de persona. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String currencycode, String baseratecatalog, String baseratecatalogcode) + throws Exception { + List ldata = null; + Query qry = pEntityManager.createQuery(TgeneBaseRateDetail.JPQL_RATEDETAIL); + qry.setParameter("currencycode", currencycode); + qry.setParameter("baseratecatalog", baseratecatalog); + qry.setParameter("baseratecatalogcode", baseratecatalogcode); + ldata = qry.getResultList(); + return ldata; + } + private static final String JPQL_RATEDETAIL_VIGENTS = " from TgeneBaseRateDetail tdet " + " where tdet.pk.currencycode = :currencycode " + + " and tdet.pk.baseratecatalog = :baseratecatalog" + + " and tdet.pk.baseratecatalogcode = :baseratecatalogcode and tdet.expirationdate>=:workingdate"; + + /** + * Metodo que entrega una lista de datos requeridos de clientes por + * producto. + * + * @param pModuleCode Codigo de modulo. + * @param pProductCode Codigo de producto. + * @param pSubproductCode Codigo de subproducto. + * @param pPersontype Tipo de persona. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findVigents(EntityManager pEntityManager, String currencycode, String baseratecatalog, + String baseratecatalogcode, Date workingdate) throws Exception { + Query qry = pEntityManager.createQuery(TgeneBaseRateDetail.JPQL_RATEDETAIL_VIGENTS); + qry.setParameter("currencycode", currencycode); + qry.setParameter("baseratecatalog", baseratecatalog); + qry.setParameter("baseratecatalogcode", baseratecatalogcode); + qry.setParameter("workingdate", workingdate); + return qry.getResultList(); + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneBaseRateDetailKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneBaseRateDetailKey.java new file mode 100644 index 0000000..2ffc5b0 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneBaseRateDetailKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.product.rate; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEBASERATEDETAIL*/ +@Embeddable +public class TgeneBaseRateDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="BASERATECATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo de tasas base, BCE tasa banco central +*/ +private String baseratecatalog; + +@Column(name="BASERATECATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo BASERATE +*/ +private String baseratecatalogcode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="RATESEQUENCE", nullable=false,updatable=false) + +/** +* null +*/ +private Integer ratesequence; + +/**Contructor por defecto*/ +public TgeneBaseRateDetailKey(){} +/**Contructor de TgeneBaseRateDetailKey +@param pBaseratecatalog Codigo de catalogo de tasas base, BCE tasa banco central +@param pBaseratecatalogcode Codigo de tabla de catalogo BASERATE +@param pCurrencycode Codigo de moneda +@param pRatesequence null +*/ +public TgeneBaseRateDetailKey(String pBaseratecatalog,String pBaseratecatalogcode,String pCurrencycode,Integer pRatesequence){ + baseratecatalog=pBaseratecatalog; + baseratecatalogcode=pBaseratecatalogcode; + currencycode=pCurrencycode; + ratesequence=pRatesequence; +} +/**Obtiene el valor de baseratecatalog +@return valor de baseratecatalog*/ +public String getBaseratecatalog(){ + return baseratecatalog; +} +/**Fija el valor de baseratecatalog +@param pBaseratecatalog nuevo Valor de baseratecatalog*/ +public void setBaseratecatalog(String pBaseratecatalog){ + baseratecatalog=pBaseratecatalog; +} + +/**Obtiene el valor de baseratecatalogcode +@return valor de baseratecatalogcode*/ +public String getBaseratecatalogcode(){ + return baseratecatalogcode; +} +/**Fija el valor de baseratecatalogcode +@param pBaseratecatalogcode nuevo Valor de baseratecatalogcode*/ +public void setBaseratecatalogcode(String pBaseratecatalogcode){ + baseratecatalogcode=pBaseratecatalogcode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de ratesequence +@return valor de ratesequence*/ +public Integer getRatesequence(){ + return ratesequence; +} +/**Fija el valor de ratesequence +@param pRatesequence nuevo Valor de ratesequence*/ +public void setRatesequence(Integer pRatesequence){ + ratesequence=pRatesequence; +} + +/**Implementacion de la comparacion de TgeneBaseRateDetailKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneBaseRateDetailKey))return false; + TgeneBaseRateDetailKey that = (TgeneBaseRateDetailKey) o; + if (this.getBaseratecatalog() == null || that.getBaseratecatalog() == null){ + return false; + } + if (! this.getBaseratecatalog().equals(that.getBaseratecatalog())){ + return false; + } + if (this.getBaseratecatalogcode() == null || that.getBaseratecatalogcode() == null){ + return false; + } + if (! this.getBaseratecatalogcode().equals(that.getBaseratecatalogcode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getRatesequence() == null || that.getRatesequence() == null){ + return false; + } + if (! this.getRatesequence().equals(that.getRatesequence())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneBaseRateDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getBaseratecatalog() == null ? 0 : this.getBaseratecatalog().hashCode()); + result = result * 37 + (this.getBaseratecatalogcode() == null ? 0 : this.getBaseratecatalogcode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getRatesequence() == null ? 0 : this.getRatesequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneBaseRateKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneBaseRateKey.java new file mode 100644 index 0000000..eefa4fa --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneBaseRateKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.product.rate; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEBASERATE*/ +@Embeddable +public class TgeneBaseRateKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="BASERATECATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo de tasas base, BCE tasa banco central +*/ +private String baseratecatalog; + +@Column(name="BASERATECATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo BASERATE +*/ +private String baseratecatalogcode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +/**Contructor por defecto*/ +public TgeneBaseRateKey(){} +/**Contructor de TgeneBaseRateKey +@param pBaseratecatalog Codigo de catalogo de tasas base, BCE tasa banco central +@param pBaseratecatalogcode Codigo de tabla de catalogo BASERATE +@param pCurrencycode Codigo de moneda +*/ +public TgeneBaseRateKey(String pBaseratecatalog,String pBaseratecatalogcode,String pCurrencycode){ + baseratecatalog=pBaseratecatalog; + baseratecatalogcode=pBaseratecatalogcode; + currencycode=pCurrencycode; +} +/**Obtiene el valor de baseratecatalog +@return valor de baseratecatalog*/ +public String getBaseratecatalog(){ + return baseratecatalog; +} +/**Fija el valor de baseratecatalog +@param pBaseratecatalog nuevo Valor de baseratecatalog*/ +public void setBaseratecatalog(String pBaseratecatalog){ + baseratecatalog=pBaseratecatalog; +} + +/**Obtiene el valor de baseratecatalogcode +@return valor de baseratecatalogcode*/ +public String getBaseratecatalogcode(){ + return baseratecatalogcode; +} +/**Fija el valor de baseratecatalogcode +@param pBaseratecatalogcode nuevo Valor de baseratecatalogcode*/ +public void setBaseratecatalogcode(String pBaseratecatalogcode){ + baseratecatalogcode=pBaseratecatalogcode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Implementacion de la comparacion de TgeneBaseRateKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneBaseRateKey))return false; + TgeneBaseRateKey that = (TgeneBaseRateKey) o; + if (this.getBaseratecatalog() == null || that.getBaseratecatalog() == null){ + return false; + } + if (! this.getBaseratecatalog().equals(that.getBaseratecatalog())){ + return false; + } + if (this.getBaseratecatalogcode() == null || that.getBaseratecatalogcode() == null){ + return false; + } + if (! this.getBaseratecatalogcode().equals(that.getBaseratecatalogcode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneBaseRateKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getBaseratecatalog() == null ? 0 : this.getBaseratecatalog().hashCode()); + result = result * 37 + (this.getBaseratecatalogcode() == null ? 0 : this.getBaseratecatalogcode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneRatesGroup.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneRatesGroup.java new file mode 100644 index 0000000..c7b8346 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneRatesGroup.java @@ -0,0 +1,254 @@ +package com.fp.persistence.pgeneral.product.rate; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENERATESGROUP*/ +@Entity(name="TgeneRatesGroup") +@Table(name="TGENERATESGROUP") +public class TgeneRatesGroup extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneRatesGroup +*/ +@EmbeddedId +private TgeneRatesGroupKey pk; +@Column(name="BASERATECATALOG", nullable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String baseratecatalog; + +@Column(name="BASERATECATALOGCODE", nullable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String baseratecatalogcode; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking +*/ +private Integer recordversion; + +@Column(name="MAXTERM", nullable=true) + +/** +* Plazo maximo +*/ +private Integer maxterm; + +@Column(name="MAXAMOUNT", nullable=true) + +/** +* Monto Maximo +*/ +private BigDecimal maxamount; + +@Column(name="MARGIN", nullable=true) + +/** +* Margen a aplicar dado el operador +*/ +private BigDecimal margin; + +@Column(name="OPERATOR", nullable=true) + +/** +* Operador a aplicar sobre la tasa base, +, - , % +*/ +private String operator; + +/**Contructor por defecto*/ +public TgeneRatesGroup(){ +} +/**Contructor de TgeneRatesGroup +@param pPk Clave Primaria del entity +@param pBaseratecatalog Codigo de catalogo 01 Natural, 02 Juridico +@param pBaseratecatalogcode Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +public TgeneRatesGroup(TgeneRatesGroupKey pPk,String pBaseratecatalog,String pBaseratecatalogcode){ + this(); + pk=pPk; + baseratecatalog=pBaseratecatalog; + baseratecatalogcode=pBaseratecatalogcode; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneRatesGroup +*/ +public static TgeneRatesGroup find(EntityManager pEntityManager,TgeneRatesGroupKey pKey) throws Exception{ + TgeneRatesGroup obj = pEntityManager.find(TgeneRatesGroup.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneRatesGroup +@return El objeto que referencia a la Clave primaria de TgeneRatesGroup +*/ +public TgeneRatesGroupKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneRatesGroup +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneRatesGroup +*/ +public void setPk(TgeneRatesGroupKey pPk){ + pk=pPk; +} +/**Obtiene el valor de baseratecatalog +@return valor de baseratecatalog*/ +public String getBaseratecatalog(){ + return baseratecatalog; +} +/**Fija el valor de baseratecatalog +@param pBaseratecatalog nuevo Valor de baseratecatalog*/ +public void setBaseratecatalog(String pBaseratecatalog){ + baseratecatalog=pBaseratecatalog; +} + +/**Obtiene el valor de baseratecatalogcode +@return valor de baseratecatalogcode*/ +public String getBaseratecatalogcode(){ + return baseratecatalogcode; +} +/**Fija el valor de baseratecatalogcode +@param pBaseratecatalogcode nuevo Valor de baseratecatalogcode*/ +public void setBaseratecatalogcode(String pBaseratecatalogcode){ + baseratecatalogcode=pBaseratecatalogcode; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de maxterm +@return valor de maxterm*/ +public Integer getMaxterm(){ + return maxterm; +} +/**Fija el valor de maxterm +@param pMaxterm nuevo Valor de maxterm*/ +public void setMaxterm(Integer pMaxterm){ + maxterm=pMaxterm; +} + +/**Obtiene el valor de maxamount +@return valor de maxamount*/ +public BigDecimal getMaxamount(){ + return maxamount; +} +/**Fija el valor de maxamount +@param pMaxamount nuevo Valor de maxamount*/ +public void setMaxamount(BigDecimal pMaxamount){ + maxamount=pMaxamount; +} + +/**Obtiene el valor de margin +@return valor de margin*/ +public BigDecimal getMargin(){ + return margin; +} +/**Fija el valor de margin +@param pMargin nuevo Valor de margin*/ +public void setMargin(BigDecimal pMargin){ + margin=pMargin; +} + +/**Obtiene el valor de operator +@return valor de operator*/ +public String getOperator(){ + return operator; +} +/**Fija el valor de operator +@param pOperator nuevo Valor de operator*/ +public void setOperator(String pOperator){ + operator=pOperator; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneRatesGroup))return false; + TgeneRatesGroup that = (TgeneRatesGroup) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneRatesGroup +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneRatesGroup +*/ +public Object createInstance(){ + TgeneRatesGroup instance=new TgeneRatesGroup(); + instance.setPk(new TgeneRatesGroupKey()); + return instance; +} +/**Clona la entidad TgeneRatesGroup +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneRatesGroup p=(TgeneRatesGroup)this.clone(); + p.setPk((TgeneRatesGroupKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneRatesGroupKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneRatesGroupKey.java new file mode 100644 index 0000000..d00f405 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneRatesGroupKey.java @@ -0,0 +1,287 @@ +package com.fp.persistence.pgeneral.product.rate; + +import javax.persistence.Column; +import java.io.Serializable; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENERATESGROUP*/ +@Embeddable +public class TgeneRatesGroupKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="INTERESTBALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String interestbalancetype; + +@Column(name="INTERESTBALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String interestbalancegroup; + +@Column(name="RATECATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo VIP, EMP empleado +*/ +private String ratecatalog; + +@Column(name="RATECATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo de grupo de tasas RATES +*/ +private String ratecatalogcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="MINTERM", nullable=false,updatable=false) + +/** +* Plazo minnimo +*/ +private Integer minterm; + +@Column(name="MINAMOUNT", nullable=false,updatable=false) + +/** +* Monto minimo +*/ +private BigDecimal minamount; + +/**Contructor por defecto*/ +public TgeneRatesGroupKey(){} +/**Contructor de TgeneRatesGroupKey +@param pInterestbalancetype Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pInterestbalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +@param pRatecatalog Codigo de catalogo VIP, EMP empleado +@param pRatecatalogcode Codigo de tabla de catalogo de grupo de tasas RATES +@param pCompanycode Codigo de compania +@param pCurrencycode Codigo de moneda +@param pMinterm Plazo minnimo +@param pMinamount Monto minimo +*/ +public TgeneRatesGroupKey(String pInterestbalancetype,String pInterestbalancegroup,String pRatecatalog,String pRatecatalogcode,Integer pCompanycode,String pCurrencycode,Integer pMinterm,BigDecimal pMinamount){ + interestbalancetype=pInterestbalancetype; + interestbalancegroup=pInterestbalancegroup; + ratecatalog=pRatecatalog; + ratecatalogcode=pRatecatalogcode; + companycode=pCompanycode; + currencycode=pCurrencycode; + minterm=pMinterm; + minamount=pMinamount; +} +/**Obtiene el valor de interestbalancetype +@return valor de interestbalancetype*/ +public String getInterestbalancetype(){ + return interestbalancetype; +} +/**Fija el valor de interestbalancetype +@param pInterestbalancetype nuevo Valor de interestbalancetype*/ +public void setInterestbalancetype(String pInterestbalancetype){ + interestbalancetype=pInterestbalancetype; +} + +/**Obtiene el valor de interestbalancegroup +@return valor de interestbalancegroup*/ +public String getInterestbalancegroup(){ + return interestbalancegroup; +} +/**Fija el valor de interestbalancegroup +@param pInterestbalancegroup nuevo Valor de interestbalancegroup*/ +public void setInterestbalancegroup(String pInterestbalancegroup){ + interestbalancegroup=pInterestbalancegroup; +} + +/**Obtiene el valor de ratecatalog +@return valor de ratecatalog*/ +public String getRatecatalog(){ + return ratecatalog; +} +/**Fija el valor de ratecatalog +@param pRatecatalog nuevo Valor de ratecatalog*/ +public void setRatecatalog(String pRatecatalog){ + ratecatalog=pRatecatalog; +} + +/**Obtiene el valor de ratecatalogcode +@return valor de ratecatalogcode*/ +public String getRatecatalogcode(){ + return ratecatalogcode; +} +/**Fija el valor de ratecatalogcode +@param pRatecatalogcode nuevo Valor de ratecatalogcode*/ +public void setRatecatalogcode(String pRatecatalogcode){ + ratecatalogcode=pRatecatalogcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de minterm +@return valor de minterm*/ +public Integer getMinterm(){ + return minterm; +} +/**Fija el valor de minterm +@param pMinterm nuevo Valor de minterm*/ +public void setMinterm(Integer pMinterm){ + minterm=pMinterm; +} + +/**Obtiene el valor de minamount +@return valor de minamount*/ +public BigDecimal getMinamount(){ + return minamount; +} +/**Fija el valor de minamount +@param pMinamount nuevo Valor de minamount*/ +public void setMinamount(BigDecimal pMinamount){ + minamount=pMinamount; +} + +/**Implementacin de la comparacin de TgeneRatesGroupKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneRatesGroupKey))return false; + TgeneRatesGroupKey that = (TgeneRatesGroupKey) o; + if (this.getInterestbalancetype() == null || that.getInterestbalancetype() == null){ + return false; + } + if (! this.getInterestbalancetype().equals(that.getInterestbalancetype())){ + return false; + } + if (this.getInterestbalancegroup() == null || that.getInterestbalancegroup() == null){ + return false; + } + if (! this.getInterestbalancegroup().equals(that.getInterestbalancegroup())){ + return false; + } + if (this.getRatecatalog() == null || that.getRatecatalog() == null){ + return false; + } + if (! this.getRatecatalog().equals(that.getRatecatalog())){ + return false; + } + if (this.getRatecatalogcode() == null || that.getRatecatalogcode() == null){ + return false; + } + if (! this.getRatecatalogcode().equals(that.getRatecatalogcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getMinterm() == null || that.getMinterm() == null){ + return false; + } + if (! this.getMinterm().equals(that.getMinterm())){ + return false; + } + if (this.getMinamount() == null || that.getMinamount() == null){ + return false; + } + if (! this.getMinamount().equals(that.getMinamount())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneRatesGroupKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getInterestbalancetype() == null ? 0 : this.getInterestbalancetype().hashCode()); + result = result * 37 + (this.getInterestbalancegroup() == null ? 0 : this.getInterestbalancegroup().hashCode()); + result = result * 37 + (this.getRatecatalog() == null ? 0 : this.getRatecatalog().hashCode()); + result = result * 37 + (this.getRatecatalogcode() == null ? 0 : this.getRatecatalogcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getMinterm() == null ? 0 : this.getMinterm().hashCode()); + result = result * 37 + (this.getMinamount() == null ? 0 : this.getMinamount().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSegmentRate.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSegmentRate.java new file mode 100644 index 0000000..367b859 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSegmentRate.java @@ -0,0 +1,377 @@ +package com.fp.persistence.pgeneral.product.rate; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.util.List; +import javax.persistence.Query; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESEGMENTRATE*/ +@Entity(name = "TgeneSegmentRate") +@Table(name = "TGENESEGMENTRATE") +public class TgeneSegmentRate extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneSegmentRate + */ + @EmbeddedId + private TgeneSegmentRateKey pk; + @Column(name = "BASERATECATALOG", nullable = false) + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String baseratecatalog; + @Column(name = "BASERATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String baseratecatalogcode; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Manejo de optimistic locking + */ + private Integer recordversion; + @Column(name = "MAXTERM", nullable = false) + /** + * Plazo maximo + */ + private Integer maxterm; + @Column(name = "MAXAMOUNT", nullable = true) + /** + * Monto Maximo + */ + private BigDecimal maxamount; + @Column(name = "MARGIN", nullable = true) + /** + * Margen a aplicar dado el operador + */ + private BigDecimal margin; + @Column(name = "OPERATOR", nullable = true) + /** + * Operador a aplicar sobre la tasa base, +, - , % + */ + private String operator; + @Column(name = "READJUSTMENTOPERATOR", nullable = true) + /** + * Operador que se utilizara el momento del reajuste + */ + private String readjustmentoperator; + @Column(name = "READJUSTMENTMARGIN", nullable = true) + /** + * Margen a aplicar en el reajuste + */ + private BigDecimal readjustmentmargin; + @Column(name = "MINRATE", nullable = true) + /** + * Minimo permitido en la negociacion del prestamo + */ + private BigDecimal minrate; + @Column(name = "MAXRATE", nullable = true) + /** + * Maximo permitido en la negociacion del prestamo + */ + private BigDecimal maxrate; + + /**Contructor por defecto*/ + public TgeneSegmentRate() { + } + + /**Contructor de TgeneSegmentRate + @param pPk Clave Primaria del entity + @param pBaseratecatalog Codigo de catalogo 01 Natural, 02 Juridico + @param pMaxterm Plazo maximo + */ + public TgeneSegmentRate(TgeneSegmentRateKey pPk, String pBaseratecatalog, Integer pMaxterm) { + this(); + pk = pPk; + baseratecatalog = pBaseratecatalog; + maxterm = pMaxterm; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSegmentRate + */ + public static TgeneSegmentRate find(EntityManager pEntityManager, TgeneSegmentRateKey pKey) throws Exception { + TgeneSegmentRate obj = pEntityManager.find(TgeneSegmentRate.class, pKey); + return obj; + } + /** + * Mtodos manuales + * INTERESTBALANCETYPE + * interestbalancetype + * INTERESTBALANCEGROUP + * interestbalancegroup + * CREDITSEGMENTCATALOG + * creditsegmentcatalog + */ + private static final String JPQL_SOL_TGENESEGMENTRATE = + " from TgeneSegmentRate tgenesr " + + "where " + + "tgenesr.pk.interestbalancetype = :interestbalancetype and " + + "tgenesr.pk.interestbalancegroup = :interestbalancegroup and " + + "tgenesr.pk.currencycode = :currencycode and " + + "tgenesr.pk.companycode = :companycode and " + + "tgenesr.pk.creditsegmentcatalog = :creditsegmentcatalog and " + + "tgenesr.pk.minterm <= :term and tgenesr.maxterm >= :term and " + + "tgenesr.pk.minamount <= :amount and tgenesr.maxamount >= :amount"; + + /** + * Metodo que entrega datos para consultar el segmento monto plazo y tipo de saldo. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSegmentRate + */ + @SuppressWarnings("unchecked") + public static List findBySegment(EntityManager pEntityManager, String pInterestbalancetype, String pInterestbalancegroup, String pCreditsegmentcatalog, Integer pCompany, String pCurrencycode,Integer pTerm,BigDecimal pAmount) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(TgeneSegmentRate.JPQL_SOL_TGENESEGMENTRATE); + qry.setParameter("interestbalancetype", pInterestbalancetype); + qry.setParameter("interestbalancegroup", pInterestbalancegroup); + qry.setParameter("creditsegmentcatalog", pCreditsegmentcatalog); + qry.setParameter("companycode", pCompany); + qry.setParameter("currencycode", pCurrencycode); + qry.setParameter("term", pTerm); + qry.setParameter("amount", pAmount); + lObjects = qry.getResultList(); + return lObjects; + } + + /**Entrega la Clave primaria de TgeneSegmentRate + @return El objeto que referencia a la Clave primaria de TgeneSegmentRate + */ + public TgeneSegmentRateKey getPk() { + return pk; + } + + /**Fija un nuevo valor a la Clave primaria de TgeneSegmentRate + @param pPk El objeto que referencia a la nueva Clave primaria de TgeneSegmentRate + */ + public void setPk(TgeneSegmentRateKey pPk) { + pk = pPk; + } + + /**Obtiene el valor de baseratecatalog + @return valor de baseratecatalog*/ + public String getBaseratecatalog() { + return baseratecatalog; + } + + /**Fija el valor de baseratecatalog + @param pBaseratecatalog nuevo Valor de baseratecatalog*/ + public void setBaseratecatalog(String pBaseratecatalog) { + baseratecatalog = pBaseratecatalog; + } + + /**Obtiene el valor de baseratecatalogcode + @return valor de baseratecatalogcode*/ + public String getBaseratecatalogcode() { + return baseratecatalogcode; + } + + /**Fija el valor de baseratecatalogcode + @param pBaseratecatalogcode nuevo Valor de baseratecatalogcode*/ + public void setBaseratecatalogcode(String pBaseratecatalogcode) { + baseratecatalogcode = pBaseratecatalogcode; + } + + /**Obtiene el valor de recordversion + @return valor de recordversion*/ + public Integer getRecordversion() { + return recordversion; + } + + /**Fija el valor de recordversion + @param pRecordversion nuevo Valor de recordversion*/ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /**Obtiene el valor de maxterm + @return valor de maxterm*/ + public Integer getMaxterm() { + return maxterm; + } + + /**Fija el valor de maxterm + @param pMaxterm nuevo Valor de maxterm*/ + public void setMaxterm(Integer pMaxterm) { + maxterm = pMaxterm; + } + + /**Obtiene el valor de maxamount + @return valor de maxamount*/ + public BigDecimal getMaxamount() { + return maxamount; + } + + /**Fija el valor de maxamount + @param pMaxamount nuevo Valor de maxamount*/ + public void setMaxamount(BigDecimal pMaxamount) { + maxamount = pMaxamount; + } + + /**Obtiene el valor de margin + @return valor de margin*/ + public BigDecimal getMargin() { + return margin; + } + + /**Fija el valor de margin + @param pMargin nuevo Valor de margin*/ + public void setMargin(BigDecimal pMargin) { + margin = pMargin; + } + + /**Obtiene el valor de operator + @return valor de operator*/ + public String getOperator() { + return operator; + } + + /**Fija el valor de operator + @param pOperator nuevo Valor de operator*/ + public void setOperator(String pOperator) { + operator = pOperator; + } + + /**Obtiene el valor de readjustmentoperator + @return valor de readjustmentoperator*/ + public String getReadjustmentoperator() { + return readjustmentoperator; + } + + /**Fija el valor de readjustmentoperator + @param pReadjustmentoperator nuevo Valor de readjustmentoperator*/ + public void setReadjustmentoperator(String pReadjustmentoperator) { + readjustmentoperator = pReadjustmentoperator; + } + + /**Obtiene el valor de readjustmentmargin + @return valor de readjustmentmargin*/ + public BigDecimal getReadjustmentmargin() { + return readjustmentmargin; + } + + /**Fija el valor de readjustmentmargin + @param pReadjustmentmargin nuevo Valor de readjustmentmargin*/ + public void setReadjustmentmargin(BigDecimal pReadjustmentmargin) { + readjustmentmargin = pReadjustmentmargin; + } + + /**Obtiene el valor de minrate + @return valor de minrate*/ + public BigDecimal getMinrate() { + return minrate; + } + + /**Fija el valor de minrate + @param pMinrate nuevo Valor de minrate*/ + public void setMinrate(BigDecimal pMinrate) { + minrate = pMinrate; + } + + /**Obtiene el valor de maxrate + @return valor de maxrate*/ + public BigDecimal getMaxrate() { + return maxrate; + } + + /**Fija el valor de maxrate + @param pMaxrate nuevo Valor de maxrate*/ + public void setMaxrate(BigDecimal pMaxrate) { + maxrate = pMaxrate; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneSegmentRate)) { + return false; + } + TgeneSegmentRate that = (TgeneSegmentRate) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /**Implementacion del metodo hashCode de la la entidad TgeneSegmentRate + @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /**Implementacion toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /**Implementacion de la creacion de un bean en blanco TgeneSegmentRate + */ + public Object createInstance() { + TgeneSegmentRate instance = new TgeneSegmentRate(); + instance.setPk(new TgeneSegmentRateKey()); + return instance; + } + + /**Clona la entidad TgeneSegmentRate + @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneSegmentRate p = (TgeneSegmentRate) this.clone(); + p.setPk((TgeneSegmentRateKey) this.pk.cloneMe()); + return p; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSegmentRateKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSegmentRateKey.java new file mode 100644 index 0000000..838f16f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSegmentRateKey.java @@ -0,0 +1,287 @@ +package com.fp.persistence.pgeneral.product.rate; + +import javax.persistence.Column; +import java.io.Serializable; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESEGMENTRATE*/ +@Embeddable +public class TgeneSegmentRateKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="INTERESTBALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo de interes a calcular. +*/ +private String interestbalancetype; + +@Column(name="INTERESTBALANCEGROUP", nullable=false,updatable=false) + +/** +* Cdigo de grupo de balance del tipo de saldo. +*/ +private String interestbalancegroup; + +@Column(name="CREDITSEGMENTCATALOG", nullable=false,updatable=false) + +/** +* Segmento asociado al tipo de producto de prestamo +*/ +private String creditsegmentcatalog; + +@Column(name="CREDITSEGMENTCATALOGCODE", nullable=false,updatable=false) + +/** +* Catalogo asociado al segmento de producto de prestamo +*/ +private String creditsegmentcatalogcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="MINTERM", nullable=false,updatable=false) + +/** +* Plazo minnimo +*/ +private Integer minterm; + +@Column(name="MINAMOUNT", nullable=false,updatable=false) + +/** +* Monto minimo +*/ +private BigDecimal minamount; + +/**Contructor por defecto*/ +public TgeneSegmentRateKey(){} +/**Contructor de TgeneSegmentRateKey +@param pInterestbalancetype Cdigo de tipo de saldo de interes a calcular. +@param pInterestbalancegroup Cdigo de grupo de balance del tipo de saldo. +@param pCreditsegmentcatalog Segmento asociado al tipo de producto de prestamo +@param pCreditsegmentcatalogcode Catalogo asociado al segmento de producto de prestamo +@param pCompanycode Codigo de compania +@param pCurrencycode Codigo de moneda +@param pMinterm Plazo minnimo +@param pMinamount Monto minimo +*/ +public TgeneSegmentRateKey(String pInterestbalancetype,String pInterestbalancegroup,String pCreditsegmentcatalog,String pCreditsegmentcatalogcode,Integer pCompanycode,String pCurrencycode,Integer pMinterm,BigDecimal pMinamount){ + interestbalancetype=pInterestbalancetype; + interestbalancegroup=pInterestbalancegroup; + creditsegmentcatalog=pCreditsegmentcatalog; + creditsegmentcatalogcode=pCreditsegmentcatalogcode; + companycode=pCompanycode; + currencycode=pCurrencycode; + minterm=pMinterm; + minamount=pMinamount; +} +/**Obtiene el valor de interestbalancetype +@return valor de interestbalancetype*/ +public String getInterestbalancetype(){ + return interestbalancetype; +} +/**Fija el valor de interestbalancetype +@param pInterestbalancetype nuevo Valor de interestbalancetype*/ +public void setInterestbalancetype(String pInterestbalancetype){ + interestbalancetype=pInterestbalancetype; +} + +/**Obtiene el valor de interestbalancegroup +@return valor de interestbalancegroup*/ +public String getInterestbalancegroup(){ + return interestbalancegroup; +} +/**Fija el valor de interestbalancegroup +@param pInterestbalancegroup nuevo Valor de interestbalancegroup*/ +public void setInterestbalancegroup(String pInterestbalancegroup){ + interestbalancegroup=pInterestbalancegroup; +} + +/**Obtiene el valor de creditsegmentcatalog +@return valor de creditsegmentcatalog*/ +public String getCreditsegmentcatalog(){ + return creditsegmentcatalog; +} +/**Fija el valor de creditsegmentcatalog +@param pCreditsegmentcatalog nuevo Valor de creditsegmentcatalog*/ +public void setCreditsegmentcatalog(String pCreditsegmentcatalog){ + creditsegmentcatalog=pCreditsegmentcatalog; +} + +/**Obtiene el valor de creditsegmentcatalogcode +@return valor de creditsegmentcatalogcode*/ +public String getCreditsegmentcatalogcode(){ + return creditsegmentcatalogcode; +} +/**Fija el valor de creditsegmentcatalogcode +@param pCreditsegmentcatalogcode nuevo Valor de creditsegmentcatalogcode*/ +public void setCreditsegmentcatalogcode(String pCreditsegmentcatalogcode){ + creditsegmentcatalogcode=pCreditsegmentcatalogcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de minterm +@return valor de minterm*/ +public Integer getMinterm(){ + return minterm; +} +/**Fija el valor de minterm +@param pMinterm nuevo Valor de minterm*/ +public void setMinterm(Integer pMinterm){ + minterm=pMinterm; +} + +/**Obtiene el valor de minamount +@return valor de minamount*/ +public BigDecimal getMinamount(){ + return minamount; +} +/**Fija el valor de minamount +@param pMinamount nuevo Valor de minamount*/ +public void setMinamount(BigDecimal pMinamount){ + minamount=pMinamount; +} + +/**Implementacion de la comparacion de TgeneSegmentRateKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSegmentRateKey))return false; + TgeneSegmentRateKey that = (TgeneSegmentRateKey) o; + if (this.getInterestbalancetype() == null || that.getInterestbalancetype() == null){ + return false; + } + if (! this.getInterestbalancetype().equals(that.getInterestbalancetype())){ + return false; + } + if (this.getInterestbalancegroup() == null || that.getInterestbalancegroup() == null){ + return false; + } + if (! this.getInterestbalancegroup().equals(that.getInterestbalancegroup())){ + return false; + } + if (this.getCreditsegmentcatalog() == null || that.getCreditsegmentcatalog() == null){ + return false; + } + if (! this.getCreditsegmentcatalog().equals(that.getCreditsegmentcatalog())){ + return false; + } + if (this.getCreditsegmentcatalogcode() == null || that.getCreditsegmentcatalogcode() == null){ + return false; + } + if (! this.getCreditsegmentcatalogcode().equals(that.getCreditsegmentcatalogcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getMinterm() == null || that.getMinterm() == null){ + return false; + } + if (! this.getMinterm().equals(that.getMinterm())){ + return false; + } + if (this.getMinamount() == null || that.getMinamount() == null){ + return false; + } + if (! this.getMinamount().equals(that.getMinamount())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneSegmentRateKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getInterestbalancetype() == null ? 0 : this.getInterestbalancetype().hashCode()); + result = result * 37 + (this.getInterestbalancegroup() == null ? 0 : this.getInterestbalancegroup().hashCode()); + result = result * 37 + (this.getCreditsegmentcatalog() == null ? 0 : this.getCreditsegmentcatalog().hashCode()); + result = result * 37 + (this.getCreditsegmentcatalogcode() == null ? 0 : this.getCreditsegmentcatalogcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getMinterm() == null ? 0 : this.getMinterm().hashCode()); + result = result * 37 + (this.getMinamount() == null ? 0 : this.getMinamount().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentCharges.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentCharges.java new file mode 100644 index 0000000..1145e35 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentCharges.java @@ -0,0 +1,253 @@ +package com.fp.persistence.pgeneral.product.rate; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESUBPRODUCTINSTALLCHARGES*/ +@Entity(name="TgeneSubProductInstallmentCharges") +@Table(name="TGENESUBPRODUCTINSTALLCHARGES") +public class TgeneSubProductInstallmentCharges extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSubProductInstallmentCharges +*/ +@EmbeddedId +private TgeneSubProductInstallmentChargesKey pk; +@Column(name="CALCULTATEORDER", nullable=true) + +/** +* Orden de calculo de los cargos. +*/ +private Integer calcultateorder; + +@Column(name="BASEAMOUNTBALANCETYPE", nullable=true) + +/** +* Tipo de saldo del cual se toma el monto para calcular el tarifario. +*/ +private String baseamountbalancetype; + +@Column(name="BASEAMOUNTBALANCEGROUP", nullable=true) + +/** +* Grupo de balance asociado al tipo de saldo del cual se toma el monto para calcular el tarifario. +*/ +private String baseamountbalancegroup; + +@Column(name="NEGOTIABLE", nullable=true) + +/** +* Indica si la tasa se puede negociar con el cliente el valor y las condiciones del cargo +*/ +private String negotiable; + +@Column(name="ACTIVE", nullable=true) + +/** +* null +*/ +private String active; + +/**Contructor por defecto*/ +public TgeneSubProductInstallmentCharges(){ +} +/**Contructor de TgeneSubProductInstallmentCharges +@param pPk Clave Primaria del entity +*/ +public TgeneSubProductInstallmentCharges(TgeneSubProductInstallmentChargesKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSubProductInstallmentCharges +*/ +public static TgeneSubProductInstallmentCharges find(EntityManager pEntityManager,TgeneSubProductInstallmentChargesKey pKey) throws Exception{ + TgeneSubProductInstallmentCharges obj = pEntityManager.find(TgeneSubProductInstallmentCharges.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSubProductInstallmentCharges +@return El objeto que referencia a la Clave primaria de TgeneSubProductInstallmentCharges +*/ +public TgeneSubProductInstallmentChargesKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSubProductInstallmentCharges +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSubProductInstallmentCharges +*/ +public void setPk(TgeneSubProductInstallmentChargesKey pPk){ + pk=pPk; +} +/**Obtiene el valor de calcultateorder +@return valor de calcultateorder*/ +public Integer getCalcultateorder(){ + return calcultateorder; +} +/**Fija el valor de calcultateorder +@param pCalcultateorder nuevo Valor de calcultateorder*/ +public void setCalcultateorder(Integer pCalcultateorder){ + calcultateorder=pCalcultateorder; +} + +/**Obtiene el valor de baseamountbalancetype +@return valor de baseamountbalancetype*/ +public String getBaseamountbalancetype(){ + return baseamountbalancetype; +} +/**Fija el valor de baseamountbalancetype +@param pBaseamountbalancetype nuevo Valor de baseamountbalancetype*/ +public void setBaseamountbalancetype(String pBaseamountbalancetype){ + baseamountbalancetype=pBaseamountbalancetype; +} + +/**Obtiene el valor de baseamountbalancegroup +@return valor de baseamountbalancegroup*/ +public String getBaseamountbalancegroup(){ + return baseamountbalancegroup; +} +/**Fija el valor de baseamountbalancegroup +@param pBaseamountbalancegroup nuevo Valor de baseamountbalancegroup*/ +public void setBaseamountbalancegroup(String pBaseamountbalancegroup){ + baseamountbalancegroup=pBaseamountbalancegroup; +} + +/**Obtiene el valor de negotiable +@return valor de negotiable*/ +public String getNegotiable(){ + return negotiable; +} +/**Fija el valor de negotiable +@param pNegotiable nuevo Valor de negotiable*/ +public void setNegotiable(String pNegotiable){ + negotiable=pNegotiable; +} + +/**Obtiene el valor de active +@return valor de active*/ +public String getActive(){ + return active; +} +/**Fija el valor de active +@param pActive nuevo Valor de active*/ +public void setActive(String pActive){ + active=pActive; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSubProductInstallmentCharges))return false; + TgeneSubProductInstallmentCharges that = (TgeneSubProductInstallmentCharges) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSubProductInstallmentCharges +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSubProductInstallmentCharges +*/ +public Object createInstance(){ + TgeneSubProductInstallmentCharges instance=new TgeneSubProductInstallmentCharges(); + instance.setPk(new TgeneSubProductInstallmentChargesKey()); + return instance; +} +/**Clona la entidad TgeneSubProductInstallmentCharges +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSubProductInstallmentCharges p=(TgeneSubProductInstallmentCharges)this.clone(); + p.setPk((TgeneSubProductInstallmentChargesKey)this.pk.cloneMe()); + return p; +} + + //Metodos manuales. + /**Sentencia que devuelve la definicion de cargos asociados al producto de una solicitud.*/ + private static final String HQL_INSTALLMENT_CHARGES = + "from TgeneSubProductInstallmentCharges tinstcharg " + + " where tinstcharg.pk.modulecode = :modulecode "+ + " and tinstcharg.pk.productcode = :productcode "+ + " and tinstcharg.pk.subproductcode = :subproductcode "+ + " and tinstcharg.pk.statuscode = :statuscode "+ + " and tinstcharg.pk.currencycode = :currencycode "+ + " and tinstcharg.active = 'Y' " ; + + + /** + * Entrega una lista de cargos asociados a una tabla de amortizacion. + * @param pModuleCode Codigo de modulo a obtener cargos asociados a la solicitud. + * @param pProductCode Codigo de producto a obtener cargos asociados a la solicitud. + * @param pSubproductCode Codigo de subproducto a obtener cargos asociados a la solicitud. + * @param pStatusCode Codigo de status a obtener cargos asociados a la solicitud. + * @param pCurrencyCode Codigo de moneda a obtener cargos asociados a la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, + String pModuleCode,String pProductCode, + String pSubproductCode,String pStatusCode,String pCurrencyCode) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_INSTALLMENT_CHARGES); + qry.setParameter("modulecode", pModuleCode); + qry.setParameter("productcode", pProductCode); + qry.setParameter("subproductcode", pSubproductCode); + qry.setParameter("statuscode", pStatusCode); + qry.setParameter("currencycode", pCurrencyCode); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentChargesKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentChargesKey.java new file mode 100644 index 0000000..c33db4a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentChargesKey.java @@ -0,0 +1,259 @@ +package com.fp.persistence.pgeneral.product.rate; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESUBPRODUCTINSTALLCHARGES*/ +@Embeddable +public class TgeneSubProductInstallmentChargesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda de la cuenta +*/ +private String currencycode; + +/**Contructor por defecto*/ +public TgeneSubProductInstallmentChargesKey(){} +/**Contructor de TgeneSubProductInstallmentChargesKey +@param pBalancetype Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pStatuscode Estatus de cuenta +@param pCurrencycode Codigo de moneda de la cuenta +*/ +public TgeneSubProductInstallmentChargesKey(String pBalancetype,String pBalancegroup,String pModulecode,String pProductcode,String pSubproductcode,String pStatuscode,String pCurrencycode){ + balancetype=pBalancetype; + balancegroup=pBalancegroup; + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + statuscode=pStatuscode; + currencycode=pCurrencycode; +} +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Implementacin de la comparacin de TgeneSubProductInstallmentChargesKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSubProductInstallmentChargesKey))return false; + TgeneSubProductInstallmentChargesKey that = (TgeneSubProductInstallmentChargesKey) o; + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSubProductInstallmentChargesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentRates.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentRates.java new file mode 100644 index 0000000..1a5d054 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentRates.java @@ -0,0 +1,317 @@ +package com.fp.persistence.pgeneral.product.rate; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESUBPRODUCTINSTALLRATES */ +@Entity(name = "TgeneSubProductInstallmentRates") +@Table(name = "TGENESUBPRODUCTINSTALLRATES") +public class TgeneSubProductInstallmentRates extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneSubProductInstallmentRates + */ + @EmbeddedId + private TgeneSubProductInstallmentRatesKey pk; + + @Column(name = "PRINCIPALBALANCETYPE", nullable = true) + /** + * Cdigo de tipo de capital sobre el cual se aplica una tasa y se calcula un valor a provisionar + */ + private String principalbalancetype; + + @Column(name = "PRINCIPALBALANCEGROUP", nullable = true) + /** + * Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor + */ + private String principalbalancegroup; + + @Column(name = "NEGOTIABLE", nullable = true) + /** + * Indica si la tasa se puede negociar con el cliente + */ + private String negotiable; + + @Column(name = "ACTIVE", nullable = true) + /** + * null + */ + private String active; + + /** Contructor por defecto */ + public TgeneSubProductInstallmentRates() { + } + + /** + * Contructor de TgeneSubProductInstallmentRates + * + * @param pPk Clave Primaria del entity + */ + public TgeneSubProductInstallmentRates(TgeneSubProductInstallmentRatesKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSubProductInstallmentRates + */ + public static TgeneSubProductInstallmentRates find(EntityManager pEntityManager, TgeneSubProductInstallmentRatesKey pKey) throws Exception { + TgeneSubProductInstallmentRates obj = pEntityManager.find(TgeneSubProductInstallmentRates.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneSubProductInstallmentRates + * + * @return El objeto que referencia a la Clave primaria de TgeneSubProductInstallmentRates + */ + public TgeneSubProductInstallmentRatesKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneSubProductInstallmentRates + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneSubProductInstallmentRates + */ + public void setPk(TgeneSubProductInstallmentRatesKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de principalbalancetype + * + * @return valor de principalbalancetype + */ + public String getPrincipalbalancetype() { + return this.principalbalancetype; + } + + /** + * Fija el valor de principalbalancetype + * + * @param pPrincipalbalancetype nuevo Valor de principalbalancetype + */ + public void setPrincipalbalancetype(String pPrincipalbalancetype) { + this.principalbalancetype = pPrincipalbalancetype; + } + + /** + * Obtiene el valor de principalbalancegroup + * + * @return valor de principalbalancegroup + */ + public String getPrincipalbalancegroup() { + return this.principalbalancegroup; + } + + /** + * Fija el valor de principalbalancegroup + * + * @param pPrincipalbalancegroup nuevo Valor de principalbalancegroup + */ + public void setPrincipalbalancegroup(String pPrincipalbalancegroup) { + this.principalbalancegroup = pPrincipalbalancegroup; + } + + /** + * Obtiene el valor de negotiable + * + * @return valor de negotiable + */ + public String getNegotiable() { + return this.negotiable; + } + + /** + * Fija el valor de negotiable + * + * @param pNegotiable nuevo Valor de negotiable + */ + public void setNegotiable(String pNegotiable) { + this.negotiable = pNegotiable; + } + + /** + * Obtiene el valor de active + * + * @return valor de active + */ + public String getActive() { + return this.active; + } + + /** + * Fija el valor de active + * + * @param pActive nuevo Valor de active + */ + public void setActive(String pActive) { + this.active = pActive; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneSubProductInstallmentRates)) { + return false; + } + TgeneSubProductInstallmentRates that = (TgeneSubProductInstallmentRates) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneSubProductInstallmentRates + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneSubProductInstallmentRates */ + @Override + public Object createInstance() { + TgeneSubProductInstallmentRates instance = new TgeneSubProductInstallmentRates(); + instance.setPk(new TgeneSubProductInstallmentRatesKey()); + return instance; + } + + /** + * Clona la entidad TgeneSubProductInstallmentRates + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneSubProductInstallmentRates p = (TgeneSubProductInstallmentRates) this.clone(); + p.setPk((TgeneSubProductInstallmentRatesKey) this.pk.cloneMe()); + return p; + } + + // Metodos manuales. + /** Sentencia que devuelve la definicion de valores a provisionar asociados al producto de una solicitud. */ + private static final String HQL_INSTALLMENT_RATES = "from TgeneSubProductInstallmentRates t " + " where t.pk.modulecode = :modulecode " + + " and t.pk.productcode = :productcode " + " and t.pk.subproductcode = :subproductcode " + " and t.pk.currencycode = :currencycode " + + " and t.active = 'Y' "; + + /** + * Entrega una lista de cargos asociados a una tabla de amortizacion, estos se pueden cobrar en la cuota, + * incrementar el valor del credito, o el cliente puede pagar en caja o con debito a la cuenta. + * + * @param pModuleCode Codigo de modulo a obtener valores a provisionar asociados a la solicitud. + * @param pProductCode Codigo de producto a obtener valores a provisionar asociados a la solicitud. + * @param pSubproductCode Codigo de subproducto a obtener valores a provisionar asociados a la solicitud. + * @param pCurrencyCode Codigo de moneda a obtener valores a provisionar asociados a la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pModuleCode, String pProductCode, + String pSubproductCode, String pCurrencyCode) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_INSTALLMENT_RATES); + qry.setParameter("modulecode", pModuleCode); + qry.setParameter("productcode", pProductCode); + qry.setParameter("subproductcode", pSubproductCode); + qry.setParameter("currencycode", pCurrencyCode); + lObjects = qry.getResultList(); + return lObjects; + } + + /** Sentencia que devuelve la definicion de valores a provisionar asociados al producto de una solicitud. */ + private static final String HQL_INSTALLMENT_RATES_BTYPE = "from TgeneSubProductInstallmentRates t " + " where t.pk.modulecode = :modulecode " + + " and t.pk.productcode = :productcode " + " and t.pk.subproductcode = :subproductcode " + " and t.pk.currencycode = :currencycode " + + " and t.principalbalancetype = :btype " + " and t.principalbalancegroup = :bgroup " + " and t.active = 'Y' "; + + /** + * Entrega una lista de cargos asociados a una tabla de amortizacion, estos se pueden cobrar en la cuota, + * incrementar el valor del credito, o el cliente puede pagar en caja o con debito a la cuenta. + * + * @param pModuleCode Codigo de modulo a obtener valores a provisionar asociados a la solicitud. + * @param pProductCode Codigo de producto a obtener valores a provisionar asociados a la solicitud. + * @param pSubproductCode Codigo de subproducto a obtener valores a provisionar asociados a la solicitud. + * @param pCurrencyCode Codigo de moneda a obtener valores a provisionar asociados a la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pModuleCode, String pProductCode, + String pSubproductCode, String pCurrencyCode, String pBalanceType, String pBalanceGroup) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_INSTALLMENT_RATES_BTYPE); + qry.setParameter("modulecode", pModuleCode); + qry.setParameter("productcode", pProductCode); + qry.setParameter("subproductcode", pSubproductCode); + qry.setParameter("currencycode", pCurrencyCode); + qry.setParameter("btype", pBalanceType); + qry.setParameter("bgroup", pBalanceGroup); + lObjects = qry.getResultList(); + return lObjects; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentRatesKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentRatesKey.java new file mode 100644 index 0000000..c15effb --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentRatesKey.java @@ -0,0 +1,232 @@ +package com.fp.persistence.pgeneral.product.rate; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESUBPRODUCTINSTALLRATES*/ +@Embeddable +public class TgeneSubProductInstallmentRatesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="INTERESTBALANCETYPE", nullable=false,updatable=false) + +/** +* Codigo de tipo de saldo que provisiona en la tabla de cuotas. +*/ +private String interestbalancetype; + +@Column(name="INTERESTBALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String interestbalancegroup; + +/**Contructor por defecto*/ +public TgeneSubProductInstallmentRatesKey(){} +/**Contructor de TgeneSubProductInstallmentRatesKey +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pCurrencycode Codigo de moneda +@param pInterestbalancetype Codigo de tipo de saldo que provisiona en la tabla de cuotas. +@param pInterestbalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +public TgeneSubProductInstallmentRatesKey(String pModulecode,String pProductcode,String pSubproductcode,String pCurrencycode,String pInterestbalancetype,String pInterestbalancegroup){ + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + currencycode=pCurrencycode; + interestbalancetype=pInterestbalancetype; + interestbalancegroup=pInterestbalancegroup; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de interestbalancetype +@return valor de interestbalancetype*/ +public String getInterestbalancetype(){ + return interestbalancetype; +} +/**Fija el valor de interestbalancetype +@param pInterestbalancetype nuevo Valor de interestbalancetype*/ +public void setInterestbalancetype(String pInterestbalancetype){ + interestbalancetype=pInterestbalancetype; +} + +/**Obtiene el valor de interestbalancegroup +@return valor de interestbalancegroup*/ +public String getInterestbalancegroup(){ + return interestbalancegroup; +} +/**Fija el valor de interestbalancegroup +@param pInterestbalancegroup nuevo Valor de interestbalancegroup*/ +public void setInterestbalancegroup(String pInterestbalancegroup){ + interestbalancegroup=pInterestbalancegroup; +} + +/**Implementacin de la comparacin de TgeneSubProductInstallmentRatesKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSubProductInstallmentRatesKey))return false; + TgeneSubProductInstallmentRatesKey that = (TgeneSubProductInstallmentRatesKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getInterestbalancetype() == null || that.getInterestbalancetype() == null){ + return false; + } + if (! this.getInterestbalancetype().equals(that.getInterestbalancetype())){ + return false; + } + if (this.getInterestbalancegroup() == null || that.getInterestbalancegroup() == null){ + return false; + } + if (! this.getInterestbalancegroup().equals(that.getInterestbalancegroup())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSubProductInstallmentRatesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getInterestbalancetype() == null ? 0 : this.getInterestbalancetype().hashCode()); + result = result * 37 + (this.getInterestbalancegroup() == null ? 0 : this.getInterestbalancegroup().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductLiquidation.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductLiquidation.java new file mode 100644 index 0000000..c4ea167 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductLiquidation.java @@ -0,0 +1,308 @@ +package com.fp.persistence.pgeneral.product.rate; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESUBPRODUCTLIQUIDATION*/ +@Entity(name="TgeneSubProductLiquidation") +@Table(name="TGENESUBPRODUCTLIQUIDATION") +public class TgeneSubProductLiquidation extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSubProductLiquidation +*/ +@EmbeddedId +private TgeneSubProductLiquidationKey pk; +@Column(name="CALCULATEORDER", nullable=true) + +/** +* Orden de calculo de los cargos. +*/ +private Integer calculateorder; + +@Column(name="BASEAMOUNTBALANCETYPE", nullable=true) + +/** +* Tipo de saldo del cual se toma el monto para calcular el tarifario. +*/ +private String baseamountbalancetype; + +@Column(name="BASEAMOUNTBALANCEGROUP", nullable=true) + +/** +* Grupo de balance del tipo de saldo del cual se toma el monto para calcular el tarifario. +*/ +private String baseamountbalancegroup; + +@Column(name="NEGOTIABLE", nullable=true) + +/** +* Indica si la tasa se puede negociar con el cliente el valor y las condiciones del cargo +*/ +private String negotiable; + +@Column(name="INCREASE", nullable=true) + +/** +* Indica que incrementa el valor de capital con el cual se genera la tabla de pagos +*/ +private String increase; + +@Column(name="DECREASE", nullable=true) + +/** +* Indica que disminuye el valor de capital con el cual se genera la tabla de pagos +*/ +private String decrease; + +@Column(name="DECREASEDISBURSEMENT", nullable=true) + +/** +* Indica que el valor del cargo se descuenta del monto a entregar al cliente +*/ +private String decreasedisbursement; + +@Column(name="ACTIVE", nullable=true) + +/** +* null +*/ +private String active; + +/**Contructor por defecto*/ +public TgeneSubProductLiquidation(){ +} +/**Contructor de TgeneSubProductLiquidation +@param pPk Clave Primaria del entity +*/ +public TgeneSubProductLiquidation(TgeneSubProductLiquidationKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSubProductLiquidation +*/ +public static TgeneSubProductLiquidation find(EntityManager pEntityManager,TgeneSubProductLiquidationKey pKey) throws Exception{ + TgeneSubProductLiquidation obj = pEntityManager.find(TgeneSubProductLiquidation.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSubProductLiquidation +@return El objeto que referencia a la Clave primaria de TgeneSubProductLiquidation +*/ +public TgeneSubProductLiquidationKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSubProductLiquidation +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSubProductLiquidation +*/ +public void setPk(TgeneSubProductLiquidationKey pPk){ + pk=pPk; +} +/**Obtiene el valor de calculateorder +@return valor de calculateorder*/ +public Integer getCalculateorder(){ + return calculateorder; +} +/**Fija el valor de calculateorder +@param pCalculateorder nuevo Valor de calculateorder*/ +public void setCalculateorder(Integer pCalculateorder){ + calculateorder=pCalculateorder; +} + +/**Obtiene el valor de baseamountbalancetype +@return valor de baseamountbalancetype*/ +public String getBaseamountbalancetype(){ + return baseamountbalancetype; +} +/**Fija el valor de baseamountbalancetype +@param pBaseamountbalancetype nuevo Valor de baseamountbalancetype*/ +public void setBaseamountbalancetype(String pBaseamountbalancetype){ + baseamountbalancetype=pBaseamountbalancetype; +} + +/**Obtiene el valor de baseamountbalancegroup +@return valor de baseamountbalancegroup*/ +public String getBaseamountbalancegroup(){ + return baseamountbalancegroup; +} +/**Fija el valor de baseamountbalancegroup +@param pBaseamountbalancegroup nuevo Valor de baseamountbalancegroup*/ +public void setBaseamountbalancegroup(String pBaseamountbalancegroup){ + baseamountbalancegroup=pBaseamountbalancegroup; +} + +/**Obtiene el valor de negotiable +@return valor de negotiable*/ +public String getNegotiable(){ + return negotiable; +} +/**Fija el valor de negotiable +@param pNegotiable nuevo Valor de negotiable*/ +public void setNegotiable(String pNegotiable){ + negotiable=pNegotiable; +} + +/**Obtiene el valor de increase +@return valor de increase*/ +public String getIncrease(){ + return increase; +} +/**Fija el valor de increase +@param pIncrease nuevo Valor de increase*/ +public void setIncrease(String pIncrease){ + increase=pIncrease; +} + +/**Obtiene el valor de decrease +@return valor de decrease*/ +public String getDecrease(){ + return decrease; +} +/**Fija el valor de decrease +@param pDecrease nuevo Valor de decrease*/ +public void setDecrease(String pDecrease){ + decrease=pDecrease; +} + +/**Obtiene el valor de decreasedisbursement +@return valor de decreasedisbursement*/ +public String getDecreasedisbursement(){ + return decreasedisbursement; +} +/**Fija el valor de decreasedisbursement +@param pDecreasedisbursement nuevo Valor de decreasedisbursement*/ +public void setDecreasedisbursement(String pDecreasedisbursement){ + decreasedisbursement=pDecreasedisbursement; +} + +/**Obtiene el valor de active +@return valor de active*/ +public String getActive(){ + return active; +} +/**Fija el valor de active +@param pActive nuevo Valor de active*/ +public void setActive(String pActive){ + active=pActive; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSubProductLiquidation))return false; + TgeneSubProductLiquidation that = (TgeneSubProductLiquidation) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSubProductLiquidation +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSubProductLiquidation +*/ +public Object createInstance(){ + TgeneSubProductLiquidation instance=new TgeneSubProductLiquidation(); + instance.setPk(new TgeneSubProductLiquidationKey()); + return instance; +} +/**Clona la entidad TgeneSubProductLiquidation +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSubProductLiquidation p=(TgeneSubProductLiquidation)this.clone(); + p.setPk((TgeneSubProductLiquidationKey)this.pk.cloneMe()); + return p; +} + + //Metodos manuales. + /**Sentencia que devuelve la definicion de cargos asociados al producto de una solicitud.*/ + private static final String HQL_LIQUIDATION_CHARGES = + "from TgeneSubProductLiquidation tprodliq " + + " where tprodliq.pk.modulecode = :modulecode "+ + " and tprodliq.pk.productcode = :productcode "+ + " and tprodliq.pk.subproductcode = :subproductcode "+ + " and tprodliq.pk.statuscode = :statuscode "+ + " and tprodliq.pk.currencycode = :currencycode "+ + " and tprodliq.active = 'Y' "; + + + /** + * Entrega una lista de cargos asociados a solicitud estos se pueden incrementar el valor del credito, o el + * cliente puede pagar en caja o con debito a la cuenta, o disminuir del valor a entregar al cliente. + * @param pModuleCode Codigo de modulo a obtener cargos asociados a la solicitud. + * @param pProductCode Codigo de producto a obtener cargos asociados a la solicitud. + * @param pSubproductCode Codigo de subproducto a obtener cargos asociados a la solicitud. + * @param pStatusCode Codigo de status a obtener cargos asociados a la solicitud. + * @param pCurrencyCode Codigo de moneda a obtener cargos asociados a la solicitud. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, + String pModuleCode,String pProductCode, + String pSubproductCode,String pStatusCode,String pCurrencyCode) throws Exception { + List lObjects = null; + Query qry = pEntityManager.createQuery(HQL_LIQUIDATION_CHARGES); + qry.setParameter("modulecode", pModuleCode); + qry.setParameter("productcode", pProductCode); + qry.setParameter("subproductcode", pSubproductCode); + qry.setParameter("statuscode", pStatusCode); + qry.setParameter("currencycode", pCurrencyCode); + lObjects = qry.getResultList(); + return lObjects; + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductLiquidationKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductLiquidationKey.java new file mode 100644 index 0000000..34574d8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductLiquidationKey.java @@ -0,0 +1,259 @@ +package com.fp.persistence.pgeneral.product.rate; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESUBPRODUCTLIQUIDATION*/ +@Embeddable +public class TgeneSubProductLiquidationKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. de valores a cobrar en la liquidacion de una operacion +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +/**Contructor por defecto*/ +public TgeneSubProductLiquidationKey(){} +/**Contructor de TgeneSubProductLiquidationKey +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pStatuscode Estatus de cuenta +@param pCurrencycode Codigo de moneda +@param pBalancetype Cdigo de tipo de saldo. de valores a cobrar en la liquidacion de una operacion +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +public TgeneSubProductLiquidationKey(String pModulecode,String pProductcode,String pSubproductcode,String pStatuscode,String pCurrencycode,String pBalancetype,String pBalancegroup){ + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + statuscode=pStatuscode; + currencycode=pCurrencycode; + balancetype=pBalancetype; + balancegroup=pBalancegroup; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Implementacin de la comparacin de TgeneSubProductLiquidationKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSubProductLiquidationKey))return false; + TgeneSubProductLiquidationKey that = (TgeneSubProductLiquidationKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSubProductLiquidationKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductRate.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductRate.java new file mode 100644 index 0000000..7d7f785 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductRate.java @@ -0,0 +1,721 @@ +package com.fp.persistence.pgeneral.product.rate; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESUBPRODUCTRATE */ +@Entity(name = "TgeneSubProductRate") +@Table(name = "TGENESUBPRODUCTRATE") +public class TgeneSubProductRate extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Cache { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneSubProductRate + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(RATESEQUENCE),0)+1 from TGENESUBPRODUCTRATE " + "where PRODUCTCODE=:procode " + + "and SUBPRODUCTCODE=:sprcode " + "and CURRENCYCODE=:curcode " + "and INTERESTBALANCETYPE=:interestbt " + + "and COMPANYCODE=:comcode " + "and INTERESTBALANCEGROUP=:interestbg " + "and MODULECODE=:modcode"), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "procode,pk.productcode;sprcode,pk.subproductcode;curcode,pk.currencycode;interestbt,pk.interestbalancetype;comcode,pk.companycode;interestbg,pk.interestbalancegroup;modcode,pk.modulecode"), + @Parameter(name = "field", value = "ratesequence") }) + @GeneratedValue(generator = "seq_id") + private TgeneSubProductRateKey pk; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Manejo de optimistic locking + */ + private Integer recordversion; + + @Column(name = "BASERATECATALOG", nullable = true) + /** + * Codigo de catalogo 01 Natural, 02 Juridico + */ + private String baseratecatalog; + + @Column(name = "BASERATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona + */ + private String baseratecatalogcode; + + @Column(name = "MARGIN", nullable = true) + /** + * Margen a aplicar dado el operador + */ + private BigDecimal margin; + + @Column(name = "OPERATOR", nullable = true) + /** + * Operador a aplicar sobre la tasa base, +, - , % + */ + private String operator; + + @Column(name = "MINTERM", nullable = false) + /** + * Plazo minnimo + */ + private Integer minterm; + + @Column(name = "MAXTERM", nullable = true) + /** + * Plazo maximo + */ + private Integer maxterm; + + @Column(name = "MINAMOUNT", nullable = false) + /** + * Monto minimo + */ + private BigDecimal minamount; + + @Column(name = "MAXAMOUNT", nullable = true) + /** + * Monto Maximo + */ + private BigDecimal maxamount; + + @Column(name = "MINRATE", nullable = true) + /** + * Minimo permitido en la negociacion del prestamo + */ + private BigDecimal minrate; + + @Column(name = "MAXRATE", nullable = true) + /** + * Maximo permitido en la negociacion del prestamo + */ + private BigDecimal maxrate; + + @Column(name = "READJUSTBASERATECATALOG", nullable = true) + /** + * Codigo de catalogo de tasas base de reajuste, BCE tasa banco central + */ + private String readjustbaseratecatalog; + + @Column(name = "READJUSTBASERATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo BASERATE + */ + private String readjustbaseratecatalogcode; + + @Column(name = "READJUSTMENTOPERATOR", nullable = true) + /** + * Operador que se utilizara el momento del reajuste + */ + private String readjustmentoperator; + + @Column(name = "READJUSTMENTMARGIN", nullable = true) + /** + * Margen a aplicar en el reajuste + */ + private BigDecimal readjustmentmargin; + + @Column(name = "MAXBASERATECATALOG", nullable = true) + /** + * Codigo de catalogo de tasas base maxima, BCE tasa banco central + */ + private String maxbaseratecatalog; + + @Column(name = "MAXBASERATECATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo BASERATE + */ + private String maxbaseratecatalogcode; + + /** Contructor por defecto */ + public TgeneSubProductRate() { + } + + /** + * Contructor de TgeneSubProductRate + * + * @param pPk Clave Primaria del entity + * @param pMinterm Plazo minnimo + * @param pMinamount Monto minimo + */ + public TgeneSubProductRate(TgeneSubProductRateKey pPk, Integer pMinterm, BigDecimal pMinamount) { + this(); + this.pk = pPk; + this.minterm = pMinterm; + this.minamount = pMinamount; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSubProductRate + */ + public static TgeneSubProductRate find(EntityManager pEntityManager, TgeneSubProductRateKey pKey) throws Exception { + TgeneSubProductRate obj = pEntityManager.find(TgeneSubProductRate.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneSubProductRate + * + * @return El objeto que referencia a la Clave primaria de TgeneSubProductRate + */ + public TgeneSubProductRateKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneSubProductRate + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneSubProductRate + */ + public void setPk(TgeneSubProductRateKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de baseratecatalog + * + * @return valor de baseratecatalog + */ + public String getBaseratecatalog() { + return this.baseratecatalog; + } + + /** + * Fija el valor de baseratecatalog + * + * @param pBaseratecatalog nuevo Valor de baseratecatalog + */ + public void setBaseratecatalog(String pBaseratecatalog) { + this.baseratecatalog = pBaseratecatalog; + } + + /** + * Obtiene el valor de baseratecatalogcode + * + * @return valor de baseratecatalogcode + */ + public String getBaseratecatalogcode() { + return this.baseratecatalogcode; + } + + /** + * Fija el valor de baseratecatalogcode + * + * @param pBaseratecatalogcode nuevo Valor de baseratecatalogcode + */ + public void setBaseratecatalogcode(String pBaseratecatalogcode) { + this.baseratecatalogcode = pBaseratecatalogcode; + } + + /** + * Obtiene el valor de margin + * + * @return valor de margin + */ + public BigDecimal getMargin() { + return this.margin; + } + + /** + * Fija el valor de margin + * + * @param pMargin nuevo Valor de margin + */ + public void setMargin(BigDecimal pMargin) { + this.margin = pMargin; + } + + /** + * Obtiene el valor de operator + * + * @return valor de operator + */ + public String getOperator() { + return this.operator; + } + + /** + * Fija el valor de operator + * + * @param pOperator nuevo Valor de operator + */ + public void setOperator(String pOperator) { + this.operator = pOperator; + } + + /** + * Obtiene el valor de minterm + * + * @return valor de minterm + */ + public Integer getMinterm() { + return this.minterm; + } + + /** + * Fija el valor de minterm + * + * @param pMinterm nuevo Valor de minterm + */ + public void setMinterm(Integer pMinterm) { + this.minterm = pMinterm; + } + + /** + * Obtiene el valor de maxterm + * + * @return valor de maxterm + */ + public Integer getMaxterm() { + return this.maxterm; + } + + /** + * Fija el valor de maxterm + * + * @param pMaxterm nuevo Valor de maxterm + */ + public void setMaxterm(Integer pMaxterm) { + this.maxterm = pMaxterm; + } + + /** + * Obtiene el valor de minamount + * + * @return valor de minamount + */ + public BigDecimal getMinamount() { + return this.minamount; + } + + /** + * Fija el valor de minamount + * + * @param pMinamount nuevo Valor de minamount + */ + public void setMinamount(BigDecimal pMinamount) { + this.minamount = pMinamount; + } + + /** + * Obtiene el valor de maxamount + * + * @return valor de maxamount + */ + public BigDecimal getMaxamount() { + return this.maxamount; + } + + /** + * Fija el valor de maxamount + * + * @param pMaxamount nuevo Valor de maxamount + */ + public void setMaxamount(BigDecimal pMaxamount) { + this.maxamount = pMaxamount; + } + + /** + * Obtiene el valor de minrate + * + * @return valor de minrate + */ + public BigDecimal getMinrate() { + return this.minrate; + } + + /** + * Fija el valor de minrate + * + * @param pMinrate nuevo Valor de minrate + */ + public void setMinrate(BigDecimal pMinrate) { + this.minrate = pMinrate; + } + + /** + * Obtiene el valor de maxrate + * + * @return valor de maxrate + */ + public BigDecimal getMaxrate() { + return this.maxrate; + } + + /** + * Fija el valor de maxrate + * + * @param pMaxrate nuevo Valor de maxrate + */ + public void setMaxrate(BigDecimal pMaxrate) { + this.maxrate = pMaxrate; + } + + /** + * Obtiene el valor de readjustbaseratecatalog + * + * @return valor de readjustbaseratecatalog + */ + public String getReadjustbaseratecatalog() { + return this.readjustbaseratecatalog; + } + + /** + * Fija el valor de readjustbaseratecatalog + * + * @param pReadjustbaseratecatalog nuevo Valor de readjustbaseratecatalog + */ + public void setReadjustbaseratecatalog(String pReadjustbaseratecatalog) { + this.readjustbaseratecatalog = pReadjustbaseratecatalog; + } + + /** + * Obtiene el valor de readjustbaseratecatalogcode + * + * @return valor de readjustbaseratecatalogcode + */ + public String getReadjustbaseratecatalogcode() { + return this.readjustbaseratecatalogcode; + } + + /** + * Fija el valor de readjustbaseratecatalogcode + * + * @param pReadjustbaseratecatalogcode nuevo Valor de readjustbaseratecatalogcode + */ + public void setReadjustbaseratecatalogcode(String pReadjustbaseratecatalogcode) { + this.readjustbaseratecatalogcode = pReadjustbaseratecatalogcode; + } + + /** + * Obtiene el valor de readjustmentoperator + * + * @return valor de readjustmentoperator + */ + public String getReadjustmentoperator() { + return this.readjustmentoperator; + } + + /** + * Fija el valor de readjustmentoperator + * + * @param pReadjustmentoperator nuevo Valor de readjustmentoperator + */ + public void setReadjustmentoperator(String pReadjustmentoperator) { + this.readjustmentoperator = pReadjustmentoperator; + } + + /** + * Obtiene el valor de readjustmentmargin + * + * @return valor de readjustmentmargin + */ + public BigDecimal getReadjustmentmargin() { + return this.readjustmentmargin; + } + + /** + * Fija el valor de readjustmentmargin + * + * @param pReadjustmentmargin nuevo Valor de readjustmentmargin + */ + public void setReadjustmentmargin(BigDecimal pReadjustmentmargin) { + this.readjustmentmargin = pReadjustmentmargin; + } + + /** + * Obtiene el valor de maxbaseratecatalog + * + * @return valor de maxbaseratecatalog + */ + public String getMaxbaseratecatalog() { + return this.maxbaseratecatalog; + } + + /** + * Fija el valor de maxbaseratecatalog + * + * @param pMaxbaseratecatalog nuevo Valor de maxbaseratecatalog + */ + public void setMaxbaseratecatalog(String pMaxbaseratecatalog) { + this.maxbaseratecatalog = pMaxbaseratecatalog; + } + + /** + * Obtiene el valor de maxbaseratecatalogcode + * + * @return valor de maxbaseratecatalogcode + */ + public String getMaxbaseratecatalogcode() { + return this.maxbaseratecatalogcode; + } + + /** + * Fija el valor de maxbaseratecatalogcode + * + * @param pMaxbaseratecatalogcode nuevo Valor de maxbaseratecatalogcode + */ + public void setMaxbaseratecatalogcode(String pMaxbaseratecatalogcode) { + this.maxbaseratecatalogcode = pMaxbaseratecatalogcode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneSubProductRate)) { + return false; + } + TgeneSubProductRate that = (TgeneSubProductRate) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneSubProductRate + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneSubProductRate */ + @Override + public Object createInstance() { + TgeneSubProductRate instance = new TgeneSubProductRate(); + instance.setPk(new TgeneSubProductRateKey()); + return instance; + } + + /** + * Clona la entidad TgeneSubProductRate + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneSubProductRate p = (TgeneSubProductRate) this.clone(); + p.setPk((TgeneSubProductRateKey) this.pk.cloneMe()); + return p; + } + + // Metodos manuales. + public boolean equalsWithoutSequence(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneSubProductRate)) { + return false; + } + TgeneSubProductRate that = (TgeneSubProductRate) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + + TgeneSubProductRateKey thispk = this.getPk(); + TgeneSubProductRateKey thatpk = that.getPk(); + + if (thatpk == null) { + return false; + } + if (!(thatpk instanceof TgeneSubProductRateKey)) { + return false; + } + if ((thispk.getModulecode() == null) || (thatpk.getModulecode() == null)) { + return false; + } + if (!thispk.getModulecode().equals(thatpk.getModulecode())) { + return false; + } + if ((thispk.getProductcode() == null) || (thatpk.getProductcode() == null)) { + return false; + } + if (!thispk.getProductcode().equals(thatpk.getProductcode())) { + return false; + } + if ((thispk.getSubproductcode() == null) || (thatpk.getSubproductcode() == null)) { + return false; + } + if (!thispk.getSubproductcode().equals(thatpk.getSubproductcode())) { + return false; + } + if ((thispk.getCurrencycode() == null) || (thatpk.getCurrencycode() == null)) { + return false; + } + if (!thispk.getCurrencycode().equals(thatpk.getCurrencycode())) { + return false; + } + if ((thispk.getInterestbalancetype() == null) || (thatpk.getInterestbalancetype() == null)) { + return false; + } + if (!thispk.getInterestbalancetype().equals(thatpk.getInterestbalancetype())) { + return false; + } + if ((thispk.getCompanycode() == null) || (thatpk.getCompanycode() == null)) { + return false; + } + if (!thispk.getCompanycode().equals(thatpk.getCompanycode())) { + return false; + } + if ((thispk.getInterestbalancegroup() == null) || (thatpk.getInterestbalancegroup() == null)) { + return false; + } + if (!thispk.getInterestbalancegroup().equals(thatpk.getInterestbalancegroup())) { + return false; + } + + return true; + } + + /** Sentencia que devuelve una lista de TgeneSubPproductRate. */ + private static final String HQL_SUBPRODUCT_RATE = "from TgeneSubProductRate tsubprate " + + " where tsubprate.pk.interestbalancetype = :interestbalancetype " + " and tsubprate.pk.interestbalancegroup = :interestbalancegroup " + + " and tsubprate.pk.modulecode = :modulecode " + " and tsubprate.pk.productcode = :productcode " + + " and tsubprate.pk.subproductcode = :subproductcode " + " and tsubprate.pk.companycode = :companycode " + + " and tsubprate.pk.currencycode = :currencycode "; + + /** + * Metodo que entrega una lista de tasas definidas por subproducto compania. + * + * @param pEntityManager Referencia a la session de la base de datos. + * @param pInterestbalancetype Tipo de saldo. + * @param pInterestbalancegroup Grupo de balance. + * @param pModule Codigo de modulo. + * @param pProduct Codigo de producto. + * @param pSubProduct Codigo de subproducto. + * @param pCompany Codigo de compania. + * @param pCurrency Codigo de moneda. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static final List find(EntityManager pEntityManager, String pInterestbalancetype, String pInterestbalancegroup, + String pModule, String pProduct, String pSubProduct, Integer pCompany, String pCurrency) throws Exception { + List lRates = null; + Query qry = pEntityManager.createQuery(TgeneSubProductRate.HQL_SUBPRODUCT_RATE); + qry.setParameter("interestbalancetype", pInterestbalancetype); + qry.setParameter("interestbalancegroup", pInterestbalancegroup); + qry.setParameter("modulecode", pModule); + qry.setParameter("productcode", pProduct); + qry.setParameter("subproductcode", pSubProduct); + qry.setParameter("companycode", pCompany); + qry.setParameter("currencycode", pCurrency); + lRates = qry.getResultList(); + return lRates; + } + + /** Sentencia que devuelve un registro de TgeneSubProductCharges. */ + private static final String JQL_RATES = "from TgeneSubProductRate tsubpchar " + " where tsubpchar.pk.modulecode = :modulecode " + + " and tsubpchar.pk.productcode = :productcode " + " and tsubpchar.pk.subproductcode = :subproductcode " + + " and tsubpchar.pk.currencycode = :currencycode " + " and tsubpchar.pk.companycode = :companycode "; + + /** + * + * @param pEntityManager + * @param pModuleCode + * @param pProduct + * @param pSubProduct + * @return + * @throws Exception + */ + + @SuppressWarnings("unchecked") + public static final List find(EntityManager pEntityManager, String pModuleCode, String pProduct, String pSubProduct, + String pCurrencyCode, Integer pCompanyCode) throws Exception { + Query qry = pEntityManager.createQuery(TgeneSubProductRate.JQL_RATES); + qry.setParameter("modulecode", pModuleCode); + qry.setParameter("productcode", pProduct); + qry.setParameter("subproductcode", pSubProduct); + qry.setParameter("currencycode", pCurrencyCode); + qry.setParameter("companycode", pCompanyCode); + + return qry.getResultList(); + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductRateKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductRateKey.java new file mode 100644 index 0000000..e499be1 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/product/rate/TgeneSubProductRateKey.java @@ -0,0 +1,286 @@ +package com.fp.persistence.pgeneral.product.rate; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESUBPRODUCTRATE*/ +@Embeddable +public class TgeneSubProductRateKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="INTERESTBALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo de interes a calcular. +*/ +private String interestbalancetype; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="INTERESTBALANCEGROUP", nullable=false,updatable=false) + +/** +* Cdigo de grupo de balance del tipo de saldo. +*/ +private String interestbalancegroup; + +@Column(name="RATESEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia para las tasas por subproducto +*/ +private Integer ratesequence; + +/**Contructor por defecto*/ +public TgeneSubProductRateKey(){} +/**Contructor de TgeneSubProductRateKey +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pCurrencycode Codigo de moneda +@param pInterestbalancetype Cdigo de tipo de saldo de interes a calcular. +@param pCompanycode Codigo de compania +@param pInterestbalancegroup Cdigo de grupo de balance del tipo de saldo. +@param pRatesequence Secuencia para las tasas por subproducto +*/ +public TgeneSubProductRateKey(String pModulecode,String pProductcode,String pSubproductcode,String pCurrencycode,String pInterestbalancetype,Integer pCompanycode,String pInterestbalancegroup,Integer pRatesequence){ + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + currencycode=pCurrencycode; + interestbalancetype=pInterestbalancetype; + companycode=pCompanycode; + interestbalancegroup=pInterestbalancegroup; + ratesequence=pRatesequence; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de interestbalancetype +@return valor de interestbalancetype*/ +public String getInterestbalancetype(){ + return interestbalancetype; +} +/**Fija el valor de interestbalancetype +@param pInterestbalancetype nuevo Valor de interestbalancetype*/ +public void setInterestbalancetype(String pInterestbalancetype){ + interestbalancetype=pInterestbalancetype; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de interestbalancegroup +@return valor de interestbalancegroup*/ +public String getInterestbalancegroup(){ + return interestbalancegroup; +} +/**Fija el valor de interestbalancegroup +@param pInterestbalancegroup nuevo Valor de interestbalancegroup*/ +public void setInterestbalancegroup(String pInterestbalancegroup){ + interestbalancegroup=pInterestbalancegroup; +} + +/**Obtiene el valor de ratesequence +@return valor de ratesequence*/ +public Integer getRatesequence(){ + return ratesequence; +} +/**Fija el valor de ratesequence +@param pRatesequence nuevo Valor de ratesequence*/ +public void setRatesequence(Integer pRatesequence){ + ratesequence=pRatesequence; +} + +/**Implementacion de la comparacion de TgeneSubProductRateKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSubProductRateKey))return false; + TgeneSubProductRateKey that = (TgeneSubProductRateKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getInterestbalancetype() == null || that.getInterestbalancetype() == null){ + return false; + } + if (! this.getInterestbalancetype().equals(that.getInterestbalancetype())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getInterestbalancegroup() == null || that.getInterestbalancegroup() == null){ + return false; + } + if (! this.getInterestbalancegroup().equals(that.getInterestbalancegroup())){ + return false; + } + if (this.getRatesequence() == null || that.getRatesequence() == null){ + return false; + } + if (! this.getRatesequence().equals(that.getRatesequence())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneSubProductRateKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getInterestbalancetype() == null ? 0 : this.getInterestbalancetype().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getInterestbalancegroup() == null ? 0 : this.getInterestbalancegroup().hashCode()); + result = result * 37 + (this.getRatesequence() == null ? 0 : this.getRatesequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/prov/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/prov/.svn/entries new file mode 100644 index 0000000..e690760 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/prov/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/prov +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneDefaultProvision.java +file + + + + +2022-07-28T03:40:29.418745Z +03f9405bc166701eda01aa707e722702 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6844 + +TgeneDefaultProvisionKey.java +file + + + + +2022-07-28T03:40:29.418745Z +5bf67048d29cb2790a2792e3b23984f3 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5658 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/prov/.svn/text-base/TgeneDefaultProvision.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/prov/.svn/text-base/TgeneDefaultProvision.java.svn-base new file mode 100644 index 0000000..5d96a4a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/prov/.svn/text-base/TgeneDefaultProvision.java.svn-base @@ -0,0 +1,232 @@ +package com.fp.persistence.pgeneral.prov; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEDEFAULTPROVISION*/ +@Entity(name="TgeneDefaultProvision") +@Table(name="TGENEDEFAULTPROVISION") +public class TgeneDefaultProvision extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneDefaultProvision +*/ +@EmbeddedId +private TgeneDefaultProvisionKey pk; +@Column(name="INTERESTBALANCETYPE", nullable=true) + +/** +* Cdigo de tipo de saldo. Del interes normal, sirve para obtener la tasa anterior. +*/ +private String interestbalancetype; + +@Column(name="INTERESTBALANCEGROUP", nullable=true) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String interestbalancegroup; + +@Column(name="GRACEDAYS", nullable=true) + +/** +* Y, Indica que se considera dias de gracia para el calculo de la provision, N no considera dias de gracia y calcula desde el vencimiento de la cuota +*/ +private String gracedays; + +@Column(name="OPERATOR", nullable=true) + +/** +* Operador a aplicar sobre la tasa base, +, - , % +*/ +private String operator; + +@Column(name="MARGIN", nullable=true) + +/** +* Margen a aplicar sobre la tasa real del tipo de saldo de interes. +*/ +private BigDecimal margin; + +@Column(name="RATEFROMTARIF", nullable=true) + +/** +* Y indica que la tasa se obtiene del tarifario +*/ +private String ratefromtarif; + +/**Contructor por defecto*/ +public TgeneDefaultProvision(){ +} +/**Contructor de TgeneDefaultProvision +@param pPk Clave Primaria del entity +*/ +public TgeneDefaultProvision(TgeneDefaultProvisionKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneDefaultProvision +*/ +public static TgeneDefaultProvision find(EntityManager pEntityManager,TgeneDefaultProvisionKey pKey) throws Exception{ + TgeneDefaultProvision obj = pEntityManager.find(TgeneDefaultProvision.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneDefaultProvision +@return El objeto que referencia a la Clave primaria de TgeneDefaultProvision +*/ +public TgeneDefaultProvisionKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneDefaultProvision +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneDefaultProvision +*/ +public void setPk(TgeneDefaultProvisionKey pPk){ + pk=pPk; +} +/**Obtiene el valor de interestbalancetype +@return valor de interestbalancetype*/ +public String getInterestbalancetype(){ + return interestbalancetype; +} +/**Fija el valor de interestbalancetype +@param pInterestbalancetype nuevo Valor de interestbalancetype*/ +public void setInterestbalancetype(String pInterestbalancetype){ + interestbalancetype=pInterestbalancetype; +} + +/**Obtiene el valor de interestbalancegroup +@return valor de interestbalancegroup*/ +public String getInterestbalancegroup(){ + return interestbalancegroup; +} +/**Fija el valor de interestbalancegroup +@param pInterestbalancegroup nuevo Valor de interestbalancegroup*/ +public void setInterestbalancegroup(String pInterestbalancegroup){ + interestbalancegroup=pInterestbalancegroup; +} + +/**Obtiene el valor de gracedays +@return valor de gracedays*/ +public String getGracedays(){ + return gracedays; +} +/**Fija el valor de gracedays +@param pGracedays nuevo Valor de gracedays*/ +public void setGracedays(String pGracedays){ + gracedays=pGracedays; +} + +/**Obtiene el valor de operator +@return valor de operator*/ +public String getOperator(){ + return operator; +} +/**Fija el valor de operator +@param pOperator nuevo Valor de operator*/ +public void setOperator(String pOperator){ + operator=pOperator; +} + +/**Obtiene el valor de margin +@return valor de margin*/ +public BigDecimal getMargin(){ + return margin; +} +/**Fija el valor de margin +@param pMargin nuevo Valor de margin*/ +public void setMargin(BigDecimal pMargin){ + margin=pMargin; +} + +/**Obtiene el valor de ratefromtarif +@return valor de ratefromtarif*/ +public String getRatefromtarif(){ + return ratefromtarif; +} +/**Fija el valor de ratefromtarif +@param pRatefromtarif nuevo Valor de ratefromtarif*/ +public void setRatefromtarif(String pRatefromtarif){ + ratefromtarif=pRatefromtarif; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneDefaultProvision))return false; + TgeneDefaultProvision that = (TgeneDefaultProvision) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneDefaultProvision +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneDefaultProvision +*/ +public Object createInstance(){ + TgeneDefaultProvision instance=new TgeneDefaultProvision(); + instance.setPk(new TgeneDefaultProvisionKey()); + return instance; +} +/**Clona la entidad TgeneDefaultProvision +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneDefaultProvision p=(TgeneDefaultProvision)this.clone(); + p.setPk((TgeneDefaultProvisionKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/prov/.svn/text-base/TgeneDefaultProvisionKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/prov/.svn/text-base/TgeneDefaultProvisionKey.java.svn-base new file mode 100644 index 0000000..a549c08 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/prov/.svn/text-base/TgeneDefaultProvisionKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.prov; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEDEFAULTPROVISION*/ +@Embeddable +public class TgeneDefaultProvisionKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="DEFAULTBALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Ehemplo ISCV, MORA +*/ +private String defaultbalancetype; + +@Column(name="DEFAULTBALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String defaultbalancegroup; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +/**Contructor por defecto*/ +public TgeneDefaultProvisionKey(){} +/**Contructor de TgeneDefaultProvisionKey +@param pDefaultbalancetype Cdigo de tipo de saldo. Ehemplo ISCV, MORA +@param pDefaultbalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +@param pModulecode Codigo de modulo +@param pStatuscode Estatus de cuenta +*/ +public TgeneDefaultProvisionKey(String pDefaultbalancetype,String pDefaultbalancegroup,String pModulecode,String pStatuscode){ + defaultbalancetype=pDefaultbalancetype; + defaultbalancegroup=pDefaultbalancegroup; + modulecode=pModulecode; + statuscode=pStatuscode; +} +/**Obtiene el valor de defaultbalancetype +@return valor de defaultbalancetype*/ +public String getDefaultbalancetype(){ + return defaultbalancetype; +} +/**Fija el valor de defaultbalancetype +@param pDefaultbalancetype nuevo Valor de defaultbalancetype*/ +public void setDefaultbalancetype(String pDefaultbalancetype){ + defaultbalancetype=pDefaultbalancetype; +} + +/**Obtiene el valor de defaultbalancegroup +@return valor de defaultbalancegroup*/ +public String getDefaultbalancegroup(){ + return defaultbalancegroup; +} +/**Fija el valor de defaultbalancegroup +@param pDefaultbalancegroup nuevo Valor de defaultbalancegroup*/ +public void setDefaultbalancegroup(String pDefaultbalancegroup){ + defaultbalancegroup=pDefaultbalancegroup; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Implementacin de la comparacin de TgeneDefaultProvisionKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneDefaultProvisionKey))return false; + TgeneDefaultProvisionKey that = (TgeneDefaultProvisionKey) o; + if (this.getDefaultbalancetype() == null || that.getDefaultbalancetype() == null){ + return false; + } + if (! this.getDefaultbalancetype().equals(that.getDefaultbalancetype())){ + return false; + } + if (this.getDefaultbalancegroup() == null || that.getDefaultbalancegroup() == null){ + return false; + } + if (! this.getDefaultbalancegroup().equals(that.getDefaultbalancegroup())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneDefaultProvisionKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getDefaultbalancetype() == null ? 0 : this.getDefaultbalancetype().hashCode()); + result = result * 37 + (this.getDefaultbalancegroup() == null ? 0 : this.getDefaultbalancegroup().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/prov/TgeneDefaultProvision.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/prov/TgeneDefaultProvision.java new file mode 100644 index 0000000..5d96a4a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/prov/TgeneDefaultProvision.java @@ -0,0 +1,232 @@ +package com.fp.persistence.pgeneral.prov; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEDEFAULTPROVISION*/ +@Entity(name="TgeneDefaultProvision") +@Table(name="TGENEDEFAULTPROVISION") +public class TgeneDefaultProvision extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneDefaultProvision +*/ +@EmbeddedId +private TgeneDefaultProvisionKey pk; +@Column(name="INTERESTBALANCETYPE", nullable=true) + +/** +* Cdigo de tipo de saldo. Del interes normal, sirve para obtener la tasa anterior. +*/ +private String interestbalancetype; + +@Column(name="INTERESTBALANCEGROUP", nullable=true) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String interestbalancegroup; + +@Column(name="GRACEDAYS", nullable=true) + +/** +* Y, Indica que se considera dias de gracia para el calculo de la provision, N no considera dias de gracia y calcula desde el vencimiento de la cuota +*/ +private String gracedays; + +@Column(name="OPERATOR", nullable=true) + +/** +* Operador a aplicar sobre la tasa base, +, - , % +*/ +private String operator; + +@Column(name="MARGIN", nullable=true) + +/** +* Margen a aplicar sobre la tasa real del tipo de saldo de interes. +*/ +private BigDecimal margin; + +@Column(name="RATEFROMTARIF", nullable=true) + +/** +* Y indica que la tasa se obtiene del tarifario +*/ +private String ratefromtarif; + +/**Contructor por defecto*/ +public TgeneDefaultProvision(){ +} +/**Contructor de TgeneDefaultProvision +@param pPk Clave Primaria del entity +*/ +public TgeneDefaultProvision(TgeneDefaultProvisionKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneDefaultProvision +*/ +public static TgeneDefaultProvision find(EntityManager pEntityManager,TgeneDefaultProvisionKey pKey) throws Exception{ + TgeneDefaultProvision obj = pEntityManager.find(TgeneDefaultProvision.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneDefaultProvision +@return El objeto que referencia a la Clave primaria de TgeneDefaultProvision +*/ +public TgeneDefaultProvisionKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneDefaultProvision +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneDefaultProvision +*/ +public void setPk(TgeneDefaultProvisionKey pPk){ + pk=pPk; +} +/**Obtiene el valor de interestbalancetype +@return valor de interestbalancetype*/ +public String getInterestbalancetype(){ + return interestbalancetype; +} +/**Fija el valor de interestbalancetype +@param pInterestbalancetype nuevo Valor de interestbalancetype*/ +public void setInterestbalancetype(String pInterestbalancetype){ + interestbalancetype=pInterestbalancetype; +} + +/**Obtiene el valor de interestbalancegroup +@return valor de interestbalancegroup*/ +public String getInterestbalancegroup(){ + return interestbalancegroup; +} +/**Fija el valor de interestbalancegroup +@param pInterestbalancegroup nuevo Valor de interestbalancegroup*/ +public void setInterestbalancegroup(String pInterestbalancegroup){ + interestbalancegroup=pInterestbalancegroup; +} + +/**Obtiene el valor de gracedays +@return valor de gracedays*/ +public String getGracedays(){ + return gracedays; +} +/**Fija el valor de gracedays +@param pGracedays nuevo Valor de gracedays*/ +public void setGracedays(String pGracedays){ + gracedays=pGracedays; +} + +/**Obtiene el valor de operator +@return valor de operator*/ +public String getOperator(){ + return operator; +} +/**Fija el valor de operator +@param pOperator nuevo Valor de operator*/ +public void setOperator(String pOperator){ + operator=pOperator; +} + +/**Obtiene el valor de margin +@return valor de margin*/ +public BigDecimal getMargin(){ + return margin; +} +/**Fija el valor de margin +@param pMargin nuevo Valor de margin*/ +public void setMargin(BigDecimal pMargin){ + margin=pMargin; +} + +/**Obtiene el valor de ratefromtarif +@return valor de ratefromtarif*/ +public String getRatefromtarif(){ + return ratefromtarif; +} +/**Fija el valor de ratefromtarif +@param pRatefromtarif nuevo Valor de ratefromtarif*/ +public void setRatefromtarif(String pRatefromtarif){ + ratefromtarif=pRatefromtarif; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneDefaultProvision))return false; + TgeneDefaultProvision that = (TgeneDefaultProvision) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneDefaultProvision +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneDefaultProvision +*/ +public Object createInstance(){ + TgeneDefaultProvision instance=new TgeneDefaultProvision(); + instance.setPk(new TgeneDefaultProvisionKey()); + return instance; +} +/**Clona la entidad TgeneDefaultProvision +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneDefaultProvision p=(TgeneDefaultProvision)this.clone(); + p.setPk((TgeneDefaultProvisionKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/prov/TgeneDefaultProvisionKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/prov/TgeneDefaultProvisionKey.java new file mode 100644 index 0000000..a549c08 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/prov/TgeneDefaultProvisionKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.prov; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEDEFAULTPROVISION*/ +@Embeddable +public class TgeneDefaultProvisionKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="DEFAULTBALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Ehemplo ISCV, MORA +*/ +private String defaultbalancetype; + +@Column(name="DEFAULTBALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String defaultbalancegroup; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +/**Contructor por defecto*/ +public TgeneDefaultProvisionKey(){} +/**Contructor de TgeneDefaultProvisionKey +@param pDefaultbalancetype Cdigo de tipo de saldo. Ehemplo ISCV, MORA +@param pDefaultbalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +@param pModulecode Codigo de modulo +@param pStatuscode Estatus de cuenta +*/ +public TgeneDefaultProvisionKey(String pDefaultbalancetype,String pDefaultbalancegroup,String pModulecode,String pStatuscode){ + defaultbalancetype=pDefaultbalancetype; + defaultbalancegroup=pDefaultbalancegroup; + modulecode=pModulecode; + statuscode=pStatuscode; +} +/**Obtiene el valor de defaultbalancetype +@return valor de defaultbalancetype*/ +public String getDefaultbalancetype(){ + return defaultbalancetype; +} +/**Fija el valor de defaultbalancetype +@param pDefaultbalancetype nuevo Valor de defaultbalancetype*/ +public void setDefaultbalancetype(String pDefaultbalancetype){ + defaultbalancetype=pDefaultbalancetype; +} + +/**Obtiene el valor de defaultbalancegroup +@return valor de defaultbalancegroup*/ +public String getDefaultbalancegroup(){ + return defaultbalancegroup; +} +/**Fija el valor de defaultbalancegroup +@param pDefaultbalancegroup nuevo Valor de defaultbalancegroup*/ +public void setDefaultbalancegroup(String pDefaultbalancegroup){ + defaultbalancegroup=pDefaultbalancegroup; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Implementacin de la comparacin de TgeneDefaultProvisionKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneDefaultProvisionKey))return false; + TgeneDefaultProvisionKey that = (TgeneDefaultProvisionKey) o; + if (this.getDefaultbalancetype() == null || that.getDefaultbalancetype() == null){ + return false; + } + if (! this.getDefaultbalancetype().equals(that.getDefaultbalancetype())){ + return false; + } + if (this.getDefaultbalancegroup() == null || that.getDefaultbalancegroup() == null){ + return false; + } + if (! this.getDefaultbalancegroup().equals(that.getDefaultbalancegroup())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneDefaultProvisionKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getDefaultbalancetype() == null ? 0 : this.getDefaultbalancetype().hashCode()); + result = result * 37 + (this.getDefaultbalancegroup() == null ? 0 : this.getDefaultbalancegroup().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/.svn/entries new file mode 100644 index 0000000..44057ce --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/.svn/entries @@ -0,0 +1,201 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TreceivableTemplateDesc.java +file + + + + +2022-07-28T03:40:29.281745Z +9159150d1b7e636773b9b189dfa58096 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4869 + +TreceivableTemplate.java +file + + + + +2022-07-28T03:40:29.282745Z +4426ff86b2c1155a9f1671696d749ee6 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4959 + +TreceivableTemplateDetail.java +file + + + + +2022-07-28T03:40:29.282745Z +07e4f551f2061a07f08c1ff2427fe64f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9040 + +acco +dir + +TreceivableTemplateDescKey.java +file + + + + +2022-07-28T03:40:29.282745Z +d13567cdc3e661e936bc8c228d6e2658 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3672 + +TreceivableTemplateDetailKey.java +file + + + + +2022-07-28T03:40:29.283745Z +b32f4b7dc7c75a9be5768be7ac6804e6 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3677 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/.svn/text-base/TreceivableTemplate.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/.svn/text-base/TreceivableTemplate.java.svn-base new file mode 100644 index 0000000..b8d8695 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/.svn/text-base/TreceivableTemplate.java.svn-base @@ -0,0 +1,176 @@ +package com.fp.persistence.pgeneral.receive; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TRECEIVABLETEMPLATE*/ +@Entity(name="TreceivableTemplate") +@Table(name="TRECEIVABLETEMPLATE") +public class TreceivableTemplate extends com.fp.dto.AbstractDataBalanceTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TreceivableTemplate +*/ +@Id +@Column(name="TEMPLATECODE" ,nullable=false, updatable=false) +private Integer pk; +@Column(name="MODULECODE", nullable=true) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistik locking del registro. +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion de la cuenta por cobrar. +*/ +private String description; + +/**Contructor por defecto*/ +public TreceivableTemplate(){ +} +/**Contructor de TreceivableTemplate +@param pPk Clave Primaria del entity +*/ +public TreceivableTemplate(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TreceivableTemplate +*/ +public static TreceivableTemplate find(EntityManager pEntityManager,Object pKey) throws Exception{ + TreceivableTemplate obj = pEntityManager.find(TreceivableTemplate.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TreceivableTemplate +@return El objeto que referencia a la Clave primaria de TreceivableTemplate +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TreceivableTemplate +@param pPk El objeto que referencia a la nueva Clave primaria de TreceivableTemplate +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TreceivableTemplate))return false; + TreceivableTemplate that = (TreceivableTemplate) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TreceivableTemplate +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TreceivableTemplate +*/ +public Object createInstance(){ + TreceivableTemplate instance=new TreceivableTemplate(); + return instance; +} +/**Clona la entidad TreceivableTemplate +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TreceivableTemplate p=(TreceivableTemplate)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/.svn/text-base/TreceivableTemplateDesc.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/.svn/text-base/TreceivableTemplateDesc.java.svn-base new file mode 100644 index 0000000..4d3fc2f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/.svn/text-base/TreceivableTemplateDesc.java.svn-base @@ -0,0 +1,159 @@ +package com.fp.persistence.pgeneral.receive; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TRECEIVABLETEMPLATEDESC*/ +@Entity(name="TreceivableTemplateDesc") +@Table(name="TRECEIVABLETEMPLATEDESC") +public class TreceivableTemplateDesc extends com.fp.dto.AbstractDataBalanceTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TreceivableTemplateDesc +*/ +@EmbeddedId +private TreceivableTemplateDescKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistick loking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPCTION", nullable=true) + +/** +* Descripcion del codigo de plantilla de cuenta por cobrar. +*/ +private String descripction; + +/**Contructor por defecto*/ +public TreceivableTemplateDesc(){ +} +/**Contructor de TreceivableTemplateDesc +@param pPk Clave Primaria del entity +*/ +public TreceivableTemplateDesc(TreceivableTemplateDescKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TreceivableTemplateDesc +*/ +public static TreceivableTemplateDesc find(EntityManager pEntityManager,TreceivableTemplateDescKey pKey) throws Exception{ + TreceivableTemplateDesc obj = pEntityManager.find(TreceivableTemplateDesc.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TreceivableTemplateDesc +@return El objeto que referencia a la Clave primaria de TreceivableTemplateDesc +*/ +public TreceivableTemplateDescKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TreceivableTemplateDesc +@param pPk El objeto que referencia a la nueva Clave primaria de TreceivableTemplateDesc +*/ +public void setPk(TreceivableTemplateDescKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de descripction +@return valor de descripction*/ +public String getDescripction(){ + return descripction; +} +/**Fija el valor de descripction +@param pDescripction nuevo Valor de descripction*/ +public void setDescripction(String pDescripction){ + descripction=pDescripction; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TreceivableTemplateDesc))return false; + TreceivableTemplateDesc that = (TreceivableTemplateDesc) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TreceivableTemplateDesc +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TreceivableTemplateDesc +*/ +public Object createInstance(){ + TreceivableTemplateDesc instance=new TreceivableTemplateDesc(); + instance.setPk(new TreceivableTemplateDescKey()); + return instance; +} +/**Clona la entidad TreceivableTemplateDesc +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TreceivableTemplateDesc p=(TreceivableTemplateDesc)this.clone(); + p.setPk((TreceivableTemplateDescKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/.svn/text-base/TreceivableTemplateDescKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/.svn/text-base/TreceivableTemplateDescKey.java.svn-base new file mode 100644 index 0000000..32c92eb --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/.svn/text-base/TreceivableTemplateDescKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.receive; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TRECEIVABLETEMPLATEDESC*/ +@Embeddable +public class TreceivableTemplateDescKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TEMPLATECODE", nullable=false,updatable=false) + +/** +* Cdigo de plantilla de cuentas por cobrar. +*/ +private Integer templatecode; + +@Column(name="LANGUAGECODE", nullable=false,updatable=false) + +/** +* Codigo de idioma +*/ +private String languagecode; + +/**Contructor por defecto*/ +public TreceivableTemplateDescKey(){} +/**Contructor de TreceivableTemplateDescKey +@param pTemplatecode Cdigo de plantilla de cuentas por cobrar. +@param pLanguagecode Codigo de idioma +*/ +public TreceivableTemplateDescKey(Integer pTemplatecode,String pLanguagecode){ + templatecode=pTemplatecode; + languagecode=pLanguagecode; +} +/**Obtiene el valor de templatecode +@return valor de templatecode*/ +public Integer getTemplatecode(){ + return templatecode; +} +/**Fija el valor de templatecode +@param pTemplatecode nuevo Valor de templatecode*/ +public void setTemplatecode(Integer pTemplatecode){ + templatecode=pTemplatecode; +} + +/**Obtiene el valor de languagecode +@return valor de languagecode*/ +public String getLanguagecode(){ + return languagecode; +} +/**Fija el valor de languagecode +@param pLanguagecode nuevo Valor de languagecode*/ +public void setLanguagecode(String pLanguagecode){ + languagecode=pLanguagecode; +} + +/**Implementacin de la comparacin de TreceivableTemplateDescKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TreceivableTemplateDescKey))return false; + TreceivableTemplateDescKey that = (TreceivableTemplateDescKey) o; + if (this.getTemplatecode() == null || that.getTemplatecode() == null){ + return false; + } + if (! this.getTemplatecode().equals(that.getTemplatecode())){ + return false; + } + if (this.getLanguagecode() == null || that.getLanguagecode() == null){ + return false; + } + if (! this.getLanguagecode().equals(that.getLanguagecode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TreceivableTemplateDescKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTemplatecode() == null ? 0 : this.getTemplatecode().hashCode()); + result = result * 37 + (this.getLanguagecode() == null ? 0 : this.getLanguagecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/.svn/text-base/TreceivableTemplateDetail.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/.svn/text-base/TreceivableTemplateDetail.java.svn-base new file mode 100644 index 0000000..831206f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/.svn/text-base/TreceivableTemplateDetail.java.svn-base @@ -0,0 +1,307 @@ +package com.fp.persistence.pgeneral.receive; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TRECEIVABLETEMPLATEDETAIL*/ +@Entity(name="TreceivableTemplateDetail") +@Table(name="TRECEIVABLETEMPLATEDETAIL") +public class TreceivableTemplateDetail extends com.fp.dto.AbstractDataBalanceTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TreceivableTemplateDetail +*/ +@Id +@Column(name="TEMPLATECODE" ,nullable=false, updatable=false) +private Integer pk; +@Column(name="BALANCETYPE", nullable=false) + +/** +* Cdigo de tipo de saldo d registro de la CXC. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +@Column(name="RECOVERBALANCETYPE", nullable=true) + +/** +* Cdigo de tipo de saldo d cobro de la CXC. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String recoverbalancetype; + +@Column(name="RECOVERBALANCEGROUP", nullable=true) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String recoverbalancegroup; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="PRIORITY", nullable=true) + +/** +* Prioridad de cobro de la cuenta por cobrar dentro del dia +*/ +private Integer priority; + +@Column(name="ISPARTIAL", nullable=true) + +/** +* Indica si permite cobros parciales de cuenta por cobrar. +*/ +private String ispartial; + +@Column(name="MINIMUNPAYMENT", nullable=true) + +/** +* Si permite cobro parcial cual es el valor minimo a cobrar. +*/ +private BigDecimal minimunpayment; + +@Column(name="TERM", nullable=true) + +/** +* Plazo de vigencia de la cuenta por cobrar, al vencimiento se da de baja la cxc +*/ +private Integer term; + +@Column(name="MANAGECACHE", nullable=true) + +/** +* Indica si el registro de plantilla se almacena en cache en el servidor de aplicaciones +*/ +private String managecache; + +/**Contructor por defecto*/ +public TreceivableTemplateDetail(){ +} +/**Contructor de TreceivableTemplateDetail +@param pPk Clave Primaria del entity +@param pBalancetype Cdigo de tipo de saldo d registro de la CXC. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +public TreceivableTemplateDetail(Integer pPk,String pBalancetype,String pBalancegroup){ + this(); + pk=pPk; + balancetype=pBalancetype; + balancegroup=pBalancegroup; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TreceivableTemplateDetail +*/ +public static TreceivableTemplateDetail find(EntityManager pEntityManager,Object pKey) throws Exception{ + TreceivableTemplateDetail obj = pEntityManager.find(TreceivableTemplateDetail.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TreceivableTemplateDetail +@return El objeto que referencia a la Clave primaria de TreceivableTemplateDetail +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TreceivableTemplateDetail +@param pPk El objeto que referencia a la nueva Clave primaria de TreceivableTemplateDetail +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Obtiene el valor de recoverbalancetype +@return valor de recoverbalancetype*/ +public String getRecoverbalancetype(){ + return recoverbalancetype; +} +/**Fija el valor de recoverbalancetype +@param pRecoverbalancetype nuevo Valor de recoverbalancetype*/ +public void setRecoverbalancetype(String pRecoverbalancetype){ + recoverbalancetype=pRecoverbalancetype; +} + +/**Obtiene el valor de recoverbalancegroup +@return valor de recoverbalancegroup*/ +public String getRecoverbalancegroup(){ + return recoverbalancegroup; +} +/**Fija el valor de recoverbalancegroup +@param pRecoverbalancegroup nuevo Valor de recoverbalancegroup*/ +public void setRecoverbalancegroup(String pRecoverbalancegroup){ + recoverbalancegroup=pRecoverbalancegroup; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de priority +@return valor de priority*/ +public Integer getPriority(){ + return priority; +} +/**Fija el valor de priority +@param pPriority nuevo Valor de priority*/ +public void setPriority(Integer pPriority){ + priority=pPriority; +} + +/**Obtiene el valor de ispartial +@return valor de ispartial*/ +public String getIspartial(){ + return ispartial; +} +/**Fija el valor de ispartial +@param pIspartial nuevo Valor de ispartial*/ +public void setIspartial(String pIspartial){ + ispartial=pIspartial; +} + +/**Obtiene el valor de minimunpayment +@return valor de minimunpayment*/ +public BigDecimal getMinimunpayment(){ + return minimunpayment; +} +/**Fija el valor de minimunpayment +@param pMinimunpayment nuevo Valor de minimunpayment*/ +public void setMinimunpayment(BigDecimal pMinimunpayment){ + minimunpayment=pMinimunpayment; +} + +/**Obtiene el valor de term +@return valor de term*/ +public Integer getTerm(){ + return term; +} +/**Fija el valor de term +@param pTerm nuevo Valor de term*/ +public void setTerm(Integer pTerm){ + term=pTerm; +} + +/**Obtiene el valor de managecache +@return valor de managecache*/ +public String getManagecache(){ + return managecache; +} +/**Fija el valor de managecache +@param pManagecache nuevo Valor de managecache*/ +public void setManagecache(String pManagecache){ + managecache=pManagecache; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TreceivableTemplateDetail))return false; + TreceivableTemplateDetail that = (TreceivableTemplateDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TreceivableTemplateDetail +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TreceivableTemplateDetail +*/ +public Object createInstance(){ + TreceivableTemplateDetail instance=new TreceivableTemplateDetail(); + return instance; +} +/**Clona la entidad TreceivableTemplateDetail +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TreceivableTemplateDetail p=(TreceivableTemplateDetail)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/.svn/text-base/TreceivableTemplateDetailKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/.svn/text-base/TreceivableTemplateDetailKey.java.svn-base new file mode 100644 index 0000000..bde5643 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/.svn/text-base/TreceivableTemplateDetailKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.receive; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TRECEIVABLETEMPLATEDETAIL*/ +@Embeddable +public class TreceivableTemplateDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TEMPLATECODE", nullable=false,updatable=false) + +/** +* Cdigo de plantilla de cuentas por cobrar. +*/ +private Integer templatecode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TreceivableTemplateDetailKey(){} +/**Contructor de TreceivableTemplateDetailKey +@param pTemplatecode Cdigo de plantilla de cuentas por cobrar. +@param pCompanycode Codigo de compania +*/ +public TreceivableTemplateDetailKey(Integer pTemplatecode,Integer pCompanycode){ + templatecode=pTemplatecode; + companycode=pCompanycode; +} +/**Obtiene el valor de templatecode +@return valor de templatecode*/ +public Integer getTemplatecode(){ + return templatecode; +} +/**Fija el valor de templatecode +@param pTemplatecode nuevo Valor de templatecode*/ +public void setTemplatecode(Integer pTemplatecode){ + templatecode=pTemplatecode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacin de la comparacin de TreceivableTemplateDetailKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TreceivableTemplateDetailKey))return false; + TreceivableTemplateDetailKey that = (TreceivableTemplateDetailKey) o; + if (this.getTemplatecode() == null || that.getTemplatecode() == null){ + return false; + } + if (! this.getTemplatecode().equals(that.getTemplatecode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TreceivableTemplateDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTemplatecode() == null ? 0 : this.getTemplatecode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/TreceivableTemplate.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/TreceivableTemplate.java new file mode 100644 index 0000000..b8d8695 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/TreceivableTemplate.java @@ -0,0 +1,176 @@ +package com.fp.persistence.pgeneral.receive; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TRECEIVABLETEMPLATE*/ +@Entity(name="TreceivableTemplate") +@Table(name="TRECEIVABLETEMPLATE") +public class TreceivableTemplate extends com.fp.dto.AbstractDataBalanceTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TreceivableTemplate +*/ +@Id +@Column(name="TEMPLATECODE" ,nullable=false, updatable=false) +private Integer pk; +@Column(name="MODULECODE", nullable=true) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistik locking del registro. +*/ +private Integer recordversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion de la cuenta por cobrar. +*/ +private String description; + +/**Contructor por defecto*/ +public TreceivableTemplate(){ +} +/**Contructor de TreceivableTemplate +@param pPk Clave Primaria del entity +*/ +public TreceivableTemplate(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TreceivableTemplate +*/ +public static TreceivableTemplate find(EntityManager pEntityManager,Object pKey) throws Exception{ + TreceivableTemplate obj = pEntityManager.find(TreceivableTemplate.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TreceivableTemplate +@return El objeto que referencia a la Clave primaria de TreceivableTemplate +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TreceivableTemplate +@param pPk El objeto que referencia a la nueva Clave primaria de TreceivableTemplate +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TreceivableTemplate))return false; + TreceivableTemplate that = (TreceivableTemplate) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TreceivableTemplate +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TreceivableTemplate +*/ +public Object createInstance(){ + TreceivableTemplate instance=new TreceivableTemplate(); + return instance; +} +/**Clona la entidad TreceivableTemplate +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TreceivableTemplate p=(TreceivableTemplate)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/TreceivableTemplateDesc.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/TreceivableTemplateDesc.java new file mode 100644 index 0000000..4d3fc2f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/TreceivableTemplateDesc.java @@ -0,0 +1,159 @@ +package com.fp.persistence.pgeneral.receive; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TRECEIVABLETEMPLATEDESC*/ +@Entity(name="TreceivableTemplateDesc") +@Table(name="TRECEIVABLETEMPLATEDESC") +public class TreceivableTemplateDesc extends com.fp.dto.AbstractDataBalanceTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TreceivableTemplateDesc +*/ +@EmbeddedId +private TreceivableTemplateDescKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistick loking del registro +*/ +private Integer recordversion; + +@Column(name="DESCRIPCTION", nullable=true) + +/** +* Descripcion del codigo de plantilla de cuenta por cobrar. +*/ +private String descripction; + +/**Contructor por defecto*/ +public TreceivableTemplateDesc(){ +} +/**Contructor de TreceivableTemplateDesc +@param pPk Clave Primaria del entity +*/ +public TreceivableTemplateDesc(TreceivableTemplateDescKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TreceivableTemplateDesc +*/ +public static TreceivableTemplateDesc find(EntityManager pEntityManager,TreceivableTemplateDescKey pKey) throws Exception{ + TreceivableTemplateDesc obj = pEntityManager.find(TreceivableTemplateDesc.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TreceivableTemplateDesc +@return El objeto que referencia a la Clave primaria de TreceivableTemplateDesc +*/ +public TreceivableTemplateDescKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TreceivableTemplateDesc +@param pPk El objeto que referencia a la nueva Clave primaria de TreceivableTemplateDesc +*/ +public void setPk(TreceivableTemplateDescKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de descripction +@return valor de descripction*/ +public String getDescripction(){ + return descripction; +} +/**Fija el valor de descripction +@param pDescripction nuevo Valor de descripction*/ +public void setDescripction(String pDescripction){ + descripction=pDescripction; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TreceivableTemplateDesc))return false; + TreceivableTemplateDesc that = (TreceivableTemplateDesc) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TreceivableTemplateDesc +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TreceivableTemplateDesc +*/ +public Object createInstance(){ + TreceivableTemplateDesc instance=new TreceivableTemplateDesc(); + instance.setPk(new TreceivableTemplateDescKey()); + return instance; +} +/**Clona la entidad TreceivableTemplateDesc +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TreceivableTemplateDesc p=(TreceivableTemplateDesc)this.clone(); + p.setPk((TreceivableTemplateDescKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/TreceivableTemplateDescKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/TreceivableTemplateDescKey.java new file mode 100644 index 0000000..32c92eb --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/TreceivableTemplateDescKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.receive; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TRECEIVABLETEMPLATEDESC*/ +@Embeddable +public class TreceivableTemplateDescKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TEMPLATECODE", nullable=false,updatable=false) + +/** +* Cdigo de plantilla de cuentas por cobrar. +*/ +private Integer templatecode; + +@Column(name="LANGUAGECODE", nullable=false,updatable=false) + +/** +* Codigo de idioma +*/ +private String languagecode; + +/**Contructor por defecto*/ +public TreceivableTemplateDescKey(){} +/**Contructor de TreceivableTemplateDescKey +@param pTemplatecode Cdigo de plantilla de cuentas por cobrar. +@param pLanguagecode Codigo de idioma +*/ +public TreceivableTemplateDescKey(Integer pTemplatecode,String pLanguagecode){ + templatecode=pTemplatecode; + languagecode=pLanguagecode; +} +/**Obtiene el valor de templatecode +@return valor de templatecode*/ +public Integer getTemplatecode(){ + return templatecode; +} +/**Fija el valor de templatecode +@param pTemplatecode nuevo Valor de templatecode*/ +public void setTemplatecode(Integer pTemplatecode){ + templatecode=pTemplatecode; +} + +/**Obtiene el valor de languagecode +@return valor de languagecode*/ +public String getLanguagecode(){ + return languagecode; +} +/**Fija el valor de languagecode +@param pLanguagecode nuevo Valor de languagecode*/ +public void setLanguagecode(String pLanguagecode){ + languagecode=pLanguagecode; +} + +/**Implementacin de la comparacin de TreceivableTemplateDescKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TreceivableTemplateDescKey))return false; + TreceivableTemplateDescKey that = (TreceivableTemplateDescKey) o; + if (this.getTemplatecode() == null || that.getTemplatecode() == null){ + return false; + } + if (! this.getTemplatecode().equals(that.getTemplatecode())){ + return false; + } + if (this.getLanguagecode() == null || that.getLanguagecode() == null){ + return false; + } + if (! this.getLanguagecode().equals(that.getLanguagecode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TreceivableTemplateDescKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTemplatecode() == null ? 0 : this.getTemplatecode().hashCode()); + result = result * 37 + (this.getLanguagecode() == null ? 0 : this.getLanguagecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/TreceivableTemplateDetail.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/TreceivableTemplateDetail.java new file mode 100644 index 0000000..831206f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/TreceivableTemplateDetail.java @@ -0,0 +1,307 @@ +package com.fp.persistence.pgeneral.receive; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TRECEIVABLETEMPLATEDETAIL*/ +@Entity(name="TreceivableTemplateDetail") +@Table(name="TRECEIVABLETEMPLATEDETAIL") +public class TreceivableTemplateDetail extends com.fp.dto.AbstractDataBalanceTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TreceivableTemplateDetail +*/ +@Id +@Column(name="TEMPLATECODE" ,nullable=false, updatable=false) +private Integer pk; +@Column(name="BALANCETYPE", nullable=false) + +/** +* Cdigo de tipo de saldo d registro de la CXC. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +@Column(name="RECOVERBALANCETYPE", nullable=true) + +/** +* Cdigo de tipo de saldo d cobro de la CXC. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String recoverbalancetype; + +@Column(name="RECOVERBALANCEGROUP", nullable=true) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String recoverbalancegroup; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="PRIORITY", nullable=true) + +/** +* Prioridad de cobro de la cuenta por cobrar dentro del dia +*/ +private Integer priority; + +@Column(name="ISPARTIAL", nullable=true) + +/** +* Indica si permite cobros parciales de cuenta por cobrar. +*/ +private String ispartial; + +@Column(name="MINIMUNPAYMENT", nullable=true) + +/** +* Si permite cobro parcial cual es el valor minimo a cobrar. +*/ +private BigDecimal minimunpayment; + +@Column(name="TERM", nullable=true) + +/** +* Plazo de vigencia de la cuenta por cobrar, al vencimiento se da de baja la cxc +*/ +private Integer term; + +@Column(name="MANAGECACHE", nullable=true) + +/** +* Indica si el registro de plantilla se almacena en cache en el servidor de aplicaciones +*/ +private String managecache; + +/**Contructor por defecto*/ +public TreceivableTemplateDetail(){ +} +/**Contructor de TreceivableTemplateDetail +@param pPk Clave Primaria del entity +@param pBalancetype Cdigo de tipo de saldo d registro de la CXC. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +public TreceivableTemplateDetail(Integer pPk,String pBalancetype,String pBalancegroup){ + this(); + pk=pPk; + balancetype=pBalancetype; + balancegroup=pBalancegroup; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TreceivableTemplateDetail +*/ +public static TreceivableTemplateDetail find(EntityManager pEntityManager,Object pKey) throws Exception{ + TreceivableTemplateDetail obj = pEntityManager.find(TreceivableTemplateDetail.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TreceivableTemplateDetail +@return El objeto que referencia a la Clave primaria de TreceivableTemplateDetail +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TreceivableTemplateDetail +@param pPk El objeto que referencia a la nueva Clave primaria de TreceivableTemplateDetail +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Obtiene el valor de recoverbalancetype +@return valor de recoverbalancetype*/ +public String getRecoverbalancetype(){ + return recoverbalancetype; +} +/**Fija el valor de recoverbalancetype +@param pRecoverbalancetype nuevo Valor de recoverbalancetype*/ +public void setRecoverbalancetype(String pRecoverbalancetype){ + recoverbalancetype=pRecoverbalancetype; +} + +/**Obtiene el valor de recoverbalancegroup +@return valor de recoverbalancegroup*/ +public String getRecoverbalancegroup(){ + return recoverbalancegroup; +} +/**Fija el valor de recoverbalancegroup +@param pRecoverbalancegroup nuevo Valor de recoverbalancegroup*/ +public void setRecoverbalancegroup(String pRecoverbalancegroup){ + recoverbalancegroup=pRecoverbalancegroup; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de priority +@return valor de priority*/ +public Integer getPriority(){ + return priority; +} +/**Fija el valor de priority +@param pPriority nuevo Valor de priority*/ +public void setPriority(Integer pPriority){ + priority=pPriority; +} + +/**Obtiene el valor de ispartial +@return valor de ispartial*/ +public String getIspartial(){ + return ispartial; +} +/**Fija el valor de ispartial +@param pIspartial nuevo Valor de ispartial*/ +public void setIspartial(String pIspartial){ + ispartial=pIspartial; +} + +/**Obtiene el valor de minimunpayment +@return valor de minimunpayment*/ +public BigDecimal getMinimunpayment(){ + return minimunpayment; +} +/**Fija el valor de minimunpayment +@param pMinimunpayment nuevo Valor de minimunpayment*/ +public void setMinimunpayment(BigDecimal pMinimunpayment){ + minimunpayment=pMinimunpayment; +} + +/**Obtiene el valor de term +@return valor de term*/ +public Integer getTerm(){ + return term; +} +/**Fija el valor de term +@param pTerm nuevo Valor de term*/ +public void setTerm(Integer pTerm){ + term=pTerm; +} + +/**Obtiene el valor de managecache +@return valor de managecache*/ +public String getManagecache(){ + return managecache; +} +/**Fija el valor de managecache +@param pManagecache nuevo Valor de managecache*/ +public void setManagecache(String pManagecache){ + managecache=pManagecache; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TreceivableTemplateDetail))return false; + TreceivableTemplateDetail that = (TreceivableTemplateDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TreceivableTemplateDetail +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TreceivableTemplateDetail +*/ +public Object createInstance(){ + TreceivableTemplateDetail instance=new TreceivableTemplateDetail(); + return instance; +} +/**Clona la entidad TreceivableTemplateDetail +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TreceivableTemplateDetail p=(TreceivableTemplateDetail)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/TreceivableTemplateDetailKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/TreceivableTemplateDetailKey.java new file mode 100644 index 0000000..bde5643 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/TreceivableTemplateDetailKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.receive; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TRECEIVABLETEMPLATEDETAIL*/ +@Embeddable +public class TreceivableTemplateDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TEMPLATECODE", nullable=false,updatable=false) + +/** +* Cdigo de plantilla de cuentas por cobrar. +*/ +private Integer templatecode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TreceivableTemplateDetailKey(){} +/**Contructor de TreceivableTemplateDetailKey +@param pTemplatecode Cdigo de plantilla de cuentas por cobrar. +@param pCompanycode Codigo de compania +*/ +public TreceivableTemplateDetailKey(Integer pTemplatecode,Integer pCompanycode){ + templatecode=pTemplatecode; + companycode=pCompanycode; +} +/**Obtiene el valor de templatecode +@return valor de templatecode*/ +public Integer getTemplatecode(){ + return templatecode; +} +/**Fija el valor de templatecode +@param pTemplatecode nuevo Valor de templatecode*/ +public void setTemplatecode(Integer pTemplatecode){ + templatecode=pTemplatecode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacin de la comparacin de TreceivableTemplateDetailKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TreceivableTemplateDetailKey))return false; + TreceivableTemplateDetailKey that = (TreceivableTemplateDetailKey) o; + if (this.getTemplatecode() == null || that.getTemplatecode() == null){ + return false; + } + if (! this.getTemplatecode().equals(that.getTemplatecode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TreceivableTemplateDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTemplatecode() == null ? 0 : this.getTemplatecode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/acco/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/acco/.svn/entries new file mode 100644 index 0000000..bac6ce9 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/acco/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/acco +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TreceivableAccountDemanDepo.java +file + + + + +2022-07-28T03:40:29.225745Z +f53c21b96794b0f91cea0fdfb3c6ed4e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +22415 + +TreceivableAccountDemanDepoKey.java +file + + + + +2022-07-28T03:40:29.225745Z +1dc8be90075916d717aff7d5f59ff24f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6202 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/acco/.svn/text-base/TreceivableAccountDemanDepo.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/acco/.svn/text-base/TreceivableAccountDemanDepo.java.svn-base new file mode 100644 index 0000000..547fc24 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/acco/.svn/text-base/TreceivableAccountDemanDepo.java.svn-base @@ -0,0 +1,757 @@ +package com.fp.persistence.pgeneral.receive.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TRECEIVABLEACCOUNTDEMANDEPO */ +@Entity(name = "TreceivableAccountDemanDepo") +@Table(name = "TRECEIVABLEACCOUNTDEMANDEPO") +public class TreceivableAccountDemanDepo extends com.fp.dto.AbstractDataBalanceTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TreceivableAccountDemanDepo + */ + @EmbeddedId + private TreceivableAccountDemanDepoKey pk; + + @Column(name = "DATEFROM", nullable = false) + /** + * Fecha desde la cual esta vigente el registro de la cuenta por cobrar + */ + private Timestamp datefrom; + + @Column(name = "ACCOUNTINGDATE", nullable = true) + /** + * Fecha contable con la que se crea la cuenta por cobrar + */ + private Date accountingdate; + + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + + @Column(name = "BALANCETYPE", nullable = true) + /** + * Cdigo de tipo de saldo de registro de la CXC. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc + */ + private String balancetype; + + @Column(name = "BALANCEGROUP", nullable = true) + /** + * Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor + */ + private String balancegroup; + + @Column(name = "RECOVERBALANCETYPE", nullable = true) + /** + * Cdigo de tipo de saldo de cobro de la CXC. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc + */ + private String recoverbalancetype; + + @Column(name = "RECOVERBALANCEGROUP", nullable = true) + /** + * Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor + */ + private String recoverbalancegroup; + + @Column(name = "PRIORITY", nullable = true) + /** + * Prioridad de cobro de la cuenta por cobrar dentro en el dia + */ + private Integer priority; + + @Column(name = "ISPARTIAL", nullable = true) + /** + * Indica si la cuenta por cobrar permite cobros parciales + */ + private String ispartial; + + @Column(name = "MINIMUMPAYMENT", nullable = true) + /** + * Si permite cobros parciales, Valor minimo de cobro + */ + private BigDecimal minimumpayment; + + @Column(name = "EXPIREDATE", nullable = true) + /** + * Fecha de vencimiento de la cuenta por cobrar. + */ + private Date expiredate; + + @Column(name = "MESSAGE", nullable = true) + /** + * Numero de mensaje con el cual se realizo la ultima transaccin en la cuenta. + */ + private String message; + + @Column(name = "ORIGINALMESSAGE", nullable = true) + /** + * Numero de mensaje con el cual se creo la cuenta por cobrar. + */ + private String originalmessage; + + @Column(name = "REVERSEMESSAGE", nullable = true) + /** + * Numero de mensaje de reverso de la cuenta por cobrar. + */ + private String reversemessage; + + @Column(name = "REVERSE", nullable = true) + /** + * Indica si la cuenta por cobrar esta reversada. + */ + private String reverse; + + @Column(name = "ORIGINALAMOUNT", nullable = true) + /** + * Monto original + */ + private BigDecimal originalamount; + + @Column(name = "PENDINGAMOUNT", nullable = true) + /** + * Monto pendiente de pago + */ + private BigDecimal pendingamount; + + @Column(name = "LASTPAYAMOUNT", nullable = true) + /** + * Ultimo monto pagado + */ + private BigDecimal lastpayamount; + + @Column(name = "LASTPAY", nullable = true) + /** + * Fecha de ultimo pago + */ + private Date lastpay; + + @Column(name = "DESCRIPTION", nullable = true) + /** + * Glosa de la cuenta por cobrar. + */ + private String description; + + /** Contructor por defecto */ + public TreceivableAccountDemanDepo() { + } + + /** + * Contructor de TreceivableAccountDemanDepo + * + * @param pPk Clave Primaria del entity + * @param pDatefrom Fecha desde la cual esta vigente el registro de la cuenta por cobrar + */ + public TreceivableAccountDemanDepo(TreceivableAccountDemanDepoKey pPk, Timestamp pDatefrom) { + this(); + pk = pPk; + datefrom = pDatefrom; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TreceivableAccountDemanDepo + */ + public static TreceivableAccountDemanDepo find(EntityManager pEntityManager, TreceivableAccountDemanDepoKey pKey) throws Exception { + TreceivableAccountDemanDepo obj = pEntityManager.find(TreceivableAccountDemanDepo.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TreceivableAccountDemanDepo + * + * @return El objeto que referencia a la Clave primaria de TreceivableAccountDemanDepo + */ + public TreceivableAccountDemanDepoKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TreceivableAccountDemanDepo + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TreceivableAccountDemanDepo + */ + public void setPk(TreceivableAccountDemanDepoKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + datefrom = pDatefrom; + } + + /** + * Obtiene el valor de accountingdate + * + * @return valor de accountingdate + */ + public Date getAccountingdate() { + return accountingdate; + } + + /** + * Fija el valor de accountingdate + * + * @param pAccountingdate nuevo Valor de accountingdate + */ + public void setAccountingdate(Date pAccountingdate) { + accountingdate = pAccountingdate; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de balancetype + * + * @return valor de balancetype + */ + public String getBalancetype() { + return balancetype; + } + + /** + * Fija el valor de balancetype + * + * @param pBalancetype nuevo Valor de balancetype + */ + public void setBalancetype(String pBalancetype) { + balancetype = pBalancetype; + } + + /** + * Obtiene el valor de balancegroup + * + * @return valor de balancegroup + */ + public String getBalancegroup() { + return balancegroup; + } + + /** + * Fija el valor de balancegroup + * + * @param pBalancegroup nuevo Valor de balancegroup + */ + public void setBalancegroup(String pBalancegroup) { + balancegroup = pBalancegroup; + } + + /** + * Obtiene el valor de recoverbalancetype + * + * @return valor de recoverbalancetype + */ + public String getRecoverbalancetype() { + return recoverbalancetype; + } + + /** + * Fija el valor de recoverbalancetype + * + * @param pRecoverbalancetype nuevo Valor de recoverbalancetype + */ + public void setRecoverbalancetype(String pRecoverbalancetype) { + recoverbalancetype = pRecoverbalancetype; + } + + /** + * Obtiene el valor de recoverbalancegroup + * + * @return valor de recoverbalancegroup + */ + public String getRecoverbalancegroup() { + return recoverbalancegroup; + } + + /** + * Fija el valor de recoverbalancegroup + * + * @param pRecoverbalancegroup nuevo Valor de recoverbalancegroup + */ + public void setRecoverbalancegroup(String pRecoverbalancegroup) { + recoverbalancegroup = pRecoverbalancegroup; + } + + /** + * Obtiene el valor de priority + * + * @return valor de priority + */ + public Integer getPriority() { + return priority; + } + + /** + * Fija el valor de priority + * + * @param pPriority nuevo Valor de priority + */ + public void setPriority(Integer pPriority) { + priority = pPriority; + } + + /** + * Obtiene el valor de ispartial + * + * @return valor de ispartial + */ + public String getIspartial() { + return ispartial; + } + + /** + * Fija el valor de ispartial + * + * @param pIspartial nuevo Valor de ispartial + */ + public void setIspartial(String pIspartial) { + ispartial = pIspartial; + } + + /** + * Obtiene el valor de minimumpayment + * + * @return valor de minimumpayment + */ + public BigDecimal getMinimumpayment() { + return minimumpayment; + } + + /** + * Fija el valor de minimumpayment + * + * @param pMinimumpayment nuevo Valor de minimumpayment + */ + public void setMinimumpayment(BigDecimal pMinimumpayment) { + minimumpayment = pMinimumpayment; + } + + /** + * Obtiene el valor de expiredate + * + * @return valor de expiredate + */ + public Date getExpiredate() { + return expiredate; + } + + /** + * Fija el valor de expiredate + * + * @param pExpiredate nuevo Valor de expiredate + */ + public void setExpiredate(Date pExpiredate) { + expiredate = pExpiredate; + } + + /** + * Obtiene el valor de message + * + * @return valor de message + */ + public String getMessage() { + return message; + } + + /** + * Fija el valor de message + * + * @param pMessage nuevo Valor de message + */ + public void setMessage(String pMessage) { + message = pMessage; + } + + /** + * Obtiene el valor de originalmessage + * + * @return valor de originalmessage + */ + public String getOriginalmessage() { + return originalmessage; + } + + /** + * Fija el valor de originalmessage + * + * @param pOriginalmessage nuevo Valor de originalmessage + */ + public void setOriginalmessage(String pOriginalmessage) { + originalmessage = pOriginalmessage; + } + + /** + * Obtiene el valor de reversemessage + * + * @return valor de reversemessage + */ + public String getReversemessage() { + return reversemessage; + } + + /** + * Fija el valor de reversemessage + * + * @param pReversemessage nuevo Valor de reversemessage + */ + public void setReversemessage(String pReversemessage) { + reversemessage = pReversemessage; + } + + /** + * Obtiene el valor de reverse + * + * @return valor de reverse + */ + public String getReverse() { + return reverse; + } + + /** + * Fija el valor de reverse + * + * @param pReverse nuevo Valor de reverse + */ + public void setReverse(String pReverse) { + reverse = pReverse; + } + + /** + * Obtiene el valor de originalamount + * + * @return valor de originalamount + */ + public BigDecimal getOriginalamount() { + return originalamount; + } + + /** + * Fija el valor de originalamount + * + * @param pOriginalamount nuevo Valor de originalamount + */ + public void setOriginalamount(BigDecimal pOriginalamount) { + originalamount = pOriginalamount; + } + + /** + * Obtiene el valor de pendingamount + * + * @return valor de pendingamount + */ + public BigDecimal getPendingamount() { + return pendingamount; + } + + /** + * Fija el valor de pendingamount + * + * @param pPendingamount nuevo Valor de pendingamount + */ + public void setPendingamount(BigDecimal pPendingamount) { + pendingamount = pPendingamount; + } + + /** + * Obtiene el valor de lastpayamount + * + * @return valor de lastpayamount + */ + public BigDecimal getLastpayamount() { + return lastpayamount; + } + + /** + * Fija el valor de lastpayamount + * + * @param pLastpayamount nuevo Valor de lastpayamount + */ + public void setLastpayamount(BigDecimal pLastpayamount) { + lastpayamount = pLastpayamount; + } + + /** + * Obtiene el valor de lastpay + * + * @return valor de lastpay + */ + public Date getLastpay() { + return lastpay; + } + + /** + * Fija el valor de lastpay + * + * @param pLastpay nuevo Valor de lastpay + */ + public void setLastpay(Date pLastpay) { + lastpay = pLastpay; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TreceivableAccountDemanDepo)) + return false; + TreceivableAccountDemanDepo that = (TreceivableAccountDemanDepo) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TreceivableAccountDemanDepo + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TreceivableAccountDemanDepo */ + public Object createInstance() { + TreceivableAccountDemanDepo instance = new TreceivableAccountDemanDepo(); + instance.setPk(new TreceivableAccountDemanDepoKey()); + return instance; + } + + /** + * Clona la entidad TreceivableAccountDemanDepo + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TreceivableAccountDemanDepo p = (TreceivableAccountDemanDepo) this.clone(); + p.setPk((TreceivableAccountDemanDepoKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + + //Metodos manuales. + + /**Sentencia que obtiene una lista de TreceivableAccount dado un numero de mensaje. */ + private static final String HQL_MSG = "from TreceivableAccountDemanDepo t " + + " where t.message = :message" ; + + /** + * Entrega una lista de TreceivableAccount dado un numeor de mensaje. + * @param pEntityManager Referencia a la session de base de datos. + * @param pMessage Numero de mensaje a buscar registros de TreceivableAccount + * @return List + */ + @SuppressWarnings("unchecked") + public static List findByMessage(EntityManager pEntityManager,String pMessage) { + List ldata = null; + Query qry = pEntityManager.createQuery(HQL_MSG); + qry.setParameter("message", pMessage); + ldata = qry.getResultList(); + return ldata; + } + + + /**Sentencia que obtiene una lista de TreceivableAccount dado un numero de mensaje orgiginal. */ + private static final String HQL_ORIMSG = "from TreceivableAccountDemanDepo t " + + " where t.originalmessage = :originalmessage "+ + " and t.message != t.originalmessage "; + + /** + * Entrega una lista de TreceivableAccount dado un numeor de mensaje original. + * @param pEntityManager Referencia a la session de base de datos. + * @param pMessage Numero de mensaje a buscar registros de TreceivableAccount + * @return List + */ + @SuppressWarnings("unchecked") + public static List findByOriginalMessage(EntityManager pEntityManager,String pMessage) { + List ldata = null; + Query qry = pEntityManager.createQuery(HQL_ORIMSG); + qry.setParameter("originalmessage", pMessage); + ldata = qry.getResultList(); + return ldata; + } + + + /** Sentencia que devuelve una lista de cuentas por cobrar, pendientes de pago.*/ + private static String HQL_RECOVERY = " from TreceivableAccountDemanDepo ra "+ + " where ra.pk.account = :account "+ + " and ra.pk.dateto = :dateto "+ + " and ra.pk.company = :company "+ + " and ra.pk.partitiondb = :partition "+ + " and ra.expiredate >= :accountingdate"+ + " and ra.pendingamount > 0 "+ + " order by ra.priority,ra.pk.creationdate "; + + /** + * Metodo que entrega una lista de cuenta por pagar pendientes de pago. + * @param pEntityManager Referencia a una session de base de datos. + * @param pAccount Numero de cuenta por cobrar. + * @param pCompany Codido de compania asociada a la cuenta por cobrar. + * @param pAccountingDate Fecha contable. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager,String pAccount,Integer pCompany, + Date pAccountingDate) throws Exception { + List ldata = null; + Query qry = pEntityManager.createQuery(HQL_RECOVERY); + qry.setParameter("account", pAccount); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + qry.setParameter("company", pCompany); + qry.setParameter("partition", Constant.getPartition(Constant.getDefaultExpiryDate())); + qry.setParameter("accountingdate", pAccountingDate); + ldata = qry.getResultList(); + return ldata; + } + + /** Sentencia que devuelve un registro de la cuenta por pagar vigente, para la cuenta tipo de saldo grupo balance.*/ + private static String HQL_VIGENT = " from TreceivableAccountDemanDepo ra "+ + " where ra.pk.account = :account "+ + " and ra.pk.dateto = :dateto "+ + " and ra.pk.company = :company "+ + " and ra.pk.partitiondb = :partition "+ + " and ra.balancetype >= :balancetype "+ + " and ra.balancegroup >= :balancegroup "; + + /** + * Metodo que entrega una datos de cuenta por pagar dada la cuenta, tipo de saldo grupo de balance. + * @param pEntityManager Referencia a una session de base de datos. + * @param pAccount Numero de cuenta por cobrar. + * @param pCompany Codido de compania asociada a la cuenta por cobrar. + * @param pBalanceType Tipo de saldo. + * @param pBalanceGroup Grupo de balance. + * @return TreceivableAccount + * @throws Exception + */ + public static TreceivableAccountDemanDepo findVigent(EntityManager pEntityManager,String pAccount,Integer pCompany, + String pBalanceType,String pBalanceGroup) throws Exception { + TreceivableAccountDemanDepo obj = null; + Query qry = pEntityManager.createQuery(HQL_VIGENT); + qry.setParameter("account", pAccount); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + qry.setParameter("company", pCompany); + qry.setParameter("partition", Constant.getPartition(Constant.getDefaultExpiryDate())); + qry.setParameter("balancetype", pBalanceType); + qry.setParameter("balancegroup", pBalanceGroup); + try { + obj = (TreceivableAccountDemanDepo)qry.getSingleResult(); + } catch (NoResultException e) { + return obj; + } + return obj; + } + + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/acco/.svn/text-base/TreceivableAccountDemanDepoKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/acco/.svn/text-base/TreceivableAccountDemanDepoKey.java.svn-base new file mode 100644 index 0000000..dc37a24 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/acco/.svn/text-base/TreceivableAccountDemanDepoKey.java.svn-base @@ -0,0 +1,210 @@ +package com.fp.persistence.pgeneral.receive.acco; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TRECEIVABLEACCOUNTDEMANDEPO*/ +@Embeddable +public class TreceivableAccountDemanDepoKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro de cuenta por cobrar. +*/ +private Timestamp dateto; + +@Column(name="CREATIONDATE", nullable=false,updatable=false) + +/** +* Timestamp de fecha de creacin de cuentas por cobrar. +*/ +private Timestamp creationdate; + +@Column(name="PARTITIONDB", nullable=false,updatable=false) + +/** +* Ao mes de la fecha hasta la cual esta vigente un registro de cuenta por cobrar. +*/ +private String partitiondb; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +/**Contructor por defecto*/ +public TreceivableAccountDemanDepoKey(){} +/**Contructor de TreceivableAccountDemanDepoKey +@param pAccount Numero de cuenta +@param pDateto Fecha hasta la cual esta vigente el registro de cuenta por cobrar. +@param pCreationdate Timestamp de fecha de creacin de cuentas por cobrar. +@param pPartitiondb Ao mes de la fecha hasta la cual esta vigente un registro de cuenta por cobrar. +@param pCompany Codigo de compania a la que pertence la cuenta +*/ +public TreceivableAccountDemanDepoKey(String pAccount,Timestamp pDateto,Timestamp pCreationdate,String pPartitiondb,Integer pCompany){ + account=pAccount; + dateto=pDateto; + creationdate=pCreationdate; + partitiondb=pPartitiondb; + company=pCompany; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de creationdate +@return valor de creationdate*/ +public Timestamp getCreationdate(){ + return creationdate; +} +/**Fija el valor de creationdate +@param pCreationdate nuevo Valor de creationdate*/ +public void setCreationdate(Timestamp pCreationdate){ + creationdate=pCreationdate; +} + +/**Obtiene el valor de partitiondb +@return valor de partitiondb*/ +public String getPartitiondb(){ + return partitiondb; +} +/**Fija el valor de partitiondb +@param pPartitiondb nuevo Valor de partitiondb*/ +public void setPartitiondb(String pPartitiondb){ + partitiondb=pPartitiondb; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Implementacin de la comparacin de TreceivableAccountDemanDepoKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TreceivableAccountDemanDepoKey))return false; + TreceivableAccountDemanDepoKey that = (TreceivableAccountDemanDepoKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getCreationdate() == null || that.getCreationdate() == null){ + return false; + } + if (! this.getCreationdate().equals(that.getCreationdate())){ + return false; + } + if (this.getPartitiondb() == null || that.getPartitiondb() == null){ + return false; + } + if (! this.getPartitiondb().equals(that.getPartitiondb())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TreceivableAccountDemanDepoKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getCreationdate() == null ? 0 : this.getCreationdate().hashCode()); + result = result * 37 + (this.getPartitiondb() == null ? 0 : this.getPartitiondb().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/acco/TreceivableAccountDemanDepo.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/acco/TreceivableAccountDemanDepo.java new file mode 100644 index 0000000..547fc24 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/acco/TreceivableAccountDemanDepo.java @@ -0,0 +1,757 @@ +package com.fp.persistence.pgeneral.receive.acco; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TRECEIVABLEACCOUNTDEMANDEPO */ +@Entity(name = "TreceivableAccountDemanDepo") +@Table(name = "TRECEIVABLEACCOUNTDEMANDEPO") +public class TreceivableAccountDemanDepo extends com.fp.dto.AbstractDataBalanceTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TreceivableAccountDemanDepo + */ + @EmbeddedId + private TreceivableAccountDemanDepoKey pk; + + @Column(name = "DATEFROM", nullable = false) + /** + * Fecha desde la cual esta vigente el registro de la cuenta por cobrar + */ + private Timestamp datefrom; + + @Column(name = "ACCOUNTINGDATE", nullable = true) + /** + * Fecha contable con la que se crea la cuenta por cobrar + */ + private Date accountingdate; + + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + + @Column(name = "BALANCETYPE", nullable = true) + /** + * Cdigo de tipo de saldo de registro de la CXC. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc + */ + private String balancetype; + + @Column(name = "BALANCEGROUP", nullable = true) + /** + * Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor + */ + private String balancegroup; + + @Column(name = "RECOVERBALANCETYPE", nullable = true) + /** + * Cdigo de tipo de saldo de cobro de la CXC. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc + */ + private String recoverbalancetype; + + @Column(name = "RECOVERBALANCEGROUP", nullable = true) + /** + * Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor + */ + private String recoverbalancegroup; + + @Column(name = "PRIORITY", nullable = true) + /** + * Prioridad de cobro de la cuenta por cobrar dentro en el dia + */ + private Integer priority; + + @Column(name = "ISPARTIAL", nullable = true) + /** + * Indica si la cuenta por cobrar permite cobros parciales + */ + private String ispartial; + + @Column(name = "MINIMUMPAYMENT", nullable = true) + /** + * Si permite cobros parciales, Valor minimo de cobro + */ + private BigDecimal minimumpayment; + + @Column(name = "EXPIREDATE", nullable = true) + /** + * Fecha de vencimiento de la cuenta por cobrar. + */ + private Date expiredate; + + @Column(name = "MESSAGE", nullable = true) + /** + * Numero de mensaje con el cual se realizo la ultima transaccin en la cuenta. + */ + private String message; + + @Column(name = "ORIGINALMESSAGE", nullable = true) + /** + * Numero de mensaje con el cual se creo la cuenta por cobrar. + */ + private String originalmessage; + + @Column(name = "REVERSEMESSAGE", nullable = true) + /** + * Numero de mensaje de reverso de la cuenta por cobrar. + */ + private String reversemessage; + + @Column(name = "REVERSE", nullable = true) + /** + * Indica si la cuenta por cobrar esta reversada. + */ + private String reverse; + + @Column(name = "ORIGINALAMOUNT", nullable = true) + /** + * Monto original + */ + private BigDecimal originalamount; + + @Column(name = "PENDINGAMOUNT", nullable = true) + /** + * Monto pendiente de pago + */ + private BigDecimal pendingamount; + + @Column(name = "LASTPAYAMOUNT", nullable = true) + /** + * Ultimo monto pagado + */ + private BigDecimal lastpayamount; + + @Column(name = "LASTPAY", nullable = true) + /** + * Fecha de ultimo pago + */ + private Date lastpay; + + @Column(name = "DESCRIPTION", nullable = true) + /** + * Glosa de la cuenta por cobrar. + */ + private String description; + + /** Contructor por defecto */ + public TreceivableAccountDemanDepo() { + } + + /** + * Contructor de TreceivableAccountDemanDepo + * + * @param pPk Clave Primaria del entity + * @param pDatefrom Fecha desde la cual esta vigente el registro de la cuenta por cobrar + */ + public TreceivableAccountDemanDepo(TreceivableAccountDemanDepoKey pPk, Timestamp pDatefrom) { + this(); + pk = pPk; + datefrom = pDatefrom; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TreceivableAccountDemanDepo + */ + public static TreceivableAccountDemanDepo find(EntityManager pEntityManager, TreceivableAccountDemanDepoKey pKey) throws Exception { + TreceivableAccountDemanDepo obj = pEntityManager.find(TreceivableAccountDemanDepo.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TreceivableAccountDemanDepo + * + * @return El objeto que referencia a la Clave primaria de TreceivableAccountDemanDepo + */ + public TreceivableAccountDemanDepoKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TreceivableAccountDemanDepo + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TreceivableAccountDemanDepo + */ + public void setPk(TreceivableAccountDemanDepoKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + datefrom = pDatefrom; + } + + /** + * Obtiene el valor de accountingdate + * + * @return valor de accountingdate + */ + public Date getAccountingdate() { + return accountingdate; + } + + /** + * Fija el valor de accountingdate + * + * @param pAccountingdate nuevo Valor de accountingdate + */ + public void setAccountingdate(Date pAccountingdate) { + accountingdate = pAccountingdate; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de balancetype + * + * @return valor de balancetype + */ + public String getBalancetype() { + return balancetype; + } + + /** + * Fija el valor de balancetype + * + * @param pBalancetype nuevo Valor de balancetype + */ + public void setBalancetype(String pBalancetype) { + balancetype = pBalancetype; + } + + /** + * Obtiene el valor de balancegroup + * + * @return valor de balancegroup + */ + public String getBalancegroup() { + return balancegroup; + } + + /** + * Fija el valor de balancegroup + * + * @param pBalancegroup nuevo Valor de balancegroup + */ + public void setBalancegroup(String pBalancegroup) { + balancegroup = pBalancegroup; + } + + /** + * Obtiene el valor de recoverbalancetype + * + * @return valor de recoverbalancetype + */ + public String getRecoverbalancetype() { + return recoverbalancetype; + } + + /** + * Fija el valor de recoverbalancetype + * + * @param pRecoverbalancetype nuevo Valor de recoverbalancetype + */ + public void setRecoverbalancetype(String pRecoverbalancetype) { + recoverbalancetype = pRecoverbalancetype; + } + + /** + * Obtiene el valor de recoverbalancegroup + * + * @return valor de recoverbalancegroup + */ + public String getRecoverbalancegroup() { + return recoverbalancegroup; + } + + /** + * Fija el valor de recoverbalancegroup + * + * @param pRecoverbalancegroup nuevo Valor de recoverbalancegroup + */ + public void setRecoverbalancegroup(String pRecoverbalancegroup) { + recoverbalancegroup = pRecoverbalancegroup; + } + + /** + * Obtiene el valor de priority + * + * @return valor de priority + */ + public Integer getPriority() { + return priority; + } + + /** + * Fija el valor de priority + * + * @param pPriority nuevo Valor de priority + */ + public void setPriority(Integer pPriority) { + priority = pPriority; + } + + /** + * Obtiene el valor de ispartial + * + * @return valor de ispartial + */ + public String getIspartial() { + return ispartial; + } + + /** + * Fija el valor de ispartial + * + * @param pIspartial nuevo Valor de ispartial + */ + public void setIspartial(String pIspartial) { + ispartial = pIspartial; + } + + /** + * Obtiene el valor de minimumpayment + * + * @return valor de minimumpayment + */ + public BigDecimal getMinimumpayment() { + return minimumpayment; + } + + /** + * Fija el valor de minimumpayment + * + * @param pMinimumpayment nuevo Valor de minimumpayment + */ + public void setMinimumpayment(BigDecimal pMinimumpayment) { + minimumpayment = pMinimumpayment; + } + + /** + * Obtiene el valor de expiredate + * + * @return valor de expiredate + */ + public Date getExpiredate() { + return expiredate; + } + + /** + * Fija el valor de expiredate + * + * @param pExpiredate nuevo Valor de expiredate + */ + public void setExpiredate(Date pExpiredate) { + expiredate = pExpiredate; + } + + /** + * Obtiene el valor de message + * + * @return valor de message + */ + public String getMessage() { + return message; + } + + /** + * Fija el valor de message + * + * @param pMessage nuevo Valor de message + */ + public void setMessage(String pMessage) { + message = pMessage; + } + + /** + * Obtiene el valor de originalmessage + * + * @return valor de originalmessage + */ + public String getOriginalmessage() { + return originalmessage; + } + + /** + * Fija el valor de originalmessage + * + * @param pOriginalmessage nuevo Valor de originalmessage + */ + public void setOriginalmessage(String pOriginalmessage) { + originalmessage = pOriginalmessage; + } + + /** + * Obtiene el valor de reversemessage + * + * @return valor de reversemessage + */ + public String getReversemessage() { + return reversemessage; + } + + /** + * Fija el valor de reversemessage + * + * @param pReversemessage nuevo Valor de reversemessage + */ + public void setReversemessage(String pReversemessage) { + reversemessage = pReversemessage; + } + + /** + * Obtiene el valor de reverse + * + * @return valor de reverse + */ + public String getReverse() { + return reverse; + } + + /** + * Fija el valor de reverse + * + * @param pReverse nuevo Valor de reverse + */ + public void setReverse(String pReverse) { + reverse = pReverse; + } + + /** + * Obtiene el valor de originalamount + * + * @return valor de originalamount + */ + public BigDecimal getOriginalamount() { + return originalamount; + } + + /** + * Fija el valor de originalamount + * + * @param pOriginalamount nuevo Valor de originalamount + */ + public void setOriginalamount(BigDecimal pOriginalamount) { + originalamount = pOriginalamount; + } + + /** + * Obtiene el valor de pendingamount + * + * @return valor de pendingamount + */ + public BigDecimal getPendingamount() { + return pendingamount; + } + + /** + * Fija el valor de pendingamount + * + * @param pPendingamount nuevo Valor de pendingamount + */ + public void setPendingamount(BigDecimal pPendingamount) { + pendingamount = pPendingamount; + } + + /** + * Obtiene el valor de lastpayamount + * + * @return valor de lastpayamount + */ + public BigDecimal getLastpayamount() { + return lastpayamount; + } + + /** + * Fija el valor de lastpayamount + * + * @param pLastpayamount nuevo Valor de lastpayamount + */ + public void setLastpayamount(BigDecimal pLastpayamount) { + lastpayamount = pLastpayamount; + } + + /** + * Obtiene el valor de lastpay + * + * @return valor de lastpay + */ + public Date getLastpay() { + return lastpay; + } + + /** + * Fija el valor de lastpay + * + * @param pLastpay nuevo Valor de lastpay + */ + public void setLastpay(Date pLastpay) { + lastpay = pLastpay; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TreceivableAccountDemanDepo)) + return false; + TreceivableAccountDemanDepo that = (TreceivableAccountDemanDepo) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TreceivableAccountDemanDepo + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TreceivableAccountDemanDepo */ + public Object createInstance() { + TreceivableAccountDemanDepo instance = new TreceivableAccountDemanDepo(); + instance.setPk(new TreceivableAccountDemanDepoKey()); + return instance; + } + + /** + * Clona la entidad TreceivableAccountDemanDepo + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TreceivableAccountDemanDepo p = (TreceivableAccountDemanDepo) this.clone(); + p.setPk((TreceivableAccountDemanDepoKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + + //Metodos manuales. + + /**Sentencia que obtiene una lista de TreceivableAccount dado un numero de mensaje. */ + private static final String HQL_MSG = "from TreceivableAccountDemanDepo t " + + " where t.message = :message" ; + + /** + * Entrega una lista de TreceivableAccount dado un numeor de mensaje. + * @param pEntityManager Referencia a la session de base de datos. + * @param pMessage Numero de mensaje a buscar registros de TreceivableAccount + * @return List + */ + @SuppressWarnings("unchecked") + public static List findByMessage(EntityManager pEntityManager,String pMessage) { + List ldata = null; + Query qry = pEntityManager.createQuery(HQL_MSG); + qry.setParameter("message", pMessage); + ldata = qry.getResultList(); + return ldata; + } + + + /**Sentencia que obtiene una lista de TreceivableAccount dado un numero de mensaje orgiginal. */ + private static final String HQL_ORIMSG = "from TreceivableAccountDemanDepo t " + + " where t.originalmessage = :originalmessage "+ + " and t.message != t.originalmessage "; + + /** + * Entrega una lista de TreceivableAccount dado un numeor de mensaje original. + * @param pEntityManager Referencia a la session de base de datos. + * @param pMessage Numero de mensaje a buscar registros de TreceivableAccount + * @return List + */ + @SuppressWarnings("unchecked") + public static List findByOriginalMessage(EntityManager pEntityManager,String pMessage) { + List ldata = null; + Query qry = pEntityManager.createQuery(HQL_ORIMSG); + qry.setParameter("originalmessage", pMessage); + ldata = qry.getResultList(); + return ldata; + } + + + /** Sentencia que devuelve una lista de cuentas por cobrar, pendientes de pago.*/ + private static String HQL_RECOVERY = " from TreceivableAccountDemanDepo ra "+ + " where ra.pk.account = :account "+ + " and ra.pk.dateto = :dateto "+ + " and ra.pk.company = :company "+ + " and ra.pk.partitiondb = :partition "+ + " and ra.expiredate >= :accountingdate"+ + " and ra.pendingamount > 0 "+ + " order by ra.priority,ra.pk.creationdate "; + + /** + * Metodo que entrega una lista de cuenta por pagar pendientes de pago. + * @param pEntityManager Referencia a una session de base de datos. + * @param pAccount Numero de cuenta por cobrar. + * @param pCompany Codido de compania asociada a la cuenta por cobrar. + * @param pAccountingDate Fecha contable. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager,String pAccount,Integer pCompany, + Date pAccountingDate) throws Exception { + List ldata = null; + Query qry = pEntityManager.createQuery(HQL_RECOVERY); + qry.setParameter("account", pAccount); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + qry.setParameter("company", pCompany); + qry.setParameter("partition", Constant.getPartition(Constant.getDefaultExpiryDate())); + qry.setParameter("accountingdate", pAccountingDate); + ldata = qry.getResultList(); + return ldata; + } + + /** Sentencia que devuelve un registro de la cuenta por pagar vigente, para la cuenta tipo de saldo grupo balance.*/ + private static String HQL_VIGENT = " from TreceivableAccountDemanDepo ra "+ + " where ra.pk.account = :account "+ + " and ra.pk.dateto = :dateto "+ + " and ra.pk.company = :company "+ + " and ra.pk.partitiondb = :partition "+ + " and ra.balancetype >= :balancetype "+ + " and ra.balancegroup >= :balancegroup "; + + /** + * Metodo que entrega una datos de cuenta por pagar dada la cuenta, tipo de saldo grupo de balance. + * @param pEntityManager Referencia a una session de base de datos. + * @param pAccount Numero de cuenta por cobrar. + * @param pCompany Codido de compania asociada a la cuenta por cobrar. + * @param pBalanceType Tipo de saldo. + * @param pBalanceGroup Grupo de balance. + * @return TreceivableAccount + * @throws Exception + */ + public static TreceivableAccountDemanDepo findVigent(EntityManager pEntityManager,String pAccount,Integer pCompany, + String pBalanceType,String pBalanceGroup) throws Exception { + TreceivableAccountDemanDepo obj = null; + Query qry = pEntityManager.createQuery(HQL_VIGENT); + qry.setParameter("account", pAccount); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + qry.setParameter("company", pCompany); + qry.setParameter("partition", Constant.getPartition(Constant.getDefaultExpiryDate())); + qry.setParameter("balancetype", pBalanceType); + qry.setParameter("balancegroup", pBalanceGroup); + try { + obj = (TreceivableAccountDemanDepo)qry.getSingleResult(); + } catch (NoResultException e) { + return obj; + } + return obj; + } + + + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/acco/TreceivableAccountDemanDepoKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/acco/TreceivableAccountDemanDepoKey.java new file mode 100644 index 0000000..dc37a24 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/receive/acco/TreceivableAccountDemanDepoKey.java @@ -0,0 +1,210 @@ +package com.fp.persistence.pgeneral.receive.acco; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TRECEIVABLEACCOUNTDEMANDEPO*/ +@Embeddable +public class TreceivableAccountDemanDepoKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro de cuenta por cobrar. +*/ +private Timestamp dateto; + +@Column(name="CREATIONDATE", nullable=false,updatable=false) + +/** +* Timestamp de fecha de creacin de cuentas por cobrar. +*/ +private Timestamp creationdate; + +@Column(name="PARTITIONDB", nullable=false,updatable=false) + +/** +* Ao mes de la fecha hasta la cual esta vigente un registro de cuenta por cobrar. +*/ +private String partitiondb; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +/**Contructor por defecto*/ +public TreceivableAccountDemanDepoKey(){} +/**Contructor de TreceivableAccountDemanDepoKey +@param pAccount Numero de cuenta +@param pDateto Fecha hasta la cual esta vigente el registro de cuenta por cobrar. +@param pCreationdate Timestamp de fecha de creacin de cuentas por cobrar. +@param pPartitiondb Ao mes de la fecha hasta la cual esta vigente un registro de cuenta por cobrar. +@param pCompany Codigo de compania a la que pertence la cuenta +*/ +public TreceivableAccountDemanDepoKey(String pAccount,Timestamp pDateto,Timestamp pCreationdate,String pPartitiondb,Integer pCompany){ + account=pAccount; + dateto=pDateto; + creationdate=pCreationdate; + partitiondb=pPartitiondb; + company=pCompany; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de creationdate +@return valor de creationdate*/ +public Timestamp getCreationdate(){ + return creationdate; +} +/**Fija el valor de creationdate +@param pCreationdate nuevo Valor de creationdate*/ +public void setCreationdate(Timestamp pCreationdate){ + creationdate=pCreationdate; +} + +/**Obtiene el valor de partitiondb +@return valor de partitiondb*/ +public String getPartitiondb(){ + return partitiondb; +} +/**Fija el valor de partitiondb +@param pPartitiondb nuevo Valor de partitiondb*/ +public void setPartitiondb(String pPartitiondb){ + partitiondb=pPartitiondb; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Implementacin de la comparacin de TreceivableAccountDemanDepoKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TreceivableAccountDemanDepoKey))return false; + TreceivableAccountDemanDepoKey that = (TreceivableAccountDemanDepoKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getCreationdate() == null || that.getCreationdate() == null){ + return false; + } + if (! this.getCreationdate().equals(that.getCreationdate())){ + return false; + } + if (this.getPartitiondb() == null || that.getPartitiondb() == null){ + return false; + } + if (! this.getPartitiondb().equals(that.getPartitiondb())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TreceivableAccountDemanDepoKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getCreationdate() == null ? 0 : this.getCreationdate().hashCode()); + result = result * 37 + (this.getPartitiondb() == null ? 0 : this.getPartitiondb().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/.svn/entries new file mode 100644 index 0000000..dbf3a74 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneSubprodReports.java +file + + + + +2022-07-28T03:40:30.023748Z +bfb5d1242efb165fdd6139ad56fc88f8 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4275 + +TgeneReportDetail.java +file + + + + +2022-07-28T03:40:30.024748Z +632f1aac5f303e74d56d6f826d0e7b85 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5073 + +TgeneReportKey.java +file + + + + +2022-07-28T03:40:30.024748Z +856ed5bd3723ad15f3152de8e62f38b9 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3405 + +TgeneSubprodReportsKey.java +file + + + + +2022-07-28T03:40:30.024748Z +10d2ef3ebe423a326ca32bb41dc5b2cf +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5144 + +TgeneReportDetailKey.java +file + + + + +2022-07-28T03:40:30.024748Z +a94fd2022fc9711ac5a4648e8a451d7f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4419 + +TgeneReport.java +file + + + + +2022-07-28T03:40:30.025748Z +6872bd155d971def02e2f183a6cc935d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5227 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/.svn/text-base/TgeneReport.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/.svn/text-base/TgeneReport.java.svn-base new file mode 100644 index 0000000..0231e42 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/.svn/text-base/TgeneReport.java.svn-base @@ -0,0 +1,197 @@ +package com.fp.persistence.pgeneral.report; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEREPORT*/ +@Entity(name="TgeneReport") +@Table(name="TGENEREPORT") +public class TgeneReport extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneReport +*/ +@EmbeddedId +private TgeneReportKey pk; +@Column(name="DESCRIPTION", nullable=false) + +/** +* Descripcion del Reporte +*/ +private String description; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="REPORTNAME", nullable=true) + +/** +* Nombre del reporte a ejecutar +*/ +private String reportname; + +@Column(name="PATH", nullable=true) + +/** +* Ubicacion del reporte. +*/ +private String path; + +/**Contructor por defecto*/ +public TgeneReport(){ +} +/**Contructor de TgeneReport +@param pPk Clave Primaria del entity +@param pDescription Descripcion del Reporte +*/ +public TgeneReport(TgeneReportKey pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneReport +*/ +public static TgeneReport find(EntityManager pEntityManager,TgeneReportKey pKey) throws Exception{ + TgeneReport obj = pEntityManager.find(TgeneReport.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneReport +@return El objeto que referencia a la Clave primaria de TgeneReport +*/ +public TgeneReportKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneReport +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneReport +*/ +public void setPk(TgeneReportKey pPk){ + pk=pPk; +} +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de reportname +@return valor de reportname*/ +public String getReportname(){ + return reportname; +} +/**Fija el valor de reportname +@param pReportname nuevo Valor de reportname*/ +public void setReportname(String pReportname){ + reportname=pReportname; +} + +/**Obtiene el valor de path +@return valor de path*/ +public String getPath(){ + return path; +} +/**Fija el valor de path +@param pPath nuevo Valor de path*/ +public void setPath(String pPath){ + path=pPath; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneReport))return false; + TgeneReport that = (TgeneReport) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneReport +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneReport +*/ +public Object createInstance(){ + TgeneReport instance=new TgeneReport(); + instance.setPk(new TgeneReportKey()); + return instance; +} +/**Clona la entidad TgeneReport +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneReport p=(TgeneReport)this.clone(); + p.setPk((TgeneReportKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/.svn/text-base/TgeneReportDetail.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/.svn/text-base/TgeneReportDetail.java.svn-base new file mode 100644 index 0000000..edccbb0 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/.svn/text-base/TgeneReportDetail.java.svn-base @@ -0,0 +1,177 @@ +package com.fp.persistence.pgeneral.report; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEREPORTDETAIL*/ +@Entity(name="TgeneReportDetail") +@Table(name="TGENEREPORTDETAIL") +public class TgeneReportDetail extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneReportDetail +*/ +@EmbeddedId +private TgeneReportDetailKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="SOURCEPARAMETER", nullable=true) + +/** +* Origen de dato del parametro. +*/ +private String sourceparameter; + +@Column(name="MANDATORY", nullable=true) + +/** +* Y Indica que el parametro es obligatorio. +*/ +private String mandatory; + +/**Contructor por defecto*/ +public TgeneReportDetail(){ +} +/**Contructor de TgeneReportDetail +@param pPk Clave Primaria del entity +*/ +public TgeneReportDetail(TgeneReportDetailKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneReportDetail +*/ +public static TgeneReportDetail find(EntityManager pEntityManager,TgeneReportDetailKey pKey) throws Exception{ + TgeneReportDetail obj = pEntityManager.find(TgeneReportDetail.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneReportDetail +@return El objeto que referencia a la Clave primaria de TgeneReportDetail +*/ +public TgeneReportDetailKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneReportDetail +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneReportDetail +*/ +public void setPk(TgeneReportDetailKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de sourceparameter +@return valor de sourceparameter*/ +public String getSourceparameter(){ + return sourceparameter; +} +/**Fija el valor de sourceparameter +@param pSourceparameter nuevo Valor de sourceparameter*/ +public void setSourceparameter(String pSourceparameter){ + sourceparameter=pSourceparameter; +} + +/**Obtiene el valor de mandatory +@return valor de mandatory*/ +public String getMandatory(){ + return mandatory; +} +/**Fija el valor de mandatory +@param pMandatory nuevo Valor de mandatory*/ +public void setMandatory(String pMandatory){ + mandatory=pMandatory; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneReportDetail))return false; + TgeneReportDetail that = (TgeneReportDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneReportDetail +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneReportDetail +*/ +public Object createInstance(){ + TgeneReportDetail instance=new TgeneReportDetail(); + instance.setPk(new TgeneReportDetailKey()); + return instance; +} +/**Clona la entidad TgeneReportDetail +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneReportDetail p=(TgeneReportDetail)this.clone(); + p.setPk((TgeneReportDetailKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/.svn/text-base/TgeneReportDetailKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/.svn/text-base/TgeneReportDetailKey.java.svn-base new file mode 100644 index 0000000..75f4892 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/.svn/text-base/TgeneReportDetailKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.report; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEREPORTDETAIL*/ +@Embeddable +public class TgeneReportDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="REPORTCODE", nullable=false,updatable=false) + +/** +* Nombre del Reporte +*/ +private String reportcode; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="REPORTPARAMETER", nullable=false,updatable=false) + +/** +* Nombre de parametro con el cual se invoca al reporte. +*/ +private String reportparameter; + +/**Contructor por defecto*/ +public TgeneReportDetailKey(){} +/**Contructor de TgeneReportDetailKey +@param pReportcode Nombre del Reporte +@param pModulecode Codigo de modulo +@param pReportparameter Nombre de parametro con el cual se invoca al reporte. +*/ +public TgeneReportDetailKey(String pReportcode,String pModulecode,String pReportparameter){ + reportcode=pReportcode; + modulecode=pModulecode; + reportparameter=pReportparameter; +} +/**Obtiene el valor de reportcode +@return valor de reportcode*/ +public String getReportcode(){ + return reportcode; +} +/**Fija el valor de reportcode +@param pReportcode nuevo Valor de reportcode*/ +public void setReportcode(String pReportcode){ + reportcode=pReportcode; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de reportparameter +@return valor de reportparameter*/ +public String getReportparameter(){ + return reportparameter; +} +/**Fija el valor de reportparameter +@param pReportparameter nuevo Valor de reportparameter*/ +public void setReportparameter(String pReportparameter){ + reportparameter=pReportparameter; +} + +/**Implementacin de la comparacin de TgeneReportDetailKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneReportDetailKey))return false; + TgeneReportDetailKey that = (TgeneReportDetailKey) o; + if (this.getReportcode() == null || that.getReportcode() == null){ + return false; + } + if (! this.getReportcode().equals(that.getReportcode())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getReportparameter() == null || that.getReportparameter() == null){ + return false; + } + if (! this.getReportparameter().equals(that.getReportparameter())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneReportDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getReportcode() == null ? 0 : this.getReportcode().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getReportparameter() == null ? 0 : this.getReportparameter().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/.svn/text-base/TgeneReportKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/.svn/text-base/TgeneReportKey.java.svn-base new file mode 100644 index 0000000..d0de980 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/.svn/text-base/TgeneReportKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.report; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEREPORT*/ +@Embeddable +public class TgeneReportKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="REPORTCODE", nullable=false,updatable=false) + +/** +* Nombre del Reporte +*/ +private String reportcode; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +/**Contructor por defecto*/ +public TgeneReportKey(){} +/**Contructor de TgeneReportKey +@param pReportcode Nombre del Reporte +@param pModulecode Codigo de modulo +*/ +public TgeneReportKey(String pReportcode,String pModulecode){ + reportcode=pReportcode; + modulecode=pModulecode; +} +/**Obtiene el valor de reportcode +@return valor de reportcode*/ +public String getReportcode(){ + return reportcode; +} +/**Fija el valor de reportcode +@param pReportcode nuevo Valor de reportcode*/ +public void setReportcode(String pReportcode){ + reportcode=pReportcode; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Implementacin de la comparacin de TgeneReportKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneReportKey))return false; + TgeneReportKey that = (TgeneReportKey) o; + if (this.getReportcode() == null || that.getReportcode() == null){ + return false; + } + if (! this.getReportcode().equals(that.getReportcode())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneReportKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getReportcode() == null ? 0 : this.getReportcode().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/.svn/text-base/TgeneSubprodReports.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/.svn/text-base/TgeneSubprodReports.java.svn-base new file mode 100644 index 0000000..062f17e --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/.svn/text-base/TgeneSubprodReports.java.svn-base @@ -0,0 +1,141 @@ +package com.fp.persistence.pgeneral.report; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESUBPRODREPORTS*/ +@Entity(name="TgeneSubprodReports") +@Table(name="TGENESUBPRODREPORTS") +public class TgeneSubprodReports extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSubprodReports +*/ +@EmbeddedId +private TgeneSubprodReportsKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TgeneSubprodReports(){ +} +/**Contructor de TgeneSubprodReports +@param pPk Clave Primaria del entity +*/ +public TgeneSubprodReports(TgeneSubprodReportsKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSubprodReports +*/ +public static TgeneSubprodReports find(EntityManager pEntityManager,TgeneSubprodReportsKey pKey) throws Exception{ + TgeneSubprodReports obj = pEntityManager.find(TgeneSubprodReports.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSubprodReports +@return El objeto que referencia a la Clave primaria de TgeneSubprodReports +*/ +public TgeneSubprodReportsKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSubprodReports +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSubprodReports +*/ +public void setPk(TgeneSubprodReportsKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSubprodReports))return false; + TgeneSubprodReports that = (TgeneSubprodReports) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSubprodReports +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSubprodReports +*/ +public Object createInstance(){ + TgeneSubprodReports instance=new TgeneSubprodReports(); + instance.setPk(new TgeneSubprodReportsKey()); + return instance; +} +/**Clona la entidad TgeneSubprodReports +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSubprodReports p=(TgeneSubprodReports)this.clone(); + p.setPk((TgeneSubprodReportsKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/.svn/text-base/TgeneSubprodReportsKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/.svn/text-base/TgeneSubprodReportsKey.java.svn-base new file mode 100644 index 0000000..bc14054 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/.svn/text-base/TgeneSubprodReportsKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.report; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESUBPRODREPORTS*/ +@Embeddable +public class TgeneSubprodReportsKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="REPORTCODE", nullable=false,updatable=false) + +/** +* Nombre del Reporte +*/ +private String reportcode; + +/**Contructor por defecto*/ +public TgeneSubprodReportsKey(){} +/**Contructor de TgeneSubprodReportsKey +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pReportcode Nombre del Reporte +*/ +public TgeneSubprodReportsKey(String pModulecode,String pProductcode,String pSubproductcode,String pReportcode){ + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + reportcode=pReportcode; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de reportcode +@return valor de reportcode*/ +public String getReportcode(){ + return reportcode; +} +/**Fija el valor de reportcode +@param pReportcode nuevo Valor de reportcode*/ +public void setReportcode(String pReportcode){ + reportcode=pReportcode; +} + +/**Implementacin de la comparacin de TgeneSubprodReportsKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSubprodReportsKey))return false; + TgeneSubprodReportsKey that = (TgeneSubprodReportsKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getReportcode() == null || that.getReportcode() == null){ + return false; + } + if (! this.getReportcode().equals(that.getReportcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSubprodReportsKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getReportcode() == null ? 0 : this.getReportcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/TgeneReport.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/TgeneReport.java new file mode 100644 index 0000000..0231e42 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/TgeneReport.java @@ -0,0 +1,197 @@ +package com.fp.persistence.pgeneral.report; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEREPORT*/ +@Entity(name="TgeneReport") +@Table(name="TGENEREPORT") +public class TgeneReport extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneReport +*/ +@EmbeddedId +private TgeneReportKey pk; +@Column(name="DESCRIPTION", nullable=false) + +/** +* Descripcion del Reporte +*/ +private String description; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="REPORTNAME", nullable=true) + +/** +* Nombre del reporte a ejecutar +*/ +private String reportname; + +@Column(name="PATH", nullable=true) + +/** +* Ubicacion del reporte. +*/ +private String path; + +/**Contructor por defecto*/ +public TgeneReport(){ +} +/**Contructor de TgeneReport +@param pPk Clave Primaria del entity +@param pDescription Descripcion del Reporte +*/ +public TgeneReport(TgeneReportKey pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneReport +*/ +public static TgeneReport find(EntityManager pEntityManager,TgeneReportKey pKey) throws Exception{ + TgeneReport obj = pEntityManager.find(TgeneReport.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneReport +@return El objeto que referencia a la Clave primaria de TgeneReport +*/ +public TgeneReportKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneReport +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneReport +*/ +public void setPk(TgeneReportKey pPk){ + pk=pPk; +} +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de reportname +@return valor de reportname*/ +public String getReportname(){ + return reportname; +} +/**Fija el valor de reportname +@param pReportname nuevo Valor de reportname*/ +public void setReportname(String pReportname){ + reportname=pReportname; +} + +/**Obtiene el valor de path +@return valor de path*/ +public String getPath(){ + return path; +} +/**Fija el valor de path +@param pPath nuevo Valor de path*/ +public void setPath(String pPath){ + path=pPath; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneReport))return false; + TgeneReport that = (TgeneReport) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneReport +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneReport +*/ +public Object createInstance(){ + TgeneReport instance=new TgeneReport(); + instance.setPk(new TgeneReportKey()); + return instance; +} +/**Clona la entidad TgeneReport +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneReport p=(TgeneReport)this.clone(); + p.setPk((TgeneReportKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/TgeneReportDetail.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/TgeneReportDetail.java new file mode 100644 index 0000000..edccbb0 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/TgeneReportDetail.java @@ -0,0 +1,177 @@ +package com.fp.persistence.pgeneral.report; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEREPORTDETAIL*/ +@Entity(name="TgeneReportDetail") +@Table(name="TGENEREPORTDETAIL") +public class TgeneReportDetail extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneReportDetail +*/ +@EmbeddedId +private TgeneReportDetailKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="SOURCEPARAMETER", nullable=true) + +/** +* Origen de dato del parametro. +*/ +private String sourceparameter; + +@Column(name="MANDATORY", nullable=true) + +/** +* Y Indica que el parametro es obligatorio. +*/ +private String mandatory; + +/**Contructor por defecto*/ +public TgeneReportDetail(){ +} +/**Contructor de TgeneReportDetail +@param pPk Clave Primaria del entity +*/ +public TgeneReportDetail(TgeneReportDetailKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneReportDetail +*/ +public static TgeneReportDetail find(EntityManager pEntityManager,TgeneReportDetailKey pKey) throws Exception{ + TgeneReportDetail obj = pEntityManager.find(TgeneReportDetail.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneReportDetail +@return El objeto que referencia a la Clave primaria de TgeneReportDetail +*/ +public TgeneReportDetailKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneReportDetail +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneReportDetail +*/ +public void setPk(TgeneReportDetailKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de sourceparameter +@return valor de sourceparameter*/ +public String getSourceparameter(){ + return sourceparameter; +} +/**Fija el valor de sourceparameter +@param pSourceparameter nuevo Valor de sourceparameter*/ +public void setSourceparameter(String pSourceparameter){ + sourceparameter=pSourceparameter; +} + +/**Obtiene el valor de mandatory +@return valor de mandatory*/ +public String getMandatory(){ + return mandatory; +} +/**Fija el valor de mandatory +@param pMandatory nuevo Valor de mandatory*/ +public void setMandatory(String pMandatory){ + mandatory=pMandatory; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneReportDetail))return false; + TgeneReportDetail that = (TgeneReportDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneReportDetail +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneReportDetail +*/ +public Object createInstance(){ + TgeneReportDetail instance=new TgeneReportDetail(); + instance.setPk(new TgeneReportDetailKey()); + return instance; +} +/**Clona la entidad TgeneReportDetail +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneReportDetail p=(TgeneReportDetail)this.clone(); + p.setPk((TgeneReportDetailKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/TgeneReportDetailKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/TgeneReportDetailKey.java new file mode 100644 index 0000000..75f4892 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/TgeneReportDetailKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.report; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEREPORTDETAIL*/ +@Embeddable +public class TgeneReportDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="REPORTCODE", nullable=false,updatable=false) + +/** +* Nombre del Reporte +*/ +private String reportcode; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="REPORTPARAMETER", nullable=false,updatable=false) + +/** +* Nombre de parametro con el cual se invoca al reporte. +*/ +private String reportparameter; + +/**Contructor por defecto*/ +public TgeneReportDetailKey(){} +/**Contructor de TgeneReportDetailKey +@param pReportcode Nombre del Reporte +@param pModulecode Codigo de modulo +@param pReportparameter Nombre de parametro con el cual se invoca al reporte. +*/ +public TgeneReportDetailKey(String pReportcode,String pModulecode,String pReportparameter){ + reportcode=pReportcode; + modulecode=pModulecode; + reportparameter=pReportparameter; +} +/**Obtiene el valor de reportcode +@return valor de reportcode*/ +public String getReportcode(){ + return reportcode; +} +/**Fija el valor de reportcode +@param pReportcode nuevo Valor de reportcode*/ +public void setReportcode(String pReportcode){ + reportcode=pReportcode; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de reportparameter +@return valor de reportparameter*/ +public String getReportparameter(){ + return reportparameter; +} +/**Fija el valor de reportparameter +@param pReportparameter nuevo Valor de reportparameter*/ +public void setReportparameter(String pReportparameter){ + reportparameter=pReportparameter; +} + +/**Implementacin de la comparacin de TgeneReportDetailKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneReportDetailKey))return false; + TgeneReportDetailKey that = (TgeneReportDetailKey) o; + if (this.getReportcode() == null || that.getReportcode() == null){ + return false; + } + if (! this.getReportcode().equals(that.getReportcode())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getReportparameter() == null || that.getReportparameter() == null){ + return false; + } + if (! this.getReportparameter().equals(that.getReportparameter())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneReportDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getReportcode() == null ? 0 : this.getReportcode().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getReportparameter() == null ? 0 : this.getReportparameter().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/TgeneReportKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/TgeneReportKey.java new file mode 100644 index 0000000..d0de980 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/TgeneReportKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.report; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEREPORT*/ +@Embeddable +public class TgeneReportKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="REPORTCODE", nullable=false,updatable=false) + +/** +* Nombre del Reporte +*/ +private String reportcode; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +/**Contructor por defecto*/ +public TgeneReportKey(){} +/**Contructor de TgeneReportKey +@param pReportcode Nombre del Reporte +@param pModulecode Codigo de modulo +*/ +public TgeneReportKey(String pReportcode,String pModulecode){ + reportcode=pReportcode; + modulecode=pModulecode; +} +/**Obtiene el valor de reportcode +@return valor de reportcode*/ +public String getReportcode(){ + return reportcode; +} +/**Fija el valor de reportcode +@param pReportcode nuevo Valor de reportcode*/ +public void setReportcode(String pReportcode){ + reportcode=pReportcode; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Implementacin de la comparacin de TgeneReportKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneReportKey))return false; + TgeneReportKey that = (TgeneReportKey) o; + if (this.getReportcode() == null || that.getReportcode() == null){ + return false; + } + if (! this.getReportcode().equals(that.getReportcode())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneReportKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getReportcode() == null ? 0 : this.getReportcode().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/TgeneSubprodReports.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/TgeneSubprodReports.java new file mode 100644 index 0000000..062f17e --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/TgeneSubprodReports.java @@ -0,0 +1,141 @@ +package com.fp.persistence.pgeneral.report; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESUBPRODREPORTS*/ +@Entity(name="TgeneSubprodReports") +@Table(name="TGENESUBPRODREPORTS") +public class TgeneSubprodReports extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSubprodReports +*/ +@EmbeddedId +private TgeneSubprodReportsKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TgeneSubprodReports(){ +} +/**Contructor de TgeneSubprodReports +@param pPk Clave Primaria del entity +*/ +public TgeneSubprodReports(TgeneSubprodReportsKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSubprodReports +*/ +public static TgeneSubprodReports find(EntityManager pEntityManager,TgeneSubprodReportsKey pKey) throws Exception{ + TgeneSubprodReports obj = pEntityManager.find(TgeneSubprodReports.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSubprodReports +@return El objeto que referencia a la Clave primaria de TgeneSubprodReports +*/ +public TgeneSubprodReportsKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSubprodReports +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSubprodReports +*/ +public void setPk(TgeneSubprodReportsKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSubprodReports))return false; + TgeneSubprodReports that = (TgeneSubprodReports) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSubprodReports +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSubprodReports +*/ +public Object createInstance(){ + TgeneSubprodReports instance=new TgeneSubprodReports(); + instance.setPk(new TgeneSubprodReportsKey()); + return instance; +} +/**Clona la entidad TgeneSubprodReports +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSubprodReports p=(TgeneSubprodReports)this.clone(); + p.setPk((TgeneSubprodReportsKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/TgeneSubprodReportsKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/TgeneSubprodReportsKey.java new file mode 100644 index 0000000..bc14054 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/report/TgeneSubprodReportsKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.report; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESUBPRODREPORTS*/ +@Embeddable +public class TgeneSubprodReportsKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="REPORTCODE", nullable=false,updatable=false) + +/** +* Nombre del Reporte +*/ +private String reportcode; + +/**Contructor por defecto*/ +public TgeneSubprodReportsKey(){} +/**Contructor de TgeneSubprodReportsKey +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pReportcode Nombre del Reporte +*/ +public TgeneSubprodReportsKey(String pModulecode,String pProductcode,String pSubproductcode,String pReportcode){ + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + reportcode=pReportcode; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de reportcode +@return valor de reportcode*/ +public String getReportcode(){ + return reportcode; +} +/**Fija el valor de reportcode +@param pReportcode nuevo Valor de reportcode*/ +public void setReportcode(String pReportcode){ + reportcode=pReportcode; +} + +/**Implementacin de la comparacin de TgeneSubprodReportsKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneSubprodReportsKey))return false; + TgeneSubprodReportsKey that = (TgeneSubprodReportsKey) o; + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getReportcode() == null || that.getReportcode() == null){ + return false; + } + if (! this.getReportcode().equals(that.getReportcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneSubprodReportsKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getReportcode() == null ? 0 : this.getReportcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/result/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/result/.svn/entries new file mode 100644 index 0000000..5f952ea --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/result/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/result +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneResults.java +file + + + + +2022-07-28T03:40:30.418750Z +1dc2aeca6bfd19c5a1cb3fee08616fc9 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7203 + +TgeneResultsKey.java +file + + + + +2022-07-28T03:40:30.418750Z +689fe977e4dca7be92b35ca1106ae7bb +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3529 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/result/.svn/text-base/TgeneResults.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/result/.svn/text-base/TgeneResults.java.svn-base new file mode 100644 index 0000000..4745419 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/result/.svn/text-base/TgeneResults.java.svn-base @@ -0,0 +1,242 @@ +package com.fp.persistence.pgeneral.result; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; +import com.fp.general.exception.GeneralException; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENERESULTS */ +@Entity(name = "TgeneResults") +@Table(name = "TGENERESULTS") +public class TgeneResults extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneResults + */ + @EmbeddedId + private TgeneResultsKey pk; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Codigo que valida caducidad de registro + */ + private Integer recordversion; + + @Column(name = "DESCRIPTION", nullable = false) + /** + * Mensaje a presentar + */ + private String description; + + /** Contructor por defecto */ + public TgeneResults() { + } + + /** + * Contructor de TgeneResults + * + * @param pPk Clave Primaria del entity + * @param pDescription Mensaje a presentar + */ + public TgeneResults(TgeneResultsKey pPk, String pDescription) { + this(); + this.pk = pPk; + this.description = pDescription; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneResults + */ + public static TgeneResults find(EntityManager pEntityManager, TgeneResultsKey pKey) throws Exception { + TgeneResults obj = pEntityManager.find(TgeneResults.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneResults + * + * @return El objeto que referencia a la Clave primaria de TgeneResults + */ + public TgeneResultsKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneResults + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneResults + */ + public void setPk(TgeneResultsKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return this.description; + } + + /** + * Fija el valor de description + * + * @param pDescription nuevo Valor de description + */ + public void setDescription(String pDescription) { + this.description = pDescription; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneResults)) { + return false; + } + TgeneResults that = (TgeneResults) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneResults + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneResults */ + @Override + public Object createInstance() { + TgeneResults instance = new TgeneResults(); + instance.setPk(new TgeneResultsKey()); + return instance; + } + + /** + * Clona la entidad TgeneResults + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneResults p = (TgeneResults) this.clone(); + p.setPk((TgeneResultsKey) this.pk.cloneMe()); + return p; + } + + // Metodos manuales. + + /** + * Sentencia que entrega el texto asociado a un codigo de error e idioma. + */ + private static final String JPQL = "from TgeneResults t where t.pk.resultcode = :resultcode and t.pk.languagecode = :languagecode"; + + /** + * Entrega la descripcion de un codigo de error. + * + * @param entityManager Referencia a una session de base de datos. + * @param resultcode Codigo de resultado a buscar la descripcion. + * @param languagecode Codigo de lenguaje a buscar la descripcion. + * @return TgeneResults + * @throws Exception + */ + public static TgeneResults find(EntityManager entityManager, String resultcode, String languagecode) throws Exception { + Query qry = entityManager.createQuery(JPQL); + qry.setParameter("resultcode", resultcode); + qry.setParameter("languagecode", languagecode); + try { + return (TgeneResults) qry.getSingleResult(); + } catch (NoResultException e) { + throw new GeneralException("GENE-0044", "DESCRIPCIN DEL MENSAJE APLICATIVO: {0} IDIOMA: {1} NO DEFINIDO EN TGENERESULTS", resultcode, + languagecode); + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/result/.svn/text-base/TgeneResultsKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/result/.svn/text-base/TgeneResultsKey.java.svn-base new file mode 100644 index 0000000..00c4362 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/result/.svn/text-base/TgeneResultsKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.result; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENERESULTS*/ +@Embeddable +public class TgeneResultsKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="RESULTCODE", nullable=false,updatable=false) + +/** +* Codigo identificador asociado al mensaje o excepcion +*/ +private String resultcode; + +@Column(name="LANGUAGECODE", nullable=false,updatable=false) + +/** +* Codigo de idioma +*/ +private String languagecode; + +/**Contructor por defecto*/ +public TgeneResultsKey(){} +/**Contructor de TgeneResultsKey +@param pResultcode Codigo identificador asociado al mensaje o excepcion +@param pLanguagecode Codigo de idioma +*/ +public TgeneResultsKey(String pResultcode,String pLanguagecode){ + resultcode=pResultcode; + languagecode=pLanguagecode; +} +/**Obtiene el valor de resultcode +@return valor de resultcode*/ +public String getResultcode(){ + return resultcode; +} +/**Fija el valor de resultcode +@param pResultcode nuevo Valor de resultcode*/ +public void setResultcode(String pResultcode){ + resultcode=pResultcode; +} + +/**Obtiene el valor de languagecode +@return valor de languagecode*/ +public String getLanguagecode(){ + return languagecode; +} +/**Fija el valor de languagecode +@param pLanguagecode nuevo Valor de languagecode*/ +public void setLanguagecode(String pLanguagecode){ + languagecode=pLanguagecode; +} + +/**Implementacion de la comparacion de TgeneResultsKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneResultsKey))return false; + TgeneResultsKey that = (TgeneResultsKey) o; + if (this.getResultcode() == null || that.getResultcode() == null){ + return false; + } + if (! this.getResultcode().equals(that.getResultcode())){ + return false; + } + if (this.getLanguagecode() == null || that.getLanguagecode() == null){ + return false; + } + if (! this.getLanguagecode().equals(that.getLanguagecode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneResultsKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getResultcode() == null ? 0 : this.getResultcode().hashCode()); + result = result * 37 + (this.getLanguagecode() == null ? 0 : this.getLanguagecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/result/TgeneResults.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/result/TgeneResults.java new file mode 100644 index 0000000..4745419 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/result/TgeneResults.java @@ -0,0 +1,242 @@ +package com.fp.persistence.pgeneral.result; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; +import com.fp.general.exception.GeneralException; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENERESULTS */ +@Entity(name = "TgeneResults") +@Table(name = "TGENERESULTS") +public class TgeneResults extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneResults + */ + @EmbeddedId + private TgeneResultsKey pk; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Codigo que valida caducidad de registro + */ + private Integer recordversion; + + @Column(name = "DESCRIPTION", nullable = false) + /** + * Mensaje a presentar + */ + private String description; + + /** Contructor por defecto */ + public TgeneResults() { + } + + /** + * Contructor de TgeneResults + * + * @param pPk Clave Primaria del entity + * @param pDescription Mensaje a presentar + */ + public TgeneResults(TgeneResultsKey pPk, String pDescription) { + this(); + this.pk = pPk; + this.description = pDescription; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneResults + */ + public static TgeneResults find(EntityManager pEntityManager, TgeneResultsKey pKey) throws Exception { + TgeneResults obj = pEntityManager.find(TgeneResults.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneResults + * + * @return El objeto que referencia a la Clave primaria de TgeneResults + */ + public TgeneResultsKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneResults + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneResults + */ + public void setPk(TgeneResultsKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return this.recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + this.recordversion = pRecordversion; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return this.description; + } + + /** + * Fija el valor de description + * + * @param pDescription nuevo Valor de description + */ + public void setDescription(String pDescription) { + this.description = pDescription; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneResults)) { + return false; + } + TgeneResults that = (TgeneResults) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneResults + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneResults */ + @Override + public Object createInstance() { + TgeneResults instance = new TgeneResults(); + instance.setPk(new TgeneResultsKey()); + return instance; + } + + /** + * Clona la entidad TgeneResults + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneResults p = (TgeneResults) this.clone(); + p.setPk((TgeneResultsKey) this.pk.cloneMe()); + return p; + } + + // Metodos manuales. + + /** + * Sentencia que entrega el texto asociado a un codigo de error e idioma. + */ + private static final String JPQL = "from TgeneResults t where t.pk.resultcode = :resultcode and t.pk.languagecode = :languagecode"; + + /** + * Entrega la descripcion de un codigo de error. + * + * @param entityManager Referencia a una session de base de datos. + * @param resultcode Codigo de resultado a buscar la descripcion. + * @param languagecode Codigo de lenguaje a buscar la descripcion. + * @return TgeneResults + * @throws Exception + */ + public static TgeneResults find(EntityManager entityManager, String resultcode, String languagecode) throws Exception { + Query qry = entityManager.createQuery(JPQL); + qry.setParameter("resultcode", resultcode); + qry.setParameter("languagecode", languagecode); + try { + return (TgeneResults) qry.getSingleResult(); + } catch (NoResultException e) { + throw new GeneralException("GENE-0044", "DESCRIPCIN DEL MENSAJE APLICATIVO: {0} IDIOMA: {1} NO DEFINIDO EN TGENERESULTS", resultcode, + languagecode); + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/result/TgeneResultsKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/result/TgeneResultsKey.java new file mode 100644 index 0000000..00c4362 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/result/TgeneResultsKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.result; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENERESULTS*/ +@Embeddable +public class TgeneResultsKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="RESULTCODE", nullable=false,updatable=false) + +/** +* Codigo identificador asociado al mensaje o excepcion +*/ +private String resultcode; + +@Column(name="LANGUAGECODE", nullable=false,updatable=false) + +/** +* Codigo de idioma +*/ +private String languagecode; + +/**Contructor por defecto*/ +public TgeneResultsKey(){} +/**Contructor de TgeneResultsKey +@param pResultcode Codigo identificador asociado al mensaje o excepcion +@param pLanguagecode Codigo de idioma +*/ +public TgeneResultsKey(String pResultcode,String pLanguagecode){ + resultcode=pResultcode; + languagecode=pLanguagecode; +} +/**Obtiene el valor de resultcode +@return valor de resultcode*/ +public String getResultcode(){ + return resultcode; +} +/**Fija el valor de resultcode +@param pResultcode nuevo Valor de resultcode*/ +public void setResultcode(String pResultcode){ + resultcode=pResultcode; +} + +/**Obtiene el valor de languagecode +@return valor de languagecode*/ +public String getLanguagecode(){ + return languagecode; +} +/**Fija el valor de languagecode +@param pLanguagecode nuevo Valor de languagecode*/ +public void setLanguagecode(String pLanguagecode){ + languagecode=pLanguagecode; +} + +/**Implementacion de la comparacion de TgeneResultsKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneResultsKey))return false; + TgeneResultsKey that = (TgeneResultsKey) o; + if (this.getResultcode() == null || that.getResultcode() == null){ + return false; + } + if (! this.getResultcode().equals(that.getResultcode())){ + return false; + } + if (this.getLanguagecode() == null || that.getLanguagecode() == null){ + return false; + } + if (! this.getLanguagecode().equals(that.getLanguagecode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneResultsKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getResultcode() == null ? 0 : this.getResultcode().hashCode()); + result = result * 37 + (this.getLanguagecode() == null ? 0 : this.getLanguagecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/entries new file mode 100644 index 0000000..5ad8c4f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/entries @@ -0,0 +1,844 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe +svn://172.17.26.185/COMACO + + + +2016-01-21T17:28:58.351554Z +4400 +cvasquez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TsafeUser.java +file + + + + +2022-07-28T03:40:30.484750Z +cfec0dfdd180ac46a0c8f4be70f856a2 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4652 + +TsafeAuditInsDelKey.java +file + + + + +2022-07-28T03:40:30.484750Z +d0352792f139c7015116b271a4c57722 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5220 + +TsafeJavaScriptKey.java +file + + + + +2022-07-28T03:40:30.485750Z +b377261fb65dd3a35e3ab0ebf59d4896 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4262 + +TsafeAuditKey.java +file + + + + +2022-07-28T03:40:30.484750Z +f8dbebefa109860283cd50a1f91147e7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5959 + +TsafeProfileHoraryAmountKey.java +file + + + + +2022-07-28T03:40:30.485750Z +fc729348fbf5d2daecad7a73ff458b39 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6109 + +TsafeUserSession.java +file + + + + +2022-07-28T03:40:30.485750Z +f05bbb216c796afb04aa43caf468f696 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5914 + +TsafeTerminalKey.java +file + + + + +2022-07-28T03:40:30.486750Z +9b2d9f04b681972ff6cbe4abfb589037 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3556 + +TsafeUserSessionLog.java +file + + + + +2022-07-28T03:40:30.485750Z +04803b4c88fd37b07bb7c2cc34be936b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8317 + +TsafeProfileHorary.java +file + + + + +2022-07-28T03:40:30.486750Z +bcfc5e39a8c66f3ce356178bc6102a58 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6521 + +TsafeUserSessionKey.java +file + + + + +2022-07-28T03:40:30.486750Z +b387ce43afb174a74ce073a4058e34dd +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3494 + +TsafeUserSessionLogKey.java +file + + + + +2022-07-28T03:40:30.486750Z +bdddbcd63f6b2646e6a9e72cb11f59b7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4379 + +TsafeProfileHoraryKey.java +file + + + + +2022-07-28T03:40:30.487750Z +9416ecb3100ea1fd8e1fd9d231a75034 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6310 + +TsafeUserProfile.java +file + + + + +2022-07-28T03:40:30.487750Z +41ecc5d1ee603d7194e53e9c54d910ab +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7618 + +TsafeProfile.java +file + + + + +2022-07-28T03:40:30.487750Z +05bcb6899620cdd01d3d7ecb6533c72c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4444 + +TsafeUserDetail.java +file + + + + +2022-07-28T03:40:30.487750Z +31ecf0e51b131b0fcaa1193abc5e90d2 +2016-01-21T17:28:58.351554Z +4400 +cvasquez + + + + + + + + + + + + + + + + + + + + + +17396 + +TsafePassword.java +file + + + + +2022-07-28T03:40:30.488750Z +5faced4dba2b5f5e18b7339301a11ddc +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7844 + +TsafeAuditInsDel.java +file + + + + +2022-07-28T03:40:30.488750Z +cbd2d21694556e11be952c1b7b2b95f8 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +11101 + +TsafeJavaScript.java +file + + + + +2022-07-28T03:40:30.488750Z +b02311b88d7bf74c2165ef5b2ffc07b8 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5310 + +TsafeAudit.java +file + + + + +2022-07-28T03:40:30.489750Z +62f7125c4ca488a1f287e69714257526 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +10483 + +TsafeUserProfileKey.java +file + + + + +2022-07-28T03:40:30.489750Z +b79b8264e4b69b96cbd11921dba34721 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4352 + +TsafeProfileHoraryAmount.java +file + + + + +2022-07-28T03:40:30.489750Z +418acf8a1bdb7b1f75fb7d84684870ea +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4849 + +TsafeUserDetailKey.java +file + + + + +2022-07-28T03:40:30.490750Z +4f8fca6999f12a771e3dcb2b8bc79192 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4169 + +TsafeTerminal.java +file + + + + +2022-07-28T03:40:30.490750Z +c47a0933f0202ddd80a10177c06936a7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8742 + +TsafePasswordKey.java +file + + + + +2022-07-28T03:40:30.490750Z +16e448d757d80bce5efe34a1b96fe200 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3473 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeAudit.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeAudit.java.svn-base new file mode 100644 index 0000000..5c281f5 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeAudit.java.svn-base @@ -0,0 +1,408 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; + +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFEAUDIT*/ +@Entity(name="TsafeAudit") +@Table(name="TSAFEAUDIT") +public class TsafeAudit extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TsafeAudit +*/ +@EmbeddedId +private TsafeAuditKey pk; +@Column(name="COMPANYCODE", nullable=false) + +/** +* Codigo de compania al que pertenece la oficina +*/ +private Integer companycode; + +@Column(name="OFFICECODE", nullable=true) + +/** +* Codigo de oficina +*/ +private Integer officecode; + +@Column(name="BRANCHCODE", nullable=true) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="TERMINALCODE", nullable=true) + +/** +* Codigo de terminal +*/ +private String terminalcode; + +@Column(name="USERCODE", nullable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="TRANSACTIONMODULE", nullable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="OLDVALUE", nullable=true) + +/** +* Valor anterior del campo +*/ +private String oldvalue; + +@Column(name="NEWVALUE", nullable=true) + +/** +* Nuevo valor del campo +*/ +private String newvalue; + +@Column(name="ACCOUNT", nullable=true) + +/** +* Numero de cuenta que se afecta +*/ +private String account; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona asociada a la tabla que se modifica +*/ +private Integer personcode; + +@Column(name="SOLICITUDENUMBER", nullable=true) + +/** +* Numero de solicitud asociada a la tabla que se modifica. +*/ +private String solicitudenumber; + +@Column(name="BROWSER", nullable=true) + +/** +* Ingresa la informacion del browser. +*/ +private String browser; + +@Column(name="OPERATIVSYSTEM", nullable=true) + +/** +* Ingresa la informacion del sistema operativo. +*/ +private String operativesystem; + +/**Contructor por defecto*/ +public TsafeAudit(){ +} +/**Contructor de TsafeAudit +@param pPk Clave Primaria del entity +@param pCompanycode Codigo de compania al que pertenece la oficina +@param pUsercode Codigo de usuario +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +*/ +public TsafeAudit(TsafeAuditKey pPk,Integer pCompanycode,String pUsercode,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion){ + this(); + pk=pPk; + companycode=pCompanycode; + usercode=pUsercode; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TsafeAudit +*/ +public static TsafeAudit find(EntityManager pEntityManager,TsafeAuditKey pKey) throws Exception{ + TsafeAudit obj = pEntityManager.find(TsafeAudit.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TsafeAudit +@return El objeto que referencia a la Clave primaria de TsafeAudit +*/ +public TsafeAuditKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TsafeAudit +@param pPk El objeto que referencia a la nueva Clave primaria de TsafeAudit +*/ +public void setPk(TsafeAuditKey pPk){ + pk=pPk; +} +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de terminalcode +@return valor de terminalcode*/ +public String getTerminalcode(){ + return terminalcode; +} +/**Fija el valor de terminalcode +@param pTerminalcode nuevo Valor de terminalcode*/ +public void setTerminalcode(String pTerminalcode){ + terminalcode=pTerminalcode; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de oldvalue +@return valor de oldvalue*/ +public String getOldvalue(){ + return oldvalue; +} +/**Fija el valor de oldvalue +@param pOldvalue nuevo Valor de oldvalue*/ +public void setOldvalue(String pOldvalue){ + oldvalue=pOldvalue; +} + +/**Obtiene el valor de newvalue +@return valor de newvalue*/ +public String getNewvalue(){ + return newvalue; +} +/**Fija el valor de newvalue +@param pNewvalue nuevo Valor de newvalue*/ +public void setNewvalue(String pNewvalue){ + newvalue=pNewvalue; +} + +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de solicitudenumber +@return valor de solicitudenumber*/ +public String getSolicitudenumber(){ + return solicitudenumber; +} +/**Fija el valor de solicitudenumber +@param pSolicitudenumber nuevo Valor de solicitudenumber*/ +public void setSolicitudenumber(String pSolicitudenumber){ + solicitudenumber=pSolicitudenumber; +} +/**Obtiene el valor de browser +@return valor de browser*/ +public String getBrowser() { + return browser; +} +/**Fija el valor de browser +@param pBrowser nuevo Valor de browser*/ +public void setBrowser(String pBrowser) { + this.browser = pBrowser; +} +/**Obtiene el valor de operativesystem +@return valor de operativesystem*/ +public String getOperativesystem() { + return operativesystem; +} +/**Fija el valor de operativesystem +@param pOperativesystem nuevo Valor de operativesystem*/ +public void setOperativesystem(String pOperativesystem) { + this.operativesystem = pOperativesystem; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TsafeAudit))return false; + TsafeAudit that = (TsafeAudit) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TsafeAudit +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TsafeAudit +*/ +public Object createInstance(){ + TsafeAudit instance=new TsafeAudit(); + instance.setPk(new TsafeAuditKey()); + return instance; +} +/**Clona la entidad TsafeAudit +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TsafeAudit p=(TsafeAudit)this.clone(); + p.setPk((TsafeAuditKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeAuditInsDel.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeAuditInsDel.java.svn-base new file mode 100644 index 0000000..8e19ba1 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeAuditInsDel.java.svn-base @@ -0,0 +1,418 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFEAUDITINSDEL*/ +@Entity(name="TsafeAuditInsDel") +@Table(name="TSAFEAUDITINSDEL") +public class TsafeAuditInsDel extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TsafeAuditInsDel +*/ +@EmbeddedId +private TsafeAuditInsDelKey pk; +@Column(name="COMPANYCODE", nullable=false) + +/** +* Codigo de compania al que pertenece la oficina +*/ +private Integer companycode; + +@Column(name="OFFICECODE", nullable=true) + +/** +* Codigo de oficina +*/ +private Integer officecode; + +@Column(name="BRANCHCODE", nullable=true) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="TERMINALCODE", nullable=true) + +/** +* Codigo de terminal +*/ +private String terminalcode; + +@Column(name="USERCODE", nullable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="TRANSACTIONMODULE", nullable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="ISINSERT", nullable=true) + +/** +* Y, Indica que los datos del registro son de insert +*/ +private String isinsert; + +@Column(name="ISDELETE", nullable=true) + +/** +* Y, Indica que los datos son de un registro eliminado +*/ +private String isdelete; + +@Column(name="RECVALUE", nullable=true) + +/** +* Datos del registro que se elimina +*/ +private String recvalue; + +@Column(name="ACCOUNT", nullable=true) + +/** +* Numero de cuenta que se afecta +*/ +private String account; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona asociada a la tabla que se modifica +*/ +private Integer personcode; + +@Column(name="SOLICITUDENUMBER", nullable=true) + +/** +* Numero de solicitud asociada a la tabla que se modifica. +*/ +private String solicitudenumber; + +@Column(name="BROWSER", nullable=true) + +/** +* Ingresa la informacion del browser. +*/ +private String browser; + +@Column(name="OPERATIVSYSTEM", nullable=true) + +/** +* Ingresa la informacion del sistema operativo. +*/ +private String operativesystem; + +/**Contructor por defecto*/ +public TsafeAuditInsDel(){ +} +/**Contructor de TsafeAuditInsDel +@param pPk Clave Primaria del entity +@param pCompanycode Codigo de compania al que pertenece la oficina +@param pUsercode Codigo de usuario +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +*/ +public TsafeAuditInsDel(TsafeAuditInsDelKey pPk,Integer pCompanycode,String pUsercode,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion){ + this(); + pk=pPk; + companycode=pCompanycode; + usercode=pUsercode; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TsafeAuditInsDel +*/ +public static TsafeAuditInsDel find(EntityManager pEntityManager,TsafeAuditInsDelKey pKey) throws Exception{ + TsafeAuditInsDel obj = pEntityManager.find(TsafeAuditInsDel.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TsafeAuditInsDel +@return El objeto que referencia a la Clave primaria de TsafeAuditInsDel +*/ +public TsafeAuditInsDelKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TsafeAuditInsDel +@param pPk El objeto que referencia a la nueva Clave primaria de TsafeAuditInsDel +*/ +public void setPk(TsafeAuditInsDelKey pPk){ + pk=pPk; +} +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de terminalcode +@return valor de terminalcode*/ +public String getTerminalcode(){ + return terminalcode; +} +/**Fija el valor de terminalcode +@param pTerminalcode nuevo Valor de terminalcode*/ +public void setTerminalcode(String pTerminalcode){ + terminalcode=pTerminalcode; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de isinsert +@return valor de isinsert*/ +public String getIsinsert(){ + return isinsert; +} +/**Fija el valor de isinsert +@param pIsinsert nuevo Valor de isinsert*/ +public void setIsinsert(String pIsinsert){ + isinsert=pIsinsert; +} + +/**Obtiene el valor de isdelete +@return valor de isdelete*/ +public String getIsdelete(){ + return isdelete; +} +/**Fija el valor de isdelete +@param pIsdelete nuevo Valor de isdelete*/ +public void setIsdelete(String pIsdelete){ + isdelete=pIsdelete; +} + +/**Obtiene el valor de recvalue +@return valor de recvalue*/ +public String getRecvalue(){ + return recvalue; +} +/**Fija el valor de recvalue +@param pRecvalue nuevo Valor de recvalue*/ +public void setRecvalue(String pRecvalue){ + recvalue=pRecvalue; +} + +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de solicitudenumber +@return valor de solicitudenumber*/ +public String getSolicitudenumber(){ + return solicitudenumber; +} +/**Fija el valor de solicitudenumber +@param pSolicitudenumber nuevo Valor de solicitudenumber*/ +public void setSolicitudenumber(String pSolicitudenumber){ + solicitudenumber=pSolicitudenumber; +} +/**Obtiene el valor de browser +@return valor de browser*/ +public String getBrowser() { + return browser; +} +/**Fija el valor de browser +@param pBrowser nuevo Valor de browser*/ +public void setBrowser(String pBrowser) { + this.browser = pBrowser; +} +/**Obtiene el valor de operativesystem +@return valor de operativesystem*/ +public String getOperativesystem() { + return operativesystem; +} +/**Fija el valor de operativesystem +@param pOperativesystem nuevo Valor de operativesystem*/ +public void setOperativesystem(String pOperativesystem) { + this.operativesystem = pOperativesystem; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TsafeAuditInsDel))return false; + TsafeAuditInsDel that = (TsafeAuditInsDel) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TsafeAuditInsDel +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TsafeAuditInsDel +*/ +public Object createInstance(){ + TsafeAuditInsDel instance=new TsafeAuditInsDel(); + instance.setPk(new TsafeAuditInsDelKey()); + return instance; +} +/**Clona la entidad TsafeAuditInsDel +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TsafeAuditInsDel p=(TsafeAuditInsDel)this.clone(); + p.setPk((TsafeAuditInsDelKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeAuditInsDelKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeAuditInsDelKey.java.svn-base new file mode 100644 index 0000000..079cd6a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeAuditInsDelKey.java.svn-base @@ -0,0 +1,180 @@ +package com.fp.persistence.pgeneral.safe; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TSAFEAUDITINSDEL*/ +@Embeddable +public class TsafeAuditInsDelKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CHANGEDATE", nullable=false,updatable=false) + +/** +* Fecha del log, es la fecha en la que se realizo el cambio de una tabla +*/ +private Date changedate; + +@Column(name="TABLENAME", nullable=false,updatable=false) + +/** +* Nombre de la tabla +*/ +private String tablename; + +@Column(name="PARTITIONDB", nullable=false,updatable=false) + +/** +* Anio mes de la fecha del cambio, con este dato se particiona la tabla. +*/ +private String partitiondb; + +@Column(name="REALDATE", nullable=false,updatable=false) + +/** +* Fecha real del cambio +*/ +private Timestamp realdate; + +/**Contructor por defecto*/ +public TsafeAuditInsDelKey(){} +/**Contructor de TsafeAuditInsDelKey +@param pChangedate Fecha del log, es la fecha en la que se realizo el cambio de una tabla +@param pTablename Nombre de la tabla +@param pPartitiondb Anio mes de la fecha del cambio, con este dato se particiona la tabla. +@param pRealdate Fecha real del cambio +*/ +public TsafeAuditInsDelKey(Date pChangedate,String pTablename,String pPartitiondb,Timestamp pRealdate){ + changedate=pChangedate; + tablename=pTablename; + partitiondb=pPartitiondb; + realdate=pRealdate; +} +/**Obtiene el valor de changedate +@return valor de changedate*/ +public Date getChangedate(){ + return changedate; +} +/**Fija el valor de changedate +@param pChangedate nuevo Valor de changedate*/ +public void setChangedate(Date pChangedate){ + changedate=pChangedate; +} + +/**Obtiene el valor de tablename +@return valor de tablename*/ +public String getTablename(){ + return tablename; +} +/**Fija el valor de tablename +@param pTablename nuevo Valor de tablename*/ +public void setTablename(String pTablename){ + tablename=pTablename; +} + +/**Obtiene el valor de partitiondb +@return valor de partitiondb*/ +public String getPartitiondb(){ + return partitiondb; +} +/**Fija el valor de partitiondb +@param pPartitiondb nuevo Valor de partitiondb*/ +public void setPartitiondb(String pPartitiondb){ + partitiondb=pPartitiondb; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Timestamp getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Timestamp pRealdate){ + realdate=pRealdate; +} + +/**Implementacin de la comparacin de TsafeAuditInsDelKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TsafeAuditInsDelKey))return false; + TsafeAuditInsDelKey that = (TsafeAuditInsDelKey) o; + if (this.getChangedate() == null || that.getChangedate() == null){ + return false; + } + if (! this.getChangedate().equals(that.getChangedate())){ + return false; + } + if (this.getTablename() == null || that.getTablename() == null){ + return false; + } + if (! this.getTablename().equals(that.getTablename())){ + return false; + } + if (this.getPartitiondb() == null || that.getPartitiondb() == null){ + return false; + } + if (! this.getPartitiondb().equals(that.getPartitiondb())){ + return false; + } + if (this.getRealdate() == null || that.getRealdate() == null){ + return false; + } + if (! this.getRealdate().equals(that.getRealdate())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TsafeAuditInsDelKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getChangedate() == null ? 0 : this.getChangedate().hashCode()); + result = result * 37 + (this.getTablename() == null ? 0 : this.getTablename().hashCode()); + result = result * 37 + (this.getPartitiondb() == null ? 0 : this.getPartitiondb().hashCode()); + result = result * 37 + (this.getRealdate() == null ? 0 : this.getRealdate().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeAuditKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeAuditKey.java.svn-base new file mode 100644 index 0000000..6970256 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeAuditKey.java.svn-base @@ -0,0 +1,207 @@ +package com.fp.persistence.pgeneral.safe; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TSAFEAUDIT*/ +@Embeddable +public class TsafeAuditKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CHANGEDATE", nullable=false,updatable=false) + +/** +* Fecha del log, es la fecha en la que se realizo el cambio de una tabla +*/ +private Date changedate; + +@Column(name="TABLENAME", nullable=false,updatable=false) + +/** +* Nombre de la tabla +*/ +private String tablename; + +@Column(name="COLUMNNAME", nullable=false,updatable=false) + +/** +* Nombre del campo que se modifico +*/ +private String columnname; + +@Column(name="PARTITIONDB", nullable=false,updatable=false) + +/** +* Anio mes de la fecha del cambio, con este dato se particiona la tabla. +*/ +private String partitiondb; + +@Column(name="REALDATE", nullable=false,updatable=false) + +/** +* Fecha real del cambio +*/ +private Timestamp realdate; + +/**Contructor por defecto*/ +public TsafeAuditKey(){} +/**Contructor de TsafeAuditKey +@param pChangedate Fecha del log, es la fecha en la que se realizo el cambio de una tabla +@param pTablename Nombre de la tabla +@param pColumnname Nombre del campo que se modifico +@param pPartitiondb Anio mes de la fecha del cambio, con este dato se particiona la tabla. +@param pRealdate Fecha real del cambio +*/ +public TsafeAuditKey(Date pChangedate,String pTablename,String pColumnname,String pPartitiondb,Timestamp pRealdate){ + changedate=pChangedate; + tablename=pTablename; + columnname=pColumnname; + partitiondb=pPartitiondb; + realdate=pRealdate; +} +/**Obtiene el valor de changedate +@return valor de changedate*/ +public Date getChangedate(){ + return changedate; +} +/**Fija el valor de changedate +@param pChangedate nuevo Valor de changedate*/ +public void setChangedate(Date pChangedate){ + changedate=pChangedate; +} + +/**Obtiene el valor de tablename +@return valor de tablename*/ +public String getTablename(){ + return tablename; +} +/**Fija el valor de tablename +@param pTablename nuevo Valor de tablename*/ +public void setTablename(String pTablename){ + tablename=pTablename; +} + +/**Obtiene el valor de columnname +@return valor de columnname*/ +public String getColumnname(){ + return columnname; +} +/**Fija el valor de columnname +@param pColumnname nuevo Valor de columnname*/ +public void setColumnname(String pColumnname){ + columnname=pColumnname; +} + +/**Obtiene el valor de partitiondb +@return valor de partitiondb*/ +public String getPartitiondb(){ + return partitiondb; +} +/**Fija el valor de partitiondb +@param pPartitiondb nuevo Valor de partitiondb*/ +public void setPartitiondb(String pPartitiondb){ + partitiondb=pPartitiondb; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Timestamp getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Timestamp pRealdate){ + realdate=pRealdate; +} + +/**Implementacin de la comparacin de TsafeAuditKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TsafeAuditKey))return false; + TsafeAuditKey that = (TsafeAuditKey) o; + if (this.getChangedate() == null || that.getChangedate() == null){ + return false; + } + if (! this.getChangedate().equals(that.getChangedate())){ + return false; + } + if (this.getTablename() == null || that.getTablename() == null){ + return false; + } + if (! this.getTablename().equals(that.getTablename())){ + return false; + } + if (this.getColumnname() == null || that.getColumnname() == null){ + return false; + } + if (! this.getColumnname().equals(that.getColumnname())){ + return false; + } + if (this.getPartitiondb() == null || that.getPartitiondb() == null){ + return false; + } + if (! this.getPartitiondb().equals(that.getPartitiondb())){ + return false; + } + if (this.getRealdate() == null || that.getRealdate() == null){ + return false; + } + if (! this.getRealdate().equals(that.getRealdate())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TsafeAuditKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getChangedate() == null ? 0 : this.getChangedate().hashCode()); + result = result * 37 + (this.getTablename() == null ? 0 : this.getTablename().hashCode()); + result = result * 37 + (this.getColumnname() == null ? 0 : this.getColumnname().hashCode()); + result = result * 37 + (this.getPartitiondb() == null ? 0 : this.getPartitiondb().hashCode()); + result = result * 37 + (this.getRealdate() == null ? 0 : this.getRealdate().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeJavaScript.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeJavaScript.java.svn-base new file mode 100644 index 0000000..fefa37f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeJavaScript.java.svn-base @@ -0,0 +1,163 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import java.util.List; +import javax.persistence.Query; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFEJAVASCRIPT*/ +@Entity(name = "TsafeJavaScript") +@Table(name = "TSAFEJAVASCRIPT") +public class TsafeJavaScript extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TsafeJavaScript + */ + @EmbeddedId + private TsafeJavaScriptKey pk; + + /**Contructor por defecto*/ + public TsafeJavaScript() { + } + + /**Contructor de TsafeJavaScript + @param pPk Clave Primaria del entity + */ + public TsafeJavaScript(TsafeJavaScriptKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TsafeJavaScript + */ + public static TsafeJavaScript find(EntityManager pEntityManager, TsafeJavaScriptKey pKey) throws Exception { + TsafeJavaScript obj = pEntityManager.find(TsafeJavaScript.class, pKey); + return obj; + } + + /**Entrega la Clave primaria de TsafeJavaScript + @return El objeto que referencia a la Clave primaria de TsafeJavaScript + */ + public TsafeJavaScriptKey getPk() { + return pk; + } + + /**Fija un nuevo valor a la Clave primaria de TsafeJavaScript + @param pPk El objeto que referencia a la nueva Clave primaria de TsafeJavaScript + */ + public void setPk(TsafeJavaScriptKey pPk) { + pk = pPk; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TsafeJavaScript)) { + return false; + } + TsafeJavaScript that = (TsafeJavaScript) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /**Implementacin del metodo hashCode de la la entidad TsafeJavaScript + @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /**Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /**Implementacin de la creacin de un bean en blanco TsafeJavaScript + */ + public Object createInstance() { + TsafeJavaScript instance = new TsafeJavaScript(); + instance.setPk(new TsafeJavaScriptKey()); + return instance; + } + + /**Clona la entidad TsafeJavaScript + @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TsafeJavaScript p = (TsafeJavaScript) this.clone(); + p.setPk((TsafeJavaScriptKey) this.pk.cloneMe()); + return p; + } + //METODOS MANAUALES + private static final String HQL = + "select tb.pk.filename from TsafeJavaScript tb " + + " where tb.pk.companycode = :companycode" + + " and tb.pk.channelcode = :channelcode"; + + /** + * Metodo que devuelve los javascript a ser utilizados en la aplicacion + * @param pEntityManager + * @param companycode + * @param channelcode + * @return + */ + public static List find(EntityManager pEntityManager, Integer companycode, String channelcode) { + List lTsafeJavaScript = null; + Query qry = pEntityManager.createQuery(HQL); + qry.setParameter("companycode", companycode); + qry.setParameter("channelcode", channelcode); + lTsafeJavaScript = qry.getResultList(); + return lTsafeJavaScript; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeJavaScriptKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeJavaScriptKey.java.svn-base new file mode 100644 index 0000000..21c5e82 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeJavaScriptKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TSAFEJAVASCRIPT*/ +@Embeddable +public class TsafeJavaScriptKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="CHANNELCODE", nullable=false,updatable=false) + +/** +* Codigo de canal. +*/ +private String channelcode; + +@Column(name="FILENAME", nullable=false,updatable=false) + +/** +* Nombre del java script a enviar al canal. +*/ +private String filename; + +/**Contructor por defecto*/ +public TsafeJavaScriptKey(){} +/**Contructor de TsafeJavaScriptKey +@param pCompanycode Codigo de compania +@param pChannelcode Codigo de canal. +@param pFilename Nombre del java script a enviar al canal. +*/ +public TsafeJavaScriptKey(Integer pCompanycode,String pChannelcode,String pFilename){ + companycode=pCompanycode; + channelcode=pChannelcode; + filename=pFilename; +} +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de channelcode +@return valor de channelcode*/ +public String getChannelcode(){ + return channelcode; +} +/**Fija el valor de channelcode +@param pChannelcode nuevo Valor de channelcode*/ +public void setChannelcode(String pChannelcode){ + channelcode=pChannelcode; +} + +/**Obtiene el valor de filename +@return valor de filename*/ +public String getFilename(){ + return filename; +} +/**Fija el valor de filename +@param pFilename nuevo Valor de filename*/ +public void setFilename(String pFilename){ + filename=pFilename; +} + +/**Implementacin de la comparacin de TsafeJavaScriptKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TsafeJavaScriptKey))return false; + TsafeJavaScriptKey that = (TsafeJavaScriptKey) o; + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getChannelcode() == null || that.getChannelcode() == null){ + return false; + } + if (! this.getChannelcode().equals(that.getChannelcode())){ + return false; + } + if (this.getFilename() == null || that.getFilename() == null){ + return false; + } + if (! this.getFilename().equals(that.getFilename())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TsafeJavaScriptKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getChannelcode() == null ? 0 : this.getChannelcode().hashCode()); + result = result * 37 + (this.getFilename() == null ? 0 : this.getFilename().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafePassword.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafePassword.java.svn-base new file mode 100644 index 0000000..85bf6bb --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafePassword.java.svn-base @@ -0,0 +1,284 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import com.fp.dto.hb.Log; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFEPASSWORD*/ +@Entity(name="TsafePassword") +@Table(name="TSAFEPASSWORD") +public class TsafePassword extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TsafePassword +*/ +@EmbeddedId +private TsafePasswordKey pk; +@Column(name="VALIDITYDAYS", nullable=true) + +/** +* Dias de validez del password +*/ +private Integer validitydays; + +@Column(name="MINLENGTH", nullable=true) + +/** +* Longitud minica del password +*/ +private Integer minlength; + +@Column(name="MINNOTREPEATED", nullable=true) + +/** +* Numero de las ultimas n veces que el password no se puede repetir, ejemplo 3, el nuevo password tiene que ser diferente a los ultimos 3 password +*/ +private Integer minnotrepeated; + +@Column(name="MINNUMBER", nullable=true) + +/** +* Numero minimo de digios del 0-9 que formen parte del password +*/ +private Integer minnumber; + +@Column(name="MINSPECIALCHARACTERS", nullable=true) + +/** +* Numero minimo de caracteres especiales no numeros si a-z o A_Z +*/ +private Integer minspecialcharacters; + +@Column(name="MINUPPERCASE", nullable=true) + +/** +* Minimo numero de minusculas compredidas entre la a-z +*/ +private Integer minuppercase; + +@Column(name="MINLOWERCASE", nullable=true) + +/** +* Minimo numero de mayusculas comprendidas entre la A_Z +*/ +private Integer minlowercase; + +@Column(name="MESSAGEDAYS", nullable=true) + +/** +* Numero de dias antes del vencimiento del password para enviar mensajes de notificaion +*/ +private Integer messagedays; + +@Column(name="INTENTNUMBER", nullable=true) + +/** +* Numero de intentos, de ingreso de password fallido para bloquear al usuario +*/ +private Integer intentnumber; + +/**Contructor por defecto*/ +public TsafePassword(){ +} +/**Contructor de TsafePassword +@param pPk Clave Primaria del entity +*/ +public TsafePassword(TsafePasswordKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TsafePassword +*/ +public static TsafePassword find(EntityManager pEntityManager,TsafePasswordKey pKey) throws Exception{ + TsafePassword obj = pEntityManager.find(TsafePassword.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TsafePassword +@return El objeto que referencia a la Clave primaria de TsafePassword +*/ +public TsafePasswordKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TsafePassword +@param pPk El objeto que referencia a la nueva Clave primaria de TsafePassword +*/ +public void setPk(TsafePasswordKey pPk){ + pk=pPk; +} +/**Obtiene el valor de validitydays +@return valor de validitydays*/ +public Integer getValiditydays(){ + return validitydays; +} +/**Fija el valor de validitydays +@param pValiditydays nuevo Valor de validitydays*/ +public void setValiditydays(Integer pValiditydays){ + validitydays=pValiditydays; +} + +/**Obtiene el valor de minlength +@return valor de minlength*/ +public Integer getMinlength(){ + return minlength; +} +/**Fija el valor de minlength +@param pMinlength nuevo Valor de minlength*/ +public void setMinlength(Integer pMinlength){ + minlength=pMinlength; +} + +/**Obtiene el valor de minnotrepeated +@return valor de minnotrepeated*/ +public Integer getMinnotrepeated(){ + return minnotrepeated; +} +/**Fija el valor de minnotrepeated +@param pMinnotrepeated nuevo Valor de minnotrepeated*/ +public void setMinnotrepeated(Integer pMinnotrepeated){ + minnotrepeated=pMinnotrepeated; +} + +/**Obtiene el valor de minnumber +@return valor de minnumber*/ +public Integer getMinnumber(){ + return minnumber; +} +/**Fija el valor de minnumber +@param pMinnumber nuevo Valor de minnumber*/ +public void setMinnumber(Integer pMinnumber){ + minnumber=pMinnumber; +} + +/**Obtiene el valor de minspecialcharacters +@return valor de minspecialcharacters*/ +public Integer getMinspecialcharacters(){ + return minspecialcharacters; +} +/**Fija el valor de minspecialcharacters +@param pMinspecialcharacters nuevo Valor de minspecialcharacters*/ +public void setMinspecialcharacters(Integer pMinspecialcharacters){ + minspecialcharacters=pMinspecialcharacters; +} + +/**Obtiene el valor de minuppercase +@return valor de minuppercase*/ +public Integer getMinuppercase(){ + return minuppercase; +} +/**Fija el valor de minuppercase +@param pMinuppercase nuevo Valor de minuppercase*/ +public void setMinuppercase(Integer pMinuppercase){ + minuppercase=pMinuppercase; +} + +/**Obtiene el valor de minlowercase +@return valor de minlowercase*/ +public Integer getMinlowercase(){ + return minlowercase; +} +/**Fija el valor de minlowercase +@param pMinlowercase nuevo Valor de minlowercase*/ +public void setMinlowercase(Integer pMinlowercase){ + minlowercase=pMinlowercase; +} + +/**Obtiene el valor de messagedays +@return valor de messagedays*/ +public Integer getMessagedays(){ + return messagedays; +} +/**Fija el valor de messagedays +@param pMessagedays nuevo Valor de messagedays*/ +public void setMessagedays(Integer pMessagedays){ + messagedays=pMessagedays; +} + +/**Obtiene el valor de intentnumber +@return valor de intentnumber*/ +public Integer getIntentnumber(){ + return intentnumber; +} +/**Fija el valor de intentnumber +@param pIntentnumber nuevo Valor de intentnumber*/ +public void setIntentnumber(Integer pIntentnumber){ + intentnumber=pIntentnumber; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TsafePassword))return false; + TsafePassword that = (TsafePassword) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TsafePassword +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TsafePassword +*/ +public Object createInstance(){ + TsafePassword instance=new TsafePassword(); + instance.setPk(new TsafePasswordKey()); + return instance; +} +/**Clona la entidad TsafePassword +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TsafePassword p=(TsafePassword)this.clone(); + p.setPk((TsafePasswordKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafePasswordKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafePasswordKey.java.svn-base new file mode 100644 index 0000000..1262fe9 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafePasswordKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TSAFEPASSWORD*/ +@Embeddable +public class TsafePasswordKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="CHANNELCODE", nullable=false,updatable=false) + +/** +* Codigo de canal. +*/ +private String channelcode; + +/**Contructor por defecto*/ +public TsafePasswordKey(){} +/**Contructor de TsafePasswordKey +@param pCompanycode Codigo de compania +@param pChannelcode Codigo de canal. +*/ +public TsafePasswordKey(Integer pCompanycode,String pChannelcode){ + companycode=pCompanycode; + channelcode=pChannelcode; +} +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de channelcode +@return valor de channelcode*/ +public String getChannelcode(){ + return channelcode; +} +/**Fija el valor de channelcode +@param pChannelcode nuevo Valor de channelcode*/ +public void setChannelcode(String pChannelcode){ + channelcode=pChannelcode; +} + +/**Implementacin de la comparacin de TsafePasswordKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TsafePasswordKey))return false; + TsafePasswordKey that = (TsafePasswordKey) o; + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getChannelcode() == null || that.getChannelcode() == null){ + return false; + } + if (! this.getChannelcode().equals(that.getChannelcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TsafePasswordKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getChannelcode() == null ? 0 : this.getChannelcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeProfile.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeProfile.java.svn-base new file mode 100644 index 0000000..e5dd0ac --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeProfile.java.svn-base @@ -0,0 +1,160 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFEPROFILE*/ +@Entity(name="TsafeProfile") +@Table(name="TSAFEPROFILE") +public class TsafeProfile extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TsafeProfile +*/ +@Id +@Column(name="PROFILECODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="DESCRIPTION", nullable=false) + +/** +* Nombre del perfil +*/ +private String description; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistick locking del registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TsafeProfile(){ +} +/**Contructor de TsafeProfile +@param pPk Clave Primaria del entity +@param pDescription Nombre del perfil +*/ +public TsafeProfile(String pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TsafeProfile +*/ +public static TsafeProfile find(EntityManager pEntityManager,Object pKey) throws Exception{ + TsafeProfile obj = pEntityManager.find(TsafeProfile.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TsafeProfile +@return El objeto que referencia a la Clave primaria de TsafeProfile +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TsafeProfile +@param pPk El objeto que referencia a la nueva Clave primaria de TsafeProfile +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TsafeProfile))return false; + TsafeProfile that = (TsafeProfile) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TsafeProfile +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TsafeProfile +*/ +public Object createInstance(){ + TsafeProfile instance=new TsafeProfile(); + return instance; +} +/**Clona la entidad TsafeProfile +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TsafeProfile p=(TsafeProfile)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeProfileHorary.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeProfileHorary.java.svn-base new file mode 100644 index 0000000..923f361 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeProfileHorary.java.svn-base @@ -0,0 +1,221 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFEPROFILEHORARY*/ +@Entity(name="TsafeProfileHorary") +@Table(name="TSAFEPROFILEHORARY") +public class TsafeProfileHorary extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TsafeProfileHorary +*/ +@EmbeddedId +private TsafeProfileHoraryKey pk; +@Column(name="REGISTERCODE", nullable=false) + +/** +* Codigo de registro es la suma de los campos de la llave primaria +*/ +private String registercode; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="INITTIME", nullable=false) + +/** +* Horas y minutos desde la cual es disponible la transaccion para el dia +*/ +private String inittime; + +@Column(name="FINISHTIME", nullable=false) + +/** +* Horas y minutos hasta la cual es disponible la transaccion para el dia +*/ +private String finishtime; + +@Column(name="VALIDATEAMOUNT", nullable=true) + +/** +* Y Indica que valida monto de la transaccion utilizada en transacciones financieras. N no valida monto. +*/ +private String validateamount; + +/**Contructor por defecto*/ +public TsafeProfileHorary(){ +} +/**Contructor de TsafeProfileHorary +@param pPk Clave Primaria del entity +@param pRegistercode Codigo de registro es la suma de los campos de la llave primaria +@param pInittime Horas y minutos desde la cual es disponible la transaccion para el dia +@param pFinishtime Horas y minutos hasta la cual es disponible la transaccion para el dia +*/ +public TsafeProfileHorary(TsafeProfileHoraryKey pPk,String pRegistercode,String pInittime,String pFinishtime){ + this(); + pk=pPk; + registercode=pRegistercode; + inittime=pInittime; + finishtime=pFinishtime; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TsafeProfileHorary +*/ +public static TsafeProfileHorary find(EntityManager pEntityManager,TsafeProfileHoraryKey pKey) throws Exception{ + TsafeProfileHorary obj = pEntityManager.find(TsafeProfileHorary.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TsafeProfileHorary +@return El objeto que referencia a la Clave primaria de TsafeProfileHorary +*/ +public TsafeProfileHoraryKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TsafeProfileHorary +@param pPk El objeto que referencia a la nueva Clave primaria de TsafeProfileHorary +*/ +public void setPk(TsafeProfileHoraryKey pPk){ + pk=pPk; +} +/**Obtiene el valor de registercode +@return valor de registercode*/ +public String getRegistercode(){ + return registercode; +} +/**Fija el valor de registercode +@param pRegistercode nuevo Valor de registercode*/ +public void setRegistercode(String pRegistercode){ + registercode=pRegistercode; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de inittime +@return valor de inittime*/ +public String getInittime(){ + return inittime; +} +/**Fija el valor de inittime +@param pInittime nuevo Valor de inittime*/ +public void setInittime(String pInittime){ + inittime=pInittime; +} + +/**Obtiene el valor de finishtime +@return valor de finishtime*/ +public String getFinishtime(){ + return finishtime; +} +/**Fija el valor de finishtime +@param pFinishtime nuevo Valor de finishtime*/ +public void setFinishtime(String pFinishtime){ + finishtime=pFinishtime; +} + +/**Obtiene el valor de validateamount +@return valor de validateamount*/ +public String getValidateamount(){ + return validateamount; +} +/**Fija el valor de validateamount +@param pValidateamount nuevo Valor de validateamount*/ +public void setValidateamount(String pValidateamount){ + validateamount=pValidateamount; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TsafeProfileHorary))return false; + TsafeProfileHorary that = (TsafeProfileHorary) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TsafeProfileHorary +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TsafeProfileHorary +*/ +public Object createInstance(){ + TsafeProfileHorary instance=new TsafeProfileHorary(); + instance.setPk(new TsafeProfileHoraryKey()); + return instance; +} +/**Clona la entidad TsafeProfileHorary +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TsafeProfileHorary p=(TsafeProfileHorary)this.clone(); + p.setPk((TsafeProfileHoraryKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeProfileHoraryAmount.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeProfileHoraryAmount.java.svn-base new file mode 100644 index 0000000..a8e1124 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeProfileHoraryAmount.java.svn-base @@ -0,0 +1,160 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFEPROFILEHORARYAMOUNT*/ +@Entity(name="TsafeProfileHoraryAmount") +@Table(name="TSAFEPROFILEHORARYAMOUNT") +public class TsafeProfileHoraryAmount extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TsafeProfileHoraryAmount +*/ +@EmbeddedId +private TsafeProfileHoraryAmountKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="AMOUNT", nullable=true) + +/** +* Monto maximo permitido para la transaccion moneda. +*/ +private BigDecimal amount; + +/**Contructor por defecto*/ +public TsafeProfileHoraryAmount(){ +} +/**Contructor de TsafeProfileHoraryAmount +@param pPk Clave Primaria del entity +*/ +public TsafeProfileHoraryAmount(TsafeProfileHoraryAmountKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TsafeProfileHoraryAmount +*/ +public static TsafeProfileHoraryAmount find(EntityManager pEntityManager,TsafeProfileHoraryAmountKey pKey) throws Exception{ + TsafeProfileHoraryAmount obj = pEntityManager.find(TsafeProfileHoraryAmount.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TsafeProfileHoraryAmount +@return El objeto que referencia a la Clave primaria de TsafeProfileHoraryAmount +*/ +public TsafeProfileHoraryAmountKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TsafeProfileHoraryAmount +@param pPk El objeto que referencia a la nueva Clave primaria de TsafeProfileHoraryAmount +*/ +public void setPk(TsafeProfileHoraryAmountKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de amount +@return valor de amount*/ +public BigDecimal getAmount(){ + return amount; +} +/**Fija el valor de amount +@param pAmount nuevo Valor de amount*/ +public void setAmount(BigDecimal pAmount){ + amount=pAmount; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TsafeProfileHoraryAmount))return false; + TsafeProfileHoraryAmount that = (TsafeProfileHoraryAmount) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TsafeProfileHoraryAmount +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TsafeProfileHoraryAmount +*/ +public Object createInstance(){ + TsafeProfileHoraryAmount instance=new TsafeProfileHoraryAmount(); + instance.setPk(new TsafeProfileHoraryAmountKey()); + return instance; +} +/**Clona la entidad TsafeProfileHoraryAmount +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TsafeProfileHoraryAmount p=(TsafeProfileHoraryAmount)this.clone(); + p.setPk((TsafeProfileHoraryAmountKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeProfileHoraryAmountKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeProfileHoraryAmountKey.java.svn-base new file mode 100644 index 0000000..a2c8e39 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeProfileHoraryAmountKey.java.svn-base @@ -0,0 +1,205 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TSAFEPROFILEHORARYAMOUNT*/ +@Embeddable +public class TsafeProfileHoraryAmountKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="REGISTERCODE", nullable=false,updatable=false) + +/** +* Codigo de registro de perfil + transaccion + dia +*/ +private String registercode; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +/**Contructor por defecto*/ +public TsafeProfileHoraryAmountKey(){} +/**Contructor de TsafeProfileHoraryAmountKey +@param pRegistercode Codigo de registro de perfil + transaccion + dia +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pCurrencycode Codigo de moneda +*/ +public TsafeProfileHoraryAmountKey(String pRegistercode,String pModulecode,String pProductcode,String pSubproductcode,String pCurrencycode){ + registercode=pRegistercode; + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + currencycode=pCurrencycode; +} +/**Obtiene el valor de registercode +@return valor de registercode*/ +public String getRegistercode(){ + return registercode; +} +/**Fija el valor de registercode +@param pRegistercode nuevo Valor de registercode*/ +public void setRegistercode(String pRegistercode){ + registercode=pRegistercode; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Implementacin de la comparacin de TsafeProfileHoraryAmountKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TsafeProfileHoraryAmountKey))return false; + TsafeProfileHoraryAmountKey that = (TsafeProfileHoraryAmountKey) o; + if (this.getRegistercode() == null || that.getRegistercode() == null){ + return false; + } + if (! this.getRegistercode().equals(that.getRegistercode())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TsafeProfileHoraryAmountKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getRegistercode() == null ? 0 : this.getRegistercode().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeProfileHoraryKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeProfileHoraryKey.java.svn-base new file mode 100644 index 0000000..71abd02 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeProfileHoraryKey.java.svn-base @@ -0,0 +1,205 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TSAFEPROFILEHORARY*/ +@Embeddable +public class TsafeProfileHoraryKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PROFILECODE", nullable=false,updatable=false) + +/** +* Codigo de perfil de usuario +*/ +private String profilecode; + +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="DAY", nullable=false,updatable=false) + +/** +* Dia de la semana para la cual esta disponible la transaccion +*/ +private Integer day; + +/**Contructor por defecto*/ +public TsafeProfileHoraryKey(){} +/**Contructor de TsafeProfileHoraryKey +@param pProfilecode Codigo de perfil de usuario +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pDay Dia de la semana para la cual esta disponible la transaccion +*/ +public TsafeProfileHoraryKey(String pProfilecode,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,Integer pDay){ + profilecode=pProfilecode; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + day=pDay; +} +/**Obtiene el valor de profilecode +@return valor de profilecode*/ +public String getProfilecode(){ + return profilecode; +} +/**Fija el valor de profilecode +@param pProfilecode nuevo Valor de profilecode*/ +public void setProfilecode(String pProfilecode){ + profilecode=pProfilecode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de day +@return valor de day*/ +public Integer getDay(){ + return day; +} +/**Fija el valor de day +@param pDay nuevo Valor de day*/ +public void setDay(Integer pDay){ + day=pDay; +} + +/**Implementacin de la comparacin de TsafeProfileHoraryKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TsafeProfileHoraryKey))return false; + TsafeProfileHoraryKey that = (TsafeProfileHoraryKey) o; + if (this.getProfilecode() == null || that.getProfilecode() == null){ + return false; + } + if (! this.getProfilecode().equals(that.getProfilecode())){ + return false; + } + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getDay() == null || that.getDay() == null){ + return false; + } + if (! this.getDay().equals(that.getDay())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TsafeProfileHoraryKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getProfilecode() == null ? 0 : this.getProfilecode().hashCode()); + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getDay() == null ? 0 : this.getDay().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeTerminal.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeTerminal.java.svn-base new file mode 100644 index 0000000..d0b998b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeTerminal.java.svn-base @@ -0,0 +1,288 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; +import com.fp.general.exception.GeneralException; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFETERMINAL*/ +@Entity(name = "TsafeTerminal") +@Table(name = "TSAFETERMINAL") +public class TsafeTerminal extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable,Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TsafeTerminal + */ + @EmbeddedId + private TsafeTerminalKey pk; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic blocking del registro + */ + private Integer recordversion; + @Column(name = "OFFICECODE", nullable = true) + /** + * Codigo de oficina + */ + private Integer officecode; + @Column(name = "BRANCHCODE", nullable = true) + /** + * Codigo de sucursal + */ + private Integer branchcode; + @Column(name = "AREACODE", nullable = true) + /** + * Codigo de area + */ + private Integer areacode; + @Column(name = "IPADDRESS", nullable = true) + /** + * Ip de la maquina + */ + private String ipaddress; + @Column(name = "MACADDRESS", nullable = true) + /** + * Mac de la maquina + */ + private String macaddress; + @Column(name = "SLIPTPRINTER", nullable = true) + /** + * Nombre de la impresora en la que se imprime el slipt de validacion de caja + */ + private String sliptprinter; + + /**Contructor por defecto*/ + public TsafeTerminal() { + } + + /**Contructor de TsafeTerminal + @param pPk Clave Primaria del entity + */ + public TsafeTerminal(TsafeTerminalKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TsafeTerminal + */ + public static TsafeTerminal find(EntityManager pEntityManager, TsafeTerminalKey pKey) throws Exception { + TsafeTerminal obj = pEntityManager.find(TsafeTerminal.class, pKey); + return obj; + } + + /**Entrega la Clave primaria de TsafeTerminal + @return El objeto que referencia a la Clave primaria de TsafeTerminal + */ + public TsafeTerminalKey getPk() { + return pk; + } + + /**Fija un nuevo valor a la Clave primaria de TsafeTerminal + @param pPk El objeto que referencia a la nueva Clave primaria de TsafeTerminal + */ + public void setPk(TsafeTerminalKey pPk) { + pk = pPk; + } + + /**Obtiene el valor de recordversion + @return valor de recordversion*/ + public Integer getRecordversion() { + return recordversion; + } + + /**Fija el valor de recordversion + @param pRecordversion nuevo Valor de recordversion*/ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /**Obtiene el valor de officecode + @return valor de officecode*/ + public Integer getOfficecode() { + return officecode; + } + + /**Fija el valor de officecode + @param pOfficecode nuevo Valor de officecode*/ + public void setOfficecode(Integer pOfficecode) { + officecode = pOfficecode; + } + + /**Obtiene el valor de branchcode + @return valor de branchcode*/ + public Integer getBranchcode() { + return branchcode; + } + + /**Fija el valor de branchcode + @param pBranchcode nuevo Valor de branchcode*/ + public void setBranchcode(Integer pBranchcode) { + branchcode = pBranchcode; + } + + /**Obtiene el valor de areacode + @return valor de areacode*/ + public Integer getAreacode() { + return areacode; + } + + /**Fija el valor de areacode + @param pAreacode nuevo Valor de areacode*/ + public void setAreacode(Integer pAreacode) { + areacode = pAreacode; + } + + /**Obtiene el valor de ipaddress + @return valor de ipaddress*/ + public String getIpaddress() { + return ipaddress; + } + + /**Fija el valor de ipaddress + @param pIpaddress nuevo Valor de ipaddress*/ + public void setIpaddress(String pIpaddress) { + ipaddress = pIpaddress; + } + + /**Obtiene el valor de macaddress + @return valor de macaddress*/ + public String getMacaddress() { + return macaddress; + } + + /**Fija el valor de macaddress + @param pMacaddress nuevo Valor de macaddress*/ + public void setMacaddress(String pMacaddress) { + macaddress = pMacaddress; + } + + /**Obtiene el valor de sliptprinter + @return valor de sliptprinter*/ + public String getSliptprinter() { + return sliptprinter; + } + + /**Fija el valor de sliptprinter + @param pSliptprinter nuevo Valor de sliptprinter*/ + public void setSliptprinter(String pSliptprinter) { + sliptprinter = pSliptprinter; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TsafeTerminal)) { + return false; + } + TsafeTerminal that = (TsafeTerminal) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /**Implementacin del metodo hashCode de la la entidad TsafeTerminal + @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /**Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /**Implementacin de la creacin de un bean en blanco TsafeTerminal + */ + public Object createInstance() { + TsafeTerminal instance = new TsafeTerminal(); + instance.setPk(new TsafeTerminalKey()); + return instance; + } + + /**Clona la entidad TsafeTerminal + @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TsafeTerminal p = (TsafeTerminal) this.clone(); + p.setPk((TsafeTerminalKey) this.pk.cloneMe()); + return p; + } + private static final String HQL_TERMINAL = "from TsafeTerminal t where t.pk.companycode = :company and ipaddress = :ip"; + + /** + * Metodo que devuelve un objeto de tipo TsafeTerminal + * @param pEntityManager + * @param company + * @param ip + * @return + * @throws Exception + */ + public static TsafeTerminal find(EntityManager pEntityManager, Integer company, String ip) throws Exception { + TsafeTerminal tsafeTerminal = null; + Query qry = (Query) pEntityManager.createQuery(HQL_TERMINAL); + qry.setParameter("company", company); + qry.setParameter("ip", ip); + try { + tsafeTerminal = (TsafeTerminal) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + return tsafeTerminal; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeTerminalKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeTerminalKey.java.svn-base new file mode 100644 index 0000000..2150bc8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeTerminalKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TSAFETERMINAL*/ +@Embeddable +public class TsafeTerminalKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TERMINALCODE", nullable=false,updatable=false) + +/** +* Codigo de terminal +*/ +private String terminalcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania al que pertenece la oficina +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TsafeTerminalKey(){} +/**Contructor de TsafeTerminalKey +@param pTerminalcode Codigo de terminal +@param pCompanycode Codigo de compania al que pertenece la oficina +*/ +public TsafeTerminalKey(String pTerminalcode,Integer pCompanycode){ + terminalcode=pTerminalcode; + companycode=pCompanycode; +} +/**Obtiene el valor de terminalcode +@return valor de terminalcode*/ +public String getTerminalcode(){ + return terminalcode; +} +/**Fija el valor de terminalcode +@param pTerminalcode nuevo Valor de terminalcode*/ +public void setTerminalcode(String pTerminalcode){ + terminalcode=pTerminalcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacin de la comparacin de TsafeTerminalKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TsafeTerminalKey))return false; + TsafeTerminalKey that = (TsafeTerminalKey) o; + if (this.getTerminalcode() == null || that.getTerminalcode() == null){ + return false; + } + if (! this.getTerminalcode().equals(that.getTerminalcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TsafeTerminalKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTerminalcode() == null ? 0 : this.getTerminalcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUser.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUser.java.svn-base new file mode 100644 index 0000000..7f3d36f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUser.java.svn-base @@ -0,0 +1,174 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFEUSER*/ +@Entity(name="TsafeUser") +@Table(name="TSAFEUSER") +public class TsafeUser extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TsafeUser +*/ +@Id +@Column(name="USERCODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="INTERNALCODE", nullable=true) + +/** +* Codigo de usuario interno, se utiliza para crear secuencias por usuario. +*/ +private Integer internalcode; + +@Column(name="COMPANYCODE", nullable=true) + +/** +* Codigo de compania +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TsafeUser(){ +} +/**Contructor de TsafeUser +@param pPk Clave Primaria del entity +*/ +public TsafeUser(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TsafeUser +*/ +public static TsafeUser find(EntityManager pEntityManager,Object pKey) throws Exception{ + TsafeUser obj = pEntityManager.find(TsafeUser.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TsafeUser +@return El objeto que referencia a la Clave primaria de TsafeUser +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TsafeUser +@param pPk El objeto que referencia a la nueva Clave primaria de TsafeUser +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de internalcode +@return valor de internalcode*/ +public Integer getInternalcode(){ + return internalcode; +} +/**Fija el valor de internalcode +@param pInternalcode nuevo Valor de internalcode*/ +public void setInternalcode(Integer pInternalcode){ + internalcode=pInternalcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TsafeUser))return false; + TsafeUser that = (TsafeUser) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TsafeUser +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TsafeUser +*/ +public Object createInstance(){ + TsafeUser instance=new TsafeUser(); + return instance; +} +/**Clona la entidad TsafeUser +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TsafeUser p=(TsafeUser)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserDetail.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserDetail.java.svn-base new file mode 100644 index 0000000..ed9ca9f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserDetail.java.svn-base @@ -0,0 +1,746 @@ +package com.fp.persistence.pgeneral.safe; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; +import com.fp.general.exception.GeneralException; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TSAFEUSERDETAIL + */ +@Entity(name = "TsafeUserDetail") +@Table(name = "TSAFEUSERDETAIL") +public class TsafeUserDetail extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable, Log { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TsafeUserDetail + */ + @EmbeddedId + private TsafeUserDetailKey pk; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic blocking del registro + */ + private Integer recordversion; + + @Column(name = "DATEFROM", nullable = false) + /** + * Fecha desde la cual esta vigente el registro del detalle de usuarios + */ + private Timestamp datefrom; + + @Column(name = "USERSTATUSCATALOG", nullable = true) + /** + * Codigo de catalogo ACT, Activo, BLQ Bloqueado, RET Retirado + */ + private String userstatuscatalog; + + @Column(name = "USERSTATUSCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo USERSTATUS del estatus del usuario + */ + private String userstatuscatalogcode; + + @Column(name = "COMPANYCODE", nullable = true) + /** + * Codigo de compania a la que pertenece el departamento + */ + private Integer companycode; + + @Column(name = "AREACODE", nullable = true) + /** + * Codigo de area + */ + private Integer areacode; + + @Column(name = "OFFICECODE", nullable = true) + /** + * Codigo de oficina + */ + private Integer officecode; + + @Column(name = "BRANCHCODE", nullable = true) + /** + * Codigo de sucursal + */ + private Integer branchcode; + + @Column(name = "CHANNELCODE", nullable = true) + /** + * Codigo de canal. + */ + private String channelcode; + + @Column(name = "LANGUAGECODE", nullable = true) + /** + * Codigo de idioma + */ + private String languagecode; + + @Column(name = "NICKNAME", nullable = false) + /** + * Nombre corto o nombre comn del usuario. + */ + private String nickname; + + @Column(name = "PASSWORD", nullable = true) + /** + * Password + */ + private String password; + + @Column(name = "BRANCHFROMTERMINAL", nullable = true) + /** + * Y indica que la sucursal, oficina area toma del terminal de la maquina + */ + private String branchfromterminal; + + @Column(name = "CHANGEPASSWORD", nullable = true) + /** + * Y Indica que el usuario tiene que cambiar de password al momento de logon, cuando el administrador resea el password + */ + private String changepassword; + + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que ingreso la informacion + */ + private String ingressuser; + + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifico la informacion + */ + private String modifyuser; + + @Column(name = "ACTIVATEUSER", nullable = true) + /** + * Codigo de usuario que pone operativo o activa al usuario. + */ + private String activateuser; + + @Column(name = "TERMINALCODE", nullable = true) + /** + * null + */ + private String terminalcode; + + @Column(name = "ISUSERBPM", nullable = true) + /** + * Y indica que el usuario esta habilitado para trabajar en el JBPM + */ + private String isuserbpm; + + @Column(name="CCENTROCONTROL", nullable=true) + + /** + * Codigo de centro de control de armas + */ + private String ccentrocontrol; + + /** Contructor por defecto */ + public TsafeUserDetail() { + } + + /** + * Contructor de TsafeUserDetail + * + * @param pPk + * Clave Primaria del entity + * @param pDatefrom + * Fecha desde la cual esta vigente el registro del detalle de + * usuarios + * @param pNickname + * Nombre corto o nombre comn del usuario. + */ + public TsafeUserDetail(TsafeUserDetailKey pPk, Timestamp pDatefrom, + String pNickname) { + this(); + pk = pPk; + datefrom = pDatefrom; + nickname = pNickname; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager + * referencia de la session a obtener datos del bean. + * @param pKey + * Caleve primaria del bean. + * @return TsafeUserDetail + */ + public static TsafeUserDetail find(EntityManager pEntityManager, + TsafeUserDetailKey pKey) throws Exception { + TsafeUserDetail obj = pEntityManager.find(TsafeUserDetail.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TsafeUserDetail + * + * @return El objeto que referencia a la Clave primaria de TsafeUserDetail + */ + public TsafeUserDetailKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TsafeUserDetail + * + * @param pPk + * El objeto que referencia a la nueva Clave primaria de + * TsafeUserDetail + */ + public void setPk(TsafeUserDetailKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion + * nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom + * nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + datefrom = pDatefrom; + } + + /** + * Obtiene el valor de userstatuscatalog + * + * @return valor de userstatuscatalog + */ + public String getUserstatuscatalog() { + return userstatuscatalog; + } + + /** + * Fija el valor de userstatuscatalog + * + * @param pUserstatuscatalog + * nuevo Valor de userstatuscatalog + */ + public void setUserstatuscatalog(String pUserstatuscatalog) { + userstatuscatalog = pUserstatuscatalog; + } + + /** + * Obtiene el valor de userstatuscatalogcode + * + * @return valor de userstatuscatalogcode + */ + public String getUserstatuscatalogcode() { + return userstatuscatalogcode; + } + + /** + * Fija el valor de userstatuscatalogcode + * + * @param pUserstatuscatalogcode + * nuevo Valor de userstatuscatalogcode + */ + public void setUserstatuscatalogcode(String pUserstatuscatalogcode) { + userstatuscatalogcode = pUserstatuscatalogcode; + } + + /** + * Obtiene el valor de companycode + * + * @return valor de companycode + */ + public Integer getCompanycode() { + return companycode; + } + + /** + * Fija el valor de companycode + * + * @param pCompanycode + * nuevo Valor de companycode + */ + public void setCompanycode(Integer pCompanycode) { + companycode = pCompanycode; + } + + /** + * Obtiene el valor de areacode + * + * @return valor de areacode + */ + public Integer getAreacode() { + return areacode; + } + + /** + * Fija el valor de areacode + * + * @param pAreacode + * nuevo Valor de areacode + */ + public void setAreacode(Integer pAreacode) { + areacode = pAreacode; + } + + /** + * Obtiene el valor de officecode + * + * @return valor de officecode + */ + public Integer getOfficecode() { + return officecode; + } + + /** + * Fija el valor de officecode + * + * @param pOfficecode + * nuevo Valor de officecode + */ + public void setOfficecode(Integer pOfficecode) { + officecode = pOfficecode; + } + + /** + * Obtiene el valor de branchcode + * + * @return valor de branchcode + */ + public Integer getBranchcode() { + return branchcode; + } + + /** + * Fija el valor de branchcode + * + * @param pBranchcode + * nuevo Valor de branchcode + */ + public void setBranchcode(Integer pBranchcode) { + branchcode = pBranchcode; + } + + /** + * Obtiene el valor de channelcode + * + * @return valor de channelcode + */ + public String getChannelcode() { + return channelcode; + } + + /** + * Fija el valor de channelcode + * + * @param pChannelcode + * nuevo Valor de channelcode + */ + public void setChannelcode(String pChannelcode) { + channelcode = pChannelcode; + } + + /** + * Obtiene el valor de languagecode + * + * @return valor de languagecode + */ + public String getLanguagecode() { + return languagecode; + } + + /** + * Fija el valor de languagecode + * + * @param pLanguagecode + * nuevo Valor de languagecode + */ + public void setLanguagecode(String pLanguagecode) { + languagecode = pLanguagecode; + } + + /** + * Obtiene el valor de nickname + * + * @return valor de nickname + */ + public String getNickname() { + return nickname; + } + + /** + * Fija el valor de nickname + * + * @param pNickname + * nuevo Valor de nickname + */ + public void setNickname(String pNickname) { + nickname = pNickname; + } + + /** + * Obtiene el valor de password + * + * @return valor de password + */ + public String getPassword() { + return password; + } + + /** + * Fija el valor de password + * + * @param pPassword + * nuevo Valor de password + */ + public void setPassword(String pPassword) { + password = pPassword; + } + + /** + * Obtiene el valor de branchfromterminal + * + * @return valor de branchfromterminal + */ + public String getBranchfromterminal() { + return branchfromterminal; + } + + /** + * Fija el valor de branchfromterminal + * + * @param pBranchfromterminal + * nuevo Valor de branchfromterminal + */ + public void setBranchfromterminal(String pBranchfromterminal) { + branchfromterminal = pBranchfromterminal; + } + + /** + * Obtiene el valor de changepassword + * + * @return valor de changepassword + */ + public String getChangepassword() { + return changepassword; + } + + /** + * Fija el valor de changepassword + * + * @param pChangepassword + * nuevo Valor de changepassword + */ + public void setChangepassword(String pChangepassword) { + changepassword = pChangepassword; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser + * nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser + * nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + modifyuser = pModifyuser; + } + + /** + * Obtiene el valor de activateuser + * + * @return valor de activateuser + */ + public String getActivateuser() { + return activateuser; + } + + /** + * Fija el valor de activateuser + * + * @param pActivateuser + * nuevo Valor de activateuser + */ + public void setActivateuser(String pActivateuser) { + activateuser = pActivateuser; + } + + /** + * Obtiene el valor de terminalcode + * + * @return valor de terminalcode + */ + public String getTerminalcode() { + return terminalcode; + } + + /** + * Fija el valor de terminalcode + * + * @param pTerminalcode + * nuevo Valor de terminalcode + */ + public void setTerminalcode(String pTerminalcode) { + terminalcode = pTerminalcode; + } + + /** + * Obtiene el valor de isuserbpm + * + * @return valor de isuserbpm + */ + public String getIsuserbpm() { + return isuserbpm; + } + + /** + * Fija el valor de isuserbpm + * + * @param pIsuserbpm + * nuevo Valor de isuserbpm + */ + public void setIsuserbpm(String pIsuserbpm) { + isuserbpm = pIsuserbpm; + } + + /**Obtiene el valor de ccentrocontrol + @return valor de ccentrocontrol*/ + public String getCcentrocontrol(){ + return ccentrocontrol; + } + /**Fija el valor de ccentrocontrol + @param pCcentrocontrol nuevo Valor de ccentrocontrol*/ + public void setCcentrocontrol(String pCcentrocontrol){ + ccentrocontrol=pCcentrocontrol; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TsafeUserDetail)) + return false; + TsafeUserDetail that = (TsafeUserDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TsafeUserDetail + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 + || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TsafeUserDetail */ + public Object createInstance() { + TsafeUserDetail instance = new TsafeUserDetail(); + instance.setPk(new TsafeUserDetailKey()); + return instance; + } + + /** + * Clona la entidad TsafeUserDetail + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TsafeUserDetail p = (TsafeUserDetail) this.clone(); + p.setPk((TsafeUserDetailKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + + //METODOS MANUALES + /**Sentecnia que entrega lista de los ultimos n passwords del usuario ordenados en forma decendente*/ + private static String SQL = "from TsafeUserDetail t where t.pk.usercode = :usercode " + + " order by t.pk.dateto desc "; + + /** + * Enterga una lista de registros asociados a un usuario de TsafeUserDetail ordenados en forma decendenete. + * @param pEntityManager Session de la base de datos. + * @param pUserCode Codigo de usuario + * @param pNumReg Numero de registros a obtener en la lista . + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pUserCode, Integer pNumReg) throws Exception { + List ldata = null; + Query qry = pEntityManager.createQuery(SQL); + qry.setParameter("usercode", pUserCode); + qry.setMaxResults(pNumReg); + ldata = qry.getResultList(); + return ldata; + } + + /**Sentecnia que entrega un objeto con los datos de un usuario.*/ + private static String JPQL_BY_USER = "from TsafeUserDetail t where t.pk.usercode = :usercode " + + " and t.pk.dateto = :dateto "; + + /** + * Enterga un objeto con los datos de un usuario de TsafeUserDetail. + * @param pEntityManager Session de la base de datos. + * @param pUserCode Codigo de usuario + * @return TsafeUserDetail + * @throws Exception + */ + public static TsafeUserDetail find(EntityManager pEntityManager, String pUserCode) throws Exception { + TsafeUserDetail obj = null; + Query qry = pEntityManager.createQuery(JPQL_BY_USER); + qry.setParameter("usercode", pUserCode); + qry.setParameter("dateto",Constant.getDefaultExpiryDate()); + try { + obj = (TsafeUserDetail)qry.getSingleResult(); + } catch (NoResultException e) { + throw new GeneralException("GENE-0035", "USUARIO: {0} NO DEFINIDO EN TSAFEUSERDETAIL", pUserCode); + } + return obj; + } + + + /** + * Sentencia que devuelve un registro de TgeneSubProduct. + */ + private static final String JPQL_NAME_USER = "from TsafeUserDetail tsu " + " where tsu.pk.usercode = :usercode " + + " and tsu.pk.dateto = :dateto "; + /** + * Metodo que obtiene datos de un registro del subproducto. + * + * @param pEntityManager Session de la base de datos. + * @param pModulecode Codigo de modulo a obtener datos de la base. + * @param pProductcode Codigo de producto a obtener datos de la base. + * @param pSubproductcode Codigo de subproducto a obtener datos de la base. + * @return TgeneSubProduct + * @throws Exception + */ + public static TsafeUserDetail findByUserCode(EntityManager pEntityManager, String usercode) throws Exception { + Query qry = pEntityManager.createQuery(TsafeUserDetail.JPQL_NAME_USER); + qry.setParameter("usercode", usercode); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + try { + return (TsafeUserDetail) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserDetailKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserDetailKey.java.svn-base new file mode 100644 index 0000000..0e47a06 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserDetailKey.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pgeneral.safe; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TSAFEUSERDETAIL*/ +@Embeddable +public class TsafeUserDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona del usuario +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro del detalle de usuarios +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TsafeUserDetailKey(){} +/**Contructor de TsafeUserDetailKey +@param pUsercode Codigo de usuario +@param pPersoncode Codigo de persona del usuario +@param pDateto Fecha hasta la cual esta vigente el registro del detalle de usuarios +*/ +public TsafeUserDetailKey(String pUsercode,Integer pPersoncode,Timestamp pDateto){ + usercode=pUsercode; + personcode=pPersoncode; + dateto=pDateto; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TsafeUserDetailKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TsafeUserDetailKey))return false; + TsafeUserDetailKey that = (TsafeUserDetailKey) o; + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TsafeUserDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserProfile.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserProfile.java.svn-base new file mode 100644 index 0000000..3febdf9 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserProfile.java.svn-base @@ -0,0 +1,264 @@ +package com.fp.persistence.pgeneral.safe; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFEUSERPROFILE */ +@Entity(name = "TsafeUserProfile") +@Table(name = "TSAFEUSERPROFILE") +public class TsafeUserProfile extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TsafeUserProfile + */ + @EmbeddedId + private TsafeUserProfileKey pk; + + @Column(name = "DATEFROM", nullable = false) + /** + * Fecha desde la cual esta vigente el registro del detalle de usuarios + */ + private Timestamp datefrom; + + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que ingreso la informacion + */ + private String ingressuser; + + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifico la informacion + */ + private String modifyuser; + + /** Contructor por defecto */ + public TsafeUserProfile() { + } + + /** + * Contructor de TsafeUserProfile + * + * @param pPk Clave Primaria del entity + * @param pDatefrom Fecha desde la cual esta vigente el registro del detalle de usuarios + */ + public TsafeUserProfile(TsafeUserProfileKey pPk, Timestamp pDatefrom) { + this(); + this.pk = pPk; + this.datefrom = pDatefrom; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TsafeUserProfile + */ + public static TsafeUserProfile find(EntityManager pEntityManager, TsafeUserProfileKey pKey) throws Exception { + TsafeUserProfile obj = pEntityManager.find(TsafeUserProfile.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TsafeUserProfile + * + * @return El objeto que referencia a la Clave primaria de TsafeUserProfile + */ + public TsafeUserProfileKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TsafeUserProfile + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TsafeUserProfile + */ + public void setPk(TsafeUserProfileKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return this.ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + this.ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return this.modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + this.modifyuser = pModifyuser; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TsafeUserProfile)) { + return false; + } + TsafeUserProfile that = (TsafeUserProfile) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TsafeUserProfile + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TsafeUserProfile */ + @Override + public Object createInstance() { + TsafeUserProfile instance = new TsafeUserProfile(); + instance.setPk(new TsafeUserProfileKey()); + return instance; + } + + /** + * Clona la entidad TsafeUserProfile + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TsafeUserProfile p = (TsafeUserProfile) this.clone(); + p.setPk((TsafeUserProfileKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + + // Metodos manuales. + /** + * Sentencia que devuelve un registro de TsafeUserProfile. + */ + private static final String JPQL_USER_PROFILE = "from TsafeUserProfile tsup " + " where tsup.pk.usercode = :usercode" + + " and tsup.pk.dateto = :dateto"; + + /** + * Metodo que obtiene datos del perfil del usuario. + * + * @param pusercode Codigo de usuario. + * @return TsafeUserProfile + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pusercode) throws Exception { + Query qry = pEntityManager.createQuery(TsafeUserProfile.JPQL_USER_PROFILE); + qry.setParameter("usercode", pusercode); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + return qry.getResultList(); + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserProfileKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserProfileKey.java.svn-base new file mode 100644 index 0000000..cb85ea9 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserProfileKey.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pgeneral.safe; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TSAFEUSERPROFILE*/ +@Embeddable +public class TsafeUserProfileKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="PROFILECODE", nullable=false,updatable=false) + +/** +* Codigo de perfil de usuario +*/ +private String profilecode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro del detalle de usuarios +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TsafeUserProfileKey(){} +/**Contructor de TsafeUserProfileKey +@param pUsercode Codigo de usuario +@param pProfilecode Codigo de perfil de usuario +@param pDateto Fecha hasta la cual esta vigente el registro del detalle de usuarios +*/ +public TsafeUserProfileKey(String pUsercode,String pProfilecode,Timestamp pDateto){ + usercode=pUsercode; + profilecode=pProfilecode; + dateto=pDateto; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de profilecode +@return valor de profilecode*/ +public String getProfilecode(){ + return profilecode; +} +/**Fija el valor de profilecode +@param pProfilecode nuevo Valor de profilecode*/ +public void setProfilecode(String pProfilecode){ + profilecode=pProfilecode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TsafeUserProfileKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TsafeUserProfileKey))return false; + TsafeUserProfileKey that = (TsafeUserProfileKey) o; + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getProfilecode() == null || that.getProfilecode() == null){ + return false; + } + if (! this.getProfilecode().equals(that.getProfilecode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TsafeUserProfileKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getProfilecode() == null ? 0 : this.getProfilecode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserSession.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserSession.java.svn-base new file mode 100644 index 0000000..5621ed8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserSession.java.svn-base @@ -0,0 +1,215 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFEUSERSESSION*/ +@Entity(name="TsafeUserSession") +@Table(name="TSAFEUSERSESSION") +public class TsafeUserSession extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TsafeUserSession +*/ +@EmbeddedId +private TsafeUserSessionKey pk; +@Column(name="DATEFROM", nullable=true) + +/** +* Fecha desde la cual esta vigente el registro. +*/ +private Timestamp datefrom; + +@Column(name="TERMINALCODE", nullable=true) + +/** +* Codigo de terminal desde el cual se conecta el usuario. +*/ +private String terminalcode; + +@Column(name="TRYNUMBER", nullable=true) + +/** +* Numero de intentos de coneccion. +*/ +private Integer trynumber; + +@Column(name="SESSIONID", nullable=true) + +/** +* Session id del browser con el servlet. +*/ +private String sessionid; + +@Column(name="WEBSERVERIP", nullable=true) + +/** +* Ip del servidor de aplicaciones al cual esta conectado un usuario, sirve para caducar las sessiones de usuario asociadas a esta ip +*/ +private String webserverip; + +/**Contructor por defecto*/ +public TsafeUserSession(){ +} +/**Contructor de TsafeUserSession +@param pPk Clave Primaria del entity +*/ +public TsafeUserSession(TsafeUserSessionKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TsafeUserSession +*/ +public static TsafeUserSession find(EntityManager pEntityManager,TsafeUserSessionKey pKey) throws Exception{ + TsafeUserSession obj = pEntityManager.find(TsafeUserSession.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TsafeUserSession +@return El objeto que referencia a la Clave primaria de TsafeUserSession +*/ +public TsafeUserSessionKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TsafeUserSession +@param pPk El objeto que referencia a la nueva Clave primaria de TsafeUserSession +*/ +public void setPk(TsafeUserSessionKey pPk){ + pk=pPk; +} +/**Obtiene el valor de datefrom +@return valor de datefrom*/ +public Timestamp getDatefrom(){ + return datefrom; +} +/**Fija el valor de datefrom +@param pDatefrom nuevo Valor de datefrom*/ +public void setDatefrom(Timestamp pDatefrom){ + datefrom=pDatefrom; +} + +/**Obtiene el valor de terminalcode +@return valor de terminalcode*/ +public String getTerminalcode(){ + return terminalcode; +} +/**Fija el valor de terminalcode +@param pTerminalcode nuevo Valor de terminalcode*/ +public void setTerminalcode(String pTerminalcode){ + terminalcode=pTerminalcode; +} + +/**Obtiene el valor de trynumber +@return valor de trynumber*/ +public Integer getTrynumber(){ + return trynumber; +} +/**Fija el valor de trynumber +@param pTrynumber nuevo Valor de trynumber*/ +public void setTrynumber(Integer pTrynumber){ + trynumber=pTrynumber; +} + +/**Obtiene el valor de sessionid +@return valor de sessionid*/ +public String getSessionid(){ + return sessionid; +} +/**Fija el valor de sessionid +@param pSessionid nuevo Valor de sessionid*/ +public void setSessionid(String pSessionid){ + sessionid=pSessionid; +} + +/**Obtiene el valor de webserverip +@return valor de webserverip*/ +public String getWebserverip(){ + return webserverip; +} +/**Fija el valor de webserverip +@param pWebserverip nuevo Valor de webserverip*/ +public void setWebserverip(String pWebserverip){ + webserverip=pWebserverip; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TsafeUserSession))return false; + TsafeUserSession that = (TsafeUserSession) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TsafeUserSession +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TsafeUserSession +*/ +public Object createInstance(){ + TsafeUserSession instance=new TsafeUserSession(); + instance.setPk(new TsafeUserSessionKey()); + return instance; +} +/**Clona la entidad TsafeUserSession +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TsafeUserSession p=(TsafeUserSession)this.clone(); + p.setPk((TsafeUserSessionKey)this.pk.cloneMe()); + return p; +} +public Object getId() { + return this.pk; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserSessionKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserSessionKey.java.svn-base new file mode 100644 index 0000000..b7e70db --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserSessionKey.java.svn-base @@ -0,0 +1,129 @@ +package com.fp.persistence.pgeneral.safe; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TSAFEUSERSESSION*/ +@Embeddable +public class TsafeUserSessionKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro. +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TsafeUserSessionKey(){} +/**Contructor de TsafeUserSessionKey +@param pUsercode Codigo de usuario +@param pDateto Fecha hasta la cual esta vigente el registro. +*/ +public TsafeUserSessionKey(String pUsercode,Timestamp pDateto){ + usercode=pUsercode; + dateto=pDateto; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TsafeUserSessionKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TsafeUserSessionKey))return false; + TsafeUserSessionKey that = (TsafeUserSessionKey) o; + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TsafeUserSessionKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserSessionLog.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserSessionLog.java.svn-base new file mode 100644 index 0000000..157cd6a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserSessionLog.java.svn-base @@ -0,0 +1,299 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFEUSERSESSIONLOG*/ +@Entity(name="TsafeUserSessionLog") +@Table(name="TSAFEUSERSESSIONLOG") +public class TsafeUserSessionLog extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TsafeUserSessionLog +*/ +@EmbeddedId +private TsafeUserSessionLogKey pk; +@Column(name="USERCODE", nullable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="BRANCHCODE", nullable=true) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="OFFICECODE", nullable=true) + +/** +* Codigo de oficina +*/ +private Integer officecode; + +@Column(name="TERMINALCODE", nullable=false) + +/** +* Codigo de terminal desde el cual se conecta el usuario. +*/ +private String terminalcode; + +@Column(name="SESSIONID", nullable=false) + +/** +* Session id del browser con el servlet. +*/ +private String sessionid; + +@Column(name="WEBSERVERIP", nullable=false) + +/** +* Ip del servidor de aplicaciones al cual esta conectado un usuario, sirve para caducar las sessiones de usuario asociadas a esta ip +*/ +private String webserverip; + +@Column(name="REALDATE", nullable=false) + +/** +* Fecha en la que se realiza el login +*/ +private Timestamp realdate; + +@Column(name="ERRORCODE", nullable=false) + +/** +* Codigo de error +*/ +private String errorcode; + +@Column(name="MESSAGELOGIN", nullable=false) + +/** +* Mensaje al intentar loguearse +*/ +private String messagelogin; + +/**Contructor por defecto*/ +public TsafeUserSessionLog(){ +} +/**Contructor de TsafeUserSessionLog +@param pPk Clave Primaria del entity +@param pUsercode Codigo de usuario +@param pTerminalcode Codigo de terminal desde el cual se conecta el usuario. +@param pSessionid Session id del browser con el servlet. +@param pWebserverip Ip del servidor de aplicaciones al cual esta conectado un usuario, sirve para caducar las sessiones de usuario asociadas a esta ip +@param pRealdate Fecha en la que se realiza el login +@param pErrorcode Codigo de error +@param pMessagelogin Mensaje al intentar loguearse +*/ +public TsafeUserSessionLog(TsafeUserSessionLogKey pPk,String pUsercode,String pTerminalcode,String pSessionid,String pWebserverip,Timestamp pRealdate,String pErrorcode,String pMessagelogin){ + this(); + pk=pPk; + usercode=pUsercode; + terminalcode=pTerminalcode; + sessionid=pSessionid; + webserverip=pWebserverip; + realdate=pRealdate; + errorcode=pErrorcode; + messagelogin=pMessagelogin; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TsafeUserSessionLog +*/ +public static TsafeUserSessionLog find(EntityManager pEntityManager,TsafeUserSessionLogKey pKey) throws Exception{ + TsafeUserSessionLog obj = pEntityManager.find(TsafeUserSessionLog.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TsafeUserSessionLog +@return El objeto que referencia a la Clave primaria de TsafeUserSessionLog +*/ +public TsafeUserSessionLogKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TsafeUserSessionLog +@param pPk El objeto que referencia a la nueva Clave primaria de TsafeUserSessionLog +*/ +public void setPk(TsafeUserSessionLogKey pPk){ + pk=pPk; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de terminalcode +@return valor de terminalcode*/ +public String getTerminalcode(){ + return terminalcode; +} +/**Fija el valor de terminalcode +@param pTerminalcode nuevo Valor de terminalcode*/ +public void setTerminalcode(String pTerminalcode){ + terminalcode=pTerminalcode; +} + +/**Obtiene el valor de sessionid +@return valor de sessionid*/ +public String getSessionid(){ + return sessionid; +} +/**Fija el valor de sessionid +@param pSessionid nuevo Valor de sessionid*/ +public void setSessionid(String pSessionid){ + sessionid=pSessionid; +} + +/**Obtiene el valor de webserverip +@return valor de webserverip*/ +public String getWebserverip(){ + return webserverip; +} +/**Fija el valor de webserverip +@param pWebserverip nuevo Valor de webserverip*/ +public void setWebserverip(String pWebserverip){ + webserverip=pWebserverip; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Timestamp getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Timestamp pRealdate){ + realdate=pRealdate; +} + +/**Obtiene el valor de errorcode +@return valor de errorcode*/ +public String getErrorcode(){ + return errorcode; +} +/**Fija el valor de errorcode +@param pErrorcode nuevo Valor de errorcode*/ +public void setErrorcode(String pErrorcode){ + errorcode=pErrorcode; +} + +/**Obtiene el valor de messagelogin +@return valor de messagelogin*/ +public String getMessagelogin(){ + return messagelogin; +} +/**Fija el valor de messagelogin +@param pMessagelogin nuevo Valor de messagelogin*/ +public void setMessagelogin(String pMessagelogin){ + messagelogin=pMessagelogin; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TsafeUserSessionLog))return false; + TsafeUserSessionLog that = (TsafeUserSessionLog) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TsafeUserSessionLog +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TsafeUserSessionLog +*/ +public Object createInstance(){ + TsafeUserSessionLog instance=new TsafeUserSessionLog(); + instance.setPk(new TsafeUserSessionLogKey()); + return instance; +} +/**Clona la entidad TsafeUserSessionLog +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TsafeUserSessionLog p=(TsafeUserSessionLog)this.clone(); + p.setPk((TsafeUserSessionLogKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserSessionLogKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserSessionLogKey.java.svn-base new file mode 100644 index 0000000..6de0ea2 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/.svn/text-base/TsafeUserSessionLogKey.java.svn-base @@ -0,0 +1,152 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TSAFEUSERSESSIONLOG*/ +@Embeddable +public class TsafeUserSessionLogKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="WORKINGDATE", nullable=false,updatable=false) + +/** +* Fecha de trabajo del sistema +*/ +private Date workingdate; + +@Column(name="SEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de la tabla +*/ +private Integer sequence; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania donde se realiza el inicio de sesion +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TsafeUserSessionLogKey(){} +/**Contructor de TsafeUserSessionLogKey +@param pWorkingdate Fecha de trabajo del sistema +@param pSequence Secuencia de la tabla +@param pCompanycode Codigo de compania donde se realiza el inicio de sesion +*/ +public TsafeUserSessionLogKey(Date pWorkingdate,Integer pSequence,Integer pCompanycode){ + workingdate=pWorkingdate; + sequence=pSequence; + companycode=pCompanycode; +} +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +/**Obtiene el valor de sequence +@return valor de sequence*/ +public Integer getSequence(){ + return sequence; +} +/**Fija el valor de sequence +@param pSequence nuevo Valor de sequence*/ +public void setSequence(Integer pSequence){ + sequence=pSequence; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacion de la comparacion de TsafeUserSessionLogKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TsafeUserSessionLogKey))return false; + TsafeUserSessionLogKey that = (TsafeUserSessionLogKey) o; + if (this.getWorkingdate() == null || that.getWorkingdate() == null){ + return false; + } + if (! this.getWorkingdate().equals(that.getWorkingdate())){ + return false; + } + if (this.getSequence() == null || that.getSequence() == null){ + return false; + } + if (! this.getSequence().equals(that.getSequence())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TsafeUserSessionLogKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getWorkingdate() == null ? 0 : this.getWorkingdate().hashCode()); + result = result * 37 + (this.getSequence() == null ? 0 : this.getSequence().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeAudit.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeAudit.java new file mode 100644 index 0000000..5c281f5 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeAudit.java @@ -0,0 +1,408 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; + +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.EntityManager; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFEAUDIT*/ +@Entity(name="TsafeAudit") +@Table(name="TSAFEAUDIT") +public class TsafeAudit extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TsafeAudit +*/ +@EmbeddedId +private TsafeAuditKey pk; +@Column(name="COMPANYCODE", nullable=false) + +/** +* Codigo de compania al que pertenece la oficina +*/ +private Integer companycode; + +@Column(name="OFFICECODE", nullable=true) + +/** +* Codigo de oficina +*/ +private Integer officecode; + +@Column(name="BRANCHCODE", nullable=true) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="TERMINALCODE", nullable=true) + +/** +* Codigo de terminal +*/ +private String terminalcode; + +@Column(name="USERCODE", nullable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="TRANSACTIONMODULE", nullable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="OLDVALUE", nullable=true) + +/** +* Valor anterior del campo +*/ +private String oldvalue; + +@Column(name="NEWVALUE", nullable=true) + +/** +* Nuevo valor del campo +*/ +private String newvalue; + +@Column(name="ACCOUNT", nullable=true) + +/** +* Numero de cuenta que se afecta +*/ +private String account; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona asociada a la tabla que se modifica +*/ +private Integer personcode; + +@Column(name="SOLICITUDENUMBER", nullable=true) + +/** +* Numero de solicitud asociada a la tabla que se modifica. +*/ +private String solicitudenumber; + +@Column(name="BROWSER", nullable=true) + +/** +* Ingresa la informacion del browser. +*/ +private String browser; + +@Column(name="OPERATIVSYSTEM", nullable=true) + +/** +* Ingresa la informacion del sistema operativo. +*/ +private String operativesystem; + +/**Contructor por defecto*/ +public TsafeAudit(){ +} +/**Contructor de TsafeAudit +@param pPk Clave Primaria del entity +@param pCompanycode Codigo de compania al que pertenece la oficina +@param pUsercode Codigo de usuario +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +*/ +public TsafeAudit(TsafeAuditKey pPk,Integer pCompanycode,String pUsercode,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion){ + this(); + pk=pPk; + companycode=pCompanycode; + usercode=pUsercode; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TsafeAudit +*/ +public static TsafeAudit find(EntityManager pEntityManager,TsafeAuditKey pKey) throws Exception{ + TsafeAudit obj = pEntityManager.find(TsafeAudit.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TsafeAudit +@return El objeto que referencia a la Clave primaria de TsafeAudit +*/ +public TsafeAuditKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TsafeAudit +@param pPk El objeto que referencia a la nueva Clave primaria de TsafeAudit +*/ +public void setPk(TsafeAuditKey pPk){ + pk=pPk; +} +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de terminalcode +@return valor de terminalcode*/ +public String getTerminalcode(){ + return terminalcode; +} +/**Fija el valor de terminalcode +@param pTerminalcode nuevo Valor de terminalcode*/ +public void setTerminalcode(String pTerminalcode){ + terminalcode=pTerminalcode; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de oldvalue +@return valor de oldvalue*/ +public String getOldvalue(){ + return oldvalue; +} +/**Fija el valor de oldvalue +@param pOldvalue nuevo Valor de oldvalue*/ +public void setOldvalue(String pOldvalue){ + oldvalue=pOldvalue; +} + +/**Obtiene el valor de newvalue +@return valor de newvalue*/ +public String getNewvalue(){ + return newvalue; +} +/**Fija el valor de newvalue +@param pNewvalue nuevo Valor de newvalue*/ +public void setNewvalue(String pNewvalue){ + newvalue=pNewvalue; +} + +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de solicitudenumber +@return valor de solicitudenumber*/ +public String getSolicitudenumber(){ + return solicitudenumber; +} +/**Fija el valor de solicitudenumber +@param pSolicitudenumber nuevo Valor de solicitudenumber*/ +public void setSolicitudenumber(String pSolicitudenumber){ + solicitudenumber=pSolicitudenumber; +} +/**Obtiene el valor de browser +@return valor de browser*/ +public String getBrowser() { + return browser; +} +/**Fija el valor de browser +@param pBrowser nuevo Valor de browser*/ +public void setBrowser(String pBrowser) { + this.browser = pBrowser; +} +/**Obtiene el valor de operativesystem +@return valor de operativesystem*/ +public String getOperativesystem() { + return operativesystem; +} +/**Fija el valor de operativesystem +@param pOperativesystem nuevo Valor de operativesystem*/ +public void setOperativesystem(String pOperativesystem) { + this.operativesystem = pOperativesystem; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TsafeAudit))return false; + TsafeAudit that = (TsafeAudit) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TsafeAudit +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TsafeAudit +*/ +public Object createInstance(){ + TsafeAudit instance=new TsafeAudit(); + instance.setPk(new TsafeAuditKey()); + return instance; +} +/**Clona la entidad TsafeAudit +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TsafeAudit p=(TsafeAudit)this.clone(); + p.setPk((TsafeAuditKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeAuditInsDel.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeAuditInsDel.java new file mode 100644 index 0000000..8e19ba1 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeAuditInsDel.java @@ -0,0 +1,418 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFEAUDITINSDEL*/ +@Entity(name="TsafeAuditInsDel") +@Table(name="TSAFEAUDITINSDEL") +public class TsafeAuditInsDel extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TsafeAuditInsDel +*/ +@EmbeddedId +private TsafeAuditInsDelKey pk; +@Column(name="COMPANYCODE", nullable=false) + +/** +* Codigo de compania al que pertenece la oficina +*/ +private Integer companycode; + +@Column(name="OFFICECODE", nullable=true) + +/** +* Codigo de oficina +*/ +private Integer officecode; + +@Column(name="BRANCHCODE", nullable=true) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="TERMINALCODE", nullable=true) + +/** +* Codigo de terminal +*/ +private String terminalcode; + +@Column(name="USERCODE", nullable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="TRANSACTIONMODULE", nullable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="ISINSERT", nullable=true) + +/** +* Y, Indica que los datos del registro son de insert +*/ +private String isinsert; + +@Column(name="ISDELETE", nullable=true) + +/** +* Y, Indica que los datos son de un registro eliminado +*/ +private String isdelete; + +@Column(name="RECVALUE", nullable=true) + +/** +* Datos del registro que se elimina +*/ +private String recvalue; + +@Column(name="ACCOUNT", nullable=true) + +/** +* Numero de cuenta que se afecta +*/ +private String account; + +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona asociada a la tabla que se modifica +*/ +private Integer personcode; + +@Column(name="SOLICITUDENUMBER", nullable=true) + +/** +* Numero de solicitud asociada a la tabla que se modifica. +*/ +private String solicitudenumber; + +@Column(name="BROWSER", nullable=true) + +/** +* Ingresa la informacion del browser. +*/ +private String browser; + +@Column(name="OPERATIVSYSTEM", nullable=true) + +/** +* Ingresa la informacion del sistema operativo. +*/ +private String operativesystem; + +/**Contructor por defecto*/ +public TsafeAuditInsDel(){ +} +/**Contructor de TsafeAuditInsDel +@param pPk Clave Primaria del entity +@param pCompanycode Codigo de compania al que pertenece la oficina +@param pUsercode Codigo de usuario +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +*/ +public TsafeAuditInsDel(TsafeAuditInsDelKey pPk,Integer pCompanycode,String pUsercode,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion){ + this(); + pk=pPk; + companycode=pCompanycode; + usercode=pUsercode; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TsafeAuditInsDel +*/ +public static TsafeAuditInsDel find(EntityManager pEntityManager,TsafeAuditInsDelKey pKey) throws Exception{ + TsafeAuditInsDel obj = pEntityManager.find(TsafeAuditInsDel.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TsafeAuditInsDel +@return El objeto que referencia a la Clave primaria de TsafeAuditInsDel +*/ +public TsafeAuditInsDelKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TsafeAuditInsDel +@param pPk El objeto que referencia a la nueva Clave primaria de TsafeAuditInsDel +*/ +public void setPk(TsafeAuditInsDelKey pPk){ + pk=pPk; +} +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de terminalcode +@return valor de terminalcode*/ +public String getTerminalcode(){ + return terminalcode; +} +/**Fija el valor de terminalcode +@param pTerminalcode nuevo Valor de terminalcode*/ +public void setTerminalcode(String pTerminalcode){ + terminalcode=pTerminalcode; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de isinsert +@return valor de isinsert*/ +public String getIsinsert(){ + return isinsert; +} +/**Fija el valor de isinsert +@param pIsinsert nuevo Valor de isinsert*/ +public void setIsinsert(String pIsinsert){ + isinsert=pIsinsert; +} + +/**Obtiene el valor de isdelete +@return valor de isdelete*/ +public String getIsdelete(){ + return isdelete; +} +/**Fija el valor de isdelete +@param pIsdelete nuevo Valor de isdelete*/ +public void setIsdelete(String pIsdelete){ + isdelete=pIsdelete; +} + +/**Obtiene el valor de recvalue +@return valor de recvalue*/ +public String getRecvalue(){ + return recvalue; +} +/**Fija el valor de recvalue +@param pRecvalue nuevo Valor de recvalue*/ +public void setRecvalue(String pRecvalue){ + recvalue=pRecvalue; +} + +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de solicitudenumber +@return valor de solicitudenumber*/ +public String getSolicitudenumber(){ + return solicitudenumber; +} +/**Fija el valor de solicitudenumber +@param pSolicitudenumber nuevo Valor de solicitudenumber*/ +public void setSolicitudenumber(String pSolicitudenumber){ + solicitudenumber=pSolicitudenumber; +} +/**Obtiene el valor de browser +@return valor de browser*/ +public String getBrowser() { + return browser; +} +/**Fija el valor de browser +@param pBrowser nuevo Valor de browser*/ +public void setBrowser(String pBrowser) { + this.browser = pBrowser; +} +/**Obtiene el valor de operativesystem +@return valor de operativesystem*/ +public String getOperativesystem() { + return operativesystem; +} +/**Fija el valor de operativesystem +@param pOperativesystem nuevo Valor de operativesystem*/ +public void setOperativesystem(String pOperativesystem) { + this.operativesystem = pOperativesystem; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TsafeAuditInsDel))return false; + TsafeAuditInsDel that = (TsafeAuditInsDel) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TsafeAuditInsDel +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TsafeAuditInsDel +*/ +public Object createInstance(){ + TsafeAuditInsDel instance=new TsafeAuditInsDel(); + instance.setPk(new TsafeAuditInsDelKey()); + return instance; +} +/**Clona la entidad TsafeAuditInsDel +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TsafeAuditInsDel p=(TsafeAuditInsDel)this.clone(); + p.setPk((TsafeAuditInsDelKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeAuditInsDelKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeAuditInsDelKey.java new file mode 100644 index 0000000..079cd6a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeAuditInsDelKey.java @@ -0,0 +1,180 @@ +package com.fp.persistence.pgeneral.safe; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TSAFEAUDITINSDEL*/ +@Embeddable +public class TsafeAuditInsDelKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CHANGEDATE", nullable=false,updatable=false) + +/** +* Fecha del log, es la fecha en la que se realizo el cambio de una tabla +*/ +private Date changedate; + +@Column(name="TABLENAME", nullable=false,updatable=false) + +/** +* Nombre de la tabla +*/ +private String tablename; + +@Column(name="PARTITIONDB", nullable=false,updatable=false) + +/** +* Anio mes de la fecha del cambio, con este dato se particiona la tabla. +*/ +private String partitiondb; + +@Column(name="REALDATE", nullable=false,updatable=false) + +/** +* Fecha real del cambio +*/ +private Timestamp realdate; + +/**Contructor por defecto*/ +public TsafeAuditInsDelKey(){} +/**Contructor de TsafeAuditInsDelKey +@param pChangedate Fecha del log, es la fecha en la que se realizo el cambio de una tabla +@param pTablename Nombre de la tabla +@param pPartitiondb Anio mes de la fecha del cambio, con este dato se particiona la tabla. +@param pRealdate Fecha real del cambio +*/ +public TsafeAuditInsDelKey(Date pChangedate,String pTablename,String pPartitiondb,Timestamp pRealdate){ + changedate=pChangedate; + tablename=pTablename; + partitiondb=pPartitiondb; + realdate=pRealdate; +} +/**Obtiene el valor de changedate +@return valor de changedate*/ +public Date getChangedate(){ + return changedate; +} +/**Fija el valor de changedate +@param pChangedate nuevo Valor de changedate*/ +public void setChangedate(Date pChangedate){ + changedate=pChangedate; +} + +/**Obtiene el valor de tablename +@return valor de tablename*/ +public String getTablename(){ + return tablename; +} +/**Fija el valor de tablename +@param pTablename nuevo Valor de tablename*/ +public void setTablename(String pTablename){ + tablename=pTablename; +} + +/**Obtiene el valor de partitiondb +@return valor de partitiondb*/ +public String getPartitiondb(){ + return partitiondb; +} +/**Fija el valor de partitiondb +@param pPartitiondb nuevo Valor de partitiondb*/ +public void setPartitiondb(String pPartitiondb){ + partitiondb=pPartitiondb; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Timestamp getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Timestamp pRealdate){ + realdate=pRealdate; +} + +/**Implementacin de la comparacin de TsafeAuditInsDelKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TsafeAuditInsDelKey))return false; + TsafeAuditInsDelKey that = (TsafeAuditInsDelKey) o; + if (this.getChangedate() == null || that.getChangedate() == null){ + return false; + } + if (! this.getChangedate().equals(that.getChangedate())){ + return false; + } + if (this.getTablename() == null || that.getTablename() == null){ + return false; + } + if (! this.getTablename().equals(that.getTablename())){ + return false; + } + if (this.getPartitiondb() == null || that.getPartitiondb() == null){ + return false; + } + if (! this.getPartitiondb().equals(that.getPartitiondb())){ + return false; + } + if (this.getRealdate() == null || that.getRealdate() == null){ + return false; + } + if (! this.getRealdate().equals(that.getRealdate())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TsafeAuditInsDelKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getChangedate() == null ? 0 : this.getChangedate().hashCode()); + result = result * 37 + (this.getTablename() == null ? 0 : this.getTablename().hashCode()); + result = result * 37 + (this.getPartitiondb() == null ? 0 : this.getPartitiondb().hashCode()); + result = result * 37 + (this.getRealdate() == null ? 0 : this.getRealdate().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeAuditKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeAuditKey.java new file mode 100644 index 0000000..6970256 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeAuditKey.java @@ -0,0 +1,207 @@ +package com.fp.persistence.pgeneral.safe; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TSAFEAUDIT*/ +@Embeddable +public class TsafeAuditKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CHANGEDATE", nullable=false,updatable=false) + +/** +* Fecha del log, es la fecha en la que se realizo el cambio de una tabla +*/ +private Date changedate; + +@Column(name="TABLENAME", nullable=false,updatable=false) + +/** +* Nombre de la tabla +*/ +private String tablename; + +@Column(name="COLUMNNAME", nullable=false,updatable=false) + +/** +* Nombre del campo que se modifico +*/ +private String columnname; + +@Column(name="PARTITIONDB", nullable=false,updatable=false) + +/** +* Anio mes de la fecha del cambio, con este dato se particiona la tabla. +*/ +private String partitiondb; + +@Column(name="REALDATE", nullable=false,updatable=false) + +/** +* Fecha real del cambio +*/ +private Timestamp realdate; + +/**Contructor por defecto*/ +public TsafeAuditKey(){} +/**Contructor de TsafeAuditKey +@param pChangedate Fecha del log, es la fecha en la que se realizo el cambio de una tabla +@param pTablename Nombre de la tabla +@param pColumnname Nombre del campo que se modifico +@param pPartitiondb Anio mes de la fecha del cambio, con este dato se particiona la tabla. +@param pRealdate Fecha real del cambio +*/ +public TsafeAuditKey(Date pChangedate,String pTablename,String pColumnname,String pPartitiondb,Timestamp pRealdate){ + changedate=pChangedate; + tablename=pTablename; + columnname=pColumnname; + partitiondb=pPartitiondb; + realdate=pRealdate; +} +/**Obtiene el valor de changedate +@return valor de changedate*/ +public Date getChangedate(){ + return changedate; +} +/**Fija el valor de changedate +@param pChangedate nuevo Valor de changedate*/ +public void setChangedate(Date pChangedate){ + changedate=pChangedate; +} + +/**Obtiene el valor de tablename +@return valor de tablename*/ +public String getTablename(){ + return tablename; +} +/**Fija el valor de tablename +@param pTablename nuevo Valor de tablename*/ +public void setTablename(String pTablename){ + tablename=pTablename; +} + +/**Obtiene el valor de columnname +@return valor de columnname*/ +public String getColumnname(){ + return columnname; +} +/**Fija el valor de columnname +@param pColumnname nuevo Valor de columnname*/ +public void setColumnname(String pColumnname){ + columnname=pColumnname; +} + +/**Obtiene el valor de partitiondb +@return valor de partitiondb*/ +public String getPartitiondb(){ + return partitiondb; +} +/**Fija el valor de partitiondb +@param pPartitiondb nuevo Valor de partitiondb*/ +public void setPartitiondb(String pPartitiondb){ + partitiondb=pPartitiondb; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Timestamp getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Timestamp pRealdate){ + realdate=pRealdate; +} + +/**Implementacin de la comparacin de TsafeAuditKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TsafeAuditKey))return false; + TsafeAuditKey that = (TsafeAuditKey) o; + if (this.getChangedate() == null || that.getChangedate() == null){ + return false; + } + if (! this.getChangedate().equals(that.getChangedate())){ + return false; + } + if (this.getTablename() == null || that.getTablename() == null){ + return false; + } + if (! this.getTablename().equals(that.getTablename())){ + return false; + } + if (this.getColumnname() == null || that.getColumnname() == null){ + return false; + } + if (! this.getColumnname().equals(that.getColumnname())){ + return false; + } + if (this.getPartitiondb() == null || that.getPartitiondb() == null){ + return false; + } + if (! this.getPartitiondb().equals(that.getPartitiondb())){ + return false; + } + if (this.getRealdate() == null || that.getRealdate() == null){ + return false; + } + if (! this.getRealdate().equals(that.getRealdate())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TsafeAuditKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getChangedate() == null ? 0 : this.getChangedate().hashCode()); + result = result * 37 + (this.getTablename() == null ? 0 : this.getTablename().hashCode()); + result = result * 37 + (this.getColumnname() == null ? 0 : this.getColumnname().hashCode()); + result = result * 37 + (this.getPartitiondb() == null ? 0 : this.getPartitiondb().hashCode()); + result = result * 37 + (this.getRealdate() == null ? 0 : this.getRealdate().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeJavaScript.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeJavaScript.java new file mode 100644 index 0000000..fefa37f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeJavaScript.java @@ -0,0 +1,163 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import java.util.List; +import javax.persistence.Query; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFEJAVASCRIPT*/ +@Entity(name = "TsafeJavaScript") +@Table(name = "TSAFEJAVASCRIPT") +public class TsafeJavaScript extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TsafeJavaScript + */ + @EmbeddedId + private TsafeJavaScriptKey pk; + + /**Contructor por defecto*/ + public TsafeJavaScript() { + } + + /**Contructor de TsafeJavaScript + @param pPk Clave Primaria del entity + */ + public TsafeJavaScript(TsafeJavaScriptKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TsafeJavaScript + */ + public static TsafeJavaScript find(EntityManager pEntityManager, TsafeJavaScriptKey pKey) throws Exception { + TsafeJavaScript obj = pEntityManager.find(TsafeJavaScript.class, pKey); + return obj; + } + + /**Entrega la Clave primaria de TsafeJavaScript + @return El objeto que referencia a la Clave primaria de TsafeJavaScript + */ + public TsafeJavaScriptKey getPk() { + return pk; + } + + /**Fija un nuevo valor a la Clave primaria de TsafeJavaScript + @param pPk El objeto que referencia a la nueva Clave primaria de TsafeJavaScript + */ + public void setPk(TsafeJavaScriptKey pPk) { + pk = pPk; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TsafeJavaScript)) { + return false; + } + TsafeJavaScript that = (TsafeJavaScript) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /**Implementacin del metodo hashCode de la la entidad TsafeJavaScript + @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /**Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /**Implementacin de la creacin de un bean en blanco TsafeJavaScript + */ + public Object createInstance() { + TsafeJavaScript instance = new TsafeJavaScript(); + instance.setPk(new TsafeJavaScriptKey()); + return instance; + } + + /**Clona la entidad TsafeJavaScript + @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TsafeJavaScript p = (TsafeJavaScript) this.clone(); + p.setPk((TsafeJavaScriptKey) this.pk.cloneMe()); + return p; + } + //METODOS MANAUALES + private static final String HQL = + "select tb.pk.filename from TsafeJavaScript tb " + + " where tb.pk.companycode = :companycode" + + " and tb.pk.channelcode = :channelcode"; + + /** + * Metodo que devuelve los javascript a ser utilizados en la aplicacion + * @param pEntityManager + * @param companycode + * @param channelcode + * @return + */ + public static List find(EntityManager pEntityManager, Integer companycode, String channelcode) { + List lTsafeJavaScript = null; + Query qry = pEntityManager.createQuery(HQL); + qry.setParameter("companycode", companycode); + qry.setParameter("channelcode", channelcode); + lTsafeJavaScript = qry.getResultList(); + return lTsafeJavaScript; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeJavaScriptKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeJavaScriptKey.java new file mode 100644 index 0000000..21c5e82 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeJavaScriptKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TSAFEJAVASCRIPT*/ +@Embeddable +public class TsafeJavaScriptKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="CHANNELCODE", nullable=false,updatable=false) + +/** +* Codigo de canal. +*/ +private String channelcode; + +@Column(name="FILENAME", nullable=false,updatable=false) + +/** +* Nombre del java script a enviar al canal. +*/ +private String filename; + +/**Contructor por defecto*/ +public TsafeJavaScriptKey(){} +/**Contructor de TsafeJavaScriptKey +@param pCompanycode Codigo de compania +@param pChannelcode Codigo de canal. +@param pFilename Nombre del java script a enviar al canal. +*/ +public TsafeJavaScriptKey(Integer pCompanycode,String pChannelcode,String pFilename){ + companycode=pCompanycode; + channelcode=pChannelcode; + filename=pFilename; +} +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de channelcode +@return valor de channelcode*/ +public String getChannelcode(){ + return channelcode; +} +/**Fija el valor de channelcode +@param pChannelcode nuevo Valor de channelcode*/ +public void setChannelcode(String pChannelcode){ + channelcode=pChannelcode; +} + +/**Obtiene el valor de filename +@return valor de filename*/ +public String getFilename(){ + return filename; +} +/**Fija el valor de filename +@param pFilename nuevo Valor de filename*/ +public void setFilename(String pFilename){ + filename=pFilename; +} + +/**Implementacin de la comparacin de TsafeJavaScriptKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TsafeJavaScriptKey))return false; + TsafeJavaScriptKey that = (TsafeJavaScriptKey) o; + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getChannelcode() == null || that.getChannelcode() == null){ + return false; + } + if (! this.getChannelcode().equals(that.getChannelcode())){ + return false; + } + if (this.getFilename() == null || that.getFilename() == null){ + return false; + } + if (! this.getFilename().equals(that.getFilename())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TsafeJavaScriptKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getChannelcode() == null ? 0 : this.getChannelcode().hashCode()); + result = result * 37 + (this.getFilename() == null ? 0 : this.getFilename().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafePassword.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafePassword.java new file mode 100644 index 0000000..85bf6bb --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafePassword.java @@ -0,0 +1,284 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import com.fp.dto.hb.Log; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFEPASSWORD*/ +@Entity(name="TsafePassword") +@Table(name="TSAFEPASSWORD") +public class TsafePassword extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TsafePassword +*/ +@EmbeddedId +private TsafePasswordKey pk; +@Column(name="VALIDITYDAYS", nullable=true) + +/** +* Dias de validez del password +*/ +private Integer validitydays; + +@Column(name="MINLENGTH", nullable=true) + +/** +* Longitud minica del password +*/ +private Integer minlength; + +@Column(name="MINNOTREPEATED", nullable=true) + +/** +* Numero de las ultimas n veces que el password no se puede repetir, ejemplo 3, el nuevo password tiene que ser diferente a los ultimos 3 password +*/ +private Integer minnotrepeated; + +@Column(name="MINNUMBER", nullable=true) + +/** +* Numero minimo de digios del 0-9 que formen parte del password +*/ +private Integer minnumber; + +@Column(name="MINSPECIALCHARACTERS", nullable=true) + +/** +* Numero minimo de caracteres especiales no numeros si a-z o A_Z +*/ +private Integer minspecialcharacters; + +@Column(name="MINUPPERCASE", nullable=true) + +/** +* Minimo numero de minusculas compredidas entre la a-z +*/ +private Integer minuppercase; + +@Column(name="MINLOWERCASE", nullable=true) + +/** +* Minimo numero de mayusculas comprendidas entre la A_Z +*/ +private Integer minlowercase; + +@Column(name="MESSAGEDAYS", nullable=true) + +/** +* Numero de dias antes del vencimiento del password para enviar mensajes de notificaion +*/ +private Integer messagedays; + +@Column(name="INTENTNUMBER", nullable=true) + +/** +* Numero de intentos, de ingreso de password fallido para bloquear al usuario +*/ +private Integer intentnumber; + +/**Contructor por defecto*/ +public TsafePassword(){ +} +/**Contructor de TsafePassword +@param pPk Clave Primaria del entity +*/ +public TsafePassword(TsafePasswordKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TsafePassword +*/ +public static TsafePassword find(EntityManager pEntityManager,TsafePasswordKey pKey) throws Exception{ + TsafePassword obj = pEntityManager.find(TsafePassword.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TsafePassword +@return El objeto que referencia a la Clave primaria de TsafePassword +*/ +public TsafePasswordKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TsafePassword +@param pPk El objeto que referencia a la nueva Clave primaria de TsafePassword +*/ +public void setPk(TsafePasswordKey pPk){ + pk=pPk; +} +/**Obtiene el valor de validitydays +@return valor de validitydays*/ +public Integer getValiditydays(){ + return validitydays; +} +/**Fija el valor de validitydays +@param pValiditydays nuevo Valor de validitydays*/ +public void setValiditydays(Integer pValiditydays){ + validitydays=pValiditydays; +} + +/**Obtiene el valor de minlength +@return valor de minlength*/ +public Integer getMinlength(){ + return minlength; +} +/**Fija el valor de minlength +@param pMinlength nuevo Valor de minlength*/ +public void setMinlength(Integer pMinlength){ + minlength=pMinlength; +} + +/**Obtiene el valor de minnotrepeated +@return valor de minnotrepeated*/ +public Integer getMinnotrepeated(){ + return minnotrepeated; +} +/**Fija el valor de minnotrepeated +@param pMinnotrepeated nuevo Valor de minnotrepeated*/ +public void setMinnotrepeated(Integer pMinnotrepeated){ + minnotrepeated=pMinnotrepeated; +} + +/**Obtiene el valor de minnumber +@return valor de minnumber*/ +public Integer getMinnumber(){ + return minnumber; +} +/**Fija el valor de minnumber +@param pMinnumber nuevo Valor de minnumber*/ +public void setMinnumber(Integer pMinnumber){ + minnumber=pMinnumber; +} + +/**Obtiene el valor de minspecialcharacters +@return valor de minspecialcharacters*/ +public Integer getMinspecialcharacters(){ + return minspecialcharacters; +} +/**Fija el valor de minspecialcharacters +@param pMinspecialcharacters nuevo Valor de minspecialcharacters*/ +public void setMinspecialcharacters(Integer pMinspecialcharacters){ + minspecialcharacters=pMinspecialcharacters; +} + +/**Obtiene el valor de minuppercase +@return valor de minuppercase*/ +public Integer getMinuppercase(){ + return minuppercase; +} +/**Fija el valor de minuppercase +@param pMinuppercase nuevo Valor de minuppercase*/ +public void setMinuppercase(Integer pMinuppercase){ + minuppercase=pMinuppercase; +} + +/**Obtiene el valor de minlowercase +@return valor de minlowercase*/ +public Integer getMinlowercase(){ + return minlowercase; +} +/**Fija el valor de minlowercase +@param pMinlowercase nuevo Valor de minlowercase*/ +public void setMinlowercase(Integer pMinlowercase){ + minlowercase=pMinlowercase; +} + +/**Obtiene el valor de messagedays +@return valor de messagedays*/ +public Integer getMessagedays(){ + return messagedays; +} +/**Fija el valor de messagedays +@param pMessagedays nuevo Valor de messagedays*/ +public void setMessagedays(Integer pMessagedays){ + messagedays=pMessagedays; +} + +/**Obtiene el valor de intentnumber +@return valor de intentnumber*/ +public Integer getIntentnumber(){ + return intentnumber; +} +/**Fija el valor de intentnumber +@param pIntentnumber nuevo Valor de intentnumber*/ +public void setIntentnumber(Integer pIntentnumber){ + intentnumber=pIntentnumber; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TsafePassword))return false; + TsafePassword that = (TsafePassword) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TsafePassword +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TsafePassword +*/ +public Object createInstance(){ + TsafePassword instance=new TsafePassword(); + instance.setPk(new TsafePasswordKey()); + return instance; +} +/**Clona la entidad TsafePassword +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TsafePassword p=(TsafePassword)this.clone(); + p.setPk((TsafePasswordKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafePasswordKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafePasswordKey.java new file mode 100644 index 0000000..1262fe9 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafePasswordKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TSAFEPASSWORD*/ +@Embeddable +public class TsafePasswordKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="CHANNELCODE", nullable=false,updatable=false) + +/** +* Codigo de canal. +*/ +private String channelcode; + +/**Contructor por defecto*/ +public TsafePasswordKey(){} +/**Contructor de TsafePasswordKey +@param pCompanycode Codigo de compania +@param pChannelcode Codigo de canal. +*/ +public TsafePasswordKey(Integer pCompanycode,String pChannelcode){ + companycode=pCompanycode; + channelcode=pChannelcode; +} +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de channelcode +@return valor de channelcode*/ +public String getChannelcode(){ + return channelcode; +} +/**Fija el valor de channelcode +@param pChannelcode nuevo Valor de channelcode*/ +public void setChannelcode(String pChannelcode){ + channelcode=pChannelcode; +} + +/**Implementacin de la comparacin de TsafePasswordKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TsafePasswordKey))return false; + TsafePasswordKey that = (TsafePasswordKey) o; + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getChannelcode() == null || that.getChannelcode() == null){ + return false; + } + if (! this.getChannelcode().equals(that.getChannelcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TsafePasswordKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getChannelcode() == null ? 0 : this.getChannelcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeProfile.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeProfile.java new file mode 100644 index 0000000..e5dd0ac --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeProfile.java @@ -0,0 +1,160 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFEPROFILE*/ +@Entity(name="TsafeProfile") +@Table(name="TSAFEPROFILE") +public class TsafeProfile extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TsafeProfile +*/ +@Id +@Column(name="PROFILECODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="DESCRIPTION", nullable=false) + +/** +* Nombre del perfil +*/ +private String description; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistick locking del registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TsafeProfile(){ +} +/**Contructor de TsafeProfile +@param pPk Clave Primaria del entity +@param pDescription Nombre del perfil +*/ +public TsafeProfile(String pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TsafeProfile +*/ +public static TsafeProfile find(EntityManager pEntityManager,Object pKey) throws Exception{ + TsafeProfile obj = pEntityManager.find(TsafeProfile.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TsafeProfile +@return El objeto que referencia a la Clave primaria de TsafeProfile +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TsafeProfile +@param pPk El objeto que referencia a la nueva Clave primaria de TsafeProfile +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TsafeProfile))return false; + TsafeProfile that = (TsafeProfile) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TsafeProfile +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TsafeProfile +*/ +public Object createInstance(){ + TsafeProfile instance=new TsafeProfile(); + return instance; +} +/**Clona la entidad TsafeProfile +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TsafeProfile p=(TsafeProfile)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeProfileHorary.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeProfileHorary.java new file mode 100644 index 0000000..923f361 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeProfileHorary.java @@ -0,0 +1,221 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFEPROFILEHORARY*/ +@Entity(name="TsafeProfileHorary") +@Table(name="TSAFEPROFILEHORARY") +public class TsafeProfileHorary extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Log{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TsafeProfileHorary +*/ +@EmbeddedId +private TsafeProfileHoraryKey pk; +@Column(name="REGISTERCODE", nullable=false) + +/** +* Codigo de registro es la suma de los campos de la llave primaria +*/ +private String registercode; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="INITTIME", nullable=false) + +/** +* Horas y minutos desde la cual es disponible la transaccion para el dia +*/ +private String inittime; + +@Column(name="FINISHTIME", nullable=false) + +/** +* Horas y minutos hasta la cual es disponible la transaccion para el dia +*/ +private String finishtime; + +@Column(name="VALIDATEAMOUNT", nullable=true) + +/** +* Y Indica que valida monto de la transaccion utilizada en transacciones financieras. N no valida monto. +*/ +private String validateamount; + +/**Contructor por defecto*/ +public TsafeProfileHorary(){ +} +/**Contructor de TsafeProfileHorary +@param pPk Clave Primaria del entity +@param pRegistercode Codigo de registro es la suma de los campos de la llave primaria +@param pInittime Horas y minutos desde la cual es disponible la transaccion para el dia +@param pFinishtime Horas y minutos hasta la cual es disponible la transaccion para el dia +*/ +public TsafeProfileHorary(TsafeProfileHoraryKey pPk,String pRegistercode,String pInittime,String pFinishtime){ + this(); + pk=pPk; + registercode=pRegistercode; + inittime=pInittime; + finishtime=pFinishtime; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TsafeProfileHorary +*/ +public static TsafeProfileHorary find(EntityManager pEntityManager,TsafeProfileHoraryKey pKey) throws Exception{ + TsafeProfileHorary obj = pEntityManager.find(TsafeProfileHorary.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TsafeProfileHorary +@return El objeto que referencia a la Clave primaria de TsafeProfileHorary +*/ +public TsafeProfileHoraryKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TsafeProfileHorary +@param pPk El objeto que referencia a la nueva Clave primaria de TsafeProfileHorary +*/ +public void setPk(TsafeProfileHoraryKey pPk){ + pk=pPk; +} +/**Obtiene el valor de registercode +@return valor de registercode*/ +public String getRegistercode(){ + return registercode; +} +/**Fija el valor de registercode +@param pRegistercode nuevo Valor de registercode*/ +public void setRegistercode(String pRegistercode){ + registercode=pRegistercode; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de inittime +@return valor de inittime*/ +public String getInittime(){ + return inittime; +} +/**Fija el valor de inittime +@param pInittime nuevo Valor de inittime*/ +public void setInittime(String pInittime){ + inittime=pInittime; +} + +/**Obtiene el valor de finishtime +@return valor de finishtime*/ +public String getFinishtime(){ + return finishtime; +} +/**Fija el valor de finishtime +@param pFinishtime nuevo Valor de finishtime*/ +public void setFinishtime(String pFinishtime){ + finishtime=pFinishtime; +} + +/**Obtiene el valor de validateamount +@return valor de validateamount*/ +public String getValidateamount(){ + return validateamount; +} +/**Fija el valor de validateamount +@param pValidateamount nuevo Valor de validateamount*/ +public void setValidateamount(String pValidateamount){ + validateamount=pValidateamount; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TsafeProfileHorary))return false; + TsafeProfileHorary that = (TsafeProfileHorary) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TsafeProfileHorary +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TsafeProfileHorary +*/ +public Object createInstance(){ + TsafeProfileHorary instance=new TsafeProfileHorary(); + instance.setPk(new TsafeProfileHoraryKey()); + return instance; +} +/**Clona la entidad TsafeProfileHorary +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TsafeProfileHorary p=(TsafeProfileHorary)this.clone(); + p.setPk((TsafeProfileHoraryKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeProfileHoraryAmount.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeProfileHoraryAmount.java new file mode 100644 index 0000000..a8e1124 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeProfileHoraryAmount.java @@ -0,0 +1,160 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFEPROFILEHORARYAMOUNT*/ +@Entity(name="TsafeProfileHoraryAmount") +@Table(name="TSAFEPROFILEHORARYAMOUNT") +public class TsafeProfileHoraryAmount extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TsafeProfileHoraryAmount +*/ +@EmbeddedId +private TsafeProfileHoraryAmountKey pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="AMOUNT", nullable=true) + +/** +* Monto maximo permitido para la transaccion moneda. +*/ +private BigDecimal amount; + +/**Contructor por defecto*/ +public TsafeProfileHoraryAmount(){ +} +/**Contructor de TsafeProfileHoraryAmount +@param pPk Clave Primaria del entity +*/ +public TsafeProfileHoraryAmount(TsafeProfileHoraryAmountKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TsafeProfileHoraryAmount +*/ +public static TsafeProfileHoraryAmount find(EntityManager pEntityManager,TsafeProfileHoraryAmountKey pKey) throws Exception{ + TsafeProfileHoraryAmount obj = pEntityManager.find(TsafeProfileHoraryAmount.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TsafeProfileHoraryAmount +@return El objeto que referencia a la Clave primaria de TsafeProfileHoraryAmount +*/ +public TsafeProfileHoraryAmountKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TsafeProfileHoraryAmount +@param pPk El objeto que referencia a la nueva Clave primaria de TsafeProfileHoraryAmount +*/ +public void setPk(TsafeProfileHoraryAmountKey pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de amount +@return valor de amount*/ +public BigDecimal getAmount(){ + return amount; +} +/**Fija el valor de amount +@param pAmount nuevo Valor de amount*/ +public void setAmount(BigDecimal pAmount){ + amount=pAmount; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TsafeProfileHoraryAmount))return false; + TsafeProfileHoraryAmount that = (TsafeProfileHoraryAmount) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TsafeProfileHoraryAmount +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TsafeProfileHoraryAmount +*/ +public Object createInstance(){ + TsafeProfileHoraryAmount instance=new TsafeProfileHoraryAmount(); + instance.setPk(new TsafeProfileHoraryAmountKey()); + return instance; +} +/**Clona la entidad TsafeProfileHoraryAmount +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TsafeProfileHoraryAmount p=(TsafeProfileHoraryAmount)this.clone(); + p.setPk((TsafeProfileHoraryAmountKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeProfileHoraryAmountKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeProfileHoraryAmountKey.java new file mode 100644 index 0000000..a2c8e39 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeProfileHoraryAmountKey.java @@ -0,0 +1,205 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TSAFEPROFILEHORARYAMOUNT*/ +@Embeddable +public class TsafeProfileHoraryAmountKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="REGISTERCODE", nullable=false,updatable=false) + +/** +* Codigo de registro de perfil + transaccion + dia +*/ +private String registercode; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=false,updatable=false) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +/**Contructor por defecto*/ +public TsafeProfileHoraryAmountKey(){} +/**Contructor de TsafeProfileHoraryAmountKey +@param pRegistercode Codigo de registro de perfil + transaccion + dia +@param pModulecode Codigo de modulo +@param pProductcode Codigo de producto +@param pSubproductcode Codigo de subproducto +@param pCurrencycode Codigo de moneda +*/ +public TsafeProfileHoraryAmountKey(String pRegistercode,String pModulecode,String pProductcode,String pSubproductcode,String pCurrencycode){ + registercode=pRegistercode; + modulecode=pModulecode; + productcode=pProductcode; + subproductcode=pSubproductcode; + currencycode=pCurrencycode; +} +/**Obtiene el valor de registercode +@return valor de registercode*/ +public String getRegistercode(){ + return registercode; +} +/**Fija el valor de registercode +@param pRegistercode nuevo Valor de registercode*/ +public void setRegistercode(String pRegistercode){ + registercode=pRegistercode; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Implementacin de la comparacin de TsafeProfileHoraryAmountKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TsafeProfileHoraryAmountKey))return false; + TsafeProfileHoraryAmountKey that = (TsafeProfileHoraryAmountKey) o; + if (this.getRegistercode() == null || that.getRegistercode() == null){ + return false; + } + if (! this.getRegistercode().equals(that.getRegistercode())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getProductcode() == null || that.getProductcode() == null){ + return false; + } + if (! this.getProductcode().equals(that.getProductcode())){ + return false; + } + if (this.getSubproductcode() == null || that.getSubproductcode() == null){ + return false; + } + if (! this.getSubproductcode().equals(that.getSubproductcode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TsafeProfileHoraryAmountKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getRegistercode() == null ? 0 : this.getRegistercode().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getProductcode() == null ? 0 : this.getProductcode().hashCode()); + result = result * 37 + (this.getSubproductcode() == null ? 0 : this.getSubproductcode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeProfileHoraryKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeProfileHoraryKey.java new file mode 100644 index 0000000..71abd02 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeProfileHoraryKey.java @@ -0,0 +1,205 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TSAFEPROFILEHORARY*/ +@Embeddable +public class TsafeProfileHoraryKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="PROFILECODE", nullable=false,updatable=false) + +/** +* Codigo de perfil de usuario +*/ +private String profilecode; + +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="DAY", nullable=false,updatable=false) + +/** +* Dia de la semana para la cual esta disponible la transaccion +*/ +private Integer day; + +/**Contructor por defecto*/ +public TsafeProfileHoraryKey(){} +/**Contructor de TsafeProfileHoraryKey +@param pProfilecode Codigo de perfil de usuario +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pDay Dia de la semana para la cual esta disponible la transaccion +*/ +public TsafeProfileHoraryKey(String pProfilecode,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,Integer pDay){ + profilecode=pProfilecode; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + day=pDay; +} +/**Obtiene el valor de profilecode +@return valor de profilecode*/ +public String getProfilecode(){ + return profilecode; +} +/**Fija el valor de profilecode +@param pProfilecode nuevo Valor de profilecode*/ +public void setProfilecode(String pProfilecode){ + profilecode=pProfilecode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de day +@return valor de day*/ +public Integer getDay(){ + return day; +} +/**Fija el valor de day +@param pDay nuevo Valor de day*/ +public void setDay(Integer pDay){ + day=pDay; +} + +/**Implementacin de la comparacin de TsafeProfileHoraryKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TsafeProfileHoraryKey))return false; + TsafeProfileHoraryKey that = (TsafeProfileHoraryKey) o; + if (this.getProfilecode() == null || that.getProfilecode() == null){ + return false; + } + if (! this.getProfilecode().equals(that.getProfilecode())){ + return false; + } + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getDay() == null || that.getDay() == null){ + return false; + } + if (! this.getDay().equals(that.getDay())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TsafeProfileHoraryKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getProfilecode() == null ? 0 : this.getProfilecode().hashCode()); + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getDay() == null ? 0 : this.getDay().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeTerminal.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeTerminal.java new file mode 100644 index 0000000..d0b998b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeTerminal.java @@ -0,0 +1,288 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; +import com.fp.general.exception.GeneralException; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFETERMINAL*/ +@Entity(name = "TsafeTerminal") +@Table(name = "TSAFETERMINAL") +public class TsafeTerminal extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable,Log { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TsafeTerminal + */ + @EmbeddedId + private TsafeTerminalKey pk; + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic blocking del registro + */ + private Integer recordversion; + @Column(name = "OFFICECODE", nullable = true) + /** + * Codigo de oficina + */ + private Integer officecode; + @Column(name = "BRANCHCODE", nullable = true) + /** + * Codigo de sucursal + */ + private Integer branchcode; + @Column(name = "AREACODE", nullable = true) + /** + * Codigo de area + */ + private Integer areacode; + @Column(name = "IPADDRESS", nullable = true) + /** + * Ip de la maquina + */ + private String ipaddress; + @Column(name = "MACADDRESS", nullable = true) + /** + * Mac de la maquina + */ + private String macaddress; + @Column(name = "SLIPTPRINTER", nullable = true) + /** + * Nombre de la impresora en la que se imprime el slipt de validacion de caja + */ + private String sliptprinter; + + /**Contructor por defecto*/ + public TsafeTerminal() { + } + + /**Contructor de TsafeTerminal + @param pPk Clave Primaria del entity + */ + public TsafeTerminal(TsafeTerminalKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TsafeTerminal + */ + public static TsafeTerminal find(EntityManager pEntityManager, TsafeTerminalKey pKey) throws Exception { + TsafeTerminal obj = pEntityManager.find(TsafeTerminal.class, pKey); + return obj; + } + + /**Entrega la Clave primaria de TsafeTerminal + @return El objeto que referencia a la Clave primaria de TsafeTerminal + */ + public TsafeTerminalKey getPk() { + return pk; + } + + /**Fija un nuevo valor a la Clave primaria de TsafeTerminal + @param pPk El objeto que referencia a la nueva Clave primaria de TsafeTerminal + */ + public void setPk(TsafeTerminalKey pPk) { + pk = pPk; + } + + /**Obtiene el valor de recordversion + @return valor de recordversion*/ + public Integer getRecordversion() { + return recordversion; + } + + /**Fija el valor de recordversion + @param pRecordversion nuevo Valor de recordversion*/ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /**Obtiene el valor de officecode + @return valor de officecode*/ + public Integer getOfficecode() { + return officecode; + } + + /**Fija el valor de officecode + @param pOfficecode nuevo Valor de officecode*/ + public void setOfficecode(Integer pOfficecode) { + officecode = pOfficecode; + } + + /**Obtiene el valor de branchcode + @return valor de branchcode*/ + public Integer getBranchcode() { + return branchcode; + } + + /**Fija el valor de branchcode + @param pBranchcode nuevo Valor de branchcode*/ + public void setBranchcode(Integer pBranchcode) { + branchcode = pBranchcode; + } + + /**Obtiene el valor de areacode + @return valor de areacode*/ + public Integer getAreacode() { + return areacode; + } + + /**Fija el valor de areacode + @param pAreacode nuevo Valor de areacode*/ + public void setAreacode(Integer pAreacode) { + areacode = pAreacode; + } + + /**Obtiene el valor de ipaddress + @return valor de ipaddress*/ + public String getIpaddress() { + return ipaddress; + } + + /**Fija el valor de ipaddress + @param pIpaddress nuevo Valor de ipaddress*/ + public void setIpaddress(String pIpaddress) { + ipaddress = pIpaddress; + } + + /**Obtiene el valor de macaddress + @return valor de macaddress*/ + public String getMacaddress() { + return macaddress; + } + + /**Fija el valor de macaddress + @param pMacaddress nuevo Valor de macaddress*/ + public void setMacaddress(String pMacaddress) { + macaddress = pMacaddress; + } + + /**Obtiene el valor de sliptprinter + @return valor de sliptprinter*/ + public String getSliptprinter() { + return sliptprinter; + } + + /**Fija el valor de sliptprinter + @param pSliptprinter nuevo Valor de sliptprinter*/ + public void setSliptprinter(String pSliptprinter) { + sliptprinter = pSliptprinter; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TsafeTerminal)) { + return false; + } + TsafeTerminal that = (TsafeTerminal) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /**Implementacin del metodo hashCode de la la entidad TsafeTerminal + @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /**Implementacin toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /**Implementacin de la creacin de un bean en blanco TsafeTerminal + */ + public Object createInstance() { + TsafeTerminal instance = new TsafeTerminal(); + instance.setPk(new TsafeTerminalKey()); + return instance; + } + + /**Clona la entidad TsafeTerminal + @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TsafeTerminal p = (TsafeTerminal) this.clone(); + p.setPk((TsafeTerminalKey) this.pk.cloneMe()); + return p; + } + private static final String HQL_TERMINAL = "from TsafeTerminal t where t.pk.companycode = :company and ipaddress = :ip"; + + /** + * Metodo que devuelve un objeto de tipo TsafeTerminal + * @param pEntityManager + * @param company + * @param ip + * @return + * @throws Exception + */ + public static TsafeTerminal find(EntityManager pEntityManager, Integer company, String ip) throws Exception { + TsafeTerminal tsafeTerminal = null; + Query qry = (Query) pEntityManager.createQuery(HQL_TERMINAL); + qry.setParameter("company", company); + qry.setParameter("ip", ip); + try { + tsafeTerminal = (TsafeTerminal) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + return tsafeTerminal; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeTerminalKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeTerminalKey.java new file mode 100644 index 0000000..2150bc8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeTerminalKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TSAFETERMINAL*/ +@Embeddable +public class TsafeTerminalKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TERMINALCODE", nullable=false,updatable=false) + +/** +* Codigo de terminal +*/ +private String terminalcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania al que pertenece la oficina +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TsafeTerminalKey(){} +/**Contructor de TsafeTerminalKey +@param pTerminalcode Codigo de terminal +@param pCompanycode Codigo de compania al que pertenece la oficina +*/ +public TsafeTerminalKey(String pTerminalcode,Integer pCompanycode){ + terminalcode=pTerminalcode; + companycode=pCompanycode; +} +/**Obtiene el valor de terminalcode +@return valor de terminalcode*/ +public String getTerminalcode(){ + return terminalcode; +} +/**Fija el valor de terminalcode +@param pTerminalcode nuevo Valor de terminalcode*/ +public void setTerminalcode(String pTerminalcode){ + terminalcode=pTerminalcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacin de la comparacin de TsafeTerminalKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TsafeTerminalKey))return false; + TsafeTerminalKey that = (TsafeTerminalKey) o; + if (this.getTerminalcode() == null || that.getTerminalcode() == null){ + return false; + } + if (! this.getTerminalcode().equals(that.getTerminalcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TsafeTerminalKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTerminalcode() == null ? 0 : this.getTerminalcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUser.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUser.java new file mode 100644 index 0000000..7f3d36f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUser.java @@ -0,0 +1,174 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFEUSER*/ +@Entity(name="TsafeUser") +@Table(name="TSAFEUSER") +public class TsafeUser extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TsafeUser +*/ +@Id +@Column(name="USERCODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="PERSONCODE", nullable=true) + +/** +* Codigo de persona +*/ +private Integer personcode; + +@Column(name="INTERNALCODE", nullable=true) + +/** +* Codigo de usuario interno, se utiliza para crear secuencias por usuario. +*/ +private Integer internalcode; + +@Column(name="COMPANYCODE", nullable=true) + +/** +* Codigo de compania +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TsafeUser(){ +} +/**Contructor de TsafeUser +@param pPk Clave Primaria del entity +*/ +public TsafeUser(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TsafeUser +*/ +public static TsafeUser find(EntityManager pEntityManager,Object pKey) throws Exception{ + TsafeUser obj = pEntityManager.find(TsafeUser.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TsafeUser +@return El objeto que referencia a la Clave primaria de TsafeUser +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TsafeUser +@param pPk El objeto que referencia a la nueva Clave primaria de TsafeUser +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de internalcode +@return valor de internalcode*/ +public Integer getInternalcode(){ + return internalcode; +} +/**Fija el valor de internalcode +@param pInternalcode nuevo Valor de internalcode*/ +public void setInternalcode(Integer pInternalcode){ + internalcode=pInternalcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TsafeUser))return false; + TsafeUser that = (TsafeUser) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TsafeUser +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TsafeUser +*/ +public Object createInstance(){ + TsafeUser instance=new TsafeUser(); + return instance; +} +/**Clona la entidad TsafeUser +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TsafeUser p=(TsafeUser)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserDetail.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserDetail.java new file mode 100644 index 0000000..ed9ca9f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserDetail.java @@ -0,0 +1,746 @@ +package com.fp.persistence.pgeneral.safe; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; +import com.fp.general.exception.GeneralException; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TSAFEUSERDETAIL + */ +@Entity(name = "TsafeUserDetail") +@Table(name = "TSAFEUSERDETAIL") +public class TsafeUserDetail extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable, Log { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TsafeUserDetail + */ + @EmbeddedId + private TsafeUserDetailKey pk; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic blocking del registro + */ + private Integer recordversion; + + @Column(name = "DATEFROM", nullable = false) + /** + * Fecha desde la cual esta vigente el registro del detalle de usuarios + */ + private Timestamp datefrom; + + @Column(name = "USERSTATUSCATALOG", nullable = true) + /** + * Codigo de catalogo ACT, Activo, BLQ Bloqueado, RET Retirado + */ + private String userstatuscatalog; + + @Column(name = "USERSTATUSCATALOGCODE", nullable = true) + /** + * Codigo de tabla de catalogo USERSTATUS del estatus del usuario + */ + private String userstatuscatalogcode; + + @Column(name = "COMPANYCODE", nullable = true) + /** + * Codigo de compania a la que pertenece el departamento + */ + private Integer companycode; + + @Column(name = "AREACODE", nullable = true) + /** + * Codigo de area + */ + private Integer areacode; + + @Column(name = "OFFICECODE", nullable = true) + /** + * Codigo de oficina + */ + private Integer officecode; + + @Column(name = "BRANCHCODE", nullable = true) + /** + * Codigo de sucursal + */ + private Integer branchcode; + + @Column(name = "CHANNELCODE", nullable = true) + /** + * Codigo de canal. + */ + private String channelcode; + + @Column(name = "LANGUAGECODE", nullable = true) + /** + * Codigo de idioma + */ + private String languagecode; + + @Column(name = "NICKNAME", nullable = false) + /** + * Nombre corto o nombre comn del usuario. + */ + private String nickname; + + @Column(name = "PASSWORD", nullable = true) + /** + * Password + */ + private String password; + + @Column(name = "BRANCHFROMTERMINAL", nullable = true) + /** + * Y indica que la sucursal, oficina area toma del terminal de la maquina + */ + private String branchfromterminal; + + @Column(name = "CHANGEPASSWORD", nullable = true) + /** + * Y Indica que el usuario tiene que cambiar de password al momento de logon, cuando el administrador resea el password + */ + private String changepassword; + + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que ingreso la informacion + */ + private String ingressuser; + + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifico la informacion + */ + private String modifyuser; + + @Column(name = "ACTIVATEUSER", nullable = true) + /** + * Codigo de usuario que pone operativo o activa al usuario. + */ + private String activateuser; + + @Column(name = "TERMINALCODE", nullable = true) + /** + * null + */ + private String terminalcode; + + @Column(name = "ISUSERBPM", nullable = true) + /** + * Y indica que el usuario esta habilitado para trabajar en el JBPM + */ + private String isuserbpm; + + @Column(name="CCENTROCONTROL", nullable=true) + + /** + * Codigo de centro de control de armas + */ + private String ccentrocontrol; + + /** Contructor por defecto */ + public TsafeUserDetail() { + } + + /** + * Contructor de TsafeUserDetail + * + * @param pPk + * Clave Primaria del entity + * @param pDatefrom + * Fecha desde la cual esta vigente el registro del detalle de + * usuarios + * @param pNickname + * Nombre corto o nombre comn del usuario. + */ + public TsafeUserDetail(TsafeUserDetailKey pPk, Timestamp pDatefrom, + String pNickname) { + this(); + pk = pPk; + datefrom = pDatefrom; + nickname = pNickname; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager + * referencia de la session a obtener datos del bean. + * @param pKey + * Caleve primaria del bean. + * @return TsafeUserDetail + */ + public static TsafeUserDetail find(EntityManager pEntityManager, + TsafeUserDetailKey pKey) throws Exception { + TsafeUserDetail obj = pEntityManager.find(TsafeUserDetail.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TsafeUserDetail + * + * @return El objeto que referencia a la Clave primaria de TsafeUserDetail + */ + public TsafeUserDetailKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TsafeUserDetail + * + * @param pPk + * El objeto que referencia a la nueva Clave primaria de + * TsafeUserDetail + */ + public void setPk(TsafeUserDetailKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion + * nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom + * nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + datefrom = pDatefrom; + } + + /** + * Obtiene el valor de userstatuscatalog + * + * @return valor de userstatuscatalog + */ + public String getUserstatuscatalog() { + return userstatuscatalog; + } + + /** + * Fija el valor de userstatuscatalog + * + * @param pUserstatuscatalog + * nuevo Valor de userstatuscatalog + */ + public void setUserstatuscatalog(String pUserstatuscatalog) { + userstatuscatalog = pUserstatuscatalog; + } + + /** + * Obtiene el valor de userstatuscatalogcode + * + * @return valor de userstatuscatalogcode + */ + public String getUserstatuscatalogcode() { + return userstatuscatalogcode; + } + + /** + * Fija el valor de userstatuscatalogcode + * + * @param pUserstatuscatalogcode + * nuevo Valor de userstatuscatalogcode + */ + public void setUserstatuscatalogcode(String pUserstatuscatalogcode) { + userstatuscatalogcode = pUserstatuscatalogcode; + } + + /** + * Obtiene el valor de companycode + * + * @return valor de companycode + */ + public Integer getCompanycode() { + return companycode; + } + + /** + * Fija el valor de companycode + * + * @param pCompanycode + * nuevo Valor de companycode + */ + public void setCompanycode(Integer pCompanycode) { + companycode = pCompanycode; + } + + /** + * Obtiene el valor de areacode + * + * @return valor de areacode + */ + public Integer getAreacode() { + return areacode; + } + + /** + * Fija el valor de areacode + * + * @param pAreacode + * nuevo Valor de areacode + */ + public void setAreacode(Integer pAreacode) { + areacode = pAreacode; + } + + /** + * Obtiene el valor de officecode + * + * @return valor de officecode + */ + public Integer getOfficecode() { + return officecode; + } + + /** + * Fija el valor de officecode + * + * @param pOfficecode + * nuevo Valor de officecode + */ + public void setOfficecode(Integer pOfficecode) { + officecode = pOfficecode; + } + + /** + * Obtiene el valor de branchcode + * + * @return valor de branchcode + */ + public Integer getBranchcode() { + return branchcode; + } + + /** + * Fija el valor de branchcode + * + * @param pBranchcode + * nuevo Valor de branchcode + */ + public void setBranchcode(Integer pBranchcode) { + branchcode = pBranchcode; + } + + /** + * Obtiene el valor de channelcode + * + * @return valor de channelcode + */ + public String getChannelcode() { + return channelcode; + } + + /** + * Fija el valor de channelcode + * + * @param pChannelcode + * nuevo Valor de channelcode + */ + public void setChannelcode(String pChannelcode) { + channelcode = pChannelcode; + } + + /** + * Obtiene el valor de languagecode + * + * @return valor de languagecode + */ + public String getLanguagecode() { + return languagecode; + } + + /** + * Fija el valor de languagecode + * + * @param pLanguagecode + * nuevo Valor de languagecode + */ + public void setLanguagecode(String pLanguagecode) { + languagecode = pLanguagecode; + } + + /** + * Obtiene el valor de nickname + * + * @return valor de nickname + */ + public String getNickname() { + return nickname; + } + + /** + * Fija el valor de nickname + * + * @param pNickname + * nuevo Valor de nickname + */ + public void setNickname(String pNickname) { + nickname = pNickname; + } + + /** + * Obtiene el valor de password + * + * @return valor de password + */ + public String getPassword() { + return password; + } + + /** + * Fija el valor de password + * + * @param pPassword + * nuevo Valor de password + */ + public void setPassword(String pPassword) { + password = pPassword; + } + + /** + * Obtiene el valor de branchfromterminal + * + * @return valor de branchfromterminal + */ + public String getBranchfromterminal() { + return branchfromterminal; + } + + /** + * Fija el valor de branchfromterminal + * + * @param pBranchfromterminal + * nuevo Valor de branchfromterminal + */ + public void setBranchfromterminal(String pBranchfromterminal) { + branchfromterminal = pBranchfromterminal; + } + + /** + * Obtiene el valor de changepassword + * + * @return valor de changepassword + */ + public String getChangepassword() { + return changepassword; + } + + /** + * Fija el valor de changepassword + * + * @param pChangepassword + * nuevo Valor de changepassword + */ + public void setChangepassword(String pChangepassword) { + changepassword = pChangepassword; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser + * nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser + * nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + modifyuser = pModifyuser; + } + + /** + * Obtiene el valor de activateuser + * + * @return valor de activateuser + */ + public String getActivateuser() { + return activateuser; + } + + /** + * Fija el valor de activateuser + * + * @param pActivateuser + * nuevo Valor de activateuser + */ + public void setActivateuser(String pActivateuser) { + activateuser = pActivateuser; + } + + /** + * Obtiene el valor de terminalcode + * + * @return valor de terminalcode + */ + public String getTerminalcode() { + return terminalcode; + } + + /** + * Fija el valor de terminalcode + * + * @param pTerminalcode + * nuevo Valor de terminalcode + */ + public void setTerminalcode(String pTerminalcode) { + terminalcode = pTerminalcode; + } + + /** + * Obtiene el valor de isuserbpm + * + * @return valor de isuserbpm + */ + public String getIsuserbpm() { + return isuserbpm; + } + + /** + * Fija el valor de isuserbpm + * + * @param pIsuserbpm + * nuevo Valor de isuserbpm + */ + public void setIsuserbpm(String pIsuserbpm) { + isuserbpm = pIsuserbpm; + } + + /**Obtiene el valor de ccentrocontrol + @return valor de ccentrocontrol*/ + public String getCcentrocontrol(){ + return ccentrocontrol; + } + /**Fija el valor de ccentrocontrol + @param pCcentrocontrol nuevo Valor de ccentrocontrol*/ + public void setCcentrocontrol(String pCcentrocontrol){ + ccentrocontrol=pCcentrocontrol; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TsafeUserDetail)) + return false; + TsafeUserDetail that = (TsafeUserDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TsafeUserDetail + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 + || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TsafeUserDetail */ + public Object createInstance() { + TsafeUserDetail instance = new TsafeUserDetail(); + instance.setPk(new TsafeUserDetailKey()); + return instance; + } + + /** + * Clona la entidad TsafeUserDetail + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TsafeUserDetail p = (TsafeUserDetail) this.clone(); + p.setPk((TsafeUserDetailKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + + //METODOS MANUALES + /**Sentecnia que entrega lista de los ultimos n passwords del usuario ordenados en forma decendente*/ + private static String SQL = "from TsafeUserDetail t where t.pk.usercode = :usercode " + + " order by t.pk.dateto desc "; + + /** + * Enterga una lista de registros asociados a un usuario de TsafeUserDetail ordenados en forma decendenete. + * @param pEntityManager Session de la base de datos. + * @param pUserCode Codigo de usuario + * @param pNumReg Numero de registros a obtener en la lista . + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pUserCode, Integer pNumReg) throws Exception { + List ldata = null; + Query qry = pEntityManager.createQuery(SQL); + qry.setParameter("usercode", pUserCode); + qry.setMaxResults(pNumReg); + ldata = qry.getResultList(); + return ldata; + } + + /**Sentecnia que entrega un objeto con los datos de un usuario.*/ + private static String JPQL_BY_USER = "from TsafeUserDetail t where t.pk.usercode = :usercode " + + " and t.pk.dateto = :dateto "; + + /** + * Enterga un objeto con los datos de un usuario de TsafeUserDetail. + * @param pEntityManager Session de la base de datos. + * @param pUserCode Codigo de usuario + * @return TsafeUserDetail + * @throws Exception + */ + public static TsafeUserDetail find(EntityManager pEntityManager, String pUserCode) throws Exception { + TsafeUserDetail obj = null; + Query qry = pEntityManager.createQuery(JPQL_BY_USER); + qry.setParameter("usercode", pUserCode); + qry.setParameter("dateto",Constant.getDefaultExpiryDate()); + try { + obj = (TsafeUserDetail)qry.getSingleResult(); + } catch (NoResultException e) { + throw new GeneralException("GENE-0035", "USUARIO: {0} NO DEFINIDO EN TSAFEUSERDETAIL", pUserCode); + } + return obj; + } + + + /** + * Sentencia que devuelve un registro de TgeneSubProduct. + */ + private static final String JPQL_NAME_USER = "from TsafeUserDetail tsu " + " where tsu.pk.usercode = :usercode " + + " and tsu.pk.dateto = :dateto "; + /** + * Metodo que obtiene datos de un registro del subproducto. + * + * @param pEntityManager Session de la base de datos. + * @param pModulecode Codigo de modulo a obtener datos de la base. + * @param pProductcode Codigo de producto a obtener datos de la base. + * @param pSubproductcode Codigo de subproducto a obtener datos de la base. + * @return TgeneSubProduct + * @throws Exception + */ + public static TsafeUserDetail findByUserCode(EntityManager pEntityManager, String usercode) throws Exception { + Query qry = pEntityManager.createQuery(TsafeUserDetail.JPQL_NAME_USER); + qry.setParameter("usercode", usercode); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + try { + return (TsafeUserDetail) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserDetailKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserDetailKey.java new file mode 100644 index 0000000..0e47a06 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserDetailKey.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pgeneral.safe; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TSAFEUSERDETAIL*/ +@Embeddable +public class TsafeUserDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="PERSONCODE", nullable=false,updatable=false) + +/** +* Codigo de persona del usuario +*/ +private Integer personcode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro del detalle de usuarios +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TsafeUserDetailKey(){} +/**Contructor de TsafeUserDetailKey +@param pUsercode Codigo de usuario +@param pPersoncode Codigo de persona del usuario +@param pDateto Fecha hasta la cual esta vigente el registro del detalle de usuarios +*/ +public TsafeUserDetailKey(String pUsercode,Integer pPersoncode,Timestamp pDateto){ + usercode=pUsercode; + personcode=pPersoncode; + dateto=pDateto; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de personcode +@return valor de personcode*/ +public Integer getPersoncode(){ + return personcode; +} +/**Fija el valor de personcode +@param pPersoncode nuevo Valor de personcode*/ +public void setPersoncode(Integer pPersoncode){ + personcode=pPersoncode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TsafeUserDetailKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TsafeUserDetailKey))return false; + TsafeUserDetailKey that = (TsafeUserDetailKey) o; + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getPersoncode() == null || that.getPersoncode() == null){ + return false; + } + if (! this.getPersoncode().equals(that.getPersoncode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TsafeUserDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getPersoncode() == null ? 0 : this.getPersoncode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserProfile.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserProfile.java new file mode 100644 index 0000000..3febdf9 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserProfile.java @@ -0,0 +1,264 @@ +package com.fp.persistence.pgeneral.safe; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; +import com.fp.dto.hb.Log; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFEUSERPROFILE */ +@Entity(name = "TsafeUserProfile") +@Table(name = "TSAFEUSERPROFILE") +public class TsafeUserProfile extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable, Log { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TsafeUserProfile + */ + @EmbeddedId + private TsafeUserProfileKey pk; + + @Column(name = "DATEFROM", nullable = false) + /** + * Fecha desde la cual esta vigente el registro del detalle de usuarios + */ + private Timestamp datefrom; + + @Column(name = "INGRESSUSER", nullable = true) + /** + * Codigo de usuario que ingreso la informacion + */ + private String ingressuser; + + @Column(name = "MODIFYUSER", nullable = true) + /** + * Codigo de usuario que modifico la informacion + */ + private String modifyuser; + + /** Contructor por defecto */ + public TsafeUserProfile() { + } + + /** + * Contructor de TsafeUserProfile + * + * @param pPk Clave Primaria del entity + * @param pDatefrom Fecha desde la cual esta vigente el registro del detalle de usuarios + */ + public TsafeUserProfile(TsafeUserProfileKey pPk, Timestamp pDatefrom) { + this(); + this.pk = pPk; + this.datefrom = pDatefrom; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TsafeUserProfile + */ + public static TsafeUserProfile find(EntityManager pEntityManager, TsafeUserProfileKey pKey) throws Exception { + TsafeUserProfile obj = pEntityManager.find(TsafeUserProfile.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TsafeUserProfile + * + * @return El objeto que referencia a la Clave primaria de TsafeUserProfile + */ + public TsafeUserProfileKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TsafeUserProfile + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TsafeUserProfile + */ + public void setPk(TsafeUserProfileKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de ingressuser + * + * @return valor de ingressuser + */ + public String getIngressuser() { + return this.ingressuser; + } + + /** + * Fija el valor de ingressuser + * + * @param pIngressuser nuevo Valor de ingressuser + */ + public void setIngressuser(String pIngressuser) { + this.ingressuser = pIngressuser; + } + + /** + * Obtiene el valor de modifyuser + * + * @return valor de modifyuser + */ + public String getModifyuser() { + return this.modifyuser; + } + + /** + * Fija el valor de modifyuser + * + * @param pModifyuser nuevo Valor de modifyuser + */ + public void setModifyuser(String pModifyuser) { + this.modifyuser = pModifyuser; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TsafeUserProfile)) { + return false; + } + TsafeUserProfile that = (TsafeUserProfile) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TsafeUserProfile + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TsafeUserProfile */ + @Override + public Object createInstance() { + TsafeUserProfile instance = new TsafeUserProfile(); + instance.setPk(new TsafeUserProfileKey()); + return instance; + } + + /** + * Clona la entidad TsafeUserProfile + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TsafeUserProfile p = (TsafeUserProfile) this.clone(); + p.setPk((TsafeUserProfileKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + + // Metodos manuales. + /** + * Sentencia que devuelve un registro de TsafeUserProfile. + */ + private static final String JPQL_USER_PROFILE = "from TsafeUserProfile tsup " + " where tsup.pk.usercode = :usercode" + + " and tsup.pk.dateto = :dateto"; + + /** + * Metodo que obtiene datos del perfil del usuario. + * + * @param pusercode Codigo de usuario. + * @return TsafeUserProfile + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager, String pusercode) throws Exception { + Query qry = pEntityManager.createQuery(TsafeUserProfile.JPQL_USER_PROFILE); + qry.setParameter("usercode", pusercode); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + return qry.getResultList(); + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserProfileKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserProfileKey.java new file mode 100644 index 0000000..cb85ea9 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserProfileKey.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pgeneral.safe; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TSAFEUSERPROFILE*/ +@Embeddable +public class TsafeUserProfileKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="PROFILECODE", nullable=false,updatable=false) + +/** +* Codigo de perfil de usuario +*/ +private String profilecode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro del detalle de usuarios +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TsafeUserProfileKey(){} +/**Contructor de TsafeUserProfileKey +@param pUsercode Codigo de usuario +@param pProfilecode Codigo de perfil de usuario +@param pDateto Fecha hasta la cual esta vigente el registro del detalle de usuarios +*/ +public TsafeUserProfileKey(String pUsercode,String pProfilecode,Timestamp pDateto){ + usercode=pUsercode; + profilecode=pProfilecode; + dateto=pDateto; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de profilecode +@return valor de profilecode*/ +public String getProfilecode(){ + return profilecode; +} +/**Fija el valor de profilecode +@param pProfilecode nuevo Valor de profilecode*/ +public void setProfilecode(String pProfilecode){ + profilecode=pProfilecode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TsafeUserProfileKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TsafeUserProfileKey))return false; + TsafeUserProfileKey that = (TsafeUserProfileKey) o; + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getProfilecode() == null || that.getProfilecode() == null){ + return false; + } + if (! this.getProfilecode().equals(that.getProfilecode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TsafeUserProfileKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getProfilecode() == null ? 0 : this.getProfilecode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserSession.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserSession.java new file mode 100644 index 0000000..5621ed8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserSession.java @@ -0,0 +1,215 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFEUSERSESSION*/ +@Entity(name="TsafeUserSession") +@Table(name="TSAFEUSERSESSION") +public class TsafeUserSession extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TsafeUserSession +*/ +@EmbeddedId +private TsafeUserSessionKey pk; +@Column(name="DATEFROM", nullable=true) + +/** +* Fecha desde la cual esta vigente el registro. +*/ +private Timestamp datefrom; + +@Column(name="TERMINALCODE", nullable=true) + +/** +* Codigo de terminal desde el cual se conecta el usuario. +*/ +private String terminalcode; + +@Column(name="TRYNUMBER", nullable=true) + +/** +* Numero de intentos de coneccion. +*/ +private Integer trynumber; + +@Column(name="SESSIONID", nullable=true) + +/** +* Session id del browser con el servlet. +*/ +private String sessionid; + +@Column(name="WEBSERVERIP", nullable=true) + +/** +* Ip del servidor de aplicaciones al cual esta conectado un usuario, sirve para caducar las sessiones de usuario asociadas a esta ip +*/ +private String webserverip; + +/**Contructor por defecto*/ +public TsafeUserSession(){ +} +/**Contructor de TsafeUserSession +@param pPk Clave Primaria del entity +*/ +public TsafeUserSession(TsafeUserSessionKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TsafeUserSession +*/ +public static TsafeUserSession find(EntityManager pEntityManager,TsafeUserSessionKey pKey) throws Exception{ + TsafeUserSession obj = pEntityManager.find(TsafeUserSession.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TsafeUserSession +@return El objeto que referencia a la Clave primaria de TsafeUserSession +*/ +public TsafeUserSessionKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TsafeUserSession +@param pPk El objeto que referencia a la nueva Clave primaria de TsafeUserSession +*/ +public void setPk(TsafeUserSessionKey pPk){ + pk=pPk; +} +/**Obtiene el valor de datefrom +@return valor de datefrom*/ +public Timestamp getDatefrom(){ + return datefrom; +} +/**Fija el valor de datefrom +@param pDatefrom nuevo Valor de datefrom*/ +public void setDatefrom(Timestamp pDatefrom){ + datefrom=pDatefrom; +} + +/**Obtiene el valor de terminalcode +@return valor de terminalcode*/ +public String getTerminalcode(){ + return terminalcode; +} +/**Fija el valor de terminalcode +@param pTerminalcode nuevo Valor de terminalcode*/ +public void setTerminalcode(String pTerminalcode){ + terminalcode=pTerminalcode; +} + +/**Obtiene el valor de trynumber +@return valor de trynumber*/ +public Integer getTrynumber(){ + return trynumber; +} +/**Fija el valor de trynumber +@param pTrynumber nuevo Valor de trynumber*/ +public void setTrynumber(Integer pTrynumber){ + trynumber=pTrynumber; +} + +/**Obtiene el valor de sessionid +@return valor de sessionid*/ +public String getSessionid(){ + return sessionid; +} +/**Fija el valor de sessionid +@param pSessionid nuevo Valor de sessionid*/ +public void setSessionid(String pSessionid){ + sessionid=pSessionid; +} + +/**Obtiene el valor de webserverip +@return valor de webserverip*/ +public String getWebserverip(){ + return webserverip; +} +/**Fija el valor de webserverip +@param pWebserverip nuevo Valor de webserverip*/ +public void setWebserverip(String pWebserverip){ + webserverip=pWebserverip; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TsafeUserSession))return false; + TsafeUserSession that = (TsafeUserSession) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TsafeUserSession +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TsafeUserSession +*/ +public Object createInstance(){ + TsafeUserSession instance=new TsafeUserSession(); + instance.setPk(new TsafeUserSessionKey()); + return instance; +} +/**Clona la entidad TsafeUserSession +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TsafeUserSession p=(TsafeUserSession)this.clone(); + p.setPk((TsafeUserSessionKey)this.pk.cloneMe()); + return p; +} +public Object getId() { + return this.pk; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserSessionKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserSessionKey.java new file mode 100644 index 0000000..b7e70db --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserSessionKey.java @@ -0,0 +1,129 @@ +package com.fp.persistence.pgeneral.safe; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TSAFEUSERSESSION*/ +@Embeddable +public class TsafeUserSessionKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro. +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TsafeUserSessionKey(){} +/**Contructor de TsafeUserSessionKey +@param pUsercode Codigo de usuario +@param pDateto Fecha hasta la cual esta vigente el registro. +*/ +public TsafeUserSessionKey(String pUsercode,Timestamp pDateto){ + usercode=pUsercode; + dateto=pDateto; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TsafeUserSessionKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TsafeUserSessionKey))return false; + TsafeUserSessionKey that = (TsafeUserSessionKey) o; + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TsafeUserSessionKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserSessionLog.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserSessionLog.java new file mode 100644 index 0000000..157cd6a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserSessionLog.java @@ -0,0 +1,299 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TSAFEUSERSESSIONLOG*/ +@Entity(name="TsafeUserSessionLog") +@Table(name="TSAFEUSERSESSIONLOG") +public class TsafeUserSessionLog extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TsafeUserSessionLog +*/ +@EmbeddedId +private TsafeUserSessionLogKey pk; +@Column(name="USERCODE", nullable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="BRANCHCODE", nullable=true) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="OFFICECODE", nullable=true) + +/** +* Codigo de oficina +*/ +private Integer officecode; + +@Column(name="TERMINALCODE", nullable=false) + +/** +* Codigo de terminal desde el cual se conecta el usuario. +*/ +private String terminalcode; + +@Column(name="SESSIONID", nullable=false) + +/** +* Session id del browser con el servlet. +*/ +private String sessionid; + +@Column(name="WEBSERVERIP", nullable=false) + +/** +* Ip del servidor de aplicaciones al cual esta conectado un usuario, sirve para caducar las sessiones de usuario asociadas a esta ip +*/ +private String webserverip; + +@Column(name="REALDATE", nullable=false) + +/** +* Fecha en la que se realiza el login +*/ +private Timestamp realdate; + +@Column(name="ERRORCODE", nullable=false) + +/** +* Codigo de error +*/ +private String errorcode; + +@Column(name="MESSAGELOGIN", nullable=false) + +/** +* Mensaje al intentar loguearse +*/ +private String messagelogin; + +/**Contructor por defecto*/ +public TsafeUserSessionLog(){ +} +/**Contructor de TsafeUserSessionLog +@param pPk Clave Primaria del entity +@param pUsercode Codigo de usuario +@param pTerminalcode Codigo de terminal desde el cual se conecta el usuario. +@param pSessionid Session id del browser con el servlet. +@param pWebserverip Ip del servidor de aplicaciones al cual esta conectado un usuario, sirve para caducar las sessiones de usuario asociadas a esta ip +@param pRealdate Fecha en la que se realiza el login +@param pErrorcode Codigo de error +@param pMessagelogin Mensaje al intentar loguearse +*/ +public TsafeUserSessionLog(TsafeUserSessionLogKey pPk,String pUsercode,String pTerminalcode,String pSessionid,String pWebserverip,Timestamp pRealdate,String pErrorcode,String pMessagelogin){ + this(); + pk=pPk; + usercode=pUsercode; + terminalcode=pTerminalcode; + sessionid=pSessionid; + webserverip=pWebserverip; + realdate=pRealdate; + errorcode=pErrorcode; + messagelogin=pMessagelogin; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TsafeUserSessionLog +*/ +public static TsafeUserSessionLog find(EntityManager pEntityManager,TsafeUserSessionLogKey pKey) throws Exception{ + TsafeUserSessionLog obj = pEntityManager.find(TsafeUserSessionLog.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TsafeUserSessionLog +@return El objeto que referencia a la Clave primaria de TsafeUserSessionLog +*/ +public TsafeUserSessionLogKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TsafeUserSessionLog +@param pPk El objeto que referencia a la nueva Clave primaria de TsafeUserSessionLog +*/ +public void setPk(TsafeUserSessionLogKey pPk){ + pk=pPk; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de terminalcode +@return valor de terminalcode*/ +public String getTerminalcode(){ + return terminalcode; +} +/**Fija el valor de terminalcode +@param pTerminalcode nuevo Valor de terminalcode*/ +public void setTerminalcode(String pTerminalcode){ + terminalcode=pTerminalcode; +} + +/**Obtiene el valor de sessionid +@return valor de sessionid*/ +public String getSessionid(){ + return sessionid; +} +/**Fija el valor de sessionid +@param pSessionid nuevo Valor de sessionid*/ +public void setSessionid(String pSessionid){ + sessionid=pSessionid; +} + +/**Obtiene el valor de webserverip +@return valor de webserverip*/ +public String getWebserverip(){ + return webserverip; +} +/**Fija el valor de webserverip +@param pWebserverip nuevo Valor de webserverip*/ +public void setWebserverip(String pWebserverip){ + webserverip=pWebserverip; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Timestamp getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Timestamp pRealdate){ + realdate=pRealdate; +} + +/**Obtiene el valor de errorcode +@return valor de errorcode*/ +public String getErrorcode(){ + return errorcode; +} +/**Fija el valor de errorcode +@param pErrorcode nuevo Valor de errorcode*/ +public void setErrorcode(String pErrorcode){ + errorcode=pErrorcode; +} + +/**Obtiene el valor de messagelogin +@return valor de messagelogin*/ +public String getMessagelogin(){ + return messagelogin; +} +/**Fija el valor de messagelogin +@param pMessagelogin nuevo Valor de messagelogin*/ +public void setMessagelogin(String pMessagelogin){ + messagelogin=pMessagelogin; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TsafeUserSessionLog))return false; + TsafeUserSessionLog that = (TsafeUserSessionLog) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TsafeUserSessionLog +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TsafeUserSessionLog +*/ +public Object createInstance(){ + TsafeUserSessionLog instance=new TsafeUserSessionLog(); + instance.setPk(new TsafeUserSessionLogKey()); + return instance; +} +/**Clona la entidad TsafeUserSessionLog +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TsafeUserSessionLog p=(TsafeUserSessionLog)this.clone(); + p.setPk((TsafeUserSessionLogKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserSessionLogKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserSessionLogKey.java new file mode 100644 index 0000000..6de0ea2 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/safe/TsafeUserSessionLogKey.java @@ -0,0 +1,152 @@ +package com.fp.persistence.pgeneral.safe; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TSAFEUSERSESSIONLOG*/ +@Embeddable +public class TsafeUserSessionLogKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="WORKINGDATE", nullable=false,updatable=false) + +/** +* Fecha de trabajo del sistema +*/ +private Date workingdate; + +@Column(name="SEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de la tabla +*/ +private Integer sequence; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania donde se realiza el inicio de sesion +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TsafeUserSessionLogKey(){} +/**Contructor de TsafeUserSessionLogKey +@param pWorkingdate Fecha de trabajo del sistema +@param pSequence Secuencia de la tabla +@param pCompanycode Codigo de compania donde se realiza el inicio de sesion +*/ +public TsafeUserSessionLogKey(Date pWorkingdate,Integer pSequence,Integer pCompanycode){ + workingdate=pWorkingdate; + sequence=pSequence; + companycode=pCompanycode; +} +/**Obtiene el valor de workingdate +@return valor de workingdate*/ +public Date getWorkingdate(){ + return workingdate; +} +/**Fija el valor de workingdate +@param pWorkingdate nuevo Valor de workingdate*/ +public void setWorkingdate(Date pWorkingdate){ + workingdate=pWorkingdate; +} + +/**Obtiene el valor de sequence +@return valor de sequence*/ +public Integer getSequence(){ + return sequence; +} +/**Fija el valor de sequence +@param pSequence nuevo Valor de sequence*/ +public void setSequence(Integer pSequence){ + sequence=pSequence; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacion de la comparacion de TsafeUserSessionLogKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TsafeUserSessionLogKey))return false; + TsafeUserSessionLogKey that = (TsafeUserSessionLogKey) o; + if (this.getWorkingdate() == null || that.getWorkingdate() == null){ + return false; + } + if (! this.getWorkingdate().equals(that.getWorkingdate())){ + return false; + } + if (this.getSequence() == null || that.getSequence() == null){ + return false; + } + if (! this.getSequence().equals(that.getSequence())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TsafeUserSessionLogKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getWorkingdate() == null ? 0 : this.getWorkingdate().hashCode()); + result = result * 37 + (this.getSequence() == null ? 0 : this.getSequence().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/.svn/entries new file mode 100644 index 0000000..5b4d32f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/.svn/entries @@ -0,0 +1,198 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneScheduleEvent.java +file + + + + +2022-07-28T03:40:29.689747Z +7c302f13910668df7555f53fee261a82 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7058 + +TgeneScheduleLog.java +file + + + + +2022-07-28T03:40:29.689747Z +fedcd5dc574a0988192406727d4e60ca +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5221 + +TgeneScheduleParameters.java +file + + + + +2022-07-28T03:40:29.690747Z +8aa1a4ea32b6bac238465fd36d5899b7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5851 + +TgeneScheduleLogKey.java +file + + + + +2022-07-28T03:40:29.690747Z +6dafa01c4b8aa78ca011fabb7ddc537f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3369 + +TgeneScheduleProcess.java +file + + + + +2022-07-28T03:40:29.690747Z +9d5b877f130bef32956ef612f5771619 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6599 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/.svn/text-base/TgeneScheduleEvent.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/.svn/text-base/TgeneScheduleEvent.java.svn-base new file mode 100644 index 0000000..f52db0e --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/.svn/text-base/TgeneScheduleEvent.java.svn-base @@ -0,0 +1,327 @@ +package com.fp.persistence.pgeneral.schedule; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Transient; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENESCHEDULEEVENT + */ +@Entity(name = "TgeneScheduleEvent") +@Table(name = "TGENESCHEDULEEVENT") +public class TgeneScheduleEvent extends com.fp.dto.AbstractDataTransport + implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneScheduleEvent + */ + @Id + @Column(name = "EVENTCODE", nullable = false, updatable = false) + private String pk; + @Column(name = "DESCRIPTION", nullable = true) + /** + * Descripcion del codigo de evento + */ + private String description; + + @Column(name = "EXEHOUR", nullable = true) + /** + * Hora de ejecucion. + */ + private Integer exehour; + + @Column(name = "EXEMINUTE", nullable = true) + /** + * Minuto de ejecucion. + */ + private Integer exeminute; + + @Column(name = "EXESECOND", nullable = true) + /** + * Segundo de ejecucion. + */ + private Integer exesecond; + + @Column(name = "BEGINWEEKDAY", nullable = true) + /** + * Dia de inicio de ejecucion + */ + private Integer beginweekday; + + @Column(name = "ENDWEEKDAY", nullable = true) + /** + * Dia final de ejecucion + */ + private Integer endweekday; + + /** Contructor por defecto */ + public TgeneScheduleEvent() { + } + + /** + * Contructor de TgeneScheduleEvent + * + * @param pPk + * Clave Primaria del entity + */ + public TgeneScheduleEvent(String pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager + * referencia de la session a obtener datos del bean. + * @param pKey + * Caleve primaria del bean. + * @return TgeneScheduleEvent + */ + public static TgeneScheduleEvent find(EntityManager pEntityManager, + Object pKey) throws Exception { + TgeneScheduleEvent obj = pEntityManager.find(TgeneScheduleEvent.class, + pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneScheduleEvent + * + * @return El objeto que referencia a la Clave primaria de + * TgeneScheduleEvent + */ + public String getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneScheduleEvent + * + * @param pPk + * El objeto que referencia a la nueva Clave primaria de + * TgeneScheduleEvent + */ + public void setPk(String pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription + * nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + /** + * Obtiene el valor de exehour + * + * @return valor de exehour + */ + public Integer getExehour() { + return exehour; + } + + /** + * Fija el valor de exehour + * + * @param pExehour + * nuevo Valor de exehour + */ + public void setExehour(Integer pExehour) { + exehour = pExehour; + } + + /** + * Obtiene el valor de exeminute + * + * @return valor de exeminute + */ + public Integer getExeminute() { + return exeminute; + } + + /** + * Fija el valor de exeminute + * + * @param pExeminute + * nuevo Valor de exeminute + */ + public void setExeminute(Integer pExeminute) { + exeminute = pExeminute; + } + + /** + * Obtiene el valor de exesecond + * + * @return valor de exesecond + */ + public Integer getExesecond() { + return exesecond; + } + + /** + * Fija el valor de exesecond + * + * @param pExesecond + * nuevo Valor de exesecond + */ + public void setExesecond(Integer pExesecond) { + exesecond = pExesecond; + } + + /** + * Obtiene el valor de beginweekday + * + * @return valor de beginweekday + */ + public Integer getBeginweekday() { + return beginweekday; + } + + /** + * Fija el valor de beginweekday + * + * @param pBeginweekday + * nuevo Valor de beginweekday + */ + public void setBeginweekday(Integer pBeginweekday) { + beginweekday = pBeginweekday; + } + + /** + * Obtiene el valor de endweekday + * + * @return valor de endweekday + */ + public Integer getEndweekday() { + return endweekday; + } + + /** + * Fija el valor de endweekday + * + * @param pEndweekday + * nuevo Valor de endweekday + */ + public void setEndweekday(Integer pEndweekday) { + endweekday = pEndweekday; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneScheduleEvent)) + return false; + TgeneScheduleEvent that = (TgeneScheduleEvent) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneScheduleEvent + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 + || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneScheduleEvent */ + public Object createInstance() { + TgeneScheduleEvent instance = new TgeneScheduleEvent(); + return instance; + } + + /** + * Clona la entidad TgeneScheduleEvent + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneScheduleEvent p = (TgeneScheduleEvent) this.clone(); + return p; + } + + //Metodos manuales + + /**Sentencia que devuelve una lista de los eventos a calendarizar..*/ + private static final String JPQL = + "from TgeneScheduleEvent t "; + + /** + * Entrega una lista de eventos a ser calendarizados. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager) throws Exception { + Query qry = pEntityManager.createQuery(JPQL); + return qry.getResultList(); + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/.svn/text-base/TgeneScheduleLog.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/.svn/text-base/TgeneScheduleLog.java.svn-base new file mode 100644 index 0000000..d43208b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/.svn/text-base/TgeneScheduleLog.java.svn-base @@ -0,0 +1,195 @@ +package com.fp.persistence.pgeneral.schedule; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESCHEDULELOG*/ +@Entity(name="TgeneScheduleLog") +@Table(name="TGENESCHEDULELOG") +public class TgeneScheduleLog extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneScheduleLog +*/ +@EmbeddedId +private TgeneScheduleLogKey pk; +@Column(name="USERCODE", nullable=true) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="PROCESSDATE", nullable=true) + +/** +* Fecha de ejecucion de la tarea calendarizada +*/ +private Date processdate; + +@Column(name="RESULTCODE", nullable=true) + +/** +* Codigo de resultado de ejecucion de la transaccion +*/ +private String resultcode; + +@Column(name="RESULTMESSAGE", nullable=true) + +/** +* Texto de resultado de la ejecucion de la tarea calendarizada. +*/ +private String resultmessage; + +/**Contructor por defecto*/ +public TgeneScheduleLog(){ +} +/**Contructor de TgeneScheduleLog +@param pPk Clave Primaria del entity +*/ +public TgeneScheduleLog(TgeneScheduleLogKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneScheduleLog +*/ +public static TgeneScheduleLog find(EntityManager pEntityManager,TgeneScheduleLogKey pKey) throws Exception{ + TgeneScheduleLog obj = pEntityManager.find(TgeneScheduleLog.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneScheduleLog +@return El objeto que referencia a la Clave primaria de TgeneScheduleLog +*/ +public TgeneScheduleLogKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneScheduleLog +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneScheduleLog +*/ +public void setPk(TgeneScheduleLogKey pPk){ + pk=pPk; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de processdate +@return valor de processdate*/ +public Date getProcessdate(){ + return processdate; +} +/**Fija el valor de processdate +@param pProcessdate nuevo Valor de processdate*/ +public void setProcessdate(Date pProcessdate){ + processdate=pProcessdate; +} + +/**Obtiene el valor de resultcode +@return valor de resultcode*/ +public String getResultcode(){ + return resultcode; +} +/**Fija el valor de resultcode +@param pResultcode nuevo Valor de resultcode*/ +public void setResultcode(String pResultcode){ + resultcode=pResultcode; +} + +/**Obtiene el valor de resultmessage +@return valor de resultmessage*/ +public String getResultmessage(){ + return resultmessage; +} +/**Fija el valor de resultmessage +@param pResultmessage nuevo Valor de resultmessage*/ +public void setResultmessage(String pResultmessage){ + resultmessage=pResultmessage; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneScheduleLog))return false; + TgeneScheduleLog that = (TgeneScheduleLog) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneScheduleLog +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneScheduleLog +*/ +public Object createInstance(){ + TgeneScheduleLog instance=new TgeneScheduleLog(); + instance.setPk(new TgeneScheduleLogKey()); + return instance; +} +/**Clona la entidad TgeneScheduleLog +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneScheduleLog p=(TgeneScheduleLog)this.clone(); + p.setPk((TgeneScheduleLogKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/.svn/text-base/TgeneScheduleLogKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/.svn/text-base/TgeneScheduleLogKey.java.svn-base new file mode 100644 index 0000000..c8a81ed --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/.svn/text-base/TgeneScheduleLogKey.java.svn-base @@ -0,0 +1,125 @@ +package com.fp.persistence.pgeneral.schedule; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESCHEDULELOG*/ +@Embeddable +public class TgeneScheduleLogKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="EVENTCODE", nullable=false,updatable=false) + +/** +* Codigo de evento +*/ +private String eventcode; + +@Column(name="REALDATE", nullable=false,updatable=false) + +/** +* Fecha real de ejecucion de una tarea calensarizada. +*/ +private Timestamp realdate; + +/**Contructor por defecto*/ +public TgeneScheduleLogKey(){} +/**Contructor de TgeneScheduleLogKey +@param pEventcode Codigo de evento +@param pRealdate Fecha real de ejecucion de una tarea calensarizada. +*/ +public TgeneScheduleLogKey(String pEventcode,Timestamp pRealdate){ + eventcode=pEventcode; + realdate=pRealdate; +} +/**Obtiene el valor de eventcode +@return valor de eventcode*/ +public String getEventcode(){ + return eventcode; +} +/**Fija el valor de eventcode +@param pEventcode nuevo Valor de eventcode*/ +public void setEventcode(String pEventcode){ + eventcode=pEventcode; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Timestamp getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Timestamp pRealdate){ + realdate=pRealdate; +} + +/**Implementacin de la comparacin de TgeneScheduleLogKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneScheduleLogKey))return false; + TgeneScheduleLogKey that = (TgeneScheduleLogKey) o; + if (this.getEventcode() == null || that.getEventcode() == null){ + return false; + } + if (! this.getEventcode().equals(that.getEventcode())){ + return false; + } + if (this.getRealdate() == null || that.getRealdate() == null){ + return false; + } + if (! this.getRealdate().equals(that.getRealdate())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneScheduleLogKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getEventcode() == null ? 0 : this.getEventcode().hashCode()); + result = result * 37 + (this.getRealdate() == null ? 0 : this.getRealdate().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/.svn/text-base/TgeneScheduleParameters.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/.svn/text-base/TgeneScheduleParameters.java.svn-base new file mode 100644 index 0000000..67f84e1 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/.svn/text-base/TgeneScheduleParameters.java.svn-base @@ -0,0 +1,228 @@ +package com.fp.persistence.pgeneral.schedule; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENSCHEDULEPARAMETERS*/ +@Entity(name="TgeneScheduleParameters") +@Table(name="TGENSCHEDULEPARAMETERS") +public class TgeneScheduleParameters extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneScheduleParameters +*/ +@Id +@Column(name="COMPANYCODE" ,nullable=false, updatable=false) +private Integer pk; +@Column(name="OFFICECODE", nullable=true) + +/** +* Codigo de oficina +*/ +private Integer officecode; + +@Column(name="BRANCHCODE", nullable=true) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="USERCODE", nullable=true) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="CHANNELCODE", nullable=true) + +/** +* Codigo de canal. +*/ +private String channelcode; + +@Column(name="TERMINALCODE", nullable=true) + +/** +* Codigo de terminal +*/ +private String terminalcode; + +@Column(name="AREACODE", nullable=true) + +/** +* Codigo de area +*/ +private Integer areacode; + +/**Contructor por defecto*/ +public TgeneScheduleParameters(){ +} +/**Contructor de TgeneScheduleParameters +@param pPk Clave Primaria del entity +*/ +public TgeneScheduleParameters(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneScheduleParameters +*/ +public static TgeneScheduleParameters find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneScheduleParameters obj = pEntityManager.find(TgeneScheduleParameters.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneScheduleParameters +@return El objeto que referencia a la Clave primaria de TgeneScheduleParameters +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneScheduleParameters +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneScheduleParameters +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de channelcode +@return valor de channelcode*/ +public String getChannelcode(){ + return channelcode; +} +/**Fija el valor de channelcode +@param pChannelcode nuevo Valor de channelcode*/ +public void setChannelcode(String pChannelcode){ + channelcode=pChannelcode; +} + +/**Obtiene el valor de terminalcode +@return valor de terminalcode*/ +public String getTerminalcode(){ + return terminalcode; +} +/**Fija el valor de terminalcode +@param pTerminalcode nuevo Valor de terminalcode*/ +public void setTerminalcode(String pTerminalcode){ + terminalcode=pTerminalcode; +} + +/**Obtiene el valor de areacode +@return valor de areacode*/ +public Integer getAreacode(){ + return areacode; +} +/**Fija el valor de areacode +@param pAreacode nuevo Valor de areacode*/ +public void setAreacode(Integer pAreacode){ + areacode=pAreacode; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneScheduleParameters))return false; + TgeneScheduleParameters that = (TgeneScheduleParameters) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneScheduleParameters +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneScheduleParameters +*/ +public Object createInstance(){ + TgeneScheduleParameters instance=new TgeneScheduleParameters(); + return instance; +} +/**Clona la entidad TgeneScheduleParameters +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneScheduleParameters p=(TgeneScheduleParameters)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/.svn/text-base/TgeneScheduleProcess.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/.svn/text-base/TgeneScheduleProcess.java.svn-base new file mode 100644 index 0000000..a0e1984 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/.svn/text-base/TgeneScheduleProcess.java.svn-base @@ -0,0 +1,228 @@ +package com.fp.persistence.pgeneral.schedule; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESCHEDULEPROCESS*/ +@Entity(name="TgeneScheduleProcess") +@Table(name="TGENESCHEDULEPROCESS") +public class TgeneScheduleProcess extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneScheduleProcess +*/ +@Id +@Column(name="EVENTCODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="PROCESSCODE", nullable=true) + +/** +* Paquete clase de un comando a ejecutar. +*/ +private String processcode; + +@Column(name="CATALOGTYPEPROCESS", nullable=true) + +/** +* Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia +*/ +private String catalogtypeprocess; + +@Column(name="CATALOGCODETYPEPROCESS", nullable=true) + +/** +* Codigo de tabla de catalogo del proceso de negocio de la aplicacion +*/ +private String catalogcodetypeprocess; + +@Column(name="TRANSACTIONMODULE", nullable=true) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=true) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=true) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +/**Contructor por defecto*/ +public TgeneScheduleProcess(){ +} +/**Contructor de TgeneScheduleProcess +@param pPk Clave Primaria del entity +*/ +public TgeneScheduleProcess(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneScheduleProcess +*/ +public static TgeneScheduleProcess find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneScheduleProcess obj = pEntityManager.find(TgeneScheduleProcess.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneScheduleProcess +@return El objeto que referencia a la Clave primaria de TgeneScheduleProcess +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneScheduleProcess +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneScheduleProcess +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de processcode +@return valor de processcode*/ +public String getProcesscode(){ + return processcode; +} +/**Fija el valor de processcode +@param pProcesscode nuevo Valor de processcode*/ +public void setProcesscode(String pProcesscode){ + processcode=pProcesscode; +} + +/**Obtiene el valor de catalogtypeprocess +@return valor de catalogtypeprocess*/ +public String getCatalogtypeprocess(){ + return catalogtypeprocess; +} +/**Fija el valor de catalogtypeprocess +@param pCatalogtypeprocess nuevo Valor de catalogtypeprocess*/ +public void setCatalogtypeprocess(String pCatalogtypeprocess){ + catalogtypeprocess=pCatalogtypeprocess; +} + +/**Obtiene el valor de catalogcodetypeprocess +@return valor de catalogcodetypeprocess*/ +public String getCatalogcodetypeprocess(){ + return catalogcodetypeprocess; +} +/**Fija el valor de catalogcodetypeprocess +@param pCatalogcodetypeprocess nuevo Valor de catalogcodetypeprocess*/ +public void setCatalogcodetypeprocess(String pCatalogcodetypeprocess){ + catalogcodetypeprocess=pCatalogcodetypeprocess; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneScheduleProcess))return false; + TgeneScheduleProcess that = (TgeneScheduleProcess) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneScheduleProcess +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneScheduleProcess +*/ +public Object createInstance(){ + TgeneScheduleProcess instance=new TgeneScheduleProcess(); + return instance; +} +/**Clona la entidad TgeneScheduleProcess +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneScheduleProcess p=(TgeneScheduleProcess)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/TgeneScheduleEvent.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/TgeneScheduleEvent.java new file mode 100644 index 0000000..f52db0e --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/TgeneScheduleEvent.java @@ -0,0 +1,327 @@ +package com.fp.persistence.pgeneral.schedule; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Transient; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENESCHEDULEEVENT + */ +@Entity(name = "TgeneScheduleEvent") +@Table(name = "TGENESCHEDULEEVENT") +public class TgeneScheduleEvent extends com.fp.dto.AbstractDataTransport + implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneScheduleEvent + */ + @Id + @Column(name = "EVENTCODE", nullable = false, updatable = false) + private String pk; + @Column(name = "DESCRIPTION", nullable = true) + /** + * Descripcion del codigo de evento + */ + private String description; + + @Column(name = "EXEHOUR", nullable = true) + /** + * Hora de ejecucion. + */ + private Integer exehour; + + @Column(name = "EXEMINUTE", nullable = true) + /** + * Minuto de ejecucion. + */ + private Integer exeminute; + + @Column(name = "EXESECOND", nullable = true) + /** + * Segundo de ejecucion. + */ + private Integer exesecond; + + @Column(name = "BEGINWEEKDAY", nullable = true) + /** + * Dia de inicio de ejecucion + */ + private Integer beginweekday; + + @Column(name = "ENDWEEKDAY", nullable = true) + /** + * Dia final de ejecucion + */ + private Integer endweekday; + + /** Contructor por defecto */ + public TgeneScheduleEvent() { + } + + /** + * Contructor de TgeneScheduleEvent + * + * @param pPk + * Clave Primaria del entity + */ + public TgeneScheduleEvent(String pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager + * referencia de la session a obtener datos del bean. + * @param pKey + * Caleve primaria del bean. + * @return TgeneScheduleEvent + */ + public static TgeneScheduleEvent find(EntityManager pEntityManager, + Object pKey) throws Exception { + TgeneScheduleEvent obj = pEntityManager.find(TgeneScheduleEvent.class, + pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneScheduleEvent + * + * @return El objeto que referencia a la Clave primaria de + * TgeneScheduleEvent + */ + public String getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneScheduleEvent + * + * @param pPk + * El objeto que referencia a la nueva Clave primaria de + * TgeneScheduleEvent + */ + public void setPk(String pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription + * nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + /** + * Obtiene el valor de exehour + * + * @return valor de exehour + */ + public Integer getExehour() { + return exehour; + } + + /** + * Fija el valor de exehour + * + * @param pExehour + * nuevo Valor de exehour + */ + public void setExehour(Integer pExehour) { + exehour = pExehour; + } + + /** + * Obtiene el valor de exeminute + * + * @return valor de exeminute + */ + public Integer getExeminute() { + return exeminute; + } + + /** + * Fija el valor de exeminute + * + * @param pExeminute + * nuevo Valor de exeminute + */ + public void setExeminute(Integer pExeminute) { + exeminute = pExeminute; + } + + /** + * Obtiene el valor de exesecond + * + * @return valor de exesecond + */ + public Integer getExesecond() { + return exesecond; + } + + /** + * Fija el valor de exesecond + * + * @param pExesecond + * nuevo Valor de exesecond + */ + public void setExesecond(Integer pExesecond) { + exesecond = pExesecond; + } + + /** + * Obtiene el valor de beginweekday + * + * @return valor de beginweekday + */ + public Integer getBeginweekday() { + return beginweekday; + } + + /** + * Fija el valor de beginweekday + * + * @param pBeginweekday + * nuevo Valor de beginweekday + */ + public void setBeginweekday(Integer pBeginweekday) { + beginweekday = pBeginweekday; + } + + /** + * Obtiene el valor de endweekday + * + * @return valor de endweekday + */ + public Integer getEndweekday() { + return endweekday; + } + + /** + * Fija el valor de endweekday + * + * @param pEndweekday + * nuevo Valor de endweekday + */ + public void setEndweekday(Integer pEndweekday) { + endweekday = pEndweekday; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneScheduleEvent)) + return false; + TgeneScheduleEvent that = (TgeneScheduleEvent) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneScheduleEvent + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 + || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneScheduleEvent */ + public Object createInstance() { + TgeneScheduleEvent instance = new TgeneScheduleEvent(); + return instance; + } + + /** + * Clona la entidad TgeneScheduleEvent + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneScheduleEvent p = (TgeneScheduleEvent) this.clone(); + return p; + } + + //Metodos manuales + + /**Sentencia que devuelve una lista de los eventos a calendarizar..*/ + private static final String JPQL = + "from TgeneScheduleEvent t "; + + /** + * Entrega una lista de eventos a ser calendarizados. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager) throws Exception { + Query qry = pEntityManager.createQuery(JPQL); + return qry.getResultList(); + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/TgeneScheduleLog.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/TgeneScheduleLog.java new file mode 100644 index 0000000..d43208b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/TgeneScheduleLog.java @@ -0,0 +1,195 @@ +package com.fp.persistence.pgeneral.schedule; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESCHEDULELOG*/ +@Entity(name="TgeneScheduleLog") +@Table(name="TGENESCHEDULELOG") +public class TgeneScheduleLog extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneScheduleLog +*/ +@EmbeddedId +private TgeneScheduleLogKey pk; +@Column(name="USERCODE", nullable=true) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="PROCESSDATE", nullable=true) + +/** +* Fecha de ejecucion de la tarea calendarizada +*/ +private Date processdate; + +@Column(name="RESULTCODE", nullable=true) + +/** +* Codigo de resultado de ejecucion de la transaccion +*/ +private String resultcode; + +@Column(name="RESULTMESSAGE", nullable=true) + +/** +* Texto de resultado de la ejecucion de la tarea calendarizada. +*/ +private String resultmessage; + +/**Contructor por defecto*/ +public TgeneScheduleLog(){ +} +/**Contructor de TgeneScheduleLog +@param pPk Clave Primaria del entity +*/ +public TgeneScheduleLog(TgeneScheduleLogKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneScheduleLog +*/ +public static TgeneScheduleLog find(EntityManager pEntityManager,TgeneScheduleLogKey pKey) throws Exception{ + TgeneScheduleLog obj = pEntityManager.find(TgeneScheduleLog.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneScheduleLog +@return El objeto que referencia a la Clave primaria de TgeneScheduleLog +*/ +public TgeneScheduleLogKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneScheduleLog +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneScheduleLog +*/ +public void setPk(TgeneScheduleLogKey pPk){ + pk=pPk; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de processdate +@return valor de processdate*/ +public Date getProcessdate(){ + return processdate; +} +/**Fija el valor de processdate +@param pProcessdate nuevo Valor de processdate*/ +public void setProcessdate(Date pProcessdate){ + processdate=pProcessdate; +} + +/**Obtiene el valor de resultcode +@return valor de resultcode*/ +public String getResultcode(){ + return resultcode; +} +/**Fija el valor de resultcode +@param pResultcode nuevo Valor de resultcode*/ +public void setResultcode(String pResultcode){ + resultcode=pResultcode; +} + +/**Obtiene el valor de resultmessage +@return valor de resultmessage*/ +public String getResultmessage(){ + return resultmessage; +} +/**Fija el valor de resultmessage +@param pResultmessage nuevo Valor de resultmessage*/ +public void setResultmessage(String pResultmessage){ + resultmessage=pResultmessage; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneScheduleLog))return false; + TgeneScheduleLog that = (TgeneScheduleLog) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneScheduleLog +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneScheduleLog +*/ +public Object createInstance(){ + TgeneScheduleLog instance=new TgeneScheduleLog(); + instance.setPk(new TgeneScheduleLogKey()); + return instance; +} +/**Clona la entidad TgeneScheduleLog +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneScheduleLog p=(TgeneScheduleLog)this.clone(); + p.setPk((TgeneScheduleLogKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/TgeneScheduleLogKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/TgeneScheduleLogKey.java new file mode 100644 index 0000000..c8a81ed --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/TgeneScheduleLogKey.java @@ -0,0 +1,125 @@ +package com.fp.persistence.pgeneral.schedule; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESCHEDULELOG*/ +@Embeddable +public class TgeneScheduleLogKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="EVENTCODE", nullable=false,updatable=false) + +/** +* Codigo de evento +*/ +private String eventcode; + +@Column(name="REALDATE", nullable=false,updatable=false) + +/** +* Fecha real de ejecucion de una tarea calensarizada. +*/ +private Timestamp realdate; + +/**Contructor por defecto*/ +public TgeneScheduleLogKey(){} +/**Contructor de TgeneScheduleLogKey +@param pEventcode Codigo de evento +@param pRealdate Fecha real de ejecucion de una tarea calensarizada. +*/ +public TgeneScheduleLogKey(String pEventcode,Timestamp pRealdate){ + eventcode=pEventcode; + realdate=pRealdate; +} +/**Obtiene el valor de eventcode +@return valor de eventcode*/ +public String getEventcode(){ + return eventcode; +} +/**Fija el valor de eventcode +@param pEventcode nuevo Valor de eventcode*/ +public void setEventcode(String pEventcode){ + eventcode=pEventcode; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Timestamp getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Timestamp pRealdate){ + realdate=pRealdate; +} + +/**Implementacin de la comparacin de TgeneScheduleLogKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneScheduleLogKey))return false; + TgeneScheduleLogKey that = (TgeneScheduleLogKey) o; + if (this.getEventcode() == null || that.getEventcode() == null){ + return false; + } + if (! this.getEventcode().equals(that.getEventcode())){ + return false; + } + if (this.getRealdate() == null || that.getRealdate() == null){ + return false; + } + if (! this.getRealdate().equals(that.getRealdate())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneScheduleLogKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getEventcode() == null ? 0 : this.getEventcode().hashCode()); + result = result * 37 + (this.getRealdate() == null ? 0 : this.getRealdate().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/TgeneScheduleParameters.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/TgeneScheduleParameters.java new file mode 100644 index 0000000..67f84e1 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/TgeneScheduleParameters.java @@ -0,0 +1,228 @@ +package com.fp.persistence.pgeneral.schedule; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENSCHEDULEPARAMETERS*/ +@Entity(name="TgeneScheduleParameters") +@Table(name="TGENSCHEDULEPARAMETERS") +public class TgeneScheduleParameters extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneScheduleParameters +*/ +@Id +@Column(name="COMPANYCODE" ,nullable=false, updatable=false) +private Integer pk; +@Column(name="OFFICECODE", nullable=true) + +/** +* Codigo de oficina +*/ +private Integer officecode; + +@Column(name="BRANCHCODE", nullable=true) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="USERCODE", nullable=true) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="CHANNELCODE", nullable=true) + +/** +* Codigo de canal. +*/ +private String channelcode; + +@Column(name="TERMINALCODE", nullable=true) + +/** +* Codigo de terminal +*/ +private String terminalcode; + +@Column(name="AREACODE", nullable=true) + +/** +* Codigo de area +*/ +private Integer areacode; + +/**Contructor por defecto*/ +public TgeneScheduleParameters(){ +} +/**Contructor de TgeneScheduleParameters +@param pPk Clave Primaria del entity +*/ +public TgeneScheduleParameters(Integer pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneScheduleParameters +*/ +public static TgeneScheduleParameters find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneScheduleParameters obj = pEntityManager.find(TgeneScheduleParameters.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneScheduleParameters +@return El objeto que referencia a la Clave primaria de TgeneScheduleParameters +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneScheduleParameters +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneScheduleParameters +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de channelcode +@return valor de channelcode*/ +public String getChannelcode(){ + return channelcode; +} +/**Fija el valor de channelcode +@param pChannelcode nuevo Valor de channelcode*/ +public void setChannelcode(String pChannelcode){ + channelcode=pChannelcode; +} + +/**Obtiene el valor de terminalcode +@return valor de terminalcode*/ +public String getTerminalcode(){ + return terminalcode; +} +/**Fija el valor de terminalcode +@param pTerminalcode nuevo Valor de terminalcode*/ +public void setTerminalcode(String pTerminalcode){ + terminalcode=pTerminalcode; +} + +/**Obtiene el valor de areacode +@return valor de areacode*/ +public Integer getAreacode(){ + return areacode; +} +/**Fija el valor de areacode +@param pAreacode nuevo Valor de areacode*/ +public void setAreacode(Integer pAreacode){ + areacode=pAreacode; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneScheduleParameters))return false; + TgeneScheduleParameters that = (TgeneScheduleParameters) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneScheduleParameters +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneScheduleParameters +*/ +public Object createInstance(){ + TgeneScheduleParameters instance=new TgeneScheduleParameters(); + return instance; +} +/**Clona la entidad TgeneScheduleParameters +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneScheduleParameters p=(TgeneScheduleParameters)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/TgeneScheduleProcess.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/TgeneScheduleProcess.java new file mode 100644 index 0000000..a0e1984 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/schedule/TgeneScheduleProcess.java @@ -0,0 +1,228 @@ +package com.fp.persistence.pgeneral.schedule; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESCHEDULEPROCESS*/ +@Entity(name="TgeneScheduleProcess") +@Table(name="TGENESCHEDULEPROCESS") +public class TgeneScheduleProcess extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneScheduleProcess +*/ +@Id +@Column(name="EVENTCODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="PROCESSCODE", nullable=true) + +/** +* Paquete clase de un comando a ejecutar. +*/ +private String processcode; + +@Column(name="CATALOGTYPEPROCESS", nullable=true) + +/** +* Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia +*/ +private String catalogtypeprocess; + +@Column(name="CATALOGCODETYPEPROCESS", nullable=true) + +/** +* Codigo de tabla de catalogo del proceso de negocio de la aplicacion +*/ +private String catalogcodetypeprocess; + +@Column(name="TRANSACTIONMODULE", nullable=true) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=true) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=true) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +/**Contructor por defecto*/ +public TgeneScheduleProcess(){ +} +/**Contructor de TgeneScheduleProcess +@param pPk Clave Primaria del entity +*/ +public TgeneScheduleProcess(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneScheduleProcess +*/ +public static TgeneScheduleProcess find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneScheduleProcess obj = pEntityManager.find(TgeneScheduleProcess.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneScheduleProcess +@return El objeto que referencia a la Clave primaria de TgeneScheduleProcess +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneScheduleProcess +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneScheduleProcess +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de processcode +@return valor de processcode*/ +public String getProcesscode(){ + return processcode; +} +/**Fija el valor de processcode +@param pProcesscode nuevo Valor de processcode*/ +public void setProcesscode(String pProcesscode){ + processcode=pProcesscode; +} + +/**Obtiene el valor de catalogtypeprocess +@return valor de catalogtypeprocess*/ +public String getCatalogtypeprocess(){ + return catalogtypeprocess; +} +/**Fija el valor de catalogtypeprocess +@param pCatalogtypeprocess nuevo Valor de catalogtypeprocess*/ +public void setCatalogtypeprocess(String pCatalogtypeprocess){ + catalogtypeprocess=pCatalogtypeprocess; +} + +/**Obtiene el valor de catalogcodetypeprocess +@return valor de catalogcodetypeprocess*/ +public String getCatalogcodetypeprocess(){ + return catalogcodetypeprocess; +} +/**Fija el valor de catalogcodetypeprocess +@param pCatalogcodetypeprocess nuevo Valor de catalogcodetypeprocess*/ +public void setCatalogcodetypeprocess(String pCatalogcodetypeprocess){ + catalogcodetypeprocess=pCatalogcodetypeprocess; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneScheduleProcess))return false; + TgeneScheduleProcess that = (TgeneScheduleProcess) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneScheduleProcess +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneScheduleProcess +*/ +public Object createInstance(){ + TgeneScheduleProcess instance=new TgeneScheduleProcess(); + return instance; +} +/**Clona la entidad TgeneScheduleProcess +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneScheduleProcess p=(TgeneScheduleProcess)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/entries new file mode 100644 index 0000000..3346cac --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/entries @@ -0,0 +1,606 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneScoreFileIssuesKey.java +file + + + + +2022-07-28T03:40:30.084748Z +5d66eb9ad1b42dc32d21e178239d8db0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5667 + +TgeneScoreAdjustmentKey.java +file + + + + +2022-07-28T03:40:30.084748Z +5ad378e8c871ccec443041a75fa2f70c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5118 + +TgeneAccountScoreJournal.java +file + + + + +2022-07-28T03:40:30.084748Z +9cde19166d94dada8314a21ca4069b60 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +16648 + +TgeneScoreHeader.java +file + + + + +2022-07-28T03:40:30.085748Z +007a98e9369668af41ff1af426f0ec28 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6523 + +TgeneAccountScoreDetailKey.java +file + + + + +2022-07-28T03:40:30.085748Z +d0c8f5e0c6ddc537796092842e9fbd0e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4239 + +TgeneScoreRank.java +file + + + + +2022-07-28T03:40:30.085748Z +2da7a7992d41618769427ecb2107bd4d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8516 + +TgeneAccountScore.java +file + + + + +2022-07-28T03:40:30.086748Z +418e3b737cfa8f01941fc93ac58931bf +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +26062 + +TgenePercentScore.java +file + + + + +2022-07-28T03:40:30.086748Z +74e1f70913c2462a305a6dcc225e4a72 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6515 + +TgeneAccountScoreJournalKey.java +file + + + + +2022-07-28T03:40:30.086748Z +9d4ec486a9b4b36634704667e2e86d6d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4371 + +TgeneScoreHeaderKey.java +file + + + + +2022-07-28T03:40:30.086748Z +a5bc069346775ede7adafd9da52d317a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3485 + +TgeneScoreRankKey.java +file + + + + +2022-07-28T03:40:30.087748Z +7404b21c3e7b835aef7875793ecef035 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6152 + +TgeneAccountScoreKey.java +file + + + + +2022-07-28T03:40:30.087748Z +d47cb64215b5a925ac7458d02e40f29c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4179 + +TgenePercentScoreKey.java +file + + + + +2022-07-28T03:40:30.087748Z +30f6bd4d4f8edae5663623ce739f52c7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4443 + +TgeneScoreFileIssues.java +file + + + + +2022-07-28T03:40:30.087748Z +075a1bf7bb1228759e1aff10a118b48e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5304 + +TgeneScoreAdjustment.java +file + + + + +2022-07-28T03:40:30.088748Z +d0d66e4dde68486fdf5a965dbce736fa +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +15975 + +TgeneScore.java +file + + + + +2022-07-28T03:40:30.088748Z +31ff043815c4af4ca18252e0098e85ce +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4113 + +TgeneAccountScoreDetail.java +file + + + + +2022-07-28T03:40:30.088748Z +a656aa7637a515a19a22dc94ab88f328 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +10228 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneAccountScore.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneAccountScore.java.svn-base new file mode 100644 index 0000000..3e997ca --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneAccountScore.java.svn-base @@ -0,0 +1,857 @@ +package com.fp.persistence.pgeneral.score; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTSCORE */ +@Entity(name = "TgeneAccountScore") +@Table(name = "TGENEACCOUNTSCORE") +public class TgeneAccountScore extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneAccountScore + */ + @EmbeddedId + private TgeneAccountScoreKey pk; + + @Column(name = "OPERATIONSTATUS", nullable = true) + /** + * Codigo de estatus de la operacion con el que se realiza la calificacion, ORI (Original), REF (refinanciada), RES (restructurada) + */ + private String operationstatus; + + @Column(name = "MODULECODE", nullable = true) + /** + * Codigo de modulo + */ + private String modulecode; + + @Column(name = "PRODUCTCODE", nullable = true) + /** + * Codigo de producto + */ + private String productcode; + + @Column(name = "SUBPRODUCTCODE", nullable = true) + /** + * Codigo de subproducto + */ + private String subproductcode; + + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + + @Column(name = "CREDITTYPECODE", nullable = true) + /** + * Codigo de tipo de credito + */ + private String credittypecode; + + @Column(name = "STATUSCODE", nullable = true) + /** + * Estatus de cuenta + */ + private String statuscode; + + @Column(name = "USERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String usercode; + + @Column(name = "AMOUNT", nullable = true) + /** + * Monto base sobre el que se realiza la provision + */ + private BigDecimal amount; + + @Column(name = "SCORE", nullable = true) + /** + * Codigo de calificacion actual del prestamo. Proceso automatico. + */ + private String score; + + @Column(name = "PROVISIONPERCENT", nullable = true) + /** + * Porcentaje de provision constituido.Proceso automatico. + */ + private BigDecimal provisionpercent; + + @Column(name = "PROVISIONVALUE", nullable = true) + /** + * Saldo de provision de la cuentaProceso automatico. + */ + private BigDecimal provisionvalue; + + @Column(name = "MANUALSCORE", nullable = true) + /** + * Codigo de calificacion actual del prestamo. Calificacion manual o por medio del archivo. + */ + private String manualscore; + + @Column(name = "MANUALPROVISIONPERCENT", nullable = true) + /** + * Porcentaje de provision constituido.Calificacion manual o por medio del archivo. + */ + private BigDecimal manualprovisionpercent; + + @Column(name = "MANUALPROVISIONVALUE", nullable = true) + /** + * Saldo de provision de la cuenta.Calificacion manual o por medio del archivo. + */ + private BigDecimal manualprovisionvalue; + + @Column(name = "FINALSCORE", nullable = true) + /** + * Codigo de calificacion actual del prestamo.Calificacion final y homologada. + */ + private String finalscore; + + @Column(name = "FINALPROVISIONPERCENT", nullable = true) + /** + * Porcentaje de provision constituido.Calificacion final y homologada. + */ + private BigDecimal finalprovisionpercent; + + @Column(name = "FINALPROVISIONVALUE", nullable = true) + /** + * Saldo de provision de la cuenta.Calificacion final y homologada. + */ + private BigDecimal finalprovisionvalue; + + @Column(name = "PREVIOUSSCORE", nullable = true) + /** + * Codigo de calificacion actual del prestamo.Calificacion final y homologada del periodo anterior + */ + private String previousscore; + + @Column(name = "PREVIOUSPROVISIONPERCENT", nullable = true) + /** + * Porcentaje de provision constituido.Calificacion final y homologada del periodo anterior + */ + private BigDecimal previousprovisionpercent; + + @Column(name = "PREVIOUSPROVISIONVALUE", nullable = true) + /** + * Saldo de provision de la cuent.Calificacion final y homologada del periodo anterior + */ + private BigDecimal previousprovisionvalue; + + @Column(name = "EXPIRATIONDATE", nullable = true) + /** + * Fecha de vencimiento de la menor cuota no pagada + */ + private Date expirationdate; + + @Column(name = "ISCOMPUTEDSCORE", nullable = true) + /** + * N Indica que la calificacion se creo al crear la cuenta, Y Indica que es una calificacion a reportar a un organismo de control + */ + private String iscomputedscore; + + @Column(name = "JOURNALID", nullable = false) + /** + * Numero de movimiento + */ + private String journalid; + + /** Contructor por defecto */ + public TgeneAccountScore() { + } + + /** + * Contructor de TgeneAccountScore + * + * @param pPk Clave Primaria del entity + * @param pJournalid Numero de movimiento + */ + public TgeneAccountScore(TgeneAccountScoreKey pPk, String pJournalid) { + this(); + this.pk = pPk; + this.journalid = pJournalid; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneAccountScore + */ + public static TgeneAccountScore find(EntityManager pEntityManager, TgeneAccountScoreKey pKey) throws Exception { + TgeneAccountScore obj = pEntityManager.find(TgeneAccountScore.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneAccountScore + * + * @return El objeto que referencia a la Clave primaria de TgeneAccountScore + */ + public TgeneAccountScoreKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneAccountScore + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountScore + */ + public void setPk(TgeneAccountScoreKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de operationstatus + * + * @return valor de operationstatus + */ + public String getOperationstatus() { + return this.operationstatus; + } + + /** + * Fija el valor de operationstatus + * + * @param pOperationstatus nuevo Valor de operationstatus + */ + public void setOperationstatus(String pOperationstatus) { + this.operationstatus = pOperationstatus; + } + + /** + * Obtiene el valor de modulecode + * + * @return valor de modulecode + */ + public String getModulecode() { + return this.modulecode; + } + + /** + * Fija el valor de modulecode + * + * @param pModulecode nuevo Valor de modulecode + */ + public void setModulecode(String pModulecode) { + this.modulecode = pModulecode; + } + + /** + * Obtiene el valor de productcode + * + * @return valor de productcode + */ + public String getProductcode() { + return this.productcode; + } + + /** + * Fija el valor de productcode + * + * @param pProductcode nuevo Valor de productcode + */ + public void setProductcode(String pProductcode) { + this.productcode = pProductcode; + } + + /** + * Obtiene el valor de subproductcode + * + * @return valor de subproductcode + */ + public String getSubproductcode() { + return this.subproductcode; + } + + /** + * Fija el valor de subproductcode + * + * @param pSubproductcode nuevo Valor de subproductcode + */ + public void setSubproductcode(String pSubproductcode) { + this.subproductcode = pSubproductcode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de credittypecode + * + * @return valor de credittypecode + */ + public String getCredittypecode() { + return this.credittypecode; + } + + /** + * Fija el valor de credittypecode + * + * @param pCredittypecode nuevo Valor de credittypecode + */ + public void setCredittypecode(String pCredittypecode) { + this.credittypecode = pCredittypecode; + } + + /** + * Obtiene el valor de statuscode + * + * @return valor de statuscode + */ + public String getStatuscode() { + return this.statuscode; + } + + /** + * Fija el valor de statuscode + * + * @param pStatuscode nuevo Valor de statuscode + */ + public void setStatuscode(String pStatuscode) { + this.statuscode = pStatuscode; + } + + /** + * Obtiene el valor de usercode + * + * @return valor de usercode + */ + public String getUsercode() { + return this.usercode; + } + + /** + * Fija el valor de usercode + * + * @param pUsercode nuevo Valor de usercode + */ + public void setUsercode(String pUsercode) { + this.usercode = pUsercode; + } + + /** + * Obtiene el valor de amount + * + * @return valor de amount + */ + public BigDecimal getAmount() { + return this.amount; + } + + /** + * Fija el valor de amount + * + * @param pAmount nuevo Valor de amount + */ + public void setAmount(BigDecimal pAmount) { + this.amount = pAmount; + } + + /** + * Obtiene el valor de score + * + * @return valor de score + */ + public String getScore() { + return this.score; + } + + /** + * Fija el valor de score + * + * @param pScore nuevo Valor de score + */ + public void setScore(String pScore) { + this.score = pScore; + } + + /** + * Obtiene el valor de provisionpercent + * + * @return valor de provisionpercent + */ + public BigDecimal getProvisionpercent() { + return this.provisionpercent; + } + + /** + * Fija el valor de provisionpercent + * + * @param pProvisionpercent nuevo Valor de provisionpercent + */ + public void setProvisionpercent(BigDecimal pProvisionpercent) { + this.provisionpercent = pProvisionpercent; + } + + /** + * Obtiene el valor de provisionvalue + * + * @return valor de provisionvalue + */ + public BigDecimal getProvisionvalue() { + return this.provisionvalue; + } + + /** + * Fija el valor de provisionvalue + * + * @param pProvisionvalue nuevo Valor de provisionvalue + */ + public void setProvisionvalue(BigDecimal pProvisionvalue) { + this.provisionvalue = pProvisionvalue; + } + + /** + * Obtiene el valor de manualscore + * + * @return valor de manualscore + */ + public String getManualscore() { + return this.manualscore; + } + + /** + * Fija el valor de manualscore + * + * @param pManualscore nuevo Valor de manualscore + */ + public void setManualscore(String pManualscore) { + this.manualscore = pManualscore; + } + + /** + * Obtiene el valor de manualprovisionpercent + * + * @return valor de manualprovisionpercent + */ + public BigDecimal getManualprovisionpercent() { + return this.manualprovisionpercent; + } + + /** + * Fija el valor de manualprovisionpercent + * + * @param pManualprovisionpercent nuevo Valor de manualprovisionpercent + */ + public void setManualprovisionpercent(BigDecimal pManualprovisionpercent) { + this.manualprovisionpercent = pManualprovisionpercent; + } + + /** + * Obtiene el valor de manualprovisionvalue + * + * @return valor de manualprovisionvalue + */ + public BigDecimal getManualprovisionvalue() { + return this.manualprovisionvalue; + } + + /** + * Fija el valor de manualprovisionvalue + * + * @param pManualprovisionvalue nuevo Valor de manualprovisionvalue + */ + public void setManualprovisionvalue(BigDecimal pManualprovisionvalue) { + this.manualprovisionvalue = pManualprovisionvalue; + } + + /** + * Obtiene el valor de finalscore + * + * @return valor de finalscore + */ + public String getFinalscore() { + return this.finalscore; + } + + /** + * Fija el valor de finalscore + * + * @param pFinalscore nuevo Valor de finalscore + */ + public void setFinalscore(String pFinalscore) { + this.finalscore = pFinalscore; + } + + /** + * Obtiene el valor de finalprovisionpercent + * + * @return valor de finalprovisionpercent + */ + public BigDecimal getFinalprovisionpercent() { + return this.finalprovisionpercent; + } + + /** + * Fija el valor de finalprovisionpercent + * + * @param pFinalprovisionpercent nuevo Valor de finalprovisionpercent + */ + public void setFinalprovisionpercent(BigDecimal pFinalprovisionpercent) { + this.finalprovisionpercent = pFinalprovisionpercent; + } + + /** + * Obtiene el valor de finalprovisionvalue + * + * @return valor de finalprovisionvalue + */ + public BigDecimal getFinalprovisionvalue() { + return this.finalprovisionvalue; + } + + /** + * Fija el valor de finalprovisionvalue + * + * @param pFinalprovisionvalue nuevo Valor de finalprovisionvalue + */ + public void setFinalprovisionvalue(BigDecimal pFinalprovisionvalue) { + this.finalprovisionvalue = pFinalprovisionvalue; + } + + /** + * Obtiene el valor de previousscore + * + * @return valor de previousscore + */ + public String getPreviousscore() { + return this.previousscore; + } + + /** + * Fija el valor de previousscore + * + * @param pPreviousscore nuevo Valor de previousscore + */ + public void setPreviousscore(String pPreviousscore) { + this.previousscore = pPreviousscore; + } + + /** + * Obtiene el valor de previousprovisionpercent + * + * @return valor de previousprovisionpercent + */ + public BigDecimal getPreviousprovisionpercent() { + return this.previousprovisionpercent; + } + + /** + * Fija el valor de previousprovisionpercent + * + * @param pPreviousprovisionpercent nuevo Valor de previousprovisionpercent + */ + public void setPreviousprovisionpercent(BigDecimal pPreviousprovisionpercent) { + this.previousprovisionpercent = pPreviousprovisionpercent; + } + + /** + * Obtiene el valor de previousprovisionvalue + * + * @return valor de previousprovisionvalue + */ + public BigDecimal getPreviousprovisionvalue() { + return this.previousprovisionvalue; + } + + /** + * Fija el valor de previousprovisionvalue + * + * @param pPreviousprovisionvalue nuevo Valor de previousprovisionvalue + */ + public void setPreviousprovisionvalue(BigDecimal pPreviousprovisionvalue) { + this.previousprovisionvalue = pPreviousprovisionvalue; + } + + /** + * Obtiene el valor de expirationdate + * + * @return valor de expirationdate + */ + public Date getExpirationdate() { + return this.expirationdate; + } + + /** + * Fija el valor de expirationdate + * + * @param pExpirationdate nuevo Valor de expirationdate + */ + public void setExpirationdate(Date pExpirationdate) { + this.expirationdate = pExpirationdate; + } + + /** + * Obtiene el valor de iscomputedscore + * + * @return valor de iscomputedscore + */ + public String getIscomputedscore() { + return this.iscomputedscore; + } + + /** + * Fija el valor de iscomputedscore + * + * @param pIscomputedscore nuevo Valor de iscomputedscore + */ + public void setIscomputedscore(String pIscomputedscore) { + this.iscomputedscore = pIscomputedscore; + } + + /** + * Obtiene el valor de journalid + * + * @return valor de journalid + */ + public String getJournalid() { + return this.journalid; + } + + /** + * Fija el valor de journalid + * + * @param pJournalid nuevo Valor de journalid + */ + public void setJournalid(String pJournalid) { + this.journalid = pJournalid; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneAccountScore)) { + return false; + } + TgeneAccountScore that = (TgeneAccountScore) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return this.getPk().equals(that.getPk()); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneAccountScore + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneAccountScore */ + @Override + public Object createInstance() { + TgeneAccountScore instance = new TgeneAccountScore(); + instance.setPk(new TgeneAccountScoreKey()); + return instance; + } + + /** + * Clona la entidad TgeneAccountScore + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneAccountScore p = (TgeneAccountScore) this.clone(); + p.setPk((TgeneAccountScoreKey) this.pk.cloneMe()); + return p; + } + + /* Mtodos manuales */ + + /** Sentencia para seleccionar la ultima calificacin de una cuenta */ + private static final String JPQL_LAST_SCORE = " select t from TgeneAccountScore t " + " where t.pk.account = :account " + + " and t.pk.company = :company " + " and t.modulecode = :modulecode " + " and t.pk.scoredate = ( " + + " select max(t.pk.scoredate) from TgeneAccountScore t " + " where t.pk.account = :account " + " and t.pk.company = :company " + + " and t.modulecode = :modulecode " + " and t.iscomputedscore = 'Y' " + " group by t.pk.account )"; + + /** + * Mtodo que selecciona la ultima calificacin de una cuenta + * + * @param entityManager + * @param pAccount + * @param pCompany + * @param pModulecode + * @return + * @throws Exception + */ + public static TgeneAccountScore getLastScore(EntityManager entityManager, String pAccount, Integer pCompany, String pModulecode) throws Exception { + Query qry = entityManager.createQuery(TgeneAccountScore.JPQL_LAST_SCORE); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + qry.setParameter("modulecode", pModulecode); + + try { + return (TgeneAccountScore) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + + // Metodos personalizados + + // select * from tgeneaccountscore where account = 1 and companycode =1; + + private static final String JPQL_FIND_BY_ACCOUNT = "" + " from TgeneAccountScore tga " + "where tga.pk.account = :account " + + " and tga.pk.company = :company"; + + /** + * Permite consultar el registro asociado a la cuenta + * + * @param entityManager Administrador de entidades y persistencia + * @param account String con la cuenta a consultar + * @param company int con la empresa asociada a la cuenta + * @return Registro TgeneAccountScore + * @throws Exception + */ + public static TgeneAccountScore findByAccount(EntityManager entityManager, String account, int company) { + Query qry = entityManager.createQuery(TgeneAccountScore.JPQL_FIND_BY_ACCOUNT); + qry.setParameter("account", account); + qry.setParameter("company", company); + return (TgeneAccountScore) qry.getSingleResult(); + } + + private static final String JPQL_FIND_WORST_SCORE_CONSTRUCTOR = "" + + " from TGENEACCOUNTSCORE " + + " where account in (select LOANACCOUNT " + + " from TCREDITFACILITYDETAILLOAN cf " + + " where ACCOUNT in (select ACCOUNT from TCREDITFACILITYDETAILLOAN where LOANACCOUNT = :account and COMPANY = :company)) " + + " and score in (select max(SCORE) " + + " from TGENEACCOUNTSCORE " + + " where account in (select LOANACCOUNT " + + " from TCREDITFACILITYDETAILLOAN cf " + + " where ACCOUNT in (select ACCOUNT from TCREDITFACILITYDETAILLOAN where LOANACCOUNT = :account and COMPANY = :company))) "; + + @SuppressWarnings("unchecked") + public static List findByWorstScore(EntityManager entityManager, String account, int company, boolean isConstructor) { + Query qry = entityManager.createQuery(TgeneAccountScore.JPQL_FIND_WORST_SCORE_CONSTRUCTOR); + qry.setParameter("account", account); + qry.setParameter("company", company); + qry.setMaxResults(1); + return qry.getResultList(); + } + + private static final String JPQL_FIND_WORST_SCORE = "" + "select score.* " + " from tgeneaccountscore score inner join TGENEACCOUNT aco1 " + + " on score.account = aco1.account " + " and score.company = aco1.company " + " and score.modulecode = aco1.modulecode " + + " inner join TGENEACCOUNT aco2 " + " on aco1.PERSONCODE = aco2.personcode " + " and aco1.COMPANY = aco2.COMPANY " + + " and aco1.DATETO = aco2.DATETO " + " and aco2.account = :account " + " and aco1.MODULECODE = aco2.MODULECODE " + + " and aco1.PRODUCTCODE = aco2.PRODUCTCODE " + " and aco2.DATETO = aco1.DATETO " + " and aco2.DATETO = TO_DATE('31/12/2999') " + + " and aco2.company = :company " + " order by score.finalscore desc"; + + @SuppressWarnings("unchecked") + public static TgeneAccountScore findByWorstScore(EntityManager entityManager, String account, int company) { + Query qry = entityManager.createQuery(TgeneAccountScore.JPQL_FIND_WORST_SCORE); + qry.setParameter("account", account); + qry.setParameter("company", company); + qry.setMaxResults(1); + List objresultado = qry.getResultList(); + if (objresultado.size() == 1) { + return objresultado.get(0); + } else { + return new TgeneAccountScore(); + } + } + + private final static String JPQL_ACCOUNT_SCORE = " from TgeneAccountScore tls where " + + "tls.pk.account IN (:accountList) and tls.score IN (:scoreList)"; + + /** + * Permite obtener la cuentas de prestamo que esten en estado vigente y que ademas tengan el score necesario para + * reestructuracion + * + * @param entityManager Administrador de persistencia y entidades + * @param accountList Lista de {@link String} con las cuentas a validar + * @param scoreList Lista de {@link String} con los puntajes a validar + * @return lista de datos {@link TloanAccountScore } con los valores de la operacion + */ + @SuppressWarnings("unchecked") + public static List findAccountsByScore(EntityManager entityManager, List accountList, List scoreList) { + Query qry = entityManager.createQuery(TgeneAccountScore.JPQL_ACCOUNT_SCORE); + qry.setParameter("accountList", accountList); + qry.setParameter("scoreList", scoreList); + return qry.getResultList(); + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneAccountScoreDetail.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneAccountScoreDetail.java.svn-base new file mode 100644 index 0000000..24fa976 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneAccountScoreDetail.java.svn-base @@ -0,0 +1,339 @@ +package com.fp.persistence.pgeneral.score; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TLOANACCOUNTSCOREDETAIL*/ +@Entity(name="TgeneAccountScoreDetail") +@Table(name="TLOANACCOUNTSCOREDETAIL") +public class TgeneAccountScoreDetail extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountScoreDetail +*/ +@EmbeddedId +private TgeneAccountScoreDetailKey pk; +@Column(name="PRINCIPALSUSPEND", nullable=true) + +/** +* null +*/ +private BigDecimal principalsuspend; + +@Column(name="PRINCIPALPUNISHED", nullable=true) + +/** +* null +*/ +private String principalpunished; + +@Column(name="PRINCIPALJUDIAL", nullable=true) + +/** +* null +*/ +private String principaljudial; + +@Column(name="MORTGAGEWARRANTIES", nullable=true) + +/** +* null +*/ +private BigDecimal mortgagewarranties; + +@Column(name="APPRAISALMORTGAGEWARRANTIES", nullable=true) + +/** +* null +*/ +private BigDecimal appraisalmortgagewarranties; + +@Column(name="FULFILMENMORTGAGEWARRANTIES", nullable=true) + +/** +* null +*/ +private BigDecimal fulfilmenmortgagewarranties; + +@Column(name="BANKWARRANTIES", nullable=true) + +/** +* null +*/ +private BigDecimal bankwarranties; + +@Column(name="APPRAISALBANKWARRANTIES", nullable=true) + +/** +* null +*/ +private BigDecimal appraisalbankwarranties; + +@Column(name="FULFILMENBANKWARRANTIES", nullable=true) + +/** +* null +*/ +private BigDecimal fulfilmenbankwarranties; + +@Column(name="POLICYWARRANTIES", nullable=true) + +/** +* null +*/ +private BigDecimal policywarranties; + +@Column(name="APPRAISALPOLICYWARRANTIES", nullable=true) + +/** +* null +*/ +private BigDecimal appraisalpolicywarranties; + +@Column(name="FULFILMENPOLICYWARRANTIES", nullable=true) + +/** +* null +*/ +private BigDecimal fulfilmenpolicywarranties; + +/**Contructor por defecto*/ +public TgeneAccountScoreDetail(){ +} +/**Contructor de TgeneAccountScoreDetail +@param pPk Clave Primaria del entity +*/ +public TgeneAccountScoreDetail(TgeneAccountScoreDetailKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountScoreDetail +*/ +public static TgeneAccountScoreDetail find(EntityManager pEntityManager,TgeneAccountScoreDetailKey pKey) throws Exception{ + TgeneAccountScoreDetail obj = pEntityManager.find(TgeneAccountScoreDetail.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountScoreDetail +@return El objeto que referencia a la Clave primaria de TgeneAccountScoreDetail +*/ +public TgeneAccountScoreDetailKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountScoreDetail +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountScoreDetail +*/ +public void setPk(TgeneAccountScoreDetailKey pPk){ + pk=pPk; +} +/**Obtiene el valor de principalsuspend +@return valor de principalsuspend*/ +public BigDecimal getPrincipalsuspend(){ + return principalsuspend; +} +/**Fija el valor de principalsuspend +@param pPrincipalsuspend nuevo Valor de principalsuspend*/ +public void setPrincipalsuspend(BigDecimal pPrincipalsuspend){ + principalsuspend=pPrincipalsuspend; +} + +/**Obtiene el valor de principalpunished +@return valor de principalpunished*/ +public String getPrincipalpunished(){ + return principalpunished; +} +/**Fija el valor de principalpunished +@param pPrincipalpunished nuevo Valor de principalpunished*/ +public void setPrincipalpunished(String pPrincipalpunished){ + principalpunished=pPrincipalpunished; +} + +/**Obtiene el valor de principaljudial +@return valor de principaljudial*/ +public String getPrincipaljudial(){ + return principaljudial; +} +/**Fija el valor de principaljudial +@param pPrincipaljudial nuevo Valor de principaljudial*/ +public void setPrincipaljudial(String pPrincipaljudial){ + principaljudial=pPrincipaljudial; +} + +/**Obtiene el valor de mortgagewarranties +@return valor de mortgagewarranties*/ +public BigDecimal getMortgagewarranties(){ + return mortgagewarranties; +} +/**Fija el valor de mortgagewarranties +@param pMortgagewarranties nuevo Valor de mortgagewarranties*/ +public void setMortgagewarranties(BigDecimal pMortgagewarranties){ + mortgagewarranties=pMortgagewarranties; +} + +/**Obtiene el valor de appraisalmortgagewarranties +@return valor de appraisalmortgagewarranties*/ +public BigDecimal getAppraisalmortgagewarranties(){ + return appraisalmortgagewarranties; +} +/**Fija el valor de appraisalmortgagewarranties +@param pAppraisalmortgagewarranties nuevo Valor de appraisalmortgagewarranties*/ +public void setAppraisalmortgagewarranties(BigDecimal pAppraisalmortgagewarranties){ + appraisalmortgagewarranties=pAppraisalmortgagewarranties; +} + +/**Obtiene el valor de fulfilmenmortgagewarranties +@return valor de fulfilmenmortgagewarranties*/ +public BigDecimal getFulfilmenmortgagewarranties(){ + return fulfilmenmortgagewarranties; +} +/**Fija el valor de fulfilmenmortgagewarranties +@param pFulfilmenmortgagewarranties nuevo Valor de fulfilmenmortgagewarranties*/ +public void setFulfilmenmortgagewarranties(BigDecimal pFulfilmenmortgagewarranties){ + fulfilmenmortgagewarranties=pFulfilmenmortgagewarranties; +} + +/**Obtiene el valor de bankwarranties +@return valor de bankwarranties*/ +public BigDecimal getBankwarranties(){ + return bankwarranties; +} +/**Fija el valor de bankwarranties +@param pBankwarranties nuevo Valor de bankwarranties*/ +public void setBankwarranties(BigDecimal pBankwarranties){ + bankwarranties=pBankwarranties; +} + +/**Obtiene el valor de appraisalbankwarranties +@return valor de appraisalbankwarranties*/ +public BigDecimal getAppraisalbankwarranties(){ + return appraisalbankwarranties; +} +/**Fija el valor de appraisalbankwarranties +@param pAppraisalbankwarranties nuevo Valor de appraisalbankwarranties*/ +public void setAppraisalbankwarranties(BigDecimal pAppraisalbankwarranties){ + appraisalbankwarranties=pAppraisalbankwarranties; +} + +/**Obtiene el valor de fulfilmenbankwarranties +@return valor de fulfilmenbankwarranties*/ +public BigDecimal getFulfilmenbankwarranties(){ + return fulfilmenbankwarranties; +} +/**Fija el valor de fulfilmenbankwarranties +@param pFulfilmenbankwarranties nuevo Valor de fulfilmenbankwarranties*/ +public void setFulfilmenbankwarranties(BigDecimal pFulfilmenbankwarranties){ + fulfilmenbankwarranties=pFulfilmenbankwarranties; +} + +/**Obtiene el valor de policywarranties +@return valor de policywarranties*/ +public BigDecimal getPolicywarranties(){ + return policywarranties; +} +/**Fija el valor de policywarranties +@param pPolicywarranties nuevo Valor de policywarranties*/ +public void setPolicywarranties(BigDecimal pPolicywarranties){ + policywarranties=pPolicywarranties; +} + +/**Obtiene el valor de appraisalpolicywarranties +@return valor de appraisalpolicywarranties*/ +public BigDecimal getAppraisalpolicywarranties(){ + return appraisalpolicywarranties; +} +/**Fija el valor de appraisalpolicywarranties +@param pAppraisalpolicywarranties nuevo Valor de appraisalpolicywarranties*/ +public void setAppraisalpolicywarranties(BigDecimal pAppraisalpolicywarranties){ + appraisalpolicywarranties=pAppraisalpolicywarranties; +} + +/**Obtiene el valor de fulfilmenpolicywarranties +@return valor de fulfilmenpolicywarranties*/ +public BigDecimal getFulfilmenpolicywarranties(){ + return fulfilmenpolicywarranties; +} +/**Fija el valor de fulfilmenpolicywarranties +@param pFulfilmenpolicywarranties nuevo Valor de fulfilmenpolicywarranties*/ +public void setFulfilmenpolicywarranties(BigDecimal pFulfilmenpolicywarranties){ + fulfilmenpolicywarranties=pFulfilmenpolicywarranties; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountScoreDetail))return false; + TgeneAccountScoreDetail that = (TgeneAccountScoreDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneAccountScoreDetail +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneAccountScoreDetail +*/ +public Object createInstance(){ + TgeneAccountScoreDetail instance=new TgeneAccountScoreDetail(); + instance.setPk(new TgeneAccountScoreDetailKey()); + return instance; +} +/**Clona la entidad TgeneAccountScoreDetail +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountScoreDetail p=(TgeneAccountScoreDetail)this.clone(); + p.setPk((TgeneAccountScoreDetailKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneAccountScoreDetailKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneAccountScoreDetailKey.java.svn-base new file mode 100644 index 0000000..74bbc68 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneAccountScoreDetailKey.java.svn-base @@ -0,0 +1,152 @@ +package com.fp.persistence.pgeneral.score; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TLOANACCOUNTSCOREDETAIL*/ +@Embeddable +public class TgeneAccountScoreDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="SCOREDATE", nullable=false,updatable=false) + +/** +* Fecha de calificacion de la cuenta +*/ +private Date scoredate; + +/**Contructor por defecto*/ +public TgeneAccountScoreDetailKey(){} +/**Contructor de TgeneAccountScoreDetailKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pScoredate Fecha de calificacion de la cuenta +*/ +public TgeneAccountScoreDetailKey(String pAccount,Integer pCompany,Date pScoredate){ + account=pAccount; + company=pCompany; + scoredate=pScoredate; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de scoredate +@return valor de scoredate*/ +public Date getScoredate(){ + return scoredate; +} +/**Fija el valor de scoredate +@param pScoredate nuevo Valor de scoredate*/ +public void setScoredate(Date pScoredate){ + scoredate=pScoredate; +} + +/**Implementacion de la comparacion de TgeneAccountScoreDetailKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountScoreDetailKey))return false; + TgeneAccountScoreDetailKey that = (TgeneAccountScoreDetailKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getScoredate() == null || that.getScoredate() == null){ + return false; + } + if (! this.getScoredate().equals(that.getScoredate())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneAccountScoreDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getScoredate() == null ? 0 : this.getScoredate().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneAccountScoreJournal.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneAccountScoreJournal.java.svn-base new file mode 100644 index 0000000..c4dd320 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneAccountScoreJournal.java.svn-base @@ -0,0 +1,616 @@ +package com.fp.persistence.pgeneral.score; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTSCOREJOURNAL*/ +@Entity(name="TgeneAccountScoreJournal") +@Table(name="TGENEACCOUNTSCOREJOURNAL") +public class TgeneAccountScoreJournal extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountScoreJournal +*/ +@EmbeddedId +private TgeneAccountScoreJournalKey pk; +@Column(name="PROCESSDESCRIPTION", nullable=true) + +/** +* null +*/ +private String processdescription; + +@Column(name="ACCOUNT", nullable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="SCOREDATE", nullable=false) + +/** +* Fecha de calificacion de la cuenta +*/ +private Date scoredate; + +@Column(name="OPERATIONSTATUS", nullable=true) + +/** +* Codigo de estatus de la operacion con el que se realiza la calificacion, ORI (Original), REF (refinanciada), RES (restructurada) +*/ +private String operationstatus; + +@Column(name="MODULECODE", nullable=true) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=true) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=true) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="CURRENCYCODE", nullable=true) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="CREDITTYPECODE", nullable=true) + +/** +* Codigo de tipo de credito +*/ +private String credittypecode; + +@Column(name="STATUSCODE", nullable=true) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +@Column(name="USERCODE", nullable=true) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="AMOUNT", nullable=true) + +/** +* null +*/ +private BigDecimal amount; + +@Column(name="SCORE", nullable=true) + +/** +* Codigo de calificacion actual del prestamo +*/ +private String score; + +@Column(name="PROVISIONPERCENT", nullable=true) + +/** +* Porcentaje de provision constituido. +*/ +private BigDecimal provisionpercent; + +@Column(name="PROVISIONVALUE", nullable=true) + +/** +* Saldo de provision de la cuenta +*/ +private BigDecimal provisionvalue; + +@Column(name="MANUALSCORE", nullable=true) + +/** +* Codigo de calificacion actual del prestamo +*/ +private String manualscore; + +@Column(name="MANUALPROVISIONPERCENT", nullable=true) + +/** +* Porcentaje de provision constituido. +*/ +private BigDecimal manualprovisionpercent; + +@Column(name="MANUALPROVISIONVALUE", nullable=true) + +/** +* Saldo de provision de la cuenta +*/ +private BigDecimal manualprovisionvalue; + +@Column(name="FINALSCORE", nullable=true) + +/** +* Codigo de calificacion actual del prestamo +*/ +private String finalscore; + +@Column(name="FINALPROVISIONPERCENT", nullable=true) + +/** +* Porcentaje de provision constituido. +*/ +private BigDecimal finalprovisionpercent; + +@Column(name="FINALPROVISIONVALUE", nullable=true) + +/** +* Saldo de provision de la cuenta +*/ +private BigDecimal finalprovisionvalue; + +@Column(name="PREVIOUSSCORE", nullable=true) + +/** +* Codigo de calificacion actual del prestamo +*/ +private String previousscore; + +@Column(name="PREVIOUSPROVISIONPERCENT", nullable=true) + +/** +* Porcentaje de provision constituido. +*/ +private BigDecimal previousprovisionpercent; + +@Column(name="PREVIOUSPROVISIONVALUE", nullable=true) + +/** +* Saldo de provision de la cuenta +*/ +private BigDecimal previousprovisionvalue; + +@Column(name="EXPIRATIONDATE", nullable=true) + +/** +* Fecha de vencimiento de la menor cuota no pagada +*/ +private Date expirationdate; + +@Column(name="ISCOMPUTEDSCORE", nullable=true) + +/** +* N Indica que la calificacion se creo al crear la cuenta, Y Indica que es una calificacion a reportar a un organismo de control +*/ +private String iscomputedscore; + +/**Contructor por defecto*/ +public TgeneAccountScoreJournal(){ +} +/**Contructor de TgeneAccountScoreJournal +@param pPk Clave Primaria del entity +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pScoredate Fecha de calificacion de la cuenta +*/ +public TgeneAccountScoreJournal(TgeneAccountScoreJournalKey pPk,String pAccount,Integer pCompany,Date pScoredate){ + this(); + pk=pPk; + account=pAccount; + company=pCompany; + scoredate=pScoredate; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountScoreJournal +*/ +public static TgeneAccountScoreJournal find(EntityManager pEntityManager,TgeneAccountScoreJournalKey pKey) throws Exception{ + TgeneAccountScoreJournal obj = pEntityManager.find(TgeneAccountScoreJournal.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountScoreJournal +@return El objeto que referencia a la Clave primaria de TgeneAccountScoreJournal +*/ +public TgeneAccountScoreJournalKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountScoreJournal +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountScoreJournal +*/ +public void setPk(TgeneAccountScoreJournalKey pPk){ + pk=pPk; +} +/**Obtiene el valor de processdescription +@return valor de processdescription*/ +public String getProcessdescription(){ + return processdescription; +} +/**Fija el valor de processdescription +@param pProcessdescription nuevo Valor de processdescription*/ +public void setProcessdescription(String pProcessdescription){ + processdescription=pProcessdescription; +} + +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de scoredate +@return valor de scoredate*/ +public Date getScoredate(){ + return scoredate; +} +/**Fija el valor de scoredate +@param pScoredate nuevo Valor de scoredate*/ +public void setScoredate(Date pScoredate){ + scoredate=pScoredate; +} + +/**Obtiene el valor de operationstatus +@return valor de operationstatus*/ +public String getOperationstatus(){ + return operationstatus; +} +/**Fija el valor de operationstatus +@param pOperationstatus nuevo Valor de operationstatus*/ +public void setOperationstatus(String pOperationstatus){ + operationstatus=pOperationstatus; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de credittypecode +@return valor de credittypecode*/ +public String getCredittypecode(){ + return credittypecode; +} +/**Fija el valor de credittypecode +@param pCredittypecode nuevo Valor de credittypecode*/ +public void setCredittypecode(String pCredittypecode){ + credittypecode=pCredittypecode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de amount +@return valor de amount*/ +public BigDecimal getAmount(){ + return amount; +} +/**Fija el valor de amount +@param pAmount nuevo Valor de amount*/ +public void setAmount(BigDecimal pAmount){ + amount=pAmount; +} + +/**Obtiene el valor de score +@return valor de score*/ +public String getScore(){ + return score; +} +/**Fija el valor de score +@param pScore nuevo Valor de score*/ +public void setScore(String pScore){ + score=pScore; +} + +/**Obtiene el valor de provisionpercent +@return valor de provisionpercent*/ +public BigDecimal getProvisionpercent(){ + return provisionpercent; +} +/**Fija el valor de provisionpercent +@param pProvisionpercent nuevo Valor de provisionpercent*/ +public void setProvisionpercent(BigDecimal pProvisionpercent){ + provisionpercent=pProvisionpercent; +} + +/**Obtiene el valor de provisionvalue +@return valor de provisionvalue*/ +public BigDecimal getProvisionvalue(){ + return provisionvalue; +} +/**Fija el valor de provisionvalue +@param pProvisionvalue nuevo Valor de provisionvalue*/ +public void setProvisionvalue(BigDecimal pProvisionvalue){ + provisionvalue=pProvisionvalue; +} + +/**Obtiene el valor de manualscore +@return valor de manualscore*/ +public String getManualscore(){ + return manualscore; +} +/**Fija el valor de manualscore +@param pManualscore nuevo Valor de manualscore*/ +public void setManualscore(String pManualscore){ + manualscore=pManualscore; +} + +/**Obtiene el valor de manualprovisionpercent +@return valor de manualprovisionpercent*/ +public BigDecimal getManualprovisionpercent(){ + return manualprovisionpercent; +} +/**Fija el valor de manualprovisionpercent +@param pManualprovisionpercent nuevo Valor de manualprovisionpercent*/ +public void setManualprovisionpercent(BigDecimal pManualprovisionpercent){ + manualprovisionpercent=pManualprovisionpercent; +} + +/**Obtiene el valor de manualprovisionvalue +@return valor de manualprovisionvalue*/ +public BigDecimal getManualprovisionvalue(){ + return manualprovisionvalue; +} +/**Fija el valor de manualprovisionvalue +@param pManualprovisionvalue nuevo Valor de manualprovisionvalue*/ +public void setManualprovisionvalue(BigDecimal pManualprovisionvalue){ + manualprovisionvalue=pManualprovisionvalue; +} + +/**Obtiene el valor de finalscore +@return valor de finalscore*/ +public String getFinalscore(){ + return finalscore; +} +/**Fija el valor de finalscore +@param pFinalscore nuevo Valor de finalscore*/ +public void setFinalscore(String pFinalscore){ + finalscore=pFinalscore; +} + +/**Obtiene el valor de finalprovisionpercent +@return valor de finalprovisionpercent*/ +public BigDecimal getFinalprovisionpercent(){ + return finalprovisionpercent; +} +/**Fija el valor de finalprovisionpercent +@param pFinalprovisionpercent nuevo Valor de finalprovisionpercent*/ +public void setFinalprovisionpercent(BigDecimal pFinalprovisionpercent){ + finalprovisionpercent=pFinalprovisionpercent; +} + +/**Obtiene el valor de finalprovisionvalue +@return valor de finalprovisionvalue*/ +public BigDecimal getFinalprovisionvalue(){ + return finalprovisionvalue; +} +/**Fija el valor de finalprovisionvalue +@param pFinalprovisionvalue nuevo Valor de finalprovisionvalue*/ +public void setFinalprovisionvalue(BigDecimal pFinalprovisionvalue){ + finalprovisionvalue=pFinalprovisionvalue; +} + +/**Obtiene el valor de previousscore +@return valor de previousscore*/ +public String getPreviousscore(){ + return previousscore; +} +/**Fija el valor de previousscore +@param pPreviousscore nuevo Valor de previousscore*/ +public void setPreviousscore(String pPreviousscore){ + previousscore=pPreviousscore; +} + +/**Obtiene el valor de previousprovisionpercent +@return valor de previousprovisionpercent*/ +public BigDecimal getPreviousprovisionpercent(){ + return previousprovisionpercent; +} +/**Fija el valor de previousprovisionpercent +@param pPreviousprovisionpercent nuevo Valor de previousprovisionpercent*/ +public void setPreviousprovisionpercent(BigDecimal pPreviousprovisionpercent){ + previousprovisionpercent=pPreviousprovisionpercent; +} + +/**Obtiene el valor de previousprovisionvalue +@return valor de previousprovisionvalue*/ +public BigDecimal getPreviousprovisionvalue(){ + return previousprovisionvalue; +} +/**Fija el valor de previousprovisionvalue +@param pPreviousprovisionvalue nuevo Valor de previousprovisionvalue*/ +public void setPreviousprovisionvalue(BigDecimal pPreviousprovisionvalue){ + previousprovisionvalue=pPreviousprovisionvalue; +} + +/**Obtiene el valor de expirationdate +@return valor de expirationdate*/ +public Date getExpirationdate(){ + return expirationdate; +} +/**Fija el valor de expirationdate +@param pExpirationdate nuevo Valor de expirationdate*/ +public void setExpirationdate(Date pExpirationdate){ + expirationdate=pExpirationdate; +} + +/**Obtiene el valor de iscomputedscore +@return valor de iscomputedscore*/ +public String getIscomputedscore(){ + return iscomputedscore; +} +/**Fija el valor de iscomputedscore +@param pIscomputedscore nuevo Valor de iscomputedscore*/ +public void setIscomputedscore(String pIscomputedscore){ + iscomputedscore=pIscomputedscore; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountScoreJournal))return false; + TgeneAccountScoreJournal that = (TgeneAccountScoreJournal) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneAccountScoreJournal +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneAccountScoreJournal +*/ +public Object createInstance(){ + TgeneAccountScoreJournal instance=new TgeneAccountScoreJournal(); + instance.setPk(new TgeneAccountScoreJournalKey()); + return instance; +} +/**Clona la entidad TgeneAccountScoreJournal +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountScoreJournal p=(TgeneAccountScoreJournal)this.clone(); + p.setPk((TgeneAccountScoreJournalKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneAccountScoreJournalKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneAccountScoreJournalKey.java.svn-base new file mode 100644 index 0000000..4a89329 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneAccountScoreJournalKey.java.svn-base @@ -0,0 +1,152 @@ +package com.fp.persistence.pgeneral.score; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTSCOREJOURNAL*/ +@Embeddable +public class TgeneAccountScoreJournalKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="JOURNALID", nullable=false,updatable=false) + +/** +* Numero de movimiento +*/ +private String journalid; + +@Column(name="PARTITIONDB", nullable=false,updatable=false) + +/** +* Particion yyyymm anio mas mes de la fecha contable hasta +*/ +private String partitiondb; + +@Column(name="REALDATE", nullable=false,updatable=false) + +/** +* Fecha real +*/ +private Timestamp realdate; + +/**Contructor por defecto*/ +public TgeneAccountScoreJournalKey(){} +/**Contructor de TgeneAccountScoreJournalKey +@param pJournalid Numero de movimiento +@param pPartitiondb Particion yyyymm anio mas mes de la fecha contable hasta +@param pRealdate Fecha real +*/ +public TgeneAccountScoreJournalKey(String pJournalid,String pPartitiondb,Timestamp pRealdate){ + journalid=pJournalid; + partitiondb=pPartitiondb; + realdate=pRealdate; +} +/**Obtiene el valor de journalid +@return valor de journalid*/ +public String getJournalid(){ + return journalid; +} +/**Fija el valor de journalid +@param pJournalid nuevo Valor de journalid*/ +public void setJournalid(String pJournalid){ + journalid=pJournalid; +} + +/**Obtiene el valor de partitiondb +@return valor de partitiondb*/ +public String getPartitiondb(){ + return partitiondb; +} +/**Fija el valor de partitiondb +@param pPartitiondb nuevo Valor de partitiondb*/ +public void setPartitiondb(String pPartitiondb){ + partitiondb=pPartitiondb; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Timestamp getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Timestamp pRealdate){ + realdate=pRealdate; +} + +/**Implementacion de la comparacion de TgeneAccountScoreJournalKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountScoreJournalKey))return false; + TgeneAccountScoreJournalKey that = (TgeneAccountScoreJournalKey) o; + if (this.getJournalid() == null || that.getJournalid() == null){ + return false; + } + if (! this.getJournalid().equals(that.getJournalid())){ + return false; + } + if (this.getPartitiondb() == null || that.getPartitiondb() == null){ + return false; + } + if (! this.getPartitiondb().equals(that.getPartitiondb())){ + return false; + } + if (this.getRealdate() == null || that.getRealdate() == null){ + return false; + } + if (! this.getRealdate().equals(that.getRealdate())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneAccountScoreJournalKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getJournalid() == null ? 0 : this.getJournalid().hashCode()); + result = result * 37 + (this.getPartitiondb() == null ? 0 : this.getPartitiondb().hashCode()); + result = result * 37 + (this.getRealdate() == null ? 0 : this.getRealdate().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneAccountScoreKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneAccountScoreKey.java.svn-base new file mode 100644 index 0000000..7f37a81 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneAccountScoreKey.java.svn-base @@ -0,0 +1,152 @@ +package com.fp.persistence.pgeneral.score; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTSCORE*/ +@Embeddable +public class TgeneAccountScoreKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="SCOREDATE", nullable=false,updatable=false) + +/** +* Fecha de calificacion de la cuenta +*/ +private Date scoredate; + +/**Contructor por defecto*/ +public TgeneAccountScoreKey(){} +/**Contructor de TgeneAccountScoreKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pScoredate Fecha de calificacion de la cuenta +*/ +public TgeneAccountScoreKey(String pAccount,Integer pCompany,Date pScoredate){ + account=pAccount; + company=pCompany; + scoredate=pScoredate; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de scoredate +@return valor de scoredate*/ +public Date getScoredate(){ + return scoredate; +} +/**Fija el valor de scoredate +@param pScoredate nuevo Valor de scoredate*/ +public void setScoredate(Date pScoredate){ + scoredate=pScoredate; +} + +/**Implementacion de la comparacion de TgeneAccountScoreKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountScoreKey))return false; + TgeneAccountScoreKey that = (TgeneAccountScoreKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getScoredate() == null || that.getScoredate() == null){ + return false; + } + if (! this.getScoredate().equals(that.getScoredate())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneAccountScoreKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getScoredate() == null ? 0 : this.getScoredate().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgenePercentScore.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgenePercentScore.java.svn-base new file mode 100644 index 0000000..92f42e8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgenePercentScore.java.svn-base @@ -0,0 +1,269 @@ +package com.fp.persistence.pgeneral.score; + +import java.sql.Timestamp; +import java.util.List; +import java.io.Serializable; +import javax.persistence.Table; +import java.math.BigDecimal; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; + +import javax.persistence.Query; +import javax.persistence.Version; +import javax.persistence.Entity; +import javax.persistence.EmbeddedId; +import com.fp.dto.hb.Cache; + +import javax.persistence.EntityManager; +import javax.persistence.Column; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENEPERCENTSCORE + */ +@Entity(name = "TgenePercentScore") +@Table(name = "TGENEPERCENTSCORE") +public class TgenePercentScore extends com.fp.dto.AbstractDataTransport + implements Serializable, HibernateBean, Cloneable, Cache { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgenePercentScore + */ + @EmbeddedId + private TgenePercentScoreKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el porcentaje de calificacion + */ + private Timestamp datefrom; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistick locking del registro. + */ + private Integer recordversion; + + @Column(name = "PERCENT", nullable = true) + /** + * Porcentaje de provision de la calificacion tipo de credito + */ + private BigDecimal percent; + + /** Contructor por defecto */ + public TgenePercentScore() { + } + + /** + * Contructor de TgenePercentScore + * + * @param pPk + * Clave Primaria del entity + */ + public TgenePercentScore(TgenePercentScoreKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager + * referencia de la session a obtener datos del bean. + * @param pKey + * Caleve primaria del bean. + * @return TgenePercentScore + */ + public static TgenePercentScore find(EntityManager pEntityManager, + TgenePercentScoreKey pKey) throws Exception { + TgenePercentScore obj = pEntityManager.find(TgenePercentScore.class, + pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgenePercentScore + * + * @return El objeto que referencia a la Clave primaria de TgenePercentScore + */ + public TgenePercentScoreKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgenePercentScore + * + * @param pPk + * El objeto que referencia a la nueva Clave primaria de + * TgenePercentScore + */ + public void setPk(TgenePercentScoreKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom + * nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion + * nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de percent + * + * @return valor de percent + */ + public BigDecimal getPercent() { + return percent; + } + + /** + * Fija el valor de percent + * + * @param pPercent + * nuevo Valor de percent + */ + public void setPercent(BigDecimal pPercent) { + percent = pPercent; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgenePercentScore)) + return false; + TgenePercentScore that = (TgenePercentScore) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgenePercentScore + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 + || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgenePercentScore */ + public Object createInstance() { + TgenePercentScore instance = new TgenePercentScore(); + instance.setPk(new TgenePercentScoreKey()); + return instance; + } + + /** + * Clona la entidad TgenePercentScore + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgenePercentScore p = (TgenePercentScore) this.clone(); + p.setPk((TgenePercentScoreKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + + + /** + * + * METODOS MANUALES + * + */ + + private static final String JPQL_SCORE_PERCENT = "" + + " from TgenePercentScore tsol " + + " where tsol.pk.dateto = :dateto " + + " and tsol.pk.credittypecode = :credittype " + + " and tsol.percent <= :percent "; + + public static List findbyScorePercent(EntityManager pEntityManager, String credittype, Number percent) throws Exception{ + //javax.persistence.Query qry = pEntityManager.createQuery(JPQL_SCORE_PERCENT); + Query qry = pEntityManager.createQuery(JPQL_SCORE_PERCENT); + qry.setParameter("credittype", credittype); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + qry.setParameter("percent", percent); + + return qry.getResultList(); + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgenePercentScoreKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgenePercentScoreKey.java.svn-base new file mode 100644 index 0000000..7915039 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgenePercentScoreKey.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pgeneral.score; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEPERCENTSCORE*/ +@Embeddable +public class TgenePercentScoreKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SCORECODE", nullable=false,updatable=false) + +/** +* Codigo de calificacion con el cual se realiza el calculo de provisiones +*/ +private String scorecode; + +@Column(name="CREDITTYPECODE", nullable=false,updatable=false) + +/** +* Codigo de tipo de credito +*/ +private String credittypecode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el porcentaje de provision de acuerdo a la calificacion +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TgenePercentScoreKey(){} +/**Contructor de TgenePercentScoreKey +@param pScorecode Codigo de calificacion con el cual se realiza el calculo de provisiones +@param pCredittypecode Codigo de tipo de credito +@param pDateto Fecha hasta la cual esta vigente el porcentaje de provision de acuerdo a la calificacion +*/ +public TgenePercentScoreKey(String pScorecode,String pCredittypecode,Timestamp pDateto){ + scorecode=pScorecode; + credittypecode=pCredittypecode; + dateto=pDateto; +} +/**Obtiene el valor de scorecode +@return valor de scorecode*/ +public String getScorecode(){ + return scorecode; +} +/**Fija el valor de scorecode +@param pScorecode nuevo Valor de scorecode*/ +public void setScorecode(String pScorecode){ + scorecode=pScorecode; +} + +/**Obtiene el valor de credittypecode +@return valor de credittypecode*/ +public String getCredittypecode(){ + return credittypecode; +} +/**Fija el valor de credittypecode +@param pCredittypecode nuevo Valor de credittypecode*/ +public void setCredittypecode(String pCredittypecode){ + credittypecode=pCredittypecode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TgenePercentScoreKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgenePercentScoreKey))return false; + TgenePercentScoreKey that = (TgenePercentScoreKey) o; + if (this.getScorecode() == null || that.getScorecode() == null){ + return false; + } + if (! this.getScorecode().equals(that.getScorecode())){ + return false; + } + if (this.getCredittypecode() == null || that.getCredittypecode() == null){ + return false; + } + if (! this.getCredittypecode().equals(that.getCredittypecode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgenePercentScoreKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getScorecode() == null ? 0 : this.getScorecode().hashCode()); + result = result * 37 + (this.getCredittypecode() == null ? 0 : this.getCredittypecode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScore.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScore.java.svn-base new file mode 100644 index 0000000..2d1d379 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScore.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.persistence.pgeneral.score; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESCORE*/ +@Entity(name="TgeneScore") +@Table(name="TGENESCORE") +public class TgeneScore extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneScore +*/ +@Id +@Column(name="SCORECODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="REALSCORE", nullable=true) + +/** +* Codigo de calificacion real a presentar a los organismos de control. +*/ +private String realscore; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion asociada al codigo de calificacion. +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneScore(){ +} +/**Contructor de TgeneScore +@param pPk Clave Primaria del entity +*/ +public TgeneScore(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneScore +*/ +public static TgeneScore find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneScore obj = pEntityManager.find(TgeneScore.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneScore +@return El objeto que referencia a la Clave primaria de TgeneScore +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneScore +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneScore +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de realscore +@return valor de realscore*/ +public String getRealscore(){ + return realscore; +} +/**Fija el valor de realscore +@param pRealscore nuevo Valor de realscore*/ +public void setRealscore(String pRealscore){ + realscore=pRealscore; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneScore))return false; + TgeneScore that = (TgeneScore) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneScore +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneScore +*/ +public Object createInstance(){ + TgeneScore instance=new TgeneScore(); + return instance; +} +/**Clona la entidad TgeneScore +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneScore p=(TgeneScore)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreAdjustment.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreAdjustment.java.svn-base new file mode 100644 index 0000000..a0f3f68 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreAdjustment.java.svn-base @@ -0,0 +1,524 @@ +package com.fp.persistence.pgeneral.score; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESCOREADJUSTMENT */ +@Entity(name = "TgeneScoreAdjustment") +@Table(name = "TGENESCOREADJUSTMENT") +public class TgeneScoreAdjustment extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneScoreAdjustment + */ + @EmbeddedId + private TgeneScoreAdjustmentKey pk; + + @Column(name = "DATEFROM", nullable = false) + /** + * Fecha desde la cual esta vigente el registro con datos de la cuenta. + */ + private Timestamp datefrom; + + @Column(name = "MODULECODE", nullable = true) + /** + * Codigo de modulo + */ + private String modulecode; + + @Column(name = "PRODUCTCODE", nullable = true) + /** + * Codigo de producto + */ + private String productcode; + + @Column(name = "SUBPRODUCTCODE", nullable = true) + /** + * Codigo de subproducto + */ + private String subproductcode; + + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + + @Column(name = "ADJUSTMENTTYPE", nullable = false) + /** + * null + */ + private String adjustmenttype; + + @Column(name = "MANUALPROVISIONPERCENT", nullable = false) + /** + * Porcentaje de provision constituido. + */ + private BigDecimal manualprovisionpercent; + + @Column(name = "JOURNALID", nullable = false) + /** + * Numero de movimiento + */ + private String journalid; + + @Column(name = "FILENAME", nullable = true) + /** + * Nombre de archivo + */ + private String filename; + + @Column(name = "STATUS", nullable = true) + /** + * Estado del registro + */ + private String status; + + /** Contructor por defecto */ + public TgeneScoreAdjustment() { + } + + /** + * Contructor de TgeneScoreAdjustment + * + * @param pPk Clave Primaria del entity + * @param pDatefrom Fecha desde la cual esta vigente el registro con datos de la cuenta. + * @param pAdjustmenttype null + * @param pManualprovisionpercent Porcentaje de provision constituido. + * @param pJournalid Numero de movimiento + */ + public TgeneScoreAdjustment(TgeneScoreAdjustmentKey pPk, Timestamp pDatefrom, String pAdjustmenttype, BigDecimal pManualprovisionpercent, + String pJournalid) { + this(); + this.pk = pPk; + this.datefrom = pDatefrom; + this.adjustmenttype = pAdjustmenttype; + this.manualprovisionpercent = pManualprovisionpercent; + this.journalid = pJournalid; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneScoreAdjustment + */ + public static TgeneScoreAdjustment find(EntityManager pEntityManager, TgeneScoreAdjustmentKey pKey) throws Exception { + TgeneScoreAdjustment obj = pEntityManager.find(TgeneScoreAdjustment.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneScoreAdjustment + * + * @return El objeto que referencia a la Clave primaria de TgeneScoreAdjustment + */ + public TgeneScoreAdjustmentKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneScoreAdjustment + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneScoreAdjustment + */ + public void setPk(TgeneScoreAdjustmentKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de modulecode + * + * @return valor de modulecode + */ + public String getModulecode() { + return this.modulecode; + } + + /** + * Fija el valor de modulecode + * + * @param pModulecode nuevo Valor de modulecode + */ + public void setModulecode(String pModulecode) { + this.modulecode = pModulecode; + } + + /** + * Obtiene el valor de productcode + * + * @return valor de productcode + */ + public String getProductcode() { + return this.productcode; + } + + /** + * Fija el valor de productcode + * + * @param pProductcode nuevo Valor de productcode + */ + public void setProductcode(String pProductcode) { + this.productcode = pProductcode; + } + + /** + * Obtiene el valor de subproductcode + * + * @return valor de subproductcode + */ + public String getSubproductcode() { + return this.subproductcode; + } + + /** + * Fija el valor de subproductcode + * + * @param pSubproductcode nuevo Valor de subproductcode + */ + public void setSubproductcode(String pSubproductcode) { + this.subproductcode = pSubproductcode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de adjustmenttype + * + * @return valor de adjustmenttype + */ + public String getAdjustmenttype() { + return this.adjustmenttype; + } + + /** + * Fija el valor de adjustmenttype + * + * @param pAdjustmenttype nuevo Valor de adjustmenttype + */ + public void setAdjustmenttype(String pAdjustmenttype) { + this.adjustmenttype = pAdjustmenttype; + } + + /** + * Obtiene el valor de manualprovisionpercent + * + * @return valor de manualprovisionpercent + */ + public BigDecimal getManualprovisionpercent() { + return this.manualprovisionpercent; + } + + /** + * Fija el valor de manualprovisionpercent + * + * @param pManualprovisionpercent nuevo Valor de manualprovisionpercent + */ + public void setManualprovisionpercent(BigDecimal pManualprovisionpercent) { + this.manualprovisionpercent = pManualprovisionpercent; + } + + /** + * Obtiene el valor de journalid + * + * @return valor de journalid + */ + public String getJournalid() { + return this.journalid; + } + + /** + * Fija el valor de journalid + * + * @param pJournalid nuevo Valor de journalid + */ + public void setJournalid(String pJournalid) { + this.journalid = pJournalid; + } + + /** + * Obtiene el valor de filename + * + * @return valor de filename + */ + public String getFilename() { + return this.filename; + } + + /** + * Fija el valor de filename + * + * @param pFilename nuevo Valor de filename + */ + public void setFilename(String pFilename) { + this.filename = pFilename; + } + + /** + * Obtiene el valor de status + * + * @return valor de status + */ + public String getStatus() { + return this.status; + } + + /** + * Fija el valor de status + * + * @param pStatus nuevo Valor de status + */ + public void setStatus(String pStatus) { + this.status = pStatus; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneScoreAdjustment)) { + return false; + } + TgeneScoreAdjustment that = (TgeneScoreAdjustment) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneScoreAdjustment + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneScoreAdjustment */ + @Override + public Object createInstance() { + TgeneScoreAdjustment instance = new TgeneScoreAdjustment(); + instance.setPk(new TgeneScoreAdjustmentKey()); + return instance; + } + + /** + * Clona la entidad TgeneScoreAdjustment + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneScoreAdjustment p = (TgeneScoreAdjustment) this.clone(); + p.setPk((TgeneScoreAdjustmentKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + + /** + * + * METODOS MANUALES + * + */ + + /** + * Sentencia para buscar los registros asociados a un scoredate + */ + private static final String JPQL_ACCOUNT_SCOREDATE = "from TgeneScoreAdjustment tsol " + + " where tsol.pk.dateto = :dateto " + + " and tsol.pk.companycode = :companycode " + + " and tsol.pk.scoredate in (select sh.pk.scoredate from TgeneScoreHeader sh " + + " where sh.pk.companycode = :companycode " + + " and sh.tabulated = :tabulated " + + " and sh.pk.scoredate = :scoredate) "; + + public static List findbyScoreDate(EntityManager pEntityManager, Integer company, String tabulated, Date scoredate) + throws Exception { + Query qry = pEntityManager.createQuery(TgeneScoreAdjustment.JPQL_ACCOUNT_SCOREDATE); + qry.setParameter("companycode", company); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + qry.setParameter("tabulated", tabulated); + qry.setParameter("scoredate", scoredate); + return qry.getResultList(); + } + + /* Calificacin por archivo */ + + /** + * Sentencia para buscar los registros que tienen el nombre de archivo dado + */ + private static final String JPQL_FILE = "select distinct t.filename " + " from TgeneScoreAdjustment t " + " where t.pk.companycode = :company" + + " and t.filename = :filename"; + + /** + * Mtodo que selecciona los registros que tienen el nombre de archivo dado + * + * @param pEntityManager Referencia de la session a obtener datos del bean + * @param pCompany Cdigo de la compaia + * @param pFilename Nombre del archivo + * @return Nombre del archivo si existe, de lo contrario null + * @throws Exception + */ + public static String find(EntityManager pEntityManager, Integer pCompany, String pFilename) throws Exception { + try { + Query qry = pEntityManager.createQuery(TgeneScoreAdjustment.JPQL_FILE); + qry.setParameter("company", pCompany); + qry.setParameter("filename", pFilename); + + return (String) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + + /** + * Sentencia para buscar los registros asociados a una entidad financiera dada que no hayan sido procesados + */ + private static final String JPQL_BANK = "from TgeneScoreAdjustment t " + " where t.pk.companycode = :company "; + // + " and t.pk.bank = coalesce(:bank, t.pk.bank) "; + + // /** + // * Mtodo que selecciona los registros asociados a una entidad financiera dada que no hayan sido procesados + // * + // * @param pEntityManager Referencia de la session a obtener datos del bean + // * @param pCompany Nombre de la compaia + // * @param pBank Cdigo del banco + // * @return Lista de registro de TloanPaymentAccoBank + // * @throws Exception + // */ + // @SuppressWarnings("unchecked") + // public static List findByBank(EntityManager pEntityManager, Integer pCompany, String pBank) + // throws Exception { + // Query qry = pEntityManager.createQuery(JPQL_BANK); + // qry.setParameter("company", pCompany); + // qry.setParameter("bank", pBank); + // + // return qry.getResultList(); + // } + // + // /** + // * Sentencia para buscar los registros asociados a una cuenta dada que no hayan sido procesados + // */ + // private static final String JPQL_ACCOUNT = "from TgeneScoreAdjustment t " + " where t.pk.companycode = :company " + // + " and t.pk.account = :account " + " and t.status = 'N' " ; + // + // /** + // * Mtodo que selecciona los registros asociados a una cuenta dada que no hayan sido procesados + // * + // * @param pEntityManager Referencia de la session a obtener datos del bean + // * @param pCompany Nombre de la compaia + // * @param pAccount Cdigo de la cuenta + // * @return Lista de registro de TloanPaymentAccoBank + // * @throws Exception + // */ + // @SuppressWarnings("unchecked") + // public static List findByAccount(EntityManager pEntityManager, Integer pCompany, String + // pAccount) throws Exception { + // Query qry = pEntityManager.createQuery(JPQL_ACCOUNT); + // qry.setParameter("company", pCompany); + // qry.setParameter("account", pAccount); + // + // return qry.getResultList(); + // } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreAdjustmentKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreAdjustmentKey.java.svn-base new file mode 100644 index 0000000..f1bb637 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreAdjustmentKey.java.svn-base @@ -0,0 +1,183 @@ +package com.fp.persistence.pgeneral.score; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESCOREADJUSTMENT*/ +@Embeddable +public class TgeneScoreAdjustmentKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro con datos de la cuenta. +*/ +private Timestamp dateto; + +@Column(name="SCOREDATE", nullable=false,updatable=false) + +/** +* Fecha de calificacion +*/ +private Timestamp scoredate; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +/**Contructor por defecto*/ +public TgeneScoreAdjustmentKey(){} +/**Contructor de TgeneScoreAdjustmentKey +@param pDateto Fecha hasta la cual esta vigente el registro con datos de la cuenta. +@param pScoredate Fecha de calificacion +@param pCompanycode Codigo de compania +@param pAccount Numero de cuenta +*/ +public TgeneScoreAdjustmentKey(Timestamp pDateto,Timestamp pScoredate,Integer pCompanycode,String pAccount){ + dateto=pDateto; + scoredate=pScoredate; + companycode=pCompanycode; + account=pAccount; +} +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de scoredate +@return valor de scoredate*/ +public Timestamp getScoredate(){ + return scoredate; +} +/**Fija el valor de scoredate +@param pScoredate nuevo Valor de scoredate*/ +public void setScoredate(Timestamp pScoredate){ + scoredate=pScoredate; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Implementacion de la comparacion de TgeneScoreAdjustmentKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneScoreAdjustmentKey))return false; + TgeneScoreAdjustmentKey that = (TgeneScoreAdjustmentKey) o; + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getScoredate() == null || that.getScoredate() == null){ + return false; + } + if (! this.getScoredate().equals(that.getScoredate())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneScoreAdjustmentKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getScoredate() == null ? 0 : this.getScoredate().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreFileIssues.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreFileIssues.java.svn-base new file mode 100644 index 0000000..f8fbb10 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreFileIssues.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.score; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESCOREFILEISSUES*/ +@Entity(name="TgeneScoreFileIssues") +@Table(name="TGENESCOREFILEISSUES") +public class TgeneScoreFileIssues extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneScoreFileIssues +*/ +@EmbeddedId +private TgeneScoreFileIssuesKey pk; +@Column(name="LINECONTENT", nullable=false) + +/** +* Contenido de la linea con problemas +*/ +private String linecontent; + +@Column(name="USERMESSAGE", nullable=true) + +/** +* Mensaje del usuario por el cual no se subio esa linea +*/ +private String usermessage; + +@Column(name="TECHNICALMESSAGE", nullable=true) + +/** +* Mensaje tecnico de porque no se subio esa linea +*/ +private String technicalmessage; + +/**Contructor por defecto*/ +public TgeneScoreFileIssues(){ +} +/**Contructor de TgeneScoreFileIssues +@param pPk Clave Primaria del entity +@param pLinecontent Contenido de la linea con problemas +*/ +public TgeneScoreFileIssues(TgeneScoreFileIssuesKey pPk,String pLinecontent){ + this(); + pk=pPk; + linecontent=pLinecontent; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneScoreFileIssues +*/ +public static TgeneScoreFileIssues find(EntityManager pEntityManager,TgeneScoreFileIssuesKey pKey) throws Exception{ + TgeneScoreFileIssues obj = pEntityManager.find(TgeneScoreFileIssues.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneScoreFileIssues +@return El objeto que referencia a la Clave primaria de TgeneScoreFileIssues +*/ +public TgeneScoreFileIssuesKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneScoreFileIssues +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneScoreFileIssues +*/ +public void setPk(TgeneScoreFileIssuesKey pPk){ + pk=pPk; +} +/**Obtiene el valor de linecontent +@return valor de linecontent*/ +public String getLinecontent(){ + return linecontent; +} +/**Fija el valor de linecontent +@param pLinecontent nuevo Valor de linecontent*/ +public void setLinecontent(String pLinecontent){ + linecontent=pLinecontent; +} + +/**Obtiene el valor de usermessage +@return valor de usermessage*/ +public String getUsermessage(){ + return usermessage; +} +/**Fija el valor de usermessage +@param pUsermessage nuevo Valor de usermessage*/ +public void setUsermessage(String pUsermessage){ + usermessage=pUsermessage; +} + +/**Obtiene el valor de technicalmessage +@return valor de technicalmessage*/ +public String getTechnicalmessage(){ + return technicalmessage; +} +/**Fija el valor de technicalmessage +@param pTechnicalmessage nuevo Valor de technicalmessage*/ +public void setTechnicalmessage(String pTechnicalmessage){ + technicalmessage=pTechnicalmessage; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneScoreFileIssues))return false; + TgeneScoreFileIssues that = (TgeneScoreFileIssues) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneScoreFileIssues +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneScoreFileIssues +*/ +public Object createInstance(){ + TgeneScoreFileIssues instance=new TgeneScoreFileIssues(); + instance.setPk(new TgeneScoreFileIssuesKey()); + return instance; +} +/**Clona la entidad TgeneScoreFileIssues +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneScoreFileIssues p=(TgeneScoreFileIssues)this.clone(); + p.setPk((TgeneScoreFileIssuesKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreFileIssuesKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreFileIssuesKey.java.svn-base new file mode 100644 index 0000000..8cc6d02 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreFileIssuesKey.java.svn-base @@ -0,0 +1,206 @@ +package com.fp.persistence.pgeneral.score; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESCOREFILEISSUES*/ +@Embeddable +public class TgeneScoreFileIssuesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="LINENUMBER", nullable=false,updatable=false) + +/** +* Numero de linea con problemas +*/ +private Integer linenumber; + +@Column(name="FILENAME", nullable=false,updatable=false) + +/** +* Nombre del archivo +*/ +private String filename; + +@Column(name="UPLOADDATE", nullable=false,updatable=false) + +/** +* Fecha de carga del archivo +*/ +private Timestamp uploaddate; + +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* ID del banco +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* null +*/ +private Integer company; + +/**Contructor por defecto*/ +public TgeneScoreFileIssuesKey(){} +/**Contructor de TgeneScoreFileIssuesKey +@param pLinenumber Numero de linea con problemas +@param pFilename Nombre del archivo +@param pUploaddate Fecha de carga del archivo +@param pAccount ID del banco +@param pCompany null +*/ +public TgeneScoreFileIssuesKey(Integer pLinenumber,String pFilename,Timestamp pUploaddate,String pAccount,Integer pCompany){ + linenumber=pLinenumber; + filename=pFilename; + uploaddate=pUploaddate; + account=pAccount; + company=pCompany; +} +/**Obtiene el valor de linenumber +@return valor de linenumber*/ +public Integer getLinenumber(){ + return linenumber; +} +/**Fija el valor de linenumber +@param pLinenumber nuevo Valor de linenumber*/ +public void setLinenumber(Integer pLinenumber){ + linenumber=pLinenumber; +} + +/**Obtiene el valor de filename +@return valor de filename*/ +public String getFilename(){ + return filename; +} +/**Fija el valor de filename +@param pFilename nuevo Valor de filename*/ +public void setFilename(String pFilename){ + filename=pFilename; +} + +/**Obtiene el valor de uploaddate +@return valor de uploaddate*/ +public Timestamp getUploaddate(){ + return uploaddate; +} +/**Fija el valor de uploaddate +@param pUploaddate nuevo Valor de uploaddate*/ +public void setUploaddate(Timestamp pUploaddate){ + uploaddate=pUploaddate; +} + +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Implementacion de la comparacion de TgeneScoreFileIssuesKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneScoreFileIssuesKey))return false; + TgeneScoreFileIssuesKey that = (TgeneScoreFileIssuesKey) o; + if (this.getLinenumber() == null || that.getLinenumber() == null){ + return false; + } + if (! this.getLinenumber().equals(that.getLinenumber())){ + return false; + } + if (this.getFilename() == null || that.getFilename() == null){ + return false; + } + if (! this.getFilename().equals(that.getFilename())){ + return false; + } + if (this.getUploaddate() == null || that.getUploaddate() == null){ + return false; + } + if (! this.getUploaddate().equals(that.getUploaddate())){ + return false; + } + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneScoreFileIssuesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getLinenumber() == null ? 0 : this.getLinenumber().hashCode()); + result = result * 37 + (this.getFilename() == null ? 0 : this.getFilename().hashCode()); + result = result * 37 + (this.getUploaddate() == null ? 0 : this.getUploaddate().hashCode()); + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreHeader.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreHeader.java.svn-base new file mode 100644 index 0000000..8537b44 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreHeader.java.svn-base @@ -0,0 +1,227 @@ +package com.fp.persistence.pgeneral.score; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESCOREHEADER */ +@Entity(name = "TgeneScoreHeader") +@Table(name = "TGENESCOREHEADER") +public class TgeneScoreHeader extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneScoreHeader + */ + @EmbeddedId + private TgeneScoreHeaderKey pk; + + @Column(name = "FILECODE", nullable = true) + /** + * Codigo de imagen + */ + private Integer filecode; + + @Column(name = "TABULATED", nullable = true) + /** + * Y Indica que la calificacion esta contabilizada y enviada a la super + */ + private String tabulated; + + /** Contructor por defecto */ + public TgeneScoreHeader() { + } + + /** + * Contructor de TgeneScoreHeader + * + * @param pPk Clave Primaria del entity + */ + public TgeneScoreHeader(TgeneScoreHeaderKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneScoreHeader + */ + public static TgeneScoreHeader find(EntityManager pEntityManager, TgeneScoreHeaderKey pKey) throws Exception { + TgeneScoreHeader obj = pEntityManager.find(TgeneScoreHeader.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneScoreHeader + * + * @return El objeto que referencia a la Clave primaria de TgeneScoreHeader + */ + public TgeneScoreHeaderKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneScoreHeader + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneScoreHeader + */ + public void setPk(TgeneScoreHeaderKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de filecode + * + * @return valor de filecode + */ + public Integer getFilecode() { + return this.filecode; + } + + /** + * Fija el valor de filecode + * + * @param pFilecode nuevo Valor de filecode + */ + public void setFilecode(Integer pFilecode) { + this.filecode = pFilecode; + } + + /** + * Obtiene el valor de tabulated + * + * @return valor de tabulated + */ + public String getTabulated() { + return this.tabulated; + } + + /** + * Fija el valor de tabulated + * + * @param pTabulated nuevo Valor de tabulated + */ + public void setTabulated(String pTabulated) { + this.tabulated = pTabulated; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneScoreHeader)) { + return false; + } + TgeneScoreHeader that = (TgeneScoreHeader) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return this.getPk().equals(that.getPk()); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneScoreHeader + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneScoreHeader */ + @Override + public Object createInstance() { + TgeneScoreHeader instance = new TgeneScoreHeader(); + instance.setPk(new TgeneScoreHeaderKey()); + return instance; + } + + /** + * Clona la entidad TgeneScoreHeader + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneScoreHeader p = (TgeneScoreHeader) this.clone(); + p.setPk((TgeneScoreHeaderKey) this.pk.cloneMe()); + return p; + } + + /* METODOS MANUALES */ + + private static final String JPQL_BY_COMPANY = "from TgeneScoreHeader tga " + "where tga.pk.companycode = :companycode"; + + /** + * Permite consultar si existe un periodo de calificacion abierto + * + * @param companycode Codigo de empresa + * @return lista de objetos de tipo + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findByCompany(EntityManager entityManager, Integer companycode) throws Exception { + Query qry = entityManager.createQuery(TgeneScoreHeader.JPQL_BY_COMPANY); + qry.setParameter("companycode", companycode); + return qry.getResultList(); + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreHeaderKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreHeaderKey.java.svn-base new file mode 100644 index 0000000..b1ca320 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreHeaderKey.java.svn-base @@ -0,0 +1,125 @@ +package com.fp.persistence.pgeneral.score; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENESCOREHEADER*/ +@Embeddable +public class TgeneScoreHeaderKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SCOREDATE", nullable=false,updatable=false) + +/** +* Fecha de calificacion +*/ +private Date scoredate; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TgeneScoreHeaderKey(){} +/**Contructor de TgeneScoreHeaderKey +@param pScoredate Fecha de calificacion +@param pCompanycode Codigo de compania +*/ +public TgeneScoreHeaderKey(Date pScoredate,Integer pCompanycode){ + scoredate=pScoredate; + companycode=pCompanycode; +} +/**Obtiene el valor de scoredate +@return valor de scoredate*/ +public Date getScoredate(){ + return scoredate; +} +/**Fija el valor de scoredate +@param pScoredate nuevo Valor de scoredate*/ +public void setScoredate(Date pScoredate){ + scoredate=pScoredate; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacion de la comparacion de TgeneScoreHeaderKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneScoreHeaderKey))return false; + TgeneScoreHeaderKey that = (TgeneScoreHeaderKey) o; + if (this.getScoredate() == null || that.getScoredate() == null){ + return false; + } + if (! this.getScoredate().equals(that.getScoredate())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneScoreHeaderKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getScoredate() == null ? 0 : this.getScoredate().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreRank.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreRank.java.svn-base new file mode 100644 index 0000000..2b31dba --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreRank.java.svn-base @@ -0,0 +1,323 @@ +package com.fp.persistence.pgeneral.score; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.Cache; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Query; + +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENESCORERANK + */ +@Entity(name = "TgeneScoreRank") +@Table(name = "TGENESCORERANK") +public class TgeneScoreRank extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable, Cache { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneScoreRank + */ + @EmbeddedId + private TgeneScoreRankKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el porcentaje de calificacion + */ + private Timestamp datefrom; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistick locking del registro. + */ + private Integer recordversion; + + @Column(name = "DAYSFROM", nullable = true) + /** + * Dias minimos para definir la calificacion del prestamo + */ + private Integer daysfrom; + + @Column(name = "DAYSTO", nullable = true) + /** + * Dias maximos para definir la calificacion del prestamo + */ + private Integer daysto; + + /** Contructor por defecto */ + public TgeneScoreRank() { + } + + /** + * Contructor de TgeneScoreRank + * + * @param pPk + * Clave Primaria del entity + */ + public TgeneScoreRank(TgeneScoreRankKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager + * referencia de la session a obtener datos del bean. + * @param pKey + * Caleve primaria del bean. + * @return TgeneScoreRank + */ + public static TgeneScoreRank find(EntityManager pEntityManager, + TgeneScoreRankKey pKey) throws Exception { + TgeneScoreRank obj = pEntityManager.find(TgeneScoreRank.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneScoreRank + * + * @return El objeto que referencia a la Clave primaria de TgeneScoreRank + */ + public TgeneScoreRankKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneScoreRank + * + * @param pPk + * El objeto que referencia a la nueva Clave primaria de + * TgeneScoreRank + */ + public void setPk(TgeneScoreRankKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom + * nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion + * nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de daysfrom + * + * @return valor de daysfrom + */ + public Integer getDaysfrom() { + return daysfrom; + } + + /** + * Fija el valor de daysfrom + * + * @param pDaysfrom + * nuevo Valor de daysfrom + */ + public void setDaysfrom(Integer pDaysfrom) { + daysfrom = pDaysfrom; + } + + /** + * Obtiene el valor de daysto + * + * @return valor de daysto + */ + public Integer getDaysto() { + return daysto; + } + + /** + * Fija el valor de daysto + * + * @param pDaysto + * nuevo Valor de daysto + */ + public void setDaysto(Integer pDaysto) { + daysto = pDaysto; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneScoreRank)) + return false; + TgeneScoreRank that = (TgeneScoreRank) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneScoreRank + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 + || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneScoreRank */ + public Object createInstance() { + TgeneScoreRank instance = new TgeneScoreRank(); + instance.setPk(new TgeneScoreRankKey()); + return instance; + } + + /** + * Clona la entidad TgeneScoreRank + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneScoreRank p = (TgeneScoreRank) this.clone(); + p.setPk((TgeneScoreRankKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + + //Metodos manuales. + /**Sentencia que entrega la definicion de rangos de calificacion de cartera.*/ + private static final String JPQL = "from TgeneScoreRank t "+ + " where t.pk.credittypecode = :credittypecode " + + " and t.pk.operationstatus = :operationstatus"+ + " and t.pk.modulecode = :modulecode "+ + " and t.pk.dateto = :dateto "; + + /** + * Metodo que entrega una lista de calificacion de cartera dado el tipo de credito, estado de la operacion y modulo. + * @param pEntityManager Referencia a una session de base de datos. + * @param pCreditType Codigo de tipo de credito, CON consumo, COM comercial, etc + * @param pOperationStatus Estado de la operacion Orginal, Restructurada + * @param pModuleCode Modulo asociado al estado de la operacion. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager,String pCreditType,String pOperationStatus,String pModuleCode) throws Exception { + List ldata = null; + Query qry = pEntityManager.createQuery(JPQL); + qry.setParameter("credittypecode", pCreditType); + qry.setParameter("operationstatus", pOperationStatus); + qry.setParameter("modulecode", pModuleCode); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + ldata = qry.getResultList(); + return ldata; + } + + /**Sentencia que entrega la definicion de rangos de calificacion de cartera.*/ + private static final String JPQL_FIRST_SCORE = "from TgeneScoreRank t "+ + " where t.pk.credittypecode = :credittypecode " + + " and t.pk.operationstatus = :operationstatus"+ + " and t.pk.modulecode = :modulecode "+ + " and t.pk.dateto = :dateto " + + " and 0 between t.daysfrom and t.daysto "; + + /** + * Metodo que entrega una lista de calificacion de cartera dado el tipo de credito y modulo. + * @param pEntityManager Referencia a una session de base de datos. + * @param pCreditType Codigo de tipo de credito, CON consumo, COM comercial, etc + * @param pModuleCode Modulo asociado al estado de la operacion. + * @return List + * @throws Exception + */ + public static TgeneScoreRank find(EntityManager pEntityManager,String pCreditType,String pModuleCode) throws Exception { + TgeneScoreRank obj = null; + Query qry = pEntityManager.createQuery(JPQL_FIRST_SCORE); + qry.setParameter("credittypecode", pCreditType); + qry.setParameter("operationstatus", "ORI"); + qry.setParameter("modulecode", pModuleCode); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + obj = (TgeneScoreRank)qry.getSingleResult(); + return obj; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreRankKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreRankKey.java.svn-base new file mode 100644 index 0000000..1edff66 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/.svn/text-base/TgeneScoreRankKey.java.svn-base @@ -0,0 +1,210 @@ +package com.fp.persistence.pgeneral.score; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESCORERANK*/ +@Embeddable +public class TgeneScoreRankKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SCORECODE", nullable=false,updatable=false) + +/** +* Codigo de calificacion con el cual se realiza el calculo de provisiones +*/ +private String scorecode; + +@Column(name="CREDITTYPECODE", nullable=false,updatable=false) + +/** +* Codigo de tipo de credito +*/ +private String credittypecode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el porcentaje de provision de acuerdo a la calificacion +*/ +private Timestamp dateto; + +@Column(name="OPERATIONSTATUS", nullable=false,updatable=false) + +/** +* Codigo de estatus de la operacion, ORI (Original), REF (refinanciada), RES (restructurada) +*/ +private String operationstatus; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +/**Contructor por defecto*/ +public TgeneScoreRankKey(){} +/**Contructor de TgeneScoreRankKey +@param pScorecode Codigo de calificacion con el cual se realiza el calculo de provisiones +@param pCredittypecode Codigo de tipo de credito +@param pDateto Fecha hasta la cual esta vigente el porcentaje de provision de acuerdo a la calificacion +@param pOperationstatus Codigo de estatus de la operacion, ORI (Original), REF (refinanciada), RES (restructurada) +@param pModulecode Codigo de modulo +*/ +public TgeneScoreRankKey(String pScorecode,String pCredittypecode,Timestamp pDateto,String pOperationstatus,String pModulecode){ + scorecode=pScorecode; + credittypecode=pCredittypecode; + dateto=pDateto; + operationstatus=pOperationstatus; + modulecode=pModulecode; +} +/**Obtiene el valor de scorecode +@return valor de scorecode*/ +public String getScorecode(){ + return scorecode; +} +/**Fija el valor de scorecode +@param pScorecode nuevo Valor de scorecode*/ +public void setScorecode(String pScorecode){ + scorecode=pScorecode; +} + +/**Obtiene el valor de credittypecode +@return valor de credittypecode*/ +public String getCredittypecode(){ + return credittypecode; +} +/**Fija el valor de credittypecode +@param pCredittypecode nuevo Valor de credittypecode*/ +public void setCredittypecode(String pCredittypecode){ + credittypecode=pCredittypecode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de operationstatus +@return valor de operationstatus*/ +public String getOperationstatus(){ + return operationstatus; +} +/**Fija el valor de operationstatus +@param pOperationstatus nuevo Valor de operationstatus*/ +public void setOperationstatus(String pOperationstatus){ + operationstatus=pOperationstatus; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Implementacin de la comparacin de TgeneScoreRankKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneScoreRankKey))return false; + TgeneScoreRankKey that = (TgeneScoreRankKey) o; + if (this.getScorecode() == null || that.getScorecode() == null){ + return false; + } + if (! this.getScorecode().equals(that.getScorecode())){ + return false; + } + if (this.getCredittypecode() == null || that.getCredittypecode() == null){ + return false; + } + if (! this.getCredittypecode().equals(that.getCredittypecode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getOperationstatus() == null || that.getOperationstatus() == null){ + return false; + } + if (! this.getOperationstatus().equals(that.getOperationstatus())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneScoreRankKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getScorecode() == null ? 0 : this.getScorecode().hashCode()); + result = result * 37 + (this.getCredittypecode() == null ? 0 : this.getCredittypecode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getOperationstatus() == null ? 0 : this.getOperationstatus().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneAccountScore.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneAccountScore.java new file mode 100644 index 0000000..3e997ca --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneAccountScore.java @@ -0,0 +1,857 @@ +package com.fp.persistence.pgeneral.score; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTSCORE */ +@Entity(name = "TgeneAccountScore") +@Table(name = "TGENEACCOUNTSCORE") +public class TgeneAccountScore extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneAccountScore + */ + @EmbeddedId + private TgeneAccountScoreKey pk; + + @Column(name = "OPERATIONSTATUS", nullable = true) + /** + * Codigo de estatus de la operacion con el que se realiza la calificacion, ORI (Original), REF (refinanciada), RES (restructurada) + */ + private String operationstatus; + + @Column(name = "MODULECODE", nullable = true) + /** + * Codigo de modulo + */ + private String modulecode; + + @Column(name = "PRODUCTCODE", nullable = true) + /** + * Codigo de producto + */ + private String productcode; + + @Column(name = "SUBPRODUCTCODE", nullable = true) + /** + * Codigo de subproducto + */ + private String subproductcode; + + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + + @Column(name = "CREDITTYPECODE", nullable = true) + /** + * Codigo de tipo de credito + */ + private String credittypecode; + + @Column(name = "STATUSCODE", nullable = true) + /** + * Estatus de cuenta + */ + private String statuscode; + + @Column(name = "USERCODE", nullable = true) + /** + * Codigo de usuario + */ + private String usercode; + + @Column(name = "AMOUNT", nullable = true) + /** + * Monto base sobre el que se realiza la provision + */ + private BigDecimal amount; + + @Column(name = "SCORE", nullable = true) + /** + * Codigo de calificacion actual del prestamo. Proceso automatico. + */ + private String score; + + @Column(name = "PROVISIONPERCENT", nullable = true) + /** + * Porcentaje de provision constituido.Proceso automatico. + */ + private BigDecimal provisionpercent; + + @Column(name = "PROVISIONVALUE", nullable = true) + /** + * Saldo de provision de la cuentaProceso automatico. + */ + private BigDecimal provisionvalue; + + @Column(name = "MANUALSCORE", nullable = true) + /** + * Codigo de calificacion actual del prestamo. Calificacion manual o por medio del archivo. + */ + private String manualscore; + + @Column(name = "MANUALPROVISIONPERCENT", nullable = true) + /** + * Porcentaje de provision constituido.Calificacion manual o por medio del archivo. + */ + private BigDecimal manualprovisionpercent; + + @Column(name = "MANUALPROVISIONVALUE", nullable = true) + /** + * Saldo de provision de la cuenta.Calificacion manual o por medio del archivo. + */ + private BigDecimal manualprovisionvalue; + + @Column(name = "FINALSCORE", nullable = true) + /** + * Codigo de calificacion actual del prestamo.Calificacion final y homologada. + */ + private String finalscore; + + @Column(name = "FINALPROVISIONPERCENT", nullable = true) + /** + * Porcentaje de provision constituido.Calificacion final y homologada. + */ + private BigDecimal finalprovisionpercent; + + @Column(name = "FINALPROVISIONVALUE", nullable = true) + /** + * Saldo de provision de la cuenta.Calificacion final y homologada. + */ + private BigDecimal finalprovisionvalue; + + @Column(name = "PREVIOUSSCORE", nullable = true) + /** + * Codigo de calificacion actual del prestamo.Calificacion final y homologada del periodo anterior + */ + private String previousscore; + + @Column(name = "PREVIOUSPROVISIONPERCENT", nullable = true) + /** + * Porcentaje de provision constituido.Calificacion final y homologada del periodo anterior + */ + private BigDecimal previousprovisionpercent; + + @Column(name = "PREVIOUSPROVISIONVALUE", nullable = true) + /** + * Saldo de provision de la cuent.Calificacion final y homologada del periodo anterior + */ + private BigDecimal previousprovisionvalue; + + @Column(name = "EXPIRATIONDATE", nullable = true) + /** + * Fecha de vencimiento de la menor cuota no pagada + */ + private Date expirationdate; + + @Column(name = "ISCOMPUTEDSCORE", nullable = true) + /** + * N Indica que la calificacion se creo al crear la cuenta, Y Indica que es una calificacion a reportar a un organismo de control + */ + private String iscomputedscore; + + @Column(name = "JOURNALID", nullable = false) + /** + * Numero de movimiento + */ + private String journalid; + + /** Contructor por defecto */ + public TgeneAccountScore() { + } + + /** + * Contructor de TgeneAccountScore + * + * @param pPk Clave Primaria del entity + * @param pJournalid Numero de movimiento + */ + public TgeneAccountScore(TgeneAccountScoreKey pPk, String pJournalid) { + this(); + this.pk = pPk; + this.journalid = pJournalid; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneAccountScore + */ + public static TgeneAccountScore find(EntityManager pEntityManager, TgeneAccountScoreKey pKey) throws Exception { + TgeneAccountScore obj = pEntityManager.find(TgeneAccountScore.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneAccountScore + * + * @return El objeto que referencia a la Clave primaria de TgeneAccountScore + */ + public TgeneAccountScoreKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneAccountScore + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountScore + */ + public void setPk(TgeneAccountScoreKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de operationstatus + * + * @return valor de operationstatus + */ + public String getOperationstatus() { + return this.operationstatus; + } + + /** + * Fija el valor de operationstatus + * + * @param pOperationstatus nuevo Valor de operationstatus + */ + public void setOperationstatus(String pOperationstatus) { + this.operationstatus = pOperationstatus; + } + + /** + * Obtiene el valor de modulecode + * + * @return valor de modulecode + */ + public String getModulecode() { + return this.modulecode; + } + + /** + * Fija el valor de modulecode + * + * @param pModulecode nuevo Valor de modulecode + */ + public void setModulecode(String pModulecode) { + this.modulecode = pModulecode; + } + + /** + * Obtiene el valor de productcode + * + * @return valor de productcode + */ + public String getProductcode() { + return this.productcode; + } + + /** + * Fija el valor de productcode + * + * @param pProductcode nuevo Valor de productcode + */ + public void setProductcode(String pProductcode) { + this.productcode = pProductcode; + } + + /** + * Obtiene el valor de subproductcode + * + * @return valor de subproductcode + */ + public String getSubproductcode() { + return this.subproductcode; + } + + /** + * Fija el valor de subproductcode + * + * @param pSubproductcode nuevo Valor de subproductcode + */ + public void setSubproductcode(String pSubproductcode) { + this.subproductcode = pSubproductcode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de credittypecode + * + * @return valor de credittypecode + */ + public String getCredittypecode() { + return this.credittypecode; + } + + /** + * Fija el valor de credittypecode + * + * @param pCredittypecode nuevo Valor de credittypecode + */ + public void setCredittypecode(String pCredittypecode) { + this.credittypecode = pCredittypecode; + } + + /** + * Obtiene el valor de statuscode + * + * @return valor de statuscode + */ + public String getStatuscode() { + return this.statuscode; + } + + /** + * Fija el valor de statuscode + * + * @param pStatuscode nuevo Valor de statuscode + */ + public void setStatuscode(String pStatuscode) { + this.statuscode = pStatuscode; + } + + /** + * Obtiene el valor de usercode + * + * @return valor de usercode + */ + public String getUsercode() { + return this.usercode; + } + + /** + * Fija el valor de usercode + * + * @param pUsercode nuevo Valor de usercode + */ + public void setUsercode(String pUsercode) { + this.usercode = pUsercode; + } + + /** + * Obtiene el valor de amount + * + * @return valor de amount + */ + public BigDecimal getAmount() { + return this.amount; + } + + /** + * Fija el valor de amount + * + * @param pAmount nuevo Valor de amount + */ + public void setAmount(BigDecimal pAmount) { + this.amount = pAmount; + } + + /** + * Obtiene el valor de score + * + * @return valor de score + */ + public String getScore() { + return this.score; + } + + /** + * Fija el valor de score + * + * @param pScore nuevo Valor de score + */ + public void setScore(String pScore) { + this.score = pScore; + } + + /** + * Obtiene el valor de provisionpercent + * + * @return valor de provisionpercent + */ + public BigDecimal getProvisionpercent() { + return this.provisionpercent; + } + + /** + * Fija el valor de provisionpercent + * + * @param pProvisionpercent nuevo Valor de provisionpercent + */ + public void setProvisionpercent(BigDecimal pProvisionpercent) { + this.provisionpercent = pProvisionpercent; + } + + /** + * Obtiene el valor de provisionvalue + * + * @return valor de provisionvalue + */ + public BigDecimal getProvisionvalue() { + return this.provisionvalue; + } + + /** + * Fija el valor de provisionvalue + * + * @param pProvisionvalue nuevo Valor de provisionvalue + */ + public void setProvisionvalue(BigDecimal pProvisionvalue) { + this.provisionvalue = pProvisionvalue; + } + + /** + * Obtiene el valor de manualscore + * + * @return valor de manualscore + */ + public String getManualscore() { + return this.manualscore; + } + + /** + * Fija el valor de manualscore + * + * @param pManualscore nuevo Valor de manualscore + */ + public void setManualscore(String pManualscore) { + this.manualscore = pManualscore; + } + + /** + * Obtiene el valor de manualprovisionpercent + * + * @return valor de manualprovisionpercent + */ + public BigDecimal getManualprovisionpercent() { + return this.manualprovisionpercent; + } + + /** + * Fija el valor de manualprovisionpercent + * + * @param pManualprovisionpercent nuevo Valor de manualprovisionpercent + */ + public void setManualprovisionpercent(BigDecimal pManualprovisionpercent) { + this.manualprovisionpercent = pManualprovisionpercent; + } + + /** + * Obtiene el valor de manualprovisionvalue + * + * @return valor de manualprovisionvalue + */ + public BigDecimal getManualprovisionvalue() { + return this.manualprovisionvalue; + } + + /** + * Fija el valor de manualprovisionvalue + * + * @param pManualprovisionvalue nuevo Valor de manualprovisionvalue + */ + public void setManualprovisionvalue(BigDecimal pManualprovisionvalue) { + this.manualprovisionvalue = pManualprovisionvalue; + } + + /** + * Obtiene el valor de finalscore + * + * @return valor de finalscore + */ + public String getFinalscore() { + return this.finalscore; + } + + /** + * Fija el valor de finalscore + * + * @param pFinalscore nuevo Valor de finalscore + */ + public void setFinalscore(String pFinalscore) { + this.finalscore = pFinalscore; + } + + /** + * Obtiene el valor de finalprovisionpercent + * + * @return valor de finalprovisionpercent + */ + public BigDecimal getFinalprovisionpercent() { + return this.finalprovisionpercent; + } + + /** + * Fija el valor de finalprovisionpercent + * + * @param pFinalprovisionpercent nuevo Valor de finalprovisionpercent + */ + public void setFinalprovisionpercent(BigDecimal pFinalprovisionpercent) { + this.finalprovisionpercent = pFinalprovisionpercent; + } + + /** + * Obtiene el valor de finalprovisionvalue + * + * @return valor de finalprovisionvalue + */ + public BigDecimal getFinalprovisionvalue() { + return this.finalprovisionvalue; + } + + /** + * Fija el valor de finalprovisionvalue + * + * @param pFinalprovisionvalue nuevo Valor de finalprovisionvalue + */ + public void setFinalprovisionvalue(BigDecimal pFinalprovisionvalue) { + this.finalprovisionvalue = pFinalprovisionvalue; + } + + /** + * Obtiene el valor de previousscore + * + * @return valor de previousscore + */ + public String getPreviousscore() { + return this.previousscore; + } + + /** + * Fija el valor de previousscore + * + * @param pPreviousscore nuevo Valor de previousscore + */ + public void setPreviousscore(String pPreviousscore) { + this.previousscore = pPreviousscore; + } + + /** + * Obtiene el valor de previousprovisionpercent + * + * @return valor de previousprovisionpercent + */ + public BigDecimal getPreviousprovisionpercent() { + return this.previousprovisionpercent; + } + + /** + * Fija el valor de previousprovisionpercent + * + * @param pPreviousprovisionpercent nuevo Valor de previousprovisionpercent + */ + public void setPreviousprovisionpercent(BigDecimal pPreviousprovisionpercent) { + this.previousprovisionpercent = pPreviousprovisionpercent; + } + + /** + * Obtiene el valor de previousprovisionvalue + * + * @return valor de previousprovisionvalue + */ + public BigDecimal getPreviousprovisionvalue() { + return this.previousprovisionvalue; + } + + /** + * Fija el valor de previousprovisionvalue + * + * @param pPreviousprovisionvalue nuevo Valor de previousprovisionvalue + */ + public void setPreviousprovisionvalue(BigDecimal pPreviousprovisionvalue) { + this.previousprovisionvalue = pPreviousprovisionvalue; + } + + /** + * Obtiene el valor de expirationdate + * + * @return valor de expirationdate + */ + public Date getExpirationdate() { + return this.expirationdate; + } + + /** + * Fija el valor de expirationdate + * + * @param pExpirationdate nuevo Valor de expirationdate + */ + public void setExpirationdate(Date pExpirationdate) { + this.expirationdate = pExpirationdate; + } + + /** + * Obtiene el valor de iscomputedscore + * + * @return valor de iscomputedscore + */ + public String getIscomputedscore() { + return this.iscomputedscore; + } + + /** + * Fija el valor de iscomputedscore + * + * @param pIscomputedscore nuevo Valor de iscomputedscore + */ + public void setIscomputedscore(String pIscomputedscore) { + this.iscomputedscore = pIscomputedscore; + } + + /** + * Obtiene el valor de journalid + * + * @return valor de journalid + */ + public String getJournalid() { + return this.journalid; + } + + /** + * Fija el valor de journalid + * + * @param pJournalid nuevo Valor de journalid + */ + public void setJournalid(String pJournalid) { + this.journalid = pJournalid; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneAccountScore)) { + return false; + } + TgeneAccountScore that = (TgeneAccountScore) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return this.getPk().equals(that.getPk()); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneAccountScore + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneAccountScore */ + @Override + public Object createInstance() { + TgeneAccountScore instance = new TgeneAccountScore(); + instance.setPk(new TgeneAccountScoreKey()); + return instance; + } + + /** + * Clona la entidad TgeneAccountScore + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneAccountScore p = (TgeneAccountScore) this.clone(); + p.setPk((TgeneAccountScoreKey) this.pk.cloneMe()); + return p; + } + + /* Mtodos manuales */ + + /** Sentencia para seleccionar la ultima calificacin de una cuenta */ + private static final String JPQL_LAST_SCORE = " select t from TgeneAccountScore t " + " where t.pk.account = :account " + + " and t.pk.company = :company " + " and t.modulecode = :modulecode " + " and t.pk.scoredate = ( " + + " select max(t.pk.scoredate) from TgeneAccountScore t " + " where t.pk.account = :account " + " and t.pk.company = :company " + + " and t.modulecode = :modulecode " + " and t.iscomputedscore = 'Y' " + " group by t.pk.account )"; + + /** + * Mtodo que selecciona la ultima calificacin de una cuenta + * + * @param entityManager + * @param pAccount + * @param pCompany + * @param pModulecode + * @return + * @throws Exception + */ + public static TgeneAccountScore getLastScore(EntityManager entityManager, String pAccount, Integer pCompany, String pModulecode) throws Exception { + Query qry = entityManager.createQuery(TgeneAccountScore.JPQL_LAST_SCORE); + qry.setParameter("account", pAccount); + qry.setParameter("company", pCompany); + qry.setParameter("modulecode", pModulecode); + + try { + return (TgeneAccountScore) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + + // Metodos personalizados + + // select * from tgeneaccountscore where account = 1 and companycode =1; + + private static final String JPQL_FIND_BY_ACCOUNT = "" + " from TgeneAccountScore tga " + "where tga.pk.account = :account " + + " and tga.pk.company = :company"; + + /** + * Permite consultar el registro asociado a la cuenta + * + * @param entityManager Administrador de entidades y persistencia + * @param account String con la cuenta a consultar + * @param company int con la empresa asociada a la cuenta + * @return Registro TgeneAccountScore + * @throws Exception + */ + public static TgeneAccountScore findByAccount(EntityManager entityManager, String account, int company) { + Query qry = entityManager.createQuery(TgeneAccountScore.JPQL_FIND_BY_ACCOUNT); + qry.setParameter("account", account); + qry.setParameter("company", company); + return (TgeneAccountScore) qry.getSingleResult(); + } + + private static final String JPQL_FIND_WORST_SCORE_CONSTRUCTOR = "" + + " from TGENEACCOUNTSCORE " + + " where account in (select LOANACCOUNT " + + " from TCREDITFACILITYDETAILLOAN cf " + + " where ACCOUNT in (select ACCOUNT from TCREDITFACILITYDETAILLOAN where LOANACCOUNT = :account and COMPANY = :company)) " + + " and score in (select max(SCORE) " + + " from TGENEACCOUNTSCORE " + + " where account in (select LOANACCOUNT " + + " from TCREDITFACILITYDETAILLOAN cf " + + " where ACCOUNT in (select ACCOUNT from TCREDITFACILITYDETAILLOAN where LOANACCOUNT = :account and COMPANY = :company))) "; + + @SuppressWarnings("unchecked") + public static List findByWorstScore(EntityManager entityManager, String account, int company, boolean isConstructor) { + Query qry = entityManager.createQuery(TgeneAccountScore.JPQL_FIND_WORST_SCORE_CONSTRUCTOR); + qry.setParameter("account", account); + qry.setParameter("company", company); + qry.setMaxResults(1); + return qry.getResultList(); + } + + private static final String JPQL_FIND_WORST_SCORE = "" + "select score.* " + " from tgeneaccountscore score inner join TGENEACCOUNT aco1 " + + " on score.account = aco1.account " + " and score.company = aco1.company " + " and score.modulecode = aco1.modulecode " + + " inner join TGENEACCOUNT aco2 " + " on aco1.PERSONCODE = aco2.personcode " + " and aco1.COMPANY = aco2.COMPANY " + + " and aco1.DATETO = aco2.DATETO " + " and aco2.account = :account " + " and aco1.MODULECODE = aco2.MODULECODE " + + " and aco1.PRODUCTCODE = aco2.PRODUCTCODE " + " and aco2.DATETO = aco1.DATETO " + " and aco2.DATETO = TO_DATE('31/12/2999') " + + " and aco2.company = :company " + " order by score.finalscore desc"; + + @SuppressWarnings("unchecked") + public static TgeneAccountScore findByWorstScore(EntityManager entityManager, String account, int company) { + Query qry = entityManager.createQuery(TgeneAccountScore.JPQL_FIND_WORST_SCORE); + qry.setParameter("account", account); + qry.setParameter("company", company); + qry.setMaxResults(1); + List objresultado = qry.getResultList(); + if (objresultado.size() == 1) { + return objresultado.get(0); + } else { + return new TgeneAccountScore(); + } + } + + private final static String JPQL_ACCOUNT_SCORE = " from TgeneAccountScore tls where " + + "tls.pk.account IN (:accountList) and tls.score IN (:scoreList)"; + + /** + * Permite obtener la cuentas de prestamo que esten en estado vigente y que ademas tengan el score necesario para + * reestructuracion + * + * @param entityManager Administrador de persistencia y entidades + * @param accountList Lista de {@link String} con las cuentas a validar + * @param scoreList Lista de {@link String} con los puntajes a validar + * @return lista de datos {@link TloanAccountScore } con los valores de la operacion + */ + @SuppressWarnings("unchecked") + public static List findAccountsByScore(EntityManager entityManager, List accountList, List scoreList) { + Query qry = entityManager.createQuery(TgeneAccountScore.JPQL_ACCOUNT_SCORE); + qry.setParameter("accountList", accountList); + qry.setParameter("scoreList", scoreList); + return qry.getResultList(); + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneAccountScoreDetail.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneAccountScoreDetail.java new file mode 100644 index 0000000..24fa976 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneAccountScoreDetail.java @@ -0,0 +1,339 @@ +package com.fp.persistence.pgeneral.score; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TLOANACCOUNTSCOREDETAIL*/ +@Entity(name="TgeneAccountScoreDetail") +@Table(name="TLOANACCOUNTSCOREDETAIL") +public class TgeneAccountScoreDetail extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountScoreDetail +*/ +@EmbeddedId +private TgeneAccountScoreDetailKey pk; +@Column(name="PRINCIPALSUSPEND", nullable=true) + +/** +* null +*/ +private BigDecimal principalsuspend; + +@Column(name="PRINCIPALPUNISHED", nullable=true) + +/** +* null +*/ +private String principalpunished; + +@Column(name="PRINCIPALJUDIAL", nullable=true) + +/** +* null +*/ +private String principaljudial; + +@Column(name="MORTGAGEWARRANTIES", nullable=true) + +/** +* null +*/ +private BigDecimal mortgagewarranties; + +@Column(name="APPRAISALMORTGAGEWARRANTIES", nullable=true) + +/** +* null +*/ +private BigDecimal appraisalmortgagewarranties; + +@Column(name="FULFILMENMORTGAGEWARRANTIES", nullable=true) + +/** +* null +*/ +private BigDecimal fulfilmenmortgagewarranties; + +@Column(name="BANKWARRANTIES", nullable=true) + +/** +* null +*/ +private BigDecimal bankwarranties; + +@Column(name="APPRAISALBANKWARRANTIES", nullable=true) + +/** +* null +*/ +private BigDecimal appraisalbankwarranties; + +@Column(name="FULFILMENBANKWARRANTIES", nullable=true) + +/** +* null +*/ +private BigDecimal fulfilmenbankwarranties; + +@Column(name="POLICYWARRANTIES", nullable=true) + +/** +* null +*/ +private BigDecimal policywarranties; + +@Column(name="APPRAISALPOLICYWARRANTIES", nullable=true) + +/** +* null +*/ +private BigDecimal appraisalpolicywarranties; + +@Column(name="FULFILMENPOLICYWARRANTIES", nullable=true) + +/** +* null +*/ +private BigDecimal fulfilmenpolicywarranties; + +/**Contructor por defecto*/ +public TgeneAccountScoreDetail(){ +} +/**Contructor de TgeneAccountScoreDetail +@param pPk Clave Primaria del entity +*/ +public TgeneAccountScoreDetail(TgeneAccountScoreDetailKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountScoreDetail +*/ +public static TgeneAccountScoreDetail find(EntityManager pEntityManager,TgeneAccountScoreDetailKey pKey) throws Exception{ + TgeneAccountScoreDetail obj = pEntityManager.find(TgeneAccountScoreDetail.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountScoreDetail +@return El objeto que referencia a la Clave primaria de TgeneAccountScoreDetail +*/ +public TgeneAccountScoreDetailKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountScoreDetail +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountScoreDetail +*/ +public void setPk(TgeneAccountScoreDetailKey pPk){ + pk=pPk; +} +/**Obtiene el valor de principalsuspend +@return valor de principalsuspend*/ +public BigDecimal getPrincipalsuspend(){ + return principalsuspend; +} +/**Fija el valor de principalsuspend +@param pPrincipalsuspend nuevo Valor de principalsuspend*/ +public void setPrincipalsuspend(BigDecimal pPrincipalsuspend){ + principalsuspend=pPrincipalsuspend; +} + +/**Obtiene el valor de principalpunished +@return valor de principalpunished*/ +public String getPrincipalpunished(){ + return principalpunished; +} +/**Fija el valor de principalpunished +@param pPrincipalpunished nuevo Valor de principalpunished*/ +public void setPrincipalpunished(String pPrincipalpunished){ + principalpunished=pPrincipalpunished; +} + +/**Obtiene el valor de principaljudial +@return valor de principaljudial*/ +public String getPrincipaljudial(){ + return principaljudial; +} +/**Fija el valor de principaljudial +@param pPrincipaljudial nuevo Valor de principaljudial*/ +public void setPrincipaljudial(String pPrincipaljudial){ + principaljudial=pPrincipaljudial; +} + +/**Obtiene el valor de mortgagewarranties +@return valor de mortgagewarranties*/ +public BigDecimal getMortgagewarranties(){ + return mortgagewarranties; +} +/**Fija el valor de mortgagewarranties +@param pMortgagewarranties nuevo Valor de mortgagewarranties*/ +public void setMortgagewarranties(BigDecimal pMortgagewarranties){ + mortgagewarranties=pMortgagewarranties; +} + +/**Obtiene el valor de appraisalmortgagewarranties +@return valor de appraisalmortgagewarranties*/ +public BigDecimal getAppraisalmortgagewarranties(){ + return appraisalmortgagewarranties; +} +/**Fija el valor de appraisalmortgagewarranties +@param pAppraisalmortgagewarranties nuevo Valor de appraisalmortgagewarranties*/ +public void setAppraisalmortgagewarranties(BigDecimal pAppraisalmortgagewarranties){ + appraisalmortgagewarranties=pAppraisalmortgagewarranties; +} + +/**Obtiene el valor de fulfilmenmortgagewarranties +@return valor de fulfilmenmortgagewarranties*/ +public BigDecimal getFulfilmenmortgagewarranties(){ + return fulfilmenmortgagewarranties; +} +/**Fija el valor de fulfilmenmortgagewarranties +@param pFulfilmenmortgagewarranties nuevo Valor de fulfilmenmortgagewarranties*/ +public void setFulfilmenmortgagewarranties(BigDecimal pFulfilmenmortgagewarranties){ + fulfilmenmortgagewarranties=pFulfilmenmortgagewarranties; +} + +/**Obtiene el valor de bankwarranties +@return valor de bankwarranties*/ +public BigDecimal getBankwarranties(){ + return bankwarranties; +} +/**Fija el valor de bankwarranties +@param pBankwarranties nuevo Valor de bankwarranties*/ +public void setBankwarranties(BigDecimal pBankwarranties){ + bankwarranties=pBankwarranties; +} + +/**Obtiene el valor de appraisalbankwarranties +@return valor de appraisalbankwarranties*/ +public BigDecimal getAppraisalbankwarranties(){ + return appraisalbankwarranties; +} +/**Fija el valor de appraisalbankwarranties +@param pAppraisalbankwarranties nuevo Valor de appraisalbankwarranties*/ +public void setAppraisalbankwarranties(BigDecimal pAppraisalbankwarranties){ + appraisalbankwarranties=pAppraisalbankwarranties; +} + +/**Obtiene el valor de fulfilmenbankwarranties +@return valor de fulfilmenbankwarranties*/ +public BigDecimal getFulfilmenbankwarranties(){ + return fulfilmenbankwarranties; +} +/**Fija el valor de fulfilmenbankwarranties +@param pFulfilmenbankwarranties nuevo Valor de fulfilmenbankwarranties*/ +public void setFulfilmenbankwarranties(BigDecimal pFulfilmenbankwarranties){ + fulfilmenbankwarranties=pFulfilmenbankwarranties; +} + +/**Obtiene el valor de policywarranties +@return valor de policywarranties*/ +public BigDecimal getPolicywarranties(){ + return policywarranties; +} +/**Fija el valor de policywarranties +@param pPolicywarranties nuevo Valor de policywarranties*/ +public void setPolicywarranties(BigDecimal pPolicywarranties){ + policywarranties=pPolicywarranties; +} + +/**Obtiene el valor de appraisalpolicywarranties +@return valor de appraisalpolicywarranties*/ +public BigDecimal getAppraisalpolicywarranties(){ + return appraisalpolicywarranties; +} +/**Fija el valor de appraisalpolicywarranties +@param pAppraisalpolicywarranties nuevo Valor de appraisalpolicywarranties*/ +public void setAppraisalpolicywarranties(BigDecimal pAppraisalpolicywarranties){ + appraisalpolicywarranties=pAppraisalpolicywarranties; +} + +/**Obtiene el valor de fulfilmenpolicywarranties +@return valor de fulfilmenpolicywarranties*/ +public BigDecimal getFulfilmenpolicywarranties(){ + return fulfilmenpolicywarranties; +} +/**Fija el valor de fulfilmenpolicywarranties +@param pFulfilmenpolicywarranties nuevo Valor de fulfilmenpolicywarranties*/ +public void setFulfilmenpolicywarranties(BigDecimal pFulfilmenpolicywarranties){ + fulfilmenpolicywarranties=pFulfilmenpolicywarranties; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountScoreDetail))return false; + TgeneAccountScoreDetail that = (TgeneAccountScoreDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneAccountScoreDetail +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneAccountScoreDetail +*/ +public Object createInstance(){ + TgeneAccountScoreDetail instance=new TgeneAccountScoreDetail(); + instance.setPk(new TgeneAccountScoreDetailKey()); + return instance; +} +/**Clona la entidad TgeneAccountScoreDetail +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountScoreDetail p=(TgeneAccountScoreDetail)this.clone(); + p.setPk((TgeneAccountScoreDetailKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneAccountScoreDetailKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneAccountScoreDetailKey.java new file mode 100644 index 0000000..74bbc68 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneAccountScoreDetailKey.java @@ -0,0 +1,152 @@ +package com.fp.persistence.pgeneral.score; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TLOANACCOUNTSCOREDETAIL*/ +@Embeddable +public class TgeneAccountScoreDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="SCOREDATE", nullable=false,updatable=false) + +/** +* Fecha de calificacion de la cuenta +*/ +private Date scoredate; + +/**Contructor por defecto*/ +public TgeneAccountScoreDetailKey(){} +/**Contructor de TgeneAccountScoreDetailKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pScoredate Fecha de calificacion de la cuenta +*/ +public TgeneAccountScoreDetailKey(String pAccount,Integer pCompany,Date pScoredate){ + account=pAccount; + company=pCompany; + scoredate=pScoredate; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de scoredate +@return valor de scoredate*/ +public Date getScoredate(){ + return scoredate; +} +/**Fija el valor de scoredate +@param pScoredate nuevo Valor de scoredate*/ +public void setScoredate(Date pScoredate){ + scoredate=pScoredate; +} + +/**Implementacion de la comparacion de TgeneAccountScoreDetailKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountScoreDetailKey))return false; + TgeneAccountScoreDetailKey that = (TgeneAccountScoreDetailKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getScoredate() == null || that.getScoredate() == null){ + return false; + } + if (! this.getScoredate().equals(that.getScoredate())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneAccountScoreDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getScoredate() == null ? 0 : this.getScoredate().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneAccountScoreJournal.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneAccountScoreJournal.java new file mode 100644 index 0000000..c4dd320 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneAccountScoreJournal.java @@ -0,0 +1,616 @@ +package com.fp.persistence.pgeneral.score; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEACCOUNTSCOREJOURNAL*/ +@Entity(name="TgeneAccountScoreJournal") +@Table(name="TGENEACCOUNTSCOREJOURNAL") +public class TgeneAccountScoreJournal extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneAccountScoreJournal +*/ +@EmbeddedId +private TgeneAccountScoreJournalKey pk; +@Column(name="PROCESSDESCRIPTION", nullable=true) + +/** +* null +*/ +private String processdescription; + +@Column(name="ACCOUNT", nullable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="SCOREDATE", nullable=false) + +/** +* Fecha de calificacion de la cuenta +*/ +private Date scoredate; + +@Column(name="OPERATIONSTATUS", nullable=true) + +/** +* Codigo de estatus de la operacion con el que se realiza la calificacion, ORI (Original), REF (refinanciada), RES (restructurada) +*/ +private String operationstatus; + +@Column(name="MODULECODE", nullable=true) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="PRODUCTCODE", nullable=true) + +/** +* Codigo de producto +*/ +private String productcode; + +@Column(name="SUBPRODUCTCODE", nullable=true) + +/** +* Codigo de subproducto +*/ +private String subproductcode; + +@Column(name="CURRENCYCODE", nullable=true) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="CREDITTYPECODE", nullable=true) + +/** +* Codigo de tipo de credito +*/ +private String credittypecode; + +@Column(name="STATUSCODE", nullable=true) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +@Column(name="USERCODE", nullable=true) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="AMOUNT", nullable=true) + +/** +* null +*/ +private BigDecimal amount; + +@Column(name="SCORE", nullable=true) + +/** +* Codigo de calificacion actual del prestamo +*/ +private String score; + +@Column(name="PROVISIONPERCENT", nullable=true) + +/** +* Porcentaje de provision constituido. +*/ +private BigDecimal provisionpercent; + +@Column(name="PROVISIONVALUE", nullable=true) + +/** +* Saldo de provision de la cuenta +*/ +private BigDecimal provisionvalue; + +@Column(name="MANUALSCORE", nullable=true) + +/** +* Codigo de calificacion actual del prestamo +*/ +private String manualscore; + +@Column(name="MANUALPROVISIONPERCENT", nullable=true) + +/** +* Porcentaje de provision constituido. +*/ +private BigDecimal manualprovisionpercent; + +@Column(name="MANUALPROVISIONVALUE", nullable=true) + +/** +* Saldo de provision de la cuenta +*/ +private BigDecimal manualprovisionvalue; + +@Column(name="FINALSCORE", nullable=true) + +/** +* Codigo de calificacion actual del prestamo +*/ +private String finalscore; + +@Column(name="FINALPROVISIONPERCENT", nullable=true) + +/** +* Porcentaje de provision constituido. +*/ +private BigDecimal finalprovisionpercent; + +@Column(name="FINALPROVISIONVALUE", nullable=true) + +/** +* Saldo de provision de la cuenta +*/ +private BigDecimal finalprovisionvalue; + +@Column(name="PREVIOUSSCORE", nullable=true) + +/** +* Codigo de calificacion actual del prestamo +*/ +private String previousscore; + +@Column(name="PREVIOUSPROVISIONPERCENT", nullable=true) + +/** +* Porcentaje de provision constituido. +*/ +private BigDecimal previousprovisionpercent; + +@Column(name="PREVIOUSPROVISIONVALUE", nullable=true) + +/** +* Saldo de provision de la cuenta +*/ +private BigDecimal previousprovisionvalue; + +@Column(name="EXPIRATIONDATE", nullable=true) + +/** +* Fecha de vencimiento de la menor cuota no pagada +*/ +private Date expirationdate; + +@Column(name="ISCOMPUTEDSCORE", nullable=true) + +/** +* N Indica que la calificacion se creo al crear la cuenta, Y Indica que es una calificacion a reportar a un organismo de control +*/ +private String iscomputedscore; + +/**Contructor por defecto*/ +public TgeneAccountScoreJournal(){ +} +/**Contructor de TgeneAccountScoreJournal +@param pPk Clave Primaria del entity +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pScoredate Fecha de calificacion de la cuenta +*/ +public TgeneAccountScoreJournal(TgeneAccountScoreJournalKey pPk,String pAccount,Integer pCompany,Date pScoredate){ + this(); + pk=pPk; + account=pAccount; + company=pCompany; + scoredate=pScoredate; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneAccountScoreJournal +*/ +public static TgeneAccountScoreJournal find(EntityManager pEntityManager,TgeneAccountScoreJournalKey pKey) throws Exception{ + TgeneAccountScoreJournal obj = pEntityManager.find(TgeneAccountScoreJournal.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneAccountScoreJournal +@return El objeto que referencia a la Clave primaria de TgeneAccountScoreJournal +*/ +public TgeneAccountScoreJournalKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneAccountScoreJournal +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneAccountScoreJournal +*/ +public void setPk(TgeneAccountScoreJournalKey pPk){ + pk=pPk; +} +/**Obtiene el valor de processdescription +@return valor de processdescription*/ +public String getProcessdescription(){ + return processdescription; +} +/**Fija el valor de processdescription +@param pProcessdescription nuevo Valor de processdescription*/ +public void setProcessdescription(String pProcessdescription){ + processdescription=pProcessdescription; +} + +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de scoredate +@return valor de scoredate*/ +public Date getScoredate(){ + return scoredate; +} +/**Fija el valor de scoredate +@param pScoredate nuevo Valor de scoredate*/ +public void setScoredate(Date pScoredate){ + scoredate=pScoredate; +} + +/**Obtiene el valor de operationstatus +@return valor de operationstatus*/ +public String getOperationstatus(){ + return operationstatus; +} +/**Fija el valor de operationstatus +@param pOperationstatus nuevo Valor de operationstatus*/ +public void setOperationstatus(String pOperationstatus){ + operationstatus=pOperationstatus; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de productcode +@return valor de productcode*/ +public String getProductcode(){ + return productcode; +} +/**Fija el valor de productcode +@param pProductcode nuevo Valor de productcode*/ +public void setProductcode(String pProductcode){ + productcode=pProductcode; +} + +/**Obtiene el valor de subproductcode +@return valor de subproductcode*/ +public String getSubproductcode(){ + return subproductcode; +} +/**Fija el valor de subproductcode +@param pSubproductcode nuevo Valor de subproductcode*/ +public void setSubproductcode(String pSubproductcode){ + subproductcode=pSubproductcode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de credittypecode +@return valor de credittypecode*/ +public String getCredittypecode(){ + return credittypecode; +} +/**Fija el valor de credittypecode +@param pCredittypecode nuevo Valor de credittypecode*/ +public void setCredittypecode(String pCredittypecode){ + credittypecode=pCredittypecode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de amount +@return valor de amount*/ +public BigDecimal getAmount(){ + return amount; +} +/**Fija el valor de amount +@param pAmount nuevo Valor de amount*/ +public void setAmount(BigDecimal pAmount){ + amount=pAmount; +} + +/**Obtiene el valor de score +@return valor de score*/ +public String getScore(){ + return score; +} +/**Fija el valor de score +@param pScore nuevo Valor de score*/ +public void setScore(String pScore){ + score=pScore; +} + +/**Obtiene el valor de provisionpercent +@return valor de provisionpercent*/ +public BigDecimal getProvisionpercent(){ + return provisionpercent; +} +/**Fija el valor de provisionpercent +@param pProvisionpercent nuevo Valor de provisionpercent*/ +public void setProvisionpercent(BigDecimal pProvisionpercent){ + provisionpercent=pProvisionpercent; +} + +/**Obtiene el valor de provisionvalue +@return valor de provisionvalue*/ +public BigDecimal getProvisionvalue(){ + return provisionvalue; +} +/**Fija el valor de provisionvalue +@param pProvisionvalue nuevo Valor de provisionvalue*/ +public void setProvisionvalue(BigDecimal pProvisionvalue){ + provisionvalue=pProvisionvalue; +} + +/**Obtiene el valor de manualscore +@return valor de manualscore*/ +public String getManualscore(){ + return manualscore; +} +/**Fija el valor de manualscore +@param pManualscore nuevo Valor de manualscore*/ +public void setManualscore(String pManualscore){ + manualscore=pManualscore; +} + +/**Obtiene el valor de manualprovisionpercent +@return valor de manualprovisionpercent*/ +public BigDecimal getManualprovisionpercent(){ + return manualprovisionpercent; +} +/**Fija el valor de manualprovisionpercent +@param pManualprovisionpercent nuevo Valor de manualprovisionpercent*/ +public void setManualprovisionpercent(BigDecimal pManualprovisionpercent){ + manualprovisionpercent=pManualprovisionpercent; +} + +/**Obtiene el valor de manualprovisionvalue +@return valor de manualprovisionvalue*/ +public BigDecimal getManualprovisionvalue(){ + return manualprovisionvalue; +} +/**Fija el valor de manualprovisionvalue +@param pManualprovisionvalue nuevo Valor de manualprovisionvalue*/ +public void setManualprovisionvalue(BigDecimal pManualprovisionvalue){ + manualprovisionvalue=pManualprovisionvalue; +} + +/**Obtiene el valor de finalscore +@return valor de finalscore*/ +public String getFinalscore(){ + return finalscore; +} +/**Fija el valor de finalscore +@param pFinalscore nuevo Valor de finalscore*/ +public void setFinalscore(String pFinalscore){ + finalscore=pFinalscore; +} + +/**Obtiene el valor de finalprovisionpercent +@return valor de finalprovisionpercent*/ +public BigDecimal getFinalprovisionpercent(){ + return finalprovisionpercent; +} +/**Fija el valor de finalprovisionpercent +@param pFinalprovisionpercent nuevo Valor de finalprovisionpercent*/ +public void setFinalprovisionpercent(BigDecimal pFinalprovisionpercent){ + finalprovisionpercent=pFinalprovisionpercent; +} + +/**Obtiene el valor de finalprovisionvalue +@return valor de finalprovisionvalue*/ +public BigDecimal getFinalprovisionvalue(){ + return finalprovisionvalue; +} +/**Fija el valor de finalprovisionvalue +@param pFinalprovisionvalue nuevo Valor de finalprovisionvalue*/ +public void setFinalprovisionvalue(BigDecimal pFinalprovisionvalue){ + finalprovisionvalue=pFinalprovisionvalue; +} + +/**Obtiene el valor de previousscore +@return valor de previousscore*/ +public String getPreviousscore(){ + return previousscore; +} +/**Fija el valor de previousscore +@param pPreviousscore nuevo Valor de previousscore*/ +public void setPreviousscore(String pPreviousscore){ + previousscore=pPreviousscore; +} + +/**Obtiene el valor de previousprovisionpercent +@return valor de previousprovisionpercent*/ +public BigDecimal getPreviousprovisionpercent(){ + return previousprovisionpercent; +} +/**Fija el valor de previousprovisionpercent +@param pPreviousprovisionpercent nuevo Valor de previousprovisionpercent*/ +public void setPreviousprovisionpercent(BigDecimal pPreviousprovisionpercent){ + previousprovisionpercent=pPreviousprovisionpercent; +} + +/**Obtiene el valor de previousprovisionvalue +@return valor de previousprovisionvalue*/ +public BigDecimal getPreviousprovisionvalue(){ + return previousprovisionvalue; +} +/**Fija el valor de previousprovisionvalue +@param pPreviousprovisionvalue nuevo Valor de previousprovisionvalue*/ +public void setPreviousprovisionvalue(BigDecimal pPreviousprovisionvalue){ + previousprovisionvalue=pPreviousprovisionvalue; +} + +/**Obtiene el valor de expirationdate +@return valor de expirationdate*/ +public Date getExpirationdate(){ + return expirationdate; +} +/**Fija el valor de expirationdate +@param pExpirationdate nuevo Valor de expirationdate*/ +public void setExpirationdate(Date pExpirationdate){ + expirationdate=pExpirationdate; +} + +/**Obtiene el valor de iscomputedscore +@return valor de iscomputedscore*/ +public String getIscomputedscore(){ + return iscomputedscore; +} +/**Fija el valor de iscomputedscore +@param pIscomputedscore nuevo Valor de iscomputedscore*/ +public void setIscomputedscore(String pIscomputedscore){ + iscomputedscore=pIscomputedscore; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneAccountScoreJournal))return false; + TgeneAccountScoreJournal that = (TgeneAccountScoreJournal) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneAccountScoreJournal +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneAccountScoreJournal +*/ +public Object createInstance(){ + TgeneAccountScoreJournal instance=new TgeneAccountScoreJournal(); + instance.setPk(new TgeneAccountScoreJournalKey()); + return instance; +} +/**Clona la entidad TgeneAccountScoreJournal +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneAccountScoreJournal p=(TgeneAccountScoreJournal)this.clone(); + p.setPk((TgeneAccountScoreJournalKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneAccountScoreJournalKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneAccountScoreJournalKey.java new file mode 100644 index 0000000..4a89329 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneAccountScoreJournalKey.java @@ -0,0 +1,152 @@ +package com.fp.persistence.pgeneral.score; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTSCOREJOURNAL*/ +@Embeddable +public class TgeneAccountScoreJournalKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="JOURNALID", nullable=false,updatable=false) + +/** +* Numero de movimiento +*/ +private String journalid; + +@Column(name="PARTITIONDB", nullable=false,updatable=false) + +/** +* Particion yyyymm anio mas mes de la fecha contable hasta +*/ +private String partitiondb; + +@Column(name="REALDATE", nullable=false,updatable=false) + +/** +* Fecha real +*/ +private Timestamp realdate; + +/**Contructor por defecto*/ +public TgeneAccountScoreJournalKey(){} +/**Contructor de TgeneAccountScoreJournalKey +@param pJournalid Numero de movimiento +@param pPartitiondb Particion yyyymm anio mas mes de la fecha contable hasta +@param pRealdate Fecha real +*/ +public TgeneAccountScoreJournalKey(String pJournalid,String pPartitiondb,Timestamp pRealdate){ + journalid=pJournalid; + partitiondb=pPartitiondb; + realdate=pRealdate; +} +/**Obtiene el valor de journalid +@return valor de journalid*/ +public String getJournalid(){ + return journalid; +} +/**Fija el valor de journalid +@param pJournalid nuevo Valor de journalid*/ +public void setJournalid(String pJournalid){ + journalid=pJournalid; +} + +/**Obtiene el valor de partitiondb +@return valor de partitiondb*/ +public String getPartitiondb(){ + return partitiondb; +} +/**Fija el valor de partitiondb +@param pPartitiondb nuevo Valor de partitiondb*/ +public void setPartitiondb(String pPartitiondb){ + partitiondb=pPartitiondb; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Timestamp getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Timestamp pRealdate){ + realdate=pRealdate; +} + +/**Implementacion de la comparacion de TgeneAccountScoreJournalKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountScoreJournalKey))return false; + TgeneAccountScoreJournalKey that = (TgeneAccountScoreJournalKey) o; + if (this.getJournalid() == null || that.getJournalid() == null){ + return false; + } + if (! this.getJournalid().equals(that.getJournalid())){ + return false; + } + if (this.getPartitiondb() == null || that.getPartitiondb() == null){ + return false; + } + if (! this.getPartitiondb().equals(that.getPartitiondb())){ + return false; + } + if (this.getRealdate() == null || that.getRealdate() == null){ + return false; + } + if (! this.getRealdate().equals(that.getRealdate())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneAccountScoreJournalKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getJournalid() == null ? 0 : this.getJournalid().hashCode()); + result = result * 37 + (this.getPartitiondb() == null ? 0 : this.getPartitiondb().hashCode()); + result = result * 37 + (this.getRealdate() == null ? 0 : this.getRealdate().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneAccountScoreKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneAccountScoreKey.java new file mode 100644 index 0000000..7f37a81 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneAccountScoreKey.java @@ -0,0 +1,152 @@ +package com.fp.persistence.pgeneral.score; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENEACCOUNTSCORE*/ +@Embeddable +public class TgeneAccountScoreKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* Codigo de compania a la que pertence la cuenta +*/ +private Integer company; + +@Column(name="SCOREDATE", nullable=false,updatable=false) + +/** +* Fecha de calificacion de la cuenta +*/ +private Date scoredate; + +/**Contructor por defecto*/ +public TgeneAccountScoreKey(){} +/**Contructor de TgeneAccountScoreKey +@param pAccount Numero de cuenta +@param pCompany Codigo de compania a la que pertence la cuenta +@param pScoredate Fecha de calificacion de la cuenta +*/ +public TgeneAccountScoreKey(String pAccount,Integer pCompany,Date pScoredate){ + account=pAccount; + company=pCompany; + scoredate=pScoredate; +} +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Obtiene el valor de scoredate +@return valor de scoredate*/ +public Date getScoredate(){ + return scoredate; +} +/**Fija el valor de scoredate +@param pScoredate nuevo Valor de scoredate*/ +public void setScoredate(Date pScoredate){ + scoredate=pScoredate; +} + +/**Implementacion de la comparacion de TgeneAccountScoreKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneAccountScoreKey))return false; + TgeneAccountScoreKey that = (TgeneAccountScoreKey) o; + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + if (this.getScoredate() == null || that.getScoredate() == null){ + return false; + } + if (! this.getScoredate().equals(that.getScoredate())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneAccountScoreKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + result = result * 37 + (this.getScoredate() == null ? 0 : this.getScoredate().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgenePercentScore.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgenePercentScore.java new file mode 100644 index 0000000..92f42e8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgenePercentScore.java @@ -0,0 +1,269 @@ +package com.fp.persistence.pgeneral.score; + +import java.sql.Timestamp; +import java.util.List; +import java.io.Serializable; +import javax.persistence.Table; +import java.math.BigDecimal; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; + +import javax.persistence.Query; +import javax.persistence.Version; +import javax.persistence.Entity; +import javax.persistence.EmbeddedId; +import com.fp.dto.hb.Cache; + +import javax.persistence.EntityManager; +import javax.persistence.Column; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENEPERCENTSCORE + */ +@Entity(name = "TgenePercentScore") +@Table(name = "TGENEPERCENTSCORE") +public class TgenePercentScore extends com.fp.dto.AbstractDataTransport + implements Serializable, HibernateBean, Cloneable, Cache { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgenePercentScore + */ + @EmbeddedId + private TgenePercentScoreKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el porcentaje de calificacion + */ + private Timestamp datefrom; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistick locking del registro. + */ + private Integer recordversion; + + @Column(name = "PERCENT", nullable = true) + /** + * Porcentaje de provision de la calificacion tipo de credito + */ + private BigDecimal percent; + + /** Contructor por defecto */ + public TgenePercentScore() { + } + + /** + * Contructor de TgenePercentScore + * + * @param pPk + * Clave Primaria del entity + */ + public TgenePercentScore(TgenePercentScoreKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager + * referencia de la session a obtener datos del bean. + * @param pKey + * Caleve primaria del bean. + * @return TgenePercentScore + */ + public static TgenePercentScore find(EntityManager pEntityManager, + TgenePercentScoreKey pKey) throws Exception { + TgenePercentScore obj = pEntityManager.find(TgenePercentScore.class, + pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgenePercentScore + * + * @return El objeto que referencia a la Clave primaria de TgenePercentScore + */ + public TgenePercentScoreKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgenePercentScore + * + * @param pPk + * El objeto que referencia a la nueva Clave primaria de + * TgenePercentScore + */ + public void setPk(TgenePercentScoreKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom + * nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion + * nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de percent + * + * @return valor de percent + */ + public BigDecimal getPercent() { + return percent; + } + + /** + * Fija el valor de percent + * + * @param pPercent + * nuevo Valor de percent + */ + public void setPercent(BigDecimal pPercent) { + percent = pPercent; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgenePercentScore)) + return false; + TgenePercentScore that = (TgenePercentScore) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgenePercentScore + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 + || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgenePercentScore */ + public Object createInstance() { + TgenePercentScore instance = new TgenePercentScore(); + instance.setPk(new TgenePercentScoreKey()); + return instance; + } + + /** + * Clona la entidad TgenePercentScore + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgenePercentScore p = (TgenePercentScore) this.clone(); + p.setPk((TgenePercentScoreKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + + + /** + * + * METODOS MANUALES + * + */ + + private static final String JPQL_SCORE_PERCENT = "" + + " from TgenePercentScore tsol " + + " where tsol.pk.dateto = :dateto " + + " and tsol.pk.credittypecode = :credittype " + + " and tsol.percent <= :percent "; + + public static List findbyScorePercent(EntityManager pEntityManager, String credittype, Number percent) throws Exception{ + //javax.persistence.Query qry = pEntityManager.createQuery(JPQL_SCORE_PERCENT); + Query qry = pEntityManager.createQuery(JPQL_SCORE_PERCENT); + qry.setParameter("credittype", credittype); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + qry.setParameter("percent", percent); + + return qry.getResultList(); + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgenePercentScoreKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgenePercentScoreKey.java new file mode 100644 index 0000000..7915039 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgenePercentScoreKey.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pgeneral.score; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEPERCENTSCORE*/ +@Embeddable +public class TgenePercentScoreKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SCORECODE", nullable=false,updatable=false) + +/** +* Codigo de calificacion con el cual se realiza el calculo de provisiones +*/ +private String scorecode; + +@Column(name="CREDITTYPECODE", nullable=false,updatable=false) + +/** +* Codigo de tipo de credito +*/ +private String credittypecode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el porcentaje de provision de acuerdo a la calificacion +*/ +private Timestamp dateto; + +/**Contructor por defecto*/ +public TgenePercentScoreKey(){} +/**Contructor de TgenePercentScoreKey +@param pScorecode Codigo de calificacion con el cual se realiza el calculo de provisiones +@param pCredittypecode Codigo de tipo de credito +@param pDateto Fecha hasta la cual esta vigente el porcentaje de provision de acuerdo a la calificacion +*/ +public TgenePercentScoreKey(String pScorecode,String pCredittypecode,Timestamp pDateto){ + scorecode=pScorecode; + credittypecode=pCredittypecode; + dateto=pDateto; +} +/**Obtiene el valor de scorecode +@return valor de scorecode*/ +public String getScorecode(){ + return scorecode; +} +/**Fija el valor de scorecode +@param pScorecode nuevo Valor de scorecode*/ +public void setScorecode(String pScorecode){ + scorecode=pScorecode; +} + +/**Obtiene el valor de credittypecode +@return valor de credittypecode*/ +public String getCredittypecode(){ + return credittypecode; +} +/**Fija el valor de credittypecode +@param pCredittypecode nuevo Valor de credittypecode*/ +public void setCredittypecode(String pCredittypecode){ + credittypecode=pCredittypecode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Implementacin de la comparacin de TgenePercentScoreKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgenePercentScoreKey))return false; + TgenePercentScoreKey that = (TgenePercentScoreKey) o; + if (this.getScorecode() == null || that.getScorecode() == null){ + return false; + } + if (! this.getScorecode().equals(that.getScorecode())){ + return false; + } + if (this.getCredittypecode() == null || that.getCredittypecode() == null){ + return false; + } + if (! this.getCredittypecode().equals(that.getCredittypecode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgenePercentScoreKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getScorecode() == null ? 0 : this.getScorecode().hashCode()); + result = result * 37 + (this.getCredittypecode() == null ? 0 : this.getCredittypecode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScore.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScore.java new file mode 100644 index 0000000..2d1d379 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScore.java @@ -0,0 +1,156 @@ +package com.fp.persistence.pgeneral.score; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESCORE*/ +@Entity(name="TgeneScore") +@Table(name="TGENESCORE") +public class TgeneScore extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneScore +*/ +@Id +@Column(name="SCORECODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="REALSCORE", nullable=true) + +/** +* Codigo de calificacion real a presentar a los organismos de control. +*/ +private String realscore; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion asociada al codigo de calificacion. +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneScore(){ +} +/**Contructor de TgeneScore +@param pPk Clave Primaria del entity +*/ +public TgeneScore(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneScore +*/ +public static TgeneScore find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneScore obj = pEntityManager.find(TgeneScore.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneScore +@return El objeto que referencia a la Clave primaria de TgeneScore +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneScore +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneScore +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de realscore +@return valor de realscore*/ +public String getRealscore(){ + return realscore; +} +/**Fija el valor de realscore +@param pRealscore nuevo Valor de realscore*/ +public void setRealscore(String pRealscore){ + realscore=pRealscore; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneScore))return false; + TgeneScore that = (TgeneScore) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneScore +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneScore +*/ +public Object createInstance(){ + TgeneScore instance=new TgeneScore(); + return instance; +} +/**Clona la entidad TgeneScore +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneScore p=(TgeneScore)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreAdjustment.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreAdjustment.java new file mode 100644 index 0000000..a0f3f68 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreAdjustment.java @@ -0,0 +1,524 @@ +package com.fp.persistence.pgeneral.score; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.sql.Date; +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESCOREADJUSTMENT */ +@Entity(name = "TgeneScoreAdjustment") +@Table(name = "TGENESCOREADJUSTMENT") +public class TgeneScoreAdjustment extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneScoreAdjustment + */ + @EmbeddedId + private TgeneScoreAdjustmentKey pk; + + @Column(name = "DATEFROM", nullable = false) + /** + * Fecha desde la cual esta vigente el registro con datos de la cuenta. + */ + private Timestamp datefrom; + + @Column(name = "MODULECODE", nullable = true) + /** + * Codigo de modulo + */ + private String modulecode; + + @Column(name = "PRODUCTCODE", nullable = true) + /** + * Codigo de producto + */ + private String productcode; + + @Column(name = "SUBPRODUCTCODE", nullable = true) + /** + * Codigo de subproducto + */ + private String subproductcode; + + @Column(name = "CURRENCYCODE", nullable = true) + /** + * Codigo de moneda + */ + private String currencycode; + + @Column(name = "ADJUSTMENTTYPE", nullable = false) + /** + * null + */ + private String adjustmenttype; + + @Column(name = "MANUALPROVISIONPERCENT", nullable = false) + /** + * Porcentaje de provision constituido. + */ + private BigDecimal manualprovisionpercent; + + @Column(name = "JOURNALID", nullable = false) + /** + * Numero de movimiento + */ + private String journalid; + + @Column(name = "FILENAME", nullable = true) + /** + * Nombre de archivo + */ + private String filename; + + @Column(name = "STATUS", nullable = true) + /** + * Estado del registro + */ + private String status; + + /** Contructor por defecto */ + public TgeneScoreAdjustment() { + } + + /** + * Contructor de TgeneScoreAdjustment + * + * @param pPk Clave Primaria del entity + * @param pDatefrom Fecha desde la cual esta vigente el registro con datos de la cuenta. + * @param pAdjustmenttype null + * @param pManualprovisionpercent Porcentaje de provision constituido. + * @param pJournalid Numero de movimiento + */ + public TgeneScoreAdjustment(TgeneScoreAdjustmentKey pPk, Timestamp pDatefrom, String pAdjustmenttype, BigDecimal pManualprovisionpercent, + String pJournalid) { + this(); + this.pk = pPk; + this.datefrom = pDatefrom; + this.adjustmenttype = pAdjustmenttype; + this.manualprovisionpercent = pManualprovisionpercent; + this.journalid = pJournalid; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneScoreAdjustment + */ + public static TgeneScoreAdjustment find(EntityManager pEntityManager, TgeneScoreAdjustmentKey pKey) throws Exception { + TgeneScoreAdjustment obj = pEntityManager.find(TgeneScoreAdjustment.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneScoreAdjustment + * + * @return El objeto que referencia a la Clave primaria de TgeneScoreAdjustment + */ + public TgeneScoreAdjustmentKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneScoreAdjustment + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneScoreAdjustment + */ + public void setPk(TgeneScoreAdjustmentKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return this.datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + this.datefrom = pDatefrom; + } + + /** + * Obtiene el valor de modulecode + * + * @return valor de modulecode + */ + public String getModulecode() { + return this.modulecode; + } + + /** + * Fija el valor de modulecode + * + * @param pModulecode nuevo Valor de modulecode + */ + public void setModulecode(String pModulecode) { + this.modulecode = pModulecode; + } + + /** + * Obtiene el valor de productcode + * + * @return valor de productcode + */ + public String getProductcode() { + return this.productcode; + } + + /** + * Fija el valor de productcode + * + * @param pProductcode nuevo Valor de productcode + */ + public void setProductcode(String pProductcode) { + this.productcode = pProductcode; + } + + /** + * Obtiene el valor de subproductcode + * + * @return valor de subproductcode + */ + public String getSubproductcode() { + return this.subproductcode; + } + + /** + * Fija el valor de subproductcode + * + * @param pSubproductcode nuevo Valor de subproductcode + */ + public void setSubproductcode(String pSubproductcode) { + this.subproductcode = pSubproductcode; + } + + /** + * Obtiene el valor de currencycode + * + * @return valor de currencycode + */ + public String getCurrencycode() { + return this.currencycode; + } + + /** + * Fija el valor de currencycode + * + * @param pCurrencycode nuevo Valor de currencycode + */ + public void setCurrencycode(String pCurrencycode) { + this.currencycode = pCurrencycode; + } + + /** + * Obtiene el valor de adjustmenttype + * + * @return valor de adjustmenttype + */ + public String getAdjustmenttype() { + return this.adjustmenttype; + } + + /** + * Fija el valor de adjustmenttype + * + * @param pAdjustmenttype nuevo Valor de adjustmenttype + */ + public void setAdjustmenttype(String pAdjustmenttype) { + this.adjustmenttype = pAdjustmenttype; + } + + /** + * Obtiene el valor de manualprovisionpercent + * + * @return valor de manualprovisionpercent + */ + public BigDecimal getManualprovisionpercent() { + return this.manualprovisionpercent; + } + + /** + * Fija el valor de manualprovisionpercent + * + * @param pManualprovisionpercent nuevo Valor de manualprovisionpercent + */ + public void setManualprovisionpercent(BigDecimal pManualprovisionpercent) { + this.manualprovisionpercent = pManualprovisionpercent; + } + + /** + * Obtiene el valor de journalid + * + * @return valor de journalid + */ + public String getJournalid() { + return this.journalid; + } + + /** + * Fija el valor de journalid + * + * @param pJournalid nuevo Valor de journalid + */ + public void setJournalid(String pJournalid) { + this.journalid = pJournalid; + } + + /** + * Obtiene el valor de filename + * + * @return valor de filename + */ + public String getFilename() { + return this.filename; + } + + /** + * Fija el valor de filename + * + * @param pFilename nuevo Valor de filename + */ + public void setFilename(String pFilename) { + this.filename = pFilename; + } + + /** + * Obtiene el valor de status + * + * @return valor de status + */ + public String getStatus() { + return this.status; + } + + /** + * Fija el valor de status + * + * @param pStatus nuevo Valor de status + */ + public void setStatus(String pStatus) { + this.status = pStatus; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneScoreAdjustment)) { + return false; + } + TgeneScoreAdjustment that = (TgeneScoreAdjustment) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneScoreAdjustment + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneScoreAdjustment */ + @Override + public Object createInstance() { + TgeneScoreAdjustment instance = new TgeneScoreAdjustment(); + instance.setPk(new TgeneScoreAdjustmentKey()); + return instance; + } + + /** + * Clona la entidad TgeneScoreAdjustment + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneScoreAdjustment p = (TgeneScoreAdjustment) this.clone(); + p.setPk((TgeneScoreAdjustmentKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + + /** + * + * METODOS MANUALES + * + */ + + /** + * Sentencia para buscar los registros asociados a un scoredate + */ + private static final String JPQL_ACCOUNT_SCOREDATE = "from TgeneScoreAdjustment tsol " + + " where tsol.pk.dateto = :dateto " + + " and tsol.pk.companycode = :companycode " + + " and tsol.pk.scoredate in (select sh.pk.scoredate from TgeneScoreHeader sh " + + " where sh.pk.companycode = :companycode " + + " and sh.tabulated = :tabulated " + + " and sh.pk.scoredate = :scoredate) "; + + public static List findbyScoreDate(EntityManager pEntityManager, Integer company, String tabulated, Date scoredate) + throws Exception { + Query qry = pEntityManager.createQuery(TgeneScoreAdjustment.JPQL_ACCOUNT_SCOREDATE); + qry.setParameter("companycode", company); + qry.setParameter("dateto", Constant.getDefaultExpiryDate()); + qry.setParameter("tabulated", tabulated); + qry.setParameter("scoredate", scoredate); + return qry.getResultList(); + } + + /* Calificacin por archivo */ + + /** + * Sentencia para buscar los registros que tienen el nombre de archivo dado + */ + private static final String JPQL_FILE = "select distinct t.filename " + " from TgeneScoreAdjustment t " + " where t.pk.companycode = :company" + + " and t.filename = :filename"; + + /** + * Mtodo que selecciona los registros que tienen el nombre de archivo dado + * + * @param pEntityManager Referencia de la session a obtener datos del bean + * @param pCompany Cdigo de la compaia + * @param pFilename Nombre del archivo + * @return Nombre del archivo si existe, de lo contrario null + * @throws Exception + */ + public static String find(EntityManager pEntityManager, Integer pCompany, String pFilename) throws Exception { + try { + Query qry = pEntityManager.createQuery(TgeneScoreAdjustment.JPQL_FILE); + qry.setParameter("company", pCompany); + qry.setParameter("filename", pFilename); + + return (String) qry.getSingleResult(); + } catch (NoResultException e) { + return null; + } + } + + /** + * Sentencia para buscar los registros asociados a una entidad financiera dada que no hayan sido procesados + */ + private static final String JPQL_BANK = "from TgeneScoreAdjustment t " + " where t.pk.companycode = :company "; + // + " and t.pk.bank = coalesce(:bank, t.pk.bank) "; + + // /** + // * Mtodo que selecciona los registros asociados a una entidad financiera dada que no hayan sido procesados + // * + // * @param pEntityManager Referencia de la session a obtener datos del bean + // * @param pCompany Nombre de la compaia + // * @param pBank Cdigo del banco + // * @return Lista de registro de TloanPaymentAccoBank + // * @throws Exception + // */ + // @SuppressWarnings("unchecked") + // public static List findByBank(EntityManager pEntityManager, Integer pCompany, String pBank) + // throws Exception { + // Query qry = pEntityManager.createQuery(JPQL_BANK); + // qry.setParameter("company", pCompany); + // qry.setParameter("bank", pBank); + // + // return qry.getResultList(); + // } + // + // /** + // * Sentencia para buscar los registros asociados a una cuenta dada que no hayan sido procesados + // */ + // private static final String JPQL_ACCOUNT = "from TgeneScoreAdjustment t " + " where t.pk.companycode = :company " + // + " and t.pk.account = :account " + " and t.status = 'N' " ; + // + // /** + // * Mtodo que selecciona los registros asociados a una cuenta dada que no hayan sido procesados + // * + // * @param pEntityManager Referencia de la session a obtener datos del bean + // * @param pCompany Nombre de la compaia + // * @param pAccount Cdigo de la cuenta + // * @return Lista de registro de TloanPaymentAccoBank + // * @throws Exception + // */ + // @SuppressWarnings("unchecked") + // public static List findByAccount(EntityManager pEntityManager, Integer pCompany, String + // pAccount) throws Exception { + // Query qry = pEntityManager.createQuery(JPQL_ACCOUNT); + // qry.setParameter("company", pCompany); + // qry.setParameter("account", pAccount); + // + // return qry.getResultList(); + // } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreAdjustmentKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreAdjustmentKey.java new file mode 100644 index 0000000..f1bb637 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreAdjustmentKey.java @@ -0,0 +1,183 @@ +package com.fp.persistence.pgeneral.score; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESCOREADJUSTMENT*/ +@Embeddable +public class TgeneScoreAdjustmentKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el registro con datos de la cuenta. +*/ +private Timestamp dateto; + +@Column(name="SCOREDATE", nullable=false,updatable=false) + +/** +* Fecha de calificacion +*/ +private Timestamp scoredate; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* Numero de cuenta +*/ +private String account; + +/**Contructor por defecto*/ +public TgeneScoreAdjustmentKey(){} +/**Contructor de TgeneScoreAdjustmentKey +@param pDateto Fecha hasta la cual esta vigente el registro con datos de la cuenta. +@param pScoredate Fecha de calificacion +@param pCompanycode Codigo de compania +@param pAccount Numero de cuenta +*/ +public TgeneScoreAdjustmentKey(Timestamp pDateto,Timestamp pScoredate,Integer pCompanycode,String pAccount){ + dateto=pDateto; + scoredate=pScoredate; + companycode=pCompanycode; + account=pAccount; +} +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de scoredate +@return valor de scoredate*/ +public Timestamp getScoredate(){ + return scoredate; +} +/**Fija el valor de scoredate +@param pScoredate nuevo Valor de scoredate*/ +public void setScoredate(Timestamp pScoredate){ + scoredate=pScoredate; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Implementacion de la comparacion de TgeneScoreAdjustmentKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneScoreAdjustmentKey))return false; + TgeneScoreAdjustmentKey that = (TgeneScoreAdjustmentKey) o; + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getScoredate() == null || that.getScoredate() == null){ + return false; + } + if (! this.getScoredate().equals(that.getScoredate())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneScoreAdjustmentKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getScoredate() == null ? 0 : this.getScoredate().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreFileIssues.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreFileIssues.java new file mode 100644 index 0000000..f8fbb10 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreFileIssues.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.score; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESCOREFILEISSUES*/ +@Entity(name="TgeneScoreFileIssues") +@Table(name="TGENESCOREFILEISSUES") +public class TgeneScoreFileIssues extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneScoreFileIssues +*/ +@EmbeddedId +private TgeneScoreFileIssuesKey pk; +@Column(name="LINECONTENT", nullable=false) + +/** +* Contenido de la linea con problemas +*/ +private String linecontent; + +@Column(name="USERMESSAGE", nullable=true) + +/** +* Mensaje del usuario por el cual no se subio esa linea +*/ +private String usermessage; + +@Column(name="TECHNICALMESSAGE", nullable=true) + +/** +* Mensaje tecnico de porque no se subio esa linea +*/ +private String technicalmessage; + +/**Contructor por defecto*/ +public TgeneScoreFileIssues(){ +} +/**Contructor de TgeneScoreFileIssues +@param pPk Clave Primaria del entity +@param pLinecontent Contenido de la linea con problemas +*/ +public TgeneScoreFileIssues(TgeneScoreFileIssuesKey pPk,String pLinecontent){ + this(); + pk=pPk; + linecontent=pLinecontent; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneScoreFileIssues +*/ +public static TgeneScoreFileIssues find(EntityManager pEntityManager,TgeneScoreFileIssuesKey pKey) throws Exception{ + TgeneScoreFileIssues obj = pEntityManager.find(TgeneScoreFileIssues.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneScoreFileIssues +@return El objeto que referencia a la Clave primaria de TgeneScoreFileIssues +*/ +public TgeneScoreFileIssuesKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneScoreFileIssues +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneScoreFileIssues +*/ +public void setPk(TgeneScoreFileIssuesKey pPk){ + pk=pPk; +} +/**Obtiene el valor de linecontent +@return valor de linecontent*/ +public String getLinecontent(){ + return linecontent; +} +/**Fija el valor de linecontent +@param pLinecontent nuevo Valor de linecontent*/ +public void setLinecontent(String pLinecontent){ + linecontent=pLinecontent; +} + +/**Obtiene el valor de usermessage +@return valor de usermessage*/ +public String getUsermessage(){ + return usermessage; +} +/**Fija el valor de usermessage +@param pUsermessage nuevo Valor de usermessage*/ +public void setUsermessage(String pUsermessage){ + usermessage=pUsermessage; +} + +/**Obtiene el valor de technicalmessage +@return valor de technicalmessage*/ +public String getTechnicalmessage(){ + return technicalmessage; +} +/**Fija el valor de technicalmessage +@param pTechnicalmessage nuevo Valor de technicalmessage*/ +public void setTechnicalmessage(String pTechnicalmessage){ + technicalmessage=pTechnicalmessage; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneScoreFileIssues))return false; + TgeneScoreFileIssues that = (TgeneScoreFileIssues) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneScoreFileIssues +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneScoreFileIssues +*/ +public Object createInstance(){ + TgeneScoreFileIssues instance=new TgeneScoreFileIssues(); + instance.setPk(new TgeneScoreFileIssuesKey()); + return instance; +} +/**Clona la entidad TgeneScoreFileIssues +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneScoreFileIssues p=(TgeneScoreFileIssues)this.clone(); + p.setPk((TgeneScoreFileIssuesKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreFileIssuesKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreFileIssuesKey.java new file mode 100644 index 0000000..8cc6d02 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreFileIssuesKey.java @@ -0,0 +1,206 @@ +package com.fp.persistence.pgeneral.score; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESCOREFILEISSUES*/ +@Embeddable +public class TgeneScoreFileIssuesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="LINENUMBER", nullable=false,updatable=false) + +/** +* Numero de linea con problemas +*/ +private Integer linenumber; + +@Column(name="FILENAME", nullable=false,updatable=false) + +/** +* Nombre del archivo +*/ +private String filename; + +@Column(name="UPLOADDATE", nullable=false,updatable=false) + +/** +* Fecha de carga del archivo +*/ +private Timestamp uploaddate; + +@Column(name="ACCOUNT", nullable=false,updatable=false) + +/** +* ID del banco +*/ +private String account; + +@Column(name="COMPANY", nullable=false,updatable=false) + +/** +* null +*/ +private Integer company; + +/**Contructor por defecto*/ +public TgeneScoreFileIssuesKey(){} +/**Contructor de TgeneScoreFileIssuesKey +@param pLinenumber Numero de linea con problemas +@param pFilename Nombre del archivo +@param pUploaddate Fecha de carga del archivo +@param pAccount ID del banco +@param pCompany null +*/ +public TgeneScoreFileIssuesKey(Integer pLinenumber,String pFilename,Timestamp pUploaddate,String pAccount,Integer pCompany){ + linenumber=pLinenumber; + filename=pFilename; + uploaddate=pUploaddate; + account=pAccount; + company=pCompany; +} +/**Obtiene el valor de linenumber +@return valor de linenumber*/ +public Integer getLinenumber(){ + return linenumber; +} +/**Fija el valor de linenumber +@param pLinenumber nuevo Valor de linenumber*/ +public void setLinenumber(Integer pLinenumber){ + linenumber=pLinenumber; +} + +/**Obtiene el valor de filename +@return valor de filename*/ +public String getFilename(){ + return filename; +} +/**Fija el valor de filename +@param pFilename nuevo Valor de filename*/ +public void setFilename(String pFilename){ + filename=pFilename; +} + +/**Obtiene el valor de uploaddate +@return valor de uploaddate*/ +public Timestamp getUploaddate(){ + return uploaddate; +} +/**Fija el valor de uploaddate +@param pUploaddate nuevo Valor de uploaddate*/ +public void setUploaddate(Timestamp pUploaddate){ + uploaddate=pUploaddate; +} + +/**Obtiene el valor de account +@return valor de account*/ +public String getAccount(){ + return account; +} +/**Fija el valor de account +@param pAccount nuevo Valor de account*/ +public void setAccount(String pAccount){ + account=pAccount; +} + +/**Obtiene el valor de company +@return valor de company*/ +public Integer getCompany(){ + return company; +} +/**Fija el valor de company +@param pCompany nuevo Valor de company*/ +public void setCompany(Integer pCompany){ + company=pCompany; +} + +/**Implementacion de la comparacion de TgeneScoreFileIssuesKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneScoreFileIssuesKey))return false; + TgeneScoreFileIssuesKey that = (TgeneScoreFileIssuesKey) o; + if (this.getLinenumber() == null || that.getLinenumber() == null){ + return false; + } + if (! this.getLinenumber().equals(that.getLinenumber())){ + return false; + } + if (this.getFilename() == null || that.getFilename() == null){ + return false; + } + if (! this.getFilename().equals(that.getFilename())){ + return false; + } + if (this.getUploaddate() == null || that.getUploaddate() == null){ + return false; + } + if (! this.getUploaddate().equals(that.getUploaddate())){ + return false; + } + if (this.getAccount() == null || that.getAccount() == null){ + return false; + } + if (! this.getAccount().equals(that.getAccount())){ + return false; + } + if (this.getCompany() == null || that.getCompany() == null){ + return false; + } + if (! this.getCompany().equals(that.getCompany())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneScoreFileIssuesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getLinenumber() == null ? 0 : this.getLinenumber().hashCode()); + result = result * 37 + (this.getFilename() == null ? 0 : this.getFilename().hashCode()); + result = result * 37 + (this.getUploaddate() == null ? 0 : this.getUploaddate().hashCode()); + result = result * 37 + (this.getAccount() == null ? 0 : this.getAccount().hashCode()); + result = result * 37 + (this.getCompany() == null ? 0 : this.getCompany().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreHeader.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreHeader.java new file mode 100644 index 0000000..8537b44 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreHeader.java @@ -0,0 +1,227 @@ +package com.fp.persistence.pgeneral.score; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESCOREHEADER */ +@Entity(name = "TgeneScoreHeader") +@Table(name = "TGENESCOREHEADER") +public class TgeneScoreHeader extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneScoreHeader + */ + @EmbeddedId + private TgeneScoreHeaderKey pk; + + @Column(name = "FILECODE", nullable = true) + /** + * Codigo de imagen + */ + private Integer filecode; + + @Column(name = "TABULATED", nullable = true) + /** + * Y Indica que la calificacion esta contabilizada y enviada a la super + */ + private String tabulated; + + /** Contructor por defecto */ + public TgeneScoreHeader() { + } + + /** + * Contructor de TgeneScoreHeader + * + * @param pPk Clave Primaria del entity + */ + public TgeneScoreHeader(TgeneScoreHeaderKey pPk) { + this(); + this.pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneScoreHeader + */ + public static TgeneScoreHeader find(EntityManager pEntityManager, TgeneScoreHeaderKey pKey) throws Exception { + TgeneScoreHeader obj = pEntityManager.find(TgeneScoreHeader.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneScoreHeader + * + * @return El objeto que referencia a la Clave primaria de TgeneScoreHeader + */ + public TgeneScoreHeaderKey getPk() { + return this.pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneScoreHeader + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneScoreHeader + */ + public void setPk(TgeneScoreHeaderKey pPk) { + this.pk = pPk; + } + + /** + * Obtiene el valor de filecode + * + * @return valor de filecode + */ + public Integer getFilecode() { + return this.filecode; + } + + /** + * Fija el valor de filecode + * + * @param pFilecode nuevo Valor de filecode + */ + public void setFilecode(Integer pFilecode) { + this.filecode = pFilecode; + } + + /** + * Obtiene el valor de tabulated + * + * @return valor de tabulated + */ + public String getTabulated() { + return this.tabulated; + } + + /** + * Fija el valor de tabulated + * + * @param pTabulated nuevo Valor de tabulated + */ + public void setTabulated(String pTabulated) { + this.tabulated = pTabulated; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneScoreHeader)) { + return false; + } + TgeneScoreHeader that = (TgeneScoreHeader) rhs; + if ((this.getPk() == null) || (that.getPk() == null)) { + return false; + } + return this.getPk().equals(that.getPk()); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneScoreHeader + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if ((name.compareTo("hashValue") == 0) || (name.compareTo("serialVersionUID") == 0)) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneScoreHeader */ + @Override + public Object createInstance() { + TgeneScoreHeader instance = new TgeneScoreHeader(); + instance.setPk(new TgeneScoreHeaderKey()); + return instance; + } + + /** + * Clona la entidad TgeneScoreHeader + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneScoreHeader p = (TgeneScoreHeader) this.clone(); + p.setPk((TgeneScoreHeaderKey) this.pk.cloneMe()); + return p; + } + + /* METODOS MANUALES */ + + private static final String JPQL_BY_COMPANY = "from TgeneScoreHeader tga " + "where tga.pk.companycode = :companycode"; + + /** + * Permite consultar si existe un periodo de calificacion abierto + * + * @param companycode Codigo de empresa + * @return lista de objetos de tipo + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List findByCompany(EntityManager entityManager, Integer companycode) throws Exception { + Query qry = entityManager.createQuery(TgeneScoreHeader.JPQL_BY_COMPANY); + qry.setParameter("companycode", companycode); + return qry.getResultList(); + } + +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreHeaderKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreHeaderKey.java new file mode 100644 index 0000000..b1ca320 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreHeaderKey.java @@ -0,0 +1,125 @@ +package com.fp.persistence.pgeneral.score; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que hace referencia a la Clave Primaria de TGENESCOREHEADER*/ +@Embeddable +public class TgeneScoreHeaderKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SCOREDATE", nullable=false,updatable=false) + +/** +* Fecha de calificacion +*/ +private Date scoredate; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania +*/ +private Integer companycode; + +/**Contructor por defecto*/ +public TgeneScoreHeaderKey(){} +/**Contructor de TgeneScoreHeaderKey +@param pScoredate Fecha de calificacion +@param pCompanycode Codigo de compania +*/ +public TgeneScoreHeaderKey(Date pScoredate,Integer pCompanycode){ + scoredate=pScoredate; + companycode=pCompanycode; +} +/**Obtiene el valor de scoredate +@return valor de scoredate*/ +public Date getScoredate(){ + return scoredate; +} +/**Fija el valor de scoredate +@param pScoredate nuevo Valor de scoredate*/ +public void setScoredate(Date pScoredate){ + scoredate=pScoredate; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Implementacion de la comparacion de TgeneScoreHeaderKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneScoreHeaderKey))return false; + TgeneScoreHeaderKey that = (TgeneScoreHeaderKey) o; + if (this.getScoredate() == null || that.getScoredate() == null){ + return false; + } + if (! this.getScoredate().equals(that.getScoredate())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneScoreHeaderKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getScoredate() == null ? 0 : this.getScoredate().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreRank.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreRank.java new file mode 100644 index 0000000..2b31dba --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreRank.java @@ -0,0 +1,323 @@ +package com.fp.persistence.pgeneral.score; + +import com.fp.common.helper.Constant; +import com.fp.dto.hb.Cache; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Query; + +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla + * TGENESCORERANK + */ +@Entity(name = "TgeneScoreRank") +@Table(name = "TGENESCORERANK") +public class TgeneScoreRank extends com.fp.dto.AbstractDataTransport implements + Serializable, HibernateBean, Cloneable, Cache { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneScoreRank + */ + @EmbeddedId + private TgeneScoreRankKey pk; + @Column(name = "DATEFROM", nullable = true) + /** + * Fecha desde la cual esta vigente el porcentaje de calificacion + */ + private Timestamp datefrom; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistick locking del registro. + */ + private Integer recordversion; + + @Column(name = "DAYSFROM", nullable = true) + /** + * Dias minimos para definir la calificacion del prestamo + */ + private Integer daysfrom; + + @Column(name = "DAYSTO", nullable = true) + /** + * Dias maximos para definir la calificacion del prestamo + */ + private Integer daysto; + + /** Contructor por defecto */ + public TgeneScoreRank() { + } + + /** + * Contructor de TgeneScoreRank + * + * @param pPk + * Clave Primaria del entity + */ + public TgeneScoreRank(TgeneScoreRankKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager + * referencia de la session a obtener datos del bean. + * @param pKey + * Caleve primaria del bean. + * @return TgeneScoreRank + */ + public static TgeneScoreRank find(EntityManager pEntityManager, + TgeneScoreRankKey pKey) throws Exception { + TgeneScoreRank obj = pEntityManager.find(TgeneScoreRank.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneScoreRank + * + * @return El objeto que referencia a la Clave primaria de TgeneScoreRank + */ + public TgeneScoreRankKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneScoreRank + * + * @param pPk + * El objeto que referencia a la nueva Clave primaria de + * TgeneScoreRank + */ + public void setPk(TgeneScoreRankKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de datefrom + * + * @return valor de datefrom + */ + public Timestamp getDatefrom() { + return datefrom; + } + + /** + * Fija el valor de datefrom + * + * @param pDatefrom + * nuevo Valor de datefrom + */ + public void setDatefrom(Timestamp pDatefrom) { + datefrom = pDatefrom; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion + * nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de daysfrom + * + * @return valor de daysfrom + */ + public Integer getDaysfrom() { + return daysfrom; + } + + /** + * Fija el valor de daysfrom + * + * @param pDaysfrom + * nuevo Valor de daysfrom + */ + public void setDaysfrom(Integer pDaysfrom) { + daysfrom = pDaysfrom; + } + + /** + * Obtiene el valor de daysto + * + * @return valor de daysto + */ + public Integer getDaysto() { + return daysto; + } + + /** + * Fija el valor de daysto + * + * @param pDaysto + * nuevo Valor de daysto + */ + public void setDaysto(Integer pDaysto) { + daysto = pDaysto; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneScoreRank)) + return false; + TgeneScoreRank that = (TgeneScoreRank) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneScoreRank + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 + || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneScoreRank */ + public Object createInstance() { + TgeneScoreRank instance = new TgeneScoreRank(); + instance.setPk(new TgeneScoreRankKey()); + return instance; + } + + /** + * Clona la entidad TgeneScoreRank + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneScoreRank p = (TgeneScoreRank) this.clone(); + p.setPk((TgeneScoreRankKey) this.pk.cloneMe()); + return p; + } + + public Object getId() { + return this.pk; + } + + //Metodos manuales. + /**Sentencia que entrega la definicion de rangos de calificacion de cartera.*/ + private static final String JPQL = "from TgeneScoreRank t "+ + " where t.pk.credittypecode = :credittypecode " + + " and t.pk.operationstatus = :operationstatus"+ + " and t.pk.modulecode = :modulecode "+ + " and t.pk.dateto = :dateto "; + + /** + * Metodo que entrega una lista de calificacion de cartera dado el tipo de credito, estado de la operacion y modulo. + * @param pEntityManager Referencia a una session de base de datos. + * @param pCreditType Codigo de tipo de credito, CON consumo, COM comercial, etc + * @param pOperationStatus Estado de la operacion Orginal, Restructurada + * @param pModuleCode Modulo asociado al estado de la operacion. + * @return List + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static List find(EntityManager pEntityManager,String pCreditType,String pOperationStatus,String pModuleCode) throws Exception { + List ldata = null; + Query qry = pEntityManager.createQuery(JPQL); + qry.setParameter("credittypecode", pCreditType); + qry.setParameter("operationstatus", pOperationStatus); + qry.setParameter("modulecode", pModuleCode); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + ldata = qry.getResultList(); + return ldata; + } + + /**Sentencia que entrega la definicion de rangos de calificacion de cartera.*/ + private static final String JPQL_FIRST_SCORE = "from TgeneScoreRank t "+ + " where t.pk.credittypecode = :credittypecode " + + " and t.pk.operationstatus = :operationstatus"+ + " and t.pk.modulecode = :modulecode "+ + " and t.pk.dateto = :dateto " + + " and 0 between t.daysfrom and t.daysto "; + + /** + * Metodo que entrega una lista de calificacion de cartera dado el tipo de credito y modulo. + * @param pEntityManager Referencia a una session de base de datos. + * @param pCreditType Codigo de tipo de credito, CON consumo, COM comercial, etc + * @param pModuleCode Modulo asociado al estado de la operacion. + * @return List + * @throws Exception + */ + public static TgeneScoreRank find(EntityManager pEntityManager,String pCreditType,String pModuleCode) throws Exception { + TgeneScoreRank obj = null; + Query qry = pEntityManager.createQuery(JPQL_FIRST_SCORE); + qry.setParameter("credittypecode", pCreditType); + qry.setParameter("operationstatus", "ORI"); + qry.setParameter("modulecode", pModuleCode); + qry.setParameter("dateto", Constant.getDefaultExpiryTimestamp()); + obj = (TgeneScoreRank)qry.getSingleResult(); + return obj; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreRankKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreRankKey.java new file mode 100644 index 0000000..1edff66 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/score/TgeneScoreRankKey.java @@ -0,0 +1,210 @@ +package com.fp.persistence.pgeneral.score; + +import java.sql.Timestamp; +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import com.fp.dto.hb.History; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENESCORERANK*/ +@Embeddable +public class TgeneScoreRankKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId,History{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="SCORECODE", nullable=false,updatable=false) + +/** +* Codigo de calificacion con el cual se realiza el calculo de provisiones +*/ +private String scorecode; + +@Column(name="CREDITTYPECODE", nullable=false,updatable=false) + +/** +* Codigo de tipo de credito +*/ +private String credittypecode; + +@Column(name="DATETO", nullable=false,updatable=false) + +/** +* Fecha hasta la cual esta vigente el porcentaje de provision de acuerdo a la calificacion +*/ +private Timestamp dateto; + +@Column(name="OPERATIONSTATUS", nullable=false,updatable=false) + +/** +* Codigo de estatus de la operacion, ORI (Original), REF (refinanciada), RES (restructurada) +*/ +private String operationstatus; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +/**Contructor por defecto*/ +public TgeneScoreRankKey(){} +/**Contructor de TgeneScoreRankKey +@param pScorecode Codigo de calificacion con el cual se realiza el calculo de provisiones +@param pCredittypecode Codigo de tipo de credito +@param pDateto Fecha hasta la cual esta vigente el porcentaje de provision de acuerdo a la calificacion +@param pOperationstatus Codigo de estatus de la operacion, ORI (Original), REF (refinanciada), RES (restructurada) +@param pModulecode Codigo de modulo +*/ +public TgeneScoreRankKey(String pScorecode,String pCredittypecode,Timestamp pDateto,String pOperationstatus,String pModulecode){ + scorecode=pScorecode; + credittypecode=pCredittypecode; + dateto=pDateto; + operationstatus=pOperationstatus; + modulecode=pModulecode; +} +/**Obtiene el valor de scorecode +@return valor de scorecode*/ +public String getScorecode(){ + return scorecode; +} +/**Fija el valor de scorecode +@param pScorecode nuevo Valor de scorecode*/ +public void setScorecode(String pScorecode){ + scorecode=pScorecode; +} + +/**Obtiene el valor de credittypecode +@return valor de credittypecode*/ +public String getCredittypecode(){ + return credittypecode; +} +/**Fija el valor de credittypecode +@param pCredittypecode nuevo Valor de credittypecode*/ +public void setCredittypecode(String pCredittypecode){ + credittypecode=pCredittypecode; +} + +/**Obtiene el valor de dateto +@return valor de dateto*/ +public Timestamp getDateto(){ + return dateto; +} +/**Fija el valor de dateto +@param pDateto nuevo Valor de dateto*/ +public void setDateto(Timestamp pDateto){ + dateto=pDateto; +} + +/**Obtiene el valor de operationstatus +@return valor de operationstatus*/ +public String getOperationstatus(){ + return operationstatus; +} +/**Fija el valor de operationstatus +@param pOperationstatus nuevo Valor de operationstatus*/ +public void setOperationstatus(String pOperationstatus){ + operationstatus=pOperationstatus; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Implementacin de la comparacin de TgeneScoreRankKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneScoreRankKey))return false; + TgeneScoreRankKey that = (TgeneScoreRankKey) o; + if (this.getScorecode() == null || that.getScorecode() == null){ + return false; + } + if (! this.getScorecode().equals(that.getScorecode())){ + return false; + } + if (this.getCredittypecode() == null || that.getCredittypecode() == null){ + return false; + } + if (! this.getCredittypecode().equals(that.getCredittypecode())){ + return false; + } + if (this.getDateto() == null || that.getDateto() == null){ + return false; + } + if (! this.getDateto().equals(that.getDateto())){ + return false; + } + if (this.getOperationstatus() == null || that.getOperationstatus() == null){ + return false; + } + if (! this.getOperationstatus().equals(that.getOperationstatus())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneScoreRankKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getScorecode() == null ? 0 : this.getScorecode().hashCode()); + result = result * 37 + (this.getCredittypecode() == null ? 0 : this.getCredittypecode().hashCode()); + result = result * 37 + (this.getDateto() == null ? 0 : this.getDateto().hashCode()); + result = result * 37 + (this.getOperationstatus() == null ? 0 : this.getOperationstatus().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +public Object getId() { + return null; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/seq/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/seq/.svn/entries new file mode 100644 index 0000000..ff8b035 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/seq/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/seq +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneSequences.java +file + + + + +2022-07-28T03:40:29.551746Z +d038accd7d3d38c123231decdfdc68ac +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6690 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/seq/.svn/text-base/TgeneSequences.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/seq/.svn/text-base/TgeneSequences.java.svn-base new file mode 100644 index 0000000..7e3462c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/seq/.svn/text-base/TgeneSequences.java.svn-base @@ -0,0 +1,241 @@ +package com.fp.persistence.pgeneral.seq; + +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.Column; + +import javax.persistence.LockModeType; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.general.exception.GeneralException; + +import java.lang.reflect.Field; +import javax.persistence.Transient; + + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESEQUENCES*/ +@Entity(name="TgeneSequences") +@Table(name="TGENESEQUENCES") +public class TgeneSequences extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSequences +*/ +@Id +@Column(name="CODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="CURRENTVALUE", nullable=false) + +/** +* Valor actual de la secuencia +*/ +private Long currentvalue; + +@Column(name="INITIALVALUE", nullable=false) + +/** +* Valor inicial de la secuenta +*/ +private Long initialvalue; + +@Column(name="LASTVALUE", nullable=false) + +/** +* Vvalor maximo de la secuencia +*/ +private Long lastvalue; + +@Column(name="CYCLIC", nullable=true) + +/** +* Y indica que la secuencia es ciclica, cuando llega al valor maximo, toma el valor inicial +*/ +private String cyclic; + +@Column(name="INCREASE", nullable=false) + +/** +* Valor de incremento de la secuencia. +*/ +private Integer increase; + +/**Contructor por defecto*/ +public TgeneSequences(){ +} +/**Contructor de TgeneSequences +@param pPk Clave Primaria del entity +@param pCurrentvalue Valor actual de la secuencia +@param pInitialvalue Valor inicial de la secuenta +@param pLastvalue Vvalor maximo de la secuencia +@param pIncrease Valor de incremento de la secuencia. +*/ +public TgeneSequences(String pPk,Long pCurrentvalue,Long pInitialvalue,Long pLastvalue,Integer pIncrease){ + this(); + pk=pPk; + currentvalue=pCurrentvalue; + initialvalue=pInitialvalue; + lastvalue=pLastvalue; + increase=pIncrease; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSequences +*/ +public static TgeneSequences find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneSequences obj = pEntityManager.find(TgeneSequences.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSequences +@return El objeto que referencia a la Clave primaria de TgeneSequences +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSequences +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSequences +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de currentvalue +@return valor de currentvalue*/ +public Long getCurrentvalue(){ + return currentvalue; +} +/**Fija el valor de currentvalue +@param pCurrentvalue nuevo Valor de currentvalue*/ +public void setCurrentvalue(Long pCurrentvalue){ + currentvalue=pCurrentvalue; +} + +/**Obtiene el valor de initialvalue +@return valor de initialvalue*/ +public Long getInitialvalue(){ + return initialvalue; +} +/**Fija el valor de initialvalue +@param pInitialvalue nuevo Valor de initialvalue*/ +public void setInitialvalue(Long pInitialvalue){ + initialvalue=pInitialvalue; +} + +/**Obtiene el valor de lastvalue +@return valor de lastvalue*/ +public Long getLastvalue(){ + return lastvalue; +} +/**Fija el valor de lastvalue +@param pLastvalue nuevo Valor de lastvalue*/ +public void setLastvalue(Long pLastvalue){ + lastvalue=pLastvalue; +} + +/**Obtiene el valor de cyclic +@return valor de cyclic*/ +public String getCyclic(){ + return cyclic; +} +/**Fija el valor de cyclic +@param pCyclic nuevo Valor de cyclic*/ +public void setCyclic(String pCyclic){ + cyclic=pCyclic; +} + +/**Obtiene el valor de increase +@return valor de increase*/ +public Integer getIncrease(){ + return increase; +} +/**Fija el valor de increase +@param pIncrease nuevo Valor de increase*/ +public void setIncrease(Integer pIncrease){ + increase=pIncrease; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSequences))return false; + TgeneSequences that = (TgeneSequences) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSequences +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSequences +*/ +public Object createInstance(){ + TgeneSequences instance=new TgeneSequences(); + return instance; +} +/**Clona la entidad TgeneSequences +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSequences p=(TgeneSequences)this.clone(); + return p; +} + + //METODOS MANUALES + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSequences + */ + public static TgeneSequences findWithLock(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneSequences tgeneSequences = pEntityManager.find(TgeneSequences.class, pKey, LockModeType.PESSIMISTIC_READ); + if (tgeneSequences == null) { + throw new GeneralException("GENE-0006", "SEMILLA DE LA SECUENCIA NO DEFINA EN TGENESEQUENCES, CODIGO: {0}", + pKey); + } + return tgeneSequences; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/seq/TgeneSequences.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/seq/TgeneSequences.java new file mode 100644 index 0000000..7e3462c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/seq/TgeneSequences.java @@ -0,0 +1,241 @@ +package com.fp.persistence.pgeneral.seq; + +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Id; +import javax.persistence.Column; + +import javax.persistence.LockModeType; + +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import com.fp.general.exception.GeneralException; + +import java.lang.reflect.Field; +import javax.persistence.Transient; + + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENESEQUENCES*/ +@Entity(name="TgeneSequences") +@Table(name="TGENESEQUENCES") +public class TgeneSequences extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneSequences +*/ +@Id +@Column(name="CODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="CURRENTVALUE", nullable=false) + +/** +* Valor actual de la secuencia +*/ +private Long currentvalue; + +@Column(name="INITIALVALUE", nullable=false) + +/** +* Valor inicial de la secuenta +*/ +private Long initialvalue; + +@Column(name="LASTVALUE", nullable=false) + +/** +* Vvalor maximo de la secuencia +*/ +private Long lastvalue; + +@Column(name="CYCLIC", nullable=true) + +/** +* Y indica que la secuencia es ciclica, cuando llega al valor maximo, toma el valor inicial +*/ +private String cyclic; + +@Column(name="INCREASE", nullable=false) + +/** +* Valor de incremento de la secuencia. +*/ +private Integer increase; + +/**Contructor por defecto*/ +public TgeneSequences(){ +} +/**Contructor de TgeneSequences +@param pPk Clave Primaria del entity +@param pCurrentvalue Valor actual de la secuencia +@param pInitialvalue Valor inicial de la secuenta +@param pLastvalue Vvalor maximo de la secuencia +@param pIncrease Valor de incremento de la secuencia. +*/ +public TgeneSequences(String pPk,Long pCurrentvalue,Long pInitialvalue,Long pLastvalue,Integer pIncrease){ + this(); + pk=pPk; + currentvalue=pCurrentvalue; + initialvalue=pInitialvalue; + lastvalue=pLastvalue; + increase=pIncrease; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneSequences +*/ +public static TgeneSequences find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneSequences obj = pEntityManager.find(TgeneSequences.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneSequences +@return El objeto que referencia a la Clave primaria de TgeneSequences +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneSequences +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneSequences +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de currentvalue +@return valor de currentvalue*/ +public Long getCurrentvalue(){ + return currentvalue; +} +/**Fija el valor de currentvalue +@param pCurrentvalue nuevo Valor de currentvalue*/ +public void setCurrentvalue(Long pCurrentvalue){ + currentvalue=pCurrentvalue; +} + +/**Obtiene el valor de initialvalue +@return valor de initialvalue*/ +public Long getInitialvalue(){ + return initialvalue; +} +/**Fija el valor de initialvalue +@param pInitialvalue nuevo Valor de initialvalue*/ +public void setInitialvalue(Long pInitialvalue){ + initialvalue=pInitialvalue; +} + +/**Obtiene el valor de lastvalue +@return valor de lastvalue*/ +public Long getLastvalue(){ + return lastvalue; +} +/**Fija el valor de lastvalue +@param pLastvalue nuevo Valor de lastvalue*/ +public void setLastvalue(Long pLastvalue){ + lastvalue=pLastvalue; +} + +/**Obtiene el valor de cyclic +@return valor de cyclic*/ +public String getCyclic(){ + return cyclic; +} +/**Fija el valor de cyclic +@param pCyclic nuevo Valor de cyclic*/ +public void setCyclic(String pCyclic){ + cyclic=pCyclic; +} + +/**Obtiene el valor de increase +@return valor de increase*/ +public Integer getIncrease(){ + return increase; +} +/**Fija el valor de increase +@param pIncrease nuevo Valor de increase*/ +public void setIncrease(Integer pIncrease){ + increase=pIncrease; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneSequences))return false; + TgeneSequences that = (TgeneSequences) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneSequences +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneSequences +*/ +public Object createInstance(){ + TgeneSequences instance=new TgeneSequences(); + return instance; +} +/**Clona la entidad TgeneSequences +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneSequences p=(TgeneSequences)this.clone(); + return p; +} + + //METODOS MANUALES + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneSequences + */ + public static TgeneSequences findWithLock(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneSequences tgeneSequences = pEntityManager.find(TgeneSequences.class, pKey, LockModeType.PESSIMISTIC_READ); + if (tgeneSequences == null) { + throw new GeneralException("GENE-0006", "SEMILLA DE LA SECUENCIA NO DEFINA EN TGENESEQUENCES, CODIGO: {0}", + pKey); + } + return tgeneSequences; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/test/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/test/.svn/entries new file mode 100644 index 0000000..dd13c8d --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/test/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TtestValores.java +file + + + + +2022-07-28T03:40:28.980743Z +a0d9a6e46d2829e477c4febcdde92baf +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5625 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/test/.svn/text-base/TtestValores.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/test/.svn/text-base/TtestValores.java.svn-base new file mode 100644 index 0000000..d8c78d4 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/test/.svn/text-base/TtestValores.java.svn-base @@ -0,0 +1,223 @@ +package com.fp.persistence.pgeneral.test; + +import java.sql.Timestamp; +import javax.persistence.Id; +import java.io.Serializable; +import javax.persistence.Table; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Column; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TTESTVALORES*/ +@Entity(name="TtestValores") +@Table(name="TTESTVALORES") +public class TtestValores extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TtestValores +*/ +@Id +@Column(name="ID" ,nullable=false, updatable=false) +private Long pk; +@Column(name="DESCRIPCION", nullable=false) + +/** +* null +*/ +private String descripcion; + +@Column(name="MONTO", nullable=false) + +/** +* null +*/ +private BigDecimal monto; + +@Column(name="FECHA", nullable=false) + +/** +* null +*/ +private Date fecha; + +@Column(name="FECHAHORA", nullable=false) + +/** +* null +*/ +private Timestamp fechahora; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* null +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TtestValores(){ +} +/**Contructor de TtestValores +@param pPk Clave Primaria del entity +@param pDescripcion null +@param pMonto null +@param pFecha null +@param pFechahora null +*/ +public TtestValores(Long pPk,String pDescripcion,BigDecimal pMonto,Date pFecha,Timestamp pFechahora){ + this(); + pk=pPk; + descripcion=pDescripcion; + monto=pMonto; + fecha=pFecha; + fechahora=pFechahora; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TtestValores +*/ +public static TtestValores find(EntityManager pEntityManager,Object pKey) throws Exception{ + TtestValores obj = pEntityManager.find(TtestValores.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TtestValores +@return El objeto que referencia a la Clave primaria de TtestValores +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TtestValores +@param pPk El objeto que referencia a la nueva Clave primaria de TtestValores +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de descripcion +@return valor de descripcion*/ +public String getDescripcion(){ + return descripcion; +} +/**Fija el valor de descripcion +@param pDescripcion nuevo Valor de descripcion*/ +public void setDescripcion(String pDescripcion){ + descripcion=pDescripcion; +} + +/**Obtiene el valor de monto +@return valor de monto*/ +public BigDecimal getMonto(){ + return monto; +} +/**Fija el valor de monto +@param pMonto nuevo Valor de monto*/ +public void setMonto(BigDecimal pMonto){ + monto=pMonto; +} + +/**Obtiene el valor de fecha +@return valor de fecha*/ +public Date getFecha(){ + return fecha; +} +/**Fija el valor de fecha +@param pFecha nuevo Valor de fecha*/ +public void setFecha(Date pFecha){ + fecha=pFecha; +} + +/**Obtiene el valor de fechahora +@return valor de fechahora*/ +public Timestamp getFechahora(){ + return fechahora; +} +/**Fija el valor de fechahora +@param pFechahora nuevo Valor de fechahora*/ +public void setFechahora(Timestamp pFechahora){ + fechahora=pFechahora; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TtestValores))return false; + TtestValores that = (TtestValores) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TtestValores +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TtestValores +*/ +public Object createInstance(){ + TtestValores instance=new TtestValores(); + return instance; +} +/**Clona la entidad TtestValores +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TtestValores p=(TtestValores)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/test/TtestValores.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/test/TtestValores.java new file mode 100644 index 0000000..d8c78d4 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/test/TtestValores.java @@ -0,0 +1,223 @@ +package com.fp.persistence.pgeneral.test; + +import java.sql.Timestamp; +import javax.persistence.Id; +import java.io.Serializable; +import javax.persistence.Table; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Column; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TTESTVALORES*/ +@Entity(name="TtestValores") +@Table(name="TTESTVALORES") +public class TtestValores extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TtestValores +*/ +@Id +@Column(name="ID" ,nullable=false, updatable=false) +private Long pk; +@Column(name="DESCRIPCION", nullable=false) + +/** +* null +*/ +private String descripcion; + +@Column(name="MONTO", nullable=false) + +/** +* null +*/ +private BigDecimal monto; + +@Column(name="FECHA", nullable=false) + +/** +* null +*/ +private Date fecha; + +@Column(name="FECHAHORA", nullable=false) + +/** +* null +*/ +private Timestamp fechahora; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* null +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public TtestValores(){ +} +/**Contructor de TtestValores +@param pPk Clave Primaria del entity +@param pDescripcion null +@param pMonto null +@param pFecha null +@param pFechahora null +*/ +public TtestValores(Long pPk,String pDescripcion,BigDecimal pMonto,Date pFecha,Timestamp pFechahora){ + this(); + pk=pPk; + descripcion=pDescripcion; + monto=pMonto; + fecha=pFecha; + fechahora=pFechahora; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TtestValores +*/ +public static TtestValores find(EntityManager pEntityManager,Object pKey) throws Exception{ + TtestValores obj = pEntityManager.find(TtestValores.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TtestValores +@return El objeto que referencia a la Clave primaria de TtestValores +*/ +public Long getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TtestValores +@param pPk El objeto que referencia a la nueva Clave primaria de TtestValores +*/ +public void setPk(Long pPk){ + pk=pPk; +} +/**Obtiene el valor de descripcion +@return valor de descripcion*/ +public String getDescripcion(){ + return descripcion; +} +/**Fija el valor de descripcion +@param pDescripcion nuevo Valor de descripcion*/ +public void setDescripcion(String pDescripcion){ + descripcion=pDescripcion; +} + +/**Obtiene el valor de monto +@return valor de monto*/ +public BigDecimal getMonto(){ + return monto; +} +/**Fija el valor de monto +@param pMonto nuevo Valor de monto*/ +public void setMonto(BigDecimal pMonto){ + monto=pMonto; +} + +/**Obtiene el valor de fecha +@return valor de fecha*/ +public Date getFecha(){ + return fecha; +} +/**Fija el valor de fecha +@param pFecha nuevo Valor de fecha*/ +public void setFecha(Date pFecha){ + fecha=pFecha; +} + +/**Obtiene el valor de fechahora +@return valor de fechahora*/ +public Timestamp getFechahora(){ + return fechahora; +} +/**Fija el valor de fechahora +@param pFechahora nuevo Valor de fechahora*/ +public void setFechahora(Timestamp pFechahora){ + fechahora=pFechahora; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TtestValores))return false; + TtestValores that = (TtestValores) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TtestValores +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TtestValores +*/ +public Object createInstance(){ + TtestValores instance=new TtestValores(); + return instance; +} +/**Clona la entidad TtestValores +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TtestValores p=(TtestValores)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/entries new file mode 100644 index 0000000..73bd56f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/entries @@ -0,0 +1,643 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans +svn://172.17.26.185/COMACO + + + +2014-10-30T05:45:24.149371Z +2205 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneTransactionItemProcessKey.java +file + + + + +2022-07-28T03:40:29.514746Z +94fce96d377d26c7e100a158f7efe80b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6429 + +TgeneTransactionItemKey.java +file + + + + +2022-07-28T03:40:29.514746Z +13b490f81c82bd0f66ee0927f4abc945 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5600 + +TgeneTransactionProcess.java +file + + + + +2022-07-28T03:40:29.514746Z +1d612b7362c3c0ecc2fd98ede89b8683 +2014-10-30T05:45:05.666266Z +2204 +dcruz + + + + + + + + + + + + + + + + + + + + + +11820 + +TgeneTransaction.java +file + + + + +2022-07-28T03:40:29.515746Z +fdc07170ef1250cdfe549aef6d79a292 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +13612 + +TgeneTransactionGlosary.java +file + + + + +2022-07-28T03:40:29.515746Z +b8f6cf6c12ab7f38b2d18ad4d6514bc7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7629 + +TgeneTransactionItemDetail.java +file + + + + +2022-07-28T03:40:29.515746Z +8cfd21b13a2ba0497af77d4cda2c9020 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +13224 + +TgeneTransactionEvent.java +file + + + + +2022-07-28T03:40:29.515746Z +c7f1ecc12aaf450730fd57d19d9654ac +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7032 + +TgeneTransactionProcessKey.java +file + + + + +2022-07-28T03:40:29.516746Z +0fb99d976f86f682baeb821eb64b45fa +2014-10-30T05:45:24.149371Z +2205 +dcruz + + + + + + + + + + + + + + + + + + + + + +5408 + +TgeneTransactionKey.java +file + + + + +2022-07-28T03:40:29.516746Z +06c1efb6e86e63b59e080afd324890db +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4632 + +TgeneTransactionProvision.java +file + + + + +2022-07-28T03:40:29.516746Z +cfa0e6d20507519869df1caddad62d96 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5643 + +TgeneTransactionGlosaryKey.java +file + + + + +2022-07-28T03:40:29.516746Z +f60ffac11caf3c688fd07c2eab60b144 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6186 + +TgeneTransactionItemDetailKey.java +file + + + + +2022-07-28T03:40:29.517746Z +8a9b5994b39d85f7fcf9ef341c4f1419 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5660 + +TgeneTransactionFinanProcess.java +file + + + + +2022-07-28T03:40:29.517746Z +4b854978bc326f498c55eea4dffef078 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8311 + +TgeneTransactionEventKey.java +file + + + + +2022-07-28T03:40:29.517746Z +2ce525446f29cd6a15e49143082d4bee +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3565 + +TgeneTransactionItemProcess.java +file + + + + +2022-07-28T03:40:29.517746Z +4fad7ff08bf30081c903531bdfa3aea1 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8225 + +TgeneTransactionItem.java +file + + + + +2022-07-28T03:40:29.518746Z +8bbc0ca3f7d86018eec77d23afd54016 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5648 + +TgeneTransactionProvisionKey.java +file + + + + +2022-07-28T03:40:29.518746Z +758f6fa553903e9801f129b3ffeb112b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7638 + +report +dir + +TgeneTransactionFinanProcessKey.java +file + + + + +2022-07-28T03:40:29.518746Z +5a6c7d5dff8d49c410fc8de75fdc3aa3 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5674 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransaction.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransaction.java.svn-base new file mode 100644 index 0000000..0993992 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransaction.java.svn-base @@ -0,0 +1,542 @@ +package com.fp.persistence.pgeneral.trans; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTION */ +@Entity(name = "TgeneTransaction") +@Table(name = "TGENETRANSACTION") +public class TgeneTransaction extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneTransaction + */ + @EmbeddedId + private TgeneTransactionKey pk; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "NAME", nullable = true) + /** + * Nombre de la Transaccion + */ + private String name; + + @Column(name = "PAGE", nullable = true) + /** + * Pagina que dispara el inicio de la transacion + */ + private String page; + + @Column(name = "AUTOQUERY", nullable = true) + /** + * Indicador de si la transaccion debe consultarse automaticamente al ser llamada + */ + private String autoquery; + + @Column(name = "INTERNAL", nullable = true) + /** + * Transaccion interna. Las transacciones internas no se presentan en el men. + */ + private String internal; + + @Column(name = "IMMOBILIZATION", nullable = true) + /** + * Indica si la transaccin es de cliente y afecta la fecha de ultimo movimiento de cuenta para inmovilizacion. + */ + private String immobilization; + + @Column(name = "COMPLETETARIFFITEMS", nullable = true) + /** + * Indica que la transaccion completa rubros de impuestos, cargos, comisiones + */ + private String completetariffitems; + + @Column(name = "FINANCIALPROCESS", nullable = true) + /** + * Indica si la transaccion, tiene definido procesos que se ejecutan, junto a la transaccion finanicera. + */ + private String financialprocess; + + @Column(name = "MANAGECACHE", nullable = true) + /** + * Indica si el registro se almacena en cache del servidor de aplicaicones + */ + private String managecache; + + @Column(name = "SIGNATURE", nullable = true) + /** + * Indica si se habilita la presentacion de la firma en la transaccion, ejemplo pago de cheques + */ + private String signature; + + @Column(name = "INBOX", nullable = true) + /** + * Y indica que cuando se ejecuta la transaccion, se consulta informacion del indbox. + */ + private String inbox; + + @Column(name = "MESSAGECODE", nullable = true) + /** + * Codigo de plantilla de mensajes + */ + private Integer messagecode; + + @Column(name = "QUERYAGAIN", nullable = true) + /** + * Campo que indica si se debe realizar o no una consulta despues de un mantenimiento + */ + private String queryagain; + + @Column(name = "QUERYCODE", nullable = true) + /** + * QUERYCODE + */ + private String querycode; + + @Column(name = "BRANCHAMONG", nullable = true) + /** + * Indica si la transaccion genera intersucursales + */ + private String branchamong; + + @Column(name = "JSFPAGE", nullable = true) + /** + * Pagina jsf + */ + private String jsfpage; + + + + + /** Contructor por defecto */ + public TgeneTransaction() { + } + + /** + * Contructor de TgeneTransaction + * + * @param pPk Clave Primaria del entity + */ + public TgeneTransaction(TgeneTransactionKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneTransaction + */ + public static TgeneTransaction find(EntityManager pEntityManager, TgeneTransactionKey pKey) throws Exception { + TgeneTransaction obj = pEntityManager.find(TgeneTransaction.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneTransaction + * + * @return El objeto que referencia a la Clave primaria de TgeneTransaction + */ + public TgeneTransactionKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneTransaction + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransaction + */ + public void setPk(TgeneTransactionKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de name + * + * @return valor de name + */ + public String getName() { + return name; + } + + /** + * Fija el valor de name + * + * @param pName nuevo Valor de name + */ + public void setName(String pName) { + name = pName; + } + + /** + * Obtiene el valor de page + * + * @return valor de page + */ + public String getPage() { + return page; + } + + /** + * Fija el valor de page + * + * @param pPage nuevo Valor de page + */ + public void setPage(String pPage) { + page = pPage; + } + + /** + * Obtiene el valor de page + * + * @return valor de page + */ + public String getJsfpage() { + return jsfpage; + } + + /** + * Fija el valor de page + * + * @param pPage nuevo Valor de page + */ + public void setJsfpage(String pJsfpage) { + jsfpage = pJsfpage; + } + + /** + * Obtiene el valor de autoquery + * + * @return valor de autoquery + */ + public String getAutoquery() { + return autoquery; + } + + /** + * Fija el valor de autoquery + * + * @param pAutoquery nuevo Valor de autoquery + */ + public void setAutoquery(String pAutoquery) { + autoquery = pAutoquery; + } + + /** + * Obtiene el valor de internal + * + * @return valor de internal + */ + public String getInternal() { + return internal; + } + + /** + * Fija el valor de internal + * + * @param pInternal nuevo Valor de internal + */ + public void setInternal(String pInternal) { + internal = pInternal; + } + + /** + * Obtiene el valor de immobilization + * + * @return valor de immobilization + */ + public String getImmobilization() { + return immobilization; + } + + /** + * Fija el valor de immobilization + * + * @param pImmobilization nuevo Valor de immobilization + */ + public void setImmobilization(String pImmobilization) { + immobilization = pImmobilization; + } + + /** + * Obtiene el valor de completetariffitems + * + * @return valor de completetariffitems + */ + public String getCompletetariffitems() { + return completetariffitems; + } + + /** + * Fija el valor de completetariffitems + * + * @param pCompletetariffitems nuevo Valor de completetariffitems + */ + public void setCompletetariffitems(String pCompletetariffitems) { + completetariffitems = pCompletetariffitems; + } + + /** + * Obtiene el valor de financialprocess + * + * @return valor de financialprocess + */ + public String getFinancialprocess() { + return financialprocess; + } + + /** + * Fija el valor de financialprocess + * + * @param pFinancialprocess nuevo Valor de financialprocess + */ + public void setFinancialprocess(String pFinancialprocess) { + financialprocess = pFinancialprocess; + } + + /** + * Obtiene el valor de managecache + * + * @return valor de managecache + */ + public String getManagecache() { + return managecache; + } + + /** + * Fija el valor de managecache + * + * @param pManagecache nuevo Valor de managecache + */ + public void setManagecache(String pManagecache) { + managecache = pManagecache; + } + + /** + * Obtiene el valor de signature + * + * @return valor de signature + */ + public String getSignature() { + return signature; + } + + /** + * Fija el valor de signature + * + * @param pSignature nuevo Valor de signature + */ + public void setSignature(String pSignature) { + signature = pSignature; + } + + /** + * Obtiene el valor de inbox + * + * @return valor de inbox + */ + public String getInbox() { + return inbox; + } + + /** + * Fija el valor de inbox + * + * @param pInbox nuevo Valor de inbox + */ + public void setInbox(String pInbox) { + inbox = pInbox; + } + + /** + * Obtiene el valor de messagecode + * + * @return valor de messagecode + */ + public Integer getMessagecode() { + return messagecode; + } + + /** + * Fija el valor de messagecode + * + * @param pMessagecode nuevo Valor de messagecode + */ + public void setMessagecode(Integer pMessagecode) { + messagecode = pMessagecode; + } + + /** + * Obtiene el valor de queryagain + * + * @return valor de queryagain + */ + public String getQueryagain() { + return queryagain; + } + + /** + * Fija el valor de queryagain + * + * @param pQueryagain nuevo Valor de queryagain + */ + public void setQueryagain(String pQueryagain) { + queryagain = pQueryagain; + } + + /** + * Obtiene el valor de querycode + * + * @return valor de querycode + */ + public String getQuerycode() { + return querycode; + } + + /** + * Fija el valor de querycode + * + * @param pQuerycode nuevo Valor de querycode + */ + public void setQuerycode(String pQuerycode) { + querycode = pQuerycode; + } + + /** + * Obtiene el valor de branchamong + * + * @return valor de branchamong + */ + public String getBranchamong() { + return branchamong; + } + + /** + * Fija el valor de branchamong + * + * @param pBranchamong nuevo Valor de branchamong + */ + public void setBranchamong(String pBranchamong) { + branchamong = pBranchamong; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneTransaction)) + return false; + TgeneTransaction that = (TgeneTransaction) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneTransaction + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneTransaction */ + @Override + public Object createInstance() { + TgeneTransaction instance = new TgeneTransaction(); + instance.setPk(new TgeneTransactionKey()); + return instance; + } + + /** + * Clona la entidad TgeneTransaction + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneTransaction p = (TgeneTransaction) this.clone(); + p.setPk((TgeneTransactionKey) this.pk.cloneMe()); + return p; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionEvent.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionEvent.java.svn-base new file mode 100644 index 0000000..6798f73 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionEvent.java.svn-base @@ -0,0 +1,241 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.core.exception.CoreException; +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONEVENT */ +@Entity(name = "TgeneTransactionEvent") +@Table(name = "TGENETRANSACTIONEVENT") +public class TgeneTransactionEvent extends com.fp.dto.AbstractDataTransport + implements + Serializable,HibernateBean,Cloneable,Cache { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneTransactionEvent + */ + @EmbeddedId + private TgeneTransactionEventKey pk; + @Column(name = "TRANSACTIONMODULE", nullable = true) + /** + * Modulo al que pertence la transaccion + */ + private String transactionmodule; + + @Column(name = "TRANSACTIONCODE", nullable = true) + /** + * Codigo de transaccion dentro del modulo + */ + private Integer transactioncode; + + @Column(name = "TRANSACTIONVERSION", nullable = true) + /** + * Version de transaccion + */ + private Integer transactionversion; + + /** Contructor por defecto */ + public TgeneTransactionEvent() { + } + /** + * Contructor de TgeneTransactionEvent + * + * @param pPk Clave Primaria del entity + */ + public TgeneTransactionEvent(TgeneTransactionEventKey pPk) { + this(); + pk = pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneTransactionEvent + */ + public static TgeneTransactionEvent find(EntityManager pEntityManager, TgeneTransactionEventKey pKey) + throws Exception { + TgeneTransactionEvent obj = pEntityManager.find(TgeneTransactionEvent.class, pKey); + return obj; + } + /** + * Entrega la Clave primaria de TgeneTransactionEvent + * + * @return El objeto que referencia a la Clave primaria de TgeneTransactionEvent + */ + public TgeneTransactionEventKey getPk() { + return pk; + } + /** + * Fija un nuevo valor a la Clave primaria de TgeneTransactionEvent + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionEvent + */ + public void setPk(TgeneTransactionEventKey pPk) { + pk = pPk; + } + /** + * Obtiene el valor de transactionmodule + * + * @return valor de transactionmodule + */ + public String getTransactionmodule() { + return transactionmodule; + } + /** + * Fija el valor de transactionmodule + * + * @param pTransactionmodule nuevo Valor de transactionmodule + */ + public void setTransactionmodule(String pTransactionmodule) { + transactionmodule = pTransactionmodule; + } + + /** + * Obtiene el valor de transactioncode + * + * @return valor de transactioncode + */ + public Integer getTransactioncode() { + return transactioncode; + } + /** + * Fija el valor de transactioncode + * + * @param pTransactioncode nuevo Valor de transactioncode + */ + public void setTransactioncode(Integer pTransactioncode) { + transactioncode = pTransactioncode; + } + + /** + * Obtiene el valor de transactionversion + * + * @return valor de transactionversion + */ + public Integer getTransactionversion() { + return transactionversion; + } + /** + * Fija el valor de transactionversion + * + * @param pTransactionversion nuevo Valor de transactionversion + */ + public void setTransactionversion(Integer pTransactionversion) { + transactionversion = pTransactionversion; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneTransactionEvent)) + return false; + TgeneTransactionEvent that = (TgeneTransactionEvent) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /** + * Implementacin del metodo hashCode de la la entidad TgeneTransactionEvent + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + /** Implementacin de la creacin de un bean en blanco TgeneTransactionEvent */ + public Object createInstance() { + TgeneTransactionEvent instance = new TgeneTransactionEvent(); + instance.setPk(new TgeneTransactionEventKey()); + return instance; + } + /** + * Clona la entidad TgeneTransactionEvent + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneTransactionEvent p = (TgeneTransactionEvent) this.clone(); + p.setPk((TgeneTransactionEventKey) this.pk.cloneMe()); + return p; + } + + //Metodos manuales. + /** Sentencia que devuelve un registro de TgeneTransactionEvent.*/ + private static final String HQL_EVENT = + "from TgeneTransactionEvent t " + + " where t.pk.eventcode = :eventcode "+ + " and t.pk.modulecode = :modulecode "; + + /** + * Metodo que entrega la transaccion a ejecutar dado un codigo de evento. + * @param pEntityManager Referencia a la session de base de datos. + * @param pEventCode Codigo de evento. + * @param pModuleCode Modulo al que pertenece el evento. + * @return TgeneTransactionEvent + * @throws Exception + */ + public static TgeneTransactionEvent find(EntityManager pEntityManager,String pEventCode,String pModuleCode) throws Exception { + Query qry = pEntityManager.createQuery(HQL_EVENT); + TgeneTransactionEvent obj = null; + qry.setParameter("eventcode", pEventCode); + qry.setParameter("modulecode", pModuleCode); + try { + obj = (TgeneTransactionEvent)qry.getSingleResult(); + } catch (NoResultException e) { + throw new CoreException("CORE-0036","EVENTO NO DEFINIDO EN TGENETRANSACTIONEVENT EVENT:{0} MODULE:{1}", + pEventCode,pModuleCode); + } + return obj; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionEventKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionEventKey.java.svn-base new file mode 100644 index 0000000..3219b41 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionEventKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONEVENT*/ +@Embeddable +public class TgeneTransactionEventKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="EVENTCODE", nullable=false,updatable=false) + +/** +* Codigo de evento a ejecutar, Ejemplo PAYMENT pago de credito +*/ +private String eventcode; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +/**Contructor por defecto*/ +public TgeneTransactionEventKey(){} +/**Contructor de TgeneTransactionEventKey +@param pEventcode Codigo de evento a ejecutar, Ejemplo PAYMENT pago de credito +@param pModulecode Codigo de modulo +*/ +public TgeneTransactionEventKey(String pEventcode,String pModulecode){ + eventcode=pEventcode; + modulecode=pModulecode; +} +/**Obtiene el valor de eventcode +@return valor de eventcode*/ +public String getEventcode(){ + return eventcode; +} +/**Fija el valor de eventcode +@param pEventcode nuevo Valor de eventcode*/ +public void setEventcode(String pEventcode){ + eventcode=pEventcode; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Implementacin de la comparacin de TgeneTransactionEventKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionEventKey))return false; + TgeneTransactionEventKey that = (TgeneTransactionEventKey) o; + if (this.getEventcode() == null || that.getEventcode() == null){ + return false; + } + if (! this.getEventcode().equals(that.getEventcode())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransactionEventKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getEventcode() == null ? 0 : this.getEventcode().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionFinanProcess.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionFinanProcess.java.svn-base new file mode 100644 index 0000000..761b8fb --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionFinanProcess.java.svn-base @@ -0,0 +1,273 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONFINANPROCESS*/ +@Entity(name="TgeneTransactionFinanProcess") +@Table(name="TGENETRANSACTIONFINANPROCESS") +public class TgeneTransactionFinanProcess extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransactionFinanProcess +*/ +@EmbeddedId +private TgeneTransactionFinanProcessKey pk; +@Column(name="PROCESSCODE", nullable=true) + +/** +* Paquete clase de un comando a ejecutar. +*/ +private String processcode; + +@Column(name="CATALOGTYPEPROCESS", nullable=true) + +/** +* Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia +*/ +private String catalogtypeprocess; + +@Column(name="CATALOGCODETYPEPROCESS", nullable=true) + +/** +* Codigo de tabla de catalogo del proceso de negocio de la aplicacion +*/ +private String catalogcodetypeprocess; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="EVENT", nullable=false) + +/** +* Proceso de negocio a ejecuatr en B (Begin) inicio de la transaccion, P (Process) proceso de la transaccion, E (End) Fin de la transaccion +*/ +private String event; + +@Column(name="EXECUTIONORDER", nullable=false) + +/** +* Orden de ejecucion del comando. +*/ +private Integer executionorder; + +@Column(name="STATUS", nullable=true) + +/** +* A indica que la regla esta activa, I regla Inactiva +*/ +private String status; + +@Column(name="MANAGECACHE", nullable=true) + +/** +* Indica si el registro se almacena en cache del servidor de aplicaicones +*/ +private String managecache; + +/**Contructor por defecto*/ +public TgeneTransactionFinanProcess(){ +} +/**Contructor de TgeneTransactionFinanProcess +@param pPk Clave Primaria del entity +@param pEvent Proceso de negocio a ejecuatr en B (Begin) inicio de la transaccion, P (Process) proceso de la transaccion, E (End) Fin de la transaccion +@param pExecutionorder Orden de ejecucion del comando. +*/ +public TgeneTransactionFinanProcess(TgeneTransactionFinanProcessKey pPk,String pEvent,Integer pExecutionorder){ + this(); + pk=pPk; + event=pEvent; + executionorder=pExecutionorder; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionFinanProcess +*/ +public static TgeneTransactionFinanProcess find(EntityManager pEntityManager,TgeneTransactionFinanProcessKey pKey) throws Exception{ + TgeneTransactionFinanProcess obj = pEntityManager.find(TgeneTransactionFinanProcess.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionFinanProcess +@return El objeto que referencia a la Clave primaria de TgeneTransactionFinanProcess +*/ +public TgeneTransactionFinanProcessKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionFinanProcess +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionFinanProcess +*/ +public void setPk(TgeneTransactionFinanProcessKey pPk){ + pk=pPk; +} +/**Obtiene el valor de processcode +@return valor de processcode*/ +public String getProcesscode(){ + return processcode; +} +/**Fija el valor de processcode +@param pProcesscode nuevo Valor de processcode*/ +public void setProcesscode(String pProcesscode){ + processcode=pProcesscode; +} + +/**Obtiene el valor de catalogtypeprocess +@return valor de catalogtypeprocess*/ +public String getCatalogtypeprocess(){ + return catalogtypeprocess; +} +/**Fija el valor de catalogtypeprocess +@param pCatalogtypeprocess nuevo Valor de catalogtypeprocess*/ +public void setCatalogtypeprocess(String pCatalogtypeprocess){ + catalogtypeprocess=pCatalogtypeprocess; +} + +/**Obtiene el valor de catalogcodetypeprocess +@return valor de catalogcodetypeprocess*/ +public String getCatalogcodetypeprocess(){ + return catalogcodetypeprocess; +} +/**Fija el valor de catalogcodetypeprocess +@param pCatalogcodetypeprocess nuevo Valor de catalogcodetypeprocess*/ +public void setCatalogcodetypeprocess(String pCatalogcodetypeprocess){ + catalogcodetypeprocess=pCatalogcodetypeprocess; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de event +@return valor de event*/ +public String getEvent(){ + return event; +} +/**Fija el valor de event +@param pEvent nuevo Valor de event*/ +public void setEvent(String pEvent){ + event=pEvent; +} + +/**Obtiene el valor de executionorder +@return valor de executionorder*/ +public Integer getExecutionorder(){ + return executionorder; +} +/**Fija el valor de executionorder +@param pExecutionorder nuevo Valor de executionorder*/ +public void setExecutionorder(Integer pExecutionorder){ + executionorder=pExecutionorder; +} + +/**Obtiene el valor de status +@return valor de status*/ +public String getStatus(){ + return status; +} +/**Fija el valor de status +@param pStatus nuevo Valor de status*/ +public void setStatus(String pStatus){ + status=pStatus; +} + +/**Obtiene el valor de managecache +@return valor de managecache*/ +public String getManagecache(){ + return managecache; +} +/**Fija el valor de managecache +@param pManagecache nuevo Valor de managecache*/ +public void setManagecache(String pManagecache){ + managecache=pManagecache; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionFinanProcess))return false; + TgeneTransactionFinanProcess that = (TgeneTransactionFinanProcess) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTransactionFinanProcess +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTransactionFinanProcess +*/ +public Object createInstance(){ + TgeneTransactionFinanProcess instance=new TgeneTransactionFinanProcess(); + instance.setPk(new TgeneTransactionFinanProcessKey()); + return instance; +} +/**Clona la entidad TgeneTransactionFinanProcess +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionFinanProcess p=(TgeneTransactionFinanProcess)this.clone(); + p.setPk((TgeneTransactionFinanProcessKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionFinanProcessKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionFinanProcessKey.java.svn-base new file mode 100644 index 0000000..b83d34c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionFinanProcessKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONFINANPROCESS*/ +@Embeddable +public class TgeneTransactionFinanProcessKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="SEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del comando de la transaccion. +*/ +private Integer sequence; + +/**Contructor por defecto*/ +public TgeneTransactionFinanProcessKey(){} +/**Contructor de TgeneTransactionFinanProcessKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pSequence Secuencia del comando de la transaccion. +*/ +public TgeneTransactionFinanProcessKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,Integer pSequence){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + sequence=pSequence; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de sequence +@return valor de sequence*/ +public Integer getSequence(){ + return sequence; +} +/**Fija el valor de sequence +@param pSequence nuevo Valor de sequence*/ +public void setSequence(Integer pSequence){ + sequence=pSequence; +} + +/**Implementacin de la comparacin de TgeneTransactionFinanProcessKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionFinanProcessKey))return false; + TgeneTransactionFinanProcessKey that = (TgeneTransactionFinanProcessKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getSequence() == null || that.getSequence() == null){ + return false; + } + if (! this.getSequence().equals(that.getSequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransactionFinanProcessKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getSequence() == null ? 0 : this.getSequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionGlosary.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionGlosary.java.svn-base new file mode 100644 index 0000000..b5d1c58 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionGlosary.java.svn-base @@ -0,0 +1,251 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.*; +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONGLOSARY + */ +@Entity(name = "TgeneTransactionGlosary") +@Table(name = "TGENETRANSACTIONGLOSARY") +public class TgeneTransactionGlosary extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneTransactionGlosary + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(SEQUENCE),0)+1 from TGENETRANSACTIONGLOSARY " + + "where TRANSACTIONMODULE=:transactionmodule " + + "and TRANSACTIONCODE=:transactioncode " + + "and TRANSACTIONVERSION=:transactionversion " + + "and LANGUAGECODE = :languagecode"), + @Parameter(name = "type", value = "java.lang.Long"), + @Parameter(name = "param", value = "transactionmodule,pk.transactionmodule;transactioncode,pk.transactioncode;transactionversion,pk.transactionversion;languagecode,pk.languagecode"), + @Parameter(name = "field", value = "sequence")}) + @GeneratedValue(generator = "seq_id") + private TgeneTransactionGlosaryKey pk; + @Version + @Column(name = "RECORDVERSION", nullable = false) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "DESCRIPTIONSHORT", nullable = false) + /** + * Descripcion de glosario + */ + private String descriptionshort; + @Column(name = "DESCRIPTION", nullable = false) + /** + * Descripcion del glosario + */ + private String description; + + /** + * Contructor por defecto + */ + public TgeneTransactionGlosary() { + } + + /** + * Contructor de TgeneTransactionGlosary + * + * @param pPk Clave Primaria del entity + * @param pRecordversion Optimistic locking del registro + * @param pDescriptionshort Descripcion de glosario + * @param pDescription Descripcion del glosario + */ + public TgeneTransactionGlosary(TgeneTransactionGlosaryKey pPk, Integer pRecordversion, String pDescriptionshort, String pDescription) { + this(); + pk = pPk; + recordversion = pRecordversion; + descriptionshort = pDescriptionshort; + description = pDescription; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneTransactionGlosary + */ + public static TgeneTransactionGlosary find(EntityManager pEntityManager, TgeneTransactionGlosaryKey pKey) throws Exception { + TgeneTransactionGlosary obj = pEntityManager.find(TgeneTransactionGlosary.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneTransactionGlosary + * + * @return El objeto que referencia a la Clave primaria de + * TgeneTransactionGlosary + */ + public TgeneTransactionGlosaryKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneTransactionGlosary + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TgeneTransactionGlosary + */ + public void setPk(TgeneTransactionGlosaryKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de descriptionshort + * + * @return valor de descriptionshort + */ + public String getDescriptionshort() { + return descriptionshort; + } + + /** + * Fija el valor de descriptionshort + * + * @param pDescriptionshort nuevo Valor de descriptionshort + */ + public void setDescriptionshort(String pDescriptionshort) { + descriptionshort = pDescriptionshort; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneTransactionGlosary)) { + return false; + } + TgeneTransactionGlosary that = (TgeneTransactionGlosary) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad + * TgeneTransactionGlosary + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacion toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacion de la creacion de un bean en blanco + * TgeneTransactionGlosary + */ + public Object createInstance() { + TgeneTransactionGlosary instance = new TgeneTransactionGlosary(); + instance.setPk(new TgeneTransactionGlosaryKey()); + return instance; + } + + /** + * Clona la entidad TgeneTransactionGlosary + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneTransactionGlosary p = (TgeneTransactionGlosary) this.clone(); + p.setPk((TgeneTransactionGlosaryKey) this.pk.cloneMe()); + return p; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionGlosaryKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionGlosaryKey.java.svn-base new file mode 100644 index 0000000..e928ec9 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionGlosaryKey.java.svn-base @@ -0,0 +1,205 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONGLOSARY*/ +@Embeddable +public class TgeneTransactionGlosaryKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="LANGUAGECODE", nullable=false,updatable=false) + +/** +* Codigo de idioma +*/ +private String languagecode; + +@Column(name="SEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia parael ingreso +*/ +private Long sequence; + +/**Contructor por defecto*/ +public TgeneTransactionGlosaryKey(){} +/**Contructor de TgeneTransactionGlosaryKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pLanguagecode Codigo de idioma +@param pSequence Secuencia parael ingreso +*/ +public TgeneTransactionGlosaryKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,String pLanguagecode,Long pSequence){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + languagecode=pLanguagecode; + sequence=pSequence; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de languagecode +@return valor de languagecode*/ +public String getLanguagecode(){ + return languagecode; +} +/**Fija el valor de languagecode +@param pLanguagecode nuevo Valor de languagecode*/ +public void setLanguagecode(String pLanguagecode){ + languagecode=pLanguagecode; +} + +/**Obtiene el valor de sequence +@return valor de sequence*/ +public Long getSequence(){ + return sequence; +} +/**Fija el valor de sequence +@param pSequence nuevo Valor de sequence*/ +public void setSequence(Long pSequence){ + sequence=pSequence; +} + +/**Implementacion de la comparacion de TgeneTransactionGlosaryKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionGlosaryKey))return false; + TgeneTransactionGlosaryKey that = (TgeneTransactionGlosaryKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getLanguagecode() == null || that.getLanguagecode() == null){ + return false; + } + if (! this.getLanguagecode().equals(that.getLanguagecode())){ + return false; + } + if (this.getSequence() == null || that.getSequence() == null){ + return false; + } + if (! this.getSequence().equals(that.getSequence())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneTransactionGlosaryKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getLanguagecode() == null ? 0 : this.getLanguagecode().hashCode()); + result = result * 37 + (this.getSequence() == null ? 0 : this.getSequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionItem.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionItem.java.svn-base new file mode 100644 index 0000000..304e2d7 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionItem.java.svn-base @@ -0,0 +1,195 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONITEM*/ +@Entity(name="TgeneTransactionItem") +@Table(name="TGENETRANSACTIONITEM") +public class TgeneTransactionItem extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransactionItem +*/ +@EmbeddedId +private TgeneTransactionItemKey pk; +@Column(name="DESCRIPTION", nullable=false) + +/** +* Descripcipn del item de la transaccin Ejemplo Efectivo. +*/ +private String description; + +@Column(name="SHOWINPAGE", nullable=true) + +/** +* null +*/ +private String showinpage; + +@Column(name="CALCUTATETARIFF", nullable=true) + +/** +* Se utiliza en paginas, Y indica que se tiene calcular el valor de un rubor en funcion a un tarifario. +*/ +private String calcutatetariff; + +@Column(name="EDITABLE", nullable=true) + +/** +* null +*/ +private String editable; + +/**Contructor por defecto*/ +public TgeneTransactionItem(){ +} +/**Contructor de TgeneTransactionItem +@param pPk Clave Primaria del entity +@param pDescription Descripcipn del item de la transaccin Ejemplo Efectivo. +*/ +public TgeneTransactionItem(TgeneTransactionItemKey pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionItem +*/ +public static TgeneTransactionItem find(EntityManager pEntityManager,TgeneTransactionItemKey pKey) throws Exception{ + TgeneTransactionItem obj = pEntityManager.find(TgeneTransactionItem.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionItem +@return El objeto que referencia a la Clave primaria de TgeneTransactionItem +*/ +public TgeneTransactionItemKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionItem +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionItem +*/ +public void setPk(TgeneTransactionItemKey pPk){ + pk=pPk; +} +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de showinpage +@return valor de showinpage*/ +public String getShowinpage(){ + return showinpage; +} +/**Fija el valor de showinpage +@param pShowinpage nuevo Valor de showinpage*/ +public void setShowinpage(String pShowinpage){ + showinpage=pShowinpage; +} + +/**Obtiene el valor de calcutatetariff +@return valor de calcutatetariff*/ +public String getCalcutatetariff(){ + return calcutatetariff; +} +/**Fija el valor de calcutatetariff +@param pCalcutatetariff nuevo Valor de calcutatetariff*/ +public void setCalcutatetariff(String pCalcutatetariff){ + calcutatetariff=pCalcutatetariff; +} + +/**Obtiene el valor de editable +@return valor de editable*/ +public String getEditable(){ + return editable; +} +/**Fija el valor de editable +@param pEditable nuevo Valor de editable*/ +public void setEditable(String pEditable){ + editable=pEditable; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionItem))return false; + TgeneTransactionItem that = (TgeneTransactionItem) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTransactionItem +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTransactionItem +*/ +public Object createInstance(){ + TgeneTransactionItem instance=new TgeneTransactionItem(); + instance.setPk(new TgeneTransactionItemKey()); + return instance; +} +/**Clona la entidad TgeneTransactionItem +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionItem p=(TgeneTransactionItem)this.clone(); + p.setPk((TgeneTransactionItemKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionItemDetail.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionItemDetail.java.svn-base new file mode 100644 index 0000000..19b0778 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionItemDetail.java.svn-base @@ -0,0 +1,466 @@ +package com.fp.persistence.pgeneral.trans; + +import com.fp.dto.hb.Cache; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONITEMDETAIL*/ +@Entity(name="TgeneTransactionItemDetail") +@Table(name="TGENETRANSACTIONITEMDETAIL") +public class TgeneTransactionItemDetail extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransactionItemDetail +*/ +@EmbeddedId +private TgeneTransactionItemDetailKey pk; +@Column(name="DEBITCREDIT", nullable=true) + +/** +* Indica si el item afecta al debito o credito del par contable +*/ +private String debitcredit; + +@Column(name="BALANCETYPE", nullable=true) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=true) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="COMPLEMENTARYITEM", nullable=true) + +/** +* Item complementario utilizado para armar el asiento contable. +*/ +private Integer complementaryitem; + +@Column(name="REFERENCEITEM", nullable=true) + +/** +* Item de referencia del cual se obtien el monto base para calcular IMP, CAR, COM. +*/ +private Integer referenceitem; + +@Column(name="ASSOCIATEDITEM", nullable=true) + +/** +* Rubro asociado, se adiciona a la transaccion cuando se ejecuta un rubro de la transaccion ejemplo cobro de intereses en orden, se reversa de cuentas de orden +*/ +private Integer associateditem; + +@Column(name="COPYACCOUNTFROMREQUEST", nullable=true) + +/** +* Indica si el journal se graba con la cuenta del request, si el rubro es de debito se copia la cuenta debito, si el rubro es credito se copia la cuenta credito +*/ +private String copyaccountfromrequest; + +@Column(name="CONCEPTMODULE", nullable=true) + +/** +* Codigo de modulo +*/ +private String conceptmodule; + +@Column(name="CONCEPTCODE", nullable=true) + +/** +* Codigo de concepto +*/ +private Integer conceptcode; + +@Column(name="TEMPLATECODE", nullable=true) + +/** +* Cdigo de plantilla de cuentas por cobrar. +*/ +private Integer templatecode; + +@Column(name="REGISTERMOVEMENT", nullable=true) + +/** +* Indica si el item se graba en la tabla de movimiento y afecta el saldo de la cuenta +*/ +private String registermovement; + +@Column(name="TARIFF", nullable=true) + +/** +* Indica si sobre el rubro se calcula impouestos, cargos o comisiones. +*/ +private String tariff; + +@Column(name="ISTAX", nullable=true) + +/** +* Indica si el rubro es un impuesto, si la cuenta no tiene saldo para ejecutar la transaccin se cobra el cargo mas el proporcinal del impuesto, En la cxc se define calcula nuevamente el imopuesto +*/ +private String istax; + +@Column(name="ACCOUNTSTATEMENT", nullable=true) + +/** +* Indica si el movimiento se presenta en el estado de cuenta +*/ +private String accountstatement; + +@Column(name="OVERDRAW", nullable=true) + +/** +* Indica si el valor del rubro genera un sobregiro indirecto o un vario deudor en cuentas de ahorro, se utiliza en los cargos por servicios +*/ +private String overdraw; + +@Column(name="PROCESS", nullable=true) + +/** +* Indica si tiene o no procesos de negocio a ejecutar en el rubro. +*/ +private String process; + +@Column(name="MANAGECACHE", nullable=true) + +/** +* Indica si el registro se almacena en cache del servidor de aplicaciones. +*/ +private String managecache; + +@Column(name="ADDORSUB", nullable=true) + +/** +* Indica se suma o resta el saldo de la cuenta producto,Los valores pueden ser '+','-' y null +*/ +private String addorsub; + +/**Contructor por defecto*/ +public TgeneTransactionItemDetail(){ +} +/**Contructor de TgeneTransactionItemDetail +@param pPk Clave Primaria del entity +*/ +public TgeneTransactionItemDetail(TgeneTransactionItemDetailKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionItemDetail +*/ +public static TgeneTransactionItemDetail find(EntityManager pEntityManager,TgeneTransactionItemDetailKey pKey) throws Exception{ + TgeneTransactionItemDetail obj = pEntityManager.find(TgeneTransactionItemDetail.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionItemDetail +@return El objeto que referencia a la Clave primaria de TgeneTransactionItemDetail +*/ +public TgeneTransactionItemDetailKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionItemDetail +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionItemDetail +*/ +public void setPk(TgeneTransactionItemDetailKey pPk){ + pk=pPk; +} +/**Obtiene el valor de debitcredit +@return valor de debitcredit*/ +public String getDebitcredit(){ + return debitcredit; +} +/**Fija el valor de debitcredit +@param pDebitcredit nuevo Valor de debitcredit*/ +public void setDebitcredit(String pDebitcredit){ + debitcredit=pDebitcredit; +} + +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de complementaryitem +@return valor de complementaryitem*/ +public Integer getComplementaryitem(){ + return complementaryitem; +} +/**Fija el valor de complementaryitem +@param pComplementaryitem nuevo Valor de complementaryitem*/ +public void setComplementaryitem(Integer pComplementaryitem){ + complementaryitem=pComplementaryitem; +} + +/**Obtiene el valor de referenceitem +@return valor de referenceitem*/ +public Integer getReferenceitem(){ + return referenceitem; +} +/**Fija el valor de referenceitem +@param pReferenceitem nuevo Valor de referenceitem*/ +public void setReferenceitem(Integer pReferenceitem){ + referenceitem=pReferenceitem; +} + +/**Obtiene el valor de associateditem +@return valor de associateditem*/ +public Integer getAssociateditem(){ + return associateditem; +} +/**Fija el valor de associateditem +@param pAssociateditem nuevo Valor de associateditem*/ +public void setAssociateditem(Integer pAssociateditem){ + associateditem=pAssociateditem; +} + +/**Obtiene el valor de copyaccountfromrequest +@return valor de copyaccountfromrequest*/ +public String getCopyaccountfromrequest(){ + return copyaccountfromrequest; +} +/**Fija el valor de copyaccountfromrequest +@param pCopyaccountfromrequest nuevo Valor de copyaccountfromrequest*/ +public void setCopyaccountfromrequest(String pCopyaccountfromrequest){ + copyaccountfromrequest=pCopyaccountfromrequest; +} + +/**Obtiene el valor de conceptmodule +@return valor de conceptmodule*/ +public String getConceptmodule(){ + return conceptmodule; +} +/**Fija el valor de conceptmodule +@param pConceptmodule nuevo Valor de conceptmodule*/ +public void setConceptmodule(String pConceptmodule){ + conceptmodule=pConceptmodule; +} + +/**Obtiene el valor de conceptcode +@return valor de conceptcode*/ +public Integer getConceptcode(){ + return conceptcode; +} +/**Fija el valor de conceptcode +@param pConceptcode nuevo Valor de conceptcode*/ +public void setConceptcode(Integer pConceptcode){ + conceptcode=pConceptcode; +} + +/**Obtiene el valor de templatecode +@return valor de templatecode*/ +public Integer getTemplatecode(){ + return templatecode; +} +/**Fija el valor de templatecode +@param pTemplatecode nuevo Valor de templatecode*/ +public void setTemplatecode(Integer pTemplatecode){ + templatecode=pTemplatecode; +} + +/**Obtiene el valor de registermovement +@return valor de registermovement*/ +public String getRegistermovement(){ + return registermovement; +} +/**Fija el valor de registermovement +@param pRegistermovement nuevo Valor de registermovement*/ +public void setRegistermovement(String pRegistermovement){ + registermovement=pRegistermovement; +} + +/**Obtiene el valor de tariff +@return valor de tariff*/ +public String getTariff(){ + return tariff; +} +/**Fija el valor de tariff +@param pTariff nuevo Valor de tariff*/ +public void setTariff(String pTariff){ + tariff=pTariff; +} + +/**Obtiene el valor de istax +@return valor de istax*/ +public String getIstax(){ + return istax; +} +/**Fija el valor de istax +@param pIstax nuevo Valor de istax*/ +public void setIstax(String pIstax){ + istax=pIstax; +} + +/**Obtiene el valor de accountstatement +@return valor de accountstatement*/ +public String getAccountstatement(){ + return accountstatement; +} +/**Fija el valor de accountstatement +@param pAccountstatement nuevo Valor de accountstatement*/ +public void setAccountstatement(String pAccountstatement){ + accountstatement=pAccountstatement; +} + +/**Obtiene el valor de overdraw +@return valor de overdraw*/ +public String getOverdraw(){ + return overdraw; +} +/**Fija el valor de overdraw +@param pOverdraw nuevo Valor de overdraw*/ +public void setOverdraw(String pOverdraw){ + overdraw=pOverdraw; +} + +/**Obtiene el valor de process +@return valor de process*/ +public String getProcess(){ + return process; +} +/**Fija el valor de process +@param pProcess nuevo Valor de process*/ +public void setProcess(String pProcess){ + process=pProcess; +} + +/**Obtiene el valor de managecache +@return valor de managecache*/ +public String getManagecache(){ + return managecache; +} +/**Fija el valor de managecache +@param pManagecache nuevo Valor de managecache*/ +public void setManagecache(String pManagecache){ + managecache=pManagecache; +} + +/**Obtiene el valor de addorsub +@return valor de addorsub*/ +public String getAddorsub(){ + return addorsub; +} +/**Fija el valor de addorsub +@param pAddorsub nuevo Valor de addorsub*/ +public void setAddorsub(String pAddorsub){ + addorsub=pAddorsub; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionItemDetail))return false; + TgeneTransactionItemDetail that = (TgeneTransactionItemDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneTransactionItemDetail +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneTransactionItemDetail +*/ +public Object createInstance(){ + TgeneTransactionItemDetail instance=new TgeneTransactionItemDetail(); + instance.setPk(new TgeneTransactionItemDetailKey()); + return instance; +} +/**Clona la entidad TgeneTransactionItemDetail +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionItemDetail p=(TgeneTransactionItemDetail)this.clone(); + p.setPk((TgeneTransactionItemDetailKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionItemDetailKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionItemDetailKey.java.svn-base new file mode 100644 index 0000000..fc138b0 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionItemDetailKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONITEMDETAIL*/ +@Embeddable +public class TgeneTransactionItemDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="ITEMCODE", nullable=false,updatable=false) + +/** +* Sequencia de items dentro de la transaccion +*/ +private Integer itemcode; + +/**Contructor por defecto*/ +public TgeneTransactionItemDetailKey(){} +/**Contructor de TgeneTransactionItemDetailKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pItemcode Sequencia de items dentro de la transaccion +*/ +public TgeneTransactionItemDetailKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,Integer pItemcode){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + itemcode=pItemcode; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de itemcode +@return valor de itemcode*/ +public Integer getItemcode(){ + return itemcode; +} +/**Fija el valor de itemcode +@param pItemcode nuevo Valor de itemcode*/ +public void setItemcode(Integer pItemcode){ + itemcode=pItemcode; +} + +/**Implementacion de la comparacion de TgeneTransactionItemDetailKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionItemDetailKey))return false; + TgeneTransactionItemDetailKey that = (TgeneTransactionItemDetailKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getItemcode() == null || that.getItemcode() == null){ + return false; + } + if (! this.getItemcode().equals(that.getItemcode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneTransactionItemDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getItemcode() == null ? 0 : this.getItemcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionItemKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionItemKey.java.svn-base new file mode 100644 index 0000000..4fd3182 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionItemKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONITEM*/ +@Embeddable +public class TgeneTransactionItemKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="ITEMCODE", nullable=false,updatable=false) + +/** +* Sequencia de items dentro de la transaccion +*/ +private Integer itemcode; + +/**Contructor por defecto*/ +public TgeneTransactionItemKey(){} +/**Contructor de TgeneTransactionItemKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pItemcode Sequencia de items dentro de la transaccion +*/ +public TgeneTransactionItemKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,Integer pItemcode){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + itemcode=pItemcode; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de itemcode +@return valor de itemcode*/ +public Integer getItemcode(){ + return itemcode; +} +/**Fija el valor de itemcode +@param pItemcode nuevo Valor de itemcode*/ +public void setItemcode(Integer pItemcode){ + itemcode=pItemcode; +} + +/**Implementacin de la comparacin de TgeneTransactionItemKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionItemKey))return false; + TgeneTransactionItemKey that = (TgeneTransactionItemKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getItemcode() == null || that.getItemcode() == null){ + return false; + } + if (! this.getItemcode().equals(that.getItemcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransactionItemKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getItemcode() == null ? 0 : this.getItemcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionItemProcess.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionItemProcess.java.svn-base new file mode 100644 index 0000000..d634988 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionItemProcess.java.svn-base @@ -0,0 +1,273 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONITEMPROCESS*/ +@Entity(name="TgeneTransactionItemProcess") +@Table(name="TGENETRANSACTIONITEMPROCESS") +public class TgeneTransactionItemProcess extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransactionItemProcess +*/ +@EmbeddedId +private TgeneTransactionItemProcessKey pk; +@Column(name="PROCESSCODE", nullable=true) + +/** +* Paquete clase de un comando a ejecutar. +*/ +private String processcode; + +@Column(name="CATALOGTYPEPROCESS", nullable=true) + +/** +* Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia +*/ +private String catalogtypeprocess; + +@Column(name="CATALOGCODETYPEPROCESS", nullable=true) + +/** +* Codigo de tabla de catalogo del proceso de negocio de la aplicacion +*/ +private String catalogcodetypeprocess; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="ISVALIDATE", nullable=false) + +/** +* Indica que la regla de negocio, es de validacion +*/ +private String isvalidate; + +@Column(name="EXECUTIONORDER", nullable=false) + +/** +* A indica que la regla esta activa, I regla Inactiva +*/ +private Integer executionorder; + +@Column(name="STATUS", nullable=true) + +/** +* A indica que el comando esta activo, I comando Inactivo +*/ +private String status; + +@Column(name="MANAGECACHE", nullable=true) + +/** +* Indica si el registro se almacena en cache del servidor de aplicaicones +*/ +private String managecache; + +/**Contructor por defecto*/ +public TgeneTransactionItemProcess(){ +} +/**Contructor de TgeneTransactionItemProcess +@param pPk Clave Primaria del entity +@param pIsvalidate Indica que la regla de negocio, es de validacion +@param pExecutionorder A indica que la regla esta activa, I regla Inactiva +*/ +public TgeneTransactionItemProcess(TgeneTransactionItemProcessKey pPk,String pIsvalidate,Integer pExecutionorder){ + this(); + pk=pPk; + isvalidate=pIsvalidate; + executionorder=pExecutionorder; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionItemProcess +*/ +public static TgeneTransactionItemProcess find(EntityManager pEntityManager,TgeneTransactionItemProcessKey pKey) throws Exception{ + TgeneTransactionItemProcess obj = pEntityManager.find(TgeneTransactionItemProcess.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionItemProcess +@return El objeto que referencia a la Clave primaria de TgeneTransactionItemProcess +*/ +public TgeneTransactionItemProcessKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionItemProcess +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionItemProcess +*/ +public void setPk(TgeneTransactionItemProcessKey pPk){ + pk=pPk; +} +/**Obtiene el valor de processcode +@return valor de processcode*/ +public String getProcesscode(){ + return processcode; +} +/**Fija el valor de processcode +@param pProcesscode nuevo Valor de processcode*/ +public void setProcesscode(String pProcesscode){ + processcode=pProcesscode; +} + +/**Obtiene el valor de catalogtypeprocess +@return valor de catalogtypeprocess*/ +public String getCatalogtypeprocess(){ + return catalogtypeprocess; +} +/**Fija el valor de catalogtypeprocess +@param pCatalogtypeprocess nuevo Valor de catalogtypeprocess*/ +public void setCatalogtypeprocess(String pCatalogtypeprocess){ + catalogtypeprocess=pCatalogtypeprocess; +} + +/**Obtiene el valor de catalogcodetypeprocess +@return valor de catalogcodetypeprocess*/ +public String getCatalogcodetypeprocess(){ + return catalogcodetypeprocess; +} +/**Fija el valor de catalogcodetypeprocess +@param pCatalogcodetypeprocess nuevo Valor de catalogcodetypeprocess*/ +public void setCatalogcodetypeprocess(String pCatalogcodetypeprocess){ + catalogcodetypeprocess=pCatalogcodetypeprocess; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de isvalidate +@return valor de isvalidate*/ +public String getIsvalidate(){ + return isvalidate; +} +/**Fija el valor de isvalidate +@param pIsvalidate nuevo Valor de isvalidate*/ +public void setIsvalidate(String pIsvalidate){ + isvalidate=pIsvalidate; +} + +/**Obtiene el valor de executionorder +@return valor de executionorder*/ +public Integer getExecutionorder(){ + return executionorder; +} +/**Fija el valor de executionorder +@param pExecutionorder nuevo Valor de executionorder*/ +public void setExecutionorder(Integer pExecutionorder){ + executionorder=pExecutionorder; +} + +/**Obtiene el valor de status +@return valor de status*/ +public String getStatus(){ + return status; +} +/**Fija el valor de status +@param pStatus nuevo Valor de status*/ +public void setStatus(String pStatus){ + status=pStatus; +} + +/**Obtiene el valor de managecache +@return valor de managecache*/ +public String getManagecache(){ + return managecache; +} +/**Fija el valor de managecache +@param pManagecache nuevo Valor de managecache*/ +public void setManagecache(String pManagecache){ + managecache=pManagecache; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionItemProcess))return false; + TgeneTransactionItemProcess that = (TgeneTransactionItemProcess) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTransactionItemProcess +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTransactionItemProcess +*/ +public Object createInstance(){ + TgeneTransactionItemProcess instance=new TgeneTransactionItemProcess(); + instance.setPk(new TgeneTransactionItemProcessKey()); + return instance; +} +/**Clona la entidad TgeneTransactionItemProcess +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionItemProcess p=(TgeneTransactionItemProcess)this.clone(); + p.setPk((TgeneTransactionItemProcessKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionItemProcessKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionItemProcessKey.java.svn-base new file mode 100644 index 0000000..543753c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionItemProcessKey.java.svn-base @@ -0,0 +1,205 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONITEMPROCESS*/ +@Embeddable +public class TgeneTransactionItemProcessKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="ITEMCODE", nullable=false,updatable=false) + +/** +* Sequencia de items dentro de la transaccion +*/ +private Integer itemcode; + +@Column(name="SEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del comando para el item +*/ +private Integer sequence; + +/**Contructor por defecto*/ +public TgeneTransactionItemProcessKey(){} +/**Contructor de TgeneTransactionItemProcessKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pItemcode Sequencia de items dentro de la transaccion +@param pSequence Secuencia del comando para el item +*/ +public TgeneTransactionItemProcessKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,Integer pItemcode,Integer pSequence){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + itemcode=pItemcode; + sequence=pSequence; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de itemcode +@return valor de itemcode*/ +public Integer getItemcode(){ + return itemcode; +} +/**Fija el valor de itemcode +@param pItemcode nuevo Valor de itemcode*/ +public void setItemcode(Integer pItemcode){ + itemcode=pItemcode; +} + +/**Obtiene el valor de sequence +@return valor de sequence*/ +public Integer getSequence(){ + return sequence; +} +/**Fija el valor de sequence +@param pSequence nuevo Valor de sequence*/ +public void setSequence(Integer pSequence){ + sequence=pSequence; +} + +/**Implementacin de la comparacin de TgeneTransactionItemProcessKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionItemProcessKey))return false; + TgeneTransactionItemProcessKey that = (TgeneTransactionItemProcessKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getItemcode() == null || that.getItemcode() == null){ + return false; + } + if (! this.getItemcode().equals(that.getItemcode())){ + return false; + } + if (this.getSequence() == null || that.getSequence() == null){ + return false; + } + if (! this.getSequence().equals(that.getSequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransactionItemProcessKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getItemcode() == null ? 0 : this.getItemcode().hashCode()); + result = result * 37 + (this.getSequence() == null ? 0 : this.getSequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionKey.java.svn-base new file mode 100644 index 0000000..0498d20 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTION*/ +@Embeddable +public class TgeneTransactionKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +/**Contructor por defecto*/ +public TgeneTransactionKey(){} +/**Contructor de TgeneTransactionKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +*/ +public TgeneTransactionKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Implementacion de la comparacion de TgeneTransactionKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionKey))return false; + TgeneTransactionKey that = (TgeneTransactionKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneTransactionKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionProcess.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionProcess.java.svn-base new file mode 100644 index 0000000..0d1bde8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionProcess.java.svn-base @@ -0,0 +1,431 @@ +package com.fp.persistence.pgeneral.trans; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONPROCESS */ +@Entity(name = "TgeneTransactionProcess") +@Table(name = "TGENETRANSACTIONPROCESS") +public class TgeneTransactionProcess extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneTransactionProcess + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(SEQUENCE),0)+1 from TGENETRANSACTIONPROCESS " + + "where TRANSACTIONMODULE=:transactionmodule " + "and TRANSACTIONCODE=:transactioncode " + + "and TRANSACTIONVERSION=:transactionversion "), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "transactionmodule,pk.transactionmodule;transactioncode,pk.transactioncode;transactionversion,pk.transactionversion"), + @Parameter(name = "field", value = "sequence") }) + @GeneratedValue(generator = "seq_id") + private TgeneTransactionProcessKey pk; + + @Column(name = "PROCESSCODE", nullable = true) + /** + * Paquete clase de un comando a ejecutar. + */ + private String processcode; + + @Column(name = "CATALOGTYPEPROCESS", nullable = true) + /** + * Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia + */ + private String catalogtypeprocess; + + @Column(name = "CATALOGCODETYPEPROCESS", nullable = true) + /** + * Codigo de tabla de catalogo del proceso de negocio de la aplicacion + */ + private String catalogcodetypeprocess; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "EXECUTIONORDER", nullable = true) + /** + * orden de ejecucion de la regla de negocio. + */ + private Integer executionorder; + + @Column(name = "STATUS", nullable = true) + /** + * A indica que la regla esta activa, I regla Inactiva + */ + private String status; + + @Column(name = "MANAGECACHE", nullable = true) + /** + * Indica si el registro se almacena en cache del servidor de aplicaicones + */ + private String managecache; + + @Column(name = "ISFLOW", nullable = true) + /** + * Y Indica que el origen de ejecucion del componente es un flujo del bpm + */ + private String isflow; + + @Column(name = "PROCESSNAME", nullable = true) + /** + * Nombre del flujo bpm a ejecutar + */ + private String processname; + + @Column(name = "RULENAME", nullable = true) + /** + * Nombre de la regla a ejecutar + */ + private String rulename; + + @Column(name = "FLOWMESSAGECODE", nullable = true) + /** + * Codigo de mensaje del flujo a presentar al cliente + */ + private String flowmessagecode; + + /** Contructor por defecto */ + public TgeneTransactionProcess() { + } + + /** + * Contructor de TgeneTransactionProcess + * + * @param pPk Clave Primaria del entity + */ + public TgeneTransactionProcess(TgeneTransactionProcessKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneTransactionProcess + */ + public static TgeneTransactionProcess find(EntityManager pEntityManager, TgeneTransactionProcessKey pKey) throws Exception { + TgeneTransactionProcess obj = pEntityManager.find(TgeneTransactionProcess.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneTransactionProcess + * + * @return El objeto que referencia a la Clave primaria de TgeneTransactionProcess + */ + public TgeneTransactionProcessKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneTransactionProcess + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionProcess + */ + public void setPk(TgeneTransactionProcessKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de processcode + * + * @return valor de processcode + */ + public String getProcesscode() { + return processcode; + } + + /** + * Fija el valor de processcode + * + * @param pProcesscode nuevo Valor de processcode + */ + public void setProcesscode(String pProcesscode) { + processcode = pProcesscode; + } + + /** + * Obtiene el valor de catalogtypeprocess + * + * @return valor de catalogtypeprocess + */ + public String getCatalogtypeprocess() { + return catalogtypeprocess; + } + + /** + * Fija el valor de catalogtypeprocess + * + * @param pCatalogtypeprocess nuevo Valor de catalogtypeprocess + */ + public void setCatalogtypeprocess(String pCatalogtypeprocess) { + catalogtypeprocess = pCatalogtypeprocess; + } + + /** + * Obtiene el valor de catalogcodetypeprocess + * + * @return valor de catalogcodetypeprocess + */ + public String getCatalogcodetypeprocess() { + return catalogcodetypeprocess; + } + + /** + * Fija el valor de catalogcodetypeprocess + * + * @param pCatalogcodetypeprocess nuevo Valor de catalogcodetypeprocess + */ + public void setCatalogcodetypeprocess(String pCatalogcodetypeprocess) { + catalogcodetypeprocess = pCatalogcodetypeprocess; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de executionorder + * + * @return valor de executionorder + */ + public Integer getExecutionorder() { + return executionorder; + } + + /** + * Fija el valor de executionorder + * + * @param pExecutionorder nuevo Valor de executionorder + */ + public void setExecutionorder(Integer pExecutionorder) { + executionorder = pExecutionorder; + } + + /** + * Obtiene el valor de status + * + * @return valor de status + */ + public String getStatus() { + return status; + } + + /** + * Fija el valor de status + * + * @param pStatus nuevo Valor de status + */ + public void setStatus(String pStatus) { + status = pStatus; + } + + /** + * Obtiene el valor de managecache + * + * @return valor de managecache + */ + public String getManagecache() { + return managecache; + } + + /** + * Fija el valor de managecache + * + * @param pManagecache nuevo Valor de managecache + */ + public void setManagecache(String pManagecache) { + managecache = pManagecache; + } + + /** + * Obtiene el valor de isflow + * + * @return valor de isflow + */ + public String getIsflow() { + return isflow; + } + + /** + * Fija el valor de isflow + * + * @param pIsflow nuevo Valor de isflow + */ + public void setIsflow(String pIsflow) { + isflow = pIsflow; + } + + /** + * Obtiene el valor de processname + * + * @return valor de processname + */ + public String getProcessname() { + return processname; + } + + /** + * Fija el valor de processname + * + * @param pProcessname nuevo Valor de processname + */ + public void setProcessname(String pProcessname) { + processname = pProcessname; + } + + /** + * Obtiene el valor de rulename + * + * @return valor de rulename + */ + public String getRulename() { + return rulename; + } + + /** + * Fija el valor de rulename + * + * @param pRulename nuevo Valor de rulename + */ + public void setRulename(String pRulename) { + rulename = pRulename; + } + + /** + * Obtiene el valor de flowmessagecode + * + * @return valor de flowmessagecode + */ + public String getFlowmessagecode() { + return flowmessagecode; + } + + /** + * Fija el valor de flowmessagecode + * + * @param pFlowmessagecode nuevo Valor de flowmessagecode + */ + public void setFlowmessagecode(String pFlowmessagecode) { + flowmessagecode = pFlowmessagecode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneTransactionProcess)) + return false; + TgeneTransactionProcess that = (TgeneTransactionProcess) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneTransactionProcess + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneTransactionProcess */ + @Override + public Object createInstance() { + TgeneTransactionProcess instance = new TgeneTransactionProcess(); + instance.setPk(new TgeneTransactionProcessKey()); + return instance; + } + + /** + * Clona la entidad TgeneTransactionProcess + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneTransactionProcess p = (TgeneTransactionProcess) this.clone(); + p.setPk((TgeneTransactionProcessKey) this.pk.cloneMe()); + return p; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionProcessKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionProcessKey.java.svn-base new file mode 100644 index 0000000..5e09a13 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionProcessKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONPROCESS*/ +@Embeddable +public class TgeneTransactionProcessKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="SEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del comando +*/ +private Integer sequence; + +/**Contructor por defecto*/ +public TgeneTransactionProcessKey(){} +/**Contructor de TgeneTransactionProcessKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pSequence Secuencia del comando +*/ +public TgeneTransactionProcessKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,Integer pSequence){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + sequence=pSequence; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de sequence +@return valor de sequence*/ +public Integer getSequence(){ + return sequence; +} +/**Fija el valor de sequence +@param pSequence nuevo Valor de sequence*/ +public void setSequence(Integer pSequence){ + sequence=pSequence; +} + +/**Implementacin de la comparacin de TgeneTransactionProcessKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionProcessKey))return false; + TgeneTransactionProcessKey that = (TgeneTransactionProcessKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getSequence() == null || that.getSequence() == null){ + return false; + } + if (! this.getSequence().equals(that.getSequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransactionProcessKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getSequence() == null ? 0 : this.getSequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionProvision.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionProvision.java.svn-base new file mode 100644 index 0000000..d4c63a9 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionProvision.java.svn-base @@ -0,0 +1,177 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONPROVISION*/ +@Entity(name="TgeneTransactionProvision") +@Table(name="TGENETRANSACTIONPROVISION") +public class TgeneTransactionProvision extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransactionProvision +*/ +@EmbeddedId +private TgeneTransactionProvisionKey pk; +@Column(name="PROVISIONFROM", nullable=true) + +/** +* B Indica que provisiona desde la fecha de inicio del sobregiro o de la cuota, E incica que provisiona desde el vencimiento del sobregiro o cuota. +*/ +private String provisionfrom; + +@Column(name="PROVISIONTO", nullable=true) + +/** +* E incica que provisiona hasta el vencimiento del sobregiro o cuota. P indica que provisiona hasta la fecha de pago del sobregiro o cuota. +*/ +private String provisionto; + +@Column(name="BASEAMOUNT", nullable=true) + +/** +* Q El monto base para el calculo es el capital de lac cuota, C El monto base es el capital reducido, E Es un valor especial en el que se suma varios tipos de saldo de una cuota. +*/ +private String baseamount; + +/**Contructor por defecto*/ +public TgeneTransactionProvision(){ +} +/**Contructor de TgeneTransactionProvision +@param pPk Clave Primaria del entity +*/ +public TgeneTransactionProvision(TgeneTransactionProvisionKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionProvision +*/ +public static TgeneTransactionProvision find(EntityManager pEntityManager,TgeneTransactionProvisionKey pKey) throws Exception{ + TgeneTransactionProvision obj = pEntityManager.find(TgeneTransactionProvision.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionProvision +@return El objeto que referencia a la Clave primaria de TgeneTransactionProvision +*/ +public TgeneTransactionProvisionKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionProvision +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionProvision +*/ +public void setPk(TgeneTransactionProvisionKey pPk){ + pk=pPk; +} +/**Obtiene el valor de provisionfrom +@return valor de provisionfrom*/ +public String getProvisionfrom(){ + return provisionfrom; +} +/**Fija el valor de provisionfrom +@param pProvisionfrom nuevo Valor de provisionfrom*/ +public void setProvisionfrom(String pProvisionfrom){ + provisionfrom=pProvisionfrom; +} + +/**Obtiene el valor de provisionto +@return valor de provisionto*/ +public String getProvisionto(){ + return provisionto; +} +/**Fija el valor de provisionto +@param pProvisionto nuevo Valor de provisionto*/ +public void setProvisionto(String pProvisionto){ + provisionto=pProvisionto; +} + +/**Obtiene el valor de baseamount +@return valor de baseamount*/ +public String getBaseamount(){ + return baseamount; +} +/**Fija el valor de baseamount +@param pBaseamount nuevo Valor de baseamount*/ +public void setBaseamount(String pBaseamount){ + baseamount=pBaseamount; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionProvision))return false; + TgeneTransactionProvision that = (TgeneTransactionProvision) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTransactionProvision +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTransactionProvision +*/ +public Object createInstance(){ + TgeneTransactionProvision instance=new TgeneTransactionProvision(); + instance.setPk(new TgeneTransactionProvisionKey()); + return instance; +} +/**Clona la entidad TgeneTransactionProvision +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionProvision p=(TgeneTransactionProvision)this.clone(); + p.setPk((TgeneTransactionProvisionKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionProvisionKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionProvisionKey.java.svn-base new file mode 100644 index 0000000..7f8bea1 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/.svn/text-base/TgeneTransactionProvisionKey.java.svn-base @@ -0,0 +1,232 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONPROVISION*/ +@Embeddable +public class TgeneTransactionProvisionKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CAPITALBALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo de capital sobre el cual se calcula intereses, ejemplo capital prestamos, sobregiro contratado utilizado. +*/ +private String capitalbalancetype; + +@Column(name="CAPITALBALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo al cual pertenece el tipo de saldos de capital +*/ +private String capitalbalancegroup; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo de provision. +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, al que pertenece el tipo de saldo de capital. +*/ +private String balancegroup; + +/**Contructor por defecto*/ +public TgeneTransactionProvisionKey(){} +/**Contructor de TgeneTransactionProvisionKey +@param pCapitalbalancetype Cdigo de tipo de saldo de capital sobre el cual se calcula intereses, ejemplo capital prestamos, sobregiro contratado utilizado. +@param pCapitalbalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo al cual pertenece el tipo de saldos de capital +@param pModulecode Codigo de modulo +@param pStatuscode Estatus de cuenta +@param pBalancetype Cdigo de tipo de saldo de provision. +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, al que pertenece el tipo de saldo de capital. +*/ +public TgeneTransactionProvisionKey(String pCapitalbalancetype,String pCapitalbalancegroup,String pModulecode,String pStatuscode,String pBalancetype,String pBalancegroup){ + capitalbalancetype=pCapitalbalancetype; + capitalbalancegroup=pCapitalbalancegroup; + modulecode=pModulecode; + statuscode=pStatuscode; + balancetype=pBalancetype; + balancegroup=pBalancegroup; +} +/**Obtiene el valor de capitalbalancetype +@return valor de capitalbalancetype*/ +public String getCapitalbalancetype(){ + return capitalbalancetype; +} +/**Fija el valor de capitalbalancetype +@param pCapitalbalancetype nuevo Valor de capitalbalancetype*/ +public void setCapitalbalancetype(String pCapitalbalancetype){ + capitalbalancetype=pCapitalbalancetype; +} + +/**Obtiene el valor de capitalbalancegroup +@return valor de capitalbalancegroup*/ +public String getCapitalbalancegroup(){ + return capitalbalancegroup; +} +/**Fija el valor de capitalbalancegroup +@param pCapitalbalancegroup nuevo Valor de capitalbalancegroup*/ +public void setCapitalbalancegroup(String pCapitalbalancegroup){ + capitalbalancegroup=pCapitalbalancegroup; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Implementacin de la comparacin de TgeneTransactionProvisionKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionProvisionKey))return false; + TgeneTransactionProvisionKey that = (TgeneTransactionProvisionKey) o; + if (this.getCapitalbalancetype() == null || that.getCapitalbalancetype() == null){ + return false; + } + if (! this.getCapitalbalancetype().equals(that.getCapitalbalancetype())){ + return false; + } + if (this.getCapitalbalancegroup() == null || that.getCapitalbalancegroup() == null){ + return false; + } + if (! this.getCapitalbalancegroup().equals(that.getCapitalbalancegroup())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransactionProvisionKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCapitalbalancetype() == null ? 0 : this.getCapitalbalancetype().hashCode()); + result = result * 37 + (this.getCapitalbalancegroup() == null ? 0 : this.getCapitalbalancegroup().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransaction.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransaction.java new file mode 100644 index 0000000..0993992 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransaction.java @@ -0,0 +1,542 @@ +package com.fp.persistence.pgeneral.trans; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTION */ +@Entity(name = "TgeneTransaction") +@Table(name = "TGENETRANSACTION") +public class TgeneTransaction extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneTransaction + */ + @EmbeddedId + private TgeneTransactionKey pk; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "NAME", nullable = true) + /** + * Nombre de la Transaccion + */ + private String name; + + @Column(name = "PAGE", nullable = true) + /** + * Pagina que dispara el inicio de la transacion + */ + private String page; + + @Column(name = "AUTOQUERY", nullable = true) + /** + * Indicador de si la transaccion debe consultarse automaticamente al ser llamada + */ + private String autoquery; + + @Column(name = "INTERNAL", nullable = true) + /** + * Transaccion interna. Las transacciones internas no se presentan en el men. + */ + private String internal; + + @Column(name = "IMMOBILIZATION", nullable = true) + /** + * Indica si la transaccin es de cliente y afecta la fecha de ultimo movimiento de cuenta para inmovilizacion. + */ + private String immobilization; + + @Column(name = "COMPLETETARIFFITEMS", nullable = true) + /** + * Indica que la transaccion completa rubros de impuestos, cargos, comisiones + */ + private String completetariffitems; + + @Column(name = "FINANCIALPROCESS", nullable = true) + /** + * Indica si la transaccion, tiene definido procesos que se ejecutan, junto a la transaccion finanicera. + */ + private String financialprocess; + + @Column(name = "MANAGECACHE", nullable = true) + /** + * Indica si el registro se almacena en cache del servidor de aplicaicones + */ + private String managecache; + + @Column(name = "SIGNATURE", nullable = true) + /** + * Indica si se habilita la presentacion de la firma en la transaccion, ejemplo pago de cheques + */ + private String signature; + + @Column(name = "INBOX", nullable = true) + /** + * Y indica que cuando se ejecuta la transaccion, se consulta informacion del indbox. + */ + private String inbox; + + @Column(name = "MESSAGECODE", nullable = true) + /** + * Codigo de plantilla de mensajes + */ + private Integer messagecode; + + @Column(name = "QUERYAGAIN", nullable = true) + /** + * Campo que indica si se debe realizar o no una consulta despues de un mantenimiento + */ + private String queryagain; + + @Column(name = "QUERYCODE", nullable = true) + /** + * QUERYCODE + */ + private String querycode; + + @Column(name = "BRANCHAMONG", nullable = true) + /** + * Indica si la transaccion genera intersucursales + */ + private String branchamong; + + @Column(name = "JSFPAGE", nullable = true) + /** + * Pagina jsf + */ + private String jsfpage; + + + + + /** Contructor por defecto */ + public TgeneTransaction() { + } + + /** + * Contructor de TgeneTransaction + * + * @param pPk Clave Primaria del entity + */ + public TgeneTransaction(TgeneTransactionKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneTransaction + */ + public static TgeneTransaction find(EntityManager pEntityManager, TgeneTransactionKey pKey) throws Exception { + TgeneTransaction obj = pEntityManager.find(TgeneTransaction.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneTransaction + * + * @return El objeto que referencia a la Clave primaria de TgeneTransaction + */ + public TgeneTransactionKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneTransaction + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransaction + */ + public void setPk(TgeneTransactionKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de name + * + * @return valor de name + */ + public String getName() { + return name; + } + + /** + * Fija el valor de name + * + * @param pName nuevo Valor de name + */ + public void setName(String pName) { + name = pName; + } + + /** + * Obtiene el valor de page + * + * @return valor de page + */ + public String getPage() { + return page; + } + + /** + * Fija el valor de page + * + * @param pPage nuevo Valor de page + */ + public void setPage(String pPage) { + page = pPage; + } + + /** + * Obtiene el valor de page + * + * @return valor de page + */ + public String getJsfpage() { + return jsfpage; + } + + /** + * Fija el valor de page + * + * @param pPage nuevo Valor de page + */ + public void setJsfpage(String pJsfpage) { + jsfpage = pJsfpage; + } + + /** + * Obtiene el valor de autoquery + * + * @return valor de autoquery + */ + public String getAutoquery() { + return autoquery; + } + + /** + * Fija el valor de autoquery + * + * @param pAutoquery nuevo Valor de autoquery + */ + public void setAutoquery(String pAutoquery) { + autoquery = pAutoquery; + } + + /** + * Obtiene el valor de internal + * + * @return valor de internal + */ + public String getInternal() { + return internal; + } + + /** + * Fija el valor de internal + * + * @param pInternal nuevo Valor de internal + */ + public void setInternal(String pInternal) { + internal = pInternal; + } + + /** + * Obtiene el valor de immobilization + * + * @return valor de immobilization + */ + public String getImmobilization() { + return immobilization; + } + + /** + * Fija el valor de immobilization + * + * @param pImmobilization nuevo Valor de immobilization + */ + public void setImmobilization(String pImmobilization) { + immobilization = pImmobilization; + } + + /** + * Obtiene el valor de completetariffitems + * + * @return valor de completetariffitems + */ + public String getCompletetariffitems() { + return completetariffitems; + } + + /** + * Fija el valor de completetariffitems + * + * @param pCompletetariffitems nuevo Valor de completetariffitems + */ + public void setCompletetariffitems(String pCompletetariffitems) { + completetariffitems = pCompletetariffitems; + } + + /** + * Obtiene el valor de financialprocess + * + * @return valor de financialprocess + */ + public String getFinancialprocess() { + return financialprocess; + } + + /** + * Fija el valor de financialprocess + * + * @param pFinancialprocess nuevo Valor de financialprocess + */ + public void setFinancialprocess(String pFinancialprocess) { + financialprocess = pFinancialprocess; + } + + /** + * Obtiene el valor de managecache + * + * @return valor de managecache + */ + public String getManagecache() { + return managecache; + } + + /** + * Fija el valor de managecache + * + * @param pManagecache nuevo Valor de managecache + */ + public void setManagecache(String pManagecache) { + managecache = pManagecache; + } + + /** + * Obtiene el valor de signature + * + * @return valor de signature + */ + public String getSignature() { + return signature; + } + + /** + * Fija el valor de signature + * + * @param pSignature nuevo Valor de signature + */ + public void setSignature(String pSignature) { + signature = pSignature; + } + + /** + * Obtiene el valor de inbox + * + * @return valor de inbox + */ + public String getInbox() { + return inbox; + } + + /** + * Fija el valor de inbox + * + * @param pInbox nuevo Valor de inbox + */ + public void setInbox(String pInbox) { + inbox = pInbox; + } + + /** + * Obtiene el valor de messagecode + * + * @return valor de messagecode + */ + public Integer getMessagecode() { + return messagecode; + } + + /** + * Fija el valor de messagecode + * + * @param pMessagecode nuevo Valor de messagecode + */ + public void setMessagecode(Integer pMessagecode) { + messagecode = pMessagecode; + } + + /** + * Obtiene el valor de queryagain + * + * @return valor de queryagain + */ + public String getQueryagain() { + return queryagain; + } + + /** + * Fija el valor de queryagain + * + * @param pQueryagain nuevo Valor de queryagain + */ + public void setQueryagain(String pQueryagain) { + queryagain = pQueryagain; + } + + /** + * Obtiene el valor de querycode + * + * @return valor de querycode + */ + public String getQuerycode() { + return querycode; + } + + /** + * Fija el valor de querycode + * + * @param pQuerycode nuevo Valor de querycode + */ + public void setQuerycode(String pQuerycode) { + querycode = pQuerycode; + } + + /** + * Obtiene el valor de branchamong + * + * @return valor de branchamong + */ + public String getBranchamong() { + return branchamong; + } + + /** + * Fija el valor de branchamong + * + * @param pBranchamong nuevo Valor de branchamong + */ + public void setBranchamong(String pBranchamong) { + branchamong = pBranchamong; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneTransaction)) + return false; + TgeneTransaction that = (TgeneTransaction) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad TgeneTransaction + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco TgeneTransaction */ + @Override + public Object createInstance() { + TgeneTransaction instance = new TgeneTransaction(); + instance.setPk(new TgeneTransactionKey()); + return instance; + } + + /** + * Clona la entidad TgeneTransaction + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneTransaction p = (TgeneTransaction) this.clone(); + p.setPk((TgeneTransactionKey) this.pk.cloneMe()); + return p; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionEvent.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionEvent.java new file mode 100644 index 0000000..6798f73 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionEvent.java @@ -0,0 +1,241 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.Query; + +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.core.exception.CoreException; +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONEVENT */ +@Entity(name = "TgeneTransactionEvent") +@Table(name = "TGENETRANSACTIONEVENT") +public class TgeneTransactionEvent extends com.fp.dto.AbstractDataTransport + implements + Serializable,HibernateBean,Cloneable,Cache { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneTransactionEvent + */ + @EmbeddedId + private TgeneTransactionEventKey pk; + @Column(name = "TRANSACTIONMODULE", nullable = true) + /** + * Modulo al que pertence la transaccion + */ + private String transactionmodule; + + @Column(name = "TRANSACTIONCODE", nullable = true) + /** + * Codigo de transaccion dentro del modulo + */ + private Integer transactioncode; + + @Column(name = "TRANSACTIONVERSION", nullable = true) + /** + * Version de transaccion + */ + private Integer transactionversion; + + /** Contructor por defecto */ + public TgeneTransactionEvent() { + } + /** + * Contructor de TgeneTransactionEvent + * + * @param pPk Clave Primaria del entity + */ + public TgeneTransactionEvent(TgeneTransactionEventKey pPk) { + this(); + pk = pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneTransactionEvent + */ + public static TgeneTransactionEvent find(EntityManager pEntityManager, TgeneTransactionEventKey pKey) + throws Exception { + TgeneTransactionEvent obj = pEntityManager.find(TgeneTransactionEvent.class, pKey); + return obj; + } + /** + * Entrega la Clave primaria de TgeneTransactionEvent + * + * @return El objeto que referencia a la Clave primaria de TgeneTransactionEvent + */ + public TgeneTransactionEventKey getPk() { + return pk; + } + /** + * Fija un nuevo valor a la Clave primaria de TgeneTransactionEvent + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionEvent + */ + public void setPk(TgeneTransactionEventKey pPk) { + pk = pPk; + } + /** + * Obtiene el valor de transactionmodule + * + * @return valor de transactionmodule + */ + public String getTransactionmodule() { + return transactionmodule; + } + /** + * Fija el valor de transactionmodule + * + * @param pTransactionmodule nuevo Valor de transactionmodule + */ + public void setTransactionmodule(String pTransactionmodule) { + transactionmodule = pTransactionmodule; + } + + /** + * Obtiene el valor de transactioncode + * + * @return valor de transactioncode + */ + public Integer getTransactioncode() { + return transactioncode; + } + /** + * Fija el valor de transactioncode + * + * @param pTransactioncode nuevo Valor de transactioncode + */ + public void setTransactioncode(Integer pTransactioncode) { + transactioncode = pTransactioncode; + } + + /** + * Obtiene el valor de transactionversion + * + * @return valor de transactionversion + */ + public Integer getTransactionversion() { + return transactionversion; + } + /** + * Fija el valor de transactionversion + * + * @param pTransactionversion nuevo Valor de transactionversion + */ + public void setTransactionversion(Integer pTransactionversion) { + transactionversion = pTransactionversion; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneTransactionEvent)) + return false; + TgeneTransactionEvent that = (TgeneTransactionEvent) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /** + * Implementacin del metodo hashCode de la la entidad TgeneTransactionEvent + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + /** Implementacin de la creacin de un bean en blanco TgeneTransactionEvent */ + public Object createInstance() { + TgeneTransactionEvent instance = new TgeneTransactionEvent(); + instance.setPk(new TgeneTransactionEventKey()); + return instance; + } + /** + * Clona la entidad TgeneTransactionEvent + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneTransactionEvent p = (TgeneTransactionEvent) this.clone(); + p.setPk((TgeneTransactionEventKey) this.pk.cloneMe()); + return p; + } + + //Metodos manuales. + /** Sentencia que devuelve un registro de TgeneTransactionEvent.*/ + private static final String HQL_EVENT = + "from TgeneTransactionEvent t " + + " where t.pk.eventcode = :eventcode "+ + " and t.pk.modulecode = :modulecode "; + + /** + * Metodo que entrega la transaccion a ejecutar dado un codigo de evento. + * @param pEntityManager Referencia a la session de base de datos. + * @param pEventCode Codigo de evento. + * @param pModuleCode Modulo al que pertenece el evento. + * @return TgeneTransactionEvent + * @throws Exception + */ + public static TgeneTransactionEvent find(EntityManager pEntityManager,String pEventCode,String pModuleCode) throws Exception { + Query qry = pEntityManager.createQuery(HQL_EVENT); + TgeneTransactionEvent obj = null; + qry.setParameter("eventcode", pEventCode); + qry.setParameter("modulecode", pModuleCode); + try { + obj = (TgeneTransactionEvent)qry.getSingleResult(); + } catch (NoResultException e) { + throw new CoreException("CORE-0036","EVENTO NO DEFINIDO EN TGENETRANSACTIONEVENT EVENT:{0} MODULE:{1}", + pEventCode,pModuleCode); + } + return obj; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionEventKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionEventKey.java new file mode 100644 index 0000000..3219b41 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionEventKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONEVENT*/ +@Embeddable +public class TgeneTransactionEventKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="EVENTCODE", nullable=false,updatable=false) + +/** +* Codigo de evento a ejecutar, Ejemplo PAYMENT pago de credito +*/ +private String eventcode; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +/**Contructor por defecto*/ +public TgeneTransactionEventKey(){} +/**Contructor de TgeneTransactionEventKey +@param pEventcode Codigo de evento a ejecutar, Ejemplo PAYMENT pago de credito +@param pModulecode Codigo de modulo +*/ +public TgeneTransactionEventKey(String pEventcode,String pModulecode){ + eventcode=pEventcode; + modulecode=pModulecode; +} +/**Obtiene el valor de eventcode +@return valor de eventcode*/ +public String getEventcode(){ + return eventcode; +} +/**Fija el valor de eventcode +@param pEventcode nuevo Valor de eventcode*/ +public void setEventcode(String pEventcode){ + eventcode=pEventcode; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Implementacin de la comparacin de TgeneTransactionEventKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionEventKey))return false; + TgeneTransactionEventKey that = (TgeneTransactionEventKey) o; + if (this.getEventcode() == null || that.getEventcode() == null){ + return false; + } + if (! this.getEventcode().equals(that.getEventcode())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransactionEventKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getEventcode() == null ? 0 : this.getEventcode().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionFinanProcess.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionFinanProcess.java new file mode 100644 index 0000000..761b8fb --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionFinanProcess.java @@ -0,0 +1,273 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONFINANPROCESS*/ +@Entity(name="TgeneTransactionFinanProcess") +@Table(name="TGENETRANSACTIONFINANPROCESS") +public class TgeneTransactionFinanProcess extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransactionFinanProcess +*/ +@EmbeddedId +private TgeneTransactionFinanProcessKey pk; +@Column(name="PROCESSCODE", nullable=true) + +/** +* Paquete clase de un comando a ejecutar. +*/ +private String processcode; + +@Column(name="CATALOGTYPEPROCESS", nullable=true) + +/** +* Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia +*/ +private String catalogtypeprocess; + +@Column(name="CATALOGCODETYPEPROCESS", nullable=true) + +/** +* Codigo de tabla de catalogo del proceso de negocio de la aplicacion +*/ +private String catalogcodetypeprocess; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="EVENT", nullable=false) + +/** +* Proceso de negocio a ejecuatr en B (Begin) inicio de la transaccion, P (Process) proceso de la transaccion, E (End) Fin de la transaccion +*/ +private String event; + +@Column(name="EXECUTIONORDER", nullable=false) + +/** +* Orden de ejecucion del comando. +*/ +private Integer executionorder; + +@Column(name="STATUS", nullable=true) + +/** +* A indica que la regla esta activa, I regla Inactiva +*/ +private String status; + +@Column(name="MANAGECACHE", nullable=true) + +/** +* Indica si el registro se almacena en cache del servidor de aplicaicones +*/ +private String managecache; + +/**Contructor por defecto*/ +public TgeneTransactionFinanProcess(){ +} +/**Contructor de TgeneTransactionFinanProcess +@param pPk Clave Primaria del entity +@param pEvent Proceso de negocio a ejecuatr en B (Begin) inicio de la transaccion, P (Process) proceso de la transaccion, E (End) Fin de la transaccion +@param pExecutionorder Orden de ejecucion del comando. +*/ +public TgeneTransactionFinanProcess(TgeneTransactionFinanProcessKey pPk,String pEvent,Integer pExecutionorder){ + this(); + pk=pPk; + event=pEvent; + executionorder=pExecutionorder; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionFinanProcess +*/ +public static TgeneTransactionFinanProcess find(EntityManager pEntityManager,TgeneTransactionFinanProcessKey pKey) throws Exception{ + TgeneTransactionFinanProcess obj = pEntityManager.find(TgeneTransactionFinanProcess.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionFinanProcess +@return El objeto que referencia a la Clave primaria de TgeneTransactionFinanProcess +*/ +public TgeneTransactionFinanProcessKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionFinanProcess +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionFinanProcess +*/ +public void setPk(TgeneTransactionFinanProcessKey pPk){ + pk=pPk; +} +/**Obtiene el valor de processcode +@return valor de processcode*/ +public String getProcesscode(){ + return processcode; +} +/**Fija el valor de processcode +@param pProcesscode nuevo Valor de processcode*/ +public void setProcesscode(String pProcesscode){ + processcode=pProcesscode; +} + +/**Obtiene el valor de catalogtypeprocess +@return valor de catalogtypeprocess*/ +public String getCatalogtypeprocess(){ + return catalogtypeprocess; +} +/**Fija el valor de catalogtypeprocess +@param pCatalogtypeprocess nuevo Valor de catalogtypeprocess*/ +public void setCatalogtypeprocess(String pCatalogtypeprocess){ + catalogtypeprocess=pCatalogtypeprocess; +} + +/**Obtiene el valor de catalogcodetypeprocess +@return valor de catalogcodetypeprocess*/ +public String getCatalogcodetypeprocess(){ + return catalogcodetypeprocess; +} +/**Fija el valor de catalogcodetypeprocess +@param pCatalogcodetypeprocess nuevo Valor de catalogcodetypeprocess*/ +public void setCatalogcodetypeprocess(String pCatalogcodetypeprocess){ + catalogcodetypeprocess=pCatalogcodetypeprocess; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de event +@return valor de event*/ +public String getEvent(){ + return event; +} +/**Fija el valor de event +@param pEvent nuevo Valor de event*/ +public void setEvent(String pEvent){ + event=pEvent; +} + +/**Obtiene el valor de executionorder +@return valor de executionorder*/ +public Integer getExecutionorder(){ + return executionorder; +} +/**Fija el valor de executionorder +@param pExecutionorder nuevo Valor de executionorder*/ +public void setExecutionorder(Integer pExecutionorder){ + executionorder=pExecutionorder; +} + +/**Obtiene el valor de status +@return valor de status*/ +public String getStatus(){ + return status; +} +/**Fija el valor de status +@param pStatus nuevo Valor de status*/ +public void setStatus(String pStatus){ + status=pStatus; +} + +/**Obtiene el valor de managecache +@return valor de managecache*/ +public String getManagecache(){ + return managecache; +} +/**Fija el valor de managecache +@param pManagecache nuevo Valor de managecache*/ +public void setManagecache(String pManagecache){ + managecache=pManagecache; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionFinanProcess))return false; + TgeneTransactionFinanProcess that = (TgeneTransactionFinanProcess) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTransactionFinanProcess +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTransactionFinanProcess +*/ +public Object createInstance(){ + TgeneTransactionFinanProcess instance=new TgeneTransactionFinanProcess(); + instance.setPk(new TgeneTransactionFinanProcessKey()); + return instance; +} +/**Clona la entidad TgeneTransactionFinanProcess +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionFinanProcess p=(TgeneTransactionFinanProcess)this.clone(); + p.setPk((TgeneTransactionFinanProcessKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionFinanProcessKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionFinanProcessKey.java new file mode 100644 index 0000000..b83d34c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionFinanProcessKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONFINANPROCESS*/ +@Embeddable +public class TgeneTransactionFinanProcessKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="SEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del comando de la transaccion. +*/ +private Integer sequence; + +/**Contructor por defecto*/ +public TgeneTransactionFinanProcessKey(){} +/**Contructor de TgeneTransactionFinanProcessKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pSequence Secuencia del comando de la transaccion. +*/ +public TgeneTransactionFinanProcessKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,Integer pSequence){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + sequence=pSequence; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de sequence +@return valor de sequence*/ +public Integer getSequence(){ + return sequence; +} +/**Fija el valor de sequence +@param pSequence nuevo Valor de sequence*/ +public void setSequence(Integer pSequence){ + sequence=pSequence; +} + +/**Implementacin de la comparacin de TgeneTransactionFinanProcessKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionFinanProcessKey))return false; + TgeneTransactionFinanProcessKey that = (TgeneTransactionFinanProcessKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getSequence() == null || that.getSequence() == null){ + return false; + } + if (! this.getSequence().equals(that.getSequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransactionFinanProcessKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getSequence() == null ? 0 : this.getSequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionGlosary.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionGlosary.java new file mode 100644 index 0000000..b5d1c58 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionGlosary.java @@ -0,0 +1,251 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.*; +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/** + * Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONGLOSARY + */ +@Entity(name = "TgeneTransactionGlosary") +@Table(name = "TGENETRANSACTIONGLOSARY") +public class TgeneTransactionGlosary extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneTransactionGlosary + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(SEQUENCE),0)+1 from TGENETRANSACTIONGLOSARY " + + "where TRANSACTIONMODULE=:transactionmodule " + + "and TRANSACTIONCODE=:transactioncode " + + "and TRANSACTIONVERSION=:transactionversion " + + "and LANGUAGECODE = :languagecode"), + @Parameter(name = "type", value = "java.lang.Long"), + @Parameter(name = "param", value = "transactionmodule,pk.transactionmodule;transactioncode,pk.transactioncode;transactionversion,pk.transactionversion;languagecode,pk.languagecode"), + @Parameter(name = "field", value = "sequence")}) + @GeneratedValue(generator = "seq_id") + private TgeneTransactionGlosaryKey pk; + @Version + @Column(name = "RECORDVERSION", nullable = false) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + @Column(name = "DESCRIPTIONSHORT", nullable = false) + /** + * Descripcion de glosario + */ + private String descriptionshort; + @Column(name = "DESCRIPTION", nullable = false) + /** + * Descripcion del glosario + */ + private String description; + + /** + * Contructor por defecto + */ + public TgeneTransactionGlosary() { + } + + /** + * Contructor de TgeneTransactionGlosary + * + * @param pPk Clave Primaria del entity + * @param pRecordversion Optimistic locking del registro + * @param pDescriptionshort Descripcion de glosario + * @param pDescription Descripcion del glosario + */ + public TgeneTransactionGlosary(TgeneTransactionGlosaryKey pPk, Integer pRecordversion, String pDescriptionshort, String pDescription) { + this(); + pk = pPk; + recordversion = pRecordversion; + descriptionshort = pDescriptionshort; + description = pDescription; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneTransactionGlosary + */ + public static TgeneTransactionGlosary find(EntityManager pEntityManager, TgeneTransactionGlosaryKey pKey) throws Exception { + TgeneTransactionGlosary obj = pEntityManager.find(TgeneTransactionGlosary.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneTransactionGlosary + * + * @return El objeto que referencia a la Clave primaria de + * TgeneTransactionGlosary + */ + public TgeneTransactionGlosaryKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneTransactionGlosary + * + * @param pPk El objeto que referencia a la nueva Clave primaria de + * TgeneTransactionGlosary + */ + public void setPk(TgeneTransactionGlosaryKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de descriptionshort + * + * @return valor de descriptionshort + */ + public String getDescriptionshort() { + return descriptionshort; + } + + /** + * Fija el valor de descriptionshort + * + * @param pDescriptionshort nuevo Valor de descriptionshort + */ + public void setDescriptionshort(String pDescriptionshort) { + descriptionshort = pDescriptionshort; + } + + /** + * Obtiene el valor de description + * + * @return valor de description + */ + public String getDescription() { + return description; + } + + /** + * Fija el valor de description + * + * @param pDescription nuevo Valor de description + */ + public void setDescription(String pDescription) { + description = pDescription; + } + + public boolean equals(Object rhs) { + if (rhs == null) { + return false; + } + if (!(rhs instanceof TgeneTransactionGlosary)) { + return false; + } + TgeneTransactionGlosary that = (TgeneTransactionGlosary) rhs; + if (this.getPk() == null || that.getPk() == null) { + return false; + } + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad + * TgeneTransactionGlosary + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** + * Implementacion toString + */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) { + continue; + } + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) { + continue; + } + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** + * Implementacion de la creacion de un bean en blanco + * TgeneTransactionGlosary + */ + public Object createInstance() { + TgeneTransactionGlosary instance = new TgeneTransactionGlosary(); + instance.setPk(new TgeneTransactionGlosaryKey()); + return instance; + } + + /** + * Clona la entidad TgeneTransactionGlosary + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneTransactionGlosary p = (TgeneTransactionGlosary) this.clone(); + p.setPk((TgeneTransactionGlosaryKey) this.pk.cloneMe()); + return p; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionGlosaryKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionGlosaryKey.java new file mode 100644 index 0000000..e928ec9 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionGlosaryKey.java @@ -0,0 +1,205 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONGLOSARY*/ +@Embeddable +public class TgeneTransactionGlosaryKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="LANGUAGECODE", nullable=false,updatable=false) + +/** +* Codigo de idioma +*/ +private String languagecode; + +@Column(name="SEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia parael ingreso +*/ +private Long sequence; + +/**Contructor por defecto*/ +public TgeneTransactionGlosaryKey(){} +/**Contructor de TgeneTransactionGlosaryKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pLanguagecode Codigo de idioma +@param pSequence Secuencia parael ingreso +*/ +public TgeneTransactionGlosaryKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,String pLanguagecode,Long pSequence){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + languagecode=pLanguagecode; + sequence=pSequence; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de languagecode +@return valor de languagecode*/ +public String getLanguagecode(){ + return languagecode; +} +/**Fija el valor de languagecode +@param pLanguagecode nuevo Valor de languagecode*/ +public void setLanguagecode(String pLanguagecode){ + languagecode=pLanguagecode; +} + +/**Obtiene el valor de sequence +@return valor de sequence*/ +public Long getSequence(){ + return sequence; +} +/**Fija el valor de sequence +@param pSequence nuevo Valor de sequence*/ +public void setSequence(Long pSequence){ + sequence=pSequence; +} + +/**Implementacion de la comparacion de TgeneTransactionGlosaryKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionGlosaryKey))return false; + TgeneTransactionGlosaryKey that = (TgeneTransactionGlosaryKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getLanguagecode() == null || that.getLanguagecode() == null){ + return false; + } + if (! this.getLanguagecode().equals(that.getLanguagecode())){ + return false; + } + if (this.getSequence() == null || that.getSequence() == null){ + return false; + } + if (! this.getSequence().equals(that.getSequence())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneTransactionGlosaryKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getLanguagecode() == null ? 0 : this.getLanguagecode().hashCode()); + result = result * 37 + (this.getSequence() == null ? 0 : this.getSequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionItem.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionItem.java new file mode 100644 index 0000000..304e2d7 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionItem.java @@ -0,0 +1,195 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONITEM*/ +@Entity(name="TgeneTransactionItem") +@Table(name="TGENETRANSACTIONITEM") +public class TgeneTransactionItem extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransactionItem +*/ +@EmbeddedId +private TgeneTransactionItemKey pk; +@Column(name="DESCRIPTION", nullable=false) + +/** +* Descripcipn del item de la transaccin Ejemplo Efectivo. +*/ +private String description; + +@Column(name="SHOWINPAGE", nullable=true) + +/** +* null +*/ +private String showinpage; + +@Column(name="CALCUTATETARIFF", nullable=true) + +/** +* Se utiliza en paginas, Y indica que se tiene calcular el valor de un rubor en funcion a un tarifario. +*/ +private String calcutatetariff; + +@Column(name="EDITABLE", nullable=true) + +/** +* null +*/ +private String editable; + +/**Contructor por defecto*/ +public TgeneTransactionItem(){ +} +/**Contructor de TgeneTransactionItem +@param pPk Clave Primaria del entity +@param pDescription Descripcipn del item de la transaccin Ejemplo Efectivo. +*/ +public TgeneTransactionItem(TgeneTransactionItemKey pPk,String pDescription){ + this(); + pk=pPk; + description=pDescription; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionItem +*/ +public static TgeneTransactionItem find(EntityManager pEntityManager,TgeneTransactionItemKey pKey) throws Exception{ + TgeneTransactionItem obj = pEntityManager.find(TgeneTransactionItem.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionItem +@return El objeto que referencia a la Clave primaria de TgeneTransactionItem +*/ +public TgeneTransactionItemKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionItem +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionItem +*/ +public void setPk(TgeneTransactionItemKey pPk){ + pk=pPk; +} +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +/**Obtiene el valor de showinpage +@return valor de showinpage*/ +public String getShowinpage(){ + return showinpage; +} +/**Fija el valor de showinpage +@param pShowinpage nuevo Valor de showinpage*/ +public void setShowinpage(String pShowinpage){ + showinpage=pShowinpage; +} + +/**Obtiene el valor de calcutatetariff +@return valor de calcutatetariff*/ +public String getCalcutatetariff(){ + return calcutatetariff; +} +/**Fija el valor de calcutatetariff +@param pCalcutatetariff nuevo Valor de calcutatetariff*/ +public void setCalcutatetariff(String pCalcutatetariff){ + calcutatetariff=pCalcutatetariff; +} + +/**Obtiene el valor de editable +@return valor de editable*/ +public String getEditable(){ + return editable; +} +/**Fija el valor de editable +@param pEditable nuevo Valor de editable*/ +public void setEditable(String pEditable){ + editable=pEditable; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionItem))return false; + TgeneTransactionItem that = (TgeneTransactionItem) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTransactionItem +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTransactionItem +*/ +public Object createInstance(){ + TgeneTransactionItem instance=new TgeneTransactionItem(); + instance.setPk(new TgeneTransactionItemKey()); + return instance; +} +/**Clona la entidad TgeneTransactionItem +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionItem p=(TgeneTransactionItem)this.clone(); + p.setPk((TgeneTransactionItemKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionItemDetail.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionItemDetail.java new file mode 100644 index 0000000..19b0778 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionItemDetail.java @@ -0,0 +1,466 @@ +package com.fp.persistence.pgeneral.trans; + +import com.fp.dto.hb.Cache; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONITEMDETAIL*/ +@Entity(name="TgeneTransactionItemDetail") +@Table(name="TGENETRANSACTIONITEMDETAIL") +public class TgeneTransactionItemDetail extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransactionItemDetail +*/ +@EmbeddedId +private TgeneTransactionItemDetailKey pk; +@Column(name="DEBITCREDIT", nullable=true) + +/** +* Indica si el item afecta al debito o credito del par contable +*/ +private String debitcredit; + +@Column(name="BALANCETYPE", nullable=true) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=true) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="COMPLEMENTARYITEM", nullable=true) + +/** +* Item complementario utilizado para armar el asiento contable. +*/ +private Integer complementaryitem; + +@Column(name="REFERENCEITEM", nullable=true) + +/** +* Item de referencia del cual se obtien el monto base para calcular IMP, CAR, COM. +*/ +private Integer referenceitem; + +@Column(name="ASSOCIATEDITEM", nullable=true) + +/** +* Rubro asociado, se adiciona a la transaccion cuando se ejecuta un rubro de la transaccion ejemplo cobro de intereses en orden, se reversa de cuentas de orden +*/ +private Integer associateditem; + +@Column(name="COPYACCOUNTFROMREQUEST", nullable=true) + +/** +* Indica si el journal se graba con la cuenta del request, si el rubro es de debito se copia la cuenta debito, si el rubro es credito se copia la cuenta credito +*/ +private String copyaccountfromrequest; + +@Column(name="CONCEPTMODULE", nullable=true) + +/** +* Codigo de modulo +*/ +private String conceptmodule; + +@Column(name="CONCEPTCODE", nullable=true) + +/** +* Codigo de concepto +*/ +private Integer conceptcode; + +@Column(name="TEMPLATECODE", nullable=true) + +/** +* Cdigo de plantilla de cuentas por cobrar. +*/ +private Integer templatecode; + +@Column(name="REGISTERMOVEMENT", nullable=true) + +/** +* Indica si el item se graba en la tabla de movimiento y afecta el saldo de la cuenta +*/ +private String registermovement; + +@Column(name="TARIFF", nullable=true) + +/** +* Indica si sobre el rubro se calcula impouestos, cargos o comisiones. +*/ +private String tariff; + +@Column(name="ISTAX", nullable=true) + +/** +* Indica si el rubro es un impuesto, si la cuenta no tiene saldo para ejecutar la transaccin se cobra el cargo mas el proporcinal del impuesto, En la cxc se define calcula nuevamente el imopuesto +*/ +private String istax; + +@Column(name="ACCOUNTSTATEMENT", nullable=true) + +/** +* Indica si el movimiento se presenta en el estado de cuenta +*/ +private String accountstatement; + +@Column(name="OVERDRAW", nullable=true) + +/** +* Indica si el valor del rubro genera un sobregiro indirecto o un vario deudor en cuentas de ahorro, se utiliza en los cargos por servicios +*/ +private String overdraw; + +@Column(name="PROCESS", nullable=true) + +/** +* Indica si tiene o no procesos de negocio a ejecutar en el rubro. +*/ +private String process; + +@Column(name="MANAGECACHE", nullable=true) + +/** +* Indica si el registro se almacena en cache del servidor de aplicaciones. +*/ +private String managecache; + +@Column(name="ADDORSUB", nullable=true) + +/** +* Indica se suma o resta el saldo de la cuenta producto,Los valores pueden ser '+','-' y null +*/ +private String addorsub; + +/**Contructor por defecto*/ +public TgeneTransactionItemDetail(){ +} +/**Contructor de TgeneTransactionItemDetail +@param pPk Clave Primaria del entity +*/ +public TgeneTransactionItemDetail(TgeneTransactionItemDetailKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionItemDetail +*/ +public static TgeneTransactionItemDetail find(EntityManager pEntityManager,TgeneTransactionItemDetailKey pKey) throws Exception{ + TgeneTransactionItemDetail obj = pEntityManager.find(TgeneTransactionItemDetail.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionItemDetail +@return El objeto que referencia a la Clave primaria de TgeneTransactionItemDetail +*/ +public TgeneTransactionItemDetailKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionItemDetail +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionItemDetail +*/ +public void setPk(TgeneTransactionItemDetailKey pPk){ + pk=pPk; +} +/**Obtiene el valor de debitcredit +@return valor de debitcredit*/ +public String getDebitcredit(){ + return debitcredit; +} +/**Fija el valor de debitcredit +@param pDebitcredit nuevo Valor de debitcredit*/ +public void setDebitcredit(String pDebitcredit){ + debitcredit=pDebitcredit; +} + +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de complementaryitem +@return valor de complementaryitem*/ +public Integer getComplementaryitem(){ + return complementaryitem; +} +/**Fija el valor de complementaryitem +@param pComplementaryitem nuevo Valor de complementaryitem*/ +public void setComplementaryitem(Integer pComplementaryitem){ + complementaryitem=pComplementaryitem; +} + +/**Obtiene el valor de referenceitem +@return valor de referenceitem*/ +public Integer getReferenceitem(){ + return referenceitem; +} +/**Fija el valor de referenceitem +@param pReferenceitem nuevo Valor de referenceitem*/ +public void setReferenceitem(Integer pReferenceitem){ + referenceitem=pReferenceitem; +} + +/**Obtiene el valor de associateditem +@return valor de associateditem*/ +public Integer getAssociateditem(){ + return associateditem; +} +/**Fija el valor de associateditem +@param pAssociateditem nuevo Valor de associateditem*/ +public void setAssociateditem(Integer pAssociateditem){ + associateditem=pAssociateditem; +} + +/**Obtiene el valor de copyaccountfromrequest +@return valor de copyaccountfromrequest*/ +public String getCopyaccountfromrequest(){ + return copyaccountfromrequest; +} +/**Fija el valor de copyaccountfromrequest +@param pCopyaccountfromrequest nuevo Valor de copyaccountfromrequest*/ +public void setCopyaccountfromrequest(String pCopyaccountfromrequest){ + copyaccountfromrequest=pCopyaccountfromrequest; +} + +/**Obtiene el valor de conceptmodule +@return valor de conceptmodule*/ +public String getConceptmodule(){ + return conceptmodule; +} +/**Fija el valor de conceptmodule +@param pConceptmodule nuevo Valor de conceptmodule*/ +public void setConceptmodule(String pConceptmodule){ + conceptmodule=pConceptmodule; +} + +/**Obtiene el valor de conceptcode +@return valor de conceptcode*/ +public Integer getConceptcode(){ + return conceptcode; +} +/**Fija el valor de conceptcode +@param pConceptcode nuevo Valor de conceptcode*/ +public void setConceptcode(Integer pConceptcode){ + conceptcode=pConceptcode; +} + +/**Obtiene el valor de templatecode +@return valor de templatecode*/ +public Integer getTemplatecode(){ + return templatecode; +} +/**Fija el valor de templatecode +@param pTemplatecode nuevo Valor de templatecode*/ +public void setTemplatecode(Integer pTemplatecode){ + templatecode=pTemplatecode; +} + +/**Obtiene el valor de registermovement +@return valor de registermovement*/ +public String getRegistermovement(){ + return registermovement; +} +/**Fija el valor de registermovement +@param pRegistermovement nuevo Valor de registermovement*/ +public void setRegistermovement(String pRegistermovement){ + registermovement=pRegistermovement; +} + +/**Obtiene el valor de tariff +@return valor de tariff*/ +public String getTariff(){ + return tariff; +} +/**Fija el valor de tariff +@param pTariff nuevo Valor de tariff*/ +public void setTariff(String pTariff){ + tariff=pTariff; +} + +/**Obtiene el valor de istax +@return valor de istax*/ +public String getIstax(){ + return istax; +} +/**Fija el valor de istax +@param pIstax nuevo Valor de istax*/ +public void setIstax(String pIstax){ + istax=pIstax; +} + +/**Obtiene el valor de accountstatement +@return valor de accountstatement*/ +public String getAccountstatement(){ + return accountstatement; +} +/**Fija el valor de accountstatement +@param pAccountstatement nuevo Valor de accountstatement*/ +public void setAccountstatement(String pAccountstatement){ + accountstatement=pAccountstatement; +} + +/**Obtiene el valor de overdraw +@return valor de overdraw*/ +public String getOverdraw(){ + return overdraw; +} +/**Fija el valor de overdraw +@param pOverdraw nuevo Valor de overdraw*/ +public void setOverdraw(String pOverdraw){ + overdraw=pOverdraw; +} + +/**Obtiene el valor de process +@return valor de process*/ +public String getProcess(){ + return process; +} +/**Fija el valor de process +@param pProcess nuevo Valor de process*/ +public void setProcess(String pProcess){ + process=pProcess; +} + +/**Obtiene el valor de managecache +@return valor de managecache*/ +public String getManagecache(){ + return managecache; +} +/**Fija el valor de managecache +@param pManagecache nuevo Valor de managecache*/ +public void setManagecache(String pManagecache){ + managecache=pManagecache; +} + +/**Obtiene el valor de addorsub +@return valor de addorsub*/ +public String getAddorsub(){ + return addorsub; +} +/**Fija el valor de addorsub +@param pAddorsub nuevo Valor de addorsub*/ +public void setAddorsub(String pAddorsub){ + addorsub=pAddorsub; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionItemDetail))return false; + TgeneTransactionItemDetail that = (TgeneTransactionItemDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TgeneTransactionItemDetail +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TgeneTransactionItemDetail +*/ +public Object createInstance(){ + TgeneTransactionItemDetail instance=new TgeneTransactionItemDetail(); + instance.setPk(new TgeneTransactionItemDetailKey()); + return instance; +} +/**Clona la entidad TgeneTransactionItemDetail +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionItemDetail p=(TgeneTransactionItemDetail)this.clone(); + p.setPk((TgeneTransactionItemDetailKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionItemDetailKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionItemDetailKey.java new file mode 100644 index 0000000..fc138b0 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionItemDetailKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONITEMDETAIL*/ +@Embeddable +public class TgeneTransactionItemDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="ITEMCODE", nullable=false,updatable=false) + +/** +* Sequencia de items dentro de la transaccion +*/ +private Integer itemcode; + +/**Contructor por defecto*/ +public TgeneTransactionItemDetailKey(){} +/**Contructor de TgeneTransactionItemDetailKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pItemcode Sequencia de items dentro de la transaccion +*/ +public TgeneTransactionItemDetailKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,Integer pItemcode){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + itemcode=pItemcode; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de itemcode +@return valor de itemcode*/ +public Integer getItemcode(){ + return itemcode; +} +/**Fija el valor de itemcode +@param pItemcode nuevo Valor de itemcode*/ +public void setItemcode(Integer pItemcode){ + itemcode=pItemcode; +} + +/**Implementacion de la comparacion de TgeneTransactionItemDetailKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionItemDetailKey))return false; + TgeneTransactionItemDetailKey that = (TgeneTransactionItemDetailKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getItemcode() == null || that.getItemcode() == null){ + return false; + } + if (! this.getItemcode().equals(that.getItemcode())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneTransactionItemDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getItemcode() == null ? 0 : this.getItemcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionItemKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionItemKey.java new file mode 100644 index 0000000..4fd3182 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionItemKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONITEM*/ +@Embeddable +public class TgeneTransactionItemKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="ITEMCODE", nullable=false,updatable=false) + +/** +* Sequencia de items dentro de la transaccion +*/ +private Integer itemcode; + +/**Contructor por defecto*/ +public TgeneTransactionItemKey(){} +/**Contructor de TgeneTransactionItemKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pItemcode Sequencia de items dentro de la transaccion +*/ +public TgeneTransactionItemKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,Integer pItemcode){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + itemcode=pItemcode; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de itemcode +@return valor de itemcode*/ +public Integer getItemcode(){ + return itemcode; +} +/**Fija el valor de itemcode +@param pItemcode nuevo Valor de itemcode*/ +public void setItemcode(Integer pItemcode){ + itemcode=pItemcode; +} + +/**Implementacin de la comparacin de TgeneTransactionItemKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionItemKey))return false; + TgeneTransactionItemKey that = (TgeneTransactionItemKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getItemcode() == null || that.getItemcode() == null){ + return false; + } + if (! this.getItemcode().equals(that.getItemcode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransactionItemKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getItemcode() == null ? 0 : this.getItemcode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionItemProcess.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionItemProcess.java new file mode 100644 index 0000000..d634988 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionItemProcess.java @@ -0,0 +1,273 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONITEMPROCESS*/ +@Entity(name="TgeneTransactionItemProcess") +@Table(name="TGENETRANSACTIONITEMPROCESS") +public class TgeneTransactionItemProcess extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransactionItemProcess +*/ +@EmbeddedId +private TgeneTransactionItemProcessKey pk; +@Column(name="PROCESSCODE", nullable=true) + +/** +* Paquete clase de un comando a ejecutar. +*/ +private String processcode; + +@Column(name="CATALOGTYPEPROCESS", nullable=true) + +/** +* Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia +*/ +private String catalogtypeprocess; + +@Column(name="CATALOGCODETYPEPROCESS", nullable=true) + +/** +* Codigo de tabla de catalogo del proceso de negocio de la aplicacion +*/ +private String catalogcodetypeprocess; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="ISVALIDATE", nullable=false) + +/** +* Indica que la regla de negocio, es de validacion +*/ +private String isvalidate; + +@Column(name="EXECUTIONORDER", nullable=false) + +/** +* A indica que la regla esta activa, I regla Inactiva +*/ +private Integer executionorder; + +@Column(name="STATUS", nullable=true) + +/** +* A indica que el comando esta activo, I comando Inactivo +*/ +private String status; + +@Column(name="MANAGECACHE", nullable=true) + +/** +* Indica si el registro se almacena en cache del servidor de aplicaicones +*/ +private String managecache; + +/**Contructor por defecto*/ +public TgeneTransactionItemProcess(){ +} +/**Contructor de TgeneTransactionItemProcess +@param pPk Clave Primaria del entity +@param pIsvalidate Indica que la regla de negocio, es de validacion +@param pExecutionorder A indica que la regla esta activa, I regla Inactiva +*/ +public TgeneTransactionItemProcess(TgeneTransactionItemProcessKey pPk,String pIsvalidate,Integer pExecutionorder){ + this(); + pk=pPk; + isvalidate=pIsvalidate; + executionorder=pExecutionorder; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionItemProcess +*/ +public static TgeneTransactionItemProcess find(EntityManager pEntityManager,TgeneTransactionItemProcessKey pKey) throws Exception{ + TgeneTransactionItemProcess obj = pEntityManager.find(TgeneTransactionItemProcess.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionItemProcess +@return El objeto que referencia a la Clave primaria de TgeneTransactionItemProcess +*/ +public TgeneTransactionItemProcessKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionItemProcess +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionItemProcess +*/ +public void setPk(TgeneTransactionItemProcessKey pPk){ + pk=pPk; +} +/**Obtiene el valor de processcode +@return valor de processcode*/ +public String getProcesscode(){ + return processcode; +} +/**Fija el valor de processcode +@param pProcesscode nuevo Valor de processcode*/ +public void setProcesscode(String pProcesscode){ + processcode=pProcesscode; +} + +/**Obtiene el valor de catalogtypeprocess +@return valor de catalogtypeprocess*/ +public String getCatalogtypeprocess(){ + return catalogtypeprocess; +} +/**Fija el valor de catalogtypeprocess +@param pCatalogtypeprocess nuevo Valor de catalogtypeprocess*/ +public void setCatalogtypeprocess(String pCatalogtypeprocess){ + catalogtypeprocess=pCatalogtypeprocess; +} + +/**Obtiene el valor de catalogcodetypeprocess +@return valor de catalogcodetypeprocess*/ +public String getCatalogcodetypeprocess(){ + return catalogcodetypeprocess; +} +/**Fija el valor de catalogcodetypeprocess +@param pCatalogcodetypeprocess nuevo Valor de catalogcodetypeprocess*/ +public void setCatalogcodetypeprocess(String pCatalogcodetypeprocess){ + catalogcodetypeprocess=pCatalogcodetypeprocess; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de isvalidate +@return valor de isvalidate*/ +public String getIsvalidate(){ + return isvalidate; +} +/**Fija el valor de isvalidate +@param pIsvalidate nuevo Valor de isvalidate*/ +public void setIsvalidate(String pIsvalidate){ + isvalidate=pIsvalidate; +} + +/**Obtiene el valor de executionorder +@return valor de executionorder*/ +public Integer getExecutionorder(){ + return executionorder; +} +/**Fija el valor de executionorder +@param pExecutionorder nuevo Valor de executionorder*/ +public void setExecutionorder(Integer pExecutionorder){ + executionorder=pExecutionorder; +} + +/**Obtiene el valor de status +@return valor de status*/ +public String getStatus(){ + return status; +} +/**Fija el valor de status +@param pStatus nuevo Valor de status*/ +public void setStatus(String pStatus){ + status=pStatus; +} + +/**Obtiene el valor de managecache +@return valor de managecache*/ +public String getManagecache(){ + return managecache; +} +/**Fija el valor de managecache +@param pManagecache nuevo Valor de managecache*/ +public void setManagecache(String pManagecache){ + managecache=pManagecache; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionItemProcess))return false; + TgeneTransactionItemProcess that = (TgeneTransactionItemProcess) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTransactionItemProcess +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTransactionItemProcess +*/ +public Object createInstance(){ + TgeneTransactionItemProcess instance=new TgeneTransactionItemProcess(); + instance.setPk(new TgeneTransactionItemProcessKey()); + return instance; +} +/**Clona la entidad TgeneTransactionItemProcess +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionItemProcess p=(TgeneTransactionItemProcess)this.clone(); + p.setPk((TgeneTransactionItemProcessKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionItemProcessKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionItemProcessKey.java new file mode 100644 index 0000000..543753c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionItemProcessKey.java @@ -0,0 +1,205 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONITEMPROCESS*/ +@Embeddable +public class TgeneTransactionItemProcessKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="ITEMCODE", nullable=false,updatable=false) + +/** +* Sequencia de items dentro de la transaccion +*/ +private Integer itemcode; + +@Column(name="SEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del comando para el item +*/ +private Integer sequence; + +/**Contructor por defecto*/ +public TgeneTransactionItemProcessKey(){} +/**Contructor de TgeneTransactionItemProcessKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pItemcode Sequencia de items dentro de la transaccion +@param pSequence Secuencia del comando para el item +*/ +public TgeneTransactionItemProcessKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,Integer pItemcode,Integer pSequence){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + itemcode=pItemcode; + sequence=pSequence; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de itemcode +@return valor de itemcode*/ +public Integer getItemcode(){ + return itemcode; +} +/**Fija el valor de itemcode +@param pItemcode nuevo Valor de itemcode*/ +public void setItemcode(Integer pItemcode){ + itemcode=pItemcode; +} + +/**Obtiene el valor de sequence +@return valor de sequence*/ +public Integer getSequence(){ + return sequence; +} +/**Fija el valor de sequence +@param pSequence nuevo Valor de sequence*/ +public void setSequence(Integer pSequence){ + sequence=pSequence; +} + +/**Implementacin de la comparacin de TgeneTransactionItemProcessKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionItemProcessKey))return false; + TgeneTransactionItemProcessKey that = (TgeneTransactionItemProcessKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getItemcode() == null || that.getItemcode() == null){ + return false; + } + if (! this.getItemcode().equals(that.getItemcode())){ + return false; + } + if (this.getSequence() == null || that.getSequence() == null){ + return false; + } + if (! this.getSequence().equals(that.getSequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransactionItemProcessKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getItemcode() == null ? 0 : this.getItemcode().hashCode()); + result = result * 37 + (this.getSequence() == null ? 0 : this.getSequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionKey.java new file mode 100644 index 0000000..0498d20 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTION*/ +@Embeddable +public class TgeneTransactionKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +/**Contructor por defecto*/ +public TgeneTransactionKey(){} +/**Contructor de TgeneTransactionKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +*/ +public TgeneTransactionKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Implementacion de la comparacion de TgeneTransactionKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionKey))return false; + TgeneTransactionKey that = (TgeneTransactionKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TgeneTransactionKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionProcess.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionProcess.java new file mode 100644 index 0000000..0d1bde8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionProcess.java @@ -0,0 +1,431 @@ +package com.fp.persistence.pgeneral.trans; + +import java.io.Serializable; +import java.lang.reflect.Field; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; +import javax.persistence.Version; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONPROCESS */ +@Entity(name = "TgeneTransactionProcess") +@Table(name = "TGENETRANSACTIONPROCESS") +public class TgeneTransactionProcess extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad TgeneTransactionProcess + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(SEQUENCE),0)+1 from TGENETRANSACTIONPROCESS " + + "where TRANSACTIONMODULE=:transactionmodule " + "and TRANSACTIONCODE=:transactioncode " + + "and TRANSACTIONVERSION=:transactionversion "), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "transactionmodule,pk.transactionmodule;transactioncode,pk.transactioncode;transactionversion,pk.transactionversion"), + @Parameter(name = "field", value = "sequence") }) + @GeneratedValue(generator = "seq_id") + private TgeneTransactionProcessKey pk; + + @Column(name = "PROCESSCODE", nullable = true) + /** + * Paquete clase de un comando a ejecutar. + */ + private String processcode; + + @Column(name = "CATALOGTYPEPROCESS", nullable = true) + /** + * Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia + */ + private String catalogtypeprocess; + + @Column(name = "CATALOGCODETYPEPROCESS", nullable = true) + /** + * Codigo de tabla de catalogo del proceso de negocio de la aplicacion + */ + private String catalogcodetypeprocess; + + @Version + @Column(name = "RECORDVERSION", nullable = true) + /** + * Optimistic locking del registro + */ + private Integer recordversion; + + @Column(name = "EXECUTIONORDER", nullable = true) + /** + * orden de ejecucion de la regla de negocio. + */ + private Integer executionorder; + + @Column(name = "STATUS", nullable = true) + /** + * A indica que la regla esta activa, I regla Inactiva + */ + private String status; + + @Column(name = "MANAGECACHE", nullable = true) + /** + * Indica si el registro se almacena en cache del servidor de aplicaicones + */ + private String managecache; + + @Column(name = "ISFLOW", nullable = true) + /** + * Y Indica que el origen de ejecucion del componente es un flujo del bpm + */ + private String isflow; + + @Column(name = "PROCESSNAME", nullable = true) + /** + * Nombre del flujo bpm a ejecutar + */ + private String processname; + + @Column(name = "RULENAME", nullable = true) + /** + * Nombre de la regla a ejecutar + */ + private String rulename; + + @Column(name = "FLOWMESSAGECODE", nullable = true) + /** + * Codigo de mensaje del flujo a presentar al cliente + */ + private String flowmessagecode; + + /** Contructor por defecto */ + public TgeneTransactionProcess() { + } + + /** + * Contructor de TgeneTransactionProcess + * + * @param pPk Clave Primaria del entity + */ + public TgeneTransactionProcess(TgeneTransactionProcessKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneTransactionProcess + */ + public static TgeneTransactionProcess find(EntityManager pEntityManager, TgeneTransactionProcessKey pKey) throws Exception { + TgeneTransactionProcess obj = pEntityManager.find(TgeneTransactionProcess.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de TgeneTransactionProcess + * + * @return El objeto que referencia a la Clave primaria de TgeneTransactionProcess + */ + public TgeneTransactionProcessKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de TgeneTransactionProcess + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionProcess + */ + public void setPk(TgeneTransactionProcessKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de processcode + * + * @return valor de processcode + */ + public String getProcesscode() { + return processcode; + } + + /** + * Fija el valor de processcode + * + * @param pProcesscode nuevo Valor de processcode + */ + public void setProcesscode(String pProcesscode) { + processcode = pProcesscode; + } + + /** + * Obtiene el valor de catalogtypeprocess + * + * @return valor de catalogtypeprocess + */ + public String getCatalogtypeprocess() { + return catalogtypeprocess; + } + + /** + * Fija el valor de catalogtypeprocess + * + * @param pCatalogtypeprocess nuevo Valor de catalogtypeprocess + */ + public void setCatalogtypeprocess(String pCatalogtypeprocess) { + catalogtypeprocess = pCatalogtypeprocess; + } + + /** + * Obtiene el valor de catalogcodetypeprocess + * + * @return valor de catalogcodetypeprocess + */ + public String getCatalogcodetypeprocess() { + return catalogcodetypeprocess; + } + + /** + * Fija el valor de catalogcodetypeprocess + * + * @param pCatalogcodetypeprocess nuevo Valor de catalogcodetypeprocess + */ + public void setCatalogcodetypeprocess(String pCatalogcodetypeprocess) { + catalogcodetypeprocess = pCatalogcodetypeprocess; + } + + /** + * Obtiene el valor de recordversion + * + * @return valor de recordversion + */ + public Integer getRecordversion() { + return recordversion; + } + + /** + * Fija el valor de recordversion + * + * @param pRecordversion nuevo Valor de recordversion + */ + public void setRecordversion(Integer pRecordversion) { + recordversion = pRecordversion; + } + + /** + * Obtiene el valor de executionorder + * + * @return valor de executionorder + */ + public Integer getExecutionorder() { + return executionorder; + } + + /** + * Fija el valor de executionorder + * + * @param pExecutionorder nuevo Valor de executionorder + */ + public void setExecutionorder(Integer pExecutionorder) { + executionorder = pExecutionorder; + } + + /** + * Obtiene el valor de status + * + * @return valor de status + */ + public String getStatus() { + return status; + } + + /** + * Fija el valor de status + * + * @param pStatus nuevo Valor de status + */ + public void setStatus(String pStatus) { + status = pStatus; + } + + /** + * Obtiene el valor de managecache + * + * @return valor de managecache + */ + public String getManagecache() { + return managecache; + } + + /** + * Fija el valor de managecache + * + * @param pManagecache nuevo Valor de managecache + */ + public void setManagecache(String pManagecache) { + managecache = pManagecache; + } + + /** + * Obtiene el valor de isflow + * + * @return valor de isflow + */ + public String getIsflow() { + return isflow; + } + + /** + * Fija el valor de isflow + * + * @param pIsflow nuevo Valor de isflow + */ + public void setIsflow(String pIsflow) { + isflow = pIsflow; + } + + /** + * Obtiene el valor de processname + * + * @return valor de processname + */ + public String getProcessname() { + return processname; + } + + /** + * Fija el valor de processname + * + * @param pProcessname nuevo Valor de processname + */ + public void setProcessname(String pProcessname) { + processname = pProcessname; + } + + /** + * Obtiene el valor de rulename + * + * @return valor de rulename + */ + public String getRulename() { + return rulename; + } + + /** + * Fija el valor de rulename + * + * @param pRulename nuevo Valor de rulename + */ + public void setRulename(String pRulename) { + rulename = pRulename; + } + + /** + * Obtiene el valor de flowmessagecode + * + * @return valor de flowmessagecode + */ + public String getFlowmessagecode() { + return flowmessagecode; + } + + /** + * Fija el valor de flowmessagecode + * + * @param pFlowmessagecode nuevo Valor de flowmessagecode + */ + public void setFlowmessagecode(String pFlowmessagecode) { + flowmessagecode = pFlowmessagecode; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneTransactionProcess)) + return false; + TgeneTransactionProcess that = (TgeneTransactionProcess) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacin del metodo hashCode de la la entidad TgeneTransactionProcess + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + + /** Implementacin toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacin de la creacin de un bean en blanco TgeneTransactionProcess */ + @Override + public Object createInstance() { + TgeneTransactionProcess instance = new TgeneTransactionProcess(); + instance.setPk(new TgeneTransactionProcessKey()); + return instance; + } + + /** + * Clona la entidad TgeneTransactionProcess + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + TgeneTransactionProcess p = (TgeneTransactionProcess) this.clone(); + p.setPk((TgeneTransactionProcessKey) this.pk.cloneMe()); + return p; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionProcessKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionProcessKey.java new file mode 100644 index 0000000..5e09a13 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionProcessKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONPROCESS*/ +@Embeddable +public class TgeneTransactionProcessKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="SEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del comando +*/ +private Integer sequence; + +/**Contructor por defecto*/ +public TgeneTransactionProcessKey(){} +/**Contructor de TgeneTransactionProcessKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pSequence Secuencia del comando +*/ +public TgeneTransactionProcessKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,Integer pSequence){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + sequence=pSequence; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de sequence +@return valor de sequence*/ +public Integer getSequence(){ + return sequence; +} +/**Fija el valor de sequence +@param pSequence nuevo Valor de sequence*/ +public void setSequence(Integer pSequence){ + sequence=pSequence; +} + +/**Implementacin de la comparacin de TgeneTransactionProcessKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionProcessKey))return false; + TgeneTransactionProcessKey that = (TgeneTransactionProcessKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getSequence() == null || that.getSequence() == null){ + return false; + } + if (! this.getSequence().equals(that.getSequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransactionProcessKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getSequence() == null ? 0 : this.getSequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionProvision.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionProvision.java new file mode 100644 index 0000000..d4c63a9 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionProvision.java @@ -0,0 +1,177 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONPROVISION*/ +@Entity(name="TgeneTransactionProvision") +@Table(name="TGENETRANSACTIONPROVISION") +public class TgeneTransactionProvision extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransactionProvision +*/ +@EmbeddedId +private TgeneTransactionProvisionKey pk; +@Column(name="PROVISIONFROM", nullable=true) + +/** +* B Indica que provisiona desde la fecha de inicio del sobregiro o de la cuota, E incica que provisiona desde el vencimiento del sobregiro o cuota. +*/ +private String provisionfrom; + +@Column(name="PROVISIONTO", nullable=true) + +/** +* E incica que provisiona hasta el vencimiento del sobregiro o cuota. P indica que provisiona hasta la fecha de pago del sobregiro o cuota. +*/ +private String provisionto; + +@Column(name="BASEAMOUNT", nullable=true) + +/** +* Q El monto base para el calculo es el capital de lac cuota, C El monto base es el capital reducido, E Es un valor especial en el que se suma varios tipos de saldo de una cuota. +*/ +private String baseamount; + +/**Contructor por defecto*/ +public TgeneTransactionProvision(){ +} +/**Contructor de TgeneTransactionProvision +@param pPk Clave Primaria del entity +*/ +public TgeneTransactionProvision(TgeneTransactionProvisionKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionProvision +*/ +public static TgeneTransactionProvision find(EntityManager pEntityManager,TgeneTransactionProvisionKey pKey) throws Exception{ + TgeneTransactionProvision obj = pEntityManager.find(TgeneTransactionProvision.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionProvision +@return El objeto que referencia a la Clave primaria de TgeneTransactionProvision +*/ +public TgeneTransactionProvisionKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionProvision +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionProvision +*/ +public void setPk(TgeneTransactionProvisionKey pPk){ + pk=pPk; +} +/**Obtiene el valor de provisionfrom +@return valor de provisionfrom*/ +public String getProvisionfrom(){ + return provisionfrom; +} +/**Fija el valor de provisionfrom +@param pProvisionfrom nuevo Valor de provisionfrom*/ +public void setProvisionfrom(String pProvisionfrom){ + provisionfrom=pProvisionfrom; +} + +/**Obtiene el valor de provisionto +@return valor de provisionto*/ +public String getProvisionto(){ + return provisionto; +} +/**Fija el valor de provisionto +@param pProvisionto nuevo Valor de provisionto*/ +public void setProvisionto(String pProvisionto){ + provisionto=pProvisionto; +} + +/**Obtiene el valor de baseamount +@return valor de baseamount*/ +public String getBaseamount(){ + return baseamount; +} +/**Fija el valor de baseamount +@param pBaseamount nuevo Valor de baseamount*/ +public void setBaseamount(String pBaseamount){ + baseamount=pBaseamount; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionProvision))return false; + TgeneTransactionProvision that = (TgeneTransactionProvision) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTransactionProvision +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTransactionProvision +*/ +public Object createInstance(){ + TgeneTransactionProvision instance=new TgeneTransactionProvision(); + instance.setPk(new TgeneTransactionProvisionKey()); + return instance; +} +/**Clona la entidad TgeneTransactionProvision +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionProvision p=(TgeneTransactionProvision)this.clone(); + p.setPk((TgeneTransactionProvisionKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionProvisionKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionProvisionKey.java new file mode 100644 index 0000000..7f8bea1 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/TgeneTransactionProvisionKey.java @@ -0,0 +1,232 @@ +package com.fp.persistence.pgeneral.trans; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONPROVISION*/ +@Embeddable +public class TgeneTransactionProvisionKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="CAPITALBALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo de capital sobre el cual se calcula intereses, ejemplo capital prestamos, sobregiro contratado utilizado. +*/ +private String capitalbalancetype; + +@Column(name="CAPITALBALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo al cual pertenece el tipo de saldos de capital +*/ +private String capitalbalancegroup; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="STATUSCODE", nullable=false,updatable=false) + +/** +* Estatus de cuenta +*/ +private String statuscode; + +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo de provision. +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, al que pertenece el tipo de saldo de capital. +*/ +private String balancegroup; + +/**Contructor por defecto*/ +public TgeneTransactionProvisionKey(){} +/**Contructor de TgeneTransactionProvisionKey +@param pCapitalbalancetype Cdigo de tipo de saldo de capital sobre el cual se calcula intereses, ejemplo capital prestamos, sobregiro contratado utilizado. +@param pCapitalbalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo al cual pertenece el tipo de saldos de capital +@param pModulecode Codigo de modulo +@param pStatuscode Estatus de cuenta +@param pBalancetype Cdigo de tipo de saldo de provision. +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, al que pertenece el tipo de saldo de capital. +*/ +public TgeneTransactionProvisionKey(String pCapitalbalancetype,String pCapitalbalancegroup,String pModulecode,String pStatuscode,String pBalancetype,String pBalancegroup){ + capitalbalancetype=pCapitalbalancetype; + capitalbalancegroup=pCapitalbalancegroup; + modulecode=pModulecode; + statuscode=pStatuscode; + balancetype=pBalancetype; + balancegroup=pBalancegroup; +} +/**Obtiene el valor de capitalbalancetype +@return valor de capitalbalancetype*/ +public String getCapitalbalancetype(){ + return capitalbalancetype; +} +/**Fija el valor de capitalbalancetype +@param pCapitalbalancetype nuevo Valor de capitalbalancetype*/ +public void setCapitalbalancetype(String pCapitalbalancetype){ + capitalbalancetype=pCapitalbalancetype; +} + +/**Obtiene el valor de capitalbalancegroup +@return valor de capitalbalancegroup*/ +public String getCapitalbalancegroup(){ + return capitalbalancegroup; +} +/**Fija el valor de capitalbalancegroup +@param pCapitalbalancegroup nuevo Valor de capitalbalancegroup*/ +public void setCapitalbalancegroup(String pCapitalbalancegroup){ + capitalbalancegroup=pCapitalbalancegroup; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de statuscode +@return valor de statuscode*/ +public String getStatuscode(){ + return statuscode; +} +/**Fija el valor de statuscode +@param pStatuscode nuevo Valor de statuscode*/ +public void setStatuscode(String pStatuscode){ + statuscode=pStatuscode; +} + +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Implementacin de la comparacin de TgeneTransactionProvisionKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionProvisionKey))return false; + TgeneTransactionProvisionKey that = (TgeneTransactionProvisionKey) o; + if (this.getCapitalbalancetype() == null || that.getCapitalbalancetype() == null){ + return false; + } + if (! this.getCapitalbalancetype().equals(that.getCapitalbalancetype())){ + return false; + } + if (this.getCapitalbalancegroup() == null || that.getCapitalbalancegroup() == null){ + return false; + } + if (! this.getCapitalbalancegroup().equals(that.getCapitalbalancegroup())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getStatuscode() == null || that.getStatuscode() == null){ + return false; + } + if (! this.getStatuscode().equals(that.getStatuscode())){ + return false; + } + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransactionProvisionKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCapitalbalancetype() == null ? 0 : this.getCapitalbalancetype().hashCode()); + result = result * 37 + (this.getCapitalbalancegroup() == null ? 0 : this.getCapitalbalancegroup().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getStatuscode() == null ? 0 : this.getStatuscode().hashCode()); + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/report/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/report/.svn/entries new file mode 100644 index 0000000..0d33e7d --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/report/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/report +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneTransactionReportsKey.java +file + + + + +2022-07-28T03:40:29.487746Z +1586ca667cd2080a266776c9e72c3050 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5593 + +TgeneTransactionReports.java +file + + + + +2022-07-28T03:40:29.488746Z +54ba622e10ceac66cbb02b60dfa82a05 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8247 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/report/.svn/text-base/TgeneTransactionReports.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/report/.svn/text-base/TgeneTransactionReports.java.svn-base new file mode 100644 index 0000000..c26c60f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/report/.svn/text-base/TgeneTransactionReports.java.svn-base @@ -0,0 +1,267 @@ +package com.fp.persistence.pgeneral.trans.report; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONREPORTS*/ +@Entity(name="TgeneTransactionReports") +@Table(name="TGENETRANSACTIONREPORTS") +public class TgeneTransactionReports extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** + * Clave primaria de la Entidad TgeneTransactionProcess + */ +@EmbeddedId +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(SEQUENCE),0)+1 from TGENETRANSACTIONREPORTS " + + "where TRANSACTIONMODULE=:transactionmodule " + "and TRANSACTIONCODE=:transactioncode " + + "and TRANSACTIONVERSION=:transactionversion "), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "transactionmodule,pk.transactionmodule;transactioncode,pk.transactioncode;transactionversion,pk.transactionversion"), + @Parameter(name = "field", value = "sequence") }) +@GeneratedValue(generator = "seq_id") +private TgeneTransactionReportsKey pk; +@Column(name="PROCESSCODE", nullable=true) + +/** +* Paquete clase de un comando a ejecutar. +*/ +private String processcode; + +@Column(name="CATALOGTYPEPROCESS", nullable=true) + +/** +* Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia +*/ +private String catalogtypeprocess; + +@Column(name="CATALOGCODETYPEPROCESS", nullable=true) + +/** +* Codigo de tabla de catalogo del proceso de negocio de la aplicacion +*/ +private String catalogcodetypeprocess; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="EXECUTIONORDER", nullable=true) + +/** +* orden de ejecucion de la regla de negocio. +*/ +private Integer executionorder; + +@Column(name="STATUS", nullable=true) + +/** +* A indica que la regla esta activa, I regla Inactiva +*/ +private String status; + +@Column(name="MANAGECACHE", nullable=true) + +/** +* Indica si el registro se almacena en cache del servidor de aplicaicones +*/ +private String managecache; + +/**Contructor por defecto*/ +public TgeneTransactionReports(){ +} +/**Contructor de TgeneTransactionReports +@param pPk Clave Primaria del entity +*/ +public TgeneTransactionReports(TgeneTransactionReportsKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionReports +*/ +public static TgeneTransactionReports find(EntityManager pEntityManager,TgeneTransactionReportsKey pKey) throws Exception{ + TgeneTransactionReports obj = pEntityManager.find(TgeneTransactionReports.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionReports +@return El objeto que referencia a la Clave primaria de TgeneTransactionReports +*/ +public TgeneTransactionReportsKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionReports +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionReports +*/ +public void setPk(TgeneTransactionReportsKey pPk){ + pk=pPk; +} +/**Obtiene el valor de processcode +@return valor de processcode*/ +public String getProcesscode(){ + return processcode; +} +/**Fija el valor de processcode +@param pProcesscode nuevo Valor de processcode*/ +public void setProcesscode(String pProcesscode){ + processcode=pProcesscode; +} + +/**Obtiene el valor de catalogtypeprocess +@return valor de catalogtypeprocess*/ +public String getCatalogtypeprocess(){ + return catalogtypeprocess; +} +/**Fija el valor de catalogtypeprocess +@param pCatalogtypeprocess nuevo Valor de catalogtypeprocess*/ +public void setCatalogtypeprocess(String pCatalogtypeprocess){ + catalogtypeprocess=pCatalogtypeprocess; +} + +/**Obtiene el valor de catalogcodetypeprocess +@return valor de catalogcodetypeprocess*/ +public String getCatalogcodetypeprocess(){ + return catalogcodetypeprocess; +} +/**Fija el valor de catalogcodetypeprocess +@param pCatalogcodetypeprocess nuevo Valor de catalogcodetypeprocess*/ +public void setCatalogcodetypeprocess(String pCatalogcodetypeprocess){ + catalogcodetypeprocess=pCatalogcodetypeprocess; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de executionorder +@return valor de executionorder*/ +public Integer getExecutionorder(){ + return executionorder; +} +/**Fija el valor de executionorder +@param pExecutionorder nuevo Valor de executionorder*/ +public void setExecutionorder(Integer pExecutionorder){ + executionorder=pExecutionorder; +} + +/**Obtiene el valor de status +@return valor de status*/ +public String getStatus(){ + return status; +} +/**Fija el valor de status +@param pStatus nuevo Valor de status*/ +public void setStatus(String pStatus){ + status=pStatus; +} + +/**Obtiene el valor de managecache +@return valor de managecache*/ +public String getManagecache(){ + return managecache; +} +/**Fija el valor de managecache +@param pManagecache nuevo Valor de managecache*/ +public void setManagecache(String pManagecache){ + managecache=pManagecache; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionReports))return false; + TgeneTransactionReports that = (TgeneTransactionReports) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTransactionReports +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTransactionReports +*/ +public Object createInstance(){ + TgeneTransactionReports instance=new TgeneTransactionReports(); + instance.setPk(new TgeneTransactionReportsKey()); + return instance; +} +/**Clona la entidad TgeneTransactionReports +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionReports p=(TgeneTransactionReports)this.clone(); + p.setPk((TgeneTransactionReportsKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/report/.svn/text-base/TgeneTransactionReportsKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/report/.svn/text-base/TgeneTransactionReportsKey.java.svn-base new file mode 100644 index 0000000..bbbf736 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/report/.svn/text-base/TgeneTransactionReportsKey.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.trans.report; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONREPORTS*/ +@Embeddable +public class TgeneTransactionReportsKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="SEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del comando +*/ +private Integer sequence; + +/**Contructor por defecto*/ +public TgeneTransactionReportsKey(){} +/**Contructor de TgeneTransactionReportsKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pSequence Secuencia del comando +*/ +public TgeneTransactionReportsKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,Integer pSequence){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + sequence=pSequence; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de sequence +@return valor de sequence*/ +public Integer getSequence(){ + return sequence; +} +/**Fija el valor de sequence +@param pSequence nuevo Valor de sequence*/ +public void setSequence(Integer pSequence){ + sequence=pSequence; +} + +/**Implementacin de la comparacin de TgeneTransactionReportsKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionReportsKey))return false; + TgeneTransactionReportsKey that = (TgeneTransactionReportsKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getSequence() == null || that.getSequence() == null){ + return false; + } + if (! this.getSequence().equals(that.getSequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransactionReportsKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getSequence() == null ? 0 : this.getSequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/report/TgeneTransactionReports.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/report/TgeneTransactionReports.java new file mode 100644 index 0000000..c26c60f --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/report/TgeneTransactionReports.java @@ -0,0 +1,267 @@ +package com.fp.persistence.pgeneral.trans.report; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSACTIONREPORTS*/ +@Entity(name="TgeneTransactionReports") +@Table(name="TGENETRANSACTIONREPORTS") +public class TgeneTransactionReports extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** + * Clave primaria de la Entidad TgeneTransactionProcess + */ +@EmbeddedId +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(SEQUENCE),0)+1 from TGENETRANSACTIONREPORTS " + + "where TRANSACTIONMODULE=:transactionmodule " + "and TRANSACTIONCODE=:transactioncode " + + "and TRANSACTIONVERSION=:transactionversion "), + @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "transactionmodule,pk.transactionmodule;transactioncode,pk.transactioncode;transactionversion,pk.transactionversion"), + @Parameter(name = "field", value = "sequence") }) +@GeneratedValue(generator = "seq_id") +private TgeneTransactionReportsKey pk; +@Column(name="PROCESSCODE", nullable=true) + +/** +* Paquete clase de un comando a ejecutar. +*/ +private String processcode; + +@Column(name="CATALOGTYPEPROCESS", nullable=true) + +/** +* Codigo de catalogo GEN proceso general consulta, mantenimiento, TRA a nivel de transaccion finacniera, ITEM a niveld e rubro de una trnsaccion financiera, BATH comandos de fin de dia +*/ +private String catalogtypeprocess; + +@Column(name="CATALOGCODETYPEPROCESS", nullable=true) + +/** +* Codigo de tabla de catalogo del proceso de negocio de la aplicacion +*/ +private String catalogcodetypeprocess; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="EXECUTIONORDER", nullable=true) + +/** +* orden de ejecucion de la regla de negocio. +*/ +private Integer executionorder; + +@Column(name="STATUS", nullable=true) + +/** +* A indica que la regla esta activa, I regla Inactiva +*/ +private String status; + +@Column(name="MANAGECACHE", nullable=true) + +/** +* Indica si el registro se almacena en cache del servidor de aplicaicones +*/ +private String managecache; + +/**Contructor por defecto*/ +public TgeneTransactionReports(){ +} +/**Contructor de TgeneTransactionReports +@param pPk Clave Primaria del entity +*/ +public TgeneTransactionReports(TgeneTransactionReportsKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransactionReports +*/ +public static TgeneTransactionReports find(EntityManager pEntityManager,TgeneTransactionReportsKey pKey) throws Exception{ + TgeneTransactionReports obj = pEntityManager.find(TgeneTransactionReports.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransactionReports +@return El objeto que referencia a la Clave primaria de TgeneTransactionReports +*/ +public TgeneTransactionReportsKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransactionReports +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransactionReports +*/ +public void setPk(TgeneTransactionReportsKey pPk){ + pk=pPk; +} +/**Obtiene el valor de processcode +@return valor de processcode*/ +public String getProcesscode(){ + return processcode; +} +/**Fija el valor de processcode +@param pProcesscode nuevo Valor de processcode*/ +public void setProcesscode(String pProcesscode){ + processcode=pProcesscode; +} + +/**Obtiene el valor de catalogtypeprocess +@return valor de catalogtypeprocess*/ +public String getCatalogtypeprocess(){ + return catalogtypeprocess; +} +/**Fija el valor de catalogtypeprocess +@param pCatalogtypeprocess nuevo Valor de catalogtypeprocess*/ +public void setCatalogtypeprocess(String pCatalogtypeprocess){ + catalogtypeprocess=pCatalogtypeprocess; +} + +/**Obtiene el valor de catalogcodetypeprocess +@return valor de catalogcodetypeprocess*/ +public String getCatalogcodetypeprocess(){ + return catalogcodetypeprocess; +} +/**Fija el valor de catalogcodetypeprocess +@param pCatalogcodetypeprocess nuevo Valor de catalogcodetypeprocess*/ +public void setCatalogcodetypeprocess(String pCatalogcodetypeprocess){ + catalogcodetypeprocess=pCatalogcodetypeprocess; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de executionorder +@return valor de executionorder*/ +public Integer getExecutionorder(){ + return executionorder; +} +/**Fija el valor de executionorder +@param pExecutionorder nuevo Valor de executionorder*/ +public void setExecutionorder(Integer pExecutionorder){ + executionorder=pExecutionorder; +} + +/**Obtiene el valor de status +@return valor de status*/ +public String getStatus(){ + return status; +} +/**Fija el valor de status +@param pStatus nuevo Valor de status*/ +public void setStatus(String pStatus){ + status=pStatus; +} + +/**Obtiene el valor de managecache +@return valor de managecache*/ +public String getManagecache(){ + return managecache; +} +/**Fija el valor de managecache +@param pManagecache nuevo Valor de managecache*/ +public void setManagecache(String pManagecache){ + managecache=pManagecache; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransactionReports))return false; + TgeneTransactionReports that = (TgeneTransactionReports) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTransactionReports +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTransactionReports +*/ +public Object createInstance(){ + TgeneTransactionReports instance=new TgeneTransactionReports(); + instance.setPk(new TgeneTransactionReportsKey()); + return instance; +} +/**Clona la entidad TgeneTransactionReports +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransactionReports p=(TgeneTransactionReports)this.clone(); + p.setPk((TgeneTransactionReportsKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/report/TgeneTransactionReportsKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/report/TgeneTransactionReportsKey.java new file mode 100644 index 0000000..bbbf736 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/trans/report/TgeneTransactionReportsKey.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pgeneral.trans.report; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSACTIONREPORTS*/ +@Embeddable +public class TgeneTransactionReportsKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSACTIONMODULE", nullable=false,updatable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false,updatable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false,updatable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="SEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia del comando +*/ +private Integer sequence; + +/**Contructor por defecto*/ +public TgeneTransactionReportsKey(){} +/**Contructor de TgeneTransactionReportsKey +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +@param pSequence Secuencia del comando +*/ +public TgeneTransactionReportsKey(String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion,Integer pSequence){ + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; + sequence=pSequence; +} +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de sequence +@return valor de sequence*/ +public Integer getSequence(){ + return sequence; +} +/**Fija el valor de sequence +@param pSequence nuevo Valor de sequence*/ +public void setSequence(Integer pSequence){ + sequence=pSequence; +} + +/**Implementacin de la comparacin de TgeneTransactionReportsKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransactionReportsKey))return false; + TgeneTransactionReportsKey that = (TgeneTransactionReportsKey) o; + if (this.getTransactionmodule() == null || that.getTransactionmodule() == null){ + return false; + } + if (! this.getTransactionmodule().equals(that.getTransactionmodule())){ + return false; + } + if (this.getTransactioncode() == null || that.getTransactioncode() == null){ + return false; + } + if (! this.getTransactioncode().equals(that.getTransactioncode())){ + return false; + } + if (this.getTransactionversion() == null || that.getTransactionversion() == null){ + return false; + } + if (! this.getTransactionversion().equals(that.getTransactionversion())){ + return false; + } + if (this.getSequence() == null || that.getSequence() == null){ + return false; + } + if (! this.getSequence().equals(that.getSequence())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransactionReportsKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransactionmodule() == null ? 0 : this.getTransactionmodule().hashCode()); + result = result * 37 + (this.getTransactioncode() == null ? 0 : this.getTransactioncode().hashCode()); + result = result * 37 + (this.getTransactionversion() == null ? 0 : this.getTransactionversion().hashCode()); + result = result * 37 + (this.getSequence() == null ? 0 : this.getSequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/.svn/entries new file mode 100644 index 0000000..1af94c2 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneMaturationKey.java +file + + + + +2022-07-28T03:40:29.724747Z +1caa3711c28a0541c8dff4eb823119a6 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3844 + +TgeneTransferDetailKey.java +file + + + + +2022-07-28T03:40:29.724747Z +4b737d2209fdb122f7e3bb6ccce1b3d5 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7032 + +TgeneMaturation.java +file + + + + +2022-07-28T03:40:29.725747Z +f8d6e931958aeb53bbb924dfc5336ad5 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6313 + +TgeneTransfer.java +file + + + + +2022-07-28T03:40:29.725747Z +736ce0f4729eddbec35eb4090ff92076 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5898 + +TgeneTransferDetail.java +file + + + + +2022-07-28T03:40:29.725747Z +d6019621aa2affde840d35f0c1510de1 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9022 + +TgeneTransferStatus.java +file + + + + +2022-07-28T03:40:29.725747Z +32f3b48e749d29edc23a0c05e1e500cc +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5068 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/.svn/text-base/TgeneMaturation.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/.svn/text-base/TgeneMaturation.java.svn-base new file mode 100644 index 0000000..c0cbb7c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/.svn/text-base/TgeneMaturation.java.svn-base @@ -0,0 +1,231 @@ +package com.fp.persistence.pgeneral.transf; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMATURATION*/ +@Entity(name="TgeneMaturation") +@Table(name="TGENEMATURATION") +public class TgeneMaturation extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneMaturation +*/ +@EmbeddedId +private TgeneMaturationKey pk; +@Column(name="MODULECODE", nullable=true) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="TRANSACTIONMODULE", nullable=true) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=true) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=true) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="DEBITITEM", nullable=true) + +/** +* Item debito +*/ +private Integer debititem; + +@Column(name="CREDITITEM", nullable=true) + +/** +* Item credito +*/ +private Integer credititem; + +/**Contructor por defecto*/ +public TgeneMaturation(){ +} +/**Contructor de TgeneMaturation +@param pPk Clave Primaria del entity +*/ +public TgeneMaturation(TgeneMaturationKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneMaturation +*/ +public static TgeneMaturation find(EntityManager pEntityManager,TgeneMaturationKey pKey) throws Exception{ + TgeneMaturation obj = pEntityManager.find(TgeneMaturation.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneMaturation +@return El objeto que referencia a la Clave primaria de TgeneMaturation +*/ +public TgeneMaturationKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneMaturation +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneMaturation +*/ +public void setPk(TgeneMaturationKey pPk){ + pk=pPk; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de debititem +@return valor de debititem*/ +public Integer getDebititem(){ + return debititem; +} +/**Fija el valor de debititem +@param pDebititem nuevo Valor de debititem*/ +public void setDebititem(Integer pDebititem){ + debititem=pDebititem; +} + +/**Obtiene el valor de credititem +@return valor de credititem*/ +public Integer getCredititem(){ + return credititem; +} +/**Fija el valor de credititem +@param pCredititem nuevo Valor de credititem*/ +public void setCredititem(Integer pCredititem){ + credititem=pCredititem; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneMaturation))return false; + TgeneMaturation that = (TgeneMaturation) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneMaturation +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneMaturation +*/ +public Object createInstance(){ + TgeneMaturation instance=new TgeneMaturation(); + instance.setPk(new TgeneMaturationKey()); + return instance; +} +/**Clona la entidad TgeneMaturation +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneMaturation p=(TgeneMaturation)this.clone(); + p.setPk((TgeneMaturationKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/.svn/text-base/TgeneMaturationKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/.svn/text-base/TgeneMaturationKey.java.svn-base new file mode 100644 index 0000000..de36b70 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/.svn/text-base/TgeneMaturationKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.transf; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEMATURATION*/ +@Embeddable +public class TgeneMaturationKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +/**Contructor por defecto*/ +public TgeneMaturationKey(){} +/**Contructor de TgeneMaturationKey +@param pBalancetype Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +public TgeneMaturationKey(String pBalancetype,String pBalancegroup){ + balancetype=pBalancetype; + balancegroup=pBalancegroup; +} +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Implementacin de la comparacin de TgeneMaturationKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneMaturationKey))return false; + TgeneMaturationKey that = (TgeneMaturationKey) o; + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneMaturationKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/.svn/text-base/TgeneTransfer.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/.svn/text-base/TgeneTransfer.java.svn-base new file mode 100644 index 0000000..df7255b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/.svn/text-base/TgeneTransfer.java.svn-base @@ -0,0 +1,214 @@ +package com.fp.persistence.pgeneral.transf; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSFER*/ +@Entity(name="TgeneTransfer") +@Table(name="TGENETRANSFER") +public class TgeneTransfer extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransfer +*/ +@Id +@Column(name="TRANSFERCODE" ,nullable=false, updatable=false) +private Integer pk; +@Column(name="MODULECODE", nullable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="TRANSACTIONMODULE", nullable=true) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=true) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=true) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion de la transferencia. +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneTransfer(){ +} +/**Contructor de TgeneTransfer +@param pPk Clave Primaria del entity +@param pModulecode Codigo de modulo +*/ +public TgeneTransfer(Integer pPk,String pModulecode){ + this(); + pk=pPk; + modulecode=pModulecode; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransfer +*/ +public static TgeneTransfer find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneTransfer obj = pEntityManager.find(TgeneTransfer.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransfer +@return El objeto que referencia a la Clave primaria de TgeneTransfer +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransfer +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransfer +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransfer))return false; + TgeneTransfer that = (TgeneTransfer) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTransfer +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTransfer +*/ +public Object createInstance(){ + TgeneTransfer instance=new TgeneTransfer(); + return instance; +} +/**Clona la entidad TgeneTransfer +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransfer p=(TgeneTransfer)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/.svn/text-base/TgeneTransferDetail.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/.svn/text-base/TgeneTransferDetail.java.svn-base new file mode 100644 index 0000000..9d51ac8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/.svn/text-base/TgeneTransferDetail.java.svn-base @@ -0,0 +1,329 @@ +package com.fp.persistence.pgeneral.transf; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.SQLQuery; +import org.hibernate.Session; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSFERDETAIL */ +@Entity(name = "TgeneTransferDetail") +@Table(name = "TGENETRANSFERDETAIL") +public class TgeneTransferDetail extends com.fp.dto.AbstractDataTransport + implements + Serializable,HibernateBean,Cloneable,Cache { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneTransferDetail + */ + @EmbeddedId + private TgeneTransferDetailKey pk; + @Column(name = "TRANSACTIONMODULE", nullable = true) + /** + * Modulo al que pertence la transaccion + */ + private String transactionmodule; + + @Column(name = "TRANSACTIONCODE", nullable = true) + /** + * Codigo de transaccion dentro del modulo + */ + private Integer transactioncode; + + @Column(name = "TRANSACTIONVERSION", nullable = true) + /** + * Version de transaccion + */ + private Integer transactionversion; + + @Column(name = "DEBITITEM", nullable = true) + /** + * Codigo de rubro debito. + */ + private Integer debititem; + + @Column(name = "CREDITITEM", nullable = true) + /** + * Codigo de rubro credito. + */ + private Integer credititem; + + @Column(name = "REVERSEDEBITITEM", nullable = true) + /** + * Codigo de rubro asociado al debito de reverso. + */ + private Integer reversedebititem; + + @Column(name = "REVERSECREDITITEM", nullable = true) + /** + * Codigo de rubro asociado al credito de reverso. + */ + private Integer reversecredititem; + + /** Contructor por defecto */ + public TgeneTransferDetail() { + } + /** + * Contructor de TgeneTransferDetail + * + * @param pPk Clave Primaria del entity + */ + public TgeneTransferDetail(TgeneTransferDetailKey pPk) { + this(); + pk = pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneTransferDetail + */ + public static TgeneTransferDetail find(EntityManager pEntityManager, TgeneTransferDetailKey pKey) throws Exception { + TgeneTransferDetail obj = pEntityManager.find(TgeneTransferDetail.class, pKey); + return obj; + } + /** + * Entrega la Clave primaria de TgeneTransferDetail + * + * @return El objeto que referencia a la Clave primaria de TgeneTransferDetail + */ + public TgeneTransferDetailKey getPk() { + return pk; + } + /** + * Fija un nuevo valor a la Clave primaria de TgeneTransferDetail + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransferDetail + */ + public void setPk(TgeneTransferDetailKey pPk) { + pk = pPk; + } + /** + * Obtiene el valor de transactionmodule + * + * @return valor de transactionmodule + */ + public String getTransactionmodule() { + return transactionmodule; + } + /** + * Fija el valor de transactionmodule + * + * @param pTransactionmodule nuevo Valor de transactionmodule + */ + public void setTransactionmodule(String pTransactionmodule) { + transactionmodule = pTransactionmodule; + } + + /** + * Obtiene el valor de transactioncode + * + * @return valor de transactioncode + */ + public Integer getTransactioncode() { + return transactioncode; + } + /** + * Fija el valor de transactioncode + * + * @param pTransactioncode nuevo Valor de transactioncode + */ + public void setTransactioncode(Integer pTransactioncode) { + transactioncode = pTransactioncode; + } + + /** + * Obtiene el valor de transactionversion + * + * @return valor de transactionversion + */ + public Integer getTransactionversion() { + return transactionversion; + } + /** + * Fija el valor de transactionversion + * + * @param pTransactionversion nuevo Valor de transactionversion + */ + public void setTransactionversion(Integer pTransactionversion) { + transactionversion = pTransactionversion; + } + + /** + * Obtiene el valor de debititem + * + * @return valor de debititem + */ + public Integer getDebititem() { + return debititem; + } + /** + * Fija el valor de debititem + * + * @param pDebititem nuevo Valor de debititem + */ + public void setDebititem(Integer pDebititem) { + debititem = pDebititem; + } + + /** + * Obtiene el valor de credititem + * + * @return valor de credititem + */ + public Integer getCredititem() { + return credititem; + } + /** + * Fija el valor de credititem + * + * @param pCredititem nuevo Valor de credititem + */ + public void setCredititem(Integer pCredititem) { + credititem = pCredititem; + } + + /** + * Obtiene el valor de reversedebititem + * + * @return valor de reversedebititem + */ + public Integer getReversedebititem() { + return reversedebititem; + } + /** + * Fija el valor de reversedebititem + * + * @param pReversedebititem nuevo Valor de reversedebititem + */ + public void setReversedebititem(Integer pReversedebititem) { + reversedebititem = pReversedebititem; + } + + /** + * Obtiene el valor de reversecredititem + * + * @return valor de reversecredititem + */ + public Integer getReversecredititem() { + return reversecredititem; + } + /** + * Fija el valor de reversecredititem + * + * @param pReversecredititem nuevo Valor de reversecredititem + */ + public void setReversecredititem(Integer pReversecredititem) { + reversecredititem = pReversecredititem; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneTransferDetail)) + return false; + TgeneTransferDetail that = (TgeneTransferDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /** + * Implementacin del metodo hashCode de la la entidad TgeneTransferDetail + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + /** Implementacin de la creacin de un bean en blanco TgeneTransferDetail */ + public Object createInstance() { + TgeneTransferDetail instance = new TgeneTransferDetail(); + instance.setPk(new TgeneTransferDetailKey()); + return instance; + } + /** + * Clona la entidad TgeneTransferDetail + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneTransferDetail p = (TgeneTransferDetail) this.clone(); + p.setPk((TgeneTransferDetailKey) this.pk.cloneMe()); + return p; + } + + //Metodos manuales. + /**sentencia que elimina tgenetellertransferdetail*/ + private static final String DEL_TRANSF_DETAIL = + " delete from TGENETELLERTRANSFERDETAIL t " + + " where t.WORKINGDATE = :workingdate " + + " and t.USERCODE = :usercode " + + " and t.TRANSFERNUMBER = :transfernumber"; + /** + * Elimina un registro de la tabla para el usuario, fecha de trabajo y numero de transferencia. + * @param pEntityManager Referencia la session de la base de datos. + * @param pWorkingdate Fecha de trabajo. + * @param pUser Codigo de usuario. + * @param pTransfernumber Numero de transferencia. + * @throws Exception + */ + public static void delete(EntityManager pEntityManager,Date pWorkingdate,String pUser,Integer pTransfernumber) throws Exception { + //Elimina tgenetellertransferdetail + Session s = (Session)pEntityManager.getDelegate(); + SQLQuery sqldet = s.createSQLQuery(DEL_TRANSF_DETAIL); + sqldet.setDate("workingdate", pWorkingdate); + sqldet.setString("usercode", pUser); + sqldet.setInteger("transfernumber", pTransfernumber); + sqldet.executeUpdate(); + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/.svn/text-base/TgeneTransferDetailKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/.svn/text-base/TgeneTransferDetailKey.java.svn-base new file mode 100644 index 0000000..278d5cb --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/.svn/text-base/TgeneTransferDetailKey.java.svn-base @@ -0,0 +1,232 @@ +package com.fp.persistence.pgeneral.transf; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSFERDETAIL*/ +@Embeddable +public class TgeneTransferDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSFERCODE", nullable=false,updatable=false) + +/** +* Codigo de transferencia +*/ +private Integer transfercode; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +@Column(name="STATUSFROM", nullable=false,updatable=false) + +/** +* Estatus de cuenta actual +*/ +private String statusfrom; + +@Column(name="STATUSTO", nullable=false,updatable=false) + +/** +* Estatus al que se realiza la transaferencia +*/ +private String statusto; + +/**Contructor por defecto*/ +public TgeneTransferDetailKey(){} +/**Contructor de TgeneTransferDetailKey +@param pTransfercode Codigo de transferencia +@param pModulecode Codigo de modulo +@param pBalancetype Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +@param pStatusfrom Estatus de cuenta actual +@param pStatusto Estatus al que se realiza la transaferencia +*/ +public TgeneTransferDetailKey(Integer pTransfercode,String pModulecode,String pBalancetype,String pBalancegroup,String pStatusfrom,String pStatusto){ + transfercode=pTransfercode; + modulecode=pModulecode; + balancetype=pBalancetype; + balancegroup=pBalancegroup; + statusfrom=pStatusfrom; + statusto=pStatusto; +} +/**Obtiene el valor de transfercode +@return valor de transfercode*/ +public Integer getTransfercode(){ + return transfercode; +} +/**Fija el valor de transfercode +@param pTransfercode nuevo Valor de transfercode*/ +public void setTransfercode(Integer pTransfercode){ + transfercode=pTransfercode; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Obtiene el valor de statusfrom +@return valor de statusfrom*/ +public String getStatusfrom(){ + return statusfrom; +} +/**Fija el valor de statusfrom +@param pStatusfrom nuevo Valor de statusfrom*/ +public void setStatusfrom(String pStatusfrom){ + statusfrom=pStatusfrom; +} + +/**Obtiene el valor de statusto +@return valor de statusto*/ +public String getStatusto(){ + return statusto; +} +/**Fija el valor de statusto +@param pStatusto nuevo Valor de statusto*/ +public void setStatusto(String pStatusto){ + statusto=pStatusto; +} + +/**Implementacin de la comparacin de TgeneTransferDetailKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransferDetailKey))return false; + TgeneTransferDetailKey that = (TgeneTransferDetailKey) o; + if (this.getTransfercode() == null || that.getTransfercode() == null){ + return false; + } + if (! this.getTransfercode().equals(that.getTransfercode())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + if (this.getStatusfrom() == null || that.getStatusfrom() == null){ + return false; + } + if (! this.getStatusfrom().equals(that.getStatusfrom())){ + return false; + } + if (this.getStatusto() == null || that.getStatusto() == null){ + return false; + } + if (! this.getStatusto().equals(that.getStatusto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransferDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransfercode() == null ? 0 : this.getTransfercode().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + result = result * 37 + (this.getStatusfrom() == null ? 0 : this.getStatusfrom().hashCode()); + result = result * 37 + (this.getStatusto() == null ? 0 : this.getStatusto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/.svn/text-base/TgeneTransferStatus.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/.svn/text-base/TgeneTransferStatus.java.svn-base new file mode 100644 index 0000000..af0dfce --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/.svn/text-base/TgeneTransferStatus.java.svn-base @@ -0,0 +1,174 @@ +package com.fp.persistence.pgeneral.transf; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSFERSTATUS*/ +@Entity(name="TgeneTransferStatus") +@Table(name="TGENETRANSFERSTATUS") +public class TgeneTransferStatus extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransferStatus +*/ +@Id +@Column(name="CREDITTYPECODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="MODULECODE", nullable=true) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="EXPIREDSTATUSCODE", nullable=true) + +/** +* Estatus de cuotas que llegaron a la fecha de vencimiento. +*/ +private String expiredstatuscode; + +@Column(name="FUTURESTATUSCODE", nullable=true) + +/** +* Estatus de cotas cuya fecha de vencimiento esta en el futuro. +*/ +private String futurestatuscode; + +/**Contructor por defecto*/ +public TgeneTransferStatus(){ +} +/**Contructor de TgeneTransferStatus +@param pPk Clave Primaria del entity +*/ +public TgeneTransferStatus(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransferStatus +*/ +public static TgeneTransferStatus find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneTransferStatus obj = pEntityManager.find(TgeneTransferStatus.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransferStatus +@return El objeto que referencia a la Clave primaria de TgeneTransferStatus +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransferStatus +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransferStatus +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de expiredstatuscode +@return valor de expiredstatuscode*/ +public String getExpiredstatuscode(){ + return expiredstatuscode; +} +/**Fija el valor de expiredstatuscode +@param pExpiredstatuscode nuevo Valor de expiredstatuscode*/ +public void setExpiredstatuscode(String pExpiredstatuscode){ + expiredstatuscode=pExpiredstatuscode; +} + +/**Obtiene el valor de futurestatuscode +@return valor de futurestatuscode*/ +public String getFuturestatuscode(){ + return futurestatuscode; +} +/**Fija el valor de futurestatuscode +@param pFuturestatuscode nuevo Valor de futurestatuscode*/ +public void setFuturestatuscode(String pFuturestatuscode){ + futurestatuscode=pFuturestatuscode; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransferStatus))return false; + TgeneTransferStatus that = (TgeneTransferStatus) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTransferStatus +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTransferStatus +*/ +public Object createInstance(){ + TgeneTransferStatus instance=new TgeneTransferStatus(); + return instance; +} +/**Clona la entidad TgeneTransferStatus +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransferStatus p=(TgeneTransferStatus)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/TgeneMaturation.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/TgeneMaturation.java new file mode 100644 index 0000000..c0cbb7c --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/TgeneMaturation.java @@ -0,0 +1,231 @@ +package com.fp.persistence.pgeneral.transf; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEMATURATION*/ +@Entity(name="TgeneMaturation") +@Table(name="TGENEMATURATION") +public class TgeneMaturation extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneMaturation +*/ +@EmbeddedId +private TgeneMaturationKey pk; +@Column(name="MODULECODE", nullable=true) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="TRANSACTIONMODULE", nullable=true) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=true) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=true) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="DEBITITEM", nullable=true) + +/** +* Item debito +*/ +private Integer debititem; + +@Column(name="CREDITITEM", nullable=true) + +/** +* Item credito +*/ +private Integer credititem; + +/**Contructor por defecto*/ +public TgeneMaturation(){ +} +/**Contructor de TgeneMaturation +@param pPk Clave Primaria del entity +*/ +public TgeneMaturation(TgeneMaturationKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneMaturation +*/ +public static TgeneMaturation find(EntityManager pEntityManager,TgeneMaturationKey pKey) throws Exception{ + TgeneMaturation obj = pEntityManager.find(TgeneMaturation.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneMaturation +@return El objeto que referencia a la Clave primaria de TgeneMaturation +*/ +public TgeneMaturationKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneMaturation +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneMaturation +*/ +public void setPk(TgeneMaturationKey pPk){ + pk=pPk; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de debititem +@return valor de debititem*/ +public Integer getDebititem(){ + return debititem; +} +/**Fija el valor de debititem +@param pDebititem nuevo Valor de debititem*/ +public void setDebititem(Integer pDebititem){ + debititem=pDebititem; +} + +/**Obtiene el valor de credititem +@return valor de credititem*/ +public Integer getCredititem(){ + return credititem; +} +/**Fija el valor de credititem +@param pCredititem nuevo Valor de credititem*/ +public void setCredititem(Integer pCredititem){ + credititem=pCredititem; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneMaturation))return false; + TgeneMaturation that = (TgeneMaturation) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneMaturation +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneMaturation +*/ +public Object createInstance(){ + TgeneMaturation instance=new TgeneMaturation(); + instance.setPk(new TgeneMaturationKey()); + return instance; +} +/**Clona la entidad TgeneMaturation +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneMaturation p=(TgeneMaturation)this.clone(); + p.setPk((TgeneMaturationKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/TgeneMaturationKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/TgeneMaturationKey.java new file mode 100644 index 0000000..de36b70 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/TgeneMaturationKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pgeneral.transf; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEMATURATION*/ +@Embeddable +public class TgeneMaturationKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +/**Contructor por defecto*/ +public TgeneMaturationKey(){} +/**Contructor de TgeneMaturationKey +@param pBalancetype Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +public TgeneMaturationKey(String pBalancetype,String pBalancegroup){ + balancetype=pBalancetype; + balancegroup=pBalancegroup; +} +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Implementacin de la comparacin de TgeneMaturationKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneMaturationKey))return false; + TgeneMaturationKey that = (TgeneMaturationKey) o; + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneMaturationKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/TgeneTransfer.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/TgeneTransfer.java new file mode 100644 index 0000000..df7255b --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/TgeneTransfer.java @@ -0,0 +1,214 @@ +package com.fp.persistence.pgeneral.transf; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSFER*/ +@Entity(name="TgeneTransfer") +@Table(name="TGENETRANSFER") +public class TgeneTransfer extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransfer +*/ +@Id +@Column(name="TRANSFERCODE" ,nullable=false, updatable=false) +private Integer pk; +@Column(name="MODULECODE", nullable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="TRANSACTIONMODULE", nullable=true) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=true) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=true) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="DESCRIPTION", nullable=true) + +/** +* Descripcion de la transferencia. +*/ +private String description; + +/**Contructor por defecto*/ +public TgeneTransfer(){ +} +/**Contructor de TgeneTransfer +@param pPk Clave Primaria del entity +@param pModulecode Codigo de modulo +*/ +public TgeneTransfer(Integer pPk,String pModulecode){ + this(); + pk=pPk; + modulecode=pModulecode; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransfer +*/ +public static TgeneTransfer find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneTransfer obj = pEntityManager.find(TgeneTransfer.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransfer +@return El objeto que referencia a la Clave primaria de TgeneTransfer +*/ +public Integer getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransfer +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransfer +*/ +public void setPk(Integer pPk){ + pk=pPk; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de description +@return valor de description*/ +public String getDescription(){ + return description; +} +/**Fija el valor de description +@param pDescription nuevo Valor de description*/ +public void setDescription(String pDescription){ + description=pDescription; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransfer))return false; + TgeneTransfer that = (TgeneTransfer) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTransfer +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTransfer +*/ +public Object createInstance(){ + TgeneTransfer instance=new TgeneTransfer(); + return instance; +} +/**Clona la entidad TgeneTransfer +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransfer p=(TgeneTransfer)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/TgeneTransferDetail.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/TgeneTransferDetail.java new file mode 100644 index 0000000..9d51ac8 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/TgeneTransferDetail.java @@ -0,0 +1,329 @@ +package com.fp.persistence.pgeneral.transf; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.SQLQuery; +import org.hibernate.Session; + +import com.fp.dto.hb.Cache; +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSFERDETAIL */ +@Entity(name = "TgeneTransferDetail") +@Table(name = "TGENETRANSFERDETAIL") +public class TgeneTransferDetail extends com.fp.dto.AbstractDataTransport + implements + Serializable,HibernateBean,Cloneable,Cache { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + /** + * Clave primaria de la Entidad TgeneTransferDetail + */ + @EmbeddedId + private TgeneTransferDetailKey pk; + @Column(name = "TRANSACTIONMODULE", nullable = true) + /** + * Modulo al que pertence la transaccion + */ + private String transactionmodule; + + @Column(name = "TRANSACTIONCODE", nullable = true) + /** + * Codigo de transaccion dentro del modulo + */ + private Integer transactioncode; + + @Column(name = "TRANSACTIONVERSION", nullable = true) + /** + * Version de transaccion + */ + private Integer transactionversion; + + @Column(name = "DEBITITEM", nullable = true) + /** + * Codigo de rubro debito. + */ + private Integer debititem; + + @Column(name = "CREDITITEM", nullable = true) + /** + * Codigo de rubro credito. + */ + private Integer credititem; + + @Column(name = "REVERSEDEBITITEM", nullable = true) + /** + * Codigo de rubro asociado al debito de reverso. + */ + private Integer reversedebititem; + + @Column(name = "REVERSECREDITITEM", nullable = true) + /** + * Codigo de rubro asociado al credito de reverso. + */ + private Integer reversecredititem; + + /** Contructor por defecto */ + public TgeneTransferDetail() { + } + /** + * Contructor de TgeneTransferDetail + * + * @param pPk Clave Primaria del entity + */ + public TgeneTransferDetail(TgeneTransferDetailKey pPk) { + this(); + pk = pPk; + } + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return TgeneTransferDetail + */ + public static TgeneTransferDetail find(EntityManager pEntityManager, TgeneTransferDetailKey pKey) throws Exception { + TgeneTransferDetail obj = pEntityManager.find(TgeneTransferDetail.class, pKey); + return obj; + } + /** + * Entrega la Clave primaria de TgeneTransferDetail + * + * @return El objeto que referencia a la Clave primaria de TgeneTransferDetail + */ + public TgeneTransferDetailKey getPk() { + return pk; + } + /** + * Fija un nuevo valor a la Clave primaria de TgeneTransferDetail + * + * @param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransferDetail + */ + public void setPk(TgeneTransferDetailKey pPk) { + pk = pPk; + } + /** + * Obtiene el valor de transactionmodule + * + * @return valor de transactionmodule + */ + public String getTransactionmodule() { + return transactionmodule; + } + /** + * Fija el valor de transactionmodule + * + * @param pTransactionmodule nuevo Valor de transactionmodule + */ + public void setTransactionmodule(String pTransactionmodule) { + transactionmodule = pTransactionmodule; + } + + /** + * Obtiene el valor de transactioncode + * + * @return valor de transactioncode + */ + public Integer getTransactioncode() { + return transactioncode; + } + /** + * Fija el valor de transactioncode + * + * @param pTransactioncode nuevo Valor de transactioncode + */ + public void setTransactioncode(Integer pTransactioncode) { + transactioncode = pTransactioncode; + } + + /** + * Obtiene el valor de transactionversion + * + * @return valor de transactionversion + */ + public Integer getTransactionversion() { + return transactionversion; + } + /** + * Fija el valor de transactionversion + * + * @param pTransactionversion nuevo Valor de transactionversion + */ + public void setTransactionversion(Integer pTransactionversion) { + transactionversion = pTransactionversion; + } + + /** + * Obtiene el valor de debititem + * + * @return valor de debititem + */ + public Integer getDebititem() { + return debititem; + } + /** + * Fija el valor de debititem + * + * @param pDebititem nuevo Valor de debititem + */ + public void setDebititem(Integer pDebititem) { + debititem = pDebititem; + } + + /** + * Obtiene el valor de credititem + * + * @return valor de credititem + */ + public Integer getCredititem() { + return credititem; + } + /** + * Fija el valor de credititem + * + * @param pCredititem nuevo Valor de credititem + */ + public void setCredititem(Integer pCredititem) { + credititem = pCredititem; + } + + /** + * Obtiene el valor de reversedebititem + * + * @return valor de reversedebititem + */ + public Integer getReversedebititem() { + return reversedebititem; + } + /** + * Fija el valor de reversedebititem + * + * @param pReversedebititem nuevo Valor de reversedebititem + */ + public void setReversedebititem(Integer pReversedebititem) { + reversedebititem = pReversedebititem; + } + + /** + * Obtiene el valor de reversecredititem + * + * @return valor de reversecredititem + */ + public Integer getReversecredititem() { + return reversecredititem; + } + /** + * Fija el valor de reversecredititem + * + * @param pReversecredititem nuevo Valor de reversecredititem + */ + public void setReversecredititem(Integer pReversecredititem) { + reversecredititem = pReversecredititem; + } + + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof TgeneTransferDetail)) + return false; + TgeneTransferDetail that = (TgeneTransferDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + /** + * Implementacin del metodo hashCode de la la entidad TgeneTransferDetail + * + * @return el hashCode la instancia + */ + public int hashCode() { + if (this.hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; + } + /** Implementacin toString */ + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + /** Implementacin de la creacin de un bean en blanco TgeneTransferDetail */ + public Object createInstance() { + TgeneTransferDetail instance = new TgeneTransferDetail(); + instance.setPk(new TgeneTransferDetailKey()); + return instance; + } + /** + * Clona la entidad TgeneTransferDetail + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + public Object cloneMe() throws CloneNotSupportedException { + TgeneTransferDetail p = (TgeneTransferDetail) this.clone(); + p.setPk((TgeneTransferDetailKey) this.pk.cloneMe()); + return p; + } + + //Metodos manuales. + /**sentencia que elimina tgenetellertransferdetail*/ + private static final String DEL_TRANSF_DETAIL = + " delete from TGENETELLERTRANSFERDETAIL t " + + " where t.WORKINGDATE = :workingdate " + + " and t.USERCODE = :usercode " + + " and t.TRANSFERNUMBER = :transfernumber"; + /** + * Elimina un registro de la tabla para el usuario, fecha de trabajo y numero de transferencia. + * @param pEntityManager Referencia la session de la base de datos. + * @param pWorkingdate Fecha de trabajo. + * @param pUser Codigo de usuario. + * @param pTransfernumber Numero de transferencia. + * @throws Exception + */ + public static void delete(EntityManager pEntityManager,Date pWorkingdate,String pUser,Integer pTransfernumber) throws Exception { + //Elimina tgenetellertransferdetail + Session s = (Session)pEntityManager.getDelegate(); + SQLQuery sqldet = s.createSQLQuery(DEL_TRANSF_DETAIL); + sqldet.setDate("workingdate", pWorkingdate); + sqldet.setString("usercode", pUser); + sqldet.setInteger("transfernumber", pTransfernumber); + sqldet.executeUpdate(); + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/TgeneTransferDetailKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/TgeneTransferDetailKey.java new file mode 100644 index 0000000..278d5cb --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/TgeneTransferDetailKey.java @@ -0,0 +1,232 @@ +package com.fp.persistence.pgeneral.transf; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENETRANSFERDETAIL*/ +@Embeddable +public class TgeneTransferDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="TRANSFERCODE", nullable=false,updatable=false) + +/** +* Codigo de transferencia +*/ +private Integer transfercode; + +@Column(name="MODULECODE", nullable=false,updatable=false) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="BALANCETYPE", nullable=false,updatable=false) + +/** +* Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +*/ +private String balancetype; + +@Column(name="BALANCEGROUP", nullable=false,updatable=false) + +/** +* Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +*/ +private String balancegroup; + +@Column(name="STATUSFROM", nullable=false,updatable=false) + +/** +* Estatus de cuenta actual +*/ +private String statusfrom; + +@Column(name="STATUSTO", nullable=false,updatable=false) + +/** +* Estatus al que se realiza la transaferencia +*/ +private String statusto; + +/**Contructor por defecto*/ +public TgeneTransferDetailKey(){} +/**Contructor de TgeneTransferDetailKey +@param pTransfercode Codigo de transferencia +@param pModulecode Codigo de modulo +@param pBalancetype Cdigo de tipo de saldo. Efectivo, Bloqueado , Pignorado, Retenciones Locales, remesas ..Etc +@param pBalancegroup Codigo del grupo de balance 1 Activo, 2 Pasivo, 3 Patrimonio .. 62 contingente deudor 61 por contra deudor +@param pStatusfrom Estatus de cuenta actual +@param pStatusto Estatus al que se realiza la transaferencia +*/ +public TgeneTransferDetailKey(Integer pTransfercode,String pModulecode,String pBalancetype,String pBalancegroup,String pStatusfrom,String pStatusto){ + transfercode=pTransfercode; + modulecode=pModulecode; + balancetype=pBalancetype; + balancegroup=pBalancegroup; + statusfrom=pStatusfrom; + statusto=pStatusto; +} +/**Obtiene el valor de transfercode +@return valor de transfercode*/ +public Integer getTransfercode(){ + return transfercode; +} +/**Fija el valor de transfercode +@param pTransfercode nuevo Valor de transfercode*/ +public void setTransfercode(Integer pTransfercode){ + transfercode=pTransfercode; +} + +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de balancetype +@return valor de balancetype*/ +public String getBalancetype(){ + return balancetype; +} +/**Fija el valor de balancetype +@param pBalancetype nuevo Valor de balancetype*/ +public void setBalancetype(String pBalancetype){ + balancetype=pBalancetype; +} + +/**Obtiene el valor de balancegroup +@return valor de balancegroup*/ +public String getBalancegroup(){ + return balancegroup; +} +/**Fija el valor de balancegroup +@param pBalancegroup nuevo Valor de balancegroup*/ +public void setBalancegroup(String pBalancegroup){ + balancegroup=pBalancegroup; +} + +/**Obtiene el valor de statusfrom +@return valor de statusfrom*/ +public String getStatusfrom(){ + return statusfrom; +} +/**Fija el valor de statusfrom +@param pStatusfrom nuevo Valor de statusfrom*/ +public void setStatusfrom(String pStatusfrom){ + statusfrom=pStatusfrom; +} + +/**Obtiene el valor de statusto +@return valor de statusto*/ +public String getStatusto(){ + return statusto; +} +/**Fija el valor de statusto +@param pStatusto nuevo Valor de statusto*/ +public void setStatusto(String pStatusto){ + statusto=pStatusto; +} + +/**Implementacin de la comparacin de TgeneTransferDetailKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneTransferDetailKey))return false; + TgeneTransferDetailKey that = (TgeneTransferDetailKey) o; + if (this.getTransfercode() == null || that.getTransfercode() == null){ + return false; + } + if (! this.getTransfercode().equals(that.getTransfercode())){ + return false; + } + if (this.getModulecode() == null || that.getModulecode() == null){ + return false; + } + if (! this.getModulecode().equals(that.getModulecode())){ + return false; + } + if (this.getBalancetype() == null || that.getBalancetype() == null){ + return false; + } + if (! this.getBalancetype().equals(that.getBalancetype())){ + return false; + } + if (this.getBalancegroup() == null || that.getBalancegroup() == null){ + return false; + } + if (! this.getBalancegroup().equals(that.getBalancegroup())){ + return false; + } + if (this.getStatusfrom() == null || that.getStatusfrom() == null){ + return false; + } + if (! this.getStatusfrom().equals(that.getStatusfrom())){ + return false; + } + if (this.getStatusto() == null || that.getStatusto() == null){ + return false; + } + if (! this.getStatusto().equals(that.getStatusto())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneTransferDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getTransfercode() == null ? 0 : this.getTransfercode().hashCode()); + result = result * 37 + (this.getModulecode() == null ? 0 : this.getModulecode().hashCode()); + result = result * 37 + (this.getBalancetype() == null ? 0 : this.getBalancetype().hashCode()); + result = result * 37 + (this.getBalancegroup() == null ? 0 : this.getBalancegroup().hashCode()); + result = result * 37 + (this.getStatusfrom() == null ? 0 : this.getStatusfrom().hashCode()); + result = result * 37 + (this.getStatusto() == null ? 0 : this.getStatusto().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/TgeneTransferStatus.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/TgeneTransferStatus.java new file mode 100644 index 0000000..af0dfce --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/transf/TgeneTransferStatus.java @@ -0,0 +1,174 @@ +package com.fp.persistence.pgeneral.transf; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENETRANSFERSTATUS*/ +@Entity(name="TgeneTransferStatus") +@Table(name="TGENETRANSFERSTATUS") +public class TgeneTransferStatus extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneTransferStatus +*/ +@Id +@Column(name="CREDITTYPECODE" ,nullable=false, updatable=false) +private String pk; +@Column(name="MODULECODE", nullable=true) + +/** +* Codigo de modulo +*/ +private String modulecode; + +@Column(name="EXPIREDSTATUSCODE", nullable=true) + +/** +* Estatus de cuotas que llegaron a la fecha de vencimiento. +*/ +private String expiredstatuscode; + +@Column(name="FUTURESTATUSCODE", nullable=true) + +/** +* Estatus de cotas cuya fecha de vencimiento esta en el futuro. +*/ +private String futurestatuscode; + +/**Contructor por defecto*/ +public TgeneTransferStatus(){ +} +/**Contructor de TgeneTransferStatus +@param pPk Clave Primaria del entity +*/ +public TgeneTransferStatus(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneTransferStatus +*/ +public static TgeneTransferStatus find(EntityManager pEntityManager,Object pKey) throws Exception{ + TgeneTransferStatus obj = pEntityManager.find(TgeneTransferStatus.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneTransferStatus +@return El objeto que referencia a la Clave primaria de TgeneTransferStatus +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneTransferStatus +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneTransferStatus +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de modulecode +@return valor de modulecode*/ +public String getModulecode(){ + return modulecode; +} +/**Fija el valor de modulecode +@param pModulecode nuevo Valor de modulecode*/ +public void setModulecode(String pModulecode){ + modulecode=pModulecode; +} + +/**Obtiene el valor de expiredstatuscode +@return valor de expiredstatuscode*/ +public String getExpiredstatuscode(){ + return expiredstatuscode; +} +/**Fija el valor de expiredstatuscode +@param pExpiredstatuscode nuevo Valor de expiredstatuscode*/ +public void setExpiredstatuscode(String pExpiredstatuscode){ + expiredstatuscode=pExpiredstatuscode; +} + +/**Obtiene el valor de futurestatuscode +@return valor de futurestatuscode*/ +public String getFuturestatuscode(){ + return futurestatuscode; +} +/**Fija el valor de futurestatuscode +@param pFuturestatuscode nuevo Valor de futurestatuscode*/ +public void setFuturestatuscode(String pFuturestatuscode){ + futurestatuscode=pFuturestatuscode; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneTransferStatus))return false; + TgeneTransferStatus that = (TgeneTransferStatus) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneTransferStatus +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneTransferStatus +*/ +public Object createInstance(){ + TgeneTransferStatus instance=new TgeneTransferStatus(); + return instance; +} +/**Clona la entidad TgeneTransferStatus +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneTransferStatus p=(TgeneTransferStatus)this.clone(); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/.svn/entries b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/.svn/entries new file mode 100644 index 0000000..f52c76a --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/.svn/entries @@ -0,0 +1,164 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneVaultDetail.java +file + + + + +2022-07-28T03:40:29.654746Z +43d77fc207ca43d956e20cb45d2e6b03 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4458 + +TgeneVaultKey.java +file + + + + +2022-07-28T03:40:29.655746Z +df1c728629d1d0cd47308e67ee37837c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5788 + +TgeneVaultDetailKey.java +file + + + + +2022-07-28T03:40:29.655746Z +6c93cc2cd55fddf6d214708f9a18297b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8554 + +TgeneVault.java +file + + + + +2022-07-28T03:40:29.655746Z +24608df41a31b5dc867330f8426fa1ea +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3884 + diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/.svn/text-base/TgeneVault.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/.svn/text-base/TgeneVault.java.svn-base new file mode 100644 index 0000000..ea0b882 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/.svn/text-base/TgeneVault.java.svn-base @@ -0,0 +1,140 @@ +package com.fp.persistence.pgeneral.vault; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEVAULT*/ +@Entity(name="TgeneVault") +@Table(name="TGENEVAULT") +public class TgeneVault extends com.fp.dto.AbstractDataBalanceTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneVault +*/ +@EmbeddedId +private TgeneVaultKey pk; +@Column(name="BALANCE", nullable=true) + +/** +* Saldo de boveda +*/ +private BigDecimal balance; + +/**Contructor por defecto*/ +public TgeneVault(){ +} +/**Contructor de TgeneVault +@param pPk Clave Primaria del entity +*/ +public TgeneVault(TgeneVaultKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneVault +*/ +public static TgeneVault find(EntityManager pEntityManager,TgeneVaultKey pKey) throws Exception{ + TgeneVault obj = pEntityManager.find(TgeneVault.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneVault +@return El objeto que referencia a la Clave primaria de TgeneVault +*/ +public TgeneVaultKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneVault +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneVault +*/ +public void setPk(TgeneVaultKey pPk){ + pk=pPk; +} +/**Obtiene el valor de balance +@return valor de balance*/ +public BigDecimal getBalance(){ + return balance; +} +/**Fija el valor de balance +@param pBalance nuevo Valor de balance*/ +public void setBalance(BigDecimal pBalance){ + balance=pBalance; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneVault))return false; + TgeneVault that = (TgeneVault) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneVault +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneVault +*/ +public Object createInstance(){ + TgeneVault instance=new TgeneVault(); + instance.setPk(new TgeneVaultKey()); + return instance; +} +/**Clona la entidad TgeneVault +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneVault p=(TgeneVault)this.clone(); + p.setPk((TgeneVaultKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/.svn/text-base/TgeneVaultDetail.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/.svn/text-base/TgeneVaultDetail.java.svn-base new file mode 100644 index 0000000..d9d5e98 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/.svn/text-base/TgeneVaultDetail.java.svn-base @@ -0,0 +1,158 @@ +package com.fp.persistence.pgeneral.vault; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEVAULTDETAIL*/ +@Entity(name="TgeneVaultDetail") +@Table(name="TGENEVAULTDETAIL") +public class TgeneVaultDetail extends com.fp.dto.AbstractDataBalanceTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneVaultDetail +*/ +@EmbeddedId +private TgeneVaultDetailKey pk; +@Column(name="QUANTITY", nullable=true) + +/** +* Numero de billetes o monedas por denominacion +*/ +private Integer quantity; + +@Column(name="TOTAL", nullable=true) + +/** +* Total de la denominacion +*/ +private BigDecimal total; + +/**Contructor por defecto*/ +public TgeneVaultDetail(){ +} +/**Contructor de TgeneVaultDetail +@param pPk Clave Primaria del entity +*/ +public TgeneVaultDetail(TgeneVaultDetailKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneVaultDetail +*/ +public static TgeneVaultDetail find(EntityManager pEntityManager,TgeneVaultDetailKey pKey) throws Exception{ + TgeneVaultDetail obj = pEntityManager.find(TgeneVaultDetail.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneVaultDetail +@return El objeto que referencia a la Clave primaria de TgeneVaultDetail +*/ +public TgeneVaultDetailKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneVaultDetail +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneVaultDetail +*/ +public void setPk(TgeneVaultDetailKey pPk){ + pk=pPk; +} +/**Obtiene el valor de quantity +@return valor de quantity*/ +public Integer getQuantity(){ + return quantity; +} +/**Fija el valor de quantity +@param pQuantity nuevo Valor de quantity*/ +public void setQuantity(Integer pQuantity){ + quantity=pQuantity; +} + +/**Obtiene el valor de total +@return valor de total*/ +public BigDecimal getTotal(){ + return total; +} +/**Fija el valor de total +@param pTotal nuevo Valor de total*/ +public void setTotal(BigDecimal pTotal){ + total=pTotal; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneVaultDetail))return false; + TgeneVaultDetail that = (TgeneVaultDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneVaultDetail +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneVaultDetail +*/ +public Object createInstance(){ + TgeneVaultDetail instance=new TgeneVaultDetail(); + instance.setPk(new TgeneVaultDetailKey()); + return instance; +} +/**Clona la entidad TgeneVaultDetail +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneVaultDetail p=(TgeneVaultDetail)this.clone(); + p.setPk((TgeneVaultDetailKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/.svn/text-base/TgeneVaultDetailKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/.svn/text-base/TgeneVaultDetailKey.java.svn-base new file mode 100644 index 0000000..9ff0b9d --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/.svn/text-base/TgeneVaultDetailKey.java.svn-base @@ -0,0 +1,287 @@ +package com.fp.persistence.pgeneral.vault; + +import javax.persistence.Column; +import java.io.Serializable; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEVAULTDETAIL*/ +@Embeddable +public class TgeneVaultDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="OFFICECODE", nullable=false,updatable=false) + +/** +* Codigo de oficina +*/ +private Integer officecode; + +@Column(name="BRANCHCODE", nullable=false,updatable=false) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania al que pertenece la oficina +*/ +private Integer companycode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="CATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String catalog; + +@Column(name="CATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String catalogcode; + +@Column(name="DENOMINATIONVALUE", nullable=false,updatable=false) + +/** +* Valor de la denominacion, ejemplo billetes de 100, 50, 20,10 etc +*/ +private BigDecimal denominationvalue; + +/**Contructor por defecto*/ +public TgeneVaultDetailKey(){} +/**Contructor de TgeneVaultDetailKey +@param pUsercode Codigo de usuario +@param pOfficecode Codigo de oficina +@param pBranchcode Codigo de sucursal +@param pCompanycode Codigo de compania al que pertenece la oficina +@param pCurrencycode Codigo de moneda +@param pCatalog Codigo de catalogo 01 Natural, 02 Juridico +@param pCatalogcode Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +@param pDenominationvalue Valor de la denominacion, ejemplo billetes de 100, 50, 20,10 etc +*/ +public TgeneVaultDetailKey(String pUsercode,Integer pOfficecode,Integer pBranchcode,Integer pCompanycode,String pCurrencycode,String pCatalog,String pCatalogcode,BigDecimal pDenominationvalue){ + usercode=pUsercode; + officecode=pOfficecode; + branchcode=pBranchcode; + companycode=pCompanycode; + currencycode=pCurrencycode; + catalog=pCatalog; + catalogcode=pCatalogcode; + denominationvalue=pDenominationvalue; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de catalog +@return valor de catalog*/ +public String getCatalog(){ + return catalog; +} +/**Fija el valor de catalog +@param pCatalog nuevo Valor de catalog*/ +public void setCatalog(String pCatalog){ + catalog=pCatalog; +} + +/**Obtiene el valor de catalogcode +@return valor de catalogcode*/ +public String getCatalogcode(){ + return catalogcode; +} +/**Fija el valor de catalogcode +@param pCatalogcode nuevo Valor de catalogcode*/ +public void setCatalogcode(String pCatalogcode){ + catalogcode=pCatalogcode; +} + +/**Obtiene el valor de denominationvalue +@return valor de denominationvalue*/ +public BigDecimal getDenominationvalue(){ + return denominationvalue; +} +/**Fija el valor de denominationvalue +@param pDenominationvalue nuevo Valor de denominationvalue*/ +public void setDenominationvalue(BigDecimal pDenominationvalue){ + denominationvalue=pDenominationvalue; +} + +/**Implementacin de la comparacin de TgeneVaultDetailKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneVaultDetailKey))return false; + TgeneVaultDetailKey that = (TgeneVaultDetailKey) o; + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getOfficecode() == null || that.getOfficecode() == null){ + return false; + } + if (! this.getOfficecode().equals(that.getOfficecode())){ + return false; + } + if (this.getBranchcode() == null || that.getBranchcode() == null){ + return false; + } + if (! this.getBranchcode().equals(that.getBranchcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getCatalog() == null || that.getCatalog() == null){ + return false; + } + if (! this.getCatalog().equals(that.getCatalog())){ + return false; + } + if (this.getCatalogcode() == null || that.getCatalogcode() == null){ + return false; + } + if (! this.getCatalogcode().equals(that.getCatalogcode())){ + return false; + } + if (this.getDenominationvalue() == null || that.getDenominationvalue() == null){ + return false; + } + if (! this.getDenominationvalue().equals(that.getDenominationvalue())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneVaultDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getOfficecode() == null ? 0 : this.getOfficecode().hashCode()); + result = result * 37 + (this.getBranchcode() == null ? 0 : this.getBranchcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getCatalog() == null ? 0 : this.getCatalog().hashCode()); + result = result * 37 + (this.getCatalogcode() == null ? 0 : this.getCatalogcode().hashCode()); + result = result * 37 + (this.getDenominationvalue() == null ? 0 : this.getDenominationvalue().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/.svn/text-base/TgeneVaultKey.java.svn-base b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/.svn/text-base/TgeneVaultKey.java.svn-base new file mode 100644 index 0000000..b175d89 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/.svn/text-base/TgeneVaultKey.java.svn-base @@ -0,0 +1,205 @@ +package com.fp.persistence.pgeneral.vault; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEVAULT*/ +@Embeddable +public class TgeneVaultKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="OFFICECODE", nullable=false,updatable=false) + +/** +* Codigo de oficina +*/ +private Integer officecode; + +@Column(name="BRANCHCODE", nullable=false,updatable=false) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania al que pertenece la oficina +*/ +private Integer companycode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +/**Contructor por defecto*/ +public TgeneVaultKey(){} +/**Contructor de TgeneVaultKey +@param pUsercode Codigo de usuario +@param pOfficecode Codigo de oficina +@param pBranchcode Codigo de sucursal +@param pCompanycode Codigo de compania al que pertenece la oficina +@param pCurrencycode Codigo de moneda +*/ +public TgeneVaultKey(String pUsercode,Integer pOfficecode,Integer pBranchcode,Integer pCompanycode,String pCurrencycode){ + usercode=pUsercode; + officecode=pOfficecode; + branchcode=pBranchcode; + companycode=pCompanycode; + currencycode=pCurrencycode; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Implementacin de la comparacin de TgeneVaultKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneVaultKey))return false; + TgeneVaultKey that = (TgeneVaultKey) o; + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getOfficecode() == null || that.getOfficecode() == null){ + return false; + } + if (! this.getOfficecode().equals(that.getOfficecode())){ + return false; + } + if (this.getBranchcode() == null || that.getBranchcode() == null){ + return false; + } + if (! this.getBranchcode().equals(that.getBranchcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneVaultKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getOfficecode() == null ? 0 : this.getOfficecode().hashCode()); + result = result * 37 + (this.getBranchcode() == null ? 0 : this.getBranchcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/TgeneVault.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/TgeneVault.java new file mode 100644 index 0000000..ea0b882 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/TgeneVault.java @@ -0,0 +1,140 @@ +package com.fp.persistence.pgeneral.vault; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEVAULT*/ +@Entity(name="TgeneVault") +@Table(name="TGENEVAULT") +public class TgeneVault extends com.fp.dto.AbstractDataBalanceTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneVault +*/ +@EmbeddedId +private TgeneVaultKey pk; +@Column(name="BALANCE", nullable=true) + +/** +* Saldo de boveda +*/ +private BigDecimal balance; + +/**Contructor por defecto*/ +public TgeneVault(){ +} +/**Contructor de TgeneVault +@param pPk Clave Primaria del entity +*/ +public TgeneVault(TgeneVaultKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneVault +*/ +public static TgeneVault find(EntityManager pEntityManager,TgeneVaultKey pKey) throws Exception{ + TgeneVault obj = pEntityManager.find(TgeneVault.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneVault +@return El objeto que referencia a la Clave primaria de TgeneVault +*/ +public TgeneVaultKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneVault +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneVault +*/ +public void setPk(TgeneVaultKey pPk){ + pk=pPk; +} +/**Obtiene el valor de balance +@return valor de balance*/ +public BigDecimal getBalance(){ + return balance; +} +/**Fija el valor de balance +@param pBalance nuevo Valor de balance*/ +public void setBalance(BigDecimal pBalance){ + balance=pBalance; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneVault))return false; + TgeneVault that = (TgeneVault) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneVault +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneVault +*/ +public Object createInstance(){ + TgeneVault instance=new TgeneVault(); + instance.setPk(new TgeneVaultKey()); + return instance; +} +/**Clona la entidad TgeneVault +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneVault p=(TgeneVault)this.clone(); + p.setPk((TgeneVaultKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/TgeneVaultDetail.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/TgeneVaultDetail.java new file mode 100644 index 0000000..d9d5e98 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/TgeneVaultDetail.java @@ -0,0 +1,158 @@ +package com.fp.persistence.pgeneral.vault; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TGENEVAULTDETAIL*/ +@Entity(name="TgeneVaultDetail") +@Table(name="TGENEVAULTDETAIL") +public class TgeneVaultDetail extends com.fp.dto.AbstractDataBalanceTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TgeneVaultDetail +*/ +@EmbeddedId +private TgeneVaultDetailKey pk; +@Column(name="QUANTITY", nullable=true) + +/** +* Numero de billetes o monedas por denominacion +*/ +private Integer quantity; + +@Column(name="TOTAL", nullable=true) + +/** +* Total de la denominacion +*/ +private BigDecimal total; + +/**Contructor por defecto*/ +public TgeneVaultDetail(){ +} +/**Contructor de TgeneVaultDetail +@param pPk Clave Primaria del entity +*/ +public TgeneVaultDetail(TgeneVaultDetailKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TgeneVaultDetail +*/ +public static TgeneVaultDetail find(EntityManager pEntityManager,TgeneVaultDetailKey pKey) throws Exception{ + TgeneVaultDetail obj = pEntityManager.find(TgeneVaultDetail.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TgeneVaultDetail +@return El objeto que referencia a la Clave primaria de TgeneVaultDetail +*/ +public TgeneVaultDetailKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TgeneVaultDetail +@param pPk El objeto que referencia a la nueva Clave primaria de TgeneVaultDetail +*/ +public void setPk(TgeneVaultDetailKey pPk){ + pk=pPk; +} +/**Obtiene el valor de quantity +@return valor de quantity*/ +public Integer getQuantity(){ + return quantity; +} +/**Fija el valor de quantity +@param pQuantity nuevo Valor de quantity*/ +public void setQuantity(Integer pQuantity){ + quantity=pQuantity; +} + +/**Obtiene el valor de total +@return valor de total*/ +public BigDecimal getTotal(){ + return total; +} +/**Fija el valor de total +@param pTotal nuevo Valor de total*/ +public void setTotal(BigDecimal pTotal){ + total=pTotal; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TgeneVaultDetail))return false; + TgeneVaultDetail that = (TgeneVaultDetail) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacin del metodo hashCode de la la entidad TgeneVaultDetail +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacin de la creacin de un bean en blanco TgeneVaultDetail +*/ +public Object createInstance(){ + TgeneVaultDetail instance=new TgeneVaultDetail(); + instance.setPk(new TgeneVaultDetailKey()); + return instance; +} +/**Clona la entidad TgeneVaultDetail +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TgeneVaultDetail p=(TgeneVaultDetail)this.clone(); + p.setPk((TgeneVaultDetailKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/TgeneVaultDetailKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/TgeneVaultDetailKey.java new file mode 100644 index 0000000..9ff0b9d --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/TgeneVaultDetailKey.java @@ -0,0 +1,287 @@ +package com.fp.persistence.pgeneral.vault; + +import javax.persistence.Column; +import java.io.Serializable; +import java.math.BigDecimal; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEVAULTDETAIL*/ +@Embeddable +public class TgeneVaultDetailKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="OFFICECODE", nullable=false,updatable=false) + +/** +* Codigo de oficina +*/ +private Integer officecode; + +@Column(name="BRANCHCODE", nullable=false,updatable=false) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania al que pertenece la oficina +*/ +private Integer companycode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +@Column(name="CATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 01 Natural, 02 Juridico +*/ +private String catalog; + +@Column(name="CATALOGCODE", nullable=false,updatable=false) + +/** +* Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +*/ +private String catalogcode; + +@Column(name="DENOMINATIONVALUE", nullable=false,updatable=false) + +/** +* Valor de la denominacion, ejemplo billetes de 100, 50, 20,10 etc +*/ +private BigDecimal denominationvalue; + +/**Contructor por defecto*/ +public TgeneVaultDetailKey(){} +/**Contructor de TgeneVaultDetailKey +@param pUsercode Codigo de usuario +@param pOfficecode Codigo de oficina +@param pBranchcode Codigo de sucursal +@param pCompanycode Codigo de compania al que pertenece la oficina +@param pCurrencycode Codigo de moneda +@param pCatalog Codigo de catalogo 01 Natural, 02 Juridico +@param pCatalogcode Codigo de tabla de catalogo 01 Codigo de tabla de tipos de persona +@param pDenominationvalue Valor de la denominacion, ejemplo billetes de 100, 50, 20,10 etc +*/ +public TgeneVaultDetailKey(String pUsercode,Integer pOfficecode,Integer pBranchcode,Integer pCompanycode,String pCurrencycode,String pCatalog,String pCatalogcode,BigDecimal pDenominationvalue){ + usercode=pUsercode; + officecode=pOfficecode; + branchcode=pBranchcode; + companycode=pCompanycode; + currencycode=pCurrencycode; + catalog=pCatalog; + catalogcode=pCatalogcode; + denominationvalue=pDenominationvalue; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Obtiene el valor de catalog +@return valor de catalog*/ +public String getCatalog(){ + return catalog; +} +/**Fija el valor de catalog +@param pCatalog nuevo Valor de catalog*/ +public void setCatalog(String pCatalog){ + catalog=pCatalog; +} + +/**Obtiene el valor de catalogcode +@return valor de catalogcode*/ +public String getCatalogcode(){ + return catalogcode; +} +/**Fija el valor de catalogcode +@param pCatalogcode nuevo Valor de catalogcode*/ +public void setCatalogcode(String pCatalogcode){ + catalogcode=pCatalogcode; +} + +/**Obtiene el valor de denominationvalue +@return valor de denominationvalue*/ +public BigDecimal getDenominationvalue(){ + return denominationvalue; +} +/**Fija el valor de denominationvalue +@param pDenominationvalue nuevo Valor de denominationvalue*/ +public void setDenominationvalue(BigDecimal pDenominationvalue){ + denominationvalue=pDenominationvalue; +} + +/**Implementacin de la comparacin de TgeneVaultDetailKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneVaultDetailKey))return false; + TgeneVaultDetailKey that = (TgeneVaultDetailKey) o; + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getOfficecode() == null || that.getOfficecode() == null){ + return false; + } + if (! this.getOfficecode().equals(that.getOfficecode())){ + return false; + } + if (this.getBranchcode() == null || that.getBranchcode() == null){ + return false; + } + if (! this.getBranchcode().equals(that.getBranchcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + if (this.getCatalog() == null || that.getCatalog() == null){ + return false; + } + if (! this.getCatalog().equals(that.getCatalog())){ + return false; + } + if (this.getCatalogcode() == null || that.getCatalogcode() == null){ + return false; + } + if (! this.getCatalogcode().equals(that.getCatalogcode())){ + return false; + } + if (this.getDenominationvalue() == null || that.getDenominationvalue() == null){ + return false; + } + if (! this.getDenominationvalue().equals(that.getDenominationvalue())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneVaultDetailKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getOfficecode() == null ? 0 : this.getOfficecode().hashCode()); + result = result * 37 + (this.getBranchcode() == null ? 0 : this.getBranchcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + result = result * 37 + (this.getCatalog() == null ? 0 : this.getCatalog().hashCode()); + result = result * 37 + (this.getCatalogcode() == null ? 0 : this.getCatalogcode().hashCode()); + result = result * 37 + (this.getDenominationvalue() == null ? 0 : this.getDenominationvalue().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/TgeneVaultKey.java b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/TgeneVaultKey.java new file mode 100644 index 0000000..b175d89 --- /dev/null +++ b/base/persistence/pgeneral/src/main/java/com/fp/persistence/pgeneral/vault/TgeneVaultKey.java @@ -0,0 +1,205 @@ +package com.fp.persistence.pgeneral.vault; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TGENEVAULT*/ +@Embeddable +public class TgeneVaultKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="USERCODE", nullable=false,updatable=false) + +/** +* Codigo de usuario +*/ +private String usercode; + +@Column(name="OFFICECODE", nullable=false,updatable=false) + +/** +* Codigo de oficina +*/ +private Integer officecode; + +@Column(name="BRANCHCODE", nullable=false,updatable=false) + +/** +* Codigo de sucursal +*/ +private Integer branchcode; + +@Column(name="COMPANYCODE", nullable=false,updatable=false) + +/** +* Codigo de compania al que pertenece la oficina +*/ +private Integer companycode; + +@Column(name="CURRENCYCODE", nullable=false,updatable=false) + +/** +* Codigo de moneda +*/ +private String currencycode; + +/**Contructor por defecto*/ +public TgeneVaultKey(){} +/**Contructor de TgeneVaultKey +@param pUsercode Codigo de usuario +@param pOfficecode Codigo de oficina +@param pBranchcode Codigo de sucursal +@param pCompanycode Codigo de compania al que pertenece la oficina +@param pCurrencycode Codigo de moneda +*/ +public TgeneVaultKey(String pUsercode,Integer pOfficecode,Integer pBranchcode,Integer pCompanycode,String pCurrencycode){ + usercode=pUsercode; + officecode=pOfficecode; + branchcode=pBranchcode; + companycode=pCompanycode; + currencycode=pCurrencycode; +} +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de currencycode +@return valor de currencycode*/ +public String getCurrencycode(){ + return currencycode; +} +/**Fija el valor de currencycode +@param pCurrencycode nuevo Valor de currencycode*/ +public void setCurrencycode(String pCurrencycode){ + currencycode=pCurrencycode; +} + +/**Implementacin de la comparacin de TgeneVaultKey +@param o Objeto de comparacin +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TgeneVaultKey))return false; + TgeneVaultKey that = (TgeneVaultKey) o; + if (this.getUsercode() == null || that.getUsercode() == null){ + return false; + } + if (! this.getUsercode().equals(that.getUsercode())){ + return false; + } + if (this.getOfficecode() == null || that.getOfficecode() == null){ + return false; + } + if (! this.getOfficecode().equals(that.getOfficecode())){ + return false; + } + if (this.getBranchcode() == null || that.getBranchcode() == null){ + return false; + } + if (! this.getBranchcode().equals(that.getBranchcode())){ + return false; + } + if (this.getCompanycode() == null || that.getCompanycode() == null){ + return false; + } + if (! this.getCompanycode().equals(that.getCompanycode())){ + return false; + } + if (this.getCurrencycode() == null || that.getCurrencycode() == null){ + return false; + } + if (! this.getCurrencycode().equals(that.getCurrencycode())){ + return false; + } + return true; +} +/**Implementacin del mtodo hashCode bajo el patrn de Bloch +@return hashCode de la instancia TgeneVaultKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getUsercode() == null ? 0 : this.getUsercode().hashCode()); + result = result * 37 + (this.getOfficecode() == null ? 0 : this.getOfficecode().hashCode()); + result = result * 37 + (this.getBranchcode() == null ? 0 : this.getBranchcode().hashCode()); + result = result * 37 + (this.getCompanycode() == null ? 0 : this.getCompanycode().hashCode()); + result = result * 37 + (this.getCurrencycode() == null ? 0 : this.getCurrencycode().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacin toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pgeneral/src/main/resources/.svn/entries b/base/persistence/pgeneral/src/main/resources/.svn/entries new file mode 100644 index 0000000..77c30f0 --- /dev/null +++ b/base/persistence/pgeneral/src/main/resources/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pgeneral/src/main/resources +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccoNumStructure.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccoNumStructure.class new file mode 100644 index 0000000..6aea824 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccoNumStructure.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccoNumStructureKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccoNumStructureKey.class new file mode 100644 index 0000000..ce9160e Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccoNumStructureKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccount.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccount.class new file mode 100644 index 0000000..e8d7c2d Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccount.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountCredit.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountCredit.class new file mode 100644 index 0000000..9ae37e9 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountCredit.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountCreditKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountCreditKey.class new file mode 100644 index 0000000..1bc36b2 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountCreditKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountCreditOpening.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountCreditOpening.class new file mode 100644 index 0000000..406e8dc Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountCreditOpening.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountCreditOpeningKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountCreditOpeningKey.class new file mode 100644 index 0000000..09a8f2e Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountCreditOpeningKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountDebitOpening.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountDebitOpening.class new file mode 100644 index 0000000..45fb998 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountDebitOpening.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountDebitOpeningKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountDebitOpeningKey.class new file mode 100644 index 0000000..4a864f9 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountDebitOpeningKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountForCredit.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountForCredit.class new file mode 100644 index 0000000..b782db1 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountForCredit.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountForCreditKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountForCreditKey.class new file mode 100644 index 0000000..bd80a91 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountForCreditKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountForDebit.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountForDebit.class new file mode 100644 index 0000000..ca6821f Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountForDebit.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountForDebitKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountForDebitKey.class new file mode 100644 index 0000000..1e9c31a Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountForDebitKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountKey.class new file mode 100644 index 0000000..a4bfb8f Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountLiquidation.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountLiquidation.class new file mode 100644 index 0000000..700be02 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountLiquidation.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountLiquidationKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountLiquidationKey.class new file mode 100644 index 0000000..51e30fb Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountLiquidationKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountLocalHold.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountLocalHold.class new file mode 100644 index 0000000..d50872f Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountLocalHold.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountLocalHoldKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountLocalHoldKey.class new file mode 100644 index 0000000..bb4466c Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountLocalHoldKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountNumber.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountNumber.class new file mode 100644 index 0000000..5ceb284 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountNumber.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountNumberKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountNumberKey.class new file mode 100644 index 0000000..ba074d0 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountNumberKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountPayable.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountPayable.class new file mode 100644 index 0000000..50dc936 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountPayable.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountPayableKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountPayableKey.class new file mode 100644 index 0000000..7010601 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountPayableKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountRemittanceHold.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountRemittanceHold.class new file mode 100644 index 0000000..b44193a Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountRemittanceHold.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountRemittanceHoldKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountRemittanceHoldKey.class new file mode 100644 index 0000000..87ebec5 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountRemittanceHoldKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountSequence.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountSequence.class new file mode 100644 index 0000000..e1fce01 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountSequence.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountSequenceKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountSequenceKey.class new file mode 100644 index 0000000..3074b9b Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountSequenceKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountStatus.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountStatus.class new file mode 100644 index 0000000..78a3161 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountStatus.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountStatusKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountStatusKey.class new file mode 100644 index 0000000..a3df451 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneAccountStatusKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneBaseAccount.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneBaseAccount.class new file mode 100644 index 0000000..3b360e3 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneBaseAccount.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneBaseAccountKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneBaseAccountKey.class new file mode 100644 index 0000000..119ec88 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneBaseAccountKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSequStruct.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSequStruct.class new file mode 100644 index 0000000..6eae1cb Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSequStruct.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSequStructDetail.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSequStructDetail.class new file mode 100644 index 0000000..d0ac872 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSequStructDetail.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSequStructDetailKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSequStructDetailKey.class new file mode 100644 index 0000000..2540dd6 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSequStructDetailKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSequentialModule.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSequentialModule.class new file mode 100644 index 0000000..bda7b0f Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSequentialModule.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSolicitudeCredit.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSolicitudeCredit.class new file mode 100644 index 0000000..1b9421d Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSolicitudeCredit.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSolicitudeCreditKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSolicitudeCreditKey.class new file mode 100644 index 0000000..62cfb90 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSolicitudeCreditKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForCredit.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForCredit.class new file mode 100644 index 0000000..29526bc Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForCredit.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForCreditKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForCreditKey.class new file mode 100644 index 0000000..f81558e Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForCreditKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForDebit.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForDebit.class new file mode 100644 index 0000000..27d86fb Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForDebit.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForDebitKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForDebitKey.class new file mode 100644 index 0000000..726d1bf Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneSolicitudeForDebitKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneTransAccountOperStat.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneTransAccountOperStat.class new file mode 100644 index 0000000..a76caa1 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneTransAccountOperStat.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneTransAccountOperStatKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneTransAccountOperStatKey.class new file mode 100644 index 0000000..7a80027 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneTransAccountOperStatKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneTransAccountStatus.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneTransAccountStatus.class new file mode 100644 index 0000000..0592ec4 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneTransAccountStatus.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneTransAccountStatusKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneTransAccountStatusKey.class new file mode 100644 index 0000000..775b7af Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneTransAccountStatusKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneWarrantyAccount.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneWarrantyAccount.class new file mode 100644 index 0000000..e066361 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneWarrantyAccount.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneWarrantyAccountKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneWarrantyAccountKey.class new file mode 100644 index 0000000..a910c7c Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/acco/TgeneWarrantyAccountKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/auth/TgeneExceptions.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/auth/TgeneExceptions.class new file mode 100644 index 0000000..cf245ad Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/auth/TgeneExceptions.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/auth/TgeneExceptionsKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/auth/TgeneExceptionsKey.class new file mode 100644 index 0000000..81618f4 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/auth/TgeneExceptionsKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/auth/TgeneSolicitudeClientdata.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/auth/TgeneSolicitudeClientdata.class new file mode 100644 index 0000000..ecf38cf Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/auth/TgeneSolicitudeClientdata.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/auth/TgeneSolicitudeClientdataKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/auth/TgeneSolicitudeClientdataKey.class new file mode 100644 index 0000000..69f7ff4 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/auth/TgeneSolicitudeClientdataKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/auth/TgeneSolicitudeExceptions.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/auth/TgeneSolicitudeExceptions.class new file mode 100644 index 0000000..65b10f7 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/auth/TgeneSolicitudeExceptions.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/auth/TgeneSolicitudeExceptionsKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/auth/TgeneSolicitudeExceptionsKey.class new file mode 100644 index 0000000..53f11d3 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/auth/TgeneSolicitudeExceptionsKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneAccountBatchProcess.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneAccountBatchProcess.class new file mode 100644 index 0000000..ccdb733 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneAccountBatchProcess.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneAccountBatchProcessKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneAccountBatchProcessKey.class new file mode 100644 index 0000000..78ee76e Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneAccountBatchProcessKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneAccountBatchStatus.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneAccountBatchStatus.class new file mode 100644 index 0000000..e8c4a26 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneAccountBatchStatus.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneAccountBatchStatusKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneAccountBatchStatusKey.class new file mode 100644 index 0000000..4df3d74 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneAccountBatchStatusKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatch.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatch.class new file mode 100644 index 0000000..146fd18 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatch.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchKey.class new file mode 100644 index 0000000..fed4f54 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchLog.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchLog.class new file mode 100644 index 0000000..2c2bbd7 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchLog.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchLogKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchLogKey.class new file mode 100644 index 0000000..3499454 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchLogKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchLogPreviousProcess.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchLogPreviousProcess.class new file mode 100644 index 0000000..bc0cb13 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchLogPreviousProcess.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchLogPreviousProcessKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchLogPreviousProcessKey.class new file mode 100644 index 0000000..939ac2d Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchLogPreviousProcessKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchPreviousProcess.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchPreviousProcess.class new file mode 100644 index 0000000..2db023a Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchPreviousProcess.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchPreviousProcessKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchPreviousProcessKey.class new file mode 100644 index 0000000..cfd1b85 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchPreviousProcessKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchProcess.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchProcess.class new file mode 100644 index 0000000..6d0ea98 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchProcess.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchProcessKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchProcessKey.class new file mode 100644 index 0000000..b0fd508 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/batch/TgeneBatchProcessKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneCharges.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneCharges.class new file mode 100644 index 0000000..2ecf301 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneCharges.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneChargesCheckbook.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneChargesCheckbook.class new file mode 100644 index 0000000..ed1eb5f Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneChargesCheckbook.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneChargesCheckbookKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneChargesCheckbookKey.class new file mode 100644 index 0000000..727090f Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneChargesCheckbookKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneChargesGroup.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneChargesGroup.class new file mode 100644 index 0000000..7a3bb78 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneChargesGroup.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneChargesGroupKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneChargesGroupKey.class new file mode 100644 index 0000000..d7ef79d Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneChargesGroupKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneChargesKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneChargesKey.class new file mode 100644 index 0000000..12c1fd4 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneChargesKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneSubProductCharges.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneSubProductCharges.class new file mode 100644 index 0000000..fbcad5a Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneSubProductCharges.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneSubProductChargesKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneSubProductChargesKey.class new file mode 100644 index 0000000..4770874 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/charge/TgeneSubProductChargesKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/date/TgeneAccountingDate.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/date/TgeneAccountingDate.class new file mode 100644 index 0000000..9fdb246 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/date/TgeneAccountingDate.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/date/TgeneAccountingDateBranch.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/date/TgeneAccountingDateBranch.class new file mode 100644 index 0000000..8c94c20 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/date/TgeneAccountingDateBranch.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/date/TgeneAccountingDateBranchKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/date/TgeneAccountingDateBranchKey.class new file mode 100644 index 0000000..91c5f18 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/date/TgeneAccountingDateBranchKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/date/TgeneAccountingDateKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/date/TgeneAccountingDateKey.class new file mode 100644 index 0000000..ce1e14d Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/date/TgeneAccountingDateKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/date/TgeneNotAccountingDay.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/date/TgeneNotAccountingDay.class new file mode 100644 index 0000000..6944520 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/date/TgeneNotAccountingDay.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/date/TgeneNotAccountingDayKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/date/TgeneNotAccountingDayKey.class new file mode 100644 index 0000000..c04244c Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/date/TgeneNotAccountingDayKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/dict/TgeneDictionary.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/dict/TgeneDictionary.class new file mode 100644 index 0000000..3ff69e1 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/dict/TgeneDictionary.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/dict/TgeneDictionaryKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/dict/TgeneDictionaryKey.class new file mode 100644 index 0000000..6900466 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/dict/TgeneDictionaryKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/excel/TgeneFileType.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/excel/TgeneFileType.class new file mode 100644 index 0000000..ca3a533 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/excel/TgeneFileType.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/excel/TgeneReadExcel.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/excel/TgeneReadExcel.class new file mode 100644 index 0000000..8562fbc Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/excel/TgeneReadExcel.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/ABSTgeneSolicitudeRelationship.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/ABSTgeneSolicitudeRelationship.class new file mode 100644 index 0000000..7fbf77f Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/ABSTgeneSolicitudeRelationship.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/OptmListaNegra.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/OptmListaNegra.class new file mode 100644 index 0000000..e91de44 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/OptmListaNegra.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneAccountInstallCharges.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneAccountInstallCharges.class new file mode 100644 index 0000000..bb3b108 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneAccountInstallCharges.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneAccountInstallChargesKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneAccountInstallChargesKey.class new file mode 100644 index 0000000..142df27 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneAccountInstallChargesKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneAccountInstallRates.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneAccountInstallRates.class new file mode 100644 index 0000000..a2aaa18 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneAccountInstallRates.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneAccountInstallRatesKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneAccountInstallRatesKey.class new file mode 100644 index 0000000..c4f0e55 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneAccountInstallRatesKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneAccountRelationship.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneAccountRelationship.class new file mode 100644 index 0000000..e15860f Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneAccountRelationship.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneAccountRelationshipKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneAccountRelationshipKey.class new file mode 100644 index 0000000..56a94fb Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneAccountRelationshipKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneArea.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneArea.class new file mode 100644 index 0000000..6675a15 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneArea.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneAreaKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneAreaKey.class new file mode 100644 index 0000000..0e3289c Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneAreaKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneBalanceGroup.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneBalanceGroup.class new file mode 100644 index 0000000..73e38cb Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneBalanceGroup.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneBalanceType.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneBalanceType.class new file mode 100644 index 0000000..7e47c82 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneBalanceType.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneBalanceTypeDetail.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneBalanceTypeDetail.class new file mode 100644 index 0000000..331a10b Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneBalanceTypeDetail.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneBalanceTypeDetailKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneBalanceTypeDetailKey.class new file mode 100644 index 0000000..dcb0dba Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneBalanceTypeDetailKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneBalanceTypeKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneBalanceTypeKey.class new file mode 100644 index 0000000..28e2754 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneBalanceTypeKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneBranch.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneBranch.class new file mode 100644 index 0000000..659c99c Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneBranch.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneBranchKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneBranchKey.class new file mode 100644 index 0000000..681030e Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneBranchKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCanton.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCanton.class new file mode 100644 index 0000000..5df56de Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCanton.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCantonKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCantonKey.class new file mode 100644 index 0000000..093940b Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCantonKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCashClose.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCashClose.class new file mode 100644 index 0000000..1439ccb Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCashClose.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCashCloseDetail.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCashCloseDetail.class new file mode 100644 index 0000000..766229e Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCashCloseDetail.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCashCloseDetailKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCashCloseDetailKey.class new file mode 100644 index 0000000..9c2a839 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCashCloseDetailKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCashCloseHeader.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCashCloseHeader.class new file mode 100644 index 0000000..1ffd855 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCashCloseHeader.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCashCloseHeaderKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCashCloseHeaderKey.class new file mode 100644 index 0000000..37e021c Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCashCloseHeaderKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCashCloseKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCashCloseKey.class new file mode 100644 index 0000000..72ecbab Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCashCloseKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCatalog.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCatalog.class new file mode 100644 index 0000000..76e51fe Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCatalog.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCatalogDetail.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCatalogDetail.class new file mode 100644 index 0000000..c445fd4 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCatalogDetail.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCatalogDetailKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCatalogDetailKey.class new file mode 100644 index 0000000..3845508 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCatalogDetailKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCatalogDetailTest.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCatalogDetailTest.class new file mode 100644 index 0000000..29f4a48 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCatalogDetailTest.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCatalogDetailTestKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCatalogDetailTestKey.class new file mode 100644 index 0000000..07caf78 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCatalogDetailTestKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCatalogEquivalence.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCatalogEquivalence.class new file mode 100644 index 0000000..d53d4b1 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCatalogEquivalence.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCatalogEquivalenceDet.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCatalogEquivalenceDet.class new file mode 100644 index 0000000..48851ed Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCatalogEquivalenceDet.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneChannels.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneChannels.class new file mode 100644 index 0000000..4c8db02 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneChannels.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCity.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCity.class new file mode 100644 index 0000000..b16c55c Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCity.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCityKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCityKey.class new file mode 100644 index 0000000..a7e90d5 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCityKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCompany.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCompany.class new file mode 100644 index 0000000..d4ea20c Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCompany.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneConcept.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneConcept.class new file mode 100644 index 0000000..194464b Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneConcept.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneConceptKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneConceptKey.class new file mode 100644 index 0000000..722a1a6 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneConceptKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneConsep.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneConsep.class new file mode 100644 index 0000000..cb0a21a Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneConsep.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneConsepLog.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneConsepLog.class new file mode 100644 index 0000000..eb00208 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneConsepLog.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCountry.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCountry.class new file mode 100644 index 0000000..64fefc3 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCountry.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCreditType.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCreditType.class new file mode 100644 index 0000000..8ec6daa Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCreditType.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCurrency.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCurrency.class new file mode 100644 index 0000000..1106dc4 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCurrency.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCurrencyRate.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCurrencyRate.class new file mode 100644 index 0000000..dcd5dba Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCurrencyRate.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCurrencyRateGroup.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCurrencyRateGroup.class new file mode 100644 index 0000000..8567307 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCurrencyRateGroup.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCurrencyRateGroupKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCurrencyRateGroupKey.class new file mode 100644 index 0000000..ed78b20 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCurrencyRateGroupKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCurrencyRateKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCurrencyRateKey.class new file mode 100644 index 0000000..c68fa39 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneCurrencyRateKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneDenomination.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneDenomination.class new file mode 100644 index 0000000..e6e5a79 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneDenomination.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneDenominationKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneDenominationKey.class new file mode 100644 index 0000000..1bb4bf5 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneDenominationKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneEntity.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneEntity.class new file mode 100644 index 0000000..c6c429b Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneEntity.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneEntityKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneEntityKey.class new file mode 100644 index 0000000..65c024b Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneEntityKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneFrequency.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneFrequency.class new file mode 100644 index 0000000..213646c Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneFrequency.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneFunctions.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneFunctions.class new file mode 100644 index 0000000..c53eb49 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneFunctions.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneLabel.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneLabel.class new file mode 100644 index 0000000..22a4699 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneLabel.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneLabelKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneLabelKey.class new file mode 100644 index 0000000..301dead Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneLabelKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneLanguage.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneLanguage.class new file mode 100644 index 0000000..1b9cacc Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneLanguage.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOffice.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOffice.class new file mode 100644 index 0000000..e8e90bd Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOffice.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOfficeKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOfficeKey.class new file mode 100644 index 0000000..27e1ceb Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOfficeKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOfficer.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOfficer.class new file mode 100644 index 0000000..a0abb82 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOfficer.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOfficerKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOfficerKey.class new file mode 100644 index 0000000..4f839bb Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOfficerKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOperationStatus.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOperationStatus.class new file mode 100644 index 0000000..d76ae02 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOperationStatus.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOperationStatusKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOperationStatusKey.class new file mode 100644 index 0000000..59c6e0b Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOperationStatusKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOperativeCondition.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOperativeCondition.class new file mode 100644 index 0000000..9f1b746 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOperativeCondition.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOperativeConditionKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOperativeConditionKey.class new file mode 100644 index 0000000..6a8ce9a Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneOperativeConditionKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneParameters.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneParameters.class new file mode 100644 index 0000000..bad8dcf Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneParameters.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneParametersKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneParametersKey.class new file mode 100644 index 0000000..acaecdb Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneParametersKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneParroquia.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneParroquia.class new file mode 100644 index 0000000..271791f Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneParroquia.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneParroquiaKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneParroquiaKey.class new file mode 100644 index 0000000..c6d4389 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneParroquiaKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneProvince.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneProvince.class new file mode 100644 index 0000000..5b73346 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneProvince.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneProvinceKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneProvinceKey.class new file mode 100644 index 0000000..f3a61e8 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneProvinceKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneQueryProcess.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneQueryProcess.class new file mode 100644 index 0000000..47c85ed Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneQueryProcess.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneQueryProcessKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneQueryProcessKey.class new file mode 100644 index 0000000..333a233 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneQueryProcessKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneRevokeSolicitude.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneRevokeSolicitude.class new file mode 100644 index 0000000..7e11a1e Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneRevokeSolicitude.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneRevokeSolicitudeKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneRevokeSolicitudeKey.class new file mode 100644 index 0000000..68e9272 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneRevokeSolicitudeKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneServices.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneServices.class new file mode 100644 index 0000000..123af22 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneServices.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitude.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitude.class new file mode 100644 index 0000000..ebaebf6 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitude.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeCreditOpening.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeCreditOpening.class new file mode 100644 index 0000000..666a9ef Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeCreditOpening.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeCreditOpeningKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeCreditOpeningKey.class new file mode 100644 index 0000000..ccec78d Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeCreditOpeningKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeDebitOpening.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeDebitOpening.class new file mode 100644 index 0000000..4898825 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeDebitOpening.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeDebitOpeningKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeDebitOpeningKey.class new file mode 100644 index 0000000..be42a04 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeDebitOpeningKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallCharges.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallCharges.class new file mode 100644 index 0000000..0a921ff Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallCharges.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallChargesKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallChargesKey.class new file mode 100644 index 0000000..3752cbb Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallChargesKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallRates.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallRates.class new file mode 100644 index 0000000..fe470b0 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallRates.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallRatesKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallRatesKey.class new file mode 100644 index 0000000..3cd43a6 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeInstallRatesKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeKey.class new file mode 100644 index 0000000..f433054 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeLiquidation.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeLiquidation.class new file mode 100644 index 0000000..070ca1d Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeLiquidation.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeLiquidationKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeLiquidationKey.class new file mode 100644 index 0000000..0fb86bd Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeLiquidationKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeNumber.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeNumber.class new file mode 100644 index 0000000..dba387a Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeNumber.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeNumberKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeNumberKey.class new file mode 100644 index 0000000..0655013 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeNumberKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeRelationship.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeRelationship.class new file mode 100644 index 0000000..de39bb2 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeRelationship.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeRelationshipKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeRelationshipKey.class new file mode 100644 index 0000000..5480945 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeRelationshipKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeStatus.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeStatus.class new file mode 100644 index 0000000..d721e2f Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeStatus.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeStatusKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeStatusKey.class new file mode 100644 index 0000000..096d531 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneSolicitudeStatusKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTechnicalPatrimony.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTechnicalPatrimony.class new file mode 100644 index 0000000..bcb4488 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTechnicalPatrimony.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTechnicalPatrimonyKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTechnicalPatrimonyKey.class new file mode 100644 index 0000000..35d672f Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTechnicalPatrimonyKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerBalance.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerBalance.class new file mode 100644 index 0000000..db0bd36 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerBalance.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerBalanceKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerBalanceKey.class new file mode 100644 index 0000000..179ad2d Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerBalanceKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerTransfer.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerTransfer.class new file mode 100644 index 0000000..63bfe36 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerTransfer.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerTransferDetail.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerTransferDetail.class new file mode 100644 index 0000000..3101e67 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerTransferDetail.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerTransferDetailKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerTransferDetailKey.class new file mode 100644 index 0000000..d1d90ca Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerTransferDetailKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerTransferHeader.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerTransferHeader.class new file mode 100644 index 0000000..2987096 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerTransferHeader.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerTransferHeaderKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerTransferHeaderKey.class new file mode 100644 index 0000000..fc630d7 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerTransferHeaderKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerTransferKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerTransferKey.class new file mode 100644 index 0000000..55856cc Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTellerTransferKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionMix.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionMix.class new file mode 100644 index 0000000..c4f6384 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionMix.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionMixKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionMixKey.class new file mode 100644 index 0000000..1d931e1 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionMixKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionMixPages.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionMixPages.class new file mode 100644 index 0000000..5491db5 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionMixPages.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionMixPagesKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionMixPagesKey.class new file mode 100644 index 0000000..390777e Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionMixPagesKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionQuery.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionQuery.class new file mode 100644 index 0000000..a16b634 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionQuery.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionQueryKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionQueryKey.class new file mode 100644 index 0000000..60e3dc6 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionQueryKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionReportLink.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionReportLink.class new file mode 100644 index 0000000..f132501 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionReportLink.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionReportLinkKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionReportLinkKey.class new file mode 100644 index 0000000..3277d0a Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneTransactionReportLinkKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneUserSolicitudeNumber.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneUserSolicitudeNumber.class new file mode 100644 index 0000000..6f4f64e Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneUserSolicitudeNumber.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneWildcard.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneWildcard.class new file mode 100644 index 0000000..8ec2eb5 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/gene/TgeneWildcard.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/image/TgeneFiles.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/image/TgeneFiles.class new file mode 100644 index 0000000..8d80170 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/image/TgeneFiles.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/image/TgeneFilesDetail.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/image/TgeneFilesDetail.class new file mode 100644 index 0000000..43141a1 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/image/TgeneFilesDetail.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/image/TgeneFilesDetailKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/image/TgeneFilesDetailKey.class new file mode 100644 index 0000000..20818cd Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/image/TgeneFilesDetailKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/installment/TgeneInstallmentType.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/installment/TgeneInstallmentType.class new file mode 100644 index 0000000..ecd5ad6 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/installment/TgeneInstallmentType.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/installment/TgeneInstallmentTypeKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/installment/TgeneInstallmentTypeKey.class new file mode 100644 index 0000000..2a67ef5 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/installment/TgeneInstallmentTypeKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/log/TgeneTransactionLog.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/log/TgeneTransactionLog.class new file mode 100644 index 0000000..c82ac27 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/log/TgeneTransactionLog.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/log/TgeneTransactionMessage.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/log/TgeneTransactionMessage.class new file mode 100644 index 0000000..7751376 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/log/TgeneTransactionMessage.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenu.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenu.class new file mode 100644 index 0000000..62a1bef Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenu.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuLevel.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuLevel.class new file mode 100644 index 0000000..89b5ee9 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuLevel.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuLevelDesc.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuLevelDesc.class new file mode 100644 index 0000000..c66f8ed Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuLevelDesc.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuLevelDescKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuLevelDescKey.class new file mode 100644 index 0000000..60d86a9 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuLevelDescKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuLevelKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuLevelKey.class new file mode 100644 index 0000000..4099849 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuLevelKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuLevelTran.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuLevelTran.class new file mode 100644 index 0000000..a994fee Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuLevelTran.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuLevelTranKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuLevelTranKey.class new file mode 100644 index 0000000..b08b553 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuLevelTranKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuProfile.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuProfile.class new file mode 100644 index 0000000..2570535 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuProfile.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevel.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevel.class new file mode 100644 index 0000000..70113b6 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevel.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelDesc.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelDesc.class new file mode 100644 index 0000000..2030835 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelDesc.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelDescKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelDescKey.class new file mode 100644 index 0000000..28bbcb4 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelDescKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelKey.class new file mode 100644 index 0000000..c3f1d29 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelTran.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelTran.class new file mode 100644 index 0000000..d777ef9 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelTran.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelTranKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelTranKey.class new file mode 100644 index 0000000..eac2adc Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/menu/TgeneMenuSubLevelTranKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/message/TgeneMessageTemplates.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/message/TgeneMessageTemplates.class new file mode 100644 index 0000000..7c6b289 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/message/TgeneMessageTemplates.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/message/TgeneMessageTemplatesDesc.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/message/TgeneMessageTemplatesDesc.class new file mode 100644 index 0000000..7b9e02a Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/message/TgeneMessageTemplatesDesc.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/message/TgeneMessageTemplatesDescKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/message/TgeneMessageTemplatesDescKey.class new file mode 100644 index 0000000..ced388e Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/message/TgeneMessageTemplatesDescKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/msg/TgeneMessageStructure.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/msg/TgeneMessageStructure.class new file mode 100644 index 0000000..65bbe8c Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/msg/TgeneMessageStructure.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/msg/TgeneMessageStructureData.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/msg/TgeneMessageStructureData.class new file mode 100644 index 0000000..aa94a8d Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/msg/TgeneMessageStructureData.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/msg/TgeneMessageStructureDataKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/msg/TgeneMessageStructureDataKey.class new file mode 100644 index 0000000..8d9b73c Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/msg/TgeneMessageStructureDataKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/msg/TgeneMessageStructureHeader.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/msg/TgeneMessageStructureHeader.class new file mode 100644 index 0000000..4d5b87a Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/msg/TgeneMessageStructureHeader.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/msg/TgeneMessageStructureHeaderKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/msg/TgeneMessageStructureHeaderKey.class new file mode 100644 index 0000000..19b5596 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/msg/TgeneMessageStructureHeaderKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/page/TgeneSubproductPages.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/page/TgeneSubproductPages.class new file mode 100644 index 0000000..ee6084a Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/page/TgeneSubproductPages.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/page/TgeneSubproductPagesKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/page/TgeneSubproductPagesKey.class new file mode 100644 index 0000000..7509924 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/page/TgeneSubproductPagesKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/page/TgeneTransactionPages.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/page/TgeneTransactionPages.class new file mode 100644 index 0000000..47e5132 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/page/TgeneTransactionPages.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/page/TgeneTransactionPagesKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/page/TgeneTransactionPagesKey.class new file mode 100644 index 0000000..03499c0 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/page/TgeneTransactionPagesKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/proc/TgeneProcess.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/proc/TgeneProcess.class new file mode 100644 index 0000000..1d39361 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/proc/TgeneProcess.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/proc/TgeneProcessKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/proc/TgeneProcessKey.class new file mode 100644 index 0000000..7ef1391 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/proc/TgeneProcessKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneModule.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneModule.class new file mode 100644 index 0000000..763ad6c Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneModule.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneProduct.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneProduct.class new file mode 100644 index 0000000..710b073 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneProduct.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneProductKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneProductKey.class new file mode 100644 index 0000000..cbe234f Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneProductKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneProductRelationship.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneProductRelationship.class new file mode 100644 index 0000000..f7ddbc1 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneProductRelationship.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneProductRelationshipKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneProductRelationshipKey.class new file mode 100644 index 0000000..742eb20 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneProductRelationshipKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubProduct.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubProduct.class new file mode 100644 index 0000000..2e49634 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubProduct.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubProductCurrency.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubProductCurrency.class new file mode 100644 index 0000000..e47acea Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubProductCurrency.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubProductCurrencyKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubProductCurrencyKey.class new file mode 100644 index 0000000..e67d214 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubProductCurrencyKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubProductKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubProductKey.class new file mode 100644 index 0000000..739095e Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubProductKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubprodClientData.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubprodClientData.class new file mode 100644 index 0000000..9fb9c99 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubprodClientData.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubprodClientDataKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubprodClientDataKey.class new file mode 100644 index 0000000..dfbaa86 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubprodClientDataKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubprodInstallType.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubprodInstallType.class new file mode 100644 index 0000000..b47c061 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubprodInstallType.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubprodInstallTypeKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubprodInstallTypeKey.class new file mode 100644 index 0000000..0d59efb Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/TgeneSubprodInstallTypeKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneBaseRate.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneBaseRate.class new file mode 100644 index 0000000..d5cebcb Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneBaseRate.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneBaseRateDetail.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneBaseRateDetail.class new file mode 100644 index 0000000..43c6fd5 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneBaseRateDetail.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneBaseRateDetailKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneBaseRateDetailKey.class new file mode 100644 index 0000000..604f394 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneBaseRateDetailKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneBaseRateKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneBaseRateKey.class new file mode 100644 index 0000000..f7c4386 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneBaseRateKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneRatesGroup.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneRatesGroup.class new file mode 100644 index 0000000..c10ef7e Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneRatesGroup.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneRatesGroupKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneRatesGroupKey.class new file mode 100644 index 0000000..0f98d20 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneRatesGroupKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSegmentRate.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSegmentRate.class new file mode 100644 index 0000000..6db9872 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSegmentRate.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSegmentRateKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSegmentRateKey.class new file mode 100644 index 0000000..ffcfe34 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSegmentRateKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentCharges.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentCharges.class new file mode 100644 index 0000000..315a9a6 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentCharges.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentChargesKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentChargesKey.class new file mode 100644 index 0000000..70bd060 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentChargesKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentRates.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentRates.class new file mode 100644 index 0000000..441628e Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentRates.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentRatesKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentRatesKey.class new file mode 100644 index 0000000..09687a3 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductInstallmentRatesKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductLiquidation.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductLiquidation.class new file mode 100644 index 0000000..37175a0 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductLiquidation.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductLiquidationKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductLiquidationKey.class new file mode 100644 index 0000000..d46c241 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductLiquidationKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductRate.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductRate.class new file mode 100644 index 0000000..e66bcf2 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductRate.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductRateKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductRateKey.class new file mode 100644 index 0000000..1209a5b Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/product/rate/TgeneSubProductRateKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/prov/TgeneDefaultProvision.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/prov/TgeneDefaultProvision.class new file mode 100644 index 0000000..a06b2ba Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/prov/TgeneDefaultProvision.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/prov/TgeneDefaultProvisionKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/prov/TgeneDefaultProvisionKey.class new file mode 100644 index 0000000..92f2b39 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/prov/TgeneDefaultProvisionKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/receive/TreceivableTemplate.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/receive/TreceivableTemplate.class new file mode 100644 index 0000000..9ae1e8d Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/receive/TreceivableTemplate.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/receive/TreceivableTemplateDesc.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/receive/TreceivableTemplateDesc.class new file mode 100644 index 0000000..d745152 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/receive/TreceivableTemplateDesc.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/receive/TreceivableTemplateDescKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/receive/TreceivableTemplateDescKey.class new file mode 100644 index 0000000..3f5a0c0 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/receive/TreceivableTemplateDescKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/receive/TreceivableTemplateDetail.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/receive/TreceivableTemplateDetail.class new file mode 100644 index 0000000..59c0d11 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/receive/TreceivableTemplateDetail.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/receive/TreceivableTemplateDetailKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/receive/TreceivableTemplateDetailKey.class new file mode 100644 index 0000000..b9e0223 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/receive/TreceivableTemplateDetailKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/receive/acco/TreceivableAccountDemanDepo.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/receive/acco/TreceivableAccountDemanDepo.class new file mode 100644 index 0000000..7333f84 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/receive/acco/TreceivableAccountDemanDepo.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/receive/acco/TreceivableAccountDemanDepoKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/receive/acco/TreceivableAccountDemanDepoKey.class new file mode 100644 index 0000000..78c978c Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/receive/acco/TreceivableAccountDemanDepoKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/report/TgeneReport.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/report/TgeneReport.class new file mode 100644 index 0000000..61ceb4b Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/report/TgeneReport.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/report/TgeneReportDetail.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/report/TgeneReportDetail.class new file mode 100644 index 0000000..57a8b57 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/report/TgeneReportDetail.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/report/TgeneReportDetailKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/report/TgeneReportDetailKey.class new file mode 100644 index 0000000..801967d Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/report/TgeneReportDetailKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/report/TgeneReportKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/report/TgeneReportKey.class new file mode 100644 index 0000000..e1c6378 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/report/TgeneReportKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/report/TgeneSubprodReports.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/report/TgeneSubprodReports.class new file mode 100644 index 0000000..a2e45ba Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/report/TgeneSubprodReports.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/report/TgeneSubprodReportsKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/report/TgeneSubprodReportsKey.class new file mode 100644 index 0000000..242fecd Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/report/TgeneSubprodReportsKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/result/TgeneResults.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/result/TgeneResults.class new file mode 100644 index 0000000..5b86e46 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/result/TgeneResults.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/result/TgeneResultsKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/result/TgeneResultsKey.class new file mode 100644 index 0000000..eecf97f Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/result/TgeneResultsKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeAudit.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeAudit.class new file mode 100644 index 0000000..4d500f2 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeAudit.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeAuditInsDel.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeAuditInsDel.class new file mode 100644 index 0000000..2ec87f0 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeAuditInsDel.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeAuditInsDelKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeAuditInsDelKey.class new file mode 100644 index 0000000..8fe8032 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeAuditInsDelKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeAuditKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeAuditKey.class new file mode 100644 index 0000000..6726930 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeAuditKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeJavaScript.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeJavaScript.class new file mode 100644 index 0000000..e2be37b Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeJavaScript.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeJavaScriptKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeJavaScriptKey.class new file mode 100644 index 0000000..cff08b7 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeJavaScriptKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafePassword.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafePassword.class new file mode 100644 index 0000000..e6bb602 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafePassword.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafePasswordKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafePasswordKey.class new file mode 100644 index 0000000..b0b0c14 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafePasswordKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeProfile.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeProfile.class new file mode 100644 index 0000000..3aecb53 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeProfile.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeProfileHorary.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeProfileHorary.class new file mode 100644 index 0000000..6e42766 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeProfileHorary.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeProfileHoraryAmount.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeProfileHoraryAmount.class new file mode 100644 index 0000000..eeaf937 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeProfileHoraryAmount.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeProfileHoraryAmountKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeProfileHoraryAmountKey.class new file mode 100644 index 0000000..2984df1 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeProfileHoraryAmountKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeProfileHoraryKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeProfileHoraryKey.class new file mode 100644 index 0000000..e9e0702 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeProfileHoraryKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeTerminal.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeTerminal.class new file mode 100644 index 0000000..cbd88cf Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeTerminal.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeTerminalKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeTerminalKey.class new file mode 100644 index 0000000..d95f6c4 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeTerminalKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUser.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUser.class new file mode 100644 index 0000000..df5881d Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUser.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserDetail.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserDetail.class new file mode 100644 index 0000000..aa0a22d Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserDetail.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserDetailKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserDetailKey.class new file mode 100644 index 0000000..8723103 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserDetailKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserProfile.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserProfile.class new file mode 100644 index 0000000..617a4df Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserProfile.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserProfileKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserProfileKey.class new file mode 100644 index 0000000..53673a8 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserProfileKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserSession.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserSession.class new file mode 100644 index 0000000..83e340f Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserSession.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserSessionKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserSessionKey.class new file mode 100644 index 0000000..a9c9b03 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserSessionKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserSessionLog.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserSessionLog.class new file mode 100644 index 0000000..8f6877b Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserSessionLog.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserSessionLogKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserSessionLogKey.class new file mode 100644 index 0000000..18460a4 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/safe/TsafeUserSessionLogKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/schedule/TgeneScheduleEvent.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/schedule/TgeneScheduleEvent.class new file mode 100644 index 0000000..46ed244 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/schedule/TgeneScheduleEvent.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/schedule/TgeneScheduleLog.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/schedule/TgeneScheduleLog.class new file mode 100644 index 0000000..209ab8c Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/schedule/TgeneScheduleLog.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/schedule/TgeneScheduleLogKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/schedule/TgeneScheduleLogKey.class new file mode 100644 index 0000000..7967896 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/schedule/TgeneScheduleLogKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/schedule/TgeneScheduleParameters.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/schedule/TgeneScheduleParameters.class new file mode 100644 index 0000000..3e8a8f2 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/schedule/TgeneScheduleParameters.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/schedule/TgeneScheduleProcess.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/schedule/TgeneScheduleProcess.class new file mode 100644 index 0000000..d1f3955 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/schedule/TgeneScheduleProcess.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneAccountScore.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneAccountScore.class new file mode 100644 index 0000000..cda8494 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneAccountScore.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneAccountScoreDetail.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneAccountScoreDetail.class new file mode 100644 index 0000000..6f0e926 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneAccountScoreDetail.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneAccountScoreDetailKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneAccountScoreDetailKey.class new file mode 100644 index 0000000..0e4dfc2 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneAccountScoreDetailKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneAccountScoreJournal.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneAccountScoreJournal.class new file mode 100644 index 0000000..754ae33 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneAccountScoreJournal.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneAccountScoreJournalKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneAccountScoreJournalKey.class new file mode 100644 index 0000000..34c2c76 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneAccountScoreJournalKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneAccountScoreKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneAccountScoreKey.class new file mode 100644 index 0000000..81c6de7 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneAccountScoreKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgenePercentScore.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgenePercentScore.class new file mode 100644 index 0000000..e8f1d9e Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgenePercentScore.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgenePercentScoreKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgenePercentScoreKey.class new file mode 100644 index 0000000..b0e1096 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgenePercentScoreKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScore.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScore.class new file mode 100644 index 0000000..65eb2f3 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScore.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreAdjustment.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreAdjustment.class new file mode 100644 index 0000000..5acbdb8 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreAdjustment.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreAdjustmentKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreAdjustmentKey.class new file mode 100644 index 0000000..348edf2 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreAdjustmentKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreFileIssues.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreFileIssues.class new file mode 100644 index 0000000..4559773 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreFileIssues.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreFileIssuesKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreFileIssuesKey.class new file mode 100644 index 0000000..2c88f08 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreFileIssuesKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreHeader.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreHeader.class new file mode 100644 index 0000000..378bf32 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreHeader.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreHeaderKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreHeaderKey.class new file mode 100644 index 0000000..ca042db Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreHeaderKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreRank.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreRank.class new file mode 100644 index 0000000..392c6a8 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreRank.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreRankKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreRankKey.class new file mode 100644 index 0000000..1509317 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/score/TgeneScoreRankKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/seq/TgeneSequences.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/seq/TgeneSequences.class new file mode 100644 index 0000000..3453b94 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/seq/TgeneSequences.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/test/TtestValores.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/test/TtestValores.class new file mode 100644 index 0000000..4828ad9 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/test/TtestValores.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransaction.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransaction.class new file mode 100644 index 0000000..501becc Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransaction.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionEvent.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionEvent.class new file mode 100644 index 0000000..39ac280 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionEvent.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionEventKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionEventKey.class new file mode 100644 index 0000000..edb64c7 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionEventKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionFinanProcess.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionFinanProcess.class new file mode 100644 index 0000000..7ac8535 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionFinanProcess.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionFinanProcessKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionFinanProcessKey.class new file mode 100644 index 0000000..94b039c Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionFinanProcessKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionGlosary.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionGlosary.class new file mode 100644 index 0000000..52d7ab7 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionGlosary.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionGlosaryKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionGlosaryKey.class new file mode 100644 index 0000000..a6357e4 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionGlosaryKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionItem.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionItem.class new file mode 100644 index 0000000..8495fbe Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionItem.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionItemDetail.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionItemDetail.class new file mode 100644 index 0000000..0546bda Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionItemDetail.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionItemDetailKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionItemDetailKey.class new file mode 100644 index 0000000..d42494f Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionItemDetailKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionItemKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionItemKey.class new file mode 100644 index 0000000..4d2f4a8 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionItemKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionItemProcess.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionItemProcess.class new file mode 100644 index 0000000..5396b03 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionItemProcess.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionItemProcessKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionItemProcessKey.class new file mode 100644 index 0000000..1b28d70 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionItemProcessKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionKey.class new file mode 100644 index 0000000..049270c Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionProcess.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionProcess.class new file mode 100644 index 0000000..c0f449f Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionProcess.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionProcessKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionProcessKey.class new file mode 100644 index 0000000..c4cd965 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionProcessKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionProvision.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionProvision.class new file mode 100644 index 0000000..50c7103 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionProvision.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionProvisionKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionProvisionKey.class new file mode 100644 index 0000000..740e7e0 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/TgeneTransactionProvisionKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/report/TgeneTransactionReports.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/report/TgeneTransactionReports.class new file mode 100644 index 0000000..43761c0 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/report/TgeneTransactionReports.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/report/TgeneTransactionReportsKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/report/TgeneTransactionReportsKey.class new file mode 100644 index 0000000..531807a Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/trans/report/TgeneTransactionReportsKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/transf/TgeneMaturation.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/transf/TgeneMaturation.class new file mode 100644 index 0000000..3b47203 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/transf/TgeneMaturation.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/transf/TgeneMaturationKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/transf/TgeneMaturationKey.class new file mode 100644 index 0000000..a9a50a9 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/transf/TgeneMaturationKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/transf/TgeneTransfer.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/transf/TgeneTransfer.class new file mode 100644 index 0000000..9ef6264 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/transf/TgeneTransfer.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/transf/TgeneTransferDetail.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/transf/TgeneTransferDetail.class new file mode 100644 index 0000000..2076b14 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/transf/TgeneTransferDetail.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/transf/TgeneTransferDetailKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/transf/TgeneTransferDetailKey.class new file mode 100644 index 0000000..e9cd528 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/transf/TgeneTransferDetailKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/transf/TgeneTransferStatus.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/transf/TgeneTransferStatus.class new file mode 100644 index 0000000..fb4f604 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/transf/TgeneTransferStatus.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/vault/TgeneVault.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/vault/TgeneVault.class new file mode 100644 index 0000000..9405718 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/vault/TgeneVault.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/vault/TgeneVaultDetail.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/vault/TgeneVaultDetail.class new file mode 100644 index 0000000..7d19a30 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/vault/TgeneVaultDetail.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/vault/TgeneVaultDetailKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/vault/TgeneVaultDetailKey.class new file mode 100644 index 0000000..9aad787 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/vault/TgeneVaultDetailKey.class differ diff --git a/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/vault/TgeneVaultKey.class b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/vault/TgeneVaultKey.class new file mode 100644 index 0000000..bfc4ff0 Binary files /dev/null and b/base/persistence/pgeneral/target/classes/com/fp/persistence/pgeneral/vault/TgeneVaultKey.class differ diff --git a/base/persistence/pgeneral/target/maven-archiver/pom.properties b/base/persistence/pgeneral/target/maven-archiver/pom.properties new file mode 100644 index 0000000..edf0d9d --- /dev/null +++ b/base/persistence/pgeneral/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:52:47 ECT 2022 +version=2.1 +groupId=com.fp.base.persistence +artifactId=pgeneral diff --git a/base/persistence/pgeneral/target/pgeneral-2.1.jar b/base/persistence/pgeneral/target/pgeneral-2.1.jar new file mode 100644 index 0000000..f762477 Binary files /dev/null and b/base/persistence/pgeneral/target/pgeneral-2.1.jar differ diff --git a/base/persistence/plog/.svn/dir-prop-base b/base/persistence/plog/.svn/dir-prop-base new file mode 100644 index 0000000..40820ff --- /dev/null +++ b/base/persistence/plog/.svn/dir-prop-base @@ -0,0 +1,6 @@ +K 10 +svn:ignore +V 7 +target + +END diff --git a/base/persistence/plog/.svn/entries b/base/persistence/plog/.svn/entries new file mode 100644 index 0000000..8708a7b --- /dev/null +++ b/base/persistence/plog/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/plog +svn://172.17.26.185/COMACO + + + +2014-10-17T05:34:35.839741Z +1670 +jvaca +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:26.438733Z +2fa09b88961b71498cd63487cfe0c966 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +527 + diff --git a/base/persistence/plog/.svn/text-base/pom.xml.svn-base b/base/persistence/plog/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..44cdd84 --- /dev/null +++ b/base/persistence/plog/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,14 @@ + + + 4.0.0 + + persistence + com.fp.base + 2.1 + + com.fp.base.persistence + plog + 2.1 + plog + diff --git a/base/persistence/plog/pom.xml b/base/persistence/plog/pom.xml new file mode 100644 index 0000000..44cdd84 --- /dev/null +++ b/base/persistence/plog/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + + persistence + com.fp.base + 2.1 + + com.fp.base.persistence + plog + 2.1 + plog + diff --git a/base/persistence/plog/src/.svn/entries b/base/persistence/plog/src/.svn/entries new file mode 100644 index 0000000..b08ea0d --- /dev/null +++ b/base/persistence/plog/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/plog/src +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/base/persistence/plog/src/main/.svn/entries b/base/persistence/plog/src/main/.svn/entries new file mode 100644 index 0000000..ccdcd2f --- /dev/null +++ b/base/persistence/plog/src/main/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/plog/src/main +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + diff --git a/base/persistence/plog/src/main/java/.svn/entries b/base/persistence/plog/src/main/java/.svn/entries new file mode 100644 index 0000000..603bda3 --- /dev/null +++ b/base/persistence/plog/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/plog/src/main/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/persistence/plog/src/main/java/com/.svn/entries b/base/persistence/plog/src/main/java/com/.svn/entries new file mode 100644 index 0000000..57bb890 --- /dev/null +++ b/base/persistence/plog/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/plog/src/main/java/com +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/persistence/plog/src/main/java/com/fp/.svn/entries b/base/persistence/plog/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..925ed27 --- /dev/null +++ b/base/persistence/plog/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/plog/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +persistence +dir + diff --git a/base/persistence/plog/src/main/java/com/fp/persistence/.svn/entries b/base/persistence/plog/src/main/java/com/fp/persistence/.svn/entries new file mode 100644 index 0000000..0f44281 --- /dev/null +++ b/base/persistence/plog/src/main/java/com/fp/persistence/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/plog/src/main/java/com/fp/persistence +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +plog +dir + diff --git a/base/persistence/plog/src/main/java/com/fp/persistence/plog/.svn/entries b/base/persistence/plog/src/main/java/com/fp/persistence/plog/.svn/entries new file mode 100644 index 0000000..f5853f8 --- /dev/null +++ b/base/persistence/plog/src/main/java/com/fp/persistence/plog/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/plog/src/main/java/com/fp/persistence/plog +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +log +dir + diff --git a/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/.svn/entries b/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/.svn/entries new file mode 100644 index 0000000..20c6860 --- /dev/null +++ b/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/.svn/entries @@ -0,0 +1,198 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/plog/src/main/java/com/fp/persistence/plog/log +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TlogLoadError.java +file + + + + +2022-07-28T03:40:26.128731Z +ce1a8a23a84307b55847386b5236be50 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4542 + +TlogLoad.java +file + + + + +2022-07-28T03:40:26.128731Z +630025b9bcdbd709cfea6eeef8461756 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4450 + +TlogLoadErrorKey.java +file + + + + +2022-07-28T03:40:26.129731Z +cee290eaaa2afc3beeeef492c10ecdd1 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4234 + +TlogHeader.java +file + + + + +2022-07-28T03:40:26.129731Z +e3aaa5027dd23e9399a02d9b2d040b08 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7925 + +TlogLoadKey.java +file + + + + +2022-07-28T03:40:26.129731Z +9c6f35a1bab0778d028a703c4372b303 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3369 + diff --git a/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/.svn/text-base/TlogHeader.java.svn-base b/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/.svn/text-base/TlogHeader.java.svn-base new file mode 100644 index 0000000..667f1e2 --- /dev/null +++ b/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/.svn/text-base/TlogHeader.java.svn-base @@ -0,0 +1,307 @@ +package com.fp.persistence.plog.log; + +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TLOGHEADER*/ +@Entity(name="TlogHeader") +@Table(name="TLOGHEADER") +public class TlogHeader extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TlogHeader +*/ +@Id +@Column(name="JOURNALID" ,nullable=false, updatable=false) +private String pk; +@Column(name="ACCOUNTINGDATE", nullable=true) + +/** +* Fecha contable en la que se ejecuta la transaccion +*/ +private Timestamp accountingdate; + +@Column(name="TRANSACTIONMODULE", nullable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="REALDATE", nullable=true) + +/** +* Fecha real de ejecucion de una transaccion +*/ +private Timestamp realdate; + +@Column(name="COMPANYCODE", nullable=true) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="BRANCHCODE", nullable=true) + +/** +* Codigo de sucursal de ejecucion de la transaccion. +*/ +private Integer branchcode; + +@Column(name="OFFICECODE", nullable=true) + +/** +* Codigo de oficina de ejecucion de la transaccion +*/ +private Integer officecode; + +@Column(name="USERCODE", nullable=true) + +/** +* Codigo de usuario que ejecuta la transaccion +*/ +private String usercode; + +@Column(name="ADITIONALDATA", nullable=true) + +/** +* Texto libre +*/ +private String aditionaldata; + +/**Contructor por defecto*/ +public TlogHeader(){ +} +/**Contructor de TlogHeader +@param pPk Clave Primaria del entity +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +*/ +public TlogHeader(String pPk,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion){ + this(); + pk=pPk; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TlogHeader +*/ +public static TlogHeader find(EntityManager pEntityManager,Object pKey) throws Exception{ + TlogHeader obj = pEntityManager.find(TlogHeader.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TlogHeader +@return El objeto que referencia a la Clave primaria de TlogHeader +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TlogHeader +@param pPk El objeto que referencia a la nueva Clave primaria de TlogHeader +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de accountingdate +@return valor de accountingdate*/ +public Timestamp getAccountingdate(){ + return accountingdate; +} +/**Fija el valor de accountingdate +@param pAccountingdate nuevo Valor de accountingdate*/ +public void setAccountingdate(Timestamp pAccountingdate){ + accountingdate=pAccountingdate; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Timestamp getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Timestamp pRealdate){ + realdate=pRealdate; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de aditionaldata +@return valor de aditionaldata*/ +public String getAditionaldata(){ + return aditionaldata; +} +/**Fija el valor de aditionaldata +@param pAditionaldata nuevo Valor de aditionaldata*/ +public void setAditionaldata(String pAditionaldata){ + aditionaldata=pAditionaldata; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TlogHeader))return false; + TlogHeader that = (TlogHeader) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TlogHeader +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TlogHeader +*/ +public Object createInstance(){ + TlogHeader instance=new TlogHeader(); + return instance; +} +/**Clona la entidad TlogHeader +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TlogHeader p=(TlogHeader)this.clone(); + return p; +} +} diff --git a/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/.svn/text-base/TlogLoad.java.svn-base b/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/.svn/text-base/TlogLoad.java.svn-base new file mode 100644 index 0000000..e8fa433 --- /dev/null +++ b/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/.svn/text-base/TlogLoad.java.svn-base @@ -0,0 +1,175 @@ +package com.fp.persistence.plog.log; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TLOGLOAD*/ +@Entity(name="TlogLoad") +@Table(name="TLOGLOAD") +public class TlogLoad extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TlogLoad +*/ +@EmbeddedId +private TlogLoadKey pk; +@Column(name="LOADID", nullable=true) + +/** +* Id de la carga, puede ser el codigo de persona, numero de lote, numero de cuenta. +*/ +private String loadid; + +@Column(name="STATUS", nullable=true) + +/** +* Status de ejecucion de la carga P en proceso, E error, S sucessfull +*/ +private String status; + +@Column(name="ADITIONALDATA", nullable=true) + +/** +* Texto libre +*/ +private String aditionaldata; + +/**Contructor por defecto*/ +public TlogLoad(){ +} +/**Contructor de TlogLoad +@param pPk Clave Primaria del entity +*/ +public TlogLoad(TlogLoadKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TlogLoad +*/ +public static TlogLoad find(EntityManager pEntityManager,TlogLoadKey pKey) throws Exception{ + TlogLoad obj = pEntityManager.find(TlogLoad.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TlogLoad +@return El objeto que referencia a la Clave primaria de TlogLoad +*/ +public TlogLoadKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TlogLoad +@param pPk El objeto que referencia a la nueva Clave primaria de TlogLoad +*/ +public void setPk(TlogLoadKey pPk){ + pk=pPk; +} +/**Obtiene el valor de loadid +@return valor de loadid*/ +public String getLoadid(){ + return loadid; +} +/**Fija el valor de loadid +@param pLoadid nuevo Valor de loadid*/ +public void setLoadid(String pLoadid){ + loadid=pLoadid; +} + +/**Obtiene el valor de status +@return valor de status*/ +public String getStatus(){ + return status; +} +/**Fija el valor de status +@param pStatus nuevo Valor de status*/ +public void setStatus(String pStatus){ + status=pStatus; +} + +/**Obtiene el valor de aditionaldata +@return valor de aditionaldata*/ +public String getAditionaldata(){ + return aditionaldata; +} +/**Fija el valor de aditionaldata +@param pAditionaldata nuevo Valor de aditionaldata*/ +public void setAditionaldata(String pAditionaldata){ + aditionaldata=pAditionaldata; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TlogLoad))return false; + TlogLoad that = (TlogLoad) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TlogLoad +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TlogLoad +*/ +public Object createInstance(){ + TlogLoad instance=new TlogLoad(); + instance.setPk(new TlogLoadKey()); + return instance; +} +/**Clona la entidad TlogLoad +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TlogLoad p=(TlogLoad)this.clone(); + p.setPk((TlogLoadKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/.svn/text-base/TlogLoadError.java.svn-base b/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/.svn/text-base/TlogLoadError.java.svn-base new file mode 100644 index 0000000..9c6f4f1 --- /dev/null +++ b/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/.svn/text-base/TlogLoadError.java.svn-base @@ -0,0 +1,175 @@ +package com.fp.persistence.plog.log; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TLOGLOADERROR*/ +@Entity(name="TlogLoadError") +@Table(name="TLOGLOADERROR") +public class TlogLoadError extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TlogLoadError +*/ +@EmbeddedId +private TlogLoadErrorKey pk; +@Column(name="RESULTCODE", nullable=true) + +/** +* Codigo de resultado +*/ +private String resultcode; + +@Column(name="MESSAGE", nullable=true) + +/** +* Texto del error +*/ +private String message; + +@Column(name="IDENTIFIER", nullable=true) + +/** +* Identificado del subproceso +*/ +private String identifier; + +/**Contructor por defecto*/ +public TlogLoadError(){ +} +/**Contructor de TlogLoadError +@param pPk Clave Primaria del entity +*/ +public TlogLoadError(TlogLoadErrorKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TlogLoadError +*/ +public static TlogLoadError find(EntityManager pEntityManager,TlogLoadErrorKey pKey) throws Exception{ + TlogLoadError obj = pEntityManager.find(TlogLoadError.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TlogLoadError +@return El objeto que referencia a la Clave primaria de TlogLoadError +*/ +public TlogLoadErrorKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TlogLoadError +@param pPk El objeto que referencia a la nueva Clave primaria de TlogLoadError +*/ +public void setPk(TlogLoadErrorKey pPk){ + pk=pPk; +} +/**Obtiene el valor de resultcode +@return valor de resultcode*/ +public String getResultcode(){ + return resultcode; +} +/**Fija el valor de resultcode +@param pResultcode nuevo Valor de resultcode*/ +public void setResultcode(String pResultcode){ + resultcode=pResultcode; +} + +/**Obtiene el valor de message +@return valor de message*/ +public String getMessage(){ + return message; +} +/**Fija el valor de message +@param pMessage nuevo Valor de message*/ +public void setMessage(String pMessage){ + message=pMessage; +} + +/**Obtiene el valor de identifier +@return valor de identifier*/ +public String getIdentifier(){ + return identifier; +} +/**Fija el valor de identifier +@param pIdentifier nuevo Valor de identifier*/ +public void setIdentifier(String pIdentifier){ + identifier=pIdentifier; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TlogLoadError))return false; + TlogLoadError that = (TlogLoadError) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TlogLoadError +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TlogLoadError +*/ +public Object createInstance(){ + TlogLoadError instance=new TlogLoadError(); + instance.setPk(new TlogLoadErrorKey()); + return instance; +} +/**Clona la entidad TlogLoadError +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TlogLoadError p=(TlogLoadError)this.clone(); + p.setPk((TlogLoadErrorKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/.svn/text-base/TlogLoadErrorKey.java.svn-base b/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/.svn/text-base/TlogLoadErrorKey.java.svn-base new file mode 100644 index 0000000..8c20759 --- /dev/null +++ b/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/.svn/text-base/TlogLoadErrorKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.plog.log; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TLOGLOADERROR*/ +@Embeddable +public class TlogLoadErrorKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="JOURNALID", nullable=false,updatable=false) + +/** +* Numero de mensaje asociado a la transaccion. +*/ +private String journalid; + +@Column(name="LOADSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de la carga cuando se porcesa lotes +*/ +private Long loadsequence; + +@Column(name="ERRORSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de error +*/ +private Integer errorsequence; + +/**Contructor por defecto*/ +public TlogLoadErrorKey(){} +/**Contructor de TlogLoadErrorKey +@param pJournalid Numero de mensaje asociado a la transaccion. +@param pLoadsequence Secuencia de la carga cuando se porcesa lotes +@param pErrorsequence Secuencia de error +*/ +public TlogLoadErrorKey(String pJournalid,Long pLoadsequence,Integer pErrorsequence){ + journalid=pJournalid; + loadsequence=pLoadsequence; + errorsequence=pErrorsequence; +} +/**Obtiene el valor de journalid +@return valor de journalid*/ +public String getJournalid(){ + return journalid; +} +/**Fija el valor de journalid +@param pJournalid nuevo Valor de journalid*/ +public void setJournalid(String pJournalid){ + journalid=pJournalid; +} + +/**Obtiene el valor de loadsequence +@return valor de loadsequence*/ +public Long getLoadsequence(){ + return loadsequence; +} +/**Fija el valor de loadsequence +@param pLoadsequence nuevo Valor de loadsequence*/ +public void setLoadsequence(Long pLoadsequence){ + loadsequence=pLoadsequence; +} + +/**Obtiene el valor de errorsequence +@return valor de errorsequence*/ +public Integer getErrorsequence(){ + return errorsequence; +} +/**Fija el valor de errorsequence +@param pErrorsequence nuevo Valor de errorsequence*/ +public void setErrorsequence(Integer pErrorsequence){ + errorsequence=pErrorsequence; +} + +/**Implementacion de la comparacion de TlogLoadErrorKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TlogLoadErrorKey))return false; + TlogLoadErrorKey that = (TlogLoadErrorKey) o; + if (this.getJournalid() == null || that.getJournalid() == null){ + return false; + } + if (! this.getJournalid().equals(that.getJournalid())){ + return false; + } + if (this.getLoadsequence() == null || that.getLoadsequence() == null){ + return false; + } + if (! this.getLoadsequence().equals(that.getLoadsequence())){ + return false; + } + if (this.getErrorsequence() == null || that.getErrorsequence() == null){ + return false; + } + if (! this.getErrorsequence().equals(that.getErrorsequence())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TlogLoadErrorKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getJournalid() == null ? 0 : this.getJournalid().hashCode()); + result = result * 37 + (this.getLoadsequence() == null ? 0 : this.getLoadsequence().hashCode()); + result = result * 37 + (this.getErrorsequence() == null ? 0 : this.getErrorsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/.svn/text-base/TlogLoadKey.java.svn-base b/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/.svn/text-base/TlogLoadKey.java.svn-base new file mode 100644 index 0000000..a9948e8 --- /dev/null +++ b/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/.svn/text-base/TlogLoadKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.plog.log; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TLOGLOAD*/ +@Embeddable +public class TlogLoadKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="JOURNALID", nullable=false,updatable=false) + +/** +* Numero de mensaje asociado a la transaccion. +*/ +private String journalid; + +@Column(name="LOADSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de la carga cuando se porcesa lotes +*/ +private Long loadsequence; + +/**Contructor por defecto*/ +public TlogLoadKey(){} +/**Contructor de TlogLoadKey +@param pJournalid Numero de mensaje asociado a la transaccion. +@param pLoadsequence Secuencia de la carga cuando se porcesa lotes +*/ +public TlogLoadKey(String pJournalid,Long pLoadsequence){ + journalid=pJournalid; + loadsequence=pLoadsequence; +} +/**Obtiene el valor de journalid +@return valor de journalid*/ +public String getJournalid(){ + return journalid; +} +/**Fija el valor de journalid +@param pJournalid nuevo Valor de journalid*/ +public void setJournalid(String pJournalid){ + journalid=pJournalid; +} + +/**Obtiene el valor de loadsequence +@return valor de loadsequence*/ +public Long getLoadsequence(){ + return loadsequence; +} +/**Fija el valor de loadsequence +@param pLoadsequence nuevo Valor de loadsequence*/ +public void setLoadsequence(Long pLoadsequence){ + loadsequence=pLoadsequence; +} + +/**Implementacion de la comparacion de TlogLoadKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TlogLoadKey))return false; + TlogLoadKey that = (TlogLoadKey) o; + if (this.getJournalid() == null || that.getJournalid() == null){ + return false; + } + if (! this.getJournalid().equals(that.getJournalid())){ + return false; + } + if (this.getLoadsequence() == null || that.getLoadsequence() == null){ + return false; + } + if (! this.getLoadsequence().equals(that.getLoadsequence())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TlogLoadKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getJournalid() == null ? 0 : this.getJournalid().hashCode()); + result = result * 37 + (this.getLoadsequence() == null ? 0 : this.getLoadsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/TlogHeader.java b/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/TlogHeader.java new file mode 100644 index 0000000..667f1e2 --- /dev/null +++ b/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/TlogHeader.java @@ -0,0 +1,307 @@ +package com.fp.persistence.plog.log; + +import javax.persistence.Entity; +import java.sql.Timestamp; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TLOGHEADER*/ +@Entity(name="TlogHeader") +@Table(name="TLOGHEADER") +public class TlogHeader extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TlogHeader +*/ +@Id +@Column(name="JOURNALID" ,nullable=false, updatable=false) +private String pk; +@Column(name="ACCOUNTINGDATE", nullable=true) + +/** +* Fecha contable en la que se ejecuta la transaccion +*/ +private Timestamp accountingdate; + +@Column(name="TRANSACTIONMODULE", nullable=false) + +/** +* Modulo al que pertence la transaccion +*/ +private String transactionmodule; + +@Column(name="TRANSACTIONCODE", nullable=false) + +/** +* Codigo de transaccion dentro del modulo +*/ +private Integer transactioncode; + +@Column(name="TRANSACTIONVERSION", nullable=false) + +/** +* Version de transaccion +*/ +private Integer transactionversion; + +@Column(name="REALDATE", nullable=true) + +/** +* Fecha real de ejecucion de una transaccion +*/ +private Timestamp realdate; + +@Column(name="COMPANYCODE", nullable=true) + +/** +* Codigo de compania +*/ +private Integer companycode; + +@Column(name="BRANCHCODE", nullable=true) + +/** +* Codigo de sucursal de ejecucion de la transaccion. +*/ +private Integer branchcode; + +@Column(name="OFFICECODE", nullable=true) + +/** +* Codigo de oficina de ejecucion de la transaccion +*/ +private Integer officecode; + +@Column(name="USERCODE", nullable=true) + +/** +* Codigo de usuario que ejecuta la transaccion +*/ +private String usercode; + +@Column(name="ADITIONALDATA", nullable=true) + +/** +* Texto libre +*/ +private String aditionaldata; + +/**Contructor por defecto*/ +public TlogHeader(){ +} +/**Contructor de TlogHeader +@param pPk Clave Primaria del entity +@param pTransactionmodule Modulo al que pertence la transaccion +@param pTransactioncode Codigo de transaccion dentro del modulo +@param pTransactionversion Version de transaccion +*/ +public TlogHeader(String pPk,String pTransactionmodule,Integer pTransactioncode,Integer pTransactionversion){ + this(); + pk=pPk; + transactionmodule=pTransactionmodule; + transactioncode=pTransactioncode; + transactionversion=pTransactionversion; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TlogHeader +*/ +public static TlogHeader find(EntityManager pEntityManager,Object pKey) throws Exception{ + TlogHeader obj = pEntityManager.find(TlogHeader.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TlogHeader +@return El objeto que referencia a la Clave primaria de TlogHeader +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TlogHeader +@param pPk El objeto que referencia a la nueva Clave primaria de TlogHeader +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de accountingdate +@return valor de accountingdate*/ +public Timestamp getAccountingdate(){ + return accountingdate; +} +/**Fija el valor de accountingdate +@param pAccountingdate nuevo Valor de accountingdate*/ +public void setAccountingdate(Timestamp pAccountingdate){ + accountingdate=pAccountingdate; +} + +/**Obtiene el valor de transactionmodule +@return valor de transactionmodule*/ +public String getTransactionmodule(){ + return transactionmodule; +} +/**Fija el valor de transactionmodule +@param pTransactionmodule nuevo Valor de transactionmodule*/ +public void setTransactionmodule(String pTransactionmodule){ + transactionmodule=pTransactionmodule; +} + +/**Obtiene el valor de transactioncode +@return valor de transactioncode*/ +public Integer getTransactioncode(){ + return transactioncode; +} +/**Fija el valor de transactioncode +@param pTransactioncode nuevo Valor de transactioncode*/ +public void setTransactioncode(Integer pTransactioncode){ + transactioncode=pTransactioncode; +} + +/**Obtiene el valor de transactionversion +@return valor de transactionversion*/ +public Integer getTransactionversion(){ + return transactionversion; +} +/**Fija el valor de transactionversion +@param pTransactionversion nuevo Valor de transactionversion*/ +public void setTransactionversion(Integer pTransactionversion){ + transactionversion=pTransactionversion; +} + +/**Obtiene el valor de realdate +@return valor de realdate*/ +public Timestamp getRealdate(){ + return realdate; +} +/**Fija el valor de realdate +@param pRealdate nuevo Valor de realdate*/ +public void setRealdate(Timestamp pRealdate){ + realdate=pRealdate; +} + +/**Obtiene el valor de companycode +@return valor de companycode*/ +public Integer getCompanycode(){ + return companycode; +} +/**Fija el valor de companycode +@param pCompanycode nuevo Valor de companycode*/ +public void setCompanycode(Integer pCompanycode){ + companycode=pCompanycode; +} + +/**Obtiene el valor de branchcode +@return valor de branchcode*/ +public Integer getBranchcode(){ + return branchcode; +} +/**Fija el valor de branchcode +@param pBranchcode nuevo Valor de branchcode*/ +public void setBranchcode(Integer pBranchcode){ + branchcode=pBranchcode; +} + +/**Obtiene el valor de officecode +@return valor de officecode*/ +public Integer getOfficecode(){ + return officecode; +} +/**Fija el valor de officecode +@param pOfficecode nuevo Valor de officecode*/ +public void setOfficecode(Integer pOfficecode){ + officecode=pOfficecode; +} + +/**Obtiene el valor de usercode +@return valor de usercode*/ +public String getUsercode(){ + return usercode; +} +/**Fija el valor de usercode +@param pUsercode nuevo Valor de usercode*/ +public void setUsercode(String pUsercode){ + usercode=pUsercode; +} + +/**Obtiene el valor de aditionaldata +@return valor de aditionaldata*/ +public String getAditionaldata(){ + return aditionaldata; +} +/**Fija el valor de aditionaldata +@param pAditionaldata nuevo Valor de aditionaldata*/ +public void setAditionaldata(String pAditionaldata){ + aditionaldata=pAditionaldata; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TlogHeader))return false; + TlogHeader that = (TlogHeader) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TlogHeader +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TlogHeader +*/ +public Object createInstance(){ + TlogHeader instance=new TlogHeader(); + return instance; +} +/**Clona la entidad TlogHeader +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TlogHeader p=(TlogHeader)this.clone(); + return p; +} +} diff --git a/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/TlogLoad.java b/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/TlogLoad.java new file mode 100644 index 0000000..e8fa433 --- /dev/null +++ b/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/TlogLoad.java @@ -0,0 +1,175 @@ +package com.fp.persistence.plog.log; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TLOGLOAD*/ +@Entity(name="TlogLoad") +@Table(name="TLOGLOAD") +public class TlogLoad extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TlogLoad +*/ +@EmbeddedId +private TlogLoadKey pk; +@Column(name="LOADID", nullable=true) + +/** +* Id de la carga, puede ser el codigo de persona, numero de lote, numero de cuenta. +*/ +private String loadid; + +@Column(name="STATUS", nullable=true) + +/** +* Status de ejecucion de la carga P en proceso, E error, S sucessfull +*/ +private String status; + +@Column(name="ADITIONALDATA", nullable=true) + +/** +* Texto libre +*/ +private String aditionaldata; + +/**Contructor por defecto*/ +public TlogLoad(){ +} +/**Contructor de TlogLoad +@param pPk Clave Primaria del entity +*/ +public TlogLoad(TlogLoadKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TlogLoad +*/ +public static TlogLoad find(EntityManager pEntityManager,TlogLoadKey pKey) throws Exception{ + TlogLoad obj = pEntityManager.find(TlogLoad.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TlogLoad +@return El objeto que referencia a la Clave primaria de TlogLoad +*/ +public TlogLoadKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TlogLoad +@param pPk El objeto que referencia a la nueva Clave primaria de TlogLoad +*/ +public void setPk(TlogLoadKey pPk){ + pk=pPk; +} +/**Obtiene el valor de loadid +@return valor de loadid*/ +public String getLoadid(){ + return loadid; +} +/**Fija el valor de loadid +@param pLoadid nuevo Valor de loadid*/ +public void setLoadid(String pLoadid){ + loadid=pLoadid; +} + +/**Obtiene el valor de status +@return valor de status*/ +public String getStatus(){ + return status; +} +/**Fija el valor de status +@param pStatus nuevo Valor de status*/ +public void setStatus(String pStatus){ + status=pStatus; +} + +/**Obtiene el valor de aditionaldata +@return valor de aditionaldata*/ +public String getAditionaldata(){ + return aditionaldata; +} +/**Fija el valor de aditionaldata +@param pAditionaldata nuevo Valor de aditionaldata*/ +public void setAditionaldata(String pAditionaldata){ + aditionaldata=pAditionaldata; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TlogLoad))return false; + TlogLoad that = (TlogLoad) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TlogLoad +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TlogLoad +*/ +public Object createInstance(){ + TlogLoad instance=new TlogLoad(); + instance.setPk(new TlogLoadKey()); + return instance; +} +/**Clona la entidad TlogLoad +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TlogLoad p=(TlogLoad)this.clone(); + p.setPk((TlogLoadKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/TlogLoadError.java b/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/TlogLoadError.java new file mode 100644 index 0000000..9c6f4f1 --- /dev/null +++ b/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/TlogLoadError.java @@ -0,0 +1,175 @@ +package com.fp.persistence.plog.log; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla TLOGLOADERROR*/ +@Entity(name="TlogLoadError") +@Table(name="TLOGLOADERROR") +public class TlogLoadError extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad TlogLoadError +*/ +@EmbeddedId +private TlogLoadErrorKey pk; +@Column(name="RESULTCODE", nullable=true) + +/** +* Codigo de resultado +*/ +private String resultcode; + +@Column(name="MESSAGE", nullable=true) + +/** +* Texto del error +*/ +private String message; + +@Column(name="IDENTIFIER", nullable=true) + +/** +* Identificado del subproceso +*/ +private String identifier; + +/**Contructor por defecto*/ +public TlogLoadError(){ +} +/**Contructor de TlogLoadError +@param pPk Clave Primaria del entity +*/ +public TlogLoadError(TlogLoadErrorKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return TlogLoadError +*/ +public static TlogLoadError find(EntityManager pEntityManager,TlogLoadErrorKey pKey) throws Exception{ + TlogLoadError obj = pEntityManager.find(TlogLoadError.class,pKey); + return obj; +} +/**Entrega la Clave primaria de TlogLoadError +@return El objeto que referencia a la Clave primaria de TlogLoadError +*/ +public TlogLoadErrorKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de TlogLoadError +@param pPk El objeto que referencia a la nueva Clave primaria de TlogLoadError +*/ +public void setPk(TlogLoadErrorKey pPk){ + pk=pPk; +} +/**Obtiene el valor de resultcode +@return valor de resultcode*/ +public String getResultcode(){ + return resultcode; +} +/**Fija el valor de resultcode +@param pResultcode nuevo Valor de resultcode*/ +public void setResultcode(String pResultcode){ + resultcode=pResultcode; +} + +/**Obtiene el valor de message +@return valor de message*/ +public String getMessage(){ + return message; +} +/**Fija el valor de message +@param pMessage nuevo Valor de message*/ +public void setMessage(String pMessage){ + message=pMessage; +} + +/**Obtiene el valor de identifier +@return valor de identifier*/ +public String getIdentifier(){ + return identifier; +} +/**Fija el valor de identifier +@param pIdentifier nuevo Valor de identifier*/ +public void setIdentifier(String pIdentifier){ + identifier=pIdentifier; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof TlogLoadError))return false; + TlogLoadError that = (TlogLoadError) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad TlogLoadError +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco TlogLoadError +*/ +public Object createInstance(){ + TlogLoadError instance=new TlogLoadError(); + instance.setPk(new TlogLoadErrorKey()); + return instance; +} +/**Clona la entidad TlogLoadError +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + TlogLoadError p=(TlogLoadError)this.clone(); + p.setPk((TlogLoadErrorKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/TlogLoadErrorKey.java b/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/TlogLoadErrorKey.java new file mode 100644 index 0000000..8c20759 --- /dev/null +++ b/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/TlogLoadErrorKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.plog.log; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TLOGLOADERROR*/ +@Embeddable +public class TlogLoadErrorKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="JOURNALID", nullable=false,updatable=false) + +/** +* Numero de mensaje asociado a la transaccion. +*/ +private String journalid; + +@Column(name="LOADSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de la carga cuando se porcesa lotes +*/ +private Long loadsequence; + +@Column(name="ERRORSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de error +*/ +private Integer errorsequence; + +/**Contructor por defecto*/ +public TlogLoadErrorKey(){} +/**Contructor de TlogLoadErrorKey +@param pJournalid Numero de mensaje asociado a la transaccion. +@param pLoadsequence Secuencia de la carga cuando se porcesa lotes +@param pErrorsequence Secuencia de error +*/ +public TlogLoadErrorKey(String pJournalid,Long pLoadsequence,Integer pErrorsequence){ + journalid=pJournalid; + loadsequence=pLoadsequence; + errorsequence=pErrorsequence; +} +/**Obtiene el valor de journalid +@return valor de journalid*/ +public String getJournalid(){ + return journalid; +} +/**Fija el valor de journalid +@param pJournalid nuevo Valor de journalid*/ +public void setJournalid(String pJournalid){ + journalid=pJournalid; +} + +/**Obtiene el valor de loadsequence +@return valor de loadsequence*/ +public Long getLoadsequence(){ + return loadsequence; +} +/**Fija el valor de loadsequence +@param pLoadsequence nuevo Valor de loadsequence*/ +public void setLoadsequence(Long pLoadsequence){ + loadsequence=pLoadsequence; +} + +/**Obtiene el valor de errorsequence +@return valor de errorsequence*/ +public Integer getErrorsequence(){ + return errorsequence; +} +/**Fija el valor de errorsequence +@param pErrorsequence nuevo Valor de errorsequence*/ +public void setErrorsequence(Integer pErrorsequence){ + errorsequence=pErrorsequence; +} + +/**Implementacion de la comparacion de TlogLoadErrorKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TlogLoadErrorKey))return false; + TlogLoadErrorKey that = (TlogLoadErrorKey) o; + if (this.getJournalid() == null || that.getJournalid() == null){ + return false; + } + if (! this.getJournalid().equals(that.getJournalid())){ + return false; + } + if (this.getLoadsequence() == null || that.getLoadsequence() == null){ + return false; + } + if (! this.getLoadsequence().equals(that.getLoadsequence())){ + return false; + } + if (this.getErrorsequence() == null || that.getErrorsequence() == null){ + return false; + } + if (! this.getErrorsequence().equals(that.getErrorsequence())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TlogLoadErrorKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getJournalid() == null ? 0 : this.getJournalid().hashCode()); + result = result * 37 + (this.getLoadsequence() == null ? 0 : this.getLoadsequence().hashCode()); + result = result * 37 + (this.getErrorsequence() == null ? 0 : this.getErrorsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/TlogLoadKey.java b/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/TlogLoadKey.java new file mode 100644 index 0000000..a9948e8 --- /dev/null +++ b/base/persistence/plog/src/main/java/com/fp/persistence/plog/log/TlogLoadKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.plog.log; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de TLOGLOAD*/ +@Embeddable +public class TlogLoadKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="JOURNALID", nullable=false,updatable=false) + +/** +* Numero de mensaje asociado a la transaccion. +*/ +private String journalid; + +@Column(name="LOADSEQUENCE", nullable=false,updatable=false) + +/** +* Secuencia de la carga cuando se porcesa lotes +*/ +private Long loadsequence; + +/**Contructor por defecto*/ +public TlogLoadKey(){} +/**Contructor de TlogLoadKey +@param pJournalid Numero de mensaje asociado a la transaccion. +@param pLoadsequence Secuencia de la carga cuando se porcesa lotes +*/ +public TlogLoadKey(String pJournalid,Long pLoadsequence){ + journalid=pJournalid; + loadsequence=pLoadsequence; +} +/**Obtiene el valor de journalid +@return valor de journalid*/ +public String getJournalid(){ + return journalid; +} +/**Fija el valor de journalid +@param pJournalid nuevo Valor de journalid*/ +public void setJournalid(String pJournalid){ + journalid=pJournalid; +} + +/**Obtiene el valor de loadsequence +@return valor de loadsequence*/ +public Long getLoadsequence(){ + return loadsequence; +} +/**Fija el valor de loadsequence +@param pLoadsequence nuevo Valor de loadsequence*/ +public void setLoadsequence(Long pLoadsequence){ + loadsequence=pLoadsequence; +} + +/**Implementacion de la comparacion de TlogLoadKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof TlogLoadKey))return false; + TlogLoadKey that = (TlogLoadKey) o; + if (this.getJournalid() == null || that.getJournalid() == null){ + return false; + } + if (! this.getJournalid().equals(that.getJournalid())){ + return false; + } + if (this.getLoadsequence() == null || that.getLoadsequence() == null){ + return false; + } + if (! this.getLoadsequence().equals(that.getLoadsequence())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia TlogLoadKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getJournalid() == null ? 0 : this.getJournalid().hashCode()); + result = result * 37 + (this.getLoadsequence() == null ? 0 : this.getLoadsequence().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/plog/src/test/.svn/entries b/base/persistence/plog/src/test/.svn/entries new file mode 100644 index 0000000..21d0567 --- /dev/null +++ b/base/persistence/plog/src/test/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/plog/src/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + diff --git a/base/persistence/plog/src/test/java/.svn/entries b/base/persistence/plog/src/test/java/.svn/entries new file mode 100644 index 0000000..5881e59 --- /dev/null +++ b/base/persistence/plog/src/test/java/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/plog/src/test/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/persistence/plog/target/classes/com/fp/persistence/plog/log/TlogHeader.class b/base/persistence/plog/target/classes/com/fp/persistence/plog/log/TlogHeader.class new file mode 100644 index 0000000..4059cf2 Binary files /dev/null and b/base/persistence/plog/target/classes/com/fp/persistence/plog/log/TlogHeader.class differ diff --git a/base/persistence/plog/target/classes/com/fp/persistence/plog/log/TlogLoad.class b/base/persistence/plog/target/classes/com/fp/persistence/plog/log/TlogLoad.class new file mode 100644 index 0000000..dc2cba8 Binary files /dev/null and b/base/persistence/plog/target/classes/com/fp/persistence/plog/log/TlogLoad.class differ diff --git a/base/persistence/plog/target/classes/com/fp/persistence/plog/log/TlogLoadError.class b/base/persistence/plog/target/classes/com/fp/persistence/plog/log/TlogLoadError.class new file mode 100644 index 0000000..3e92e1b Binary files /dev/null and b/base/persistence/plog/target/classes/com/fp/persistence/plog/log/TlogLoadError.class differ diff --git a/base/persistence/plog/target/classes/com/fp/persistence/plog/log/TlogLoadErrorKey.class b/base/persistence/plog/target/classes/com/fp/persistence/plog/log/TlogLoadErrorKey.class new file mode 100644 index 0000000..f10e51d Binary files /dev/null and b/base/persistence/plog/target/classes/com/fp/persistence/plog/log/TlogLoadErrorKey.class differ diff --git a/base/persistence/plog/target/classes/com/fp/persistence/plog/log/TlogLoadKey.class b/base/persistence/plog/target/classes/com/fp/persistence/plog/log/TlogLoadKey.class new file mode 100644 index 0000000..af6155b Binary files /dev/null and b/base/persistence/plog/target/classes/com/fp/persistence/plog/log/TlogLoadKey.class differ diff --git a/base/persistence/plog/target/maven-archiver/pom.properties b/base/persistence/plog/target/maven-archiver/pom.properties new file mode 100644 index 0000000..44e70e5 --- /dev/null +++ b/base/persistence/plog/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:53:01 ECT 2022 +version=2.1 +groupId=com.fp.base.persistence +artifactId=plog diff --git a/base/persistence/plog/target/plog-2.1.jar b/base/persistence/plog/target/plog-2.1.jar new file mode 100644 index 0000000..7bc404f Binary files /dev/null and b/base/persistence/plog/target/plog-2.1.jar differ diff --git a/base/persistence/pom.xml b/base/persistence/pom.xml new file mode 100644 index 0000000..777df78 --- /dev/null +++ b/base/persistence/pom.xml @@ -0,0 +1,53 @@ + + + + base + com.fp + 2.1 + + 4.0.0 + com.fp.base + persistence + persistence + 2.1 + pom + Financial Lifecycle Process Persistence Beans + + commondb + pgeneral + pcustomer + pbpm + util + plog + pviaticos + pfirmas + parmas + + + + com.fp.base.dto + dto + ${project.version} + + + com.fp.base.dto + common + ${project.version} + + + org.jboss.spec.javax.ejb + jboss-ejb-api_3.1_spec + provided + + + org.hibernate + hibernate-core + provided + + + org.hibernate + hibernate-entitymanager + provided + + + \ No newline at end of file diff --git a/base/persistence/pviaticos/.svn/dir-prop-base b/base/persistence/pviaticos/.svn/dir-prop-base new file mode 100644 index 0000000..40820ff --- /dev/null +++ b/base/persistence/pviaticos/.svn/dir-prop-base @@ -0,0 +1,6 @@ +K 10 +svn:ignore +V 7 +target + +END diff --git a/base/persistence/pviaticos/.svn/entries b/base/persistence/pviaticos/.svn/entries new file mode 100644 index 0000000..5579f19 --- /dev/null +++ b/base/persistence/pviaticos/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pviaticos +svn://172.17.26.185/COMACO + + + +2014-10-17T05:34:35.839741Z +1670 +jvaca +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:27.210736Z +dccea537a1348889f4b541484270135b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +682 + diff --git a/base/persistence/pviaticos/.svn/text-base/pom.xml.svn-base b/base/persistence/pviaticos/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..ae17dbc --- /dev/null +++ b/base/persistence/pviaticos/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,21 @@ + + + 4.0.0 + + com.fp.base + persistence + 2.1 + + com.fp.base.persistence + pviaticos + pviaticos + + + + com.fp.base.core + bpm + 2.1 + + + diff --git a/base/persistence/pviaticos/pom.xml b/base/persistence/pviaticos/pom.xml new file mode 100644 index 0000000..ae17dbc --- /dev/null +++ b/base/persistence/pviaticos/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + + com.fp.base + persistence + 2.1 + + com.fp.base.persistence + pviaticos + pviaticos + + + + com.fp.base.core + bpm + 2.1 + + + diff --git a/base/persistence/pviaticos/src/.svn/entries b/base/persistence/pviaticos/src/.svn/entries new file mode 100644 index 0000000..52f3de9 --- /dev/null +++ b/base/persistence/pviaticos/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pviaticos/src +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/base/persistence/pviaticos/src/main/.svn/entries b/base/persistence/pviaticos/src/main/.svn/entries new file mode 100644 index 0000000..c1ebe2d --- /dev/null +++ b/base/persistence/pviaticos/src/main/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pviaticos/src/main +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + diff --git a/base/persistence/pviaticos/src/main/java/.svn/entries b/base/persistence/pviaticos/src/main/java/.svn/entries new file mode 100644 index 0000000..1c07e38 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pviaticos/src/main/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/persistence/pviaticos/src/main/java/com/.svn/entries b/base/persistence/pviaticos/src/main/java/com/.svn/entries new file mode 100644 index 0000000..323930f --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pviaticos/src/main/java/com +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/persistence/pviaticos/src/main/java/com/fp/.svn/entries b/base/persistence/pviaticos/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..5b77104 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pviaticos/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +persistence +dir + diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/.svn/entries b/base/persistence/pviaticos/src/main/java/com/fp/persistence/.svn/entries new file mode 100644 index 0000000..07cb97f --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pviaticos/src/main/java/com/fp/persistence +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +pviaticos +dir + diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/.svn/entries b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/.svn/entries new file mode 100644 index 0000000..fb0e03e --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/.svn/entries @@ -0,0 +1,37 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +solicitud +dir + +param +dir + +hra +dir + diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/hra/.svn/entries b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/hra/.svn/entries new file mode 100644 index 0000000..74e1957 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/hra/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/hra +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +Empleado.java +file + + + + +2022-07-28T03:40:26.969735Z +006bb16e76cb1762a870f69c34a36668 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +12452 + +EmpleadoJpql.java +file + + + + +2022-07-28T03:40:26.969735Z +d3a22a0761db7892aa6145a9e8e7406a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3374 + diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/hra/.svn/text-base/Empleado.java.svn-base b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/hra/.svn/text-base/Empleado.java.svn-base new file mode 100644 index 0000000..a6cf3ca --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/hra/.svn/text-base/Empleado.java.svn-base @@ -0,0 +1,540 @@ +package com.fp.persistence.pviaticos.hra; + +import java.io.Serializable; + +import com.fp.dto.hb.HibernateBean; + +/** + * Clase de transporte de la informacion de un empleado de la sbs, la informacion la obtiene de la vista + * HRA.VWDATOSEMPLEADOS. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class Empleado extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + + private static final long serialVersionUID = 1L; + + /** + * Codigo de empleado. + */ + private String codigo; + + /** + * Nombre + apellido del empleado. + */ + private String nombre; + + /** + * Numero de cedula del empleado. + */ + private String cedula; + + /** + * Codigo de puesto del empleado. + */ + private String cargo; + + /** + * Nombre de puesto del empleado. + */ + private String nombreCargo; + + /** + * Entrega la direccin email asociada al empleado. + */ + private String email; + + /** + * Nombre del banco en el cual tiene una cuenta el empleado. + */ + private String banco; + + /** + * Tipo de cuenta bancaria del empleado. + */ + private String tipoCuenta; + + /** + * Numero de cuenta que mantiene el empleado de la sbs en el banco. + */ + private String cuenta; + + /** + * Codigo de area a la que pertenece el empleado. + */ + private String codigoArea; + + /** + * Nombre de area a la que pertenece el empleado. + */ + private String nombreArea; + + /** + * Codigo de empleado asociado al jefe del empleado. + */ + private String codigoJefe; + + /** + * Nombre del jefe del empleado. + */ + private String nombreJefe; + + /** + * Codigo del responsable de la unidad asociado al empleado. + */ + private String codigoResponsableUnidad; + + /** + * Nombre del responsable de la unidad a la que pertecene el empleado. + */ + private String nombreResponsableUnidad; + + /** + * Nombre de cargo del jefe. + */ + private String nombreCargoJefe; + + /** + * Nombre de cargo responsable de la unidad. + */ + private String nombreCargoResponsableUnidad; + + /** + * Codiogo de usuario web del servidor publico. + */ + private String usuarioweb; + + /** + * Codiogo de usuario web del servidor publico. + */ + private String codigoLocalidad; + /** + * Estado del servidor + */ + private String estado; + /** + * Atributo localidad + */ + private String localidad; + /** + * Constructor Empleado + * @param obj + * @return + * @throws Exception + */ + public static Empleado cerar(Object[] obj) throws Exception { + Empleado e = new Empleado(); + e.setCodigo((String) obj[0]); + e.setNombre((String) obj[1]); + e.setCedula((String) obj[2]); + e.setCargo((String) obj[3]); + e.setNombreCargo((String) obj[4]); + e.setEmail((String) obj[5]); + e.setBanco((String) obj[6]); + e.setTipoCuenta((String) obj[7]); + e.setCuenta((String) obj[8]); + e.setCodigoArea((String) obj[9]); + e.setNombreArea((String) obj[10]); + e.setCodigoJefe((String) obj[11]); + e.setCodigoResponsableUnidad((String) obj[12]); + e.setNombreJefe((String) obj[13]); + e.setNombreResponsableUnidad((String) obj[14]); + e.setNombreCargoJefe((String) obj[15]); + e.setNombreCargoResponsableUnidad((String) obj[16]); + e.setUsuarioweb((String) obj[17]); + e.setCodigoLocalidad((String) obj[18]); + e.setEstado((String) obj[19]); + e.setLocalidad((String) obj[20]); + return e; + } + + /** + * Entrega el valor de: codigo + * + * @return String + */ + public String getCodigo() { + return codigo; + } + + /** + * Fija el valor de: codigo + * + * @param codigo Valor del parametro a fijar en el atributo + */ + public void setCodigo(String codigo) { + this.codigo = codigo; + } + + /** + * Entrega el valor de: nombre + * + * @return String + */ + public String getNombre() { + return nombre; + } + + /** + * Fija el valor de: nombre + * + * @param nombre Valor del parametro a fijar en el atributo + */ + public void setNombre(String nombre) { + this.nombre = nombre; + } + + /** + * Entrega el valor de: cedula + * + * @return String + */ + public String getCedula() { + return cedula; + } + + /** + * Fija el valor de: cedula + * + * @param cedula Valor del parametro a fijar en el atributo + */ + public void setCedula(String cedula) { + this.cedula = cedula; + } + + /** + * Entrega el valor de: cargo + * + * @return String + */ + public String getCargo() { + return cargo; + } + + /** + * Fija el valor de: cargo + * + * @param cargo Valor del parametro a fijar en el atributo + */ + public void setCargo(String cargo) { + this.cargo = cargo; + } + + /** + * Entrega el valor de: nombreCargo + * + * @return String + */ + public String getNombreCargo() { + return nombreCargo; + } + + /** + * Fija el valor de: nombreCargo + * + * @param nombreCargo Valor del parametro a fijar en el atributo + */ + public void setNombreCargo(String nombreCargo) { + this.nombreCargo = nombreCargo; + } + + /** + * Entrega el valor de: email + * + * @return String + */ + public String getEmail() { + return email; + } + + /** + * Fija el valor de: email + * + * @param email Valor del parametro a fijar en el atributo + */ + public void setEmail(String email) { + this.email = email; + } + + /** + * Entrega el valor de: banco + * + * @return String + */ + public String getBanco() { + return banco; + } + + /** + * Fija el valor de: banco + * + * @param banco Valor del parametro a fijar en el atributo + */ + public void setBanco(String banco) { + this.banco = banco; + } + + /** + * Entrega el valor de: tipoCuenta + * + * @return String + */ + public String getTipoCuenta() { + return tipoCuenta; + } + + /** + * Fija el valor de: tipoCuenta + * + * @param tipoCuenta Valor del parametro a fijar en el atributo + */ + public void setTipoCuenta(String tipoCuenta) { + this.tipoCuenta = tipoCuenta; + } + + /** + * Entrega el valor de: cuenta + * + * @return String + */ + public String getCuenta() { + return cuenta; + } + + /** + * Fija el valor de: cuenta + * + * @param cuenta Valor del parametro a fijar en el atributo + */ + public void setCuenta(String cuenta) { + this.cuenta = cuenta; + } + + /** + * Entrega el valor de: codigoArea + * + * @return String + */ + public String getCodigoArea() { + return codigoArea; + } + + /** + * Fija el valor de: codigoArea + * + * @param codigoArea Valor del parametro a fijar en el atributo + */ + public void setCodigoArea(String codigoArea) { + this.codigoArea = codigoArea; + } + + /** + * Entrega el valor de: nombreArea + * + * @return String + */ + public String getNombreArea() { + return nombreArea; + } + + /** + * Fija el valor de: nombreArea + * + * @param nombreArea Valor del parametro a fijar en el atributo + */ + public void setNombreArea(String nombreArea) { + this.nombreArea = nombreArea; + } + + /** + * Entrega el valor de: codigoJefe + * + * @return String + */ + public String getCodigoJefe() { + return codigoJefe; + } + + /** + * Fija el valor de: codigoJefe + * + * @param codigoJefe Valor del parametro a fijar en el atributo + */ + public void setCodigoJefe(String codigoJefe) { + this.codigoJefe = codigoJefe; + } + + /** + * Entrega el valor de: nombreJefe + * + * @return String + */ + public String getNombreJefe() { + return nombreJefe; + } + + /** + * Fija el valor de: nombreJefe + * + * @param nombreJefe Valor del parametro a fijar en el atributo + */ + public void setNombreJefe(String nombreJefe) { + this.nombreJefe = nombreJefe; + } + + /** + * Entrega el valor de: codigoResponsableUnidad + * + * @return String + */ + public String getCodigoResponsableUnidad() { + return codigoResponsableUnidad; + } + + /** + * Fija el valor de: codigoResponsableUnidad + * + * @param codigoResponsableUnidad Valor del parametro a fijar en el atributo + */ + public void setCodigoResponsableUnidad(String codigoResponsableUnidad) { + this.codigoResponsableUnidad = codigoResponsableUnidad; + } + + /** + * Entrega el valor de: nombreResponsableUnidad + * + * @return String + */ + public String getNombreResponsableUnidad() { + return nombreResponsableUnidad; + } + + /** + * Fija el valor de: nombreResponsableUnidad + * + * @param nombreResponsableUnidad Valor del parametro a fijar en el atributo + */ + public void setNombreResponsableUnidad(String nombreResponsableUnidad) { + this.nombreResponsableUnidad = nombreResponsableUnidad; + } + + /** + * Entrega el valor de: nombreCargoJefe + * + * @return String + */ + public String getNombreCargoJefe() { + return nombreCargoJefe; + } + + /** + * Fija el valor de: nombreCargoJefe + * + * @param nombreCargoJefe Valor del parametro a fijar en el atributo + */ + public void setNombreCargoJefe(String nombreCargoJefe) { + this.nombreCargoJefe = nombreCargoJefe; + } + + /** + * Entrega el valor de: nombreCargoResponsableUnidad + * + * @return String + */ + public String getNombreCargoResponsableUnidad() { + return nombreCargoResponsableUnidad; + } + + /** + * Fija el valor de: nombreCargoResponsableUnidad + * + * @param nombreCargoResponsableUnidad Valor del parametro a fijar en el atributo + */ + public void setNombreCargoResponsableUnidad(String nombreCargoResponsableUnidad) { + this.nombreCargoResponsableUnidad = nombreCargoResponsableUnidad; + } + + /** + * Entrega el valor de: usuarioweb + * + * @return String + */ + public String getUsuarioweb() { + return usuarioweb; + } + + /** + * Fija el valor de: usuarioweb + * + * @param usuarioweb + */ + public void setUsuarioweb(String usuarioweb) { + this.usuarioweb = usuarioweb; + } + + /** + * Entrega el valor de: codigoLocalidad + * + * @return String + */ + public String getCodigoLocalidad() { + return codigoLocalidad; + } + + /** + * Fija el valor de: codigoLocalidad + * + * @param codigoLocalidad + */ + public void setCodigoLocalidad(String codigoLocalidad) { + this.codigoLocalidad = codigoLocalidad; + } + + /** + * Crea una instancia de Empleado. + */ + @Override + public Object createInstance() throws Exception { + Empleado instance = new Empleado(); + return instance; + } + + /** + * Clona y entrega una instancia de empleado. + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + Empleado p = (Empleado) this.clone(); + return p; + } + /** + * Entrega el valor del estado del empleado + * @return estado + */ + public String getEstado() { + return estado; + } + /** + * Fija el valor del estado del empleado + * @param estado + */ + public void setEstado(String estado) { + this.estado = estado; + } + /** + * Entrega el nombre localidad + * @return localidad + */ + public String getLocalidad() { + return localidad; + } + /** + * Fija el nombre localidad + * @fija localidad + */ + public void setLocalidad(String localidad) { + this.localidad = localidad; + } + +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/hra/.svn/text-base/EmpleadoJpql.java.svn-base b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/hra/.svn/text-base/EmpleadoJpql.java.svn-base new file mode 100644 index 0000000..e06e733 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/hra/.svn/text-base/EmpleadoJpql.java.svn-base @@ -0,0 +1,79 @@ +package com.fp.persistence.pviaticos.hra; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.query.DtoQuery; +import com.fp.persistence.commondb.PersistenceHelper; + +/** + * Clase que se encarga de consultar informacin de la vista HRA.VWDATOSEMPLEADOS. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class EmpleadoJpql extends QueryJsf { + + private static String SQL = "select codigo_empleado, apellidos ||' '||nombres as nombre, cedula, codigo_puesto as cargo, nombre_puesto as nomcargo, correo, " + + "banco, tipo_cuenta,cuenta, codigo_area, nombre_area, codigo_jefe, codigo_responsable," + + "( select unique(apellidos ||' '||nombres) from HRA.VWDATOSEMPLEADOS i where i.codigo_empleado = t.codigo_jefe) as njefe, " + + "( select unique(apellidos ||' '||nombres) from HRA.VWDATOSEMPLEADOS i where i.codigo_empleado = t.codigo_responsable) as nrespunidad, " + + "(select i.nombre_puesto from HRA.VWDATOSEMPLEADOS i where i.CODIGO_EMPLEADO = t.CODIGO_JEFE) as cargo_jefe, " + + "(select i.nombre_puesto from HRA.VWDATOSEMPLEADOS i where i.CODIGO_EMPLEADO = t.CODIGO_RESPONSABLE) as cargo_supervisor, " + + "usuario_web, codigo_localidad, estado, " + + "(select cd.description from tgenecatalogdetail cd where cd.catalogcode = 'CUDADORIGEN' and cd.catalog = t.codigo_localidad) as localidad" + + " from HRA.VWDATOSEMPLEADOS t"; + + /** + * + * @param codigoEmpleado Codigo de empleado + * @return Empleado + * @throws Exception + */ + public Empleado find(String codigoEmpleado) throws Exception { + Map mcriterios = new HashMap<>(); + mcriterios.put("codigo_empleado", codigoEmpleado); + DtoQuery dtoquery = new DtoQuery("com.fp.persistence.pviaticos.hra.Empleado", mcriterios); + Empleado emp = this.find(dtoquery).get(0); + return emp; + } + + /** + * + * @param codigoUsuarioWeb Codigo de usuario web. + * @return Empleado + * @throws Exception + */ + public Empleado findPorUsuarioWeb(String codigoUsuarioWeb) throws Exception { + Map mcriterios = new HashMap<>(); + mcriterios.put("usuario_web", codigoUsuarioWeb.toLowerCase()); + DtoQuery dtoquery = new DtoQuery("com.fp.persistence.pviaticos.hra.Empleado", mcriterios); + List empleados = this.find(dtoquery); + Empleado emp = null; + if (!empleados.isEmpty()) { + emp = empleados.get(0); + } + return emp; + } + + @SuppressWarnings("unchecked") + public List find(DtoQuery dtoquery) throws Exception { + List ldata = new ArrayList<>(); + where = new StringBuffer(46); + super.mparameter.clear(); + super.buildCriteria(dtoquery); + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(EmpleadoJpql.SQL + (super.where == null ? "" : super.where.toString())); + super.setParameters(dtoquery, qry); + List lresp = qry.getResultList(); + for (Object[] obj : lresp) { + ldata.add(Empleado.cerar(obj)); + } + return ldata; + } + +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/hra/Empleado.java b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/hra/Empleado.java new file mode 100644 index 0000000..a6cf3ca --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/hra/Empleado.java @@ -0,0 +1,540 @@ +package com.fp.persistence.pviaticos.hra; + +import java.io.Serializable; + +import com.fp.dto.hb.HibernateBean; + +/** + * Clase de transporte de la informacion de un empleado de la sbs, la informacion la obtiene de la vista + * HRA.VWDATOSEMPLEADOS. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class Empleado extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + + private static final long serialVersionUID = 1L; + + /** + * Codigo de empleado. + */ + private String codigo; + + /** + * Nombre + apellido del empleado. + */ + private String nombre; + + /** + * Numero de cedula del empleado. + */ + private String cedula; + + /** + * Codigo de puesto del empleado. + */ + private String cargo; + + /** + * Nombre de puesto del empleado. + */ + private String nombreCargo; + + /** + * Entrega la direccin email asociada al empleado. + */ + private String email; + + /** + * Nombre del banco en el cual tiene una cuenta el empleado. + */ + private String banco; + + /** + * Tipo de cuenta bancaria del empleado. + */ + private String tipoCuenta; + + /** + * Numero de cuenta que mantiene el empleado de la sbs en el banco. + */ + private String cuenta; + + /** + * Codigo de area a la que pertenece el empleado. + */ + private String codigoArea; + + /** + * Nombre de area a la que pertenece el empleado. + */ + private String nombreArea; + + /** + * Codigo de empleado asociado al jefe del empleado. + */ + private String codigoJefe; + + /** + * Nombre del jefe del empleado. + */ + private String nombreJefe; + + /** + * Codigo del responsable de la unidad asociado al empleado. + */ + private String codigoResponsableUnidad; + + /** + * Nombre del responsable de la unidad a la que pertecene el empleado. + */ + private String nombreResponsableUnidad; + + /** + * Nombre de cargo del jefe. + */ + private String nombreCargoJefe; + + /** + * Nombre de cargo responsable de la unidad. + */ + private String nombreCargoResponsableUnidad; + + /** + * Codiogo de usuario web del servidor publico. + */ + private String usuarioweb; + + /** + * Codiogo de usuario web del servidor publico. + */ + private String codigoLocalidad; + /** + * Estado del servidor + */ + private String estado; + /** + * Atributo localidad + */ + private String localidad; + /** + * Constructor Empleado + * @param obj + * @return + * @throws Exception + */ + public static Empleado cerar(Object[] obj) throws Exception { + Empleado e = new Empleado(); + e.setCodigo((String) obj[0]); + e.setNombre((String) obj[1]); + e.setCedula((String) obj[2]); + e.setCargo((String) obj[3]); + e.setNombreCargo((String) obj[4]); + e.setEmail((String) obj[5]); + e.setBanco((String) obj[6]); + e.setTipoCuenta((String) obj[7]); + e.setCuenta((String) obj[8]); + e.setCodigoArea((String) obj[9]); + e.setNombreArea((String) obj[10]); + e.setCodigoJefe((String) obj[11]); + e.setCodigoResponsableUnidad((String) obj[12]); + e.setNombreJefe((String) obj[13]); + e.setNombreResponsableUnidad((String) obj[14]); + e.setNombreCargoJefe((String) obj[15]); + e.setNombreCargoResponsableUnidad((String) obj[16]); + e.setUsuarioweb((String) obj[17]); + e.setCodigoLocalidad((String) obj[18]); + e.setEstado((String) obj[19]); + e.setLocalidad((String) obj[20]); + return e; + } + + /** + * Entrega el valor de: codigo + * + * @return String + */ + public String getCodigo() { + return codigo; + } + + /** + * Fija el valor de: codigo + * + * @param codigo Valor del parametro a fijar en el atributo + */ + public void setCodigo(String codigo) { + this.codigo = codigo; + } + + /** + * Entrega el valor de: nombre + * + * @return String + */ + public String getNombre() { + return nombre; + } + + /** + * Fija el valor de: nombre + * + * @param nombre Valor del parametro a fijar en el atributo + */ + public void setNombre(String nombre) { + this.nombre = nombre; + } + + /** + * Entrega el valor de: cedula + * + * @return String + */ + public String getCedula() { + return cedula; + } + + /** + * Fija el valor de: cedula + * + * @param cedula Valor del parametro a fijar en el atributo + */ + public void setCedula(String cedula) { + this.cedula = cedula; + } + + /** + * Entrega el valor de: cargo + * + * @return String + */ + public String getCargo() { + return cargo; + } + + /** + * Fija el valor de: cargo + * + * @param cargo Valor del parametro a fijar en el atributo + */ + public void setCargo(String cargo) { + this.cargo = cargo; + } + + /** + * Entrega el valor de: nombreCargo + * + * @return String + */ + public String getNombreCargo() { + return nombreCargo; + } + + /** + * Fija el valor de: nombreCargo + * + * @param nombreCargo Valor del parametro a fijar en el atributo + */ + public void setNombreCargo(String nombreCargo) { + this.nombreCargo = nombreCargo; + } + + /** + * Entrega el valor de: email + * + * @return String + */ + public String getEmail() { + return email; + } + + /** + * Fija el valor de: email + * + * @param email Valor del parametro a fijar en el atributo + */ + public void setEmail(String email) { + this.email = email; + } + + /** + * Entrega el valor de: banco + * + * @return String + */ + public String getBanco() { + return banco; + } + + /** + * Fija el valor de: banco + * + * @param banco Valor del parametro a fijar en el atributo + */ + public void setBanco(String banco) { + this.banco = banco; + } + + /** + * Entrega el valor de: tipoCuenta + * + * @return String + */ + public String getTipoCuenta() { + return tipoCuenta; + } + + /** + * Fija el valor de: tipoCuenta + * + * @param tipoCuenta Valor del parametro a fijar en el atributo + */ + public void setTipoCuenta(String tipoCuenta) { + this.tipoCuenta = tipoCuenta; + } + + /** + * Entrega el valor de: cuenta + * + * @return String + */ + public String getCuenta() { + return cuenta; + } + + /** + * Fija el valor de: cuenta + * + * @param cuenta Valor del parametro a fijar en el atributo + */ + public void setCuenta(String cuenta) { + this.cuenta = cuenta; + } + + /** + * Entrega el valor de: codigoArea + * + * @return String + */ + public String getCodigoArea() { + return codigoArea; + } + + /** + * Fija el valor de: codigoArea + * + * @param codigoArea Valor del parametro a fijar en el atributo + */ + public void setCodigoArea(String codigoArea) { + this.codigoArea = codigoArea; + } + + /** + * Entrega el valor de: nombreArea + * + * @return String + */ + public String getNombreArea() { + return nombreArea; + } + + /** + * Fija el valor de: nombreArea + * + * @param nombreArea Valor del parametro a fijar en el atributo + */ + public void setNombreArea(String nombreArea) { + this.nombreArea = nombreArea; + } + + /** + * Entrega el valor de: codigoJefe + * + * @return String + */ + public String getCodigoJefe() { + return codigoJefe; + } + + /** + * Fija el valor de: codigoJefe + * + * @param codigoJefe Valor del parametro a fijar en el atributo + */ + public void setCodigoJefe(String codigoJefe) { + this.codigoJefe = codigoJefe; + } + + /** + * Entrega el valor de: nombreJefe + * + * @return String + */ + public String getNombreJefe() { + return nombreJefe; + } + + /** + * Fija el valor de: nombreJefe + * + * @param nombreJefe Valor del parametro a fijar en el atributo + */ + public void setNombreJefe(String nombreJefe) { + this.nombreJefe = nombreJefe; + } + + /** + * Entrega el valor de: codigoResponsableUnidad + * + * @return String + */ + public String getCodigoResponsableUnidad() { + return codigoResponsableUnidad; + } + + /** + * Fija el valor de: codigoResponsableUnidad + * + * @param codigoResponsableUnidad Valor del parametro a fijar en el atributo + */ + public void setCodigoResponsableUnidad(String codigoResponsableUnidad) { + this.codigoResponsableUnidad = codigoResponsableUnidad; + } + + /** + * Entrega el valor de: nombreResponsableUnidad + * + * @return String + */ + public String getNombreResponsableUnidad() { + return nombreResponsableUnidad; + } + + /** + * Fija el valor de: nombreResponsableUnidad + * + * @param nombreResponsableUnidad Valor del parametro a fijar en el atributo + */ + public void setNombreResponsableUnidad(String nombreResponsableUnidad) { + this.nombreResponsableUnidad = nombreResponsableUnidad; + } + + /** + * Entrega el valor de: nombreCargoJefe + * + * @return String + */ + public String getNombreCargoJefe() { + return nombreCargoJefe; + } + + /** + * Fija el valor de: nombreCargoJefe + * + * @param nombreCargoJefe Valor del parametro a fijar en el atributo + */ + public void setNombreCargoJefe(String nombreCargoJefe) { + this.nombreCargoJefe = nombreCargoJefe; + } + + /** + * Entrega el valor de: nombreCargoResponsableUnidad + * + * @return String + */ + public String getNombreCargoResponsableUnidad() { + return nombreCargoResponsableUnidad; + } + + /** + * Fija el valor de: nombreCargoResponsableUnidad + * + * @param nombreCargoResponsableUnidad Valor del parametro a fijar en el atributo + */ + public void setNombreCargoResponsableUnidad(String nombreCargoResponsableUnidad) { + this.nombreCargoResponsableUnidad = nombreCargoResponsableUnidad; + } + + /** + * Entrega el valor de: usuarioweb + * + * @return String + */ + public String getUsuarioweb() { + return usuarioweb; + } + + /** + * Fija el valor de: usuarioweb + * + * @param usuarioweb + */ + public void setUsuarioweb(String usuarioweb) { + this.usuarioweb = usuarioweb; + } + + /** + * Entrega el valor de: codigoLocalidad + * + * @return String + */ + public String getCodigoLocalidad() { + return codigoLocalidad; + } + + /** + * Fija el valor de: codigoLocalidad + * + * @param codigoLocalidad + */ + public void setCodigoLocalidad(String codigoLocalidad) { + this.codigoLocalidad = codigoLocalidad; + } + + /** + * Crea una instancia de Empleado. + */ + @Override + public Object createInstance() throws Exception { + Empleado instance = new Empleado(); + return instance; + } + + /** + * Clona y entrega una instancia de empleado. + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + Empleado p = (Empleado) this.clone(); + return p; + } + /** + * Entrega el valor del estado del empleado + * @return estado + */ + public String getEstado() { + return estado; + } + /** + * Fija el valor del estado del empleado + * @param estado + */ + public void setEstado(String estado) { + this.estado = estado; + } + /** + * Entrega el nombre localidad + * @return localidad + */ + public String getLocalidad() { + return localidad; + } + /** + * Fija el nombre localidad + * @fija localidad + */ + public void setLocalidad(String localidad) { + this.localidad = localidad; + } + +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/hra/EmpleadoJpql.java b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/hra/EmpleadoJpql.java new file mode 100644 index 0000000..e06e733 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/hra/EmpleadoJpql.java @@ -0,0 +1,79 @@ +package com.fp.persistence.pviaticos.hra; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.persistence.Query; + +import com.fp.bpm.query.QueryJsf; +import com.fp.dto.query.DtoQuery; +import com.fp.persistence.commondb.PersistenceHelper; + +/** + * Clase que se encarga de consultar informacin de la vista HRA.VWDATOSEMPLEADOS. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class EmpleadoJpql extends QueryJsf { + + private static String SQL = "select codigo_empleado, apellidos ||' '||nombres as nombre, cedula, codigo_puesto as cargo, nombre_puesto as nomcargo, correo, " + + "banco, tipo_cuenta,cuenta, codigo_area, nombre_area, codigo_jefe, codigo_responsable," + + "( select unique(apellidos ||' '||nombres) from HRA.VWDATOSEMPLEADOS i where i.codigo_empleado = t.codigo_jefe) as njefe, " + + "( select unique(apellidos ||' '||nombres) from HRA.VWDATOSEMPLEADOS i where i.codigo_empleado = t.codigo_responsable) as nrespunidad, " + + "(select i.nombre_puesto from HRA.VWDATOSEMPLEADOS i where i.CODIGO_EMPLEADO = t.CODIGO_JEFE) as cargo_jefe, " + + "(select i.nombre_puesto from HRA.VWDATOSEMPLEADOS i where i.CODIGO_EMPLEADO = t.CODIGO_RESPONSABLE) as cargo_supervisor, " + + "usuario_web, codigo_localidad, estado, " + + "(select cd.description from tgenecatalogdetail cd where cd.catalogcode = 'CUDADORIGEN' and cd.catalog = t.codigo_localidad) as localidad" + + " from HRA.VWDATOSEMPLEADOS t"; + + /** + * + * @param codigoEmpleado Codigo de empleado + * @return Empleado + * @throws Exception + */ + public Empleado find(String codigoEmpleado) throws Exception { + Map mcriterios = new HashMap<>(); + mcriterios.put("codigo_empleado", codigoEmpleado); + DtoQuery dtoquery = new DtoQuery("com.fp.persistence.pviaticos.hra.Empleado", mcriterios); + Empleado emp = this.find(dtoquery).get(0); + return emp; + } + + /** + * + * @param codigoUsuarioWeb Codigo de usuario web. + * @return Empleado + * @throws Exception + */ + public Empleado findPorUsuarioWeb(String codigoUsuarioWeb) throws Exception { + Map mcriterios = new HashMap<>(); + mcriterios.put("usuario_web", codigoUsuarioWeb.toLowerCase()); + DtoQuery dtoquery = new DtoQuery("com.fp.persistence.pviaticos.hra.Empleado", mcriterios); + List empleados = this.find(dtoquery); + Empleado emp = null; + if (!empleados.isEmpty()) { + emp = empleados.get(0); + } + return emp; + } + + @SuppressWarnings("unchecked") + public List find(DtoQuery dtoquery) throws Exception { + List ldata = new ArrayList<>(); + where = new StringBuffer(46); + super.mparameter.clear(); + super.buildCriteria(dtoquery); + Query qry = PersistenceHelper.getEntityManager().createNativeQuery(EmpleadoJpql.SQL + (super.where == null ? "" : super.where.toString())); + super.setParameters(dtoquery, qry); + List lresp = qry.getResultList(); + for (Object[] obj : lresp) { + ldata.add(Empleado.cerar(obj)); + } + return ldata; + } + +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/entries b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/entries new file mode 100644 index 0000000..abf0ccb --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/entries @@ -0,0 +1,266 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ViaEstado.java +file + + + + +2022-07-28T03:40:26.943735Z +ed6a1b60562c8a63a21bc53e3afae410 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4341 + +ViaCiudadUsuario.java +file + + + + +2022-07-28T03:40:26.943735Z +d07a2be7a77677b2816bd2f472348bb2 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6063 + +ViaDiasAcumuladosKey.java +file + + + + +2022-07-28T03:40:26.944735Z +e0ab8e316338870bc471ae27733edf00 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4163 + +ViaNotificacionMovilizacion.java +file + + + + +2022-07-28T03:40:26.944735Z +21764c44bc14267e9140dde520e53996 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5491 + +ViaCiudadUsuarioKey.java +file + + + + +2022-07-28T03:40:26.944735Z +d407b8f0562b1ac3411fbbc55a2abf4d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3920 + +ViaParametros.java +file + + + + +2022-07-28T03:40:26.944735Z +f5ba55380c3a3d6d28d140f516191cb7 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4773 + +ViaDiasAcumulados.java +file + + + + +2022-07-28T03:40:26.945735Z +2fc748089ae3fb7515f3eb5002ccba38 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4128 + diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/text-base/ViaCiudadUsuario.java.svn-base b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/text-base/ViaCiudadUsuario.java.svn-base new file mode 100644 index 0000000..308d93b --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/text-base/ViaCiudadUsuario.java.svn-base @@ -0,0 +1,201 @@ +package com.fp.persistence.pviaticos.param; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla VIA_CIUDAD_USUARIO*/ +@Entity(name="ViaCiudadUsuario") +@Table(name="VIA_CIUDAD_USUARIO") +public class ViaCiudadUsuario extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad ViaCiudadUsuario +*/ +@EmbeddedId +private ViaCiudadUsuarioKey pk; +@Column(name="COD_ACTIVIDAD_CATALOGCODE", nullable=false) + +/** +* Codigo de tabla de catalogo ACTIVIDAD_ +*/ +private String cod_actividad_catalogcode; + +@Column(name="COD_CIUDAD_CATALOGCODE", nullable=false) + +/** +* Codigo de tabla de catalogo CUDADORIGEN de los empleados de la sbs +*/ +private String cod_ciudad_catalogcode; + +@Column(name="COD_USUARIO", nullable=false) + +/** +* Codigo de usuario asociado a la ciudad +*/ +private String cod_usuario; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking del registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public ViaCiudadUsuario(){ +} +/**Contructor de ViaCiudadUsuario +@param pPk Clave Primaria del entity +@param pCod_actividad_catalogcode Codigo de tabla de catalogo ACTIVIDAD_ +@param pCod_ciudad_catalogcode Codigo de tabla de catalogo CUDADORIGEN de los empleados de la sbs +@param pCod_usuario Codigo de usuario asociado a la ciudad +*/ +public ViaCiudadUsuario(ViaCiudadUsuarioKey pPk,String pCod_actividad_catalogcode,String pCod_ciudad_catalogcode,String pCod_usuario){ + this(); + pk=pPk; + cod_actividad_catalogcode=pCod_actividad_catalogcode; + cod_ciudad_catalogcode=pCod_ciudad_catalogcode; + cod_usuario=pCod_usuario; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return ViaCiudadUsuario +*/ +public static ViaCiudadUsuario find(EntityManager pEntityManager,ViaCiudadUsuarioKey pKey) throws Exception{ + ViaCiudadUsuario obj = pEntityManager.find(ViaCiudadUsuario.class,pKey); + return obj; +} +/**Entrega la Clave primaria de ViaCiudadUsuario +@return El objeto que referencia a la Clave primaria de ViaCiudadUsuario +*/ +public ViaCiudadUsuarioKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de ViaCiudadUsuario +@param pPk El objeto que referencia a la nueva Clave primaria de ViaCiudadUsuario +*/ +public void setPk(ViaCiudadUsuarioKey pPk){ + pk=pPk; +} +/**Obtiene el valor de cod_actividad_catalogcode +@return valor de cod_actividad_catalogcode*/ +public String getCod_actividad_catalogcode(){ + return cod_actividad_catalogcode; +} +/**Fija el valor de cod_actividad_catalogcode +@param pCod_actividad_catalogcode nuevo Valor de cod_actividad_catalogcode*/ +public void setCod_actividad_catalogcode(String pCod_actividad_catalogcode){ + cod_actividad_catalogcode=pCod_actividad_catalogcode; +} + +/**Obtiene el valor de cod_ciudad_catalogcode +@return valor de cod_ciudad_catalogcode*/ +public String getCod_ciudad_catalogcode(){ + return cod_ciudad_catalogcode; +} +/**Fija el valor de cod_ciudad_catalogcode +@param pCod_ciudad_catalogcode nuevo Valor de cod_ciudad_catalogcode*/ +public void setCod_ciudad_catalogcode(String pCod_ciudad_catalogcode){ + cod_ciudad_catalogcode=pCod_ciudad_catalogcode; +} + +/**Obtiene el valor de cod_usuario +@return valor de cod_usuario*/ +public String getCod_usuario(){ + return cod_usuario; +} +/**Fija el valor de cod_usuario +@param pCod_usuario nuevo Valor de cod_usuario*/ +public void setCod_usuario(String pCod_usuario){ + cod_usuario=pCod_usuario; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof ViaCiudadUsuario))return false; + ViaCiudadUsuario that = (ViaCiudadUsuario) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad ViaCiudadUsuario +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco ViaCiudadUsuario +*/ +public Object createInstance(){ + ViaCiudadUsuario instance=new ViaCiudadUsuario(); + instance.setPk(new ViaCiudadUsuarioKey()); + return instance; +} +/**Clona la entidad ViaCiudadUsuario +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + ViaCiudadUsuario p=(ViaCiudadUsuario)this.clone(); + p.setPk((ViaCiudadUsuarioKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/text-base/ViaCiudadUsuarioKey.java.svn-base b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/text-base/ViaCiudadUsuarioKey.java.svn-base new file mode 100644 index 0000000..f24991b --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/text-base/ViaCiudadUsuarioKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pviaticos.param; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de VIA_CIUDAD_USUARIO*/ +@Embeddable +public class ViaCiudadUsuarioKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COD_ACTIVIDAD_CATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo actividades, TESORERIA, CONTABILIDAD +*/ +private String cod_actividad_catalog; + +@Column(name="COD_CIUDAD_CATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 1 Quito, 2 Guayaquil, 3 Cuenca, 4 +*/ +private String cod_ciudad_catalog; + +/**Contructor por defecto*/ +public ViaCiudadUsuarioKey(){} +/**Contructor de ViaCiudadUsuarioKey +@param pCod_actividad_catalog Codigo de catalogo actividades, TESORERIA, CONTABILIDAD +@param pCod_ciudad_catalog Codigo de catalogo 1 Quito, 2 Guayaquil, 3 Cuenca, 4 +*/ +public ViaCiudadUsuarioKey(String pCod_actividad_catalog,String pCod_ciudad_catalog){ + cod_actividad_catalog=pCod_actividad_catalog; + cod_ciudad_catalog=pCod_ciudad_catalog; +} +/**Obtiene el valor de cod_actividad_catalog +@return valor de cod_actividad_catalog*/ +public String getCod_actividad_catalog(){ + return cod_actividad_catalog; +} +/**Fija el valor de cod_actividad_catalog +@param pCod_actividad_catalog nuevo Valor de cod_actividad_catalog*/ +public void setCod_actividad_catalog(String pCod_actividad_catalog){ + cod_actividad_catalog=pCod_actividad_catalog; +} + +/**Obtiene el valor de cod_ciudad_catalog +@return valor de cod_ciudad_catalog*/ +public String getCod_ciudad_catalog(){ + return cod_ciudad_catalog; +} +/**Fija el valor de cod_ciudad_catalog +@param pCod_ciudad_catalog nuevo Valor de cod_ciudad_catalog*/ +public void setCod_ciudad_catalog(String pCod_ciudad_catalog){ + cod_ciudad_catalog=pCod_ciudad_catalog; +} + +/**Implementacion de la comparacion de ViaCiudadUsuarioKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof ViaCiudadUsuarioKey))return false; + ViaCiudadUsuarioKey that = (ViaCiudadUsuarioKey) o; + if (this.getCod_actividad_catalog() == null || that.getCod_actividad_catalog() == null){ + return false; + } + if (! this.getCod_actividad_catalog().equals(that.getCod_actividad_catalog())){ + return false; + } + if (this.getCod_ciudad_catalog() == null || that.getCod_ciudad_catalog() == null){ + return false; + } + if (! this.getCod_ciudad_catalog().equals(that.getCod_ciudad_catalog())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia ViaCiudadUsuarioKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCod_actividad_catalog() == null ? 0 : this.getCod_actividad_catalog().hashCode()); + result = result * 37 + (this.getCod_ciudad_catalog() == null ? 0 : this.getCod_ciudad_catalog().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/text-base/ViaDiasAcumulados.java.svn-base b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/text-base/ViaDiasAcumulados.java.svn-base new file mode 100644 index 0000000..50ca979 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/text-base/ViaDiasAcumulados.java.svn-base @@ -0,0 +1,141 @@ +package com.fp.persistence.pviaticos.param; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla VIA_DIAS_ACUMULADOS*/ +@Entity(name="ViaDiasAcumulados") +@Table(name="VIA_DIAS_ACUMULADOS") +public class ViaDiasAcumulados extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad ViaDiasAcumulados +*/ +@EmbeddedId +private ViaDiasAcumuladosKey pk; + +@Column(name="NUM_DIAS", nullable=true) +/** +* Numero de dias +*/ +private BigDecimal num_dias; + +/**Contructor por defecto*/ +public ViaDiasAcumulados(){ +} +/**Contructor de ViaDiasAcumulados +@param pPk Clave Primaria del entity +*/ +public ViaDiasAcumulados(ViaDiasAcumuladosKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return ViaDiasAcumulados +*/ +public static ViaDiasAcumulados find(EntityManager pEntityManager,ViaDiasAcumuladosKey pKey) throws Exception{ + ViaDiasAcumulados obj = pEntityManager.find(ViaDiasAcumulados.class,pKey); + return obj; +} +/**Entrega la Clave primaria de ViaDiasAcumulados +@return El objeto que referencia a la Clave primaria de ViaDiasAcumulados +*/ +public ViaDiasAcumuladosKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de ViaDiasAcumulados +@param pPk El objeto que referencia a la nueva Clave primaria de ViaDiasAcumulados +*/ +public void setPk(ViaDiasAcumuladosKey pPk){ + pk=pPk; +} + +/**Obtiene el valor de num_dias +@return valor de num_dias*/ +public BigDecimal getNum_dias(){ + return num_dias; +} +/**Fija el valor de num_dias +@param pNum_dias nuevo Valor de num_dias*/ +public void setNum_dias(BigDecimal pNum_dias){ + num_dias=pNum_dias; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof ViaDiasAcumulados))return false; + ViaDiasAcumulados that = (ViaDiasAcumulados) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad ViaDiasAcumulados +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco ViaDiasAcumulados +*/ +public Object createInstance(){ + ViaDiasAcumulados instance=new ViaDiasAcumulados(); + instance.setPk(new ViaDiasAcumuladosKey()); + return instance; +} +/**Clona la entidad ViaDiasAcumulados +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + ViaDiasAcumulados p=(ViaDiasAcumulados)this.clone(); + p.setPk((ViaDiasAcumuladosKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/text-base/ViaDiasAcumuladosKey.java.svn-base b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/text-base/ViaDiasAcumuladosKey.java.svn-base new file mode 100644 index 0000000..c0bfca8 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/text-base/ViaDiasAcumuladosKey.java.svn-base @@ -0,0 +1,146 @@ +package com.fp.persistence.pviaticos.param; + +import javax.persistence.Column; + +import java.io.Serializable; + +import com.fp.dto.hb.HibernateId; + +import java.lang.reflect.Field; + +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de VIA_DIAS_ACUMULADOS*/ +@Embeddable +public class ViaDiasAcumuladosKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COD_EMPLEADO", nullable=false,updatable=false) + +/** +* Codigo de estatus de la solicitud de viaticos +*/ +private String cod_empleado; + +@Column(name="COD_EJERCICIO", nullable=false,updatable=false) + +/** +* Anio asociado a los dias acumulados +*/ +private Integer cod_ejercicio; + +@Column(name="COD_DESTINO", nullable=true) + +/** +* Descripcion default del tipo de tabla de pagos +*/ +private String cod_destino; + +/**Contructor por defecto*/ +public ViaDiasAcumuladosKey(){} +/**Contructor de ViaDiasAcumuladosKey +@param pCod_empleado Codigo de estatus de la solicitud de viaticos +@param pCod_ejercicio Anio asociado a los dias acumulados +*/ +public ViaDiasAcumuladosKey(String pCod_empleado,Integer pCod_ejercicio, String pCod_destino){ + cod_empleado=pCod_empleado; + cod_ejercicio=pCod_ejercicio; + cod_destino=pCod_destino; +} +/**Obtiene el valor de cod_empleado +@return valor de cod_empleado*/ +public String getCod_empleado(){ + return cod_empleado; +} +/**Fija el valor de cod_empleado +@param pCod_empleado nuevo Valor de cod_empleado*/ +public void setCod_empleado(String pCod_empleado){ + cod_empleado=pCod_empleado; +} + +/**Obtiene el valor de cod_ejercicio +@return valor de cod_ejercicio*/ +public Integer getCod_ejercicio(){ + return cod_ejercicio; +} +/**Fija el valor de cod_ejercicio +@param pCod_ejercicio nuevo Valor de cod_ejercicio*/ +public void setCod_ejercicio(Integer pCod_ejercicio){ + cod_ejercicio=pCod_ejercicio; +} + +/**Obtiene el valor de cod_destino +@return valor de cod_destino*/ +public String getCod_destino(){ + return cod_destino; +} +/**Fija el valor de cod_destino +@param pCod_destino nuevo Valor de cod_destino*/ +public void setCod_destino(String pCod_destino){ + cod_destino=pCod_destino; +} +/**Implementacion de la comparacion de ViaDiasAcumuladosKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof ViaDiasAcumuladosKey))return false; + ViaDiasAcumuladosKey that = (ViaDiasAcumuladosKey) o; + if (this.getCod_empleado() == null || that.getCod_empleado() == null){ + return false; + } + if (! this.getCod_empleado().equals(that.getCod_empleado())){ + return false; + } + if (this.getCod_ejercicio() == null || that.getCod_ejercicio() == null){ + return false; + } + if (! this.getCod_ejercicio().equals(that.getCod_ejercicio())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia ViaDiasAcumuladosKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCod_empleado() == null ? 0 : this.getCod_empleado().hashCode()); + result = result * 37 + (this.getCod_ejercicio() == null ? 0 : this.getCod_ejercicio().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/text-base/ViaEstado.java.svn-base b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/text-base/ViaEstado.java.svn-base new file mode 100644 index 0000000..2420c8d --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/text-base/ViaEstado.java.svn-base @@ -0,0 +1,159 @@ +package com.fp.persistence.pviaticos.param; + +import com.fp.dto.hb.Cache; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla VIA_ESTADO*/ +@Entity(name="ViaEstado") +@Table(name="VIA_ESTADO") +public class ViaEstado extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad ViaEstado +*/ +@Id +@Column(name="COD_ESTADO" ,nullable=false, updatable=false) +private String pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="NOM_ESTADO", nullable=true) + +/** +* Descripcion default del tipo de tabla de pagos +*/ +private String nom_estado; + +/**Contructor por defecto*/ +public ViaEstado(){ +} +/**Contructor de ViaEstado +@param pPk Clave Primaria del entity +*/ +public ViaEstado(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return ViaEstado +*/ +public static ViaEstado find(EntityManager pEntityManager,Object pKey) throws Exception{ + ViaEstado obj = pEntityManager.find(ViaEstado.class,pKey); + return obj; +} +/**Entrega la Clave primaria de ViaEstado +@return El objeto que referencia a la Clave primaria de ViaEstado +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de ViaEstado +@param pPk El objeto que referencia a la nueva Clave primaria de ViaEstado +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de nom_estado +@return valor de nom_estado*/ +public String getNom_estado(){ + return nom_estado; +} +/**Fija el valor de nom_estado +@param pNom_estado nuevo Valor de nom_estado*/ +public void setNom_estado(String pNom_estado){ + nom_estado=pNom_estado; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof ViaEstado))return false; + ViaEstado that = (ViaEstado) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad ViaEstado +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco ViaEstado +*/ +public Object createInstance(){ + ViaEstado instance=new ViaEstado(); + return instance; +} +/**Clona la entidad ViaEstado +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + ViaEstado p=(ViaEstado)this.clone(); + return p; +} +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/text-base/ViaNotificacionMovilizacion.java.svn-base b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/text-base/ViaNotificacionMovilizacion.java.svn-base new file mode 100644 index 0000000..a4bd16a --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/text-base/ViaNotificacionMovilizacion.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.persistence.pviaticos.param; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla VIA_NOTIFICACION_MOVILIZACION*/ +@Entity(name="ViaNotificacionMovilizacion") +@Table(name="VIA_NOTIFICACION_MOVILIZACION") +public class ViaNotificacionMovilizacion extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad ViaNotificacionMovilizacion +*/ +@Id +@Column(name="COD_CIUDAD_CATALOG" ,nullable=false, updatable=false) +private String pk; +@Column(name="COD_CIUDAD_CATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo CUDADORIGEN de los empleados de la sbs +*/ +private String cod_ciudad_catalogcode; + +@Column(name="COD_USUARIO", nullable=false) + +/** +* Codigo de usuario asociado a la ciudad +*/ +private String cod_usuario; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking del registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public ViaNotificacionMovilizacion(){ +} +/**Contructor de ViaNotificacionMovilizacion +@param pPk Clave Primaria del entity +@param pCod_usuario Codigo de usuario asociado a la ciudad +*/ +public ViaNotificacionMovilizacion(String pPk,String pCod_usuario){ + this(); + pk=pPk; + cod_usuario=pCod_usuario; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return ViaNotificacionMovilizacion +*/ +public static ViaNotificacionMovilizacion find(EntityManager pEntityManager,Object pKey) throws Exception{ + ViaNotificacionMovilizacion obj = pEntityManager.find(ViaNotificacionMovilizacion.class,pKey); + return obj; +} +/**Entrega la Clave primaria de ViaNotificacionMovilizacion +@return El objeto que referencia a la Clave primaria de ViaNotificacionMovilizacion +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de ViaNotificacionMovilizacion +@param pPk El objeto que referencia a la nueva Clave primaria de ViaNotificacionMovilizacion +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de cod_ciudad_catalogcode +@return valor de cod_ciudad_catalogcode*/ +public String getCod_ciudad_catalogcode(){ + return cod_ciudad_catalogcode; +} +/**Fija el valor de cod_ciudad_catalogcode +@param pCod_ciudad_catalogcode nuevo Valor de cod_ciudad_catalogcode*/ +public void setCod_ciudad_catalogcode(String pCod_ciudad_catalogcode){ + cod_ciudad_catalogcode=pCod_ciudad_catalogcode; +} + +/**Obtiene el valor de cod_usuario +@return valor de cod_usuario*/ +public String getCod_usuario(){ + return cod_usuario; +} +/**Fija el valor de cod_usuario +@param pCod_usuario nuevo Valor de cod_usuario*/ +public void setCod_usuario(String pCod_usuario){ + cod_usuario=pCod_usuario; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof ViaNotificacionMovilizacion))return false; + ViaNotificacionMovilizacion that = (ViaNotificacionMovilizacion) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad ViaNotificacionMovilizacion +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco ViaNotificacionMovilizacion +*/ +public Object createInstance(){ + ViaNotificacionMovilizacion instance=new ViaNotificacionMovilizacion(); + return instance; +} +/**Clona la entidad ViaNotificacionMovilizacion +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + ViaNotificacionMovilizacion p=(ViaNotificacionMovilizacion)this.clone(); + return p; +} +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/text-base/ViaParametros.java.svn-base b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/text-base/ViaParametros.java.svn-base new file mode 100644 index 0000000..b8df003 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/.svn/text-base/ViaParametros.java.svn-base @@ -0,0 +1,176 @@ +package com.fp.persistence.pviaticos.param; + +import com.fp.dto.hb.Cache; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla VIA_PARAMETROS*/ +@Entity(name="ViaParametros") +@Table(name="VIA_PARAMETROS") +public class ViaParametros extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad ViaParametros +*/ +@Id +@Column(name="COD_PARAMETRO" ,nullable=false, updatable=false) +private String pk; +@Column(name="TEX_VALOR", nullable=true) + +/** +* Valor texto del parametro. +*/ +private String tex_valor; + +@Column(name="NUM_VALOR", nullable=true) + +/** +* Valor numero del parametro. +*/ +private BigDecimal num_valor; + +@Column(name="NOM_PARAMETRO", nullable=true) + +/** +* Nombre del parametro +*/ +private String nom_parametro; + +/**Contructor por defecto*/ +public ViaParametros(){ +} +/**Contructor de ViaParametros +@param pPk Clave Primaria del entity +*/ +public ViaParametros(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return ViaParametros +*/ +public static ViaParametros find(EntityManager pEntityManager,Object pKey) throws Exception{ + ViaParametros obj = pEntityManager.find(ViaParametros.class,pKey); + return obj; +} +/**Entrega la Clave primaria de ViaParametros +@return El objeto que referencia a la Clave primaria de ViaParametros +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de ViaParametros +@param pPk El objeto que referencia a la nueva Clave primaria de ViaParametros +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de tex_valor +@return valor de tex_valor*/ +public String getTex_valor(){ + return tex_valor; +} +/**Fija el valor de tex_valor +@param pTex_valor nuevo Valor de tex_valor*/ +public void setTex_valor(String pTex_valor){ + tex_valor=pTex_valor; +} + +/**Obtiene el valor de num_valor +@return valor de num_valor*/ +public BigDecimal getNum_valor(){ + return num_valor; +} +/**Fija el valor de num_valor +@param pNum_valor nuevo Valor de num_valor*/ +public void setNum_valor(BigDecimal pNum_valor){ + num_valor=pNum_valor; +} + +/**Obtiene el valor de nom_parametro +@return valor de nom_parametro*/ +public String getNom_parametro(){ + return nom_parametro; +} +/**Fija el valor de nom_parametro +@param pNom_parametro nuevo Valor de nom_parametro*/ +public void setNom_parametro(String pNom_parametro){ + nom_parametro=pNom_parametro; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof ViaParametros))return false; + ViaParametros that = (ViaParametros) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad ViaParametros +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco ViaParametros +*/ +public Object createInstance(){ + ViaParametros instance=new ViaParametros(); + return instance; +} +/**Clona la entidad ViaParametros +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + ViaParametros p=(ViaParametros)this.clone(); + return p; +} +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/ViaCiudadUsuario.java b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/ViaCiudadUsuario.java new file mode 100644 index 0000000..308d93b --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/ViaCiudadUsuario.java @@ -0,0 +1,201 @@ +package com.fp.persistence.pviaticos.param; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla VIA_CIUDAD_USUARIO*/ +@Entity(name="ViaCiudadUsuario") +@Table(name="VIA_CIUDAD_USUARIO") +public class ViaCiudadUsuario extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad ViaCiudadUsuario +*/ +@EmbeddedId +private ViaCiudadUsuarioKey pk; +@Column(name="COD_ACTIVIDAD_CATALOGCODE", nullable=false) + +/** +* Codigo de tabla de catalogo ACTIVIDAD_ +*/ +private String cod_actividad_catalogcode; + +@Column(name="COD_CIUDAD_CATALOGCODE", nullable=false) + +/** +* Codigo de tabla de catalogo CUDADORIGEN de los empleados de la sbs +*/ +private String cod_ciudad_catalogcode; + +@Column(name="COD_USUARIO", nullable=false) + +/** +* Codigo de usuario asociado a la ciudad +*/ +private String cod_usuario; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking del registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public ViaCiudadUsuario(){ +} +/**Contructor de ViaCiudadUsuario +@param pPk Clave Primaria del entity +@param pCod_actividad_catalogcode Codigo de tabla de catalogo ACTIVIDAD_ +@param pCod_ciudad_catalogcode Codigo de tabla de catalogo CUDADORIGEN de los empleados de la sbs +@param pCod_usuario Codigo de usuario asociado a la ciudad +*/ +public ViaCiudadUsuario(ViaCiudadUsuarioKey pPk,String pCod_actividad_catalogcode,String pCod_ciudad_catalogcode,String pCod_usuario){ + this(); + pk=pPk; + cod_actividad_catalogcode=pCod_actividad_catalogcode; + cod_ciudad_catalogcode=pCod_ciudad_catalogcode; + cod_usuario=pCod_usuario; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return ViaCiudadUsuario +*/ +public static ViaCiudadUsuario find(EntityManager pEntityManager,ViaCiudadUsuarioKey pKey) throws Exception{ + ViaCiudadUsuario obj = pEntityManager.find(ViaCiudadUsuario.class,pKey); + return obj; +} +/**Entrega la Clave primaria de ViaCiudadUsuario +@return El objeto que referencia a la Clave primaria de ViaCiudadUsuario +*/ +public ViaCiudadUsuarioKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de ViaCiudadUsuario +@param pPk El objeto que referencia a la nueva Clave primaria de ViaCiudadUsuario +*/ +public void setPk(ViaCiudadUsuarioKey pPk){ + pk=pPk; +} +/**Obtiene el valor de cod_actividad_catalogcode +@return valor de cod_actividad_catalogcode*/ +public String getCod_actividad_catalogcode(){ + return cod_actividad_catalogcode; +} +/**Fija el valor de cod_actividad_catalogcode +@param pCod_actividad_catalogcode nuevo Valor de cod_actividad_catalogcode*/ +public void setCod_actividad_catalogcode(String pCod_actividad_catalogcode){ + cod_actividad_catalogcode=pCod_actividad_catalogcode; +} + +/**Obtiene el valor de cod_ciudad_catalogcode +@return valor de cod_ciudad_catalogcode*/ +public String getCod_ciudad_catalogcode(){ + return cod_ciudad_catalogcode; +} +/**Fija el valor de cod_ciudad_catalogcode +@param pCod_ciudad_catalogcode nuevo Valor de cod_ciudad_catalogcode*/ +public void setCod_ciudad_catalogcode(String pCod_ciudad_catalogcode){ + cod_ciudad_catalogcode=pCod_ciudad_catalogcode; +} + +/**Obtiene el valor de cod_usuario +@return valor de cod_usuario*/ +public String getCod_usuario(){ + return cod_usuario; +} +/**Fija el valor de cod_usuario +@param pCod_usuario nuevo Valor de cod_usuario*/ +public void setCod_usuario(String pCod_usuario){ + cod_usuario=pCod_usuario; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof ViaCiudadUsuario))return false; + ViaCiudadUsuario that = (ViaCiudadUsuario) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad ViaCiudadUsuario +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco ViaCiudadUsuario +*/ +public Object createInstance(){ + ViaCiudadUsuario instance=new ViaCiudadUsuario(); + instance.setPk(new ViaCiudadUsuarioKey()); + return instance; +} +/**Clona la entidad ViaCiudadUsuario +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + ViaCiudadUsuario p=(ViaCiudadUsuario)this.clone(); + p.setPk((ViaCiudadUsuarioKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/ViaCiudadUsuarioKey.java b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/ViaCiudadUsuarioKey.java new file mode 100644 index 0000000..f24991b --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/ViaCiudadUsuarioKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pviaticos.param; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de VIA_CIUDAD_USUARIO*/ +@Embeddable +public class ViaCiudadUsuarioKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COD_ACTIVIDAD_CATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo actividades, TESORERIA, CONTABILIDAD +*/ +private String cod_actividad_catalog; + +@Column(name="COD_CIUDAD_CATALOG", nullable=false,updatable=false) + +/** +* Codigo de catalogo 1 Quito, 2 Guayaquil, 3 Cuenca, 4 +*/ +private String cod_ciudad_catalog; + +/**Contructor por defecto*/ +public ViaCiudadUsuarioKey(){} +/**Contructor de ViaCiudadUsuarioKey +@param pCod_actividad_catalog Codigo de catalogo actividades, TESORERIA, CONTABILIDAD +@param pCod_ciudad_catalog Codigo de catalogo 1 Quito, 2 Guayaquil, 3 Cuenca, 4 +*/ +public ViaCiudadUsuarioKey(String pCod_actividad_catalog,String pCod_ciudad_catalog){ + cod_actividad_catalog=pCod_actividad_catalog; + cod_ciudad_catalog=pCod_ciudad_catalog; +} +/**Obtiene el valor de cod_actividad_catalog +@return valor de cod_actividad_catalog*/ +public String getCod_actividad_catalog(){ + return cod_actividad_catalog; +} +/**Fija el valor de cod_actividad_catalog +@param pCod_actividad_catalog nuevo Valor de cod_actividad_catalog*/ +public void setCod_actividad_catalog(String pCod_actividad_catalog){ + cod_actividad_catalog=pCod_actividad_catalog; +} + +/**Obtiene el valor de cod_ciudad_catalog +@return valor de cod_ciudad_catalog*/ +public String getCod_ciudad_catalog(){ + return cod_ciudad_catalog; +} +/**Fija el valor de cod_ciudad_catalog +@param pCod_ciudad_catalog nuevo Valor de cod_ciudad_catalog*/ +public void setCod_ciudad_catalog(String pCod_ciudad_catalog){ + cod_ciudad_catalog=pCod_ciudad_catalog; +} + +/**Implementacion de la comparacion de ViaCiudadUsuarioKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof ViaCiudadUsuarioKey))return false; + ViaCiudadUsuarioKey that = (ViaCiudadUsuarioKey) o; + if (this.getCod_actividad_catalog() == null || that.getCod_actividad_catalog() == null){ + return false; + } + if (! this.getCod_actividad_catalog().equals(that.getCod_actividad_catalog())){ + return false; + } + if (this.getCod_ciudad_catalog() == null || that.getCod_ciudad_catalog() == null){ + return false; + } + if (! this.getCod_ciudad_catalog().equals(that.getCod_ciudad_catalog())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia ViaCiudadUsuarioKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCod_actividad_catalog() == null ? 0 : this.getCod_actividad_catalog().hashCode()); + result = result * 37 + (this.getCod_ciudad_catalog() == null ? 0 : this.getCod_ciudad_catalog().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/ViaDiasAcumulados.java b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/ViaDiasAcumulados.java new file mode 100644 index 0000000..50ca979 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/ViaDiasAcumulados.java @@ -0,0 +1,141 @@ +package com.fp.persistence.pviaticos.param; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla VIA_DIAS_ACUMULADOS*/ +@Entity(name="ViaDiasAcumulados") +@Table(name="VIA_DIAS_ACUMULADOS") +public class ViaDiasAcumulados extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad ViaDiasAcumulados +*/ +@EmbeddedId +private ViaDiasAcumuladosKey pk; + +@Column(name="NUM_DIAS", nullable=true) +/** +* Numero de dias +*/ +private BigDecimal num_dias; + +/**Contructor por defecto*/ +public ViaDiasAcumulados(){ +} +/**Contructor de ViaDiasAcumulados +@param pPk Clave Primaria del entity +*/ +public ViaDiasAcumulados(ViaDiasAcumuladosKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return ViaDiasAcumulados +*/ +public static ViaDiasAcumulados find(EntityManager pEntityManager,ViaDiasAcumuladosKey pKey) throws Exception{ + ViaDiasAcumulados obj = pEntityManager.find(ViaDiasAcumulados.class,pKey); + return obj; +} +/**Entrega la Clave primaria de ViaDiasAcumulados +@return El objeto que referencia a la Clave primaria de ViaDiasAcumulados +*/ +public ViaDiasAcumuladosKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de ViaDiasAcumulados +@param pPk El objeto que referencia a la nueva Clave primaria de ViaDiasAcumulados +*/ +public void setPk(ViaDiasAcumuladosKey pPk){ + pk=pPk; +} + +/**Obtiene el valor de num_dias +@return valor de num_dias*/ +public BigDecimal getNum_dias(){ + return num_dias; +} +/**Fija el valor de num_dias +@param pNum_dias nuevo Valor de num_dias*/ +public void setNum_dias(BigDecimal pNum_dias){ + num_dias=pNum_dias; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof ViaDiasAcumulados))return false; + ViaDiasAcumulados that = (ViaDiasAcumulados) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad ViaDiasAcumulados +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco ViaDiasAcumulados +*/ +public Object createInstance(){ + ViaDiasAcumulados instance=new ViaDiasAcumulados(); + instance.setPk(new ViaDiasAcumuladosKey()); + return instance; +} +/**Clona la entidad ViaDiasAcumulados +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + ViaDiasAcumulados p=(ViaDiasAcumulados)this.clone(); + p.setPk((ViaDiasAcumuladosKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/ViaDiasAcumuladosKey.java b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/ViaDiasAcumuladosKey.java new file mode 100644 index 0000000..c0bfca8 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/ViaDiasAcumuladosKey.java @@ -0,0 +1,146 @@ +package com.fp.persistence.pviaticos.param; + +import javax.persistence.Column; + +import java.io.Serializable; + +import com.fp.dto.hb.HibernateId; + +import java.lang.reflect.Field; + +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de VIA_DIAS_ACUMULADOS*/ +@Embeddable +public class ViaDiasAcumuladosKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COD_EMPLEADO", nullable=false,updatable=false) + +/** +* Codigo de estatus de la solicitud de viaticos +*/ +private String cod_empleado; + +@Column(name="COD_EJERCICIO", nullable=false,updatable=false) + +/** +* Anio asociado a los dias acumulados +*/ +private Integer cod_ejercicio; + +@Column(name="COD_DESTINO", nullable=true) + +/** +* Descripcion default del tipo de tabla de pagos +*/ +private String cod_destino; + +/**Contructor por defecto*/ +public ViaDiasAcumuladosKey(){} +/**Contructor de ViaDiasAcumuladosKey +@param pCod_empleado Codigo de estatus de la solicitud de viaticos +@param pCod_ejercicio Anio asociado a los dias acumulados +*/ +public ViaDiasAcumuladosKey(String pCod_empleado,Integer pCod_ejercicio, String pCod_destino){ + cod_empleado=pCod_empleado; + cod_ejercicio=pCod_ejercicio; + cod_destino=pCod_destino; +} +/**Obtiene el valor de cod_empleado +@return valor de cod_empleado*/ +public String getCod_empleado(){ + return cod_empleado; +} +/**Fija el valor de cod_empleado +@param pCod_empleado nuevo Valor de cod_empleado*/ +public void setCod_empleado(String pCod_empleado){ + cod_empleado=pCod_empleado; +} + +/**Obtiene el valor de cod_ejercicio +@return valor de cod_ejercicio*/ +public Integer getCod_ejercicio(){ + return cod_ejercicio; +} +/**Fija el valor de cod_ejercicio +@param pCod_ejercicio nuevo Valor de cod_ejercicio*/ +public void setCod_ejercicio(Integer pCod_ejercicio){ + cod_ejercicio=pCod_ejercicio; +} + +/**Obtiene el valor de cod_destino +@return valor de cod_destino*/ +public String getCod_destino(){ + return cod_destino; +} +/**Fija el valor de cod_destino +@param pCod_destino nuevo Valor de cod_destino*/ +public void setCod_destino(String pCod_destino){ + cod_destino=pCod_destino; +} +/**Implementacion de la comparacion de ViaDiasAcumuladosKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof ViaDiasAcumuladosKey))return false; + ViaDiasAcumuladosKey that = (ViaDiasAcumuladosKey) o; + if (this.getCod_empleado() == null || that.getCod_empleado() == null){ + return false; + } + if (! this.getCod_empleado().equals(that.getCod_empleado())){ + return false; + } + if (this.getCod_ejercicio() == null || that.getCod_ejercicio() == null){ + return false; + } + if (! this.getCod_ejercicio().equals(that.getCod_ejercicio())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia ViaDiasAcumuladosKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCod_empleado() == null ? 0 : this.getCod_empleado().hashCode()); + result = result * 37 + (this.getCod_ejercicio() == null ? 0 : this.getCod_ejercicio().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/ViaEstado.java b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/ViaEstado.java new file mode 100644 index 0000000..2420c8d --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/ViaEstado.java @@ -0,0 +1,159 @@ +package com.fp.persistence.pviaticos.param; + +import com.fp.dto.hb.Cache; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla VIA_ESTADO*/ +@Entity(name="ViaEstado") +@Table(name="VIA_ESTADO") +public class ViaEstado extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad ViaEstado +*/ +@Id +@Column(name="COD_ESTADO" ,nullable=false, updatable=false) +private String pk; +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking del registro +*/ +private Integer recordversion; + +@Column(name="NOM_ESTADO", nullable=true) + +/** +* Descripcion default del tipo de tabla de pagos +*/ +private String nom_estado; + +/**Contructor por defecto*/ +public ViaEstado(){ +} +/**Contructor de ViaEstado +@param pPk Clave Primaria del entity +*/ +public ViaEstado(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return ViaEstado +*/ +public static ViaEstado find(EntityManager pEntityManager,Object pKey) throws Exception{ + ViaEstado obj = pEntityManager.find(ViaEstado.class,pKey); + return obj; +} +/**Entrega la Clave primaria de ViaEstado +@return El objeto que referencia a la Clave primaria de ViaEstado +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de ViaEstado +@param pPk El objeto que referencia a la nueva Clave primaria de ViaEstado +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +/**Obtiene el valor de nom_estado +@return valor de nom_estado*/ +public String getNom_estado(){ + return nom_estado; +} +/**Fija el valor de nom_estado +@param pNom_estado nuevo Valor de nom_estado*/ +public void setNom_estado(String pNom_estado){ + nom_estado=pNom_estado; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof ViaEstado))return false; + ViaEstado that = (ViaEstado) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad ViaEstado +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco ViaEstado +*/ +public Object createInstance(){ + ViaEstado instance=new ViaEstado(); + return instance; +} +/**Clona la entidad ViaEstado +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + ViaEstado p=(ViaEstado)this.clone(); + return p; +} +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/ViaNotificacionMovilizacion.java b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/ViaNotificacionMovilizacion.java new file mode 100644 index 0000000..a4bd16a --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/ViaNotificacionMovilizacion.java @@ -0,0 +1,178 @@ +package com.fp.persistence.pviaticos.param; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla VIA_NOTIFICACION_MOVILIZACION*/ +@Entity(name="ViaNotificacionMovilizacion") +@Table(name="VIA_NOTIFICACION_MOVILIZACION") +public class ViaNotificacionMovilizacion extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad ViaNotificacionMovilizacion +*/ +@Id +@Column(name="COD_CIUDAD_CATALOG" ,nullable=false, updatable=false) +private String pk; +@Column(name="COD_CIUDAD_CATALOGCODE", nullable=true) + +/** +* Codigo de tabla de catalogo CUDADORIGEN de los empleados de la sbs +*/ +private String cod_ciudad_catalogcode; + +@Column(name="COD_USUARIO", nullable=false) + +/** +* Codigo de usuario asociado a la ciudad +*/ +private String cod_usuario; + +@Version +@Column(name="RECORDVERSION", nullable=true) + +/** +* Manejo de optimistic locking del registro +*/ +private Integer recordversion; + +/**Contructor por defecto*/ +public ViaNotificacionMovilizacion(){ +} +/**Contructor de ViaNotificacionMovilizacion +@param pPk Clave Primaria del entity +@param pCod_usuario Codigo de usuario asociado a la ciudad +*/ +public ViaNotificacionMovilizacion(String pPk,String pCod_usuario){ + this(); + pk=pPk; + cod_usuario=pCod_usuario; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return ViaNotificacionMovilizacion +*/ +public static ViaNotificacionMovilizacion find(EntityManager pEntityManager,Object pKey) throws Exception{ + ViaNotificacionMovilizacion obj = pEntityManager.find(ViaNotificacionMovilizacion.class,pKey); + return obj; +} +/**Entrega la Clave primaria de ViaNotificacionMovilizacion +@return El objeto que referencia a la Clave primaria de ViaNotificacionMovilizacion +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de ViaNotificacionMovilizacion +@param pPk El objeto que referencia a la nueva Clave primaria de ViaNotificacionMovilizacion +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de cod_ciudad_catalogcode +@return valor de cod_ciudad_catalogcode*/ +public String getCod_ciudad_catalogcode(){ + return cod_ciudad_catalogcode; +} +/**Fija el valor de cod_ciudad_catalogcode +@param pCod_ciudad_catalogcode nuevo Valor de cod_ciudad_catalogcode*/ +public void setCod_ciudad_catalogcode(String pCod_ciudad_catalogcode){ + cod_ciudad_catalogcode=pCod_ciudad_catalogcode; +} + +/**Obtiene el valor de cod_usuario +@return valor de cod_usuario*/ +public String getCod_usuario(){ + return cod_usuario; +} +/**Fija el valor de cod_usuario +@param pCod_usuario nuevo Valor de cod_usuario*/ +public void setCod_usuario(String pCod_usuario){ + cod_usuario=pCod_usuario; +} + +/**Obtiene el valor de recordversion +@return valor de recordversion*/ +public Integer getRecordversion(){ + return recordversion; +} +/**Fija el valor de recordversion +@param pRecordversion nuevo Valor de recordversion*/ +public void setRecordversion(Integer pRecordversion){ + recordversion=pRecordversion; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof ViaNotificacionMovilizacion))return false; + ViaNotificacionMovilizacion that = (ViaNotificacionMovilizacion) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad ViaNotificacionMovilizacion +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco ViaNotificacionMovilizacion +*/ +public Object createInstance(){ + ViaNotificacionMovilizacion instance=new ViaNotificacionMovilizacion(); + return instance; +} +/**Clona la entidad ViaNotificacionMovilizacion +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + ViaNotificacionMovilizacion p=(ViaNotificacionMovilizacion)this.clone(); + return p; +} +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/ViaParametros.java b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/ViaParametros.java new file mode 100644 index 0000000..b8df003 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/param/ViaParametros.java @@ -0,0 +1,176 @@ +package com.fp.persistence.pviaticos.param; + +import com.fp.dto.hb.Cache; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla VIA_PARAMETROS*/ +@Entity(name="ViaParametros") +@Table(name="VIA_PARAMETROS") +public class ViaParametros extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable,Cache{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad ViaParametros +*/ +@Id +@Column(name="COD_PARAMETRO" ,nullable=false, updatable=false) +private String pk; +@Column(name="TEX_VALOR", nullable=true) + +/** +* Valor texto del parametro. +*/ +private String tex_valor; + +@Column(name="NUM_VALOR", nullable=true) + +/** +* Valor numero del parametro. +*/ +private BigDecimal num_valor; + +@Column(name="NOM_PARAMETRO", nullable=true) + +/** +* Nombre del parametro +*/ +private String nom_parametro; + +/**Contructor por defecto*/ +public ViaParametros(){ +} +/**Contructor de ViaParametros +@param pPk Clave Primaria del entity +*/ +public ViaParametros(String pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return ViaParametros +*/ +public static ViaParametros find(EntityManager pEntityManager,Object pKey) throws Exception{ + ViaParametros obj = pEntityManager.find(ViaParametros.class,pKey); + return obj; +} +/**Entrega la Clave primaria de ViaParametros +@return El objeto que referencia a la Clave primaria de ViaParametros +*/ +public String getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de ViaParametros +@param pPk El objeto que referencia a la nueva Clave primaria de ViaParametros +*/ +public void setPk(String pPk){ + pk=pPk; +} +/**Obtiene el valor de tex_valor +@return valor de tex_valor*/ +public String getTex_valor(){ + return tex_valor; +} +/**Fija el valor de tex_valor +@param pTex_valor nuevo Valor de tex_valor*/ +public void setTex_valor(String pTex_valor){ + tex_valor=pTex_valor; +} + +/**Obtiene el valor de num_valor +@return valor de num_valor*/ +public BigDecimal getNum_valor(){ + return num_valor; +} +/**Fija el valor de num_valor +@param pNum_valor nuevo Valor de num_valor*/ +public void setNum_valor(BigDecimal pNum_valor){ + num_valor=pNum_valor; +} + +/**Obtiene el valor de nom_parametro +@return valor de nom_parametro*/ +public String getNom_parametro(){ + return nom_parametro; +} +/**Fija el valor de nom_parametro +@param pNom_parametro nuevo Valor de nom_parametro*/ +public void setNom_parametro(String pNom_parametro){ + nom_parametro=pNom_parametro; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof ViaParametros))return false; + ViaParametros that = (ViaParametros) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad ViaParametros +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco ViaParametros +*/ +public Object createInstance(){ + ViaParametros instance=new ViaParametros(); + return instance; +} +/**Clona la entidad ViaParametros +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + ViaParametros p=(ViaParametros)this.clone(); + return p; +} +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/entries b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/entries new file mode 100644 index 0000000..933cd6f --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/entries @@ -0,0 +1,368 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ViaSolicitud.java +file + + + + +2022-07-28T03:40:26.895734Z +72b966f7369a8e4d3129944f6abbf9b6 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +11872 + +ViaSolicitudLiquidacion.java +file + + + + +2022-07-28T03:40:26.895734Z +94b535d8f1d88a61476c74bf58de95e9 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7490 + +ViaSolicitudTransporte.java +file + + + + +2022-07-28T03:40:26.895734Z +aa610300c9fd668673f487dd046bbb54 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +9063 + +ViaSolicitudComentarios.java +file + + + + +2022-07-28T03:40:26.896734Z +08b8690a57bd7f60f24802b5a095f393 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7019 + +ViaSolicitudIntegrantes.java +file + + + + +2022-07-28T03:40:26.896734Z +370fea3f6a148b432c7a4c92a60c53af +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3827 + +ViaSolicitudKey.java +file + + + + +2022-07-28T03:40:26.896734Z +e543cb5c9efd4b38b44cac54295611a3 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3381 + +ViaSolicitudLiquidacionKey.java +file + + + + +2022-07-28T03:40:26.896734Z +107678b6d25fa96b170993804ddabdc1 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4329 + +ViaSolicitudTransporteKey.java +file + + + + +2022-07-28T03:40:26.897734Z +51f9a2e87e6518bc117df0b92b560714 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4411 + +ViaSolicitudComentariosKey.java +file + + + + +2022-07-28T03:40:26.897734Z +361872f4cfdc124d6dd39569ef57ec69 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4339 + +ViaSolicitudIntegrantesKey.java +file + + + + +2022-07-28T03:40:26.897734Z +a4cc9cb0713111f8c5f4b9ef820da261 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4328 + diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitud.java.svn-base b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitud.java.svn-base new file mode 100644 index 0000000..04d6fe2 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitud.java.svn-base @@ -0,0 +1,466 @@ +package com.fp.persistence.pviaticos.solicitud; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla VIA_SOLICITUD*/ +@Entity(name="ViaSolicitud") +@Table(name="VIA_SOLICITUD") +public class ViaSolicitud extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad ViaSolicitud +*/ +@EmbeddedId +private ViaSolicitudKey pk; +@Column(name="COD_ESTADO", nullable=true) + +/** +* Codigo de estatus de la solicitud de viaticos +*/ +private String cod_estado; + +@Column(name="COD_EMPLEADO", nullable=true) + +/** +* Codigo de empleados +*/ +private String cod_empleado; + +@Column(name="COD_CREDENCIAL", nullable=true) + +/** +* Numero de credencial del empleado en la sbs +*/ +private String cod_credencial; + +@Column(name="FEC_CREACION", nullable=true) + +/** +* Fecha de creacion de la solicitud se obtiene de la base de datos +*/ +private Date fec_creacion; + +@Column(name="NUM_DIAS", nullable=true) + +/** +* Numero de dias que el servidor sale de comision +*/ +private BigDecimal num_dias; + +@Column(name="NUM_DIAS_ACUMULADOS", nullable=true) + +/** +* Corresponde a los dias acumulados de viaticos del ejercicio actual a la fecha de ingreso de la solicitud +*/ +private BigDecimal num_dias_acumulados; + +@Column(name="STS_VIATICOS", nullable=true) + +/** +* 1, Indica que solicituta viaticos +*/ +private String sts_viaticos; + +@Column(name="STS_MOVILIZACION", nullable=true) + +/** +* 1, Indica que solicituta gastos de movilizacion +*/ +private String sts_movilizacion; + +@Column(name="STS_SUBSISTENCIA", nullable=true) + +/** +* 1, Indica que solicituta gastos de subsistencia +*/ +private String sts_subsistencia; + +@Column(name="STS_ALIMENTACION", nullable=true) + +/** +* 1, Indica que solicituta gastos de alimentacion +*/ +private String sts_alimentacion; + +@Column(name="COD_DESTINO", nullable=true) + +/** +* Descripcion default del tipo de tabla de pagos +*/ +private String cod_destino; + +@Column(name="FEC_INI_VIATICO", nullable=true) + +/** +* Fecha inicio de la comision +*/ +private Date fec_ini_viatico; + +@Column(name="FEC_FIN_VIATICO", nullable=true) + +/** +* Fecha de finalizacion de la comision +*/ +private Date fec_fin_viatico; + +@Column(name="FEC_HORA_INICIO", nullable=true) + +/** +* Hora de inicio de la comision +*/ +private String fec_hora_inicio; + +@Column(name="FEC_HORA_FIN", nullable=true) + +/** +* Hora de fin de la comision +*/ +private String fec_hora_fin; + +@Column(name="TXT_ACTIVIDADES", nullable=true) + +/** +* Detalle de actividades a realizar +*/ +private String txt_actividades; + +@Column(name="COD_USUARIO", nullable=true) + +/** +* Campo para el codigo de usuario que procesa la solicitud +*/ +private String cod_usuario; + +@Column(name="COD_JEFE", nullable=true) + +/** +* Campo para el codigo del jefe +*/ +private String cod_jefe; + +@Column(name="COD_RESPONSABLE", nullable=true) + +/** +* Campo para el codigo del responsable de la unidad. +*/ +private String cod_responsable; + +/**Contructor por defecto*/ +public ViaSolicitud(){ +} +/**Contructor de ViaSolicitud +@param pPk Clave Primaria del entity +*/ +public ViaSolicitud(ViaSolicitudKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return ViaSolicitud +*/ +public static ViaSolicitud find(EntityManager pEntityManager,ViaSolicitudKey pKey) throws Exception{ + ViaSolicitud obj = pEntityManager.find(ViaSolicitud.class,pKey); + return obj; +} +/**Entrega la Clave primaria de ViaSolicitud +@return El objeto que referencia a la Clave primaria de ViaSolicitud +*/ +public ViaSolicitudKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de ViaSolicitud +@param pPk El objeto que referencia a la nueva Clave primaria de ViaSolicitud +*/ +public void setPk(ViaSolicitudKey pPk){ + pk=pPk; +} +/**Obtiene el valor de cod_estado +@return valor de cod_estado*/ +public String getCod_estado(){ + return cod_estado; +} +/**Fija el valor de cod_estado +@param pCod_estado nuevo Valor de cod_estado*/ +public void setCod_estado(String pCod_estado){ + cod_estado=pCod_estado; +} + +/**Obtiene el valor de cod_empleado +@return valor de cod_empleado*/ +public String getCod_empleado(){ + return cod_empleado; +} +/**Fija el valor de cod_empleado +@param pCod_empleado nuevo Valor de cod_empleado*/ +public void setCod_empleado(String pCod_empleado){ + cod_empleado=pCod_empleado; +} + +/**Obtiene el valor de cod_credencial +@return valor de cod_credencial*/ +public String getCod_credencial(){ + return cod_credencial; +} +/**Fija el valor de cod_credencial +@param pCod_credencial nuevo Valor de cod_credencial*/ +public void setCod_credencial(String pCod_credencial){ + cod_credencial=pCod_credencial; +} + +/**Obtiene el valor de fec_creacion +@return valor de fec_creacion*/ +public Date getFec_creacion(){ + return fec_creacion; +} +/**Fija el valor de fec_creacion +@param pFec_creacion nuevo Valor de fec_creacion*/ +public void setFec_creacion(Date pFec_creacion){ + fec_creacion=pFec_creacion; +} + +/**Obtiene el valor de num_dias +@return valor de num_dias*/ +public BigDecimal getNum_dias(){ + return num_dias; +} +/**Fija el valor de num_dias +@param pNum_dias nuevo Valor de num_dias*/ +public void setNum_dias(BigDecimal pNum_dias){ + num_dias=pNum_dias; +} + +/**Obtiene el valor de num_dias_acumulados +@return valor de num_dias_acumulados*/ +public BigDecimal getNum_dias_acumulados(){ + return num_dias_acumulados; +} +/**Fija el valor de num_dias_acumulados +@param pNum_dias_acumulados nuevo Valor de num_dias_acumulados*/ +public void setNum_dias_acumulados(BigDecimal pNum_dias_acumulados){ + num_dias_acumulados=pNum_dias_acumulados; +} + +/**Obtiene el valor de sts_viaticos +@return valor de sts_viaticos*/ +public String getSts_viaticos(){ + return sts_viaticos; +} +/**Fija el valor de sts_viaticos +@param pSts_viaticos nuevo Valor de sts_viaticos*/ +public void setSts_viaticos(String pSts_viaticos){ + sts_viaticos=pSts_viaticos; +} + +/**Obtiene el valor de sts_movilizacion +@return valor de sts_movilizacion*/ +public String getSts_movilizacion(){ + return sts_movilizacion; +} +/**Fija el valor de sts_movilizacion +@param pSts_movilizacion nuevo Valor de sts_movilizacion*/ +public void setSts_movilizacion(String pSts_movilizacion){ + sts_movilizacion=pSts_movilizacion; +} + +/**Obtiene el valor de sts_subsistencia +@return valor de sts_subsistencia*/ +public String getSts_subsistencia(){ + return sts_subsistencia; +} +/**Fija el valor de sts_subsistencia +@param pSts_subsistencia nuevo Valor de sts_subsistencia*/ +public void setSts_subsistencia(String pSts_subsistencia){ + sts_subsistencia=pSts_subsistencia; +} + +/**Obtiene el valor de sts_alimentacion +@return valor de sts_alimentacion*/ +public String getSts_alimentacion(){ + return sts_alimentacion; +} +/**Fija el valor de sts_alimentacion +@param pSts_alimentacion nuevo Valor de sts_alimentacion*/ +public void setSts_alimentacion(String pSts_alimentacion){ + sts_alimentacion=pSts_alimentacion; +} + +/**Obtiene el valor de cod_destino +@return valor de cod_destino*/ +public String getCod_destino(){ + return cod_destino; +} +/**Fija el valor de cod_destino +@param pCod_destino nuevo Valor de cod_destino*/ +public void setCod_destino(String pCod_destino){ + cod_destino=pCod_destino; +} + +/**Obtiene el valor de fec_ini_viatico +@return valor de fec_ini_viatico*/ +public Date getFec_ini_viatico(){ + return fec_ini_viatico; +} +/**Fija el valor de fec_ini_viatico +@param pFec_ini_viatico nuevo Valor de fec_ini_viatico*/ +public void setFec_ini_viatico(Date pFec_ini_viatico){ + fec_ini_viatico=pFec_ini_viatico; +} + +/**Obtiene el valor de fec_fin_viatico +@return valor de fec_fin_viatico*/ +public Date getFec_fin_viatico(){ + return fec_fin_viatico; +} +/**Fija el valor de fec_fin_viatico +@param pFec_fin_viatico nuevo Valor de fec_fin_viatico*/ +public void setFec_fin_viatico(Date pFec_fin_viatico){ + fec_fin_viatico=pFec_fin_viatico; +} + +/**Obtiene el valor de fec_hora_inicio +@return valor de fec_hora_inicio*/ +public String getFec_hora_inicio(){ + return fec_hora_inicio; +} +/**Fija el valor de fec_hora_inicio +@param pFec_hora_inicio nuevo Valor de fec_hora_inicio*/ +public void setFec_hora_inicio(String pFec_hora_inicio){ + fec_hora_inicio=pFec_hora_inicio; +} + +/**Obtiene el valor de fec_hora_fin +@return valor de fec_hora_fin*/ +public String getFec_hora_fin(){ + return fec_hora_fin; +} +/**Fija el valor de fec_hora_fin +@param pFec_hora_fin nuevo Valor de fec_hora_fin*/ +public void setFec_hora_fin(String pFec_hora_fin){ + fec_hora_fin=pFec_hora_fin; +} + +/**Obtiene el valor de txt_actividades +@return valor de txt_actividades*/ +public String getTxt_actividades(){ + return txt_actividades; +} +/**Fija el valor de txt_actividades +@param pTxt_actividades nuevo Valor de txt_actividades*/ +public void setTxt_actividades(String pTxt_actividades){ + txt_actividades=pTxt_actividades; +} + +/**Obtiene el valor de cod_usuario +@return valor de cod_usuario*/ +public String getCod_usuario(){ + return cod_usuario; +} +/**Fija el valor de cod_usuario +@param pCod_usuario nuevo Valor de cod_usuario*/ +public void setCod_usuario(String pCod_usuario){ + cod_usuario=pCod_usuario; +} + +/**Obtiene el valor de cod_jefe +@return valor de cod_jefe*/ +public String getCod_jefe(){ + return cod_jefe; +} +/**Fija el valor de cod_jefe +@param pCod_jefe nuevo Valor de cod_jefe*/ +public void setCod_jefe(String pCod_jefe){ + cod_jefe=pCod_jefe; +} + +/**Obtiene el valor de cod_responsable +@return valor de cod_responsable*/ +public String getCod_responsable(){ + return cod_responsable; +} +/**Fija el valor de cod_responsable +@param pCod_responsable nuevo Valor de cod_responsable*/ +public void setCod_responsable(String pCod_responsable){ + cod_responsable=pCod_responsable; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof ViaSolicitud))return false; + ViaSolicitud that = (ViaSolicitud) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad ViaSolicitud +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco ViaSolicitud +*/ +public Object createInstance(){ + ViaSolicitud instance=new ViaSolicitud(); + instance.setPk(new ViaSolicitudKey()); + return instance; +} +/**Clona la entidad ViaSolicitud +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + ViaSolicitud p=(ViaSolicitud)this.clone(); + p.setPk((ViaSolicitudKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudComentarios.java.svn-base b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudComentarios.java.svn-base new file mode 100644 index 0000000..eec0787 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudComentarios.java.svn-base @@ -0,0 +1,247 @@ +package com.fp.persistence.pviaticos.solicitud; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla VIA_SOL_COMENTARIOS*/ +@Entity(name="ViaSolicitudComentarios") +@Table(name="VIA_SOL_COMENTARIOS") +public class ViaSolicitudComentarios extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad ViaSolicitudComentarios +*/ +@EmbeddedId +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(COD_SECUENCIA),0)+1 from VIA_SOL_COMENTARIOS " + + "where COD_SOLICITUD=:cod_solicitud "), @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "cod_solicitud,pk.cod_solicitud"), @Parameter(name = "field", value = "cod_secuencia") }) +@GeneratedValue(generator = "seq_id") +private ViaSolicitudComentariosKey pk; +@Column(name="COD_ESTADO", nullable=true) + +/** +* Codigo de estatus de la solicitud de viaticos +*/ +private String cod_estado; + +@Column(name="COD_USUARIO", nullable=true) + +/** +* Campo para el codigo del funcionario que ingresa el comentario +*/ +private String cod_usuario; + +@Column(name="TXT_ACTIVIDAD", nullable=true) + +/** +* Campo para el ingreso del nombre de la actividad +*/ +private String txt_actividad; + +@Column(name="FEC_COMENTARIO", nullable=true) + +/** +* Campo para registrar la fecha del comentario +*/ +private Date fec_comentario; + +@Column(name="FEC_HORA", nullable=true) + +/** +* Campo para el registro de la hora del comentario +*/ +private String fec_hora; + +@Column(name="TXT_COMENTARIO", nullable=true) + +/** +* Campo para el registro de los comentarios +*/ +private String txt_comentario; + +/**Contructor por defecto*/ +public ViaSolicitudComentarios(){ +} +/**Contructor de ViaSolicitudComentarios +@param pPk Clave Primaria del entity +*/ +public ViaSolicitudComentarios(ViaSolicitudComentariosKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return ViaSolicitudComentarios +*/ +public static ViaSolicitudComentarios find(EntityManager pEntityManager,ViaSolicitudComentariosKey pKey) throws Exception{ + ViaSolicitudComentarios obj = pEntityManager.find(ViaSolicitudComentarios.class,pKey); + return obj; +} +/**Entrega la Clave primaria de ViaSolicitudComentarios +@return El objeto que referencia a la Clave primaria de ViaSolicitudComentarios +*/ +public ViaSolicitudComentariosKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de ViaSolicitudComentarios +@param pPk El objeto que referencia a la nueva Clave primaria de ViaSolicitudComentarios +*/ +public void setPk(ViaSolicitudComentariosKey pPk){ + pk=pPk; +} +/**Obtiene el valor de cod_estado +@return valor de cod_estado*/ +public String getCod_estado(){ + return cod_estado; +} +/**Fija el valor de cod_estado +@param pCod_estado nuevo Valor de cod_estado*/ +public void setCod_estado(String pCod_estado){ + cod_estado=pCod_estado; +} + +/**Obtiene el valor de cod_usuario +@return valor de cod_usuario*/ +public String getCod_usuario(){ + return cod_usuario; +} +/**Fija el valor de cod_empleado +@param pCod_usuario nuevo Valor de cod_usuario*/ +public void setCod_usuario(String pCod_usuario){ + cod_usuario=pCod_usuario; +} + +/**Obtiene el valor de txt_actividad +@return valor de txt_actividad*/ +public String getTxt_actividad(){ + return txt_actividad; +} +/**Fija el valor de txt_actividad +@param pTxt_actividad nuevo Valor de txt_actividad*/ +public void setTxt_actividad(String pTxt_actividad){ + txt_actividad=pTxt_actividad; +} + +/**Obtiene el valor de fec_comentario +@return valor de fec_comentario*/ +public Date getFec_comentario(){ + return fec_comentario; +} +/**Fija el valor de fec_comentario +@param pFec_comentario nuevo Valor de fec_comentario*/ +public void setFec_comentario(Date pFec_comentario){ + fec_comentario=pFec_comentario; +} + +/**Obtiene el valor de fec_hora +@return valor de fec_hora*/ +public String getFec_hora(){ + return fec_hora; +} +/**Fija el valor de fec_hora +@param pFec_hora nuevo Valor de fec_hora*/ +public void setFec_hora(String pFec_hora){ + fec_hora=pFec_hora; +} + +/**Obtiene el valor de txt_comentario +@return valor de txt_comentario*/ +public String getTxt_comentario(){ + return txt_comentario; +} +/**Fija el valor de txt_comentario +@param pTxt_comentario nuevo Valor de txt_comentario*/ +public void setTxt_comentario(String pTxt_comentario){ + txt_comentario=pTxt_comentario; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof ViaSolicitudComentarios))return false; + ViaSolicitudComentarios that = (ViaSolicitudComentarios) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad ViaSolicitudComentarios +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco ViaSolicitudComentarios +*/ +public Object createInstance(){ + ViaSolicitudComentarios instance=new ViaSolicitudComentarios(); + instance.setPk(new ViaSolicitudComentariosKey()); + return instance; +} +/**Clona la entidad ViaSolicitudComentarios +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + ViaSolicitudComentarios p=(ViaSolicitudComentarios)this.clone(); + p.setPk((ViaSolicitudComentariosKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudComentariosKey.java.svn-base b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudComentariosKey.java.svn-base new file mode 100644 index 0000000..3c65a90 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudComentariosKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pviaticos.solicitud; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de VIA_SOL_COMENTARIOS*/ +@Embeddable +public class ViaSolicitudComentariosKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COD_SOLICITUD", nullable=false,updatable=false) + +/** +* Numero de solicitud de viaticos +*/ +private String cod_solicitud; + +@Column(name="COD_TIPO", nullable=false,updatable=false) + +/** +* Campo para el codigo del documento +*/ +private String cod_tipo; + +@Column(name="COD_SECUENCIA", nullable=false,updatable=false) + +/** +* Campo secuancial para los comentarios +*/ +private Integer cod_secuencia; + +/**Contructor por defecto*/ +public ViaSolicitudComentariosKey(){} +/**Contructor de ViaSolicitudComentariosKey +@param pCod_solicitud Numero de solicitud de viaticos +@param pCod_tipo Campo para el codigo del documento +@param pCod_secuencia Campo secuancial para los comentarios +*/ +public ViaSolicitudComentariosKey(String pCod_solicitud,String pCod_tipo,Integer pCod_secuencia){ + cod_solicitud=pCod_solicitud; + cod_tipo=pCod_tipo; + cod_secuencia=pCod_secuencia; +} +/**Obtiene el valor de cod_solicitud +@return valor de cod_solicitud*/ +public String getCod_solicitud(){ + return cod_solicitud; +} +/**Fija el valor de cod_solicitud +@param pCod_solicitud nuevo Valor de cod_solicitud*/ +public void setCod_solicitud(String pCod_solicitud){ + cod_solicitud=pCod_solicitud; +} + +/**Obtiene el valor de cod_tipo +@return valor de cod_tipo*/ +public String getCod_tipo(){ + return cod_tipo; +} +/**Fija el valor de cod_tipo +@param pCod_tipo nuevo Valor de cod_tipo*/ +public void setCod_tipo(String pCod_tipo){ + cod_tipo=pCod_tipo; +} + +/**Obtiene el valor de cod_secuencia +@return valor de cod_secuencia*/ +public Integer getCod_secuencia(){ + return cod_secuencia; +} +/**Fija el valor de cod_secuencia +@param pCod_secuencia nuevo Valor de cod_secuencia*/ +public void setCod_secuencia(Integer pCod_secuencia){ + cod_secuencia=pCod_secuencia; +} + +/**Implementacion de la comparacion de ViaSolicitudComentariosKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof ViaSolicitudComentariosKey))return false; + ViaSolicitudComentariosKey that = (ViaSolicitudComentariosKey) o; + if (this.getCod_solicitud() == null || that.getCod_solicitud() == null){ + return false; + } + if (! this.getCod_solicitud().equals(that.getCod_solicitud())){ + return false; + } + if (this.getCod_tipo() == null || that.getCod_tipo() == null){ + return false; + } + if (! this.getCod_tipo().equals(that.getCod_tipo())){ + return false; + } + if (this.getCod_secuencia() == null || that.getCod_secuencia() == null){ + return false; + } + if (! this.getCod_secuencia().equals(that.getCod_secuencia())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia ViaSolicitudComentariosKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCod_solicitud() == null ? 0 : this.getCod_solicitud().hashCode()); + result = result * 37 + (this.getCod_tipo() == null ? 0 : this.getCod_tipo().hashCode()); + result = result * 37 + (this.getCod_secuencia() == null ? 0 : this.getCod_secuencia().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudIntegrantes.java.svn-base b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudIntegrantes.java.svn-base new file mode 100644 index 0000000..3d511a8 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudIntegrantes.java.svn-base @@ -0,0 +1,122 @@ +package com.fp.persistence.pviaticos.solicitud; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla VIA_SOL_INTEGRANTES*/ +@Entity(name="ViaSolicitudIntegrantes") +@Table(name="VIA_SOL_INTEGRANTES") +public class ViaSolicitudIntegrantes extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad ViaSolicitudIntegrantes +*/ +@EmbeddedId +private ViaSolicitudIntegrantesKey pk; +/**Contructor por defecto*/ +public ViaSolicitudIntegrantes(){ +} +/**Contructor de ViaSolicitudIntegrantes +@param pPk Clave Primaria del entity +*/ +public ViaSolicitudIntegrantes(ViaSolicitudIntegrantesKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return ViaSolicitudIntegrantes +*/ +public static ViaSolicitudIntegrantes find(EntityManager pEntityManager,ViaSolicitudIntegrantesKey pKey) throws Exception{ + ViaSolicitudIntegrantes obj = pEntityManager.find(ViaSolicitudIntegrantes.class,pKey); + return obj; +} +/**Entrega la Clave primaria de ViaSolicitudIntegrantes +@return El objeto que referencia a la Clave primaria de ViaSolicitudIntegrantes +*/ +public ViaSolicitudIntegrantesKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de ViaSolicitudIntegrantes +@param pPk El objeto que referencia a la nueva Clave primaria de ViaSolicitudIntegrantes +*/ +public void setPk(ViaSolicitudIntegrantesKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof ViaSolicitudIntegrantes))return false; + ViaSolicitudIntegrantes that = (ViaSolicitudIntegrantes) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad ViaSolicitudIntegrantes +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco ViaSolicitudIntegrantes +*/ +public Object createInstance(){ + ViaSolicitudIntegrantes instance=new ViaSolicitudIntegrantes(); + instance.setPk(new ViaSolicitudIntegrantesKey()); + return instance; +} +/**Clona la entidad ViaSolicitudIntegrantes +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + ViaSolicitudIntegrantes p=(ViaSolicitudIntegrantes)this.clone(); + p.setPk((ViaSolicitudIntegrantesKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudIntegrantesKey.java.svn-base b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudIntegrantesKey.java.svn-base new file mode 100644 index 0000000..9b16bd1 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudIntegrantesKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pviaticos.solicitud; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de VIA_SOL_INTEGRANTES*/ +@Embeddable +public class ViaSolicitudIntegrantesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COD_SOLICITUD", nullable=false,updatable=false) + +/** +* Numero de solicitud de viaticos +*/ +private String cod_solicitud; + +@Column(name="COD_TIPO", nullable=false,updatable=false) + +/** +* Campo para el codigo del documento +*/ +private String cod_tipo; + +@Column(name="COD_EMPLEADO", nullable=false,updatable=false) + +/** +* Codigo de estatus de la solicitud de viaticos +*/ +private String cod_empleado; + +/**Contructor por defecto*/ +public ViaSolicitudIntegrantesKey(){} +/**Contructor de ViaSolicitudIntegrantesKey +@param pCod_solicitud Numero de solicitud de viaticos +@param pCod_tipo Campo para el codigo del documento +@param pCod_empleado Codigo de estatus de la solicitud de viaticos +*/ +public ViaSolicitudIntegrantesKey(String pCod_solicitud,String pCod_tipo,String pCod_empleado){ + cod_solicitud=pCod_solicitud; + cod_tipo=pCod_tipo; + cod_empleado=pCod_empleado; +} +/**Obtiene el valor de cod_solicitud +@return valor de cod_solicitud*/ +public String getCod_solicitud(){ + return cod_solicitud; +} +/**Fija el valor de cod_solicitud +@param pCod_solicitud nuevo Valor de cod_solicitud*/ +public void setCod_solicitud(String pCod_solicitud){ + cod_solicitud=pCod_solicitud; +} + +/**Obtiene el valor de cod_tipo +@return valor de cod_tipo*/ +public String getCod_tipo(){ + return cod_tipo; +} +/**Fija el valor de cod_tipo +@param pCod_tipo nuevo Valor de cod_tipo*/ +public void setCod_tipo(String pCod_tipo){ + cod_tipo=pCod_tipo; +} + +/**Obtiene el valor de cod_empleado +@return valor de cod_empleado*/ +public String getCod_empleado(){ + return cod_empleado; +} +/**Fija el valor de cod_empleado +@param pCod_empleado nuevo Valor de cod_empleado*/ +public void setCod_empleado(String pCod_empleado){ + cod_empleado=pCod_empleado; +} + +/**Implementacion de la comparacion de ViaSolicitudIntegrantesKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof ViaSolicitudIntegrantesKey))return false; + ViaSolicitudIntegrantesKey that = (ViaSolicitudIntegrantesKey) o; + if (this.getCod_solicitud() == null || that.getCod_solicitud() == null){ + return false; + } + if (! this.getCod_solicitud().equals(that.getCod_solicitud())){ + return false; + } + if (this.getCod_tipo() == null || that.getCod_tipo() == null){ + return false; + } + if (! this.getCod_tipo().equals(that.getCod_tipo())){ + return false; + } + if (this.getCod_empleado() == null || that.getCod_empleado() == null){ + return false; + } + if (! this.getCod_empleado().equals(that.getCod_empleado())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia ViaSolicitudIntegrantesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCod_solicitud() == null ? 0 : this.getCod_solicitud().hashCode()); + result = result * 37 + (this.getCod_tipo() == null ? 0 : this.getCod_tipo().hashCode()); + result = result * 37 + (this.getCod_empleado() == null ? 0 : this.getCod_empleado().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudKey.java.svn-base b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudKey.java.svn-base new file mode 100644 index 0000000..3585c3f --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudKey.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.persistence.pviaticos.solicitud; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de VIA_SOLICITUD*/ +@Embeddable +public class ViaSolicitudKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COD_SOLICITUD", nullable=false,updatable=false) + +/** +* Numero de solicitud de viaticos +*/ +private String cod_solicitud; + +@Column(name="COD_TIPO", nullable=false,updatable=false) + +/** +* Campo para el codigo del documento +*/ +private String cod_tipo; + +/**Contructor por defecto*/ +public ViaSolicitudKey(){} +/**Contructor de ViaSolicitudKey +@param pCod_solicitud Numero de solicitud de viaticos +@param pCod_tipo Campo para el codigo del documento +*/ +public ViaSolicitudKey(String pCod_solicitud,String pCod_tipo){ + cod_solicitud=pCod_solicitud; + cod_tipo=pCod_tipo; +} +/**Obtiene el valor de cod_solicitud +@return valor de cod_solicitud*/ +public String getCod_solicitud(){ + return cod_solicitud; +} +/**Fija el valor de cod_solicitud +@param pCod_solicitud nuevo Valor de cod_solicitud*/ +public void setCod_solicitud(String pCod_solicitud){ + cod_solicitud=pCod_solicitud; +} + +/**Obtiene el valor de cod_tipo +@return valor de cod_tipo*/ +public String getCod_tipo(){ + return cod_tipo; +} +/**Fija el valor de cod_tipo +@param pCod_tipo nuevo Valor de cod_tipo*/ +public void setCod_tipo(String pCod_tipo){ + cod_tipo=pCod_tipo; +} + +/**Implementacion de la comparacion de ViaSolicitudKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof ViaSolicitudKey))return false; + ViaSolicitudKey that = (ViaSolicitudKey) o; + if (this.getCod_solicitud() == null || that.getCod_solicitud() == null){ + return false; + } + if (! this.getCod_solicitud().equals(that.getCod_solicitud())){ + return false; + } + if (this.getCod_tipo() == null || that.getCod_tipo() == null){ + return false; + } + if (! this.getCod_tipo().equals(that.getCod_tipo())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia ViaSolicitudKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCod_solicitud() == null ? 0 : this.getCod_solicitud().hashCode()); + result = result * 37 + (this.getCod_tipo() == null ? 0 : this.getCod_tipo().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudLiquidacion.java.svn-base b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudLiquidacion.java.svn-base new file mode 100644 index 0000000..d309f06 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudLiquidacion.java.svn-base @@ -0,0 +1,266 @@ +package com.fp.persistence.pviaticos.solicitud; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla VIA_SOL_LIQUIDACION*/ +@Entity(name="ViaSolicitudLiquidacion") +@Table(name="VIA_SOL_LIQUIDACION") +public class ViaSolicitudLiquidacion extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad ViaSolicitudLiquidacion +*/ +@EmbeddedId +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(COD_SECUENCIA),0)+1 from VIA_SOL_LIQUIDACION " + + "where COD_SOLICITUD=:cod_solicitud "), @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "cod_solicitud,pk.cod_solicitud"), @Parameter(name = "field", value = "cod_secuencia") }) +@GeneratedValue(generator = "seq_id") +private ViaSolicitudLiquidacionKey pk; +@Column(name="FEC_FACTURA", nullable=true) + +/** +* Campo para el ingreso de la fecha de emision de la factura +*/ +private Date fec_factura; + +@Column(name="NUM_COMPROBANTE", nullable=true) + +/** +* Campo para el ingreso del comprobante de pago +*/ +private String num_comprobante; + +@Column(name="NOM_EMPRESA", nullable=true) + +/** +* Campo para el ingreso del nombre de la empresa de servicio +*/ +private String nom_empresa; + +@Column(name="NUM_RUC", nullable=true) + +/** +* Campo para el ingreso del RUC +*/ +private String num_ruc; + +@Column(name="COD_GASTO", nullable=true) + +/** +* Campo para el ingreso del tipo de gasto empleado en la comision +*/ +private String cod_gasto; + +@Column(name="VAL_IMPORTE", nullable=true) + +/** +* Campo para el ingreso del total de la factura +*/ +private BigDecimal val_importe; + +@Column(name="NOM_LUGAREMISION", nullable=true) + +/** +* Campo para el ingreso del lugar y fecha de emision de la liquidacion +*/ +private String nom_lugaremision; + +/**Contructor por defecto*/ +public ViaSolicitudLiquidacion(){ +} +/**Contructor de ViaSolicitudLiquidacion +@param pPk Clave Primaria del entity +*/ +public ViaSolicitudLiquidacion(ViaSolicitudLiquidacionKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return ViaSolicitudLiquidacion +*/ +public static ViaSolicitudLiquidacion find(EntityManager pEntityManager,ViaSolicitudLiquidacionKey pKey) throws Exception{ + ViaSolicitudLiquidacion obj = pEntityManager.find(ViaSolicitudLiquidacion.class,pKey); + return obj; +} +/**Entrega la Clave primaria de ViaSolicitudLiquidacion +@return El objeto que referencia a la Clave primaria de ViaSolicitudLiquidacion +*/ +public ViaSolicitudLiquidacionKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de ViaSolicitudLiquidacion +@param pPk El objeto que referencia a la nueva Clave primaria de ViaSolicitudLiquidacion +*/ +public void setPk(ViaSolicitudLiquidacionKey pPk){ + pk=pPk; +} +/**Obtiene el valor de fec_factura +@return valor de fec_factura*/ +public Date getFec_factura(){ + return fec_factura; +} +/**Fija el valor de fec_factura +@param pFec_factura nuevo Valor de fec_factura*/ +public void setFec_factura(Date pFec_factura){ + fec_factura=pFec_factura; +} + +/**Obtiene el valor de num_comprobante +@return valor de num_comprobante*/ +public String getNum_comprobante(){ + return num_comprobante; +} +/**Fija el valor de num_comprobante +@param pNum_comprobante nuevo Valor de num_comprobante*/ +public void setNum_comprobante(String pNum_comprobante){ + num_comprobante=pNum_comprobante; +} + +/**Obtiene el valor de nom_empresa +@return valor de nom_empresa*/ +public String getNom_empresa(){ + return nom_empresa; +} +/**Fija el valor de nom_empresa +@param pNom_empresa nuevo Valor de nom_empresa*/ +public void setNom_empresa(String pNom_empresa){ + nom_empresa=pNom_empresa; +} + +/**Obtiene el valor de num_ruc +@return valor de num_ruc*/ +public String getNum_ruc(){ + return num_ruc; +} +/**Fija el valor de num_ruc +@param pNum_ruc nuevo Valor de num_ruc*/ +public void setNum_ruc(String pNum_ruc){ + num_ruc=pNum_ruc; +} + +/**Obtiene el valor de cod_gasto +@return valor de cod_gasto*/ +public String getCod_gasto(){ + return cod_gasto; +} +/**Fija el valor de cod_gasto +@param pCod_gasto nuevo Valor de cod_gasto*/ +public void setCod_gasto(String pCod_gasto){ + cod_gasto=pCod_gasto; +} + +/**Obtiene el valor de val_importe +@return valor de val_importe*/ +public BigDecimal getVal_importe(){ + return val_importe; +} +/**Fija el valor de val_importe +@param pVal_importe nuevo Valor de val_importe*/ +public void setVal_importe(BigDecimal pVal_importe){ + val_importe=pVal_importe; +} + +/**Obtiene el valor de nom_lugaremision +@return valor de nom_lugaremision*/ +public String getNom_lugaremision(){ + return nom_lugaremision; +} +/**Fija el valor de nom_lugaremision +@param pNom_lugaremision nuevo Valor de nom_lugaremision*/ +public void setNom_lugaremision(String pNom_lugaremision){ + nom_lugaremision=pNom_lugaremision; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof ViaSolicitudLiquidacion))return false; + ViaSolicitudLiquidacion that = (ViaSolicitudLiquidacion) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad ViaSolicitudLiquidacion +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco ViaSolicitudLiquidacion +*/ +public Object createInstance(){ + ViaSolicitudLiquidacion instance=new ViaSolicitudLiquidacion(); + instance.setPk(new ViaSolicitudLiquidacionKey()); + return instance; +} +/**Clona la entidad ViaSolicitudLiquidacion +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + ViaSolicitudLiquidacion p=(ViaSolicitudLiquidacion)this.clone(); + p.setPk((ViaSolicitudLiquidacionKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudLiquidacionKey.java.svn-base b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudLiquidacionKey.java.svn-base new file mode 100644 index 0000000..816a5e9 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudLiquidacionKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pviaticos.solicitud; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de VIA_SOL_LIQUIDACION*/ +@Embeddable +public class ViaSolicitudLiquidacionKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COD_SOLICITUD", nullable=false,updatable=false) + +/** +* Numero de solicitud de viaticos +*/ +private String cod_solicitud; + +@Column(name="COD_TIPO", nullable=false,updatable=false) + +/** +* Campo para el codigo del documento +*/ +private String cod_tipo; + +@Column(name="COD_SECUENCIA", nullable=false,updatable=false) + +/** +* Campo para el codigo secuanecial +*/ +private Integer cod_secuencia; + +/**Contructor por defecto*/ +public ViaSolicitudLiquidacionKey(){} +/**Contructor de ViaSolicitudLiquidacionKey +@param pCod_solicitud Numero de solicitud de viaticos +@param pCod_tipo Campo para el codigo del documento +@param pCod_secuencia Campo para el codigo secuanecial +*/ +public ViaSolicitudLiquidacionKey(String pCod_solicitud,String pCod_tipo,Integer pCod_secuencia){ + cod_solicitud=pCod_solicitud; + cod_tipo=pCod_tipo; + cod_secuencia=pCod_secuencia; +} +/**Obtiene el valor de cod_solicitud +@return valor de cod_solicitud*/ +public String getCod_solicitud(){ + return cod_solicitud; +} +/**Fija el valor de cod_solicitud +@param pCod_solicitud nuevo Valor de cod_solicitud*/ +public void setCod_solicitud(String pCod_solicitud){ + cod_solicitud=pCod_solicitud; +} + +/**Obtiene el valor de cod_tipo +@return valor de cod_tipo*/ +public String getCod_tipo(){ + return cod_tipo; +} +/**Fija el valor de cod_tipo +@param pCod_tipo nuevo Valor de cod_tipo*/ +public void setCod_tipo(String pCod_tipo){ + cod_tipo=pCod_tipo; +} + +/**Obtiene el valor de cod_secuencia +@return valor de cod_secuencia*/ +public Integer getCod_secuencia(){ + return cod_secuencia; +} +/**Fija el valor de cod_secuencia +@param pCod_secuencia nuevo Valor de cod_secuencia*/ +public void setCod_secuencia(Integer pCod_secuencia){ + cod_secuencia=pCod_secuencia; +} + +/**Implementacion de la comparacion de ViaSolicitudLiquidacionKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof ViaSolicitudLiquidacionKey))return false; + ViaSolicitudLiquidacionKey that = (ViaSolicitudLiquidacionKey) o; + if (this.getCod_solicitud() == null || that.getCod_solicitud() == null){ + return false; + } + if (! this.getCod_solicitud().equals(that.getCod_solicitud())){ + return false; + } + if (this.getCod_tipo() == null || that.getCod_tipo() == null){ + return false; + } + if (! this.getCod_tipo().equals(that.getCod_tipo())){ + return false; + } + if (this.getCod_secuencia() == null || that.getCod_secuencia() == null){ + return false; + } + if (! this.getCod_secuencia().equals(that.getCod_secuencia())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia ViaSolicitudLiquidacionKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCod_solicitud() == null ? 0 : this.getCod_solicitud().hashCode()); + result = result * 37 + (this.getCod_tipo() == null ? 0 : this.getCod_tipo().hashCode()); + result = result * 37 + (this.getCod_secuencia() == null ? 0 : this.getCod_secuencia().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudTransporte.java.svn-base b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudTransporte.java.svn-base new file mode 100644 index 0000000..456c7f2 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudTransporte.java.svn-base @@ -0,0 +1,331 @@ +package com.fp.persistence.pviaticos.solicitud; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla VIA_SOL_TRANSPORTE */ +@Entity(name = "ViaSolicitudTransporte") +@Table(name = "VIA_SOL_TRANSPORTE") +public class ViaSolicitudTransporte extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad ViaSolicitudTransporte + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(COD_SECUENCIA),0)+1 from VIA_SOL_TRANSPORTE " + + "where COD_SOLICITUD=:cod_solicitud "), @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "cod_solicitud,pk.cod_solicitud"), @Parameter(name = "field", value = "cod_secuencia") }) + @GeneratedValue(generator = "seq_id") + private ViaSolicitudTransporteKey pk; + + @Column(name = "COD_TIP_TRANSPORTE", nullable = true) + /** + * T terrestre, A aereo, M maritimo + */ + private String cod_tip_transporte; + + @Column(name = "TXT_TRANSPORTE", nullable = true) + /** + * Nombre de la empresa de transporte + */ + private String txt_transporte; + + @Column(name = "TXT_RUTA", nullable = true) + /** + * Ruta utilizada para el transporte + */ + private String txt_ruta; + + @Column(name = "FEC_SALIDA", nullable = true) + /** + * Fecha inicio del viaje + */ + private Date fec_salida; + + @Column(name = "FEC_LLEGADA", nullable = true) + /** + * Fecha llegada + */ + private Date fec_llegada; + + @Column(name = "FEC_HORA_SALIDA", nullable = true) + /** + * Hora de inicio del viaje + */ + private String fec_hora_salida; + + @Column(name = "FEC_HORA_LLEGADA", nullable = true) + /** + * Hora de llegada + */ + private String fec_hora_llegada; + + /** Contructor por defecto */ + public ViaSolicitudTransporte() { + } + + /** + * Contructor de ViaSolicitudTransporte + * + * @param pPk Clave Primaria del entity + */ + public ViaSolicitudTransporte(ViaSolicitudTransporteKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return ViaSolicitudTransporte + */ + public static ViaSolicitudTransporte find(EntityManager pEntityManager, ViaSolicitudTransporteKey pKey) throws Exception { + ViaSolicitudTransporte obj = pEntityManager.find(ViaSolicitudTransporte.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de ViaSolicitudTransporte + * + * @return El objeto que referencia a la Clave primaria de ViaSolicitudTransporte + */ + public ViaSolicitudTransporteKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de ViaSolicitudTransporte + * + * @param pPk El objeto que referencia a la nueva Clave primaria de ViaSolicitudTransporte + */ + public void setPk(ViaSolicitudTransporteKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de cod_tip_transporte + * + * @return valor de cod_tip_transporte + */ + public String getCod_tip_transporte() { + return cod_tip_transporte; + } + + /** + * Fija el valor de cod_tip_transporte + * + * @param pCod_tip_transporte nuevo Valor de cod_tip_transporte + */ + public void setCod_tip_transporte(String pCod_tip_transporte) { + cod_tip_transporte = pCod_tip_transporte; + } + + /** + * Obtiene el valor de txt_transporte + * + * @return valor de txt_transporte + */ + public String getTxt_transporte() { + return txt_transporte; + } + + /** + * Fija el valor de txt_transporte + * + * @param pTxt_transporte nuevo Valor de txt_transporte + */ + public void setTxt_transporte(String pTxt_transporte) { + txt_transporte = pTxt_transporte; + } + + /** + * Obtiene el valor de txt_ruta + * + * @return valor de txt_ruta + */ + public String getTxt_ruta() { + return txt_ruta; + } + + /** + * Fija el valor de txt_ruta + * + * @param pTxt_ruta nuevo Valor de txt_ruta + */ + public void setTxt_ruta(String pTxt_ruta) { + txt_ruta = pTxt_ruta; + } + + /** + * Obtiene el valor de fec_salida + * + * @return valor de fec_salida + */ + public Date getFec_salida() { + return fec_salida; + } + + /** + * Fija el valor de fec_salida + * + * @param pFec_salida nuevo Valor de fec_salida + */ + public void setFec_salida(Date pFec_salida) { + fec_salida = pFec_salida; + } + + /** + * Obtiene el valor de fec_llegada + * + * @return valor de fec_llegada + */ + public Date getFec_llegada() { + return fec_llegada; + } + + /** + * Fija el valor de fec_llegada + * + * @param pFec_llegada nuevo Valor de fec_llegada + */ + public void setFec_llegada(Date pFec_llegada) { + fec_llegada = pFec_llegada; + } + + /** + * Obtiene el valor de fec_hora_salida + * + * @return valor de fec_hora_salida + */ + public String getFec_hora_salida() { + return fec_hora_salida; + } + + /** + * Fija el valor de fec_hora_salida + * + * @param pFec_hora_salida nuevo Valor de fec_hora_salida + */ + public void setFec_hora_salida(String pFec_hora_salida) { + fec_hora_salida = pFec_hora_salida; + } + + /** + * Obtiene el valor de fec_hora_llegada + * + * @return valor de fec_hora_llegada + */ + public String getFec_hora_llegada() { + return fec_hora_llegada; + } + + /** + * Fija el valor de fec_hora_llegada + * + * @param pFec_hora_llegada nuevo Valor de fec_hora_llegada + */ + public void setFec_hora_llegada(String pFec_hora_llegada) { + fec_hora_llegada = pFec_hora_llegada; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof ViaSolicitudTransporte)) + return false; + ViaSolicitudTransporte that = (ViaSolicitudTransporte) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad ViaSolicitudTransporte + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + hashValue = result; + } + return hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco ViaSolicitudTransporte */ + @Override + public Object createInstance() { + ViaSolicitudTransporte instance = new ViaSolicitudTransporte(); + instance.setPk(new ViaSolicitudTransporteKey()); + return instance; + } + + /** + * Clona la entidad ViaSolicitudTransporte + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + ViaSolicitudTransporte p = (ViaSolicitudTransporte) this.clone(); + p.setPk((ViaSolicitudTransporteKey) pk.cloneMe()); + return p; + } +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudTransporteKey.java.svn-base b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudTransporteKey.java.svn-base new file mode 100644 index 0000000..fdf9ea8 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/.svn/text-base/ViaSolicitudTransporteKey.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.persistence.pviaticos.solicitud; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de VIA_SOL_TRANSPORTE*/ +@Embeddable +public class ViaSolicitudTransporteKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COD_SOLICITUD", nullable=false,updatable=false) + +/** +* Numero de solicitud de viaticos +*/ +private String cod_solicitud; + +@Column(name="COD_TIPO", nullable=false,updatable=false) + +/** +* Campo para el codigo del documento +*/ +private String cod_tipo; + +@Column(name="COD_SECUENCIA", nullable=false,updatable=false) + +/** +* Secuencia interna para cada solicitud de transportes utilizados en la comision +*/ +private Integer cod_secuencia; + +/**Contructor por defecto*/ +public ViaSolicitudTransporteKey(){} +/**Contructor de ViaSolicitudTransporteKey +@param pCod_solicitud Numero de solicitud de viaticos +@param pCod_tipo Campo para el codigo del documento +@param pCod_secuencia Secuencia interna para cada solicitud de transportes utilizados en la comision +*/ +public ViaSolicitudTransporteKey(String pCod_solicitud,String pCod_tipo,Integer pCod_secuencia){ + cod_solicitud=pCod_solicitud; + cod_tipo=pCod_tipo; + cod_secuencia=pCod_secuencia; +} +/**Obtiene el valor de cod_solicitud +@return valor de cod_solicitud*/ +public String getCod_solicitud(){ + return cod_solicitud; +} +/**Fija el valor de cod_solicitud +@param pCod_solicitud nuevo Valor de cod_solicitud*/ +public void setCod_solicitud(String pCod_solicitud){ + cod_solicitud=pCod_solicitud; +} + +/**Obtiene el valor de cod_tipo +@return valor de cod_tipo*/ +public String getCod_tipo(){ + return cod_tipo; +} +/**Fija el valor de cod_tipo +@param pCod_tipo nuevo Valor de cod_tipo*/ +public void setCod_tipo(String pCod_tipo){ + cod_tipo=pCod_tipo; +} + +/**Obtiene el valor de cod_secuencia +@return valor de cod_secuencia*/ +public Integer getCod_secuencia(){ + return cod_secuencia; +} +/**Fija el valor de cod_secuencia +@param pCod_secuencia nuevo Valor de cod_secuencia*/ +public void setCod_secuencia(Integer pCod_secuencia){ + cod_secuencia=pCod_secuencia; +} + +/**Implementacion de la comparacion de ViaSolicitudTransporteKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof ViaSolicitudTransporteKey))return false; + ViaSolicitudTransporteKey that = (ViaSolicitudTransporteKey) o; + if (this.getCod_solicitud() == null || that.getCod_solicitud() == null){ + return false; + } + if (! this.getCod_solicitud().equals(that.getCod_solicitud())){ + return false; + } + if (this.getCod_tipo() == null || that.getCod_tipo() == null){ + return false; + } + if (! this.getCod_tipo().equals(that.getCod_tipo())){ + return false; + } + if (this.getCod_secuencia() == null || that.getCod_secuencia() == null){ + return false; + } + if (! this.getCod_secuencia().equals(that.getCod_secuencia())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia ViaSolicitudTransporteKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCod_solicitud() == null ? 0 : this.getCod_solicitud().hashCode()); + result = result * 37 + (this.getCod_tipo() == null ? 0 : this.getCod_tipo().hashCode()); + result = result * 37 + (this.getCod_secuencia() == null ? 0 : this.getCod_secuencia().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitud.java b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitud.java new file mode 100644 index 0000000..04d6fe2 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitud.java @@ -0,0 +1,466 @@ +package com.fp.persistence.pviaticos.solicitud; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla VIA_SOLICITUD*/ +@Entity(name="ViaSolicitud") +@Table(name="VIA_SOLICITUD") +public class ViaSolicitud extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad ViaSolicitud +*/ +@EmbeddedId +private ViaSolicitudKey pk; +@Column(name="COD_ESTADO", nullable=true) + +/** +* Codigo de estatus de la solicitud de viaticos +*/ +private String cod_estado; + +@Column(name="COD_EMPLEADO", nullable=true) + +/** +* Codigo de empleados +*/ +private String cod_empleado; + +@Column(name="COD_CREDENCIAL", nullable=true) + +/** +* Numero de credencial del empleado en la sbs +*/ +private String cod_credencial; + +@Column(name="FEC_CREACION", nullable=true) + +/** +* Fecha de creacion de la solicitud se obtiene de la base de datos +*/ +private Date fec_creacion; + +@Column(name="NUM_DIAS", nullable=true) + +/** +* Numero de dias que el servidor sale de comision +*/ +private BigDecimal num_dias; + +@Column(name="NUM_DIAS_ACUMULADOS", nullable=true) + +/** +* Corresponde a los dias acumulados de viaticos del ejercicio actual a la fecha de ingreso de la solicitud +*/ +private BigDecimal num_dias_acumulados; + +@Column(name="STS_VIATICOS", nullable=true) + +/** +* 1, Indica que solicituta viaticos +*/ +private String sts_viaticos; + +@Column(name="STS_MOVILIZACION", nullable=true) + +/** +* 1, Indica que solicituta gastos de movilizacion +*/ +private String sts_movilizacion; + +@Column(name="STS_SUBSISTENCIA", nullable=true) + +/** +* 1, Indica que solicituta gastos de subsistencia +*/ +private String sts_subsistencia; + +@Column(name="STS_ALIMENTACION", nullable=true) + +/** +* 1, Indica que solicituta gastos de alimentacion +*/ +private String sts_alimentacion; + +@Column(name="COD_DESTINO", nullable=true) + +/** +* Descripcion default del tipo de tabla de pagos +*/ +private String cod_destino; + +@Column(name="FEC_INI_VIATICO", nullable=true) + +/** +* Fecha inicio de la comision +*/ +private Date fec_ini_viatico; + +@Column(name="FEC_FIN_VIATICO", nullable=true) + +/** +* Fecha de finalizacion de la comision +*/ +private Date fec_fin_viatico; + +@Column(name="FEC_HORA_INICIO", nullable=true) + +/** +* Hora de inicio de la comision +*/ +private String fec_hora_inicio; + +@Column(name="FEC_HORA_FIN", nullable=true) + +/** +* Hora de fin de la comision +*/ +private String fec_hora_fin; + +@Column(name="TXT_ACTIVIDADES", nullable=true) + +/** +* Detalle de actividades a realizar +*/ +private String txt_actividades; + +@Column(name="COD_USUARIO", nullable=true) + +/** +* Campo para el codigo de usuario que procesa la solicitud +*/ +private String cod_usuario; + +@Column(name="COD_JEFE", nullable=true) + +/** +* Campo para el codigo del jefe +*/ +private String cod_jefe; + +@Column(name="COD_RESPONSABLE", nullable=true) + +/** +* Campo para el codigo del responsable de la unidad. +*/ +private String cod_responsable; + +/**Contructor por defecto*/ +public ViaSolicitud(){ +} +/**Contructor de ViaSolicitud +@param pPk Clave Primaria del entity +*/ +public ViaSolicitud(ViaSolicitudKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return ViaSolicitud +*/ +public static ViaSolicitud find(EntityManager pEntityManager,ViaSolicitudKey pKey) throws Exception{ + ViaSolicitud obj = pEntityManager.find(ViaSolicitud.class,pKey); + return obj; +} +/**Entrega la Clave primaria de ViaSolicitud +@return El objeto que referencia a la Clave primaria de ViaSolicitud +*/ +public ViaSolicitudKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de ViaSolicitud +@param pPk El objeto que referencia a la nueva Clave primaria de ViaSolicitud +*/ +public void setPk(ViaSolicitudKey pPk){ + pk=pPk; +} +/**Obtiene el valor de cod_estado +@return valor de cod_estado*/ +public String getCod_estado(){ + return cod_estado; +} +/**Fija el valor de cod_estado +@param pCod_estado nuevo Valor de cod_estado*/ +public void setCod_estado(String pCod_estado){ + cod_estado=pCod_estado; +} + +/**Obtiene el valor de cod_empleado +@return valor de cod_empleado*/ +public String getCod_empleado(){ + return cod_empleado; +} +/**Fija el valor de cod_empleado +@param pCod_empleado nuevo Valor de cod_empleado*/ +public void setCod_empleado(String pCod_empleado){ + cod_empleado=pCod_empleado; +} + +/**Obtiene el valor de cod_credencial +@return valor de cod_credencial*/ +public String getCod_credencial(){ + return cod_credencial; +} +/**Fija el valor de cod_credencial +@param pCod_credencial nuevo Valor de cod_credencial*/ +public void setCod_credencial(String pCod_credencial){ + cod_credencial=pCod_credencial; +} + +/**Obtiene el valor de fec_creacion +@return valor de fec_creacion*/ +public Date getFec_creacion(){ + return fec_creacion; +} +/**Fija el valor de fec_creacion +@param pFec_creacion nuevo Valor de fec_creacion*/ +public void setFec_creacion(Date pFec_creacion){ + fec_creacion=pFec_creacion; +} + +/**Obtiene el valor de num_dias +@return valor de num_dias*/ +public BigDecimal getNum_dias(){ + return num_dias; +} +/**Fija el valor de num_dias +@param pNum_dias nuevo Valor de num_dias*/ +public void setNum_dias(BigDecimal pNum_dias){ + num_dias=pNum_dias; +} + +/**Obtiene el valor de num_dias_acumulados +@return valor de num_dias_acumulados*/ +public BigDecimal getNum_dias_acumulados(){ + return num_dias_acumulados; +} +/**Fija el valor de num_dias_acumulados +@param pNum_dias_acumulados nuevo Valor de num_dias_acumulados*/ +public void setNum_dias_acumulados(BigDecimal pNum_dias_acumulados){ + num_dias_acumulados=pNum_dias_acumulados; +} + +/**Obtiene el valor de sts_viaticos +@return valor de sts_viaticos*/ +public String getSts_viaticos(){ + return sts_viaticos; +} +/**Fija el valor de sts_viaticos +@param pSts_viaticos nuevo Valor de sts_viaticos*/ +public void setSts_viaticos(String pSts_viaticos){ + sts_viaticos=pSts_viaticos; +} + +/**Obtiene el valor de sts_movilizacion +@return valor de sts_movilizacion*/ +public String getSts_movilizacion(){ + return sts_movilizacion; +} +/**Fija el valor de sts_movilizacion +@param pSts_movilizacion nuevo Valor de sts_movilizacion*/ +public void setSts_movilizacion(String pSts_movilizacion){ + sts_movilizacion=pSts_movilizacion; +} + +/**Obtiene el valor de sts_subsistencia +@return valor de sts_subsistencia*/ +public String getSts_subsistencia(){ + return sts_subsistencia; +} +/**Fija el valor de sts_subsistencia +@param pSts_subsistencia nuevo Valor de sts_subsistencia*/ +public void setSts_subsistencia(String pSts_subsistencia){ + sts_subsistencia=pSts_subsistencia; +} + +/**Obtiene el valor de sts_alimentacion +@return valor de sts_alimentacion*/ +public String getSts_alimentacion(){ + return sts_alimentacion; +} +/**Fija el valor de sts_alimentacion +@param pSts_alimentacion nuevo Valor de sts_alimentacion*/ +public void setSts_alimentacion(String pSts_alimentacion){ + sts_alimentacion=pSts_alimentacion; +} + +/**Obtiene el valor de cod_destino +@return valor de cod_destino*/ +public String getCod_destino(){ + return cod_destino; +} +/**Fija el valor de cod_destino +@param pCod_destino nuevo Valor de cod_destino*/ +public void setCod_destino(String pCod_destino){ + cod_destino=pCod_destino; +} + +/**Obtiene el valor de fec_ini_viatico +@return valor de fec_ini_viatico*/ +public Date getFec_ini_viatico(){ + return fec_ini_viatico; +} +/**Fija el valor de fec_ini_viatico +@param pFec_ini_viatico nuevo Valor de fec_ini_viatico*/ +public void setFec_ini_viatico(Date pFec_ini_viatico){ + fec_ini_viatico=pFec_ini_viatico; +} + +/**Obtiene el valor de fec_fin_viatico +@return valor de fec_fin_viatico*/ +public Date getFec_fin_viatico(){ + return fec_fin_viatico; +} +/**Fija el valor de fec_fin_viatico +@param pFec_fin_viatico nuevo Valor de fec_fin_viatico*/ +public void setFec_fin_viatico(Date pFec_fin_viatico){ + fec_fin_viatico=pFec_fin_viatico; +} + +/**Obtiene el valor de fec_hora_inicio +@return valor de fec_hora_inicio*/ +public String getFec_hora_inicio(){ + return fec_hora_inicio; +} +/**Fija el valor de fec_hora_inicio +@param pFec_hora_inicio nuevo Valor de fec_hora_inicio*/ +public void setFec_hora_inicio(String pFec_hora_inicio){ + fec_hora_inicio=pFec_hora_inicio; +} + +/**Obtiene el valor de fec_hora_fin +@return valor de fec_hora_fin*/ +public String getFec_hora_fin(){ + return fec_hora_fin; +} +/**Fija el valor de fec_hora_fin +@param pFec_hora_fin nuevo Valor de fec_hora_fin*/ +public void setFec_hora_fin(String pFec_hora_fin){ + fec_hora_fin=pFec_hora_fin; +} + +/**Obtiene el valor de txt_actividades +@return valor de txt_actividades*/ +public String getTxt_actividades(){ + return txt_actividades; +} +/**Fija el valor de txt_actividades +@param pTxt_actividades nuevo Valor de txt_actividades*/ +public void setTxt_actividades(String pTxt_actividades){ + txt_actividades=pTxt_actividades; +} + +/**Obtiene el valor de cod_usuario +@return valor de cod_usuario*/ +public String getCod_usuario(){ + return cod_usuario; +} +/**Fija el valor de cod_usuario +@param pCod_usuario nuevo Valor de cod_usuario*/ +public void setCod_usuario(String pCod_usuario){ + cod_usuario=pCod_usuario; +} + +/**Obtiene el valor de cod_jefe +@return valor de cod_jefe*/ +public String getCod_jefe(){ + return cod_jefe; +} +/**Fija el valor de cod_jefe +@param pCod_jefe nuevo Valor de cod_jefe*/ +public void setCod_jefe(String pCod_jefe){ + cod_jefe=pCod_jefe; +} + +/**Obtiene el valor de cod_responsable +@return valor de cod_responsable*/ +public String getCod_responsable(){ + return cod_responsable; +} +/**Fija el valor de cod_responsable +@param pCod_responsable nuevo Valor de cod_responsable*/ +public void setCod_responsable(String pCod_responsable){ + cod_responsable=pCod_responsable; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof ViaSolicitud))return false; + ViaSolicitud that = (ViaSolicitud) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad ViaSolicitud +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco ViaSolicitud +*/ +public Object createInstance(){ + ViaSolicitud instance=new ViaSolicitud(); + instance.setPk(new ViaSolicitudKey()); + return instance; +} +/**Clona la entidad ViaSolicitud +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + ViaSolicitud p=(ViaSolicitud)this.clone(); + p.setPk((ViaSolicitudKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudComentarios.java b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudComentarios.java new file mode 100644 index 0000000..eec0787 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudComentarios.java @@ -0,0 +1,247 @@ +package com.fp.persistence.pviaticos.solicitud; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; + +import java.io.Serializable; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla VIA_SOL_COMENTARIOS*/ +@Entity(name="ViaSolicitudComentarios") +@Table(name="VIA_SOL_COMENTARIOS") +public class ViaSolicitudComentarios extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad ViaSolicitudComentarios +*/ +@EmbeddedId +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(COD_SECUENCIA),0)+1 from VIA_SOL_COMENTARIOS " + + "where COD_SOLICITUD=:cod_solicitud "), @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "cod_solicitud,pk.cod_solicitud"), @Parameter(name = "field", value = "cod_secuencia") }) +@GeneratedValue(generator = "seq_id") +private ViaSolicitudComentariosKey pk; +@Column(name="COD_ESTADO", nullable=true) + +/** +* Codigo de estatus de la solicitud de viaticos +*/ +private String cod_estado; + +@Column(name="COD_USUARIO", nullable=true) + +/** +* Campo para el codigo del funcionario que ingresa el comentario +*/ +private String cod_usuario; + +@Column(name="TXT_ACTIVIDAD", nullable=true) + +/** +* Campo para el ingreso del nombre de la actividad +*/ +private String txt_actividad; + +@Column(name="FEC_COMENTARIO", nullable=true) + +/** +* Campo para registrar la fecha del comentario +*/ +private Date fec_comentario; + +@Column(name="FEC_HORA", nullable=true) + +/** +* Campo para el registro de la hora del comentario +*/ +private String fec_hora; + +@Column(name="TXT_COMENTARIO", nullable=true) + +/** +* Campo para el registro de los comentarios +*/ +private String txt_comentario; + +/**Contructor por defecto*/ +public ViaSolicitudComentarios(){ +} +/**Contructor de ViaSolicitudComentarios +@param pPk Clave Primaria del entity +*/ +public ViaSolicitudComentarios(ViaSolicitudComentariosKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return ViaSolicitudComentarios +*/ +public static ViaSolicitudComentarios find(EntityManager pEntityManager,ViaSolicitudComentariosKey pKey) throws Exception{ + ViaSolicitudComentarios obj = pEntityManager.find(ViaSolicitudComentarios.class,pKey); + return obj; +} +/**Entrega la Clave primaria de ViaSolicitudComentarios +@return El objeto que referencia a la Clave primaria de ViaSolicitudComentarios +*/ +public ViaSolicitudComentariosKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de ViaSolicitudComentarios +@param pPk El objeto que referencia a la nueva Clave primaria de ViaSolicitudComentarios +*/ +public void setPk(ViaSolicitudComentariosKey pPk){ + pk=pPk; +} +/**Obtiene el valor de cod_estado +@return valor de cod_estado*/ +public String getCod_estado(){ + return cod_estado; +} +/**Fija el valor de cod_estado +@param pCod_estado nuevo Valor de cod_estado*/ +public void setCod_estado(String pCod_estado){ + cod_estado=pCod_estado; +} + +/**Obtiene el valor de cod_usuario +@return valor de cod_usuario*/ +public String getCod_usuario(){ + return cod_usuario; +} +/**Fija el valor de cod_empleado +@param pCod_usuario nuevo Valor de cod_usuario*/ +public void setCod_usuario(String pCod_usuario){ + cod_usuario=pCod_usuario; +} + +/**Obtiene el valor de txt_actividad +@return valor de txt_actividad*/ +public String getTxt_actividad(){ + return txt_actividad; +} +/**Fija el valor de txt_actividad +@param pTxt_actividad nuevo Valor de txt_actividad*/ +public void setTxt_actividad(String pTxt_actividad){ + txt_actividad=pTxt_actividad; +} + +/**Obtiene el valor de fec_comentario +@return valor de fec_comentario*/ +public Date getFec_comentario(){ + return fec_comentario; +} +/**Fija el valor de fec_comentario +@param pFec_comentario nuevo Valor de fec_comentario*/ +public void setFec_comentario(Date pFec_comentario){ + fec_comentario=pFec_comentario; +} + +/**Obtiene el valor de fec_hora +@return valor de fec_hora*/ +public String getFec_hora(){ + return fec_hora; +} +/**Fija el valor de fec_hora +@param pFec_hora nuevo Valor de fec_hora*/ +public void setFec_hora(String pFec_hora){ + fec_hora=pFec_hora; +} + +/**Obtiene el valor de txt_comentario +@return valor de txt_comentario*/ +public String getTxt_comentario(){ + return txt_comentario; +} +/**Fija el valor de txt_comentario +@param pTxt_comentario nuevo Valor de txt_comentario*/ +public void setTxt_comentario(String pTxt_comentario){ + txt_comentario=pTxt_comentario; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof ViaSolicitudComentarios))return false; + ViaSolicitudComentarios that = (ViaSolicitudComentarios) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad ViaSolicitudComentarios +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco ViaSolicitudComentarios +*/ +public Object createInstance(){ + ViaSolicitudComentarios instance=new ViaSolicitudComentarios(); + instance.setPk(new ViaSolicitudComentariosKey()); + return instance; +} +/**Clona la entidad ViaSolicitudComentarios +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + ViaSolicitudComentarios p=(ViaSolicitudComentarios)this.clone(); + p.setPk((ViaSolicitudComentariosKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudComentariosKey.java b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudComentariosKey.java new file mode 100644 index 0000000..3c65a90 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudComentariosKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pviaticos.solicitud; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de VIA_SOL_COMENTARIOS*/ +@Embeddable +public class ViaSolicitudComentariosKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COD_SOLICITUD", nullable=false,updatable=false) + +/** +* Numero de solicitud de viaticos +*/ +private String cod_solicitud; + +@Column(name="COD_TIPO", nullable=false,updatable=false) + +/** +* Campo para el codigo del documento +*/ +private String cod_tipo; + +@Column(name="COD_SECUENCIA", nullable=false,updatable=false) + +/** +* Campo secuancial para los comentarios +*/ +private Integer cod_secuencia; + +/**Contructor por defecto*/ +public ViaSolicitudComentariosKey(){} +/**Contructor de ViaSolicitudComentariosKey +@param pCod_solicitud Numero de solicitud de viaticos +@param pCod_tipo Campo para el codigo del documento +@param pCod_secuencia Campo secuancial para los comentarios +*/ +public ViaSolicitudComentariosKey(String pCod_solicitud,String pCod_tipo,Integer pCod_secuencia){ + cod_solicitud=pCod_solicitud; + cod_tipo=pCod_tipo; + cod_secuencia=pCod_secuencia; +} +/**Obtiene el valor de cod_solicitud +@return valor de cod_solicitud*/ +public String getCod_solicitud(){ + return cod_solicitud; +} +/**Fija el valor de cod_solicitud +@param pCod_solicitud nuevo Valor de cod_solicitud*/ +public void setCod_solicitud(String pCod_solicitud){ + cod_solicitud=pCod_solicitud; +} + +/**Obtiene el valor de cod_tipo +@return valor de cod_tipo*/ +public String getCod_tipo(){ + return cod_tipo; +} +/**Fija el valor de cod_tipo +@param pCod_tipo nuevo Valor de cod_tipo*/ +public void setCod_tipo(String pCod_tipo){ + cod_tipo=pCod_tipo; +} + +/**Obtiene el valor de cod_secuencia +@return valor de cod_secuencia*/ +public Integer getCod_secuencia(){ + return cod_secuencia; +} +/**Fija el valor de cod_secuencia +@param pCod_secuencia nuevo Valor de cod_secuencia*/ +public void setCod_secuencia(Integer pCod_secuencia){ + cod_secuencia=pCod_secuencia; +} + +/**Implementacion de la comparacion de ViaSolicitudComentariosKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof ViaSolicitudComentariosKey))return false; + ViaSolicitudComentariosKey that = (ViaSolicitudComentariosKey) o; + if (this.getCod_solicitud() == null || that.getCod_solicitud() == null){ + return false; + } + if (! this.getCod_solicitud().equals(that.getCod_solicitud())){ + return false; + } + if (this.getCod_tipo() == null || that.getCod_tipo() == null){ + return false; + } + if (! this.getCod_tipo().equals(that.getCod_tipo())){ + return false; + } + if (this.getCod_secuencia() == null || that.getCod_secuencia() == null){ + return false; + } + if (! this.getCod_secuencia().equals(that.getCod_secuencia())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia ViaSolicitudComentariosKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCod_solicitud() == null ? 0 : this.getCod_solicitud().hashCode()); + result = result * 37 + (this.getCod_tipo() == null ? 0 : this.getCod_tipo().hashCode()); + result = result * 37 + (this.getCod_secuencia() == null ? 0 : this.getCod_secuencia().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudIntegrantes.java b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudIntegrantes.java new file mode 100644 index 0000000..3d511a8 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudIntegrantes.java @@ -0,0 +1,122 @@ +package com.fp.persistence.pviaticos.solicitud; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import java.io.Serializable; +import javax.persistence.Table; +import com.fp.dto.hb.HibernateBean; +import javax.persistence.Version; +import java.lang.reflect.Field; +import javax.persistence.Transient; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla VIA_SOL_INTEGRANTES*/ +@Entity(name="ViaSolicitudIntegrantes") +@Table(name="VIA_SOL_INTEGRANTES") +public class ViaSolicitudIntegrantes extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad ViaSolicitudIntegrantes +*/ +@EmbeddedId +private ViaSolicitudIntegrantesKey pk; +/**Contructor por defecto*/ +public ViaSolicitudIntegrantes(){ +} +/**Contructor de ViaSolicitudIntegrantes +@param pPk Clave Primaria del entity +*/ +public ViaSolicitudIntegrantes(ViaSolicitudIntegrantesKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return ViaSolicitudIntegrantes +*/ +public static ViaSolicitudIntegrantes find(EntityManager pEntityManager,ViaSolicitudIntegrantesKey pKey) throws Exception{ + ViaSolicitudIntegrantes obj = pEntityManager.find(ViaSolicitudIntegrantes.class,pKey); + return obj; +} +/**Entrega la Clave primaria de ViaSolicitudIntegrantes +@return El objeto que referencia a la Clave primaria de ViaSolicitudIntegrantes +*/ +public ViaSolicitudIntegrantesKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de ViaSolicitudIntegrantes +@param pPk El objeto que referencia a la nueva Clave primaria de ViaSolicitudIntegrantes +*/ +public void setPk(ViaSolicitudIntegrantesKey pPk){ + pk=pPk; +} +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof ViaSolicitudIntegrantes))return false; + ViaSolicitudIntegrantes that = (ViaSolicitudIntegrantes) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad ViaSolicitudIntegrantes +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco ViaSolicitudIntegrantes +*/ +public Object createInstance(){ + ViaSolicitudIntegrantes instance=new ViaSolicitudIntegrantes(); + instance.setPk(new ViaSolicitudIntegrantesKey()); + return instance; +} +/**Clona la entidad ViaSolicitudIntegrantes +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + ViaSolicitudIntegrantes p=(ViaSolicitudIntegrantes)this.clone(); + p.setPk((ViaSolicitudIntegrantesKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudIntegrantesKey.java b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudIntegrantesKey.java new file mode 100644 index 0000000..9b16bd1 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudIntegrantesKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pviaticos.solicitud; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de VIA_SOL_INTEGRANTES*/ +@Embeddable +public class ViaSolicitudIntegrantesKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COD_SOLICITUD", nullable=false,updatable=false) + +/** +* Numero de solicitud de viaticos +*/ +private String cod_solicitud; + +@Column(name="COD_TIPO", nullable=false,updatable=false) + +/** +* Campo para el codigo del documento +*/ +private String cod_tipo; + +@Column(name="COD_EMPLEADO", nullable=false,updatable=false) + +/** +* Codigo de estatus de la solicitud de viaticos +*/ +private String cod_empleado; + +/**Contructor por defecto*/ +public ViaSolicitudIntegrantesKey(){} +/**Contructor de ViaSolicitudIntegrantesKey +@param pCod_solicitud Numero de solicitud de viaticos +@param pCod_tipo Campo para el codigo del documento +@param pCod_empleado Codigo de estatus de la solicitud de viaticos +*/ +public ViaSolicitudIntegrantesKey(String pCod_solicitud,String pCod_tipo,String pCod_empleado){ + cod_solicitud=pCod_solicitud; + cod_tipo=pCod_tipo; + cod_empleado=pCod_empleado; +} +/**Obtiene el valor de cod_solicitud +@return valor de cod_solicitud*/ +public String getCod_solicitud(){ + return cod_solicitud; +} +/**Fija el valor de cod_solicitud +@param pCod_solicitud nuevo Valor de cod_solicitud*/ +public void setCod_solicitud(String pCod_solicitud){ + cod_solicitud=pCod_solicitud; +} + +/**Obtiene el valor de cod_tipo +@return valor de cod_tipo*/ +public String getCod_tipo(){ + return cod_tipo; +} +/**Fija el valor de cod_tipo +@param pCod_tipo nuevo Valor de cod_tipo*/ +public void setCod_tipo(String pCod_tipo){ + cod_tipo=pCod_tipo; +} + +/**Obtiene el valor de cod_empleado +@return valor de cod_empleado*/ +public String getCod_empleado(){ + return cod_empleado; +} +/**Fija el valor de cod_empleado +@param pCod_empleado nuevo Valor de cod_empleado*/ +public void setCod_empleado(String pCod_empleado){ + cod_empleado=pCod_empleado; +} + +/**Implementacion de la comparacion de ViaSolicitudIntegrantesKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof ViaSolicitudIntegrantesKey))return false; + ViaSolicitudIntegrantesKey that = (ViaSolicitudIntegrantesKey) o; + if (this.getCod_solicitud() == null || that.getCod_solicitud() == null){ + return false; + } + if (! this.getCod_solicitud().equals(that.getCod_solicitud())){ + return false; + } + if (this.getCod_tipo() == null || that.getCod_tipo() == null){ + return false; + } + if (! this.getCod_tipo().equals(that.getCod_tipo())){ + return false; + } + if (this.getCod_empleado() == null || that.getCod_empleado() == null){ + return false; + } + if (! this.getCod_empleado().equals(that.getCod_empleado())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia ViaSolicitudIntegrantesKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCod_solicitud() == null ? 0 : this.getCod_solicitud().hashCode()); + result = result * 37 + (this.getCod_tipo() == null ? 0 : this.getCod_tipo().hashCode()); + result = result * 37 + (this.getCod_empleado() == null ? 0 : this.getCod_empleado().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudKey.java b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudKey.java new file mode 100644 index 0000000..3585c3f --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudKey.java @@ -0,0 +1,124 @@ +package com.fp.persistence.pviaticos.solicitud; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de VIA_SOLICITUD*/ +@Embeddable +public class ViaSolicitudKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COD_SOLICITUD", nullable=false,updatable=false) + +/** +* Numero de solicitud de viaticos +*/ +private String cod_solicitud; + +@Column(name="COD_TIPO", nullable=false,updatable=false) + +/** +* Campo para el codigo del documento +*/ +private String cod_tipo; + +/**Contructor por defecto*/ +public ViaSolicitudKey(){} +/**Contructor de ViaSolicitudKey +@param pCod_solicitud Numero de solicitud de viaticos +@param pCod_tipo Campo para el codigo del documento +*/ +public ViaSolicitudKey(String pCod_solicitud,String pCod_tipo){ + cod_solicitud=pCod_solicitud; + cod_tipo=pCod_tipo; +} +/**Obtiene el valor de cod_solicitud +@return valor de cod_solicitud*/ +public String getCod_solicitud(){ + return cod_solicitud; +} +/**Fija el valor de cod_solicitud +@param pCod_solicitud nuevo Valor de cod_solicitud*/ +public void setCod_solicitud(String pCod_solicitud){ + cod_solicitud=pCod_solicitud; +} + +/**Obtiene el valor de cod_tipo +@return valor de cod_tipo*/ +public String getCod_tipo(){ + return cod_tipo; +} +/**Fija el valor de cod_tipo +@param pCod_tipo nuevo Valor de cod_tipo*/ +public void setCod_tipo(String pCod_tipo){ + cod_tipo=pCod_tipo; +} + +/**Implementacion de la comparacion de ViaSolicitudKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof ViaSolicitudKey))return false; + ViaSolicitudKey that = (ViaSolicitudKey) o; + if (this.getCod_solicitud() == null || that.getCod_solicitud() == null){ + return false; + } + if (! this.getCod_solicitud().equals(that.getCod_solicitud())){ + return false; + } + if (this.getCod_tipo() == null || that.getCod_tipo() == null){ + return false; + } + if (! this.getCod_tipo().equals(that.getCod_tipo())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia ViaSolicitudKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCod_solicitud() == null ? 0 : this.getCod_solicitud().hashCode()); + result = result * 37 + (this.getCod_tipo() == null ? 0 : this.getCod_tipo().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudLiquidacion.java b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudLiquidacion.java new file mode 100644 index 0000000..d309f06 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudLiquidacion.java @@ -0,0 +1,266 @@ +package com.fp.persistence.pviaticos.solicitud; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Column; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.persistence.Table; + +import com.fp.dto.hb.HibernateBean; + +import javax.persistence.Version; + +import java.lang.reflect.Field; + +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import java.sql.Date; + +/**Clase que implementa la entidad de Hibernate que hace referencia a la tabla VIA_SOL_LIQUIDACION*/ +@Entity(name="ViaSolicitudLiquidacion") +@Table(name="VIA_SOL_LIQUIDACION") +public class ViaSolicitudLiquidacion extends com.fp.dto.AbstractDataTransport implements Serializable,HibernateBean,Cloneable{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +/** +* Clave primaria de la Entidad ViaSolicitudLiquidacion +*/ +@EmbeddedId +@GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(COD_SECUENCIA),0)+1 from VIA_SOL_LIQUIDACION " + + "where COD_SOLICITUD=:cod_solicitud "), @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "cod_solicitud,pk.cod_solicitud"), @Parameter(name = "field", value = "cod_secuencia") }) +@GeneratedValue(generator = "seq_id") +private ViaSolicitudLiquidacionKey pk; +@Column(name="FEC_FACTURA", nullable=true) + +/** +* Campo para el ingreso de la fecha de emision de la factura +*/ +private Date fec_factura; + +@Column(name="NUM_COMPROBANTE", nullable=true) + +/** +* Campo para el ingreso del comprobante de pago +*/ +private String num_comprobante; + +@Column(name="NOM_EMPRESA", nullable=true) + +/** +* Campo para el ingreso del nombre de la empresa de servicio +*/ +private String nom_empresa; + +@Column(name="NUM_RUC", nullable=true) + +/** +* Campo para el ingreso del RUC +*/ +private String num_ruc; + +@Column(name="COD_GASTO", nullable=true) + +/** +* Campo para el ingreso del tipo de gasto empleado en la comision +*/ +private String cod_gasto; + +@Column(name="VAL_IMPORTE", nullable=true) + +/** +* Campo para el ingreso del total de la factura +*/ +private BigDecimal val_importe; + +@Column(name="NOM_LUGAREMISION", nullable=true) + +/** +* Campo para el ingreso del lugar y fecha de emision de la liquidacion +*/ +private String nom_lugaremision; + +/**Contructor por defecto*/ +public ViaSolicitudLiquidacion(){ +} +/**Contructor de ViaSolicitudLiquidacion +@param pPk Clave Primaria del entity +*/ +public ViaSolicitudLiquidacion(ViaSolicitudLiquidacionKey pPk){ + this(); + pk=pPk; +} +/** +* Metodo que entrega datos de la tabla dada la clave primaria. +* @param pEntityManager referencia de la session a obtener datos del bean. +* @param pKey Caleve primaria del bean. +* @return ViaSolicitudLiquidacion +*/ +public static ViaSolicitudLiquidacion find(EntityManager pEntityManager,ViaSolicitudLiquidacionKey pKey) throws Exception{ + ViaSolicitudLiquidacion obj = pEntityManager.find(ViaSolicitudLiquidacion.class,pKey); + return obj; +} +/**Entrega la Clave primaria de ViaSolicitudLiquidacion +@return El objeto que referencia a la Clave primaria de ViaSolicitudLiquidacion +*/ +public ViaSolicitudLiquidacionKey getPk(){ + return pk; +} +/**Fija un nuevo valor a la Clave primaria de ViaSolicitudLiquidacion +@param pPk El objeto que referencia a la nueva Clave primaria de ViaSolicitudLiquidacion +*/ +public void setPk(ViaSolicitudLiquidacionKey pPk){ + pk=pPk; +} +/**Obtiene el valor de fec_factura +@return valor de fec_factura*/ +public Date getFec_factura(){ + return fec_factura; +} +/**Fija el valor de fec_factura +@param pFec_factura nuevo Valor de fec_factura*/ +public void setFec_factura(Date pFec_factura){ + fec_factura=pFec_factura; +} + +/**Obtiene el valor de num_comprobante +@return valor de num_comprobante*/ +public String getNum_comprobante(){ + return num_comprobante; +} +/**Fija el valor de num_comprobante +@param pNum_comprobante nuevo Valor de num_comprobante*/ +public void setNum_comprobante(String pNum_comprobante){ + num_comprobante=pNum_comprobante; +} + +/**Obtiene el valor de nom_empresa +@return valor de nom_empresa*/ +public String getNom_empresa(){ + return nom_empresa; +} +/**Fija el valor de nom_empresa +@param pNom_empresa nuevo Valor de nom_empresa*/ +public void setNom_empresa(String pNom_empresa){ + nom_empresa=pNom_empresa; +} + +/**Obtiene el valor de num_ruc +@return valor de num_ruc*/ +public String getNum_ruc(){ + return num_ruc; +} +/**Fija el valor de num_ruc +@param pNum_ruc nuevo Valor de num_ruc*/ +public void setNum_ruc(String pNum_ruc){ + num_ruc=pNum_ruc; +} + +/**Obtiene el valor de cod_gasto +@return valor de cod_gasto*/ +public String getCod_gasto(){ + return cod_gasto; +} +/**Fija el valor de cod_gasto +@param pCod_gasto nuevo Valor de cod_gasto*/ +public void setCod_gasto(String pCod_gasto){ + cod_gasto=pCod_gasto; +} + +/**Obtiene el valor de val_importe +@return valor de val_importe*/ +public BigDecimal getVal_importe(){ + return val_importe; +} +/**Fija el valor de val_importe +@param pVal_importe nuevo Valor de val_importe*/ +public void setVal_importe(BigDecimal pVal_importe){ + val_importe=pVal_importe; +} + +/**Obtiene el valor de nom_lugaremision +@return valor de nom_lugaremision*/ +public String getNom_lugaremision(){ + return nom_lugaremision; +} +/**Fija el valor de nom_lugaremision +@param pNom_lugaremision nuevo Valor de nom_lugaremision*/ +public void setNom_lugaremision(String pNom_lugaremision){ + nom_lugaremision=pNom_lugaremision; +} + +public boolean equals(Object rhs){ + if (rhs == null)return false; + if (! (rhs instanceof ViaSolicitudLiquidacion))return false; + ViaSolicitudLiquidacion that = (ViaSolicitudLiquidacion) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); +} +/**Implementacion del metodo hashCode de la la entidad ViaSolicitudLiquidacion +@return el hashCode la instancia +*/ +public int hashCode() { + if (this.hashValue == 0){ + int result = 17; + if (this.getPk() == null){ + result = super.hashCode(); + }else{ + result = this.getPk().hashCode(); + } + this.hashValue = result; + } + return this.hashValue; +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+=name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +/**Implementacion de la creacion de un bean en blanco ViaSolicitudLiquidacion +*/ +public Object createInstance(){ + ViaSolicitudLiquidacion instance=new ViaSolicitudLiquidacion(); + instance.setPk(new ViaSolicitudLiquidacionKey()); + return instance; +} +/**Clona la entidad ViaSolicitudLiquidacion +@see com.fp.dto.hb.HibernateBean#cloneMe() +*/ +public Object cloneMe() throws CloneNotSupportedException{ + ViaSolicitudLiquidacion p=(ViaSolicitudLiquidacion)this.clone(); + p.setPk((ViaSolicitudLiquidacionKey)this.pk.cloneMe()); + return p; +} +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudLiquidacionKey.java b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudLiquidacionKey.java new file mode 100644 index 0000000..816a5e9 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudLiquidacionKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pviaticos.solicitud; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de VIA_SOL_LIQUIDACION*/ +@Embeddable +public class ViaSolicitudLiquidacionKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COD_SOLICITUD", nullable=false,updatable=false) + +/** +* Numero de solicitud de viaticos +*/ +private String cod_solicitud; + +@Column(name="COD_TIPO", nullable=false,updatable=false) + +/** +* Campo para el codigo del documento +*/ +private String cod_tipo; + +@Column(name="COD_SECUENCIA", nullable=false,updatable=false) + +/** +* Campo para el codigo secuanecial +*/ +private Integer cod_secuencia; + +/**Contructor por defecto*/ +public ViaSolicitudLiquidacionKey(){} +/**Contructor de ViaSolicitudLiquidacionKey +@param pCod_solicitud Numero de solicitud de viaticos +@param pCod_tipo Campo para el codigo del documento +@param pCod_secuencia Campo para el codigo secuanecial +*/ +public ViaSolicitudLiquidacionKey(String pCod_solicitud,String pCod_tipo,Integer pCod_secuencia){ + cod_solicitud=pCod_solicitud; + cod_tipo=pCod_tipo; + cod_secuencia=pCod_secuencia; +} +/**Obtiene el valor de cod_solicitud +@return valor de cod_solicitud*/ +public String getCod_solicitud(){ + return cod_solicitud; +} +/**Fija el valor de cod_solicitud +@param pCod_solicitud nuevo Valor de cod_solicitud*/ +public void setCod_solicitud(String pCod_solicitud){ + cod_solicitud=pCod_solicitud; +} + +/**Obtiene el valor de cod_tipo +@return valor de cod_tipo*/ +public String getCod_tipo(){ + return cod_tipo; +} +/**Fija el valor de cod_tipo +@param pCod_tipo nuevo Valor de cod_tipo*/ +public void setCod_tipo(String pCod_tipo){ + cod_tipo=pCod_tipo; +} + +/**Obtiene el valor de cod_secuencia +@return valor de cod_secuencia*/ +public Integer getCod_secuencia(){ + return cod_secuencia; +} +/**Fija el valor de cod_secuencia +@param pCod_secuencia nuevo Valor de cod_secuencia*/ +public void setCod_secuencia(Integer pCod_secuencia){ + cod_secuencia=pCod_secuencia; +} + +/**Implementacion de la comparacion de ViaSolicitudLiquidacionKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof ViaSolicitudLiquidacionKey))return false; + ViaSolicitudLiquidacionKey that = (ViaSolicitudLiquidacionKey) o; + if (this.getCod_solicitud() == null || that.getCod_solicitud() == null){ + return false; + } + if (! this.getCod_solicitud().equals(that.getCod_solicitud())){ + return false; + } + if (this.getCod_tipo() == null || that.getCod_tipo() == null){ + return false; + } + if (! this.getCod_tipo().equals(that.getCod_tipo())){ + return false; + } + if (this.getCod_secuencia() == null || that.getCod_secuencia() == null){ + return false; + } + if (! this.getCod_secuencia().equals(that.getCod_secuencia())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia ViaSolicitudLiquidacionKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCod_solicitud() == null ? 0 : this.getCod_solicitud().hashCode()); + result = result * 37 + (this.getCod_tipo() == null ? 0 : this.getCod_tipo().hashCode()); + result = result * 37 + (this.getCod_secuencia() == null ? 0 : this.getCod_secuencia().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudTransporte.java b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudTransporte.java new file mode 100644 index 0000000..456c7f2 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudTransporte.java @@ -0,0 +1,331 @@ +package com.fp.persistence.pviaticos.solicitud; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.sql.Date; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import com.fp.dto.hb.HibernateBean; + +/** Clase que implementa la entidad de Hibernate que hace referencia a la tabla VIA_SOL_TRANSPORTE */ +@Entity(name = "ViaSolicitudTransporte") +@Table(name = "VIA_SOL_TRANSPORTE") +public class ViaSolicitudTransporte extends com.fp.dto.AbstractDataTransport implements Serializable, HibernateBean, Cloneable { + /** + * HashCode asociado con la Instancia + */ + @Transient + private int hashValue = 0; + + /** + * Version de la Clase + */ + private static final long serialVersionUID = 1L; + + /** + * Clave primaria de la Entidad ViaSolicitudTransporte + */ + @EmbeddedId + @GenericGenerator(name = "seq_id", strategy = "com.fp.general.keygen.SubSequenceKey", parameters = { + @Parameter(name = "sql", value = "select coalesce(max(COD_SECUENCIA),0)+1 from VIA_SOL_TRANSPORTE " + + "where COD_SOLICITUD=:cod_solicitud "), @Parameter(name = "type", value = "java.lang.Integer"), + @Parameter(name = "param", value = "cod_solicitud,pk.cod_solicitud"), @Parameter(name = "field", value = "cod_secuencia") }) + @GeneratedValue(generator = "seq_id") + private ViaSolicitudTransporteKey pk; + + @Column(name = "COD_TIP_TRANSPORTE", nullable = true) + /** + * T terrestre, A aereo, M maritimo + */ + private String cod_tip_transporte; + + @Column(name = "TXT_TRANSPORTE", nullable = true) + /** + * Nombre de la empresa de transporte + */ + private String txt_transporte; + + @Column(name = "TXT_RUTA", nullable = true) + /** + * Ruta utilizada para el transporte + */ + private String txt_ruta; + + @Column(name = "FEC_SALIDA", nullable = true) + /** + * Fecha inicio del viaje + */ + private Date fec_salida; + + @Column(name = "FEC_LLEGADA", nullable = true) + /** + * Fecha llegada + */ + private Date fec_llegada; + + @Column(name = "FEC_HORA_SALIDA", nullable = true) + /** + * Hora de inicio del viaje + */ + private String fec_hora_salida; + + @Column(name = "FEC_HORA_LLEGADA", nullable = true) + /** + * Hora de llegada + */ + private String fec_hora_llegada; + + /** Contructor por defecto */ + public ViaSolicitudTransporte() { + } + + /** + * Contructor de ViaSolicitudTransporte + * + * @param pPk Clave Primaria del entity + */ + public ViaSolicitudTransporte(ViaSolicitudTransporteKey pPk) { + this(); + pk = pPk; + } + + /** + * Metodo que entrega datos de la tabla dada la clave primaria. + * + * @param pEntityManager referencia de la session a obtener datos del bean. + * @param pKey Caleve primaria del bean. + * @return ViaSolicitudTransporte + */ + public static ViaSolicitudTransporte find(EntityManager pEntityManager, ViaSolicitudTransporteKey pKey) throws Exception { + ViaSolicitudTransporte obj = pEntityManager.find(ViaSolicitudTransporte.class, pKey); + return obj; + } + + /** + * Entrega la Clave primaria de ViaSolicitudTransporte + * + * @return El objeto que referencia a la Clave primaria de ViaSolicitudTransporte + */ + public ViaSolicitudTransporteKey getPk() { + return pk; + } + + /** + * Fija un nuevo valor a la Clave primaria de ViaSolicitudTransporte + * + * @param pPk El objeto que referencia a la nueva Clave primaria de ViaSolicitudTransporte + */ + public void setPk(ViaSolicitudTransporteKey pPk) { + pk = pPk; + } + + /** + * Obtiene el valor de cod_tip_transporte + * + * @return valor de cod_tip_transporte + */ + public String getCod_tip_transporte() { + return cod_tip_transporte; + } + + /** + * Fija el valor de cod_tip_transporte + * + * @param pCod_tip_transporte nuevo Valor de cod_tip_transporte + */ + public void setCod_tip_transporte(String pCod_tip_transporte) { + cod_tip_transporte = pCod_tip_transporte; + } + + /** + * Obtiene el valor de txt_transporte + * + * @return valor de txt_transporte + */ + public String getTxt_transporte() { + return txt_transporte; + } + + /** + * Fija el valor de txt_transporte + * + * @param pTxt_transporte nuevo Valor de txt_transporte + */ + public void setTxt_transporte(String pTxt_transporte) { + txt_transporte = pTxt_transporte; + } + + /** + * Obtiene el valor de txt_ruta + * + * @return valor de txt_ruta + */ + public String getTxt_ruta() { + return txt_ruta; + } + + /** + * Fija el valor de txt_ruta + * + * @param pTxt_ruta nuevo Valor de txt_ruta + */ + public void setTxt_ruta(String pTxt_ruta) { + txt_ruta = pTxt_ruta; + } + + /** + * Obtiene el valor de fec_salida + * + * @return valor de fec_salida + */ + public Date getFec_salida() { + return fec_salida; + } + + /** + * Fija el valor de fec_salida + * + * @param pFec_salida nuevo Valor de fec_salida + */ + public void setFec_salida(Date pFec_salida) { + fec_salida = pFec_salida; + } + + /** + * Obtiene el valor de fec_llegada + * + * @return valor de fec_llegada + */ + public Date getFec_llegada() { + return fec_llegada; + } + + /** + * Fija el valor de fec_llegada + * + * @param pFec_llegada nuevo Valor de fec_llegada + */ + public void setFec_llegada(Date pFec_llegada) { + fec_llegada = pFec_llegada; + } + + /** + * Obtiene el valor de fec_hora_salida + * + * @return valor de fec_hora_salida + */ + public String getFec_hora_salida() { + return fec_hora_salida; + } + + /** + * Fija el valor de fec_hora_salida + * + * @param pFec_hora_salida nuevo Valor de fec_hora_salida + */ + public void setFec_hora_salida(String pFec_hora_salida) { + fec_hora_salida = pFec_hora_salida; + } + + /** + * Obtiene el valor de fec_hora_llegada + * + * @return valor de fec_hora_llegada + */ + public String getFec_hora_llegada() { + return fec_hora_llegada; + } + + /** + * Fija el valor de fec_hora_llegada + * + * @param pFec_hora_llegada nuevo Valor de fec_hora_llegada + */ + public void setFec_hora_llegada(String pFec_hora_llegada) { + fec_hora_llegada = pFec_hora_llegada; + } + + @Override + public boolean equals(Object rhs) { + if (rhs == null) + return false; + if (!(rhs instanceof ViaSolicitudTransporte)) + return false; + ViaSolicitudTransporte that = (ViaSolicitudTransporte) rhs; + if (this.getPk() == null || that.getPk() == null) + return false; + return (this.getPk().equals(that.getPk())); + } + + /** + * Implementacion del metodo hashCode de la la entidad ViaSolicitudTransporte + * + * @return el hashCode la instancia + */ + @Override + public int hashCode() { + if (hashValue == 0) { + int result = 17; + if (this.getPk() == null) { + result = super.hashCode(); + } else { + result = this.getPk().hashCode(); + } + hashValue = result; + } + return hashValue; + } + + /** Implementacion toString */ + @Override + public String toString() { + Field[] fs = this.getClass().getDeclaredFields(); + String data = ""; + for (Field f : fs) { + try { + String name = f.getName(); + if (f.getType().getName().compareTo("java.util.Set") == 0) + continue; + if (name.compareTo("hashValue") == 0 || name.compareTo("serialVersionUID") == 0) + continue; + data += name + "=" + f.get(this) + ";"; + } catch (Exception e) { + continue; + } + } + if (data.compareTo("") == 0) { + data = super.toString(); + } + return data; + } + + /** Implementacion de la creacion de un bean en blanco ViaSolicitudTransporte */ + @Override + public Object createInstance() { + ViaSolicitudTransporte instance = new ViaSolicitudTransporte(); + instance.setPk(new ViaSolicitudTransporteKey()); + return instance; + } + + /** + * Clona la entidad ViaSolicitudTransporte + * + * @see com.fp.dto.hb.HibernateBean#cloneMe() + */ + @Override + public Object cloneMe() throws CloneNotSupportedException { + ViaSolicitudTransporte p = (ViaSolicitudTransporte) this.clone(); + p.setPk((ViaSolicitudTransporteKey) pk.cloneMe()); + return p; + } +} diff --git a/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudTransporteKey.java b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudTransporteKey.java new file mode 100644 index 0000000..fdf9ea8 --- /dev/null +++ b/base/persistence/pviaticos/src/main/java/com/fp/persistence/pviaticos/solicitud/ViaSolicitudTransporteKey.java @@ -0,0 +1,151 @@ +package com.fp.persistence.pviaticos.solicitud; + +import javax.persistence.Column; +import java.io.Serializable; +import com.fp.dto.hb.HibernateId; +import java.lang.reflect.Field; +import javax.persistence.Embeddable; +import javax.persistence.Transient; + +/**Clase que hace referencia a la Clave Primaria de VIA_SOL_TRANSPORTE*/ +@Embeddable +public class ViaSolicitudTransporteKey extends com.fp.dto.AbstractDataTransport implements Serializable,Cloneable,HibernateId{ +/** +* HashCode asociado con la Instancia +*/ +@Transient +private int hashValue = 0; +/** +* Version de la Clase +*/ +private static final long serialVersionUID = 1L; +@Column(name="COD_SOLICITUD", nullable=false,updatable=false) + +/** +* Numero de solicitud de viaticos +*/ +private String cod_solicitud; + +@Column(name="COD_TIPO", nullable=false,updatable=false) + +/** +* Campo para el codigo del documento +*/ +private String cod_tipo; + +@Column(name="COD_SECUENCIA", nullable=false,updatable=false) + +/** +* Secuencia interna para cada solicitud de transportes utilizados en la comision +*/ +private Integer cod_secuencia; + +/**Contructor por defecto*/ +public ViaSolicitudTransporteKey(){} +/**Contructor de ViaSolicitudTransporteKey +@param pCod_solicitud Numero de solicitud de viaticos +@param pCod_tipo Campo para el codigo del documento +@param pCod_secuencia Secuencia interna para cada solicitud de transportes utilizados en la comision +*/ +public ViaSolicitudTransporteKey(String pCod_solicitud,String pCod_tipo,Integer pCod_secuencia){ + cod_solicitud=pCod_solicitud; + cod_tipo=pCod_tipo; + cod_secuencia=pCod_secuencia; +} +/**Obtiene el valor de cod_solicitud +@return valor de cod_solicitud*/ +public String getCod_solicitud(){ + return cod_solicitud; +} +/**Fija el valor de cod_solicitud +@param pCod_solicitud nuevo Valor de cod_solicitud*/ +public void setCod_solicitud(String pCod_solicitud){ + cod_solicitud=pCod_solicitud; +} + +/**Obtiene el valor de cod_tipo +@return valor de cod_tipo*/ +public String getCod_tipo(){ + return cod_tipo; +} +/**Fija el valor de cod_tipo +@param pCod_tipo nuevo Valor de cod_tipo*/ +public void setCod_tipo(String pCod_tipo){ + cod_tipo=pCod_tipo; +} + +/**Obtiene el valor de cod_secuencia +@return valor de cod_secuencia*/ +public Integer getCod_secuencia(){ + return cod_secuencia; +} +/**Fija el valor de cod_secuencia +@param pCod_secuencia nuevo Valor de cod_secuencia*/ +public void setCod_secuencia(Integer pCod_secuencia){ + cod_secuencia=pCod_secuencia; +} + +/**Implementacion de la comparacion de ViaSolicitudTransporteKey +@param o Objeto de comparacion +*/ +public boolean equals(Object o){ + if (o == null)return false; + if (! (o instanceof ViaSolicitudTransporteKey))return false; + ViaSolicitudTransporteKey that = (ViaSolicitudTransporteKey) o; + if (this.getCod_solicitud() == null || that.getCod_solicitud() == null){ + return false; + } + if (! this.getCod_solicitud().equals(that.getCod_solicitud())){ + return false; + } + if (this.getCod_tipo() == null || that.getCod_tipo() == null){ + return false; + } + if (! this.getCod_tipo().equals(that.getCod_tipo())){ + return false; + } + if (this.getCod_secuencia() == null || that.getCod_secuencia() == null){ + return false; + } + if (! this.getCod_secuencia().equals(that.getCod_secuencia())){ + return false; + } + return true; +} +/**Implementacion del metodo hashCode bajo el patron de Bloch +@return hashCode de la instancia ViaSolicitudTransporteKey +*/ +public int hashCode(){ + if (this.hashValue == 0){ + int result = 17; + result = result * 37 + (this.getCod_solicitud() == null ? 0 : this.getCod_solicitud().hashCode()); + result = result * 37 + (this.getCod_tipo() == null ? 0 : this.getCod_tipo().hashCode()); + result = result * 37 + (this.getCod_secuencia() == null ? 0 : this.getCod_secuencia().hashCode()); + this.hashValue = result; + } + return this.hashValue; +} +public Object cloneMe() throws CloneNotSupportedException { + return this.clone(); +} +/**Implementacion toString +*/ +public String toString() { + Field[]fs=this.getClass().getDeclaredFields(); + String data=""; + for(Field f:fs){ + try{ + String name=f.getName(); + if(f.getType().getName().compareTo("java.util.Set")==0)continue; + if(name.compareTo("hashValue")==0||name.compareTo("serialVersionUID")==0)continue; + data+="pk."+name+"="+f.get(this)+";"; + }catch(Exception e){ + continue; + } + } + if(data.compareTo("")==0){ + data=super.toString(); + } + return data; + } +} diff --git a/base/persistence/pviaticos/src/test/.svn/entries b/base/persistence/pviaticos/src/test/.svn/entries new file mode 100644 index 0000000..5be6dc2 --- /dev/null +++ b/base/persistence/pviaticos/src/test/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pviaticos/src/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + diff --git a/base/persistence/pviaticos/src/test/java/.svn/entries b/base/persistence/pviaticos/src/test/java/.svn/entries new file mode 100644 index 0000000..fd1bf39 --- /dev/null +++ b/base/persistence/pviaticos/src/test/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pviaticos/src/test/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/persistence/pviaticos/src/test/java/com/.svn/entries b/base/persistence/pviaticos/src/test/java/com/.svn/entries new file mode 100644 index 0000000..3b04ad9 --- /dev/null +++ b/base/persistence/pviaticos/src/test/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pviaticos/src/test/java/com +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/persistence/pviaticos/src/test/java/com/fp/.svn/entries b/base/persistence/pviaticos/src/test/java/com/fp/.svn/entries new file mode 100644 index 0000000..820ad50 --- /dev/null +++ b/base/persistence/pviaticos/src/test/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pviaticos/src/test/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +persistence +dir + diff --git a/base/persistence/pviaticos/src/test/java/com/fp/persistence/.svn/entries b/base/persistence/pviaticos/src/test/java/com/fp/persistence/.svn/entries new file mode 100644 index 0000000..ba2e088 --- /dev/null +++ b/base/persistence/pviaticos/src/test/java/com/fp/persistence/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/pviaticos/src/test/java/com/fp/persistence +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +AppTest.java +file + + + + +2022-07-28T03:40:26.486733Z +31e1e6228ad5533c932208c702c51800 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +684 + diff --git a/base/persistence/pviaticos/src/test/java/com/fp/persistence/.svn/text-base/AppTest.java.svn-base b/base/persistence/pviaticos/src/test/java/com/fp/persistence/.svn/text-base/AppTest.java.svn-base new file mode 100644 index 0000000..2478b52 --- /dev/null +++ b/base/persistence/pviaticos/src/test/java/com/fp/persistence/.svn/text-base/AppTest.java.svn-base @@ -0,0 +1,38 @@ +package com.fp.persistence; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/base/persistence/pviaticos/src/test/java/com/fp/persistence/AppTest.java b/base/persistence/pviaticos/src/test/java/com/fp/persistence/AppTest.java new file mode 100644 index 0000000..2478b52 --- /dev/null +++ b/base/persistence/pviaticos/src/test/java/com/fp/persistence/AppTest.java @@ -0,0 +1,38 @@ +package com.fp.persistence; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/hra/Empleado.class b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/hra/Empleado.class new file mode 100644 index 0000000..e9325e9 Binary files /dev/null and b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/hra/Empleado.class differ diff --git a/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/hra/EmpleadoJpql.class b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/hra/EmpleadoJpql.class new file mode 100644 index 0000000..5b18e47 Binary files /dev/null and b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/hra/EmpleadoJpql.class differ diff --git a/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/param/ViaCiudadUsuario.class b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/param/ViaCiudadUsuario.class new file mode 100644 index 0000000..0fbc21b Binary files /dev/null and b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/param/ViaCiudadUsuario.class differ diff --git a/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/param/ViaCiudadUsuarioKey.class b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/param/ViaCiudadUsuarioKey.class new file mode 100644 index 0000000..5632f7d Binary files /dev/null and b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/param/ViaCiudadUsuarioKey.class differ diff --git a/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/param/ViaDiasAcumulados.class b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/param/ViaDiasAcumulados.class new file mode 100644 index 0000000..9305bf3 Binary files /dev/null and b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/param/ViaDiasAcumulados.class differ diff --git a/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/param/ViaDiasAcumuladosKey.class b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/param/ViaDiasAcumuladosKey.class new file mode 100644 index 0000000..688120f Binary files /dev/null and b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/param/ViaDiasAcumuladosKey.class differ diff --git a/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/param/ViaEstado.class b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/param/ViaEstado.class new file mode 100644 index 0000000..4dbe552 Binary files /dev/null and b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/param/ViaEstado.class differ diff --git a/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/param/ViaNotificacionMovilizacion.class b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/param/ViaNotificacionMovilizacion.class new file mode 100644 index 0000000..28af42e Binary files /dev/null and b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/param/ViaNotificacionMovilizacion.class differ diff --git a/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/param/ViaParametros.class b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/param/ViaParametros.class new file mode 100644 index 0000000..7de77b6 Binary files /dev/null and b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/param/ViaParametros.class differ diff --git a/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitud.class b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitud.class new file mode 100644 index 0000000..75b7e97 Binary files /dev/null and b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitud.class differ diff --git a/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudComentarios.class b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudComentarios.class new file mode 100644 index 0000000..28bc487 Binary files /dev/null and b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudComentarios.class differ diff --git a/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudComentariosKey.class b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudComentariosKey.class new file mode 100644 index 0000000..5643b18 Binary files /dev/null and b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudComentariosKey.class differ diff --git a/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudIntegrantes.class b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudIntegrantes.class new file mode 100644 index 0000000..7a2c13f Binary files /dev/null and b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudIntegrantes.class differ diff --git a/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudIntegrantesKey.class b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudIntegrantesKey.class new file mode 100644 index 0000000..b6d7033 Binary files /dev/null and b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudIntegrantesKey.class differ diff --git a/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudKey.class b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudKey.class new file mode 100644 index 0000000..dd75f02 Binary files /dev/null and b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudKey.class differ diff --git a/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudLiquidacion.class b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudLiquidacion.class new file mode 100644 index 0000000..220fcab Binary files /dev/null and b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudLiquidacion.class differ diff --git a/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudLiquidacionKey.class b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudLiquidacionKey.class new file mode 100644 index 0000000..156c1fe Binary files /dev/null and b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudLiquidacionKey.class differ diff --git a/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudTransporte.class b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudTransporte.class new file mode 100644 index 0000000..175455e Binary files /dev/null and b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudTransporte.class differ diff --git a/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudTransporteKey.class b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudTransporteKey.class new file mode 100644 index 0000000..ea0cd2f Binary files /dev/null and b/base/persistence/pviaticos/target/classes/com/fp/persistence/pviaticos/solicitud/ViaSolicitudTransporteKey.class differ diff --git a/base/persistence/pviaticos/target/maven-archiver/pom.properties b/base/persistence/pviaticos/target/maven-archiver/pom.properties new file mode 100644 index 0000000..690cdb5 --- /dev/null +++ b/base/persistence/pviaticos/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:53:03 ECT 2022 +version=2.1 +groupId=com.fp.base.persistence +artifactId=pviaticos diff --git a/base/persistence/pviaticos/target/pviaticos-2.1.jar b/base/persistence/pviaticos/target/pviaticos-2.1.jar new file mode 100644 index 0000000..ea2bd11 Binary files /dev/null and b/base/persistence/pviaticos/target/pviaticos-2.1.jar differ diff --git a/base/persistence/util/.svn/dir-prop-base b/base/persistence/util/.svn/dir-prop-base new file mode 100644 index 0000000..3e2a6f2 --- /dev/null +++ b/base/persistence/util/.svn/dir-prop-base @@ -0,0 +1,9 @@ +K 10 +svn:ignore +V 37 +.classpath +.project +.settings +target + +END diff --git a/base/persistence/util/.svn/entries b/base/persistence/util/.svn/entries new file mode 100644 index 0000000..1fe83c2 --- /dev/null +++ b/base/persistence/util/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/util +svn://172.17.26.185/COMACO + + + +2014-10-17T05:34:35.839741Z +1670 +jvaca +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:31.583755Z +9ec07cb41b9cc129434013ed5dde8b39 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +946 + diff --git a/base/persistence/util/.svn/text-base/pom.xml.svn-base b/base/persistence/util/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..efe6a73 --- /dev/null +++ b/base/persistence/util/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,31 @@ + + + 4.0.0 + + persistence + com.fp.base + 2.1 + + com.fp.base.persistence + util + util + + + + com.fp.base.persistence + pgeneral + 2.1 + + + com.fp.base.persistence + pcustomer + 2.1 + + + com.fp.base.persistence + commondb + 2.1 + + + diff --git a/base/persistence/util/pom.xml b/base/persistence/util/pom.xml new file mode 100644 index 0000000..efe6a73 --- /dev/null +++ b/base/persistence/util/pom.xml @@ -0,0 +1,31 @@ + + + 4.0.0 + + persistence + com.fp.base + 2.1 + + com.fp.base.persistence + util + util + + + + com.fp.base.persistence + pgeneral + 2.1 + + + com.fp.base.persistence + pcustomer + 2.1 + + + com.fp.base.persistence + commondb + 2.1 + + + diff --git a/base/persistence/util/src/.svn/entries b/base/persistence/util/src/.svn/entries new file mode 100644 index 0000000..75bb928 --- /dev/null +++ b/base/persistence/util/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/util/src +svn://172.17.26.185/COMACO + + + +2014-09-11T11:45:32.157821Z +689 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/base/persistence/util/src/main/.svn/entries b/base/persistence/util/src/main/.svn/entries new file mode 100644 index 0000000..7cd968f --- /dev/null +++ b/base/persistence/util/src/main/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/util/src/main +svn://172.17.26.185/COMACO + + + +2014-09-11T11:45:32.157821Z +689 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + diff --git a/base/persistence/util/src/main/java/.svn/entries b/base/persistence/util/src/main/java/.svn/entries new file mode 100644 index 0000000..e5bf0e6 --- /dev/null +++ b/base/persistence/util/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/util/src/main/java +svn://172.17.26.185/COMACO + + + +2014-09-11T11:45:32.157821Z +689 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/persistence/util/src/main/java/com/.svn/entries b/base/persistence/util/src/main/java/com/.svn/entries new file mode 100644 index 0000000..45a7e5a --- /dev/null +++ b/base/persistence/util/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/util/src/main/java/com +svn://172.17.26.185/COMACO + + + +2014-09-11T11:45:32.157821Z +689 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/persistence/util/src/main/java/com/fp/.svn/entries b/base/persistence/util/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..022e1f3 --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/util/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-09-11T11:45:32.157821Z +689 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +base +dir + diff --git a/base/persistence/util/src/main/java/com/fp/base/.svn/entries b/base/persistence/util/src/main/java/com/fp/base/.svn/entries new file mode 100644 index 0000000..ac32cbe --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/util/src/main/java/com/fp/base +svn://172.17.26.185/COMACO + + + +2014-09-11T11:45:32.157821Z +689 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +persistence +dir + diff --git a/base/persistence/util/src/main/java/com/fp/base/persistence/.svn/entries b/base/persistence/util/src/main/java/com/fp/base/persistence/.svn/entries new file mode 100644 index 0000000..7788b90 --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/persistence/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/util/src/main/java/com/fp/base/persistence +svn://172.17.26.185/COMACO + + + +2014-09-11T11:45:32.157821Z +689 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +util +dir + diff --git a/base/persistence/util/src/main/java/com/fp/base/persistence/util/.svn/entries b/base/persistence/util/src/main/java/com/fp/base/persistence/util/.svn/entries new file mode 100644 index 0000000..a4f3e3f --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/persistence/util/.svn/entries @@ -0,0 +1,40 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/util/src/main/java/com/fp/base/persistence/util +svn://172.17.26.185/COMACO + + + +2014-09-11T11:45:32.157821Z +689 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +helper +dir + +db +dir + +formula +dir + +job +dir + diff --git a/base/persistence/util/src/main/java/com/fp/base/persistence/util/db/.svn/entries b/base/persistence/util/src/main/java/com/fp/base/persistence/util/db/.svn/entries new file mode 100644 index 0000000..77716cd --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/persistence/util/db/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/util/src/main/java/com/fp/base/persistence/util/db +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +DataHelper.java +file + + + + +2022-07-28T03:40:31.102753Z +329f14e4510036a1b29b8467fba01a14 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8969 + diff --git a/base/persistence/util/src/main/java/com/fp/base/persistence/util/db/.svn/text-base/DataHelper.java.svn-base b/base/persistence/util/src/main/java/com/fp/base/persistence/util/db/.svn/text-base/DataHelper.java.svn-base new file mode 100644 index 0000000..056f2f1 --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/persistence/util/db/.svn/text-base/DataHelper.java.svn-base @@ -0,0 +1,210 @@ +package com.fp.base.persistence.util.db; + +import java.util.Map; + +import com.fp.core.exception.CoreException; +import com.fp.persistence.commondb.HqlStatement; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.cache.CacheManager; +import com.fp.persistence.pgeneral.gene.TgeneCreditType; +import com.fp.persistence.pgeneral.gene.TgeneCurrency; +import com.fp.persistence.pgeneral.gene.TgeneFrequency; +import com.fp.persistence.pgeneral.installment.TgeneInstallmentType; +import com.fp.persistence.pgeneral.safe.TsafeUser; +import com.fp.persistence.pgeneral.trans.TgeneTransactionItem; + +/** + * Clase que se encarga de manejo de sentencias SQL o HQL con la base de datos, Existe ciertas tablas con informacion + * estatica, las cuales se cargan a memoria.
+ * Otras tablas se define para que se cargue a cache la informacion de ciertos regitros que esten marcados con + * ManageCache. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class DataHelper { + /** Almacena una instancia de DataHelper. */ + private static DataHelper cache; + + /** + * Entrega una instancia de DataHelper. + * + * @return DataHelper + */ + public static DataHelper getInstance() { + if (DataHelper.cache != null) { + return DataHelper.cache; + } + synchronized (DataHelper.class) { + if (DataHelper.cache == null) { + DataHelper.cache = new DataHelper(); + } + } + return DataHelper.cache; + } + + private static final String VMODULECODE = "modulecode"; + + /** Sentencia que devuelve un registro de TgeneCreditType. */ + private static final String HQL_CREDIT_TYPE = "from TgeneCreditType t " + " where t.pk = :credittypecode "; + + /** + * Metodo que entrega la definicion de TgeneCreditType. + * + * @param pCreditType Codigo de tipo de credito a obtener datos. + * @return TgeneCreditType + * @throws Exception + */ + public TgeneCreditType getTgeneCreditType(String pCreditType) throws Exception { + TgeneCreditType tgeneCreditType = null; + CacheManager cm = CacheManager.getInstance(); + tgeneCreditType = (TgeneCreditType) cm.getData("TgeneCreditType", pCreditType); + if (tgeneCreditType == null) { + HqlStatement hql = new HqlStatement(); + hql.setSentence(DataHelper.HQL_CREDIT_TYPE); + hql.setString("credittypecode", pCreditType); + tgeneCreditType = (TgeneCreditType) hql.getObject(); + Map m = cm.getMapDefinition("TgeneCreditType"); + m.put(pCreditType, tgeneCreditType); + cm.putData("TgeneCreditType", m); + } + return tgeneCreditType; + } + + /** Sentencia que devuelve un registro de TgeneInstallmentType. */ + private static final String HQL_INSTALLMENT_TYPE = "from TgeneInstallmentType t " + " where t.pk.installmenttype = :installmenttype " + + " and t.pk.modulecode = :modulecode "; + + /** + * Metodo que entrega la definicion de TgeneInstallmentType + * + * @param TgeneInstallmentType Codigo de tipo de tabla de amortizacion. + * @return TgeneInstallmentType + * @throws Exception + */ + public TgeneInstallmentType getTgeneInstallmentType(String pInstallmentType, String pModule) throws Exception { + String key = pInstallmentType + pModule; + TgeneInstallmentType tgeneInstallmentType = null; + CacheManager cm = CacheManager.getInstance(); + tgeneInstallmentType = (TgeneInstallmentType) cm.getData("TgeneInstallmentType", key); + if (tgeneInstallmentType == null) { + HqlStatement hql = new HqlStatement(); + hql.setSentence(DataHelper.HQL_INSTALLMENT_TYPE); + hql.setString("installmenttype", pInstallmentType); + hql.setString(DataHelper.VMODULECODE, pModule); + hql.setReadonly(true); + tgeneInstallmentType = (TgeneInstallmentType) hql.getObject(); + if (tgeneInstallmentType == null) { + throw new CoreException("CORE-0022", "TIPO TABLA DE AMORTIZACION NO DEFINIDA EN TGENEINSTALLMENTTYPE :{0}", pInstallmentType); + } + + Map m = cm.getMapDefinition("TgeneInstallmentType"); + m.put(key, tgeneInstallmentType); + cm.putData("TgeneInstallmentType", m); + } + return tgeneInstallmentType; + } + + /** Sentencia que devuelve un registro de TgeneFrequency. */ + private static final String HQL_FREQUENCY = "from TgeneFrequency t " + " where t.pk = :frequencycode "; + + /** + * Metodo que entrega la definicion de TgeneFrequency + * + * @param pFrequencyCode Codigo de frecuenia a obtener su definicion. + * @return TgeneFrequency + * @throws Exception + */ + public TgeneFrequency getTgeneFrecuency(Integer pFrequencyCode) throws Exception { + TgeneFrequency tgeneFrequency = null; + String key = "" + pFrequencyCode; + CacheManager cm = CacheManager.getInstance(); + tgeneFrequency = (TgeneFrequency) cm.getData("TgeneFrequency", key); + if (tgeneFrequency == null) { + HqlStatement hql = new HqlStatement(); + hql.setSentence(DataHelper.HQL_FREQUENCY); + hql.setInteger("frequencycode", pFrequencyCode); + hql.setReadonly(true); + tgeneFrequency = (TgeneFrequency) hql.getObject(); + if (tgeneFrequency == null) { + throw new CoreException("CORE-0015", "FRECUENCIA NO DEFINIDA EN TGENEFREQUENCY FRQCODE:{0}", pFrequencyCode); + } + Map m = cm.getMapDefinition("TgeneFrequency"); + m.put(key, tgeneFrequency); + cm.putData("TgeneFrequency", m); + } + return tgeneFrequency; + } + + /** + * Entrega un objeto con los datos de TsafeUser. Que contiene datos de un usuario. + * + * @param pUserCode Codigo de usuario a obtener un registro. + * @return TsafeUser + * @throws CoreException + * @throws Exception + */ + public TsafeUser getTsafeUser(String pUserCode) throws CoreException, Exception { + TsafeUser tsafeUser = TsafeUser.find(PersistenceHelper.getEntityManager(), pUserCode); + if (tsafeUser == null) { + throw new CoreException("CORE-0032", "USUARIO {0} NO DEFINIDO EN TSAFEUSER", pUserCode); + } + if (tsafeUser.getInternalcode() == null) { + throw new CoreException("CORE-0033", "CODIGO USUARIO INTERNO NO DEFINIDO EN TSAFEUSER USERCODE: {0}", pUserCode); + } + return tsafeUser; + } + + /** + * Entrega un registro de tgenecurrency. + * + * @param pCurrency Codigo de moneda a obtener un registro de la base de datos. + * @return TgeneCurrency + * @throws Exception + */ + public TgeneCurrency getTgeneCurrency(String pCurrency) throws Exception { + TgeneCurrency tgeneCurrency = null; + CacheManager cm = CacheManager.getInstance(); + tgeneCurrency = (TgeneCurrency) cm.getData("TgeneCurrency", pCurrency); + if (tgeneCurrency == null) { + tgeneCurrency = TgeneCurrency.find(PersistenceHelper.getEntityManager(), pCurrency); + if (tgeneCurrency == null) { + throw new CoreException("CORE-0017", "MONEDA {0} NO DEFINIDA EN TGENECURRENCY ", pCurrency); + } + Map m = cm.getMapDefinition("TgeneCurrency"); + m.put(pCurrency, tgeneCurrency); + cm.putData("TgeneCurrency", m); + } + return tgeneCurrency; + } + + /** + * Sentecia que devuelve el rubro de una transaccion + */ + private static final String HQL_TRANSACTION_ITEMCODE = "from TgeneTransactionItem tt " + " where tt.pk.transactionmodule = :transactionmodule" + + " and tt.pk.transactioncode = :transactioncode" + " and tt.pk.transactionversion = :transactionversion" + + " and tt.pk.itemcode = :itemcode"; + + /** + * Metodo que retorna el rubro de una transaccion + * + * @param transactionmodule Modulo de la transaccion + * @param transactioncode Codigo de la transaccion + * @param transactionversion Version de la transaccion + * @param itemcode Rubro de la transaccion + * @return + * @throws Exception + */ + public TgeneTransactionItem getTgeneTransactionItem(String transactionmodule, Integer transactioncode, Integer transactionversion, + Integer itemcode) throws Exception { + TgeneTransactionItem tgeneTransactionItem = null; + HqlStatement hql = new HqlStatement(DataHelper.HQL_TRANSACTION_ITEMCODE); + hql.setString("transactionmodule", transactionmodule); + hql.setInteger("transactioncode", transactioncode); + hql.setInteger("transactionversion", transactionversion); + hql.setInteger("itemcode", itemcode); + tgeneTransactionItem = (TgeneTransactionItem) hql.getObject(); + return tgeneTransactionItem; + } + +} diff --git a/base/persistence/util/src/main/java/com/fp/base/persistence/util/db/DataHelper.java b/base/persistence/util/src/main/java/com/fp/base/persistence/util/db/DataHelper.java new file mode 100644 index 0000000..056f2f1 --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/persistence/util/db/DataHelper.java @@ -0,0 +1,210 @@ +package com.fp.base.persistence.util.db; + +import java.util.Map; + +import com.fp.core.exception.CoreException; +import com.fp.persistence.commondb.HqlStatement; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.cache.CacheManager; +import com.fp.persistence.pgeneral.gene.TgeneCreditType; +import com.fp.persistence.pgeneral.gene.TgeneCurrency; +import com.fp.persistence.pgeneral.gene.TgeneFrequency; +import com.fp.persistence.pgeneral.installment.TgeneInstallmentType; +import com.fp.persistence.pgeneral.safe.TsafeUser; +import com.fp.persistence.pgeneral.trans.TgeneTransactionItem; + +/** + * Clase que se encarga de manejo de sentencias SQL o HQL con la base de datos, Existe ciertas tablas con informacion + * estatica, las cuales se cargan a memoria.
+ * Otras tablas se define para que se cargue a cache la informacion de ciertos regitros que esten marcados con + * ManageCache. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class DataHelper { + /** Almacena una instancia de DataHelper. */ + private static DataHelper cache; + + /** + * Entrega una instancia de DataHelper. + * + * @return DataHelper + */ + public static DataHelper getInstance() { + if (DataHelper.cache != null) { + return DataHelper.cache; + } + synchronized (DataHelper.class) { + if (DataHelper.cache == null) { + DataHelper.cache = new DataHelper(); + } + } + return DataHelper.cache; + } + + private static final String VMODULECODE = "modulecode"; + + /** Sentencia que devuelve un registro de TgeneCreditType. */ + private static final String HQL_CREDIT_TYPE = "from TgeneCreditType t " + " where t.pk = :credittypecode "; + + /** + * Metodo que entrega la definicion de TgeneCreditType. + * + * @param pCreditType Codigo de tipo de credito a obtener datos. + * @return TgeneCreditType + * @throws Exception + */ + public TgeneCreditType getTgeneCreditType(String pCreditType) throws Exception { + TgeneCreditType tgeneCreditType = null; + CacheManager cm = CacheManager.getInstance(); + tgeneCreditType = (TgeneCreditType) cm.getData("TgeneCreditType", pCreditType); + if (tgeneCreditType == null) { + HqlStatement hql = new HqlStatement(); + hql.setSentence(DataHelper.HQL_CREDIT_TYPE); + hql.setString("credittypecode", pCreditType); + tgeneCreditType = (TgeneCreditType) hql.getObject(); + Map m = cm.getMapDefinition("TgeneCreditType"); + m.put(pCreditType, tgeneCreditType); + cm.putData("TgeneCreditType", m); + } + return tgeneCreditType; + } + + /** Sentencia que devuelve un registro de TgeneInstallmentType. */ + private static final String HQL_INSTALLMENT_TYPE = "from TgeneInstallmentType t " + " where t.pk.installmenttype = :installmenttype " + + " and t.pk.modulecode = :modulecode "; + + /** + * Metodo que entrega la definicion de TgeneInstallmentType + * + * @param TgeneInstallmentType Codigo de tipo de tabla de amortizacion. + * @return TgeneInstallmentType + * @throws Exception + */ + public TgeneInstallmentType getTgeneInstallmentType(String pInstallmentType, String pModule) throws Exception { + String key = pInstallmentType + pModule; + TgeneInstallmentType tgeneInstallmentType = null; + CacheManager cm = CacheManager.getInstance(); + tgeneInstallmentType = (TgeneInstallmentType) cm.getData("TgeneInstallmentType", key); + if (tgeneInstallmentType == null) { + HqlStatement hql = new HqlStatement(); + hql.setSentence(DataHelper.HQL_INSTALLMENT_TYPE); + hql.setString("installmenttype", pInstallmentType); + hql.setString(DataHelper.VMODULECODE, pModule); + hql.setReadonly(true); + tgeneInstallmentType = (TgeneInstallmentType) hql.getObject(); + if (tgeneInstallmentType == null) { + throw new CoreException("CORE-0022", "TIPO TABLA DE AMORTIZACION NO DEFINIDA EN TGENEINSTALLMENTTYPE :{0}", pInstallmentType); + } + + Map m = cm.getMapDefinition("TgeneInstallmentType"); + m.put(key, tgeneInstallmentType); + cm.putData("TgeneInstallmentType", m); + } + return tgeneInstallmentType; + } + + /** Sentencia que devuelve un registro de TgeneFrequency. */ + private static final String HQL_FREQUENCY = "from TgeneFrequency t " + " where t.pk = :frequencycode "; + + /** + * Metodo que entrega la definicion de TgeneFrequency + * + * @param pFrequencyCode Codigo de frecuenia a obtener su definicion. + * @return TgeneFrequency + * @throws Exception + */ + public TgeneFrequency getTgeneFrecuency(Integer pFrequencyCode) throws Exception { + TgeneFrequency tgeneFrequency = null; + String key = "" + pFrequencyCode; + CacheManager cm = CacheManager.getInstance(); + tgeneFrequency = (TgeneFrequency) cm.getData("TgeneFrequency", key); + if (tgeneFrequency == null) { + HqlStatement hql = new HqlStatement(); + hql.setSentence(DataHelper.HQL_FREQUENCY); + hql.setInteger("frequencycode", pFrequencyCode); + hql.setReadonly(true); + tgeneFrequency = (TgeneFrequency) hql.getObject(); + if (tgeneFrequency == null) { + throw new CoreException("CORE-0015", "FRECUENCIA NO DEFINIDA EN TGENEFREQUENCY FRQCODE:{0}", pFrequencyCode); + } + Map m = cm.getMapDefinition("TgeneFrequency"); + m.put(key, tgeneFrequency); + cm.putData("TgeneFrequency", m); + } + return tgeneFrequency; + } + + /** + * Entrega un objeto con los datos de TsafeUser. Que contiene datos de un usuario. + * + * @param pUserCode Codigo de usuario a obtener un registro. + * @return TsafeUser + * @throws CoreException + * @throws Exception + */ + public TsafeUser getTsafeUser(String pUserCode) throws CoreException, Exception { + TsafeUser tsafeUser = TsafeUser.find(PersistenceHelper.getEntityManager(), pUserCode); + if (tsafeUser == null) { + throw new CoreException("CORE-0032", "USUARIO {0} NO DEFINIDO EN TSAFEUSER", pUserCode); + } + if (tsafeUser.getInternalcode() == null) { + throw new CoreException("CORE-0033", "CODIGO USUARIO INTERNO NO DEFINIDO EN TSAFEUSER USERCODE: {0}", pUserCode); + } + return tsafeUser; + } + + /** + * Entrega un registro de tgenecurrency. + * + * @param pCurrency Codigo de moneda a obtener un registro de la base de datos. + * @return TgeneCurrency + * @throws Exception + */ + public TgeneCurrency getTgeneCurrency(String pCurrency) throws Exception { + TgeneCurrency tgeneCurrency = null; + CacheManager cm = CacheManager.getInstance(); + tgeneCurrency = (TgeneCurrency) cm.getData("TgeneCurrency", pCurrency); + if (tgeneCurrency == null) { + tgeneCurrency = TgeneCurrency.find(PersistenceHelper.getEntityManager(), pCurrency); + if (tgeneCurrency == null) { + throw new CoreException("CORE-0017", "MONEDA {0} NO DEFINIDA EN TGENECURRENCY ", pCurrency); + } + Map m = cm.getMapDefinition("TgeneCurrency"); + m.put(pCurrency, tgeneCurrency); + cm.putData("TgeneCurrency", m); + } + return tgeneCurrency; + } + + /** + * Sentecia que devuelve el rubro de una transaccion + */ + private static final String HQL_TRANSACTION_ITEMCODE = "from TgeneTransactionItem tt " + " where tt.pk.transactionmodule = :transactionmodule" + + " and tt.pk.transactioncode = :transactioncode" + " and tt.pk.transactionversion = :transactionversion" + + " and tt.pk.itemcode = :itemcode"; + + /** + * Metodo que retorna el rubro de una transaccion + * + * @param transactionmodule Modulo de la transaccion + * @param transactioncode Codigo de la transaccion + * @param transactionversion Version de la transaccion + * @param itemcode Rubro de la transaccion + * @return + * @throws Exception + */ + public TgeneTransactionItem getTgeneTransactionItem(String transactionmodule, Integer transactioncode, Integer transactionversion, + Integer itemcode) throws Exception { + TgeneTransactionItem tgeneTransactionItem = null; + HqlStatement hql = new HqlStatement(DataHelper.HQL_TRANSACTION_ITEMCODE); + hql.setString("transactionmodule", transactionmodule); + hql.setInteger("transactioncode", transactioncode); + hql.setInteger("transactionversion", transactionversion); + hql.setInteger("itemcode", itemcode); + tgeneTransactionItem = (TgeneTransactionItem) hql.getObject(); + return tgeneTransactionItem; + } + +} diff --git a/base/persistence/util/src/main/java/com/fp/base/persistence/util/formula/.svn/entries b/base/persistence/util/src/main/java/com/fp/base/persistence/util/formula/.svn/entries new file mode 100644 index 0000000..10bc602 --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/persistence/util/formula/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/util/src/main/java/com/fp/base/persistence/util/formula +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +FormulaManager.java +file + + + + +2022-07-28T03:40:31.148753Z +ec0c175b04e488da6986dc41f107c89c +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +988 + +package-info.java +file + + + + +2022-07-28T03:40:31.148753Z +14f0d0792c3d6232182bd3722e0a3f16 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +78 + diff --git a/base/persistence/util/src/main/java/com/fp/base/persistence/util/formula/.svn/text-base/FormulaManager.java.svn-base b/base/persistence/util/src/main/java/com/fp/base/persistence/util/formula/.svn/text-base/FormulaManager.java.svn-base new file mode 100644 index 0000000..5c552f0 --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/persistence/util/formula/.svn/text-base/FormulaManager.java.svn-base @@ -0,0 +1,32 @@ +package com.fp.base.persistence.util.formula; + +import java.util.List; + +import javax.persistence.Query; + +import org.nfunk.jep.function.PostfixMathCommand; + +import com.fp.common.formula.FormulaEvaluator; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.gene.TgeneFunctions; + +public class FormulaManager { + private FormulaEvaluator fe; + + public FormulaManager() throws Exception { + this.fe = new FormulaEvaluator(); + this.addMaiaFunctions(); + } + + private void addMaiaFunctions() throws Exception { + Query qry = PersistenceHelper.createQuery("from com.fp.persistence.pgeneral.gene.TgeneFunctions p where p.active='Y'"); + List lF = qry.getResultList(); + for (TgeneFunctions f : lF) { + this.fe.setFunction(f.getPk(), (PostfixMathCommand) Class.forName(f.getClassname()).newInstance()); + } + } + + public FormulaEvaluator getEvaluator() { + return this.fe; + } +} diff --git a/base/persistence/util/src/main/java/com/fp/base/persistence/util/formula/.svn/text-base/package-info.java.svn-base b/base/persistence/util/src/main/java/com/fp/base/persistence/util/formula/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..2a769e8 --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/persistence/util/formula/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,4 @@ +/** + * Manejador de Formulas + */ +package com.fp.base.persistence.util.formula; \ No newline at end of file diff --git a/base/persistence/util/src/main/java/com/fp/base/persistence/util/formula/FormulaManager.java b/base/persistence/util/src/main/java/com/fp/base/persistence/util/formula/FormulaManager.java new file mode 100644 index 0000000..5c552f0 --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/persistence/util/formula/FormulaManager.java @@ -0,0 +1,32 @@ +package com.fp.base.persistence.util.formula; + +import java.util.List; + +import javax.persistence.Query; + +import org.nfunk.jep.function.PostfixMathCommand; + +import com.fp.common.formula.FormulaEvaluator; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.gene.TgeneFunctions; + +public class FormulaManager { + private FormulaEvaluator fe; + + public FormulaManager() throws Exception { + this.fe = new FormulaEvaluator(); + this.addMaiaFunctions(); + } + + private void addMaiaFunctions() throws Exception { + Query qry = PersistenceHelper.createQuery("from com.fp.persistence.pgeneral.gene.TgeneFunctions p where p.active='Y'"); + List lF = qry.getResultList(); + for (TgeneFunctions f : lF) { + this.fe.setFunction(f.getPk(), (PostfixMathCommand) Class.forName(f.getClassname()).newInstance()); + } + } + + public FormulaEvaluator getEvaluator() { + return this.fe; + } +} diff --git a/base/persistence/util/src/main/java/com/fp/base/persistence/util/formula/package-info.java b/base/persistence/util/src/main/java/com/fp/base/persistence/util/formula/package-info.java new file mode 100644 index 0000000..2a769e8 --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/persistence/util/formula/package-info.java @@ -0,0 +1,4 @@ +/** + * Manejador de Formulas + */ +package com.fp.base.persistence.util.formula; \ No newline at end of file diff --git a/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/.svn/entries b/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/.svn/entries new file mode 100644 index 0000000..3eb442c --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/.svn/entries @@ -0,0 +1,164 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +MessageManager.java +file + + + + +2022-07-28T03:40:31.064753Z +b40535a3ab1e3897160d0d4cea02e8ca +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1827 + +SaveBeanInOtherSession.java +file + + + + +2022-07-28T03:40:31.064753Z +ea71b0943ce48393c115d1459fcb75c9 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1809 + +GeneralDescriptions.java +file + + + + +2022-07-28T03:40:31.065753Z +39d618dcd5756abf39fab197651a83fa +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +13500 + +MessageDescriptions.java +file + + + + +2022-07-28T03:40:31.065753Z +e141d617f82b69d36bd8cbcefe65159e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +565 + diff --git a/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/.svn/text-base/GeneralDescriptions.java.svn-base b/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/.svn/text-base/GeneralDescriptions.java.svn-base new file mode 100644 index 0000000..bf44be3 --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/.svn/text-base/GeneralDescriptions.java.svn-base @@ -0,0 +1,350 @@ +package com.fp.base.persistence.util.helper; + +import com.fp.base.persistence.util.db.DataHelper; +import com.fp.common.helper.Constant; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.acco.TgeneAccount; +import com.fp.persistence.pgeneral.acco.TgeneAccountKey; +import com.fp.persistence.pgeneral.acco.TgeneAccountStatus; +import com.fp.persistence.pgeneral.acco.TgeneAccountStatusKey; +import com.fp.persistence.pgeneral.gene.*; +import com.fp.persistence.pgeneral.installment.TgeneInstallmentType; +import com.fp.persistence.pgeneral.product.TgeneModule; +import com.fp.persistence.pgeneral.product.TgeneProduct; +import com.fp.persistence.pgeneral.product.TgeneSubProduct; +import com.fp.persistence.pgeneral.safe.TsafeUser; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; +import com.fp.persistence.pgeneral.trans.TgeneTransactionItem; + +/** + * Clase utilitaria que entrega las descripciones generales, de productos, monedas, tipos de credito, adicionalmente + * completa descripciones en tgeneaccount, tgenesolicitude. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class GeneralDescriptions { + + /** + * Metodo que completa descripciones de cuenta. + * + * @param pTgeneAccount Datos generales de la cuenta. + * @throws Exception + */ + public static void completeAccountDescriptions(TgeneAccount pTgeneAccount) throws Exception { + pTgeneAccount.addAddtionalInfo("moduledesc", GeneralDescriptions.getModuledesc(pTgeneAccount.getModulecode())); + pTgeneAccount.addAddtionalInfo("productdesc", + GeneralDescriptions.getProductdesc(pTgeneAccount.getModulecode(), pTgeneAccount.getProductcode())); + pTgeneAccount.addAddtionalInfo( + "subproductdesc", + GeneralDescriptions.getSubProductdesc(pTgeneAccount.getModulecode(), pTgeneAccount.getProductcode(), + pTgeneAccount.getSubproductcode())); + pTgeneAccount.addAddtionalInfo("currencydesc", GeneralDescriptions.getCurrencydesc(pTgeneAccount.getCurrencycode())); + pTgeneAccount.addAddtionalInfo("statusdesc", + GeneralDescriptions.getStatusdesc(pTgeneAccount.getModulecode(), pTgeneAccount.getAccountstatuscode())); + } + + /** + * Metodo que completa descripciones de uan solicitud. + * + * @param pTgeneSolicitude Datos generales de una solicitud. + * @throws Exception + */ + public static void completeSolicitudeDescriptions(TgeneSolicitude pTgeneSolicitude) throws Exception { + pTgeneSolicitude.addAddtionalInfo("moduledesc", GeneralDescriptions.getModuledesc(pTgeneSolicitude.getModulecode())); + pTgeneSolicitude.addAddtionalInfo("productdesc", + GeneralDescriptions.getProductdesc(pTgeneSolicitude.getModulecode(), pTgeneSolicitude.getProductcode())); + pTgeneSolicitude.addAddtionalInfo( + "subproductdesc", + GeneralDescriptions.getSubProductdesc(pTgeneSolicitude.getModulecode(), pTgeneSolicitude.getProductcode(), + pTgeneSolicitude.getSubproductcode())); + pTgeneSolicitude.addAddtionalInfo("currencydesc", GeneralDescriptions.getCurrencydesc(pTgeneSolicitude.getCurrencycode())); + } + + /** + * Metodo que entrega la descripcion del detalle de catalogo. + * + * @param pCatalog Codigo de tiposobregiro, base de calculo, destiono de fondos etc. + * @param pCatalogcode Codigo de catalogo. + * @return String. + * @throws Exception + */ + public static String getCatalogdetaildesc(String pCatalog, String pCatalogcode) throws Exception { + TgeneCatalogDetail detail = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneCatalogDetail(pCatalog, pCatalogcode); + return detail.getDescription(); + } + + /** + * Metodo que entrega la descripcion de tipo de credito. + * + * @param pCredittype Codigo de tipo de credito. + * @return String. + * @throws Exception + */ + public static String getCredittypedesc(String pCredittype) throws Exception { + if (pCredittype == null) { + return ""; + } + TgeneCreditType ctype = DataHelper.getInstance().getTgeneCreditType(pCredittype); + return ctype.getDescription(); + } + + /** + * Metodo que entrega la descripcion del tipo de tabla de amortizacion. + * + * @param pInstallmenttype Codigo de tipo de tabla de amortizacion. + * @return String. + * @throws Exception + */ + public static String getInstallmettypedesc(String pInstallmenttype, String pModule) throws Exception { + if (pInstallmenttype == null) { + return ""; + } + TgeneInstallmentType itype = DataHelper.getInstance().getTgeneInstallmentType(pInstallmenttype, pModule); + return itype.getDescription(); + } + + /** + * Metodo que entrega la descripcion de la frequencia. + * + * @param pFrequencycode Codigo de frequencia. + * @return String. + * @throws Exception + */ + public static String getFrequencydesc(Integer pFrequencycode) throws Exception { + if (pFrequencycode == null) { + return ""; + } + TgeneFrequency frequency = DataHelper.getInstance().getTgeneFrecuency(pFrequencycode); + return frequency.getDescription(); + } + + /** + * Metodo que entrega el nombre del oficial de cuenta. + * + * @param pUser Codigo de usuario. + * @return String. + * @throws Exception + */ + public static String getOfficername(String pUser) throws Exception { + if (pUser == null) { + return ""; + } + TsafeUser user = DataHelper.getInstance().getTsafeUser(pUser); + return GeneralDescriptions.getPersonname(user.getPersoncode()); + } + + /** + * Metodo que entrega el nombre del usuario. + * + * @param pUser Codigo de usuario. + * @return String. + * @throws Exception + */ + public static String getUsername(String pUser) throws Exception { + if (pUser == null) { + return ""; + } + TsafeUser user = DataHelper.getInstance().getTsafeUser(pUser); + return GeneralDescriptions.getPersonname(user.getPersoncode()); + } + + /** + * Metodo que entrega el email de un usuario.s + * + * @param pUser Codigo de usuario. + * @return String. + * @throws Exception + */ + public static String getEmailByUser(String pUser) throws Exception { + if (pUser == null) { + return ""; + } + TsafeUser user = DataHelper.getInstance().getTsafeUser(pUser); + return GeneralDescriptions.getEmail(user.getPersoncode()); + } + + /** + * Metodo que entrega el email de una persona + * + * @param pPersoncode Codigo de persona a obtener el email. + * @return String. + * @throws Exception + */ + public static String getEmail(Integer pPersoncode) throws Exception { + return TcustPersonAddress.getEmail(PersistenceHelper.getEntityManager(), pPersoncode); + } + + /** + * Metodo que entrega el nombre de una persona. + * + * @param pPersoncode Codigo de persona a obtener el nombre. + * @return String. + * @throws Exception + */ + public static String getPersonname(Integer pPersoncode) throws Exception { + return TcustPersonDetail.find(PersistenceHelper.getEntityManager(), pPersoncode).getName(); + } + + /** + * Metodo que entrega la descripcion de la moneda. + * + * @param pBranch Codigo de sucursal. + * @param company Compania a la que pertenece la sucursal + * @return String. + * @throws Exception + */ + public static String getBranchdesc(Integer pBranch, Integer company) throws Exception { + return TgeneBranch.find(PersistenceHelper.getEntityManager(), pBranch, company).getDescription(); + } + + /** + * Metodo que entrega la descripcion de la Etiqueta. + * + * @param pBranch Codigo de sucursal. + * @param company Compania a la que pertenece la sucursal + * @return String. + * @throws Exception + */ + public static String getLabel(String pLabel, String pLanguagecode, String pChannelcode) throws Exception { + TgeneLabelKey k = new TgeneLabelKey(pLabel, pLanguagecode, pChannelcode); + TgeneLabel label = TgeneLabel.find(PersistenceHelper.getEntityManager(), k); + if (label == null) { + return pLabel; + } + return label.getDescription(); + } + + /** + * Metodo que entrega la descripcion de la moneda. + * + * @param pOffice Codigo de oficina. + * @param pBranch Codigo de sucursal. + * @param pCompany Codigo de compania. + * @return String. + * @throws Exception + */ + public static String getOfficedesc(Integer pOffice, Integer pBranch, Integer pCompany) throws Exception { + TgeneOfficeKey tgeneOfficeKey = new TgeneOfficeKey(pOffice, pBranch, pCompany); + TgeneOffice office = TgeneOffice.find(PersistenceHelper.getEntityManager(), tgeneOfficeKey); + return office.getDescription(); + } + + /** + * Metodo que entrega la descripcion de la moneda. + * + * @param pCurrency Codigo de moneda. + * @return String. + * @throws Exception + */ + public static String getCurrencydesc(String pCurrency) throws Exception { + TgeneCurrency currency = DataHelper.getInstance().getTgeneCurrency(pCurrency); + return currency.getDescription(); + } + + /** + * Metodo que entrega la descripcion del status de la cuenta. + * + * @param pModule Codigo de modulo. + * @param pStatus Codigo de status. + * @return String + * @throws Exception + */ + public static String getStatusdesc(String pModule, String pStatus) throws Exception { + TgeneAccountStatusKey key = new TgeneAccountStatusKey(pModule, pStatus); + TgeneAccountStatus status = TgeneAccountStatus.find(PersistenceHelper.getEntityManager(), key); + return status.getDescription(); + } + + /** + * Metodo que entrega la descripcion del modulo. + * + * @param pModule Codigo de modulo. + * @return String. + * @throws Exception + */ + public static String getModuledesc(String pModule) throws Exception { + return TgeneModule.find(PersistenceHelper.getEntityManager(), pModule).getDescription(); + } + + /** + * Metodo que entrega la descripcion del producto. + * + * @param pModule Codigo de modulo. + * @param pProduct Codigo de producto. + * @return String + * @throws Exception + */ + public static String getProductdesc(String pModule, String pProduct) throws Exception { + if (pProduct == null) { + return ""; + } + return TgeneProduct.find(PersistenceHelper.getEntityManager(), pModule, pProduct).getDescription(); + } + + /** + * Metodo que entrega la descripcion del subproducto. + * + * @param pModule Codigo de modulo. + * @param pProduct Codigo de producto. + * @param pSubProduct Codigo de subproducto. + * @return String + * @throws Exception + */ + public static String getSubProductdesc(String pModule, String pProduct, String pSubProduct) throws Exception { + if (pSubProduct == null) { + return ""; + } + return TgeneSubProduct.find(PersistenceHelper.getEntityManager(), pModule, pProduct, pSubProduct).getDescription(); + } + + /** + * Metodo que devuelve el nombre o descripcion de la tranbsaccion + * + * @param transactionmodule Codigo modulo + * @param transactioncode Codigo transaccion + * @param transactionversion Codigo version + * @return + * @throws Exception + */ + public static String getTransactiondesc(String transactionmodule, Integer transactioncode, Integer transactionversion) throws Exception { + TgeneTransaction tgeneTransaction = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneTransaction(transactionmodule, + transactioncode, transactionversion); + if (tgeneTransaction == null) { + return "TRANSACCION NO DEFINIDA"; + } + return tgeneTransaction.getName(); + } + + /** + * Metodo que devuelve la descripcion del rubro de una transaccion + * + * @param transactionmodule Modulo de la transaccion + * @param transactioncode Codigo de la transaccion + * @param transactionversion Version de la transaccion + * @param itemcode Rubro de la transaccion + * @return + * @throws Exception + */ + public static String getTransactionItemdesc(String transactionmodule, Integer transactioncode, Integer transactionversion, Integer itemcode) + throws Exception { + TgeneTransactionItem tgeneTransactionItem = DataHelper.getInstance().getTgeneTransactionItem(transactionmodule, transactioncode, + transactionversion, itemcode); + return tgeneTransactionItem.getDescription(); + } + + /** + * Metodo que devuelve el nombre de una cuenta + * + * @param account Numero de cuenta + * @param company Compania ala que pertenece la cuenta + * @return + * @throws Exception + */ + public static String getAccountName(String account, Integer company) throws Exception { + TgeneAccountKey key = new TgeneAccountKey(account, company, Constant.getDefaultExpiryTimestamp()); + return TgeneAccount.find(PersistenceHelper.getEntityManager(), key).getAccountname(); + } +} diff --git a/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/.svn/text-base/MessageDescriptions.java.svn-base b/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/.svn/text-base/MessageDescriptions.java.svn-base new file mode 100644 index 0000000..166cf11 --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/.svn/text-base/MessageDescriptions.java.svn-base @@ -0,0 +1,22 @@ +package com.fp.base.persistence.util.helper; + +/** + * Clase utilitaria que se encarga de entregar descripciones a utilizar con velocity. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class MessageDescriptions { + + /** + * Entrega en el nombre de una persona dado el codigo de persona. + * + * @param personcode Codigo de persona a buscar el nombre. + * @return String + * @throws Exception + */ + public String getPersonname(Integer personcode) throws Exception { + return GeneralDescriptions.getPersonname(personcode); + } + +} diff --git a/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/.svn/text-base/MessageManager.java.netbeans-base b/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/.svn/text-base/MessageManager.java.netbeans-base new file mode 100644 index 0000000..4a7401e --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/.svn/text-base/MessageManager.java.netbeans-base @@ -0,0 +1,45 @@ +package com.fp.base.persistence.util.helper; + +import com.fp.common.messages.MessageUtil; +import com.fp.dto.Request; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDesc; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDescKey; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * Clase que encarga de completar plantillas de mesajes. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class MessageManager { + + /** + * Verifica que la transaccion tienga definida una plantilla de mensajes, busca el template de mensaje y compelta + * informacion dado el request. + * + * @param request Datos del mensaje de entrada. + * @return String + * @throws Exception + */ + public static String getMessage(Request request) throws Exception { + // Fija datos del subject de la agenda, si no tiene un valor previo y el codigo de plantilla de mensaje es + String message = ""; + if ((request.mbeans == null) || !request.mbeans.containsKey("tgenetransaction")) { + return message; + } + Integer messagecode = ((TgeneTransaction) request.mbeans.get("tgenetransaction")).getMessagecode(); + if (messagecode != null) { + MessageDescriptions md = new MessageDescriptions(); + TgeneMessageTemplatesDescKey key = new TgeneMessageTemplatesDescKey(messagecode, request.getLanguage()); + TgeneMessageTemplatesDesc msg = TgeneMessageTemplatesDesc.find(PersistenceHelper.getEntityManager(), key); + MessageUtil mu = new MessageUtil("es", msg.getTemplate()); + mu.setValue("request", request); + mu.setValue("messagedescripciones", md); + message = mu.getMessage(); + } + return message; + } + +} \ No newline at end of file diff --git a/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/.svn/text-base/MessageManager.java.svn-base b/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/.svn/text-base/MessageManager.java.svn-base new file mode 100644 index 0000000..4a7401e --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/.svn/text-base/MessageManager.java.svn-base @@ -0,0 +1,45 @@ +package com.fp.base.persistence.util.helper; + +import com.fp.common.messages.MessageUtil; +import com.fp.dto.Request; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDesc; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDescKey; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * Clase que encarga de completar plantillas de mesajes. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class MessageManager { + + /** + * Verifica que la transaccion tienga definida una plantilla de mensajes, busca el template de mensaje y compelta + * informacion dado el request. + * + * @param request Datos del mensaje de entrada. + * @return String + * @throws Exception + */ + public static String getMessage(Request request) throws Exception { + // Fija datos del subject de la agenda, si no tiene un valor previo y el codigo de plantilla de mensaje es + String message = ""; + if ((request.mbeans == null) || !request.mbeans.containsKey("tgenetransaction")) { + return message; + } + Integer messagecode = ((TgeneTransaction) request.mbeans.get("tgenetransaction")).getMessagecode(); + if (messagecode != null) { + MessageDescriptions md = new MessageDescriptions(); + TgeneMessageTemplatesDescKey key = new TgeneMessageTemplatesDescKey(messagecode, request.getLanguage()); + TgeneMessageTemplatesDesc msg = TgeneMessageTemplatesDesc.find(PersistenceHelper.getEntityManager(), key); + MessageUtil mu = new MessageUtil("es", msg.getTemplate()); + mu.setValue("request", request); + mu.setValue("messagedescripciones", md); + message = mu.getMessage(); + } + return message; + } + +} \ No newline at end of file diff --git a/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/.svn/text-base/SaveBeanInOtherSession.java.svn-base b/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/.svn/text-base/SaveBeanInOtherSession.java.svn-base new file mode 100644 index 0000000..486f195 --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/.svn/text-base/SaveBeanInOtherSession.java.svn-base @@ -0,0 +1,56 @@ +package com.fp.base.persistence.util.helper; + +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.logger.APPLogger; +import com.fp.dto.hb.HibernateBean; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; + +/** + * Clase que se encarga en insertar o actualizar un registro en la base de datos en un hilo diferente. + * @author Jorge Vaca. + * @version 2.1 + * + */ +public class SaveBeanInOtherSession extends Thread { + + /**Codigo de compania con el cual se obtiene la coneccion a la base de datos.*/ + private Integer company; + + /**Objeto a enviar a la base de datos.*/ + private HibernateBean bean; + + public SaveBeanInOtherSession(Integer pCompany, HibernateBean pHibernateBean) throws Exception { + company = pCompany; + bean = pHibernateBean; + } + + /** + * Metodo que se encarga de inicio de ejecucion del hilo. + */ + public void run(){ + try { + SessionData s = new SessionData(); + s.setCompany(company); + ThreadFacade.setSaveRequest(s); + PersistenceHelper.setEntityManager(PersistenceManager.getInstance().createEntityManagerLocal()); + PersistenceHelper.beginTransaction(); + PersistenceHelper.saveOrUpdate(bean); + PersistenceHelper.commitTransaction(); + } catch (Exception e) { + APPLogger.getLogger().error(e); + }finally{ + try { + //Cierra la sesion de base de datos con la cual se ejecuto el proceso de fin de dia. + PersistenceHelper.closeSession(); + } catch (Exception e) { + ExceptionHandler eh = new ExceptionHandler(e,"es"); + APPLogger.getLogger().error(eh.getStackTrace()); + } + } + } + + +} diff --git a/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/GeneralDescriptions.java b/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/GeneralDescriptions.java new file mode 100644 index 0000000..bf44be3 --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/GeneralDescriptions.java @@ -0,0 +1,350 @@ +package com.fp.base.persistence.util.helper; + +import com.fp.base.persistence.util.db.DataHelper; +import com.fp.common.helper.Constant; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.acco.TgeneAccount; +import com.fp.persistence.pgeneral.acco.TgeneAccountKey; +import com.fp.persistence.pgeneral.acco.TgeneAccountStatus; +import com.fp.persistence.pgeneral.acco.TgeneAccountStatusKey; +import com.fp.persistence.pgeneral.gene.*; +import com.fp.persistence.pgeneral.installment.TgeneInstallmentType; +import com.fp.persistence.pgeneral.product.TgeneModule; +import com.fp.persistence.pgeneral.product.TgeneProduct; +import com.fp.persistence.pgeneral.product.TgeneSubProduct; +import com.fp.persistence.pgeneral.safe.TsafeUser; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; +import com.fp.persistence.pgeneral.trans.TgeneTransactionItem; + +/** + * Clase utilitaria que entrega las descripciones generales, de productos, monedas, tipos de credito, adicionalmente + * completa descripciones en tgeneaccount, tgenesolicitude. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class GeneralDescriptions { + + /** + * Metodo que completa descripciones de cuenta. + * + * @param pTgeneAccount Datos generales de la cuenta. + * @throws Exception + */ + public static void completeAccountDescriptions(TgeneAccount pTgeneAccount) throws Exception { + pTgeneAccount.addAddtionalInfo("moduledesc", GeneralDescriptions.getModuledesc(pTgeneAccount.getModulecode())); + pTgeneAccount.addAddtionalInfo("productdesc", + GeneralDescriptions.getProductdesc(pTgeneAccount.getModulecode(), pTgeneAccount.getProductcode())); + pTgeneAccount.addAddtionalInfo( + "subproductdesc", + GeneralDescriptions.getSubProductdesc(pTgeneAccount.getModulecode(), pTgeneAccount.getProductcode(), + pTgeneAccount.getSubproductcode())); + pTgeneAccount.addAddtionalInfo("currencydesc", GeneralDescriptions.getCurrencydesc(pTgeneAccount.getCurrencycode())); + pTgeneAccount.addAddtionalInfo("statusdesc", + GeneralDescriptions.getStatusdesc(pTgeneAccount.getModulecode(), pTgeneAccount.getAccountstatuscode())); + } + + /** + * Metodo que completa descripciones de uan solicitud. + * + * @param pTgeneSolicitude Datos generales de una solicitud. + * @throws Exception + */ + public static void completeSolicitudeDescriptions(TgeneSolicitude pTgeneSolicitude) throws Exception { + pTgeneSolicitude.addAddtionalInfo("moduledesc", GeneralDescriptions.getModuledesc(pTgeneSolicitude.getModulecode())); + pTgeneSolicitude.addAddtionalInfo("productdesc", + GeneralDescriptions.getProductdesc(pTgeneSolicitude.getModulecode(), pTgeneSolicitude.getProductcode())); + pTgeneSolicitude.addAddtionalInfo( + "subproductdesc", + GeneralDescriptions.getSubProductdesc(pTgeneSolicitude.getModulecode(), pTgeneSolicitude.getProductcode(), + pTgeneSolicitude.getSubproductcode())); + pTgeneSolicitude.addAddtionalInfo("currencydesc", GeneralDescriptions.getCurrencydesc(pTgeneSolicitude.getCurrencycode())); + } + + /** + * Metodo que entrega la descripcion del detalle de catalogo. + * + * @param pCatalog Codigo de tiposobregiro, base de calculo, destiono de fondos etc. + * @param pCatalogcode Codigo de catalogo. + * @return String. + * @throws Exception + */ + public static String getCatalogdetaildesc(String pCatalog, String pCatalogcode) throws Exception { + TgeneCatalogDetail detail = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneCatalogDetail(pCatalog, pCatalogcode); + return detail.getDescription(); + } + + /** + * Metodo que entrega la descripcion de tipo de credito. + * + * @param pCredittype Codigo de tipo de credito. + * @return String. + * @throws Exception + */ + public static String getCredittypedesc(String pCredittype) throws Exception { + if (pCredittype == null) { + return ""; + } + TgeneCreditType ctype = DataHelper.getInstance().getTgeneCreditType(pCredittype); + return ctype.getDescription(); + } + + /** + * Metodo que entrega la descripcion del tipo de tabla de amortizacion. + * + * @param pInstallmenttype Codigo de tipo de tabla de amortizacion. + * @return String. + * @throws Exception + */ + public static String getInstallmettypedesc(String pInstallmenttype, String pModule) throws Exception { + if (pInstallmenttype == null) { + return ""; + } + TgeneInstallmentType itype = DataHelper.getInstance().getTgeneInstallmentType(pInstallmenttype, pModule); + return itype.getDescription(); + } + + /** + * Metodo que entrega la descripcion de la frequencia. + * + * @param pFrequencycode Codigo de frequencia. + * @return String. + * @throws Exception + */ + public static String getFrequencydesc(Integer pFrequencycode) throws Exception { + if (pFrequencycode == null) { + return ""; + } + TgeneFrequency frequency = DataHelper.getInstance().getTgeneFrecuency(pFrequencycode); + return frequency.getDescription(); + } + + /** + * Metodo que entrega el nombre del oficial de cuenta. + * + * @param pUser Codigo de usuario. + * @return String. + * @throws Exception + */ + public static String getOfficername(String pUser) throws Exception { + if (pUser == null) { + return ""; + } + TsafeUser user = DataHelper.getInstance().getTsafeUser(pUser); + return GeneralDescriptions.getPersonname(user.getPersoncode()); + } + + /** + * Metodo que entrega el nombre del usuario. + * + * @param pUser Codigo de usuario. + * @return String. + * @throws Exception + */ + public static String getUsername(String pUser) throws Exception { + if (pUser == null) { + return ""; + } + TsafeUser user = DataHelper.getInstance().getTsafeUser(pUser); + return GeneralDescriptions.getPersonname(user.getPersoncode()); + } + + /** + * Metodo que entrega el email de un usuario.s + * + * @param pUser Codigo de usuario. + * @return String. + * @throws Exception + */ + public static String getEmailByUser(String pUser) throws Exception { + if (pUser == null) { + return ""; + } + TsafeUser user = DataHelper.getInstance().getTsafeUser(pUser); + return GeneralDescriptions.getEmail(user.getPersoncode()); + } + + /** + * Metodo que entrega el email de una persona + * + * @param pPersoncode Codigo de persona a obtener el email. + * @return String. + * @throws Exception + */ + public static String getEmail(Integer pPersoncode) throws Exception { + return TcustPersonAddress.getEmail(PersistenceHelper.getEntityManager(), pPersoncode); + } + + /** + * Metodo que entrega el nombre de una persona. + * + * @param pPersoncode Codigo de persona a obtener el nombre. + * @return String. + * @throws Exception + */ + public static String getPersonname(Integer pPersoncode) throws Exception { + return TcustPersonDetail.find(PersistenceHelper.getEntityManager(), pPersoncode).getName(); + } + + /** + * Metodo que entrega la descripcion de la moneda. + * + * @param pBranch Codigo de sucursal. + * @param company Compania a la que pertenece la sucursal + * @return String. + * @throws Exception + */ + public static String getBranchdesc(Integer pBranch, Integer company) throws Exception { + return TgeneBranch.find(PersistenceHelper.getEntityManager(), pBranch, company).getDescription(); + } + + /** + * Metodo que entrega la descripcion de la Etiqueta. + * + * @param pBranch Codigo de sucursal. + * @param company Compania a la que pertenece la sucursal + * @return String. + * @throws Exception + */ + public static String getLabel(String pLabel, String pLanguagecode, String pChannelcode) throws Exception { + TgeneLabelKey k = new TgeneLabelKey(pLabel, pLanguagecode, pChannelcode); + TgeneLabel label = TgeneLabel.find(PersistenceHelper.getEntityManager(), k); + if (label == null) { + return pLabel; + } + return label.getDescription(); + } + + /** + * Metodo que entrega la descripcion de la moneda. + * + * @param pOffice Codigo de oficina. + * @param pBranch Codigo de sucursal. + * @param pCompany Codigo de compania. + * @return String. + * @throws Exception + */ + public static String getOfficedesc(Integer pOffice, Integer pBranch, Integer pCompany) throws Exception { + TgeneOfficeKey tgeneOfficeKey = new TgeneOfficeKey(pOffice, pBranch, pCompany); + TgeneOffice office = TgeneOffice.find(PersistenceHelper.getEntityManager(), tgeneOfficeKey); + return office.getDescription(); + } + + /** + * Metodo que entrega la descripcion de la moneda. + * + * @param pCurrency Codigo de moneda. + * @return String. + * @throws Exception + */ + public static String getCurrencydesc(String pCurrency) throws Exception { + TgeneCurrency currency = DataHelper.getInstance().getTgeneCurrency(pCurrency); + return currency.getDescription(); + } + + /** + * Metodo que entrega la descripcion del status de la cuenta. + * + * @param pModule Codigo de modulo. + * @param pStatus Codigo de status. + * @return String + * @throws Exception + */ + public static String getStatusdesc(String pModule, String pStatus) throws Exception { + TgeneAccountStatusKey key = new TgeneAccountStatusKey(pModule, pStatus); + TgeneAccountStatus status = TgeneAccountStatus.find(PersistenceHelper.getEntityManager(), key); + return status.getDescription(); + } + + /** + * Metodo que entrega la descripcion del modulo. + * + * @param pModule Codigo de modulo. + * @return String. + * @throws Exception + */ + public static String getModuledesc(String pModule) throws Exception { + return TgeneModule.find(PersistenceHelper.getEntityManager(), pModule).getDescription(); + } + + /** + * Metodo que entrega la descripcion del producto. + * + * @param pModule Codigo de modulo. + * @param pProduct Codigo de producto. + * @return String + * @throws Exception + */ + public static String getProductdesc(String pModule, String pProduct) throws Exception { + if (pProduct == null) { + return ""; + } + return TgeneProduct.find(PersistenceHelper.getEntityManager(), pModule, pProduct).getDescription(); + } + + /** + * Metodo que entrega la descripcion del subproducto. + * + * @param pModule Codigo de modulo. + * @param pProduct Codigo de producto. + * @param pSubProduct Codigo de subproducto. + * @return String + * @throws Exception + */ + public static String getSubProductdesc(String pModule, String pProduct, String pSubProduct) throws Exception { + if (pSubProduct == null) { + return ""; + } + return TgeneSubProduct.find(PersistenceHelper.getEntityManager(), pModule, pProduct, pSubProduct).getDescription(); + } + + /** + * Metodo que devuelve el nombre o descripcion de la tranbsaccion + * + * @param transactionmodule Codigo modulo + * @param transactioncode Codigo transaccion + * @param transactionversion Codigo version + * @return + * @throws Exception + */ + public static String getTransactiondesc(String transactionmodule, Integer transactioncode, Integer transactionversion) throws Exception { + TgeneTransaction tgeneTransaction = com.fp.persistence.commondb.db.DataHelper.getInstance().getTgeneTransaction(transactionmodule, + transactioncode, transactionversion); + if (tgeneTransaction == null) { + return "TRANSACCION NO DEFINIDA"; + } + return tgeneTransaction.getName(); + } + + /** + * Metodo que devuelve la descripcion del rubro de una transaccion + * + * @param transactionmodule Modulo de la transaccion + * @param transactioncode Codigo de la transaccion + * @param transactionversion Version de la transaccion + * @param itemcode Rubro de la transaccion + * @return + * @throws Exception + */ + public static String getTransactionItemdesc(String transactionmodule, Integer transactioncode, Integer transactionversion, Integer itemcode) + throws Exception { + TgeneTransactionItem tgeneTransactionItem = DataHelper.getInstance().getTgeneTransactionItem(transactionmodule, transactioncode, + transactionversion, itemcode); + return tgeneTransactionItem.getDescription(); + } + + /** + * Metodo que devuelve el nombre de una cuenta + * + * @param account Numero de cuenta + * @param company Compania ala que pertenece la cuenta + * @return + * @throws Exception + */ + public static String getAccountName(String account, Integer company) throws Exception { + TgeneAccountKey key = new TgeneAccountKey(account, company, Constant.getDefaultExpiryTimestamp()); + return TgeneAccount.find(PersistenceHelper.getEntityManager(), key).getAccountname(); + } +} diff --git a/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/MessageDescriptions.java b/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/MessageDescriptions.java new file mode 100644 index 0000000..166cf11 --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/MessageDescriptions.java @@ -0,0 +1,22 @@ +package com.fp.base.persistence.util.helper; + +/** + * Clase utilitaria que se encarga de entregar descripciones a utilizar con velocity. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class MessageDescriptions { + + /** + * Entrega en el nombre de una persona dado el codigo de persona. + * + * @param personcode Codigo de persona a buscar el nombre. + * @return String + * @throws Exception + */ + public String getPersonname(Integer personcode) throws Exception { + return GeneralDescriptions.getPersonname(personcode); + } + +} diff --git a/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/MessageManager.java b/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/MessageManager.java new file mode 100644 index 0000000..4a7401e --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/MessageManager.java @@ -0,0 +1,45 @@ +package com.fp.base.persistence.util.helper; + +import com.fp.common.messages.MessageUtil; +import com.fp.dto.Request; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDesc; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDescKey; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * Clase que encarga de completar plantillas de mesajes. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class MessageManager { + + /** + * Verifica que la transaccion tienga definida una plantilla de mensajes, busca el template de mensaje y compelta + * informacion dado el request. + * + * @param request Datos del mensaje de entrada. + * @return String + * @throws Exception + */ + public static String getMessage(Request request) throws Exception { + // Fija datos del subject de la agenda, si no tiene un valor previo y el codigo de plantilla de mensaje es + String message = ""; + if ((request.mbeans == null) || !request.mbeans.containsKey("tgenetransaction")) { + return message; + } + Integer messagecode = ((TgeneTransaction) request.mbeans.get("tgenetransaction")).getMessagecode(); + if (messagecode != null) { + MessageDescriptions md = new MessageDescriptions(); + TgeneMessageTemplatesDescKey key = new TgeneMessageTemplatesDescKey(messagecode, request.getLanguage()); + TgeneMessageTemplatesDesc msg = TgeneMessageTemplatesDesc.find(PersistenceHelper.getEntityManager(), key); + MessageUtil mu = new MessageUtil("es", msg.getTemplate()); + mu.setValue("request", request); + mu.setValue("messagedescripciones", md); + message = mu.getMessage(); + } + return message; + } + +} \ No newline at end of file diff --git a/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/SaveBeanInOtherSession.java b/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/SaveBeanInOtherSession.java new file mode 100644 index 0000000..486f195 --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/persistence/util/helper/SaveBeanInOtherSession.java @@ -0,0 +1,56 @@ +package com.fp.base.persistence.util.helper; + +import com.fp.common.exception.ExceptionHandler; +import com.fp.common.logger.APPLogger; +import com.fp.dto.hb.HibernateBean; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; + +/** + * Clase que se encarga en insertar o actualizar un registro en la base de datos en un hilo diferente. + * @author Jorge Vaca. + * @version 2.1 + * + */ +public class SaveBeanInOtherSession extends Thread { + + /**Codigo de compania con el cual se obtiene la coneccion a la base de datos.*/ + private Integer company; + + /**Objeto a enviar a la base de datos.*/ + private HibernateBean bean; + + public SaveBeanInOtherSession(Integer pCompany, HibernateBean pHibernateBean) throws Exception { + company = pCompany; + bean = pHibernateBean; + } + + /** + * Metodo que se encarga de inicio de ejecucion del hilo. + */ + public void run(){ + try { + SessionData s = new SessionData(); + s.setCompany(company); + ThreadFacade.setSaveRequest(s); + PersistenceHelper.setEntityManager(PersistenceManager.getInstance().createEntityManagerLocal()); + PersistenceHelper.beginTransaction(); + PersistenceHelper.saveOrUpdate(bean); + PersistenceHelper.commitTransaction(); + } catch (Exception e) { + APPLogger.getLogger().error(e); + }finally{ + try { + //Cierra la sesion de base de datos con la cual se ejecuto el proceso de fin de dia. + PersistenceHelper.closeSession(); + } catch (Exception e) { + ExceptionHandler eh = new ExceptionHandler(e,"es"); + APPLogger.getLogger().error(eh.getStackTrace()); + } + } + } + + +} diff --git a/base/persistence/util/src/main/java/com/fp/base/persistence/util/job/.svn/entries b/base/persistence/util/src/main/java/com/fp/base/persistence/util/job/.svn/entries new file mode 100644 index 0000000..b31a3fa --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/persistence/util/job/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/util/src/main/java/com/fp/base/persistence/util/job +svn://172.17.26.185/COMACO + + + +2014-09-11T11:45:32.157821Z +689 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ServiceManager.java +file + + + + +2022-07-28T03:40:31.282753Z +7be20f3a14b1d858ce9b92ab84920f91 +2014-09-11T11:45:32.157821Z +689 +jvaca + + + + + + + + + + + + + + + + + + + + + +3735 + diff --git a/base/persistence/util/src/main/java/com/fp/base/persistence/util/job/.svn/text-base/ServiceManager.java.svn-base b/base/persistence/util/src/main/java/com/fp/base/persistence/util/job/.svn/text-base/ServiceManager.java.svn-base new file mode 100644 index 0000000..3ca6745 --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/persistence/util/job/.svn/text-base/ServiceManager.java.svn-base @@ -0,0 +1,111 @@ +package com.fp.base.persistence.util.job; + +import java.lang.reflect.Method; +import java.util.List; + +import com.fp.common.helper.Constant; +import com.fp.common.logger.APPLogger; +import com.fp.dto.rules.Service; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.gene.TgeneServices; + +/** + * Clase que se encarga de manejar serviciso o demonios que estan activos en el servidor de aplicaciones. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class ServiceManager { + + /** + * Metodo que inicia todos los servicios declarados como automaticos, el proceso lo ejecuta cuando sube el servidor + * de aplicaciones. + * + * @throws Exception + */ + public void autoamaticInit() throws Exception { + List ldata = TgeneServices.find(PersistenceHelper.getEntityManager()); + for (TgeneServices obj : ldata) { + try { + if(Constant.ifYes(obj.getAutomatic()) ){ + this.startByService(obj); + } + } catch (Exception e) { + APPLogger.getLogger().error("***********NO PUEDE INICIAR EL SERVICIO********** :"+obj.getPk()+" DEFINIDO EN TgeneServices ***********"); + } + } + } + + /** + * Metodo que inicia un servicio, dado un codigo de servicio. + * + * @param pService Codigo de servicio a iniciar + * @throws Exception + */ + public void startService(String pService) throws Exception { + TgeneServices tgeneServices = TgeneServices.find(PersistenceHelper.getEntityManager(), pService); + this.startByService(tgeneServices); + } + + /** + * Metodo que detiene un servicio, dado un codigo de servicio. + * + * @param pService Codigo de servicio a detener. + * @throws Exception + */ + public void stopService(String pService) throws Exception { + TgeneServices tgeneServices = TgeneServices.find(PersistenceHelper.getEntityManager(), pService); + this.stopByService(tgeneServices); + } + + /** + * Metodo que inicia un servicio. + * + * @param pTgeneServices Objeto que contiene la defincion de un servicio. + * @throws Exception + */ + private void startByService(TgeneServices pTgeneServices) throws Exception { + Service service = this.getService(pTgeneServices); + service.start(); + } + + /** + * Metodo que detiene un servicio. + * + * @param pTgeneServices Objeto que contiene la defincion de un servicio. + * @throws Exception + */ + private void stopByService(TgeneServices pTgeneServices) throws Exception { + Service service = this.getService(pTgeneServices); + service.stop(); + } + + /** + * Metodo que indica si el servisio esta en estado de ejecucion o no. + * + * @param pService Codigo de servicio. + * @return boolean + * @throws Exception + */ + public boolean isRunning(String pService) throws Exception { + TgeneServices tgeneServices = TgeneServices.find(PersistenceHelper.getEntityManager(), pService); + Service service = this.getService(tgeneServices); + return service.isrunning(); + } + + /** + * Metodo que obtiene una instancia del servicio, de manera dinamica. + * + * @param pTgeneServices Objeto que contiene la defincion de un servicio. + * @return Service + * @throws Exception + */ + private Service getService(TgeneServices pTgeneServices) throws Exception { + Service service = null; + Method m = Class.forName(pTgeneServices.getClassname()).getDeclaredMethod("getInstance"); + m.setAccessible(true); // if security settings allow this + service = (Service) m.invoke(null); // use null if the method is static + return service; + } + +} diff --git a/base/persistence/util/src/main/java/com/fp/base/persistence/util/job/ServiceManager.java b/base/persistence/util/src/main/java/com/fp/base/persistence/util/job/ServiceManager.java new file mode 100644 index 0000000..3ca6745 --- /dev/null +++ b/base/persistence/util/src/main/java/com/fp/base/persistence/util/job/ServiceManager.java @@ -0,0 +1,111 @@ +package com.fp.base.persistence.util.job; + +import java.lang.reflect.Method; +import java.util.List; + +import com.fp.common.helper.Constant; +import com.fp.common.logger.APPLogger; +import com.fp.dto.rules.Service; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.pgeneral.gene.TgeneServices; + +/** + * Clase que se encarga de manejar serviciso o demonios que estan activos en el servidor de aplicaciones. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class ServiceManager { + + /** + * Metodo que inicia todos los servicios declarados como automaticos, el proceso lo ejecuta cuando sube el servidor + * de aplicaciones. + * + * @throws Exception + */ + public void autoamaticInit() throws Exception { + List ldata = TgeneServices.find(PersistenceHelper.getEntityManager()); + for (TgeneServices obj : ldata) { + try { + if(Constant.ifYes(obj.getAutomatic()) ){ + this.startByService(obj); + } + } catch (Exception e) { + APPLogger.getLogger().error("***********NO PUEDE INICIAR EL SERVICIO********** :"+obj.getPk()+" DEFINIDO EN TgeneServices ***********"); + } + } + } + + /** + * Metodo que inicia un servicio, dado un codigo de servicio. + * + * @param pService Codigo de servicio a iniciar + * @throws Exception + */ + public void startService(String pService) throws Exception { + TgeneServices tgeneServices = TgeneServices.find(PersistenceHelper.getEntityManager(), pService); + this.startByService(tgeneServices); + } + + /** + * Metodo que detiene un servicio, dado un codigo de servicio. + * + * @param pService Codigo de servicio a detener. + * @throws Exception + */ + public void stopService(String pService) throws Exception { + TgeneServices tgeneServices = TgeneServices.find(PersistenceHelper.getEntityManager(), pService); + this.stopByService(tgeneServices); + } + + /** + * Metodo que inicia un servicio. + * + * @param pTgeneServices Objeto que contiene la defincion de un servicio. + * @throws Exception + */ + private void startByService(TgeneServices pTgeneServices) throws Exception { + Service service = this.getService(pTgeneServices); + service.start(); + } + + /** + * Metodo que detiene un servicio. + * + * @param pTgeneServices Objeto que contiene la defincion de un servicio. + * @throws Exception + */ + private void stopByService(TgeneServices pTgeneServices) throws Exception { + Service service = this.getService(pTgeneServices); + service.stop(); + } + + /** + * Metodo que indica si el servisio esta en estado de ejecucion o no. + * + * @param pService Codigo de servicio. + * @return boolean + * @throws Exception + */ + public boolean isRunning(String pService) throws Exception { + TgeneServices tgeneServices = TgeneServices.find(PersistenceHelper.getEntityManager(), pService); + Service service = this.getService(tgeneServices); + return service.isrunning(); + } + + /** + * Metodo que obtiene una instancia del servicio, de manera dinamica. + * + * @param pTgeneServices Objeto que contiene la defincion de un servicio. + * @return Service + * @throws Exception + */ + private Service getService(TgeneServices pTgeneServices) throws Exception { + Service service = null; + Method m = Class.forName(pTgeneServices.getClassname()).getDeclaredMethod("getInstance"); + m.setAccessible(true); // if security settings allow this + service = (Service) m.invoke(null); // use null if the method is static + return service; + } + +} diff --git a/base/persistence/util/src/test/.svn/entries b/base/persistence/util/src/test/.svn/entries new file mode 100644 index 0000000..a8ca725 --- /dev/null +++ b/base/persistence/util/src/test/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/util/src/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + diff --git a/base/persistence/util/src/test/java/.svn/entries b/base/persistence/util/src/test/java/.svn/entries new file mode 100644 index 0000000..21a406e --- /dev/null +++ b/base/persistence/util/src/test/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/util/src/test/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/persistence/util/src/test/java/com/.svn/entries b/base/persistence/util/src/test/java/com/.svn/entries new file mode 100644 index 0000000..ff49286 --- /dev/null +++ b/base/persistence/util/src/test/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/util/src/test/java/com +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/persistence/util/src/test/java/com/fp/.svn/entries b/base/persistence/util/src/test/java/com/fp/.svn/entries new file mode 100644 index 0000000..9917d1e --- /dev/null +++ b/base/persistence/util/src/test/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/util/src/test/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +base +dir + diff --git a/base/persistence/util/src/test/java/com/fp/base/.svn/entries b/base/persistence/util/src/test/java/com/fp/base/.svn/entries new file mode 100644 index 0000000..98c670a --- /dev/null +++ b/base/persistence/util/src/test/java/com/fp/base/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/util/src/test/java/com/fp/base +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +persistence +dir + diff --git a/base/persistence/util/src/test/java/com/fp/base/persistence/.svn/entries b/base/persistence/util/src/test/java/com/fp/base/persistence/.svn/entries new file mode 100644 index 0000000..a6e3f2e --- /dev/null +++ b/base/persistence/util/src/test/java/com/fp/base/persistence/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/persistence/util/src/test/java/com/fp/base/persistence +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +AppTest.java +file + + + + +2022-07-28T03:40:30.839752Z +1f797add1170cd7049e4e378ab45388e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +651 + diff --git a/base/persistence/util/src/test/java/com/fp/base/persistence/.svn/text-base/AppTest.java.svn-base b/base/persistence/util/src/test/java/com/fp/base/persistence/.svn/text-base/AppTest.java.svn-base new file mode 100644 index 0000000..cd90310 --- /dev/null +++ b/base/persistence/util/src/test/java/com/fp/base/persistence/.svn/text-base/AppTest.java.svn-base @@ -0,0 +1,38 @@ +package com.fp.base.persistence; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/base/persistence/util/src/test/java/com/fp/base/persistence/AppTest.java b/base/persistence/util/src/test/java/com/fp/base/persistence/AppTest.java new file mode 100644 index 0000000..cd90310 --- /dev/null +++ b/base/persistence/util/src/test/java/com/fp/base/persistence/AppTest.java @@ -0,0 +1,38 @@ +package com.fp.base.persistence; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/base/persistence/util/target/classes/com/fp/base/persistence/util/db/DataHelper.class b/base/persistence/util/target/classes/com/fp/base/persistence/util/db/DataHelper.class new file mode 100644 index 0000000..f97ea30 Binary files /dev/null and b/base/persistence/util/target/classes/com/fp/base/persistence/util/db/DataHelper.class differ diff --git a/base/persistence/util/target/classes/com/fp/base/persistence/util/formula/FormulaManager.class b/base/persistence/util/target/classes/com/fp/base/persistence/util/formula/FormulaManager.class new file mode 100644 index 0000000..7785a5e Binary files /dev/null and b/base/persistence/util/target/classes/com/fp/base/persistence/util/formula/FormulaManager.class differ diff --git a/base/persistence/util/target/classes/com/fp/base/persistence/util/helper/GeneralDescriptions.class b/base/persistence/util/target/classes/com/fp/base/persistence/util/helper/GeneralDescriptions.class new file mode 100644 index 0000000..ee289d9 Binary files /dev/null and b/base/persistence/util/target/classes/com/fp/base/persistence/util/helper/GeneralDescriptions.class differ diff --git a/base/persistence/util/target/classes/com/fp/base/persistence/util/helper/MessageDescriptions.class b/base/persistence/util/target/classes/com/fp/base/persistence/util/helper/MessageDescriptions.class new file mode 100644 index 0000000..67c9a3e Binary files /dev/null and b/base/persistence/util/target/classes/com/fp/base/persistence/util/helper/MessageDescriptions.class differ diff --git a/base/persistence/util/target/classes/com/fp/base/persistence/util/helper/MessageManager.class b/base/persistence/util/target/classes/com/fp/base/persistence/util/helper/MessageManager.class new file mode 100644 index 0000000..9ee5799 Binary files /dev/null and b/base/persistence/util/target/classes/com/fp/base/persistence/util/helper/MessageManager.class differ diff --git a/base/persistence/util/target/classes/com/fp/base/persistence/util/helper/SaveBeanInOtherSession.class b/base/persistence/util/target/classes/com/fp/base/persistence/util/helper/SaveBeanInOtherSession.class new file mode 100644 index 0000000..498fb51 Binary files /dev/null and b/base/persistence/util/target/classes/com/fp/base/persistence/util/helper/SaveBeanInOtherSession.class differ diff --git a/base/persistence/util/target/classes/com/fp/base/persistence/util/job/ServiceManager.class b/base/persistence/util/target/classes/com/fp/base/persistence/util/job/ServiceManager.class new file mode 100644 index 0000000..2b6c20b Binary files /dev/null and b/base/persistence/util/target/classes/com/fp/base/persistence/util/job/ServiceManager.class differ diff --git a/base/persistence/util/target/maven-archiver/pom.properties b/base/persistence/util/target/maven-archiver/pom.properties new file mode 100644 index 0000000..6fbfc04 --- /dev/null +++ b/base/persistence/util/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:52:53 ECT 2022 +version=2.1 +groupId=com.fp.base.persistence +artifactId=util diff --git a/base/persistence/util/target/util-2.1.jar b/base/persistence/util/target/util-2.1.jar new file mode 100644 index 0000000..0f16c2a Binary files /dev/null and b/base/persistence/util/target/util-2.1.jar differ diff --git a/base/pom.xml b/base/pom.xml new file mode 100644 index 0000000..b8baae0 --- /dev/null +++ b/base/pom.xml @@ -0,0 +1,82 @@ + + + + FlipBean + com.fp + 2.1 + + 4.0.0 + com.fp + base + Base + 2.1 + pom + + 6.1.0.Final + 6.1.0.Final + ISO-8859-1 + + + dto + bpm + persistence + core + business + facadeclient + facade + sessionbeans + + + + + + + + org.drools + drools-bom + pom + ${drools.version} + import + + + + + org.jbpm + jbpm-bom + pom + ${jbpm.version} + import + + + + + org.apache.poi + poi + 3.5-FINAL + jar + provided + + + org.apache.poi + poi-ooxml-schemas + 3.6 + jar + provided + + + org.apache.poi + poi-ooxml + 3.5-FINAL + jar + provided + + + org.apache.poi + ooxml-schemas + 1.0 + jar + provided + + + + diff --git a/base/sessionbeans/.svn/dir-prop-base b/base/sessionbeans/.svn/dir-prop-base new file mode 100644 index 0000000..40820ff --- /dev/null +++ b/base/sessionbeans/.svn/dir-prop-base @@ -0,0 +1,6 @@ +K 10 +svn:ignore +V 7 +target + +END diff --git a/base/sessionbeans/.svn/entries b/base/sessionbeans/.svn/entries new file mode 100644 index 0000000..19ff84e --- /dev/null +++ b/base/sessionbeans/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/sessionbeans +svn://172.17.26.185/COMACO + + + +2015-06-23T07:18:19.905071Z +4129 +cpiedra +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:45.218814Z +ff6eae1412c63a98be37c33e85c08ec1 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1413 + diff --git a/base/sessionbeans/.svn/text-base/pom.xml.svn-base b/base/sessionbeans/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..ac565e1 --- /dev/null +++ b/base/sessionbeans/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,45 @@ + + + 4.0.0 + + base + com.fp + 2.1 + + com.fp.base + sessionbeans + sessionbeans + + + org.jboss.spec.javax.ejb + jboss-ejb-api_3.1_spec + provided + + + org.hibernate + hibernate-core + provided + + + org.hibernate + hibernate-entitymanager + + + com.fp.base.persistence + pgeneral + 2.1 + + + com.fp.base.dto + common + 2.1 + + + com.fp.base.persistence + commondb + 2.1 + + + diff --git a/base/sessionbeans/pom.xml b/base/sessionbeans/pom.xml new file mode 100644 index 0000000..ac565e1 --- /dev/null +++ b/base/sessionbeans/pom.xml @@ -0,0 +1,45 @@ + + + 4.0.0 + + base + com.fp + 2.1 + + com.fp.base + sessionbeans + sessionbeans + + + org.jboss.spec.javax.ejb + jboss-ejb-api_3.1_spec + provided + + + org.hibernate + hibernate-core + provided + + + org.hibernate + hibernate-entitymanager + + + com.fp.base.persistence + pgeneral + 2.1 + + + com.fp.base.dto + common + 2.1 + + + com.fp.base.persistence + commondb + 2.1 + + + diff --git a/base/sessionbeans/src/.svn/entries b/base/sessionbeans/src/.svn/entries new file mode 100644 index 0000000..331357c --- /dev/null +++ b/base/sessionbeans/src/.svn/entries @@ -0,0 +1,37 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/sessionbeans/src +svn://172.17.26.185/COMACO + + + +2015-06-23T07:18:19.905071Z +4129 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +META-INF +dir + +main +dir + diff --git a/base/sessionbeans/src/META-INF/.svn/entries b/base/sessionbeans/src/META-INF/.svn/entries new file mode 100644 index 0000000..2951cbe --- /dev/null +++ b/base/sessionbeans/src/META-INF/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/sessionbeans/src/META-INF +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +MANIFEST.MF +file + + + + +2022-07-28T03:40:44.861812Z +b10f37c8bb1803d98c127a01d1a71cc5 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +39 + diff --git a/base/sessionbeans/src/META-INF/.svn/text-base/MANIFEST.MF.svn-base b/base/sessionbeans/src/META-INF/.svn/text-base/MANIFEST.MF.svn-base new file mode 100644 index 0000000..5e94951 --- /dev/null +++ b/base/sessionbeans/src/META-INF/.svn/text-base/MANIFEST.MF.svn-base @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/base/sessionbeans/src/META-INF/MANIFEST.MF b/base/sessionbeans/src/META-INF/MANIFEST.MF new file mode 100644 index 0000000..5e94951 --- /dev/null +++ b/base/sessionbeans/src/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/base/sessionbeans/src/main/.svn/entries b/base/sessionbeans/src/main/.svn/entries new file mode 100644 index 0000000..a03313f --- /dev/null +++ b/base/sessionbeans/src/main/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/sessionbeans/src/main +svn://172.17.26.185/COMACO + + + +2015-06-23T07:18:19.905071Z +4129 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + diff --git a/base/sessionbeans/src/main/java/.svn/entries b/base/sessionbeans/src/main/java/.svn/entries new file mode 100644 index 0000000..1dccd86 --- /dev/null +++ b/base/sessionbeans/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/sessionbeans/src/main/java +svn://172.17.26.185/COMACO + + + +2015-06-23T07:18:19.905071Z +4129 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/base/sessionbeans/src/main/java/com/.svn/entries b/base/sessionbeans/src/main/java/com/.svn/entries new file mode 100644 index 0000000..660176c --- /dev/null +++ b/base/sessionbeans/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/sessionbeans/src/main/java/com +svn://172.17.26.185/COMACO + + + +2015-06-23T07:18:19.905071Z +4129 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/base/sessionbeans/src/main/java/com/fp/.svn/entries b/base/sessionbeans/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..5aeceab --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/sessionbeans/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2015-06-23T07:18:19.905071Z +4129 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +sessionbeans +dir + diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/.svn/entries b/base/sessionbeans/src/main/java/com/fp/sessionbeans/.svn/entries new file mode 100644 index 0000000..b3966cf --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/sessionbeans/src/main/java/com/fp/sessionbeans +svn://172.17.26.185/COMACO + + + +2015-06-23T07:18:19.905071Z +4129 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +helper +dir + +ejb +dir + diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/.svn/entries b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/.svn/entries new file mode 100644 index 0000000..e7dcac9 --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/.svn/entries @@ -0,0 +1,102 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb +svn://172.17.26.185/COMACO + + + +2015-06-23T07:18:19.905071Z +4129 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +cobis +dir + +interfaces +dir + +CrudBean.java +file + + + + +2022-07-28T03:40:45.002813Z +b174384b1a74441f11798dc16cdf2ff3 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2175 + +SequenceBean.java +file + + + + +2022-07-28T03:40:45.002813Z +3f7a2a5c214c4bef9613ff2c3a145e20 +2015-06-23T07:18:19.905071Z +4129 +cpiedra + + + + + + + + + + + + + + + + + + + + + +2232 + diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/.svn/text-base/CrudBean.java.svn-base b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/.svn/text-base/CrudBean.java.svn-base new file mode 100644 index 0000000..6ea87d4 --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/.svn/text-base/CrudBean.java.svn-base @@ -0,0 +1,96 @@ +package com.fp.sessionbeans.ejb; + +import java.util.List; + +import javax.ejb.Stateless; +import javax.ejb.TransactionManagement; +import javax.ejb.TransactionManagementType; +import javax.persistence.EntityManager; +import javax.persistence.EntityTransaction; + +import com.fp.dto.hb.HibernateBean; +import com.fp.sessionbeans.ejb.interfaces.CrudBeanLocal; + +/** + * Session Bean utilitario utilizada en insert de registros a la base. + * + * @author Jorge VAca. + * @version 2.1 + */ +@Stateless +@TransactionManagement(value = TransactionManagementType.BEAN) +public class CrudBean implements CrudBeanLocal { + + /** Version de la Clase */ + private static final long serialVersionUID = 1L; + + /** + * Metodo que entrega de grbar un registrp en la base haciendo commit. + * + * @param em + * Referencia a una session de base de datos. + * @param pBean + * Objeto a almacenar en la base de datos. + * @throws Exception + */ + public void insert(EntityManager em, HibernateBean pBean) throws Exception { + EntityTransaction tx = em.getTransaction(); + tx.begin(); + try { + em.persist(pBean); + tx.commit(); + } catch (Exception e) { + if (tx.isActive()) { + tx.rollback(); + } + throw e; + } finally { + try { + if (em.isOpen()) { + em.clear(); + em.close(); + } + } catch (Exception e) { + throw e; + } + } + } + + /** + * Metodo que entrega de grbar un registrp en la base haciendo commit. + * + * @param em + * Referencia a una session de base de datos. + * @param pLbean + * Lista con objetos a almacenar en la base de datos. + * @throws Exception + */ + public void insert(EntityManager em, List pLbean) + throws Exception { + EntityTransaction tx = em.getTransaction(); + tx.begin(); + try { + for (HibernateBean obj : pLbean) { + em.persist(obj); + } + tx.commit(); + } catch (Exception e) { + if (tx.isActive()) { + tx.rollback(); + } + throw e; + } finally { + try { + if (em.isOpen()) { + em.clear(); + em.close(); + } + } catch (Exception e) { + throw e; + } + } + } + + + +} diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/.svn/text-base/SequenceBean.java.svn-base b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/.svn/text-base/SequenceBean.java.svn-base new file mode 100644 index 0000000..c65343f --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/.svn/text-base/SequenceBean.java.svn-base @@ -0,0 +1,65 @@ +package com.fp.sessionbeans.ejb; + +import javax.ejb.Stateless; +import javax.ejb.TransactionManagement; +import javax.ejb.TransactionManagementType; +import javax.persistence.EntityManager; +import javax.persistence.EntityTransaction; + +import com.fp.common.helper.Constant; +import com.fp.persistence.pgeneral.seq.TgeneSequences; +import com.fp.sessionbeans.ejb.interfaces.SequenceBeanLocal; + +/** + * Session Bean que entrega el nuemero de secuenia, dado un codigo de secuencia. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@Stateless +@TransactionManagement(value = TransactionManagementType.BEAN) +public class SequenceBean implements SequenceBeanLocal { + /** + * Metodo que entrega el valor de uan secuencia, dado el codigo de sequencia. + * + * @param pSequenceCode Codigo de secuencia a obtener el numero de secuenia. + * @return Integer + * @throws Exception + */ + @Override + public Long getNextValueJta(EntityManager em, String pSequenceCode) throws Exception { + EntityTransaction tx = em.getTransaction(); + tx.begin(); + try { + Long sec = null; + TgeneSequences tgeneSequences = TgeneSequences.findWithLock(em, pSequenceCode); + tgeneSequences.setCurrentvalue(tgeneSequences.getCurrentvalue() + tgeneSequences.getIncrease()); + if (Constant.ifYes(tgeneSequences.getCyclic())) { + if (tgeneSequences.getCurrentvalue().compareTo(tgeneSequences.getLastvalue()) >= 0) { + tgeneSequences.setCurrentvalue(tgeneSequences.getInitialvalue()); + } + } + // update del registro + em.merge(tgeneSequences); + sec = Long.valueOf(tgeneSequences.getCurrentvalue().toString()); + tx.commit(); + return sec; + } catch (Exception e) { + if (tx.isActive()) { + tx.rollback(); + } + throw e; + } finally { + try { + if (em.isOpen()) { + em.clear(); + em.close(); + } + } catch (Exception e) { + throw e; + } + } + + } + +} diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/CrudBean.java b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/CrudBean.java new file mode 100644 index 0000000..6ea87d4 --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/CrudBean.java @@ -0,0 +1,96 @@ +package com.fp.sessionbeans.ejb; + +import java.util.List; + +import javax.ejb.Stateless; +import javax.ejb.TransactionManagement; +import javax.ejb.TransactionManagementType; +import javax.persistence.EntityManager; +import javax.persistence.EntityTransaction; + +import com.fp.dto.hb.HibernateBean; +import com.fp.sessionbeans.ejb.interfaces.CrudBeanLocal; + +/** + * Session Bean utilitario utilizada en insert de registros a la base. + * + * @author Jorge VAca. + * @version 2.1 + */ +@Stateless +@TransactionManagement(value = TransactionManagementType.BEAN) +public class CrudBean implements CrudBeanLocal { + + /** Version de la Clase */ + private static final long serialVersionUID = 1L; + + /** + * Metodo que entrega de grbar un registrp en la base haciendo commit. + * + * @param em + * Referencia a una session de base de datos. + * @param pBean + * Objeto a almacenar en la base de datos. + * @throws Exception + */ + public void insert(EntityManager em, HibernateBean pBean) throws Exception { + EntityTransaction tx = em.getTransaction(); + tx.begin(); + try { + em.persist(pBean); + tx.commit(); + } catch (Exception e) { + if (tx.isActive()) { + tx.rollback(); + } + throw e; + } finally { + try { + if (em.isOpen()) { + em.clear(); + em.close(); + } + } catch (Exception e) { + throw e; + } + } + } + + /** + * Metodo que entrega de grbar un registrp en la base haciendo commit. + * + * @param em + * Referencia a una session de base de datos. + * @param pLbean + * Lista con objetos a almacenar en la base de datos. + * @throws Exception + */ + public void insert(EntityManager em, List pLbean) + throws Exception { + EntityTransaction tx = em.getTransaction(); + tx.begin(); + try { + for (HibernateBean obj : pLbean) { + em.persist(obj); + } + tx.commit(); + } catch (Exception e) { + if (tx.isActive()) { + tx.rollback(); + } + throw e; + } finally { + try { + if (em.isOpen()) { + em.clear(); + em.close(); + } + } catch (Exception e) { + throw e; + } + } + } + + + +} diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/SequenceBean.java b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/SequenceBean.java new file mode 100644 index 0000000..c65343f --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/SequenceBean.java @@ -0,0 +1,65 @@ +package com.fp.sessionbeans.ejb; + +import javax.ejb.Stateless; +import javax.ejb.TransactionManagement; +import javax.ejb.TransactionManagementType; +import javax.persistence.EntityManager; +import javax.persistence.EntityTransaction; + +import com.fp.common.helper.Constant; +import com.fp.persistence.pgeneral.seq.TgeneSequences; +import com.fp.sessionbeans.ejb.interfaces.SequenceBeanLocal; + +/** + * Session Bean que entrega el nuemero de secuenia, dado un codigo de secuencia. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@Stateless +@TransactionManagement(value = TransactionManagementType.BEAN) +public class SequenceBean implements SequenceBeanLocal { + /** + * Metodo que entrega el valor de uan secuencia, dado el codigo de sequencia. + * + * @param pSequenceCode Codigo de secuencia a obtener el numero de secuenia. + * @return Integer + * @throws Exception + */ + @Override + public Long getNextValueJta(EntityManager em, String pSequenceCode) throws Exception { + EntityTransaction tx = em.getTransaction(); + tx.begin(); + try { + Long sec = null; + TgeneSequences tgeneSequences = TgeneSequences.findWithLock(em, pSequenceCode); + tgeneSequences.setCurrentvalue(tgeneSequences.getCurrentvalue() + tgeneSequences.getIncrease()); + if (Constant.ifYes(tgeneSequences.getCyclic())) { + if (tgeneSequences.getCurrentvalue().compareTo(tgeneSequences.getLastvalue()) >= 0) { + tgeneSequences.setCurrentvalue(tgeneSequences.getInitialvalue()); + } + } + // update del registro + em.merge(tgeneSequences); + sec = Long.valueOf(tgeneSequences.getCurrentvalue().toString()); + tx.commit(); + return sec; + } catch (Exception e) { + if (tx.isActive()) { + tx.rollback(); + } + throw e; + } finally { + try { + if (em.isOpen()) { + em.clear(); + em.close(); + } + } catch (Exception e) { + throw e; + } + } + + } + +} diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/cobis/.svn/entries b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/cobis/.svn/entries new file mode 100644 index 0000000..7da1a9b --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/cobis/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/cobis +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +CobisBean.java +file + + + + +2022-07-28T03:40:44.926812Z +d7a594c00fe8f9b5ad8cdc6a78448496 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +20333 + +ContabilizaCobisBean.java +file + + + + +2022-07-28T03:40:44.926812Z +5a70321309f1b63419331a219ce43c47 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7502 + diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/cobis/.svn/text-base/CobisBean.java.svn-base b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/cobis/.svn/text-base/CobisBean.java.svn-base new file mode 100644 index 0000000..48e7e4b --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/cobis/.svn/text-base/CobisBean.java.svn-base @@ -0,0 +1,497 @@ +package com.fp.sessionbeans.ejb.cobis; + +import java.sql.CallableStatement; +import java.sql.Connection; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.Types; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ejb.Stateless; +import javax.ejb.TransactionManagement; +import javax.ejb.TransactionManagementType; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; + +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; +import com.fp.sessionbeans.ejb.interfaces.CobisBeanLocal; + +/** + * Session Bean utilitario para obtener informacion de cobis. + * @author Jorge Vaca. + * @version 2.1 + */ +@Stateless +@TransactionManagement(value = TransactionManagementType.BEAN) +public class CobisBean implements CobisBeanLocal { + + /** + * Entrega una lista de clientes de Cobis. + * @return List> + * @throws Exception + */ + @Override + @SuppressWarnings("deprecation") + public List> getClientes(QueryBean queryBean) throws Exception { + EntityManagerFactory emf = null; + EntityManager em = null; + List> ldata = new ArrayList>(); + Integer page = queryBean.getPage(); + Integer rowsPerPage = queryBean.getPageSize(); + Connection connection = null; + ResultSet resultSet = null; + PreparedStatement preparedStatement = null; + try { + emf = Persistence.createEntityManagerFactory("cobis"); + em = emf.createEntityManager(); + //connection = ((Session) em.getDelegate()).connection(); + String SQL_CLIENT = "select en_ente, en_ced_ruc, en_nomlar, en_nombre, p_p_apellido, p_s_apellido, en_subtipo from cobis..cl_ente"; + SQL_CLIENT = this.getSentenceWithFilter(SQL_CLIENT, queryBean.getCriteria()); + List lcriteria = this.getCriteria(queryBean.getCriteria()); + preparedStatement = connection.prepareStatement(SQL_CLIENT + " order by en_nombre, p_p_apellido", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + for (int i = 0; i < lcriteria.size(); i++) { + Object value = lcriteria.get(i); + preparedStatement.setObject(i + 1, value); + } + resultSet = preparedStatement.executeQuery(); + if (page > 1) { + resultSet.setFetchSize(rowsPerPage + 1); + resultSet.absolute((page - 1) * rowsPerPage); + } + for (int i = 0; i < rowsPerPage; i++) { + if (!resultSet.next()) { + break; + } + ldata.add(this.getResulsetClientes(resultSet)); + } + } catch (Exception ex) { + throw ex; + } finally { + this.closeSesion(preparedStatement, resultSet, em,emf); + } + return ldata; + } + + /** + * Metodo que se encarga de consultar los datos para consultar el archivo + * @param corte + * @param fecha + * @return + * @throws Exception + */ + @Override + public List getDataSendFile(Integer corte, Date fecha) throws Exception { + List ldata = new ArrayList(); + EntityManagerFactory emf = null; + EntityManager em = null; + Connection connection = null; + ResultSet resultSet = null; + PreparedStatement preparedStatement = null; + try { + emf = Persistence.createEntityManagerFactory("cobis"); + em = emf.createEntityManager(); + //connection = ((Session) em.getDelegate()).connection(); + String SQL = + "SELECT ta_texto" + + " FROM cobis .. textos_ach" + + " WHERE ta_corte = ?" + + " AND ta_enviado = ?" + + " AND ta_fecha = ?" + + " ORDER BY ta_secuencial"; + preparedStatement = connection.prepareStatement(SQL, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + preparedStatement.setInt(1, corte); + preparedStatement.setString(2, "N"); + preparedStatement.setDate(3, fecha); + resultSet = preparedStatement.executeQuery(); + while (resultSet.next()) { + ldata.add(resultSet.getString(1)); + } + } catch (Exception ex) { + throw ex; + } finally { + this.closeSesion(preparedStatement, resultSet, em,emf); + } + return ldata; + } + + /** + * Metodo que obtiene los datos de la consulta + * @param resultSet + * @return Map + * @throws Exception + */ + private Map getResulsetClientes(ResultSet resultSet) throws Exception { + Map map = new HashMap(); + Object valor = resultSet.getObject("en_ente"); + map.put("en_ente", valor); + valor = resultSet.getObject("en_ced_ruc"); + map.put("en_ced_ruc", valor); + valor = resultSet.getObject("en_nomlar"); + map.put("en_nomlar", valor); + valor = resultSet.getObject("en_nombre"); + map.put("en_nombre", valor); + valor = resultSet.getObject("p_p_apellido"); + map.put("p_p_apellido", valor); + valor = resultSet.getObject("p_s_apellido"); + map.put("p_s_apellido", valor); + String tipopersona = (String) resultSet.getObject("en_subtipo"); + map.put("en_subtipo", tipopersona); + if (tipopersona.compareTo("C") == 0) { + valor = resultSet.getObject("en_nombre"); + } else { + valor = resultSet.getObject("en_nomlar"); + } + map.put("name", valor); + return map; + } + + /** + * Metodo que entrega una lista de cuentas de ahorro + * @param queryBean + * @return + * @throws Exception + */ + @Override + public List> getCuentasAhorro(QueryBean queryBean) throws Exception { + List> ldata = new ArrayList>(); + EntityManagerFactory emf = null; + EntityManager em = null; + Integer page = queryBean.getPage(); + Integer rowsPerPage = queryBean.getPageSize(); + Connection connection = null; + ResultSet resultSet = null; + PreparedStatement preparedStatement = null; + try { + emf = Persistence.createEntityManagerFactory("cobis"); + em = emf.createEntityManager(); + //connection = ((Session) em.getDelegate()).connection(); + String SQL_SAVING_ACCOUNT = "select ah_cuenta, rtrim(ah_cta_banco) as ah_cta_banco, ah_nombre, ah_cliente from cob_ahorros..ah_cuenta"; + SQL_SAVING_ACCOUNT = this.getSentenceWithFilter(SQL_SAVING_ACCOUNT, queryBean.getCriteria()); + List lcriteria = this.getCriteria(queryBean.getCriteria()); + preparedStatement = connection.prepareStatement(SQL_SAVING_ACCOUNT, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + for (int i = 0; i < lcriteria.size(); i++) { + Object value = lcriteria.get(i); + preparedStatement.setObject(i + 1, value); + } + resultSet = preparedStatement.executeQuery(); + if (page > 1) { + resultSet.setFetchSize(rowsPerPage + 1); + resultSet.absolute((page - 1) * rowsPerPage); + } + for (int i = 0; i < rowsPerPage; i++) { + if (!resultSet.next()) { + break; + } + ldata.add(this.getResulsetSavingsAccounts(resultSet)); + } + } catch (Exception ex) { + throw ex; + } finally { + this.closeSesion(preparedStatement, resultSet, em,emf); + } + return ldata; + } + + /** + * Metodo que obtiene los datos de la consulta + * @param resultSet + * @return Map + * @throws Exception + */ + private Map getResulsetSavingsAccounts(ResultSet resultSet) throws Exception { + Map map = new HashMap(); + Object valor = resultSet.getObject("ah_cuenta"); + map.put("ah_cuenta", valor); + valor = resultSet.getObject("ah_cta_banco"); + map.put("ah_cta_banco", valor); + valor = resultSet.getObject("ah_nombre"); + map.put("ah_nombre", valor); + valor = resultSet.getObject("ah_cliente"); + map.put("ah_cliente", valor); + return map; + } + + /** + * Metodo que obtiene los datos de la consulta + * @param resultSet + * @return Map + * @throws Exception + */ + private Map getResulsetCheckingAccounts(ResultSet resultSet) throws Exception { + Map map = new HashMap(); + Object valor = resultSet.getObject("cc_ctacte"); + map.put("cc_ctacte", valor); + valor = resultSet.getObject("cc_cta_banco"); + map.put("cc_cta_banco", valor); + valor = resultSet.getObject("cc_nombre"); + map.put("cc_nombre", valor); + valor = resultSet.getObject("cc_cliente"); + map.put("cc_cliente", valor); + return map; + } + + /** + * Metodo que entrega una lista de cuentas corrientes + * @param queryBean + * @return + * @throws Exception + */ + @Override + public List> getCuentasCorrientes(QueryBean queryBean) throws Exception { + List> ldata = new ArrayList>(); + Integer page = queryBean.getPage(); + Integer rowsPerPage = queryBean.getPageSize(); + EntityManagerFactory emf = null; + EntityManager em = null; + Connection connection = null; + ResultSet resultSet = null; + PreparedStatement preparedStatement = null; + try { + emf = Persistence.createEntityManagerFactory("cobis"); + em = emf.createEntityManager(); + //connection = ((Session) em.getDelegate()).connection(); + String SQL_CHECKING_ACCOUNT = "select cc_ctacte, rtrim(cc_cta_banco) as cc_cta_banco, cc_nombre, cc_cliente from cob_cuentas..cc_ctacte"; + SQL_CHECKING_ACCOUNT = this.getSentenceWithFilter(SQL_CHECKING_ACCOUNT, queryBean.getCriteria()); + List lcriteria = this.getCriteria(queryBean.getCriteria()); + preparedStatement = connection.prepareStatement(SQL_CHECKING_ACCOUNT, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + for (int i = 0; i < lcriteria.size(); i++) { + Object value = lcriteria.get(i); + preparedStatement.setObject(i + 1, value); + } + resultSet = preparedStatement.executeQuery(); + if (page > 1) { + resultSet.setFetchSize(rowsPerPage + 1); + resultSet.absolute((page - 1) * rowsPerPage); + } + for (int i = 0; i < rowsPerPage; i++) { + if (!resultSet.next()) { + break; + } + ldata.add(this.getResulsetCheckingAccounts(resultSet)); + } + } catch (Exception ex) { + throw ex; + } finally { + this.closeSesion(preparedStatement, resultSet, em,emf); + } + return ldata; + } + + /** + * Sentencia SQL con filtros si estos son enviados + * @param sentenceSQL + * @param lQueryCriteria + * @return + * @throws Exception + */ + private String getSentenceWithFilter(String sentenceSQL, List lQueryCriteria) throws Exception { + boolean isFirstCriteria = true; + for (int i = 0; i < lQueryCriteria.size(); i++) { + QueryCriteria queryCriteria = lQueryCriteria.get(i); + String attribute = queryCriteria.getProperty(); + Object value = queryCriteria.getValue(); + String operator = queryCriteria.getOperation(); + if (attribute != null && value != null && operator != null) { + if (isFirstCriteria) { + sentenceSQL += " where " + attribute + " " + operator + " ?"; + isFirstCriteria = false; + } else { + sentenceSQL += " and " + attribute + " " + operator + " ?"; + } + } + } + return sentenceSQL; + } + + /** + * Metodo que se encarga de obtener los criterios con los que se debe realizar la consulta + * @param lQueryCriteria + * @throws Exception + */ + protected List getCriteria(List lQueryCriteria) throws Exception { + List lCriteria = new ArrayList(); + for (int i = 0; i < lQueryCriteria.size(); i++) { + QueryCriteria queryCriteria = lQueryCriteria.get(i); + String attribute = queryCriteria.getProperty(); + Object value = queryCriteria.getValue(); + String operator = queryCriteria.getOperation(); + if (attribute != null && value != null && operator != null) { + lCriteria.add(value); + } + } + return lCriteria; + } + + /** + * Entrega datos del repositorio de cobis + * @param queryBean + * @return + * @throws Exception + */ + @Override + public List> getRepositorio(QueryBean queryBean) throws Exception { + List> ldata = new ArrayList>(); + Integer page = queryBean.getPage(); + Integer rowsPerPage = queryBean.getPageSize(); + EntityManagerFactory emf = null; + EntityManager em = null; + Connection connection = null; + ResultSet resultSet = null; + PreparedStatement preparedStatement = null; + try { + emf = Persistence.createEntityManagerFactory("cobis"); + em = emf.createEntityManager(); + //connection = ((Session) em.getDelegate()).connection(); + String SQL_REPOSITORIO = "select p.pd_descripcion as ea_producto,sum(r.ea_valor)as ea_valor,sum(ea_comision)as ea_comision from cobis..repositorio_ach t ,cobis..envios_ach_wfl r,cobis..cl_producto p"; + SQL_REPOSITORIO = this.getSentenceWithFilter(SQL_REPOSITORIO, queryBean.getCriteria()) + " and t.ra_secuencial=r.ea_sec_corte and t.ra_corte = r.ea_corte and r.ea_producto=p.pd_abreviatura and t.ra_estado ='P' group by p.pd_descripcion"; + List lcriteria = this.getCriteria(queryBean.getCriteria()); + preparedStatement = connection.prepareStatement(SQL_REPOSITORIO, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + for (int i = 0; i < lcriteria.size(); i++) { + Object value = lcriteria.get(i); + preparedStatement.setObject(i + 1, value); + } + resultSet = preparedStatement.executeQuery(); + if (page > 1) { + resultSet.setFetchSize(rowsPerPage + 1); + resultSet.absolute((page - 1) * rowsPerPage); + } + for (int i = 0; i < rowsPerPage; i++) { + if (!resultSet.next()) { + break; + } + ldata.add(this.getResulsetRepositorio(resultSet)); + } + } catch (Exception ex) { + throw ex; + } finally { + this.closeSesion(preparedStatement, resultSet, em,emf); + } + return ldata; + } + + /** + * Metodo que obtiene los datos de la consulta + * @param resultSet + * @return Map + * @throws Exception + */ + private Map getResulsetRepositorio(ResultSet resultSet) throws Exception { + Map map = new HashMap(); + Object valor = resultSet.getObject("ea_producto"); + if (valor.toString().compareTo("OPERACIONES ACH") == 0) { + valor = "OPERACIONES ACH-RECURRENTES"; + } + map.put("ea_producto", valor); + valor = resultSet.getObject("ea_valor"); + map.put("ea_valor", valor); + valor = resultSet.getObject("ea_comision"); + map.put("ea_comision", valor); + return map; + } + + /** + * Metodo que cierra sesiones a la base de datos abiertas + * @param preparedStatement + * @param resultSet + * @param entityManager + * @throws Exception + */ + private void closeSesion(PreparedStatement preparedStatement, ResultSet resultSet, EntityManager em,EntityManagerFactory emf) throws Exception { + if (resultSet != null) { + resultSet.close(); + } + if (preparedStatement != null) { + preparedStatement.close(); + } + if (em != null) { + try { + em.clear(); + } catch (Exception ex) { + } + em.clear(); + em.close(); + emf.close(); + } + } + + /** + * Metodo que cierra sesiones a la base de datos abiertas + * @param preparedStatement + * @param resultSet + * @param connection + * @throws Exception + */ + private void closeSesion(PreparedStatement preparedStatement, ResultSet resultSet, Connection connection) throws Exception { + if (preparedStatement != null) { + preparedStatement.close(); + } + if (resultSet != null) { + resultSet.close(); + } + if (connection != null) { + connection.close(); + } + } + + /** + * Metodo que llena la tabla textos_ach, con los datos de enviadas. + * @param pTransaction Codigo de transaccion con el cual se generan los textos ach. + * @param pOperation Codigo de operaicon. + * @return Map + * @throws Exception + */ + @Override + public Map generaTextoAch(Integer pTransaction, String pOperation) throws Exception { + EntityManagerFactory emf = null; + EntityManager em = null; + Connection c = null; + CallableStatement cs = null; + try { + emf = Persistence.createEntityManagerFactory("cobis"); + em = emf.createEntityManager(); + //c = ((Session) em.getDelegate()).connection(); + // c.setTransactionIsolation(Connection.TRANSACTION_NONE); + cs = c.prepareCall("{ call maia..sp_genera_texto_ach(?,?,?,?,?) }"); + cs.setInt(1, pTransaction);// Codigo de transaccion 2804 + cs.setString(2, pOperation);// Codigo de operacion "A" + cs.setInt(3, 0); //Numero de corte con el cual se genera el archivo texto de enviadas. + cs.setString(4, ""); // Codigo de resultado + cs.setString(5, ""); // Texto de resultado + // parametro de salida + cs.registerOutParameter(3, Types.INTEGER); + cs.registerOutParameter(4, Types.CHAR); + cs.registerOutParameter(5, Types.CHAR); + // ejecutar el SP + cs.execute(); + Integer corte = cs.getInt(3); + String cresultado = cs.getString(4); + String textoerror = cs.getString(5); + Map m = new HashMap(); + m.put("corte", corte); + m.put("cresultado", cresultado); + m.put("textoerror", textoerror); + return m; + } catch (Exception e) { + throw e; + } finally { + if (cs != null) { + cs.close(); + } + if (c != null) { + c.close(); + } + if (em != null) { + em.clear(); + em.close(); + emf.close(); + } + } + + } +} diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/cobis/.svn/text-base/ContabilizaCobisBean.java.svn-base b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/cobis/.svn/text-base/ContabilizaCobisBean.java.svn-base new file mode 100644 index 0000000..dea4616 --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/cobis/.svn/text-base/ContabilizaCobisBean.java.svn-base @@ -0,0 +1,185 @@ +package com.fp.sessionbeans.ejb.cobis; + +import java.math.BigDecimal; +import java.sql.CallableStatement; +import java.sql.Connection; +import java.sql.Date; +import java.sql.Types; + +import javax.ejb.Stateless; +import javax.ejb.TransactionManagement; +import javax.ejb.TransactionManagementType; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; + +import com.fp.ach.exception.AchException; +import com.fp.dto.save.SaveRequest; +import com.fp.sessionbeans.ejb.interfaces.ContabilizaCobisLocal; + +/** + * Session Bean utilitario para obtener informacion de cobis. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@Stateless +@TransactionManagement(value = TransactionManagementType.BEAN) +public class ContabilizaCobisBean implements ContabilizaCobisLocal { + + /** + * Metodo que ejecuta la transaccion en cobis. + * + * @param pSaveRequest Mensaje de entrada de ejecucion de la transaccion. + * @param pAmount Monto de la afectacion contable. + * @param pCurrency MOneda de la afectacion contable. + * @param pProfile Perfil de afectacion contable. + * @param pServer Codigo de servidor cobis con el que se ejecuta una + * transaccion. + * @param pOffcie Codigo de oficina cobis con la que se ejecuta la + * transaccion. + * @throws Exception + */ + @SuppressWarnings("deprecation") + @Override + public void process(SaveRequest pSaveRequest, BigDecimal pAmount, Integer pCurrency, String pProfile, + String pServer, Integer pOffcie, Integer pArea) throws Exception { + EntityManagerFactory emf = null; + EntityManager em = null; + Connection c = null; + CallableStatement cs = null; + try { + emf = Persistence.createEntityManagerFactory("cobis"); + em = emf.createEntityManager(); + //c = ((Session) em.getDelegate()).connection(); + // c.setTransactionIsolation(Connection.TRANSACTION_NONE); + cs = c.prepareCall("{ call maia..sp_contabiliza(?,?,?,?,?,?,?,?,?,?,?) }"); + this.fillParameters(pSaveRequest, cs, pAmount, pCurrency, pProfile, pServer, pOffcie, pArea); + // ejecutar el SP + cs.execute(); + String cresultado = cs.getString(10); + if (cresultado.compareTo("0") == 0) { + return; + } + String textoerror = cs.getString(11); + throw new AchException(cresultado, textoerror); + } catch (Exception e) { + throw e; + } finally { + if (cs != null) { + cs.close(); + } + if (em != null) { + em.clear(); + em.close(); + emf.close(); + } + } + } + + /** + * Metodo que fija los parametros necesarios para ejecutar el proceso de + * base. + * + * @param pSaveRequest Mensaje de entrada de ejecucion de la transaccion. + * @param pEntryDetail Datos del registro a procesar. + * @param cs Referencia a CallableStatement + * @throws Exception + */ + private void fillParameters(SaveRequest pSaveRequest, CallableStatement cs, BigDecimal pAmount, Integer pCurrency, + String pProfile, String pServer, Integer pOffcie, Integer pArea) throws Exception { + cs.setString(1, pServer); // Nombre del servidor COBIS + cs.setInt(2, pOffcie); // Oficina COBIS + cs.setString(3, pSaveRequest.getUser()); // Usuario + cs.setString(4, "127.0.0.1"); // Terminal + cs.setBigDecimal(5, pAmount); // MOnto de la transacion + cs.setInt(6, pCurrency);// MOneda 0 = U.S. + cs.setString(7, pProfile);// Fecha proceso de Cobis + cs.setInt(8, pArea);// area + cs.setString(9, "");// Glosa del comprobante + cs.setString(10, ""); // Codigo de resultado + cs.setString(11, ""); // Texto de resultado + // parametro de salida + cs.registerOutParameter(10, Types.CHAR); + cs.registerOutParameter(11, Types.CHAR); + } + + /** + * Metodo que se encarga de contabilizar valores del repositorio unico. + * + * @param pSaveRequest Datos del request original. + * @param pServer Nombre del servidor cobis. + * @param pOffcie Codigo de oficina. + * @param pDate Fecha de contabilizacion. + * @param pUser Codigo de usuario. + * @param pTransaction Codigo de transaccion cobis 2804, + * @param pOperation Codigo de operacion "C" + * @param pProduct Codigo de producto ach 33 + * @throws Exception + */ + @SuppressWarnings("deprecation") + @Override + public void processRepository(SaveRequest pSaveRequest, String pServer, Integer pOffcie, Date pDate, String pUser, + Integer pTransaction, String pOperation, Integer pProduct) throws Exception { + EntityManagerFactory emf = null; + EntityManager em = null; + Connection c = null; + CallableStatement cs = null; + try { + emf = Persistence.createEntityManagerFactory("cobis"); + em = emf.createEntityManager(); + //c = ((Session) em.getDelegate()).connection(); + // c.setTransactionIsolation(Connection.TRANSACTION_NONE); + cs = c.prepareCall("{ call maia..sp_afecta_conta_ach(?,?,?,?,?,?,?,?,?) }"); + this.fillParameters(cs, pServer, pOffcie, pDate, pUser, pTransaction, pOperation, pProduct); + // ejecutar el SP + cs.execute(); + c.close(); + String cresultado = cs.getString(8); + if (cresultado.compareTo("0") == 0) { + return; + } + String textoerror = cs.getString(9); + throw new AchException(cresultado, textoerror); + } catch (Exception e) { + throw e; + } finally { + if (cs != null) { + cs.close(); + } + if (em != null) { + em.clear(); + em.close(); + emf.close(); + } + } + } + + /** + * Fija parametros en el CallableStatement. + * @param cs Objeto utilizado para la ejecucion del sp de cobis. + * @param pServer Nombre del servidor cobis. + * @param pOffcie Codigo de oficina. + * @param pDate Fecha de contabilizacion. + * @param pUser Codigo de usuario. + * @param pTransaction Codigo de transaccion cobis 2804, + * @param pOperation Codigo de operacion "C" + * @param pProduct Codigo de producto ach 33 + * @throws Exception + */ + private void fillParameters(CallableStatement cs, String pServer, Integer pOffcie, Date pDate, String pUser, + Integer pTransaction, String pOperation, Integer pProduct) throws Exception { + cs.setString(1, pServer); // Nombre del servidor COBIS + cs.setInt(2, pOffcie); // Oficina COBIS + cs.setDate(3, pDate); // Fecha + cs.setString(4, pUser); // Usuario + cs.setInt(5, pTransaction); // Codigo de transaccion + cs.setString(6, pOperation);// Codigo de operacion + cs.setInt(7, pProduct);// area + cs.setString(8, ""); // Codigo de resultado + cs.setString(9, ""); // Texto de resultado + // parametro de salida + cs.registerOutParameter(8, Types.CHAR); + cs.registerOutParameter(9, Types.CHAR); + } +} diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/cobis/CobisBean.java b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/cobis/CobisBean.java new file mode 100644 index 0000000..48e7e4b --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/cobis/CobisBean.java @@ -0,0 +1,497 @@ +package com.fp.sessionbeans.ejb.cobis; + +import java.sql.CallableStatement; +import java.sql.Connection; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.Types; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ejb.Stateless; +import javax.ejb.TransactionManagement; +import javax.ejb.TransactionManagementType; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; + +import com.fp.dto.query.QueryBean; +import com.fp.dto.query.QueryCriteria; +import com.fp.sessionbeans.ejb.interfaces.CobisBeanLocal; + +/** + * Session Bean utilitario para obtener informacion de cobis. + * @author Jorge Vaca. + * @version 2.1 + */ +@Stateless +@TransactionManagement(value = TransactionManagementType.BEAN) +public class CobisBean implements CobisBeanLocal { + + /** + * Entrega una lista de clientes de Cobis. + * @return List> + * @throws Exception + */ + @Override + @SuppressWarnings("deprecation") + public List> getClientes(QueryBean queryBean) throws Exception { + EntityManagerFactory emf = null; + EntityManager em = null; + List> ldata = new ArrayList>(); + Integer page = queryBean.getPage(); + Integer rowsPerPage = queryBean.getPageSize(); + Connection connection = null; + ResultSet resultSet = null; + PreparedStatement preparedStatement = null; + try { + emf = Persistence.createEntityManagerFactory("cobis"); + em = emf.createEntityManager(); + //connection = ((Session) em.getDelegate()).connection(); + String SQL_CLIENT = "select en_ente, en_ced_ruc, en_nomlar, en_nombre, p_p_apellido, p_s_apellido, en_subtipo from cobis..cl_ente"; + SQL_CLIENT = this.getSentenceWithFilter(SQL_CLIENT, queryBean.getCriteria()); + List lcriteria = this.getCriteria(queryBean.getCriteria()); + preparedStatement = connection.prepareStatement(SQL_CLIENT + " order by en_nombre, p_p_apellido", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + for (int i = 0; i < lcriteria.size(); i++) { + Object value = lcriteria.get(i); + preparedStatement.setObject(i + 1, value); + } + resultSet = preparedStatement.executeQuery(); + if (page > 1) { + resultSet.setFetchSize(rowsPerPage + 1); + resultSet.absolute((page - 1) * rowsPerPage); + } + for (int i = 0; i < rowsPerPage; i++) { + if (!resultSet.next()) { + break; + } + ldata.add(this.getResulsetClientes(resultSet)); + } + } catch (Exception ex) { + throw ex; + } finally { + this.closeSesion(preparedStatement, resultSet, em,emf); + } + return ldata; + } + + /** + * Metodo que se encarga de consultar los datos para consultar el archivo + * @param corte + * @param fecha + * @return + * @throws Exception + */ + @Override + public List getDataSendFile(Integer corte, Date fecha) throws Exception { + List ldata = new ArrayList(); + EntityManagerFactory emf = null; + EntityManager em = null; + Connection connection = null; + ResultSet resultSet = null; + PreparedStatement preparedStatement = null; + try { + emf = Persistence.createEntityManagerFactory("cobis"); + em = emf.createEntityManager(); + //connection = ((Session) em.getDelegate()).connection(); + String SQL = + "SELECT ta_texto" + + " FROM cobis .. textos_ach" + + " WHERE ta_corte = ?" + + " AND ta_enviado = ?" + + " AND ta_fecha = ?" + + " ORDER BY ta_secuencial"; + preparedStatement = connection.prepareStatement(SQL, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + preparedStatement.setInt(1, corte); + preparedStatement.setString(2, "N"); + preparedStatement.setDate(3, fecha); + resultSet = preparedStatement.executeQuery(); + while (resultSet.next()) { + ldata.add(resultSet.getString(1)); + } + } catch (Exception ex) { + throw ex; + } finally { + this.closeSesion(preparedStatement, resultSet, em,emf); + } + return ldata; + } + + /** + * Metodo que obtiene los datos de la consulta + * @param resultSet + * @return Map + * @throws Exception + */ + private Map getResulsetClientes(ResultSet resultSet) throws Exception { + Map map = new HashMap(); + Object valor = resultSet.getObject("en_ente"); + map.put("en_ente", valor); + valor = resultSet.getObject("en_ced_ruc"); + map.put("en_ced_ruc", valor); + valor = resultSet.getObject("en_nomlar"); + map.put("en_nomlar", valor); + valor = resultSet.getObject("en_nombre"); + map.put("en_nombre", valor); + valor = resultSet.getObject("p_p_apellido"); + map.put("p_p_apellido", valor); + valor = resultSet.getObject("p_s_apellido"); + map.put("p_s_apellido", valor); + String tipopersona = (String) resultSet.getObject("en_subtipo"); + map.put("en_subtipo", tipopersona); + if (tipopersona.compareTo("C") == 0) { + valor = resultSet.getObject("en_nombre"); + } else { + valor = resultSet.getObject("en_nomlar"); + } + map.put("name", valor); + return map; + } + + /** + * Metodo que entrega una lista de cuentas de ahorro + * @param queryBean + * @return + * @throws Exception + */ + @Override + public List> getCuentasAhorro(QueryBean queryBean) throws Exception { + List> ldata = new ArrayList>(); + EntityManagerFactory emf = null; + EntityManager em = null; + Integer page = queryBean.getPage(); + Integer rowsPerPage = queryBean.getPageSize(); + Connection connection = null; + ResultSet resultSet = null; + PreparedStatement preparedStatement = null; + try { + emf = Persistence.createEntityManagerFactory("cobis"); + em = emf.createEntityManager(); + //connection = ((Session) em.getDelegate()).connection(); + String SQL_SAVING_ACCOUNT = "select ah_cuenta, rtrim(ah_cta_banco) as ah_cta_banco, ah_nombre, ah_cliente from cob_ahorros..ah_cuenta"; + SQL_SAVING_ACCOUNT = this.getSentenceWithFilter(SQL_SAVING_ACCOUNT, queryBean.getCriteria()); + List lcriteria = this.getCriteria(queryBean.getCriteria()); + preparedStatement = connection.prepareStatement(SQL_SAVING_ACCOUNT, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + for (int i = 0; i < lcriteria.size(); i++) { + Object value = lcriteria.get(i); + preparedStatement.setObject(i + 1, value); + } + resultSet = preparedStatement.executeQuery(); + if (page > 1) { + resultSet.setFetchSize(rowsPerPage + 1); + resultSet.absolute((page - 1) * rowsPerPage); + } + for (int i = 0; i < rowsPerPage; i++) { + if (!resultSet.next()) { + break; + } + ldata.add(this.getResulsetSavingsAccounts(resultSet)); + } + } catch (Exception ex) { + throw ex; + } finally { + this.closeSesion(preparedStatement, resultSet, em,emf); + } + return ldata; + } + + /** + * Metodo que obtiene los datos de la consulta + * @param resultSet + * @return Map + * @throws Exception + */ + private Map getResulsetSavingsAccounts(ResultSet resultSet) throws Exception { + Map map = new HashMap(); + Object valor = resultSet.getObject("ah_cuenta"); + map.put("ah_cuenta", valor); + valor = resultSet.getObject("ah_cta_banco"); + map.put("ah_cta_banco", valor); + valor = resultSet.getObject("ah_nombre"); + map.put("ah_nombre", valor); + valor = resultSet.getObject("ah_cliente"); + map.put("ah_cliente", valor); + return map; + } + + /** + * Metodo que obtiene los datos de la consulta + * @param resultSet + * @return Map + * @throws Exception + */ + private Map getResulsetCheckingAccounts(ResultSet resultSet) throws Exception { + Map map = new HashMap(); + Object valor = resultSet.getObject("cc_ctacte"); + map.put("cc_ctacte", valor); + valor = resultSet.getObject("cc_cta_banco"); + map.put("cc_cta_banco", valor); + valor = resultSet.getObject("cc_nombre"); + map.put("cc_nombre", valor); + valor = resultSet.getObject("cc_cliente"); + map.put("cc_cliente", valor); + return map; + } + + /** + * Metodo que entrega una lista de cuentas corrientes + * @param queryBean + * @return + * @throws Exception + */ + @Override + public List> getCuentasCorrientes(QueryBean queryBean) throws Exception { + List> ldata = new ArrayList>(); + Integer page = queryBean.getPage(); + Integer rowsPerPage = queryBean.getPageSize(); + EntityManagerFactory emf = null; + EntityManager em = null; + Connection connection = null; + ResultSet resultSet = null; + PreparedStatement preparedStatement = null; + try { + emf = Persistence.createEntityManagerFactory("cobis"); + em = emf.createEntityManager(); + //connection = ((Session) em.getDelegate()).connection(); + String SQL_CHECKING_ACCOUNT = "select cc_ctacte, rtrim(cc_cta_banco) as cc_cta_banco, cc_nombre, cc_cliente from cob_cuentas..cc_ctacte"; + SQL_CHECKING_ACCOUNT = this.getSentenceWithFilter(SQL_CHECKING_ACCOUNT, queryBean.getCriteria()); + List lcriteria = this.getCriteria(queryBean.getCriteria()); + preparedStatement = connection.prepareStatement(SQL_CHECKING_ACCOUNT, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + for (int i = 0; i < lcriteria.size(); i++) { + Object value = lcriteria.get(i); + preparedStatement.setObject(i + 1, value); + } + resultSet = preparedStatement.executeQuery(); + if (page > 1) { + resultSet.setFetchSize(rowsPerPage + 1); + resultSet.absolute((page - 1) * rowsPerPage); + } + for (int i = 0; i < rowsPerPage; i++) { + if (!resultSet.next()) { + break; + } + ldata.add(this.getResulsetCheckingAccounts(resultSet)); + } + } catch (Exception ex) { + throw ex; + } finally { + this.closeSesion(preparedStatement, resultSet, em,emf); + } + return ldata; + } + + /** + * Sentencia SQL con filtros si estos son enviados + * @param sentenceSQL + * @param lQueryCriteria + * @return + * @throws Exception + */ + private String getSentenceWithFilter(String sentenceSQL, List lQueryCriteria) throws Exception { + boolean isFirstCriteria = true; + for (int i = 0; i < lQueryCriteria.size(); i++) { + QueryCriteria queryCriteria = lQueryCriteria.get(i); + String attribute = queryCriteria.getProperty(); + Object value = queryCriteria.getValue(); + String operator = queryCriteria.getOperation(); + if (attribute != null && value != null && operator != null) { + if (isFirstCriteria) { + sentenceSQL += " where " + attribute + " " + operator + " ?"; + isFirstCriteria = false; + } else { + sentenceSQL += " and " + attribute + " " + operator + " ?"; + } + } + } + return sentenceSQL; + } + + /** + * Metodo que se encarga de obtener los criterios con los que se debe realizar la consulta + * @param lQueryCriteria + * @throws Exception + */ + protected List getCriteria(List lQueryCriteria) throws Exception { + List lCriteria = new ArrayList(); + for (int i = 0; i < lQueryCriteria.size(); i++) { + QueryCriteria queryCriteria = lQueryCriteria.get(i); + String attribute = queryCriteria.getProperty(); + Object value = queryCriteria.getValue(); + String operator = queryCriteria.getOperation(); + if (attribute != null && value != null && operator != null) { + lCriteria.add(value); + } + } + return lCriteria; + } + + /** + * Entrega datos del repositorio de cobis + * @param queryBean + * @return + * @throws Exception + */ + @Override + public List> getRepositorio(QueryBean queryBean) throws Exception { + List> ldata = new ArrayList>(); + Integer page = queryBean.getPage(); + Integer rowsPerPage = queryBean.getPageSize(); + EntityManagerFactory emf = null; + EntityManager em = null; + Connection connection = null; + ResultSet resultSet = null; + PreparedStatement preparedStatement = null; + try { + emf = Persistence.createEntityManagerFactory("cobis"); + em = emf.createEntityManager(); + //connection = ((Session) em.getDelegate()).connection(); + String SQL_REPOSITORIO = "select p.pd_descripcion as ea_producto,sum(r.ea_valor)as ea_valor,sum(ea_comision)as ea_comision from cobis..repositorio_ach t ,cobis..envios_ach_wfl r,cobis..cl_producto p"; + SQL_REPOSITORIO = this.getSentenceWithFilter(SQL_REPOSITORIO, queryBean.getCriteria()) + " and t.ra_secuencial=r.ea_sec_corte and t.ra_corte = r.ea_corte and r.ea_producto=p.pd_abreviatura and t.ra_estado ='P' group by p.pd_descripcion"; + List lcriteria = this.getCriteria(queryBean.getCriteria()); + preparedStatement = connection.prepareStatement(SQL_REPOSITORIO, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + for (int i = 0; i < lcriteria.size(); i++) { + Object value = lcriteria.get(i); + preparedStatement.setObject(i + 1, value); + } + resultSet = preparedStatement.executeQuery(); + if (page > 1) { + resultSet.setFetchSize(rowsPerPage + 1); + resultSet.absolute((page - 1) * rowsPerPage); + } + for (int i = 0; i < rowsPerPage; i++) { + if (!resultSet.next()) { + break; + } + ldata.add(this.getResulsetRepositorio(resultSet)); + } + } catch (Exception ex) { + throw ex; + } finally { + this.closeSesion(preparedStatement, resultSet, em,emf); + } + return ldata; + } + + /** + * Metodo que obtiene los datos de la consulta + * @param resultSet + * @return Map + * @throws Exception + */ + private Map getResulsetRepositorio(ResultSet resultSet) throws Exception { + Map map = new HashMap(); + Object valor = resultSet.getObject("ea_producto"); + if (valor.toString().compareTo("OPERACIONES ACH") == 0) { + valor = "OPERACIONES ACH-RECURRENTES"; + } + map.put("ea_producto", valor); + valor = resultSet.getObject("ea_valor"); + map.put("ea_valor", valor); + valor = resultSet.getObject("ea_comision"); + map.put("ea_comision", valor); + return map; + } + + /** + * Metodo que cierra sesiones a la base de datos abiertas + * @param preparedStatement + * @param resultSet + * @param entityManager + * @throws Exception + */ + private void closeSesion(PreparedStatement preparedStatement, ResultSet resultSet, EntityManager em,EntityManagerFactory emf) throws Exception { + if (resultSet != null) { + resultSet.close(); + } + if (preparedStatement != null) { + preparedStatement.close(); + } + if (em != null) { + try { + em.clear(); + } catch (Exception ex) { + } + em.clear(); + em.close(); + emf.close(); + } + } + + /** + * Metodo que cierra sesiones a la base de datos abiertas + * @param preparedStatement + * @param resultSet + * @param connection + * @throws Exception + */ + private void closeSesion(PreparedStatement preparedStatement, ResultSet resultSet, Connection connection) throws Exception { + if (preparedStatement != null) { + preparedStatement.close(); + } + if (resultSet != null) { + resultSet.close(); + } + if (connection != null) { + connection.close(); + } + } + + /** + * Metodo que llena la tabla textos_ach, con los datos de enviadas. + * @param pTransaction Codigo de transaccion con el cual se generan los textos ach. + * @param pOperation Codigo de operaicon. + * @return Map + * @throws Exception + */ + @Override + public Map generaTextoAch(Integer pTransaction, String pOperation) throws Exception { + EntityManagerFactory emf = null; + EntityManager em = null; + Connection c = null; + CallableStatement cs = null; + try { + emf = Persistence.createEntityManagerFactory("cobis"); + em = emf.createEntityManager(); + //c = ((Session) em.getDelegate()).connection(); + // c.setTransactionIsolation(Connection.TRANSACTION_NONE); + cs = c.prepareCall("{ call maia..sp_genera_texto_ach(?,?,?,?,?) }"); + cs.setInt(1, pTransaction);// Codigo de transaccion 2804 + cs.setString(2, pOperation);// Codigo de operacion "A" + cs.setInt(3, 0); //Numero de corte con el cual se genera el archivo texto de enviadas. + cs.setString(4, ""); // Codigo de resultado + cs.setString(5, ""); // Texto de resultado + // parametro de salida + cs.registerOutParameter(3, Types.INTEGER); + cs.registerOutParameter(4, Types.CHAR); + cs.registerOutParameter(5, Types.CHAR); + // ejecutar el SP + cs.execute(); + Integer corte = cs.getInt(3); + String cresultado = cs.getString(4); + String textoerror = cs.getString(5); + Map m = new HashMap(); + m.put("corte", corte); + m.put("cresultado", cresultado); + m.put("textoerror", textoerror); + return m; + } catch (Exception e) { + throw e; + } finally { + if (cs != null) { + cs.close(); + } + if (c != null) { + c.close(); + } + if (em != null) { + em.clear(); + em.close(); + emf.close(); + } + } + + } +} diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/cobis/ContabilizaCobisBean.java b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/cobis/ContabilizaCobisBean.java new file mode 100644 index 0000000..dea4616 --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/cobis/ContabilizaCobisBean.java @@ -0,0 +1,185 @@ +package com.fp.sessionbeans.ejb.cobis; + +import java.math.BigDecimal; +import java.sql.CallableStatement; +import java.sql.Connection; +import java.sql.Date; +import java.sql.Types; + +import javax.ejb.Stateless; +import javax.ejb.TransactionManagement; +import javax.ejb.TransactionManagementType; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; + +import com.fp.ach.exception.AchException; +import com.fp.dto.save.SaveRequest; +import com.fp.sessionbeans.ejb.interfaces.ContabilizaCobisLocal; + +/** + * Session Bean utilitario para obtener informacion de cobis. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@Stateless +@TransactionManagement(value = TransactionManagementType.BEAN) +public class ContabilizaCobisBean implements ContabilizaCobisLocal { + + /** + * Metodo que ejecuta la transaccion en cobis. + * + * @param pSaveRequest Mensaje de entrada de ejecucion de la transaccion. + * @param pAmount Monto de la afectacion contable. + * @param pCurrency MOneda de la afectacion contable. + * @param pProfile Perfil de afectacion contable. + * @param pServer Codigo de servidor cobis con el que se ejecuta una + * transaccion. + * @param pOffcie Codigo de oficina cobis con la que se ejecuta la + * transaccion. + * @throws Exception + */ + @SuppressWarnings("deprecation") + @Override + public void process(SaveRequest pSaveRequest, BigDecimal pAmount, Integer pCurrency, String pProfile, + String pServer, Integer pOffcie, Integer pArea) throws Exception { + EntityManagerFactory emf = null; + EntityManager em = null; + Connection c = null; + CallableStatement cs = null; + try { + emf = Persistence.createEntityManagerFactory("cobis"); + em = emf.createEntityManager(); + //c = ((Session) em.getDelegate()).connection(); + // c.setTransactionIsolation(Connection.TRANSACTION_NONE); + cs = c.prepareCall("{ call maia..sp_contabiliza(?,?,?,?,?,?,?,?,?,?,?) }"); + this.fillParameters(pSaveRequest, cs, pAmount, pCurrency, pProfile, pServer, pOffcie, pArea); + // ejecutar el SP + cs.execute(); + String cresultado = cs.getString(10); + if (cresultado.compareTo("0") == 0) { + return; + } + String textoerror = cs.getString(11); + throw new AchException(cresultado, textoerror); + } catch (Exception e) { + throw e; + } finally { + if (cs != null) { + cs.close(); + } + if (em != null) { + em.clear(); + em.close(); + emf.close(); + } + } + } + + /** + * Metodo que fija los parametros necesarios para ejecutar el proceso de + * base. + * + * @param pSaveRequest Mensaje de entrada de ejecucion de la transaccion. + * @param pEntryDetail Datos del registro a procesar. + * @param cs Referencia a CallableStatement + * @throws Exception + */ + private void fillParameters(SaveRequest pSaveRequest, CallableStatement cs, BigDecimal pAmount, Integer pCurrency, + String pProfile, String pServer, Integer pOffcie, Integer pArea) throws Exception { + cs.setString(1, pServer); // Nombre del servidor COBIS + cs.setInt(2, pOffcie); // Oficina COBIS + cs.setString(3, pSaveRequest.getUser()); // Usuario + cs.setString(4, "127.0.0.1"); // Terminal + cs.setBigDecimal(5, pAmount); // MOnto de la transacion + cs.setInt(6, pCurrency);// MOneda 0 = U.S. + cs.setString(7, pProfile);// Fecha proceso de Cobis + cs.setInt(8, pArea);// area + cs.setString(9, "");// Glosa del comprobante + cs.setString(10, ""); // Codigo de resultado + cs.setString(11, ""); // Texto de resultado + // parametro de salida + cs.registerOutParameter(10, Types.CHAR); + cs.registerOutParameter(11, Types.CHAR); + } + + /** + * Metodo que se encarga de contabilizar valores del repositorio unico. + * + * @param pSaveRequest Datos del request original. + * @param pServer Nombre del servidor cobis. + * @param pOffcie Codigo de oficina. + * @param pDate Fecha de contabilizacion. + * @param pUser Codigo de usuario. + * @param pTransaction Codigo de transaccion cobis 2804, + * @param pOperation Codigo de operacion "C" + * @param pProduct Codigo de producto ach 33 + * @throws Exception + */ + @SuppressWarnings("deprecation") + @Override + public void processRepository(SaveRequest pSaveRequest, String pServer, Integer pOffcie, Date pDate, String pUser, + Integer pTransaction, String pOperation, Integer pProduct) throws Exception { + EntityManagerFactory emf = null; + EntityManager em = null; + Connection c = null; + CallableStatement cs = null; + try { + emf = Persistence.createEntityManagerFactory("cobis"); + em = emf.createEntityManager(); + //c = ((Session) em.getDelegate()).connection(); + // c.setTransactionIsolation(Connection.TRANSACTION_NONE); + cs = c.prepareCall("{ call maia..sp_afecta_conta_ach(?,?,?,?,?,?,?,?,?) }"); + this.fillParameters(cs, pServer, pOffcie, pDate, pUser, pTransaction, pOperation, pProduct); + // ejecutar el SP + cs.execute(); + c.close(); + String cresultado = cs.getString(8); + if (cresultado.compareTo("0") == 0) { + return; + } + String textoerror = cs.getString(9); + throw new AchException(cresultado, textoerror); + } catch (Exception e) { + throw e; + } finally { + if (cs != null) { + cs.close(); + } + if (em != null) { + em.clear(); + em.close(); + emf.close(); + } + } + } + + /** + * Fija parametros en el CallableStatement. + * @param cs Objeto utilizado para la ejecucion del sp de cobis. + * @param pServer Nombre del servidor cobis. + * @param pOffcie Codigo de oficina. + * @param pDate Fecha de contabilizacion. + * @param pUser Codigo de usuario. + * @param pTransaction Codigo de transaccion cobis 2804, + * @param pOperation Codigo de operacion "C" + * @param pProduct Codigo de producto ach 33 + * @throws Exception + */ + private void fillParameters(CallableStatement cs, String pServer, Integer pOffcie, Date pDate, String pUser, + Integer pTransaction, String pOperation, Integer pProduct) throws Exception { + cs.setString(1, pServer); // Nombre del servidor COBIS + cs.setInt(2, pOffcie); // Oficina COBIS + cs.setDate(3, pDate); // Fecha + cs.setString(4, pUser); // Usuario + cs.setInt(5, pTransaction); // Codigo de transaccion + cs.setString(6, pOperation);// Codigo de operacion + cs.setInt(7, pProduct);// area + cs.setString(8, ""); // Codigo de resultado + cs.setString(9, ""); // Texto de resultado + // parametro de salida + cs.registerOutParameter(8, Types.CHAR); + cs.registerOutParameter(9, Types.CHAR); + } +} diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/.svn/entries b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/.svn/entries new file mode 100644 index 0000000..34b5511 --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/.svn/entries @@ -0,0 +1,167 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces +svn://172.17.26.185/COMACO + + + +2015-06-23T07:18:19.905071Z +4129 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +cobis +dir + +CobisBeanLocal.java +file + + + + +2022-07-28T03:40:44.972813Z +03ba13e48501e09f95e94c868a699b84 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1995 + +SequenceBeanLocal.java +file + + + + +2022-07-28T03:40:44.972813Z +5ff80288e36d62020f6f08f47f67ff6d +2015-06-23T07:18:19.905071Z +4129 +cpiedra + + + + + + + + + + + + + + + + + + + + + +577 + +ContabilizaCobisLocal.java +file + + + + +2022-07-28T03:40:44.973813Z +7d1fda2664cc0394032479c9e985075a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1743 + +CrudBeanLocal.java +file + + + + +2022-07-28T03:40:44.973813Z +06583af84078adcfc4dae13dc361e575 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +956 + diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/.svn/text-base/CobisBeanLocal.java.svn-base b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/.svn/text-base/CobisBeanLocal.java.svn-base new file mode 100644 index 0000000..7618652 --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/.svn/text-base/CobisBeanLocal.java.svn-base @@ -0,0 +1,67 @@ +package com.fp.sessionbeans.ejb.interfaces; + +import java.util.List; +import java.util.Map; + +import javax.ejb.Local; + +import com.fp.dto.query.QueryBean; +import java.sql.Date; + +/** + * Interface de ejb de de consulta de informacion en cobis. + * @author Jorge Vaca. + * @version 2.1 + */ +@Local +public interface CobisBeanLocal { + + /** + * Entrega una lista de clientes de Cobis. + * @return List> + * @throws Exception + */ + public List> getClientes(QueryBean queryBean) throws Exception; + + /** + * Entrega una lista de cuentas de ahorro de Cobis. + * @return List> + * @throws Exception + */ + public List> getCuentasAhorro(QueryBean queryBean) throws Exception; + + /** + * Entrega una lista de cuentas de corriente de Cobis. + * @return List> + * @throws Exception + */ + public List> getCuentasCorrientes(QueryBean queryBean) throws Exception; + + /** + * Entrega la consulta del repositorio_ach de cobis + * @param queryBean + * @return List> + * @throws Exception + */ + public List> getRepositorio(QueryBean queryBean) throws Exception; + + /** + * Metodo que devuelve la informacion para el archivo de enviadas + * @param corte + * @param fecha + * @return + * @throws Exception + */ + public List getDataSendFile(Integer corte, Date fecha) throws Exception; + + /** + * Metodo que llena la tabla textos_ach, con los datos de enviadas. + * @param pTransaction Codigo de transaccion con el cual se generan los textos ach. + * @param pOperation Codigo de operaicon. + * @return Map + * @throws Exception + */ + public Map generaTextoAch(Integer pTransaction,String pOperation) throws Exception; + + +} diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/.svn/text-base/ContabilizaCobisLocal.java.svn-base b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/.svn/text-base/ContabilizaCobisLocal.java.svn-base new file mode 100644 index 0000000..120c8d9 --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/.svn/text-base/ContabilizaCobisLocal.java.svn-base @@ -0,0 +1,46 @@ +package com.fp.sessionbeans.ejb.interfaces; + +import java.math.BigDecimal; +import java.sql.Date; + +import javax.ejb.Local; + +import com.fp.dto.save.SaveRequest; + +/** + * Interface de ejb de contabilizacion de contabilizacion en cobis. + * @author Jorge Vaca. + * @version 2.1 + */ +@Local +public interface ContabilizaCobisLocal { + + /** + * Metodo que ejecuta la transaccion en cobis. + * @param pSaveRequest Mensaje de entrada de ejecucion de la transaccion. + * @param pAmount Monto de la afectacion contable. + * @param pCurrency MOneda de la afectacion contable. + * @param pProfile Perfil de afectacion contable. + * @param pServer Codigo de servidor cobis con el que se ejecuta una transaccion. + * @param pOffcie Codigo de oficina cobis con la que se ejecuta la transaccion. + * @throws Exception + */ + public void process(SaveRequest pSaveRequest,BigDecimal pAmount,Integer pCurrency,String pProfile, + String pServer,Integer pOffcie,Integer pArea) throws Exception; + + /** + * Metodo que se encarga de contabilizar valores del repositorio unico. + * @param pSaveRequest Datos del request original. + * @param pServer Nombre del servidor cobis. + * @param pOffcie Codigo de oficina. + * @param pDate Fecha de contabilizacion. + * @param pUser Codigo de usuario. + * @param pTransaction Codigo de transaccion cobis 2804, + * @param pOperation Codigo de operacion "C" + * @param pProduct Codigo de producto ach 33 + * @throws Exception + */ + public void processRepository(SaveRequest pSaveRequest,String pServer,Integer pOffcie, + Date pDate,String pUser,Integer pTransaction,String pOperation,Integer pProduct) throws Exception; + +} diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/.svn/text-base/CrudBeanLocal.java.svn-base b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/.svn/text-base/CrudBeanLocal.java.svn-base new file mode 100644 index 0000000..6c71016 --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/.svn/text-base/CrudBeanLocal.java.svn-base @@ -0,0 +1,36 @@ +package com.fp.sessionbeans.ejb.interfaces; + +import java.util.List; + +import javax.ejb.Local; +import javax.persistence.EntityManager; + +import com.fp.dto.hb.HibernateBean; + +/** + * Interface de ejb de de CRUD de beans. + * @author Jorge Vaca. + * @version 2.1 + */ +@Local +public interface CrudBeanLocal { + + /** + * Metodo que entrega de grbar un registrp en la base haciendo commit. + * @param em Referencia a una session de base de datos. + * @param pBean Objeto a almacenar en la base de datos. + * @throws Exception + */ + public void insert(EntityManager em,HibernateBean pBean) throws Exception; + + /** + * Metodo que entrega de grbar un registrp en la base haciendo commit. + * @param em Referencia a una session de base de datos. + * @param pLbean Lista con objetos a almacenar en la base de datos. + * @throws Exception + */ + public void insert(EntityManager em,List pLbean) throws Exception; + + + +} diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/.svn/text-base/SequenceBeanLocal.java.svn-base b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/.svn/text-base/SequenceBeanLocal.java.svn-base new file mode 100644 index 0000000..dece34b --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/.svn/text-base/SequenceBeanLocal.java.svn-base @@ -0,0 +1,22 @@ +package com.fp.sessionbeans.ejb.interfaces; + +import javax.ejb.Local; +import javax.persistence.EntityManager; + +/** + * Interface de ejb de ejecucion de transacciones. + * @author Jorge Vaca. + * @version 2.1 + */ +@Local +public interface SequenceBeanLocal { + + /** + * Metodo que entrega el valor de uan secuencia, dado el codigo de sequencia. + * @param pSequenceCode Codigo de secuencia a obtener el numero de secuenia. + * @return Integer + * @throws Exception + */ + public Long getNextValueJta(EntityManager em,String pSequenceCode) throws Exception; + +} diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/CobisBeanLocal.java b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/CobisBeanLocal.java new file mode 100644 index 0000000..7618652 --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/CobisBeanLocal.java @@ -0,0 +1,67 @@ +package com.fp.sessionbeans.ejb.interfaces; + +import java.util.List; +import java.util.Map; + +import javax.ejb.Local; + +import com.fp.dto.query.QueryBean; +import java.sql.Date; + +/** + * Interface de ejb de de consulta de informacion en cobis. + * @author Jorge Vaca. + * @version 2.1 + */ +@Local +public interface CobisBeanLocal { + + /** + * Entrega una lista de clientes de Cobis. + * @return List> + * @throws Exception + */ + public List> getClientes(QueryBean queryBean) throws Exception; + + /** + * Entrega una lista de cuentas de ahorro de Cobis. + * @return List> + * @throws Exception + */ + public List> getCuentasAhorro(QueryBean queryBean) throws Exception; + + /** + * Entrega una lista de cuentas de corriente de Cobis. + * @return List> + * @throws Exception + */ + public List> getCuentasCorrientes(QueryBean queryBean) throws Exception; + + /** + * Entrega la consulta del repositorio_ach de cobis + * @param queryBean + * @return List> + * @throws Exception + */ + public List> getRepositorio(QueryBean queryBean) throws Exception; + + /** + * Metodo que devuelve la informacion para el archivo de enviadas + * @param corte + * @param fecha + * @return + * @throws Exception + */ + public List getDataSendFile(Integer corte, Date fecha) throws Exception; + + /** + * Metodo que llena la tabla textos_ach, con los datos de enviadas. + * @param pTransaction Codigo de transaccion con el cual se generan los textos ach. + * @param pOperation Codigo de operaicon. + * @return Map + * @throws Exception + */ + public Map generaTextoAch(Integer pTransaction,String pOperation) throws Exception; + + +} diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/ContabilizaCobisLocal.java b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/ContabilizaCobisLocal.java new file mode 100644 index 0000000..120c8d9 --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/ContabilizaCobisLocal.java @@ -0,0 +1,46 @@ +package com.fp.sessionbeans.ejb.interfaces; + +import java.math.BigDecimal; +import java.sql.Date; + +import javax.ejb.Local; + +import com.fp.dto.save.SaveRequest; + +/** + * Interface de ejb de contabilizacion de contabilizacion en cobis. + * @author Jorge Vaca. + * @version 2.1 + */ +@Local +public interface ContabilizaCobisLocal { + + /** + * Metodo que ejecuta la transaccion en cobis. + * @param pSaveRequest Mensaje de entrada de ejecucion de la transaccion. + * @param pAmount Monto de la afectacion contable. + * @param pCurrency MOneda de la afectacion contable. + * @param pProfile Perfil de afectacion contable. + * @param pServer Codigo de servidor cobis con el que se ejecuta una transaccion. + * @param pOffcie Codigo de oficina cobis con la que se ejecuta la transaccion. + * @throws Exception + */ + public void process(SaveRequest pSaveRequest,BigDecimal pAmount,Integer pCurrency,String pProfile, + String pServer,Integer pOffcie,Integer pArea) throws Exception; + + /** + * Metodo que se encarga de contabilizar valores del repositorio unico. + * @param pSaveRequest Datos del request original. + * @param pServer Nombre del servidor cobis. + * @param pOffcie Codigo de oficina. + * @param pDate Fecha de contabilizacion. + * @param pUser Codigo de usuario. + * @param pTransaction Codigo de transaccion cobis 2804, + * @param pOperation Codigo de operacion "C" + * @param pProduct Codigo de producto ach 33 + * @throws Exception + */ + public void processRepository(SaveRequest pSaveRequest,String pServer,Integer pOffcie, + Date pDate,String pUser,Integer pTransaction,String pOperation,Integer pProduct) throws Exception; + +} diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/CrudBeanLocal.java b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/CrudBeanLocal.java new file mode 100644 index 0000000..6c71016 --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/CrudBeanLocal.java @@ -0,0 +1,36 @@ +package com.fp.sessionbeans.ejb.interfaces; + +import java.util.List; + +import javax.ejb.Local; +import javax.persistence.EntityManager; + +import com.fp.dto.hb.HibernateBean; + +/** + * Interface de ejb de de CRUD de beans. + * @author Jorge Vaca. + * @version 2.1 + */ +@Local +public interface CrudBeanLocal { + + /** + * Metodo que entrega de grbar un registrp en la base haciendo commit. + * @param em Referencia a una session de base de datos. + * @param pBean Objeto a almacenar en la base de datos. + * @throws Exception + */ + public void insert(EntityManager em,HibernateBean pBean) throws Exception; + + /** + * Metodo que entrega de grbar un registrp en la base haciendo commit. + * @param em Referencia a una session de base de datos. + * @param pLbean Lista con objetos a almacenar en la base de datos. + * @throws Exception + */ + public void insert(EntityManager em,List pLbean) throws Exception; + + + +} diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/SequenceBeanLocal.java b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/SequenceBeanLocal.java new file mode 100644 index 0000000..dece34b --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/SequenceBeanLocal.java @@ -0,0 +1,22 @@ +package com.fp.sessionbeans.ejb.interfaces; + +import javax.ejb.Local; +import javax.persistence.EntityManager; + +/** + * Interface de ejb de ejecucion de transacciones. + * @author Jorge Vaca. + * @version 2.1 + */ +@Local +public interface SequenceBeanLocal { + + /** + * Metodo que entrega el valor de uan secuencia, dado el codigo de sequencia. + * @param pSequenceCode Codigo de secuencia a obtener el numero de secuenia. + * @return Integer + * @throws Exception + */ + public Long getNextValueJta(EntityManager em,String pSequenceCode) throws Exception; + +} diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/cobis/.svn/entries b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/cobis/.svn/entries new file mode 100644 index 0000000..b9b3d57 --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/cobis/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/sessionbeans/src/main/java/com/fp/sessionbeans/ejb/interfaces/cobis +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/helper/.svn/entries b/base/sessionbeans/src/main/java/com/fp/sessionbeans/helper/.svn/entries new file mode 100644 index 0000000..f7e44e4 --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/helper/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/sessionbeans/src/main/java/com/fp/sessionbeans/helper +svn://172.17.26.185/COMACO + + + +2015-06-23T07:18:19.905071Z +4129 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +SequenceThread.java +file + + + + +2022-07-28T03:40:44.898812Z +a67276f64a4faf0406e169c5a8087f02 +2015-06-23T07:18:19.905071Z +4129 +cpiedra + + + + + + + + + + + + + + + + + + + + + +2197 + +Sequence.java +file + + + + +2022-07-28T03:40:44.898812Z +37763b0be7c377ad311923e415c9e86b +2015-06-23T07:18:19.905071Z +4129 +cpiedra + + + + + + + + + + + + + + + + + + + + + +2513 + diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/helper/.svn/text-base/Sequence.java.svn-base b/base/sessionbeans/src/main/java/com/fp/sessionbeans/helper/.svn/text-base/Sequence.java.svn-base new file mode 100644 index 0000000..27c65e6 --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/helper/.svn/text-base/Sequence.java.svn-base @@ -0,0 +1,75 @@ +package com.fp.sessionbeans.helper; + +import javax.naming.InitialContext; + +import com.fp.common.properties.PropertiesHandler; +import com.fp.persistence.commondb.PersistenceManager; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.sessionbeans.ejb.interfaces.SequenceBeanLocal; + +/** + * Calse que se encarga de entregar el consecutivo de una secuencia dado un codigo de sequencia. Ejemplo Codigo dde + * secuencia, PERSONCODE, entrega el siguiente numero de persona. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class Sequence { + + private Long nextvalue; + + /** + * Metodo que entrega el numero de solicitud, para el usuario. + * + * @param pQueryRequest Datos del request. + * @throws Exception + */ + synchronized public Long getNextValue(String pSequenceCode) throws Exception { + SessionData sd = ThreadFacade.getSessionData(); + if (sd.isEjb()) { + return this.getNextValueJta(pSequenceCode); + } + this.getNextValueNonJta(pSequenceCode); + return Long.valueOf(this.nextvalue.toString()); + } + + /** + * Metodo que entrega el numero de solicitud, para el usuario. + * + * @param pQueryRequest Datos del request. + * @throws Exception + */ + public Long getNextValueJta(String pSequenceCode) throws Exception { + SequenceBeanLocal local = null; + try { + PropertiesHandler ph = new PropertiesHandler("fb-facade"); + InitialContext ctx = new InitialContext(); + local = (SequenceBeanLocal) ctx.lookup(ph.getStringValue("ear") + "SequenceBean/local"); + Long sec = local.getNextValueJta(PersistenceManager.getInstance().createEntityManagerLocal(), pSequenceCode); + return sec; + } catch (Exception exp) { + throw exp; + } + } + + /** + * Metodo que entrega el numero de solicitud, para el usuario. + * + * @param pQueryRequest Datos del request. + * @throws Exception + */ + private void getNextValueNonJta(String pSequenceCode) throws Exception { + SequenceThread st = new SequenceThread(this, ThreadFacade.getSessionData().getCompany(), pSequenceCode); + st.start(); + st.join(); + } + + public void setNextvalue(Long nextvalue) { + this.nextvalue = nextvalue; + } + + public Long getNextvalue() { + return this.nextvalue; + } +} diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/helper/.svn/text-base/SequenceThread.java.svn-base b/base/sessionbeans/src/main/java/com/fp/sessionbeans/helper/.svn/text-base/SequenceThread.java.svn-base new file mode 100644 index 0000000..01fd610 --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/helper/.svn/text-base/SequenceThread.java.svn-base @@ -0,0 +1,52 @@ +package com.fp.sessionbeans.helper; + +import com.fp.common.helper.Constant; +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.pgeneral.seq.TgeneSequences; + +public class SequenceThread extends Thread { + + private final Sequence sequence; + + private final Integer company; + + private final String sequencecode; + + public SequenceThread(Sequence sequence, Integer pCompany, String pSequenceCode) { + this.sequence = sequence; + this.sequencecode = pSequenceCode; + this.company = pCompany; + } + + @Override + public void run() { + try { + SessionData s = new SessionData(); + s.setCompany(this.company); + ThreadFacade.setSaveRequest(s); + PersistenceHelper.setEntityManager(PersistenceManager.getInstance().createEntityManagerLocal()); + PersistenceHelper.beginNewTransaction(); + TgeneSequences tgeneSequences = TgeneSequences.findWithLock(PersistenceHelper.getEntityManager(), this.sequencecode); + tgeneSequences.setCurrentvalue(tgeneSequences.getCurrentvalue() + tgeneSequences.getIncrease()); + if (Constant.ifYes(tgeneSequences.getCyclic())) { + if (tgeneSequences.getCurrentvalue().compareTo(tgeneSequences.getLastvalue()) >= 0) { + tgeneSequences.setCurrentvalue(tgeneSequences.getInitialvalue()); + } + } + this.sequence.setNextvalue(tgeneSequences.getCurrentvalue()); + // update del registro + PersistenceHelper.getEntityManager().merge(tgeneSequences); + // Integer.valueOf(tgeneSequences.getCurrentvalue().toString()); + PersistenceHelper.commitNewTransaction(); + } catch (Exception e) { + APPLogger.getLogger().warn(e, e); + PersistenceHelper.rollbackNewTransaction(); + } finally { + PersistenceHelper.closeSession(); + } + } +} diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/helper/Sequence.java b/base/sessionbeans/src/main/java/com/fp/sessionbeans/helper/Sequence.java new file mode 100644 index 0000000..27c65e6 --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/helper/Sequence.java @@ -0,0 +1,75 @@ +package com.fp.sessionbeans.helper; + +import javax.naming.InitialContext; + +import com.fp.common.properties.PropertiesHandler; +import com.fp.persistence.commondb.PersistenceManager; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.sessionbeans.ejb.interfaces.SequenceBeanLocal; + +/** + * Calse que se encarga de entregar el consecutivo de una secuencia dado un codigo de sequencia. Ejemplo Codigo dde + * secuencia, PERSONCODE, entrega el siguiente numero de persona. + * + * @author Jorge Vaca + * @version 2.1 + */ +public class Sequence { + + private Long nextvalue; + + /** + * Metodo que entrega el numero de solicitud, para el usuario. + * + * @param pQueryRequest Datos del request. + * @throws Exception + */ + synchronized public Long getNextValue(String pSequenceCode) throws Exception { + SessionData sd = ThreadFacade.getSessionData(); + if (sd.isEjb()) { + return this.getNextValueJta(pSequenceCode); + } + this.getNextValueNonJta(pSequenceCode); + return Long.valueOf(this.nextvalue.toString()); + } + + /** + * Metodo que entrega el numero de solicitud, para el usuario. + * + * @param pQueryRequest Datos del request. + * @throws Exception + */ + public Long getNextValueJta(String pSequenceCode) throws Exception { + SequenceBeanLocal local = null; + try { + PropertiesHandler ph = new PropertiesHandler("fb-facade"); + InitialContext ctx = new InitialContext(); + local = (SequenceBeanLocal) ctx.lookup(ph.getStringValue("ear") + "SequenceBean/local"); + Long sec = local.getNextValueJta(PersistenceManager.getInstance().createEntityManagerLocal(), pSequenceCode); + return sec; + } catch (Exception exp) { + throw exp; + } + } + + /** + * Metodo que entrega el numero de solicitud, para el usuario. + * + * @param pQueryRequest Datos del request. + * @throws Exception + */ + private void getNextValueNonJta(String pSequenceCode) throws Exception { + SequenceThread st = new SequenceThread(this, ThreadFacade.getSessionData().getCompany(), pSequenceCode); + st.start(); + st.join(); + } + + public void setNextvalue(Long nextvalue) { + this.nextvalue = nextvalue; + } + + public Long getNextvalue() { + return this.nextvalue; + } +} diff --git a/base/sessionbeans/src/main/java/com/fp/sessionbeans/helper/SequenceThread.java b/base/sessionbeans/src/main/java/com/fp/sessionbeans/helper/SequenceThread.java new file mode 100644 index 0000000..01fd610 --- /dev/null +++ b/base/sessionbeans/src/main/java/com/fp/sessionbeans/helper/SequenceThread.java @@ -0,0 +1,52 @@ +package com.fp.sessionbeans.helper; + +import com.fp.common.helper.Constant; +import com.fp.common.logger.APPLogger; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.commondb.PersistenceManager; +import com.fp.persistence.commondb.data.SessionData; +import com.fp.persistence.commondb.data.ThreadFacade; +import com.fp.persistence.pgeneral.seq.TgeneSequences; + +public class SequenceThread extends Thread { + + private final Sequence sequence; + + private final Integer company; + + private final String sequencecode; + + public SequenceThread(Sequence sequence, Integer pCompany, String pSequenceCode) { + this.sequence = sequence; + this.sequencecode = pSequenceCode; + this.company = pCompany; + } + + @Override + public void run() { + try { + SessionData s = new SessionData(); + s.setCompany(this.company); + ThreadFacade.setSaveRequest(s); + PersistenceHelper.setEntityManager(PersistenceManager.getInstance().createEntityManagerLocal()); + PersistenceHelper.beginNewTransaction(); + TgeneSequences tgeneSequences = TgeneSequences.findWithLock(PersistenceHelper.getEntityManager(), this.sequencecode); + tgeneSequences.setCurrentvalue(tgeneSequences.getCurrentvalue() + tgeneSequences.getIncrease()); + if (Constant.ifYes(tgeneSequences.getCyclic())) { + if (tgeneSequences.getCurrentvalue().compareTo(tgeneSequences.getLastvalue()) >= 0) { + tgeneSequences.setCurrentvalue(tgeneSequences.getInitialvalue()); + } + } + this.sequence.setNextvalue(tgeneSequences.getCurrentvalue()); + // update del registro + PersistenceHelper.getEntityManager().merge(tgeneSequences); + // Integer.valueOf(tgeneSequences.getCurrentvalue().toString()); + PersistenceHelper.commitNewTransaction(); + } catch (Exception e) { + APPLogger.getLogger().warn(e, e); + PersistenceHelper.rollbackNewTransaction(); + } finally { + PersistenceHelper.closeSession(); + } + } +} diff --git a/base/sessionbeans/src/test/.svn/entries b/base/sessionbeans/src/test/.svn/entries new file mode 100644 index 0000000..aefb824 --- /dev/null +++ b/base/sessionbeans/src/test/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/sessionbeans/src/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + diff --git a/base/sessionbeans/src/test/java/.svn/entries b/base/sessionbeans/src/test/java/.svn/entries new file mode 100644 index 0000000..bea418b --- /dev/null +++ b/base/sessionbeans/src/test/java/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/base/sessionbeans/src/test/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/CrudBean.class b/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/CrudBean.class new file mode 100644 index 0000000..7698567 Binary files /dev/null and b/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/CrudBean.class differ diff --git a/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/SequenceBean.class b/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/SequenceBean.class new file mode 100644 index 0000000..cf2b656 Binary files /dev/null and b/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/SequenceBean.class differ diff --git a/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/cobis/CobisBean.class b/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/cobis/CobisBean.class new file mode 100644 index 0000000..7e5d01e Binary files /dev/null and b/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/cobis/CobisBean.class differ diff --git a/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/cobis/ContabilizaCobisBean.class b/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/cobis/ContabilizaCobisBean.class new file mode 100644 index 0000000..a4b693d Binary files /dev/null and b/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/cobis/ContabilizaCobisBean.class differ diff --git a/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/interfaces/CobisBeanLocal.class b/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/interfaces/CobisBeanLocal.class new file mode 100644 index 0000000..c35f94e Binary files /dev/null and b/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/interfaces/CobisBeanLocal.class differ diff --git a/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/interfaces/ContabilizaCobisLocal.class b/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/interfaces/ContabilizaCobisLocal.class new file mode 100644 index 0000000..0657df2 Binary files /dev/null and b/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/interfaces/ContabilizaCobisLocal.class differ diff --git a/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/interfaces/CrudBeanLocal.class b/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/interfaces/CrudBeanLocal.class new file mode 100644 index 0000000..7b1907d Binary files /dev/null and b/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/interfaces/CrudBeanLocal.class differ diff --git a/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/interfaces/SequenceBeanLocal.class b/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/interfaces/SequenceBeanLocal.class new file mode 100644 index 0000000..779ba3f Binary files /dev/null and b/base/sessionbeans/target/classes/com/fp/sessionbeans/ejb/interfaces/SequenceBeanLocal.class differ diff --git a/base/sessionbeans/target/classes/com/fp/sessionbeans/helper/Sequence.class b/base/sessionbeans/target/classes/com/fp/sessionbeans/helper/Sequence.class new file mode 100644 index 0000000..03a919e Binary files /dev/null and b/base/sessionbeans/target/classes/com/fp/sessionbeans/helper/Sequence.class differ diff --git a/base/sessionbeans/target/classes/com/fp/sessionbeans/helper/SequenceThread.class b/base/sessionbeans/target/classes/com/fp/sessionbeans/helper/SequenceThread.class new file mode 100644 index 0000000..039862f Binary files /dev/null and b/base/sessionbeans/target/classes/com/fp/sessionbeans/helper/SequenceThread.class differ diff --git a/base/sessionbeans/target/maven-archiver/pom.properties b/base/sessionbeans/target/maven-archiver/pom.properties new file mode 100644 index 0000000..462b030 --- /dev/null +++ b/base/sessionbeans/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:53:10 ECT 2022 +version=2.1 +groupId=com.fp.base +artifactId=sessionbeans diff --git a/base/sessionbeans/target/sessionbeans-2.1.jar b/base/sessionbeans/target/sessionbeans-2.1.jar new file mode 100644 index 0000000..985aac9 Binary files /dev/null and b/base/sessionbeans/target/sessionbeans-2.1.jar differ diff --git a/centralwebservices/.svn/entries b/centralwebservices/.svn/entries new file mode 100644 index 0000000..53b51d8 --- /dev/null +++ b/centralwebservices/.svn/entries @@ -0,0 +1,108 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices +svn://172.17.26.185/COMACO + + + +2021-05-14T20:47:05.591314Z +4636 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +mule-project.xml +file + + + + +2022-07-28T03:40:47.671824Z +c4eb4d14db30a68bbd9b3b8d9747bd64 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +270 + +src +dir + +bin +dir + +flows +dir + +pom.xml +file + + + + +2022-07-28T03:40:47.671824Z +a0fb1c3e3939d7dd705ca2812f272e71 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +10949 + +mappings +dir + diff --git a/centralwebservices/.svn/prop-base/mule-project.xml.svn-base b/centralwebservices/.svn/prop-base/mule-project.xml.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/.svn/prop-base/mule-project.xml.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/.svn/prop-base/pom.xml.svn-base b/centralwebservices/.svn/prop-base/pom.xml.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/.svn/prop-base/pom.xml.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/.svn/text-base/mule-project.xml.svn-base b/centralwebservices/.svn/text-base/mule-project.xml.svn-base new file mode 100644 index 0000000..19983f8 --- /dev/null +++ b/centralwebservices/.svn/text-base/mule-project.xml.svn-base @@ -0,0 +1,5 @@ + + + centralwebservices + + diff --git a/centralwebservices/.svn/text-base/pom.xml.netbeans-base b/centralwebservices/.svn/text-base/pom.xml.netbeans-base new file mode 100644 index 0000000..d4aac84 --- /dev/null +++ b/centralwebservices/.svn/text-base/pom.xml.netbeans-base @@ -0,0 +1,360 @@ + + + + 4.0.0 + com.fp.esb + centralwebservices + mule + 2.1 + + + UTF-8 + UTF-8 + + 3.5.0 + 2.8 + JavaSE-1.6 + 1.6 + 4.9 + + + + + + + + org.apache.maven.plugins + maven-install-plugin + 2.3.1 + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.mule.tools + maven-mule-plugin + [1.6,) + + attach-test-resources + filter-resources + + + + + + + + + + + + + + + org.mule.tools + maven-mule-plugin + 1.9 + true + + true + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + ${jdk.version} + ${jdk.version} + ISO-8859-1 + + + + maven-assembly-plugin + 2.2.1 + + + project + + + + + org.apache.maven.plugins + maven-eclipse-plugin + ${eclipsePluginVersion} + + + true + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.7 + + + add-resource + generate-resources + + add-resource + + + + + + + src/main/app/ + + + src/main/api/ + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + + java + + + + + org.mule.MuleServer + + -config + src/main/app/mule-config.xml + + compile + + + + + + + + + + org.apache.maven.plugins + maven-surefire-report-plugin + 2.4.2 + + + + org.apache.maven.plugins + maven-checkstyle-plugin + 2.5 + + http://mulesoft.org/download/attachments/92/checkstyle.xml?version=1 + + + + org.apache.maven.plugins + maven-pmd-plugin + 2.5 + + ${jdk.version} + + + + org.codehaus.mojo + cobertura-maven-plugin + 2.5 + + + org.codehaus.mojo + taglist-maven-plugin + 2.4 + + + TODO + @todo + FIXME + @fixme + @deprecated + + + + + org.apache.maven.plugins + maven-jxr-plugin + 2.2 + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.7 + + ${jdk.version} + + http://java.sun.com/j2ee/1.4/docs/api + http://java.sun.com/j2se/1.4.2/docs/api + http://java.sun.com/j2se/1.5.0/docs/api + + + + + org.codehaus.mojo + jdepend-maven-plugin + 2.0-beta-2 + + + org.codehaus.mojo + findbugs-maven-plugin + 2.3.2 + + + + + + + + org.mule + mule-core + ${mule.version} + provided + + + + org.mule.modules + mule-module-spring-config + ${mule.version} + provided + + + + + org.mule.transports + mule-transport-file + ${mule.version} + provided + + + org.mule.transports + mule-transport-http + ${mule.version} + provided + + + org.mule.transports + mule-transport-jdbc + ${mule.version} + provided + + + org.mule.transports + mule-transport-jms + ${mule.version} + provided + + + org.mule.transports + mule-transport-vm + ${mule.version} + provided + + + + + org.mule.modules + mule-module-client + ${mule.version} + provided + + + org.mule.modules + mule-module-cxf + ${mule.version} + provided + + + org.mule.modules + mule-module-management + ${mule.version} + provided + + + org.mule.modules + mule-module-scripting + ${mule.version} + provided + + + org.mule.modules + mule-module-sxc + ${mule.version} + provided + + + org.mule.modules + mule-module-xml + ${mule.version} + provided + + + + org.mule.tests + mule-tests-functional + ${mule.version} + test + + + mockobjects + mockobjects-core + 0.09 + test + + + junit + junit + ${junit.version} + test + + + + + + Central + Central + http://repo1.maven.org/maven2/ + default + + + mulesoft-releases + MuleSoft Releases Repository + http://repository.mulesoft.org/releases/ + default + + + mulesoft-snapshots + MuleSoft Snapshots Repository + http://repository.mulesoft.org/snapshots/ + default + + + + + mulesoft-release + mulesoft release repository + default + http://repository.mulesoft.org/releases/ + + false + + + + + diff --git a/centralwebservices/.svn/text-base/pom.xml.svn-base b/centralwebservices/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..d4aac84 --- /dev/null +++ b/centralwebservices/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,360 @@ + + + + 4.0.0 + com.fp.esb + centralwebservices + mule + 2.1 + + + UTF-8 + UTF-8 + + 3.5.0 + 2.8 + JavaSE-1.6 + 1.6 + 4.9 + + + + + + + + org.apache.maven.plugins + maven-install-plugin + 2.3.1 + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.mule.tools + maven-mule-plugin + [1.6,) + + attach-test-resources + filter-resources + + + + + + + + + + + + + + + org.mule.tools + maven-mule-plugin + 1.9 + true + + true + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + ${jdk.version} + ${jdk.version} + ISO-8859-1 + + + + maven-assembly-plugin + 2.2.1 + + + project + + + + + org.apache.maven.plugins + maven-eclipse-plugin + ${eclipsePluginVersion} + + + true + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.7 + + + add-resource + generate-resources + + add-resource + + + + + + + src/main/app/ + + + src/main/api/ + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + + java + + + + + org.mule.MuleServer + + -config + src/main/app/mule-config.xml + + compile + + + + + + + + + + org.apache.maven.plugins + maven-surefire-report-plugin + 2.4.2 + + + + org.apache.maven.plugins + maven-checkstyle-plugin + 2.5 + + http://mulesoft.org/download/attachments/92/checkstyle.xml?version=1 + + + + org.apache.maven.plugins + maven-pmd-plugin + 2.5 + + ${jdk.version} + + + + org.codehaus.mojo + cobertura-maven-plugin + 2.5 + + + org.codehaus.mojo + taglist-maven-plugin + 2.4 + + + TODO + @todo + FIXME + @fixme + @deprecated + + + + + org.apache.maven.plugins + maven-jxr-plugin + 2.2 + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.7 + + ${jdk.version} + + http://java.sun.com/j2ee/1.4/docs/api + http://java.sun.com/j2se/1.4.2/docs/api + http://java.sun.com/j2se/1.5.0/docs/api + + + + + org.codehaus.mojo + jdepend-maven-plugin + 2.0-beta-2 + + + org.codehaus.mojo + findbugs-maven-plugin + 2.3.2 + + + + + + + + org.mule + mule-core + ${mule.version} + provided + + + + org.mule.modules + mule-module-spring-config + ${mule.version} + provided + + + + + org.mule.transports + mule-transport-file + ${mule.version} + provided + + + org.mule.transports + mule-transport-http + ${mule.version} + provided + + + org.mule.transports + mule-transport-jdbc + ${mule.version} + provided + + + org.mule.transports + mule-transport-jms + ${mule.version} + provided + + + org.mule.transports + mule-transport-vm + ${mule.version} + provided + + + + + org.mule.modules + mule-module-client + ${mule.version} + provided + + + org.mule.modules + mule-module-cxf + ${mule.version} + provided + + + org.mule.modules + mule-module-management + ${mule.version} + provided + + + org.mule.modules + mule-module-scripting + ${mule.version} + provided + + + org.mule.modules + mule-module-sxc + ${mule.version} + provided + + + org.mule.modules + mule-module-xml + ${mule.version} + provided + + + + org.mule.tests + mule-tests-functional + ${mule.version} + test + + + mockobjects + mockobjects-core + 0.09 + test + + + junit + junit + ${junit.version} + test + + + + + + Central + Central + http://repo1.maven.org/maven2/ + default + + + mulesoft-releases + MuleSoft Releases Repository + http://repository.mulesoft.org/releases/ + default + + + mulesoft-snapshots + MuleSoft Snapshots Repository + http://repository.mulesoft.org/snapshots/ + default + + + + + mulesoft-release + mulesoft release repository + default + http://repository.mulesoft.org/releases/ + + false + + + + + diff --git a/centralwebservices/bin/.svn/entries b/centralwebservices/bin/.svn/entries new file mode 100644 index 0000000..8b332f1 --- /dev/null +++ b/centralwebservices/bin/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/bin +svn://172.17.26.185/COMACO + + + +2014-12-11T05:00:43.966009Z +3415 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/centralwebservices/flows/.svn/entries b/centralwebservices/flows/.svn/entries new file mode 100644 index 0000000..e89f27f --- /dev/null +++ b/centralwebservices/flows/.svn/entries @@ -0,0 +1,300 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/flows +svn://172.17.26.185/COMACO + + + +2016-02-02T21:19:16.375331Z +4424 +cvasquez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +centralwebservices-colaimpresion.mflow +file + + + + +2022-07-28T03:40:47.635824Z +555c6385db9db695aa3250f03e814f20 +2015-01-23T14:02:29.360857Z +3814 +dcruz + + + + + + + + + + + + + + + + + + + + + +6874 + +centralwebservices-datosnap.mflow +file + + + + +2022-07-28T03:40:47.635824Z +97b22ec2a7760bdb32606d287794d764 +2016-02-02T21:19:16.375331Z +4424 +cvasquez + + + + + + + + + + + + + + + + + + + + + +6824 + +centralwebservicessnap-ruc.mflow +file + + + + +2022-07-28T03:40:47.635824Z +8cbfd951b51f9fc85970b0d889d83371 +2015-01-22T09:54:27.633570Z +3785 +dcruz + + + + + + + + + + + + + + + + + + + + + +4370 + +centralwebservicessnap-ced.mflow +file + + + + +2022-07-28T03:40:47.636824Z +6a9b136d0952d97f041b4fd3ed91c02e +2015-01-22T09:54:27.633570Z +3785 +dcruz + + + + + + + + + + + + + + + + + + + + + +4284 + +centralwebservices-lectura.mflow +file + + + + +2022-07-28T03:40:47.636824Z +a693314a81e4fe24be55c4386f4e3acc +2015-01-23T14:02:29.360857Z +3814 +dcruz + + + + + + + + + + + + + + + + + + + + + +6861 + +centralwebservices-documentos.mflow +file + + + + +2022-07-28T03:40:47.636824Z +0d888b6348ff8d70bcd1761d4a727359 +2015-01-23T14:02:29.360857Z +3814 +dcruz + + + + + + + + + + + + + + + + + + + + + +6797 + +centralwebservices-consultalogin.mflow +file + + + + +2022-07-28T03:40:47.636824Z +bae75ce5d29ce621f6ffa9a016966e2f +2015-01-23T14:02:29.360857Z +3814 +dcruz + + + + + + + + + + + + + + + + + + + + + +6883 + +centralwebservices-armas.mflow +file + + + + +2022-07-28T03:40:47.637824Z +bd255b5d994c310e75abe1ea01af4428 +2015-01-23T14:02:29.360857Z +3814 +dcruz + + + + + + + + + + + + + + + + + + + + + +6731 + diff --git a/centralwebservices/flows/.svn/text-base/centralwebservices-armas.mflow.netbeans-base b/centralwebservices/flows/.svn/text-base/centralwebservices-armas.mflow.netbeans-base new file mode 100644 index 0000000..03341e7 --- /dev/null +++ b/centralwebservices/flows/.svn/text-base/centralwebservices-armas.mflow.netbeans-base @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/centralwebservices/flows/.svn/text-base/centralwebservices-armas.mflow.svn-base b/centralwebservices/flows/.svn/text-base/centralwebservices-armas.mflow.svn-base new file mode 100644 index 0000000..03341e7 --- /dev/null +++ b/centralwebservices/flows/.svn/text-base/centralwebservices-armas.mflow.svn-base @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/centralwebservices/flows/.svn/text-base/centralwebservices-colaimpresion.mflow.netbeans-base b/centralwebservices/flows/.svn/text-base/centralwebservices-colaimpresion.mflow.netbeans-base new file mode 100644 index 0000000..b9efe5a --- /dev/null +++ b/centralwebservices/flows/.svn/text-base/centralwebservices-colaimpresion.mflow.netbeans-base @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Contiene todos los servicios de la cola de impresion + diff --git a/centralwebservices/flows/.svn/text-base/centralwebservices-colaimpresion.mflow.svn-base b/centralwebservices/flows/.svn/text-base/centralwebservices-colaimpresion.mflow.svn-base new file mode 100644 index 0000000..b9efe5a --- /dev/null +++ b/centralwebservices/flows/.svn/text-base/centralwebservices-colaimpresion.mflow.svn-base @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Contiene todos los servicios de la cola de impresion + diff --git a/centralwebservices/flows/.svn/text-base/centralwebservices-consultalogin.mflow.netbeans-base b/centralwebservices/flows/.svn/text-base/centralwebservices-consultalogin.mflow.netbeans-base new file mode 100644 index 0000000..e797037 --- /dev/null +++ b/centralwebservices/flows/.svn/text-base/centralwebservices-consultalogin.mflow.netbeans-base @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Contiene los servicios web relacionados con la cola de impresion + diff --git a/centralwebservices/flows/.svn/text-base/centralwebservices-consultalogin.mflow.svn-base b/centralwebservices/flows/.svn/text-base/centralwebservices-consultalogin.mflow.svn-base new file mode 100644 index 0000000..e797037 --- /dev/null +++ b/centralwebservices/flows/.svn/text-base/centralwebservices-consultalogin.mflow.svn-base @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Contiene los servicios web relacionados con la cola de impresion + diff --git a/centralwebservices/flows/.svn/text-base/centralwebservices-datosnap.mflow.netbeans-base b/centralwebservices/flows/.svn/text-base/centralwebservices-datosnap.mflow.netbeans-base new file mode 100644 index 0000000..c986575 --- /dev/null +++ b/centralwebservices/flows/.svn/text-base/centralwebservices-datosnap.mflow.netbeans-base @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Contiene el servicio de Datos del Snap + diff --git a/centralwebservices/flows/.svn/text-base/centralwebservices-datosnap.mflow.svn-base b/centralwebservices/flows/.svn/text-base/centralwebservices-datosnap.mflow.svn-base new file mode 100644 index 0000000..c986575 --- /dev/null +++ b/centralwebservices/flows/.svn/text-base/centralwebservices-datosnap.mflow.svn-base @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Contiene el servicio de Datos del Snap + diff --git a/centralwebservices/flows/.svn/text-base/centralwebservices-documentos.mflow.svn-base b/centralwebservices/flows/.svn/text-base/centralwebservices-documentos.mflow.svn-base new file mode 100644 index 0000000..3ffe00e --- /dev/null +++ b/centralwebservices/flows/.svn/text-base/centralwebservices-documentos.mflow.svn-base @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/centralwebservices/flows/.svn/text-base/centralwebservices-lectura.mflow.netbeans-base b/centralwebservices/flows/.svn/text-base/centralwebservices-lectura.mflow.netbeans-base new file mode 100644 index 0000000..b557dbf --- /dev/null +++ b/centralwebservices/flows/.svn/text-base/centralwebservices-lectura.mflow.netbeans-base @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Flujo en donde se publica el servicio de lectura de los datos en el hand held + diff --git a/centralwebservices/flows/.svn/text-base/centralwebservices-lectura.mflow.svn-base b/centralwebservices/flows/.svn/text-base/centralwebservices-lectura.mflow.svn-base new file mode 100644 index 0000000..b557dbf --- /dev/null +++ b/centralwebservices/flows/.svn/text-base/centralwebservices-lectura.mflow.svn-base @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Flujo en donde se publica el servicio de lectura de los datos en el hand held + diff --git a/centralwebservices/flows/.svn/text-base/centralwebservicessnap-ced.mflow.svn-base b/centralwebservices/flows/.svn/text-base/centralwebservicessnap-ced.mflow.svn-base new file mode 100644 index 0000000..a3672ce --- /dev/null +++ b/centralwebservices/flows/.svn/text-base/centralwebservicessnap-ced.mflow.svn-base @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/centralwebservices/flows/.svn/text-base/centralwebservicessnap-ruc.mflow.svn-base b/centralwebservices/flows/.svn/text-base/centralwebservicessnap-ruc.mflow.svn-base new file mode 100644 index 0000000..06a7534 --- /dev/null +++ b/centralwebservices/flows/.svn/text-base/centralwebservicessnap-ruc.mflow.svn-base @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Servicio que realiza la implementacion del servicio web que provee la SNAP para realizar la conexion al SRI + diff --git a/centralwebservices/flows/centralwebservices-armas.mflow b/centralwebservices/flows/centralwebservices-armas.mflow new file mode 100644 index 0000000..03341e7 --- /dev/null +++ b/centralwebservices/flows/centralwebservices-armas.mflow @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/centralwebservices/flows/centralwebservices-colaimpresion.mflow b/centralwebservices/flows/centralwebservices-colaimpresion.mflow new file mode 100644 index 0000000..b9efe5a --- /dev/null +++ b/centralwebservices/flows/centralwebservices-colaimpresion.mflow @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Contiene todos los servicios de la cola de impresion + diff --git a/centralwebservices/flows/centralwebservices-consultalogin.mflow b/centralwebservices/flows/centralwebservices-consultalogin.mflow new file mode 100644 index 0000000..7776d63 --- /dev/null +++ b/centralwebservices/flows/centralwebservices-consultalogin.mflow @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Contiene los servicios web relacionados con la cola de impresion + diff --git a/centralwebservices/flows/centralwebservices-datosnap.mflow b/centralwebservices/flows/centralwebservices-datosnap.mflow new file mode 100644 index 0000000..c986575 --- /dev/null +++ b/centralwebservices/flows/centralwebservices-datosnap.mflow @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Contiene el servicio de Datos del Snap + diff --git a/centralwebservices/flows/centralwebservices-documentos.mflow b/centralwebservices/flows/centralwebservices-documentos.mflow new file mode 100644 index 0000000..3ffe00e --- /dev/null +++ b/centralwebservices/flows/centralwebservices-documentos.mflow @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/centralwebservices/flows/centralwebservices-lectura.mflow b/centralwebservices/flows/centralwebservices-lectura.mflow new file mode 100644 index 0000000..b557dbf --- /dev/null +++ b/centralwebservices/flows/centralwebservices-lectura.mflow @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Flujo en donde se publica el servicio de lectura de los datos en el hand held + diff --git a/centralwebservices/flows/centralwebservicessnap-ced.mflow b/centralwebservices/flows/centralwebservicessnap-ced.mflow new file mode 100644 index 0000000..a3672ce --- /dev/null +++ b/centralwebservices/flows/centralwebservicessnap-ced.mflow @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/centralwebservices/flows/centralwebservicessnap-ruc.mflow b/centralwebservices/flows/centralwebservicessnap-ruc.mflow new file mode 100644 index 0000000..06a7534 --- /dev/null +++ b/centralwebservices/flows/centralwebservicessnap-ruc.mflow @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Servicio que realiza la implementacion del servicio web que provee la SNAP para realizar la conexion al SRI + diff --git a/centralwebservices/mappings/.svn/entries b/centralwebservices/mappings/.svn/entries new file mode 100644 index 0000000..899e4c8 --- /dev/null +++ b/centralwebservices/mappings/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/mappings +svn://172.17.26.185/COMACO + + + +2014-12-11T05:00:43.966009Z +3415 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/centralwebservices/mule-project.xml b/centralwebservices/mule-project.xml new file mode 100644 index 0000000..19983f8 --- /dev/null +++ b/centralwebservices/mule-project.xml @@ -0,0 +1,5 @@ + + + centralwebservices + + diff --git a/centralwebservices/pom.xml b/centralwebservices/pom.xml new file mode 100644 index 0000000..d4aac84 --- /dev/null +++ b/centralwebservices/pom.xml @@ -0,0 +1,360 @@ + + + + 4.0.0 + com.fp.esb + centralwebservices + mule + 2.1 + + + UTF-8 + UTF-8 + + 3.5.0 + 2.8 + JavaSE-1.6 + 1.6 + 4.9 + + + + + + + + org.apache.maven.plugins + maven-install-plugin + 2.3.1 + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.mule.tools + maven-mule-plugin + [1.6,) + + attach-test-resources + filter-resources + + + + + + + + + + + + + + + org.mule.tools + maven-mule-plugin + 1.9 + true + + true + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + ${jdk.version} + ${jdk.version} + ISO-8859-1 + + + + maven-assembly-plugin + 2.2.1 + + + project + + + + + org.apache.maven.plugins + maven-eclipse-plugin + ${eclipsePluginVersion} + + + true + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.7 + + + add-resource + generate-resources + + add-resource + + + + + + + src/main/app/ + + + src/main/api/ + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + + java + + + + + org.mule.MuleServer + + -config + src/main/app/mule-config.xml + + compile + + + + + + + + + + org.apache.maven.plugins + maven-surefire-report-plugin + 2.4.2 + + + + org.apache.maven.plugins + maven-checkstyle-plugin + 2.5 + + http://mulesoft.org/download/attachments/92/checkstyle.xml?version=1 + + + + org.apache.maven.plugins + maven-pmd-plugin + 2.5 + + ${jdk.version} + + + + org.codehaus.mojo + cobertura-maven-plugin + 2.5 + + + org.codehaus.mojo + taglist-maven-plugin + 2.4 + + + TODO + @todo + FIXME + @fixme + @deprecated + + + + + org.apache.maven.plugins + maven-jxr-plugin + 2.2 + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.7 + + ${jdk.version} + + http://java.sun.com/j2ee/1.4/docs/api + http://java.sun.com/j2se/1.4.2/docs/api + http://java.sun.com/j2se/1.5.0/docs/api + + + + + org.codehaus.mojo + jdepend-maven-plugin + 2.0-beta-2 + + + org.codehaus.mojo + findbugs-maven-plugin + 2.3.2 + + + + + + + + org.mule + mule-core + ${mule.version} + provided + + + + org.mule.modules + mule-module-spring-config + ${mule.version} + provided + + + + + org.mule.transports + mule-transport-file + ${mule.version} + provided + + + org.mule.transports + mule-transport-http + ${mule.version} + provided + + + org.mule.transports + mule-transport-jdbc + ${mule.version} + provided + + + org.mule.transports + mule-transport-jms + ${mule.version} + provided + + + org.mule.transports + mule-transport-vm + ${mule.version} + provided + + + + + org.mule.modules + mule-module-client + ${mule.version} + provided + + + org.mule.modules + mule-module-cxf + ${mule.version} + provided + + + org.mule.modules + mule-module-management + ${mule.version} + provided + + + org.mule.modules + mule-module-scripting + ${mule.version} + provided + + + org.mule.modules + mule-module-sxc + ${mule.version} + provided + + + org.mule.modules + mule-module-xml + ${mule.version} + provided + + + + org.mule.tests + mule-tests-functional + ${mule.version} + test + + + mockobjects + mockobjects-core + 0.09 + test + + + junit + junit + ${junit.version} + test + + + + + + Central + Central + http://repo1.maven.org/maven2/ + default + + + mulesoft-releases + MuleSoft Releases Repository + http://repository.mulesoft.org/releases/ + default + + + mulesoft-snapshots + MuleSoft Snapshots Repository + http://repository.mulesoft.org/snapshots/ + default + + + + + mulesoft-release + mulesoft release repository + default + http://repository.mulesoft.org/releases/ + + false + + + + + diff --git a/centralwebservices/src/.svn/entries b/centralwebservices/src/.svn/entries new file mode 100644 index 0000000..4b5db88 --- /dev/null +++ b/centralwebservices/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src +svn://172.17.26.185/COMACO + + + +2021-05-14T20:47:05.591314Z +4636 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/centralwebservices/src/main/.svn/entries b/centralwebservices/src/main/.svn/entries new file mode 100644 index 0000000..43b6950 --- /dev/null +++ b/centralwebservices/src/main/.svn/entries @@ -0,0 +1,40 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main +svn://172.17.26.185/COMACO + + + +2021-05-14T20:47:05.591314Z +4636 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +app +dir + +java +dir + +api +dir + +resources +dir + diff --git a/centralwebservices/src/main/api/.svn/entries b/centralwebservices/src/main/api/.svn/entries new file mode 100644 index 0000000..9031d05 --- /dev/null +++ b/centralwebservices/src/main/api/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/api +svn://172.17.26.185/COMACO + + + +2014-12-11T05:00:43.966009Z +3415 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/centralwebservices/src/main/app/.svn/entries b/centralwebservices/src/main/app/.svn/entries new file mode 100644 index 0000000..b4d1157 --- /dev/null +++ b/centralwebservices/src/main/app/.svn/entries @@ -0,0 +1,436 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/app +svn://172.17.26.185/COMACO + + + +2021-05-14T20:47:05.591314Z +4636 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +centralwebservices-datosnap.xml +file + + + + +2022-07-28T03:40:47.054822Z +abd7e0b326e86a8083d32c46df9edd14 +2016-02-02T21:18:20.974622Z +4422 +cvasquez + + + + + + + + + + + + + + + + + + + + + +1799 + +centralwebservicessnap-ruc.xml +file + + + + +2022-07-28T03:40:47.054822Z +bea6413e59dbaeea24ac722ae0afce7a +2015-04-30T06:52:25.886120Z +4063 +cpiedra +has-props + + + + + + + + + + + + + + + + + + + + +1506 + +centralwebservicessnap-ced.xml +file + + + + +2022-07-28T03:40:47.054822Z +4f863119b8acfe73437106bf70173ee2 +2021-05-14T20:47:05.591314Z +4636 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1478 + +centralwebservices-lectura.xml +file + + + + +2022-07-28T03:40:47.055822Z +0abb5675df5e30bdbeeb5d07e8d74a8b +2015-04-30T06:52:25.886120Z +4063 +cpiedra +has-props + + + + + + + + + + + + + + + + + + + + +1799 + +centralwebservices-documentos.xml +file + + + + +2022-07-28T03:40:47.055822Z +f381cac442c8bb564915e393b9621351 +2015-04-30T06:52:25.886120Z +4063 +cpiedra +has-props + + + + + + + + + + + + + + + + + + + + +1812 + +mule-deploy.properties +file + + + + +2022-07-28T03:40:47.055822Z +dfe5215305598015e6ab8b5936303519 +2016-02-02T21:18:48.187992Z +4423 +cvasquez +has-props + + + + + + + + + + + + + + + + + + + + +440 + +centralwebservices-consultalogin.xml +file + + + + +2022-07-28T03:40:47.056822Z +953b7500cf9a50010434f5472bbd0493 +2015-04-30T06:52:25.886120Z +4063 +cpiedra +has-props + + + + + + + + + + + + + + + + + + + + +2016 + +centralwebservices-lectura2.xml +file + + + + +2022-07-28T03:40:47.056822Z +234ab207d8fe5d4689896602521552d7 +2015-05-08T04:25:52.157662Z +4082 +cpiedra + + + + + + + + + + + + + + + + + + + + + +1602 + +centralwebservices-consultalogin1.xml +file + + + + +2022-07-28T03:40:47.056822Z +1c8401a38c24019d4d08a01e833179ec +2015-05-08T04:25:52.157662Z +4082 +cpiedra + + + + + + + + + + + + + + + + + + + + + +1834 + +centralwebservices-armas.xml +file + + + + +2022-07-28T03:40:47.056822Z +d3330dcc84d047009ddb09a75d5ddc96 +2015-04-30T06:52:25.886120Z +4063 +cpiedra +has-props + + + + + + + + + + + + + + + + + + + + +2200 + +centralwebservices-colaimpresion.xml +file + + + + +2022-07-28T03:40:47.057822Z +bf06f779305e2e2e09e4ebe6604a7bf1 +2017-06-26T18:54:33.784915Z +4605 +jespinosa +has-props + + + + + + + + + + + + + + + + + + + + +1863 + +mule-app.properties +file + + + + +2022-07-28T03:40:47.057822Z +d41d8cd98f00b204e9800998ecf8427e +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +0 + diff --git a/centralwebservices/src/main/app/.svn/prop-base/centralwebservices-armas.xml.svn-base b/centralwebservices/src/main/app/.svn/prop-base/centralwebservices-armas.xml.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/app/.svn/prop-base/centralwebservices-armas.xml.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/app/.svn/prop-base/centralwebservices-colaimpresion.xml.svn-base b/centralwebservices/src/main/app/.svn/prop-base/centralwebservices-colaimpresion.xml.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/app/.svn/prop-base/centralwebservices-colaimpresion.xml.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/app/.svn/prop-base/centralwebservices-consultalogin.xml.svn-base b/centralwebservices/src/main/app/.svn/prop-base/centralwebservices-consultalogin.xml.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/app/.svn/prop-base/centralwebservices-consultalogin.xml.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/app/.svn/prop-base/centralwebservices-documentos.xml.svn-base b/centralwebservices/src/main/app/.svn/prop-base/centralwebservices-documentos.xml.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/app/.svn/prop-base/centralwebservices-documentos.xml.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/app/.svn/prop-base/centralwebservices-lectura.xml.svn-base b/centralwebservices/src/main/app/.svn/prop-base/centralwebservices-lectura.xml.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/app/.svn/prop-base/centralwebservices-lectura.xml.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/app/.svn/prop-base/centralwebservicessnap-ced.xml.svn-base b/centralwebservices/src/main/app/.svn/prop-base/centralwebservicessnap-ced.xml.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/app/.svn/prop-base/centralwebservicessnap-ced.xml.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/app/.svn/prop-base/centralwebservicessnap-ruc.xml.svn-base b/centralwebservices/src/main/app/.svn/prop-base/centralwebservicessnap-ruc.xml.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/app/.svn/prop-base/centralwebservicessnap-ruc.xml.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/app/.svn/prop-base/mule-app.properties.svn-base b/centralwebservices/src/main/app/.svn/prop-base/mule-app.properties.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/app/.svn/prop-base/mule-app.properties.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/app/.svn/prop-base/mule-deploy.properties.svn-base b/centralwebservices/src/main/app/.svn/prop-base/mule-deploy.properties.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/app/.svn/prop-base/mule-deploy.properties.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/app/.svn/text-base/centralwebservices-armas.xml.netbeans-base b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-armas.xml.netbeans-base new file mode 100644 index 0000000..8943dd1 --- /dev/null +++ b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-armas.xml.netbeans-base @@ -0,0 +1,21 @@ + + + + + + + + + + + + + diff --git a/centralwebservices/src/main/app/.svn/text-base/centralwebservices-armas.xml.svn-base b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-armas.xml.svn-base new file mode 100644 index 0000000..8943dd1 --- /dev/null +++ b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-armas.xml.svn-base @@ -0,0 +1,21 @@ + + + + + + + + + + + + + diff --git a/centralwebservices/src/main/app/.svn/text-base/centralwebservices-colaimpresion.xml.svn-base b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-colaimpresion.xml.svn-base new file mode 100644 index 0000000..86e56ad --- /dev/null +++ b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-colaimpresion.xml.svn-base @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/centralwebservices/src/main/app/.svn/text-base/centralwebservices-consultalogin.xml.netbeans-base b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-consultalogin.xml.netbeans-base new file mode 100644 index 0000000..1966174 --- /dev/null +++ b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-consultalogin.xml.netbeans-base @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/centralwebservices/src/main/app/.svn/text-base/centralwebservices-consultalogin.xml.svn-base b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-consultalogin.xml.svn-base new file mode 100644 index 0000000..1966174 --- /dev/null +++ b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-consultalogin.xml.svn-base @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/centralwebservices/src/main/app/.svn/text-base/centralwebservices-consultalogin1.xml.netbeans-base b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-consultalogin1.xml.netbeans-base new file mode 100644 index 0000000..5d1573c --- /dev/null +++ b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-consultalogin1.xml.netbeans-base @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/centralwebservices/src/main/app/.svn/text-base/centralwebservices-consultalogin1.xml.svn-base b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-consultalogin1.xml.svn-base new file mode 100644 index 0000000..5d1573c --- /dev/null +++ b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-consultalogin1.xml.svn-base @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/centralwebservices/src/main/app/.svn/text-base/centralwebservices-datosnap.xml.svn-base b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-datosnap.xml.svn-base new file mode 100644 index 0000000..89b60db --- /dev/null +++ b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-datosnap.xml.svn-base @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/centralwebservices/src/main/app/.svn/text-base/centralwebservices-documentos.xml.svn-base b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-documentos.xml.svn-base new file mode 100644 index 0000000..edafa6a --- /dev/null +++ b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-documentos.xml.svn-base @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/centralwebservices/src/main/app/.svn/text-base/centralwebservices-lectura.xml.svn-base b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-lectura.xml.svn-base new file mode 100644 index 0000000..1abfd2a --- /dev/null +++ b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-lectura.xml.svn-base @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/centralwebservices/src/main/app/.svn/text-base/centralwebservices-lectura2.xml.netbeans-base b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-lectura2.xml.netbeans-base new file mode 100644 index 0000000..2051a5f --- /dev/null +++ b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-lectura2.xml.netbeans-base @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/centralwebservices/src/main/app/.svn/text-base/centralwebservices-lectura2.xml.svn-base b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-lectura2.xml.svn-base new file mode 100644 index 0000000..2051a5f --- /dev/null +++ b/centralwebservices/src/main/app/.svn/text-base/centralwebservices-lectura2.xml.svn-base @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/centralwebservices/src/main/app/.svn/text-base/centralwebservicessnap-ced.xml.netbeans-base b/centralwebservices/src/main/app/.svn/text-base/centralwebservicessnap-ced.xml.netbeans-base new file mode 100644 index 0000000..e76c336 --- /dev/null +++ b/centralwebservices/src/main/app/.svn/text-base/centralwebservicessnap-ced.xml.netbeans-base @@ -0,0 +1,17 @@ + + + + + + + + + + + + + diff --git a/centralwebservices/src/main/app/.svn/text-base/centralwebservicessnap-ced.xml.svn-base b/centralwebservices/src/main/app/.svn/text-base/centralwebservicessnap-ced.xml.svn-base new file mode 100644 index 0000000..e76c336 --- /dev/null +++ b/centralwebservices/src/main/app/.svn/text-base/centralwebservicessnap-ced.xml.svn-base @@ -0,0 +1,17 @@ + + + + + + + + + + + + + diff --git a/centralwebservices/src/main/app/.svn/text-base/centralwebservicessnap-ruc.xml.netbeans-base b/centralwebservices/src/main/app/.svn/text-base/centralwebservicessnap-ruc.xml.netbeans-base new file mode 100644 index 0000000..99e76f9 --- /dev/null +++ b/centralwebservices/src/main/app/.svn/text-base/centralwebservicessnap-ruc.xml.netbeans-base @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/centralwebservices/src/main/app/.svn/text-base/centralwebservicessnap-ruc.xml.svn-base b/centralwebservices/src/main/app/.svn/text-base/centralwebservicessnap-ruc.xml.svn-base new file mode 100644 index 0000000..99e76f9 --- /dev/null +++ b/centralwebservices/src/main/app/.svn/text-base/centralwebservicessnap-ruc.xml.svn-base @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/centralwebservices/src/main/app/.svn/text-base/mule-app.properties.netbeans-base b/centralwebservices/src/main/app/.svn/text-base/mule-app.properties.netbeans-base new file mode 100644 index 0000000..e69de29 diff --git a/centralwebservices/src/main/app/.svn/text-base/mule-app.properties.svn-base b/centralwebservices/src/main/app/.svn/text-base/mule-app.properties.svn-base new file mode 100644 index 0000000..e69de29 diff --git a/centralwebservices/src/main/app/.svn/text-base/mule-deploy.properties.netbeans-base b/centralwebservices/src/main/app/.svn/text-base/mule-deploy.properties.netbeans-base new file mode 100644 index 0000000..0aa574e --- /dev/null +++ b/centralwebservices/src/main/app/.svn/text-base/mule-deploy.properties.netbeans-base @@ -0,0 +1,5 @@ +#Thu Apr 30 15:37:39 COT 2015 +redeployment.enabled=true +encoding=UTF-8 +config.resources=centralwebservicessnap-ruc.xml,centralwebservicessnap-ced.xml,centralwebservices-lectura2.xml,centralwebservices-lectura.xml,centralwebservices-documentos.xml,centralwebservices-consultalogin1.xml,centralwebservices-consultalogin.xml,centralwebservices-colaimpresion.xml,centralwebservices-armas.xml,centralwebservices-datosnap.xml +domain=default diff --git a/centralwebservices/src/main/app/.svn/text-base/mule-deploy.properties.svn-base b/centralwebservices/src/main/app/.svn/text-base/mule-deploy.properties.svn-base new file mode 100644 index 0000000..0aa574e --- /dev/null +++ b/centralwebservices/src/main/app/.svn/text-base/mule-deploy.properties.svn-base @@ -0,0 +1,5 @@ +#Thu Apr 30 15:37:39 COT 2015 +redeployment.enabled=true +encoding=UTF-8 +config.resources=centralwebservicessnap-ruc.xml,centralwebservicessnap-ced.xml,centralwebservices-lectura2.xml,centralwebservices-lectura.xml,centralwebservices-documentos.xml,centralwebservices-consultalogin1.xml,centralwebservices-consultalogin.xml,centralwebservices-colaimpresion.xml,centralwebservices-armas.xml,centralwebservices-datosnap.xml +domain=default diff --git a/centralwebservices/src/main/app/centralwebservices-armas.xml b/centralwebservices/src/main/app/centralwebservices-armas.xml new file mode 100644 index 0000000..8943dd1 --- /dev/null +++ b/centralwebservices/src/main/app/centralwebservices-armas.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + diff --git a/centralwebservices/src/main/app/centralwebservices-colaimpresion.xml b/centralwebservices/src/main/app/centralwebservices-colaimpresion.xml new file mode 100644 index 0000000..86e56ad --- /dev/null +++ b/centralwebservices/src/main/app/centralwebservices-colaimpresion.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/centralwebservices/src/main/app/centralwebservices-consultalogin.xml b/centralwebservices/src/main/app/centralwebservices-consultalogin.xml new file mode 100644 index 0000000..1966174 --- /dev/null +++ b/centralwebservices/src/main/app/centralwebservices-consultalogin.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/centralwebservices/src/main/app/centralwebservices-consultalogin1.xml b/centralwebservices/src/main/app/centralwebservices-consultalogin1.xml new file mode 100644 index 0000000..5d1573c --- /dev/null +++ b/centralwebservices/src/main/app/centralwebservices-consultalogin1.xml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/centralwebservices/src/main/app/centralwebservices-datosnap.xml b/centralwebservices/src/main/app/centralwebservices-datosnap.xml new file mode 100644 index 0000000..89b60db --- /dev/null +++ b/centralwebservices/src/main/app/centralwebservices-datosnap.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/centralwebservices/src/main/app/centralwebservices-documentos.xml b/centralwebservices/src/main/app/centralwebservices-documentos.xml new file mode 100644 index 0000000..edafa6a --- /dev/null +++ b/centralwebservices/src/main/app/centralwebservices-documentos.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/centralwebservices/src/main/app/centralwebservices-lectura.xml b/centralwebservices/src/main/app/centralwebservices-lectura.xml new file mode 100644 index 0000000..1abfd2a --- /dev/null +++ b/centralwebservices/src/main/app/centralwebservices-lectura.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/centralwebservices/src/main/app/centralwebservices-lectura2.xml b/centralwebservices/src/main/app/centralwebservices-lectura2.xml new file mode 100644 index 0000000..2051a5f --- /dev/null +++ b/centralwebservices/src/main/app/centralwebservices-lectura2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/centralwebservices/src/main/app/centralwebservicessnap-ced.xml b/centralwebservices/src/main/app/centralwebservicessnap-ced.xml new file mode 100644 index 0000000..e76c336 --- /dev/null +++ b/centralwebservices/src/main/app/centralwebservicessnap-ced.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + diff --git a/centralwebservices/src/main/app/centralwebservicessnap-ruc.xml b/centralwebservices/src/main/app/centralwebservicessnap-ruc.xml new file mode 100644 index 0000000..99e76f9 --- /dev/null +++ b/centralwebservices/src/main/app/centralwebservicessnap-ruc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/centralwebservices/src/main/app/mule-app.properties b/centralwebservices/src/main/app/mule-app.properties new file mode 100644 index 0000000..e69de29 diff --git a/centralwebservices/src/main/app/mule-deploy.properties b/centralwebservices/src/main/app/mule-deploy.properties new file mode 100644 index 0000000..0aa574e --- /dev/null +++ b/centralwebservices/src/main/app/mule-deploy.properties @@ -0,0 +1,5 @@ +#Thu Apr 30 15:37:39 COT 2015 +redeployment.enabled=true +encoding=UTF-8 +config.resources=centralwebservicessnap-ruc.xml,centralwebservicessnap-ced.xml,centralwebservices-lectura2.xml,centralwebservices-lectura.xml,centralwebservices-documentos.xml,centralwebservices-consultalogin1.xml,centralwebservices-consultalogin.xml,centralwebservices-colaimpresion.xml,centralwebservices-armas.xml,centralwebservices-datosnap.xml +domain=default diff --git a/centralwebservices/src/main/java/.svn/entries b/centralwebservices/src/main/java/.svn/entries new file mode 100644 index 0000000..9e491f6 --- /dev/null +++ b/centralwebservices/src/main/java/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/java +svn://172.17.26.185/COMACO + + + +2015-05-08T04:26:40.595617Z +4083 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ec +dir + +com +dir + diff --git a/centralwebservices/src/main/java/com/.svn/entries b/centralwebservices/src/main/java/com/.svn/entries new file mode 100644 index 0000000..41acd9e --- /dev/null +++ b/centralwebservices/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/java/com +svn://172.17.26.185/COMACO + + + +2015-05-08T04:26:40.595617Z +4083 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/centralwebservices/src/main/java/com/fp/.svn/entries b/centralwebservices/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..f34fdb8 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2015-05-08T04:26:40.595617Z +4083 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +webservices +dir + diff --git a/centralwebservices/src/main/java/com/fp/webservices/.svn/entries b/centralwebservices/src/main/java/com/fp/webservices/.svn/entries new file mode 100644 index 0000000..ed6124d --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/java/com/fp/webservices +svn://172.17.26.185/COMACO + + + +2015-05-08T04:26:40.595617Z +4083 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +snap +dir + diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/.svn/entries b/centralwebservices/src/main/java/com/fp/webservices/snap/.svn/entries new file mode 100644 index 0000000..3990ceb --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/.svn/entries @@ -0,0 +1,43 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/java/com/fp/webservices/snap +svn://172.17.26.185/COMACO + + + +2015-05-08T04:26:40.595617Z +4083 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +recursos +dir + +seguridad +dir + +ruc +dir + +cedula +dir + +util +dir + diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/.svn/entries b/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/.svn/entries new file mode 100644 index 0000000..bba05f5 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/java/com/fp/webservices/snap/cedula +svn://172.17.26.185/COMACO + + + +2014-12-11T05:00:43.966009Z +3415 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +impl +dir + +CedulaServicio.java +file + + + + +2022-07-28T03:40:47.288823Z +cc831e65c0ab50aeb9d440ffa4da6e38 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +427 + diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/.svn/prop-base/CedulaServicio.java.svn-base b/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/.svn/prop-base/CedulaServicio.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/.svn/prop-base/CedulaServicio.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/.svn/text-base/CedulaServicio.java.svn-base b/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/.svn/text-base/CedulaServicio.java.svn-base new file mode 100644 index 0000000..a37e7ce --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/.svn/text-base/CedulaServicio.java.svn-base @@ -0,0 +1,19 @@ +package com.fp.webservices.snap.cedula; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; + +import ec.gob.registrocivil.consultacedula.Cedula; + +/** + * Servicio que contiene los datos de la cédula de identidad en el registro civil + * @author dcruz + * + */ +@WebService +public interface CedulaServicio { + + @WebMethod + public Cedula consultarCedula(@WebParam(name="cedula")String cedula); +} diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/CedulaServicio.java b/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/CedulaServicio.java new file mode 100644 index 0000000..a37e7ce --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/CedulaServicio.java @@ -0,0 +1,19 @@ +package com.fp.webservices.snap.cedula; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; + +import ec.gob.registrocivil.consultacedula.Cedula; + +/** + * Servicio que contiene los datos de la cédula de identidad en el registro civil + * @author dcruz + * + */ +@WebService +public interface CedulaServicio { + + @WebMethod + public Cedula consultarCedula(@WebParam(name="cedula")String cedula); +} diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/impl/.svn/entries b/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/impl/.svn/entries new file mode 100644 index 0000000..cc8ba0c --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/impl/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/impl +svn://172.17.26.185/COMACO + + + +2014-12-11T05:00:43.966009Z +3415 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +CedulaServicioImpl.java +file + + + + +2022-07-28T03:40:47.279823Z +860daeb75f5c927bc65650abacb4ec81 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1527 + diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/impl/.svn/prop-base/CedulaServicioImpl.java.svn-base b/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/impl/.svn/prop-base/CedulaServicioImpl.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/impl/.svn/prop-base/CedulaServicioImpl.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/impl/.svn/text-base/CedulaServicioImpl.java.svn-base b/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/impl/.svn/text-base/CedulaServicioImpl.java.svn-base new file mode 100644 index 0000000..2a07ef1 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/impl/.svn/text-base/CedulaServicioImpl.java.svn-base @@ -0,0 +1,33 @@ +package com.fp.webservices.snap.cedula.impl; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; + +import com.fp.webservices.snap.cedula.CedulaServicio; +import com.fp.webservices.snap.recursos.MsgSnap; +import com.fp.webservices.snap.seguridad.DatosHeader; +import com.fp.webservices.snap.seguridad.HeaderHandlerResolver; +import com.fp.webservices.snap.seguridad.PermissionClient; + +import ec.gob.registrocivil.consultacedula.Cedula; + +@WebService(endpointInterface="com.fp.webservices.snap.cedula.CedulaServicio", serviceName="CedulaServicio") +public class CedulaServicioImpl implements CedulaServicio { + + @Override + @WebMethod + public Cedula consultarCedula(@WebParam(name = "cedula") String cedula) { + DatosHeader headers= new DatosHeader(); + PermissionClient permissionClient = new PermissionClient(MsgSnap.getString("url_consulta_cedula")); + headers = permissionClient.generaToken(); + ec.gob.registrocivil.consultacedula.WSRegistroCivilConsultaCedula_Service service = new ec.gob.registrocivil.consultacedula.WSRegistroCivilConsultaCedula_Service(); + HeaderHandlerResolver handlerResolver = new HeaderHandlerResolver(headers); + service.setHandlerResolver(handlerResolver); + + ec.gob.registrocivil.consultacedula.WSRegistroCivilConsultaCedula port = service.getWSRegistroCivilConsultaCedulaPort(); + ec.gob.registrocivil.consultacedula.Cedula result = port.busquedaPorCedula(cedula, MsgSnap.getString("usuario"), MsgSnap.getString("password")); + return result; + } + +} diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/impl/CedulaServicioImpl.java b/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/impl/CedulaServicioImpl.java new file mode 100644 index 0000000..2a07ef1 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/cedula/impl/CedulaServicioImpl.java @@ -0,0 +1,33 @@ +package com.fp.webservices.snap.cedula.impl; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; + +import com.fp.webservices.snap.cedula.CedulaServicio; +import com.fp.webservices.snap.recursos.MsgSnap; +import com.fp.webservices.snap.seguridad.DatosHeader; +import com.fp.webservices.snap.seguridad.HeaderHandlerResolver; +import com.fp.webservices.snap.seguridad.PermissionClient; + +import ec.gob.registrocivil.consultacedula.Cedula; + +@WebService(endpointInterface="com.fp.webservices.snap.cedula.CedulaServicio", serviceName="CedulaServicio") +public class CedulaServicioImpl implements CedulaServicio { + + @Override + @WebMethod + public Cedula consultarCedula(@WebParam(name = "cedula") String cedula) { + DatosHeader headers= new DatosHeader(); + PermissionClient permissionClient = new PermissionClient(MsgSnap.getString("url_consulta_cedula")); + headers = permissionClient.generaToken(); + ec.gob.registrocivil.consultacedula.WSRegistroCivilConsultaCedula_Service service = new ec.gob.registrocivil.consultacedula.WSRegistroCivilConsultaCedula_Service(); + HeaderHandlerResolver handlerResolver = new HeaderHandlerResolver(headers); + service.setHandlerResolver(handlerResolver); + + ec.gob.registrocivil.consultacedula.WSRegistroCivilConsultaCedula port = service.getWSRegistroCivilConsultaCedulaPort(); + ec.gob.registrocivil.consultacedula.Cedula result = port.busquedaPorCedula(cedula, MsgSnap.getString("usuario"), MsgSnap.getString("password")); + return result; + } + +} diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/recursos/.svn/entries b/centralwebservices/src/main/java/com/fp/webservices/snap/recursos/.svn/entries new file mode 100644 index 0000000..d03ed46 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/recursos/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/java/com/fp/webservices/snap/recursos +svn://172.17.26.185/COMACO + + + +2014-12-11T05:00:43.966009Z +3415 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +MsgSnap.java +file + + + + +2022-07-28T03:40:47.224822Z +6bdad900e65e71776e163b22cafac4fb +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +572 + diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/recursos/.svn/prop-base/MsgSnap.java.svn-base b/centralwebservices/src/main/java/com/fp/webservices/snap/recursos/.svn/prop-base/MsgSnap.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/recursos/.svn/prop-base/MsgSnap.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/recursos/.svn/text-base/MsgSnap.java.svn-base b/centralwebservices/src/main/java/com/fp/webservices/snap/recursos/.svn/text-base/MsgSnap.java.svn-base new file mode 100644 index 0000000..a77c5b2 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/recursos/.svn/text-base/MsgSnap.java.svn-base @@ -0,0 +1,26 @@ +package com.fp.webservices.snap.recursos; + +import java.util.ResourceBundle; + +/** + * Clase utilitaria que maneja el archivo de propiedades del usuario + * @author dcruz + * + */ +public class MsgSnap { + + private static final String RESOURCES = "com.fp.webservices.snap.recursos.snap"; + private static ResourceBundle properties = null; + + static{ + properties = ResourceBundle.getBundle(RESOURCES); + } + + public static String getString(String key) { + return properties.getString(key); + } + + public static String getObject(String key) { + return properties.getString(key); + } +} diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/recursos/MsgSnap.java b/centralwebservices/src/main/java/com/fp/webservices/snap/recursos/MsgSnap.java new file mode 100644 index 0000000..a77c5b2 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/recursos/MsgSnap.java @@ -0,0 +1,26 @@ +package com.fp.webservices.snap.recursos; + +import java.util.ResourceBundle; + +/** + * Clase utilitaria que maneja el archivo de propiedades del usuario + * @author dcruz + * + */ +public class MsgSnap { + + private static final String RESOURCES = "com.fp.webservices.snap.recursos.snap"; + private static ResourceBundle properties = null; + + static{ + properties = ResourceBundle.getBundle(RESOURCES); + } + + public static String getString(String key) { + return properties.getString(key); + } + + public static String getObject(String key) { + return properties.getString(key); + } +} diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/.svn/entries b/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/.svn/entries new file mode 100644 index 0000000..7b2e327 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/java/com/fp/webservices/snap/ruc +svn://172.17.26.185/COMACO + + + +2015-01-23T13:20:32.296918Z +3801 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +impl +dir + +RucServicio.java +file + + + + +2022-07-28T03:40:47.264823Z +236cc864ebdff3808f292311920311b4 +2015-01-23T13:20:32.296918Z +3801 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +566 + diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/.svn/prop-base/RucServicio.java.svn-base b/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/.svn/prop-base/RucServicio.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/.svn/prop-base/RucServicio.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/.svn/text-base/RucServicio.java.svn-base b/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/.svn/text-base/RucServicio.java.svn-base new file mode 100644 index 0000000..23e93d8 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/.svn/text-base/RucServicio.java.svn-base @@ -0,0 +1,24 @@ +package com.fp.webservices.snap.ruc; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; + +import ec.gov.sri.wsconsultacontribuyente.ContribuyenteCompleto; + +/** + * Web servicio que interactúa con el servicio web del SRI y retorna los datos del contribuyente + * @author dcruz + * + */ +@WebService +public interface RucServicio { + + /** + * Retorna los datos del contribuyente si es el RUC es válido + * @param ruc + * @return + */ + @WebMethod + public ContribuyenteCompleto consultarRuc(@WebParam(name = "ruc") String ruc); +} diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/RucServicio.java b/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/RucServicio.java new file mode 100644 index 0000000..23e93d8 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/RucServicio.java @@ -0,0 +1,24 @@ +package com.fp.webservices.snap.ruc; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; + +import ec.gov.sri.wsconsultacontribuyente.ContribuyenteCompleto; + +/** + * Web servicio que interactúa con el servicio web del SRI y retorna los datos del contribuyente + * @author dcruz + * + */ +@WebService +public interface RucServicio { + + /** + * Retorna los datos del contribuyente si es el RUC es válido + * @param ruc + * @return + */ + @WebMethod + public ContribuyenteCompleto consultarRuc(@WebParam(name = "ruc") String ruc); +} diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/impl/.svn/entries b/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/impl/.svn/entries new file mode 100644 index 0000000..8bef93e --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/impl/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/impl +svn://172.17.26.185/COMACO + + + +2015-01-23T13:20:32.296918Z +3801 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +RucServicioImpl.java +file + + + + +2022-07-28T03:40:47.252823Z +4dc21adca22706586eab23c1cd87b606 +2015-01-23T13:20:32.296918Z +3801 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1492 + diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/impl/.svn/prop-base/RucServicioImpl.java.svn-base b/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/impl/.svn/prop-base/RucServicioImpl.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/impl/.svn/prop-base/RucServicioImpl.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/impl/.svn/text-base/RucServicioImpl.java.svn-base b/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/impl/.svn/text-base/RucServicioImpl.java.svn-base new file mode 100644 index 0000000..6211d49 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/impl/.svn/text-base/RucServicioImpl.java.svn-base @@ -0,0 +1,38 @@ +package com.fp.webservices.snap.ruc.impl; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; + +import com.fp.webservices.snap.recursos.MsgSnap; +import com.fp.webservices.snap.ruc.RucServicio; +import com.fp.webservices.snap.seguridad.DatosHeader; +import com.fp.webservices.snap.seguridad.HeaderHandlerResolver; +import com.fp.webservices.snap.seguridad.PermissionClient; + +import ec.gov.sri.wsconsultacontribuyente.ContribuyenteCompleto; +import ec.gov.sri.wsconsultacontribuyente.WebServiceContribuyenteService; + +@WebService(endpointInterface="com.fp.webservices.snap.ruc.RucServicio", serviceName="RucServicio") +public class RucServicioImpl implements RucServicio { + + @WebMethod + @Override + public ContribuyenteCompleto consultarRuc(@WebParam(name = "ruc") String ruc) { + // TODO Auto-generated method stub + DatosHeader headers= new DatosHeader(); + PermissionClient permissionClient = new PermissionClient(MsgSnap.getString("url_consulta_ruc")); + headers = permissionClient.generaToken(); + WebServiceContribuyenteService service = new WebServiceContribuyenteService(); + HeaderHandlerResolver handlerResolver = new HeaderHandlerResolver(headers); + service.setHandlerResolver(handlerResolver); + ContribuyenteCompleto contribuyente = service.getWsConsultaContribuyentePort().obtenerCompleto(ruc, ""); + return contribuyente; + } + + + public static void main(String[] args) { + RucServicioImpl ruc = new RucServicioImpl(); + ruc.consultarRuc(""); + } +} diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/impl/RucServicioImpl.java b/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/impl/RucServicioImpl.java new file mode 100644 index 0000000..6211d49 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/ruc/impl/RucServicioImpl.java @@ -0,0 +1,38 @@ +package com.fp.webservices.snap.ruc.impl; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; + +import com.fp.webservices.snap.recursos.MsgSnap; +import com.fp.webservices.snap.ruc.RucServicio; +import com.fp.webservices.snap.seguridad.DatosHeader; +import com.fp.webservices.snap.seguridad.HeaderHandlerResolver; +import com.fp.webservices.snap.seguridad.PermissionClient; + +import ec.gov.sri.wsconsultacontribuyente.ContribuyenteCompleto; +import ec.gov.sri.wsconsultacontribuyente.WebServiceContribuyenteService; + +@WebService(endpointInterface="com.fp.webservices.snap.ruc.RucServicio", serviceName="RucServicio") +public class RucServicioImpl implements RucServicio { + + @WebMethod + @Override + public ContribuyenteCompleto consultarRuc(@WebParam(name = "ruc") String ruc) { + // TODO Auto-generated method stub + DatosHeader headers= new DatosHeader(); + PermissionClient permissionClient = new PermissionClient(MsgSnap.getString("url_consulta_ruc")); + headers = permissionClient.generaToken(); + WebServiceContribuyenteService service = new WebServiceContribuyenteService(); + HeaderHandlerResolver handlerResolver = new HeaderHandlerResolver(headers); + service.setHandlerResolver(handlerResolver); + ContribuyenteCompleto contribuyente = service.getWsConsultaContribuyentePort().obtenerCompleto(ruc, ""); + return contribuyente; + } + + + public static void main(String[] args) { + RucServicioImpl ruc = new RucServicioImpl(); + ruc.consultarRuc(""); + } +} diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/entries b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/entries new file mode 100644 index 0000000..523c21e --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/entries @@ -0,0 +1,198 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad +svn://172.17.26.185/COMACO + + + +2015-05-08T04:26:40.595617Z +4083 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +DatosHeader.java +file + + + + +2022-07-28T03:40:47.238822Z +707509334c90fcd31bf52c3376036056 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +2124 + +RegistroCivilClient.java +file + + + + +2022-07-28T03:40:47.239822Z +537f026e30322c15c6f6927f38cd065d +2015-05-08T04:26:40.595617Z +4083 +cpiedra +has-props + + + + + + + + + + + + + + + + + + + + +2346 + +HeaderHandler.java +file + + + + +2022-07-28T03:40:47.239822Z +90c71209f7d8525e5460b02901976ea1 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +5879 + +PermissionClient.java +file + + + + +2022-07-28T03:40:47.239822Z +afdaeba57ffcd8b1a6ee55b019f29ee4 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +2619 + +HeaderHandlerResolver.java +file + + + + +2022-07-28T03:40:47.240822Z +7f089ef57fd848eee3f432a77089c6ab +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1770 + diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/prop-base/DatosHeader.java.svn-base b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/prop-base/DatosHeader.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/prop-base/DatosHeader.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/prop-base/HeaderHandler.java.svn-base b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/prop-base/HeaderHandler.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/prop-base/HeaderHandler.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/prop-base/HeaderHandlerResolver.java.svn-base b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/prop-base/HeaderHandlerResolver.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/prop-base/HeaderHandlerResolver.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/prop-base/PermissionClient.java.svn-base b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/prop-base/PermissionClient.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/prop-base/PermissionClient.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/prop-base/RegistroCivilClient.java.svn-base b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/prop-base/RegistroCivilClient.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/prop-base/RegistroCivilClient.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/text-base/DatosHeader.java.svn-base b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/text-base/DatosHeader.java.svn-base new file mode 100644 index 0000000..0a4d024 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/text-base/DatosHeader.java.svn-base @@ -0,0 +1,102 @@ +/* + +* +* Copyright (C) 2013 Libreria para Cliente Consulta Títulos development team. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2.1 of the License, or (at your option) any later version. +* +****************************************************** +* SUBSECRETARIA DE TECNOLOGIAS DE LA INFORMACION +* DIRECCION DE INTEROPERABILIDAD GUBERNAMENTAL +* +* FECHA CREACION : 02 -02-2013 +* AUTHOR: DIG DIRECCION DE INTEROPERABILIDAD GUBERNAMENTAL +* PROGRAMADOR:LUIGGI ANDRADE +* CONCEPTO : Consulta De Titulos de Ciudadanos +* Utilización del servicio web de la senascyt +* +* +* MODIFICACION (Fecha, Autor y la descripción de la modificación) +* +* +******************************************************* + + */ + + +package com.fp.webservices.snap.seguridad; + +/** + * Contiene información acerca de la autenticación realizada + * @author landrade + */ +public class DatosHeader { + + private String fecha; + private String fechaf; + private String nonce; + private String digest; + private String usuario; + + public DatosHeader() + { + + } + + public DatosHeader(String fecha,String nonce,String digest) + { + this.fecha = fecha; + this.fechaf = fecha; + this.nonce = nonce; + this.digest = digest; + } + + + public String getFecha() { + return fecha; + } + + public void setFecha(String fecha) { + this.fecha = fecha; + } + + public String getFechaf() { + return fechaf; + } + + public void setFechaf(String fechaf) { + this.fechaf = fechaf; + } + + + public String getNonce() { + return nonce; + } + + public void setNonce(String nonce) { + this.nonce = nonce; + } + + public String getDigest() { + return digest; + } + + public void setDigest(String digest) { + this.digest = digest; + } + + + public String getUsuario() { + return usuario; + } + + public void setUsuario(String usuario) { + this.usuario = usuario; + } + + + +} diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/text-base/HeaderHandler.java.svn-base b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/text-base/HeaderHandler.java.svn-base new file mode 100644 index 0000000..240466c --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/text-base/HeaderHandler.java.svn-base @@ -0,0 +1,164 @@ +/* + +* +* Copyright (C) 2013 Libreria para Cliente Consulta Títulos development team. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2.1 of the License, or (at your option) any later version. +* +****************************************************** +* SUBSECRETARIA DE TECNOLOGIAS DE LA INFORMACION +* DIRECCION DE INTEROPERABILIDAD GUBERNAMENTAL +* +* FECHA CREACION : 02 -02-2013 +* AUTHOR: DIG DIRECCION DE INTEROPERABILIDAD GUBERNAMENTAL +* PROGRAMADOR:LUIGGI ANDRADE +* CONCEPTO : Consulta De Titulos de Ciudadanos +* Utilización del servicio web de la senascyt +* +* +* MODIFICACION (Fecha, Autor y la descripción de la modificación) +* +* +******************************************************* + + */ +package com.fp.webservices.snap.seguridad; + + +import java.util.Set; + +import javax.xml.soap.SOAPElement; +import javax.xml.soap.SOAPEnvelope; +import javax.xml.soap.SOAPHeader; +import javax.xml.soap.SOAPMessage; +import javax.xml.ws.handler.MessageContext; +import javax.xml.ws.handler.soap.SOAPHandler; +import javax.xml.ws.handler.soap.SOAPMessageContext; + +/** + * Handler JAX-WS para manejar ws-security en el WS + * @author landrade + */ +public class HeaderHandler implements SOAPHandler { + + DatosHeader DHLista= new DatosHeader(); + + public HeaderHandler(DatosHeader DHeader){ + + DHLista.setDigest(DHeader.getDigest()); + DHLista.setNonce(DHeader.getNonce()); + DHLista.setFecha(DHeader.getFecha()); + DHLista.setFechaf(DHeader.getFechaf()); + DHLista.setUsuario(DHeader.getUsuario()); + + } + + + /** + * Método que manipula el mensaje y agrega los datos de la cabecera del servicio + */ + public boolean handleMessage(SOAPMessageContext smc) { + + Boolean outboundProperty = (Boolean) smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); + + + + if (outboundProperty.booleanValue()) { + + SOAPMessage message = smc.getMessage(); + + try { + + SOAPEnvelope envelope = smc.getMessage().getSOAPPart().getEnvelope(); + SOAPHeader header = envelope.addHeader(); + + // get SOAP envelope from SOAP message + + SOAPElement security = + header.addChildElement("Security", "wss", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"); + + + SOAPElement timeStamp = security + .addChildElement( + "Timestamp", + "wsu", + "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"); + + + SOAPElement createdTime = + timeStamp.addChildElement("Created", "wsu"); + createdTime.addTextNode(DHLista.getFecha()); + + SOAPElement expires = + timeStamp.addChildElement("Expires", "wsu"); + expires.addTextNode(DHLista.getFechaf()); + + + SOAPElement usernameToken = + security.addChildElement("UsernameToken","wss"); + //usernameToken.addAttribute(new QName("xmlns:wsu"), "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"); + + SOAPElement username = + usernameToken.addChildElement("Username", "wss"); + username.addTextNode(DHLista.getUsuario()); + + SOAPElement password = + usernameToken.addChildElement("Password", "wss"); + password.setAttribute("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"); + password.addTextNode(DHLista.getDigest()); + //password.addTextNode("Qro+U/5Swf50Pt04i4WS/PsbljY="); + + SOAPElement nonce = + usernameToken.addChildElement("Nonce", "wss"); + nonce.setAttribute("EncodingType", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"); + nonce.addTextNode(DHLista.getNonce()); + //nonce.addTextNode("He+y+afyHy7lWugWrn6LBQ=="); + + SOAPElement created = usernameToken.addChildElement("Created", "wsu", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"); + created.addTextNode(DHLista.getFecha()); + //created.addTextNode("2012-12-07T13:40:21Z"); + + //Print out the outbound SOAP message to System.out + message.writeTo(System.out); + + + } catch (Exception e) { + e.printStackTrace(); + } + + } else { + try { + + //This handler does nothing with the response from the Web Service so + //we just print out the SOAP message. + + SOAPMessage message = smc.getMessage(); + message.writeTo(System.out); + + } catch (Exception ex) { + ex.printStackTrace(); + } + } + return outboundProperty; + } + + /** + * Retorna las cabeceras del servicio + */ + public Set getHeaders() { + //throw new UnsupportedOperationException("Not supported yet."); + return null; + } + + public boolean handleFault(SOAPMessageContext context) { + //throw new UnsupportedOperationException("Not supported yet."); + return false; + } + + public void close(MessageContext context) { + //throw new UnsupportedOperationException("Not supported yet."); + } +} \ No newline at end of file diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/text-base/HeaderHandlerResolver.java.svn-base b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/text-base/HeaderHandlerResolver.java.svn-base new file mode 100644 index 0000000..e243df3 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/text-base/HeaderHandlerResolver.java.svn-base @@ -0,0 +1,62 @@ +/* + + * + * Copyright (C) 2013 Libreria para Cliente Consulta Títulos development team. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + ****************************************************** + * SUBSECRETARIA DE TECNOLOGIAS DE LA INFORMACION + * DIRECCION DE INTEROPERABILIDAD GUBERNAMENTAL + * + * FECHA CREACION : 02 -02-2013 + * AUTHOR: DIG DIRECCION DE INTEROPERABILIDAD GUBERNAMENTAL + * PROGRAMADOR:LUIGGI ANDRADE + * CONCEPTO : Consulta De Titulos de Ciudadanos + * Utilización del servicio web de la senascyt + * + * + * MODIFICACION (Fecha, Autor y la descripción de la modificación) + * + * + ******************************************************* + + */ + +package com.fp.webservices.snap.seguridad; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.ws.handler.Handler; +import javax.xml.ws.handler.HandlerResolver; +import javax.xml.ws.handler.PortInfo; + +/** + * + * @author landrade + */ +public class HeaderHandlerResolver implements HandlerResolver { + + private DatosHeader headerData = new DatosHeader(); + + public HeaderHandlerResolver(DatosHeader HeaderList) { + headerData.setDigest(HeaderList.getDigest()); + headerData.setNonce(HeaderList.getNonce()); + headerData.setFecha(HeaderList.getFecha()); + headerData.setFechaf(HeaderList.getFechaf()); + headerData.setUsuario(HeaderList.getUsuario()); + } + + public List getHandlerChain(PortInfo portInfo) { + List handlerChain = new ArrayList(); + + HeaderHandler hh = new HeaderHandler(headerData); + + handlerChain.add(hh); + + return handlerChain; + } +} diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/text-base/PermissionClient.java.svn-base b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/text-base/PermissionClient.java.svn-base new file mode 100644 index 0000000..a9c9753 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/text-base/PermissionClient.java.svn-base @@ -0,0 +1,67 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.webservices.snap.seguridad; + +import com.fp.webservices.snap.recursos.MsgSnap; + + +/** + * + */ +public class PermissionClient { + + //@WebServiceRef(wsdlLocation = "WEB-INF/wsdl/www.bsg.gob.ec/sw/STI/BSGSW08_Acceder_BSG.wsdl") +// private AccesoBSGService service = new AccesoBSGService(); + private String urlServicio; + + public PermissionClient(String urlServicio){ + this.urlServicio = urlServicio; + } + + public DatosHeader generaToken() { + try { // Call Web Service Operation + + DatosHeader headers = new DatosHeader(); + + ec.gob.bsg.accesobsgservice.AccesoBSGService service = new ec.gob.bsg.accesobsgservice.AccesoBSGService(); + ec.gob.bsg.accesobsgservice.BSG04AccederBSG port = service.getBSG04AccederBSGPort(); + // TODO initialize WS operation arguments here + ec.gob.bsg.accesobsgservice.ValidarPermisoPeticion validarPermisoPeticion = new ec.gob.bsg.accesobsgservice.ValidarPermisoPeticion(); + // TODO process result here + validarPermisoPeticion.setCedula(MsgSnap.getString("cedulapermiso")); + validarPermisoPeticion.setUrlsw(urlServicio); + + ec.gob.bsg.accesobsgservice.ValidarPermisoRespuesta result = port.validarPermiso(validarPermisoPeticion); + + + if (!result.getMensaje().getCodError().equals("000")) + { + System.out.println(result.getMensaje().getDesError()); + headers.setNonce(result.getMensaje().getDesError()); + headers.setDigest(result.getMensaje().getDesError()); + headers.setFecha(result.getMensaje().getDesError()); + headers.setFechaf(result.getMensaje().getDesError()); + } + else + { + + headers.setNonce(result.getNonce()); + headers.setDigest(result.getDigest()); + headers.setFecha(result.getFecha()); + headers.setFechaf(result.getFechaF()); + headers.setUsuario(MsgSnap.getString("cedulapermiso")); + } + System.out.println("Acceso = " + result.getMensaje().getDesError()); + return headers; + } catch (Exception ex) { + System.out.println(" ERROR "+ex.getMessage()); + ex.printStackTrace(); + // TODO handle custom exceptions here + return null; + } + } + +} diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/text-base/RegistroCivilClient.java.netbeans-base b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/text-base/RegistroCivilClient.java.netbeans-base new file mode 100644 index 0000000..6f50626 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/text-base/RegistroCivilClient.java.netbeans-base @@ -0,0 +1,57 @@ +package com.fp.webservices.snap.seguridad; + + +/** + * Susbsecretaria de Gobierno Electrónico + * Elaborado por : Ing.Luiggi Andrade + */ +public class RegistroCivilClient +{ + + //@WebServiceRef(wsdlLocation = "WEB-INF/wsdl/bsg.gob.ec/sw/RC/BSGSW01_Consultar_Cedula.wsdl") +// private static WSRegistroCivilConsultaCedula_Service service = new WSRegistroCivilConsultaCedula_Service(); + + public static void main(String[] args) { + PermissionClient permissionClient = new PermissionClient("https://www.bsg.gob.ec/sw/RC/BSGSW01_Consultar_Cedula?wsdl"); + try { // Call Web Service Operation + + DatosHeader headers= new DatosHeader(); + + //AuxValidarPermisoRespuesta validarPermiso = new AuxValidarPermisoRespuesta(); + headers = permissionClient.generaToken(); + + //DatosHeader headerData = new DatosHeader(); + + //headerData.setDigest(DatosHeader.getDigest()); + //headerData.setNonce(validarPermiso.getNonce()); + //headerData.setFecha(validarPermiso.getFecha()); + //headerData.setFechaf(validarPermiso.getFechaF()); + ec.gob.registrocivil.consultacedula.WSRegistroCivilConsultaCedula_Service service = new ec.gob.registrocivil.consultacedula.WSRegistroCivilConsultaCedula_Service(); + + HeaderHandlerResolver handlerResolver = new HeaderHandlerResolver(headers); + service.setHandlerResolver(handlerResolver); + + ec.gob.registrocivil.consultacedula.WSRegistroCivilConsultaCedula port = service.getWSRegistroCivilConsultaCedulaPort(); + System.out.println(" --- >> >"); + // TODO initialize WS operation arguments here + java.lang.String cedula = "1001114840"; + java.lang.String usuario = "testroot"; + java.lang.String contrasenia = "Sti1DigS21"; + // TODO process result here + ec.gob.registrocivil.consultacedula.Cedula result = port.busquedaPorCedula(cedula, usuario, contrasenia); + System.out.println("Result = " + result.getNombre()); + + + } catch (Exception ex) { + // TODO handle custom exceptions here + System.out.println(" --> "+ex.getMessage()); + ex.printStackTrace(); + } + + + + } + +} + + diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/text-base/RegistroCivilClient.java.svn-base b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/text-base/RegistroCivilClient.java.svn-base new file mode 100644 index 0000000..6f50626 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/.svn/text-base/RegistroCivilClient.java.svn-base @@ -0,0 +1,57 @@ +package com.fp.webservices.snap.seguridad; + + +/** + * Susbsecretaria de Gobierno Electrónico + * Elaborado por : Ing.Luiggi Andrade + */ +public class RegistroCivilClient +{ + + //@WebServiceRef(wsdlLocation = "WEB-INF/wsdl/bsg.gob.ec/sw/RC/BSGSW01_Consultar_Cedula.wsdl") +// private static WSRegistroCivilConsultaCedula_Service service = new WSRegistroCivilConsultaCedula_Service(); + + public static void main(String[] args) { + PermissionClient permissionClient = new PermissionClient("https://www.bsg.gob.ec/sw/RC/BSGSW01_Consultar_Cedula?wsdl"); + try { // Call Web Service Operation + + DatosHeader headers= new DatosHeader(); + + //AuxValidarPermisoRespuesta validarPermiso = new AuxValidarPermisoRespuesta(); + headers = permissionClient.generaToken(); + + //DatosHeader headerData = new DatosHeader(); + + //headerData.setDigest(DatosHeader.getDigest()); + //headerData.setNonce(validarPermiso.getNonce()); + //headerData.setFecha(validarPermiso.getFecha()); + //headerData.setFechaf(validarPermiso.getFechaF()); + ec.gob.registrocivil.consultacedula.WSRegistroCivilConsultaCedula_Service service = new ec.gob.registrocivil.consultacedula.WSRegistroCivilConsultaCedula_Service(); + + HeaderHandlerResolver handlerResolver = new HeaderHandlerResolver(headers); + service.setHandlerResolver(handlerResolver); + + ec.gob.registrocivil.consultacedula.WSRegistroCivilConsultaCedula port = service.getWSRegistroCivilConsultaCedulaPort(); + System.out.println(" --- >> >"); + // TODO initialize WS operation arguments here + java.lang.String cedula = "1001114840"; + java.lang.String usuario = "testroot"; + java.lang.String contrasenia = "Sti1DigS21"; + // TODO process result here + ec.gob.registrocivil.consultacedula.Cedula result = port.busquedaPorCedula(cedula, usuario, contrasenia); + System.out.println("Result = " + result.getNombre()); + + + } catch (Exception ex) { + // TODO handle custom exceptions here + System.out.println(" --> "+ex.getMessage()); + ex.printStackTrace(); + } + + + + } + +} + + diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/DatosHeader.java b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/DatosHeader.java new file mode 100644 index 0000000..0a4d024 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/DatosHeader.java @@ -0,0 +1,102 @@ +/* + +* +* Copyright (C) 2013 Libreria para Cliente Consulta Títulos development team. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2.1 of the License, or (at your option) any later version. +* +****************************************************** +* SUBSECRETARIA DE TECNOLOGIAS DE LA INFORMACION +* DIRECCION DE INTEROPERABILIDAD GUBERNAMENTAL +* +* FECHA CREACION : 02 -02-2013 +* AUTHOR: DIG DIRECCION DE INTEROPERABILIDAD GUBERNAMENTAL +* PROGRAMADOR:LUIGGI ANDRADE +* CONCEPTO : Consulta De Titulos de Ciudadanos +* Utilización del servicio web de la senascyt +* +* +* MODIFICACION (Fecha, Autor y la descripción de la modificación) +* +* +******************************************************* + + */ + + +package com.fp.webservices.snap.seguridad; + +/** + * Contiene información acerca de la autenticación realizada + * @author landrade + */ +public class DatosHeader { + + private String fecha; + private String fechaf; + private String nonce; + private String digest; + private String usuario; + + public DatosHeader() + { + + } + + public DatosHeader(String fecha,String nonce,String digest) + { + this.fecha = fecha; + this.fechaf = fecha; + this.nonce = nonce; + this.digest = digest; + } + + + public String getFecha() { + return fecha; + } + + public void setFecha(String fecha) { + this.fecha = fecha; + } + + public String getFechaf() { + return fechaf; + } + + public void setFechaf(String fechaf) { + this.fechaf = fechaf; + } + + + public String getNonce() { + return nonce; + } + + public void setNonce(String nonce) { + this.nonce = nonce; + } + + public String getDigest() { + return digest; + } + + public void setDigest(String digest) { + this.digest = digest; + } + + + public String getUsuario() { + return usuario; + } + + public void setUsuario(String usuario) { + this.usuario = usuario; + } + + + +} diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/HeaderHandler.java b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/HeaderHandler.java new file mode 100644 index 0000000..240466c --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/HeaderHandler.java @@ -0,0 +1,164 @@ +/* + +* +* Copyright (C) 2013 Libreria para Cliente Consulta Títulos development team. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2.1 of the License, or (at your option) any later version. +* +****************************************************** +* SUBSECRETARIA DE TECNOLOGIAS DE LA INFORMACION +* DIRECCION DE INTEROPERABILIDAD GUBERNAMENTAL +* +* FECHA CREACION : 02 -02-2013 +* AUTHOR: DIG DIRECCION DE INTEROPERABILIDAD GUBERNAMENTAL +* PROGRAMADOR:LUIGGI ANDRADE +* CONCEPTO : Consulta De Titulos de Ciudadanos +* Utilización del servicio web de la senascyt +* +* +* MODIFICACION (Fecha, Autor y la descripción de la modificación) +* +* +******************************************************* + + */ +package com.fp.webservices.snap.seguridad; + + +import java.util.Set; + +import javax.xml.soap.SOAPElement; +import javax.xml.soap.SOAPEnvelope; +import javax.xml.soap.SOAPHeader; +import javax.xml.soap.SOAPMessage; +import javax.xml.ws.handler.MessageContext; +import javax.xml.ws.handler.soap.SOAPHandler; +import javax.xml.ws.handler.soap.SOAPMessageContext; + +/** + * Handler JAX-WS para manejar ws-security en el WS + * @author landrade + */ +public class HeaderHandler implements SOAPHandler { + + DatosHeader DHLista= new DatosHeader(); + + public HeaderHandler(DatosHeader DHeader){ + + DHLista.setDigest(DHeader.getDigest()); + DHLista.setNonce(DHeader.getNonce()); + DHLista.setFecha(DHeader.getFecha()); + DHLista.setFechaf(DHeader.getFechaf()); + DHLista.setUsuario(DHeader.getUsuario()); + + } + + + /** + * Método que manipula el mensaje y agrega los datos de la cabecera del servicio + */ + public boolean handleMessage(SOAPMessageContext smc) { + + Boolean outboundProperty = (Boolean) smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); + + + + if (outboundProperty.booleanValue()) { + + SOAPMessage message = smc.getMessage(); + + try { + + SOAPEnvelope envelope = smc.getMessage().getSOAPPart().getEnvelope(); + SOAPHeader header = envelope.addHeader(); + + // get SOAP envelope from SOAP message + + SOAPElement security = + header.addChildElement("Security", "wss", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"); + + + SOAPElement timeStamp = security + .addChildElement( + "Timestamp", + "wsu", + "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"); + + + SOAPElement createdTime = + timeStamp.addChildElement("Created", "wsu"); + createdTime.addTextNode(DHLista.getFecha()); + + SOAPElement expires = + timeStamp.addChildElement("Expires", "wsu"); + expires.addTextNode(DHLista.getFechaf()); + + + SOAPElement usernameToken = + security.addChildElement("UsernameToken","wss"); + //usernameToken.addAttribute(new QName("xmlns:wsu"), "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"); + + SOAPElement username = + usernameToken.addChildElement("Username", "wss"); + username.addTextNode(DHLista.getUsuario()); + + SOAPElement password = + usernameToken.addChildElement("Password", "wss"); + password.setAttribute("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"); + password.addTextNode(DHLista.getDigest()); + //password.addTextNode("Qro+U/5Swf50Pt04i4WS/PsbljY="); + + SOAPElement nonce = + usernameToken.addChildElement("Nonce", "wss"); + nonce.setAttribute("EncodingType", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"); + nonce.addTextNode(DHLista.getNonce()); + //nonce.addTextNode("He+y+afyHy7lWugWrn6LBQ=="); + + SOAPElement created = usernameToken.addChildElement("Created", "wsu", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"); + created.addTextNode(DHLista.getFecha()); + //created.addTextNode("2012-12-07T13:40:21Z"); + + //Print out the outbound SOAP message to System.out + message.writeTo(System.out); + + + } catch (Exception e) { + e.printStackTrace(); + } + + } else { + try { + + //This handler does nothing with the response from the Web Service so + //we just print out the SOAP message. + + SOAPMessage message = smc.getMessage(); + message.writeTo(System.out); + + } catch (Exception ex) { + ex.printStackTrace(); + } + } + return outboundProperty; + } + + /** + * Retorna las cabeceras del servicio + */ + public Set getHeaders() { + //throw new UnsupportedOperationException("Not supported yet."); + return null; + } + + public boolean handleFault(SOAPMessageContext context) { + //throw new UnsupportedOperationException("Not supported yet."); + return false; + } + + public void close(MessageContext context) { + //throw new UnsupportedOperationException("Not supported yet."); + } +} \ No newline at end of file diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/HeaderHandlerResolver.java b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/HeaderHandlerResolver.java new file mode 100644 index 0000000..e243df3 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/HeaderHandlerResolver.java @@ -0,0 +1,62 @@ +/* + + * + * Copyright (C) 2013 Libreria para Cliente Consulta Títulos development team. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + ****************************************************** + * SUBSECRETARIA DE TECNOLOGIAS DE LA INFORMACION + * DIRECCION DE INTEROPERABILIDAD GUBERNAMENTAL + * + * FECHA CREACION : 02 -02-2013 + * AUTHOR: DIG DIRECCION DE INTEROPERABILIDAD GUBERNAMENTAL + * PROGRAMADOR:LUIGGI ANDRADE + * CONCEPTO : Consulta De Titulos de Ciudadanos + * Utilización del servicio web de la senascyt + * + * + * MODIFICACION (Fecha, Autor y la descripción de la modificación) + * + * + ******************************************************* + + */ + +package com.fp.webservices.snap.seguridad; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.ws.handler.Handler; +import javax.xml.ws.handler.HandlerResolver; +import javax.xml.ws.handler.PortInfo; + +/** + * + * @author landrade + */ +public class HeaderHandlerResolver implements HandlerResolver { + + private DatosHeader headerData = new DatosHeader(); + + public HeaderHandlerResolver(DatosHeader HeaderList) { + headerData.setDigest(HeaderList.getDigest()); + headerData.setNonce(HeaderList.getNonce()); + headerData.setFecha(HeaderList.getFecha()); + headerData.setFechaf(HeaderList.getFechaf()); + headerData.setUsuario(HeaderList.getUsuario()); + } + + public List getHandlerChain(PortInfo portInfo) { + List handlerChain = new ArrayList(); + + HeaderHandler hh = new HeaderHandler(headerData); + + handlerChain.add(hh); + + return handlerChain; + } +} diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/PermissionClient.java b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/PermissionClient.java new file mode 100644 index 0000000..a9c9753 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/PermissionClient.java @@ -0,0 +1,67 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.webservices.snap.seguridad; + +import com.fp.webservices.snap.recursos.MsgSnap; + + +/** + * + */ +public class PermissionClient { + + //@WebServiceRef(wsdlLocation = "WEB-INF/wsdl/www.bsg.gob.ec/sw/STI/BSGSW08_Acceder_BSG.wsdl") +// private AccesoBSGService service = new AccesoBSGService(); + private String urlServicio; + + public PermissionClient(String urlServicio){ + this.urlServicio = urlServicio; + } + + public DatosHeader generaToken() { + try { // Call Web Service Operation + + DatosHeader headers = new DatosHeader(); + + ec.gob.bsg.accesobsgservice.AccesoBSGService service = new ec.gob.bsg.accesobsgservice.AccesoBSGService(); + ec.gob.bsg.accesobsgservice.BSG04AccederBSG port = service.getBSG04AccederBSGPort(); + // TODO initialize WS operation arguments here + ec.gob.bsg.accesobsgservice.ValidarPermisoPeticion validarPermisoPeticion = new ec.gob.bsg.accesobsgservice.ValidarPermisoPeticion(); + // TODO process result here + validarPermisoPeticion.setCedula(MsgSnap.getString("cedulapermiso")); + validarPermisoPeticion.setUrlsw(urlServicio); + + ec.gob.bsg.accesobsgservice.ValidarPermisoRespuesta result = port.validarPermiso(validarPermisoPeticion); + + + if (!result.getMensaje().getCodError().equals("000")) + { + System.out.println(result.getMensaje().getDesError()); + headers.setNonce(result.getMensaje().getDesError()); + headers.setDigest(result.getMensaje().getDesError()); + headers.setFecha(result.getMensaje().getDesError()); + headers.setFechaf(result.getMensaje().getDesError()); + } + else + { + + headers.setNonce(result.getNonce()); + headers.setDigest(result.getDigest()); + headers.setFecha(result.getFecha()); + headers.setFechaf(result.getFechaF()); + headers.setUsuario(MsgSnap.getString("cedulapermiso")); + } + System.out.println("Acceso = " + result.getMensaje().getDesError()); + return headers; + } catch (Exception ex) { + System.out.println(" ERROR "+ex.getMessage()); + ex.printStackTrace(); + // TODO handle custom exceptions here + return null; + } + } + +} diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/RegistroCivilClient.java b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/RegistroCivilClient.java new file mode 100644 index 0000000..6f50626 --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/seguridad/RegistroCivilClient.java @@ -0,0 +1,57 @@ +package com.fp.webservices.snap.seguridad; + + +/** + * Susbsecretaria de Gobierno Electrónico + * Elaborado por : Ing.Luiggi Andrade + */ +public class RegistroCivilClient +{ + + //@WebServiceRef(wsdlLocation = "WEB-INF/wsdl/bsg.gob.ec/sw/RC/BSGSW01_Consultar_Cedula.wsdl") +// private static WSRegistroCivilConsultaCedula_Service service = new WSRegistroCivilConsultaCedula_Service(); + + public static void main(String[] args) { + PermissionClient permissionClient = new PermissionClient("https://www.bsg.gob.ec/sw/RC/BSGSW01_Consultar_Cedula?wsdl"); + try { // Call Web Service Operation + + DatosHeader headers= new DatosHeader(); + + //AuxValidarPermisoRespuesta validarPermiso = new AuxValidarPermisoRespuesta(); + headers = permissionClient.generaToken(); + + //DatosHeader headerData = new DatosHeader(); + + //headerData.setDigest(DatosHeader.getDigest()); + //headerData.setNonce(validarPermiso.getNonce()); + //headerData.setFecha(validarPermiso.getFecha()); + //headerData.setFechaf(validarPermiso.getFechaF()); + ec.gob.registrocivil.consultacedula.WSRegistroCivilConsultaCedula_Service service = new ec.gob.registrocivil.consultacedula.WSRegistroCivilConsultaCedula_Service(); + + HeaderHandlerResolver handlerResolver = new HeaderHandlerResolver(headers); + service.setHandlerResolver(handlerResolver); + + ec.gob.registrocivil.consultacedula.WSRegistroCivilConsultaCedula port = service.getWSRegistroCivilConsultaCedulaPort(); + System.out.println(" --- >> >"); + // TODO initialize WS operation arguments here + java.lang.String cedula = "1001114840"; + java.lang.String usuario = "testroot"; + java.lang.String contrasenia = "Sti1DigS21"; + // TODO process result here + ec.gob.registrocivil.consultacedula.Cedula result = port.busquedaPorCedula(cedula, usuario, contrasenia); + System.out.println("Result = " + result.getNombre()); + + + } catch (Exception ex) { + // TODO handle custom exceptions here + System.out.println(" --> "+ex.getMessage()); + ex.printStackTrace(); + } + + + + } + +} + + diff --git a/centralwebservices/src/main/java/com/fp/webservices/snap/util/.svn/entries b/centralwebservices/src/main/java/com/fp/webservices/snap/util/.svn/entries new file mode 100644 index 0000000..6c6153b --- /dev/null +++ b/centralwebservices/src/main/java/com/fp/webservices/snap/util/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/java/com/fp/webservices/snap/util +svn://172.17.26.185/COMACO + + + +2014-12-11T05:00:43.966009Z +3415 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/centralwebservices/src/main/java/ec/.svn/entries b/centralwebservices/src/main/java/ec/.svn/entries new file mode 100644 index 0000000..a1119a9 --- /dev/null +++ b/centralwebservices/src/main/java/ec/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/java/ec +svn://172.17.26.185/COMACO + + + +2015-04-30T06:52:59.895028Z +4064 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +gob +dir + +gov +dir + diff --git a/centralwebservices/src/main/java/ec/gob/.svn/entries b/centralwebservices/src/main/java/ec/gob/.svn/entries new file mode 100644 index 0000000..bf150ad --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/java/ec/gob +svn://172.17.26.185/COMACO + + + +2015-04-30T06:52:59.895028Z +4064 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +registrocivil +dir + +bsg +dir + diff --git a/centralwebservices/src/main/java/ec/gob/bsg/.svn/entries b/centralwebservices/src/main/java/ec/gob/bsg/.svn/entries new file mode 100644 index 0000000..f04962b --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/java/ec/gob/bsg +svn://172.17.26.185/COMACO + + + +2015-01-23T05:45:44.873421Z +3793 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +accesobsgservice +dir + diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/entries b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/entries new file mode 100644 index 0000000..cfa09ba --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/entries @@ -0,0 +1,334 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice +svn://172.17.26.185/COMACO + + + +2015-01-23T05:45:44.873421Z +3793 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ValidarPermisoResponse.java +file + + + + +2022-07-28T03:40:47.118822Z +85e6c431179f5987eedb5af6c6551cea +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1575 + +ValidarPermiso.java +file + + + + +2022-07-28T03:40:47.119822Z +f0adb455367f392b01dd765b97401ab7 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1693 + +BSG04AccederBSG.java +file + + + + +2022-07-28T03:40:47.119822Z +4812d0259848e8b0d09202149812e7dc +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1320 + +package-info.java +file + + + + +2022-07-28T03:40:47.119822Z +1527167f7d202a4960cb07cf67d3cffe +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +124 + +AccesoBSGService.java +file + + + + +2022-07-28T03:40:47.120822Z +dcc2701bfdc992bdfad492897898b9a1 +2015-01-23T05:45:44.873421Z +3793 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +3151 + +MensajeError.java +file + + + + +2022-07-28T03:40:47.120822Z +3f1d8bc4ed66261b9a423972b1a5d531 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +2099 + +ValidarPermisoPeticion.java +file + + + + +2022-07-28T03:40:47.121822Z +a304a6b5df9d284888a4749be0353303 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +2089 + +ValidarPermisoRespuesta.java +file + + + + +2022-07-28T03:40:47.121822Z +8f7bd4e1d3c12d85d22d18943be5eb85 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +4719 + +ObjectFactory.java +file + + + + +2022-07-28T03:40:47.121822Z +81a0222aa90c37a22f5f1427cc3de8d8 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +3115 + diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/AccesoBSGService.java.svn-base b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/AccesoBSGService.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/AccesoBSGService.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/BSG04AccederBSG.java.svn-base b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/BSG04AccederBSG.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/BSG04AccederBSG.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/MensajeError.java.svn-base b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/MensajeError.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/MensajeError.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/ObjectFactory.java.svn-base b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/ObjectFactory.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/ObjectFactory.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/ValidarPermiso.java.svn-base b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/ValidarPermiso.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/ValidarPermiso.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/ValidarPermisoPeticion.java.svn-base b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/ValidarPermisoPeticion.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/ValidarPermisoPeticion.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/ValidarPermisoResponse.java.svn-base b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/ValidarPermisoResponse.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/ValidarPermisoResponse.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/ValidarPermisoRespuesta.java.svn-base b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/ValidarPermisoRespuesta.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/ValidarPermisoRespuesta.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/package-info.java.svn-base b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/package-info.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/prop-base/package-info.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/AccesoBSGService.java.svn-base b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/AccesoBSGService.java.svn-base new file mode 100644 index 0000000..105fcdd --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/AccesoBSGService.java.svn-base @@ -0,0 +1,96 @@ + +package ec.gob.bsg.accesobsgservice; + +import java.net.MalformedURLException; +import java.net.URL; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceException; +import javax.xml.ws.WebServiceFeature; + +import com.fp.webservices.snap.recursos.MsgSnap; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.6b21 + * Generated source version: 2.2 + * + */ +@WebServiceClient(name = "AccesoBSGService", targetNamespace = "http://bsg.gob.ec/AccesoBSGService", wsdlLocation = "https://bsg.gob.ec/sw/STI/BSGSW08_Acceder_BSG?wsdl") +public class AccesoBSGService + extends Service +{ + + private final static URL ACCESOBSGSERVICE_WSDL_LOCATION; + private final static WebServiceException ACCESOBSGSERVICE_EXCEPTION; + private final static QName ACCESOBSGSERVICE_QNAME = new QName("http://bsg.gob.ec/AccesoBSGService", "AccesoBSGService"); + + static { + URL url = null; + WebServiceException e = null; + try { + url = new URL(MsgSnap.getString("url_permiso_client")); + } catch (MalformedURLException ex) { + e = new WebServiceException(ex); + } + ACCESOBSGSERVICE_WSDL_LOCATION = url; + ACCESOBSGSERVICE_EXCEPTION = e; + } + + public AccesoBSGService() { + super(__getWsdlLocation(), ACCESOBSGSERVICE_QNAME); + } + + public AccesoBSGService(WebServiceFeature... features) { + super(__getWsdlLocation(), ACCESOBSGSERVICE_QNAME, features); + } + + public AccesoBSGService(URL wsdlLocation) { + super(wsdlLocation, ACCESOBSGSERVICE_QNAME); + } + + public AccesoBSGService(URL wsdlLocation, WebServiceFeature... features) { + super(wsdlLocation, ACCESOBSGSERVICE_QNAME, features); + } + + public AccesoBSGService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public AccesoBSGService(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * + * @return + * returns BSG04AccederBSG + */ + @WebEndpoint(name = "BSG04_Acceder_BSGPort") + public BSG04AccederBSG getBSG04AccederBSGPort() { + return super.getPort(new QName("http://bsg.gob.ec/AccesoBSGService", "BSG04_Acceder_BSGPort"), BSG04AccederBSG.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns BSG04AccederBSG + */ + @WebEndpoint(name = "BSG04_Acceder_BSGPort") + public BSG04AccederBSG getBSG04AccederBSGPort(WebServiceFeature... features) { + return super.getPort(new QName("http://bsg.gob.ec/AccesoBSGService", "BSG04_Acceder_BSGPort"), BSG04AccederBSG.class, features); + } + + private static URL __getWsdlLocation() { + if (ACCESOBSGSERVICE_EXCEPTION!= null) { + throw ACCESOBSGSERVICE_EXCEPTION; + } + return ACCESOBSGSERVICE_WSDL_LOCATION; + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/BSG04AccederBSG.java.svn-base b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/BSG04AccederBSG.java.svn-base new file mode 100644 index 0000000..d9fa70e --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/BSG04AccederBSG.java.svn-base @@ -0,0 +1,40 @@ + +package ec.gob.bsg.accesobsgservice; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.6b21 + * Generated source version: 2.2 + * + */ +@WebService(name = "BSG04_Acceder_BSG", targetNamespace = "http://bsg.gob.ec/AccesoBSGService") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface BSG04AccederBSG { + + + /** + * + * @param validarPermisoPeticion + * @return + * returns ec.gob.bsg.accesobsgservice.ValidarPermisoRespuesta + */ + @WebMethod(operationName = "ValidarPermiso") + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "ValidarPermiso", targetNamespace = "http://bsg.gob.ec/AccesoBSGService", className = "ec.gob.bsg.accesobsgservice.ValidarPermiso") + @ResponseWrapper(localName = "ValidarPermisoResponse", targetNamespace = "http://bsg.gob.ec/AccesoBSGService", className = "ec.gob.bsg.accesobsgservice.ValidarPermisoResponse") + public ValidarPermisoRespuesta validarPermiso( + @WebParam(name = "ValidarPermisoPeticion", targetNamespace = "") + ValidarPermisoPeticion validarPermisoPeticion); + +} diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/MensajeError.java.svn-base b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/MensajeError.java.svn-base new file mode 100644 index 0000000..000e3c4 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/MensajeError.java.svn-base @@ -0,0 +1,90 @@ + +package ec.gob.bsg.accesobsgservice; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para mensajeError complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="mensajeError">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="CodError" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="DesError" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "mensajeError", propOrder = { + "codError", + "desError" +}) +public class MensajeError { + + @XmlElement(name = "CodError") + protected String codError; + @XmlElement(name = "DesError") + protected String desError; + + /** + * Obtiene el valor de la propiedad codError. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodError() { + return codError; + } + + /** + * Define el valor de la propiedad codError. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodError(String value) { + this.codError = value; + } + + /** + * Obtiene el valor de la propiedad desError. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDesError() { + return desError; + } + + /** + * Define el valor de la propiedad desError. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDesError(String value) { + this.desError = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/ObjectFactory.java.svn-base b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/ObjectFactory.java.svn-base new file mode 100644 index 0000000..863e307 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/ObjectFactory.java.svn-base @@ -0,0 +1,95 @@ + +package ec.gob.bsg.accesobsgservice; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the ec.gob.bsg.accesobsgservice package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _ValidarPermisoResponse_QNAME = new QName("http://bsg.gob.ec/AccesoBSGService", "ValidarPermisoResponse"); + private final static QName _ValidarPermiso_QNAME = new QName("http://bsg.gob.ec/AccesoBSGService", "ValidarPermiso"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: ec.gob.bsg.accesobsgservice + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link ValidarPermiso } + * + */ + public ValidarPermiso createValidarPermiso() { + return new ValidarPermiso(); + } + + /** + * Create an instance of {@link ValidarPermisoResponse } + * + */ + public ValidarPermisoResponse createValidarPermisoResponse() { + return new ValidarPermisoResponse(); + } + + /** + * Create an instance of {@link ValidarPermisoPeticion } + * + */ + public ValidarPermisoPeticion createValidarPermisoPeticion() { + return new ValidarPermisoPeticion(); + } + + /** + * Create an instance of {@link ValidarPermisoRespuesta } + * + */ + public ValidarPermisoRespuesta createValidarPermisoRespuesta() { + return new ValidarPermisoRespuesta(); + } + + /** + * Create an instance of {@link MensajeError } + * + */ + public MensajeError createMensajeError() { + return new MensajeError(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ValidarPermisoResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://bsg.gob.ec/AccesoBSGService", name = "ValidarPermisoResponse") + public JAXBElement createValidarPermisoResponse(ValidarPermisoResponse value) { + return new JAXBElement(_ValidarPermisoResponse_QNAME, ValidarPermisoResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ValidarPermiso }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://bsg.gob.ec/AccesoBSGService", name = "ValidarPermiso") + public JAXBElement createValidarPermiso(ValidarPermiso value) { + return new JAXBElement(_ValidarPermiso_QNAME, ValidarPermiso.class, null, value); + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/ValidarPermiso.java.svn-base b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/ValidarPermiso.java.svn-base new file mode 100644 index 0000000..a997527 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/ValidarPermiso.java.svn-base @@ -0,0 +1,62 @@ + +package ec.gob.bsg.accesobsgservice; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para ValidarPermiso complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="ValidarPermiso">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="ValidarPermisoPeticion" type="{http://bsg.gob.ec/AccesoBSGService}validarPermisoPeticion" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ValidarPermiso", propOrder = { + "validarPermisoPeticion" +}) +public class ValidarPermiso { + + @XmlElement(name = "ValidarPermisoPeticion") + protected ValidarPermisoPeticion validarPermisoPeticion; + + /** + * Obtiene el valor de la propiedad validarPermisoPeticion. + * + * @return + * possible object is + * {@link ValidarPermisoPeticion } + * + */ + public ValidarPermisoPeticion getValidarPermisoPeticion() { + return validarPermisoPeticion; + } + + /** + * Define el valor de la propiedad validarPermisoPeticion. + * + * @param value + * allowed object is + * {@link ValidarPermisoPeticion } + * + */ + public void setValidarPermisoPeticion(ValidarPermisoPeticion value) { + this.validarPermisoPeticion = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/ValidarPermisoPeticion.java.svn-base b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/ValidarPermisoPeticion.java.svn-base new file mode 100644 index 0000000..099fd51 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/ValidarPermisoPeticion.java.svn-base @@ -0,0 +1,90 @@ + +package ec.gob.bsg.accesobsgservice; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para validarPermisoPeticion complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="validarPermisoPeticion">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="Cedula" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Urlsw" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "validarPermisoPeticion", propOrder = { + "cedula", + "urlsw" +}) +public class ValidarPermisoPeticion { + + @XmlElement(name = "Cedula") + protected String cedula; + @XmlElement(name = "Urlsw") + protected String urlsw; + + /** + * Obtiene el valor de la propiedad cedula. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCedula() { + return cedula; + } + + /** + * Define el valor de la propiedad cedula. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCedula(String value) { + this.cedula = value; + } + + /** + * Obtiene el valor de la propiedad urlsw. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUrlsw() { + return urlsw; + } + + /** + * Define el valor de la propiedad urlsw. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUrlsw(String value) { + this.urlsw = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/ValidarPermisoResponse.java.svn-base b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/ValidarPermisoResponse.java.svn-base new file mode 100644 index 0000000..f9310a0 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/ValidarPermisoResponse.java.svn-base @@ -0,0 +1,62 @@ + +package ec.gob.bsg.accesobsgservice; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para ValidarPermisoResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="ValidarPermisoResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://bsg.gob.ec/AccesoBSGService}validarPermisoRespuesta" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ValidarPermisoResponse", propOrder = { + "_return" +}) +public class ValidarPermisoResponse { + + @XmlElement(name = "return") + protected ValidarPermisoRespuesta _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link ValidarPermisoRespuesta } + * + */ + public ValidarPermisoRespuesta getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link ValidarPermisoRespuesta } + * + */ + public void setReturn(ValidarPermisoRespuesta value) { + this._return = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/ValidarPermisoRespuesta.java.svn-base b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/ValidarPermisoRespuesta.java.svn-base new file mode 100644 index 0000000..1c1cd03 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/ValidarPermisoRespuesta.java.svn-base @@ -0,0 +1,202 @@ + +package ec.gob.bsg.accesobsgservice; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para validarPermisoRespuesta complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="validarPermisoRespuesta">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="Digest" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Fecha" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="FechaF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Mensaje" type="{http://bsg.gob.ec/AccesoBSGService}mensajeError" minOccurs="0"/>
+ *         <element name="Nonce" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="TienePermiso" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "validarPermisoRespuesta", propOrder = { + "digest", + "fecha", + "fechaF", + "mensaje", + "nonce", + "tienePermiso" +}) +public class ValidarPermisoRespuesta { + + @XmlElement(name = "Digest") + protected String digest; + @XmlElement(name = "Fecha") + protected String fecha; + @XmlElement(name = "FechaF") + protected String fechaF; + @XmlElement(name = "Mensaje") + protected MensajeError mensaje; + @XmlElement(name = "Nonce") + protected String nonce; + @XmlElement(name = "TienePermiso") + protected String tienePermiso; + + /** + * Obtiene el valor de la propiedad digest. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDigest() { + return digest; + } + + /** + * Define el valor de la propiedad digest. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDigest(String value) { + this.digest = value; + } + + /** + * Obtiene el valor de la propiedad fecha. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFecha() { + return fecha; + } + + /** + * Define el valor de la propiedad fecha. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFecha(String value) { + this.fecha = value; + } + + /** + * Obtiene el valor de la propiedad fechaF. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaF() { + return fechaF; + } + + /** + * Define el valor de la propiedad fechaF. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaF(String value) { + this.fechaF = value; + } + + /** + * Obtiene el valor de la propiedad mensaje. + * + * @return + * possible object is + * {@link MensajeError } + * + */ + public MensajeError getMensaje() { + return mensaje; + } + + /** + * Define el valor de la propiedad mensaje. + * + * @param value + * allowed object is + * {@link MensajeError } + * + */ + public void setMensaje(MensajeError value) { + this.mensaje = value; + } + + /** + * Obtiene el valor de la propiedad nonce. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNonce() { + return nonce; + } + + /** + * Define el valor de la propiedad nonce. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNonce(String value) { + this.nonce = value; + } + + /** + * Obtiene el valor de la propiedad tienePermiso. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTienePermiso() { + return tienePermiso; + } + + /** + * Define el valor de la propiedad tienePermiso. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTienePermiso(String value) { + this.tienePermiso = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/package-info.java.svn-base b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..ae11272 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://bsg.gob.ec/AccesoBSGService") +package ec.gob.bsg.accesobsgservice; diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/AccesoBSGService.java b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/AccesoBSGService.java new file mode 100644 index 0000000..105fcdd --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/AccesoBSGService.java @@ -0,0 +1,96 @@ + +package ec.gob.bsg.accesobsgservice; + +import java.net.MalformedURLException; +import java.net.URL; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceException; +import javax.xml.ws.WebServiceFeature; + +import com.fp.webservices.snap.recursos.MsgSnap; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.6b21 + * Generated source version: 2.2 + * + */ +@WebServiceClient(name = "AccesoBSGService", targetNamespace = "http://bsg.gob.ec/AccesoBSGService", wsdlLocation = "https://bsg.gob.ec/sw/STI/BSGSW08_Acceder_BSG?wsdl") +public class AccesoBSGService + extends Service +{ + + private final static URL ACCESOBSGSERVICE_WSDL_LOCATION; + private final static WebServiceException ACCESOBSGSERVICE_EXCEPTION; + private final static QName ACCESOBSGSERVICE_QNAME = new QName("http://bsg.gob.ec/AccesoBSGService", "AccesoBSGService"); + + static { + URL url = null; + WebServiceException e = null; + try { + url = new URL(MsgSnap.getString("url_permiso_client")); + } catch (MalformedURLException ex) { + e = new WebServiceException(ex); + } + ACCESOBSGSERVICE_WSDL_LOCATION = url; + ACCESOBSGSERVICE_EXCEPTION = e; + } + + public AccesoBSGService() { + super(__getWsdlLocation(), ACCESOBSGSERVICE_QNAME); + } + + public AccesoBSGService(WebServiceFeature... features) { + super(__getWsdlLocation(), ACCESOBSGSERVICE_QNAME, features); + } + + public AccesoBSGService(URL wsdlLocation) { + super(wsdlLocation, ACCESOBSGSERVICE_QNAME); + } + + public AccesoBSGService(URL wsdlLocation, WebServiceFeature... features) { + super(wsdlLocation, ACCESOBSGSERVICE_QNAME, features); + } + + public AccesoBSGService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public AccesoBSGService(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * + * @return + * returns BSG04AccederBSG + */ + @WebEndpoint(name = "BSG04_Acceder_BSGPort") + public BSG04AccederBSG getBSG04AccederBSGPort() { + return super.getPort(new QName("http://bsg.gob.ec/AccesoBSGService", "BSG04_Acceder_BSGPort"), BSG04AccederBSG.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns BSG04AccederBSG + */ + @WebEndpoint(name = "BSG04_Acceder_BSGPort") + public BSG04AccederBSG getBSG04AccederBSGPort(WebServiceFeature... features) { + return super.getPort(new QName("http://bsg.gob.ec/AccesoBSGService", "BSG04_Acceder_BSGPort"), BSG04AccederBSG.class, features); + } + + private static URL __getWsdlLocation() { + if (ACCESOBSGSERVICE_EXCEPTION!= null) { + throw ACCESOBSGSERVICE_EXCEPTION; + } + return ACCESOBSGSERVICE_WSDL_LOCATION; + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/BSG04AccederBSG.java b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/BSG04AccederBSG.java new file mode 100644 index 0000000..d9fa70e --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/BSG04AccederBSG.java @@ -0,0 +1,40 @@ + +package ec.gob.bsg.accesobsgservice; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.6b21 + * Generated source version: 2.2 + * + */ +@WebService(name = "BSG04_Acceder_BSG", targetNamespace = "http://bsg.gob.ec/AccesoBSGService") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface BSG04AccederBSG { + + + /** + * + * @param validarPermisoPeticion + * @return + * returns ec.gob.bsg.accesobsgservice.ValidarPermisoRespuesta + */ + @WebMethod(operationName = "ValidarPermiso") + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "ValidarPermiso", targetNamespace = "http://bsg.gob.ec/AccesoBSGService", className = "ec.gob.bsg.accesobsgservice.ValidarPermiso") + @ResponseWrapper(localName = "ValidarPermisoResponse", targetNamespace = "http://bsg.gob.ec/AccesoBSGService", className = "ec.gob.bsg.accesobsgservice.ValidarPermisoResponse") + public ValidarPermisoRespuesta validarPermiso( + @WebParam(name = "ValidarPermisoPeticion", targetNamespace = "") + ValidarPermisoPeticion validarPermisoPeticion); + +} diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/MensajeError.java b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/MensajeError.java new file mode 100644 index 0000000..000e3c4 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/MensajeError.java @@ -0,0 +1,90 @@ + +package ec.gob.bsg.accesobsgservice; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para mensajeError complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="mensajeError">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="CodError" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="DesError" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "mensajeError", propOrder = { + "codError", + "desError" +}) +public class MensajeError { + + @XmlElement(name = "CodError") + protected String codError; + @XmlElement(name = "DesError") + protected String desError; + + /** + * Obtiene el valor de la propiedad codError. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodError() { + return codError; + } + + /** + * Define el valor de la propiedad codError. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodError(String value) { + this.codError = value; + } + + /** + * Obtiene el valor de la propiedad desError. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDesError() { + return desError; + } + + /** + * Define el valor de la propiedad desError. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDesError(String value) { + this.desError = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/ObjectFactory.java b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/ObjectFactory.java new file mode 100644 index 0000000..863e307 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/ObjectFactory.java @@ -0,0 +1,95 @@ + +package ec.gob.bsg.accesobsgservice; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the ec.gob.bsg.accesobsgservice package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _ValidarPermisoResponse_QNAME = new QName("http://bsg.gob.ec/AccesoBSGService", "ValidarPermisoResponse"); + private final static QName _ValidarPermiso_QNAME = new QName("http://bsg.gob.ec/AccesoBSGService", "ValidarPermiso"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: ec.gob.bsg.accesobsgservice + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link ValidarPermiso } + * + */ + public ValidarPermiso createValidarPermiso() { + return new ValidarPermiso(); + } + + /** + * Create an instance of {@link ValidarPermisoResponse } + * + */ + public ValidarPermisoResponse createValidarPermisoResponse() { + return new ValidarPermisoResponse(); + } + + /** + * Create an instance of {@link ValidarPermisoPeticion } + * + */ + public ValidarPermisoPeticion createValidarPermisoPeticion() { + return new ValidarPermisoPeticion(); + } + + /** + * Create an instance of {@link ValidarPermisoRespuesta } + * + */ + public ValidarPermisoRespuesta createValidarPermisoRespuesta() { + return new ValidarPermisoRespuesta(); + } + + /** + * Create an instance of {@link MensajeError } + * + */ + public MensajeError createMensajeError() { + return new MensajeError(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ValidarPermisoResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://bsg.gob.ec/AccesoBSGService", name = "ValidarPermisoResponse") + public JAXBElement createValidarPermisoResponse(ValidarPermisoResponse value) { + return new JAXBElement(_ValidarPermisoResponse_QNAME, ValidarPermisoResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ValidarPermiso }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://bsg.gob.ec/AccesoBSGService", name = "ValidarPermiso") + public JAXBElement createValidarPermiso(ValidarPermiso value) { + return new JAXBElement(_ValidarPermiso_QNAME, ValidarPermiso.class, null, value); + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/ValidarPermiso.java b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/ValidarPermiso.java new file mode 100644 index 0000000..a997527 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/ValidarPermiso.java @@ -0,0 +1,62 @@ + +package ec.gob.bsg.accesobsgservice; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para ValidarPermiso complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="ValidarPermiso">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="ValidarPermisoPeticion" type="{http://bsg.gob.ec/AccesoBSGService}validarPermisoPeticion" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ValidarPermiso", propOrder = { + "validarPermisoPeticion" +}) +public class ValidarPermiso { + + @XmlElement(name = "ValidarPermisoPeticion") + protected ValidarPermisoPeticion validarPermisoPeticion; + + /** + * Obtiene el valor de la propiedad validarPermisoPeticion. + * + * @return + * possible object is + * {@link ValidarPermisoPeticion } + * + */ + public ValidarPermisoPeticion getValidarPermisoPeticion() { + return validarPermisoPeticion; + } + + /** + * Define el valor de la propiedad validarPermisoPeticion. + * + * @param value + * allowed object is + * {@link ValidarPermisoPeticion } + * + */ + public void setValidarPermisoPeticion(ValidarPermisoPeticion value) { + this.validarPermisoPeticion = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/ValidarPermisoPeticion.java b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/ValidarPermisoPeticion.java new file mode 100644 index 0000000..099fd51 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/ValidarPermisoPeticion.java @@ -0,0 +1,90 @@ + +package ec.gob.bsg.accesobsgservice; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para validarPermisoPeticion complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="validarPermisoPeticion">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="Cedula" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Urlsw" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "validarPermisoPeticion", propOrder = { + "cedula", + "urlsw" +}) +public class ValidarPermisoPeticion { + + @XmlElement(name = "Cedula") + protected String cedula; + @XmlElement(name = "Urlsw") + protected String urlsw; + + /** + * Obtiene el valor de la propiedad cedula. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCedula() { + return cedula; + } + + /** + * Define el valor de la propiedad cedula. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCedula(String value) { + this.cedula = value; + } + + /** + * Obtiene el valor de la propiedad urlsw. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUrlsw() { + return urlsw; + } + + /** + * Define el valor de la propiedad urlsw. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUrlsw(String value) { + this.urlsw = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/ValidarPermisoResponse.java b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/ValidarPermisoResponse.java new file mode 100644 index 0000000..f9310a0 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/ValidarPermisoResponse.java @@ -0,0 +1,62 @@ + +package ec.gob.bsg.accesobsgservice; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para ValidarPermisoResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="ValidarPermisoResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://bsg.gob.ec/AccesoBSGService}validarPermisoRespuesta" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ValidarPermisoResponse", propOrder = { + "_return" +}) +public class ValidarPermisoResponse { + + @XmlElement(name = "return") + protected ValidarPermisoRespuesta _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link ValidarPermisoRespuesta } + * + */ + public ValidarPermisoRespuesta getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link ValidarPermisoRespuesta } + * + */ + public void setReturn(ValidarPermisoRespuesta value) { + this._return = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/ValidarPermisoRespuesta.java b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/ValidarPermisoRespuesta.java new file mode 100644 index 0000000..1c1cd03 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/ValidarPermisoRespuesta.java @@ -0,0 +1,202 @@ + +package ec.gob.bsg.accesobsgservice; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para validarPermisoRespuesta complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="validarPermisoRespuesta">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="Digest" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Fecha" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="FechaF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Mensaje" type="{http://bsg.gob.ec/AccesoBSGService}mensajeError" minOccurs="0"/>
+ *         <element name="Nonce" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="TienePermiso" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "validarPermisoRespuesta", propOrder = { + "digest", + "fecha", + "fechaF", + "mensaje", + "nonce", + "tienePermiso" +}) +public class ValidarPermisoRespuesta { + + @XmlElement(name = "Digest") + protected String digest; + @XmlElement(name = "Fecha") + protected String fecha; + @XmlElement(name = "FechaF") + protected String fechaF; + @XmlElement(name = "Mensaje") + protected MensajeError mensaje; + @XmlElement(name = "Nonce") + protected String nonce; + @XmlElement(name = "TienePermiso") + protected String tienePermiso; + + /** + * Obtiene el valor de la propiedad digest. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDigest() { + return digest; + } + + /** + * Define el valor de la propiedad digest. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDigest(String value) { + this.digest = value; + } + + /** + * Obtiene el valor de la propiedad fecha. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFecha() { + return fecha; + } + + /** + * Define el valor de la propiedad fecha. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFecha(String value) { + this.fecha = value; + } + + /** + * Obtiene el valor de la propiedad fechaF. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaF() { + return fechaF; + } + + /** + * Define el valor de la propiedad fechaF. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaF(String value) { + this.fechaF = value; + } + + /** + * Obtiene el valor de la propiedad mensaje. + * + * @return + * possible object is + * {@link MensajeError } + * + */ + public MensajeError getMensaje() { + return mensaje; + } + + /** + * Define el valor de la propiedad mensaje. + * + * @param value + * allowed object is + * {@link MensajeError } + * + */ + public void setMensaje(MensajeError value) { + this.mensaje = value; + } + + /** + * Obtiene el valor de la propiedad nonce. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNonce() { + return nonce; + } + + /** + * Define el valor de la propiedad nonce. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNonce(String value) { + this.nonce = value; + } + + /** + * Obtiene el valor de la propiedad tienePermiso. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTienePermiso() { + return tienePermiso; + } + + /** + * Define el valor de la propiedad tienePermiso. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTienePermiso(String value) { + this.tienePermiso = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/package-info.java b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/package-info.java new file mode 100644 index 0000000..ae11272 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/bsg/accesobsgservice/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://bsg.gob.ec/AccesoBSGService") +package ec.gob.bsg.accesobsgservice; diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/.svn/entries b/centralwebservices/src/main/java/ec/gob/registrocivil/.svn/entries new file mode 100644 index 0000000..23f3350 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/java/ec/gob/registrocivil +svn://172.17.26.185/COMACO + + + +2015-04-30T06:52:59.895028Z +4064 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +consultacedula +dir + diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/entries b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/entries new file mode 100644 index 0000000..735dfb3 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/entries @@ -0,0 +1,334 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula +svn://172.17.26.185/COMACO + + + +2015-04-30T06:52:59.895028Z +4064 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +package-info.java +file + + + + +2022-07-28T03:40:47.087822Z +358d0bad413660fe94fc06448a8ba1eb +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +144 + +WSRegistroCivilConsultaCedula.java +file + + + + +2022-07-28T03:40:47.088822Z +1747e707536de9ebd449936cb47d004c +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +2103 + +WSRegistroCivilConsultaCedula_Service.java +file + + + + +2022-07-28T03:40:47.088822Z +04427ec35121ad5606ac00770f9263c0 +2015-01-23T05:45:24.731767Z +3792 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +3701 + +BusquedaPorCedulaResponse.java +file + + + + +2022-07-28T03:40:47.088822Z +b4499e1e87ec716b25877c9ba4b2e00f +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1505 + +BusquedaPorCedula.java +file + + + + +2022-07-28T03:40:47.089822Z +620530878f6a71e6a5375cb2536b858f +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +2779 + +Cedula.java +file + + + + +2022-07-28T03:40:47.089822Z +20389c4f92e05696ef036e6aa10f83e9 +2015-04-30T06:52:59.895028Z +4064 +cpiedra +has-props + + + + + + + + + + + + + + + + + + + + +15197 + +WsUpResponse.java +file + + + + +2022-07-28T03:40:47.090822Z +1a7fc84bf52d081f12776830c7b201ca +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1453 + +ObjectFactory.java +file + + + + +2022-07-28T03:40:47.090822Z +6a643f1bcbddfc963d3495e847faf937 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +4119 + +WsUp.java +file + + + + +2022-07-28T03:40:47.090822Z +f5984861c7f36a1fb5b3ae53e913ce27 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +710 + diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/BusquedaPorCedula.java.svn-base b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/BusquedaPorCedula.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/BusquedaPorCedula.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/BusquedaPorCedulaResponse.java.svn-base b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/BusquedaPorCedulaResponse.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/BusquedaPorCedulaResponse.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/Cedula.java.svn-base b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/Cedula.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/Cedula.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/ObjectFactory.java.svn-base b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/ObjectFactory.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/ObjectFactory.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/WSRegistroCivilConsultaCedula.java.svn-base b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/WSRegistroCivilConsultaCedula.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/WSRegistroCivilConsultaCedula.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/WSRegistroCivilConsultaCedula_Service.java.svn-base b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/WSRegistroCivilConsultaCedula_Service.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/WSRegistroCivilConsultaCedula_Service.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/WsUp.java.svn-base b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/WsUp.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/WsUp.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/WsUpResponse.java.svn-base b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/WsUpResponse.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/WsUpResponse.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/package-info.java.svn-base b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/package-info.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/prop-base/package-info.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/BusquedaPorCedula.java.svn-base b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/BusquedaPorCedula.java.svn-base new file mode 100644 index 0000000..fd3396f --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/BusquedaPorCedula.java.svn-base @@ -0,0 +1,118 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para BusquedaPorCedula complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="BusquedaPorCedula">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="Cedula" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Usuario" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Contrasenia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "BusquedaPorCedula", propOrder = { + "cedula", + "usuario", + "contrasenia" +}) +public class BusquedaPorCedula { + + @XmlElement(name = "Cedula") + protected String cedula; + @XmlElement(name = "Usuario") + protected String usuario; + @XmlElement(name = "Contrasenia") + protected String contrasenia; + + /** + * Obtiene el valor de la propiedad cedula. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCedula() { + return cedula; + } + + /** + * Define el valor de la propiedad cedula. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCedula(String value) { + this.cedula = value; + } + + /** + * Obtiene el valor de la propiedad usuario. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUsuario() { + return usuario; + } + + /** + * Define el valor de la propiedad usuario. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUsuario(String value) { + this.usuario = value; + } + + /** + * Obtiene el valor de la propiedad contrasenia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getContrasenia() { + return contrasenia; + } + + /** + * Define el valor de la propiedad contrasenia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setContrasenia(String value) { + this.contrasenia = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/BusquedaPorCedulaResponse.java.svn-base b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/BusquedaPorCedulaResponse.java.svn-base new file mode 100644 index 0000000..d621947 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/BusquedaPorCedulaResponse.java.svn-base @@ -0,0 +1,62 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para BusquedaPorCedulaResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="BusquedaPorCedulaResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://www.registrocivil.gob.ec/ConsultaCedula}cedula" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "BusquedaPorCedulaResponse", propOrder = { + "_return" +}) +public class BusquedaPorCedulaResponse { + + @XmlElement(name = "return") + protected Cedula _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link Cedula } + * + */ + public Cedula getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link Cedula } + * + */ + public void setReturn(Cedula value) { + this._return = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/Cedula.java.svn-base b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/Cedula.java.svn-base new file mode 100644 index 0000000..bff475d --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/Cedula.java.svn-base @@ -0,0 +1,622 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para cedula complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="cedula">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="CalleDomicilio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Cedula" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="CodigoError" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="CondicionCedulado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Conyuge" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Domicilio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Error" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="EstadoCivil" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="FechaCedulacion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="FechaNacimiento" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="FirmaElectronica" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Genero" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="IndividualDactilar" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Instruccion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="LugarNacimiento" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Nacionalidad" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="NombreMadre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="NombrePadre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Nombre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="NumeroDomicilio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Profesion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "cedula", propOrder = { + "calleDomicilio", + "cedula", + "codigoError", + "condicionCedulado", + "conyuge", + "domicilio", + "error", + "estadoCivil", + "fechaCedulacion", + "fechaNacimiento", + "firmaElectronica", + "genero", + "individualDactilar", + "instruccion", + "lugarNacimiento", + "nacionalidad", + "nombreMadre", + "nombrePadre", + "nombre", + "numeroDomicilio", + "profesion" +}) +public class Cedula { + + @XmlElement(name = "CalleDomicilio") + protected String calleDomicilio; + @XmlElement(name = "Cedula") + protected String cedula; + @XmlElement(name = "CodigoError") + protected String codigoError; + @XmlElement(name = "CondicionCedulado") + protected String condicionCedulado; + @XmlElement(name = "Conyuge") + protected String conyuge; + @XmlElement(name = "Domicilio") + protected String domicilio; + @XmlElement(name = "Error") + protected String error; + @XmlElement(name = "EstadoCivil") + protected String estadoCivil; + @XmlElement(name = "FechaCedulacion") + protected String fechaCedulacion; + @XmlElement(name = "FechaNacimiento") + protected String fechaNacimiento; + @XmlElement(name = "FirmaElectronica") + protected String firmaElectronica; + @XmlElement(name = "Genero") + protected String genero; + @XmlElement(name = "IndividualDactilar") + protected String individualDactilar; + @XmlElement(name = "Instruccion") + protected String instruccion; + @XmlElement(name = "LugarNacimiento") + protected String lugarNacimiento; + @XmlElement(name = "Nacionalidad") + protected String nacionalidad; + @XmlElement(name = "NombreMadre") + protected String nombreMadre; + @XmlElement(name = "NombrePadre") + protected String nombrePadre; + @XmlElement(name = "Nombre") + protected String nombre; + @XmlElement(name = "NumeroDomicilio") + protected String numeroDomicilio; + @XmlElement(name = "Profesion") + protected String profesion; + + /** + * Obtiene el valor de la propiedad calleDomicilio. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCalleDomicilio() { + return calleDomicilio; + } + + /** + * Define el valor de la propiedad calleDomicilio. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCalleDomicilio(String value) { + this.calleDomicilio = value; + } + + /** + * Obtiene el valor de la propiedad cedula. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCedula() { + return cedula; + } + + /** + * Define el valor de la propiedad cedula. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCedula(String value) { + this.cedula = value; + } + + /** + * Obtiene el valor de la propiedad codigoError. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodigoError() { + return codigoError; + } + + /** + * Define el valor de la propiedad codigoError. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodigoError(String value) { + this.codigoError = value; + } + + /** + * Obtiene el valor de la propiedad condicionCedulado. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCondicionCedulado() { + return condicionCedulado; + } + + /** + * Define el valor de la propiedad condicionCedulado. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCondicionCedulado(String value) { + this.condicionCedulado = value; + } + + /** + * Obtiene el valor de la propiedad conyuge. + * + * @return + * possible object is + * {@link String } + * + */ + public String getConyuge() { + return conyuge; + } + + /** + * Define el valor de la propiedad conyuge. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setConyuge(String value) { + this.conyuge = value; + } + + /** + * Obtiene el valor de la propiedad domicilio. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDomicilio() { + return domicilio; + } + + /** + * Define el valor de la propiedad domicilio. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDomicilio(String value) { + this.domicilio = value; + } + + /** + * Obtiene el valor de la propiedad error. + * + * @return + * possible object is + * {@link String } + * + */ + public String getError() { + return error; + } + + /** + * Define el valor de la propiedad error. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setError(String value) { + this.error = value; + } + + /** + * Obtiene el valor de la propiedad estadoCivil. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEstadoCivil() { + return estadoCivil; + } + + /** + * Define el valor de la propiedad estadoCivil. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEstadoCivil(String value) { + this.estadoCivil = value; + } + + /** + * Obtiene el valor de la propiedad fechaCedulacion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaCedulacion() { + return fechaCedulacion; + } + + /** + * Define el valor de la propiedad fechaCedulacion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaCedulacion(String value) { + this.fechaCedulacion = value; + } + + /** + * Obtiene el valor de la propiedad fechaNacimiento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaNacimiento() { + return fechaNacimiento; + } + + /** + * Define el valor de la propiedad fechaNacimiento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaNacimiento(String value) { + this.fechaNacimiento = value; + } + + /** + * Obtiene el valor de la propiedad firmaElectronica. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFirmaElectronica() { + return firmaElectronica; + } + + /** + * Define el valor de la propiedad firmaElectronica. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFirmaElectronica(String value) { + this.firmaElectronica = value; + } + + /** + * Obtiene el valor de la propiedad genero. + * + * @return + * possible object is + * {@link String } + * + */ + public String getGenero() { + return genero; + } + + /** + * Define el valor de la propiedad genero. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setGenero(String value) { + this.genero = value; + } + + /** + * Obtiene el valor de la propiedad individualDactilar. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIndividualDactilar() { + return individualDactilar; + } + + /** + * Define el valor de la propiedad individualDactilar. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIndividualDactilar(String individualDactilar) { + this.individualDactilar = individualDactilar; + } + + /** + * Obtiene el valor de la propiedad instruccion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getInstruccion() { + return instruccion; + } + + /** + * Define el valor de la propiedad instruccion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setInstruccion(String value) { + this.instruccion = value; + } + + /** + * Obtiene el valor de la propiedad lugarNacimiento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLugarNacimiento() { + return lugarNacimiento; + } + + /** + * Define el valor de la propiedad lugarNacimiento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLugarNacimiento(String value) { + this.lugarNacimiento = value; + } + + /** + * Obtiene el valor de la propiedad nacionalidad. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNacionalidad() { + return nacionalidad; + } + + /** + * Define el valor de la propiedad nacionalidad. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNacionalidad(String value) { + this.nacionalidad = value; + } + + /** + * Obtiene el valor de la propiedad nombreMadre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombreMadre() { + return nombreMadre; + } + + /** + * Define el valor de la propiedad nombreMadre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombreMadre(String value) { + this.nombreMadre = value; + } + + /** + * Obtiene el valor de la propiedad nombrePadre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombrePadre() { + return nombrePadre; + } + + /** + * Define el valor de la propiedad nombrePadre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombrePadre(String value) { + this.nombrePadre = value; + } + + /** + * Obtiene el valor de la propiedad nombre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombre() { + return nombre; + } + + /** + * Define el valor de la propiedad nombre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombre(String value) { + this.nombre = value; + } + + /** + * Obtiene el valor de la propiedad numeroDomicilio. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroDomicilio() { + return numeroDomicilio; + } + + /** + * Define el valor de la propiedad numeroDomicilio. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroDomicilio(String value) { + this.numeroDomicilio = value; + } + + /** + * Obtiene el valor de la propiedad profesion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getProfesion() { + return profesion; + } + + /** + * Define el valor de la propiedad profesion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setProfesion(String value) { + this.profesion = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/ObjectFactory.java.svn-base b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/ObjectFactory.java.svn-base new file mode 100644 index 0000000..1399799 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/ObjectFactory.java.svn-base @@ -0,0 +1,115 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the ec.gob.registrocivil.consultacedula package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _BusquedaPorCedula_QNAME = new QName("http://www.registrocivil.gob.ec/ConsultaCedula", "BusquedaPorCedula"); + private final static QName _WsUpResponse_QNAME = new QName("http://www.registrocivil.gob.ec/ConsultaCedula", "WsUpResponse"); + private final static QName _BusquedaPorCedulaResponse_QNAME = new QName("http://www.registrocivil.gob.ec/ConsultaCedula", "BusquedaPorCedulaResponse"); + private final static QName _WsUp_QNAME = new QName("http://www.registrocivil.gob.ec/ConsultaCedula", "WsUp"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: ec.gob.registrocivil.consultacedula + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link BusquedaPorCedula } + * + */ + public BusquedaPorCedula createBusquedaPorCedula() { + return new BusquedaPorCedula(); + } + + /** + * Create an instance of {@link WsUp } + * + */ + public WsUp createWsUp() { + return new WsUp(); + } + + /** + * Create an instance of {@link BusquedaPorCedulaResponse } + * + */ + public BusquedaPorCedulaResponse createBusquedaPorCedulaResponse() { + return new BusquedaPorCedulaResponse(); + } + + /** + * Create an instance of {@link WsUpResponse } + * + */ + public WsUpResponse createWsUpResponse() { + return new WsUpResponse(); + } + + /** + * Create an instance of {@link Cedula } + * + */ + public Cedula createCedula() { + return new Cedula(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link BusquedaPorCedula }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.registrocivil.gob.ec/ConsultaCedula", name = "BusquedaPorCedula") + public JAXBElement createBusquedaPorCedula(BusquedaPorCedula value) { + return new JAXBElement(_BusquedaPorCedula_QNAME, BusquedaPorCedula.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link WsUpResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.registrocivil.gob.ec/ConsultaCedula", name = "WsUpResponse") + public JAXBElement createWsUpResponse(WsUpResponse value) { + return new JAXBElement(_WsUpResponse_QNAME, WsUpResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link BusquedaPorCedulaResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.registrocivil.gob.ec/ConsultaCedula", name = "BusquedaPorCedulaResponse") + public JAXBElement createBusquedaPorCedulaResponse(BusquedaPorCedulaResponse value) { + return new JAXBElement(_BusquedaPorCedulaResponse_QNAME, BusquedaPorCedulaResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link WsUp }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.registrocivil.gob.ec/ConsultaCedula", name = "WsUp") + public JAXBElement createWsUp(WsUp value) { + return new JAXBElement(_WsUp_QNAME, WsUp.class, null, value); + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/WSRegistroCivilConsultaCedula.java.svn-base b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/WSRegistroCivilConsultaCedula.java.svn-base new file mode 100644 index 0000000..2e20d1c --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/WSRegistroCivilConsultaCedula.java.svn-base @@ -0,0 +1,57 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.6b21 + * Generated source version: 2.2 + * + */ +@WebService(name = "WSRegistroCivilConsultaCedula", targetNamespace = "http://www.registrocivil.gob.ec/ConsultaCedula") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface WSRegistroCivilConsultaCedula { + + + /** + * + * @param usuario + * @param contrasenia + * @param cedula + * @return + * returns ec.gob.registrocivil.consultacedula.Cedula + */ + @WebMethod(operationName = "BusquedaPorCedula") + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "BusquedaPorCedula", targetNamespace = "http://www.registrocivil.gob.ec/ConsultaCedula", className = "ec.gob.registrocivil.consultacedula.BusquedaPorCedula") + @ResponseWrapper(localName = "BusquedaPorCedulaResponse", targetNamespace = "http://www.registrocivil.gob.ec/ConsultaCedula", className = "ec.gob.registrocivil.consultacedula.BusquedaPorCedulaResponse") + public Cedula busquedaPorCedula( + @WebParam(name = "Cedula", targetNamespace = "") + String cedula, + @WebParam(name = "Usuario", targetNamespace = "") + String usuario, + @WebParam(name = "Contrasenia", targetNamespace = "") + String contrasenia); + + /** + * + * @return + * returns ec.gob.registrocivil.consultacedula.Cedula + */ + @WebMethod(operationName = "WsUp") + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "WsUp", targetNamespace = "http://www.registrocivil.gob.ec/ConsultaCedula", className = "ec.gob.registrocivil.consultacedula.WsUp") + @ResponseWrapper(localName = "WsUpResponse", targetNamespace = "http://www.registrocivil.gob.ec/ConsultaCedula", className = "ec.gob.registrocivil.consultacedula.WsUpResponse") + public Cedula wsUp(); + +} diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/WSRegistroCivilConsultaCedula_Service.java.svn-base b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/WSRegistroCivilConsultaCedula_Service.java.svn-base new file mode 100644 index 0000000..09b800c --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/WSRegistroCivilConsultaCedula_Service.java.svn-base @@ -0,0 +1,96 @@ + +package ec.gob.registrocivil.consultacedula; + +import java.net.MalformedURLException; +import java.net.URL; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceException; +import javax.xml.ws.WebServiceFeature; + +import com.fp.webservices.snap.recursos.MsgSnap; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.6b21 + * Generated source version: 2.2 + * + */ +@WebServiceClient(name = "WSRegistroCivilConsultaCedula", targetNamespace = "http://www.registrocivil.gob.ec/ConsultaCedula", wsdlLocation = "https://bsg.gob.ec/sw/RC/BSGSW01_Consultar_Cedula?wsdl") +public class WSRegistroCivilConsultaCedula_Service + extends Service +{ + + private final static URL WSREGISTROCIVILCONSULTACEDULA_WSDL_LOCATION; + private final static WebServiceException WSREGISTROCIVILCONSULTACEDULA_EXCEPTION; + private final static QName WSREGISTROCIVILCONSULTACEDULA_QNAME = new QName("http://www.registrocivil.gob.ec/ConsultaCedula", "WSRegistroCivilConsultaCedula"); + + static { + URL url = null; + WebServiceException e = null; + try { + url = new URL(MsgSnap.getString("url_consulta_cedula")); + } catch (MalformedURLException ex) { + e = new WebServiceException(ex); + } + WSREGISTROCIVILCONSULTACEDULA_WSDL_LOCATION = url; + WSREGISTROCIVILCONSULTACEDULA_EXCEPTION = e; + } + + public WSRegistroCivilConsultaCedula_Service() { + super(__getWsdlLocation(), WSREGISTROCIVILCONSULTACEDULA_QNAME); + } + + public WSRegistroCivilConsultaCedula_Service(WebServiceFeature... features) { + super(__getWsdlLocation(), WSREGISTROCIVILCONSULTACEDULA_QNAME, features); + } + + public WSRegistroCivilConsultaCedula_Service(URL wsdlLocation) { + super(wsdlLocation, WSREGISTROCIVILCONSULTACEDULA_QNAME); + } + + public WSRegistroCivilConsultaCedula_Service(URL wsdlLocation, WebServiceFeature... features) { + super(wsdlLocation, WSREGISTROCIVILCONSULTACEDULA_QNAME, features); + } + + public WSRegistroCivilConsultaCedula_Service(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public WSRegistroCivilConsultaCedula_Service(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * + * @return + * returns WSRegistroCivilConsultaCedula + */ + @WebEndpoint(name = "WSRegistroCivilConsultaCedulaPort") + public WSRegistroCivilConsultaCedula getWSRegistroCivilConsultaCedulaPort() { + return super.getPort(new QName("http://www.registrocivil.gob.ec/ConsultaCedula", "WSRegistroCivilConsultaCedulaPort"), WSRegistroCivilConsultaCedula.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns WSRegistroCivilConsultaCedula + */ + @WebEndpoint(name = "WSRegistroCivilConsultaCedulaPort") + public WSRegistroCivilConsultaCedula getWSRegistroCivilConsultaCedulaPort(WebServiceFeature... features) { + return super.getPort(new QName("http://www.registrocivil.gob.ec/ConsultaCedula", "WSRegistroCivilConsultaCedulaPort"), WSRegistroCivilConsultaCedula.class, features); + } + + private static URL __getWsdlLocation() { + if (WSREGISTROCIVILCONSULTACEDULA_EXCEPTION!= null) { + throw WSREGISTROCIVILCONSULTACEDULA_EXCEPTION; + } + return WSREGISTROCIVILCONSULTACEDULA_WSDL_LOCATION; + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/WsUp.java.svn-base b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/WsUp.java.svn-base new file mode 100644 index 0000000..2809604 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/WsUp.java.svn-base @@ -0,0 +1,32 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para WsUp complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="WsUp">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "WsUp") +public class WsUp { + + +} diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/WsUpResponse.java.svn-base b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/WsUpResponse.java.svn-base new file mode 100644 index 0000000..e09995e --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/WsUpResponse.java.svn-base @@ -0,0 +1,62 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para WsUpResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="WsUpResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://www.registrocivil.gob.ec/ConsultaCedula}cedula" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "WsUpResponse", propOrder = { + "_return" +}) +public class WsUpResponse { + + @XmlElement(name = "return") + protected Cedula _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link Cedula } + * + */ + public Cedula getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link Cedula } + * + */ + public void setReturn(Cedula value) { + this._return = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/package-info.java.svn-base b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..e344919 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.registrocivil.gob.ec/ConsultaCedula") +package ec.gob.registrocivil.consultacedula; diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/BusquedaPorCedula.java b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/BusquedaPorCedula.java new file mode 100644 index 0000000..fd3396f --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/BusquedaPorCedula.java @@ -0,0 +1,118 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para BusquedaPorCedula complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="BusquedaPorCedula">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="Cedula" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Usuario" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Contrasenia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "BusquedaPorCedula", propOrder = { + "cedula", + "usuario", + "contrasenia" +}) +public class BusquedaPorCedula { + + @XmlElement(name = "Cedula") + protected String cedula; + @XmlElement(name = "Usuario") + protected String usuario; + @XmlElement(name = "Contrasenia") + protected String contrasenia; + + /** + * Obtiene el valor de la propiedad cedula. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCedula() { + return cedula; + } + + /** + * Define el valor de la propiedad cedula. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCedula(String value) { + this.cedula = value; + } + + /** + * Obtiene el valor de la propiedad usuario. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUsuario() { + return usuario; + } + + /** + * Define el valor de la propiedad usuario. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUsuario(String value) { + this.usuario = value; + } + + /** + * Obtiene el valor de la propiedad contrasenia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getContrasenia() { + return contrasenia; + } + + /** + * Define el valor de la propiedad contrasenia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setContrasenia(String value) { + this.contrasenia = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/BusquedaPorCedulaResponse.java b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/BusquedaPorCedulaResponse.java new file mode 100644 index 0000000..d621947 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/BusquedaPorCedulaResponse.java @@ -0,0 +1,62 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para BusquedaPorCedulaResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="BusquedaPorCedulaResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://www.registrocivil.gob.ec/ConsultaCedula}cedula" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "BusquedaPorCedulaResponse", propOrder = { + "_return" +}) +public class BusquedaPorCedulaResponse { + + @XmlElement(name = "return") + protected Cedula _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link Cedula } + * + */ + public Cedula getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link Cedula } + * + */ + public void setReturn(Cedula value) { + this._return = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/Cedula.java b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/Cedula.java new file mode 100644 index 0000000..bff475d --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/Cedula.java @@ -0,0 +1,622 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para cedula complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="cedula">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="CalleDomicilio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Cedula" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="CodigoError" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="CondicionCedulado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Conyuge" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Domicilio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Error" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="EstadoCivil" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="FechaCedulacion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="FechaNacimiento" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="FirmaElectronica" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Genero" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="IndividualDactilar" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Instruccion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="LugarNacimiento" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Nacionalidad" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="NombreMadre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="NombrePadre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Nombre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="NumeroDomicilio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Profesion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "cedula", propOrder = { + "calleDomicilio", + "cedula", + "codigoError", + "condicionCedulado", + "conyuge", + "domicilio", + "error", + "estadoCivil", + "fechaCedulacion", + "fechaNacimiento", + "firmaElectronica", + "genero", + "individualDactilar", + "instruccion", + "lugarNacimiento", + "nacionalidad", + "nombreMadre", + "nombrePadre", + "nombre", + "numeroDomicilio", + "profesion" +}) +public class Cedula { + + @XmlElement(name = "CalleDomicilio") + protected String calleDomicilio; + @XmlElement(name = "Cedula") + protected String cedula; + @XmlElement(name = "CodigoError") + protected String codigoError; + @XmlElement(name = "CondicionCedulado") + protected String condicionCedulado; + @XmlElement(name = "Conyuge") + protected String conyuge; + @XmlElement(name = "Domicilio") + protected String domicilio; + @XmlElement(name = "Error") + protected String error; + @XmlElement(name = "EstadoCivil") + protected String estadoCivil; + @XmlElement(name = "FechaCedulacion") + protected String fechaCedulacion; + @XmlElement(name = "FechaNacimiento") + protected String fechaNacimiento; + @XmlElement(name = "FirmaElectronica") + protected String firmaElectronica; + @XmlElement(name = "Genero") + protected String genero; + @XmlElement(name = "IndividualDactilar") + protected String individualDactilar; + @XmlElement(name = "Instruccion") + protected String instruccion; + @XmlElement(name = "LugarNacimiento") + protected String lugarNacimiento; + @XmlElement(name = "Nacionalidad") + protected String nacionalidad; + @XmlElement(name = "NombreMadre") + protected String nombreMadre; + @XmlElement(name = "NombrePadre") + protected String nombrePadre; + @XmlElement(name = "Nombre") + protected String nombre; + @XmlElement(name = "NumeroDomicilio") + protected String numeroDomicilio; + @XmlElement(name = "Profesion") + protected String profesion; + + /** + * Obtiene el valor de la propiedad calleDomicilio. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCalleDomicilio() { + return calleDomicilio; + } + + /** + * Define el valor de la propiedad calleDomicilio. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCalleDomicilio(String value) { + this.calleDomicilio = value; + } + + /** + * Obtiene el valor de la propiedad cedula. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCedula() { + return cedula; + } + + /** + * Define el valor de la propiedad cedula. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCedula(String value) { + this.cedula = value; + } + + /** + * Obtiene el valor de la propiedad codigoError. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodigoError() { + return codigoError; + } + + /** + * Define el valor de la propiedad codigoError. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodigoError(String value) { + this.codigoError = value; + } + + /** + * Obtiene el valor de la propiedad condicionCedulado. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCondicionCedulado() { + return condicionCedulado; + } + + /** + * Define el valor de la propiedad condicionCedulado. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCondicionCedulado(String value) { + this.condicionCedulado = value; + } + + /** + * Obtiene el valor de la propiedad conyuge. + * + * @return + * possible object is + * {@link String } + * + */ + public String getConyuge() { + return conyuge; + } + + /** + * Define el valor de la propiedad conyuge. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setConyuge(String value) { + this.conyuge = value; + } + + /** + * Obtiene el valor de la propiedad domicilio. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDomicilio() { + return domicilio; + } + + /** + * Define el valor de la propiedad domicilio. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDomicilio(String value) { + this.domicilio = value; + } + + /** + * Obtiene el valor de la propiedad error. + * + * @return + * possible object is + * {@link String } + * + */ + public String getError() { + return error; + } + + /** + * Define el valor de la propiedad error. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setError(String value) { + this.error = value; + } + + /** + * Obtiene el valor de la propiedad estadoCivil. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEstadoCivil() { + return estadoCivil; + } + + /** + * Define el valor de la propiedad estadoCivil. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEstadoCivil(String value) { + this.estadoCivil = value; + } + + /** + * Obtiene el valor de la propiedad fechaCedulacion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaCedulacion() { + return fechaCedulacion; + } + + /** + * Define el valor de la propiedad fechaCedulacion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaCedulacion(String value) { + this.fechaCedulacion = value; + } + + /** + * Obtiene el valor de la propiedad fechaNacimiento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaNacimiento() { + return fechaNacimiento; + } + + /** + * Define el valor de la propiedad fechaNacimiento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaNacimiento(String value) { + this.fechaNacimiento = value; + } + + /** + * Obtiene el valor de la propiedad firmaElectronica. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFirmaElectronica() { + return firmaElectronica; + } + + /** + * Define el valor de la propiedad firmaElectronica. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFirmaElectronica(String value) { + this.firmaElectronica = value; + } + + /** + * Obtiene el valor de la propiedad genero. + * + * @return + * possible object is + * {@link String } + * + */ + public String getGenero() { + return genero; + } + + /** + * Define el valor de la propiedad genero. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setGenero(String value) { + this.genero = value; + } + + /** + * Obtiene el valor de la propiedad individualDactilar. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIndividualDactilar() { + return individualDactilar; + } + + /** + * Define el valor de la propiedad individualDactilar. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIndividualDactilar(String individualDactilar) { + this.individualDactilar = individualDactilar; + } + + /** + * Obtiene el valor de la propiedad instruccion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getInstruccion() { + return instruccion; + } + + /** + * Define el valor de la propiedad instruccion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setInstruccion(String value) { + this.instruccion = value; + } + + /** + * Obtiene el valor de la propiedad lugarNacimiento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLugarNacimiento() { + return lugarNacimiento; + } + + /** + * Define el valor de la propiedad lugarNacimiento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLugarNacimiento(String value) { + this.lugarNacimiento = value; + } + + /** + * Obtiene el valor de la propiedad nacionalidad. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNacionalidad() { + return nacionalidad; + } + + /** + * Define el valor de la propiedad nacionalidad. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNacionalidad(String value) { + this.nacionalidad = value; + } + + /** + * Obtiene el valor de la propiedad nombreMadre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombreMadre() { + return nombreMadre; + } + + /** + * Define el valor de la propiedad nombreMadre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombreMadre(String value) { + this.nombreMadre = value; + } + + /** + * Obtiene el valor de la propiedad nombrePadre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombrePadre() { + return nombrePadre; + } + + /** + * Define el valor de la propiedad nombrePadre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombrePadre(String value) { + this.nombrePadre = value; + } + + /** + * Obtiene el valor de la propiedad nombre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombre() { + return nombre; + } + + /** + * Define el valor de la propiedad nombre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombre(String value) { + this.nombre = value; + } + + /** + * Obtiene el valor de la propiedad numeroDomicilio. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroDomicilio() { + return numeroDomicilio; + } + + /** + * Define el valor de la propiedad numeroDomicilio. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroDomicilio(String value) { + this.numeroDomicilio = value; + } + + /** + * Obtiene el valor de la propiedad profesion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getProfesion() { + return profesion; + } + + /** + * Define el valor de la propiedad profesion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setProfesion(String value) { + this.profesion = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/ObjectFactory.java b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/ObjectFactory.java new file mode 100644 index 0000000..1399799 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/ObjectFactory.java @@ -0,0 +1,115 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the ec.gob.registrocivil.consultacedula package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _BusquedaPorCedula_QNAME = new QName("http://www.registrocivil.gob.ec/ConsultaCedula", "BusquedaPorCedula"); + private final static QName _WsUpResponse_QNAME = new QName("http://www.registrocivil.gob.ec/ConsultaCedula", "WsUpResponse"); + private final static QName _BusquedaPorCedulaResponse_QNAME = new QName("http://www.registrocivil.gob.ec/ConsultaCedula", "BusquedaPorCedulaResponse"); + private final static QName _WsUp_QNAME = new QName("http://www.registrocivil.gob.ec/ConsultaCedula", "WsUp"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: ec.gob.registrocivil.consultacedula + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link BusquedaPorCedula } + * + */ + public BusquedaPorCedula createBusquedaPorCedula() { + return new BusquedaPorCedula(); + } + + /** + * Create an instance of {@link WsUp } + * + */ + public WsUp createWsUp() { + return new WsUp(); + } + + /** + * Create an instance of {@link BusquedaPorCedulaResponse } + * + */ + public BusquedaPorCedulaResponse createBusquedaPorCedulaResponse() { + return new BusquedaPorCedulaResponse(); + } + + /** + * Create an instance of {@link WsUpResponse } + * + */ + public WsUpResponse createWsUpResponse() { + return new WsUpResponse(); + } + + /** + * Create an instance of {@link Cedula } + * + */ + public Cedula createCedula() { + return new Cedula(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link BusquedaPorCedula }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.registrocivil.gob.ec/ConsultaCedula", name = "BusquedaPorCedula") + public JAXBElement createBusquedaPorCedula(BusquedaPorCedula value) { + return new JAXBElement(_BusquedaPorCedula_QNAME, BusquedaPorCedula.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link WsUpResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.registrocivil.gob.ec/ConsultaCedula", name = "WsUpResponse") + public JAXBElement createWsUpResponse(WsUpResponse value) { + return new JAXBElement(_WsUpResponse_QNAME, WsUpResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link BusquedaPorCedulaResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.registrocivil.gob.ec/ConsultaCedula", name = "BusquedaPorCedulaResponse") + public JAXBElement createBusquedaPorCedulaResponse(BusquedaPorCedulaResponse value) { + return new JAXBElement(_BusquedaPorCedulaResponse_QNAME, BusquedaPorCedulaResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link WsUp }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.registrocivil.gob.ec/ConsultaCedula", name = "WsUp") + public JAXBElement createWsUp(WsUp value) { + return new JAXBElement(_WsUp_QNAME, WsUp.class, null, value); + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/WSRegistroCivilConsultaCedula.java b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/WSRegistroCivilConsultaCedula.java new file mode 100644 index 0000000..2e20d1c --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/WSRegistroCivilConsultaCedula.java @@ -0,0 +1,57 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.6b21 + * Generated source version: 2.2 + * + */ +@WebService(name = "WSRegistroCivilConsultaCedula", targetNamespace = "http://www.registrocivil.gob.ec/ConsultaCedula") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface WSRegistroCivilConsultaCedula { + + + /** + * + * @param usuario + * @param contrasenia + * @param cedula + * @return + * returns ec.gob.registrocivil.consultacedula.Cedula + */ + @WebMethod(operationName = "BusquedaPorCedula") + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "BusquedaPorCedula", targetNamespace = "http://www.registrocivil.gob.ec/ConsultaCedula", className = "ec.gob.registrocivil.consultacedula.BusquedaPorCedula") + @ResponseWrapper(localName = "BusquedaPorCedulaResponse", targetNamespace = "http://www.registrocivil.gob.ec/ConsultaCedula", className = "ec.gob.registrocivil.consultacedula.BusquedaPorCedulaResponse") + public Cedula busquedaPorCedula( + @WebParam(name = "Cedula", targetNamespace = "") + String cedula, + @WebParam(name = "Usuario", targetNamespace = "") + String usuario, + @WebParam(name = "Contrasenia", targetNamespace = "") + String contrasenia); + + /** + * + * @return + * returns ec.gob.registrocivil.consultacedula.Cedula + */ + @WebMethod(operationName = "WsUp") + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "WsUp", targetNamespace = "http://www.registrocivil.gob.ec/ConsultaCedula", className = "ec.gob.registrocivil.consultacedula.WsUp") + @ResponseWrapper(localName = "WsUpResponse", targetNamespace = "http://www.registrocivil.gob.ec/ConsultaCedula", className = "ec.gob.registrocivil.consultacedula.WsUpResponse") + public Cedula wsUp(); + +} diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/WSRegistroCivilConsultaCedula_Service.java b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/WSRegistroCivilConsultaCedula_Service.java new file mode 100644 index 0000000..09b800c --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/WSRegistroCivilConsultaCedula_Service.java @@ -0,0 +1,96 @@ + +package ec.gob.registrocivil.consultacedula; + +import java.net.MalformedURLException; +import java.net.URL; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceException; +import javax.xml.ws.WebServiceFeature; + +import com.fp.webservices.snap.recursos.MsgSnap; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.6b21 + * Generated source version: 2.2 + * + */ +@WebServiceClient(name = "WSRegistroCivilConsultaCedula", targetNamespace = "http://www.registrocivil.gob.ec/ConsultaCedula", wsdlLocation = "https://bsg.gob.ec/sw/RC/BSGSW01_Consultar_Cedula?wsdl") +public class WSRegistroCivilConsultaCedula_Service + extends Service +{ + + private final static URL WSREGISTROCIVILCONSULTACEDULA_WSDL_LOCATION; + private final static WebServiceException WSREGISTROCIVILCONSULTACEDULA_EXCEPTION; + private final static QName WSREGISTROCIVILCONSULTACEDULA_QNAME = new QName("http://www.registrocivil.gob.ec/ConsultaCedula", "WSRegistroCivilConsultaCedula"); + + static { + URL url = null; + WebServiceException e = null; + try { + url = new URL(MsgSnap.getString("url_consulta_cedula")); + } catch (MalformedURLException ex) { + e = new WebServiceException(ex); + } + WSREGISTROCIVILCONSULTACEDULA_WSDL_LOCATION = url; + WSREGISTROCIVILCONSULTACEDULA_EXCEPTION = e; + } + + public WSRegistroCivilConsultaCedula_Service() { + super(__getWsdlLocation(), WSREGISTROCIVILCONSULTACEDULA_QNAME); + } + + public WSRegistroCivilConsultaCedula_Service(WebServiceFeature... features) { + super(__getWsdlLocation(), WSREGISTROCIVILCONSULTACEDULA_QNAME, features); + } + + public WSRegistroCivilConsultaCedula_Service(URL wsdlLocation) { + super(wsdlLocation, WSREGISTROCIVILCONSULTACEDULA_QNAME); + } + + public WSRegistroCivilConsultaCedula_Service(URL wsdlLocation, WebServiceFeature... features) { + super(wsdlLocation, WSREGISTROCIVILCONSULTACEDULA_QNAME, features); + } + + public WSRegistroCivilConsultaCedula_Service(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public WSRegistroCivilConsultaCedula_Service(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * + * @return + * returns WSRegistroCivilConsultaCedula + */ + @WebEndpoint(name = "WSRegistroCivilConsultaCedulaPort") + public WSRegistroCivilConsultaCedula getWSRegistroCivilConsultaCedulaPort() { + return super.getPort(new QName("http://www.registrocivil.gob.ec/ConsultaCedula", "WSRegistroCivilConsultaCedulaPort"), WSRegistroCivilConsultaCedula.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns WSRegistroCivilConsultaCedula + */ + @WebEndpoint(name = "WSRegistroCivilConsultaCedulaPort") + public WSRegistroCivilConsultaCedula getWSRegistroCivilConsultaCedulaPort(WebServiceFeature... features) { + return super.getPort(new QName("http://www.registrocivil.gob.ec/ConsultaCedula", "WSRegistroCivilConsultaCedulaPort"), WSRegistroCivilConsultaCedula.class, features); + } + + private static URL __getWsdlLocation() { + if (WSREGISTROCIVILCONSULTACEDULA_EXCEPTION!= null) { + throw WSREGISTROCIVILCONSULTACEDULA_EXCEPTION; + } + return WSREGISTROCIVILCONSULTACEDULA_WSDL_LOCATION; + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/WsUp.java b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/WsUp.java new file mode 100644 index 0000000..2809604 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/WsUp.java @@ -0,0 +1,32 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para WsUp complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="WsUp">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "WsUp") +public class WsUp { + + +} diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/WsUpResponse.java b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/WsUpResponse.java new file mode 100644 index 0000000..e09995e --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/WsUpResponse.java @@ -0,0 +1,62 @@ + +package ec.gob.registrocivil.consultacedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para WsUpResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="WsUpResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://www.registrocivil.gob.ec/ConsultaCedula}cedula" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "WsUpResponse", propOrder = { + "_return" +}) +public class WsUpResponse { + + @XmlElement(name = "return") + protected Cedula _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link Cedula } + * + */ + public Cedula getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link Cedula } + * + */ + public void setReturn(Cedula value) { + this._return = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/package-info.java b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/package-info.java new file mode 100644 index 0000000..e344919 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gob/registrocivil/consultacedula/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.registrocivil.gob.ec/ConsultaCedula") +package ec.gob.registrocivil.consultacedula; diff --git a/centralwebservices/src/main/java/ec/gov/.svn/entries b/centralwebservices/src/main/java/ec/gov/.svn/entries new file mode 100644 index 0000000..20100c5 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/java/ec/gov +svn://172.17.26.185/COMACO + + + +2015-01-23T05:44:56.960184Z +3791 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +sri +dir + diff --git a/centralwebservices/src/main/java/ec/gov/sri/.svn/entries b/centralwebservices/src/main/java/ec/gov/sri/.svn/entries new file mode 100644 index 0000000..f640d0b --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/java/ec/gov/sri +svn://172.17.26.185/COMACO + + + +2015-01-23T05:44:56.960184Z +3791 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +wsconsultacontribuyente +dir + diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/entries b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/entries new file mode 100644 index 0000000..98815a5 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/entries @@ -0,0 +1,742 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente +svn://172.17.26.185/COMACO + + + +2015-01-23T05:44:56.960184Z +3791 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ContribuyenteOnLine.java +file + + + + +2022-07-28T03:40:47.177822Z +c381f60cd2c1f461f0eddda6312622c4 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +8032 + +ObtenerCompleto.java +file + + + + +2022-07-28T03:40:47.178822Z +0571c28cb00b2cf2d13c75eb99f8ea58 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +2039 + +UbicacionGeografica.java +file + + + + +2022-07-28T03:40:47.178822Z +621de317c251508845b4690059cfa5f3 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +6982 + +ActividadEconomica.java +file + + + + +2022-07-28T03:40:47.178822Z +ea633b8001712b88b0bb455c18b5e23b +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +9144 + +ObtenerSimple.java +file + + + + +2022-07-28T03:40:47.179822Z +3ae6511eef4fd9a2d99a8a3996a9cf81 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +2031 + +ObtenerDatosResponse.java +file + + + + +2022-07-28T03:40:47.179822Z +a3ffb7d8cbdc944083cb8536d1836e2d +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1574 + +Contador.java +file + + + + +2022-07-28T03:40:47.179822Z +e19621ed87870c389e42539b7ce7e8f9 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +2511 + +AgenteRetencion.java +file + + + + +2022-07-28T03:40:47.180822Z +bdde2d99c44487e9fe49d174c14a23e3 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1368 + +ListaBlanca.java +file + + + + +2022-07-28T03:40:47.180822Z +79bc2340c9ca531ffd36a6b17b2d0411 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1352 + +WsConsultaContribuyente.java +file + + + + +2022-07-28T03:40:47.180822Z +d8cf14970ce57dce8e3b2b01d4e32c9e +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +2894 + +ObtenerCompletoResponse.java +file + + + + +2022-07-28T03:40:47.181822Z +1bc1f0918c97ce821774ccab0bb4e01e +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1598 + +EstructuraOrganizacional.java +file + + + + +2022-07-28T03:40:47.181822Z +3b6f959f52c6b7f366d16243f21fad5c +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +3876 + +RepresentanteLegal.java +file + + + + +2022-07-28T03:40:47.182822Z +b7273495d65feabc5f418dec47ef12e1 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +2641 + +package-info.java +file + + + + +2022-07-28T03:40:47.181822Z +91f869035576c860aa6db60950ce64d8 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +138 + +TipoContribuyente.java +file + + + + +2022-07-28T03:40:47.182822Z +a8a5f36d600c7a88754ca520b4f31193 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +4368 + +ObtenerSimpleResponse.java +file + + + + +2022-07-28T03:40:47.183822Z +4180f1cf033dd37eb0e64bee7529f2dd +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1542 + +ObtenerDatos.java +file + + + + +2022-07-28T03:40:47.183822Z +5a757561b87c4e599486d53d993fd787 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +1383 + +Contribuyente.java +file + + + + +2022-07-28T03:40:47.183822Z +0c7f76c6502fab6676af8b6e4b1c3438 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +10451 + +WebServiceContribuyenteService.java +file + + + + +2022-07-28T03:40:47.184822Z +541da5ed61f4a976a82aef6a6e90c234 +2015-01-23T05:44:56.960184Z +3791 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +3571 + +ContribuyenteCompleto.java +file + + + + +2022-07-28T03:40:47.184822Z +5a1b8832944c5d4372dd3857e195fa29 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +15570 + +ObjectFactory.java +file + + + + +2022-07-28T03:40:47.184822Z +7768892ddea53d3685a5a1aa8f44c3c5 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +7628 + diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ActividadEconomica.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ActividadEconomica.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ActividadEconomica.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/AgenteRetencion.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/AgenteRetencion.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/AgenteRetencion.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/Contador.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/Contador.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/Contador.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/Contribuyente.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/Contribuyente.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/Contribuyente.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ContribuyenteCompleto.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ContribuyenteCompleto.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ContribuyenteCompleto.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ContribuyenteOnLine.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ContribuyenteOnLine.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ContribuyenteOnLine.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/EstructuraOrganizacional.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/EstructuraOrganizacional.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/EstructuraOrganizacional.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ListaBlanca.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ListaBlanca.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ListaBlanca.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObjectFactory.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObjectFactory.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObjectFactory.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerCompleto.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerCompleto.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerCompleto.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerCompletoResponse.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerCompletoResponse.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerCompletoResponse.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerDatos.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerDatos.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerDatos.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerDatosResponse.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerDatosResponse.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerDatosResponse.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerSimple.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerSimple.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerSimple.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerSimpleResponse.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerSimpleResponse.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/ObtenerSimpleResponse.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/RepresentanteLegal.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/RepresentanteLegal.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/RepresentanteLegal.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/TipoContribuyente.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/TipoContribuyente.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/TipoContribuyente.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/UbicacionGeografica.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/UbicacionGeografica.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/UbicacionGeografica.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/WebServiceContribuyenteService.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/WebServiceContribuyenteService.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/WebServiceContribuyenteService.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/WsConsultaContribuyente.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/WsConsultaContribuyente.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/WsConsultaContribuyente.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/package-info.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/package-info.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/prop-base/package-info.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ActividadEconomica.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ActividadEconomica.java.svn-base new file mode 100644 index 0000000..6b3197f --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ActividadEconomica.java.svn-base @@ -0,0 +1,384 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para actividadEconomica complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="actividadEconomica">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="actividadGeneral" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN1Familia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN2Grupo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN3SubGrupo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN4Clase" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN5SubClase" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN6Actividad" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n1Familia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n2Grupo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n3SubGrupo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n4Clase" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n5SubClase" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n6Actividad" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "actividadEconomica", propOrder = { + "actividadGeneral", + "codN1Familia", + "codN2Grupo", + "codN3SubGrupo", + "codN4Clase", + "codN5SubClase", + "codN6Actividad", + "n1Familia", + "n2Grupo", + "n3SubGrupo", + "n4Clase", + "n5SubClase", + "n6Actividad" +}) +public class ActividadEconomica { + + protected String actividadGeneral; + protected String codN1Familia; + protected String codN2Grupo; + protected String codN3SubGrupo; + protected String codN4Clase; + protected String codN5SubClase; + protected String codN6Actividad; + protected String n1Familia; + protected String n2Grupo; + protected String n3SubGrupo; + protected String n4Clase; + protected String n5SubClase; + protected String n6Actividad; + + /** + * Obtiene el valor de la propiedad actividadGeneral. + * + * @return + * possible object is + * {@link String } + * + */ + public String getActividadGeneral() { + return actividadGeneral; + } + + /** + * Define el valor de la propiedad actividadGeneral. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setActividadGeneral(String value) { + this.actividadGeneral = value; + } + + /** + * Obtiene el valor de la propiedad codN1Familia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN1Familia() { + return codN1Familia; + } + + /** + * Define el valor de la propiedad codN1Familia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN1Familia(String value) { + this.codN1Familia = value; + } + + /** + * Obtiene el valor de la propiedad codN2Grupo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN2Grupo() { + return codN2Grupo; + } + + /** + * Define el valor de la propiedad codN2Grupo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN2Grupo(String value) { + this.codN2Grupo = value; + } + + /** + * Obtiene el valor de la propiedad codN3SubGrupo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN3SubGrupo() { + return codN3SubGrupo; + } + + /** + * Define el valor de la propiedad codN3SubGrupo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN3SubGrupo(String value) { + this.codN3SubGrupo = value; + } + + /** + * Obtiene el valor de la propiedad codN4Clase. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN4Clase() { + return codN4Clase; + } + + /** + * Define el valor de la propiedad codN4Clase. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN4Clase(String value) { + this.codN4Clase = value; + } + + /** + * Obtiene el valor de la propiedad codN5SubClase. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN5SubClase() { + return codN5SubClase; + } + + /** + * Define el valor de la propiedad codN5SubClase. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN5SubClase(String value) { + this.codN5SubClase = value; + } + + /** + * Obtiene el valor de la propiedad codN6Actividad. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN6Actividad() { + return codN6Actividad; + } + + /** + * Define el valor de la propiedad codN6Actividad. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN6Actividad(String value) { + this.codN6Actividad = value; + } + + /** + * Obtiene el valor de la propiedad n1Familia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN1Familia() { + return n1Familia; + } + + /** + * Define el valor de la propiedad n1Familia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN1Familia(String value) { + this.n1Familia = value; + } + + /** + * Obtiene el valor de la propiedad n2Grupo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN2Grupo() { + return n2Grupo; + } + + /** + * Define el valor de la propiedad n2Grupo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN2Grupo(String value) { + this.n2Grupo = value; + } + + /** + * Obtiene el valor de la propiedad n3SubGrupo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN3SubGrupo() { + return n3SubGrupo; + } + + /** + * Define el valor de la propiedad n3SubGrupo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN3SubGrupo(String value) { + this.n3SubGrupo = value; + } + + /** + * Obtiene el valor de la propiedad n4Clase. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN4Clase() { + return n4Clase; + } + + /** + * Define el valor de la propiedad n4Clase. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN4Clase(String value) { + this.n4Clase = value; + } + + /** + * Obtiene el valor de la propiedad n5SubClase. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN5SubClase() { + return n5SubClase; + } + + /** + * Define el valor de la propiedad n5SubClase. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN5SubClase(String value) { + this.n5SubClase = value; + } + + /** + * Obtiene el valor de la propiedad n6Actividad. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN6Actividad() { + return n6Actividad; + } + + /** + * Define el valor de la propiedad n6Actividad. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN6Actividad(String value) { + this.n6Actividad = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/AgenteRetencion.java.netbeans-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/AgenteRetencion.java.netbeans-base new file mode 100644 index 0000000..1378a8c --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/AgenteRetencion.java.netbeans-base @@ -0,0 +1,60 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para agenteRetencion complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="agenteRetencion">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="nombre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "agenteRetencion", propOrder = { + "nombre" +}) +public class AgenteRetencion { + + protected String nombre; + + /** + * Obtiene el valor de la propiedad nombre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombre() { + return nombre; + } + + /** + * Define el valor de la propiedad nombre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombre(String value) { + this.nombre = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/AgenteRetencion.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/AgenteRetencion.java.svn-base new file mode 100644 index 0000000..1378a8c --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/AgenteRetencion.java.svn-base @@ -0,0 +1,60 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para agenteRetencion complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="agenteRetencion">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="nombre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "agenteRetencion", propOrder = { + "nombre" +}) +public class AgenteRetencion { + + protected String nombre; + + /** + * Obtiene el valor de la propiedad nombre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombre() { + return nombre; + } + + /** + * Define el valor de la propiedad nombre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombre(String value) { + this.nombre = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/Contador.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/Contador.java.svn-base new file mode 100644 index 0000000..8c4dfe4 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/Contador.java.svn-base @@ -0,0 +1,114 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para contador complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="contador">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="cedula" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nombre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="ruc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "contador", propOrder = { + "cedula", + "nombre", + "ruc" +}) +public class Contador { + + protected String cedula; + protected String nombre; + protected String ruc; + + /** + * Obtiene el valor de la propiedad cedula. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCedula() { + return cedula; + } + + /** + * Define el valor de la propiedad cedula. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCedula(String value) { + this.cedula = value; + } + + /** + * Obtiene el valor de la propiedad nombre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombre() { + return nombre; + } + + /** + * Define el valor de la propiedad nombre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombre(String value) { + this.nombre = value; + } + + /** + * Obtiene el valor de la propiedad ruc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRuc() { + return ruc; + } + + /** + * Define el valor de la propiedad ruc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRuc(String value) { + this.ruc = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/Contribuyente.java.netbeans-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/Contribuyente.java.netbeans-base new file mode 100644 index 0000000..a31f64c --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/Contribuyente.java.netbeans-base @@ -0,0 +1,416 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para contribuyente complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="contribuyente">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="actividadEconomica" type="{http://sri.gov.ec/wsConsultaContribuyente}actividadEconomica" minOccurs="0"/>
+ *         <element name="codClaseContrib" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codEstado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="desClaseContrib" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="desEstado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="direccionCorta" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="email" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nombreComercial" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="numeroRuc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="razonSocial" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="telefonoDomicilio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="telefonoTrabajo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="tipoContribuyente" type="{http://sri.gov.ec/wsConsultaContribuyente}tipoContribuyente" minOccurs="0"/>
+ *         <element name="ubicacionGeografica" type="{http://sri.gov.ec/wsConsultaContribuyente}ubicacionGeografica" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "contribuyente", propOrder = { + "actividadEconomica", + "codClaseContrib", + "codEstado", + "desClaseContrib", + "desEstado", + "direccionCorta", + "email", + "nombreComercial", + "numeroRuc", + "razonSocial", + "telefonoDomicilio", + "telefonoTrabajo", + "tipoContribuyente", + "ubicacionGeografica" +}) +@XmlSeeAlso({ + ContribuyenteOnLine.class, + ContribuyenteCompleto.class +}) +public class Contribuyente { + + protected ActividadEconomica actividadEconomica; + protected String codClaseContrib; + protected String codEstado; + protected String desClaseContrib; + protected String desEstado; + protected String direccionCorta; + protected String email; + protected String nombreComercial; + protected String numeroRuc; + protected String razonSocial; + protected String telefonoDomicilio; + protected String telefonoTrabajo; + protected TipoContribuyente tipoContribuyente; + protected UbicacionGeografica ubicacionGeografica; + + /** + * Obtiene el valor de la propiedad actividadEconomica. + * + * @return + * possible object is + * {@link ActividadEconomica } + * + */ + public ActividadEconomica getActividadEconomica() { + return actividadEconomica; + } + + /** + * Define el valor de la propiedad actividadEconomica. + * + * @param value + * allowed object is + * {@link ActividadEconomica } + * + */ + public void setActividadEconomica(ActividadEconomica value) { + this.actividadEconomica = value; + } + + /** + * Obtiene el valor de la propiedad codClaseContrib. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodClaseContrib() { + return codClaseContrib; + } + + /** + * Define el valor de la propiedad codClaseContrib. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodClaseContrib(String value) { + this.codClaseContrib = value; + } + + /** + * Obtiene el valor de la propiedad codEstado. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodEstado() { + return codEstado; + } + + /** + * Define el valor de la propiedad codEstado. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodEstado(String value) { + this.codEstado = value; + } + + /** + * Obtiene el valor de la propiedad desClaseContrib. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDesClaseContrib() { + return desClaseContrib; + } + + /** + * Define el valor de la propiedad desClaseContrib. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDesClaseContrib(String value) { + this.desClaseContrib = value; + } + + /** + * Obtiene el valor de la propiedad desEstado. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDesEstado() { + return desEstado; + } + + /** + * Define el valor de la propiedad desEstado. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDesEstado(String value) { + this.desEstado = value; + } + + /** + * Obtiene el valor de la propiedad direccionCorta. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDireccionCorta() { + return direccionCorta; + } + + /** + * Define el valor de la propiedad direccionCorta. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDireccionCorta(String value) { + this.direccionCorta = value; + } + + /** + * Obtiene el valor de la propiedad email. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEmail() { + return email; + } + + /** + * Define el valor de la propiedad email. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEmail(String value) { + this.email = value; + } + + /** + * Obtiene el valor de la propiedad nombreComercial. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombreComercial() { + return nombreComercial; + } + + /** + * Define el valor de la propiedad nombreComercial. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombreComercial(String value) { + this.nombreComercial = value; + } + + /** + * Obtiene el valor de la propiedad numeroRuc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroRuc() { + return numeroRuc; + } + + /** + * Define el valor de la propiedad numeroRuc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroRuc(String value) { + this.numeroRuc = value; + } + + /** + * Obtiene el valor de la propiedad razonSocial. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRazonSocial() { + return razonSocial; + } + + /** + * Define el valor de la propiedad razonSocial. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRazonSocial(String value) { + this.razonSocial = value; + } + + /** + * Obtiene el valor de la propiedad telefonoDomicilio. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTelefonoDomicilio() { + return telefonoDomicilio; + } + + /** + * Define el valor de la propiedad telefonoDomicilio. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTelefonoDomicilio(String value) { + this.telefonoDomicilio = value; + } + + /** + * Obtiene el valor de la propiedad telefonoTrabajo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTelefonoTrabajo() { + return telefonoTrabajo; + } + + /** + * Define el valor de la propiedad telefonoTrabajo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTelefonoTrabajo(String value) { + this.telefonoTrabajo = value; + } + + /** + * Obtiene el valor de la propiedad tipoContribuyente. + * + * @return + * possible object is + * {@link TipoContribuyente } + * + */ + public TipoContribuyente getTipoContribuyente() { + return tipoContribuyente; + } + + /** + * Define el valor de la propiedad tipoContribuyente. + * + * @param value + * allowed object is + * {@link TipoContribuyente } + * + */ + public void setTipoContribuyente(TipoContribuyente value) { + this.tipoContribuyente = value; + } + + /** + * Obtiene el valor de la propiedad ubicacionGeografica. + * + * @return + * possible object is + * {@link UbicacionGeografica } + * + */ + public UbicacionGeografica getUbicacionGeografica() { + return ubicacionGeografica; + } + + /** + * Define el valor de la propiedad ubicacionGeografica. + * + * @param value + * allowed object is + * {@link UbicacionGeografica } + * + */ + public void setUbicacionGeografica(UbicacionGeografica value) { + this.ubicacionGeografica = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/Contribuyente.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/Contribuyente.java.svn-base new file mode 100644 index 0000000..a31f64c --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/Contribuyente.java.svn-base @@ -0,0 +1,416 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para contribuyente complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="contribuyente">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="actividadEconomica" type="{http://sri.gov.ec/wsConsultaContribuyente}actividadEconomica" minOccurs="0"/>
+ *         <element name="codClaseContrib" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codEstado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="desClaseContrib" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="desEstado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="direccionCorta" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="email" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nombreComercial" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="numeroRuc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="razonSocial" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="telefonoDomicilio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="telefonoTrabajo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="tipoContribuyente" type="{http://sri.gov.ec/wsConsultaContribuyente}tipoContribuyente" minOccurs="0"/>
+ *         <element name="ubicacionGeografica" type="{http://sri.gov.ec/wsConsultaContribuyente}ubicacionGeografica" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "contribuyente", propOrder = { + "actividadEconomica", + "codClaseContrib", + "codEstado", + "desClaseContrib", + "desEstado", + "direccionCorta", + "email", + "nombreComercial", + "numeroRuc", + "razonSocial", + "telefonoDomicilio", + "telefonoTrabajo", + "tipoContribuyente", + "ubicacionGeografica" +}) +@XmlSeeAlso({ + ContribuyenteOnLine.class, + ContribuyenteCompleto.class +}) +public class Contribuyente { + + protected ActividadEconomica actividadEconomica; + protected String codClaseContrib; + protected String codEstado; + protected String desClaseContrib; + protected String desEstado; + protected String direccionCorta; + protected String email; + protected String nombreComercial; + protected String numeroRuc; + protected String razonSocial; + protected String telefonoDomicilio; + protected String telefonoTrabajo; + protected TipoContribuyente tipoContribuyente; + protected UbicacionGeografica ubicacionGeografica; + + /** + * Obtiene el valor de la propiedad actividadEconomica. + * + * @return + * possible object is + * {@link ActividadEconomica } + * + */ + public ActividadEconomica getActividadEconomica() { + return actividadEconomica; + } + + /** + * Define el valor de la propiedad actividadEconomica. + * + * @param value + * allowed object is + * {@link ActividadEconomica } + * + */ + public void setActividadEconomica(ActividadEconomica value) { + this.actividadEconomica = value; + } + + /** + * Obtiene el valor de la propiedad codClaseContrib. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodClaseContrib() { + return codClaseContrib; + } + + /** + * Define el valor de la propiedad codClaseContrib. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodClaseContrib(String value) { + this.codClaseContrib = value; + } + + /** + * Obtiene el valor de la propiedad codEstado. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodEstado() { + return codEstado; + } + + /** + * Define el valor de la propiedad codEstado. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodEstado(String value) { + this.codEstado = value; + } + + /** + * Obtiene el valor de la propiedad desClaseContrib. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDesClaseContrib() { + return desClaseContrib; + } + + /** + * Define el valor de la propiedad desClaseContrib. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDesClaseContrib(String value) { + this.desClaseContrib = value; + } + + /** + * Obtiene el valor de la propiedad desEstado. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDesEstado() { + return desEstado; + } + + /** + * Define el valor de la propiedad desEstado. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDesEstado(String value) { + this.desEstado = value; + } + + /** + * Obtiene el valor de la propiedad direccionCorta. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDireccionCorta() { + return direccionCorta; + } + + /** + * Define el valor de la propiedad direccionCorta. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDireccionCorta(String value) { + this.direccionCorta = value; + } + + /** + * Obtiene el valor de la propiedad email. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEmail() { + return email; + } + + /** + * Define el valor de la propiedad email. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEmail(String value) { + this.email = value; + } + + /** + * Obtiene el valor de la propiedad nombreComercial. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombreComercial() { + return nombreComercial; + } + + /** + * Define el valor de la propiedad nombreComercial. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombreComercial(String value) { + this.nombreComercial = value; + } + + /** + * Obtiene el valor de la propiedad numeroRuc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroRuc() { + return numeroRuc; + } + + /** + * Define el valor de la propiedad numeroRuc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroRuc(String value) { + this.numeroRuc = value; + } + + /** + * Obtiene el valor de la propiedad razonSocial. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRazonSocial() { + return razonSocial; + } + + /** + * Define el valor de la propiedad razonSocial. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRazonSocial(String value) { + this.razonSocial = value; + } + + /** + * Obtiene el valor de la propiedad telefonoDomicilio. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTelefonoDomicilio() { + return telefonoDomicilio; + } + + /** + * Define el valor de la propiedad telefonoDomicilio. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTelefonoDomicilio(String value) { + this.telefonoDomicilio = value; + } + + /** + * Obtiene el valor de la propiedad telefonoTrabajo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTelefonoTrabajo() { + return telefonoTrabajo; + } + + /** + * Define el valor de la propiedad telefonoTrabajo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTelefonoTrabajo(String value) { + this.telefonoTrabajo = value; + } + + /** + * Obtiene el valor de la propiedad tipoContribuyente. + * + * @return + * possible object is + * {@link TipoContribuyente } + * + */ + public TipoContribuyente getTipoContribuyente() { + return tipoContribuyente; + } + + /** + * Define el valor de la propiedad tipoContribuyente. + * + * @param value + * allowed object is + * {@link TipoContribuyente } + * + */ + public void setTipoContribuyente(TipoContribuyente value) { + this.tipoContribuyente = value; + } + + /** + * Obtiene el valor de la propiedad ubicacionGeografica. + * + * @return + * possible object is + * {@link UbicacionGeografica } + * + */ + public UbicacionGeografica getUbicacionGeografica() { + return ubicacionGeografica; + } + + /** + * Define el valor de la propiedad ubicacionGeografica. + * + * @param value + * allowed object is + * {@link UbicacionGeografica } + * + */ + public void setUbicacionGeografica(UbicacionGeografica value) { + this.ubicacionGeografica = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ContribuyenteCompleto.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ContribuyenteCompleto.java.svn-base new file mode 100644 index 0000000..82a0b62 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ContribuyenteCompleto.java.svn-base @@ -0,0 +1,575 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para contribuyenteCompleto complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="contribuyenteCompleto">
+ *   <complexContent>
+ *     <extension base="{http://sri.gov.ec/wsConsultaContribuyente}contribuyente">
+ *       <sequence>
+ *         <element name="agenteRetencion" type="{http://sri.gov.ec/wsConsultaContribuyente}agenteRetencion" minOccurs="0"/>
+ *         <element name="calificacionArtesanal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="contador" type="{http://sri.gov.ec/wsConsultaContribuyente}contador" minOccurs="0"/>
+ *         <element name="direccionLarga" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="estructuraOrganizacional" type="{http://sri.gov.ec/wsConsultaContribuyente}estructuraOrganizacional" minOccurs="0"/>
+ *         <element name="fax" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaAltaParaEspecial" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaCalificacionArtesanal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaCambioObligado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaInicioActividades" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaNacimiento" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaNotificacionEspeciales" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaUltimaDeclaracion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="listaBlanca" type="{http://sri.gov.ec/wsConsultaContribuyente}listaBlanca" minOccurs="0"/>
+ *         <element name="numeroCalificacionArtesanal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="obligadoContabilidad" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="representanteLegal" type="{http://sri.gov.ec/wsConsultaContribuyente}representanteLegal" minOccurs="0"/>
+ *         <element name="resolucionAltaParaEspecial" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="tipoCalificacionArtesanal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="ultimoPeriodoFiscalCumplido" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "contribuyenteCompleto", propOrder = { + "agenteRetencion", + "calificacionArtesanal", + "contador", + "direccionLarga", + "estructuraOrganizacional", + "fax", + "fechaAltaParaEspecial", + "fechaCalificacionArtesanal", + "fechaCambioObligado", + "fechaInicioActividades", + "fechaNacimiento", + "fechaNotificacionEspeciales", + "fechaUltimaDeclaracion", + "listaBlanca", + "numeroCalificacionArtesanal", + "obligadoContabilidad", + "representanteLegal", + "resolucionAltaParaEspecial", + "tipoCalificacionArtesanal", + "ultimoPeriodoFiscalCumplido" +}) +public class ContribuyenteCompleto + extends Contribuyente +{ + + protected AgenteRetencion agenteRetencion; + protected String calificacionArtesanal; + protected Contador contador; + protected String direccionLarga; + protected EstructuraOrganizacional estructuraOrganizacional; + protected String fax; + protected String fechaAltaParaEspecial; + protected String fechaCalificacionArtesanal; + protected String fechaCambioObligado; + protected String fechaInicioActividades; + protected String fechaNacimiento; + protected String fechaNotificacionEspeciales; + protected String fechaUltimaDeclaracion; + protected ListaBlanca listaBlanca; + protected String numeroCalificacionArtesanal; + protected String obligadoContabilidad; + protected RepresentanteLegal representanteLegal; + protected String resolucionAltaParaEspecial; + protected String tipoCalificacionArtesanal; + protected String ultimoPeriodoFiscalCumplido; + + /** + * Obtiene el valor de la propiedad agenteRetencion. + * + * @return + * possible object is + * {@link AgenteRetencion } + * + */ + public AgenteRetencion getAgenteRetencion() { + return agenteRetencion; + } + + /** + * Define el valor de la propiedad agenteRetencion. + * + * @param value + * allowed object is + * {@link AgenteRetencion } + * + */ + public void setAgenteRetencion(AgenteRetencion value) { + this.agenteRetencion = value; + } + + /** + * Obtiene el valor de la propiedad calificacionArtesanal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCalificacionArtesanal() { + return calificacionArtesanal; + } + + /** + * Define el valor de la propiedad calificacionArtesanal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCalificacionArtesanal(String value) { + this.calificacionArtesanal = value; + } + + /** + * Obtiene el valor de la propiedad contador. + * + * @return + * possible object is + * {@link Contador } + * + */ + public Contador getContador() { + return contador; + } + + /** + * Define el valor de la propiedad contador. + * + * @param value + * allowed object is + * {@link Contador } + * + */ + public void setContador(Contador value) { + this.contador = value; + } + + /** + * Obtiene el valor de la propiedad direccionLarga. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDireccionLarga() { + return direccionLarga; + } + + /** + * Define el valor de la propiedad direccionLarga. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDireccionLarga(String value) { + this.direccionLarga = value; + } + + /** + * Obtiene el valor de la propiedad estructuraOrganizacional. + * + * @return + * possible object is + * {@link EstructuraOrganizacional } + * + */ + public EstructuraOrganizacional getEstructuraOrganizacional() { + return estructuraOrganizacional; + } + + /** + * Define el valor de la propiedad estructuraOrganizacional. + * + * @param value + * allowed object is + * {@link EstructuraOrganizacional } + * + */ + public void setEstructuraOrganizacional(EstructuraOrganizacional value) { + this.estructuraOrganizacional = value; + } + + /** + * Obtiene el valor de la propiedad fax. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFax() { + return fax; + } + + /** + * Define el valor de la propiedad fax. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFax(String value) { + this.fax = value; + } + + /** + * Obtiene el valor de la propiedad fechaAltaParaEspecial. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaAltaParaEspecial() { + return fechaAltaParaEspecial; + } + + /** + * Define el valor de la propiedad fechaAltaParaEspecial. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaAltaParaEspecial(String value) { + this.fechaAltaParaEspecial = value; + } + + /** + * Obtiene el valor de la propiedad fechaCalificacionArtesanal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaCalificacionArtesanal() { + return fechaCalificacionArtesanal; + } + + /** + * Define el valor de la propiedad fechaCalificacionArtesanal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaCalificacionArtesanal(String value) { + this.fechaCalificacionArtesanal = value; + } + + /** + * Obtiene el valor de la propiedad fechaCambioObligado. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaCambioObligado() { + return fechaCambioObligado; + } + + /** + * Define el valor de la propiedad fechaCambioObligado. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaCambioObligado(String value) { + this.fechaCambioObligado = value; + } + + /** + * Obtiene el valor de la propiedad fechaInicioActividades. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaInicioActividades() { + return fechaInicioActividades; + } + + /** + * Define el valor de la propiedad fechaInicioActividades. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaInicioActividades(String value) { + this.fechaInicioActividades = value; + } + + /** + * Obtiene el valor de la propiedad fechaNacimiento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaNacimiento() { + return fechaNacimiento; + } + + /** + * Define el valor de la propiedad fechaNacimiento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaNacimiento(String value) { + this.fechaNacimiento = value; + } + + /** + * Obtiene el valor de la propiedad fechaNotificacionEspeciales. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaNotificacionEspeciales() { + return fechaNotificacionEspeciales; + } + + /** + * Define el valor de la propiedad fechaNotificacionEspeciales. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaNotificacionEspeciales(String value) { + this.fechaNotificacionEspeciales = value; + } + + /** + * Obtiene el valor de la propiedad fechaUltimaDeclaracion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaUltimaDeclaracion() { + return fechaUltimaDeclaracion; + } + + /** + * Define el valor de la propiedad fechaUltimaDeclaracion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaUltimaDeclaracion(String value) { + this.fechaUltimaDeclaracion = value; + } + + /** + * Obtiene el valor de la propiedad listaBlanca. + * + * @return + * possible object is + * {@link ListaBlanca } + * + */ + public ListaBlanca getListaBlanca() { + return listaBlanca; + } + + /** + * Define el valor de la propiedad listaBlanca. + * + * @param value + * allowed object is + * {@link ListaBlanca } + * + */ + public void setListaBlanca(ListaBlanca value) { + this.listaBlanca = value; + } + + /** + * Obtiene el valor de la propiedad numeroCalificacionArtesanal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroCalificacionArtesanal() { + return numeroCalificacionArtesanal; + } + + /** + * Define el valor de la propiedad numeroCalificacionArtesanal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroCalificacionArtesanal(String value) { + this.numeroCalificacionArtesanal = value; + } + + /** + * Obtiene el valor de la propiedad obligadoContabilidad. + * + * @return + * possible object is + * {@link String } + * + */ + public String getObligadoContabilidad() { + return obligadoContabilidad; + } + + /** + * Define el valor de la propiedad obligadoContabilidad. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setObligadoContabilidad(String value) { + this.obligadoContabilidad = value; + } + + /** + * Obtiene el valor de la propiedad representanteLegal. + * + * @return + * possible object is + * {@link RepresentanteLegal } + * + */ + public RepresentanteLegal getRepresentanteLegal() { + return representanteLegal; + } + + /** + * Define el valor de la propiedad representanteLegal. + * + * @param value + * allowed object is + * {@link RepresentanteLegal } + * + */ + public void setRepresentanteLegal(RepresentanteLegal value) { + this.representanteLegal = value; + } + + /** + * Obtiene el valor de la propiedad resolucionAltaParaEspecial. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResolucionAltaParaEspecial() { + return resolucionAltaParaEspecial; + } + + /** + * Define el valor de la propiedad resolucionAltaParaEspecial. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResolucionAltaParaEspecial(String value) { + this.resolucionAltaParaEspecial = value; + } + + /** + * Obtiene el valor de la propiedad tipoCalificacionArtesanal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTipoCalificacionArtesanal() { + return tipoCalificacionArtesanal; + } + + /** + * Define el valor de la propiedad tipoCalificacionArtesanal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTipoCalificacionArtesanal(String value) { + this.tipoCalificacionArtesanal = value; + } + + /** + * Obtiene el valor de la propiedad ultimoPeriodoFiscalCumplido. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUltimoPeriodoFiscalCumplido() { + return ultimoPeriodoFiscalCumplido; + } + + /** + * Define el valor de la propiedad ultimoPeriodoFiscalCumplido. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUltimoPeriodoFiscalCumplido(String value) { + this.ultimoPeriodoFiscalCumplido = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ContribuyenteOnLine.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ContribuyenteOnLine.java.svn-base new file mode 100644 index 0000000..080ef38 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ContribuyenteOnLine.java.svn-base @@ -0,0 +1,332 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para contribuyenteOnLine complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="contribuyenteOnLine">
+ *   <complexContent>
+ *     <extension base="{http://sri.gov.ec/wsConsultaContribuyente}contribuyente">
+ *       <sequence>
+ *         <element name="actEcoPrin" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="activEstablec" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codActEcoPrin" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="desUbicaGeograf" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="descTipoContri" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaIniAct" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="idRepreLegal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nombreRepreLegal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="telefonos" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="tipoContri" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="ubicaGeograf" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "contribuyenteOnLine", propOrder = { + "actEcoPrin", + "activEstablec", + "codActEcoPrin", + "desUbicaGeograf", + "descTipoContri", + "fechaIniAct", + "idRepreLegal", + "nombreRepreLegal", + "telefonos", + "tipoContri", + "ubicaGeograf" +}) +public class ContribuyenteOnLine + extends Contribuyente +{ + + protected String actEcoPrin; + protected String activEstablec; + protected String codActEcoPrin; + protected String desUbicaGeograf; + protected String descTipoContri; + protected String fechaIniAct; + protected String idRepreLegal; + protected String nombreRepreLegal; + protected String telefonos; + protected String tipoContri; + protected String ubicaGeograf; + + /** + * Obtiene el valor de la propiedad actEcoPrin. + * + * @return + * possible object is + * {@link String } + * + */ + public String getActEcoPrin() { + return actEcoPrin; + } + + /** + * Define el valor de la propiedad actEcoPrin. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setActEcoPrin(String value) { + this.actEcoPrin = value; + } + + /** + * Obtiene el valor de la propiedad activEstablec. + * + * @return + * possible object is + * {@link String } + * + */ + public String getActivEstablec() { + return activEstablec; + } + + /** + * Define el valor de la propiedad activEstablec. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setActivEstablec(String value) { + this.activEstablec = value; + } + + /** + * Obtiene el valor de la propiedad codActEcoPrin. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodActEcoPrin() { + return codActEcoPrin; + } + + /** + * Define el valor de la propiedad codActEcoPrin. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodActEcoPrin(String value) { + this.codActEcoPrin = value; + } + + /** + * Obtiene el valor de la propiedad desUbicaGeograf. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDesUbicaGeograf() { + return desUbicaGeograf; + } + + /** + * Define el valor de la propiedad desUbicaGeograf. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDesUbicaGeograf(String value) { + this.desUbicaGeograf = value; + } + + /** + * Obtiene el valor de la propiedad descTipoContri. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDescTipoContri() { + return descTipoContri; + } + + /** + * Define el valor de la propiedad descTipoContri. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDescTipoContri(String value) { + this.descTipoContri = value; + } + + /** + * Obtiene el valor de la propiedad fechaIniAct. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaIniAct() { + return fechaIniAct; + } + + /** + * Define el valor de la propiedad fechaIniAct. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaIniAct(String value) { + this.fechaIniAct = value; + } + + /** + * Obtiene el valor de la propiedad idRepreLegal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIdRepreLegal() { + return idRepreLegal; + } + + /** + * Define el valor de la propiedad idRepreLegal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIdRepreLegal(String value) { + this.idRepreLegal = value; + } + + /** + * Obtiene el valor de la propiedad nombreRepreLegal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombreRepreLegal() { + return nombreRepreLegal; + } + + /** + * Define el valor de la propiedad nombreRepreLegal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombreRepreLegal(String value) { + this.nombreRepreLegal = value; + } + + /** + * Obtiene el valor de la propiedad telefonos. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTelefonos() { + return telefonos; + } + + /** + * Define el valor de la propiedad telefonos. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTelefonos(String value) { + this.telefonos = value; + } + + /** + * Obtiene el valor de la propiedad tipoContri. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTipoContri() { + return tipoContri; + } + + /** + * Define el valor de la propiedad tipoContri. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTipoContri(String value) { + this.tipoContri = value; + } + + /** + * Obtiene el valor de la propiedad ubicaGeograf. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUbicaGeograf() { + return ubicaGeograf; + } + + /** + * Define el valor de la propiedad ubicaGeograf. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUbicaGeograf(String value) { + this.ubicaGeograf = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/EstructuraOrganizacional.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/EstructuraOrganizacional.java.svn-base new file mode 100644 index 0000000..c175fee --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/EstructuraOrganizacional.java.svn-base @@ -0,0 +1,160 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para estructuraOrganizacional complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="estructuraOrganizacional">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="codigoProvincia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codigoRegional" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="id" type="{http://www.w3.org/2001/XMLSchema}long"/>
+ *         <element name="nombreProvincia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nombreRegional" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "estructuraOrganizacional", propOrder = { + "codigoProvincia", + "codigoRegional", + "id", + "nombreProvincia", + "nombreRegional" +}) +public class EstructuraOrganizacional { + + protected String codigoProvincia; + protected String codigoRegional; + protected long id; + protected String nombreProvincia; + protected String nombreRegional; + + /** + * Obtiene el valor de la propiedad codigoProvincia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodigoProvincia() { + return codigoProvincia; + } + + /** + * Define el valor de la propiedad codigoProvincia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodigoProvincia(String value) { + this.codigoProvincia = value; + } + + /** + * Obtiene el valor de la propiedad codigoRegional. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodigoRegional() { + return codigoRegional; + } + + /** + * Define el valor de la propiedad codigoRegional. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodigoRegional(String value) { + this.codigoRegional = value; + } + + /** + * Obtiene el valor de la propiedad id. + * + */ + public long getId() { + return id; + } + + /** + * Define el valor de la propiedad id. + * + */ + public void setId(long value) { + this.id = value; + } + + /** + * Obtiene el valor de la propiedad nombreProvincia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombreProvincia() { + return nombreProvincia; + } + + /** + * Define el valor de la propiedad nombreProvincia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombreProvincia(String value) { + this.nombreProvincia = value; + } + + /** + * Obtiene el valor de la propiedad nombreRegional. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombreRegional() { + return nombreRegional; + } + + /** + * Define el valor de la propiedad nombreRegional. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombreRegional(String value) { + this.nombreRegional = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ListaBlanca.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ListaBlanca.java.svn-base new file mode 100644 index 0000000..91b3c90 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ListaBlanca.java.svn-base @@ -0,0 +1,60 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para listaBlanca complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="listaBlanca">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="estado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "listaBlanca", propOrder = { + "estado" +}) +public class ListaBlanca { + + protected String estado; + + /** + * Obtiene el valor de la propiedad estado. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEstado() { + return estado; + } + + /** + * Define el valor de la propiedad estado. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEstado(String value) { + this.estado = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObjectFactory.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObjectFactory.java.svn-base new file mode 100644 index 0000000..51c2a79 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObjectFactory.java.svn-base @@ -0,0 +1,231 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the ec.gov.sri.wsconsultacontribuyente package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _ObtenerSimple_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerSimple"); + private final static QName _ObtenerCompletoResponse_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerCompletoResponse"); + private final static QName _ObtenerSimpleResponse_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerSimpleResponse"); + private final static QName _ObtenerCompleto_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerCompleto"); + private final static QName _ObtenerDatos_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerDatos"); + private final static QName _ObtenerDatosResponse_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerDatosResponse"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: ec.gov.sri.wsconsultacontribuyente + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link ObtenerSimple } + * + */ + public ObtenerSimple createObtenerSimple() { + return new ObtenerSimple(); + } + + /** + * Create an instance of {@link ObtenerDatosResponse } + * + */ + public ObtenerDatosResponse createObtenerDatosResponse() { + return new ObtenerDatosResponse(); + } + + /** + * Create an instance of {@link ObtenerCompletoResponse } + * + */ + public ObtenerCompletoResponse createObtenerCompletoResponse() { + return new ObtenerCompletoResponse(); + } + + /** + * Create an instance of {@link ObtenerDatos } + * + */ + public ObtenerDatos createObtenerDatos() { + return new ObtenerDatos(); + } + + /** + * Create an instance of {@link ObtenerCompleto } + * + */ + public ObtenerCompleto createObtenerCompleto() { + return new ObtenerCompleto(); + } + + /** + * Create an instance of {@link ObtenerSimpleResponse } + * + */ + public ObtenerSimpleResponse createObtenerSimpleResponse() { + return new ObtenerSimpleResponse(); + } + + /** + * Create an instance of {@link ContribuyenteOnLine } + * + */ + public ContribuyenteOnLine createContribuyenteOnLine() { + return new ContribuyenteOnLine(); + } + + /** + * Create an instance of {@link AgenteRetencion } + * + */ + public AgenteRetencion createAgenteRetencion() { + return new AgenteRetencion(); + } + + /** + * Create an instance of {@link EstructuraOrganizacional } + * + */ + public EstructuraOrganizacional createEstructuraOrganizacional() { + return new EstructuraOrganizacional(); + } + + /** + * Create an instance of {@link ListaBlanca } + * + */ + public ListaBlanca createListaBlanca() { + return new ListaBlanca(); + } + + /** + * Create an instance of {@link RepresentanteLegal } + * + */ + public RepresentanteLegal createRepresentanteLegal() { + return new RepresentanteLegal(); + } + + /** + * Create an instance of {@link Contribuyente } + * + */ + public Contribuyente createContribuyente() { + return new Contribuyente(); + } + + /** + * Create an instance of {@link Contador } + * + */ + public Contador createContador() { + return new Contador(); + } + + /** + * Create an instance of {@link UbicacionGeografica } + * + */ + public UbicacionGeografica createUbicacionGeografica() { + return new UbicacionGeografica(); + } + + /** + * Create an instance of {@link ContribuyenteCompleto } + * + */ + public ContribuyenteCompleto createContribuyenteCompleto() { + return new ContribuyenteCompleto(); + } + + /** + * Create an instance of {@link ActividadEconomica } + * + */ + public ActividadEconomica createActividadEconomica() { + return new ActividadEconomica(); + } + + /** + * Create an instance of {@link TipoContribuyente } + * + */ + public TipoContribuyente createTipoContribuyente() { + return new TipoContribuyente(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerSimple }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerSimple") + public JAXBElement createObtenerSimple(ObtenerSimple value) { + return new JAXBElement(_ObtenerSimple_QNAME, ObtenerSimple.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerCompletoResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerCompletoResponse") + public JAXBElement createObtenerCompletoResponse(ObtenerCompletoResponse value) { + return new JAXBElement(_ObtenerCompletoResponse_QNAME, ObtenerCompletoResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerSimpleResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerSimpleResponse") + public JAXBElement createObtenerSimpleResponse(ObtenerSimpleResponse value) { + return new JAXBElement(_ObtenerSimpleResponse_QNAME, ObtenerSimpleResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerCompleto }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerCompleto") + public JAXBElement createObtenerCompleto(ObtenerCompleto value) { + return new JAXBElement(_ObtenerCompleto_QNAME, ObtenerCompleto.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerDatos }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerDatos") + public JAXBElement createObtenerDatos(ObtenerDatos value) { + return new JAXBElement(_ObtenerDatos_QNAME, ObtenerDatos.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerDatosResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerDatosResponse") + public JAXBElement createObtenerDatosResponse(ObtenerDatosResponse value) { + return new JAXBElement(_ObtenerDatosResponse_QNAME, ObtenerDatosResponse.class, null, value); + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerCompleto.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerCompleto.java.svn-base new file mode 100644 index 0000000..bfe75e8 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerCompleto.java.svn-base @@ -0,0 +1,87 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerCompleto complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerCompleto">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="numeroRuc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fuenteDatos" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerCompleto", propOrder = { + "numeroRuc", + "fuenteDatos" +}) +public class ObtenerCompleto { + + protected String numeroRuc; + protected String fuenteDatos; + + /** + * Obtiene el valor de la propiedad numeroRuc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroRuc() { + return numeroRuc; + } + + /** + * Define el valor de la propiedad numeroRuc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroRuc(String value) { + this.numeroRuc = value; + } + + /** + * Obtiene el valor de la propiedad fuenteDatos. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFuenteDatos() { + return fuenteDatos; + } + + /** + * Define el valor de la propiedad fuenteDatos. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFuenteDatos(String value) { + this.fuenteDatos = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerCompletoResponse.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerCompletoResponse.java.svn-base new file mode 100644 index 0000000..27c12ef --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerCompletoResponse.java.svn-base @@ -0,0 +1,62 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerCompletoResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerCompletoResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://sri.gov.ec/wsConsultaContribuyente}contribuyenteCompleto" minOccurs="0" form="qualified"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerCompletoResponse", propOrder = { + "_return" +}) +public class ObtenerCompletoResponse { + + @XmlElement(name = "return") + protected ContribuyenteCompleto _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link ContribuyenteCompleto } + * + */ + public ContribuyenteCompleto getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link ContribuyenteCompleto } + * + */ + public void setReturn(ContribuyenteCompleto value) { + this._return = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerDatos.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerDatos.java.svn-base new file mode 100644 index 0000000..ba64c14 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerDatos.java.svn-base @@ -0,0 +1,60 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerDatos complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerDatos">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="numeroRuc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerDatos", propOrder = { + "numeroRuc" +}) +public class ObtenerDatos { + + protected String numeroRuc; + + /** + * Obtiene el valor de la propiedad numeroRuc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroRuc() { + return numeroRuc; + } + + /** + * Define el valor de la propiedad numeroRuc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroRuc(String value) { + this.numeroRuc = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerDatosResponse.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerDatosResponse.java.svn-base new file mode 100644 index 0000000..1cdd699 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerDatosResponse.java.svn-base @@ -0,0 +1,62 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerDatosResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerDatosResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://sri.gov.ec/wsConsultaContribuyente}contribuyenteOnLine" minOccurs="0" form="qualified"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerDatosResponse", propOrder = { + "_return" +}) +public class ObtenerDatosResponse { + + @XmlElement(name = "return") + protected ContribuyenteOnLine _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link ContribuyenteOnLine } + * + */ + public ContribuyenteOnLine getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link ContribuyenteOnLine } + * + */ + public void setReturn(ContribuyenteOnLine value) { + this._return = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerSimple.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerSimple.java.svn-base new file mode 100644 index 0000000..0b08a57 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerSimple.java.svn-base @@ -0,0 +1,87 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerSimple complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerSimple">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="numeroRuc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fuenteDatos" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerSimple", propOrder = { + "numeroRuc", + "fuenteDatos" +}) +public class ObtenerSimple { + + protected String numeroRuc; + protected String fuenteDatos; + + /** + * Obtiene el valor de la propiedad numeroRuc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroRuc() { + return numeroRuc; + } + + /** + * Define el valor de la propiedad numeroRuc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroRuc(String value) { + this.numeroRuc = value; + } + + /** + * Obtiene el valor de la propiedad fuenteDatos. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFuenteDatos() { + return fuenteDatos; + } + + /** + * Define el valor de la propiedad fuenteDatos. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFuenteDatos(String value) { + this.fuenteDatos = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerSimpleResponse.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerSimpleResponse.java.svn-base new file mode 100644 index 0000000..f9d71c1 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/ObtenerSimpleResponse.java.svn-base @@ -0,0 +1,62 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerSimpleResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerSimpleResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://sri.gov.ec/wsConsultaContribuyente}contribuyente" minOccurs="0" form="qualified"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerSimpleResponse", propOrder = { + "_return" +}) +public class ObtenerSimpleResponse { + + @XmlElement(name = "return") + protected Contribuyente _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link Contribuyente } + * + */ + public Contribuyente getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link Contribuyente } + * + */ + public void setReturn(Contribuyente value) { + this._return = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/RepresentanteLegal.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/RepresentanteLegal.java.svn-base new file mode 100644 index 0000000..16e3747 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/RepresentanteLegal.java.svn-base @@ -0,0 +1,114 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para representanteLegal complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="representanteLegal">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="cargo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="identificacion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nombre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "representanteLegal", propOrder = { + "cargo", + "identificacion", + "nombre" +}) +public class RepresentanteLegal { + + protected String cargo; + protected String identificacion; + protected String nombre; + + /** + * Obtiene el valor de la propiedad cargo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCargo() { + return cargo; + } + + /** + * Define el valor de la propiedad cargo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCargo(String value) { + this.cargo = value; + } + + /** + * Obtiene el valor de la propiedad identificacion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIdentificacion() { + return identificacion; + } + + /** + * Define el valor de la propiedad identificacion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIdentificacion(String value) { + this.identificacion = value; + } + + /** + * Obtiene el valor de la propiedad nombre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombre() { + return nombre; + } + + /** + * Define el valor de la propiedad nombre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombre(String value) { + this.nombre = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/TipoContribuyente.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/TipoContribuyente.java.svn-base new file mode 100644 index 0000000..6e99e41 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/TipoContribuyente.java.svn-base @@ -0,0 +1,195 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para tipoContribuyente complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="tipoContribuyente">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="id" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
+ *         <element name="nivel1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nivel2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nivel3" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nivel4" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="ultimoNivel" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "tipoContribuyente", propOrder = { + "id", + "nivel1", + "nivel2", + "nivel3", + "nivel4", + "ultimoNivel" +}) +public class TipoContribuyente { + + protected Long id; + protected String nivel1; + protected String nivel2; + protected String nivel3; + protected String nivel4; + protected String ultimoNivel; + + /** + * Obtiene el valor de la propiedad id. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getId() { + return id; + } + + /** + * Define el valor de la propiedad id. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setId(Long value) { + this.id = value; + } + + /** + * Obtiene el valor de la propiedad nivel1. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNivel1() { + return nivel1; + } + + /** + * Define el valor de la propiedad nivel1. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNivel1(String value) { + this.nivel1 = value; + } + + /** + * Obtiene el valor de la propiedad nivel2. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNivel2() { + return nivel2; + } + + /** + * Define el valor de la propiedad nivel2. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNivel2(String value) { + this.nivel2 = value; + } + + /** + * Obtiene el valor de la propiedad nivel3. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNivel3() { + return nivel3; + } + + /** + * Define el valor de la propiedad nivel3. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNivel3(String value) { + this.nivel3 = value; + } + + /** + * Obtiene el valor de la propiedad nivel4. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNivel4() { + return nivel4; + } + + /** + * Define el valor de la propiedad nivel4. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNivel4(String value) { + this.nivel4 = value; + } + + /** + * Obtiene el valor de la propiedad ultimoNivel. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUltimoNivel() { + return ultimoNivel; + } + + /** + * Define el valor de la propiedad ultimoNivel. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUltimoNivel(String value) { + this.ultimoNivel = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/UbicacionGeografica.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/UbicacionGeografica.java.svn-base new file mode 100644 index 0000000..a8d4e56 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/UbicacionGeografica.java.svn-base @@ -0,0 +1,303 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para ubicacionGeografica complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="ubicacionGeografica">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="canton" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codCanton" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codPais" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codParroquia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codProvincia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codRegion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="pais" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="parroquia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="provincia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="region" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ubicacionGeografica", propOrder = { + "canton", + "codCanton", + "codPais", + "codParroquia", + "codProvincia", + "codRegion", + "pais", + "parroquia", + "provincia", + "region" +}) +public class UbicacionGeografica { + + protected String canton; + protected String codCanton; + protected String codPais; + protected String codParroquia; + protected String codProvincia; + protected String codRegion; + protected String pais; + protected String parroquia; + protected String provincia; + protected String region; + + /** + * Obtiene el valor de la propiedad canton. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCanton() { + return canton; + } + + /** + * Define el valor de la propiedad canton. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCanton(String value) { + this.canton = value; + } + + /** + * Obtiene el valor de la propiedad codCanton. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodCanton() { + return codCanton; + } + + /** + * Define el valor de la propiedad codCanton. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodCanton(String value) { + this.codCanton = value; + } + + /** + * Obtiene el valor de la propiedad codPais. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodPais() { + return codPais; + } + + /** + * Define el valor de la propiedad codPais. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodPais(String value) { + this.codPais = value; + } + + /** + * Obtiene el valor de la propiedad codParroquia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodParroquia() { + return codParroquia; + } + + /** + * Define el valor de la propiedad codParroquia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodParroquia(String value) { + this.codParroquia = value; + } + + /** + * Obtiene el valor de la propiedad codProvincia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodProvincia() { + return codProvincia; + } + + /** + * Define el valor de la propiedad codProvincia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodProvincia(String value) { + this.codProvincia = value; + } + + /** + * Obtiene el valor de la propiedad codRegion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodRegion() { + return codRegion; + } + + /** + * Define el valor de la propiedad codRegion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodRegion(String value) { + this.codRegion = value; + } + + /** + * Obtiene el valor de la propiedad pais. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPais() { + return pais; + } + + /** + * Define el valor de la propiedad pais. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPais(String value) { + this.pais = value; + } + + /** + * Obtiene el valor de la propiedad parroquia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getParroquia() { + return parroquia; + } + + /** + * Define el valor de la propiedad parroquia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setParroquia(String value) { + this.parroquia = value; + } + + /** + * Obtiene el valor de la propiedad provincia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getProvincia() { + return provincia; + } + + /** + * Define el valor de la propiedad provincia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setProvincia(String value) { + this.provincia = value; + } + + /** + * Obtiene el valor de la propiedad region. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRegion() { + return region; + } + + /** + * Define el valor de la propiedad region. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRegion(String value) { + this.region = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/WebServiceContribuyenteService.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/WebServiceContribuyenteService.java.svn-base new file mode 100644 index 0000000..d1855ae --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/WebServiceContribuyenteService.java.svn-base @@ -0,0 +1,96 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import java.net.MalformedURLException; +import java.net.URL; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceException; +import javax.xml.ws.WebServiceFeature; + +import com.fp.webservices.snap.recursos.MsgSnap; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.6b21 + * Generated source version: 2.2 + * + */ +@WebServiceClient(name = "WebServiceContribuyenteService", targetNamespace = "http://sri.gov.ec/wsConsultaContribuyente", wsdlLocation = "https://bsg.gob.ec/sw/SRI/BSGSW01_Consultar_RucSRI?wsdl") +public class WebServiceContribuyenteService + extends Service +{ + + private final static URL WEBSERVICECONTRIBUYENTESERVICE_WSDL_LOCATION; + private final static WebServiceException WEBSERVICECONTRIBUYENTESERVICE_EXCEPTION; + private final static QName WEBSERVICECONTRIBUYENTESERVICE_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "WebServiceContribuyenteService"); + + static { + URL url = null; + WebServiceException e = null; + try { + url = new URL(MsgSnap.getString("url_consulta_ruc")); + } catch (MalformedURLException ex) { + e = new WebServiceException(ex); + } + WEBSERVICECONTRIBUYENTESERVICE_WSDL_LOCATION = url; + WEBSERVICECONTRIBUYENTESERVICE_EXCEPTION = e; + } + + public WebServiceContribuyenteService() { + super(__getWsdlLocation(), WEBSERVICECONTRIBUYENTESERVICE_QNAME); + } + + public WebServiceContribuyenteService(WebServiceFeature... features) { + super(__getWsdlLocation(), WEBSERVICECONTRIBUYENTESERVICE_QNAME, features); + } + + public WebServiceContribuyenteService(URL wsdlLocation) { + super(wsdlLocation, WEBSERVICECONTRIBUYENTESERVICE_QNAME); + } + + public WebServiceContribuyenteService(URL wsdlLocation, WebServiceFeature... features) { + super(wsdlLocation, WEBSERVICECONTRIBUYENTESERVICE_QNAME, features); + } + + public WebServiceContribuyenteService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public WebServiceContribuyenteService(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * + * @return + * returns WsConsultaContribuyente + */ + @WebEndpoint(name = "wsConsultaContribuyentePort") + public WsConsultaContribuyente getWsConsultaContribuyentePort() { + return super.getPort(new QName("http://sri.gov.ec/wsConsultaContribuyente", "wsConsultaContribuyentePort"), WsConsultaContribuyente.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns WsConsultaContribuyente + */ + @WebEndpoint(name = "wsConsultaContribuyentePort") + public WsConsultaContribuyente getWsConsultaContribuyentePort(WebServiceFeature... features) { + return super.getPort(new QName("http://sri.gov.ec/wsConsultaContribuyente", "wsConsultaContribuyentePort"), WsConsultaContribuyente.class, features); + } + + private static URL __getWsdlLocation() { + if (WEBSERVICECONTRIBUYENTESERVICE_EXCEPTION!= null) { + throw WEBSERVICECONTRIBUYENTESERVICE_EXCEPTION; + } + return WEBSERVICECONTRIBUYENTESERVICE_WSDL_LOCATION; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/WsConsultaContribuyente.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/WsConsultaContribuyente.java.svn-base new file mode 100644 index 0000000..196d927 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/WsConsultaContribuyente.java.svn-base @@ -0,0 +1,74 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.6b21 + * Generated source version: 2.2 + * + */ +@WebService(name = "wsConsultaContribuyente", targetNamespace = "http://sri.gov.ec/wsConsultaContribuyente") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface WsConsultaContribuyente { + + + /** + * + * @param fuenteDatos + * @param numeroRuc + * @return + * returns ec.gov.sri.wsconsultacontribuyente.Contribuyente + */ + @WebMethod + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "obtenerSimple", targetNamespace = "http://sri.gov.ec/wsConsultaContribuyente", className = "ec.gov.sri.wsconsultacontribuyente.ObtenerSimple") + @ResponseWrapper(localName = "obtenerSimpleResponse", targetNamespace = "http://sri.gov.ec/wsConsultaContribuyente", className = "ec.gov.sri.wsconsultacontribuyente.ObtenerSimpleResponse") + public Contribuyente obtenerSimple( + @WebParam(name = "numeroRuc", targetNamespace = "") + String numeroRuc, + @WebParam(name = "fuenteDatos", targetNamespace = "") + String fuenteDatos); + + /** + * + * @param fuenteDatos + * @param numeroRuc + * @return + * returns ec.gov.sri.wsconsultacontribuyente.ContribuyenteCompleto + */ + @WebMethod + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "obtenerCompleto", targetNamespace = "http://sri.gov.ec/wsConsultaContribuyente", className = "ec.gov.sri.wsconsultacontribuyente.ObtenerCompleto") + @ResponseWrapper(localName = "obtenerCompletoResponse", targetNamespace = "http://sri.gov.ec/wsConsultaContribuyente", className = "ec.gov.sri.wsconsultacontribuyente.ObtenerCompletoResponse") + public ContribuyenteCompleto obtenerCompleto( + @WebParam(name = "numeroRuc", targetNamespace = "") + String numeroRuc, + @WebParam(name = "fuenteDatos", targetNamespace = "") + String fuenteDatos); + + /** + * + * @param numeroRuc + * @return + * returns ec.gov.sri.wsconsultacontribuyente.ContribuyenteOnLine + */ + @WebMethod + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "obtenerDatos", targetNamespace = "http://sri.gov.ec/wsConsultaContribuyente", className = "ec.gov.sri.wsconsultacontribuyente.ObtenerDatos") + @ResponseWrapper(localName = "obtenerDatosResponse", targetNamespace = "http://sri.gov.ec/wsConsultaContribuyente", className = "ec.gov.sri.wsconsultacontribuyente.ObtenerDatosResponse") + public ContribuyenteOnLine obtenerDatos( + @WebParam(name = "numeroRuc", targetNamespace = "") + String numeroRuc); + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/package-info.java.svn-base b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..1a4786d --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://sri.gov.ec/wsConsultaContribuyente") +package ec.gov.sri.wsconsultacontribuyente; diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ActividadEconomica.java b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ActividadEconomica.java new file mode 100644 index 0000000..6b3197f --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ActividadEconomica.java @@ -0,0 +1,384 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para actividadEconomica complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="actividadEconomica">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="actividadGeneral" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN1Familia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN2Grupo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN3SubGrupo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN4Clase" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN5SubClase" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codN6Actividad" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n1Familia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n2Grupo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n3SubGrupo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n4Clase" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n5SubClase" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="n6Actividad" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "actividadEconomica", propOrder = { + "actividadGeneral", + "codN1Familia", + "codN2Grupo", + "codN3SubGrupo", + "codN4Clase", + "codN5SubClase", + "codN6Actividad", + "n1Familia", + "n2Grupo", + "n3SubGrupo", + "n4Clase", + "n5SubClase", + "n6Actividad" +}) +public class ActividadEconomica { + + protected String actividadGeneral; + protected String codN1Familia; + protected String codN2Grupo; + protected String codN3SubGrupo; + protected String codN4Clase; + protected String codN5SubClase; + protected String codN6Actividad; + protected String n1Familia; + protected String n2Grupo; + protected String n3SubGrupo; + protected String n4Clase; + protected String n5SubClase; + protected String n6Actividad; + + /** + * Obtiene el valor de la propiedad actividadGeneral. + * + * @return + * possible object is + * {@link String } + * + */ + public String getActividadGeneral() { + return actividadGeneral; + } + + /** + * Define el valor de la propiedad actividadGeneral. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setActividadGeneral(String value) { + this.actividadGeneral = value; + } + + /** + * Obtiene el valor de la propiedad codN1Familia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN1Familia() { + return codN1Familia; + } + + /** + * Define el valor de la propiedad codN1Familia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN1Familia(String value) { + this.codN1Familia = value; + } + + /** + * Obtiene el valor de la propiedad codN2Grupo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN2Grupo() { + return codN2Grupo; + } + + /** + * Define el valor de la propiedad codN2Grupo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN2Grupo(String value) { + this.codN2Grupo = value; + } + + /** + * Obtiene el valor de la propiedad codN3SubGrupo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN3SubGrupo() { + return codN3SubGrupo; + } + + /** + * Define el valor de la propiedad codN3SubGrupo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN3SubGrupo(String value) { + this.codN3SubGrupo = value; + } + + /** + * Obtiene el valor de la propiedad codN4Clase. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN4Clase() { + return codN4Clase; + } + + /** + * Define el valor de la propiedad codN4Clase. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN4Clase(String value) { + this.codN4Clase = value; + } + + /** + * Obtiene el valor de la propiedad codN5SubClase. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN5SubClase() { + return codN5SubClase; + } + + /** + * Define el valor de la propiedad codN5SubClase. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN5SubClase(String value) { + this.codN5SubClase = value; + } + + /** + * Obtiene el valor de la propiedad codN6Actividad. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodN6Actividad() { + return codN6Actividad; + } + + /** + * Define el valor de la propiedad codN6Actividad. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodN6Actividad(String value) { + this.codN6Actividad = value; + } + + /** + * Obtiene el valor de la propiedad n1Familia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN1Familia() { + return n1Familia; + } + + /** + * Define el valor de la propiedad n1Familia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN1Familia(String value) { + this.n1Familia = value; + } + + /** + * Obtiene el valor de la propiedad n2Grupo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN2Grupo() { + return n2Grupo; + } + + /** + * Define el valor de la propiedad n2Grupo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN2Grupo(String value) { + this.n2Grupo = value; + } + + /** + * Obtiene el valor de la propiedad n3SubGrupo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN3SubGrupo() { + return n3SubGrupo; + } + + /** + * Define el valor de la propiedad n3SubGrupo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN3SubGrupo(String value) { + this.n3SubGrupo = value; + } + + /** + * Obtiene el valor de la propiedad n4Clase. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN4Clase() { + return n4Clase; + } + + /** + * Define el valor de la propiedad n4Clase. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN4Clase(String value) { + this.n4Clase = value; + } + + /** + * Obtiene el valor de la propiedad n5SubClase. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN5SubClase() { + return n5SubClase; + } + + /** + * Define el valor de la propiedad n5SubClase. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN5SubClase(String value) { + this.n5SubClase = value; + } + + /** + * Obtiene el valor de la propiedad n6Actividad. + * + * @return + * possible object is + * {@link String } + * + */ + public String getN6Actividad() { + return n6Actividad; + } + + /** + * Define el valor de la propiedad n6Actividad. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setN6Actividad(String value) { + this.n6Actividad = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/AgenteRetencion.java b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/AgenteRetencion.java new file mode 100644 index 0000000..1378a8c --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/AgenteRetencion.java @@ -0,0 +1,60 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para agenteRetencion complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="agenteRetencion">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="nombre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "agenteRetencion", propOrder = { + "nombre" +}) +public class AgenteRetencion { + + protected String nombre; + + /** + * Obtiene el valor de la propiedad nombre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombre() { + return nombre; + } + + /** + * Define el valor de la propiedad nombre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombre(String value) { + this.nombre = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/Contador.java b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/Contador.java new file mode 100644 index 0000000..8c4dfe4 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/Contador.java @@ -0,0 +1,114 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para contador complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="contador">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="cedula" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nombre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="ruc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "contador", propOrder = { + "cedula", + "nombre", + "ruc" +}) +public class Contador { + + protected String cedula; + protected String nombre; + protected String ruc; + + /** + * Obtiene el valor de la propiedad cedula. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCedula() { + return cedula; + } + + /** + * Define el valor de la propiedad cedula. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCedula(String value) { + this.cedula = value; + } + + /** + * Obtiene el valor de la propiedad nombre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombre() { + return nombre; + } + + /** + * Define el valor de la propiedad nombre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombre(String value) { + this.nombre = value; + } + + /** + * Obtiene el valor de la propiedad ruc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRuc() { + return ruc; + } + + /** + * Define el valor de la propiedad ruc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRuc(String value) { + this.ruc = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/Contribuyente.java b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/Contribuyente.java new file mode 100644 index 0000000..a31f64c --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/Contribuyente.java @@ -0,0 +1,416 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para contribuyente complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="contribuyente">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="actividadEconomica" type="{http://sri.gov.ec/wsConsultaContribuyente}actividadEconomica" minOccurs="0"/>
+ *         <element name="codClaseContrib" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codEstado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="desClaseContrib" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="desEstado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="direccionCorta" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="email" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nombreComercial" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="numeroRuc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="razonSocial" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="telefonoDomicilio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="telefonoTrabajo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="tipoContribuyente" type="{http://sri.gov.ec/wsConsultaContribuyente}tipoContribuyente" minOccurs="0"/>
+ *         <element name="ubicacionGeografica" type="{http://sri.gov.ec/wsConsultaContribuyente}ubicacionGeografica" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "contribuyente", propOrder = { + "actividadEconomica", + "codClaseContrib", + "codEstado", + "desClaseContrib", + "desEstado", + "direccionCorta", + "email", + "nombreComercial", + "numeroRuc", + "razonSocial", + "telefonoDomicilio", + "telefonoTrabajo", + "tipoContribuyente", + "ubicacionGeografica" +}) +@XmlSeeAlso({ + ContribuyenteOnLine.class, + ContribuyenteCompleto.class +}) +public class Contribuyente { + + protected ActividadEconomica actividadEconomica; + protected String codClaseContrib; + protected String codEstado; + protected String desClaseContrib; + protected String desEstado; + protected String direccionCorta; + protected String email; + protected String nombreComercial; + protected String numeroRuc; + protected String razonSocial; + protected String telefonoDomicilio; + protected String telefonoTrabajo; + protected TipoContribuyente tipoContribuyente; + protected UbicacionGeografica ubicacionGeografica; + + /** + * Obtiene el valor de la propiedad actividadEconomica. + * + * @return + * possible object is + * {@link ActividadEconomica } + * + */ + public ActividadEconomica getActividadEconomica() { + return actividadEconomica; + } + + /** + * Define el valor de la propiedad actividadEconomica. + * + * @param value + * allowed object is + * {@link ActividadEconomica } + * + */ + public void setActividadEconomica(ActividadEconomica value) { + this.actividadEconomica = value; + } + + /** + * Obtiene el valor de la propiedad codClaseContrib. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodClaseContrib() { + return codClaseContrib; + } + + /** + * Define el valor de la propiedad codClaseContrib. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodClaseContrib(String value) { + this.codClaseContrib = value; + } + + /** + * Obtiene el valor de la propiedad codEstado. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodEstado() { + return codEstado; + } + + /** + * Define el valor de la propiedad codEstado. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodEstado(String value) { + this.codEstado = value; + } + + /** + * Obtiene el valor de la propiedad desClaseContrib. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDesClaseContrib() { + return desClaseContrib; + } + + /** + * Define el valor de la propiedad desClaseContrib. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDesClaseContrib(String value) { + this.desClaseContrib = value; + } + + /** + * Obtiene el valor de la propiedad desEstado. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDesEstado() { + return desEstado; + } + + /** + * Define el valor de la propiedad desEstado. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDesEstado(String value) { + this.desEstado = value; + } + + /** + * Obtiene el valor de la propiedad direccionCorta. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDireccionCorta() { + return direccionCorta; + } + + /** + * Define el valor de la propiedad direccionCorta. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDireccionCorta(String value) { + this.direccionCorta = value; + } + + /** + * Obtiene el valor de la propiedad email. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEmail() { + return email; + } + + /** + * Define el valor de la propiedad email. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEmail(String value) { + this.email = value; + } + + /** + * Obtiene el valor de la propiedad nombreComercial. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombreComercial() { + return nombreComercial; + } + + /** + * Define el valor de la propiedad nombreComercial. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombreComercial(String value) { + this.nombreComercial = value; + } + + /** + * Obtiene el valor de la propiedad numeroRuc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroRuc() { + return numeroRuc; + } + + /** + * Define el valor de la propiedad numeroRuc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroRuc(String value) { + this.numeroRuc = value; + } + + /** + * Obtiene el valor de la propiedad razonSocial. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRazonSocial() { + return razonSocial; + } + + /** + * Define el valor de la propiedad razonSocial. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRazonSocial(String value) { + this.razonSocial = value; + } + + /** + * Obtiene el valor de la propiedad telefonoDomicilio. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTelefonoDomicilio() { + return telefonoDomicilio; + } + + /** + * Define el valor de la propiedad telefonoDomicilio. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTelefonoDomicilio(String value) { + this.telefonoDomicilio = value; + } + + /** + * Obtiene el valor de la propiedad telefonoTrabajo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTelefonoTrabajo() { + return telefonoTrabajo; + } + + /** + * Define el valor de la propiedad telefonoTrabajo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTelefonoTrabajo(String value) { + this.telefonoTrabajo = value; + } + + /** + * Obtiene el valor de la propiedad tipoContribuyente. + * + * @return + * possible object is + * {@link TipoContribuyente } + * + */ + public TipoContribuyente getTipoContribuyente() { + return tipoContribuyente; + } + + /** + * Define el valor de la propiedad tipoContribuyente. + * + * @param value + * allowed object is + * {@link TipoContribuyente } + * + */ + public void setTipoContribuyente(TipoContribuyente value) { + this.tipoContribuyente = value; + } + + /** + * Obtiene el valor de la propiedad ubicacionGeografica. + * + * @return + * possible object is + * {@link UbicacionGeografica } + * + */ + public UbicacionGeografica getUbicacionGeografica() { + return ubicacionGeografica; + } + + /** + * Define el valor de la propiedad ubicacionGeografica. + * + * @param value + * allowed object is + * {@link UbicacionGeografica } + * + */ + public void setUbicacionGeografica(UbicacionGeografica value) { + this.ubicacionGeografica = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ContribuyenteCompleto.java b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ContribuyenteCompleto.java new file mode 100644 index 0000000..82a0b62 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ContribuyenteCompleto.java @@ -0,0 +1,575 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para contribuyenteCompleto complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="contribuyenteCompleto">
+ *   <complexContent>
+ *     <extension base="{http://sri.gov.ec/wsConsultaContribuyente}contribuyente">
+ *       <sequence>
+ *         <element name="agenteRetencion" type="{http://sri.gov.ec/wsConsultaContribuyente}agenteRetencion" minOccurs="0"/>
+ *         <element name="calificacionArtesanal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="contador" type="{http://sri.gov.ec/wsConsultaContribuyente}contador" minOccurs="0"/>
+ *         <element name="direccionLarga" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="estructuraOrganizacional" type="{http://sri.gov.ec/wsConsultaContribuyente}estructuraOrganizacional" minOccurs="0"/>
+ *         <element name="fax" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaAltaParaEspecial" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaCalificacionArtesanal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaCambioObligado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaInicioActividades" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaNacimiento" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaNotificacionEspeciales" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaUltimaDeclaracion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="listaBlanca" type="{http://sri.gov.ec/wsConsultaContribuyente}listaBlanca" minOccurs="0"/>
+ *         <element name="numeroCalificacionArtesanal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="obligadoContabilidad" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="representanteLegal" type="{http://sri.gov.ec/wsConsultaContribuyente}representanteLegal" minOccurs="0"/>
+ *         <element name="resolucionAltaParaEspecial" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="tipoCalificacionArtesanal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="ultimoPeriodoFiscalCumplido" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "contribuyenteCompleto", propOrder = { + "agenteRetencion", + "calificacionArtesanal", + "contador", + "direccionLarga", + "estructuraOrganizacional", + "fax", + "fechaAltaParaEspecial", + "fechaCalificacionArtesanal", + "fechaCambioObligado", + "fechaInicioActividades", + "fechaNacimiento", + "fechaNotificacionEspeciales", + "fechaUltimaDeclaracion", + "listaBlanca", + "numeroCalificacionArtesanal", + "obligadoContabilidad", + "representanteLegal", + "resolucionAltaParaEspecial", + "tipoCalificacionArtesanal", + "ultimoPeriodoFiscalCumplido" +}) +public class ContribuyenteCompleto + extends Contribuyente +{ + + protected AgenteRetencion agenteRetencion; + protected String calificacionArtesanal; + protected Contador contador; + protected String direccionLarga; + protected EstructuraOrganizacional estructuraOrganizacional; + protected String fax; + protected String fechaAltaParaEspecial; + protected String fechaCalificacionArtesanal; + protected String fechaCambioObligado; + protected String fechaInicioActividades; + protected String fechaNacimiento; + protected String fechaNotificacionEspeciales; + protected String fechaUltimaDeclaracion; + protected ListaBlanca listaBlanca; + protected String numeroCalificacionArtesanal; + protected String obligadoContabilidad; + protected RepresentanteLegal representanteLegal; + protected String resolucionAltaParaEspecial; + protected String tipoCalificacionArtesanal; + protected String ultimoPeriodoFiscalCumplido; + + /** + * Obtiene el valor de la propiedad agenteRetencion. + * + * @return + * possible object is + * {@link AgenteRetencion } + * + */ + public AgenteRetencion getAgenteRetencion() { + return agenteRetencion; + } + + /** + * Define el valor de la propiedad agenteRetencion. + * + * @param value + * allowed object is + * {@link AgenteRetencion } + * + */ + public void setAgenteRetencion(AgenteRetencion value) { + this.agenteRetencion = value; + } + + /** + * Obtiene el valor de la propiedad calificacionArtesanal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCalificacionArtesanal() { + return calificacionArtesanal; + } + + /** + * Define el valor de la propiedad calificacionArtesanal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCalificacionArtesanal(String value) { + this.calificacionArtesanal = value; + } + + /** + * Obtiene el valor de la propiedad contador. + * + * @return + * possible object is + * {@link Contador } + * + */ + public Contador getContador() { + return contador; + } + + /** + * Define el valor de la propiedad contador. + * + * @param value + * allowed object is + * {@link Contador } + * + */ + public void setContador(Contador value) { + this.contador = value; + } + + /** + * Obtiene el valor de la propiedad direccionLarga. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDireccionLarga() { + return direccionLarga; + } + + /** + * Define el valor de la propiedad direccionLarga. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDireccionLarga(String value) { + this.direccionLarga = value; + } + + /** + * Obtiene el valor de la propiedad estructuraOrganizacional. + * + * @return + * possible object is + * {@link EstructuraOrganizacional } + * + */ + public EstructuraOrganizacional getEstructuraOrganizacional() { + return estructuraOrganizacional; + } + + /** + * Define el valor de la propiedad estructuraOrganizacional. + * + * @param value + * allowed object is + * {@link EstructuraOrganizacional } + * + */ + public void setEstructuraOrganizacional(EstructuraOrganizacional value) { + this.estructuraOrganizacional = value; + } + + /** + * Obtiene el valor de la propiedad fax. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFax() { + return fax; + } + + /** + * Define el valor de la propiedad fax. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFax(String value) { + this.fax = value; + } + + /** + * Obtiene el valor de la propiedad fechaAltaParaEspecial. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaAltaParaEspecial() { + return fechaAltaParaEspecial; + } + + /** + * Define el valor de la propiedad fechaAltaParaEspecial. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaAltaParaEspecial(String value) { + this.fechaAltaParaEspecial = value; + } + + /** + * Obtiene el valor de la propiedad fechaCalificacionArtesanal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaCalificacionArtesanal() { + return fechaCalificacionArtesanal; + } + + /** + * Define el valor de la propiedad fechaCalificacionArtesanal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaCalificacionArtesanal(String value) { + this.fechaCalificacionArtesanal = value; + } + + /** + * Obtiene el valor de la propiedad fechaCambioObligado. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaCambioObligado() { + return fechaCambioObligado; + } + + /** + * Define el valor de la propiedad fechaCambioObligado. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaCambioObligado(String value) { + this.fechaCambioObligado = value; + } + + /** + * Obtiene el valor de la propiedad fechaInicioActividades. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaInicioActividades() { + return fechaInicioActividades; + } + + /** + * Define el valor de la propiedad fechaInicioActividades. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaInicioActividades(String value) { + this.fechaInicioActividades = value; + } + + /** + * Obtiene el valor de la propiedad fechaNacimiento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaNacimiento() { + return fechaNacimiento; + } + + /** + * Define el valor de la propiedad fechaNacimiento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaNacimiento(String value) { + this.fechaNacimiento = value; + } + + /** + * Obtiene el valor de la propiedad fechaNotificacionEspeciales. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaNotificacionEspeciales() { + return fechaNotificacionEspeciales; + } + + /** + * Define el valor de la propiedad fechaNotificacionEspeciales. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaNotificacionEspeciales(String value) { + this.fechaNotificacionEspeciales = value; + } + + /** + * Obtiene el valor de la propiedad fechaUltimaDeclaracion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaUltimaDeclaracion() { + return fechaUltimaDeclaracion; + } + + /** + * Define el valor de la propiedad fechaUltimaDeclaracion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaUltimaDeclaracion(String value) { + this.fechaUltimaDeclaracion = value; + } + + /** + * Obtiene el valor de la propiedad listaBlanca. + * + * @return + * possible object is + * {@link ListaBlanca } + * + */ + public ListaBlanca getListaBlanca() { + return listaBlanca; + } + + /** + * Define el valor de la propiedad listaBlanca. + * + * @param value + * allowed object is + * {@link ListaBlanca } + * + */ + public void setListaBlanca(ListaBlanca value) { + this.listaBlanca = value; + } + + /** + * Obtiene el valor de la propiedad numeroCalificacionArtesanal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroCalificacionArtesanal() { + return numeroCalificacionArtesanal; + } + + /** + * Define el valor de la propiedad numeroCalificacionArtesanal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroCalificacionArtesanal(String value) { + this.numeroCalificacionArtesanal = value; + } + + /** + * Obtiene el valor de la propiedad obligadoContabilidad. + * + * @return + * possible object is + * {@link String } + * + */ + public String getObligadoContabilidad() { + return obligadoContabilidad; + } + + /** + * Define el valor de la propiedad obligadoContabilidad. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setObligadoContabilidad(String value) { + this.obligadoContabilidad = value; + } + + /** + * Obtiene el valor de la propiedad representanteLegal. + * + * @return + * possible object is + * {@link RepresentanteLegal } + * + */ + public RepresentanteLegal getRepresentanteLegal() { + return representanteLegal; + } + + /** + * Define el valor de la propiedad representanteLegal. + * + * @param value + * allowed object is + * {@link RepresentanteLegal } + * + */ + public void setRepresentanteLegal(RepresentanteLegal value) { + this.representanteLegal = value; + } + + /** + * Obtiene el valor de la propiedad resolucionAltaParaEspecial. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResolucionAltaParaEspecial() { + return resolucionAltaParaEspecial; + } + + /** + * Define el valor de la propiedad resolucionAltaParaEspecial. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResolucionAltaParaEspecial(String value) { + this.resolucionAltaParaEspecial = value; + } + + /** + * Obtiene el valor de la propiedad tipoCalificacionArtesanal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTipoCalificacionArtesanal() { + return tipoCalificacionArtesanal; + } + + /** + * Define el valor de la propiedad tipoCalificacionArtesanal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTipoCalificacionArtesanal(String value) { + this.tipoCalificacionArtesanal = value; + } + + /** + * Obtiene el valor de la propiedad ultimoPeriodoFiscalCumplido. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUltimoPeriodoFiscalCumplido() { + return ultimoPeriodoFiscalCumplido; + } + + /** + * Define el valor de la propiedad ultimoPeriodoFiscalCumplido. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUltimoPeriodoFiscalCumplido(String value) { + this.ultimoPeriodoFiscalCumplido = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ContribuyenteOnLine.java b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ContribuyenteOnLine.java new file mode 100644 index 0000000..080ef38 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ContribuyenteOnLine.java @@ -0,0 +1,332 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para contribuyenteOnLine complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="contribuyenteOnLine">
+ *   <complexContent>
+ *     <extension base="{http://sri.gov.ec/wsConsultaContribuyente}contribuyente">
+ *       <sequence>
+ *         <element name="actEcoPrin" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="activEstablec" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codActEcoPrin" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="desUbicaGeograf" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="descTipoContri" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fechaIniAct" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="idRepreLegal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nombreRepreLegal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="telefonos" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="tipoContri" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="ubicaGeograf" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "contribuyenteOnLine", propOrder = { + "actEcoPrin", + "activEstablec", + "codActEcoPrin", + "desUbicaGeograf", + "descTipoContri", + "fechaIniAct", + "idRepreLegal", + "nombreRepreLegal", + "telefonos", + "tipoContri", + "ubicaGeograf" +}) +public class ContribuyenteOnLine + extends Contribuyente +{ + + protected String actEcoPrin; + protected String activEstablec; + protected String codActEcoPrin; + protected String desUbicaGeograf; + protected String descTipoContri; + protected String fechaIniAct; + protected String idRepreLegal; + protected String nombreRepreLegal; + protected String telefonos; + protected String tipoContri; + protected String ubicaGeograf; + + /** + * Obtiene el valor de la propiedad actEcoPrin. + * + * @return + * possible object is + * {@link String } + * + */ + public String getActEcoPrin() { + return actEcoPrin; + } + + /** + * Define el valor de la propiedad actEcoPrin. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setActEcoPrin(String value) { + this.actEcoPrin = value; + } + + /** + * Obtiene el valor de la propiedad activEstablec. + * + * @return + * possible object is + * {@link String } + * + */ + public String getActivEstablec() { + return activEstablec; + } + + /** + * Define el valor de la propiedad activEstablec. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setActivEstablec(String value) { + this.activEstablec = value; + } + + /** + * Obtiene el valor de la propiedad codActEcoPrin. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodActEcoPrin() { + return codActEcoPrin; + } + + /** + * Define el valor de la propiedad codActEcoPrin. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodActEcoPrin(String value) { + this.codActEcoPrin = value; + } + + /** + * Obtiene el valor de la propiedad desUbicaGeograf. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDesUbicaGeograf() { + return desUbicaGeograf; + } + + /** + * Define el valor de la propiedad desUbicaGeograf. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDesUbicaGeograf(String value) { + this.desUbicaGeograf = value; + } + + /** + * Obtiene el valor de la propiedad descTipoContri. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDescTipoContri() { + return descTipoContri; + } + + /** + * Define el valor de la propiedad descTipoContri. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDescTipoContri(String value) { + this.descTipoContri = value; + } + + /** + * Obtiene el valor de la propiedad fechaIniAct. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFechaIniAct() { + return fechaIniAct; + } + + /** + * Define el valor de la propiedad fechaIniAct. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFechaIniAct(String value) { + this.fechaIniAct = value; + } + + /** + * Obtiene el valor de la propiedad idRepreLegal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIdRepreLegal() { + return idRepreLegal; + } + + /** + * Define el valor de la propiedad idRepreLegal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIdRepreLegal(String value) { + this.idRepreLegal = value; + } + + /** + * Obtiene el valor de la propiedad nombreRepreLegal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombreRepreLegal() { + return nombreRepreLegal; + } + + /** + * Define el valor de la propiedad nombreRepreLegal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombreRepreLegal(String value) { + this.nombreRepreLegal = value; + } + + /** + * Obtiene el valor de la propiedad telefonos. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTelefonos() { + return telefonos; + } + + /** + * Define el valor de la propiedad telefonos. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTelefonos(String value) { + this.telefonos = value; + } + + /** + * Obtiene el valor de la propiedad tipoContri. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTipoContri() { + return tipoContri; + } + + /** + * Define el valor de la propiedad tipoContri. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTipoContri(String value) { + this.tipoContri = value; + } + + /** + * Obtiene el valor de la propiedad ubicaGeograf. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUbicaGeograf() { + return ubicaGeograf; + } + + /** + * Define el valor de la propiedad ubicaGeograf. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUbicaGeograf(String value) { + this.ubicaGeograf = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/EstructuraOrganizacional.java b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/EstructuraOrganizacional.java new file mode 100644 index 0000000..c175fee --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/EstructuraOrganizacional.java @@ -0,0 +1,160 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para estructuraOrganizacional complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="estructuraOrganizacional">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="codigoProvincia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codigoRegional" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="id" type="{http://www.w3.org/2001/XMLSchema}long"/>
+ *         <element name="nombreProvincia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nombreRegional" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "estructuraOrganizacional", propOrder = { + "codigoProvincia", + "codigoRegional", + "id", + "nombreProvincia", + "nombreRegional" +}) +public class EstructuraOrganizacional { + + protected String codigoProvincia; + protected String codigoRegional; + protected long id; + protected String nombreProvincia; + protected String nombreRegional; + + /** + * Obtiene el valor de la propiedad codigoProvincia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodigoProvincia() { + return codigoProvincia; + } + + /** + * Define el valor de la propiedad codigoProvincia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodigoProvincia(String value) { + this.codigoProvincia = value; + } + + /** + * Obtiene el valor de la propiedad codigoRegional. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodigoRegional() { + return codigoRegional; + } + + /** + * Define el valor de la propiedad codigoRegional. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodigoRegional(String value) { + this.codigoRegional = value; + } + + /** + * Obtiene el valor de la propiedad id. + * + */ + public long getId() { + return id; + } + + /** + * Define el valor de la propiedad id. + * + */ + public void setId(long value) { + this.id = value; + } + + /** + * Obtiene el valor de la propiedad nombreProvincia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombreProvincia() { + return nombreProvincia; + } + + /** + * Define el valor de la propiedad nombreProvincia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombreProvincia(String value) { + this.nombreProvincia = value; + } + + /** + * Obtiene el valor de la propiedad nombreRegional. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombreRegional() { + return nombreRegional; + } + + /** + * Define el valor de la propiedad nombreRegional. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombreRegional(String value) { + this.nombreRegional = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ListaBlanca.java b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ListaBlanca.java new file mode 100644 index 0000000..91b3c90 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ListaBlanca.java @@ -0,0 +1,60 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para listaBlanca complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="listaBlanca">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="estado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "listaBlanca", propOrder = { + "estado" +}) +public class ListaBlanca { + + protected String estado; + + /** + * Obtiene el valor de la propiedad estado. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEstado() { + return estado; + } + + /** + * Define el valor de la propiedad estado. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEstado(String value) { + this.estado = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObjectFactory.java b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObjectFactory.java new file mode 100644 index 0000000..51c2a79 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObjectFactory.java @@ -0,0 +1,231 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the ec.gov.sri.wsconsultacontribuyente package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _ObtenerSimple_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerSimple"); + private final static QName _ObtenerCompletoResponse_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerCompletoResponse"); + private final static QName _ObtenerSimpleResponse_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerSimpleResponse"); + private final static QName _ObtenerCompleto_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerCompleto"); + private final static QName _ObtenerDatos_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerDatos"); + private final static QName _ObtenerDatosResponse_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "obtenerDatosResponse"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: ec.gov.sri.wsconsultacontribuyente + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link ObtenerSimple } + * + */ + public ObtenerSimple createObtenerSimple() { + return new ObtenerSimple(); + } + + /** + * Create an instance of {@link ObtenerDatosResponse } + * + */ + public ObtenerDatosResponse createObtenerDatosResponse() { + return new ObtenerDatosResponse(); + } + + /** + * Create an instance of {@link ObtenerCompletoResponse } + * + */ + public ObtenerCompletoResponse createObtenerCompletoResponse() { + return new ObtenerCompletoResponse(); + } + + /** + * Create an instance of {@link ObtenerDatos } + * + */ + public ObtenerDatos createObtenerDatos() { + return new ObtenerDatos(); + } + + /** + * Create an instance of {@link ObtenerCompleto } + * + */ + public ObtenerCompleto createObtenerCompleto() { + return new ObtenerCompleto(); + } + + /** + * Create an instance of {@link ObtenerSimpleResponse } + * + */ + public ObtenerSimpleResponse createObtenerSimpleResponse() { + return new ObtenerSimpleResponse(); + } + + /** + * Create an instance of {@link ContribuyenteOnLine } + * + */ + public ContribuyenteOnLine createContribuyenteOnLine() { + return new ContribuyenteOnLine(); + } + + /** + * Create an instance of {@link AgenteRetencion } + * + */ + public AgenteRetencion createAgenteRetencion() { + return new AgenteRetencion(); + } + + /** + * Create an instance of {@link EstructuraOrganizacional } + * + */ + public EstructuraOrganizacional createEstructuraOrganizacional() { + return new EstructuraOrganizacional(); + } + + /** + * Create an instance of {@link ListaBlanca } + * + */ + public ListaBlanca createListaBlanca() { + return new ListaBlanca(); + } + + /** + * Create an instance of {@link RepresentanteLegal } + * + */ + public RepresentanteLegal createRepresentanteLegal() { + return new RepresentanteLegal(); + } + + /** + * Create an instance of {@link Contribuyente } + * + */ + public Contribuyente createContribuyente() { + return new Contribuyente(); + } + + /** + * Create an instance of {@link Contador } + * + */ + public Contador createContador() { + return new Contador(); + } + + /** + * Create an instance of {@link UbicacionGeografica } + * + */ + public UbicacionGeografica createUbicacionGeografica() { + return new UbicacionGeografica(); + } + + /** + * Create an instance of {@link ContribuyenteCompleto } + * + */ + public ContribuyenteCompleto createContribuyenteCompleto() { + return new ContribuyenteCompleto(); + } + + /** + * Create an instance of {@link ActividadEconomica } + * + */ + public ActividadEconomica createActividadEconomica() { + return new ActividadEconomica(); + } + + /** + * Create an instance of {@link TipoContribuyente } + * + */ + public TipoContribuyente createTipoContribuyente() { + return new TipoContribuyente(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerSimple }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerSimple") + public JAXBElement createObtenerSimple(ObtenerSimple value) { + return new JAXBElement(_ObtenerSimple_QNAME, ObtenerSimple.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerCompletoResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerCompletoResponse") + public JAXBElement createObtenerCompletoResponse(ObtenerCompletoResponse value) { + return new JAXBElement(_ObtenerCompletoResponse_QNAME, ObtenerCompletoResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerSimpleResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerSimpleResponse") + public JAXBElement createObtenerSimpleResponse(ObtenerSimpleResponse value) { + return new JAXBElement(_ObtenerSimpleResponse_QNAME, ObtenerSimpleResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerCompleto }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerCompleto") + public JAXBElement createObtenerCompleto(ObtenerCompleto value) { + return new JAXBElement(_ObtenerCompleto_QNAME, ObtenerCompleto.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerDatos }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerDatos") + public JAXBElement createObtenerDatos(ObtenerDatos value) { + return new JAXBElement(_ObtenerDatos_QNAME, ObtenerDatos.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ObtenerDatosResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://sri.gov.ec/wsConsultaContribuyente", name = "obtenerDatosResponse") + public JAXBElement createObtenerDatosResponse(ObtenerDatosResponse value) { + return new JAXBElement(_ObtenerDatosResponse_QNAME, ObtenerDatosResponse.class, null, value); + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerCompleto.java b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerCompleto.java new file mode 100644 index 0000000..bfe75e8 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerCompleto.java @@ -0,0 +1,87 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerCompleto complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerCompleto">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="numeroRuc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fuenteDatos" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerCompleto", propOrder = { + "numeroRuc", + "fuenteDatos" +}) +public class ObtenerCompleto { + + protected String numeroRuc; + protected String fuenteDatos; + + /** + * Obtiene el valor de la propiedad numeroRuc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroRuc() { + return numeroRuc; + } + + /** + * Define el valor de la propiedad numeroRuc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroRuc(String value) { + this.numeroRuc = value; + } + + /** + * Obtiene el valor de la propiedad fuenteDatos. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFuenteDatos() { + return fuenteDatos; + } + + /** + * Define el valor de la propiedad fuenteDatos. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFuenteDatos(String value) { + this.fuenteDatos = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerCompletoResponse.java b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerCompletoResponse.java new file mode 100644 index 0000000..27c12ef --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerCompletoResponse.java @@ -0,0 +1,62 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerCompletoResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerCompletoResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://sri.gov.ec/wsConsultaContribuyente}contribuyenteCompleto" minOccurs="0" form="qualified"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerCompletoResponse", propOrder = { + "_return" +}) +public class ObtenerCompletoResponse { + + @XmlElement(name = "return") + protected ContribuyenteCompleto _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link ContribuyenteCompleto } + * + */ + public ContribuyenteCompleto getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link ContribuyenteCompleto } + * + */ + public void setReturn(ContribuyenteCompleto value) { + this._return = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerDatos.java b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerDatos.java new file mode 100644 index 0000000..ba64c14 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerDatos.java @@ -0,0 +1,60 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerDatos complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerDatos">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="numeroRuc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerDatos", propOrder = { + "numeroRuc" +}) +public class ObtenerDatos { + + protected String numeroRuc; + + /** + * Obtiene el valor de la propiedad numeroRuc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroRuc() { + return numeroRuc; + } + + /** + * Define el valor de la propiedad numeroRuc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroRuc(String value) { + this.numeroRuc = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerDatosResponse.java b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerDatosResponse.java new file mode 100644 index 0000000..1cdd699 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerDatosResponse.java @@ -0,0 +1,62 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerDatosResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerDatosResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://sri.gov.ec/wsConsultaContribuyente}contribuyenteOnLine" minOccurs="0" form="qualified"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerDatosResponse", propOrder = { + "_return" +}) +public class ObtenerDatosResponse { + + @XmlElement(name = "return") + protected ContribuyenteOnLine _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link ContribuyenteOnLine } + * + */ + public ContribuyenteOnLine getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link ContribuyenteOnLine } + * + */ + public void setReturn(ContribuyenteOnLine value) { + this._return = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerSimple.java b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerSimple.java new file mode 100644 index 0000000..0b08a57 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerSimple.java @@ -0,0 +1,87 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerSimple complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerSimple">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="numeroRuc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fuenteDatos" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerSimple", propOrder = { + "numeroRuc", + "fuenteDatos" +}) +public class ObtenerSimple { + + protected String numeroRuc; + protected String fuenteDatos; + + /** + * Obtiene el valor de la propiedad numeroRuc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroRuc() { + return numeroRuc; + } + + /** + * Define el valor de la propiedad numeroRuc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroRuc(String value) { + this.numeroRuc = value; + } + + /** + * Obtiene el valor de la propiedad fuenteDatos. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFuenteDatos() { + return fuenteDatos; + } + + /** + * Define el valor de la propiedad fuenteDatos. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFuenteDatos(String value) { + this.fuenteDatos = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerSimpleResponse.java b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerSimpleResponse.java new file mode 100644 index 0000000..f9d71c1 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/ObtenerSimpleResponse.java @@ -0,0 +1,62 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para obtenerSimpleResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="obtenerSimpleResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://sri.gov.ec/wsConsultaContribuyente}contribuyente" minOccurs="0" form="qualified"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "obtenerSimpleResponse", propOrder = { + "_return" +}) +public class ObtenerSimpleResponse { + + @XmlElement(name = "return") + protected Contribuyente _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link Contribuyente } + * + */ + public Contribuyente getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link Contribuyente } + * + */ + public void setReturn(Contribuyente value) { + this._return = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/RepresentanteLegal.java b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/RepresentanteLegal.java new file mode 100644 index 0000000..16e3747 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/RepresentanteLegal.java @@ -0,0 +1,114 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para representanteLegal complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="representanteLegal">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="cargo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="identificacion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nombre" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "representanteLegal", propOrder = { + "cargo", + "identificacion", + "nombre" +}) +public class RepresentanteLegal { + + protected String cargo; + protected String identificacion; + protected String nombre; + + /** + * Obtiene el valor de la propiedad cargo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCargo() { + return cargo; + } + + /** + * Define el valor de la propiedad cargo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCargo(String value) { + this.cargo = value; + } + + /** + * Obtiene el valor de la propiedad identificacion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIdentificacion() { + return identificacion; + } + + /** + * Define el valor de la propiedad identificacion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIdentificacion(String value) { + this.identificacion = value; + } + + /** + * Obtiene el valor de la propiedad nombre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNombre() { + return nombre; + } + + /** + * Define el valor de la propiedad nombre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNombre(String value) { + this.nombre = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/TipoContribuyente.java b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/TipoContribuyente.java new file mode 100644 index 0000000..6e99e41 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/TipoContribuyente.java @@ -0,0 +1,195 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para tipoContribuyente complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="tipoContribuyente">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="id" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
+ *         <element name="nivel1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nivel2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nivel3" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nivel4" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="ultimoNivel" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "tipoContribuyente", propOrder = { + "id", + "nivel1", + "nivel2", + "nivel3", + "nivel4", + "ultimoNivel" +}) +public class TipoContribuyente { + + protected Long id; + protected String nivel1; + protected String nivel2; + protected String nivel3; + protected String nivel4; + protected String ultimoNivel; + + /** + * Obtiene el valor de la propiedad id. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getId() { + return id; + } + + /** + * Define el valor de la propiedad id. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setId(Long value) { + this.id = value; + } + + /** + * Obtiene el valor de la propiedad nivel1. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNivel1() { + return nivel1; + } + + /** + * Define el valor de la propiedad nivel1. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNivel1(String value) { + this.nivel1 = value; + } + + /** + * Obtiene el valor de la propiedad nivel2. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNivel2() { + return nivel2; + } + + /** + * Define el valor de la propiedad nivel2. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNivel2(String value) { + this.nivel2 = value; + } + + /** + * Obtiene el valor de la propiedad nivel3. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNivel3() { + return nivel3; + } + + /** + * Define el valor de la propiedad nivel3. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNivel3(String value) { + this.nivel3 = value; + } + + /** + * Obtiene el valor de la propiedad nivel4. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNivel4() { + return nivel4; + } + + /** + * Define el valor de la propiedad nivel4. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNivel4(String value) { + this.nivel4 = value; + } + + /** + * Obtiene el valor de la propiedad ultimoNivel. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUltimoNivel() { + return ultimoNivel; + } + + /** + * Define el valor de la propiedad ultimoNivel. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUltimoNivel(String value) { + this.ultimoNivel = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/UbicacionGeografica.java b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/UbicacionGeografica.java new file mode 100644 index 0000000..a8d4e56 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/UbicacionGeografica.java @@ -0,0 +1,303 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para ubicacionGeografica complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="ubicacionGeografica">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="canton" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codCanton" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codPais" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codParroquia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codProvincia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codRegion" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="pais" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="parroquia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="provincia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="region" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ubicacionGeografica", propOrder = { + "canton", + "codCanton", + "codPais", + "codParroquia", + "codProvincia", + "codRegion", + "pais", + "parroquia", + "provincia", + "region" +}) +public class UbicacionGeografica { + + protected String canton; + protected String codCanton; + protected String codPais; + protected String codParroquia; + protected String codProvincia; + protected String codRegion; + protected String pais; + protected String parroquia; + protected String provincia; + protected String region; + + /** + * Obtiene el valor de la propiedad canton. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCanton() { + return canton; + } + + /** + * Define el valor de la propiedad canton. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCanton(String value) { + this.canton = value; + } + + /** + * Obtiene el valor de la propiedad codCanton. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodCanton() { + return codCanton; + } + + /** + * Define el valor de la propiedad codCanton. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodCanton(String value) { + this.codCanton = value; + } + + /** + * Obtiene el valor de la propiedad codPais. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodPais() { + return codPais; + } + + /** + * Define el valor de la propiedad codPais. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodPais(String value) { + this.codPais = value; + } + + /** + * Obtiene el valor de la propiedad codParroquia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodParroquia() { + return codParroquia; + } + + /** + * Define el valor de la propiedad codParroquia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodParroquia(String value) { + this.codParroquia = value; + } + + /** + * Obtiene el valor de la propiedad codProvincia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodProvincia() { + return codProvincia; + } + + /** + * Define el valor de la propiedad codProvincia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodProvincia(String value) { + this.codProvincia = value; + } + + /** + * Obtiene el valor de la propiedad codRegion. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodRegion() { + return codRegion; + } + + /** + * Define el valor de la propiedad codRegion. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodRegion(String value) { + this.codRegion = value; + } + + /** + * Obtiene el valor de la propiedad pais. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPais() { + return pais; + } + + /** + * Define el valor de la propiedad pais. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPais(String value) { + this.pais = value; + } + + /** + * Obtiene el valor de la propiedad parroquia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getParroquia() { + return parroquia; + } + + /** + * Define el valor de la propiedad parroquia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setParroquia(String value) { + this.parroquia = value; + } + + /** + * Obtiene el valor de la propiedad provincia. + * + * @return + * possible object is + * {@link String } + * + */ + public String getProvincia() { + return provincia; + } + + /** + * Define el valor de la propiedad provincia. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setProvincia(String value) { + this.provincia = value; + } + + /** + * Obtiene el valor de la propiedad region. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRegion() { + return region; + } + + /** + * Define el valor de la propiedad region. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRegion(String value) { + this.region = value; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/WebServiceContribuyenteService.java b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/WebServiceContribuyenteService.java new file mode 100644 index 0000000..d1855ae --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/WebServiceContribuyenteService.java @@ -0,0 +1,96 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import java.net.MalformedURLException; +import java.net.URL; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceException; +import javax.xml.ws.WebServiceFeature; + +import com.fp.webservices.snap.recursos.MsgSnap; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.6b21 + * Generated source version: 2.2 + * + */ +@WebServiceClient(name = "WebServiceContribuyenteService", targetNamespace = "http://sri.gov.ec/wsConsultaContribuyente", wsdlLocation = "https://bsg.gob.ec/sw/SRI/BSGSW01_Consultar_RucSRI?wsdl") +public class WebServiceContribuyenteService + extends Service +{ + + private final static URL WEBSERVICECONTRIBUYENTESERVICE_WSDL_LOCATION; + private final static WebServiceException WEBSERVICECONTRIBUYENTESERVICE_EXCEPTION; + private final static QName WEBSERVICECONTRIBUYENTESERVICE_QNAME = new QName("http://sri.gov.ec/wsConsultaContribuyente", "WebServiceContribuyenteService"); + + static { + URL url = null; + WebServiceException e = null; + try { + url = new URL(MsgSnap.getString("url_consulta_ruc")); + } catch (MalformedURLException ex) { + e = new WebServiceException(ex); + } + WEBSERVICECONTRIBUYENTESERVICE_WSDL_LOCATION = url; + WEBSERVICECONTRIBUYENTESERVICE_EXCEPTION = e; + } + + public WebServiceContribuyenteService() { + super(__getWsdlLocation(), WEBSERVICECONTRIBUYENTESERVICE_QNAME); + } + + public WebServiceContribuyenteService(WebServiceFeature... features) { + super(__getWsdlLocation(), WEBSERVICECONTRIBUYENTESERVICE_QNAME, features); + } + + public WebServiceContribuyenteService(URL wsdlLocation) { + super(wsdlLocation, WEBSERVICECONTRIBUYENTESERVICE_QNAME); + } + + public WebServiceContribuyenteService(URL wsdlLocation, WebServiceFeature... features) { + super(wsdlLocation, WEBSERVICECONTRIBUYENTESERVICE_QNAME, features); + } + + public WebServiceContribuyenteService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public WebServiceContribuyenteService(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * + * @return + * returns WsConsultaContribuyente + */ + @WebEndpoint(name = "wsConsultaContribuyentePort") + public WsConsultaContribuyente getWsConsultaContribuyentePort() { + return super.getPort(new QName("http://sri.gov.ec/wsConsultaContribuyente", "wsConsultaContribuyentePort"), WsConsultaContribuyente.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns WsConsultaContribuyente + */ + @WebEndpoint(name = "wsConsultaContribuyentePort") + public WsConsultaContribuyente getWsConsultaContribuyentePort(WebServiceFeature... features) { + return super.getPort(new QName("http://sri.gov.ec/wsConsultaContribuyente", "wsConsultaContribuyentePort"), WsConsultaContribuyente.class, features); + } + + private static URL __getWsdlLocation() { + if (WEBSERVICECONTRIBUYENTESERVICE_EXCEPTION!= null) { + throw WEBSERVICECONTRIBUYENTESERVICE_EXCEPTION; + } + return WEBSERVICECONTRIBUYENTESERVICE_WSDL_LOCATION; + } + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/WsConsultaContribuyente.java b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/WsConsultaContribuyente.java new file mode 100644 index 0000000..196d927 --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/WsConsultaContribuyente.java @@ -0,0 +1,74 @@ + +package ec.gov.sri.wsconsultacontribuyente; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.6b21 + * Generated source version: 2.2 + * + */ +@WebService(name = "wsConsultaContribuyente", targetNamespace = "http://sri.gov.ec/wsConsultaContribuyente") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface WsConsultaContribuyente { + + + /** + * + * @param fuenteDatos + * @param numeroRuc + * @return + * returns ec.gov.sri.wsconsultacontribuyente.Contribuyente + */ + @WebMethod + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "obtenerSimple", targetNamespace = "http://sri.gov.ec/wsConsultaContribuyente", className = "ec.gov.sri.wsconsultacontribuyente.ObtenerSimple") + @ResponseWrapper(localName = "obtenerSimpleResponse", targetNamespace = "http://sri.gov.ec/wsConsultaContribuyente", className = "ec.gov.sri.wsconsultacontribuyente.ObtenerSimpleResponse") + public Contribuyente obtenerSimple( + @WebParam(name = "numeroRuc", targetNamespace = "") + String numeroRuc, + @WebParam(name = "fuenteDatos", targetNamespace = "") + String fuenteDatos); + + /** + * + * @param fuenteDatos + * @param numeroRuc + * @return + * returns ec.gov.sri.wsconsultacontribuyente.ContribuyenteCompleto + */ + @WebMethod + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "obtenerCompleto", targetNamespace = "http://sri.gov.ec/wsConsultaContribuyente", className = "ec.gov.sri.wsconsultacontribuyente.ObtenerCompleto") + @ResponseWrapper(localName = "obtenerCompletoResponse", targetNamespace = "http://sri.gov.ec/wsConsultaContribuyente", className = "ec.gov.sri.wsconsultacontribuyente.ObtenerCompletoResponse") + public ContribuyenteCompleto obtenerCompleto( + @WebParam(name = "numeroRuc", targetNamespace = "") + String numeroRuc, + @WebParam(name = "fuenteDatos", targetNamespace = "") + String fuenteDatos); + + /** + * + * @param numeroRuc + * @return + * returns ec.gov.sri.wsconsultacontribuyente.ContribuyenteOnLine + */ + @WebMethod + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "obtenerDatos", targetNamespace = "http://sri.gov.ec/wsConsultaContribuyente", className = "ec.gov.sri.wsconsultacontribuyente.ObtenerDatos") + @ResponseWrapper(localName = "obtenerDatosResponse", targetNamespace = "http://sri.gov.ec/wsConsultaContribuyente", className = "ec.gov.sri.wsconsultacontribuyente.ObtenerDatosResponse") + public ContribuyenteOnLine obtenerDatos( + @WebParam(name = "numeroRuc", targetNamespace = "") + String numeroRuc); + +} diff --git a/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/package-info.java b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/package-info.java new file mode 100644 index 0000000..1a4786d --- /dev/null +++ b/centralwebservices/src/main/java/ec/gov/sri/wsconsultacontribuyente/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://sri.gov.ec/wsConsultaContribuyente") +package ec.gov.sri.wsconsultacontribuyente; diff --git a/centralwebservices/src/main/resources/.svn/entries b/centralwebservices/src/main/resources/.svn/entries new file mode 100644 index 0000000..0fef93e --- /dev/null +++ b/centralwebservices/src/main/resources/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/resources +svn://172.17.26.185/COMACO + + + +2015-04-30T06:53:57.070359Z +4065 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/centralwebservices/src/main/resources/com/.svn/entries b/centralwebservices/src/main/resources/com/.svn/entries new file mode 100644 index 0000000..9e4ea02 --- /dev/null +++ b/centralwebservices/src/main/resources/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/resources/com +svn://172.17.26.185/COMACO + + + +2015-04-30T06:53:57.070359Z +4065 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/centralwebservices/src/main/resources/com/fp/.svn/entries b/centralwebservices/src/main/resources/com/fp/.svn/entries new file mode 100644 index 0000000..a21bc9a --- /dev/null +++ b/centralwebservices/src/main/resources/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/resources/com/fp +svn://172.17.26.185/COMACO + + + +2015-04-30T06:53:57.070359Z +4065 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +webservices +dir + diff --git a/centralwebservices/src/main/resources/com/fp/webservices/.svn/entries b/centralwebservices/src/main/resources/com/fp/webservices/.svn/entries new file mode 100644 index 0000000..b0a9a72 --- /dev/null +++ b/centralwebservices/src/main/resources/com/fp/webservices/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/resources/com/fp/webservices +svn://172.17.26.185/COMACO + + + +2015-04-30T06:53:57.070359Z +4065 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +snap +dir + diff --git a/centralwebservices/src/main/resources/com/fp/webservices/snap/.svn/entries b/centralwebservices/src/main/resources/com/fp/webservices/snap/.svn/entries new file mode 100644 index 0000000..f0d50f4 --- /dev/null +++ b/centralwebservices/src/main/resources/com/fp/webservices/snap/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/resources/com/fp/webservices/snap +svn://172.17.26.185/COMACO + + + +2015-04-30T06:53:57.070359Z +4065 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +recursos +dir + diff --git a/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/.svn/entries b/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/.svn/entries new file mode 100644 index 0000000..07aa45d --- /dev/null +++ b/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos +svn://172.17.26.185/COMACO + + + +2015-04-30T06:53:57.070359Z +4065 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +snap.properties +file + + + + +2022-07-28T03:40:47.543824Z +967d9d2048c067b7a0f37104ebeadb7f +2015-04-30T06:53:57.070359Z +4065 +cpiedra +has-props + + + + + + + + + + + + + + + + + + + + +291 + +return.xml +file + + + + +2022-07-28T03:40:47.544824Z +e03589d558b15b62aacc058168466391 +2014-12-11T05:00:43.966009Z +3415 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +2187 + diff --git a/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/.svn/prop-base/return.xml.svn-base b/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/.svn/prop-base/return.xml.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/.svn/prop-base/return.xml.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/.svn/prop-base/snap.properties.svn-base b/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/.svn/prop-base/snap.properties.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/.svn/prop-base/snap.properties.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/.svn/text-base/return.xml.netbeans-base b/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/.svn/text-base/return.xml.netbeans-base new file mode 100644 index 0000000..5f1cc8f --- /dev/null +++ b/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/.svn/text-base/return.xml.netbeans-base @@ -0,0 +1,54 @@ + + + ACTIVIDADES DE TIPO SERVICIO. + O + O93 + O930 + O9309 + O93090 + O930909 + OTRAS ACTIVIDADES COMUNITARIAS SOCIALES Y PERSONALES DE + TIPO SERVICIOS + OTRAS ACTIVIDADES DE TIPO SERVICIO. + OTRAS ACTIVIDADES DE TIPO SERVICIO. + OTRAS ACTIVIDADES DE TIPO SERVICIO N.C.P. + OTRAS ACTIVIDADES DE TIPO SERVICIO N.C.P. + OTRAS ACTIVIDADES DE TIPO SERVICIO N.C.P.: APARCADORES DE + VEHICULOS, ASISTENTES DE COMPRAS, ASTROLOGIA Y ESPIRITISMO, + LUSTRABOTAS, PORTEADORES DE MALETAS, ETC. + + OTR + ACT + OTROS + ACTIVO + CALLE: JUAN CALDERON NÚMERO: OE4-81 INTERSECCIÓN: + DIEGO PALOMINO REFERENCIA: A UNA CUADRA DEL MERCADO DE LA QUITO SUR + + 1716776933001 + CRUZ LOJAN JORGE DAVID + + 1 + PERSONAS NATURALES + + + + CALLE: JUAN CALDERON NÚMERO: OE4-81 INTERSECCIÓN: + DIEGO PALOMINO REFERENCIA: A UNA CUADRA DEL MERCADO DE LA QUITO SUR + + + Q17 + Q + 0 + PICHINCHA + ZONA 9 + + 2010-09-30 + 1987-11-24 + 2012-11-12 + + N + + N + + 03-2012 + \ No newline at end of file diff --git a/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/.svn/text-base/return.xml.svn-base b/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/.svn/text-base/return.xml.svn-base new file mode 100644 index 0000000..5f1cc8f --- /dev/null +++ b/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/.svn/text-base/return.xml.svn-base @@ -0,0 +1,54 @@ + + + ACTIVIDADES DE TIPO SERVICIO. + O + O93 + O930 + O9309 + O93090 + O930909 + OTRAS ACTIVIDADES COMUNITARIAS SOCIALES Y PERSONALES DE + TIPO SERVICIOS + OTRAS ACTIVIDADES DE TIPO SERVICIO. + OTRAS ACTIVIDADES DE TIPO SERVICIO. + OTRAS ACTIVIDADES DE TIPO SERVICIO N.C.P. + OTRAS ACTIVIDADES DE TIPO SERVICIO N.C.P. + OTRAS ACTIVIDADES DE TIPO SERVICIO N.C.P.: APARCADORES DE + VEHICULOS, ASISTENTES DE COMPRAS, ASTROLOGIA Y ESPIRITISMO, + LUSTRABOTAS, PORTEADORES DE MALETAS, ETC. + + OTR + ACT + OTROS + ACTIVO + CALLE: JUAN CALDERON NÚMERO: OE4-81 INTERSECCIÓN: + DIEGO PALOMINO REFERENCIA: A UNA CUADRA DEL MERCADO DE LA QUITO SUR + + 1716776933001 + CRUZ LOJAN JORGE DAVID + + 1 + PERSONAS NATURALES + + + + CALLE: JUAN CALDERON NÚMERO: OE4-81 INTERSECCIÓN: + DIEGO PALOMINO REFERENCIA: A UNA CUADRA DEL MERCADO DE LA QUITO SUR + + + Q17 + Q + 0 + PICHINCHA + ZONA 9 + + 2010-09-30 + 1987-11-24 + 2012-11-12 + + N + + N + + 03-2012 + \ No newline at end of file diff --git a/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/.svn/text-base/snap.properties.netbeans-base b/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/.svn/text-base/snap.properties.netbeans-base new file mode 100644 index 0000000..76317cc --- /dev/null +++ b/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/.svn/text-base/snap.properties.netbeans-base @@ -0,0 +1,6 @@ +cedulapermiso=0501764468 +url_consulta_cedula=https://www.bsg.gob.ec/sw/RC/BSGSW01_Consultar_Cedula?wsdl +url_consulta_ruc=https://www.bsg.gob.ec/sw/SRI/BSGSW01_Consultar_RucSRI?wsdl +url_permiso_client=https://www.bsg.gob.ec/sw/STI/BSGSW08_Acceder_BSG?wsdl +usuario=testroot +password=Sti1DigS21 \ No newline at end of file diff --git a/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/.svn/text-base/snap.properties.svn-base b/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/.svn/text-base/snap.properties.svn-base new file mode 100644 index 0000000..76317cc --- /dev/null +++ b/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/.svn/text-base/snap.properties.svn-base @@ -0,0 +1,6 @@ +cedulapermiso=0501764468 +url_consulta_cedula=https://www.bsg.gob.ec/sw/RC/BSGSW01_Consultar_Cedula?wsdl +url_consulta_ruc=https://www.bsg.gob.ec/sw/SRI/BSGSW01_Consultar_RucSRI?wsdl +url_permiso_client=https://www.bsg.gob.ec/sw/STI/BSGSW08_Acceder_BSG?wsdl +usuario=testroot +password=Sti1DigS21 \ No newline at end of file diff --git a/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/return.xml b/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/return.xml new file mode 100644 index 0000000..5f1cc8f --- /dev/null +++ b/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/return.xml @@ -0,0 +1,54 @@ + + + ACTIVIDADES DE TIPO SERVICIO. + O + O93 + O930 + O9309 + O93090 + O930909 + OTRAS ACTIVIDADES COMUNITARIAS SOCIALES Y PERSONALES DE + TIPO SERVICIOS + OTRAS ACTIVIDADES DE TIPO SERVICIO. + OTRAS ACTIVIDADES DE TIPO SERVICIO. + OTRAS ACTIVIDADES DE TIPO SERVICIO N.C.P. + OTRAS ACTIVIDADES DE TIPO SERVICIO N.C.P. + OTRAS ACTIVIDADES DE TIPO SERVICIO N.C.P.: APARCADORES DE + VEHICULOS, ASISTENTES DE COMPRAS, ASTROLOGIA Y ESPIRITISMO, + LUSTRABOTAS, PORTEADORES DE MALETAS, ETC. + + OTR + ACT + OTROS + ACTIVO + CALLE: JUAN CALDERON NÚMERO: OE4-81 INTERSECCIÓN: + DIEGO PALOMINO REFERENCIA: A UNA CUADRA DEL MERCADO DE LA QUITO SUR + + 1716776933001 + CRUZ LOJAN JORGE DAVID + + 1 + PERSONAS NATURALES + + + + CALLE: JUAN CALDERON NÚMERO: OE4-81 INTERSECCIÓN: + DIEGO PALOMINO REFERENCIA: A UNA CUADRA DEL MERCADO DE LA QUITO SUR + + + Q17 + Q + 0 + PICHINCHA + ZONA 9 + + 2010-09-30 + 1987-11-24 + 2012-11-12 + + N + + N + + 03-2012 + \ No newline at end of file diff --git a/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/snap.properties b/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/snap.properties new file mode 100644 index 0000000..76317cc --- /dev/null +++ b/centralwebservices/src/main/resources/com/fp/webservices/snap/recursos/snap.properties @@ -0,0 +1,6 @@ +cedulapermiso=0501764468 +url_consulta_cedula=https://www.bsg.gob.ec/sw/RC/BSGSW01_Consultar_Cedula?wsdl +url_consulta_ruc=https://www.bsg.gob.ec/sw/SRI/BSGSW01_Consultar_RucSRI?wsdl +url_permiso_client=https://www.bsg.gob.ec/sw/STI/BSGSW08_Acceder_BSG?wsdl +usuario=testroot +password=Sti1DigS21 \ No newline at end of file diff --git a/centralwebservices/src/test/.svn/entries b/centralwebservices/src/test/.svn/entries new file mode 100644 index 0000000..435c4cd --- /dev/null +++ b/centralwebservices/src/test/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/test +svn://172.17.26.185/COMACO + + + +2014-12-11T05:00:43.966009Z +3415 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/centralwebservices/src/test/java/.svn/entries b/centralwebservices/src/test/java/.svn/entries new file mode 100644 index 0000000..aaf927c --- /dev/null +++ b/centralwebservices/src/test/java/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/test/java +svn://172.17.26.185/COMACO + + + +2014-12-11T05:00:43.966009Z +3415 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/centralwebservices/src/test/resources/.svn/entries b/centralwebservices/src/test/resources/.svn/entries new file mode 100644 index 0000000..3176b85 --- /dev/null +++ b/centralwebservices/src/test/resources/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/centralwebservices/src/test/resources +svn://172.17.26.185/COMACO + + + +2014-12-11T05:00:43.966009Z +3415 +dcruz + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/clients/.svn/entries b/clients/.svn/entries new file mode 100644 index 0000000..25c5484 --- /dev/null +++ b/clients/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients +svn://172.17.26.185/COMACO + + + +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +comaco +dir + +pom.xml +file + + + + +2022-07-28T03:40:23.357719Z +c6e4ebf7cf19fe65ac3a9574f34374a0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6004 + diff --git a/clients/.svn/text-base/pom.xml.svn-base b/clients/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..0512f1a --- /dev/null +++ b/clients/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,163 @@ + + + + FlipBean + com.fp + 2.1 + + 4.0.0 + com.fp + clients + Clients + 2.1 + pom + + 5.5.0.Final + 5.4.0.Final + ISO-8859-1 + + + comaco + + + + + + + org.drools + drools-persistence-jpa + ${drools.version} + provided + + + org.drools + knowledge-api + ${drools.version} + provided + + + org.drools + knowledge-internal-api + ${drools.version} + provided + + + + org.drools + drools-core + ${drools.version} + provided + + + org.drools + drools-compiler + ${drools.version} + provided + + + org.drools + drools-decisiontables + ${drools.version} + provided + + + org.drools + drools-templates + ${drools.version} + provided + + + org.apache.mina + mina-core + 2.0.1 + provided + + + + + org.jbpm + jbpm-flow + ${jbpm.version} + provided + + + org.jbpm + jbpm-flow-builder + ${jbpm.version} + provided + + + org.jbpm + jbpm-persistence-jpa + ${jbpm.version} + provided + + + org.jbpm + jbpm-bpmn2 + ${jbpm.version} + provided + + + org.jbpm + jbpm-human-task + ${jbpm.version} + provided + + + org.jbpm + jbpm-human-task-core + ${jbpm.version} + provided + + + org.jbpm + jbpm-human-task-mina + ${jbpm.version} + provided + + + org.jbpm + jbpm-bam + ${jbpm.version} + provided + + + org.jbpm + jbpm-workitems + ${jbpm.version} + provided + + + + + org.apache.poi + poi + 3.5-FINAL + jar + provided + + + org.apache.poi + poi-ooxml-schemas + 3.6 + jar + provided + + + org.apache.poi + poi-ooxml + 3.5-FINAL + jar + provided + + + org.apache.poi + ooxml-schemas + 1.0 + jar + provided + + + + diff --git a/clients/comaco/.svn/entries b/clients/comaco/.svn/entries new file mode 100644 index 0000000..89dcfcc --- /dev/null +++ b/clients/comaco/.svn/entries @@ -0,0 +1,68 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco +svn://172.17.26.185/COMACO + + + +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ear +dir + +pom.xml +file + + + + +2022-07-28T03:40:23.323719Z +b450fc1248873a063865d05e8dcabc2f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1242 + +environment-eap6 +dir + diff --git a/clients/comaco/.svn/text-base/pom.xml.svn-base b/clients/comaco/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..14648bb --- /dev/null +++ b/clients/comaco/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,48 @@ + + + + clients + com.fp + 2.1 + + 4.0.0 + com.fp.clients + maia + FlipBean + 2.1 + pom + + environment-eap6 + ear + + + + flipbean + Flipbean + flipbean.s.a@gmail.com + + Project Manager + Architect + + + + + + + log4j + log4j + 1.2.14 + + + + + + junit + junit + 4.0 + test + + + + + diff --git a/clients/comaco/ear/.svn/dir-prop-base b/clients/comaco/ear/.svn/dir-prop-base new file mode 100644 index 0000000..40820ff --- /dev/null +++ b/clients/comaco/ear/.svn/dir-prop-base @@ -0,0 +1,6 @@ +K 10 +svn:ignore +V 7 +target + +END diff --git a/clients/comaco/ear/.svn/entries b/clients/comaco/ear/.svn/entries new file mode 100644 index 0000000..082ae44 --- /dev/null +++ b/clients/comaco/ear/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/ear +svn://172.17.26.185/COMACO + + + +2014-10-17T05:29:48.567075Z +1668 +jvaca +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:22.658716Z +8308e4c280b72d2c37bd91c0c5011e0d +2014-09-11T06:13:12.553770Z +659 +jvaca + + + + + + + + + + + + + + + + + + + + + +12509 + diff --git a/clients/comaco/ear/.svn/text-base/pom.xml.svn-base b/clients/comaco/ear/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..8c45fb0 --- /dev/null +++ b/clients/comaco/ear/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,338 @@ + + + + maia + com.fp.clients + 2.1 + + 4.0.0 + com.fp.clients.maia + maiaear + ear maia + 2.1 + ear + + + com.fp.clients.maia + environment-eap6 + ${project.version} + + + com.fp.base.dto + common + ${project.version} + + + com.fp.base.dto + dto + ${project.version} + + + + com.fp.base + facade + ${project.version} + ejb + + + com.fp.base + facadeclient + ${project.version} + ejb + + + com.fp.base + sessionbeans + ${project.version} + ejb + + + + com.fp.base.persistence + commondb + ${project.version} + + + com.fp.base.persistence + util + ${project.version} + + + + + com.fp.base.core + bpm + ${project.version} + + + com.fp.base.core + firmas + ${project.version} + + + + + com.fp.base.business + general + ${project.version} + + + com.fp.base.persistence + pgeneral + ${project.version} + + + com.fp.base.persistence + pfirmas + ${project.version} + + + + + com.fp.base.business + log + ${project.version} + + + com.fp.base.persistence + plog + ${project.version} + + + + + com.fp.base.business + person + ${project.version} + + + com.fp.base.persistence + pcustomer + ${project.version} + + + + + com.fp.base.business + report + ${project.version} + + + + + com.fp.base.business + armas + ${project.version} + + + com.fp.base.persistence + parmas + ${project.version} + + + + + com.fp.base.bpm + simple + ${project.version} + + + com.fp.base.bpm + bpmlib + ${project.version} + ejb + + + com.fp.base.persistence + pbpm + ${project.version} + + + + + org.apache.velocity + velocity-tools + provided + + + org.apache.velocity + velocity + provided + + + + + + + + + + org.apache.maven.plugins + maven-ear-plugin + 2.8 + + + + 6 + + + + ${basedir}/src/main/resources + + + META-INF/jboss-deployment-structure.xml,META-INF/persistence.xml + + + + true + + + + + + com.fp.clients.maia + environment-eap6 + true + + + com.fp.base.dto + common + true + + + com.fp.base.dto + dto + true + + + + + com.fp.base + facade + facade.jar + + + com.fp.base + facadeclient + facadeclient.jar + + + com.fp.base + sessionbeans + sessionbeans.jar + + + com.fp.base.bpm + bpmlib + bpmlib.jar + + + + + com.fp.base.persistence + commondb + true + + + com.fp.base.persistence + util + true + + + + + + com.fp.base.core + bpm + true + + + com.fp.base.core + firmas + true + + + + + com.fp.base.business + general + true + + + com.fp.base.persistence + pgeneral + true + + + + + + com.fp.base.business + log + true + + + com.fp.base.persistence + plog + true + + + + + com.fp.base.business + person + true + + + com.fp.base.persistence + pcustomer + true + + + + + com.fp.base.business + armas + true + + + com.fp.base.persistence + parmas + true + + + + + com.fp.base.business + report + true + + + + + com.fp.base.bpm + simple + true + + + com.fp.base.persistence + pbpm + true + + + com.fp.base.persistence + pfirmas + true + + + + + + + + + diff --git a/clients/comaco/ear/pom.xml b/clients/comaco/ear/pom.xml new file mode 100644 index 0000000..8c45fb0 --- /dev/null +++ b/clients/comaco/ear/pom.xml @@ -0,0 +1,338 @@ + + + + maia + com.fp.clients + 2.1 + + 4.0.0 + com.fp.clients.maia + maiaear + ear maia + 2.1 + ear + + + com.fp.clients.maia + environment-eap6 + ${project.version} + + + com.fp.base.dto + common + ${project.version} + + + com.fp.base.dto + dto + ${project.version} + + + + com.fp.base + facade + ${project.version} + ejb + + + com.fp.base + facadeclient + ${project.version} + ejb + + + com.fp.base + sessionbeans + ${project.version} + ejb + + + + com.fp.base.persistence + commondb + ${project.version} + + + com.fp.base.persistence + util + ${project.version} + + + + + com.fp.base.core + bpm + ${project.version} + + + com.fp.base.core + firmas + ${project.version} + + + + + com.fp.base.business + general + ${project.version} + + + com.fp.base.persistence + pgeneral + ${project.version} + + + com.fp.base.persistence + pfirmas + ${project.version} + + + + + com.fp.base.business + log + ${project.version} + + + com.fp.base.persistence + plog + ${project.version} + + + + + com.fp.base.business + person + ${project.version} + + + com.fp.base.persistence + pcustomer + ${project.version} + + + + + com.fp.base.business + report + ${project.version} + + + + + com.fp.base.business + armas + ${project.version} + + + com.fp.base.persistence + parmas + ${project.version} + + + + + com.fp.base.bpm + simple + ${project.version} + + + com.fp.base.bpm + bpmlib + ${project.version} + ejb + + + com.fp.base.persistence + pbpm + ${project.version} + + + + + org.apache.velocity + velocity-tools + provided + + + org.apache.velocity + velocity + provided + + + + + + + + + + org.apache.maven.plugins + maven-ear-plugin + 2.8 + + + + 6 + + + + ${basedir}/src/main/resources + + + META-INF/jboss-deployment-structure.xml,META-INF/persistence.xml + + + + true + + + + + + com.fp.clients.maia + environment-eap6 + true + + + com.fp.base.dto + common + true + + + com.fp.base.dto + dto + true + + + + + com.fp.base + facade + facade.jar + + + com.fp.base + facadeclient + facadeclient.jar + + + com.fp.base + sessionbeans + sessionbeans.jar + + + com.fp.base.bpm + bpmlib + bpmlib.jar + + + + + com.fp.base.persistence + commondb + true + + + com.fp.base.persistence + util + true + + + + + + com.fp.base.core + bpm + true + + + com.fp.base.core + firmas + true + + + + + com.fp.base.business + general + true + + + com.fp.base.persistence + pgeneral + true + + + + + + com.fp.base.business + log + true + + + com.fp.base.persistence + plog + true + + + + + com.fp.base.business + person + true + + + com.fp.base.persistence + pcustomer + true + + + + + com.fp.base.business + armas + true + + + com.fp.base.persistence + parmas + true + + + + + com.fp.base.business + report + true + + + + + com.fp.base.bpm + simple + true + + + com.fp.base.persistence + pbpm + true + + + com.fp.base.persistence + pfirmas + true + + + + + + + + + diff --git a/clients/comaco/ear/src/.svn/entries b/clients/comaco/ear/src/.svn/entries new file mode 100644 index 0000000..8c7b90d --- /dev/null +++ b/clients/comaco/ear/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/ear/src +svn://172.17.26.185/COMACO + + + +2014-09-11T06:13:12.553770Z +659 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/clients/comaco/ear/src/main/.svn/entries b/clients/comaco/ear/src/main/.svn/entries new file mode 100644 index 0000000..6fe362f --- /dev/null +++ b/clients/comaco/ear/src/main/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/ear/src/main +svn://172.17.26.185/COMACO + + + +2014-09-11T06:13:12.553770Z +659 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/clients/comaco/ear/src/main/java/.svn/entries b/clients/comaco/ear/src/main/java/.svn/entries new file mode 100644 index 0000000..7ee19ad --- /dev/null +++ b/clients/comaco/ear/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/ear/src/main/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/clients/comaco/ear/src/main/java/com/.svn/entries b/clients/comaco/ear/src/main/java/com/.svn/entries new file mode 100644 index 0000000..db03cd5 --- /dev/null +++ b/clients/comaco/ear/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/ear/src/main/java/com +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/clients/comaco/ear/src/main/java/com/fp/.svn/entries b/clients/comaco/ear/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..01a8525 --- /dev/null +++ b/clients/comaco/ear/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/ear/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +clients +dir + diff --git a/clients/comaco/ear/src/main/java/com/fp/clients/.svn/entries b/clients/comaco/ear/src/main/java/com/fp/clients/.svn/entries new file mode 100644 index 0000000..7b2f17c --- /dev/null +++ b/clients/comaco/ear/src/main/java/com/fp/clients/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/ear/src/main/java/com/fp/clients +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +maia +dir + diff --git a/clients/comaco/ear/src/main/java/com/fp/clients/maia/.svn/entries b/clients/comaco/ear/src/main/java/com/fp/clients/maia/.svn/entries new file mode 100644 index 0000000..02c0981 --- /dev/null +++ b/clients/comaco/ear/src/main/java/com/fp/clients/maia/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/ear/src/main/java/com/fp/clients/maia +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +App.java +file + + + + +2022-07-28T03:40:22.372715Z +6ef12b6027f1ac1067ce16aa120ba3bd +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +195 + diff --git a/clients/comaco/ear/src/main/java/com/fp/clients/maia/.svn/text-base/App.java.svn-base b/clients/comaco/ear/src/main/java/com/fp/clients/maia/.svn/text-base/App.java.svn-base new file mode 100644 index 0000000..db0e2f3 --- /dev/null +++ b/clients/comaco/ear/src/main/java/com/fp/clients/maia/.svn/text-base/App.java.svn-base @@ -0,0 +1,13 @@ +package com.fp.clients.maia; + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/clients/comaco/ear/src/main/java/com/fp/clients/maia/App.java b/clients/comaco/ear/src/main/java/com/fp/clients/maia/App.java new file mode 100644 index 0000000..db0e2f3 --- /dev/null +++ b/clients/comaco/ear/src/main/java/com/fp/clients/maia/App.java @@ -0,0 +1,13 @@ +package com.fp.clients.maia; + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/clients/comaco/ear/src/main/resources/.svn/entries b/clients/comaco/ear/src/main/resources/.svn/entries new file mode 100644 index 0000000..ff6097e --- /dev/null +++ b/clients/comaco/ear/src/main/resources/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/ear/src/main/resources +svn://172.17.26.185/COMACO + + + +2014-09-11T06:13:12.553770Z +659 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +META-INF +dir + diff --git a/clients/comaco/ear/src/main/resources/META-INF/.svn/entries b/clients/comaco/ear/src/main/resources/META-INF/.svn/entries new file mode 100644 index 0000000..5e9a6a5 --- /dev/null +++ b/clients/comaco/ear/src/main/resources/META-INF/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/ear/src/main/resources/META-INF +svn://172.17.26.185/COMACO + + + +2014-09-11T06:13:12.553770Z +659 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +jboss-deployment-structure.xml +file + + + + +2022-07-28T03:40:22.531716Z +80b63d5d973f3a33521699419199afa4 +2014-09-11T06:13:12.553770Z +659 +jvaca + + + + + + + + + + + + + + + + + + + + + +1693 + diff --git a/clients/comaco/ear/src/main/resources/META-INF/.svn/text-base/jboss-deployment-structure.xml.svn-base b/clients/comaco/ear/src/main/resources/META-INF/.svn/text-base/jboss-deployment-structure.xml.svn-base new file mode 100644 index 0000000..5f1e9f9 --- /dev/null +++ b/clients/comaco/ear/src/main/resources/META-INF/.svn/text-base/jboss-deployment-structure.xml.svn-base @@ -0,0 +1,43 @@ + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/clients/comaco/ear/src/main/resources/META-INF/jboss-deployment-structure.xml b/clients/comaco/ear/src/main/resources/META-INF/jboss-deployment-structure.xml new file mode 100644 index 0000000..5f1e9f9 --- /dev/null +++ b/clients/comaco/ear/src/main/resources/META-INF/jboss-deployment-structure.xml @@ -0,0 +1,43 @@ + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/clients/comaco/ear/src/test/.svn/entries b/clients/comaco/ear/src/test/.svn/entries new file mode 100644 index 0000000..551ab66 --- /dev/null +++ b/clients/comaco/ear/src/test/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/ear/src/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + diff --git a/clients/comaco/ear/src/test/java/.svn/entries b/clients/comaco/ear/src/test/java/.svn/entries new file mode 100644 index 0000000..c2d96b5 --- /dev/null +++ b/clients/comaco/ear/src/test/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/ear/src/test/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/clients/comaco/ear/src/test/java/com/.svn/entries b/clients/comaco/ear/src/test/java/com/.svn/entries new file mode 100644 index 0000000..74aa283 --- /dev/null +++ b/clients/comaco/ear/src/test/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/ear/src/test/java/com +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/clients/comaco/ear/src/test/java/com/fp/.svn/entries b/clients/comaco/ear/src/test/java/com/fp/.svn/entries new file mode 100644 index 0000000..d136ddb --- /dev/null +++ b/clients/comaco/ear/src/test/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/ear/src/test/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +clients +dir + diff --git a/clients/comaco/ear/src/test/java/com/fp/clients/.svn/entries b/clients/comaco/ear/src/test/java/com/fp/clients/.svn/entries new file mode 100644 index 0000000..4cb3cdb --- /dev/null +++ b/clients/comaco/ear/src/test/java/com/fp/clients/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/ear/src/test/java/com/fp/clients +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +maia +dir + diff --git a/clients/comaco/ear/src/test/java/com/fp/clients/maia/.svn/entries b/clients/comaco/ear/src/test/java/com/fp/clients/maia/.svn/entries new file mode 100644 index 0000000..65fdb46 --- /dev/null +++ b/clients/comaco/ear/src/test/java/com/fp/clients/maia/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/ear/src/test/java/com/fp/clients/maia +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +AppTest.java +file + + + + +2022-07-28T03:40:22.176714Z +cff7ea6778066ebbb0f0ad1a1326d65e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +685 + diff --git a/clients/comaco/ear/src/test/java/com/fp/clients/maia/.svn/text-base/AppTest.java.svn-base b/clients/comaco/ear/src/test/java/com/fp/clients/maia/.svn/text-base/AppTest.java.svn-base new file mode 100644 index 0000000..c3d70fe --- /dev/null +++ b/clients/comaco/ear/src/test/java/com/fp/clients/maia/.svn/text-base/AppTest.java.svn-base @@ -0,0 +1,38 @@ +package com.fp.clients.maia; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/clients/comaco/ear/src/test/java/com/fp/clients/maia/AppTest.java b/clients/comaco/ear/src/test/java/com/fp/clients/maia/AppTest.java new file mode 100644 index 0000000..c3d70fe --- /dev/null +++ b/clients/comaco/ear/src/test/java/com/fp/clients/maia/AppTest.java @@ -0,0 +1,38 @@ +package com.fp.clients.maia; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/clients/comaco/ear/target/application.xml b/clients/comaco/ear/target/application.xml new file mode 100644 index 0000000..64503b8 --- /dev/null +++ b/clients/comaco/ear/target/application.xml @@ -0,0 +1,73 @@ + + + maiaear + + environment-eap6-2.1.jar + + + common-2.1.jar + + + dto-2.1.jar + + + facade.jar + + + facadeclient.jar + + + sessionbeans.jar + + + bpmlib.jar + + + commondb-2.1.jar + + + util-2.1.jar + + + bpm-2.1.jar + + + firmas-2.1.jar + + + general-2.1.jar + + + pgeneral-2.1.jar + + + log-2.1.jar + + + plog-2.1.jar + + + person-2.1.jar + + + pcustomer-2.1.jar + + + armas-2.1.jar + + + parmas-2.1.jar + + + report-2.1.jar + + + simple-2.1.jar + + + pbpm-2.1.jar + + + pfirmas-2.1.jar + + \ No newline at end of file diff --git a/clients/comaco/ear/target/classes/META-INF/jboss-deployment-structure.xml b/clients/comaco/ear/target/classes/META-INF/jboss-deployment-structure.xml new file mode 100644 index 0000000..5f1e9f9 --- /dev/null +++ b/clients/comaco/ear/target/classes/META-INF/jboss-deployment-structure.xml @@ -0,0 +1,43 @@ + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/clients/comaco/ear/target/maiaear-2.1.ear b/clients/comaco/ear/target/maiaear-2.1.ear new file mode 100644 index 0000000..f671fa7 Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1.ear differ diff --git a/clients/comaco/ear/target/maiaear-2.1/META-INF/application.xml b/clients/comaco/ear/target/maiaear-2.1/META-INF/application.xml new file mode 100644 index 0000000..64503b8 --- /dev/null +++ b/clients/comaco/ear/target/maiaear-2.1/META-INF/application.xml @@ -0,0 +1,73 @@ + + + maiaear + + environment-eap6-2.1.jar + + + common-2.1.jar + + + dto-2.1.jar + + + facade.jar + + + facadeclient.jar + + + sessionbeans.jar + + + bpmlib.jar + + + commondb-2.1.jar + + + util-2.1.jar + + + bpm-2.1.jar + + + firmas-2.1.jar + + + general-2.1.jar + + + pgeneral-2.1.jar + + + log-2.1.jar + + + plog-2.1.jar + + + person-2.1.jar + + + pcustomer-2.1.jar + + + armas-2.1.jar + + + parmas-2.1.jar + + + report-2.1.jar + + + simple-2.1.jar + + + pbpm-2.1.jar + + + pfirmas-2.1.jar + + \ No newline at end of file diff --git a/clients/comaco/ear/target/maiaear-2.1/META-INF/jboss-deployment-structure.xml b/clients/comaco/ear/target/maiaear-2.1/META-INF/jboss-deployment-structure.xml new file mode 100644 index 0000000..5f1e9f9 --- /dev/null +++ b/clients/comaco/ear/target/maiaear-2.1/META-INF/jboss-deployment-structure.xml @@ -0,0 +1,43 @@ + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/clients/comaco/ear/target/maiaear-2.1/activation-1.1.1.jar b/clients/comaco/ear/target/maiaear-2.1/activation-1.1.1.jar new file mode 100644 index 0000000..1b703ab Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/activation-1.1.1.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/armas-2.1.jar b/clients/comaco/ear/target/maiaear-2.1/armas-2.1.jar new file mode 100644 index 0000000..259f704 Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/armas-2.1.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/bcmail-jdk15on-1.50.jar b/clients/comaco/ear/target/maiaear-2.1/bcmail-jdk15on-1.50.jar new file mode 100644 index 0000000..b12b362 Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/bcmail-jdk15on-1.50.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/bcpkix-jdk15on-1.50.jar b/clients/comaco/ear/target/maiaear-2.1/bcpkix-jdk15on-1.50.jar new file mode 100644 index 0000000..5dc125f Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/bcpkix-jdk15on-1.50.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/bcprov-jdk15on-1.50.jar b/clients/comaco/ear/target/maiaear-2.1/bcprov-jdk15on-1.50.jar new file mode 100644 index 0000000..d4b510d Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/bcprov-jdk15on-1.50.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/bpm-2.1.jar b/clients/comaco/ear/target/maiaear-2.1/bpm-2.1.jar new file mode 100644 index 0000000..aecd23a Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/bpm-2.1.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/bpmlib.jar b/clients/comaco/ear/target/maiaear-2.1/bpmlib.jar new file mode 100644 index 0000000..c8fe5b0 Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/bpmlib.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/common-2.1.jar b/clients/comaco/ear/target/maiaear-2.1/common-2.1.jar new file mode 100644 index 0000000..67ada14 Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/common-2.1.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/commondb-2.1.jar b/clients/comaco/ear/target/maiaear-2.1/commondb-2.1.jar new file mode 100644 index 0000000..3c1e867 Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/commondb-2.1.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/commons-fileupload-1.2.2.jar b/clients/comaco/ear/target/maiaear-2.1/commons-fileupload-1.2.2.jar new file mode 100644 index 0000000..131f192 Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/commons-fileupload-1.2.2.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/commons-lang3-3.1.jar b/clients/comaco/ear/target/maiaear-2.1/commons-lang3-3.1.jar new file mode 100644 index 0000000..a85e539 Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/commons-lang3-3.1.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/dto-2.1.jar b/clients/comaco/ear/target/maiaear-2.1/dto-2.1.jar new file mode 100644 index 0000000..4e008b1 Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/dto-2.1.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/environment-eap6-2.1.jar b/clients/comaco/ear/target/maiaear-2.1/environment-eap6-2.1.jar new file mode 100644 index 0000000..94840fc Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/environment-eap6-2.1.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/facade.jar b/clients/comaco/ear/target/maiaear-2.1/facade.jar new file mode 100644 index 0000000..7d69701 Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/facade.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/facadeclient.jar b/clients/comaco/ear/target/maiaear-2.1/facadeclient.jar new file mode 100644 index 0000000..594366f Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/facadeclient.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/firmas-2.1.jar b/clients/comaco/ear/target/maiaear-2.1/firmas-2.1.jar new file mode 100644 index 0000000..aaf8b3c Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/firmas-2.1.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/general-2.1.jar b/clients/comaco/ear/target/maiaear-2.1/general-2.1.jar new file mode 100644 index 0000000..253fd90 Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/general-2.1.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/itextpdf-5.5.0.jar b/clients/comaco/ear/target/maiaear-2.1/itextpdf-5.5.0.jar new file mode 100644 index 0000000..44edf12 Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/itextpdf-5.5.0.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/jep-2.4.1.jar b/clients/comaco/ear/target/maiaear-2.1/jep-2.4.1.jar new file mode 100644 index 0000000..0aea3e5 Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/jep-2.4.1.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/log-2.1.jar b/clients/comaco/ear/target/maiaear-2.1/log-2.1.jar new file mode 100644 index 0000000..d340d38 Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/log-2.1.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/log4j-1.2.14.jar b/clients/comaco/ear/target/maiaear-2.1/log4j-1.2.14.jar new file mode 100644 index 0000000..6251307 Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/log4j-1.2.14.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/mail-1.4.4.jar b/clients/comaco/ear/target/maiaear-2.1/mail-1.4.4.jar new file mode 100644 index 0000000..c122092 Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/mail-1.4.4.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/parmas-2.1.jar b/clients/comaco/ear/target/maiaear-2.1/parmas-2.1.jar new file mode 100644 index 0000000..f7a90ce Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/parmas-2.1.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/pbpm-2.1.jar b/clients/comaco/ear/target/maiaear-2.1/pbpm-2.1.jar new file mode 100644 index 0000000..b00bf0a Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/pbpm-2.1.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/pcustomer-2.1.jar b/clients/comaco/ear/target/maiaear-2.1/pcustomer-2.1.jar new file mode 100644 index 0000000..11f3dcc Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/pcustomer-2.1.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/person-2.1.jar b/clients/comaco/ear/target/maiaear-2.1/person-2.1.jar new file mode 100644 index 0000000..bfb1e31 Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/person-2.1.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/pfirmas-2.1.jar b/clients/comaco/ear/target/maiaear-2.1/pfirmas-2.1.jar new file mode 100644 index 0000000..2a69293 Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/pfirmas-2.1.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/pgeneral-2.1.jar b/clients/comaco/ear/target/maiaear-2.1/pgeneral-2.1.jar new file mode 100644 index 0000000..f762477 Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/pgeneral-2.1.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/plog-2.1.jar b/clients/comaco/ear/target/maiaear-2.1/plog-2.1.jar new file mode 100644 index 0000000..7bc404f Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/plog-2.1.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/report-2.1.jar b/clients/comaco/ear/target/maiaear-2.1/report-2.1.jar new file mode 100644 index 0000000..9c79325 Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/report-2.1.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/sessionbeans.jar b/clients/comaco/ear/target/maiaear-2.1/sessionbeans.jar new file mode 100644 index 0000000..985aac9 Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/sessionbeans.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/simple-2.1.jar b/clients/comaco/ear/target/maiaear-2.1/simple-2.1.jar new file mode 100644 index 0000000..adaee9f Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/simple-2.1.jar differ diff --git a/clients/comaco/ear/target/maiaear-2.1/util-2.1.jar b/clients/comaco/ear/target/maiaear-2.1/util-2.1.jar new file mode 100644 index 0000000..0f16c2a Binary files /dev/null and b/clients/comaco/ear/target/maiaear-2.1/util-2.1.jar differ diff --git a/clients/comaco/ear/target/maven-archiver/pom.properties b/clients/comaco/ear/target/maven-archiver/pom.properties new file mode 100644 index 0000000..c34dc36 --- /dev/null +++ b/clients/comaco/ear/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:53:23 ECT 2022 +version=2.1 +groupId=com.fp.clients.maia +artifactId=maiaear diff --git a/clients/comaco/environment-eap6/.svn/dir-prop-base b/clients/comaco/environment-eap6/.svn/dir-prop-base new file mode 100644 index 0000000..40820ff --- /dev/null +++ b/clients/comaco/environment-eap6/.svn/dir-prop-base @@ -0,0 +1,6 @@ +K 10 +svn:ignore +V 7 +target + +END diff --git a/clients/comaco/environment-eap6/.svn/entries b/clients/comaco/environment-eap6/.svn/entries new file mode 100644 index 0000000..0909639 --- /dev/null +++ b/clients/comaco/environment-eap6/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/environment-eap6 +svn://172.17.26.185/COMACO + + + +2021-08-26T17:51:29.138509Z +4639 +usermaia1 +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:23.290719Z +dbbbf5c9ef0a04dd11f72c0f5b6f1e4e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +780 + diff --git a/clients/comaco/environment-eap6/.svn/text-base/pom.xml.svn-base b/clients/comaco/environment-eap6/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..2c3c85b --- /dev/null +++ b/clients/comaco/environment-eap6/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,23 @@ + + + 4.0.0 + + maia + com.fp.clients + 2.1 + + com.fp.clients.maia + environment-eap6 + 2.1 + varibales de ambiente + http://maven.apache.org + + + junit + junit + 3.8.1 + test + + + diff --git a/clients/comaco/environment-eap6/pom.xml b/clients/comaco/environment-eap6/pom.xml new file mode 100644 index 0000000..2c3c85b --- /dev/null +++ b/clients/comaco/environment-eap6/pom.xml @@ -0,0 +1,23 @@ + + + 4.0.0 + + maia + com.fp.clients + 2.1 + + com.fp.clients.maia + environment-eap6 + 2.1 + varibales de ambiente + http://maven.apache.org + + + junit + junit + 3.8.1 + test + + + diff --git a/clients/comaco/environment-eap6/src/.svn/entries b/clients/comaco/environment-eap6/src/.svn/entries new file mode 100644 index 0000000..d7edea0 --- /dev/null +++ b/clients/comaco/environment-eap6/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/environment-eap6/src +svn://172.17.26.185/COMACO + + + +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/clients/comaco/environment-eap6/src/main/.svn/entries b/clients/comaco/environment-eap6/src/main/.svn/entries new file mode 100644 index 0000000..3e07422 --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/environment-eap6/src/main +svn://172.17.26.185/COMACO + + + +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + diff --git a/clients/comaco/environment-eap6/src/main/java/.svn/entries b/clients/comaco/environment-eap6/src/main/java/.svn/entries new file mode 100644 index 0000000..abfebf6 --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/environment-eap6/src/main/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/clients/comaco/environment-eap6/src/main/java/com/.svn/entries b/clients/comaco/environment-eap6/src/main/java/com/.svn/entries new file mode 100644 index 0000000..f55aeeb --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/environment-eap6/src/main/java/com +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/clients/comaco/environment-eap6/src/main/java/com/fp/.svn/entries b/clients/comaco/environment-eap6/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..dedada8 --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/environment-eap6/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +clients +dir + diff --git a/clients/comaco/environment-eap6/src/main/java/com/fp/clients/.svn/entries b/clients/comaco/environment-eap6/src/main/java/com/fp/clients/.svn/entries new file mode 100644 index 0000000..f0ea6a5 --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/java/com/fp/clients/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/environment-eap6/src/main/java/com/fp/clients +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +maia +dir + diff --git a/clients/comaco/environment-eap6/src/main/java/com/fp/clients/maia/.svn/entries b/clients/comaco/environment-eap6/src/main/java/com/fp/clients/maia/.svn/entries new file mode 100644 index 0000000..e8592d7 --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/java/com/fp/clients/maia/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/environment-eap6/src/main/java/com/fp/clients/maia +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/clients/comaco/environment-eap6/src/main/resources/.svn/entries b/clients/comaco/environment-eap6/src/main/resources/.svn/entries new file mode 100644 index 0000000..af6fd46 --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/.svn/entries @@ -0,0 +1,201 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/environment-eap6/src/main/resources +svn://172.17.26.185/COMACO + + + +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +META-INF +dir + +common.properties +file + + + + +2022-07-28T03:40:23.188718Z +16274b04e9cb10a83efae22a12fd29c4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +429 + +fb-facade.properties +file + + + + +2022-07-28T03:40:23.188718Z +10aef3a0cf2ed24b87300b26b60c7883 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +58 + +hibernateFlipMapping.cfg.xml +file + + + + +2022-07-28T03:40:23.188718Z +acfae474b38da3771234c5e0d3baf8f7 +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +20262 + +bpm.properties +file + + + + +2022-07-28T03:40:23.189718Z +ccd4a41bd8d25a3422345809360fd6a1 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +972 + +log4j.properties +file + + + + +2022-07-28T03:40:23.189718Z +3492c8160528621ca1a145122b6c5b4d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +773 + diff --git a/clients/comaco/environment-eap6/src/main/resources/.svn/text-base/bpm.properties.svn-base b/clients/comaco/environment-eap6/src/main/resources/.svn/text-base/bpm.properties.svn-base new file mode 100644 index 0000000..5444a7a --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/.svn/text-base/bpm.properties.svn-base @@ -0,0 +1,16 @@ +guvnor.url=http\://127.0.0.1\:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/{0}/{1} +vnor.url=http\://127.0.0.1\:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/{0}/{1} +guvnor.change.set= +guvnor.security.basicAuthentication=enabled +guvnor.security.username=gfiallos +guvnor.security.password=gfiallos +guvnor.refresh=false +bpm.memory=false +#task.ip=192.168.2.210 +task.ip=127.0.0.1 +task.ip.server=0.0.0.0 +task.port=9123 +flows.package=maia.flows +flows.snapshot=LATEST +inbox.icon.path=images/bpm/ +inbox.icon.extension=.gif diff --git a/clients/comaco/environment-eap6/src/main/resources/.svn/text-base/common.properties.svn-base b/clients/comaco/environment-eap6/src/main/resources/.svn/text-base/common.properties.svn-base new file mode 100644 index 0000000..e332127 --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/.svn/text-base/common.properties.svn-base @@ -0,0 +1,9 @@ +bean.class.path=/logs/fp +#codigo de moneda oficial +localCurrency=USD +# True indica que la aplicacion trabaja con tasas nominales, false indica que la aplicacion trabaja con tasas efectiva. +nominalRate=true +# Parametro que define el numero de dias de retencion default de valores depositados en cheque. +localhold=2 +#tipos de saldo sobre los cuales se paga intereses en cuentas a la vista +btypeinterest=Cash-Locked-Pawned \ No newline at end of file diff --git a/clients/comaco/environment-eap6/src/main/resources/.svn/text-base/fb-facade.properties.svn-base b/clients/comaco/environment-eap6/src/main/resources/.svn/text-base/fb-facade.properties.svn-base new file mode 100644 index 0000000..4d0474f --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/.svn/text-base/fb-facade.properties.svn-base @@ -0,0 +1,3 @@ +ear=maiaear-2.1/ +bean=FacadeBean/remote +defaultcompany=1 \ No newline at end of file diff --git a/clients/comaco/environment-eap6/src/main/resources/.svn/text-base/hibernateFlipMapping.cfg.xml.netbeans-base b/clients/comaco/environment-eap6/src/main/resources/.svn/text-base/hibernateFlipMapping.cfg.xml.netbeans-base new file mode 100644 index 0000000..1f4a7d6 --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/.svn/text-base/hibernateFlipMapping.cfg.xml.netbeans-base @@ -0,0 +1,273 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/clients/comaco/environment-eap6/src/main/resources/.svn/text-base/hibernateFlipMapping.cfg.xml.svn-base b/clients/comaco/environment-eap6/src/main/resources/.svn/text-base/hibernateFlipMapping.cfg.xml.svn-base new file mode 100644 index 0000000..1f4a7d6 --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/.svn/text-base/hibernateFlipMapping.cfg.xml.svn-base @@ -0,0 +1,273 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/clients/comaco/environment-eap6/src/main/resources/.svn/text-base/log4j.properties.svn-base b/clients/comaco/environment-eap6/src/main/resources/.svn/text-base/log4j.properties.svn-base new file mode 100644 index 0000000..a150115 --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/.svn/text-base/log4j.properties.svn-base @@ -0,0 +1,18 @@ +log4j.rootLogger=error,com.fp +log4j.logger.com.fp=error +log4j.appender.com.fp=org.apache.log4j.ConsoleAppender +log4j.appender.com.fp.layout=org.apache.log4j.PatternLayout +#log4j.appender.com.fp.layout.ConversionPattern=%d{dd-MMM-yyyy HH\:mm\:ss.SSS} %p [%t] <%l> - %m%n +log4j.appender.com.fp.layout.ConversionPattern=%d{HH\:mm\:ss.SSS} %p [%t] <%l> - %m%n +log4j.category.org.hibernate=fatal +log4j.category.javax=error +log4j.category.org.hibernate.cfg.AnnotationBinder=off +log4j.category.org.hibernate.cfg.annotations.EntityBinder=off +log4j.category.org.apache.tomcat.util.http.Cookies=off +log4j.category.net.sf.json=error +log4j.category.org.springframework=error +log4j.category.com.fp.commondb.PersistenceManager=info +log4j.category.com.fp.bpmlib=info + + + diff --git a/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/entries b/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/entries new file mode 100644 index 0000000..1c57306 --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/environment-eap6/src/main/resources/META-INF +svn://172.17.26.185/COMACO + + + +2014-09-11T06:13:12.553770Z +659 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +Taskorm.xml +file + + + + +2022-07-28T03:40:23.152718Z +a8eb210e9efe8f0a857f54251813f5fe +2014-09-11T06:13:12.553770Z +659 +jvaca + + + + + + + + + + + + + + + + + + + + + +45185 + +Servicesorm.xml +file + + + + +2022-07-28T03:40:23.153718Z +cb3156c534953d04e9a587754cb1217d +2014-09-11T06:13:12.553770Z +659 +jvaca + + + + + + + + + + + + + + + + + + + + + +9902 + +persistence.xml +file + + + + +2022-07-28T03:40:23.153718Z +86bf04187d0b7f1beea0ab3b0945aa6b +2014-09-11T06:13:12.553770Z +659 +jvaca + + + + + + + + + + + + + + + + + + + + + +5217 + +JBPMorm.xml +file + + + + +2022-07-28T03:40:23.153718Z +152833f30a88745a123a0720abcaef8b +2014-09-11T06:13:12.553770Z +659 +jvaca + + + + + + + + + + + + + + + + + + + + + +1273 + +TaskAuditorm.xml +file + + + + +2022-07-28T03:40:23.153718Z +ca76037d90a20efb70dcfd13f140d1bb +2014-09-11T06:13:12.553770Z +659 +jvaca + + + + + + + + + + + + + + + + + + + + + +1869 + +Executor-orm.xml +file + + + + +2022-07-28T03:40:23.154718Z +c304f3ee3a33c29170f66284a96fb12c +2014-09-11T06:13:12.553770Z +659 +jvaca + + + + + + + + + + + + + + + + + + + + + +2843 + diff --git a/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/text-base/Executor-orm.xml.svn-base b/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/text-base/Executor-orm.xml.svn-base new file mode 100644 index 0000000..eec1cf5 --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/text-base/Executor-orm.xml.svn-base @@ -0,0 +1,84 @@ + + + + + Select r from RequestInfo as r where (r.status ='QUEUED' or r.status = 'RETRYING') and r.time < :now ORDER BY r.time DESC + + + + + Select r from RequestInfo as r where (r.status ='QUEUED' or r.status ='RETRYING') and id = :id + + + + + Select r from RequestInfo as r where r.status ='RUNNING' + + + + + Select r from RequestInfo as r where r.status ='QUEUED' + + + + + Select r from RequestInfo as r where r.status ='QUEUED' and r.time > :now ORDER BY r.time ASC + + + + + Select r from RequestInfo as r where r.status ='DONE' + + + + + + Select r from RequestInfo as r where r.status ='ERROR' + + + + + + Select r from RequestInfo as r where r.status ='CANCELLED' + + + + + + Select r from RequestInfo as r + + + + + + Select e from ErrorInfo as e + + + + + + Select e from ErrorInfo as e where e.requestInfo.id = :id + + + + + + Select r from RequestInfo as r where r.status in (:statuses) ORDER BY r.time DESC + + + + + + Select r from RequestInfo as r where r.key = :businessKey + + + + + Select r from RequestInfo as r where (r.status ='QUEUED' or r.status = 'RETRYING') and r.time < :now + + + + diff --git a/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/text-base/JBPMorm.xml.svn-base b/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/text-base/JBPMorm.xml.svn-base new file mode 100644 index 0000000..1300b1e --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/text-base/JBPMorm.xml.svn-base @@ -0,0 +1,44 @@ + + + + + +select + processInstanceInfo.processInstanceId +from + ProcessInstanceInfo processInstanceInfo join processInstanceInfo.eventTypes eventTypes +where + eventTypes = :type + + + + + +select + key.processInstanceId +from + CorrelationKeyInfo key + left join key.properties props +where + cast(:elem_count as integer) = + (select count(id) from CorrelationPropertyInfo cpi where cpi.correlationKey.id = key.id) and + props.value in :properties + group by key.id,key.processInstanceId +having count(key.id) = :elem_count + + + + +select + key +from + CorrelationKeyInfo key +where + key.processInstanceId = :pId + + + diff --git a/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/text-base/Servicesorm.xml.svn-base b/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/text-base/Servicesorm.xml.svn-base new file mode 100644 index 0000000..01762d4 --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/text-base/Servicesorm.xml.svn-base @@ -0,0 +1,372 @@ + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + ORDER BY + log.processId, log.start + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.status in (:states) + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.status in (:states) and log.identity = :initiator + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.externalId=:externalId + and log.status in (:states) + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.processId =:processDefId + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.processInstanceId =:processId + + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.status in (:states) and log.processId like :processId + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.status in (:states) and log.processId like :processId and log.identity = :initiator + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.status in (:states) and log.processName like :processName + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.status in (:states) and log.processName like :processName and log.identity = :initiator + + + + + + + + select + new org.jbpm.kie.services.impl.model.NodeInstanceDesc( + log.nodeInstanceId, + log.nodeId, + log.nodeName, + log.nodeType, + log.externalId, + log.processInstanceId, + log.date, + log.connection, + log.type + ) + from + NodeInstanceLog log + where + log.processInstanceId=:processId AND log.externalId=:externalId AND log.type =:type + ORDER BY + log.date DESC, log.id DESC + + + + + + + + select + new org.jbpm.kie.services.impl.model.NodeInstanceDesc( + log.nodeInstanceId, + log.nodeId, + log.nodeName, + log.nodeType, + log.externalId, + log.processInstanceId, + log.date, + log.connection, + log.type + ) + from + NodeInstanceLog log + where + log.processInstanceId=:processId AND log.externalId=:externalId + ORDER BY + log.date DESC, log.id DESC + + + + + + + + select + new org.jbpm.kie.services.impl.model.NodeInstanceDesc( + log.nodeInstanceId, + log.nodeId, + log.nodeName, + log.nodeType, + log.externalId, + log.processInstanceId, + log.date, + log.connection, + log.type + ) + from + NodeInstanceLog log + where + log.nodeInstanceId in ( select nil.nodeInstanceId from NodeInstanceLog nil where nil.processInstanceId=:processId AND nil.externalId=:externalId + GROUP BY nil.nodeInstanceId + HAVING sum(nil.type) = 0) + and log.type = 0 + and log.processInstanceId=:processId + order by + log.id ASC + + + + + + + select + new org.jbpm.kie.services.impl.model.NodeInstanceDesc( + log.nodeInstanceId, + log.nodeId, + log.nodeName, + log.nodeType, + log.externalId, + log.processInstanceId, + log.date, + log.connection, + log.type + ) + from + NodeInstanceLog log + where + log.nodeInstanceId in (select nodeInstanceId from NodeInstanceLog nid where nid.processInstanceId=:processId AND nid.externalId=:externalId AND nid.type = 1 + GROUP BY nid.nodeInstanceId + HAVING sum(nid.type) >= 1) + and log.type = 1 + and log.processInstanceId=:processId + ORDER BY + log.nodeInstanceId, log.id ASC + + + + + + + + + select + new org.jbpm.kie.services.impl.model.VariableStateDesc( + log.variableId, + log.variableInstanceId, + log.oldValue, + log.value, + log.externalId, + log.processInstanceId, + log.date + ) + from + VariableInstanceLog log + where + log.processInstanceId =:processInstanceId AND log.id in (select max(vss.id) FROM VariableInstanceLog vss WHERE vss.processInstanceId =:processInstanceId group by vss.variableId ) order by log.id + + + + + + + select + new org.jbpm.kie.services.impl.model.VariableStateDesc( + log.variableId, + log.variableInstanceId, + log.oldValue, + log.value, + log.externalId, + log.processInstanceId, + log.date + ) + from + VariableInstanceLog log + where + log.processInstanceId =:processInstanceId AND log.variableId =:variableId + order by + log.id DESC + + + + + + \ No newline at end of file diff --git a/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/text-base/TaskAuditorm.xml.svn-base b/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/text-base/TaskAuditorm.xml.svn-base new file mode 100644 index 0000000..2f0266f --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/text-base/TaskAuditorm.xml.svn-base @@ -0,0 +1,42 @@ + + + + select t from TaskEventImpl t where t.taskId = :taskId + + + + select b from BAMTaskSummaryImpl b where b.taskId = :taskId + + + + delete from BAMTaskSummaryImpl b where b.taskId = :taskId + + + + delete from BAMTaskSummaryImpl b + + + + + + select a from AuditTaskImpl a order by a.taskId DESC + + + + + + select a from AuditTaskImpl a where a.actualOwner = :owner order by a.taskId DESC + + + + + + select a from AuditTaskImpl a where a.taskId = :taskId + + + + + diff --git a/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/text-base/Taskorm.xml.svn-base b/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/text-base/Taskorm.xml.svn-base new file mode 100644 index 0000000..ac0ebca --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/text-base/Taskorm.xml.svn-base @@ -0,0 +1,1297 @@ + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl businessAdministrator + where + t.archived = 0 and + businessAdministrator.id = :userId and + businessAdministrator in elements ( t.peopleAssignments.businessAdministrators ) + + + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl excludedOwners + where + t.archived = 0 and + excludedOwners.id = :userId and + excludedOwners in elements ( t.peopleAssignments.excludedOwners ) + + + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + potentialOwners.id = :userId and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + potentialOwners.id = :userId and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + + t.taskData.status in (:status) + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + t.taskData.status in (:status) + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t , + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t , + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + t.taskData.status in (:status) + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t , + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + t.taskData.actualOwner = null and + potentialOwners.id = :groupId and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + order by t.id DESC + + + + + + + select + + t.id, + potentialOwners.id + + from + TaskImpl t, + + OrganizationalEntityImpl potentialOwners + + where + + potentialOwners.id in (:groupIds) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.archived = 0 and + t.taskData.actualOwner = null and + + + + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + + + + + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + t.taskData.expirationTime = :expirationDate and + t.taskData.status in (:status) + order by t.id DESC + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + (t.taskData.expirationTime = :expirationDate or t.taskData.expirationTime is null) and + t.taskData.status in (:status) + order by t.id DESC + + + + + + + select + + t.id, + potentialOwners.id + + from + TaskImpl t, + + OrganizationalEntityImpl potentialOwners + + where + + potentialOwners.id in (:groupIds) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.archived = 0 and + t.taskData.actualOwner = null and + t.taskData.expirationTime = :expirationDate and + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + + + + + + + + + + + + select + t.id, + potentialOwners + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + + where + t.id in (:taskIds) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) + + + + + + + + + select + + t.id, + potentialOwners.id + + from + TaskImpl t, + + OrganizationalEntityImpl potentialOwners + + where + + potentialOwners.id in (:groupIds) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.archived = 0 and + t.taskData.actualOwner = null and + (t.taskData.expirationTime = :expirationDate or t.taskData.expirationTime is null) and + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + + + + + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + t.taskData.parentId = :parentId and + (potentialOwners.id = :userId or potentialOwners.id in (:groupIds)) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + order by t.id DESC + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + t.taskData.parentId = :parentId and + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + order by t.id DESC + + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl recipients + where + t.archived = 0 and + recipients.id = :userId and + recipients in elements ( t.peopleAssignments.recipients ) + + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl taskInitiator + where + t.archived = 0 and + taskInitiator.id = :userId and + taskInitiator = t.peopleAssignments.taskInitiator + + + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl taskStakeholder + where + t.archived = 0 and + taskStakeholder.id = :userId and + taskStakeholder in elements ( t.peopleAssignments.taskStakeholders ) + + + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + where + t.archived = 0 and + t.taskData.actualOwner.id = :userId + + + order by t.id DESC + + + + + + + select + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + left join t.peopleAssignments.potentialOwners potOwners + where + t.archived = 0 and + (t.taskData.actualOwner.id = :userId or potOwners.id = :userId) and + t.taskData.status in (:status) and + t.taskData.expirationTime = :expirationDate + + order by t.id DESC + + + + + + + select + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + left join t.peopleAssignments.potentialOwners potOwners + where + t.archived = 0 and + (t.taskData.actualOwner.id = :userId or potOwners.id = :userId) and + t.taskData.status in (:status) and + t.taskData.expirationTime < :date + + order by t.id DESC + + + + + + + select + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + left join t.peopleAssignments.potentialOwners potOwners + where + t.archived = 0 and + (t.taskData.actualOwner.id = :userId or potOwners.id = :userId) and + t.taskData.status in (:status) and + (t.taskData.expirationTime = :expirationDate or + t.taskData.expirationTime is null) + + + order by t.id DESC + + + + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + where + t.archived = 0 and + t.taskData.status = :status + order by t.id DESC + + + + + + select + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + where + t.archived = 0 and + t.taskData.status = :status and + + + + t.taskData.activationTime < :since + + order by t.id DESC + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + where + t.archived = 1 + + + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + where + t.archived = 0 and + t.taskData.actualOwner.id = :userId and + t.taskData.status in (:status) + + + order by t.id DESC + + + + + + + + select + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + where + t.id in (:taskIds) + order by t.id DESC + + + + + + + + select + + t.id, + potentialOwners.id + + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + + where + + t.id in (:taskIds) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.archived = 0 and + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + + + + + + + + + + + select + new org.jbpm.services.task.query.DeadlineSummaryImpl( + t.id, + d.id, + d.date) + from + TaskImpl t, + DeadlineImpl d + where + t.archived = 0 and + d in elements( t.deadlines.endDeadlines ) and + d.escalated = 0 + order by + d.date + + + + + + + select + new org.jbpm.services.task.query.DeadlineSummaryImpl( + t.id, + d.id, + d.date) + from + TaskImpl t, + DeadlineImpl d + where + t.archived = 0 and + d in elements( t.deadlines.startDeadlines ) and + d.escalated = 0 + order by + d.date + + + + + + select + new org.jbpm.services.task.query.DeadlineSummaryImpl( + t.id, + d.id, + d.date) + from + TaskImpl t, + DeadlineImpl d + where + t.id = :taskId and + t.archived = 0 and + d in elements( t.deadlines.endDeadlines ) and + d.escalated = 0 + order by + d.date + + + + + + + select + new org.jbpm.services.task.query.DeadlineSummaryImpl( + t.id, + d.id, + d.date) + from + TaskImpl t, + DeadlineImpl d + where + t.id = :taskId and + t.archived = 0 and + d in elements( t.deadlines.startDeadlines ) and + d.escalated = 0 + order by + d.date + + + + + + select + t + from + TaskImpl t + where + t.archived = 0 and + t.taskData.workItemId = :workItemId + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + where + t.archived = 0 and + t.taskData.processInstanceId = :processInstanceId and + + + t.taskData.status in (:status) + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + where + t.archived = 0 and + t.taskData.processInstanceId = :processInstanceId and + t.name = :taskName and + t.taskData.status in (:status) + order by t.id DESC + + + + + + select + t.id + from + TaskImpl t + where + t.archived = 0 and + t.taskData.processInstanceId = :processInstanceId + + + + + + + + + select + a + from + TaskImpl t + join t.taskData.attachments as a + where + t.id = :taskId + + + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.taskData.status in (:status) + order by t.id DESC + + + + + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t , + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + (t.taskData.expirationTime = :expirationDate or t.taskData.expirationTime is null) and + t.taskData.status in (:status) + order by t.id DESC + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t , + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + t.taskData.expirationTime = :expirationDate and + t.taskData.status in (:status) + order by t.id DESC + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.taskData.status in (:status) + order by t.id DESC + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + (t.taskData.expirationTime = :expirationDate or t.taskData.expirationTime is null) and + t.taskData.status in (:status) + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.taskData.expirationTime = :expirationDate and + t.taskData.status in (:status) + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + where + t.archived = 0 and + t.taskData.actualOwner.id = :userId and + t.taskData.status in (:status) + order by t.id DESC + + + + + diff --git a/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/text-base/persistence.xml.netbeans-base b/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/text-base/persistence.xml.netbeans-base new file mode 100644 index 0000000..a243d13 --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/text-base/persistence.xml.netbeans-base @@ -0,0 +1,94 @@ + + + + + org.hibernate.ejb.HibernatePersistence + java:jboss/datasources/jbpmDS + META-INF/Taskorm.xml + META-INF/JBPMorm.xml + META-INF/Executor-orm.xml + META-INF/Servicesorm.xml + META-INF/TaskAuditorm.xml + + + org.jbpm.services.task.impl.model.AttachmentImpl + org.jbpm.services.task.impl.model.ContentImpl + org.jbpm.services.task.impl.model.BooleanExpressionImpl + org.jbpm.services.task.impl.model.CommentImpl + org.jbpm.services.task.impl.model.DeadlineImpl + org.jbpm.services.task.impl.model.DelegationImpl + org.jbpm.services.task.impl.model.EscalationImpl + org.jbpm.services.task.impl.model.GroupImpl + org.jbpm.services.task.impl.model.I18NTextImpl + org.jbpm.services.task.impl.model.NotificationImpl + org.jbpm.services.task.impl.model.EmailNotificationImpl + org.jbpm.services.task.impl.model.EmailNotificationHeaderImpl + org.jbpm.services.task.impl.model.PeopleAssignmentsImpl + org.jbpm.services.task.impl.model.ReassignmentImpl + org.jbpm.services.task.impl.model.TaskImpl + org.jbpm.services.task.impl.model.TaskDefImpl + org.jbpm.services.task.impl.model.TaskDataImpl + org.jbpm.services.task.impl.model.UserImpl + org.jbpm.executor.entities.ErrorInfo + org.jbpm.executor.entities.RequestInfo + + org.jbpm.services.task.audit.impl.model.TaskEventImpl + + + org.jbpm.services.task.audit.impl.model.AuditTaskImpl + + + org.jbpm.services.task.audit.impl.model.BAMTaskSummaryImpl + + + org.drools.persistence.info.SessionInfo + org.jbpm.persistence.processinstance.ProcessInstanceInfo + org.drools.persistence.info.WorkItemInfo + org.jbpm.persistence.correlation.CorrelationKeyInfo + org.jbpm.persistence.correlation.CorrelationPropertyInfo + + org.jbpm.runtime.manager.impl.jpa.ContextMappingInfo + + + org.jbpm.process.audit.ProcessInstanceLog + org.jbpm.process.audit.NodeInstanceLog + org.jbpm.process.audit.VariableInstanceLog + + + + + + + + + + + + + + + + org.hibernate.ejb.HibernatePersistence + java:jboss/datasources/FLIPDS1 + + + + + + + + + + + + + + + + + + diff --git a/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/text-base/persistence.xml.svn-base b/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/text-base/persistence.xml.svn-base new file mode 100644 index 0000000..a243d13 --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/META-INF/.svn/text-base/persistence.xml.svn-base @@ -0,0 +1,94 @@ + + + + + org.hibernate.ejb.HibernatePersistence + java:jboss/datasources/jbpmDS + META-INF/Taskorm.xml + META-INF/JBPMorm.xml + META-INF/Executor-orm.xml + META-INF/Servicesorm.xml + META-INF/TaskAuditorm.xml + + + org.jbpm.services.task.impl.model.AttachmentImpl + org.jbpm.services.task.impl.model.ContentImpl + org.jbpm.services.task.impl.model.BooleanExpressionImpl + org.jbpm.services.task.impl.model.CommentImpl + org.jbpm.services.task.impl.model.DeadlineImpl + org.jbpm.services.task.impl.model.DelegationImpl + org.jbpm.services.task.impl.model.EscalationImpl + org.jbpm.services.task.impl.model.GroupImpl + org.jbpm.services.task.impl.model.I18NTextImpl + org.jbpm.services.task.impl.model.NotificationImpl + org.jbpm.services.task.impl.model.EmailNotificationImpl + org.jbpm.services.task.impl.model.EmailNotificationHeaderImpl + org.jbpm.services.task.impl.model.PeopleAssignmentsImpl + org.jbpm.services.task.impl.model.ReassignmentImpl + org.jbpm.services.task.impl.model.TaskImpl + org.jbpm.services.task.impl.model.TaskDefImpl + org.jbpm.services.task.impl.model.TaskDataImpl + org.jbpm.services.task.impl.model.UserImpl + org.jbpm.executor.entities.ErrorInfo + org.jbpm.executor.entities.RequestInfo + + org.jbpm.services.task.audit.impl.model.TaskEventImpl + + + org.jbpm.services.task.audit.impl.model.AuditTaskImpl + + + org.jbpm.services.task.audit.impl.model.BAMTaskSummaryImpl + + + org.drools.persistence.info.SessionInfo + org.jbpm.persistence.processinstance.ProcessInstanceInfo + org.drools.persistence.info.WorkItemInfo + org.jbpm.persistence.correlation.CorrelationKeyInfo + org.jbpm.persistence.correlation.CorrelationPropertyInfo + + org.jbpm.runtime.manager.impl.jpa.ContextMappingInfo + + + org.jbpm.process.audit.ProcessInstanceLog + org.jbpm.process.audit.NodeInstanceLog + org.jbpm.process.audit.VariableInstanceLog + + + + + + + + + + + + + + + + org.hibernate.ejb.HibernatePersistence + java:jboss/datasources/FLIPDS1 + + + + + + + + + + + + + + + + + + diff --git a/clients/comaco/environment-eap6/src/main/resources/META-INF/Executor-orm.xml b/clients/comaco/environment-eap6/src/main/resources/META-INF/Executor-orm.xml new file mode 100644 index 0000000..eec1cf5 --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/META-INF/Executor-orm.xml @@ -0,0 +1,84 @@ + + + + + Select r from RequestInfo as r where (r.status ='QUEUED' or r.status = 'RETRYING') and r.time < :now ORDER BY r.time DESC + + + + + Select r from RequestInfo as r where (r.status ='QUEUED' or r.status ='RETRYING') and id = :id + + + + + Select r from RequestInfo as r where r.status ='RUNNING' + + + + + Select r from RequestInfo as r where r.status ='QUEUED' + + + + + Select r from RequestInfo as r where r.status ='QUEUED' and r.time > :now ORDER BY r.time ASC + + + + + Select r from RequestInfo as r where r.status ='DONE' + + + + + + Select r from RequestInfo as r where r.status ='ERROR' + + + + + + Select r from RequestInfo as r where r.status ='CANCELLED' + + + + + + Select r from RequestInfo as r + + + + + + Select e from ErrorInfo as e + + + + + + Select e from ErrorInfo as e where e.requestInfo.id = :id + + + + + + Select r from RequestInfo as r where r.status in (:statuses) ORDER BY r.time DESC + + + + + + Select r from RequestInfo as r where r.key = :businessKey + + + + + Select r from RequestInfo as r where (r.status ='QUEUED' or r.status = 'RETRYING') and r.time < :now + + + + diff --git a/clients/comaco/environment-eap6/src/main/resources/META-INF/JBPMorm.xml b/clients/comaco/environment-eap6/src/main/resources/META-INF/JBPMorm.xml new file mode 100644 index 0000000..1300b1e --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/META-INF/JBPMorm.xml @@ -0,0 +1,44 @@ + + + + + +select + processInstanceInfo.processInstanceId +from + ProcessInstanceInfo processInstanceInfo join processInstanceInfo.eventTypes eventTypes +where + eventTypes = :type + + + + + +select + key.processInstanceId +from + CorrelationKeyInfo key + left join key.properties props +where + cast(:elem_count as integer) = + (select count(id) from CorrelationPropertyInfo cpi where cpi.correlationKey.id = key.id) and + props.value in :properties + group by key.id,key.processInstanceId +having count(key.id) = :elem_count + + + + +select + key +from + CorrelationKeyInfo key +where + key.processInstanceId = :pId + + + diff --git a/clients/comaco/environment-eap6/src/main/resources/META-INF/Servicesorm.xml b/clients/comaco/environment-eap6/src/main/resources/META-INF/Servicesorm.xml new file mode 100644 index 0000000..01762d4 --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/META-INF/Servicesorm.xml @@ -0,0 +1,372 @@ + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + ORDER BY + log.processId, log.start + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.status in (:states) + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.status in (:states) and log.identity = :initiator + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.externalId=:externalId + and log.status in (:states) + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.processId =:processDefId + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.processInstanceId =:processId + + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.status in (:states) and log.processId like :processId + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.status in (:states) and log.processId like :processId and log.identity = :initiator + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.status in (:states) and log.processName like :processName + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.status in (:states) and log.processName like :processName and log.identity = :initiator + + + + + + + + select + new org.jbpm.kie.services.impl.model.NodeInstanceDesc( + log.nodeInstanceId, + log.nodeId, + log.nodeName, + log.nodeType, + log.externalId, + log.processInstanceId, + log.date, + log.connection, + log.type + ) + from + NodeInstanceLog log + where + log.processInstanceId=:processId AND log.externalId=:externalId AND log.type =:type + ORDER BY + log.date DESC, log.id DESC + + + + + + + + select + new org.jbpm.kie.services.impl.model.NodeInstanceDesc( + log.nodeInstanceId, + log.nodeId, + log.nodeName, + log.nodeType, + log.externalId, + log.processInstanceId, + log.date, + log.connection, + log.type + ) + from + NodeInstanceLog log + where + log.processInstanceId=:processId AND log.externalId=:externalId + ORDER BY + log.date DESC, log.id DESC + + + + + + + + select + new org.jbpm.kie.services.impl.model.NodeInstanceDesc( + log.nodeInstanceId, + log.nodeId, + log.nodeName, + log.nodeType, + log.externalId, + log.processInstanceId, + log.date, + log.connection, + log.type + ) + from + NodeInstanceLog log + where + log.nodeInstanceId in ( select nil.nodeInstanceId from NodeInstanceLog nil where nil.processInstanceId=:processId AND nil.externalId=:externalId + GROUP BY nil.nodeInstanceId + HAVING sum(nil.type) = 0) + and log.type = 0 + and log.processInstanceId=:processId + order by + log.id ASC + + + + + + + select + new org.jbpm.kie.services.impl.model.NodeInstanceDesc( + log.nodeInstanceId, + log.nodeId, + log.nodeName, + log.nodeType, + log.externalId, + log.processInstanceId, + log.date, + log.connection, + log.type + ) + from + NodeInstanceLog log + where + log.nodeInstanceId in (select nodeInstanceId from NodeInstanceLog nid where nid.processInstanceId=:processId AND nid.externalId=:externalId AND nid.type = 1 + GROUP BY nid.nodeInstanceId + HAVING sum(nid.type) >= 1) + and log.type = 1 + and log.processInstanceId=:processId + ORDER BY + log.nodeInstanceId, log.id ASC + + + + + + + + + select + new org.jbpm.kie.services.impl.model.VariableStateDesc( + log.variableId, + log.variableInstanceId, + log.oldValue, + log.value, + log.externalId, + log.processInstanceId, + log.date + ) + from + VariableInstanceLog log + where + log.processInstanceId =:processInstanceId AND log.id in (select max(vss.id) FROM VariableInstanceLog vss WHERE vss.processInstanceId =:processInstanceId group by vss.variableId ) order by log.id + + + + + + + select + new org.jbpm.kie.services.impl.model.VariableStateDesc( + log.variableId, + log.variableInstanceId, + log.oldValue, + log.value, + log.externalId, + log.processInstanceId, + log.date + ) + from + VariableInstanceLog log + where + log.processInstanceId =:processInstanceId AND log.variableId =:variableId + order by + log.id DESC + + + + + + \ No newline at end of file diff --git a/clients/comaco/environment-eap6/src/main/resources/META-INF/TaskAuditorm.xml b/clients/comaco/environment-eap6/src/main/resources/META-INF/TaskAuditorm.xml new file mode 100644 index 0000000..2f0266f --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/META-INF/TaskAuditorm.xml @@ -0,0 +1,42 @@ + + + + select t from TaskEventImpl t where t.taskId = :taskId + + + + select b from BAMTaskSummaryImpl b where b.taskId = :taskId + + + + delete from BAMTaskSummaryImpl b where b.taskId = :taskId + + + + delete from BAMTaskSummaryImpl b + + + + + + select a from AuditTaskImpl a order by a.taskId DESC + + + + + + select a from AuditTaskImpl a where a.actualOwner = :owner order by a.taskId DESC + + + + + + select a from AuditTaskImpl a where a.taskId = :taskId + + + + + diff --git a/clients/comaco/environment-eap6/src/main/resources/META-INF/Taskorm.xml b/clients/comaco/environment-eap6/src/main/resources/META-INF/Taskorm.xml new file mode 100644 index 0000000..ac0ebca --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/META-INF/Taskorm.xml @@ -0,0 +1,1297 @@ + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl businessAdministrator + where + t.archived = 0 and + businessAdministrator.id = :userId and + businessAdministrator in elements ( t.peopleAssignments.businessAdministrators ) + + + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl excludedOwners + where + t.archived = 0 and + excludedOwners.id = :userId and + excludedOwners in elements ( t.peopleAssignments.excludedOwners ) + + + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + potentialOwners.id = :userId and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + potentialOwners.id = :userId and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + + t.taskData.status in (:status) + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + t.taskData.status in (:status) + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t , + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t , + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + t.taskData.status in (:status) + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t , + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + t.taskData.actualOwner = null and + potentialOwners.id = :groupId and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + order by t.id DESC + + + + + + + select + + t.id, + potentialOwners.id + + from + TaskImpl t, + + OrganizationalEntityImpl potentialOwners + + where + + potentialOwners.id in (:groupIds) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.archived = 0 and + t.taskData.actualOwner = null and + + + + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + + + + + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + t.taskData.expirationTime = :expirationDate and + t.taskData.status in (:status) + order by t.id DESC + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + (t.taskData.expirationTime = :expirationDate or t.taskData.expirationTime is null) and + t.taskData.status in (:status) + order by t.id DESC + + + + + + + select + + t.id, + potentialOwners.id + + from + TaskImpl t, + + OrganizationalEntityImpl potentialOwners + + where + + potentialOwners.id in (:groupIds) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.archived = 0 and + t.taskData.actualOwner = null and + t.taskData.expirationTime = :expirationDate and + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + + + + + + + + + + + + select + t.id, + potentialOwners + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + + where + t.id in (:taskIds) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) + + + + + + + + + select + + t.id, + potentialOwners.id + + from + TaskImpl t, + + OrganizationalEntityImpl potentialOwners + + where + + potentialOwners.id in (:groupIds) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.archived = 0 and + t.taskData.actualOwner = null and + (t.taskData.expirationTime = :expirationDate or t.taskData.expirationTime is null) and + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + + + + + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + t.taskData.parentId = :parentId and + (potentialOwners.id = :userId or potentialOwners.id in (:groupIds)) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + order by t.id DESC + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + t.taskData.parentId = :parentId and + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + order by t.id DESC + + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl recipients + where + t.archived = 0 and + recipients.id = :userId and + recipients in elements ( t.peopleAssignments.recipients ) + + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl taskInitiator + where + t.archived = 0 and + taskInitiator.id = :userId and + taskInitiator = t.peopleAssignments.taskInitiator + + + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl taskStakeholder + where + t.archived = 0 and + taskStakeholder.id = :userId and + taskStakeholder in elements ( t.peopleAssignments.taskStakeholders ) + + + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + where + t.archived = 0 and + t.taskData.actualOwner.id = :userId + + + order by t.id DESC + + + + + + + select + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + left join t.peopleAssignments.potentialOwners potOwners + where + t.archived = 0 and + (t.taskData.actualOwner.id = :userId or potOwners.id = :userId) and + t.taskData.status in (:status) and + t.taskData.expirationTime = :expirationDate + + order by t.id DESC + + + + + + + select + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + left join t.peopleAssignments.potentialOwners potOwners + where + t.archived = 0 and + (t.taskData.actualOwner.id = :userId or potOwners.id = :userId) and + t.taskData.status in (:status) and + t.taskData.expirationTime < :date + + order by t.id DESC + + + + + + + select + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + left join t.peopleAssignments.potentialOwners potOwners + where + t.archived = 0 and + (t.taskData.actualOwner.id = :userId or potOwners.id = :userId) and + t.taskData.status in (:status) and + (t.taskData.expirationTime = :expirationDate or + t.taskData.expirationTime is null) + + + order by t.id DESC + + + + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + where + t.archived = 0 and + t.taskData.status = :status + order by t.id DESC + + + + + + select + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + where + t.archived = 0 and + t.taskData.status = :status and + + + + t.taskData.activationTime < :since + + order by t.id DESC + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + where + t.archived = 1 + + + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + where + t.archived = 0 and + t.taskData.actualOwner.id = :userId and + t.taskData.status in (:status) + + + order by t.id DESC + + + + + + + + select + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + where + t.id in (:taskIds) + order by t.id DESC + + + + + + + + select + + t.id, + potentialOwners.id + + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + + where + + t.id in (:taskIds) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.archived = 0 and + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + + + + + + + + + + + select + new org.jbpm.services.task.query.DeadlineSummaryImpl( + t.id, + d.id, + d.date) + from + TaskImpl t, + DeadlineImpl d + where + t.archived = 0 and + d in elements( t.deadlines.endDeadlines ) and + d.escalated = 0 + order by + d.date + + + + + + + select + new org.jbpm.services.task.query.DeadlineSummaryImpl( + t.id, + d.id, + d.date) + from + TaskImpl t, + DeadlineImpl d + where + t.archived = 0 and + d in elements( t.deadlines.startDeadlines ) and + d.escalated = 0 + order by + d.date + + + + + + select + new org.jbpm.services.task.query.DeadlineSummaryImpl( + t.id, + d.id, + d.date) + from + TaskImpl t, + DeadlineImpl d + where + t.id = :taskId and + t.archived = 0 and + d in elements( t.deadlines.endDeadlines ) and + d.escalated = 0 + order by + d.date + + + + + + + select + new org.jbpm.services.task.query.DeadlineSummaryImpl( + t.id, + d.id, + d.date) + from + TaskImpl t, + DeadlineImpl d + where + t.id = :taskId and + t.archived = 0 and + d in elements( t.deadlines.startDeadlines ) and + d.escalated = 0 + order by + d.date + + + + + + select + t + from + TaskImpl t + where + t.archived = 0 and + t.taskData.workItemId = :workItemId + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + where + t.archived = 0 and + t.taskData.processInstanceId = :processInstanceId and + + + t.taskData.status in (:status) + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + where + t.archived = 0 and + t.taskData.processInstanceId = :processInstanceId and + t.name = :taskName and + t.taskData.status in (:status) + order by t.id DESC + + + + + + select + t.id + from + TaskImpl t + where + t.archived = 0 and + t.taskData.processInstanceId = :processInstanceId + + + + + + + + + select + a + from + TaskImpl t + join t.taskData.attachments as a + where + t.id = :taskId + + + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.taskData.status in (:status) + order by t.id DESC + + + + + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t , + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + (t.taskData.expirationTime = :expirationDate or t.taskData.expirationTime is null) and + t.taskData.status in (:status) + order by t.id DESC + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t , + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + t.taskData.expirationTime = :expirationDate and + t.taskData.status in (:status) + order by t.id DESC + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.taskData.status in (:status) + order by t.id DESC + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + (t.taskData.expirationTime = :expirationDate or t.taskData.expirationTime is null) and + t.taskData.status in (:status) + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.taskData.expirationTime = :expirationDate and + t.taskData.status in (:status) + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + where + t.archived = 0 and + t.taskData.actualOwner.id = :userId and + t.taskData.status in (:status) + order by t.id DESC + + + + + diff --git a/clients/comaco/environment-eap6/src/main/resources/META-INF/persistence.xml b/clients/comaco/environment-eap6/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000..522239a --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,94 @@ + + + + + org.hibernate.ejb.HibernatePersistence + java:jboss/datasources/jbpmDS + META-INF/Taskorm.xml + META-INF/JBPMorm.xml + META-INF/Executor-orm.xml + META-INF/Servicesorm.xml + META-INF/TaskAuditorm.xml + + org.jbpm.services.task.impl.model.AttachmentImpl + org.jbpm.services.task.impl.model.ContentImpl + org.jbpm.services.task.impl.model.BooleanExpressionImpl + org.jbpm.services.task.impl.model.CommentImpl + org.jbpm.services.task.impl.model.DeadlineImpl + org.jbpm.services.task.impl.model.DelegationImpl + org.jbpm.services.task.impl.model.EscalationImpl + org.jbpm.services.task.impl.model.GroupImpl + org.jbpm.services.task.impl.model.I18NTextImpl + org.jbpm.services.task.impl.model.NotificationImpl + org.jbpm.services.task.impl.model.EmailNotificationImpl + org.jbpm.services.task.impl.model.EmailNotificationHeaderImpl + org.jbpm.services.task.impl.model.PeopleAssignmentsImpl + org.jbpm.services.task.impl.model.ReassignmentImpl + org.jbpm.services.task.impl.model.TaskImpl + org.jbpm.services.task.impl.model.TaskDefImpl + org.jbpm.services.task.impl.model.TaskDataImpl + org.jbpm.services.task.impl.model.UserImpl + org.jbpm.executor.entities.ErrorInfo + org.jbpm.executor.entities.RequestInfo + + org.jbpm.services.task.audit.impl.model.TaskEventImpl + + + org.jbpm.services.task.audit.impl.model.AuditTaskImpl + + + org.jbpm.services.task.audit.impl.model.BAMTaskSummaryImpl + + + org.drools.persistence.info.SessionInfo + org.jbpm.persistence.processinstance.ProcessInstanceInfo + org.drools.persistence.info.WorkItemInfo + org.jbpm.persistence.correlation.CorrelationKeyInfo + org.jbpm.persistence.correlation.CorrelationPropertyInfo + + org.jbpm.runtime.manager.impl.jpa.ContextMappingInfo + + + org.jbpm.process.audit.ProcessInstanceLog + org.jbpm.process.audit.NodeInstanceLog + org.jbpm.process.audit.VariableInstanceLog + + + + + + + + + + + + + + + + + org.hibernate.ejb.HibernatePersistence + java:jboss/datasources/FLIPDS1 + + + + + + + + + + + + + + + + + + diff --git a/clients/comaco/environment-eap6/src/main/resources/bpm.properties b/clients/comaco/environment-eap6/src/main/resources/bpm.properties new file mode 100644 index 0000000..5444a7a --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/bpm.properties @@ -0,0 +1,16 @@ +guvnor.url=http\://127.0.0.1\:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/{0}/{1} +vnor.url=http\://127.0.0.1\:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/{0}/{1} +guvnor.change.set= +guvnor.security.basicAuthentication=enabled +guvnor.security.username=gfiallos +guvnor.security.password=gfiallos +guvnor.refresh=false +bpm.memory=false +#task.ip=192.168.2.210 +task.ip=127.0.0.1 +task.ip.server=0.0.0.0 +task.port=9123 +flows.package=maia.flows +flows.snapshot=LATEST +inbox.icon.path=images/bpm/ +inbox.icon.extension=.gif diff --git a/clients/comaco/environment-eap6/src/main/resources/common.properties b/clients/comaco/environment-eap6/src/main/resources/common.properties new file mode 100644 index 0000000..e332127 --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/common.properties @@ -0,0 +1,9 @@ +bean.class.path=/logs/fp +#codigo de moneda oficial +localCurrency=USD +# True indica que la aplicacion trabaja con tasas nominales, false indica que la aplicacion trabaja con tasas efectiva. +nominalRate=true +# Parametro que define el numero de dias de retencion default de valores depositados en cheque. +localhold=2 +#tipos de saldo sobre los cuales se paga intereses en cuentas a la vista +btypeinterest=Cash-Locked-Pawned \ No newline at end of file diff --git a/clients/comaco/environment-eap6/src/main/resources/fb-facade.properties b/clients/comaco/environment-eap6/src/main/resources/fb-facade.properties new file mode 100644 index 0000000..4d0474f --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/fb-facade.properties @@ -0,0 +1,3 @@ +ear=maiaear-2.1/ +bean=FacadeBean/remote +defaultcompany=1 \ No newline at end of file diff --git a/clients/comaco/environment-eap6/src/main/resources/hibernateFlipMapping.cfg.xml b/clients/comaco/environment-eap6/src/main/resources/hibernateFlipMapping.cfg.xml new file mode 100644 index 0000000..1f4a7d6 --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/hibernateFlipMapping.cfg.xml @@ -0,0 +1,273 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/clients/comaco/environment-eap6/src/main/resources/log4j.properties b/clients/comaco/environment-eap6/src/main/resources/log4j.properties new file mode 100644 index 0000000..a150115 --- /dev/null +++ b/clients/comaco/environment-eap6/src/main/resources/log4j.properties @@ -0,0 +1,18 @@ +log4j.rootLogger=error,com.fp +log4j.logger.com.fp=error +log4j.appender.com.fp=org.apache.log4j.ConsoleAppender +log4j.appender.com.fp.layout=org.apache.log4j.PatternLayout +#log4j.appender.com.fp.layout.ConversionPattern=%d{dd-MMM-yyyy HH\:mm\:ss.SSS} %p [%t] <%l> - %m%n +log4j.appender.com.fp.layout.ConversionPattern=%d{HH\:mm\:ss.SSS} %p [%t] <%l> - %m%n +log4j.category.org.hibernate=fatal +log4j.category.javax=error +log4j.category.org.hibernate.cfg.AnnotationBinder=off +log4j.category.org.hibernate.cfg.annotations.EntityBinder=off +log4j.category.org.apache.tomcat.util.http.Cookies=off +log4j.category.net.sf.json=error +log4j.category.org.springframework=error +log4j.category.com.fp.commondb.PersistenceManager=info +log4j.category.com.fp.bpmlib=info + + + diff --git a/clients/comaco/environment-eap6/src/test/.svn/entries b/clients/comaco/environment-eap6/src/test/.svn/entries new file mode 100644 index 0000000..f340e73 --- /dev/null +++ b/clients/comaco/environment-eap6/src/test/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/environment-eap6/src/test +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + diff --git a/clients/comaco/environment-eap6/src/test/java/.svn/entries b/clients/comaco/environment-eap6/src/test/java/.svn/entries new file mode 100644 index 0000000..882ee2b --- /dev/null +++ b/clients/comaco/environment-eap6/src/test/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/environment-eap6/src/test/java +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/clients/comaco/environment-eap6/src/test/java/com/.svn/entries b/clients/comaco/environment-eap6/src/test/java/com/.svn/entries new file mode 100644 index 0000000..aae3f8b --- /dev/null +++ b/clients/comaco/environment-eap6/src/test/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/environment-eap6/src/test/java/com +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/clients/comaco/environment-eap6/src/test/java/com/fp/.svn/entries b/clients/comaco/environment-eap6/src/test/java/com/fp/.svn/entries new file mode 100644 index 0000000..6c82478 --- /dev/null +++ b/clients/comaco/environment-eap6/src/test/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/environment-eap6/src/test/java/com/fp +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +clients +dir + diff --git a/clients/comaco/environment-eap6/src/test/java/com/fp/clients/.svn/entries b/clients/comaco/environment-eap6/src/test/java/com/fp/clients/.svn/entries new file mode 100644 index 0000000..3c882f2 --- /dev/null +++ b/clients/comaco/environment-eap6/src/test/java/com/fp/clients/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/environment-eap6/src/test/java/com/fp/clients +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +maia +dir + diff --git a/clients/comaco/environment-eap6/src/test/java/com/fp/clients/maia/.svn/entries b/clients/comaco/environment-eap6/src/test/java/com/fp/clients/maia/.svn/entries new file mode 100644 index 0000000..050ad3a --- /dev/null +++ b/clients/comaco/environment-eap6/src/test/java/com/fp/clients/maia/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/clients/comaco/environment-eap6/src/test/java/com/fp/clients/maia +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + diff --git a/clients/comaco/environment-eap6/target/classes/META-INF/Executor-orm.xml b/clients/comaco/environment-eap6/target/classes/META-INF/Executor-orm.xml new file mode 100644 index 0000000..eec1cf5 --- /dev/null +++ b/clients/comaco/environment-eap6/target/classes/META-INF/Executor-orm.xml @@ -0,0 +1,84 @@ + + + + + Select r from RequestInfo as r where (r.status ='QUEUED' or r.status = 'RETRYING') and r.time < :now ORDER BY r.time DESC + + + + + Select r from RequestInfo as r where (r.status ='QUEUED' or r.status ='RETRYING') and id = :id + + + + + Select r from RequestInfo as r where r.status ='RUNNING' + + + + + Select r from RequestInfo as r where r.status ='QUEUED' + + + + + Select r from RequestInfo as r where r.status ='QUEUED' and r.time > :now ORDER BY r.time ASC + + + + + Select r from RequestInfo as r where r.status ='DONE' + + + + + + Select r from RequestInfo as r where r.status ='ERROR' + + + + + + Select r from RequestInfo as r where r.status ='CANCELLED' + + + + + + Select r from RequestInfo as r + + + + + + Select e from ErrorInfo as e + + + + + + Select e from ErrorInfo as e where e.requestInfo.id = :id + + + + + + Select r from RequestInfo as r where r.status in (:statuses) ORDER BY r.time DESC + + + + + + Select r from RequestInfo as r where r.key = :businessKey + + + + + Select r from RequestInfo as r where (r.status ='QUEUED' or r.status = 'RETRYING') and r.time < :now + + + + diff --git a/clients/comaco/environment-eap6/target/classes/META-INF/JBPMorm.xml b/clients/comaco/environment-eap6/target/classes/META-INF/JBPMorm.xml new file mode 100644 index 0000000..1300b1e --- /dev/null +++ b/clients/comaco/environment-eap6/target/classes/META-INF/JBPMorm.xml @@ -0,0 +1,44 @@ + + + + + +select + processInstanceInfo.processInstanceId +from + ProcessInstanceInfo processInstanceInfo join processInstanceInfo.eventTypes eventTypes +where + eventTypes = :type + + + + + +select + key.processInstanceId +from + CorrelationKeyInfo key + left join key.properties props +where + cast(:elem_count as integer) = + (select count(id) from CorrelationPropertyInfo cpi where cpi.correlationKey.id = key.id) and + props.value in :properties + group by key.id,key.processInstanceId +having count(key.id) = :elem_count + + + + +select + key +from + CorrelationKeyInfo key +where + key.processInstanceId = :pId + + + diff --git a/clients/comaco/environment-eap6/target/classes/META-INF/Servicesorm.xml b/clients/comaco/environment-eap6/target/classes/META-INF/Servicesorm.xml new file mode 100644 index 0000000..01762d4 --- /dev/null +++ b/clients/comaco/environment-eap6/target/classes/META-INF/Servicesorm.xml @@ -0,0 +1,372 @@ + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + ORDER BY + log.processId, log.start + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.status in (:states) + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.status in (:states) and log.identity = :initiator + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.externalId=:externalId + and log.status in (:states) + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.processId =:processDefId + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.processInstanceId =:processId + + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.status in (:states) and log.processId like :processId + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.status in (:states) and log.processId like :processId and log.identity = :initiator + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.status in (:states) and log.processName like :processName + + + + + + + select + new org.jbpm.kie.services.impl.model.ProcessInstanceDesc( + log.processInstanceId, + log.processId, + log.processName, + log.processVersion, + log.status, + log.externalId, + log.start, + log.identity + ) + from + ProcessInstanceLog log + where + log.status in (:states) and log.processName like :processName and log.identity = :initiator + + + + + + + + select + new org.jbpm.kie.services.impl.model.NodeInstanceDesc( + log.nodeInstanceId, + log.nodeId, + log.nodeName, + log.nodeType, + log.externalId, + log.processInstanceId, + log.date, + log.connection, + log.type + ) + from + NodeInstanceLog log + where + log.processInstanceId=:processId AND log.externalId=:externalId AND log.type =:type + ORDER BY + log.date DESC, log.id DESC + + + + + + + + select + new org.jbpm.kie.services.impl.model.NodeInstanceDesc( + log.nodeInstanceId, + log.nodeId, + log.nodeName, + log.nodeType, + log.externalId, + log.processInstanceId, + log.date, + log.connection, + log.type + ) + from + NodeInstanceLog log + where + log.processInstanceId=:processId AND log.externalId=:externalId + ORDER BY + log.date DESC, log.id DESC + + + + + + + + select + new org.jbpm.kie.services.impl.model.NodeInstanceDesc( + log.nodeInstanceId, + log.nodeId, + log.nodeName, + log.nodeType, + log.externalId, + log.processInstanceId, + log.date, + log.connection, + log.type + ) + from + NodeInstanceLog log + where + log.nodeInstanceId in ( select nil.nodeInstanceId from NodeInstanceLog nil where nil.processInstanceId=:processId AND nil.externalId=:externalId + GROUP BY nil.nodeInstanceId + HAVING sum(nil.type) = 0) + and log.type = 0 + and log.processInstanceId=:processId + order by + log.id ASC + + + + + + + select + new org.jbpm.kie.services.impl.model.NodeInstanceDesc( + log.nodeInstanceId, + log.nodeId, + log.nodeName, + log.nodeType, + log.externalId, + log.processInstanceId, + log.date, + log.connection, + log.type + ) + from + NodeInstanceLog log + where + log.nodeInstanceId in (select nodeInstanceId from NodeInstanceLog nid where nid.processInstanceId=:processId AND nid.externalId=:externalId AND nid.type = 1 + GROUP BY nid.nodeInstanceId + HAVING sum(nid.type) >= 1) + and log.type = 1 + and log.processInstanceId=:processId + ORDER BY + log.nodeInstanceId, log.id ASC + + + + + + + + + select + new org.jbpm.kie.services.impl.model.VariableStateDesc( + log.variableId, + log.variableInstanceId, + log.oldValue, + log.value, + log.externalId, + log.processInstanceId, + log.date + ) + from + VariableInstanceLog log + where + log.processInstanceId =:processInstanceId AND log.id in (select max(vss.id) FROM VariableInstanceLog vss WHERE vss.processInstanceId =:processInstanceId group by vss.variableId ) order by log.id + + + + + + + select + new org.jbpm.kie.services.impl.model.VariableStateDesc( + log.variableId, + log.variableInstanceId, + log.oldValue, + log.value, + log.externalId, + log.processInstanceId, + log.date + ) + from + VariableInstanceLog log + where + log.processInstanceId =:processInstanceId AND log.variableId =:variableId + order by + log.id DESC + + + + + + \ No newline at end of file diff --git a/clients/comaco/environment-eap6/target/classes/META-INF/TaskAuditorm.xml b/clients/comaco/environment-eap6/target/classes/META-INF/TaskAuditorm.xml new file mode 100644 index 0000000..2f0266f --- /dev/null +++ b/clients/comaco/environment-eap6/target/classes/META-INF/TaskAuditorm.xml @@ -0,0 +1,42 @@ + + + + select t from TaskEventImpl t where t.taskId = :taskId + + + + select b from BAMTaskSummaryImpl b where b.taskId = :taskId + + + + delete from BAMTaskSummaryImpl b where b.taskId = :taskId + + + + delete from BAMTaskSummaryImpl b + + + + + + select a from AuditTaskImpl a order by a.taskId DESC + + + + + + select a from AuditTaskImpl a where a.actualOwner = :owner order by a.taskId DESC + + + + + + select a from AuditTaskImpl a where a.taskId = :taskId + + + + + diff --git a/clients/comaco/environment-eap6/target/classes/META-INF/Taskorm.xml b/clients/comaco/environment-eap6/target/classes/META-INF/Taskorm.xml new file mode 100644 index 0000000..ac0ebca --- /dev/null +++ b/clients/comaco/environment-eap6/target/classes/META-INF/Taskorm.xml @@ -0,0 +1,1297 @@ + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl businessAdministrator + where + t.archived = 0 and + businessAdministrator.id = :userId and + businessAdministrator in elements ( t.peopleAssignments.businessAdministrators ) + + + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl excludedOwners + where + t.archived = 0 and + excludedOwners.id = :userId and + excludedOwners in elements ( t.peopleAssignments.excludedOwners ) + + + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + potentialOwners.id = :userId and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + potentialOwners.id = :userId and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + + t.taskData.status in (:status) + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + t.taskData.status in (:status) + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t , + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t , + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + t.taskData.status in (:status) + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t , + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + t.taskData.actualOwner = null and + potentialOwners.id = :groupId and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + order by t.id DESC + + + + + + + select + + t.id, + potentialOwners.id + + from + TaskImpl t, + + OrganizationalEntityImpl potentialOwners + + where + + potentialOwners.id in (:groupIds) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.archived = 0 and + t.taskData.actualOwner = null and + + + + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + + + + + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + t.taskData.expirationTime = :expirationDate and + t.taskData.status in (:status) + order by t.id DESC + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + (t.taskData.expirationTime = :expirationDate or t.taskData.expirationTime is null) and + t.taskData.status in (:status) + order by t.id DESC + + + + + + + select + + t.id, + potentialOwners.id + + from + TaskImpl t, + + OrganizationalEntityImpl potentialOwners + + where + + potentialOwners.id in (:groupIds) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.archived = 0 and + t.taskData.actualOwner = null and + t.taskData.expirationTime = :expirationDate and + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + + + + + + + + + + + + select + t.id, + potentialOwners + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + + where + t.id in (:taskIds) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) + + + + + + + + + select + + t.id, + potentialOwners.id + + from + TaskImpl t, + + OrganizationalEntityImpl potentialOwners + + where + + potentialOwners.id in (:groupIds) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.archived = 0 and + t.taskData.actualOwner = null and + (t.taskData.expirationTime = :expirationDate or t.taskData.expirationTime is null) and + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + + + + + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + t.taskData.parentId = :parentId and + (potentialOwners.id = :userId or potentialOwners.id in (:groupIds)) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + order by t.id DESC + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + t.taskData.parentId = :parentId and + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + order by t.id DESC + + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl recipients + where + t.archived = 0 and + recipients.id = :userId and + recipients in elements ( t.peopleAssignments.recipients ) + + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl taskInitiator + where + t.archived = 0 and + taskInitiator.id = :userId and + taskInitiator = t.peopleAssignments.taskInitiator + + + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl taskStakeholder + where + t.archived = 0 and + taskStakeholder.id = :userId and + taskStakeholder in elements ( t.peopleAssignments.taskStakeholders ) + + + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + where + t.archived = 0 and + t.taskData.actualOwner.id = :userId + + + order by t.id DESC + + + + + + + select + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + left join t.peopleAssignments.potentialOwners potOwners + where + t.archived = 0 and + (t.taskData.actualOwner.id = :userId or potOwners.id = :userId) and + t.taskData.status in (:status) and + t.taskData.expirationTime = :expirationDate + + order by t.id DESC + + + + + + + select + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + left join t.peopleAssignments.potentialOwners potOwners + where + t.archived = 0 and + (t.taskData.actualOwner.id = :userId or potOwners.id = :userId) and + t.taskData.status in (:status) and + t.taskData.expirationTime < :date + + order by t.id DESC + + + + + + + select + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + left join t.peopleAssignments.potentialOwners potOwners + where + t.archived = 0 and + (t.taskData.actualOwner.id = :userId or potOwners.id = :userId) and + t.taskData.status in (:status) and + (t.taskData.expirationTime = :expirationDate or + t.taskData.expirationTime is null) + + + order by t.id DESC + + + + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + where + t.archived = 0 and + t.taskData.status = :status + order by t.id DESC + + + + + + select + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + where + t.archived = 0 and + t.taskData.status = :status and + + + + t.taskData.activationTime < :since + + order by t.id DESC + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + where + t.archived = 1 + + + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + where + t.archived = 0 and + t.taskData.actualOwner.id = :userId and + t.taskData.status in (:status) + + + order by t.id DESC + + + + + + + + select + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + where + t.id in (:taskIds) + order by t.id DESC + + + + + + + + select + + t.id, + potentialOwners.id + + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + + where + + t.id in (:taskIds) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.archived = 0 and + t.taskData.status in ('Created', 'Ready', 'Reserved', 'InProgress', 'Suspended') + + + + + + + + + + + select + new org.jbpm.services.task.query.DeadlineSummaryImpl( + t.id, + d.id, + d.date) + from + TaskImpl t, + DeadlineImpl d + where + t.archived = 0 and + d in elements( t.deadlines.endDeadlines ) and + d.escalated = 0 + order by + d.date + + + + + + + select + new org.jbpm.services.task.query.DeadlineSummaryImpl( + t.id, + d.id, + d.date) + from + TaskImpl t, + DeadlineImpl d + where + t.archived = 0 and + d in elements( t.deadlines.startDeadlines ) and + d.escalated = 0 + order by + d.date + + + + + + select + new org.jbpm.services.task.query.DeadlineSummaryImpl( + t.id, + d.id, + d.date) + from + TaskImpl t, + DeadlineImpl d + where + t.id = :taskId and + t.archived = 0 and + d in elements( t.deadlines.endDeadlines ) and + d.escalated = 0 + order by + d.date + + + + + + + select + new org.jbpm.services.task.query.DeadlineSummaryImpl( + t.id, + d.id, + d.date) + from + TaskImpl t, + DeadlineImpl d + where + t.id = :taskId and + t.archived = 0 and + d in elements( t.deadlines.startDeadlines ) and + d.escalated = 0 + order by + d.date + + + + + + select + t + from + TaskImpl t + where + t.archived = 0 and + t.taskData.workItemId = :workItemId + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + where + t.archived = 0 and + t.taskData.processInstanceId = :processInstanceId and + + + t.taskData.status in (:status) + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + + where + t.archived = 0 and + t.taskData.processInstanceId = :processInstanceId and + t.name = :taskName and + t.taskData.status in (:status) + order by t.id DESC + + + + + + select + t.id + from + TaskImpl t + where + t.archived = 0 and + t.taskData.processInstanceId = :processInstanceId + + + + + + + + + select + a + from + TaskImpl t + join t.taskData.attachments as a + where + t.id = :taskId + + + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.taskData.status in (:status) + order by t.id DESC + + + + + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t , + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + (t.taskData.expirationTime = :expirationDate or t.taskData.expirationTime is null) and + t.taskData.status in (:status) + order by t.id DESC + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t , + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + + t.taskData.expirationTime = :expirationDate and + t.taskData.status in (:status) + order by t.id DESC + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.taskData.status in (:status) + order by t.id DESC + + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + (t.taskData.expirationTime = :expirationDate or t.taskData.expirationTime is null) and + t.taskData.status in (:status) + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t, + OrganizationalEntityImpl potentialOwners + where + t.archived = 0 and + ( potentialOwners.id = :userId or potentialOwners.id in (:groupIds) ) and + potentialOwners in elements ( t.peopleAssignments.potentialOwners ) and + t.taskData.expirationTime = :expirationDate and + t.taskData.status in (:status) + order by t.id DESC + + + + + + select distinct + new org.jbpm.services.task.query.TaskSummaryImpl( + t.id, + t.name, + t.description, + t.taskData.status, + t.priority, + t.taskData.actualOwner.id, + t.taskData.createdBy.id, + t.taskData.createdOn, + t.taskData.activationTime, + t.taskData.expirationTime, + t.taskData.processId, + t.taskData.processInstanceId, + t.taskData.parentId, + t.taskData.deploymentId ) + from + TaskImpl t + where + t.archived = 0 and + t.taskData.actualOwner.id = :userId and + t.taskData.status in (:status) + order by t.id DESC + + + + + diff --git a/clients/comaco/environment-eap6/target/classes/META-INF/persistence.xml b/clients/comaco/environment-eap6/target/classes/META-INF/persistence.xml new file mode 100644 index 0000000..522239a --- /dev/null +++ b/clients/comaco/environment-eap6/target/classes/META-INF/persistence.xml @@ -0,0 +1,94 @@ + + + + + org.hibernate.ejb.HibernatePersistence + java:jboss/datasources/jbpmDS + META-INF/Taskorm.xml + META-INF/JBPMorm.xml + META-INF/Executor-orm.xml + META-INF/Servicesorm.xml + META-INF/TaskAuditorm.xml + + org.jbpm.services.task.impl.model.AttachmentImpl + org.jbpm.services.task.impl.model.ContentImpl + org.jbpm.services.task.impl.model.BooleanExpressionImpl + org.jbpm.services.task.impl.model.CommentImpl + org.jbpm.services.task.impl.model.DeadlineImpl + org.jbpm.services.task.impl.model.DelegationImpl + org.jbpm.services.task.impl.model.EscalationImpl + org.jbpm.services.task.impl.model.GroupImpl + org.jbpm.services.task.impl.model.I18NTextImpl + org.jbpm.services.task.impl.model.NotificationImpl + org.jbpm.services.task.impl.model.EmailNotificationImpl + org.jbpm.services.task.impl.model.EmailNotificationHeaderImpl + org.jbpm.services.task.impl.model.PeopleAssignmentsImpl + org.jbpm.services.task.impl.model.ReassignmentImpl + org.jbpm.services.task.impl.model.TaskImpl + org.jbpm.services.task.impl.model.TaskDefImpl + org.jbpm.services.task.impl.model.TaskDataImpl + org.jbpm.services.task.impl.model.UserImpl + org.jbpm.executor.entities.ErrorInfo + org.jbpm.executor.entities.RequestInfo + + org.jbpm.services.task.audit.impl.model.TaskEventImpl + + + org.jbpm.services.task.audit.impl.model.AuditTaskImpl + + + org.jbpm.services.task.audit.impl.model.BAMTaskSummaryImpl + + + org.drools.persistence.info.SessionInfo + org.jbpm.persistence.processinstance.ProcessInstanceInfo + org.drools.persistence.info.WorkItemInfo + org.jbpm.persistence.correlation.CorrelationKeyInfo + org.jbpm.persistence.correlation.CorrelationPropertyInfo + + org.jbpm.runtime.manager.impl.jpa.ContextMappingInfo + + + org.jbpm.process.audit.ProcessInstanceLog + org.jbpm.process.audit.NodeInstanceLog + org.jbpm.process.audit.VariableInstanceLog + + + + + + + + + + + + + + + + + org.hibernate.ejb.HibernatePersistence + java:jboss/datasources/FLIPDS1 + + + + + + + + + + + + + + + + + + diff --git a/clients/comaco/environment-eap6/target/classes/bpm.properties b/clients/comaco/environment-eap6/target/classes/bpm.properties new file mode 100644 index 0000000..5444a7a --- /dev/null +++ b/clients/comaco/environment-eap6/target/classes/bpm.properties @@ -0,0 +1,16 @@ +guvnor.url=http\://127.0.0.1\:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/{0}/{1} +vnor.url=http\://127.0.0.1\:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/{0}/{1} +guvnor.change.set= +guvnor.security.basicAuthentication=enabled +guvnor.security.username=gfiallos +guvnor.security.password=gfiallos +guvnor.refresh=false +bpm.memory=false +#task.ip=192.168.2.210 +task.ip=127.0.0.1 +task.ip.server=0.0.0.0 +task.port=9123 +flows.package=maia.flows +flows.snapshot=LATEST +inbox.icon.path=images/bpm/ +inbox.icon.extension=.gif diff --git a/clients/comaco/environment-eap6/target/classes/common.properties b/clients/comaco/environment-eap6/target/classes/common.properties new file mode 100644 index 0000000..e332127 --- /dev/null +++ b/clients/comaco/environment-eap6/target/classes/common.properties @@ -0,0 +1,9 @@ +bean.class.path=/logs/fp +#codigo de moneda oficial +localCurrency=USD +# True indica que la aplicacion trabaja con tasas nominales, false indica que la aplicacion trabaja con tasas efectiva. +nominalRate=true +# Parametro que define el numero de dias de retencion default de valores depositados en cheque. +localhold=2 +#tipos de saldo sobre los cuales se paga intereses en cuentas a la vista +btypeinterest=Cash-Locked-Pawned \ No newline at end of file diff --git a/clients/comaco/environment-eap6/target/classes/fb-facade.properties b/clients/comaco/environment-eap6/target/classes/fb-facade.properties new file mode 100644 index 0000000..4d0474f --- /dev/null +++ b/clients/comaco/environment-eap6/target/classes/fb-facade.properties @@ -0,0 +1,3 @@ +ear=maiaear-2.1/ +bean=FacadeBean/remote +defaultcompany=1 \ No newline at end of file diff --git a/clients/comaco/environment-eap6/target/classes/hibernateFlipMapping.cfg.xml b/clients/comaco/environment-eap6/target/classes/hibernateFlipMapping.cfg.xml new file mode 100644 index 0000000..1f4a7d6 --- /dev/null +++ b/clients/comaco/environment-eap6/target/classes/hibernateFlipMapping.cfg.xml @@ -0,0 +1,273 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/clients/comaco/environment-eap6/target/classes/log4j.properties b/clients/comaco/environment-eap6/target/classes/log4j.properties new file mode 100644 index 0000000..a150115 --- /dev/null +++ b/clients/comaco/environment-eap6/target/classes/log4j.properties @@ -0,0 +1,18 @@ +log4j.rootLogger=error,com.fp +log4j.logger.com.fp=error +log4j.appender.com.fp=org.apache.log4j.ConsoleAppender +log4j.appender.com.fp.layout=org.apache.log4j.PatternLayout +#log4j.appender.com.fp.layout.ConversionPattern=%d{dd-MMM-yyyy HH\:mm\:ss.SSS} %p [%t] <%l> - %m%n +log4j.appender.com.fp.layout.ConversionPattern=%d{HH\:mm\:ss.SSS} %p [%t] <%l> - %m%n +log4j.category.org.hibernate=fatal +log4j.category.javax=error +log4j.category.org.hibernate.cfg.AnnotationBinder=off +log4j.category.org.hibernate.cfg.annotations.EntityBinder=off +log4j.category.org.apache.tomcat.util.http.Cookies=off +log4j.category.net.sf.json=error +log4j.category.org.springframework=error +log4j.category.com.fp.commondb.PersistenceManager=info +log4j.category.com.fp.bpmlib=info + + + diff --git a/clients/comaco/environment-eap6/target/environment-eap6-2.1.jar b/clients/comaco/environment-eap6/target/environment-eap6-2.1.jar new file mode 100644 index 0000000..94840fc Binary files /dev/null and b/clients/comaco/environment-eap6/target/environment-eap6-2.1.jar differ diff --git a/clients/comaco/environment-eap6/target/maven-archiver/pom.properties b/clients/comaco/environment-eap6/target/maven-archiver/pom.properties new file mode 100644 index 0000000..3c85caa --- /dev/null +++ b/clients/comaco/environment-eap6/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Thu Oct 27 16:53:23 ECT 2022 +version=2.1 +groupId=com.fp.clients.maia +artifactId=environment-eap6 diff --git a/clients/comaco/pom.xml b/clients/comaco/pom.xml new file mode 100644 index 0000000..14648bb --- /dev/null +++ b/clients/comaco/pom.xml @@ -0,0 +1,48 @@ + + + + clients + com.fp + 2.1 + + 4.0.0 + com.fp.clients + maia + FlipBean + 2.1 + pom + + environment-eap6 + ear + + + + flipbean + Flipbean + flipbean.s.a@gmail.com + + Project Manager + Architect + + + + + + + log4j + log4j + 1.2.14 + + + + + + junit + junit + 4.0 + test + + + + + diff --git a/clients/pom.xml b/clients/pom.xml new file mode 100644 index 0000000..0512f1a --- /dev/null +++ b/clients/pom.xml @@ -0,0 +1,163 @@ + + + + FlipBean + com.fp + 2.1 + + 4.0.0 + com.fp + clients + Clients + 2.1 + pom + + 5.5.0.Final + 5.4.0.Final + ISO-8859-1 + + + comaco + + + + + + + org.drools + drools-persistence-jpa + ${drools.version} + provided + + + org.drools + knowledge-api + ${drools.version} + provided + + + org.drools + knowledge-internal-api + ${drools.version} + provided + + + + org.drools + drools-core + ${drools.version} + provided + + + org.drools + drools-compiler + ${drools.version} + provided + + + org.drools + drools-decisiontables + ${drools.version} + provided + + + org.drools + drools-templates + ${drools.version} + provided + + + org.apache.mina + mina-core + 2.0.1 + provided + + + + + org.jbpm + jbpm-flow + ${jbpm.version} + provided + + + org.jbpm + jbpm-flow-builder + ${jbpm.version} + provided + + + org.jbpm + jbpm-persistence-jpa + ${jbpm.version} + provided + + + org.jbpm + jbpm-bpmn2 + ${jbpm.version} + provided + + + org.jbpm + jbpm-human-task + ${jbpm.version} + provided + + + org.jbpm + jbpm-human-task-core + ${jbpm.version} + provided + + + org.jbpm + jbpm-human-task-mina + ${jbpm.version} + provided + + + org.jbpm + jbpm-bam + ${jbpm.version} + provided + + + org.jbpm + jbpm-workitems + ${jbpm.version} + provided + + + + + org.apache.poi + poi + 3.5-FINAL + jar + provided + + + org.apache.poi + poi-ooxml-schemas + 3.6 + jar + provided + + + org.apache.poi + poi-ooxml + 3.5-FINAL + jar + provided + + + org.apache.poi + ooxml-schemas + 1.0 + jar + provided + + + + diff --git a/frontend/.metadata/.svn/entries b/frontend/.metadata/.svn/entries new file mode 100644 index 0000000..e34043f --- /dev/null +++ b/frontend/.metadata/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/.metadata +svn://172.17.26.185/COMACO + + + +2020-11-16T08:48:06.664034Z +4632 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + diff --git a/frontend/.metadata/src/.svn/entries b/frontend/.metadata/src/.svn/entries new file mode 100644 index 0000000..0d1d938 --- /dev/null +++ b/frontend/.metadata/src/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/.metadata/src +svn://172.17.26.185/COMACO + + + +2020-11-16T08:48:06.664034Z +4632 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +main +dir + diff --git a/frontend/.metadata/src/main/.svn/entries b/frontend/.metadata/src/main/.svn/entries new file mode 100644 index 0000000..c0fc8f2 --- /dev/null +++ b/frontend/.metadata/src/main/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/.metadata/src/main +svn://172.17.26.185/COMACO + + + +2020-11-16T08:48:06.664034Z +4632 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +webapp +dir + diff --git a/frontend/.metadata/src/main/webapp/.svn/entries b/frontend/.metadata/src/main/webapp/.svn/entries new file mode 100644 index 0000000..7888bd9 --- /dev/null +++ b/frontend/.metadata/src/main/webapp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/.metadata/src/main/webapp +svn://172.17.26.185/COMACO + + + +2020-11-16T08:48:06.664034Z +4632 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +WEB-INF +dir + diff --git a/frontend/.metadata/src/main/webapp/WEB-INF/.svn/entries b/frontend/.metadata/src/main/webapp/WEB-INF/.svn/entries new file mode 100644 index 0000000..c14fb1e --- /dev/null +++ b/frontend/.metadata/src/main/webapp/WEB-INF/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/.metadata/src/main/webapp/WEB-INF +svn://172.17.26.185/COMACO + + + +2020-11-16T08:48:06.664034Z +4632 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +faces-config.pageflow +file + + + + +2022-07-28T03:40:15.653686Z +b830e48595347dabbb640fb71ee28ae4 +2020-11-16T08:48:06.664034Z +4632 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +202 + diff --git a/frontend/.metadata/src/main/webapp/WEB-INF/.svn/text-base/faces-config.pageflow.svn-base b/frontend/.metadata/src/main/webapp/WEB-INF/.svn/text-base/faces-config.pageflow.svn-base new file mode 100644 index 0000000..2383095 --- /dev/null +++ b/frontend/.metadata/src/main/webapp/WEB-INF/.svn/text-base/faces-config.pageflow.svn-base @@ -0,0 +1,2 @@ + + diff --git a/frontend/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow b/frontend/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow new file mode 100644 index 0000000..2383095 --- /dev/null +++ b/frontend/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow @@ -0,0 +1,2 @@ + + diff --git a/frontend/.svn/dir-prop-base b/frontend/.svn/dir-prop-base new file mode 100644 index 0000000..3e2a6f2 --- /dev/null +++ b/frontend/.svn/dir-prop-base @@ -0,0 +1,9 @@ +K 10 +svn:ignore +V 37 +.classpath +.project +.settings +target + +END diff --git a/frontend/.svn/entries b/frontend/.svn/entries new file mode 100644 index 0000000..2125b0d --- /dev/null +++ b/frontend/.svn/entries @@ -0,0 +1,68 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +src +dir + +pom.xml +file + + + + +2022-07-28T03:40:15.762686Z +793d44f24092e3bb0f6336ce85d5636a +2022-01-20T04:14:54.721239Z +4663 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +16000 + +.metadata +dir + diff --git a/frontend/.svn/text-base/pom.xml.netbeans-base b/frontend/.svn/text-base/pom.xml.netbeans-base new file mode 100644 index 0000000..a5e4003 --- /dev/null +++ b/frontend/.svn/text-base/pom.xml.netbeans-base @@ -0,0 +1,465 @@ + + 4.0.0 + com.fp + frontend + 2.1 + war + Frontend primefaces + + + + + log4j + log4j + 1.2.16 + + provided + + + dom4j + dom4j + 1.6.1 + provided + + + org.jboss.as + jboss-as-ejb-client-bom + 7.1.3.Final + pom + + provided + + + + org.hibernate + hibernate-entitymanager + 4.0.1.Final + + provided + + + + javax + javaee-web-api + 6.0 + provided + + + com.sun.faces + jsf-api + 2.2.4 + + provided + + + com.sun.faces + jsf-impl + 2.2.4 + + provided + + + javax.servlet + jstl + 1.2 + + provided + + + javax.servlet + servlet-api + 2.5 + + provided + + + + org.primefaces + primefaces + 5.0.8 + + + org.primefaces.extensions + primefaces-extensions + 2.0.0 + + + org.primefaces.themes + redmond + 1.0.10 + + + org.omnifaces + omnifaces + 1.3 + + + net.sf.json-lib + json-lib + 2.2.3 + + + + + + + + com.fp.base.dto + dto + 2.1 + + + com.fp.base + facadeclient + 2.1 + + + com.fp.base.bpm + simple + 2.1 + + + + com.fp.base.persistence + pgeneral + 2.1 + + + com.fp.base.persistence + pcustomer + 2.1 + + + com.fp.base.persistence + pbpm + 2.1 + + + com.fp.base.persistence + parmas + 2.1 + + + + com.fp.general + general-mail + 2.1 + + + + + com.fp.base.core + firmas + 2.1 + + + com.fp.base.persistence + pfirmas + 2.1 + + + com.fp.base.core + alfresco-client + 2.1 + provided + + + + + log4j + log4j + + + dom4j + dom4j + + + org.jboss.as + jboss-as-ejb-client-bom + pom + + + + + org.hibernate + hibernate-entitymanager + + + + javax + javaee-web-api + + + + com.sun.faces + jsf-api + + + com.sun.faces + jsf-impl + + + javax.servlet + jstl + + + + + + org.primefaces + primefaces + + + org.primefaces.extensions + primefaces-extensions + + + org.primefaces.themes + redmond + + + junit + junit + 4.8.2 + test + + + org.omnifaces + omnifaces + + + + + net.sf.jasperreports + jasperreports + 5.6.0 + provided + + + + com.google.zxing + core + 2.2 + + + + com.jaspersoft.ireport + jaspersoft.ireport + 5.6.0 + provided + + + + com.jaspersoft.ireport.jasperserver + jaspersoft.ireport.jasperserver + 5.6.0 + provided + + + + com.jaspersoft.jasperserver + jasperserver-common-ws + 5.6.0 + provided + + + + com.lowagie + itext + 2.1.7 + provided + + + org.codeartisans.thirdparties.swing + org-openide-util + 8.6.2 + provided + + + javax.activation + activation + 1.1 + provided + + + org.apache.axis + axis + 1.4 + provided + + + commons-codec + commons-codec + 1.10 + compile + + + commons-discovery + commons-discovery + 0.2 + provided + + + commons-httpclient + commons-httpclient + 3.1 + provided + + + commons-collections + commons-collections + 3.2.1 + compile + + + commons-digester + commons-digester + 2.1 + provided + + + xerces + xercesImpl + 2.9.1 + provided + + + javax.xml + jaxrpc-api + 1.1 + provided + + + javax.mail + mail + 1.4 + provided + + + + axis + axis-wsdl4j + 1.5.1 + provided + + + + + net.sf.json-lib + json-lib + + + + org.apache.httpcomponents + httpclient + 4.3.1 + + + org.apache.httpcomponents + httpmime + 4.3.1 + + + org.apache.httpcomponents + httpcore + 4.3.1 + + + + + + commons-io + commons-io + 2.4 + + + commons-fileupload + commons-fileupload + 1.3 + + + + + org.apache.poi + poi + 3.10-FINAL + + + org.apache.poi + poi-ooxml + 3.10-FINAL + + + org.apache.poi + poi-ooxml-schemas + 3.10-FINAL + + + org.apache.poi + poi-scratchpad + 3.10-FINAL + + + + + com.thetransactioncompany + cors-filter + 2.5 + + + org.bitbucket.b_c + jose4j + 0.7.9 + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.0 + + true + ${project.build.sourceEncoding} + 1.7 + 1.7 + + + + maia + + + + + diff --git a/frontend/.svn/text-base/pom.xml.svn-base b/frontend/.svn/text-base/pom.xml.svn-base new file mode 100644 index 0000000..a5e4003 --- /dev/null +++ b/frontend/.svn/text-base/pom.xml.svn-base @@ -0,0 +1,465 @@ + + 4.0.0 + com.fp + frontend + 2.1 + war + Frontend primefaces + + + + + log4j + log4j + 1.2.16 + + provided + + + dom4j + dom4j + 1.6.1 + provided + + + org.jboss.as + jboss-as-ejb-client-bom + 7.1.3.Final + pom + + provided + + + + org.hibernate + hibernate-entitymanager + 4.0.1.Final + + provided + + + + javax + javaee-web-api + 6.0 + provided + + + com.sun.faces + jsf-api + 2.2.4 + + provided + + + com.sun.faces + jsf-impl + 2.2.4 + + provided + + + javax.servlet + jstl + 1.2 + + provided + + + javax.servlet + servlet-api + 2.5 + + provided + + + + org.primefaces + primefaces + 5.0.8 + + + org.primefaces.extensions + primefaces-extensions + 2.0.0 + + + org.primefaces.themes + redmond + 1.0.10 + + + org.omnifaces + omnifaces + 1.3 + + + net.sf.json-lib + json-lib + 2.2.3 + + + + + + + + com.fp.base.dto + dto + 2.1 + + + com.fp.base + facadeclient + 2.1 + + + com.fp.base.bpm + simple + 2.1 + + + + com.fp.base.persistence + pgeneral + 2.1 + + + com.fp.base.persistence + pcustomer + 2.1 + + + com.fp.base.persistence + pbpm + 2.1 + + + com.fp.base.persistence + parmas + 2.1 + + + + com.fp.general + general-mail + 2.1 + + + + + com.fp.base.core + firmas + 2.1 + + + com.fp.base.persistence + pfirmas + 2.1 + + + com.fp.base.core + alfresco-client + 2.1 + provided + + + + + log4j + log4j + + + dom4j + dom4j + + + org.jboss.as + jboss-as-ejb-client-bom + pom + + + + + org.hibernate + hibernate-entitymanager + + + + javax + javaee-web-api + + + + com.sun.faces + jsf-api + + + com.sun.faces + jsf-impl + + + javax.servlet + jstl + + + + + + org.primefaces + primefaces + + + org.primefaces.extensions + primefaces-extensions + + + org.primefaces.themes + redmond + + + junit + junit + 4.8.2 + test + + + org.omnifaces + omnifaces + + + + + net.sf.jasperreports + jasperreports + 5.6.0 + provided + + + + com.google.zxing + core + 2.2 + + + + com.jaspersoft.ireport + jaspersoft.ireport + 5.6.0 + provided + + + + com.jaspersoft.ireport.jasperserver + jaspersoft.ireport.jasperserver + 5.6.0 + provided + + + + com.jaspersoft.jasperserver + jasperserver-common-ws + 5.6.0 + provided + + + + com.lowagie + itext + 2.1.7 + provided + + + org.codeartisans.thirdparties.swing + org-openide-util + 8.6.2 + provided + + + javax.activation + activation + 1.1 + provided + + + org.apache.axis + axis + 1.4 + provided + + + commons-codec + commons-codec + 1.10 + compile + + + commons-discovery + commons-discovery + 0.2 + provided + + + commons-httpclient + commons-httpclient + 3.1 + provided + + + commons-collections + commons-collections + 3.2.1 + compile + + + commons-digester + commons-digester + 2.1 + provided + + + xerces + xercesImpl + 2.9.1 + provided + + + javax.xml + jaxrpc-api + 1.1 + provided + + + javax.mail + mail + 1.4 + provided + + + + axis + axis-wsdl4j + 1.5.1 + provided + + + + + net.sf.json-lib + json-lib + + + + org.apache.httpcomponents + httpclient + 4.3.1 + + + org.apache.httpcomponents + httpmime + 4.3.1 + + + org.apache.httpcomponents + httpcore + 4.3.1 + + + + + + commons-io + commons-io + 2.4 + + + commons-fileupload + commons-fileupload + 1.3 + + + + + org.apache.poi + poi + 3.10-FINAL + + + org.apache.poi + poi-ooxml + 3.10-FINAL + + + org.apache.poi + poi-ooxml-schemas + 3.10-FINAL + + + org.apache.poi + poi-scratchpad + 3.10-FINAL + + + + + com.thetransactioncompany + cors-filter + 2.5 + + + org.bitbucket.b_c + jose4j + 0.7.9 + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.0 + + true + ${project.build.sourceEncoding} + 1.7 + 1.7 + + + + maia + + + + + diff --git a/frontend/nb-configuration.xml b/frontend/nb-configuration.xml new file mode 100644 index 0000000..d21e5dd --- /dev/null +++ b/frontend/nb-configuration.xml @@ -0,0 +1,20 @@ + + + + + + ide + JDK_1.7 + JSP + + diff --git a/frontend/pom.xml b/frontend/pom.xml new file mode 100644 index 0000000..488ed7a --- /dev/null +++ b/frontend/pom.xml @@ -0,0 +1,476 @@ + + 4.0.0 + com.fp + frontend + 2.1 + war + Frontend primefaces + + + + + log4j + log4j + 1.2.16 + + provided + + + dom4j + dom4j + 1.6.1 + provided + + + org.jboss.as + jboss-as-ejb-client-bom + 7.1.3.Final + pom + + provided + + + + org.hibernate + hibernate-entitymanager + 4.0.1.Final + + provided + + + + javax + javaee-web-api + 6.0 + provided + + + com.sun.faces + jsf-api + 2.2.4 + + provided + + + com.sun.faces + jsf-impl + 2.2.4 + + provided + + + javax.servlet + jstl + 1.2 + + provided + + + javax.servlet + servlet-api + 2.5 + + provided + + + + org.primefaces + primefaces + 5.0.8 + + + org.primefaces.extensions + primefaces-extensions + 2.0.0 + + + org.primefaces.themes + redmond + 1.0.10 + + + org.omnifaces + omnifaces + 1.3 + + + net.sf.json-lib + json-lib + 2.2.3 + + + + + + + + com.fp.base.dto + dto + 2.1 + + + com.fp.base + facadeclient + 2.1 + + + com.fp.base.bpm + simple + 2.1 + + + + com.fp.base.persistence + pgeneral + 2.1 + + + com.fp.base.persistence + pcustomer + 2.1 + + + com.fp.base.persistence + pbpm + 2.1 + + + com.fp.base.persistence + parmas + 2.1 + + + + com.fp.general + general-mail + 2.1 + + + + + com.fp.base.core + firmas + 2.1 + + + com.fp.base.persistence + pfirmas + 2.1 + + + com.fp.base.core + alfresco-client + 2.1 + provided + + + + + log4j + log4j + + + dom4j + dom4j + + + org.jboss.as + jboss-as-ejb-client-bom + pom + + + + + org.hibernate + hibernate-entitymanager + + + + javax + javaee-web-api + + + + com.sun.faces + jsf-api + + + com.sun.faces + jsf-impl + + + javax.servlet + jstl + + + + + + org.primefaces + primefaces + + + org.primefaces.extensions + primefaces-extensions + + + org.primefaces.themes + redmond + + + junit + junit + 4.8.2 + test + + + org.omnifaces + omnifaces + + + + + net.sf.jasperreports + jasperreports + 5.6.0 + provided + + + + com.google.zxing + core + 2.2 + + + + com.jaspersoft.ireport + jaspersoft.ireport + 5.6.0 + provided + + + + com.jaspersoft.ireport.jasperserver + jaspersoft.ireport.jasperserver + 5.6.0 + provided + + + + com.jaspersoft.jasperserver + jasperserver-common-ws + 5.6.0 + provided + + + + com.lowagie + itext + 2.1.7 + provided + + + org.codeartisans.thirdparties.swing + org-openide-util + 8.6.2 + provided + + + javax.activation + activation + 1.1 + provided + + + org.apache.axis + axis + 1.4 + provided + + + commons-codec + commons-codec + 1.10 + compile + + + commons-discovery + commons-discovery + 0.2 + provided + + + commons-httpclient + commons-httpclient + 3.1 + provided + + + commons-collections + commons-collections + 3.2.1 + compile + + + commons-digester + commons-digester + 2.1 + provided + + + xerces + xercesImpl + 2.9.1 + provided + + + javax.xml + jaxrpc-api + 1.1 + provided + + + javax.mail + mail + 1.4 + provided + + + + axis + axis-wsdl4j + 1.5.1 + provided + + + + + net.sf.json-lib + json-lib + + + + org.apache.httpcomponents + httpclient + 4.3.1 + + + org.apache.httpcomponents + httpmime + 4.3.1 + + + org.apache.httpcomponents + httpcore + 4.3.1 + + + + + + commons-io + commons-io + 2.4 + + + commons-fileupload + commons-fileupload + 1.3 + + + + + org.apache.poi + poi + 3.10-FINAL + + + org.apache.poi + poi-ooxml + 3.10-FINAL + + + org.apache.poi + poi-ooxml-schemas + 3.10-FINAL + + + org.apache.poi + poi-scratchpad + 3.10-FINAL + + + + + com.thetransactioncompany + cors-filter + 2.5 + + + org.bitbucket.b_c + jose4j + 0.7.9 + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.0 + + true + ${project.build.sourceEncoding} + 1.7 + 1.7 + + + + org.apache.maven.plugins + maven-resources-plugin + 2.4.3 + + ${project.build.sourceEncoding} + + + + maia + + + + + + windows-1252 + + diff --git a/frontend/src/.svn/entries b/frontend/src/.svn/entries new file mode 100644 index 0000000..52fd174 --- /dev/null +++ b/frontend/src/.svn/entries @@ -0,0 +1,34 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +main +dir + diff --git a/frontend/src/main/.svn/entries b/frontend/src/main/.svn/entries new file mode 100644 index 0000000..899fac1 --- /dev/null +++ b/frontend/src/main/.svn/entries @@ -0,0 +1,37 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +java +dir + +resources +dir + +webapp +dir + diff --git a/frontend/src/main/java/.svn/entries b/frontend/src/main/java/.svn/entries new file mode 100644 index 0000000..af4f988 --- /dev/null +++ b/frontend/src/main/java/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +com +dir + diff --git a/frontend/src/main/java/com/.svn/entries b/frontend/src/main/java/com/.svn/entries new file mode 100644 index 0000000..0a4091b --- /dev/null +++ b/frontend/src/main/java/com/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +fp +dir + diff --git a/frontend/src/main/java/com/fp/.svn/entries b/frontend/src/main/java/com/fp/.svn/entries new file mode 100644 index 0000000..b4d82c5 --- /dev/null +++ b/frontend/src/main/java/com/fp/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +frontend +dir + diff --git a/frontend/src/main/java/com/fp/frontend/.svn/entries b/frontend/src/main/java/com/fp/frontend/.svn/entries new file mode 100644 index 0000000..807d2fb --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/.svn/entries @@ -0,0 +1,58 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +helper +dir + +webservices +dir + +controller +dir + +utility +dir + +servlet +dir + +filter +dir + +enums +dir + +validators +dir + +converters +dir + +prueba +dir + diff --git a/frontend/src/main/java/com/fp/frontend/controller/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/.svn/entries new file mode 100644 index 0000000..cda0820 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/.svn/entries @@ -0,0 +1,132 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +ReportController.java +file + + + + +2022-07-28T03:39:55.950601Z +dcec68f6a39a1198dca16927ce5931d6 +2017-02-08T23:39:58.950238Z +4577 +jespinosa + + + + + + + + + + + + + + + + + + + + + +12562 + +pcustomer +dir + +armas +dir + +security +dir + +AbstractController.java +file + + + + +2022-07-28T03:39:55.950601Z +fc18f2839b0c0b6be16c55d27a169bb9 +2021-05-14T20:37:22.948846Z +4633 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +34013 + +error +dir + +accounting +dir + +general +dir + +pgeneral +dir + +alfresco +dir + +bpm +dir + +pbpm +dir + +pentaho +dir + diff --git a/frontend/src/main/java/com/fp/frontend/controller/.svn/text-base/AbstractController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/.svn/text-base/AbstractController.java.netbeans-base new file mode 100644 index 0000000..f5f4be8 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/.svn/text-base/AbstractController.java.netbeans-base @@ -0,0 +1,1355 @@ +package com.fp.frontend.controller; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.faces.bean.ManagedProperty; +import javax.faces.context.ExternalContext; +import javax.faces.context.FacesContext; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; + +import org.primefaces.context.RequestContext; + +import com.fp.common.helper.BeanManager; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.firmas.rules.common.CertificateUtils; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgGeneral; + +/** + * Clase principal para los controladores + * + * @author jvaca + * @author amerchan Cambio atributos, metodos genericos + * + * @param + */ +public abstract class AbstractController + implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * Registro a ser usado cuando se crea uno nuevo o para edicion + */ + protected T record; + + /** + * Lista de registros a presentar en una tabla de mantenimiento + */ + protected List lrecord; + + /** + * Identificador para obtener la lista de registros del mapa de resultados + * del core + */ + protected String beanalias; + + /** + * Tipo de dato de la entidad que maneja el controlador + */ + protected Class classType; + + // Valores posibles Q(query), P(previous), N(next) + private String queryType; + + /** + * Numero de pagina o registro desde el cual se va a ejecutar la consulta. + */ + protected Integer page = 0; + + /** + * Numero de registros por pagina a consultar. + */ + protected Integer recperpage = 10; + + /** + * Crease utilitaria, para ejecutar una accion en el core, ejecmpo consulta, + * mantenimiento. + */ + protected CallerHelper callerhelper; + + /** + * Lista de registros eliminados associates a una tabla o entitybean. + */ + private final List ldeleted = new ArrayList<>(); + + /** + * Lista de registros nuevos asociados a una tabla o entitybean. + */ + private final List lnew = new ArrayList<>(); + + /** + * Lista de registros modificados asociados a una tabla o entitybean. + */ + private final List lupdated = new ArrayList<>(); + + /** + * Map que contiene los criterios de busqueda de una tabla. + */ + private Map mfilters = new HashMap(); + + /** + * Map que contiene campos extras como descripciones. + */ + private Map mfilelds = new HashMap(); + + /** + * Numero de decimales a manejar en las pantallas. + */ + private Integer decimal = 2; + + /** + * Formato de numeros a utilizar en los outputtext. + */ + private String numberformat = "#,##,##0.000000"; + + /** + * Variable que indica si se ejecuta el autoquery, Ej: en el lov de personas + * deberia ser falso. + */ + protected boolean forceautoquery = true; + + /** + * Variable que indica si la pagina es del BPM y ademas si tiene parametros + * para pegar en la pagina + */ + boolean bpmPage = false; + + /** + * Para indicar que el registro se va a visualizar. + */ + private boolean showRow; + + /** + * Para indicar que se va a insertar un nuevo registro. + */ + private boolean newRow; + + /** + * Id de la tarea de jbpm a ejecutar. + */ + protected String tid; + + /** + * Codigo de estatus de bpm A aprobano, D negado + */ + protected String bpmDataStatus; + + /** + * Cometario de ejecucion de una tarea. + */ + protected String bpmDataComment; + /** + * Atributo para la contrasena de la firma + */ + private String signaturePass; + /** + * Atributo para el comentario de la firma + */ + private String signatureComments; + /* + * Atributo para el mensaje de la solicitud + */ + private String message; + /** + * Referencia al controlador de session + */ + @ManagedProperty(value = "#{loginController}") + private LoginController loginController; + + /** + * Constructor del controlador + * + * @param type + * Tipo de clase + * @throws Exception + */ + protected AbstractController(Class type) throws Exception { + this.classType = type; + if (this.callerhelper == null) { + this.callerhelper = new CallerHelper( + FacesContext.getCurrentInstance()); + } + } + + /** + * Metodo que verifica si la pagina es de autoconsulta y si debe pegar + * valores del BPM + */ + public void startQuery() { + try { + this.bpmPage = this.pasteBpmScreenParameters(); + if (!this.bpmPage && this.forceautoquery + && this.callerhelper.isautoquery()) { + this.query(); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que verifica si la pagina es de BPM, pega los valores en los + * filtros y realiza la consulta de la p´gina + * + * @return + * @throws Exception + */ + public boolean pasteBpmScreenParameters() throws Exception { + this.getLoginController().setRenderBpmData(false); + String bpmParamsJson = this.getRequestParameter("bpmParams"); + if (bpmParamsJson == null) { + return false; + } + bpmParamsJson = bpmParamsJson.substring(1, bpmParamsJson.length() - 1); + if (!bpmParamsJson.isEmpty()) { + String[] bpmParams = bpmParamsJson.split(","); + for (String item : bpmParams) { + String[] param = item.split("="); + this.manageBpmParameter(param); + } + return true; + } + return false; + } + + private void manageBpmParameter(String[] param) throws Exception { + String key = param[0].trim(); + String value = param[1]; + if (key.equals("null")) { + return; + } + if (key.equals("TID")) { + tid = param[1]; + return; + } + if (key.equals("KIND")) { + if (value.compareTo("OK_NO") == 0) { + this.getLoginController().setRenderBpmData(true); + } else if (value.compareTo("OK") == 0) { + this.bpmDataStatus = "A"; + } + return; + } + + this.mfilters.put(param[0].trim(), param[1]); + } + + /** + * Funcion que verifica que exista al menos un filtro de busqueda + * + * @return boolean + */ + public boolean existAtLeastOneFilterValue() { + Set keys = this.mfilters.keySet(); + for (String key : keys) { + String val = this.mfilters.get(key); + if (!key.equals("pk.dateto")) { + if ((val != null) && !val.isEmpty()) { + return true; + } + } + } + return false; + } + + /** + * Metodo que agrega la fecha hasta (dateto) al mapa de filtros + * + * @throws Exception + */ + public void addFilterDateto() throws Exception { + this.mfilters.put("pk.dateto", "2999-12-31"); + } + + /** + * Crea una instancia de una entidad T y marca el registro como nuevo. + * + * @throws Exception + */ + @SuppressWarnings("unchecked") + public void create() throws Exception { + this.record = (T) Class.forName(this.classType.getName()).newInstance(); + BeanManager.setBeanAttributeValue(this.record, "isnew", true); + try { + BeanManager.setBeanAttributeValue(this.record, "pk", + Class.forName(this.classType.getName() + "Key") + .newInstance()); + } catch (Exception e) { + } + } + + /** + * Metodo a ser sobreescrito en los controladores. En este método a + * sobrescribir se debe colocar la lógica para invocar al core y + * guardar los registros. + */ + public void save() { + }; + + /** + * Adiciona datos de un registro a ser eliminado de la base de datos. + * + * @param bean + * Objeto a eliminar. + * @throws Exception + */ + @SuppressWarnings("unchecked") + public void remove() throws Exception { + if (this.record == null) { + return; + } + this.removefromlista(this.lrecord, this.record); + if (!this.record.isnew) { + this.ldeleted.add(this.record); + } + this.removefromlista((List) this.lnew, this.record); + this.removefromlista((List) this.lupdated, this.record); + } + + /** + * Elimina un registro de la lista comparando el rowkey del registro. + * + * @param ldata + * Lista de registros a buscar y remover un objeto. + * @param abstractbean + * Bean a remover de la lista. + * @throws Exception + */ + private void removefromlista(List ldata, T abstractbean) + throws Exception { + int size = ldata.size(); + for (int i = 0; i < size; i++) { + if (ldata.get(i).rowkey() == abstractbean.rowkey()) { + ldata.remove(i); + break; + } + } + } + + /** + * Adiciona un registro a la lista de registros que se va a insertar en la + * base de datos. + * + * @param bean + * Abjeto a insertar. + * @throws Exception + */ + protected void addNew(AbstractDataTransport bean) throws Exception { + if (!this.lnew.contains(bean)) { + this.lnew.add(bean); + } + } + + /** + * Adiciona un registro a la lista de registros que se va a actualizar en la + * base de datos. + * + * @param bean + * @throws Exception + */ + protected void addUpdated(AbstractDataTransport bean) throws Exception { + if (!this.lupdated.contains(bean)) { + this.lupdated.add(bean); + } + } + + /** + * Actualiza datos de registros nuevos o modifiados, si el registro es nuevo + * se adiciona a lista de nuevos, si es actualizado se adiciona a la lista + * de actualizados. + * + * @throws Exception + */ + @SuppressWarnings("unchecked") + public void update() throws Exception { + AbstractDataTransport bean = this.record; + if (bean == null) { + return; + } + if (bean.isnew) { + if (!this.exist(bean, (List) this.lrecord)) { + this.addNew(bean); + this.lrecord.add((T) bean); + } + } else { + this.addUpdated(bean); + } + } + + /** + * + * @param bean + * @param ldata + * @return + * @throws Exception + */ + private boolean exist(AbstractDataTransport bean, + List ldata) throws Exception { + for (AbstractDataTransport obj : ldata) { + if (obj.rowkey() == bean.rowkey()) { + return true; + } + } + return false; + } + + /** + * Metodo que tiene que sobreescribir las clases que trabajen con el core. + * En este metodo se debe implementar la consulta de las las tablas que se + * requieran + */ + protected abstract void querydatabase(); + + /** + * Ejecuta consulta de datos en la base para la tabla. + * + * @throws Exception + */ + public void query() throws Exception { + this.queryType = "Q"; + if (this.validateQuery()) { + this.page = 0; + this.querydatabase(); + } + } + + private boolean validateQuery() { + if (this.lupdated.isEmpty() && this.lnew.isEmpty() + && this.ldeleted.isEmpty()) { + return true; + } else { + RequestContext.getCurrentInstance().execute( + "PF('queryConfirmDialog').show()"); + } + return false; + } + + public void forcedQuery() throws Exception { + this.lupdated.clear(); + this.lnew.clear(); + this.ldeleted.clear(); + this.lrecord.clear(); + if (this.queryType == null) { + this.queryType = "default"; // valor dummy para que no de null + // pointer exception en el switch + } + switch (this.queryType) { + case "P": + this.previous(); + break; + case "N": + this.next(); + break; + default: + this.query(); + break; + } + } + + /** + * Ejecuta consulta de la sigueinte pagina. + * + * @throws Exception + */ + public void next() throws Exception { + this.queryType = "N"; + if (this.validateQuery()) { + this.page = ((this.page > 0) && (this.lrecord.size() == 0)) ? this.page + : this.page + this.recperpage; + this.querydatabase(); + } + } + + /** + * Ejecuta consulta de la pagina anterior. + * + * @throws Exception + */ + public void previous() throws Exception { + this.queryType = "P"; + if (this.validateQuery()) { + this.page = this.page - this.recperpage; + this.page = this.page < 0 ? 0 : this.page; + this.querydatabase(); + } + } + + /** + * Entrega el dto de save, con los registros a insertar, eliminar, modificar + * para una tabla. + * + * @param beanname + * Nombre del bean. + * @return + * @throws Exception + */ + public DtoSave getDtoSave() throws Exception { + DtoSave dto = new DtoSave(); + dto.setBeanname(this.classType.getName()); + for (AbstractDataTransport bean : this.lnew) { + // para que siempre fije el valor del rowkey. + bean.rowkey(); + bean.getModifiedData().put("isnew", "1"); + } + dto.addNew(this.lnew); + dto.addDeleted(this.ldeleted); + // Quita el bean original de los modificados y marca el bean para + // actualizacion. + for (AbstractDataTransport mod : this.lupdated) { + if (mod.get("ORIGINALBEAN") == null) { + continue; + } + mod.isupdated = false; + AbstractDataTransport boriginal = (AbstractDataTransport) mod + .get("ORIGINALBEAN"); + HashMap modificados = BeanManager.getModified( + boriginal, mod); + if (!modificados.isEmpty()) { + mod.isupdated = true; + // solo si existe cambios se adiciona a la lista de modificado. + dto.getLupdated().add(modificados); + } + } + // adiciona campos sueltos. + return dto; + } + + /** + * Entrega el dto de save, con los registros a insertar, eliminar, modificar + * para una tabla. + * + * @param isForm + * V si es formulario. + * @return dto + * @throws Exception + */ + public DtoSave getDtoSave(boolean isForm) throws Exception { + DtoSave dto = this.getDtoSave(); + dto.setIsForm(isForm); + return dto; + } + + /** + * Metodo que retorna un objeto de tipo DtoQuery que sirve para realizar + * consultas + * + * @param isMultirecord + * @return + * @throws Exception + */ + public DtoQuery getDtoQuery(boolean isMultirecord) throws Exception { + DtoQuery dto = new DtoQuery(this.classType.getName(), this.page, + this.recperpage, isMultirecord, this.getMfilters()); + return dto; + } + + /** + * Metodo usado despues de grabar exitosamente los datos en la base + * + * @param response + * @throws Exception + */ + public void postCommit(Response response) throws Exception { + this.postCommitGeneric(response, this.beanalias); + } + + /** + * Si el commit se relaliza con exito, suma 1 al campo optlock para poder + * hacer un nuevo mantenimiento del registro. Completa las claves primarias + * de los registros nuevos + * + * @throws Exception + */ + @SuppressWarnings("unchecked") + protected void postCommitGeneric(Response response, String alias) + throws Exception { + for (AbstractDataTransport bean : this.lupdated) { + this.postcommitbean(bean); + } + // marca el registro como no nuevo va antes de actualizar pk. + for (AbstractDataTransport bean : this.lnew) { + bean.isnew = false; + this.postcommitbean(bean); + } + // Actualiza pk de los registros nuevos. + if (response.get(alias) != null) { + List> lresp = (List>) response + .get(alias); + for (Map m : lresp) { + this.updatePkOnRecords(m); + } + } + // Encera registros nuevos. + this.lnew.clear(); + this.ldeleted.clear(); + this.lupdated.clear(); + } + + /** + * Metodo que maneja la version de registros de una entidad + * + * @param bean + * @throws Exception + */ + private void postcommitbean(AbstractDataTransport bean) throws Exception { + Integer optlock = BeanManager.getRecordversion(bean); + if (optlock != null) { + if (bean.isupdated) { + BeanManager.setBeanAttributeValue(bean, "recordversion", + optlock + 1); + } else { + BeanManager.setBeanAttributeValue(bean, "recordversion", + optlock); + } + } + this.postQuery(bean); + } + + /** + * Metodo que actualiza los pk's de los registros nuevos + * + * @param m + * @throws Exception + */ + private void updatePkOnRecords(Map m) throws Exception { + String id = m.get("rowkey").toString(); + AbstractDataTransport bean = this.getNewBeanById(Integer.valueOf(id)); + if (bean == null) { + return; + } + Set s = m.keySet(); + for (String key : s) { + if (key.equals("rowkey")) { + continue; + } + BeanManager.setBeanAttributeValue(bean, key.replace("pk_", "pk."), + m.get(key)); + } + } + + /** + * Metodo que obtiene una entidad de la lista de registros nuevos por id + * + * @param id + * @return + * @throws Exception + */ + private AbstractDataTransport getNewBeanById(Integer id) throws Exception { + AbstractDataTransport bean = null; + for (AbstractDataTransport obj : this.lnew) { + if (obj.rowkey() == id) { + bean = obj; + } + } + return bean; + } + + /** + * Metodo que clona una lista de entidades + * + * @param lbeans + * @throws Exception + */ + @SuppressWarnings("rawtypes") + public void postQuery(List lbeans) throws Exception { + for (Object bean : lbeans) { + if (bean instanceof AbstractDataTransport) { + this.postQuery((AbstractDataTransport) bean); + } + } + } + + /** + * Metodo que clona una entidad y lo coloca en un mapa dentro de la misma + * para poder dar mantenimiento + * + * @param bean + * @throws Exception + */ + public void postQuery(AbstractDataTransport bean) throws Exception { + if (bean == null) { + return; + } + bean.isupdated = false; // Se cambia a true cuando arma el mensaje que + // se envia al core. + AbstractDataTransport boriginal = (AbstractDataTransport) bean + .cloneMe(); + bean.put("ORIGINALBEAN", boriginal); + } + + /** + * Metodo que limplia las listas de objetos + */ + public void clearAll() { + this.mfilelds.clear(); + this.mfilters.clear(); + this.lupdated.clear(); + this.lnew.clear(); + this.ldeleted.clear(); + this.lrecord.clear(); + } + + /** + * Metodo que obtiene el valor de un parametro enviado desde la p´gina + * + * @param key + * @return + * @throws Exception + */ + public String getRequestParameter(String key) throws Exception { + return FacesContext.getCurrentInstance().getExternalContext() + .getRequestParameterMap().get(key); + } + + /** + * Metodo que retorna un mapa de parametros enviados desde una pagina + * + * @return + * @throws Exception + */ + public Map getRequestParameterMap() throws Exception { + return FacesContext.getCurrentInstance().getExternalContext() + .getRequestParameterMap(); + } + + /** + * Metodo usado para descargar archivos + * + * @param fileByte + * @param contentType + * @param extension + */ + public void downloadFile(byte[] fileByte, String contentType, + String extension) { + try { + int read = 0; + byte[] bytes = new byte[1024]; + + InputStream input = new ByteArrayInputStream(fileByte); + FacesContext context = FacesContext.getCurrentInstance(); + ExternalContext external = context.getExternalContext(); + HttpServletResponse response = (HttpServletResponse) external + .getResponse(); + response.setContentType(contentType); + response.setHeader("Content-Disposition", + "attachment; filename=fileDownload." + extension); + ServletOutputStream out = response.getOutputStream(); + + while ((read = input.read(bytes)) != -1) { + out.write(bytes, 0, read); + } + out.flush(); + out.close(); + context.responseComplete(); + } catch (Exception ex) { + + } + } + + /** + * Entrega el valor de: recperpage + * + * @return Integer + */ + public Integer getRecperpage() { + return this.recperpage; + } + + /** + * Fija el valor de: recperpage + * + * @param Valor + * a fijar en el atributo. + */ + public void setRecperpage(Integer recperpage) { + this.recperpage = recperpage; + } + + /** + * Entrega el valor de: callerhelper + * + * @return CallerHelper + */ + public CallerHelper getCallerhelper() { + return this.callerhelper; + } + + /** + * Fija el valor de: callerhelper + * + * @param Valor + * a fijar en el atributo. + */ + public void setCallerhelper(CallerHelper callerhelper) { + this.callerhelper = callerhelper; + } + + /** + * Entrega el valor de: mfilters + * + * @return Map + */ + public Map getMfilters() { + return this.mfilters; + } + + /** + * Fija el valor de: mfilters + * + * @param Valor + * a fijar en el atributo. + */ + public void setMfilters(Map mfilters) { + this.mfilters = mfilters; + } + + public void addFilter(String field, String value) { + this.mfilters.put(field, value); + } + + /** + * Entrega el valor de: mfilelds + * + * @return Map + */ + public Map getMfilelds() { + return this.mfilelds; + } + + /** + * Fija el valor de: mfilelds + * + * @param Valor + * a fijar en el atributo. + */ + public void setMfilelds(Map mfilelds) { + this.mfilelds = mfilelds; + } + + /** + * Entrega el valor de: decimal + * + * @return Integer + */ + public Integer getDecimal() { + return this.decimal; + } + + /** + * Fija el valor de: decimal + * + * @param Valor + * a fijar en el atributo. + */ + public void setDecimal(Integer decimal) { + this.decimal = decimal; + } + + /** + * Entrega el valor de: numberformat + * + * @return String + */ + public String getNumberformat() { + return this.numberformat; + } + + /** + * Fija el valor de: numberformat + * + * @param Valor + * a fijar en el atributo. + */ + public void setNumberformat(String numberformat) { + this.numberformat = numberformat; + } + + /** + * Entrega el valor de: forceautoquery + * + * @return boolean + */ + public boolean isForceautoquery() { + return this.forceautoquery; + } + + /** + * Fija el valor de: forceautoquery + * + * @param Valor + * a fijar en el atributo. + */ + public void setForceautoquery(boolean forceautoquery) { + this.forceautoquery = forceautoquery; + } + + /** + * Entrega el valor de: bpmPage + * + * @return boolean + */ + public boolean isBpmPage() { + return this.bpmPage; + } + + /** + * Fija el valor de: bpmPage + * + * @param bpmPage + * Valor a fijar en el atributo + */ + public void setBpmPage(boolean bpmPage) { + this.bpmPage = bpmPage; + } + + /** + * Entrega el valor de: record + * + * @return T + */ + public T getRecord() { + return this.record; + } + + /** + * Fija el valor de: record + * + * @param Valor + * a fijar en el atributo + */ + public void setRecord(T record) { + this.record = record; + } + + /** + * Entrega el valor de: lrecord + * + * @return List + */ + public List getLrecord() { + return this.lrecord; + } + + /** + * Fija el valor de: lrecord + * + * @param Valor + * a fijar en el atributo + */ + public void setLrecord(List lrecord) { + this.lrecord = lrecord; + } + + /** + * Entrega el valor de: beanalias + * + * @return String + */ + public String getBeanalias() { + return this.beanalias; + } + + /** + * Entrega el valor de: beanalias + * + * @return String + */ + public void setBeanalias(String beanalias) { + this.beanalias = beanalias; + } + + /** + * Entrega el valor de: showRow + * + * @return boolean + */ + public boolean isShowRow() { + return this.showRow; + } + + /** + * Fija el valor de: showRow + * + * @param Valor + * a fijar en el atributo. + */ + public void setShowRow(boolean showRow) { + this.showRow = showRow; + } + + public boolean isNewRow() { + return this.newRow; + } + + public void setNewRow(boolean newRow) { + this.newRow = newRow; + } + + public void addField(String field, Object value) { + this.mfilelds.put(field, value); + } + + public Object getFieldvalue(String field) { + return this.mfilelds.get(field); + } + + /** + * Entrega el valor de: loginController + * + * @return LoginController + */ + public LoginController getLoginController() { + return this.loginController; + } + + /** + * Fija el valor de: loginController + * + * @param Valor + * a fijar en el atributo. + */ + public void setLoginController(LoginController loginController) { + this.loginController = loginController; + } + + /** + * Entrega el valor de: bpmDataStatus + * + * @return String + */ + public String getBpmDataStatus() { + return bpmDataStatus; + } + + /** + * Fija el valor de: bpmDataStatus + * + * @param bpmDataStatus + * Valor a fijar en el atributo. + */ + public void setBpmDataStatus(String bpmDataStatus) { + this.bpmDataStatus = bpmDataStatus; + } + + /** + * Entrega el valor de: bpmDataComment + * + * @return String + */ + public String getBpmDataComment() { + return bpmDataComment; + } + + /** + * Fija el valor de: bpmDataComment + * + * @param bpmDataComment + * Valor a fijar en el atributo. + */ + public void setBpmDataComment(String bpmDataComment) { + this.bpmDataComment = bpmDataComment; + } + + /** + * Metodo que se encarga de encerar datos de consultas, mantenimeintos y + * datos adicionales de un request, se utliza para iniciar flujos de un bpm. + * + * @param request + * Objeto a limpiar informacion. + * @throws Exception + */ + public void cleanRequest(Request request) throws Exception { + request.modifiedData().clear(); + if (request.getSaveTables() != null) { + request.getSaveTables().clear(); + } + if (request.getQueryTables() != null) { + request.getQueryTables().clear(); + } + + } + /** + * Entrega el password del firmante + * @return signaturePass + */ + public String getSignaturePass() { + return signaturePass; + } + /** + * Fija el password del firmante + * @param signaturePass + */ + public void setSignaturePass(String signaturePass) { + this.signaturePass = signaturePass; + } + /** + * Entrega el motivo del firmado + * @return + */ + public String getSignatureComments() { + return signatureComments; + } + /** + * Fija el motivo del firmado + * @param signatureComments + */ + public void setSignatureComments(String signatureComments) { + this.signatureComments = signatureComments; + } + /** + * Entrega el valor del mensaje + * @return message + */ + public String getMessage() { + return message; + } + /** + * Fija el valor del mensaje + * @param message + */ + public void setMessage(String message) { + this.message = message; + } + /** + * Metodo que comprueba las firmas de un documento + * @param codSol + * @param codEmp + * @param nomTipo + */ + public boolean checkSignature(String codSol, String codEmp, String nomTipo) { + int count=0; + InputStream originalDocTemplate = AlfrescoController.getDocumentByCode(codSol, nomTipo, this.getLoginController().getRequest().getCompany().toString()); + if(originalDocTemplate==null){ + return false; + } + List signs = CertificateUtils.obtainNameSigns(originalDocTemplate); + if (signs!=null && signs.size() > 0) { + for (String sign : signs) { + if (sign.equalsIgnoreCase(codEmp)) { + ++count; + } + } + if(count==0) + { + return true; + } + } + return false; + } + + /** + * Metodo para el firmado electronico de documentos + * + * @param codSol + * - Codigo de la solicitud + * @param codEmp + * - Codigo del empleado + * @param nomTipo + * - Tipo de documento (solicitud, informe) + */ + /*public void signatureDocument(String codSol, String codEmp, String nomTipo, + int company, String usuario) { + + String pathStoreCertificates= ParametersController.find(EnumParametros.PATH_CERTIFICADO_BCE.getCodigo(),(company+"")).getTextvalue(); + String nomCert = CertificadosController.find(usuario).getPk().getIdcertificado(); + + + String path =pathStoreCertificates+"/"+nomCert; + + InputStream originalDocTemplate = AlfrescoController.getDocumentByCode(codSol, nomTipo, this.getLoginController().getRequest().getCompany().toString()); + + List signs = CertificateUtils + .obtainNameSigns(originalDocTemplate); + float llx = 50; + float lly = 210; + float urx = 305; + float ury = 277; + Rectangle rectangle = new Rectangle(llx, lly, urx, ury); + + if (signs.size() > 0) { + for (String sign : signs) { + if (sign.equalsIgnoreCase(codEmp)) { + MessageHelper.setMessageWarn("msg_firmaExistente"); + return; + } + } + + } + + InputStream originalDoc = AlfrescoController.getDocumentByCode(codSol, nomTipo, this.getLoginController().getRequest().getCompany().toString()); + + byte[] signedDoc = null; + try { + signedDoc = CertificateUtils.sign(originalDoc, usuario, + this.signaturePass, company, this.signatureComments, + this.signatureComments, rectangle, 1, codEmp, + path); + + if (signedDoc != null) { + InputStream uploadDoc = new ByteArrayInputStream(signedDoc); + + AlfrescoController.uploadSignedDocument(uploadDoc, codSol, + nomTipo); + + } + originalDocTemplate.close(); + originalDoc.close(); + } catch (Exception e1) { + + e1.printStackTrace(); + } + + }*/ + + /** + * Metodo para el firmado electronico de documentos; Aprobaciones + * + * @param codSol + * - Codigo de la solicitud + * @param codEmp + * - Codigo del empleado + * @param nomTipo + * - Tipo de documento (solicitud, informe) + */ + /*public void signatureDocumentAPR(String codSol, String codEmp, String nomTipo, + int company, String usuario) { + + InputStream originalDocTemplate = AlfrescoController.getDocumentByCode(codSol, nomTipo, this.getLoginController().getRequest().getCompany().toString()); + TfirmCertificado certificado = CertificadosController.find(usuario); + if(certificado == null){ + MessageHelper.setMessageError("msg_certificateNotParam"); + return; + } + String nomCert = certificado.getPk().getIdcertificado(); + String pathStoreCertificates= ParametersController.find(EnumParametros.PATH_CERTIFICADO_BCE.getCodigo(),(company+"")).getTextvalue(); + + String path =pathStoreCertificates+"/"+nomCert; + + List signs = CertificateUtils + .obtainNameSigns(originalDocTemplate); + float llx = 50; + float lly = 210; + float urx = 305; + float ury = 277; + Rectangle rectangle = new Rectangle(llx, lly, urx, ury); + + if (signs.size() > 0) { + for (String sign : signs) { + if (sign.equalsIgnoreCase(codEmp)) { + MessageHelper.setMessageWarn("msg_firmaExistente"); + return; + } + } + + InputStream originalDoc = AlfrescoController.getDocumentByCode(codSol, nomTipo, this.getLoginController().getRequest().getCompany().toString()); + + byte[] signedDoc = null; + try { + signedDoc = CertificateUtils.sign(originalDoc, usuario, + this.signaturePass, company, this.signatureComments, + this.signatureComments, rectangle, 1, codEmp, + path); + + if (signedDoc != null) { + InputStream uploadDoc = new ByteArrayInputStream(signedDoc); + + AlfrescoController.uploadSignedDocument(uploadDoc, codSol, + nomTipo); + + } + originalDocTemplate.close(); + originalDoc.close(); + } catch (Exception e1) { + + e1.printStackTrace(); + } + + } + else + { + MessageHelper.setMessageWarn("msg_sinFirma"); + return; + } + + }*/ + /** + * Metodo que comprueba las firmas de un documento + * @param codSol + * @param codEmp + * @param nomTipo + */ + public void signature(String codSol, String nomTipo, String tipo) { + int count=0; + InputStream originalDocTemplate = AlfrescoController.getDocumentByCode(codSol, nomTipo, this.getLoginController().getRequest().getCompany().toString()); + if(originalDocTemplate==null){ + this.message = MsgGeneral.getProperty("msg_solicitudeNotSign"); + return; + } + List signs = CertificateUtils.obtainNameSigns(originalDocTemplate); + if (signs!=null && !signs.isEmpty()) { + this.message = tipo.equals("S")?MsgGeneral.getProperty("msg_solicitudeSign"):MsgGeneral.getProperty("msg_informSign"); + } + this.message = tipo.equals("S")?MsgGeneral.getProperty("msg_solicitudeNotSign"):MsgGeneral.getProperty("msg_informNotSign"); + } + /** + * Método para el inicio de flujo + */ + public void iniciarFlujo() { + try { + + Request request = callerhelper.getRequest(); + this.cleanRequest(request); + + request.modifiedData().put("csolicitud", "123456"); + request.modifiedData().put("isnew", "Y"); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + /** + * Método para el inicio de flujo + */ + public void completarTarea() { + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + this.cleanRequest(request); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment); + //request.modifiedData().put("validate", "Y"); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/.svn/text-base/AbstractController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/.svn/text-base/AbstractController.java.svn-base new file mode 100644 index 0000000..f5f4be8 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/.svn/text-base/AbstractController.java.svn-base @@ -0,0 +1,1355 @@ +package com.fp.frontend.controller; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.faces.bean.ManagedProperty; +import javax.faces.context.ExternalContext; +import javax.faces.context.FacesContext; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; + +import org.primefaces.context.RequestContext; + +import com.fp.common.helper.BeanManager; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.firmas.rules.common.CertificateUtils; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgGeneral; + +/** + * Clase principal para los controladores + * + * @author jvaca + * @author amerchan Cambio atributos, metodos genericos + * + * @param + */ +public abstract class AbstractController + implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * Registro a ser usado cuando se crea uno nuevo o para edicion + */ + protected T record; + + /** + * Lista de registros a presentar en una tabla de mantenimiento + */ + protected List lrecord; + + /** + * Identificador para obtener la lista de registros del mapa de resultados + * del core + */ + protected String beanalias; + + /** + * Tipo de dato de la entidad que maneja el controlador + */ + protected Class classType; + + // Valores posibles Q(query), P(previous), N(next) + private String queryType; + + /** + * Numero de pagina o registro desde el cual se va a ejecutar la consulta. + */ + protected Integer page = 0; + + /** + * Numero de registros por pagina a consultar. + */ + protected Integer recperpage = 10; + + /** + * Crease utilitaria, para ejecutar una accion en el core, ejecmpo consulta, + * mantenimiento. + */ + protected CallerHelper callerhelper; + + /** + * Lista de registros eliminados associates a una tabla o entitybean. + */ + private final List ldeleted = new ArrayList<>(); + + /** + * Lista de registros nuevos asociados a una tabla o entitybean. + */ + private final List lnew = new ArrayList<>(); + + /** + * Lista de registros modificados asociados a una tabla o entitybean. + */ + private final List lupdated = new ArrayList<>(); + + /** + * Map que contiene los criterios de busqueda de una tabla. + */ + private Map mfilters = new HashMap(); + + /** + * Map que contiene campos extras como descripciones. + */ + private Map mfilelds = new HashMap(); + + /** + * Numero de decimales a manejar en las pantallas. + */ + private Integer decimal = 2; + + /** + * Formato de numeros a utilizar en los outputtext. + */ + private String numberformat = "#,##,##0.000000"; + + /** + * Variable que indica si se ejecuta el autoquery, Ej: en el lov de personas + * deberia ser falso. + */ + protected boolean forceautoquery = true; + + /** + * Variable que indica si la pagina es del BPM y ademas si tiene parametros + * para pegar en la pagina + */ + boolean bpmPage = false; + + /** + * Para indicar que el registro se va a visualizar. + */ + private boolean showRow; + + /** + * Para indicar que se va a insertar un nuevo registro. + */ + private boolean newRow; + + /** + * Id de la tarea de jbpm a ejecutar. + */ + protected String tid; + + /** + * Codigo de estatus de bpm A aprobano, D negado + */ + protected String bpmDataStatus; + + /** + * Cometario de ejecucion de una tarea. + */ + protected String bpmDataComment; + /** + * Atributo para la contrasena de la firma + */ + private String signaturePass; + /** + * Atributo para el comentario de la firma + */ + private String signatureComments; + /* + * Atributo para el mensaje de la solicitud + */ + private String message; + /** + * Referencia al controlador de session + */ + @ManagedProperty(value = "#{loginController}") + private LoginController loginController; + + /** + * Constructor del controlador + * + * @param type + * Tipo de clase + * @throws Exception + */ + protected AbstractController(Class type) throws Exception { + this.classType = type; + if (this.callerhelper == null) { + this.callerhelper = new CallerHelper( + FacesContext.getCurrentInstance()); + } + } + + /** + * Metodo que verifica si la pagina es de autoconsulta y si debe pegar + * valores del BPM + */ + public void startQuery() { + try { + this.bpmPage = this.pasteBpmScreenParameters(); + if (!this.bpmPage && this.forceautoquery + && this.callerhelper.isautoquery()) { + this.query(); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que verifica si la pagina es de BPM, pega los valores en los + * filtros y realiza la consulta de la p´gina + * + * @return + * @throws Exception + */ + public boolean pasteBpmScreenParameters() throws Exception { + this.getLoginController().setRenderBpmData(false); + String bpmParamsJson = this.getRequestParameter("bpmParams"); + if (bpmParamsJson == null) { + return false; + } + bpmParamsJson = bpmParamsJson.substring(1, bpmParamsJson.length() - 1); + if (!bpmParamsJson.isEmpty()) { + String[] bpmParams = bpmParamsJson.split(","); + for (String item : bpmParams) { + String[] param = item.split("="); + this.manageBpmParameter(param); + } + return true; + } + return false; + } + + private void manageBpmParameter(String[] param) throws Exception { + String key = param[0].trim(); + String value = param[1]; + if (key.equals("null")) { + return; + } + if (key.equals("TID")) { + tid = param[1]; + return; + } + if (key.equals("KIND")) { + if (value.compareTo("OK_NO") == 0) { + this.getLoginController().setRenderBpmData(true); + } else if (value.compareTo("OK") == 0) { + this.bpmDataStatus = "A"; + } + return; + } + + this.mfilters.put(param[0].trim(), param[1]); + } + + /** + * Funcion que verifica que exista al menos un filtro de busqueda + * + * @return boolean + */ + public boolean existAtLeastOneFilterValue() { + Set keys = this.mfilters.keySet(); + for (String key : keys) { + String val = this.mfilters.get(key); + if (!key.equals("pk.dateto")) { + if ((val != null) && !val.isEmpty()) { + return true; + } + } + } + return false; + } + + /** + * Metodo que agrega la fecha hasta (dateto) al mapa de filtros + * + * @throws Exception + */ + public void addFilterDateto() throws Exception { + this.mfilters.put("pk.dateto", "2999-12-31"); + } + + /** + * Crea una instancia de una entidad T y marca el registro como nuevo. + * + * @throws Exception + */ + @SuppressWarnings("unchecked") + public void create() throws Exception { + this.record = (T) Class.forName(this.classType.getName()).newInstance(); + BeanManager.setBeanAttributeValue(this.record, "isnew", true); + try { + BeanManager.setBeanAttributeValue(this.record, "pk", + Class.forName(this.classType.getName() + "Key") + .newInstance()); + } catch (Exception e) { + } + } + + /** + * Metodo a ser sobreescrito en los controladores. En este método a + * sobrescribir se debe colocar la lógica para invocar al core y + * guardar los registros. + */ + public void save() { + }; + + /** + * Adiciona datos de un registro a ser eliminado de la base de datos. + * + * @param bean + * Objeto a eliminar. + * @throws Exception + */ + @SuppressWarnings("unchecked") + public void remove() throws Exception { + if (this.record == null) { + return; + } + this.removefromlista(this.lrecord, this.record); + if (!this.record.isnew) { + this.ldeleted.add(this.record); + } + this.removefromlista((List) this.lnew, this.record); + this.removefromlista((List) this.lupdated, this.record); + } + + /** + * Elimina un registro de la lista comparando el rowkey del registro. + * + * @param ldata + * Lista de registros a buscar y remover un objeto. + * @param abstractbean + * Bean a remover de la lista. + * @throws Exception + */ + private void removefromlista(List ldata, T abstractbean) + throws Exception { + int size = ldata.size(); + for (int i = 0; i < size; i++) { + if (ldata.get(i).rowkey() == abstractbean.rowkey()) { + ldata.remove(i); + break; + } + } + } + + /** + * Adiciona un registro a la lista de registros que se va a insertar en la + * base de datos. + * + * @param bean + * Abjeto a insertar. + * @throws Exception + */ + protected void addNew(AbstractDataTransport bean) throws Exception { + if (!this.lnew.contains(bean)) { + this.lnew.add(bean); + } + } + + /** + * Adiciona un registro a la lista de registros que se va a actualizar en la + * base de datos. + * + * @param bean + * @throws Exception + */ + protected void addUpdated(AbstractDataTransport bean) throws Exception { + if (!this.lupdated.contains(bean)) { + this.lupdated.add(bean); + } + } + + /** + * Actualiza datos de registros nuevos o modifiados, si el registro es nuevo + * se adiciona a lista de nuevos, si es actualizado se adiciona a la lista + * de actualizados. + * + * @throws Exception + */ + @SuppressWarnings("unchecked") + public void update() throws Exception { + AbstractDataTransport bean = this.record; + if (bean == null) { + return; + } + if (bean.isnew) { + if (!this.exist(bean, (List) this.lrecord)) { + this.addNew(bean); + this.lrecord.add((T) bean); + } + } else { + this.addUpdated(bean); + } + } + + /** + * + * @param bean + * @param ldata + * @return + * @throws Exception + */ + private boolean exist(AbstractDataTransport bean, + List ldata) throws Exception { + for (AbstractDataTransport obj : ldata) { + if (obj.rowkey() == bean.rowkey()) { + return true; + } + } + return false; + } + + /** + * Metodo que tiene que sobreescribir las clases que trabajen con el core. + * En este metodo se debe implementar la consulta de las las tablas que se + * requieran + */ + protected abstract void querydatabase(); + + /** + * Ejecuta consulta de datos en la base para la tabla. + * + * @throws Exception + */ + public void query() throws Exception { + this.queryType = "Q"; + if (this.validateQuery()) { + this.page = 0; + this.querydatabase(); + } + } + + private boolean validateQuery() { + if (this.lupdated.isEmpty() && this.lnew.isEmpty() + && this.ldeleted.isEmpty()) { + return true; + } else { + RequestContext.getCurrentInstance().execute( + "PF('queryConfirmDialog').show()"); + } + return false; + } + + public void forcedQuery() throws Exception { + this.lupdated.clear(); + this.lnew.clear(); + this.ldeleted.clear(); + this.lrecord.clear(); + if (this.queryType == null) { + this.queryType = "default"; // valor dummy para que no de null + // pointer exception en el switch + } + switch (this.queryType) { + case "P": + this.previous(); + break; + case "N": + this.next(); + break; + default: + this.query(); + break; + } + } + + /** + * Ejecuta consulta de la sigueinte pagina. + * + * @throws Exception + */ + public void next() throws Exception { + this.queryType = "N"; + if (this.validateQuery()) { + this.page = ((this.page > 0) && (this.lrecord.size() == 0)) ? this.page + : this.page + this.recperpage; + this.querydatabase(); + } + } + + /** + * Ejecuta consulta de la pagina anterior. + * + * @throws Exception + */ + public void previous() throws Exception { + this.queryType = "P"; + if (this.validateQuery()) { + this.page = this.page - this.recperpage; + this.page = this.page < 0 ? 0 : this.page; + this.querydatabase(); + } + } + + /** + * Entrega el dto de save, con los registros a insertar, eliminar, modificar + * para una tabla. + * + * @param beanname + * Nombre del bean. + * @return + * @throws Exception + */ + public DtoSave getDtoSave() throws Exception { + DtoSave dto = new DtoSave(); + dto.setBeanname(this.classType.getName()); + for (AbstractDataTransport bean : this.lnew) { + // para que siempre fije el valor del rowkey. + bean.rowkey(); + bean.getModifiedData().put("isnew", "1"); + } + dto.addNew(this.lnew); + dto.addDeleted(this.ldeleted); + // Quita el bean original de los modificados y marca el bean para + // actualizacion. + for (AbstractDataTransport mod : this.lupdated) { + if (mod.get("ORIGINALBEAN") == null) { + continue; + } + mod.isupdated = false; + AbstractDataTransport boriginal = (AbstractDataTransport) mod + .get("ORIGINALBEAN"); + HashMap modificados = BeanManager.getModified( + boriginal, mod); + if (!modificados.isEmpty()) { + mod.isupdated = true; + // solo si existe cambios se adiciona a la lista de modificado. + dto.getLupdated().add(modificados); + } + } + // adiciona campos sueltos. + return dto; + } + + /** + * Entrega el dto de save, con los registros a insertar, eliminar, modificar + * para una tabla. + * + * @param isForm + * V si es formulario. + * @return dto + * @throws Exception + */ + public DtoSave getDtoSave(boolean isForm) throws Exception { + DtoSave dto = this.getDtoSave(); + dto.setIsForm(isForm); + return dto; + } + + /** + * Metodo que retorna un objeto de tipo DtoQuery que sirve para realizar + * consultas + * + * @param isMultirecord + * @return + * @throws Exception + */ + public DtoQuery getDtoQuery(boolean isMultirecord) throws Exception { + DtoQuery dto = new DtoQuery(this.classType.getName(), this.page, + this.recperpage, isMultirecord, this.getMfilters()); + return dto; + } + + /** + * Metodo usado despues de grabar exitosamente los datos en la base + * + * @param response + * @throws Exception + */ + public void postCommit(Response response) throws Exception { + this.postCommitGeneric(response, this.beanalias); + } + + /** + * Si el commit se relaliza con exito, suma 1 al campo optlock para poder + * hacer un nuevo mantenimiento del registro. Completa las claves primarias + * de los registros nuevos + * + * @throws Exception + */ + @SuppressWarnings("unchecked") + protected void postCommitGeneric(Response response, String alias) + throws Exception { + for (AbstractDataTransport bean : this.lupdated) { + this.postcommitbean(bean); + } + // marca el registro como no nuevo va antes de actualizar pk. + for (AbstractDataTransport bean : this.lnew) { + bean.isnew = false; + this.postcommitbean(bean); + } + // Actualiza pk de los registros nuevos. + if (response.get(alias) != null) { + List> lresp = (List>) response + .get(alias); + for (Map m : lresp) { + this.updatePkOnRecords(m); + } + } + // Encera registros nuevos. + this.lnew.clear(); + this.ldeleted.clear(); + this.lupdated.clear(); + } + + /** + * Metodo que maneja la version de registros de una entidad + * + * @param bean + * @throws Exception + */ + private void postcommitbean(AbstractDataTransport bean) throws Exception { + Integer optlock = BeanManager.getRecordversion(bean); + if (optlock != null) { + if (bean.isupdated) { + BeanManager.setBeanAttributeValue(bean, "recordversion", + optlock + 1); + } else { + BeanManager.setBeanAttributeValue(bean, "recordversion", + optlock); + } + } + this.postQuery(bean); + } + + /** + * Metodo que actualiza los pk's de los registros nuevos + * + * @param m + * @throws Exception + */ + private void updatePkOnRecords(Map m) throws Exception { + String id = m.get("rowkey").toString(); + AbstractDataTransport bean = this.getNewBeanById(Integer.valueOf(id)); + if (bean == null) { + return; + } + Set s = m.keySet(); + for (String key : s) { + if (key.equals("rowkey")) { + continue; + } + BeanManager.setBeanAttributeValue(bean, key.replace("pk_", "pk."), + m.get(key)); + } + } + + /** + * Metodo que obtiene una entidad de la lista de registros nuevos por id + * + * @param id + * @return + * @throws Exception + */ + private AbstractDataTransport getNewBeanById(Integer id) throws Exception { + AbstractDataTransport bean = null; + for (AbstractDataTransport obj : this.lnew) { + if (obj.rowkey() == id) { + bean = obj; + } + } + return bean; + } + + /** + * Metodo que clona una lista de entidades + * + * @param lbeans + * @throws Exception + */ + @SuppressWarnings("rawtypes") + public void postQuery(List lbeans) throws Exception { + for (Object bean : lbeans) { + if (bean instanceof AbstractDataTransport) { + this.postQuery((AbstractDataTransport) bean); + } + } + } + + /** + * Metodo que clona una entidad y lo coloca en un mapa dentro de la misma + * para poder dar mantenimiento + * + * @param bean + * @throws Exception + */ + public void postQuery(AbstractDataTransport bean) throws Exception { + if (bean == null) { + return; + } + bean.isupdated = false; // Se cambia a true cuando arma el mensaje que + // se envia al core. + AbstractDataTransport boriginal = (AbstractDataTransport) bean + .cloneMe(); + bean.put("ORIGINALBEAN", boriginal); + } + + /** + * Metodo que limplia las listas de objetos + */ + public void clearAll() { + this.mfilelds.clear(); + this.mfilters.clear(); + this.lupdated.clear(); + this.lnew.clear(); + this.ldeleted.clear(); + this.lrecord.clear(); + } + + /** + * Metodo que obtiene el valor de un parametro enviado desde la p´gina + * + * @param key + * @return + * @throws Exception + */ + public String getRequestParameter(String key) throws Exception { + return FacesContext.getCurrentInstance().getExternalContext() + .getRequestParameterMap().get(key); + } + + /** + * Metodo que retorna un mapa de parametros enviados desde una pagina + * + * @return + * @throws Exception + */ + public Map getRequestParameterMap() throws Exception { + return FacesContext.getCurrentInstance().getExternalContext() + .getRequestParameterMap(); + } + + /** + * Metodo usado para descargar archivos + * + * @param fileByte + * @param contentType + * @param extension + */ + public void downloadFile(byte[] fileByte, String contentType, + String extension) { + try { + int read = 0; + byte[] bytes = new byte[1024]; + + InputStream input = new ByteArrayInputStream(fileByte); + FacesContext context = FacesContext.getCurrentInstance(); + ExternalContext external = context.getExternalContext(); + HttpServletResponse response = (HttpServletResponse) external + .getResponse(); + response.setContentType(contentType); + response.setHeader("Content-Disposition", + "attachment; filename=fileDownload." + extension); + ServletOutputStream out = response.getOutputStream(); + + while ((read = input.read(bytes)) != -1) { + out.write(bytes, 0, read); + } + out.flush(); + out.close(); + context.responseComplete(); + } catch (Exception ex) { + + } + } + + /** + * Entrega el valor de: recperpage + * + * @return Integer + */ + public Integer getRecperpage() { + return this.recperpage; + } + + /** + * Fija el valor de: recperpage + * + * @param Valor + * a fijar en el atributo. + */ + public void setRecperpage(Integer recperpage) { + this.recperpage = recperpage; + } + + /** + * Entrega el valor de: callerhelper + * + * @return CallerHelper + */ + public CallerHelper getCallerhelper() { + return this.callerhelper; + } + + /** + * Fija el valor de: callerhelper + * + * @param Valor + * a fijar en el atributo. + */ + public void setCallerhelper(CallerHelper callerhelper) { + this.callerhelper = callerhelper; + } + + /** + * Entrega el valor de: mfilters + * + * @return Map + */ + public Map getMfilters() { + return this.mfilters; + } + + /** + * Fija el valor de: mfilters + * + * @param Valor + * a fijar en el atributo. + */ + public void setMfilters(Map mfilters) { + this.mfilters = mfilters; + } + + public void addFilter(String field, String value) { + this.mfilters.put(field, value); + } + + /** + * Entrega el valor de: mfilelds + * + * @return Map + */ + public Map getMfilelds() { + return this.mfilelds; + } + + /** + * Fija el valor de: mfilelds + * + * @param Valor + * a fijar en el atributo. + */ + public void setMfilelds(Map mfilelds) { + this.mfilelds = mfilelds; + } + + /** + * Entrega el valor de: decimal + * + * @return Integer + */ + public Integer getDecimal() { + return this.decimal; + } + + /** + * Fija el valor de: decimal + * + * @param Valor + * a fijar en el atributo. + */ + public void setDecimal(Integer decimal) { + this.decimal = decimal; + } + + /** + * Entrega el valor de: numberformat + * + * @return String + */ + public String getNumberformat() { + return this.numberformat; + } + + /** + * Fija el valor de: numberformat + * + * @param Valor + * a fijar en el atributo. + */ + public void setNumberformat(String numberformat) { + this.numberformat = numberformat; + } + + /** + * Entrega el valor de: forceautoquery + * + * @return boolean + */ + public boolean isForceautoquery() { + return this.forceautoquery; + } + + /** + * Fija el valor de: forceautoquery + * + * @param Valor + * a fijar en el atributo. + */ + public void setForceautoquery(boolean forceautoquery) { + this.forceautoquery = forceautoquery; + } + + /** + * Entrega el valor de: bpmPage + * + * @return boolean + */ + public boolean isBpmPage() { + return this.bpmPage; + } + + /** + * Fija el valor de: bpmPage + * + * @param bpmPage + * Valor a fijar en el atributo + */ + public void setBpmPage(boolean bpmPage) { + this.bpmPage = bpmPage; + } + + /** + * Entrega el valor de: record + * + * @return T + */ + public T getRecord() { + return this.record; + } + + /** + * Fija el valor de: record + * + * @param Valor + * a fijar en el atributo + */ + public void setRecord(T record) { + this.record = record; + } + + /** + * Entrega el valor de: lrecord + * + * @return List + */ + public List getLrecord() { + return this.lrecord; + } + + /** + * Fija el valor de: lrecord + * + * @param Valor + * a fijar en el atributo + */ + public void setLrecord(List lrecord) { + this.lrecord = lrecord; + } + + /** + * Entrega el valor de: beanalias + * + * @return String + */ + public String getBeanalias() { + return this.beanalias; + } + + /** + * Entrega el valor de: beanalias + * + * @return String + */ + public void setBeanalias(String beanalias) { + this.beanalias = beanalias; + } + + /** + * Entrega el valor de: showRow + * + * @return boolean + */ + public boolean isShowRow() { + return this.showRow; + } + + /** + * Fija el valor de: showRow + * + * @param Valor + * a fijar en el atributo. + */ + public void setShowRow(boolean showRow) { + this.showRow = showRow; + } + + public boolean isNewRow() { + return this.newRow; + } + + public void setNewRow(boolean newRow) { + this.newRow = newRow; + } + + public void addField(String field, Object value) { + this.mfilelds.put(field, value); + } + + public Object getFieldvalue(String field) { + return this.mfilelds.get(field); + } + + /** + * Entrega el valor de: loginController + * + * @return LoginController + */ + public LoginController getLoginController() { + return this.loginController; + } + + /** + * Fija el valor de: loginController + * + * @param Valor + * a fijar en el atributo. + */ + public void setLoginController(LoginController loginController) { + this.loginController = loginController; + } + + /** + * Entrega el valor de: bpmDataStatus + * + * @return String + */ + public String getBpmDataStatus() { + return bpmDataStatus; + } + + /** + * Fija el valor de: bpmDataStatus + * + * @param bpmDataStatus + * Valor a fijar en el atributo. + */ + public void setBpmDataStatus(String bpmDataStatus) { + this.bpmDataStatus = bpmDataStatus; + } + + /** + * Entrega el valor de: bpmDataComment + * + * @return String + */ + public String getBpmDataComment() { + return bpmDataComment; + } + + /** + * Fija el valor de: bpmDataComment + * + * @param bpmDataComment + * Valor a fijar en el atributo. + */ + public void setBpmDataComment(String bpmDataComment) { + this.bpmDataComment = bpmDataComment; + } + + /** + * Metodo que se encarga de encerar datos de consultas, mantenimeintos y + * datos adicionales de un request, se utliza para iniciar flujos de un bpm. + * + * @param request + * Objeto a limpiar informacion. + * @throws Exception + */ + public void cleanRequest(Request request) throws Exception { + request.modifiedData().clear(); + if (request.getSaveTables() != null) { + request.getSaveTables().clear(); + } + if (request.getQueryTables() != null) { + request.getQueryTables().clear(); + } + + } + /** + * Entrega el password del firmante + * @return signaturePass + */ + public String getSignaturePass() { + return signaturePass; + } + /** + * Fija el password del firmante + * @param signaturePass + */ + public void setSignaturePass(String signaturePass) { + this.signaturePass = signaturePass; + } + /** + * Entrega el motivo del firmado + * @return + */ + public String getSignatureComments() { + return signatureComments; + } + /** + * Fija el motivo del firmado + * @param signatureComments + */ + public void setSignatureComments(String signatureComments) { + this.signatureComments = signatureComments; + } + /** + * Entrega el valor del mensaje + * @return message + */ + public String getMessage() { + return message; + } + /** + * Fija el valor del mensaje + * @param message + */ + public void setMessage(String message) { + this.message = message; + } + /** + * Metodo que comprueba las firmas de un documento + * @param codSol + * @param codEmp + * @param nomTipo + */ + public boolean checkSignature(String codSol, String codEmp, String nomTipo) { + int count=0; + InputStream originalDocTemplate = AlfrescoController.getDocumentByCode(codSol, nomTipo, this.getLoginController().getRequest().getCompany().toString()); + if(originalDocTemplate==null){ + return false; + } + List signs = CertificateUtils.obtainNameSigns(originalDocTemplate); + if (signs!=null && signs.size() > 0) { + for (String sign : signs) { + if (sign.equalsIgnoreCase(codEmp)) { + ++count; + } + } + if(count==0) + { + return true; + } + } + return false; + } + + /** + * Metodo para el firmado electronico de documentos + * + * @param codSol + * - Codigo de la solicitud + * @param codEmp + * - Codigo del empleado + * @param nomTipo + * - Tipo de documento (solicitud, informe) + */ + /*public void signatureDocument(String codSol, String codEmp, String nomTipo, + int company, String usuario) { + + String pathStoreCertificates= ParametersController.find(EnumParametros.PATH_CERTIFICADO_BCE.getCodigo(),(company+"")).getTextvalue(); + String nomCert = CertificadosController.find(usuario).getPk().getIdcertificado(); + + + String path =pathStoreCertificates+"/"+nomCert; + + InputStream originalDocTemplate = AlfrescoController.getDocumentByCode(codSol, nomTipo, this.getLoginController().getRequest().getCompany().toString()); + + List signs = CertificateUtils + .obtainNameSigns(originalDocTemplate); + float llx = 50; + float lly = 210; + float urx = 305; + float ury = 277; + Rectangle rectangle = new Rectangle(llx, lly, urx, ury); + + if (signs.size() > 0) { + for (String sign : signs) { + if (sign.equalsIgnoreCase(codEmp)) { + MessageHelper.setMessageWarn("msg_firmaExistente"); + return; + } + } + + } + + InputStream originalDoc = AlfrescoController.getDocumentByCode(codSol, nomTipo, this.getLoginController().getRequest().getCompany().toString()); + + byte[] signedDoc = null; + try { + signedDoc = CertificateUtils.sign(originalDoc, usuario, + this.signaturePass, company, this.signatureComments, + this.signatureComments, rectangle, 1, codEmp, + path); + + if (signedDoc != null) { + InputStream uploadDoc = new ByteArrayInputStream(signedDoc); + + AlfrescoController.uploadSignedDocument(uploadDoc, codSol, + nomTipo); + + } + originalDocTemplate.close(); + originalDoc.close(); + } catch (Exception e1) { + + e1.printStackTrace(); + } + + }*/ + + /** + * Metodo para el firmado electronico de documentos; Aprobaciones + * + * @param codSol + * - Codigo de la solicitud + * @param codEmp + * - Codigo del empleado + * @param nomTipo + * - Tipo de documento (solicitud, informe) + */ + /*public void signatureDocumentAPR(String codSol, String codEmp, String nomTipo, + int company, String usuario) { + + InputStream originalDocTemplate = AlfrescoController.getDocumentByCode(codSol, nomTipo, this.getLoginController().getRequest().getCompany().toString()); + TfirmCertificado certificado = CertificadosController.find(usuario); + if(certificado == null){ + MessageHelper.setMessageError("msg_certificateNotParam"); + return; + } + String nomCert = certificado.getPk().getIdcertificado(); + String pathStoreCertificates= ParametersController.find(EnumParametros.PATH_CERTIFICADO_BCE.getCodigo(),(company+"")).getTextvalue(); + + String path =pathStoreCertificates+"/"+nomCert; + + List signs = CertificateUtils + .obtainNameSigns(originalDocTemplate); + float llx = 50; + float lly = 210; + float urx = 305; + float ury = 277; + Rectangle rectangle = new Rectangle(llx, lly, urx, ury); + + if (signs.size() > 0) { + for (String sign : signs) { + if (sign.equalsIgnoreCase(codEmp)) { + MessageHelper.setMessageWarn("msg_firmaExistente"); + return; + } + } + + InputStream originalDoc = AlfrescoController.getDocumentByCode(codSol, nomTipo, this.getLoginController().getRequest().getCompany().toString()); + + byte[] signedDoc = null; + try { + signedDoc = CertificateUtils.sign(originalDoc, usuario, + this.signaturePass, company, this.signatureComments, + this.signatureComments, rectangle, 1, codEmp, + path); + + if (signedDoc != null) { + InputStream uploadDoc = new ByteArrayInputStream(signedDoc); + + AlfrescoController.uploadSignedDocument(uploadDoc, codSol, + nomTipo); + + } + originalDocTemplate.close(); + originalDoc.close(); + } catch (Exception e1) { + + e1.printStackTrace(); + } + + } + else + { + MessageHelper.setMessageWarn("msg_sinFirma"); + return; + } + + }*/ + /** + * Metodo que comprueba las firmas de un documento + * @param codSol + * @param codEmp + * @param nomTipo + */ + public void signature(String codSol, String nomTipo, String tipo) { + int count=0; + InputStream originalDocTemplate = AlfrescoController.getDocumentByCode(codSol, nomTipo, this.getLoginController().getRequest().getCompany().toString()); + if(originalDocTemplate==null){ + this.message = MsgGeneral.getProperty("msg_solicitudeNotSign"); + return; + } + List signs = CertificateUtils.obtainNameSigns(originalDocTemplate); + if (signs!=null && !signs.isEmpty()) { + this.message = tipo.equals("S")?MsgGeneral.getProperty("msg_solicitudeSign"):MsgGeneral.getProperty("msg_informSign"); + } + this.message = tipo.equals("S")?MsgGeneral.getProperty("msg_solicitudeNotSign"):MsgGeneral.getProperty("msg_informNotSign"); + } + /** + * Método para el inicio de flujo + */ + public void iniciarFlujo() { + try { + + Request request = callerhelper.getRequest(); + this.cleanRequest(request); + + request.modifiedData().put("csolicitud", "123456"); + request.modifiedData().put("isnew", "Y"); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + /** + * Método para el inicio de flujo + */ + public void completarTarea() { + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + this.cleanRequest(request); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment); + //request.modifiedData().put("validate", "Y"); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/.svn/text-base/ReportController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/.svn/text-base/ReportController.java.netbeans-base new file mode 100644 index 0000000..7e79396 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/.svn/text-base/ReportController.java.netbeans-base @@ -0,0 +1,274 @@ +package com.fp.frontend.controller; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.HashMap; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletResponse; + +import net.sf.jasperreports.engine.JRExporterParameter; +import net.sf.jasperreports.engine.JRParameter; +import net.sf.jasperreports.engine.JasperExportManager; +import net.sf.jasperreports.engine.JasperPrint; +import net.sf.jasperreports.engine.export.JRXlsExporterParameter; +import net.sf.jasperreports.engine.export.ooxml.JRXlsxExporter; + +import org.primefaces.model.StreamedContent; + +import com.fp.common.properties.PropertiesHandler; +import com.fp.frontend.controller.pgeneral.date.TgeneAccountingDateBranchController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.jaspersoft.ireport.jasperserver.JServer; +import com.jaspersoft.ireport.jasperserver.ws.WSClient; +import com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ResourceDescriptor; + +/** + * Clase controladora de reportes. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ReportController { + + private StreamedContent streamedContent; + + public ReportController() { + } + + public void execute(String path, HashMap parameters, String format, String filename, LoginController logincontroller) throws Exception { + this.adddefaultparameters(parameters, logincontroller); + if (format == null) { + format = "pdf"; + } + if ((format.compareTo("xls") == 0) || (format.compareTo("xlsx") == 0)) { + parameters.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE); + } + + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition", "attachment; filename=" + filename + ".pdf"); + JasperPrint jasperPrint = this.executereport(logincontroller.getRequest().getCompany()+"/modules/"+ path, parameters); + OutputStream outputStream = response.getOutputStream(); + + JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream); + FacesContext.getCurrentInstance().responseComplete(); + + } + /** + * Método que exporta el reporte a formato .xlsx + * @param path, ruta de acceso al reporte en el servidor jaspersoft + * @param parameters, parámetros que se envían desde el controlador + * @param format, formato de archivo, en este caso xlsx + * @param filename, nombre que tendrá el archivo + * @param logincontroller + * @throws Exception + */ + @SuppressWarnings("deprecation") + public void executeXls(String path, HashMap parameters, String format, String filename, LoginController logincontroller) throws Exception { + this.adddefaultparameters(parameters, logincontroller); + if (format == null) { + format = "pdf"; + } + if ((format.compareTo("xls") == 0) || (format.compareTo("xlsx") == 0)) { + parameters.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE); + } + + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition", "attachment; filename=" + filename + ".xlsx"); + System.out.println(logincontroller.getRequest().getCompany()+"/modules/"+ path); + JasperPrint jasperPrint = this.executereport(logincontroller.getRequest().getCompany()+"/modules/"+ path, parameters); + OutputStream ouputStream = response.getOutputStream(); + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + JRXlsxExporter exporter = new JRXlsxExporter(); + exporter.setParameter(JRXlsExporterParameter.JASPER_PRINT, jasperPrint); + exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, byteArrayOutputStream); + exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE); + exporter.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE); + exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); + exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); + exporter.exportReport(); + ouputStream.write(byteArrayOutputStream.toByteArray()); + ouputStream.flush(); + ouputStream.close(); + FacesContext.getCurrentInstance().responseComplete(); + + } + + + + + private JasperPrint executereport(String pathJasper, HashMap parameters) throws Exception { + PropertiesHandler ph = new PropertiesHandler("jasper"); + + JServer server = new JServer(); + //server.setUsername("jasperadmin"); + server.setUsername(ph.getStringValue("jasperserver.user")); + //server.setPassword("jasperadmin"); + server.setPassword(ph.getStringValue("jasperserver.password")); + //server.setUrl("http://localhost:8080/jasperserver/services/repository"); + server.setUrl(ph.getStringValue("jasperserver.repository")); + ResourceDescriptor rd = new ResourceDescriptor(); + rd.setWsType(ResourceDescriptor.TYPE_REPORTUNIT); + rd.setUriString("/maia/" + pathJasper); + WSClient wsClient = server.getWSClient(); + return wsClient.runReport(rd, parameters); + } + + /** + * Recupera un input stream del reporte pdf + * @param path + * @param parameters + * @param format + * @param filename + * @param logincontroller + * @return + * @throws Exception + */ + public InputStream jaspertoInputstream(String path, HashMap parameters, String format, String filename, LoginController logincontroller) throws Exception{ + this.adddefaultparameters(parameters, logincontroller); + if (format == null) { + format = "pdf"; + } + if ((format.compareTo("xls") == 0) || (format.compareTo("xlsx") == 0)) { + parameters.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE); + } + + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition", "attachment; filename=" + filename + ".pdf"); + JasperPrint jasperPrint = this.executereport(logincontroller.getRequest().getCompany()+"/modules/"+ path, parameters); + + OutputStream outputStream = response.getOutputStream(); + JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream); + InputStream inputStream; + + + byte[] byteArray=JasperExportManager.exportReportToPdf(jasperPrint); + inputStream = new ByteArrayInputStream(byteArray); + FacesContext.getCurrentInstance().responseComplete(); + + return inputStream; + + } + + /** + * Recupera un byte array del reporte pdf + * @param path + * @param parameters + * @param format + * @param filename + * @param logincontroller + * @return + * @throws Exception + */ + public byte[] jaspertoByteArray(String path, HashMap parameters, String format, String filename, LoginController logincontroller) throws Exception{ + this.adddefaultparameters(parameters, logincontroller); + if (format == null) { + format = "pdf"; + } + if ((format.compareTo("xls") == 0) || (format.compareTo("xlsx") == 0)) { + parameters.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE); + } + JasperPrint jasperPrint = this.executereport(logincontroller.getRequest().getCompany()+"/modules/"+ path, parameters); + JasperExportManager.exportReportToPdfFile(jasperPrint, filename+"."+format); + byte[] byteArray=JasperExportManager.exportReportToPdf(jasperPrint); + return byteArray; + + } + + /** + * Recupera un input stream del reporte xls + * @param path + * @param parameters + * @param format + * @param filename + * @param logincontroller + * @return + * @throws Exception + */ + public InputStream jaspertoInputstreamXls(String path, HashMap parameters, String format, String filename, LoginController logincontroller) throws Exception{ + this.adddefaultparameters(parameters, logincontroller); + if (format == null) { + format = "xls"; + } + if ((format.compareTo("xls") == 0) || (format.compareTo("xlsx") == 0)) { + parameters.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE); + } + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition", "attachment; filename=" + filename + ".xls"); + JasperPrint jasperPrint = this.executereport(logincontroller.getRequest().getCompany()+"/modules/"+ path, parameters); + + OutputStream ouputStream = response.getOutputStream(); + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + JRXlsxExporter exporter = new JRXlsxExporter(); + exporter.setParameter(JRXlsExporterParameter.JASPER_PRINT, jasperPrint); + exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, byteArrayOutputStream); + exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE); + exporter.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE); + exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); + exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); + exporter.exportReport(); + ouputStream.write(byteArrayOutputStream.toByteArray()); + byte[] byteArray=byteArrayOutputStream.toByteArray(); + ouputStream.flush(); + ouputStream.close(); + FacesContext.getCurrentInstance().responseComplete(); + + InputStream inputStream; + inputStream = new ByteArrayInputStream(byteArray); + FacesContext.getCurrentInstance().responseComplete(); + return inputStream; + } + + + private void adddefaultparameters(HashMap parameters, LoginController logincontroller) throws Exception { + if (parameters == null) { + parameters = new HashMap(); + } + parameters.put("pathimage", "repo:/maia/" + logincontroller.getRequest().getCompany()+"/image/logo"); + parameters.put("pathstyle", "repo:/maia/" + logincontroller.getRequest().getCompany() + "/style/style"); + + + TgeneAccountingDateBranch accodate = TgeneAccountingDateBranchController.find(logincontroller.getRequest().getCompany()); + parameters.put("workingdate", accodate.getWorkingdate()); + parameters.put("accountingdate", accodate.getAccountingdate()); + //parameters.workingtime = User.getHour(); + parameters.put("companycode", logincontroller.getRequest().getCompany()); + parameters.put("usercode", logincontroller.getRequest().getUser()); + parameters.put("languagecode", logincontroller.getRequest().getLanguage().toUpperCase()); + + } + + /** + * Formato de fechas utilizado en la ejecucion de reportes. + */ + private static SimpleDateFormat FORMATOFECHAREPORTES = new SimpleDateFormat("yyyy-MM-dd"); + + /** + * Entrega un string con la fecha en formato "yyyy-MM-dd" + * @param value Fecha a transformar a un string. + * @return String + */ + public String getFechaReporte(Date value) { + if(value == null){ + return null; + } + return FORMATOFECHAREPORTES.format(value); + } + + public StreamedContent getStreamedContent() { + return streamedContent; + } + + public void setStreamedContent(StreamedContent streamedContent) { + this.streamedContent = streamedContent; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/.svn/text-base/ReportController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/.svn/text-base/ReportController.java.svn-base new file mode 100644 index 0000000..7e79396 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/.svn/text-base/ReportController.java.svn-base @@ -0,0 +1,274 @@ +package com.fp.frontend.controller; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.HashMap; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletResponse; + +import net.sf.jasperreports.engine.JRExporterParameter; +import net.sf.jasperreports.engine.JRParameter; +import net.sf.jasperreports.engine.JasperExportManager; +import net.sf.jasperreports.engine.JasperPrint; +import net.sf.jasperreports.engine.export.JRXlsExporterParameter; +import net.sf.jasperreports.engine.export.ooxml.JRXlsxExporter; + +import org.primefaces.model.StreamedContent; + +import com.fp.common.properties.PropertiesHandler; +import com.fp.frontend.controller.pgeneral.date.TgeneAccountingDateBranchController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.jaspersoft.ireport.jasperserver.JServer; +import com.jaspersoft.ireport.jasperserver.ws.WSClient; +import com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ResourceDescriptor; + +/** + * Clase controladora de reportes. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ReportController { + + private StreamedContent streamedContent; + + public ReportController() { + } + + public void execute(String path, HashMap parameters, String format, String filename, LoginController logincontroller) throws Exception { + this.adddefaultparameters(parameters, logincontroller); + if (format == null) { + format = "pdf"; + } + if ((format.compareTo("xls") == 0) || (format.compareTo("xlsx") == 0)) { + parameters.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE); + } + + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition", "attachment; filename=" + filename + ".pdf"); + JasperPrint jasperPrint = this.executereport(logincontroller.getRequest().getCompany()+"/modules/"+ path, parameters); + OutputStream outputStream = response.getOutputStream(); + + JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream); + FacesContext.getCurrentInstance().responseComplete(); + + } + /** + * Método que exporta el reporte a formato .xlsx + * @param path, ruta de acceso al reporte en el servidor jaspersoft + * @param parameters, parámetros que se envían desde el controlador + * @param format, formato de archivo, en este caso xlsx + * @param filename, nombre que tendrá el archivo + * @param logincontroller + * @throws Exception + */ + @SuppressWarnings("deprecation") + public void executeXls(String path, HashMap parameters, String format, String filename, LoginController logincontroller) throws Exception { + this.adddefaultparameters(parameters, logincontroller); + if (format == null) { + format = "pdf"; + } + if ((format.compareTo("xls") == 0) || (format.compareTo("xlsx") == 0)) { + parameters.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE); + } + + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition", "attachment; filename=" + filename + ".xlsx"); + System.out.println(logincontroller.getRequest().getCompany()+"/modules/"+ path); + JasperPrint jasperPrint = this.executereport(logincontroller.getRequest().getCompany()+"/modules/"+ path, parameters); + OutputStream ouputStream = response.getOutputStream(); + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + JRXlsxExporter exporter = new JRXlsxExporter(); + exporter.setParameter(JRXlsExporterParameter.JASPER_PRINT, jasperPrint); + exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, byteArrayOutputStream); + exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE); + exporter.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE); + exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); + exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); + exporter.exportReport(); + ouputStream.write(byteArrayOutputStream.toByteArray()); + ouputStream.flush(); + ouputStream.close(); + FacesContext.getCurrentInstance().responseComplete(); + + } + + + + + private JasperPrint executereport(String pathJasper, HashMap parameters) throws Exception { + PropertiesHandler ph = new PropertiesHandler("jasper"); + + JServer server = new JServer(); + //server.setUsername("jasperadmin"); + server.setUsername(ph.getStringValue("jasperserver.user")); + //server.setPassword("jasperadmin"); + server.setPassword(ph.getStringValue("jasperserver.password")); + //server.setUrl("http://localhost:8080/jasperserver/services/repository"); + server.setUrl(ph.getStringValue("jasperserver.repository")); + ResourceDescriptor rd = new ResourceDescriptor(); + rd.setWsType(ResourceDescriptor.TYPE_REPORTUNIT); + rd.setUriString("/maia/" + pathJasper); + WSClient wsClient = server.getWSClient(); + return wsClient.runReport(rd, parameters); + } + + /** + * Recupera un input stream del reporte pdf + * @param path + * @param parameters + * @param format + * @param filename + * @param logincontroller + * @return + * @throws Exception + */ + public InputStream jaspertoInputstream(String path, HashMap parameters, String format, String filename, LoginController logincontroller) throws Exception{ + this.adddefaultparameters(parameters, logincontroller); + if (format == null) { + format = "pdf"; + } + if ((format.compareTo("xls") == 0) || (format.compareTo("xlsx") == 0)) { + parameters.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE); + } + + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition", "attachment; filename=" + filename + ".pdf"); + JasperPrint jasperPrint = this.executereport(logincontroller.getRequest().getCompany()+"/modules/"+ path, parameters); + + OutputStream outputStream = response.getOutputStream(); + JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream); + InputStream inputStream; + + + byte[] byteArray=JasperExportManager.exportReportToPdf(jasperPrint); + inputStream = new ByteArrayInputStream(byteArray); + FacesContext.getCurrentInstance().responseComplete(); + + return inputStream; + + } + + /** + * Recupera un byte array del reporte pdf + * @param path + * @param parameters + * @param format + * @param filename + * @param logincontroller + * @return + * @throws Exception + */ + public byte[] jaspertoByteArray(String path, HashMap parameters, String format, String filename, LoginController logincontroller) throws Exception{ + this.adddefaultparameters(parameters, logincontroller); + if (format == null) { + format = "pdf"; + } + if ((format.compareTo("xls") == 0) || (format.compareTo("xlsx") == 0)) { + parameters.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE); + } + JasperPrint jasperPrint = this.executereport(logincontroller.getRequest().getCompany()+"/modules/"+ path, parameters); + JasperExportManager.exportReportToPdfFile(jasperPrint, filename+"."+format); + byte[] byteArray=JasperExportManager.exportReportToPdf(jasperPrint); + return byteArray; + + } + + /** + * Recupera un input stream del reporte xls + * @param path + * @param parameters + * @param format + * @param filename + * @param logincontroller + * @return + * @throws Exception + */ + public InputStream jaspertoInputstreamXls(String path, HashMap parameters, String format, String filename, LoginController logincontroller) throws Exception{ + this.adddefaultparameters(parameters, logincontroller); + if (format == null) { + format = "xls"; + } + if ((format.compareTo("xls") == 0) || (format.compareTo("xlsx") == 0)) { + parameters.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE); + } + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition", "attachment; filename=" + filename + ".xls"); + JasperPrint jasperPrint = this.executereport(logincontroller.getRequest().getCompany()+"/modules/"+ path, parameters); + + OutputStream ouputStream = response.getOutputStream(); + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + JRXlsxExporter exporter = new JRXlsxExporter(); + exporter.setParameter(JRXlsExporterParameter.JASPER_PRINT, jasperPrint); + exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, byteArrayOutputStream); + exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE); + exporter.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE); + exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); + exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); + exporter.exportReport(); + ouputStream.write(byteArrayOutputStream.toByteArray()); + byte[] byteArray=byteArrayOutputStream.toByteArray(); + ouputStream.flush(); + ouputStream.close(); + FacesContext.getCurrentInstance().responseComplete(); + + InputStream inputStream; + inputStream = new ByteArrayInputStream(byteArray); + FacesContext.getCurrentInstance().responseComplete(); + return inputStream; + } + + + private void adddefaultparameters(HashMap parameters, LoginController logincontroller) throws Exception { + if (parameters == null) { + parameters = new HashMap(); + } + parameters.put("pathimage", "repo:/maia/" + logincontroller.getRequest().getCompany()+"/image/logo"); + parameters.put("pathstyle", "repo:/maia/" + logincontroller.getRequest().getCompany() + "/style/style"); + + + TgeneAccountingDateBranch accodate = TgeneAccountingDateBranchController.find(logincontroller.getRequest().getCompany()); + parameters.put("workingdate", accodate.getWorkingdate()); + parameters.put("accountingdate", accodate.getAccountingdate()); + //parameters.workingtime = User.getHour(); + parameters.put("companycode", logincontroller.getRequest().getCompany()); + parameters.put("usercode", logincontroller.getRequest().getUser()); + parameters.put("languagecode", logincontroller.getRequest().getLanguage().toUpperCase()); + + } + + /** + * Formato de fechas utilizado en la ejecucion de reportes. + */ + private static SimpleDateFormat FORMATOFECHAREPORTES = new SimpleDateFormat("yyyy-MM-dd"); + + /** + * Entrega un string con la fecha en formato "yyyy-MM-dd" + * @param value Fecha a transformar a un string. + * @return String + */ + public String getFechaReporte(Date value) { + if(value == null){ + return null; + } + return FORMATOFECHAREPORTES.format(value); + } + + public StreamedContent getStreamedContent() { + return streamedContent; + } + + public void setStreamedContent(StreamedContent streamedContent) { + this.streamedContent = streamedContent; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/AbstractController.java b/frontend/src/main/java/com/fp/frontend/controller/AbstractController.java new file mode 100644 index 0000000..674479b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/AbstractController.java @@ -0,0 +1,1347 @@ +package com.fp.frontend.controller; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.faces.bean.ManagedProperty; +import javax.faces.context.ExternalContext; +import javax.faces.context.FacesContext; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; + +import org.primefaces.context.RequestContext; + +import com.fp.common.helper.BeanManager; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.firmas.rules.common.CertificateUtils; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgGeneral; + +/** + * Clase principal para los controladores + * + * @author jvaca + * @author amerchan Cambio atributos, metodos genericos + * + * @param + */ +public abstract class AbstractController + implements Serializable { + + private static final long serialVersionUID = 1154897874514657854L; + + /** + * Registro a ser usado cuando se crea uno nuevo o para edicion + */ + protected T record; + + /** + * Lista de registros a presentar en una tabla de mantenimiento + */ + protected List lrecord; + + /** + * Identificador para obtener la lista de registros del mapa de resultados + * del core + */ + protected String beanalias; + + /** + * Tipo de dato de la entidad que maneja el controlador + */ + protected Class classType; + + // Valores posibles Q(query), P(previous), N(next) + private String queryType; + + /** + * Numero de pagina o registro desde el cual se va a ejecutar la consulta. + */ + protected Integer page = 0; + + /** + * Numero de registros por pagina a consultar. + */ + protected Integer recperpage = 10; + + /** + * Crease utilitaria, para ejecutar una accion en el core, ejecmpo consulta, + * mantenimiento. + */ + protected CallerHelper callerhelper; + + /** + * Lista de registros eliminados associates a una tabla o entitybean. + */ + private final List ldeleted = new ArrayList<>(); + + /** + * Lista de registros nuevos asociados a una tabla o entitybean. + */ + private final List lnew = new ArrayList<>(); + + /** + * Lista de registros modificados asociados a una tabla o entitybean. + */ + private final List lupdated = new ArrayList<>(); + + /** + * Map que contiene los criterios de busqueda de una tabla. + */ + private Map mfilters = new HashMap(); + + /** + * Map que contiene campos extras como descripciones. + */ + private Map mfilelds = new HashMap(); + + /** + * Numero de decimales a manejar en las pantallas. + */ + private Integer decimal = 2; + + /** + * Formato de numeros a utilizar en los outputtext. + */ + private String numberformat = "#,##,##0.000000"; + + /** + * Variable que indica si se ejecuta el autoquery, Ej: en el lov de personas + * deberia ser falso. + */ + protected boolean forceautoquery = true; + + /** + * Variable que indica si la pagina es del BPM y ademas si tiene parametros + * para pegar en la pagina + */ + boolean bpmPage = false; + + /** + * Para indicar que el registro se va a visualizar. + */ + private boolean showRow; + + /** + * Para indicar que se va a insertar un nuevo registro. + */ + private boolean newRow; + + /** + * Id de la tarea de jbpm a ejecutar. + */ + protected String tid; + + /** + * Codigo de estatus de bpm A aprobano, D negado + */ + protected String bpmDataStatus; + + /** + * Cometario de ejecucion de una tarea. + */ + protected String bpmDataComment; + /** + * Atributo para la contrasena de la firma + */ + private String signaturePass; + /** + * Atributo para el comentario de la firma + */ + private String signatureComments; + /* + * Atributo para el mensaje de la solicitud + */ + private String message; + /** + * Referencia al controlador de session + */ + @ManagedProperty(value = "#{loginController}") + private LoginController loginController; + + /** + * Constructor del controlador + * + * @param type Tipo de clase + * @throws Exception + */ + protected AbstractController(Class type) throws Exception { + this.classType = type; + if (this.callerhelper == null) { + this.callerhelper = new CallerHelper( + FacesContext.getCurrentInstance()); + } + } + + /** + * Metodo que verifica si la pagina es de autoconsulta y si debe pegar + * valores del BPM + */ + public void startQuery() { + try { + this.bpmPage = this.pasteBpmScreenParameters(); + if (!this.bpmPage && this.forceautoquery + && this.callerhelper.isautoquery()) { + this.query(); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que verifica si la pagina es de BPM, pega los valores en los + * filtros y realiza la consulta de la p´gina + * + * @return + * @throws Exception + */ + public boolean pasteBpmScreenParameters() throws Exception { + this.getLoginController().setRenderBpmData(false); + String bpmParamsJson = this.getRequestParameter("bpmParams"); + if (bpmParamsJson == null) { + return false; + } + bpmParamsJson = bpmParamsJson.substring(1, bpmParamsJson.length() - 1); + if (!bpmParamsJson.isEmpty()) { + String[] bpmParams = bpmParamsJson.split(","); + for (String item : bpmParams) { + String[] param = item.split("="); + this.manageBpmParameter(param); + } + return true; + } + return false; + } + + private void manageBpmParameter(String[] param) throws Exception { + String key = param[0].trim(); + String value = param[1]; + if (key.equals("null")) { + return; + } + if (key.equals("TID")) { + tid = param[1]; + return; + } + if (key.equals("KIND")) { + if (value.compareTo("OK_NO") == 0) { + this.getLoginController().setRenderBpmData(true); + } else if (value.compareTo("OK") == 0) { + this.bpmDataStatus = "A"; + } + return; + } + + this.mfilters.put(param[0].trim(), param[1]); + } + + /** + * Funcion que verifica que exista al menos un filtro de busqueda + * + * @return boolean + */ + public boolean existAtLeastOneFilterValue() { + Set keys = this.mfilters.keySet(); + for (String key : keys) { + String val = this.mfilters.get(key); + if (!key.equals("pk.dateto")) { + if ((val != null) && !val.isEmpty()) { + return true; + } + } + } + return false; + } + + /** + * Metodo que agrega la fecha hasta (dateto) al mapa de filtros + * + * @throws Exception + */ + public void addFilterDateto() throws Exception { + this.mfilters.put("pk.dateto", "2999-12-31"); + } + + /** + * Crea una instancia de una entidad T y marca el registro como nuevo. + * + * @throws Exception + */ + @SuppressWarnings("unchecked") + public void create() throws Exception { + this.record = (T) Class.forName(this.classType.getName()).newInstance(); + BeanManager.setBeanAttributeValue(this.record, "isnew", true); + try { + BeanManager.setBeanAttributeValue(this.record, "pk", + Class.forName(this.classType.getName() + "Key") + .newInstance()); + } catch (Exception e) { + } + } + + /** + * Metodo a ser sobreescrito en los controladores. En este método a + * sobrescribir se debe colocar la lógica para invocar al core y + * guardar los registros. + */ + public void save() { + } + + ; + + /** + * Adiciona datos de un registro a ser eliminado de la base de datos. + * + * @param bean + * Objeto a eliminar. + * @throws Exception + */ + @SuppressWarnings("unchecked") + public void remove() throws Exception { + if (this.record == null) { + return; + } + this.removefromlista(this.lrecord, this.record); + if (!this.record.isnew) { + this.ldeleted.add(this.record); + } + this.removefromlista((List) this.lnew, this.record); + this.removefromlista((List) this.lupdated, this.record); + } + + /** + * Elimina un registro de la lista comparando el rowkey del registro. + * + * @param ldata Lista de registros a buscar y remover un objeto. + * @param abstractbean Bean a remover de la lista. + * @throws Exception + */ + private void removefromlista(List ldata, T abstractbean) + throws Exception { + int size = ldata.size(); + for (int i = 0; i < size; i++) { + if (ldata.get(i).rowkey() == abstractbean.rowkey()) { + ldata.remove(i); + break; + } + } + } + + /** + * Adiciona un registro a la lista de registros que se va a insertar en la + * base de datos. + * + * @param bean Abjeto a insertar. + * @throws Exception + */ + protected void addNew(AbstractDataTransport bean) throws Exception { + if (!this.lnew.contains(bean)) { + this.lnew.add(bean); + } + } + + /** + * Adiciona un registro a la lista de registros que se va a actualizar en la + * base de datos. + * + * @param bean + * @throws Exception + */ + protected void addUpdated(AbstractDataTransport bean) throws Exception { + if (!this.lupdated.contains(bean)) { + this.lupdated.add(bean); + } + } + + /** + * Actualiza datos de registros nuevos o modifiados, si el registro es nuevo + * se adiciona a lista de nuevos, si es actualizado se adiciona a la lista + * de actualizados. + * + * @throws Exception + */ + @SuppressWarnings("unchecked") + public void update() throws Exception { + AbstractDataTransport bean = this.record; + if (bean == null) { + return; + } + if (bean.isnew) { + if (!this.exist(bean, (List) this.lrecord)) { + this.addNew(bean); + this.lrecord.add((T) bean); + } + } else { + this.addUpdated(bean); + } + } + + /** + * + * @param bean + * @param ldata + * @return + * @throws Exception + */ + private boolean exist(AbstractDataTransport bean, + List ldata) throws Exception { + for (AbstractDataTransport obj : ldata) { + if (obj.rowkey() == bean.rowkey()) { + return true; + } + } + return false; + } + + /** + * Metodo que tiene que sobreescribir las clases que trabajen con el core. + * En este metodo se debe implementar la consulta de las las tablas que se + * requieran + */ + protected abstract void querydatabase(); + + /** + * Ejecuta consulta de datos en la base para la tabla. + * + * @throws Exception + */ + public void query() throws Exception { + this.queryType = "Q"; + if (this.validateQuery()) { + this.page = 0; + this.querydatabase(); + } + } + + private boolean validateQuery() { + if (this.lupdated.isEmpty() && this.lnew.isEmpty() + && this.ldeleted.isEmpty()) { + return true; + } else { + RequestContext.getCurrentInstance().execute( + "PF('queryConfirmDialog').show()"); + } + return false; + } + + public void forcedQuery() throws Exception { + this.lupdated.clear(); + this.lnew.clear(); + this.ldeleted.clear(); + this.lrecord.clear(); + if (this.queryType == null) { + this.queryType = "default"; // valor dummy para que no de null + // pointer exception en el switch + } + switch (this.queryType) { + case "P": + this.previous(); + break; + case "N": + this.next(); + break; + default: + this.query(); + break; + } + } + + /** + * Ejecuta consulta de la sigueinte pagina. + * + * @throws Exception + */ + public void next() throws Exception { + this.queryType = "N"; + if (this.validateQuery()) { + this.page = ((this.page > 0) && (this.lrecord.size() == 0)) ? this.page + : this.page + this.recperpage; + this.querydatabase(); + } + } + + /** + * Ejecuta consulta de la pagina anterior. + * + * @throws Exception + */ + public void previous() throws Exception { + this.queryType = "P"; + if (this.validateQuery()) { + this.page = this.page - this.recperpage; + this.page = this.page < 0 ? 0 : this.page; + this.querydatabase(); + } + } + + /** + * Entrega el dto de save, con los registros a insertar, eliminar, modificar + * para una tabla. + * + * @param beanname Nombre del bean. + * @return + * @throws Exception + */ + public DtoSave getDtoSave() throws Exception { + DtoSave dto = new DtoSave(); + dto.setBeanname(this.classType.getName()); + for (AbstractDataTransport bean : this.lnew) { + // para que siempre fije el valor del rowkey. + bean.rowkey(); + bean.getModifiedData().put("isnew", "1"); + } + dto.addNew(this.lnew); + dto.addDeleted(this.ldeleted); + // Quita el bean original de los modificados y marca el bean para + // actualizacion. + for (AbstractDataTransport mod : this.lupdated) { + if (mod.get("ORIGINALBEAN") == null) { + continue; + } + mod.isupdated = false; + AbstractDataTransport boriginal = (AbstractDataTransport) mod + .get("ORIGINALBEAN"); + HashMap modificados = BeanManager.getModified( + boriginal, mod); + if (!modificados.isEmpty()) { + mod.isupdated = true; + // solo si existe cambios se adiciona a la lista de modificado. + dto.getLupdated().add(modificados); + } + } + // adiciona campos sueltos. + return dto; + } + + /** + * Entrega el dto de save, con los registros a insertar, eliminar, modificar + * para una tabla. + * + * @param isForm V si es formulario. + * @return dto + * @throws Exception + */ + public DtoSave getDtoSave(boolean isForm) throws Exception { + DtoSave dto = this.getDtoSave(); + dto.setIsForm(isForm); + return dto; + } + + /** + * Metodo que retorna un objeto de tipo DtoQuery que sirve para realizar + * consultas + * + * @param isMultirecord + * @return + * @throws Exception + */ + public DtoQuery getDtoQuery(boolean isMultirecord) throws Exception { + DtoQuery dto = new DtoQuery(this.classType.getName(), this.page, + this.recperpage, isMultirecord, this.getMfilters()); + return dto; + } + + /** + * Metodo usado despues de grabar exitosamente los datos en la base + * + * @param response + * @throws Exception + */ + public void postCommit(Response response) throws Exception { + this.postCommitGeneric(response, this.beanalias); + } + + /** + * Si el commit se relaliza con exito, suma 1 al campo optlock para poder + * hacer un nuevo mantenimiento del registro. Completa las claves primarias + * de los registros nuevos + * + * @throws Exception + */ + @SuppressWarnings("unchecked") + protected void postCommitGeneric(Response response, String alias) + throws Exception { + for (AbstractDataTransport bean : this.lupdated) { + this.postcommitbean(bean); + } + // marca el registro como no nuevo va antes de actualizar pk. + for (AbstractDataTransport bean : this.lnew) { + bean.isnew = false; + this.postcommitbean(bean); + } + // Actualiza pk de los registros nuevos. + if (response.get(alias) != null) { + List> lresp = (List>) response + .get(alias); + for (Map m : lresp) { + this.updatePkOnRecords(m); + } + } + // Encera registros nuevos. + this.lnew.clear(); + this.ldeleted.clear(); + this.lupdated.clear(); + } + + /** + * Metodo que maneja la version de registros de una entidad + * + * @param bean + * @throws Exception + */ + private void postcommitbean(AbstractDataTransport bean) throws Exception { + Integer optlock = BeanManager.getRecordversion(bean); + if (optlock != null) { + if (bean.isupdated) { + BeanManager.setBeanAttributeValue(bean, "recordversion", + optlock + 1); + } else { + BeanManager.setBeanAttributeValue(bean, "recordversion", + optlock); + } + } + this.postQuery(bean); + } + + /** + * Metodo que actualiza los pk's de los registros nuevos + * + * @param m + * @throws Exception + */ + private void updatePkOnRecords(Map m) throws Exception { + String id = m.get("rowkey").toString(); + AbstractDataTransport bean = this.getNewBeanById(Integer.valueOf(id)); + if (bean == null) { + return; + } + Set s = m.keySet(); + for (String key : s) { + if (key.equals("rowkey")) { + continue; + } + BeanManager.setBeanAttributeValue(bean, key.replace("pk_", "pk."), + m.get(key)); + } + } + + /** + * Metodo que obtiene una entidad de la lista de registros nuevos por id + * + * @param id + * @return + * @throws Exception + */ + private AbstractDataTransport getNewBeanById(Integer id) throws Exception { + AbstractDataTransport bean = null; + for (AbstractDataTransport obj : this.lnew) { + if (obj.rowkey() == id) { + bean = obj; + } + } + return bean; + } + + /** + * Metodo que clona una lista de entidades + * + * @param lbeans + * @throws Exception + */ + @SuppressWarnings("rawtypes") + public void postQuery(List lbeans) throws Exception { + for (Object bean : lbeans) { + if (bean instanceof AbstractDataTransport) { + this.postQuery((AbstractDataTransport) bean); + } + } + } + + /** + * Metodo que clona una entidad y lo coloca en un mapa dentro de la misma + * para poder dar mantenimiento + * + * @param bean + * @throws Exception + */ + public void postQuery(AbstractDataTransport bean) throws Exception { + if (bean == null) { + return; + } + bean.isupdated = false; // Se cambia a true cuando arma el mensaje que + // se envia al core. + AbstractDataTransport boriginal = (AbstractDataTransport) bean + .cloneMe(); + bean.put("ORIGINALBEAN", boriginal); + } + + /** + * Metodo que limplia las listas de objetos + */ + public void clearAll() { + this.mfilelds.clear(); + this.mfilters.clear(); + this.lupdated.clear(); + this.lnew.clear(); + this.ldeleted.clear(); + if (lrecord != null) { + this.lrecord.clear(); + } + } + + /** + * Metodo que obtiene el valor de un parametro enviado desde la p´gina + * + * @param key + * @return + * @throws Exception + */ + public String getRequestParameter(String key) throws Exception { + return FacesContext.getCurrentInstance().getExternalContext() + .getRequestParameterMap().get(key); + } + + /** + * Metodo que retorna un mapa de parametros enviados desde una pagina + * + * @return + * @throws Exception + */ + public Map getRequestParameterMap() throws Exception { + return FacesContext.getCurrentInstance().getExternalContext() + .getRequestParameterMap(); + } + + /** + * Metodo usado para descargar archivos + * + * @param fileByte + * @param contentType + * @param extension + */ + public void downloadFile(byte[] fileByte, String contentType, + String extension) { + try { + int read = 0; + byte[] bytes = new byte[1024]; + + InputStream input = new ByteArrayInputStream(fileByte); + FacesContext context = FacesContext.getCurrentInstance(); + ExternalContext external = context.getExternalContext(); + HttpServletResponse response = (HttpServletResponse) external + .getResponse(); + response.setContentType(contentType); + response.setHeader("Content-Disposition", + "attachment; filename=fileDownload." + extension); + ServletOutputStream out = response.getOutputStream(); + + while ((read = input.read(bytes)) != -1) { + out.write(bytes, 0, read); + } + out.flush(); + out.close(); + context.responseComplete(); + } catch (Exception ex) { + + } + } + + /** + * Entrega el valor de: recperpage + * + * @return Integer + */ + public Integer getRecperpage() { + return this.recperpage; + } + + /** + * Fija el valor de: recperpage + * + * @param Valor a fijar en el atributo. + */ + public void setRecperpage(Integer recperpage) { + this.recperpage = recperpage; + } + + /** + * Entrega el valor de: callerhelper + * + * @return CallerHelper + */ + public CallerHelper getCallerhelper() { + return this.callerhelper; + } + + /** + * Fija el valor de: callerhelper + * + * @param Valor a fijar en el atributo. + */ + public void setCallerhelper(CallerHelper callerhelper) { + this.callerhelper = callerhelper; + } + + /** + * Entrega el valor de: mfilters + * + * @return Map + */ + public Map getMfilters() { + return this.mfilters; + } + + /** + * Fija el valor de: mfilters + * + * @param Valor a fijar en el atributo. + */ + public void setMfilters(Map mfilters) { + this.mfilters = mfilters; + } + + public void addFilter(String field, String value) { + this.mfilters.put(field, value); + } + + /** + * Entrega el valor de: mfilelds + * + * @return Map + */ + public Map getMfilelds() { + return this.mfilelds; + } + + /** + * Fija el valor de: mfilelds + * + * @param Valor a fijar en el atributo. + */ + public void setMfilelds(Map mfilelds) { + this.mfilelds = mfilelds; + } + + /** + * Entrega el valor de: decimal + * + * @return Integer + */ + public Integer getDecimal() { + return this.decimal; + } + + /** + * Fija el valor de: decimal + * + * @param Valor a fijar en el atributo. + */ + public void setDecimal(Integer decimal) { + this.decimal = decimal; + } + + /** + * Entrega el valor de: numberformat + * + * @return String + */ + public String getNumberformat() { + return this.numberformat; + } + + /** + * Fija el valor de: numberformat + * + * @param Valor a fijar en el atributo. + */ + public void setNumberformat(String numberformat) { + this.numberformat = numberformat; + } + + /** + * Entrega el valor de: forceautoquery + * + * @return boolean + */ + public boolean isForceautoquery() { + return this.forceautoquery; + } + + /** + * Fija el valor de: forceautoquery + * + * @param Valor a fijar en el atributo. + */ + public void setForceautoquery(boolean forceautoquery) { + this.forceautoquery = forceautoquery; + } + + /** + * Entrega el valor de: bpmPage + * + * @return boolean + */ + public boolean isBpmPage() { + return this.bpmPage; + } + + /** + * Fija el valor de: bpmPage + * + * @param bpmPage Valor a fijar en el atributo + */ + public void setBpmPage(boolean bpmPage) { + this.bpmPage = bpmPage; + } + + /** + * Entrega el valor de: record + * + * @return T + */ + public T getRecord() { + return this.record; + } + + /** + * Fija el valor de: record + * + * @param Valor a fijar en el atributo + */ + public void setRecord(T record) { + this.record = record; + } + + /** + * Entrega el valor de: lrecord + * + * @return List + */ + public List getLrecord() { + return this.lrecord; + } + + /** + * Fija el valor de: lrecord + * + * @param Valor a fijar en el atributo + */ + public void setLrecord(List lrecord) { + this.lrecord = lrecord; + } + + /** + * Entrega el valor de: beanalias + * + * @return String + */ + public String getBeanalias() { + return this.beanalias; + } + + /** + * Entrega el valor de: beanalias + * + * @return String + */ + public void setBeanalias(String beanalias) { + this.beanalias = beanalias; + } + + /** + * Entrega el valor de: showRow + * + * @return boolean + */ + public boolean isShowRow() { + return this.showRow; + } + + /** + * Fija el valor de: showRow + * + * @param Valor a fijar en el atributo. + */ + public void setShowRow(boolean showRow) { + this.showRow = showRow; + } + + public boolean isNewRow() { + return this.newRow; + } + + public void setNewRow(boolean newRow) { + this.newRow = newRow; + } + + public void addField(String field, Object value) { + this.mfilelds.put(field, value); + } + + public Object getFieldvalue(String field) { + return this.mfilelds.get(field); + } + + /** + * Entrega el valor de: loginController + * + * @return LoginController + */ + public LoginController getLoginController() { + return this.loginController; + } + + /** + * Fija el valor de: loginController + * + * @param Valor a fijar en el atributo. + */ + public void setLoginController(LoginController loginController) { + this.loginController = loginController; + } + + /** + * Entrega el valor de: bpmDataStatus + * + * @return String + */ + public String getBpmDataStatus() { + return bpmDataStatus; + } + + /** + * Fija el valor de: bpmDataStatus + * + * @param bpmDataStatus Valor a fijar en el atributo. + */ + public void setBpmDataStatus(String bpmDataStatus) { + this.bpmDataStatus = bpmDataStatus; + } + + /** + * Entrega el valor de: bpmDataComment + * + * @return String + */ + public String getBpmDataComment() { + return bpmDataComment; + } + + /** + * Fija el valor de: bpmDataComment + * + * @param bpmDataComment Valor a fijar en el atributo. + */ + public void setBpmDataComment(String bpmDataComment) { + this.bpmDataComment = bpmDataComment; + } + + /** + * Metodo que se encarga de encerar datos de consultas, mantenimeintos y + * datos adicionales de un request, se utliza para iniciar flujos de un bpm. + * + * @param request Objeto a limpiar informacion. + * @throws Exception + */ + public void cleanRequest(Request request) throws Exception { + request.modifiedData().clear(); + if (request.getSaveTables() != null) { + request.getSaveTables().clear(); + } + if (request.getQueryTables() != null) { + request.getQueryTables().clear(); + } + + } + + /** + * Entrega el password del firmante + * + * @return signaturePass + */ + public String getSignaturePass() { + return signaturePass; + } + + /** + * Fija el password del firmante + * + * @param signaturePass + */ + public void setSignaturePass(String signaturePass) { + this.signaturePass = signaturePass; + } + + /** + * Entrega el motivo del firmado + * + * @return + */ + public String getSignatureComments() { + return signatureComments; + } + + /** + * Fija el motivo del firmado + * + * @param signatureComments + */ + public void setSignatureComments(String signatureComments) { + this.signatureComments = signatureComments; + } + + /** + * Entrega el valor del mensaje + * + * @return message + */ + public String getMessage() { + return message; + } + + /** + * Fija el valor del mensaje + * + * @param message + */ + public void setMessage(String message) { + this.message = message; + } + + /** + * Metodo que comprueba las firmas de un documento + * + * @param codSol + * @param codEmp + * @param nomTipo + */ + public boolean checkSignature(String codSol, String codEmp, String nomTipo) { + int count = 0; + InputStream originalDocTemplate = AlfrescoController.getDocumentByCode(codSol, nomTipo, this.getLoginController().getRequest().getCompany().toString()); + if (originalDocTemplate == null) { + return false; + } + List signs = CertificateUtils.obtainNameSigns(originalDocTemplate); + if (signs != null && signs.size() > 0) { + for (String sign : signs) { + if (sign.equalsIgnoreCase(codEmp)) { + ++count; + } + } + if (count == 0) { + return true; + } + } + return false; + } + + /** + * Metodo para el firmado electronico de documentos + * + * @param codSol - Codigo de la solicitud + * @param codEmp - Codigo del empleado + * @param nomTipo - Tipo de documento (solicitud, informe) + */ + /*public void signatureDocument(String codSol, String codEmp, String nomTipo, + int company, String usuario) { + + String pathStoreCertificates= ParametersController.find(EnumParametros.PATH_CERTIFICADO_BCE.getCodigo(),(company+"")).getTextvalue(); + String nomCert = CertificadosController.find(usuario).getPk().getIdcertificado(); + + + String path =pathStoreCertificates+"/"+nomCert; + + InputStream originalDocTemplate = AlfrescoController.getDocumentByCode(codSol, nomTipo, this.getLoginController().getRequest().getCompany().toString()); + + List signs = CertificateUtils + .obtainNameSigns(originalDocTemplate); + float llx = 50; + float lly = 210; + float urx = 305; + float ury = 277; + Rectangle rectangle = new Rectangle(llx, lly, urx, ury); + + if (signs.size() > 0) { + for (String sign : signs) { + if (sign.equalsIgnoreCase(codEmp)) { + MessageHelper.setMessageWarn("msg_firmaExistente"); + return; + } + } + + } + + InputStream originalDoc = AlfrescoController.getDocumentByCode(codSol, nomTipo, this.getLoginController().getRequest().getCompany().toString()); + + byte[] signedDoc = null; + try { + signedDoc = CertificateUtils.sign(originalDoc, usuario, + this.signaturePass, company, this.signatureComments, + this.signatureComments, rectangle, 1, codEmp, + path); + + if (signedDoc != null) { + InputStream uploadDoc = new ByteArrayInputStream(signedDoc); + + AlfrescoController.uploadSignedDocument(uploadDoc, codSol, + nomTipo); + + } + originalDocTemplate.close(); + originalDoc.close(); + } catch (Exception e1) { + + e1.printStackTrace(); + } + + }*/ + /** + * Metodo para el firmado electronico de documentos; Aprobaciones + * + * @param codSol - Codigo de la solicitud + * @param codEmp - Codigo del empleado + * @param nomTipo - Tipo de documento (solicitud, informe) + */ + /*public void signatureDocumentAPR(String codSol, String codEmp, String nomTipo, + int company, String usuario) { + + InputStream originalDocTemplate = AlfrescoController.getDocumentByCode(codSol, nomTipo, this.getLoginController().getRequest().getCompany().toString()); + TfirmCertificado certificado = CertificadosController.find(usuario); + if(certificado == null){ + MessageHelper.setMessageError("msg_certificateNotParam"); + return; + } + String nomCert = certificado.getPk().getIdcertificado(); + String pathStoreCertificates= ParametersController.find(EnumParametros.PATH_CERTIFICADO_BCE.getCodigo(),(company+"")).getTextvalue(); + + String path =pathStoreCertificates+"/"+nomCert; + + List signs = CertificateUtils + .obtainNameSigns(originalDocTemplate); + float llx = 50; + float lly = 210; + float urx = 305; + float ury = 277; + Rectangle rectangle = new Rectangle(llx, lly, urx, ury); + + if (signs.size() > 0) { + for (String sign : signs) { + if (sign.equalsIgnoreCase(codEmp)) { + MessageHelper.setMessageWarn("msg_firmaExistente"); + return; + } + } + + InputStream originalDoc = AlfrescoController.getDocumentByCode(codSol, nomTipo, this.getLoginController().getRequest().getCompany().toString()); + + byte[] signedDoc = null; + try { + signedDoc = CertificateUtils.sign(originalDoc, usuario, + this.signaturePass, company, this.signatureComments, + this.signatureComments, rectangle, 1, codEmp, + path); + + if (signedDoc != null) { + InputStream uploadDoc = new ByteArrayInputStream(signedDoc); + + AlfrescoController.uploadSignedDocument(uploadDoc, codSol, + nomTipo); + + } + originalDocTemplate.close(); + originalDoc.close(); + } catch (Exception e1) { + + e1.printStackTrace(); + } + + } + else + { + MessageHelper.setMessageWarn("msg_sinFirma"); + return; + } + + }*/ + /** + * Metodo que comprueba las firmas de un documento + * + * @param codSol + * @param codEmp + * @param nomTipo + */ + public void signature(String codSol, String nomTipo, String tipo) { + int count = 0; + InputStream originalDocTemplate = AlfrescoController.getDocumentByCode(codSol, nomTipo, this.getLoginController().getRequest().getCompany().toString()); + if (originalDocTemplate == null) { + this.message = MsgGeneral.getProperty("msg_solicitudeNotSign"); + return; + } + List signs = CertificateUtils.obtainNameSigns(originalDocTemplate); + if (signs != null && !signs.isEmpty()) { + this.message = tipo.equals("S") ? MsgGeneral.getProperty("msg_solicitudeSign") : MsgGeneral.getProperty("msg_informSign"); + } + this.message = tipo.equals("S") ? MsgGeneral.getProperty("msg_solicitudeNotSign") : MsgGeneral.getProperty("msg_informNotSign"); + } + + /** + * Método para el inicio de flujo + */ + public void iniciarFlujo() { + try { + + Request request = callerhelper.getRequest(); + this.cleanRequest(request); + + request.modifiedData().put("csolicitud", "123456"); + request.modifiedData().put("isnew", "Y"); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para el inicio de flujo + */ + public void completarTarea() { + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + this.cleanRequest(request); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment); + //request.modifiedData().put("validate", "Y"); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/ReportController.java b/frontend/src/main/java/com/fp/frontend/controller/ReportController.java new file mode 100644 index 0000000..042200d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/ReportController.java @@ -0,0 +1,278 @@ +package com.fp.frontend.controller; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.HashMap; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletResponse; + +import net.sf.jasperreports.engine.JRExporterParameter; +import net.sf.jasperreports.engine.JRParameter; +import net.sf.jasperreports.engine.JasperExportManager; +import net.sf.jasperreports.engine.JasperPrint; +import net.sf.jasperreports.engine.export.JRXlsExporterParameter; +import net.sf.jasperreports.engine.export.ooxml.JRXlsxExporter; + +import org.primefaces.model.StreamedContent; + +import com.fp.common.properties.PropertiesHandler; +import com.fp.frontend.controller.pgeneral.date.TgeneAccountingDateBranchController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; +import com.jaspersoft.ireport.jasperserver.JServer; +import com.jaspersoft.ireport.jasperserver.ws.WSClient; +import com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ResourceDescriptor; +import java.io.File; + +/** + * Clase controladora de reportes. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ReportController { + + private StreamedContent streamedContent; + + public ReportController() { + } + + public void execute(String path, HashMap parameters, String format, String filename, LoginController logincontroller) throws Exception { + this.adddefaultparameters(parameters, logincontroller); + if (format == null) { + format = "pdf"; + } + if ((format.compareTo("xls") == 0) || (format.compareTo("xlsx") == 0)) { + parameters.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE); + } + + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition", "attachment; filename=" + filename + ".pdf"); + JasperPrint jasperPrint = this.executereport(logincontroller.getRequest().getCompany() + "/modules/" + path, parameters); + OutputStream outputStream = response.getOutputStream(); + + JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream); + FacesContext.getCurrentInstance().responseComplete(); + + } + + /** + * Método que exporta el reporte a formato .xlsx + * + * @param path, ruta de acceso al reporte en el servidor jaspersoft + * @param parameters, parámetros que se envían desde el + * controlador + * @param format, formato de archivo, en este caso xlsx + * @param filename, nombre que tendrá el archivo + * @param logincontroller + * @throws Exception + */ + @SuppressWarnings("deprecation") + public void executeXls(String path, HashMap parameters, String format, String filename, LoginController logincontroller) throws Exception { + this.adddefaultparameters(parameters, logincontroller); + if (format == null) { + format = "pdf"; + } + if ((format.compareTo("xls") == 0) || (format.compareTo("xlsx") == 0)) { + parameters.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE); + } + + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition", "attachment; filename=" + filename + ".xlsx"); + System.out.println(logincontroller.getRequest().getCompany() + "/modules/" + path); +// JasperPrint jasperPrint = this.executereport(logincontroller.getRequest().getCompany() + "/modules/" + path, parameters); + JasperPrint jasperPrint = this.executereport("/home/developer2/NetBeansProjects/sources/reports-jsf/" + path, parameters); + + OutputStream ouputStream = response.getOutputStream(); + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + JRXlsxExporter exporter = new JRXlsxExporter(); + exporter.setParameter(JRXlsExporterParameter.JASPER_PRINT, jasperPrint); + exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, byteArrayOutputStream); + exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE); + exporter.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE); + exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); + exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); + exporter.exportReport(); + ouputStream.write(byteArrayOutputStream.toByteArray()); + ouputStream.flush(); + ouputStream.close(); + FacesContext.getCurrentInstance().responseComplete(); + + } + + private JasperPrint executereport(String pathJasper, HashMap parameters) throws Exception { + PropertiesHandler ph = new PropertiesHandler("jasper"); + + JServer server = new JServer(); + //server.setUsername("jasperadmin"); + server.setUsername(ph.getStringValue("jasperserver.user")); + //server.setPassword("jasperadmin"); + server.setPassword(ph.getStringValue("jasperserver.password")); + //server.setUrl("http://localhost:8080/jasperserver/services/repository"); + server.setUrl(ph.getStringValue("jasperserver.repository")); + ResourceDescriptor rd = new ResourceDescriptor(); + rd.setWsType(ResourceDescriptor.TYPE_REPORTUNIT); + rd.setUriString("/maia/" + pathJasper); + WSClient wsClient = server.getWSClient(); + return wsClient.runReport(rd, parameters); + } + + /** + * Recupera un input stream del reporte pdf + * + * @param path + * @param parameters + * @param format + * @param filename + * @param logincontroller + * @return + * @throws Exception + */ + public InputStream jaspertoInputstream(String path, HashMap parameters, String format, String filename, LoginController logincontroller) throws Exception { + this.adddefaultparameters(parameters, logincontroller); + if (format == null) { + format = "pdf"; + } + if ((format.compareTo("xls") == 0) || (format.compareTo("xlsx") == 0)) { + parameters.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE); + } + + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition", "attachment; filename=" + filename + ".pdf"); + JasperPrint jasperPrint = this.executereport(logincontroller.getRequest().getCompany() + "/modules/" + path, parameters); + + OutputStream outputStream = response.getOutputStream(); + JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream); + InputStream inputStream; + + byte[] byteArray = JasperExportManager.exportReportToPdf(jasperPrint); + inputStream = new ByteArrayInputStream(byteArray); + FacesContext.getCurrentInstance().responseComplete(); + + return inputStream; + + } + + /** + * Recupera un byte array del reporte pdf + * + * @param path + * @param parameters + * @param format + * @param filename + * @param logincontroller + * @return + * @throws Exception + */ + public byte[] jaspertoByteArray(String path, HashMap parameters, String format, String filename, LoginController logincontroller) throws Exception { + this.adddefaultparameters(parameters, logincontroller); + if (format == null) { + format = "pdf"; + } + if ((format.compareTo("xls") == 0) || (format.compareTo("xlsx") == 0)) { + parameters.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE); + } + JasperPrint jasperPrint = this.executereport(logincontroller.getRequest().getCompany() + "/modules/" + path, parameters); + JasperExportManager.exportReportToPdfFile(jasperPrint, filename + "." + format); + byte[] byteArray = JasperExportManager.exportReportToPdf(jasperPrint); + return byteArray; + + } + + /** + * Recupera un input stream del reporte xls + * + * @param path + * @param parameters + * @param format + * @param filename + * @param logincontroller + * @return + * @throws Exception + */ + public InputStream jaspertoInputstreamXls(String path, HashMap parameters, String format, String filename, LoginController logincontroller) throws Exception { + this.adddefaultparameters(parameters, logincontroller); + if (format == null) { + format = "xls"; + } + if ((format.compareTo("xls") == 0) || (format.compareTo("xlsx") == 0)) { + parameters.put(JRParameter.IS_IGNORE_PAGINATION, Boolean.TRUE); + } + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition", "attachment; filename=" + filename + ".xls"); + JasperPrint jasperPrint = this.executereport(logincontroller.getRequest().getCompany() + "/modules/" + path, parameters); + + OutputStream ouputStream = response.getOutputStream(); + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + JRXlsxExporter exporter = new JRXlsxExporter(); + exporter.setParameter(JRXlsExporterParameter.JASPER_PRINT, jasperPrint); + exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, byteArrayOutputStream); + exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE); + exporter.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE); + exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); + exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); + exporter.exportReport(); + ouputStream.write(byteArrayOutputStream.toByteArray()); + byte[] byteArray = byteArrayOutputStream.toByteArray(); + ouputStream.flush(); + ouputStream.close(); + FacesContext.getCurrentInstance().responseComplete(); + + InputStream inputStream; + inputStream = new ByteArrayInputStream(byteArray); + FacesContext.getCurrentInstance().responseComplete(); + return inputStream; + } + + private void adddefaultparameters(HashMap parameters, LoginController logincontroller) throws Exception { + if (parameters == null) { + parameters = new HashMap(); + } + parameters.put("pathimage", "repo:/maia/" + logincontroller.getRequest().getCompany() + "/image/logo"); + parameters.put("pathstyle", "repo:/maia/" + logincontroller.getRequest().getCompany() + "/style/style"); + + TgeneAccountingDateBranch accodate = TgeneAccountingDateBranchController.find(logincontroller.getRequest().getCompany()); + parameters.put("workingdate", accodate.getWorkingdate()); + parameters.put("accountingdate", accodate.getAccountingdate()); + //parameters.workingtime = User.getHour(); + parameters.put("companycode", logincontroller.getRequest().getCompany()); + parameters.put("usercode", logincontroller.getRequest().getUser()); + parameters.put("languagecode", logincontroller.getRequest().getLanguage().toUpperCase()); + + } + + /** + * Formato de fechas utilizado en la ejecucion de reportes. + */ + private static SimpleDateFormat FORMATOFECHAREPORTES = new SimpleDateFormat("yyyy-MM-dd"); + + /** + * Entrega un string con la fecha en formato "yyyy-MM-dd" + * + * @param value Fecha a transformar a un string. + * @return String + */ + public String getFechaReporte(Date value) { + if (value == null) { + return null; + } + return FORMATOFECHAREPORTES.format(value); + } + + public StreamedContent getStreamedContent() { + return streamedContent; + } + + public void setStreamedContent(StreamedContent streamedContent) { + this.streamedContent = streamedContent; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/accounting/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/accounting/.svn/entries new file mode 100644 index 0000000..2929747 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/accounting/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/accounting +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ChangeAccoDateControllerController.java +file + + + + +2022-07-28T03:39:54.874596Z +c85dea7b503365d62ed1aa8fba059e98 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4026 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/accounting/.svn/text-base/ChangeAccoDateControllerController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/accounting/.svn/text-base/ChangeAccoDateControllerController.java.svn-base new file mode 100644 index 0000000..58ef4c5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/accounting/.svn/text-base/ChangeAccoDateControllerController.java.svn-base @@ -0,0 +1,134 @@ +package com.fp.frontend.controller.accounting; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; + +/** + * Clase controladora del bean TgeneCatalog. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ChangeAccoDateControllerController extends AbstractController { + + private Map nextDateMap; + + /** + * Constructor + * @throws Exception + */ + public ChangeAccoDateControllerController() throws Exception { + super(TgeneAccountingDateBranch.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.beanalias = "TGENEACCOUNTINGDATEBRANCH"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + Map mcriterios = new HashMap(); + mcriterios.put("pk.branchcode", "0"); + mcriterios.put("pk.companycode", request.getCompany().toString()); + + DtoQuery dto = super.getDtoQuery(false); + dto.addCriterios(mcriterios); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + this.nextDateMap = new HashMap(); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.record = new TgeneAccountingDateBranch(); + MessageHelper.setMessageError(resp); + } else { + this.record = (TgeneAccountingDateBranch) resp.get(this.beanalias); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + this.update(); + + DtoSave dtosave = super.getDtoSave(true); + if(!this.nextDateMap.isEmpty()){ + MessageHelper.setMessageError("msg_accodate_already_generated"); + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.nextDateMap = (Map) resp.get("NEXTDATE"); + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * @return Retorna el atributo nextDateMap + */ + public Map getNextDateMap() { + return this.nextDateMap; + } + + /** + * @param nextDateMap Parametro a fijar en el atributo nextDateMap + */ + public void setNextDateMap(Map nextDateMap) { + this.nextDateMap = nextDateMap; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/accounting/ChangeAccoDateControllerController.java b/frontend/src/main/java/com/fp/frontend/controller/accounting/ChangeAccoDateControllerController.java new file mode 100644 index 0000000..dabaead --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/accounting/ChangeAccoDateControllerController.java @@ -0,0 +1,136 @@ +package com.fp.frontend.controller.accounting; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; + +/** + * Clase controladora del bean TgeneCatalog. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ChangeAccoDateControllerController extends AbstractController { + + private Map nextDateMap; + + /** + * Constructor + * + * @throws Exception + */ + public ChangeAccoDateControllerController() throws Exception { + super(TgeneAccountingDateBranch.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.beanalias = "TGENEACCOUNTINGDATEBRANCH"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + Map mcriterios = new HashMap(); + mcriterios.put("pk.branchcode", "0"); + mcriterios.put("pk.companycode", request.getCompany().toString()); + + DtoQuery dto = super.getDtoQuery(false); + dto.addCriterios(mcriterios); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + this.nextDateMap = new HashMap(); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.record = new TgeneAccountingDateBranch(); + MessageHelper.setMessageError(resp); + } else { + this.record = (TgeneAccountingDateBranch) resp.get(this.beanalias); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + this.update(); + + DtoSave dtosave = super.getDtoSave(true); + if (!this.nextDateMap.isEmpty()) { + MessageHelper.setMessageError("msg_accodate_already_generated"); + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.nextDateMap = (Map) resp.get("NEXTDATE"); + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * @return Retorna el atributo nextDateMap + */ + public Map getNextDateMap() { + return this.nextDateMap; + } + + /** + * @param nextDateMap Parametro a fijar en el atributo nextDateMap + */ + public void setNextDateMap(Map nextDateMap) { + this.nextDateMap = nextDateMap; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/alfresco/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/alfresco/.svn/entries new file mode 100644 index 0000000..5c6affe --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/alfresco/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/alfresco +svn://172.17.26.185/COMACO + + + +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +AlfrescoController.java +file + + + + +2022-07-28T03:39:55.687600Z +45814a2a0692361c5268e3d6aeb8b23a +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +20542 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/alfresco/.svn/text-base/AlfrescoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/alfresco/.svn/text-base/AlfrescoController.java.svn-base new file mode 100644 index 0000000..6d95533 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/alfresco/.svn/text-base/AlfrescoController.java.svn-base @@ -0,0 +1,534 @@ +/** + * + */ +package com.fp.frontend.controller.alfresco; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.ExternalContext; +import javax.faces.context.FacesContext; +import javax.faces.event.ActionEvent; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.io.IOUtils; +import org.primefaces.context.RequestContext; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.DefaultStreamedContent; +import org.primefaces.model.StreamedContent; +import org.primefaces.model.UploadedFile; + +import com.fp.alfresco.client.AlfrescoApi; +import com.fp.alfresco.client.DocumentoAlfresco; +import com.fp.alfresco.exception.ExceptionWebscript; +import com.fp.alfresco.util.ApiProperties; +import com.fp.frontend.controller.pentaho.PentahoController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.EnumParametros; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +/** + * @author amerchan + * @author dcruz + * + */ +@ManagedBean +@ViewScoped +public class AlfrescoController implements Serializable { + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{loginController}") + private LoginController logincontroler; + + @ManagedProperty(value = "#{pentahoController}") + private PentahoController pentahoController; + + private AlfrescoApi api; + + private List lDocuments; + + private List lUploadedDocuments; + + public AlfrescoController() { + lUploadedDocuments = new ArrayList(); + api = new AlfrescoApi("comaco"); + } + + public boolean uploadFile(InputStream document, String fileName, String xPathLocation) { + return uploadFile(null, document, fileName, xPathLocation); + } + + public boolean uploadFile(String site, InputStream document, String fileName, String xPathLocation) { + Boolean resp = Boolean.FALSE; + try { + fileName=Utilidades.caractersEspeciales(fileName); + } catch (Exception e1) { + e1.printStackTrace(); + MessageHelper.setMessageError(e1.getMessage()); + return Boolean.FALSE; + } + try { + + if(site != null){ + api = new AlfrescoApi(site); + } + String name = FilenameUtils.getBaseName(fileName); + String extension = FilenameUtils.getExtension(fileName); + File archivoTemporal = File.createTempFile(name, extension); + OutputStream outputStream = new FileOutputStream(archivoTemporal); + IOUtils.copy(document, outputStream); + IOUtils.closeQuietly(document); + IOUtils.closeQuietly(outputStream); + + DocumentoAlfresco documentoAlfresco = api.findOneByXPathLocation(ApiProperties.getProperty("api.doclocation.base", api.getSite())+"/"+xPathLocation+"/cm:"+fileName); + if (documentoAlfresco != null && documentoAlfresco.getId() != null) { +// DocumentoAlfresco docUpdate = documentoAlfresco.get(0); + documentoAlfresco.setFile(archivoTemporal); + documentoAlfresco.setNombre(fileName); + api.uploadUpdateDocument(documentoAlfresco); + } else { + DocumentoAlfresco doc = new DocumentoAlfresco(fileName, logincontroler.getRequest().getUser()); + doc.setFile(archivoTemporal); + doc.setNombre(fileName); + api.uploadNewDocument(xPathLocation, doc); + } + resp = Boolean.TRUE; + + } catch (ExceptionWebscript e) { + resp = Boolean.FALSE; + MessageHelper.setMessageError(e.getMessage()); + } catch (Throwable e) { + resp = Boolean.FALSE; + e.printStackTrace(); + MessageHelper.setMessageError("msg_error_subir_arch"); + } + return resp; + } + + public boolean uploadFileWebService(InputStream document, String fileName, String xPathLocation,String user) { + Boolean resp = Boolean.FALSE; + + try { + + String name = FilenameUtils.getBaseName(fileName); + String extension = FilenameUtils.getExtension(fileName); + File archivoTemporal = File.createTempFile(name, extension); + OutputStream outputStream = new FileOutputStream(archivoTemporal); + IOUtils.copy(document, outputStream); + IOUtils.closeQuietly(document); + IOUtils.closeQuietly(outputStream); + DocumentoAlfresco documentoAlfresco = api.findOneByXPathLocation(ApiProperties.getProperty("api.doclocation.base", api.getSite())+"/"+xPathLocation+"/cm:"+fileName); + if (documentoAlfresco != null && documentoAlfresco.getId() != null) { + documentoAlfresco.setFile(archivoTemporal); + documentoAlfresco.setNombre(fileName); + api.uploadUpdateDocument(documentoAlfresco); + } else { + DocumentoAlfresco doc = new DocumentoAlfresco(fileName, user); + doc.setFile(archivoTemporal); + doc.setNombre(fileName); + api.uploadNewDocument(xPathLocation, doc); + } + resp = Boolean.TRUE; + + } catch (ExceptionWebscript e) { + resp = Boolean.FALSE; + MessageHelper.setMessageError(e.getMessage()); + } catch (Throwable e) { + resp = Boolean.FALSE; + e.printStackTrace(); + MessageHelper.setMessageError("msg_error_subir_arch"); + } + return resp; + } + + public void listenerUpload(FileUploadEvent event) { + UploadedFile item = event.getFile(); + try { + Utilidades.caractersEspeciales(item.getFileName()); + } catch (Exception e1) { + e1.printStackTrace(); + MessageHelper.setMessageError(e1.getMessage()); + return; + } +// String[] nameArr = item.getFileName().split("[.]"); +// String name = nameArr[0]; +// String extension = nameArr[1]; + String name = FilenameUtils.getBaseName(item.getFileName()); + String extension = FilenameUtils.getExtension(item.getFileName()); + + String xPathLocation = (String) event.getComponent().getAttributes().get("xPathLocation"); + if ((xPathLocation == null) || xPathLocation.isEmpty()) { + MessageHelper.setMessageError("msg_location_req"); + return; + } + try { + File archivoTemporal = File.createTempFile(name, extension); + OutputStream outputStream = new FileOutputStream(archivoTemporal); + InputStream inputStream = item.getInputstream(); + IOUtils.copy(inputStream, outputStream); + IOUtils.closeQuietly(inputStream); + IOUtils.closeQuietly(outputStream); + + DocumentoAlfresco doc = new DocumentoAlfresco(item.getFileName(), logincontroler.getRequest().getUser()); + doc.setFile(archivoTemporal); + doc.setNombre(item.getFileName()); + doc = api.uploadNewDocument(xPathLocation, doc); + doc.setFile(archivoTemporal); + lUploadedDocuments.add(doc); + RequestContext.getCurrentInstance().execute("onUploadAlfrescoListener()"); + } catch (ExceptionWebscript e) { + MessageHelper.setMessageError(e.getMessage()); + return; + } catch (Exception e) { + e.printStackTrace(); + MessageHelper.setMessageError("msg_error_subir_arch"); + } + } + + public byte[] downloadReturnDocument(String location) { + FacesContext context = FacesContext.getCurrentInstance(); + ExternalContext external = context.getExternalContext(); +// HttpServletResponse response = (HttpServletResponse) external.getResponse(); + try { + TgeneParameters parameters =ParametersController.find("PATH.ALFRESCO.ARCHIVOS", "1"); + String xPathLocation=parameters.getTextvalue()+location; +// xPathLocation+=(String) event.getComponent().getAttributes().get("xPathLocation"); + DocumentoAlfresco doc = null; + if ((xPathLocation != null) && !xPathLocation.isEmpty()) { + doc = api.findOneByXPathLocation(xPathLocation); + } + if (doc == null) { + MessageHelper.setMessageError("msg_doc_no_existe"); + return null; + } +// response.setHeader("Pragma", "no-cache"); +// response.setDateHeader("Expires", 0); +// response.setContentType("application/octet-stream"); +// response.setHeader("Content-Disposition", "attachment;filename=\"" + doc.getNombre() + "\""); + + InputStream inputStream = api.downloadDocumentByXPathLocation(xPathLocation); + byte[] bytes = IOUtils.toByteArray(inputStream); + return bytes; +// OutputStream outputStream = response.getOutputStream(); +// IOUtils.copy(inputStream, outputStream); +// IOUtils.closeQuietly(inputStream); +// IOUtils.closeQuietly(outputStream); + } catch (Exception e) { + e.printStackTrace(); + MessageHelper.setMessageError("msg_error_bajar_arch"); + return null; + } +// context.responseComplete(); + } + + public void downloadDocument(ActionEvent event) { + FacesContext context = FacesContext.getCurrentInstance(); + ExternalContext external = context.getExternalContext(); + HttpServletResponse response = (HttpServletResponse) external.getResponse(); + try { + TgeneParameters parameters =ParametersController.find("PATH.ALFRESCO.ARCHIVOS", "1"); + String xPathLocation=parameters.getTextvalue(); + xPathLocation+=(String) event.getComponent().getAttributes().get("xPathLocation"); + DocumentoAlfresco doc = null; + if ((xPathLocation != null) && !xPathLocation.isEmpty()) { + doc = api.findOneByXPathLocation(xPathLocation); + } + if (doc == null) { + MessageHelper.setMessageError("msg_doc_no_existe"); + return; + } + response.setHeader("Pragma", "no-cache"); + response.setDateHeader("Expires", 0); + response.setContentType("application/octet-stream"); + response.setHeader("Content-Disposition", "attachment;filename=\"" + doc.getNombre() + "\""); + + InputStream inputStream = api.downloadDocumentByXPathLocation(xPathLocation); + OutputStream outputStream = response.getOutputStream(); + IOUtils.copy(inputStream, outputStream); + IOUtils.closeQuietly(inputStream); + IOUtils.closeQuietly(outputStream); + } catch (Exception e) { + e.printStackTrace(); + MessageHelper.setMessageError("msg_error_bajar_arch"); + return; + } + context.responseComplete(); + } + + public static StreamedContent downloadDocument(String ruta) { + FacesContext context = FacesContext.getCurrentInstance(); + ExternalContext external = context.getExternalContext(); + HttpServletResponse response = (HttpServletResponse) external.getResponse(); + try { + TgeneParameters parameters =ParametersController.find("PATH.ALFRESCO.ARCHIVOS", "1"); + String xPathLocation=parameters.getTextvalue(); + xPathLocation+=ruta; + DocumentoAlfresco doc = null; + AlfrescoApi api = new AlfrescoApi("comaco"); + if ((xPathLocation != null) && !xPathLocation.isEmpty()) { + doc = api.findOneByXPathLocation(xPathLocation); + } + if (doc == null) { + MessageHelper.setMessageError("msg_doc_no_existe"); + return null; + } + response.setHeader("Pragma", "no-cache"); + response.setDateHeader("Expires", 0); + response.setContentType("application/octet-stream"); + response.setHeader("Content-Disposition", "attachment;filename=\"" + doc.getNombre() + "\""); + + InputStream inputStream = api.downloadDocumentByXPathLocation(xPathLocation); + return new DefaultStreamedContent(inputStream, "application/pdf", "TerminosCondiciones.pdf"); + } catch (Exception e) { + e.printStackTrace(); + MessageHelper.setMessageError("msg_error_bajar_arch"); + return null; + } + } + + public void prepareDocumentList(ActionEvent event) { + String xPathLocationFolder = (String) event.getComponent().getAttributes().get("xPathLocation"); + try { + DocumentoAlfresco doc = api.findOneByXPathLocation(xPathLocationFolder); + if (doc == null) { + MessageHelper.setMessageError("msg_carp_no_existe", xPathLocationFolder); + return; + } + lDocuments = api.findListByXPathLocation(xPathLocationFolder); + } catch (Exception e) { + e.printStackTrace(); + MessageHelper.setMessageError("msg_error_consulta_docs"); + } + } + + public static InputStream getDocument(String name, String path) { + + AlfrescoController alfresco = new AlfrescoController(); + String xPath = path + name; + + InputStream input = null; + try { + + input = alfresco.api.downloadDocumentByXPathLocation(xPath) != null ? alfresco.api.downloadDocumentByXPathLocation(xPath) : null; + } catch (ExceptionWebscript e) { + MessageHelper.setMessageError(e); + input = null; + } catch (Exception ex) { + + } + return input; + + } + + /** + * Descarga un documento Alfresco + * + * @param name + * @param path + * @return + */ + public static InputStream getDocumentByCode(String codDocument, String nomTipo, String company) { + + AlfrescoController alfresco = new AlfrescoController(); + + String xPath = ParametersController.find(EnumParametros.PATH_ALFRESCO.getCodigo(), company).getTextvalue() + codDocument + "/cm:" + nomTipo + + "_" + codDocument + ".pdf"; + + InputStream input = null; + try { + + input = alfresco.api.downloadDocumentByXPathLocation(xPath) != null ? alfresco.api.downloadDocumentByXPathLocation(xPath) : null; + } catch (ExceptionWebscript e) { + MessageHelper.setMessageError(e); + input = null; + } catch (Exception ex) { + // TODO Auto-generated catch block + } + return input; + + } + + /** + * Carga un documento + * + * @param codDocument + * @param nomTipo (solicitud - informe) + * @throws Exception + */ + /*public void uploadDocument(String codDocument, String nomTipo, String tipo) throws Exception { + + String reporte = nomTipo; + Map parameters = new HashMap(); + parameters.put("cod_solicitud", codDocument); + parameters.put("cod_tipo", tipo); + + this.uploadFile(pentahoController.generateTemporalReport(reporte, parameters, "pdf"), nomTipo + "_" + codDocument + ".pdf", "pdf", + codDocument); + }*/ + + /** + * Carga un documento + * + * @param codDocument + * @param nomTipo (solicitud - informe) + * @throws Exception + */ + /*public static boolean uploadSignedDocument(InputStream document, String codDocument, String nomTipo) { + + AlfrescoController alfresco = new AlfrescoController(); + + try { + alfresco.uploadFile(document, nomTipo + "_" + codDocument + ".pdf", "pdf", codDocument); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + }*/ + + public boolean uploadDocumentRepository(InputStream document, String fileName, String xPathLocation) { + return uploadDocumentRepository(null, document, fileName, xPathLocation); + } + + /** + * Método general de carga de documentos en alfresco + * + * @param document documento a cargar + * @param site sitio a cargar el documento + * @param fileName nombre con el que se cargara el archivo + * @param xPathFile ruta dentro del sitio que se almacenara el documento + * @return + */ + public boolean uploadDocumentRepository(String site, InputStream document, String fileName, String xPathLocation) { + Boolean resp = Boolean.FALSE; + try { + if(site != null){ + api = new AlfrescoApi(site); + } + String name = FilenameUtils.getName(fileName); + String extension = FilenameUtils.getExtension(fileName); + File archivoTemporal = File.createTempFile(name, extension); + OutputStream outputStream = new FileOutputStream(archivoTemporal); + IOUtils.copy(document, outputStream); + IOUtils.closeQuietly(document); + IOUtils.closeQuietly(outputStream); + + DocumentoAlfresco doc = new DocumentoAlfresco(fileName, logincontroler.getRequest().getUser()); + doc.setFile(archivoTemporal); + doc.setNombre(fileName); + doc = api.uploadNewDocument(xPathLocation, doc); + resp = true; + } catch (Throwable e) { + resp = false; + } + return resp; + } + + /** + * Carga un documento + * + * @param codDocument + * @param nomTipo (solicitud - informe) + * @throws Exception + */ + /*public void uploadDocument(InputStream document, String codDocument, String nomTipo) throws Exception { + + this.uploadFile(document, nomTipo + "_" + codDocument + ".pdf", "pdf", codDocument); + }*/ + + /** + * @return Retorna el atributo logincontroler + */ + public LoginController getLogincontroler() { + return logincontroler; + } + + /** + * @param logincontroler Parametro a fijar en el atributo logincontroler + */ + public void setLogincontroler(LoginController logincontroler) { + this.logincontroler = logincontroler; + } + + /** + * @return Retorna el atributo lDocuments + */ + public List getlDocuments() { + return lDocuments; + } + + /** + * @param lDocuments Parametro a fijar en el atributo lDocuments + */ + public void setlDocuments(List lDocuments) { + this.lDocuments = lDocuments; + } + + /** + * @return Retorna el atributo lUploadedDocuments + */ + public List getlUploadedDocuments() { + return lUploadedDocuments; + } + + /** + * @param lUploadedDocuments Parametro a fijar en el atributo lUploadedDocuments + */ + public void setlUploadedDocuments(List lUploadedDocuments) { + this.lUploadedDocuments = lUploadedDocuments; + } + + public void clearlUploadedDocuments() { + if (lUploadedDocuments != null) { + lUploadedDocuments.clear(); + } else { + lUploadedDocuments = new ArrayList(); + } + } + + /** + * @return Retorna el atributo api + */ + public AlfrescoApi getApi() { + return api; + } + + /** + * @param Fija el par�metro del atributo api + */ + public void setApi(AlfrescoApi api) { + this.api = api; + } + + /** + * Entrega una instancia de PentahoController + * + * @return pentahoController + */ + public PentahoController getPentahoController() { + return pentahoController; + } + + /** + * Fija una instancia de PentahoController + * + * @param pentahoController + */ + public void setPentahoController(PentahoController pentahoController) { + this.pentahoController = pentahoController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/alfresco/AlfrescoController.java b/frontend/src/main/java/com/fp/frontend/controller/alfresco/AlfrescoController.java new file mode 100644 index 0000000..8a8f7f4 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/alfresco/AlfrescoController.java @@ -0,0 +1,532 @@ +/** + * + */ +package com.fp.frontend.controller.alfresco; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.ExternalContext; +import javax.faces.context.FacesContext; +import javax.faces.event.ActionEvent; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.io.IOUtils; +import org.primefaces.context.RequestContext; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.DefaultStreamedContent; +import org.primefaces.model.StreamedContent; +import org.primefaces.model.UploadedFile; + +import com.fp.alfresco.client.AlfrescoApi; +import com.fp.alfresco.client.DocumentoAlfresco; +import com.fp.alfresco.exception.ExceptionWebscript; +import com.fp.alfresco.util.ApiProperties; +import com.fp.frontend.controller.pentaho.PentahoController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.EnumParametros; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +/** + * @author amerchan + * @author dcruz + * + */ +@ManagedBean +@ViewScoped +public class AlfrescoController implements Serializable { + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{loginController}") + private LoginController logincontroler; + + @ManagedProperty(value = "#{pentahoController}") + private PentahoController pentahoController; + + private AlfrescoApi api; + + private List lDocuments; + + private List lUploadedDocuments; + + public AlfrescoController() { + lUploadedDocuments = new ArrayList(); + api = new AlfrescoApi("comaco"); + } + + public boolean uploadFile(InputStream document, String fileName, String xPathLocation) { + return uploadFile(null, document, fileName, xPathLocation); + } + + public boolean uploadFile(String site, InputStream document, String fileName, String xPathLocation) { + Boolean resp = Boolean.FALSE; + try { + fileName = Utilidades.caractersEspeciales(fileName); + } catch (Exception e1) { + e1.printStackTrace(); + MessageHelper.setMessageError(e1.getMessage()); + return Boolean.FALSE; + } + try { + + if (site != null) { + api = new AlfrescoApi(site); + } + String name = FilenameUtils.getBaseName(fileName); + String extension = FilenameUtils.getExtension(fileName); + File archivoTemporal = File.createTempFile(name, extension); + OutputStream outputStream = new FileOutputStream(archivoTemporal); + IOUtils.copy(document, outputStream); + IOUtils.closeQuietly(document); + IOUtils.closeQuietly(outputStream); + + DocumentoAlfresco documentoAlfresco = api.findOneByXPathLocation(ApiProperties.getProperty("api.doclocation.base", api.getSite()) + "/" + xPathLocation + "/cm:" + fileName); + if (documentoAlfresco != null && documentoAlfresco.getId() != null) { +// DocumentoAlfresco docUpdate = documentoAlfresco.get(0); + documentoAlfresco.setFile(archivoTemporal); + documentoAlfresco.setNombre(fileName); + api.uploadUpdateDocument(documentoAlfresco); + } else { + DocumentoAlfresco doc = new DocumentoAlfresco(fileName, logincontroler.getRequest().getUser()); + doc.setFile(archivoTemporal); + doc.setNombre(fileName); + api.uploadNewDocument(xPathLocation, doc); + } + resp = Boolean.TRUE; + + } catch (ExceptionWebscript e) { + resp = Boolean.FALSE; + MessageHelper.setMessageError(e.getMessage()); + } catch (Throwable e) { + resp = Boolean.FALSE; + e.printStackTrace(); + MessageHelper.setMessageError("msg_error_subir_arch"); + } + return resp; + } + + public boolean uploadFileWebService(InputStream document, String fileName, String xPathLocation, String user) { + Boolean resp = Boolean.FALSE; + + try { + + String name = FilenameUtils.getBaseName(fileName); + String extension = FilenameUtils.getExtension(fileName); + File archivoTemporal = File.createTempFile(name, extension); + OutputStream outputStream = new FileOutputStream(archivoTemporal); + IOUtils.copy(document, outputStream); + IOUtils.closeQuietly(document); + IOUtils.closeQuietly(outputStream); + DocumentoAlfresco documentoAlfresco = api.findOneByXPathLocation(ApiProperties.getProperty("api.doclocation.base", api.getSite()) + "/" + xPathLocation + "/cm:" + fileName); + if (documentoAlfresco != null && documentoAlfresco.getId() != null) { + documentoAlfresco.setFile(archivoTemporal); + documentoAlfresco.setNombre(fileName); + api.uploadUpdateDocument(documentoAlfresco); + } else { + DocumentoAlfresco doc = new DocumentoAlfresco(fileName, user); + doc.setFile(archivoTemporal); + doc.setNombre(fileName); + api.uploadNewDocument(xPathLocation, doc); + } + resp = Boolean.TRUE; + + } catch (ExceptionWebscript e) { + resp = Boolean.FALSE; + MessageHelper.setMessageError(e.getMessage()); + } catch (Throwable e) { + resp = Boolean.FALSE; + e.printStackTrace(); + MessageHelper.setMessageError("msg_error_subir_arch"); + } + return resp; + } + + public void listenerUpload(FileUploadEvent event) { + UploadedFile item = event.getFile(); + try { + Utilidades.caractersEspeciales(item.getFileName()); + } catch (Exception e1) { + e1.printStackTrace(); + MessageHelper.setMessageError(e1.getMessage()); + return; + } +// String[] nameArr = item.getFileName().split("[.]"); +// String name = nameArr[0]; +// String extension = nameArr[1]; + String name = FilenameUtils.getBaseName(item.getFileName()); + String extension = FilenameUtils.getExtension(item.getFileName()); + + String xPathLocation = (String) event.getComponent().getAttributes().get("xPathLocation"); + if ((xPathLocation == null) || xPathLocation.isEmpty()) { + MessageHelper.setMessageError("msg_location_req"); + return; + } + try { + File archivoTemporal = File.createTempFile(name, extension); + OutputStream outputStream = new FileOutputStream(archivoTemporal); + InputStream inputStream = item.getInputstream(); + IOUtils.copy(inputStream, outputStream); + IOUtils.closeQuietly(inputStream); + IOUtils.closeQuietly(outputStream); + + DocumentoAlfresco doc = new DocumentoAlfresco(item.getFileName(), logincontroler.getRequest().getUser()); + doc.setFile(archivoTemporal); + doc.setNombre(item.getFileName()); + doc = api.uploadNewDocument(xPathLocation, doc); + doc.setFile(archivoTemporal); + lUploadedDocuments.add(doc); + RequestContext.getCurrentInstance().execute("onUploadAlfrescoListener()"); + } catch (ExceptionWebscript e) { + MessageHelper.setMessageError(e.getMessage()); + return; + } catch (Exception e) { + e.printStackTrace(); + MessageHelper.setMessageError("msg_error_subir_arch"); + } + } + + public byte[] downloadReturnDocument(String location) { + FacesContext context = FacesContext.getCurrentInstance(); + ExternalContext external = context.getExternalContext(); +// HttpServletResponse response = (HttpServletResponse) external.getResponse(); + try { + TgeneParameters parameters = ParametersController.find("PATH.ALFRESCO.ARCHIVOS", "1"); + String xPathLocation = parameters.getTextvalue() + location; +// xPathLocation+=(String) event.getComponent().getAttributes().get("xPathLocation"); + DocumentoAlfresco doc = null; + if ((xPathLocation != null) && !xPathLocation.isEmpty()) { + doc = api.findOneByXPathLocation(xPathLocation); + } + if (doc == null) { + MessageHelper.setMessageError("msg_doc_no_existe"); + return null; + } +// response.setHeader("Pragma", "no-cache"); +// response.setDateHeader("Expires", 0); +// response.setContentType("application/octet-stream"); +// response.setHeader("Content-Disposition", "attachment;filename=\"" + doc.getNombre() + "\""); + + InputStream inputStream = api.downloadDocumentByXPathLocation(xPathLocation); + byte[] bytes = IOUtils.toByteArray(inputStream); + return bytes; +// OutputStream outputStream = response.getOutputStream(); +// IOUtils.copy(inputStream, outputStream); +// IOUtils.closeQuietly(inputStream); +// IOUtils.closeQuietly(outputStream); + } catch (Exception e) { + e.printStackTrace(); + MessageHelper.setMessageError("msg_error_bajar_arch"); + return null; + } +// context.responseComplete(); + } + + public void downloadDocument(ActionEvent event) { + FacesContext context = FacesContext.getCurrentInstance(); + ExternalContext external = context.getExternalContext(); + HttpServletResponse response = (HttpServletResponse) external.getResponse(); + try { + TgeneParameters parameters = ParametersController.find("PATH.ALFRESCO.ARCHIVOS", "1"); + String xPathLocation = parameters.getTextvalue(); + xPathLocation += (String) event.getComponent().getAttributes().get("xPathLocation"); + DocumentoAlfresco doc = null; + if ((xPathLocation != null) && !xPathLocation.isEmpty()) { + doc = api.findOneByXPathLocation(xPathLocation); + } + if (doc == null) { + MessageHelper.setMessageError("msg_doc_no_existe"); + return; + } + response.setHeader("Pragma", "no-cache"); + response.setDateHeader("Expires", 0); + response.setContentType("application/octet-stream"); + response.setHeader("Content-Disposition", "attachment;filename=\"" + doc.getNombre() + "\""); + + InputStream inputStream = api.downloadDocumentByXPathLocation(xPathLocation); + OutputStream outputStream = response.getOutputStream(); + IOUtils.copy(inputStream, outputStream); + IOUtils.closeQuietly(inputStream); + IOUtils.closeQuietly(outputStream); + } catch (Exception e) { + e.printStackTrace(); + MessageHelper.setMessageError("msg_error_bajar_arch"); + return; + } + context.responseComplete(); + } + + public static StreamedContent downloadDocument(String ruta) { + FacesContext context = FacesContext.getCurrentInstance(); + ExternalContext external = context.getExternalContext(); + HttpServletResponse response = (HttpServletResponse) external.getResponse(); + try { + TgeneParameters parameters = ParametersController.find("PATH.ALFRESCO.ARCHIVOS", "1"); + String xPathLocation = parameters.getTextvalue(); + xPathLocation += ruta; + DocumentoAlfresco doc = null; + AlfrescoApi api = new AlfrescoApi("comaco"); + if ((xPathLocation != null) && !xPathLocation.isEmpty()) { + doc = api.findOneByXPathLocation(xPathLocation); + } + if (doc == null) { + MessageHelper.setMessageError("msg_doc_no_existe"); + return null; + } + response.setHeader("Pragma", "no-cache"); + response.setDateHeader("Expires", 0); + response.setContentType("application/octet-stream"); + response.setHeader("Content-Disposition", "attachment;filename=\"" + doc.getNombre() + "\""); + + InputStream inputStream = api.downloadDocumentByXPathLocation(xPathLocation); + return new DefaultStreamedContent(inputStream, "application/pdf", "TerminosCondiciones.pdf"); + } catch (Exception e) { + e.printStackTrace(); + MessageHelper.setMessageError("msg_error_bajar_arch"); + return null; + } + } + + public void prepareDocumentList(ActionEvent event) { + String xPathLocationFolder = (String) event.getComponent().getAttributes().get("xPathLocation"); + try { + DocumentoAlfresco doc = api.findOneByXPathLocation(xPathLocationFolder); + if (doc == null) { + MessageHelper.setMessageError("msg_carp_no_existe", xPathLocationFolder); + return; + } + lDocuments = api.findListByXPathLocation(xPathLocationFolder); + } catch (Exception e) { + e.printStackTrace(); + MessageHelper.setMessageError("msg_error_consulta_docs"); + } + } + + public static InputStream getDocument(String name, String path) { + + AlfrescoController alfresco = new AlfrescoController(); + String xPath = path + name; + + InputStream input = null; + try { + + input = alfresco.api.downloadDocumentByXPathLocation(xPath) != null ? alfresco.api.downloadDocumentByXPathLocation(xPath) : null; + } catch (ExceptionWebscript e) { + MessageHelper.setMessageError(e); + input = null; + } catch (Exception ex) { + + } + return input; + + } + + /** + * Descarga un documento Alfresco + * + * @param name + * @param path + * @return + */ + public static InputStream getDocumentByCode(String codDocument, String nomTipo, String company) { + + AlfrescoController alfresco = new AlfrescoController(); + + String xPath = ParametersController.find(EnumParametros.PATH_ALFRESCO.getCodigo(), company).getTextvalue() + codDocument + "/cm:" + nomTipo + + "_" + codDocument + ".pdf"; + + InputStream input = null; + try { + + input = alfresco.api.downloadDocumentByXPathLocation(xPath) != null ? alfresco.api.downloadDocumentByXPathLocation(xPath) : null; + } catch (ExceptionWebscript e) { + MessageHelper.setMessageError(e); + input = null; + } catch (Exception ex) { + // TODO Auto-generated catch block + } + return input; + + } + + /** + * Carga un documento + * + * @param codDocument + * @param nomTipo (solicitud - informe) + * @throws Exception + */ + /*public void uploadDocument(String codDocument, String nomTipo, String tipo) throws Exception { + + String reporte = nomTipo; + Map parameters = new HashMap(); + parameters.put("cod_solicitud", codDocument); + parameters.put("cod_tipo", tipo); + + this.uploadFile(pentahoController.generateTemporalReport(reporte, parameters, "pdf"), nomTipo + "_" + codDocument + ".pdf", "pdf", + codDocument); + }*/ + /** + * Carga un documento + * + * @param codDocument + * @param nomTipo (solicitud - informe) + * @throws Exception + */ + /*public static boolean uploadSignedDocument(InputStream document, String codDocument, String nomTipo) { + + AlfrescoController alfresco = new AlfrescoController(); + + try { + alfresco.uploadFile(document, nomTipo + "_" + codDocument + ".pdf", "pdf", codDocument); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + }*/ + public boolean uploadDocumentRepository(InputStream document, String fileName, String xPathLocation) { + return uploadDocumentRepository(null, document, fileName, xPathLocation); + } + + /** + * Método general de carga de documentos en alfresco + * + * @param document documento a cargar + * @param site sitio a cargar el documento + * @param fileName nombre con el que se cargara el archivo + * @param xPathFile ruta dentro del sitio que se almacenara el documento + * @return + */ + public boolean uploadDocumentRepository(String site, InputStream document, String fileName, String xPathLocation) { + Boolean resp = Boolean.FALSE; + try { + if (site != null) { + api = new AlfrescoApi(site); + } + String name = FilenameUtils.getName(fileName); + String extension = FilenameUtils.getExtension(fileName); + File archivoTemporal = File.createTempFile(name, extension); + OutputStream outputStream = new FileOutputStream(archivoTemporal); + IOUtils.copy(document, outputStream); + IOUtils.closeQuietly(document); + IOUtils.closeQuietly(outputStream); + + DocumentoAlfresco doc = new DocumentoAlfresco(fileName, logincontroler.getRequest().getUser()); + doc.setFile(archivoTemporal); + doc.setNombre(fileName); + doc = api.uploadNewDocument(xPathLocation, doc); + resp = true; + } catch (Throwable e) { + resp = false; + } + return resp; + } + + /** + * Carga un documento + * + * @param codDocument + * @param nomTipo (solicitud - informe) + * @throws Exception + */ + /*public void uploadDocument(InputStream document, String codDocument, String nomTipo) throws Exception { + + this.uploadFile(document, nomTipo + "_" + codDocument + ".pdf", "pdf", codDocument); + }*/ + /** + * @return Retorna el atributo logincontroler + */ + public LoginController getLogincontroler() { + return logincontroler; + } + + /** + * @param logincontroler Parametro a fijar en el atributo logincontroler + */ + public void setLogincontroler(LoginController logincontroler) { + this.logincontroler = logincontroler; + } + + /** + * @return Retorna el atributo lDocuments + */ + public List getlDocuments() { + return lDocuments; + } + + /** + * @param lDocuments Parametro a fijar en el atributo lDocuments + */ + public void setlDocuments(List lDocuments) { + this.lDocuments = lDocuments; + } + + /** + * @return Retorna el atributo lUploadedDocuments + */ + public List getlUploadedDocuments() { + return lUploadedDocuments; + } + + /** + * @param lUploadedDocuments Parametro a fijar en el atributo + * lUploadedDocuments + */ + public void setlUploadedDocuments(List lUploadedDocuments) { + this.lUploadedDocuments = lUploadedDocuments; + } + + public void clearlUploadedDocuments() { + if (lUploadedDocuments != null) { + lUploadedDocuments.clear(); + } else { + lUploadedDocuments = new ArrayList(); + } + } + + /** + * @return Retorna el atributo api + */ + public AlfrescoApi getApi() { + return api; + } + + /** + * @param Fija el par�metro del atributo api + */ + public void setApi(AlfrescoApi api) { + this.api = api; + } + + /** + * Entrega una instancia de PentahoController + * + * @return pentahoController + */ + public PentahoController getPentahoController() { + return pentahoController; + } + + /** + * Fija una instancia de PentahoController + * + * @param pentahoController + */ + public void setPentahoController(PentahoController pentahoController) { + this.pentahoController = pentahoController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/armas/.svn/entries new file mode 100644 index 0000000..3fb57d6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/.svn/entries @@ -0,0 +1,111 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/armas +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +solicitud +dir + +funcionalidad +dir + +lov +dir + +TipoTramiteController.java +file + + + + +2022-07-28T03:39:54.554595Z +a93b73d7346c382fc51c0ef28d8850bb +2020-10-01T15:35:45.801439Z +4629 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +4322 + +eval +dir + +RequisitoPorTipoTramiteController.java +file + + + + +2022-07-28T03:39:54.554595Z +0833e357b8af5d7fffb8d1fb8fdabc37 +2014-08-19T10:33:45.613393Z +234 +ogarcia + + + + + + + + + + + + + + + + + + + + + +5945 + +parametros +dir + diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/.svn/text-base/RequisitoPorTipoTramiteController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/.svn/text-base/RequisitoPorTipoTramiteController.java.svn-base new file mode 100644 index 0000000..01fbb82 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/.svn/text-base/RequisitoPorTipoTramiteController.java.svn-base @@ -0,0 +1,187 @@ +package com.fp.frontend.controller.armas; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.RequisitoController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmRequisito; +import com.fp.persistence.parmas.param.TarmRequisitoPorTipoTramite; +import com.fp.persistence.parmas.param.TarmTipoTramite; + +/** + * Clase controladora del bean TarmRequisitoPorTipoTramite. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RequisitoPorTipoTramiteController extends AbstractController { + + List ltipotramite; + + List lrequisito; + + public RequisitoPorTipoTramiteController() throws Exception { + super(TarmRequisitoPorTipoTramite.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + ltipotramite = TipoTramiteController.find(); + lrequisito = RequisitoController.find(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "REQUISITOPORTIPOTRAMITE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + // record.getPk().setCtipotramite(super.getMfilters().get("pk.ctipotramite")); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.crequisito"); + // Subquery + SubQuery subquery = new SubQuery("TarmRequisito", "nombre", "nrequisito", "i.pk = t.pk.crequisito"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Fija la descripcion del perfil en el record + */ + public void setNombreReqisito() { + for (TarmRequisito r : lrequisito) { + if (r.getPk().compareTo(record.getPk().getCrequisito()) == 0) { + record.put("nrequisito", r.getNombre()); + } + } + } + + /** + * @return the ltipotramite + */ + public List getLtipotramite() { + return ltipotramite; + } + + /** + * @param ltipotramite the ltipotramite to set + */ + public void setLtipotramite(List ltipotramite) { + this.ltipotramite = ltipotramite; + } + + /** + * @return the lrequisito + */ + public List getLrequisito() { + return lrequisito; + } + + /** + * @param lrequisito the lrequisito to set + */ + public void setLrequisito(List lrequisito) { + this.lrequisito = lrequisito; + } + + /** + * Entrega una lista de requisitos por tipo de tramite. + * + * @param ctipotramite + * @return + * @throws Exception + */ + public static List find(String ctipotramite) throws Exception { + RequisitoPorTipoTramiteController r = new RequisitoPorTipoTramiteController(); + r.addFilter("pk.ctipotramite", ctipotramite); + r.querydatabase(); + return r.getLrecord(); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/.svn/text-base/TipoTramiteController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/.svn/text-base/TipoTramiteController.java.svn-base new file mode 100644 index 0000000..8657650 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/.svn/text-base/TipoTramiteController.java.svn-base @@ -0,0 +1,142 @@ +package com.fp.frontend.controller.armas; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTipoTramite; + +/** + * Clase controladora del bean TarmTipoTramite. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class TipoTramiteController extends AbstractController { + + public TipoTramiteController() throws Exception { + super(TarmTipoTramite.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "TIPOTRAMITE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.nombre"); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Entrega una lista de tipos de tramite. + * + * @return List + */ + public static List find() { + try { + TipoTramiteController cc = new TipoTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/RequisitoPorTipoTramiteController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/RequisitoPorTipoTramiteController.java new file mode 100644 index 0000000..f65380f --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/RequisitoPorTipoTramiteController.java @@ -0,0 +1,189 @@ +package com.fp.frontend.controller.armas; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.RequisitoController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmRequisito; +import com.fp.persistence.parmas.param.TarmRequisitoPorTipoTramite; +import com.fp.persistence.parmas.param.TarmTipoTramite; + +/** + * Clase controladora del bean TarmRequisitoPorTipoTramite. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RequisitoPorTipoTramiteController extends AbstractController { + + List ltipotramite; + + List lrequisito; + + public RequisitoPorTipoTramiteController() throws Exception { + super(TarmRequisitoPorTipoTramite.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + ltipotramite = TipoTramiteController.find(); + lrequisito = RequisitoController.find(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "REQUISITOPORTIPOTRAMITE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + // record.getPk().setCtipotramite(super.getMfilters().get("pk.ctipotramite")); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.crequisito"); + // Subquery + SubQuery subquery = new SubQuery("TarmRequisito", "nombre", "nrequisito", "i.pk = t.pk.crequisito"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Fija la descripcion del perfil en el record + */ + public void setNombreReqisito() { + for (TarmRequisito r : lrequisito) { + if (r.getPk().compareTo(record.getPk().getCrequisito()) == 0) { + record.put("nrequisito", r.getNombre()); + } + } + } + + /** + * @return the ltipotramite + */ + public List getLtipotramite() { + return ltipotramite; + } + + /** + * @param ltipotramite the ltipotramite to set + */ + public void setLtipotramite(List ltipotramite) { + this.ltipotramite = ltipotramite; + } + + /** + * @return the lrequisito + */ + public List getLrequisito() { + return lrequisito; + } + + /** + * @param lrequisito the lrequisito to set + */ + public void setLrequisito(List lrequisito) { + this.lrequisito = lrequisito; + } + + /** + * Entrega una lista de requisitos por tipo de tramite. + * + * @param ctipotramite + * @return + * @throws Exception + */ + public static List find(String ctipotramite) throws Exception { + RequisitoPorTipoTramiteController r = new RequisitoPorTipoTramiteController(); + r.addFilter("pk.ctipotramite", ctipotramite); + r.querydatabase(); + return r.getLrecord(); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/TipoTramiteController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/TipoTramiteController.java new file mode 100644 index 0000000..540b135 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/TipoTramiteController.java @@ -0,0 +1,144 @@ +package com.fp.frontend.controller.armas; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTipoTramite; + +/** + * Clase controladora del bean TarmTipoTramite. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class TipoTramiteController extends AbstractController { + + public TipoTramiteController() throws Exception { + super(TarmTipoTramite.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "TIPOTRAMITE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.nombre"); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Entrega una lista de tipos de tramite. + * + * @return List + */ + public static List find() { + try { + TipoTramiteController cc = new TipoTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/entries new file mode 100644 index 0000000..5ef89cf --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/entries @@ -0,0 +1,266 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/armas/eval +svn://172.17.26.185/COMACO + + + +2021-12-08T19:17:47.063140Z +4656 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +RespuestasController.java +file + + + + +2022-07-28T03:39:53.595590Z +59fe2f1d649b70648231d46fa998fe81 +2015-04-20T12:00:26.947603Z +4042 +dlopez + + + + + + + + + + + + + + + + + + + + + +4496 + +Evaluacion.java +file + + + + +2022-07-28T03:39:53.595590Z +6e3833abfc41d888c5b61320c29f43ec +2014-12-16T10:19:33.564414Z +3532 +acevallos + + + + + + + + + + + + + + + + + + + + + +1317 + +DetallePreguntasController.java +file + + + + +2022-07-28T03:39:53.595590Z +c97f582b1300a6468ff6a9bce9272a12 +2014-09-19T06:04:56.930662Z +950 +acevallos + + + + + + + + + + + + + + + + + + + + + +3510 + +EvaluacionController.java +file + + + + +2022-07-28T03:39:53.596591Z +a854164ed604b1fbdfe074ba45ee081a +2021-12-08T19:17:47.063140Z +4656 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +45641 + +ConocimientoLovController.java +file + + + + +2022-07-28T03:39:53.596591Z +5b3e4e8be98ac8e10ed53d6f26ce2238 +2014-11-06T04:58:59.072653Z +2390 +acevallos + + + + + + + + + + + + + + + + + + + + + +12442 + +EvaluacionCompleta.java +file + + + + +2022-07-28T03:39:53.596591Z +7dcfcb9e69a0d32a15fa1291b2edc298 +2014-10-06T03:32:48.546712Z +1382 +acevallos + + + + + + + + + + + + + + + + + + + + + +582 + +TestConocimientosController.java +file + + + + +2022-07-28T03:39:53.596591Z +4f4c2b1b70c13d9c3581e14bfa3a6d7d +2015-07-09T07:54:47.328172Z +4183 +cpiedra + + + + + + + + + + + + + + + + + + + + + +19182 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/text-base/ConocimientoLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/text-base/ConocimientoLovController.java.svn-base new file mode 100644 index 0000000..d027b1f --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/text-base/ConocimientoLovController.java.svn-base @@ -0,0 +1,464 @@ +package com.fp.frontend.controller.armas.eval; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + + + +import org.primefaces.context.RequestContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.PreguntasParaEvaluacionesController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.eval.TarmPreguntas; +import com.fp.persistence.parmas.eval.TarmRespuestas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +/** + * Clase controladora del lov asociado con la evaluacion. + * + * @author Andres Cevallos. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ConocimientoLovController extends AbstractController { + + + + private static final long serialVersionUID = 1L; + /** + * Instancia de la clase TarmPreguntas + */ + private TarmPreguntas pregunta; + /** + * Boleano que comprueba si la pregunta fue respondida correctamente + */ + private Boolean isCorrecta; + /** + * Lista de Preguntas + */ + private List lpreguntas; + /** + * Lista de Respuestas + */ + private List lrespuestas; + /** + * Instancia de TcustpersonDetail, corresponde a la persona a ser + * evaluada + */ + private static TcustPersonDetail personevaluada; + /** + * Instancia de una Evaluacion, maneja una pregunta y sus respectivasrespuestas + * que son mostradas en pantalla + */ + private Evaluacion currentEvaluacion; + + /** + * Lista del objetos Evaluacion + */ + private List leva; + /** + * Tipo de Evaluacion + */ + private static String tipoeval; + /** + * Contador que Lleva el numero de pregunta en el que se encuentra + */ + private int numeropregunta; + /** + * Maneja la ultima pregunta + */ + private boolean finalizar; + /** + * Fecha Actual del Sistema + */ + private Date fecha; + /** + * Objeto que sera retornado conteniendo todas las preguntas. + */ + EvaluacionCompleta evaluacionCompleta; + /** + * Tipo de persona referenciada en el catalogo + */ + private TgeneCatalogDetail tipopersona; + + /** + * Tipo de evaluacion referenciado en el catalogo + */ + private TgeneCatalogDetail tipoevaluacion; + /** + * Numero de preguntas que tendra la evaluacion + */ + int npreguntas=4; + private Boolean errorrend=false; + + private String error; + public ConocimientoLovController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + lpreguntas = new ArrayList(); + this.beanalias = "EVALUACIONLOV"; + tipoevaluacion = new TgeneCatalogDetail(); + TgeneParameters parametro= ParametersController.find("NUMEROPREGUNTAS", "1"); + + try{ + npreguntas=parametro.getNumbervalue().intValue(); + tipoevaluacion=CatalogDetailController.findxCodigoCodcatalogo(tipoeval, "TIPOEVALUACION"); + setTipopersona(CatalogDetailController.findxCodigoCodcatalogo(personevaluada.getPersontypecatalog(), personevaluada.getPersontypecatalogcode())); + lpreguntas.addAll( PreguntasParaEvaluacionesController.findxPregunta(tipopersona.getPk().getCatalog(),"CONOCIMIENTO")); + } + catch(Exception e){ + MessageHelper.setMessageError("PROBLEMAS DE PARAMETRIZACION. CONSULTE AL EVALUADOR"); + error="PROBLEMAS DE PARAMETRIZACION. CONSULTE AL EVALUADOR"; + errorrend=true; + System.out.println("Error"); + return; + } + + + + numeropregunta=0; + finalizar=false; + + fecha=Calendar.getInstance().getTime(); + evaluacionCompleta=new EvaluacionCompleta(); + evaluacionCompleta.inicializa(); + construirEvaluacion(); + currentEvaluacion=leva.get(numeropregunta); + comprobarpreguntafinal(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Construye la evaluacion en base a las preguntas que se tengan catalogadas + */ + public void construirEvaluacion(){ + + leva = new ArrayList(); + + + int i=0; + while(i> params, TcustPersonDetail persona,String catalogo) { + personevaluada=persona; + tipoeval=catalogo; + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 350); + options.put(EnumLovOption.WIDTH.getLabel(), 900); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + options.put("closable", false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/conocimientoLov.xhtml", options, params); + } + + /** + * Crea una instancia y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + isCorrecta = false; +// record.setCpregunta(pregunta.getPk()); + } + + /** + * Actualiza la lista de registros a grabar + * + * @throws Exception + */ + public void update() throws Exception { + //if(record.getEscorrecta()==null){ + // record.setEscorrecta("N"); + // } + //super.update(); + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public TarmPreguntas getPregunta() { + return pregunta; + } + + public void setPregunta(TarmPreguntas pregunta) { + this.pregunta = pregunta; + } + + public Boolean getIsCorrecta() { + return isCorrecta; + } + + public void setIsCorrecta(Boolean isCorrecta) { + this.isCorrecta = isCorrecta; + } + + public void onChangeEsCorrecta() { + /* if (isCorrecta) { + record.setEscorrecta("Y"); + } else { + record.setEscorrecta("N"); + }*/ + } + + public List getLpreguntas() { + return lpreguntas; + } + + public void setLpreguntas(List lpreguntas) { + this.lpreguntas = lpreguntas; + } + + public List getLrespuestas() { + return lrespuestas; + } + + public void setLrespuestas(List lrespuestas) { + this.lrespuestas = lrespuestas; + } + + public List getLeva() { + return leva; + } + + public void setLeva(List leva) { + this.leva = leva; + } + + public TcustPersonDetail getPersonevaluada() { + return personevaluada; + } + + public void setPersonevaluada(TcustPersonDetail personevaluada) { + this.personevaluada = personevaluada; + } + + public TgeneCatalogDetail getTipopersona() { + return tipopersona; + } + + public void setTipopersona(TgeneCatalogDetail tipopersona) { + this.tipopersona = tipopersona; + } + + + + public TgeneCatalogDetail getTipoevaluacion() { + return tipoevaluacion; + } + + public void setTipoevaluacion(TgeneCatalogDetail tipoevaluacion) { + this.tipoevaluacion = tipoevaluacion; + } + + public Evaluacion getCurrentEvaluacion() { + return currentEvaluacion; + } + + public void setCurrentEvaluacion(Evaluacion currentEvaluacion) { + this.currentEvaluacion = currentEvaluacion; + } + + public boolean isFinalizar() { + return finalizar; + } + + public void setFinalizar(boolean finalizar) { + this.finalizar = finalizar; + } + + + public int getNumeropregunta() { + return numeropregunta; + } + + public void setNumeropregunta(int numeropregunta) { + this.numeropregunta = numeropregunta; + } + + public Date getFecha() { + return fecha; + } + + public void setFecha(Date fecha) { + this.fecha = fecha; + } + + public String getError() { + return error; + } + + public void setError(String error) { + this.error = error; + } + + public Boolean getErrorrend() { + return errorrend; + } + + public void setErrorrend(Boolean errorrend) { + this.errorrend = errorrend; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/text-base/DetallePreguntasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/text-base/DetallePreguntasController.java.svn-base new file mode 100644 index 0000000..02ae0cf --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/text-base/DetallePreguntasController.java.svn-base @@ -0,0 +1,127 @@ +package com.fp.frontend.controller.armas.eval; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; + +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.eval.TarmDetallePreguntas; + + + +/** + * Clase controladora del bean TarmDetallePreguntas. + * + * @author Andres Cevallos. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class DetallePreguntasController extends AbstractController { + + /** + * Constructor + * @throws Exception + */ + public DetallePreguntasController() throws Exception { + super(TarmDetallePreguntas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "DETALLEPREGUNTAS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * M´todo para generar un reporte + * + * @throws Exception + */ + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/text-base/Evaluacion.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/text-base/Evaluacion.java.svn-base new file mode 100644 index 0000000..c2def8b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/text-base/Evaluacion.java.svn-base @@ -0,0 +1,65 @@ +package com.fp.frontend.controller.armas.eval; + +import java.util.List; + +import com.fp.persistence.parmas.eval.TarmPreguntas; +import com.fp.persistence.parmas.eval.TarmRespuestas; + +/** + * Objeto que encapsula las preguntas y las respuestas + * @author Andres Cevallos + * + */ +public class Evaluacion { + + /** + * Instancia de TarmPreguntas + */ + private TarmPreguntas pregunta; + /** + * Lista de Respuestas asociadas a la pregunta + */ + private List respuesta; + /** + * Codigo de respuesta seleccionada + */ + + private Integer codigorespuesta; + /** + * Respuesta seleccionada + */ + private TarmRespuestas respues; + + public TarmPreguntas getPregunta() { + return pregunta; + } + + public void setPregunta(TarmPreguntas pregunta) { + this.pregunta = pregunta; + } + + public List getRespuesta() { + return respuesta; + } + + public void setRespuesta(List respuesta) { + this.respuesta = respuesta; + } + + public Integer getCodigorespuesta() { + return codigorespuesta; + } + + public void setCodigorespuesta(Integer codigorespuesta) { + this.codigorespuesta = codigorespuesta; + } + + public TarmRespuestas getRespues() { + return respues; + } + + public void setRespues(TarmRespuestas respues) { + this.respues = respues; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/text-base/EvaluacionCompleta.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/text-base/EvaluacionCompleta.java.svn-base new file mode 100644 index 0000000..cda8e00 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/text-base/EvaluacionCompleta.java.svn-base @@ -0,0 +1,29 @@ +package com.fp.frontend.controller.armas.eval; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Andres Cevallos + *Contiene la lista de respuestas y preguntas + */ +public class EvaluacionCompleta { + + /** + *Contiene una lista de evaluaciones + */ + private List levaluacion; + + public void inicializa(){ + levaluacion = new ArrayList(); + } + + public List getLevaluacion() { + return levaluacion; + } + + public void setLevaluacion(List levaluacion) { + this.levaluacion = levaluacion; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/text-base/EvaluacionController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/text-base/EvaluacionController.java.svn-base new file mode 100644 index 0000000..2de34f3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/text-base/EvaluacionController.java.svn-base @@ -0,0 +1,1258 @@ +package com.fp.frontend.controller.armas.eval; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.SelectEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.GuardiasController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.frontend.utility.ValidateIdentification; +import com.fp.frontend.webservices.snap.cedula.ClienteCedula; +import com.fp.frontend.webservices.snap.ruc.ClienteRUC; +import com.fp.persistence.parmas.eval.TarmEvaluacion; +import com.fp.persistence.parmas.soli.TarmGuardias; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +import ec.gob.registrocivil.consultacedula.Cedula; +import ec.gov.sri.wsconsultacontribuyente.Contribuyente; + + +/** + * Clase controladora del bean TarmEvaluacion. + * + * @author Andres Cevallos. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class EvaluacionController extends AbstractController { + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + @ManagedProperty(value = "#{guardiasController}") + private GuardiasController guardiasController; +// private TcustPersonDetail evaluado; + private Boolean aprobado; + TgeneCatalogDetail lTipoPersona; + private TgeneCatalogDetail centromed; + public String centro; + public List lcentro; +// private List lTipoEvaluacion; + TgeneCatalogDetail tipoEvaluacion; + private TcustPersonDetail empresa; + private UploadedFile file; + private Date fecha; + private Date fechaactual; + private Date fechadeposito; + private TcustPersonDetail personafiltro; + private TcustPersonDetail personafiltroSNAP; + private List eliminar; + private boolean subio=false; + private String deposito; + private String papeleta; + private Boolean centroMedico; + private String nombreArchivo; + private Boolean isGuardia; + private String tipoTest; + + private Boolean isPasaporte; + /** + * codigo del ruc + */ + private String codigoRuc; + /** + * codigo del ruc + */ + private String codigoCedula; + /** + * codigo del pasaporte + */ + private String codigoPasaporte; + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List tipoDocumentoLst; + + /** + * Atributo para setear el psicologo responsable + */ + private TcustPersonDetail tcustPersonDetailPsicologo; + + /** + * Constructor + * @throws Exception + */ + public EvaluacionController() throws Exception { + super(TarmEvaluacion.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + querydatabase(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + eliminar=new ArrayList(); + this.beanalias = "EVALUACION"; + this.tipoTest = "PSICOLOGICA"; + aprobado=false; + fecha=new Date(); + codigoRuc=codigos("CODIGO.RUC"); + codigoCedula=codigos("CODIGO.CEDULA"); + codigoPasaporte=codigos("CODIGO.PASAPORTE"); + tipoDocumentoLst = CatalogDetailController.find("IDENTIFICATION"); +// lTipoEvaluacion=CatalogDetailController.find("TIPOEVALUACION"); + tipoEvaluacion=CatalogDetailController.findCatalogo("TIPOEVALUACION", "PSICOLOGICA"); + lcentro=CatalogDetailController.find("CENTROMEDICO"); + setFechaactual(new Date()); + centroMedico=Boolean.FALSE; + + // CARGAR INFORMACION DEL USUARIO LOGUEADO DEL SNAP + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + personafiltro = PersonLovController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + lTipoPersona=CatalogDetailController.findxCodigoCodcatalogo(personafiltro.getPersontypecatalog(), personafiltro.getPersontypecatalogcode()); + super.create(); + this.record.setPersoncode(personafiltro.getPk().getPersoncode()); + this.record.getModifiedData().put("nombre", personafiltro.getName()); + this.record.getModifiedData().put("identificacion", personafiltro.getIdentification()); + this.record.getModifiedData().put("tipopersona", lTipoPersona.getDescription()); + + + + if(personafiltro.getIdentification() == null || personafiltro.getIdentification() == null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselacedula")); + return; + } + + if(personafiltro.getIdentificationcatalog().equals("CED")){ + // valido validez CEDULA + if(!ValidateIdentification.cedula(personafiltro.getIdentification())){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + personafiltroSNAP=buscarPersonaSnap(personafiltro.getIdentification(),personafiltro.getIdentificationcatalog()); + + }else if(personafiltro.getIdentificationcatalog().equals("RUC")){ + // valido validez RUC + if(!ValidateIdentification.ruc(personafiltro.getIdentification())){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + personafiltroSNAP=buscarPersonaSnap(personafiltro.getIdentification(),personafiltro.getIdentificationcatalog()); + } + else{ + // PASAPORTE + personafiltroSNAP = new TcustPersonDetail(); + personafiltroSNAP.setName(personafiltro.getName()); + personafiltroSNAP.setIdentification(personafiltro.getIdentification()); + personafiltroSNAP.setIdentificationcatalog("PAS"); + personafiltroSNAP.setIdentificationcatalogcode("IDENTIFICATION"); + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para obtener los codigos + */ + public String codigos(String parametro){ + TgeneParameters tgeneParameters= ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + /** + * Método para obtener los codigos + */ + public Integer valorInt(String parametro){ + TgeneParameters tgeneParameters= ParametersController.find(parametro, "1"); + return tgeneParameters.getNumbervalue().intValue(); + } + + public String getCentro() { + return centro; + } + + public void setCentro(String centro) { + this.centro = centro; + } + + public List getLcentro() { + return lcentro; + } + + public void setLcentro(List lcentro) { + this.lcentro = lcentro; + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.fecha,t.tipoevaluacion"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + SubQuery snombre= new SubQuery + ("TcustPersonDetail", "name", "nombre", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery snumerodocumento= new SubQuery + ("TcustPersonDetail", "identification", "identificacion", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery persontipe= new SubQuery + ("TcustPersonDetail", "persontypecatalog", "tipopersona", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery persontipecode= new SubQuery + ("TcustPersonDetail", "persontypecatalogcode", "tipopersonacode", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery identificationcatalogcode= new SubQuery + ("TcustPersonDetail", "identificationcatalogcode", "identificationcatalogcode", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery tipoevaluacion = new SubQuery + ("TgeneCatalogDetail", "description", "tipoevaluaciondesc", "i.pk.catalog=t.tipoevaluacion and i.pk.catalogcode=t.tipoevaluacioncodigo"); + + + Filter filtrofecha=new Filter(); +// filtrofecha.setSql("t.fecha=(select max(te.fecha) from TarmEvaluacion te where te.personcode=t.personcode and te.tipoevaluacion=t.tipoevaluacion)"); + filtrofecha.setSql("t.personcode="+personafiltro.getPk().getPersoncode().toString()+" and t.tipoevaluacion='"+tipoTest+"'"); // + dto.addFiltro(filtrofecha); + dto.addSubQuery(snombre); + dto.addSubQuery(snumerodocumento); + dto.addSubQuery(persontipe); + dto.addSubQuery(identificationcatalogcode); + dto.addSubQuery(persontipecode); + dto.addSubQuery(tipoevaluacion); + // dto.addSubQuery(maxdate); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + completar(); + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void cargarDeposito(){ + centromed = CatalogDetailController.findxCodigoCodcatalogo(centro, "CENTROMEDICO"); + this.record.setCentromedico(centro); + TgeneParameters parameters= ParametersController.find("CODIGO.OTROS", "1"); + centroMedico=Boolean.FALSE; + if(centro.equals(parameters.getTextvalue())){ + fechadeposito= new Date(); + record.setNopapeleta(null); + centroMedico=Boolean.TRUE; + } + } + /** + * Conpleta la informacion de la Evaluacion + */ + @SuppressWarnings("deprecation") + public void completar(){ + for(int i=0;i< this.lrecord.size();i++){ + try{ + if(lrecord.get(i).getModifiedData().get("tipoevaluaciondesc").toString().equals("EVALUACION DE CONOCIMIENTOS")) + this.lrecord.get(i).getModifiedData().put("eliminar", "true"); + else if(fecha.getDay()!=lrecord.get(i).getFecha().getDay() || fecha.getMonth()!=lrecord.get(i).getFecha().getMonth() || fecha.getYear()!=lrecord.get(i).getFecha().getYear()) + this.lrecord.get(i).getModifiedData().put("eliminar", "true"); + //else if(lrecord.get(i)) + else + this.lrecord.get(i).getModifiedData().put("eliminar", "false"); + + + + TgeneCatalogDetail tipo = CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("tipopersona").toString(), this.lrecord.get(i).getModifiedData().get("tipopersonacode").toString()); + this.lrecord.get(i).getModifiedData().put("tipopersonadesc", tipo.getDescription()); + + if(lrecord.get(i).getFechaexpiracion()!=null && lrecord.get(i).getFechaexpiracion().after(new Date())){ + this.lrecord.get(i).getModifiedData().put("estadovig", "VIGENTE"); + }else{ + this.lrecord.get(i).getModifiedData().put("estadovig", "NO VIGENTE"); + } + } + catch (Exception e){ + e.printStackTrace(); + } + } + } + + /** + * Ruta para la evaluacion de conocimientos + * @param eva + * @return + */ + public String getRutaDocumentoPrueba(TarmEvaluacion eva) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta = new StringBuilder("cm:Pruebas"); + ruta = ruta.append("/cm:ID-").append(eva.modifiedData().get("identificacion").toString()); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + return ruta.toString(); + } + + /** + * Valida la fecha + * @param fech + */ + public void validarfecha(Date fech){ + if(fech.getTime()>(new Date()).getTime()){ + fecha=new Date(); + } + } + + /** + * Evento el cual carga los archivos + * @param event + */ + public void upload(FileUploadEvent event) { + + file = event.getFile(); + subio=true; + nombreArchivo=Utilidades.recorteNombre(file.getFileName()); + + } + /** + * Crea un registro de actualizacion + */ + @SuppressWarnings("deprecation") + public void actualizar(){ + + try { + if(personafiltro==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_persona")); + return; + } + +// if(empresa==null){ +// MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_persona")); +// return; +// } + + if(file==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_debesubir")); + return; + } + + Date horas=new Date(); + fecha.setHours(horas.getHours()); + fecha.setMinutes(horas.getMinutes()); + fecha.setSeconds(horas.getSeconds()); + this.record.getModifiedData().put("file", file); + String xPathLocation= getRutaDocumentoPrueba(record); + this.record.setTipoevaluacion("PSICOLOGICA"); + this.record.setTipoevaluacioncodigo("TIPOEVALUACION"); + this.record.setTipdoccodepsicologo("IDENTIFICATION"); + this.record.setInformexpath(xPathLocation + "/cm:Pruebas/cm:"+"Psicologico.pdf"); + this.record.setFecha(new java.sql.Timestamp(new Date().getTime()) ); + aprobar(); + // Para validar el estado del guardia + Integer numTestPsicologicosAPB = EvaluacionController.findEvaluacionesAprobadasVigentes(record.getPersoncode().toString(), "PSICOLOGICA"); + Integer numTestConocimientososAPB = EvaluacionController.findEvaluacionesAprobadasVigentes(record.getPersoncode().toString(), "CONOCIMIENTO"); + if(this.record.getResultado().equalsIgnoreCase("APROBADO")){ + // En caso de que el actual test sea aprobado sumo uno a los antes aprobados + numTestPsicologicosAPB++; + Date fechaexpiracion=new Date(); + //fechaexpiracion.setYear(fechaexpiracion.getYear()+2); + Integer month= valorInt("VIGENCIA_MES_EVAL"); + fechaexpiracion.setMonth(fechaexpiracion.getMonth()+month); + this.record.setFechaexpiracion(new java.sql.Date(fechaexpiracion.getTime())); + } + this.record.setCentromedico(centromed.getPk().getCatalog()); + if(empresa!=null && empresa.getPk()!=null && empresa.getPk().getPersoncode()!=null){ + this.record.setEmpresapersoncode(empresa.getPk().getPersoncode()); + } + this.record.setCentromedicocode("CENTROMEDICO"); + this.record.setFechadeposito(new java.sql.Date(fechadeposito.getTime())); + this.record.getModifiedData().put("tipopersonadesc",lTipoPersona.getDescription()); + this.record.getModifiedData().put("tipoevaluaciondesc",CatalogDetailController.findxCodigoCodcatalogo(this.record.getTipoevaluacion(), this.record.getTipoevaluacioncodigo()).getDescription()); + TarmEvaluacion oeva=EvaluacionController.findVigencia(record.getPersoncode().toString(), record.getTipoevaluacion()); + + if(oeva==null || record.getFecha().before(oeva.getFecha())){ + record.setVigente("N"); + update(); + TarmGuardias guardia; + guardia=GuardiasController.findxcguardia(personafiltro.getPk().getPersoncode().toString()); + + if(guardia!=null){ + guardiasController.setRecord(guardia); + guardiasController.getRecord().setIsnew(false); + } + else{ + guardiasController.create(); + } + if(empresa!=null && empresa.getPk()!=null && empresa.getPk().getPersoncode()!=null){ + guardiasController.getRecord().setCempresa(empresa.getPk().getPersoncode()); + } + + guardiasController.getRecord().setPk(personafiltro.getPk().getPersoncode()); + + if(numTestPsicologicosAPB<=0 || numTestConocimientososAPB <=0 ){ + guardiasController.getRecord().setEstado("NAPT"); + } + else{ + guardiasController.getRecord().setEstado("APT"); + } + guardiasController.update(); + + return; + } + record.setVigente("Y"); + update(); + TarmGuardias guardia; + guardia=GuardiasController.findxcguardia(personafiltro.getPk().getPersoncode().toString()); + + if(guardia!=null){ + guardiasController.setRecord(guardia); + guardiasController.getRecord().setIsnew(false); + } + else{ + guardiasController.create(); + } + if(empresa!=null && empresa.getPk()!=null && empresa.getPk().getPersoncode()!=null){ + guardiasController.getRecord().setCempresa(empresa.getPk().getPersoncode()); + } + guardiasController.getRecord().setPk(personafiltro.getPk().getPersoncode()); + if(numTestPsicologicosAPB<=0 || numTestConocimientososAPB <=0 ){ + guardiasController.getRecord().setEstado("NAPT"); + } + else{ + guardiasController.getRecord().setEstado("APT"); + } + guardiasController.update(); + + oeva.setVigente("N"); + oeva.setIsnew(false); + this.record=oeva; + update(); + }catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + + } + + + public GuardiasController getGuardiasController() { + return guardiasController; + } + + public void setGuardiasController(GuardiasController guardiasController) { + this.guardiasController = guardiasController; + } + + /** + * Abre el lov de persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + +// /** +// * Retorna y carga datos de la persona +// * @param event +// * @throws Exception +// */ +// public void onReturnPersonLov(SelectEvent event) throws Exception { +//// setEvaluado( (TcustPersonDetail) event.getObject()); +// lTipoPersona=CatalogDetailController.findxCodigoCodcatalogo(personafiltro.getPersontypecatalog(), personafiltro.getPersontypecatalogcode()); +// this.record.setPersoncode(personafiltro.getPk().getPersoncode()); +// this.record.getModifiedData().put("nombre", personafiltro.getName()); +// this.record.getModifiedData().put("identificacion", personafiltro.getIdentification()); +// try{ +// this.record.getModifiedData().put("tipopersona", lTipoPersona.getDescription()); +// } +// catch(Exception e){ +// e.printStackTrace(); +// } +// } + + public void onRetrunPersonLovEmpresa(SelectEvent event) throws Exception{ + setEmpresa((TcustPersonDetail) event.getObject()); + this.record.setEmpresapersoncode(empresa.getPk().getPersoncode()); + } +// /** +// * Regresa una persona para guardarla en un nuevo registro de evaluacio psicologica +// * @param event +// * @throws Exceptionq +// */ +// public void onReturnPersonLov2(SelectEvent event) throws Exception{ +// personafiltro=(TcustPersonDetail) event.getObject(); +// this.addFilter("personcode", personafiltro.getPk().getPersoncode().toString()); +// } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + + /** + * Metodo de guardado de la evaluacion. Ademas sube el archivo alfresco seleccionado + */ + @Override + public void save(){ + try { + for(int i=0;i msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + DtoSave dtoguardias = this.guardiasController.getDtoSave(true); + msave.put(guardiasController.getBeanalias(), dtoguardias); // adicionar metadata de mantenimiento para cada tabla. + dtoguardias.setPosition(2); + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + postconstruct(); + } + + /** + * Metodo el cual borra un registro. Revisa si el registro coincide con la fecha maxima. + */ + @SuppressWarnings("deprecation") + @Override + public void remove(){ + fecha=new Date(); + if(fecha.getDay()==record.getFecha().getDay() && fecha.getMonth()==record.getFecha().getMonth() && fecha.getYear()==record.getFecha().getYear()){ + try { + eliminar.add(record.getInformexpath()); + super.remove(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + else{ + MessageHelper.setMessageError("NO SE PUEDE BORRAR ESTE REGISTRO"); + } + } + /** + * aprueba la o reprueba la evaluacion + */ + public void aprobar(){ + if(aprobado){ + this.record.setResultado("APROBADO"); + this.record.setResultadocodigo("RESULTADO"); + } + else{ + this.record.setResultado("REPROBADO"); + this.record.setResultadocodigo("RESULTADO"); + } + } + + /** + * find para encontrar los registros anteriores + */ + public static Integer findIntentos(String personcode, String tipoevaluacion) { + try { + EvaluacionController cc = new EvaluacionController(); + cc.init(); + cc.recperpage = 300000; + cc.addFilter("personcode", personcode); + cc.addFilter("tipoevaluacion",tipoevaluacion); + cc.querydata(personcode,tipoevaluacion); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.size(); + } + return 0; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return 0; + } + + } + + /** + * find para encontrar evaluaciones aprobadas anteriores en estado vigente + */ + public static Integer findEvaluacionesAprobadasVigentes(String personcode, String tipoevaluacion) { + try { + EvaluacionController cc = new EvaluacionController(); + cc.init(); + cc.recperpage = 300000; + cc.addFilter("resultado", "APROBADO"); + cc.addFilter("personcode", personcode); + cc.addFilter("tipoevaluacion",tipoevaluacion); + cc.querydatabaseVigentes(personcode,tipoevaluacion); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.size(); + } + return 0; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return 0; + } + + } + + /** + * find para encontrar los registros anteriores + */ + public static Integer findIntentosReprobados(String personcode, String tipoevaluacion) { + try { + EvaluacionController cc = new EvaluacionController(); + cc.init(); + cc.recperpage = 300000; + cc.addFilter("resultado", "REPROBADO"); + cc.addFilter("personcode", personcode); + cc.addFilter("tipoevaluacion",tipoevaluacion); + cc.querydata(personcode,tipoevaluacion); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.size(); + } + return 0; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return 0; + } + + } + +// /* (non-Javadoc) +// * @see com.fp.frontend.controller.AbstractController#create() +// */ +// @Override +// public void create(){ +// limpiar(); +// try { +// super.create(); +// } catch (Exception e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// } + + + /** + * Limpia los registros anteriores + */ + public void limpiar(){ + personafiltro=null; + file=null; + lTipoPersona=null; + subio=false; + fechadeposito=new Date(); + empresa=new TcustPersonDetail(); + deposito=""; + nombreArchivo=null; + init(); + } + + + /** + * Find para encontrar la fecha en la que debe rendir la prueba + * @param personcode + * @param tipoevaluacion + * @return + */ + public static TarmEvaluacion findFecha(String personcode, String tipoevaluacion) { + try { + EvaluacionController cc = new EvaluacionController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("personcode", personcode); + cc.addFilter("tipoevaluacion",tipoevaluacion); + cc.querydat(personcode,tipoevaluacion); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + + /** + * find para encontrar evaluaciones aprobadas anteriores en estado vigente + */ + public static TarmEvaluacion findEvaluacionesVigentes(String personcode, String tipoevaluacion) { + try { + EvaluacionController cc = new EvaluacionController(); + cc.init(); + cc.recperpage = 100; + cc.addFilter("resultado", "APROBADO"); + cc.addFilter("personcode", personcode); + cc.addFilter("tipoevaluacion",tipoevaluacion); + cc.querydataVigentes(personcode,tipoevaluacion); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public void querydataVigentes(String personcode, String tipoevaluacion) { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.fecha desc"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Encuentra la evaluacion vigente + * @param personcode + * @param tipoevaluacion + * @return + */ + public static TarmEvaluacion findVigencia(String personcode, String tipoevaluacion) { + try { + EvaluacionController cc = new EvaluacionController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("personcode", personcode); + cc.addFilter("tipoevaluacion",tipoevaluacion); + cc.addFilter("vigente","Y"); + cc.querydat(personcode,tipoevaluacion); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmEvaluacion find(String personcode, String tipoevaluacion) { + try { + EvaluacionController cc = new EvaluacionController(); + cc.init(); + cc.recperpage = 300000; + cc.addFilter("personcode", personcode); + cc.addFilter("tipoevaluacion",tipoevaluacion); + cc.querydat(personcode,tipoevaluacion); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + if(cc.lrecord.get(0).getFechaexpiracion()!=null && cc.lrecord.get(0).getFechaexpiracion().after(new Date())){ + return cc.lrecord.get(0); + }else{ + return null; + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + /** + * consulta en la cual se busca la fecha proxima para rendir la evaluacion + * @param personcode + * @param tipoevaluacion + */ + public void querydat(String personcode, String tipoevaluacion) { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.fechapreox"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + Filter sql= new Filter(); + sql.setSql("t.fecha=(select max(fecha) from TarmEvaluacion where personcode='"+personcode+"' and tipoevaluacion='"+tipoevaluacion+"')"); + dto.addFiltro(sql); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + public void queryByTipoEvaluacion(String personcode, String tipoevaluacion) { + try { + Request request = this.callerhelper.getRequest(); + this.lrecord = new ArrayList<>(); + DtoQuery dto = super.getDtoQuery(true); + this.recperpage = 300000; + SubQuery snombre= new SubQuery + ("TcustPersonDetail", "name", "nombre", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery snumerodocumento= new SubQuery + ("TcustPersonDetail", "identification", "identificacion", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery persontipe= new SubQuery + ("TcustPersonDetail", "persontypecatalog", "tipopersona", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery persontipecode= new SubQuery + ("TcustPersonDetail", "persontypecatalogcode", "tipopersonacode", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery identificationcatalogcode= new SubQuery + ("TcustPersonDetail", "identificationcatalogcode", "identificationcatalogcode", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery tipoevaluacionSQ = new SubQuery + ("TgeneCatalogDetail", "description", "tipoevaluaciondesc", "i.pk.catalog=t.tipoevaluacion and i.pk.catalogcode=t.tipoevaluacioncodigo"); + Filter filtropersona=new Filter();// + filtropersona.setSql("t.personcode="+personcode+" and t.tipoevaluacion='"+tipoevaluacion+"' "); + dto.addFiltro(filtropersona); + dto.addSubQuery(snombre); + dto.addSubQuery(snumerodocumento); + dto.addSubQuery(persontipe); + dto.addSubQuery(identificationcatalogcode); + dto.addSubQuery(persontipecode); + dto.addSubQuery(tipoevaluacionSQ); +// this.getMfilters().put("t.personcode", personcode); +// this.getMfilters().put("t.tipoevaluacion", tipoevaluacion); + dto.setOrderby("t.fechaexpiracion desc"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + completar(); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + public void querydata(String personcode, String tipoevaluacion) { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.fechapreox"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + public void querydatabaseVigentes(String personcode, String tipoevaluacion) { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + Filter filtro = new Filter(); + filtro.setSql("t.fechaexpiracion>=sysdate"); + dto.addFiltro(filtro); + dto.setOrderby("t.fechapreox"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Query hacia la base de datos + */ + public void querybase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.fecha"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void onChangeTipoDocumento(){ + if(this.getRecord().getTipdocpsicologo().equalsIgnoreCase("CED")|| this.getRecord().getTipdocpsicologo().equalsIgnoreCase("RUC")){ + this.setIsPasaporte(Boolean.FALSE); + this.getRecord().setNumdocpsicologo(null); + this.getRecord().setPsicologoresponsable(null); + }else{ + this.setIsPasaporte(Boolean.TRUE); + } + } + + /** + * Método que valida la persona portadora del arma o explosivo + * en las tablas de maia y en la snap + * + */ + public void validarPsicologoResponsable(){ + if(this.getRecord().getNumdocpsicologo() ==null || this.getRecord().getTipdocpsicologo() ==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselacedula")); + return; + } + if(this.getRecord().getTipdocpsicologo().equals(codigoCedula)){ + // SI ES CEDULA + if(!ValidateIdentification.cedula(this.getRecord().getNumdocpsicologo())){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en la SNAP + tcustPersonDetailPsicologo=buscarPersonaSnap(this.getRecord().getNumdocpsicologo(),this.getRecord().getTipdocpsicologo()); + }else if(this.getRecord().getTipdocpsicologo().equals(codigoRuc)){ + // SI ES RUC + if(!ValidateIdentification.ruc(this.getRecord().getNumdocpsicologo())){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + // envia a buscar en la snap + tcustPersonDetailPsicologo=buscarPersonaSnap(this.getRecord().getNumdocpsicologo(),this.getRecord().getTipdocpsicologo()); + } + if(tcustPersonDetailPsicologo!=null){ + this.record.setPsicologoresponsable(tcustPersonDetailPsicologo.getName()); + } + else if(this.getRecord().getTipdocpsicologo().equals(codigoCedula)||this.getRecord().getTipdocpsicologo().equals(codigoRuc)){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_psicologoinvalido")); + this.record.setPsicologoresponsable(null); + } + } + + /** + * Método para buscar a la persona en la snap + * @param documento + */ + public TcustPersonDetail buscarPersonaSnap(String documento,String tipoDocumento){ + if(tipoDocumento.equals("CED")){ + Cedula cedula= ClienteCedula.obtenerCedula(documento); + if(cedula!=null){ + TcustPersonDetail detail= new TcustPersonDetail(); + detail.setName(cedula.getNombre()); + detail.setIdentification(cedula.getCedula()); + detail.setIdentificationcatalog("CED"); + detail.setIdentificationcatalogcode("IDENTIFICATION"); + return detail; + }else{ + return null; + } + }else { + Contribuyente contribuyente= ClienteRUC.obtenerRUC(documento); + if(contribuyente!=null){ + TcustPersonDetail detail= new TcustPersonDetail(); + detail.setName(contribuyente.getRazonSocial()); + detail.setIdentification(contribuyente.getNumeroRuc()); + detail.setIdentificationcatalog("RUC"); + detail.setIdentificationcatalogcode("IDENTIFICATION"); + return detail; + }else{ + return null; + } + } + } + + public Boolean getAprobado() { + return aprobado; + } + + public void setAprobado(Boolean aprobado) { + this.aprobado = aprobado; + } + + + public TgeneCatalogDetail getlTipoPersona() { + return lTipoPersona; + } + + public void setlTipoPersona(TgeneCatalogDetail lTipoPersona) { + this.lTipoPersona = lTipoPersona; + } + + public UploadedFile getFile() { + return file; + } + + public void setFile(UploadedFile file) { + this.file = file; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public Date getFecha() { + return fecha; + } + + public void setFecha(Date fecha) { + this.fecha = fecha; + } + + public TcustPersonDetail getPersonafiltro() { + return personafiltro; + } + + public void setPersonafiltro(TcustPersonDetail personafiltro) { + this.personafiltro = personafiltro; + } + + public Date getFechaactual() { + return fechaactual; + } + + public void setFechaactual(Date fechaactual) { + this.fechaactual = fechaactual; + } + + public List getEliminar() { + return eliminar; + } + + public void setEliminar(List eliminar) { + this.eliminar = eliminar; + } + + public TgeneCatalogDetail getTipoEvaluacion() { + return tipoEvaluacion; + } + + public void setTipoEvaluacion(TgeneCatalogDetail tipoEvaluacion) { + this.tipoEvaluacion = tipoEvaluacion; + } + + public boolean isSubio() { + return subio; + } + + public void setSubio(boolean subio) { + this.subio = subio; + } + + public TcustPersonDetail getEmpresa() { + return empresa; + } + + public void setEmpresa(TcustPersonDetail empresa) { + this.empresa = empresa; + } + + public Date getFechadeposito() { + return fechadeposito; + } + + public void setFechadeposito(Date fechadeposito) { + this.fechadeposito = fechadeposito; + } + + public String getDeposito() { + return deposito; + } + + public void setDeposito(String deposito) { + this.deposito = deposito; + } + + public TgeneCatalogDetail getCentromed() { + return centromed; + } + + public void setCentromed(TgeneCatalogDetail centromed) { + this.centromed = centromed; + } + + public String getPapeleta() { + return papeleta; + } + + public void setPapeleta(String papeleta) { + this.papeleta = papeleta; + } + + public Boolean getCentroMedico() { + return centroMedico; + } + + public void setCentroMedico(Boolean centroMedico) { + this.centroMedico = centroMedico; + } + + public String getNombreArchivo() { + return nombreArchivo; + } + + public void setNombreArchivo(String nombreArchivo) { + this.nombreArchivo = nombreArchivo; + } + + public Boolean getIsGuardia() { + return isGuardia; + } + + public void setIsGuardia(Boolean isGuardia) { + this.isGuardia = isGuardia; + } + + public TcustPersonDetail getPersonafiltroSNAP() { + return personafiltroSNAP; + } + + public void setPersonafiltroSNAP(TcustPersonDetail personafiltroSNAP) { + this.personafiltroSNAP = personafiltroSNAP; + } + + public String getTipoTest() { + return tipoTest; + } + + public void setTipoTest(String tipoTest) { + this.tipoTest = tipoTest; + } + + public List getTipoDocumentoLst() { + return tipoDocumentoLst; + } + + public void setTipoDocumentoLst(List tipoDocumentoLst) { + this.tipoDocumentoLst = tipoDocumentoLst; + } + + public TcustPersonDetail getTcustPersonDetailPsicologo() { + return tcustPersonDetailPsicologo; + } + + public void setTcustPersonDetailPsicologo( + TcustPersonDetail tcustPersonDetailPsicologo) { + this.tcustPersonDetailPsicologo = tcustPersonDetailPsicologo; + } + + public Boolean getIsPasaporte() { + return isPasaporte; + } + public void setIsPasaporte(Boolean isPasaporte) { + this.isPasaporte = isPasaporte; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/text-base/RespuestasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/text-base/RespuestasController.java.svn-base new file mode 100644 index 0000000..53aa372 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/text-base/RespuestasController.java.svn-base @@ -0,0 +1,152 @@ +package com.fp.frontend.controller.armas.eval; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.eval.TarmRespuestas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + + +/** + * Clase controladora del bean TgeneCatalog. + * + * @author Andres Cevallos. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RespuestasController extends AbstractController { + + /** + * Constructor + * @throws Exception + */ + public RespuestasController() throws Exception { + super(TarmRespuestas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOG"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static List findxPregunta(String pregunta) { + try {//TgeneCatalogDetailKey + RespuestasController cc = new RespuestasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("cpregunta", pregunta); + cc.addFilter("isactive", "Y"); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static String findxPk(Integer pk) { + try {//TgeneCatalogDetailKey + RespuestasController cc = new RespuestasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", pk.toString()); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0).getEscorrecta(); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/text-base/TestConocimientosController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/text-base/TestConocimientosController.java.svn-base new file mode 100644 index 0000000..c2537ca --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/.svn/text-base/TestConocimientosController.java.svn-base @@ -0,0 +1,571 @@ +package com.fp.frontend.controller.armas.eval; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.MovimientoController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.ArmaController; +import com.fp.frontend.controller.armas.parametros.GuardiasController; +import com.fp.frontend.controller.armas.parametros.PreguntasParaEvaluacionesController; +import com.fp.frontend.controller.armas.solicitud.ArmasController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.date.TgeneNotAccountingDayController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.ValidateIdentification; +import com.fp.frontend.webservices.snap.cedula.ClienteCedula; +import com.fp.frontend.webservices.snap.ruc.ClienteRUC; +import com.fp.persistence.parmas.soli.TarmGuardias; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.date.TgeneNotAccountingDay; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +import ec.gob.registrocivil.consultacedula.Cedula; +import ec.gov.sri.wsconsultacontribuyente.Contribuyente; + +/** + * @author Andres Cevallos + * Clase la cual valida que un usuario pueda rendir una evaluacion. Almacena la evaluacion en la Base de Datos + */ +@ManagedBean +@ViewScoped +public class TestConocimientosController extends AbstractController { + + /** + * Persona a ser evaluada + */ + private TcustPersonDetail evaluado; + + /** + *Controlador inyectado EvaluacionController + */ + @ManagedProperty(value = "#{evaluacionController}") + private EvaluacionController evaluacionController; + private TarmGuardias guardia; + /** + *Controlador inyectado DetallePreguntasController + */ + @ManagedProperty(value = "#{detallePreguntasController}") + private DetallePreguntasController detallePreguntas; + + private TcustPersonDetail evaluadoSNAP; + + /** + *Controlador Fecha + */ + private Date fecha; + + /** + *Booleano que activa la opcion de guardar + */ + private Boolean guardar; + /** + *Tipo de persona referenciada en el catalogo + */ + TgeneCatalogDetail lTipoPersona; + /** + *numero de intentos + */ + Integer numeroIntentos; + /** + *intento actual + */ + Long intento; + /** + *Referencia en el catalogo del tipo de evaluacion + */ + private List ltipoevaluacion; + /** + *Lista de las preguntas y respuestas de una evaluacion + */ + private List levaluacion; + private String tipoevaluacion; + + private boolean bloquear = Boolean.FALSE; + + private TcustPersonDetail compania; + + public TestConocimientosController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + + @PostConstruct + private void postconstruct() { + + + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "TCONOCIMIENTO"; + setLtipoevaluacion(CatalogDetailController.find("TIPOEVALUACION")); + fecha = new Date(); + tipoevaluacion = "CONOCIMIENTO"; + numeroIntentos=ParametersController.find("INTENTOS", "1").getNumbervalue().intValue(); + guardar=false; + + + + // CARGAR INFORMACION DEL USUARIO LOGUEADO DEL SNAP + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + evaluado = PersonLovController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + evaluacionController.setTipoTest("CONOCIMIENTO"); + evaluacionController.queryByTipoEvaluacion(tsafeUserDetail.getPk().getPersoncode().toString(), tipoevaluacion); + + guardia=GuardiasController.findxcguardia(evaluado.getPk().getPersoncode().toString()); + lTipoPersona=CatalogDetailController.findxCodigoCodcatalogo(evaluado.getPersontypecatalog(), evaluado.getPersontypecatalogcode()); + +// super.create(); +// this.record.setPersoncode(evaluado.getPk().getPersoncode()); +// this.record.getModifiedData().put("nombre", evaluado.getName()); +// this.record.getModifiedData().put("identificacion", evaluado.getIdentification()); +// this.record.getModifiedData().put("tipopersona", lTipoPersona.getDescription()); + + + + if(evaluado.getIdentification() == null || evaluado.getIdentification() == null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselacedula")); + return; + } + + if(evaluado.getIdentificationcatalog().equals("CED")){ + // valido validez CEDULA + if(!ValidateIdentification.cedula(evaluado.getIdentification())){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + evaluadoSNAP=buscarPersonaSnap(evaluado.getIdentification(),evaluado.getIdentificationcatalog()); + + }else if(evaluado.getIdentificationcatalog().equals("RUC")){ + // valido validez RUC + if(!ValidateIdentification.ruc(evaluado.getIdentification())){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + evaluadoSNAP=buscarPersonaSnap(evaluado.getIdentification(),evaluado.getIdentificationcatalog()); + } + else{ + // PASAPORTE + evaluadoSNAP = new TcustPersonDetail(); + evaluadoSNAP.setName(evaluado.getName()); + evaluadoSNAP.setIdentification(evaluado.getIdentification()); + evaluadoSNAP.setIdentificationcatalog("PAS"); + evaluadoSNAP.setIdentificationcatalogcode("IDENTIFICATION"); + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public String getTipoevaluacion() { + return tipoevaluacion; + } + + public void setTipoevaluacion(String tipoevaluacion) { + this.tipoevaluacion = tipoevaluacion; + } + + /** + * Abre el lov donde se realiza la evaluacion. Valida la fecha en la que se puede dar la prueba y el numero de intentos + */ + public void openTest() { + if(evaluado==null){ + MessageHelper.setMessageWarn(MsgControlArmas.getProperty("msg_seleccionepersona")); + return; + } + + if(EvaluacionController.find(evaluado.getPk().getPersoncode().toString(), "PSICOLOGICA") == null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("lbl_psicologicanecesaria")); + return; + } +// if(guardia==null){ +// MessageHelper.setMessageError(MsgControlArmas.getProperty("lbl_psicologicanecesaria")); +// return; +// } +// if(tipoevaluacion==null){ +// MessageHelper.setMessageWarn(MsgControlArmas.getProperty("msg_tipoevaluacion")); +// } + if(numeroIntentos>EvaluacionController.findIntentosReprobados(evaluado.getPk().getPersoncode().toString(), tipoevaluacion)){ + intento=EvaluacionController.findIntentosReprobados(evaluado.getPk().getPersoncode().toString(), tipoevaluacion).longValue()+1; + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_numerointentos")); + return; + } +// if(EvaluacionController.findIntentos(evaluado.getPk().getPersoncode().toString(), tipoevaluacion)!=0) +// if(fecha.getTime()< EvaluacionController.findFecha(evaluado.getPk().getPersoncode().toString(), tipoevaluacion).getFechapreox().getTime()){ +// MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_fechaprox") +" " +EvaluacionController.findFecha(evaluado.getPk().getPersoncode().toString(), tipoevaluacion).getFechapreox()); +// return; +// } + + Map> params = new HashMap<>(); + + ConocimientoLovController.openLov(params,evaluado,tipoevaluacion); + + } + + /** + * Funcion que llama a una evaluacion + * @param event + * @throws Exception + */ + public void onReturnOpenTest(SelectEvent event) throws Exception{ + EvaluacionCompleta eval = new EvaluacionCompleta(); + eval = (EvaluacionCompleta) event.getObject(); + ingresarDatosEvaluacion(); + ingresarDetalleEvaluacion(eval); + guardar=true; + + save(); + } + + /** + * Llama al record de evaluaciones y carga los datos que se llevaran a la base + * @throws Exception + */ + public void ingresarDatosEvaluacion() throws Exception{ + evaluacionController.create(); + Date fecha = new Date(); + Date fechalaboral=new Date(); + Integer dias = null; + try{ + dias=ParametersController.find("INTENTOS", "1").getNumbervalue().intValue(); + } + catch(Exception e){ + e.printStackTrace(); + } + if(dias== null || dias<=0){ + dias=2; + } + Calendar calendario = Calendar.getInstance(); + for(int i=0;i> params = new HashMap<>(); +// PersonLovController.openLov(params); +// } + + +// /** +// * Love que regresa la informacion de una persona +// * @param event +// * @throws Exception +// */ +// public void onReturnPersonLov(SelectEvent event) throws Exception { +// setEvaluado( (TcustPersonDetail) event.getObject()); +// if(evaluado.getPersontypecatalog()==null){ +// lTipoPersona=null; +// return; +// } +// lTipoPersona=CatalogDetailController.findxCodigoCodcatalogo(evaluado.getPersontypecatalog(), evaluado.getPersontypecatalogcode()); +//// guardia=GuardiasController.findxcguardia(evaluado.getPk().getPersoncode().toString()); +//// if(guardia==null){ +//// MessageHelper.setMessageError(MsgControlArmas.getProperty("lbl_psicologicanecesaria")); +//// } +// } + + /** + *Limpia la persona seleccionada + */ + public void limpiar(){ + evaluado= null; + lTipoPersona=null; + bloquear=false; + } + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + if(!guardar) + { + return; + } + Request request = this.callerhelper.getRequest(); + DtoSave dtosavevaluacion = this.evaluacionController.getDtoSave(true); + HashMap msave = new HashMap(); + msave.put(evaluacionController.getBeanalias(), dtosavevaluacion); // adicionar metadata de mantenimiento para cada tabla. + dtosavevaluacion.setPosition(1); + + + DtoSave dtosavepreguntas = this.detallePreguntas.getDtoSave(true); + + msave.put(detallePreguntas.getBeanalias(), dtosavepreguntas); // adicionar metadata de mantenimiento para cada tabla. + dtosavepreguntas.setPosition(2); + + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + + + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("lbl_examenfinalizado")); + String calificacion =(String) resp.get("result"); + if(calificacion.equals("APR")){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("lbl_aprobado")); + } + else{ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("lbl_reprobado")+", Debe Realizar el Test Nuevamente"); //+"."+MsgControlArmas.getProperty("msg_fechaprox") +" " +EvaluacionController.findFecha(evaluado.getPk().getPersoncode().toString(), tipoevaluacion).getFechapreox()); + } + + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + finally { + guardar=false; + evaluacionController.clearAll(); + detallePreguntas.clearAll(); + bloquear=true; + init(); + + } + } + + /** + * Método para buscar a la persona en la snap + * @param documento + */ + public TcustPersonDetail buscarPersonaSnap(String documento,String tipoDocumento){ + if(tipoDocumento.equals("CED")){ + Cedula cedula= ClienteCedula.obtenerCedula(documento); + if(cedula!=null){ + TcustPersonDetail detail= new TcustPersonDetail(); + detail.setName(cedula.getNombre()); + detail.setIdentification(cedula.getCedula()); + detail.setIdentificationcatalog("CED"); + detail.setIdentificationcatalogcode("IDENTIFICATION"); + return detail; + }else{ + return null; + } + }else { + Contribuyente contribuyente= ClienteRUC.obtenerRUC(documento); + if(contribuyente!=null){ + TcustPersonDetail detail= new TcustPersonDetail(); + detail.setName(contribuyente.getRazonSocial()); + detail.setIdentification(contribuyente.getNumeroRuc()); + detail.setIdentificationcatalog("RUC"); + detail.setIdentificationcatalogcode("IDENTIFICATION"); + return detail; + }else{ + return null; + } + } + } + + + public EvaluacionController getEvaluacionController() { + return evaluacionController; + } + + public void setEvaluacionController(EvaluacionController evaluacionController) { + this.evaluacionController = evaluacionController; + } + + public DetallePreguntasController getDetallePreguntas() { + return detallePreguntas; + } + + public void setDetallePreguntas(DetallePreguntasController detallePreguntas) { + this.detallePreguntas = detallePreguntas; + } + + public TcustPersonDetail getEvaluado() { + return evaluado; + } + + public void setEvaluado(TcustPersonDetail evaluado) { + this.evaluado = evaluado; + } + + public List getLtipoevaluacion() { + return ltipoevaluacion; + } + + public void setLtipoevaluacion(List ltipoevaluacion) { + this.ltipoevaluacion = ltipoevaluacion; + } + + public List getLevaluacion() { + return levaluacion; + } + + public void setLevaluacion(List levaluacion) { + this.levaluacion = levaluacion; + } + + public Date getFecha() { + return fecha; + } + + public void setFecha(Date fecha) { + this.fecha = fecha; + } + + public TgeneCatalogDetail getlTipoPersona() { + return lTipoPersona; + } + + public void setlTipoPersona(TgeneCatalogDetail lTipoPersona) { + this.lTipoPersona = lTipoPersona; + } + + public boolean isBloquear() { + return bloquear; + } + + public void setBloquear(boolean bloquear) { + this.bloquear = bloquear; + } + + public TcustPersonDetail getCompania() { + return compania; + } + + public void setCompania(TcustPersonDetail compania) { + this.compania = compania; + } + + public TarmGuardias getGuardia() { + return guardia; + } + + public void setGuardia(TarmGuardias guardia) { + this.guardia = guardia; + } + + public TcustPersonDetail getEvaluadoSNAP() { + return evaluadoSNAP; + } + + public void setEvaluadoSNAP(TcustPersonDetail evaluadoSNAP) { + this.evaluadoSNAP = evaluadoSNAP; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/eval/ConocimientoLovController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/ConocimientoLovController.java new file mode 100644 index 0000000..4eca141 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/ConocimientoLovController.java @@ -0,0 +1,443 @@ +package com.fp.frontend.controller.armas.eval; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.PreguntasParaEvaluacionesController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.eval.TarmPreguntas; +import com.fp.persistence.parmas.eval.TarmRespuestas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +/** + * Clase controladora del lov asociado con la evaluacion. + * + * @author Andres Cevallos. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ConocimientoLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + /** + * Instancia de la clase TarmPreguntas + */ + private TarmPreguntas pregunta; + /** + * Boleano que comprueba si la pregunta fue respondida correctamente + */ + private Boolean isCorrecta; + /** + * Lista de Preguntas + */ + private List lpreguntas; + /** + * Lista de Respuestas + */ + private List lrespuestas; + /** + * Instancia de TcustpersonDetail, corresponde a la persona a ser evaluada + */ + private static TcustPersonDetail personevaluada; + /** + * Instancia de una Evaluacion, maneja una pregunta y sus + * respectivasrespuestas que son mostradas en pantalla + */ + private Evaluacion currentEvaluacion; + + /** + * Lista del objetos Evaluacion + */ + private List leva; + /** + * Tipo de Evaluacion + */ + private static String tipoeval; + /** + * Contador que Lleva el numero de pregunta en el que se encuentra + */ + private int numeropregunta; + /** + * Maneja la ultima pregunta + */ + private boolean finalizar; + /** + * Fecha Actual del Sistema + */ + private Date fecha; + /** + * Objeto que sera retornado conteniendo todas las preguntas. + */ + EvaluacionCompleta evaluacionCompleta; + /** + * Tipo de persona referenciada en el catalogo + */ + private TgeneCatalogDetail tipopersona; + + /** + * Tipo de evaluacion referenciado en el catalogo + */ + private TgeneCatalogDetail tipoevaluacion; + /** + * Numero de preguntas que tendra la evaluacion + */ + int npreguntas = 4; + private Boolean errorrend = false; + + private String error; + + public ConocimientoLovController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + lpreguntas = new ArrayList(); + this.beanalias = "EVALUACIONLOV"; + tipoevaluacion = new TgeneCatalogDetail(); + TgeneParameters parametro = ParametersController.find("NUMEROPREGUNTAS", "1"); + + try { + npreguntas = parametro.getNumbervalue().intValue(); + tipoevaluacion = CatalogDetailController.findxCodigoCodcatalogo(tipoeval, "TIPOEVALUACION"); + setTipopersona(CatalogDetailController.findxCodigoCodcatalogo(personevaluada.getPersontypecatalog(), personevaluada.getPersontypecatalogcode())); + lpreguntas.addAll(PreguntasParaEvaluacionesController.findxPregunta(tipopersona.getPk().getCatalog(), "CONOCIMIENTO")); + } catch (Exception e) { + MessageHelper.setMessageError("PROBLEMAS DE PARAMETRIZACION. CONSULTE AL EVALUADOR"); + error = "PROBLEMAS DE PARAMETRIZACION. CONSULTE AL EVALUADOR"; + errorrend = true; + System.out.println("Error"); + return; + } + + numeropregunta = 0; + finalizar = false; + + fecha = Calendar.getInstance().getTime(); + evaluacionCompleta = new EvaluacionCompleta(); + evaluacionCompleta.inicializa(); + construirEvaluacion(); + currentEvaluacion = leva.get(numeropregunta); + comprobarpreguntafinal(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Construye la evaluacion en base a las preguntas que se tengan catalogadas + */ + public void construirEvaluacion() { + + leva = new ArrayList(); + + int i = 0; + while (i < npreguntas) { + int numAleatorio = (int) (Math.random() * (lpreguntas.size() - 1)); + //RespuestasController. + Evaluacion eva = new Evaluacion(); + eva.setPregunta(lpreguntas.get((numAleatorio))); + eva.setRespuesta(RespuestasController.findxPregunta(eva.getPregunta().getPk().toString())); + lpreguntas.remove(numAleatorio); + if (eva.getRespuesta() != null) { + leva.add(eva); + i++; + } + if (lpreguntas.isEmpty()) { + break; + } + + } + } + + /** + * Verifica si se ha respondido una pregunta y llama a la vista la siguiente + * pregunta + */ + public void siguiente() { + + if (currentEvaluacion.getCodigorespuesta() == null || currentEvaluacion.getCodigorespuesta() == 0) { + MessageHelper.setMessageWarn(MsgControlArmas.getProperty("msg_ingreseresp")); + return; + } + evaluacionCompleta.getLevaluacion().add(currentEvaluacion); + currentEvaluacion = leva.get(numeropregunta); + + comprobarpreguntafinal(); + } + + /** + * Verifica que se encuentre en la ultima pregunta + */ + public void comprobarpreguntafinal() { + numeropregunta++; + if (numeropregunta == leva.size()) { + finalizar = true; + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @Override + protected void querydatabase() { + try { + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } finally { + return; + } + } + + public static String getTipoeval() { + return tipoeval; + } + + /** + * Regresa el Objeto de Evaluacion a la pantalla principal + */ + public void setEvaluacion() { + if (currentEvaluacion.getCodigorespuesta() == null || currentEvaluacion.getCodigorespuesta() == 0) { + MessageHelper.setMessageWarn(MsgControlArmas.getProperty("msg_ingreseresp")); + return; + } + + evaluacionCompleta.getLevaluacion().add(currentEvaluacion); + // se utiliza en la pagina del lov. + + RequestContext.getCurrentInstance().closeDialog(evaluacionCompleta); + } + + public static void setTipoeval(String tipoeval) { + ConocimientoLovController.tipoeval = tipoeval; + } + + /** + * Abre el Lov donde se realiza la evaluacion + * + * @param params + * @param persona + * @param catalogo + */ + public static void openLov(Map> params, TcustPersonDetail persona, String catalogo) { + personevaluada = persona; + tipoeval = catalogo; + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 350); + options.put(EnumLovOption.WIDTH.getLabel(), 900); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + options.put("closable", false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/conocimientoLov.xhtml", options, params); + } + + /** + * Crea una instancia y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + isCorrecta = false; +// record.setCpregunta(pregunta.getPk()); + } + + /** + * Actualiza la lista de registros a grabar + * + * @throws Exception + */ + public void update() throws Exception { + //if(record.getEscorrecta()==null){ + // record.setEscorrecta("N"); + // } + //super.update(); + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public TarmPreguntas getPregunta() { + return pregunta; + } + + public void setPregunta(TarmPreguntas pregunta) { + this.pregunta = pregunta; + } + + public Boolean getIsCorrecta() { + return isCorrecta; + } + + public void setIsCorrecta(Boolean isCorrecta) { + this.isCorrecta = isCorrecta; + } + + public void onChangeEsCorrecta() { + /* if (isCorrecta) { + record.setEscorrecta("Y"); + } else { + record.setEscorrecta("N"); + }*/ + } + + public List getLpreguntas() { + return lpreguntas; + } + + public void setLpreguntas(List lpreguntas) { + this.lpreguntas = lpreguntas; + } + + public List getLrespuestas() { + return lrespuestas; + } + + public void setLrespuestas(List lrespuestas) { + this.lrespuestas = lrespuestas; + } + + public List getLeva() { + return leva; + } + + public void setLeva(List leva) { + this.leva = leva; + } + + public TcustPersonDetail getPersonevaluada() { + return personevaluada; + } + + public void setPersonevaluada(TcustPersonDetail personevaluada) { + this.personevaluada = personevaluada; + } + + public TgeneCatalogDetail getTipopersona() { + return tipopersona; + } + + public void setTipopersona(TgeneCatalogDetail tipopersona) { + this.tipopersona = tipopersona; + } + + public TgeneCatalogDetail getTipoevaluacion() { + return tipoevaluacion; + } + + public void setTipoevaluacion(TgeneCatalogDetail tipoevaluacion) { + this.tipoevaluacion = tipoevaluacion; + } + + public Evaluacion getCurrentEvaluacion() { + return currentEvaluacion; + } + + public void setCurrentEvaluacion(Evaluacion currentEvaluacion) { + this.currentEvaluacion = currentEvaluacion; + } + + public boolean isFinalizar() { + return finalizar; + } + + public void setFinalizar(boolean finalizar) { + this.finalizar = finalizar; + } + + public int getNumeropregunta() { + return numeropregunta; + } + + public void setNumeropregunta(int numeropregunta) { + this.numeropregunta = numeropregunta; + } + + public Date getFecha() { + return fecha; + } + + public void setFecha(Date fecha) { + this.fecha = fecha; + } + + public String getError() { + return error; + } + + public void setError(String error) { + this.error = error; + } + + public Boolean getErrorrend() { + return errorrend; + } + + public void setErrorrend(Boolean errorrend) { + this.errorrend = errorrend; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/eval/DetallePreguntasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/DetallePreguntasController.java new file mode 100644 index 0000000..9461a2d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/DetallePreguntasController.java @@ -0,0 +1,124 @@ +package com.fp.frontend.controller.armas.eval; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; + +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.eval.TarmDetallePreguntas; + +/** + * Clase controladora del bean TarmDetallePreguntas. + * + * @author Andres Cevallos. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class DetallePreguntasController extends AbstractController { + + /** + * Constructor + * + * @throws Exception + */ + public DetallePreguntasController() throws Exception { + super(TarmDetallePreguntas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "DETALLEPREGUNTAS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * M´todo para generar un reporte + * + * @throws Exception + */ +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/eval/Evaluacion.java b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/Evaluacion.java new file mode 100644 index 0000000..8372ac6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/Evaluacion.java @@ -0,0 +1,66 @@ +package com.fp.frontend.controller.armas.eval; + +import java.util.List; + +import com.fp.persistence.parmas.eval.TarmPreguntas; +import com.fp.persistence.parmas.eval.TarmRespuestas; + +/** + * Objeto que encapsula las preguntas y las respuestas + * + * @author Andres Cevallos + * + */ +public class Evaluacion { + + /** + * Instancia de TarmPreguntas + */ + private TarmPreguntas pregunta; + /** + * Lista de Respuestas asociadas a la pregunta + */ + private List respuesta; + /** + * Codigo de respuesta seleccionada + */ + + private Integer codigorespuesta; + /** + * Respuesta seleccionada + */ + private TarmRespuestas respues; + + public TarmPreguntas getPregunta() { + return pregunta; + } + + public void setPregunta(TarmPreguntas pregunta) { + this.pregunta = pregunta; + } + + public List getRespuesta() { + return respuesta; + } + + public void setRespuesta(List respuesta) { + this.respuesta = respuesta; + } + + public Integer getCodigorespuesta() { + return codigorespuesta; + } + + public void setCodigorespuesta(Integer codigorespuesta) { + this.codigorespuesta = codigorespuesta; + } + + public TarmRespuestas getRespues() { + return respues; + } + + public void setRespues(TarmRespuestas respues) { + this.respues = respues; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/eval/EvaluacionCompleta.java b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/EvaluacionCompleta.java new file mode 100644 index 0000000..4d90700 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/EvaluacionCompleta.java @@ -0,0 +1,28 @@ +package com.fp.frontend.controller.armas.eval; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Andres Cevallos Contiene la lista de respuestas y preguntas + */ +public class EvaluacionCompleta { + + /** + * Contiene una lista de evaluaciones + */ + private List levaluacion; + + public void inicializa() { + levaluacion = new ArrayList(); + } + + public List getLevaluacion() { + return levaluacion; + } + + public void setLevaluacion(List levaluacion) { + this.levaluacion = levaluacion; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/eval/EvaluacionController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/EvaluacionController.java new file mode 100644 index 0000000..280db03 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/EvaluacionController.java @@ -0,0 +1,1233 @@ +package com.fp.frontend.controller.armas.eval; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.SelectEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.GuardiasController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.frontend.utility.ValidateIdentification; +import com.fp.frontend.webservices.snap.cedula.ClienteCedula; +import com.fp.frontend.webservices.snap.ruc.ClienteRUC; +import com.fp.persistence.parmas.eval.TarmEvaluacion; +import com.fp.persistence.parmas.soli.TarmGuardias; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +import ec.gob.registrocivil.consultacedula.Cedula; +import ec.gov.sri.wsconsultacontribuyente.Contribuyente; + +/** + * Clase controladora del bean TarmEvaluacion. + * + * @author Andres Cevallos. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class EvaluacionController extends AbstractController { + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + @ManagedProperty(value = "#{guardiasController}") + private GuardiasController guardiasController; +// private TcustPersonDetail evaluado; + private Boolean aprobado; + TgeneCatalogDetail lTipoPersona; + private TgeneCatalogDetail centromed; + public String centro; + public List lcentro; +// private List lTipoEvaluacion; + TgeneCatalogDetail tipoEvaluacion; + private TcustPersonDetail empresa; + private UploadedFile file; + private Date fecha; + private Date fechaactual; + private Date fechadeposito; + private TcustPersonDetail personafiltro; + private TcustPersonDetail personafiltroSNAP; + private List eliminar; + private boolean subio = false; + private String deposito; + private String papeleta; + private Boolean centroMedico; + private String nombreArchivo; + private Boolean isGuardia; + private String tipoTest; + + private Boolean isPasaporte; + /** + * codigo del ruc + */ + private String codigoRuc; + /** + * codigo del ruc + */ + private String codigoCedula; + /** + * codigo del pasaporte + */ + private String codigoPasaporte; + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List tipoDocumentoLst; + + /** + * Atributo para setear el psicologo responsable + */ + private TcustPersonDetail tcustPersonDetailPsicologo; + + /** + * Constructor + * + * @throws Exception + */ + public EvaluacionController() throws Exception { + super(TarmEvaluacion.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + querydatabase(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + eliminar = new ArrayList(); + this.beanalias = "EVALUACION"; + this.tipoTest = "PSICOLOGICA"; + aprobado = false; + fecha = new Date(); + codigoRuc = codigos("CODIGO.RUC"); + codigoCedula = codigos("CODIGO.CEDULA"); + codigoPasaporte = codigos("CODIGO.PASAPORTE"); + tipoDocumentoLst = CatalogDetailController.find("IDENTIFICATION"); +// lTipoEvaluacion=CatalogDetailController.find("TIPOEVALUACION"); + tipoEvaluacion = CatalogDetailController.findCatalogo("TIPOEVALUACION", "PSICOLOGICA"); + lcentro = CatalogDetailController.find("CENTROMEDICO"); + setFechaactual(new Date()); + centroMedico = Boolean.FALSE; + + // CARGAR INFORMACION DEL USUARIO LOGUEADO DEL SNAP + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + personafiltro = PersonLovController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + lTipoPersona = CatalogDetailController.findxCodigoCodcatalogo(personafiltro.getPersontypecatalog(), personafiltro.getPersontypecatalogcode()); + super.create(); + this.record.setPersoncode(personafiltro.getPk().getPersoncode()); + this.record.getModifiedData().put("nombre", personafiltro.getName()); + this.record.getModifiedData().put("identificacion", personafiltro.getIdentification()); + this.record.getModifiedData().put("tipopersona", lTipoPersona.getDescription()); + + if (personafiltro.getIdentification() == null || personafiltro.getIdentification() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselacedula")); + return; + } + + if (personafiltro.getIdentificationcatalog().equals("CED")) { + // valido validez CEDULA + if (!ValidateIdentification.cedula(personafiltro.getIdentification())) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + personafiltroSNAP = buscarPersonaSnap(personafiltro.getIdentification(), personafiltro.getIdentificationcatalog()); + + } else if (personafiltro.getIdentificationcatalog().equals("RUC")) { + // valido validez RUC + if (!ValidateIdentification.ruc(personafiltro.getIdentification())) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + personafiltroSNAP = buscarPersonaSnap(personafiltro.getIdentification(), personafiltro.getIdentificationcatalog()); + } else { + // PASAPORTE + personafiltroSNAP = new TcustPersonDetail(); + personafiltroSNAP.setName(personafiltro.getName()); + personafiltroSNAP.setIdentification(personafiltro.getIdentification()); + personafiltroSNAP.setIdentificationcatalog("PAS"); + personafiltroSNAP.setIdentificationcatalogcode("IDENTIFICATION"); + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para obtener los codigos + */ + public String codigos(String parametro) { + TgeneParameters tgeneParameters = ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + /** + * Método para obtener los codigos + */ + public Integer valorInt(String parametro) { + TgeneParameters tgeneParameters = ParametersController.find(parametro, "1"); + return tgeneParameters.getNumbervalue().intValue(); + } + + public String getCentro() { + return centro; + } + + public void setCentro(String centro) { + this.centro = centro; + } + + public List getLcentro() { + return lcentro; + } + + public void setLcentro(List lcentro) { + this.lcentro = lcentro; + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.fecha,t.tipoevaluacion"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + SubQuery snombre = new SubQuery("TcustPersonDetail", "name", "nombre", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery snumerodocumento = new SubQuery("TcustPersonDetail", "identification", "identificacion", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery persontipe = new SubQuery("TcustPersonDetail", "persontypecatalog", "tipopersona", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery persontipecode = new SubQuery("TcustPersonDetail", "persontypecatalogcode", "tipopersonacode", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery identificationcatalogcode = new SubQuery("TcustPersonDetail", "identificationcatalogcode", "identificationcatalogcode", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery tipoevaluacion = new SubQuery("TgeneCatalogDetail", "description", "tipoevaluaciondesc", "i.pk.catalog=t.tipoevaluacion and i.pk.catalogcode=t.tipoevaluacioncodigo"); + + Filter filtrofecha = new Filter(); +// filtrofecha.setSql("t.fecha=(select max(te.fecha) from TarmEvaluacion te where te.personcode=t.personcode and te.tipoevaluacion=t.tipoevaluacion)"); + filtrofecha.setSql("t.personcode=" + personafiltro.getPk().getPersoncode().toString() + " and t.tipoevaluacion='" + tipoTest + "'"); // + dto.addFiltro(filtrofecha); + dto.addSubQuery(snombre); + dto.addSubQuery(snumerodocumento); + dto.addSubQuery(persontipe); + dto.addSubQuery(identificationcatalogcode); + dto.addSubQuery(persontipecode); + dto.addSubQuery(tipoevaluacion); + // dto.addSubQuery(maxdate); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + completar(); + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void cargarDeposito() { + centromed = CatalogDetailController.findxCodigoCodcatalogo(centro, "CENTROMEDICO"); + this.record.setCentromedico(centro); + TgeneParameters parameters = ParametersController.find("CODIGO.OTROS", "1"); + centroMedico = Boolean.FALSE; + if (centro.equals(parameters.getTextvalue())) { + fechadeposito = new Date(); + record.setNopapeleta(null); + centroMedico = Boolean.TRUE; + } + } + + /** + * Conpleta la informacion de la Evaluacion + */ + @SuppressWarnings("deprecation") + public void completar() { + for (int i = 0; i < this.lrecord.size(); i++) { + try { + if (lrecord.get(i).getModifiedData().get("tipoevaluaciondesc").toString().equals("EVALUACION DE CONOCIMIENTOS")) { + this.lrecord.get(i).getModifiedData().put("eliminar", "true"); + } else if (fecha.getDay() != lrecord.get(i).getFecha().getDay() || fecha.getMonth() != lrecord.get(i).getFecha().getMonth() || fecha.getYear() != lrecord.get(i).getFecha().getYear()) { + this.lrecord.get(i).getModifiedData().put("eliminar", "true"); + } //else if(lrecord.get(i)) + else { + this.lrecord.get(i).getModifiedData().put("eliminar", "false"); + } + + TgeneCatalogDetail tipo = CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("tipopersona").toString(), this.lrecord.get(i).getModifiedData().get("tipopersonacode").toString()); + this.lrecord.get(i).getModifiedData().put("tipopersonadesc", tipo.getDescription()); + + if (lrecord.get(i).getFechaexpiracion() != null && lrecord.get(i).getFechaexpiracion().after(new Date())) { + this.lrecord.get(i).getModifiedData().put("estadovig", "VIGENTE"); + } else { + this.lrecord.get(i).getModifiedData().put("estadovig", "NO VIGENTE"); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + /** + * Ruta para la evaluacion de conocimientos + * + * @param eva + * @return + */ + public String getRutaDocumentoPrueba(TarmEvaluacion eva) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta = new StringBuilder("cm:Pruebas"); + ruta = ruta.append("/cm:ID-").append(eva.modifiedData().get("identificacion").toString()); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + return ruta.toString(); + } + + /** + * Valida la fecha + * + * @param fech + */ + public void validarfecha(Date fech) { + if (fech.getTime() > (new Date()).getTime()) { + fecha = new Date(); + } + } + + /** + * Evento el cual carga los archivos + * + * @param event + */ + public void upload(FileUploadEvent event) { + + file = event.getFile(); + subio = true; + nombreArchivo = Utilidades.recorteNombre(file.getFileName()); + + } + + /** + * Crea un registro de actualizacion + */ + @SuppressWarnings("deprecation") + public void actualizar() { + + try { + if (personafiltro == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_persona")); + return; + } + +// if(empresa==null){ +// MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_persona")); +// return; +// } + if (file == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_debesubir")); + return; + } + + Date horas = new Date(); + fecha.setHours(horas.getHours()); + fecha.setMinutes(horas.getMinutes()); + fecha.setSeconds(horas.getSeconds()); + this.record.getModifiedData().put("file", file); + String xPathLocation = getRutaDocumentoPrueba(record); + this.record.setTipoevaluacion("PSICOLOGICA"); + this.record.setTipoevaluacioncodigo("TIPOEVALUACION"); + this.record.setTipdoccodepsicologo("IDENTIFICATION"); + this.record.setInformexpath(xPathLocation + "/cm:Pruebas/cm:" + "Psicologico.pdf"); + this.record.setFecha(new java.sql.Timestamp(new Date().getTime())); + aprobar(); + // Para validar el estado del guardia + Integer numTestPsicologicosAPB = EvaluacionController.findEvaluacionesAprobadasVigentes(record.getPersoncode().toString(), "PSICOLOGICA"); + Integer numTestConocimientososAPB = EvaluacionController.findEvaluacionesAprobadasVigentes(record.getPersoncode().toString(), "CONOCIMIENTO"); + if (this.record.getResultado().equalsIgnoreCase("APROBADO")) { + // En caso de que el actual test sea aprobado sumo uno a los antes aprobados + numTestPsicologicosAPB++; + Date fechaexpiracion = new Date(); + //fechaexpiracion.setYear(fechaexpiracion.getYear()+2); + Integer month = valorInt("VIGENCIA_MES_EVAL"); + fechaexpiracion.setMonth(fechaexpiracion.getMonth() + month); + this.record.setFechaexpiracion(new java.sql.Date(fechaexpiracion.getTime())); + } + this.record.setCentromedico(centromed.getPk().getCatalog()); + if (empresa != null && empresa.getPk() != null && empresa.getPk().getPersoncode() != null) { + this.record.setEmpresapersoncode(empresa.getPk().getPersoncode()); + } + this.record.setCentromedicocode("CENTROMEDICO"); + this.record.setFechadeposito(new java.sql.Date(fechadeposito.getTime())); + this.record.getModifiedData().put("tipopersonadesc", lTipoPersona.getDescription()); + this.record.getModifiedData().put("tipoevaluaciondesc", CatalogDetailController.findxCodigoCodcatalogo(this.record.getTipoevaluacion(), this.record.getTipoevaluacioncodigo()).getDescription()); + TarmEvaluacion oeva = EvaluacionController.findVigencia(record.getPersoncode().toString(), record.getTipoevaluacion()); + + if (oeva == null || record.getFecha().before(oeva.getFecha())) { + record.setVigente("N"); + update(); + TarmGuardias guardia; + guardia = GuardiasController.findxcguardia(personafiltro.getPk().getPersoncode().toString()); + + if (guardia != null) { + guardiasController.setRecord(guardia); + guardiasController.getRecord().setIsnew(false); + } else { + guardiasController.create(); + } + if (empresa != null && empresa.getPk() != null && empresa.getPk().getPersoncode() != null) { + guardiasController.getRecord().setCempresa(empresa.getPk().getPersoncode()); + } + + guardiasController.getRecord().setPk(personafiltro.getPk().getPersoncode()); + + if (numTestPsicologicosAPB <= 0 || numTestConocimientososAPB <= 0) { + guardiasController.getRecord().setEstado("NAPT"); + } else { + guardiasController.getRecord().setEstado("APT"); + } + guardiasController.update(); + + return; + } + record.setVigente("Y"); + update(); + TarmGuardias guardia; + guardia = GuardiasController.findxcguardia(personafiltro.getPk().getPersoncode().toString()); + + if (guardia != null) { + guardiasController.setRecord(guardia); + guardiasController.getRecord().setIsnew(false); + } else { + guardiasController.create(); + } + if (empresa != null && empresa.getPk() != null && empresa.getPk().getPersoncode() != null) { + guardiasController.getRecord().setCempresa(empresa.getPk().getPersoncode()); + } + guardiasController.getRecord().setPk(personafiltro.getPk().getPersoncode()); + if (numTestPsicologicosAPB <= 0 || numTestConocimientososAPB <= 0) { + guardiasController.getRecord().setEstado("NAPT"); + } else { + guardiasController.getRecord().setEstado("APT"); + } + guardiasController.update(); + + oeva.setVigente("N"); + oeva.setIsnew(false); + this.record = oeva; + update(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + public GuardiasController getGuardiasController() { + return guardiasController; + } + + public void setGuardiasController(GuardiasController guardiasController) { + this.guardiasController = guardiasController; + } + + /** + * Abre el lov de persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + +// /** +// * Retorna y carga datos de la persona +// * @param event +// * @throws Exception +// */ +// public void onReturnPersonLov(SelectEvent event) throws Exception { +//// setEvaluado( (TcustPersonDetail) event.getObject()); +// lTipoPersona=CatalogDetailController.findxCodigoCodcatalogo(personafiltro.getPersontypecatalog(), personafiltro.getPersontypecatalogcode()); +// this.record.setPersoncode(personafiltro.getPk().getPersoncode()); +// this.record.getModifiedData().put("nombre", personafiltro.getName()); +// this.record.getModifiedData().put("identificacion", personafiltro.getIdentification()); +// try{ +// this.record.getModifiedData().put("tipopersona", lTipoPersona.getDescription()); +// } +// catch(Exception e){ +// e.printStackTrace(); +// } +// } + public void onRetrunPersonLovEmpresa(SelectEvent event) throws Exception { + setEmpresa((TcustPersonDetail) event.getObject()); + this.record.setEmpresapersoncode(empresa.getPk().getPersoncode()); + } +// /** +// * Regresa una persona para guardarla en un nuevo registro de evaluacio psicologica +// * @param event +// * @throws Exceptionq +// */ +// public void onReturnPersonLov2(SelectEvent event) throws Exception{ +// personafiltro=(TcustPersonDetail) event.getObject(); +// this.addFilter("personcode", personafiltro.getPk().getPersoncode().toString()); +// } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + /** + * Metodo de guardado de la evaluacion. Ademas sube el archivo alfresco + * seleccionado + */ + @Override + public void save() { + try { + for (int i = 0; i < lrecord.size(); i++) { + if (lrecord.get(i).isnew) { + if (lrecord.get(i).getModifiedData().get("file") != null) { + UploadedFile archivo = (UploadedFile) lrecord.get(i).modifiedData().get("file"); + String xPathLocation = getRutaDocumentoPrueba(lrecord.get(i)) + "/cm:Pruebas"; + lrecord.get(i).modifiedData().clear(); + alfrescoController.uploadFile(archivo.getInputstream(), "Psicologico.pdf", xPathLocation); + if (this.lrecord.get(i).getFechaexpiracion() != null && this.lrecord.get(i).getFechaexpiracion().after(new Date())) { + this.lrecord.get(i).getModifiedData().put("estadovig", "VIGENTE"); + } else { + this.lrecord.get(i).getModifiedData().put("estadovig", "NO VIGENTE"); + } + } + } + } + + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + dtosave.setPosition(1); + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + DtoSave dtoguardias = this.guardiasController.getDtoSave(true); + msave.put(guardiasController.getBeanalias(), dtoguardias); // adicionar metadata de mantenimiento para cada tabla. + dtoguardias.setPosition(2); + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + postconstruct(); + } + + /** + * Metodo el cual borra un registro. Revisa si el registro coincide con la + * fecha maxima. + */ + @SuppressWarnings("deprecation") + @Override + public void remove() { + fecha = new Date(); + if (fecha.getDay() == record.getFecha().getDay() && fecha.getMonth() == record.getFecha().getMonth() && fecha.getYear() == record.getFecha().getYear()) { + try { + eliminar.add(record.getInformexpath()); + super.remove(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else { + MessageHelper.setMessageError("NO SE PUEDE BORRAR ESTE REGISTRO"); + } + } + + /** + * aprueba la o reprueba la evaluacion + */ + public void aprobar() { + if (aprobado) { + this.record.setResultado("APROBADO"); + this.record.setResultadocodigo("RESULTADO"); + } else { + this.record.setResultado("REPROBADO"); + this.record.setResultadocodigo("RESULTADO"); + } + } + + /** + * find para encontrar los registros anteriores + */ + public static Integer findIntentos(String personcode, String tipoevaluacion) { + try { + EvaluacionController cc = new EvaluacionController(); + cc.init(); + cc.recperpage = 300000; + cc.addFilter("personcode", personcode); + cc.addFilter("tipoevaluacion", tipoevaluacion); + cc.querydata(personcode, tipoevaluacion); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.size(); + } + return 0; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return 0; + } + + } + + /** + * find para encontrar evaluaciones aprobadas anteriores en estado vigente + */ + public static Integer findEvaluacionesAprobadasVigentes(String personcode, String tipoevaluacion) { + try { + EvaluacionController cc = new EvaluacionController(); + cc.init(); + cc.recperpage = 300000; + cc.addFilter("resultado", "APROBADO"); + cc.addFilter("personcode", personcode); + cc.addFilter("tipoevaluacion", tipoevaluacion); + cc.querydatabaseVigentes(personcode, tipoevaluacion); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.size(); + } + return 0; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return 0; + } + + } + + /** + * find para encontrar los registros anteriores + */ + public static Integer findIntentosReprobados(String personcode, String tipoevaluacion) { + try { + EvaluacionController cc = new EvaluacionController(); + cc.init(); + cc.recperpage = 300000; + cc.addFilter("resultado", "REPROBADO"); + cc.addFilter("personcode", personcode); + cc.addFilter("tipoevaluacion", tipoevaluacion); + cc.querydata(personcode, tipoevaluacion); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.size(); + } + return 0; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return 0; + } + + } + +// /* (non-Javadoc) +// * @see com.fp.frontend.controller.AbstractController#create() +// */ +// @Override +// public void create(){ +// limpiar(); +// try { +// super.create(); +// } catch (Exception e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// } + /** + * Limpia los registros anteriores + */ + public void limpiar() { + personafiltro = null; + file = null; + lTipoPersona = null; + subio = false; + fechadeposito = new Date(); + empresa = new TcustPersonDetail(); + deposito = ""; + nombreArchivo = null; + init(); + } + + /** + * Find para encontrar la fecha en la que debe rendir la prueba + * + * @param personcode + * @param tipoevaluacion + * @return + */ + public static TarmEvaluacion findFecha(String personcode, String tipoevaluacion) { + try { + EvaluacionController cc = new EvaluacionController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("personcode", personcode); + cc.addFilter("tipoevaluacion", tipoevaluacion); + cc.querydat(personcode, tipoevaluacion); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * find para encontrar evaluaciones aprobadas anteriores en estado vigente + */ + public static TarmEvaluacion findEvaluacionesVigentes(String personcode, String tipoevaluacion) { + try { + EvaluacionController cc = new EvaluacionController(); + cc.init(); + cc.recperpage = 100; + cc.addFilter("resultado", "APROBADO"); + cc.addFilter("personcode", personcode); + cc.addFilter("tipoevaluacion", tipoevaluacion); + cc.querydataVigentes(personcode, tipoevaluacion); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public void querydataVigentes(String personcode, String tipoevaluacion) { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.fecha desc"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Encuentra la evaluacion vigente + * + * @param personcode + * @param tipoevaluacion + * @return + */ + public static TarmEvaluacion findVigencia(String personcode, String tipoevaluacion) { + try { + EvaluacionController cc = new EvaluacionController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("personcode", personcode); + cc.addFilter("tipoevaluacion", tipoevaluacion); + cc.addFilter("vigente", "Y"); + cc.querydat(personcode, tipoevaluacion); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmEvaluacion find(String personcode, String tipoevaluacion) { + try { + EvaluacionController cc = new EvaluacionController(); + cc.init(); + cc.recperpage = 300000; + cc.addFilter("personcode", personcode); + cc.addFilter("tipoevaluacion", tipoevaluacion); + cc.querydat(personcode, tipoevaluacion); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + if (cc.lrecord.get(0).getFechaexpiracion() != null && cc.lrecord.get(0).getFechaexpiracion().after(new Date())) { + return cc.lrecord.get(0); + } else { + return null; + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * consulta en la cual se busca la fecha proxima para rendir la evaluacion + * + * @param personcode + * @param tipoevaluacion + */ + public void querydat(String personcode, String tipoevaluacion) { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.fechapreox"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + Filter sql = new Filter(); + sql.setSql("t.fecha=(select max(fecha) from TarmEvaluacion where personcode='" + personcode + "' and tipoevaluacion='" + tipoevaluacion + "')"); + dto.addFiltro(sql); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void queryByTipoEvaluacion(String personcode, String tipoevaluacion) { + try { + Request request = this.callerhelper.getRequest(); + this.lrecord = new ArrayList<>(); + DtoQuery dto = super.getDtoQuery(true); + this.recperpage = 300000; + SubQuery snombre = new SubQuery("TcustPersonDetail", "name", "nombre", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery snumerodocumento = new SubQuery("TcustPersonDetail", "identification", "identificacion", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery persontipe = new SubQuery("TcustPersonDetail", "persontypecatalog", "tipopersona", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery persontipecode = new SubQuery("TcustPersonDetail", "persontypecatalogcode", "tipopersonacode", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery identificationcatalogcode = new SubQuery("TcustPersonDetail", "identificationcatalogcode", "identificationcatalogcode", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery tipoevaluacionSQ = new SubQuery("TgeneCatalogDetail", "description", "tipoevaluaciondesc", "i.pk.catalog=t.tipoevaluacion and i.pk.catalogcode=t.tipoevaluacioncodigo"); + Filter filtropersona = new Filter();// + filtropersona.setSql("t.personcode=" + personcode + " and t.tipoevaluacion='" + tipoevaluacion + "' "); + dto.addFiltro(filtropersona); + dto.addSubQuery(snombre); + dto.addSubQuery(snumerodocumento); + dto.addSubQuery(persontipe); + dto.addSubQuery(identificationcatalogcode); + dto.addSubQuery(persontipecode); + dto.addSubQuery(tipoevaluacionSQ); +// this.getMfilters().put("t.personcode", personcode); +// this.getMfilters().put("t.tipoevaluacion", tipoevaluacion); + dto.setOrderby("t.fechaexpiracion desc"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + completar(); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void querydata(String personcode, String tipoevaluacion) { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.fechapreox"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void querydatabaseVigentes(String personcode, String tipoevaluacion) { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + Filter filtro = new Filter(); + filtro.setSql("t.fechaexpiracion>=now()"); + dto.addFiltro(filtro); + dto.setOrderby("t.fechapreox"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Query hacia la base de datos + */ + public void querybase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.fecha"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void onChangeTipoDocumento() { + if (this.getRecord().getTipdocpsicologo().equalsIgnoreCase("CED") || this.getRecord().getTipdocpsicologo().equalsIgnoreCase("RUC")) { + this.setIsPasaporte(Boolean.FALSE); + this.getRecord().setNumdocpsicologo(null); + this.getRecord().setPsicologoresponsable(null); + } else { + this.setIsPasaporte(Boolean.TRUE); + } + } + + /** + * Método que valida la persona portadora del arma o explosivo en las + * tablas de maia y en la snap + * + */ + public void validarPsicologoResponsable() { + if (this.getRecord().getNumdocpsicologo() == null || this.getRecord().getTipdocpsicologo() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselacedula")); + return; + } + if (this.getRecord().getTipdocpsicologo().equals(codigoCedula)) { + // SI ES CEDULA + if (!ValidateIdentification.cedula(this.getRecord().getNumdocpsicologo())) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en la SNAP + tcustPersonDetailPsicologo = buscarPersonaSnap(this.getRecord().getNumdocpsicologo(), this.getRecord().getTipdocpsicologo()); + } else if (this.getRecord().getTipdocpsicologo().equals(codigoRuc)) { + // SI ES RUC + if (!ValidateIdentification.ruc(this.getRecord().getNumdocpsicologo())) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + // envia a buscar en la snap + tcustPersonDetailPsicologo = buscarPersonaSnap(this.getRecord().getNumdocpsicologo(), this.getRecord().getTipdocpsicologo()); + } + if (tcustPersonDetailPsicologo != null) { + this.record.setPsicologoresponsable(tcustPersonDetailPsicologo.getName()); + } else if (this.getRecord().getTipdocpsicologo().equals(codigoCedula) || this.getRecord().getTipdocpsicologo().equals(codigoRuc)) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_psicologoinvalido")); + this.record.setPsicologoresponsable(null); + } + } + + /** + * Método para buscar a la persona en la snap + * + * @param documento + */ + public TcustPersonDetail buscarPersonaSnap(String documento, String tipoDocumento) { + if (tipoDocumento.equals("CED")) { + Cedula cedula = ClienteCedula.obtenerCedula(documento); + if (cedula != null) { + TcustPersonDetail detail = new TcustPersonDetail(); + detail.setName(cedula.getNombre()); + detail.setIdentification(cedula.getCedula()); + detail.setIdentificationcatalog("CED"); + detail.setIdentificationcatalogcode("IDENTIFICATION"); + return detail; + } else { + return null; + } + } else { + Contribuyente contribuyente = ClienteRUC.obtenerRUC(documento); + if (contribuyente != null) { + TcustPersonDetail detail = new TcustPersonDetail(); + detail.setName(contribuyente.getRazonSocial()); + detail.setIdentification(contribuyente.getNumeroRuc()); + detail.setIdentificationcatalog("RUC"); + detail.setIdentificationcatalogcode("IDENTIFICATION"); + return detail; + } else { + return null; + } + } + } + + public Boolean getAprobado() { + return aprobado; + } + + public void setAprobado(Boolean aprobado) { + this.aprobado = aprobado; + } + + public TgeneCatalogDetail getlTipoPersona() { + return lTipoPersona; + } + + public void setlTipoPersona(TgeneCatalogDetail lTipoPersona) { + this.lTipoPersona = lTipoPersona; + } + + public UploadedFile getFile() { + return file; + } + + public void setFile(UploadedFile file) { + this.file = file; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public Date getFecha() { + return fecha; + } + + public void setFecha(Date fecha) { + this.fecha = fecha; + } + + public TcustPersonDetail getPersonafiltro() { + return personafiltro; + } + + public void setPersonafiltro(TcustPersonDetail personafiltro) { + this.personafiltro = personafiltro; + } + + public Date getFechaactual() { + return fechaactual; + } + + public void setFechaactual(Date fechaactual) { + this.fechaactual = fechaactual; + } + + public List getEliminar() { + return eliminar; + } + + public void setEliminar(List eliminar) { + this.eliminar = eliminar; + } + + public TgeneCatalogDetail getTipoEvaluacion() { + return tipoEvaluacion; + } + + public void setTipoEvaluacion(TgeneCatalogDetail tipoEvaluacion) { + this.tipoEvaluacion = tipoEvaluacion; + } + + public boolean isSubio() { + return subio; + } + + public void setSubio(boolean subio) { + this.subio = subio; + } + + public TcustPersonDetail getEmpresa() { + return empresa; + } + + public void setEmpresa(TcustPersonDetail empresa) { + this.empresa = empresa; + } + + public Date getFechadeposito() { + return fechadeposito; + } + + public void setFechadeposito(Date fechadeposito) { + this.fechadeposito = fechadeposito; + } + + public String getDeposito() { + return deposito; + } + + public void setDeposito(String deposito) { + this.deposito = deposito; + } + + public TgeneCatalogDetail getCentromed() { + return centromed; + } + + public void setCentromed(TgeneCatalogDetail centromed) { + this.centromed = centromed; + } + + public String getPapeleta() { + return papeleta; + } + + public void setPapeleta(String papeleta) { + this.papeleta = papeleta; + } + + public Boolean getCentroMedico() { + return centroMedico; + } + + public void setCentroMedico(Boolean centroMedico) { + this.centroMedico = centroMedico; + } + + public String getNombreArchivo() { + return nombreArchivo; + } + + public void setNombreArchivo(String nombreArchivo) { + this.nombreArchivo = nombreArchivo; + } + + public Boolean getIsGuardia() { + return isGuardia; + } + + public void setIsGuardia(Boolean isGuardia) { + this.isGuardia = isGuardia; + } + + public TcustPersonDetail getPersonafiltroSNAP() { + return personafiltroSNAP; + } + + public void setPersonafiltroSNAP(TcustPersonDetail personafiltroSNAP) { + this.personafiltroSNAP = personafiltroSNAP; + } + + public String getTipoTest() { + return tipoTest; + } + + public void setTipoTest(String tipoTest) { + this.tipoTest = tipoTest; + } + + public List getTipoDocumentoLst() { + return tipoDocumentoLst; + } + + public void setTipoDocumentoLst(List tipoDocumentoLst) { + this.tipoDocumentoLst = tipoDocumentoLst; + } + + public TcustPersonDetail getTcustPersonDetailPsicologo() { + return tcustPersonDetailPsicologo; + } + + public void setTcustPersonDetailPsicologo( + TcustPersonDetail tcustPersonDetailPsicologo) { + this.tcustPersonDetailPsicologo = tcustPersonDetailPsicologo; + } + + public Boolean getIsPasaporte() { + return isPasaporte; + } + + public void setIsPasaporte(Boolean isPasaporte) { + this.isPasaporte = isPasaporte; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/eval/RespuestasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/RespuestasController.java new file mode 100644 index 0000000..ba25114 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/RespuestasController.java @@ -0,0 +1,153 @@ +package com.fp.frontend.controller.armas.eval; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.eval.TarmRespuestas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TgeneCatalog. + * + * @author Andres Cevallos. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RespuestasController extends AbstractController { + + /** + * Constructor + * + * @throws Exception + */ + public RespuestasController() throws Exception { + super(TarmRespuestas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOG"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static List findxPregunta(String pregunta) { + try {//TgeneCatalogDetailKey + RespuestasController cc = new RespuestasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("cpregunta", pregunta); + cc.addFilter("isactive", "Y"); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static String findxPk(Integer pk) { + try {//TgeneCatalogDetailKey + RespuestasController cc = new RespuestasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", pk.toString()); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0).getEscorrecta(); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/eval/TestConocimientosController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/TestConocimientosController.java new file mode 100644 index 0000000..9f44974 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/eval/TestConocimientosController.java @@ -0,0 +1,555 @@ +package com.fp.frontend.controller.armas.eval; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.MovimientoController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.ArmaController; +import com.fp.frontend.controller.armas.parametros.GuardiasController; +import com.fp.frontend.controller.armas.parametros.PreguntasParaEvaluacionesController; +import com.fp.frontend.controller.armas.solicitud.ArmasController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.date.TgeneNotAccountingDayController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.ValidateIdentification; +import com.fp.frontend.webservices.snap.cedula.ClienteCedula; +import com.fp.frontend.webservices.snap.ruc.ClienteRUC; +import com.fp.persistence.parmas.soli.TarmGuardias; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.date.TgeneNotAccountingDay; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +import ec.gob.registrocivil.consultacedula.Cedula; +import ec.gov.sri.wsconsultacontribuyente.Contribuyente; + +/** + * @author Andres Cevallos Clase la cual valida que un usuario pueda rendir una + * evaluacion. Almacena la evaluacion en la Base de Datos + */ +@ManagedBean +@ViewScoped +public class TestConocimientosController extends AbstractController { + + /** + * Persona a ser evaluada + */ + private TcustPersonDetail evaluado; + + /** + * Controlador inyectado EvaluacionController + */ + @ManagedProperty(value = "#{evaluacionController}") + private EvaluacionController evaluacionController; + private TarmGuardias guardia; + /** + * Controlador inyectado DetallePreguntasController + */ + @ManagedProperty(value = "#{detallePreguntasController}") + private DetallePreguntasController detallePreguntas; + + private TcustPersonDetail evaluadoSNAP; + + /** + * Controlador Fecha + */ + private Date fecha; + + /** + * Booleano que activa la opcion de guardar + */ + private Boolean guardar; + /** + * Tipo de persona referenciada en el catalogo + */ + TgeneCatalogDetail lTipoPersona; + /** + * numero de intentos + */ + Integer numeroIntentos; + /** + * intento actual + */ + Long intento; + /** + * Referencia en el catalogo del tipo de evaluacion + */ + private List ltipoevaluacion; + /** + * Lista de las preguntas y respuestas de una evaluacion + */ + private List levaluacion; + private String tipoevaluacion; + + private boolean bloquear = Boolean.FALSE; + + private TcustPersonDetail compania; + + public TestConocimientosController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + + @PostConstruct + private void postconstruct() { + + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "TCONOCIMIENTO"; + setLtipoevaluacion(CatalogDetailController.find("TIPOEVALUACION")); + fecha = new Date(); + tipoevaluacion = "CONOCIMIENTO"; + numeroIntentos = ParametersController.find("INTENTOS", "1").getNumbervalue().intValue(); + guardar = false; + + // CARGAR INFORMACION DEL USUARIO LOGUEADO DEL SNAP + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + evaluado = PersonLovController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + evaluacionController.setTipoTest("CONOCIMIENTO"); + evaluacionController.queryByTipoEvaluacion(tsafeUserDetail.getPk().getPersoncode().toString(), tipoevaluacion); + + guardia = GuardiasController.findxcguardia(evaluado.getPk().getPersoncode().toString()); + lTipoPersona = CatalogDetailController.findxCodigoCodcatalogo(evaluado.getPersontypecatalog(), evaluado.getPersontypecatalogcode()); + +// super.create(); +// this.record.setPersoncode(evaluado.getPk().getPersoncode()); +// this.record.getModifiedData().put("nombre", evaluado.getName()); +// this.record.getModifiedData().put("identificacion", evaluado.getIdentification()); +// this.record.getModifiedData().put("tipopersona", lTipoPersona.getDescription()); + if (evaluado.getIdentification() == null || evaluado.getIdentification() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselacedula")); + return; + } + + if (evaluado.getIdentificationcatalog().equals("CED")) { + // valido validez CEDULA + if (!ValidateIdentification.cedula(evaluado.getIdentification())) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + evaluadoSNAP = buscarPersonaSnap(evaluado.getIdentification(), evaluado.getIdentificationcatalog()); + + } else if (evaluado.getIdentificationcatalog().equals("RUC")) { + // valido validez RUC + if (!ValidateIdentification.ruc(evaluado.getIdentification())) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + evaluadoSNAP = buscarPersonaSnap(evaluado.getIdentification(), evaluado.getIdentificationcatalog()); + } else { + // PASAPORTE + evaluadoSNAP = new TcustPersonDetail(); + evaluadoSNAP.setName(evaluado.getName()); + evaluadoSNAP.setIdentification(evaluado.getIdentification()); + evaluadoSNAP.setIdentificationcatalog("PAS"); + evaluadoSNAP.setIdentificationcatalogcode("IDENTIFICATION"); + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public String getTipoevaluacion() { + return tipoevaluacion; + } + + public void setTipoevaluacion(String tipoevaluacion) { + this.tipoevaluacion = tipoevaluacion; + } + + /** + * Abre el lov donde se realiza la evaluacion. Valida la fecha en la que se + * puede dar la prueba y el numero de intentos + */ + public void openTest() { + if (evaluado == null) { + MessageHelper.setMessageWarn(MsgControlArmas.getProperty("msg_seleccionepersona")); + return; + } + + if (EvaluacionController.find(evaluado.getPk().getPersoncode().toString(), "PSICOLOGICA") == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("lbl_psicologicanecesaria")); + return; + } +// if(guardia==null){ +// MessageHelper.setMessageError(MsgControlArmas.getProperty("lbl_psicologicanecesaria")); +// return; +// } +// if(tipoevaluacion==null){ +// MessageHelper.setMessageWarn(MsgControlArmas.getProperty("msg_tipoevaluacion")); +// } + if (numeroIntentos > EvaluacionController.findIntentosReprobados(evaluado.getPk().getPersoncode().toString(), tipoevaluacion)) { + intento = EvaluacionController.findIntentosReprobados(evaluado.getPk().getPersoncode().toString(), tipoevaluacion).longValue() + 1; + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_numerointentos")); + return; + } +// if(EvaluacionController.findIntentos(evaluado.getPk().getPersoncode().toString(), tipoevaluacion)!=0) +// if(fecha.getTime()< EvaluacionController.findFecha(evaluado.getPk().getPersoncode().toString(), tipoevaluacion).getFechapreox().getTime()){ +// MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_fechaprox") +" " +EvaluacionController.findFecha(evaluado.getPk().getPersoncode().toString(), tipoevaluacion).getFechapreox()); +// return; +// } + + Map> params = new HashMap<>(); + + ConocimientoLovController.openLov(params, evaluado, tipoevaluacion); + + } + + /** + * Funcion que llama a una evaluacion + * + * @param event + * @throws Exception + */ + public void onReturnOpenTest(SelectEvent event) throws Exception { + EvaluacionCompleta eval = new EvaluacionCompleta(); + eval = (EvaluacionCompleta) event.getObject(); + ingresarDatosEvaluacion(); + ingresarDetalleEvaluacion(eval); + guardar = true; + + save(); + } + + /** + * Llama al record de evaluaciones y carga los datos que se llevaran a la + * base + * + * @throws Exception + */ + public void ingresarDatosEvaluacion() throws Exception { + evaluacionController.create(); + Date fecha = new Date(); + Date fechalaboral = new Date(); + Integer dias = null; + try { + dias = ParametersController.find("INTENTOS", "1").getNumbervalue().intValue(); + } catch (Exception e) { + e.printStackTrace(); + } + if (dias == null || dias <= 0) { + dias = 2; + } + Calendar calendario = Calendar.getInstance(); + for (int i = 0; i < dias; i++) { + calendario.add(Calendar.DAY_OF_YEAR, 1); + fechalaboral = isfechalaboral(calendario.getTime()); + calendario.setTime(fechalaboral); + } + try { + evaluacionController.getRecord().setTipoevaluacion(tipoevaluacion); + evaluacionController.getRecord().setTipoevaluacioncodigo("TIPOEVALUACION"); + evaluacionController.getRecord().setFecha(new java.sql.Timestamp(new Date().getTime())); + evaluacionController.getRecord().setFechapreox(new java.sql.Date(fechalaboral.getTime())); + evaluacionController.getRecord().setIntento(intento); + evaluacionController.getRecord().setPersoncode(evaluado.getPk().getPersoncode()); + evaluacionController.getRecord().put("aprobacion", ParametersController.find("VALORAPROBACION", "1").getNumbervalue().floatValue()); + evaluacionController.update(); + } catch (Exception e) { + MessageHelper.setMessageError("PROBLEMAS DE PARAMETRIZACION. CONSULTE AL EVALUADOR"); + } + + } + + /** + * Verifica la fecha laboral + * + * @param fechalaboral + * @return + */ + /** + * @param fechalaboral + * @return + */ + public Date isfechalaboral(Date fechalaboral) { + String month = "0"; + Calendar calendario = Calendar.getInstance(); + calendario.setTime(fechalaboral); + if (calendario.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calendario.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) { + calendario.add(Calendar.DAY_OF_YEAR, 1); + fechalaboral = isfechalaboral(calendario.getTime()); + } + Integer mes = fechalaboral.getMonth(); + if (mes < 10) { + month += mes.toString(); + } else { + month = mes.toString(); + } + if (TgeneNotAccountingDayController.findDaynuevo(month, fechalaboral.getDate())) { + calendario.add(Calendar.DAY_OF_YEAR, 1); + fechalaboral = isfechalaboral(calendario.getTime()); + } + + return fechalaboral; + + } + + /** + * Carga el detalle de la evaluacion + * + * @param eval + * @throws Exception + */ + public void ingresarDetalleEvaluacion(EvaluacionCompleta eval) throws Exception { + + for (Evaluacion eva : eval.getLevaluacion()) { + detallePreguntas.create(); + detallePreguntas.getRecord().setCpregunta(eva.getPregunta().getPk()); + detallePreguntas.getRecord().setCrespuestaingresada(eva.getCodigorespuesta()); + detallePreguntas.getRecord().getModifiedData().put("valor", RespuestasController.findxPk(detallePreguntas.getRecord().getCrespuestaingresada())); + detallePreguntas.update(); + + } + + } + +// /** +// *Abre el lov de persona +// */ +// public void openPersonLov() { +// Map> params = new HashMap<>(); +// PersonLovController.openLov(params); +// } +// /** +// * Love que regresa la informacion de una persona +// * @param event +// * @throws Exception +// */ +// public void onReturnPersonLov(SelectEvent event) throws Exception { +// setEvaluado( (TcustPersonDetail) event.getObject()); +// if(evaluado.getPersontypecatalog()==null){ +// lTipoPersona=null; +// return; +// } +// lTipoPersona=CatalogDetailController.findxCodigoCodcatalogo(evaluado.getPersontypecatalog(), evaluado.getPersontypecatalogcode()); +//// guardia=GuardiasController.findxcguardia(evaluado.getPk().getPersoncode().toString()); +//// if(guardia==null){ +//// MessageHelper.setMessageError(MsgControlArmas.getProperty("lbl_psicologicanecesaria")); +//// } +// } + /** + * Limpia la persona seleccionada + */ + public void limpiar() { + evaluado = null; + lTipoPersona = null; + bloquear = false; + } + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + if (!guardar) { + return; + } + Request request = this.callerhelper.getRequest(); + DtoSave dtosavevaluacion = this.evaluacionController.getDtoSave(true); + HashMap msave = new HashMap(); + msave.put(evaluacionController.getBeanalias(), dtosavevaluacion); // adicionar metadata de mantenimiento para cada tabla. + dtosavevaluacion.setPosition(1); + + DtoSave dtosavepreguntas = this.detallePreguntas.getDtoSave(true); + + msave.put(detallePreguntas.getBeanalias(), dtosavepreguntas); // adicionar metadata de mantenimiento para cada tabla. + dtosavepreguntas.setPosition(2); + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("lbl_examenfinalizado")); + String calificacion = (String) resp.get("result"); + if (calificacion.equals("APR")) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("lbl_aprobado")); + } else { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("lbl_reprobado") + ", Debe Realizar el Test Nuevamente"); //+"."+MsgControlArmas.getProperty("msg_fechaprox") +" " +EvaluacionController.findFecha(evaluado.getPk().getPersoncode().toString(), tipoevaluacion).getFechapreox()); + } + + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } finally { + guardar = false; + evaluacionController.clearAll(); + detallePreguntas.clearAll(); + bloquear = true; + init(); + + } + } + + /** + * Método para buscar a la persona en la snap + * + * @param documento + */ + public TcustPersonDetail buscarPersonaSnap(String documento, String tipoDocumento) { + if (tipoDocumento.equals("CED")) { + Cedula cedula = ClienteCedula.obtenerCedula(documento); + if (cedula != null) { + TcustPersonDetail detail = new TcustPersonDetail(); + detail.setName(cedula.getNombre()); + detail.setIdentification(cedula.getCedula()); + detail.setIdentificationcatalog("CED"); + detail.setIdentificationcatalogcode("IDENTIFICATION"); + return detail; + } else { + return null; + } + } else { + Contribuyente contribuyente = ClienteRUC.obtenerRUC(documento); + if (contribuyente != null) { + TcustPersonDetail detail = new TcustPersonDetail(); + detail.setName(contribuyente.getRazonSocial()); + detail.setIdentification(contribuyente.getNumeroRuc()); + detail.setIdentificationcatalog("RUC"); + detail.setIdentificationcatalogcode("IDENTIFICATION"); + return detail; + } else { + return null; + } + } + } + + public EvaluacionController getEvaluacionController() { + return evaluacionController; + } + + public void setEvaluacionController(EvaluacionController evaluacionController) { + this.evaluacionController = evaluacionController; + } + + public DetallePreguntasController getDetallePreguntas() { + return detallePreguntas; + } + + public void setDetallePreguntas(DetallePreguntasController detallePreguntas) { + this.detallePreguntas = detallePreguntas; + } + + public TcustPersonDetail getEvaluado() { + return evaluado; + } + + public void setEvaluado(TcustPersonDetail evaluado) { + this.evaluado = evaluado; + } + + public List getLtipoevaluacion() { + return ltipoevaluacion; + } + + public void setLtipoevaluacion(List ltipoevaluacion) { + this.ltipoevaluacion = ltipoevaluacion; + } + + public List getLevaluacion() { + return levaluacion; + } + + public void setLevaluacion(List levaluacion) { + this.levaluacion = levaluacion; + } + + public Date getFecha() { + return fecha; + } + + public void setFecha(Date fecha) { + this.fecha = fecha; + } + + public TgeneCatalogDetail getlTipoPersona() { + return lTipoPersona; + } + + public void setlTipoPersona(TgeneCatalogDetail lTipoPersona) { + this.lTipoPersona = lTipoPersona; + } + + public boolean isBloquear() { + return bloquear; + } + + public void setBloquear(boolean bloquear) { + this.bloquear = bloquear; + } + + public TcustPersonDetail getCompania() { + return compania; + } + + public void setCompania(TcustPersonDetail compania) { + this.compania = compania; + } + + public TarmGuardias getGuardia() { + return guardia; + } + + public void setGuardia(TarmGuardias guardia) { + this.guardia = guardia; + } + + public TcustPersonDetail getEvaluadoSNAP() { + return evaluadoSNAP; + } + + public void setEvaluadoSNAP(TcustPersonDetail evaluadoSNAP) { + this.evaluadoSNAP = evaluadoSNAP; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/entries new file mode 100644 index 0000000..97fa85b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/entries @@ -0,0 +1,1082 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ReporteCompInscritaController.java +file + + + + +2022-07-28T03:39:53.170589Z +82c63be7dbdf0c94b02e1226f1964deb +2019-06-04T23:56:53.400737Z +4621 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +13725 + +ReporteTipoArmasController.java +file + + + + +2022-07-28T03:39:53.171589Z +db29e2ec0885914a2a9ff6246d880e28 +2018-12-03T11:43:03.396680Z +4616 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +9339 + +ProvinceLovController.java +file + + + + +2022-07-28T03:39:53.174589Z +4b964478098f8a75598daa5c94e96fb5 +2014-09-08T05:32:36.948396Z +590 +abenalcazar + + + + + + + + + + + + + + + + + + + + + +6230 + +TotalArmasController.java +file + + + + +2022-07-28T03:39:53.174589Z +04f0a0449918f7bc8d04ced51dea5afc +2014-09-08T04:31:57.354359Z +581 +acevallos + + + + + + + + + + + + + + + + + + + + + +4197 + +ReporteCashManagmentController.java +file + + + + +2022-07-28T03:39:53.175589Z +afa0c6471808ac6b72972890ad1fddd6 +2015-11-19T22:50:14.672068Z +4321 +fpazmino + + + + + + + + + + + + + + + + + + + + + +18799 + +VisualizacionSitiosAlmacenamientoController.java +file + + + + +2022-07-28T03:39:53.176589Z +abdc6707337ca16d6c3023df38048d31 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +7284 + +ReporteTipoArma.java +file + + + + +2022-07-28T03:39:53.175589Z +2c316a0eef0605616864287845fa6217 +2019-06-04T23:56:53.400737Z +4621 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +15930 + +ConsultaArmasVentaController.java +file + + + + +2022-07-28T03:39:53.176589Z +2b69a46eccc6e632f6594028b8b44f55 +2015-06-28T11:36:41.606576Z +4151 +cpiedra + + + + + + + + + + + + + + + + + + + + + +5400 + +ReporteImportacionProduccionController.java +file + + + + +2022-07-28T03:39:53.176589Z +7c3ce5acf9a7e723e1faaaf0480147b4 +2015-09-30T04:00:04.739636Z +4289 +fpazmino + + + + + + + + + + + + + + + + + + + + + +11364 + +VentaController.java +file + + + + +2022-07-28T03:39:53.177589Z +1606d2e09b5609b8ef350386d6d8ee8f +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +29720 + +CargaController.java +file + + + + +2022-07-28T03:39:53.177589Z +9415fff3c7432e7384c35f0c9beb735d +2015-12-29T13:56:10.923396Z +4355 +fpazmino + + + + + + + + + + + + + + + + + + + + + +4883 + +ArmaVentaController.java +file + + + + +2022-07-28T03:39:53.177589Z +813ed754eddccb7d1539efc2777b0f37 +2015-06-28T11:36:41.606576Z +4151 +cpiedra + + + + + + + + + + + + + + + + + + + + + +7170 + +ReporteNumArmasEstadoController.java +file + + + + +2022-07-28T03:39:53.178589Z +d610d12e9ee54da017f27047243bb1d4 +2021-05-14T20:37:22.948846Z +4633 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +14043 + +MovimientoController.java +file + + + + +2022-07-28T03:39:53.178589Z +9a7ab3a086693d16e505a6fdf5534039 +2014-10-25T04:23:49.396971Z +1934 +acevallos + + + + + + + + + + + + + + + + + + + + + +3324 + +VentasVariasArmasController.java +file + + + + +2022-07-28T03:39:53.179589Z +a53998e419b17ad4b582e92f23a73390 +2021-05-14T20:37:22.948846Z +4633 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +22075 + +ReporteTipoFabricacionController.java +file + + + + +2022-07-28T03:39:53.170589Z +15bdd636c8ba65cf78200d01eea35297 +2019-06-04T23:56:53.400737Z +4621 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +13859 + +ReportePermisosAutorizacionesSuspController.java +file + + + + +2022-07-28T03:39:53.170589Z +109bca65ade5290bcc0363e0415d9d7b +2021-09-08T20:05:22.862791Z +4642 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +6217 + +RegistroArmController.java +file + + + + +2022-07-28T03:39:53.171589Z +f0077208209612d0674d481395df3e2e +2015-07-11T05:56:57.512540Z +4192 +fpazmino + + + + + + + + + + + + + + + + + + + + + +5086 + +DesaduanizacionOldController.java +file + + + + +2022-07-28T03:39:53.171589Z +72994dd7d67842ca0dd98837ca5e65b4 +2016-04-18T16:22:46.835695Z +4536 +fpazmino + + + + + + + + + + + + + + + + + + + + + +17430 + +DesaduanizacionController.java +file + + + + +2022-07-28T03:39:53.172589Z +85407c0209b8c2101dcecdb5ebc3acc4 +2019-01-14T03:06:37.641608Z +4617 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +21623 + +ReporteCompaniasCCentrol.java +file + + + + +2022-07-28T03:39:53.172589Z +195a816334625f52a5fee305eeb109b7 +2021-05-14T20:37:22.948846Z +4633 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +13834 + +ReporteDecomisoController.java +file + + + + +2022-07-28T03:39:53.173589Z +3455b4ca97dbfcb17fdbbf7d4001aad8 +2015-03-04T10:57:48.692824Z +3896 +dlopez + + + + + + + + + + + + + + + + + + + + + +11524 + +ReporteTipoAutorizacionController.java +file + + + + +2022-07-28T03:39:53.173589Z +6a38b78664677c59eefdd3765d7efbe2 +2019-06-04T23:56:53.400737Z +4621 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +15900 + +ReporteArmasController.java +file + + + + +2022-07-28T03:39:53.173589Z +3f7b67b51aea35cdeae92e957176dafe +2021-12-15T03:30:14.444318Z +4658 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +14548 + +ReporteArmasPrevImportacionController.java +file + + + + +2022-07-28T03:39:53.174589Z +df6b7e3f3ee87d697893bec403be0b25 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +2766 + +CargaDetalleController.java +file + + + + +2022-07-28T03:39:53.175589Z +8be65f0c88d8184609bcdb6455a9dde7 +2015-12-29T13:56:10.923396Z +4355 +fpazmino + + + + + + + + + + + + + + + + + + + + + +3439 + +VentaTraspasoDominioController.java +file + + + + +2022-07-28T03:39:53.176589Z +d017224d9e7f1038cb3c0131bcfa2f73 +2021-05-14T20:37:22.948846Z +4633 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +10790 + +ArmaExcell.java +file + + + + +2022-07-28T03:39:53.175589Z +75fd7088b92bc8223825aef799aee156 +2014-10-22T10:19:20.410968Z +1838 +ogarcia + + + + + + + + + + + + + + + + + + + + + +6969 + +ReporteTramiteCentroController.java +file + + + + +2022-07-28T03:39:53.177589Z +b5250d142045f5f9be3732160108e4d0 +2016-03-18T22:08:37.710677Z +4517 +fpazmino + + + + + + + + + + + + + + + + + + + + + +13459 + +ReporteNumPermisosController.java +file + + + + +2022-07-28T03:39:53.178589Z +dfad06bad8039e7ce96f5e85c9a18416 +2019-06-04T23:56:53.400737Z +4621 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +15005 + +ReportePermisosAutorizacionesCconController.java +file + + + + +2022-07-28T03:39:53.178589Z +cb683ae5d00242beaea5b3a922fe4a86 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +4793 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ArmaExcell.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ArmaExcell.java.svn-base new file mode 100644 index 0000000..d0457ce --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ArmaExcell.java.svn-base @@ -0,0 +1,302 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.parmas.param.TarmComercianteCupo; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +//import com.fp.persistence.parmas.soli.TarmArmasProduccion; +import com.fp.persistence.parmas.soli.TarmCustodiaTemporal; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + + +public class ArmaExcell { + + private String textoNumero; + private int numero; + + private String serie; + private String clase; + private String longitud; + private String tipo; + private String calibre; + private String color; + private String marca; + + private String textoCantidad; + private double cantidad; + + private String unidadMedidaCantidad; + + private String textoPeso; + private double peso; + + private String unidadMedidaPeso; + + private Boolean camposIncompletos=false; + private Boolean duplicada=false; + private Boolean existeCatalogo=false; + private Boolean existeTARMTIPOARMAEXPLOSIVO=false; + private Boolean cupoInsuficiente=false; + private Boolean existeBaseDatos=false; + + private TgeneCatalogDetail catalogoColor; + private TgeneCatalogDetail catalogoMarca; + private TgeneCatalogDetail catalogoClase; + private TgeneCatalogDetail catalogoLongitud; + private TgeneCatalogDetail catalogoTipoArma; + private TgeneCatalogDetail catalogoCalibre; + + private TarmComercianteCupo cupo; + private TarmTotalPersona totalPersona; + private TarmTipoArmaExplosivo tipoArmaExplosivo; + private TarmArmas arma; + //private TarmArmasProduccion arma; + + public ArmaExcell() { + super(); + // TODO Auto-generated constructor stub + } + + public int getNumero() { + return numero; + } + public void setNumero(int numero) { + this.numero = numero; + } + public String getSerie() { + return serie; + } + public void setSerie(String serie) { + this.serie = serie; + } + public String getClase() { + return clase; + } + public void setClase(String clase) { + this.clase = clase; + } + public String getLongitud() { + return longitud; + } + public void setLongitud(String longitud) { + this.longitud = longitud; + } + public String getTipo() { + return tipo; + } + public void setTipo(String tipo) { + this.tipo = tipo; + } + public String getCalibre() { + return calibre; + } + public void setCalibre(String calibre) { + this.calibre = calibre; + } + public String getColor() { + return color; + } + public void setColor(String color) { + this.color = color; + } + public String getMarca() { + return marca; + } + public void setMarca(String marca) { + this.marca = marca; + } + + public double getCantidad() { + return cantidad; + } + + public void setCantidad(double cantidad) { + this.cantidad = cantidad; + } + + public double getPeso() { + return peso; + } + + public void setPeso(double peso) { + this.peso = peso; + } + + public Boolean getCamposIncompletos() { + return camposIncompletos; + } + public void setCamposIncompletos(Boolean camposIncompletos) { + this.camposIncompletos = camposIncompletos; + } + + public String getTextoNumero() { + return textoNumero; + } + + public void setTextoNumero(String textoNumero) { + this.textoNumero = textoNumero; + } + + public String getTextoCantidad() { + return textoCantidad; + } + + public void setTextoCantidad(String textoCantidad) { + this.textoCantidad = textoCantidad; + } + + public String getTextoPeso() { + return textoPeso; + } + + public void setTextoPeso(String textoPeso) { + this.textoPeso = textoPeso; + } + + public String getUnidadMedidaCantidad() { + return unidadMedidaCantidad; + } + + public void setUnidadMedidaCantidad(String unidadMedidaCantidad) { + this.unidadMedidaCantidad = unidadMedidaCantidad; + } + + public String getUnidadMedidaPeso() { + return unidadMedidaPeso; + } + + public void setUnidadMedidaPeso(String unidadMedidaPeso) { + this.unidadMedidaPeso = unidadMedidaPeso; + } + + public Boolean getDuplicada() { + return duplicada; + } + + public void setDuplicada(Boolean duplicada) { + this.duplicada = duplicada; + } + + public Boolean getExisteCatalogo() { + return existeCatalogo; + } + + public void setExisteCatalogo(Boolean existeCatalogo) { + this.existeCatalogo = existeCatalogo; + } + + public Boolean getExisteTARMTIPOARMAEXPLOSIVO() { + return existeTARMTIPOARMAEXPLOSIVO; + } + + public void setExisteTARMTIPOARMAEXPLOSIVO(Boolean existeTARMTIPOARMAEXPLOSIVO) { + this.existeTARMTIPOARMAEXPLOSIVO = existeTARMTIPOARMAEXPLOSIVO; + } + + public Boolean getCupoInsuficiente() { + return cupoInsuficiente; + } + + public void setCupoInsuficiente(Boolean cupoInsuficiente) { + this.cupoInsuficiente = cupoInsuficiente; + } + + public TgeneCatalogDetail getCatalogoColor() { + return catalogoColor; + } + + public void setCatalogoColor(TgeneCatalogDetail catalogoColor) { + this.catalogoColor = catalogoColor; + } + + public TgeneCatalogDetail getCatalogoMarca() { + return catalogoMarca; + } + + public void setCatalogoMarca(TgeneCatalogDetail catalogoMarca) { + this.catalogoMarca = catalogoMarca; + } + + public TgeneCatalogDetail getCatalogoClase() { + return catalogoClase; + } + + public void setCatalogoClase(TgeneCatalogDetail catalogoClase) { + this.catalogoClase = catalogoClase; + } + + public TgeneCatalogDetail getCatalogoLongitud() { + return catalogoLongitud; + } + + public void setCatalogoLongitud(TgeneCatalogDetail catalogoLongitud) { + this.catalogoLongitud = catalogoLongitud; + } + + public TgeneCatalogDetail getCatalogoTipoArma() { + return catalogoTipoArma; + } + + public void setCatalogoTipoArma(TgeneCatalogDetail catalogoTipoArma) { + this.catalogoTipoArma = catalogoTipoArma; + } + + public TgeneCatalogDetail getCatalogoCalibre() { + return catalogoCalibre; + } + + public void setCatalogoCalibre(TgeneCatalogDetail catalogoCalibre) { + this.catalogoCalibre = catalogoCalibre; + } + + public TarmComercianteCupo getCupo() { + return cupo; + } + + public void setCupo(TarmComercianteCupo cupo) { + this.cupo = cupo; + } + + public Boolean getExisteBaseDatos() { + return existeBaseDatos; + } + + public void setExisteBaseDatos(Boolean existeBaseDatos) { + this.existeBaseDatos = existeBaseDatos; + } + + public TarmTotalPersona getTotalPersona() { + return totalPersona; + } + + public void setTotalPersona(TarmTotalPersona totalPersona) { + this.totalPersona = totalPersona; + } + + public TarmTipoArmaExplosivo getTipoArmaExplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoArmaExplosivo(TarmTipoArmaExplosivo tipoArmaExplosivo) { + this.tipoArmaExplosivo = tipoArmaExplosivo; + } + + public TarmArmas getArma() { + return arma; + } + + public void setArma(TarmArmas arma) { + this.arma = arma; + } + + /* + public TarmArmasProduccion getArma() { + return arma; + } + + public void setArma(TarmArmasProduccion arma) { + this.arma = arma; + } + */ + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ArmaVentaController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ArmaVentaController.java.svn-base new file mode 100644 index 0000000..c31c858 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ArmaVentaController.java.svn-base @@ -0,0 +1,189 @@ +package com.fp.frontend.controller.armas.funcionalidad; + + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + + + +/** + * @author Andres Cevallos + * Clase Controladora para la entidad TarmArma + * Incluye metodo de consulta para la busqueda de persona y registro + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ArmaVentaController extends AbstractController { + + //Variabgles globales + + /** + *String el cual tendr un nombre de filtro + */ + private String csolicitud; + + + public ArmaVentaController() throws Exception { + super(TarmArmas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.record=new TarmArmas(); + this.beanalias = "ARMAS"; + this.filtro(); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + //this.addFilter("estado", "REG"); + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TarmTipoArmaExplosivo","clase","cclase","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo= new SubQuery("TarmTipoArmaExplosivo","clasecodigo","cclasecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud= new SubQuery("TarmTipoArmaExplosivo","longitud","clongitud","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo= new SubQuery("TarmTipoArmaExplosivo","longitudcodigo","clongitudcodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ccalibre","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo= new SubQuery("TarmTipoArmaExplosivo","calibrecodigo","ccalibrecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivo","ctipoarmaexplosivo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivocodigo","ctipoarmaexplosivocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapeso","cunidadmedidapeso","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapesocodigo","cunidadmedidapesocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + + //Filter filtrofecha=new Filter(); + //filtrofecha.setSql( + String filtrofecha= "t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) " + + " and t.estado in("+MsgControlArmas.getProperty("codigo_estado_arma_busqueda_venta")+") and (t.peso>0 or t.cantidad>0)"; + //dto.addFiltro(filtrofecha); + + String sql=csolicitud; + if(csolicitud!=null){ + Filter filtro = new Filter(); + filtro.setSql(filtrofecha +" and "+sql); + dto.addFiltro(filtro); + } + else{ + return; + } + + dto.setOrderby("pk"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para armar el registro + * @param lsolicitud + * @throws Exception + */ + public void filtro() throws Exception{ + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + RegistroArmController registroArmas = new RegistroArmController(); + registroArmas.init(); + registroArmas.setRecperpage(3000000); + registroArmas.addFilter("personcode", tsafeUserDetail.getPk().getPersoncode().toString()); + registroArmas.query(); + + for(TarmRegistroArmas soli : registroArmas.getLrecord()){ + if(csolicitud==null){ + csolicitud="(cregistro="+soli.getPk(); + } + else{ + csolicitud+=" or cregistro="+soli.getPk(); + } + } + csolicitud+=")"; + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/CargaController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/CargaController.java.netbeans-base new file mode 100644 index 0000000..8dd67f2 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/CargaController.java.netbeans-base @@ -0,0 +1,171 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.InventarioSubidoController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.fun.TarmInventarioSubidoPorPersona; +import com.fp.persistence.parmas.soli.TarmArmas; + +/** + * Clase controladora del bean TarmCarga. + * + * @author Christian Pazmino + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CargaController extends AbstractController { + + /** + * Constructor + * @throws Exception + */ + public CargaController() throws Exception { + super(TarmCarga.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CARGA"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + public void update(TarmCarga bean) throws Exception { + this.setRecord(bean); + super.update(); + } + + + /** + * Obtiene una carga por codigo AUCP + * @param codigopersona + * @return + */ + public static TarmCarga findByAUCP(String aucp) { + try { + CargaController cc = new CargaController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("aucp", aucp); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Entrega una lista de objetos TarmCarga + * @param personcode categoria + * @return lrecord Lista de objetos TarmCarga + */ + public static List findXPersonaYCategoria(String personcode, String categoria, String tipoCarga) { + try { + CargaController cc = new CargaController(); + cc.init(); + cc.recperpage = 1000; + cc.addFilter("personcode", personcode); + cc.addFilter("categoria", categoria); + cc.addFilter("tipocarga", tipoCarga); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/CargaController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/CargaController.java.svn-base new file mode 100644 index 0000000..8dd67f2 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/CargaController.java.svn-base @@ -0,0 +1,171 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.InventarioSubidoController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.fun.TarmInventarioSubidoPorPersona; +import com.fp.persistence.parmas.soli.TarmArmas; + +/** + * Clase controladora del bean TarmCarga. + * + * @author Christian Pazmino + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CargaController extends AbstractController { + + /** + * Constructor + * @throws Exception + */ + public CargaController() throws Exception { + super(TarmCarga.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CARGA"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + public void update(TarmCarga bean) throws Exception { + this.setRecord(bean); + super.update(); + } + + + /** + * Obtiene una carga por codigo AUCP + * @param codigopersona + * @return + */ + public static TarmCarga findByAUCP(String aucp) { + try { + CargaController cc = new CargaController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("aucp", aucp); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Entrega una lista de objetos TarmCarga + * @param personcode categoria + * @return lrecord Lista de objetos TarmCarga + */ + public static List findXPersonaYCategoria(String personcode, String categoria, String tipoCarga) { + try { + CargaController cc = new CargaController(); + cc.init(); + cc.recperpage = 1000; + cc.addFilter("personcode", personcode); + cc.addFilter("categoria", categoria); + cc.addFilter("tipocarga", tipoCarga); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/CargaDetalleController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/CargaDetalleController.java.svn-base new file mode 100644 index 0000000..ca297c1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/CargaDetalleController.java.svn-base @@ -0,0 +1,120 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmCargaDetalle; + +/** + * Clase controladora del bean TarmCargaDetalle. + * + * @author Christian Pazmino + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CargaDetalleController extends AbstractController { + + /** + * Constructor + * @throws Exception + */ + public CargaDetalleController() throws Exception { + super(TarmCargaDetalle.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CARGADETALLE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + public void update(TarmCargaDetalle bean) throws Exception { + this.setRecord(bean); + super.update(); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ConsultaArmasVentaController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ConsultaArmasVentaController.java.svn-base new file mode 100644 index 0000000..8de32ed --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ConsultaArmasVentaController.java.svn-base @@ -0,0 +1,124 @@ +package com.fp.frontend.controller.armas.funcionalidad; + + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ConsultaArmasVentaController extends AbstractController { + + public ConsultaArmasVentaController() throws Exception { + super(TarmArmas.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + private void init() { + try { + this.recperpage = 15; + this.lrecord = new ArrayList<>(); + this.record=new TarmArmas(); + this.beanalias = "CONSULTAARMASVENTA"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TarmTipoArmaExplosivo","clase","cclase","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo= new SubQuery("TarmTipoArmaExplosivo","clasecodigo","cclasecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud= new SubQuery("TarmTipoArmaExplosivo","longitud","clongitud","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo= new SubQuery("TarmTipoArmaExplosivo","longitudcodigo","clongitudcodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ccalibre","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo= new SubQuery("TarmTipoArmaExplosivo","calibrecodigo","ccalibrecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivo","ctipoarmaexplosivo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivocodigo","ctipoarmaexplosivocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapeso","cunidadmedidapeso","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapesocodigo","cunidadmedidapesocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + + Filter filtro=new Filter(); + String filtrofecha= "t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) " + + " and t.estado in("+MsgControlArmas.getProperty("codigo_estado_arma_busqueda_venta")+")"; + filtro.setSql(filtrofecha); + dto.addFiltro(filtro); + dto.setOrderby("pk"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); +// request.put("queryalias", "ARMASCOMPLETE"); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/DesaduanizacionController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/DesaduanizacionController.java.svn-base new file mode 100644 index 0000000..7d53aea --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/DesaduanizacionController.java.svn-base @@ -0,0 +1,505 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.solicitud.DocumentoHabilitanteController; +import com.fp.frontend.controller.armas.solicitud.SolicitudController; +import com.fp.frontend.controller.armas.solicitud.SolicitudTramiteController; +import com.fp.frontend.controller.armas.solicitud.TarmSolicitudTramiteController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class DesaduanizacionController extends AbstractController { + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{solicitudTramiteController}") + private SolicitudTramiteController tarmSolicitudTramiteController; + + private Date fechaDesaduanizacion; + private List tramites; + //private TarmTramite tramiteSeleccionado; + private String noSolicitud; + //private List larmas=new ArrayList(); + private Boolean salvarDeshabilitado=false; + + private TsafeUserDetail tsafeUserDetailUsuario = null; + + /** + * Listado de colores + */ + private List lcolor; + + /*@ManagedProperty(value = "#{tarmSolicitudArmasController}") + private TarmSolicitudArmasController tarmSolicitudArmasController;*/ + + + public DesaduanizacionController() throws Exception { + super(TarmArmas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta +// super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + noSolicitud = null; +// this.record=new TarmArmas(); + this.beanalias = "DESADUANIZACION"; + lcolor = CatalogDetailController.find("COLOR"); + this.create(); + + //Fecha de desaduanizacion + this.fechaDesaduanizacion=Calendar.getInstance().getTime(); + + //Cargando los tramites + caragarTramiteSolicitud(); + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + this.salvarDeshabilitado = true; + + tarmSolicitudTramiteController.create(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void caragarTramiteSolicitud(){ + this.tramites=TarmSolicitudTramiteController.findTramites(); + } + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception{ + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TarmTipoArmaExplosivo","clase","cclase","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo= new SubQuery("TarmTipoArmaExplosivo","clasecodigo","cclasecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud= new SubQuery("TarmTipoArmaExplosivo","longitud","clongitud","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo= new SubQuery("TarmTipoArmaExplosivo","longitudcodigo","clongitudcodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ccalibre","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo= new SubQuery("TarmTipoArmaExplosivo","calibrecodigo","ccalibrecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivo","ctipoarmaexplosivo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivocodigo","ctipoarmaexplosivocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapeso","cunidadmedidapeso","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapesocodigo","cunidadmedidapesocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida= new SubQuery("TgeneCatalogDetail","description","unidadmedida","i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode= new SubQuery("TarmRegistroArmas","personcode","personcode","i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + SubQuery subqueryTipo= new SubQuery("TgeneCatalogDetail","description","tipo","i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipo); + + SubQuery subqueryCalibreD= new SubQuery("TgeneCatalogDetail","description","calibreD","i.pk.catalog= (select o.calibre from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.calibrecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryCalibreD); + + SubQuery subqueryTipoArmaExplosivo= new SubQuery("TgeneCatalogDetail","description","tipoarmaexplosivo","i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + + dto.addSubQuery(subqueryTipoArmaExplosivo); + SubQuery subqueryClasecatalogo= new SubQuery("TgeneCatalogDetail","description","clase","i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClasecatalogo); + return dto; + } + + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + Filter filtro = new Filter(); + if(this.getMfilelds().get("cregistro") != null){ + filtro.setSql(this.getMfilelds().get("cregistro").toString() +" and t.estado = 'IMPO' and t.lote is null " + + " and t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro)" + + " and t.pk in (select tar.codigoarma from TarmArmas tar where tar.pk in( select ar.pk.carma from TarmSolicitudArmas ar where ar.pk.csolicitud= '"+this.noSolicitud+"'))" + + " and (t.peso>0 or t.cantidad>0)"); + dto.addFiltro(filtro); + } + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); +// for(int i = 0; i(); +// MessageHelper.setMessageError(resp); +// } else { +// lrecord = (List) resp.get(beanalias); +// if(!lrecord.isEmpty()){ +// record=lrecord.get(0); +// } +// super.postQuery(lrecord); +// Collections.sort(lrecord,new Comparator(){ +// public int compare(TarmArmas f1, TarmArmas f2) +// { +// return f1.getModifiedData().get("tipo").toString().compareTo(f1.getModifiedData().get("tipo").toString()); +// } +// }); +// } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public boolean validarSerieDuplicadas(){ + Set lista= new HashSet(); + for(TarmArmas ar:this.lrecord){ + lista.add(ar.getLote()); + } + if(this.lrecord.size()>lista.size()){ + return true; + } + return false; + + } + + + @Override + public void save() { + try { + for(TarmArmas armas:this.lrecord){ + this.record = armas; + this.record.setEstado("REG"); + this.record.setColorcodigo("COLOR"); + Calendar calendario=Calendar.getInstance(); + calendario.setTime(this.fechaDesaduanizacion); + this.record.setFdesaduanizacion(new java.sql.Date(calendario.getTimeInMillis())); + if(this.record.getLote() != null){ + if(this.validarSerieDuplicadas()){ + MessageHelper.setMessageError("LOS ARTCULOS NO PUEDEN TENER SERIES IGUALES"); + return; + } + update(); + }else { + StringBuilder err=new StringBuilder("EL CAMPO SERIE NO PUEDE ESTAR VACO"); + //err.append(this.record.getPk()); + MessageHelper.setMessageError(err.toString()); + return; + } + + } + HashMap msave = new HashMap(); + Request request = callerhelper.getRequest(); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + for(TarmSolicitudTramite tramite:tramites){ + if(this.noSolicitud.equals(tramite.getPk().getCsolicitud())){ + tarmSolicitudTramiteController.setRecord(tramite); + break; + } + } + + +// tarmSolicitudTramiteController.getRecord().setEstadotramite("FIN"); +// tarmSolicitudTramiteController.update(); +// DtoSave dtosaveTramite = tarmSolicitudTramiteController.getDtoSave(); +// msave.put(tarmSolicitudTramiteController.getBeanalias(), dtosaveTramite); // adicionar metadata de mantenimiento para cada tabla. + request.getModifiedData().put("noSolicitud", noSolicitud); + request.setSaveTables(msave); + request.getModifiedData().put("REQUIEREDESGLOCE", Boolean.FALSE); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); +// tarmSolicitudTramiteController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + this.salvarDeshabilitado=true; + caragarTramiteSolicitud(); + this.query(); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void desaduanizarArmas() { + try { + System.out.println("*** INICIA PROCESO DESADUANIZACION ARMAS: " + noSolicitud); + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + TarmSolicitud solicitudObj = SolicitudController.findSolicitudxcodsolicitud(noSolicitud); + if(solicitudObj!=null){ + request.getModifiedData().put("SOLICITUD", solicitudObj); + request.getModifiedData().put("REQUIEREDESGLOCE", Boolean.TRUE); + } + else{ + MessageHelper.setMessageError("NO EXISTE UN CODIGO DE AUCP ASOCIADO A LA SOLICITUD"); + return; + } + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + querydatabase(); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + +// try { +// System.out.println("*** INICIA PROCESO DESADUANIZACION ARMAS: " + noSolicitud); +// Request request = this.callerhelper.getRequest(); +//// request.modifiedData().put("querytype", "P"); +//// request.modifiedData().put("queryalias", "DESGLOCEDESADUANIZACION"); +// TarmSolicitud solicitudObj = SolicitudController.findSolicitudxcodsolicitud(noSolicitud); +// if(solicitudObj!=null){ +// request.getModifiedData().put("SOLICITUD", solicitudObj); +// } +// else{ +// MessageHelper.setMessageError("NO EXISTE UN CODIGO DE AUCP ASOCIADO A LA SOLICITUD"); +// return; +// } +// Response resp = this.callerhelper.executeQuery(request); +// if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { +// this.lrecord = new ArrayList(); +// MessageHelper.setMessageError(resp); +// } else { +// this.lrecord = (List) resp.get(this.beanalias); +// } +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// } + } + + /** + * Obtiene un arma por su codigo + * @param codigopersona + * @return + */ + public static TarmArmas findByCode(String carma) { + try { + DesaduanizacionController cc = new DesaduanizacionController(); + cc.init(); + cc.recperpage = 300000; + cc.addFilter("pk", carma); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public Date getFechaDesaduanizacion() { + return fechaDesaduanizacion; + } + + public void setFechaDesaduanizacion(Date fechaDesaduanizacion) { + this.fechaDesaduanizacion = fechaDesaduanizacion; + } + + public void setDatos(final AjaxBehaviorEvent event){ + try { + TarmSolicitudTramite soltra = TarmSolicitudTramiteController.findPorCSolicitud(this.noSolicitud); + // Verificacion del desgloce de desaduanizacion + TarmSolicitud solicitudObj = SolicitudController.findSolicitudxcodsolicitud(soltra.getPk().getCsolicitud()); + TarmCarga carga = CargaController.findByAUCP(solicitudObj.getAucp()); + + this.record=new TarmArmas(); + this.record.modifiedData().put("tipotramitedesc", soltra.modifiedData().get("tipotramitedesc")); + this.record.modifiedData().put("categoriadesc", soltra.modifiedData().get("categoriadesc")); + this.record.modifiedData().put("usodesc", soltra.modifiedData().get("usodesc")); + this.record.modifiedData().put("cedula", soltra.modifiedData().get("cedula")); + this.record.modifiedData().put("nombre", soltra.modifiedData().get("nombre")); + this.record.modifiedData().put("personcode", soltra.modifiedData().get("personcode")); + this.record.modifiedData().put("aucp", (solicitudObj.getAucp()!=null&&!solicitudObj.getAucp().isEmpty())?solicitudObj.getAucp():""); + TarmCentroControl centroControlObj = CentroControlArmasController.findPorCodigo(solicitudObj.getCcentrocontrol()); + if(centroControlObj!=null){ + String ccentrocontrol = CatalogDetailController.findxCodigoCodcatalogo( centroControlObj.getNombreinstitucion(), + centroControlObj.getNombreinstitucioncodigo()).getDescription(); + this.record.modifiedData().put("nombreCentroControl",(ccentrocontrol!=null&&!ccentrocontrol.isEmpty())?ccentrocontrol:""); + } + + TarmDocumentoHabilitante dochab = DocumentoHabilitanteController.findPorSolicitud(this.noSolicitud); + if(dochab != null){ + this.record.modifiedData().put("fechaemision", dochab.getFechaemision()); + } + + //cregistro propietario +// List regArmas = RegistroArmController.findxPersoncode(soltra.modifiedData().get("personcode").toString()); +// StringBuilder sql = new StringBuilder("cregistro in"); +// Integer aux=0; +// for(TarmRegistroArmas t :regArmas){ +// if(aux==0){ +// sql.append("("+t.getPk()); +// aux++; +// }else{ +// sql.append(","+t.getPk()); +// } +// } +// sql.append(")"); + //armas codigoarma que debe filtar + String sql = "cregistro in (Select r.pk from TarmRegistroArmas r where personcode="+soltra.modifiedData().get("personcode").toString()+")"; + addField("cregistro", sql); + this.salvarDeshabilitado = true; + if(carga.getEsdesaduanizado().equals("N")){ + RequestContext.getCurrentInstance().execute("PF('dialog').show()"); + } + else{ + querydatabase(); + + } + } catch (Exception e) { + // TODO: handle exception + } + } + + /** + * Metodo que indica las acciones asociadas de cerrar el dialogo sin desanuanizar + */ + public void cerrar() { + init(); + } + + public void habilitaGrabar(final AjaxBehaviorEvent event){ + Integer aux=0; + for(TarmArmas armas:this.lrecord){ + if(!this.lrecord.isEmpty() && armas.getLote() != null){ + aux++; + } + } + if(aux.compareTo(this.lrecord.size()) == 0){ + this.salvarDeshabilitado = false; + } + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + + public List getTramites() { + return tramites; + } + + public void setTramites(List tramites) { + this.tramites = tramites; + } + + public String getNoSolicitud() { + return noSolicitud; + } + + public void setNoSolicitud(String noSolicitud) { + this.noSolicitud = noSolicitud; + } + + public Boolean getSalvarDeshabilitado() { + return salvarDeshabilitado; + } + + public void setSalvarDeshabilitado(Boolean salvarDeshabilitado) { + this.salvarDeshabilitado = salvarDeshabilitado; + } + + public SolicitudTramiteController getTarmSolicitudTramiteController() { + return tarmSolicitudTramiteController; + } + + public void setTarmSolicitudTramiteController( + SolicitudTramiteController tarmSolicitudTramiteController) { + this.tarmSolicitudTramiteController = tarmSolicitudTramiteController; + } + + public List getLcolor() { + return lcolor; + } + + public void setLcolor(List lcolor) { + this.lcolor = lcolor; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/DesaduanizacionOldController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/DesaduanizacionOldController.java.svn-base new file mode 100644 index 0000000..a417e6c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/DesaduanizacionOldController.java.svn-base @@ -0,0 +1,408 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.solicitud.DocumentoHabilitanteController; +import com.fp.frontend.controller.armas.solicitud.SolicitudTramiteController; +import com.fp.frontend.controller.armas.solicitud.TarmSolicitudArmasController; +import com.fp.frontend.controller.armas.solicitud.TarmSolicitudTramiteController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.eval.TarmDetallePreguntas; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.ins.TarmPlanificacionTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class DesaduanizacionOldController extends AbstractController { + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{solicitudTramiteController}") + private SolicitudTramiteController tarmSolicitudTramiteController; + + private Date fechaDesaduanizacion; + private List tramites; + //private TarmTramite tramiteSeleccionado; + private String noSolicitud; + //private List larmas=new ArrayList(); + private Boolean salvarDeshabilitado=false; + + private TsafeUserDetail tsafeUserDetailUsuario = null; + + /*@ManagedProperty(value = "#{tarmSolicitudArmasController}") + private TarmSolicitudArmasController tarmSolicitudArmasController;*/ + + + public DesaduanizacionOldController() throws Exception { + super(TarmArmas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta +// super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. +// this.lrecord = new ArrayList<>(); +// this.record=new TarmArmas(); + this.beanalias = "DESADUANIZACION"; +// this.create(); + + //Fecha de desaduanizacion + this.fechaDesaduanizacion=Calendar.getInstance().getTime(); + + //Cargando los tramites + caragarTramiteSolicitud(); + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + this.salvarDeshabilitado = true; + + tarmSolicitudTramiteController.create(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void caragarTramiteSolicitud(){ + this.tramites=TarmSolicitudTramiteController.findTramites(); + } + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception{ + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TarmTipoArmaExplosivo","clase","cclase","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo= new SubQuery("TarmTipoArmaExplosivo","clasecodigo","cclasecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud= new SubQuery("TarmTipoArmaExplosivo","longitud","clongitud","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo= new SubQuery("TarmTipoArmaExplosivo","longitudcodigo","clongitudcodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ccalibre","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo= new SubQuery("TarmTipoArmaExplosivo","calibrecodigo","ccalibrecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivo","ctipoarmaexplosivo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivocodigo","ctipoarmaexplosivocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapeso","cunidadmedidapeso","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapesocodigo","cunidadmedidapesocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida= new SubQuery("TgeneCatalogDetail","description","unidadmedida","i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode= new SubQuery("TarmRegistroArmas","personcode","personcode","i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + SubQuery subqueryTipo= new SubQuery("TgeneCatalogDetail","description","tipo","i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipo); + + SubQuery subqueryCalibreD= new SubQuery("TgeneCatalogDetail","description","calibreD","i.pk.catalog= (select o.calibre from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.calibrecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryCalibreD); + + SubQuery subqueryTipoArmaExplosivo= new SubQuery("TgeneCatalogDetail","description","tipoarmaexplosivo","i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + + dto.addSubQuery(subqueryTipoArmaExplosivo); + SubQuery subqueryClasecatalogo= new SubQuery("TgeneCatalogDetail","description","clase","i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClasecatalogo); + return dto; + } + + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + Filter filtro = new Filter(); + if(this.getMfilelds().get("cregistro") != null){ + filtro.setSql(this.getMfilelds().get("cregistro").toString() +" and t.estado = 'IMPO' and t.lote is null " + + " and t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro)" + + " and t.pk in (select tar.codigoarma from TarmArmas tar where tar.pk in( select ar.pk.carma from TarmSolicitudArmas ar where ar.pk.csolicitud= '"+this.noSolicitud+"'))" + + " and (t.peso>0 or t.cantidad>0)"); + dto.addFiltro(filtro); + } + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); +// for(int i = 0; i(); +// MessageHelper.setMessageError(resp); +// } else { +// lrecord = (List) resp.get(beanalias); +// if(!lrecord.isEmpty()){ +// record=lrecord.get(0); +// } +// super.postQuery(lrecord); +// Collections.sort(lrecord,new Comparator(){ +// public int compare(TarmArmas f1, TarmArmas f2) +// { +// return f1.getModifiedData().get("tipo").toString().compareTo(f1.getModifiedData().get("tipo").toString()); +// } +// }); +// } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public boolean validarSerieDuplicadas(){ + Set lista= new HashSet(); + for(TarmArmas ar:this.lrecord){ + lista.add(ar.getLote()); + } + if(this.lrecord.size()>lista.size()){ + return true; + } + return false; + + } + + + @Override + public void save() { + try { + for(TarmArmas armas:this.lrecord){ + this.record = armas; + this.record.setEstado("REG"); + Calendar calendario=Calendar.getInstance(); + calendario.setTime(this.fechaDesaduanizacion); + this.record.setFdesaduanizacion(new java.sql.Date(calendario.getTimeInMillis())); + if(this.record.getLote() != null){ + if(this.validarSerieDuplicadas()){ + MessageHelper.setMessageError("LOS ARTCULOS NO PUEDEN TENER SERIES IGUALES"); + return; + } + update(); + }else { + StringBuilder err=new StringBuilder("EL CAMPO SERIE NO PUEDE ESTAR VACO"); + //err.append(this.record.getPk()); + MessageHelper.setMessageError(err.toString()); + return; + + } + + } + HashMap msave = new HashMap(); + Request request = callerhelper.getRequest(); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + for(TarmSolicitudTramite tramite:tramites){ + if(this.noSolicitud.equals(tramite.getPk().getCsolicitud())){ + tarmSolicitudTramiteController.setRecord(tramite); + break; + } + } + + +// tarmSolicitudTramiteController.getRecord().setEstadotramite("FIN"); +// tarmSolicitudTramiteController.update(); +// DtoSave dtosaveTramite = tarmSolicitudTramiteController.getDtoSave(); +// msave.put(tarmSolicitudTramiteController.getBeanalias(), dtosaveTramite); // adicionar metadata de mantenimiento para cada tabla. + request.getModifiedData().put("noSolicitud", noSolicitud); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); +// tarmSolicitudTramiteController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + this.salvarDeshabilitado=true; + caragarTramiteSolicitud(); + this.query(); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene un arma por su codigo + * @param codigopersona + * @return + */ + public static TarmArmas findByCode(String carma) { + try { + DesaduanizacionOldController cc = new DesaduanizacionOldController(); + cc.init(); + cc.recperpage = 300000; + cc.addFilter("pk", carma); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public Date getFechaDesaduanizacion() { + return fechaDesaduanizacion; + } + + public void setFechaDesaduanizacion(Date fechaDesaduanizacion) { + this.fechaDesaduanizacion = fechaDesaduanizacion; + } + + public void setDatos(final AjaxBehaviorEvent event){ + try { + TarmSolicitudTramite soltra = TarmSolicitudTramiteController.findPorCSolicitud(this.noSolicitud); + this.record=new TarmArmas(); + this.record.modifiedData().put("tipotramitedesc", soltra.modifiedData().get("tipotramitedesc")); + this.record.modifiedData().put("categoriadesc", soltra.modifiedData().get("categoriadesc")); + this.record.modifiedData().put("usodesc", soltra.modifiedData().get("usodesc")); + this.record.modifiedData().put("cedula", soltra.modifiedData().get("cedula")); + this.record.modifiedData().put("nombre", soltra.modifiedData().get("nombre")); + this.record.modifiedData().put("personcode", soltra.modifiedData().get("personcode")); + TarmDocumentoHabilitante dochab = DocumentoHabilitanteController.findPorSolicitud(this.noSolicitud); + if(dochab != null){ + this.record.modifiedData().put("fechaemision", dochab.getFechaemision()); + } + + //cregistro propietario +// List regArmas = RegistroArmController.findxPersoncode(soltra.modifiedData().get("personcode").toString()); +// StringBuilder sql = new StringBuilder("cregistro in"); +// Integer aux=0; +// for(TarmRegistroArmas t :regArmas){ +// if(aux==0){ +// sql.append("("+t.getPk()); +// aux++; +// }else{ +// sql.append(","+t.getPk()); +// } +// } +// sql.append(")"); + //armas codigoarma que debe filtar + String sql = "cregistro in (Select r.pk from TarmRegistroArmas r where personcode="+soltra.modifiedData().get("personcode").toString()+")"; + addField("cregistro", sql); + this.salvarDeshabilitado = true; + + } catch (Exception e) { + // TODO: handle exception + } + } + + + + public void habilitaGrabar(final AjaxBehaviorEvent event){ + Integer aux=0; + for(TarmArmas armas:this.lrecord){ + if(!this.lrecord.isEmpty() && armas.getLote() != null){ + aux++; + } + } + if(aux.compareTo(this.lrecord.size()) == 0){ + this.salvarDeshabilitado = false; + } + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + + public List getTramites() { + return tramites; + } + + public void setTramites(List tramites) { + this.tramites = tramites; + } + + public String getNoSolicitud() { + return noSolicitud; + } + + public void setNoSolicitud(String noSolicitud) { + this.noSolicitud = noSolicitud; + } + + public Boolean getSalvarDeshabilitado() { + return salvarDeshabilitado; + } + + public void setSalvarDeshabilitado(Boolean salvarDeshabilitado) { + this.salvarDeshabilitado = salvarDeshabilitado; + } + + public SolicitudTramiteController getTarmSolicitudTramiteController() { + return tarmSolicitudTramiteController; + } + + public void setTarmSolicitudTramiteController( + SolicitudTramiteController tarmSolicitudTramiteController) { + this.tarmSolicitudTramiteController = tarmSolicitudTramiteController; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/MovimientoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/MovimientoController.java.svn-base new file mode 100644 index 0000000..64ce07c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/MovimientoController.java.svn-base @@ -0,0 +1,112 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmMovimientoArmas; +/** + * Clase controladora del bean TarmMovimiento. + * + * @author Andres Cevallos. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class MovimientoController extends AbstractController { + + /** + * Constructor + * @throws Exception + */ + public MovimientoController() throws Exception { + super(TarmMovimientoArmas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "MOVIMIENTO"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ProvinceLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ProvinceLovController.java.svn-base new file mode 100644 index 0000000..3d9bbdf --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ProvinceLovController.java.svn-base @@ -0,0 +1,224 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Clase controladora del bean TarmSitioAlmacenamiento. + * + * @author abenalcazar + * + */ + +@ManagedBean +@ViewScoped +public class ProvinceLovController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public ProvinceLovController() throws Exception { + super(TgeneProvince.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PROVINCELOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); // En en string van todos los + // campos de orden + // ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Método que entrega el listado objetos TgeneProvince provincias + * + * @param countrycode + * Código de país + * @return lrecord Lista de objetos TgeneProvince + */ + public static List find(String countrycode) { + try { + ProvinceLovController cc = new ProvinceLovController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Metodo para buscar por codigo de provincia + * + * @param provincecode + * @return + */ + public static List findPorCodigo(String countrycode, + String provincecode) { + try { + ProvinceLovController cc = new ProvinceLovController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.addFilter("pk.provincecode", provincecode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findxDescripcion(String countrycode, + String codigoProvincia, String descripcion) { + try { + ProvinceLovController cc = new ProvinceLovController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + if (codigoProvincia != null && codigoProvincia.length() > 0) { + cc.addFilter("pk.provincecode", codigoProvincia); + } + if (descripcion != null && descripcion.length() > 0) { + cc.addFilter("description", descripcion); + } + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog( + "/pages/armas/lov/provinciaLov.xhtml", options, params); + } + + public void setprovince() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setprovince(TgeneProvince tgeneProvince) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneProvince); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/RegistroArmController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/RegistroArmController.java.svn-base new file mode 100644 index 0000000..578a392 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/RegistroArmController.java.svn-base @@ -0,0 +1,181 @@ +package com.fp.frontend.controller.armas.funcionalidad; + + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; + +/** + * Clase controladora del bean TarmSolicitudImportacion. + * + * @author Andres Cevallos. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RegistroArmController extends AbstractController { + + + + + public RegistroArmController() throws Exception { + super(TarmRegistroArmas.class); + } + + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //Ingreso de Datos Quemados + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + public void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + // record = new TarmSolicitudImportacion(); + this.beanalias = "TREGISTROARMAS"; +// this.create(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + public static List find() { + try { + RegistroArmController cc = new RegistroArmController(); + cc.init(); + cc.recperpage = 5000; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + public static List findxPersoncode(String personcode) { + try { + RegistroArmController cc = new RegistroArmController(); + cc.init(); + cc.addFilter("personcode", personcode); + cc.recperpage = 5000; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + public static TarmRegistroArmas findByCodigo(String cRegistro) { + try { + RegistroArmController cc = new RegistroArmController(); + cc.init(); + cc.recperpage = 3000000; + cc.addFilter("pk", cRegistro); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + + + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + public void update(TarmRegistroArmas bean) throws Exception { + record=bean; + update(); + } +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteArmasController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteArmasController.java.netbeans-base new file mode 100644 index 0000000..79cc62a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteArmasController.java.netbeans-base @@ -0,0 +1,372 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + + + + + +/** + * @author Andres Cevallos + * Clase Controladora la cual genera el reporte de armas + */ +@ManagedBean +@ViewScoped +public class ReporteArmasController extends AbstractController { + + public ReporteArmasController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + + + public Date fecha; + private TcustPersonDetail customerperson; + private List lestados; + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + private TsafeUserDetail userDetail; + private String institucionCentroControl=""; + private TarmCentroControl centroControl = new TarmCentroControl(); + private Date fechainicial; + private Date fechafinal; + private String filtro=""; + private String estado; + private String serieLote; + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + + + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + + + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + + + + public ReportController getReportController() { + return reportController; + } + + + + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + + + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + + + + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + lestados = CatalogDetailController.find("ESTADOARMA"); + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + estado=""; + obtenerCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Metodo que se debe ejecutar cuando es una transaccion de tipo verificar armas + * @throws Exception + */ + private void obtenerCentroControl() throws Exception { + + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + + } + + @Override + protected void querydatabase() { + + } + + /** + * Abre el Lov de Persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Carga los datos que se devuelven en el Lov de personas + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + setCustomerperson( (TcustPersonDetail) event.getObject()); + + } + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + + } + + public void generarReporte(){ + if(fechainicial.getTime()>fechafinal.getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_fechafinal")); + return; + } + String gradoUsuario =""; + filtro=" "; + String path = "armas/reports/reporteArmas"; + if(customerperson!=null){ + filtro=" and tarma.cregistro in " + + " (select regarma.cregistro from tarmregistroarmas regarma where regarma.personcode='"+customerperson.getPk().getPersoncode()+"')"; + } + if(estado!=null && !estado.equals("")){ + if(estado.equals("APTA")){ + filtro+=" and tarma.carma in (select carma from tarmarmapruebas p " + + " where p.carmaprueba=(select max(prue.carmaprueba)" + + " from tarmarmapruebas prue where prue.apruebaevaluacion='Y' and prue.carma in(select codar.carma from tarmarmas codar" + + " where codar.codigoarma =(select ar.codigoarma from tarmarmas ar where carma=tarma.carma) ))) "; + //"and pru.apruebaevaluacion='Y'"; + } + else{ + filtro+=" and tarma.estado='"+estado+"' "; + } + } + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + // parameters.put("fechaCorte", (new SimpleDateFormat("dd-MM-yyyy")).format(fechaCorte).toString()); + // parameters.put("gradoUsuario",gradoUsuario); + try { + + //Usuario logueado en la aplicacion + String nombreUsuario; + if(userDetail.getPk().getPersoncode()!=null){ + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + } + else{ + nombreUsuario = ""; + } + //filtro = "where tarma.personcode='1138'"; + parameters.put("filtro", filtro); + SimpleDateFormat fechatxt=new SimpleDateFormat("yyyy-MM-dd"); + parameters.put("fechainicial", fechatxt.format(fechainicial)); + parameters.put("fechafinal", fechatxt.format(fechafinal)); + parameters.put("usuario", nombreUsuario); + parameters.put("unidadmilitar", institucionCentroControl); + // parameters.put("tecnicoAlmacenamiento",MsgControlArmas.getProperty("tecnicoAlmacenamiento")+" "+institucionCentroControl); + // parameters.put("jefe",MsgControlArmas.getProperty("jefe")+" "+institucionCentroControl); + String format="xlsx"; + String filename= MsgControlArmas.getProperty("lbl_nombreexcel"); + //Fecha actual + Calendar fechaActualCldr = Calendar.getInstance(); + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH)+1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarfecha", fechaActualSB.toString()); + // parameters.put("transaccion",numeroTransaccionEnvioConvertido); + parameters.put("codigoQR", "PRUEBAARMAS"+fechaActualSB.toString()); + + // format = CatalogDetailController.findxCodigoCodcatalogo(tipoReporte, "TIPOREPORTE").getLegalcode(); + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + // this.reportController.execute(path, parameters, null, filename, this.getLoginController()); + // xpathflujo = generarXpath(); + + // alfrescoController.uploadFile(file,numeroTransaccionEnvioConvertido+".pdf",xpathflujo); + // iniciarFlujo(xpathflujo+"/cm:"+numeroTransaccionEnvioConvertido+ ".pdf");//="cm:Decomiso/cm:A-2014/cm:M-10/cm:ENV-000000319/cm:ENV-000000319.pdf" + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } + + + public void generarReporteHistorico(){ + if(fechainicial.getTime()>fechafinal.getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_fechafinal")); + return; + } + String gradoUsuario =""; + String path = "armas/reports/reporteHistoricoArmas.jrxml"; + filtro=""; + if(serieLote!=null && serieLote.trim().length()>0){ + filtro=" and tarma.lote='"+serieLote+"' "; + } + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + if(userDetail.getPk().getPersoncode()!=null){ + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + } + else{ + nombreUsuario = ""; + } + //filtro = "where tarma.personcode='1138'"; + parameters.put("filtro", filtro); + SimpleDateFormat fechatxt=new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fechainicial", fechatxt.format(fechainicial)); + parameters.put("fechafinal", fechatxt.format(fechafinal)); + parameters.put("usuario", nombreUsuario); + parameters.put("unidadmilitar", institucionCentroControl); + String format="xlsx"; + String filename= MsgControlArmas.getProperty("lbl_nombreexcelhistorico"); + //Fecha actual + Calendar fechaActualCldr = Calendar.getInstance(); + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH)+1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarfecha", fechaActualSB.toString()); + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#postCommit(com.fp.dto.Response) + */ + + public Date getFecha() { + return fecha; + } + + public void setFecha(Date fecha) { + this.fecha = fecha; + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public List getLestados() { + return lestados; + } + + public void setLestados(List lestados) { + this.lestados = lestados; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public String getSerieLote() { + return serieLote; + } + + public void setSerieLote(String serieLote) { + this.serieLote = serieLote; + } + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteArmasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteArmasController.java.svn-base new file mode 100644 index 0000000..79cc62a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteArmasController.java.svn-base @@ -0,0 +1,372 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + + + + + +/** + * @author Andres Cevallos + * Clase Controladora la cual genera el reporte de armas + */ +@ManagedBean +@ViewScoped +public class ReporteArmasController extends AbstractController { + + public ReporteArmasController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + + + public Date fecha; + private TcustPersonDetail customerperson; + private List lestados; + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + private TsafeUserDetail userDetail; + private String institucionCentroControl=""; + private TarmCentroControl centroControl = new TarmCentroControl(); + private Date fechainicial; + private Date fechafinal; + private String filtro=""; + private String estado; + private String serieLote; + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + + + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + + + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + + + + public ReportController getReportController() { + return reportController; + } + + + + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + + + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + + + + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + lestados = CatalogDetailController.find("ESTADOARMA"); + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + estado=""; + obtenerCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Metodo que se debe ejecutar cuando es una transaccion de tipo verificar armas + * @throws Exception + */ + private void obtenerCentroControl() throws Exception { + + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + + } + + @Override + protected void querydatabase() { + + } + + /** + * Abre el Lov de Persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Carga los datos que se devuelven en el Lov de personas + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + setCustomerperson( (TcustPersonDetail) event.getObject()); + + } + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + + } + + public void generarReporte(){ + if(fechainicial.getTime()>fechafinal.getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_fechafinal")); + return; + } + String gradoUsuario =""; + filtro=" "; + String path = "armas/reports/reporteArmas"; + if(customerperson!=null){ + filtro=" and tarma.cregistro in " + + " (select regarma.cregistro from tarmregistroarmas regarma where regarma.personcode='"+customerperson.getPk().getPersoncode()+"')"; + } + if(estado!=null && !estado.equals("")){ + if(estado.equals("APTA")){ + filtro+=" and tarma.carma in (select carma from tarmarmapruebas p " + + " where p.carmaprueba=(select max(prue.carmaprueba)" + + " from tarmarmapruebas prue where prue.apruebaevaluacion='Y' and prue.carma in(select codar.carma from tarmarmas codar" + + " where codar.codigoarma =(select ar.codigoarma from tarmarmas ar where carma=tarma.carma) ))) "; + //"and pru.apruebaevaluacion='Y'"; + } + else{ + filtro+=" and tarma.estado='"+estado+"' "; + } + } + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + // parameters.put("fechaCorte", (new SimpleDateFormat("dd-MM-yyyy")).format(fechaCorte).toString()); + // parameters.put("gradoUsuario",gradoUsuario); + try { + + //Usuario logueado en la aplicacion + String nombreUsuario; + if(userDetail.getPk().getPersoncode()!=null){ + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + } + else{ + nombreUsuario = ""; + } + //filtro = "where tarma.personcode='1138'"; + parameters.put("filtro", filtro); + SimpleDateFormat fechatxt=new SimpleDateFormat("yyyy-MM-dd"); + parameters.put("fechainicial", fechatxt.format(fechainicial)); + parameters.put("fechafinal", fechatxt.format(fechafinal)); + parameters.put("usuario", nombreUsuario); + parameters.put("unidadmilitar", institucionCentroControl); + // parameters.put("tecnicoAlmacenamiento",MsgControlArmas.getProperty("tecnicoAlmacenamiento")+" "+institucionCentroControl); + // parameters.put("jefe",MsgControlArmas.getProperty("jefe")+" "+institucionCentroControl); + String format="xlsx"; + String filename= MsgControlArmas.getProperty("lbl_nombreexcel"); + //Fecha actual + Calendar fechaActualCldr = Calendar.getInstance(); + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH)+1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarfecha", fechaActualSB.toString()); + // parameters.put("transaccion",numeroTransaccionEnvioConvertido); + parameters.put("codigoQR", "PRUEBAARMAS"+fechaActualSB.toString()); + + // format = CatalogDetailController.findxCodigoCodcatalogo(tipoReporte, "TIPOREPORTE").getLegalcode(); + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + // this.reportController.execute(path, parameters, null, filename, this.getLoginController()); + // xpathflujo = generarXpath(); + + // alfrescoController.uploadFile(file,numeroTransaccionEnvioConvertido+".pdf",xpathflujo); + // iniciarFlujo(xpathflujo+"/cm:"+numeroTransaccionEnvioConvertido+ ".pdf");//="cm:Decomiso/cm:A-2014/cm:M-10/cm:ENV-000000319/cm:ENV-000000319.pdf" + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } + + + public void generarReporteHistorico(){ + if(fechainicial.getTime()>fechafinal.getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_fechafinal")); + return; + } + String gradoUsuario =""; + String path = "armas/reports/reporteHistoricoArmas.jrxml"; + filtro=""; + if(serieLote!=null && serieLote.trim().length()>0){ + filtro=" and tarma.lote='"+serieLote+"' "; + } + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + if(userDetail.getPk().getPersoncode()!=null){ + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + } + else{ + nombreUsuario = ""; + } + //filtro = "where tarma.personcode='1138'"; + parameters.put("filtro", filtro); + SimpleDateFormat fechatxt=new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fechainicial", fechatxt.format(fechainicial)); + parameters.put("fechafinal", fechatxt.format(fechafinal)); + parameters.put("usuario", nombreUsuario); + parameters.put("unidadmilitar", institucionCentroControl); + String format="xlsx"; + String filename= MsgControlArmas.getProperty("lbl_nombreexcelhistorico"); + //Fecha actual + Calendar fechaActualCldr = Calendar.getInstance(); + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH)+1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarfecha", fechaActualSB.toString()); + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#postCommit(com.fp.dto.Response) + */ + + public Date getFecha() { + return fecha; + } + + public void setFecha(Date fecha) { + this.fecha = fecha; + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public List getLestados() { + return lestados; + } + + public void setLestados(List lestados) { + this.lestados = lestados; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public String getSerieLote() { + return serieLote; + } + + public void setSerieLote(String serieLote) { + this.serieLote = serieLote; + } + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteArmasPrevImportacionController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteArmasPrevImportacionController.java.svn-base new file mode 100644 index 0000000..e846791 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteArmasPrevImportacionController.java.svn-base @@ -0,0 +1,84 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.HashMap; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * + * @author David Cruz + * + */ +@ManagedBean +@ViewScoped +public class ReporteArmasPrevImportacionController extends AbstractController { + + private static final long serialVersionUID = -6726028201723692500L; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + private TsafeUserDetail userDetail; + + public ReporteArmasPrevImportacionController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + public void init() { + beanalias = "REPORTE"; + lrecord = new ArrayList<>(); + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + } + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + } + + public void generarReporte() { + String path = "armas/reports/reporteArmasPrevImportacion"; + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + if(userDetail.getPk().getPersoncode()!=null){ + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + } + else{ + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario); + String format="xlsx"; + String filename= "permisosprevimportacion"; + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteCashManagmentController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteCashManagmentController.java.svn-base new file mode 100644 index 0000000..fd8c648 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteCashManagmentController.java.svn-base @@ -0,0 +1,441 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletResponse; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CashManagementHistoryController; +import com.fp.frontend.controller.armas.solicitud.SolicitudArmasController; +import com.fp.frontend.controller.armas.solicitud.SolicitudTramiteController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.date.TgeneNotAccountingDayController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.fun.TarmCashManagementHistory; +import com.fp.persistence.parmas.soli.CashManagementDTO; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +/** + * @author Christian Pazmino + * Cash management + */ +@ManagedBean +@ViewScoped +public class ReporteCashManagmentController extends AbstractController { + + public ReporteCashManagmentController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + // Fecha inicial + private Date fechainicial; + // Fecha final + private Date fechafinal; + // Fecha inicial con mascara + private String fechaInicialStr; + // Fecha final con mascara + private String fechaFinalStr; + // Lista con informacion de los tramites habilitados para realizar los depositos en la cuenta + private List cashManagementList = new ArrayList(); + // Fecha del ultimo reporte generado + private String fechaUltReporte; + // Autor del ultimo reporte generado + private String autorUltReporte; + // Path del reporte en el alfresco + private String xpathReporte; + // Controlador de Solicitud Tramite + @ManagedProperty(value="#{solicitudTramiteController}") + private SolicitudTramiteController solicitudTramiteController; + // Controlador del alfresco + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + // Nombre identificador del archivo cash management generado + private String nombreArchivo; + + private File archivo; + /** + * Controlador que maneja los datos de generacion ultima vez del reporte + */ + @ManagedProperty(value = "#{cashManagementHistoryController}") + private CashManagementHistoryController cashManagementHistoryController; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + TarmCashManagementHistory ultimoReporteObj = CashManagementHistoryController.findUltimoReporteGenerado(); + if(ultimoReporteObj!=null){ + SimpleDateFormat sdfUltimaFecha = new SimpleDateFormat("dd/MM/yyyy HH:mm"); + fechaUltReporte = sdfUltimaFecha.format(ultimoReporteObj.getDatefrom()); + autorUltReporte = ultimoReporteObj.getModifiedData().get("personname")!=null? ultimoReporteObj.getModifiedData().get("personname").toString():null; + } + this.beanalias = "CASHMANAGEMENT"; + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + int diasLaborablesPermitidos = Integer.parseInt(ParametersController.find("DIASDEPOSITO", "1").getNumbervalue().toString()); + // La fecha inicial se calcula en funcion del numero de dias laborables permitidos para el deposito + fechainicial = TgeneNotAccountingDayController.diasLaborablesPreviosAUnaFecha(new Date(), diasLaborablesPermitidos); + // La fecha final es la fecha actual + Calendar fechaFinalCldr = Calendar.getInstance(); + System.out.println("Fecha final "+fechaFinalCldr.getTime()); + fechaFinalStr = sdf.format(fechaFinalCldr.getTime()); + System.out.println("Fecha inicial "+fechainicial); + fechaInicialStr = sdf.format(fechainicial); + querydatabase(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + protected void querydatabase() { + try{ + System.out.println("Ejecuta querydatabase cash managment..."); + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + request.put("queryalias", "CASHMANAGEMENT"); + request.put("querytype", "P"); + request.put("fechaInicialStr", fechaInicialStr); + request.put("fechaFinalStr", fechaFinalStr); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + List lCashManagement = (List)resp.get("CASHMANAGEMENTLIST"); + construirListaCashDTO(lCashManagement); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void construirListaCashDTO(List lCashManagement){ + for(Object[]cashObj:lCashManagement){ + CashManagementDTO cashManagementDTO = new CashManagementDTO(); + // Codigo orientacion + cashManagementDTO.setCodigoServicio(cashObj[0]!=null?cashObj[0].toString():null); + // Contra partida + cashObj[1]=Integer.parseInt(cashObj[1].toString().substring(4, cashObj[1].toString().length())); + cashManagementDTO.setContrato(cashObj[1]!=null?cashObj[1].toString():null); + // Moneda + cashManagementDTO.setMoneda(cashObj[2]!=null?cashObj[2].toString():null); + // Valor + String valorDosDecimalesStr = null; + if(cashObj[3]!=null){ + BigDecimal valorDosDecimales = ((BigDecimal)cashObj[3]).setScale(2); +// valorDosDecimales.setScale(2, BigDecimal.ROUND_HALF_UP); + valorDosDecimalesStr = valorDosDecimales.toString().replace(".", ""); + } + cashManagementDTO.setValorapagar(valorDosDecimalesStr); + // Forma de cobro, forma de pago + cashManagementDTO.setFormaCobro(cashObj[4]!=null?cashObj[4].toString():null); + // Tipo de cuenta + cashManagementDTO.setTipoCuenta(cashObj[5]!=null?cashObj[5].toString():null); + // NUmero de cuenta + cashManagementDTO.setNumeroCuenta(cashObj[6]!=null?cashObj[6].toString():null); + // Referencia + cashManagementDTO.setReferencia(cashObj[7]!=null?Utilidades.reemplazaAcentosCaractEspeciales(cashObj[7].toString()):null); + // Tipo ID cliente + cashManagementDTO.setTipoIDCliente(cashObj[8]!=null?cashObj[8].toString():null); + // Nombre del cliente + cashManagementDTO.setNumeroIDCliente(cashObj[9]!=null?cashObj[9].toString():null); + // Si el nombre del cliente es mayor a 41 caracteres + if(cashObj[10]!=null && cashObj[10].toString().length()>41){ + cashObj[10]=cashObj[10].toString().substring(0, 41); + } + // Nombre del cliente + cashManagementDTO.setNombreCliente(cashObj[10]!=null?Utilidades.reemplazaAcentosCaractEspeciales(cashObj[10].toString()):null); + // Base Imponible + cashManagementDTO.setBaseImponible(cashObj[11]!=null?cashObj[11].toString():null); + // Csolicitud + cashManagementDTO.setCsolicitud(cashObj[12]!=null?cashObj[12].toString():null); + cashManagementList.add(cashManagementDTO); + } + } + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + + } + + + /** + * Obtiene el reporte de cash management + */ + public void generarReporte(String filename) { + try { + if(cashManagementList.isEmpty()){ + MessageHelper.setMessageInfo("NO EXISTEN DATOS PARA GENERAR EL REPORTE..."); +// return null; + } + archivo = File.createTempFile(filename,".txt"); +// File archivo = File.createTempFile("cashmanagement"+fechaFinalStr,".txt"); + PrintWriter escribir = new PrintWriter(archivo); + for(CashManagementDTO cashManagementDTO : cashManagementList){ + escribir.print(cashManagementDTO.getCodigoServicio()!=null?cashManagementDTO.getCodigoServicio() +"\t":"\t"); + escribir.print(cashManagementDTO.getContrato()!=null?cashManagementDTO.getContrato()+"\t":"\t"); + escribir.print(cashManagementDTO.getMoneda()!=null?cashManagementDTO.getMoneda()+"\t":"\t"); + escribir.print(cashManagementDTO.getValorapagar()!=null?cashManagementDTO.getValorapagar()+"\t":"\t"); + escribir.print(cashManagementDTO.getFormaCobro()!=null?cashManagementDTO.getFormaCobro()+"\t":"\t"); + escribir.print(cashManagementDTO.getTipoCuenta()!=null?cashManagementDTO.getTipoCuenta()+"\t":"\t"); + escribir.print(cashManagementDTO.getNumeroCuenta()!=null?cashManagementDTO.getNumeroCuenta()+"\t":"\t"); + escribir.print(cashManagementDTO.getReferencia()!=null?cashManagementDTO.getReferencia()+"\t":"\t"); + escribir.print(cashManagementDTO.getTipoIDCliente()!=null?cashManagementDTO.getTipoIDCliente()+"\t":"\t"); + escribir.print(cashManagementDTO.getNumeroIDCliente()!=null?cashManagementDTO.getNumeroIDCliente()+"\t":"\t"); + escribir.print(cashManagementDTO.getNombreCliente()!=null?cashManagementDTO.getNombreCliente()+"\r\n":"\r\n"); + TarmSolicitudTramite solicitudTramiteObj = SolicitudTramiteController.findByCSolicitud(cashManagementDTO.getCsolicitud()); + solicitudTramiteObj.setIncashreport("S"); + solicitudTramiteController.updateSimple(solicitudTramiteObj); + // escribir.println(cashManagementDTO.getBaseImponible()); + + } + solicitudTramiteController.save(); + escribir.flush(); + escribir.close(); +// return archivo; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); +// return null; + } + + } + + + + /** + * Llama a la construccion del metodo para recargar + */ + public void descargarArchivo(){ + +// File archivoTemporal=generarReporte(); + try { + obtenerSecuencialSolicitud(); + this.xpathReporte = this.getRutaDocumento(); + Calendar calendar = Calendar.getInstance(); + SimpleDateFormat sdfFechaParaNombre = new SimpleDateFormat("ddMMyyyyHHmm"); + String fechaParaNombre = sdfFechaParaNombre.format(calendar.getTime()); + String filename="COMACO"+fechaParaNombre+this.nombreArchivo; + + generarReporte(filename); + filename=filename+".txt"; + +// if(archivoTemporal==null){ + if(archivo==null){ + return; + } + InputStream inputStream = new FileInputStream(archivo); //(archivoTemporal); + + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition", "attachment; filename="+filename); + OutputStream out = response.getOutputStream(); + + int read = 0; + byte[] bytes = new byte[1024]; + + while ((read = inputStream.read(bytes)) != -1) { + out.write(bytes, 0, read); + } + out.flush(); + + FacesContext.getCurrentInstance().responseComplete(); + + generarReporte(filename); + InputStream inputStream2 = new FileInputStream(archivo); + +// if(!this.alfrescoController.uploadFile(inputStream, filename, this.xpathReporte)){ + if(!this.alfrescoController.uploadFile(inputStream2, filename, this.xpathReporte)){ + throw new Exception("ERROR AL CARGAR EL REPORTE"); + } + + inputStream.close(); + inputStream2.close(); + + // Guardar datos ultima generacion del archivo + TarmCashManagementHistory actualCashManagementHistory = new TarmCashManagementHistory(); + actualCashManagementHistory.setDatefrom(new Timestamp(calendar.getTimeInMillis())); + actualCashManagementHistory.setDateto(Utilidades.getFechaExpiracion()); + actualCashManagementHistory.setIsnew(true); + actualCashManagementHistory.setNombrearchivo(filename); + actualCashManagementHistory.setPathreporte(this.xpathReporte + "/cm:" + filename); + actualCashManagementHistory.setPk(nombreArchivo); + + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + actualCashManagementHistory.setUsercode(tsafeUserDetail.getPk().getUsercode()); + + cashManagementHistoryController.update(actualCashManagementHistory); + + List ultimoCashManagementHistoryList = CashManagementHistoryController.findReportesGeneradosVigentes(); + if(ultimoCashManagementHistoryList!=null){ + for(TarmCashManagementHistory ultimoCashManagementHistory:ultimoCashManagementHistoryList){ + ultimoCashManagementHistory.setDateto(new Timestamp(calendar.getTimeInMillis())); + ultimoCashManagementHistory.setIsnew(Boolean.FALSE); + cashManagementHistoryController.update(ultimoCashManagementHistory); + } + } + cashManagementHistoryController.save(); + + } catch (Exception e) { + // TODO: handle exception + } catch (Throwable e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Arma la petición al core para solicitar un número de secuencial para la solicitud antes de guardarla + * @throws Throwable + */ + private void obtenerSecuencialSolicitud() throws Throwable{ + Request request = callerhelper.getRequest(); + DtoQuery dtoQuery = super.getDtoQuery(true); + HashMap mapQuery = new HashMap(); + mapQuery.put(beanalias, dtoQuery); + request.put("querytype", "T"); + request.setQueryTables(mapQuery); + Response response = callerhelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(response); + }else{ + nombreArchivo = response.get("CASHHISTORICOSEQUENCE").toString(); + } + } + + /** + * Metodo para armar la ruta del documento + * @return + */ + public String getRutaDocumento() { + Calendar calendar = Calendar.getInstance(); + StringBuilder ruta = new StringBuilder("cm:CashManagement"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append( + (calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + ruta = ruta.append("/cm:D-").append( + (calendar.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (calendar.get(Calendar.DAY_OF_MONTH)) : (calendar.get(Calendar.DAY_OF_MONTH))); + return ruta.toString(); + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + public String getFechaInicialStr() { + return fechaInicialStr; + } + public void setFechaInicialStr(String fechaInicialStr) { + this.fechaInicialStr = fechaInicialStr; + } + public String getFechaFinalStr() { + return fechaFinalStr; + } + public void setFechaFinalStr(String fechaFinalStr) { + this.fechaFinalStr = fechaFinalStr; + } + public String getFechaUltReporte() { + return fechaUltReporte; + } + public void setFechaUltReporte(String fechaUltReporte) { + this.fechaUltReporte = fechaUltReporte; + } + public String getAutorUltReporte() { + return autorUltReporte; + } + public void setAutorUltReporte(String autorUltReporte) { + this.autorUltReporte = autorUltReporte; + } + public CashManagementHistoryController getCashManagementHistoryController() { + return cashManagementHistoryController; + } + public void setCashManagementHistoryController( + CashManagementHistoryController cashManagementHistoryController) { + this.cashManagementHistoryController = cashManagementHistoryController; + } + public String getXpathReporte() { + return xpathReporte; + } + public void setXpathReporte(String xpathReporte) { + this.xpathReporte = xpathReporte; + } + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + public String getNombreArchivo() { + return nombreArchivo; + } + public void setNombreArchivo(String nombreArchivo) { + this.nombreArchivo = nombreArchivo; + } + public SolicitudTramiteController getSolicitudTramiteController() { + return solicitudTramiteController; + } + public void setSolicitudTramiteController( + SolicitudTramiteController solicitudTramiteController) { + this.solicitudTramiteController = solicitudTramiteController; + } + + + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteCompInscritaController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteCompInscritaController.java.svn-base new file mode 100644 index 0000000..ed0256b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteCompInscritaController.java.svn-base @@ -0,0 +1,431 @@ +package com.fp.frontend.controller.armas.funcionalidad; + + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.apache.log4j.Logger; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@ManagedBean +@ViewScoped +public class ReporteCompInscritaController extends AbstractController{ + + /** + * + */ + public ReporteCompInscritaController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private final static Logger LOGGER = Logger.getLogger(ReporteCompInscritaController.class); + private static final long serialVersionUID = 1L; + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController personDetailController; + + @ManagedProperty(value = "#{centroControlController}") + private CentroControlArmasController centroControlController; + + + + private TcustPersonDetail customerperson; + private TsafeUserDetail userDetail; + private TcustPersonDetail responsableCentroControl= null; + private TsafeUserDetail tsafeUserDetailUsuario = null; + private TarmCentroControl centroControl = new TarmCentroControl(); + private List lcentroControl = null; + private List ltiporeg = null; + private List lestadosArma = null; + private List ltipoFabArma = null; + private List estadosSeleccionados = null; + //Tipo de Fabricacion Arma Seleccionada + private List tipoFabArmaSeleccionada = null; + + private String institucionCentroControl=""; + private Date fechainicial; + private Date fechafinal; + private String filtro=""; + private String filtro2=""; + private String idTipoReg; + private Date fec_actual; + private String codCentroControl; + + + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + ltiporeg = CatalogDetailController.find("TIPOREGISTRO", "DECINC"); + this.lestadosArma = CatalogDetailController.find("ESTADOARMA"); + //tipo de Fabricacion Arma + this.ltipoFabArma = CatalogDetailController.find("TIPOFABRICACION"); + this.lcentroControl = CentroControlArmasController.findAll(); + this.responsableCentroControl = new TcustPersonDetail(); +// this.tsafeUserDetailUsuario = new TsafeUserDetail(); + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + //this.obtenerResponsableCentroControl(); + this.idTipoReg=""; + this.codCentroControl=""; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if(tcustPersonAddres == null){ + return null; + } + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl(){ + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + + } + + /** + * Obtiene el reporte de Tipo de Fabricacion de las Armas + */ + public void reporteCompaniaInscrita() { + try { + String gradoUsuario =""; + String path = "armas/reports/reporteCompaniaInscrita"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename="reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + + String format = "pdf"; + + try { + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public void reporteCompaniaInscritaXls() { + try { + String gradoUsuario =""; + String path = "armas/reports/reporteCompaniaInscrita"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename="reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + + +// } + + String format = "xls"; + + try { + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + private String obtenerTipoFabArmaSeleccionada(){ + StringBuilder filtro = new StringBuilder(); + StringBuilder armaSel = new StringBuilder(); + for (String tipos : tipoFabArmaSeleccionada) { + armaSel.append("'"); + armaSel.append(tipos); + armaSel.append("',"); + } + + filtro.append(" AND A.TIPOFABRICACION IN ("); + filtro.append(armaSel.substring(0, armaSel.length() - 1)); + filtro.append(")"); + LOGGER.info("el filtro obtenido tipo Arma es el siguiente::" + filtro); + return filtro.toString(); + } + + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public String getIdTipoReg() { + return idTipoReg; + } + + public void setIdTipoReg(String idTipoReg) { + this.idTipoReg = idTipoReg; + } + + public List getLtiporeg() { + return ltiporeg; + } + + public void setLtiporeg(List ltiporeg) { + this.ltiporeg = ltiporeg; + } + + public PersonDetailController getPersonDetailController() { + return personDetailController; + } + + public void setPersonDetailController( + PersonDetailController personDetailController) { + this.personDetailController = personDetailController; + } + + public CentroControlArmasController getCentroControlController() { + return centroControlController; + } + + public void setCentroControlController( + CentroControlArmasController centroControlController) { + this.centroControlController = centroControlController; + } + + public List getLcentroControl() { + return lcentroControl; + } + + public void setLcentroControl(List lcentroControl) { + this.lcentroControl = lcentroControl; + } + + public String getCodCentroControl() { + return codCentroControl; + } + + public void setCodCentroControl(String codCentroControl) { + this.codCentroControl = codCentroControl; + } + + public List getLestadosArma() { + return lestadosArma; + } + + public void setLestadosArma(List lestadosArma) { + this.lestadosArma = lestadosArma; + } + + public List getEstadosSeleccionados() { + return estadosSeleccionados; + } + + public void setEstadosSeleccionados(List estadosSeleccionados) { + this.estadosSeleccionados = estadosSeleccionados; + } + + + public List getLtipoFabArma() { + return ltipoFabArma; + } + + public void setLtipoFabArma(List ltipoFabArma) { + this.ltipoFabArma = ltipoFabArma; + } + + public List getTipoFabArmaSeleccionada() { + return tipoFabArmaSeleccionada; + } + + public void setTipoFabArmaSeleccionada(List tipoFabArmaSeleccionada) { + this.tipoFabArmaSeleccionada = tipoFabArmaSeleccionada; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteCompaniasCCentrol.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteCompaniasCCentrol.java.svn-base new file mode 100644 index 0000000..db58480 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteCompaniasCCentrol.java.svn-base @@ -0,0 +1,430 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +/** + * @author usermaia2 + * Clase Controladora la cual genera el reporte de trámite por centro de control + */ +@ManagedBean +@ViewScoped +public class ReporteCompaniasCCentrol extends AbstractController { + + public ReporteCompaniasCCentrol() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController personDetailController; + + @ManagedProperty(value = "#{centroControlController}") + private CentroControlArmasController centroControlController; + @ManagedProperty(value = "#{logincontroller}") + private LoginController logincontroller; + + + private TcustPersonDetail customerperson; + private TsafeUserDetail userDetail; + private TcustPersonDetail responsableCentroControl= null; + private TsafeUserDetail tsafeUserDetailUsuario = null; + private TarmCentroControl centroControl = new TarmCentroControl(); + private List lcentroControl = null; + private List ltiporeg = null; + private List lorgcontrol = null; + private String institucionCentroControl=""; + private Date fechainicial; + private Date fechafinal; + private String filtro=""; + private String filtro2=""; + private String idTipoReg; + private Date fec_actual; + private String codCentroControl; + + + + + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + ltiporeg = CatalogDetailController.find("TIPOREGISTRO", "DECINC"); + this.lorgcontrol = CatalogDetailController.find("INSTITUCION"); + this.lcentroControl = CentroControlArmasController.findAll(); + this.responsableCentroControl = new TcustPersonDetail(); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + //this.obtenerResponsableCentroControl(); + this.idTipoReg=""; + this.codCentroControl=""; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if(tcustPersonAddres == null){ + return null; + } + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl(){ + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + @Override + protected void querydatabase() { + + } + + + + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + + } + + /** + * Obtiene el reporte de Ficha de Armas + */ + public void reporteTramitesCentro() { + try { + String gradoUsuario =""; + String path = "armas/reports/reporteCompaniasCControl"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename="reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + parameters.put("centroControl", this.codCentroControl); + + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + //fechas inicial y final que vienen desde el controlador +// SimpleDateFormat df=new SimpleDateFormat("dd/MM/yyyy"); +// parameters.put("fechainicial", df.format(this.fechainicial)); +// parameters.put("fechafinal", df.format(this.fechafinal)); + +// if(this.idTipoReg.equals("DECO") && this.idTipoReg!=null){ +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else if (this.idTipoReg.equals("INCA") && this.idTipoReg!=null) { +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else { +// parameters.put("filtro", ""); +// } + + if(this.codCentroControl!=null && !this.codCentroControl.equals("TODOS")){ + parameters.put("centroControl", this.codCentroControl); + }else { + parameters.put("centroControl", ""); + } + + + + String format = "pdf"; + + try { + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + + public void reporteTramitesCentroXls() { + try { + String gradoUsuario =""; + String path = "armas/reports/reporteCompaniasCControl"; + String filename="reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + parameters.put("centroControl", this.codCentroControl); + + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + if(this.codCentroControl!=null && !this.codCentroControl.equals("TODOS")){ + parameters.put("centroControl", this.codCentroControl); + }else { + parameters.put("centroControl", ""); + } + + String format = "xls"; + + try { + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + + + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public String getIdTipoReg() { + return idTipoReg; + } + + public void setIdTipoReg(String idTipoReg) { + this.idTipoReg = idTipoReg; + } + + public List getLtiporeg() { + return ltiporeg; + } + + public void setLtiporeg(List ltiporeg) { + this.ltiporeg = ltiporeg; + } + + public PersonDetailController getPersonDetailController() { + return personDetailController; + } + + public void setPersonDetailController( + PersonDetailController personDetailController) { + this.personDetailController = personDetailController; + } + + public CentroControlArmasController getCentroControlController() { + return centroControlController; + } + + public void setCentroControlController( + CentroControlArmasController centroControlController) { + this.centroControlController = centroControlController; + } + + public List getLorgcontrol() { + return lorgcontrol; + } + + public void setLorgcontrol(List lorgcontrol) { + this.lorgcontrol = lorgcontrol; + } + + public List getLcentroControl() { + return lcentroControl; + } + + public void setLcentroControl(List lcentroControl) { + this.lcentroControl = lcentroControl; + } + + public String getCodCentroControl() { + return codCentroControl; + } + + public void setCodCentroControl(String codCentroControl) { + this.codCentroControl = codCentroControl; + } + + + + public LoginController getLogincontroller() { + return logincontroller; + } + + public void setLogincontroller(LoginController logincontroller) { + this.logincontroller = logincontroller; + } + + + + + + + + + + + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteDecomisoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteDecomisoController.java.svn-base new file mode 100644 index 0000000..405cae8 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteDecomisoController.java.svn-base @@ -0,0 +1,368 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.eclipse.jdt.core.dom.ThisExpression; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +/** + * @author DLO + * Clase Controladora la cual genera el reporte de trámite por centro de control + */ +@ManagedBean +@ViewScoped +public class ReporteDecomisoController extends AbstractController { + + public ReporteDecomisoController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController personDetailController; + + @ManagedProperty(value = "#{centroControlController}") + private CentroControlArmasController centroControlController; + + + + private TcustPersonDetail customerperson; + private TsafeUserDetail userDetail; + private TcustPersonDetail responsableCentroControl= null; + private TsafeUserDetail tsafeUserDetailUsuario = null; + private TarmCentroControl centroControl = new TarmCentroControl(); + private List ltiporeg = null; + private List lorgcontrol = null; + private String institucionCentroControl=""; + private Date fechainicial; + private Date fechafinal; + private String filtro=""; + private String filtro2=""; + private String idTipoReg; + private Date fec_actual; + private String idOrgControl; + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + ltiporeg = CatalogDetailController.find("TIPOREGISTRO", "DECINC"); + this.lorgcontrol = CatalogDetailController.find("INSTITUCION"); + this.responsableCentroControl = new TcustPersonDetail(); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + //this.obtenerResponsableCentroControl(); + this.idTipoReg=""; + this.idOrgControl=""; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if(tcustPersonAddres == null){ + return null; + } + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl(){ + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + @Override + protected void querydatabase() { + + } + + + + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + + } + + /** + * Obtiene el reporte de Ficha de Armas + */ + public void reporteTramitesCentro() { + try { + if(this.fechainicial.getTime()>this.fechafinal.getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_fechafinal")); + return; + } + String gradoUsuario =""; + String path = "armas/reports/reporteDecomiso"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename="reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + parameters.put("centroControl", this.obtenerCentroControl()); + + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + //fechas inicial y final que vienen desde el controlador + SimpleDateFormat df=new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fechainicial", df.format(this.fechainicial)); + parameters.put("fechafinal", df.format(this.fechafinal)); + + if(this.idTipoReg.equals("DECO") && this.idTipoReg!=null){ + this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; + parameters.put("filtro", this.filtro); + }else if (this.idTipoReg.equals("INCA") && this.idTipoReg!=null) { + this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; + parameters.put("filtro", this.filtro); + }else { + parameters.put("filtro", ""); + } + + if(this.idOrgControl!=null && !this.idOrgControl.equals("TODOS")){ + this.filtro2 = " and cc.institucion = '"+this.idOrgControl+"' "; + parameters.put("filtro2", this.filtro2); + }else { + parameters.put("filtro2", ""); + } + + + + String format = "xlsx"; + + try { + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public String getIdTipoReg() { + return idTipoReg; + } + + public void setIdTipoReg(String idTipoReg) { + this.idTipoReg = idTipoReg; + } + + public List getLtiporeg() { + return ltiporeg; + } + + public void setLtiporeg(List ltiporeg) { + this.ltiporeg = ltiporeg; + } + + public PersonDetailController getPersonDetailController() { + return personDetailController; + } + + public void setPersonDetailController( + PersonDetailController personDetailController) { + this.personDetailController = personDetailController; + } + + public CentroControlArmasController getCentroControlController() { + return centroControlController; + } + + public void setCentroControlController( + CentroControlArmasController centroControlController) { + this.centroControlController = centroControlController; + } + + public List getLorgcontrol() { + return lorgcontrol; + } + + public void setLorgcontrol(List lorgcontrol) { + this.lorgcontrol = lorgcontrol; + } + + public String getIdOrgControl() { + return idOrgControl; + } + + public void setIdOrgControl(String idOrgControl) { + this.idOrgControl = idOrgControl; + } + + + + + + + + + + + + + + + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteImportacionProduccionController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteImportacionProduccionController.java.svn-base new file mode 100644 index 0000000..08e20a1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteImportacionProduccionController.java.svn-base @@ -0,0 +1,356 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.eclipse.jdt.core.dom.ThisExpression; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +/** + * @author DLO + * Clase Controladora la cual genera el reporte de trámite por centro de control + */ +@ManagedBean +@ViewScoped +public class ReporteImportacionProduccionController extends AbstractController { + + public ReporteImportacionProduccionController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController personDetailController; + + @ManagedProperty(value = "#{centroControlController}") + private CentroControlArmasController centroControlController; + + private TcustPersonDetail customerperson; + private TsafeUserDetail userDetail; + private TcustPersonDetail responsableCentroControl= null; + private TsafeUserDetail tsafeUserDetailUsuario = null; + private TarmCentroControl centroControl = new TarmCentroControl(); + private List lcentros = null; + private String institucionCentroControl=""; + private Date fechainicial; + private Date fechafinal; + private String filtro=""; + private String idRegistro; + private String estado; + private Date fec_actual; + private String tituloRep; + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + lcentros = CatalogDetailController.find("NOMBREINSTITUCION"); + this.responsableCentroControl = new TcustPersonDetail(); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + //this.obtenerResponsableCentroControl(); + this.idRegistro=""; + this.tituloRep=""; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if(tcustPersonAddres!=null && tcustPersonAddres.getProvincecode()!=null){ + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + else{ + return ""; + } + + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl(){ + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + @Override + protected void querydatabase() { + + } + + + + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + + } + + /** + * Obtiene el reporte de Ficha de Armas + */ + public void reporteTramitesCentro() { + try { + if(this.fechainicial.getTime()>this.fechafinal.getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_fechafinal")); + return; + } + String gradoUsuario =""; + String path = "armas/reports/reporteImportacionProduccion"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename="reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + parameters.put("centroControl", this.obtenerCentroControl()); + + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + customerperson=PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + //usuario + parameters.put("usuario", customerperson.getName()); + + //fechas inicial y final que vienen desde el controlador + SimpleDateFormat df=new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fechainicial", df.format(this.fechainicial)); + parameters.put("fechafinal", df.format(this.fechafinal)); + + + if(this.idRegistro.equals("IMP") && this.idRegistro!=null){ + this.filtro = " and ra.tiporegistro = '"+this.idRegistro+"' "; + parameters.put("filtro", this.filtro); + this.tituloRep = "REGISTRO DE IMPORTACIONES"; + parameters.put("titulo", this.tituloRep); + }else if (this.idRegistro.equals("PRO") && this.idRegistro!=null) { + this.filtro = " and ra.tiporegistro = '"+this.idRegistro+"' "; + parameters.put("filtro", this.filtro); + this.tituloRep = "REGISTRO DE PRODUCCI\u00d3N"; + parameters.put("titulo", this.tituloRep); + }else { + parameters.put("filtro", ""); + this.tituloRep="REGISTRO DE IMPORTACIONES Y PRODUCCI\u00d3N"; + parameters.put("titulo", this.tituloRep); + } + + + + String format = "xlsx"; + + try { + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + + + public String getIdRegistro() { + return idRegistro; + } + + public void setIdRegistro(String idRegistro) { + this.idRegistro = idRegistro; + } + + public List getLcentros() { + return lcentros; + } + + public void setLcentros(List lcentros) { + this.lcentros = lcentros; + } + + public PersonDetailController getPersonDetailController() { + return personDetailController; + } + + public void setPersonDetailController( + PersonDetailController personDetailController) { + this.personDetailController = personDetailController; + } + + public CentroControlArmasController getCentroControlController() { + return centroControlController; + } + + public void setCentroControlController( + CentroControlArmasController centroControlController) { + this.centroControlController = centroControlController; + } + + + + + + + + + + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteNumArmasEstadoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteNumArmasEstadoController.java.svn-base new file mode 100644 index 0000000..3949116 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteNumArmasEstadoController.java.svn-base @@ -0,0 +1,433 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.eclipse.jdt.core.dom.ThisExpression; +import org.jboss.logging.Logger; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +/** + * @author usermaia2 + * Clase Controladora la cual genera el reporte de trámite por centro de control + */ +@ManagedBean +@ViewScoped +public class ReporteNumArmasEstadoController extends AbstractController { + + private final static Logger LOGGER = Logger.getLogger(ReporteNumArmasEstadoController.class); + + public ReporteNumArmasEstadoController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController personDetailController; + + @ManagedProperty(value = "#{centroControlController}") + private CentroControlArmasController centroControlController; + + + + private TcustPersonDetail customerperson; + private TsafeUserDetail userDetail; + private TcustPersonDetail responsableCentroControl= null; + private TsafeUserDetail tsafeUserDetailUsuario = null; + private TarmCentroControl centroControl = new TarmCentroControl(); + private List lcentroControl = null; + private List ltiporeg = null; + private List lestadosArma = null; + private List estadosSeleccionados = null; + private String institucionCentroControl=""; + private Date fechainicial; + private Date fechafinal; + private String filtro=""; + private String filtro2=""; + private String idTipoReg; + private Date fec_actual; + private String codCentroControl; + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + ltiporeg = CatalogDetailController.find("TIPOREGISTRO", "DECINC"); + this.lestadosArma = CatalogDetailController.find("ESTADOARMA"); + this.lcentroControl = CentroControlArmasController.findAll(); + this.responsableCentroControl = new TcustPersonDetail(); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + //this.obtenerResponsableCentroControl(); + this.idTipoReg=""; + this.codCentroControl=""; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if(tcustPersonAddres == null){ + return null; + } + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl(){ + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + @Override + protected void querydatabase() { + + } + + + + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + + } + + /** + * Obtiene el reporte de Ficha de Armas + */ + public void reporteNumArmas() { + try { + String gradoUsuario =""; + String path = "armas/reports/reporteArmasCompania"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename="reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + //fechas inicial y final que vienen desde el controlador +// SimpleDateFormat df=new SimpleDateFormat("dd/MM/yyyy"); +// parameters.put("fechainicial", df.format(this.fechainicial)); +// parameters.put("fechafinal", df.format(this.fechafinal)); + +// if(this.idTipoReg.equals("DECO") && this.idTipoReg!=null){ +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else if (this.idTipoReg.equals("INCA") && this.idTipoReg!=null) { +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else { + parameters.put("filtroEstados", obtenerEstadosSeleccionados()); +// } + + String format = "pdf"; + + try { + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + + public void reporteNumArmasXls() { + try { + String gradoUsuario =""; + String path = "armas/reports/reporteArmasCompania"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename="reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + parameters.put("filtroEstados", obtenerEstadosSeleccionados()); + + + String format = "xls"; + + try { + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + private String obtenerEstadosSeleccionados(){ + StringBuilder filtro = new StringBuilder(); + StringBuilder estadosSel = new StringBuilder(); + for (String estado : estadosSeleccionados) { + estadosSel.append("'"); + estadosSel.append(estado); + estadosSel.append("',"); + } + filtro.append(" AND A.ESTADO IN ("); + filtro.append(estadosSel.substring(0, estadosSel.length() - 1)); + filtro.append(")"); + LOGGER.info("el filtro obtenido es el siguiente::" + filtro); + return filtro.toString(); + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public String getIdTipoReg() { + return idTipoReg; + } + + public void setIdTipoReg(String idTipoReg) { + this.idTipoReg = idTipoReg; + } + + public List getLtiporeg() { + return ltiporeg; + } + + public void setLtiporeg(List ltiporeg) { + this.ltiporeg = ltiporeg; + } + + public PersonDetailController getPersonDetailController() { + return personDetailController; + } + + public void setPersonDetailController( + PersonDetailController personDetailController) { + this.personDetailController = personDetailController; + } + + public CentroControlArmasController getCentroControlController() { + return centroControlController; + } + + public void setCentroControlController( + CentroControlArmasController centroControlController) { + this.centroControlController = centroControlController; + } + + public List getLcentroControl() { + return lcentroControl; + } + + public void setLcentroControl(List lcentroControl) { + this.lcentroControl = lcentroControl; + } + + public String getCodCentroControl() { + return codCentroControl; + } + + public void setCodCentroControl(String codCentroControl) { + this.codCentroControl = codCentroControl; + } + + public List getLestadosArma() { + return lestadosArma; + } + + public void setLestadosArma(List lestadosArma) { + this.lestadosArma = lestadosArma; + } + + public List getEstadosSeleccionados() { + return estadosSeleccionados; + } + + public void setEstadosSeleccionados(List estadosSeleccionados) { + this.estadosSeleccionados = estadosSeleccionados; + } + + + + + + + + + + + + + + + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteNumPermisosController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteNumPermisosController.java.svn-base new file mode 100644 index 0000000..5c2ef64 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteNumPermisosController.java.svn-base @@ -0,0 +1,477 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.eclipse.jdt.core.dom.ThisExpression; +import org.jboss.logging.Logger; +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +/** + * @author usermaia2 + * Clase Controladora la cual genera el reporte de trámite por centro de control + */ +@ManagedBean +@ViewScoped +public class ReporteNumPermisosController extends AbstractController { + + private final static Logger LOGGER = Logger.getLogger(ReporteNumPermisosController.class); + + public ReporteNumPermisosController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController personDetailController; + + @ManagedProperty(value = "#{centroControlController}") + private CentroControlArmasController centroControlController; + + + + private TcustPersonDetail customerperson; + private TsafeUserDetail userDetail; + private TcustPersonDetail responsableCentroControl= null; + private TsafeUserDetail tsafeUserDetailUsuario = null; + private TarmCentroControl centroControl = new TarmCentroControl(); + private List lcentroControl = null; + private List ltiporeg = null; + private List lestadosArma = null; + private List estadosSeleccionados = null; + private String institucionCentroControl=""; + private Date fechainicial; + private Date fechafinal; + private String filtro=""; + private String filtro2=""; + private String idTipoReg; + private Date fec_actual; + private String codCentroControl; + //Datos para buscar persona + private String razonSocial; + + private String numeroDocumento; + + private String filtroPersona; + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + ltiporeg = CatalogDetailController.find("TIPOREGISTRO", "DECINC"); + this.lestadosArma = CatalogDetailController.find("ESTADOARMA"); + this.lcentroControl = CentroControlArmasController.findAll(); + this.responsableCentroControl = new TcustPersonDetail(); +// this.tsafeUserDetailUsuario = new TsafeUserDetail(); + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + //this.obtenerResponsableCentroControl(); + this.idTipoReg=""; + this.codCentroControl=""; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if(tcustPersonAddres == null){ + return null; + } + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl(){ + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + @Override + protected void querydatabase() { + + } + + + + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + + } + + /** + * Obtiene el reporte de Ficha de Armas + */ + public void reporteTotalPermisos() { + try { + String gradoUsuario =""; + String path = "armas/reports/reporteNumeroPermisos"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename="reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + parameters.put("filtroPersona", obtenerPersonaSeleccionada()); + String format = "pdf"; + + try { + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + + public void reporteTotalPermisosXls() { + try { + String gradoUsuario =""; + String path = "armas/reports/reporteNumeroPermisos"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename="reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + parameters.put("filtroPersona", obtenerPersonaSeleccionada()); + String format = "xls"; + + try { + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public String getIdTipoReg() { + return idTipoReg; + } + + public void setIdTipoReg(String idTipoReg) { + this.idTipoReg = idTipoReg; + } + + public List getLtiporeg() { + return ltiporeg; + } + + public void setLtiporeg(List ltiporeg) { + this.ltiporeg = ltiporeg; + } + + public PersonDetailController getPersonDetailController() { + return personDetailController; + } + + public void setPersonDetailController( + PersonDetailController personDetailController) { + this.personDetailController = personDetailController; + } + + public CentroControlArmasController getCentroControlController() { + return centroControlController; + } + + public void setCentroControlController( + CentroControlArmasController centroControlController) { + this.centroControlController = centroControlController; + } + + public List getLcentroControl() { + return lcentroControl; + } + + public void setLcentroControl(List lcentroControl) { + this.lcentroControl = lcentroControl; + } + + public String getCodCentroControl() { + return codCentroControl; + } + + public void setCodCentroControl(String codCentroControl) { + this.codCentroControl = codCentroControl; + } + + public List getLestadosArma() { + return lestadosArma; + } + + public void setLestadosArma(List lestadosArma) { + this.lestadosArma = lestadosArma; + } + + public List getEstadosSeleccionados() { + return estadosSeleccionados; + } + + public void setEstadosSeleccionados(List estadosSeleccionados) { + this.estadosSeleccionados = estadosSeleccionados; + } + +//BUSQUEDA DE PERSONA + + public String getRazonSocial() { + return razonSocial; + } + + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public String getFiltroPersona() { + return filtroPersona; + } + + public void setFiltroPersona(String filtroPersona) { + this.filtroPersona = filtroPersona; + } + + + + /** + * Abre el lov de persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + + + + /** + * Maneja la respuesta del Lov de Personas + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + filtroPersona = ""; + TcustPersonDetail personaDetailSelecionada = (TcustPersonDetail) event.getObject(); + razonSocial=personaDetailSelecionada.getName(); + numeroDocumento=personaDetailSelecionada.getIdentification(); + filtroPersona=personaDetailSelecionada.getPk().getPersoncode().toString(); + LOGGER.info("parametro seleccionado " +filtroPersona); + //this.setLrecord(new ArrayList()); + FacesContext context = FacesContext.getCurrentInstance(); + context.addMessage(null, new FacesMessage("RECUERDE", MsgControlArmas.getProperty("msg_recuerdeClickSeleccionarArmas"))); + + } + + + + private String obtenerPersonaSeleccionada(){ + StringBuilder filtro = new StringBuilder(); + filtro.append(" AND personadetalle.identification IN ('"); + filtro.append(numeroDocumento); + filtro.append("')"); + LOGGER.info("el filtro obtenido de persona es el siguiente::" + filtro); + return filtro.toString(); + } + + + + + + + + + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReportePermisosAutorizacionesCconController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReportePermisosAutorizacionesCconController.java.svn-base new file mode 100644 index 0000000..f7e0ef8 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReportePermisosAutorizacionesCconController.java.svn-base @@ -0,0 +1,126 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * + * @author David Cruz + * + */ +@ManagedBean +@ViewScoped +public class ReportePermisosAutorizacionesCconController extends AbstractController { + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + private TsafeUserDetail userDetail; + private TgeneParameters paramDiasCaducidad; + private String centroControl=""; + private List lcentroControl; + + + public ReportePermisosAutorizacionesCconController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + public void init() { + beanalias = "REPORTE"; + lrecord = new ArrayList<>(); + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + paramDiasCaducidad = ParametersController.find("DIASCADUCIDADCERT", "1"); + lcentroControl = CentroControlArmasController.findAll(); + } + + private static final long serialVersionUID = 1L; + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + } + + public void generarReporte() { + String path = "armas/reports/reportePermisosAutorizacionesxSuspCcon"; + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + if(userDetail.getPk().getPersoncode()!=null){ + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + } + else{ + nombreUsuario = ""; + } +// TarmCentroControl ccentroControl= CentroControlArmasController.findPorCodigo(centroControl); +// String institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo( ccentroControl.getNombreinstitucion(), ccentroControl.getNombreinstitucioncodigo()).getDescription(); + SimpleDateFormat fechatxt=new SimpleDateFormat("dd/MM/yyyy"); + Date fechainicial = Calendar.getInstance().getTime(); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(fechainicial); + calendar.add(Calendar.DATE, (paramDiasCaducidad != null && paramDiasCaducidad.getNumbervalue() != null) ? paramDiasCaducidad.getNumbervalue().intValue() : 0); + Date fechafinal = calendar.getTime(); + parameters.put("usuario", nombreUsuario); +// parameters.put("centroControl", centroControl); +// parameters.put("nombrecentro", institucionCentroControl); + parameters.put("fechainicio", fechatxt.format(fechainicial)); + parameters.put("fechafin", fechatxt.format(fechafinal)); + String format="xlsx"; + String filename= "permisosautorizacionesxsusp"; + //Fecha actual + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getCentroControl() { + return centroControl; + } + + public void setCentroControl(String centroControl) { + this.centroControl = centroControl; + } + + public List getLcentroControl() { + return lcentroControl; + } + + public void setLcentroControl(List lcentroControl) { + this.lcentroControl = lcentroControl; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReportePermisosAutorizacionesSuspController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReportePermisosAutorizacionesSuspController.java.svn-base new file mode 100644 index 0000000..5b9e0f3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReportePermisosAutorizacionesSuspController.java.svn-base @@ -0,0 +1,168 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + + + + + +/** + * @author Andres Cevallos + * Clase Controladora la cual genera el reporte de armas + */ +@ManagedBean +@ViewScoped +public class ReportePermisosAutorizacionesSuspController extends AbstractController { + + public ReportePermisosAutorizacionesSuspController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + private TsafeUserDetail userDetail; + private String institucionCentroControl=""; + private TarmCentroControl centroControl = new TarmCentroControl(); + private Date fechainicial; + private Date fechafinal; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + obtenerCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Metodo que se debe ejecutar cuando es una transaccion de tipo verificar armas + * @throws Exception + */ + private void obtenerCentroControl() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + @Override + protected void querydatabase() { + } + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + } + + public void generarReporte(){ + if(fechainicial.getTime()>fechafinal.getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_fechafinal")); + return; + } + String path = "armas/reports/reportePermisosAutorizacionesSusp"; + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + if(userDetail.getPk().getPersoncode()!=null){ + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + } + else{ + nombreUsuario = ""; + } + SimpleDateFormat fechatxt=new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fechainicio", fechatxt.format(fechainicial)); + parameters.put("fechafin", fechatxt.format(fechafinal)); + parameters.put("usuario", nombreUsuario); + parameters.put("unidadmilitar", institucionCentroControl); + String format="xlsx"; + String filename= "permisosautorizacionessusp"; + //Fecha actual + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteTipoArma.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteTipoArma.java.svn-base new file mode 100644 index 0000000..04d9549 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteTipoArma.java.svn-base @@ -0,0 +1,477 @@ +package com.fp.frontend.controller.armas.funcionalidad; + + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.apache.log4j.Logger; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@ManagedBean +@ViewScoped +public class ReporteTipoArma extends AbstractController{ + + /** + * + */ + public ReporteTipoArma() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private final static Logger LOGGER = Logger.getLogger(ReporteTipoArma.class); + private static final long serialVersionUID = 1L; + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController personDetailController; + + @ManagedProperty(value = "#{centroControlController}") + private CentroControlArmasController centroControlController; + + + + private TcustPersonDetail customerperson; + private TsafeUserDetail userDetail; + private TcustPersonDetail responsableCentroControl= null; + private TsafeUserDetail tsafeUserDetailUsuario = null; + private TarmCentroControl centroControl = new TarmCentroControl(); + private List lcentroControl = null; + private List ltiporeg = null; + private List lestadosArma = null; + private List ltipoArma = null; + private List estadosSeleccionados = null; + //Tipo de Arma Seleccionada + private List tipoArmaSeleccionada = null; + + private String institucionCentroControl=""; + private Date fechainicial; + private Date fechafinal; + private String filtro=""; + private String filtro2=""; + private String idTipoReg; + private Date fec_actual; + private String codCentroControl; + + + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + ltiporeg = CatalogDetailController.find("TIPOREGISTRO", "DECINC"); + this.lestadosArma = CatalogDetailController.find("ESTADOARMA"); + //tipo de Arma + this.ltipoArma = CatalogDetailController.find("TIPOARMAEXPLOSIVO", "0010000001"); + this.lcentroControl = CentroControlArmasController.findAll(); + this.responsableCentroControl = new TcustPersonDetail(); +// this.tsafeUserDetailUsuario = new TsafeUserDetail(); + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + //this.obtenerResponsableCentroControl(); + this.idTipoReg=""; + this.codCentroControl=""; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if(tcustPersonAddres == null){ + return null; + } + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl(){ + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + + } + + /** + * Obtiene el reporte de Ficha de Armas + */ + public void reporteTotalArmaCompania() { + try { + String gradoUsuario =""; + String path = "armas/reports/reporteTipoArmasCompania"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename="reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + //fechas inicial y final que vienen desde el controlador +// SimpleDateFormat df=new SimpleDateFormat("dd/MM/yyyy"); +// parameters.put("fechainicial", df.format(this.fechainicial)); +// parameters.put("fechafinal", df.format(this.fechafinal)); + +// if(this.idTipoReg.equals("DECO") && this.idTipoReg!=null){ +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else if (this.idTipoReg.equals("INCA") && this.idTipoReg!=null) { +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else { + parameters.put("filtroEstados", obtenerEstadosSeleccionados()); + + parameters.put("filtroTipos", obtenerTipoArmaSeleccionada()); +// } + + String format = "pdf"; + + try { + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + + public void reporteTotalArmaCompaniaXls() { + try { + String gradoUsuario =""; + String path = "armas/reports/reporteTipoArmasCompania"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename="reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + //fechas inicial y final que vienen desde el controlador +// SimpleDateFormat df=new SimpleDateFormat("dd/MM/yyyy"); +// parameters.put("fechainicial", df.format(this.fechainicial)); +// parameters.put("fechafinal", df.format(this.fechafinal)); + +// if(this.idTipoReg.equals("DECO") && this.idTipoReg!=null){ +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else if (this.idTipoReg.equals("INCA") && this.idTipoReg!=null) { +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else { + parameters.put("filtroEstados", obtenerEstadosSeleccionados()); + + parameters.put("filtroTipos", obtenerTipoArmaSeleccionada()); +// } + + String format = "xls"; + + try { + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + + + private String obtenerEstadosSeleccionados(){ + StringBuilder filtro = new StringBuilder(); + StringBuilder estadosSel = new StringBuilder(); + for (String estado : estadosSeleccionados) { + estadosSel.append("'"); + estadosSel.append(estado); + estadosSel.append("',"); + } + filtro.append(" AND A.ESTADO IN ("); + filtro.append(estadosSel.substring(0, estadosSel.length() - 1)); + filtro.append(")"); + LOGGER.info("el filtro obtenido es el siguiente::" + filtro); + return filtro.toString(); + } + + + private String obtenerTipoArmaSeleccionada(){ + StringBuilder filtro = new StringBuilder(); + StringBuilder armaSel = new StringBuilder(); + for (String tipos : tipoArmaSeleccionada) { + armaSel.append("'"); + armaSel.append(tipos); + armaSel.append("',"); + } + + filtro.append(" AND T.CATALOG IN ("); + filtro.append(armaSel.substring(0, armaSel.length() - 1)); + filtro.append(")"); + LOGGER.info("el filtro obtenido tipo Arma es el siguiente::" + filtro); + return filtro.toString(); + } + + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public String getIdTipoReg() { + return idTipoReg; + } + + public void setIdTipoReg(String idTipoReg) { + this.idTipoReg = idTipoReg; + } + + public List getLtiporeg() { + return ltiporeg; + } + + public void setLtiporeg(List ltiporeg) { + this.ltiporeg = ltiporeg; + } + + public PersonDetailController getPersonDetailController() { + return personDetailController; + } + + public void setPersonDetailController( + PersonDetailController personDetailController) { + this.personDetailController = personDetailController; + } + + public CentroControlArmasController getCentroControlController() { + return centroControlController; + } + + public void setCentroControlController( + CentroControlArmasController centroControlController) { + this.centroControlController = centroControlController; + } + + public List getLcentroControl() { + return lcentroControl; + } + + public void setLcentroControl(List lcentroControl) { + this.lcentroControl = lcentroControl; + } + + public String getCodCentroControl() { + return codCentroControl; + } + + public void setCodCentroControl(String codCentroControl) { + this.codCentroControl = codCentroControl; + } + + public List getLestadosArma() { + return lestadosArma; + } + + public void setLestadosArma(List lestadosArma) { + this.lestadosArma = lestadosArma; + } + + public List getEstadosSeleccionados() { + return estadosSeleccionados; + } + + public void setEstadosSeleccionados(List estadosSeleccionados) { + this.estadosSeleccionados = estadosSeleccionados; + } + + public List getLtipoArma() { + return ltipoArma; + } + + public void setLtipoArma(List ltipoArma) { + this.ltipoArma = ltipoArma; + } + + public List getTipoArmaSeleccionada() { + return tipoArmaSeleccionada; + } + + public void setTipoArmaSeleccionada(List tipoArmaSeleccionada) { + this.tipoArmaSeleccionada = tipoArmaSeleccionada; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteTipoArmasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteTipoArmasController.java.svn-base new file mode 100644 index 0000000..74ce978 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteTipoArmasController.java.svn-base @@ -0,0 +1,238 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + + + +@ManagedBean (name="reporteTipoArmasController") +@ViewScoped +public class ReporteTipoArmasController extends AbstractController { + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + + private List lestados; + private TsafeUserDetail userDetail; + /** + * INSTITUCION A LA QUE PERTENECE + */ + private String institucionCentroControl; + /** + * VARIABLES PARA EL REPORTE + */ + private Date fechainicial; + private Date fechafinal; + private String estado; + private TcustPersonDetail customerperson; + + @PostConstruct + private void postconstruct() { + this.init(); + } + + public ReporteTipoArmasController() throws Exception { + super(AbstractDataTransport.class); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTETIPOARMAS"; + lestados = CatalogDetailController.find("ESTADOARMA"); + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + estado=""; + obtenerCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Metodo que se debe ejecutar cuando es una transaccion de tipo verificar armas + * @throws Exception + */ + private void obtenerCentroControl() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + TarmCentroControl centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + + } + + @Override + protected void querydatabase() { + + } + + /** + * Abre el Lov de Persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Carga los datos que se devuelven en el Lov de personas + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + setCustomerperson( (TcustPersonDetail) event.getObject()); + + } + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + } + + public void generarReporte(){ + if(fechainicial.getTime()>fechafinal.getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_fechafinal")); + return; + } + String filtro=" "; + String path = "armas/reports/reporteTipoArmas"; + if(customerperson!=null){ + filtro=" and tarma.cregistro in " + + " (select regarma.cregistro from tarmregistroarmas regarma where regarma.personcode='"+customerperson.getPk().getPersoncode()+"')"; + } + if(estado!=null && !estado.equals("")){ + if(estado.equals("APTA")){ + filtro+=" and tarma.carma in (select carma from tarmarmapruebas p " + + " where p.carmaprueba=(select max(prue.carmaprueba)" + + " from tarmarmapruebas prue where prue.apruebaevaluacion='Y' and prue.carma in(select codar.carma from tarmarmas codar" + + " where codar.codigoarma =(select ar.codigoarma from tarmarmas ar where carma=tarma.carma) ))) "; + } + else{ + filtro+=" and tarma.estado='"+estado+"' "; + } + }else{ + filtro+=" and tarma.estado!='VEND' and tarma.estado!='MING' and tarma.estado!='DUPL'"; + } + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + if(userDetail.getPk().getPersoncode()!=null){ + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + } + else{ + nombreUsuario = ""; + } + //filtro = "where tarma.personcode='1138'"; + parameters.put("filtro", filtro); + SimpleDateFormat fechatxt=new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fechainicial", fechatxt.format(fechainicial)); + parameters.put("fechafinal", fechatxt.format(fechafinal)); + parameters.put("usuario", nombreUsuario); + parameters.put("unidadmilitar", institucionCentroControl); + String format="xlsx"; + String filename= MsgControlArmas.getProperty("lbl_nombreexcel"); + //Fecha actual + Calendar fechaActualCldr = Calendar.getInstance(); + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH)+1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarfecha", fechaActualSB.toString()); + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public List getLestados() { + return lestados; + } + + public void setLestados(List lestados) { + this.lestados = lestados; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteTipoAutorizacionController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteTipoAutorizacionController.java.svn-base new file mode 100644 index 0000000..45628ed --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteTipoAutorizacionController.java.svn-base @@ -0,0 +1,476 @@ +package com.fp.frontend.controller.armas.funcionalidad; + + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.apache.log4j.Logger; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@ManagedBean +@ViewScoped +public class ReporteTipoAutorizacionController extends AbstractController{ + + /** + * + */ + public ReporteTipoAutorizacionController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private final static Logger LOGGER = Logger.getLogger(ReporteTipoAutorizacionController.class); + private static final long serialVersionUID = 1L; + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController personDetailController; + + @ManagedProperty(value = "#{centroControlController}") + private CentroControlArmasController centroControlController; + + + + private TcustPersonDetail customerperson; + private TsafeUserDetail userDetail; + private TcustPersonDetail responsableCentroControl= null; + private TsafeUserDetail tsafeUserDetailUsuario = null; + private TarmCentroControl centroControl = new TarmCentroControl(); + private List lcentroControl = null; + private List ltiporeg = null; + private List ltipoAuto = null; + private List ltipoArma = null; + private List tipoAutoSeleccionado = null; + //Tipo de Arma Seleccionada + private List tipoArmaSeleccionada = null; + + private String institucionCentroControl=""; + private Date fechainicial; + private Date fechafinal; + private String filtro=""; + private String filtro2=""; + private String idTipoReg; + private Date fec_actual; + private String codCentroControl; + + + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + ltiporeg = CatalogDetailController.find("TIPOREGISTRO", "DECINC"); + this.ltipoAuto = CatalogDetailController.find("TIPOAUTORIZACION"); + //tipo de Arma + this.ltipoArma = CatalogDetailController.find("TIPOARMAEXPLOSIVO", "0010000001"); + this.lcentroControl = CentroControlArmasController.findAll(); + this.responsableCentroControl = new TcustPersonDetail(); +// this.tsafeUserDetailUsuario = new TsafeUserDetail(); + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + //this.obtenerResponsableCentroControl(); + this.idTipoReg=""; + this.codCentroControl=""; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if(tcustPersonAddres == null){ + return null; + } + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl(){ + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + + } + + /** + * Obtiene el reporte de Ficha de Armas + */ + public void reporteTipoAutorizacion() { + try { + String gradoUsuario =""; + String path = "armas/reports/reporteTipoAutorizacion"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename="reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + //fechas inicial y final que vienen desde el controlador +// SimpleDateFormat df=new SimpleDateFormat("dd/MM/yyyy"); +// parameters.put("fechainicial", df.format(this.fechainicial)); +// parameters.put("fechafinal", df.format(this.fechafinal)); + +// if(this.idTipoReg.equals("DECO") && this.idTipoReg!=null){ +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else if (this.idTipoReg.equals("INCA") && this.idTipoReg!=null) { +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else { + parameters.put("filtroEstados", obtenerEstadosSeleccionados()); + + +// } + + String format = "pdf"; + + try { + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + + public void reporteTipoAutorizacionXls() { + try { + String gradoUsuario =""; + String path = "armas/reports/reporteTipoAutorizacion"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename="reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + //fechas inicial y final que vienen desde el controlador +// SimpleDateFormat df=new SimpleDateFormat("dd/MM/yyyy"); +// parameters.put("fechainicial", df.format(this.fechainicial)); +// parameters.put("fechafinal", df.format(this.fechafinal)); + +// if(this.idTipoReg.equals("DECO") && this.idTipoReg!=null){ +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else if (this.idTipoReg.equals("INCA") && this.idTipoReg!=null) { +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else { + parameters.put("filtroEstados", obtenerEstadosSeleccionados()); + + +// } + + String format = "xls"; + + try { + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + + private String obtenerEstadosSeleccionados(){ + StringBuilder filtro = new StringBuilder(); + StringBuilder autorizacionSel = new StringBuilder(); + for (String autorizacion : tipoAutoSeleccionado) { + autorizacionSel.append("'"); + autorizacionSel.append(autorizacion); + autorizacionSel.append("',"); + } + filtro.append(" AND autorizacion.CATALOG IN ("); + filtro.append(autorizacionSel.substring(0, autorizacionSel.length() - 1)); + filtro.append(")"); + LOGGER.info("el filtro obtenido es el siguiente::" + filtro); + return filtro.toString(); + } + + + private String obtenerTipoArmaSeleccionada(){ + StringBuilder filtro = new StringBuilder(); + StringBuilder armaSel = new StringBuilder(); + for (String tipos : tipoArmaSeleccionada) { + armaSel.append("'"); + armaSel.append(tipos); + armaSel.append("',"); + } + + filtro.append(" AND T.CATALOG IN ("); + filtro.append(armaSel.substring(0, armaSel.length() - 1)); + filtro.append(")"); + LOGGER.info("el filtro obtenido tipo Arma es el siguiente::" + filtro); + return filtro.toString(); + } + + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public String getIdTipoReg() { + return idTipoReg; + } + + public void setIdTipoReg(String idTipoReg) { + this.idTipoReg = idTipoReg; + } + + public List getLtiporeg() { + return ltiporeg; + } + + public void setLtiporeg(List ltiporeg) { + this.ltiporeg = ltiporeg; + } + + public PersonDetailController getPersonDetailController() { + return personDetailController; + } + + public void setPersonDetailController( + PersonDetailController personDetailController) { + this.personDetailController = personDetailController; + } + + public CentroControlArmasController getCentroControlController() { + return centroControlController; + } + + public void setCentroControlController( + CentroControlArmasController centroControlController) { + this.centroControlController = centroControlController; + } + + public List getLcentroControl() { + return lcentroControl; + } + + public void setLcentroControl(List lcentroControl) { + this.lcentroControl = lcentroControl; + } + + public String getCodCentroControl() { + return codCentroControl; + } + + public void setCodCentroControl(String codCentroControl) { + this.codCentroControl = codCentroControl; + } + + public List getLtipoAuto() { + return ltipoAuto; + } + + public void setLtipoAuto(List lestadosArma) { + this.ltipoAuto = lestadosArma; + } + + public List getTipoAutoSeleccionado() { + return tipoAutoSeleccionado; + } + + public void setTipoAutoSeleccionado(List estadosSeleccionados) { + this.tipoAutoSeleccionado = estadosSeleccionados; + } + + public List getLtipoArma() { + return ltipoArma; + } + + public void setLtipoArma(List ltipoArma) { + this.ltipoArma = ltipoArma; + } + + public List getTipoArmaSeleccionada() { + return tipoArmaSeleccionada; + } + + public void setTipoArmaSeleccionada(List tipoArmaSeleccionada) { + this.tipoArmaSeleccionada = tipoArmaSeleccionada; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteTipoFabricacionController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteTipoFabricacionController.java.svn-base new file mode 100644 index 0000000..1209a07 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteTipoFabricacionController.java.svn-base @@ -0,0 +1,434 @@ +package com.fp.frontend.controller.armas.funcionalidad; + + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.apache.log4j.Logger; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@ManagedBean +@ViewScoped +public class ReporteTipoFabricacionController extends AbstractController{ + + /** + * + */ + public ReporteTipoFabricacionController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private final static Logger LOGGER = Logger.getLogger(ReporteTipoArma.class); + private static final long serialVersionUID = 1L; + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController personDetailController; + + @ManagedProperty(value = "#{centroControlController}") + private CentroControlArmasController centroControlController; + + + + private TcustPersonDetail customerperson; + private TsafeUserDetail userDetail; + private TcustPersonDetail responsableCentroControl= null; + private TsafeUserDetail tsafeUserDetailUsuario = null; + private TarmCentroControl centroControl = new TarmCentroControl(); + private List lcentroControl = null; + private List ltiporeg = null; + private List lestadosArma = null; + private List ltipoFabArma = null; + private List estadosSeleccionados = null; + //Tipo de Fabricacion Arma Seleccionada + private List tipoFabArmaSeleccionada = null; + + private String institucionCentroControl=""; + private Date fechainicial; + private Date fechafinal; + private String filtro=""; + private String filtro2=""; + private String idTipoReg; + private Date fec_actual; + private String codCentroControl; + + + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + ltiporeg = CatalogDetailController.find("TIPOREGISTRO", "DECINC"); + this.lestadosArma = CatalogDetailController.find("ESTADOARMA"); + //tipo de Fabricacion Arma + this.ltipoFabArma = CatalogDetailController.find("TIPOFABRICACION"); + this.lcentroControl = CentroControlArmasController.findAll(); + this.responsableCentroControl = new TcustPersonDetail(); +// this.tsafeUserDetailUsuario = new TsafeUserDetail(); + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + //this.obtenerResponsableCentroControl(); + this.idTipoReg=""; + this.codCentroControl=""; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if(tcustPersonAddres == null){ + return null; + } + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl(){ + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + + } + + /** + * Obtiene el reporte de Tipo de Fabricacion de las Armas + */ + public void reporteTipoFabricacion() { + try { + String gradoUsuario =""; + String path = "armas/reports/reporteTipoFabricacion"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename="reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + + parameters.put("filtroTipos", obtenerTipoFabArmaSeleccionada()); +// } + + String format = "pdf"; + + try { + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public void reporteTipoFabricacionXls() { + try { + String gradoUsuario =""; + String path = "armas/reports/reporteTipoFabricacion"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename="reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + + parameters.put("filtroTipos", obtenerTipoFabArmaSeleccionada()); +// } + + String format = "xls"; + + try { + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + private String obtenerTipoFabArmaSeleccionada(){ + StringBuilder filtro = new StringBuilder(); + StringBuilder armaSel = new StringBuilder(); + for (String tipos : tipoFabArmaSeleccionada) { + armaSel.append("'"); + armaSel.append(tipos); + armaSel.append("',"); + } + + filtro.append(" AND A.TIPOFABRICACION IN ("); + filtro.append(armaSel.substring(0, armaSel.length() - 1)); + filtro.append(")"); + LOGGER.info("el filtro obtenido tipo Arma es el siguiente::" + filtro); + return filtro.toString(); + } + + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public String getIdTipoReg() { + return idTipoReg; + } + + public void setIdTipoReg(String idTipoReg) { + this.idTipoReg = idTipoReg; + } + + public List getLtiporeg() { + return ltiporeg; + } + + public void setLtiporeg(List ltiporeg) { + this.ltiporeg = ltiporeg; + } + + public PersonDetailController getPersonDetailController() { + return personDetailController; + } + + public void setPersonDetailController( + PersonDetailController personDetailController) { + this.personDetailController = personDetailController; + } + + public CentroControlArmasController getCentroControlController() { + return centroControlController; + } + + public void setCentroControlController( + CentroControlArmasController centroControlController) { + this.centroControlController = centroControlController; + } + + public List getLcentroControl() { + return lcentroControl; + } + + public void setLcentroControl(List lcentroControl) { + this.lcentroControl = lcentroControl; + } + + public String getCodCentroControl() { + return codCentroControl; + } + + public void setCodCentroControl(String codCentroControl) { + this.codCentroControl = codCentroControl; + } + + public List getLestadosArma() { + return lestadosArma; + } + + public void setLestadosArma(List lestadosArma) { + this.lestadosArma = lestadosArma; + } + + public List getEstadosSeleccionados() { + return estadosSeleccionados; + } + + public void setEstadosSeleccionados(List estadosSeleccionados) { + this.estadosSeleccionados = estadosSeleccionados; + } + + + public List getLtipoFabArma() { + return ltipoFabArma; + } + + public void setLtipoFabArma(List ltipoFabArma) { + this.ltipoFabArma = ltipoFabArma; + } + + public List getTipoFabArmaSeleccionada() { + return tipoFabArmaSeleccionada; + } + + public void setTipoFabArmaSeleccionada(List tipoFabArmaSeleccionada) { + this.tipoFabArmaSeleccionada = tipoFabArmaSeleccionada; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteTramiteCentroController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteTramiteCentroController.java.svn-base new file mode 100644 index 0000000..9325016 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/ReporteTramiteCentroController.java.svn-base @@ -0,0 +1,401 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.eclipse.jdt.core.dom.ThisExpression; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +/** + * @author DLO + * Clase Controladora la cual genera el reporte de trámite por centro de control + */ +@ManagedBean +@ViewScoped +public class ReporteTramiteCentroController extends AbstractController { + + public ReporteTramiteCentroController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController personDetailController; + + @ManagedProperty(value = "#{centroControlController}") + private CentroControlArmasController centroControlController; + + private TcustPersonDetail customerperson; + private TsafeUserDetail userDetail; + private TcustPersonDetail responsableCentroControl= null; + private TsafeUserDetail tsafeUserDetailUsuario = null; + private TarmCentroControl centroControl = new TarmCentroControl(); + private List lcentros = null; + private List lestados = null; + private String institucionCentroControl=""; + private Date fechainicial; + private Date fechafinal; + private String filtro=""; + private String filtro2=""; + private String idCentroControl; + private String estado; + private Date fec_actual; + private String estadoDoc; + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + lcentros = CatalogDetailController.find("NOMBREINSTITUCION"); + this.lestados = CatalogDetailController.find("ESTADODOCUMENTO"); + this.responsableCentroControl = new TcustPersonDetail(); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + //this.obtenerResponsableCentroControl(); + this.idCentroControl=""; + this.estadoDoc =""; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if(tcustPersonAddres!=null && tcustPersonAddres.getProvincecode()!=null){ + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + else{ + return ""; + } + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl(){ + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + @Override + protected void querydatabase() { + + } + + + + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + + } + + /** + * Obtiene el reporte de Ficha de Armas + */ + public void reporteTramitesCentro() { + try { + if(this.fechainicial.getTime()>this.fechafinal.getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_fechafinal")); + return; + } + String gradoUsuario =""; + String path = "armas/reports/reporteTremiteXCentro"; + String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + //String filename="reporte"; + + // Datos del centro de control del usuario logueado + institucionCentroControl = obtenerCentroControl(); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("centroControl", institucionCentroControl); + + //Centro de control + parameters.put("centroControl", this.obtenerCentroControl()); + + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson=PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + //fechas inicial y final que vienen desde el controlador + SimpleDateFormat df=new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fechainicial", df.format(this.fechainicial)); + parameters.put("fechafinal", df.format(this.fechafinal)); + + TarmCentroControl centro =null; + if(!this.idCentroControl.toString().equals("TODOS")){ + centro = CentroControlArmasController.findPorCentroControl(this.idCentroControl.toString()); + } +// if(centro == null){ +// MessageHelper.setMessageInfo("EL CENTRO DE CONTROL DE ARMAS SELECCIONADO NO TIENE DATOS A MOSTRAR"); +// return; +// } + + if(centro!=null && centro.getPk()!=null && this.idCentroControl.toString()!="TODOS"){ + this.filtro = " and h.ccentrocontrol = '"+centro.getPk()+"' "; + parameters.put("filtro", this.filtro); + }else { + parameters.put("filtro", ""); + } + + if(this.estadoDoc.equals("APR") && this.estadoDoc!=null){ + this.filtro2 = " and h.estado = '"+this.estadoDoc+"' "; + parameters.put("filtro2", this.filtro2); + }else if (this.estadoDoc.equals("CAN") && this.estadoDoc!=null) { + this.filtro2 = " and h.estado = '"+this.estadoDoc+"' "; + parameters.put("filtro2", this.filtro2); + }else if (this.estadoDoc.equals("SUS") && this.estadoDoc!=null) { + this.filtro2 = " and h.estado = '"+this.estadoDoc+"' "; + parameters.put("filtro2", this.filtro2); + }else if (this.estadoDoc.equals("FIN") && this.estadoDoc!=null) { + this.filtro2 = " and h.estado = '"+this.estadoDoc+"' "; + parameters.put("filtro2", this.filtro2); + }else { + parameters.put("filtro2", ""); + } + + + String format = "xlsx"; + + try { + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public String getIdCentroControl() { + return idCentroControl; + } + + public void setIdCentroControl(String idCentroControl) { + this.idCentroControl = idCentroControl; + } + + public List getLcentros() { + return lcentros; + } + + public void setLcentros(List lcentros) { + this.lcentros = lcentros; + } + + public PersonDetailController getPersonDetailController() { + return personDetailController; + } + + public void setPersonDetailController( + PersonDetailController personDetailController) { + this.personDetailController = personDetailController; + } + + public CentroControlArmasController getCentroControlController() { + return centroControlController; + } + + public void setCentroControlController( + CentroControlArmasController centroControlController) { + this.centroControlController = centroControlController; + } + + public List getLestados() { + return lestados; + } + + public void setLestados(List lestados) { + this.lestados = lestados; + } + + public String getEstadoDoc() { + return estadoDoc; + } + + public void setEstadoDoc(String estadoDoc) { + this.estadoDoc = estadoDoc; + } + + public StringBuilder armarFormatoFechaSinHora(Calendar fechaCldr){ + StringBuilder fechaStr= new StringBuilder(); + fechaStr = fechaStr.append((fechaCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCldr.get(Calendar.DAY_OF_MONTH))); + fechaStr = fechaStr.append("-").append((fechaCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaCldr.get(Calendar.MONTH) + 1) : (fechaCldr.get(Calendar.MONTH)+1)); + fechaStr = fechaStr.append("-").append(fechaCldr.get(Calendar.YEAR)); + return fechaStr; + } + + + + + + + + + + + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/TotalArmasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/TotalArmasController.java.svn-base new file mode 100644 index 0000000..6995c00 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/TotalArmasController.java.svn-base @@ -0,0 +1,140 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.pgeneral.gene.TgeneCountry; + + +/** + * Clase controladora del bean TarmTotalPersona. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class TotalArmasController extends AbstractController { + + /** + * Constructor + * @throws Exception + */ + public TotalArmasController() throws Exception { + super(TarmTotalPersona.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TOTALCONTROLLER"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static TarmTotalPersona findbyClase(String clase, String tipoarmaexplosivo, String personcodigo) { + try { + TotalArmasController cc = new TotalArmasController(); + + cc.init(); + cc.recperpage = 300; + cc.addFilter("clase", clase); + cc.addFilter("tipoarmaexplosivo", tipoarmaexplosivo); + cc.addFilter("personcodigo", personcodigo); + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/VentaController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/VentaController.java.netbeans-base new file mode 100644 index 0000000..dc7c09f --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/VentaController.java.netbeans-base @@ -0,0 +1,823 @@ + package com.fp.frontend.controller.armas.funcionalidad; + +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.SelectEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmVentaArmaTemporalController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.armas.parametros.VentaTotalPersonaController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.fun.TarmMovimientoArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + + + +/** + * @author Andres Cevallos + * Clase Controladora la cual maneja la venta de armas + */ +@ManagedBean +@ViewScoped +public class VentaController extends AbstractController { + + public VentaController() throws Exception { + super(TarmArmas.class); + } + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{movimientoController}") + private MovimientoController movimientoController; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmController; + + @ManagedProperty(value = "#{ventaTotalPersonaController}") + private VentaTotalPersonaController ventaTotalPersonaController; + + @ManagedProperty(value = "#{tarmVentaArmaTemporalController}") + private TarmVentaArmaTemporalController ventaArmaTemp; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + + private String loteFilter; + + /** + * Lisat de personas + */ + private List lperson; + private TarmMovimientoArmas movimientoArma; + + /** + * Persona Cliente a la cual se le vende un arma + */ + private TcustPersonDetail compradorArma; + /** + * Cantidad de producto en venta + */ + private Integer cantidad; + /** + * Peso del producto en venta + */ + private BigDecimal peso; + /** + * Referencia de los Movimientos en el catalogo + */ + private List lmovimientos; + /** + * Lista referenciada al catalogo + */ + private List lcatalog; + /** + * Referencia del cliente en el catalogo + */ + private TgeneCatalogDetail cdetalle; + /** + * Detalle de la persona que vende el arma + */ + private TcustPersonDetail persondetail; + /** + * Fecha actual del sistema + */ + private Date fecha; + /** + * Lista de centros de control + */ + private List centroControlList; + + /** + * Codigo del centro de control + */ + private String ccentrocontrol; + + /** + * umero de solicitud + */ + private String numerosolicitud; + /** + * bandera para el flujo de venta + */ + private String flujoventa; + /** + * bandera para el consumo de municion + */ + private String consumomunicion; + + /** + * Variable que nos permite cargar el documento al Alfresco + */ + private UploadedFile uploadedFile; + + @PostConstruct + private void postconstruct() { + this.init(); + centroControlList=CentroControlArmasController.findEstadoInst("Y","1");//Departamento + querydatabase(); + } + + private void init() { + try { + peso=null; + cantidad=null; + this.lrecord = new ArrayList<>(); + this.beanalias = "VENTAARMAS"; + // tipomovimiento=false; + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + this.persondetail=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + lmovimientos = CatalogDetailController.find("TIPOREGISTRO","MOV");//catalogo de movimientos + cdetalle = CatalogDetailController.findxCodigoCodcatalogo(getPersondetail().getIdentificationcatalog(),getPersondetail().getIdentificationcatalogcode()); + fecha = new Date(); + lcatalog=CatalogDetailController.find("IDENTIFICATION"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + + SubQuery subqueryLonguitud= new SubQuery("TgeneCatalogDetail","description","longitud","i.pk.catalog=(select o.longitud from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.longitudcodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryLonguitud); + + SubQuery subqueryClase= new SubQuery("TgeneCatalogDetail","description","clase","i.pk.catalog=(select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClase); + + SubQuery subqueryTipoArma= new SubQuery("TgeneCatalogDetail","description","tipoarmaexplosivo","i.pk.catalog=(select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipoArma); + + SubQuery subqueryCalibre= new SubQuery("TgeneCatalogDetail","description","calibre","i.pk.catalog=(select o.calibre from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.calibrecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryCalibre); + + SubQuery subqueryUnidad= new SubQuery("TgeneCatalogDetail","description","unidadmedidapeso","i.pk.catalog=(select o.unidadmedidapeso from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryUnidad); + + dto.setOrderby("lote, ctipoarmaexplosivo,cregistro"); + + Filter filtro=new Filter(); + String filtrofecha= "t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) " + + " and t.estado in("+MsgControlArmas.getProperty("codigo_estado_arma_busqueda_venta")+") "//'REG','REN','APTA','DEV','ECO','COLE' + + " and cregistro in (select reg.pk from TarmRegistroArmas reg where reg.personcode ='"+persondetail.getPk().getPersoncode()+"' )" + + " and (t.peso>0 or t.cantidad>0)"; + + if(loteFilter!=null && !loteFilter.isEmpty()){ + filtrofecha+=" and UPPER(t.lote) like '"+loteFilter+"'"; + } + + filtro.setSql(filtrofecha); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); +// request.put("queryalias", "ARMASCOMPLETE"); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Cambia el valor del movimiento de Venta a Materia Prima + */ + public void changeType(){ + compradorArma=new TcustPersonDetail(); + } + /** + * Valida que la fecha de venta no seaa superior a la fecha del sistema + * @param fech + */ + public void validarfecha(Date fech){ + if(fech.getTime()>(new Date()).getTime()){ + fecha=new Date(); + } + } + + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en el Alfresco + */ + public void handleUpload(FileUploadEvent event){ + uploadedFile = event.getFile(); + } + + /** + * Recorta el nombre del archivo a cargarse + * @param nombre + * @return nombre recortado + */ + public String recorteNombre(String nombre){ + String fielname=nombre; + if(fielname.length()>30){ + fielname=fielname.substring(0,30)+extencionArchivo(nombre); + } + return fielname; + } + /** + * Obtiene la extencion del archivo a cargar + * @param nombre + * @return + */ + private String extencionArchivo(String nombre){ + int pos=nombre.lastIndexOf('.'); + nombre=nombre.substring(pos); + return nombre; + } + + /** + * Actualiza la informacion en el lrecord + */ + @Override + public void update(){ + try { + String pathRuta=""; + //ACTUALIZA ELRESTO DE DATOS DE LA TABLA DE MOVIMIENTO + this.movimientoArma.setPersoncodevendedor(persondetail.getPk().getPersoncode()); + this.movimientoArma.getModifiedData().put("personaVemdedor", persondetail); + if(movimientoArma.getTipomovimiento().equals("VENT")){ + if(compradorArma!=null && compradorArma.getPk()!=null){ + //if(verificaDocHabilitante(compradorArma.getPk().getPersoncode())){ + this.movimientoArma.setPersoncodecomprador(compradorArma.getPk().getPersoncode()); + this.movimientoArma.getModifiedData().put("personaComprador", compradorArma); + } + else{ + MessageHelper.setMessageWarn("DEBE INGRESAR UN CLIENTE"); + return; + } + //VALIDA SI ES ARMA: LETAL Y NO LETAL + TarmTipoArmaExplosivo tipoArmaExplosivo=TiposArmasExplosivosController.findarma(this.record.getCtipoarmaexplosivo()); + if(tipoArmaExplosivo!=null && tipoArmaExplosivo.getClasecodigo().equals("CLASE") + && ((this.flujoventa !=null && this.flujoventa.equals("SI") && movimientoArma.getTipomovimiento().equals("VENT")) || + (this.consumomunicion!=null && this.consumomunicion.equals("SI") && movimientoArma.getTipomovimiento().equals("CONS"))) + && (tipoArmaExplosivo.getClase().equals("0010000008") || tipoArmaExplosivo.getClase().equals("0010000001") + || tipoArmaExplosivo.getClase().equals("0010000002"))){//0010000002 MUNICION + + String xPathLocation= getRutaDocumentoSolBase() + "/cm:I-" +persondetail.getIdentification()+ "/cm:C-" + record.getCodigoarma() ; + if(uploadedFile!=null && uploadedFile.getFileName()!=null){ + String extencionArchivo=getExtension(uploadedFile.getFileName()); + String nombreArchivo = "PERMISO-"+this.record.getCodigoarma()+"."+extencionArchivo; + if(alfrescoController.uploadFile(uploadedFile.getInputstream(),nombreArchivo, xPathLocation)){ + pathRuta=xPathLocation + "/cm:" + nombreArchivo; + }else{ + MessageHelper.setMessageError("Adjunte el documento erroneo"); + return; + } + }else{ + MessageHelper.setMessageError("Adjunte el documento "); + return; + } + + if(ccentrocontrol!=null && !ccentrocontrol.trim().isEmpty()){ + saveVentaArma(pathRuta); + //retorna + return; + }else{ + MessageHelper.setMessageWarn("SELECCIONE EL CENTRO DE CONTROL"); + return; + } + } + }else{ + this.movimientoArma.getModifiedData().put("personaComprador", persondetail); + this.movimientoArma.setPersoncodecomprador(persondetail.getPk().getPersoncode());//es el mismo si el tipo movimientoArma.getTipomovimiento() es diferente de nenta + } + save(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta = new StringBuilder("cm:Solicitudes"); + ruta = ruta.append("/cm:VentaTem-"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + return ruta.toString(); + } + /** + * Metodo que retorna la extencion del documento que se desea subir al alfresco + */ + public String getExtension(String filename) { + int index = filename.lastIndexOf('.'); + if (index == -1) { + return ""; + } else { + return filename.substring(index + 1); + } + } + + public void saveVentaArma(String pathRuta) { + try { + System.out.println("-------------Ingresa Venta Armas Save: "+numerosolicitud); + + //actualiza el arma a un estado pendiente de venta + this.record.setEstadoventa("PENVEN"); + numerosolicitud=record.getPk(); + System.out.println("------------Ingresa Venta Armas Save2: "+numerosolicitud); + + super.update(); + + ventaArmaTemp.clearAll(); + ventaArmaTemp.create(); + ventaArmaTemp.getRecord().setCarma(record.getPk()); + //this.movimientoArma.setPersoncodecomprador(compradorArma.getPk().getPersoncode()); + ventaArmaTemp.getRecord().setPersoncodigo(compradorArma.getPk().getPersoncode()); + ventaArmaTemp.getRecord().setEstado("PENDIENTE"); + ventaArmaTemp.getRecord().setFcreacion(new java.sql.Date(new Date().getTime())); + ventaArmaTemp.getRecord().setFactura( movimientoArma.getFactura()); + ventaArmaTemp.getRecord().setNoregistra(movimientoArma.getNoregistro()); + ventaArmaTemp.getRecord().setJustificacion(movimientoArma.getJustificacion()); + ventaArmaTemp.getRecord().setPathdocumento(pathRuta); + ventaArmaTemp.getRecord().setCentrocontrol(ccentrocontrol); + ventaArmaTemp.update(); + + Request request = this.callerhelper.getRequest(); + super.cleanRequest(request); + + HashMap msave = new HashMap(); + + DtoSave dtosaveArma = this.getDtoSave(true); + dtosaveArma.setPosition(1); + msave.put(this.getBeanalias(), dtosaveArma);//2 + + DtoSave dtosaveRegistro = this.ventaArmaTemp.getDtoSave(true); + dtosaveRegistro.setPosition(2); + msave.put(ventaArmaTemp.getBeanalias(), dtosaveRegistro); + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.ventaArmaTemp.postCommit(resp); + this.record= new TarmArmas(); + MessageHelper.setMessageInfo(resp); + //inicio del flujo + iniciarFlujo(); + super.cleanRequest(request); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + querydatabase(); + } + + + /** + * Método para el inicio de flujo + */ + public void iniciarFlujo() { + try { + System.out.println("--------------Ingresa Venta Armas Inicio Flujo: "+numerosolicitud); + + String cprovincia=null; + for(TarmCentroControl centro: centroControlList){ + if(ccentrocontrol.equals(centro.getPk())){ + cprovincia=centro.getProvincecode(); + } + } + ; + if(cprovincia==null || cprovincia.length()==0){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinprovincia")); + return; + } + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + + request.modifiedData().put("csolicitud", numerosolicitud);//nuemro del arma carma pk + SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm", Locale.getDefault()); + request.modifiedData().put("numerosolicitud", numerosolicitud+"-"+this.persondetail.getPk().getPersoncode()+"-"+dateFormat.format(new Date()) ); + request.modifiedData().put("cprovincia", cprovincia); + request.modifiedData().put("isnew", "Y"); + request.setLogsolicitude(numerosolicitud); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.setShowRow(true); + cantidad=null; + peso=null; + //crea un movimiento para la tabla TarmMovimientoArmas + movimientoArma= null; + //crea a la persona compradora + compradorArma=null; + // tipomovimiento=false; + flujoventa=null; + consumomunicion=null; + //flujoiniciado = true; + //deshabilitarPantalla = Boolean.TRUE; + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + " SOLICITUD: " + numerosolicitud); + //saveInicioFlujoEnYES(); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Valida que la cantidad que se desea vender no sea superior a la cantidad maxima que se tiene + * @param cantidad + */ + public void validarCantidadMexima(Integer cantidad){ + this.peso=null; + if(cantidad==null || cantidad==0 || cantidad<0|| cantidad.compareTo(record.getCantidad())>0){ + this.cantidad=record.getCantidad(); + } + } + /** + * Valida que la cantidad que se desea vender no sea superior a la cantidad maxima que se tiene + * @param peso + */ + public void validarPesoMexima(BigDecimal peso){ + this.cantidad=null; + if(peso==null || peso.compareTo(new BigDecimal(0))==0|| peso.compareTo(new BigDecimal(0))<0|| peso.compareTo(record.getPeso())>0){ + this.peso=getRecord().getPeso(); + } + } + + /** + * Crea un registro de arma + * @param arm + */ + public void create(TarmArmas arm){ + try { + cantidad=arm.getCantidad(); + peso=arm.getPeso(); + //crea un movimiento para la tabla TarmMovimientoArmas + movimientoArma= new TarmMovimientoArmas(); + //crea a la persona compradora + compradorArma=new TcustPersonDetail(); + // tipomovimiento=false; + flujoventa=null; + consumomunicion=null; + //VALIDA SI ES ARMA: LETAL Y NO LETAL + TarmTipoArmaExplosivo tipoArmaExplosivo=TiposArmasExplosivosController.findarma(arm.getCtipoarmaexplosivo()); + if(tipoArmaExplosivo!=null && tipoArmaExplosivo.getClasecodigo().equals("CLASE") + && (tipoArmaExplosivo.getClase().equals("0010000008") || tipoArmaExplosivo.getClase().equals("0010000001"))){ + flujoventa="SI"; + } + if(tipoArmaExplosivo!=null && tipoArmaExplosivo.getClasecodigo().equals("CLASE") + && tipoArmaExplosivo.getClase().equals("0010000002")){ + consumomunicion="SI"; + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + + public TgeneCatalogDetail getCdetalle() { + return cdetalle; + } + + public void setCdetalle(TgeneCatalogDetail cdetalle) { + this.cdetalle = cdetalle; + } + + /** + * Abre el Lov de Persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Carga los datos que se devuelven en el Lov de personas + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + compradorArma= (TcustPersonDetail) event.getObject(); + } + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + try { + //actualiza el movimiento + this.movimientoArma.setCarma(record.getPk()); + this.movimientoArma.setTipomovimientocodigo("TIPOMOVIMIENTO"); + this.movimientoArma.setFecha(new java.sql.Timestamp(fecha.getTime()) ); + this.movimientoController.create(); + this.movimientoController.setRecord(movimientoArma); + this.movimientoController.getRecord().setIsnew(true); + this.movimientoController.update(); + //actualiza el arma + //this.record.setPk(null); + if(cantidad!=null){ + this.record.setValorAux(cantidad); + } + if(peso!=null){ + this.record.setPesoAux(peso); + } + super.update(); + + + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + + DtoSave dtosaveRegistro = this.registroArmController.getDtoSave(true); + dtosaveRegistro.setPosition(1); + msave.put(registroArmController.getBeanalias(), dtosaveRegistro); + + DtoSave dtosaveMovimiento = this.movimientoController.getDtoSave(true); + dtosaveMovimiento.setPosition(2); + msave.put(movimientoController.getBeanalias(), dtosaveMovimiento);//1 + + DtoSave dtosaveTotalPersona = this.ventaTotalPersonaController.getDtoSave(true); + dtosaveTotalPersona.setPosition(3); + msave.put(ventaTotalPersonaController.getBeanalias(), dtosaveTotalPersona); + + DtoSave dtosaveArma = this.getDtoSave(true); + dtosaveArma.setPosition(4); + msave.put(this.getBeanalias(), dtosaveArma);//2 + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.ventaTotalPersonaController.postCommit(resp); + this.movimientoController.postCommit(resp); + this.registroArmController.postCommit(resp); + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + querydatabase(); + } + + +// private boolean verificaDocHabilitante(Integer personcode) { +// boolean verifica = false; +// TsafeUserDetail userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); +// TgeneParameters habVenta = ParametersController.find("TRAHABVENTAS", userDetail.getCompanycode().toString()); +// List ldocs = DocumentoHabilitanteController.findPorPersoncode(personcode.toString()); +// if(ldocs != null && !ldocs.isEmpty()){ +// for (TarmDocumentoHabilitante doc : ldocs) { +// String[] tramites = habVenta.getTextvalue().split(","); +// int ind = Arrays.binarySearch(tramites, doc.getCtramite().toString()); +// if(ind >= 0 && Calendar.getInstance().getTime().compareTo(doc.getFechaexpiracion()) <= 0){ +// verifica = true; +// break; +// } +// } +// } +// return verifica; +// } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#postCommit(com.fp.dto.Response) + */ + @Override + public void postCommit(Response response) throws Exception { + super.postCommit(response); + } + + + public TcustPersonDetail getPersondetail() { + return persondetail; + } + + public void setPersondetail(TcustPersonDetail persondetail) { + this.persondetail = persondetail; + } + + public List getLcatalog() { + return lcatalog; + } + + public void setLcatalog(List lcatalog) { + this.lcatalog = lcatalog; + } + + public TcustPersonDetail getCompradorArma() { + return compradorArma; + } + + public void setCompradorArma(TcustPersonDetail compradorArma) { + this.compradorArma = compradorArma; + } + + public RegistroArmController getRegistroArmController() { + return registroArmController; + } + + public void setRegistroArmController(RegistroArmController registroArmController) { + this.registroArmController = registroArmController; + } + + public Integer getCantidad() { + return cantidad; + } + + public void setCantidad(Integer cantidad) { + this.cantidad = cantidad; + } + + public BigDecimal getPeso() { + return peso; + } + + public void setPeso(BigDecimal peso) { + this.peso = peso; + } + + public Date getFecha() { + return fecha; + } + + public void setFecha(Date fecha) { + this.fecha = fecha; + } + + public List getLmovimientos() { + return lmovimientos; + } + + public void setLmovimientos(List lmovimientos) { + this.lmovimientos = new ArrayList(); + for(TgeneCatalogDetail mov:lmovimientos){ + //No se incluye el tipo de registro TRASLADO (TRASL) + if(!mov.getPk().getCatalog().equalsIgnoreCase("TRASL")){ + this.lmovimientos.add(mov); + } + } + } + + public List getLperson() { + return lperson; + } + + public void setLperson(List lperson) { + this.lperson = lperson; + } + + public TarmMovimientoArmas getMovimientoArma() { + return movimientoArma; + } + + public void setMovimientoArma(TarmMovimientoArmas movimientoArma) { + this.movimientoArma = movimientoArma; + } + + public MovimientoController getMovimientoController() { + return movimientoController; + } + + public void setMovimientoController(MovimientoController movimientoController) { + this.movimientoController = movimientoController; + } + + public VentaTotalPersonaController getVentaTotalPersonaController() { + return ventaTotalPersonaController; + } + + public void setVentaTotalPersonaController( + VentaTotalPersonaController ventaTotalPersonaController) { + this.ventaTotalPersonaController = ventaTotalPersonaController; + } + + public String getLoteFilter() { + return loteFilter; + } + + public void setLoteFilter(String loteFilter) { + this.loteFilter = loteFilter; + } + + public List getCentroControlList() { + return centroControlList; + } + + public void setCentroControlList(List centroControlList) { + this.centroControlList = centroControlList; + } + + public String getCcentrocontrol() { + return ccentrocontrol; + } + + public void setCcentrocontrol(String ccentrocontrol) { + this.ccentrocontrol = ccentrocontrol; + } + + public String getFlujoventa() { + return flujoventa; + } + + public void setFlujoventa(String flujoventa) { + this.flujoventa = flujoventa; + } + + public String getConsumomunicion() { + return consumomunicion; + } + + public void setConsumomunicion(String consumomunicion) { + this.consumomunicion = consumomunicion; + } + + public TarmVentaArmaTemporalController getVentaArmaTemp() { + return ventaArmaTemp; + } + + public void setVentaArmaTemp(TarmVentaArmaTemporalController ventaArmaTemp) { + this.ventaArmaTemp = ventaArmaTemp; + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/VentaController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/VentaController.java.svn-base new file mode 100644 index 0000000..dc7c09f --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/VentaController.java.svn-base @@ -0,0 +1,823 @@ + package com.fp.frontend.controller.armas.funcionalidad; + +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.SelectEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmVentaArmaTemporalController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.armas.parametros.VentaTotalPersonaController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.fun.TarmMovimientoArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + + + +/** + * @author Andres Cevallos + * Clase Controladora la cual maneja la venta de armas + */ +@ManagedBean +@ViewScoped +public class VentaController extends AbstractController { + + public VentaController() throws Exception { + super(TarmArmas.class); + } + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{movimientoController}") + private MovimientoController movimientoController; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmController; + + @ManagedProperty(value = "#{ventaTotalPersonaController}") + private VentaTotalPersonaController ventaTotalPersonaController; + + @ManagedProperty(value = "#{tarmVentaArmaTemporalController}") + private TarmVentaArmaTemporalController ventaArmaTemp; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + + private String loteFilter; + + /** + * Lisat de personas + */ + private List lperson; + private TarmMovimientoArmas movimientoArma; + + /** + * Persona Cliente a la cual se le vende un arma + */ + private TcustPersonDetail compradorArma; + /** + * Cantidad de producto en venta + */ + private Integer cantidad; + /** + * Peso del producto en venta + */ + private BigDecimal peso; + /** + * Referencia de los Movimientos en el catalogo + */ + private List lmovimientos; + /** + * Lista referenciada al catalogo + */ + private List lcatalog; + /** + * Referencia del cliente en el catalogo + */ + private TgeneCatalogDetail cdetalle; + /** + * Detalle de la persona que vende el arma + */ + private TcustPersonDetail persondetail; + /** + * Fecha actual del sistema + */ + private Date fecha; + /** + * Lista de centros de control + */ + private List centroControlList; + + /** + * Codigo del centro de control + */ + private String ccentrocontrol; + + /** + * umero de solicitud + */ + private String numerosolicitud; + /** + * bandera para el flujo de venta + */ + private String flujoventa; + /** + * bandera para el consumo de municion + */ + private String consumomunicion; + + /** + * Variable que nos permite cargar el documento al Alfresco + */ + private UploadedFile uploadedFile; + + @PostConstruct + private void postconstruct() { + this.init(); + centroControlList=CentroControlArmasController.findEstadoInst("Y","1");//Departamento + querydatabase(); + } + + private void init() { + try { + peso=null; + cantidad=null; + this.lrecord = new ArrayList<>(); + this.beanalias = "VENTAARMAS"; + // tipomovimiento=false; + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + this.persondetail=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + lmovimientos = CatalogDetailController.find("TIPOREGISTRO","MOV");//catalogo de movimientos + cdetalle = CatalogDetailController.findxCodigoCodcatalogo(getPersondetail().getIdentificationcatalog(),getPersondetail().getIdentificationcatalogcode()); + fecha = new Date(); + lcatalog=CatalogDetailController.find("IDENTIFICATION"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + + SubQuery subqueryLonguitud= new SubQuery("TgeneCatalogDetail","description","longitud","i.pk.catalog=(select o.longitud from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.longitudcodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryLonguitud); + + SubQuery subqueryClase= new SubQuery("TgeneCatalogDetail","description","clase","i.pk.catalog=(select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClase); + + SubQuery subqueryTipoArma= new SubQuery("TgeneCatalogDetail","description","tipoarmaexplosivo","i.pk.catalog=(select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipoArma); + + SubQuery subqueryCalibre= new SubQuery("TgeneCatalogDetail","description","calibre","i.pk.catalog=(select o.calibre from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.calibrecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryCalibre); + + SubQuery subqueryUnidad= new SubQuery("TgeneCatalogDetail","description","unidadmedidapeso","i.pk.catalog=(select o.unidadmedidapeso from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryUnidad); + + dto.setOrderby("lote, ctipoarmaexplosivo,cregistro"); + + Filter filtro=new Filter(); + String filtrofecha= "t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) " + + " and t.estado in("+MsgControlArmas.getProperty("codigo_estado_arma_busqueda_venta")+") "//'REG','REN','APTA','DEV','ECO','COLE' + + " and cregistro in (select reg.pk from TarmRegistroArmas reg where reg.personcode ='"+persondetail.getPk().getPersoncode()+"' )" + + " and (t.peso>0 or t.cantidad>0)"; + + if(loteFilter!=null && !loteFilter.isEmpty()){ + filtrofecha+=" and UPPER(t.lote) like '"+loteFilter+"'"; + } + + filtro.setSql(filtrofecha); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); +// request.put("queryalias", "ARMASCOMPLETE"); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Cambia el valor del movimiento de Venta a Materia Prima + */ + public void changeType(){ + compradorArma=new TcustPersonDetail(); + } + /** + * Valida que la fecha de venta no seaa superior a la fecha del sistema + * @param fech + */ + public void validarfecha(Date fech){ + if(fech.getTime()>(new Date()).getTime()){ + fecha=new Date(); + } + } + + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en el Alfresco + */ + public void handleUpload(FileUploadEvent event){ + uploadedFile = event.getFile(); + } + + /** + * Recorta el nombre del archivo a cargarse + * @param nombre + * @return nombre recortado + */ + public String recorteNombre(String nombre){ + String fielname=nombre; + if(fielname.length()>30){ + fielname=fielname.substring(0,30)+extencionArchivo(nombre); + } + return fielname; + } + /** + * Obtiene la extencion del archivo a cargar + * @param nombre + * @return + */ + private String extencionArchivo(String nombre){ + int pos=nombre.lastIndexOf('.'); + nombre=nombre.substring(pos); + return nombre; + } + + /** + * Actualiza la informacion en el lrecord + */ + @Override + public void update(){ + try { + String pathRuta=""; + //ACTUALIZA ELRESTO DE DATOS DE LA TABLA DE MOVIMIENTO + this.movimientoArma.setPersoncodevendedor(persondetail.getPk().getPersoncode()); + this.movimientoArma.getModifiedData().put("personaVemdedor", persondetail); + if(movimientoArma.getTipomovimiento().equals("VENT")){ + if(compradorArma!=null && compradorArma.getPk()!=null){ + //if(verificaDocHabilitante(compradorArma.getPk().getPersoncode())){ + this.movimientoArma.setPersoncodecomprador(compradorArma.getPk().getPersoncode()); + this.movimientoArma.getModifiedData().put("personaComprador", compradorArma); + } + else{ + MessageHelper.setMessageWarn("DEBE INGRESAR UN CLIENTE"); + return; + } + //VALIDA SI ES ARMA: LETAL Y NO LETAL + TarmTipoArmaExplosivo tipoArmaExplosivo=TiposArmasExplosivosController.findarma(this.record.getCtipoarmaexplosivo()); + if(tipoArmaExplosivo!=null && tipoArmaExplosivo.getClasecodigo().equals("CLASE") + && ((this.flujoventa !=null && this.flujoventa.equals("SI") && movimientoArma.getTipomovimiento().equals("VENT")) || + (this.consumomunicion!=null && this.consumomunicion.equals("SI") && movimientoArma.getTipomovimiento().equals("CONS"))) + && (tipoArmaExplosivo.getClase().equals("0010000008") || tipoArmaExplosivo.getClase().equals("0010000001") + || tipoArmaExplosivo.getClase().equals("0010000002"))){//0010000002 MUNICION + + String xPathLocation= getRutaDocumentoSolBase() + "/cm:I-" +persondetail.getIdentification()+ "/cm:C-" + record.getCodigoarma() ; + if(uploadedFile!=null && uploadedFile.getFileName()!=null){ + String extencionArchivo=getExtension(uploadedFile.getFileName()); + String nombreArchivo = "PERMISO-"+this.record.getCodigoarma()+"."+extencionArchivo; + if(alfrescoController.uploadFile(uploadedFile.getInputstream(),nombreArchivo, xPathLocation)){ + pathRuta=xPathLocation + "/cm:" + nombreArchivo; + }else{ + MessageHelper.setMessageError("Adjunte el documento erroneo"); + return; + } + }else{ + MessageHelper.setMessageError("Adjunte el documento "); + return; + } + + if(ccentrocontrol!=null && !ccentrocontrol.trim().isEmpty()){ + saveVentaArma(pathRuta); + //retorna + return; + }else{ + MessageHelper.setMessageWarn("SELECCIONE EL CENTRO DE CONTROL"); + return; + } + } + }else{ + this.movimientoArma.getModifiedData().put("personaComprador", persondetail); + this.movimientoArma.setPersoncodecomprador(persondetail.getPk().getPersoncode());//es el mismo si el tipo movimientoArma.getTipomovimiento() es diferente de nenta + } + save(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta = new StringBuilder("cm:Solicitudes"); + ruta = ruta.append("/cm:VentaTem-"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + return ruta.toString(); + } + /** + * Metodo que retorna la extencion del documento que se desea subir al alfresco + */ + public String getExtension(String filename) { + int index = filename.lastIndexOf('.'); + if (index == -1) { + return ""; + } else { + return filename.substring(index + 1); + } + } + + public void saveVentaArma(String pathRuta) { + try { + System.out.println("-------------Ingresa Venta Armas Save: "+numerosolicitud); + + //actualiza el arma a un estado pendiente de venta + this.record.setEstadoventa("PENVEN"); + numerosolicitud=record.getPk(); + System.out.println("------------Ingresa Venta Armas Save2: "+numerosolicitud); + + super.update(); + + ventaArmaTemp.clearAll(); + ventaArmaTemp.create(); + ventaArmaTemp.getRecord().setCarma(record.getPk()); + //this.movimientoArma.setPersoncodecomprador(compradorArma.getPk().getPersoncode()); + ventaArmaTemp.getRecord().setPersoncodigo(compradorArma.getPk().getPersoncode()); + ventaArmaTemp.getRecord().setEstado("PENDIENTE"); + ventaArmaTemp.getRecord().setFcreacion(new java.sql.Date(new Date().getTime())); + ventaArmaTemp.getRecord().setFactura( movimientoArma.getFactura()); + ventaArmaTemp.getRecord().setNoregistra(movimientoArma.getNoregistro()); + ventaArmaTemp.getRecord().setJustificacion(movimientoArma.getJustificacion()); + ventaArmaTemp.getRecord().setPathdocumento(pathRuta); + ventaArmaTemp.getRecord().setCentrocontrol(ccentrocontrol); + ventaArmaTemp.update(); + + Request request = this.callerhelper.getRequest(); + super.cleanRequest(request); + + HashMap msave = new HashMap(); + + DtoSave dtosaveArma = this.getDtoSave(true); + dtosaveArma.setPosition(1); + msave.put(this.getBeanalias(), dtosaveArma);//2 + + DtoSave dtosaveRegistro = this.ventaArmaTemp.getDtoSave(true); + dtosaveRegistro.setPosition(2); + msave.put(ventaArmaTemp.getBeanalias(), dtosaveRegistro); + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.ventaArmaTemp.postCommit(resp); + this.record= new TarmArmas(); + MessageHelper.setMessageInfo(resp); + //inicio del flujo + iniciarFlujo(); + super.cleanRequest(request); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + querydatabase(); + } + + + /** + * Método para el inicio de flujo + */ + public void iniciarFlujo() { + try { + System.out.println("--------------Ingresa Venta Armas Inicio Flujo: "+numerosolicitud); + + String cprovincia=null; + for(TarmCentroControl centro: centroControlList){ + if(ccentrocontrol.equals(centro.getPk())){ + cprovincia=centro.getProvincecode(); + } + } + ; + if(cprovincia==null || cprovincia.length()==0){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinprovincia")); + return; + } + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + + request.modifiedData().put("csolicitud", numerosolicitud);//nuemro del arma carma pk + SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm", Locale.getDefault()); + request.modifiedData().put("numerosolicitud", numerosolicitud+"-"+this.persondetail.getPk().getPersoncode()+"-"+dateFormat.format(new Date()) ); + request.modifiedData().put("cprovincia", cprovincia); + request.modifiedData().put("isnew", "Y"); + request.setLogsolicitude(numerosolicitud); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.setShowRow(true); + cantidad=null; + peso=null; + //crea un movimiento para la tabla TarmMovimientoArmas + movimientoArma= null; + //crea a la persona compradora + compradorArma=null; + // tipomovimiento=false; + flujoventa=null; + consumomunicion=null; + //flujoiniciado = true; + //deshabilitarPantalla = Boolean.TRUE; + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + " SOLICITUD: " + numerosolicitud); + //saveInicioFlujoEnYES(); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Valida que la cantidad que se desea vender no sea superior a la cantidad maxima que se tiene + * @param cantidad + */ + public void validarCantidadMexima(Integer cantidad){ + this.peso=null; + if(cantidad==null || cantidad==0 || cantidad<0|| cantidad.compareTo(record.getCantidad())>0){ + this.cantidad=record.getCantidad(); + } + } + /** + * Valida que la cantidad que se desea vender no sea superior a la cantidad maxima que se tiene + * @param peso + */ + public void validarPesoMexima(BigDecimal peso){ + this.cantidad=null; + if(peso==null || peso.compareTo(new BigDecimal(0))==0|| peso.compareTo(new BigDecimal(0))<0|| peso.compareTo(record.getPeso())>0){ + this.peso=getRecord().getPeso(); + } + } + + /** + * Crea un registro de arma + * @param arm + */ + public void create(TarmArmas arm){ + try { + cantidad=arm.getCantidad(); + peso=arm.getPeso(); + //crea un movimiento para la tabla TarmMovimientoArmas + movimientoArma= new TarmMovimientoArmas(); + //crea a la persona compradora + compradorArma=new TcustPersonDetail(); + // tipomovimiento=false; + flujoventa=null; + consumomunicion=null; + //VALIDA SI ES ARMA: LETAL Y NO LETAL + TarmTipoArmaExplosivo tipoArmaExplosivo=TiposArmasExplosivosController.findarma(arm.getCtipoarmaexplosivo()); + if(tipoArmaExplosivo!=null && tipoArmaExplosivo.getClasecodigo().equals("CLASE") + && (tipoArmaExplosivo.getClase().equals("0010000008") || tipoArmaExplosivo.getClase().equals("0010000001"))){ + flujoventa="SI"; + } + if(tipoArmaExplosivo!=null && tipoArmaExplosivo.getClasecodigo().equals("CLASE") + && tipoArmaExplosivo.getClase().equals("0010000002")){ + consumomunicion="SI"; + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + + public TgeneCatalogDetail getCdetalle() { + return cdetalle; + } + + public void setCdetalle(TgeneCatalogDetail cdetalle) { + this.cdetalle = cdetalle; + } + + /** + * Abre el Lov de Persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Carga los datos que se devuelven en el Lov de personas + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + compradorArma= (TcustPersonDetail) event.getObject(); + } + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + try { + //actualiza el movimiento + this.movimientoArma.setCarma(record.getPk()); + this.movimientoArma.setTipomovimientocodigo("TIPOMOVIMIENTO"); + this.movimientoArma.setFecha(new java.sql.Timestamp(fecha.getTime()) ); + this.movimientoController.create(); + this.movimientoController.setRecord(movimientoArma); + this.movimientoController.getRecord().setIsnew(true); + this.movimientoController.update(); + //actualiza el arma + //this.record.setPk(null); + if(cantidad!=null){ + this.record.setValorAux(cantidad); + } + if(peso!=null){ + this.record.setPesoAux(peso); + } + super.update(); + + + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + + DtoSave dtosaveRegistro = this.registroArmController.getDtoSave(true); + dtosaveRegistro.setPosition(1); + msave.put(registroArmController.getBeanalias(), dtosaveRegistro); + + DtoSave dtosaveMovimiento = this.movimientoController.getDtoSave(true); + dtosaveMovimiento.setPosition(2); + msave.put(movimientoController.getBeanalias(), dtosaveMovimiento);//1 + + DtoSave dtosaveTotalPersona = this.ventaTotalPersonaController.getDtoSave(true); + dtosaveTotalPersona.setPosition(3); + msave.put(ventaTotalPersonaController.getBeanalias(), dtosaveTotalPersona); + + DtoSave dtosaveArma = this.getDtoSave(true); + dtosaveArma.setPosition(4); + msave.put(this.getBeanalias(), dtosaveArma);//2 + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.ventaTotalPersonaController.postCommit(resp); + this.movimientoController.postCommit(resp); + this.registroArmController.postCommit(resp); + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + querydatabase(); + } + + +// private boolean verificaDocHabilitante(Integer personcode) { +// boolean verifica = false; +// TsafeUserDetail userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); +// TgeneParameters habVenta = ParametersController.find("TRAHABVENTAS", userDetail.getCompanycode().toString()); +// List ldocs = DocumentoHabilitanteController.findPorPersoncode(personcode.toString()); +// if(ldocs != null && !ldocs.isEmpty()){ +// for (TarmDocumentoHabilitante doc : ldocs) { +// String[] tramites = habVenta.getTextvalue().split(","); +// int ind = Arrays.binarySearch(tramites, doc.getCtramite().toString()); +// if(ind >= 0 && Calendar.getInstance().getTime().compareTo(doc.getFechaexpiracion()) <= 0){ +// verifica = true; +// break; +// } +// } +// } +// return verifica; +// } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#postCommit(com.fp.dto.Response) + */ + @Override + public void postCommit(Response response) throws Exception { + super.postCommit(response); + } + + + public TcustPersonDetail getPersondetail() { + return persondetail; + } + + public void setPersondetail(TcustPersonDetail persondetail) { + this.persondetail = persondetail; + } + + public List getLcatalog() { + return lcatalog; + } + + public void setLcatalog(List lcatalog) { + this.lcatalog = lcatalog; + } + + public TcustPersonDetail getCompradorArma() { + return compradorArma; + } + + public void setCompradorArma(TcustPersonDetail compradorArma) { + this.compradorArma = compradorArma; + } + + public RegistroArmController getRegistroArmController() { + return registroArmController; + } + + public void setRegistroArmController(RegistroArmController registroArmController) { + this.registroArmController = registroArmController; + } + + public Integer getCantidad() { + return cantidad; + } + + public void setCantidad(Integer cantidad) { + this.cantidad = cantidad; + } + + public BigDecimal getPeso() { + return peso; + } + + public void setPeso(BigDecimal peso) { + this.peso = peso; + } + + public Date getFecha() { + return fecha; + } + + public void setFecha(Date fecha) { + this.fecha = fecha; + } + + public List getLmovimientos() { + return lmovimientos; + } + + public void setLmovimientos(List lmovimientos) { + this.lmovimientos = new ArrayList(); + for(TgeneCatalogDetail mov:lmovimientos){ + //No se incluye el tipo de registro TRASLADO (TRASL) + if(!mov.getPk().getCatalog().equalsIgnoreCase("TRASL")){ + this.lmovimientos.add(mov); + } + } + } + + public List getLperson() { + return lperson; + } + + public void setLperson(List lperson) { + this.lperson = lperson; + } + + public TarmMovimientoArmas getMovimientoArma() { + return movimientoArma; + } + + public void setMovimientoArma(TarmMovimientoArmas movimientoArma) { + this.movimientoArma = movimientoArma; + } + + public MovimientoController getMovimientoController() { + return movimientoController; + } + + public void setMovimientoController(MovimientoController movimientoController) { + this.movimientoController = movimientoController; + } + + public VentaTotalPersonaController getVentaTotalPersonaController() { + return ventaTotalPersonaController; + } + + public void setVentaTotalPersonaController( + VentaTotalPersonaController ventaTotalPersonaController) { + this.ventaTotalPersonaController = ventaTotalPersonaController; + } + + public String getLoteFilter() { + return loteFilter; + } + + public void setLoteFilter(String loteFilter) { + this.loteFilter = loteFilter; + } + + public List getCentroControlList() { + return centroControlList; + } + + public void setCentroControlList(List centroControlList) { + this.centroControlList = centroControlList; + } + + public String getCcentrocontrol() { + return ccentrocontrol; + } + + public void setCcentrocontrol(String ccentrocontrol) { + this.ccentrocontrol = ccentrocontrol; + } + + public String getFlujoventa() { + return flujoventa; + } + + public void setFlujoventa(String flujoventa) { + this.flujoventa = flujoventa; + } + + public String getConsumomunicion() { + return consumomunicion; + } + + public void setConsumomunicion(String consumomunicion) { + this.consumomunicion = consumomunicion; + } + + public TarmVentaArmaTemporalController getVentaArmaTemp() { + return ventaArmaTemp; + } + + public void setVentaArmaTemp(TarmVentaArmaTemporalController ventaArmaTemp) { + this.ventaArmaTemp = ventaArmaTemp; + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/VentaTraspasoDominioController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/VentaTraspasoDominioController.java.svn-base new file mode 100644 index 0000000..c376282 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/VentaTraspasoDominioController.java.svn-base @@ -0,0 +1,261 @@ + package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.armas.parametros.TarmVentaArmaTemporalController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmVentaArmaTem; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * @author CP + * Clase Controladora flujo venta de armas + */ +@ManagedBean +@ViewScoped +public class VentaTraspasoDominioController extends AbstractController { + + public VentaTraspasoDominioController() throws Exception { + super(TarmArmas.class); + } + + private static final long serialVersionUID = 1L; + + /** + * Constante usada para referirse a la opcion general aprobar + */ + private final String APROBAR = "APR"; + + /** + * Opciones de aceptar o rechazar + */ + private List accionList; + /** + * numero de solicitud + */ + private String numerosolicitud; + /** + * Numero del arma a vender + */ + private String csolicitud; + /** + * Accion tomada por el usuario, aprobar o rechazar + */ + private String accionTomada; + + /** + * Propiedad usada para el manejo del Alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + @PostConstruct + private void postconstruct() { + startQuery(); + this.getMfilters().clear(); + accionList=CatalogDetailController.find("ACCION"); + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + //codigo del arma carma pk + csolicitud=super.getMfilters().get("csolicitud"); + //codigo persona compra + numerosolicitud=super.getMfilters().get("numerosolicitud"); + this.getMfilters().clear(); + querydatabase(); + for (TarmArmas item : this.lrecord) { + TarmVentaArmaTem ventaArma=TarmVentaArmaTemporalController.findPendienteCarma(item.getPk()); + if(ventaArma!=null){ + item.getModifiedData().put("pathdocumento", ventaArma.getPathdocumento()); + } + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + + SubQuery subqueryLonguitud= new SubQuery("TgeneCatalogDetail","description","longitud","i.pk.catalog=(select o.longitud from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.longitudcodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryLonguitud); + + SubQuery subqueryClase= new SubQuery("TgeneCatalogDetail","description","clase","i.pk.catalog=(select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClase); + + SubQuery subqueryTipoArma= new SubQuery("TgeneCatalogDetail","description","tipoarmaexplosivo","i.pk.catalog=(select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipoArma); + + SubQuery subqueryCalibre= new SubQuery("TgeneCatalogDetail","description","calibre","i.pk.catalog=(select o.calibre from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.calibrecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryCalibre); + + SubQuery subqueryUnidad= new SubQuery("TgeneCatalogDetail","description","unidadmedidapeso","i.pk.catalog=(select o.unidadmedidapeso from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryUnidad); + + dto.setOrderby("lote, ctipoarmaexplosivo,cregistro"); + + Filter filtro=new Filter(); + String filtroCarma= "t.pk='"+csolicitud+"' and t.estadoventa='PENVEN'"; + + + filtro.setSql(filtroCarma); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); +// request.put("queryalias", "ARMASCOMPLETE"); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#postCommit(com.fp.dto.Response) + */ + @Override + public void postCommit(Response response) throws Exception { + super.postCommit(response); + } + + /** + * Método para finalizar la tarea del flujo + */ + public void completarTarea() { + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + //mail + Map datosmail = new HashMap(); + datosmail.put("sol", numerosolicitud); + TarmCentroControl centroControl= obtenerCentroControl(); + datosmail.put("centrocontrol",(centroControl==null || centroControl.getNombreinstitucion()==null || centroControl.getNombreinstitucioncodigo()==null)?"":CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + + // Completar tarea en el flujo + if(accionTomada.equalsIgnoreCase(APROBAR)){ + request.modifiedData().put("BPMStatus", "A"); + datosmail.put("observaciones", "Aprobada"); + }else{ + request.modifiedData().put("BPMStatus", "D"); + datosmail.put("observaciones", "Rechazada"); + } + request.modifiedData().put("datosmail", datosmail); + request.modifiedData().put("csolicitud", csolicitud);//nuemro del arma carma pk + request.modifiedData().put("numerosolicitud", numerosolicitud); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + this.clearAll(); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Exception e) { + e.printStackTrace(); + } catch (Throwable e) { + e.printStackTrace(); + } + } + + /** + * Método para obtener el centro de control + * @throws Exception + */ + private TarmCentroControl obtenerCentroControl() throws Exception { + try { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + TarmCentroControl centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return centroControl; + } catch (Exception e) { + e.getMessage(); + } + return null; + + } + + public List getAccionList() { + return accionList; + } + + public void setAccionList(List accionList) { + this.accionList = accionList; + } + + public String getAccionTomada() { + return accionTomada; + } + + public void setAccionTomada(String accionTomada) { + this.accionTomada = accionTomada; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/VentasVariasArmasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/VentasVariasArmasController.java.svn-base new file mode 100644 index 0000000..17eab23 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/VentasVariasArmasController.java.svn-base @@ -0,0 +1,627 @@ + package com.fp.frontend.controller.armas.funcionalidad; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.SelectEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmVentaArmaTemporalController; +import com.fp.frontend.controller.armas.parametros.VentaTotalPersonaController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.fun.TarmMovimientoArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + + + +/** + * Clase Controladora la cual maneja la venta de varias armas + */ +@ManagedBean +@ViewScoped +public class VentasVariasArmasController extends AbstractController { + + public VentasVariasArmasController() throws Exception { + super(TarmArmas.class); + } + + private static final long serialVersionUID = 1L; + + private ListlrecordSelccionadas; + + @ManagedProperty(value = "#{movimientoController}") + private MovimientoController movimientoController; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmController; + + @ManagedProperty(value = "#{ventaTotalPersonaController}") + private VentaTotalPersonaController ventaTotalPersonaController; + + @ManagedProperty(value = "#{tarmVentaArmaTemporalController}") + private TarmVentaArmaTemporalController ventaArmaTemp; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + + private String loteFilter; + + /** + * Lisat de personas + */ + private List lperson; + private TarmMovimientoArmas movimientoArma; + + /** + * Persona Cliente a la cual se le vende un arma + */ + private TcustPersonDetail compradorArma; + /** + * Referencia de los Movimientos en el catalogo + */ + private List lmovimientos; + /** + * Lista referenciada al catalogo + */ + private List lcatalog; + /** + * Referencia del cliente en el catalogo + */ + private TgeneCatalogDetail cdetalle; + /** + * Detalle de la persona que vende el arma + */ + private TcustPersonDetail persondetail; + /** + * Fecha actual del sistema + */ + private Date fecha; + /** + * Lista de centros de control + */ + private List centroControlList; + + /** + * Codigo del centro de control + */ + private String ccentrocontrol; + + /** + * bandera para el flujo de venta + */ + private String flujoventa; + + /** + * Variable que nos permite cargar el documento al Alfresco + */ + private UploadedFile uploadedFile; + + @PostConstruct + private void postconstruct() { + this.init(); + centroControlList=CentroControlArmasController.findEstadoInst("Y","1");//Departamento + querydatabase(); + } + + private void init() { + try { + this.lrecord = new ArrayList<>(); + this.beanalias = "VENTAVARIASARMAS"; + // tipomovimiento=false; + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + this.persondetail=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + lmovimientos = CatalogDetailController.find("TIPOREGISTRO","MOV");//catalogo de movimientos + cdetalle = CatalogDetailController.findxCodigoCodcatalogo(getPersondetail().getIdentificationcatalog(),getPersondetail().getIdentificationcatalogcode()); + fecha = new Date(); + lcatalog=CatalogDetailController.find("IDENTIFICATION"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + + SubQuery subqueryLonguitud= new SubQuery("TgeneCatalogDetail","description","longitud","i.pk.catalog=(select o.longitud from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.longitudcodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryLonguitud); + + SubQuery subqueryClase= new SubQuery("TgeneCatalogDetail","description","clase","i.pk.catalog=(select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClase); + + SubQuery subqueryTipoArma= new SubQuery("TgeneCatalogDetail","description","tipoarmaexplosivo","i.pk.catalog=(select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipoArma); + + SubQuery subqueryCalibre= new SubQuery("TgeneCatalogDetail","description","calibre","i.pk.catalog=(select o.calibre from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.calibrecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryCalibre); + + SubQuery subqueryUnidad= new SubQuery("TgeneCatalogDetail","description","unidadmedidapeso","i.pk.catalog=(select o.unidadmedidapeso from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryUnidad); + + dto.setOrderby("lote, ctipoarmaexplosivo,cregistro"); + + Filter filtro=new Filter(); + String filtrofecha= "t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) " + + " and t.estado in("+MsgControlArmas.getProperty("codigo_estado_arma_busqueda_venta")+") "//'REG','REN','APTA','DEV','ECO','COLE' + + " and cregistro in (select reg.pk from TarmRegistroArmas reg where reg.personcode ='"+persondetail.getPk().getPersoncode()+"' )" + + " and (t.peso>0 or t.cantidad>0)"; + + if(loteFilter!=null && !loteFilter.isEmpty()){ + filtrofecha+=" and UPPER(t.lote) like '"+loteFilter+"'"; + } + filtrofecha+=" and t.ctipoarmaexplosivo not in " + + "(select ta.pk from TarmTipoArmaExplosivo ta where ta.clasecodigo='CLASE' and (ta.clase='0010000008' or ta.clase='0010000001'))"; + + //VALIDA SI ES ARMA: LETAL Y NO LETAL +// TarmTipoArmaExplosivo tipoArmaExplosivo=TiposArmasExplosivosController.findarma(arm.getCtipoarmaexplosivo()); +// if(tipoArmaExplosivo!=null && tipoArmaExplosivo.getClasecodigo().equals("CLASE") +// && (tipoArmaExplosivo.getClase().equals("0010000008") || tipoArmaExplosivo.getClase().equals("0010000001"))){ +// flujoventa="SI"; +// } + + + filtro.setSql(filtrofecha); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); +// request.put("queryalias", "ARMASCOMPLETE"); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Cambia el valor del movimiento de Venta a Materia Prima + */ + public void changeType(){ + compradorArma=new TcustPersonDetail(); + } + /** + * Valida que la fecha de venta no seaa superior a la fecha del sistema + * @param fech + */ + public void validarfecha(Date fech){ + if(fech.getTime()>(new Date()).getTime()){ + fecha=new Date(); + } + } + + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en el Alfresco + */ + public void handleUpload(FileUploadEvent event){ + uploadedFile = event.getFile(); + } + + /** + * Recorta el nombre del archivo a cargarse + * @param nombre + * @return nombre recortado + */ + public String recorteNombre(String nombre){ + String fielname=nombre; + if(fielname.length()>30){ + fielname=fielname.substring(0,30)+extencionArchivo(nombre); + } + return fielname; + } + /** + * Obtiene la extencion del archivo a cargar + * @param nombre + * @return + */ + private String extencionArchivo(String nombre){ + int pos=nombre.lastIndexOf('.'); + nombre=nombre.substring(pos); + return nombre; + } + + /** + * Actualiza la informacion en el lrecord + */ + @Override + public void update(){ + try { + for (TarmArmas item : this.lrecordSelccionadas) { + if((item.getPesoAux()==null ||item.getPesoAux().equals(new BigDecimal(0)))&& + (item.getValorAux()==0)){ + MessageHelper.setMessageWarn("Ingrese el peso / cantidad"); + return; + } + super.create(); + record=item; + super.update(); + } + //ACTUALIZA ELRESTO DE DATOS DE LA TABLA DE MOVIMIENTO + this.movimientoArma.setPersoncodevendedor(persondetail.getPk().getPersoncode()); + this.movimientoArma.getModifiedData().put("personaVemdedor", persondetail); + if(movimientoArma.getTipomovimiento().equals("VENT")){ + if(compradorArma!=null && compradorArma.getPk()!=null){ + this.movimientoArma.setPersoncodecomprador(compradorArma.getPk().getPersoncode()); + this.movimientoArma.getModifiedData().put("personaComprador", compradorArma); + } + else{ + MessageHelper.setMessageWarn("DEBE INGRESAR UN CLIENTE"); + return; + } + }else{ + this.movimientoArma.getModifiedData().put("personaComprador", persondetail); + this.movimientoArma.setPersoncodecomprador(persondetail.getPk().getPersoncode());//es el mismo si el tipo movimientoArma.getTipomovimiento() es diferente de nenta + } + save(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + /** + * Valida que la cantidad que se desea vender no sea superior a la cantidad maxima que se tiene + * @param cantidad + */ + public void validarCantidadMaxima(Integer cantidad,TarmArmas arma){ + //this.peso=null; + if(cantidad==null || cantidad==0 || cantidad<0|| cantidad.compareTo(arma.getCantidad())>0){ + arma.setValorAux(0); + MessageHelper.setMessageWarn("Ingrese la cantidad"); + return; + } + } + + /** + * Valida que la cantidad que se desea vender no sea superior a la cantidad maxima que se tiene + * @param peso + */ + public void validarPesoMaxima(BigDecimal peso,TarmArmas arma){ + // this.cantidad=null; + if(peso==null || peso.compareTo(new BigDecimal(0))==0|| peso.compareTo(new BigDecimal(0))<0|| peso.compareTo(arma.getPeso())>0){ + arma.setPesoAux(null); + MessageHelper.setMessageWarn("Ingrese el peso"); + return; + } + } + + /** + * Crea un registro de arma + * @param arm + */ + public void create(){ + try { + lrecordSelccionadas=new ArrayList(); + int aux=0; + for (TarmArmas item: this.lrecord) { + if(item.getModifiedData().get("seleccionado")!=null && (Boolean)item.getModifiedData().get("seleccionado")){ + aux=1; + lrecordSelccionadas.add(item); + } + } + if(aux==0){ + MessageHelper.setMessageError("Seleccione un registro"); + return; + } + //crea un movimiento para la tabla TarmMovimientoArmas + movimientoArma= new TarmMovimientoArmas(); + //crea a la persona compradora + compradorArma=new TcustPersonDetail(); + // tipomovimiento=false; + flujoventa=null; +// //VALIDA SI ES ARMA: LETAL Y NO LETAL +// TarmTipoArmaExplosivo tipoArmaExplosivo=TiposArmasExplosivosController.findarma(arm.getCtipoarmaexplosivo()); +// if(tipoArmaExplosivo!=null && tipoArmaExplosivo.getClasecodigo().equals("CLASE") +// && (tipoArmaExplosivo.getClase().equals("0010000008") || tipoArmaExplosivo.getClase().equals("0010000001"))){ +// flujoventa="SI"; +// } + } catch (Exception e) { + e.printStackTrace(); + } + } + + + public TgeneCatalogDetail getCdetalle() { + return cdetalle; + } + + public void setCdetalle(TgeneCatalogDetail cdetalle) { + this.cdetalle = cdetalle; + } + + /** + * Abre el Lov de Persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Carga los datos que se devuelven en el Lov de personas + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + compradorArma= (TcustPersonDetail) event.getObject(); + } + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + try { + //actualiza el movimiento + //this.movimientoArma.setCarma(record.getPk()); + this.movimientoArma.setTipomovimientocodigo("TIPOMOVIMIENTO"); + this.movimientoArma.setFecha(new java.sql.Timestamp(fecha.getTime()) ); + + Request request = this.callerhelper.getRequest(); + request.put("tarmMovimientoArmas", movimientoArma); + HashMap msave = new HashMap(); + + DtoSave dtosaveRegistro = this.registroArmController.getDtoSave(true); + dtosaveRegistro.setPosition(1); + msave.put(registroArmController.getBeanalias(), dtosaveRegistro); + + DtoSave dtosaveMovimiento = this.movimientoController.getDtoSave(true); + dtosaveMovimiento.setPosition(2); + msave.put(movimientoController.getBeanalias(), dtosaveMovimiento);//1 + + DtoSave dtosaveTotalPersona = this.ventaTotalPersonaController.getDtoSave(true); + dtosaveTotalPersona.setPosition(3); + msave.put(ventaTotalPersonaController.getBeanalias(), dtosaveTotalPersona); + + DtoSave dtosaveArma = this.getDtoSave(true); + dtosaveArma.setPosition(4); + msave.put(this.getBeanalias(), dtosaveArma);//2 + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.ventaTotalPersonaController.postCommit(resp); + this.movimientoController.postCommit(resp); + this.registroArmController.postCommit(resp); + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + querydatabase(); + } + + +// private boolean verificaDocHabilitante(Integer personcode) { +// boolean verifica = false; +// TsafeUserDetail userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); +// TgeneParameters habVenta = ParametersController.find("TRAHABVENTAS", userDetail.getCompanycode().toString()); +// List ldocs = DocumentoHabilitanteController.findPorPersoncode(personcode.toString()); +// if(ldocs != null && !ldocs.isEmpty()){ +// for (TarmDocumentoHabilitante doc : ldocs) { +// String[] tramites = habVenta.getTextvalue().split(","); +// int ind = Arrays.binarySearch(tramites, doc.getCtramite().toString()); +// if(ind >= 0 && Calendar.getInstance().getTime().compareTo(doc.getFechaexpiracion()) <= 0){ +// verifica = true; +// break; +// } +// } +// } +// return verifica; +// } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#postCommit(com.fp.dto.Response) + */ + @Override + public void postCommit(Response response) throws Exception { + super.postCommit(response); + } + + + public TcustPersonDetail getPersondetail() { + return persondetail; + } + + public void setPersondetail(TcustPersonDetail persondetail) { + this.persondetail = persondetail; + } + + public List getLcatalog() { + return lcatalog; + } + + public void setLcatalog(List lcatalog) { + this.lcatalog = lcatalog; + } + + public TcustPersonDetail getCompradorArma() { + return compradorArma; + } + + public void setCompradorArma(TcustPersonDetail compradorArma) { + this.compradorArma = compradorArma; + } + + public RegistroArmController getRegistroArmController() { + return registroArmController; + } + + public void setRegistroArmController(RegistroArmController registroArmController) { + this.registroArmController = registroArmController; + } + + public Date getFecha() { + return fecha; + } + + public void setFecha(Date fecha) { + this.fecha = fecha; + } + + public List getLmovimientos() { + return lmovimientos; + } + + public void setLmovimientos(List lmovimientos) { + this.lmovimientos = new ArrayList(); + for(TgeneCatalogDetail mov:lmovimientos){ + //No se incluye el tipo de registro TRASLADO (TRASL) + if(!mov.getPk().getCatalog().equalsIgnoreCase("TRASL")){ + this.lmovimientos.add(mov); + } + } + } + + public List getLperson() { + return lperson; + } + + public void setLperson(List lperson) { + this.lperson = lperson; + } + + public TarmMovimientoArmas getMovimientoArma() { + return movimientoArma; + } + + public void setMovimientoArma(TarmMovimientoArmas movimientoArma) { + this.movimientoArma = movimientoArma; + } + + public MovimientoController getMovimientoController() { + return movimientoController; + } + + public void setMovimientoController(MovimientoController movimientoController) { + this.movimientoController = movimientoController; + } + + public VentaTotalPersonaController getVentaTotalPersonaController() { + return ventaTotalPersonaController; + } + + public void setVentaTotalPersonaController( + VentaTotalPersonaController ventaTotalPersonaController) { + this.ventaTotalPersonaController = ventaTotalPersonaController; + } + + public String getLoteFilter() { + return loteFilter; + } + + public void setLoteFilter(String loteFilter) { + this.loteFilter = loteFilter; + } + + public List getCentroControlList() { + return centroControlList; + } + + public void setCentroControlList(List centroControlList) { + this.centroControlList = centroControlList; + } + + public String getCcentrocontrol() { + return ccentrocontrol; + } + + public void setCcentrocontrol(String ccentrocontrol) { + this.ccentrocontrol = ccentrocontrol; + } + + public String getFlujoventa() { + return flujoventa; + } + + public void setFlujoventa(String flujoventa) { + this.flujoventa = flujoventa; + } + + public TarmVentaArmaTemporalController getVentaArmaTemp() { + return ventaArmaTemp; + } + + public void setVentaArmaTemp(TarmVentaArmaTemporalController ventaArmaTemp) { + this.ventaArmaTemp = ventaArmaTemp; + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public List getLrecordSelccionadas() { + return lrecordSelccionadas; + } + + public void setLrecordSelccionadas(List lrecordSelccionadas) { + this.lrecordSelccionadas = lrecordSelccionadas; + } + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/VisualizacionSitiosAlmacenamientoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/VisualizacionSitiosAlmacenamientoController.java.svn-base new file mode 100644 index 0000000..4d8389f --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/.svn/text-base/VisualizacionSitiosAlmacenamientoController.java.svn-base @@ -0,0 +1,284 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; +import org.primefaces.event.map.MarkerDragEvent; +import org.primefaces.event.map.OverlaySelectEvent; +import org.primefaces.model.map.DefaultMapModel; +import org.primefaces.model.map.LatLng; +import org.primefaces.model.map.MapModel; +import org.primefaces.model.map.Marker; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmSitioAlmacenamiento; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Clase controladora del bean TarmSitioAlmacenamiento. + * + * @author abenalcazar + * + */ +@SuppressWarnings("serial") +@ManagedBean(name = "visualizacionSitiosAlmacenamientoController") +@ViewScoped +public class VisualizacionSitiosAlmacenamientoController extends + AbstractController { + + public VisualizacionSitiosAlmacenamientoController() throws Exception { + super(TarmSitioAlmacenamiento.class); + } + + + + /** + * Model para GMAP + */ + private MapModel simpleModel; + /** + * Marcador de Gmap + */ + private Marker marker; + /** + * Atributo que oculta boton Generar Mapa + */ + private boolean ocultarBtnGmap; + + /** + * Incializa el controlador, cuando se esta utilizando una página que + * utiliza el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "SITIOALMACENAMIENTO"; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Post Construct + * + * @throws Exception + */ + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + + ocultarBtnGmap = true; + } + + /** + * Método para consultar registros de la base de datos + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + this.addFilter("estado", "ACT"); + DtoQuery dto = super.getDtoQuery(true); + + SubQuery sprovincia = new SubQuery("TgeneProvince", "description", + "desprovincia", + "i.pk.countrycode = t.countrycode and i.pk.provincecode= t.provincecode"); + SubQuery scanton = new SubQuery( + "TgeneCanton", + "description", + "descanton", + "i.pk.countrycode = t.countrycode and i.pk.provincecode=t.provincecode and i.pk.cantoncode=t.cantoncode"); + SubQuery sparroquia = new SubQuery( + "TgeneParroquia", + "description", + "desparroquia", + "i.pk.countrycode = t.countrycode and i.pk.provincecode=t.provincecode and i.pk.cantoncode=t.cantoncode and i.pk.parroquiacode=t.parroquiacode"); + + //nombre + SubQuery snombre= new SubQuery + ("TcustPersonDetail", "name", "nombre", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + + + dto.addSubQuery(sprovincia); + dto.addSubQuery(scanton); + dto.addSubQuery(sparroquia); + + dto.addSubQuery(snombre); + + dto.setOrderby("t.countrycode"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp + .get(this.beanalias); + super.postQuery(this.lrecord); + listaVacia(); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void listaVacia() { + if (lrecord.size() != 0) { + ocultarBtnGmap = false; + } else { + ocultarBtnGmap = true; + } + + } + + /** + * Método para abrir el lov de Provincia. + */ + public void openProvinciaLov() { + Map> params = new HashMap<>(); + ProvinceLovController.openLov(params); + } + + public void onReturnProvinceLov(SelectEvent event) throws Exception { + TgeneProvince t = (TgeneProvince) event.getObject(); + super.addFilter("pk.provincecode", t.getPk().getProvincecode()); + super.addField("description", t.getDescription()); + this.query(); + } + + /** + * Método para generar Mapa y mostrar los marcadores de latitud y + * longitud dentro del mapa + */ + public void generarMapa() { + + if (lrecord != null) { + LatLng coord = null; + simpleModel = new DefaultMapModel(); + for (TarmSitioAlmacenamiento c : lrecord) { + try { + coord = new LatLng(c.getLatitud().doubleValue(), c + .getLongitud().doubleValue()); + } catch (Exception e) { + // TODO: handle exception + } + simpleModel.addOverlay(new Marker(coord, "quito")); + } + } + } + + public void limpiar() + { + lrecord = new ArrayList<>(); + simpleModel = new DefaultMapModel(); + this.getMfilters().remove("pk.provincecode"); + this.getMfilelds().remove("description"); + } + + /** + * Lanza el evento simpleModel + * + * @param event + */ + public void onMarkerDrag(MarkerDragEvent event) { + // since marker's state is already kept in draggableModel you do not + // necessarily + } + + /** + * Selecciona un marcador dentro de gmap + * + * @param event + */ + public void onMarkerSelect(OverlaySelectEvent event) { + marker = (Marker) event.getOverlay(); + + addMessage(new FacesMessage(FacesMessage.SEVERITY_INFO, + "Marker Selected", marker.getTitle())); + } + + public void addMessage(FacesMessage message) { + FacesContext.getCurrentInstance().addMessage(null, message); + } + + /** + * Incrementa el numero del documento + * @param arma + * @return + */ + public int incrementarRowkey(TarmSitioAlmacenamiento sitio){ + int n=0; + + for (int i = 0; i < this.lrecord.size(); i++) { + if(sitio.getPk()==this.lrecord.get(i).getPk()){ + n=i+1; + break; + } + } + + return n; + } + + // ** + // **ACCESORES Y MUTADORES + // ** + public final MapModel getSimpleModel() { + return simpleModel; + } + + public final void setSimpleModel(MapModel simpleModel) { + this.simpleModel = simpleModel; + } + + public final Marker getMarker() { + return marker; + } + + public final void setMarker(Marker marker) { + this.marker = marker; + } + + /** + * Entrega V/F + * + * @return ocultarBtnGmap + */ + public boolean isOcultarBtnGmap() { + return ocultarBtnGmap; + } + + /** + * Fija V/F + * + * @param ocultarBtnGmap + */ + public void setOcultarBtnGmap(boolean ocultarBtnGmap) { + this.ocultarBtnGmap = ocultarBtnGmap; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ArmaExcell.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ArmaExcell.java new file mode 100644 index 0000000..68f03dd --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ArmaExcell.java @@ -0,0 +1,316 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.parmas.param.TarmComercianteCupo; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +//import com.fp.persistence.parmas.soli.TarmArmasProduccion; +import com.fp.persistence.parmas.soli.TarmCustodiaTemporal; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +public class ArmaExcell { + + private String textoNumero; + private int numero; + + private String serie; + private String clase; + private String longitud; + private String tipo; + private String calibre; + private String color; + private String marca; + + private String textoCantidad; + private double cantidad; + + private String unidadMedidaCantidad; + + private String textoPeso; + private double peso; + + private String unidadMedidaPeso; + + private Boolean camposIncompletos = false; + private Boolean duplicada = false; + private Boolean existeCatalogo = false; + private Boolean existeTARMTIPOARMAEXPLOSIVO = false; + private Boolean cupoInsuficiente = false; + private Boolean existeBaseDatos = false; + + private TgeneCatalogDetail catalogoColor; + private TgeneCatalogDetail catalogoMarca; + private TgeneCatalogDetail catalogoClase; + private TgeneCatalogDetail catalogoLongitud; + private TgeneCatalogDetail catalogoTipoArma; + private TgeneCatalogDetail catalogoCalibre; + + private TarmComercianteCupo cupo; + private TarmTotalPersona totalPersona; + private TarmTipoArmaExplosivo tipoArmaExplosivo; + private TarmArmas arma; + //private TarmArmasProduccion arma; + + public ArmaExcell() { + super(); + // TODO Auto-generated constructor stub + } + + public int getNumero() { + return numero; + } + + public void setNumero(int numero) { + this.numero = numero; + } + + public String getSerie() { + return serie; + } + + public void setSerie(String serie) { + this.serie = serie; + } + + public String getClase() { + return clase; + } + + public void setClase(String clase) { + this.clase = clase; + } + + public String getLongitud() { + return longitud; + } + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + public String getTipo() { + return tipo; + } + + public void setTipo(String tipo) { + this.tipo = tipo; + } + + public String getCalibre() { + return calibre; + } + + public void setCalibre(String calibre) { + this.calibre = calibre; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getMarca() { + return marca; + } + + public void setMarca(String marca) { + this.marca = marca; + } + + public double getCantidad() { + return cantidad; + } + + public void setCantidad(double cantidad) { + this.cantidad = cantidad; + } + + public double getPeso() { + return peso; + } + + public void setPeso(double peso) { + this.peso = peso; + } + + public Boolean getCamposIncompletos() { + return camposIncompletos; + } + + public void setCamposIncompletos(Boolean camposIncompletos) { + this.camposIncompletos = camposIncompletos; + } + + public String getTextoNumero() { + return textoNumero; + } + + public void setTextoNumero(String textoNumero) { + this.textoNumero = textoNumero; + } + + public String getTextoCantidad() { + return textoCantidad; + } + + public void setTextoCantidad(String textoCantidad) { + this.textoCantidad = textoCantidad; + } + + public String getTextoPeso() { + return textoPeso; + } + + public void setTextoPeso(String textoPeso) { + this.textoPeso = textoPeso; + } + + public String getUnidadMedidaCantidad() { + return unidadMedidaCantidad; + } + + public void setUnidadMedidaCantidad(String unidadMedidaCantidad) { + this.unidadMedidaCantidad = unidadMedidaCantidad; + } + + public String getUnidadMedidaPeso() { + return unidadMedidaPeso; + } + + public void setUnidadMedidaPeso(String unidadMedidaPeso) { + this.unidadMedidaPeso = unidadMedidaPeso; + } + + public Boolean getDuplicada() { + return duplicada; + } + + public void setDuplicada(Boolean duplicada) { + this.duplicada = duplicada; + } + + public Boolean getExisteCatalogo() { + return existeCatalogo; + } + + public void setExisteCatalogo(Boolean existeCatalogo) { + this.existeCatalogo = existeCatalogo; + } + + public Boolean getExisteTARMTIPOARMAEXPLOSIVO() { + return existeTARMTIPOARMAEXPLOSIVO; + } + + public void setExisteTARMTIPOARMAEXPLOSIVO(Boolean existeTARMTIPOARMAEXPLOSIVO) { + this.existeTARMTIPOARMAEXPLOSIVO = existeTARMTIPOARMAEXPLOSIVO; + } + + public Boolean getCupoInsuficiente() { + return cupoInsuficiente; + } + + public void setCupoInsuficiente(Boolean cupoInsuficiente) { + this.cupoInsuficiente = cupoInsuficiente; + } + + public TgeneCatalogDetail getCatalogoColor() { + return catalogoColor; + } + + public void setCatalogoColor(TgeneCatalogDetail catalogoColor) { + this.catalogoColor = catalogoColor; + } + + public TgeneCatalogDetail getCatalogoMarca() { + return catalogoMarca; + } + + public void setCatalogoMarca(TgeneCatalogDetail catalogoMarca) { + this.catalogoMarca = catalogoMarca; + } + + public TgeneCatalogDetail getCatalogoClase() { + return catalogoClase; + } + + public void setCatalogoClase(TgeneCatalogDetail catalogoClase) { + this.catalogoClase = catalogoClase; + } + + public TgeneCatalogDetail getCatalogoLongitud() { + return catalogoLongitud; + } + + public void setCatalogoLongitud(TgeneCatalogDetail catalogoLongitud) { + this.catalogoLongitud = catalogoLongitud; + } + + public TgeneCatalogDetail getCatalogoTipoArma() { + return catalogoTipoArma; + } + + public void setCatalogoTipoArma(TgeneCatalogDetail catalogoTipoArma) { + this.catalogoTipoArma = catalogoTipoArma; + } + + public TgeneCatalogDetail getCatalogoCalibre() { + return catalogoCalibre; + } + + public void setCatalogoCalibre(TgeneCatalogDetail catalogoCalibre) { + this.catalogoCalibre = catalogoCalibre; + } + + public TarmComercianteCupo getCupo() { + return cupo; + } + + public void setCupo(TarmComercianteCupo cupo) { + this.cupo = cupo; + } + + public Boolean getExisteBaseDatos() { + return existeBaseDatos; + } + + public void setExisteBaseDatos(Boolean existeBaseDatos) { + this.existeBaseDatos = existeBaseDatos; + } + + public TarmTotalPersona getTotalPersona() { + return totalPersona; + } + + public void setTotalPersona(TarmTotalPersona totalPersona) { + this.totalPersona = totalPersona; + } + + public TarmTipoArmaExplosivo getTipoArmaExplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoArmaExplosivo(TarmTipoArmaExplosivo tipoArmaExplosivo) { + this.tipoArmaExplosivo = tipoArmaExplosivo; + } + + public TarmArmas getArma() { + return arma; + } + + public void setArma(TarmArmas arma) { + this.arma = arma; + } + + /* + public TarmArmasProduccion getArma() { + return arma; + } + + public void setArma(TarmArmasProduccion arma) { + this.arma = arma; + } + */ +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ArmaVentaController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ArmaVentaController.java new file mode 100644 index 0000000..c2914c8 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ArmaVentaController.java @@ -0,0 +1,183 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * @author Andres Cevallos Clase Controladora para la entidad TarmArma Incluye + * metodo de consulta para la busqueda de persona y registro + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ArmaVentaController extends AbstractController { + + //Variabgles globales + /** + * String el cual tendr un nombre de filtro + */ + private String csolicitud; + + public ArmaVentaController() throws Exception { + super(TarmArmas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.record = new TarmArmas(); + this.beanalias = "ARMAS"; + this.filtro(); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + //this.addFilter("estado", "REG"); + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", "i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase = new SubQuery("TarmTipoArmaExplosivo", "clase", "cclase", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo = new SubQuery("TarmTipoArmaExplosivo", "clasecodigo", "cclasecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud = new SubQuery("TarmTipoArmaExplosivo", "longitud", "clongitud", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo = new SubQuery("TarmTipoArmaExplosivo", "longitudcodigo", "clongitudcodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre = new SubQuery("TarmTipoArmaExplosivo", "calibre", "ccalibre", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo = new SubQuery("TarmTipoArmaExplosivo", "calibrecodigo", "ccalibrecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivo", "ctipoarmaexplosivo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivocodigo", "ctipoarmaexplosivocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapeso", "cunidadmedidapeso", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapesocodigo", "cunidadmedidapesocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + + //Filter filtrofecha=new Filter(); + //filtrofecha.setSql( + String filtrofecha = "t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) " + + " and t.estado in(" + MsgControlArmas.getProperty("codigo_estado_arma_busqueda_venta") + ") and (t.peso>0 or t.cantidad>0)"; + //dto.addFiltro(filtrofecha); + + String sql = csolicitud; + if (csolicitud != null) { + Filter filtro = new Filter(); + filtro.setSql(filtrofecha + " and " + sql); + dto.addFiltro(filtro); + } else { + return; + } + + dto.setOrderby("pk"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para armar el registro + * + * @param lsolicitud + * @throws Exception + */ + public void filtro() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + RegistroArmController registroArmas = new RegistroArmController(); + registroArmas.init(); + registroArmas.setRecperpage(3000000); + registroArmas.addFilter("personcode", tsafeUserDetail.getPk().getPersoncode().toString()); + registroArmas.query(); + + for (TarmRegistroArmas soli : registroArmas.getLrecord()) { + if (csolicitud == null) { + csolicitud = "(cregistro=" + soli.getPk(); + } else { + csolicitud += " or cregistro=" + soli.getPk(); + } + } + csolicitud += ")"; + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/CargaController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/CargaController.java new file mode 100644 index 0000000..81669a2 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/CargaController.java @@ -0,0 +1,172 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.InventarioSubidoController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.fun.TarmInventarioSubidoPorPersona; +import com.fp.persistence.parmas.soli.TarmArmas; + +/** + * Clase controladora del bean TarmCarga. + * + * @author Christian Pazmino + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CargaController extends AbstractController { + + /** + * Constructor + * + * @throws Exception + */ + public CargaController() throws Exception { + super(TarmCarga.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CARGA"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void update(TarmCarga bean) throws Exception { + this.setRecord(bean); + super.update(); + } + + /** + * Obtiene una carga por codigo AUCP + * + * @param codigopersona + * @return + */ + public static TarmCarga findByAUCP(String aucp) { + try { + CargaController cc = new CargaController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("aucp", aucp); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Entrega una lista de objetos TarmCarga + * + * @param personcode categoria + * @return lrecord Lista de objetos TarmCarga + */ + public static List findXPersonaYCategoria(String personcode, String categoria, String tipoCarga) { + try { + CargaController cc = new CargaController(); + cc.init(); + cc.recperpage = 1000; + cc.addFilter("personcode", personcode); + cc.addFilter("categoria", categoria); + cc.addFilter("tipocarga", tipoCarga); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/CargaDetalleController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/CargaDetalleController.java new file mode 100644 index 0000000..325c5fd --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/CargaDetalleController.java @@ -0,0 +1,121 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmCargaDetalle; + +/** + * Clase controladora del bean TarmCargaDetalle. + * + * @author Christian Pazmino + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CargaDetalleController extends AbstractController { + + /** + * Constructor + * + * @throws Exception + */ + public CargaDetalleController() throws Exception { + super(TarmCargaDetalle.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CARGADETALLE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void update(TarmCargaDetalle bean) throws Exception { + this.setRecord(bean); + super.update(); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ConsultaArmasVentaController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ConsultaArmasVentaController.java new file mode 100644 index 0000000..e60a460 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ConsultaArmasVentaController.java @@ -0,0 +1,123 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ConsultaArmasVentaController extends AbstractController { + + public ConsultaArmasVentaController() throws Exception { + super(TarmArmas.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + private void init() { + try { + this.recperpage = 15; + this.lrecord = new ArrayList<>(); + this.record = new TarmArmas(); + this.beanalias = "CONSULTAARMASVENTA"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", "i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase = new SubQuery("TarmTipoArmaExplosivo", "clase", "cclase", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo = new SubQuery("TarmTipoArmaExplosivo", "clasecodigo", "cclasecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud = new SubQuery("TarmTipoArmaExplosivo", "longitud", "clongitud", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo = new SubQuery("TarmTipoArmaExplosivo", "longitudcodigo", "clongitudcodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre = new SubQuery("TarmTipoArmaExplosivo", "calibre", "ccalibre", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo = new SubQuery("TarmTipoArmaExplosivo", "calibrecodigo", "ccalibrecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivo", "ctipoarmaexplosivo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivocodigo", "ctipoarmaexplosivocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapeso", "cunidadmedidapeso", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapesocodigo", "cunidadmedidapesocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + + Filter filtro = new Filter(); + String filtrofecha = "t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) " + + " and t.estado in(" + MsgControlArmas.getProperty("codigo_estado_arma_busqueda_venta") + ")"; + filtro.setSql(filtrofecha); + dto.addFiltro(filtro); + dto.setOrderby("pk"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); +// request.put("queryalias", "ARMASCOMPLETE"); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/DesaduanizacionController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/DesaduanizacionController.java new file mode 100644 index 0000000..2358ff0 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/DesaduanizacionController.java @@ -0,0 +1,503 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.solicitud.DocumentoHabilitanteController; +import com.fp.frontend.controller.armas.solicitud.SolicitudController; +import com.fp.frontend.controller.armas.solicitud.SolicitudTramiteController; +import com.fp.frontend.controller.armas.solicitud.TarmSolicitudTramiteController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class DesaduanizacionController extends AbstractController { + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{solicitudTramiteController}") + private SolicitudTramiteController tarmSolicitudTramiteController; + + private Date fechaDesaduanizacion; + private List tramites; + //private TarmTramite tramiteSeleccionado; + private String noSolicitud; + //private List larmas=new ArrayList(); + private Boolean salvarDeshabilitado = false; + + private TsafeUserDetail tsafeUserDetailUsuario = null; + + /** + * Listado de colores + */ + private List lcolor; + + /*@ManagedProperty(value = "#{tarmSolicitudArmasController}") + private TarmSolicitudArmasController tarmSolicitudArmasController;*/ + public DesaduanizacionController() throws Exception { + super(TarmArmas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta +// super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + noSolicitud = null; +// this.record=new TarmArmas(); + this.beanalias = "DESADUANIZACION"; + lcolor = CatalogDetailController.find("COLOR"); + this.create(); + + //Fecha de desaduanizacion + this.fechaDesaduanizacion = Calendar.getInstance().getTime(); + + //Cargando los tramites + caragarTramiteSolicitud(); + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + this.salvarDeshabilitado = true; + + tarmSolicitudTramiteController.create(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void caragarTramiteSolicitud() { + this.tramites = TarmSolicitudTramiteController.findTramites(); + } + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", "i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase = new SubQuery("TarmTipoArmaExplosivo", "clase", "cclase", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo = new SubQuery("TarmTipoArmaExplosivo", "clasecodigo", "cclasecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud = new SubQuery("TarmTipoArmaExplosivo", "longitud", "clongitud", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo = new SubQuery("TarmTipoArmaExplosivo", "longitudcodigo", "clongitudcodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre = new SubQuery("TarmTipoArmaExplosivo", "calibre", "ccalibre", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo = new SubQuery("TarmTipoArmaExplosivo", "calibrecodigo", "ccalibrecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivo", "ctipoarmaexplosivo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivocodigo", "ctipoarmaexplosivocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapeso", "cunidadmedidapeso", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapesocodigo", "cunidadmedidapesocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida = new SubQuery("TgeneCatalogDetail", "description", "unidadmedida", "i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode = new SubQuery("TarmRegistroArmas", "personcode", "personcode", "i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + SubQuery subqueryTipo = new SubQuery("TgeneCatalogDetail", "description", "tipo", "i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipo); + + SubQuery subqueryCalibreD = new SubQuery("TgeneCatalogDetail", "description", "calibreD", "i.pk.catalog= (select o.calibre from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.calibrecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryCalibreD); + + SubQuery subqueryTipoArmaExplosivo = new SubQuery("TgeneCatalogDetail", "description", "tipoarmaexplosivo", "i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + + dto.addSubQuery(subqueryTipoArmaExplosivo); + SubQuery subqueryClasecatalogo = new SubQuery("TgeneCatalogDetail", "description", "clase", "i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClasecatalogo); + return dto; + } + + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + Filter filtro = new Filter(); + if (this.getMfilelds().get("cregistro") != null) { + filtro.setSql(this.getMfilelds().get("cregistro").toString() + " and t.estado = 'IMPO' and t.lote is null " + + " and t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro)" + + " and t.pk in (select tar.codigoarma from TarmArmas tar where tar.pk in( select ar.pk.carma from TarmSolicitudArmas ar where ar.pk.csolicitud= '" + this.noSolicitud + "'))" + + " and (t.peso>0 or t.cantidad>0)"); + dto.addFiltro(filtro); + } + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); +// for(int i = 0; i(); +// MessageHelper.setMessageError(resp); +// } else { +// lrecord = (List) resp.get(beanalias); +// if(!lrecord.isEmpty()){ +// record=lrecord.get(0); +// } +// super.postQuery(lrecord); +// Collections.sort(lrecord,new Comparator(){ +// public int compare(TarmArmas f1, TarmArmas f2) +// { +// return f1.getModifiedData().get("tipo").toString().compareTo(f1.getModifiedData().get("tipo").toString()); +// } +// }); +// } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public boolean validarSerieDuplicadas() { + Set lista = new HashSet(); + for (TarmArmas ar : this.lrecord) { + lista.add(ar.getLote()); + } + if (this.lrecord.size() > lista.size()) { + return true; + } + return false; + + } + + @Override + public void save() { + try { + for (TarmArmas armas : this.lrecord) { + this.record = armas; + this.record.setEstado("REG"); + this.record.setColorcodigo("COLOR"); + Calendar calendario = Calendar.getInstance(); + calendario.setTime(this.fechaDesaduanizacion); + this.record.setFdesaduanizacion(new java.sql.Date(calendario.getTimeInMillis())); + if (this.record.getLote() != null) { + if (this.validarSerieDuplicadas()) { + MessageHelper.setMessageError("LOS ARTCULOS NO PUEDEN TENER SERIES IGUALES"); + return; + } + update(); + } else { + StringBuilder err = new StringBuilder("EL CAMPO SERIE NO PUEDE ESTAR VACO"); + //err.append(this.record.getPk()); + MessageHelper.setMessageError(err.toString()); + return; + } + + } + HashMap msave = new HashMap(); + Request request = callerhelper.getRequest(); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + for (TarmSolicitudTramite tramite : tramites) { + if (this.noSolicitud.equals(tramite.getPk().getCsolicitud())) { + tarmSolicitudTramiteController.setRecord(tramite); + break; + } + } + +// tarmSolicitudTramiteController.getRecord().setEstadotramite("FIN"); +// tarmSolicitudTramiteController.update(); +// DtoSave dtosaveTramite = tarmSolicitudTramiteController.getDtoSave(); +// msave.put(tarmSolicitudTramiteController.getBeanalias(), dtosaveTramite); // adicionar metadata de mantenimiento para cada tabla. + request.getModifiedData().put("noSolicitud", noSolicitud); + request.setSaveTables(msave); + request.getModifiedData().put("REQUIEREDESGLOCE", Boolean.FALSE); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); +// tarmSolicitudTramiteController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + this.salvarDeshabilitado = true; + caragarTramiteSolicitud(); + this.query(); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void desaduanizarArmas() { + try { + System.out.println("*** INICIA PROCESO DESADUANIZACION ARMAS: " + noSolicitud); + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + TarmSolicitud solicitudObj = SolicitudController.findSolicitudxcodsolicitud(noSolicitud); + if (solicitudObj != null) { + request.getModifiedData().put("SOLICITUD", solicitudObj); + request.getModifiedData().put("REQUIEREDESGLOCE", Boolean.TRUE); + } else { + MessageHelper.setMessageError("NO EXISTE UN CODIGO DE AUCP ASOCIADO A LA SOLICITUD"); + return; + } + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + querydatabase(); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + +// try { +// System.out.println("*** INICIA PROCESO DESADUANIZACION ARMAS: " + noSolicitud); +// Request request = this.callerhelper.getRequest(); +//// request.modifiedData().put("querytype", "P"); +//// request.modifiedData().put("queryalias", "DESGLOCEDESADUANIZACION"); +// TarmSolicitud solicitudObj = SolicitudController.findSolicitudxcodsolicitud(noSolicitud); +// if(solicitudObj!=null){ +// request.getModifiedData().put("SOLICITUD", solicitudObj); +// } +// else{ +// MessageHelper.setMessageError("NO EXISTE UN CODIGO DE AUCP ASOCIADO A LA SOLICITUD"); +// return; +// } +// Response resp = this.callerhelper.executeQuery(request); +// if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { +// this.lrecord = new ArrayList(); +// MessageHelper.setMessageError(resp); +// } else { +// this.lrecord = (List) resp.get(this.beanalias); +// } +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// } + } + + /** + * Obtiene un arma por su codigo + * + * @param codigopersona + * @return + */ + public static TarmArmas findByCode(String carma) { + try { + DesaduanizacionController cc = new DesaduanizacionController(); + cc.init(); + cc.recperpage = 300000; + cc.addFilter("pk", carma); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public Date getFechaDesaduanizacion() { + return fechaDesaduanizacion; + } + + public void setFechaDesaduanizacion(Date fechaDesaduanizacion) { + this.fechaDesaduanizacion = fechaDesaduanizacion; + } + + public void setDatos(final AjaxBehaviorEvent event) { + try { + TarmSolicitudTramite soltra = TarmSolicitudTramiteController.findPorCSolicitud(this.noSolicitud); + // Verificacion del desgloce de desaduanizacion + TarmSolicitud solicitudObj = SolicitudController.findSolicitudxcodsolicitud(soltra.getPk().getCsolicitud()); + TarmCarga carga = CargaController.findByAUCP(solicitudObj.getAucp()); + + this.record = new TarmArmas(); + this.record.modifiedData().put("tipotramitedesc", soltra.modifiedData().get("tipotramitedesc")); + this.record.modifiedData().put("categoriadesc", soltra.modifiedData().get("categoriadesc")); + this.record.modifiedData().put("usodesc", soltra.modifiedData().get("usodesc")); + this.record.modifiedData().put("cedula", soltra.modifiedData().get("cedula")); + this.record.modifiedData().put("nombre", soltra.modifiedData().get("nombre")); + this.record.modifiedData().put("personcode", soltra.modifiedData().get("personcode")); + this.record.modifiedData().put("aucp", (solicitudObj.getAucp() != null && !solicitudObj.getAucp().isEmpty()) ? solicitudObj.getAucp() : ""); + TarmCentroControl centroControlObj = CentroControlArmasController.findPorCodigo(solicitudObj.getCcentrocontrol()); + if (centroControlObj != null) { + String ccentrocontrol = CatalogDetailController.findxCodigoCodcatalogo(centroControlObj.getNombreinstitucion(), + centroControlObj.getNombreinstitucioncodigo()).getDescription(); + this.record.modifiedData().put("nombreCentroControl", (ccentrocontrol != null && !ccentrocontrol.isEmpty()) ? ccentrocontrol : ""); + } + + TarmDocumentoHabilitante dochab = DocumentoHabilitanteController.findPorSolicitud(this.noSolicitud); + if (dochab != null) { + this.record.modifiedData().put("fechaemision", dochab.getFechaemision()); + } + + //cregistro propietario +// List regArmas = RegistroArmController.findxPersoncode(soltra.modifiedData().get("personcode").toString()); +// StringBuilder sql = new StringBuilder("cregistro in"); +// Integer aux=0; +// for(TarmRegistroArmas t :regArmas){ +// if(aux==0){ +// sql.append("("+t.getPk()); +// aux++; +// }else{ +// sql.append(","+t.getPk()); +// } +// } +// sql.append(")"); + //armas codigoarma que debe filtar + String sql = "cregistro in (Select r.pk from TarmRegistroArmas r where personcode=" + soltra.modifiedData().get("personcode").toString() + ")"; + addField("cregistro", sql); + this.salvarDeshabilitado = true; + if (carga.getEsdesaduanizado().equals("N")) { + RequestContext.getCurrentInstance().execute("PF('dialog').show()"); + } else { + querydatabase(); + + } + } catch (Exception e) { + // TODO: handle exception + } + } + + /** + * Metodo que indica las acciones asociadas de cerrar el dialogo sin + * desanuanizar + */ + public void cerrar() { + init(); + } + + public void habilitaGrabar(final AjaxBehaviorEvent event) { + Integer aux = 0; + for (TarmArmas armas : this.lrecord) { + if (!this.lrecord.isEmpty() && armas.getLote() != null) { + aux++; + } + } + if (aux.compareTo(this.lrecord.size()) == 0) { + this.salvarDeshabilitado = false; + } + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + + public List getTramites() { + return tramites; + } + + public void setTramites(List tramites) { + this.tramites = tramites; + } + + public String getNoSolicitud() { + return noSolicitud; + } + + public void setNoSolicitud(String noSolicitud) { + this.noSolicitud = noSolicitud; + } + + public Boolean getSalvarDeshabilitado() { + return salvarDeshabilitado; + } + + public void setSalvarDeshabilitado(Boolean salvarDeshabilitado) { + this.salvarDeshabilitado = salvarDeshabilitado; + } + + public SolicitudTramiteController getTarmSolicitudTramiteController() { + return tarmSolicitudTramiteController; + } + + public void setTarmSolicitudTramiteController( + SolicitudTramiteController tarmSolicitudTramiteController) { + this.tarmSolicitudTramiteController = tarmSolicitudTramiteController; + } + + public List getLcolor() { + return lcolor; + } + + public void setLcolor(List lcolor) { + this.lcolor = lcolor; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/DesaduanizacionOldController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/DesaduanizacionOldController.java new file mode 100644 index 0000000..dded801 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/DesaduanizacionOldController.java @@ -0,0 +1,404 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.solicitud.DocumentoHabilitanteController; +import com.fp.frontend.controller.armas.solicitud.SolicitudTramiteController; +import com.fp.frontend.controller.armas.solicitud.TarmSolicitudArmasController; +import com.fp.frontend.controller.armas.solicitud.TarmSolicitudTramiteController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.eval.TarmDetallePreguntas; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.ins.TarmPlanificacionTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class DesaduanizacionOldController extends AbstractController { + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{solicitudTramiteController}") + private SolicitudTramiteController tarmSolicitudTramiteController; + + private Date fechaDesaduanizacion; + private List tramites; + //private TarmTramite tramiteSeleccionado; + private String noSolicitud; + //private List larmas=new ArrayList(); + private Boolean salvarDeshabilitado = false; + + private TsafeUserDetail tsafeUserDetailUsuario = null; + + /*@ManagedProperty(value = "#{tarmSolicitudArmasController}") + private TarmSolicitudArmasController tarmSolicitudArmasController;*/ + public DesaduanizacionOldController() throws Exception { + super(TarmArmas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta +// super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. +// this.lrecord = new ArrayList<>(); +// this.record=new TarmArmas(); + this.beanalias = "DESADUANIZACION"; +// this.create(); + + //Fecha de desaduanizacion + this.fechaDesaduanizacion = Calendar.getInstance().getTime(); + + //Cargando los tramites + caragarTramiteSolicitud(); + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + this.salvarDeshabilitado = true; + + tarmSolicitudTramiteController.create(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void caragarTramiteSolicitud() { + this.tramites = TarmSolicitudTramiteController.findTramites(); + } + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", "i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase = new SubQuery("TarmTipoArmaExplosivo", "clase", "cclase", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo = new SubQuery("TarmTipoArmaExplosivo", "clasecodigo", "cclasecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud = new SubQuery("TarmTipoArmaExplosivo", "longitud", "clongitud", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo = new SubQuery("TarmTipoArmaExplosivo", "longitudcodigo", "clongitudcodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre = new SubQuery("TarmTipoArmaExplosivo", "calibre", "ccalibre", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo = new SubQuery("TarmTipoArmaExplosivo", "calibrecodigo", "ccalibrecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivo", "ctipoarmaexplosivo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivocodigo", "ctipoarmaexplosivocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapeso", "cunidadmedidapeso", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapesocodigo", "cunidadmedidapesocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida = new SubQuery("TgeneCatalogDetail", "description", "unidadmedida", "i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode = new SubQuery("TarmRegistroArmas", "personcode", "personcode", "i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + SubQuery subqueryTipo = new SubQuery("TgeneCatalogDetail", "description", "tipo", "i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipo); + + SubQuery subqueryCalibreD = new SubQuery("TgeneCatalogDetail", "description", "calibreD", "i.pk.catalog= (select o.calibre from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.calibrecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryCalibreD); + + SubQuery subqueryTipoArmaExplosivo = new SubQuery("TgeneCatalogDetail", "description", "tipoarmaexplosivo", "i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + + dto.addSubQuery(subqueryTipoArmaExplosivo); + SubQuery subqueryClasecatalogo = new SubQuery("TgeneCatalogDetail", "description", "clase", "i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClasecatalogo); + return dto; + } + + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + Filter filtro = new Filter(); + if (this.getMfilelds().get("cregistro") != null) { + filtro.setSql(this.getMfilelds().get("cregistro").toString() + " and t.estado = 'IMPO' and t.lote is null " + + " and t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro)" + + " and t.pk in (select tar.codigoarma from TarmArmas tar where tar.pk in( select ar.pk.carma from TarmSolicitudArmas ar where ar.pk.csolicitud= '" + this.noSolicitud + "'))" + + " and (t.peso>0 or t.cantidad>0)"); + dto.addFiltro(filtro); + } + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); +// for(int i = 0; i(); +// MessageHelper.setMessageError(resp); +// } else { +// lrecord = (List) resp.get(beanalias); +// if(!lrecord.isEmpty()){ +// record=lrecord.get(0); +// } +// super.postQuery(lrecord); +// Collections.sort(lrecord,new Comparator(){ +// public int compare(TarmArmas f1, TarmArmas f2) +// { +// return f1.getModifiedData().get("tipo").toString().compareTo(f1.getModifiedData().get("tipo").toString()); +// } +// }); +// } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public boolean validarSerieDuplicadas() { + Set lista = new HashSet(); + for (TarmArmas ar : this.lrecord) { + lista.add(ar.getLote()); + } + if (this.lrecord.size() > lista.size()) { + return true; + } + return false; + + } + + @Override + public void save() { + try { + for (TarmArmas armas : this.lrecord) { + this.record = armas; + this.record.setEstado("REG"); + Calendar calendario = Calendar.getInstance(); + calendario.setTime(this.fechaDesaduanizacion); + this.record.setFdesaduanizacion(new java.sql.Date(calendario.getTimeInMillis())); + if (this.record.getLote() != null) { + if (this.validarSerieDuplicadas()) { + MessageHelper.setMessageError("LOS ARTCULOS NO PUEDEN TENER SERIES IGUALES"); + return; + } + update(); + } else { + StringBuilder err = new StringBuilder("EL CAMPO SERIE NO PUEDE ESTAR VACO"); + //err.append(this.record.getPk()); + MessageHelper.setMessageError(err.toString()); + return; + + } + + } + HashMap msave = new HashMap(); + Request request = callerhelper.getRequest(); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + for (TarmSolicitudTramite tramite : tramites) { + if (this.noSolicitud.equals(tramite.getPk().getCsolicitud())) { + tarmSolicitudTramiteController.setRecord(tramite); + break; + } + } + +// tarmSolicitudTramiteController.getRecord().setEstadotramite("FIN"); +// tarmSolicitudTramiteController.update(); +// DtoSave dtosaveTramite = tarmSolicitudTramiteController.getDtoSave(); +// msave.put(tarmSolicitudTramiteController.getBeanalias(), dtosaveTramite); // adicionar metadata de mantenimiento para cada tabla. + request.getModifiedData().put("noSolicitud", noSolicitud); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); +// tarmSolicitudTramiteController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + this.salvarDeshabilitado = true; + caragarTramiteSolicitud(); + this.query(); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene un arma por su codigo + * + * @param codigopersona + * @return + */ + public static TarmArmas findByCode(String carma) { + try { + DesaduanizacionOldController cc = new DesaduanizacionOldController(); + cc.init(); + cc.recperpage = 300000; + cc.addFilter("pk", carma); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public Date getFechaDesaduanizacion() { + return fechaDesaduanizacion; + } + + public void setFechaDesaduanizacion(Date fechaDesaduanizacion) { + this.fechaDesaduanizacion = fechaDesaduanizacion; + } + + public void setDatos(final AjaxBehaviorEvent event) { + try { + TarmSolicitudTramite soltra = TarmSolicitudTramiteController.findPorCSolicitud(this.noSolicitud); + this.record = new TarmArmas(); + this.record.modifiedData().put("tipotramitedesc", soltra.modifiedData().get("tipotramitedesc")); + this.record.modifiedData().put("categoriadesc", soltra.modifiedData().get("categoriadesc")); + this.record.modifiedData().put("usodesc", soltra.modifiedData().get("usodesc")); + this.record.modifiedData().put("cedula", soltra.modifiedData().get("cedula")); + this.record.modifiedData().put("nombre", soltra.modifiedData().get("nombre")); + this.record.modifiedData().put("personcode", soltra.modifiedData().get("personcode")); + TarmDocumentoHabilitante dochab = DocumentoHabilitanteController.findPorSolicitud(this.noSolicitud); + if (dochab != null) { + this.record.modifiedData().put("fechaemision", dochab.getFechaemision()); + } + + //cregistro propietario +// List regArmas = RegistroArmController.findxPersoncode(soltra.modifiedData().get("personcode").toString()); +// StringBuilder sql = new StringBuilder("cregistro in"); +// Integer aux=0; +// for(TarmRegistroArmas t :regArmas){ +// if(aux==0){ +// sql.append("("+t.getPk()); +// aux++; +// }else{ +// sql.append(","+t.getPk()); +// } +// } +// sql.append(")"); + //armas codigoarma que debe filtar + String sql = "cregistro in (Select r.pk from TarmRegistroArmas r where personcode=" + soltra.modifiedData().get("personcode").toString() + ")"; + addField("cregistro", sql); + this.salvarDeshabilitado = true; + + } catch (Exception e) { + // TODO: handle exception + } + } + + public void habilitaGrabar(final AjaxBehaviorEvent event) { + Integer aux = 0; + for (TarmArmas armas : this.lrecord) { + if (!this.lrecord.isEmpty() && armas.getLote() != null) { + aux++; + } + } + if (aux.compareTo(this.lrecord.size()) == 0) { + this.salvarDeshabilitado = false; + } + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + + public List getTramites() { + return tramites; + } + + public void setTramites(List tramites) { + this.tramites = tramites; + } + + public String getNoSolicitud() { + return noSolicitud; + } + + public void setNoSolicitud(String noSolicitud) { + this.noSolicitud = noSolicitud; + } + + public Boolean getSalvarDeshabilitado() { + return salvarDeshabilitado; + } + + public void setSalvarDeshabilitado(Boolean salvarDeshabilitado) { + this.salvarDeshabilitado = salvarDeshabilitado; + } + + public SolicitudTramiteController getTarmSolicitudTramiteController() { + return tarmSolicitudTramiteController; + } + + public void setTarmSolicitudTramiteController( + SolicitudTramiteController tarmSolicitudTramiteController) { + this.tarmSolicitudTramiteController = tarmSolicitudTramiteController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/MovimientoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/MovimientoController.java new file mode 100644 index 0000000..570d4fc --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/MovimientoController.java @@ -0,0 +1,114 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmMovimientoArmas; + +/** + * Clase controladora del bean TarmMovimiento. + * + * @author Andres Cevallos. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class MovimientoController extends AbstractController { + + /** + * Constructor + * + * @throws Exception + */ + public MovimientoController() throws Exception { + super(TarmMovimientoArmas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "MOVIMIENTO"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ProvinceLovController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ProvinceLovController.java new file mode 100644 index 0000000..5280fa3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ProvinceLovController.java @@ -0,0 +1,222 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Clase controladora del bean TarmSitioAlmacenamiento. + * + * @author abenalcazar + * + */ +@ManagedBean +@ViewScoped +public class ProvinceLovController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public ProvinceLovController() throws Exception { + super(TgeneProvince.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PROVINCELOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); // En en string van todos los + // campos de orden + // ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Método que entrega el listado objetos TgeneProvince provincias + * + * @param countrycode Código de país + * @return lrecord Lista de objetos TgeneProvince + */ + public static List find(String countrycode) { + try { + ProvinceLovController cc = new ProvinceLovController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Metodo para buscar por codigo de provincia + * + * @param provincecode + * @return + */ + public static List findPorCodigo(String countrycode, + String provincecode) { + try { + ProvinceLovController cc = new ProvinceLovController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.addFilter("pk.provincecode", provincecode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findxDescripcion(String countrycode, + String codigoProvincia, String descripcion) { + try { + ProvinceLovController cc = new ProvinceLovController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + if (codigoProvincia != null && codigoProvincia.length() > 0) { + cc.addFilter("pk.provincecode", codigoProvincia); + } + if (descripcion != null && descripcion.length() > 0) { + cc.addFilter("description", descripcion); + } + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog( + "/pages/armas/lov/provinciaLov.xhtml", options, params); + } + + public void setprovince() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setprovince(TgeneProvince tgeneProvince) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneProvince); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/RegistroArmController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/RegistroArmController.java new file mode 100644 index 0000000..593022c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/RegistroArmController.java @@ -0,0 +1,171 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; + +/** + * Clase controladora del bean TarmSolicitudImportacion. + * + * @author Andres Cevallos. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RegistroArmController extends AbstractController { + + public RegistroArmController() throws Exception { + super(TarmRegistroArmas.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //Ingreso de Datos Quemados + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + public void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + // record = new TarmSolicitudImportacion(); + this.beanalias = "TREGISTROARMAS"; +// this.create(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static List find() { + try { + RegistroArmController cc = new RegistroArmController(); + cc.init(); + cc.recperpage = 5000; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + public static List findxPersoncode(String personcode) { + try { + RegistroArmController cc = new RegistroArmController(); + cc.init(); + cc.addFilter("personcode", personcode); + cc.recperpage = 5000; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + public static TarmRegistroArmas findByCodigo(String cRegistro) { + try { + RegistroArmController cc = new RegistroArmController(); + cc.init(); + cc.recperpage = 3000000; + cc.addFilter("pk", cRegistro); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + public void update(TarmRegistroArmas bean) throws Exception { + record = bean; + update(); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteArmasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteArmasController.java new file mode 100644 index 0000000..db78e6d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteArmasController.java @@ -0,0 +1,346 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * @author Andres Cevallos Clase Controladora la cual genera el reporte de armas + */ +@ManagedBean +@ViewScoped +public class ReporteArmasController extends AbstractController { + + public ReporteArmasController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + + public Date fecha; + private TcustPersonDetail customerperson; + private List lestados; + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + private TsafeUserDetail userDetail; + private String institucionCentroControl = ""; + private TarmCentroControl centroControl = new TarmCentroControl(); + private Date fechainicial; + private Date fechafinal; + private String filtro = ""; + private String estado; + private String serieLote; + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + lestados = CatalogDetailController.find("ESTADOARMA"); + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + estado = ""; + obtenerCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que se debe ejecutar cuando es una transaccion de tipo verificar + * armas + * + * @throws Exception + */ + private void obtenerCentroControl() throws Exception { + + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + + } + + @Override + protected void querydatabase() { + + } + + /** + * Abre el Lov de Persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Carga los datos que se devuelven en el Lov de personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + setCustomerperson((TcustPersonDetail) event.getObject()); + + } + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + } + + public void generarReporte() { + if (fechainicial.getTime() > fechafinal.getTime()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_fechafinal")); + return; + } + String gradoUsuario = ""; + filtro = " "; + String path = "armas/reports/reporteArmas"; + if (customerperson != null) { + filtro = " and tarma.cregistro in " + + " (select regarma.cregistro from tarmregistroarmas regarma where regarma.personcode='" + customerperson.getPk().getPersoncode() + "')"; + } + if (estado != null && !estado.equals("")) { + if (estado.equals("APTA")) { + filtro += " and tarma.carma in (select carma from tarmarmapruebas p " + + " where p.carmaprueba=(select max(prue.carmaprueba)" + + " from tarmarmapruebas prue where prue.apruebaevaluacion='Y' and prue.carma in(select codar.carma from tarmarmas codar" + + " where codar.codigoarma =(select ar.codigoarma from tarmarmas ar where carma=tarma.carma) ))) "; + //"and pru.apruebaevaluacion='Y'"; + } else { + filtro += " and tarma.estado='" + estado + "' "; + } + } + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + // parameters.put("fechaCorte", (new SimpleDateFormat("dd-MM-yyyy")).format(fechaCorte).toString()); + // parameters.put("gradoUsuario",gradoUsuario); + try { + + //Usuario logueado en la aplicacion + String nombreUsuario; + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + } else { + nombreUsuario = ""; + } + //filtro = "where tarma.personcode='1138'"; + parameters.put("filtro", filtro); + SimpleDateFormat fechatxt = new SimpleDateFormat("yyyy-MM-dd"); + parameters.put("fechainicial", fechatxt.format(fechainicial)); + parameters.put("fechafinal", fechatxt.format(fechafinal)); + parameters.put("usuario", nombreUsuario); + parameters.put("unidadmilitar", institucionCentroControl); + // parameters.put("tecnicoAlmacenamiento",MsgControlArmas.getProperty("tecnicoAlmacenamiento")+" "+institucionCentroControl); + // parameters.put("jefe",MsgControlArmas.getProperty("jefe")+" "+institucionCentroControl); + String format = "xlsx"; + String filename = MsgControlArmas.getProperty("lbl_nombreexcel"); + //Fecha actual + Calendar fechaActualCldr = Calendar.getInstance(); + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH) + 1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarfecha", fechaActualSB.toString()); + // parameters.put("transaccion",numeroTransaccionEnvioConvertido); + parameters.put("codigoQR", "PRUEBAARMAS" + fechaActualSB.toString()); + + // format = CatalogDetailController.findxCodigoCodcatalogo(tipoReporte, "TIPOREPORTE").getLegalcode(); + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + // this.reportController.execute(path, parameters, null, filename, this.getLoginController()); + // xpathflujo = generarXpath(); + + // alfrescoController.uploadFile(file,numeroTransaccionEnvioConvertido+".pdf",xpathflujo); + // iniciarFlujo(xpathflujo+"/cm:"+numeroTransaccionEnvioConvertido+ ".pdf");//="cm:Decomiso/cm:A-2014/cm:M-10/cm:ENV-000000319/cm:ENV-000000319.pdf" + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } + + public void generarReporteHistorico() { + if (fechainicial.getTime() > fechafinal.getTime()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_fechafinal")); + return; + } + String gradoUsuario = ""; + String path = "armas/reports/reporteHistoricoArmas.jrxml"; + filtro = ""; + if (serieLote != null && serieLote.trim().length() > 0) { + filtro = " and tarma.lote='" + serieLote + "' "; + } + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + } else { + nombreUsuario = ""; + } + //filtro = "where tarma.personcode='1138'"; + parameters.put("filtro", filtro); + SimpleDateFormat fechatxt = new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fechainicial", fechatxt.format(fechainicial)); + parameters.put("fechafinal", fechatxt.format(fechafinal)); + parameters.put("usuario", nombreUsuario); + parameters.put("unidadmilitar", institucionCentroControl); + String format = "xlsx"; + String filename = MsgControlArmas.getProperty("lbl_nombreexcelhistorico"); + //Fecha actual + Calendar fechaActualCldr = Calendar.getInstance(); + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH) + 1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarfecha", fechaActualSB.toString()); + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#postCommit(com.fp.dto.Response) + */ + public Date getFecha() { + return fecha; + } + + public void setFecha(Date fecha) { + this.fecha = fecha; + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public List getLestados() { + return lestados; + } + + public void setLestados(List lestados) { + this.lestados = lestados; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public String getSerieLote() { + return serieLote; + } + + public void setSerieLote(String serieLote) { + this.serieLote = serieLote; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteArmasPrevImportacionController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteArmasPrevImportacionController.java new file mode 100644 index 0000000..17f5b8a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteArmasPrevImportacionController.java @@ -0,0 +1,83 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.HashMap; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * + * @author David Cruz + * + */ +@ManagedBean +@ViewScoped +public class ReporteArmasPrevImportacionController extends AbstractController { + + private static final long serialVersionUID = -6726028201723692500L; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + private TsafeUserDetail userDetail; + + public ReporteArmasPrevImportacionController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + public void init() { + beanalias = "REPORTE"; + lrecord = new ArrayList<>(); + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + } + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + } + + public void generarReporte() { + String path = "armas/reports/reporteArmasPrevImportacion"; + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + } else { + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario); + String format = "xlsx"; + String filename = "permisosprevimportacion"; + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteCashManagmentController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteCashManagmentController.java new file mode 100644 index 0000000..e1a15f5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteCashManagmentController.java @@ -0,0 +1,457 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletResponse; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CashManagementHistoryController; +import com.fp.frontend.controller.armas.solicitud.SolicitudArmasController; +import com.fp.frontend.controller.armas.solicitud.SolicitudTramiteController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.date.TgeneNotAccountingDayController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.fun.TarmCashManagementHistory; +import com.fp.persistence.parmas.soli.CashManagementDTO; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * @author Christian Pazmino Cash management + */ +@ManagedBean +@ViewScoped +public class ReporteCashManagmentController extends AbstractController { + + public ReporteCashManagmentController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + // Fecha inicial + private Date fechainicial; + // Fecha final + private Date fechafinal; + // Fecha inicial con mascara + private String fechaInicialStr; + // Fecha final con mascara + private String fechaFinalStr; + // Lista con informacion de los tramites habilitados para realizar los depositos en la cuenta + private List cashManagementList = new ArrayList(); + // Fecha del ultimo reporte generado + private String fechaUltReporte; + // Autor del ultimo reporte generado + private String autorUltReporte; + // Path del reporte en el alfresco + private String xpathReporte; + // Controlador de Solicitud Tramite + @ManagedProperty(value = "#{solicitudTramiteController}") + private SolicitudTramiteController solicitudTramiteController; + // Controlador del alfresco + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + // Nombre identificador del archivo cash management generado + private String nombreArchivo; + + private File archivo; + /** + * Controlador que maneja los datos de generacion ultima vez del reporte + */ + @ManagedProperty(value = "#{cashManagementHistoryController}") + private CashManagementHistoryController cashManagementHistoryController; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + TarmCashManagementHistory ultimoReporteObj = CashManagementHistoryController.findUltimoReporteGenerado(); + if (ultimoReporteObj != null) { + SimpleDateFormat sdfUltimaFecha = new SimpleDateFormat("dd/MM/yyyy HH:mm"); + fechaUltReporte = sdfUltimaFecha.format(ultimoReporteObj.getDatefrom()); + autorUltReporte = ultimoReporteObj.getModifiedData().get("personname") != null ? ultimoReporteObj.getModifiedData().get("personname").toString() : null; + } + this.beanalias = "CASHMANAGEMENT"; + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + int diasLaborablesPermitidos = Integer.parseInt(ParametersController.find("DIASDEPOSITO", "1").getNumbervalue().toString()); + // La fecha inicial se calcula en funcion del numero de dias laborables permitidos para el deposito + fechainicial = TgeneNotAccountingDayController.diasLaborablesPreviosAUnaFecha(new Date(), diasLaborablesPermitidos); + // La fecha final es la fecha actual + Calendar fechaFinalCldr = Calendar.getInstance(); + System.out.println("Fecha final " + fechaFinalCldr.getTime()); + fechaFinalStr = sdf.format(fechaFinalCldr.getTime()); + System.out.println("Fecha inicial " + fechainicial); + fechaInicialStr = sdf.format(fechainicial); + querydatabase(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + try { + System.out.println("Ejecuta querydatabase cash managment..."); + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + request.put("queryalias", "CASHMANAGEMENT"); + request.put("querytype", "P"); + request.put("fechaInicialStr", fechaInicialStr); + request.put("fechaFinalStr", fechaFinalStr); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + List lCashManagement = (List) resp.get("CASHMANAGEMENTLIST"); + construirListaCashDTO(lCashManagement); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void construirListaCashDTO(List lCashManagement) { + for (Object[] cashObj : lCashManagement) { + CashManagementDTO cashManagementDTO = new CashManagementDTO(); + // Codigo orientacion + cashManagementDTO.setCodigoServicio(cashObj[0] != null ? cashObj[0].toString() : null); + // Contra partida + cashObj[1] = Integer.parseInt(cashObj[1].toString().substring(4, cashObj[1].toString().length())); + cashManagementDTO.setContrato(cashObj[1] != null ? cashObj[1].toString() : null); + // Moneda + cashManagementDTO.setMoneda(cashObj[2] != null ? cashObj[2].toString() : null); + // Valor + String valorDosDecimalesStr = null; + if (cashObj[3] != null) { + BigDecimal valorDosDecimales = ((BigDecimal) cashObj[3]).setScale(2); +// valorDosDecimales.setScale(2, BigDecimal.ROUND_HALF_UP); + valorDosDecimalesStr = valorDosDecimales.toString().replace(".", ""); + } + cashManagementDTO.setValorapagar(valorDosDecimalesStr); + // Forma de cobro, forma de pago + cashManagementDTO.setFormaCobro(cashObj[4] != null ? cashObj[4].toString() : null); + // Tipo de cuenta + cashManagementDTO.setTipoCuenta(cashObj[5] != null ? cashObj[5].toString() : null); + // NUmero de cuenta + cashManagementDTO.setNumeroCuenta(cashObj[6] != null ? cashObj[6].toString() : null); + // Referencia + cashManagementDTO.setReferencia(cashObj[7] != null ? Utilidades.reemplazaAcentosCaractEspeciales(cashObj[7].toString()) : null); + // Tipo ID cliente + cashManagementDTO.setTipoIDCliente(cashObj[8] != null ? cashObj[8].toString() : null); + // Nombre del cliente + cashManagementDTO.setNumeroIDCliente(cashObj[9] != null ? cashObj[9].toString() : null); + // Si el nombre del cliente es mayor a 41 caracteres + if (cashObj[10] != null && cashObj[10].toString().length() > 41) { + cashObj[10] = cashObj[10].toString().substring(0, 41); + } + // Nombre del cliente + cashManagementDTO.setNombreCliente(cashObj[10] != null ? Utilidades.reemplazaAcentosCaractEspeciales(cashObj[10].toString()) : null); + // Base Imponible + cashManagementDTO.setBaseImponible(cashObj[11] != null ? cashObj[11].toString() : null); + // Csolicitud + cashManagementDTO.setCsolicitud(cashObj[12] != null ? cashObj[12].toString() : null); + cashManagementList.add(cashManagementDTO); + } + } + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + } + + /** + * Obtiene el reporte de cash management + */ + public void generarReporte(String filename) { + try { + + if (cashManagementList.isEmpty()) { + MessageHelper.setMessageInfo("NO EXISTEN DATOS PARA GENERAR EL REPORTE..."); +// return null; + } + archivo = File.createTempFile(filename, ".txt"); +// File archivo = File.createTempFile("cashmanagement"+fechaFinalStr,".txt"); + PrintWriter escribir = new PrintWriter(archivo); + for (CashManagementDTO cashManagementDTO : cashManagementList) { + escribir.print(cashManagementDTO.getCodigoServicio() != null ? cashManagementDTO.getCodigoServicio() + "\t" : "\t"); + escribir.print(cashManagementDTO.getContrato() != null ? cashManagementDTO.getContrato() + "\t" : "\t"); + escribir.print(cashManagementDTO.getMoneda() != null ? cashManagementDTO.getMoneda() + "\t" : "\t"); + escribir.print(cashManagementDTO.getValorapagar() != null ? cashManagementDTO.getValorapagar() + "\t" : "\t"); + escribir.print(cashManagementDTO.getFormaCobro() != null ? cashManagementDTO.getFormaCobro() + "\t" : "\t"); + escribir.print(cashManagementDTO.getTipoCuenta() != null ? cashManagementDTO.getTipoCuenta() + "\t" : "\t"); + escribir.print(cashManagementDTO.getNumeroCuenta() != null ? cashManagementDTO.getNumeroCuenta() + "\t" : "\t"); + escribir.print(cashManagementDTO.getReferencia() != null ? cashManagementDTO.getReferencia() + "\t" : "\t"); + escribir.print(cashManagementDTO.getTipoIDCliente() != null ? cashManagementDTO.getTipoIDCliente() + "\t" : "\t"); + escribir.print(cashManagementDTO.getNumeroIDCliente() != null ? cashManagementDTO.getNumeroIDCliente() + "\t" : "\t"); + escribir.print(cashManagementDTO.getNombreCliente() != null ? cashManagementDTO.getNombreCliente() + "\r\n" : "\r\n"); + TarmSolicitudTramite solicitudTramiteObj = SolicitudTramiteController.findByCSolicitud(cashManagementDTO.getCsolicitud()); + solicitudTramiteObj.setIncashreport("S"); + solicitudTramiteController.updateSimple(solicitudTramiteObj); + // escribir.println(cashManagementDTO.getBaseImponible()); + + } + solicitudTramiteController.save(); + escribir.flush(); + escribir.close(); +// return archivo; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); +// return null; + } + + } + + /** + * Llama a la construccion del metodo para recargar + */ + public void descargarArchivo() { +// File archivoTemporal=generarReporte(); + try { + obtenerSecuencialSolicitud(); + this.xpathReporte = this.getRutaDocumento(); + Calendar calendar = Calendar.getInstance(); + SimpleDateFormat sdfFechaParaNombre = new SimpleDateFormat("ddMMyyyyHHmm"); + String fechaParaNombre = sdfFechaParaNombre.format(calendar.getTime()); + String filename = "COMACO" + fechaParaNombre + this.nombreArchivo; + + generarReporte(filename); + filename = filename + ".txt"; + +// if(archivoTemporal==null){ + if (archivo == null) { + return; + } + InputStream inputStream = new FileInputStream(archivo); //(archivoTemporal); + + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition", "attachment; filename=" + filename); + OutputStream out = response.getOutputStream(); + + int read = 0; + byte[] bytes = new byte[1024]; + + while ((read = inputStream.read(bytes)) != -1) { + out.write(bytes, 0, read); + } + out.flush(); + + FacesContext.getCurrentInstance().responseComplete(); + + generarReporte(filename); + InputStream inputStream2 = new FileInputStream(archivo); + +// if(!this.alfrescoController.uploadFile(inputStream, filename, this.xpathReporte)){ + if (!this.alfrescoController.uploadFile(inputStream2, filename, this.xpathReporte)) { + throw new Exception("ERROR AL CARGAR EL REPORTE"); + } + + inputStream.close(); + inputStream2.close(); + + // Guardar datos ultima generacion del archivo + TarmCashManagementHistory actualCashManagementHistory = new TarmCashManagementHistory(); + actualCashManagementHistory.setDatefrom(new Timestamp(calendar.getTimeInMillis())); + actualCashManagementHistory.setDateto(Utilidades.getFechaExpiracion()); + actualCashManagementHistory.setIsnew(true); + actualCashManagementHistory.setNombrearchivo(filename); + actualCashManagementHistory.setPathreporte(this.xpathReporte + "/cm:" + filename); + actualCashManagementHistory.setPk(nombreArchivo); + + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + actualCashManagementHistory.setUsercode(tsafeUserDetail.getPk().getUsercode()); + + cashManagementHistoryController.update(actualCashManagementHistory); + + List ultimoCashManagementHistoryList = CashManagementHistoryController.findReportesGeneradosVigentes(); + if (ultimoCashManagementHistoryList != null) { + for (TarmCashManagementHistory ultimoCashManagementHistory : ultimoCashManagementHistoryList) { + ultimoCashManagementHistory.setDateto(new Timestamp(calendar.getTimeInMillis())); + ultimoCashManagementHistory.setIsnew(Boolean.FALSE); + cashManagementHistoryController.update(ultimoCashManagementHistory); + } + } + cashManagementHistoryController.save(); + + } catch (Exception e) { + // TODO: handle exception + } catch (Throwable e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Arma la petición al core para solicitar un número de + * secuencial para la solicitud antes de guardarla + * + * @throws Throwable + */ + private void obtenerSecuencialSolicitud() throws Throwable { + Request request = callerhelper.getRequest(); + DtoQuery dtoQuery = super.getDtoQuery(true); + HashMap mapQuery = new HashMap(); + mapQuery.put(beanalias, dtoQuery); + request.put("querytype", "T"); + request.setQueryTables(mapQuery); + Response response = callerhelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(response); + } else { + nombreArchivo = response.get("CASHHISTORICOSEQUENCE").toString(); + } + } + + /** + * Metodo para armar la ruta del documento + * + * @return + */ + public String getRutaDocumento() { + Calendar calendar = Calendar.getInstance(); + StringBuilder ruta = new StringBuilder("cm:CashManagement"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append( + (calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + ruta = ruta.append("/cm:D-").append( + (calendar.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (calendar.get(Calendar.DAY_OF_MONTH)) : (calendar.get(Calendar.DAY_OF_MONTH))); + return ruta.toString(); + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getFechaInicialStr() { + return fechaInicialStr; + } + + public void setFechaInicialStr(String fechaInicialStr) { + this.fechaInicialStr = fechaInicialStr; + } + + public String getFechaFinalStr() { + return fechaFinalStr; + } + + public void setFechaFinalStr(String fechaFinalStr) { + this.fechaFinalStr = fechaFinalStr; + } + + public String getFechaUltReporte() { + return fechaUltReporte; + } + + public void setFechaUltReporte(String fechaUltReporte) { + this.fechaUltReporte = fechaUltReporte; + } + + public String getAutorUltReporte() { + return autorUltReporte; + } + + public void setAutorUltReporte(String autorUltReporte) { + this.autorUltReporte = autorUltReporte; + } + + public CashManagementHistoryController getCashManagementHistoryController() { + return cashManagementHistoryController; + } + + public void setCashManagementHistoryController( + CashManagementHistoryController cashManagementHistoryController) { + this.cashManagementHistoryController = cashManagementHistoryController; + } + + public String getXpathReporte() { + return xpathReporte; + } + + public void setXpathReporte(String xpathReporte) { + this.xpathReporte = xpathReporte; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public String getNombreArchivo() { + return nombreArchivo; + } + + public void setNombreArchivo(String nombreArchivo) { + this.nombreArchivo = nombreArchivo; + } + + public SolicitudTramiteController getSolicitudTramiteController() { + return solicitudTramiteController; + } + + public void setSolicitudTramiteController( + SolicitudTramiteController solicitudTramiteController) { + this.solicitudTramiteController = solicitudTramiteController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteCompInscritaController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteCompInscritaController.java new file mode 100644 index 0000000..7852aee --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteCompInscritaController.java @@ -0,0 +1,415 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.apache.log4j.Logger; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@ManagedBean +@ViewScoped +public class ReporteCompInscritaController extends AbstractController { + + /** + * + */ + public ReporteCompInscritaController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private final static Logger LOGGER = Logger.getLogger(ReporteCompInscritaController.class); + private static final long serialVersionUID = 1L; + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController personDetailController; + + @ManagedProperty(value = "#{centroControlController}") + private CentroControlArmasController centroControlController; + + private TcustPersonDetail customerperson; + private TsafeUserDetail userDetail; + private TcustPersonDetail responsableCentroControl = null; + private TsafeUserDetail tsafeUserDetailUsuario = null; + private TarmCentroControl centroControl = new TarmCentroControl(); + private List lcentroControl = null; + private List ltiporeg = null; + private List lestadosArma = null; + private List ltipoFabArma = null; + private List estadosSeleccionados = null; + //Tipo de Fabricacion Arma Seleccionada + private List tipoFabArmaSeleccionada = null; + + private String institucionCentroControl = ""; + private Date fechainicial; + private Date fechafinal; + private String filtro = ""; + private String filtro2 = ""; + private String idTipoReg; + private Date fec_actual; + private String codCentroControl; + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + ltiporeg = CatalogDetailController.find("TIPOREGISTRO", "DECINC"); + this.lestadosArma = CatalogDetailController.find("ESTADOARMA"); + //tipo de Fabricacion Arma + this.ltipoFabArma = CatalogDetailController.find("TIPOFABRICACION"); + this.lcentroControl = CentroControlArmasController.findAll(); + this.responsableCentroControl = new TcustPersonDetail(); +// this.tsafeUserDetailUsuario = new TsafeUserDetail(); + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + //this.obtenerResponsableCentroControl(); + this.idTipoReg = ""; + this.codCentroControl = ""; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if (tcustPersonAddres == null) { + return null; + } + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl() { + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + } + + /** + * Obtiene el reporte de Tipo de Fabricacion de las Armas + */ + public void reporteCompaniaInscrita() { + try { + String gradoUsuario = ""; + String path = "armas/reports/reporteCompaniaInscrita"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename = "reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + String format = "pdf"; + + try { + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public void reporteCompaniaInscritaXls() { + try { + String gradoUsuario = ""; + String path = "armas/reports/reporteCompaniaInscrita"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename = "reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + +// } + String format = "xls"; + + try { + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + private String obtenerTipoFabArmaSeleccionada() { + StringBuilder filtro = new StringBuilder(); + StringBuilder armaSel = new StringBuilder(); + for (String tipos : tipoFabArmaSeleccionada) { + armaSel.append("'"); + armaSel.append(tipos); + armaSel.append("',"); + } + + filtro.append(" AND A.TIPOFABRICACION IN ("); + filtro.append(armaSel.substring(0, armaSel.length() - 1)); + filtro.append(")"); + LOGGER.info("el filtro obtenido tipo Arma es el siguiente::" + filtro); + return filtro.toString(); + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public String getIdTipoReg() { + return idTipoReg; + } + + public void setIdTipoReg(String idTipoReg) { + this.idTipoReg = idTipoReg; + } + + public List getLtiporeg() { + return ltiporeg; + } + + public void setLtiporeg(List ltiporeg) { + this.ltiporeg = ltiporeg; + } + + public PersonDetailController getPersonDetailController() { + return personDetailController; + } + + public void setPersonDetailController( + PersonDetailController personDetailController) { + this.personDetailController = personDetailController; + } + + public CentroControlArmasController getCentroControlController() { + return centroControlController; + } + + public void setCentroControlController( + CentroControlArmasController centroControlController) { + this.centroControlController = centroControlController; + } + + public List getLcentroControl() { + return lcentroControl; + } + + public void setLcentroControl(List lcentroControl) { + this.lcentroControl = lcentroControl; + } + + public String getCodCentroControl() { + return codCentroControl; + } + + public void setCodCentroControl(String codCentroControl) { + this.codCentroControl = codCentroControl; + } + + public List getLestadosArma() { + return lestadosArma; + } + + public void setLestadosArma(List lestadosArma) { + this.lestadosArma = lestadosArma; + } + + public List getEstadosSeleccionados() { + return estadosSeleccionados; + } + + public void setEstadosSeleccionados(List estadosSeleccionados) { + this.estadosSeleccionados = estadosSeleccionados; + } + + public List getLtipoFabArma() { + return ltipoFabArma; + } + + public void setLtipoFabArma(List ltipoFabArma) { + this.ltipoFabArma = ltipoFabArma; + } + + public List getTipoFabArmaSeleccionada() { + return tipoFabArmaSeleccionada; + } + + public void setTipoFabArmaSeleccionada(List tipoFabArmaSeleccionada) { + this.tipoFabArmaSeleccionada = tipoFabArmaSeleccionada; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteCompaniasCCentrol.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteCompaniasCCentrol.java new file mode 100644 index 0000000..470bdbc --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteCompaniasCCentrol.java @@ -0,0 +1,404 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * @author usermaia2 Clase Controladora la cual genera el reporte de + * trámite por centro de control + */ +@ManagedBean +@ViewScoped +public class ReporteCompaniasCCentrol extends AbstractController { + + public ReporteCompaniasCCentrol() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController personDetailController; + + @ManagedProperty(value = "#{centroControlController}") + private CentroControlArmasController centroControlController; + @ManagedProperty(value = "#{logincontroller}") + private LoginController logincontroller; + + private TcustPersonDetail customerperson; + private TsafeUserDetail userDetail; + private TcustPersonDetail responsableCentroControl = null; + private TsafeUserDetail tsafeUserDetailUsuario = null; + private TarmCentroControl centroControl = new TarmCentroControl(); + private List lcentroControl = null; + private List ltiporeg = null; + private List lorgcontrol = null; + private String institucionCentroControl = ""; + private Date fechainicial; + private Date fechafinal; + private String filtro = ""; + private String filtro2 = ""; + private String idTipoReg; + private Date fec_actual; + private String codCentroControl; + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + ltiporeg = CatalogDetailController.find("TIPOREGISTRO", "DECINC"); + this.lorgcontrol = CatalogDetailController.find("INSTITUCION"); + this.lcentroControl = CentroControlArmasController.findAll(); + this.responsableCentroControl = new TcustPersonDetail(); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + //this.obtenerResponsableCentroControl(); + this.idTipoReg = ""; + this.codCentroControl = ""; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if (tcustPersonAddres == null) { + return null; + } + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl() { + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + @Override + protected void querydatabase() { + + } + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + } + + /** + * Obtiene el reporte de Ficha de Armas + */ + public void reporteTramitesCentro() { + try { + String gradoUsuario = ""; + String path = "armas/reports/reporteCompaniasCControl"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename = "reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + parameters.put("centroControl", this.codCentroControl); + + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + //fechas inicial y final que vienen desde el controlador +// SimpleDateFormat df=new SimpleDateFormat("dd/MM/yyyy"); +// parameters.put("fechainicial", df.format(this.fechainicial)); +// parameters.put("fechafinal", df.format(this.fechafinal)); +// if(this.idTipoReg.equals("DECO") && this.idTipoReg!=null){ +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else if (this.idTipoReg.equals("INCA") && this.idTipoReg!=null) { +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else { +// parameters.put("filtro", ""); +// } + if (this.codCentroControl != null && !this.codCentroControl.equals("TODOS")) { + parameters.put("centroControl", this.codCentroControl); + } else { + parameters.put("centroControl", ""); + } + + String format = "pdf"; + + try { + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public void reporteTramitesCentroXls() { + try { + String gradoUsuario = ""; + String path = "armas/reports/reporteCompaniasCControl"; + String filename = "reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + parameters.put("centroControl", this.codCentroControl); + + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + if (this.codCentroControl != null && !this.codCentroControl.equals("TODOS")) { + parameters.put("centroControl", this.codCentroControl); + } else { + parameters.put("centroControl", ""); + } + + String format = "xls"; + + try { + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public String getIdTipoReg() { + return idTipoReg; + } + + public void setIdTipoReg(String idTipoReg) { + this.idTipoReg = idTipoReg; + } + + public List getLtiporeg() { + return ltiporeg; + } + + public void setLtiporeg(List ltiporeg) { + this.ltiporeg = ltiporeg; + } + + public PersonDetailController getPersonDetailController() { + return personDetailController; + } + + public void setPersonDetailController( + PersonDetailController personDetailController) { + this.personDetailController = personDetailController; + } + + public CentroControlArmasController getCentroControlController() { + return centroControlController; + } + + public void setCentroControlController( + CentroControlArmasController centroControlController) { + this.centroControlController = centroControlController; + } + + public List getLorgcontrol() { + return lorgcontrol; + } + + public void setLorgcontrol(List lorgcontrol) { + this.lorgcontrol = lorgcontrol; + } + + public List getLcentroControl() { + return lcentroControl; + } + + public void setLcentroControl(List lcentroControl) { + this.lcentroControl = lcentroControl; + } + + public String getCodCentroControl() { + return codCentroControl; + } + + public void setCodCentroControl(String codCentroControl) { + this.codCentroControl = codCentroControl; + } + + public LoginController getLogincontroller() { + return logincontroller; + } + + public void setLogincontroller(LoginController logincontroller) { + this.logincontroller = logincontroller; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteDecomisoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteDecomisoController.java new file mode 100644 index 0000000..692ff4f --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteDecomisoController.java @@ -0,0 +1,349 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.eclipse.jdt.core.dom.ThisExpression; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * @author DLO Clase Controladora la cual genera el reporte de trámite + * por centro de control + */ +@ManagedBean +@ViewScoped +public class ReporteDecomisoController extends AbstractController { + + public ReporteDecomisoController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController personDetailController; + + @ManagedProperty(value = "#{centroControlController}") + private CentroControlArmasController centroControlController; + + private TcustPersonDetail customerperson; + private TsafeUserDetail userDetail; + private TcustPersonDetail responsableCentroControl = null; + private TsafeUserDetail tsafeUserDetailUsuario = null; + private TarmCentroControl centroControl = new TarmCentroControl(); + private List ltiporeg = null; + private List lorgcontrol = null; + private String institucionCentroControl = ""; + private Date fechainicial; + private Date fechafinal; + private String filtro = ""; + private String filtro2 = ""; + private String idTipoReg; + private Date fec_actual; + private String idOrgControl; + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + ltiporeg = CatalogDetailController.find("TIPOREGISTRO", "DECINC"); + this.lorgcontrol = CatalogDetailController.find("INSTITUCION"); + this.responsableCentroControl = new TcustPersonDetail(); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + //this.obtenerResponsableCentroControl(); + this.idTipoReg = ""; + this.idOrgControl = ""; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if (tcustPersonAddres == null) { + return null; + } + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl() { + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + @Override + protected void querydatabase() { + + } + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + } + + /** + * Obtiene el reporte de Ficha de Armas + */ + public void reporteTramitesCentro() { + try { + if (this.fechainicial.getTime() > this.fechafinal.getTime()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_fechafinal")); + return; + } + String gradoUsuario = ""; + String path = "armas/reports/reporteDecomiso"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename = "reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + parameters.put("centroControl", this.obtenerCentroControl()); + + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + //fechas inicial y final que vienen desde el controlador + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fechainicial", df.format(this.fechainicial)); + parameters.put("fechafinal", df.format(this.fechafinal)); + + if (this.idTipoReg.equals("DECO") && this.idTipoReg != null) { + this.filtro = " and d.tipoproceso = '" + this.idTipoReg + "' "; + parameters.put("filtro", this.filtro); + } else if (this.idTipoReg.equals("INCA") && this.idTipoReg != null) { + this.filtro = " and d.tipoproceso = '" + this.idTipoReg + "' "; + parameters.put("filtro", this.filtro); + } else { + parameters.put("filtro", ""); + } + + if (this.idOrgControl != null && !this.idOrgControl.equals("TODOS")) { + this.filtro2 = " and cc.institucion = '" + this.idOrgControl + "' "; + parameters.put("filtro2", this.filtro2); + } else { + parameters.put("filtro2", ""); + } + + String format = "xlsx"; + + try { + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public String getIdTipoReg() { + return idTipoReg; + } + + public void setIdTipoReg(String idTipoReg) { + this.idTipoReg = idTipoReg; + } + + public List getLtiporeg() { + return ltiporeg; + } + + public void setLtiporeg(List ltiporeg) { + this.ltiporeg = ltiporeg; + } + + public PersonDetailController getPersonDetailController() { + return personDetailController; + } + + public void setPersonDetailController( + PersonDetailController personDetailController) { + this.personDetailController = personDetailController; + } + + public CentroControlArmasController getCentroControlController() { + return centroControlController; + } + + public void setCentroControlController( + CentroControlArmasController centroControlController) { + this.centroControlController = centroControlController; + } + + public List getLorgcontrol() { + return lorgcontrol; + } + + public void setLorgcontrol(List lorgcontrol) { + this.lorgcontrol = lorgcontrol; + } + + public String getIdOrgControl() { + return idOrgControl; + } + + public void setIdOrgControl(String idOrgControl) { + this.idOrgControl = idOrgControl; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteImportacionProduccionController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteImportacionProduccionController.java new file mode 100644 index 0000000..95648b6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteImportacionProduccionController.java @@ -0,0 +1,340 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.eclipse.jdt.core.dom.ThisExpression; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * @author DLO Clase Controladora la cual genera el reporte de trámite + * por centro de control + */ +@ManagedBean +@ViewScoped +public class ReporteImportacionProduccionController extends AbstractController { + + public ReporteImportacionProduccionController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController personDetailController; + + @ManagedProperty(value = "#{centroControlController}") + private CentroControlArmasController centroControlController; + + private TcustPersonDetail customerperson; + private TsafeUserDetail userDetail; + private TcustPersonDetail responsableCentroControl = null; + private TsafeUserDetail tsafeUserDetailUsuario = null; + private TarmCentroControl centroControl = new TarmCentroControl(); + private List lcentros = null; + private String institucionCentroControl = ""; + private Date fechainicial; + private Date fechafinal; + private String filtro = ""; + private String idRegistro; + private String estado; + private Date fec_actual; + private String tituloRep; + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + lcentros = CatalogDetailController.find("NOMBREINSTITUCION"); + this.responsableCentroControl = new TcustPersonDetail(); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + //this.obtenerResponsableCentroControl(); + this.idRegistro = ""; + this.tituloRep = ""; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if (tcustPersonAddres != null && tcustPersonAddres.getProvincecode() != null) { + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } else { + return ""; + } + + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl() { + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + @Override + protected void querydatabase() { + + } + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + } + + /** + * Obtiene el reporte de Ficha de Armas + */ + public void reporteTramitesCentro() { + try { + if (this.fechainicial.getTime() > this.fechafinal.getTime()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_fechafinal")); + return; + } + String gradoUsuario = ""; + String path = "armas/reports/reporteImportacionProduccion"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename = "reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + parameters.put("centroControl", this.obtenerCentroControl()); + + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + //usuario + parameters.put("usuario", customerperson.getName()); + + //fechas inicial y final que vienen desde el controlador + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fechainicial", df.format(this.fechainicial)); + parameters.put("fechafinal", df.format(this.fechafinal)); + + if (this.idRegistro.equals("IMP") && this.idRegistro != null) { + this.filtro = " and ra.tiporegistro = '" + this.idRegistro + "' "; + parameters.put("filtro", this.filtro); + this.tituloRep = "REGISTRO DE IMPORTACIONES"; + parameters.put("titulo", this.tituloRep); + } else if (this.idRegistro.equals("PRO") && this.idRegistro != null) { + this.filtro = " and ra.tiporegistro = '" + this.idRegistro + "' "; + parameters.put("filtro", this.filtro); + this.tituloRep = "REGISTRO DE PRODUCCI\u00d3N"; + parameters.put("titulo", this.tituloRep); + } else { + parameters.put("filtro", ""); + this.tituloRep = "REGISTRO DE IMPORTACIONES Y PRODUCCI\u00d3N"; + parameters.put("titulo", this.tituloRep); + } + + String format = "xlsx"; + + try { + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public String getIdRegistro() { + return idRegistro; + } + + public void setIdRegistro(String idRegistro) { + this.idRegistro = idRegistro; + } + + public List getLcentros() { + return lcentros; + } + + public void setLcentros(List lcentros) { + this.lcentros = lcentros; + } + + public PersonDetailController getPersonDetailController() { + return personDetailController; + } + + public void setPersonDetailController( + PersonDetailController personDetailController) { + this.personDetailController = personDetailController; + } + + public CentroControlArmasController getCentroControlController() { + return centroControlController; + } + + public void setCentroControlController( + CentroControlArmasController centroControlController) { + this.centroControlController = centroControlController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteNumArmasEstadoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteNumArmasEstadoController.java new file mode 100644 index 0000000..d7f1d75 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteNumArmasEstadoController.java @@ -0,0 +1,411 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.eclipse.jdt.core.dom.ThisExpression; +import org.jboss.logging.Logger; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * @author usermaia2 Clase Controladora la cual genera el reporte de + * trámite por centro de control + */ +@ManagedBean +@ViewScoped +public class ReporteNumArmasEstadoController extends AbstractController { + + private final static Logger LOGGER = Logger.getLogger(ReporteNumArmasEstadoController.class); + + public ReporteNumArmasEstadoController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController personDetailController; + + @ManagedProperty(value = "#{centroControlController}") + private CentroControlArmasController centroControlController; + + private TcustPersonDetail customerperson; + private TsafeUserDetail userDetail; + private TcustPersonDetail responsableCentroControl = null; + private TsafeUserDetail tsafeUserDetailUsuario = null; + private TarmCentroControl centroControl = new TarmCentroControl(); + private List lcentroControl = null; + private List ltiporeg = null; + private List lestadosArma = null; + private List estadosSeleccionados = null; + private String institucionCentroControl = ""; + private Date fechainicial; + private Date fechafinal; + private String filtro = ""; + private String filtro2 = ""; + private String idTipoReg; + private Date fec_actual; + private String codCentroControl; + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + ltiporeg = CatalogDetailController.find("TIPOREGISTRO", "DECINC"); + this.lestadosArma = CatalogDetailController.find("ESTADOARMA"); + this.lcentroControl = CentroControlArmasController.findAll(); + this.responsableCentroControl = new TcustPersonDetail(); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + //this.obtenerResponsableCentroControl(); + this.idTipoReg = ""; + this.codCentroControl = ""; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if (tcustPersonAddres == null) { + return null; + } + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl() { + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + @Override + protected void querydatabase() { + + } + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + } + + /** + * Obtiene el reporte de Ficha de Armas + */ + public void reporteNumArmas() { + try { + String gradoUsuario = ""; + String path = "armas/reports/reporteArmasCompania"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename = "reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + //fechas inicial y final que vienen desde el controlador +// SimpleDateFormat df=new SimpleDateFormat("dd/MM/yyyy"); +// parameters.put("fechainicial", df.format(this.fechainicial)); +// parameters.put("fechafinal", df.format(this.fechafinal)); +// if(this.idTipoReg.equals("DECO") && this.idTipoReg!=null){ +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else if (this.idTipoReg.equals("INCA") && this.idTipoReg!=null) { +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else { + parameters.put("filtroEstados", obtenerEstadosSeleccionados()); +// } + + String format = "pdf"; + + try { + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public void reporteNumArmasXls() { + try { + String gradoUsuario = ""; + String path = "armas/reports/reporteArmasCompania"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename = "reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + parameters.put("filtroEstados", obtenerEstadosSeleccionados()); + + String format = "xls"; + + try { + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + private String obtenerEstadosSeleccionados() { + StringBuilder filtro = new StringBuilder(); + StringBuilder estadosSel = new StringBuilder(); + for (String estado : estadosSeleccionados) { + estadosSel.append("'"); + estadosSel.append(estado); + estadosSel.append("',"); + } + filtro.append(" AND A.ESTADO IN ("); + filtro.append(estadosSel.substring(0, estadosSel.length() - 1)); + filtro.append(")"); + LOGGER.info("el filtro obtenido es el siguiente::" + filtro); + return filtro.toString(); + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public String getIdTipoReg() { + return idTipoReg; + } + + public void setIdTipoReg(String idTipoReg) { + this.idTipoReg = idTipoReg; + } + + public List getLtiporeg() { + return ltiporeg; + } + + public void setLtiporeg(List ltiporeg) { + this.ltiporeg = ltiporeg; + } + + public PersonDetailController getPersonDetailController() { + return personDetailController; + } + + public void setPersonDetailController( + PersonDetailController personDetailController) { + this.personDetailController = personDetailController; + } + + public CentroControlArmasController getCentroControlController() { + return centroControlController; + } + + public void setCentroControlController( + CentroControlArmasController centroControlController) { + this.centroControlController = centroControlController; + } + + public List getLcentroControl() { + return lcentroControl; + } + + public void setLcentroControl(List lcentroControl) { + this.lcentroControl = lcentroControl; + } + + public String getCodCentroControl() { + return codCentroControl; + } + + public void setCodCentroControl(String codCentroControl) { + this.codCentroControl = codCentroControl; + } + + public List getLestadosArma() { + return lestadosArma; + } + + public void setLestadosArma(List lestadosArma) { + this.lestadosArma = lestadosArma; + } + + public List getEstadosSeleccionados() { + return estadosSeleccionados; + } + + public void setEstadosSeleccionados(List estadosSeleccionados) { + this.estadosSeleccionados = estadosSeleccionados; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteNumPermisosController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteNumPermisosController.java new file mode 100644 index 0000000..9f88d7a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteNumPermisosController.java @@ -0,0 +1,454 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.eclipse.jdt.core.dom.ThisExpression; +import org.jboss.logging.Logger; +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * @author usermaia2 Clase Controladora la cual genera el reporte de + * trámite por centro de control + */ +@ManagedBean +@ViewScoped +public class ReporteNumPermisosController extends AbstractController { + + private final static Logger LOGGER = Logger.getLogger(ReporteNumPermisosController.class); + + public ReporteNumPermisosController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController personDetailController; + + @ManagedProperty(value = "#{centroControlController}") + private CentroControlArmasController centroControlController; + + private TcustPersonDetail customerperson; + private TsafeUserDetail userDetail; + private TcustPersonDetail responsableCentroControl = null; + private TsafeUserDetail tsafeUserDetailUsuario = null; + private TarmCentroControl centroControl = new TarmCentroControl(); + private List lcentroControl = null; + private List ltiporeg = null; + private List lestadosArma = null; + private List estadosSeleccionados = null; + private String institucionCentroControl = ""; + private Date fechainicial; + private Date fechafinal; + private String filtro = ""; + private String filtro2 = ""; + private String idTipoReg; + private Date fec_actual; + private String codCentroControl; + //Datos para buscar persona + private String razonSocial; + + private String numeroDocumento; + + private String filtroPersona; + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + ltiporeg = CatalogDetailController.find("TIPOREGISTRO", "DECINC"); + this.lestadosArma = CatalogDetailController.find("ESTADOARMA"); + this.lcentroControl = CentroControlArmasController.findAll(); + this.responsableCentroControl = new TcustPersonDetail(); +// this.tsafeUserDetailUsuario = new TsafeUserDetail(); + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + //this.obtenerResponsableCentroControl(); + this.idTipoReg = ""; + this.codCentroControl = ""; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if (tcustPersonAddres == null) { + return null; + } + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl() { + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + @Override + protected void querydatabase() { + + } + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + } + + /** + * Obtiene el reporte de Ficha de Armas + */ + public void reporteTotalPermisos() { + try { + String gradoUsuario = ""; + String path = "armas/reports/reporteNumeroPermisos"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename = "reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + parameters.put("filtroPersona", obtenerPersonaSeleccionada()); + String format = "pdf"; + + try { + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public void reporteTotalPermisosXls() { + try { + String gradoUsuario = ""; + String path = "armas/reports/reporteNumeroPermisos"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename = "reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + parameters.put("filtroPersona", obtenerPersonaSeleccionada()); + String format = "xls"; + + try { + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public String getIdTipoReg() { + return idTipoReg; + } + + public void setIdTipoReg(String idTipoReg) { + this.idTipoReg = idTipoReg; + } + + public List getLtiporeg() { + return ltiporeg; + } + + public void setLtiporeg(List ltiporeg) { + this.ltiporeg = ltiporeg; + } + + public PersonDetailController getPersonDetailController() { + return personDetailController; + } + + public void setPersonDetailController( + PersonDetailController personDetailController) { + this.personDetailController = personDetailController; + } + + public CentroControlArmasController getCentroControlController() { + return centroControlController; + } + + public void setCentroControlController( + CentroControlArmasController centroControlController) { + this.centroControlController = centroControlController; + } + + public List getLcentroControl() { + return lcentroControl; + } + + public void setLcentroControl(List lcentroControl) { + this.lcentroControl = lcentroControl; + } + + public String getCodCentroControl() { + return codCentroControl; + } + + public void setCodCentroControl(String codCentroControl) { + this.codCentroControl = codCentroControl; + } + + public List getLestadosArma() { + return lestadosArma; + } + + public void setLestadosArma(List lestadosArma) { + this.lestadosArma = lestadosArma; + } + + public List getEstadosSeleccionados() { + return estadosSeleccionados; + } + + public void setEstadosSeleccionados(List estadosSeleccionados) { + this.estadosSeleccionados = estadosSeleccionados; + } + +//BUSQUEDA DE PERSONA + public String getRazonSocial() { + return razonSocial; + } + + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public String getFiltroPersona() { + return filtroPersona; + } + + public void setFiltroPersona(String filtroPersona) { + this.filtroPersona = filtroPersona; + } + + /** + * Abre el lov de persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Maneja la respuesta del Lov de Personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + filtroPersona = ""; + TcustPersonDetail personaDetailSelecionada = (TcustPersonDetail) event.getObject(); + razonSocial = personaDetailSelecionada.getName(); + numeroDocumento = personaDetailSelecionada.getIdentification(); + filtroPersona = personaDetailSelecionada.getPk().getPersoncode().toString(); + LOGGER.info("parametro seleccionado " + filtroPersona); + //this.setLrecord(new ArrayList()); + FacesContext context = FacesContext.getCurrentInstance(); + context.addMessage(null, new FacesMessage("RECUERDE", MsgControlArmas.getProperty("msg_recuerdeClickSeleccionarArmas"))); + + } + + private String obtenerPersonaSeleccionada() { + StringBuilder filtro = new StringBuilder(); + filtro.append(" AND personadetalle.identification IN ('"); + filtro.append(numeroDocumento); + filtro.append("')"); + LOGGER.info("el filtro obtenido de persona es el siguiente::" + filtro); + return filtro.toString(); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReportePermisosAutorizacionesCconController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReportePermisosAutorizacionesCconController.java new file mode 100644 index 0000000..0dfac45 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReportePermisosAutorizacionesCconController.java @@ -0,0 +1,124 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * + * @author David Cruz + * + */ +@ManagedBean +@ViewScoped +public class ReportePermisosAutorizacionesCconController extends AbstractController { + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + private TsafeUserDetail userDetail; + private TgeneParameters paramDiasCaducidad; + private String centroControl = ""; + private List lcentroControl; + + public ReportePermisosAutorizacionesCconController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + public void init() { + beanalias = "REPORTE"; + lrecord = new ArrayList<>(); + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + paramDiasCaducidad = ParametersController.find("DIASCADUCIDADCERT", "1"); + lcentroControl = CentroControlArmasController.findAll(); + } + + private static final long serialVersionUID = 1L; + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + } + + public void generarReporte() { + String path = "armas/reports/reportePermisosAutorizacionesxSuspCcon"; + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + } else { + nombreUsuario = ""; + } +// TarmCentroControl ccentroControl= CentroControlArmasController.findPorCodigo(centroControl); +// String institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo( ccentroControl.getNombreinstitucion(), ccentroControl.getNombreinstitucioncodigo()).getDescription(); + SimpleDateFormat fechatxt = new SimpleDateFormat("dd/MM/yyyy"); + Date fechainicial = Calendar.getInstance().getTime(); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(fechainicial); + calendar.add(Calendar.DATE, (paramDiasCaducidad != null && paramDiasCaducidad.getNumbervalue() != null) ? paramDiasCaducidad.getNumbervalue().intValue() : 0); + Date fechafinal = calendar.getTime(); + parameters.put("usuario", nombreUsuario); +// parameters.put("centroControl", centroControl); +// parameters.put("nombrecentro", institucionCentroControl); + parameters.put("fechainicio", fechatxt.format(fechainicial)); + parameters.put("fechafin", fechatxt.format(fechafinal)); + String format = "xlsx"; + String filename = "permisosautorizacionesxsusp"; + //Fecha actual + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getCentroControl() { + return centroControl; + } + + public void setCentroControl(String centroControl) { + this.centroControl = centroControl; + } + + public List getLcentroControl() { + return lcentroControl; + } + + public void setLcentroControl(List lcentroControl) { + this.lcentroControl = lcentroControl; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReportePermisosAutorizacionesSuspController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReportePermisosAutorizacionesSuspController.java new file mode 100644 index 0000000..d2a2a38 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReportePermisosAutorizacionesSuspController.java @@ -0,0 +1,163 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * @author Andres Cevallos Clase Controladora la cual genera el reporte de armas + */ +@ManagedBean +@ViewScoped +public class ReportePermisosAutorizacionesSuspController extends AbstractController { + + public ReportePermisosAutorizacionesSuspController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + private TsafeUserDetail userDetail; + private String institucionCentroControl = ""; + private TarmCentroControl centroControl = new TarmCentroControl(); + private Date fechainicial; + private Date fechafinal; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + obtenerCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que se debe ejecutar cuando es una transaccion de tipo verificar + * armas + * + * @throws Exception + */ + private void obtenerCentroControl() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + @Override + protected void querydatabase() { + } + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + } + + public void generarReporte() { + if (fechainicial.getTime() > fechafinal.getTime()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_fechafinal")); + return; + } + String path = "armas/reports/reportePermisosAutorizacionesSusp"; + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + } else { + nombreUsuario = ""; + } + SimpleDateFormat fechatxt = new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fechainicio", fechatxt.format(fechainicial)); + parameters.put("fechafin", fechatxt.format(fechafinal)); + parameters.put("usuario", nombreUsuario); + parameters.put("unidadmilitar", institucionCentroControl); + String format = "xlsx"; + String filename = "permisosautorizacionessusp"; + //Fecha actual + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteTipoArma.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteTipoArma.java new file mode 100644 index 0000000..8b67c2c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteTipoArma.java @@ -0,0 +1,461 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.apache.log4j.Logger; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@ManagedBean +@ViewScoped +public class ReporteTipoArma extends AbstractController { + + /** + * + */ + public ReporteTipoArma() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private final static Logger LOGGER = Logger.getLogger(ReporteTipoArma.class); + private static final long serialVersionUID = 1L; + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController personDetailController; + + @ManagedProperty(value = "#{centroControlController}") + private CentroControlArmasController centroControlController; + + private TcustPersonDetail customerperson; + private TsafeUserDetail userDetail; + private TcustPersonDetail responsableCentroControl = null; + private TsafeUserDetail tsafeUserDetailUsuario = null; + private TarmCentroControl centroControl = new TarmCentroControl(); + private List lcentroControl = null; + private List ltiporeg = null; + private List lestadosArma = null; + private List ltipoArma = null; + private List estadosSeleccionados = null; + //Tipo de Arma Seleccionada + private List tipoArmaSeleccionada = null; + + private String institucionCentroControl = ""; + private Date fechainicial; + private Date fechafinal; + private String filtro = ""; + private String filtro2 = ""; + private String idTipoReg; + private Date fec_actual; + private String codCentroControl; + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + ltiporeg = CatalogDetailController.find("TIPOREGISTRO", "DECINC"); + this.lestadosArma = CatalogDetailController.find("ESTADOARMA"); + //tipo de Arma + this.ltipoArma = CatalogDetailController.find("TIPOARMAEXPLOSIVO", "0010000001"); + this.lcentroControl = CentroControlArmasController.findAll(); + this.responsableCentroControl = new TcustPersonDetail(); +// this.tsafeUserDetailUsuario = new TsafeUserDetail(); + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + //this.obtenerResponsableCentroControl(); + this.idTipoReg = ""; + this.codCentroControl = ""; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if (tcustPersonAddres == null) { + return null; + } + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl() { + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + } + + /** + * Obtiene el reporte de Ficha de Armas + */ + public void reporteTotalArmaCompania() { + try { + String gradoUsuario = ""; + String path = "armas/reports/reporteTipoArmasCompania"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename = "reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + //fechas inicial y final que vienen desde el controlador +// SimpleDateFormat df=new SimpleDateFormat("dd/MM/yyyy"); +// parameters.put("fechainicial", df.format(this.fechainicial)); +// parameters.put("fechafinal", df.format(this.fechafinal)); +// if(this.idTipoReg.equals("DECO") && this.idTipoReg!=null){ +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else if (this.idTipoReg.equals("INCA") && this.idTipoReg!=null) { +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else { + parameters.put("filtroEstados", obtenerEstadosSeleccionados()); + + parameters.put("filtroTipos", obtenerTipoArmaSeleccionada()); +// } + + String format = "pdf"; + + try { + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public void reporteTotalArmaCompaniaXls() { + try { + String gradoUsuario = ""; + String path = "armas/reports/reporteTipoArmasCompania"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename = "reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + //fechas inicial y final que vienen desde el controlador +// SimpleDateFormat df=new SimpleDateFormat("dd/MM/yyyy"); +// parameters.put("fechainicial", df.format(this.fechainicial)); +// parameters.put("fechafinal", df.format(this.fechafinal)); +// if(this.idTipoReg.equals("DECO") && this.idTipoReg!=null){ +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else if (this.idTipoReg.equals("INCA") && this.idTipoReg!=null) { +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else { + parameters.put("filtroEstados", obtenerEstadosSeleccionados()); + + parameters.put("filtroTipos", obtenerTipoArmaSeleccionada()); +// } + + String format = "xls"; + + try { + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + private String obtenerEstadosSeleccionados() { + StringBuilder filtro = new StringBuilder(); + StringBuilder estadosSel = new StringBuilder(); + for (String estado : estadosSeleccionados) { + estadosSel.append("'"); + estadosSel.append(estado); + estadosSel.append("',"); + } + filtro.append(" AND A.ESTADO IN ("); + filtro.append(estadosSel.substring(0, estadosSel.length() - 1)); + filtro.append(")"); + LOGGER.info("el filtro obtenido es el siguiente::" + filtro); + return filtro.toString(); + } + + private String obtenerTipoArmaSeleccionada() { + StringBuilder filtro = new StringBuilder(); + StringBuilder armaSel = new StringBuilder(); + for (String tipos : tipoArmaSeleccionada) { + armaSel.append("'"); + armaSel.append(tipos); + armaSel.append("',"); + } + + filtro.append(" AND T.CATALOG IN ("); + filtro.append(armaSel.substring(0, armaSel.length() - 1)); + filtro.append(")"); + LOGGER.info("el filtro obtenido tipo Arma es el siguiente::" + filtro); + return filtro.toString(); + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public String getIdTipoReg() { + return idTipoReg; + } + + public void setIdTipoReg(String idTipoReg) { + this.idTipoReg = idTipoReg; + } + + public List getLtiporeg() { + return ltiporeg; + } + + public void setLtiporeg(List ltiporeg) { + this.ltiporeg = ltiporeg; + } + + public PersonDetailController getPersonDetailController() { + return personDetailController; + } + + public void setPersonDetailController( + PersonDetailController personDetailController) { + this.personDetailController = personDetailController; + } + + public CentroControlArmasController getCentroControlController() { + return centroControlController; + } + + public void setCentroControlController( + CentroControlArmasController centroControlController) { + this.centroControlController = centroControlController; + } + + public List getLcentroControl() { + return lcentroControl; + } + + public void setLcentroControl(List lcentroControl) { + this.lcentroControl = lcentroControl; + } + + public String getCodCentroControl() { + return codCentroControl; + } + + public void setCodCentroControl(String codCentroControl) { + this.codCentroControl = codCentroControl; + } + + public List getLestadosArma() { + return lestadosArma; + } + + public void setLestadosArma(List lestadosArma) { + this.lestadosArma = lestadosArma; + } + + public List getEstadosSeleccionados() { + return estadosSeleccionados; + } + + public void setEstadosSeleccionados(List estadosSeleccionados) { + this.estadosSeleccionados = estadosSeleccionados; + } + + public List getLtipoArma() { + return ltipoArma; + } + + public void setLtipoArma(List ltipoArma) { + this.ltipoArma = ltipoArma; + } + + public List getTipoArmaSeleccionada() { + return tipoArmaSeleccionada; + } + + public void setTipoArmaSeleccionada(List tipoArmaSeleccionada) { + this.tipoArmaSeleccionada = tipoArmaSeleccionada; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteTipoArmasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteTipoArmasController.java new file mode 100644 index 0000000..8510a6a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteTipoArmasController.java @@ -0,0 +1,235 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@ManagedBean(name = "reporteTipoArmasController") +@ViewScoped +public class ReporteTipoArmasController extends AbstractController { + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + private List lestados; + private TsafeUserDetail userDetail; + /** + * INSTITUCION A LA QUE PERTENECE + */ + private String institucionCentroControl; + /** + * VARIABLES PARA EL REPORTE + */ + private Date fechainicial; + private Date fechafinal; + private String estado; + private TcustPersonDetail customerperson; + + @PostConstruct + private void postconstruct() { + this.init(); + } + + public ReporteTipoArmasController() throws Exception { + super(AbstractDataTransport.class); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTETIPOARMAS"; + lestados = CatalogDetailController.find("ESTADOARMA"); + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + estado = ""; + obtenerCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que se debe ejecutar cuando es una transaccion de tipo verificar + * armas + * + * @throws Exception + */ + private void obtenerCentroControl() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + + } + + @Override + protected void querydatabase() { + + } + + /** + * Abre el Lov de Persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Carga los datos que se devuelven en el Lov de personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + setCustomerperson((TcustPersonDetail) event.getObject()); + + } + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + } + + public void generarReporte() { + if (fechainicial.getTime() > fechafinal.getTime()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_fechafinal")); + return; + } + String filtro = " "; + String path = "armas/reports/reporteTipoArmas"; + if (customerperson != null) { + filtro = " and tarma.cregistro in " + + " (select regarma.cregistro from tarmregistroarmas regarma where regarma.personcode='" + customerperson.getPk().getPersoncode() + "')"; + } + if (estado != null && !estado.equals("")) { + if (estado.equals("APTA")) { + filtro += " and tarma.carma in (select carma from tarmarmapruebas p " + + " where p.carmaprueba=(select max(prue.carmaprueba)" + + " from tarmarmapruebas prue where prue.apruebaevaluacion='Y' and prue.carma in(select codar.carma from tarmarmas codar" + + " where codar.codigoarma =(select ar.codigoarma from tarmarmas ar where carma=tarma.carma) ))) "; + } else { + filtro += " and tarma.estado='" + estado + "' "; + } + } else { + filtro += " and tarma.estado!='VEND' and tarma.estado!='MING' and tarma.estado!='DUPL'"; + } + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + } else { + nombreUsuario = ""; + } + //filtro = "where tarma.personcode='1138'"; + parameters.put("filtro", filtro); + SimpleDateFormat fechatxt = new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fechainicial", fechatxt.format(fechainicial)); + parameters.put("fechafinal", fechatxt.format(fechafinal)); + parameters.put("usuario", nombreUsuario); + parameters.put("unidadmilitar", institucionCentroControl); + String format = "xlsx"; + String filename = MsgControlArmas.getProperty("lbl_nombreexcel"); + //Fecha actual + Calendar fechaActualCldr = Calendar.getInstance(); + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH) + 1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarfecha", fechaActualSB.toString()); + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public List getLestados() { + return lestados; + } + + public void setLestados(List lestados) { + this.lestados = lestados; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteTipoAutorizacionController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteTipoAutorizacionController.java new file mode 100644 index 0000000..f4d3d3b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteTipoAutorizacionController.java @@ -0,0 +1,457 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.apache.log4j.Logger; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@ManagedBean +@ViewScoped +public class ReporteTipoAutorizacionController extends AbstractController { + + /** + * + */ + public ReporteTipoAutorizacionController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private final static Logger LOGGER = Logger.getLogger(ReporteTipoAutorizacionController.class); + private static final long serialVersionUID = 1L; + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController personDetailController; + + @ManagedProperty(value = "#{centroControlController}") + private CentroControlArmasController centroControlController; + + private TcustPersonDetail customerperson; + private TsafeUserDetail userDetail; + private TcustPersonDetail responsableCentroControl = null; + private TsafeUserDetail tsafeUserDetailUsuario = null; + private TarmCentroControl centroControl = new TarmCentroControl(); + private List lcentroControl = null; + private List ltiporeg = null; + private List ltipoAuto = null; + private List ltipoArma = null; + private List tipoAutoSeleccionado = null; + //Tipo de Arma Seleccionada + private List tipoArmaSeleccionada = null; + + private String institucionCentroControl = ""; + private Date fechainicial; + private Date fechafinal; + private String filtro = ""; + private String filtro2 = ""; + private String idTipoReg; + private Date fec_actual; + private String codCentroControl; + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + ltiporeg = CatalogDetailController.find("TIPOREGISTRO", "DECINC"); + this.ltipoAuto = CatalogDetailController.find("TIPOAUTORIZACION"); + //tipo de Arma + this.ltipoArma = CatalogDetailController.find("TIPOARMAEXPLOSIVO", "0010000001"); + this.lcentroControl = CentroControlArmasController.findAll(); + this.responsableCentroControl = new TcustPersonDetail(); +// this.tsafeUserDetailUsuario = new TsafeUserDetail(); + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + //this.obtenerResponsableCentroControl(); + this.idTipoReg = ""; + this.codCentroControl = ""; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if (tcustPersonAddres == null) { + return null; + } + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl() { + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + } + + /** + * Obtiene el reporte de Ficha de Armas + */ + public void reporteTipoAutorizacion() { + try { + String gradoUsuario = ""; + String path = "armas/reports/reporteTipoAutorizacion"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename = "reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + //fechas inicial y final que vienen desde el controlador +// SimpleDateFormat df=new SimpleDateFormat("dd/MM/yyyy"); +// parameters.put("fechainicial", df.format(this.fechainicial)); +// parameters.put("fechafinal", df.format(this.fechafinal)); +// if(this.idTipoReg.equals("DECO") && this.idTipoReg!=null){ +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else if (this.idTipoReg.equals("INCA") && this.idTipoReg!=null) { +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else { + parameters.put("filtroEstados", obtenerEstadosSeleccionados()); + +// } + String format = "pdf"; + + try { + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public void reporteTipoAutorizacionXls() { + try { + String gradoUsuario = ""; + String path = "armas/reports/reporteTipoAutorizacion"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename = "reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + //fechas inicial y final que vienen desde el controlador +// SimpleDateFormat df=new SimpleDateFormat("dd/MM/yyyy"); +// parameters.put("fechainicial", df.format(this.fechainicial)); +// parameters.put("fechafinal", df.format(this.fechafinal)); +// if(this.idTipoReg.equals("DECO") && this.idTipoReg!=null){ +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else if (this.idTipoReg.equals("INCA") && this.idTipoReg!=null) { +// this.filtro = " and d.tipoproceso = '"+this.idTipoReg+"' "; +// parameters.put("filtro", this.filtro); +// }else { + parameters.put("filtroEstados", obtenerEstadosSeleccionados()); + +// } + String format = "xls"; + + try { + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + private String obtenerEstadosSeleccionados() { + StringBuilder filtro = new StringBuilder(); + StringBuilder autorizacionSel = new StringBuilder(); + for (String autorizacion : tipoAutoSeleccionado) { + autorizacionSel.append("'"); + autorizacionSel.append(autorizacion); + autorizacionSel.append("',"); + } + filtro.append(" AND autorizacion.CATALOG IN ("); + filtro.append(autorizacionSel.substring(0, autorizacionSel.length() - 1)); + filtro.append(")"); + LOGGER.info("el filtro obtenido es el siguiente::" + filtro); + return filtro.toString(); + } + + private String obtenerTipoArmaSeleccionada() { + StringBuilder filtro = new StringBuilder(); + StringBuilder armaSel = new StringBuilder(); + for (String tipos : tipoArmaSeleccionada) { + armaSel.append("'"); + armaSel.append(tipos); + armaSel.append("',"); + } + + filtro.append(" AND T.CATALOG IN ("); + filtro.append(armaSel.substring(0, armaSel.length() - 1)); + filtro.append(")"); + LOGGER.info("el filtro obtenido tipo Arma es el siguiente::" + filtro); + return filtro.toString(); + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public String getIdTipoReg() { + return idTipoReg; + } + + public void setIdTipoReg(String idTipoReg) { + this.idTipoReg = idTipoReg; + } + + public List getLtiporeg() { + return ltiporeg; + } + + public void setLtiporeg(List ltiporeg) { + this.ltiporeg = ltiporeg; + } + + public PersonDetailController getPersonDetailController() { + return personDetailController; + } + + public void setPersonDetailController( + PersonDetailController personDetailController) { + this.personDetailController = personDetailController; + } + + public CentroControlArmasController getCentroControlController() { + return centroControlController; + } + + public void setCentroControlController( + CentroControlArmasController centroControlController) { + this.centroControlController = centroControlController; + } + + public List getLcentroControl() { + return lcentroControl; + } + + public void setLcentroControl(List lcentroControl) { + this.lcentroControl = lcentroControl; + } + + public String getCodCentroControl() { + return codCentroControl; + } + + public void setCodCentroControl(String codCentroControl) { + this.codCentroControl = codCentroControl; + } + + public List getLtipoAuto() { + return ltipoAuto; + } + + public void setLtipoAuto(List lestadosArma) { + this.ltipoAuto = lestadosArma; + } + + public List getTipoAutoSeleccionado() { + return tipoAutoSeleccionado; + } + + public void setTipoAutoSeleccionado(List estadosSeleccionados) { + this.tipoAutoSeleccionado = estadosSeleccionados; + } + + public List getLtipoArma() { + return ltipoArma; + } + + public void setLtipoArma(List ltipoArma) { + this.ltipoArma = ltipoArma; + } + + public List getTipoArmaSeleccionada() { + return tipoArmaSeleccionada; + } + + public void setTipoArmaSeleccionada(List tipoArmaSeleccionada) { + this.tipoArmaSeleccionada = tipoArmaSeleccionada; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteTipoFabricacionController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteTipoFabricacionController.java new file mode 100644 index 0000000..bc97789 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteTipoFabricacionController.java @@ -0,0 +1,420 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.apache.log4j.Logger; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@ManagedBean +@ViewScoped +public class ReporteTipoFabricacionController extends AbstractController { + + /** + * + */ + public ReporteTipoFabricacionController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private final static Logger LOGGER = Logger.getLogger(ReporteTipoArma.class); + private static final long serialVersionUID = 1L; + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController personDetailController; + + @ManagedProperty(value = "#{centroControlController}") + private CentroControlArmasController centroControlController; + + private TcustPersonDetail customerperson; + private TsafeUserDetail userDetail; + private TcustPersonDetail responsableCentroControl = null; + private TsafeUserDetail tsafeUserDetailUsuario = null; + private TarmCentroControl centroControl = new TarmCentroControl(); + private List lcentroControl = null; + private List ltiporeg = null; + private List lestadosArma = null; + private List ltipoFabArma = null; + private List estadosSeleccionados = null; + //Tipo de Fabricacion Arma Seleccionada + private List tipoFabArmaSeleccionada = null; + + private String institucionCentroControl = ""; + private Date fechainicial; + private Date fechafinal; + private String filtro = ""; + private String filtro2 = ""; + private String idTipoReg; + private Date fec_actual; + private String codCentroControl; + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + ltiporeg = CatalogDetailController.find("TIPOREGISTRO", "DECINC"); + this.lestadosArma = CatalogDetailController.find("ESTADOARMA"); + //tipo de Fabricacion Arma + this.ltipoFabArma = CatalogDetailController.find("TIPOFABRICACION"); + this.lcentroControl = CentroControlArmasController.findAll(); + this.responsableCentroControl = new TcustPersonDetail(); +// this.tsafeUserDetailUsuario = new TsafeUserDetail(); + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + //this.obtenerResponsableCentroControl(); + this.idTipoReg = ""; + this.codCentroControl = ""; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if (tcustPersonAddres == null) { + return null; + } + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl() { + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + } + + /** + * Obtiene el reporte de Tipo de Fabricacion de las Armas + */ + public void reporteTipoFabricacion() { + try { + String gradoUsuario = ""; + String path = "armas/reports/reporteTipoFabricacion"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename = "reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + parameters.put("filtroTipos", obtenerTipoFabArmaSeleccionada()); +// } + + String format = "pdf"; + + try { + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public void reporteTipoFabricacionXls() { + try { + String gradoUsuario = ""; + String path = "armas/reports/reporteTipoFabricacion"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename = "reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + parameters.put("filtroTipos", obtenerTipoFabArmaSeleccionada()); +// } + + String format = "xls"; + + try { + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + private String obtenerTipoFabArmaSeleccionada() { + StringBuilder filtro = new StringBuilder(); + StringBuilder armaSel = new StringBuilder(); + for (String tipos : tipoFabArmaSeleccionada) { + armaSel.append("'"); + armaSel.append(tipos); + armaSel.append("',"); + } + + filtro.append(" AND A.TIPOFABRICACION IN ("); + filtro.append(armaSel.substring(0, armaSel.length() - 1)); + filtro.append(")"); + LOGGER.info("el filtro obtenido tipo Arma es el siguiente::" + filtro); + return filtro.toString(); + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public String getIdTipoReg() { + return idTipoReg; + } + + public void setIdTipoReg(String idTipoReg) { + this.idTipoReg = idTipoReg; + } + + public List getLtiporeg() { + return ltiporeg; + } + + public void setLtiporeg(List ltiporeg) { + this.ltiporeg = ltiporeg; + } + + public PersonDetailController getPersonDetailController() { + return personDetailController; + } + + public void setPersonDetailController( + PersonDetailController personDetailController) { + this.personDetailController = personDetailController; + } + + public CentroControlArmasController getCentroControlController() { + return centroControlController; + } + + public void setCentroControlController( + CentroControlArmasController centroControlController) { + this.centroControlController = centroControlController; + } + + public List getLcentroControl() { + return lcentroControl; + } + + public void setLcentroControl(List lcentroControl) { + this.lcentroControl = lcentroControl; + } + + public String getCodCentroControl() { + return codCentroControl; + } + + public void setCodCentroControl(String codCentroControl) { + this.codCentroControl = codCentroControl; + } + + public List getLestadosArma() { + return lestadosArma; + } + + public void setLestadosArma(List lestadosArma) { + this.lestadosArma = lestadosArma; + } + + public List getEstadosSeleccionados() { + return estadosSeleccionados; + } + + public void setEstadosSeleccionados(List estadosSeleccionados) { + this.estadosSeleccionados = estadosSeleccionados; + } + + public List getLtipoFabArma() { + return ltipoFabArma; + } + + public void setLtipoFabArma(List ltipoFabArma) { + this.ltipoFabArma = ltipoFabArma; + } + + public List getTipoFabArmaSeleccionada() { + return tipoFabArmaSeleccionada; + } + + public void setTipoFabArmaSeleccionada(List tipoFabArmaSeleccionada) { + this.tipoFabArmaSeleccionada = tipoFabArmaSeleccionada; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteTramiteCentroController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteTramiteCentroController.java new file mode 100644 index 0000000..33e4554 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/ReporteTramiteCentroController.java @@ -0,0 +1,388 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.eclipse.jdt.core.dom.ThisExpression; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * @author DLO Clase Controladora la cual genera el reporte de trámite + * por centro de control + */ +@ManagedBean +@ViewScoped +public class ReporteTramiteCentroController extends AbstractController { + + public ReporteTramiteCentroController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController personDetailController; + + @ManagedProperty(value = "#{centroControlController}") + private CentroControlArmasController centroControlController; + + private TcustPersonDetail customerperson; + private TsafeUserDetail userDetail; + private TcustPersonDetail responsableCentroControl = null; + private TsafeUserDetail tsafeUserDetailUsuario = null; + private TarmCentroControl centroControl = new TarmCentroControl(); + private List lcentros = null; + private List lestados = null; + private String institucionCentroControl = ""; + private Date fechainicial; + private Date fechafinal; + private String filtro = ""; + private String filtro2 = ""; + private String idCentroControl; + private String estado; + private Date fec_actual; + private String estadoDoc; + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTE"; + lcentros = CatalogDetailController.find("NOMBREINSTITUCION"); + this.lestados = CatalogDetailController.find("ESTADODOCUMENTO"); + this.responsableCentroControl = new TcustPersonDetail(); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + //this.obtenerResponsableCentroControl(); + this.idCentroControl = ""; + this.estadoDoc = ""; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if (tcustPersonAddres != null && tcustPersonAddres.getProvincecode() != null) { + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } else { + return ""; + } + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl() { + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + @Override + protected void querydatabase() { + + } + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + + } + + /** + * Obtiene el reporte de Ficha de Armas + */ + public void reporteTramitesCentro() { + try { + if (this.fechainicial.getTime() > this.fechafinal.getTime()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_fechafinal")); + return; + } + String gradoUsuario = ""; + String path = "armas/reports/reporteTremiteXCentro"; + String filename = MsgControlArmas.getProperty("lbl_tramitesXcentro"); + //String filename="reporte"; + + // Datos del centro de control del usuario logueado + institucionCentroControl = obtenerCentroControl(); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("centroControl", institucionCentroControl); + + //Centro de control + parameters.put("centroControl", this.obtenerCentroControl()); + + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + + //fechas inicial y final que vienen desde el controlador + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fechainicial", df.format(this.fechainicial)); + parameters.put("fechafinal", df.format(this.fechafinal)); + + TarmCentroControl centro = null; + if (!this.idCentroControl.toString().equals("TODOS")) { + centro = CentroControlArmasController.findPorCentroControl(this.idCentroControl.toString()); + } +// if(centro == null){ +// MessageHelper.setMessageInfo("EL CENTRO DE CONTROL DE ARMAS SELECCIONADO NO TIENE DATOS A MOSTRAR"); +// return; +// } + + if (centro != null && centro.getPk() != null && this.idCentroControl.toString() != "TODOS") { + this.filtro = " and h.ccentrocontrol = '" + centro.getPk() + "' "; + parameters.put("filtro", this.filtro); + } else { + parameters.put("filtro", ""); + } + + if (this.estadoDoc.equals("APR") && this.estadoDoc != null) { + this.filtro2 = " and h.estado = '" + this.estadoDoc + "' "; + parameters.put("filtro2", this.filtro2); + } else if (this.estadoDoc.equals("CAN") && this.estadoDoc != null) { + this.filtro2 = " and h.estado = '" + this.estadoDoc + "' "; + parameters.put("filtro2", this.filtro2); + } else if (this.estadoDoc.equals("SUS") && this.estadoDoc != null) { + this.filtro2 = " and h.estado = '" + this.estadoDoc + "' "; + parameters.put("filtro2", this.filtro2); + } else if (this.estadoDoc.equals("FIN") && this.estadoDoc != null) { + this.filtro2 = " and h.estado = '" + this.estadoDoc + "' "; + parameters.put("filtro2", this.filtro2); + } else { + parameters.put("filtro2", ""); + } + + String format = "xlsx"; + + try { + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TcustPersonDetail getCustomerperson() { + return customerperson; + } + + public void setCustomerperson(TcustPersonDetail customerperson) { + this.customerperson = customerperson; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public String getIdCentroControl() { + return idCentroControl; + } + + public void setIdCentroControl(String idCentroControl) { + this.idCentroControl = idCentroControl; + } + + public List getLcentros() { + return lcentros; + } + + public void setLcentros(List lcentros) { + this.lcentros = lcentros; + } + + public PersonDetailController getPersonDetailController() { + return personDetailController; + } + + public void setPersonDetailController( + PersonDetailController personDetailController) { + this.personDetailController = personDetailController; + } + + public CentroControlArmasController getCentroControlController() { + return centroControlController; + } + + public void setCentroControlController( + CentroControlArmasController centroControlController) { + this.centroControlController = centroControlController; + } + + public List getLestados() { + return lestados; + } + + public void setLestados(List lestados) { + this.lestados = lestados; + } + + public String getEstadoDoc() { + return estadoDoc; + } + + public void setEstadoDoc(String estadoDoc) { + this.estadoDoc = estadoDoc; + } + + public StringBuilder armarFormatoFechaSinHora(Calendar fechaCldr) { + StringBuilder fechaStr = new StringBuilder(); + fechaStr = fechaStr.append((fechaCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCldr.get(Calendar.DAY_OF_MONTH))); + fechaStr = fechaStr.append("-").append((fechaCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaCldr.get(Calendar.MONTH) + 1) : (fechaCldr.get(Calendar.MONTH) + 1)); + fechaStr = fechaStr.append("-").append(fechaCldr.get(Calendar.YEAR)); + return fechaStr; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/TotalArmasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/TotalArmasController.java new file mode 100644 index 0000000..c6d71fa --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/TotalArmasController.java @@ -0,0 +1,140 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.pgeneral.gene.TgeneCountry; + +/** + * Clase controladora del bean TarmTotalPersona. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class TotalArmasController extends AbstractController { + + /** + * Constructor + * + * @throws Exception + */ + public TotalArmasController() throws Exception { + super(TarmTotalPersona.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TOTALCONTROLLER"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static TarmTotalPersona findbyClase(String clase, String tipoarmaexplosivo, String personcodigo) { + try { + TotalArmasController cc = new TotalArmasController(); + + cc.init(); + cc.recperpage = 300; + cc.addFilter("clase", clase); + cc.addFilter("tipoarmaexplosivo", tipoarmaexplosivo); + cc.addFilter("personcodigo", personcodigo); + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/VentaController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/VentaController.java new file mode 100644 index 0000000..3735c23 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/VentaController.java @@ -0,0 +1,825 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.SelectEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmVentaArmaTemporalController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.armas.parametros.VentaTotalPersonaController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.fun.TarmMovimientoArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * @author Andres Cevallos Clase Controladora la cual maneja la venta de armas + */ +@ManagedBean +@ViewScoped +public class VentaController extends AbstractController { + + public VentaController() throws Exception { + super(TarmArmas.class); + } + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{movimientoController}") + private MovimientoController movimientoController; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmController; + + @ManagedProperty(value = "#{ventaTotalPersonaController}") + private VentaTotalPersonaController ventaTotalPersonaController; + + @ManagedProperty(value = "#{tarmVentaArmaTemporalController}") + private TarmVentaArmaTemporalController ventaArmaTemp; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + private String loteFilter; + + /** + * Lisat de personas + */ + private List lperson; + private TarmMovimientoArmas movimientoArma; + + /** + * Persona Cliente a la cual se le vende un arma + */ + private TcustPersonDetail compradorArma; + /** + * Cantidad de producto en venta + */ + private Integer cantidad; + /** + * Peso del producto en venta + */ + private BigDecimal peso; + /** + * Referencia de los Movimientos en el catalogo + */ + private List lmovimientos; + /** + * Lista referenciada al catalogo + */ + private List lcatalog; + /** + * Referencia del cliente en el catalogo + */ + private TgeneCatalogDetail cdetalle; + /** + * Detalle de la persona que vende el arma + */ + private TcustPersonDetail persondetail; + /** + * Fecha actual del sistema + */ + private Date fecha; + /** + * Lista de centros de control + */ + private List centroControlList; + + /** + * Codigo del centro de control + */ + private String ccentrocontrol; + + /** + * umero de solicitud + */ + private String numerosolicitud; + /** + * bandera para el flujo de venta + */ + private String flujoventa; + /** + * bandera para el consumo de municion + */ + private String consumomunicion; + + /** + * Variable que nos permite cargar el documento al Alfresco + */ + private UploadedFile uploadedFile; + + @PostConstruct + private void postconstruct() { + this.init(); + centroControlList = CentroControlArmasController.findEstadoInst("Y", "1");//Departamento + querydatabase(); + } + + private void init() { + try { + peso = null; + cantidad = null; + this.lrecord = new ArrayList<>(); + this.beanalias = "VENTAARMAS"; + // tipomovimiento=false; + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + this.persondetail = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + lmovimientos = CatalogDetailController.find("TIPOREGISTRO", "MOV");//catalogo de movimientos + cdetalle = CatalogDetailController.findxCodigoCodcatalogo(getPersondetail().getIdentificationcatalog(), getPersondetail().getIdentificationcatalogcode()); + fecha = new Date(); + lcatalog = CatalogDetailController.find("IDENTIFICATION"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", "i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + + SubQuery subqueryLonguitud = new SubQuery("TgeneCatalogDetail", "description", "longitud", "i.pk.catalog=(select o.longitud from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.longitudcodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryLonguitud); + + SubQuery subqueryClase = new SubQuery("TgeneCatalogDetail", "description", "clase", "i.pk.catalog=(select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClase); + + SubQuery subqueryTipoArma = new SubQuery("TgeneCatalogDetail", "description", "tipoarmaexplosivo", "i.pk.catalog=(select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipoArma); + + SubQuery subqueryCalibre = new SubQuery("TgeneCatalogDetail", "description", "calibre", "i.pk.catalog=(select o.calibre from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.calibrecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryCalibre); + + SubQuery subqueryUnidad = new SubQuery("TgeneCatalogDetail", "description", "unidadmedidapeso", "i.pk.catalog=(select o.unidadmedidapeso from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryUnidad); + + dto.setOrderby("lote, ctipoarmaexplosivo,cregistro"); + + Filter filtro = new Filter(); + String filtrofecha = "t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) " + + " and t.estado in(" + MsgControlArmas.getProperty("codigo_estado_arma_busqueda_venta") + ") "//'REG','REN','APTA','DEV','ECO','COLE' + + " and cregistro in (select reg.pk from TarmRegistroArmas reg where reg.personcode ='" + persondetail.getPk().getPersoncode() + "' )" + + " and (t.peso>0 or t.cantidad>0)"; + + if (loteFilter != null && !loteFilter.isEmpty()) { + filtrofecha += " and UPPER(t.lote) like '" + loteFilter + "'"; + } + + filtro.setSql(filtrofecha); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); +// request.put("queryalias", "ARMASCOMPLETE"); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Cambia el valor del movimiento de Venta a Materia Prima + */ + public void changeType() { + compradorArma = new TcustPersonDetail(); + } + + /** + * Valida que la fecha de venta no seaa superior a la fecha del sistema + * + * @param fech + */ + public void validarfecha(Date fech) { + if (fech.getTime() > (new Date()).getTime()) { + fecha = new Date(); + } + } + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en + * el Alfresco + */ + public void handleUpload(FileUploadEvent event) { + uploadedFile = event.getFile(); + } + + /** + * Recorta el nombre del archivo a cargarse + * + * @param nombre + * @return nombre recortado + */ + public String recorteNombre(String nombre) { + String fielname = nombre; + if (fielname.length() > 30) { + fielname = fielname.substring(0, 30) + extencionArchivo(nombre); + } + return fielname; + } + + /** + * Obtiene la extencion del archivo a cargar + * + * @param nombre + * @return + */ + private String extencionArchivo(String nombre) { + int pos = nombre.lastIndexOf('.'); + nombre = nombre.substring(pos); + return nombre; + } + + /** + * Actualiza la informacion en el lrecord + */ + @Override + public void update() { + try { + String pathRuta = ""; + //ACTUALIZA ELRESTO DE DATOS DE LA TABLA DE MOVIMIENTO + this.movimientoArma.setPersoncodevendedor(persondetail.getPk().getPersoncode()); + this.movimientoArma.getModifiedData().put("personaVemdedor", persondetail); + if (movimientoArma.getTipomovimiento().equals("VENT")) { + if (compradorArma != null && compradorArma.getPk() != null) { + //if(verificaDocHabilitante(compradorArma.getPk().getPersoncode())){ + this.movimientoArma.setPersoncodecomprador(compradorArma.getPk().getPersoncode()); + this.movimientoArma.getModifiedData().put("personaComprador", compradorArma); + } else { + MessageHelper.setMessageWarn("DEBE INGRESAR UN CLIENTE"); + return; + } + //VALIDA SI ES ARMA: LETAL Y NO LETAL + TarmTipoArmaExplosivo tipoArmaExplosivo = TiposArmasExplosivosController.findarma(this.record.getCtipoarmaexplosivo()); + if (tipoArmaExplosivo != null && tipoArmaExplosivo.getClasecodigo().equals("CLASE") + && ((this.flujoventa != null && this.flujoventa.equals("SI") && movimientoArma.getTipomovimiento().equals("VENT")) + || (this.consumomunicion != null && this.consumomunicion.equals("SI") && movimientoArma.getTipomovimiento().equals("CONS"))) + && (tipoArmaExplosivo.getClase().equals("0010000008") || tipoArmaExplosivo.getClase().equals("0010000001") + || tipoArmaExplosivo.getClase().equals("0010000002"))) {//0010000002 MUNICION + + String xPathLocation = getRutaDocumentoSolBase() + "/cm:I-" + persondetail.getIdentification() + "/cm:C-" + record.getCodigoarma(); + if (uploadedFile != null && uploadedFile.getFileName() != null) { + String extencionArchivo = getExtension(uploadedFile.getFileName()); + String nombreArchivo = "PERMISO-" + this.record.getCodigoarma() + "." + extencionArchivo; + if (alfrescoController.uploadFile(uploadedFile.getInputstream(), nombreArchivo, xPathLocation)) { + pathRuta = xPathLocation + "/cm:" + nombreArchivo; + } else { + MessageHelper.setMessageError("Adjunte el documento erroneo"); + return; + } + } else { + MessageHelper.setMessageError("Adjunte el documento "); + return; + } + + if (ccentrocontrol != null && !ccentrocontrol.trim().isEmpty()) { + saveVentaArma(pathRuta); + //retorna + return; + } else { + MessageHelper.setMessageWarn("SELECCIONE EL CENTRO DE CONTROL"); + return; + } + } + } else { + this.movimientoArma.getModifiedData().put("personaComprador", persondetail); + this.movimientoArma.setPersoncodecomprador(persondetail.getPk().getPersoncode());//es el mismo si el tipo movimientoArma.getTipomovimiento() es diferente de nenta + } + save(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta = new StringBuilder("cm:Solicitudes"); + ruta = ruta.append("/cm:VentaTem-"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + return ruta.toString(); + } + + /** + * Metodo que retorna la extencion del documento que se desea subir al + * alfresco + */ + public String getExtension(String filename) { + int index = filename.lastIndexOf('.'); + if (index == -1) { + return ""; + } else { + return filename.substring(index + 1); + } + } + + public void saveVentaArma(String pathRuta) { + try { + System.out.println("-------------Ingresa Venta Armas Save: " + numerosolicitud); + + //actualiza el arma a un estado pendiente de venta + this.record.setEstadoventa("PENVEN"); + numerosolicitud = record.getPk(); + System.out.println("------------Ingresa Venta Armas Save2: " + numerosolicitud); + + super.update(); + + ventaArmaTemp.clearAll(); + ventaArmaTemp.create(); + ventaArmaTemp.getRecord().setCarma(record.getPk()); + //this.movimientoArma.setPersoncodecomprador(compradorArma.getPk().getPersoncode()); + ventaArmaTemp.getRecord().setPersoncodigo(compradorArma.getPk().getPersoncode()); + ventaArmaTemp.getRecord().setEstado("PENDIENTE"); + ventaArmaTemp.getRecord().setFcreacion(new java.sql.Date(new Date().getTime())); + ventaArmaTemp.getRecord().setFactura(movimientoArma.getFactura()); + ventaArmaTemp.getRecord().setNoregistra(movimientoArma.getNoregistro()); + ventaArmaTemp.getRecord().setJustificacion(movimientoArma.getJustificacion()); + ventaArmaTemp.getRecord().setPathdocumento(pathRuta); + ventaArmaTemp.getRecord().setCentrocontrol(ccentrocontrol); + ventaArmaTemp.update(); + + Request request = this.callerhelper.getRequest(); + super.cleanRequest(request); + + HashMap msave = new HashMap(); + + DtoSave dtosaveArma = this.getDtoSave(true); + dtosaveArma.setPosition(1); + msave.put(this.getBeanalias(), dtosaveArma);//2 + + DtoSave dtosaveRegistro = this.ventaArmaTemp.getDtoSave(true); + dtosaveRegistro.setPosition(2); + msave.put(ventaArmaTemp.getBeanalias(), dtosaveRegistro); + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.ventaArmaTemp.postCommit(resp); + this.record = new TarmArmas(); + MessageHelper.setMessageInfo(resp); + //inicio del flujo + iniciarFlujo(); + super.cleanRequest(request); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + querydatabase(); + } + + /** + * Método para el inicio de flujo + */ + public void iniciarFlujo() { + try { + System.out.println("--------------Ingresa Venta Armas Inicio Flujo: " + numerosolicitud); + + String cprovincia = null; + for (TarmCentroControl centro : centroControlList) { + if (ccentrocontrol.equals(centro.getPk())) { + cprovincia = centro.getProvincecode(); + } + } + ; + if (cprovincia == null || cprovincia.length() == 0) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinprovincia")); + return; + } + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + + request.modifiedData().put("csolicitud", numerosolicitud);//nuemro del arma carma pk + SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm", Locale.getDefault()); + request.modifiedData().put("numerosolicitud", numerosolicitud + "-" + this.persondetail.getPk().getPersoncode() + "-" + dateFormat.format(new Date())); + request.modifiedData().put("cprovincia", cprovincia); + request.modifiedData().put("isnew", "Y"); + request.setLogsolicitude(numerosolicitud); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.setShowRow(true); + cantidad = null; + peso = null; + //crea un movimiento para la tabla TarmMovimientoArmas + movimientoArma = null; + //crea a la persona compradora + compradorArma = null; + // tipomovimiento=false; + flujoventa = null; + consumomunicion = null; + //flujoiniciado = true; + //deshabilitarPantalla = Boolean.TRUE; + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + " SOLICITUD: " + numerosolicitud); + //saveInicioFlujoEnYES(); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Valida que la cantidad que se desea vender no sea superior a la cantidad + * maxima que se tiene + * + * @param cantidad + */ + public void validarCantidadMexima(Integer cantidad) { + this.peso = null; + if (cantidad == null || cantidad == 0 || cantidad < 0 || cantidad.compareTo(record.getCantidad()) > 0) { + this.cantidad = record.getCantidad(); + } + } + + /** + * Valida que la cantidad que se desea vender no sea superior a la cantidad + * maxima que se tiene + * + * @param peso + */ + public void validarPesoMexima(BigDecimal peso) { + this.cantidad = null; + if (peso == null || peso.compareTo(new BigDecimal(0)) == 0 || peso.compareTo(new BigDecimal(0)) < 0 || peso.compareTo(record.getPeso()) > 0) { + this.peso = getRecord().getPeso(); + } + } + + /** + * Crea un registro de arma + * + * @param arm + */ + public void create(TarmArmas arm) { + try { + cantidad = arm.getCantidad(); + peso = arm.getPeso(); + //crea un movimiento para la tabla TarmMovimientoArmas + movimientoArma = new TarmMovimientoArmas(); + //crea a la persona compradora + compradorArma = new TcustPersonDetail(); + // tipomovimiento=false; + flujoventa = null; + consumomunicion = null; + //VALIDA SI ES ARMA: LETAL Y NO LETAL + TarmTipoArmaExplosivo tipoArmaExplosivo = TiposArmasExplosivosController.findarma(arm.getCtipoarmaexplosivo()); + if (tipoArmaExplosivo != null && tipoArmaExplosivo.getClasecodigo().equals("CLASE") + && (tipoArmaExplosivo.getClase().equals("0010000008") || tipoArmaExplosivo.getClase().equals("0010000001"))) { + flujoventa = "SI"; + } + if (tipoArmaExplosivo != null && tipoArmaExplosivo.getClasecodigo().equals("CLASE") + && tipoArmaExplosivo.getClase().equals("0010000002")) { + consumomunicion = "SI"; + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + public TgeneCatalogDetail getCdetalle() { + return cdetalle; + } + + public void setCdetalle(TgeneCatalogDetail cdetalle) { + this.cdetalle = cdetalle; + } + + /** + * Abre el Lov de Persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Carga los datos que se devuelven en el Lov de personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + compradorArma = (TcustPersonDetail) event.getObject(); + } + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + try { + //actualiza el movimiento + this.movimientoArma.setCarma(record.getPk()); + this.movimientoArma.setTipomovimientocodigo("TIPOMOVIMIENTO"); + this.movimientoArma.setFecha(new java.sql.Timestamp(fecha.getTime())); + this.movimientoController.create(); + this.movimientoController.setRecord(movimientoArma); + this.movimientoController.getRecord().setIsnew(true); + this.movimientoController.update(); + //actualiza el arma + //this.record.setPk(null); + if (cantidad != null) { + this.record.setValorAux(cantidad); + } + if (peso != null) { + this.record.setPesoAux(peso); + } + super.update(); + + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + + DtoSave dtosaveRegistro = this.registroArmController.getDtoSave(true); + dtosaveRegistro.setPosition(1); + msave.put(registroArmController.getBeanalias(), dtosaveRegistro); + + DtoSave dtosaveMovimiento = this.movimientoController.getDtoSave(true); + dtosaveMovimiento.setPosition(2); + msave.put(movimientoController.getBeanalias(), dtosaveMovimiento);//1 + + DtoSave dtosaveTotalPersona = this.ventaTotalPersonaController.getDtoSave(true); + dtosaveTotalPersona.setPosition(3); + msave.put(ventaTotalPersonaController.getBeanalias(), dtosaveTotalPersona); + + DtoSave dtosaveArma = this.getDtoSave(true); + dtosaveArma.setPosition(4); + msave.put(this.getBeanalias(), dtosaveArma);//2 + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.ventaTotalPersonaController.postCommit(resp); + this.movimientoController.postCommit(resp); + this.registroArmController.postCommit(resp); + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + querydatabase(); + } + +// private boolean verificaDocHabilitante(Integer personcode) { +// boolean verifica = false; +// TsafeUserDetail userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); +// TgeneParameters habVenta = ParametersController.find("TRAHABVENTAS", userDetail.getCompanycode().toString()); +// List ldocs = DocumentoHabilitanteController.findPorPersoncode(personcode.toString()); +// if(ldocs != null && !ldocs.isEmpty()){ +// for (TarmDocumentoHabilitante doc : ldocs) { +// String[] tramites = habVenta.getTextvalue().split(","); +// int ind = Arrays.binarySearch(tramites, doc.getCtramite().toString()); +// if(ind >= 0 && Calendar.getInstance().getTime().compareTo(doc.getFechaexpiracion()) <= 0){ +// verifica = true; +// break; +// } +// } +// } +// return verifica; +// } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#postCommit(com.fp.dto.Response) + */ + @Override + public void postCommit(Response response) throws Exception { + super.postCommit(response); + } + + public TcustPersonDetail getPersondetail() { + return persondetail; + } + + public void setPersondetail(TcustPersonDetail persondetail) { + this.persondetail = persondetail; + } + + public List getLcatalog() { + return lcatalog; + } + + public void setLcatalog(List lcatalog) { + this.lcatalog = lcatalog; + } + + public TcustPersonDetail getCompradorArma() { + return compradorArma; + } + + public void setCompradorArma(TcustPersonDetail compradorArma) { + this.compradorArma = compradorArma; + } + + public RegistroArmController getRegistroArmController() { + return registroArmController; + } + + public void setRegistroArmController(RegistroArmController registroArmController) { + this.registroArmController = registroArmController; + } + + public Integer getCantidad() { + return cantidad; + } + + public void setCantidad(Integer cantidad) { + this.cantidad = cantidad; + } + + public BigDecimal getPeso() { + return peso; + } + + public void setPeso(BigDecimal peso) { + this.peso = peso; + } + + public Date getFecha() { + return fecha; + } + + public void setFecha(Date fecha) { + this.fecha = fecha; + } + + public List getLmovimientos() { + return lmovimientos; + } + + public void setLmovimientos(List lmovimientos) { + this.lmovimientos = new ArrayList(); + for (TgeneCatalogDetail mov : lmovimientos) { + //No se incluye el tipo de registro TRASLADO (TRASL) + if (!mov.getPk().getCatalog().equalsIgnoreCase("TRASL")) { + this.lmovimientos.add(mov); + } + } + } + + public List getLperson() { + return lperson; + } + + public void setLperson(List lperson) { + this.lperson = lperson; + } + + public TarmMovimientoArmas getMovimientoArma() { + return movimientoArma; + } + + public void setMovimientoArma(TarmMovimientoArmas movimientoArma) { + this.movimientoArma = movimientoArma; + } + + public MovimientoController getMovimientoController() { + return movimientoController; + } + + public void setMovimientoController(MovimientoController movimientoController) { + this.movimientoController = movimientoController; + } + + public VentaTotalPersonaController getVentaTotalPersonaController() { + return ventaTotalPersonaController; + } + + public void setVentaTotalPersonaController( + VentaTotalPersonaController ventaTotalPersonaController) { + this.ventaTotalPersonaController = ventaTotalPersonaController; + } + + public String getLoteFilter() { + return loteFilter; + } + + public void setLoteFilter(String loteFilter) { + this.loteFilter = loteFilter; + } + + public List getCentroControlList() { + return centroControlList; + } + + public void setCentroControlList(List centroControlList) { + this.centroControlList = centroControlList; + } + + public String getCcentrocontrol() { + return ccentrocontrol; + } + + public void setCcentrocontrol(String ccentrocontrol) { + this.ccentrocontrol = ccentrocontrol; + } + + public String getFlujoventa() { + return flujoventa; + } + + public void setFlujoventa(String flujoventa) { + this.flujoventa = flujoventa; + } + + public String getConsumomunicion() { + return consumomunicion; + } + + public void setConsumomunicion(String consumomunicion) { + this.consumomunicion = consumomunicion; + } + + public TarmVentaArmaTemporalController getVentaArmaTemp() { + return ventaArmaTemp; + } + + public void setVentaArmaTemp(TarmVentaArmaTemporalController ventaArmaTemp) { + this.ventaArmaTemp = ventaArmaTemp; + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/VentaTraspasoDominioController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/VentaTraspasoDominioController.java new file mode 100644 index 0000000..0d99187 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/VentaTraspasoDominioController.java @@ -0,0 +1,259 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.armas.parametros.TarmVentaArmaTemporalController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmVentaArmaTem; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * @author CP Clase Controladora flujo venta de armas + */ +@ManagedBean +@ViewScoped +public class VentaTraspasoDominioController extends AbstractController { + + public VentaTraspasoDominioController() throws Exception { + super(TarmArmas.class); + } + + private static final long serialVersionUID = 1L; + + /** + * Constante usada para referirse a la opcion general aprobar + */ + private final String APROBAR = "APR"; + + /** + * Opciones de aceptar o rechazar + */ + private List accionList; + /** + * numero de solicitud + */ + private String numerosolicitud; + /** + * Numero del arma a vender + */ + private String csolicitud; + /** + * Accion tomada por el usuario, aprobar o rechazar + */ + private String accionTomada; + + /** + * Propiedad usada para el manejo del Alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + @PostConstruct + private void postconstruct() { + startQuery(); + this.getMfilters().clear(); + accionList = CatalogDetailController.find("ACCION"); + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + //codigo del arma carma pk + csolicitud = super.getMfilters().get("csolicitud"); + //codigo persona compra + numerosolicitud = super.getMfilters().get("numerosolicitud"); + this.getMfilters().clear(); + querydatabase(); + for (TarmArmas item : this.lrecord) { + TarmVentaArmaTem ventaArma = TarmVentaArmaTemporalController.findPendienteCarma(item.getPk()); + if (ventaArma != null) { + item.getModifiedData().put("pathdocumento", ventaArma.getPathdocumento()); + } + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", "i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + + SubQuery subqueryLonguitud = new SubQuery("TgeneCatalogDetail", "description", "longitud", "i.pk.catalog=(select o.longitud from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.longitudcodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryLonguitud); + + SubQuery subqueryClase = new SubQuery("TgeneCatalogDetail", "description", "clase", "i.pk.catalog=(select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClase); + + SubQuery subqueryTipoArma = new SubQuery("TgeneCatalogDetail", "description", "tipoarmaexplosivo", "i.pk.catalog=(select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipoArma); + + SubQuery subqueryCalibre = new SubQuery("TgeneCatalogDetail", "description", "calibre", "i.pk.catalog=(select o.calibre from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.calibrecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryCalibre); + + SubQuery subqueryUnidad = new SubQuery("TgeneCatalogDetail", "description", "unidadmedidapeso", "i.pk.catalog=(select o.unidadmedidapeso from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryUnidad); + + dto.setOrderby("lote, ctipoarmaexplosivo,cregistro"); + + Filter filtro = new Filter(); + String filtroCarma = "t.pk='" + csolicitud + "' and t.estadoventa='PENVEN'"; + + filtro.setSql(filtroCarma); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); +// request.put("queryalias", "ARMASCOMPLETE"); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#postCommit(com.fp.dto.Response) + */ + @Override + public void postCommit(Response response) throws Exception { + super.postCommit(response); + } + + /** + * Método para finalizar la tarea del flujo + */ + public void completarTarea() { + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + //mail + Map datosmail = new HashMap(); + datosmail.put("sol", numerosolicitud); + TarmCentroControl centroControl = obtenerCentroControl(); + datosmail.put("centrocontrol", (centroControl == null || centroControl.getNombreinstitucion() == null || centroControl.getNombreinstitucioncodigo() == null) ? "" : CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + + // Completar tarea en el flujo + if (accionTomada.equalsIgnoreCase(APROBAR)) { + request.modifiedData().put("BPMStatus", "A"); + datosmail.put("observaciones", "Aprobada"); + } else { + request.modifiedData().put("BPMStatus", "D"); + datosmail.put("observaciones", "Rechazada"); + } + request.modifiedData().put("datosmail", datosmail); + request.modifiedData().put("csolicitud", csolicitud);//nuemro del arma carma pk + request.modifiedData().put("numerosolicitud", numerosolicitud); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + this.clearAll(); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Exception e) { + e.printStackTrace(); + } catch (Throwable e) { + e.printStackTrace(); + } + } + + /** + * Método para obtener el centro de control + * + * @throws Exception + */ + private TarmCentroControl obtenerCentroControl() throws Exception { + try { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return centroControl; + } catch (Exception e) { + e.getMessage(); + } + return null; + + } + + public List getAccionList() { + return accionList; + } + + public void setAccionList(List accionList) { + this.accionList = accionList; + } + + public String getAccionTomada() { + return accionTomada; + } + + public void setAccionTomada(String accionTomada) { + this.accionTomada = accionTomada; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/VentasVariasArmasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/VentasVariasArmasController.java new file mode 100644 index 0000000..86dfb39 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/VentasVariasArmasController.java @@ -0,0 +1,628 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.SelectEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmVentaArmaTemporalController; +import com.fp.frontend.controller.armas.parametros.VentaTotalPersonaController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.fun.TarmMovimientoArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase Controladora la cual maneja la venta de varias armas + */ +@ManagedBean +@ViewScoped +public class VentasVariasArmasController extends AbstractController { + + public VentasVariasArmasController() throws Exception { + super(TarmArmas.class); + } + + private static final long serialVersionUID = 1L; + + private List lrecordSelccionadas; + + @ManagedProperty(value = "#{movimientoController}") + private MovimientoController movimientoController; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmController; + + @ManagedProperty(value = "#{ventaTotalPersonaController}") + private VentaTotalPersonaController ventaTotalPersonaController; + + @ManagedProperty(value = "#{tarmVentaArmaTemporalController}") + private TarmVentaArmaTemporalController ventaArmaTemp; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + private String loteFilter; + + /** + * Lisat de personas + */ + private List lperson; + private TarmMovimientoArmas movimientoArma; + + /** + * Persona Cliente a la cual se le vende un arma + */ + private TcustPersonDetail compradorArma; + /** + * Referencia de los Movimientos en el catalogo + */ + private List lmovimientos; + /** + * Lista referenciada al catalogo + */ + private List lcatalog; + /** + * Referencia del cliente en el catalogo + */ + private TgeneCatalogDetail cdetalle; + /** + * Detalle de la persona que vende el arma + */ + private TcustPersonDetail persondetail; + /** + * Fecha actual del sistema + */ + private Date fecha; + /** + * Lista de centros de control + */ + private List centroControlList; + + /** + * Codigo del centro de control + */ + private String ccentrocontrol; + + /** + * bandera para el flujo de venta + */ + private String flujoventa; + + /** + * Variable que nos permite cargar el documento al Alfresco + */ + private UploadedFile uploadedFile; + + @PostConstruct + private void postconstruct() { + this.init(); + centroControlList = CentroControlArmasController.findEstadoInst("Y", "1");//Departamento + querydatabase(); + } + + private void init() { + try { + this.lrecord = new ArrayList<>(); + this.beanalias = "VENTAVARIASARMAS"; + // tipomovimiento=false; + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + this.persondetail = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + lmovimientos = CatalogDetailController.find("TIPOREGISTRO", "MOV");//catalogo de movimientos + cdetalle = CatalogDetailController.findxCodigoCodcatalogo(getPersondetail().getIdentificationcatalog(), getPersondetail().getIdentificationcatalogcode()); + fecha = new Date(); + lcatalog = CatalogDetailController.find("IDENTIFICATION"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", "i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + + SubQuery subqueryLonguitud = new SubQuery("TgeneCatalogDetail", "description", "longitud", "i.pk.catalog=(select o.longitud from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.longitudcodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryLonguitud); + + SubQuery subqueryClase = new SubQuery("TgeneCatalogDetail", "description", "clase", "i.pk.catalog=(select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClase); + + SubQuery subqueryTipoArma = new SubQuery("TgeneCatalogDetail", "description", "tipoarmaexplosivo", "i.pk.catalog=(select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipoArma); + + SubQuery subqueryCalibre = new SubQuery("TgeneCatalogDetail", "description", "calibre", "i.pk.catalog=(select o.calibre from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.calibrecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryCalibre); + + SubQuery subqueryUnidad = new SubQuery("TgeneCatalogDetail", "description", "unidadmedidapeso", "i.pk.catalog=(select o.unidadmedidapeso from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryUnidad); + + dto.setOrderby("lote, ctipoarmaexplosivo,cregistro"); + + Filter filtro = new Filter(); + String filtrofecha = "t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) " + + " and t.estado in(" + MsgControlArmas.getProperty("codigo_estado_arma_busqueda_venta") + ") "//'REG','REN','APTA','DEV','ECO','COLE' + + " and cregistro in (select reg.pk from TarmRegistroArmas reg where reg.personcode ='" + persondetail.getPk().getPersoncode() + "' )" + + " and (t.peso>0 or t.cantidad>0)"; + + if (loteFilter != null && !loteFilter.isEmpty()) { + filtrofecha += " and UPPER(t.lote) like '" + loteFilter + "'"; + } + filtrofecha += " and t.ctipoarmaexplosivo not in " + + "(select ta.pk from TarmTipoArmaExplosivo ta where ta.clasecodigo='CLASE' and (ta.clase='0010000008' or ta.clase='0010000001'))"; + + //VALIDA SI ES ARMA: LETAL Y NO LETAL +// TarmTipoArmaExplosivo tipoArmaExplosivo=TiposArmasExplosivosController.findarma(arm.getCtipoarmaexplosivo()); +// if(tipoArmaExplosivo!=null && tipoArmaExplosivo.getClasecodigo().equals("CLASE") +// && (tipoArmaExplosivo.getClase().equals("0010000008") || tipoArmaExplosivo.getClase().equals("0010000001"))){ +// flujoventa="SI"; +// } + filtro.setSql(filtrofecha); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); +// request.put("queryalias", "ARMASCOMPLETE"); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Cambia el valor del movimiento de Venta a Materia Prima + */ + public void changeType() { + compradorArma = new TcustPersonDetail(); + } + + /** + * Valida que la fecha de venta no seaa superior a la fecha del sistema + * + * @param fech + */ + public void validarfecha(Date fech) { + if (fech.getTime() > (new Date()).getTime()) { + fecha = new Date(); + } + } + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en + * el Alfresco + */ + public void handleUpload(FileUploadEvent event) { + uploadedFile = event.getFile(); + } + + /** + * Recorta el nombre del archivo a cargarse + * + * @param nombre + * @return nombre recortado + */ + public String recorteNombre(String nombre) { + String fielname = nombre; + if (fielname.length() > 30) { + fielname = fielname.substring(0, 30) + extencionArchivo(nombre); + } + return fielname; + } + + /** + * Obtiene la extencion del archivo a cargar + * + * @param nombre + * @return + */ + private String extencionArchivo(String nombre) { + int pos = nombre.lastIndexOf('.'); + nombre = nombre.substring(pos); + return nombre; + } + + /** + * Actualiza la informacion en el lrecord + */ + @Override + public void update() { + try { + for (TarmArmas item : this.lrecordSelccionadas) { + if ((item.getPesoAux() == null || item.getPesoAux().equals(new BigDecimal(0))) + && (item.getValorAux() == 0)) { + MessageHelper.setMessageWarn("Ingrese el peso / cantidad"); + return; + } + super.create(); + record = item; + super.update(); + } + //ACTUALIZA ELRESTO DE DATOS DE LA TABLA DE MOVIMIENTO + this.movimientoArma.setPersoncodevendedor(persondetail.getPk().getPersoncode()); + this.movimientoArma.getModifiedData().put("personaVemdedor", persondetail); + if (movimientoArma.getTipomovimiento().equals("VENT")) { + if (compradorArma != null && compradorArma.getPk() != null) { + this.movimientoArma.setPersoncodecomprador(compradorArma.getPk().getPersoncode()); + this.movimientoArma.getModifiedData().put("personaComprador", compradorArma); + } else { + MessageHelper.setMessageWarn("DEBE INGRESAR UN CLIENTE"); + return; + } + } else { + this.movimientoArma.getModifiedData().put("personaComprador", persondetail); + this.movimientoArma.setPersoncodecomprador(persondetail.getPk().getPersoncode());//es el mismo si el tipo movimientoArma.getTipomovimiento() es diferente de nenta + } + save(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Valida que la cantidad que se desea vender no sea superior a la cantidad + * maxima que se tiene + * + * @param cantidad + */ + public void validarCantidadMaxima(Integer cantidad, TarmArmas arma) { + //this.peso=null; + if (cantidad == null || cantidad == 0 || cantidad < 0 || cantidad.compareTo(arma.getCantidad()) > 0) { + arma.setValorAux(0); + MessageHelper.setMessageWarn("Ingrese la cantidad"); + return; + } + } + + /** + * Valida que la cantidad que se desea vender no sea superior a la cantidad + * maxima que se tiene + * + * @param peso + */ + public void validarPesoMaxima(BigDecimal peso, TarmArmas arma) { + // this.cantidad=null; + if (peso == null || peso.compareTo(new BigDecimal(0)) == 0 || peso.compareTo(new BigDecimal(0)) < 0 || peso.compareTo(arma.getPeso()) > 0) { + arma.setPesoAux(null); + MessageHelper.setMessageWarn("Ingrese el peso"); + return; + } + } + + /** + * Crea un registro de arma + * + * @param arm + */ + public void create() { + try { + lrecordSelccionadas = new ArrayList(); + int aux = 0; + for (TarmArmas item : this.lrecord) { + if (item.getModifiedData().get("seleccionado") != null && (Boolean) item.getModifiedData().get("seleccionado")) { + aux = 1; + lrecordSelccionadas.add(item); + } + } + if (aux == 0) { + MessageHelper.setMessageError("Seleccione un registro"); + return; + } + //crea un movimiento para la tabla TarmMovimientoArmas + movimientoArma = new TarmMovimientoArmas(); + //crea a la persona compradora + compradorArma = new TcustPersonDetail(); + // tipomovimiento=false; + flujoventa = null; +// //VALIDA SI ES ARMA: LETAL Y NO LETAL +// TarmTipoArmaExplosivo tipoArmaExplosivo=TiposArmasExplosivosController.findarma(arm.getCtipoarmaexplosivo()); +// if(tipoArmaExplosivo!=null && tipoArmaExplosivo.getClasecodigo().equals("CLASE") +// && (tipoArmaExplosivo.getClase().equals("0010000008") || tipoArmaExplosivo.getClase().equals("0010000001"))){ +// flujoventa="SI"; +// } + } catch (Exception e) { + e.printStackTrace(); + } + } + + public TgeneCatalogDetail getCdetalle() { + return cdetalle; + } + + public void setCdetalle(TgeneCatalogDetail cdetalle) { + this.cdetalle = cdetalle; + } + + /** + * Abre el Lov de Persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Carga los datos que se devuelven en el Lov de personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + compradorArma = (TcustPersonDetail) event.getObject(); + } + + /** + * Graba los registros en la base de datos + */ + @Override + public void save() { + try { + //actualiza el movimiento + //this.movimientoArma.setCarma(record.getPk()); + this.movimientoArma.setTipomovimientocodigo("TIPOMOVIMIENTO"); + this.movimientoArma.setFecha(new java.sql.Timestamp(fecha.getTime())); + + Request request = this.callerhelper.getRequest(); + request.put("tarmMovimientoArmas", movimientoArma); + HashMap msave = new HashMap(); + + DtoSave dtosaveRegistro = this.registroArmController.getDtoSave(true); + dtosaveRegistro.setPosition(1); + msave.put(registroArmController.getBeanalias(), dtosaveRegistro); + + DtoSave dtosaveMovimiento = this.movimientoController.getDtoSave(true); + dtosaveMovimiento.setPosition(2); + msave.put(movimientoController.getBeanalias(), dtosaveMovimiento);//1 + + DtoSave dtosaveTotalPersona = this.ventaTotalPersonaController.getDtoSave(true); + dtosaveTotalPersona.setPosition(3); + msave.put(ventaTotalPersonaController.getBeanalias(), dtosaveTotalPersona); + + DtoSave dtosaveArma = this.getDtoSave(true); + dtosaveArma.setPosition(4); + msave.put(this.getBeanalias(), dtosaveArma);//2 + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.ventaTotalPersonaController.postCommit(resp); + this.movimientoController.postCommit(resp); + this.registroArmController.postCommit(resp); + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + querydatabase(); + } + +// private boolean verificaDocHabilitante(Integer personcode) { +// boolean verifica = false; +// TsafeUserDetail userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); +// TgeneParameters habVenta = ParametersController.find("TRAHABVENTAS", userDetail.getCompanycode().toString()); +// List ldocs = DocumentoHabilitanteController.findPorPersoncode(personcode.toString()); +// if(ldocs != null && !ldocs.isEmpty()){ +// for (TarmDocumentoHabilitante doc : ldocs) { +// String[] tramites = habVenta.getTextvalue().split(","); +// int ind = Arrays.binarySearch(tramites, doc.getCtramite().toString()); +// if(ind >= 0 && Calendar.getInstance().getTime().compareTo(doc.getFechaexpiracion()) <= 0){ +// verifica = true; +// break; +// } +// } +// } +// return verifica; +// } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#postCommit(com.fp.dto.Response) + */ + @Override + public void postCommit(Response response) throws Exception { + super.postCommit(response); + } + + public TcustPersonDetail getPersondetail() { + return persondetail; + } + + public void setPersondetail(TcustPersonDetail persondetail) { + this.persondetail = persondetail; + } + + public List getLcatalog() { + return lcatalog; + } + + public void setLcatalog(List lcatalog) { + this.lcatalog = lcatalog; + } + + public TcustPersonDetail getCompradorArma() { + return compradorArma; + } + + public void setCompradorArma(TcustPersonDetail compradorArma) { + this.compradorArma = compradorArma; + } + + public RegistroArmController getRegistroArmController() { + return registroArmController; + } + + public void setRegistroArmController(RegistroArmController registroArmController) { + this.registroArmController = registroArmController; + } + + public Date getFecha() { + return fecha; + } + + public void setFecha(Date fecha) { + this.fecha = fecha; + } + + public List getLmovimientos() { + return lmovimientos; + } + + public void setLmovimientos(List lmovimientos) { + this.lmovimientos = new ArrayList(); + for (TgeneCatalogDetail mov : lmovimientos) { + //No se incluye el tipo de registro TRASLADO (TRASL) + if (!mov.getPk().getCatalog().equalsIgnoreCase("TRASL")) { + this.lmovimientos.add(mov); + } + } + } + + public List getLperson() { + return lperson; + } + + public void setLperson(List lperson) { + this.lperson = lperson; + } + + public TarmMovimientoArmas getMovimientoArma() { + return movimientoArma; + } + + public void setMovimientoArma(TarmMovimientoArmas movimientoArma) { + this.movimientoArma = movimientoArma; + } + + public MovimientoController getMovimientoController() { + return movimientoController; + } + + public void setMovimientoController(MovimientoController movimientoController) { + this.movimientoController = movimientoController; + } + + public VentaTotalPersonaController getVentaTotalPersonaController() { + return ventaTotalPersonaController; + } + + public void setVentaTotalPersonaController( + VentaTotalPersonaController ventaTotalPersonaController) { + this.ventaTotalPersonaController = ventaTotalPersonaController; + } + + public String getLoteFilter() { + return loteFilter; + } + + public void setLoteFilter(String loteFilter) { + this.loteFilter = loteFilter; + } + + public List getCentroControlList() { + return centroControlList; + } + + public void setCentroControlList(List centroControlList) { + this.centroControlList = centroControlList; + } + + public String getCcentrocontrol() { + return ccentrocontrol; + } + + public void setCcentrocontrol(String ccentrocontrol) { + this.ccentrocontrol = ccentrocontrol; + } + + public String getFlujoventa() { + return flujoventa; + } + + public void setFlujoventa(String flujoventa) { + this.flujoventa = flujoventa; + } + + public TarmVentaArmaTemporalController getVentaArmaTemp() { + return ventaArmaTemp; + } + + public void setVentaArmaTemp(TarmVentaArmaTemporalController ventaArmaTemp) { + this.ventaArmaTemp = ventaArmaTemp; + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public List getLrecordSelccionadas() { + return lrecordSelccionadas; + } + + public void setLrecordSelccionadas(List lrecordSelccionadas) { + this.lrecordSelccionadas = lrecordSelccionadas; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/VisualizacionSitiosAlmacenamientoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/VisualizacionSitiosAlmacenamientoController.java new file mode 100644 index 0000000..074ae9a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/funcionalidad/VisualizacionSitiosAlmacenamientoController.java @@ -0,0 +1,280 @@ +package com.fp.frontend.controller.armas.funcionalidad; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; +import org.primefaces.event.map.MarkerDragEvent; +import org.primefaces.event.map.OverlaySelectEvent; +import org.primefaces.model.map.DefaultMapModel; +import org.primefaces.model.map.LatLng; +import org.primefaces.model.map.MapModel; +import org.primefaces.model.map.Marker; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmSitioAlmacenamiento; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Clase controladora del bean TarmSitioAlmacenamiento. + * + * @author abenalcazar + * + */ +@SuppressWarnings("serial") +@ManagedBean(name = "visualizacionSitiosAlmacenamientoController") +@ViewScoped +public class VisualizacionSitiosAlmacenamientoController extends + AbstractController { + + public VisualizacionSitiosAlmacenamientoController() throws Exception { + super(TarmSitioAlmacenamiento.class); + } + + /** + * Model para GMAP + */ + private MapModel simpleModel; + /** + * Marcador de Gmap + */ + private Marker marker; + /** + * Atributo que oculta boton Generar Mapa + */ + private boolean ocultarBtnGmap; + + /** + * Incializa el controlador, cuando se esta utilizando una página que + * utiliza el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "SITIOALMACENAMIENTO"; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Post Construct + * + * @throws Exception + */ + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + + ocultarBtnGmap = true; + } + + /** + * Método para consultar registros de la base de datos + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + this.addFilter("estado", "ACT"); + DtoQuery dto = super.getDtoQuery(true); + + SubQuery sprovincia = new SubQuery("TgeneProvince", "description", + "desprovincia", + "i.pk.countrycode = t.countrycode and i.pk.provincecode= t.provincecode"); + SubQuery scanton = new SubQuery( + "TgeneCanton", + "description", + "descanton", + "i.pk.countrycode = t.countrycode and i.pk.provincecode=t.provincecode and i.pk.cantoncode=t.cantoncode"); + SubQuery sparroquia = new SubQuery( + "TgeneParroquia", + "description", + "desparroquia", + "i.pk.countrycode = t.countrycode and i.pk.provincecode=t.provincecode and i.pk.cantoncode=t.cantoncode and i.pk.parroquiacode=t.parroquiacode"); + + //nombre + SubQuery snombre = new SubQuery("TcustPersonDetail", "name", "nombre", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + + dto.addSubQuery(sprovincia); + dto.addSubQuery(scanton); + dto.addSubQuery(sparroquia); + + dto.addSubQuery(snombre); + + dto.setOrderby("t.countrycode"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp + .get(this.beanalias); + super.postQuery(this.lrecord); + listaVacia(); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void listaVacia() { + if (lrecord.size() != 0) { + ocultarBtnGmap = false; + } else { + ocultarBtnGmap = true; + } + + } + + /** + * Método para abrir el lov de Provincia. + */ + public void openProvinciaLov() { + Map> params = new HashMap<>(); + ProvinceLovController.openLov(params); + } + + public void onReturnProvinceLov(SelectEvent event) throws Exception { + TgeneProvince t = (TgeneProvince) event.getObject(); + super.addFilter("pk.provincecode", t.getPk().getProvincecode()); + super.addField("description", t.getDescription()); + this.query(); + } + + /** + * Método para generar Mapa y mostrar los marcadores de latitud y + * longitud dentro del mapa + */ + public void generarMapa() { + + if (lrecord != null) { + LatLng coord = null; + simpleModel = new DefaultMapModel(); + for (TarmSitioAlmacenamiento c : lrecord) { + try { + coord = new LatLng(c.getLatitud().doubleValue(), c + .getLongitud().doubleValue()); + } catch (Exception e) { + // TODO: handle exception + } + simpleModel.addOverlay(new Marker(coord, "quito")); + } + } + } + + public void limpiar() { + lrecord = new ArrayList<>(); + simpleModel = new DefaultMapModel(); + this.getMfilters().remove("pk.provincecode"); + this.getMfilelds().remove("description"); + } + + /** + * Lanza el evento simpleModel + * + * @param event + */ + public void onMarkerDrag(MarkerDragEvent event) { + // since marker's state is already kept in draggableModel you do not + // necessarily + } + + /** + * Selecciona un marcador dentro de gmap + * + * @param event + */ + public void onMarkerSelect(OverlaySelectEvent event) { + marker = (Marker) event.getOverlay(); + + addMessage(new FacesMessage(FacesMessage.SEVERITY_INFO, + "Marker Selected", marker.getTitle())); + } + + public void addMessage(FacesMessage message) { + FacesContext.getCurrentInstance().addMessage(null, message); + } + + /** + * Incrementa el numero del documento + * + * @param arma + * @return + */ + public int incrementarRowkey(TarmSitioAlmacenamiento sitio) { + int n = 0; + + for (int i = 0; i < this.lrecord.size(); i++) { + if (sitio.getPk() == this.lrecord.get(i).getPk()) { + n = i + 1; + break; + } + } + + return n; + } + + // ** + // **ACCESORES Y MUTADORES + // ** + public final MapModel getSimpleModel() { + return simpleModel; + } + + public final void setSimpleModel(MapModel simpleModel) { + this.simpleModel = simpleModel; + } + + public final Marker getMarker() { + return marker; + } + + public final void setMarker(Marker marker) { + this.marker = marker; + } + + /** + * Entrega V/F + * + * @return ocultarBtnGmap + */ + public boolean isOcultarBtnGmap() { + return ocultarBtnGmap; + } + + /** + * Fija V/F + * + * @param ocultarBtnGmap + */ + public void setOcultarBtnGmap(boolean ocultarBtnGmap) { + this.ocultarBtnGmap = ocultarBtnGmap; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/entries new file mode 100644 index 0000000..13e1aac --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/entries @@ -0,0 +1,368 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/armas/lov +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +CatalogoArmaLovController.java +file + + + + +2022-07-28T03:39:53.349589Z +a6179b5aed452d9111fbbb8f82509020 +2014-09-29T13:58:18.593909Z +1228 +cpiedra + + + + + + + + + + + + + + + + + + + + + +4251 + +CentroControlLovController.java +file + + + + +2022-07-28T03:39:53.349589Z +fb4151ee6ff5744fb7fd529baf9f4b9c +2014-10-13T09:23:23.914479Z +1551 +cguzman + + + + + + + + + + + + + + + + + + + + + +3078 + +SancionarLovController.java +file + + + + +2022-07-28T03:39:53.350589Z +a4f0352afe4104217aa21e9bbda530cc +2019-01-14T03:06:37.641608Z +4617 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +5746 + +CargasLovController.java +file + + + + +2022-07-28T03:39:53.350589Z +5b4e7bec86d163aee4f85e8dfa8d9799 +2015-12-29T13:56:10.923396Z +4355 +fpazmino + + + + + + + + + + + + + + + + + + + + + +4668 + +UnidadTipoLovController.java +file + + + + +2022-07-28T03:39:53.350589Z +a637bbf64aec9b453021e9180078bc58 +2014-09-04T08:02:49.024731Z +518 +cpiedra + + + + + + + + + + + + + + + + + + + + + +8751 + +CertArmasLovController.java +file + + + + +2022-07-28T03:39:53.351589Z +29d652bc9c5aa8cee1f53480e34d43c7 +2015-10-19T06:17:44.255745Z +4295 +fpazmino + + + + + + + + + + + + + + + + + + + + + +13561 + +ArmasLovController.java +file + + + + +2022-07-28T03:39:53.351589Z +826120057d96d3693cf931cdefafbe87 +2016-05-07T15:04:27.540845Z +4541 +cvasquez + + + + + + + + + + + + + + + + + + + + + +13656 + +PlanificacionTramiteLovController.java +file + + + + +2022-07-28T03:39:53.351589Z +2954bfc5d3b9e90140a4329daa64e5d8 +2014-11-13T08:18:25.709004Z +2706 +cpiedra + + + + + + + + + + + + + + + + + + + + + +6943 + +SitioAlmacenamientoLovController.java +file + + + + +2022-07-28T03:39:53.352589Z +2c426269673b51e35aadb0ae42cd5dfa +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +5125 + +ArmaExplosivoLovController.java +file + + + + +2022-07-28T03:39:53.352589Z +c35b0b38dce55aded4cef195549c5ab4 +2015-12-29T22:25:37.144732Z +4364 +fpazmino + + + + + + + + + + + + + + + + + + + + + +6932 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/ArmaExplosivoLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/ArmaExplosivoLovController.java.svn-base new file mode 100644 index 0000000..4d3f690 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/ArmaExplosivoLovController.java.svn-base @@ -0,0 +1,184 @@ +package com.fp.frontend.controller.armas.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author C.P. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ArmaExplosivoLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private String tituloLOV; + private String categoriaParam; + + private String descripcionClase; + private String descripcionTipo; + + public ArmaExplosivoLovController() throws Exception { + super(TarmTipoArmaExplosivo.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + tituloLOV = CallerHelper.getLovParameter("tituloLOV"); + categoriaParam = CallerHelper.getLovParameter("categoria"); + if(categoriaParam!=null){ + categoriaParam = " and t.clase in ('"+categoriaParam+"')"; + categoriaParam=categoriaParam.replace(",", "','"); + } + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TIPOARMAEXPLOSIVOLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + + SubQuery subqueryClase = new SubQuery("TgeneCatalogDetail", "description", "nclase", "i.pk.catalog = t.clase and i.pk.catalogcode = t.clasecodigo"); + dto.addSubQuery(subqueryClase); + + SubQuery subqueryTipoArmaExplosivo = new SubQuery("TgeneCatalogDetail", "description", "ntipo", "i.pk.catalog = t.tipoarmaexplosivo and i.pk.catalogcode = t.tipoarmaexplosivocodigo"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + + SubQuery subqueryLongitud = new SubQuery("TgeneCatalogDetail", "description", "nlongitud", "i.pk.catalog = t.longitud and i.pk.catalogcode = t.longitudcodigo"); + dto.addSubQuery(subqueryLongitud); + + SubQuery subqueryCalibre = new SubQuery("TgeneCatalogDetail", "description", "ncalibre", "i.pk.catalog = t.calibre and i.pk.catalogcode = t.calibrecodigo"); + dto.addSubQuery(subqueryCalibre); + + SubQuery subunidad= new SubQuery("TgeneCatalogDetail", "description", "desunidad", "i.pk.catalog = t.pk.unidadmedidapeso and i.pk.catalogcode=t.pk.unidadmedidapesocodigo"); + dto.addSubQuery(subunidad); + + SubQuery subunidadlegalcode= new SubQuery("TgeneCatalogDetail", "legalcode", "deslegalcode", "i.pk.catalog = t.pk.unidadmedidapeso and i.pk.catalogcode=t.pk.unidadmedidapesocodigo"); + dto.addSubQuery(subunidadlegalcode); + String sql=" 1=1 "; + + + if(descripcionClase!= null && descripcionClase.trim().length()>0){ + sql=sql+" and clase in (select o.pk.catalog from TgeneCatalogDetail o where o.description like '%"+descripcionClase+"%' and o.pk.catalogcode='CLASE')"; + }//TarmTipoArmaExplosivo + + if(descripcionTipo!= null && descripcionTipo.trim().length()>0){ + sql=sql+" and tipoarmaexplosivo in (select o.pk.catalog from TgeneCatalogDetail o where o.description like '%"+descripcionTipo+"%' and o.pk.catalogcode='TIPOARMAEXPLOSIVO')"; //TarmTipoArmaExplosivo//catalogcode + } + + Filter filtro= new Filter(); + sql += categoriaParam!=null?categoriaParam:""; + filtro.setSql(sql); //TarmTipoArmaExplosivo//catalogcode + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setcatalog() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setcatalog(TarmTipoArmaExplosivo armaExplosivo) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(armaExplosivo); + } + + public String getTituloLOV() { + return tituloLOV; + } + + public void setTituloLOV(String tituloLOV) { + this.tituloLOV = tituloLOV; + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/armaExplosivoLov.xhtml", options, params); + } + + public String getDescripcionClase() { + return descripcionClase; + } + + public void setDescripcionClase(String descripcionClase) { + this.descripcionClase = descripcionClase; + } + + public String getDescripcionTipo() { + return descripcionTipo; + } + + public void setDescripcionTipo(String descripcionTipo) { + this.descripcionTipo = descripcionTipo; + } + + public String getCategoriaParam() { + return categoriaParam; + } + + public void setCategoriaParam(String categoriaParam) { + this.categoriaParam = categoriaParam; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/ArmasLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/ArmasLovController.java.svn-base new file mode 100644 index 0000000..588c3f7 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/ArmasLovController.java.svn-base @@ -0,0 +1,271 @@ +package com.fp.frontend.controller.armas.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.apache.commons.lang3.StringUtils; +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; + +/** + * Controlador principal de armas + * @author C.P. + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ArmasLovController extends AbstractController { + + private String ccodigosarmas; + private String estadosArma; + private String codigopersona; + + public ArmasLovController() throws Exception { + super(TarmArmas.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + try { + ccodigosarmas = CallerHelper.getLovParameter("ccodigosarmas"); + estadosArma = CallerHelper.getLovParameter("estadosarmas"); + codigopersona=CallerHelper.getLovParameter("codigopersona"); + super.startQuery(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + recperpage = 5000; // Cambiar al # reg a mirar. + record = new TarmArmas(); + lrecord = new ArrayList<>(); + beanalias = "ARMAS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + String sqlFiltroEstados = ""; + String sqlFiltroCodigosArmas = "";//1 + + String sqlFiltroEstadosDec = (String) this.getMfilelds().get("codigosarmasdec"); + String sqlFiltroCodigosArmasDec = (String) this.getMfilelds().get("estadosarmasdec"); + + //codigos de las armas seleccionadas + if (ccodigosarmas != null) { + sqlFiltroCodigosArmas=ccodigosarmas; + } + //filtro de los estados de las armas + if (estadosArma != null) { + sqlFiltroEstados=estadosArma;//estado distinto de destruidas - cambiodepropietario - vendidas - decomisadas - suspendida - cancelada - incautada + } + if(codigopersona!=null && !codigopersona.equals("null") && codigopersona.trim().length()>1){ + sqlFiltroEstados=sqlFiltroEstados+" and t.cregistro in (select per from TarmRegistroArmas per where per.personcode="+codigopersona+")"; + } + + dto.setOrderby("pk"); + String sqlActual = " t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) " + + " and (t.peso>0 or t.cantidad>0)";// and (t.cregistro=ta.cregistro) para el manejo de los explosivos + String sqlFinal = obtenerFiltroBusquedaGeneral(sqlFiltroEstadosDec, sqlFiltroCodigosArmasDec, sqlFiltroEstados, sqlFiltroCodigosArmas, sqlActual); + System.out.println("SQL ARMA: "+sqlFinal); + Filter filtroFinal = new Filter(); + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + cargarPropietario(); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para buscar el propietario del arma y asignarle al arma + */ + private void cargarPropietario(){ + for(TarmArmas arma:this.lrecord){ + //asigmnamos un valor al arma para ordenarla + arma.getModifiedData().put("ordenarma",arma.getPk()); + if(arma.getModifiedData().get("personcode")!=null){ + TcustPersonDetail personaDetalle=PersonDetailController.find(arma.getModifiedData().get("personcode").toString()); + arma.getModifiedData().put("propietario", personaDetalle.getName()); + arma.getModifiedData().put("noDocumento", personaDetalle.getIdentification()); + } + } + } + + private String obtenerFiltroBusquedaGeneral(String... sqlFiltros ){ + StringBuffer sqlFinal = new StringBuffer(); + for (int i = 0; i < sqlFiltros.length ; i++) { + if(sqlFinal.length() > 0 && !StringUtils.endsWith(StringUtils.trim(sqlFinal.toString()), "AND")){ + sqlFinal.append( " AND "); + } + sqlFinal.append(sqlFiltros[i]); + } + return sqlFinal.toString(); + } + + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception{ + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryPaisOrigen= new SubQuery("TgeneCountry","description","paisorigen","i.pk=t.cpaisorigen"); + dto.addSubQuery(subqueryPaisOrigen); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TarmTipoArmaExplosivo","clase","cclase","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo= new SubQuery("TarmTipoArmaExplosivo","clasecodigo","cclasecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud= new SubQuery("TarmTipoArmaExplosivo","longitud","clongitud","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo= new SubQuery("TarmTipoArmaExplosivo","longitudcodigo","clongitudcodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ccalibre","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo= new SubQuery("TarmTipoArmaExplosivo","calibrecodigo","ccalibrecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivo","ctipoarmaexplosivo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivocodigo","ctipoarmaexplosivocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapeso","cunidadmedidapeso","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapesocodigo","cunidadmedidapesocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida= new SubQuery("TgeneCatalogDetail","description","unidadmedida","i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode= new SubQuery("TarmRegistroArmas","personcode","personcode","i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + SubQuery subqueryTipo= new SubQuery("TgeneCatalogDetail","description","tipo","i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipo); + SubQuery subqueryTipoArmaExplosivo= new SubQuery("TgeneCatalogDetail","description","tipoarmaexplosivo","i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + SubQuery subqueryClasecatalogo= new SubQuery("TgeneCatalogDetail","description","clase","i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClasecatalogo); + SubQuery subqueryUnidadTipo= new SubQuery("TgeneCatalogDetail","description","unidadmedidadesc","i.pk.catalog= (select o.unidadmedidapeso from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryUnidadTipo); +// SubQuery subqueryestadopermiso= new SubQuery("TgeneCatalogDetail","description","estadopermiso", +// "i.pk.catalog=(select dh.estado from TarmDocumentoHabilitante dh where dh.personcode = (select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) and dh.carma = t.pk)" +// + "and i.pk.catalogcode=(select dh.estadocode from TarmDocumentoHabilitante dh where dh.personcode = (select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) and dh.carma = t.pk)"); +// dto.addSubQuery(subqueryestadopermiso); + + + + SubQuery subqueryFechaemiperm= new SubQuery("TarmDocumentoHabilitante","fechaemision","fechaemision", + //" i.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) and i.carma = t.pk and "+ + " i.pk=(select max(doc.pk) from TarmDocumentoHabilitante doc where doc.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro)" + + " and doc.carma in (select arm1.pk from TarmArmas arm1 where arm1.codigoarma in (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))"); + dto.addSubQuery(subqueryFechaemiperm); + SubQuery subqueryFechaexpperm= new SubQuery("TarmDocumentoHabilitante","fechaexpiracion","fechaexpiracion", + // " i.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) and i.carma = t.pk and "+ + " i.pk=(select max(doc.pk) from TarmDocumentoHabilitante doc where doc.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) " + + "and doc.carma in (select arm1.pk from TarmArmas arm1 where arm1.codigoarma in (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))"); + dto.addSubQuery(subqueryFechaexpperm); + return dto; + } + + @Override + public void save() { + try { + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog() { + Listarmas=new ArrayList(); + armas.add(this.record); + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(armas); + } + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog(TarmArmas tarmArmas) { + Listarmas=new ArrayList(); + armas.add(tarmArmas); + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(armas); + } + + public void selecionaTodos(){ + RequestContext.getCurrentInstance().closeDialog(lrecord); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 1200); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/armasLov.xhtml", options, params); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/CargasLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/CargasLovController.java.svn-base new file mode 100644 index 0000000..e281ace --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/CargasLovController.java.svn-base @@ -0,0 +1,147 @@ +package com.fp.frontend.controller.armas.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del lov asociado al bean TarmCarga. + * + * @author Christian Pazmino + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class CargasLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private String tituloLOV; + private String personcode; + + + public CargasLovController() throws Exception { + super(TarmCarga.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + personcode = CallerHelper.getLovParameter("personcode"); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 500; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CARGASLOV"; + this.querydatabase(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.fecha desc"); + String sql=""; + if(personcode!= null){ + sql="t.esdesaduanizado = 'N' and t.tipocarga='IMP' and t.personcode ="+ personcode; + // Filtro para la TX 30-20 + if(!this.getLoginController().getRequest().getTransactionCode().equals(37)){ + sql=sql+" and t.csolicitud is null"; + } + }else{ + MessageHelper.setMessageError("EL CODIGO DE PERSONA ES REQUERIDO"); + return; + } + Filter filtro= new Filter(); + filtro.setSql(sql); //TarmTipoArmaExplosivo//catalogcode + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setCarga() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setCarga(TarmCarga carga) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(carga); + } + + public String getTituloLOV() { + return tituloLOV; + } + + public void setTituloLOV(String tituloLOV) { + this.tituloLOV = tituloLOV; + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/cargasLov.xhtml", options, params); + } + + public String getPersoncode() { + return personcode; + } + + public void setPersoncode(String personcode) { + this.personcode = personcode; + } + + + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/CatalogoArmaLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/CatalogoArmaLovController.java.svn-base new file mode 100644 index 0000000..00073c4 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/CatalogoArmaLovController.java.svn-base @@ -0,0 +1,122 @@ +package com.fp.frontend.controller.armas.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author C.P. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class CatalogoArmaLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private String tituloLOV; + + public CatalogoArmaLovController() throws Exception { + super(TgeneCatalogDetail.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + tituloLOV = CallerHelper.getLovParameter("tituloLOV"); + String catalogcode = CallerHelper.getLovParameter("catalogcode"); + if (catalogcode != null) { + super.addFilter("pk.catalogcode", catalogcode); + } + String legalcode =CallerHelper.getLovParameter("legalcode"); + if (catalogcode != null) { + super.addFilter("legalcode", legalcode); + } + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CLASELOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setcatalog() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setcatalog(TgeneCatalogDetail tgeneCatalogDetail) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneCatalogDetail); + } + + public String getTituloLOV() { + return tituloLOV; + } + + public void setTituloLOV(String tituloLOV) { + this.tituloLOV = tituloLOV; + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/catalogoArmaLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/CentroControlLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/CentroControlLovController.java.svn-base new file mode 100644 index 0000000..8ffa9d2 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/CentroControlLovController.java.svn-base @@ -0,0 +1,97 @@ +package com.fp.frontend.controller.armas.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class CentroControlLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public CentroControlLovController() throws Exception { + super(TgeneCatalogDetail.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + try { +/* String codeperson = CallerHelper.getLovParameter("personcode"); + if (codeperson != null) { + super.addFilter("personcode", codeperson); + }*/ + super.startQuery(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CENTROCONTROLLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + List listaCatalogoDetail = CatalogDetailController.find("NOMBREINSTITUCION"); + for(TgeneCatalogDetail catalogDetail:listaCatalogoDetail){ + record = catalogDetail; + System.out.println("***********" + catalogDetail.getDescription()); + } + System.out.println("Fin"); + this.lrecord = listaCatalogoDetail; + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setcatalog(TgeneCatalogDetail catalogD) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(catalogD); + } + + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/centroControlLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/CertArmasLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/CertArmasLovController.java.svn-base new file mode 100644 index 0000000..7dd81a7 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/CertArmasLovController.java.svn-base @@ -0,0 +1,269 @@ +package com.fp.frontend.controller.armas.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.apache.commons.lang3.StringUtils; +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; + +/** + * Controlador principal de armas + * @author C.P. + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CertArmasLovController extends AbstractController { + + private String ccodigosarmas; + private String estadosArma; + private String codigopersona; + + public CertArmasLovController() throws Exception { + super(TarmArmas.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + try { + ccodigosarmas = CallerHelper.getLovParameter("ccodigosarmas"); + estadosArma = CallerHelper.getLovParameter("estadosarmas"); + codigopersona=CallerHelper.getLovParameter("codigopersona"); + if(codigopersona!=null && !codigopersona.equalsIgnoreCase("")){ + querydatabase(); + } +// super.startQuery(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + recperpage = 5000; // Cambiar al # reg a mirar. + record = new TarmArmas(); + lrecord = new ArrayList<>(); + beanalias = "ARMAS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + String sqlFiltroEstados = ""; + String sqlFiltroCodigosArmas = "";//1 + //codigos de las armas seleccionadas + if (ccodigosarmas != null) { + sqlFiltroCodigosArmas=ccodigosarmas; + } + //filtro de los estados de las armas + if (estadosArma != null) { + sqlFiltroEstados=estadosArma;//estado distinto de destruidas - cambiodepropietario - vendidas - decomisadas - suspendida - cancelada - incautada + } + if(codigopersona!=null && !codigopersona.equals("null") && codigopersona.trim().length()>1){ + sqlFiltroEstados=sqlFiltroEstados+" and t.cregistro in (select per from TarmRegistroArmas per where per.personcode="+codigopersona+") and ((select tae.clase from TarmTipoArmaExplosivo tae WHERE tae.pk = t.ctipoarmaexplosivo) in ('0010000001','0010000008'))"; + } + + dto.setOrderby("pk"); + String sqlActual = " t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma) " + + " and (t.peso>0 or t.cantidad>0)";// and (t.cregistro=ta.cregistro) para el manejo de los explosivos + String sqlFinal = obtenerFiltroBusquedaGeneral(sqlFiltroEstados, sqlFiltroCodigosArmas, sqlActual); + Filter filtroFinal = new Filter(); + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + cargarPropietario(); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para buscar el propietario del arma y asignarle al arma + */ + private void cargarPropietario(){ + for(TarmArmas arma:this.lrecord){ + //asigmnamos un valor al arma para ordenarla + arma.getModifiedData().put("ordenarma",arma.getPk()); + if(arma.getModifiedData().get("personcode")!=null){ + TcustPersonDetail personaDetalle=PersonDetailController.find(arma.getModifiedData().get("personcode").toString()); + arma.getModifiedData().put("propietario", personaDetalle.getName()); + arma.getModifiedData().put("noDocumento", personaDetalle.getIdentification()); + } + } + } + + private String obtenerFiltroBusquedaGeneral(String... sqlFiltros ){ + StringBuffer sqlFinal = new StringBuffer(); + for (int i = 0; i < sqlFiltros.length ; i++) { + if(sqlFinal.length() > 0 && !StringUtils.endsWith(StringUtils.trim(sqlFinal.toString()), "AND")){ + sqlFinal.append( " AND "); + } + sqlFinal.append(sqlFiltros[i]); + } + return sqlFinal.toString(); + } + + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception{ + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryPaisOrigen= new SubQuery("TgeneCountry","description","paisorigen","i.pk=t.cpaisorigen"); + dto.addSubQuery(subqueryPaisOrigen); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TarmTipoArmaExplosivo","clase","cclase","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo= new SubQuery("TarmTipoArmaExplosivo","clasecodigo","cclasecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud= new SubQuery("TarmTipoArmaExplosivo","longitud","clongitud","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo= new SubQuery("TarmTipoArmaExplosivo","longitudcodigo","clongitudcodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ccalibre","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo= new SubQuery("TarmTipoArmaExplosivo","calibrecodigo","ccalibrecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivo","ctipoarmaexplosivo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivocodigo","ctipoarmaexplosivocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapeso","cunidadmedidapeso","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapesocodigo","cunidadmedidapesocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida= new SubQuery("TgeneCatalogDetail","description","unidadmedida","i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode= new SubQuery("TarmRegistroArmas","personcode","personcode","i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + SubQuery subqueryTipo= new SubQuery("TgeneCatalogDetail","description","tipo","i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipo); + SubQuery subqueryTipoArmaExplosivo= new SubQuery("TgeneCatalogDetail","description","tipoarmaexplosivo","i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + SubQuery subqueryClasecatalogo= new SubQuery("TgeneCatalogDetail","description","clase","i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClasecatalogo); + SubQuery subqueryUnidadTipo= new SubQuery("TgeneCatalogDetail","description","unidadmedidadesc","i.pk.catalog= (select o.unidadmedidapeso from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryUnidadTipo); +// SubQuery subqueryestadopermiso= new SubQuery("TgeneCatalogDetail","description","estadopermiso", +// "i.pk.catalog=(select dh.estado from TarmDocumentoHabilitante dh where dh.personcode = (select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) and dh.carma = t.pk)" +// + "and i.pk.catalogcode=(select dh.estadocode from TarmDocumentoHabilitante dh where dh.personcode = (select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) and dh.carma = t.pk)"); +// dto.addSubQuery(subqueryestadopermiso); + + + + SubQuery subqueryFechaemiperm= new SubQuery("TarmDocumentoHabilitante","fechaemision","fechaemision", + //" i.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) and i.carma = t.pk and "+ + " i.pk=(select max(doc.pk) from TarmDocumentoHabilitante doc where doc.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro)" + + " and doc.carma in (select arm1.pk from TarmArmas arm1 where arm1.codigoarma in (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))"); + dto.addSubQuery(subqueryFechaemiperm); + SubQuery subqueryFechaexpperm= new SubQuery("TarmDocumentoHabilitante","fechaexpiracion","fechaexpiracion", + // " i.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) and i.carma = t.pk and "+ + " i.pk=(select max(doc.pk) from TarmDocumentoHabilitante doc where doc.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) " + + "and doc.carma in (select arm1.pk from TarmArmas arm1 where arm1.codigoarma in (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))"); + dto.addSubQuery(subqueryFechaexpperm); + return dto; + } + + @Override + public void save() { + try { + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog() { + Listarmas=new ArrayList(); + armas.add(this.record); + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(armas); + } + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog(TarmArmas tarmArmas) { + Listarmas=new ArrayList(); + armas.add(tarmArmas); + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(armas); + } + + public void selecionaTodos(){ + RequestContext.getCurrentInstance().closeDialog(lrecord); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 1200); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/certArmasLov.xhtml", options, params); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/PlanificacionTramiteLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/PlanificacionTramiteLovController.java.svn-base new file mode 100644 index 0000000..6fd6449 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/PlanificacionTramiteLovController.java.svn-base @@ -0,0 +1,155 @@ +package com.fp.frontend.controller.armas.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.ins.TarmPlanificacionInspeccion; +import com.fp.persistence.parmas.ins.TarmPlanificacionTramite; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author c.p. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class PlanificacionTramiteLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + String centrocontrol; + public PlanificacionTramiteLovController() throws Exception { + super(TarmPlanificacionTramite.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + try { + centrocontrol = CallerHelper.getLovParameter("centrocontrol"); +// if (centrocontrol != null) { +// super.addFilter("personcode", centrocontrol);f +// } + super.startQuery(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOGLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if (centrocontrol != null) { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.mes , 9 "); + + Filter filtro= new Filter(); + filtro.setSql("(inspeccion is null or inspeccion != 'Y') and cplanificacion in (select o.pk from TarmPlanificacionInspeccion o where o.ccentrocontrol='"+centrocontrol.trim()+"' and aprobada='Y')"); + dto.addFiltro(filtro); + + SubQuery subqueryName = new SubQuery("TcustPersonDetail", "name", "name", + " i.pk.personcode = (select o.personcode from TarmDocumentoHabilitante o where o.pk=t.cdocumento)" + + " and i.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryName); + + SubQuery subqueryCodigoPlanificacion = new SubQuery("TarmPlanificacionInspeccion", "codigo", "codigoplanificacion", " i.pk = t.cplanificacion"); + dto.addSubQuery(subqueryCodigoPlanificacion); + + SubQuery subqueryPersoncode = new SubQuery("TarmDocumentoHabilitante", "personcode", "personcode", " i.pk = t.cdocumento"); + dto.addSubQuery(subqueryPersoncode); + + + SubQuery subqueryIdentificacion = new SubQuery("TcustPersonDetail", "identification", "identification", + " i.pk.personcode = (select o.personcode from TarmDocumentoHabilitante o where o.pk=t.cdocumento)" + + " and i.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryIdentificacion); + + SubQuery subqueryTramite = new SubQuery("TgeneCatalogDetail", "description", "tramite", + " i.pk.catalog = (select o.tipotramite from TarmTramite o where o.pk=t.ctramite) " + + " and i.pk.catalogcode=(select o.tipotramitecodigo from TarmTramite o where o.pk=t.ctramite)"); + dto.addSubQuery(subqueryTramite); + + SubQuery subqueryCategoria = new SubQuery("TgeneCatalogDetail", "description", "categoria", + " i.pk.catalog = (select o.categoria from TarmTramite o where o.pk=t.ctramite) " + + " and i.pk.catalogcode=(select o.categoriacodigo from TarmTramite o where o.pk=t.ctramite)"); + dto.addSubQuery(subqueryCategoria); + + SubQuery subqueryUsoActividad = new SubQuery("TgeneCatalogDetail", "description", "usoactividad", + " i.pk.catalog = (select o.usoactividad from TarmTramite o where o.pk=t.ctramite) " + + " and i.pk.catalogcode=(select o.usoactividadcodigo from TarmTramite o where o.pk=t.ctramite)"); + dto.addSubQuery(subqueryUsoActividad); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + }else{ + MessageHelper.setMessageError("NO TIENE ASIGNADO UN CENTRO DE CONTROL"); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setcatalog() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setcatalog(TarmPlanificacionTramite tarmPlanificacionTramite) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tarmPlanificacionTramite); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/planificacionTramiteLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/SancionarLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/SancionarLovController.java.svn-base new file mode 100644 index 0000000..3942ed6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/SancionarLovController.java.svn-base @@ -0,0 +1,164 @@ +package com.fp.frontend.controller.armas.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTipoSancion; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + + +/** + * Clase controladora del lov asociado al bean TarmTipoSancion. + * + * @author Andres Cevallos. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class SancionarLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + private String clase; + //static List ltiposancion; + private String tramite; + public List lsancion; + //private List tsancion; + public SancionarLovController() throws Exception { + super(TarmTipoSancion.class); + } + +// public static List getLtiposancion() { +// return ltiposancion; +// } + + public List getLsancion() { + return lsancion; + } + + public void setLsancion(List lsancion) { + this.lsancion = lsancion; + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOGLOV"; + String clase = CallerHelper.getLovParameter("clase"); + String tramite = CallerHelper.getLovParameter("tramite"); + if(clase!=null){ + this.getMfilters().put("clase", clase); + } + if(tramite!=null){ + this.getMfilters().put("tramite", tramite); + } + lsancion = CatalogDetailController.find("TIPODEFALTA"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + // Subquery + SubQuery subqueryClase = new SubQuery("TgeneCatalogDetail", "description", "nclase", "i.pk.catalog = t.clase and i.pk.catalogcode = t.clasecodigo"); + dto.addSubQuery(subqueryClase); + + SubQuery subqueryFalta = new SubQuery("TgeneCatalogDetail", "description", "nfalta", "i.pk.catalog = t.falta and i.pk.catalogcode = t.faltacodigo"); + dto.addSubQuery(subqueryFalta); + + SubQuery subqueryTipoFalta = new SubQuery("TgeneCatalogDetail", "description", "ntipoFalta", "i.pk.catalog = t.tipofalta and i.pk.catalogcode = t.tipofaltacodigo"); + dto.addSubQuery(subqueryTipoFalta); + + SubQuery subqueryTramite = new SubQuery("TgeneCatalogDetail", "description", "ntramite", "i.pk.catalog = t.tramite and i.pk.catalogcode = t.tramitecodigo"); + dto.addSubQuery(subqueryTramite); + + SubQuery subquerySancion = new SubQuery("TgeneCatalogDetail", "description", "nsancion", "i.pk.catalog = t.sancion and i.pk.catalogcode = t.sancioncodigo"); + dto.addSubQuery(subquerySancion); + + SubQuery subqueryTiempo = new SubQuery("TgeneCatalogDetail", "description", "ntiempo", "i.pk.catalog = t.tiempo and i.pk.catalogcode = t.tiempocodigo"); + dto.addSubQuery(subqueryTiempo); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setcatalog() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setcatalog(TarmTipoSancion tarmTipoSancion) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tarmTipoSancion); + } + + public static void openLov(Map> params) {//, List tsancion + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 850); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/sancionarLov.xhtml", options, params); + } + +// public List getTsancion() { +// return tsancion; +// } +// +// public void setTsancion(List tsancion) { +// this.tsancion = tsancion; +// } +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/SitioAlmacenamientoLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/SitioAlmacenamientoLovController.java.svn-base new file mode 100644 index 0000000..c1063c9 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/SitioAlmacenamientoLovController.java.svn-base @@ -0,0 +1,133 @@ +package com.fp.frontend.controller.armas.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmSitioAlmacenamiento; +import com.fp.persistence.pgeneral.gene.TgeneCityKey; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class SitioAlmacenamientoLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public SitioAlmacenamientoLovController() throws Exception { + super(TarmSitioAlmacenamiento.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + try { + String codeperson = CallerHelper.getLovParameter("personcode"); + if (codeperson != null) { + super.addFilter("personcode", codeperson); + this.querydatabase(); + } + super.startQuery(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 200; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOGLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + this.addFilter("estado", "ACT"); + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + SubQuery subqueryProvincia = new SubQuery("TgeneProvince", "description", "provincia", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode"); + dto.addSubQuery(subqueryProvincia); + + SubQuery subqueryCanton = new SubQuery("TgeneCanton", "description", "canton", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode and i.pk.cantoncode=t.cantoncode"); + dto.addSubQuery(subqueryCanton); + + SubQuery subqueryCiudad = new SubQuery("TgeneCity", "description", "ciudad", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode and i.pk.cantoncode=t.cantoncode "); + dto.addSubQuery(subqueryCiudad); + + SubQuery subqueryParroquia = new SubQuery("TgeneParroquia", "description", "parroquia", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode and i.pk.cantoncode=t.cantoncode and i.pk.parroquiacode=t.parroquiacode"); + dto.addSubQuery(subqueryParroquia); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setcatalog() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setcatalog(TarmSitioAlmacenamiento tarmSitioAlmacenamiento) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tarmSitioAlmacenamiento); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/sitioAlmacenamientoLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/UnidadTipoLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/UnidadTipoLovController.java.svn-base new file mode 100644 index 0000000..785d160 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/.svn/text-base/UnidadTipoLovController.java.svn-base @@ -0,0 +1,259 @@ +package com.fp.frontend.controller.armas.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.ClaseLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmUnidadTipo; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del lov asociado al bean TarmUnidTipo. + * + * @author C.P. + * @version 2.1 + */ +/** + * @author User + * + */ +@ManagedBean +@ViewScoped +public class UnidadTipoLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private String descripcionClase; + private String descripcionTipoArma; + private String codigoClase; + private String btnAcctivar; + + @ManagedProperty(value = "#{claseLovController}") + private ClaseLovController claseLovController; + + public UnidadTipoLovController() throws Exception { + super(TarmUnidadTipo.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; + this.lrecord = new ArrayList<>(); + this.beanalias = "UNIDADTIPO"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + //dto.setOrderby("t.pk"); + SubQuery sclasearma= new SubQuery + ("TgeneCatalogDetail", "description", "desclasearma", "i.pk.catalog = t.pk.clase and i.pk.catalogcode=t.pk.clasecode"); + SubQuery stipoarma= new SubQuery + ("TgeneCatalogDetail", "description", "destipoarma", "i.pk.catalog = t.pk.tipoarmaexplosivo and i.pk.catalogcode=t.pk.tipoarmaexplosivocodigo"); + SubQuery sunidad= new SubQuery + ("TgeneCatalogDetail", "description", "desunidad", "i.pk.catalog = t.pk.unidadmedidapeso and i.pk.catalogcode=t.pk.unidadmedidapesocodigo"); + dto.addSubQuery(stipoarma); + dto.addSubQuery(sclasearma); + dto.addSubQuery(sunidad); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + //busquedas desde en un dialogo + public void openClaseLov() { + try { + btnAcctivar="clase"; + claseLovController.setLrecord(new ArrayList()); + claseLovController.getMfilters().clear(); + claseLovController.getMfilters().put("pk.catalogcode", "CLASE"); + claseLovController.query(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + //del catalogo para la clase + private TgeneCatalogDetail sel; + + public void setcatalogDialog(TgeneCatalogDetail tgeneCatalog) { + sel = tgeneCatalog; + super.getMfilters().put("pk.clase", sel.getPk().getCatalog()); + descripcionClase=sel.getDescription(); + codigoClase=sel.getPk().getCatalog(); + claseLovController.setLrecord(new ArrayList()); + claseLovController.getMfilters().clear(); + super.getMfilters().put("pk.tipoarmaexplosivo", null); + descripcionTipoArma=null; + } + + //busquedas desde en un dialogo + public void openTipoArmaDialog() { + try { + if(codigoClase==null || codigoClase.trim().length()==0){ + MessageHelper.setMessageError("SELECCIONE LA CLASE"); + return; + } + claseLovController.setLrecord(new ArrayList()); + claseLovController.getMfilters().clear(); + btnAcctivar="tipoArma"; + String legalcode=""; + String legalcode2 =""; + Listlista=CatalogDetailController.find("LONGITUD", codigoClase); + if(lista!=null){ + for(TgeneCatalogDetail catalogo:lista){ + if(legalcode==null || legalcode.length()==0){ + legalcode+= catalogo.getPk().getCatalog(); + }else if(legalcode2==null || legalcode2.length()==0){ + legalcode2+=" legalcode= '"+catalogo.getPk().getCatalog()+"'"; + }else{ + legalcode2+=" or t.legalcode= '"+catalogo.getPk().getCatalog()+"'"; + } + } + }else{ + legalcode=codigoClase; + } + claseLovController.getMfilters().put("pk.catalogcode", "TIPOARMAEXPLOSIVO"); + + if (legalcode != null && legalcode.trim().length()>0) { + if (legalcode2 != null && legalcode2.trim().length()>0) { + claseLovController.getMfilters().put(legalcode2+" or t.legalcode", legalcode); + }else{ + claseLovController.getMfilters().put("legalcode", legalcode); + } + } + + claseLovController.query(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + //del catalogo para la clase + + public void setDialogTipoArma(TgeneCatalogDetail tgeneCatalog) { + sel = tgeneCatalog; + super.getMfilters().put("pk.tipoarmaexplosivo", sel.getPk().getCatalog()); + descripcionTipoArma=sel.getDescription(); + claseLovController.setLrecord(new ArrayList()); + claseLovController.getMfilters().clear(); + } + + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/unidadTipoLov.xhtml", options, params); + } + + public void setunidTipo() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setunidTipo(TarmUnidadTipo tarmUnidadTipo) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tarmUnidadTipo); + } + + public String getDescripcionClase() { + return descripcionClase; + } + + public void setDescripcionClase(String descripcionClase) { + this.descripcionClase = descripcionClase; + } + + public String getDescripcionTipoArma() { + return descripcionTipoArma; + } + + public void setDescripcionTipoArma(String descripcionTipoArma) { + this.descripcionTipoArma = descripcionTipoArma; + } + + public TgeneCatalogDetail getSel() { + return sel; + } + + public void setSel(TgeneCatalogDetail sel) { + this.sel = sel; + } + + public ClaseLovController getClaseLovController() { + return claseLovController; + } + + public void setClaseLovController(ClaseLovController claseLovController) { + this.claseLovController = claseLovController; + } + + public String getBtnAcctivar() { + return btnAcctivar; + } + + public void setBtnAcctivar(String btnAcctivar) { + this.btnAcctivar = btnAcctivar; + } + + public String getCodigoClase() { + return codigoClase; + } + + public void setCodigoClase(String codigoClase) { + this.codigoClase = codigoClase; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/lov/ArmaExplosivoLovController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/ArmaExplosivoLovController.java new file mode 100644 index 0000000..c5f50f1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/ArmaExplosivoLovController.java @@ -0,0 +1,182 @@ +package com.fp.frontend.controller.armas.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author C.P. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ArmaExplosivoLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private String tituloLOV; + private String categoriaParam; + + private String descripcionClase; + private String descripcionTipo; + + public ArmaExplosivoLovController() throws Exception { + super(TarmTipoArmaExplosivo.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + tituloLOV = CallerHelper.getLovParameter("tituloLOV"); + categoriaParam = CallerHelper.getLovParameter("categoria"); + if (categoriaParam != null) { + categoriaParam = " and t.clase in ('" + categoriaParam + "')"; + categoriaParam = categoriaParam.replace(",", "','"); + } + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TIPOARMAEXPLOSIVOLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + + SubQuery subqueryClase = new SubQuery("TgeneCatalogDetail", "description", "nclase", "i.pk.catalog = t.clase and i.pk.catalogcode = t.clasecodigo"); + dto.addSubQuery(subqueryClase); + + SubQuery subqueryTipoArmaExplosivo = new SubQuery("TgeneCatalogDetail", "description", "ntipo", "i.pk.catalog = t.tipoarmaexplosivo and i.pk.catalogcode = t.tipoarmaexplosivocodigo"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + + SubQuery subqueryLongitud = new SubQuery("TgeneCatalogDetail", "description", "nlongitud", "i.pk.catalog = t.longitud and i.pk.catalogcode = t.longitudcodigo"); + dto.addSubQuery(subqueryLongitud); + + SubQuery subqueryCalibre = new SubQuery("TgeneCatalogDetail", "description", "ncalibre", "i.pk.catalog = t.calibre and i.pk.catalogcode = t.calibrecodigo"); + dto.addSubQuery(subqueryCalibre); + + SubQuery subunidad = new SubQuery("TgeneCatalogDetail", "description", "desunidad", "i.pk.catalog = t.pk.unidadmedidapeso and i.pk.catalogcode=t.pk.unidadmedidapesocodigo"); + dto.addSubQuery(subunidad); + + SubQuery subunidadlegalcode = new SubQuery("TgeneCatalogDetail", "legalcode", "deslegalcode", "i.pk.catalog = t.pk.unidadmedidapeso and i.pk.catalogcode=t.pk.unidadmedidapesocodigo"); + dto.addSubQuery(subunidadlegalcode); + String sql = " 1=1 "; + + if (descripcionClase != null && descripcionClase.trim().length() > 0) { + sql = sql + " and clase in (select o.pk.catalog from TgeneCatalogDetail o where o.description like '%" + descripcionClase + "%' and o.pk.catalogcode='CLASE')"; + }//TarmTipoArmaExplosivo + + if (descripcionTipo != null && descripcionTipo.trim().length() > 0) { + sql = sql + " and tipoarmaexplosivo in (select o.pk.catalog from TgeneCatalogDetail o where o.description like '%" + descripcionTipo + "%' and o.pk.catalogcode='TIPOARMAEXPLOSIVO')"; //TarmTipoArmaExplosivo//catalogcode + } + + Filter filtro = new Filter(); + sql += categoriaParam != null ? categoriaParam : ""; + filtro.setSql(sql); //TarmTipoArmaExplosivo//catalogcode + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setcatalog() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setcatalog(TarmTipoArmaExplosivo armaExplosivo) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(armaExplosivo); + } + + public String getTituloLOV() { + return tituloLOV; + } + + public void setTituloLOV(String tituloLOV) { + this.tituloLOV = tituloLOV; + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/armaExplosivoLov.xhtml", options, params); + } + + public String getDescripcionClase() { + return descripcionClase; + } + + public void setDescripcionClase(String descripcionClase) { + this.descripcionClase = descripcionClase; + } + + public String getDescripcionTipo() { + return descripcionTipo; + } + + public void setDescripcionTipo(String descripcionTipo) { + this.descripcionTipo = descripcionTipo; + } + + public String getCategoriaParam() { + return categoriaParam; + } + + public void setCategoriaParam(String categoriaParam) { + this.categoriaParam = categoriaParam; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/lov/ArmasLovController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/ArmasLovController.java new file mode 100644 index 0000000..861f0eb --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/ArmasLovController.java @@ -0,0 +1,269 @@ +package com.fp.frontend.controller.armas.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.apache.commons.lang3.StringUtils; +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; + +/** + * Controlador principal de armas + * + * @author C.P. + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ArmasLovController extends AbstractController { + + private String ccodigosarmas; + private String estadosArma; + private String codigopersona; + + public ArmasLovController() throws Exception { + super(TarmArmas.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + try { + ccodigosarmas = CallerHelper.getLovParameter("ccodigosarmas"); + estadosArma = CallerHelper.getLovParameter("estadosarmas"); + codigopersona = CallerHelper.getLovParameter("codigopersona"); + super.startQuery(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + recperpage = 5000; // Cambiar al # reg a mirar. + record = new TarmArmas(); + lrecord = new ArrayList<>(); + beanalias = "ARMAS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + String sqlFiltroEstados = ""; + String sqlFiltroCodigosArmas = "";//1 + + String sqlFiltroEstadosDec = (String) this.getMfilelds().get("codigosarmasdec"); + String sqlFiltroCodigosArmasDec = (String) this.getMfilelds().get("estadosarmasdec"); + + //codigos de las armas seleccionadas + if (ccodigosarmas != null) { + sqlFiltroCodigosArmas = ccodigosarmas; + } + //filtro de los estados de las armas + if (estadosArma != null) { + sqlFiltroEstados = estadosArma;//estado distinto de destruidas - cambiodepropietario - vendidas - decomisadas - suspendida - cancelada - incautada + } + if (codigopersona != null && !codigopersona.equals("null") && codigopersona.trim().length() > 1) { + sqlFiltroEstados = sqlFiltroEstados + " and t.cregistro in (select per from TarmRegistroArmas per where per.personcode=" + codigopersona + ")"; + } + + dto.setOrderby("pk"); + String sqlActual = " t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) " + + " and (t.peso>0 or t.cantidad>0)";// and (t.cregistro=ta.cregistro) para el manejo de los explosivos + String sqlFinal = obtenerFiltroBusquedaGeneral(sqlFiltroEstadosDec, sqlFiltroCodigosArmasDec, sqlFiltroEstados, sqlFiltroCodigosArmas, sqlActual); + System.out.println("SQL ARMA: " + sqlFinal); + Filter filtroFinal = new Filter(); + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + cargarPropietario(); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para buscar el propietario del arma y asignarle al arma + */ + private void cargarPropietario() { + for (TarmArmas arma : this.lrecord) { + //asigmnamos un valor al arma para ordenarla + arma.getModifiedData().put("ordenarma", arma.getPk()); + if (arma.getModifiedData().get("personcode") != null) { + TcustPersonDetail personaDetalle = PersonDetailController.find(arma.getModifiedData().get("personcode").toString()); + arma.getModifiedData().put("propietario", personaDetalle.getName()); + arma.getModifiedData().put("noDocumento", personaDetalle.getIdentification()); + } + } + } + + private String obtenerFiltroBusquedaGeneral(String... sqlFiltros) { + StringBuffer sqlFinal = new StringBuffer(); + for (int i = 0; i < sqlFiltros.length; i++) { + if (sqlFinal.length() > 0 && !StringUtils.endsWith(StringUtils.trim(sqlFinal.toString()), "AND")) { + sqlFinal.append(" AND "); + } + sqlFinal.append(sqlFiltros[i]); + } + return sqlFinal.toString(); + } + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryPaisOrigen = new SubQuery("TgeneCountry", "description", "paisorigen", "i.pk=t.cpaisorigen"); + dto.addSubQuery(subqueryPaisOrigen); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", "i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase = new SubQuery("TarmTipoArmaExplosivo", "clase", "cclase", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo = new SubQuery("TarmTipoArmaExplosivo", "clasecodigo", "cclasecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud = new SubQuery("TarmTipoArmaExplosivo", "longitud", "clongitud", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo = new SubQuery("TarmTipoArmaExplosivo", "longitudcodigo", "clongitudcodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre = new SubQuery("TarmTipoArmaExplosivo", "calibre", "ccalibre", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo = new SubQuery("TarmTipoArmaExplosivo", "calibrecodigo", "ccalibrecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivo", "ctipoarmaexplosivo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivocodigo", "ctipoarmaexplosivocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapeso", "cunidadmedidapeso", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapesocodigo", "cunidadmedidapesocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida = new SubQuery("TgeneCatalogDetail", "description", "unidadmedida", "i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode = new SubQuery("TarmRegistroArmas", "personcode", "personcode", "i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + SubQuery subqueryTipo = new SubQuery("TgeneCatalogDetail", "description", "tipo", "i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipo); + SubQuery subqueryTipoArmaExplosivo = new SubQuery("TgeneCatalogDetail", "description", "tipoarmaexplosivo", "i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + SubQuery subqueryClasecatalogo = new SubQuery("TgeneCatalogDetail", "description", "clase", "i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClasecatalogo); + SubQuery subqueryUnidadTipo = new SubQuery("TgeneCatalogDetail", "description", "unidadmedidadesc", "i.pk.catalog= (select o.unidadmedidapeso from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryUnidadTipo); +// SubQuery subqueryestadopermiso= new SubQuery("TgeneCatalogDetail","description","estadopermiso", +// "i.pk.catalog=(select dh.estado from TarmDocumentoHabilitante dh where dh.personcode = (select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) and dh.carma = t.pk)" +// + "and i.pk.catalogcode=(select dh.estadocode from TarmDocumentoHabilitante dh where dh.personcode = (select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) and dh.carma = t.pk)"); +// dto.addSubQuery(subqueryestadopermiso); + + SubQuery subqueryFechaemiperm = new SubQuery("TarmDocumentoHabilitante", "fechaemision", "fechaemision", + //" i.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) and i.carma = t.pk and "+ + " i.pk=(select max(doc.pk) from TarmDocumentoHabilitante doc where doc.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro)" + + " and doc.carma in (select arm1.pk from TarmArmas arm1 where arm1.codigoarma in (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))"); + dto.addSubQuery(subqueryFechaemiperm); + SubQuery subqueryFechaexpperm = new SubQuery("TarmDocumentoHabilitante", "fechaexpiracion", "fechaexpiracion", + // " i.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) and i.carma = t.pk and "+ + " i.pk=(select max(doc.pk) from TarmDocumentoHabilitante doc where doc.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) " + + "and doc.carma in (select arm1.pk from TarmArmas arm1 where arm1.codigoarma in (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))"); + dto.addSubQuery(subqueryFechaexpperm); + return dto; + } + + @Override + public void save() { + try { + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog() { + List armas = new ArrayList(); + armas.add(this.record); + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(armas); + } + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog(TarmArmas tarmArmas) { + List armas = new ArrayList(); + armas.add(tarmArmas); + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(armas); + } + + public void selecionaTodos() { + RequestContext.getCurrentInstance().closeDialog(lrecord); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 1200); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/armasLov.xhtml", options, params); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/lov/CargasLovController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/CargasLovController.java new file mode 100644 index 0000000..a52c65f --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/CargasLovController.java @@ -0,0 +1,143 @@ +package com.fp.frontend.controller.armas.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del lov asociado al bean TarmCarga. + * + * @author Christian Pazmino + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class CargasLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private String tituloLOV; + private String personcode; + + public CargasLovController() throws Exception { + super(TarmCarga.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + personcode = CallerHelper.getLovParameter("personcode"); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 500; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CARGASLOV"; + this.querydatabase(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.fecha desc"); + String sql = ""; + if (personcode != null) { + sql = "t.esdesaduanizado = 'N' and t.tipocarga='IMP' and t.personcode =" + personcode; + // Filtro para la TX 30-20 + if (!this.getLoginController().getRequest().getTransactionCode().equals(37)) { + sql = sql + " and t.csolicitud is null"; + } + } else { + MessageHelper.setMessageError("EL CODIGO DE PERSONA ES REQUERIDO"); + return; + } + Filter filtro = new Filter(); + filtro.setSql(sql); //TarmTipoArmaExplosivo//catalogcode + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setCarga() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setCarga(TarmCarga carga) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(carga); + } + + public String getTituloLOV() { + return tituloLOV; + } + + public void setTituloLOV(String tituloLOV) { + this.tituloLOV = tituloLOV; + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/cargasLov.xhtml", options, params); + } + + public String getPersoncode() { + return personcode; + } + + public void setPersoncode(String personcode) { + this.personcode = personcode; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/lov/CatalogoArmaLovController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/CatalogoArmaLovController.java new file mode 100644 index 0000000..f53e051 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/CatalogoArmaLovController.java @@ -0,0 +1,123 @@ +package com.fp.frontend.controller.armas.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author C.P. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class CatalogoArmaLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private String tituloLOV; + + public CatalogoArmaLovController() throws Exception { + super(TgeneCatalogDetail.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + tituloLOV = CallerHelper.getLovParameter("tituloLOV"); + String catalogcode = CallerHelper.getLovParameter("catalogcode"); + if (catalogcode != null) { + super.addFilter("pk.catalogcode", catalogcode); + } + String legalcode = CallerHelper.getLovParameter("legalcode"); + if (catalogcode != null) { + super.addFilter("legalcode", legalcode); + } + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CLASELOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setcatalog() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setcatalog(TgeneCatalogDetail tgeneCatalogDetail) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneCatalogDetail); + } + + public String getTituloLOV() { + return tituloLOV; + } + + public void setTituloLOV(String tituloLOV) { + this.tituloLOV = tituloLOV; + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/catalogoArmaLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/lov/CentroControlLovController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/CentroControlLovController.java new file mode 100644 index 0000000..ea20219 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/CentroControlLovController.java @@ -0,0 +1,96 @@ +package com.fp.frontend.controller.armas.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class CentroControlLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public CentroControlLovController() throws Exception { + super(TgeneCatalogDetail.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + try { + /* String codeperson = CallerHelper.getLovParameter("personcode"); + if (codeperson != null) { + super.addFilter("personcode", codeperson); + }*/ + super.startQuery(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CENTROCONTROLLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + List listaCatalogoDetail = CatalogDetailController.find("NOMBREINSTITUCION"); + for (TgeneCatalogDetail catalogDetail : listaCatalogoDetail) { + record = catalogDetail; + System.out.println("***********" + catalogDetail.getDescription()); + } + System.out.println("Fin"); + this.lrecord = listaCatalogoDetail; + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setcatalog(TgeneCatalogDetail catalogD) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(catalogD); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/centroControlLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/lov/CertArmasLovController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/CertArmasLovController.java new file mode 100644 index 0000000..0f7a946 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/CertArmasLovController.java @@ -0,0 +1,267 @@ +package com.fp.frontend.controller.armas.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.apache.commons.lang3.StringUtils; +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; + +/** + * Controlador principal de armas + * + * @author C.P. + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CertArmasLovController extends AbstractController { + + private String ccodigosarmas; + private String estadosArma; + private String codigopersona; + + public CertArmasLovController() throws Exception { + super(TarmArmas.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + try { + ccodigosarmas = CallerHelper.getLovParameter("ccodigosarmas"); + estadosArma = CallerHelper.getLovParameter("estadosarmas"); + codigopersona = CallerHelper.getLovParameter("codigopersona"); + if (codigopersona != null && !codigopersona.equalsIgnoreCase("")) { + querydatabase(); + } +// super.startQuery(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + recperpage = 5000; // Cambiar al # reg a mirar. + record = new TarmArmas(); + lrecord = new ArrayList<>(); + beanalias = "ARMAS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + String sqlFiltroEstados = ""; + String sqlFiltroCodigosArmas = "";//1 + //codigos de las armas seleccionadas + if (ccodigosarmas != null) { + sqlFiltroCodigosArmas = ccodigosarmas; + } + //filtro de los estados de las armas + if (estadosArma != null) { + sqlFiltroEstados = estadosArma;//estado distinto de destruidas - cambiodepropietario - vendidas - decomisadas - suspendida - cancelada - incautada + } + if (codigopersona != null && !codigopersona.equals("null") && codigopersona.trim().length() > 1) { + sqlFiltroEstados = sqlFiltroEstados + " and t.cregistro in (select per from TarmRegistroArmas per where per.personcode=" + codigopersona + ") and ((select tae.clase from TarmTipoArmaExplosivo tae WHERE tae.pk = t.ctipoarmaexplosivo) in ('0010000001','0010000008'))"; + } + + dto.setOrderby("pk"); + String sqlActual = " t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma) " + + " and (t.peso>0 or t.cantidad>0)";// and (t.cregistro=ta.cregistro) para el manejo de los explosivos + String sqlFinal = obtenerFiltroBusquedaGeneral(sqlFiltroEstados, sqlFiltroCodigosArmas, sqlActual); + Filter filtroFinal = new Filter(); + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + cargarPropietario(); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para buscar el propietario del arma y asignarle al arma + */ + private void cargarPropietario() { + for (TarmArmas arma : this.lrecord) { + //asigmnamos un valor al arma para ordenarla + arma.getModifiedData().put("ordenarma", arma.getPk()); + if (arma.getModifiedData().get("personcode") != null) { + TcustPersonDetail personaDetalle = PersonDetailController.find(arma.getModifiedData().get("personcode").toString()); + arma.getModifiedData().put("propietario", personaDetalle.getName()); + arma.getModifiedData().put("noDocumento", personaDetalle.getIdentification()); + } + } + } + + private String obtenerFiltroBusquedaGeneral(String... sqlFiltros) { + StringBuffer sqlFinal = new StringBuffer(); + for (int i = 0; i < sqlFiltros.length; i++) { + if (sqlFinal.length() > 0 && !StringUtils.endsWith(StringUtils.trim(sqlFinal.toString()), "AND")) { + sqlFinal.append(" AND "); + } + sqlFinal.append(sqlFiltros[i]); + } + return sqlFinal.toString(); + } + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryPaisOrigen = new SubQuery("TgeneCountry", "description", "paisorigen", "i.pk=t.cpaisorigen"); + dto.addSubQuery(subqueryPaisOrigen); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", "i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase = new SubQuery("TarmTipoArmaExplosivo", "clase", "cclase", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo = new SubQuery("TarmTipoArmaExplosivo", "clasecodigo", "cclasecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud = new SubQuery("TarmTipoArmaExplosivo", "longitud", "clongitud", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo = new SubQuery("TarmTipoArmaExplosivo", "longitudcodigo", "clongitudcodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre = new SubQuery("TarmTipoArmaExplosivo", "calibre", "ccalibre", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo = new SubQuery("TarmTipoArmaExplosivo", "calibrecodigo", "ccalibrecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivo", "ctipoarmaexplosivo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivocodigo", "ctipoarmaexplosivocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapeso", "cunidadmedidapeso", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapesocodigo", "cunidadmedidapesocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida = new SubQuery("TgeneCatalogDetail", "description", "unidadmedida", "i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode = new SubQuery("TarmRegistroArmas", "personcode", "personcode", "i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + SubQuery subqueryTipo = new SubQuery("TgeneCatalogDetail", "description", "tipo", "i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipo); + SubQuery subqueryTipoArmaExplosivo = new SubQuery("TgeneCatalogDetail", "description", "tipoarmaexplosivo", "i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + SubQuery subqueryClasecatalogo = new SubQuery("TgeneCatalogDetail", "description", "clase", "i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClasecatalogo); + SubQuery subqueryUnidadTipo = new SubQuery("TgeneCatalogDetail", "description", "unidadmedidadesc", "i.pk.catalog= (select o.unidadmedidapeso from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryUnidadTipo); +// SubQuery subqueryestadopermiso= new SubQuery("TgeneCatalogDetail","description","estadopermiso", +// "i.pk.catalog=(select dh.estado from TarmDocumentoHabilitante dh where dh.personcode = (select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) and dh.carma = t.pk)" +// + "and i.pk.catalogcode=(select dh.estadocode from TarmDocumentoHabilitante dh where dh.personcode = (select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) and dh.carma = t.pk)"); +// dto.addSubQuery(subqueryestadopermiso); + + SubQuery subqueryFechaemiperm = new SubQuery("TarmDocumentoHabilitante", "fechaemision", "fechaemision", + //" i.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) and i.carma = t.pk and "+ + " i.pk=(select max(doc.pk) from TarmDocumentoHabilitante doc where doc.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro)" + + " and doc.carma in (select arm1.pk from TarmArmas arm1 where arm1.codigoarma in (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))"); + dto.addSubQuery(subqueryFechaemiperm); + SubQuery subqueryFechaexpperm = new SubQuery("TarmDocumentoHabilitante", "fechaexpiracion", "fechaexpiracion", + // " i.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) and i.carma = t.pk and "+ + " i.pk=(select max(doc.pk) from TarmDocumentoHabilitante doc where doc.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) " + + "and doc.carma in (select arm1.pk from TarmArmas arm1 where arm1.codigoarma in (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))"); + dto.addSubQuery(subqueryFechaexpperm); + return dto; + } + + @Override + public void save() { + try { + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog() { + List armas = new ArrayList(); + armas.add(this.record); + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(armas); + } + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog(TarmArmas tarmArmas) { + List armas = new ArrayList(); + armas.add(tarmArmas); + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(armas); + } + + public void selecionaTodos() { + RequestContext.getCurrentInstance().closeDialog(lrecord); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 1200); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/certArmasLov.xhtml", options, params); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/lov/PlanificacionTramiteLovController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/PlanificacionTramiteLovController.java new file mode 100644 index 0000000..64910fb --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/PlanificacionTramiteLovController.java @@ -0,0 +1,156 @@ +package com.fp.frontend.controller.armas.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.ins.TarmPlanificacionInspeccion; +import com.fp.persistence.parmas.ins.TarmPlanificacionTramite; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author c.p. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class PlanificacionTramiteLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + String centrocontrol; + + public PlanificacionTramiteLovController() throws Exception { + super(TarmPlanificacionTramite.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + try { + centrocontrol = CallerHelper.getLovParameter("centrocontrol"); +// if (centrocontrol != null) { +// super.addFilter("personcode", centrocontrol);f +// } + super.startQuery(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOGLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if (centrocontrol != null) { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.mes , 9 "); + + Filter filtro = new Filter(); + filtro.setSql("(inspeccion is null or inspeccion != 'Y') and cplanificacion in (select o.pk from TarmPlanificacionInspeccion o where o.ccentrocontrol='" + centrocontrol.trim() + "' and aprobada='Y')"); + dto.addFiltro(filtro); + + SubQuery subqueryName = new SubQuery("TcustPersonDetail", "name", "name", + " i.pk.personcode = (select o.personcode from TarmDocumentoHabilitante o where o.pk=t.cdocumento)" + + " and i.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryName); + + SubQuery subqueryCodigoPlanificacion = new SubQuery("TarmPlanificacionInspeccion", "codigo", "codigoplanificacion", " i.pk = t.cplanificacion"); + dto.addSubQuery(subqueryCodigoPlanificacion); + + SubQuery subqueryPersoncode = new SubQuery("TarmDocumentoHabilitante", "personcode", "personcode", " i.pk = t.cdocumento"); + dto.addSubQuery(subqueryPersoncode); + + SubQuery subqueryIdentificacion = new SubQuery("TcustPersonDetail", "identification", "identification", + " i.pk.personcode = (select o.personcode from TarmDocumentoHabilitante o where o.pk=t.cdocumento)" + + " and i.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryIdentificacion); + + SubQuery subqueryTramite = new SubQuery("TgeneCatalogDetail", "description", "tramite", + " i.pk.catalog = (select o.tipotramite from TarmTramite o where o.pk=t.ctramite) " + + " and i.pk.catalogcode=(select o.tipotramitecodigo from TarmTramite o where o.pk=t.ctramite)"); + dto.addSubQuery(subqueryTramite); + + SubQuery subqueryCategoria = new SubQuery("TgeneCatalogDetail", "description", "categoria", + " i.pk.catalog = (select o.categoria from TarmTramite o where o.pk=t.ctramite) " + + " and i.pk.catalogcode=(select o.categoriacodigo from TarmTramite o where o.pk=t.ctramite)"); + dto.addSubQuery(subqueryCategoria); + + SubQuery subqueryUsoActividad = new SubQuery("TgeneCatalogDetail", "description", "usoactividad", + " i.pk.catalog = (select o.usoactividad from TarmTramite o where o.pk=t.ctramite) " + + " and i.pk.catalogcode=(select o.usoactividadcodigo from TarmTramite o where o.pk=t.ctramite)"); + dto.addSubQuery(subqueryUsoActividad); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } else { + MessageHelper.setMessageError("NO TIENE ASIGNADO UN CENTRO DE CONTROL"); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setcatalog() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setcatalog(TarmPlanificacionTramite tarmPlanificacionTramite) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tarmPlanificacionTramite); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/planificacionTramiteLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/lov/SancionarLovController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/SancionarLovController.java new file mode 100644 index 0000000..7515ca3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/SancionarLovController.java @@ -0,0 +1,163 @@ +package com.fp.frontend.controller.armas.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTipoSancion; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del lov asociado al bean TarmTipoSancion. + * + * @author Andres Cevallos. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class SancionarLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + private String clase; + //static List ltiposancion; + private String tramite; + public List lsancion; + + //private List tsancion; + public SancionarLovController() throws Exception { + super(TarmTipoSancion.class); + } + +// public static List getLtiposancion() { +// return ltiposancion; +// } + public List getLsancion() { + return lsancion; + } + + public void setLsancion(List lsancion) { + this.lsancion = lsancion; + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOGLOV"; + String clase = CallerHelper.getLovParameter("clase"); + String tramite = CallerHelper.getLovParameter("tramite"); + if (clase != null) { + this.getMfilters().put("clase", clase); + } + if (tramite != null) { + this.getMfilters().put("tramite", tramite); + } + lsancion = CatalogDetailController.find("TIPODEFALTA"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + // Subquery + SubQuery subqueryClase = new SubQuery("TgeneCatalogDetail", "description", "nclase", "i.pk.catalog = t.clase and i.pk.catalogcode = t.clasecodigo"); + dto.addSubQuery(subqueryClase); + + SubQuery subqueryFalta = new SubQuery("TgeneCatalogDetail", "description", "nfalta", "i.pk.catalog = t.falta and i.pk.catalogcode = t.faltacodigo"); + dto.addSubQuery(subqueryFalta); + + SubQuery subqueryTipoFalta = new SubQuery("TgeneCatalogDetail", "description", "ntipoFalta", "i.pk.catalog = t.tipofalta and i.pk.catalogcode = t.tipofaltacodigo"); + dto.addSubQuery(subqueryTipoFalta); + + SubQuery subqueryTramite = new SubQuery("TgeneCatalogDetail", "description", "ntramite", "i.pk.catalog = t.tramite and i.pk.catalogcode = t.tramitecodigo"); + dto.addSubQuery(subqueryTramite); + + SubQuery subquerySancion = new SubQuery("TgeneCatalogDetail", "description", "nsancion", "i.pk.catalog = t.sancion and i.pk.catalogcode = t.sancioncodigo"); + dto.addSubQuery(subquerySancion); + + SubQuery subqueryTiempo = new SubQuery("TgeneCatalogDetail", "description", "ntiempo", "i.pk.catalog = t.tiempo and i.pk.catalogcode = t.tiempocodigo"); + dto.addSubQuery(subqueryTiempo); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setcatalog() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setcatalog(TarmTipoSancion tarmTipoSancion) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tarmTipoSancion); + } + + public static void openLov(Map> params) {//, List tsancion + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 850); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/sancionarLov.xhtml", options, params); + } + +// public List getTsancion() { +// return tsancion; +// } +// +// public void setTsancion(List tsancion) { +// this.tsancion = tsancion; +// } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/lov/SitioAlmacenamientoLovController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/SitioAlmacenamientoLovController.java new file mode 100644 index 0000000..b3754e6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/SitioAlmacenamientoLovController.java @@ -0,0 +1,134 @@ +package com.fp.frontend.controller.armas.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmSitioAlmacenamiento; +import com.fp.persistence.pgeneral.gene.TgeneCityKey; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class SitioAlmacenamientoLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public SitioAlmacenamientoLovController() throws Exception { + super(TarmSitioAlmacenamiento.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + try { + String codeperson = CallerHelper.getLovParameter("personcode"); + if (codeperson != null) { + super.addFilter("personcode", codeperson); + this.querydatabase(); + } + super.startQuery(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 200; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOGLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + this.addFilter("estado", "ACT"); + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + SubQuery subqueryProvincia = new SubQuery("TgeneProvince", "description", "provincia", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode"); + dto.addSubQuery(subqueryProvincia); + + SubQuery subqueryCanton = new SubQuery("TgeneCanton", "description", "canton", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode and i.pk.cantoncode=t.cantoncode"); + dto.addSubQuery(subqueryCanton); + + SubQuery subqueryCiudad = new SubQuery("TgeneCity", "description", "ciudad", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode and i.pk.cantoncode=t.cantoncode "); + dto.addSubQuery(subqueryCiudad); + + SubQuery subqueryParroquia = new SubQuery("TgeneParroquia", "description", "parroquia", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode and i.pk.cantoncode=t.cantoncode and i.pk.parroquiacode=t.parroquiacode"); + dto.addSubQuery(subqueryParroquia); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setcatalog() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setcatalog(TarmSitioAlmacenamiento tarmSitioAlmacenamiento) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tarmSitioAlmacenamiento); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/sitioAlmacenamientoLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/lov/UnidadTipoLovController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/UnidadTipoLovController.java new file mode 100644 index 0000000..12b02fe --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/lov/UnidadTipoLovController.java @@ -0,0 +1,255 @@ +package com.fp.frontend.controller.armas.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.ClaseLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmUnidadTipo; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del lov asociado al bean TarmUnidTipo. + * + * @author C.P. + * @version 2.1 + */ +/** + * @author User + * + */ +@ManagedBean +@ViewScoped +public class UnidadTipoLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private String descripcionClase; + private String descripcionTipoArma; + private String codigoClase; + private String btnAcctivar; + + @ManagedProperty(value = "#{claseLovController}") + private ClaseLovController claseLovController; + + public UnidadTipoLovController() throws Exception { + super(TarmUnidadTipo.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; + this.lrecord = new ArrayList<>(); + this.beanalias = "UNIDADTIPO"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + //dto.setOrderby("t.pk"); + SubQuery sclasearma = new SubQuery("TgeneCatalogDetail", "description", "desclasearma", "i.pk.catalog = t.pk.clase and i.pk.catalogcode=t.pk.clasecode"); + SubQuery stipoarma = new SubQuery("TgeneCatalogDetail", "description", "destipoarma", "i.pk.catalog = t.pk.tipoarmaexplosivo and i.pk.catalogcode=t.pk.tipoarmaexplosivocodigo"); + SubQuery sunidad = new SubQuery("TgeneCatalogDetail", "description", "desunidad", "i.pk.catalog = t.pk.unidadmedidapeso and i.pk.catalogcode=t.pk.unidadmedidapesocodigo"); + dto.addSubQuery(stipoarma); + dto.addSubQuery(sclasearma); + dto.addSubQuery(sunidad); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + //busquedas desde en un dialogo + public void openClaseLov() { + try { + btnAcctivar = "clase"; + claseLovController.setLrecord(new ArrayList()); + claseLovController.getMfilters().clear(); + claseLovController.getMfilters().put("pk.catalogcode", "CLASE"); + claseLovController.query(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + //del catalogo para la clase + private TgeneCatalogDetail sel; + + public void setcatalogDialog(TgeneCatalogDetail tgeneCatalog) { + sel = tgeneCatalog; + super.getMfilters().put("pk.clase", sel.getPk().getCatalog()); + descripcionClase = sel.getDescription(); + codigoClase = sel.getPk().getCatalog(); + claseLovController.setLrecord(new ArrayList()); + claseLovController.getMfilters().clear(); + super.getMfilters().put("pk.tipoarmaexplosivo", null); + descripcionTipoArma = null; + } + + //busquedas desde en un dialogo + public void openTipoArmaDialog() { + try { + if (codigoClase == null || codigoClase.trim().length() == 0) { + MessageHelper.setMessageError("SELECCIONE LA CLASE"); + return; + } + claseLovController.setLrecord(new ArrayList()); + claseLovController.getMfilters().clear(); + btnAcctivar = "tipoArma"; + String legalcode = ""; + String legalcode2 = ""; + List lista = CatalogDetailController.find("LONGITUD", codigoClase); + if (lista != null) { + for (TgeneCatalogDetail catalogo : lista) { + if (legalcode == null || legalcode.length() == 0) { + legalcode += catalogo.getPk().getCatalog(); + } else if (legalcode2 == null || legalcode2.length() == 0) { + legalcode2 += " legalcode= '" + catalogo.getPk().getCatalog() + "'"; + } else { + legalcode2 += " or t.legalcode= '" + catalogo.getPk().getCatalog() + "'"; + } + } + } else { + legalcode = codigoClase; + } + claseLovController.getMfilters().put("pk.catalogcode", "TIPOARMAEXPLOSIVO"); + + if (legalcode != null && legalcode.trim().length() > 0) { + if (legalcode2 != null && legalcode2.trim().length() > 0) { + claseLovController.getMfilters().put(legalcode2 + " or t.legalcode", legalcode); + } else { + claseLovController.getMfilters().put("legalcode", legalcode); + } + } + + claseLovController.query(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + //del catalogo para la clase + + public void setDialogTipoArma(TgeneCatalogDetail tgeneCatalog) { + sel = tgeneCatalog; + super.getMfilters().put("pk.tipoarmaexplosivo", sel.getPk().getCatalog()); + descripcionTipoArma = sel.getDescription(); + claseLovController.setLrecord(new ArrayList()); + claseLovController.getMfilters().clear(); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/unidadTipoLov.xhtml", options, params); + } + + public void setunidTipo() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setunidTipo(TarmUnidadTipo tarmUnidadTipo) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tarmUnidadTipo); + } + + public String getDescripcionClase() { + return descripcionClase; + } + + public void setDescripcionClase(String descripcionClase) { + this.descripcionClase = descripcionClase; + } + + public String getDescripcionTipoArma() { + return descripcionTipoArma; + } + + public void setDescripcionTipoArma(String descripcionTipoArma) { + this.descripcionTipoArma = descripcionTipoArma; + } + + public TgeneCatalogDetail getSel() { + return sel; + } + + public void setSel(TgeneCatalogDetail sel) { + this.sel = sel; + } + + public ClaseLovController getClaseLovController() { + return claseLovController; + } + + public void setClaseLovController(ClaseLovController claseLovController) { + this.claseLovController = claseLovController; + } + + public String getBtnAcctivar() { + return btnAcctivar; + } + + public void setBtnAcctivar(String btnAcctivar) { + this.btnAcctivar = btnAcctivar; + } + + public String getCodigoClase() { + return codigoClase; + } + + public void setCodigoClase(String codigoClase) { + this.codigoClase = codigoClase; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/entries new file mode 100644 index 0000000..39f6329 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/entries @@ -0,0 +1,1323 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/armas/parametros +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +RequisitoPorTramiteController.java +file + + + + +2022-07-28T03:39:54.508594Z +938720e0f959f75907857dee5f130afe +2016-01-08T15:10:02.437044Z +4370 +jespinosa + + + + + + + + + + + + + + + + + + + + + +12932 + +FirmarDocumentoController.java +file + + + + +2022-07-28T03:39:54.509594Z +fae83084e47bf99cbfb9308f14e87db2 +2016-07-28T21:02:51.840314Z +4553 +cvasquez + + + + + + + + + + + + + + + + + + + + + +26352 + +GuardiasController.java +file + + + + +2022-07-28T03:39:54.509594Z +6afdbdda8d53410d08a825cf395ba82f +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +5647 + +TarmCentroControlJurController.java +file + + + + +2022-07-28T03:39:54.510594Z +f61066b0ac1081c6bb58ba3219073cbc +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +11659 + +CatalogFilterLovController.java +file + + + + +2022-07-28T03:39:54.510594Z +5680057e68bb93cfd9973d2e8f7a63b6 +2014-10-17T04:27:01.373611Z +1661 +fpazmino + + + + + + + + + + + + + + + + + + + + + +5210 + +ImportacionArmasDetalleController.java +file + + + + +2022-07-28T03:39:54.510594Z +dd8e3dcaf0c2ad2d39065a122dadc466 +2014-08-25T06:56:55.717394Z +316 +acevallos + + + + + + + + + + + + + + + + + + + + + +3927 + +TipoArmaExpLovController.java +file + + + + +2022-07-28T03:39:54.511594Z +a3d6fef16579ee75b16b7e56e7dc0496 +2015-07-10T10:46:23.842001Z +4190 +fpazmino + + + + + + + + + + + + + + + + + + + + + +4743 + +PreguntasParaEvaluacionesController.java +file + + + + +2022-07-28T03:39:54.511594Z +a6e2bda6939cc01dbe5249514cb0cbff +2014-11-12T11:33:27.145114Z +2683 +fpazmino + + + + + + + + + + + + + + + + + + + + + +14514 + +TotalPersonaController.java +file + + + + +2022-07-28T03:39:54.511594Z +7b7b90bf5d41e16dd381d7b2fc86ccc3 +2015-04-28T07:18:10.043932Z +4058 +cpiedra + + + + + + + + + + + + + + + + + + + + + +5499 + +TiposArmasExplosivosController.java +file + + + + +2022-07-28T03:39:54.512594Z +2d88b8371044f65541a9afa6e106ec0b +2015-08-06T11:48:46.589882Z +4259 +fpazmino + + + + + + + + + + + + + + + + + + + + + +32359 + +RespuestasLovController.java +file + + + + +2022-07-28T03:39:54.512594Z +83f3c6d3566e012791a63c437d02de87 +2015-04-20T12:00:32.629179Z +4043 +dlopez + + + + + + + + + + + + + + + + + + + + + +8772 + +CentroControlArmasController.java +file + + + + +2022-07-28T03:39:54.512594Z +3121d1437849eff48b2dc46ccfa8189f +2016-02-15T19:57:14.669988Z +4444 +cvasquez + + + + + + + + + + + + + + + + + + + + + +22395 + +ImportacionDetalleController.java +file + + + + +2022-07-28T03:39:54.513594Z +7554b2782b93cf7db59b0908fb02cb34 +2014-08-25T06:59:21.531443Z +318 +acevallos + + + + + + + + + + + + + + + + + + + + + +106 + +ArmaController.java +file + + + + +2022-07-28T03:39:54.513594Z +6d87916c6c035c8224b214030cda9c23 +2015-12-07T21:31:14.267090Z +4337 +fpazmino + + + + + + + + + + + + + + + + + + + + + +75085 + +CalibreLovController.java +file + + + + +2022-07-28T03:39:54.514594Z +57b5abae6ae6b84d961bd6deee7338ec +2014-11-06T07:07:59.457269Z +2409 +fpazmino + + + + + + + + + + + + + + + + + + + + + +3795 + +InventarioSubidoController.java +file + + + + +2022-07-28T03:39:54.514594Z +c76cfd5caf50019ebe1fbffe54057b23 +2015-09-04T07:02:37.538139Z +4274 +fpazmino + + + + + + + + + + + + + + + + + + + + + +4061 + +ImporteArmasExcelController.java +file + + + + +2022-07-28T03:39:54.514594Z +cddf7439cbab9a95f40174e3a55fa610 +2021-05-14T20:37:22.948846Z +4633 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +26817 + +ImportacionController.java +file + + + + +2022-07-28T03:39:54.514594Z +dac77eec3008b30a884731cf984a4dab +2014-10-22T10:18:50.915275Z +1836 +ogarcia + + + + + + + + + + + + + + + + + + + + + +13307 + +CashManagementHistoryController.java +file + + + + +2022-07-28T03:39:54.515594Z +c1a84701c05b4d111b945ba5b47ad07d +2016-01-21T16:01:36.970774Z +4397 +mcepeda + + + + + + + + + + + + + + + + + + + + + +10692 + +UnidadTipoController.java +file + + + + +2022-07-28T03:39:54.515594Z +f60632542158211c988db0ac13ac93fa +2015-08-06T11:48:46.589882Z +4259 +fpazmino + + + + + + + + + + + + + + + + + + + + + +14124 + +ImporteArmasController.java +file + + + + +2022-07-28T03:39:54.515594Z +23692bef9a21c0eb3dcbb3253b254718 +2020-01-15T23:50:20.451652Z +4625 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +30660 + +IngresoInventarioController.java +file + + + + +2022-07-28T03:39:54.516594Z +8abfa700e4d0e699656a1b05b33d4c99 +2021-05-14T20:37:22.948846Z +4633 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +75225 + +LongitudLovController.java +file + + + + +2022-07-28T03:39:54.516594Z +690c89aae80057928999f348866f6a5e +2014-11-06T07:07:47.103942Z +2407 +fpazmino + + + + + + + + + + + + + + + + + + + + + +3799 + +TarmVentaArmaTemporalController.java +file + + + + +2022-07-28T03:39:54.516594Z +d5d6de36cbba63086f514954f9e9c392 +2021-09-08T20:06:35.809021Z +4643 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +7197 + +ClaseLovController.java +file + + + + +2022-07-28T03:39:54.516594Z +46252e153155586fbbc5ec2a69eaff93 +2014-11-06T07:07:40.889953Z +2406 +fpazmino + + + + + + + + + + + + + + + + + + + + + +5326 + +OrigenTramiteController.java +file + + + + +2022-07-28T03:39:54.518594Z +15c665baadda50af36240b66d329bf23 +2016-01-18T19:47:54.300889Z +4383 +cvasquez + + + + + + + + + + + + + + + + + + + + + +15855 + +VentaTotalPersonaController.java +file + + + + +2022-07-28T03:39:54.516594Z +eb45bce686198e26bd848bb4a8985401 +2021-05-14T20:37:22.948846Z +4633 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +2853 + +IngresoDatosTipoTramite.java +file + + + + +2022-07-28T03:39:54.518594Z +df6d454a888d64e8cf536a514e0f1567 +2016-07-25T20:45:07.323347Z +4550 +cvasquez + + + + + + + + + + + + + + + + + + + + + +29117 + +AuxCargaArmasController.java +file + + + + +2022-07-28T03:39:54.518594Z +4a05d5daba7df7c9a6eb15f13fe507ce +2020-01-15T23:50:20.451652Z +4625 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +15007 + +ComercianteCupoController.java +file + + + + +2022-07-28T03:39:54.518594Z +cb1188001a3c9254cbb2361b90ca7890 +2015-03-05T12:30:19.289381Z +3905 +cguzman + + + + + + + + + + + + + + + + + + + + + +15518 + +DatosParaSancionesController.java +file + + + + +2022-07-28T03:39:54.519594Z +4698adca72ab97b9c266581fd8d8862a +2015-01-19T09:09:59.162875Z +3768 +cpiedra + + + + + + + + + + + + + + + + + + + + + +17338 + +SancionesController.java +file + + + + +2022-07-28T03:39:54.519594Z +6f0ae818544f9c9d4bbe3227e4cb959a +2014-10-20T09:33:12.700047Z +1738 +acevallos + + + + + + + + + + + + + + + + + + + + + +7085 + +RequisitoController.java +file + + + + +2022-07-28T03:39:54.519594Z +ecd0986b106f475cd54f9b0ec978a200 +2015-05-07T05:42:46.680912Z +4079 +cpiedra + + + + + + + + + + + + + + + + + + + + + +7478 + +SitioAlmacenamientoController.java +file + + + + +2022-07-28T03:39:54.519594Z +a27830024d5ed6360047b21736ca7ed1 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +18503 + +ImporteTipoArmaExplosivoController.java +file + + + + +2022-07-28T03:39:54.520594Z +85186760c3069029ce7dce167775edcc +2017-03-04T15:15:58.643449Z +4578 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +3077 + +BuscarTramiteLovController.java +file + + + + +2022-07-28T03:39:54.520594Z +fb8619f7957cd69f51b1d30f08d03284 +2015-12-29T18:34:31.727682Z +4362 +cvasquez + + + + + + + + + + + + + + + + + + + + + +9516 + +SolicitudImportacionArmasController.java +file + + + + +2022-07-28T03:39:54.520594Z +20d5645b4679acd856c00e5c638aa4bc +2014-08-25T07:00:02.404990Z +320 +acevallos + + + + + + + + + + + + + + + + + + + + + +2719 + +util +dir + +FirmarDocumentoFiscaliaController.java +file + + + + +2022-07-28T03:39:54.520594Z +b3ea83167056c199e4465562cb703ef9 +2016-07-28T21:02:51.840314Z +4553 +cvasquez + + + + + + + + + + + + + + + + + + + + + +17543 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/prop-base/GuardiasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/prop-base/GuardiasController.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/prop-base/GuardiasController.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ArmaController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ArmaController.java.netbeans-base new file mode 100644 index 0000000..7ae946e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ArmaController.java.netbeans-base @@ -0,0 +1,1693 @@ +package com.fp.frontend.controller.armas.parametros; + + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletResponse; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.ArmaExcell; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.funcionalidad.TotalArmasController; +import com.fp.frontend.controller.armas.solicitud.ArmasController; +import com.fp.frontend.controller.armas.solicitud.DocumentoHabilitanteController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.parmas.param.TarmComercianteCupo; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmUnidadTipo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + + + +/** + * @author Andres Cevallos + * Clase Controladora para la entidad TarmArma + * Incluye metodo de consulta para la busqueda de persona y registro + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ArmaController extends AbstractController { + + //Variabgles globales + private Integer personcode; + + private Boolean descargar; + private String csolicitud; + InputStream filei; + + //Datos generales + private TgeneCatalogDetail tipoDocumento; + private TcustPersonDetail detallesPersona; + + Date fechaActual; + private List tiposRegistro; + private TgeneCatalogDetail tipoRegistro; + + //Detalle del material + //Pais + private List lpaises; + private TgeneCountry pais; + //private String pais; + + //Provincia + private List lprovincias; + private String codigoProvincia; + + //Canton + private List lcantones; + private String codigoCanton; + + //Ciudad + private List lciudades; + private TgeneCity ciudad; + + //Registro armas + TarmRegistroArmas registro=new TarmRegistroArmas(); + + //Variables de las armas + private TcustPersonDetail usuario; + private TcustPersonAddress direccion; + private List listaFilas; + private List listaErrores; +// private List cuposArmas; + + //private BigDecimal pesoTotal; + private TarmTipoArmaExplosivo tipoArmaExplosivo; + private List listaArmas; + private ArmaExcell armaexcell; + + private List laexel; + private List armas=new ArrayList(); + private List totalesPersoan=new ArrayList(); + + //Aeropuertos + List laeropuertos=new ArrayList<>(); + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddressController; + +// @ManagedProperty(value = "#{comercianteCupoController}") +// private ComercianteCupoController comercianteCupoController; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmasController; + + @ManagedProperty(value = "#{totalArmasController}") + private TotalArmasController totalPersonaController; + + private List ldocumentospersona; + + private String clase; + public ArmaController() throws Exception { + super(TarmArmas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.record=new TarmArmas(); + this.beanalias = "ARMAS"; + this.create(); + + //Globales + descargar=false; + csolicitud=null; + + //Datos generales + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + //Obteniendo los datos de la persona + detallesPersona= PersonDetailController.find(String.valueOf(usuario.getPk().getPersoncode())); + + //Tipo de documento + tipoDocumento = CatalogDetailController.findxCodigoCodcatalogo(detallesPersona.getIdentificationcatalog(),detallesPersona.getIdentificationcatalogcode()); + + //Fecha actual + this.fechaActual=Calendar.getInstance().getTime(); + + //Tipos de registro + tiposRegistro=CatalogDetailController.find("TIPOREGISTRO", "REG"); + + //Detalle del material + lpaises=CountryController.find(); + registro.setFechasolicitud(new java.sql.Date((new Date()).getTime())); + + //Obteniendo la direccion de la persona + String tipoDireccion=""; + + if(detallesPersona!=null){ + switch(detallesPersona.getIdentificationcatalog()){ + case "CED": + tipoDireccion = "1"; + break; + case "RUC": + tipoDireccion= "2"; + break; + default: + tipoDireccion= ""; + break; + } + } + //direccion= personAddressController.findByPersonCode(usuario.getPk().getPersoncode().toString()); + direccion= personAddressController.findPrincipal(String.valueOf(usuario.getPk().getPersoncode().toString())) ; + + + //Imprtacion + this.lprovincias=ProvinceController.find("EC"); + + //Armas + listaErrores = new ArrayList(); + + //Controlador de totales +// this.totalPersonaController=new TotalPersonaController(); +// this.totalPersonaController.create(); +// this.totalPersonaController.setLrecord(new ArrayList()); + + RegistroArmController registroArmas = new RegistroArmController(); + registroArmas.init(); + registroArmas.setRecperpage(3000000); + registroArmas.addFilter("personcode", tsafeUserDetail.getPk().getPersoncode().toString()); + registroArmas.query(); + this.addFilter("estado", "REG"); + filtro(registroArmas.getLrecord()); + + //Obteniendo los aeropuertos + this.laeropuertos=CatalogDetailController.find("AEROPUERTOS"); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TarmTipoArmaExplosivo","clase","cclase","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo= new SubQuery("TarmTipoArmaExplosivo","clasecodigo","cclasecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud= new SubQuery("TarmTipoArmaExplosivo","longitud","clongitud","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo= new SubQuery("TarmTipoArmaExplosivo","longitudcodigo","clongitudcodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ccalibre","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo= new SubQuery("TarmTipoArmaExplosivo","calibrecodigo","ccalibrecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivo","ctipoarmaexplosivo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivocodigo","ctipoarmaexplosivocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapeso","cunidadmedidapeso","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapesocodigo","cunidadmedidapesocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + + Filter filtrofecha=new Filter(); + filtrofecha.setSql("t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) and t.estado !='DEST' and t.estado !='CDP'"); + dto.addFiltro(filtrofecha); + dto.setOrderby("pk"); + String sql=csolicitud; + if(csolicitud!=null){ + Filter filtro = new Filter(); + filtro.setSql(sql); + dto.addFiltro(filtro); + } + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + public void querydatabaseMarcaSerie(String cregistro,String marca, String serie) { + try { + + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TarmTipoArmaExplosivo","clase","cclase","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo= new SubQuery("TarmTipoArmaExplosivo","clasecodigo","cclasecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud= new SubQuery("TarmTipoArmaExplosivo","longitud","clongitud","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo= new SubQuery("TarmTipoArmaExplosivo","longitudcodigo","clongitudcodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ccalibre","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo= new SubQuery("TarmTipoArmaExplosivo","calibrecodigo","ccalibrecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivo","ctipoarmaexplosivo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivocodigo","ctipoarmaexplosivocodigo","i.pk=t.ctipoarmaexplosivo");// and i.clase='" + clase + "' and i.tipoarmaexplosivo='" + tipoArmaExplosivo + "'"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapeso","cunidadmedidapeso","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapesocodigo","cunidadmedidapesocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + + + Filter filtrofecha=new Filter(); + filtrofecha.setSql("t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) " + + " and t.estado !='DEST' and t.estado !='CDP' and t.lote " + (serie==null?" is null":("= '" + serie + "'")) + " and t.cregistro= '" + + cregistro + "' and t.marca " + (marca==null?" is null":("= '" + marca + "'"))); + dto.addFiltro(filtrofecha); + dto.setOrderby("pk"); + /* String sql=csolicitud; + if(csolicitud!=null){ + Filter filtro = new Filter(); + filtro.setSql(sql); + dto.addFiltro(filtro); + }*/ + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + /* Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE");*/ + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecOked") + protected void querydatabaseSimple() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql=" t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para armar el registro + * @param lsolicitud + */ + public void filtro(List lsolicitud){ + + for(TarmRegistroArmas soli : lsolicitud){ + if(csolicitud==null){ + csolicitud="(cregistro="+soli.getPk(); + } + else{ + csolicitud+=" or cregistro="+soli.getPk(); + } + } + csolicitud+=")"; + + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + + DtoSave dtosave = super.getDtoSave(true); + dtosave.setPosition(2); + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); + + registroArmasController.clearAll(); + DtoSave dtosaveregistroarma = registroArmasController.getDtoSave(true); + dtosaveregistroarma.setPosition(1); + msave.put(registroArmasController.getBeanalias(), dtosaveregistroarma); + + totalPersonaController.clearAll(); + DtoSave dtosavetotalper = totalPersonaController.getDtoSave(true); + dtosavetotalper.setPosition(3); + msave.put(totalPersonaController.getBeanalias(), dtosavetotalper); + + request.setSaveTables(msave); + request.getModifiedData().put("LISTAARMAS", this.armas); + request.getModifiedData().put("LISTATOTALES", this.totalesPersoan); + request.getModifiedData().put("REGISTRO", this.registro); + + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + //this.totalPersonaController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + + /** + * Metodo que carga y valida el contenido de un archivo excel con información de armas + * @param event + */ + public void cargarArchivo(FileUploadEvent event){ + HashMap mapaTotalesTemporales = new HashMap<>(); + int f1=0; + try { + //Completando los datos del registro + this.registro.setPersoncode(this.usuario.getPk().getPersoncode()); + this.registro.setTiporegistrocodigo("TIPOREGISTRO"); + this.registro.setFechasolicitud(new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + //Inicializando las listas + listaFilas=new ArrayList(); + listaArmas= new ArrayList(); + listaErrores= new ArrayList(); + //caraga el excel + UploadedFile selectedFile = event.getFile(); + InputStream archivo=selectedFile.getInputstream(); + XSSFWorkbook libro = new XSSFWorkbook(archivo); + XSSFSheet hoja = libro.getSheetAt(0); + //Iterando sobre las filas + int cont=0; + Iterator rowIterator = hoja.iterator(); + //Cargando el contenido de las celdas a una lista de objetos + while(rowIterator.hasNext()) { + cont++; + Row row = rowIterator.next(); + if(cont>1){ + Cell numero=row.getCell(0); + Cell serie=row.getCell(1); + Cell clase=row.getCell(2); + Cell longitud=row.getCell(3); + Cell tipo=row.getCell(4); + Cell calibre=row.getCell(5); + Cell color=row.getCell(6); + Cell marca=row.getCell(7); + Cell cantidad=row.getCell(8); + Cell umcantidad=row.getCell(9); + Cell peso=row.getCell(10); + Cell umpeso=row.getCell(11); + Boolean filaEnBlanco=false; + if(this.celdaVacia(numero) && this.celdaVacia(serie) && this.celdaVacia(clase) + && this.celdaVacia(longitud) && this.celdaVacia(tipo) && this.celdaVacia(calibre) + && this.celdaVacia(color) && this.celdaVacia(marca) && this.celdaVacia(cantidad) + && this.celdaVacia(umcantidad) && this.celdaVacia(peso) && this.celdaVacia(umpeso)){ + filaEnBlanco=true; + }else{ + listaFilas.add(row); + } + if(!filaEnBlanco){ + //arma la lista de las armas en un dto aniade en la lista listaArmas + armarlistaArmasExcel(numero, serie, clase, longitud, tipo, calibre, color, marca, cantidad, umcantidad, peso, umpeso, row); + } + } + } + //Verificando las filas duplicadas en el archivo + verificarFilasDuplicadas(listaArmas); + if(this.registro.getTiporegistro().equals("PRO")){ + //Verificando las filas duplicadas en la BD + verificarArmasExistentesEnBaseDeDatos(listaArmas, this.usuario.getPk().getPersoncode()); + } + Boolean contieneSerie=false; + //RECORRE LA LISTA DE LAS ARMAS y valida el CUPO DEL ARMA + //Validando los campos requeridos que estan vacios + recorreListaArmasExcel(contieneSerie,f1,mapaTotalesTemporales); + //Seteando los atributos de las armas y totales si no hay ningun error + if(listaErrores.isEmpty()){ + for (int i = 0; i < listaArmas.size(); i++) { + if(!listaArmas.get(i).getCamposIncompletos() && !listaArmas.get(i).getDuplicada() && listaArmas.get(i).getExisteCatalogo() + && listaArmas.get(i).getExisteTARMTIPOARMAEXPLOSIVO()){ //&& !listaArmas.get(i).getCupoInsuficiente() + //Marca + if(listaArmas.get(i).getCatalogoMarca()!=null){ + listaArmas.get(i).getArma().setMarcacodigo("MARCA"); + listaArmas.get(i).getArma().setMarca(listaArmas.get(i).getCatalogoMarca().getPk().getCatalog()); + } + //Color + if(listaArmas.get(i).getCatalogoColor()!=null){ + listaArmas.get(i).getArma().setColorcodigo("COLOR"); + listaArmas.get(i).getArma().setColor(listaArmas.get(i).getCatalogoColor().getPk().getCatalog()); + } + //Unidad medida cantidad + if(listaArmas.get(i).getTipoArmaExplosivo()!=null){ + listaArmas.get(i).getArma().setUnidadmedidacantidadcodigo("UNIDADMEDIDA"); + Double doubleNum=0.0; + //Cargando el catalodo del tipo de unidad de medida + if(listaArmas.get(i).getUnidadMedidaCantidad()!=null && !listaArmas.get(i).getUnidadMedidaCantidad().isEmpty()){ + listaArmas.get(i).getArma().setUnidadmedidacantidad(listaArmas.get(i).getUnidadMedidaCantidad()); + doubleNum=Double.parseDouble(listaArmas.get(i).getTextoCantidad()); + //Cantidad + Integer intNum=(int)doubleNum.doubleValue(); + listaArmas.get(i).getArma().setCantidad(intNum); + }else if(listaArmas.get(i).getUnidadMedidaPeso()!=null && !listaArmas.get(i).getUnidadMedidaPeso().isEmpty()){ + listaArmas.get(i).getArma().setUnidadmedidacantidad(listaArmas.get(i).getUnidadMedidaPeso()); + doubleNum=Double.parseDouble(listaArmas.get(i).getTextoPeso()); + //Peso + listaArmas.get(i).getArma().setPeso(new BigDecimal(doubleNum)); + } + } + //Estado + //1-Serie + //Validando que si el tipo de registro es de importacion + //las armas no contengan numero de serie + if(this.registro.getTiporegistro().equalsIgnoreCase("IMP")){ + listaArmas.get(i).getArma().setEstado("IMPO"); + }else{ + listaArmas.get(i).getArma().setEstado("PRO"); + } + listaArmas.get(i).getArma().setEstadocodigo("ESTADOARMA"); + if(direccion!=null){ + //Codigo de pais + listaArmas.get(i).getArma().setCountrycode(direccion.getCountrycode()); + //Codigo de provincia + listaArmas.get(i).getArma().setProvincecode(direccion.getProvincecode()); + //Codigo de canton + listaArmas.get(i).getArma().setCantoncode(direccion.getCantoncode()); + //Codigo de parroquia + listaArmas.get(i).getArma().setParroquiacode(direccion.getParroquiacode()); + //Codigo de ciudad + listaArmas.get(i).getArma().setCitycode(direccion.getCitycode()); + } + //Lote + listaArmas.get(i).getArma().setLote(listaArmas.get(i).getSerie()); + //Peso + if(listaArmas.get(i).getTextoPeso()!=null && !listaArmas.get(i).getTextoPeso().isEmpty()){ + listaArmas.get(i).getArma().setPeso(BigDecimal.valueOf(Double.parseDouble(listaArmas.get(i).getTextoPeso()))); + } + //Direccion + listaArmas.get(i).getArma().setDireccion(direccion.getAddress()); + + //Fecha de registro + listaArmas.get(i).getArma().setFecharegistro(new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + + //Tipo de arma explosivo + if(listaArmas.get(i).getTipoArmaExplosivo()!=null){ + listaArmas.get(i).getArma().setCtipoarmaexplosivo(listaArmas.get(i).getTipoArmaExplosivo().getPk()); + } + armas.add(listaArmas.get(i).getArma()); + } + } + //Se rrecorre el mapa HashMap mapaTotalesTemporales + for (TarmTotalPersona value : mapaTotalesTemporales.values()) { + totalesPersoan.add(value); + } + save(); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + }finally{ + if (!listaErrores.isEmpty()) { + listaArmas.clear(); + MessageHelper.setMessageError("ERRORES ENCONTRADOS DENTRO DEL ARCHIVO EXCEL: ");// + errores.toString()); + descargar=true; + }else{ +// MessageHelper.setMessageInfo("ARCHIVO CARGADO EXITOSAMENTE"); + descargar=false; + } + } + } + /** + * Metodo para cargar los valores del EXCEL EN UNA CLASE DTO(ArmaExcell ) + * @param numero * @param serie * @param clase * @param longitud * @param tipo * @param calibre + * @param color * @param marca * @param cantidad * @param umcantidad * @param peso * @param umpeso * @param row + */ + public void armarlistaArmasExcel(Cell numero,Cell serie,Cell clase,Cell longitud,Cell tipo,Cell calibre,Cell color,Cell marca, + Cell cantidad,Cell umcantidad,Cell peso,Cell umpeso,Row row){ + ArmaExcell arma=new ArmaExcell(); + arma.setTextoNumero(Utilidades.setearValorCelda(numero));//Numero + arma.setSerie(Utilidades.setearValorCelda(serie));//Serie + arma.setClase(Utilidades.setearValorCelda(clase));//Clase + arma.setLongitud(Utilidades.setearValorCelda(longitud));//Longitud + arma.setTipo(Utilidades.setearValorCelda(tipo));//Tipo + arma.setCalibre(Utilidades.setearValorCelda(calibre));//Calibre + arma.setColor(Utilidades.setearValorCelda(color));//Color + arma.setMarca(Utilidades.setearValorCelda(marca));//Marca + arma.setTextoCantidad(Utilidades.setearValorCelda(cantidad));//Cantidad + arma.setUnidadMedidaCantidad(Utilidades.setearValorCelda(umcantidad));//U. Medida Cantidad + arma.setTextoPeso(Utilidades.setearValorCelda(peso));//Peso + arma.setUnidadMedidaPeso(Utilidades.setearValorCelda(umpeso));//U. Medida Peso + if(this.registro.getTiporegistro().equals("PRO")){ + if(arma.getSerie()!=null){ + if(arma.getClase().equalsIgnoreCase("arma de fuego") && !arma.getTextoCantidad().equals("1.0") ){ + listaErrores.add("Fila "+row.getRowNum()+": "+"Columna 8: "+MsgControlArmas.getProperty("msg_limitecantidadarma")); + return; + } + listaArmas.add(arma); + }else { + listaErrores.add("Fila "+row.getRowNum()+": "+"Columna 1: "+MsgControlArmas.getProperty("msg_serieVacia")); + return; + } + }else { + if(arma.getClase().equalsIgnoreCase("arma de fuego") && arma.getTextoCantidad().equals("1.0")){ + listaArmas.add(arma); + }else if (!arma.getClase().equalsIgnoreCase("arma de fuego")) { + listaArmas.add(arma); + }else { + listaErrores.add("Fila "+row.getRowNum()+": "+"Columna 8: "+MsgControlArmas.getProperty("msg_limitecantidadarma")); + return; + } + } + } + + /** + * Metodo que verifica si existen filas duplicadas en el archivo de excell + * @param listaArmas + */ + private void verificarFilasDuplicadas(List listaArmas){ + for (int i = 0; i < listaArmas.size()-1; i++) { + for (int j = i+1; j < listaArmas.size(); j++) { + if(!this.registro.getTiporegistro().equalsIgnoreCase("IMP") && ((listaArmas.get(i).getSerie().equalsIgnoreCase(listaArmas.get(j).getSerie())) + && listaArmas.get(i).getClase().equalsIgnoreCase(listaArmas.get(j).getClase()) + && listaArmas.get(i).getTipo().equalsIgnoreCase(listaArmas.get(j).getTipo()) + && (!listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego") + || (listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego") && listaArmas.get(j).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")) + && listaArmas.get(i).getCalibre().equalsIgnoreCase(listaArmas.get(j).getCalibre())) + && listaArmas.get(i).getMarca().equalsIgnoreCase(listaArmas.get(j).getMarca()))){ + listaArmas.get(j).setDuplicada(true); + break; + } + } + } + } + + /** + * @param listaArmas + * @throws Exception + */ + @SuppressWarnings("static-access") + private void verificarArmasExistentesEnBaseDeDatos(List listaArmas, Integer codigoPersona) throws Exception{ + TgeneCatalogDetail codigoClase = new TgeneCatalogDetail(); + TgeneCatalogDetail codigoMarca = new TgeneCatalogDetail(); + TgeneCatalogDetail codigoTipo = new TgeneCatalogDetail(); + TgeneCatalogDetail codigoCalibre = new TgeneCatalogDetail(); + String codigoSerie; + List lstRegistroArmas = registroArmasController.findxPersoncode(String.valueOf(codigoPersona)); + if(lstRegistroArmas==null || listaArmas==null || lstRegistroArmas.isEmpty() || listaArmas.isEmpty()){ + return; + } + for (int i = 0; i < listaArmas.size(); i++) { + codigoClase=CatalogDetailController.findByCatalogcodeDescrption("CLASE", listaArmas.get(i).getClase()); + codigoTipo=CatalogDetailController.findByCatalogcodeDescrption("TIPOARMAEXPLOSIVO", listaArmas.get(i).getTipo()); + codigoMarca=CatalogDetailController.findByCatalogcodeDescrption("MARCA", listaArmas.get(i).getMarca()); + codigoSerie = this.registro.getTiporegistro().equalsIgnoreCase("IMP")?null:listaArmas.get(i).getSerie(); + codigoCalibre=listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")?CatalogDetailController.findByCatalogcodeDescrption("CALIBRE",listaArmas.get(i).getCalibre()):null; + + if((codigoClase==null && (listaArmas.get(i).getClase()!=null && !listaArmas.get(i).getClase().trim().isEmpty())) || (codigoTipo==null && (listaArmas.get(i).getTipo()!=null && !listaArmas.get(i).getTipo().trim().isEmpty())) + || (codigoMarca==null && (listaArmas.get(i).getMarca()!=null && !listaArmas.get(i).getMarca().trim().isEmpty())) || (codigoSerie==null && (listaArmas.get(i).getSerie()!=null && !listaArmas.get(i).getSerie().trim().isEmpty())) + || (codigoCalibre==null && (listaArmas.get(i).getCalibre()!=null && !listaArmas.get(i).getCalibre().trim().isEmpty())) + || listaArmas.get(i).getClase()==null || listaArmas.get(i).getMarca()==null || listaArmas.get(i).getCalibre()==null + || listaArmas.get(i).getClase().isEmpty() || listaArmas.get(i).getMarca().isEmpty() || listaArmas.get(i).getCalibre().isEmpty()){ + continue; + } + for(TarmRegistroArmas registroArmas :lstRegistroArmas){ + List lstArmasEncontradas = findByMarcaSerie(String.valueOf(registroArmas.getPk()),codigoMarca.getPk().getCatalog(), codigoSerie); + if(lstArmasEncontradas!=null){ + for(TarmArmas armas:lstArmasEncontradas){ + TarmTipoArmaExplosivo tipoArma = TiposArmasExplosivosController.findarma(armas.getCtipoarmaexplosivo()); + if(tipoArma.getClase().equalsIgnoreCase(codigoClase.getPk().getCatalog()) && codigoCalibre!=null?tipoArma.getCalibre().equalsIgnoreCase(codigoCalibre.getPk().getCatalog()):true && tipoArma.getTipoarmaexplosivo().equalsIgnoreCase(codigoTipo.getPk().getCatalog())){ + listaArmas.get(i).setDuplicada(true); + break; + } + } + } + } + } + } + /** + * Metodo que recorre la lista de las armas con los valores cargados del EXCEL + * @param contieneSerie + * @param f1 + * @param mapaTotalesTemporales + */ + public void recorreListaArmasExcel(Boolean contieneSerie, int f1,HashMap mapaTotalesTemporales){ + for (int i = 0; i < listaArmas.size(); i++) { + Integer fila=i+1; + f1=i; + Boolean campoCantidad=false; + //0-Datos duplicados + if(listaArmas.get(i).getDuplicada()){ + listaErrores.add("Fila "+fila.toString()+": "+MsgControlArmas.getProperty("msg_datosDuplicados")); + } + //1-Serie + //Validando que si el tipo de registro es de importacion + //las armas no contengan numero de serie + if(this.registro.getTiporegistro().equalsIgnoreCase("IMP") && (listaArmas.get(i).getSerie()!=null) && !contieneSerie){ + contieneSerie=true; + listaErrores.add(MsgControlArmas.getProperty("msg_archivoImportacionSerie")); + } + if(!this.registro.getTiporegistro().equalsIgnoreCase("IMP") && (listaArmas.get(i).getSerie()==null || listaArmas.get(i).getSerie().trim().isEmpty())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 1: "+MsgControlArmas.getProperty("msg_serieVacia")); + listaArmas.get(i).setCamposIncompletos(true); + } + //2-Clase + if(listaArmas.get(i).getClase()==null || listaArmas.get(i).getClase().trim().isEmpty()){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 2: "+MsgControlArmas.getProperty("msg_claseVacia")); + listaArmas.get(i).setCamposIncompletos(true); + + //3-Validando que cuando la clase sea ARMA DE FUEGO la longitud no este vacia + }else if(listaArmas.get(i).getClase().equalsIgnoreCase("ARMA DE FUEGO") + && (listaArmas.get(i).getLongitud()==null || listaArmas.get(i).getLongitud().trim().isEmpty())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 3: "+MsgControlArmas.getProperty("msg_longitudVacia")); + listaArmas.get(i).setCamposIncompletos(true); + + //Validando que cuando la clase no sea ARMA DE FUEGO la longitud este vacia + }else if(!listaArmas.get(i).getClase().equalsIgnoreCase("ARMA DE FUEGO") + && (listaArmas.get(i).getLongitud()!=null && !listaArmas.get(i).getLongitud().trim().isEmpty())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 3: "+MsgControlArmas.getProperty("msg_longitudNoVacia")); + } + //Carga de catalogos + TgeneCatalogDetail catalogoClase=CatalogDetailController.findByCatalogcodeDescrption("CLASE", listaArmas.get(i).getClase()); + listaArmas.get(i).setCatalogoClase(catalogoClase); + if(catalogoClase!=null && catalogoClase.getPk()!=null && catalogoClase.getPk().getCatalog()!=null && !clase.contains(catalogoClase.getPk().getCatalog())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 2: "+" No tiene permiso para cargar "+catalogoClase.getDescription()); + listaArmas.get(i).setCamposIncompletos(true); + }else if(catalogoClase==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 2: "+" No tiene ingresado una Clase V\u00e1lida "); + listaArmas.get(i).setCamposIncompletos(true); + } + TgeneCatalogDetail catalogoLongitud=CatalogDetailController.findByCatalogcodeDescrption("LONGITUD", listaArmas.get(i).getLongitud()); + listaArmas.get(i).setCatalogoLongitud(catalogoLongitud); + TgeneCatalogDetail catalogoTipoArma=CatalogDetailController.findByCatalogcodeDescrption("TIPOARMAEXPLOSIVO", listaArmas.get(i).getTipo()); + listaArmas.get(i).setCatalogoTipoArma(catalogoTipoArma); + TgeneCatalogDetail catalogoCalibre=CatalogDetailController.findByCatalogcodeDescrption("CALIBRE", listaArmas.get(i).getCalibre()); + listaArmas.get(i).setCatalogoCalibre(catalogoCalibre); + TgeneCatalogDetail catalogoColor=CatalogDetailController.findByCatalogcodeDescrption("COLOR", listaArmas.get(i).getColor()); + listaArmas.get(i).setCatalogoColor(catalogoColor); + TgeneCatalogDetail catalogoMarca=CatalogDetailController.findByCatalogcodeDescrption("MARCA", listaArmas.get(i).getMarca()); + listaArmas.get(i).setCatalogoMarca(catalogoMarca); + TarmUnidadTipo tipoUnidadSeleccionada =null;// new TarmUnidadTipo(); + if(catalogoClase!=null){ + //Obteniendo la configuracion de TARMUNIDADTIPO + if(!(listaArmas.get(i).getUnidadMedidaCantidad()==null || listaArmas.get(i).getUnidadMedidaCantidad().isEmpty()) && !(listaArmas.get(i).getUnidadMedidaPeso()==null || listaArmas.get(i).getUnidadMedidaPeso().isEmpty())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 9,11: "+MsgControlArmas.getProperty("msg_unidadMedidaSoloUna")); + } + String unidadMedidaIngresada = (listaArmas.get(i).getUnidadMedidaCantidad()==null || listaArmas.get(i).getUnidadMedidaCantidad().isEmpty())?listaArmas.get(i).getUnidadMedidaPeso():listaArmas.get(i).getUnidadMedidaCantidad(); + String columnaUnidadMedidaError = (listaArmas.get(i).getUnidadMedidaCantidad()==null || listaArmas.get(i).getUnidadMedidaCantidad().isEmpty())?"Columna 11":"Columna 9"; + if (listaArmas.get(i).getCatalogoTipoArma() == null) { + listaErrores.add("Fila "+fila.toString()+": "+"Columna 5: El Tipo de Arma Explosivo no existe en el Catlogo. Revise los espacios entre cada palabra y que este bien escrito."); + listaArmas.get(i).setCamposIncompletos(true); + tipoUnidadSeleccionada=null; + }else { + tipoUnidadSeleccionada= UnidadTipoController.findByClaseAndClasecode(catalogoClase.getPk().getCatalog(), catalogoClase.getPk().getCatalogcode(),listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(), unidadMedidaIngresada); + } + if(tipoUnidadSeleccionada!=null && tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()!=null && !tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().isEmpty()){ + if(tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().equalsIgnoreCase("UNIDAD") || tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().equalsIgnoreCase("UNIDADES")){ + campoCantidad=true; + }else if(tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().equalsIgnoreCase("KG")){ + campoCantidad=false; + } + } + else if (tipoUnidadSeleccionada==null){ + listaErrores.add("Fila "+fila.toString()+": "+ columnaUnidadMedidaError + ": " +MsgControlArmas.getProperty("msg_unidadMedidaNoExiste")); + } + } + //4-Tipo + if(listaArmas.get(i).getTipo()==null || listaArmas.get(i).getTipo().trim().isEmpty()){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 4: "+MsgControlArmas.getProperty("msg_tipoVacio")); + listaArmas.get(i).setCamposIncompletos(true); + } + //5-Calibre + if(listaArmas.get(i).getClase()!=null && !listaArmas.get(i).getClase().isEmpty() + && listaArmas.get(i).getClase().equalsIgnoreCase("ARMA DE FUEGO") + && (listaArmas.get(i).getCalibre()==null || listaArmas.get(i).getCalibre().trim().isEmpty())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 5: "+MsgControlArmas.getProperty("msg_calibreVacio")); + } + //Marca + if(listaArmas.get(i).getMarca()==null || listaArmas.get(i).getMarca().trim().isEmpty()){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 7: "+MsgControlArmas.getProperty("msg_marcaVacia")); + listaArmas.get(i).setCamposIncompletos(true); + } + if(campoCantidad){ + //Cantidad + if((listaArmas.get(i).getTextoCantidad()==null || listaArmas.get(i).getTextoCantidad().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 8: "+MsgControlArmas.getProperty("msg_cantidadVacia")); + listaArmas.get(i).setCamposIncompletos(true); + + }else if(listaFilas.get(i).getCell(8).getCellType()!=Cell.CELL_TYPE_NUMERIC && tipoUnidadSeleccionada!=null){ + //Verificando el tipo de dato numerico + listaErrores.add("Fila "+fila.toString()+": "+"Columna 8: "+MsgControlArmas.getProperty("msg_cantidadValorNumerico")); + } + + //U. Medida Cantidad + if((listaArmas.get(i).getUnidadMedidaCantidad()==null || listaArmas.get(i).getUnidadMedidaCantidad().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 9: "+MsgControlArmas.getProperty("msg_unidadMedidaCantidadVacia")); + } + + //Peso + if((listaArmas.get(i).getTextoPeso()!=null && !listaArmas.get(i).getTextoPeso().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 10: "+MsgControlArmas.getProperty("msg_pesoNoVacio")); + } + + //U. Medida Peso + if((listaArmas.get(i).getUnidadMedidaPeso()!=null && !listaArmas.get(i).getUnidadMedidaPeso().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 11: "+MsgControlArmas.getProperty("msg_unidadMedidaPesoNoVacia")); + } + //Validando que cuando la clase NO sea ARMA DE FUEGO, MUNICION, + //Explosivos, Accesorios, Fuegos Pirotecnicos, Sustancia Quimica, Armas no Letales + //la cantidad y unidad de medida cantidad esten vacios + //y el peso y unidad de medida peso NO esten vacios + }else if(listaArmas.get(i).getClase()!=null && !listaArmas.get(i).getClase().isEmpty()){ + //Cantidad + if((listaArmas.get(i).getTextoCantidad()!=null && !listaArmas.get(i).getTextoCantidad().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 8: "+MsgControlArmas.getProperty("msg_cantidadNoVacia")); + } + //U. Medida Cantidad + if(listaArmas.get(i).getUnidadMedidaCantidad()!=null && !listaArmas.get(i).getUnidadMedidaCantidad().trim().isEmpty() && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 9: "+MsgControlArmas.getProperty("msg_unidadMedidaCantidadNoVacia")); + } + //Peso + if((listaArmas.get(i).getTextoPeso()==null || listaArmas.get(i).getTextoPeso().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 10: "+MsgControlArmas.getProperty("msg_pesoVacio")); + listaArmas.get(i).setCamposIncompletos(true); + + }else if(listaFilas.get(i).getCell(10).getCellType()!=Cell.CELL_TYPE_NUMERIC && tipoUnidadSeleccionada!=null){ + //Verificando el tipo de dato numerico + listaErrores.add("Fila "+fila.toString()+": "+"Columna 10: "+MsgControlArmas.getProperty("msg_pesoValorNumerico")); + } + //U. Medida Peso + if((listaArmas.get(i).getUnidadMedidaPeso()==null || listaArmas.get(i).getUnidadMedidaPeso().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 11: "+MsgControlArmas.getProperty("msg_unidadMedidaPesoVacia")); + listaArmas.get(i).setCamposIncompletos(true); + } + } + //Verificando que no existan problemas en el arma proveniente del archivo EXCEL + //para validar entonces los datos en la base de datos + if(!listaArmas.get(i).getCamposIncompletos() && !listaArmas.get(i).getDuplicada()){ + //Verificando los datos en los catalogos + //Verificando la existencia de la clase en el catalogo + if(catalogoClase==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 2: "+MsgControlArmas.getProperty("msg_calibreNoExisteCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia de la longitud en el catalogo + if(catalogoLongitud==null){ + listaArmas.get(i).setExisteCatalogo(false); + if(listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 3: "+MsgControlArmas.getProperty("msg_longitudNoExisteCatalogo")); + } + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia del tipo de arma en el catalogo + if(catalogoTipoArma==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 4: "+MsgControlArmas.getProperty("msg_noExisteTipoArmaCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia del calibre en el catalogo + if(catalogoCalibre==null){ + listaArmas.get(i).setExisteCatalogo(false); + if(listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 5: "+MsgControlArmas.getProperty("msg_calibreNoExisteCatalogo")); + } + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia del color en el catalogo + if(listaArmas.get(i).getColor()!=null && !listaArmas.get(i).getColor().isEmpty()){ + if(catalogoColor==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 6: "+MsgControlArmas.getProperty("msg_colorNoExisteCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + } + //Verificando la existencia de la marca en el catalogo + if(catalogoMarca==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 7: "+MsgControlArmas.getProperty("msg_marcaNoExisteCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + //Validacio 4- Verificando que exista la combinacion clase, longitud, tipo arma y calibre + //en la tabla TARMTIPOARMAEXPLOSIVO + if(listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")){ + if(catalogoClase!=null && catalogoLongitud!=null && catalogoTipoArma!=null && catalogoCalibre!=null && tipoUnidadSeleccionada!=null){ + tipoArmaExplosivo=TiposArmasExplosivosController.findByClaseLongitudCalibreTipoArma(catalogoLongitud.getPk().getCatalog(), + catalogoCalibre.getPk().getCatalog(), catalogoClase.getPk().getCatalog(), catalogoTipoArma.getPk().getCatalog(),tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + + if(tipoArmaExplosivo==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado: "+listaArmas.get(i).getClase()+", "+listaArmas.get(i).getLongitud()+", "+listaArmas.get(i).getTipo()+", "+listaArmas.get(i).getCalibre()); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + }else{ + listaArmas.get(i).setTipoArmaExplosivo(tipoArmaExplosivo); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(true); + } + }else{ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado la combinaci\u00f3n del Tipo Arma Explosivo"); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } + }else{ + if(catalogoCalibre!=null && catalogoCalibre.getDescription()!=null && !catalogoCalibre.getDescription().equals("")){ + // Caso donde existe calibre + if(catalogoClase!=null && catalogoTipoArma!=null && tipoUnidadSeleccionada!=null){ + tipoArmaExplosivo=TiposArmasExplosivosController.findByClaseCalibreTipoArma(catalogoClase.getPk().getCatalog(), catalogoCalibre.getPk().getCatalog(), catalogoTipoArma.getPk().getCatalog(),tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + if(tipoArmaExplosivo==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado: "+listaArmas.get(i).getClase()+", "+listaArmas.get(i).getTipo()); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + }else{ + listaArmas.get(i).setTipoArmaExplosivo(tipoArmaExplosivo); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(true); + } + }else{ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado la combinaci\u00f3n del Tipo Arma Explosivo "); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } + } + else{ + // Caso donde no existe calibre + if(catalogoClase!=null && catalogoTipoArma!=null && tipoUnidadSeleccionada!=null){ + tipoArmaExplosivo=TiposArmasExplosivosController.findByClaseTipo(catalogoClase.getPk().getCatalog(), catalogoTipoArma.getPk().getCatalog(),tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + if(tipoArmaExplosivo==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado: "+listaArmas.get(i).getClase()+", "+listaArmas.get(i).getTipo()); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + }else{ + listaArmas.get(i).setTipoArmaExplosivo(tipoArmaExplosivo); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(true); + } + }else{ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado la combinaci\u00f3n del Tipo Arma Explosivo "); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } + } + + } + if(listaArmas.get(i).getCatalogoClase()!=null && listaArmas.get(i).getCatalogoTipoArma()!=null && listaArmas.get(i).getCatalogoMarca()!=null){ + TarmArmas armaBD; + //Si el tipo de registro es de Importacion, el arma se persiste como nueva + //no se busca en la base de datos + if(this.registro.getTiporegistro().equalsIgnoreCase("IMP")){ + listaArmas.get(i).setExisteBaseDatos(false); + armaBD=new TarmArmas(); + armaBD.setIsnew(true); + }else{ + //Verificando que el arma exista en la base de datos + //si el tipo de registro es de produccion + armaBD=null; //ArmasController.findBySerieMarca(listaArmas.get(i).getSerie(), listaArmas.get(i).getCatalogoMarca().getPk().getCatalog()); + if(armaBD==null){ + listaArmas.get(i).setExisteBaseDatos(false); + armaBD=new TarmArmas(); + armaBD.setIsnew(true); + }else{ + List listaExplosivos=TiposArmasExplosivosController.findByClaseTipoAll(listaArmas.get(i).getCatalogoClase().getPk().getCatalog(), + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog()); + if(listaExplosivos==null){ + listaArmas.get(i).setExisteBaseDatos(false); + }else{ + listaArmas.get(i).setExisteBaseDatos(false); + for (TarmTipoArmaExplosivo explosivo : listaExplosivos) { + if(explosivo.getPk().equalsIgnoreCase(armaBD.getCtipoarmaexplosivo())){ + listaArmas.get(i).setExisteBaseDatos(true); + armaBD.setIsnew(false); + break; + } + } + } + } + } + listaArmas.get(i).setArma(armaBD); + String unidadTipoIngresada = campoCantidad?listaArmas.get(i).getUnidadMedidaCantidad():listaArmas.get(i).getUnidadMedidaPeso(); + // CARGA EL CUPO ***** //persona,clase,tipoarmaexplosivo +// List cupo =ComercianteCupoController.findByPersonCode(usuario.getPk().getPersoncode().toString(), +// listaArmas.get(i).getCatalogoClase().getPk().getCatalog(), listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(), +// unidadTipoIngresada); +// +// if(cupo!=null && !cupo.isEmpty() && cupo.get(0).getTiporegistro().equalsIgnoreCase(this.registro.getTiporegistro())){ + //metodo de los TOTALES SETEADOS EN UN MAPA + cupoArmasExplosivos(i, mapaTotalesTemporales, fila,tipoUnidadSeleccionada); +// }else{ +// if(cupo==null || cupo.isEmpty()){ +// listaErrores.add("Fila "+fila.toString()+": Cupo no asignado para "+listaArmas.get(i).getClase()+"."); +// } +// else{ +// listaErrores.add("Fila "+fila.toString()+": Cupo no disponible para "+listaArmas.get(i).getClase()+"."); +// } +// listaArmas.get(i).setCupoInsuficiente(true); +// } + } + } + tipoUnidadSeleccionada = null; + } + } + + public void cupoArmasExplosivos(int i,HashMap mapaTotalesTemporales,Integer fila,TarmUnidadTipo tipoUnidadSeleccionada){ + +// listaArmas.get(i).setCupo1(0); + //Cargando el total + //saldo de la TotalPersona + BigDecimal saldoPasaraaAnterior = new BigDecimal(0); + //TarmTotalPersona totalMapa= new BigDecimal(0); + TarmTotalPersona totalPersona=null; +// Double cupoMaximo=listaArmas.get(i).getCupo().getCupounidad().doubleValue(); + //no existe + if(mapaTotalesTemporales.get(usuario.getPk().getPersoncode().toString()+ "|" + listaArmas.get(i).getCatalogoClase().getPk().getCatalog()+ "|" + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog())==null){ + totalPersona =TotalPersonaController.findMaxFecha(listaArmas.get(i).getCatalogoClase().getPk().getCatalog(), + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(), usuario.getPk().getPersoncode().toString(), + tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + if(totalPersona==null){ + totalPersona=new TarmTotalPersona(); + totalPersona.setTotal(new BigDecimal(0)); + }else{ + saldoPasaraaAnterior = (totalPersona==null?new BigDecimal(0):totalPersona.getTotal()); + } + BigDecimal peso = (listaArmas==null || listaArmas.get(i).getTextoPeso()==null || listaArmas.get(i).getTextoPeso().isEmpty())?new BigDecimal(0.0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoPeso())); + BigDecimal cantidad = (listaArmas==null || listaArmas.get(i).getTextoCantidad()==null || listaArmas.get(i).getTextoCantidad().isEmpty())?new BigDecimal(0.0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())); + totalPersona.setCantidadmovimiento(cantidad.add(peso)); + totalPersona.setTotal(new BigDecimal(0));//saldoPasaraaAnterior.add((listaArmas==null || listaArmas.get(i).getTextoCantidad()==null)?new BigDecimal(0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())))); + Double suma=0.0; + //Cantidad + if(listaArmas.get(i).getUnidadMedidaCantidad()!=null && !listaArmas.get(i).getUnidadMedidaCantidad().isEmpty()){ + listaArmas.get(i).setCantidad(Double.parseDouble(listaArmas.get(i).getTextoCantidad())); + totalPersona.setUnidadmedidapeso(listaArmas.get(i).getUnidadMedidaCantidad()); + //suma eltotal anterior + la cantidad a ingresar + suma=saldoPasaraaAnterior.doubleValue()+listaArmas.get(i).getCantidad(); + totalPersona.setTotal(new BigDecimal(suma)); + //Peso + }else if(listaArmas.get(i).getUnidadMedidaPeso()!=null && !listaArmas.get(i).getUnidadMedidaPeso().isEmpty()){ + listaArmas.get(i).setPeso(Double.parseDouble(listaArmas.get(i).getTextoPeso())); + totalPersona.setUnidadmedidapeso(listaArmas.get(i).getUnidadMedidaPeso()); + //suma eltotal anterior + la cantidad a ingresar + suma=saldoPasaraaAnterior.doubleValue()+listaArmas.get(i).getPeso(); + totalPersona.setTotal(new BigDecimal(suma)); + } + } + else{//existe la combinacion + totalPersona = mapaTotalesTemporales.get(usuario.getPk().getPersoncode().toString()+ "|" + listaArmas.get(i).getCatalogoClase().getPk().getCatalog()+ "|" + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog()); + BigDecimal peso = (listaArmas==null || listaArmas.get(i).getTextoPeso()==null || listaArmas.get(i).getTextoPeso().isEmpty())?new BigDecimal(0.0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoPeso())); + BigDecimal cantidad = (listaArmas==null || listaArmas.get(i).getTextoCantidad()==null || listaArmas.get(i).getTextoCantidad().isEmpty())?new BigDecimal(0.0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())); + totalPersona.setCantidadmovimiento(cantidad.add(peso).add(totalPersona.getCantidadmovimiento())); + totalPersona.setTotal(totalPersona.getSaldoanterior().add(totalPersona.getCantidadmovimiento()));//saldoPasaraaAnterior.add((listaArmas==null || listaArmas.get(i).getTextoCantidad()==null)?new BigDecimal(0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())))); + saldoPasaraaAnterior=totalPersona.getSaldoanterior(); + } + totalPersona.setPk(null); + totalPersona.setPersoncodigo(usuario.getPk().getPersoncode()); + totalPersona.setClase(listaArmas.get(i).getCatalogoClase().getPk().getCatalog()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setIngresoegreso("ING"); + totalPersona.setCarma(listaArmas.get(i).getArma().getPk()); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setFecha(new java.sql.Timestamp(new Date().getTime())); + totalPersona.setSaldoanterior(saldoPasaraaAnterior==null?new BigDecimal(0):saldoPasaraaAnterior); + totalPersona.setIsnew(true); + //Verificando si el usuario tiene cupo disponible para el arma + + //mapa con el nuevo total por clase tipo unidad + mapaTotalesTemporales.put(usuario.getPk().getPersoncode().toString()+ "|" + listaArmas.get(i).getCatalogoClase().getPk().getCatalog()+ "|" + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(),totalPersona); + listaArmas.get(i).setTotalPersona(totalPersona); + //Verificando que el la suma del total con la cantidad de armas + //no sea mayor que el cupo +// if(totalPersona.getTotal().doubleValue()>cupoMaximo){ +// listaErrores.add("Fila "+fila.toString()+": Cupo no disponible para "+listaArmas.get(i).getClase()); +// listaArmas.get(i).setCupoInsuficiente(true); +// }else{ +// //Actualizando el valor del total y del total anterior +// listaArmas.get(i).getTotalPersona().setSaldoanterior(listaArmas.get(i).getTotalPersona().getSaldoanterior()); +// listaArmas.get(i).getTotalPersona().setTotal(totalPersona.getTotal()); +// } + } + + /** + * Metodo que indica cuando una celda esta vacia + * @param celda + * @return + */ + public Boolean celdaVacia(Cell celda){ + Boolean vacia=false; + if(celda==null || celda.getCellType()==Cell.CELL_TYPE_BLANK || (celda.getCellType()==Cell.CELL_TYPE_STRING && celda.getStringCellValue().isEmpty())){ + vacia=true; + } + return vacia; + } + + /** + * + * @param codigopersona + * @return + */ + public static TarmArmas findBySerieMarca(String serie, String marca) { + try { + ArmaController cc = new ArmaController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("lote", serie); + cc.addFilter("marca", marca); + cc.querydatabaseSimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + + /** + * + * Metodo para encontrar por marca y tipoarmaexplosivo + * @param marca + * @param tipoArmaExplosivo + * @return + * @throws Exception + */ + public static List findByMarcaSerie(String cregistro,String marca, String serie) throws Exception { + + ArmaController cc = new ArmaController(); + //cc.init(); + cc.recperpage = 300; + cc.querydatabaseMarcaSerie(cregistro,marca, serie ); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + + } + + @SuppressWarnings("finally") + public File generarArchivoError(Long key){ + if(listaErrores.isEmpty()){ + + //MessageHelper.setMessageInfo("ARCHIVO SUBIDO CORRECTAMENTE"); + return null; + } + PrintWriter escribir=null; + File archivo = null; + try { + archivo = File.createTempFile("errorlog"+key,".txt"); + escribir = new PrintWriter(archivo); + + + for(String err : listaErrores){ + System.out.println(err); + + + escribir.print(err+"\r\n"); + } + //escribir.close(); + limpiar(); + + + + } + catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + finally{ + escribir.flush(); + escribir.close(); + return archivo; + } + + } + + /** + * Llama a la construccion del metodo para recargar + */ + public void descargarArchivo(){ + + Long key=new Date().getTime(); + File archivoTemporal=generarArchivoError(key); + if(archivoTemporal==null) + return; + try { + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition", "attachment; filename=errorlog"+key+".txt"); + OutputStream out = response.getOutputStream(); + InputStream inputStream = new FileInputStream(archivoTemporal.getAbsolutePath()); + + int read = 0; + byte[] bytes = new byte[1024]; + + while ((read = inputStream.read(bytes)) != -1) { + out.write(bytes, 0, read); + } + + inputStream.close(); + out.flush(); + + FacesContext.getCurrentInstance().responseComplete(); + + + } catch (Exception e) { + // TODO: handle exception + } + } + + /** + * Limpia las los valores en las listas + */ + public void limpiar(){ + try { + create(); + while(lrecord.iterator().hasNext()){ + record =lrecord.get(0); + remove(); + } + listaArmas = new ArrayList(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Carga las listas de cantones y limpia la lista de ciudades + */ + public void seleccionarProvincia(){ + try { + codigoProvincia=this.record.getProvincecode(); + lcantones = CantonController.find("EC", record.getProvincecode()); + lciudades = new ArrayList<>(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Carga las listas de ciudades + */ + public void seleccionarCanton(){ + try { + codigoCanton = this.record.getCantoncode(); + lciudades = CityController.find("EC", record.getProvincecode(), record.getCantoncode()); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + public void cargarDocumentosHabilitantes(String categoria){ + ldocumentospersona= new ArrayList<>(); + List listadocum=DocumentoHabilitanteController.findpersoncode(usuario.getPk().getPersoncode().toString(),categoria); + //Forma nmero 1 (Uso de Maps). + Map mapPersonas = new HashMap(listadocum.size()); + for(TarmDocumentoHabilitante p : listadocum) { + mapPersonas.put(p.getCtramite(), p); + } + //Agrego cada elemento del map a una nueva lista y muestro cada elemento. + System.out.println("Lista sin repetidos:"); + for(Entry p : mapPersonas.entrySet()) { + ldocumentospersona.add(p.getValue()); + } +// ldocumentospersona =DocumentoHabilitanteController.findpersoncode(usuario.getPk().getPersoncode().toString(),categoria); + } + + public void cambioTipoRegistro(){ + if(registro.getTiporegistro()!=null){ + if("PRO".equals(registro.getTiporegistro())){ + cargarDocumentosHabilitantes("4");//4 Fabrica, 5Fabricante + }else{// IMP + cargarDocumentosHabilitantes("8");//8 importador + } + }else{ + ldocumentospersona=new ArrayList<>(); + } + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + public String getCodigoProvincia() { + return codigoProvincia; + } + + public void setCodigoProvincia(String codigoProvincia) { + this.codigoProvincia = codigoProvincia; + } + + public String getCodigoCanton() { + return codigoCanton; + } + + public void setCodigoCanton(String codigoCanton) { + this.codigoCanton = codigoCanton; + } + + public String getCodigoCiudad() { + return codigoCiudad; + } + + public void setCodigoCiudad(String codigoCiudad) { + this.codigoCiudad = codigoCiudad; + } + + String codigoCiudad; + public void codigoCiudad(){ + + + } + + public void addPersoncodeFilter(String personcode) { + super.addFilter("pk.personcode", personcode); + } + + public List getLarmexcell() { + return listaArmas; + } + + public void setLarmexcell(List larmexcell) { + this.listaArmas = larmexcell; + } + + public ArmaExcell getArmaexcell() { + return armaexcell; + } + + public void setArmaexcell(ArmaExcell armaexcell) { + this.armaexcell = armaexcell; + } + + public TarmTipoArmaExplosivo getTipoarmexplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoarmexplosivo(TarmTipoArmaExplosivo tipoarmexplosivo) { + this.tipoArmaExplosivo = tipoarmexplosivo; + } + + public List getLaexel() { + return laexel; + } + + public void setLaexel(List laexel) { + this.laexel = laexel; + } + + public TcustPersonDetail getDetallesPersona() { + return detallesPersona; + } + + public void setDetallesPersona(TcustPersonDetail detallesPersona) { + this.detallesPersona = detallesPersona; + } + + public TcustPersonDetail getUsuario() { + return usuario; + } + + public void setUsuario(TcustPersonDetail usuario) { + this.usuario = usuario; + } + + public List getListaFilas() { + return listaFilas; + } + + public void setListaFilas(List listaFilas) { + this.listaFilas = listaFilas; + } + + public List getListaErrores() { + return listaErrores; + } + + public void setListaErrores(List listaErrores) { + this.listaErrores = listaErrores; + } + + public TarmTipoArmaExplosivo getTipoArmaExplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoArmaExplosivo(TarmTipoArmaExplosivo tipoArmaExplosivo) { + this.tipoArmaExplosivo = tipoArmaExplosivo; + } + + public List getListaArmas() { + return listaArmas; + } + + public void setListaArmas(List listaArmas) { + this.listaArmas = listaArmas; + } + + public PersonAddressController getPersonAddressController() { + return personAddressController; + } + + public void setPersonAddressController( + PersonAddressController personAddressController) { + this.personAddressController = personAddressController; + } + + public InputStream getFilei() { + return filei; + } + + public void setFilei(InputStream filei) { + this.filei = filei; + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public TcustPersonAddress getDireccion() { + return direccion; + } + + public void setDireccion(TcustPersonAddress direccion) { + this.direccion = direccion; + } + +// public List getCuposArmas() { +// return cuposArmas; +// } + // +// public void setCuposArmas(List cuposArmas) { +// this.cuposArmas = cuposArmas; +// } + +// public ComercianteCupoController getComercianteCupoController() { +// return comercianteCupoController; +// } + // +// public void setComercianteCupoController( +// ComercianteCupoController comercianteCupoController) { +// this.comercianteCupoController = comercianteCupoController; +// } + + public Boolean getDescargar() { + return descargar; + } + + public void setDescargar(Boolean descargar) { + this.descargar = descargar; + } + + public RegistroArmController getRegistroArmasController() { + return registroArmasController; + } + + public void setRegistroArmasController( + RegistroArmController registroArmasController) { + this.registroArmasController = registroArmasController; + } + + + public TotalArmasController getTotalPersonaController() { + return totalPersonaController; + } + + public void setTotalPersonaController( + TotalArmasController totalPersonaController) { + this.totalPersonaController = totalPersonaController; + } + + public TgeneCountry getPais() { + return pais; + } + + public void setPais(TgeneCountry pais) { + this.pais = pais; + } + + public List getLciudades() { + return lciudades; + } + + public void setLciudades(List lciudades) { + this.lciudades = lciudades; + } + + public TgeneCity getCiudad() { + return ciudad; + } + + public void setCiudad(TgeneCity ciudad) { + this.ciudad = ciudad; + } + + public List getArmas() { + return armas; + } + + public void setArmas(List armas) { + this.armas = armas; + } + + public List getTotalesPersoan() { + return totalesPersoan; + } + + public void setTotalesPersoan(List totalesPersoan) { + this.totalesPersoan = totalesPersoan; + } + + public TgeneCatalogDetail getTipoDocumento() { + return tipoDocumento; + } + + public void setTipoDocumento(TgeneCatalogDetail tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public List getTiposRegistro() { + return tiposRegistro; + } + + public void setTiposRegistro(List tiposRegistro) { + this.tiposRegistro = tiposRegistro; + } + + public TgeneCatalogDetail getTipoRegistro() { + return tipoRegistro; + } + + public void setTipoRegistro(TgeneCatalogDetail tipoRegistro) { + this.tipoRegistro = tipoRegistro; + } + + public List getLpaises() { + return lpaises; + } + + public void setLpaises(List lpaises) { + this.lpaises = lpaises; + } + + public List getLprovincias() { + return lprovincias; + } + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + public TarmRegistroArmas getRegistro() { + return registro; + } + + public void setRegistro(TarmRegistroArmas registro) { + this.registro = registro; + } + + public List getLaeropuertos() { + return laeropuertos; + } + + public void setLaeropuertos(List laeropuertos) { + this.laeropuertos = laeropuertos; + } + + public List getLdocumentospersona() { + return ldocumentospersona; + } + + public void setLdocumentospersona( + List ldocumentospersona) { + this.ldocumentospersona = ldocumentospersona; + } + + public String getClase() { + return clase; + } + + public void setClase(String clase) { + this.clase = clase; + } + + public Integer getPersoncode() { + return personcode; + } + + public void setPersoncode(Integer personcode) { + this.personcode = personcode; + } + + + + + + } diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ArmaController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ArmaController.java.svn-base new file mode 100644 index 0000000..7ae946e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ArmaController.java.svn-base @@ -0,0 +1,1693 @@ +package com.fp.frontend.controller.armas.parametros; + + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletResponse; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.ArmaExcell; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.funcionalidad.TotalArmasController; +import com.fp.frontend.controller.armas.solicitud.ArmasController; +import com.fp.frontend.controller.armas.solicitud.DocumentoHabilitanteController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.parmas.param.TarmComercianteCupo; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmUnidadTipo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + + + +/** + * @author Andres Cevallos + * Clase Controladora para la entidad TarmArma + * Incluye metodo de consulta para la busqueda de persona y registro + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ArmaController extends AbstractController { + + //Variabgles globales + private Integer personcode; + + private Boolean descargar; + private String csolicitud; + InputStream filei; + + //Datos generales + private TgeneCatalogDetail tipoDocumento; + private TcustPersonDetail detallesPersona; + + Date fechaActual; + private List tiposRegistro; + private TgeneCatalogDetail tipoRegistro; + + //Detalle del material + //Pais + private List lpaises; + private TgeneCountry pais; + //private String pais; + + //Provincia + private List lprovincias; + private String codigoProvincia; + + //Canton + private List lcantones; + private String codigoCanton; + + //Ciudad + private List lciudades; + private TgeneCity ciudad; + + //Registro armas + TarmRegistroArmas registro=new TarmRegistroArmas(); + + //Variables de las armas + private TcustPersonDetail usuario; + private TcustPersonAddress direccion; + private List listaFilas; + private List listaErrores; +// private List cuposArmas; + + //private BigDecimal pesoTotal; + private TarmTipoArmaExplosivo tipoArmaExplosivo; + private List listaArmas; + private ArmaExcell armaexcell; + + private List laexel; + private List armas=new ArrayList(); + private List totalesPersoan=new ArrayList(); + + //Aeropuertos + List laeropuertos=new ArrayList<>(); + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddressController; + +// @ManagedProperty(value = "#{comercianteCupoController}") +// private ComercianteCupoController comercianteCupoController; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmasController; + + @ManagedProperty(value = "#{totalArmasController}") + private TotalArmasController totalPersonaController; + + private List ldocumentospersona; + + private String clase; + public ArmaController() throws Exception { + super(TarmArmas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.record=new TarmArmas(); + this.beanalias = "ARMAS"; + this.create(); + + //Globales + descargar=false; + csolicitud=null; + + //Datos generales + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + //Obteniendo los datos de la persona + detallesPersona= PersonDetailController.find(String.valueOf(usuario.getPk().getPersoncode())); + + //Tipo de documento + tipoDocumento = CatalogDetailController.findxCodigoCodcatalogo(detallesPersona.getIdentificationcatalog(),detallesPersona.getIdentificationcatalogcode()); + + //Fecha actual + this.fechaActual=Calendar.getInstance().getTime(); + + //Tipos de registro + tiposRegistro=CatalogDetailController.find("TIPOREGISTRO", "REG"); + + //Detalle del material + lpaises=CountryController.find(); + registro.setFechasolicitud(new java.sql.Date((new Date()).getTime())); + + //Obteniendo la direccion de la persona + String tipoDireccion=""; + + if(detallesPersona!=null){ + switch(detallesPersona.getIdentificationcatalog()){ + case "CED": + tipoDireccion = "1"; + break; + case "RUC": + tipoDireccion= "2"; + break; + default: + tipoDireccion= ""; + break; + } + } + //direccion= personAddressController.findByPersonCode(usuario.getPk().getPersoncode().toString()); + direccion= personAddressController.findPrincipal(String.valueOf(usuario.getPk().getPersoncode().toString())) ; + + + //Imprtacion + this.lprovincias=ProvinceController.find("EC"); + + //Armas + listaErrores = new ArrayList(); + + //Controlador de totales +// this.totalPersonaController=new TotalPersonaController(); +// this.totalPersonaController.create(); +// this.totalPersonaController.setLrecord(new ArrayList()); + + RegistroArmController registroArmas = new RegistroArmController(); + registroArmas.init(); + registroArmas.setRecperpage(3000000); + registroArmas.addFilter("personcode", tsafeUserDetail.getPk().getPersoncode().toString()); + registroArmas.query(); + this.addFilter("estado", "REG"); + filtro(registroArmas.getLrecord()); + + //Obteniendo los aeropuertos + this.laeropuertos=CatalogDetailController.find("AEROPUERTOS"); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TarmTipoArmaExplosivo","clase","cclase","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo= new SubQuery("TarmTipoArmaExplosivo","clasecodigo","cclasecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud= new SubQuery("TarmTipoArmaExplosivo","longitud","clongitud","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo= new SubQuery("TarmTipoArmaExplosivo","longitudcodigo","clongitudcodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ccalibre","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo= new SubQuery("TarmTipoArmaExplosivo","calibrecodigo","ccalibrecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivo","ctipoarmaexplosivo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivocodigo","ctipoarmaexplosivocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapeso","cunidadmedidapeso","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapesocodigo","cunidadmedidapesocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + + Filter filtrofecha=new Filter(); + filtrofecha.setSql("t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) and t.estado !='DEST' and t.estado !='CDP'"); + dto.addFiltro(filtrofecha); + dto.setOrderby("pk"); + String sql=csolicitud; + if(csolicitud!=null){ + Filter filtro = new Filter(); + filtro.setSql(sql); + dto.addFiltro(filtro); + } + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + public void querydatabaseMarcaSerie(String cregistro,String marca, String serie) { + try { + + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TarmTipoArmaExplosivo","clase","cclase","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo= new SubQuery("TarmTipoArmaExplosivo","clasecodigo","cclasecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud= new SubQuery("TarmTipoArmaExplosivo","longitud","clongitud","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo= new SubQuery("TarmTipoArmaExplosivo","longitudcodigo","clongitudcodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ccalibre","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo= new SubQuery("TarmTipoArmaExplosivo","calibrecodigo","ccalibrecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivo","ctipoarmaexplosivo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivocodigo","ctipoarmaexplosivocodigo","i.pk=t.ctipoarmaexplosivo");// and i.clase='" + clase + "' and i.tipoarmaexplosivo='" + tipoArmaExplosivo + "'"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapeso","cunidadmedidapeso","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapesocodigo","cunidadmedidapesocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + + + Filter filtrofecha=new Filter(); + filtrofecha.setSql("t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) " + + " and t.estado !='DEST' and t.estado !='CDP' and t.lote " + (serie==null?" is null":("= '" + serie + "'")) + " and t.cregistro= '" + + cregistro + "' and t.marca " + (marca==null?" is null":("= '" + marca + "'"))); + dto.addFiltro(filtrofecha); + dto.setOrderby("pk"); + /* String sql=csolicitud; + if(csolicitud!=null){ + Filter filtro = new Filter(); + filtro.setSql(sql); + dto.addFiltro(filtro); + }*/ + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + /* Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE");*/ + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecOked") + protected void querydatabaseSimple() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql=" t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para armar el registro + * @param lsolicitud + */ + public void filtro(List lsolicitud){ + + for(TarmRegistroArmas soli : lsolicitud){ + if(csolicitud==null){ + csolicitud="(cregistro="+soli.getPk(); + } + else{ + csolicitud+=" or cregistro="+soli.getPk(); + } + } + csolicitud+=")"; + + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + + DtoSave dtosave = super.getDtoSave(true); + dtosave.setPosition(2); + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); + + registroArmasController.clearAll(); + DtoSave dtosaveregistroarma = registroArmasController.getDtoSave(true); + dtosaveregistroarma.setPosition(1); + msave.put(registroArmasController.getBeanalias(), dtosaveregistroarma); + + totalPersonaController.clearAll(); + DtoSave dtosavetotalper = totalPersonaController.getDtoSave(true); + dtosavetotalper.setPosition(3); + msave.put(totalPersonaController.getBeanalias(), dtosavetotalper); + + request.setSaveTables(msave); + request.getModifiedData().put("LISTAARMAS", this.armas); + request.getModifiedData().put("LISTATOTALES", this.totalesPersoan); + request.getModifiedData().put("REGISTRO", this.registro); + + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + //this.totalPersonaController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + + /** + * Metodo que carga y valida el contenido de un archivo excel con información de armas + * @param event + */ + public void cargarArchivo(FileUploadEvent event){ + HashMap mapaTotalesTemporales = new HashMap<>(); + int f1=0; + try { + //Completando los datos del registro + this.registro.setPersoncode(this.usuario.getPk().getPersoncode()); + this.registro.setTiporegistrocodigo("TIPOREGISTRO"); + this.registro.setFechasolicitud(new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + //Inicializando las listas + listaFilas=new ArrayList(); + listaArmas= new ArrayList(); + listaErrores= new ArrayList(); + //caraga el excel + UploadedFile selectedFile = event.getFile(); + InputStream archivo=selectedFile.getInputstream(); + XSSFWorkbook libro = new XSSFWorkbook(archivo); + XSSFSheet hoja = libro.getSheetAt(0); + //Iterando sobre las filas + int cont=0; + Iterator rowIterator = hoja.iterator(); + //Cargando el contenido de las celdas a una lista de objetos + while(rowIterator.hasNext()) { + cont++; + Row row = rowIterator.next(); + if(cont>1){ + Cell numero=row.getCell(0); + Cell serie=row.getCell(1); + Cell clase=row.getCell(2); + Cell longitud=row.getCell(3); + Cell tipo=row.getCell(4); + Cell calibre=row.getCell(5); + Cell color=row.getCell(6); + Cell marca=row.getCell(7); + Cell cantidad=row.getCell(8); + Cell umcantidad=row.getCell(9); + Cell peso=row.getCell(10); + Cell umpeso=row.getCell(11); + Boolean filaEnBlanco=false; + if(this.celdaVacia(numero) && this.celdaVacia(serie) && this.celdaVacia(clase) + && this.celdaVacia(longitud) && this.celdaVacia(tipo) && this.celdaVacia(calibre) + && this.celdaVacia(color) && this.celdaVacia(marca) && this.celdaVacia(cantidad) + && this.celdaVacia(umcantidad) && this.celdaVacia(peso) && this.celdaVacia(umpeso)){ + filaEnBlanco=true; + }else{ + listaFilas.add(row); + } + if(!filaEnBlanco){ + //arma la lista de las armas en un dto aniade en la lista listaArmas + armarlistaArmasExcel(numero, serie, clase, longitud, tipo, calibre, color, marca, cantidad, umcantidad, peso, umpeso, row); + } + } + } + //Verificando las filas duplicadas en el archivo + verificarFilasDuplicadas(listaArmas); + if(this.registro.getTiporegistro().equals("PRO")){ + //Verificando las filas duplicadas en la BD + verificarArmasExistentesEnBaseDeDatos(listaArmas, this.usuario.getPk().getPersoncode()); + } + Boolean contieneSerie=false; + //RECORRE LA LISTA DE LAS ARMAS y valida el CUPO DEL ARMA + //Validando los campos requeridos que estan vacios + recorreListaArmasExcel(contieneSerie,f1,mapaTotalesTemporales); + //Seteando los atributos de las armas y totales si no hay ningun error + if(listaErrores.isEmpty()){ + for (int i = 0; i < listaArmas.size(); i++) { + if(!listaArmas.get(i).getCamposIncompletos() && !listaArmas.get(i).getDuplicada() && listaArmas.get(i).getExisteCatalogo() + && listaArmas.get(i).getExisteTARMTIPOARMAEXPLOSIVO()){ //&& !listaArmas.get(i).getCupoInsuficiente() + //Marca + if(listaArmas.get(i).getCatalogoMarca()!=null){ + listaArmas.get(i).getArma().setMarcacodigo("MARCA"); + listaArmas.get(i).getArma().setMarca(listaArmas.get(i).getCatalogoMarca().getPk().getCatalog()); + } + //Color + if(listaArmas.get(i).getCatalogoColor()!=null){ + listaArmas.get(i).getArma().setColorcodigo("COLOR"); + listaArmas.get(i).getArma().setColor(listaArmas.get(i).getCatalogoColor().getPk().getCatalog()); + } + //Unidad medida cantidad + if(listaArmas.get(i).getTipoArmaExplosivo()!=null){ + listaArmas.get(i).getArma().setUnidadmedidacantidadcodigo("UNIDADMEDIDA"); + Double doubleNum=0.0; + //Cargando el catalodo del tipo de unidad de medida + if(listaArmas.get(i).getUnidadMedidaCantidad()!=null && !listaArmas.get(i).getUnidadMedidaCantidad().isEmpty()){ + listaArmas.get(i).getArma().setUnidadmedidacantidad(listaArmas.get(i).getUnidadMedidaCantidad()); + doubleNum=Double.parseDouble(listaArmas.get(i).getTextoCantidad()); + //Cantidad + Integer intNum=(int)doubleNum.doubleValue(); + listaArmas.get(i).getArma().setCantidad(intNum); + }else if(listaArmas.get(i).getUnidadMedidaPeso()!=null && !listaArmas.get(i).getUnidadMedidaPeso().isEmpty()){ + listaArmas.get(i).getArma().setUnidadmedidacantidad(listaArmas.get(i).getUnidadMedidaPeso()); + doubleNum=Double.parseDouble(listaArmas.get(i).getTextoPeso()); + //Peso + listaArmas.get(i).getArma().setPeso(new BigDecimal(doubleNum)); + } + } + //Estado + //1-Serie + //Validando que si el tipo de registro es de importacion + //las armas no contengan numero de serie + if(this.registro.getTiporegistro().equalsIgnoreCase("IMP")){ + listaArmas.get(i).getArma().setEstado("IMPO"); + }else{ + listaArmas.get(i).getArma().setEstado("PRO"); + } + listaArmas.get(i).getArma().setEstadocodigo("ESTADOARMA"); + if(direccion!=null){ + //Codigo de pais + listaArmas.get(i).getArma().setCountrycode(direccion.getCountrycode()); + //Codigo de provincia + listaArmas.get(i).getArma().setProvincecode(direccion.getProvincecode()); + //Codigo de canton + listaArmas.get(i).getArma().setCantoncode(direccion.getCantoncode()); + //Codigo de parroquia + listaArmas.get(i).getArma().setParroquiacode(direccion.getParroquiacode()); + //Codigo de ciudad + listaArmas.get(i).getArma().setCitycode(direccion.getCitycode()); + } + //Lote + listaArmas.get(i).getArma().setLote(listaArmas.get(i).getSerie()); + //Peso + if(listaArmas.get(i).getTextoPeso()!=null && !listaArmas.get(i).getTextoPeso().isEmpty()){ + listaArmas.get(i).getArma().setPeso(BigDecimal.valueOf(Double.parseDouble(listaArmas.get(i).getTextoPeso()))); + } + //Direccion + listaArmas.get(i).getArma().setDireccion(direccion.getAddress()); + + //Fecha de registro + listaArmas.get(i).getArma().setFecharegistro(new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + + //Tipo de arma explosivo + if(listaArmas.get(i).getTipoArmaExplosivo()!=null){ + listaArmas.get(i).getArma().setCtipoarmaexplosivo(listaArmas.get(i).getTipoArmaExplosivo().getPk()); + } + armas.add(listaArmas.get(i).getArma()); + } + } + //Se rrecorre el mapa HashMap mapaTotalesTemporales + for (TarmTotalPersona value : mapaTotalesTemporales.values()) { + totalesPersoan.add(value); + } + save(); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + }finally{ + if (!listaErrores.isEmpty()) { + listaArmas.clear(); + MessageHelper.setMessageError("ERRORES ENCONTRADOS DENTRO DEL ARCHIVO EXCEL: ");// + errores.toString()); + descargar=true; + }else{ +// MessageHelper.setMessageInfo("ARCHIVO CARGADO EXITOSAMENTE"); + descargar=false; + } + } + } + /** + * Metodo para cargar los valores del EXCEL EN UNA CLASE DTO(ArmaExcell ) + * @param numero * @param serie * @param clase * @param longitud * @param tipo * @param calibre + * @param color * @param marca * @param cantidad * @param umcantidad * @param peso * @param umpeso * @param row + */ + public void armarlistaArmasExcel(Cell numero,Cell serie,Cell clase,Cell longitud,Cell tipo,Cell calibre,Cell color,Cell marca, + Cell cantidad,Cell umcantidad,Cell peso,Cell umpeso,Row row){ + ArmaExcell arma=new ArmaExcell(); + arma.setTextoNumero(Utilidades.setearValorCelda(numero));//Numero + arma.setSerie(Utilidades.setearValorCelda(serie));//Serie + arma.setClase(Utilidades.setearValorCelda(clase));//Clase + arma.setLongitud(Utilidades.setearValorCelda(longitud));//Longitud + arma.setTipo(Utilidades.setearValorCelda(tipo));//Tipo + arma.setCalibre(Utilidades.setearValorCelda(calibre));//Calibre + arma.setColor(Utilidades.setearValorCelda(color));//Color + arma.setMarca(Utilidades.setearValorCelda(marca));//Marca + arma.setTextoCantidad(Utilidades.setearValorCelda(cantidad));//Cantidad + arma.setUnidadMedidaCantidad(Utilidades.setearValorCelda(umcantidad));//U. Medida Cantidad + arma.setTextoPeso(Utilidades.setearValorCelda(peso));//Peso + arma.setUnidadMedidaPeso(Utilidades.setearValorCelda(umpeso));//U. Medida Peso + if(this.registro.getTiporegistro().equals("PRO")){ + if(arma.getSerie()!=null){ + if(arma.getClase().equalsIgnoreCase("arma de fuego") && !arma.getTextoCantidad().equals("1.0") ){ + listaErrores.add("Fila "+row.getRowNum()+": "+"Columna 8: "+MsgControlArmas.getProperty("msg_limitecantidadarma")); + return; + } + listaArmas.add(arma); + }else { + listaErrores.add("Fila "+row.getRowNum()+": "+"Columna 1: "+MsgControlArmas.getProperty("msg_serieVacia")); + return; + } + }else { + if(arma.getClase().equalsIgnoreCase("arma de fuego") && arma.getTextoCantidad().equals("1.0")){ + listaArmas.add(arma); + }else if (!arma.getClase().equalsIgnoreCase("arma de fuego")) { + listaArmas.add(arma); + }else { + listaErrores.add("Fila "+row.getRowNum()+": "+"Columna 8: "+MsgControlArmas.getProperty("msg_limitecantidadarma")); + return; + } + } + } + + /** + * Metodo que verifica si existen filas duplicadas en el archivo de excell + * @param listaArmas + */ + private void verificarFilasDuplicadas(List listaArmas){ + for (int i = 0; i < listaArmas.size()-1; i++) { + for (int j = i+1; j < listaArmas.size(); j++) { + if(!this.registro.getTiporegistro().equalsIgnoreCase("IMP") && ((listaArmas.get(i).getSerie().equalsIgnoreCase(listaArmas.get(j).getSerie())) + && listaArmas.get(i).getClase().equalsIgnoreCase(listaArmas.get(j).getClase()) + && listaArmas.get(i).getTipo().equalsIgnoreCase(listaArmas.get(j).getTipo()) + && (!listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego") + || (listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego") && listaArmas.get(j).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")) + && listaArmas.get(i).getCalibre().equalsIgnoreCase(listaArmas.get(j).getCalibre())) + && listaArmas.get(i).getMarca().equalsIgnoreCase(listaArmas.get(j).getMarca()))){ + listaArmas.get(j).setDuplicada(true); + break; + } + } + } + } + + /** + * @param listaArmas + * @throws Exception + */ + @SuppressWarnings("static-access") + private void verificarArmasExistentesEnBaseDeDatos(List listaArmas, Integer codigoPersona) throws Exception{ + TgeneCatalogDetail codigoClase = new TgeneCatalogDetail(); + TgeneCatalogDetail codigoMarca = new TgeneCatalogDetail(); + TgeneCatalogDetail codigoTipo = new TgeneCatalogDetail(); + TgeneCatalogDetail codigoCalibre = new TgeneCatalogDetail(); + String codigoSerie; + List lstRegistroArmas = registroArmasController.findxPersoncode(String.valueOf(codigoPersona)); + if(lstRegistroArmas==null || listaArmas==null || lstRegistroArmas.isEmpty() || listaArmas.isEmpty()){ + return; + } + for (int i = 0; i < listaArmas.size(); i++) { + codigoClase=CatalogDetailController.findByCatalogcodeDescrption("CLASE", listaArmas.get(i).getClase()); + codigoTipo=CatalogDetailController.findByCatalogcodeDescrption("TIPOARMAEXPLOSIVO", listaArmas.get(i).getTipo()); + codigoMarca=CatalogDetailController.findByCatalogcodeDescrption("MARCA", listaArmas.get(i).getMarca()); + codigoSerie = this.registro.getTiporegistro().equalsIgnoreCase("IMP")?null:listaArmas.get(i).getSerie(); + codigoCalibre=listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")?CatalogDetailController.findByCatalogcodeDescrption("CALIBRE",listaArmas.get(i).getCalibre()):null; + + if((codigoClase==null && (listaArmas.get(i).getClase()!=null && !listaArmas.get(i).getClase().trim().isEmpty())) || (codigoTipo==null && (listaArmas.get(i).getTipo()!=null && !listaArmas.get(i).getTipo().trim().isEmpty())) + || (codigoMarca==null && (listaArmas.get(i).getMarca()!=null && !listaArmas.get(i).getMarca().trim().isEmpty())) || (codigoSerie==null && (listaArmas.get(i).getSerie()!=null && !listaArmas.get(i).getSerie().trim().isEmpty())) + || (codigoCalibre==null && (listaArmas.get(i).getCalibre()!=null && !listaArmas.get(i).getCalibre().trim().isEmpty())) + || listaArmas.get(i).getClase()==null || listaArmas.get(i).getMarca()==null || listaArmas.get(i).getCalibre()==null + || listaArmas.get(i).getClase().isEmpty() || listaArmas.get(i).getMarca().isEmpty() || listaArmas.get(i).getCalibre().isEmpty()){ + continue; + } + for(TarmRegistroArmas registroArmas :lstRegistroArmas){ + List lstArmasEncontradas = findByMarcaSerie(String.valueOf(registroArmas.getPk()),codigoMarca.getPk().getCatalog(), codigoSerie); + if(lstArmasEncontradas!=null){ + for(TarmArmas armas:lstArmasEncontradas){ + TarmTipoArmaExplosivo tipoArma = TiposArmasExplosivosController.findarma(armas.getCtipoarmaexplosivo()); + if(tipoArma.getClase().equalsIgnoreCase(codigoClase.getPk().getCatalog()) && codigoCalibre!=null?tipoArma.getCalibre().equalsIgnoreCase(codigoCalibre.getPk().getCatalog()):true && tipoArma.getTipoarmaexplosivo().equalsIgnoreCase(codigoTipo.getPk().getCatalog())){ + listaArmas.get(i).setDuplicada(true); + break; + } + } + } + } + } + } + /** + * Metodo que recorre la lista de las armas con los valores cargados del EXCEL + * @param contieneSerie + * @param f1 + * @param mapaTotalesTemporales + */ + public void recorreListaArmasExcel(Boolean contieneSerie, int f1,HashMap mapaTotalesTemporales){ + for (int i = 0; i < listaArmas.size(); i++) { + Integer fila=i+1; + f1=i; + Boolean campoCantidad=false; + //0-Datos duplicados + if(listaArmas.get(i).getDuplicada()){ + listaErrores.add("Fila "+fila.toString()+": "+MsgControlArmas.getProperty("msg_datosDuplicados")); + } + //1-Serie + //Validando que si el tipo de registro es de importacion + //las armas no contengan numero de serie + if(this.registro.getTiporegistro().equalsIgnoreCase("IMP") && (listaArmas.get(i).getSerie()!=null) && !contieneSerie){ + contieneSerie=true; + listaErrores.add(MsgControlArmas.getProperty("msg_archivoImportacionSerie")); + } + if(!this.registro.getTiporegistro().equalsIgnoreCase("IMP") && (listaArmas.get(i).getSerie()==null || listaArmas.get(i).getSerie().trim().isEmpty())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 1: "+MsgControlArmas.getProperty("msg_serieVacia")); + listaArmas.get(i).setCamposIncompletos(true); + } + //2-Clase + if(listaArmas.get(i).getClase()==null || listaArmas.get(i).getClase().trim().isEmpty()){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 2: "+MsgControlArmas.getProperty("msg_claseVacia")); + listaArmas.get(i).setCamposIncompletos(true); + + //3-Validando que cuando la clase sea ARMA DE FUEGO la longitud no este vacia + }else if(listaArmas.get(i).getClase().equalsIgnoreCase("ARMA DE FUEGO") + && (listaArmas.get(i).getLongitud()==null || listaArmas.get(i).getLongitud().trim().isEmpty())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 3: "+MsgControlArmas.getProperty("msg_longitudVacia")); + listaArmas.get(i).setCamposIncompletos(true); + + //Validando que cuando la clase no sea ARMA DE FUEGO la longitud este vacia + }else if(!listaArmas.get(i).getClase().equalsIgnoreCase("ARMA DE FUEGO") + && (listaArmas.get(i).getLongitud()!=null && !listaArmas.get(i).getLongitud().trim().isEmpty())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 3: "+MsgControlArmas.getProperty("msg_longitudNoVacia")); + } + //Carga de catalogos + TgeneCatalogDetail catalogoClase=CatalogDetailController.findByCatalogcodeDescrption("CLASE", listaArmas.get(i).getClase()); + listaArmas.get(i).setCatalogoClase(catalogoClase); + if(catalogoClase!=null && catalogoClase.getPk()!=null && catalogoClase.getPk().getCatalog()!=null && !clase.contains(catalogoClase.getPk().getCatalog())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 2: "+" No tiene permiso para cargar "+catalogoClase.getDescription()); + listaArmas.get(i).setCamposIncompletos(true); + }else if(catalogoClase==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 2: "+" No tiene ingresado una Clase V\u00e1lida "); + listaArmas.get(i).setCamposIncompletos(true); + } + TgeneCatalogDetail catalogoLongitud=CatalogDetailController.findByCatalogcodeDescrption("LONGITUD", listaArmas.get(i).getLongitud()); + listaArmas.get(i).setCatalogoLongitud(catalogoLongitud); + TgeneCatalogDetail catalogoTipoArma=CatalogDetailController.findByCatalogcodeDescrption("TIPOARMAEXPLOSIVO", listaArmas.get(i).getTipo()); + listaArmas.get(i).setCatalogoTipoArma(catalogoTipoArma); + TgeneCatalogDetail catalogoCalibre=CatalogDetailController.findByCatalogcodeDescrption("CALIBRE", listaArmas.get(i).getCalibre()); + listaArmas.get(i).setCatalogoCalibre(catalogoCalibre); + TgeneCatalogDetail catalogoColor=CatalogDetailController.findByCatalogcodeDescrption("COLOR", listaArmas.get(i).getColor()); + listaArmas.get(i).setCatalogoColor(catalogoColor); + TgeneCatalogDetail catalogoMarca=CatalogDetailController.findByCatalogcodeDescrption("MARCA", listaArmas.get(i).getMarca()); + listaArmas.get(i).setCatalogoMarca(catalogoMarca); + TarmUnidadTipo tipoUnidadSeleccionada =null;// new TarmUnidadTipo(); + if(catalogoClase!=null){ + //Obteniendo la configuracion de TARMUNIDADTIPO + if(!(listaArmas.get(i).getUnidadMedidaCantidad()==null || listaArmas.get(i).getUnidadMedidaCantidad().isEmpty()) && !(listaArmas.get(i).getUnidadMedidaPeso()==null || listaArmas.get(i).getUnidadMedidaPeso().isEmpty())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 9,11: "+MsgControlArmas.getProperty("msg_unidadMedidaSoloUna")); + } + String unidadMedidaIngresada = (listaArmas.get(i).getUnidadMedidaCantidad()==null || listaArmas.get(i).getUnidadMedidaCantidad().isEmpty())?listaArmas.get(i).getUnidadMedidaPeso():listaArmas.get(i).getUnidadMedidaCantidad(); + String columnaUnidadMedidaError = (listaArmas.get(i).getUnidadMedidaCantidad()==null || listaArmas.get(i).getUnidadMedidaCantidad().isEmpty())?"Columna 11":"Columna 9"; + if (listaArmas.get(i).getCatalogoTipoArma() == null) { + listaErrores.add("Fila "+fila.toString()+": "+"Columna 5: El Tipo de Arma Explosivo no existe en el Catlogo. Revise los espacios entre cada palabra y que este bien escrito."); + listaArmas.get(i).setCamposIncompletos(true); + tipoUnidadSeleccionada=null; + }else { + tipoUnidadSeleccionada= UnidadTipoController.findByClaseAndClasecode(catalogoClase.getPk().getCatalog(), catalogoClase.getPk().getCatalogcode(),listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(), unidadMedidaIngresada); + } + if(tipoUnidadSeleccionada!=null && tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()!=null && !tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().isEmpty()){ + if(tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().equalsIgnoreCase("UNIDAD") || tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().equalsIgnoreCase("UNIDADES")){ + campoCantidad=true; + }else if(tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().equalsIgnoreCase("KG")){ + campoCantidad=false; + } + } + else if (tipoUnidadSeleccionada==null){ + listaErrores.add("Fila "+fila.toString()+": "+ columnaUnidadMedidaError + ": " +MsgControlArmas.getProperty("msg_unidadMedidaNoExiste")); + } + } + //4-Tipo + if(listaArmas.get(i).getTipo()==null || listaArmas.get(i).getTipo().trim().isEmpty()){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 4: "+MsgControlArmas.getProperty("msg_tipoVacio")); + listaArmas.get(i).setCamposIncompletos(true); + } + //5-Calibre + if(listaArmas.get(i).getClase()!=null && !listaArmas.get(i).getClase().isEmpty() + && listaArmas.get(i).getClase().equalsIgnoreCase("ARMA DE FUEGO") + && (listaArmas.get(i).getCalibre()==null || listaArmas.get(i).getCalibre().trim().isEmpty())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 5: "+MsgControlArmas.getProperty("msg_calibreVacio")); + } + //Marca + if(listaArmas.get(i).getMarca()==null || listaArmas.get(i).getMarca().trim().isEmpty()){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 7: "+MsgControlArmas.getProperty("msg_marcaVacia")); + listaArmas.get(i).setCamposIncompletos(true); + } + if(campoCantidad){ + //Cantidad + if((listaArmas.get(i).getTextoCantidad()==null || listaArmas.get(i).getTextoCantidad().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 8: "+MsgControlArmas.getProperty("msg_cantidadVacia")); + listaArmas.get(i).setCamposIncompletos(true); + + }else if(listaFilas.get(i).getCell(8).getCellType()!=Cell.CELL_TYPE_NUMERIC && tipoUnidadSeleccionada!=null){ + //Verificando el tipo de dato numerico + listaErrores.add("Fila "+fila.toString()+": "+"Columna 8: "+MsgControlArmas.getProperty("msg_cantidadValorNumerico")); + } + + //U. Medida Cantidad + if((listaArmas.get(i).getUnidadMedidaCantidad()==null || listaArmas.get(i).getUnidadMedidaCantidad().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 9: "+MsgControlArmas.getProperty("msg_unidadMedidaCantidadVacia")); + } + + //Peso + if((listaArmas.get(i).getTextoPeso()!=null && !listaArmas.get(i).getTextoPeso().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 10: "+MsgControlArmas.getProperty("msg_pesoNoVacio")); + } + + //U. Medida Peso + if((listaArmas.get(i).getUnidadMedidaPeso()!=null && !listaArmas.get(i).getUnidadMedidaPeso().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 11: "+MsgControlArmas.getProperty("msg_unidadMedidaPesoNoVacia")); + } + //Validando que cuando la clase NO sea ARMA DE FUEGO, MUNICION, + //Explosivos, Accesorios, Fuegos Pirotecnicos, Sustancia Quimica, Armas no Letales + //la cantidad y unidad de medida cantidad esten vacios + //y el peso y unidad de medida peso NO esten vacios + }else if(listaArmas.get(i).getClase()!=null && !listaArmas.get(i).getClase().isEmpty()){ + //Cantidad + if((listaArmas.get(i).getTextoCantidad()!=null && !listaArmas.get(i).getTextoCantidad().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 8: "+MsgControlArmas.getProperty("msg_cantidadNoVacia")); + } + //U. Medida Cantidad + if(listaArmas.get(i).getUnidadMedidaCantidad()!=null && !listaArmas.get(i).getUnidadMedidaCantidad().trim().isEmpty() && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 9: "+MsgControlArmas.getProperty("msg_unidadMedidaCantidadNoVacia")); + } + //Peso + if((listaArmas.get(i).getTextoPeso()==null || listaArmas.get(i).getTextoPeso().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 10: "+MsgControlArmas.getProperty("msg_pesoVacio")); + listaArmas.get(i).setCamposIncompletos(true); + + }else if(listaFilas.get(i).getCell(10).getCellType()!=Cell.CELL_TYPE_NUMERIC && tipoUnidadSeleccionada!=null){ + //Verificando el tipo de dato numerico + listaErrores.add("Fila "+fila.toString()+": "+"Columna 10: "+MsgControlArmas.getProperty("msg_pesoValorNumerico")); + } + //U. Medida Peso + if((listaArmas.get(i).getUnidadMedidaPeso()==null || listaArmas.get(i).getUnidadMedidaPeso().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 11: "+MsgControlArmas.getProperty("msg_unidadMedidaPesoVacia")); + listaArmas.get(i).setCamposIncompletos(true); + } + } + //Verificando que no existan problemas en el arma proveniente del archivo EXCEL + //para validar entonces los datos en la base de datos + if(!listaArmas.get(i).getCamposIncompletos() && !listaArmas.get(i).getDuplicada()){ + //Verificando los datos en los catalogos + //Verificando la existencia de la clase en el catalogo + if(catalogoClase==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 2: "+MsgControlArmas.getProperty("msg_calibreNoExisteCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia de la longitud en el catalogo + if(catalogoLongitud==null){ + listaArmas.get(i).setExisteCatalogo(false); + if(listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 3: "+MsgControlArmas.getProperty("msg_longitudNoExisteCatalogo")); + } + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia del tipo de arma en el catalogo + if(catalogoTipoArma==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 4: "+MsgControlArmas.getProperty("msg_noExisteTipoArmaCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia del calibre en el catalogo + if(catalogoCalibre==null){ + listaArmas.get(i).setExisteCatalogo(false); + if(listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 5: "+MsgControlArmas.getProperty("msg_calibreNoExisteCatalogo")); + } + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia del color en el catalogo + if(listaArmas.get(i).getColor()!=null && !listaArmas.get(i).getColor().isEmpty()){ + if(catalogoColor==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 6: "+MsgControlArmas.getProperty("msg_colorNoExisteCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + } + //Verificando la existencia de la marca en el catalogo + if(catalogoMarca==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 7: "+MsgControlArmas.getProperty("msg_marcaNoExisteCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + //Validacio 4- Verificando que exista la combinacion clase, longitud, tipo arma y calibre + //en la tabla TARMTIPOARMAEXPLOSIVO + if(listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")){ + if(catalogoClase!=null && catalogoLongitud!=null && catalogoTipoArma!=null && catalogoCalibre!=null && tipoUnidadSeleccionada!=null){ + tipoArmaExplosivo=TiposArmasExplosivosController.findByClaseLongitudCalibreTipoArma(catalogoLongitud.getPk().getCatalog(), + catalogoCalibre.getPk().getCatalog(), catalogoClase.getPk().getCatalog(), catalogoTipoArma.getPk().getCatalog(),tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + + if(tipoArmaExplosivo==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado: "+listaArmas.get(i).getClase()+", "+listaArmas.get(i).getLongitud()+", "+listaArmas.get(i).getTipo()+", "+listaArmas.get(i).getCalibre()); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + }else{ + listaArmas.get(i).setTipoArmaExplosivo(tipoArmaExplosivo); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(true); + } + }else{ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado la combinaci\u00f3n del Tipo Arma Explosivo"); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } + }else{ + if(catalogoCalibre!=null && catalogoCalibre.getDescription()!=null && !catalogoCalibre.getDescription().equals("")){ + // Caso donde existe calibre + if(catalogoClase!=null && catalogoTipoArma!=null && tipoUnidadSeleccionada!=null){ + tipoArmaExplosivo=TiposArmasExplosivosController.findByClaseCalibreTipoArma(catalogoClase.getPk().getCatalog(), catalogoCalibre.getPk().getCatalog(), catalogoTipoArma.getPk().getCatalog(),tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + if(tipoArmaExplosivo==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado: "+listaArmas.get(i).getClase()+", "+listaArmas.get(i).getTipo()); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + }else{ + listaArmas.get(i).setTipoArmaExplosivo(tipoArmaExplosivo); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(true); + } + }else{ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado la combinaci\u00f3n del Tipo Arma Explosivo "); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } + } + else{ + // Caso donde no existe calibre + if(catalogoClase!=null && catalogoTipoArma!=null && tipoUnidadSeleccionada!=null){ + tipoArmaExplosivo=TiposArmasExplosivosController.findByClaseTipo(catalogoClase.getPk().getCatalog(), catalogoTipoArma.getPk().getCatalog(),tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + if(tipoArmaExplosivo==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado: "+listaArmas.get(i).getClase()+", "+listaArmas.get(i).getTipo()); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + }else{ + listaArmas.get(i).setTipoArmaExplosivo(tipoArmaExplosivo); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(true); + } + }else{ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado la combinaci\u00f3n del Tipo Arma Explosivo "); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } + } + + } + if(listaArmas.get(i).getCatalogoClase()!=null && listaArmas.get(i).getCatalogoTipoArma()!=null && listaArmas.get(i).getCatalogoMarca()!=null){ + TarmArmas armaBD; + //Si el tipo de registro es de Importacion, el arma se persiste como nueva + //no se busca en la base de datos + if(this.registro.getTiporegistro().equalsIgnoreCase("IMP")){ + listaArmas.get(i).setExisteBaseDatos(false); + armaBD=new TarmArmas(); + armaBD.setIsnew(true); + }else{ + //Verificando que el arma exista en la base de datos + //si el tipo de registro es de produccion + armaBD=null; //ArmasController.findBySerieMarca(listaArmas.get(i).getSerie(), listaArmas.get(i).getCatalogoMarca().getPk().getCatalog()); + if(armaBD==null){ + listaArmas.get(i).setExisteBaseDatos(false); + armaBD=new TarmArmas(); + armaBD.setIsnew(true); + }else{ + List listaExplosivos=TiposArmasExplosivosController.findByClaseTipoAll(listaArmas.get(i).getCatalogoClase().getPk().getCatalog(), + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog()); + if(listaExplosivos==null){ + listaArmas.get(i).setExisteBaseDatos(false); + }else{ + listaArmas.get(i).setExisteBaseDatos(false); + for (TarmTipoArmaExplosivo explosivo : listaExplosivos) { + if(explosivo.getPk().equalsIgnoreCase(armaBD.getCtipoarmaexplosivo())){ + listaArmas.get(i).setExisteBaseDatos(true); + armaBD.setIsnew(false); + break; + } + } + } + } + } + listaArmas.get(i).setArma(armaBD); + String unidadTipoIngresada = campoCantidad?listaArmas.get(i).getUnidadMedidaCantidad():listaArmas.get(i).getUnidadMedidaPeso(); + // CARGA EL CUPO ***** //persona,clase,tipoarmaexplosivo +// List cupo =ComercianteCupoController.findByPersonCode(usuario.getPk().getPersoncode().toString(), +// listaArmas.get(i).getCatalogoClase().getPk().getCatalog(), listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(), +// unidadTipoIngresada); +// +// if(cupo!=null && !cupo.isEmpty() && cupo.get(0).getTiporegistro().equalsIgnoreCase(this.registro.getTiporegistro())){ + //metodo de los TOTALES SETEADOS EN UN MAPA + cupoArmasExplosivos(i, mapaTotalesTemporales, fila,tipoUnidadSeleccionada); +// }else{ +// if(cupo==null || cupo.isEmpty()){ +// listaErrores.add("Fila "+fila.toString()+": Cupo no asignado para "+listaArmas.get(i).getClase()+"."); +// } +// else{ +// listaErrores.add("Fila "+fila.toString()+": Cupo no disponible para "+listaArmas.get(i).getClase()+"."); +// } +// listaArmas.get(i).setCupoInsuficiente(true); +// } + } + } + tipoUnidadSeleccionada = null; + } + } + + public void cupoArmasExplosivos(int i,HashMap mapaTotalesTemporales,Integer fila,TarmUnidadTipo tipoUnidadSeleccionada){ + +// listaArmas.get(i).setCupo1(0); + //Cargando el total + //saldo de la TotalPersona + BigDecimal saldoPasaraaAnterior = new BigDecimal(0); + //TarmTotalPersona totalMapa= new BigDecimal(0); + TarmTotalPersona totalPersona=null; +// Double cupoMaximo=listaArmas.get(i).getCupo().getCupounidad().doubleValue(); + //no existe + if(mapaTotalesTemporales.get(usuario.getPk().getPersoncode().toString()+ "|" + listaArmas.get(i).getCatalogoClase().getPk().getCatalog()+ "|" + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog())==null){ + totalPersona =TotalPersonaController.findMaxFecha(listaArmas.get(i).getCatalogoClase().getPk().getCatalog(), + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(), usuario.getPk().getPersoncode().toString(), + tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + if(totalPersona==null){ + totalPersona=new TarmTotalPersona(); + totalPersona.setTotal(new BigDecimal(0)); + }else{ + saldoPasaraaAnterior = (totalPersona==null?new BigDecimal(0):totalPersona.getTotal()); + } + BigDecimal peso = (listaArmas==null || listaArmas.get(i).getTextoPeso()==null || listaArmas.get(i).getTextoPeso().isEmpty())?new BigDecimal(0.0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoPeso())); + BigDecimal cantidad = (listaArmas==null || listaArmas.get(i).getTextoCantidad()==null || listaArmas.get(i).getTextoCantidad().isEmpty())?new BigDecimal(0.0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())); + totalPersona.setCantidadmovimiento(cantidad.add(peso)); + totalPersona.setTotal(new BigDecimal(0));//saldoPasaraaAnterior.add((listaArmas==null || listaArmas.get(i).getTextoCantidad()==null)?new BigDecimal(0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())))); + Double suma=0.0; + //Cantidad + if(listaArmas.get(i).getUnidadMedidaCantidad()!=null && !listaArmas.get(i).getUnidadMedidaCantidad().isEmpty()){ + listaArmas.get(i).setCantidad(Double.parseDouble(listaArmas.get(i).getTextoCantidad())); + totalPersona.setUnidadmedidapeso(listaArmas.get(i).getUnidadMedidaCantidad()); + //suma eltotal anterior + la cantidad a ingresar + suma=saldoPasaraaAnterior.doubleValue()+listaArmas.get(i).getCantidad(); + totalPersona.setTotal(new BigDecimal(suma)); + //Peso + }else if(listaArmas.get(i).getUnidadMedidaPeso()!=null && !listaArmas.get(i).getUnidadMedidaPeso().isEmpty()){ + listaArmas.get(i).setPeso(Double.parseDouble(listaArmas.get(i).getTextoPeso())); + totalPersona.setUnidadmedidapeso(listaArmas.get(i).getUnidadMedidaPeso()); + //suma eltotal anterior + la cantidad a ingresar + suma=saldoPasaraaAnterior.doubleValue()+listaArmas.get(i).getPeso(); + totalPersona.setTotal(new BigDecimal(suma)); + } + } + else{//existe la combinacion + totalPersona = mapaTotalesTemporales.get(usuario.getPk().getPersoncode().toString()+ "|" + listaArmas.get(i).getCatalogoClase().getPk().getCatalog()+ "|" + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog()); + BigDecimal peso = (listaArmas==null || listaArmas.get(i).getTextoPeso()==null || listaArmas.get(i).getTextoPeso().isEmpty())?new BigDecimal(0.0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoPeso())); + BigDecimal cantidad = (listaArmas==null || listaArmas.get(i).getTextoCantidad()==null || listaArmas.get(i).getTextoCantidad().isEmpty())?new BigDecimal(0.0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())); + totalPersona.setCantidadmovimiento(cantidad.add(peso).add(totalPersona.getCantidadmovimiento())); + totalPersona.setTotal(totalPersona.getSaldoanterior().add(totalPersona.getCantidadmovimiento()));//saldoPasaraaAnterior.add((listaArmas==null || listaArmas.get(i).getTextoCantidad()==null)?new BigDecimal(0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())))); + saldoPasaraaAnterior=totalPersona.getSaldoanterior(); + } + totalPersona.setPk(null); + totalPersona.setPersoncodigo(usuario.getPk().getPersoncode()); + totalPersona.setClase(listaArmas.get(i).getCatalogoClase().getPk().getCatalog()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setIngresoegreso("ING"); + totalPersona.setCarma(listaArmas.get(i).getArma().getPk()); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setFecha(new java.sql.Timestamp(new Date().getTime())); + totalPersona.setSaldoanterior(saldoPasaraaAnterior==null?new BigDecimal(0):saldoPasaraaAnterior); + totalPersona.setIsnew(true); + //Verificando si el usuario tiene cupo disponible para el arma + + //mapa con el nuevo total por clase tipo unidad + mapaTotalesTemporales.put(usuario.getPk().getPersoncode().toString()+ "|" + listaArmas.get(i).getCatalogoClase().getPk().getCatalog()+ "|" + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(),totalPersona); + listaArmas.get(i).setTotalPersona(totalPersona); + //Verificando que el la suma del total con la cantidad de armas + //no sea mayor que el cupo +// if(totalPersona.getTotal().doubleValue()>cupoMaximo){ +// listaErrores.add("Fila "+fila.toString()+": Cupo no disponible para "+listaArmas.get(i).getClase()); +// listaArmas.get(i).setCupoInsuficiente(true); +// }else{ +// //Actualizando el valor del total y del total anterior +// listaArmas.get(i).getTotalPersona().setSaldoanterior(listaArmas.get(i).getTotalPersona().getSaldoanterior()); +// listaArmas.get(i).getTotalPersona().setTotal(totalPersona.getTotal()); +// } + } + + /** + * Metodo que indica cuando una celda esta vacia + * @param celda + * @return + */ + public Boolean celdaVacia(Cell celda){ + Boolean vacia=false; + if(celda==null || celda.getCellType()==Cell.CELL_TYPE_BLANK || (celda.getCellType()==Cell.CELL_TYPE_STRING && celda.getStringCellValue().isEmpty())){ + vacia=true; + } + return vacia; + } + + /** + * + * @param codigopersona + * @return + */ + public static TarmArmas findBySerieMarca(String serie, String marca) { + try { + ArmaController cc = new ArmaController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("lote", serie); + cc.addFilter("marca", marca); + cc.querydatabaseSimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + + /** + * + * Metodo para encontrar por marca y tipoarmaexplosivo + * @param marca + * @param tipoArmaExplosivo + * @return + * @throws Exception + */ + public static List findByMarcaSerie(String cregistro,String marca, String serie) throws Exception { + + ArmaController cc = new ArmaController(); + //cc.init(); + cc.recperpage = 300; + cc.querydatabaseMarcaSerie(cregistro,marca, serie ); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + + } + + @SuppressWarnings("finally") + public File generarArchivoError(Long key){ + if(listaErrores.isEmpty()){ + + //MessageHelper.setMessageInfo("ARCHIVO SUBIDO CORRECTAMENTE"); + return null; + } + PrintWriter escribir=null; + File archivo = null; + try { + archivo = File.createTempFile("errorlog"+key,".txt"); + escribir = new PrintWriter(archivo); + + + for(String err : listaErrores){ + System.out.println(err); + + + escribir.print(err+"\r\n"); + } + //escribir.close(); + limpiar(); + + + + } + catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + finally{ + escribir.flush(); + escribir.close(); + return archivo; + } + + } + + /** + * Llama a la construccion del metodo para recargar + */ + public void descargarArchivo(){ + + Long key=new Date().getTime(); + File archivoTemporal=generarArchivoError(key); + if(archivoTemporal==null) + return; + try { + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition", "attachment; filename=errorlog"+key+".txt"); + OutputStream out = response.getOutputStream(); + InputStream inputStream = new FileInputStream(archivoTemporal.getAbsolutePath()); + + int read = 0; + byte[] bytes = new byte[1024]; + + while ((read = inputStream.read(bytes)) != -1) { + out.write(bytes, 0, read); + } + + inputStream.close(); + out.flush(); + + FacesContext.getCurrentInstance().responseComplete(); + + + } catch (Exception e) { + // TODO: handle exception + } + } + + /** + * Limpia las los valores en las listas + */ + public void limpiar(){ + try { + create(); + while(lrecord.iterator().hasNext()){ + record =lrecord.get(0); + remove(); + } + listaArmas = new ArrayList(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Carga las listas de cantones y limpia la lista de ciudades + */ + public void seleccionarProvincia(){ + try { + codigoProvincia=this.record.getProvincecode(); + lcantones = CantonController.find("EC", record.getProvincecode()); + lciudades = new ArrayList<>(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Carga las listas de ciudades + */ + public void seleccionarCanton(){ + try { + codigoCanton = this.record.getCantoncode(); + lciudades = CityController.find("EC", record.getProvincecode(), record.getCantoncode()); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + public void cargarDocumentosHabilitantes(String categoria){ + ldocumentospersona= new ArrayList<>(); + List listadocum=DocumentoHabilitanteController.findpersoncode(usuario.getPk().getPersoncode().toString(),categoria); + //Forma nmero 1 (Uso de Maps). + Map mapPersonas = new HashMap(listadocum.size()); + for(TarmDocumentoHabilitante p : listadocum) { + mapPersonas.put(p.getCtramite(), p); + } + //Agrego cada elemento del map a una nueva lista y muestro cada elemento. + System.out.println("Lista sin repetidos:"); + for(Entry p : mapPersonas.entrySet()) { + ldocumentospersona.add(p.getValue()); + } +// ldocumentospersona =DocumentoHabilitanteController.findpersoncode(usuario.getPk().getPersoncode().toString(),categoria); + } + + public void cambioTipoRegistro(){ + if(registro.getTiporegistro()!=null){ + if("PRO".equals(registro.getTiporegistro())){ + cargarDocumentosHabilitantes("4");//4 Fabrica, 5Fabricante + }else{// IMP + cargarDocumentosHabilitantes("8");//8 importador + } + }else{ + ldocumentospersona=new ArrayList<>(); + } + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + public String getCodigoProvincia() { + return codigoProvincia; + } + + public void setCodigoProvincia(String codigoProvincia) { + this.codigoProvincia = codigoProvincia; + } + + public String getCodigoCanton() { + return codigoCanton; + } + + public void setCodigoCanton(String codigoCanton) { + this.codigoCanton = codigoCanton; + } + + public String getCodigoCiudad() { + return codigoCiudad; + } + + public void setCodigoCiudad(String codigoCiudad) { + this.codigoCiudad = codigoCiudad; + } + + String codigoCiudad; + public void codigoCiudad(){ + + + } + + public void addPersoncodeFilter(String personcode) { + super.addFilter("pk.personcode", personcode); + } + + public List getLarmexcell() { + return listaArmas; + } + + public void setLarmexcell(List larmexcell) { + this.listaArmas = larmexcell; + } + + public ArmaExcell getArmaexcell() { + return armaexcell; + } + + public void setArmaexcell(ArmaExcell armaexcell) { + this.armaexcell = armaexcell; + } + + public TarmTipoArmaExplosivo getTipoarmexplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoarmexplosivo(TarmTipoArmaExplosivo tipoarmexplosivo) { + this.tipoArmaExplosivo = tipoarmexplosivo; + } + + public List getLaexel() { + return laexel; + } + + public void setLaexel(List laexel) { + this.laexel = laexel; + } + + public TcustPersonDetail getDetallesPersona() { + return detallesPersona; + } + + public void setDetallesPersona(TcustPersonDetail detallesPersona) { + this.detallesPersona = detallesPersona; + } + + public TcustPersonDetail getUsuario() { + return usuario; + } + + public void setUsuario(TcustPersonDetail usuario) { + this.usuario = usuario; + } + + public List getListaFilas() { + return listaFilas; + } + + public void setListaFilas(List listaFilas) { + this.listaFilas = listaFilas; + } + + public List getListaErrores() { + return listaErrores; + } + + public void setListaErrores(List listaErrores) { + this.listaErrores = listaErrores; + } + + public TarmTipoArmaExplosivo getTipoArmaExplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoArmaExplosivo(TarmTipoArmaExplosivo tipoArmaExplosivo) { + this.tipoArmaExplosivo = tipoArmaExplosivo; + } + + public List getListaArmas() { + return listaArmas; + } + + public void setListaArmas(List listaArmas) { + this.listaArmas = listaArmas; + } + + public PersonAddressController getPersonAddressController() { + return personAddressController; + } + + public void setPersonAddressController( + PersonAddressController personAddressController) { + this.personAddressController = personAddressController; + } + + public InputStream getFilei() { + return filei; + } + + public void setFilei(InputStream filei) { + this.filei = filei; + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public TcustPersonAddress getDireccion() { + return direccion; + } + + public void setDireccion(TcustPersonAddress direccion) { + this.direccion = direccion; + } + +// public List getCuposArmas() { +// return cuposArmas; +// } + // +// public void setCuposArmas(List cuposArmas) { +// this.cuposArmas = cuposArmas; +// } + +// public ComercianteCupoController getComercianteCupoController() { +// return comercianteCupoController; +// } + // +// public void setComercianteCupoController( +// ComercianteCupoController comercianteCupoController) { +// this.comercianteCupoController = comercianteCupoController; +// } + + public Boolean getDescargar() { + return descargar; + } + + public void setDescargar(Boolean descargar) { + this.descargar = descargar; + } + + public RegistroArmController getRegistroArmasController() { + return registroArmasController; + } + + public void setRegistroArmasController( + RegistroArmController registroArmasController) { + this.registroArmasController = registroArmasController; + } + + + public TotalArmasController getTotalPersonaController() { + return totalPersonaController; + } + + public void setTotalPersonaController( + TotalArmasController totalPersonaController) { + this.totalPersonaController = totalPersonaController; + } + + public TgeneCountry getPais() { + return pais; + } + + public void setPais(TgeneCountry pais) { + this.pais = pais; + } + + public List getLciudades() { + return lciudades; + } + + public void setLciudades(List lciudades) { + this.lciudades = lciudades; + } + + public TgeneCity getCiudad() { + return ciudad; + } + + public void setCiudad(TgeneCity ciudad) { + this.ciudad = ciudad; + } + + public List getArmas() { + return armas; + } + + public void setArmas(List armas) { + this.armas = armas; + } + + public List getTotalesPersoan() { + return totalesPersoan; + } + + public void setTotalesPersoan(List totalesPersoan) { + this.totalesPersoan = totalesPersoan; + } + + public TgeneCatalogDetail getTipoDocumento() { + return tipoDocumento; + } + + public void setTipoDocumento(TgeneCatalogDetail tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public List getTiposRegistro() { + return tiposRegistro; + } + + public void setTiposRegistro(List tiposRegistro) { + this.tiposRegistro = tiposRegistro; + } + + public TgeneCatalogDetail getTipoRegistro() { + return tipoRegistro; + } + + public void setTipoRegistro(TgeneCatalogDetail tipoRegistro) { + this.tipoRegistro = tipoRegistro; + } + + public List getLpaises() { + return lpaises; + } + + public void setLpaises(List lpaises) { + this.lpaises = lpaises; + } + + public List getLprovincias() { + return lprovincias; + } + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + public TarmRegistroArmas getRegistro() { + return registro; + } + + public void setRegistro(TarmRegistroArmas registro) { + this.registro = registro; + } + + public List getLaeropuertos() { + return laeropuertos; + } + + public void setLaeropuertos(List laeropuertos) { + this.laeropuertos = laeropuertos; + } + + public List getLdocumentospersona() { + return ldocumentospersona; + } + + public void setLdocumentospersona( + List ldocumentospersona) { + this.ldocumentospersona = ldocumentospersona; + } + + public String getClase() { + return clase; + } + + public void setClase(String clase) { + this.clase = clase; + } + + public Integer getPersoncode() { + return personcode; + } + + public void setPersoncode(Integer personcode) { + this.personcode = personcode; + } + + + + + + } diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/AuxCargaArmasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/AuxCargaArmasController.java.svn-base new file mode 100644 index 0000000..b7b9b19 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/AuxCargaArmasController.java.svn-base @@ -0,0 +1,517 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletResponse; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.jboss.logging.Logger; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.solicitud.AuxArmasController; +import com.fp.frontend.controller.armas.solicitud.DecomisoArmaController; +import com.fp.frontend.controller.armas.solicitud.DecomisoController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class AuxCargaArmasController extends AbstractController { + + /** + * Variable para listar los errores al cargar el excel + */ + private List listaErrores; + /** + * Mensaje de error + */ + private String mensajeError; + /** + * numero de armas procesadas + */ + private Integer numArmasProcesadas; + /** + * numero de armas con error + */ + private Integer numArmasError; + /** + * numero de armas con error + */ + private Integer numCorrectas; + /** + * Centro de control Policoa Judicia 2/PN07 + */ + private TarmCentroControl centroControl; + + /** + * Detalle del usuario + */ + @SuppressWarnings("unused") + private TcustPersonDetail usuario; + + /** + * Nombre del centro de control logeado + */ + private String centroControlNombreLogeado; + + /*Constante centro control*/ + @SuppressWarnings("unused") + private String nombreInstitucion; + @SuppressWarnings("unused") + private String institucion; + /*Cedula del propietario*/ + @SuppressWarnings("unused") + private String cedulaPropietario; + /*motivo incautacion*/ + @SuppressWarnings("unused") + private String motivocatalogo; + /*cantidad de armas*/ + @SuppressWarnings("unused") + private Integer cantidad=1; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmasController; + + /** + * Controlador que maneja el decomiso TarmDecomiso + */ + @ManagedProperty(value = "#{decomisoController}") + private DecomisoController decomisoController; + + /** + * Controlador que maneja TarmDecomisoArma + */ + @ManagedProperty(value = "#{decomisoArmaController}") + private DecomisoArmaController decomisoArmaController; + + private final static Logger LOG = Logger.getLogger(AuxCargaArmasController.class.getName()); + + public AuxCargaArmasController() throws Exception { + super(TarmArmas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.record = new TarmArmas(); + this.beanalias = "AUXARMAS"; +// listArmas = new ArrayList(); + cargaParametros(); + cargaUsuarioLogeado(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void cargaParametros(){ + nombreInstitucion=codigos("CODIGO.NOM.INSTIT.IMPORTE");//"PJ01" + institucion=codigos("CODIGO.INSTITUCION.IMPORTE");//2 + /*Cedula del propietario*/ + cedulaPropietario=codigos("CEDULA.PROPIETARIO.IMPORTE");//"999999999"; + /*motivo incautacion*/ + motivocatalogo=codigos("MOTIVO.IMPORTE");//"9"; + } + + /** + * Método para obtener los codigos + */ + private String codigos(String parametro){ + TgeneParameters tgeneParameters= ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + + public void cargaUsuarioLogeado(){ + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + centroControlNombreLogeado = tsafeUserDetail.getModifiedData().get("centrocontrol").toString(); + } + + + /* + * (non-Javadoc) + * + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + + DtoQuery dto = super.getDtoQuery(true); + Filter filtrofecha = new Filter(); + filtrofecha + .setSql("t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) and t.estado !='DEST' and t.estado !='CDP'"); + dto.addFiltro(filtrofecha); + dto.setOrderby("pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + public void save() { + try { + if(lrecord==null || lrecord.size()==0 || lrecord.isEmpty()){ + MessageHelper.setMessageError("NO EXISTEN ARMAS CARGADAS "); + return; + } + HashMap msave = new HashMap(); + Request request = this.callerhelper.getRequest(); + + DtoSave dtosave = super.getDtoSave(true); + dtosave.setPosition(1); + msave.put(this.beanalias, dtosave); + + request.setSaveTables(msave); + //request.getModifiedData().put("REGISTRO", this.registroArma); + + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + mensajeError=null; + MessageHelper.setMessageInfo(resp); + lrecord.clear(); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Metodo que carga y valida el contenido de un archivo excel con + * información de armas + * + * @param event + */ + public void cargarArchivo(FileUploadEvent event) { + // cargar Armas + lrecord.clear(); + this.clearAll(); + listaErrores = new ArrayList(); + int cont = 0; + try { + UploadedFile selectedFile = event.getFile(); + InputStream archivo = selectedFile.getInputstream(); + XSSFWorkbook libro = new XSSFWorkbook(archivo); + XSSFSheet hoja = libro.getSheetAt(0); + // Iterando sobre las filas + Iterator rowIterator = hoja.iterator(); + // Cargando el contenido de las celdas a una lista de objetos + SetlistaCodigoArmas = new HashSet(); + while (rowIterator.hasNext()) { + Row row = rowIterator.next(); + System.out.println("contador........."+cont); + if(cont!=0){ + Cell codigoArma = row.getCell(0); + if (!this.celdaVacia(codigoArma)) { + listaCodigoArmas.add(codigoArma.toString().trim()); + } else { + listaErrores.add("CELDA VACIA: "+codigoArma+" Num:" + cont); + } + cont++; + LOG.info("Contador "+cont); + }else{ + cont++; + } + } + archivo.close(); + LOG.info("ARMAS CARGADAS: "+listaCodigoArmas.size()); + int auxi=0; + //procesar armas + for (String item : listaCodigoArmas) { + System.out.println("contador2: "+auxi++); + TarmArmas arma = AuxArmasController.findByPK(item); + if (arma != null) { + record=arma; + record.setPk(null); + record.setIsnew(true); + record.setEstado("DEST"); + record.setFecharegistro(new java.sql.Date(new Date().getTime())); + SimpleDateFormat formato= new SimpleDateFormat("dd/MM/yyyy"); + record.setEstadoDecomiso("DESTRUIDAS: "+formato.format(new Date())); + super.update(); + }else{ + listaErrores.add("ARMA NO ENCONTRADA: "+item+" "); + } + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } finally { + numArmasProcesadas=cont-1; + if (!listaErrores.isEmpty()) { + MessageHelper.setMessageError("ERRORES ENCONTRADOS DENTRO DEL ARCHIVO EXCEL: "); + mensajeError="ERROR EN LA CARGA DE ARMAS"; + numCorrectas=lrecord.size(); + lrecord.clear(); + this.clearAll(); + }else{ + numCorrectas=lrecord.size(); + } + numArmasError =listaErrores.size(); + } + } + + + /** + * Metodo que indica cuando una celda esta vacia + * @param celda + * @return + */ + private Boolean celdaVacia(Cell celda) { + Boolean vacia = false; + if (celda == null || celda.getCellType() == Cell.CELL_TYPE_BLANK|| + (celda.getCellType() == Cell.CELL_TYPE_STRING && celda.getStringCellValue().isEmpty())) { + vacia = true; + } + return vacia; + } + + @SuppressWarnings("finally") + private File generarArchivoError(Long key) { + if (listaErrores.isEmpty()) { + return null; + } + PrintWriter escribir = null; + File archivo = null; + try { + archivo = File.createTempFile("errorlog" + key, ".txt"); + escribir = new PrintWriter(archivo); + for (String err : listaErrores) { + escribir.print(err + "\r\n"); + } + limpiar(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + escribir.flush(); + escribir.close(); + return archivo; + } + } + + /** + * Llama a la construccion del metodo para recargar + */ + public void descargarArchivo() { + if(listaErrores!=null && listaErrores.size()>0){ + Long key = new Date().getTime(); + File archivoTemporal = generarArchivoError(key); + if (archivoTemporal == null) + return; + try { + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition","attachment; filename=errorlog" + key + ".txt"); + OutputStream out = response.getOutputStream(); + InputStream inputStream = new FileInputStream(archivoTemporal.getAbsolutePath()); + int read = 0; + byte[] bytes = new byte[1024]; + + while ((read = inputStream.read(bytes)) != -1) { + out.write(bytes, 0, read); + } + + inputStream.close(); + out.flush(); + FacesContext.getCurrentInstance().responseComplete(); + } catch (Exception e) { + } + }else{ + MessageHelper.setMessageError("NO TIENE ERRORES"); + } + } + + /** + * Limpia las los valores en las listas + */ + public void limpiar() { + try { + create(); + while (lrecord.iterator().hasNext()) { + record = lrecord.get(0); + remove(); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public String getCodigoCiudad() { + return codigoCiudad; + } + + public void setCodigoCiudad(String codigoCiudad) { + this.codigoCiudad = codigoCiudad; + } + + String codigoCiudad; + + public void codigoCiudad() { + } + + public void addPersoncodeFilter(String personcode) { + super.addFilter("pk.personcode", personcode); + } + + public List getListaErrores() { + return listaErrores; + } + + public void setListaErrores(List listaErrores) { + this.listaErrores = listaErrores; + } + + public RegistroArmController getRegistroArmasController() { + return registroArmasController; + } + + public void setRegistroArmasController( + RegistroArmController registroArmasController) { + this.registroArmasController = registroArmasController; + } + + public String getMensajeError() { + return mensajeError; + } + + public void setMensajeError(String mensajeError) { + this.mensajeError = mensajeError; + } + + public Integer getNumArmasProcesadas() { + return numArmasProcesadas; + } + + public void setNumArmasProcesadas(Integer numArmasProcesadas) { + this.numArmasProcesadas = numArmasProcesadas; + } + + public Integer getNumArmasError() { + return numArmasError; + } + + public void setNumArmasError(Integer numArmasError) { + this.numArmasError = numArmasError; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getCentroControlNombreLogeado() { + return centroControlNombreLogeado; + } + + public void setCentroControlNombreLogeado(String centroControlNombreLogeado) { + this.centroControlNombreLogeado = centroControlNombreLogeado; + } + + public DecomisoController getDecomisoController() { + return decomisoController; + } + + public void setDecomisoController(DecomisoController decomisoController) { + this.decomisoController = decomisoController; + } + + public DecomisoArmaController getDecomisoArmaController() { + return decomisoArmaController; + } + + public void setDecomisoArmaController( + DecomisoArmaController decomisoArmaController) { + this.decomisoArmaController = decomisoArmaController; + } + + public Integer getNumCorrectas() { + return numCorrectas; + } + + public void setNumCorrectas(Integer numCorrectas) { + this.numCorrectas = numCorrectas; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/BuscarTramiteLovController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/BuscarTramiteLovController.java.netbeans-base new file mode 100644 index 0000000..c61da98 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/BuscarTramiteLovController.java.netbeans-base @@ -0,0 +1,273 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.solicitud.TarmTramiteController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + + +/** + * Clase controladora del lov asociado al bean TarmTramite. + * + * @author Christian Pazmino. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class BuscarTramiteLovController extends AbstractController { + + + /** + * + */ + private static final long serialVersionUID = 1L; + private List ltipoTramite; + private List ltipoAutorizacion; + private List lcategoria; + private List lusoActividad; + private String ctramite; + private String tipoPersonaAmbos; + private List tarmTramite; + private String tipoautorizacion; + private String tipotramite; + private String categoria; + + public BuscarTramiteLovController() throws Exception { + super(TarmTramite.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + try { + ctramite = CallerHelper.getLovParameter("ctramite"); + String tipopersonasol=CallerHelper.getLovParameter("tipopersonasol"); + if(tipopersonasol!=null && tipopersonasol.trim().length()>0){ + tipoPersonaAmbos=ParametersController.find("CODIGO.PERSONTYPE.AMBOS", "1").getTextvalue(); + this.getMfilelds().put("tipopersonasol", "(tipopersona='"+tipoPersonaAmbos+"' or tipopersona='"+tipopersonasol+"') "); + } + // Inicializa autoconsulta + super.startQuery(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TRAMITE"; + ltipoAutorizacion=CatalogDetailController.find("TIPOAUTORIZACION"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.tipotramite, t.tipoautorizacion, t.categoria, t.usoactividad"); + SubQuery stipoAutorizacion= new SubQuery + ("TgeneCatalogDetail", "description", "destipoAutorizacion", "i.pk.catalog = t.tipoautorizacion and i.pk.catalogcode=t.tipoautorizacioncodigo"); + SubQuery stipoTramite= new SubQuery + ("TgeneCatalogDetail", "description", "destipoTramite", "i.pk.catalog = t.tipotramite and i.pk.catalogcode=t.tipotramitecodigo"); + SubQuery scategoria= new SubQuery + ("TgeneCatalogDetail", "description", "descategoria", "i.pk.catalog = t.categoria and i.pk.catalogcode=t.categoriacodigo"); + SubQuery susoactividad= new SubQuery + ("TgeneCatalogDetail", "description", "desusoactividad", "i.pk.catalog = t.usoactividad and i.pk.catalogcode=t.usoactividadcodigo"); + + dto.addSubQuery(stipoAutorizacion); + dto.addSubQuery(stipoTramite); + dto.addSubQuery(scategoria); + dto.addSubQuery(susoactividad); + //valida si tiene el codigo del tramite padre + if (ctramite != null) { + Filter filtro= new Filter(); + filtro.setSql("pk !="+ctramite); + dto.addFiltro(filtro); + } + + if(this.getMfilelds().get("tipopersonasol")!=null){ + Filter filtro= new Filter(); + filtro.setSql(this.getMfilelds().get("tipopersonasol").toString()); + dto.addFiltro(filtro); + } + +// dto.setOrderby("t.tipotramite"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 980); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/buscartramiteLov.xhtml", options, params); + } + + public void catalogos(Listlist, String codigo,String pk){ + for(TgeneCatalogDetail item:list){ + if(codigo==item.getPk().getCatalog()){ + record.modifiedData.put(pk, item.getDescription()); + break; + } + } + } + + /** + * Método para el evento change del combo tramite + */ + public void executeTramite() { + tarmTramite = new ArrayList<>(); + ltipoTramite = new ArrayList<>(); + lcategoria = new ArrayList<>(); + lusoActividad = new ArrayList<>(); + + tipoautorizacion = (String) this.getMfilters().get("pk.tipoautorizacion"); + + tarmTramite = TarmTramiteController.findPorCriteriosTramite(tipoautorizacion); + + for (int i = 0; i < tarmTramite.size(); i++) { + TarmTramite tramite = tarmTramite.get(i); + + TgeneCatalogDetail catalogDetail = CatalogDetailController.findCatalogo(tramite.getTipotramitecodigo(),tramite.getTipotramite()); + if(!ltipoTramite.contains(catalogDetail)){ + ltipoTramite.add(catalogDetail); + } + } + + } + + /** + * Método para el evento change del combo autorizacion + */ + public void executeTipoTramite() { + lusoActividad = new ArrayList<>(); + tipotramite = (String) this.getMfilters().get("pk.tipotramite"); + + for (int i = 0; i < tarmTramite.size(); i++) { + TarmTramite tramite = tarmTramite.get(i); + if(tramite.getTipotramite().equals(tipotramite) && tramite.getCategoriacodigo().equals("CATEGORIA")){ + TgeneCatalogDetail catalogDetail = CatalogDetailController.findCatalogo(tramite.getCategoriacodigo(),tramite.getCategoria()); + + if(!lcategoria.contains(catalogDetail)){ + lcategoria.add(catalogDetail); + } + } + + } + + } + + /** + * Método para el evento change del combo categoria + */ + public void executeCategoria() { + + categoria = (String) this.getMfilters().get("pk.categoria"); + lusoActividad = new ArrayList<>(); + for (int i = 0; i < tarmTramite.size(); i++) { + TarmTramite tramite = tarmTramite.get(i); + if(tramite.getTipotramite().equals(tipotramite) && tramite.getCategoria().equals(categoria) && + tramite.getCategoriacodigo().equals("CATEGORIA") && tramite.getUsoactividadcodigo().equals("USOACTIVIDAD")){ + TgeneCatalogDetail catalogDetail = CatalogDetailController.findCatalogo(tramite.getUsoactividadcodigo(),tramite.getUsoactividad()); + + if(!lusoActividad.contains(catalogDetail)){ + lusoActividad.add(catalogDetail); + } + } + } + } + + public List getLtipoTramite() { + return ltipoTramite; + } + + public void setLtipoTramite(List ltipoTramite) { + this.ltipoTramite = ltipoTramite; + } + + public List getLcategoria() { + return lcategoria; + } + + public void setLcategoria(List lcategoria) { + this.lcategoria = lcategoria; + } + + public List getLusoActividad() { + return lusoActividad; + } + + public void setLusoActividad(List lusoActividad) { + this.lusoActividad = lusoActividad; + } + + public List getLtipoAutorizacion() { + return ltipoAutorizacion; + } + + public void setLtipoAutorizacion(List ltipoAutorizacion) { + this.ltipoAutorizacion = ltipoAutorizacion; + } + + public void setTramite() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setTramite(TarmTramite tarmTramite) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tarmTramite); + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/BuscarTramiteLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/BuscarTramiteLovController.java.svn-base new file mode 100644 index 0000000..c61da98 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/BuscarTramiteLovController.java.svn-base @@ -0,0 +1,273 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.solicitud.TarmTramiteController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + + +/** + * Clase controladora del lov asociado al bean TarmTramite. + * + * @author Christian Pazmino. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class BuscarTramiteLovController extends AbstractController { + + + /** + * + */ + private static final long serialVersionUID = 1L; + private List ltipoTramite; + private List ltipoAutorizacion; + private List lcategoria; + private List lusoActividad; + private String ctramite; + private String tipoPersonaAmbos; + private List tarmTramite; + private String tipoautorizacion; + private String tipotramite; + private String categoria; + + public BuscarTramiteLovController() throws Exception { + super(TarmTramite.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + try { + ctramite = CallerHelper.getLovParameter("ctramite"); + String tipopersonasol=CallerHelper.getLovParameter("tipopersonasol"); + if(tipopersonasol!=null && tipopersonasol.trim().length()>0){ + tipoPersonaAmbos=ParametersController.find("CODIGO.PERSONTYPE.AMBOS", "1").getTextvalue(); + this.getMfilelds().put("tipopersonasol", "(tipopersona='"+tipoPersonaAmbos+"' or tipopersona='"+tipopersonasol+"') "); + } + // Inicializa autoconsulta + super.startQuery(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TRAMITE"; + ltipoAutorizacion=CatalogDetailController.find("TIPOAUTORIZACION"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.tipotramite, t.tipoautorizacion, t.categoria, t.usoactividad"); + SubQuery stipoAutorizacion= new SubQuery + ("TgeneCatalogDetail", "description", "destipoAutorizacion", "i.pk.catalog = t.tipoautorizacion and i.pk.catalogcode=t.tipoautorizacioncodigo"); + SubQuery stipoTramite= new SubQuery + ("TgeneCatalogDetail", "description", "destipoTramite", "i.pk.catalog = t.tipotramite and i.pk.catalogcode=t.tipotramitecodigo"); + SubQuery scategoria= new SubQuery + ("TgeneCatalogDetail", "description", "descategoria", "i.pk.catalog = t.categoria and i.pk.catalogcode=t.categoriacodigo"); + SubQuery susoactividad= new SubQuery + ("TgeneCatalogDetail", "description", "desusoactividad", "i.pk.catalog = t.usoactividad and i.pk.catalogcode=t.usoactividadcodigo"); + + dto.addSubQuery(stipoAutorizacion); + dto.addSubQuery(stipoTramite); + dto.addSubQuery(scategoria); + dto.addSubQuery(susoactividad); + //valida si tiene el codigo del tramite padre + if (ctramite != null) { + Filter filtro= new Filter(); + filtro.setSql("pk !="+ctramite); + dto.addFiltro(filtro); + } + + if(this.getMfilelds().get("tipopersonasol")!=null){ + Filter filtro= new Filter(); + filtro.setSql(this.getMfilelds().get("tipopersonasol").toString()); + dto.addFiltro(filtro); + } + +// dto.setOrderby("t.tipotramite"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 980); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/buscartramiteLov.xhtml", options, params); + } + + public void catalogos(Listlist, String codigo,String pk){ + for(TgeneCatalogDetail item:list){ + if(codigo==item.getPk().getCatalog()){ + record.modifiedData.put(pk, item.getDescription()); + break; + } + } + } + + /** + * Método para el evento change del combo tramite + */ + public void executeTramite() { + tarmTramite = new ArrayList<>(); + ltipoTramite = new ArrayList<>(); + lcategoria = new ArrayList<>(); + lusoActividad = new ArrayList<>(); + + tipoautorizacion = (String) this.getMfilters().get("pk.tipoautorizacion"); + + tarmTramite = TarmTramiteController.findPorCriteriosTramite(tipoautorizacion); + + for (int i = 0; i < tarmTramite.size(); i++) { + TarmTramite tramite = tarmTramite.get(i); + + TgeneCatalogDetail catalogDetail = CatalogDetailController.findCatalogo(tramite.getTipotramitecodigo(),tramite.getTipotramite()); + if(!ltipoTramite.contains(catalogDetail)){ + ltipoTramite.add(catalogDetail); + } + } + + } + + /** + * Método para el evento change del combo autorizacion + */ + public void executeTipoTramite() { + lusoActividad = new ArrayList<>(); + tipotramite = (String) this.getMfilters().get("pk.tipotramite"); + + for (int i = 0; i < tarmTramite.size(); i++) { + TarmTramite tramite = tarmTramite.get(i); + if(tramite.getTipotramite().equals(tipotramite) && tramite.getCategoriacodigo().equals("CATEGORIA")){ + TgeneCatalogDetail catalogDetail = CatalogDetailController.findCatalogo(tramite.getCategoriacodigo(),tramite.getCategoria()); + + if(!lcategoria.contains(catalogDetail)){ + lcategoria.add(catalogDetail); + } + } + + } + + } + + /** + * Método para el evento change del combo categoria + */ + public void executeCategoria() { + + categoria = (String) this.getMfilters().get("pk.categoria"); + lusoActividad = new ArrayList<>(); + for (int i = 0; i < tarmTramite.size(); i++) { + TarmTramite tramite = tarmTramite.get(i); + if(tramite.getTipotramite().equals(tipotramite) && tramite.getCategoria().equals(categoria) && + tramite.getCategoriacodigo().equals("CATEGORIA") && tramite.getUsoactividadcodigo().equals("USOACTIVIDAD")){ + TgeneCatalogDetail catalogDetail = CatalogDetailController.findCatalogo(tramite.getUsoactividadcodigo(),tramite.getUsoactividad()); + + if(!lusoActividad.contains(catalogDetail)){ + lusoActividad.add(catalogDetail); + } + } + } + } + + public List getLtipoTramite() { + return ltipoTramite; + } + + public void setLtipoTramite(List ltipoTramite) { + this.ltipoTramite = ltipoTramite; + } + + public List getLcategoria() { + return lcategoria; + } + + public void setLcategoria(List lcategoria) { + this.lcategoria = lcategoria; + } + + public List getLusoActividad() { + return lusoActividad; + } + + public void setLusoActividad(List lusoActividad) { + this.lusoActividad = lusoActividad; + } + + public List getLtipoAutorizacion() { + return ltipoAutorizacion; + } + + public void setLtipoAutorizacion(List ltipoAutorizacion) { + this.ltipoAutorizacion = ltipoAutorizacion; + } + + public void setTramite() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setTramite(TarmTramite tarmTramite) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tarmTramite); + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/CalibreLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/CalibreLovController.java.svn-base new file mode 100644 index 0000000..0d856eb --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/CalibreLovController.java.svn-base @@ -0,0 +1,116 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class CalibreLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public CalibreLovController() throws Exception { + super(TgeneCatalogDetail.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "LONGITUDLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + this.getMfilters().put("pk.catalogcode", "CALIBRE"); + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog(TgeneCatalogDetail tgeneCatalogDetail) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneCatalogDetail); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/calibreLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/CashManagementHistoryController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/CashManagementHistoryController.java.svn-base new file mode 100644 index 0000000..075129a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/CashManagementHistoryController.java.svn-base @@ -0,0 +1,295 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.fun.TarmCashManagementHistory; +import com.fp.persistence.parmas.fun.TarmInventarioSubidoPorPersona; + +/** + * Clase controladora del bean TgeneCatalogDetail. + * + * @author Christian Pazmino. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CashManagementHistoryController extends AbstractController { + + // Fecha inicial + private Date fechainicial; + // Fecha final + private Date fechafinal; + + public CashManagementHistoryController() throws Exception { + super(TarmCashManagementHistory.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + if(fechainicial!=null && fechafinal!=null){ + super.startQuery(); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CASHMANAGEMENTHISTORY"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + DtoQuery dto = super.getDtoQuery(true); + + if(fechainicial!= null && fechafinal!=null){ + if(this.fechainicial.getTime() > this.fechafinal.getTime()){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaFin")); + this.lrecord = new ArrayList<>(); + return; + } + Filter filtroFecha = new Filter(); + SimpleDateFormat formato= new SimpleDateFormat("yyyy-MM-dd"); + filtroFecha.setSql("trunc(t.datefrom)>=TO_DATE('" + formato.format(fechainicial)+ "','yyyy-MM-dd')" +" and "+ "trunc(t.datefrom)<=TO_DATE('" + formato.format(fechafinal)+ "','yyyy-MM-dd')"); + dto.addFiltro(filtroFecha); + } + dto.setOrderby("t.datefrom"); + SubQuery queryPersonDetail = new SubQuery("TcustPersonDetail", "name", "personname", + "i.pk.personcode=(Select max(o.pk.personcode) from TsafeUserDetail o where o.pk.usercode = t.usercode and o.pk.dateto=to_date('2999-12-31', 'YYYY-MM-DD')) and i.pk.dateto=to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(queryPersonDetail); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + for(TarmCashManagementHistory tmp:lrecord){ + // path del alfresco arreglado + tmp.getModifiedData().put("pathAlfresco", tmp.getPathreporte().replace("cm:", "")); +// SimpleDateFormat sdfHora=new SimpleDateFormat("HH:mm"); + // Fecha y hora separados + Calendar fechaTmpCal = Calendar.getInstance(); + fechaTmpCal.setTimeInMillis(tmp.getDatefrom().getTime()); + tmp.getModifiedData().put("hora", StringUtils.leftPad(String.valueOf(fechaTmpCal.get(Calendar.HOUR_OF_DAY)),2,'0')+":"+StringUtils.leftPad(String.valueOf(fechaTmpCal.get(Calendar.MINUTE)),2,'0')); + tmp.getModifiedData().put("fecha", fechaTmpCal.get(Calendar.YEAR)+"-"+StringUtils.leftPad(String.valueOf(fechaTmpCal.get(Calendar.MONTH)+1),2,'0')+"-"+StringUtils.leftPad(String.valueOf(fechaTmpCal.get(Calendar.DAY_OF_MONTH)),2,'0')); + + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void update(TarmCashManagementHistory bean) throws Exception { + record=bean; + update(); + } + + /** + * + */ + public static TarmCashManagementHistory findUltimoReporteGenerado() { + try { + CashManagementHistoryController cc = new CashManagementHistoryController(); + cc.init(); + cc.recperpage = 10; + cc.addFilter("dateto", "2999-12-31"); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * + */ + public static List findReportesGeneradosVigentes() { + try { + CashManagementHistoryController cc = new CashManagementHistoryController(); + cc.init(); + cc.recperpage = 10000; + cc.addFilter("dateto", "2999-12-31"); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * + */ + public static List findReportesByDate(Date fechainicial, Date fechafinal) { + try { + CashManagementHistoryController cc = new CashManagementHistoryController(); + cc.init(); + cc.recperpage = 10000; +// cc.addFilter("dateto", "2999-12-31"); + cc.querydatabaseByDate(fechainicial, fechafinal);; + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaseByDate(Date fechainicial, Date fechafinal) { + try { + + DtoQuery dto = super.getDtoQuery(true); + + if(fechainicial!= null && fechafinal!=null){ + if(fechainicial.getTime() > fechafinal.getTime()){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaFin")); + this.lrecord = new ArrayList<>(); + return; + } + Filter filtroFecha = new Filter(); + SimpleDateFormat formato= new SimpleDateFormat("yyyy-MM-dd"); + filtroFecha.setSql("trunc(t.datefrom)>=TO_DATE('" + formato.format(fechainicial)+ "','yyyy-MM-dd')" +" and "+ "trunc(t.datefrom)<=TO_DATE('" + formato.format(fechafinal)+ "','yyyy-MM-dd')"); + dto.addFiltro(filtroFecha); + } + dto.setOrderby("t.datefrom"); + SubQuery queryPersonDetail = new SubQuery("TcustPersonDetail", "name", "personname", + "i.pk.personcode=(Select max(o.pk.personcode) from TsafeUserDetail o where o.pk.usercode = t.usercode and o.pk.dateto=to_date('2999-12-31', 'YYYY-MM-DD')) and i.pk.dateto=to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(queryPersonDetail); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + for(TarmCashManagementHistory tmp:lrecord){ + // path del alfresco arreglado + tmp.getModifiedData().put("pathAlfresco", tmp.getPathreporte().replace("cm:", "")); +// SimpleDateFormat sdfHora=new SimpleDateFormat("HH:mm"); + // Fecha y hora separados + Calendar fechaTmpCal = Calendar.getInstance(); + fechaTmpCal.setTimeInMillis(tmp.getDatefrom().getTime()); + tmp.getModifiedData().put("hora", StringUtils.leftPad(String.valueOf(fechaTmpCal.get(Calendar.HOUR_OF_DAY)),2,'0')+":"+StringUtils.leftPad(String.valueOf(fechaTmpCal.get(Calendar.MINUTE)),2,'0')); + tmp.getModifiedData().put("fecha", fechaTmpCal.get(Calendar.YEAR)+"-"+StringUtils.leftPad(String.valueOf(fechaTmpCal.get(Calendar.MONTH)+1),2,'0')+"-"+StringUtils.leftPad(String.valueOf(fechaTmpCal.get(Calendar.DAY_OF_MONTH)),2,'0')); + + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Limpia los registros anteriores + */ + public void limpiar(){ + this.lrecord = new ArrayList<>(); + fechainicial= null; + fechafinal= null; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/CatalogFilterLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/CatalogFilterLovController.java.svn-base new file mode 100644 index 0000000..dbbf5a1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/CatalogFilterLovController.java.svn-base @@ -0,0 +1,160 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author Christian Pazmino. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class CatalogFilterLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private String tituloLOV; + private String filtro; + + public CatalogFilterLovController() throws Exception { + super(TgeneCatalogDetail.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + tituloLOV = CallerHelper.getLovParameter("tituloLOV"); + + String catalogcode = CallerHelper.getLovParameter("catalogcode"); + if (catalogcode != null) { + super.addFilter("pk.catalogcode", catalogcode); + } + // Valor usado para filtrar registros de la tabla TGENECATALOGDETAIL + filtro = CallerHelper.getLovParameter("filtro"); + + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CLASELOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + + Filter filtroGeneral = new Filter(); + filtroGeneral.setSql(filtro); + dto.addFiltro(filtroGeneral); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setcatalog() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setcatalog(TgeneCatalogDetail tgeneCatalogDetail) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneCatalogDetail); + } + + public String getTituloLOV() { + return tituloLOV; + } + + public void setTituloLOV(String tituloLOV) { + this.tituloLOV = tituloLOV; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/catalogFilterLov.xhtml", options, params); + } + + public static List findTramiteSancion() { + try { + CatalogFilterLovController cc = new CatalogFilterLovController(); + cc.init(); + cc.recperpage = 300; + cc.filtro = "t.pk.catalog in ('1','6')"; + cc.addFilter("pk.catalogcode", "TIPOAUTORIZACION"); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/CentroControlArmasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/CentroControlArmasController.java.svn-base new file mode 100644 index 0000000..b88afef --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/CentroControlArmasController.java.svn-base @@ -0,0 +1,668 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CentroControlArmasController extends AbstractController { + + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List linstitucion; + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List lnombreInstitucion; + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lprovinces; + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcantones; + + /** + * Atributo para la lista de objetos TgeneParroquia + */ + private List lparroquias; + /** + * Atributo para la lista de objetos TgeneCatalogDetail (catalogo de grados asignados a los militares) + */ + private List lgrados; + /** + * Variable para activar o desactivar los campos segun la opcion seleccionada + */ + private String editarReg; + /** + * Variable de tipo TcustPersonDetail para setear cuando seleccione del lov + */ + private TcustPersonDetail personaDetailSelecionada; + + public CentroControlArmasController() throws Exception { + super(TarmCentroControl.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CENTCONTARMAS"; + //CARGA DE CATALOGOS + linstitucion=CatalogDetailController.find("INSTITUCION"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + SubQuery stipoInstitucion= new SubQuery + ("TgeneCatalogDetail", "description", "desinstitucion", "i.pk.catalog = t.institucion and i.pk.catalogcode=t.instituciontipo"); + SubQuery stipoInstitucionLegalcode= new SubQuery + ("TgeneCatalogDetail", "legalcode", "legalcode", "i.pk.catalog = t.institucion and i.pk.catalogcode=t.instituciontipo"); + SubQuery snombreinstitucion= new SubQuery + ("TgeneCatalogDetail", "description", "desnombreinstitucion", "i.pk.catalog = t.nombreinstitucion and i.pk.catalogcode=t.nombreinstitucioncodigo"); + SubQuery sprovincia= new SubQuery + ("TgeneProvince", "description", "desprovincia", "i.pk.countrycode = t.countrycode and i.pk.provincecode= t.provincecode"); + SubQuery scanton= new SubQuery + ("TgeneCanton", "description", "descanton", "i.pk.countrycode = t.countrycode and i.pk.provincecode=t.provincecode and i.pk.cantoncode=t.cantoncode"); + SubQuery sparroquia= new SubQuery + ("TgeneParroquia", "description", "desparroquia", "i.pk.countrycode = t.countrycode and i.pk.provincecode=t.provincecode and i.pk.cantoncode=t.cantoncode and i.pk.parroquiacode=t.parroquiacode"); + SubQuery spersona= new SubQuery + ("TcustPersonDetail", "name", "nombre", "i.pk.personcode=t.personcode and i.pk.dateto=to_date('2999-12-31', 'YYYY-MM-DD')"); + SubQuery sgrado= new SubQuery + ("TgeneCatalogDetail", "description", "desgrado", "i.pk.catalog = t.grado and i.pk.catalogcode=t.gradocodigo"); + dto.addSubQuery(stipoInstitucion); + dto.addSubQuery(stipoInstitucionLegalcode); + dto.addSubQuery(snombreinstitucion); + dto.addSubQuery(sprovincia); + dto.addSubQuery(scanton); + dto.addSubQuery(sparroquia); + dto.addSubQuery(spersona); + dto.addSubQuery(sgrado); + dto.setOrderby("t.institucion"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(this.lrecord!=null && !this.lrecord.isEmpty()){ + this.record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para el evento change del combo institucion + */ + public void executeInstitucion() { + if ((getMfilters().get("institucion")!= null) && (getMfilters().get("institucion").compareTo("") != 0)) { + lnombreInstitucion=CatalogDetailController.find("NOMBREINSTITUCION",getMfilters().get("institucion")); + } + } + + /** + * Metodo q se ejecuta cuando pulsamos el boton crear + */ + @Override + public void create() throws Exception{ + if (super.getMfilters().get("institucion") == null || super.getMfilters().get("institucion").equals("%")) { + MessageHelper.setMessageError("INSTITUCI\u00D3N REQUERIDA"); + return; + } + editarReg=null; + super.create(); + //se carga el nombre de la institucion seleccionada + catalogos(linstitucion, getMfilters().get("institucion"), "desinstitucion"); + record.setInstituciontipo("INSTITUCION"); + record.setInstitucion(super.getMfilters().get("institucion")); + record.setNombreinstitucioncodigo("NOMBREINSTITUCION"); + record.setGradocodigo("MILITARYGRADE"); + //se consulta las provincias del ecuador + record.setCountrycode("EC"); + if(lprovinces==null || lprovinces.size()==0){ + lprovinces = ProvinceController.find(record.getCountrycode()); + } + //consulta los grados + if(lgrados== null || lgrados.size()==0){ + lgrados=CatalogDetailController.find("MILITARYGRADE"); + } + personaDetailSelecionada= new TcustPersonDetail(); + } + + @Override + public void update() throws Exception { + catalogos(lnombreInstitucion, record.getNombreinstitucion(), "desnombreinstitucion");//lista, campo a validar, pk del mdafile + catalogos(linstitucion, record.getInstitucion(), "desinstitucion"); + catalogos(lgrados, record.getGrado(), "desgrado"); + nombreProvincia(); + nombreCanton(); + nombreParroquia(); + super.update(); + } + + + /** + * Método para cargar datos en el editar + */ + public void loadEdit() { + personaDetailSelecionada= new TcustPersonDetail(); + personaDetailSelecionada.setName(record.getModifiedData().get("nombre").toString()); + //consulta los nombres de las intituciones + lnombreInstitucion=CatalogDetailController.find("NOMBREINSTITUCION",record.getInstitucion()); + if(lprovinces==null || lprovinces.size()==0){ + lprovinces = ProvinceController.find(record.getCountrycode()); + } + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + //consulta los grados + if(lgrados== null || lgrados.size()==0){ + lgrados=CatalogDetailController.find("MILITARYGRADE"); + } + editarReg="SI"; + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + lparroquias = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + } + } + + /** + * Metodos para recorreer los combos y setear las descripciones de lo q se escoge + */ + public void catalogos(Listlist, String codigo,String pk){ + for(TgeneCatalogDetail item:list){ + if(codigo.equals(item.getPk().getCatalog())){ + record.modifiedData.put(pk, item.getDescription()); + break; + } + } + } + + /** + * Metodo para obtener la descripcion de la provincia + */ + public void nombreProvincia(){ + for(TgeneProvince provincia:lprovinces){ + if(provincia.getPk().getProvincecode().equals(record.getProvincecode())){ + record.getModifiedData().put("desprovincia", provincia.getDescription()); + + } + } + } + + /** + * Metodo para obtener la descripcion del canton + */ + public void nombreCanton(){ + for(TgeneCanton canton:lcantones){ + if(canton.getPk().getProvincecode().equals(record.getProvincecode()) && canton.getPk().getCantoncode().equals(record.getCantoncode())){ + record.getModifiedData().put("descanton", canton.getDescription()); + + } + } + } + + /** + * Metodo para obtener la descripcion de la provincia + */ + public void nombreParroquia(){ + for(TgeneParroquia parroquia:lparroquias){ + if(parroquia.getPk().getProvincecode().equals(record.getProvincecode()) && parroquia.getPk().getCantoncode().equals(record.getCantoncode()) + && parroquia.getPk().getParroquiacode().equals(record.getParroquiacode())){ + record.getModifiedData().put("desparroquia", parroquia.getDescription()); + + } + } + } + + /** + * Método para abrir el lov de personas + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + openLov(params); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), true); + // lovpersona es el nombre de la pagina + RequestContext.getCurrentInstance().openDialog("/pages/customer/lov/personLov.xhtml", options, params); + } + + + /** + * Maneja la respuesta del Lov de Personas + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + personaDetailSelecionada = (TcustPersonDetail) event.getObject(); + this.record.put("dateto", personaDetailSelecionada.getPk().getDateto()); + this.record.put("personcode", personaDetailSelecionada.getPk().getPersoncode()); + this.record.put("nombre", personaDetailSelecionada.getName()); + //seteo de los codigos de persona + record.setPersoncode(personaDetailSelecionada.getPk().getPersoncode()); + record.setDateto(personaDetailSelecionada.getPk().getDateto()); + } + + + /** + * Metodo para buscar todos los centros de control + * @param ccentrocontrol + * @return + */ + public static List findAll() { + try { + CentroControlArmasController cc = new CentroControlArmasController(); + cc.init(); + cc.recperpage = 10000; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para buscar por codigo de centro de control + * @param ccentrocontrol + * @return + */ + public static List find(String ccentrocontrol) { + try { + CentroControlArmasController cc = new CentroControlArmasController(); + cc.init(); + cc.recperpage = 15; + cc.addFilter("pk", ccentrocontrol); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para validar el campo de jefe de centro + * @param tc + */ + public void validarJefe(TarmCentroControl tc){ + System.out.println("nombre...selec..."+tc.getPersoncode()); + if(tc.getPersoncode()!=null && tc.getPersoncode()>0){ + record.getModifiedData().put("nombre", personaDetailSelecionada.getName()); + return ; + } + record.getModifiedData().put("nombre", null); + + } + + /** + * Metodo que devuelve un centro de control de armas por su codigo + * @param codigoSolicitud + * @return + */ + public static TarmCentroControl findPorCodigo(String codigo) { + try { + CentroControlArmasController cc = new CentroControlArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", codigo); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que devuelve un centro de control de armas por su codigo de Catalogo + * @param codigoSolicitud + * @return + */ + public static TarmCentroControl findPorCentroControl(String codigo) { + try { + CentroControlArmasController cc = new CentroControlArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("nombreinstitucion", codigo); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * @param catalogcode Có de catálogo + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static TarmCentroControl findxpersoncode(String personcode) { + try { + CentroControlArmasController cc = new CentroControlArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("personcode", personcode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + /** + * Metodo para buscar los centros de control asociados a un organismo o unidad + * @param codigoSolicitud + * @return + */ + public static List findxOrganismoUnidad(String organismo, String unidad) { + try { + CentroControlArmasController cc = new CentroControlArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("institucion", organismo); + cc.addFilter("nombreinstitucion", unidad); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para buscar el centros de control asociado a un organismo y unidad + * @param codigoSolicitud + * @return + */ + public static TarmCentroControl findxCcontrolUnidad(String ccontrol, String unidad) { + try { + CentroControlArmasController cc = new CentroControlArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("institucion", ccontrol); + cc.addFilter("nombreinstitucion", unidad); + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para buscar los centros de control asociados a un organismo o unidad + * @param codigoSolicitud + * @return + */ + public static List findxInstitucion(String organismo) { + try { + CentroControlArmasController cc = new CentroControlArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("institucion", organismo); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para buscar por codigo de centro de control + * @param ccentrocontrol + * @return + */ + public static List findEstadoInst(String estado,String institucion) { + try { + CentroControlArmasController cc = new CentroControlArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("estado", estado); + cc.addFilter("institucion", institucion); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmCentroControl departamento=new TarmCentroControl(); + for(TarmCentroControl centro:cc.lrecord){ + if("DPCA".equals(centro.getNombreinstitucion())){ + departamento=centro; + } + } + cc.lrecord.remove(departamento); + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para buscar por codigo de centro de control + * @param ccentrocontrol + * @return + */ + public static List findEstado(String estado) { + try { + CentroControlArmasController cc = new CentroControlArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("estado", estado); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmCentroControl departamento=new TarmCentroControl(); + for(TarmCentroControl centro:cc.lrecord){ + if("DPCA".equals(centro.getNombreinstitucion())){ + departamento=centro; + } + } + cc.lrecord.remove(departamento); + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public List getLinstitucion() { + return linstitucion; + } + + public void setLinstitucion(List linstitucion) { + this.linstitucion = linstitucion; + } + + public List getLnombreInstitucion() { + return lnombreInstitucion; + } + + public void setLnombreInstitucion(List lnombreInstitucion) { + this.lnombreInstitucion = lnombreInstitucion; + } + + public List getLprovinces() { + return lprovinces; + } + + public void setLprovinces(List lprovinces) { + this.lprovinces = lprovinces; + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public List getLparroquias() { + return lparroquias; + } + + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + public List getLgrados() { + return lgrados; + } + + public void setLgrados(List lgrados) { + this.lgrados = lgrados; + } + + public String getEditarReg() { + return editarReg; + } + + public void setEditarReg(String editarReg) { + this.editarReg = editarReg; + } + + /** + * Metodo para actualizar un bean en el record desde otros controladores + */ + public void update(TarmCentroControl bean) throws Exception { + record=bean; + super.update(); + } + +} + diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ClaseLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ClaseLovController.java.svn-base new file mode 100644 index 0000000..66af631 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ClaseLovController.java.svn-base @@ -0,0 +1,157 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author Christian Pazmino + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ClaseLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + /** + * Titulo que se le asignara al dialogo desplegado + */ + private String tituloLOV; + + public ClaseLovController() throws Exception { + super(TgeneCatalogDetail.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + tituloLOV = CallerHelper.getLovParameter("tituloLOV"); + if(tituloLOV!=null){ + MsgControlArmas.getProperty("lvh_clase"); + } + String catalogcode = CallerHelper.getLovParameter("catalogcode"); + if (catalogcode != null) { + super.addFilter("pk.catalogcode", catalogcode); + } + // Valor usado para filtro del campo legalcode de la tabla TGENECATALOGDETAIL + String legalcode = CallerHelper.getLovParameter("legalcode"); + // Valor opcional usado para filtro del campo legalcode de la tabla TGENECATALOGDETAIL + String legalcode2 = CallerHelper.getLovParameter("legalcode2"); + if (legalcode != null) { + if (legalcode2 != null) { + super.addFilter(legalcode2+" or t.legalcode", legalcode); + }else{ + super.addFilter("legalcode", legalcode); + } + } + if(tituloLOV==null && catalogcode==null && legalcode==null){ + super.addFilter("pk.catalogcode", "CLASE"); + tituloLOV=MsgControlArmas.getProperty("lvh_clase"); + } + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CLASELOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + //this.getMfilters().put("pk.catalogcode", "CLASE"); + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog(TgeneCatalogDetail tgeneCatalogDetail) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneCatalogDetail); + } + + public String getTituloLOV() { + return tituloLOV; + } + + public void setTituloLOV(String tituloLOV) { + this.tituloLOV = tituloLOV; + } + + /** + * Metodo usado para abrir el dialogo definiendo el tamano que tendra el mismo + * @param params + */ + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/claseLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ComercianteCupoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ComercianteCupoController.java.svn-base new file mode 100644 index 0000000..904a54e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ComercianteCupoController.java.svn-base @@ -0,0 +1,472 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.lov.UnidadTipoLovController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmComercianteCupo; +import com.fp.persistence.parmas.param.TarmUnidadTipo; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TarmUnidTipo. + * + * @author C.P. + * @version 2 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ComercianteCupoController extends AbstractController { + + private List ltiposRegistro; + + private String descripcionClase; + private String descripcionTipoArma; + + private String nombreComerciante; + private String numeroDocumento; + + //variables para el popup + private String nombreComercianteDialog; + private String numeroDocumentoDialog; + private String descripcionClaseDialog; + private String descripcionTipoArmaDialog; + private String descripcionUnidadMedida; + private BigDecimal cupoAsignado; + private Boolean regEditar; + + + public ComercianteCupoController() throws Exception { + super(TarmComercianteCupo.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "COMCUOP"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); +// dto.setOrderby("t.description"); nombre identification desclasearma destipoarma desunidad destiporegistro + + SubQuery snombre= new SubQuery + ("TcustPersonDetail", "name", "nombre", "i.pk.personcode = t.personcodigo and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcodigo)"); + SubQuery snumerodocumento= new SubQuery + ("TcustPersonDetail", "identification", "identification", "i.pk.personcode = t.personcodigo and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcodigo)"); + SubQuery sclasearma= new SubQuery + ("TgeneCatalogDetail", "description", "desclasearma", "i.pk.catalog = t.clase and i.pk.catalogcode=t.clasecodigo"); + SubQuery stipoarma= new SubQuery + ("TgeneCatalogDetail", "description", "destipoarma", "i.pk.catalog = t.tipoarmaexplosivo and i.pk.catalogcode=t.tipoarmaexplosivocodigo"); + SubQuery sunidad= new SubQuery + ("TgeneCatalogDetail", "description", "desunidad", "i.pk.catalog = t.unidadmedidapeso and i.pk.catalogcode=t.unidadmedidapesocodigo"); + SubQuery stiporegistro= new SubQuery + ("TgeneCatalogDetail", "description", "destiporegistro", "i.pk.catalog = t.tiporegistro and i.pk.catalogcode=t.tiporegistrocodigo"); + dto.addSubQuery(snombre); + dto.addSubQuery(snumerodocumento); + dto.addSubQuery(stipoarma); + dto.addSubQuery(sclasearma); + dto.addSubQuery(sunidad); + dto.addSubQuery(stiporegistro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp + .get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Crea una instancia del registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + cupoAsignado=new BigDecimal(0); + regEditar=Boolean.FALSE; + nombreComercianteDialog=null; + numeroDocumentoDialog=null; + descripcionClaseDialog=null; + descripcionTipoArmaDialog=null; + descripcionUnidadMedida=null; + super.create(); + this.record.setFecharegistro(new Timestamp(new Date().getTime())); + if(ltiposRegistro==null || ltiposRegistro.size()==0){ + ltiposRegistro=CatalogDetailController.find("TIPOREGISTRO"); + } + } + + @Override + public void update() throws Exception { + if(record.getPersoncodigo()!=null){ + if(record.getClase()!=null && record.getClase().trim().length()>0){ + this.record.setTiporegistrocodigo("TIPOREGISTRO"); + if(record.getCupounidad().compareTo(new BigDecimal(0))>0 && record.getCupounidad().compareTo(cupoAsignado)>=0){ + if(!regEditar){ + catalogos(ltiposRegistro, record.getTiporegistro(), "destiporegistro"); + } + super.update(); + }else{ + if(!regEditar){ + MessageHelper.setMessageError("EL CUPO DEDE SER MAYOR A CERO"); + }else{ + MessageHelper.setMessageError("EL CUPO DEDE SER MAYOR AL ASIGNADO INICIALMENTE"); + } + + } + }else{ + MessageHelper.setMessageError("SELECCIONE LA CLASE"); + } + }else{ + MessageHelper.setMessageError("SELECCIONE EL No. DE DOCUMENTO"); + } + + } + + public void updateSimple(TarmComercianteCupo bean) throws Exception { + record=bean; + super.update(); + } + + /** + * Metodo para cargar las variables para editar + */ + public void loadEdit() { + regEditar=Boolean.TRUE; + cupoAsignado=record.getCupounidad(); + nombreComercianteDialog=record.getModifiedData().get("nombre").toString(); + numeroDocumentoDialog=record.getModifiedData().get("identification").toString(); + descripcionClaseDialog=record.getModifiedData().get("desclasearma").toString(); + descripcionTipoArmaDialog=record.getModifiedData().get("destipoarma").toString(); + descripcionUnidadMedida=record.getModifiedData().get("desunidad").toString(); + // destiporegistro + } + + /** + * Metodo para recorreer los combos y setear las descripciones de lo q se escoge + * para la vista + * @param list + * @param codigo + * @param pk + */ + public void catalogos(Listlist, String codigo,String pk){ + for(TgeneCatalogDetail item:list){ + if(codigo.equals(item.getPk().getCatalog())){ + record.modifiedData.put(pk, item.getDescription()); + break; + } + } + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * + * @param catalogcode + * Có de catálogo + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static List find(String code) { + try { + ComercianteCupoController cc = new ComercianteCupoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", code); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Devuelve la lista de cupos de una persona + * @param catalogcode + */ + public static List findByPersonCode(String personCode, String classCode, String tipoArmaExplosivoCodigo, String unidad) { + try { + ComercianteCupoController cc = new ComercianteCupoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("personcodigo", personCode); + cc.addFilter("clase", classCode); + cc.addFilter("tipoarmaexplosivo", tipoArmaExplosivoCodigo); + cc.addFilter("unidadmedidapeso", unidad); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + //lov de persona + /** + * Método para abrir el lov de personas + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Maneja la respuesta del Lov de Personas + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail personaDetailSelecionada = (TcustPersonDetail) event.getObject(); + nombreComerciante=personaDetailSelecionada.getName(); + numeroDocumento=personaDetailSelecionada.getIdentification(); + super.getMfilters().put("personcodigo", personaDetailSelecionada.getPk().getPersoncode().toString()); + } + + /** + * Maneja la respuesta del Lov de Personas que se ejecuta desde el dialog de comerciante cupo + * @param event + * @throws Exception + */ + public void onReturnPersonLovDialog(SelectEvent event) throws Exception { + TcustPersonDetail personaDetailSelecionada = (TcustPersonDetail) event.getObject(); + nombreComercianteDialog=personaDetailSelecionada.getName(); + numeroDocumentoDialog=personaDetailSelecionada.getIdentification(); + record.setPersoncodigo(personaDetailSelecionada.getPk().getPersoncode()); + record.getModifiedData().put("nombre", personaDetailSelecionada.getName()); + record.getModifiedData().put("identification", personaDetailSelecionada.getIdentification()); + + } + + + //lov de UnidadTipo + /** + * Método para abrir el lov de UnidadTipo + */ + public void openUnidadTipoLov() { + Map> params = new HashMap<>(); + UnidadTipoLovController.openLov(params); + } + + /** + * Return del LOV de UnidadTipo + * @param event + * @throws Exception + */ + public void onReturnUnidadTipoLov(SelectEvent event) throws Exception { + TarmUnidadTipo t = (TarmUnidadTipo) event.getObject(); + super.getMfilters().put("clase", t.getPk().getClase()); + super.getMfilters().put("clasecodigo", t.getPk().getClasecode()); + super.getMfilters().put("tipoarmaexplosivo", t.getPk().getTipoarmaexplosivo()); + super.getMfilters().put("tipoarmaexplosivocodigo", t.getPk().getTipoarmaexplosivocodigo()); + descripcionClase=t.getModifiedData().get("desclasearma").toString(); + descripcionTipoArma=t.getModifiedData().get("destipoarma").toString(); + } + + /** + * Return del LOV de UnidadTipo ejecutado desde el Dialog + * @param event + * @throws Exception + */ + public void onReturnUnidadTipoLovDialog(SelectEvent event) throws Exception { + TarmUnidadTipo t = (TarmUnidadTipo) event.getObject(); + record.setClase(t.getPk().getClase()); + record.setClasecodigo(t.getPk().getClasecode()); + record.setTipoarmaexplosivo(t.getPk().getTipoarmaexplosivo()); + record.setTipoarmaexplosivocodigo( t.getPk().getTipoarmaexplosivocodigo()); + record.setUnidadmedidapeso(t.getPk().getUnidadmedidapeso()); + record.setUnidadmedidapesocodigo(t.getPk().getUnidadmedidapesocodigo()); + descripcionClaseDialog=t.getModifiedData().get("desclasearma").toString(); + descripcionTipoArmaDialog=t.getModifiedData().get("destipoarma").toString(); + descripcionUnidadMedida=t.getModifiedData().get("desunidad").toString(); + record.getModifiedData().put("desclasearma", t.getModifiedData().get("desclasearma").toString()); + record.getModifiedData().put("destipoarma", t.getModifiedData().get("destipoarma").toString()); + record.getModifiedData().put("desunidad", t.getModifiedData().get("desunidad").toString()); + } + + + + public String getDescripcionClase() { + return descripcionClase; + } + + public void setDescripcionClase(String descripcionClase) { + this.descripcionClase = descripcionClase; + } + + public String getDescripcionTipoArma() { + return descripcionTipoArma; + } + + public void setDescripcionTipoArma(String descripcionTipoArma) { + this.descripcionTipoArma = descripcionTipoArma; + } + + public String getNombreComerciante() { + return nombreComerciante; + } + + public void setNombreComerciante(String nombreComerciante) { + this.nombreComerciante = nombreComerciante; + } + + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public String getNombreComercianteDialog() { + return nombreComercianteDialog; + } + + public void setNombreComercianteDialog(String nombreComercianteDialog) { + this.nombreComercianteDialog = nombreComercianteDialog; + } + + public String getNumeroDocumentoDialog() { + return numeroDocumentoDialog; + } + + public void setNumeroDocumentoDialog(String numeroDocumentoDialog) { + this.numeroDocumentoDialog = numeroDocumentoDialog; + } + + public String getDescripcionClaseDialog() { + return descripcionClaseDialog; + } + + public void setDescripcionClaseDialog(String descripcionClaseDialog) { + this.descripcionClaseDialog = descripcionClaseDialog; + } + + public String getDescripcionTipoArmaDialog() { + return descripcionTipoArmaDialog; + } + + public void setDescripcionTipoArmaDialog(String descripcionTipoArmaDialog) { + this.descripcionTipoArmaDialog = descripcionTipoArmaDialog; + } + + public String getDescripcionUnidadMedida() { + return descripcionUnidadMedida; + } + + public void setDescripcionUnidadMedida(String descripcionUnidadMedida) { + this.descripcionUnidadMedida = descripcionUnidadMedida; + } + + public List getLtiposRegistro() { + return ltiposRegistro; + } + + public void setLtiposRegistro(List ltiposRegistro) { + this.ltiposRegistro = ltiposRegistro; + } + + public Boolean getRegEditar() { + return regEditar; + } + + public void setRegEditar(Boolean regEditar) { + this.regEditar = regEditar; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/DatosParaSancionesController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/DatosParaSancionesController.java.svn-base new file mode 100644 index 0000000..ca732a3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/DatosParaSancionesController.java.svn-base @@ -0,0 +1,543 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmTipoSancion; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TarmTipoSancion. + * + * @author Christian Pazmino + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class DatosParaSancionesController extends AbstractController { + + /** + * Lista de tipos de tramites a ser seleccionados por el usuario (Autorizacion, Permiso) + */ + private List tramiteList; + /** + * Lista de tipos de faltas a ser seleccionadados por el usuario (Leve, Grave, etc) + */ + private List tipoDeFaltaList; + /** + * Lista de tipos de sanciones a ser seleccionados por el usuario (Suspencion, Decomiso, etc) + */ + private List sancionList; + /** + * Lista de periodos en dias que durara la sancion (180 dias, 270 dias, etc) + */ + private List tiempoList; + /** + * Codigo de la clase seleccionada por el usuario + */ + private String claseFiltroStr; + /** + * Variable que indica si el usuario esta negado para continuar en la pantalla + */ + private Boolean esEdicionBln; + /** + * Constante usada para referirse al catalogo de tipo de falta + */ + private final String TIPOFALTACODIGO = "TIPODEFALTA"; + /** + * Constante usada para referirse al catalogo de vigencia en dias + */ + private final String TIEMPOCODIGO = "VIGENCIADIAS"; + /** + * Constante usada para referirse al catalogo de sanciones + */ + private final String SANCIONCODIGO = "SANCION"; + /** + * Constante usada para referirse al catalogo de tipo autorizacion + */ + private final String TRAMITECODIGO = "TIPOAUTORIZACION"; + + public DatosParaSancionesController() throws Exception { + super(TarmTipoSancion.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + record = new TarmTipoSancion(); + tipoDeFaltaList = CatalogDetailController.find("TIPODEFALTA"); + tramiteList = CatalogFilterLovController.findTramiteSancion(); + tiempoList = CatalogDetailController.find("VIGENCIADIAS"); + sancionList = CatalogDetailController.find("SANCION"); + esEdicionBln = Boolean.FALSE; + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "DATOSPARASANCION"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo utilizado al escoger tipo de falta + */ + public void changeTipoFalta() { + for (TgeneCatalogDetail r : tipoDeFaltaList) { + if (r.getPk().getCatalog().compareTo(record.getTipofalta()) == 0) { + record.put("ntipoFalta", r.getDescription()); + break; + } + } + record.setTipofaltacodigo(TIPOFALTACODIGO); + } + + /** + * Metodo utilizado al escoger tramite + */ + public void changeTramite() { + for (TgeneCatalogDetail r : tramiteList) { + if (r.getPk().getCatalog().compareTo(record.getTramite()) == 0) { + record.put("ntramite", r.getDescription()); + break; + } + } + record.setTramitecodigo(TRAMITECODIGO); + } + + /** + * Metodo utilizado al escoger sancion + */ + public void changeSancion() { + for (TgeneCatalogDetail r : sancionList) { + if (r.getPk().getCatalog().compareTo(record.getSancion()) == 0) { + record.put("nsancion", r.getDescription()); + break; + } + } + record.setSancioncodigo(SANCIONCODIGO); + } + + /** + * Metodo utilizado al escoger tiempo + */ + public void changeTiempo() { + for (TgeneCatalogDetail r : tiempoList) { + if (r.getPk().getCatalog().compareTo(record.getTiempo()) == 0) { + record.put("ntiempo", r.getDescription()); + break; + } + } + record.setTiempocodigo(TIEMPOCODIGO); + } + + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); +// if(!esEdicionBln){ +// record.setNumeropregunta(null); +// }else{ +// record.setNumeropregunta(record.getNumeropregunta()); +// } + esEdicionBln = Boolean.FALSE; + super.addField("claseDescriptionD", null); + super.addField("faltaDescriptionD", null); + } + + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + // Subquery + SubQuery subqueryClase = new SubQuery("TgeneCatalogDetail", "description", "nclase", "i.pk.catalog = t.clase and i.pk.catalogcode = t.clasecodigo"); + dto.addSubQuery(subqueryClase); + + SubQuery subqueryFalta = new SubQuery("TgeneCatalogDetail", "description", "nfalta", "i.pk.catalog = t.falta and i.pk.catalogcode = t.faltacodigo"); + dto.addSubQuery(subqueryFalta); + + SubQuery subqueryTipoFalta = new SubQuery("TgeneCatalogDetail", "description", "ntipoFalta", "i.pk.catalog = t.tipofalta and i.pk.catalogcode = t.tipofaltacodigo"); + dto.addSubQuery(subqueryTipoFalta); + + SubQuery subqueryTramite = new SubQuery("TgeneCatalogDetail", "description", "ntramite", "i.pk.catalog = t.tramite and i.pk.catalogcode = t.tramitecodigo"); + dto.addSubQuery(subqueryTramite); + + SubQuery subquerySancion = new SubQuery("TgeneCatalogDetail", "description", "nsancion", "i.pk.catalog = t.sancion and i.pk.catalogcode = t.sancioncodigo"); + dto.addSubQuery(subquerySancion); + + SubQuery subqueryTiempo = new SubQuery("TgeneCatalogDetail", "description", "ntiempo", "i.pk.catalog = t.tiempo and i.pk.catalogcode = t.tiempocodigo"); + dto.addSubQuery(subqueryTiempo); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Metodo usado para abrir el dialogo de falta en de la pantalla crear/editar + */ + public void openFaltaDialogLov() { + try { + if(this.record.getClase()!=null){ + Map> params = new HashMap<>(); + //Codigo de catalogcode + List lcatalogcode = new ArrayList<>(); + lcatalogcode.add("FALTA"); + params.put("catalogcode", lcatalogcode); + //tITULO DEL LOV + List ltituloLOV = new ArrayList<>(); + ltituloLOV.add("lov_falta"); + params.put("tituloLOV", ltituloLOV); + //Filtro + List lfiltro = new ArrayList<>(); + + if(this.record.getClase().equals("0010000001")||this.record.getClase().equals("0010000002")){ + //Filtro para armas de fuego y municiones + lfiltro.add("t.legalcode = 'ARMASYMUNICIONES'"); + }// + else if(this.record.getClase().equals("0010000003")||this.record.getClase().equals("0010000007")){ + //Filtro para explosivos y pirotecnicos + lfiltro.add("t.legalcode = 'EXPLOSIVOSYPIROTECNICOS'"); + } + else if(this.record.getClase().equals("0010000004")){ + //Filtro para accesorios + lfiltro.add("t.legalcode = 'ACCESORIOS'"); + } + else if(this.record.getClase().equals("0010000006")){ + //Filtro para accesorios + lfiltro.add("t.legalcode = 'ACCESORIOS'"); + } + params.put("filtro", lfiltro); + CatalogFilterLovController.openLov(params); + //ClaseLovController.openLov(params); + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionClase")); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo de consulta de datos para sanciones segun la clase pasada como parametro + */ + public static List find(String clase) { + try { + DatosParaSancionesController cc = new DatosParaSancionesController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("clase", clase); + + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo de consulta de dato para sancion segun la clave primaria pasada como parametro + */ + public static TarmTipoSancion findxPk(String pk) { + try { + DatosParaSancionesController cc = new DatosParaSancionesController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", pk); + + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo usado para abrir el dialogo de seleccionar falta en de la pantalla principal + */ + public void openFaltaLov() { + try { + if(claseFiltroStr!=null){ + Map> params = new HashMap<>(); + //Codigo de catalogcode + List lcatalogcode = new ArrayList<>(); + lcatalogcode.add("FALTA"); + params.put("catalogcode", lcatalogcode); + //tITULO DEL LOV + List ltituloLOV = new ArrayList<>(); + ltituloLOV.add("lov_falta"); + params.put("tituloLOV", ltituloLOV); + //Filtro + List lfiltro = new ArrayList<>(); + + if(claseFiltroStr.equals("0010000001")||claseFiltroStr.equals("0010000002")){ + //Filtro para armas de fuego y municiones + lfiltro.add("t.legalcode = 'ARMASYMUNICIONES'"); + }// + else if(claseFiltroStr.equals("0010000003")||claseFiltroStr.equals("0010000007")){ + //Filtro para explosivos y pirotecnicos + lfiltro.add("t.legalcode = 'EXPLOSIVOSYPIROTECNICOS'"); + } + else if(claseFiltroStr.equals("0010000004")){ + //Filtro para accesorios + lfiltro.add("t.legalcode = 'ACCESORIOS'"); + } + else if(claseFiltroStr.equals("0010000006")){ + //Filtro para accesorios + lfiltro.add("t.legalcode = 'ACCESORIOS'"); + } + params.put("filtro", lfiltro); + CatalogFilterLovController.openLov(params); + //ClaseLovController.openLov(params); + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionClase")); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar falta de la pantalla principal + */ + public void onReturnFaltaLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.addFilter("falta", t.getPk().getCatalog()); + super.addFilter("faltacodigo", t.getPk().getCatalogcode()); + super.addField("faltaDescription", t.getDescription()); + this.query(); + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar falta de la pantalla crear/editar + */ + public void onReturnFaltaDialogLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.addField("faltaDescriptionD", t.getDescription()); + this.record.setFalta(t.getPk().getCatalog()); + this.record.setFaltacodigo(t.getPk().getCatalogcode()); + record.put("nfalta", t.getDescription()); + } + + /** + * Metodo usado para abrir el dialogo de seleccionar clase en de la pantalla principal + */ + public void openClaseLov() { + try { + Map> params = new HashMap<>(); + //Codigo de catalogcode + List lcatalogcode = new ArrayList<>(); + lcatalogcode.add("CLASE"); + params.put("catalogcode", lcatalogcode); + //tITULO DEL LOV + List ltituloLOV = new ArrayList<>(); + ltituloLOV.add("lvh_clase"); + params.put("tituloLOV", ltituloLOV); + //Filtro +// List lfiltro = new ArrayList<>(); +// lfiltro.add("t.pk.catalog in ('0010000001','0010000002','0010000003','0010000007','0010000004','0010000006')"); +// params.put("filtro", lfiltro); + CatalogFilterLovController.openLov(params); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar clase de la pantalla principal + */ + public void onReturnClaseLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + claseFiltroStr = t.getPk().getCatalog(); + super.addFilter("clase", t.getPk().getCatalog()); + super.addFilter("clasecodigo", t.getPk().getCatalogcode()); + super.addField("claseDescription", t.getDescription()); + this.query(); + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar clase de la pantalla crear/editar + */ + public void onReturnClaseDialogLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.addField("claseDescriptionD", t.getDescription()); + super.addField("faltaDescriptionD", null); + record.setFalta(null); + this.record.setClase(t.getPk().getCatalog()); + this.record.setClasecodigo(t.getPk().getCatalogcode()); + record.put("nclase", t.getDescription()); + } + + @Override + public void update() throws Exception { + if(record.getClase()!=null){ + if(record.getFalta()!=null){ + super.update(); + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_faltaRequerido")); + } + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_claseRequerido")); + } + } + + /** + * Metodo que actualiza las descripciones seleccionadas en el dialogo crear/editar a la variable record y marca una bandera ser edicion + */ + public void actualizar(){ + esEdicionBln = Boolean.TRUE; + super.addField("claseDescriptionD", record.get("nclase")); + super.addField("faltaDescriptionD", record.get("nfalta")); + } + + public List getTramiteList() { + return tramiteList; + } + + public void setTramiteList(List tramiteList) { + this.tramiteList = tramiteList; + } + + public List getTipoDeFaltaList() { + return tipoDeFaltaList; + } + + public void setTipoDeFaltaList(List tipoDeFaltaList) { + this.tipoDeFaltaList = tipoDeFaltaList; + } + + public List getSancionList() { + return sancionList; + } + + public void setSancionList(List sancionList) { + this.sancionList = sancionList; + } + + public List getTiempoList() { + return tiempoList; + } + + public void setTiempoList(List tiempoList) { + this.tiempoList = tiempoList; + } + + public Boolean getEsEdicionBln() { + return esEdicionBln; + } + + public void setEsEdicionBln(Boolean esEdicionBln) { + this.esEdicionBln = esEdicionBln; + } + + public String getClaseFiltroStr() { + return claseFiltroStr; + } + + public void setClaseFiltroStr(String claseFiltroStr) { + this.claseFiltroStr = claseFiltroStr; + } + + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/FirmarDocumentoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/FirmarDocumentoController.java.svn-base new file mode 100644 index 0000000..926b495 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/FirmarDocumentoController.java.svn-base @@ -0,0 +1,666 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.io.IOException; +import java.io.InputStream; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.solicitud.DecomisoArmaTransaccionController; +import com.fp.frontend.controller.armas.solicitud.DocumentoHabilitanteController; +import com.fp.frontend.controller.armas.solicitud.PlanificacionInspeccionController; +import com.fp.frontend.controller.armas.solicitud.SolicitudArmasController; +import com.fp.frontend.controller.armas.solicitud.TarmSolicitudTramiteController; +import com.fp.frontend.controller.armas.solicitud.TarmTramiteController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.controller.pgeneral.message.MessageTemplatesController; +import com.fp.frontend.controller.pgeneral.message.MessageTemplatesDescController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.frontend.validators.DocFirmaValidator; +import com.fp.mail.Mail; +import com.fp.persistence.parmas.ins.TarmPlanificacionInspeccion; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplates; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDesc; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +/** + * Clase controladora para firmar documentos. + * + * @author Carlos Guzman. + * @modificacion David Cruz + * @modificacion Christian Pazmino + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class FirmarDocumentoController extends AbstractController { + + private String xpathflujo; + private String xpath; + private String numerotransaccion; + private String numerosolicitud; + private String cplanificacion; + private String creporte; + private String appletCoordenadallx=""; + private String appletCoordenadally=""; + private String appletCoordenadaurx=""; + private String appletCoordenadaury=""; + private String appletLugar=""; + private String appletFirma=""; + private UploadedFile uploadedFile; + private TsafeUserDetail userDetail; + private boolean mensajeGuardar=false; + private boolean mensajeNoFirma=false; + private String btnFlujo; + private TarmSolicitud solicitud; + TarmPlanificacionInspeccion planificacionInspeccion=null; + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + @ManagedProperty(value="#{personAddressController}") + private PersonAddressController personAddress; + @ManagedProperty(value = "#{decomisoArmaTransaccionController}") + private DecomisoArmaTransaccionController decomisoArmaTransaccionController; + + // Variables para envio de mail + + private String funcionarioStr; + private String razonsStr; + private String tramiteStr; + private String centrocontrolStr; + private String fechanotificacionStr; + private String tipoTramiteStr; + private String tipoAutorizacionStr; + private String usoactividadStr; + private String categoriaStr; + /** + * Constructor + * @throws Exception + */ + public FirmarDocumentoController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + startQuery(); + this.init(); + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + numerotransaccion=super.getMfilters().get("numerotransaccion"); + numerosolicitud=super.getMfilters().get("csolicitud"); + creporte=super.getMfilters().get("creporte"); + cplanificacion=super.getMfilters().get("cplanificacion"); + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + if(userDetail.getPk().getPersoncode()!=null){ + appletFirma = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName() + " " + (new Timestamp(new Date().getTime())).toString().split("\\.")[0]; + if(creporte!=null && !creporte.equals("null")){ + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(userDetail.getPk().getPersoncode().toString()); + List provinceList = ProvinceController.findPorCodigo("EC", tcustPersonAddres.getProvincecode()); + appletLugar = provinceList.get(0).getDescription(); + } + } + else{ + appletFirma = ""; + } + if(numerosolicitud!=null &&!numerosolicitud.equals("null") && numerosolicitud.trim().length()>0){ + solicitud = SolicitudArmasController.find(numerosolicitud); + TarmCentroControl centroControl=CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + List lciudades = CityController.find("EC", centroControl.getProvincecode(), centroControl.getCantoncode()); + appletLugar = lciudades.get(0).getDescription(); + }else if(numerotransaccion!=null && !numerotransaccion.equals("null")){ + TarmDecomisoArmaTransaccion decomisoArmaTransaccion= DecomisoArmaTransaccionController.find(numerotransaccion); + TarmCentroControl centroControl=CentroControlArmasController.findPorCodigo(decomisoArmaTransaccion.getCcentrocontrol()); + List lciudades = CityController.find("EC", centroControl.getProvincecode(), centroControl.getCantoncode()); + appletLugar = lciudades.get(0).getDescription(); + }else if(cplanificacion!=null && !cplanificacion.equals("null")){ + planificacionInspeccion= PlanificacionInspeccionController.findPorCodigo(Long.parseLong(cplanificacion)); + TarmCentroControl centroControl=CentroControlArmasController.findPorCodigo(planificacionInspeccion.getCcentrocontrol()); + List lciudades = CityController.find("EC", centroControl.getProvincecode(), centroControl.getCantoncode()); + appletLugar = lciudades.get(0).getDescription(); + } + + System.out.println("xpath .."+xpathflujo); + obtenerXpath(); + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Metodo para opbtener el xpath de alfresco + */ + private void obtenerXpath() { + // TODO Auto-generated method stub + TarmDocumentoHabilitante documentohabilitante = new TarmDocumentoHabilitante(); + xpathflujo=super.getMfilters().get("xpath");//formato de archivo "cm:Decomiso/cm:A-2014/cm:M-10/cm:ENV-000000319/cm:ENV-000000319.pdf";// + + if(MsgControlArmas.getProperty("xpathFujoDocumentoHabilitante").equalsIgnoreCase(xpathflujo) || xpathflujo==null || xpathflujo.isEmpty() || xpathflujo.equals("null")){ + if(numerosolicitud!=null && !numerosolicitud.equals("null")){ + documentohabilitante = DocumentoHabilitanteController.findPorSolicitud(numerosolicitud); + xpathflujo = documentohabilitante.getXpath(); + } + } + if(planificacionInspeccion!=null && (xpathflujo==null || xpathflujo.isEmpty() || xpathflujo.equals("null") || xpathflujo.trim().length()==0)){ + xpathflujo=planificacionInspeccion.getXpath(); + } + xpath=xpathflujo.substring( 0, xpathflujo.lastIndexOf("/cm:")); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.lrecord = new ArrayList<>(); + this.beanalias = "FIRMARDOCUMENTO"; + btnFlujo=null; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + + } + + /** + * Metodo que analiza si el archivo tiene la extension permitida + * @param nombreArchivo + * @return + */ + public Boolean esExtensionDeArchivoPermitida(String nombreArchivo){ + String[]archivosPermitidosLst = {".pdf"}; + for(String extensionValida:archivosPermitidosLst){ + if(nombreArchivo.contains(extensionValida)){ + return Boolean.TRUE; + } + } + return Boolean.FALSE; + } + + /** + * Metodo para grabar el documento en alfresco + */ + public void saveWithDocumentAlfresco() { + try { + + if(uploadedFile!=null && esExtensionDeArchivoPermitida(uploadedFile.getFileName())){ + + if(!uploadedFile.getFileName().equals(xpathflujo.substring( xpathflujo.lastIndexOf(":") + 1,xpathflujo.length()))){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nombrearchivo_xpath")); + return; + } + alfrescoController.uploadFile(uploadedFile.getInputstream(),xpathflujo.substring( xpathflujo.lastIndexOf(":") + 1,xpathflujo.length()), xpath); + //completa la tarea + //completarTarea(); + btnFlujo="ok"; + + } + else if(uploadedFile==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinarchivo")); + return; + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_archivo_firma")); + return; + } + } catch (Exception e) { + // TODO Auto-generated catch block + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_archivo_firma")); + e.printStackTrace(); + return; + } catch (Throwable e) { + // TODO Auto-generated catch block + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_archivo")); + e.printStackTrace(); + } + + } + + + + + + public void guardarRegistro() { + +} + +// /** +// * Metodo para finalizar la tarea del flujo +// */ +// public void completarTarea() { +// +// try { +// BigDecimal numeroCustodios = new BigDecimal("0"); +// if(this.solicitud.getNumerocustodios()!=null){ +// numeroCustodios = new BigDecimal(this.solicitud.getNumerocustodios()); +// } +// if(numeroCustodios.compareTo(new BigDecimal("0"))==0 && this.getLoginController().getRequest().getTransactionCode()==109){ +// this.envioCorreoDocumentoAdjunto(); +// } +// +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// } +// } + + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("cplanificacion", cplanificacion); + request.modifiedData().put("numerotransaccion", numerotransaccion); + request.modifiedData().put("xpath", xpathflujo); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", "A" ); // A,D,R + request.modifiedData().put("BPMObs","OK" ); + + //Actualiza el campo estadofirma en la tabla TARMDECOMISOARMATRANSACCION + if(this.getLoginController().getRequest().getTransactionCode()==94){ + TarmDecomisoArmaTransaccion armaTransaccion = DecomisoArmaTransaccionController.find(numerotransaccion); + this.decomisoArmaTransaccionController.setRecord(armaTransaccion); + this.decomisoArmaTransaccionController.getRecord().setEstadofirma("Y"); + this.decomisoArmaTransaccionController.update(); + + DtoSave dtosaveDecomisoTran = this.decomisoArmaTransaccionController.getDtoSave(true); + dtosaveDecomisoTran.setReturnpk(true); + dtosaveDecomisoTran.setPosition(1); + msave.put(decomisoArmaTransaccionController.getBeanalias(), dtosaveDecomisoTran); + }else if(this.getLoginController().getRequest().getTransactionCode()==109){ + Map datosmail = new HashMap(); + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail persona = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + SimpleDateFormat sdf1 = new SimpleDateFormat(MsgGeneral.getProperty("dateformat")); + TarmSolicitudTramite solicitudTramite =TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + // Variables para envio de mail + funcionarioStr=persona ==null?"":((persona.getMilitarygrade()==null)?"":CatalogDetailController.findxCodigoCodcatalogo(persona.getMilitarygrade(),"MILITARYGRADE").getDescription()) + " " + persona.getName(); + razonsStr=(solicitud==null || solicitud.getModifiedData().get("nombre")==null)?"":solicitud.getModifiedData().get("nombre").toString(); + tramiteStr=solicitudTramite.getNumerotramite(); + //El centro de control se saca de la solicitud donde inicio el tramite + TarmCentroControl centroControlObj = CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + if(centroControlObj!=null && centroControlObj.getNombreinstitucion()!=null && centroControlObj.getNombreinstitucioncodigo()!=null){ + centrocontrolStr= CatalogDetailController.findxCodigoCodcatalogo(centroControlObj.getNombreinstitucion(), centroControlObj.getNombreinstitucioncodigo()).getDescription();; + } + fechanotificacionStr=sdf1.format(new Date()); + TarmTramite tramiteObj =TarmTramiteController.find(String.valueOf(solicitud.getCtramite())); + tipoTramiteStr=(tramiteObj==null || tramiteObj.getModifiedData().get("tipotramite")==null)?"":tramiteObj.getModifiedData().get("tipotramite").toString(); + tipoAutorizacionStr=(tramiteObj==null || tramiteObj.getModifiedData().get("tipoautorizacion")==null)?"":tramiteObj.getModifiedData().get("tipoautorizacion").toString(); + usoactividadStr=(tramiteObj==null || tramiteObj.getModifiedData().get("usoactividad")==null)?"":tramiteObj.getModifiedData().get("usoactividad").toString(); + categoriaStr=(tramiteObj==null || tramiteObj.getModifiedData().get("categoria")==null)?"":tramiteObj.getModifiedData().get("categoria").toString(); + + datosmail.put("funcionario",funcionarioStr); + datosmail.put("razons",razonsStr); + datosmail.put("tramite",tramiteStr); + datosmail.put("centrocontrol",centrocontrolStr); + datosmail.put("fechanotificacion",fechanotificacionStr); + datosmail.put("tipoTramite",tipoTramiteStr); + datosmail.put("tipoAutorizacion",tipoAutorizacionStr); + datosmail.put("usoactividad",usoactividadStr); + datosmail.put("categoria",categoriaStr); + request.modifiedData().put("datosmail", datosmail); + } + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.decomisoArmaTransaccionController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + BigDecimal numeroCustodios = new BigDecimal("0"); + if(this.solicitud!=null && this.solicitud.getNumerocustodios()!=null){ + numeroCustodios = new BigDecimal(this.solicitud.getNumerocustodios()); + } + if(numeroCustodios !=null && numeroCustodios.compareTo(new BigDecimal("0"))==0 && this.getLoginController().getRequest().getTransactionCode()==109){ + this.envioCorreoDocumentoAdjunto(); + } + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + btnFlujo=null; + + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Envía el correo de cambio de email + * @throws Exception + */ + private void envioCorreoDocumentoAdjunto() throws Exception{ + Mail m = new Mail(); + m.config(ParametersController.find("MAIL.FROM", "1").getTextvalue(), + ParametersController.find("MAIL.SMTP.SERVER", "1").getTextvalue(), + ParametersController.find("MAIL.SMTP.PORT", "1").getNumbervalue().intValue(), + ParametersController.find("MAIL.SMTP.USER", "1").getTextvalue(), + ParametersController.find("MAIL.SMTP.PASSWORD", "1").getTextvalue(), + Boolean.valueOf(ParametersController.find("MAIL.SMTP.AUTH", "1").getTextvalue()), + Boolean.valueOf(ParametersController.find("MAIL.SMTPS", "1").getTextvalue())); + TcustPersonAddress mail = personAddress.findPersonaPorDireccionTipoCatalogo(solicitud.getPersoncode().toString(), "3"); + m.setTo(personAddress.getRecord().getAddress()); + MessageTemplatesController message = new MessageTemplatesController(); + message.addFilter("pk", "64"); + message.query(); + if(message.getLrecord() != null && !message.getLrecord().isEmpty()){ + TgeneMessageTemplates asunto = message.getLrecord().get(0); + MessageTemplatesDescController content = new MessageTemplatesDescController(); + content.addFilter("pk.code", "64"); + content.addFilter("pk.languagecode", "ES"); + content.query(); + if(content.getLrecord() != null && !content.getLrecord().isEmpty()){ + TgeneMessageTemplatesDesc descripcionContenido = content.getLrecord().get(0); + m.setSubject(asunto.getDescription()); + String sw = descripcionContenido.getTemplate(); + // Reemplazar variables de la plantilla en mail + sw=sw.replace("$request.funcionario", this.funcionarioStr); + sw=sw.replace("$request.razons", this.razonsStr) ; + sw=sw.replace("$request.tramite", this.tramiteStr) ; + sw=sw.replace("$request.centrocontrol", this.centrocontrolStr) ; + sw=sw.replace("$request.fechanotificacion", this.fechanotificacionStr) ; + sw=sw.replace("$request.tipoTramite", this.tipoTramiteStr) ; + sw=sw.replace("$request.tipoAutorizacion", this.tipoAutorizacionStr) ; + sw=sw.replace("$request.usoactividad", this.usoactividadStr) ; + sw=sw.replace("$request.categoria", this.categoriaStr) ; + m.setCuerpoMail(sw.toString()); + m.setContentMessageType("text/html"); + // Descargar el documento habilitante a adjuntar + byte[] bytes = alfrescoController.downloadReturnDocument(this.xpathflujo); + m.addAttachment("documento.pdf", bytes, "application/pdf"); +// m.addAttachment("Documento Habilitante","C:\\Users\\JALVARADO\\Downloads\\DOC-000362250.pdf"); + m.send(); + } + } + } + + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){} + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en el Alfresco + */ + public void handleUpload(FileUploadEvent event){ + uploadedFile = event.getFile(); + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + + public String getXpath() { + return xpath; + } + + public void setXpath(String xpath) { + this.xpath = xpath; + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + + public void upload(FileUploadEvent event) { + uploadedFile = event.getFile(); + try { + boolean isValid = DocFirmaValidator.validDocSign(uploadedFile.getInputstream()); + if(isValid){ + mensajeNoFirma = false; + mensajeGuardar = true; + + }else{ + uploadedFile = null; + btnFlujo=null; + mensajeNoFirma = true; + mensajeGuardar = false; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinfirmararchivo")); + } + } catch (IOException e) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinfirmararchivo")); + } + + } + + public String getAppletCoordenadallx() { + return appletCoordenadallx; + } + + public void setAppletCoordenadallx(String appletCoordenadallx) { + this.appletCoordenadallx = appletCoordenadallx; + } + + public String getAppletCoordenadally() { + return appletCoordenadally; + } + + public void setAppletCoordenadally(String appletCoordenadally) { + this.appletCoordenadally = appletCoordenadally; + } + + public String getAppletCoordenadaurx() { + return appletCoordenadaurx; + } + + public void setAppletCoordenadaurx(String appletCoordenadaurx) { + this.appletCoordenadaurx = appletCoordenadaurx; + } + + public String getAppletCoordenadaury() { + return appletCoordenadaury; + } + + public boolean isMensajeGuardar() { + return mensajeGuardar; + } + + public void setMensajeGuardar(boolean mensajeGuardar) { + this.mensajeGuardar = mensajeGuardar; + } + + public void setAppletCoordenadaury(String appletCoordenadaury) { + this.appletCoordenadaury = appletCoordenadaury; + } + + public String getAppletLugar() { + return appletLugar; + } + + public void setAppletLugar(String appletLugar) { + this.appletLugar = appletLugar; + } + + public String getAppletFirma() { + return appletFirma; + } + + public void setAppletFirma(String appletFirma) { + this.appletFirma = appletFirma; + } + + public String getBtnFlujo() { + return btnFlujo; + } + + public void setBtnFlujo(String btnFlujo) { + this.btnFlujo = btnFlujo; + } + + public PersonAddressController getPersonAddress() { + return personAddress; + } + + public void setPersonAddress(PersonAddressController personAddress) { + this.personAddress = personAddress; + } + + public DecomisoArmaTransaccionController getDecomisoArmaTransaccionController() { + return decomisoArmaTransaccionController; + } + + public void setDecomisoArmaTransaccionController( + DecomisoArmaTransaccionController decomisoArmaTransaccionController) { + this.decomisoArmaTransaccionController = decomisoArmaTransaccionController; + } + + public String getFuncionarioStr() { + return funcionarioStr; + } + + public void setFuncionarioStr(String funcionarioStr) { + this.funcionarioStr = funcionarioStr; + } + + public String getRazonsStr() { + return razonsStr; + } + + public void setRazonsStr(String razonsStr) { + this.razonsStr = razonsStr; + } + + public String getTramiteStr() { + return tramiteStr; + } + + public void setTramiteStr(String tramiteStr) { + this.tramiteStr = tramiteStr; + } + + public String getCentrocontrolStr() { + return centrocontrolStr; + } + + public void setCentrocontrolStr(String centrocontrolStr) { + this.centrocontrolStr = centrocontrolStr; + } + + public String getFechanotificacionStr() { + return fechanotificacionStr; + } + + public void setFechanotificacionStr(String fechanotificacionStr) { + this.fechanotificacionStr = fechanotificacionStr; + } + + public String getTipoTramiteStr() { + return tipoTramiteStr; + } + + public void setTipoTramiteStr(String tipoTramiteStr) { + this.tipoTramiteStr = tipoTramiteStr; + } + + public String getTipoAutorizacionStr() { + return tipoAutorizacionStr; + } + + public void setTipoAutorizacionStr(String tipoAutorizacionStr) { + this.tipoAutorizacionStr = tipoAutorizacionStr; + } + + public String getUsoactividadStr() { + return usoactividadStr; + } + + public void setUsoactividadStr(String usoactividadStr) { + this.usoactividadStr = usoactividadStr; + } + + public String getCategoriaStr() { + return categoriaStr; + } + + public void setCategoriaStr(String categoriaStr) { + this.categoriaStr = categoriaStr; + } + + public boolean isMensajeNoFirma() { + return mensajeNoFirma; + } + + public void setMensajeNoFirma(boolean mensajeNoFirma) { + this.mensajeNoFirma = mensajeNoFirma; + } + + + + + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/FirmarDocumentoFiscaliaController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/FirmarDocumentoFiscaliaController.java.svn-base new file mode 100644 index 0000000..28688ea --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/FirmarDocumentoFiscaliaController.java.svn-base @@ -0,0 +1,481 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.io.IOException; +import java.io.InputStream; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.solicitud.DecomisoArmaTransaccionController; +import com.fp.frontend.controller.armas.solicitud.DocumentoHabilitanteController; +import com.fp.frontend.controller.armas.solicitud.PlanificacionInspeccionController; +import com.fp.frontend.controller.armas.solicitud.SolicitudArmasController; +import com.fp.frontend.controller.armas.solicitud.SolicitudCertificadoController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.controller.pgeneral.message.MessageTemplatesController; +import com.fp.frontend.controller.pgeneral.message.MessageTemplatesDescController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.validators.DocFirmaValidator; +import com.fp.mail.Mail; +import com.fp.persistence.parmas.ins.TarmPlanificacionInspeccion; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmCertificadoFiscalia; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplates; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDesc; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +/** + * Clase controladora para firmar documentos. + * + * @author Carlos Guzman. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class FirmarDocumentoFiscaliaController extends AbstractController { + + private String xpathflujo; + private String xpathSolicitud; + private String xpath; + private String numerosolicitud; + private String appletCoordenadallx=""; + private String appletCoordenadally=""; + private String appletCoordenadaurx=""; + private String appletCoordenadaury=""; + private String appletLugar=""; + private String appletFirma=""; + private UploadedFile uploadedFile; + private TsafeUserDetail userDetail; + private boolean mensajeGuardar=false; + private boolean mensajeNoFirma=false; + private String btnFlujo; +// private TarmSolicitud solicitud; + private TarmCertificadoFiscalia certificadoFiscalia; + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + @ManagedProperty(value="#{personAddressController}") + private PersonAddressController personAddress; + + /** + * Constructor + * @throws Exception + */ + public FirmarDocumentoFiscaliaController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + startQuery(); + this.init(); + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + numerosolicitud=super.getMfilters().get("csolicitud"); + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + if(userDetail.getPk().getPersoncode()!=null){ + appletFirma = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName() + " " + (new Timestamp(new Date().getTime())).toString().split("\\.")[0]; +// if(creporte!=null && !creporte.equals("null")){ +// PersonAddressController personAddressController = new PersonAddressController(); +// TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(userDetail.getPk().getPersoncode().toString()); +// List provinceList = ProvinceController.findPorCodigo("EC", tcustPersonAddres.getProvincecode()); +// appletLugar = provinceList.get(0).getDescription(); +// } + } + else{ + appletFirma = ""; + } + if(numerosolicitud!=null &&!numerosolicitud.equals("null") && numerosolicitud.trim().length()>0){ + certificadoFiscalia = SolicitudCertificadoController.findPorSolicitud(numerosolicitud.trim()); + if(certificadoFiscalia!=null && certificadoFiscalia.getXpathSolicitudArma()!=null){ + xpathflujo = certificadoFiscalia.getXpathSolicitudArma(); + xpathSolicitud = certificadoFiscalia.getXpath(); + } + Request request = this.callerhelper.getRequest(); + if(request!=null && request.getCentrocontrol()!=null) { + TarmCentroControl centroControl=CentroControlArmasController.findPorCodigo(request.getCentrocontrol()); + List lciudades = CityController.find("EC", centroControl.getProvincecode(), centroControl.getCantoncode()); + appletLugar = lciudades.get(0).getDescription(); + } + } +// else if(numerotransaccion!=null && !numerotransaccion.equals("null")){ +// TarmDecomisoArmaTransaccion decomisoArmaTransaccion= DecomisoArmaTransaccionController.find(numerotransaccion); +// TarmCentroControl centroControl=CentroControlArmasController.findPorCodigo(decomisoArmaTransaccion.getCcentrocontrol()); +// List lciudades = CityController.find("EC", centroControl.getProvincecode(), centroControl.getCantoncode()); +// appletLugar = lciudades.get(0).getDescription(); +// }else if(cplanificacion!=null && !cplanificacion.equals("null")){ +// planificacionInspeccion= PlanificacionInspeccionController.findPorCodigo(Long.parseLong(cplanificacion)); +// TarmCentroControl centroControl=CentroControlArmasController.findPorCodigo(planificacionInspeccion.getCcentrocontrol()); +// List lciudades = CityController.find("EC", centroControl.getProvincecode(), centroControl.getCantoncode()); +// appletLugar = lciudades.get(0).getDescription(); +// } + + + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + /** + * Metodo para extrer solo elnoimbre del archivo + * @param xpath xpath del archivo en alfresco + * @return solo la parte correspondiente al nombre del archivo + */ + public String soloNombreArchivo(String xpath){ + return xpath.substring(xpath.lastIndexOf(":") + 1,xpath.length()); + } + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.lrecord = new ArrayList<>(); + this.beanalias = "FIRMARDOCUMENTOCERTIFICADO"; + btnFlujo=null; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + + } + + /** + * Metodo que analiza si el archivo tiene la extension permitida + * @param nombreArchivo + * @return + */ + public Boolean esExtensionDeArchivoPermitida(String nombreArchivo){ + String[]archivosPermitidosLst = {".pdf"}; + for(String extensionValida:archivosPermitidosLst){ + if(nombreArchivo.contains(extensionValida)){ + return Boolean.TRUE; + } + } + return Boolean.FALSE; + } + + /** + * Metodo para grabar el documento en alfresco + */ + public void saveWithDocumentAlfresco() { + try { + if(uploadedFile!=null && esExtensionDeArchivoPermitida(uploadedFile.getFileName())){ + + if(!uploadedFile.getFileName().equals(xpathflujo.substring( xpathflujo.lastIndexOf(":") + 1,xpathflujo.length()))){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nombrearchivo_xpath")); + return; + } + alfrescoController.uploadFile(uploadedFile.getInputstream(),xpathflujo.substring( xpathflujo.lastIndexOf(":") + 1,xpathflujo.length()), xpathflujo.substring(0,xpathflujo.lastIndexOf(":")-2)); + //completa la tarea + //completarTarea(); + btnFlujo="ok"; + } + else if(uploadedFile==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinarchivo")); + return; + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_archivo_firma")); + return; + } + } catch (Exception e) { + // TODO Auto-generated catch block + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_archivo_firma")); + e.printStackTrace(); + return; + } catch (Throwable e) { + // TODO Auto-generated catch block + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_archivo")); + e.printStackTrace(); + } + + } + + + + + + public void guardarRegistro() { + +} + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", "A" ); // A,D,R + request.modifiedData().put("BPMObs","OK" ); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + this.envioCorreoDocumentoAdjunto(); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + btnFlujo=null; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Envía el correo de cambio de email + * @throws Exception + */ + private void envioCorreoDocumentoAdjunto() throws Exception{ + Mail m = new Mail(); + m.config(ParametersController.find("MAIL.FROM", "1").getTextvalue(), + ParametersController.find("MAIL.SMTP.SERVER", "1").getTextvalue(), + ParametersController.find("MAIL.SMTP.PORT", "1").getNumbervalue().intValue(), + ParametersController.find("MAIL.SMTP.USER", "1").getTextvalue(), + ParametersController.find("MAIL.SMTP.PASSWORD", "1").getTextvalue(), + Boolean.valueOf(ParametersController.find("MAIL.SMTP.AUTH", "1").getTextvalue()), + Boolean.valueOf(ParametersController.find("MAIL.SMTPS", "1").getTextvalue())); + TcustPersonAddress mail = personAddress.findPersonaPorDireccionTipoCatalogo(certificadoFiscalia.getPersoncode().toString(), "3"); + m.setTo(personAddress.getRecord().getAddress()); + MessageTemplatesController message = new MessageTemplatesController(); + message.addFilter("pk", "67"); + message.query(); + if(message.getLrecord() != null && !message.getLrecord().isEmpty()){ + TgeneMessageTemplates asunto = message.getLrecord().get(0); + MessageTemplatesDescController content = new MessageTemplatesDescController(); + content.addFilter("pk.code", "67"); + content.addFilter("pk.languagecode", "ES"); + content.query(); + if(content.getLrecord() != null && !content.getLrecord().isEmpty()){ + TgeneMessageTemplatesDesc descripcionContenido = content.getLrecord().get(0); + //Velocity.init(); + //VelocityContext context = new VelocityContext(); + //context.put("nombreusuario", this.getLoginController().getRequest().getUser()); + //context.put("clave", this.record.get("newpassword")); + m.setSubject(asunto.getDescription()); + //StringWriter sw = new StringWriter(); +// String sw=descripcionContenido.getTemplate().replace("$clave", this.record.get("newpassword").toString()); +// sw=sw.replace("$nombreusuario", this.record.get("name")+""); + //Velocity.evaluate(context, sw, "", descripcionContenido.getTemplate()); + String sw = "Mail de prueba documento habilitante con adjunto"; + m.setCont(sw.toString()); + m.setContentMessageType("text/html"); + // Descargar el documento habilitante a adjuntar + byte[] bytes = alfrescoController.downloadReturnDocument(this.xpathflujo); + m.addAttachment("documento.pdf", bytes, "application/pdf"); +// m.addAttachment("Documento Habilitante","C:\\Users\\JALVARADO\\Downloads\\DOC-000362250.pdf"); + m.send(); + } + } + } + + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){} + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en el Alfresco + */ + public void handleUpload(FileUploadEvent event){ + uploadedFile = event.getFile(); + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + + public String getXpath() { + return xpathSolicitud; + } + + public void setXpath(String xpathSolicitud) { + this.xpathSolicitud = xpathSolicitud; + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + + public void upload(FileUploadEvent event) { + uploadedFile = event.getFile(); + try { + boolean isValid = DocFirmaValidator.validDocSign(uploadedFile.getInputstream()); + if(isValid){ + mensajeNoFirma = false; + mensajeGuardar = true; + + }else{ + uploadedFile = null; + btnFlujo=null; + mensajeNoFirma = true; + mensajeGuardar = false; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinfirmararchivo")); + } + } catch (IOException e) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinfirmararchivo")); + } + + } + + public String getAppletCoordenadallx() { + return appletCoordenadallx; + } + + public void setAppletCoordenadallx(String appletCoordenadallx) { + this.appletCoordenadallx = appletCoordenadallx; + } + + public String getAppletCoordenadally() { + return appletCoordenadally; + } + + public void setAppletCoordenadally(String appletCoordenadally) { + this.appletCoordenadally = appletCoordenadally; + } + + public String getAppletCoordenadaurx() { + return appletCoordenadaurx; + } + + public void setAppletCoordenadaurx(String appletCoordenadaurx) { + this.appletCoordenadaurx = appletCoordenadaurx; + } + + public String getAppletCoordenadaury() { + return appletCoordenadaury; + } + + public boolean isMensajeGuardar() { + return mensajeGuardar; + } + + public void setMensajeGuardar(boolean mensajeGuardar) { + this.mensajeGuardar = mensajeGuardar; + } + + public void setAppletCoordenadaury(String appletCoordenadaury) { + this.appletCoordenadaury = appletCoordenadaury; + } + + public String getAppletLugar() { + return appletLugar; + } + + public void setAppletLugar(String appletLugar) { + this.appletLugar = appletLugar; + } + + public String getAppletFirma() { + return appletFirma; + } + + public void setAppletFirma(String appletFirma) { + this.appletFirma = appletFirma; + } + + public String getBtnFlujo() { + return btnFlujo; + } + + public void setBtnFlujo(String btnFlujo) { + this.btnFlujo = btnFlujo; + } + + public PersonAddressController getPersonAddress() { + return personAddress; + } + + public void setPersonAddress(PersonAddressController personAddress) { + this.personAddress = personAddress; + } + + public String getXpathSolicitud() { + return xpathSolicitud; + } + + public void setXpathSolicitud(String xpathSolicitud) { + this.xpathSolicitud = xpathSolicitud; + } + + public String getNumerosolicitud() { + return numerosolicitud; + } + + public void setNumerosolicitud(String numerosolicitud) { + this.numerosolicitud = numerosolicitud; + } + + public boolean isMensajeNoFirma() { + return mensajeNoFirma; + } + + public void setMensajeNoFirma(boolean mensajeNoFirma) { + this.mensajeNoFirma = mensajeNoFirma; + } + + + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/GuardiasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/GuardiasController.java.svn-base new file mode 100644 index 0000000..74570cf --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/GuardiasController.java.svn-base @@ -0,0 +1,169 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.event.AjaxBehaviorEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmGuardias; + +/** + * Controlador que maneja guardias de seguridad + * @author james + * + */ +@ManagedBean +@ViewScoped +public class GuardiasController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public GuardiasController() throws Exception { + super(TarmGuardias.class); + } + + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "GUARDIAS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método ejecutado después de ejecutarse el constructor + */ + @PostConstruct + public void postConstruct(){ + + init(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dtoQuery = super.getDtoQuery(Boolean.TRUE); + HashMapmtables = new HashMap(); + mtables.put(beanalias, dtoQuery); + SubQuery subQueryGuardia1 = new SubQuery("TcustPersonDetail", "name", "gnombre", "i.pk.personcode=t.pk and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.pk)"); + SubQuery subQueryGuardia2 = new SubQuery("TcustPersonDetail", "identification", "gcedula", "i.pk.personcode=t.pk and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.pk)"); + SubQuery subQueryEmpresa1 = new SubQuery("TcustPersonDetail","name","nempresa","i.pk.personcode=t.cempresa and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.cempresa)"); + SubQuery subQueryEmpresa2 = new SubQuery("TcustPersonDetail", "identification", "iempresa", "i.pk.personcode=t.cempresa and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.cempresa)"); + dtoQuery.addSubQuery(subQueryGuardia1); + dtoQuery.addSubQuery(subQueryGuardia2); + dtoQuery.addSubQuery(subQueryEmpresa1); + dtoQuery.addSubQuery(subQueryEmpresa2); + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response response = callerhelper.executeQuery(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0){ + this.lrecord = new ArrayList<>(); + MessageHelper.setMessageError(response); + } else{ + this.lrecord = (List) response.get(beanalias); + this.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * M\u00e9todo para encontrar por solicitud + * @param solicitudCode + * @return + */ + public static TarmGuardias find(String guardiaCode, String empresaCode) { + try { + GuardiasController cc = new GuardiasController(); + //cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", guardiaCode); + cc.addFilter("cempresa", empresaCode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response response = this.callerhelper.executeSave(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(response); + MessageHelper.setMessageInfo(response); + } else { + MessageHelper.setMessageError(response); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if(Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")){ + valorColocar = Boolean.TRUE; + } + for (TarmGuardias guardias : lrecord) { + guardias.getModifiedData().put("seleccionado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static TarmGuardias findxcguardia(String codigopersona){ + try { + GuardiasController cc = new GuardiasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", codigopersona); + + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ImportacionArmasDetalleController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ImportacionArmasDetalleController.java.svn-base new file mode 100644 index 0000000..59d99e8 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ImportacionArmasDetalleController.java.svn-base @@ -0,0 +1,143 @@ +package com.fp.frontend.controller.armas.parametros; + + +import java.util.ArrayList; +import java.util.HashMap; + +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmDetalleImportacion; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Clase controladora del bean Tdireccion. + * + * @author Andres Cevallos. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ImportacionArmasDetalleController extends AbstractController { + + + + public ImportacionArmasDetalleController() throws Exception { + super(TarmDetalleImportacion.class); + } + + + @PostConstruct + private void postconstruct() { + this.init(); + + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + + this.beanalias = "TARMASDETALLE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void executeProvincia() { + + + } + + + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + + + + + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ImportacionController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ImportacionController.java.netbeans-base new file mode 100644 index 0000000..c00b418 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ImportacionController.java.netbeans-base @@ -0,0 +1,459 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + + + + + + +import javax.faces.context.FacesContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.ArmaExcell; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.funcionalidad.TotalArmasController; +import com.fp.frontend.controller.armas.solicitud.SolicitudController; +import com.fp.frontend.controller.armas.solicitud.SolicitudTramiteController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + + +/** + * Clase controladora del bean + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ImportacionController extends AbstractController { + + public ImportacionController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmController; + + @ManagedProperty(value = "#{armaController}") + private ArmaController armaController; + + /* + @ManagedProperty(value = "#{armaControllerProduccion}") + private ArmaControllerProduccion armaControllerProduccion; + */ + + @ManagedProperty(value = "#{totalArmasController}") + private TotalArmasController totalArmasController; + + private Boolean tiporegistro; + + private Boolean aux; + + private Date fechaactual; + private List ltiporegistro; + + private List laddresstype; + + private List lprovinces; + + private List lcantones; + + private List lciudades; + + private List lcountry; + + private TgeneCountry pais; + + private List lcities; + + + + private TgeneCatalogDetail cdetalle; + + private Date fechadesolicitud; + + public void changeType(){ + if(this.registroArmController.getRecord().getTiporegistro()==null){ + setTiporegistro(false); + } + else if(this.registroArmController.getRecord().getTiporegistro().equals("PRO")){ + + setTiporegistro(false); + + } + else{ + setTiporegistro(true); + + + } + } + + + + public Boolean getAux() { + return aux; + } + + public void setAux(Boolean aux) { + this.aux = aux; + } + + public TotalArmasController getTotalArmasController() { + return totalArmasController; + } + + public void setTotalArmasController(TotalArmasController totalArmasController) { + this.totalArmasController = totalArmasController; + } + + // @ManagedProperty(value = "#{importacionArmasDetalleController}") +// private ImportacionArmasDetalleController importacionArmasDetalleController; + @ManagedProperty(value = "#{loginController}") + private LoginController loginController; + + public RegistroArmController getRegistroArmController() { + return registroArmController; + } + + public void setRegistroArmController( + RegistroArmController RegistroArmController) { + this.registroArmController = RegistroArmController; + } + + + + + //Datos quemados de Prueba + private List lsolicitud; + + private TarmSolicitud solicitud; + //Fin de Datos quemados de prueba + + private TcustPersonDetail persondetail; + + //private TarmSolicitud solicitudpersondata; + + private List lperson; + + + + public List getLaddresstype() { + return laddresstype; + } + + public void setLaddresstype(List laddresstype) { + this.laddresstype = laddresstype; + } + + public List getLprovinces() { + return lprovinces; + } + + public void setLprovinces(List lprovinces) { + this.lprovinces = lprovinces; + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public List getLcountry() { + return lcountry; + } + + public void setLcountry(List lcountry) { + this.lcountry = lcountry; + } + + public List getLcities() { + return lcities; + } + + public void setLcities(List lcities) { + this.lcities = lcities; + } + + public List getLsolicitud() { + return lsolicitud; + } + + public void setLsolicitud(List lsolicitud) { + this.lsolicitud = lsolicitud; + } + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + + + public List getLperson() { + return lperson; + } + + public void setLperson(List lperson) { + this.lperson = lperson; + } + + + @PostConstruct + private void postconstruct() { + + + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + + crearRegistro(); + this.lrecord = new ArrayList<>(); + this.beanalias = "IMPORTACION"; + + pais = new TgeneCountry(); + aux=false; + fechaactual=new Date(); + fechadesolicitud=new Date(); + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + //solicitud.setPersoncode(tsafeUserDetail.getPk().getPersoncode()); + setPersondetail(PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString())); + setLtiporegistro(CatalogDetailController.find("TIPOREGISTRO", "REG")); + armaController.setPersoncode(tsafeUserDetail.getPk().getPersoncode()); + setLaddresstype(CatalogDetailController.find("ADDRESSTYPE")); + setLcountry(CountryController.find()); + pais=CountryController.findcountry("EC"); + //armaController.setPais(pais.getPk()); + setTiporegistro(false); + setLprovinces(ProvinceController.find(pais.getPk())); + cdetalle = CatalogDetailController.findxCodigoCodcatalogo(getPersondetail().getIdentificationcatalog(),getPersondetail().getIdentificationcatalogcode()); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + + } + + + public void actualizarsolicitudImportacionArmas() throws Exception{ + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + registroArmController.getRecord().setFcreacion(new java.sql.Date(new Date().getTime())); + + if(fechadesolicitud!=null) + registroArmController.getRecord().setFechasolicitud(new java.sql.Date(fechadesolicitud.getTime())); + registroArmController.getRecord().setPersoncode(tsafeUserDetail.getPk().getPersoncode()); + registroArmController.getRecord().setTiporegistrocodigo("TIPOREGISTRO"); + registroArmController.update(); + +} + + public void crearRegistro() throws Exception{ + registroArmController.create(); + } + +public void validarTramite(String tramite){ + + + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + String solicitud = SolicitudTramiteController.findByNumTramite(tramite).getPk().getCsolicitud(); + aux=SolicitudController.existeRegistroPersona(tsafeUserDetail.getPk().getPersoncode(), solicitud); + +} + +public void actualizarTotales() throws Exception{ + + totalArmasController.update(); + for (TarmArmas object : armaController.getLrecord() ){ + TiposArmasExplosivosController.findarma(object.getCtipoarmaexplosivo()); + } +} +//importacionController.armaController.record.provincecode + + @Override + public void save() { + try { + if(armaController.getLrecord()==null||armaController.getLrecord().isEmpty()) + return; + actualizarsolicitudImportacionArmas(); + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = this.armaController.getDtoSave(true); + HashMap msave = new HashMap(); + msave.put(armaController.getBeanalias(), dtosave); // adicionar metadata de mantenimiento para cada tabla. + dtosave.setPosition(1); + + DtoSave dtosaveSol = this.registroArmController.getDtoSave(true); + dtosaveSol.setPosition(2); + msave.put(registroArmController.getBeanalias(), dtosaveSol); + + DtoSave dtosaveTot = this.totalArmasController.getDtoSave(true); + dtosaveTot.setPosition(3); + msave.put(totalArmasController.getBeanalias(), dtosaveTot); + request.setSaveTables(msave); + + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + + this.armaController.postCommit(resp); + this.registroArmController.postCommit(resp); + this.totalArmasController.postCommit(resp); + this.armaController.clearAll(); + this.registroArmController.clearAll(); + this.totalArmasController.clearAll(); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + //armaController.setSave(false); + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + //armaController.setSave(false); + } + finally{ + try { + crearRegistro(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } + + @Override + public void postCommit(Response response) throws Exception { + this.armaController.postCommit(response); + this.registroArmController.postCommit(response); + this.totalArmasController.postCommit(response); + } + + public ArmaController getArmaController() { + return armaController; + } + + public void setArmaController(ArmaController armaController) { + this.armaController = armaController; + } + + public LoginController getLoginController() { + return loginController; + } + + public void setLoginController(LoginController loginController) { + this.loginController = loginController; + } + + public TcustPersonDetail getPersondetail() { + return persondetail; + } + + public void setPersondetail(TcustPersonDetail persondetail) { + this.persondetail = persondetail; + } + + public TgeneCatalogDetail getCdetalle() { + return cdetalle; + } + + public void setCdetalle(TgeneCatalogDetail cdetalle) { + this.cdetalle = cdetalle; + } + + public List getLciudades() { + return lciudades; + } + + public void setLciudades(List lciudades) { + this.lciudades = lciudades; + } + + public TgeneCountry getPais() { + return pais; + } + + public void setPais(TgeneCountry pais) { + this.pais = pais; + } + + public List getLtiporegistro() { + return ltiporegistro; + } + + public void setLtiporegistro(List ltiporegistro) { + this.ltiporegistro = ltiporegistro; + } + + public Boolean getTiporegistro() { + return tiporegistro; + } + + public void setTiporegistro(Boolean tiporegistro) { + this.tiporegistro = tiporegistro; + } + + public Date getFechadesolicitud() { + return fechadesolicitud; + } + + public void setFechadesolicitud(Date fechadesolicitud) { + this.fechadesolicitud = fechadesolicitud; + } + + public Date getFechaactual() { + return fechaactual; + } + public void setFechaactual(Date fechaactual) { + this.fechaactual = fechaactual; + } + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ImportacionController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ImportacionController.java.svn-base new file mode 100644 index 0000000..c00b418 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ImportacionController.java.svn-base @@ -0,0 +1,459 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + + + + + + +import javax.faces.context.FacesContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.ArmaExcell; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.funcionalidad.TotalArmasController; +import com.fp.frontend.controller.armas.solicitud.SolicitudController; +import com.fp.frontend.controller.armas.solicitud.SolicitudTramiteController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + + +/** + * Clase controladora del bean + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ImportacionController extends AbstractController { + + public ImportacionController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmController; + + @ManagedProperty(value = "#{armaController}") + private ArmaController armaController; + + /* + @ManagedProperty(value = "#{armaControllerProduccion}") + private ArmaControllerProduccion armaControllerProduccion; + */ + + @ManagedProperty(value = "#{totalArmasController}") + private TotalArmasController totalArmasController; + + private Boolean tiporegistro; + + private Boolean aux; + + private Date fechaactual; + private List ltiporegistro; + + private List laddresstype; + + private List lprovinces; + + private List lcantones; + + private List lciudades; + + private List lcountry; + + private TgeneCountry pais; + + private List lcities; + + + + private TgeneCatalogDetail cdetalle; + + private Date fechadesolicitud; + + public void changeType(){ + if(this.registroArmController.getRecord().getTiporegistro()==null){ + setTiporegistro(false); + } + else if(this.registroArmController.getRecord().getTiporegistro().equals("PRO")){ + + setTiporegistro(false); + + } + else{ + setTiporegistro(true); + + + } + } + + + + public Boolean getAux() { + return aux; + } + + public void setAux(Boolean aux) { + this.aux = aux; + } + + public TotalArmasController getTotalArmasController() { + return totalArmasController; + } + + public void setTotalArmasController(TotalArmasController totalArmasController) { + this.totalArmasController = totalArmasController; + } + + // @ManagedProperty(value = "#{importacionArmasDetalleController}") +// private ImportacionArmasDetalleController importacionArmasDetalleController; + @ManagedProperty(value = "#{loginController}") + private LoginController loginController; + + public RegistroArmController getRegistroArmController() { + return registroArmController; + } + + public void setRegistroArmController( + RegistroArmController RegistroArmController) { + this.registroArmController = RegistroArmController; + } + + + + + //Datos quemados de Prueba + private List lsolicitud; + + private TarmSolicitud solicitud; + //Fin de Datos quemados de prueba + + private TcustPersonDetail persondetail; + + //private TarmSolicitud solicitudpersondata; + + private List lperson; + + + + public List getLaddresstype() { + return laddresstype; + } + + public void setLaddresstype(List laddresstype) { + this.laddresstype = laddresstype; + } + + public List getLprovinces() { + return lprovinces; + } + + public void setLprovinces(List lprovinces) { + this.lprovinces = lprovinces; + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public List getLcountry() { + return lcountry; + } + + public void setLcountry(List lcountry) { + this.lcountry = lcountry; + } + + public List getLcities() { + return lcities; + } + + public void setLcities(List lcities) { + this.lcities = lcities; + } + + public List getLsolicitud() { + return lsolicitud; + } + + public void setLsolicitud(List lsolicitud) { + this.lsolicitud = lsolicitud; + } + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + + + public List getLperson() { + return lperson; + } + + public void setLperson(List lperson) { + this.lperson = lperson; + } + + + @PostConstruct + private void postconstruct() { + + + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + + crearRegistro(); + this.lrecord = new ArrayList<>(); + this.beanalias = "IMPORTACION"; + + pais = new TgeneCountry(); + aux=false; + fechaactual=new Date(); + fechadesolicitud=new Date(); + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + //solicitud.setPersoncode(tsafeUserDetail.getPk().getPersoncode()); + setPersondetail(PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString())); + setLtiporegistro(CatalogDetailController.find("TIPOREGISTRO", "REG")); + armaController.setPersoncode(tsafeUserDetail.getPk().getPersoncode()); + setLaddresstype(CatalogDetailController.find("ADDRESSTYPE")); + setLcountry(CountryController.find()); + pais=CountryController.findcountry("EC"); + //armaController.setPais(pais.getPk()); + setTiporegistro(false); + setLprovinces(ProvinceController.find(pais.getPk())); + cdetalle = CatalogDetailController.findxCodigoCodcatalogo(getPersondetail().getIdentificationcatalog(),getPersondetail().getIdentificationcatalogcode()); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + + } + + + public void actualizarsolicitudImportacionArmas() throws Exception{ + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + registroArmController.getRecord().setFcreacion(new java.sql.Date(new Date().getTime())); + + if(fechadesolicitud!=null) + registroArmController.getRecord().setFechasolicitud(new java.sql.Date(fechadesolicitud.getTime())); + registroArmController.getRecord().setPersoncode(tsafeUserDetail.getPk().getPersoncode()); + registroArmController.getRecord().setTiporegistrocodigo("TIPOREGISTRO"); + registroArmController.update(); + +} + + public void crearRegistro() throws Exception{ + registroArmController.create(); + } + +public void validarTramite(String tramite){ + + + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + String solicitud = SolicitudTramiteController.findByNumTramite(tramite).getPk().getCsolicitud(); + aux=SolicitudController.existeRegistroPersona(tsafeUserDetail.getPk().getPersoncode(), solicitud); + +} + +public void actualizarTotales() throws Exception{ + + totalArmasController.update(); + for (TarmArmas object : armaController.getLrecord() ){ + TiposArmasExplosivosController.findarma(object.getCtipoarmaexplosivo()); + } +} +//importacionController.armaController.record.provincecode + + @Override + public void save() { + try { + if(armaController.getLrecord()==null||armaController.getLrecord().isEmpty()) + return; + actualizarsolicitudImportacionArmas(); + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = this.armaController.getDtoSave(true); + HashMap msave = new HashMap(); + msave.put(armaController.getBeanalias(), dtosave); // adicionar metadata de mantenimiento para cada tabla. + dtosave.setPosition(1); + + DtoSave dtosaveSol = this.registroArmController.getDtoSave(true); + dtosaveSol.setPosition(2); + msave.put(registroArmController.getBeanalias(), dtosaveSol); + + DtoSave dtosaveTot = this.totalArmasController.getDtoSave(true); + dtosaveTot.setPosition(3); + msave.put(totalArmasController.getBeanalias(), dtosaveTot); + request.setSaveTables(msave); + + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + + this.armaController.postCommit(resp); + this.registroArmController.postCommit(resp); + this.totalArmasController.postCommit(resp); + this.armaController.clearAll(); + this.registroArmController.clearAll(); + this.totalArmasController.clearAll(); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + //armaController.setSave(false); + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + //armaController.setSave(false); + } + finally{ + try { + crearRegistro(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } + + @Override + public void postCommit(Response response) throws Exception { + this.armaController.postCommit(response); + this.registroArmController.postCommit(response); + this.totalArmasController.postCommit(response); + } + + public ArmaController getArmaController() { + return armaController; + } + + public void setArmaController(ArmaController armaController) { + this.armaController = armaController; + } + + public LoginController getLoginController() { + return loginController; + } + + public void setLoginController(LoginController loginController) { + this.loginController = loginController; + } + + public TcustPersonDetail getPersondetail() { + return persondetail; + } + + public void setPersondetail(TcustPersonDetail persondetail) { + this.persondetail = persondetail; + } + + public TgeneCatalogDetail getCdetalle() { + return cdetalle; + } + + public void setCdetalle(TgeneCatalogDetail cdetalle) { + this.cdetalle = cdetalle; + } + + public List getLciudades() { + return lciudades; + } + + public void setLciudades(List lciudades) { + this.lciudades = lciudades; + } + + public TgeneCountry getPais() { + return pais; + } + + public void setPais(TgeneCountry pais) { + this.pais = pais; + } + + public List getLtiporegistro() { + return ltiporegistro; + } + + public void setLtiporegistro(List ltiporegistro) { + this.ltiporegistro = ltiporegistro; + } + + public Boolean getTiporegistro() { + return tiporegistro; + } + + public void setTiporegistro(Boolean tiporegistro) { + this.tiporegistro = tiporegistro; + } + + public Date getFechadesolicitud() { + return fechadesolicitud; + } + + public void setFechadesolicitud(Date fechadesolicitud) { + this.fechadesolicitud = fechadesolicitud; + } + + public Date getFechaactual() { + return fechaactual; + } + public void setFechaactual(Date fechaactual) { + this.fechaactual = fechaactual; + } + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ImportacionDetalleController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ImportacionDetalleController.java.svn-base new file mode 100644 index 0000000..ea1ad10 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ImportacionDetalleController.java.svn-base @@ -0,0 +1,5 @@ +package com.fp.frontend.controller.armas.parametros; + +public class ImportacionDetalleController { + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ImporteArmasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ImporteArmasController.java.svn-base new file mode 100644 index 0000000..731b756 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ImporteArmasController.java.svn-base @@ -0,0 +1,853 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletResponse; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.jboss.logging.Logger; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.util.ArmasExcel; +import com.fp.frontend.controller.armas.parametros.util.TipoArmaExplosivoPKExcel; +import com.fp.frontend.controller.armas.solicitud.DecomisoArmaController; +import com.fp.frontend.controller.armas.solicitud.DecomisoController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ImporteArmasController extends AbstractController { + + /* CATALOGOS */ + /* TIPO ARMA EXPLOSIVO */ + private List listLongitudes; + private List listCalibres; + private List listClases; + private List listTipoArmaExplosivos; + /* ADICONAL */ + private List listMarcas; + private List listTipoFabricacion; + + /** + * Variable para a;adir las armas que se van a Guardar + */ + private List listArmas; + /** + * registro del Arma Due;o de las armas + */ + private TarmRegistroArmas registroArma; + /** + * Cabecera del decomiso + */ + private TarmDecomiso tarmDecomiso; + /** + * Variable para listar los errores al cargar el excel + */ + private List listaErrores; + /** + * Mensaje de error + */ + private String mensajeError; + /** + * numero de armas procesadas + */ + private Integer numArmasProcesadas; + /** + * numero de armas con error + */ + private Integer numArmasError; + /** + * numero de armas con error + */ + private Integer numCorrectas; + /** + * Centro de control Policoa Judicia 2/PN07 + */ + private TarmCentroControl centroControl; + + /** + * Detalle del usuario + */ + private TcustPersonDetail usuario; + + /** + * Nombre del centro de control logeado + */ + private String centroControlNombreLogeado; + /** + * Numero de registro + */ + private String numeroRecibo; + + /*Constante centro control*/ + private String nombreInstitucion; + private String institucion; + /*Cedula del propietario*/ + private String cedulaPropietario; + /*motivo incautacion*/ + private String motivocatalogo; + /*cantidad de armas*/ + private Integer cantidad=1; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmasController; + + /** + * Controlador que maneja el decomiso TarmDecomiso + */ + @ManagedProperty(value = "#{decomisoController}") + private DecomisoController decomisoController; + + /** + * Controlador que maneja TarmDecomisoArma + */ + @ManagedProperty(value = "#{decomisoArmaController}") + private DecomisoArmaController decomisoArmaController; + + private MapmapaProvincia; + private MapmapaCanton; + private SetlistaTipoArmaExplosivoPk; + + private final static Logger LOG = Logger.getLogger(ImporteArmasController.class.getName()); + + public ImporteArmasController() throws Exception { + super(TarmArmas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.record = new TarmArmas(); + this.beanalias = "ARMASIMPORTE"; + listArmas = new ArrayList(); + registroArma = new TarmRegistroArmas(); + mapaProvincia=new HashMap(); + mapaCanton=new HashMap(); + listaTipoArmaExplosivoPk=new HashSet<>(); + cargaParametros(); + cargaCatalogos(); + cargaRegistroArma(); + cargaUsuarioLogeado(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void cargaParametros(){ + nombreInstitucion=codigos("CODIGO.NOM.INSTIT.IMPORTE");//"PJ01" + institucion=codigos("CODIGO.INSTITUCION.IMPORTE");//2 + /*Cedula del propietario*/ + cedulaPropietario=codigos("CEDULA.PROPIETARIO.IMPORTE");//"999999999"; + /*motivo incautacion*/ + motivocatalogo=codigos("MOTIVO.IMPORTE");//"9"; + } + + /** + * Método para obtener los codigos + */ + private String codigos(String parametro){ + TgeneParameters tgeneParameters= ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + public void cargaCatalogos() { + /* TIPOARMAEXPLOSIVO */ + listLongitudes = CatalogDetailController.find("LONGITUD"); + listCalibres = CatalogDetailController.find("CALIBRE"); + listClases = CatalogDetailController.find("CLASE"); + listTipoArmaExplosivos = CatalogDetailController.find("TIPOARMAEXPLOSIVO"); + /* CATALOGO AD */ + listMarcas = CatalogDetailController.find("MARCA"); + listTipoFabricacion = CatalogDetailController.find("TIPOFABRICACION"); + //listColor = CatalogDetailController.find("COLOR"); + } + + public void cargaUsuarioLogeado(){ + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + centroControlNombreLogeado = tsafeUserDetail.getModifiedData().get("centrocontrol").toString(); + } + + public void cargaRegistroArma() { + TcustPersonDetail tcustPersonDetail = PersonDetailController.findByIdentification(cedulaPropietario); + registroArma.setPersoncode(tcustPersonDetail.getPk().getPersoncode()); + registroArma.setFcreacion(new java.sql.Date(new Date().getTime())); + registroArma.setTiporegistro("INCA"); + registroArma.setTiporegistrocodigo("TIPOREGISTRO"); + registroArma.setPaisorigen(""); + registroArma.setIsnew(true); + + ListlistCentroControls= CentroControlArmasController.findxOrganismoUnidad(institucion,nombreInstitucion); + if(listCentroControls!=null && listCentroControls.size()==1){ + centroControl=listCentroControls.get(0); + }else{ + centroControl=null; + mensajeError="NO TIENE REGISTRADO UN CENTRO DE CONTROL O TIENE REGISTRADO MAS DE UNO CON EL MISMO NOMBRE DE INSTITUCI\u00d3N Y NOMBRE INSTITUCI\u00d3N"; + } + } + + /* + * (non-Javadoc) + * + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + + DtoQuery dto = super.getDtoQuery(true); + Filter filtrofecha = new Filter(); + filtrofecha + .setSql("t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) and t.estado !='DEST' and t.estado !='CDP'"); + dto.addFiltro(filtrofecha); + dto.setOrderby("pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + public void save() { + try { + if(centroControl==null){ + MessageHelper.setMessageError("NO TIENE CENTRO DE CONTROL REVISE EL CENTRO DE CONTROL"); + return; + } + if(listArmas==null || listArmas.size()==0 || listArmas.isEmpty()){ + MessageHelper.setMessageError("NO EXISTEN ARMAS CARGADAS "); + return; + } + HashMap msave = new HashMap(); + Request request = this.callerhelper.getRequest(); + // regstroArma + registroArmasController.clearAll(); + registroArmasController.setRecord(registroArma); + registroArmasController.update(); + DtoSave dtosaveregistroarma = registroArmasController.getDtoSave(true); + dtosaveregistroarma.setPosition(1); + msave.put(registroArmasController.getBeanalias(),dtosaveregistroarma); + + // cargar Armas + this.clearAll(); + cargarArmas(); + DtoSave dtosave = super.getDtoSave(true); + dtosave.setPosition(2); + msave.put(this.beanalias, dtosave); + + //carga tarmdecomiso + decomisoController.clearAll(); + tarmDecomiso= new TarmDecomiso(); + tarmDecomiso.setIsnew(true); + tarmDecomiso.setTipoprocesocode("TIPOREGISTRO"); + tarmDecomiso.setTipoproceso("INCA"); + tarmDecomiso.setCcentrocontrol(centroControl.getPk()); + tarmDecomiso.setNumerorecibo(numeroRecibo);//numero de oficio + tarmDecomiso.setFecharegistro(new java.sql.Date(new Date().getTime())); + //tarmDecomiso.setOrganismocontrol(centroControlNombreLogeado); + tarmDecomiso.setOrganismocontrol(centroControl.getModifiedData().get("desinstitucion").toString()); + tarmDecomiso.setPersoncoderegistra(usuario.getPk().getPersoncode()); + + //tarmDecomiso.setNumerotransaccion(pNumerotransaccion); + decomisoController.setRecord(tarmDecomiso); + decomisoController.update(); + DtoSave dtoDecomiso = decomisoController.getDtoSave(true); + dtoDecomiso.setPosition(3); + msave.put("IMPORTEDECOMISO",dtoDecomiso); + + //Tarmdecomisoarma + decomisoArmaController.clearAll(); + DtoSave dtoDecomisoArma = decomisoArmaController.getDtoSave(true); + dtoDecomisoArma.setPosition(4); + msave.put(decomisoArmaController.getBeanalias(),dtoDecomisoArma); + + request.setSaveTables(msave); + //request.getModifiedData().put("REGISTRO", this.registroArma); + + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + mensajeError=null; + MessageHelper.setMessageInfo(resp); + listArmas.clear(); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + public void cargarArmas() throws Exception { + for (TarmArmas item : listArmas) { + item.setEstadoDecomiso(numeroRecibo); + this.record = item; + record.setIsnew(true); + super.update(); + } + } + + /** + * Metodo que carga y valida el contenido de un archivo excel con + * información de armas + * + * @param event + */ + public void cargarArchivo(FileUploadEvent event) { + listArmas = new ArrayList(); + listaErrores = new ArrayList(); + int contador = 0; + try { + UploadedFile selectedFile = event.getFile(); + InputStream archivo = selectedFile.getInputstream(); + XSSFWorkbook libro = new XSSFWorkbook(archivo); + XSSFSheet hoja = libro.getSheetAt(0); + // Iterando sobre las filas + Iterator rowIterator = hoja.iterator(); + ListlistaArmasExcel = new ArrayList(); + // Cargando el contenido de las celdas a una lista de objetos + while (rowIterator.hasNext()) { + Row row = rowIterator.next(); + if(contador!=0){ + Cell orden = row.getCell(0); + Cell longuitud = row.getCell(14); + Cell calibre = row.getCell(5); + Cell clase = row.getCell(1);//material + Cell tipoArmaExplosivo = row.getCell(2);// modelo: REVOLVER CARTUCHERA CARTUCHERANO CARABINA SUB-AMETRALLADORA*revisar + Cell marca = row.getCell(3); + Cell tipoFabricacion = row.getCell(7); + Cell serie = row.getCell(4); + Cell fechaRecepcion = row.getCell(9); + Cell motivo = row.getCell(10); + Cell descripcionProvincia= row.getCell(12); + Cell descripcionCanton= row.getCell(13); + Cell observaciones= row.getCell(15); + if (!this.celdaVacia(orden) + && !this.celdaVacia(longuitud) + && !this.celdaVacia(calibre) + && !this.celdaVacia(clase) + && !this.celdaVacia(tipoArmaExplosivo) + && !this.celdaVacia(marca) + && !this.celdaVacia(tipoFabricacion) + && !this.celdaVacia(serie) + && !this.celdaVacia(fechaRecepcion) + && !this.celdaVacia(motivo) + && !this.celdaVacia(descripcionProvincia) + && !this.celdaVacia(descripcionCanton) + && !this.celdaVacia(observaciones)) { + + ArmasExcel armasExcel = new ArmasExcel(orden.toString().trim(),longuitud.toString().trim(),calibre.toString().trim(), + clase.toString().trim(),tipoArmaExplosivo.toString().trim(),marca.toString().trim(), + tipoFabricacion.toString().trim(),serie.toString().trim(),fechaRecepcion.toString().trim(), + motivo.toString().trim(),descripcionProvincia.toString().trim(),descripcionCanton.toString().trim(), + observaciones.toString().trim(),contador); + listaArmasExcel.add(armasExcel); + LOG.info("CONTADOR........"+contador); + } else { + listaErrores.add("EL REGISTRO TIENE CAMPOS EN BLANCO, REGISTRO: " + contador); + } + contador++; + }else{ + contador++; + } + } + archivo.close(); + + LOG.info("NUMERO REGISTROS........."+listaArmasExcel.size()); + LOG.info("Procesar armas adjuntas"); + MapmapaSerie=new HashMap(); + int auxi=0; + for (ArmasExcel armasExcel : listaArmasExcel) { + LOG.info("CONTADOR 2: "+auxi++); + TarmArmas arma = armarlistaArmasExcel(armasExcel.getLonguitud(),armasExcel.getCalibre(),armasExcel.getClase(), + armasExcel.getTipoArmaExplosivo(),armasExcel.getMarca(),armasExcel.getTipoFabricacion(), + armasExcel.getCont(), armasExcel.getSerie(),armasExcel.getDescripcionProvincia(),armasExcel.getDescripcionCanton()); + if (arma != null) { + arma.getModifiedData().put("motivo", armasExcel.getMotivo()); + arma.getModifiedData().put("observaciondecomiso", armasExcel.getObservaciones()); + arma.getModifiedData().put("cantidad",cantidad); + arma.getModifiedData().put("motivocatalogocode","MOTIVODECOMISO"); + arma.getModifiedData().put("motivocatalogo",motivocatalogo);//entrega voluntaria + //dd/MM/yyyy + try { + //validar si la serie es repetida + if(mapaSerie.get(armasExcel.getSerie())!=null){ + listaErrores.add("SERIE DUPLICADA" + armasExcel.getSerie()+ " DEL REGISTRO: "+armasExcel.getCont()); + continue; + }else{ + mapaSerie.put(armasExcel.getSerie(),armasExcel.getSerie()); + } + + SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy"); //formatter.parse("7-OCT-016"); + Date date = formatter.parse(armasExcel.getFechaRecepcion()); + Calendar cal= Calendar.getInstance(); + cal.setTime(date); + String anio=cal.get(Calendar.YEAR)+""; + if(anio!=null && anio.trim().length()==4 && cal.get(Calendar.YEAR)>1900){ + arma.getModifiedData().put("fechaRecepcion",date); + arma.getModifiedData().put("fechaDecomiso",date); + //ANIADE EL ARMA + listArmas.add(arma); + }else{ + listaErrores.add("PROBLEMA CON LA FECHA DE RECEPCI\u00d3N " + armasExcel.getFechaRecepcion()+ ", EL A\u00d1O: "+anio+ + " NO CORRESPONDE AL FORMATO, EL FORMATO ES dd-MMM-yyyy EJ:(04-OCT-2017), DEL REGISTRO: "+armasExcel.getCont()); + } + } catch (Exception e) { + listaErrores.add("PROBLEMA CON LA FECHA DE RECEPCI\u00d3N " + armasExcel.getFechaRecepcion()+ + ", EL FORMATO ES dd-MMM-yyyy EJ:(04-OCT-2017), DEL REGISTRO: "+armasExcel.getCont()); + } + } + } + LOG.info("ARMAS PROCESADAS 2: "+listArmas.size()); + } catch (Exception e) { + MessageHelper.setMessageError(e); + e.printStackTrace(); + } finally { + numArmasProcesadas=contador-1; + if (!listaErrores.isEmpty()) { + MessageHelper.setMessageError("ERRORES ENCONTRADOS DENTRO DEL ARCHIVO EXCEL: "); + mensajeError="ERROR EN LA CARGA DE ARMAS"; + numCorrectas=listArmas.size(); + listArmas.clear(); + }else{ + numCorrectas=listArmas.size(); + } + numArmasError =listaErrores.size(); + } + } + + private TarmArmas armarlistaArmasExcel(String longuitud, String calibre,String clase, String tipoArmaExplosivo, String marca, + String tipoFabricacion, int cont, String serie,String descripcionProvincia,String descripcionCanton) { + TarmArmas armaRegistro = null; + String longuitudCodigo = validarCatalogo(listLongitudes, longuitud); + if(longuitudCodigo==null || longuitudCodigo.isEmpty()){ + listaErrores.add("LA DESCRIPCI\u00d3N DE LA LONGUITUD: "+longuitud.toString()+" NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: "+ cont); + } + String calibreCodigo = validarCatalogo(listCalibres, calibre); + if(calibreCodigo==null || calibreCodigo.isEmpty()){ + listaErrores.add("LA DESCRIPCI\u00d3N DEL CALIBRE: "+calibre.toString()+" NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: "+ cont); + } + String claseCodigo = validarCatalogo(listClases, clase); + if(claseCodigo==null || claseCodigo.isEmpty()){ + listaErrores.add("LA DESCRIPCI\u00d3N DE LA CLASE: "+clase.toString()+" NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: "+ cont); + } + String tipoArmaExplosivoCodigo = validarCatalogo(listTipoArmaExplosivos, tipoArmaExplosivo); + if(tipoArmaExplosivoCodigo==null || tipoArmaExplosivoCodigo.isEmpty()){ + listaErrores.add("LA DESCRIPCI\u00d3N DEL TIPO ARMA EXPLOSIVO: "+tipoArmaExplosivo.toString()+" NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: "+ cont); + } + String unidadMedidaPesoCodigo = "UNIDAD"; + + String marcaCodigo = validarCatalogo(listMarcas, marca);// MARCA + if (marcaCodigo == null) { + listaErrores.add("LA MARCA DEL ARMA: "+marca.toString()+" NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: "+ cont); + } + String tipoFabricacionCodigo = validarCatalogo(listTipoFabricacion, tipoFabricacion);// TIPOFABRICACION + if (tipoFabricacionCodigo == null) { + listaErrores.add("EL TIPO DE FABRICACI\u00d3N: "+tipoFabricacion.toString()+" NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: "+ cont); + } + /*Ubicacion Provincia canton*/ + TgeneProvince province=null; + TgeneCanton canton=null; + //provincia + if(mapaProvincia.get("descripcionProvincia")!=null){ + province=(TgeneProvince)mapaProvincia.get(descripcionProvincia); + }else{ + ListlistProvincias=ProvinceController.findxDescripcion("EC", null, descripcionProvincia); + if(listProvincias!=null ){ + if(listProvincias.size()==1){ + province=listProvincias.get(0); + mapaProvincia.get("descripcionProvincia"); + }else{ + listaErrores.add(" EXISTE MAS DE UNA PROVINCIA: "+descripcionProvincia.toString()+" CON ESTA DESCRIPCI\u00d3N, DEL REGISTRO: "+ cont); + return null; + } + }else{ + listaErrores.add(" NO EXISTE LA PROVINCIA: "+descripcionProvincia.toString()+" EN EL CAT\u00c1LOGO, DEL REGISTRO: "+ cont); + return null; + } + } + //canton + if(mapaCanton.get(descripcionProvincia)!=null && province != null && province.getPk()!=null){ + canton=(TgeneCanton)mapaCanton.get(descripcionProvincia); + }else if(province != null && province.getPk()!=null){ + List listCantons= CantonController.find("EC", province.getPk().getProvincecode()); + if(listCantons!=null && listCantons.size()!=0){ + for (TgeneCanton item : listCantons) { + if(item.getDescription().trim().equals(descripcionCanton)){ + canton=item; + mapaCanton.put(descripcionProvincia,item); + break; + } + } + if(canton==null){ + listaErrores.add(" NO EXISTEN CANTONES ASOCIADOS CON LA PROVINCIA: "+descripcionProvincia.toString()+", DEL REGISTRO: "+ cont); + return null; + } + }else{ + listaErrores.add(" NO EXISTEN CANTONES ASOCIADOS CON LA PROVINCIA: "+descripcionProvincia.toString()+", DEL REGISTRO: "+ cont); + return null; + } + } + + if (marcaCodigo == null || tipoFabricacionCodigo == null || province==null || canton==null) { + return null; + } + + if (longuitudCodigo != null && calibreCodigo != null && claseCodigo != null && tipoArmaExplosivoCodigo != null) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo =null; + TipoArmaExplosivoPKExcel tipoArmaPk = validarTipoArma(longuitudCodigo, calibreCodigo, claseCodigo,tipoArmaExplosivoCodigo, unidadMedidaPesoCodigo); + if(tipoArmaPk!=null){ + tarmTipoArmaExplosivo=tipoArmaPk.getTipoArmaExplosivoClase(); + }else{ + tarmTipoArmaExplosivo = ImporteTipoArmaExplosivoController.findpk(longuitudCodigo, calibreCodigo, claseCodigo,tipoArmaExplosivoCodigo, unidadMedidaPesoCodigo); + if(tarmTipoArmaExplosivo!=null){ + tipoArmaPk = new TipoArmaExplosivoPKExcel(longuitudCodigo, calibreCodigo, claseCodigo,tipoArmaExplosivoCodigo, unidadMedidaPesoCodigo,tarmTipoArmaExplosivo); + listaTipoArmaExplosivoPk.add(tipoArmaPk); + } + } + if (tarmTipoArmaExplosivo != null) { + armaRegistro = new TarmArmas(); + armaRegistro.setMarca(marcaCodigo); + armaRegistro.setMarcacodigo("MARCA"); + armaRegistro.setTipofabricacion(tipoFabricacionCodigo); + armaRegistro.setTipofabricacioncodigo("TIPOFABRICACION"); + //armaRegistro.setColor(colorCodigo); + armaRegistro.setColorcodigo("COLOR"); + armaRegistro.setUnidadmedidacantidad("UNIDAD"); + armaRegistro.setUnidadmedidacantidadcodigo("UNIDADMEDIDA"); + armaRegistro.setEstado("INC"); + armaRegistro.setEstadocodigo("ESTADOARMA"); + armaRegistro.setCountrycode("EC"); + armaRegistro.setProvincecode(province.getPk().getProvincecode()); + armaRegistro.setCantoncode(canton.getPk().getCantoncode()); + //armaRegistro.setParroquiacode(""); + // armaRegistro.setCregistro(); + armaRegistro.setCitycode(""); + armaRegistro.setLote(serie); + armaRegistro.setCantidad(cantidad); + // armaRegistro.setSeriecanon(); + // armaRegistro.setDireccion(); + armaRegistro.setFecharegistro(new java.sql.Date(new Date().getTime())); + armaRegistro.setCtipoarmaexplosivo(tarmTipoArmaExplosivo.getPk()); + armaRegistro.setEstadoDecomiso("INC"); + } else { + listaErrores.add("LA COMBINACION DEL ARMA NO EXISTE EN EL REGISTRO: " + cont+ " "); + } + } + return armaRegistro; + } + + private TipoArmaExplosivoPKExcel validarTipoArma(String longitud, String calibre, + String clase, String tipoarmaexplosivo,String unidadmedidapeso){ + for (TipoArmaExplosivoPKExcel item : listaTipoArmaExplosivoPk) { + if(longitud.equals(item.getLongitud()) && + calibre.equals(item.getCalibre()) && + clase.equals(item.getClase()) && + tipoarmaexplosivo.equals(item.getTipoarmaexplosivo()) && + unidadmedidapeso.equals(item.getUnidadmedidapeso()) ){ + return item; + } + } + return null; + } + + public String validarCatalogo(List listCatalogo,String descripcion) { + String codigo = null; + for (TgeneCatalogDetail item : listCatalogo) { + if (item.getDescription().equals(descripcion)) { + codigo = item.getPk().getCatalog(); + break; + } + } + return codigo; + } + + /** + * Metodo que indica cuando una celda esta vacia + * @param celda + * @return + */ + private Boolean celdaVacia(Cell celda) { + Boolean vacia = false; + if (celda == null || celda.getCellType() == Cell.CELL_TYPE_BLANK|| + (celda.getCellType() == Cell.CELL_TYPE_STRING && celda.getStringCellValue().isEmpty())) { + vacia = true; + } + return vacia; + } + + @SuppressWarnings("finally") + private File generarArchivoError(Long key) { + if (listaErrores.isEmpty()) { + return null; + } + PrintWriter escribir = null; + File archivo = null; + try { + archivo = File.createTempFile("errorlog" + key, ".txt"); + escribir = new PrintWriter(archivo); + for (String err : listaErrores) { + escribir.print(err + "\r\n"); + } + limpiar(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + escribir.flush(); + escribir.close(); + return archivo; + } + } + + /** + * Llama a la construccion del metodo para recargar + */ + public void descargarArchivo() { + if(listaErrores!=null && listaErrores.size()>0){ + Long key = new Date().getTime(); + File archivoTemporal = generarArchivoError(key); + if (archivoTemporal == null) + return; + try { + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition","attachment; filename=errorlog" + key + ".txt"); + OutputStream out = response.getOutputStream(); + InputStream inputStream = new FileInputStream(archivoTemporal.getAbsolutePath()); + int read = 0; + byte[] bytes = new byte[1024]; + + while ((read = inputStream.read(bytes)) != -1) { + out.write(bytes, 0, read); + } + + inputStream.close(); + out.flush(); + FacesContext.getCurrentInstance().responseComplete(); + } catch (Exception e) { + } + }else{ + MessageHelper.setMessageError("NO TIENE ERRORES"); + } + } + + /** + * Limpia las los valores en las listas + */ + public void limpiar() { + try { + create(); + while (lrecord.iterator().hasNext()) { + record = lrecord.get(0); + remove(); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public String getCodigoCiudad() { + return codigoCiudad; + } + + public void setCodigoCiudad(String codigoCiudad) { + this.codigoCiudad = codigoCiudad; + } + + String codigoCiudad; + + public void codigoCiudad() { + } + + public void addPersoncodeFilter(String personcode) { + super.addFilter("pk.personcode", personcode); + } + + public List getListaErrores() { + return listaErrores; + } + + public void setListaErrores(List listaErrores) { + this.listaErrores = listaErrores; + } + + public RegistroArmController getRegistroArmasController() { + return registroArmasController; + } + + public void setRegistroArmasController( + RegistroArmController registroArmasController) { + this.registroArmasController = registroArmasController; + } + + public String getMensajeError() { + return mensajeError; + } + + public void setMensajeError(String mensajeError) { + this.mensajeError = mensajeError; + } + + public Integer getNumArmasProcesadas() { + return numArmasProcesadas; + } + + public void setNumArmasProcesadas(Integer numArmasProcesadas) { + this.numArmasProcesadas = numArmasProcesadas; + } + + public Integer getNumArmasError() { + return numArmasError; + } + + public void setNumArmasError(Integer numArmasError) { + this.numArmasError = numArmasError; + } + + public String getNumeroRecibo() { + return numeroRecibo; + } + + public void setNumeroRecibo(String numeroRecibo) { + this.numeroRecibo = numeroRecibo; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getCentroControlNombreLogeado() { + return centroControlNombreLogeado; + } + + public void setCentroControlNombreLogeado(String centroControlNombreLogeado) { + this.centroControlNombreLogeado = centroControlNombreLogeado; + } + + public DecomisoController getDecomisoController() { + return decomisoController; + } + + public void setDecomisoController(DecomisoController decomisoController) { + this.decomisoController = decomisoController; + } + + public DecomisoArmaController getDecomisoArmaController() { + return decomisoArmaController; + } + + public void setDecomisoArmaController( + DecomisoArmaController decomisoArmaController) { + this.decomisoArmaController = decomisoArmaController; + } + + public Integer getNumCorrectas() { + return numCorrectas; + } + + public void setNumCorrectas(Integer numCorrectas) { + this.numCorrectas = numCorrectas; + } + + public TarmDecomiso getTarmDecomiso() { + return tarmDecomiso; + } + + public void setTarmDecomiso(TarmDecomiso tarmDecomiso) { + this.tarmDecomiso = tarmDecomiso; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ImporteArmasExcelController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ImporteArmasExcelController.java.svn-base new file mode 100644 index 0000000..b54d88c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ImporteArmasExcelController.java.svn-base @@ -0,0 +1,760 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletResponse; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.jboss.logging.Logger; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.util.ArmasExcel; +import com.fp.frontend.controller.armas.parametros.util.TipoArmaExplosivoPKExcel; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ImporteArmasExcelController extends AbstractController { + + /* CATALOGOS */ + /* TIPO ARMA EXPLOSIVO */ + private List listLongitudes; + private List listCalibres; + private List listClases; + private List listTipoArmaExplosivos; + /* ADICONAL */ + private List listMarcas; + private List listTipoFabricacion; + + /** + * Variable para a;adir las armas que se van a Guardar + */ + private List listArmas; + /** + * registro del Arma Due;o de las armas + */ + private TarmRegistroArmas registroArma; + /** + * Variable para listar los errores al cargar el excel + */ + private List listaErrores; + /** + * Mensaje de error + */ + private String mensajeError; + /** + * numero de armas procesadas + */ + private Integer numArmasProcesadas; + /** + * numero de armas con error + */ + private Integer numArmasError; + /** + * numero de armas con error + */ + private Integer numCorrectas; +// /** +// * Centro de control Policoa Judicia 2/PN07 +// */ +// private TarmCentroControl centroControl; + + /** + * Detalle del usuario + */ + private TcustPersonDetail usuario; + + /** + * Nombre del centro de control logeado + */ + private String centroControlNombreLogeado; + /** + * Numero de registro + */ + private String numeroRecibo; + +// /*Constante centro control*/ +// private String nombreInstitucion; +// private String institucion; + /*Cedula del propietario*/ + private String cedulaPropietario; + /*cantidad de armas*/ + private Integer cantidad=1; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmasController; + + + private MapmapaProvincia; + private MapmapaCanton; + private SetlistaTipoArmaExplosivoPk; + + private final static Logger LOG = Logger.getLogger(ImporteArmasExcelController.class.getName()); + + public ImporteArmasExcelController() throws Exception { + super(TarmArmas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.record = new TarmArmas(); + this.beanalias = "ARMASIMPORTEEXCEL"; + listArmas = new ArrayList(); + registroArma = new TarmRegistroArmas(); + mapaProvincia=new HashMap(); + mapaCanton=new HashMap(); + listaTipoArmaExplosivoPk=new HashSet<>(); + cargaParametros(); + cargaCatalogos(); + cargaRegistroArma(); + cargaUsuarioLogeado(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void cargaParametros(){ +// nombreInstitucion=codigos("CODIGO.NOM.INSTIT.IMPORTE");//"PJ01" +// institucion=codigos("CODIGO.INSTITUCION.IMPORTE");//2 + /*Cedula del propietario*/ + cedulaPropietario=codigos("CEDULA.RUC.PROPIETARIO.ARMA");//"999999999"; + } + + /** + * Método para obtener los codigos + */ + private String codigos(String parametro){ + TgeneParameters tgeneParameters= ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + public void cargaCatalogos() { + /* TIPOARMAEXPLOSIVO */ + listLongitudes = CatalogDetailController.find("LONGITUD"); + listCalibres = CatalogDetailController.find("CALIBRE"); + listClases = CatalogDetailController.find("CLASE"); + listTipoArmaExplosivos = CatalogDetailController.find("TIPOARMAEXPLOSIVO"); + /* CATALOGO AD */ + listMarcas = CatalogDetailController.find("MARCA"); + listTipoFabricacion = CatalogDetailController.find("TIPOFABRICACION"); + //listColor = CatalogDetailController.find("COLOR"); + } + + public void cargaUsuarioLogeado(){ + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + centroControlNombreLogeado = tsafeUserDetail.getModifiedData().get("centrocontrol").toString(); + } + + public void cargaRegistroArma() { + TcustPersonDetail tcustPersonDetail = PersonDetailController.findByIdentification(cedulaPropietario); + registroArma.setPersoncode(tcustPersonDetail.getPk().getPersoncode()); + registroArma.setFcreacion(new java.sql.Date(new Date().getTime())); + registroArma.setTiporegistro("INCA"); + registroArma.setTiporegistrocodigo("TIPOREGISTRO"); + registroArma.setPaisorigen(""); + registroArma.setIsnew(true); + +// ListlistCentroControls= CentroControlArmasController.findxOrganismoUnidad(institucion,nombreInstitucion); +// if(listCentroControls!=null && listCentroControls.size()==1){ +// centroControl=listCentroControls.get(0); +// }else{ +// centroControl=null; +// mensajeError="NO TIENE REGISTRADO UN CENTRO DE CONTROL O TIENE REGISTRADO MAS DE UNO CON EL MISMO NOMBRE DE INSTITUCI\u00d3N Y NOMBRE INSTITUCI\u00d3N"; +// } + } + + /* + * (non-Javadoc) + * + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + + DtoQuery dto = super.getDtoQuery(true); + Filter filtrofecha = new Filter(); + filtrofecha + .setSql("t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) and t.estado !='DEST' and t.estado !='CDP'"); + dto.addFiltro(filtrofecha); + dto.setOrderby("pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + public void save() { + try { +// if(centroControl==null){ +// MessageHelper.setMessageError("NO TIENE CENTRO DE CONTROL REVISE EL CENTRO DE CONTROL"); +// return; +// } + if(listArmas==null || listArmas.size()==0 || listArmas.isEmpty()){ + MessageHelper.setMessageError("NO EXISTEN ARMAS CARGADAS "); + return; + } + HashMap msave = new HashMap(); + Request request = this.callerhelper.getRequest(); + // regstroArma + registroArmasController.clearAll(); + registroArmasController.setRecord(registroArma); + registroArmasController.update(); + DtoSave dtosaveregistroarma = registroArmasController.getDtoSave(true); + dtosaveregistroarma.setPosition(1); + msave.put(registroArmasController.getBeanalias(),dtosaveregistroarma); + + // cargar Armas + this.clearAll(); + cargarArmas(); + DtoSave dtosave = super.getDtoSave(true); + dtosave.setPosition(2); + msave.put(this.beanalias, dtosave); + + request.setSaveTables(msave); + + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + mensajeError=null; + MessageHelper.setMessageInfo(resp); + listArmas.clear(); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + public void cargarArmas() throws Exception { + for (TarmArmas item : listArmas) { + item.setEstadoDecomiso(numeroRecibo); + this.record = item; + record.setIsnew(true); + super.update(); + } + } + + /** + * Metodo que carga y valida el contenido de un archivo excel con + * información de armas + * + * @param event + */ + public void cargarArchivo(FileUploadEvent event) { + listArmas = new ArrayList(); + listaErrores = new ArrayList(); + int contador = 0; + try { + UploadedFile selectedFile = event.getFile(); + InputStream archivo = selectedFile.getInputstream(); + XSSFWorkbook libro = new XSSFWorkbook(archivo); + XSSFSheet hoja = libro.getSheetAt(0); + // Iterando sobre las filas + Iterator rowIterator = hoja.iterator(); + ListlistaArmasExcel = new ArrayList(); + // Cargando el contenido de las celdas a una lista de objetos + while (rowIterator.hasNext()) { + Row row = rowIterator.next(); + if(contador!=0){ + Cell orden = row.getCell(0); + Cell longuitud = row.getCell(14); + Cell calibre = row.getCell(5); + Cell clase = row.getCell(1);//material + Cell tipoArmaExplosivo = row.getCell(2);// modelo: REVOLVER CARTUCHERA CARTUCHERANO CARABINA SUB-AMETRALLADORA*revisar + Cell marca = row.getCell(3); + Cell tipoFabricacion = row.getCell(7); + Cell serie = row.getCell(4); + Cell fechaRecepcion = row.getCell(9); + Cell motivo = row.getCell(10); + Cell descripcionProvincia= row.getCell(12); + Cell descripcionCanton= row.getCell(13); + Cell observaciones= row.getCell(15); + if (!this.celdaVacia(orden) + && !this.celdaVacia(longuitud) + && !this.celdaVacia(calibre) + && !this.celdaVacia(clase) + && !this.celdaVacia(tipoArmaExplosivo) + && !this.celdaVacia(marca) + && !this.celdaVacia(tipoFabricacion) + && !this.celdaVacia(serie) + //&& !this.celdaVacia(fechaRecepcion) + // && !this.celdaVacia(motivo) + && !this.celdaVacia(descripcionProvincia) + && !this.celdaVacia(descripcionCanton) + //&& !this.celdaVacia(observaciones) + ) { + + ArmasExcel armasExcel = new ArmasExcel(orden.toString().trim(),longuitud.toString().trim(),calibre.toString().trim(), + clase.toString().trim(),tipoArmaExplosivo.toString().trim(),marca.toString().trim(), + tipoFabricacion.toString().trim(),serie.toString().trim(),null, + null,descripcionProvincia.toString().trim(),descripcionCanton.toString().trim(), + null,contador); + listaArmasExcel.add(armasExcel); + LOG.info("CONTADOR........"+contador); + } else { + listaErrores.add("EL REGISTRO TIENE CAMPOS EN BLANCO, REGISTRO: " + contador); + } + contador++; + }else{ + contador++; + } + } + archivo.close(); + + LOG.info("NUMERO REGISTROS........."+listaArmasExcel.size()); + LOG.info("Procesar armas adjuntas"); + MapmapaSerie=new HashMap(); + int auxi=0; + for (ArmasExcel armasExcel : listaArmasExcel) { + LOG.info("CONTADOR 2: "+auxi++); + TarmArmas arma = armarlistaArmasExcel(armasExcel.getLonguitud(),armasExcel.getCalibre(),armasExcel.getClase(), + armasExcel.getTipoArmaExplosivo(),armasExcel.getMarca(),armasExcel.getTipoFabricacion(), + armasExcel.getCont(), armasExcel.getSerie(),armasExcel.getDescripcionProvincia(),armasExcel.getDescripcionCanton()); + if (arma != null) { +// arma.getModifiedData().put("motivo", armasExcel.getMotivo()); +// arma.getModifiedData().put("observaciondecomiso", armasExcel.getObservaciones()); + arma.getModifiedData().put("cantidad",cantidad); +// arma.getModifiedData().put("motivocatalogocode","MOTIVODECOMISO"); +// arma.getModifiedData().put("motivocatalogo",motivocatalogo);//entrega voluntaria + //validar si la serie es repetida + if(mapaSerie.get(armasExcel.getSerie())!=null){ + listaErrores.add("SERIE DUPLICADA" + armasExcel.getSerie()+ " DEL REGISTRO: "+armasExcel.getCont()); + continue; + }else{ + mapaSerie.put(armasExcel.getSerie(),armasExcel.getSerie()); + } + + //ANIADE EL ARMA + listArmas.add(arma); + } + } + LOG.info("ARMAS PROCESADAS 2: "+listArmas.size()); + } catch (Exception e) { + MessageHelper.setMessageError(e); + e.printStackTrace(); + } finally { + numArmasProcesadas=contador-1; + if (!listaErrores.isEmpty()) { + MessageHelper.setMessageError("ERRORES ENCONTRADOS DENTRO DEL ARCHIVO EXCEL: "); + mensajeError="ERROR EN LA CARGA DE ARMAS"; + numCorrectas=listArmas.size(); + listArmas.clear(); + }else{ + numCorrectas=listArmas.size(); + } + numArmasError =listaErrores.size(); + } + } + + private TarmArmas armarlistaArmasExcel(String longuitud, String calibre,String clase, String tipoArmaExplosivo, String marca, + String tipoFabricacion, int cont, String serie,String descripcionProvincia,String descripcionCanton) { + TarmArmas armaRegistro = null; + String longuitudCodigo = validarCatalogo(listLongitudes, longuitud); + if(longuitudCodigo==null || longuitudCodigo.isEmpty()){ + listaErrores.add("LA DESCRIPCI\u00d3N DE LA LONGUITUD: "+longuitud.toString()+" NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: "+ cont); + } + String calibreCodigo = validarCatalogo(listCalibres, calibre); + if(calibreCodigo==null || calibreCodigo.isEmpty()){ + listaErrores.add("LA DESCRIPCI\u00d3N DEL CALIBRE: "+calibre.toString()+" NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: "+ cont); + } + String claseCodigo = validarCatalogo(listClases, clase); + if(claseCodigo==null || claseCodigo.isEmpty()){ + listaErrores.add("LA DESCRIPCI\u00d3N DE LA CLASE: "+clase.toString()+" NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: "+ cont); + } + String tipoArmaExplosivoCodigo = validarCatalogo(listTipoArmaExplosivos, tipoArmaExplosivo); + if(tipoArmaExplosivoCodigo==null || tipoArmaExplosivoCodigo.isEmpty()){ + listaErrores.add("LA DESCRIPCI\u00d3N DEL TIPO ARMA EXPLOSIVO: "+tipoArmaExplosivo.toString()+" NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: "+ cont); + } + String unidadMedidaPesoCodigo = "UNIDAD"; + + String marcaCodigo = validarCatalogo(listMarcas, marca);// MARCA + if (marcaCodigo == null) { + listaErrores.add("LA MARCA DEL ARMA: "+marca.toString()+" NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: "+ cont); + } + String tipoFabricacionCodigo = validarCatalogo(listTipoFabricacion, tipoFabricacion);// TIPOFABRICACION + if (tipoFabricacionCodigo == null) { + listaErrores.add("EL TIPO DE FABRICACI\u00d3N: "+tipoFabricacion.toString()+" NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: "+ cont); + } + /*Ubicacion Provincia canton*/ + TgeneProvince province=null; + TgeneCanton canton=null; + //provincia + if(mapaProvincia.get("descripcionProvincia")!=null){ + province=(TgeneProvince)mapaProvincia.get(descripcionProvincia); + }else{ + ListlistProvincias=ProvinceController.findxDescripcion("EC", null, descripcionProvincia); + if(listProvincias!=null ){ + if(listProvincias.size()==1){ + province=listProvincias.get(0); + mapaProvincia.get("descripcionProvincia"); + }else{ + listaErrores.add(" EXISTE MAS DE UNA PROVINCIA: "+descripcionProvincia.toString()+" CON ESTA DESCRIPCI\u00d3N, DEL REGISTRO: "+ cont); + return null; + } + }else{ + listaErrores.add(" NO EXISTE LA PROVINCIA: "+descripcionProvincia.toString()+" EN EL CAT\u00c1LOGO, DEL REGISTRO: "+ cont); + return null; + } + } + //canton + if(mapaCanton.get(descripcionProvincia)!=null && province != null && province.getPk()!=null){ + canton=(TgeneCanton)mapaCanton.get(descripcionProvincia); + }else if(province != null && province.getPk()!=null){ + List listCantons= CantonController.find("EC", province.getPk().getProvincecode()); + if(listCantons!=null && listCantons.size()!=0){ + for (TgeneCanton item : listCantons) { + if(item.getDescription().trim().equals(descripcionCanton)){ + canton=item; + mapaCanton.put(descripcionProvincia,item); + break; + } + } + if(canton==null){ + listaErrores.add(" NO EXISTEN CANTONES ASOCIADOS CON LA PROVINCIA: "+descripcionProvincia.toString()+", DEL REGISTRO: "+ cont); + return null; + } + }else{ + listaErrores.add(" NO EXISTEN CANTONES ASOCIADOS CON LA PROVINCIA: "+descripcionProvincia.toString()+", DEL REGISTRO: "+ cont); + return null; + } + } + + if (marcaCodigo == null || tipoFabricacionCodigo == null || province==null || canton==null) { + return null; + } + + if (longuitudCodigo != null && calibreCodigo != null && claseCodigo != null && tipoArmaExplosivoCodigo != null) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo =null; + TipoArmaExplosivoPKExcel tipoArmaPk = validarTipoArma(longuitudCodigo, calibreCodigo, claseCodigo,tipoArmaExplosivoCodigo, unidadMedidaPesoCodigo); + if(tipoArmaPk!=null){ + tarmTipoArmaExplosivo=tipoArmaPk.getTipoArmaExplosivoClase(); + }else{ + tarmTipoArmaExplosivo = ImporteTipoArmaExplosivoController.findpk(longuitudCodigo, calibreCodigo, claseCodigo,tipoArmaExplosivoCodigo, unidadMedidaPesoCodigo); + if(tarmTipoArmaExplosivo!=null){ + tipoArmaPk = new TipoArmaExplosivoPKExcel(longuitudCodigo, calibreCodigo, claseCodigo,tipoArmaExplosivoCodigo, unidadMedidaPesoCodigo,tarmTipoArmaExplosivo); + listaTipoArmaExplosivoPk.add(tipoArmaPk); + } + } + if (tarmTipoArmaExplosivo != null) { + armaRegistro = new TarmArmas(); + armaRegistro.setMarca(marcaCodigo); + armaRegistro.setMarcacodigo("MARCA"); + armaRegistro.setTipofabricacion(tipoFabricacionCodigo); + armaRegistro.setTipofabricacioncodigo("TIPOFABRICACION"); + //armaRegistro.setColor(colorCodigo); + armaRegistro.setColorcodigo("COLOR"); + armaRegistro.setUnidadmedidacantidad("UNIDAD"); + armaRegistro.setUnidadmedidacantidadcodigo("UNIDADMEDIDA"); + armaRegistro.setEstado("REG"); + armaRegistro.setEstadocodigo("ESTADOARMA"); + armaRegistro.setCountrycode("EC"); + armaRegistro.setProvincecode(province.getPk().getProvincecode()); + armaRegistro.setCantoncode(canton.getPk().getCantoncode()); + //armaRegistro.setParroquiacode(""); + // armaRegistro.setCregistro(); + armaRegistro.setCitycode(""); + armaRegistro.setLote(serie); + armaRegistro.setCantidad(cantidad); + // armaRegistro.setSeriecanon(); + // armaRegistro.setDireccion(); + armaRegistro.setFecharegistro(new java.sql.Date(new Date().getTime())); + armaRegistro.setCtipoarmaexplosivo(tarmTipoArmaExplosivo.getPk()); + //armaRegistro.setEstadoDecomiso("INC"); + } else { + listaErrores.add("LA COMBINACION DEL ARMA NO EXISTE EN EL REGISTRO: " + cont+ " "); + } + } + return armaRegistro; + } + + private TipoArmaExplosivoPKExcel validarTipoArma(String longitud, String calibre, + String clase, String tipoarmaexplosivo,String unidadmedidapeso){ + for (TipoArmaExplosivoPKExcel item : listaTipoArmaExplosivoPk) { + if(longitud.equals(item.getLongitud()) && + calibre.equals(item.getCalibre()) && + clase.equals(item.getClase()) && + tipoarmaexplosivo.equals(item.getTipoarmaexplosivo()) && + unidadmedidapeso.equals(item.getUnidadmedidapeso()) ){ + return item; + } + } + return null; + } + + public String validarCatalogo(List listCatalogo,String descripcion) { + String codigo = null; + for (TgeneCatalogDetail item : listCatalogo) { + if (item.getDescription().equals(descripcion)) { + codigo = item.getPk().getCatalog(); + break; + } + } + return codigo; + } + + /** + * Metodo que indica cuando una celda esta vacia + * @param celda + * @return + */ + private Boolean celdaVacia(Cell celda) { + Boolean vacia = false; + if (celda == null || celda.getCellType() == Cell.CELL_TYPE_BLANK|| + (celda.getCellType() == Cell.CELL_TYPE_STRING && celda.getStringCellValue().isEmpty())) { + vacia = true; + } + return vacia; + } + + @SuppressWarnings("finally") + private File generarArchivoError(Long key) { + if (listaErrores.isEmpty()) { + return null; + } + PrintWriter escribir = null; + File archivo = null; + try { + archivo = File.createTempFile("errorlog" + key, ".txt"); + escribir = new PrintWriter(archivo); + for (String err : listaErrores) { + escribir.print(err + "\r\n"); + } + limpiar(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + escribir.flush(); + escribir.close(); + return archivo; + } + } + + /** + * Llama a la construccion del metodo para recargar + */ + public void descargarArchivo() { + if(listaErrores!=null && listaErrores.size()>0){ + Long key = new Date().getTime(); + File archivoTemporal = generarArchivoError(key); + if (archivoTemporal == null) + return; + try { + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition","attachment; filename=errorlog" + key + ".txt"); + OutputStream out = response.getOutputStream(); + InputStream inputStream = new FileInputStream(archivoTemporal.getAbsolutePath()); + int read = 0; + byte[] bytes = new byte[1024]; + + while ((read = inputStream.read(bytes)) != -1) { + out.write(bytes, 0, read); + } + + inputStream.close(); + out.flush(); + FacesContext.getCurrentInstance().responseComplete(); + } catch (Exception e) { + } + }else{ + MessageHelper.setMessageError("NO TIENE ERRORES"); + } + } + + /** + * Limpia las los valores en las listas + */ + public void limpiar() { + try { + create(); + while (lrecord.iterator().hasNext()) { + record = lrecord.get(0); + remove(); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public String getCodigoCiudad() { + return codigoCiudad; + } + + public void setCodigoCiudad(String codigoCiudad) { + this.codigoCiudad = codigoCiudad; + } + + String codigoCiudad; + + public void codigoCiudad() { + } + + public void addPersoncodeFilter(String personcode) { + super.addFilter("pk.personcode", personcode); + } + + public List getListaErrores() { + return listaErrores; + } + + public void setListaErrores(List listaErrores) { + this.listaErrores = listaErrores; + } + + public RegistroArmController getRegistroArmasController() { + return registroArmasController; + } + + public void setRegistroArmasController( + RegistroArmController registroArmasController) { + this.registroArmasController = registroArmasController; + } + + public String getMensajeError() { + return mensajeError; + } + + public void setMensajeError(String mensajeError) { + this.mensajeError = mensajeError; + } + + public Integer getNumArmasProcesadas() { + return numArmasProcesadas; + } + + public void setNumArmasProcesadas(Integer numArmasProcesadas) { + this.numArmasProcesadas = numArmasProcesadas; + } + + public Integer getNumArmasError() { + return numArmasError; + } + + public void setNumArmasError(Integer numArmasError) { + this.numArmasError = numArmasError; + } + + public String getNumeroRecibo() { + return numeroRecibo; + } + + public void setNumeroRecibo(String numeroRecibo) { + this.numeroRecibo = numeroRecibo; + } + +// public TarmCentroControl getCentroControl() { +// return centroControl; +// } +// +// public void setCentroControl(TarmCentroControl centroControl) { +// this.centroControl = centroControl; +// } + + public String getCentroControlNombreLogeado() { + return centroControlNombreLogeado; + } + + public void setCentroControlNombreLogeado(String centroControlNombreLogeado) { + this.centroControlNombreLogeado = centroControlNombreLogeado; + } + + public Integer getNumCorrectas() { + return numCorrectas; + } + + public void setNumCorrectas(Integer numCorrectas) { + this.numCorrectas = numCorrectas; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ImporteTipoArmaExplosivoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ImporteTipoArmaExplosivoController.java.svn-base new file mode 100644 index 0000000..a199bf9 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/ImporteTipoArmaExplosivoController.java.svn-base @@ -0,0 +1,115 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; + + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ImporteTipoArmaExplosivoController extends + AbstractController { + + + public ImporteTipoArmaExplosivoController() throws Exception { + super(TarmTipoArmaExplosivo.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "IMPORTETIPOARMAEXPLOSIVO"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + + /** + * Find para encontrar el pk mediante las caracteristicas. + */ + public static TarmTipoArmaExplosivo findpk(String longitud, String calibre, + String clase, String tipoarmaexplosivo,String unidadmedidapeso) { + try { + ImporteTipoArmaExplosivoController cc = new ImporteTipoArmaExplosivoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("longitud", longitud); + cc.addFilter("calibre", calibre); + cc.addFilter("clase", clase); + cc.addFilter("tipoarmaexplosivo", tipoarmaexplosivo); + cc.addFilter("unidadmedidapeso", unidadmedidapeso); + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/IngresoDatosTipoTramite.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/IngresoDatosTipoTramite.java.svn-base new file mode 100644 index 0000000..a920332 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/IngresoDatosTipoTramite.java.svn-base @@ -0,0 +1,892 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class IngresoDatosTipoTramite extends AbstractController { + + /** + * Variable auxiliar para bloquerar los campos al crear o editar + */ + private String editarReg; + /** + * Variables de tipo boolean para selecionar si registroGuardia + */ + private boolean registroGuardia; + /** + * Variables de tipo boolean para selecionar si tiene logo + */ + private boolean logo; + /** + * Variables de tipo boolean para selecionar si registroArmas + */ + private boolean registroArmas; + /** + * Variables de tipo boolean para selecionar si registroAgenciasSucursales + */ + private boolean registroAgenciasSucursales; + /** + * Variables de tipo boolean para selecionar si requiereEvaluacion + */ + private boolean requiereEvaluacion; + /** + * Variables de tipo boolean para selecionar si requiereInspeccion + */ + private boolean requiereInspeccion; + /** + * Variables de tipo boolean para selecionar documentosHabilitantes + */ + private boolean documentosHabilitantes; + /** + * Variables de tipo boolean para selecionar reimpresion + */ + private boolean reimpresion; + /** + * Variables de tipo boolean para selecionar si la transaccion es sancionable + */ + private boolean sancionable; + /** + * Valida caducidad tramite padre + */ + private boolean caducidadTramitePadreBln; + /** + * Valida caducidad tramite padre alterno + */ + private boolean caducidadTramitePadreAltBln; + /** + * Valida si visualiza la fecha de expiracion + */ + private boolean visualizaFechaExpiracionBln; + /** + * Variables de tipo boolean para selecionar si requiereJurisdiccion + */ + private boolean requiereJurisdiccion; + /** + * Catalogo de tipos de tramites + */ + private List ltipoTramite; + /** + * Catalogo de Autorizacion + */ + private List ltipoAutorizacion; + /** + * Catalogo de categoria + */ + private List lcategoria; + /** + * Catalogo de tipos de Uso actividad + */ + private List lusoActividad; + /** + * Catalogo de tipos de Costo + */ + private List ltipoCosto; + /** + * Catalogo de Vigencia de meses + */ + private List lvigenciaMeses; + /** + * Catalogo de tipos de archivo + */ + private List ltipoArchivo; + /** + * Catalogo de tipos de caminos para el flujo + */ + private List lflujoTramite; + /** + * Catalogo de tipos de archivo + */ + private List lestadosarma; + /** + * Catalogo de tipos de fabricacion + */ + private List ltipofabricacionarma; + /** + * Catalogo de tipos de archivo + */ + private List ltipoPersona; + /** + * Catalogo de tipos de archivo + */ + private List ljurisdiccion; + /** + * Arreglo de los estados seleccionados + */ + private String[] selectedEstados; + /** + * Arreglo de los tipos de fabricacion seleccionados + */ + private String[] selectedTipoFabric; + + private String descripcionTrmitePadre; + + private String descripcionTrmitePadreAlt; + + public IngresoDatosTipoTramite() throws Exception { + super(TarmTramite.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TRAMITE"; + //CARGA DE CATALOGOS + ltipoTramite=CatalogDetailController.find("TIPOTRAMITE"); + ltipoAutorizacion=CatalogDetailController.find("TIPOAUTORIZACION"); + lcategoria=CatalogDetailController.find("CATEGORIA"); + lusoActividad=CatalogDetailController.find("USOACTIVIDAD"); + ltipoCosto=CatalogDetailController.find("TIPOCOSTO"); + lvigenciaMeses=CatalogDetailController.find("VIGENCIAMESES"); + //ordena la lista lvigenciaMeses + Collections.sort(lvigenciaMeses, new Comparator() { + public int compare(TgeneCatalogDetail p1, TgeneCatalogDetail p2) { + return new Integer(p1.getDescription()).compareTo(new Integer(p2.getDescription())); + } + }); + + ltipoArchivo=CatalogDetailController.find("TIPOARCHIVO"); + lflujoTramite=CatalogDetailController.find("FLUJOTRAMITE"); + lestadosarma=CatalogDetailController.find("ESTADOARMA"); + setLtipofabricacionarma(CatalogDetailController.find("TIPOFABRICACION")); + ltipoPersona=CatalogDetailController.find("PERSONTYPE"); + ljurisdiccion=CatalogDetailController.find("JURISDICCION"); + Collections.swap(ljurisdiccion, 0, 2); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + SubQuery stipoTramite= new SubQuery + ("TgeneCatalogDetail", "description", "destipoTramite", "i.pk.catalog = t.tipotramite and i.pk.catalogcode=t.tipotramitecodigo"); + SubQuery stipoAutorizacion= new SubQuery + ("TgeneCatalogDetail", "description", "destipoAutorizacion", "i.pk.catalog = t.tipoautorizacion and i.pk.catalogcode=t.tipoautorizacioncodigo"); + SubQuery scategoria= new SubQuery + ("TgeneCatalogDetail", "description", "descategoria", "i.pk.catalog = t.categoria and i.pk.catalogcode=t.categoriacodigo"); + SubQuery susoactividad= new SubQuery + ("TgeneCatalogDetail", "description", "desusoactividad", "i.pk.catalog = t.usoactividad and i.pk.catalogcode=t.usoactividadcodigo"); + SubQuery stipocosto= new SubQuery + ("TgeneCatalogDetail", "description", "destipocosto", "i.pk.catalog = t.tipocosto and i.pk.catalogcode=t.tipocostocodigo"); + SubQuery svigencia= new SubQuery + ("TgeneCatalogDetail", "description", "desvigencia", "i.pk.catalog = t.vigencia and i.pk.catalogcode=t.vigenciacodigo"); + SubQuery stipoarchivo= new SubQuery + ("TgeneCatalogDetail", "description", "destipoarchivo", "i.pk.catalog = t.tipoarchivo and i.pk.catalogcode=t.tipoarchivocodigo"); + SubQuery sjurisdiccion= new SubQuery + ("TgeneCatalogDetail", "description", "desjurisdiccion", "i.pk.catalog = t.jurisdiccion and i.pk.catalogcode=t.jurisdiccioncode"); + dto.addSubQuery(stipoTramite); + dto.addSubQuery(stipoAutorizacion); + dto.addSubQuery(scategoria); + dto.addSubQuery(susoactividad); + dto.addSubQuery(stipocosto); + dto.addSubQuery(svigencia); + dto.addSubQuery(stipoarchivo); + dto.addSubQuery(sjurisdiccion); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + if(!dtosave.pendingProcess()){ + return; + } + + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para cargar las variables para editar + */ + public void loadEdit() { + System.out.println("cargar"); + editarReg="SI"; + registroGuardia = ((record.getRegistroguardia() != null) && record.getRegistroguardia().equals("Y") ? true : false); + registroArmas = ((record.getRegistroarmas() != null) && record.getRegistroarmas().equals("Y") ? true : false); + registroAgenciasSucursales = ((record.getRegistroagenciasucursal() != null) && record.getRegistroagenciasucursal().equals("Y") ? true : false); + requiereEvaluacion = ((record.getRequiereevaluacion() != null) && record.getRequiereevaluacion().equals("Y") ? true : false); + requiereInspeccion = ((record.getRequiereinspeccion()!= null) && record.getRequiereinspeccion().equals("Y") ? true : false); + documentosHabilitantes = ((record.getDocumentohabilitante() != null) && record.getDocumentohabilitante().equals("Y") ? true : false); + reimpresion=((record.getReimpresion() != null) && record.getReimpresion().equals("Y") ? true : false); + logo=((record.getLogo()!= null) && record.getLogo().equals("Y") ? true : false); + sancionable=((record.getSancionable()!= null) && record.getSancionable().equals("Y") ? true : false); + caducidadTramitePadreBln =((record.getValidacaducidadpadre()!= null) && record.getValidacaducidadpadre().equals("Y") ? true : false); + caducidadTramitePadreAltBln=((record.getValidacaducidadpadrealt()!= null) && record.getValidacaducidadpadrealt().equals("Y") ? true : false); + visualizaFechaExpiracionBln=((record.getValidaFechaExpiracion()!= null) && record.getValidaFechaExpiracion().equals("Y") ? true : false); + requiereJurisdiccion = ((record.getTipoautorizacion()!= null) && record.getTipoautorizacion().equals("6") ? true : false); + + if(record.getEstados()!=null){ + selectedEstados = record.getEstados().split(","); + }else{ + selectedEstados=null; + } + + if(record.getTipofabricacion()!=null){ + selectedTipoFabric = record.getTipofabricacion().split(","); + + }else{ + selectedTipoFabric=null; + } + + if(record.getCtramitepadre()!=null){ + TarmTramite tarmTramite= find(record.getCtramitepadre().toString()); + descripcionTrmitePadre=tarmTramite.getPk().toString()+": "+tarmTramite.getModifiedData().get("destipoTramite")+" "+ + tarmTramite.getModifiedData().get("destipoAutorizacion")+" "+tarmTramite.getModifiedData().get("descategoria")+" "+ + tarmTramite.getModifiedData().get("desusoactividad"); + }else{ + descripcionTrmitePadre=null; + } + if(record.getCtramitepadrealt()!=null){ + TarmTramite tarmTramite= find(record.getCtramitepadrealt().toString()); + descripcionTrmitePadreAlt=tarmTramite.getPk().toString()+": "+tarmTramite.getModifiedData().get("destipoTramite")+" "+ + tarmTramite.getModifiedData().get("destipoAutorizacion")+" "+tarmTramite.getModifiedData().get("descategoria")+" "+ + tarmTramite.getModifiedData().get("desusoactividad"); + }else{ + descripcionTrmitePadreAlt=null; + } + } + + @Override + public void create() throws Exception{ + System.out.println("create"); + editarReg=null; + + super.create(); + registroGuardia=Boolean.FALSE; + registroArmas=Boolean.FALSE; + registroAgenciasSucursales=Boolean.FALSE; + requiereEvaluacion=Boolean.FALSE; + requiereInspeccion=Boolean.FALSE; + documentosHabilitantes=Boolean.FALSE; + reimpresion=Boolean.FALSE; + logo=Boolean.FALSE; + sancionable=Boolean.FALSE; + selectedEstados=null; + setSelectedTipoFabric(null); + descripcionTrmitePadre=null; + descripcionTrmitePadreAlt=null; + caducidadTramitePadreBln=Boolean.FALSE; + caducidadTramitePadreAltBln=Boolean.FALSE; + visualizaFechaExpiracionBln=Boolean.TRUE; + requiereJurisdiccion=Boolean.FALSE; + + } + + @Override + public void update() throws Exception { + this.record.setTipotramitecodigo("TIPOTRAMITE"); + this.record.setTipoautorizacioncodigo("TIPOAUTORIZACION"); + this.record.setCategoriacodigo("CATEGORIA"); + this.record.setUsoactividadcodigo("USOACTIVIDAD"); + this.record.setTipocostocodigo("TIPOCOSTO"); + this.record.setVigenciacodigo("VIGENCIAMESES"); + this.record.setTipoarchivocodigo("TIPOARCHIVO"); + this.record.setFlujotramitecode("FLUJOTRAMITE"); + this.record.setTipopersonacode("PERSONTYPE"); + this.record.setJurisdiccioncode("JURISDICCION"); + + //validaciones para la vista + if(editarReg==null || !editarReg.equals("SI")){ + catalogos(ltipoTramite, record.getTipotramite(), "destipoTramite"); + catalogos(ltipoAutorizacion, record.getTipoautorizacion(), "destipoAutorizacion"); + catalogos(lcategoria, record.getCategoria(), "descategoria"); + catalogos(lusoActividad, record.getUsoactividad(), "desusoactividad"); + } + catalogos(ltipoCosto, record.getTipocosto(), "destipocosto"); + catalogos(lvigenciaMeses, record.getVigencia(), "desvigencia"); + catalogos(ltipoArchivo, record.getTipoarchivo(), "destipoarchivo"); + if(record.getJurisdiccion() == null || record.getJurisdiccion().equals("")){ + record.setJurisdiccion("JURECU"); + } + catalogos(ljurisdiccion, record.getJurisdiccion(), "desjurisdiccion"); + + onChangeRegistroArmas(); + onChangeRegistroGuardia(); + onChangeRegistroAgenciaSucursal(); + onChangeRequiereEvaluacion(); + onChangeRequiereInspeccion(); + onChangeDocumentosHabilitantes(); + onChangeReimpresion(); + onChangeLogo(); + onChangeSancionable(); + onChangeCaducidadTramPadre(); + onChangeCaducidadTramPadreAlt(); + + //recorre la lsita de estado + this.record.setEstados(null); + for(String estado:selectedEstados){ + if(this.record.getEstados()==null || this.record.getEstados().trim().length()==0){ + this.record.setEstados(estado); + } + this.record.setEstados(record.getEstados()+","+estado); + } + //recorre la lsita de tipoFabricacion + this.record.setTipofabricacion(null); + for(String tipoFac:selectedTipoFabric){ + if(this.record.getTipofabricacion()==null || this.record.getTipofabricacion().trim().length()==0){ + this.record.setTipofabricacion(tipoFac); + } + this.record.setTipofabricacion(record.getTipofabricacion()+","+tipoFac); + } + + if(record.getNumeromaxarmas()!=null && record.getNumeromaxarmas()==0l){ + record.setNumeromaxarmas(null); + } + super.update(); + } + + /** + * Metodo para recorreer los combos y setear las descripciones de lo q se escoge + * para la vista + * @param list + * @param codigo + * @param pk + */ + public void catalogos(Listlist, String codigo,String pk){ + for(TgeneCatalogDetail item:list){ + if(codigo.equals(item.getPk().getCatalog())){ + record.modifiedData.put(pk, item.getDescription()); + break; + } + } + } + + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeRegistroArmas() { + if (registroArmas) { + record.setRegistroarmas("Y"); + } else { + record.setRegistroarmas("N"); + } + } + + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeRegistroGuardia() { + if (registroGuardia) { + record.setRegistroguardia("Y"); + } else { + record.setRegistroguardia("N"); + } + } + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeRegistroAgenciaSucursal() { + if (registroAgenciasSucursales) { + record.setRegistroagenciasucursal("Y"); + } else { + record.setRegistroagenciasucursal("N"); + } + } + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeRequiereEvaluacion() { + if (requiereEvaluacion) { + record.setRequiereevaluacion("Y"); + } else { + record.setRequiereevaluacion("N"); + } + } + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeRequiereInspeccion() { + if (requiereInspeccion) { + record.setRequiereinspeccion("Y"); + } else { + record.setRequiereinspeccion("N"); + } + } + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeDocumentosHabilitantes() { + if (documentosHabilitantes) { + record.setDocumentohabilitante("Y"); + } else { + record.setDocumentohabilitante("N"); + } + } + + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeReimpresion() { + if (reimpresion) { + record.setReimpresion("Y"); + } else { + record.setReimpresion("N"); + } + } + + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeLogo() { + if (logo) { + record.setLogo("Y"); + } else { + record.setLogo("N"); + } + } + + /** + * Método para manejar el evento change en el CheckBox sancionable + */ + public void onChangeCaducidadTramPadre() { + if (caducidadTramitePadreBln) { + record.setValidacaducidadpadre("Y"); + } else { + record.setValidacaducidadpadre("N"); + } + } + + public void onChangeCaducidadTramPadreAlt() { + if (caducidadTramitePadreAltBln) { + record.setValidacaducidadpadrealt("Y"); + } else { + record.setValidacaducidadpadrealt("N"); + } + } + + public void onChangeVisualizaFechaExpiracion() { + if (visualizaFechaExpiracionBln) { + record.setValidaFechaExpiracion("Y"); + record.setVisualizarPorFechaExpiracion(""); + } else { + record.setValidaFechaExpiracion("N"); + if(record.getVisualizarPorFechaExpiracion()==null || record.getVisualizarPorFechaExpiracion().isEmpty()){ + record.setVisualizarPorFechaExpiracion("AL CANJEAR ARMA"); + } + + } + } + + /** + * Método para manejar el evento change en el CheckBox sancionable + */ + public void onChangeSancionable() { + if (sancionable) { + record.setSancionable("Y"); + } else { + record.setSancionable("N"); + } + } + + /** + * Método para manejar el render en el ComboBox jurisdiccion + */ + public void onChangeJurisdiccion() { + requiereJurisdiccion = ((record.getTipoautorizacion()!= null) && record.getTipoautorizacion().equals("6") ? true : false); + } + + public static TarmTramite find(String ctramite) { + try { + IngresoDatosTipoTramite cc = new IngresoDatosTipoTramite(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", ctramite); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List find(String tipoTramite,String tipoAutorizacion, String categria, String usoActividad) { + try { + IngresoDatosTipoTramite cc = new IngresoDatosTipoTramite(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("tipotramite", tipoTramite); + cc.addFilter("tipoautorizacion", tipoTramite); + cc.addFilter("categoria", tipoTramite); + cc.addFilter("usoActividad", tipoTramite); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Abre el LOV de la clase del arma + */ + public void openArmaTramiteLov() { + Map> params = new HashMap<>(); + Listpa=new ArrayList<>(); + if(record.getPk()!=null){ + pa.add(record.getPk().toString()); + } + params.put("ctramitepadre", pa); + BuscarTramiteLovController.openLov(params); + } + + /** + * Regresa del LOV de tramite + * @param event + */ + public void onReturnTramite(SelectEvent event) { + TarmTramite tarmTramite = (TarmTramite) event.getObject(); + record.setCtramitepadre(tarmTramite.getPk()); + descripcionTrmitePadre=tarmTramite.getPk().toString()+": "+tarmTramite.getModifiedData().get("destipoTramite")+" "+ + tarmTramite.getModifiedData().get("destipoAutorizacion")+" "+tarmTramite.getModifiedData().get("descategoria")+" "+ + tarmTramite.getModifiedData().get("desusoactividad"); + } + + /** + * Regresa del LOV de tramiteAlt + * @param event + */ + public void onReturnTramiteAlt(SelectEvent event) { + TarmTramite tarmTramite = (TarmTramite) event.getObject(); + record.setCtramitepadrealt(tarmTramite.getPk()); + descripcionTrmitePadreAlt=tarmTramite.getPk().toString()+": "+tarmTramite.getModifiedData().get("destipoTramite")+" "+ + tarmTramite.getModifiedData().get("destipoAutorizacion")+" "+tarmTramite.getModifiedData().get("descategoria")+" "+ + tarmTramite.getModifiedData().get("desusoactividad"); + } + + /** + * Limpia el tramite padre + * @param event + */ + public void eliminarTramitePadre() { + record.setCtramitepadre(null); + descripcionTrmitePadre=null; + } + + /** + * Limpia el tramite padre alterno + * @param event + */ + public void eliminarTramitePadreAlt() { + record.setCtramitepadrealt(null); + descripcionTrmitePadreAlt=null; + } + + public boolean isRegistroGuardia() { + return registroGuardia; + } + + public void setRegistroGuardia(boolean registroGuardia) { + this.registroGuardia = registroGuardia; + } + + public boolean isRegistroArmas() { + return registroArmas; + } + + public void setRegistroArmas(boolean registroArmas) { + this.registroArmas = registroArmas; + } + + public boolean isRegistroAgenciasSucursales() { + return registroAgenciasSucursales; + } + + public void setRegistroAgenciasSucursales(boolean registroAgenciasSucursales) { + this.registroAgenciasSucursales = registroAgenciasSucursales; + } + + public boolean isRequiereEvaluacion() { + return requiereEvaluacion; + } + + public void setRequiereEvaluacion(boolean requiereEvaluacion) { + this.requiereEvaluacion = requiereEvaluacion; + } + + public boolean isRequiereInspeccion() { + return requiereInspeccion; + } + + public void setRequiereInspeccion(boolean requiereInspeccion) { + this.requiereInspeccion = requiereInspeccion; + } + + public boolean isDocumentosHabilitantes() { + return documentosHabilitantes; + } + + public void setDocumentosHabilitantes(boolean documentosHabilitantes) { + this.documentosHabilitantes = documentosHabilitantes; + } + + public List getLtipoTramite() { + return ltipoTramite; + } + + public void setLtipoTramite(List ltipoTramite) { + this.ltipoTramite = ltipoTramite; + } + + public List getLcategoria() { + return lcategoria; + } + + public void setLcategoria(List lcategoria) { + this.lcategoria = lcategoria; + } + + public List getLusoActividad() { + return lusoActividad; + } + + public void setLusoActividad(List lusoActividad) { + this.lusoActividad = lusoActividad; + } + + public List getLtipoCosto() { + return ltipoCosto; + } + + public void setLtipoCosto(List ltipoCosto) { + this.ltipoCosto = ltipoCosto; + } + + public List getLvigenciaMeses() { + return lvigenciaMeses; + } + + public void setLvigenciaMeses(List lvigenciaMeses) { + this.lvigenciaMeses = lvigenciaMeses; + } + + public List getLtipoArchivo() { + return ltipoArchivo; + } + + public void setLtipoArchivo(List ltipoArchivo) { + this.ltipoArchivo = ltipoArchivo; + } + + public List getLtipoAutorizacion() { + return ltipoAutorizacion; + } + + public void setLtipoAutorizacion(List ltipoAutorizacion) { + this.ltipoAutorizacion = ltipoAutorizacion; + } + + public String getEditarReg() { + return editarReg; + } + + public void setEditarReg(String editarReg) { + this.editarReg = editarReg; + } + + public List getLflujoTramite() { + return lflujoTramite; + } + + public void setLflujoTramite(List lflujoTramite) { + this.lflujoTramite = lflujoTramite; + } + + public boolean isReimpresion() { + return reimpresion; + } + + public void setReimpresion(boolean reimpresion) { + this.reimpresion = reimpresion; + } + + public String[] getSelectedEstados() { + return selectedEstados; + } + + public void setSelectedEstados(String[] selectedEstados) { + this.selectedEstados = selectedEstados; + } + + public List getLestadosarma() { + return lestadosarma; + } + + public void setLestadosarma(List lestadosarma) { + this.lestadosarma = lestadosarma; + } + + public String getDescripcionTrmitePadre() { + return descripcionTrmitePadre; + } + + public void setDescripcionTrmitePadre(String descripcionTrmitePadre) { + this.descripcionTrmitePadre = descripcionTrmitePadre; + } + + public String getDescripcionTrmitePadreAlt() { + return descripcionTrmitePadreAlt; + } + + public void setDescripcionTrmitePadreAlt(String descripcionTrmitePadreAlt) { + this.descripcionTrmitePadreAlt = descripcionTrmitePadreAlt; + } + + public List getLtipoPersona() { + return ltipoPersona; + } + + public void setLtipoPersona(List ltipoPersona) { + this.ltipoPersona = ltipoPersona; + } + + public List getLjurisdiccion() { + return ljurisdiccion; + } + + public void setLjurisdiccion(List ljurisdiccion) { + this.ljurisdiccion = ljurisdiccion; + } + + public boolean isLogo() { + return logo; + } + + public void setLogo(boolean logo) { + this.logo = logo; + } + + public boolean isSancionable() { + return sancionable; + } + + public void setSancionable(boolean sancionable) { + this.sancionable = sancionable; + } + + public boolean isCaducidadTramitePadreBln() { + return caducidadTramitePadreBln; + } + + public void setCaducidadTramitePadreBln(boolean caducidadTramitePadreBln) { + this.caducidadTramitePadreBln = caducidadTramitePadreBln; + } + + public boolean isCaducidadTramitePadreAltBln() { + return caducidadTramitePadreAltBln; + } + + public void setCaducidadTramitePadreAltBln(boolean caducidadTramitePadreAltBln) { + this.caducidadTramitePadreAltBln = caducidadTramitePadreAltBln; + } + + public boolean isVisualizaFechaExpiracionBln() { + return visualizaFechaExpiracionBln; + } + + public void setVisualizaFechaExpiracionBln(boolean visualizaFechaExpiracionBln) { + this.visualizaFechaExpiracionBln = visualizaFechaExpiracionBln; + } + + public boolean isRequiereJurisdiccion() { + return requiereJurisdiccion; + } + + public void setRequiereJurisdiccion(boolean requiereJurisdiccion) { + this.requiereJurisdiccion = requiereJurisdiccion; + } + + public List getLtipofabricacionarma() { + return ltipofabricacionarma; + } + + public void setLtipofabricacionarma(List ltipofabricacionarma) { + this.ltipofabricacionarma = ltipofabricacionarma; + } + + public String[] getSelectedTipoFabric() { + return selectedTipoFabric; + } + + public void setSelectedTipoFabric(String[] selectedTipoFabric) { + this.selectedTipoFabric = selectedTipoFabric; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/IngresoInventarioController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/IngresoInventarioController.java.netbeans-base new file mode 100644 index 0000000..51f085d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/IngresoInventarioController.java.netbeans-base @@ -0,0 +1,1715 @@ +package com.fp.frontend.controller.armas.parametros; + + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.annotation.PostConstruct; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletResponse; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.ArmaExcell; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.funcionalidad.TotalArmasController; +import com.fp.frontend.controller.armas.solicitud.ArmasController; +import com.fp.frontend.controller.armas.solicitud.DocumentoHabilitanteController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.fun.TarmInventarioSubidoPorPersona; +import com.fp.persistence.parmas.fun.TarmInventarioSubidoPorPersonaKey; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +//import com.fp.persistence.parmas.param.TarmComercianteCupo; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmUnidadTipo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + + + +/** + * @author Andres Cevallos + * Clase Controladora para la entidad TarmArma + * Incluye metodo de consulta para la busqueda de persona y registro + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class IngresoInventarioController extends AbstractController { + + //Variabgles globales + private Integer personcode; + + private Boolean descargar; + private String csolicitud; + InputStream filei; + + //Datos generales + private TgeneCatalogDetail tipoDocumento; + private TcustPersonDetail detallesPersona; + + Date fechaActual; + private List tiposRegistro; + private TgeneCatalogDetail tipoRegistro; + + //Detalle del material + //Pais + private List lpaises; + private TgeneCountry pais; + //private String pais; + + //Provincia + private List lprovincias; + private String codigoProvincia; + + //Canton + private List lcantones; + private String codigoCanton; + + //Ciudad + private List lciudades; + private TgeneCity ciudad; + + //Registro armas + TarmRegistroArmas registro=new TarmRegistroArmas(); + + //Variables de las armas + private TcustPersonDetail usuario; + private TcustPersonAddress direccion; + private List listaFilas; + private List listaErrores; +// private List cuposArmas; + + //private BigDecimal pesoTotal; + private TarmTipoArmaExplosivo tipoArmaExplosivo; + private List listaArmas; + private ArmaExcell armaexcell; + + private List laexel; + private List armas=new ArrayList(); + private List totalesPersoan=new ArrayList(); + + //Aeropuertos + List laeropuertos=new ArrayList<>(); + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddressController; + +// @ManagedProperty(value = "#{comercianteCupoController}") +// private ComercianteCupoController comercianteCupoController; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmasController; + + @ManagedProperty(value = "#{totalArmasController}") + private TotalArmasController totalPersonaController; + + @ManagedProperty(value = "#{inventarioSubidoController}") + private InventarioSubidoController inventarioSubidoController; + + private List ldocumentospersona; + + private String clase; + public IngresoInventarioController() throws Exception { + super(TarmArmas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.record=new TarmArmas(); + this.beanalias = "ARMAS"; + this.create(); + + //Globales + descargar=false; + csolicitud=null; + + //Datos generales + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + //Obteniendo los datos de la persona + detallesPersona= PersonDetailController.find(String.valueOf(usuario.getPk().getPersoncode())); + + //Tipo de documento + tipoDocumento = CatalogDetailController.findxCodigoCodcatalogo(detallesPersona.getIdentificationcatalog(),detallesPersona.getIdentificationcatalogcode()); + + //Fecha actual + this.fechaActual=Calendar.getInstance().getTime(); + + //Tipos de registro + ListtiposRegistroAux = CatalogDetailController.find("TIPOREGISTRO", "REG"); + tiposRegistro = new ArrayList(); + for(TgeneCatalogDetail tipoReg : tiposRegistroAux){ + if(tipoReg.getPk().getCatalog().equalsIgnoreCase("PRO")){ + tiposRegistro.add(tipoReg); + } + } + + //Detalle del material + lpaises=CountryController.find(); + registro.setFechasolicitud(new java.sql.Date((new Date()).getTime())); + + //Obteniendo la direccion de la persona + String tipoDireccion=""; + + if(detallesPersona!=null){ + switch(detallesPersona.getIdentificationcatalog()){ + case "CED": + tipoDireccion = "1"; + break; + case "RUC": + tipoDireccion= "2"; + break; + default: + tipoDireccion= ""; + break; + } + } + //direccion= personAddressController.findByPersonCode(usuario.getPk().getPersoncode().toString()); + direccion= personAddressController.findPrincipal(String.valueOf(usuario.getPk().getPersoncode().toString())) ; + + + //Imprtacion + this.lprovincias=ProvinceController.find("EC"); + + //Armas + listaErrores = new ArrayList(); + + //Controlador de totales +// this.totalPersonaController=new TotalPersonaController(); +// this.totalPersonaController.create(); +// this.totalPersonaController.setLrecord(new ArrayList()); + + RegistroArmController registroArmas = new RegistroArmController(); + registroArmas.init(); + registroArmas.setRecperpage(3000000); + registroArmas.addFilter("personcode", tsafeUserDetail.getPk().getPersoncode().toString()); + registroArmas.query(); + this.addFilter("estado", "REG"); + filtro(registroArmas.getLrecord()); + + //Obteniendo los aeropuertos + this.laeropuertos=CatalogDetailController.find("AEROPUERTOS"); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TarmTipoArmaExplosivo","clase","cclase","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo= new SubQuery("TarmTipoArmaExplosivo","clasecodigo","cclasecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud= new SubQuery("TarmTipoArmaExplosivo","longitud","clongitud","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo= new SubQuery("TarmTipoArmaExplosivo","longitudcodigo","clongitudcodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ccalibre","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo= new SubQuery("TarmTipoArmaExplosivo","calibrecodigo","ccalibrecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivo","ctipoarmaexplosivo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivocodigo","ctipoarmaexplosivocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapeso","cunidadmedidapeso","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapesocodigo","cunidadmedidapesocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + + Filter filtrofecha=new Filter(); + filtrofecha.setSql("t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) and t.estado !='DEST' and t.estado !='CDP'"); + dto.addFiltro(filtrofecha); + dto.setOrderby("pk"); + String sql=csolicitud; + if(csolicitud!=null){ + Filter filtro = new Filter(); + filtro.setSql(sql); + dto.addFiltro(filtro); + } + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + public void querydatabaseMarcaSerie(String cregistro,String marca, String serie) { + try { + + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TarmTipoArmaExplosivo","clase","cclase","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo= new SubQuery("TarmTipoArmaExplosivo","clasecodigo","cclasecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud= new SubQuery("TarmTipoArmaExplosivo","longitud","clongitud","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo= new SubQuery("TarmTipoArmaExplosivo","longitudcodigo","clongitudcodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ccalibre","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo= new SubQuery("TarmTipoArmaExplosivo","calibrecodigo","ccalibrecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivo","ctipoarmaexplosivo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivocodigo","ctipoarmaexplosivocodigo","i.pk=t.ctipoarmaexplosivo");// and i.clase='" + clase + "' and i.tipoarmaexplosivo='" + tipoArmaExplosivo + "'"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapeso","cunidadmedidapeso","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapesocodigo","cunidadmedidapesocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + + + Filter filtrofecha=new Filter(); + filtrofecha.setSql("t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) " + + " and t.estado !='DEST' and t.estado !='CDP' and t.lote " + (serie==null?" is null":("= '" + serie + "'")) + " and t.cregistro= '" + + cregistro + "' and t.marca " + (marca==null?" is null":("= '" + marca + "'"))); + dto.addFiltro(filtrofecha); + dto.setOrderby("pk"); +/* String sql=csolicitud; + if(csolicitud!=null){ + Filter filtro = new Filter(); + filtro.setSql(sql); + dto.addFiltro(filtro); + }*/ + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + +/* Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE");*/ + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecOked") + protected void querydatabaseSimple() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql=" t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para armar el registro + * @param lsolicitud + */ + public void filtro(List lsolicitud){ + + for(TarmRegistroArmas soli : lsolicitud){ + if(csolicitud==null){ + csolicitud="(cregistro="+soli.getPk(); + } + else{ + csolicitud+=" or cregistro="+soli.getPk(); + } + } + csolicitud+=")"; + + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + + DtoSave dtosave = super.getDtoSave(true); + dtosave.setPosition(2); + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); + + registroArmasController.clearAll(); + DtoSave dtosaveregistroarma = registroArmasController.getDtoSave(true); + dtosaveregistroarma.setPosition(1); + msave.put(registroArmasController.getBeanalias(), dtosaveregistroarma); + + totalPersonaController.clearAll(); + DtoSave dtosavetotalper = totalPersonaController.getDtoSave(true); + dtosavetotalper.setPosition(3); + msave.put(totalPersonaController.getBeanalias(), dtosavetotalper); + + DtoSave dtoInventarioSubido = inventarioSubidoController.getDtoSave(true); + dtoInventarioSubido.setPosition(4); + msave.put(inventarioSubidoController.getBeanalias(), dtoInventarioSubido); + + request.setSaveTables(msave); + request.getModifiedData().put("LISTAARMAS", this.armas); + request.getModifiedData().put("LISTATOTALES", this.totalesPersoan); + request.getModifiedData().put("REGISTRO", this.registro); + + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.registroArmasController.postCommit(resp); + this.totalPersonaController.postCommit(resp); + this.inventarioSubidoController.postCommit(resp); + //this.totalPersonaController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + + /** + * Metodo que carga y valida el contenido de un archivo excel con información de armas + * @param event + */ + public void cargarArchivo(FileUploadEvent event){ + + HashMap mapaTotalesTemporales = new HashMap<>(); + int f1=0; + try { + // Verifico si ya se hizo una carga de inventario previa para al clase seleccionada + List inventarioPrevioIngresadoLst = InventarioSubidoController.findXPersonaYClase(this.usuario.getPk().getPersoncode().toString(), clase); + if(inventarioPrevioIngresadoLst!=null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_inventarioCargadoPreviamente")); + return; + }else{ + TarmInventarioSubidoPorPersonaKey pkInventarioSubidoObj = new TarmInventarioSubidoPorPersonaKey(); + pkInventarioSubidoObj.setPersoncode(this.usuario.getPk().getPersoncode()); + pkInventarioSubidoObj.setClase(clase); + TarmInventarioSubidoPorPersona inventarioSubidoObj = new TarmInventarioSubidoPorPersona(); + inventarioSubidoObj.setPk(pkInventarioSubidoObj); + java.util.Date today = new java.util.Date(); + java.sql.Timestamp fechaReporte = new java.sql.Timestamp(today.getTime()); + inventarioSubidoObj.setFechacarga(fechaReporte); + inventarioSubidoObj.setIsnew(Boolean.TRUE); + inventarioSubidoController.update(inventarioSubidoObj); + } + + //Completando los datos del registro + this.registro.setPersoncode(this.usuario.getPk().getPersoncode()); + this.registro.setTiporegistrocodigo("TIPOREGISTRO"); + this.registro.setFechasolicitud(new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + //Inicializando las listas + listaFilas=new ArrayList(); + listaArmas= new ArrayList(); + listaErrores= new ArrayList(); + //caraga el excel + UploadedFile selectedFile = event.getFile(); + InputStream archivo=selectedFile.getInputstream(); + XSSFWorkbook libro = new XSSFWorkbook(archivo); + XSSFSheet hoja = libro.getSheetAt(0); + //Iterando sobre las filas + int cont=0; + Iterator rowIterator = hoja.iterator(); + //Cargando el contenido de las celdas a una lista de objetos + while(rowIterator.hasNext()) { + cont++; + Row row = rowIterator.next(); + if(cont>1){ + Cell numero=row.getCell(0); + Cell serie=row.getCell(1); + Cell clase=row.getCell(2); + Cell longitud=row.getCell(3); + Cell tipo=row.getCell(4); + Cell calibre=row.getCell(5); + Cell color=row.getCell(6); + Cell marca=row.getCell(7); + Cell cantidad=row.getCell(8); + Cell umcantidad=row.getCell(9); + Cell peso=row.getCell(10); + Cell umpeso=row.getCell(11); + Boolean filaEnBlanco=false; + if(this.celdaVacia(numero) && this.celdaVacia(serie) && this.celdaVacia(clase) + && this.celdaVacia(longitud) && this.celdaVacia(tipo) && this.celdaVacia(calibre) + && this.celdaVacia(color) && this.celdaVacia(marca) && this.celdaVacia(cantidad) + && this.celdaVacia(umcantidad) && this.celdaVacia(peso) && this.celdaVacia(umpeso)){ + filaEnBlanco=true; + }else{ + listaFilas.add(row); + } + if(!filaEnBlanco){ + //arma la lista de las armas en un dto aniade en la lista listaArmas + armarlistaArmasExcel(numero, serie, clase, longitud, tipo, calibre, color, marca, cantidad, umcantidad, peso, umpeso, row); + } + } + } + //Verificando las filas duplicadas en el archivo + verificarFilasDuplicadas(listaArmas); + if(this.registro.getTiporegistro().equals("PRO")){ + //Verificando las filas duplicadas en la BD + verificarArmasExistentesEnBaseDeDatos(listaArmas, this.usuario.getPk().getPersoncode()); + } + Boolean contieneSerie=false; + //RECORRE LA LISTA DE LAS ARMAS y valida el CUPO DEL ARMA + //Validando los campos requeridos que estan vacios + recorreListaArmasExcel(contieneSerie,f1,mapaTotalesTemporales); + //Seteando los atributos de las armas y totales si no hay ningun error + if(listaErrores.isEmpty()){ + for (int i = 0; i < listaArmas.size(); i++) { + if(!listaArmas.get(i).getCamposIncompletos() && !listaArmas.get(i).getDuplicada() && listaArmas.get(i).getExisteCatalogo() + && listaArmas.get(i).getExisteTARMTIPOARMAEXPLOSIVO()){ //&& !listaArmas.get(i).getCupoInsuficiente() + //Marca + if(listaArmas.get(i).getCatalogoMarca()!=null){ + listaArmas.get(i).getArma().setMarcacodigo("MARCA"); + listaArmas.get(i).getArma().setMarca(listaArmas.get(i).getCatalogoMarca().getPk().getCatalog()); + } + //Color + if(listaArmas.get(i).getCatalogoColor()!=null){ + listaArmas.get(i).getArma().setColorcodigo("COLOR"); + listaArmas.get(i).getArma().setColor(listaArmas.get(i).getCatalogoColor().getPk().getCatalog()); + } + //Unidad medida cantidad + if(listaArmas.get(i).getTipoArmaExplosivo()!=null){ + listaArmas.get(i).getArma().setUnidadmedidacantidadcodigo("UNIDADMEDIDA"); + Double doubleNum=0.0; + //Cargando el catalodo del tipo de unidad de medida + if(listaArmas.get(i).getUnidadMedidaCantidad()!=null && !listaArmas.get(i).getUnidadMedidaCantidad().isEmpty()){ + listaArmas.get(i).getArma().setUnidadmedidacantidad(listaArmas.get(i).getUnidadMedidaCantidad()); + doubleNum=Double.parseDouble(listaArmas.get(i).getTextoCantidad()); + //Cantidad + Integer intNum=(int)doubleNum.doubleValue(); + listaArmas.get(i).getArma().setCantidad(intNum); + }else if(listaArmas.get(i).getUnidadMedidaPeso()!=null && !listaArmas.get(i).getUnidadMedidaPeso().isEmpty()){ + listaArmas.get(i).getArma().setUnidadmedidacantidad(listaArmas.get(i).getUnidadMedidaPeso()); + doubleNum=Double.parseDouble(listaArmas.get(i).getTextoPeso()); + //Peso + listaArmas.get(i).getArma().setPeso(new BigDecimal(doubleNum)); + } + } + //Estado DEL ARMA + listaArmas.get(i).getArma().setEstado("REG"); + listaArmas.get(i).getArma().setEstadocodigo("ESTADOARMA"); + if(direccion!=null){ + //Codigo de pais + listaArmas.get(i).getArma().setCountrycode(direccion.getCountrycode()); + //Codigo de provincia + listaArmas.get(i).getArma().setProvincecode(direccion.getProvincecode()); + //Codigo de canton + listaArmas.get(i).getArma().setCantoncode(direccion.getCantoncode()); + //Codigo de parroquia + listaArmas.get(i).getArma().setParroquiacode(direccion.getParroquiacode()); + //Codigo de ciudad + listaArmas.get(i).getArma().setCitycode(direccion.getCitycode()); + } + //Lote + listaArmas.get(i).getArma().setLote(listaArmas.get(i).getSerie()); + //Peso + if(listaArmas.get(i).getTextoPeso()!=null && !listaArmas.get(i).getTextoPeso().isEmpty()){ + listaArmas.get(i).getArma().setPeso(BigDecimal.valueOf(Double.parseDouble(listaArmas.get(i).getTextoPeso()))); + } + //Direccion + listaArmas.get(i).getArma().setDireccion(direccion.getAddress()); + + //Fecha de registro + listaArmas.get(i).getArma().setFecharegistro(new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + + //Tipo de arma explosivo + if(listaArmas.get(i).getTipoArmaExplosivo()!=null){ + listaArmas.get(i).getArma().setCtipoarmaexplosivo(listaArmas.get(i).getTipoArmaExplosivo().getPk()); + } + armas.add(listaArmas.get(i).getArma()); + } + } + //Se rrecorre el mapa HashMap mapaTotalesTemporales + for (TarmTotalPersona value : mapaTotalesTemporales.values()) { + totalesPersoan.add(value); + } + save(); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + }finally{ + if (!listaErrores.isEmpty()) { + listaArmas.clear(); + MessageHelper.setMessageError("ERRORES ENCONTRADOS DENTRO DEL ARCHIVO EXCEL: ");// + errores.toString()); + descargar=true; + }else{ + MessageHelper.setMessageInfo("ARCHIVO CARGADO EXITOSAMENTE"); + descargar=false; + } + } + } + /** + * Metodo para cargar los valores del EXCEL EN UNA CLASE DTO(ArmaExcell ) + * @param numero * @param serie * @param clase * @param longitud * @param tipo * @param calibre + * @param color * @param marca * @param cantidad * @param umcantidad * @param peso * @param umpeso * @param row + */ + public void armarlistaArmasExcel(Cell numero,Cell serie,Cell clase,Cell longitud,Cell tipo,Cell calibre,Cell color,Cell marca, + Cell cantidad,Cell umcantidad,Cell peso,Cell umpeso,Row row){ + ArmaExcell arma=new ArmaExcell(); + arma.setTextoNumero(Utilidades.setearValorCelda(numero));//Numero + arma.setSerie(Utilidades.setearValorCelda(serie));//Serie + arma.setClase(Utilidades.setearValorCelda(clase));//Clase + arma.setLongitud(Utilidades.setearValorCelda(longitud));//Longitud + arma.setTipo(Utilidades.setearValorCelda(tipo));//Tipo + arma.setCalibre(Utilidades.setearValorCelda(calibre));//Calibre + arma.setColor(Utilidades.setearValorCelda(color));//Color + arma.setMarca(Utilidades.setearValorCelda(marca));//Marca + arma.setTextoCantidad(Utilidades.setearValorCelda(cantidad));//Cantidad + arma.setUnidadMedidaCantidad(Utilidades.setearValorCelda(umcantidad));//U. Medida Cantidad + arma.setTextoPeso(Utilidades.setearValorCelda(peso));//Peso + arma.setUnidadMedidaPeso(Utilidades.setearValorCelda(umpeso));//U. Medida Peso + + // El ingreso de inventario sera para todas las clases excepto armas de fuego y armas no letales + if(!arma.getClase().equalsIgnoreCase("ARMA DE FUEGO") && !arma.getClase().equalsIgnoreCase("ARMAS NO LETALES")){ + listaArmas.add(arma); + }else { + listaErrores.add("Fila "+row.getRowNum()+": "+"Columna clase: "+MsgControlArmas.getProperty("msg_inventarioNoArmasFuegoNiNoLetales")); + return; + } + } + + /** + * Metodo que verifica si existen filas duplicadas en el archivo de excell + * @param listaArmas + */ + private void verificarFilasDuplicadas(List listaArmas){ + for (int i = 0; i < listaArmas.size()-1; i++) { + for (int j = i+1; j < listaArmas.size(); j++) { + if(!this.registro.getTiporegistro().equalsIgnoreCase("IMP") && ((listaArmas.get(i).getSerie().equalsIgnoreCase(listaArmas.get(j).getSerie())) + && listaArmas.get(i).getClase().equalsIgnoreCase(listaArmas.get(j).getClase()) + && listaArmas.get(i).getTipo().equalsIgnoreCase(listaArmas.get(j).getTipo()) + && (!listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego") + || (listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego") && listaArmas.get(j).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")) + && listaArmas.get(i).getCalibre().equalsIgnoreCase(listaArmas.get(j).getCalibre())) + && listaArmas.get(i).getMarca().equalsIgnoreCase(listaArmas.get(j).getMarca()))){ + listaArmas.get(j).setDuplicada(true); + break; + } + } + } + } + + /** + * @param listaArmas + * @throws Exception + */ + @SuppressWarnings("static-access") + private void verificarArmasExistentesEnBaseDeDatos(List listaArmas, Integer codigoPersona) throws Exception{ + TgeneCatalogDetail codigoClase = new TgeneCatalogDetail(); + TgeneCatalogDetail codigoMarca = new TgeneCatalogDetail(); + TgeneCatalogDetail codigoTipo = new TgeneCatalogDetail(); + TgeneCatalogDetail codigoCalibre = new TgeneCatalogDetail(); + String codigoSerie; + List lstRegistroArmas = registroArmasController.findxPersoncode(String.valueOf(codigoPersona)); + if(lstRegistroArmas==null || listaArmas==null || lstRegistroArmas.isEmpty() || listaArmas.isEmpty()){ + return; + } + for (int i = 0; i < listaArmas.size(); i++) { + codigoClase=CatalogDetailController.findByCatalogcodeDescrption("CLASE", listaArmas.get(i).getClase()); + codigoTipo=CatalogDetailController.findByCatalogcodeDescrption("TIPOARMAEXPLOSIVO", listaArmas.get(i).getTipo()); + codigoMarca=CatalogDetailController.findByCatalogcodeDescrption("MARCA", listaArmas.get(i).getMarca()); + codigoSerie = this.registro.getTiporegistro().equalsIgnoreCase("IMP")?null:listaArmas.get(i).getSerie(); + codigoCalibre=listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")?CatalogDetailController.findByCatalogcodeDescrption("CALIBRE",listaArmas.get(i).getCalibre()):null; + + if((codigoClase==null && (listaArmas.get(i).getClase()!=null && !listaArmas.get(i).getClase().trim().isEmpty())) || (codigoTipo==null && (listaArmas.get(i).getTipo()!=null && !listaArmas.get(i).getTipo().trim().isEmpty())) + || (codigoMarca==null && (listaArmas.get(i).getMarca()!=null && !listaArmas.get(i).getMarca().trim().isEmpty())) || (codigoSerie==null && (listaArmas.get(i).getSerie()!=null && !listaArmas.get(i).getSerie().trim().isEmpty())) + || (codigoCalibre==null && (listaArmas.get(i).getCalibre()!=null && !listaArmas.get(i).getCalibre().trim().isEmpty())) + || listaArmas.get(i).getClase()==null || listaArmas.get(i).getMarca()==null || listaArmas.get(i).getCalibre()==null + || listaArmas.get(i).getClase().isEmpty() || listaArmas.get(i).getMarca().isEmpty() || listaArmas.get(i).getCalibre().isEmpty()){ + continue; + } + for(TarmRegistroArmas registroArmas :lstRegistroArmas){ + List lstArmasEncontradas = findByMarcaSerie(String.valueOf(registroArmas.getPk()),codigoMarca.getPk().getCatalog(), codigoSerie); + if(lstArmasEncontradas!=null){ + for(TarmArmas armas:lstArmasEncontradas){ + TarmTipoArmaExplosivo tipoArma = TiposArmasExplosivosController.findarma(armas.getCtipoarmaexplosivo()); + if(tipoArma.getClase().equalsIgnoreCase(codigoClase.getPk().getCatalog()) && codigoCalibre!=null?tipoArma.getCalibre().equalsIgnoreCase(codigoCalibre.getPk().getCatalog()):true && tipoArma.getTipoarmaexplosivo().equalsIgnoreCase(codigoTipo.getPk().getCatalog())){ + listaArmas.get(i).setDuplicada(true); + break; + } + } + } + } + } + } + /** + * Metodo que recorre la lista de las armas con los valores cargados del EXCEL + * @param contieneSerie + * @param f1 + * @param mapaTotalesTemporales + */ + public void recorreListaArmasExcel(Boolean contieneSerie, int f1,HashMap mapaTotalesTemporales){ + for (int i = 0; i < listaArmas.size(); i++) { + Integer fila=i+1; + f1=i; + Boolean campoCantidad=false; + //0-Datos duplicados + if(listaArmas.get(i).getDuplicada()){ + listaErrores.add("Fila "+fila.toString()+": "+MsgControlArmas.getProperty("msg_datosDuplicados")); + } + //1-Serie + //Validando que si el tipo de registro es de importacion + //las armas no contengan numero de serie + if(this.registro.getTiporegistro().equalsIgnoreCase("IMP") && (listaArmas.get(i).getSerie()!=null) && !contieneSerie){ + contieneSerie=true; + listaErrores.add(MsgControlArmas.getProperty("msg_archivoImportacionSerie")); + } + if(!this.registro.getTiporegistro().equalsIgnoreCase("IMP") && (listaArmas.get(i).getSerie()==null || listaArmas.get(i).getSerie().trim().isEmpty())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 1: "+MsgControlArmas.getProperty("msg_serieVacia")); + listaArmas.get(i).setCamposIncompletos(true); + } + //2-Clase + if(listaArmas.get(i).getClase()==null || listaArmas.get(i).getClase().trim().isEmpty()){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 2: "+MsgControlArmas.getProperty("msg_claseVacia")); + listaArmas.get(i).setCamposIncompletos(true); + + //3-Validando que cuando la clase sea ARMA DE FUEGO la longitud no este vacia + }else if(listaArmas.get(i).getClase().equalsIgnoreCase("ARMA DE FUEGO") + && (listaArmas.get(i).getLongitud()==null || listaArmas.get(i).getLongitud().trim().isEmpty())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 3: "+MsgControlArmas.getProperty("msg_longitudVacia")); + listaArmas.get(i).setCamposIncompletos(true); + + //Validando que cuando la clase no sea ARMA DE FUEGO la longitud este vacia + }else if(!listaArmas.get(i).getClase().equalsIgnoreCase("ARMA DE FUEGO") + && (listaArmas.get(i).getLongitud()!=null && !listaArmas.get(i).getLongitud().trim().isEmpty())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 3: "+MsgControlArmas.getProperty("msg_longitudNoVacia")); + } + //Carga de catalogos + TgeneCatalogDetail catalogoClase=CatalogDetailController.findByCatalogcodeDescrption("CLASE", listaArmas.get(i).getClase()); + listaArmas.get(i).setCatalogoClase(catalogoClase); + if(catalogoClase!=null && catalogoClase.getPk()!=null && catalogoClase.getPk().getCatalog()!=null && !clase.contains(catalogoClase.getPk().getCatalog())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 2: "+" No tiene permiso para cargar "+catalogoClase.getDescription()); + listaArmas.get(i).setCamposIncompletos(true); + }else if(catalogoClase==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 2: "+" No tiene ingresado una Clase V\u00e1lida "); + listaArmas.get(i).setCamposIncompletos(true); + } + TgeneCatalogDetail catalogoLongitud=CatalogDetailController.findByCatalogcodeDescrption("LONGITUD", listaArmas.get(i).getLongitud()); + listaArmas.get(i).setCatalogoLongitud(catalogoLongitud); + TgeneCatalogDetail catalogoTipoArma=CatalogDetailController.findByCatalogcodeDescrption("TIPOARMAEXPLOSIVO", listaArmas.get(i).getTipo()); + listaArmas.get(i).setCatalogoTipoArma(catalogoTipoArma); + TgeneCatalogDetail catalogoCalibre=CatalogDetailController.findByCatalogcodeDescrption("CALIBRE", listaArmas.get(i).getCalibre()); + listaArmas.get(i).setCatalogoCalibre(catalogoCalibre); + TgeneCatalogDetail catalogoColor=CatalogDetailController.findByCatalogcodeDescrption("COLOR", listaArmas.get(i).getColor()); + listaArmas.get(i).setCatalogoColor(catalogoColor); + TgeneCatalogDetail catalogoMarca=CatalogDetailController.findByCatalogcodeDescrption("MARCA", listaArmas.get(i).getMarca()); + listaArmas.get(i).setCatalogoMarca(catalogoMarca); + TarmUnidadTipo tipoUnidadSeleccionada =null;// new TarmUnidadTipo(); + if(catalogoClase!=null){ + //Obteniendo la configuracion de TARMUNIDADTIPO + if(!(listaArmas.get(i).getUnidadMedidaCantidad()==null || listaArmas.get(i).getUnidadMedidaCantidad().isEmpty()) && !(listaArmas.get(i).getUnidadMedidaPeso()==null || listaArmas.get(i).getUnidadMedidaPeso().isEmpty())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 9,11: "+MsgControlArmas.getProperty("msg_unidadMedidaSoloUna")); + } + String unidadMedidaIngresada = (listaArmas.get(i).getUnidadMedidaCantidad()==null || listaArmas.get(i).getUnidadMedidaCantidad().isEmpty())?listaArmas.get(i).getUnidadMedidaPeso():listaArmas.get(i).getUnidadMedidaCantidad(); + String columnaUnidadMedidaError = (listaArmas.get(i).getUnidadMedidaCantidad()==null || listaArmas.get(i).getUnidadMedidaCantidad().isEmpty())?"Columna 11":"Columna 9"; + if (listaArmas.get(i).getCatalogoTipoArma() == null) { + listaErrores.add("Fila "+fila.toString()+": "+"Columna 5: El Tipo de Arma Explosivo no existe en el Catlogo. Revise los espacios entre cada palabra y que este bien escrito."); + listaArmas.get(i).setCamposIncompletos(true); + tipoUnidadSeleccionada=null; + }else { + tipoUnidadSeleccionada= UnidadTipoController.findByClaseAndClasecode(catalogoClase.getPk().getCatalog(), catalogoClase.getPk().getCatalogcode(),listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(), unidadMedidaIngresada); + } + if(tipoUnidadSeleccionada!=null && tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()!=null && !tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().isEmpty()){ + if(tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().equalsIgnoreCase("UNIDAD") || tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().equalsIgnoreCase("UNIDADES")){ + campoCantidad=true; + }else if(tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().equalsIgnoreCase("KG")){ + campoCantidad=false; + } + } + else if (tipoUnidadSeleccionada==null){ + listaErrores.add("Fila "+fila.toString()+": "+ columnaUnidadMedidaError + ": " +MsgControlArmas.getProperty("msg_unidadMedidaNoExiste")); + } + } + //4-Tipo + if(listaArmas.get(i).getTipo()==null || listaArmas.get(i).getTipo().trim().isEmpty()){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 4: "+MsgControlArmas.getProperty("msg_tipoVacio")); + listaArmas.get(i).setCamposIncompletos(true); + } + //5-Calibre + if(listaArmas.get(i).getClase()!=null && !listaArmas.get(i).getClase().isEmpty() + && listaArmas.get(i).getClase().equalsIgnoreCase("ARMA DE FUEGO") + && (listaArmas.get(i).getCalibre()==null || listaArmas.get(i).getCalibre().trim().isEmpty())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 5: "+MsgControlArmas.getProperty("msg_calibreVacio")); + } + //Marca + if(listaArmas.get(i).getMarca()==null || listaArmas.get(i).getMarca().trim().isEmpty()){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 7: "+MsgControlArmas.getProperty("msg_marcaVacia")); + listaArmas.get(i).setCamposIncompletos(true); + } + if(campoCantidad){ + //Cantidad + if((listaArmas.get(i).getTextoCantidad()==null || listaArmas.get(i).getTextoCantidad().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 8: "+MsgControlArmas.getProperty("msg_cantidadVacia")); + listaArmas.get(i).setCamposIncompletos(true); + + }else if(listaFilas.get(i).getCell(8).getCellType()!=Cell.CELL_TYPE_NUMERIC && tipoUnidadSeleccionada!=null){ + //Verificando el tipo de dato numerico + listaErrores.add("Fila "+fila.toString()+": "+"Columna 8: "+MsgControlArmas.getProperty("msg_cantidadValorNumerico")); + } + + //U. Medida Cantidad + if((listaArmas.get(i).getUnidadMedidaCantidad()==null || listaArmas.get(i).getUnidadMedidaCantidad().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 9: "+MsgControlArmas.getProperty("msg_unidadMedidaCantidadVacia")); + } + + //Peso + if((listaArmas.get(i).getTextoPeso()!=null && !listaArmas.get(i).getTextoPeso().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 10: "+MsgControlArmas.getProperty("msg_pesoNoVacio")); + } + + //U. Medida Peso + if((listaArmas.get(i).getUnidadMedidaPeso()!=null && !listaArmas.get(i).getUnidadMedidaPeso().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 11: "+MsgControlArmas.getProperty("msg_unidadMedidaPesoNoVacia")); + } + //Validando que cuando la clase NO sea ARMA DE FUEGO, MUNICION, + //Explosivos, Accesorios, Fuegos Pirotecnicos, Sustancia Quimica, Armas no Letales + //la cantidad y unidad de medida cantidad esten vacios + //y el peso y unidad de medida peso NO esten vacios + }else if(listaArmas.get(i).getClase()!=null && !listaArmas.get(i).getClase().isEmpty()){ + //Cantidad + if((listaArmas.get(i).getTextoCantidad()!=null && !listaArmas.get(i).getTextoCantidad().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 8: "+MsgControlArmas.getProperty("msg_cantidadNoVacia")); + } + //U. Medida Cantidad + if(listaArmas.get(i).getUnidadMedidaCantidad()!=null && !listaArmas.get(i).getUnidadMedidaCantidad().trim().isEmpty() && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 9: "+MsgControlArmas.getProperty("msg_unidadMedidaCantidadNoVacia")); + } + //Peso + if((listaArmas.get(i).getTextoPeso()==null || listaArmas.get(i).getTextoPeso().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 10: "+MsgControlArmas.getProperty("msg_pesoVacio")); + listaArmas.get(i).setCamposIncompletos(true); + + }else if(listaFilas.get(i).getCell(10).getCellType()!=Cell.CELL_TYPE_NUMERIC && tipoUnidadSeleccionada!=null){ + //Verificando el tipo de dato numerico + listaErrores.add("Fila "+fila.toString()+": "+"Columna 10: "+MsgControlArmas.getProperty("msg_pesoValorNumerico")); + } + //U. Medida Peso + if((listaArmas.get(i).getUnidadMedidaPeso()==null || listaArmas.get(i).getUnidadMedidaPeso().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 11: "+MsgControlArmas.getProperty("msg_unidadMedidaPesoVacia")); + listaArmas.get(i).setCamposIncompletos(true); + } + } + //Verificando que no existan problemas en el arma proveniente del archivo EXCEL + //para validar entonces los datos en la base de datos + if(!listaArmas.get(i).getCamposIncompletos() && !listaArmas.get(i).getDuplicada()){ + //Verificando los datos en los catalogos + //Verificando la existencia de la clase en el catalogo + if(catalogoClase==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 2: "+MsgControlArmas.getProperty("msg_calibreNoExisteCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia de la longitud en el catalogo + if(catalogoLongitud==null){ + listaArmas.get(i).setExisteCatalogo(false); + if(listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 3: "+MsgControlArmas.getProperty("msg_longitudNoExisteCatalogo")); + } + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia del tipo de arma en el catalogo + if(catalogoTipoArma==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 4: "+MsgControlArmas.getProperty("msg_noExisteTipoArmaCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia del calibre en el catalogo + if(catalogoCalibre==null){ + listaArmas.get(i).setExisteCatalogo(false); + if(listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 5: "+MsgControlArmas.getProperty("msg_calibreNoExisteCatalogo")); + } + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia del color en el catalogo + if(listaArmas.get(i).getColor()!=null && !listaArmas.get(i).getColor().isEmpty()){ + if(catalogoColor==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 6: "+MsgControlArmas.getProperty("msg_colorNoExisteCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + } + //Verificando la existencia de la marca en el catalogo + if(catalogoMarca==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 7: "+MsgControlArmas.getProperty("msg_marcaNoExisteCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + //Validacio 4- Verificando que exista la combinacion clase, longitud, tipo arma y calibre + //en la tabla TARMTIPOARMAEXPLOSIVO + if(listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")){ + if(catalogoClase!=null && catalogoLongitud!=null && catalogoTipoArma!=null && catalogoCalibre!=null && tipoUnidadSeleccionada!=null){ + tipoArmaExplosivo=TiposArmasExplosivosController.findByClaseLongitudCalibreTipoArma(catalogoLongitud.getPk().getCatalog(), + catalogoCalibre.getPk().getCatalog(), catalogoClase.getPk().getCatalog(), catalogoTipoArma.getPk().getCatalog(),tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + + if(tipoArmaExplosivo==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado: "+listaArmas.get(i).getClase()+", "+listaArmas.get(i).getLongitud()+", "+listaArmas.get(i).getTipo()+", "+listaArmas.get(i).getCalibre()); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + }else{ + listaArmas.get(i).setTipoArmaExplosivo(tipoArmaExplosivo); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(true); + } + }else{ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado la combinaci\u00f3n del Tipo Arma Explosivo"); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } + }else{ + if(catalogoCalibre!=null && catalogoCalibre.getDescription()!=null && !catalogoCalibre.getDescription().equals("")){ + // Caso donde existe calibre + if(catalogoClase!=null && catalogoTipoArma!=null && tipoUnidadSeleccionada!=null){ + tipoArmaExplosivo=TiposArmasExplosivosController.findByClaseCalibreTipoArma(catalogoClase.getPk().getCatalog(), catalogoCalibre.getPk().getCatalog(), catalogoTipoArma.getPk().getCatalog(),tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + if(tipoArmaExplosivo==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado: "+listaArmas.get(i).getClase()+", "+listaArmas.get(i).getTipo()); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + }else{ + listaArmas.get(i).setTipoArmaExplosivo(tipoArmaExplosivo); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(true); + } + }else{ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado la combinaci\u00f3n del Tipo Arma Explosivo "); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } + } + else{ + // Caso donde no existe calibre + if(catalogoClase!=null && catalogoTipoArma!=null && tipoUnidadSeleccionada!=null){ + tipoArmaExplosivo=TiposArmasExplosivosController.findByClaseTipo(catalogoClase.getPk().getCatalog(), catalogoTipoArma.getPk().getCatalog(),tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + if(tipoArmaExplosivo==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado: "+listaArmas.get(i).getClase()+", "+listaArmas.get(i).getTipo()); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + }else{ + listaArmas.get(i).setTipoArmaExplosivo(tipoArmaExplosivo); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(true); + } + }else{ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado la combinaci\u00f3n del Tipo Arma Explosivo "); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } + } + + } + if(listaArmas.get(i).getCatalogoClase()!=null && listaArmas.get(i).getCatalogoTipoArma()!=null && listaArmas.get(i).getCatalogoMarca()!=null){ + TarmArmas armaBD; + //Si el tipo de registro es de Importacion, el arma se persiste como nueva + //no se busca en la base de datos + if(this.registro.getTiporegistro().equalsIgnoreCase("IMP")){ + listaArmas.get(i).setExisteBaseDatos(false); + armaBD=new TarmArmas(); + armaBD.setIsnew(true); + }else{ + //Verificando que el arma exista en la base de datos + //si el tipo de registro es de produccion + armaBD=ArmasController.findBySerieMarca(listaArmas.get(i).getSerie(), listaArmas.get(i).getCatalogoMarca().getPk().getCatalog()); + if(armaBD==null){ + listaArmas.get(i).setExisteBaseDatos(false); + armaBD=new TarmArmas(); + armaBD.setIsnew(true); + }else{ + List listaExplosivos=TiposArmasExplosivosController.findByClaseTipoAll(listaArmas.get(i).getCatalogoClase().getPk().getCatalog(), + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog()); + if(listaExplosivos==null){ + listaArmas.get(i).setExisteBaseDatos(false); + }else{ + listaArmas.get(i).setExisteBaseDatos(false); + for (TarmTipoArmaExplosivo explosivo : listaExplosivos) { + if(explosivo.getPk().equalsIgnoreCase(armaBD.getCtipoarmaexplosivo())){ + listaArmas.get(i).setExisteBaseDatos(true); + armaBD.setIsnew(false); + break; + } + } + } + } + } + listaArmas.get(i).setArma(armaBD); + String unidadTipoIngresada = campoCantidad?listaArmas.get(i).getUnidadMedidaCantidad():listaArmas.get(i).getUnidadMedidaPeso(); + // CARGA EL CUPO ***** //persona,clase,tipoarmaexplosivo +// List cupo =ComercianteCupoController.findByPersonCode(usuario.getPk().getPersoncode().toString(), +// listaArmas.get(i).getCatalogoClase().getPk().getCatalog(), listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(), +// unidadTipoIngresada); +// +// if(cupo!=null && !cupo.isEmpty() && cupo.get(0).getTiporegistro().equalsIgnoreCase(this.registro.getTiporegistro())){ + //metodo de los TOTALES SETEADOS EN UN MAPA + cupoArmasExplosivos(i, mapaTotalesTemporales, fila,tipoUnidadSeleccionada); +// }else{ +// if(cupo==null || cupo.isEmpty()){ +// listaErrores.add("Fila "+fila.toString()+": Cupo no asignado para "+listaArmas.get(i).getClase()+"."); +// } +// else{ +// listaErrores.add("Fila "+fila.toString()+": Cupo no disponible para "+listaArmas.get(i).getClase()+"."); +// } +// listaArmas.get(i).setCupoInsuficiente(true); +// } + } + } + tipoUnidadSeleccionada = null; + } + } + + public void cupoArmasExplosivos(int i,HashMap mapaTotalesTemporales,Integer fila,TarmUnidadTipo tipoUnidadSeleccionada){ + + BigDecimal saldoPasaraaAnterior = new BigDecimal(0); + TarmTotalPersona totalPersona=null; + + if(mapaTotalesTemporales.get(usuario.getPk().getPersoncode().toString()+ "|" + listaArmas.get(i).getCatalogoClase().getPk().getCatalog() + + "|" + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog())==null){ + totalPersona =TotalPersonaController.findMaxFecha(listaArmas.get(i).getCatalogoClase().getPk().getCatalog(), + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(), usuario.getPk().getPersoncode().toString(), + tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + if(totalPersona==null){ + totalPersona=new TarmTotalPersona(); + totalPersona.setTotal(new BigDecimal(0)); + }else{ + saldoPasaraaAnterior = (totalPersona==null?new BigDecimal(0):totalPersona.getTotal()); + } + BigDecimal peso = (listaArmas==null || listaArmas.get(i).getTextoPeso()==null || listaArmas.get(i).getTextoPeso().isEmpty())?new BigDecimal(0.0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoPeso())); + BigDecimal cantidad = (listaArmas==null || listaArmas.get(i).getTextoCantidad()==null || listaArmas.get(i).getTextoCantidad().isEmpty())?new BigDecimal(0.0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())); + totalPersona.setCantidadmovimiento(cantidad.add(peso)); + totalPersona.setTotal(new BigDecimal(0));//saldoPasaraaAnterior.add((listaArmas==null || listaArmas.get(i).getTextoCantidad()==null)?new BigDecimal(0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())))); + Double suma=0.0; + //Cantidad + if(listaArmas.get(i).getUnidadMedidaCantidad()!=null && !listaArmas.get(i).getUnidadMedidaCantidad().isEmpty()){ + listaArmas.get(i).setCantidad(Double.parseDouble(listaArmas.get(i).getTextoCantidad())); + totalPersona.setUnidadmedidapeso(listaArmas.get(i).getUnidadMedidaCantidad()); + //suma eltotal anterior + la cantidad a ingresar + suma=saldoPasaraaAnterior.doubleValue()+listaArmas.get(i).getCantidad(); + totalPersona.setTotal(new BigDecimal(suma)); + //Peso + }else if(listaArmas.get(i).getUnidadMedidaPeso()!=null && !listaArmas.get(i).getUnidadMedidaPeso().isEmpty()){ + listaArmas.get(i).setPeso(Double.parseDouble(listaArmas.get(i).getTextoPeso())); + totalPersona.setUnidadmedidapeso(listaArmas.get(i).getUnidadMedidaPeso()); + //suma eltotal anterior + la cantidad a ingresar + suma=saldoPasaraaAnterior.doubleValue()+listaArmas.get(i).getPeso(); + totalPersona.setTotal(new BigDecimal(suma)); + } + } + else{//existe la combinacion + totalPersona = mapaTotalesTemporales.get(usuario.getPk().getPersoncode().toString()+ "|" + listaArmas.get(i).getCatalogoClase().getPk().getCatalog()+ "|" + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog()); + BigDecimal peso = (listaArmas==null || listaArmas.get(i).getTextoPeso()==null || listaArmas.get(i).getTextoPeso().isEmpty())?new BigDecimal(0.0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoPeso())); + BigDecimal cantidad = (listaArmas==null || listaArmas.get(i).getTextoCantidad()==null || listaArmas.get(i).getTextoCantidad().isEmpty())?new BigDecimal(0.0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())); + totalPersona.setCantidadmovimiento(cantidad.add(peso).add(totalPersona.getCantidadmovimiento())); + totalPersona.setTotal(totalPersona.getSaldoanterior().add(totalPersona.getCantidadmovimiento()));//saldoPasaraaAnterior.add((listaArmas==null || listaArmas.get(i).getTextoCantidad()==null)?new BigDecimal(0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())))); + saldoPasaraaAnterior=totalPersona.getSaldoanterior(); + } + totalPersona.setPk(null); + totalPersona.setPersoncodigo(usuario.getPk().getPersoncode()); + totalPersona.setClase(listaArmas.get(i).getCatalogoClase().getPk().getCatalog()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setIngresoegreso("ING"); + totalPersona.setCarma(listaArmas.get(i).getArma().getPk()); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setFecha(new java.sql.Timestamp(new Date().getTime())); + totalPersona.setSaldoanterior(saldoPasaraaAnterior==null?new BigDecimal(0):saldoPasaraaAnterior); + totalPersona.setIsnew(true); + //Verificando si el usuario tiene cupo disponible para el arma + + //mapa con el nuevo total por clase tipo unidad + mapaTotalesTemporales.put(usuario.getPk().getPersoncode().toString()+ "|" + listaArmas.get(i).getCatalogoClase().getPk().getCatalog()+ "|" + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(),totalPersona); + listaArmas.get(i).setTotalPersona(totalPersona); + //Verificando que el la suma del total con la cantidad de armas + //no sea mayor que el cupo +// if(totalPersona.getTotal().doubleValue()>cupoMaximo){ +// listaErrores.add("Fila "+fila.toString()+": Cupo no disponible para "+listaArmas.get(i).getClase()); +// listaArmas.get(i).setCupoInsuficiente(true); +// }else{ +// //Actualizando el valor del total y del total anterior +// listaArmas.get(i).getTotalPersona().setSaldoanterior(listaArmas.get(i).getTotalPersona().getSaldoanterior()); +// listaArmas.get(i).getTotalPersona().setTotal(totalPersona.getTotal()); +// } + } + + /** + * Metodo que indica cuando una celda esta vacia + * @param celda + * @return + */ + public Boolean celdaVacia(Cell celda){ + Boolean vacia=false; + if(celda==null || celda.getCellType()==Cell.CELL_TYPE_BLANK || (celda.getCellType()==Cell.CELL_TYPE_STRING && celda.getStringCellValue().isEmpty())){ + vacia=true; + } + return vacia; + } + + /** + * + * @param codigopersona + * @return + */ + public static TarmArmas findBySerieMarca(String serie, String marca) { + try { + IngresoInventarioController cc = new IngresoInventarioController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("lote", serie); + cc.addFilter("marca", marca); + cc.querydatabaseSimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + + /** + * + * Metodo para encontrar por marca y tipoarmaexplosivo + * @param marca + * @param tipoArmaExplosivo + * @return + * @throws Exception + */ + public static List findByMarcaSerie(String cregistro,String marca, String serie) throws Exception { + + IngresoInventarioController cc = new IngresoInventarioController(); + //cc.init(); + cc.recperpage = 300; + cc.querydatabaseMarcaSerie(cregistro,marca, serie ); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + + } + + @SuppressWarnings("finally") + public File generarArchivoError(Long key){ + if(listaErrores.isEmpty()){ + + //MessageHelper.setMessageInfo("ARCHIVO SUBIDO CORRECTAMENTE"); + return null; + } + PrintWriter escribir=null; + File archivo = null; + try { + archivo = File.createTempFile("errorlog"+key,".txt"); + escribir = new PrintWriter(archivo); + + + for(String err : listaErrores){ + System.out.println(err); + + + escribir.print(err+"\r\n"); + } + //escribir.close(); + limpiar(); + + + + } + catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + finally{ + escribir.flush(); + escribir.close(); + return archivo; + } + + } + + /** + * Llama a la construccion del metodo para recargar + */ + public void descargarArchivo(){ + + Long key=new Date().getTime(); + File archivoTemporal=generarArchivoError(key); + if(archivoTemporal==null) + return; + try { + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition", "attachment; filename=errorlog"+key+".txt"); + OutputStream out = response.getOutputStream(); + InputStream inputStream = new FileInputStream(archivoTemporal.getAbsolutePath()); + + int read = 0; + byte[] bytes = new byte[1024]; + + while ((read = inputStream.read(bytes)) != -1) { + out.write(bytes, 0, read); + } + + inputStream.close(); + out.flush(); + + FacesContext.getCurrentInstance().responseComplete(); + + + } catch (Exception e) { + // TODO: handle exception + } + } + + /** + * Limpia las los valores en las listas + */ + public void limpiar(){ + try { + create(); + while(lrecord.iterator().hasNext()){ + record =lrecord.get(0); + remove(); + } + listaArmas = new ArrayList(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Carga las listas de cantones y limpia la lista de ciudades + */ + public void seleccionarProvincia(){ + try { + codigoProvincia=this.record.getProvincecode(); + lcantones = CantonController.find("EC", record.getProvincecode()); + lciudades = new ArrayList<>(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Carga las listas de ciudades + */ + public void seleccionarCanton(){ + try { + codigoCanton = this.record.getCantoncode(); + lciudades = CityController.find("EC", record.getProvincecode(), record.getCantoncode()); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + public void cargarDocumentosHabilitantes(String categoria){ + ldocumentospersona= new ArrayList<>(); + List listadocum=DocumentoHabilitanteController.findpersoncodeInventario(usuario.getPk().getPersoncode().toString(),categoria); + //Forma nmero 1 (Uso de Maps). + Map mapPersonas = new HashMap(listadocum.size()); + for(TarmDocumentoHabilitante p : listadocum) { + mapPersonas.put(p.getCtramite(), p); + } + //Agrego cada elemento del map a una nueva lista y muestro cada elemento. + System.out.println("Lista sin repetidos:"); + for(Entry p : mapPersonas.entrySet()) { + // Se cargan las categorias diferentes a armas de fuego y armas no letales +// if(!p.getValue().getModifiedData().get("clase").toString().contains("0010000001")||!p.getValue().getModifiedData().get("clase").toString().contains("0010000008")){ + ldocumentospersona.add(p.getValue()); +// } + } +// ldocumentospersona =DocumentoHabilitanteController.findpersoncode(usuario.getPk().getPersoncode().toString(),categoria); + } + + public void cambioTipoRegistro(){ + if(registro.getTiporegistro()!=null){ + cargarDocumentosHabilitantes("4");//4 Fabrica, 5Fabricante + }else{ + ldocumentospersona=new ArrayList<>(); + } + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + public String getCodigoProvincia() { + return codigoProvincia; + } + + public void setCodigoProvincia(String codigoProvincia) { + this.codigoProvincia = codigoProvincia; + } + + public String getCodigoCanton() { + return codigoCanton; + } + + public void setCodigoCanton(String codigoCanton) { + this.codigoCanton = codigoCanton; + } + + public String getCodigoCiudad() { + return codigoCiudad; + } + + public void setCodigoCiudad(String codigoCiudad) { + this.codigoCiudad = codigoCiudad; + } + + String codigoCiudad; + public void codigoCiudad(){ + + + } + + public void addPersoncodeFilter(String personcode) { + super.addFilter("pk.personcode", personcode); + } + + public List getLarmexcell() { + return listaArmas; + } + + public void setLarmexcell(List larmexcell) { + this.listaArmas = larmexcell; + } + + public ArmaExcell getArmaexcell() { + return armaexcell; + } + + public void setArmaexcell(ArmaExcell armaexcell) { + this.armaexcell = armaexcell; + } + + public TarmTipoArmaExplosivo getTipoarmexplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoarmexplosivo(TarmTipoArmaExplosivo tipoarmexplosivo) { + this.tipoArmaExplosivo = tipoarmexplosivo; + } + + public List getLaexel() { + return laexel; + } + + public void setLaexel(List laexel) { + this.laexel = laexel; + } + + public TcustPersonDetail getDetallesPersona() { + return detallesPersona; + } + + public void setDetallesPersona(TcustPersonDetail detallesPersona) { + this.detallesPersona = detallesPersona; + } + + public TcustPersonDetail getUsuario() { + return usuario; + } + + public void setUsuario(TcustPersonDetail usuario) { + this.usuario = usuario; + } + + public List getListaFilas() { + return listaFilas; + } + + public void setListaFilas(List listaFilas) { + this.listaFilas = listaFilas; + } + + public List getListaErrores() { + return listaErrores; + } + + public void setListaErrores(List listaErrores) { + this.listaErrores = listaErrores; + } + + public TarmTipoArmaExplosivo getTipoArmaExplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoArmaExplosivo(TarmTipoArmaExplosivo tipoArmaExplosivo) { + this.tipoArmaExplosivo = tipoArmaExplosivo; + } + + public List getListaArmas() { + return listaArmas; + } + + public void setListaArmas(List listaArmas) { + this.listaArmas = listaArmas; + } + + public PersonAddressController getPersonAddressController() { + return personAddressController; + } + + public void setPersonAddressController( + PersonAddressController personAddressController) { + this.personAddressController = personAddressController; + } + + public InputStream getFilei() { + return filei; + } + + public void setFilei(InputStream filei) { + this.filei = filei; + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public TcustPersonAddress getDireccion() { + return direccion; + } + + public void setDireccion(TcustPersonAddress direccion) { + this.direccion = direccion; + } + +// public List getCuposArmas() { +// return cuposArmas; +// } +// +// public void setCuposArmas(List cuposArmas) { +// this.cuposArmas = cuposArmas; +// } + +// public ComercianteCupoController getComercianteCupoController() { +// return comercianteCupoController; +// } +// +// public void setComercianteCupoController( +// ComercianteCupoController comercianteCupoController) { +// this.comercianteCupoController = comercianteCupoController; +// } + + public Boolean getDescargar() { + return descargar; + } + + public void setDescargar(Boolean descargar) { + this.descargar = descargar; + } + + public RegistroArmController getRegistroArmasController() { + return registroArmasController; + } + + public void setRegistroArmasController( + RegistroArmController registroArmasController) { + this.registroArmasController = registroArmasController; + } + + + public TotalArmasController getTotalPersonaController() { + return totalPersonaController; + } + + public void setTotalPersonaController( + TotalArmasController totalPersonaController) { + this.totalPersonaController = totalPersonaController; + } + + public TgeneCountry getPais() { + return pais; + } + + public void setPais(TgeneCountry pais) { + this.pais = pais; + } + + public List getLciudades() { + return lciudades; + } + + public void setLciudades(List lciudades) { + this.lciudades = lciudades; + } + + public TgeneCity getCiudad() { + return ciudad; + } + + public void setCiudad(TgeneCity ciudad) { + this.ciudad = ciudad; + } + + public List getArmas() { + return armas; + } + + public void setArmas(List armas) { + this.armas = armas; + } + + public List getTotalesPersoan() { + return totalesPersoan; + } + + public void setTotalesPersoan(List totalesPersoan) { + this.totalesPersoan = totalesPersoan; + } + + public TgeneCatalogDetail getTipoDocumento() { + return tipoDocumento; + } + + public void setTipoDocumento(TgeneCatalogDetail tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public List getTiposRegistro() { + return tiposRegistro; + } + + public void setTiposRegistro(List tiposRegistro) { + this.tiposRegistro = tiposRegistro; + } + + public TgeneCatalogDetail getTipoRegistro() { + return tipoRegistro; + } + + public void setTipoRegistro(TgeneCatalogDetail tipoRegistro) { + this.tipoRegistro = tipoRegistro; + } + + public List getLpaises() { + return lpaises; + } + + public void setLpaises(List lpaises) { + this.lpaises = lpaises; + } + + public List getLprovincias() { + return lprovincias; + } + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + public TarmRegistroArmas getRegistro() { + return registro; + } + + public void setRegistro(TarmRegistroArmas registro) { + this.registro = registro; + } + + public List getLaeropuertos() { + return laeropuertos; + } + + public void setLaeropuertos(List laeropuertos) { + this.laeropuertos = laeropuertos; + } + + public List getLdocumentospersona() { + return ldocumentospersona; + } + + public void setLdocumentospersona( + List ldocumentospersona) { + this.ldocumentospersona = ldocumentospersona; + } + + public String getClase() { + return clase; + } + + public void setClase(String clase) { + this.clase = clase; + } + + public Integer getPersoncode() { + return personcode; + } + + public void setPersoncode(Integer personcode) { + this.personcode = personcode; + } + + public InventarioSubidoController getInventarioSubidoController() { + return inventarioSubidoController; + } + + public void setInventarioSubidoController( + InventarioSubidoController inventarioSubidoController) { + this.inventarioSubidoController = inventarioSubidoController; + } + + + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/IngresoInventarioController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/IngresoInventarioController.java.svn-base new file mode 100644 index 0000000..51f085d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/IngresoInventarioController.java.svn-base @@ -0,0 +1,1715 @@ +package com.fp.frontend.controller.armas.parametros; + + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.annotation.PostConstruct; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletResponse; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.ArmaExcell; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.funcionalidad.TotalArmasController; +import com.fp.frontend.controller.armas.solicitud.ArmasController; +import com.fp.frontend.controller.armas.solicitud.DocumentoHabilitanteController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.fun.TarmInventarioSubidoPorPersona; +import com.fp.persistence.parmas.fun.TarmInventarioSubidoPorPersonaKey; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +//import com.fp.persistence.parmas.param.TarmComercianteCupo; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmUnidadTipo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + + + +/** + * @author Andres Cevallos + * Clase Controladora para la entidad TarmArma + * Incluye metodo de consulta para la busqueda de persona y registro + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class IngresoInventarioController extends AbstractController { + + //Variabgles globales + private Integer personcode; + + private Boolean descargar; + private String csolicitud; + InputStream filei; + + //Datos generales + private TgeneCatalogDetail tipoDocumento; + private TcustPersonDetail detallesPersona; + + Date fechaActual; + private List tiposRegistro; + private TgeneCatalogDetail tipoRegistro; + + //Detalle del material + //Pais + private List lpaises; + private TgeneCountry pais; + //private String pais; + + //Provincia + private List lprovincias; + private String codigoProvincia; + + //Canton + private List lcantones; + private String codigoCanton; + + //Ciudad + private List lciudades; + private TgeneCity ciudad; + + //Registro armas + TarmRegistroArmas registro=new TarmRegistroArmas(); + + //Variables de las armas + private TcustPersonDetail usuario; + private TcustPersonAddress direccion; + private List listaFilas; + private List listaErrores; +// private List cuposArmas; + + //private BigDecimal pesoTotal; + private TarmTipoArmaExplosivo tipoArmaExplosivo; + private List listaArmas; + private ArmaExcell armaexcell; + + private List laexel; + private List armas=new ArrayList(); + private List totalesPersoan=new ArrayList(); + + //Aeropuertos + List laeropuertos=new ArrayList<>(); + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddressController; + +// @ManagedProperty(value = "#{comercianteCupoController}") +// private ComercianteCupoController comercianteCupoController; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmasController; + + @ManagedProperty(value = "#{totalArmasController}") + private TotalArmasController totalPersonaController; + + @ManagedProperty(value = "#{inventarioSubidoController}") + private InventarioSubidoController inventarioSubidoController; + + private List ldocumentospersona; + + private String clase; + public IngresoInventarioController() throws Exception { + super(TarmArmas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.record=new TarmArmas(); + this.beanalias = "ARMAS"; + this.create(); + + //Globales + descargar=false; + csolicitud=null; + + //Datos generales + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + //Obteniendo los datos de la persona + detallesPersona= PersonDetailController.find(String.valueOf(usuario.getPk().getPersoncode())); + + //Tipo de documento + tipoDocumento = CatalogDetailController.findxCodigoCodcatalogo(detallesPersona.getIdentificationcatalog(),detallesPersona.getIdentificationcatalogcode()); + + //Fecha actual + this.fechaActual=Calendar.getInstance().getTime(); + + //Tipos de registro + ListtiposRegistroAux = CatalogDetailController.find("TIPOREGISTRO", "REG"); + tiposRegistro = new ArrayList(); + for(TgeneCatalogDetail tipoReg : tiposRegistroAux){ + if(tipoReg.getPk().getCatalog().equalsIgnoreCase("PRO")){ + tiposRegistro.add(tipoReg); + } + } + + //Detalle del material + lpaises=CountryController.find(); + registro.setFechasolicitud(new java.sql.Date((new Date()).getTime())); + + //Obteniendo la direccion de la persona + String tipoDireccion=""; + + if(detallesPersona!=null){ + switch(detallesPersona.getIdentificationcatalog()){ + case "CED": + tipoDireccion = "1"; + break; + case "RUC": + tipoDireccion= "2"; + break; + default: + tipoDireccion= ""; + break; + } + } + //direccion= personAddressController.findByPersonCode(usuario.getPk().getPersoncode().toString()); + direccion= personAddressController.findPrincipal(String.valueOf(usuario.getPk().getPersoncode().toString())) ; + + + //Imprtacion + this.lprovincias=ProvinceController.find("EC"); + + //Armas + listaErrores = new ArrayList(); + + //Controlador de totales +// this.totalPersonaController=new TotalPersonaController(); +// this.totalPersonaController.create(); +// this.totalPersonaController.setLrecord(new ArrayList()); + + RegistroArmController registroArmas = new RegistroArmController(); + registroArmas.init(); + registroArmas.setRecperpage(3000000); + registroArmas.addFilter("personcode", tsafeUserDetail.getPk().getPersoncode().toString()); + registroArmas.query(); + this.addFilter("estado", "REG"); + filtro(registroArmas.getLrecord()); + + //Obteniendo los aeropuertos + this.laeropuertos=CatalogDetailController.find("AEROPUERTOS"); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TarmTipoArmaExplosivo","clase","cclase","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo= new SubQuery("TarmTipoArmaExplosivo","clasecodigo","cclasecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud= new SubQuery("TarmTipoArmaExplosivo","longitud","clongitud","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo= new SubQuery("TarmTipoArmaExplosivo","longitudcodigo","clongitudcodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ccalibre","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo= new SubQuery("TarmTipoArmaExplosivo","calibrecodigo","ccalibrecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivo","ctipoarmaexplosivo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivocodigo","ctipoarmaexplosivocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapeso","cunidadmedidapeso","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapesocodigo","cunidadmedidapesocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + + Filter filtrofecha=new Filter(); + filtrofecha.setSql("t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) and t.estado !='DEST' and t.estado !='CDP'"); + dto.addFiltro(filtrofecha); + dto.setOrderby("pk"); + String sql=csolicitud; + if(csolicitud!=null){ + Filter filtro = new Filter(); + filtro.setSql(sql); + dto.addFiltro(filtro); + } + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + public void querydatabaseMarcaSerie(String cregistro,String marca, String serie) { + try { + + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TarmTipoArmaExplosivo","clase","cclase","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo= new SubQuery("TarmTipoArmaExplosivo","clasecodigo","cclasecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud= new SubQuery("TarmTipoArmaExplosivo","longitud","clongitud","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo= new SubQuery("TarmTipoArmaExplosivo","longitudcodigo","clongitudcodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ccalibre","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo= new SubQuery("TarmTipoArmaExplosivo","calibrecodigo","ccalibrecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivo","ctipoarmaexplosivo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivocodigo","ctipoarmaexplosivocodigo","i.pk=t.ctipoarmaexplosivo");// and i.clase='" + clase + "' and i.tipoarmaexplosivo='" + tipoArmaExplosivo + "'"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapeso","cunidadmedidapeso","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapesocodigo","cunidadmedidapesocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + + + Filter filtrofecha=new Filter(); + filtrofecha.setSql("t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) " + + " and t.estado !='DEST' and t.estado !='CDP' and t.lote " + (serie==null?" is null":("= '" + serie + "'")) + " and t.cregistro= '" + + cregistro + "' and t.marca " + (marca==null?" is null":("= '" + marca + "'"))); + dto.addFiltro(filtrofecha); + dto.setOrderby("pk"); +/* String sql=csolicitud; + if(csolicitud!=null){ + Filter filtro = new Filter(); + filtro.setSql(sql); + dto.addFiltro(filtro); + }*/ + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + +/* Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE");*/ + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecOked") + protected void querydatabaseSimple() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql=" t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para armar el registro + * @param lsolicitud + */ + public void filtro(List lsolicitud){ + + for(TarmRegistroArmas soli : lsolicitud){ + if(csolicitud==null){ + csolicitud="(cregistro="+soli.getPk(); + } + else{ + csolicitud+=" or cregistro="+soli.getPk(); + } + } + csolicitud+=")"; + + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + + DtoSave dtosave = super.getDtoSave(true); + dtosave.setPosition(2); + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); + + registroArmasController.clearAll(); + DtoSave dtosaveregistroarma = registroArmasController.getDtoSave(true); + dtosaveregistroarma.setPosition(1); + msave.put(registroArmasController.getBeanalias(), dtosaveregistroarma); + + totalPersonaController.clearAll(); + DtoSave dtosavetotalper = totalPersonaController.getDtoSave(true); + dtosavetotalper.setPosition(3); + msave.put(totalPersonaController.getBeanalias(), dtosavetotalper); + + DtoSave dtoInventarioSubido = inventarioSubidoController.getDtoSave(true); + dtoInventarioSubido.setPosition(4); + msave.put(inventarioSubidoController.getBeanalias(), dtoInventarioSubido); + + request.setSaveTables(msave); + request.getModifiedData().put("LISTAARMAS", this.armas); + request.getModifiedData().put("LISTATOTALES", this.totalesPersoan); + request.getModifiedData().put("REGISTRO", this.registro); + + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.registroArmasController.postCommit(resp); + this.totalPersonaController.postCommit(resp); + this.inventarioSubidoController.postCommit(resp); + //this.totalPersonaController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + + /** + * Metodo que carga y valida el contenido de un archivo excel con información de armas + * @param event + */ + public void cargarArchivo(FileUploadEvent event){ + + HashMap mapaTotalesTemporales = new HashMap<>(); + int f1=0; + try { + // Verifico si ya se hizo una carga de inventario previa para al clase seleccionada + List inventarioPrevioIngresadoLst = InventarioSubidoController.findXPersonaYClase(this.usuario.getPk().getPersoncode().toString(), clase); + if(inventarioPrevioIngresadoLst!=null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_inventarioCargadoPreviamente")); + return; + }else{ + TarmInventarioSubidoPorPersonaKey pkInventarioSubidoObj = new TarmInventarioSubidoPorPersonaKey(); + pkInventarioSubidoObj.setPersoncode(this.usuario.getPk().getPersoncode()); + pkInventarioSubidoObj.setClase(clase); + TarmInventarioSubidoPorPersona inventarioSubidoObj = new TarmInventarioSubidoPorPersona(); + inventarioSubidoObj.setPk(pkInventarioSubidoObj); + java.util.Date today = new java.util.Date(); + java.sql.Timestamp fechaReporte = new java.sql.Timestamp(today.getTime()); + inventarioSubidoObj.setFechacarga(fechaReporte); + inventarioSubidoObj.setIsnew(Boolean.TRUE); + inventarioSubidoController.update(inventarioSubidoObj); + } + + //Completando los datos del registro + this.registro.setPersoncode(this.usuario.getPk().getPersoncode()); + this.registro.setTiporegistrocodigo("TIPOREGISTRO"); + this.registro.setFechasolicitud(new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + //Inicializando las listas + listaFilas=new ArrayList(); + listaArmas= new ArrayList(); + listaErrores= new ArrayList(); + //caraga el excel + UploadedFile selectedFile = event.getFile(); + InputStream archivo=selectedFile.getInputstream(); + XSSFWorkbook libro = new XSSFWorkbook(archivo); + XSSFSheet hoja = libro.getSheetAt(0); + //Iterando sobre las filas + int cont=0; + Iterator rowIterator = hoja.iterator(); + //Cargando el contenido de las celdas a una lista de objetos + while(rowIterator.hasNext()) { + cont++; + Row row = rowIterator.next(); + if(cont>1){ + Cell numero=row.getCell(0); + Cell serie=row.getCell(1); + Cell clase=row.getCell(2); + Cell longitud=row.getCell(3); + Cell tipo=row.getCell(4); + Cell calibre=row.getCell(5); + Cell color=row.getCell(6); + Cell marca=row.getCell(7); + Cell cantidad=row.getCell(8); + Cell umcantidad=row.getCell(9); + Cell peso=row.getCell(10); + Cell umpeso=row.getCell(11); + Boolean filaEnBlanco=false; + if(this.celdaVacia(numero) && this.celdaVacia(serie) && this.celdaVacia(clase) + && this.celdaVacia(longitud) && this.celdaVacia(tipo) && this.celdaVacia(calibre) + && this.celdaVacia(color) && this.celdaVacia(marca) && this.celdaVacia(cantidad) + && this.celdaVacia(umcantidad) && this.celdaVacia(peso) && this.celdaVacia(umpeso)){ + filaEnBlanco=true; + }else{ + listaFilas.add(row); + } + if(!filaEnBlanco){ + //arma la lista de las armas en un dto aniade en la lista listaArmas + armarlistaArmasExcel(numero, serie, clase, longitud, tipo, calibre, color, marca, cantidad, umcantidad, peso, umpeso, row); + } + } + } + //Verificando las filas duplicadas en el archivo + verificarFilasDuplicadas(listaArmas); + if(this.registro.getTiporegistro().equals("PRO")){ + //Verificando las filas duplicadas en la BD + verificarArmasExistentesEnBaseDeDatos(listaArmas, this.usuario.getPk().getPersoncode()); + } + Boolean contieneSerie=false; + //RECORRE LA LISTA DE LAS ARMAS y valida el CUPO DEL ARMA + //Validando los campos requeridos que estan vacios + recorreListaArmasExcel(contieneSerie,f1,mapaTotalesTemporales); + //Seteando los atributos de las armas y totales si no hay ningun error + if(listaErrores.isEmpty()){ + for (int i = 0; i < listaArmas.size(); i++) { + if(!listaArmas.get(i).getCamposIncompletos() && !listaArmas.get(i).getDuplicada() && listaArmas.get(i).getExisteCatalogo() + && listaArmas.get(i).getExisteTARMTIPOARMAEXPLOSIVO()){ //&& !listaArmas.get(i).getCupoInsuficiente() + //Marca + if(listaArmas.get(i).getCatalogoMarca()!=null){ + listaArmas.get(i).getArma().setMarcacodigo("MARCA"); + listaArmas.get(i).getArma().setMarca(listaArmas.get(i).getCatalogoMarca().getPk().getCatalog()); + } + //Color + if(listaArmas.get(i).getCatalogoColor()!=null){ + listaArmas.get(i).getArma().setColorcodigo("COLOR"); + listaArmas.get(i).getArma().setColor(listaArmas.get(i).getCatalogoColor().getPk().getCatalog()); + } + //Unidad medida cantidad + if(listaArmas.get(i).getTipoArmaExplosivo()!=null){ + listaArmas.get(i).getArma().setUnidadmedidacantidadcodigo("UNIDADMEDIDA"); + Double doubleNum=0.0; + //Cargando el catalodo del tipo de unidad de medida + if(listaArmas.get(i).getUnidadMedidaCantidad()!=null && !listaArmas.get(i).getUnidadMedidaCantidad().isEmpty()){ + listaArmas.get(i).getArma().setUnidadmedidacantidad(listaArmas.get(i).getUnidadMedidaCantidad()); + doubleNum=Double.parseDouble(listaArmas.get(i).getTextoCantidad()); + //Cantidad + Integer intNum=(int)doubleNum.doubleValue(); + listaArmas.get(i).getArma().setCantidad(intNum); + }else if(listaArmas.get(i).getUnidadMedidaPeso()!=null && !listaArmas.get(i).getUnidadMedidaPeso().isEmpty()){ + listaArmas.get(i).getArma().setUnidadmedidacantidad(listaArmas.get(i).getUnidadMedidaPeso()); + doubleNum=Double.parseDouble(listaArmas.get(i).getTextoPeso()); + //Peso + listaArmas.get(i).getArma().setPeso(new BigDecimal(doubleNum)); + } + } + //Estado DEL ARMA + listaArmas.get(i).getArma().setEstado("REG"); + listaArmas.get(i).getArma().setEstadocodigo("ESTADOARMA"); + if(direccion!=null){ + //Codigo de pais + listaArmas.get(i).getArma().setCountrycode(direccion.getCountrycode()); + //Codigo de provincia + listaArmas.get(i).getArma().setProvincecode(direccion.getProvincecode()); + //Codigo de canton + listaArmas.get(i).getArma().setCantoncode(direccion.getCantoncode()); + //Codigo de parroquia + listaArmas.get(i).getArma().setParroquiacode(direccion.getParroquiacode()); + //Codigo de ciudad + listaArmas.get(i).getArma().setCitycode(direccion.getCitycode()); + } + //Lote + listaArmas.get(i).getArma().setLote(listaArmas.get(i).getSerie()); + //Peso + if(listaArmas.get(i).getTextoPeso()!=null && !listaArmas.get(i).getTextoPeso().isEmpty()){ + listaArmas.get(i).getArma().setPeso(BigDecimal.valueOf(Double.parseDouble(listaArmas.get(i).getTextoPeso()))); + } + //Direccion + listaArmas.get(i).getArma().setDireccion(direccion.getAddress()); + + //Fecha de registro + listaArmas.get(i).getArma().setFecharegistro(new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + + //Tipo de arma explosivo + if(listaArmas.get(i).getTipoArmaExplosivo()!=null){ + listaArmas.get(i).getArma().setCtipoarmaexplosivo(listaArmas.get(i).getTipoArmaExplosivo().getPk()); + } + armas.add(listaArmas.get(i).getArma()); + } + } + //Se rrecorre el mapa HashMap mapaTotalesTemporales + for (TarmTotalPersona value : mapaTotalesTemporales.values()) { + totalesPersoan.add(value); + } + save(); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + }finally{ + if (!listaErrores.isEmpty()) { + listaArmas.clear(); + MessageHelper.setMessageError("ERRORES ENCONTRADOS DENTRO DEL ARCHIVO EXCEL: ");// + errores.toString()); + descargar=true; + }else{ + MessageHelper.setMessageInfo("ARCHIVO CARGADO EXITOSAMENTE"); + descargar=false; + } + } + } + /** + * Metodo para cargar los valores del EXCEL EN UNA CLASE DTO(ArmaExcell ) + * @param numero * @param serie * @param clase * @param longitud * @param tipo * @param calibre + * @param color * @param marca * @param cantidad * @param umcantidad * @param peso * @param umpeso * @param row + */ + public void armarlistaArmasExcel(Cell numero,Cell serie,Cell clase,Cell longitud,Cell tipo,Cell calibre,Cell color,Cell marca, + Cell cantidad,Cell umcantidad,Cell peso,Cell umpeso,Row row){ + ArmaExcell arma=new ArmaExcell(); + arma.setTextoNumero(Utilidades.setearValorCelda(numero));//Numero + arma.setSerie(Utilidades.setearValorCelda(serie));//Serie + arma.setClase(Utilidades.setearValorCelda(clase));//Clase + arma.setLongitud(Utilidades.setearValorCelda(longitud));//Longitud + arma.setTipo(Utilidades.setearValorCelda(tipo));//Tipo + arma.setCalibre(Utilidades.setearValorCelda(calibre));//Calibre + arma.setColor(Utilidades.setearValorCelda(color));//Color + arma.setMarca(Utilidades.setearValorCelda(marca));//Marca + arma.setTextoCantidad(Utilidades.setearValorCelda(cantidad));//Cantidad + arma.setUnidadMedidaCantidad(Utilidades.setearValorCelda(umcantidad));//U. Medida Cantidad + arma.setTextoPeso(Utilidades.setearValorCelda(peso));//Peso + arma.setUnidadMedidaPeso(Utilidades.setearValorCelda(umpeso));//U. Medida Peso + + // El ingreso de inventario sera para todas las clases excepto armas de fuego y armas no letales + if(!arma.getClase().equalsIgnoreCase("ARMA DE FUEGO") && !arma.getClase().equalsIgnoreCase("ARMAS NO LETALES")){ + listaArmas.add(arma); + }else { + listaErrores.add("Fila "+row.getRowNum()+": "+"Columna clase: "+MsgControlArmas.getProperty("msg_inventarioNoArmasFuegoNiNoLetales")); + return; + } + } + + /** + * Metodo que verifica si existen filas duplicadas en el archivo de excell + * @param listaArmas + */ + private void verificarFilasDuplicadas(List listaArmas){ + for (int i = 0; i < listaArmas.size()-1; i++) { + for (int j = i+1; j < listaArmas.size(); j++) { + if(!this.registro.getTiporegistro().equalsIgnoreCase("IMP") && ((listaArmas.get(i).getSerie().equalsIgnoreCase(listaArmas.get(j).getSerie())) + && listaArmas.get(i).getClase().equalsIgnoreCase(listaArmas.get(j).getClase()) + && listaArmas.get(i).getTipo().equalsIgnoreCase(listaArmas.get(j).getTipo()) + && (!listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego") + || (listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego") && listaArmas.get(j).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")) + && listaArmas.get(i).getCalibre().equalsIgnoreCase(listaArmas.get(j).getCalibre())) + && listaArmas.get(i).getMarca().equalsIgnoreCase(listaArmas.get(j).getMarca()))){ + listaArmas.get(j).setDuplicada(true); + break; + } + } + } + } + + /** + * @param listaArmas + * @throws Exception + */ + @SuppressWarnings("static-access") + private void verificarArmasExistentesEnBaseDeDatos(List listaArmas, Integer codigoPersona) throws Exception{ + TgeneCatalogDetail codigoClase = new TgeneCatalogDetail(); + TgeneCatalogDetail codigoMarca = new TgeneCatalogDetail(); + TgeneCatalogDetail codigoTipo = new TgeneCatalogDetail(); + TgeneCatalogDetail codigoCalibre = new TgeneCatalogDetail(); + String codigoSerie; + List lstRegistroArmas = registroArmasController.findxPersoncode(String.valueOf(codigoPersona)); + if(lstRegistroArmas==null || listaArmas==null || lstRegistroArmas.isEmpty() || listaArmas.isEmpty()){ + return; + } + for (int i = 0; i < listaArmas.size(); i++) { + codigoClase=CatalogDetailController.findByCatalogcodeDescrption("CLASE", listaArmas.get(i).getClase()); + codigoTipo=CatalogDetailController.findByCatalogcodeDescrption("TIPOARMAEXPLOSIVO", listaArmas.get(i).getTipo()); + codigoMarca=CatalogDetailController.findByCatalogcodeDescrption("MARCA", listaArmas.get(i).getMarca()); + codigoSerie = this.registro.getTiporegistro().equalsIgnoreCase("IMP")?null:listaArmas.get(i).getSerie(); + codigoCalibre=listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")?CatalogDetailController.findByCatalogcodeDescrption("CALIBRE",listaArmas.get(i).getCalibre()):null; + + if((codigoClase==null && (listaArmas.get(i).getClase()!=null && !listaArmas.get(i).getClase().trim().isEmpty())) || (codigoTipo==null && (listaArmas.get(i).getTipo()!=null && !listaArmas.get(i).getTipo().trim().isEmpty())) + || (codigoMarca==null && (listaArmas.get(i).getMarca()!=null && !listaArmas.get(i).getMarca().trim().isEmpty())) || (codigoSerie==null && (listaArmas.get(i).getSerie()!=null && !listaArmas.get(i).getSerie().trim().isEmpty())) + || (codigoCalibre==null && (listaArmas.get(i).getCalibre()!=null && !listaArmas.get(i).getCalibre().trim().isEmpty())) + || listaArmas.get(i).getClase()==null || listaArmas.get(i).getMarca()==null || listaArmas.get(i).getCalibre()==null + || listaArmas.get(i).getClase().isEmpty() || listaArmas.get(i).getMarca().isEmpty() || listaArmas.get(i).getCalibre().isEmpty()){ + continue; + } + for(TarmRegistroArmas registroArmas :lstRegistroArmas){ + List lstArmasEncontradas = findByMarcaSerie(String.valueOf(registroArmas.getPk()),codigoMarca.getPk().getCatalog(), codigoSerie); + if(lstArmasEncontradas!=null){ + for(TarmArmas armas:lstArmasEncontradas){ + TarmTipoArmaExplosivo tipoArma = TiposArmasExplosivosController.findarma(armas.getCtipoarmaexplosivo()); + if(tipoArma.getClase().equalsIgnoreCase(codigoClase.getPk().getCatalog()) && codigoCalibre!=null?tipoArma.getCalibre().equalsIgnoreCase(codigoCalibre.getPk().getCatalog()):true && tipoArma.getTipoarmaexplosivo().equalsIgnoreCase(codigoTipo.getPk().getCatalog())){ + listaArmas.get(i).setDuplicada(true); + break; + } + } + } + } + } + } + /** + * Metodo que recorre la lista de las armas con los valores cargados del EXCEL + * @param contieneSerie + * @param f1 + * @param mapaTotalesTemporales + */ + public void recorreListaArmasExcel(Boolean contieneSerie, int f1,HashMap mapaTotalesTemporales){ + for (int i = 0; i < listaArmas.size(); i++) { + Integer fila=i+1; + f1=i; + Boolean campoCantidad=false; + //0-Datos duplicados + if(listaArmas.get(i).getDuplicada()){ + listaErrores.add("Fila "+fila.toString()+": "+MsgControlArmas.getProperty("msg_datosDuplicados")); + } + //1-Serie + //Validando que si el tipo de registro es de importacion + //las armas no contengan numero de serie + if(this.registro.getTiporegistro().equalsIgnoreCase("IMP") && (listaArmas.get(i).getSerie()!=null) && !contieneSerie){ + contieneSerie=true; + listaErrores.add(MsgControlArmas.getProperty("msg_archivoImportacionSerie")); + } + if(!this.registro.getTiporegistro().equalsIgnoreCase("IMP") && (listaArmas.get(i).getSerie()==null || listaArmas.get(i).getSerie().trim().isEmpty())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 1: "+MsgControlArmas.getProperty("msg_serieVacia")); + listaArmas.get(i).setCamposIncompletos(true); + } + //2-Clase + if(listaArmas.get(i).getClase()==null || listaArmas.get(i).getClase().trim().isEmpty()){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 2: "+MsgControlArmas.getProperty("msg_claseVacia")); + listaArmas.get(i).setCamposIncompletos(true); + + //3-Validando que cuando la clase sea ARMA DE FUEGO la longitud no este vacia + }else if(listaArmas.get(i).getClase().equalsIgnoreCase("ARMA DE FUEGO") + && (listaArmas.get(i).getLongitud()==null || listaArmas.get(i).getLongitud().trim().isEmpty())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 3: "+MsgControlArmas.getProperty("msg_longitudVacia")); + listaArmas.get(i).setCamposIncompletos(true); + + //Validando que cuando la clase no sea ARMA DE FUEGO la longitud este vacia + }else if(!listaArmas.get(i).getClase().equalsIgnoreCase("ARMA DE FUEGO") + && (listaArmas.get(i).getLongitud()!=null && !listaArmas.get(i).getLongitud().trim().isEmpty())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 3: "+MsgControlArmas.getProperty("msg_longitudNoVacia")); + } + //Carga de catalogos + TgeneCatalogDetail catalogoClase=CatalogDetailController.findByCatalogcodeDescrption("CLASE", listaArmas.get(i).getClase()); + listaArmas.get(i).setCatalogoClase(catalogoClase); + if(catalogoClase!=null && catalogoClase.getPk()!=null && catalogoClase.getPk().getCatalog()!=null && !clase.contains(catalogoClase.getPk().getCatalog())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 2: "+" No tiene permiso para cargar "+catalogoClase.getDescription()); + listaArmas.get(i).setCamposIncompletos(true); + }else if(catalogoClase==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 2: "+" No tiene ingresado una Clase V\u00e1lida "); + listaArmas.get(i).setCamposIncompletos(true); + } + TgeneCatalogDetail catalogoLongitud=CatalogDetailController.findByCatalogcodeDescrption("LONGITUD", listaArmas.get(i).getLongitud()); + listaArmas.get(i).setCatalogoLongitud(catalogoLongitud); + TgeneCatalogDetail catalogoTipoArma=CatalogDetailController.findByCatalogcodeDescrption("TIPOARMAEXPLOSIVO", listaArmas.get(i).getTipo()); + listaArmas.get(i).setCatalogoTipoArma(catalogoTipoArma); + TgeneCatalogDetail catalogoCalibre=CatalogDetailController.findByCatalogcodeDescrption("CALIBRE", listaArmas.get(i).getCalibre()); + listaArmas.get(i).setCatalogoCalibre(catalogoCalibre); + TgeneCatalogDetail catalogoColor=CatalogDetailController.findByCatalogcodeDescrption("COLOR", listaArmas.get(i).getColor()); + listaArmas.get(i).setCatalogoColor(catalogoColor); + TgeneCatalogDetail catalogoMarca=CatalogDetailController.findByCatalogcodeDescrption("MARCA", listaArmas.get(i).getMarca()); + listaArmas.get(i).setCatalogoMarca(catalogoMarca); + TarmUnidadTipo tipoUnidadSeleccionada =null;// new TarmUnidadTipo(); + if(catalogoClase!=null){ + //Obteniendo la configuracion de TARMUNIDADTIPO + if(!(listaArmas.get(i).getUnidadMedidaCantidad()==null || listaArmas.get(i).getUnidadMedidaCantidad().isEmpty()) && !(listaArmas.get(i).getUnidadMedidaPeso()==null || listaArmas.get(i).getUnidadMedidaPeso().isEmpty())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 9,11: "+MsgControlArmas.getProperty("msg_unidadMedidaSoloUna")); + } + String unidadMedidaIngresada = (listaArmas.get(i).getUnidadMedidaCantidad()==null || listaArmas.get(i).getUnidadMedidaCantidad().isEmpty())?listaArmas.get(i).getUnidadMedidaPeso():listaArmas.get(i).getUnidadMedidaCantidad(); + String columnaUnidadMedidaError = (listaArmas.get(i).getUnidadMedidaCantidad()==null || listaArmas.get(i).getUnidadMedidaCantidad().isEmpty())?"Columna 11":"Columna 9"; + if (listaArmas.get(i).getCatalogoTipoArma() == null) { + listaErrores.add("Fila "+fila.toString()+": "+"Columna 5: El Tipo de Arma Explosivo no existe en el Catlogo. Revise los espacios entre cada palabra y que este bien escrito."); + listaArmas.get(i).setCamposIncompletos(true); + tipoUnidadSeleccionada=null; + }else { + tipoUnidadSeleccionada= UnidadTipoController.findByClaseAndClasecode(catalogoClase.getPk().getCatalog(), catalogoClase.getPk().getCatalogcode(),listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(), unidadMedidaIngresada); + } + if(tipoUnidadSeleccionada!=null && tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()!=null && !tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().isEmpty()){ + if(tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().equalsIgnoreCase("UNIDAD") || tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().equalsIgnoreCase("UNIDADES")){ + campoCantidad=true; + }else if(tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().equalsIgnoreCase("KG")){ + campoCantidad=false; + } + } + else if (tipoUnidadSeleccionada==null){ + listaErrores.add("Fila "+fila.toString()+": "+ columnaUnidadMedidaError + ": " +MsgControlArmas.getProperty("msg_unidadMedidaNoExiste")); + } + } + //4-Tipo + if(listaArmas.get(i).getTipo()==null || listaArmas.get(i).getTipo().trim().isEmpty()){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 4: "+MsgControlArmas.getProperty("msg_tipoVacio")); + listaArmas.get(i).setCamposIncompletos(true); + } + //5-Calibre + if(listaArmas.get(i).getClase()!=null && !listaArmas.get(i).getClase().isEmpty() + && listaArmas.get(i).getClase().equalsIgnoreCase("ARMA DE FUEGO") + && (listaArmas.get(i).getCalibre()==null || listaArmas.get(i).getCalibre().trim().isEmpty())){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 5: "+MsgControlArmas.getProperty("msg_calibreVacio")); + } + //Marca + if(listaArmas.get(i).getMarca()==null || listaArmas.get(i).getMarca().trim().isEmpty()){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 7: "+MsgControlArmas.getProperty("msg_marcaVacia")); + listaArmas.get(i).setCamposIncompletos(true); + } + if(campoCantidad){ + //Cantidad + if((listaArmas.get(i).getTextoCantidad()==null || listaArmas.get(i).getTextoCantidad().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 8: "+MsgControlArmas.getProperty("msg_cantidadVacia")); + listaArmas.get(i).setCamposIncompletos(true); + + }else if(listaFilas.get(i).getCell(8).getCellType()!=Cell.CELL_TYPE_NUMERIC && tipoUnidadSeleccionada!=null){ + //Verificando el tipo de dato numerico + listaErrores.add("Fila "+fila.toString()+": "+"Columna 8: "+MsgControlArmas.getProperty("msg_cantidadValorNumerico")); + } + + //U. Medida Cantidad + if((listaArmas.get(i).getUnidadMedidaCantidad()==null || listaArmas.get(i).getUnidadMedidaCantidad().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 9: "+MsgControlArmas.getProperty("msg_unidadMedidaCantidadVacia")); + } + + //Peso + if((listaArmas.get(i).getTextoPeso()!=null && !listaArmas.get(i).getTextoPeso().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 10: "+MsgControlArmas.getProperty("msg_pesoNoVacio")); + } + + //U. Medida Peso + if((listaArmas.get(i).getUnidadMedidaPeso()!=null && !listaArmas.get(i).getUnidadMedidaPeso().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 11: "+MsgControlArmas.getProperty("msg_unidadMedidaPesoNoVacia")); + } + //Validando que cuando la clase NO sea ARMA DE FUEGO, MUNICION, + //Explosivos, Accesorios, Fuegos Pirotecnicos, Sustancia Quimica, Armas no Letales + //la cantidad y unidad de medida cantidad esten vacios + //y el peso y unidad de medida peso NO esten vacios + }else if(listaArmas.get(i).getClase()!=null && !listaArmas.get(i).getClase().isEmpty()){ + //Cantidad + if((listaArmas.get(i).getTextoCantidad()!=null && !listaArmas.get(i).getTextoCantidad().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 8: "+MsgControlArmas.getProperty("msg_cantidadNoVacia")); + } + //U. Medida Cantidad + if(listaArmas.get(i).getUnidadMedidaCantidad()!=null && !listaArmas.get(i).getUnidadMedidaCantidad().trim().isEmpty() && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 9: "+MsgControlArmas.getProperty("msg_unidadMedidaCantidadNoVacia")); + } + //Peso + if((listaArmas.get(i).getTextoPeso()==null || listaArmas.get(i).getTextoPeso().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 10: "+MsgControlArmas.getProperty("msg_pesoVacio")); + listaArmas.get(i).setCamposIncompletos(true); + + }else if(listaFilas.get(i).getCell(10).getCellType()!=Cell.CELL_TYPE_NUMERIC && tipoUnidadSeleccionada!=null){ + //Verificando el tipo de dato numerico + listaErrores.add("Fila "+fila.toString()+": "+"Columna 10: "+MsgControlArmas.getProperty("msg_pesoValorNumerico")); + } + //U. Medida Peso + if((listaArmas.get(i).getUnidadMedidaPeso()==null || listaArmas.get(i).getUnidadMedidaPeso().trim().isEmpty()) && tipoUnidadSeleccionada!=null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 11: "+MsgControlArmas.getProperty("msg_unidadMedidaPesoVacia")); + listaArmas.get(i).setCamposIncompletos(true); + } + } + //Verificando que no existan problemas en el arma proveniente del archivo EXCEL + //para validar entonces los datos en la base de datos + if(!listaArmas.get(i).getCamposIncompletos() && !listaArmas.get(i).getDuplicada()){ + //Verificando los datos en los catalogos + //Verificando la existencia de la clase en el catalogo + if(catalogoClase==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 2: "+MsgControlArmas.getProperty("msg_calibreNoExisteCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia de la longitud en el catalogo + if(catalogoLongitud==null){ + listaArmas.get(i).setExisteCatalogo(false); + if(listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 3: "+MsgControlArmas.getProperty("msg_longitudNoExisteCatalogo")); + } + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia del tipo de arma en el catalogo + if(catalogoTipoArma==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 4: "+MsgControlArmas.getProperty("msg_noExisteTipoArmaCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia del calibre en el catalogo + if(catalogoCalibre==null){ + listaArmas.get(i).setExisteCatalogo(false); + if(listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 5: "+MsgControlArmas.getProperty("msg_calibreNoExisteCatalogo")); + } + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia del color en el catalogo + if(listaArmas.get(i).getColor()!=null && !listaArmas.get(i).getColor().isEmpty()){ + if(catalogoColor==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 6: "+MsgControlArmas.getProperty("msg_colorNoExisteCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + } + //Verificando la existencia de la marca en el catalogo + if(catalogoMarca==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Columna 7: "+MsgControlArmas.getProperty("msg_marcaNoExisteCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + }else{ + listaArmas.get(i).setExisteCatalogo(true); + } + //Validacio 4- Verificando que exista la combinacion clase, longitud, tipo arma y calibre + //en la tabla TARMTIPOARMAEXPLOSIVO + if(listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")){ + if(catalogoClase!=null && catalogoLongitud!=null && catalogoTipoArma!=null && catalogoCalibre!=null && tipoUnidadSeleccionada!=null){ + tipoArmaExplosivo=TiposArmasExplosivosController.findByClaseLongitudCalibreTipoArma(catalogoLongitud.getPk().getCatalog(), + catalogoCalibre.getPk().getCatalog(), catalogoClase.getPk().getCatalog(), catalogoTipoArma.getPk().getCatalog(),tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + + if(tipoArmaExplosivo==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado: "+listaArmas.get(i).getClase()+", "+listaArmas.get(i).getLongitud()+", "+listaArmas.get(i).getTipo()+", "+listaArmas.get(i).getCalibre()); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + }else{ + listaArmas.get(i).setTipoArmaExplosivo(tipoArmaExplosivo); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(true); + } + }else{ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado la combinaci\u00f3n del Tipo Arma Explosivo"); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } + }else{ + if(catalogoCalibre!=null && catalogoCalibre.getDescription()!=null && !catalogoCalibre.getDescription().equals("")){ + // Caso donde existe calibre + if(catalogoClase!=null && catalogoTipoArma!=null && tipoUnidadSeleccionada!=null){ + tipoArmaExplosivo=TiposArmasExplosivosController.findByClaseCalibreTipoArma(catalogoClase.getPk().getCatalog(), catalogoCalibre.getPk().getCatalog(), catalogoTipoArma.getPk().getCatalog(),tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + if(tipoArmaExplosivo==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado: "+listaArmas.get(i).getClase()+", "+listaArmas.get(i).getTipo()); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + }else{ + listaArmas.get(i).setTipoArmaExplosivo(tipoArmaExplosivo); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(true); + } + }else{ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado la combinaci\u00f3n del Tipo Arma Explosivo "); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } + } + else{ + // Caso donde no existe calibre + if(catalogoClase!=null && catalogoTipoArma!=null && tipoUnidadSeleccionada!=null){ + tipoArmaExplosivo=TiposArmasExplosivosController.findByClaseTipo(catalogoClase.getPk().getCatalog(), catalogoTipoArma.getPk().getCatalog(),tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + if(tipoArmaExplosivo==null){ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado: "+listaArmas.get(i).getClase()+", "+listaArmas.get(i).getTipo()); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + }else{ + listaArmas.get(i).setTipoArmaExplosivo(tipoArmaExplosivo); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(true); + } + }else{ + listaErrores.add("Fila "+fila.toString()+": "+"Registro no encontrado la combinaci\u00f3n del Tipo Arma Explosivo "); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } + } + + } + if(listaArmas.get(i).getCatalogoClase()!=null && listaArmas.get(i).getCatalogoTipoArma()!=null && listaArmas.get(i).getCatalogoMarca()!=null){ + TarmArmas armaBD; + //Si el tipo de registro es de Importacion, el arma se persiste como nueva + //no se busca en la base de datos + if(this.registro.getTiporegistro().equalsIgnoreCase("IMP")){ + listaArmas.get(i).setExisteBaseDatos(false); + armaBD=new TarmArmas(); + armaBD.setIsnew(true); + }else{ + //Verificando que el arma exista en la base de datos + //si el tipo de registro es de produccion + armaBD=ArmasController.findBySerieMarca(listaArmas.get(i).getSerie(), listaArmas.get(i).getCatalogoMarca().getPk().getCatalog()); + if(armaBD==null){ + listaArmas.get(i).setExisteBaseDatos(false); + armaBD=new TarmArmas(); + armaBD.setIsnew(true); + }else{ + List listaExplosivos=TiposArmasExplosivosController.findByClaseTipoAll(listaArmas.get(i).getCatalogoClase().getPk().getCatalog(), + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog()); + if(listaExplosivos==null){ + listaArmas.get(i).setExisteBaseDatos(false); + }else{ + listaArmas.get(i).setExisteBaseDatos(false); + for (TarmTipoArmaExplosivo explosivo : listaExplosivos) { + if(explosivo.getPk().equalsIgnoreCase(armaBD.getCtipoarmaexplosivo())){ + listaArmas.get(i).setExisteBaseDatos(true); + armaBD.setIsnew(false); + break; + } + } + } + } + } + listaArmas.get(i).setArma(armaBD); + String unidadTipoIngresada = campoCantidad?listaArmas.get(i).getUnidadMedidaCantidad():listaArmas.get(i).getUnidadMedidaPeso(); + // CARGA EL CUPO ***** //persona,clase,tipoarmaexplosivo +// List cupo =ComercianteCupoController.findByPersonCode(usuario.getPk().getPersoncode().toString(), +// listaArmas.get(i).getCatalogoClase().getPk().getCatalog(), listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(), +// unidadTipoIngresada); +// +// if(cupo!=null && !cupo.isEmpty() && cupo.get(0).getTiporegistro().equalsIgnoreCase(this.registro.getTiporegistro())){ + //metodo de los TOTALES SETEADOS EN UN MAPA + cupoArmasExplosivos(i, mapaTotalesTemporales, fila,tipoUnidadSeleccionada); +// }else{ +// if(cupo==null || cupo.isEmpty()){ +// listaErrores.add("Fila "+fila.toString()+": Cupo no asignado para "+listaArmas.get(i).getClase()+"."); +// } +// else{ +// listaErrores.add("Fila "+fila.toString()+": Cupo no disponible para "+listaArmas.get(i).getClase()+"."); +// } +// listaArmas.get(i).setCupoInsuficiente(true); +// } + } + } + tipoUnidadSeleccionada = null; + } + } + + public void cupoArmasExplosivos(int i,HashMap mapaTotalesTemporales,Integer fila,TarmUnidadTipo tipoUnidadSeleccionada){ + + BigDecimal saldoPasaraaAnterior = new BigDecimal(0); + TarmTotalPersona totalPersona=null; + + if(mapaTotalesTemporales.get(usuario.getPk().getPersoncode().toString()+ "|" + listaArmas.get(i).getCatalogoClase().getPk().getCatalog() + + "|" + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog())==null){ + totalPersona =TotalPersonaController.findMaxFecha(listaArmas.get(i).getCatalogoClase().getPk().getCatalog(), + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(), usuario.getPk().getPersoncode().toString(), + tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + if(totalPersona==null){ + totalPersona=new TarmTotalPersona(); + totalPersona.setTotal(new BigDecimal(0)); + }else{ + saldoPasaraaAnterior = (totalPersona==null?new BigDecimal(0):totalPersona.getTotal()); + } + BigDecimal peso = (listaArmas==null || listaArmas.get(i).getTextoPeso()==null || listaArmas.get(i).getTextoPeso().isEmpty())?new BigDecimal(0.0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoPeso())); + BigDecimal cantidad = (listaArmas==null || listaArmas.get(i).getTextoCantidad()==null || listaArmas.get(i).getTextoCantidad().isEmpty())?new BigDecimal(0.0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())); + totalPersona.setCantidadmovimiento(cantidad.add(peso)); + totalPersona.setTotal(new BigDecimal(0));//saldoPasaraaAnterior.add((listaArmas==null || listaArmas.get(i).getTextoCantidad()==null)?new BigDecimal(0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())))); + Double suma=0.0; + //Cantidad + if(listaArmas.get(i).getUnidadMedidaCantidad()!=null && !listaArmas.get(i).getUnidadMedidaCantidad().isEmpty()){ + listaArmas.get(i).setCantidad(Double.parseDouble(listaArmas.get(i).getTextoCantidad())); + totalPersona.setUnidadmedidapeso(listaArmas.get(i).getUnidadMedidaCantidad()); + //suma eltotal anterior + la cantidad a ingresar + suma=saldoPasaraaAnterior.doubleValue()+listaArmas.get(i).getCantidad(); + totalPersona.setTotal(new BigDecimal(suma)); + //Peso + }else if(listaArmas.get(i).getUnidadMedidaPeso()!=null && !listaArmas.get(i).getUnidadMedidaPeso().isEmpty()){ + listaArmas.get(i).setPeso(Double.parseDouble(listaArmas.get(i).getTextoPeso())); + totalPersona.setUnidadmedidapeso(listaArmas.get(i).getUnidadMedidaPeso()); + //suma eltotal anterior + la cantidad a ingresar + suma=saldoPasaraaAnterior.doubleValue()+listaArmas.get(i).getPeso(); + totalPersona.setTotal(new BigDecimal(suma)); + } + } + else{//existe la combinacion + totalPersona = mapaTotalesTemporales.get(usuario.getPk().getPersoncode().toString()+ "|" + listaArmas.get(i).getCatalogoClase().getPk().getCatalog()+ "|" + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog()); + BigDecimal peso = (listaArmas==null || listaArmas.get(i).getTextoPeso()==null || listaArmas.get(i).getTextoPeso().isEmpty())?new BigDecimal(0.0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoPeso())); + BigDecimal cantidad = (listaArmas==null || listaArmas.get(i).getTextoCantidad()==null || listaArmas.get(i).getTextoCantidad().isEmpty())?new BigDecimal(0.0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())); + totalPersona.setCantidadmovimiento(cantidad.add(peso).add(totalPersona.getCantidadmovimiento())); + totalPersona.setTotal(totalPersona.getSaldoanterior().add(totalPersona.getCantidadmovimiento()));//saldoPasaraaAnterior.add((listaArmas==null || listaArmas.get(i).getTextoCantidad()==null)?new BigDecimal(0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())))); + saldoPasaraaAnterior=totalPersona.getSaldoanterior(); + } + totalPersona.setPk(null); + totalPersona.setPersoncodigo(usuario.getPk().getPersoncode()); + totalPersona.setClase(listaArmas.get(i).getCatalogoClase().getPk().getCatalog()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setIngresoegreso("ING"); + totalPersona.setCarma(listaArmas.get(i).getArma().getPk()); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setFecha(new java.sql.Timestamp(new Date().getTime())); + totalPersona.setSaldoanterior(saldoPasaraaAnterior==null?new BigDecimal(0):saldoPasaraaAnterior); + totalPersona.setIsnew(true); + //Verificando si el usuario tiene cupo disponible para el arma + + //mapa con el nuevo total por clase tipo unidad + mapaTotalesTemporales.put(usuario.getPk().getPersoncode().toString()+ "|" + listaArmas.get(i).getCatalogoClase().getPk().getCatalog()+ "|" + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(),totalPersona); + listaArmas.get(i).setTotalPersona(totalPersona); + //Verificando que el la suma del total con la cantidad de armas + //no sea mayor que el cupo +// if(totalPersona.getTotal().doubleValue()>cupoMaximo){ +// listaErrores.add("Fila "+fila.toString()+": Cupo no disponible para "+listaArmas.get(i).getClase()); +// listaArmas.get(i).setCupoInsuficiente(true); +// }else{ +// //Actualizando el valor del total y del total anterior +// listaArmas.get(i).getTotalPersona().setSaldoanterior(listaArmas.get(i).getTotalPersona().getSaldoanterior()); +// listaArmas.get(i).getTotalPersona().setTotal(totalPersona.getTotal()); +// } + } + + /** + * Metodo que indica cuando una celda esta vacia + * @param celda + * @return + */ + public Boolean celdaVacia(Cell celda){ + Boolean vacia=false; + if(celda==null || celda.getCellType()==Cell.CELL_TYPE_BLANK || (celda.getCellType()==Cell.CELL_TYPE_STRING && celda.getStringCellValue().isEmpty())){ + vacia=true; + } + return vacia; + } + + /** + * + * @param codigopersona + * @return + */ + public static TarmArmas findBySerieMarca(String serie, String marca) { + try { + IngresoInventarioController cc = new IngresoInventarioController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("lote", serie); + cc.addFilter("marca", marca); + cc.querydatabaseSimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + + /** + * + * Metodo para encontrar por marca y tipoarmaexplosivo + * @param marca + * @param tipoArmaExplosivo + * @return + * @throws Exception + */ + public static List findByMarcaSerie(String cregistro,String marca, String serie) throws Exception { + + IngresoInventarioController cc = new IngresoInventarioController(); + //cc.init(); + cc.recperpage = 300; + cc.querydatabaseMarcaSerie(cregistro,marca, serie ); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + + } + + @SuppressWarnings("finally") + public File generarArchivoError(Long key){ + if(listaErrores.isEmpty()){ + + //MessageHelper.setMessageInfo("ARCHIVO SUBIDO CORRECTAMENTE"); + return null; + } + PrintWriter escribir=null; + File archivo = null; + try { + archivo = File.createTempFile("errorlog"+key,".txt"); + escribir = new PrintWriter(archivo); + + + for(String err : listaErrores){ + System.out.println(err); + + + escribir.print(err+"\r\n"); + } + //escribir.close(); + limpiar(); + + + + } + catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + finally{ + escribir.flush(); + escribir.close(); + return archivo; + } + + } + + /** + * Llama a la construccion del metodo para recargar + */ + public void descargarArchivo(){ + + Long key=new Date().getTime(); + File archivoTemporal=generarArchivoError(key); + if(archivoTemporal==null) + return; + try { + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition", "attachment; filename=errorlog"+key+".txt"); + OutputStream out = response.getOutputStream(); + InputStream inputStream = new FileInputStream(archivoTemporal.getAbsolutePath()); + + int read = 0; + byte[] bytes = new byte[1024]; + + while ((read = inputStream.read(bytes)) != -1) { + out.write(bytes, 0, read); + } + + inputStream.close(); + out.flush(); + + FacesContext.getCurrentInstance().responseComplete(); + + + } catch (Exception e) { + // TODO: handle exception + } + } + + /** + * Limpia las los valores en las listas + */ + public void limpiar(){ + try { + create(); + while(lrecord.iterator().hasNext()){ + record =lrecord.get(0); + remove(); + } + listaArmas = new ArrayList(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Carga las listas de cantones y limpia la lista de ciudades + */ + public void seleccionarProvincia(){ + try { + codigoProvincia=this.record.getProvincecode(); + lcantones = CantonController.find("EC", record.getProvincecode()); + lciudades = new ArrayList<>(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Carga las listas de ciudades + */ + public void seleccionarCanton(){ + try { + codigoCanton = this.record.getCantoncode(); + lciudades = CityController.find("EC", record.getProvincecode(), record.getCantoncode()); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + public void cargarDocumentosHabilitantes(String categoria){ + ldocumentospersona= new ArrayList<>(); + List listadocum=DocumentoHabilitanteController.findpersoncodeInventario(usuario.getPk().getPersoncode().toString(),categoria); + //Forma nmero 1 (Uso de Maps). + Map mapPersonas = new HashMap(listadocum.size()); + for(TarmDocumentoHabilitante p : listadocum) { + mapPersonas.put(p.getCtramite(), p); + } + //Agrego cada elemento del map a una nueva lista y muestro cada elemento. + System.out.println("Lista sin repetidos:"); + for(Entry p : mapPersonas.entrySet()) { + // Se cargan las categorias diferentes a armas de fuego y armas no letales +// if(!p.getValue().getModifiedData().get("clase").toString().contains("0010000001")||!p.getValue().getModifiedData().get("clase").toString().contains("0010000008")){ + ldocumentospersona.add(p.getValue()); +// } + } +// ldocumentospersona =DocumentoHabilitanteController.findpersoncode(usuario.getPk().getPersoncode().toString(),categoria); + } + + public void cambioTipoRegistro(){ + if(registro.getTiporegistro()!=null){ + cargarDocumentosHabilitantes("4");//4 Fabrica, 5Fabricante + }else{ + ldocumentospersona=new ArrayList<>(); + } + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + public String getCodigoProvincia() { + return codigoProvincia; + } + + public void setCodigoProvincia(String codigoProvincia) { + this.codigoProvincia = codigoProvincia; + } + + public String getCodigoCanton() { + return codigoCanton; + } + + public void setCodigoCanton(String codigoCanton) { + this.codigoCanton = codigoCanton; + } + + public String getCodigoCiudad() { + return codigoCiudad; + } + + public void setCodigoCiudad(String codigoCiudad) { + this.codigoCiudad = codigoCiudad; + } + + String codigoCiudad; + public void codigoCiudad(){ + + + } + + public void addPersoncodeFilter(String personcode) { + super.addFilter("pk.personcode", personcode); + } + + public List getLarmexcell() { + return listaArmas; + } + + public void setLarmexcell(List larmexcell) { + this.listaArmas = larmexcell; + } + + public ArmaExcell getArmaexcell() { + return armaexcell; + } + + public void setArmaexcell(ArmaExcell armaexcell) { + this.armaexcell = armaexcell; + } + + public TarmTipoArmaExplosivo getTipoarmexplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoarmexplosivo(TarmTipoArmaExplosivo tipoarmexplosivo) { + this.tipoArmaExplosivo = tipoarmexplosivo; + } + + public List getLaexel() { + return laexel; + } + + public void setLaexel(List laexel) { + this.laexel = laexel; + } + + public TcustPersonDetail getDetallesPersona() { + return detallesPersona; + } + + public void setDetallesPersona(TcustPersonDetail detallesPersona) { + this.detallesPersona = detallesPersona; + } + + public TcustPersonDetail getUsuario() { + return usuario; + } + + public void setUsuario(TcustPersonDetail usuario) { + this.usuario = usuario; + } + + public List getListaFilas() { + return listaFilas; + } + + public void setListaFilas(List listaFilas) { + this.listaFilas = listaFilas; + } + + public List getListaErrores() { + return listaErrores; + } + + public void setListaErrores(List listaErrores) { + this.listaErrores = listaErrores; + } + + public TarmTipoArmaExplosivo getTipoArmaExplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoArmaExplosivo(TarmTipoArmaExplosivo tipoArmaExplosivo) { + this.tipoArmaExplosivo = tipoArmaExplosivo; + } + + public List getListaArmas() { + return listaArmas; + } + + public void setListaArmas(List listaArmas) { + this.listaArmas = listaArmas; + } + + public PersonAddressController getPersonAddressController() { + return personAddressController; + } + + public void setPersonAddressController( + PersonAddressController personAddressController) { + this.personAddressController = personAddressController; + } + + public InputStream getFilei() { + return filei; + } + + public void setFilei(InputStream filei) { + this.filei = filei; + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public TcustPersonAddress getDireccion() { + return direccion; + } + + public void setDireccion(TcustPersonAddress direccion) { + this.direccion = direccion; + } + +// public List getCuposArmas() { +// return cuposArmas; +// } +// +// public void setCuposArmas(List cuposArmas) { +// this.cuposArmas = cuposArmas; +// } + +// public ComercianteCupoController getComercianteCupoController() { +// return comercianteCupoController; +// } +// +// public void setComercianteCupoController( +// ComercianteCupoController comercianteCupoController) { +// this.comercianteCupoController = comercianteCupoController; +// } + + public Boolean getDescargar() { + return descargar; + } + + public void setDescargar(Boolean descargar) { + this.descargar = descargar; + } + + public RegistroArmController getRegistroArmasController() { + return registroArmasController; + } + + public void setRegistroArmasController( + RegistroArmController registroArmasController) { + this.registroArmasController = registroArmasController; + } + + + public TotalArmasController getTotalPersonaController() { + return totalPersonaController; + } + + public void setTotalPersonaController( + TotalArmasController totalPersonaController) { + this.totalPersonaController = totalPersonaController; + } + + public TgeneCountry getPais() { + return pais; + } + + public void setPais(TgeneCountry pais) { + this.pais = pais; + } + + public List getLciudades() { + return lciudades; + } + + public void setLciudades(List lciudades) { + this.lciudades = lciudades; + } + + public TgeneCity getCiudad() { + return ciudad; + } + + public void setCiudad(TgeneCity ciudad) { + this.ciudad = ciudad; + } + + public List getArmas() { + return armas; + } + + public void setArmas(List armas) { + this.armas = armas; + } + + public List getTotalesPersoan() { + return totalesPersoan; + } + + public void setTotalesPersoan(List totalesPersoan) { + this.totalesPersoan = totalesPersoan; + } + + public TgeneCatalogDetail getTipoDocumento() { + return tipoDocumento; + } + + public void setTipoDocumento(TgeneCatalogDetail tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public List getTiposRegistro() { + return tiposRegistro; + } + + public void setTiposRegistro(List tiposRegistro) { + this.tiposRegistro = tiposRegistro; + } + + public TgeneCatalogDetail getTipoRegistro() { + return tipoRegistro; + } + + public void setTipoRegistro(TgeneCatalogDetail tipoRegistro) { + this.tipoRegistro = tipoRegistro; + } + + public List getLpaises() { + return lpaises; + } + + public void setLpaises(List lpaises) { + this.lpaises = lpaises; + } + + public List getLprovincias() { + return lprovincias; + } + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + public TarmRegistroArmas getRegistro() { + return registro; + } + + public void setRegistro(TarmRegistroArmas registro) { + this.registro = registro; + } + + public List getLaeropuertos() { + return laeropuertos; + } + + public void setLaeropuertos(List laeropuertos) { + this.laeropuertos = laeropuertos; + } + + public List getLdocumentospersona() { + return ldocumentospersona; + } + + public void setLdocumentospersona( + List ldocumentospersona) { + this.ldocumentospersona = ldocumentospersona; + } + + public String getClase() { + return clase; + } + + public void setClase(String clase) { + this.clase = clase; + } + + public Integer getPersoncode() { + return personcode; + } + + public void setPersoncode(Integer personcode) { + this.personcode = personcode; + } + + public InventarioSubidoController getInventarioSubidoController() { + return inventarioSubidoController; + } + + public void setInventarioSubidoController( + InventarioSubidoController inventarioSubidoController) { + this.inventarioSubidoController = inventarioSubidoController; + } + + + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/InventarioSubidoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/InventarioSubidoController.java.svn-base new file mode 100644 index 0000000..4da23bc --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/InventarioSubidoController.java.svn-base @@ -0,0 +1,135 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmInventarioSubidoPorPersona; + +/** + * Clase controladora del bean TgeneCatalogDetail. + * + * @author Christian Pazmino. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class InventarioSubidoController extends AbstractController { + + public InventarioSubidoController() throws Exception { + super(TarmInventarioSubidoPorPersona.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "INVENTARIOSUBIDOPERSONA"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void update(TarmInventarioSubidoPorPersona bean) throws Exception { + record=bean; + update(); + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * @param catalogcode Có de catálogo + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static List findXPersonaYClase(String personcode, String clase) { + try { + InventarioSubidoController cc = new InventarioSubidoController(); + cc.init(); + cc.recperpage = 10; + cc.addFilter("pk.personcode", personcode); + cc.addFilter("pk.clase", clase); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/LongitudLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/LongitudLovController.java.svn-base new file mode 100644 index 0000000..91dffbc --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/LongitudLovController.java.svn-base @@ -0,0 +1,116 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class LongitudLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public LongitudLovController() throws Exception { + super(TgeneCatalogDetail.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "LONGITUDLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + this.getMfilters().put("pk.catalogcode", "LONGITUD"); + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog(TgeneCatalogDetail tgeneCatalogDetail) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneCatalogDetail); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/longitudLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/OrigenTramiteController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/OrigenTramiteController.java.svn-base new file mode 100644 index 0000000..45e9544 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/OrigenTramiteController.java.svn-base @@ -0,0 +1,462 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmOrigenTramite; +import com.fp.persistence.parmas.param.TarmOrigenTramiteKey; +import com.fp.persistence.parmas.param.TarmTipoTramite; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora de ingreso de tramites de control de armas. + * + * @author Jorge Vaca. + * @author dcruz + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class OrigenTramiteController extends AbstractController { + + private TarmTipoTramite tipoTramite; + private String origenAdquisicion; + private String tipoPersona; + private String tipoDeTramite; + private String tipoAutorizacion; + private String categoria; + private String actividad; + private String tipoDeTramiteD; + private String tipoAutorizacionD; + private String categoriaD; + private String actividadD; + private String origenAdquisicionD; + /** + * Trámite seleccionado + */ + private TarmTramite tarmTramite; + + /** + * Lista de origen de adquisición + */ + private List lorigenadquisicion; + + + public OrigenTramiteController() throws Exception { + super(TarmOrigenTramite.class); + } + + @PostConstruct + private void postconstruct() { + try { + init(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + * @throws Exception + */ + private void init() throws Exception { + try{ + this.beanalias="ORIGENTRAMITE"; + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList(); + this.record = new TarmOrigenTramite(); + this.record.setPk(new TarmOrigenTramiteKey()); + lorigenadquisicion = CatalogDetailController.find("ORIGENADQUISICION"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + protected void querydatabase() { + try { + if((this.origenAdquisicion == null || this.origenAdquisicion.equals("")) && this.tarmTramite == null){ + MessageHelper.setMessageError("DEBE SELECCIONAR UN TRAMITE O UN ORIGEN DE ADQUISICIN PARA REALIZAR LA BUSQUEDA"); + return; + } + + Boolean existeFiltro = Boolean.FALSE; + DtoQuery dto = super.getDtoQuery(true); + + SubQuery tramiteSQ = new SubQuery("TgeneCatalogDetail", "description", "tipoAutorizacion", + "i.pk.catalog = (select a.tipoautorizacion from TarmTramite a where a.pk = t.pk.ctramite) " + + " and " + + "i.pk.catalogcode = (select a.tipoautorizacioncodigo from TarmTramite a where a.pk = t.pk.ctramite)"); + dto.addSubQuery(tramiteSQ); + + SubQuery tipoTramiteSQ = new SubQuery("TgeneCatalogDetail", "description", "tipoDeTramite", + "i.pk.catalog = (select a.tipotramite from TarmTramite a where a.pk = t.pk.ctramite) " + + " and " + + "i.pk.catalogcode = (select a.tipotramitecodigo from TarmTramite a where a.pk = t.pk.ctramite)"); + dto.addSubQuery(tipoTramiteSQ); + + SubQuery categoriaSQ = new SubQuery("TgeneCatalogDetail", "description", "categoria", + "i.pk.catalog = (select a.categoria from TarmTramite a where a.pk = t.pk.ctramite) " + + " and " + + "i.pk.catalogcode = (select a.categoriacodigo from TarmTramite a where a.pk = t.pk.ctramite)"); + dto.addSubQuery(categoriaSQ); + + SubQuery usoActividadSQ = new SubQuery("TgeneCatalogDetail", "description", "actividad", + "i.pk.catalog = (select a.usoactividad from TarmTramite a where a.pk = t.pk.ctramite) " + + " and " + + "i.pk.catalogcode = (select a.usoactividadcodigo from TarmTramite a where a.pk = t.pk.ctramite)"); + dto.addSubQuery(usoActividadSQ); + + SubQuery adquisicionSQ = new SubQuery("TgeneCatalogDetail", "description", "adquisicion", + "i.pk.catalog = t.pk.origencatalog and i.pk.catalogcode = t.pk.origencatalogcode"); + dto.addSubQuery(adquisicionSQ); + + + Filter filtro=new Filter(); + StringBuilder sql = new StringBuilder(); + if(this.origenAdquisicion != null && !this.origenAdquisicion.equals("")){ + sql.append("t.pk.origencatalog='"+this.origenAdquisicion+"'"); + existeFiltro = Boolean.TRUE; + } + if(this.tarmTramite!=null){ + if(this.origenAdquisicion != null && !this.origenAdquisicion.equals("")){ + sql.append(" and "); + } + sql.append("t.pk.ctramite='"+this.tarmTramite.getPk()+"'"); + existeFiltro = Boolean.TRUE; + } + if(existeFiltro){ + filtro.setSql(sql.toString()); + dto.addFiltro(filtro); + } + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + protected void querydatabasesimple() { + try { + + Boolean existeFiltro = Boolean.FALSE; + DtoQuery dto = super.getDtoQuery(true); + Filter filtro=new Filter(); + StringBuilder sql = new StringBuilder(); + + if(this.tarmTramite!=null){ + sql.append("t.pk.ctramite='"+this.tarmTramite.getPk()+"'"); + existeFiltro = Boolean.TRUE; + } + if(existeFiltro){ + filtro.setSql(sql.toString()); + dto.addFiltro(filtro); + } + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Abre el LOV de trámite + */ + public void openLovTramite() { + Map> params = new HashMap>(); + List ltipopersona = new ArrayList<>(); + + +// ltipopersona.add(ParametersController.find("CODIGO.PERSONTYPE.NATURAL", "1").getTextvalue());//1 +// +// ltipopersona.add(ParametersController.find("CODIGO.PERSONTYPE.JURIDICA", "1").getTextvalue());//2 +// +// +// params.put("tipopersonasol", ltipopersona); + BuscarTramiteLovController.openLov(params); + } + + /** + * Regresa del LOV para cargar valores + * @param event {@link SelectEvent} + */ + public void onReturnTramite(SelectEvent event) { + try{ + TarmTramite tramite = (TarmTramite) event.getObject(); + this.tarmTramite = tramite; + TgeneCatalogDetail tipoTramiteCD = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + TgeneCatalogDetail tipoAutorizacionCD = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail categoriaCD = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + TgeneCatalogDetail actividadCD = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + tipoDeTramite = tipoTramiteCD!=null?tipoTramiteCD.getDescription():""; + tipoAutorizacion = tipoAutorizacionCD!=null?tipoAutorizacionCD.getDescription():""; + categoria=categoriaCD!=null?categoriaCD.getDescription():""; + actividad=actividadCD!=null?actividadCD.getDescription():""; + } catch(Throwable e){ + MessageHelper.setMessageError(e); + } + } + + /** + * Regresa del LOV para cargar valores + * @param event {@link SelectEvent} + */ + public void onReturnTramiteDialog(SelectEvent event) { + try{ + TarmTramite tramite = (TarmTramite) event.getObject(); + this.tarmTramite = tramite; + TgeneCatalogDetail tipoTramiteCD = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + TgeneCatalogDetail tipoAutorizacionCD = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail categoriaCD = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + TgeneCatalogDetail actividadCD = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + TgeneCatalogDetail adquisicionCD = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + record.getModifiedData().put("tipoDeTramite", tipoTramiteCD!=null?tipoTramiteCD.getDescription():""); + record.getModifiedData().put("tipoAutorizacion", tipoAutorizacionCD!=null?tipoAutorizacionCD.getDescription():""); + record.getModifiedData().put("categoria", categoriaCD!=null?categoriaCD.getDescription():""); + record.getModifiedData().put("actividad", actividadCD!=null?actividadCD.getDescription():""); + record.getModifiedData().put("adquisicion", adquisicionCD!=null?adquisicionCD.getDescription():""); + this.record.getPk().setCtramite(tramite.getPk()); + } catch(Throwable e){ + MessageHelper.setMessageError(e); + } + } + + /** + * Regresa del LOV para cargar valores + * + * @param tarmTramite Tarm Tramite + * @param event + * {@link SelectEvent} + */ + public static List findOrigenTramite(TarmTramite tarmTramite) { + try { + OrigenTramiteController cc = new OrigenTramiteController(); + cc.init(); + cc.recperpage = 1000; + cc.setTarmTramite(tarmTramite); + cc.querydatabasesimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Actualiza la lista de registros a grabar + * + * @throws Exception + */ + public void update() throws Exception { + + if(this.record.getPk().getCtramite()==null){ + MessageHelper.setMessageError("DEBE SELECCIONAR UN TRAMITE","formOrigenTramiteDialog"); + return; + } + + this.record.getPk().setOrigencatalogcode("ORIGENADQUISICION"); + TgeneCatalogDetail adquisicionCD = CatalogDetailController.findxCodigoCodcatalogo(this.record.getPk().getOrigencatalog(), this.record.getPk().getOrigencatalogcode()); + record.getModifiedData().put("adquisicion", adquisicionCD!=null?adquisicionCD.getDescription():""); + super.update(); + tarmTramite = null; + origenAdquisicion = null; + } + + + public TarmTipoTramite getTipoTramite() { + return tipoTramite; + } + + public void setTipoTramite(TarmTipoTramite tipoTramite) { + this.tipoTramite = tipoTramite; + } + + public String getOrigenAdquisicion() { + return origenAdquisicion; + } + + public void setOrigenAdquisicion(String origenAdquisicion) { + this.origenAdquisicion = origenAdquisicion; + } + + public List getLorigenadquisicion() { + return lorigenadquisicion; + } + + public void setLorigenadquisicion(List lorigenadquisicion) { + this.lorigenadquisicion = lorigenadquisicion; + } + + public String getTipoPersona() { + return tipoPersona; + } + + public void setTipoPersona(String tipoPersona) { + this.tipoPersona = tipoPersona; + } + + public TarmTramite getTarmTramite() { + return tarmTramite; + } + + public void setTarmTramite(TarmTramite tarmTramite) { + this.tarmTramite = tarmTramite; + } + + public String getTipoAutorizacion() { + return tipoAutorizacion; + } + + public void setTipoAutorizacion(String tipoAutorizacion) { + this.tipoAutorizacion = tipoAutorizacion; + } + + public String getCategoria() { + return categoria; + } + + public void setCategoria(String categoria) { + this.categoria = categoria; + } + + public String getActividad() { + return actividad; + } + + public void setActividad(String actividad) { + this.actividad = actividad; + } + + public String getTipoDeTramite() { + return tipoDeTramite; + } + + public void setTipoDeTramite(String tipoDeTramite) { + this.tipoDeTramite = tipoDeTramite; + } + + public String getTipoDeTramiteD() { + return tipoDeTramiteD; + } + + public void setTipoDeTramiteD(String tipoDeTramiteD) { + this.tipoDeTramiteD = tipoDeTramiteD; + } + + public String getTipoAutorizacionD() { + return tipoAutorizacionD; + } + + public void setTipoAutorizacionD(String tipoAutorizacionD) { + this.tipoAutorizacionD = tipoAutorizacionD; + } + + public String getCategoriaD() { + return categoriaD; + } + + public void setCategoriaD(String categoriaD) { + this.categoriaD = categoriaD; + } + + public String getActividadD() { + return actividadD; + } + + public void setActividadD(String actividadD) { + this.actividadD = actividadD; + } + + public String getOrigenAdquisicionD() { + return origenAdquisicionD; + } + + public void setOrigenAdquisicionD(String origenAdquisicionD) { + this.origenAdquisicionD = origenAdquisicionD; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/PreguntasParaEvaluacionesController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/PreguntasParaEvaluacionesController.java.svn-base new file mode 100644 index 0000000..a93ad5e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/PreguntasParaEvaluacionesController.java.svn-base @@ -0,0 +1,468 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.eval.RespuestasController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.eval.TarmPreguntas; +import com.fp.persistence.parmas.eval.TarmRespuestas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TarmPreguntas. + * + * @author Christian Pazmino + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class PreguntasParaEvaluacionesController extends + AbstractController { + + /** + * Lista de catalogos de tipos de evaluaciones + */ + List lTipoEvaluacion; + /** + * Lista de catalogos de tipos de personas + */ + List lTipoPersona; + /** + * Lista de catalogos de tipos de estados de preguntas + */ + List lEstados; + /** + * Variable tipo map utilizada para generar el numero de pregunta segun el tipo de persona y tipo de evaluacion escogidos + */ + private Map numeroPreguntaMAP = new HashMap(); + /** + * Constante usada para referirse al codigo de tipo de evaluacion + */ + private final String TIPOEVALUACIONCODIGO = "TIPOEVALUACION"; + /** + * Constante usada para referirse al codigo de tipo de persona + */ + private final String TIPOPERSONACODIGO = "PERSONTYPE"; + /** + * Constante usada para referirse a codigo de estado de preguntas + */ + private final String ESTADOPREGUNTACODIGO = "ESTADOPRUEBAS"; + /** + * Variable de tipo boleano para indicar si el dialog esta en modo edicion o creacion + */ + private Boolean esEdicionBln; + /** + * Variable de tipo boleano para indicar si existe alguna respuesta a la pregunta + */ + private Boolean existeRespuestasBln; + + public PreguntasParaEvaluacionesController() throws Exception { + super(TarmPreguntas.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + lTipoEvaluacion = CatalogDetailController.find("TIPOEVALUACION"); + lTipoPersona = CatalogDetailController.find(TIPOPERSONACODIGO); + lEstados = CatalogDetailController.find("ESTADOPRUEBAS"); + if (lEstados!=null && lEstados.size()==2) { + TgeneCatalogDetail activado=lEstados.get(0); + lEstados.set(0, lEstados.get(1)); + lEstados.set(1, activado); + + } + for (TgeneCatalogDetail tEvaluacion : lTipoEvaluacion) { + for (TgeneCatalogDetail tPersona : lTipoPersona) { + numeroPreguntaMAP.put(tEvaluacion.getPk().getCatalog() + + tPersona.getPk().getCatalog(), 0); + } + } + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Método de busqueda que consulta una lista de preguntas mediante codigo de evaluacion y codigo de persona + * @param String codigoEvaluacion + * @param String codigoPersona + * @return List lista de pregunta + */ + public ListfindByCodEvaluacionPersona(String codigoEvaluacion, String codigoPersona){ + try { + PreguntasParaEvaluacionesController cc = new PreguntasParaEvaluacionesController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("tipoevaluacion", codigoEvaluacion); + cc.addFilter("tipopersona", codigoPersona); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + /** + * Método que obtiene el numero de pregunta + * @param String codigo Evaluacion + * @param String codigo Persona + * @return numero de pregunta + */ + private void generaNumeroPregunta(String codigoEvaluacion, String codigoPersona) { + if (codigoEvaluacion != null && codigoPersona != null) { + Listlista = findByCodEvaluacionPersona(codigoEvaluacion, codigoPersona); + if (lista!=null) { + Integer ultimoValor = 0; + for (TarmPreguntas pregunta : lista) { + if ((codigoEvaluacion.compareTo(pregunta.getTipoevaluacion()) == 0) && (codigoPersona.compareTo(pregunta.getTipopersona()) == 0)) { + if (ultimoValor < pregunta.getNumeropregunta()) { + ultimoValor = pregunta.getNumeropregunta(); + } + } + } + record.setNumeropregunta(ultimoValor + 1); + } + else{ + record.setNumeropregunta(1); + } + } else { + record.setNumeropregunta(null); + } + } + + /** + * Método que gestiona el cambio de tipo de evaluacion por parte del usuario en el dialogo de crear + * @return numero de pregunta + */ + public void setNombreTipoEvaluacion() { + for (TgeneCatalogDetail r : lTipoEvaluacion) { + if (r.getPk().getCatalog().compareTo(record.getTipoevaluacion()) == 0) { + record.put("nTipoEvaluacion", r.getDescription()); + } + } + record.setTipoevaluacioncodigo(TIPOEVALUACIONCODIGO); + generaNumeroPregunta(record.getTipoevaluacion(),record.getTipopersona()); + } + + /** + * Método que gestiona el cambio de tipo de persona por parte del usuario en el dialogo de crear + */ + public void setNombreTipoPersona() { + for (TgeneCatalogDetail r : lTipoPersona) { + if (r.getPk().getCatalog().compareTo(record.getTipopersona()) == 0) { + record.put("nTipoPersona", r.getDescription()); + } + } + record.setTipopersonacodigo(TIPOPERSONACODIGO); + generaNumeroPregunta(record.getTipoevaluacion(),record.getTipopersona()); + } + + /** + * Método que devuelve el estado de la pregunta + */ + public void setEstadoPregunta() { + for (TgeneCatalogDetail r : lEstados) { + if (r.getPk().getCatalog().compareTo(record.getEstadopregunta()) == 0) { + record.put("nEstado", r.getDescription()); + } + } + record.setEstadopreguntacodigo(ESTADOPREGUNTACODIGO); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "PREGUNTASPARAEVALUACIONES"; + esEdicionBln = Boolean.FALSE; + existeRespuestasBln = Boolean.FALSE; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + + for(TgeneCatalogDetail estadoObj:lEstados){ + if(estadoObj.getPk().getCatalog().equalsIgnoreCase("INA")){ + record.setEstadopregunta("INA"); + record.setEstadopreguntacodigo(ESTADOPREGUNTACODIGO); + record.getModifiedData().put("nEstado", estadoObj.getDescription()); + } + } + esEdicionBln = Boolean.FALSE; + existeRespuestasBln = Boolean.FALSE; + } + + /** + * Metodo ejecutado al editar un item de la tabla + */ + public void edicion(){ + esEdicionBln = Boolean.TRUE; + existeRespuestasBln = consultarExisteResuestas(); + } + + /** + * Metodo que verifica si existe o no al menos una respuesta para la pregunta + */ + public Boolean consultarExisteResuestas(){ + ListrespuestaList = RespuestasController.findxPregunta(record.getPk().toString()); + if(respuestaList!=null && respuestaList.size()>0){ + return Boolean.TRUE; + }else{ + return Boolean.FALSE; + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.numeropregunta"); + // Subquery + SubQuery subqueryTipoEval = new SubQuery("TgeneCatalogDetail", + "description", "nTipoEvaluacion", + "i.pk.catalog = t.tipoevaluacion and i.pk.catalogcode = t.tipoevaluacioncodigo"); + dto.addSubQuery(subqueryTipoEval); + + // Subquery + SubQuery subqueryTipoPers = new SubQuery("TgeneCatalogDetail", + "description", "nTipoPersona", + "i.pk.catalog = t.tipopersona and i.pk.catalogcode = t.tipopersonacodigo"); + dto.addSubQuery(subqueryTipoPers); + + // Subquery de Estado Pregunta + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", + "description", "nEstado", + "i.pk.catalog = t.estadopregunta and i.pk.catalogcode = t.estadopreguntacodigo"); + dto.addSubQuery(subqueryEstado); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(lEstados==null){ + lEstados = CatalogDetailController.find("ESTADOPRUEBAS"); + } + for (TarmPreguntas pregunta : lrecord) { + for (TgeneCatalogDetail estado : lEstados) { + if(pregunta.getEstadopregunta()!=null && pregunta.getEstadopregunta().equalsIgnoreCase(estado.getPk().getCatalog())){ + pregunta.modifiedData.put("nEstado", estado.getDescription()); + } + } + } + + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Consulta preguntas por codigo de pregunta + * + * @param cpreguntas + * @return + * @throws Exception + */ + public static List find(String cpreguntas) throws Exception { + PreguntasParaEvaluacionesController r = new PreguntasParaEvaluacionesController(); + r.addFilter("pk", cpreguntas); + r.querydatabase(); + return r.getLrecord(); + } + + + /** + * Consulta todas las preguntas filtradas por tipo de persona y por tipo de evaluacion + */ + public static List findxPregunta(String tipopersona, String tipoevaluacion) { + try { + PreguntasParaEvaluacionesController cc = new PreguntasParaEvaluacionesController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("tipopersona", tipopersona); + cc.addFilter("tipoevaluacion",tipoevaluacion); + cc.addFilter("estadopregunta","ACT"); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca en la lista de estados la descripcion del codigo de estado recibido como parametro + */ + public String descripcionEstadoPregunta(String estadoCodigo){ + String estado=""; + + for (TgeneCatalogDetail e : lEstados) { + if(estadoCodigo.equalsIgnoreCase(e.getPk().getCatalog())){ + return e.getDescription(); + } + } + + return estado; + } + + public List getlTipoEvaluacion() { + return lTipoEvaluacion; + } + + public void setlTipoEvaluacion(List lTipoEvaluacion) { + this.lTipoEvaluacion = lTipoEvaluacion; + } + + public List getlTipoPersona() { + return lTipoPersona; + } + + public void setlTipoPersona(List lTipoPersona) { + this.lTipoPersona = lTipoPersona; + } + + public Map getNumeroPreguntaMAP() { + return numeroPreguntaMAP; + } + + public void setNumeroPreguntaMAP(Map numeroPreguntaMAP) { + this.numeroPreguntaMAP = numeroPreguntaMAP; + } + + public Boolean getEsEdicionBln() { + return esEdicionBln; + } + + public void setEsEdicionBln(Boolean esEdicionBln) { + this.esEdicionBln = esEdicionBln; + } + + public Boolean getExisteRespuestasBln() { + return existeRespuestasBln; + } + + public void setExisteRespuestasBln(Boolean existeRespuestasBln) { + this.existeRespuestasBln = existeRespuestasBln; + } + + /** + * Abre el dialogo de respuestas desde la pantalla principal para la pregunta seleccionada + */ + public void openRespuestasLov(TarmPreguntas preguntaSel) { + Map> params = new HashMap<>(); + List preguntaPKLst = new ArrayList<>(); + preguntaPKLst.add(preguntaSel.getPk().toString()); + params.put("preguntaPK", preguntaPKLst); + RespuestasLovController.openLov(params); + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo de respuestas + */ + public void onReturnRespuestasLov(SelectEvent event) throws Exception { + System.out.println("*** Retorna del LOV de respuestas..."); +// querydatabase(); + } + + + public List getlEstados() { + return lEstados; + } + + public void setlEstados(List lEstados) { + this.lEstados = lEstados; + } + + /** + * Metodo usado por controladores externos para cargar en el bean pasado como parametro en la variable record + */ + public void update(TarmPreguntas bean) throws Exception{ + record=bean; + update(); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/RequisitoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/RequisitoController.java.svn-base new file mode 100644 index 0000000..336bc4a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/RequisitoController.java.svn-base @@ -0,0 +1,225 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmRequisito; +import com.fp.persistence.parmas.param.TarmRequisitoPorTipoTramite; + +/** + * Clase controladora del bean TarmRequisito. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RequisitoController extends AbstractController { + + public RequisitoController() throws Exception { + super(TarmRequisito.class); + } + + @ManagedProperty(value = "#{requisitoPorTramiteController}") + private RequisitoPorTramiteController requisitoPorTramiteController; + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "REQUISITO"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + record.setActive("Y"); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + HashMap msave = new HashMap(); + Request request = callerhelper.getRequest(); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + dtosave.setPosition(1); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + for(TarmRequisito requisito:lrecord){ + if(requisito.getActive()!=null && requisito.getActive().equals("N")){ + //consulta de requisitosportramite + requisitoPorTramiteController.setLrecord(RequisitoPorTramiteController.findxrequisito(requisito.getPk())); + if(requisitoPorTramiteController.getLrecord()!=null){ + for(TarmRequisitoPorTipoTramite requisitoPorTipoTramite: requisitoPorTramiteController.getLrecord()){ + requisitoPorTramiteController.setRecord(requisitoPorTipoTramite); + requisitoPorTramiteController.getRecord().setActive("N"); + requisitoPorTramiteController.update(); + } + } + } + } + + DtoSave dtosaverequisitotramite = requisitoPorTramiteController.getDtoSave(); + dtosaverequisitotramite.setPosition(2); + msave.put(requisitoPorTramiteController.getBeanalias(), dtosaverequisitotramite); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + public void eliminar(TarmRequisito requisito) throws Exception { + requisito.setActive("N"); + setRecord(requisito); + super.update(); + } + + /** + * Entrega una lista de requisitos. + * + * @return List + */ + public static List find() { + try { + RequisitoController cc = new RequisitoController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + public static List findActivos() { + try { + RequisitoController cc = new RequisitoController(); + cc.init(); + cc.recperpage = 300; + cc.getMfilters().put("active", "Y"); + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Método que retorna un Requisito en base al id enviado + * @param crequisito + * @return + */ + public static TarmRequisito findxId(String crequisito) { + try { + RequisitoController cc = new RequisitoController(); + cc.getMfilters().put("pk", crequisito); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + public RequisitoPorTramiteController getRequisitoPorTramiteController() { + return requisitoPorTramiteController; + } + + public void setRequisitoPorTramiteController( + RequisitoPorTramiteController requisitoPorTramiteController) { + this.requisitoPorTramiteController = requisitoPorTramiteController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/RequisitoPorTramiteController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/RequisitoPorTramiteController.java.svn-base new file mode 100644 index 0000000..5720b1f --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/RequisitoPorTramiteController.java.svn-base @@ -0,0 +1,432 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmRequisito; +import com.fp.persistence.parmas.param.TarmRequisitoPorTipoTramite; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean requisitos por tramite, tabla TarmRequisitoPorTipoTramite + * + * @author Christian Pazmino + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean(name = "requisitoPorTramiteController") +@ViewScoped +public class RequisitoPorTramiteController extends + AbstractController { + /** + * Lista de tipos de tramites + */ + List ltipotramite; + + /** + * Lista de tipos de requisitos + */ + List lrequisito; + + /** + * Booleano que indica si el deposito es por tramite + */ + private boolean depositoPorTramite; + /** + * Booleano que indica si el deposito es por custodio + */ + private boolean depositoPorCustodio; + /** + * Codigo de tramite + */ + private Long cTramite; + + public RequisitoPorTramiteController() throws Exception { + super(TarmRequisitoPorTipoTramite.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + ltipotramite = CatalogDetailController.find("TIPOTRAMITE"); + lrequisito = RequisitoController.findActivos(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "REQUISITOPORTRAMITE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TarmRequisitoPorTipoTramite y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (cTramite==null) { + MessageHelper.setMessageError("POR FAVOR SELECCIONE UN TR\u00c1MITE"); + return; + } + super.create(); + this.record.setActive("Y"); + depositoPorCustodio = false; + depositoPorTramite = false; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if(cTramite!=null){ + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.crequisito"); + Filter filtro = new Filter(); + filtro.setSql(" t.active = 'Y'"); + dto.addFiltro(filtro); + // Subquery + SubQuery subquerypk = new SubQuery("TarmRequisito", "pk", "crequisito", "i.pk = t.pk.crequisito"); + dto.addSubQuery(subquerypk); + SubQuery subquery = new SubQuery("TarmRequisito", "nombre", "nrequisito", "i.pk = t.pk.crequisito"); + dto.addSubQuery(subquery); + SubQuery subqueryDescCorta = new SubQuery("TarmRequisito", "descripcioncorta", "ndescripcion", "i.pk = t.pk.crequisito"); + dto.addSubQuery(subqueryDescCorta); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp + .get(beanalias); + super.postQuery(lrecord); + } + } + else{ + MessageHelper.setMessageError("POR FAVOR SELECCIONE UN TR\u00c1MITE"); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaseConsultas() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.crequisito"); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Actualiza datos de registros nuevos o modifiados, si el registro es nuevo + * se adiciona a lista de nuevos, si es actualizado se adiciona a la lista + * de actualizados. + * + * @throws Exception + */ + @Override + public void update() throws Exception { + List lista = findInactiveTramiteRequisito(cTramite.toString(), record.getPk().getCrequisito()); + if(lista != null && !lista.isEmpty()){ + System.out.println("existe resultado : " + lista.get(0).getPk().getCrequisito() + "------------- " + lista.get(0).getPk().getCtramite()); + record.setIsnew(false); + record.put("ORIGINALBEAN", lista.get(0).get("ORIGINALBEAN")); + this.lrecord.add(record); + } + super.update(); + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void borrarRequisitos(){ + try { + this.record.setActive("N"); + update(); + this.lrecord.remove(this.record); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Fija la descripcion del requisito desde el dialogo de requisitos en el objeto record a persistir + */ + public void setNombreReqisito() { + for (TarmRequisito r : lrequisito) { + if (r.getPk().compareTo(record.getPk().getCrequisito()) == 0) { + record.put("nrequisito", r.getNombre()); + } + } + record.getPk().setCtramite(cTramite); + } + + public List getLtipotramite() { + return ltipotramite; + } + + public void setLtipotramite(List ltipotramite) { + this.ltipotramite = ltipotramite; + } + + /** + * @return the lrequisito + */ + public List getLrequisito() { + return lrequisito; + } + + /** + * @param lrequisito + * the lrequisito to set + */ + public void setLrequisito(List lrequisito) { + this.lrequisito = lrequisito; + } + + /** + * Consulta una lista de requisitos por tipo de tramite. + * + * @param ctipotramite + * @return + * @throws Exception + */ + public static List find(String ctipotramite) + throws Exception { + RequisitoPorTramiteController r = new RequisitoPorTramiteController(); + r.addFilter("pk.ctipotramite", ctipotramite); + r.querydatabase(); + return r.getLrecord(); + } + + public static List findxrequisito(String crequisito) + throws Exception { + RequisitoPorTramiteController r = new RequisitoPorTramiteController(); + r.addFilter("pk.crequisito", crequisito); + r.querydatabasesimple(); + return r.getLrecord(); + } + + /** + * Metodo que encuentra TarmRequisitoPorTipoTramite por tramite y por requisito en estado inactivo + * @param codigoSolicitud + * @return + */ + public static List findInactiveTramiteRequisito(String tramite, String requisito) { + try { + RequisitoPorTramiteController cc = new RequisitoPorTramiteController(); + cc.init(); + cc.recperpage = 300; + if(tramite != null){ + cc.addFilter("pk.ctramite", tramite); + } + if(requisito != null){ + cc.addFilter("pk.crequisito", requisito); + } + cc.addFilter("active", "N"); + cc.querydatabaseConsultas(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public boolean isDepositoPorTramite() { + return depositoPorTramite; + } + + public void setDepositoPorTramite(boolean depositoPorTramite) { + this.depositoPorTramite = depositoPorTramite; + } + + public boolean isDepositoPorCustodio() { + return depositoPorCustodio; + } + + public void setDepositoPorCustodio(boolean depositoPorCustodio) { + this.depositoPorCustodio = depositoPorCustodio; + } + + public Long getcTramite() { + return cTramite; + } + + public void setcTramite(Long cTramite) { + this.cTramite = cTramite; + } + + /** + * Método para manejar el evento change en el CheckBox DepositoPorTramite + */ + public void onChangeDepositoPorTramite() { + if (depositoPorTramite) { + record.setDepositoportramite("Y"); + } else { + record.setDepositoportramite("N"); + } + } + + /** + * Método para manejar el evento change en el CheckBox DepositoPorCustodio + */ + public void onChangeDepositoPorCustodio() { + if (depositoPorCustodio) { + record.setDepositoporcustodio("Y"); + } else { + record.setDepositoporcustodio("N"); + } + } + + /** + * Abre el dialog para seleccionar un tramite + */ + public void openRequisitosPorTramiteLov() { + Map> params = new HashMap<>(); + BuscarTramiteLovController.openLov(params); + } + + /** + * Completa las acciones pertinentes al momento en que se cierra el dialog para seleccionar un tramite + */ + public void onReturnRequisitosPorTramiteLov(SelectEvent event) + throws Exception { + TarmTramite t = (TarmTramite) event.getObject(); + super.addFilter("pk.ctramite", t.getPk().toString()); + super.addField("tipoTramiteName", + t.getModifiedData().get("destipoTramite")); + super.addField("tipoAutorizacionName", + t.getModifiedData().get("destipoAutorizacion")); + super.addField("categoriaName", t.getModifiedData().get("descategoria")); + super.addField("usoActividadName", + t.getModifiedData().get("desusoactividad")); + cTramite = t.getPk(); + this.query(); + } + + protected void querydatabasesimple() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.crequisito"); + Filter filtro = new Filter(); + filtro.setSql(" t.active = 'Y'"); + dto.addFiltro(filtro); + // Subquery + SubQuery subquery = new SubQuery("TarmRequisito", "nombre", "nrequisito", "i.pk = t.pk.crequisito"); + dto.addSubQuery(subquery); + SubQuery subqueryDescCorta = new SubQuery("TarmRequisito", "descripcioncorta", "ndescripcion", "i.pk = t.pk.crequisito"); + dto.addSubQuery(subqueryDescCorta); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/RespuestasLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/RespuestasLovController.java.svn-base new file mode 100644 index 0000000..f79c0e9 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/RespuestasLovController.java.svn-base @@ -0,0 +1,282 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.eval.TarmPreguntas; +import com.fp.persistence.parmas.eval.TarmRespuestas; + +/** + * Clase controller de respuestas para preguntas + * + * @author Christian Pazmino + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class RespuestasLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + /** + * Variable que contiene la pregunta a las que corresponden las respuestas presentadas + */ + private TarmPreguntas pregunta; + /** + * Variable de tipo boleano que indica si una respuesta es o no correcta + */ + private Boolean isCorrecta; + /** + * Estado de la respuesta + */ + private String estado; + /** + * Constante usada para referirse al estado activo de una respuesta + */ + private final String ESTADOACTIVO = "ACT"; + /** + * Constante usada para referirse al estado inactivo de una respuesta + */ + private final String ESTADOINACTIVO = "INA"; + + /** + * Referencia al controlador de la clase pregunta + */ + @ManagedProperty(value = "#{preguntasParaEvaluacionesController}") + private PreguntasParaEvaluacionesController preguntasController; + + public RespuestasLovController() throws Exception { + super(TarmRespuestas.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + try { + String preguntaPK = CallerHelper.getLovParameter("preguntaPK"); + pregunta = PreguntasParaEvaluacionesController.find(preguntaPK).get(0); + if(pregunta.getEstadopregunta().equalsIgnoreCase(ESTADOACTIVO)){ + estado = CatalogDetailController.findxCodigoCodcatalogo(ESTADOACTIVO, "ESTADOPRUEBAS").getDescription(); + }else if (pregunta.getEstadopregunta().equalsIgnoreCase(ESTADOINACTIVO)){ + estado = CatalogDetailController.findxCodigoCodcatalogo(ESTADOINACTIVO, "ESTADOPRUEBAS").getDescription(); + } + this.addFilter("cpregunta", pregunta.getPk().toString()); + this.querydatabase(); + //super.startQuery(); + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "RESPUESTASLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.descripcion"); + + Filter f = new Filter(); + f.setSql("t.isactive = 'Y'"); + dto.addFiltro(f); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Abre el dialogo de crear/editar respuestas desde la pantalla de respuestas + */ + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/respuestasLov.xhtml", options, params); + } + + /** + * Crea una instancia y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + isCorrecta = false; + record.setCpregunta(pregunta.getPk()); + record.setIsactive("Y"); + } + + /** + * Actualiza la lista de registros a grabar + * + * @throws Exception + */ + public void update() throws Exception { + if(record.getEscorrecta()==null){ + record.setEscorrecta("N"); + } + super.update(); + } + + public void eliminarLogico() throws Exception{ + record.setIsactive("N"); + super.update(); + this.lrecord.remove(record); + + } + + @Override + public void save() { + try { + if(lrecord.size()>=2){ + int numRespuestasCorrectas = 0; + for(TarmRespuestas respuesta : lrecord){ + if(respuesta.getEscorrecta().equals("Y")){ + numRespuestasCorrectas++; + } + if(numRespuestasCorrectas>1){ + break; + } + } + if(numRespuestasCorrectas==1){ + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + // Cambiar el estado de la pregunta + if(pregunta.getEstadopregunta().equalsIgnoreCase(ESTADOINACTIVO)){ + pregunta.isnew = false; + pregunta.setEstadopregunta(ESTADOACTIVO); + preguntasController.update(pregunta); + preguntasController.save(); + } + + RequestContext.getCurrentInstance().closeDialog(pregunta); + } + else if(numRespuestasCorrectas>1){ + MessageHelper.setMessageError("LA PREGUNTA PUEDE TENER MARCADA SOLO UNA RESPUESTA CORRECTA"); + }else if(numRespuestasCorrectas==0){ + MessageHelper.setMessageError("LA PREGUNTA DEBE TENER MARCADA UNA RESPUESTA CORRECTA"); + } + }else{ + MessageHelper.setMessageError("DEBEN HABER AL MENOS DOS RESPUESTAS"); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public TarmPreguntas getPregunta() { + return pregunta; + } + + public void setPregunta(TarmPreguntas pregunta) { + this.pregunta = pregunta; + } + + public Boolean getIsCorrecta() { + return isCorrecta; + } + + public void setIsCorrecta(Boolean isCorrecta) { + this.isCorrecta = isCorrecta; + } + + /** + * Metodo para manejar el evento change en el CheckBox "respuesta correcta" y convertir valor TRUE en "Y" y FALSE en "N" + */ + public void onChangeEsCorrecta() { + if (isCorrecta) { + record.setEscorrecta("Y"); + } else { + record.setEscorrecta("N"); + } + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public PreguntasParaEvaluacionesController getPreguntasController() { + return preguntasController; + } + + public void setPreguntasController( + PreguntasParaEvaluacionesController preguntasController) { + this.preguntasController = preguntasController; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/SancionesController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/SancionesController.java.svn-base new file mode 100644 index 0000000..448684d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/SancionesController.java.svn-base @@ -0,0 +1,235 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.CatalogLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TgeneCatalogDetail. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SancionesController extends AbstractController { + + public SancionesController() throws Exception { + super(TgeneCatalogDetail.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOGDETAIL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.catalogcode") == null) { + MessageHelper.setMessageError("msg_catalogrequird"); + return; + } + super.create(); + this.record.getPk().setCatalogcode(super.getMfilters().get("pk.catalogcode")); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void openCatalogLov() { + Map> params = new HashMap<>(); + CatalogLovController.openLov(params); + } + + public void onReturnCatalogLov(SelectEvent event) throws Exception { + TgeneCatalog t = (TgeneCatalog) event.getObject(); + super.addFilter("pk.catalogcode", t.getPk()); + super.addField("catalogname", t.getDescription()); + this.query(); + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * @param catalogcode Có de catálogo + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static List find(String catalogcode) { + try { + SancionesController cc = new SancionesController(); + cc.init(); + cc.recperpage = 10000; + cc.addFilter("pk.catalogcode", catalogcode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * @param catalogcode Có de catálogo + * @param legalcode Código legal + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static List find(String catalogcode, String legalcode) { + try { + SancionesController cc = new SancionesController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalogcode", catalogcode); + cc.addFilter("legalcode", legalcode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que consulta por Catalog y Catalogcode ambos requeridos + */ + public static TgeneCatalogDetail findxCodigoCodcatalogo(String catalog, String catalogcode) { + try {//TgeneCatalogDetailKey + if(catalog!=null && catalogcode!=null){ + SancionesController cc = new SancionesController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalogcode", catalogcode); + cc.addFilter("pk.catalog", catalog); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TgeneCatalogDetail findxCodigo(String catalog) { + try {//TgeneCatalogDetailKey + SancionesController cc = new SancionesController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalog", catalog); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que llena lal lista de géneros + */ + public static List getListGender(){ + List gender = new ArrayList(); + String[] male = {"M", "MASCULINO"}; + String[] female = {"F", "FEMENINO"}; + gender.add(male); + gender.add(female); + return gender; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/SitioAlmacenamientoController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/SitioAlmacenamientoController.java.netbeans-base new file mode 100644 index 0000000..9975b0b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/SitioAlmacenamientoController.java.netbeans-base @@ -0,0 +1,608 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmSitioAlmacenamiento; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Clase controladora del bean TarmSitioAlmacenamiento. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SitioAlmacenamientoController extends AbstractController { + + /** + * latitud de la direccin en el google map + */ + private String latitud; + /** + * longitud de la direccin en el google map + */ + private String longitud; + /** + * direccion en la que se va ha visualizar el map + */ + private String direccionGoogleMap; + + + public SitioAlmacenamientoController() throws Exception { + super(TarmSitioAlmacenamiento.class); + } + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lprovinces; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcantones; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lparroquias; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcities; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List tipoComercio; + + private Boolean btnEditar=Boolean.FALSE; + + /** + * tipoMapa permite visualizar la posicion del mapa por direccion o por coordenadas + */ + private String tipoMapa; + + private String latitudG; + private String latitudM; + private String latitudS; + private String longuitudG; + private String longuitudM; + private String longuitudS; + + private String latitudGMS; + private String longitudGMS; + + + @PostConstruct + private void postconstruct() { + setDireccionGoogleMap("Ecuador"); + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOGDETAIL"; + lprovinces= ProvinceController.find("EC"); + tipoComercio = CatalogDetailController.find("TIPOCOMERCIO"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + record.setCountrycode("EC"); + record.setTipocomerciocodigo("TIPOCOMERCIO"); + record.setEstado("ACT"); + btnEditar=Boolean.FALSE; + + if(this.getMfilters().get("pk.personcode")!=null){ + record.setPersoncode(Integer.parseInt(this.getMfilters().get("pk.personcode").toString())); + record.getModifiedData().put("nombre", this.getMfilelds().get("nombre")); + record.getModifiedData().put("numeroDocumento", this.getMfilelds().get("numeroDocumento")); + } + if(this.getMfilters().get("tipocomercio")!=null){ + record.setTipocomercio(this.getMfilters().get("tipocomercio").toString()); + } + } + + @Override + public void update() throws Exception{ +//-------------------validar SELECCION TIPO UBICACION + if(tipoMapa == null || "".equals(tipoMapa)){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipoMapa")); + return; + } +//-------------------validar LATITUD Y LONGITUD + if(record.getLatitud()==null || record.getLongitud()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselongitudlatitud")); + return; + } + + if (record.getPersoncode() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_numerodocumento")); + return; + } + catalogos(tipoComercio, record.getTipocomercio(), "tipocomercio"); + super.update(); + btnEditar=Boolean.TRUE; + } + + public void edit(){ + executeProvince(); + executeCanton(); + btnEditar=Boolean.TRUE; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + this.addFilter("estado", "ACT"); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.bodega"); + SubQuery snombre= new SubQuery + ("TcustPersonDetail", "name", "nombre", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery snumerodocumento= new SubQuery + ("TcustPersonDetail", "identification", "numeroDocumento", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery tipoComercio= new SubQuery + ("TgeneCatalogDetail", "description", "tipocomercio", "i.pk.catalog = t.tipocomercio and i.pk.catalogcode=t.tipocomerciocodigo"); + + dto.addSubQuery(snombre); + dto.addSubQuery(snumerodocumento); + dto.addSubQuery(tipoComercio); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void remove() { + if (this.record != null) { + this.record.setEstado("INA"); + try { + removefromlista(lrecord, record); + this.addUpdated(record); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + } + + private void removefromlista(List ldata, TarmSitioAlmacenamiento abstractbean) + throws Exception { + int size = ldata.size(); + for (int i = 0; i < size; i++) { + if (ldata.get(i).rowkey() == abstractbean.rowkey()) { + ldata.remove(i); + break; + } + } + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince() { + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + lcities = CityController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + } + } + + /** + * Método para el evento change del combo ciudad + */ + public void executeCiudad() { + if ((getRecord().getCantoncode() != null) && (getRecord().getCantoncode().compareTo("") != 0)) { + List lcities = CityController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + setDireccionGoogleMap(lcities.get(0).getDescription() + ", " + "Ecuador"); + } + } + + /** + * Método para abrir el lov de persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + /** + * Método para obtener la persona al cerrar el lov de persona + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail tp = (TcustPersonDetail) event.getObject(); + super.addFilter("pk.personcode", tp.getPk().getPersoncode().toString()); + super.addField("nombre", tp.getName()); + super.addField("numeroDocumento", tp.getIdentification()); + } + /** + * Método para obtener la persona al cerrar el lov de persona + * @param event + * @throws Exception + */ + public void onReturnPersonDialogLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + record.getModifiedData().put("nombre", t.getName()); + record.getModifiedData().put("numeroDocumento", t.getIdentification()); + record.setPersoncode(t.getPk().getPersoncode()); + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * @param catalogcode Có de catálogo + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static List find(String code) { + try { + SitioAlmacenamientoController cc = new SitioAlmacenamientoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", code); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para recorreer los combos y setear las descripciones de lo q se escoge + * para la vista + * @param list + * @param codigo + * @param pk + */ + public void catalogos(Listlist, String codigo,String pk){ + for(TgeneCatalogDetail item:list){ + if(codigo.equals(item.getPk().getCatalog())){ + record.modifiedData.put(pk, item.getDescription()); + break; + } + } + } + + /** + * Metodo que permite setear los datos de coordenadas relacionados a la entidad TarmDecomiso, una vez seleccionado un punto en el Map desde pantalla + */ + public void evento(){ + getRecord().setLatitud(new BigDecimal(getLatitud())); + getRecord().setLongitud(new BigDecimal(getLongitud())); + + String longitudString = getRecord().getLongitud().toString(); + if(longitudString.contains("-")){ + longitudString = longitudString.replace("-", ""); + setLongitudGMS("oeste"); + }else{ + setLongitudGMS("este"); + } + String[] longitud = transformarGrados(longitudString); + + + + String latitudString = getRecord().getLatitud().toString(); + if(latitudString.contains("-")){ + latitudString = latitudString.replace("-", ""); + setLatitudGMS("sur"); + }else{ + setLatitudGMS("norte"); + } + String[] latitud = transformarGrados(latitudString); + + setLatitudG(latitud[0]); + setLatitudM(latitud[1]); + setLatitudS(latitud[2]); + setLonguitudG(longitud[0]); + setLonguitudM(longitud[1]); + setLonguitudS(longitud[2]); + } + + /** + * Inicializa los campos al cambiar el tipo de Ubicacion desde la pagina + */ + public void changeUbicacion(){ + getRecord().setLatitud(null); + getRecord().setLongitud(null); + setLatitudG(""); + setLatitudM(""); + setLatitudS(""); + setLonguitudG(""); + setLonguitudM(""); + setLonguitudS(""); + setLatitud(""); + setLongitud(""); + setLongitudGMS(null); + setLatitudGMS(null); + } + + /** + * Permite inicializar los campos de longitud y lalitud y cargar a los datos de coordenadas relacionados a la entidad TarmDecomiso + */ + public void openMapPorCoordenandas(){ + setLatitud(""); + setLongitud(""); + if("coodernadas".equals(tipoMapa)){ + getRecord().setLatitud(new BigDecimal(transformarCoordenadas(latitudG, latitudM, latitudS, "sur".equals(latitudGMS)))); + getRecord().setLongitud(new BigDecimal(transformarCoordenadas(longuitudG, longuitudM, longuitudS, "oeste".equals(longitudGMS)))); + } + } + + /** + * Metodo que permite transformar de Coordenadas Hexadecimales a Coordenadas en Grados, Minutos y Seguntos + * @param coordenada + * @return vector con las Coordenadas en Grados, Minutos y Seguntos + */ + public String[] transformarGrados(String coordenada){ + int grados = new BigDecimal(coordenada).intValue(); + BigDecimal minutos = new BigDecimal(coordenada).subtract(new BigDecimal(grados)).multiply(new BigDecimal(60)); + int min = minutos.intValue(); + BigDecimal segundos = minutos.subtract(new BigDecimal(min)).multiply(new BigDecimal(60)).setScale(4, BigDecimal.ROUND_FLOOR); + //System.out.println("latitude: " + grados + " " + min + " " + segundos); + return (grados + "," + min + "," + segundos).split(","); + } + + public String transformarCoordenadas(String grados, String minutos, String segundos, boolean negativo){ + BigDecimal resultado = new BigDecimal(grados).add(new BigDecimal(minutos).divide(new BigDecimal(60), 12, BigDecimal.ROUND_FLOOR)).add(new BigDecimal(segundos).divide(new BigDecimal(3600), 12, BigDecimal.ROUND_FLOOR)); + resultado = resultado.setScale(12, BigDecimal.ROUND_FLOOR); + if(negativo){ + resultado = resultado.multiply(new BigDecimal(-1)); + } + return resultado.toString(); + } + public List getLprovinces() { + return lprovinces; + } + + public void setLprovinces(List lprovinces) { + this.lprovinces = lprovinces; + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public List getLparroquias() { + return lparroquias; + } + + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + public List getLcities() { + return lcities; + } + + public void setLcities(List lcities) { + this.lcities = lcities; + } + + public List getTipoComercio() { + return tipoComercio; + } + + public void setTipoComercio(List tipoComercio) { + this.tipoComercio = tipoComercio; + } + + public Boolean getBtnEditar() { + return btnEditar; + } + + public void setBtnEditar(Boolean btnEditar) { + this.btnEditar = btnEditar; + } + + public String getLatitud() { + return latitud; + } + + public void setLatitud(String latitud) { + this.latitud = latitud; + } + + public String getLongitud() { + return longitud; + } + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + public String getDireccionGoogleMap() { + return direccionGoogleMap; + } + + public void setDireccionGoogleMap(String direccionGoogleMap) { + this.direccionGoogleMap = direccionGoogleMap; + } + + public String getTipoMapa() { + return tipoMapa; + } + + public void setTipoMapa(String tipoMapa) { + this.tipoMapa = tipoMapa; + } + + public String getLatitudG() { + return latitudG; + } + + public void setLatitudG(String latitudG) { + this.latitudG = latitudG; + } + + public String getLatitudM() { + return latitudM; + } + + public void setLatitudM(String latitudM) { + this.latitudM = latitudM; + } + + public String getLatitudS() { + return latitudS; + } + + public void setLatitudS(String latitudS) { + this.latitudS = latitudS; + } + + public String getLonguitudG() { + return longuitudG; + } + + public void setLonguitudG(String longuitudG) { + this.longuitudG = longuitudG; + } + + public String getLonguitudM() { + return longuitudM; + } + + public void setLonguitudM(String longuitudM) { + this.longuitudM = longuitudM; + } + + public String getLonguitudS() { + return longuitudS; + } + + public void setLonguitudS(String longuitudS) { + this.longuitudS = longuitudS; + } + + /** + * @return the latitudGMS + */ + public String getLatitudGMS() { + return latitudGMS; + } + + /** + * @param latitudGMS the latitudGMS to set + */ + public void setLatitudGMS(String latitudGMS) { + this.latitudGMS = latitudGMS; + } + + /** + * @return the longitudGMS + */ + public String getLongitudGMS() { + return longitudGMS; + } + + /** + * @param longitudGMS the longitudGMS to set + */ + public void setLongitudGMS(String longitudGMS) { + this.longitudGMS = longitudGMS; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/SitioAlmacenamientoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/SitioAlmacenamientoController.java.svn-base new file mode 100644 index 0000000..9975b0b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/SitioAlmacenamientoController.java.svn-base @@ -0,0 +1,608 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmSitioAlmacenamiento; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Clase controladora del bean TarmSitioAlmacenamiento. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SitioAlmacenamientoController extends AbstractController { + + /** + * latitud de la direccin en el google map + */ + private String latitud; + /** + * longitud de la direccin en el google map + */ + private String longitud; + /** + * direccion en la que se va ha visualizar el map + */ + private String direccionGoogleMap; + + + public SitioAlmacenamientoController() throws Exception { + super(TarmSitioAlmacenamiento.class); + } + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lprovinces; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcantones; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lparroquias; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcities; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List tipoComercio; + + private Boolean btnEditar=Boolean.FALSE; + + /** + * tipoMapa permite visualizar la posicion del mapa por direccion o por coordenadas + */ + private String tipoMapa; + + private String latitudG; + private String latitudM; + private String latitudS; + private String longuitudG; + private String longuitudM; + private String longuitudS; + + private String latitudGMS; + private String longitudGMS; + + + @PostConstruct + private void postconstruct() { + setDireccionGoogleMap("Ecuador"); + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOGDETAIL"; + lprovinces= ProvinceController.find("EC"); + tipoComercio = CatalogDetailController.find("TIPOCOMERCIO"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + record.setCountrycode("EC"); + record.setTipocomerciocodigo("TIPOCOMERCIO"); + record.setEstado("ACT"); + btnEditar=Boolean.FALSE; + + if(this.getMfilters().get("pk.personcode")!=null){ + record.setPersoncode(Integer.parseInt(this.getMfilters().get("pk.personcode").toString())); + record.getModifiedData().put("nombre", this.getMfilelds().get("nombre")); + record.getModifiedData().put("numeroDocumento", this.getMfilelds().get("numeroDocumento")); + } + if(this.getMfilters().get("tipocomercio")!=null){ + record.setTipocomercio(this.getMfilters().get("tipocomercio").toString()); + } + } + + @Override + public void update() throws Exception{ +//-------------------validar SELECCION TIPO UBICACION + if(tipoMapa == null || "".equals(tipoMapa)){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipoMapa")); + return; + } +//-------------------validar LATITUD Y LONGITUD + if(record.getLatitud()==null || record.getLongitud()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselongitudlatitud")); + return; + } + + if (record.getPersoncode() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_numerodocumento")); + return; + } + catalogos(tipoComercio, record.getTipocomercio(), "tipocomercio"); + super.update(); + btnEditar=Boolean.TRUE; + } + + public void edit(){ + executeProvince(); + executeCanton(); + btnEditar=Boolean.TRUE; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + this.addFilter("estado", "ACT"); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.bodega"); + SubQuery snombre= new SubQuery + ("TcustPersonDetail", "name", "nombre", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery snumerodocumento= new SubQuery + ("TcustPersonDetail", "identification", "numeroDocumento", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery tipoComercio= new SubQuery + ("TgeneCatalogDetail", "description", "tipocomercio", "i.pk.catalog = t.tipocomercio and i.pk.catalogcode=t.tipocomerciocodigo"); + + dto.addSubQuery(snombre); + dto.addSubQuery(snumerodocumento); + dto.addSubQuery(tipoComercio); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void remove() { + if (this.record != null) { + this.record.setEstado("INA"); + try { + removefromlista(lrecord, record); + this.addUpdated(record); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + } + + private void removefromlista(List ldata, TarmSitioAlmacenamiento abstractbean) + throws Exception { + int size = ldata.size(); + for (int i = 0; i < size; i++) { + if (ldata.get(i).rowkey() == abstractbean.rowkey()) { + ldata.remove(i); + break; + } + } + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince() { + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + lcities = CityController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + } + } + + /** + * Método para el evento change del combo ciudad + */ + public void executeCiudad() { + if ((getRecord().getCantoncode() != null) && (getRecord().getCantoncode().compareTo("") != 0)) { + List lcities = CityController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + setDireccionGoogleMap(lcities.get(0).getDescription() + ", " + "Ecuador"); + } + } + + /** + * Método para abrir el lov de persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + /** + * Método para obtener la persona al cerrar el lov de persona + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail tp = (TcustPersonDetail) event.getObject(); + super.addFilter("pk.personcode", tp.getPk().getPersoncode().toString()); + super.addField("nombre", tp.getName()); + super.addField("numeroDocumento", tp.getIdentification()); + } + /** + * Método para obtener la persona al cerrar el lov de persona + * @param event + * @throws Exception + */ + public void onReturnPersonDialogLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + record.getModifiedData().put("nombre", t.getName()); + record.getModifiedData().put("numeroDocumento", t.getIdentification()); + record.setPersoncode(t.getPk().getPersoncode()); + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * @param catalogcode Có de catálogo + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static List find(String code) { + try { + SitioAlmacenamientoController cc = new SitioAlmacenamientoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", code); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para recorreer los combos y setear las descripciones de lo q se escoge + * para la vista + * @param list + * @param codigo + * @param pk + */ + public void catalogos(Listlist, String codigo,String pk){ + for(TgeneCatalogDetail item:list){ + if(codigo.equals(item.getPk().getCatalog())){ + record.modifiedData.put(pk, item.getDescription()); + break; + } + } + } + + /** + * Metodo que permite setear los datos de coordenadas relacionados a la entidad TarmDecomiso, una vez seleccionado un punto en el Map desde pantalla + */ + public void evento(){ + getRecord().setLatitud(new BigDecimal(getLatitud())); + getRecord().setLongitud(new BigDecimal(getLongitud())); + + String longitudString = getRecord().getLongitud().toString(); + if(longitudString.contains("-")){ + longitudString = longitudString.replace("-", ""); + setLongitudGMS("oeste"); + }else{ + setLongitudGMS("este"); + } + String[] longitud = transformarGrados(longitudString); + + + + String latitudString = getRecord().getLatitud().toString(); + if(latitudString.contains("-")){ + latitudString = latitudString.replace("-", ""); + setLatitudGMS("sur"); + }else{ + setLatitudGMS("norte"); + } + String[] latitud = transformarGrados(latitudString); + + setLatitudG(latitud[0]); + setLatitudM(latitud[1]); + setLatitudS(latitud[2]); + setLonguitudG(longitud[0]); + setLonguitudM(longitud[1]); + setLonguitudS(longitud[2]); + } + + /** + * Inicializa los campos al cambiar el tipo de Ubicacion desde la pagina + */ + public void changeUbicacion(){ + getRecord().setLatitud(null); + getRecord().setLongitud(null); + setLatitudG(""); + setLatitudM(""); + setLatitudS(""); + setLonguitudG(""); + setLonguitudM(""); + setLonguitudS(""); + setLatitud(""); + setLongitud(""); + setLongitudGMS(null); + setLatitudGMS(null); + } + + /** + * Permite inicializar los campos de longitud y lalitud y cargar a los datos de coordenadas relacionados a la entidad TarmDecomiso + */ + public void openMapPorCoordenandas(){ + setLatitud(""); + setLongitud(""); + if("coodernadas".equals(tipoMapa)){ + getRecord().setLatitud(new BigDecimal(transformarCoordenadas(latitudG, latitudM, latitudS, "sur".equals(latitudGMS)))); + getRecord().setLongitud(new BigDecimal(transformarCoordenadas(longuitudG, longuitudM, longuitudS, "oeste".equals(longitudGMS)))); + } + } + + /** + * Metodo que permite transformar de Coordenadas Hexadecimales a Coordenadas en Grados, Minutos y Seguntos + * @param coordenada + * @return vector con las Coordenadas en Grados, Minutos y Seguntos + */ + public String[] transformarGrados(String coordenada){ + int grados = new BigDecimal(coordenada).intValue(); + BigDecimal minutos = new BigDecimal(coordenada).subtract(new BigDecimal(grados)).multiply(new BigDecimal(60)); + int min = minutos.intValue(); + BigDecimal segundos = minutos.subtract(new BigDecimal(min)).multiply(new BigDecimal(60)).setScale(4, BigDecimal.ROUND_FLOOR); + //System.out.println("latitude: " + grados + " " + min + " " + segundos); + return (grados + "," + min + "," + segundos).split(","); + } + + public String transformarCoordenadas(String grados, String minutos, String segundos, boolean negativo){ + BigDecimal resultado = new BigDecimal(grados).add(new BigDecimal(minutos).divide(new BigDecimal(60), 12, BigDecimal.ROUND_FLOOR)).add(new BigDecimal(segundos).divide(new BigDecimal(3600), 12, BigDecimal.ROUND_FLOOR)); + resultado = resultado.setScale(12, BigDecimal.ROUND_FLOOR); + if(negativo){ + resultado = resultado.multiply(new BigDecimal(-1)); + } + return resultado.toString(); + } + public List getLprovinces() { + return lprovinces; + } + + public void setLprovinces(List lprovinces) { + this.lprovinces = lprovinces; + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public List getLparroquias() { + return lparroquias; + } + + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + public List getLcities() { + return lcities; + } + + public void setLcities(List lcities) { + this.lcities = lcities; + } + + public List getTipoComercio() { + return tipoComercio; + } + + public void setTipoComercio(List tipoComercio) { + this.tipoComercio = tipoComercio; + } + + public Boolean getBtnEditar() { + return btnEditar; + } + + public void setBtnEditar(Boolean btnEditar) { + this.btnEditar = btnEditar; + } + + public String getLatitud() { + return latitud; + } + + public void setLatitud(String latitud) { + this.latitud = latitud; + } + + public String getLongitud() { + return longitud; + } + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + public String getDireccionGoogleMap() { + return direccionGoogleMap; + } + + public void setDireccionGoogleMap(String direccionGoogleMap) { + this.direccionGoogleMap = direccionGoogleMap; + } + + public String getTipoMapa() { + return tipoMapa; + } + + public void setTipoMapa(String tipoMapa) { + this.tipoMapa = tipoMapa; + } + + public String getLatitudG() { + return latitudG; + } + + public void setLatitudG(String latitudG) { + this.latitudG = latitudG; + } + + public String getLatitudM() { + return latitudM; + } + + public void setLatitudM(String latitudM) { + this.latitudM = latitudM; + } + + public String getLatitudS() { + return latitudS; + } + + public void setLatitudS(String latitudS) { + this.latitudS = latitudS; + } + + public String getLonguitudG() { + return longuitudG; + } + + public void setLonguitudG(String longuitudG) { + this.longuitudG = longuitudG; + } + + public String getLonguitudM() { + return longuitudM; + } + + public void setLonguitudM(String longuitudM) { + this.longuitudM = longuitudM; + } + + public String getLonguitudS() { + return longuitudS; + } + + public void setLonguitudS(String longuitudS) { + this.longuitudS = longuitudS; + } + + /** + * @return the latitudGMS + */ + public String getLatitudGMS() { + return latitudGMS; + } + + /** + * @param latitudGMS the latitudGMS to set + */ + public void setLatitudGMS(String latitudGMS) { + this.latitudGMS = latitudGMS; + } + + /** + * @return the longitudGMS + */ + public String getLongitudGMS() { + return longitudGMS; + } + + /** + * @param longitudGMS the longitudGMS to set + */ + public void setLongitudGMS(String longitudGMS) { + this.longitudGMS = longitudGMS; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/SolicitudImportacionArmasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/SolicitudImportacionArmasController.java.svn-base new file mode 100644 index 0000000..9a3be15 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/SolicitudImportacionArmasController.java.svn-base @@ -0,0 +1,115 @@ +package com.fp.frontend.controller.armas.parametros; + + +import java.util.ArrayList; +import java.util.HashMap; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmSolicitudImportacion; + + +/** + * Clase controladora del bean TarmSolicitudImportacion. + * + * @author Andres Cevallos. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SolicitudImportacionArmasController extends AbstractController { + + + + + public SolicitudImportacionArmasController() throws Exception { + super(TarmSolicitudImportacion.class); + } + + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //Ingreso de Datos Quemados + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + // record = new TarmSolicitudImportacion(); + this.beanalias = "TDIRECCIONES"; + this.create(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void executeProvincia() { + + + } + + + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + } + + public void update(TarmSolicitudImportacion bean) throws Exception { + record=bean; + update(); + } +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/TarmCentroControlJurController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/TarmCentroControlJurController.java.svn-base new file mode 100644 index 0000000..4027c1b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/TarmCentroControlJurController.java.svn-base @@ -0,0 +1,381 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.model.DefaultTreeNode; +import org.primefaces.model.TreeNode; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Clase controladora del bean TarmCentroControlJur. + * + * @author C.P. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TarmCentroControlJurController extends AbstractController { + + private static final long serialVersionUID = 1L; + + /** + * Nodos para la creacion del arbol + */ + private TreeNode root; + /** + * Variable que se carga cuando selecciona un nodo del arbol + */ + private TreeNode selectedNode; + /** + * Recupera el codigo de la provincia selecionada + */ + private String codigoProvincia; + /** + * Recupera la descripcion de la provincia selecionada + */ + private String descripcionProvincia; + /** + * Carga la lista de las provincias + */ + private List lprovinces; + /** + * Carga el centro de control + */ + private TarmCentroControl tarmCentroControl; + + /** + * Inyeccion del controlador centroControlArmasController + */ + @ManagedProperty(value = "#{centroControlArmasController}") + private CentroControlArmasController centroControlArmasController; + + public TarmCentroControlJurController() throws Exception { + super(TarmCentroControlJur.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TARMCENTROCONTROLJURIS"; + tarmCentroControl= new TarmCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + SubQuery sprovincia= new SubQuery + ("TgeneProvince", "description", "desprovincia", "i.pk.countrycode = t.countrycode and i.pk.provincecode= t.provincecode"); + dto.addSubQuery(sprovincia); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp + .get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Metodo que se ejecuta al pulsar jurisdiccion + * Inicializa las variables, lista las provincias y el arbol de jurisdiccion + */ + public void loadEdit() { + centroControlArmasController.getRecord();// contiene el registro seleccionado + clearAll(); + listarProvincias(); + root=null; + getMfilters().put("ccentrocontrol", centroControlArmasController.getRecord().getPk()); + querydatabase(); + root=createTree();//carga el arbol + } + + /** + * selecciona un registro para anadir una jurisdiccion + * @throws Exception + */ + public void displaySelectedSingle() throws Exception { + if(selectedNode != null) { + super.create(); + record.setCountrycode("EC"); + record.setCcentrocontrol(centroControlArmasController.getRecord().getPk()); + listarProvincias(); + } + } + + /** + * elimna la jurisdiccion + * @throws Exception + */ + public void deleteNode() throws Exception { + record=(TarmCentroControlJur)selectedNode.getData(); + if(record.getCcentrocontrol()==null || record.getCcentrocontrol().trim().length()==0){ + MessageHelper.setMessageError("NO SE PUEDE ELIMINAR EL NODO"); + return; + } + record.setProvincianombre(null); + super.remove(); + selectedNode.getChildren().clear(); + selectedNode.getParent().getChildren().remove(selectedNode); + selectedNode.setParent(null); + selectedNode = null; + } + + /** + * arma el arbol + * @return + */ + @SuppressWarnings("unused") + public TreeNode createTree() { + TarmCentroControlJur cabecera = new TarmCentroControlJur(); + cabecera.setProvincianombre(centroControlArmasController.getRecord().getModifiedData().get("desinstitucion").toString()); + + TarmCentroControlJur reg1 = new TarmCentroControlJur(); + reg1.setProvincianombre(centroControlArmasController.getRecord().getModifiedData().get("desinstitucion").toString()); + + TarmCentroControlJur reg2 = new TarmCentroControlJur(); + reg2.setProvincianombre(centroControlArmasController.getRecord().getModifiedData().get("desnombreinstitucion").toString()); + + TreeNode root = new DefaultTreeNode(cabecera, null); + TreeNode nombreCentro = new DefaultTreeNode(cabecera, root); + TreeNode Default2 = new DefaultTreeNode(reg2, nombreCentro); + //se recorre para el arbol + if(lrecord!=null && lrecord.size()>0){ + for(TarmCentroControlJur jurisdiccion:lrecord){ + jurisdiccion.setProvincianombre(nombreProvincia(lprovinces, jurisdiccion.getProvincecode())); + TreeNode documents = new DefaultTreeNode(jurisdiccion, Default2); + } + } + return root; + } + + /** + * Metodo para obtener la descripcion de la provincia + * @param list + * @param codigo + * @return + */ + public String nombreProvincia(Listlist, String codigo){ + for(TgeneProvince item:list){ + if(item.getPk().getProvincecode().equals(codigo)){ + return item.getDescription(); + } + } + return ""; + } + + + /** + * metodo para a\u00F1adir un nuevo registro de jurisdiccion + * @param province + * @throws Exception + */ + public void setProvincia(TgeneProvince province) throws Exception { + System.out.println(province.getDescription()); + //validamos que el registro no este ingresado + List listaJurisdicciones=find(); + if(listaJurisdicciones!=null && listaJurisdicciones.size()>0){ + for(TarmCentroControlJur item:listaJurisdicciones){ + if(item.getProvincecode().equals(province.getPk().getProvincecode())){ + MessageHelper.setMessageError("LA JURISDICCI\u00D3N YA PERTENECE A UN CENTRO DE CONTROL DE ARMAS"); + return; + } + } + } + //validamos sobre la lista que vamos a guardar + if(this.lrecord!=null && this.lrecord.size()>0){ + for(TarmCentroControlJur item:this.lrecord){ + if(item.getProvincecode().equals(province.getPk().getProvincecode())){ + MessageHelper.setMessageError("LA JURISDICCI\u00D3N YA PERTENECE A UN CENTRO DE CONTROL DE ARMAS"); + return; + } + } + } + + record.setProvincecode(province.getPk().getProvincecode()); + addNew(record); + getLrecord().add(record); + root=createTree(); + super.update(); + } + + /** + * Metodo para listar las provincias + */ + public void listarProvincias(){ + if(lprovinces==null || lprovinces.size()==0){ + lprovinces = ProvinceController.findxDescripcion("EC",codigoProvincia, descripcionProvincia); + } + } + + public static List find() { + try { + TarmCentroControlJurController cc = new TarmCentroControlJurController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmCentroControlJur findxProvincia(String provincecode) { + try { + TarmCentroControlJurController cc = new TarmCentroControlJurController(); + cc.init(); + cc.addFilter("provincecode", provincecode); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public TreeNode getRoot() { + return root; + } + + public void setRoot(TreeNode root) { + this.root = root; + } + + + public TreeNode getSelectedNode() { + return selectedNode; + } + + + public void setSelectedNode(TreeNode selectedNode) { + this.selectedNode = selectedNode; + } + + public CentroControlArmasController getCentroControlArmasController() { + return centroControlArmasController; + } + + public void setCentroControlArmasController( + CentroControlArmasController centroControlArmasController) { + this.centroControlArmasController = centroControlArmasController; + } + + public List getLprovinces() { + return lprovinces; + } + + public void setLprovinces(List lprovinces) { + this.lprovinces = lprovinces; + } + + public String getCodigoProvincia() { + return codigoProvincia; + } + + public void setCodigoProvincia(String codigoProvincia) { + this.codigoProvincia = codigoProvincia; + } + + public String getDescripcionProvincia() { + return descripcionProvincia; + } + + public void setDescripcionProvincia(String descripcionProvincia) { + this.descripcionProvincia = descripcionProvincia; + } + + public TarmCentroControl getTarmCentroControl() { + return tarmCentroControl; + } + + public void setTarmCentroControl(TarmCentroControl tarmCentroControl) { + this.tarmCentroControl = tarmCentroControl; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/TarmVentaArmaTemporalController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/TarmVentaArmaTemporalController.java.svn-base new file mode 100644 index 0000000..feea253 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/TarmVentaArmaTemporalController.java.svn-base @@ -0,0 +1,180 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmVentaArmaTem; + +@ManagedBean +@ViewScoped +public class TarmVentaArmaTemporalController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public TarmVentaArmaTemporalController() throws Exception { + super(TarmVentaArmaTem.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + private void init() { + try { + recperpage = 15; + lrecord = new ArrayList<>(); + beanalias = "VENTAARMATEMPORAL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static TarmVentaArmaTem findPendienteCarma(String carma) { + try { + TarmVentaArmaTemporalController cc = new TarmVentaArmaTemporalController(); + cc.init(); + cc.recperpage = 5000; + if(carma!=null && !carma.isEmpty()){ + cc.addFilter("carma", carma); + } + cc.addFilter("estado", "PENDIENTE"); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findLote(String lote) { + try { + TarmVentaArmaTemporalController cc = new TarmVentaArmaTemporalController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("estado", "APROBADO"); + cc.querydatabaselote(lote); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + @SuppressWarnings("unchecked") + protected void querydatabaselote(String lote) { + try { + DtoQuery dto = this.getDtoQueryLote(); + dto.setOrderby("pk"); + String sqlFinal = " t.carma in (select p.pk from TarmArmas p where p.lote='"+lote+"') "; + Filter filtroFinal = new Filter(); + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + private DtoQuery getDtoQueryLote() throws Exception{ + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryTipoFab= new SubQuery("TgeneCatalogDetail","description","tipofabricacion","i.pk.catalog= (select p.tipofabricacion from TarmArmas p where p.pk=t.carma)"//t.tipofabricacion + + " and i.pk.catalogcode='TIPOFABRICACION'"); + dto.addSubQuery(subqueryTipoFab); + SubQuery subqueryTipo= new SubQuery("TgeneCatalogDetail","description","tipo","i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o " + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma)) "//t.ctipoarmaexplosivo + + " and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o " + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))");//t.ctipoarmaexplosivo + dto.addSubQuery(subqueryTipo); + SubQuery subqueryClasecatalogo= new SubQuery("TgeneCatalogDetail","description","clase","i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o " + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))"//t.ctipoarmaexplosivo + + " and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o " + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))");//t.ctipoarmaexplosivo + dto.addSubQuery(subqueryClasecatalogo); + return dto; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/TipoArmaExpLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/TipoArmaExpLovController.java.svn-base new file mode 100644 index 0000000..5c1e46c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/TipoArmaExpLovController.java.svn-base @@ -0,0 +1,147 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TipoArmaExpLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private String legalCode = ""; + + public TipoArmaExpLovController() throws Exception { + super(TgeneCatalogDetail.class); + } + + @PostConstruct + private void postconstruct() { + try { + this.init(); + String isArmaFuego = CallerHelper.getLovParameter("isArmaFuego"); + if(isArmaFuego.equals("true")){ + legalCode = CallerHelper.getLovParameter("longitud"); +// this.getMfilters().put("legalcode", longitudcode); + }else{ + legalCode = CallerHelper.getLovParameter("clase"); +// this.getMfilters().put("legalcode", clasecode); + } + // Inicializa autoconsulta + super.startQuery(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TIPOARMEXPLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + +// this.getMfilters().put("pk.catalogcode", "TIPOARMAEXPLOSIVO"); + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + + Filter filtro = new Filter(); + filtro.setSql("t.legalcode='"+legalCode+"' and t.pk.catalogcode='TIPOARMAEXPLOSIVO'"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog(TgeneCatalogDetail tgeneCatalogDetail) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneCatalogDetail); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/TipoArmaExpLov.xhtml", options, params); + } + + public String getLegalCode() { + return legalCode; + } + + public void setLegalCode(String legalCode) { + this.legalCode = legalCode; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/TiposArmasExplosivosController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/TiposArmasExplosivosController.java.svn-base new file mode 100644 index 0000000..ec7b11d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/TiposArmasExplosivosController.java.svn-base @@ -0,0 +1,996 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.sql.Date; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmUnidadTipo; +import com.fp.persistence.parmas.param.TarmUnidadTipoKey; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TarmTipoArmaExplosivo. + * + * @author Christian Pazmino + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class TiposArmasExplosivosController extends + AbstractController { + + /** + * Variable que contiene el String (nombre de clase) del dialogo seleccionar + * clase de la pantalla principal + */ + private String clase; + /** + * Variable que contiene el String (codigo de clase) del dialogo seleccionar + * clase de la pantalla principal + */ + private String claseCodigo; + + /** + * Variable que contiene el String (nombre de clase) del dialogo seleccionar + * clase de la pantalla principal + */ + private String unidadMedidaPesoD; + /** + * Variable que contiene el String (codigo de clase) del dialogo seleccionar + * clase de la pantalla principal + */ + private String unidadMedidaPesoCodigoD; + + /** + * Variable que contiene el String (nombre de clase) del dialogo seleccionar + * clase de la pantalla crear/editar + */ + private String claseD; + /** + * Variable que contiene el String (codigo de clase) del dialogo seleccionar + * clase de la pantalla crear/editar + */ + private String claseCodigoD; + /** + * Variable que contiene el String (codigo de longitud) del dialogo + * seleccionar longitud de la pantalla principal + */ + private String longitud; + /** + * Variable que contiene el String (codigo de longitud) del dialogo + * seleccionar longitud de la pantalla crear/editar + */ + private String longitudD; + /** + * Variable de tipo boleano (TRUE o FALSE) que indica si la clase + * seleccionada en la pantalla principal es un arma de fuego + */ + private Boolean isArmaFuego; + /** + * Variable de tipo boleano (TRUE o FALSE) que indica si la clase + * seleccionada en la pantalla crear/editar es un arma de fuego + */ + private Boolean isArmaFuegoD; + /** + * Constante usada para referirse a la clase arma de fuego + */ + private final String CODIGOARMADEFUEGO = "0010000001"; + + @ManagedProperty(value = "#{unidadTipoController}") + private UnidadTipoController unidadTipoController; + + + /** + * Map que contiene los criterios de busqueda de una tabla previos a los + * criterios de creacion. + */ + private Map mfiltersBKP = new HashMap(); + + public TiposArmasExplosivosController() throws Exception { + super(TarmTipoArmaExplosivo.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + isArmaFuego = false; + isArmaFuegoD = false; + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "TIPOARMAEXPLOSIVO"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + super.addField("clasedescriptionD", null); + super.addField("longituddescriptionD", null); + super.addField("tipodescriptionD", null); + super.addField("calibredescriptionD", null); + super.addField("unidaddescriptionD", null); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + // Subquery + SubQuery subqueryClase = new SubQuery("TgeneCatalogDetail", + "description", "nclase", + "i.pk.catalog = t.clase and i.pk.catalogcode = t.clasecodigo"); + dto.addSubQuery(subqueryClase); + + SubQuery subqueryLongitud = new SubQuery("TgeneCatalogDetail", + "description", "nlongitud", + "i.pk.catalog = t.longitud and i.pk.catalogcode = t.longitudcodigo"); + dto.addSubQuery(subqueryLongitud); + + SubQuery subqueryTipoArmaExplosivo = new SubQuery( + "TgeneCatalogDetail", + "description", + "ntipo", + "i.pk.catalog = t.tipoarmaexplosivo and i.pk.catalogcode = t.tipoarmaexplosivocodigo"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + + SubQuery subqueryCalibre = new SubQuery("TgeneCatalogDetail", + "description", "ncalibre", + "i.pk.catalog = t.calibre and i.pk.catalogcode = t.calibrecodigo"); + dto.addSubQuery(subqueryCalibre); + + SubQuery subqueryUnidad = new SubQuery("TgeneCatalogDetail", + "description", "nunidadMedidaPeso", + "i.pk.catalog = t.unidadmedidapeso and i.pk.catalogcode = t.unidadmedidapesocodigo"); + dto.addSubQuery(subqueryUnidad); + + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * ? + */ + protected void queryDatbase(String longitud, String calibre) { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + // Subquery + if (longitud == null && calibre == null) { + Filter longitudFiltro = new Filter(); + longitudFiltro + .setSql("t.longitud is null and t.calibre is null"); + dto.addFiltro(longitudFiltro); + } else if (longitud == null) { + Filter longitudFiltro = new Filter(); + longitudFiltro.setSql("t.longitud is null"); + dto.addFiltro(longitudFiltro); + } else if (calibre == null) { + Filter calibreFiltro = new Filter(); + calibreFiltro.setSql("t.calibre is null"); + dto.addFiltro(calibreFiltro); + } + + SubQuery subqueryClase = new SubQuery("TgeneCatalogDetail", + "description", "nclase", + "i.pk.catalog = t.clase and i.pk.catalogcode = t.clasecodigo"); + dto.addSubQuery(subqueryClase); + + SubQuery subqueryLongitud = new SubQuery("TgeneCatalogDetail", + "description", "nlongitud", + "i.pk.catalog = t.longitud and i.pk.catalogcode = t.longitudcodigo"); + dto.addSubQuery(subqueryLongitud); + + SubQuery subqueryTipoArmaExplosivo = new SubQuery( + "TgeneCatalogDetail", + "description", + "ntipo", + "i.pk.catalog = t.tipoarmaexplosivo and i.pk.catalogcode = t.tipoarmaexplosivocodigo"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + + SubQuery subqueryCalibre = new SubQuery("TgeneCatalogDetail", + "description", "ncalibre", + "i.pk.catalog = t.calibre and i.pk.catalogcode = t.calibrecodigo"); + dto.addSubQuery(subqueryCalibre); + + SubQuery subunidad = new SubQuery( + "TgeneCatalogDetail", + "description", + "desunidad", + "i.pk.catalog = t.pk.unidadmedidapeso and i.pk.catalogcode=t.pk.unidadmedidapesocodigo"); + dto.addSubQuery(subunidad); + + SubQuery subunidadlegalcode = new SubQuery( + "TgeneCatalogDetail", + "legalcode", + "deslegalcode", + "i.pk.catalog = t.pk.unidadmedidapeso and i.pk.catalogcode=t.pk.unidadmedidapesocodigo"); + dto.addSubQuery(subunidadlegalcode); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + dtosave.setPosition(2); + + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada tabla. + + TarmUnidadTipo tipoUnidadSeleccionada= UnidadTipoController.findByClaseAndClasecode(record.getClase(), record.getClasecodigo(),record.getTipoarmaexplosivo(), record.getUnidadmedidapeso()); + if(tipoUnidadSeleccionada==null){ + TarmUnidadTipoKey tarmUnidadTipoKey = new TarmUnidadTipoKey(); + tarmUnidadTipoKey.setClase(record.getClase()); + tarmUnidadTipoKey.setClasecode(record.getClasecodigo()); + + tarmUnidadTipoKey.setTipoarmaexplosivo(record.getTipoarmaexplosivo()); + tarmUnidadTipoKey.setTipoarmaexplosivocodigo(record.getTipoarmaexplosivocodigo()); + + tarmUnidadTipoKey.setUnidadmedidapeso(record.getUnidadmedidapeso()); + tarmUnidadTipoKey.setUnidadmedidapesocodigo(record.getUnidadmedidapesocodigo()); + + tipoUnidadSeleccionada = new TarmUnidadTipo(); + tipoUnidadSeleccionada.setPk(tarmUnidadTipoKey); + tipoUnidadSeleccionada.setRecordversion(0); + tipoUnidadSeleccionada.setIsnew(Boolean.TRUE); + tipoUnidadSeleccionada.setFecharegistro(new Date(new java.util.Date().getTime())); + + unidadTipoController.update(tipoUnidadSeleccionada); + } + + DtoSave dtosaveUnidadTipo = unidadTipoController.getDtoSave(true); + dtosaveUnidadTipo.setPosition(1); + msave.put(unidadTipoController.getBeanalias(), dtosaveUnidadTipo); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.unidadTipoController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + public String getClase() { + return clase; + } + + public void setClase(String clase) { + this.clase = clase; + } + + public String getClaseCodigo() { + return claseCodigo; + } + + public void setClaseCodigo(String claseCodigo) { + this.claseCodigo = claseCodigo; + } + + public String getLongitud() { + return longitud; + } + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + public Boolean getIsArmaFuego() { + return isArmaFuego; + } + + public Boolean getIsArmaFuegoD() { + return isArmaFuegoD; + } + + public void setIsArmaFuegoD(Boolean isArmaFuegoD) { + this.isArmaFuegoD = isArmaFuegoD; + } + + public String getClaseD() { + return claseD; + } + + public void setClaseD(String claseD) { + this.claseD = claseD; + } + + public String getClaseCodigoD() { + return claseCodigoD; + } + + public void setClaseCodigoD(String claseCodigoD) { + this.claseCodigoD = claseCodigoD; + } + + public String getLongitudD() { + return longitudD; + } + + public void setLongitudD(String longitudD) { + this.longitudD = longitudD; + } + + public Map getMfiltersBKP() { + return mfiltersBKP; + } + + public void setMfiltersBKP(Map mfiltersBKP) { + this.mfiltersBKP = mfiltersBKP; + } + + public UnidadTipoController getUnidadTipoController() { + return unidadTipoController; + } + + public void setUnidadTipoController(UnidadTipoController unidadTipoController) { + this.unidadTipoController = unidadTipoController; + } + + /** + * Metodo utilizado para limpiar las variables que contienen las + * descripciones de los dialogos de seleccion de la pantalla principal + */ + public void actualizarElementosBusqueda(String tipoBusqueda) { + if (tipoBusqueda.equals("todo")) { + super.addField("clasedescription", null); + super.addField("longituddescription", null); + super.addField("tipodescription", null); + super.addField("calibredescription", null); + super.getMfilters().remove("clase"); + super.getMfilters().remove("clasecodigo"); + super.getMfilters().remove("longitud"); + super.getMfilters().remove("longitudcodigo"); + super.getMfilters().remove("tipoarmaexplosivo"); + super.getMfilters().remove("tipoarmaexplosivocodigo"); + super.getMfilters().remove("calibre"); + super.getMfilters().remove("calibrecodigo"); + } else if (tipoBusqueda.equals("clase")) { + super.addField("longituddescription", null); + super.addField("tipodescription", null); + super.addField("calibredescription", null); + super.getMfilters().remove("longitud"); + super.getMfilters().remove("longitudcodigo"); + super.getMfilters().remove("tipoarmaexplosivo"); + super.getMfilters().remove("tipoarmaexplosivocodigo"); + super.getMfilters().remove("calibre"); + super.getMfilters().remove("calibrecodigo"); + } else if (tipoBusqueda.equals("longitud")) { + super.addField("tipodescription", null); + super.addField("calibredescription", null); + super.getMfilters().remove("tipoarmaexplosivo"); + super.getMfilters().remove("tipoarmaexplosivocodigo"); + super.getMfilters().remove("calibre"); + super.getMfilters().remove("calibrecodigo"); + } else if (tipoBusqueda.equals("tipo")) { + super.addField("calibredescription", null); + super.getMfilters().remove("calibre"); + super.getMfilters().remove("calibrecodigo"); + } + } + + /** + * Metodo utilizado para limpiar las variables que contienen las + * descripciones de los dialogos de seleccion de la pantalla crear/editar + */ + public void actualizarElementosBusquedaDialog(String tipoBusqueda) { + if (tipoBusqueda.equals("clase")) { + super.addField("longituddescriptionD", null); + super.addField("tipodescriptionD", null); + super.addField("calibredescriptionD", null); + super.addField("unidaddescriptionD", null); + } else if (tipoBusqueda.equals("longitud")) { + super.addField("tipodescriptionD", null); + super.addField("calibredescriptionD", null); + super.addField("unidaddescriptionD", null); + } else if (tipoBusqueda.equals("tipo")) { + super.addField("calibredescriptionD", null); + super.addField("unidaddescriptionD", null); + } + } + + /** + * Metodo usado para abrir el dialogo seleccionar clase de la pantalla + * principal y del dialogo crear/editar + */ + public void openClaseLov() { + try { + Map> params = new HashMap<>(); + List lcat = new ArrayList<>(); + lcat.add("CLASE"); + params.put("catalogcode", lcat); + //tITULO DEL LOV + List ltituloLOV = new ArrayList<>(); + ltituloLOV.add("lov_unidades"); + params.put("tituloLOV", ltituloLOV); + ClaseLovController.openLov(params); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo usado para abrir el dialogo seleccionar clase de la pantalla + * principal y del dialogo crear/editar + */ + public void openUnidadLov() { + try { + Map> params = new HashMap<>(); + // CATALOGCODE + List lcatalogcode = new ArrayList<>(); + lcatalogcode.add("UNIDADMEDIDA"); + params.put("catalogcode", lcatalogcode); + //tITULO DEL LOV + List ltituloLOV = new ArrayList<>(); + ltituloLOV.add("lov_unidades"); + params.put("tituloLOV", ltituloLOV); + ClaseLovController.openLov(params); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar + * clase de la pantalla principal + */ + public void onReturnClaseLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.addFilter("clase", t.getPk().getCatalog()); + super.addFilter("clasecodigo", t.getPk().getCatalogcode()); + clase = t.getPk().getCatalog(); + claseCodigo = t.getPk().getCatalogcode(); + if (clase.equalsIgnoreCase(CODIGOARMADEFUEGO)) { + isArmaFuego = true; + } else { + isArmaFuego = false; + } + super.addField("clasedescription", t.getDescription()); + actualizarElementosBusqueda("clase"); + this.query(); + } + + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar + * clase de la pantalla principal + */ + public void onReturnUnidadDialogLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.addField("unidaddescriptionD", t.getDescription()); + this.record.setUnidadmedidapeso(t.getPk().getCatalog()); + this.record.setUnidadmedidapesocodigo(t.getPk().getCatalogcode()); + unidadMedidaPesoD = t.getPk().getCatalog(); + unidadMedidaPesoCodigoD = t.getPk().getCatalogcode(); + this.record.put("nunidadMedidaPeso", t.getDescription()); + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar + * clase de la pantalla crear/editar + */ + public void onReturnClaseDialogLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + claseD = t.getPk().getCatalog(); + claseCodigoD = t.getPk().getCatalogcode(); + if (claseD.equalsIgnoreCase(CODIGOARMADEFUEGO)) { + isArmaFuegoD = true; + } else { + isArmaFuegoD = false; + } + super.addField("clasedescriptionD", t.getDescription()); + this.record.setClase(t.getPk().getCatalog()); + ; + this.record.setClasecodigo(t.getPk().getCatalogcode()); + record.put("nclase", t.getDescription()); + actualizarElementosBusquedaDialog("clase"); + } + + /** + * Metodo usado para abrir el dialogo seleccionar longitud de la pantalla + * principal + */ + public void openLogitudLov() { + if (clase != null && claseCodigo != null) { + Map> params = new HashMap<>(); + LongitudLovController.openLov(params); + } else { + MessageHelper + .setMessageError("POR FAVOR SELECCIONE UNA CLASE DE ARMA O EXPLOSIVO"); + } + } + + /** + * Metodo usado para abrir el dialogo seleccionar longitud de la pantalla + * crear/editar + */ + public void openLogitudDialogLov() { + if (claseD != null && claseCodigoD != null) { + Map> params = new HashMap<>(); + LongitudLovController.openLov(params); + } else { + MessageHelper + .setMessageError("POR FAVOR SELECCIONE UNA CLASE DE ARMA O EXPLOSIVO"); + } + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar + * longitud de la pantalla principal + */ + public void onReturnLogitudLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.addFilter("longitud", t.getPk().getCatalog()); + super.addFilter("longitudcodigo", t.getPk().getCatalogcode()); + longitud = t.getPk().getCatalog(); + super.addField("longituddescription", t.getDescription()); + actualizarElementosBusqueda("longitud"); + this.query(); + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar + * longitud de la pantalla crear/editar + */ + public void onReturnLogitudDialogLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + longitudD = t.getPk().getCatalog(); + super.addField("longituddescriptionD", t.getDescription()); + this.record.setLongitud(longitudD); + this.record.setLongitudcodigo(t.getPk().getCatalogcode()); + record.put("nlongitud", t.getDescription()); + actualizarElementosBusquedaDialog("longitudD"); + } + + /** + * Metodo usado para abrir el dialogo seleccionar tipo de arma o explosivo + * de la pantalla principal + */ + public void openTipoLov() { + + if (clase != null && claseCodigo != null) { + Map> params = new HashMap<>(); + List valuesArmaFuego = new ArrayList(); + valuesArmaFuego.add(isArmaFuego.toString()); + params.put("isArmaFuego", valuesArmaFuego); + if (isArmaFuego) { + List valuesLongitud = new ArrayList(); + valuesLongitud.add(longitud); + params.put("longitud", valuesLongitud); + } else { + List valuesClase = new ArrayList(); + valuesClase.add(clase); + params.put("clase", valuesClase); + } + TipoArmaExpLovController.openLov(params); + } else { + MessageHelper + .setMessageError("POR FAVOR SELECCIONE UNA CLASE DE ARMA O EXPLOSIVO"); + } + } + + /** + * Metodo usado para abrir el dialogo seleccionar tipo de arma o explosivo + * de la pantalla crear/editar + */ + public void openTipoDialogLov() { + if (record.isnew) { + if (claseD != null && claseCodigoD != null) { + Map> params = new HashMap<>(); + List valuesArmaFuego = new ArrayList(); + valuesArmaFuego.add(isArmaFuegoD.toString()); + params.put("isArmaFuego", valuesArmaFuego); + if (isArmaFuegoD) { + List valuesLongitud = new ArrayList(); + valuesLongitud.add(longitudD); + params.put("longitud", valuesLongitud); + } else { + List valuesClase = new ArrayList(); + valuesClase.add(claseD); + params.put("clase", valuesClase); + } + TipoArmaExpLovController.openLov(params); + } else { + MessageHelper + .setMessageError("POR FAVOR SELECCIONE UNA CLASE DE ARMA O EXPLOSIVO"); + } + } else { + Map> params = new HashMap<>(); + List valuesArmaFuego = new ArrayList(); + valuesArmaFuego.add(isArmaFuegoD.toString()); + params.put("isArmaFuego", valuesArmaFuego); + if (isArmaFuegoD) { + List valuesLongitud = new ArrayList(); + valuesLongitud.add(longitudD); + params.put("longitud", valuesLongitud); + } else { + List valuesClase = new ArrayList(); + valuesClase.add(claseD); + params.put("clase", valuesClase); + } + TipoArmaExpLovController.openLov(params); + } + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar + * tipo de arma o explosivo de la pantalla principal + */ + public void onReturnTipoLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.addFilter("tipoarmaexplosivo", t.getPk().getCatalog()); + super.addFilter("tipoarmaexplosivocodigo", t.getPk().getCatalogcode()); + super.addField("tipodescription", t.getDescription()); + actualizarElementosBusqueda("tipo"); + this.query(); + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar + * tipo de arma o explosivo de la pantalla crear/editar + */ + public void onReturnTipoDialogLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.addField("tipodescriptionD", t.getDescription()); + this.record.setTipoarmaexplosivo(t.getPk().getCatalog()); + ; + this.record.setTipoarmaexplosivocodigo(t.getPk().getCatalogcode()); + record.put("ntipo", t.getDescription()); + actualizarElementosBusquedaDialog("tipo"); + } + + /** + * Metodo usado para abrir el dialogo seleccionar calibre de arma o + * explosivo de la pantalla principal y del dialogo crear/editar + */ + public void openCalibreLov() { + Map> params = new HashMap<>(); + CalibreLovController.openLov(params); + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar + * calibre de la pantalla principal + */ + public void onReturnCalibreLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.addFilter("calibre", t.getPk().getCatalog()); + super.addFilter("calibrecodigo", t.getPk().getCatalogcode()); + super.addField("calibredescription", t.getDescription()); + this.query(); + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar + * calibre de la pantalla crear/editar + */ + public void onReturnCalibreDialogLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.addField("calibredescriptionD", t.getDescription()); + this.record.setCalibre(t.getPk().getCatalog()); + this.record.setCalibrecodigo(t.getPk().getCatalogcode()); + record.put("ncalibre", t.getDescription()); + } + + /** + * Metodo que actualiza las descripciones seleccionadas en el dialogo + * crear/editar a la variable record y calcula valor de la variable + * isArmaFuegoD + */ + public void actualizar() { + super.addField("clasedescriptionD", record.get("nclase")); + super.addField("longituddescriptionD", record.get("nlongitud")); + super.addField("tipodescriptionD", record.get("ntipo")); + super.addField("calibredescriptionD", record.get("ncalibre")); + super.addField("unidaddescriptionD", record.get("nunidadMedidaPeso")); + claseD = record.getClase(); + claseCodigoD = record.getClasecodigo(); + if (record.getClase().equalsIgnoreCase(CODIGOARMADEFUEGO)) { + isArmaFuegoD = true; + longitudD = record.getLongitud(); + } else { + isArmaFuegoD = false; + } + } + + @Override + public void update() throws Exception { + if (record.getClase() != null) { + if (record.getClase().equalsIgnoreCase(CODIGOARMADEFUEGO)) { + if (record.getLongitud() != null) { + if (record.getTipoarmaexplosivo() != null) { + if (record.getCalibre() != null) { + if (record.getUnidadmedidapeso() != null) { + super.update(); + } else { + MessageHelper.setMessageError("SELECCIONE UNA UNIDAD PARA EL ARMA O EXPLOSIVO"); + } + } else { + MessageHelper + .setMessageError("SELECCIONE UN CALIBRE PARA EL ARMA O EXPLOSIVO"); + } + } else { + MessageHelper + .setMessageError("SELECCIONE UN TIPO PARA EL ARMA O EXPLOSIVO"); + } + } else { + MessageHelper + .setMessageError("SELECCIONE UNA LONGITUD PARA EL ARMA O EXPLOSIVO"); + } + } else { + if (record.getTipoarmaexplosivo() != null) { + if (record.getUnidadmedidapeso() != null) { + super.update(); + } else { + MessageHelper.setMessageError("SELECCIONE UNA UNIDAD PARA EL ARMA O EXPLOSIVO"); + } + } else { + MessageHelper.setMessageError("SELECCIONE UN TIPO DE ARMA O EXPLOSIVO"); + } + } + } else { + MessageHelper.setMessageError("SELECCIONE UNA CLASE DE ARMA O EXPLOSIVO"); + } + } + + /** + * Find para encontrar las caracteristicas del arma mediante el pk. + * ctipo - tipo de arma o explosivo + */ + public static TarmTipoArmaExplosivo findarma(String ctipo) { + try { + if (ctipo == null) { + return null; + } + TiposArmasExplosivosController cc = new TiposArmasExplosivosController(); + + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", ctipo); + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Find para encontrar el pk del arma mediante las caracteristicas. Andres Cevallos + */ + public static TarmTipoArmaExplosivo findpk(String longitud, String calibre, + String clase, String tipoarmaexplosivo) { + try { + TiposArmasExplosivosController cc = new TiposArmasExplosivosController(); + + cc.init(); + cc.recperpage = 300; + cc.addFilter("longitud", longitud); + cc.addFilter("calibre", calibre); + cc.addFilter("clase", clase); + cc.addFilter("tipoarmaexplosivo", tipoarmaexplosivo); + cc.queryDatbase(longitud, calibre); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Find para encontrar el pk del arma mediante las caracteristicas. Andres + * Cevallos + */ + public static TarmTipoArmaExplosivo findByClaseLongitudCalibreTipoArma( String longitud, String calibre, String clase, + String tipoarmaexplosivo, String unidadmedidapeso) { + try { + TiposArmasExplosivosController cc = new TiposArmasExplosivosController(); + + cc.init(); + cc.recperpage = 300; + cc.addFilter("longitud", longitud); + cc.addFilter("calibre", calibre); + cc.addFilter("clase", clase); + cc.addFilter("tipoarmaexplosivo", tipoarmaexplosivo); + cc.addFilter("unidadmedidapeso", unidadmedidapeso); + cc.queryDatbase(longitud, calibre); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + /** + * Find para encontrar el pk del arma mediante las caracteristicas. FPazmino + * Cevallos + */ + public static TarmTipoArmaExplosivo findByClaseCalibreTipoArma(String clase, String calibre, + String tipoarmaexplosivo, String unidadmedidapeso) { + try { + TiposArmasExplosivosController cc = new TiposArmasExplosivosController(); + + cc.init(); + cc.recperpage = 300; + cc.addFilter("clase", clase); + cc.addFilter("calibre", calibre); + cc.addFilter("tipoarmaexplosivo", tipoarmaexplosivo); + cc.addFilter("unidadmedidapeso", unidadmedidapeso); + cc.queryDatbase(null, calibre); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que busca una combinacion de tipo arma explosivo por la clase y el + * tipo de arma pasados como parametro + * + * @param clase + * @param tipoarmaexplosivo + * @return + */ + public static TarmTipoArmaExplosivo findByClaseTipo(String clase, + String tipoarmaexplosivo,String unidadmedidapeso) { + try { + TiposArmasExplosivosController cc = new TiposArmasExplosivosController(); + + cc.init(); + cc.recperpage = 300; + cc.addFilter("clase", clase); + cc.addFilter("tipoarmaexplosivo", tipoarmaexplosivo); + cc.addFilter("unidadmedidapeso", unidadmedidapeso); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que busca todas las combinaciones de tipos armas explosivos por la + * clase y el tipo de arma pasados como parametro + * + * @param clase + * @param tipoarmaexplosivo + * @return + */ + public static List findByClaseTipoAll(String clase, + String tipoarmaexplosivo) { + try { + TiposArmasExplosivosController cc = new TiposArmasExplosivosController(); + + cc.init(); + cc.recperpage = 300; + cc.addFilter("clase", clase); + cc.addFilter("tipoarmaexplosivo", tipoarmaexplosivo); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/TotalPersonaController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/TotalPersonaController.java.svn-base new file mode 100644 index 0000000..cbd038c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/TotalPersonaController.java.svn-base @@ -0,0 +1,174 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmTotalPersona; + +public class TotalPersonaController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public TotalPersonaController() throws Exception { + super(TarmTotalPersona.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + private void init() { + try { + recperpage = 100; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "TOTALPERSONACONTROLLER"; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + + if(this.getMfilelds().get("fechamaxima") != null){ + Filter filter= new Filter(); + filter.setSql(this.getMfilelds().get("fechamaxima").toString()); + dto.addFiltro(filter); + } + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + Collections.sort(lrecord, new Comparator() { + public int compare(TarmTotalPersona o1, TarmTotalPersona o2) { + return ((Date)(o1.getFecha())).after((Date)(o2.getFecha())) ? -1 : 1; + } + }); + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + public void update(TarmTotalPersona bean) throws Exception { + record=bean; + super.update(); + } + + + /** + * Busca el total de un arma para una persona + */ + public static TarmTotalPersona find(String clase, String tipoArmaEplosivo, String codigoPersona) { + try { + TotalPersonaController cc = new TotalPersonaController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("clase", clase); + cc.addFilter("tipoarmaexplosivo", tipoArmaEplosivo); + cc.addFilter("personcodigo", codigoPersona); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca el total de un arma para una persona + */ + public static TarmTotalPersona findMaxFecha(String clase, String tipoArmaEplosivo, String codigoPersona,String unidad) { + try { + TotalPersonaController cc = new TotalPersonaController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("clase", clase); + cc.addFilter("tipoarmaexplosivo", tipoArmaEplosivo); + cc.addFilter("personcodigo", codigoPersona); + cc.addField("fechamaxima", "t.fecha=(select max(o.fecha) from TarmTotalPersona o where o.clase='"+clase+"' and tipoarmaexplosivo='"+tipoArmaEplosivo+"' and o.personcodigo='"+codigoPersona+"')"); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/UnidadTipoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/UnidadTipoController.java.svn-base new file mode 100644 index 0000000..5aa5e24 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/UnidadTipoController.java.svn-base @@ -0,0 +1,454 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmUnidadTipo; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TarmUnidTipo. + * + * @author C.P. + * @version 2 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class UnidadTipoController extends AbstractController { + + /** + * catalogo de las unidades + */ + private List lunidades; + /** + * atributo para la descripcion de la clase del arma + */ + private String descripcionClase; + /** + * atributo para la descripcion del tipo del arma + */ + private String descripcionTipoArma; + + public UnidadTipoController() throws Exception { + super(TarmUnidadTipo.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + lunidades=CatalogDetailController.find("UNIDADMEDIDA"); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "UNIDTIPO"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); +// dto.setOrderby("t.description"); + + SubQuery sclasearma= new SubQuery + ("TgeneCatalogDetail", "description", "desclasearma", "i.pk.catalog = t.pk.clase and i.pk.catalogcode=t.pk.clasecode"); + SubQuery stipoarma= new SubQuery + ("TgeneCatalogDetail", "description", "destipoarma", "i.pk.catalog = t.pk.tipoarmaexplosivo and i.pk.catalogcode=t.pk.tipoarmaexplosivocodigo"); + SubQuery sunidad= new SubQuery + ("TgeneCatalogDetail", "description", "desunidad", "i.pk.catalog = t.pk.unidadmedidapeso and i.pk.catalogcode=t.pk.unidadmedidapesocodigo"); + + dto.addSubQuery(stipoarma); + dto.addSubQuery(sclasearma); + dto.addSubQuery(sunidad); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp + .get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaseSimple() { + try { + DtoQuery dto = super.getDtoQuery(true); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp + .get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Crea una instancia del registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @Override + public void update() throws Exception { + if(record.getModifiedData().get("desclasearma")==null || record.getModifiedData().get("desclasearma").toString().trim().length()==0){ + MessageHelper.setMessageError("SELECCIONE LA CLASE"); + return; + } + if(record.getModifiedData().get("destipoarma")==null || record.getModifiedData().get("destipoarma").toString().trim().length()==0){ + MessageHelper.setMessageError("SELECCIONE EL TIPO DE ARMA"); + return; + } + this.record.getPk().setUnidadmedidapesocodigo("UNIDADMEDIDA"); + record.setFecharegistro(new java.sql.Date(new Date().getTime())); + catalogos(lunidades, record.getPk().getUnidadmedidapeso(), "desunidad"); + super.update(); + } + + + public void update(TarmUnidadTipo bean) throws Exception { + record=bean; + super.update(); + } + + + /** + * Metodo para recorreer los combos y setear las descripciones de lo q se escoge + * para la vista + * @param list + * @param codigo + * @param pk + */ + public void catalogos(Listlist, String codigo,String pk){ + for(TgeneCatalogDetail item:list){ + if(codigo.equals(item.getPk().getCatalog())){ + record.modifiedData.put(pk, item.getDescription()); + break; + } + } + } + + public void openClaseLov() { + Map> params = new HashMap<>(); + List lcat = new ArrayList<>(); + lcat.add("CLASE"); + params.put("catalogcode", lcat); + List ldescripcion = new ArrayList<>(); + ldescripcion.add(MsgControlArmas.getProperty("lvh_clase")); + params.put("tituloLOV", ldescripcion); + ClaseLovController.openLov(params); + + } + + private String codigoClase; + public void openTipoArmaLov() { + if(codigoClase==null || codigoClase.trim().length()==0){ + MessageHelper.setMessageError("SELECCIONE LA CLASE"); + return; + } + Map> params = new HashMap<>(); + String codigoslonguitud=""; + String codigoslonguitud2=""; + Listlista=CatalogDetailController.find("LONGITUD", codigoClase); + if(lista!=null){ + for(TgeneCatalogDetail catalogo:lista){ + if(codigoslonguitud==null || codigoslonguitud.length()==0){ + codigoslonguitud+= catalogo.getPk().getCatalog(); + }else if(codigoslonguitud2==null || codigoslonguitud2.length()==0){ + codigoslonguitud2+=" legalcode= '"+catalogo.getPk().getCatalog()+"'"; + }else{ + codigoslonguitud2+=" or t.legalcode= '"+catalogo.getPk().getCatalog()+"'"; + } + } + } + List l = new ArrayList<>(); + if(codigoslonguitud!=null && codigoslonguitud.length()>0){ + l.add(codigoslonguitud); + }else{ + l.add(codigoClase); + } + params.put("legalcode", l); + + List l2 = new ArrayList<>(); + if(codigoslonguitud2!=null && codigoslonguitud2.length()>0){ + l2.add(codigoslonguitud2); + } + params.put("legalcode2", l2); + List lcat = new ArrayList<>(); + lcat.add("TIPOARMAEXPLOSIVO"); + params.put("catalogcode", lcat); + + List ldescripcion = new ArrayList<>(); + ldescripcion.add(MsgControlArmas.getProperty("lvh_tipoarma")); + params.put("tituloLOV", ldescripcion); + ClaseLovController.openLov(params); + + } + + private String codigoClaseD; + public void openTipoArmaDialogLov() { + if(codigoClaseD==null || codigoClaseD.trim().length()==0){ + MessageHelper.setMessageError("SELECCIONE LA CLASE"); + return; + } + Map> params = new HashMap<>(); + String codigoslonguitud=""; + String codigoslonguitud2=""; + Listlista=CatalogDetailController.find("LONGITUD", codigoClaseD); + if(lista!=null){ + for(TgeneCatalogDetail catalogo:lista){ + if(codigoslonguitud==null || codigoslonguitud.length()==0){ + codigoslonguitud+= catalogo.getPk().getCatalog(); + }else if(codigoslonguitud2==null || codigoslonguitud2.length()==0){ + codigoslonguitud2+=" legalcode= '"+catalogo.getPk().getCatalog()+"'"; + }else{ + codigoslonguitud2+=" or t.legalcode= '"+catalogo.getPk().getCatalog()+"'"; + } + } + } + List l = new ArrayList<>(); + if(codigoslonguitud!=null && codigoslonguitud.length()>0){ + l.add(codigoslonguitud); + }else{ + l.add(codigoClaseD); + } + params.put("legalcode", l); + + List l2 = new ArrayList<>(); + if(codigoslonguitud2!=null && codigoslonguitud2.length()>0){ + l2.add(codigoslonguitud2); + } + params.put("legalcode2", l2); + List lcat = new ArrayList<>(); + lcat.add("TIPOARMAEXPLOSIVO"); + params.put("catalogcode", lcat); + + List ldescripcion = new ArrayList<>(); + ldescripcion.add(MsgControlArmas.getProperty("lvh_tipoarma")); + params.put("tituloLOV", ldescripcion); + ClaseLovController.openLov(params); + + } + + public void onReturnClaseLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.getMfilters().put("pk.clase", t.getPk().getCatalog()); + descripcionClase=t.getDescription(); + codigoClase=t.getPk().getCatalog(); + //encero + super.getMfilters().put("pk.tipoarmaexplosivo", null); + descripcionTipoArma=null; + } + + public void onReturnTipoArmaLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.getMfilters().put("pk.tipoarmaexplosivo", t.getPk().getCatalog()); + descripcionTipoArma=t.getDescription(); + } + + public void onReturnClaseDialogLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + record.getPk().setClase(t.getPk().getCatalog()); + record.getPk().setClasecode(t.getPk().getCatalogcode()); + record.getModifiedData().put("desclasearma", t.getDescription()); + codigoClaseD=t.getPk().getCatalog(); + //encero + record.getPk().setTipoarmaexplosivo(null); + record.getPk().setTipoarmaexplosivocodigo(null); + record.getModifiedData().put("destipoarma", null); + } + + public void onReturnTipoArmaDialogLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + record.getPk().setTipoarmaexplosivo(t.getPk().getCatalog()); + record.getPk().setTipoarmaexplosivocodigo(t.getPk().getCatalogcode()); + record.getModifiedData().put("destipoarma", t.getDescription()); +// codigoClase=t.getPk().getCatalog(); + } + + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * + * @param catalogcode + * Có de catálogo + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static List find(String catalogcode) { + try { + UnidadTipoController cc = new UnidadTipoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", catalogcode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Obtiene un tipo de unidad por la clase y el codigo de clase + */ + public static TarmUnidadTipo findByClaseAndClasecode(String clase,String clasecode, String tipoArmaExplosivo, String unidadMedida) { + try { + UnidadTipoController cc = new UnidadTipoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.clase", clase); + cc.addFilter("pk.clasecode", clasecode); + cc.addFilter("pk.tipoarmaexplosivo", tipoArmaExplosivo); + cc.addFilter("pk.unidadmedidapeso",unidadMedida); + cc.querydatabaseSimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + public static TarmUnidadTipo find(String clase, String tipoarmaexplosivo) { + try { + UnidadTipoController cc = new UnidadTipoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.clase", clase); + cc.addFilter("pk.tipoarmaexplosivo", tipoarmaexplosivo); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public List getLunidades() { + return lunidades; + } + + public void setLunidades(List lunidades) { + this.lunidades = lunidades; + } + + public String getDescripcionClase() { + return descripcionClase; + } + + public void setDescripcionClase(String descripcionClase) { + this.descripcionClase = descripcionClase; + } + + public String getDescripcionTipoArma() { + return descripcionTipoArma; + } + + public void setDescripcionTipoArma(String descripcionTipoArma) { + this.descripcionTipoArma = descripcionTipoArma; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/VentaTotalPersonaController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/VentaTotalPersonaController.java.svn-base new file mode 100644 index 0000000..d4f92cf --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/.svn/text-base/VentaTotalPersonaController.java.svn-base @@ -0,0 +1,96 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmTotalPersona; + +@ManagedBean +@ViewScoped +public class VentaTotalPersonaController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public VentaTotalPersonaController() throws Exception { + super(TarmTotalPersona.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + private void init() { + try { + recperpage = 15; + lrecord = new ArrayList<>(); + beanalias = "VENTATOTALPERSONA"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ArmaController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ArmaController.java new file mode 100644 index 0000000..4f1fe21 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ArmaController.java @@ -0,0 +1,1694 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletResponse; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.ArmaExcell; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.funcionalidad.TotalArmasController; +import com.fp.frontend.controller.armas.solicitud.ArmasController; +import com.fp.frontend.controller.armas.solicitud.DocumentoHabilitanteController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +import com.fp.persistence.parmas.param.TarmComercianteCupo; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmUnidadTipo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * @author Andres Cevallos Clase Controladora para la entidad TarmArma Incluye + * metodo de consulta para la busqueda de persona y registro + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ArmaController extends AbstractController { + + //Variabgles globales + private Integer personcode; + + private Boolean descargar; + private String csolicitud; + InputStream filei; + + //Datos generales + private TgeneCatalogDetail tipoDocumento; + private TcustPersonDetail detallesPersona; + + Date fechaActual; + private List tiposRegistro; + private TgeneCatalogDetail tipoRegistro; + + //Detalle del material + //Pais + private List lpaises; + private TgeneCountry pais; + //private String pais; + + //Provincia + private List lprovincias; + private String codigoProvincia; + + //Canton + private List lcantones; + private String codigoCanton; + + //Ciudad + private List lciudades; + private TgeneCity ciudad; + + //Registro armas + TarmRegistroArmas registro = new TarmRegistroArmas(); + + //Variables de las armas + private TcustPersonDetail usuario; + private TcustPersonAddress direccion; + private List listaFilas; + private List listaErrores; +// private List cuposArmas; + + //private BigDecimal pesoTotal; + private TarmTipoArmaExplosivo tipoArmaExplosivo; + private List listaArmas; + private ArmaExcell armaexcell; + + private List laexel; + private List armas = new ArrayList(); + private List totalesPersoan = new ArrayList(); + + //Aeropuertos + List laeropuertos = new ArrayList<>(); + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddressController; + +// @ManagedProperty(value = "#{comercianteCupoController}") +// private ComercianteCupoController comercianteCupoController; + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmasController; + + @ManagedProperty(value = "#{totalArmasController}") + private TotalArmasController totalPersonaController; + + private List ldocumentospersona; + + private String clase; + + public ArmaController() throws Exception { + super(TarmArmas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.record = new TarmArmas(); + this.beanalias = "ARMAS"; + this.create(); + + //Globales + descargar = false; + csolicitud = null; + + //Datos generales + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + //Obteniendo los datos de la persona + detallesPersona = PersonDetailController.find(String.valueOf(usuario.getPk().getPersoncode())); + + //Tipo de documento + tipoDocumento = CatalogDetailController.findxCodigoCodcatalogo(detallesPersona.getIdentificationcatalog(), detallesPersona.getIdentificationcatalogcode()); + + //Fecha actual + this.fechaActual = Calendar.getInstance().getTime(); + + //Tipos de registro + tiposRegistro = CatalogDetailController.find("TIPOREGISTRO", "REG"); + + //Detalle del material + lpaises = CountryController.find(); + registro.setFechasolicitud(new java.sql.Date((new Date()).getTime())); + + //Obteniendo la direccion de la persona + String tipoDireccion = ""; + + if (detallesPersona != null) { + switch (detallesPersona.getIdentificationcatalog()) { + case "CED": + tipoDireccion = "1"; + break; + case "RUC": + tipoDireccion = "2"; + break; + default: + tipoDireccion = ""; + break; + } + } + //direccion= personAddressController.findByPersonCode(usuario.getPk().getPersoncode().toString()); + direccion = personAddressController.findPrincipal(String.valueOf(usuario.getPk().getPersoncode().toString())); + + //Imprtacion + this.lprovincias = ProvinceController.find("EC"); + + //Armas + listaErrores = new ArrayList(); + + //Controlador de totales +// this.totalPersonaController=new TotalPersonaController(); +// this.totalPersonaController.create(); +// this.totalPersonaController.setLrecord(new ArrayList()); + RegistroArmController registroArmas = new RegistroArmController(); + registroArmas.init(); + registroArmas.setRecperpage(3000000); + registroArmas.addFilter("personcode", tsafeUserDetail.getPk().getPersoncode().toString()); + registroArmas.query(); + this.addFilter("estado", "REG"); + filtro(registroArmas.getLrecord()); + + //Obteniendo los aeropuertos + this.laeropuertos = CatalogDetailController.find("AEROPUERTOS"); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", "i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase = new SubQuery("TarmTipoArmaExplosivo", "clase", "cclase", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo = new SubQuery("TarmTipoArmaExplosivo", "clasecodigo", "cclasecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud = new SubQuery("TarmTipoArmaExplosivo", "longitud", "clongitud", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo = new SubQuery("TarmTipoArmaExplosivo", "longitudcodigo", "clongitudcodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre = new SubQuery("TarmTipoArmaExplosivo", "calibre", "ccalibre", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo = new SubQuery("TarmTipoArmaExplosivo", "calibrecodigo", "ccalibrecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivo", "ctipoarmaexplosivo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivocodigo", "ctipoarmaexplosivocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapeso", "cunidadmedidapeso", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapesocodigo", "cunidadmedidapesocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + + Filter filtrofecha = new Filter(); + filtrofecha.setSql("t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) and t.estado !='DEST' and t.estado !='CDP'"); + dto.addFiltro(filtrofecha); + dto.setOrderby("pk"); + String sql = csolicitud; + if (csolicitud != null) { + Filter filtro = new Filter(); + filtro.setSql(sql); + dto.addFiltro(filtro); + } + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + public void querydatabaseMarcaSerie(String cregistro, String marca, String serie) { + try { + + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", "i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase = new SubQuery("TarmTipoArmaExplosivo", "clase", "cclase", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo = new SubQuery("TarmTipoArmaExplosivo", "clasecodigo", "cclasecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud = new SubQuery("TarmTipoArmaExplosivo", "longitud", "clongitud", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo = new SubQuery("TarmTipoArmaExplosivo", "longitudcodigo", "clongitudcodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre = new SubQuery("TarmTipoArmaExplosivo", "calibre", "ccalibre", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo = new SubQuery("TarmTipoArmaExplosivo", "calibrecodigo", "ccalibrecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivo", "ctipoarmaexplosivo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivocodigo", "ctipoarmaexplosivocodigo", "i.pk=t.ctipoarmaexplosivo");// and i.clase='" + clase + "' and i.tipoarmaexplosivo='" + tipoArmaExplosivo + "'"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapeso", "cunidadmedidapeso", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapesocodigo", "cunidadmedidapesocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + + Filter filtrofecha = new Filter(); + filtrofecha.setSql("t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) " + + " and t.estado !='DEST' and t.estado !='CDP' and t.lote " + (serie == null ? " is null" : ("= '" + serie + "'")) + " and t.cregistro= '" + + cregistro + "' and t.marca " + (marca == null ? " is null" : ("= '" + marca + "'"))); + dto.addFiltro(filtrofecha); + dto.setOrderby("pk"); + /* String sql=csolicitud; + if(csolicitud!=null){ + Filter filtro = new Filter(); + filtro.setSql(sql); + dto.addFiltro(filtro); + }*/ + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + /* Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE");*/ + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecOked") + protected void querydatabaseSimple() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql = " t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para armar el registro + * + * @param lsolicitud + */ + public void filtro(List lsolicitud) { + + for (TarmRegistroArmas soli : lsolicitud) { + if (csolicitud == null) { + csolicitud = "(cregistro=" + soli.getPk(); + } else { + csolicitud += " or cregistro=" + soli.getPk(); + } + } + csolicitud += ")"; + + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + + DtoSave dtosave = super.getDtoSave(true); + dtosave.setPosition(2); + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); + + registroArmasController.clearAll(); + DtoSave dtosaveregistroarma = registroArmasController.getDtoSave(true); + dtosaveregistroarma.setPosition(1); + msave.put(registroArmasController.getBeanalias(), dtosaveregistroarma); + + totalPersonaController.clearAll(); + DtoSave dtosavetotalper = totalPersonaController.getDtoSave(true); + dtosavetotalper.setPosition(3); + msave.put(totalPersonaController.getBeanalias(), dtosavetotalper); + + request.setSaveTables(msave); + request.getModifiedData().put("LISTAARMAS", this.armas); + request.getModifiedData().put("LISTATOTALES", this.totalesPersoan); + request.getModifiedData().put("REGISTRO", this.registro); + + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + //this.totalPersonaController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Metodo que carga y valida el contenido de un archivo excel con + * información de armas + * + * @param event + */ + public void cargarArchivo(FileUploadEvent event) { + HashMap mapaTotalesTemporales = new HashMap<>(); + int f1 = 0; + try { + //Completando los datos del registro + this.registro.setPersoncode(this.usuario.getPk().getPersoncode()); + this.registro.setTiporegistrocodigo("TIPOREGISTRO"); + this.registro.setFechasolicitud(new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + //Inicializando las listas + listaFilas = new ArrayList(); + listaArmas = new ArrayList(); + listaErrores = new ArrayList(); + //caraga el excel + UploadedFile selectedFile = event.getFile(); + InputStream archivo = selectedFile.getInputstream(); + XSSFWorkbook libro = new XSSFWorkbook(archivo); + XSSFSheet hoja = libro.getSheetAt(0); + //Iterando sobre las filas + int cont = 0; + Iterator rowIterator = hoja.iterator(); + //Cargando el contenido de las celdas a una lista de objetos + while (rowIterator.hasNext()) { + cont++; + Row row = rowIterator.next(); + if (cont > 1) { + Cell numero = row.getCell(0); + Cell serie = row.getCell(1); + Cell clase = row.getCell(2); + Cell longitud = row.getCell(3); + Cell tipo = row.getCell(4); + Cell calibre = row.getCell(5); + Cell color = row.getCell(6); + Cell marca = row.getCell(7); + Cell cantidad = row.getCell(8); + Cell umcantidad = row.getCell(9); + Cell peso = row.getCell(10); + Cell umpeso = row.getCell(11); + Boolean filaEnBlanco = false; + if (this.celdaVacia(numero) && this.celdaVacia(serie) && this.celdaVacia(clase) + && this.celdaVacia(longitud) && this.celdaVacia(tipo) && this.celdaVacia(calibre) + && this.celdaVacia(color) && this.celdaVacia(marca) && this.celdaVacia(cantidad) + && this.celdaVacia(umcantidad) && this.celdaVacia(peso) && this.celdaVacia(umpeso)) { + filaEnBlanco = true; + } else { + listaFilas.add(row); + } + if (!filaEnBlanco) { + //arma la lista de las armas en un dto aniade en la lista listaArmas + armarlistaArmasExcel(numero, serie, clase, longitud, tipo, calibre, color, marca, cantidad, umcantidad, peso, umpeso, row); + } + } + } + //Verificando las filas duplicadas en el archivo + verificarFilasDuplicadas(listaArmas); + if (this.registro.getTiporegistro().equals("PRO")) { + //Verificando las filas duplicadas en la BD + verificarArmasExistentesEnBaseDeDatos(listaArmas, this.usuario.getPk().getPersoncode()); + } + Boolean contieneSerie = false; + //RECORRE LA LISTA DE LAS ARMAS y valida el CUPO DEL ARMA + //Validando los campos requeridos que estan vacios + recorreListaArmasExcel(contieneSerie, f1, mapaTotalesTemporales); + //Seteando los atributos de las armas y totales si no hay ningun error + if (listaErrores.isEmpty()) { + for (int i = 0; i < listaArmas.size(); i++) { + if (!listaArmas.get(i).getCamposIncompletos() && !listaArmas.get(i).getDuplicada() && listaArmas.get(i).getExisteCatalogo() + && listaArmas.get(i).getExisteTARMTIPOARMAEXPLOSIVO()) { //&& !listaArmas.get(i).getCupoInsuficiente() + //Marca + if (listaArmas.get(i).getCatalogoMarca() != null) { + listaArmas.get(i).getArma().setMarcacodigo("MARCA"); + listaArmas.get(i).getArma().setMarca(listaArmas.get(i).getCatalogoMarca().getPk().getCatalog()); + } + //Color + if (listaArmas.get(i).getCatalogoColor() != null) { + listaArmas.get(i).getArma().setColorcodigo("COLOR"); + listaArmas.get(i).getArma().setColor(listaArmas.get(i).getCatalogoColor().getPk().getCatalog()); + } + //Unidad medida cantidad + if (listaArmas.get(i).getTipoArmaExplosivo() != null) { + listaArmas.get(i).getArma().setUnidadmedidacantidadcodigo("UNIDADMEDIDA"); + Double doubleNum = 0.0; + //Cargando el catalodo del tipo de unidad de medida + if (listaArmas.get(i).getUnidadMedidaCantidad() != null && !listaArmas.get(i).getUnidadMedidaCantidad().isEmpty()) { + listaArmas.get(i).getArma().setUnidadmedidacantidad(listaArmas.get(i).getUnidadMedidaCantidad()); + doubleNum = Double.parseDouble(listaArmas.get(i).getTextoCantidad()); + //Cantidad + Integer intNum = (int) doubleNum.doubleValue(); + listaArmas.get(i).getArma().setCantidad(intNum); + } else if (listaArmas.get(i).getUnidadMedidaPeso() != null && !listaArmas.get(i).getUnidadMedidaPeso().isEmpty()) { + listaArmas.get(i).getArma().setUnidadmedidacantidad(listaArmas.get(i).getUnidadMedidaPeso()); + doubleNum = Double.parseDouble(listaArmas.get(i).getTextoPeso()); + //Peso + listaArmas.get(i).getArma().setPeso(new BigDecimal(doubleNum)); + } + } + //Estado + //1-Serie + //Validando que si el tipo de registro es de importacion + //las armas no contengan numero de serie + if (this.registro.getTiporegistro().equalsIgnoreCase("IMP")) { + listaArmas.get(i).getArma().setEstado("IMPO"); + } else { + listaArmas.get(i).getArma().setEstado("PRO"); + } + listaArmas.get(i).getArma().setEstadocodigo("ESTADOARMA"); + if (direccion != null) { + //Codigo de pais + listaArmas.get(i).getArma().setCountrycode(direccion.getCountrycode()); + //Codigo de provincia + listaArmas.get(i).getArma().setProvincecode(direccion.getProvincecode()); + //Codigo de canton + listaArmas.get(i).getArma().setCantoncode(direccion.getCantoncode()); + //Codigo de parroquia + listaArmas.get(i).getArma().setParroquiacode(direccion.getParroquiacode()); + //Codigo de ciudad + listaArmas.get(i).getArma().setCitycode(direccion.getCitycode()); + } + //Lote + listaArmas.get(i).getArma().setLote(listaArmas.get(i).getSerie()); + //Peso + if (listaArmas.get(i).getTextoPeso() != null && !listaArmas.get(i).getTextoPeso().isEmpty()) { + listaArmas.get(i).getArma().setPeso(BigDecimal.valueOf(Double.parseDouble(listaArmas.get(i).getTextoPeso()))); + } + //Direccion + listaArmas.get(i).getArma().setDireccion(direccion.getAddress()); + + //Fecha de registro + listaArmas.get(i).getArma().setFecharegistro(new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + + //Tipo de arma explosivo + if (listaArmas.get(i).getTipoArmaExplosivo() != null) { + listaArmas.get(i).getArma().setCtipoarmaexplosivo(listaArmas.get(i).getTipoArmaExplosivo().getPk()); + } + armas.add(listaArmas.get(i).getArma()); + } + } + //Se rrecorre el mapa HashMap mapaTotalesTemporales + for (TarmTotalPersona value : mapaTotalesTemporales.values()) { + totalesPersoan.add(value); + } + save(); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } finally { + if (!listaErrores.isEmpty()) { + listaArmas.clear(); + MessageHelper.setMessageError("ERRORES ENCONTRADOS DENTRO DEL ARCHIVO EXCEL: ");// + errores.toString()); + descargar = true; + } else { +// MessageHelper.setMessageInfo("ARCHIVO CARGADO EXITOSAMENTE"); + descargar = false; + } + } + } + + /** + * Metodo para cargar los valores del EXCEL EN UNA CLASE DTO(ArmaExcell ) + * + * @param numero * @param serie * @param clase * @param longitud * @param + * tipo * @param calibre + * @param color * @param marca * @param cantidad * @param umcantidad * + * @param peso * @param umpeso * @param row + */ + public void armarlistaArmasExcel(Cell numero, Cell serie, Cell clase, Cell longitud, Cell tipo, Cell calibre, Cell color, Cell marca, + Cell cantidad, Cell umcantidad, Cell peso, Cell umpeso, Row row) { + ArmaExcell arma = new ArmaExcell(); + arma.setTextoNumero(Utilidades.setearValorCelda(numero));//Numero + arma.setSerie(Utilidades.setearValorCelda(serie));//Serie + arma.setClase(Utilidades.setearValorCelda(clase));//Clase + arma.setLongitud(Utilidades.setearValorCelda(longitud));//Longitud + arma.setTipo(Utilidades.setearValorCelda(tipo));//Tipo + arma.setCalibre(Utilidades.setearValorCelda(calibre));//Calibre + arma.setColor(Utilidades.setearValorCelda(color));//Color + arma.setMarca(Utilidades.setearValorCelda(marca));//Marca + arma.setTextoCantidad(Utilidades.setearValorCelda(cantidad));//Cantidad + arma.setUnidadMedidaCantidad(Utilidades.setearValorCelda(umcantidad));//U. Medida Cantidad + arma.setTextoPeso(Utilidades.setearValorCelda(peso));//Peso + arma.setUnidadMedidaPeso(Utilidades.setearValorCelda(umpeso));//U. Medida Peso + if (this.registro.getTiporegistro().equals("PRO")) { + if (arma.getSerie() != null) { + if (arma.getClase().equalsIgnoreCase("arma de fuego") && !arma.getTextoCantidad().equals("1.0")) { + listaErrores.add("Fila " + row.getRowNum() + ": " + "Columna 8: " + MsgControlArmas.getProperty("msg_limitecantidadarma")); + return; + } + listaArmas.add(arma); + } else { + listaErrores.add("Fila " + row.getRowNum() + ": " + "Columna 1: " + MsgControlArmas.getProperty("msg_serieVacia")); + return; + } + } else if (arma.getClase().equalsIgnoreCase("arma de fuego") && arma.getTextoCantidad().equals("1.0")) { + listaArmas.add(arma); + } else if (!arma.getClase().equalsIgnoreCase("arma de fuego")) { + listaArmas.add(arma); + } else { + listaErrores.add("Fila " + row.getRowNum() + ": " + "Columna 8: " + MsgControlArmas.getProperty("msg_limitecantidadarma")); + return; + } + } + + /** + * Metodo que verifica si existen filas duplicadas en el archivo de excell + * + * @param listaArmas + */ + private void verificarFilasDuplicadas(List listaArmas) { + for (int i = 0; i < listaArmas.size() - 1; i++) { + for (int j = i + 1; j < listaArmas.size(); j++) { + if (!this.registro.getTiporegistro().equalsIgnoreCase("IMP") && ((listaArmas.get(i).getSerie().equalsIgnoreCase(listaArmas.get(j).getSerie())) + && listaArmas.get(i).getClase().equalsIgnoreCase(listaArmas.get(j).getClase()) + && listaArmas.get(i).getTipo().equalsIgnoreCase(listaArmas.get(j).getTipo()) + && (!listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego") + || (listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego") && listaArmas.get(j).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")) + && listaArmas.get(i).getCalibre().equalsIgnoreCase(listaArmas.get(j).getCalibre())) + && listaArmas.get(i).getMarca().equalsIgnoreCase(listaArmas.get(j).getMarca()))) { + listaArmas.get(j).setDuplicada(true); + break; + } + } + } + } + + /** + * @param listaArmas + * @throws Exception + */ + @SuppressWarnings("static-access") + private void verificarArmasExistentesEnBaseDeDatos(List listaArmas, Integer codigoPersona) throws Exception { + TgeneCatalogDetail codigoClase = new TgeneCatalogDetail(); + TgeneCatalogDetail codigoMarca = new TgeneCatalogDetail(); + TgeneCatalogDetail codigoTipo = new TgeneCatalogDetail(); + TgeneCatalogDetail codigoCalibre = new TgeneCatalogDetail(); + String codigoSerie; + List lstRegistroArmas = registroArmasController.findxPersoncode(String.valueOf(codigoPersona)); + if (lstRegistroArmas == null || listaArmas == null || lstRegistroArmas.isEmpty() || listaArmas.isEmpty()) { + return; + } + for (int i = 0; i < listaArmas.size(); i++) { + codigoClase = CatalogDetailController.findByCatalogcodeDescrption("CLASE", listaArmas.get(i).getClase()); + codigoTipo = CatalogDetailController.findByCatalogcodeDescrption("TIPOARMAEXPLOSIVO", listaArmas.get(i).getTipo()); + codigoMarca = CatalogDetailController.findByCatalogcodeDescrption("MARCA", listaArmas.get(i).getMarca()); + codigoSerie = this.registro.getTiporegistro().equalsIgnoreCase("IMP") ? null : listaArmas.get(i).getSerie(); + codigoCalibre = listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego") ? CatalogDetailController.findByCatalogcodeDescrption("CALIBRE", listaArmas.get(i).getCalibre()) : null; + + if ((codigoClase == null && (listaArmas.get(i).getClase() != null && !listaArmas.get(i).getClase().trim().isEmpty())) || (codigoTipo == null && (listaArmas.get(i).getTipo() != null && !listaArmas.get(i).getTipo().trim().isEmpty())) + || (codigoMarca == null && (listaArmas.get(i).getMarca() != null && !listaArmas.get(i).getMarca().trim().isEmpty())) || (codigoSerie == null && (listaArmas.get(i).getSerie() != null && !listaArmas.get(i).getSerie().trim().isEmpty())) + || (codigoCalibre == null && (listaArmas.get(i).getCalibre() != null && !listaArmas.get(i).getCalibre().trim().isEmpty())) + || listaArmas.get(i).getClase() == null || listaArmas.get(i).getMarca() == null || listaArmas.get(i).getCalibre() == null + || listaArmas.get(i).getClase().isEmpty() || listaArmas.get(i).getMarca().isEmpty() || listaArmas.get(i).getCalibre().isEmpty()) { + continue; + } + for (TarmRegistroArmas registroArmas : lstRegistroArmas) { + List lstArmasEncontradas = findByMarcaSerie(String.valueOf(registroArmas.getPk()), codigoMarca.getPk().getCatalog(), codigoSerie); + if (lstArmasEncontradas != null) { + for (TarmArmas armas : lstArmasEncontradas) { + TarmTipoArmaExplosivo tipoArma = TiposArmasExplosivosController.findarma(armas.getCtipoarmaexplosivo()); + if (tipoArma.getClase().equalsIgnoreCase(codigoClase.getPk().getCatalog()) && codigoCalibre != null ? tipoArma.getCalibre().equalsIgnoreCase(codigoCalibre.getPk().getCatalog()) : true && tipoArma.getTipoarmaexplosivo().equalsIgnoreCase(codigoTipo.getPk().getCatalog())) { + listaArmas.get(i).setDuplicada(true); + break; + } + } + } + } + } + } + + /** + * Metodo que recorre la lista de las armas con los valores cargados del + * EXCEL + * + * @param contieneSerie + * @param f1 + * @param mapaTotalesTemporales + */ + public void recorreListaArmasExcel(Boolean contieneSerie, int f1, HashMap mapaTotalesTemporales) { + for (int i = 0; i < listaArmas.size(); i++) { + Integer fila = i + 1; + f1 = i; + Boolean campoCantidad = false; + //0-Datos duplicados + if (listaArmas.get(i).getDuplicada()) { + listaErrores.add("Fila " + fila.toString() + ": " + MsgControlArmas.getProperty("msg_datosDuplicados")); + } + //1-Serie + //Validando que si el tipo de registro es de importacion + //las armas no contengan numero de serie + if (this.registro.getTiporegistro().equalsIgnoreCase("IMP") && (listaArmas.get(i).getSerie() != null) && !contieneSerie) { + contieneSerie = true; + listaErrores.add(MsgControlArmas.getProperty("msg_archivoImportacionSerie")); + } + if (!this.registro.getTiporegistro().equalsIgnoreCase("IMP") && (listaArmas.get(i).getSerie() == null || listaArmas.get(i).getSerie().trim().isEmpty())) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 1: " + MsgControlArmas.getProperty("msg_serieVacia")); + listaArmas.get(i).setCamposIncompletos(true); + } + //2-Clase + if (listaArmas.get(i).getClase() == null || listaArmas.get(i).getClase().trim().isEmpty()) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 2: " + MsgControlArmas.getProperty("msg_claseVacia")); + listaArmas.get(i).setCamposIncompletos(true); + + //3-Validando que cuando la clase sea ARMA DE FUEGO la longitud no este vacia + } else if (listaArmas.get(i).getClase().equalsIgnoreCase("ARMA DE FUEGO") + && (listaArmas.get(i).getLongitud() == null || listaArmas.get(i).getLongitud().trim().isEmpty())) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 3: " + MsgControlArmas.getProperty("msg_longitudVacia")); + listaArmas.get(i).setCamposIncompletos(true); + + //Validando que cuando la clase no sea ARMA DE FUEGO la longitud este vacia + } else if (!listaArmas.get(i).getClase().equalsIgnoreCase("ARMA DE FUEGO") + && (listaArmas.get(i).getLongitud() != null && !listaArmas.get(i).getLongitud().trim().isEmpty())) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 3: " + MsgControlArmas.getProperty("msg_longitudNoVacia")); + } + //Carga de catalogos + TgeneCatalogDetail catalogoClase = CatalogDetailController.findByCatalogcodeDescrption("CLASE", listaArmas.get(i).getClase()); + listaArmas.get(i).setCatalogoClase(catalogoClase); + if (catalogoClase != null && catalogoClase.getPk() != null && catalogoClase.getPk().getCatalog() != null && !clase.contains(catalogoClase.getPk().getCatalog())) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 2: " + " No tiene permiso para cargar " + catalogoClase.getDescription()); + listaArmas.get(i).setCamposIncompletos(true); + } else if (catalogoClase == null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 2: " + " No tiene ingresado una Clase V\u00e1lida "); + listaArmas.get(i).setCamposIncompletos(true); + } + TgeneCatalogDetail catalogoLongitud = CatalogDetailController.findByCatalogcodeDescrption("LONGITUD", listaArmas.get(i).getLongitud()); + listaArmas.get(i).setCatalogoLongitud(catalogoLongitud); + TgeneCatalogDetail catalogoTipoArma = CatalogDetailController.findByCatalogcodeDescrption("TIPOARMAEXPLOSIVO", listaArmas.get(i).getTipo()); + listaArmas.get(i).setCatalogoTipoArma(catalogoTipoArma); + TgeneCatalogDetail catalogoCalibre = CatalogDetailController.findByCatalogcodeDescrption("CALIBRE", listaArmas.get(i).getCalibre()); + listaArmas.get(i).setCatalogoCalibre(catalogoCalibre); + TgeneCatalogDetail catalogoColor = CatalogDetailController.findByCatalogcodeDescrption("COLOR", listaArmas.get(i).getColor()); + listaArmas.get(i).setCatalogoColor(catalogoColor); + TgeneCatalogDetail catalogoMarca = CatalogDetailController.findByCatalogcodeDescrption("MARCA", listaArmas.get(i).getMarca()); + listaArmas.get(i).setCatalogoMarca(catalogoMarca); + TarmUnidadTipo tipoUnidadSeleccionada = null;// new TarmUnidadTipo(); + if (catalogoClase != null) { + //Obteniendo la configuracion de TARMUNIDADTIPO + if (!(listaArmas.get(i).getUnidadMedidaCantidad() == null || listaArmas.get(i).getUnidadMedidaCantidad().isEmpty()) && !(listaArmas.get(i).getUnidadMedidaPeso() == null || listaArmas.get(i).getUnidadMedidaPeso().isEmpty())) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 9,11: " + MsgControlArmas.getProperty("msg_unidadMedidaSoloUna")); + } + String unidadMedidaIngresada = (listaArmas.get(i).getUnidadMedidaCantidad() == null || listaArmas.get(i).getUnidadMedidaCantidad().isEmpty()) ? listaArmas.get(i).getUnidadMedidaPeso() : listaArmas.get(i).getUnidadMedidaCantidad(); + String columnaUnidadMedidaError = (listaArmas.get(i).getUnidadMedidaCantidad() == null || listaArmas.get(i).getUnidadMedidaCantidad().isEmpty()) ? "Columna 11" : "Columna 9"; + if (listaArmas.get(i).getCatalogoTipoArma() == null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 5: El Tipo de Arma Explosivo no existe en el Catlogo. Revise los espacios entre cada palabra y que este bien escrito."); + listaArmas.get(i).setCamposIncompletos(true); + tipoUnidadSeleccionada = null; + } else { + tipoUnidadSeleccionada = UnidadTipoController.findByClaseAndClasecode(catalogoClase.getPk().getCatalog(), catalogoClase.getPk().getCatalogcode(), listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(), unidadMedidaIngresada); + } + if (tipoUnidadSeleccionada != null && tipoUnidadSeleccionada.getPk().getUnidadmedidapeso() != null && !tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().isEmpty()) { + if (tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().equalsIgnoreCase("UNIDAD") || tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().equalsIgnoreCase("UNIDADES")) { + campoCantidad = true; + } else if (tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().equalsIgnoreCase("KG")) { + campoCantidad = false; + } + } else if (tipoUnidadSeleccionada == null) { + listaErrores.add("Fila " + fila.toString() + ": " + columnaUnidadMedidaError + ": " + MsgControlArmas.getProperty("msg_unidadMedidaNoExiste")); + } + } + //4-Tipo + if (listaArmas.get(i).getTipo() == null || listaArmas.get(i).getTipo().trim().isEmpty()) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 4: " + MsgControlArmas.getProperty("msg_tipoVacio")); + listaArmas.get(i).setCamposIncompletos(true); + } + //5-Calibre + if (listaArmas.get(i).getClase() != null && !listaArmas.get(i).getClase().isEmpty() + && listaArmas.get(i).getClase().equalsIgnoreCase("ARMA DE FUEGO") + && (listaArmas.get(i).getCalibre() == null || listaArmas.get(i).getCalibre().trim().isEmpty())) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 5: " + MsgControlArmas.getProperty("msg_calibreVacio")); + } + //Marca + if (listaArmas.get(i).getMarca() == null || listaArmas.get(i).getMarca().trim().isEmpty()) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 7: " + MsgControlArmas.getProperty("msg_marcaVacia")); + listaArmas.get(i).setCamposIncompletos(true); + } + if (campoCantidad) { + //Cantidad + if ((listaArmas.get(i).getTextoCantidad() == null || listaArmas.get(i).getTextoCantidad().trim().isEmpty()) && tipoUnidadSeleccionada != null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 8: " + MsgControlArmas.getProperty("msg_cantidadVacia")); + listaArmas.get(i).setCamposIncompletos(true); + + } else if (listaFilas.get(i).getCell(8).getCellType() != Cell.CELL_TYPE_NUMERIC && tipoUnidadSeleccionada != null) { + //Verificando el tipo de dato numerico + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 8: " + MsgControlArmas.getProperty("msg_cantidadValorNumerico")); + } + + //U. Medida Cantidad + if ((listaArmas.get(i).getUnidadMedidaCantidad() == null || listaArmas.get(i).getUnidadMedidaCantidad().trim().isEmpty()) && tipoUnidadSeleccionada != null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 9: " + MsgControlArmas.getProperty("msg_unidadMedidaCantidadVacia")); + } + + //Peso + if ((listaArmas.get(i).getTextoPeso() != null && !listaArmas.get(i).getTextoPeso().trim().isEmpty()) && tipoUnidadSeleccionada != null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 10: " + MsgControlArmas.getProperty("msg_pesoNoVacio")); + } + + //U. Medida Peso + if ((listaArmas.get(i).getUnidadMedidaPeso() != null && !listaArmas.get(i).getUnidadMedidaPeso().trim().isEmpty()) && tipoUnidadSeleccionada != null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 11: " + MsgControlArmas.getProperty("msg_unidadMedidaPesoNoVacia")); + } + //Validando que cuando la clase NO sea ARMA DE FUEGO, MUNICION, + //Explosivos, Accesorios, Fuegos Pirotecnicos, Sustancia Quimica, Armas no Letales + //la cantidad y unidad de medida cantidad esten vacios + //y el peso y unidad de medida peso NO esten vacios + } else if (listaArmas.get(i).getClase() != null && !listaArmas.get(i).getClase().isEmpty()) { + //Cantidad + if ((listaArmas.get(i).getTextoCantidad() != null && !listaArmas.get(i).getTextoCantidad().trim().isEmpty()) && tipoUnidadSeleccionada != null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 8: " + MsgControlArmas.getProperty("msg_cantidadNoVacia")); + } + //U. Medida Cantidad + if (listaArmas.get(i).getUnidadMedidaCantidad() != null && !listaArmas.get(i).getUnidadMedidaCantidad().trim().isEmpty() && tipoUnidadSeleccionada != null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 9: " + MsgControlArmas.getProperty("msg_unidadMedidaCantidadNoVacia")); + } + //Peso + if ((listaArmas.get(i).getTextoPeso() == null || listaArmas.get(i).getTextoPeso().trim().isEmpty()) && tipoUnidadSeleccionada != null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 10: " + MsgControlArmas.getProperty("msg_pesoVacio")); + listaArmas.get(i).setCamposIncompletos(true); + + } else if (listaFilas.get(i).getCell(10).getCellType() != Cell.CELL_TYPE_NUMERIC && tipoUnidadSeleccionada != null) { + //Verificando el tipo de dato numerico + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 10: " + MsgControlArmas.getProperty("msg_pesoValorNumerico")); + } + //U. Medida Peso + if ((listaArmas.get(i).getUnidadMedidaPeso() == null || listaArmas.get(i).getUnidadMedidaPeso().trim().isEmpty()) && tipoUnidadSeleccionada != null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 11: " + MsgControlArmas.getProperty("msg_unidadMedidaPesoVacia")); + listaArmas.get(i).setCamposIncompletos(true); + } + } + //Verificando que no existan problemas en el arma proveniente del archivo EXCEL + //para validar entonces los datos en la base de datos + if (!listaArmas.get(i).getCamposIncompletos() && !listaArmas.get(i).getDuplicada()) { + //Verificando los datos en los catalogos + //Verificando la existencia de la clase en el catalogo + if (catalogoClase == null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 2: " + MsgControlArmas.getProperty("msg_calibreNoExisteCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + } else { + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia de la longitud en el catalogo + if (catalogoLongitud == null) { + listaArmas.get(i).setExisteCatalogo(false); + if (listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 3: " + MsgControlArmas.getProperty("msg_longitudNoExisteCatalogo")); + } + } else { + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia del tipo de arma en el catalogo + if (catalogoTipoArma == null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 4: " + MsgControlArmas.getProperty("msg_noExisteTipoArmaCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + } else { + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia del calibre en el catalogo + if (catalogoCalibre == null) { + listaArmas.get(i).setExisteCatalogo(false); + if (listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 5: " + MsgControlArmas.getProperty("msg_calibreNoExisteCatalogo")); + } + } else { + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia del color en el catalogo + if (listaArmas.get(i).getColor() != null && !listaArmas.get(i).getColor().isEmpty()) { + if (catalogoColor == null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 6: " + MsgControlArmas.getProperty("msg_colorNoExisteCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + } else { + listaArmas.get(i).setExisteCatalogo(true); + } + } + //Verificando la existencia de la marca en el catalogo + if (catalogoMarca == null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 7: " + MsgControlArmas.getProperty("msg_marcaNoExisteCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + } else { + listaArmas.get(i).setExisteCatalogo(true); + } + //Validacio 4- Verificando que exista la combinacion clase, longitud, tipo arma y calibre + //en la tabla TARMTIPOARMAEXPLOSIVO + if (listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")) { + if (catalogoClase != null && catalogoLongitud != null && catalogoTipoArma != null && catalogoCalibre != null && tipoUnidadSeleccionada != null) { + tipoArmaExplosivo = TiposArmasExplosivosController.findByClaseLongitudCalibreTipoArma(catalogoLongitud.getPk().getCatalog(), + catalogoCalibre.getPk().getCatalog(), catalogoClase.getPk().getCatalog(), catalogoTipoArma.getPk().getCatalog(), tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + + if (tipoArmaExplosivo == null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Registro no encontrado: " + listaArmas.get(i).getClase() + ", " + listaArmas.get(i).getLongitud() + ", " + listaArmas.get(i).getTipo() + ", " + listaArmas.get(i).getCalibre()); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } else { + listaArmas.get(i).setTipoArmaExplosivo(tipoArmaExplosivo); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(true); + } + } else { + listaErrores.add("Fila " + fila.toString() + ": " + "Registro no encontrado la combinaci\u00f3n del Tipo Arma Explosivo"); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } + } else if (catalogoCalibre != null && catalogoCalibre.getDescription() != null && !catalogoCalibre.getDescription().equals("")) { + // Caso donde existe calibre + if (catalogoClase != null && catalogoTipoArma != null && tipoUnidadSeleccionada != null) { + tipoArmaExplosivo = TiposArmasExplosivosController.findByClaseCalibreTipoArma(catalogoClase.getPk().getCatalog(), catalogoCalibre.getPk().getCatalog(), catalogoTipoArma.getPk().getCatalog(), tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + if (tipoArmaExplosivo == null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Registro no encontrado: " + listaArmas.get(i).getClase() + ", " + listaArmas.get(i).getTipo()); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } else { + listaArmas.get(i).setTipoArmaExplosivo(tipoArmaExplosivo); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(true); + } + } else { + listaErrores.add("Fila " + fila.toString() + ": " + "Registro no encontrado la combinaci\u00f3n del Tipo Arma Explosivo "); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } + } else // Caso donde no existe calibre + if (catalogoClase != null && catalogoTipoArma != null && tipoUnidadSeleccionada != null) { + tipoArmaExplosivo = TiposArmasExplosivosController.findByClaseTipo(catalogoClase.getPk().getCatalog(), catalogoTipoArma.getPk().getCatalog(), tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + if (tipoArmaExplosivo == null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Registro no encontrado: " + listaArmas.get(i).getClase() + ", " + listaArmas.get(i).getTipo()); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } else { + listaArmas.get(i).setTipoArmaExplosivo(tipoArmaExplosivo); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(true); + } + } else { + listaErrores.add("Fila " + fila.toString() + ": " + "Registro no encontrado la combinaci\u00f3n del Tipo Arma Explosivo "); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } + if (listaArmas.get(i).getCatalogoClase() != null && listaArmas.get(i).getCatalogoTipoArma() != null && listaArmas.get(i).getCatalogoMarca() != null) { + TarmArmas armaBD; + //Si el tipo de registro es de Importacion, el arma se persiste como nueva + //no se busca en la base de datos + if (this.registro.getTiporegistro().equalsIgnoreCase("IMP")) { + listaArmas.get(i).setExisteBaseDatos(false); + armaBD = new TarmArmas(); + armaBD.setIsnew(true); + } else { + //Verificando que el arma exista en la base de datos + //si el tipo de registro es de produccion + armaBD = null; //ArmasController.findBySerieMarca(listaArmas.get(i).getSerie(), listaArmas.get(i).getCatalogoMarca().getPk().getCatalog()); + if (armaBD == null) { + listaArmas.get(i).setExisteBaseDatos(false); + armaBD = new TarmArmas(); + armaBD.setIsnew(true); + } else { + List listaExplosivos = TiposArmasExplosivosController.findByClaseTipoAll(listaArmas.get(i).getCatalogoClase().getPk().getCatalog(), + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog()); + if (listaExplosivos == null) { + listaArmas.get(i).setExisteBaseDatos(false); + } else { + listaArmas.get(i).setExisteBaseDatos(false); + for (TarmTipoArmaExplosivo explosivo : listaExplosivos) { + if (explosivo.getPk().equalsIgnoreCase(armaBD.getCtipoarmaexplosivo())) { + listaArmas.get(i).setExisteBaseDatos(true); + armaBD.setIsnew(false); + break; + } + } + } + } + } + listaArmas.get(i).setArma(armaBD); + String unidadTipoIngresada = campoCantidad ? listaArmas.get(i).getUnidadMedidaCantidad() : listaArmas.get(i).getUnidadMedidaPeso(); + // CARGA EL CUPO ***** //persona,clase,tipoarmaexplosivo +// List cupo =ComercianteCupoController.findByPersonCode(usuario.getPk().getPersoncode().toString(), +// listaArmas.get(i).getCatalogoClase().getPk().getCatalog(), listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(), +// unidadTipoIngresada); +// +// if(cupo!=null && !cupo.isEmpty() && cupo.get(0).getTiporegistro().equalsIgnoreCase(this.registro.getTiporegistro())){ + //metodo de los TOTALES SETEADOS EN UN MAPA + cupoArmasExplosivos(i, mapaTotalesTemporales, fila, tipoUnidadSeleccionada); +// }else{ +// if(cupo==null || cupo.isEmpty()){ +// listaErrores.add("Fila "+fila.toString()+": Cupo no asignado para "+listaArmas.get(i).getClase()+"."); +// } +// else{ +// listaErrores.add("Fila "+fila.toString()+": Cupo no disponible para "+listaArmas.get(i).getClase()+"."); +// } +// listaArmas.get(i).setCupoInsuficiente(true); +// } + } + } + tipoUnidadSeleccionada = null; + } + } + + public void cupoArmasExplosivos(int i, HashMap mapaTotalesTemporales, Integer fila, TarmUnidadTipo tipoUnidadSeleccionada) { + +// listaArmas.get(i).setCupo1(0); + //Cargando el total + //saldo de la TotalPersona + BigDecimal saldoPasaraaAnterior = new BigDecimal(0); + //TarmTotalPersona totalMapa= new BigDecimal(0); + TarmTotalPersona totalPersona = null; +// Double cupoMaximo=listaArmas.get(i).getCupo().getCupounidad().doubleValue(); + //no existe + if (mapaTotalesTemporales.get(usuario.getPk().getPersoncode().toString() + "|" + listaArmas.get(i).getCatalogoClase().getPk().getCatalog() + "|" + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog()) == null) { + totalPersona = TotalPersonaController.findMaxFecha(listaArmas.get(i).getCatalogoClase().getPk().getCatalog(), + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(), usuario.getPk().getPersoncode().toString(), + tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + if (totalPersona == null) { + totalPersona = new TarmTotalPersona(); + totalPersona.setTotal(new BigDecimal(0)); + } else { + saldoPasaraaAnterior = (totalPersona == null ? new BigDecimal(0) : totalPersona.getTotal()); + } + BigDecimal peso = (listaArmas == null || listaArmas.get(i).getTextoPeso() == null || listaArmas.get(i).getTextoPeso().isEmpty()) ? new BigDecimal(0.0) : new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoPeso())); + BigDecimal cantidad = (listaArmas == null || listaArmas.get(i).getTextoCantidad() == null || listaArmas.get(i).getTextoCantidad().isEmpty()) ? new BigDecimal(0.0) : new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())); + totalPersona.setCantidadmovimiento(cantidad.add(peso)); + totalPersona.setTotal(new BigDecimal(0));//saldoPasaraaAnterior.add((listaArmas==null || listaArmas.get(i).getTextoCantidad()==null)?new BigDecimal(0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())))); + Double suma = 0.0; + //Cantidad + if (listaArmas.get(i).getUnidadMedidaCantidad() != null && !listaArmas.get(i).getUnidadMedidaCantidad().isEmpty()) { + listaArmas.get(i).setCantidad(Double.parseDouble(listaArmas.get(i).getTextoCantidad())); + totalPersona.setUnidadmedidapeso(listaArmas.get(i).getUnidadMedidaCantidad()); + //suma eltotal anterior + la cantidad a ingresar + suma = saldoPasaraaAnterior.doubleValue() + listaArmas.get(i).getCantidad(); + totalPersona.setTotal(new BigDecimal(suma)); + //Peso + } else if (listaArmas.get(i).getUnidadMedidaPeso() != null && !listaArmas.get(i).getUnidadMedidaPeso().isEmpty()) { + listaArmas.get(i).setPeso(Double.parseDouble(listaArmas.get(i).getTextoPeso())); + totalPersona.setUnidadmedidapeso(listaArmas.get(i).getUnidadMedidaPeso()); + //suma eltotal anterior + la cantidad a ingresar + suma = saldoPasaraaAnterior.doubleValue() + listaArmas.get(i).getPeso(); + totalPersona.setTotal(new BigDecimal(suma)); + } + } else {//existe la combinacion + totalPersona = mapaTotalesTemporales.get(usuario.getPk().getPersoncode().toString() + "|" + listaArmas.get(i).getCatalogoClase().getPk().getCatalog() + "|" + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog()); + BigDecimal peso = (listaArmas == null || listaArmas.get(i).getTextoPeso() == null || listaArmas.get(i).getTextoPeso().isEmpty()) ? new BigDecimal(0.0) : new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoPeso())); + BigDecimal cantidad = (listaArmas == null || listaArmas.get(i).getTextoCantidad() == null || listaArmas.get(i).getTextoCantidad().isEmpty()) ? new BigDecimal(0.0) : new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())); + totalPersona.setCantidadmovimiento(cantidad.add(peso).add(totalPersona.getCantidadmovimiento())); + totalPersona.setTotal(totalPersona.getSaldoanterior().add(totalPersona.getCantidadmovimiento()));//saldoPasaraaAnterior.add((listaArmas==null || listaArmas.get(i).getTextoCantidad()==null)?new BigDecimal(0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())))); + saldoPasaraaAnterior = totalPersona.getSaldoanterior(); + } + totalPersona.setPk(null); + totalPersona.setPersoncodigo(usuario.getPk().getPersoncode()); + totalPersona.setClase(listaArmas.get(i).getCatalogoClase().getPk().getCatalog()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setIngresoegreso("ING"); + totalPersona.setCarma(listaArmas.get(i).getArma().getPk()); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setFecha(new java.sql.Timestamp(new Date().getTime())); + totalPersona.setSaldoanterior(saldoPasaraaAnterior == null ? new BigDecimal(0) : saldoPasaraaAnterior); + totalPersona.setIsnew(true); + //Verificando si el usuario tiene cupo disponible para el arma + + //mapa con el nuevo total por clase tipo unidad + mapaTotalesTemporales.put(usuario.getPk().getPersoncode().toString() + "|" + listaArmas.get(i).getCatalogoClase().getPk().getCatalog() + "|" + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(), totalPersona); + listaArmas.get(i).setTotalPersona(totalPersona); + //Verificando que el la suma del total con la cantidad de armas + //no sea mayor que el cupo +// if(totalPersona.getTotal().doubleValue()>cupoMaximo){ +// listaErrores.add("Fila "+fila.toString()+": Cupo no disponible para "+listaArmas.get(i).getClase()); +// listaArmas.get(i).setCupoInsuficiente(true); +// }else{ +// //Actualizando el valor del total y del total anterior +// listaArmas.get(i).getTotalPersona().setSaldoanterior(listaArmas.get(i).getTotalPersona().getSaldoanterior()); +// listaArmas.get(i).getTotalPersona().setTotal(totalPersona.getTotal()); +// } + } + + /** + * Metodo que indica cuando una celda esta vacia + * + * @param celda + * @return + */ + public Boolean celdaVacia(Cell celda) { + Boolean vacia = false; + if (celda == null || celda.getCellType() == Cell.CELL_TYPE_BLANK || (celda.getCellType() == Cell.CELL_TYPE_STRING && celda.getStringCellValue().isEmpty())) { + vacia = true; + } + return vacia; + } + + /** + * + * @param carma + * @return + */ + public static TarmArmas findByPk(String carma) { + try { + ArmaController cc = new ArmaController(); +// cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", carma); + cc.querydatabaseSimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * + * @param codigopersona + * @return + */ + public static TarmArmas findBySerieMarca(String serie, String marca) { + try { + ArmaController cc = new ArmaController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("lote", serie); + cc.addFilter("marca", marca); + cc.querydatabaseSimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * + * Metodo para encontrar por marca y tipoarmaexplosivo + * + * @param marca + * @param tipoArmaExplosivo + * @return + * @throws Exception + */ + public static List findByMarcaSerie(String cregistro, String marca, String serie) throws Exception { + + ArmaController cc = new ArmaController(); + //cc.init(); + cc.recperpage = 300; + cc.querydatabaseMarcaSerie(cregistro, marca, serie); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + + } + + @SuppressWarnings("finally") + public File generarArchivoError(Long key) { + if (listaErrores.isEmpty()) { + + //MessageHelper.setMessageInfo("ARCHIVO SUBIDO CORRECTAMENTE"); + return null; + } + PrintWriter escribir = null; + File archivo = null; + try { + archivo = File.createTempFile("errorlog" + key, ".txt"); + escribir = new PrintWriter(archivo); + + for (String err : listaErrores) { + System.out.println(err); + + escribir.print(err + "\r\n"); + } + //escribir.close(); + limpiar(); + + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } finally { + escribir.flush(); + escribir.close(); + return archivo; + } + + } + + /** + * Llama a la construccion del metodo para recargar + */ + public void descargarArchivo() { + + Long key = new Date().getTime(); + File archivoTemporal = generarArchivoError(key); + if (archivoTemporal == null) { + return; + } + try { + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition", "attachment; filename=errorlog" + key + ".txt"); + OutputStream out = response.getOutputStream(); + InputStream inputStream = new FileInputStream(archivoTemporal.getAbsolutePath()); + + int read = 0; + byte[] bytes = new byte[1024]; + + while ((read = inputStream.read(bytes)) != -1) { + out.write(bytes, 0, read); + } + + inputStream.close(); + out.flush(); + + FacesContext.getCurrentInstance().responseComplete(); + + } catch (Exception e) { + // TODO: handle exception + } + } + + /** + * Limpia las los valores en las listas + */ + public void limpiar() { + try { + create(); + while (lrecord.iterator().hasNext()) { + record = lrecord.get(0); + remove(); + } + listaArmas = new ArrayList(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Carga las listas de cantones y limpia la lista de ciudades + */ + public void seleccionarProvincia() { + try { + codigoProvincia = this.record.getProvincecode(); + lcantones = CantonController.find("EC", record.getProvincecode()); + lciudades = new ArrayList<>(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Carga las listas de ciudades + */ + public void seleccionarCanton() { + try { + codigoCanton = this.record.getCantoncode(); + lciudades = CityController.find("EC", record.getProvincecode(), record.getCantoncode()); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void cargarDocumentosHabilitantes(String categoria) { + ldocumentospersona = new ArrayList<>(); + List listadocum = DocumentoHabilitanteController.findpersoncode(usuario.getPk().getPersoncode().toString(), categoria); + //Forma nmero 1 (Uso de Maps). + Map mapPersonas = new HashMap(listadocum.size()); + for (TarmDocumentoHabilitante p : listadocum) { + mapPersonas.put(p.getCtramite(), p); + } + //Agrego cada elemento del map a una nueva lista y muestro cada elemento. + System.out.println("Lista sin repetidos:"); + for (Entry p : mapPersonas.entrySet()) { + ldocumentospersona.add(p.getValue()); + } +// ldocumentospersona =DocumentoHabilitanteController.findpersoncode(usuario.getPk().getPersoncode().toString(),categoria); + } + + public void cambioTipoRegistro() { + if (registro.getTiporegistro() != null) { + if ("PRO".equals(registro.getTiporegistro())) { + cargarDocumentosHabilitantes("4");//4 Fabrica, 5Fabricante + } else {// IMP + cargarDocumentosHabilitantes("8");//8 importador + } + } else { + ldocumentospersona = new ArrayList<>(); + } + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public String getCodigoProvincia() { + return codigoProvincia; + } + + public void setCodigoProvincia(String codigoProvincia) { + this.codigoProvincia = codigoProvincia; + } + + public String getCodigoCanton() { + return codigoCanton; + } + + public void setCodigoCanton(String codigoCanton) { + this.codigoCanton = codigoCanton; + } + + public String getCodigoCiudad() { + return codigoCiudad; + } + + public void setCodigoCiudad(String codigoCiudad) { + this.codigoCiudad = codigoCiudad; + } + + String codigoCiudad; + + public void codigoCiudad() { + + } + + public void addPersoncodeFilter(String personcode) { + super.addFilter("pk.personcode", personcode); + } + + public List getLarmexcell() { + return listaArmas; + } + + public void setLarmexcell(List larmexcell) { + this.listaArmas = larmexcell; + } + + public ArmaExcell getArmaexcell() { + return armaexcell; + } + + public void setArmaexcell(ArmaExcell armaexcell) { + this.armaexcell = armaexcell; + } + + public TarmTipoArmaExplosivo getTipoarmexplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoarmexplosivo(TarmTipoArmaExplosivo tipoarmexplosivo) { + this.tipoArmaExplosivo = tipoarmexplosivo; + } + + public List getLaexel() { + return laexel; + } + + public void setLaexel(List laexel) { + this.laexel = laexel; + } + + public TcustPersonDetail getDetallesPersona() { + return detallesPersona; + } + + public void setDetallesPersona(TcustPersonDetail detallesPersona) { + this.detallesPersona = detallesPersona; + } + + public TcustPersonDetail getUsuario() { + return usuario; + } + + public void setUsuario(TcustPersonDetail usuario) { + this.usuario = usuario; + } + + public List getListaFilas() { + return listaFilas; + } + + public void setListaFilas(List listaFilas) { + this.listaFilas = listaFilas; + } + + public List getListaErrores() { + return listaErrores; + } + + public void setListaErrores(List listaErrores) { + this.listaErrores = listaErrores; + } + + public TarmTipoArmaExplosivo getTipoArmaExplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoArmaExplosivo(TarmTipoArmaExplosivo tipoArmaExplosivo) { + this.tipoArmaExplosivo = tipoArmaExplosivo; + } + + public List getListaArmas() { + return listaArmas; + } + + public void setListaArmas(List listaArmas) { + this.listaArmas = listaArmas; + } + + public PersonAddressController getPersonAddressController() { + return personAddressController; + } + + public void setPersonAddressController( + PersonAddressController personAddressController) { + this.personAddressController = personAddressController; + } + + public InputStream getFilei() { + return filei; + } + + public void setFilei(InputStream filei) { + this.filei = filei; + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public TcustPersonAddress getDireccion() { + return direccion; + } + + public void setDireccion(TcustPersonAddress direccion) { + this.direccion = direccion; + } + +// public List getCuposArmas() { +// return cuposArmas; +// } + // +// public void setCuposArmas(List cuposArmas) { +// this.cuposArmas = cuposArmas; +// } +// public ComercianteCupoController getComercianteCupoController() { +// return comercianteCupoController; +// } + // +// public void setComercianteCupoController( +// ComercianteCupoController comercianteCupoController) { +// this.comercianteCupoController = comercianteCupoController; +// } + public Boolean getDescargar() { + return descargar; + } + + public void setDescargar(Boolean descargar) { + this.descargar = descargar; + } + + public RegistroArmController getRegistroArmasController() { + return registroArmasController; + } + + public void setRegistroArmasController( + RegistroArmController registroArmasController) { + this.registroArmasController = registroArmasController; + } + + public TotalArmasController getTotalPersonaController() { + return totalPersonaController; + } + + public void setTotalPersonaController( + TotalArmasController totalPersonaController) { + this.totalPersonaController = totalPersonaController; + } + + public TgeneCountry getPais() { + return pais; + } + + public void setPais(TgeneCountry pais) { + this.pais = pais; + } + + public List getLciudades() { + return lciudades; + } + + public void setLciudades(List lciudades) { + this.lciudades = lciudades; + } + + public TgeneCity getCiudad() { + return ciudad; + } + + public void setCiudad(TgeneCity ciudad) { + this.ciudad = ciudad; + } + + public List getArmas() { + return armas; + } + + public void setArmas(List armas) { + this.armas = armas; + } + + public List getTotalesPersoan() { + return totalesPersoan; + } + + public void setTotalesPersoan(List totalesPersoan) { + this.totalesPersoan = totalesPersoan; + } + + public TgeneCatalogDetail getTipoDocumento() { + return tipoDocumento; + } + + public void setTipoDocumento(TgeneCatalogDetail tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public List getTiposRegistro() { + return tiposRegistro; + } + + public void setTiposRegistro(List tiposRegistro) { + this.tiposRegistro = tiposRegistro; + } + + public TgeneCatalogDetail getTipoRegistro() { + return tipoRegistro; + } + + public void setTipoRegistro(TgeneCatalogDetail tipoRegistro) { + this.tipoRegistro = tipoRegistro; + } + + public List getLpaises() { + return lpaises; + } + + public void setLpaises(List lpaises) { + this.lpaises = lpaises; + } + + public List getLprovincias() { + return lprovincias; + } + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + public TarmRegistroArmas getRegistro() { + return registro; + } + + public void setRegistro(TarmRegistroArmas registro) { + this.registro = registro; + } + + public List getLaeropuertos() { + return laeropuertos; + } + + public void setLaeropuertos(List laeropuertos) { + this.laeropuertos = laeropuertos; + } + + public List getLdocumentospersona() { + return ldocumentospersona; + } + + public void setLdocumentospersona( + List ldocumentospersona) { + this.ldocumentospersona = ldocumentospersona; + } + + public String getClase() { + return clase; + } + + public void setClase(String clase) { + this.clase = clase; + } + + public Integer getPersoncode() { + return personcode; + } + + public void setPersoncode(Integer personcode) { + this.personcode = personcode; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/AuxCargaArmasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/AuxCargaArmasController.java new file mode 100644 index 0000000..5b79b3c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/AuxCargaArmasController.java @@ -0,0 +1,516 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletResponse; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.jboss.logging.Logger; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.solicitud.AuxArmasController; +import com.fp.frontend.controller.armas.solicitud.DecomisoArmaController; +import com.fp.frontend.controller.armas.solicitud.DecomisoController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class AuxCargaArmasController extends AbstractController { + + /** + * Variable para listar los errores al cargar el excel + */ + private List listaErrores; + /** + * Mensaje de error + */ + private String mensajeError; + /** + * numero de armas procesadas + */ + private Integer numArmasProcesadas; + /** + * numero de armas con error + */ + private Integer numArmasError; + /** + * numero de armas con error + */ + private Integer numCorrectas; + /** + * Centro de control Policoa Judicia 2/PN07 + */ + private TarmCentroControl centroControl; + + /** + * Detalle del usuario + */ + @SuppressWarnings("unused") + private TcustPersonDetail usuario; + + /** + * Nombre del centro de control logeado + */ + private String centroControlNombreLogeado; + + /*Constante centro control*/ + @SuppressWarnings("unused") + private String nombreInstitucion; + @SuppressWarnings("unused") + private String institucion; + /*Cedula del propietario*/ + @SuppressWarnings("unused") + private String cedulaPropietario; + /*motivo incautacion*/ + @SuppressWarnings("unused") + private String motivocatalogo; + /*cantidad de armas*/ + @SuppressWarnings("unused") + private Integer cantidad = 1; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmasController; + + /** + * Controlador que maneja el decomiso TarmDecomiso + */ + @ManagedProperty(value = "#{decomisoController}") + private DecomisoController decomisoController; + + /** + * Controlador que maneja TarmDecomisoArma + */ + @ManagedProperty(value = "#{decomisoArmaController}") + private DecomisoArmaController decomisoArmaController; + + private final static Logger LOG = Logger.getLogger(AuxCargaArmasController.class.getName()); + + public AuxCargaArmasController() throws Exception { + super(TarmArmas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.record = new TarmArmas(); + this.beanalias = "AUXARMAS"; +// listArmas = new ArrayList(); + cargaParametros(); + cargaUsuarioLogeado(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void cargaParametros() { + nombreInstitucion = codigos("CODIGO.NOM.INSTIT.IMPORTE");//"PJ01" + institucion = codigos("CODIGO.INSTITUCION.IMPORTE");//2 + /*Cedula del propietario*/ + cedulaPropietario = codigos("CEDULA.PROPIETARIO.IMPORTE");//"999999999"; + /*motivo incautacion*/ + motivocatalogo = codigos("MOTIVO.IMPORTE");//"9"; + } + + /** + * Método para obtener los codigos + */ + private String codigos(String parametro) { + TgeneParameters tgeneParameters = ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + public void cargaUsuarioLogeado() { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + centroControlNombreLogeado = tsafeUserDetail.getModifiedData().get("centrocontrol").toString(); + } + + + /* + * (non-Javadoc) + * + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + + DtoQuery dto = super.getDtoQuery(true); + Filter filtrofecha = new Filter(); + filtrofecha + .setSql("t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) and t.estado !='DEST' and t.estado !='CDP'"); + dto.addFiltro(filtrofecha); + dto.setOrderby("pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + if (lrecord == null || lrecord.size() == 0 || lrecord.isEmpty()) { + MessageHelper.setMessageError("NO EXISTEN ARMAS CARGADAS "); + return; + } + HashMap msave = new HashMap(); + Request request = this.callerhelper.getRequest(); + + DtoSave dtosave = super.getDtoSave(true); + dtosave.setPosition(1); + msave.put(this.beanalias, dtosave); + + request.setSaveTables(msave); + //request.getModifiedData().put("REGISTRO", this.registroArma); + + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + mensajeError = null; + MessageHelper.setMessageInfo(resp); + lrecord.clear(); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Metodo que carga y valida el contenido de un archivo excel con + * información de armas + * + * @param event + */ + public void cargarArchivo(FileUploadEvent event) { + // cargar Armas + lrecord.clear(); + this.clearAll(); + listaErrores = new ArrayList(); + int cont = 0; + try { + UploadedFile selectedFile = event.getFile(); + InputStream archivo = selectedFile.getInputstream(); + XSSFWorkbook libro = new XSSFWorkbook(archivo); + XSSFSheet hoja = libro.getSheetAt(0); + // Iterando sobre las filas + Iterator rowIterator = hoja.iterator(); + // Cargando el contenido de las celdas a una lista de objetos + Set listaCodigoArmas = new HashSet(); + while (rowIterator.hasNext()) { + Row row = rowIterator.next(); + System.out.println("contador........." + cont); + if (cont != 0) { + Cell codigoArma = row.getCell(0); + if (!this.celdaVacia(codigoArma)) { + listaCodigoArmas.add(codigoArma.toString().trim()); + } else { + listaErrores.add("CELDA VACIA: " + codigoArma + " Num:" + cont); + } + cont++; + LOG.info("Contador " + cont); + } else { + cont++; + } + } + archivo.close(); + LOG.info("ARMAS CARGADAS: " + listaCodigoArmas.size()); + int auxi = 0; + //procesar armas + for (String item : listaCodigoArmas) { + System.out.println("contador2: " + auxi++); + TarmArmas arma = AuxArmasController.findByPK(item); + if (arma != null) { + record = arma; + record.setPk(null); + record.setIsnew(true); + record.setEstado("DEST"); + record.setFecharegistro(new java.sql.Date(new Date().getTime())); + SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yyyy"); + record.setEstadoDecomiso("DESTRUIDAS: " + formato.format(new Date())); + super.update(); + } else { + listaErrores.add("ARMA NO ENCONTRADA: " + item + " "); + } + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } finally { + numArmasProcesadas = cont - 1; + if (!listaErrores.isEmpty()) { + MessageHelper.setMessageError("ERRORES ENCONTRADOS DENTRO DEL ARCHIVO EXCEL: "); + mensajeError = "ERROR EN LA CARGA DE ARMAS"; + numCorrectas = lrecord.size(); + lrecord.clear(); + this.clearAll(); + } else { + numCorrectas = lrecord.size(); + } + numArmasError = listaErrores.size(); + } + } + + /** + * Metodo que indica cuando una celda esta vacia + * + * @param celda + * @return + */ + private Boolean celdaVacia(Cell celda) { + Boolean vacia = false; + if (celda == null || celda.getCellType() == Cell.CELL_TYPE_BLANK + || (celda.getCellType() == Cell.CELL_TYPE_STRING && celda.getStringCellValue().isEmpty())) { + vacia = true; + } + return vacia; + } + + @SuppressWarnings("finally") + private File generarArchivoError(Long key) { + if (listaErrores.isEmpty()) { + return null; + } + PrintWriter escribir = null; + File archivo = null; + try { + archivo = File.createTempFile("errorlog" + key, ".txt"); + escribir = new PrintWriter(archivo); + for (String err : listaErrores) { + escribir.print(err + "\r\n"); + } + limpiar(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + escribir.flush(); + escribir.close(); + return archivo; + } + } + + /** + * Llama a la construccion del metodo para recargar + */ + public void descargarArchivo() { + if (listaErrores != null && listaErrores.size() > 0) { + Long key = new Date().getTime(); + File archivoTemporal = generarArchivoError(key); + if (archivoTemporal == null) { + return; + } + try { + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition", "attachment; filename=errorlog" + key + ".txt"); + OutputStream out = response.getOutputStream(); + InputStream inputStream = new FileInputStream(archivoTemporal.getAbsolutePath()); + int read = 0; + byte[] bytes = new byte[1024]; + + while ((read = inputStream.read(bytes)) != -1) { + out.write(bytes, 0, read); + } + + inputStream.close(); + out.flush(); + FacesContext.getCurrentInstance().responseComplete(); + } catch (Exception e) { + } + } else { + MessageHelper.setMessageError("NO TIENE ERRORES"); + } + } + + /** + * Limpia las los valores en las listas + */ + public void limpiar() { + try { + create(); + while (lrecord.iterator().hasNext()) { + record = lrecord.get(0); + remove(); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public String getCodigoCiudad() { + return codigoCiudad; + } + + public void setCodigoCiudad(String codigoCiudad) { + this.codigoCiudad = codigoCiudad; + } + + String codigoCiudad; + + public void codigoCiudad() { + } + + public void addPersoncodeFilter(String personcode) { + super.addFilter("pk.personcode", personcode); + } + + public List getListaErrores() { + return listaErrores; + } + + public void setListaErrores(List listaErrores) { + this.listaErrores = listaErrores; + } + + public RegistroArmController getRegistroArmasController() { + return registroArmasController; + } + + public void setRegistroArmasController( + RegistroArmController registroArmasController) { + this.registroArmasController = registroArmasController; + } + + public String getMensajeError() { + return mensajeError; + } + + public void setMensajeError(String mensajeError) { + this.mensajeError = mensajeError; + } + + public Integer getNumArmasProcesadas() { + return numArmasProcesadas; + } + + public void setNumArmasProcesadas(Integer numArmasProcesadas) { + this.numArmasProcesadas = numArmasProcesadas; + } + + public Integer getNumArmasError() { + return numArmasError; + } + + public void setNumArmasError(Integer numArmasError) { + this.numArmasError = numArmasError; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getCentroControlNombreLogeado() { + return centroControlNombreLogeado; + } + + public void setCentroControlNombreLogeado(String centroControlNombreLogeado) { + this.centroControlNombreLogeado = centroControlNombreLogeado; + } + + public DecomisoController getDecomisoController() { + return decomisoController; + } + + public void setDecomisoController(DecomisoController decomisoController) { + this.decomisoController = decomisoController; + } + + public DecomisoArmaController getDecomisoArmaController() { + return decomisoArmaController; + } + + public void setDecomisoArmaController( + DecomisoArmaController decomisoArmaController) { + this.decomisoArmaController = decomisoArmaController; + } + + public Integer getNumCorrectas() { + return numCorrectas; + } + + public void setNumCorrectas(Integer numCorrectas) { + this.numCorrectas = numCorrectas; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/BuscarTramiteLovController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/BuscarTramiteLovController.java new file mode 100644 index 0000000..108fea0 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/BuscarTramiteLovController.java @@ -0,0 +1,266 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.solicitud.TarmTramiteController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del lov asociado al bean TarmTramite. + * + * @author Christian Pazmino. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class BuscarTramiteLovController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 1L; + private List ltipoTramite; + private List ltipoAutorizacion; + private List lcategoria; + private List lusoActividad; + private String ctramite; + private String tipoPersonaAmbos; + private List tarmTramite; + private String tipoautorizacion; + private String tipotramite; + private String categoria; + + public BuscarTramiteLovController() throws Exception { + super(TarmTramite.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + try { + ctramite = CallerHelper.getLovParameter("ctramite"); + String tipopersonasol = CallerHelper.getLovParameter("tipopersonasol"); + if (tipopersonasol != null && tipopersonasol.trim().length() > 0) { + tipoPersonaAmbos = ParametersController.find("CODIGO.PERSONTYPE.AMBOS", "1").getTextvalue(); + this.getMfilelds().put("tipopersonasol", "(tipopersona='" + tipoPersonaAmbos + "' or tipopersona='" + tipopersonasol + "') "); + } + // Inicializa autoconsulta + super.startQuery(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TRAMITE"; + ltipoAutorizacion = CatalogDetailController.find("TIPOAUTORIZACION"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.tipotramite, t.tipoautorizacion, t.categoria, t.usoactividad"); + SubQuery stipoAutorizacion = new SubQuery("TgeneCatalogDetail", "description", "destipoAutorizacion", "i.pk.catalog = t.tipoautorizacion and i.pk.catalogcode=t.tipoautorizacioncodigo"); + SubQuery stipoTramite = new SubQuery("TgeneCatalogDetail", "description", "destipoTramite", "i.pk.catalog = t.tipotramite and i.pk.catalogcode=t.tipotramitecodigo"); + SubQuery scategoria = new SubQuery("TgeneCatalogDetail", "description", "descategoria", "i.pk.catalog = t.categoria and i.pk.catalogcode=t.categoriacodigo"); + SubQuery susoactividad = new SubQuery("TgeneCatalogDetail", "description", "desusoactividad", "i.pk.catalog = t.usoactividad and i.pk.catalogcode=t.usoactividadcodigo"); + + dto.addSubQuery(stipoAutorizacion); + dto.addSubQuery(stipoTramite); + dto.addSubQuery(scategoria); + dto.addSubQuery(susoactividad); + //valida si tiene el codigo del tramite padre + if (ctramite != null) { + Filter filtro = new Filter(); + filtro.setSql("pk !=" + ctramite); + dto.addFiltro(filtro); + } + + if (this.getMfilelds().get("tipopersonasol") != null) { + Filter filtro = new Filter(); + filtro.setSql(this.getMfilelds().get("tipopersonasol").toString()); + dto.addFiltro(filtro); + } + +// dto.setOrderby("t.tipotramite"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 980); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/buscartramiteLov.xhtml", options, params); + } + + public void catalogos(List list, String codigo, String pk) { + for (TgeneCatalogDetail item : list) { + if (codigo == item.getPk().getCatalog()) { + record.modifiedData.put(pk, item.getDescription()); + break; + } + } + } + + /** + * Método para el evento change del combo tramite + */ + public void executeTramite() { + tarmTramite = new ArrayList<>(); + ltipoTramite = new ArrayList<>(); + lcategoria = new ArrayList<>(); + lusoActividad = new ArrayList<>(); + + tipoautorizacion = (String) this.getMfilters().get("pk.tipoautorizacion"); + + tarmTramite = TarmTramiteController.findPorCriteriosTramite(tipoautorizacion); + + for (int i = 0; i < tarmTramite.size(); i++) { + TarmTramite tramite = tarmTramite.get(i); + + TgeneCatalogDetail catalogDetail = CatalogDetailController.findCatalogo(tramite.getTipotramitecodigo(), tramite.getTipotramite()); + if (!ltipoTramite.contains(catalogDetail)) { + ltipoTramite.add(catalogDetail); + } + } + + } + + /** + * Método para el evento change del combo autorizacion + */ + public void executeTipoTramite() { + lusoActividad = new ArrayList<>(); + tipotramite = (String) this.getMfilters().get("pk.tipotramite"); + + for (int i = 0; i < tarmTramite.size(); i++) { + TarmTramite tramite = tarmTramite.get(i); + if (tramite.getTipotramite().equals(tipotramite) && tramite.getCategoriacodigo().equals("CATEGORIA")) { + TgeneCatalogDetail catalogDetail = CatalogDetailController.findCatalogo(tramite.getCategoriacodigo(), tramite.getCategoria()); + + if (!lcategoria.contains(catalogDetail)) { + lcategoria.add(catalogDetail); + } + } + + } + + } + + /** + * Método para el evento change del combo categoria + */ + public void executeCategoria() { + + categoria = (String) this.getMfilters().get("pk.categoria"); + lusoActividad = new ArrayList<>(); + for (int i = 0; i < tarmTramite.size(); i++) { + TarmTramite tramite = tarmTramite.get(i); + if (tramite.getTipotramite().equals(tipotramite) && tramite.getCategoria().equals(categoria) + && tramite.getCategoriacodigo().equals("CATEGORIA") && tramite.getUsoactividadcodigo().equals("USOACTIVIDAD")) { + TgeneCatalogDetail catalogDetail = CatalogDetailController.findCatalogo(tramite.getUsoactividadcodigo(), tramite.getUsoactividad()); + + if (!lusoActividad.contains(catalogDetail)) { + lusoActividad.add(catalogDetail); + } + } + } + } + + public List getLtipoTramite() { + return ltipoTramite; + } + + public void setLtipoTramite(List ltipoTramite) { + this.ltipoTramite = ltipoTramite; + } + + public List getLcategoria() { + return lcategoria; + } + + public void setLcategoria(List lcategoria) { + this.lcategoria = lcategoria; + } + + public List getLusoActividad() { + return lusoActividad; + } + + public void setLusoActividad(List lusoActividad) { + this.lusoActividad = lusoActividad; + } + + public List getLtipoAutorizacion() { + return ltipoAutorizacion; + } + + public void setLtipoAutorizacion(List ltipoAutorizacion) { + this.ltipoAutorizacion = ltipoAutorizacion; + } + + public void setTramite() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setTramite(TarmTramite tarmTramite) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tarmTramite); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/CalibreLovController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/CalibreLovController.java new file mode 100644 index 0000000..1fd5160 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/CalibreLovController.java @@ -0,0 +1,117 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class CalibreLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public CalibreLovController() throws Exception { + super(TgeneCatalogDetail.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "LONGITUDLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + this.getMfilters().put("pk.catalogcode", "CALIBRE"); + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog(TgeneCatalogDetail tgeneCatalogDetail) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneCatalogDetail); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/calibreLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/CashManagementHistoryController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/CashManagementHistoryController.java new file mode 100644 index 0000000..153bfcc --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/CashManagementHistoryController.java @@ -0,0 +1,293 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.apache.commons.lang.StringUtils; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.fun.TarmCashManagementHistory; +import com.fp.persistence.parmas.fun.TarmInventarioSubidoPorPersona; + +/** + * Clase controladora del bean TgeneCatalogDetail. + * + * @author Christian Pazmino. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CashManagementHistoryController extends AbstractController { + + // Fecha inicial + private Date fechainicial; + // Fecha final + private Date fechafinal; + + public CashManagementHistoryController() throws Exception { + super(TarmCashManagementHistory.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + if (fechainicial != null && fechafinal != null) { + super.startQuery(); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CASHMANAGEMENTHISTORY"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + DtoQuery dto = super.getDtoQuery(true); + + if (fechainicial != null && fechafinal != null) { + if (this.fechainicial.getTime() > this.fechafinal.getTime()) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaFin")); + this.lrecord = new ArrayList<>(); + return; + } + Filter filtroFecha = new Filter(); + SimpleDateFormat formato = new SimpleDateFormat("yyyy-MM-dd"); + filtroFecha.setSql("t.datefrom>=TO_DATE('" + formato.format(fechainicial) + "','yyyy-MM-dd')" + " and " + "t.datefrom<=TO_DATE('" + formato.format(fechafinal) + "','yyyy-MM-dd')"); + dto.addFiltro(filtroFecha); + } + dto.setOrderby("t.datefrom"); + SubQuery queryPersonDetail = new SubQuery("TcustPersonDetail", "name", "personname", + "i.pk.personcode=(Select max(o.pk.personcode) from TsafeUserDetail o where o.pk.usercode = t.usercode and o.pk.dateto=to_date('2999-12-31', 'YYYY-MM-DD')) and i.pk.dateto=to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(queryPersonDetail); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + for (TarmCashManagementHistory tmp : lrecord) { + // path del alfresco arreglado + tmp.getModifiedData().put("pathAlfresco", tmp.getPathreporte().replace("cm:", "")); +// SimpleDateFormat sdfHora=new SimpleDateFormat("HH:mm"); + // Fecha y hora separados + Calendar fechaTmpCal = Calendar.getInstance(); + fechaTmpCal.setTimeInMillis(tmp.getDatefrom().getTime()); + tmp.getModifiedData().put("hora", StringUtils.leftPad(String.valueOf(fechaTmpCal.get(Calendar.HOUR_OF_DAY)), 2, '0') + ":" + StringUtils.leftPad(String.valueOf(fechaTmpCal.get(Calendar.MINUTE)), 2, '0')); + tmp.getModifiedData().put("fecha", fechaTmpCal.get(Calendar.YEAR) + "-" + StringUtils.leftPad(String.valueOf(fechaTmpCal.get(Calendar.MONTH) + 1), 2, '0') + "-" + StringUtils.leftPad(String.valueOf(fechaTmpCal.get(Calendar.DAY_OF_MONTH)), 2, '0')); + + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void update(TarmCashManagementHistory bean) throws Exception { + record = bean; + update(); + } + + /** + * + */ + public static TarmCashManagementHistory findUltimoReporteGenerado() { + try { + CashManagementHistoryController cc = new CashManagementHistoryController(); + cc.init(); + cc.recperpage = 10; + cc.addFilter("dateto", "2999-12-31"); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * + */ + public static List findReportesGeneradosVigentes() { + try { + CashManagementHistoryController cc = new CashManagementHistoryController(); + cc.init(); + cc.recperpage = 10000; + cc.addFilter("dateto", "2999-12-31"); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * + */ + public static List findReportesByDate(Date fechainicial, Date fechafinal) { + try { + CashManagementHistoryController cc = new CashManagementHistoryController(); + cc.init(); + cc.recperpage = 10000; +// cc.addFilter("dateto", "2999-12-31"); + cc.querydatabaseByDate(fechainicial, fechafinal);; + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaseByDate(Date fechainicial, Date fechafinal) { + try { + + DtoQuery dto = super.getDtoQuery(true); + + if (fechainicial != null && fechafinal != null) { + if (fechainicial.getTime() > fechafinal.getTime()) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaFin")); + this.lrecord = new ArrayList<>(); + return; + } + Filter filtroFecha = new Filter(); + SimpleDateFormat formato = new SimpleDateFormat("yyyy-MM-dd"); + filtroFecha.setSql("t.datefrom>=TO_DATE('" + formato.format(fechainicial) + "','yyyy-MM-dd')" + " and " + "t.datefrom<=TO_DATE('" + formato.format(fechafinal) + "','yyyy-MM-dd')"); + dto.addFiltro(filtroFecha); + } + dto.setOrderby("t.datefrom"); + SubQuery queryPersonDetail = new SubQuery("TcustPersonDetail", "name", "personname", + "i.pk.personcode=(Select max(o.pk.personcode) from TsafeUserDetail o where o.pk.usercode = t.usercode and o.pk.dateto=to_date('2999-12-31', 'YYYY-MM-DD')) and i.pk.dateto=to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(queryPersonDetail); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + for (TarmCashManagementHistory tmp : lrecord) { + // path del alfresco arreglado + tmp.getModifiedData().put("pathAlfresco", tmp.getPathreporte().replace("cm:", "")); +// SimpleDateFormat sdfHora=new SimpleDateFormat("HH:mm"); + // Fecha y hora separados + Calendar fechaTmpCal = Calendar.getInstance(); + fechaTmpCal.setTimeInMillis(tmp.getDatefrom().getTime()); + tmp.getModifiedData().put("hora", StringUtils.leftPad(String.valueOf(fechaTmpCal.get(Calendar.HOUR_OF_DAY)), 2, '0') + ":" + StringUtils.leftPad(String.valueOf(fechaTmpCal.get(Calendar.MINUTE)), 2, '0')); + tmp.getModifiedData().put("fecha", fechaTmpCal.get(Calendar.YEAR) + "-" + StringUtils.leftPad(String.valueOf(fechaTmpCal.get(Calendar.MONTH) + 1), 2, '0') + "-" + StringUtils.leftPad(String.valueOf(fechaTmpCal.get(Calendar.DAY_OF_MONTH)), 2, '0')); + + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Limpia los registros anteriores + */ + public void limpiar() { + this.lrecord = new ArrayList<>(); + fechainicial = null; + fechafinal = null; + } + + public Date getFechainicial() { + return fechainicial; + } + + public void setFechainicial(Date fechainicial) { + this.fechainicial = fechainicial; + } + + public Date getFechafinal() { + return fechafinal; + } + + public void setFechafinal(Date fechafinal) { + this.fechafinal = fechafinal; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/CatalogFilterLovController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/CatalogFilterLovController.java new file mode 100644 index 0000000..081e6ac --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/CatalogFilterLovController.java @@ -0,0 +1,161 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author Christian Pazmino. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class CatalogFilterLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private String tituloLOV; + private String filtro; + + public CatalogFilterLovController() throws Exception { + super(TgeneCatalogDetail.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + tituloLOV = CallerHelper.getLovParameter("tituloLOV"); + + String catalogcode = CallerHelper.getLovParameter("catalogcode"); + if (catalogcode != null) { + super.addFilter("pk.catalogcode", catalogcode); + } + // Valor usado para filtrar registros de la tabla TGENECATALOGDETAIL + filtro = CallerHelper.getLovParameter("filtro"); + + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CLASELOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + + Filter filtroGeneral = new Filter(); + filtroGeneral.setSql(filtro); + dto.addFiltro(filtroGeneral); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setcatalog() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setcatalog(TgeneCatalogDetail tgeneCatalogDetail) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneCatalogDetail); + } + + public String getTituloLOV() { + return tituloLOV; + } + + public void setTituloLOV(String tituloLOV) { + this.tituloLOV = tituloLOV; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/catalogFilterLov.xhtml", options, params); + } + + public static List findTramiteSancion() { + try { + CatalogFilterLovController cc = new CatalogFilterLovController(); + cc.init(); + cc.recperpage = 300; + cc.filtro = "t.pk.catalog in ('1','6')"; + cc.addFilter("pk.catalogcode", "TIPOAUTORIZACION"); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/CentroControlArmasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/CentroControlArmasController.java new file mode 100644 index 0000000..f2ff530 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/CentroControlArmasController.java @@ -0,0 +1,673 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CentroControlArmasController extends AbstractController { + + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List linstitucion; + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List lnombreInstitucion; + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lprovinces; + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcantones; + + /** + * Atributo para la lista de objetos TgeneParroquia + */ + private List lparroquias; + /** + * Atributo para la lista de objetos TgeneCatalogDetail (catalogo de grados + * asignados a los militares) + */ + private List lgrados; + /** + * Variable para activar o desactivar los campos segun la opcion + * seleccionada + */ + private String editarReg; + /** + * Variable de tipo TcustPersonDetail para setear cuando seleccione del lov + */ + private TcustPersonDetail personaDetailSelecionada; + + public CentroControlArmasController() throws Exception { + super(TarmCentroControl.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CENTCONTARMAS"; + //CARGA DE CATALOGOS + linstitucion = CatalogDetailController.find("INSTITUCION"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + SubQuery stipoInstitucion = new SubQuery("TgeneCatalogDetail", "description", "desinstitucion", "i.pk.catalog = t.institucion and i.pk.catalogcode=t.instituciontipo"); + SubQuery stipoInstitucionLegalcode = new SubQuery("TgeneCatalogDetail", "legalcode", "legalcode", "i.pk.catalog = t.institucion and i.pk.catalogcode=t.instituciontipo"); + SubQuery snombreinstitucion = new SubQuery("TgeneCatalogDetail", "description", "desnombreinstitucion", "i.pk.catalog = t.nombreinstitucion and i.pk.catalogcode=t.nombreinstitucioncodigo"); + SubQuery sprovincia = new SubQuery("TgeneProvince", "description", "desprovincia", "i.pk.countrycode = t.countrycode and i.pk.provincecode= t.provincecode"); + SubQuery scanton = new SubQuery("TgeneCanton", "description", "descanton", "i.pk.countrycode = t.countrycode and i.pk.provincecode=t.provincecode and i.pk.cantoncode=t.cantoncode"); + SubQuery sparroquia = new SubQuery("TgeneParroquia", "description", "desparroquia", "i.pk.countrycode = t.countrycode and i.pk.provincecode=t.provincecode and i.pk.cantoncode=t.cantoncode and i.pk.parroquiacode=t.parroquiacode"); + SubQuery spersona = new SubQuery("TcustPersonDetail", "name", "nombre", "i.pk.personcode=t.personcode and i.pk.dateto=to_date('2999-12-31', 'YYYY-MM-DD')"); + SubQuery sgrado = new SubQuery("TgeneCatalogDetail", "description", "desgrado", "i.pk.catalog = t.grado and i.pk.catalogcode=t.gradocodigo"); + dto.addSubQuery(stipoInstitucion); + dto.addSubQuery(stipoInstitucionLegalcode); + dto.addSubQuery(snombreinstitucion); + dto.addSubQuery(sprovincia); + dto.addSubQuery(scanton); + dto.addSubQuery(sparroquia); + dto.addSubQuery(spersona); + dto.addSubQuery(sgrado); + dto.setOrderby("t.institucion"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (this.lrecord != null && !this.lrecord.isEmpty()) { + this.record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para el evento change del combo institucion + */ + public void executeInstitucion() { + if ((getMfilters().get("institucion") != null) && (getMfilters().get("institucion").compareTo("") != 0)) { + lnombreInstitucion = CatalogDetailController.find("NOMBREINSTITUCION", getMfilters().get("institucion")); + } + } + + /** + * Metodo q se ejecuta cuando pulsamos el boton crear + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("institucion") == null || super.getMfilters().get("institucion").equals("%")) { + MessageHelper.setMessageError("INSTITUCI\u00D3N REQUERIDA"); + return; + } + editarReg = null; + super.create(); + //se carga el nombre de la institucion seleccionada + catalogos(linstitucion, getMfilters().get("institucion"), "desinstitucion"); + record.setInstituciontipo("INSTITUCION"); + record.setInstitucion(super.getMfilters().get("institucion")); + record.setNombreinstitucioncodigo("NOMBREINSTITUCION"); + record.setGradocodigo("MILITARYGRADE"); + //se consulta las provincias del ecuador + record.setCountrycode("EC"); + if (lprovinces == null || lprovinces.size() == 0) { + lprovinces = ProvinceController.find(record.getCountrycode()); + } + //consulta los grados + if (lgrados == null || lgrados.size() == 0) { + lgrados = CatalogDetailController.find("MILITARYGRADE"); + } + personaDetailSelecionada = new TcustPersonDetail(); + } + + @Override + public void update() throws Exception { + catalogos(lnombreInstitucion, record.getNombreinstitucion(), "desnombreinstitucion");//lista, campo a validar, pk del mdafile + catalogos(linstitucion, record.getInstitucion(), "desinstitucion"); + catalogos(lgrados, record.getGrado(), "desgrado"); + nombreProvincia(); + nombreCanton(); + nombreParroquia(); + super.update(); + } + + /** + * Método para cargar datos en el editar + */ + public void loadEdit() { + personaDetailSelecionada = new TcustPersonDetail(); + personaDetailSelecionada.setName(record.getModifiedData().get("nombre").toString()); + //consulta los nombres de las intituciones + lnombreInstitucion = CatalogDetailController.find("NOMBREINSTITUCION", record.getInstitucion()); + if (lprovinces == null || lprovinces.size() == 0) { + lprovinces = ProvinceController.find(record.getCountrycode()); + } + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + //consulta los grados + if (lgrados == null || lgrados.size() == 0) { + lgrados = CatalogDetailController.find("MILITARYGRADE"); + } + editarReg = "SI"; + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + lparroquias = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + } + } + + /** + * Metodos para recorreer los combos y setear las descripciones de lo q se + * escoge + */ + public void catalogos(List list, String codigo, String pk) { + for (TgeneCatalogDetail item : list) { + if (codigo.equals(item.getPk().getCatalog())) { + record.modifiedData.put(pk, item.getDescription()); + break; + } + } + } + + /** + * Metodo para obtener la descripcion de la provincia + */ + public void nombreProvincia() { + for (TgeneProvince provincia : lprovinces) { + if (provincia.getPk().getProvincecode().equals(record.getProvincecode())) { + record.getModifiedData().put("desprovincia", provincia.getDescription()); + + } + } + } + + /** + * Metodo para obtener la descripcion del canton + */ + public void nombreCanton() { + for (TgeneCanton canton : lcantones) { + if (canton.getPk().getProvincecode().equals(record.getProvincecode()) && canton.getPk().getCantoncode().equals(record.getCantoncode())) { + record.getModifiedData().put("descanton", canton.getDescription()); + + } + } + } + + /** + * Metodo para obtener la descripcion de la provincia + */ + public void nombreParroquia() { + for (TgeneParroquia parroquia : lparroquias) { + if (parroquia.getPk().getProvincecode().equals(record.getProvincecode()) && parroquia.getPk().getCantoncode().equals(record.getCantoncode()) + && parroquia.getPk().getParroquiacode().equals(record.getParroquiacode())) { + record.getModifiedData().put("desparroquia", parroquia.getDescription()); + + } + } + } + + /** + * Método para abrir el lov de personas + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + openLov(params); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), true); + // lovpersona es el nombre de la pagina + RequestContext.getCurrentInstance().openDialog("/pages/customer/lov/personLov.xhtml", options, params); + } + + /** + * Maneja la respuesta del Lov de Personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + personaDetailSelecionada = (TcustPersonDetail) event.getObject(); + this.record.put("dateto", personaDetailSelecionada.getPk().getDateto()); + this.record.put("personcode", personaDetailSelecionada.getPk().getPersoncode()); + this.record.put("nombre", personaDetailSelecionada.getName()); + //seteo de los codigos de persona + record.setPersoncode(personaDetailSelecionada.getPk().getPersoncode()); + record.setDateto(personaDetailSelecionada.getPk().getDateto()); + } + + /** + * Metodo para buscar todos los centros de control + * + * @param ccentrocontrol + * @return + */ + public static List findAll() { + try { + CentroControlArmasController cc = new CentroControlArmasController(); + cc.init(); + cc.recperpage = 10000; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para buscar por codigo de centro de control + * + * @param ccentrocontrol + * @return + */ + public static List find(String ccentrocontrol) { + try { + CentroControlArmasController cc = new CentroControlArmasController(); + cc.init(); + cc.recperpage = 15; + cc.addFilter("pk", ccentrocontrol); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para validar el campo de jefe de centro + * + * @param tc + */ + public void validarJefe(TarmCentroControl tc) { + System.out.println("nombre...selec..." + tc.getPersoncode()); + if (tc.getPersoncode() != null && tc.getPersoncode() > 0) { + record.getModifiedData().put("nombre", personaDetailSelecionada.getName()); + return; + } + record.getModifiedData().put("nombre", null); + + } + + /** + * Metodo que devuelve un centro de control de armas por su codigo + * + * @param codigoSolicitud + * @return + */ + public static TarmCentroControl findPorCodigo(String codigo) { + try { + CentroControlArmasController cc = new CentroControlArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", codigo); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que devuelve un centro de control de armas por su codigo de + * Catalogo + * + * @param codigoSolicitud + * @return + */ + public static TarmCentroControl findPorCentroControl(String codigo) { + try { + CentroControlArmasController cc = new CentroControlArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("nombreinstitucion", codigo); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * + * @param catalogcode Có de catálogo + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static TarmCentroControl findxpersoncode(String personcode) { + try { + CentroControlArmasController cc = new CentroControlArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("personcode", personcode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para buscar los centros de control asociados a un organismo o + * unidad + * + * @param codigoSolicitud + * @return + */ + public static List findxOrganismoUnidad(String organismo, String unidad) { + try { + CentroControlArmasController cc = new CentroControlArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("institucion", organismo); + cc.addFilter("nombreinstitucion", unidad); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para buscar el centros de control asociado a un organismo y unidad + * + * @param codigoSolicitud + * @return + */ + public static TarmCentroControl findxCcontrolUnidad(String ccontrol, String unidad) { + try { + CentroControlArmasController cc = new CentroControlArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("institucion", ccontrol); + cc.addFilter("nombreinstitucion", unidad); + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para buscar los centros de control asociados a un organismo o + * unidad + * + * @param codigoSolicitud + * @return + */ + public static List findxInstitucion(String organismo) { + try { + CentroControlArmasController cc = new CentroControlArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("institucion", organismo); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para buscar por codigo de centro de control + * + * @param ccentrocontrol + * @return + */ + public static List findEstadoInst(String estado, String institucion) { + try { + CentroControlArmasController cc = new CentroControlArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("estado", estado); + cc.addFilter("institucion", institucion); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmCentroControl departamento = new TarmCentroControl(); + for (TarmCentroControl centro : cc.lrecord) { + if ("DPCA".equals(centro.getNombreinstitucion())) { + departamento = centro; + } + } + cc.lrecord.remove(departamento); + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para buscar por codigo de centro de control + * + * @param ccentrocontrol + * @return + */ + public static List findEstado(String estado) { + try { + CentroControlArmasController cc = new CentroControlArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("estado", estado); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmCentroControl departamento = new TarmCentroControl(); + for (TarmCentroControl centro : cc.lrecord) { + if ("DPCA".equals(centro.getNombreinstitucion())) { + departamento = centro; + } + } + cc.lrecord.remove(departamento); + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public List getLinstitucion() { + return linstitucion; + } + + public void setLinstitucion(List linstitucion) { + this.linstitucion = linstitucion; + } + + public List getLnombreInstitucion() { + return lnombreInstitucion; + } + + public void setLnombreInstitucion(List lnombreInstitucion) { + this.lnombreInstitucion = lnombreInstitucion; + } + + public List getLprovinces() { + return lprovinces; + } + + public void setLprovinces(List lprovinces) { + this.lprovinces = lprovinces; + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public List getLparroquias() { + return lparroquias; + } + + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + public List getLgrados() { + return lgrados; + } + + public void setLgrados(List lgrados) { + this.lgrados = lgrados; + } + + public String getEditarReg() { + return editarReg; + } + + public void setEditarReg(String editarReg) { + this.editarReg = editarReg; + } + + /** + * Metodo para actualizar un bean en el record desde otros controladores + */ + public void update(TarmCentroControl bean) throws Exception { + record = bean; + super.update(); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ClaseLovController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ClaseLovController.java new file mode 100644 index 0000000..3e476d4 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ClaseLovController.java @@ -0,0 +1,158 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author Christian Pazmino + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ClaseLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + /** + * Titulo que se le asignara al dialogo desplegado + */ + private String tituloLOV; + + public ClaseLovController() throws Exception { + super(TgeneCatalogDetail.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + tituloLOV = CallerHelper.getLovParameter("tituloLOV"); + if (tituloLOV != null) { + MsgControlArmas.getProperty("lvh_clase"); + } + String catalogcode = CallerHelper.getLovParameter("catalogcode"); + if (catalogcode != null) { + super.addFilter("pk.catalogcode", catalogcode); + } + // Valor usado para filtro del campo legalcode de la tabla TGENECATALOGDETAIL + String legalcode = CallerHelper.getLovParameter("legalcode"); + // Valor opcional usado para filtro del campo legalcode de la tabla TGENECATALOGDETAIL + String legalcode2 = CallerHelper.getLovParameter("legalcode2"); + if (legalcode != null) { + if (legalcode2 != null) { + super.addFilter(legalcode2 + " or t.legalcode", legalcode); + } else { + super.addFilter("legalcode", legalcode); + } + } + if (tituloLOV == null && catalogcode == null && legalcode == null) { + super.addFilter("pk.catalogcode", "CLASE"); + tituloLOV = MsgControlArmas.getProperty("lvh_clase"); + } + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CLASELOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + //this.getMfilters().put("pk.catalogcode", "CLASE"); + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog(TgeneCatalogDetail tgeneCatalogDetail) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneCatalogDetail); + } + + public String getTituloLOV() { + return tituloLOV; + } + + public void setTituloLOV(String tituloLOV) { + this.tituloLOV = tituloLOV; + } + + /** + * Metodo usado para abrir el dialogo definiendo el tamano que tendra el + * mismo + * + * @param params + */ + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/claseLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ComercianteCupoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ComercianteCupoController.java new file mode 100644 index 0000000..9d1b472 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ComercianteCupoController.java @@ -0,0 +1,460 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.lov.UnidadTipoLovController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmComercianteCupo; +import com.fp.persistence.parmas.param.TarmUnidadTipo; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TarmUnidTipo. + * + * @author C.P. + * @version 2 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ComercianteCupoController extends AbstractController { + + private List ltiposRegistro; + + private String descripcionClase; + private String descripcionTipoArma; + + private String nombreComerciante; + private String numeroDocumento; + + //variables para el popup + private String nombreComercianteDialog; + private String numeroDocumentoDialog; + private String descripcionClaseDialog; + private String descripcionTipoArmaDialog; + private String descripcionUnidadMedida; + private BigDecimal cupoAsignado; + private Boolean regEditar; + + public ComercianteCupoController() throws Exception { + super(TarmComercianteCupo.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "COMCUOP"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); +// dto.setOrderby("t.description"); nombre identification desclasearma destipoarma desunidad destiporegistro + + SubQuery snombre = new SubQuery("TcustPersonDetail", "name", "nombre", "i.pk.personcode = t.personcodigo and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcodigo)"); + SubQuery snumerodocumento = new SubQuery("TcustPersonDetail", "identification", "identification", "i.pk.personcode = t.personcodigo and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcodigo)"); + SubQuery sclasearma = new SubQuery("TgeneCatalogDetail", "description", "desclasearma", "i.pk.catalog = t.clase and i.pk.catalogcode=t.clasecodigo"); + SubQuery stipoarma = new SubQuery("TgeneCatalogDetail", "description", "destipoarma", "i.pk.catalog = t.tipoarmaexplosivo and i.pk.catalogcode=t.tipoarmaexplosivocodigo"); + SubQuery sunidad = new SubQuery("TgeneCatalogDetail", "description", "desunidad", "i.pk.catalog = t.unidadmedidapeso and i.pk.catalogcode=t.unidadmedidapesocodigo"); + SubQuery stiporegistro = new SubQuery("TgeneCatalogDetail", "description", "destiporegistro", "i.pk.catalog = t.tiporegistro and i.pk.catalogcode=t.tiporegistrocodigo"); + dto.addSubQuery(snombre); + dto.addSubQuery(snumerodocumento); + dto.addSubQuery(stipoarma); + dto.addSubQuery(sclasearma); + dto.addSubQuery(sunidad); + dto.addSubQuery(stiporegistro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp + .get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia del registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + cupoAsignado = new BigDecimal(0); + regEditar = Boolean.FALSE; + nombreComercianteDialog = null; + numeroDocumentoDialog = null; + descripcionClaseDialog = null; + descripcionTipoArmaDialog = null; + descripcionUnidadMedida = null; + super.create(); + this.record.setFecharegistro(new Timestamp(new Date().getTime())); + if (ltiposRegistro == null || ltiposRegistro.size() == 0) { + ltiposRegistro = CatalogDetailController.find("TIPOREGISTRO"); + } + } + + @Override + public void update() throws Exception { + if (record.getPersoncodigo() != null) { + if (record.getClase() != null && record.getClase().trim().length() > 0) { + this.record.setTiporegistrocodigo("TIPOREGISTRO"); + if (record.getCupounidad().compareTo(new BigDecimal(0)) > 0 && record.getCupounidad().compareTo(cupoAsignado) >= 0) { + if (!regEditar) { + catalogos(ltiposRegistro, record.getTiporegistro(), "destiporegistro"); + } + super.update(); + } else if (!regEditar) { + MessageHelper.setMessageError("EL CUPO DEDE SER MAYOR A CERO"); + } else { + MessageHelper.setMessageError("EL CUPO DEDE SER MAYOR AL ASIGNADO INICIALMENTE"); + } + } else { + MessageHelper.setMessageError("SELECCIONE LA CLASE"); + } + } else { + MessageHelper.setMessageError("SELECCIONE EL No. DE DOCUMENTO"); + } + + } + + public void updateSimple(TarmComercianteCupo bean) throws Exception { + record = bean; + super.update(); + } + + /** + * Metodo para cargar las variables para editar + */ + public void loadEdit() { + regEditar = Boolean.TRUE; + cupoAsignado = record.getCupounidad(); + nombreComercianteDialog = record.getModifiedData().get("nombre").toString(); + numeroDocumentoDialog = record.getModifiedData().get("identification").toString(); + descripcionClaseDialog = record.getModifiedData().get("desclasearma").toString(); + descripcionTipoArmaDialog = record.getModifiedData().get("destipoarma").toString(); + descripcionUnidadMedida = record.getModifiedData().get("desunidad").toString(); + // destiporegistro + } + + /** + * Metodo para recorreer los combos y setear las descripciones de lo q se + * escoge para la vista + * + * @param list + * @param codigo + * @param pk + */ + public void catalogos(List list, String codigo, String pk) { + for (TgeneCatalogDetail item : list) { + if (codigo.equals(item.getPk().getCatalog())) { + record.modifiedData.put(pk, item.getDescription()); + break; + } + } + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * + * @param catalogcode Có de catálogo + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static List find(String code) { + try { + ComercianteCupoController cc = new ComercianteCupoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", code); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Devuelve la lista de cupos de una persona + * + * @param catalogcode + */ + public static List findByPersonCode(String personCode, String classCode, String tipoArmaExplosivoCodigo, String unidad) { + try { + ComercianteCupoController cc = new ComercianteCupoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("personcodigo", personCode); + cc.addFilter("clase", classCode); + cc.addFilter("tipoarmaexplosivo", tipoArmaExplosivoCodigo); + cc.addFilter("unidadmedidapeso", unidad); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + //lov de persona + /** + * Método para abrir el lov de personas + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Maneja la respuesta del Lov de Personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail personaDetailSelecionada = (TcustPersonDetail) event.getObject(); + nombreComerciante = personaDetailSelecionada.getName(); + numeroDocumento = personaDetailSelecionada.getIdentification(); + super.getMfilters().put("personcodigo", personaDetailSelecionada.getPk().getPersoncode().toString()); + } + + /** + * Maneja la respuesta del Lov de Personas que se ejecuta desde el dialog de + * comerciante cupo + * + * @param event + * @throws Exception + */ + public void onReturnPersonLovDialog(SelectEvent event) throws Exception { + TcustPersonDetail personaDetailSelecionada = (TcustPersonDetail) event.getObject(); + nombreComercianteDialog = personaDetailSelecionada.getName(); + numeroDocumentoDialog = personaDetailSelecionada.getIdentification(); + record.setPersoncodigo(personaDetailSelecionada.getPk().getPersoncode()); + record.getModifiedData().put("nombre", personaDetailSelecionada.getName()); + record.getModifiedData().put("identification", personaDetailSelecionada.getIdentification()); + + } + + //lov de UnidadTipo + /** + * Método para abrir el lov de UnidadTipo + */ + public void openUnidadTipoLov() { + Map> params = new HashMap<>(); + UnidadTipoLovController.openLov(params); + } + + /** + * Return del LOV de UnidadTipo + * + * @param event + * @throws Exception + */ + public void onReturnUnidadTipoLov(SelectEvent event) throws Exception { + TarmUnidadTipo t = (TarmUnidadTipo) event.getObject(); + super.getMfilters().put("clase", t.getPk().getClase()); + super.getMfilters().put("clasecodigo", t.getPk().getClasecode()); + super.getMfilters().put("tipoarmaexplosivo", t.getPk().getTipoarmaexplosivo()); + super.getMfilters().put("tipoarmaexplosivocodigo", t.getPk().getTipoarmaexplosivocodigo()); + descripcionClase = t.getModifiedData().get("desclasearma").toString(); + descripcionTipoArma = t.getModifiedData().get("destipoarma").toString(); + } + + /** + * Return del LOV de UnidadTipo ejecutado desde el Dialog + * + * @param event + * @throws Exception + */ + public void onReturnUnidadTipoLovDialog(SelectEvent event) throws Exception { + TarmUnidadTipo t = (TarmUnidadTipo) event.getObject(); + record.setClase(t.getPk().getClase()); + record.setClasecodigo(t.getPk().getClasecode()); + record.setTipoarmaexplosivo(t.getPk().getTipoarmaexplosivo()); + record.setTipoarmaexplosivocodigo(t.getPk().getTipoarmaexplosivocodigo()); + record.setUnidadmedidapeso(t.getPk().getUnidadmedidapeso()); + record.setUnidadmedidapesocodigo(t.getPk().getUnidadmedidapesocodigo()); + descripcionClaseDialog = t.getModifiedData().get("desclasearma").toString(); + descripcionTipoArmaDialog = t.getModifiedData().get("destipoarma").toString(); + descripcionUnidadMedida = t.getModifiedData().get("desunidad").toString(); + record.getModifiedData().put("desclasearma", t.getModifiedData().get("desclasearma").toString()); + record.getModifiedData().put("destipoarma", t.getModifiedData().get("destipoarma").toString()); + record.getModifiedData().put("desunidad", t.getModifiedData().get("desunidad").toString()); + } + + public String getDescripcionClase() { + return descripcionClase; + } + + public void setDescripcionClase(String descripcionClase) { + this.descripcionClase = descripcionClase; + } + + public String getDescripcionTipoArma() { + return descripcionTipoArma; + } + + public void setDescripcionTipoArma(String descripcionTipoArma) { + this.descripcionTipoArma = descripcionTipoArma; + } + + public String getNombreComerciante() { + return nombreComerciante; + } + + public void setNombreComerciante(String nombreComerciante) { + this.nombreComerciante = nombreComerciante; + } + + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public String getNombreComercianteDialog() { + return nombreComercianteDialog; + } + + public void setNombreComercianteDialog(String nombreComercianteDialog) { + this.nombreComercianteDialog = nombreComercianteDialog; + } + + public String getNumeroDocumentoDialog() { + return numeroDocumentoDialog; + } + + public void setNumeroDocumentoDialog(String numeroDocumentoDialog) { + this.numeroDocumentoDialog = numeroDocumentoDialog; + } + + public String getDescripcionClaseDialog() { + return descripcionClaseDialog; + } + + public void setDescripcionClaseDialog(String descripcionClaseDialog) { + this.descripcionClaseDialog = descripcionClaseDialog; + } + + public String getDescripcionTipoArmaDialog() { + return descripcionTipoArmaDialog; + } + + public void setDescripcionTipoArmaDialog(String descripcionTipoArmaDialog) { + this.descripcionTipoArmaDialog = descripcionTipoArmaDialog; + } + + public String getDescripcionUnidadMedida() { + return descripcionUnidadMedida; + } + + public void setDescripcionUnidadMedida(String descripcionUnidadMedida) { + this.descripcionUnidadMedida = descripcionUnidadMedida; + } + + public List getLtiposRegistro() { + return ltiposRegistro; + } + + public void setLtiposRegistro(List ltiposRegistro) { + this.ltiposRegistro = ltiposRegistro; + } + + public Boolean getRegEditar() { + return regEditar; + } + + public void setRegEditar(Boolean regEditar) { + this.regEditar = regEditar; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/DatosParaSancionesController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/DatosParaSancionesController.java new file mode 100644 index 0000000..2195fd9 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/DatosParaSancionesController.java @@ -0,0 +1,545 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmTipoSancion; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TarmTipoSancion. + * + * @author Christian Pazmino + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class DatosParaSancionesController extends AbstractController { + + /** + * Lista de tipos de tramites a ser seleccionados por el usuario + * (Autorizacion, Permiso) + */ + private List tramiteList; + /** + * Lista de tipos de faltas a ser seleccionadados por el usuario (Leve, + * Grave, etc) + */ + private List tipoDeFaltaList; + /** + * Lista de tipos de sanciones a ser seleccionados por el usuario + * (Suspencion, Decomiso, etc) + */ + private List sancionList; + /** + * Lista de periodos en dias que durara la sancion (180 dias, 270 dias, etc) + */ + private List tiempoList; + /** + * Codigo de la clase seleccionada por el usuario + */ + private String claseFiltroStr; + /** + * Variable que indica si el usuario esta negado para continuar en la + * pantalla + */ + private Boolean esEdicionBln; + /** + * Constante usada para referirse al catalogo de tipo de falta + */ + private final String TIPOFALTACODIGO = "TIPODEFALTA"; + /** + * Constante usada para referirse al catalogo de vigencia en dias + */ + private final String TIEMPOCODIGO = "VIGENCIADIAS"; + /** + * Constante usada para referirse al catalogo de sanciones + */ + private final String SANCIONCODIGO = "SANCION"; + /** + * Constante usada para referirse al catalogo de tipo autorizacion + */ + private final String TRAMITECODIGO = "TIPOAUTORIZACION"; + + public DatosParaSancionesController() throws Exception { + super(TarmTipoSancion.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + record = new TarmTipoSancion(); + tipoDeFaltaList = CatalogDetailController.find("TIPODEFALTA"); + tramiteList = CatalogFilterLovController.findTramiteSancion(); + tiempoList = CatalogDetailController.find("VIGENCIADIAS"); + sancionList = CatalogDetailController.find("SANCION"); + esEdicionBln = Boolean.FALSE; + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "DATOSPARASANCION"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo utilizado al escoger tipo de falta + */ + public void changeTipoFalta() { + for (TgeneCatalogDetail r : tipoDeFaltaList) { + if (r.getPk().getCatalog().compareTo(record.getTipofalta()) == 0) { + record.put("ntipoFalta", r.getDescription()); + break; + } + } + record.setTipofaltacodigo(TIPOFALTACODIGO); + } + + /** + * Metodo utilizado al escoger tramite + */ + public void changeTramite() { + for (TgeneCatalogDetail r : tramiteList) { + if (r.getPk().getCatalog().compareTo(record.getTramite()) == 0) { + record.put("ntramite", r.getDescription()); + break; + } + } + record.setTramitecodigo(TRAMITECODIGO); + } + + /** + * Metodo utilizado al escoger sancion + */ + public void changeSancion() { + for (TgeneCatalogDetail r : sancionList) { + if (r.getPk().getCatalog().compareTo(record.getSancion()) == 0) { + record.put("nsancion", r.getDescription()); + break; + } + } + record.setSancioncodigo(SANCIONCODIGO); + } + + /** + * Metodo utilizado al escoger tiempo + */ + public void changeTiempo() { + for (TgeneCatalogDetail r : tiempoList) { + if (r.getPk().getCatalog().compareTo(record.getTiempo()) == 0) { + record.put("ntiempo", r.getDescription()); + break; + } + } + record.setTiempocodigo(TIEMPOCODIGO); + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); +// if(!esEdicionBln){ +// record.setNumeropregunta(null); +// }else{ +// record.setNumeropregunta(record.getNumeropregunta()); +// } + esEdicionBln = Boolean.FALSE; + super.addField("claseDescriptionD", null); + super.addField("faltaDescriptionD", null); + } + + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + // Subquery + SubQuery subqueryClase = new SubQuery("TgeneCatalogDetail", "description", "nclase", "i.pk.catalog = t.clase and i.pk.catalogcode = t.clasecodigo"); + dto.addSubQuery(subqueryClase); + + SubQuery subqueryFalta = new SubQuery("TgeneCatalogDetail", "description", "nfalta", "i.pk.catalog = t.falta and i.pk.catalogcode = t.faltacodigo"); + dto.addSubQuery(subqueryFalta); + + SubQuery subqueryTipoFalta = new SubQuery("TgeneCatalogDetail", "description", "ntipoFalta", "i.pk.catalog = t.tipofalta and i.pk.catalogcode = t.tipofaltacodigo"); + dto.addSubQuery(subqueryTipoFalta); + + SubQuery subqueryTramite = new SubQuery("TgeneCatalogDetail", "description", "ntramite", "i.pk.catalog = t.tramite and i.pk.catalogcode = t.tramitecodigo"); + dto.addSubQuery(subqueryTramite); + + SubQuery subquerySancion = new SubQuery("TgeneCatalogDetail", "description", "nsancion", "i.pk.catalog = t.sancion and i.pk.catalogcode = t.sancioncodigo"); + dto.addSubQuery(subquerySancion); + + SubQuery subqueryTiempo = new SubQuery("TgeneCatalogDetail", "description", "ntiempo", "i.pk.catalog = t.tiempo and i.pk.catalogcode = t.tiempocodigo"); + dto.addSubQuery(subqueryTiempo); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Metodo usado para abrir el dialogo de falta en de la pantalla + * crear/editar + */ + public void openFaltaDialogLov() { + try { + if (this.record.getClase() != null) { + Map> params = new HashMap<>(); + //Codigo de catalogcode + List lcatalogcode = new ArrayList<>(); + lcatalogcode.add("FALTA"); + params.put("catalogcode", lcatalogcode); + //tITULO DEL LOV + List ltituloLOV = new ArrayList<>(); + ltituloLOV.add("lov_falta"); + params.put("tituloLOV", ltituloLOV); + //Filtro + List lfiltro = new ArrayList<>(); + + if (this.record.getClase().equals("0010000001") || this.record.getClase().equals("0010000002")) { + //Filtro para armas de fuego y municiones + lfiltro.add("t.legalcode = 'ARMASYMUNICIONES'"); + }// + else if (this.record.getClase().equals("0010000003") || this.record.getClase().equals("0010000007")) { + //Filtro para explosivos y pirotecnicos + lfiltro.add("t.legalcode = 'EXPLOSIVOSYPIROTECNICOS'"); + } else if (this.record.getClase().equals("0010000004")) { + //Filtro para accesorios + lfiltro.add("t.legalcode = 'ACCESORIOS'"); + } else if (this.record.getClase().equals("0010000006")) { + //Filtro para accesorios + lfiltro.add("t.legalcode = 'ACCESORIOS'"); + } + params.put("filtro", lfiltro); + CatalogFilterLovController.openLov(params); + //ClaseLovController.openLov(params); + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionClase")); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo de consulta de datos para sanciones segun la clase pasada como + * parametro + */ + public static List find(String clase) { + try { + DatosParaSancionesController cc = new DatosParaSancionesController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("clase", clase); + + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo de consulta de dato para sancion segun la clave primaria pasada + * como parametro + */ + public static TarmTipoSancion findxPk(String pk) { + try { + DatosParaSancionesController cc = new DatosParaSancionesController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", pk); + + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo usado para abrir el dialogo de seleccionar falta en de la pantalla + * principal + */ + public void openFaltaLov() { + try { + if (claseFiltroStr != null) { + Map> params = new HashMap<>(); + //Codigo de catalogcode + List lcatalogcode = new ArrayList<>(); + lcatalogcode.add("FALTA"); + params.put("catalogcode", lcatalogcode); + //tITULO DEL LOV + List ltituloLOV = new ArrayList<>(); + ltituloLOV.add("lov_falta"); + params.put("tituloLOV", ltituloLOV); + //Filtro + List lfiltro = new ArrayList<>(); + + if (claseFiltroStr.equals("0010000001") || claseFiltroStr.equals("0010000002")) { + //Filtro para armas de fuego y municiones + lfiltro.add("t.legalcode = 'ARMASYMUNICIONES'"); + }// + else if (claseFiltroStr.equals("0010000003") || claseFiltroStr.equals("0010000007")) { + //Filtro para explosivos y pirotecnicos + lfiltro.add("t.legalcode = 'EXPLOSIVOSYPIROTECNICOS'"); + } else if (claseFiltroStr.equals("0010000004")) { + //Filtro para accesorios + lfiltro.add("t.legalcode = 'ACCESORIOS'"); + } else if (claseFiltroStr.equals("0010000006")) { + //Filtro para accesorios + lfiltro.add("t.legalcode = 'ACCESORIOS'"); + } + params.put("filtro", lfiltro); + CatalogFilterLovController.openLov(params); + //ClaseLovController.openLov(params); + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionClase")); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar + * falta de la pantalla principal + */ + public void onReturnFaltaLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.addFilter("falta", t.getPk().getCatalog()); + super.addFilter("faltacodigo", t.getPk().getCatalogcode()); + super.addField("faltaDescription", t.getDescription()); + this.query(); + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar + * falta de la pantalla crear/editar + */ + public void onReturnFaltaDialogLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.addField("faltaDescriptionD", t.getDescription()); + this.record.setFalta(t.getPk().getCatalog()); + this.record.setFaltacodigo(t.getPk().getCatalogcode()); + record.put("nfalta", t.getDescription()); + } + + /** + * Metodo usado para abrir el dialogo de seleccionar clase en de la pantalla + * principal + */ + public void openClaseLov() { + try { + Map> params = new HashMap<>(); + //Codigo de catalogcode + List lcatalogcode = new ArrayList<>(); + lcatalogcode.add("CLASE"); + params.put("catalogcode", lcatalogcode); + //tITULO DEL LOV + List ltituloLOV = new ArrayList<>(); + ltituloLOV.add("lvh_clase"); + params.put("tituloLOV", ltituloLOV); + //Filtro +// List lfiltro = new ArrayList<>(); +// lfiltro.add("t.pk.catalog in ('0010000001','0010000002','0010000003','0010000007','0010000004','0010000006')"); +// params.put("filtro", lfiltro); + CatalogFilterLovController.openLov(params); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar + * clase de la pantalla principal + */ + public void onReturnClaseLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + claseFiltroStr = t.getPk().getCatalog(); + super.addFilter("clase", t.getPk().getCatalog()); + super.addFilter("clasecodigo", t.getPk().getCatalogcode()); + super.addField("claseDescription", t.getDescription()); + this.query(); + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar + * clase de la pantalla crear/editar + */ + public void onReturnClaseDialogLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.addField("claseDescriptionD", t.getDescription()); + super.addField("faltaDescriptionD", null); + record.setFalta(null); + this.record.setClase(t.getPk().getCatalog()); + this.record.setClasecodigo(t.getPk().getCatalogcode()); + record.put("nclase", t.getDescription()); + } + + @Override + public void update() throws Exception { + if (record.getClase() != null) { + if (record.getFalta() != null) { + super.update(); + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_faltaRequerido")); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_claseRequerido")); + } + } + + /** + * Metodo que actualiza las descripciones seleccionadas en el dialogo + * crear/editar a la variable record y marca una bandera ser edicion + */ + public void actualizar() { + esEdicionBln = Boolean.TRUE; + super.addField("claseDescriptionD", record.get("nclase")); + super.addField("faltaDescriptionD", record.get("nfalta")); + } + + public List getTramiteList() { + return tramiteList; + } + + public void setTramiteList(List tramiteList) { + this.tramiteList = tramiteList; + } + + public List getTipoDeFaltaList() { + return tipoDeFaltaList; + } + + public void setTipoDeFaltaList(List tipoDeFaltaList) { + this.tipoDeFaltaList = tipoDeFaltaList; + } + + public List getSancionList() { + return sancionList; + } + + public void setSancionList(List sancionList) { + this.sancionList = sancionList; + } + + public List getTiempoList() { + return tiempoList; + } + + public void setTiempoList(List tiempoList) { + this.tiempoList = tiempoList; + } + + public Boolean getEsEdicionBln() { + return esEdicionBln; + } + + public void setEsEdicionBln(Boolean esEdicionBln) { + this.esEdicionBln = esEdicionBln; + } + + public String getClaseFiltroStr() { + return claseFiltroStr; + } + + public void setClaseFiltroStr(String claseFiltroStr) { + this.claseFiltroStr = claseFiltroStr; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/FirmarDocumentoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/FirmarDocumentoController.java new file mode 100644 index 0000000..ff4e5be --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/FirmarDocumentoController.java @@ -0,0 +1,658 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.io.IOException; +import java.io.InputStream; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.solicitud.DecomisoArmaTransaccionController; +import com.fp.frontend.controller.armas.solicitud.DocumentoHabilitanteController; +import com.fp.frontend.controller.armas.solicitud.PlanificacionInspeccionController; +import com.fp.frontend.controller.armas.solicitud.SolicitudArmasController; +import com.fp.frontend.controller.armas.solicitud.TarmSolicitudTramiteController; +import com.fp.frontend.controller.armas.solicitud.TarmTramiteController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.controller.pgeneral.message.MessageTemplatesController; +import com.fp.frontend.controller.pgeneral.message.MessageTemplatesDescController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.frontend.validators.DocFirmaValidator; +import com.fp.mail.Mail; +import com.fp.persistence.parmas.ins.TarmPlanificacionInspeccion; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplates; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDesc; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora para firmar documentos. + * + * @author Carlos Guzman. + * @modificacion David Cruz + * @modificacion Christian Pazmino + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class FirmarDocumentoController extends AbstractController { + + private String xpathflujo; + private String xpath; + private String numerotransaccion; + private String numerosolicitud; + private String cplanificacion; + private String creporte; + private String appletCoordenadallx = ""; + private String appletCoordenadally = ""; + private String appletCoordenadaurx = ""; + private String appletCoordenadaury = ""; + private String appletLugar = ""; + private String appletFirma = ""; + private UploadedFile uploadedFile; + private TsafeUserDetail userDetail; + private boolean mensajeGuardar = false; + private boolean mensajeNoFirma = false; + private String btnFlujo; + private TarmSolicitud solicitud; + TarmPlanificacionInspeccion planificacionInspeccion = null; + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddress; + @ManagedProperty(value = "#{decomisoArmaTransaccionController}") + private DecomisoArmaTransaccionController decomisoArmaTransaccionController; + + // Variables para envio de mail + private String funcionarioStr; + private String razonsStr; + private String tramiteStr; + private String centrocontrolStr; + private String fechanotificacionStr; + private String tipoTramiteStr; + private String tipoAutorizacionStr; + private String usoactividadStr; + private String categoriaStr; + + /** + * Constructor + * + * @throws Exception + */ + public FirmarDocumentoController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + startQuery(); + this.init(); + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + numerotransaccion = super.getMfilters().get("numerotransaccion"); + numerosolicitud = super.getMfilters().get("csolicitud"); + creporte = super.getMfilters().get("creporte"); + cplanificacion = super.getMfilters().get("cplanificacion"); + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + if (userDetail.getPk().getPersoncode() != null) { + appletFirma = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName() + " " + (new Timestamp(new Date().getTime())).toString().split("\\.")[0]; + if (creporte != null && !creporte.equals("null")) { + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(userDetail.getPk().getPersoncode().toString()); + List provinceList = ProvinceController.findPorCodigo("EC", tcustPersonAddres.getProvincecode()); + appletLugar = provinceList.get(0).getDescription(); + } + } else { + appletFirma = ""; + } + if (numerosolicitud != null && !numerosolicitud.equals("null") && numerosolicitud.trim().length() > 0) { + solicitud = SolicitudArmasController.find(numerosolicitud); + TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + List lciudades = CityController.find("EC", centroControl.getProvincecode(), centroControl.getCantoncode()); + appletLugar = lciudades.get(0).getDescription(); + } else if (numerotransaccion != null && !numerotransaccion.equals("null")) { + TarmDecomisoArmaTransaccion decomisoArmaTransaccion = DecomisoArmaTransaccionController.find(numerotransaccion); + TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(decomisoArmaTransaccion.getCcentrocontrol()); + List lciudades = CityController.find("EC", centroControl.getProvincecode(), centroControl.getCantoncode()); + appletLugar = lciudades.get(0).getDescription(); + } else if (cplanificacion != null && !cplanificacion.equals("null")) { + planificacionInspeccion = PlanificacionInspeccionController.findPorCodigo(Long.parseLong(cplanificacion)); + TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(planificacionInspeccion.getCcentrocontrol()); + List lciudades = CityController.find("EC", centroControl.getProvincecode(), centroControl.getCantoncode()); + appletLugar = lciudades.get(0).getDescription(); + } + + System.out.println("xpath .." + xpathflujo); + obtenerXpath(); + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para opbtener el xpath de alfresco + */ + private void obtenerXpath() { + // TODO Auto-generated method stub + TarmDocumentoHabilitante documentohabilitante = new TarmDocumentoHabilitante(); + xpathflujo = super.getMfilters().get("xpath");//formato de archivo "cm:Decomiso/cm:A-2014/cm:M-10/cm:ENV-000000319/cm:ENV-000000319.pdf";// + + if (MsgControlArmas.getProperty("xpathFujoDocumentoHabilitante").equalsIgnoreCase(xpathflujo) || xpathflujo == null || xpathflujo.isEmpty() || xpathflujo.equals("null")) { + if (numerosolicitud != null && !numerosolicitud.equals("null")) { + documentohabilitante = DocumentoHabilitanteController.findPorSolicitud(numerosolicitud); + xpathflujo = documentohabilitante.getXpath(); + } + } + if (planificacionInspeccion != null && (xpathflujo == null || xpathflujo.isEmpty() || xpathflujo.equals("null") || xpathflujo.trim().length() == 0)) { + xpathflujo = planificacionInspeccion.getXpath(); + } + xpath = xpathflujo.substring(0, xpathflujo.lastIndexOf("/cm:")); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.lrecord = new ArrayList<>(); + this.beanalias = "FIRMARDOCUMENTO"; + btnFlujo = null; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + + } + + /** + * Metodo que analiza si el archivo tiene la extension permitida + * + * @param nombreArchivo + * @return + */ + public Boolean esExtensionDeArchivoPermitida(String nombreArchivo) { + String[] archivosPermitidosLst = {".pdf"}; + for (String extensionValida : archivosPermitidosLst) { + if (nombreArchivo.contains(extensionValida)) { + return Boolean.TRUE; + } + } + return Boolean.FALSE; + } + + /** + * Metodo para grabar el documento en alfresco + */ + public void saveWithDocumentAlfresco() { + try { + + if (uploadedFile != null && esExtensionDeArchivoPermitida(uploadedFile.getFileName())) { + + if (!uploadedFile.getFileName().equals(xpathflujo.substring(xpathflujo.lastIndexOf(":") + 1, xpathflujo.length()))) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nombrearchivo_xpath")); + return; + } + alfrescoController.uploadFile(uploadedFile.getInputstream(), xpathflujo.substring(xpathflujo.lastIndexOf(":") + 1, xpathflujo.length()), xpath); + //completa la tarea + //completarTarea(); + btnFlujo = "ok"; + + } else if (uploadedFile == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinarchivo")); + return; + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_archivo_firma")); + return; + } + } catch (Exception e) { + // TODO Auto-generated catch block + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_archivo_firma")); + e.printStackTrace(); + return; + } catch (Throwable e) { + // TODO Auto-generated catch block + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_archivo")); + e.printStackTrace(); + } + + } + + public void guardarRegistro() { + + } + +// /** +// * Metodo para finalizar la tarea del flujo +// */ +// public void completarTarea() { +// +// try { +// BigDecimal numeroCustodios = new BigDecimal("0"); +// if(this.solicitud.getNumerocustodios()!=null){ +// numeroCustodios = new BigDecimal(this.solicitud.getNumerocustodios()); +// } +// if(numeroCustodios.compareTo(new BigDecimal("0"))==0 && this.getLoginController().getRequest().getTransactionCode()==109){ +// this.envioCorreoDocumentoAdjunto(); +// } +// +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// } +// } + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("cplanificacion", cplanificacion); + request.modifiedData().put("numerotransaccion", numerotransaccion); + request.modifiedData().put("xpath", xpathflujo); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", "A"); // A,D,R + request.modifiedData().put("BPMObs", "OK"); + + //Actualiza el campo estadofirma en la tabla TARMDECOMISOARMATRANSACCION + if (this.getLoginController().getRequest().getTransactionCode() == 94) { + TarmDecomisoArmaTransaccion armaTransaccion = DecomisoArmaTransaccionController.find(numerotransaccion); + this.decomisoArmaTransaccionController.setRecord(armaTransaccion); + this.decomisoArmaTransaccionController.getRecord().setEstadofirma("Y"); + this.decomisoArmaTransaccionController.update(); + + DtoSave dtosaveDecomisoTran = this.decomisoArmaTransaccionController.getDtoSave(true); + dtosaveDecomisoTran.setReturnpk(true); + dtosaveDecomisoTran.setPosition(1); + msave.put(decomisoArmaTransaccionController.getBeanalias(), dtosaveDecomisoTran); + } else if (this.getLoginController().getRequest().getTransactionCode() == 109) { + Map datosmail = new HashMap(); + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail persona = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + SimpleDateFormat sdf1 = new SimpleDateFormat(MsgGeneral.getProperty("dateformat")); + TarmSolicitudTramite solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + // Variables para envio de mail + funcionarioStr = persona == null ? "" : ((persona.getMilitarygrade() == null) ? "" : CatalogDetailController.findxCodigoCodcatalogo(persona.getMilitarygrade(), "MILITARYGRADE").getDescription()) + " " + persona.getName(); + razonsStr = (solicitud == null || solicitud.getModifiedData().get("nombre") == null) ? "" : solicitud.getModifiedData().get("nombre").toString(); + tramiteStr = solicitudTramite.getNumerotramite(); + //El centro de control se saca de la solicitud donde inicio el tramite + TarmCentroControl centroControlObj = CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + if (centroControlObj != null && centroControlObj.getNombreinstitucion() != null && centroControlObj.getNombreinstitucioncodigo() != null) { + centrocontrolStr = CatalogDetailController.findxCodigoCodcatalogo(centroControlObj.getNombreinstitucion(), centroControlObj.getNombreinstitucioncodigo()).getDescription();; + } + fechanotificacionStr = sdf1.format(new Date()); + TarmTramite tramiteObj = TarmTramiteController.find(String.valueOf(solicitud.getCtramite())); + tipoTramiteStr = (tramiteObj == null || tramiteObj.getModifiedData().get("tipotramite") == null) ? "" : tramiteObj.getModifiedData().get("tipotramite").toString(); + tipoAutorizacionStr = (tramiteObj == null || tramiteObj.getModifiedData().get("tipoautorizacion") == null) ? "" : tramiteObj.getModifiedData().get("tipoautorizacion").toString(); + usoactividadStr = (tramiteObj == null || tramiteObj.getModifiedData().get("usoactividad") == null) ? "" : tramiteObj.getModifiedData().get("usoactividad").toString(); + categoriaStr = (tramiteObj == null || tramiteObj.getModifiedData().get("categoria") == null) ? "" : tramiteObj.getModifiedData().get("categoria").toString(); + + datosmail.put("funcionario", funcionarioStr); + datosmail.put("razons", razonsStr); + datosmail.put("tramite", tramiteStr); + datosmail.put("centrocontrol", centrocontrolStr); + datosmail.put("fechanotificacion", fechanotificacionStr); + datosmail.put("tipoTramite", tipoTramiteStr); + datosmail.put("tipoAutorizacion", tipoAutorizacionStr); + datosmail.put("usoactividad", usoactividadStr); + datosmail.put("categoria", categoriaStr); + request.modifiedData().put("datosmail", datosmail); + } + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.decomisoArmaTransaccionController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + BigDecimal numeroCustodios = new BigDecimal("0"); + if (this.solicitud != null && this.solicitud.getNumerocustodios() != null) { + numeroCustodios = new BigDecimal(this.solicitud.getNumerocustodios()); + } + if (numeroCustodios != null && numeroCustodios.compareTo(new BigDecimal("0")) == 0 && this.getLoginController().getRequest().getTransactionCode() == 109) { + this.envioCorreoDocumentoAdjunto(); + } + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + btnFlujo = null; + + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Envía el correo de cambio de email + * + * @throws Exception + */ + private void envioCorreoDocumentoAdjunto() throws Exception { + Mail m = new Mail(); + m.config(ParametersController.find("MAIL.FROM", "1").getTextvalue(), + ParametersController.find("MAIL.SMTP.SERVER", "1").getTextvalue(), + ParametersController.find("MAIL.SMTP.PORT", "1").getNumbervalue().intValue(), + ParametersController.find("MAIL.SMTP.USER", "1").getTextvalue(), + ParametersController.find("MAIL.SMTP.PASSWORD", "1").getTextvalue(), + Boolean.valueOf(ParametersController.find("MAIL.SMTP.AUTH", "1").getTextvalue()), + Boolean.valueOf(ParametersController.find("MAIL.SMTPS", "1").getTextvalue())); + TcustPersonAddress mail = personAddress.findPersonaPorDireccionTipoCatalogo(solicitud.getPersoncode().toString(), "3"); + m.setTo(personAddress.getRecord().getAddress()); + MessageTemplatesController message = new MessageTemplatesController(); + message.addFilter("pk", "64"); + message.query(); + if (message.getLrecord() != null && !message.getLrecord().isEmpty()) { + TgeneMessageTemplates asunto = message.getLrecord().get(0); + MessageTemplatesDescController content = new MessageTemplatesDescController(); + content.addFilter("pk.code", "64"); + content.addFilter("pk.languagecode", "ES"); + content.query(); + if (content.getLrecord() != null && !content.getLrecord().isEmpty()) { + TgeneMessageTemplatesDesc descripcionContenido = content.getLrecord().get(0); + m.setSubject(asunto.getDescription()); + String sw = descripcionContenido.getTemplate(); + // Reemplazar variables de la plantilla en mail + sw = sw.replace("$request.funcionario", this.funcionarioStr); + sw = sw.replace("$request.razons", this.razonsStr); + sw = sw.replace("$request.tramite", this.tramiteStr); + sw = sw.replace("$request.centrocontrol", this.centrocontrolStr); + sw = sw.replace("$request.fechanotificacion", this.fechanotificacionStr); + sw = sw.replace("$request.tipoTramite", this.tipoTramiteStr); + sw = sw.replace("$request.tipoAutorizacion", this.tipoAutorizacionStr); + sw = sw.replace("$request.usoactividad", this.usoactividadStr); + sw = sw.replace("$request.categoria", this.categoriaStr); + m.setCuerpoMail(sw.toString()); + m.setContentMessageType("text/html"); + // Descargar el documento habilitante a adjuntar + byte[] bytes = alfrescoController.downloadReturnDocument(this.xpathflujo); + m.addAttachment("documento.pdf", bytes, "application/pdf"); +// m.addAttachment("Documento Habilitante","C:\\Users\\JALVARADO\\Downloads\\DOC-000362250.pdf"); + m.send(); + } + } + } + + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + } + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en + * el Alfresco + */ + public void handleUpload(FileUploadEvent event) { + uploadedFile = event.getFile(); + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + public String getXpath() { + return xpath; + } + + public void setXpath(String xpath) { + this.xpath = xpath; + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + + public void upload(FileUploadEvent event) { + uploadedFile = event.getFile(); + try { + boolean isValid = DocFirmaValidator.validDocSign(uploadedFile.getInputstream()); + if (isValid) { + mensajeNoFirma = false; + mensajeGuardar = true; + + } else { + uploadedFile = null; + btnFlujo = null; + mensajeNoFirma = true; + mensajeGuardar = false; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinfirmararchivo")); + } + } catch (IOException e) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinfirmararchivo")); + } + + } + + public String getAppletCoordenadallx() { + return appletCoordenadallx; + } + + public void setAppletCoordenadallx(String appletCoordenadallx) { + this.appletCoordenadallx = appletCoordenadallx; + } + + public String getAppletCoordenadally() { + return appletCoordenadally; + } + + public void setAppletCoordenadally(String appletCoordenadally) { + this.appletCoordenadally = appletCoordenadally; + } + + public String getAppletCoordenadaurx() { + return appletCoordenadaurx; + } + + public void setAppletCoordenadaurx(String appletCoordenadaurx) { + this.appletCoordenadaurx = appletCoordenadaurx; + } + + public String getAppletCoordenadaury() { + return appletCoordenadaury; + } + + public boolean isMensajeGuardar() { + return mensajeGuardar; + } + + public void setMensajeGuardar(boolean mensajeGuardar) { + this.mensajeGuardar = mensajeGuardar; + } + + public void setAppletCoordenadaury(String appletCoordenadaury) { + this.appletCoordenadaury = appletCoordenadaury; + } + + public String getAppletLugar() { + return appletLugar; + } + + public void setAppletLugar(String appletLugar) { + this.appletLugar = appletLugar; + } + + public String getAppletFirma() { + return appletFirma; + } + + public void setAppletFirma(String appletFirma) { + this.appletFirma = appletFirma; + } + + public String getBtnFlujo() { + return btnFlujo; + } + + public void setBtnFlujo(String btnFlujo) { + this.btnFlujo = btnFlujo; + } + + public PersonAddressController getPersonAddress() { + return personAddress; + } + + public void setPersonAddress(PersonAddressController personAddress) { + this.personAddress = personAddress; + } + + public DecomisoArmaTransaccionController getDecomisoArmaTransaccionController() { + return decomisoArmaTransaccionController; + } + + public void setDecomisoArmaTransaccionController( + DecomisoArmaTransaccionController decomisoArmaTransaccionController) { + this.decomisoArmaTransaccionController = decomisoArmaTransaccionController; + } + + public String getFuncionarioStr() { + return funcionarioStr; + } + + public void setFuncionarioStr(String funcionarioStr) { + this.funcionarioStr = funcionarioStr; + } + + public String getRazonsStr() { + return razonsStr; + } + + public void setRazonsStr(String razonsStr) { + this.razonsStr = razonsStr; + } + + public String getTramiteStr() { + return tramiteStr; + } + + public void setTramiteStr(String tramiteStr) { + this.tramiteStr = tramiteStr; + } + + public String getCentrocontrolStr() { + return centrocontrolStr; + } + + public void setCentrocontrolStr(String centrocontrolStr) { + this.centrocontrolStr = centrocontrolStr; + } + + public String getFechanotificacionStr() { + return fechanotificacionStr; + } + + public void setFechanotificacionStr(String fechanotificacionStr) { + this.fechanotificacionStr = fechanotificacionStr; + } + + public String getTipoTramiteStr() { + return tipoTramiteStr; + } + + public void setTipoTramiteStr(String tipoTramiteStr) { + this.tipoTramiteStr = tipoTramiteStr; + } + + public String getTipoAutorizacionStr() { + return tipoAutorizacionStr; + } + + public void setTipoAutorizacionStr(String tipoAutorizacionStr) { + this.tipoAutorizacionStr = tipoAutorizacionStr; + } + + public String getUsoactividadStr() { + return usoactividadStr; + } + + public void setUsoactividadStr(String usoactividadStr) { + this.usoactividadStr = usoactividadStr; + } + + public String getCategoriaStr() { + return categoriaStr; + } + + public void setCategoriaStr(String categoriaStr) { + this.categoriaStr = categoriaStr; + } + + public boolean isMensajeNoFirma() { + return mensajeNoFirma; + } + + public void setMensajeNoFirma(boolean mensajeNoFirma) { + this.mensajeNoFirma = mensajeNoFirma; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/FirmarDocumentoFiscaliaController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/FirmarDocumentoFiscaliaController.java new file mode 100644 index 0000000..4b28aea --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/FirmarDocumentoFiscaliaController.java @@ -0,0 +1,480 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.io.IOException; +import java.io.InputStream; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.solicitud.DecomisoArmaTransaccionController; +import com.fp.frontend.controller.armas.solicitud.DocumentoHabilitanteController; +import com.fp.frontend.controller.armas.solicitud.PlanificacionInspeccionController; +import com.fp.frontend.controller.armas.solicitud.SolicitudArmasController; +import com.fp.frontend.controller.armas.solicitud.SolicitudCertificadoController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.controller.pgeneral.message.MessageTemplatesController; +import com.fp.frontend.controller.pgeneral.message.MessageTemplatesDescController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.validators.DocFirmaValidator; +import com.fp.mail.Mail; +import com.fp.persistence.parmas.ins.TarmPlanificacionInspeccion; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmCertificadoFiscalia; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplates; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDesc; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora para firmar documentos. + * + * @author Carlos Guzman. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class FirmarDocumentoFiscaliaController extends AbstractController { + + private String xpathflujo; + private String xpathSolicitud; + private String xpath; + private String numerosolicitud; + private String appletCoordenadallx = ""; + private String appletCoordenadally = ""; + private String appletCoordenadaurx = ""; + private String appletCoordenadaury = ""; + private String appletLugar = ""; + private String appletFirma = ""; + private UploadedFile uploadedFile; + private TsafeUserDetail userDetail; + private boolean mensajeGuardar = false; + private boolean mensajeNoFirma = false; + private String btnFlujo; +// private TarmSolicitud solicitud; + private TarmCertificadoFiscalia certificadoFiscalia; + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddress; + + /** + * Constructor + * + * @throws Exception + */ + public FirmarDocumentoFiscaliaController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + startQuery(); + this.init(); + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + numerosolicitud = super.getMfilters().get("csolicitud"); + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + if (userDetail.getPk().getPersoncode() != null) { + appletFirma = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName() + " " + (new Timestamp(new Date().getTime())).toString().split("\\.")[0]; +// if(creporte!=null && !creporte.equals("null")){ +// PersonAddressController personAddressController = new PersonAddressController(); +// TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(userDetail.getPk().getPersoncode().toString()); +// List provinceList = ProvinceController.findPorCodigo("EC", tcustPersonAddres.getProvincecode()); +// appletLugar = provinceList.get(0).getDescription(); +// } + } else { + appletFirma = ""; + } + if (numerosolicitud != null && !numerosolicitud.equals("null") && numerosolicitud.trim().length() > 0) { + certificadoFiscalia = SolicitudCertificadoController.findPorSolicitud(numerosolicitud.trim()); + if (certificadoFiscalia != null && certificadoFiscalia.getXpathSolicitudArma() != null) { + xpathflujo = certificadoFiscalia.getXpathSolicitudArma(); + xpathSolicitud = certificadoFiscalia.getXpath(); + } + Request request = this.callerhelper.getRequest(); + if (request != null && request.getCentrocontrol() != null) { + TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(request.getCentrocontrol()); + List lciudades = CityController.find("EC", centroControl.getProvincecode(), centroControl.getCantoncode()); + appletLugar = lciudades.get(0).getDescription(); + } + } +// else if(numerotransaccion!=null && !numerotransaccion.equals("null")){ +// TarmDecomisoArmaTransaccion decomisoArmaTransaccion= DecomisoArmaTransaccionController.find(numerotransaccion); +// TarmCentroControl centroControl=CentroControlArmasController.findPorCodigo(decomisoArmaTransaccion.getCcentrocontrol()); +// List lciudades = CityController.find("EC", centroControl.getProvincecode(), centroControl.getCantoncode()); +// appletLugar = lciudades.get(0).getDescription(); +// }else if(cplanificacion!=null && !cplanificacion.equals("null")){ +// planificacionInspeccion= PlanificacionInspeccionController.findPorCodigo(Long.parseLong(cplanificacion)); +// TarmCentroControl centroControl=CentroControlArmasController.findPorCodigo(planificacionInspeccion.getCcentrocontrol()); +// List lciudades = CityController.find("EC", centroControl.getProvincecode(), centroControl.getCantoncode()); +// appletLugar = lciudades.get(0).getDescription(); +// } + + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para extrer solo elnoimbre del archivo + * + * @param xpath xpath del archivo en alfresco + * @return solo la parte correspondiente al nombre del archivo + */ + public String soloNombreArchivo(String xpath) { + return xpath.substring(xpath.lastIndexOf(":") + 1, xpath.length()); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.lrecord = new ArrayList<>(); + this.beanalias = "FIRMARDOCUMENTOCERTIFICADO"; + btnFlujo = null; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + + } + + /** + * Metodo que analiza si el archivo tiene la extension permitida + * + * @param nombreArchivo + * @return + */ + public Boolean esExtensionDeArchivoPermitida(String nombreArchivo) { + String[] archivosPermitidosLst = {".pdf"}; + for (String extensionValida : archivosPermitidosLst) { + if (nombreArchivo.contains(extensionValida)) { + return Boolean.TRUE; + } + } + return Boolean.FALSE; + } + + /** + * Metodo para grabar el documento en alfresco + */ + public void saveWithDocumentAlfresco() { + try { + if (uploadedFile != null && esExtensionDeArchivoPermitida(uploadedFile.getFileName())) { + + if (!uploadedFile.getFileName().equals(xpathflujo.substring(xpathflujo.lastIndexOf(":") + 1, xpathflujo.length()))) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nombrearchivo_xpath")); + return; + } + alfrescoController.uploadFile(uploadedFile.getInputstream(), xpathflujo.substring(xpathflujo.lastIndexOf(":") + 1, xpathflujo.length()), xpathflujo.substring(0, xpathflujo.lastIndexOf(":") - 2)); + //completa la tarea + //completarTarea(); + btnFlujo = "ok"; + } else if (uploadedFile == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinarchivo")); + return; + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_archivo_firma")); + return; + } + } catch (Exception e) { + // TODO Auto-generated catch block + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_archivo_firma")); + e.printStackTrace(); + return; + } catch (Throwable e) { + // TODO Auto-generated catch block + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_archivo")); + e.printStackTrace(); + } + + } + + public void guardarRegistro() { + + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", "A"); // A,D,R + request.modifiedData().put("BPMObs", "OK"); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + this.envioCorreoDocumentoAdjunto(); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + btnFlujo = null; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Envía el correo de cambio de email + * + * @throws Exception + */ + private void envioCorreoDocumentoAdjunto() throws Exception { + Mail m = new Mail(); + m.config(ParametersController.find("MAIL.FROM", "1").getTextvalue(), + ParametersController.find("MAIL.SMTP.SERVER", "1").getTextvalue(), + ParametersController.find("MAIL.SMTP.PORT", "1").getNumbervalue().intValue(), + ParametersController.find("MAIL.SMTP.USER", "1").getTextvalue(), + ParametersController.find("MAIL.SMTP.PASSWORD", "1").getTextvalue(), + Boolean.valueOf(ParametersController.find("MAIL.SMTP.AUTH", "1").getTextvalue()), + Boolean.valueOf(ParametersController.find("MAIL.SMTPS", "1").getTextvalue())); + TcustPersonAddress mail = personAddress.findPersonaPorDireccionTipoCatalogo(certificadoFiscalia.getPersoncode().toString(), "3"); + m.setTo(personAddress.getRecord().getAddress()); + MessageTemplatesController message = new MessageTemplatesController(); + message.addFilter("pk", "67"); + message.query(); + if (message.getLrecord() != null && !message.getLrecord().isEmpty()) { + TgeneMessageTemplates asunto = message.getLrecord().get(0); + MessageTemplatesDescController content = new MessageTemplatesDescController(); + content.addFilter("pk.code", "67"); + content.addFilter("pk.languagecode", "ES"); + content.query(); + if (content.getLrecord() != null && !content.getLrecord().isEmpty()) { + TgeneMessageTemplatesDesc descripcionContenido = content.getLrecord().get(0); + //Velocity.init(); + //VelocityContext context = new VelocityContext(); + //context.put("nombreusuario", this.getLoginController().getRequest().getUser()); + //context.put("clave", this.record.get("newpassword")); + m.setSubject(asunto.getDescription()); + //StringWriter sw = new StringWriter(); +// String sw=descripcionContenido.getTemplate().replace("$clave", this.record.get("newpassword").toString()); +// sw=sw.replace("$nombreusuario", this.record.get("name")+""); + //Velocity.evaluate(context, sw, "", descripcionContenido.getTemplate()); + String sw = "Mail de prueba documento habilitante con adjunto"; + m.setCont(sw.toString()); + m.setContentMessageType("text/html"); + // Descargar el documento habilitante a adjuntar + byte[] bytes = alfrescoController.downloadReturnDocument(this.xpathflujo); + m.addAttachment("documento.pdf", bytes, "application/pdf"); +// m.addAttachment("Documento Habilitante","C:\\Users\\JALVARADO\\Downloads\\DOC-000362250.pdf"); + m.send(); + } + } + } + + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + } + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en + * el Alfresco + */ + public void handleUpload(FileUploadEvent event) { + uploadedFile = event.getFile(); + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + public String getXpath() { + return xpathSolicitud; + } + + public void setXpath(String xpathSolicitud) { + this.xpathSolicitud = xpathSolicitud; + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + + public void upload(FileUploadEvent event) { + uploadedFile = event.getFile(); + try { + boolean isValid = DocFirmaValidator.validDocSign(uploadedFile.getInputstream()); + if (isValid) { + mensajeNoFirma = false; + mensajeGuardar = true; + + } else { + uploadedFile = null; + btnFlujo = null; + mensajeNoFirma = true; + mensajeGuardar = false; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinfirmararchivo")); + } + } catch (IOException e) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinfirmararchivo")); + } + + } + + public String getAppletCoordenadallx() { + return appletCoordenadallx; + } + + public void setAppletCoordenadallx(String appletCoordenadallx) { + this.appletCoordenadallx = appletCoordenadallx; + } + + public String getAppletCoordenadally() { + return appletCoordenadally; + } + + public void setAppletCoordenadally(String appletCoordenadally) { + this.appletCoordenadally = appletCoordenadally; + } + + public String getAppletCoordenadaurx() { + return appletCoordenadaurx; + } + + public void setAppletCoordenadaurx(String appletCoordenadaurx) { + this.appletCoordenadaurx = appletCoordenadaurx; + } + + public String getAppletCoordenadaury() { + return appletCoordenadaury; + } + + public boolean isMensajeGuardar() { + return mensajeGuardar; + } + + public void setMensajeGuardar(boolean mensajeGuardar) { + this.mensajeGuardar = mensajeGuardar; + } + + public void setAppletCoordenadaury(String appletCoordenadaury) { + this.appletCoordenadaury = appletCoordenadaury; + } + + public String getAppletLugar() { + return appletLugar; + } + + public void setAppletLugar(String appletLugar) { + this.appletLugar = appletLugar; + } + + public String getAppletFirma() { + return appletFirma; + } + + public void setAppletFirma(String appletFirma) { + this.appletFirma = appletFirma; + } + + public String getBtnFlujo() { + return btnFlujo; + } + + public void setBtnFlujo(String btnFlujo) { + this.btnFlujo = btnFlujo; + } + + public PersonAddressController getPersonAddress() { + return personAddress; + } + + public void setPersonAddress(PersonAddressController personAddress) { + this.personAddress = personAddress; + } + + public String getXpathSolicitud() { + return xpathSolicitud; + } + + public void setXpathSolicitud(String xpathSolicitud) { + this.xpathSolicitud = xpathSolicitud; + } + + public String getNumerosolicitud() { + return numerosolicitud; + } + + public void setNumerosolicitud(String numerosolicitud) { + this.numerosolicitud = numerosolicitud; + } + + public boolean isMensajeNoFirma() { + return mensajeNoFirma; + } + + public void setMensajeNoFirma(boolean mensajeNoFirma) { + this.mensajeNoFirma = mensajeNoFirma; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/GuardiasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/GuardiasController.java new file mode 100644 index 0000000..f8da5be --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/GuardiasController.java @@ -0,0 +1,171 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.event.AjaxBehaviorEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmGuardias; + +/** + * Controlador que maneja guardias de seguridad + * + * @author james + * + */ +@ManagedBean +@ViewScoped +public class GuardiasController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public GuardiasController() throws Exception { + super(TarmGuardias.class); + } + + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "GUARDIAS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método ejecutado después de ejecutarse el constructor + */ + @PostConstruct + public void postConstruct() { + + init(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dtoQuery = super.getDtoQuery(Boolean.TRUE); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dtoQuery); + SubQuery subQueryGuardia1 = new SubQuery("TcustPersonDetail", "name", "gnombre", "i.pk.personcode=t.pk and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.pk)"); + SubQuery subQueryGuardia2 = new SubQuery("TcustPersonDetail", "identification", "gcedula", "i.pk.personcode=t.pk and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.pk)"); + SubQuery subQueryEmpresa1 = new SubQuery("TcustPersonDetail", "name", "nempresa", "i.pk.personcode=t.cempresa and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.cempresa)"); + SubQuery subQueryEmpresa2 = new SubQuery("TcustPersonDetail", "identification", "iempresa", "i.pk.personcode=t.cempresa and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.cempresa)"); + dtoQuery.addSubQuery(subQueryGuardia1); + dtoQuery.addSubQuery(subQueryGuardia2); + dtoQuery.addSubQuery(subQueryEmpresa1); + dtoQuery.addSubQuery(subQueryEmpresa2); + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response response = callerhelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList<>(); + MessageHelper.setMessageError(response); + } else { + this.lrecord = (List) response.get(beanalias); + this.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * M\u00e9todo para encontrar por solicitud + * + * @param solicitudCode + * @return + */ + public static TarmGuardias find(String guardiaCode, String empresaCode) { + try { + GuardiasController cc = new GuardiasController(); + //cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", guardiaCode); + cc.addFilter("cempresa", empresaCode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response response = this.callerhelper.executeSave(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(response); + MessageHelper.setMessageInfo(response); + } else { + MessageHelper.setMessageError(response); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if (Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")) { + valorColocar = Boolean.TRUE; + } + for (TarmGuardias guardias : lrecord) { + guardias.getModifiedData().put("seleccionado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static TarmGuardias findxcguardia(String codigopersona) { + try { + GuardiasController cc = new GuardiasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", codigopersona); + + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ImportacionArmasDetalleController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ImportacionArmasDetalleController.java new file mode 100644 index 0000000..875182a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ImportacionArmasDetalleController.java @@ -0,0 +1,127 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; + +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmDetalleImportacion; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Clase controladora del bean Tdireccion. + * + * @author Andres Cevallos. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ImportacionArmasDetalleController extends AbstractController { + + public ImportacionArmasDetalleController() throws Exception { + super(TarmDetalleImportacion.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + + this.beanalias = "TARMASDETALLE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void executeProvincia() { + + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ImportacionController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ImportacionController.java new file mode 100644 index 0000000..78a8510 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ImportacionController.java @@ -0,0 +1,435 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import javax.faces.context.FacesContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.ArmaExcell; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.funcionalidad.TotalArmasController; +import com.fp.frontend.controller.armas.solicitud.SolicitudController; +import com.fp.frontend.controller.armas.solicitud.SolicitudTramiteController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ImportacionController extends AbstractController { + + public ImportacionController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmController; + + @ManagedProperty(value = "#{armaController}") + private ArmaController armaController; + + /* + @ManagedProperty(value = "#{armaControllerProduccion}") + private ArmaControllerProduccion armaControllerProduccion; + */ + @ManagedProperty(value = "#{totalArmasController}") + private TotalArmasController totalArmasController; + + private Boolean tiporegistro; + + private Boolean aux; + + private Date fechaactual; + private List ltiporegistro; + + private List laddresstype; + + private List lprovinces; + + private List lcantones; + + private List lciudades; + + private List lcountry; + + private TgeneCountry pais; + + private List lcities; + + private TgeneCatalogDetail cdetalle; + + private Date fechadesolicitud; + + public void changeType() { + if (this.registroArmController.getRecord().getTiporegistro() == null) { + setTiporegistro(false); + } else if (this.registroArmController.getRecord().getTiporegistro().equals("PRO")) { + + setTiporegistro(false); + + } else { + setTiporegistro(true); + + } + } + + public Boolean getAux() { + return aux; + } + + public void setAux(Boolean aux) { + this.aux = aux; + } + + public TotalArmasController getTotalArmasController() { + return totalArmasController; + } + + public void setTotalArmasController(TotalArmasController totalArmasController) { + this.totalArmasController = totalArmasController; + } + + // @ManagedProperty(value = "#{importacionArmasDetalleController}") +// private ImportacionArmasDetalleController importacionArmasDetalleController; + @ManagedProperty(value = "#{loginController}") + private LoginController loginController; + + public RegistroArmController getRegistroArmController() { + return registroArmController; + } + + public void setRegistroArmController( + RegistroArmController RegistroArmController) { + this.registroArmController = RegistroArmController; + } + + //Datos quemados de Prueba + private List lsolicitud; + + private TarmSolicitud solicitud; + //Fin de Datos quemados de prueba + + private TcustPersonDetail persondetail; + + //private TarmSolicitud solicitudpersondata; + private List lperson; + + public List getLaddresstype() { + return laddresstype; + } + + public void setLaddresstype(List laddresstype) { + this.laddresstype = laddresstype; + } + + public List getLprovinces() { + return lprovinces; + } + + public void setLprovinces(List lprovinces) { + this.lprovinces = lprovinces; + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public List getLcountry() { + return lcountry; + } + + public void setLcountry(List lcountry) { + this.lcountry = lcountry; + } + + public List getLcities() { + return lcities; + } + + public void setLcities(List lcities) { + this.lcities = lcities; + } + + public List getLsolicitud() { + return lsolicitud; + } + + public void setLsolicitud(List lsolicitud) { + this.lsolicitud = lsolicitud; + } + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + public List getLperson() { + return lperson; + } + + public void setLperson(List lperson) { + this.lperson = lperson; + } + + @PostConstruct + private void postconstruct() { + + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + + crearRegistro(); + this.lrecord = new ArrayList<>(); + this.beanalias = "IMPORTACION"; + + pais = new TgeneCountry(); + aux = false; + fechaactual = new Date(); + fechadesolicitud = new Date(); + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + //solicitud.setPersoncode(tsafeUserDetail.getPk().getPersoncode()); + setPersondetail(PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString())); + setLtiporegistro(CatalogDetailController.find("TIPOREGISTRO", "REG")); + armaController.setPersoncode(tsafeUserDetail.getPk().getPersoncode()); + setLaddresstype(CatalogDetailController.find("ADDRESSTYPE")); + setLcountry(CountryController.find()); + pais = CountryController.findcountry("EC"); + //armaController.setPais(pais.getPk()); + setTiporegistro(false); + setLprovinces(ProvinceController.find(pais.getPk())); + cdetalle = CatalogDetailController.findxCodigoCodcatalogo(getPersondetail().getIdentificationcatalog(), getPersondetail().getIdentificationcatalogcode()); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + + } + + public void actualizarsolicitudImportacionArmas() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + registroArmController.getRecord().setFcreacion(new java.sql.Date(new Date().getTime())); + + if (fechadesolicitud != null) { + registroArmController.getRecord().setFechasolicitud(new java.sql.Date(fechadesolicitud.getTime())); + } + registroArmController.getRecord().setPersoncode(tsafeUserDetail.getPk().getPersoncode()); + registroArmController.getRecord().setTiporegistrocodigo("TIPOREGISTRO"); + registroArmController.update(); + + } + + public void crearRegistro() throws Exception { + registroArmController.create(); + } + + public void validarTramite(String tramite) { + + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + String solicitud = SolicitudTramiteController.findByNumTramite(tramite).getPk().getCsolicitud(); + aux = SolicitudController.existeRegistroPersona(tsafeUserDetail.getPk().getPersoncode(), solicitud); + + } + + public void actualizarTotales() throws Exception { + + totalArmasController.update(); + for (TarmArmas object : armaController.getLrecord()) { + TiposArmasExplosivosController.findarma(object.getCtipoarmaexplosivo()); + } + } +//importacionController.armaController.record.provincecode + + @Override + public void save() { + try { + if (armaController.getLrecord() == null || armaController.getLrecord().isEmpty()) { + return; + } + actualizarsolicitudImportacionArmas(); + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = this.armaController.getDtoSave(true); + HashMap msave = new HashMap(); + msave.put(armaController.getBeanalias(), dtosave); // adicionar metadata de mantenimiento para cada tabla. + dtosave.setPosition(1); + + DtoSave dtosaveSol = this.registroArmController.getDtoSave(true); + dtosaveSol.setPosition(2); + msave.put(registroArmController.getBeanalias(), dtosaveSol); + + DtoSave dtosaveTot = this.totalArmasController.getDtoSave(true); + dtosaveTot.setPosition(3); + msave.put(totalArmasController.getBeanalias(), dtosaveTot); + request.setSaveTables(msave); + + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + + this.armaController.postCommit(resp); + this.registroArmController.postCommit(resp); + this.totalArmasController.postCommit(resp); + this.armaController.clearAll(); + this.registroArmController.clearAll(); + this.totalArmasController.clearAll(); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + //armaController.setSave(false); + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + //armaController.setSave(false); + } finally { + try { + crearRegistro(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } + + @Override + public void postCommit(Response response) throws Exception { + this.armaController.postCommit(response); + this.registroArmController.postCommit(response); + this.totalArmasController.postCommit(response); + } + + public ArmaController getArmaController() { + return armaController; + } + + public void setArmaController(ArmaController armaController) { + this.armaController = armaController; + } + + public LoginController getLoginController() { + return loginController; + } + + public void setLoginController(LoginController loginController) { + this.loginController = loginController; + } + + public TcustPersonDetail getPersondetail() { + return persondetail; + } + + public void setPersondetail(TcustPersonDetail persondetail) { + this.persondetail = persondetail; + } + + public TgeneCatalogDetail getCdetalle() { + return cdetalle; + } + + public void setCdetalle(TgeneCatalogDetail cdetalle) { + this.cdetalle = cdetalle; + } + + public List getLciudades() { + return lciudades; + } + + public void setLciudades(List lciudades) { + this.lciudades = lciudades; + } + + public TgeneCountry getPais() { + return pais; + } + + public void setPais(TgeneCountry pais) { + this.pais = pais; + } + + public List getLtiporegistro() { + return ltiporegistro; + } + + public void setLtiporegistro(List ltiporegistro) { + this.ltiporegistro = ltiporegistro; + } + + public Boolean getTiporegistro() { + return tiporegistro; + } + + public void setTiporegistro(Boolean tiporegistro) { + this.tiporegistro = tiporegistro; + } + + public Date getFechadesolicitud() { + return fechadesolicitud; + } + + public void setFechadesolicitud(Date fechadesolicitud) { + this.fechadesolicitud = fechadesolicitud; + } + + public Date getFechaactual() { + return fechaactual; + } + + public void setFechaactual(Date fechaactual) { + this.fechaactual = fechaactual; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ImportacionDetalleController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ImportacionDetalleController.java new file mode 100644 index 0000000..ea1ad10 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ImportacionDetalleController.java @@ -0,0 +1,5 @@ +package com.fp.frontend.controller.armas.parametros; + +public class ImportacionDetalleController { + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ImporteArmasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ImporteArmasController.java new file mode 100644 index 0000000..e732a3e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ImporteArmasController.java @@ -0,0 +1,854 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletResponse; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.jboss.logging.Logger; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.util.ArmasExcel; +import com.fp.frontend.controller.armas.parametros.util.TipoArmaExplosivoPKExcel; +import com.fp.frontend.controller.armas.solicitud.DecomisoArmaController; +import com.fp.frontend.controller.armas.solicitud.DecomisoController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ImporteArmasController extends AbstractController { + + /* CATALOGOS */ + /* TIPO ARMA EXPLOSIVO */ + private List listLongitudes; + private List listCalibres; + private List listClases; + private List listTipoArmaExplosivos; + /* ADICONAL */ + private List listMarcas; + private List listTipoFabricacion; + + /** + * Variable para a;adir las armas que se van a Guardar + */ + private List listArmas; + /** + * registro del Arma Due;o de las armas + */ + private TarmRegistroArmas registroArma; + /** + * Cabecera del decomiso + */ + private TarmDecomiso tarmDecomiso; + /** + * Variable para listar los errores al cargar el excel + */ + private List listaErrores; + /** + * Mensaje de error + */ + private String mensajeError; + /** + * numero de armas procesadas + */ + private Integer numArmasProcesadas; + /** + * numero de armas con error + */ + private Integer numArmasError; + /** + * numero de armas con error + */ + private Integer numCorrectas; + /** + * Centro de control Policoa Judicia 2/PN07 + */ + private TarmCentroControl centroControl; + + /** + * Detalle del usuario + */ + private TcustPersonDetail usuario; + + /** + * Nombre del centro de control logeado + */ + private String centroControlNombreLogeado; + /** + * Numero de registro + */ + private String numeroRecibo; + + /*Constante centro control*/ + private String nombreInstitucion; + private String institucion; + /*Cedula del propietario*/ + private String cedulaPropietario; + /*motivo incautacion*/ + private String motivocatalogo; + /*cantidad de armas*/ + private Integer cantidad = 1; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmasController; + + /** + * Controlador que maneja el decomiso TarmDecomiso + */ + @ManagedProperty(value = "#{decomisoController}") + private DecomisoController decomisoController; + + /** + * Controlador que maneja TarmDecomisoArma + */ + @ManagedProperty(value = "#{decomisoArmaController}") + private DecomisoArmaController decomisoArmaController; + + private Map mapaProvincia; + private Map mapaCanton; + private Set listaTipoArmaExplosivoPk; + + private final static Logger LOG = Logger.getLogger(ImporteArmasController.class.getName()); + + public ImporteArmasController() throws Exception { + super(TarmArmas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.record = new TarmArmas(); + this.beanalias = "ARMASIMPORTE"; + listArmas = new ArrayList(); + registroArma = new TarmRegistroArmas(); + mapaProvincia = new HashMap(); + mapaCanton = new HashMap(); + listaTipoArmaExplosivoPk = new HashSet<>(); + cargaParametros(); + cargaCatalogos(); + cargaRegistroArma(); + cargaUsuarioLogeado(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void cargaParametros() { + nombreInstitucion = codigos("CODIGO.NOM.INSTIT.IMPORTE");//"PJ01" + institucion = codigos("CODIGO.INSTITUCION.IMPORTE");//2 + /*Cedula del propietario*/ + cedulaPropietario = codigos("CEDULA.PROPIETARIO.IMPORTE");//"999999999"; + /*motivo incautacion*/ + motivocatalogo = codigos("MOTIVO.IMPORTE");//"9"; + } + + /** + * Método para obtener los codigos + */ + private String codigos(String parametro) { + TgeneParameters tgeneParameters = ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + public void cargaCatalogos() { + /* TIPOARMAEXPLOSIVO */ + listLongitudes = CatalogDetailController.find("LONGITUD"); + listCalibres = CatalogDetailController.find("CALIBRE"); + listClases = CatalogDetailController.find("CLASE"); + listTipoArmaExplosivos = CatalogDetailController.find("TIPOARMAEXPLOSIVO"); + /* CATALOGO AD */ + listMarcas = CatalogDetailController.find("MARCA"); + listTipoFabricacion = CatalogDetailController.find("TIPOFABRICACION"); + //listColor = CatalogDetailController.find("COLOR"); + } + + public void cargaUsuarioLogeado() { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + centroControlNombreLogeado = tsafeUserDetail.getModifiedData().get("centrocontrol").toString(); + } + + public void cargaRegistroArma() { + TcustPersonDetail tcustPersonDetail = PersonDetailController.findByIdentification(cedulaPropietario); + registroArma.setPersoncode(tcustPersonDetail.getPk().getPersoncode()); + registroArma.setFcreacion(new java.sql.Date(new Date().getTime())); + registroArma.setTiporegistro("INCA"); + registroArma.setTiporegistrocodigo("TIPOREGISTRO"); + registroArma.setPaisorigen(""); + registroArma.setIsnew(true); + + List listCentroControls = CentroControlArmasController.findxOrganismoUnidad(institucion, nombreInstitucion); + if (listCentroControls != null && listCentroControls.size() == 1) { + centroControl = listCentroControls.get(0); + } else { + centroControl = null; + mensajeError = "NO TIENE REGISTRADO UN CENTRO DE CONTROL O TIENE REGISTRADO MAS DE UNO CON EL MISMO NOMBRE DE INSTITUCI\u00d3N Y NOMBRE INSTITUCI\u00d3N"; + } + } + + /* + * (non-Javadoc) + * + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + + DtoQuery dto = super.getDtoQuery(true); + Filter filtrofecha = new Filter(); + filtrofecha + .setSql("t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) and t.estado !='DEST' and t.estado !='CDP'"); + dto.addFiltro(filtrofecha); + dto.setOrderby("pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + if (centroControl == null) { + MessageHelper.setMessageError("NO TIENE CENTRO DE CONTROL REVISE EL CENTRO DE CONTROL"); + return; + } + if (listArmas == null || listArmas.size() == 0 || listArmas.isEmpty()) { + MessageHelper.setMessageError("NO EXISTEN ARMAS CARGADAS "); + return; + } + HashMap msave = new HashMap(); + Request request = this.callerhelper.getRequest(); + // regstroArma + registroArmasController.clearAll(); + registroArmasController.setRecord(registroArma); + registroArmasController.update(); + DtoSave dtosaveregistroarma = registroArmasController.getDtoSave(true); + dtosaveregistroarma.setPosition(1); + msave.put(registroArmasController.getBeanalias(), dtosaveregistroarma); + + // cargar Armas + this.clearAll(); + cargarArmas(); + DtoSave dtosave = super.getDtoSave(true); + dtosave.setPosition(2); + msave.put(this.beanalias, dtosave); + + //carga tarmdecomiso + decomisoController.clearAll(); + tarmDecomiso = new TarmDecomiso(); + tarmDecomiso.setIsnew(true); + tarmDecomiso.setTipoprocesocode("TIPOREGISTRO"); + tarmDecomiso.setTipoproceso("INCA"); + tarmDecomiso.setCcentrocontrol(centroControl.getPk()); + tarmDecomiso.setNumerorecibo(numeroRecibo);//numero de oficio + tarmDecomiso.setFecharegistro(new java.sql.Date(new Date().getTime())); + //tarmDecomiso.setOrganismocontrol(centroControlNombreLogeado); + tarmDecomiso.setOrganismocontrol(centroControl.getModifiedData().get("desinstitucion").toString()); + tarmDecomiso.setPersoncoderegistra(usuario.getPk().getPersoncode()); + + //tarmDecomiso.setNumerotransaccion(pNumerotransaccion); + decomisoController.setRecord(tarmDecomiso); + decomisoController.update(); + DtoSave dtoDecomiso = decomisoController.getDtoSave(true); + dtoDecomiso.setPosition(3); + msave.put("IMPORTEDECOMISO", dtoDecomiso); + + //Tarmdecomisoarma + decomisoArmaController.clearAll(); + DtoSave dtoDecomisoArma = decomisoArmaController.getDtoSave(true); + dtoDecomisoArma.setPosition(4); + msave.put(decomisoArmaController.getBeanalias(), dtoDecomisoArma); + + request.setSaveTables(msave); + //request.getModifiedData().put("REGISTRO", this.registroArma); + + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + mensajeError = null; + MessageHelper.setMessageInfo(resp); + listArmas.clear(); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + public void cargarArmas() throws Exception { + for (TarmArmas item : listArmas) { + item.setEstadoDecomiso(numeroRecibo); + this.record = item; + record.setIsnew(true); + super.update(); + } + } + + /** + * Metodo que carga y valida el contenido de un archivo excel con + * información de armas + * + * @param event + */ + public void cargarArchivo(FileUploadEvent event) { + listArmas = new ArrayList(); + listaErrores = new ArrayList(); + int contador = 0; + try { + UploadedFile selectedFile = event.getFile(); + InputStream archivo = selectedFile.getInputstream(); + XSSFWorkbook libro = new XSSFWorkbook(archivo); + XSSFSheet hoja = libro.getSheetAt(0); + // Iterando sobre las filas + Iterator rowIterator = hoja.iterator(); + List listaArmasExcel = new ArrayList(); + // Cargando el contenido de las celdas a una lista de objetos + while (rowIterator.hasNext()) { + Row row = rowIterator.next(); + if (contador != 0) { + Cell orden = row.getCell(0); + Cell longuitud = row.getCell(14); + Cell calibre = row.getCell(5); + Cell clase = row.getCell(1);//material + Cell tipoArmaExplosivo = row.getCell(2);// modelo: REVOLVER CARTUCHERA CARTUCHERANO CARABINA SUB-AMETRALLADORA*revisar + Cell marca = row.getCell(3); + Cell tipoFabricacion = row.getCell(7); + Cell serie = row.getCell(4); + Cell fechaRecepcion = row.getCell(9); + Cell motivo = row.getCell(10); + Cell descripcionProvincia = row.getCell(12); + Cell descripcionCanton = row.getCell(13); + Cell observaciones = row.getCell(15); + if (!this.celdaVacia(orden) + && !this.celdaVacia(longuitud) + && !this.celdaVacia(calibre) + && !this.celdaVacia(clase) + && !this.celdaVacia(tipoArmaExplosivo) + && !this.celdaVacia(marca) + && !this.celdaVacia(tipoFabricacion) + && !this.celdaVacia(serie) + && !this.celdaVacia(fechaRecepcion) + && !this.celdaVacia(motivo) + && !this.celdaVacia(descripcionProvincia) + && !this.celdaVacia(descripcionCanton) + && !this.celdaVacia(observaciones)) { + + ArmasExcel armasExcel = new ArmasExcel(orden.toString().trim(), longuitud.toString().trim(), calibre.toString().trim(), + clase.toString().trim(), tipoArmaExplosivo.toString().trim(), marca.toString().trim(), + tipoFabricacion.toString().trim(), serie.toString().trim(), fechaRecepcion.toString().trim(), + motivo.toString().trim(), descripcionProvincia.toString().trim(), descripcionCanton.toString().trim(), + observaciones.toString().trim(), contador); + listaArmasExcel.add(armasExcel); + LOG.info("CONTADOR........" + contador); + } else { + listaErrores.add("EL REGISTRO TIENE CAMPOS EN BLANCO, REGISTRO: " + contador); + } + contador++; + } else { + contador++; + } + } + archivo.close(); + + LOG.info("NUMERO REGISTROS........." + listaArmasExcel.size()); + LOG.info("Procesar armas adjuntas"); + Map mapaSerie = new HashMap(); + int auxi = 0; + for (ArmasExcel armasExcel : listaArmasExcel) { + LOG.info("CONTADOR 2: " + auxi++); + TarmArmas arma = armarlistaArmasExcel(armasExcel.getLonguitud(), armasExcel.getCalibre(), armasExcel.getClase(), + armasExcel.getTipoArmaExplosivo(), armasExcel.getMarca(), armasExcel.getTipoFabricacion(), + armasExcel.getCont(), armasExcel.getSerie(), armasExcel.getDescripcionProvincia(), armasExcel.getDescripcionCanton()); + if (arma != null) { + arma.getModifiedData().put("motivo", armasExcel.getMotivo()); + arma.getModifiedData().put("observaciondecomiso", armasExcel.getObservaciones()); + arma.getModifiedData().put("cantidad", cantidad); + arma.getModifiedData().put("motivocatalogocode", "MOTIVODECOMISO"); + arma.getModifiedData().put("motivocatalogo", motivocatalogo);//entrega voluntaria + //dd/MM/yyyy + try { + //validar si la serie es repetida + if (mapaSerie.get(armasExcel.getSerie()) != null) { + listaErrores.add("SERIE DUPLICADA" + armasExcel.getSerie() + " DEL REGISTRO: " + armasExcel.getCont()); + continue; + } else { + mapaSerie.put(armasExcel.getSerie(), armasExcel.getSerie()); + } + + SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy"); //formatter.parse("7-OCT-016"); + Date date = formatter.parse(armasExcel.getFechaRecepcion()); + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + String anio = cal.get(Calendar.YEAR) + ""; + if (anio != null && anio.trim().length() == 4 && cal.get(Calendar.YEAR) > 1900) { + arma.getModifiedData().put("fechaRecepcion", date); + arma.getModifiedData().put("fechaDecomiso", date); + //ANIADE EL ARMA + listArmas.add(arma); + } else { + listaErrores.add("PROBLEMA CON LA FECHA DE RECEPCI\u00d3N " + armasExcel.getFechaRecepcion() + ", EL A\u00d1O: " + anio + + " NO CORRESPONDE AL FORMATO, EL FORMATO ES dd-MMM-yyyy EJ:(04-OCT-2017), DEL REGISTRO: " + armasExcel.getCont()); + } + } catch (Exception e) { + listaErrores.add("PROBLEMA CON LA FECHA DE RECEPCI\u00d3N " + armasExcel.getFechaRecepcion() + + ", EL FORMATO ES dd-MMM-yyyy EJ:(04-OCT-2017), DEL REGISTRO: " + armasExcel.getCont()); + } + } + } + LOG.info("ARMAS PROCESADAS 2: " + listArmas.size()); + } catch (Exception e) { + MessageHelper.setMessageError(e); + e.printStackTrace(); + } finally { + numArmasProcesadas = contador - 1; + if (!listaErrores.isEmpty()) { + MessageHelper.setMessageError("ERRORES ENCONTRADOS DENTRO DEL ARCHIVO EXCEL: "); + mensajeError = "ERROR EN LA CARGA DE ARMAS"; + numCorrectas = listArmas.size(); + listArmas.clear(); + } else { + numCorrectas = listArmas.size(); + } + numArmasError = listaErrores.size(); + } + } + + private TarmArmas armarlistaArmasExcel(String longuitud, String calibre, String clase, String tipoArmaExplosivo, String marca, + String tipoFabricacion, int cont, String serie, String descripcionProvincia, String descripcionCanton) { + TarmArmas armaRegistro = null; + String longuitudCodigo = validarCatalogo(listLongitudes, longuitud); + if (longuitudCodigo == null || longuitudCodigo.isEmpty()) { + listaErrores.add("LA DESCRIPCI\u00d3N DE LA LONGUITUD: " + longuitud.toString() + " NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: " + cont); + } + String calibreCodigo = validarCatalogo(listCalibres, calibre); + if (calibreCodigo == null || calibreCodigo.isEmpty()) { + listaErrores.add("LA DESCRIPCI\u00d3N DEL CALIBRE: " + calibre.toString() + " NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: " + cont); + } + String claseCodigo = validarCatalogo(listClases, clase); + if (claseCodigo == null || claseCodigo.isEmpty()) { + listaErrores.add("LA DESCRIPCI\u00d3N DE LA CLASE: " + clase.toString() + " NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: " + cont); + } + String tipoArmaExplosivoCodigo = validarCatalogo(listTipoArmaExplosivos, tipoArmaExplosivo); + if (tipoArmaExplosivoCodigo == null || tipoArmaExplosivoCodigo.isEmpty()) { + listaErrores.add("LA DESCRIPCI\u00d3N DEL TIPO ARMA EXPLOSIVO: " + tipoArmaExplosivo.toString() + " NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: " + cont); + } + String unidadMedidaPesoCodigo = "UNIDAD"; + + String marcaCodigo = validarCatalogo(listMarcas, marca);// MARCA + if (marcaCodigo == null) { + listaErrores.add("LA MARCA DEL ARMA: " + marca.toString() + " NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: " + cont); + } + String tipoFabricacionCodigo = validarCatalogo(listTipoFabricacion, tipoFabricacion);// TIPOFABRICACION + if (tipoFabricacionCodigo == null) { + listaErrores.add("EL TIPO DE FABRICACI\u00d3N: " + tipoFabricacion.toString() + " NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: " + cont); + } + /*Ubicacion Provincia canton*/ + TgeneProvince province = null; + TgeneCanton canton = null; + //provincia + if (mapaProvincia.get("descripcionProvincia") != null) { + province = (TgeneProvince) mapaProvincia.get(descripcionProvincia); + } else { + List listProvincias = ProvinceController.findxDescripcion("EC", null, descripcionProvincia); + if (listProvincias != null) { + if (listProvincias.size() == 1) { + province = listProvincias.get(0); + mapaProvincia.get("descripcionProvincia"); + } else { + listaErrores.add(" EXISTE MAS DE UNA PROVINCIA: " + descripcionProvincia.toString() + " CON ESTA DESCRIPCI\u00d3N, DEL REGISTRO: " + cont); + return null; + } + } else { + listaErrores.add(" NO EXISTE LA PROVINCIA: " + descripcionProvincia.toString() + " EN EL CAT\u00c1LOGO, DEL REGISTRO: " + cont); + return null; + } + } + //canton + if (mapaCanton.get(descripcionProvincia) != null && province != null && province.getPk() != null) { + canton = (TgeneCanton) mapaCanton.get(descripcionProvincia); + } else if (province != null && province.getPk() != null) { + List listCantons = CantonController.find("EC", province.getPk().getProvincecode()); + if (listCantons != null && listCantons.size() != 0) { + for (TgeneCanton item : listCantons) { + if (item.getDescription().trim().equals(descripcionCanton)) { + canton = item; + mapaCanton.put(descripcionProvincia, item); + break; + } + } + if (canton == null) { + listaErrores.add(" NO EXISTEN CANTONES ASOCIADOS CON LA PROVINCIA: " + descripcionProvincia.toString() + ", DEL REGISTRO: " + cont); + return null; + } + } else { + listaErrores.add(" NO EXISTEN CANTONES ASOCIADOS CON LA PROVINCIA: " + descripcionProvincia.toString() + ", DEL REGISTRO: " + cont); + return null; + } + } + + if (marcaCodigo == null || tipoFabricacionCodigo == null || province == null || canton == null) { + return null; + } + + if (longuitudCodigo != null && calibreCodigo != null && claseCodigo != null && tipoArmaExplosivoCodigo != null) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = null; + TipoArmaExplosivoPKExcel tipoArmaPk = validarTipoArma(longuitudCodigo, calibreCodigo, claseCodigo, tipoArmaExplosivoCodigo, unidadMedidaPesoCodigo); + if (tipoArmaPk != null) { + tarmTipoArmaExplosivo = tipoArmaPk.getTipoArmaExplosivoClase(); + } else { + tarmTipoArmaExplosivo = ImporteTipoArmaExplosivoController.findpk(longuitudCodigo, calibreCodigo, claseCodigo, tipoArmaExplosivoCodigo, unidadMedidaPesoCodigo); + if (tarmTipoArmaExplosivo != null) { + tipoArmaPk = new TipoArmaExplosivoPKExcel(longuitudCodigo, calibreCodigo, claseCodigo, tipoArmaExplosivoCodigo, unidadMedidaPesoCodigo, tarmTipoArmaExplosivo); + listaTipoArmaExplosivoPk.add(tipoArmaPk); + } + } + if (tarmTipoArmaExplosivo != null) { + armaRegistro = new TarmArmas(); + armaRegistro.setMarca(marcaCodigo); + armaRegistro.setMarcacodigo("MARCA"); + armaRegistro.setTipofabricacion(tipoFabricacionCodigo); + armaRegistro.setTipofabricacioncodigo("TIPOFABRICACION"); + //armaRegistro.setColor(colorCodigo); + armaRegistro.setColorcodigo("COLOR"); + armaRegistro.setUnidadmedidacantidad("UNIDAD"); + armaRegistro.setUnidadmedidacantidadcodigo("UNIDADMEDIDA"); + armaRegistro.setEstado("INC"); + armaRegistro.setEstadocodigo("ESTADOARMA"); + armaRegistro.setCountrycode("EC"); + armaRegistro.setProvincecode(province.getPk().getProvincecode()); + armaRegistro.setCantoncode(canton.getPk().getCantoncode()); + //armaRegistro.setParroquiacode(""); + // armaRegistro.setCregistro(); + armaRegistro.setCitycode(""); + armaRegistro.setLote(serie); + armaRegistro.setCantidad(cantidad); + // armaRegistro.setSeriecanon(); + // armaRegistro.setDireccion(); + armaRegistro.setFecharegistro(new java.sql.Date(new Date().getTime())); + armaRegistro.setCtipoarmaexplosivo(tarmTipoArmaExplosivo.getPk()); + armaRegistro.setEstadoDecomiso("INC"); + } else { + listaErrores.add("LA COMBINACION DEL ARMA NO EXISTE EN EL REGISTRO: " + cont + " "); + } + } + return armaRegistro; + } + + private TipoArmaExplosivoPKExcel validarTipoArma(String longitud, String calibre, + String clase, String tipoarmaexplosivo, String unidadmedidapeso) { + for (TipoArmaExplosivoPKExcel item : listaTipoArmaExplosivoPk) { + if (longitud.equals(item.getLongitud()) + && calibre.equals(item.getCalibre()) + && clase.equals(item.getClase()) + && tipoarmaexplosivo.equals(item.getTipoarmaexplosivo()) + && unidadmedidapeso.equals(item.getUnidadmedidapeso())) { + return item; + } + } + return null; + } + + public String validarCatalogo(List listCatalogo, String descripcion) { + String codigo = null; + for (TgeneCatalogDetail item : listCatalogo) { + if (item.getDescription().equals(descripcion)) { + codigo = item.getPk().getCatalog(); + break; + } + } + return codigo; + } + + /** + * Metodo que indica cuando una celda esta vacia + * + * @param celda + * @return + */ + private Boolean celdaVacia(Cell celda) { + Boolean vacia = false; + if (celda == null || celda.getCellType() == Cell.CELL_TYPE_BLANK + || (celda.getCellType() == Cell.CELL_TYPE_STRING && celda.getStringCellValue().isEmpty())) { + vacia = true; + } + return vacia; + } + + @SuppressWarnings("finally") + private File generarArchivoError(Long key) { + if (listaErrores.isEmpty()) { + return null; + } + PrintWriter escribir = null; + File archivo = null; + try { + archivo = File.createTempFile("errorlog" + key, ".txt"); + escribir = new PrintWriter(archivo); + for (String err : listaErrores) { + escribir.print(err + "\r\n"); + } + limpiar(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + escribir.flush(); + escribir.close(); + return archivo; + } + } + + /** + * Llama a la construccion del metodo para recargar + */ + public void descargarArchivo() { + if (listaErrores != null && listaErrores.size() > 0) { + Long key = new Date().getTime(); + File archivoTemporal = generarArchivoError(key); + if (archivoTemporal == null) { + return; + } + try { + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition", "attachment; filename=errorlog" + key + ".txt"); + OutputStream out = response.getOutputStream(); + InputStream inputStream = new FileInputStream(archivoTemporal.getAbsolutePath()); + int read = 0; + byte[] bytes = new byte[1024]; + + while ((read = inputStream.read(bytes)) != -1) { + out.write(bytes, 0, read); + } + + inputStream.close(); + out.flush(); + FacesContext.getCurrentInstance().responseComplete(); + } catch (Exception e) { + } + } else { + MessageHelper.setMessageError("NO TIENE ERRORES"); + } + } + + /** + * Limpia las los valores en las listas + */ + public void limpiar() { + try { + create(); + while (lrecord.iterator().hasNext()) { + record = lrecord.get(0); + remove(); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public String getCodigoCiudad() { + return codigoCiudad; + } + + public void setCodigoCiudad(String codigoCiudad) { + this.codigoCiudad = codigoCiudad; + } + + String codigoCiudad; + + public void codigoCiudad() { + } + + public void addPersoncodeFilter(String personcode) { + super.addFilter("pk.personcode", personcode); + } + + public List getListaErrores() { + return listaErrores; + } + + public void setListaErrores(List listaErrores) { + this.listaErrores = listaErrores; + } + + public RegistroArmController getRegistroArmasController() { + return registroArmasController; + } + + public void setRegistroArmasController( + RegistroArmController registroArmasController) { + this.registroArmasController = registroArmasController; + } + + public String getMensajeError() { + return mensajeError; + } + + public void setMensajeError(String mensajeError) { + this.mensajeError = mensajeError; + } + + public Integer getNumArmasProcesadas() { + return numArmasProcesadas; + } + + public void setNumArmasProcesadas(Integer numArmasProcesadas) { + this.numArmasProcesadas = numArmasProcesadas; + } + + public Integer getNumArmasError() { + return numArmasError; + } + + public void setNumArmasError(Integer numArmasError) { + this.numArmasError = numArmasError; + } + + public String getNumeroRecibo() { + return numeroRecibo; + } + + public void setNumeroRecibo(String numeroRecibo) { + this.numeroRecibo = numeroRecibo; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getCentroControlNombreLogeado() { + return centroControlNombreLogeado; + } + + public void setCentroControlNombreLogeado(String centroControlNombreLogeado) { + this.centroControlNombreLogeado = centroControlNombreLogeado; + } + + public DecomisoController getDecomisoController() { + return decomisoController; + } + + public void setDecomisoController(DecomisoController decomisoController) { + this.decomisoController = decomisoController; + } + + public DecomisoArmaController getDecomisoArmaController() { + return decomisoArmaController; + } + + public void setDecomisoArmaController( + DecomisoArmaController decomisoArmaController) { + this.decomisoArmaController = decomisoArmaController; + } + + public Integer getNumCorrectas() { + return numCorrectas; + } + + public void setNumCorrectas(Integer numCorrectas) { + this.numCorrectas = numCorrectas; + } + + public TarmDecomiso getTarmDecomiso() { + return tarmDecomiso; + } + + public void setTarmDecomiso(TarmDecomiso tarmDecomiso) { + this.tarmDecomiso = tarmDecomiso; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ImporteArmasExcelController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ImporteArmasExcelController.java new file mode 100644 index 0000000..cab1fc0 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ImporteArmasExcelController.java @@ -0,0 +1,757 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletResponse; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.jboss.logging.Logger; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.util.ArmasExcel; +import com.fp.frontend.controller.armas.parametros.util.TipoArmaExplosivoPKExcel; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ImporteArmasExcelController extends AbstractController { + + /* CATALOGOS */ + /* TIPO ARMA EXPLOSIVO */ + private List listLongitudes; + private List listCalibres; + private List listClases; + private List listTipoArmaExplosivos; + /* ADICONAL */ + private List listMarcas; + private List listTipoFabricacion; + + /** + * Variable para a;adir las armas que se van a Guardar + */ + private List listArmas; + /** + * registro del Arma Due;o de las armas + */ + private TarmRegistroArmas registroArma; + /** + * Variable para listar los errores al cargar el excel + */ + private List listaErrores; + /** + * Mensaje de error + */ + private String mensajeError; + /** + * numero de armas procesadas + */ + private Integer numArmasProcesadas; + /** + * numero de armas con error + */ + private Integer numArmasError; + /** + * numero de armas con error + */ + private Integer numCorrectas; +// /** +// * Centro de control Policoa Judicia 2/PN07 +// */ +// private TarmCentroControl centroControl; + + /** + * Detalle del usuario + */ + private TcustPersonDetail usuario; + + /** + * Nombre del centro de control logeado + */ + private String centroControlNombreLogeado; + /** + * Numero de registro + */ + private String numeroRecibo; + +// /*Constante centro control*/ +// private String nombreInstitucion; +// private String institucion; + /*Cedula del propietario*/ + private String cedulaPropietario; + /*cantidad de armas*/ + private Integer cantidad = 1; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmasController; + + private Map mapaProvincia; + private Map mapaCanton; + private Set listaTipoArmaExplosivoPk; + + private final static Logger LOG = Logger.getLogger(ImporteArmasExcelController.class.getName()); + + public ImporteArmasExcelController() throws Exception { + super(TarmArmas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.record = new TarmArmas(); + this.beanalias = "ARMASIMPORTEEXCEL"; + listArmas = new ArrayList(); + registroArma = new TarmRegistroArmas(); + mapaProvincia = new HashMap(); + mapaCanton = new HashMap(); + listaTipoArmaExplosivoPk = new HashSet<>(); + cargaParametros(); + cargaCatalogos(); + cargaRegistroArma(); + cargaUsuarioLogeado(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void cargaParametros() { +// nombreInstitucion=codigos("CODIGO.NOM.INSTIT.IMPORTE");//"PJ01" +// institucion=codigos("CODIGO.INSTITUCION.IMPORTE");//2 + /*Cedula del propietario*/ + cedulaPropietario = codigos("CEDULA.RUC.PROPIETARIO.ARMA");//"999999999"; + } + + /** + * Método para obtener los codigos + */ + private String codigos(String parametro) { + TgeneParameters tgeneParameters = ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + public void cargaCatalogos() { + /* TIPOARMAEXPLOSIVO */ + listLongitudes = CatalogDetailController.find("LONGITUD"); + listCalibres = CatalogDetailController.find("CALIBRE"); + listClases = CatalogDetailController.find("CLASE"); + listTipoArmaExplosivos = CatalogDetailController.find("TIPOARMAEXPLOSIVO"); + /* CATALOGO AD */ + listMarcas = CatalogDetailController.find("MARCA"); + listTipoFabricacion = CatalogDetailController.find("TIPOFABRICACION"); + //listColor = CatalogDetailController.find("COLOR"); + } + + public void cargaUsuarioLogeado() { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + centroControlNombreLogeado = tsafeUserDetail.getModifiedData().get("centrocontrol").toString(); + } + + public void cargaRegistroArma() { + TcustPersonDetail tcustPersonDetail = PersonDetailController.findByIdentification(cedulaPropietario); + registroArma.setPersoncode(tcustPersonDetail.getPk().getPersoncode()); + registroArma.setFcreacion(new java.sql.Date(new Date().getTime())); + registroArma.setTiporegistro("INCA"); + registroArma.setTiporegistrocodigo("TIPOREGISTRO"); + registroArma.setPaisorigen(""); + registroArma.setIsnew(true); + +// ListlistCentroControls= CentroControlArmasController.findxOrganismoUnidad(institucion,nombreInstitucion); +// if(listCentroControls!=null && listCentroControls.size()==1){ +// centroControl=listCentroControls.get(0); +// }else{ +// centroControl=null; +// mensajeError="NO TIENE REGISTRADO UN CENTRO DE CONTROL O TIENE REGISTRADO MAS DE UNO CON EL MISMO NOMBRE DE INSTITUCI\u00d3N Y NOMBRE INSTITUCI\u00d3N"; +// } + } + + /* + * (non-Javadoc) + * + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + + DtoQuery dto = super.getDtoQuery(true); + Filter filtrofecha = new Filter(); + filtrofecha + .setSql("t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) and t.estado !='DEST' and t.estado !='CDP'"); + dto.addFiltro(filtrofecha); + dto.setOrderby("pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { +// if(centroControl==null){ +// MessageHelper.setMessageError("NO TIENE CENTRO DE CONTROL REVISE EL CENTRO DE CONTROL"); +// return; +// } + if (listArmas == null || listArmas.size() == 0 || listArmas.isEmpty()) { + MessageHelper.setMessageError("NO EXISTEN ARMAS CARGADAS "); + return; + } + HashMap msave = new HashMap(); + Request request = this.callerhelper.getRequest(); + // regstroArma + registroArmasController.clearAll(); + registroArmasController.setRecord(registroArma); + registroArmasController.update(); + DtoSave dtosaveregistroarma = registroArmasController.getDtoSave(true); + dtosaveregistroarma.setPosition(1); + msave.put(registroArmasController.getBeanalias(), dtosaveregistroarma); + + // cargar Armas + this.clearAll(); + cargarArmas(); + DtoSave dtosave = super.getDtoSave(true); + dtosave.setPosition(2); + msave.put(this.beanalias, dtosave); + + request.setSaveTables(msave); + + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + mensajeError = null; + MessageHelper.setMessageInfo(resp); + listArmas.clear(); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + public void cargarArmas() throws Exception { + for (TarmArmas item : listArmas) { + item.setEstadoDecomiso(numeroRecibo); + this.record = item; + record.setIsnew(true); + super.update(); + } + } + + /** + * Metodo que carga y valida el contenido de un archivo excel con + * información de armas + * + * @param event + */ + public void cargarArchivo(FileUploadEvent event) { + listArmas = new ArrayList(); + listaErrores = new ArrayList(); + int contador = 0; + try { + UploadedFile selectedFile = event.getFile(); + InputStream archivo = selectedFile.getInputstream(); + XSSFWorkbook libro = new XSSFWorkbook(archivo); + XSSFSheet hoja = libro.getSheetAt(0); + // Iterando sobre las filas + Iterator rowIterator = hoja.iterator(); + List listaArmasExcel = new ArrayList(); + // Cargando el contenido de las celdas a una lista de objetos + while (rowIterator.hasNext()) { + Row row = rowIterator.next(); + if (contador != 0) { + Cell orden = row.getCell(0); + Cell longuitud = row.getCell(14); + Cell calibre = row.getCell(5); + Cell clase = row.getCell(1);//material + Cell tipoArmaExplosivo = row.getCell(2);// modelo: REVOLVER CARTUCHERA CARTUCHERANO CARABINA SUB-AMETRALLADORA*revisar + Cell marca = row.getCell(3); + Cell tipoFabricacion = row.getCell(7); + Cell serie = row.getCell(4); + Cell fechaRecepcion = row.getCell(9); + Cell motivo = row.getCell(10); + Cell descripcionProvincia = row.getCell(12); + Cell descripcionCanton = row.getCell(13); + Cell observaciones = row.getCell(15); + if (!this.celdaVacia(orden) + && !this.celdaVacia(longuitud) + && !this.celdaVacia(calibre) + && !this.celdaVacia(clase) + && !this.celdaVacia(tipoArmaExplosivo) + && !this.celdaVacia(marca) + && !this.celdaVacia(tipoFabricacion) + && !this.celdaVacia(serie) + //&& !this.celdaVacia(fechaRecepcion) + // && !this.celdaVacia(motivo) + && !this.celdaVacia(descripcionProvincia) + && !this.celdaVacia(descripcionCanton) //&& !this.celdaVacia(observaciones) + ) { + + ArmasExcel armasExcel = new ArmasExcel(orden.toString().trim(), longuitud.toString().trim(), calibre.toString().trim(), + clase.toString().trim(), tipoArmaExplosivo.toString().trim(), marca.toString().trim(), + tipoFabricacion.toString().trim(), serie.toString().trim(), null, + null, descripcionProvincia.toString().trim(), descripcionCanton.toString().trim(), + null, contador); + listaArmasExcel.add(armasExcel); + LOG.info("CONTADOR........" + contador); + } else { + listaErrores.add("EL REGISTRO TIENE CAMPOS EN BLANCO, REGISTRO: " + contador); + } + contador++; + } else { + contador++; + } + } + archivo.close(); + + LOG.info("NUMERO REGISTROS........." + listaArmasExcel.size()); + LOG.info("Procesar armas adjuntas"); + Map mapaSerie = new HashMap(); + int auxi = 0; + for (ArmasExcel armasExcel : listaArmasExcel) { + LOG.info("CONTADOR 2: " + auxi++); + TarmArmas arma = armarlistaArmasExcel(armasExcel.getLonguitud(), armasExcel.getCalibre(), armasExcel.getClase(), + armasExcel.getTipoArmaExplosivo(), armasExcel.getMarca(), armasExcel.getTipoFabricacion(), + armasExcel.getCont(), armasExcel.getSerie(), armasExcel.getDescripcionProvincia(), armasExcel.getDescripcionCanton()); + if (arma != null) { +// arma.getModifiedData().put("motivo", armasExcel.getMotivo()); +// arma.getModifiedData().put("observaciondecomiso", armasExcel.getObservaciones()); + arma.getModifiedData().put("cantidad", cantidad); +// arma.getModifiedData().put("motivocatalogocode","MOTIVODECOMISO"); +// arma.getModifiedData().put("motivocatalogo",motivocatalogo);//entrega voluntaria + //validar si la serie es repetida + if (mapaSerie.get(armasExcel.getSerie()) != null) { + listaErrores.add("SERIE DUPLICADA" + armasExcel.getSerie() + " DEL REGISTRO: " + armasExcel.getCont()); + continue; + } else { + mapaSerie.put(armasExcel.getSerie(), armasExcel.getSerie()); + } + + //ANIADE EL ARMA + listArmas.add(arma); + } + } + LOG.info("ARMAS PROCESADAS 2: " + listArmas.size()); + } catch (Exception e) { + MessageHelper.setMessageError(e); + e.printStackTrace(); + } finally { + numArmasProcesadas = contador - 1; + if (!listaErrores.isEmpty()) { + MessageHelper.setMessageError("ERRORES ENCONTRADOS DENTRO DEL ARCHIVO EXCEL: "); + mensajeError = "ERROR EN LA CARGA DE ARMAS"; + numCorrectas = listArmas.size(); + listArmas.clear(); + } else { + numCorrectas = listArmas.size(); + } + numArmasError = listaErrores.size(); + } + } + + private TarmArmas armarlistaArmasExcel(String longuitud, String calibre, String clase, String tipoArmaExplosivo, String marca, + String tipoFabricacion, int cont, String serie, String descripcionProvincia, String descripcionCanton) { + TarmArmas armaRegistro = null; + String longuitudCodigo = validarCatalogo(listLongitudes, longuitud); + if (longuitudCodigo == null || longuitudCodigo.isEmpty()) { + listaErrores.add("LA DESCRIPCI\u00d3N DE LA LONGUITUD: " + longuitud.toString() + " NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: " + cont); + } + String calibreCodigo = validarCatalogo(listCalibres, calibre); + if (calibreCodigo == null || calibreCodigo.isEmpty()) { + listaErrores.add("LA DESCRIPCI\u00d3N DEL CALIBRE: " + calibre.toString() + " NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: " + cont); + } + String claseCodigo = validarCatalogo(listClases, clase); + if (claseCodigo == null || claseCodigo.isEmpty()) { + listaErrores.add("LA DESCRIPCI\u00d3N DE LA CLASE: " + clase.toString() + " NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: " + cont); + } + String tipoArmaExplosivoCodigo = validarCatalogo(listTipoArmaExplosivos, tipoArmaExplosivo); + if (tipoArmaExplosivoCodigo == null || tipoArmaExplosivoCodigo.isEmpty()) { + listaErrores.add("LA DESCRIPCI\u00d3N DEL TIPO ARMA EXPLOSIVO: " + tipoArmaExplosivo.toString() + " NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: " + cont); + } + String unidadMedidaPesoCodigo = "UNIDAD"; + + String marcaCodigo = validarCatalogo(listMarcas, marca);// MARCA + if (marcaCodigo == null) { + listaErrores.add("LA MARCA DEL ARMA: " + marca.toString() + " NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: " + cont); + } + String tipoFabricacionCodigo = validarCatalogo(listTipoFabricacion, tipoFabricacion);// TIPOFABRICACION + if (tipoFabricacionCodigo == null) { + listaErrores.add("EL TIPO DE FABRICACI\u00d3N: " + tipoFabricacion.toString() + " NO EXISTE EN EL CAT\u00c1LOGO, DEL REGISTRO: " + cont); + } + /*Ubicacion Provincia canton*/ + TgeneProvince province = null; + TgeneCanton canton = null; + //provincia + if (mapaProvincia.get("descripcionProvincia") != null) { + province = (TgeneProvince) mapaProvincia.get(descripcionProvincia); + } else { + List listProvincias = ProvinceController.findxDescripcion("EC", null, descripcionProvincia); + if (listProvincias != null) { + if (listProvincias.size() == 1) { + province = listProvincias.get(0); + mapaProvincia.get("descripcionProvincia"); + } else { + listaErrores.add(" EXISTE MAS DE UNA PROVINCIA: " + descripcionProvincia.toString() + " CON ESTA DESCRIPCI\u00d3N, DEL REGISTRO: " + cont); + return null; + } + } else { + listaErrores.add(" NO EXISTE LA PROVINCIA: " + descripcionProvincia.toString() + " EN EL CAT\u00c1LOGO, DEL REGISTRO: " + cont); + return null; + } + } + //canton + if (mapaCanton.get(descripcionProvincia) != null && province != null && province.getPk() != null) { + canton = (TgeneCanton) mapaCanton.get(descripcionProvincia); + } else if (province != null && province.getPk() != null) { + List listCantons = CantonController.find("EC", province.getPk().getProvincecode()); + if (listCantons != null && listCantons.size() != 0) { + for (TgeneCanton item : listCantons) { + if (item.getDescription().trim().equals(descripcionCanton)) { + canton = item; + mapaCanton.put(descripcionProvincia, item); + break; + } + } + if (canton == null) { + listaErrores.add(" NO EXISTEN CANTONES ASOCIADOS CON LA PROVINCIA: " + descripcionProvincia.toString() + ", DEL REGISTRO: " + cont); + return null; + } + } else { + listaErrores.add(" NO EXISTEN CANTONES ASOCIADOS CON LA PROVINCIA: " + descripcionProvincia.toString() + ", DEL REGISTRO: " + cont); + return null; + } + } + + if (marcaCodigo == null || tipoFabricacionCodigo == null || province == null || canton == null) { + return null; + } + + if (longuitudCodigo != null && calibreCodigo != null && claseCodigo != null && tipoArmaExplosivoCodigo != null) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = null; + TipoArmaExplosivoPKExcel tipoArmaPk = validarTipoArma(longuitudCodigo, calibreCodigo, claseCodigo, tipoArmaExplosivoCodigo, unidadMedidaPesoCodigo); + if (tipoArmaPk != null) { + tarmTipoArmaExplosivo = tipoArmaPk.getTipoArmaExplosivoClase(); + } else { + tarmTipoArmaExplosivo = ImporteTipoArmaExplosivoController.findpk(longuitudCodigo, calibreCodigo, claseCodigo, tipoArmaExplosivoCodigo, unidadMedidaPesoCodigo); + if (tarmTipoArmaExplosivo != null) { + tipoArmaPk = new TipoArmaExplosivoPKExcel(longuitudCodigo, calibreCodigo, claseCodigo, tipoArmaExplosivoCodigo, unidadMedidaPesoCodigo, tarmTipoArmaExplosivo); + listaTipoArmaExplosivoPk.add(tipoArmaPk); + } + } + if (tarmTipoArmaExplosivo != null) { + armaRegistro = new TarmArmas(); + armaRegistro.setMarca(marcaCodigo); + armaRegistro.setMarcacodigo("MARCA"); + armaRegistro.setTipofabricacion(tipoFabricacionCodigo); + armaRegistro.setTipofabricacioncodigo("TIPOFABRICACION"); + //armaRegistro.setColor(colorCodigo); + armaRegistro.setColorcodigo("COLOR"); + armaRegistro.setUnidadmedidacantidad("UNIDAD"); + armaRegistro.setUnidadmedidacantidadcodigo("UNIDADMEDIDA"); + armaRegistro.setEstado("REG"); + armaRegistro.setEstadocodigo("ESTADOARMA"); + armaRegistro.setCountrycode("EC"); + armaRegistro.setProvincecode(province.getPk().getProvincecode()); + armaRegistro.setCantoncode(canton.getPk().getCantoncode()); + //armaRegistro.setParroquiacode(""); + // armaRegistro.setCregistro(); + armaRegistro.setCitycode(""); + armaRegistro.setLote(serie); + armaRegistro.setCantidad(cantidad); + // armaRegistro.setSeriecanon(); + // armaRegistro.setDireccion(); + armaRegistro.setFecharegistro(new java.sql.Date(new Date().getTime())); + armaRegistro.setCtipoarmaexplosivo(tarmTipoArmaExplosivo.getPk()); + //armaRegistro.setEstadoDecomiso("INC"); + } else { + listaErrores.add("LA COMBINACION DEL ARMA NO EXISTE EN EL REGISTRO: " + cont + " "); + } + } + return armaRegistro; + } + + private TipoArmaExplosivoPKExcel validarTipoArma(String longitud, String calibre, + String clase, String tipoarmaexplosivo, String unidadmedidapeso) { + for (TipoArmaExplosivoPKExcel item : listaTipoArmaExplosivoPk) { + if (longitud.equals(item.getLongitud()) + && calibre.equals(item.getCalibre()) + && clase.equals(item.getClase()) + && tipoarmaexplosivo.equals(item.getTipoarmaexplosivo()) + && unidadmedidapeso.equals(item.getUnidadmedidapeso())) { + return item; + } + } + return null; + } + + public String validarCatalogo(List listCatalogo, String descripcion) { + String codigo = null; + for (TgeneCatalogDetail item : listCatalogo) { + if (item.getDescription().equals(descripcion)) { + codigo = item.getPk().getCatalog(); + break; + } + } + return codigo; + } + + /** + * Metodo que indica cuando una celda esta vacia + * + * @param celda + * @return + */ + private Boolean celdaVacia(Cell celda) { + Boolean vacia = false; + if (celda == null || celda.getCellType() == Cell.CELL_TYPE_BLANK + || (celda.getCellType() == Cell.CELL_TYPE_STRING && celda.getStringCellValue().isEmpty())) { + vacia = true; + } + return vacia; + } + + @SuppressWarnings("finally") + private File generarArchivoError(Long key) { + if (listaErrores.isEmpty()) { + return null; + } + PrintWriter escribir = null; + File archivo = null; + try { + archivo = File.createTempFile("errorlog" + key, ".txt"); + escribir = new PrintWriter(archivo); + for (String err : listaErrores) { + escribir.print(err + "\r\n"); + } + limpiar(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + escribir.flush(); + escribir.close(); + return archivo; + } + } + + /** + * Llama a la construccion del metodo para recargar + */ + public void descargarArchivo() { + if (listaErrores != null && listaErrores.size() > 0) { + Long key = new Date().getTime(); + File archivoTemporal = generarArchivoError(key); + if (archivoTemporal == null) { + return; + } + try { + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition", "attachment; filename=errorlog" + key + ".txt"); + OutputStream out = response.getOutputStream(); + InputStream inputStream = new FileInputStream(archivoTemporal.getAbsolutePath()); + int read = 0; + byte[] bytes = new byte[1024]; + + while ((read = inputStream.read(bytes)) != -1) { + out.write(bytes, 0, read); + } + + inputStream.close(); + out.flush(); + FacesContext.getCurrentInstance().responseComplete(); + } catch (Exception e) { + } + } else { + MessageHelper.setMessageError("NO TIENE ERRORES"); + } + } + + /** + * Limpia las los valores en las listas + */ + public void limpiar() { + try { + create(); + while (lrecord.iterator().hasNext()) { + record = lrecord.get(0); + remove(); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public String getCodigoCiudad() { + return codigoCiudad; + } + + public void setCodigoCiudad(String codigoCiudad) { + this.codigoCiudad = codigoCiudad; + } + + String codigoCiudad; + + public void codigoCiudad() { + } + + public void addPersoncodeFilter(String personcode) { + super.addFilter("pk.personcode", personcode); + } + + public List getListaErrores() { + return listaErrores; + } + + public void setListaErrores(List listaErrores) { + this.listaErrores = listaErrores; + } + + public RegistroArmController getRegistroArmasController() { + return registroArmasController; + } + + public void setRegistroArmasController( + RegistroArmController registroArmasController) { + this.registroArmasController = registroArmasController; + } + + public String getMensajeError() { + return mensajeError; + } + + public void setMensajeError(String mensajeError) { + this.mensajeError = mensajeError; + } + + public Integer getNumArmasProcesadas() { + return numArmasProcesadas; + } + + public void setNumArmasProcesadas(Integer numArmasProcesadas) { + this.numArmasProcesadas = numArmasProcesadas; + } + + public Integer getNumArmasError() { + return numArmasError; + } + + public void setNumArmasError(Integer numArmasError) { + this.numArmasError = numArmasError; + } + + public String getNumeroRecibo() { + return numeroRecibo; + } + + public void setNumeroRecibo(String numeroRecibo) { + this.numeroRecibo = numeroRecibo; + } + +// public TarmCentroControl getCentroControl() { +// return centroControl; +// } +// +// public void setCentroControl(TarmCentroControl centroControl) { +// this.centroControl = centroControl; +// } + public String getCentroControlNombreLogeado() { + return centroControlNombreLogeado; + } + + public void setCentroControlNombreLogeado(String centroControlNombreLogeado) { + this.centroControlNombreLogeado = centroControlNombreLogeado; + } + + public Integer getNumCorrectas() { + return numCorrectas; + } + + public void setNumCorrectas(Integer numCorrectas) { + this.numCorrectas = numCorrectas; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ImporteTipoArmaExplosivoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ImporteTipoArmaExplosivoController.java new file mode 100644 index 0000000..4ea6235 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/ImporteTipoArmaExplosivoController.java @@ -0,0 +1,109 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ImporteTipoArmaExplosivoController extends + AbstractController { + + public ImporteTipoArmaExplosivoController() throws Exception { + super(TarmTipoArmaExplosivo.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "IMPORTETIPOARMAEXPLOSIVO"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Find para encontrar el pk mediante las caracteristicas. + */ + public static TarmTipoArmaExplosivo findpk(String longitud, String calibre, + String clase, String tipoarmaexplosivo, String unidadmedidapeso) { + try { + ImporteTipoArmaExplosivoController cc = new ImporteTipoArmaExplosivoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("longitud", longitud); + cc.addFilter("calibre", calibre); + cc.addFilter("clase", clase); + cc.addFilter("tipoarmaexplosivo", tipoarmaexplosivo); + cc.addFilter("unidadmedidapeso", unidadmedidapeso); + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/IngresoDatosTipoTramite.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/IngresoDatosTipoTramite.java new file mode 100644 index 0000000..79e7241 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/IngresoDatosTipoTramite.java @@ -0,0 +1,896 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class IngresoDatosTipoTramite extends AbstractController { + + /** + * Variable auxiliar para bloquerar los campos al crear o editar + */ + private String editarReg; + /** + * Variables de tipo boolean para selecionar si registroGuardia + */ + private boolean registroGuardia; + /** + * Variables de tipo boolean para selecionar si tiene logo + */ + private boolean logo; + /** + * Variables de tipo boolean para selecionar si registroArmas + */ + private boolean registroArmas; + /** + * Variables de tipo boolean para selecionar si registroAgenciasSucursales + */ + private boolean registroAgenciasSucursales; + /** + * Variables de tipo boolean para selecionar si requiereEvaluacion + */ + private boolean requiereEvaluacion; + /** + * Variables de tipo boolean para selecionar si requiereInspeccion + */ + private boolean requiereInspeccion; + /** + * Variables de tipo boolean para selecionar documentosHabilitantes + */ + private boolean documentosHabilitantes; + /** + * Variables de tipo boolean para selecionar reimpresion + */ + private boolean reimpresion; + /** + * Variables de tipo boolean para selecionar si la transaccion es + * sancionable + */ + private boolean sancionable; + /** + * Valida caducidad tramite padre + */ + private boolean caducidadTramitePadreBln; + /** + * Valida caducidad tramite padre alterno + */ + private boolean caducidadTramitePadreAltBln; + /** + * Valida si visualiza la fecha de expiracion + */ + private boolean visualizaFechaExpiracionBln; + /** + * Variables de tipo boolean para selecionar si requiereJurisdiccion + */ + private boolean requiereJurisdiccion; + /** + * Catalogo de tipos de tramites + */ + private List ltipoTramite; + /** + * Catalogo de Autorizacion + */ + private List ltipoAutorizacion; + /** + * Catalogo de categoria + */ + private List lcategoria; + /** + * Catalogo de tipos de Uso actividad + */ + private List lusoActividad; + /** + * Catalogo de tipos de Costo + */ + private List ltipoCosto; + /** + * Catalogo de Vigencia de meses + */ + private List lvigenciaMeses; + /** + * Catalogo de tipos de archivo + */ + private List ltipoArchivo; + /** + * Catalogo de tipos de caminos para el flujo + */ + private List lflujoTramite; + /** + * Catalogo de tipos de archivo + */ + private List lestadosarma; + /** + * Catalogo de tipos de fabricacion + */ + private List ltipofabricacionarma; + /** + * Catalogo de tipos de archivo + */ + private List ltipoPersona; + /** + * Catalogo de tipos de archivo + */ + private List ljurisdiccion; + /** + * Arreglo de los estados seleccionados + */ + private String[] selectedEstados; + /** + * Arreglo de los tipos de fabricacion seleccionados + */ + private String[] selectedTipoFabric; + + private String descripcionTrmitePadre; + + private String descripcionTrmitePadreAlt; + + public IngresoDatosTipoTramite() throws Exception { + super(TarmTramite.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TRAMITE"; + //CARGA DE CATALOGOS + ltipoTramite = CatalogDetailController.find("TIPOTRAMITE"); + ltipoAutorizacion = CatalogDetailController.find("TIPOAUTORIZACION"); + lcategoria = CatalogDetailController.find("CATEGORIA"); + lusoActividad = CatalogDetailController.find("USOACTIVIDAD"); + ltipoCosto = CatalogDetailController.find("TIPOCOSTO"); + lvigenciaMeses = CatalogDetailController.find("VIGENCIAMESES"); + //ordena la lista lvigenciaMeses + Collections.sort(lvigenciaMeses, new Comparator() { + public int compare(TgeneCatalogDetail p1, TgeneCatalogDetail p2) { + return new Integer(p1.getDescription()).compareTo(new Integer(p2.getDescription())); + } + }); + + ltipoArchivo = CatalogDetailController.find("TIPOARCHIVO"); + lflujoTramite = CatalogDetailController.find("FLUJOTRAMITE"); + lestadosarma = CatalogDetailController.find("ESTADOARMA"); + setLtipofabricacionarma(CatalogDetailController.find("TIPOFABRICACION")); + ltipoPersona = CatalogDetailController.find("PERSONTYPE"); + ljurisdiccion = CatalogDetailController.find("JURISDICCION"); + Collections.swap(ljurisdiccion, 0, 2); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + SubQuery stipoTramite = new SubQuery("TgeneCatalogDetail", "description", "destipoTramite", "i.pk.catalog = t.tipotramite and i.pk.catalogcode=t.tipotramitecodigo"); + SubQuery stipoAutorizacion = new SubQuery("TgeneCatalogDetail", "description", "destipoAutorizacion", "i.pk.catalog = t.tipoautorizacion and i.pk.catalogcode=t.tipoautorizacioncodigo"); + SubQuery scategoria = new SubQuery("TgeneCatalogDetail", "description", "descategoria", "i.pk.catalog = t.categoria and i.pk.catalogcode=t.categoriacodigo"); + SubQuery susoactividad = new SubQuery("TgeneCatalogDetail", "description", "desusoactividad", "i.pk.catalog = t.usoactividad and i.pk.catalogcode=t.usoactividadcodigo"); + SubQuery stipocosto = new SubQuery("TgeneCatalogDetail", "description", "destipocosto", "i.pk.catalog = t.tipocosto and i.pk.catalogcode=t.tipocostocodigo"); + SubQuery svigencia = new SubQuery("TgeneCatalogDetail", "description", "desvigencia", "i.pk.catalog = t.vigencia and i.pk.catalogcode=t.vigenciacodigo"); + SubQuery stipoarchivo = new SubQuery("TgeneCatalogDetail", "description", "destipoarchivo", "i.pk.catalog = t.tipoarchivo and i.pk.catalogcode=t.tipoarchivocodigo"); + SubQuery sjurisdiccion = new SubQuery("TgeneCatalogDetail", "description", "desjurisdiccion", "i.pk.catalog = t.jurisdiccion and i.pk.catalogcode=t.jurisdiccioncode"); + dto.addSubQuery(stipoTramite); + dto.addSubQuery(stipoAutorizacion); + dto.addSubQuery(scategoria); + dto.addSubQuery(susoactividad); + dto.addSubQuery(stipocosto); + dto.addSubQuery(svigencia); + dto.addSubQuery(stipoarchivo); + dto.addSubQuery(sjurisdiccion); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + if (!dtosave.pendingProcess()) { + return; + } + + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para cargar las variables para editar + */ + public void loadEdit() { + System.out.println("cargar"); + editarReg = "SI"; + registroGuardia = ((record.getRegistroguardia() != null) && record.getRegistroguardia().equals("Y") ? true : false); + registroArmas = ((record.getRegistroarmas() != null) && record.getRegistroarmas().equals("Y") ? true : false); + registroAgenciasSucursales = ((record.getRegistroagenciasucursal() != null) && record.getRegistroagenciasucursal().equals("Y") ? true : false); + requiereEvaluacion = ((record.getRequiereevaluacion() != null) && record.getRequiereevaluacion().equals("Y") ? true : false); + requiereInspeccion = ((record.getRequiereinspeccion() != null) && record.getRequiereinspeccion().equals("Y") ? true : false); + documentosHabilitantes = ((record.getDocumentohabilitante() != null) && record.getDocumentohabilitante().equals("Y") ? true : false); + reimpresion = ((record.getReimpresion() != null) && record.getReimpresion().equals("Y") ? true : false); + logo = ((record.getLogo() != null) && record.getLogo().equals("Y") ? true : false); + sancionable = ((record.getSancionable() != null) && record.getSancionable().equals("Y") ? true : false); + caducidadTramitePadreBln = ((record.getValidacaducidadpadre() != null) && record.getValidacaducidadpadre().equals("Y") ? true : false); + caducidadTramitePadreAltBln = ((record.getValidacaducidadpadrealt() != null) && record.getValidacaducidadpadrealt().equals("Y") ? true : false); + visualizaFechaExpiracionBln = ((record.getValidaFechaExpiracion() != null) && record.getValidaFechaExpiracion().equals("Y") ? true : false); + requiereJurisdiccion = ((record.getTipoautorizacion() != null) && record.getTipoautorizacion().equals("6") ? true : false); + + if (record.getEstados() != null) { + selectedEstados = record.getEstados().split(","); + } else { + selectedEstados = null; + } + + if (record.getTipofabricacion() != null) { + selectedTipoFabric = record.getTipofabricacion().split(","); + + } else { + selectedTipoFabric = null; + } + + if (record.getCtramitepadre() != null) { + TarmTramite tarmTramite = find(record.getCtramitepadre().toString()); + descripcionTrmitePadre = tarmTramite.getPk().toString() + ": " + tarmTramite.getModifiedData().get("destipoTramite") + " " + + tarmTramite.getModifiedData().get("destipoAutorizacion") + " " + tarmTramite.getModifiedData().get("descategoria") + " " + + tarmTramite.getModifiedData().get("desusoactividad"); + } else { + descripcionTrmitePadre = null; + } + if (record.getCtramitepadrealt() != null) { + TarmTramite tarmTramite = find(record.getCtramitepadrealt().toString()); + descripcionTrmitePadreAlt = tarmTramite.getPk().toString() + ": " + tarmTramite.getModifiedData().get("destipoTramite") + " " + + tarmTramite.getModifiedData().get("destipoAutorizacion") + " " + tarmTramite.getModifiedData().get("descategoria") + " " + + tarmTramite.getModifiedData().get("desusoactividad"); + } else { + descripcionTrmitePadreAlt = null; + } + } + + @Override + public void create() throws Exception { + System.out.println("create"); + editarReg = null; + + super.create(); + registroGuardia = Boolean.FALSE; + registroArmas = Boolean.FALSE; + registroAgenciasSucursales = Boolean.FALSE; + requiereEvaluacion = Boolean.FALSE; + requiereInspeccion = Boolean.FALSE; + documentosHabilitantes = Boolean.FALSE; + reimpresion = Boolean.FALSE; + logo = Boolean.FALSE; + sancionable = Boolean.FALSE; + selectedEstados = null; + setSelectedTipoFabric(null); + descripcionTrmitePadre = null; + descripcionTrmitePadreAlt = null; + caducidadTramitePadreBln = Boolean.FALSE; + caducidadTramitePadreAltBln = Boolean.FALSE; + visualizaFechaExpiracionBln = Boolean.TRUE; + requiereJurisdiccion = Boolean.FALSE; + + } + + @Override + public void update() throws Exception { + this.record.setTipotramitecodigo("TIPOTRAMITE"); + this.record.setTipoautorizacioncodigo("TIPOAUTORIZACION"); + this.record.setCategoriacodigo("CATEGORIA"); + this.record.setUsoactividadcodigo("USOACTIVIDAD"); + this.record.setTipocostocodigo("TIPOCOSTO"); + this.record.setVigenciacodigo("VIGENCIAMESES"); + this.record.setTipoarchivocodigo("TIPOARCHIVO"); + this.record.setFlujotramitecode("FLUJOTRAMITE"); + this.record.setTipopersonacode("PERSONTYPE"); + this.record.setJurisdiccioncode("JURISDICCION"); + + //validaciones para la vista + if (editarReg == null || !editarReg.equals("SI")) { + catalogos(ltipoTramite, record.getTipotramite(), "destipoTramite"); + catalogos(ltipoAutorizacion, record.getTipoautorizacion(), "destipoAutorizacion"); + catalogos(lcategoria, record.getCategoria(), "descategoria"); + catalogos(lusoActividad, record.getUsoactividad(), "desusoactividad"); + } + catalogos(ltipoCosto, record.getTipocosto(), "destipocosto"); + catalogos(lvigenciaMeses, record.getVigencia(), "desvigencia"); + catalogos(ltipoArchivo, record.getTipoarchivo(), "destipoarchivo"); + if (record.getJurisdiccion() == null || record.getJurisdiccion().equals("")) { + record.setJurisdiccion("JURECU"); + } + + catalogos(ljurisdiccion, record.getJurisdiccion(), "desjurisdiccion"); + + onChangeRegistroArmas(); + onChangeRegistroGuardia(); + onChangeRegistroAgenciaSucursal(); + onChangeRequiereEvaluacion(); + onChangeRequiereInspeccion(); + onChangeDocumentosHabilitantes(); + onChangeReimpresion(); + onChangeLogo(); + onChangeSancionable(); + onChangeCaducidadTramPadre(); + onChangeCaducidadTramPadreAlt(); + + //recorre la lsita de estado + this.record.setEstados(null); + for (String estado : selectedEstados) { + if (this.record.getEstados() == null || this.record.getEstados().trim().length() == 0) { + this.record.setEstados(estado); + } + this.record.setEstados(record.getEstados() + "," + estado); + } + //recorre la lsita de tipoFabricacion + this.record.setTipofabricacion(null); + for (String tipoFac : selectedTipoFabric) { + if (this.record.getTipofabricacion() == null || this.record.getTipofabricacion().trim().length() == 0) { + this.record.setTipofabricacion(tipoFac); + } + this.record.setTipofabricacion(record.getTipofabricacion() + "," + tipoFac); + } + + if (record.getNumeromaxarmas() != null && record.getNumeromaxarmas() == 0l) { + record.setNumeromaxarmas(null); + } + super.update(); + } + + /** + * Metodo para recorreer los combos y setear las descripciones de lo q se + * escoge para la vista + * + * @param list + * @param codigo + * @param pk + */ + public void catalogos(List list, String codigo, String pk) { + for (TgeneCatalogDetail item : list) { + if (codigo.equals(item.getPk().getCatalog())) { + record.modifiedData.put(pk, item.getDescription()); + break; + } + } + } + + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeRegistroArmas() { + if (registroArmas) { + record.setRegistroarmas("Y"); + } else { + record.setRegistroarmas("N"); + } + } + + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeRegistroGuardia() { + if (registroGuardia) { + record.setRegistroguardia("Y"); + } else { + record.setRegistroguardia("N"); + } + } + + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeRegistroAgenciaSucursal() { + if (registroAgenciasSucursales) { + record.setRegistroagenciasucursal("Y"); + } else { + record.setRegistroagenciasucursal("N"); + } + } + + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeRequiereEvaluacion() { + if (requiereEvaluacion) { + record.setRequiereevaluacion("Y"); + } else { + record.setRequiereevaluacion("N"); + } + } + + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeRequiereInspeccion() { + if (requiereInspeccion) { + record.setRequiereinspeccion("Y"); + } else { + record.setRequiereinspeccion("N"); + } + } + + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeDocumentosHabilitantes() { + if (documentosHabilitantes) { + record.setDocumentohabilitante("Y"); + } else { + record.setDocumentohabilitante("N"); + } + } + + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeReimpresion() { + if (reimpresion) { + record.setReimpresion("Y"); + } else { + record.setReimpresion("N"); + } + } + + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeLogo() { + if (logo) { + record.setLogo("Y"); + } else { + record.setLogo("N"); + } + } + + /** + * Método para manejar el evento change en el CheckBox sancionable + */ + public void onChangeCaducidadTramPadre() { + if (caducidadTramitePadreBln) { + record.setValidacaducidadpadre("Y"); + } else { + record.setValidacaducidadpadre("N"); + } + } + + public void onChangeCaducidadTramPadreAlt() { + if (caducidadTramitePadreAltBln) { + record.setValidacaducidadpadrealt("Y"); + } else { + record.setValidacaducidadpadrealt("N"); + } + } + + public void onChangeVisualizaFechaExpiracion() { + if (visualizaFechaExpiracionBln) { + record.setValidaFechaExpiracion("Y"); + record.setVisualizarPorFechaExpiracion(""); + } else { + record.setValidaFechaExpiracion("N"); + if (record.getVisualizarPorFechaExpiracion() == null || record.getVisualizarPorFechaExpiracion().isEmpty()) { + record.setVisualizarPorFechaExpiracion("AL CANJEAR ARMA"); + } + + } + } + + /** + * Método para manejar el evento change en el CheckBox sancionable + */ + public void onChangeSancionable() { + if (sancionable) { + record.setSancionable("Y"); + } else { + record.setSancionable("N"); + } + } + + /** + * Método para manejar el render en el ComboBox jurisdiccion + */ + public void onChangeJurisdiccion() { + requiereJurisdiccion = ((record.getTipoautorizacion() != null) && record.getTipoautorizacion().equals("6") ? true : false); + } + + public static TarmTramite find(String ctramite) { + try { + IngresoDatosTipoTramite cc = new IngresoDatosTipoTramite(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", ctramite); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List find(String tipoTramite, String tipoAutorizacion, String categria, String usoActividad) { + try { + IngresoDatosTipoTramite cc = new IngresoDatosTipoTramite(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("tipotramite", tipoTramite); + cc.addFilter("tipoautorizacion", tipoTramite); + cc.addFilter("categoria", tipoTramite); + cc.addFilter("usoActividad", tipoTramite); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Abre el LOV de la clase del arma + */ + public void openArmaTramiteLov() { + Map> params = new HashMap<>(); + List pa = new ArrayList<>(); + if (record.getPk() != null) { + pa.add(record.getPk().toString()); + } + params.put("ctramitepadre", pa); + BuscarTramiteLovController.openLov(params); + } + + /** + * Regresa del LOV de tramite + * + * @param event + */ + public void onReturnTramite(SelectEvent event) { + TarmTramite tarmTramite = (TarmTramite) event.getObject(); + record.setCtramitepadre(tarmTramite.getPk()); + descripcionTrmitePadre = tarmTramite.getPk().toString() + ": " + tarmTramite.getModifiedData().get("destipoTramite") + " " + + tarmTramite.getModifiedData().get("destipoAutorizacion") + " " + tarmTramite.getModifiedData().get("descategoria") + " " + + tarmTramite.getModifiedData().get("desusoactividad"); + } + + /** + * Regresa del LOV de tramiteAlt + * + * @param event + */ + public void onReturnTramiteAlt(SelectEvent event) { + TarmTramite tarmTramite = (TarmTramite) event.getObject(); + record.setCtramitepadrealt(tarmTramite.getPk()); + descripcionTrmitePadreAlt = tarmTramite.getPk().toString() + ": " + tarmTramite.getModifiedData().get("destipoTramite") + " " + + tarmTramite.getModifiedData().get("destipoAutorizacion") + " " + tarmTramite.getModifiedData().get("descategoria") + " " + + tarmTramite.getModifiedData().get("desusoactividad"); + } + + /** + * Limpia el tramite padre + * + * @param event + */ + public void eliminarTramitePadre() { + record.setCtramitepadre(null); + descripcionTrmitePadre = null; + } + + /** + * Limpia el tramite padre alterno + * + * @param event + */ + public void eliminarTramitePadreAlt() { + record.setCtramitepadrealt(null); + descripcionTrmitePadreAlt = null; + } + + public boolean isRegistroGuardia() { + return registroGuardia; + } + + public void setRegistroGuardia(boolean registroGuardia) { + this.registroGuardia = registroGuardia; + } + + public boolean isRegistroArmas() { + return registroArmas; + } + + public void setRegistroArmas(boolean registroArmas) { + this.registroArmas = registroArmas; + } + + public boolean isRegistroAgenciasSucursales() { + return registroAgenciasSucursales; + } + + public void setRegistroAgenciasSucursales(boolean registroAgenciasSucursales) { + this.registroAgenciasSucursales = registroAgenciasSucursales; + } + + public boolean isRequiereEvaluacion() { + return requiereEvaluacion; + } + + public void setRequiereEvaluacion(boolean requiereEvaluacion) { + this.requiereEvaluacion = requiereEvaluacion; + } + + public boolean isRequiereInspeccion() { + return requiereInspeccion; + } + + public void setRequiereInspeccion(boolean requiereInspeccion) { + this.requiereInspeccion = requiereInspeccion; + } + + public boolean isDocumentosHabilitantes() { + return documentosHabilitantes; + } + + public void setDocumentosHabilitantes(boolean documentosHabilitantes) { + this.documentosHabilitantes = documentosHabilitantes; + } + + public List getLtipoTramite() { + return ltipoTramite; + } + + public void setLtipoTramite(List ltipoTramite) { + this.ltipoTramite = ltipoTramite; + } + + public List getLcategoria() { + return lcategoria; + } + + public void setLcategoria(List lcategoria) { + this.lcategoria = lcategoria; + } + + public List getLusoActividad() { + return lusoActividad; + } + + public void setLusoActividad(List lusoActividad) { + this.lusoActividad = lusoActividad; + } + + public List getLtipoCosto() { + return ltipoCosto; + } + + public void setLtipoCosto(List ltipoCosto) { + this.ltipoCosto = ltipoCosto; + } + + public List getLvigenciaMeses() { + return lvigenciaMeses; + } + + public void setLvigenciaMeses(List lvigenciaMeses) { + this.lvigenciaMeses = lvigenciaMeses; + } + + public List getLtipoArchivo() { + return ltipoArchivo; + } + + public void setLtipoArchivo(List ltipoArchivo) { + this.ltipoArchivo = ltipoArchivo; + } + + public List getLtipoAutorizacion() { + return ltipoAutorizacion; + } + + public void setLtipoAutorizacion(List ltipoAutorizacion) { + this.ltipoAutorizacion = ltipoAutorizacion; + } + + public String getEditarReg() { + return editarReg; + } + + public void setEditarReg(String editarReg) { + this.editarReg = editarReg; + } + + public List getLflujoTramite() { + return lflujoTramite; + } + + public void setLflujoTramite(List lflujoTramite) { + this.lflujoTramite = lflujoTramite; + } + + public boolean isReimpresion() { + return reimpresion; + } + + public void setReimpresion(boolean reimpresion) { + this.reimpresion = reimpresion; + } + + public String[] getSelectedEstados() { + return selectedEstados; + } + + public void setSelectedEstados(String[] selectedEstados) { + this.selectedEstados = selectedEstados; + } + + public List getLestadosarma() { + return lestadosarma; + } + + public void setLestadosarma(List lestadosarma) { + this.lestadosarma = lestadosarma; + } + + public String getDescripcionTrmitePadre() { + return descripcionTrmitePadre; + } + + public void setDescripcionTrmitePadre(String descripcionTrmitePadre) { + this.descripcionTrmitePadre = descripcionTrmitePadre; + } + + public String getDescripcionTrmitePadreAlt() { + return descripcionTrmitePadreAlt; + } + + public void setDescripcionTrmitePadreAlt(String descripcionTrmitePadreAlt) { + this.descripcionTrmitePadreAlt = descripcionTrmitePadreAlt; + } + + public List getLtipoPersona() { + return ltipoPersona; + } + + public void setLtipoPersona(List ltipoPersona) { + this.ltipoPersona = ltipoPersona; + } + + public List getLjurisdiccion() { + return ljurisdiccion; + } + + public void setLjurisdiccion(List ljurisdiccion) { + this.ljurisdiccion = ljurisdiccion; + } + + public boolean isLogo() { + return logo; + } + + public void setLogo(boolean logo) { + this.logo = logo; + } + + public boolean isSancionable() { + return sancionable; + } + + public void setSancionable(boolean sancionable) { + this.sancionable = sancionable; + } + + public boolean isCaducidadTramitePadreBln() { + return caducidadTramitePadreBln; + } + + public void setCaducidadTramitePadreBln(boolean caducidadTramitePadreBln) { + this.caducidadTramitePadreBln = caducidadTramitePadreBln; + } + + public boolean isCaducidadTramitePadreAltBln() { + return caducidadTramitePadreAltBln; + } + + public void setCaducidadTramitePadreAltBln(boolean caducidadTramitePadreAltBln) { + this.caducidadTramitePadreAltBln = caducidadTramitePadreAltBln; + } + + public boolean isVisualizaFechaExpiracionBln() { + return visualizaFechaExpiracionBln; + } + + public void setVisualizaFechaExpiracionBln(boolean visualizaFechaExpiracionBln) { + this.visualizaFechaExpiracionBln = visualizaFechaExpiracionBln; + } + + public boolean isRequiereJurisdiccion() { + return requiereJurisdiccion; + } + + public void setRequiereJurisdiccion(boolean requiereJurisdiccion) { + this.requiereJurisdiccion = requiereJurisdiccion; + } + + public List getLtipofabricacionarma() { + return ltipofabricacionarma; + } + + public void setLtipofabricacionarma(List ltipofabricacionarma) { + this.ltipofabricacionarma = ltipofabricacionarma; + } + + public String[] getSelectedTipoFabric() { + return selectedTipoFabric; + } + + public void setSelectedTipoFabric(String[] selectedTipoFabric) { + this.selectedTipoFabric = selectedTipoFabric; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/IngresoInventarioController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/IngresoInventarioController.java new file mode 100644 index 0000000..56e8290 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/IngresoInventarioController.java @@ -0,0 +1,1696 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.annotation.PostConstruct; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletResponse; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.ArmaExcell; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.funcionalidad.TotalArmasController; +import com.fp.frontend.controller.armas.solicitud.ArmasController; +import com.fp.frontend.controller.armas.solicitud.DocumentoHabilitanteController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.fun.TarmInventarioSubidoPorPersona; +import com.fp.persistence.parmas.fun.TarmInventarioSubidoPorPersonaKey; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.fun.TarmTotalPersona; +//import com.fp.persistence.parmas.param.TarmComercianteCupo; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmUnidadTipo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * @author Andres Cevallos Clase Controladora para la entidad TarmArma Incluye + * metodo de consulta para la busqueda de persona y registro + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class IngresoInventarioController extends AbstractController { + + //Variabgles globales + private Integer personcode; + + private Boolean descargar; + private String csolicitud; + InputStream filei; + + //Datos generales + private TgeneCatalogDetail tipoDocumento; + private TcustPersonDetail detallesPersona; + + Date fechaActual; + private List tiposRegistro; + private TgeneCatalogDetail tipoRegistro; + + //Detalle del material + //Pais + private List lpaises; + private TgeneCountry pais; + //private String pais; + + //Provincia + private List lprovincias; + private String codigoProvincia; + + //Canton + private List lcantones; + private String codigoCanton; + + //Ciudad + private List lciudades; + private TgeneCity ciudad; + + //Registro armas + TarmRegistroArmas registro = new TarmRegistroArmas(); + + //Variables de las armas + private TcustPersonDetail usuario; + private TcustPersonAddress direccion; + private List listaFilas; + private List listaErrores; +// private List cuposArmas; + + //private BigDecimal pesoTotal; + private TarmTipoArmaExplosivo tipoArmaExplosivo; + private List listaArmas; + private ArmaExcell armaexcell; + + private List laexel; + private List armas = new ArrayList(); + private List totalesPersoan = new ArrayList(); + + //Aeropuertos + List laeropuertos = new ArrayList<>(); + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddressController; + +// @ManagedProperty(value = "#{comercianteCupoController}") +// private ComercianteCupoController comercianteCupoController; + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmasController; + + @ManagedProperty(value = "#{totalArmasController}") + private TotalArmasController totalPersonaController; + + @ManagedProperty(value = "#{inventarioSubidoController}") + private InventarioSubidoController inventarioSubidoController; + + private List ldocumentospersona; + + private String clase; + + public IngresoInventarioController() throws Exception { + super(TarmArmas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.record = new TarmArmas(); + this.beanalias = "ARMAS"; + this.create(); + + //Globales + descargar = false; + csolicitud = null; + + //Datos generales + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + //Obteniendo los datos de la persona + detallesPersona = PersonDetailController.find(String.valueOf(usuario.getPk().getPersoncode())); + + //Tipo de documento + tipoDocumento = CatalogDetailController.findxCodigoCodcatalogo(detallesPersona.getIdentificationcatalog(), detallesPersona.getIdentificationcatalogcode()); + + //Fecha actual + this.fechaActual = Calendar.getInstance().getTime(); + + //Tipos de registro + List tiposRegistroAux = CatalogDetailController.find("TIPOREGISTRO", "REG"); + tiposRegistro = new ArrayList(); + for (TgeneCatalogDetail tipoReg : tiposRegistroAux) { + if (tipoReg.getPk().getCatalog().equalsIgnoreCase("PRO")) { + tiposRegistro.add(tipoReg); + } + } + + //Detalle del material + lpaises = CountryController.find(); + registro.setFechasolicitud(new java.sql.Date((new Date()).getTime())); + + //Obteniendo la direccion de la persona + String tipoDireccion = ""; + + if (detallesPersona != null) { + switch (detallesPersona.getIdentificationcatalog()) { + case "CED": + tipoDireccion = "1"; + break; + case "RUC": + tipoDireccion = "2"; + break; + default: + tipoDireccion = ""; + break; + } + } + //direccion= personAddressController.findByPersonCode(usuario.getPk().getPersoncode().toString()); + direccion = personAddressController.findPrincipal(String.valueOf(usuario.getPk().getPersoncode().toString())); + + //Imprtacion + this.lprovincias = ProvinceController.find("EC"); + + //Armas + listaErrores = new ArrayList(); + + //Controlador de totales +// this.totalPersonaController=new TotalPersonaController(); +// this.totalPersonaController.create(); +// this.totalPersonaController.setLrecord(new ArrayList()); + RegistroArmController registroArmas = new RegistroArmController(); + registroArmas.init(); + registroArmas.setRecperpage(3000000); + registroArmas.addFilter("personcode", tsafeUserDetail.getPk().getPersoncode().toString()); + registroArmas.query(); + this.addFilter("estado", "REG"); + filtro(registroArmas.getLrecord()); + + //Obteniendo los aeropuertos + this.laeropuertos = CatalogDetailController.find("AEROPUERTOS"); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", "i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase = new SubQuery("TarmTipoArmaExplosivo", "clase", "cclase", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo = new SubQuery("TarmTipoArmaExplosivo", "clasecodigo", "cclasecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud = new SubQuery("TarmTipoArmaExplosivo", "longitud", "clongitud", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo = new SubQuery("TarmTipoArmaExplosivo", "longitudcodigo", "clongitudcodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre = new SubQuery("TarmTipoArmaExplosivo", "calibre", "ccalibre", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo = new SubQuery("TarmTipoArmaExplosivo", "calibrecodigo", "ccalibrecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivo", "ctipoarmaexplosivo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivocodigo", "ctipoarmaexplosivocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapeso", "cunidadmedidapeso", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapesocodigo", "cunidadmedidapesocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + + Filter filtrofecha = new Filter(); + filtrofecha.setSql("t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) and t.estado !='DEST' and t.estado !='CDP'"); + dto.addFiltro(filtrofecha); + dto.setOrderby("pk"); + String sql = csolicitud; + if (csolicitud != null) { + Filter filtro = new Filter(); + filtro.setSql(sql); + dto.addFiltro(filtro); + } + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + public void querydatabaseMarcaSerie(String cregistro, String marca, String serie) { + try { + + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", "i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase = new SubQuery("TarmTipoArmaExplosivo", "clase", "cclase", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo = new SubQuery("TarmTipoArmaExplosivo", "clasecodigo", "cclasecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud = new SubQuery("TarmTipoArmaExplosivo", "longitud", "clongitud", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo = new SubQuery("TarmTipoArmaExplosivo", "longitudcodigo", "clongitudcodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre = new SubQuery("TarmTipoArmaExplosivo", "calibre", "ccalibre", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo = new SubQuery("TarmTipoArmaExplosivo", "calibrecodigo", "ccalibrecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivo", "ctipoarmaexplosivo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivocodigo", "ctipoarmaexplosivocodigo", "i.pk=t.ctipoarmaexplosivo");// and i.clase='" + clase + "' and i.tipoarmaexplosivo='" + tipoArmaExplosivo + "'"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapeso", "cunidadmedidapeso", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapesocodigo", "cunidadmedidapesocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + + Filter filtrofecha = new Filter(); + filtrofecha.setSql("t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) " + + " and t.estado !='DEST' and t.estado !='CDP' and t.lote " + (serie == null ? " is null" : ("= '" + serie + "'")) + " and t.cregistro= '" + + cregistro + "' and t.marca " + (marca == null ? " is null" : ("= '" + marca + "'"))); + dto.addFiltro(filtrofecha); + dto.setOrderby("pk"); + /* String sql=csolicitud; + if(csolicitud!=null){ + Filter filtro = new Filter(); + filtro.setSql(sql); + dto.addFiltro(filtro); + }*/ + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + /* Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE");*/ + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecOked") + protected void querydatabaseSimple() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql = " t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para armar el registro + * + * @param lsolicitud + */ + public void filtro(List lsolicitud) { + + for (TarmRegistroArmas soli : lsolicitud) { + if (csolicitud == null) { + csolicitud = "(cregistro=" + soli.getPk(); + } else { + csolicitud += " or cregistro=" + soli.getPk(); + } + } + csolicitud += ")"; + + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + + DtoSave dtosave = super.getDtoSave(true); + dtosave.setPosition(2); + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); + + registroArmasController.clearAll(); + DtoSave dtosaveregistroarma = registroArmasController.getDtoSave(true); + dtosaveregistroarma.setPosition(1); + msave.put(registroArmasController.getBeanalias(), dtosaveregistroarma); + + totalPersonaController.clearAll(); + DtoSave dtosavetotalper = totalPersonaController.getDtoSave(true); + dtosavetotalper.setPosition(3); + msave.put(totalPersonaController.getBeanalias(), dtosavetotalper); + + DtoSave dtoInventarioSubido = inventarioSubidoController.getDtoSave(true); + dtoInventarioSubido.setPosition(4); + msave.put(inventarioSubidoController.getBeanalias(), dtoInventarioSubido); + + request.setSaveTables(msave); + request.getModifiedData().put("LISTAARMAS", this.armas); + request.getModifiedData().put("LISTATOTALES", this.totalesPersoan); + request.getModifiedData().put("REGISTRO", this.registro); + + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.registroArmasController.postCommit(resp); + this.totalPersonaController.postCommit(resp); + this.inventarioSubidoController.postCommit(resp); + //this.totalPersonaController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Metodo que carga y valida el contenido de un archivo excel con + * información de armas + * + * @param event + */ + public void cargarArchivo(FileUploadEvent event) { + + HashMap mapaTotalesTemporales = new HashMap<>(); + int f1 = 0; + try { + // Verifico si ya se hizo una carga de inventario previa para al clase seleccionada + List inventarioPrevioIngresadoLst = InventarioSubidoController.findXPersonaYClase(this.usuario.getPk().getPersoncode().toString(), clase); + if (inventarioPrevioIngresadoLst != null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_inventarioCargadoPreviamente")); + return; + } else { + TarmInventarioSubidoPorPersonaKey pkInventarioSubidoObj = new TarmInventarioSubidoPorPersonaKey(); + pkInventarioSubidoObj.setPersoncode(this.usuario.getPk().getPersoncode()); + pkInventarioSubidoObj.setClase(clase); + TarmInventarioSubidoPorPersona inventarioSubidoObj = new TarmInventarioSubidoPorPersona(); + inventarioSubidoObj.setPk(pkInventarioSubidoObj); + java.util.Date today = new java.util.Date(); + java.sql.Timestamp fechaReporte = new java.sql.Timestamp(today.getTime()); + inventarioSubidoObj.setFechacarga(fechaReporte); + inventarioSubidoObj.setIsnew(Boolean.TRUE); + inventarioSubidoController.update(inventarioSubidoObj); + } + + //Completando los datos del registro + this.registro.setPersoncode(this.usuario.getPk().getPersoncode()); + this.registro.setTiporegistrocodigo("TIPOREGISTRO"); + this.registro.setFechasolicitud(new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + //Inicializando las listas + listaFilas = new ArrayList(); + listaArmas = new ArrayList(); + listaErrores = new ArrayList(); + //caraga el excel + UploadedFile selectedFile = event.getFile(); + InputStream archivo = selectedFile.getInputstream(); + XSSFWorkbook libro = new XSSFWorkbook(archivo); + XSSFSheet hoja = libro.getSheetAt(0); + //Iterando sobre las filas + int cont = 0; + Iterator rowIterator = hoja.iterator(); + //Cargando el contenido de las celdas a una lista de objetos + while (rowIterator.hasNext()) { + cont++; + Row row = rowIterator.next(); + if (cont > 1) { + Cell numero = row.getCell(0); + Cell serie = row.getCell(1); + Cell clase = row.getCell(2); + Cell longitud = row.getCell(3); + Cell tipo = row.getCell(4); + Cell calibre = row.getCell(5); + Cell color = row.getCell(6); + Cell marca = row.getCell(7); + Cell cantidad = row.getCell(8); + Cell umcantidad = row.getCell(9); + Cell peso = row.getCell(10); + Cell umpeso = row.getCell(11); + Boolean filaEnBlanco = false; + if (this.celdaVacia(numero) && this.celdaVacia(serie) && this.celdaVacia(clase) + && this.celdaVacia(longitud) && this.celdaVacia(tipo) && this.celdaVacia(calibre) + && this.celdaVacia(color) && this.celdaVacia(marca) && this.celdaVacia(cantidad) + && this.celdaVacia(umcantidad) && this.celdaVacia(peso) && this.celdaVacia(umpeso)) { + filaEnBlanco = true; + } else { + listaFilas.add(row); + } + if (!filaEnBlanco) { + //arma la lista de las armas en un dto aniade en la lista listaArmas + armarlistaArmasExcel(numero, serie, clase, longitud, tipo, calibre, color, marca, cantidad, umcantidad, peso, umpeso, row); + } + } + } + //Verificando las filas duplicadas en el archivo + verificarFilasDuplicadas(listaArmas); + if (this.registro.getTiporegistro().equals("PRO")) { + //Verificando las filas duplicadas en la BD + verificarArmasExistentesEnBaseDeDatos(listaArmas, this.usuario.getPk().getPersoncode()); + } + Boolean contieneSerie = false; + //RECORRE LA LISTA DE LAS ARMAS y valida el CUPO DEL ARMA + //Validando los campos requeridos que estan vacios + recorreListaArmasExcel(contieneSerie, f1, mapaTotalesTemporales); + //Seteando los atributos de las armas y totales si no hay ningun error + if (listaErrores.isEmpty()) { + for (int i = 0; i < listaArmas.size(); i++) { + if (!listaArmas.get(i).getCamposIncompletos() && !listaArmas.get(i).getDuplicada() && listaArmas.get(i).getExisteCatalogo() + && listaArmas.get(i).getExisteTARMTIPOARMAEXPLOSIVO()) { //&& !listaArmas.get(i).getCupoInsuficiente() + //Marca + if (listaArmas.get(i).getCatalogoMarca() != null) { + listaArmas.get(i).getArma().setMarcacodigo("MARCA"); + listaArmas.get(i).getArma().setMarca(listaArmas.get(i).getCatalogoMarca().getPk().getCatalog()); + } + //Color + if (listaArmas.get(i).getCatalogoColor() != null) { + listaArmas.get(i).getArma().setColorcodigo("COLOR"); + listaArmas.get(i).getArma().setColor(listaArmas.get(i).getCatalogoColor().getPk().getCatalog()); + } + //Unidad medida cantidad + if (listaArmas.get(i).getTipoArmaExplosivo() != null) { + listaArmas.get(i).getArma().setUnidadmedidacantidadcodigo("UNIDADMEDIDA"); + Double doubleNum = 0.0; + //Cargando el catalodo del tipo de unidad de medida + if (listaArmas.get(i).getUnidadMedidaCantidad() != null && !listaArmas.get(i).getUnidadMedidaCantidad().isEmpty()) { + listaArmas.get(i).getArma().setUnidadmedidacantidad(listaArmas.get(i).getUnidadMedidaCantidad()); + doubleNum = Double.parseDouble(listaArmas.get(i).getTextoCantidad()); + //Cantidad + Integer intNum = (int) doubleNum.doubleValue(); + listaArmas.get(i).getArma().setCantidad(intNum); + } else if (listaArmas.get(i).getUnidadMedidaPeso() != null && !listaArmas.get(i).getUnidadMedidaPeso().isEmpty()) { + listaArmas.get(i).getArma().setUnidadmedidacantidad(listaArmas.get(i).getUnidadMedidaPeso()); + doubleNum = Double.parseDouble(listaArmas.get(i).getTextoPeso()); + //Peso + listaArmas.get(i).getArma().setPeso(new BigDecimal(doubleNum)); + } + } + //Estado DEL ARMA + listaArmas.get(i).getArma().setEstado("REG"); + listaArmas.get(i).getArma().setEstadocodigo("ESTADOARMA"); + if (direccion != null) { + //Codigo de pais + listaArmas.get(i).getArma().setCountrycode(direccion.getCountrycode()); + //Codigo de provincia + listaArmas.get(i).getArma().setProvincecode(direccion.getProvincecode()); + //Codigo de canton + listaArmas.get(i).getArma().setCantoncode(direccion.getCantoncode()); + //Codigo de parroquia + listaArmas.get(i).getArma().setParroquiacode(direccion.getParroquiacode()); + //Codigo de ciudad + listaArmas.get(i).getArma().setCitycode(direccion.getCitycode()); + } + //Lote + listaArmas.get(i).getArma().setLote(listaArmas.get(i).getSerie()); + //Peso + if (listaArmas.get(i).getTextoPeso() != null && !listaArmas.get(i).getTextoPeso().isEmpty()) { + listaArmas.get(i).getArma().setPeso(BigDecimal.valueOf(Double.parseDouble(listaArmas.get(i).getTextoPeso()))); + } + //Direccion + listaArmas.get(i).getArma().setDireccion(direccion.getAddress()); + + //Fecha de registro + listaArmas.get(i).getArma().setFecharegistro(new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + + //Tipo de arma explosivo + if (listaArmas.get(i).getTipoArmaExplosivo() != null) { + listaArmas.get(i).getArma().setCtipoarmaexplosivo(listaArmas.get(i).getTipoArmaExplosivo().getPk()); + } + armas.add(listaArmas.get(i).getArma()); + } + } + //Se rrecorre el mapa HashMap mapaTotalesTemporales + for (TarmTotalPersona value : mapaTotalesTemporales.values()) { + totalesPersoan.add(value); + } + save(); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } finally { + if (!listaErrores.isEmpty()) { + listaArmas.clear(); + MessageHelper.setMessageError("ERRORES ENCONTRADOS DENTRO DEL ARCHIVO EXCEL: ");// + errores.toString()); + descargar = true; + } else { + MessageHelper.setMessageInfo("ARCHIVO CARGADO EXITOSAMENTE"); + descargar = false; + } + } + } + + /** + * Metodo para cargar los valores del EXCEL EN UNA CLASE DTO(ArmaExcell ) + * + * @param numero * @param serie * @param clase * @param longitud * @param + * tipo * @param calibre + * @param color * @param marca * @param cantidad * @param umcantidad * + * @param peso * @param umpeso * @param row + */ + public void armarlistaArmasExcel(Cell numero, Cell serie, Cell clase, Cell longitud, Cell tipo, Cell calibre, Cell color, Cell marca, + Cell cantidad, Cell umcantidad, Cell peso, Cell umpeso, Row row) { + ArmaExcell arma = new ArmaExcell(); + arma.setTextoNumero(Utilidades.setearValorCelda(numero));//Numero + arma.setSerie(Utilidades.setearValorCelda(serie));//Serie + arma.setClase(Utilidades.setearValorCelda(clase));//Clase + arma.setLongitud(Utilidades.setearValorCelda(longitud));//Longitud + arma.setTipo(Utilidades.setearValorCelda(tipo));//Tipo + arma.setCalibre(Utilidades.setearValorCelda(calibre));//Calibre + arma.setColor(Utilidades.setearValorCelda(color));//Color + arma.setMarca(Utilidades.setearValorCelda(marca));//Marca + arma.setTextoCantidad(Utilidades.setearValorCelda(cantidad));//Cantidad + arma.setUnidadMedidaCantidad(Utilidades.setearValorCelda(umcantidad));//U. Medida Cantidad + arma.setTextoPeso(Utilidades.setearValorCelda(peso));//Peso + arma.setUnidadMedidaPeso(Utilidades.setearValorCelda(umpeso));//U. Medida Peso + + // El ingreso de inventario sera para todas las clases excepto armas de fuego y armas no letales + if (!arma.getClase().equalsIgnoreCase("ARMA DE FUEGO") && !arma.getClase().equalsIgnoreCase("ARMAS NO LETALES")) { + listaArmas.add(arma); + } else { + listaErrores.add("Fila " + row.getRowNum() + ": " + "Columna clase: " + MsgControlArmas.getProperty("msg_inventarioNoArmasFuegoNiNoLetales")); + return; + } + } + + /** + * Metodo que verifica si existen filas duplicadas en el archivo de excell + * + * @param listaArmas + */ + private void verificarFilasDuplicadas(List listaArmas) { + for (int i = 0; i < listaArmas.size() - 1; i++) { + for (int j = i + 1; j < listaArmas.size(); j++) { + if (!this.registro.getTiporegistro().equalsIgnoreCase("IMP") && ((listaArmas.get(i).getSerie().equalsIgnoreCase(listaArmas.get(j).getSerie())) + && listaArmas.get(i).getClase().equalsIgnoreCase(listaArmas.get(j).getClase()) + && listaArmas.get(i).getTipo().equalsIgnoreCase(listaArmas.get(j).getTipo()) + && (!listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego") + || (listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego") && listaArmas.get(j).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")) + && listaArmas.get(i).getCalibre().equalsIgnoreCase(listaArmas.get(j).getCalibre())) + && listaArmas.get(i).getMarca().equalsIgnoreCase(listaArmas.get(j).getMarca()))) { + listaArmas.get(j).setDuplicada(true); + break; + } + } + } + } + + /** + * @param listaArmas + * @throws Exception + */ + @SuppressWarnings("static-access") + private void verificarArmasExistentesEnBaseDeDatos(List listaArmas, Integer codigoPersona) throws Exception { + TgeneCatalogDetail codigoClase = new TgeneCatalogDetail(); + TgeneCatalogDetail codigoMarca = new TgeneCatalogDetail(); + TgeneCatalogDetail codigoTipo = new TgeneCatalogDetail(); + TgeneCatalogDetail codigoCalibre = new TgeneCatalogDetail(); + String codigoSerie; + List lstRegistroArmas = registroArmasController.findxPersoncode(String.valueOf(codigoPersona)); + if (lstRegistroArmas == null || listaArmas == null || lstRegistroArmas.isEmpty() || listaArmas.isEmpty()) { + return; + } + for (int i = 0; i < listaArmas.size(); i++) { + codigoClase = CatalogDetailController.findByCatalogcodeDescrption("CLASE", listaArmas.get(i).getClase()); + codigoTipo = CatalogDetailController.findByCatalogcodeDescrption("TIPOARMAEXPLOSIVO", listaArmas.get(i).getTipo()); + codigoMarca = CatalogDetailController.findByCatalogcodeDescrption("MARCA", listaArmas.get(i).getMarca()); + codigoSerie = this.registro.getTiporegistro().equalsIgnoreCase("IMP") ? null : listaArmas.get(i).getSerie(); + codigoCalibre = listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego") ? CatalogDetailController.findByCatalogcodeDescrption("CALIBRE", listaArmas.get(i).getCalibre()) : null; + + if ((codigoClase == null && (listaArmas.get(i).getClase() != null && !listaArmas.get(i).getClase().trim().isEmpty())) || (codigoTipo == null && (listaArmas.get(i).getTipo() != null && !listaArmas.get(i).getTipo().trim().isEmpty())) + || (codigoMarca == null && (listaArmas.get(i).getMarca() != null && !listaArmas.get(i).getMarca().trim().isEmpty())) || (codigoSerie == null && (listaArmas.get(i).getSerie() != null && !listaArmas.get(i).getSerie().trim().isEmpty())) + || (codigoCalibre == null && (listaArmas.get(i).getCalibre() != null && !listaArmas.get(i).getCalibre().trim().isEmpty())) + || listaArmas.get(i).getClase() == null || listaArmas.get(i).getMarca() == null || listaArmas.get(i).getCalibre() == null + || listaArmas.get(i).getClase().isEmpty() || listaArmas.get(i).getMarca().isEmpty() || listaArmas.get(i).getCalibre().isEmpty()) { + continue; + } + for (TarmRegistroArmas registroArmas : lstRegistroArmas) { + List lstArmasEncontradas = findByMarcaSerie(String.valueOf(registroArmas.getPk()), codigoMarca.getPk().getCatalog(), codigoSerie); + if (lstArmasEncontradas != null) { + for (TarmArmas armas : lstArmasEncontradas) { + TarmTipoArmaExplosivo tipoArma = TiposArmasExplosivosController.findarma(armas.getCtipoarmaexplosivo()); + if (tipoArma.getClase().equalsIgnoreCase(codigoClase.getPk().getCatalog()) && codigoCalibre != null ? tipoArma.getCalibre().equalsIgnoreCase(codigoCalibre.getPk().getCatalog()) : true && tipoArma.getTipoarmaexplosivo().equalsIgnoreCase(codigoTipo.getPk().getCatalog())) { + listaArmas.get(i).setDuplicada(true); + break; + } + } + } + } + } + } + + /** + * Metodo que recorre la lista de las armas con los valores cargados del + * EXCEL + * + * @param contieneSerie + * @param f1 + * @param mapaTotalesTemporales + */ + public void recorreListaArmasExcel(Boolean contieneSerie, int f1, HashMap mapaTotalesTemporales) { + for (int i = 0; i < listaArmas.size(); i++) { + Integer fila = i + 1; + f1 = i; + Boolean campoCantidad = false; + //0-Datos duplicados + if (listaArmas.get(i).getDuplicada()) { + listaErrores.add("Fila " + fila.toString() + ": " + MsgControlArmas.getProperty("msg_datosDuplicados")); + } + //1-Serie + //Validando que si el tipo de registro es de importacion + //las armas no contengan numero de serie + if (this.registro.getTiporegistro().equalsIgnoreCase("IMP") && (listaArmas.get(i).getSerie() != null) && !contieneSerie) { + contieneSerie = true; + listaErrores.add(MsgControlArmas.getProperty("msg_archivoImportacionSerie")); + } + if (!this.registro.getTiporegistro().equalsIgnoreCase("IMP") && (listaArmas.get(i).getSerie() == null || listaArmas.get(i).getSerie().trim().isEmpty())) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 1: " + MsgControlArmas.getProperty("msg_serieVacia")); + listaArmas.get(i).setCamposIncompletos(true); + } + //2-Clase + if (listaArmas.get(i).getClase() == null || listaArmas.get(i).getClase().trim().isEmpty()) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 2: " + MsgControlArmas.getProperty("msg_claseVacia")); + listaArmas.get(i).setCamposIncompletos(true); + + //3-Validando que cuando la clase sea ARMA DE FUEGO la longitud no este vacia + } else if (listaArmas.get(i).getClase().equalsIgnoreCase("ARMA DE FUEGO") + && (listaArmas.get(i).getLongitud() == null || listaArmas.get(i).getLongitud().trim().isEmpty())) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 3: " + MsgControlArmas.getProperty("msg_longitudVacia")); + listaArmas.get(i).setCamposIncompletos(true); + + //Validando que cuando la clase no sea ARMA DE FUEGO la longitud este vacia + } else if (!listaArmas.get(i).getClase().equalsIgnoreCase("ARMA DE FUEGO") + && (listaArmas.get(i).getLongitud() != null && !listaArmas.get(i).getLongitud().trim().isEmpty())) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 3: " + MsgControlArmas.getProperty("msg_longitudNoVacia")); + } + //Carga de catalogos + TgeneCatalogDetail catalogoClase = CatalogDetailController.findByCatalogcodeDescrption("CLASE", listaArmas.get(i).getClase()); + listaArmas.get(i).setCatalogoClase(catalogoClase); + if (catalogoClase != null && catalogoClase.getPk() != null && catalogoClase.getPk().getCatalog() != null && !clase.contains(catalogoClase.getPk().getCatalog())) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 2: " + " No tiene permiso para cargar " + catalogoClase.getDescription()); + listaArmas.get(i).setCamposIncompletos(true); + } else if (catalogoClase == null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 2: " + " No tiene ingresado una Clase V\u00e1lida "); + listaArmas.get(i).setCamposIncompletos(true); + } + TgeneCatalogDetail catalogoLongitud = CatalogDetailController.findByCatalogcodeDescrption("LONGITUD", listaArmas.get(i).getLongitud()); + listaArmas.get(i).setCatalogoLongitud(catalogoLongitud); + TgeneCatalogDetail catalogoTipoArma = CatalogDetailController.findByCatalogcodeDescrption("TIPOARMAEXPLOSIVO", listaArmas.get(i).getTipo()); + listaArmas.get(i).setCatalogoTipoArma(catalogoTipoArma); + TgeneCatalogDetail catalogoCalibre = CatalogDetailController.findByCatalogcodeDescrption("CALIBRE", listaArmas.get(i).getCalibre()); + listaArmas.get(i).setCatalogoCalibre(catalogoCalibre); + TgeneCatalogDetail catalogoColor = CatalogDetailController.findByCatalogcodeDescrption("COLOR", listaArmas.get(i).getColor()); + listaArmas.get(i).setCatalogoColor(catalogoColor); + TgeneCatalogDetail catalogoMarca = CatalogDetailController.findByCatalogcodeDescrption("MARCA", listaArmas.get(i).getMarca()); + listaArmas.get(i).setCatalogoMarca(catalogoMarca); + TarmUnidadTipo tipoUnidadSeleccionada = null;// new TarmUnidadTipo(); + if (catalogoClase != null) { + //Obteniendo la configuracion de TARMUNIDADTIPO + if (!(listaArmas.get(i).getUnidadMedidaCantidad() == null || listaArmas.get(i).getUnidadMedidaCantidad().isEmpty()) && !(listaArmas.get(i).getUnidadMedidaPeso() == null || listaArmas.get(i).getUnidadMedidaPeso().isEmpty())) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 9,11: " + MsgControlArmas.getProperty("msg_unidadMedidaSoloUna")); + } + String unidadMedidaIngresada = (listaArmas.get(i).getUnidadMedidaCantidad() == null || listaArmas.get(i).getUnidadMedidaCantidad().isEmpty()) ? listaArmas.get(i).getUnidadMedidaPeso() : listaArmas.get(i).getUnidadMedidaCantidad(); + String columnaUnidadMedidaError = (listaArmas.get(i).getUnidadMedidaCantidad() == null || listaArmas.get(i).getUnidadMedidaCantidad().isEmpty()) ? "Columna 11" : "Columna 9"; + if (listaArmas.get(i).getCatalogoTipoArma() == null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 5: El Tipo de Arma Explosivo no existe en el Catlogo. Revise los espacios entre cada palabra y que este bien escrito."); + listaArmas.get(i).setCamposIncompletos(true); + tipoUnidadSeleccionada = null; + } else { + tipoUnidadSeleccionada = UnidadTipoController.findByClaseAndClasecode(catalogoClase.getPk().getCatalog(), catalogoClase.getPk().getCatalogcode(), listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(), unidadMedidaIngresada); + } + if (tipoUnidadSeleccionada != null && tipoUnidadSeleccionada.getPk().getUnidadmedidapeso() != null && !tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().isEmpty()) { + if (tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().equalsIgnoreCase("UNIDAD") || tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().equalsIgnoreCase("UNIDADES")) { + campoCantidad = true; + } else if (tipoUnidadSeleccionada.getPk().getUnidadmedidapeso().equalsIgnoreCase("KG")) { + campoCantidad = false; + } + } else if (tipoUnidadSeleccionada == null) { + listaErrores.add("Fila " + fila.toString() + ": " + columnaUnidadMedidaError + ": " + MsgControlArmas.getProperty("msg_unidadMedidaNoExiste")); + } + } + //4-Tipo + if (listaArmas.get(i).getTipo() == null || listaArmas.get(i).getTipo().trim().isEmpty()) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 4: " + MsgControlArmas.getProperty("msg_tipoVacio")); + listaArmas.get(i).setCamposIncompletos(true); + } + //5-Calibre + if (listaArmas.get(i).getClase() != null && !listaArmas.get(i).getClase().isEmpty() + && listaArmas.get(i).getClase().equalsIgnoreCase("ARMA DE FUEGO") + && (listaArmas.get(i).getCalibre() == null || listaArmas.get(i).getCalibre().trim().isEmpty())) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 5: " + MsgControlArmas.getProperty("msg_calibreVacio")); + } + //Marca + if (listaArmas.get(i).getMarca() == null || listaArmas.get(i).getMarca().trim().isEmpty()) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 7: " + MsgControlArmas.getProperty("msg_marcaVacia")); + listaArmas.get(i).setCamposIncompletos(true); + } + if (campoCantidad) { + //Cantidad + if ((listaArmas.get(i).getTextoCantidad() == null || listaArmas.get(i).getTextoCantidad().trim().isEmpty()) && tipoUnidadSeleccionada != null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 8: " + MsgControlArmas.getProperty("msg_cantidadVacia")); + listaArmas.get(i).setCamposIncompletos(true); + + } else if (listaFilas.get(i).getCell(8).getCellType() != Cell.CELL_TYPE_NUMERIC && tipoUnidadSeleccionada != null) { + //Verificando el tipo de dato numerico + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 8: " + MsgControlArmas.getProperty("msg_cantidadValorNumerico")); + } + + //U. Medida Cantidad + if ((listaArmas.get(i).getUnidadMedidaCantidad() == null || listaArmas.get(i).getUnidadMedidaCantidad().trim().isEmpty()) && tipoUnidadSeleccionada != null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 9: " + MsgControlArmas.getProperty("msg_unidadMedidaCantidadVacia")); + } + + //Peso + if ((listaArmas.get(i).getTextoPeso() != null && !listaArmas.get(i).getTextoPeso().trim().isEmpty()) && tipoUnidadSeleccionada != null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 10: " + MsgControlArmas.getProperty("msg_pesoNoVacio")); + } + + //U. Medida Peso + if ((listaArmas.get(i).getUnidadMedidaPeso() != null && !listaArmas.get(i).getUnidadMedidaPeso().trim().isEmpty()) && tipoUnidadSeleccionada != null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 11: " + MsgControlArmas.getProperty("msg_unidadMedidaPesoNoVacia")); + } + //Validando que cuando la clase NO sea ARMA DE FUEGO, MUNICION, + //Explosivos, Accesorios, Fuegos Pirotecnicos, Sustancia Quimica, Armas no Letales + //la cantidad y unidad de medida cantidad esten vacios + //y el peso y unidad de medida peso NO esten vacios + } else if (listaArmas.get(i).getClase() != null && !listaArmas.get(i).getClase().isEmpty()) { + //Cantidad + if ((listaArmas.get(i).getTextoCantidad() != null && !listaArmas.get(i).getTextoCantidad().trim().isEmpty()) && tipoUnidadSeleccionada != null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 8: " + MsgControlArmas.getProperty("msg_cantidadNoVacia")); + } + //U. Medida Cantidad + if (listaArmas.get(i).getUnidadMedidaCantidad() != null && !listaArmas.get(i).getUnidadMedidaCantidad().trim().isEmpty() && tipoUnidadSeleccionada != null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 9: " + MsgControlArmas.getProperty("msg_unidadMedidaCantidadNoVacia")); + } + //Peso + if ((listaArmas.get(i).getTextoPeso() == null || listaArmas.get(i).getTextoPeso().trim().isEmpty()) && tipoUnidadSeleccionada != null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 10: " + MsgControlArmas.getProperty("msg_pesoVacio")); + listaArmas.get(i).setCamposIncompletos(true); + + } else if (listaFilas.get(i).getCell(10).getCellType() != Cell.CELL_TYPE_NUMERIC && tipoUnidadSeleccionada != null) { + //Verificando el tipo de dato numerico + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 10: " + MsgControlArmas.getProperty("msg_pesoValorNumerico")); + } + //U. Medida Peso + if ((listaArmas.get(i).getUnidadMedidaPeso() == null || listaArmas.get(i).getUnidadMedidaPeso().trim().isEmpty()) && tipoUnidadSeleccionada != null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 11: " + MsgControlArmas.getProperty("msg_unidadMedidaPesoVacia")); + listaArmas.get(i).setCamposIncompletos(true); + } + } + //Verificando que no existan problemas en el arma proveniente del archivo EXCEL + //para validar entonces los datos en la base de datos + if (!listaArmas.get(i).getCamposIncompletos() && !listaArmas.get(i).getDuplicada()) { + //Verificando los datos en los catalogos + //Verificando la existencia de la clase en el catalogo + if (catalogoClase == null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 2: " + MsgControlArmas.getProperty("msg_calibreNoExisteCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + } else { + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia de la longitud en el catalogo + if (catalogoLongitud == null) { + listaArmas.get(i).setExisteCatalogo(false); + if (listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 3: " + MsgControlArmas.getProperty("msg_longitudNoExisteCatalogo")); + } + } else { + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia del tipo de arma en el catalogo + if (catalogoTipoArma == null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 4: " + MsgControlArmas.getProperty("msg_noExisteTipoArmaCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + } else { + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia del calibre en el catalogo + if (catalogoCalibre == null) { + listaArmas.get(i).setExisteCatalogo(false); + if (listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 5: " + MsgControlArmas.getProperty("msg_calibreNoExisteCatalogo")); + } + } else { + listaArmas.get(i).setExisteCatalogo(true); + } + //Verificando la existencia del color en el catalogo + if (listaArmas.get(i).getColor() != null && !listaArmas.get(i).getColor().isEmpty()) { + if (catalogoColor == null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 6: " + MsgControlArmas.getProperty("msg_colorNoExisteCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + } else { + listaArmas.get(i).setExisteCatalogo(true); + } + } + //Verificando la existencia de la marca en el catalogo + if (catalogoMarca == null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Columna 7: " + MsgControlArmas.getProperty("msg_marcaNoExisteCatalogo")); + listaArmas.get(i).setExisteCatalogo(false); + } else { + listaArmas.get(i).setExisteCatalogo(true); + } + //Validacio 4- Verificando que exista la combinacion clase, longitud, tipo arma y calibre + //en la tabla TARMTIPOARMAEXPLOSIVO + if (listaArmas.get(i).getClase().toLowerCase().equalsIgnoreCase("arma de fuego")) { + if (catalogoClase != null && catalogoLongitud != null && catalogoTipoArma != null && catalogoCalibre != null && tipoUnidadSeleccionada != null) { + tipoArmaExplosivo = TiposArmasExplosivosController.findByClaseLongitudCalibreTipoArma(catalogoLongitud.getPk().getCatalog(), + catalogoCalibre.getPk().getCatalog(), catalogoClase.getPk().getCatalog(), catalogoTipoArma.getPk().getCatalog(), tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + + if (tipoArmaExplosivo == null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Registro no encontrado: " + listaArmas.get(i).getClase() + ", " + listaArmas.get(i).getLongitud() + ", " + listaArmas.get(i).getTipo() + ", " + listaArmas.get(i).getCalibre()); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } else { + listaArmas.get(i).setTipoArmaExplosivo(tipoArmaExplosivo); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(true); + } + } else { + listaErrores.add("Fila " + fila.toString() + ": " + "Registro no encontrado la combinaci\u00f3n del Tipo Arma Explosivo"); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } + } else if (catalogoCalibre != null && catalogoCalibre.getDescription() != null && !catalogoCalibre.getDescription().equals("")) { + // Caso donde existe calibre + if (catalogoClase != null && catalogoTipoArma != null && tipoUnidadSeleccionada != null) { + tipoArmaExplosivo = TiposArmasExplosivosController.findByClaseCalibreTipoArma(catalogoClase.getPk().getCatalog(), catalogoCalibre.getPk().getCatalog(), catalogoTipoArma.getPk().getCatalog(), tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + if (tipoArmaExplosivo == null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Registro no encontrado: " + listaArmas.get(i).getClase() + ", " + listaArmas.get(i).getTipo()); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } else { + listaArmas.get(i).setTipoArmaExplosivo(tipoArmaExplosivo); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(true); + } + } else { + listaErrores.add("Fila " + fila.toString() + ": " + "Registro no encontrado la combinaci\u00f3n del Tipo Arma Explosivo "); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } + } else // Caso donde no existe calibre + if (catalogoClase != null && catalogoTipoArma != null && tipoUnidadSeleccionada != null) { + tipoArmaExplosivo = TiposArmasExplosivosController.findByClaseTipo(catalogoClase.getPk().getCatalog(), catalogoTipoArma.getPk().getCatalog(), tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + if (tipoArmaExplosivo == null) { + listaErrores.add("Fila " + fila.toString() + ": " + "Registro no encontrado: " + listaArmas.get(i).getClase() + ", " + listaArmas.get(i).getTipo()); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } else { + listaArmas.get(i).setTipoArmaExplosivo(tipoArmaExplosivo); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(true); + } + } else { + listaErrores.add("Fila " + fila.toString() + ": " + "Registro no encontrado la combinaci\u00f3n del Tipo Arma Explosivo "); + listaArmas.get(i).setExisteTARMTIPOARMAEXPLOSIVO(false); + } + if (listaArmas.get(i).getCatalogoClase() != null && listaArmas.get(i).getCatalogoTipoArma() != null && listaArmas.get(i).getCatalogoMarca() != null) { + TarmArmas armaBD; + //Si el tipo de registro es de Importacion, el arma se persiste como nueva + //no se busca en la base de datos + if (this.registro.getTiporegistro().equalsIgnoreCase("IMP")) { + listaArmas.get(i).setExisteBaseDatos(false); + armaBD = new TarmArmas(); + armaBD.setIsnew(true); + } else { + //Verificando que el arma exista en la base de datos + //si el tipo de registro es de produccion + armaBD = ArmasController.findBySerieMarca(listaArmas.get(i).getSerie(), listaArmas.get(i).getCatalogoMarca().getPk().getCatalog()); + if (armaBD == null) { + listaArmas.get(i).setExisteBaseDatos(false); + armaBD = new TarmArmas(); + armaBD.setIsnew(true); + } else { + List listaExplosivos = TiposArmasExplosivosController.findByClaseTipoAll(listaArmas.get(i).getCatalogoClase().getPk().getCatalog(), + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog()); + if (listaExplosivos == null) { + listaArmas.get(i).setExisteBaseDatos(false); + } else { + listaArmas.get(i).setExisteBaseDatos(false); + for (TarmTipoArmaExplosivo explosivo : listaExplosivos) { + if (explosivo.getPk().equalsIgnoreCase(armaBD.getCtipoarmaexplosivo())) { + listaArmas.get(i).setExisteBaseDatos(true); + armaBD.setIsnew(false); + break; + } + } + } + } + } + listaArmas.get(i).setArma(armaBD); + String unidadTipoIngresada = campoCantidad ? listaArmas.get(i).getUnidadMedidaCantidad() : listaArmas.get(i).getUnidadMedidaPeso(); + // CARGA EL CUPO ***** //persona,clase,tipoarmaexplosivo +// List cupo =ComercianteCupoController.findByPersonCode(usuario.getPk().getPersoncode().toString(), +// listaArmas.get(i).getCatalogoClase().getPk().getCatalog(), listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(), +// unidadTipoIngresada); +// +// if(cupo!=null && !cupo.isEmpty() && cupo.get(0).getTiporegistro().equalsIgnoreCase(this.registro.getTiporegistro())){ + //metodo de los TOTALES SETEADOS EN UN MAPA + cupoArmasExplosivos(i, mapaTotalesTemporales, fila, tipoUnidadSeleccionada); +// }else{ +// if(cupo==null || cupo.isEmpty()){ +// listaErrores.add("Fila "+fila.toString()+": Cupo no asignado para "+listaArmas.get(i).getClase()+"."); +// } +// else{ +// listaErrores.add("Fila "+fila.toString()+": Cupo no disponible para "+listaArmas.get(i).getClase()+"."); +// } +// listaArmas.get(i).setCupoInsuficiente(true); +// } + } + } + tipoUnidadSeleccionada = null; + } + } + + public void cupoArmasExplosivos(int i, HashMap mapaTotalesTemporales, Integer fila, TarmUnidadTipo tipoUnidadSeleccionada) { + + BigDecimal saldoPasaraaAnterior = new BigDecimal(0); + TarmTotalPersona totalPersona = null; + + if (mapaTotalesTemporales.get(usuario.getPk().getPersoncode().toString() + "|" + listaArmas.get(i).getCatalogoClase().getPk().getCatalog() + + "|" + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog()) == null) { + totalPersona = TotalPersonaController.findMaxFecha(listaArmas.get(i).getCatalogoClase().getPk().getCatalog(), + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(), usuario.getPk().getPersoncode().toString(), + tipoUnidadSeleccionada.getPk().getUnidadmedidapeso()); + if (totalPersona == null) { + totalPersona = new TarmTotalPersona(); + totalPersona.setTotal(new BigDecimal(0)); + } else { + saldoPasaraaAnterior = (totalPersona == null ? new BigDecimal(0) : totalPersona.getTotal()); + } + BigDecimal peso = (listaArmas == null || listaArmas.get(i).getTextoPeso() == null || listaArmas.get(i).getTextoPeso().isEmpty()) ? new BigDecimal(0.0) : new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoPeso())); + BigDecimal cantidad = (listaArmas == null || listaArmas.get(i).getTextoCantidad() == null || listaArmas.get(i).getTextoCantidad().isEmpty()) ? new BigDecimal(0.0) : new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())); + totalPersona.setCantidadmovimiento(cantidad.add(peso)); + totalPersona.setTotal(new BigDecimal(0));//saldoPasaraaAnterior.add((listaArmas==null || listaArmas.get(i).getTextoCantidad()==null)?new BigDecimal(0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())))); + Double suma = 0.0; + //Cantidad + if (listaArmas.get(i).getUnidadMedidaCantidad() != null && !listaArmas.get(i).getUnidadMedidaCantidad().isEmpty()) { + listaArmas.get(i).setCantidad(Double.parseDouble(listaArmas.get(i).getTextoCantidad())); + totalPersona.setUnidadmedidapeso(listaArmas.get(i).getUnidadMedidaCantidad()); + //suma eltotal anterior + la cantidad a ingresar + suma = saldoPasaraaAnterior.doubleValue() + listaArmas.get(i).getCantidad(); + totalPersona.setTotal(new BigDecimal(suma)); + //Peso + } else if (listaArmas.get(i).getUnidadMedidaPeso() != null && !listaArmas.get(i).getUnidadMedidaPeso().isEmpty()) { + listaArmas.get(i).setPeso(Double.parseDouble(listaArmas.get(i).getTextoPeso())); + totalPersona.setUnidadmedidapeso(listaArmas.get(i).getUnidadMedidaPeso()); + //suma eltotal anterior + la cantidad a ingresar + suma = saldoPasaraaAnterior.doubleValue() + listaArmas.get(i).getPeso(); + totalPersona.setTotal(new BigDecimal(suma)); + } + } else {//existe la combinacion + totalPersona = mapaTotalesTemporales.get(usuario.getPk().getPersoncode().toString() + "|" + listaArmas.get(i).getCatalogoClase().getPk().getCatalog() + "|" + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog()); + BigDecimal peso = (listaArmas == null || listaArmas.get(i).getTextoPeso() == null || listaArmas.get(i).getTextoPeso().isEmpty()) ? new BigDecimal(0.0) : new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoPeso())); + BigDecimal cantidad = (listaArmas == null || listaArmas.get(i).getTextoCantidad() == null || listaArmas.get(i).getTextoCantidad().isEmpty()) ? new BigDecimal(0.0) : new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())); + totalPersona.setCantidadmovimiento(cantidad.add(peso).add(totalPersona.getCantidadmovimiento())); + totalPersona.setTotal(totalPersona.getSaldoanterior().add(totalPersona.getCantidadmovimiento()));//saldoPasaraaAnterior.add((listaArmas==null || listaArmas.get(i).getTextoCantidad()==null)?new BigDecimal(0):new BigDecimal(Double.parseDouble(listaArmas.get(i).getTextoCantidad())))); + saldoPasaraaAnterior = totalPersona.getSaldoanterior(); + } + totalPersona.setPk(null); + totalPersona.setPersoncodigo(usuario.getPk().getPersoncode()); + totalPersona.setClase(listaArmas.get(i).getCatalogoClase().getPk().getCatalog()); + totalPersona.setClasecodigo("CLASE"); + totalPersona.setTipoarmaexplosivo(listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog()); + totalPersona.setTipoarmaexplosivocodigo("TIPOARMAEXPLOSIVO"); + totalPersona.setIngresoegreso("ING"); + totalPersona.setCarma(listaArmas.get(i).getArma().getPk()); + totalPersona.setIngresoegresocodigo("ESINGRESOEGRESO"); + totalPersona.setUnidadmedidapesocodigo("UNIDADMEDIDA"); + totalPersona.setFecha(new java.sql.Timestamp(new Date().getTime())); + totalPersona.setSaldoanterior(saldoPasaraaAnterior == null ? new BigDecimal(0) : saldoPasaraaAnterior); + totalPersona.setIsnew(true); + //Verificando si el usuario tiene cupo disponible para el arma + + //mapa con el nuevo total por clase tipo unidad + mapaTotalesTemporales.put(usuario.getPk().getPersoncode().toString() + "|" + listaArmas.get(i).getCatalogoClase().getPk().getCatalog() + "|" + listaArmas.get(i).getCatalogoTipoArma().getPk().getCatalog(), totalPersona); + listaArmas.get(i).setTotalPersona(totalPersona); + //Verificando que el la suma del total con la cantidad de armas + //no sea mayor que el cupo +// if(totalPersona.getTotal().doubleValue()>cupoMaximo){ +// listaErrores.add("Fila "+fila.toString()+": Cupo no disponible para "+listaArmas.get(i).getClase()); +// listaArmas.get(i).setCupoInsuficiente(true); +// }else{ +// //Actualizando el valor del total y del total anterior +// listaArmas.get(i).getTotalPersona().setSaldoanterior(listaArmas.get(i).getTotalPersona().getSaldoanterior()); +// listaArmas.get(i).getTotalPersona().setTotal(totalPersona.getTotal()); +// } + } + + /** + * Metodo que indica cuando una celda esta vacia + * + * @param celda + * @return + */ + public Boolean celdaVacia(Cell celda) { + Boolean vacia = false; + if (celda == null || celda.getCellType() == Cell.CELL_TYPE_BLANK || (celda.getCellType() == Cell.CELL_TYPE_STRING && celda.getStringCellValue().isEmpty())) { + vacia = true; + } + return vacia; + } + + /** + * + * @param codigopersona + * @return + */ + public static TarmArmas findBySerieMarca(String serie, String marca) { + try { + IngresoInventarioController cc = new IngresoInventarioController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("lote", serie); + cc.addFilter("marca", marca); + cc.querydatabaseSimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * + * Metodo para encontrar por marca y tipoarmaexplosivo + * + * @param marca + * @param tipoArmaExplosivo + * @return + * @throws Exception + */ + public static List findByMarcaSerie(String cregistro, String marca, String serie) throws Exception { + + IngresoInventarioController cc = new IngresoInventarioController(); + //cc.init(); + cc.recperpage = 300; + cc.querydatabaseMarcaSerie(cregistro, marca, serie); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + + } + + @SuppressWarnings("finally") + public File generarArchivoError(Long key) { + if (listaErrores.isEmpty()) { + + //MessageHelper.setMessageInfo("ARCHIVO SUBIDO CORRECTAMENTE"); + return null; + } + PrintWriter escribir = null; + File archivo = null; + try { + archivo = File.createTempFile("errorlog" + key, ".txt"); + escribir = new PrintWriter(archivo); + + for (String err : listaErrores) { + System.out.println(err); + + escribir.print(err + "\r\n"); + } + //escribir.close(); + limpiar(); + + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } finally { + escribir.flush(); + escribir.close(); + return archivo; + } + + } + + /** + * Llama a la construccion del metodo para recargar + */ + public void descargarArchivo() { + + Long key = new Date().getTime(); + File archivoTemporal = generarArchivoError(key); + if (archivoTemporal == null) { + return; + } + try { + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + response.addHeader("Content-disposition", "attachment; filename=errorlog" + key + ".txt"); + OutputStream out = response.getOutputStream(); + InputStream inputStream = new FileInputStream(archivoTemporal.getAbsolutePath()); + + int read = 0; + byte[] bytes = new byte[1024]; + + while ((read = inputStream.read(bytes)) != -1) { + out.write(bytes, 0, read); + } + + inputStream.close(); + out.flush(); + + FacesContext.getCurrentInstance().responseComplete(); + + } catch (Exception e) { + // TODO: handle exception + } + } + + /** + * Limpia las los valores en las listas + */ + public void limpiar() { + try { + create(); + while (lrecord.iterator().hasNext()) { + record = lrecord.get(0); + remove(); + } + listaArmas = new ArrayList(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Carga las listas de cantones y limpia la lista de ciudades + */ + public void seleccionarProvincia() { + try { + codigoProvincia = this.record.getProvincecode(); + lcantones = CantonController.find("EC", record.getProvincecode()); + lciudades = new ArrayList<>(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Carga las listas de ciudades + */ + public void seleccionarCanton() { + try { + codigoCanton = this.record.getCantoncode(); + lciudades = CityController.find("EC", record.getProvincecode(), record.getCantoncode()); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void cargarDocumentosHabilitantes(String categoria) { + ldocumentospersona = new ArrayList<>(); + List listadocum = DocumentoHabilitanteController.findpersoncodeInventario(usuario.getPk().getPersoncode().toString(), categoria); + //Forma nmero 1 (Uso de Maps). + Map mapPersonas = new HashMap(listadocum.size()); + for (TarmDocumentoHabilitante p : listadocum) { + mapPersonas.put(p.getCtramite(), p); + } + //Agrego cada elemento del map a una nueva lista y muestro cada elemento. + System.out.println("Lista sin repetidos:"); + for (Entry p : mapPersonas.entrySet()) { + // Se cargan las categorias diferentes a armas de fuego y armas no letales +// if(!p.getValue().getModifiedData().get("clase").toString().contains("0010000001")||!p.getValue().getModifiedData().get("clase").toString().contains("0010000008")){ + ldocumentospersona.add(p.getValue()); +// } + } +// ldocumentospersona =DocumentoHabilitanteController.findpersoncode(usuario.getPk().getPersoncode().toString(),categoria); + } + + public void cambioTipoRegistro() { + if (registro.getTiporegistro() != null) { + cargarDocumentosHabilitantes("4");//4 Fabrica, 5Fabricante + } else { + ldocumentospersona = new ArrayList<>(); + } + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public String getCodigoProvincia() { + return codigoProvincia; + } + + public void setCodigoProvincia(String codigoProvincia) { + this.codigoProvincia = codigoProvincia; + } + + public String getCodigoCanton() { + return codigoCanton; + } + + public void setCodigoCanton(String codigoCanton) { + this.codigoCanton = codigoCanton; + } + + public String getCodigoCiudad() { + return codigoCiudad; + } + + public void setCodigoCiudad(String codigoCiudad) { + this.codigoCiudad = codigoCiudad; + } + + String codigoCiudad; + + public void codigoCiudad() { + + } + + public void addPersoncodeFilter(String personcode) { + super.addFilter("pk.personcode", personcode); + } + + public List getLarmexcell() { + return listaArmas; + } + + public void setLarmexcell(List larmexcell) { + this.listaArmas = larmexcell; + } + + public ArmaExcell getArmaexcell() { + return armaexcell; + } + + public void setArmaexcell(ArmaExcell armaexcell) { + this.armaexcell = armaexcell; + } + + public TarmTipoArmaExplosivo getTipoarmexplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoarmexplosivo(TarmTipoArmaExplosivo tipoarmexplosivo) { + this.tipoArmaExplosivo = tipoarmexplosivo; + } + + public List getLaexel() { + return laexel; + } + + public void setLaexel(List laexel) { + this.laexel = laexel; + } + + public TcustPersonDetail getDetallesPersona() { + return detallesPersona; + } + + public void setDetallesPersona(TcustPersonDetail detallesPersona) { + this.detallesPersona = detallesPersona; + } + + public TcustPersonDetail getUsuario() { + return usuario; + } + + public void setUsuario(TcustPersonDetail usuario) { + this.usuario = usuario; + } + + public List getListaFilas() { + return listaFilas; + } + + public void setListaFilas(List listaFilas) { + this.listaFilas = listaFilas; + } + + public List getListaErrores() { + return listaErrores; + } + + public void setListaErrores(List listaErrores) { + this.listaErrores = listaErrores; + } + + public TarmTipoArmaExplosivo getTipoArmaExplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoArmaExplosivo(TarmTipoArmaExplosivo tipoArmaExplosivo) { + this.tipoArmaExplosivo = tipoArmaExplosivo; + } + + public List getListaArmas() { + return listaArmas; + } + + public void setListaArmas(List listaArmas) { + this.listaArmas = listaArmas; + } + + public PersonAddressController getPersonAddressController() { + return personAddressController; + } + + public void setPersonAddressController( + PersonAddressController personAddressController) { + this.personAddressController = personAddressController; + } + + public InputStream getFilei() { + return filei; + } + + public void setFilei(InputStream filei) { + this.filei = filei; + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public TcustPersonAddress getDireccion() { + return direccion; + } + + public void setDireccion(TcustPersonAddress direccion) { + this.direccion = direccion; + } + +// public List getCuposArmas() { +// return cuposArmas; +// } +// +// public void setCuposArmas(List cuposArmas) { +// this.cuposArmas = cuposArmas; +// } +// public ComercianteCupoController getComercianteCupoController() { +// return comercianteCupoController; +// } +// +// public void setComercianteCupoController( +// ComercianteCupoController comercianteCupoController) { +// this.comercianteCupoController = comercianteCupoController; +// } + public Boolean getDescargar() { + return descargar; + } + + public void setDescargar(Boolean descargar) { + this.descargar = descargar; + } + + public RegistroArmController getRegistroArmasController() { + return registroArmasController; + } + + public void setRegistroArmasController( + RegistroArmController registroArmasController) { + this.registroArmasController = registroArmasController; + } + + public TotalArmasController getTotalPersonaController() { + return totalPersonaController; + } + + public void setTotalPersonaController( + TotalArmasController totalPersonaController) { + this.totalPersonaController = totalPersonaController; + } + + public TgeneCountry getPais() { + return pais; + } + + public void setPais(TgeneCountry pais) { + this.pais = pais; + } + + public List getLciudades() { + return lciudades; + } + + public void setLciudades(List lciudades) { + this.lciudades = lciudades; + } + + public TgeneCity getCiudad() { + return ciudad; + } + + public void setCiudad(TgeneCity ciudad) { + this.ciudad = ciudad; + } + + public List getArmas() { + return armas; + } + + public void setArmas(List armas) { + this.armas = armas; + } + + public List getTotalesPersoan() { + return totalesPersoan; + } + + public void setTotalesPersoan(List totalesPersoan) { + this.totalesPersoan = totalesPersoan; + } + + public TgeneCatalogDetail getTipoDocumento() { + return tipoDocumento; + } + + public void setTipoDocumento(TgeneCatalogDetail tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public List getTiposRegistro() { + return tiposRegistro; + } + + public void setTiposRegistro(List tiposRegistro) { + this.tiposRegistro = tiposRegistro; + } + + public TgeneCatalogDetail getTipoRegistro() { + return tipoRegistro; + } + + public void setTipoRegistro(TgeneCatalogDetail tipoRegistro) { + this.tipoRegistro = tipoRegistro; + } + + public List getLpaises() { + return lpaises; + } + + public void setLpaises(List lpaises) { + this.lpaises = lpaises; + } + + public List getLprovincias() { + return lprovincias; + } + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + public TarmRegistroArmas getRegistro() { + return registro; + } + + public void setRegistro(TarmRegistroArmas registro) { + this.registro = registro; + } + + public List getLaeropuertos() { + return laeropuertos; + } + + public void setLaeropuertos(List laeropuertos) { + this.laeropuertos = laeropuertos; + } + + public List getLdocumentospersona() { + return ldocumentospersona; + } + + public void setLdocumentospersona( + List ldocumentospersona) { + this.ldocumentospersona = ldocumentospersona; + } + + public String getClase() { + return clase; + } + + public void setClase(String clase) { + this.clase = clase; + } + + public Integer getPersoncode() { + return personcode; + } + + public void setPersoncode(Integer personcode) { + this.personcode = personcode; + } + + public InventarioSubidoController getInventarioSubidoController() { + return inventarioSubidoController; + } + + public void setInventarioSubidoController( + InventarioSubidoController inventarioSubidoController) { + this.inventarioSubidoController = inventarioSubidoController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/InventarioSubidoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/InventarioSubidoController.java new file mode 100644 index 0000000..c8cdb12 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/InventarioSubidoController.java @@ -0,0 +1,135 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmInventarioSubidoPorPersona; + +/** + * Clase controladora del bean TgeneCatalogDetail. + * + * @author Christian Pazmino. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class InventarioSubidoController extends AbstractController { + + public InventarioSubidoController() throws Exception { + super(TarmInventarioSubidoPorPersona.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "INVENTARIOSUBIDOPERSONA"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void update(TarmInventarioSubidoPorPersona bean) throws Exception { + record = bean; + update(); + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * + * @param catalogcode Có de catálogo + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static List findXPersonaYClase(String personcode, String clase) { + try { + InventarioSubidoController cc = new InventarioSubidoController(); + cc.init(); + cc.recperpage = 10; + cc.addFilter("pk.personcode", personcode); + cc.addFilter("pk.clase", clase); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/LongitudLovController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/LongitudLovController.java new file mode 100644 index 0000000..ebcd36a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/LongitudLovController.java @@ -0,0 +1,117 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class LongitudLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public LongitudLovController() throws Exception { + super(TgeneCatalogDetail.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "LONGITUDLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + this.getMfilters().put("pk.catalogcode", "LONGITUD"); + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog(TgeneCatalogDetail tgeneCatalogDetail) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneCatalogDetail); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/longitudLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/OrigenTramiteController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/OrigenTramiteController.java new file mode 100644 index 0000000..fbfdd22 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/OrigenTramiteController.java @@ -0,0 +1,457 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmOrigenTramite; +import com.fp.persistence.parmas.param.TarmOrigenTramiteKey; +import com.fp.persistence.parmas.param.TarmTipoTramite; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora de ingreso de tramites de control de armas. + * + * @author Jorge Vaca. + * @author dcruz + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class OrigenTramiteController extends AbstractController { + + private TarmTipoTramite tipoTramite; + private String origenAdquisicion; + private String tipoPersona; + private String tipoDeTramite; + private String tipoAutorizacion; + private String categoria; + private String actividad; + private String tipoDeTramiteD; + private String tipoAutorizacionD; + private String categoriaD; + private String actividadD; + private String origenAdquisicionD; + /** + * Trámite seleccionado + */ + private TarmTramite tarmTramite; + + /** + * Lista de origen de adquisición + */ + private List lorigenadquisicion; + + public OrigenTramiteController() throws Exception { + super(TarmOrigenTramite.class); + } + + @PostConstruct + private void postconstruct() { + try { + init(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + * + * @throws Exception + */ + private void init() throws Exception { + try { + this.beanalias = "ORIGENTRAMITE"; + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList(); + this.record = new TarmOrigenTramite(); + this.record.setPk(new TarmOrigenTramiteKey()); + lorigenadquisicion = CatalogDetailController.find("ORIGENADQUISICION"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + try { + if ((this.origenAdquisicion == null || this.origenAdquisicion.equals("")) && this.tarmTramite == null) { + MessageHelper.setMessageError("DEBE SELECCIONAR UN TRAMITE O UN ORIGEN DE ADQUISICIN PARA REALIZAR LA BUSQUEDA"); + return; + } + + Boolean existeFiltro = Boolean.FALSE; + DtoQuery dto = super.getDtoQuery(true); + + SubQuery tramiteSQ = new SubQuery("TgeneCatalogDetail", "description", "tipoAutorizacion", + "i.pk.catalog = (select a.tipoautorizacion from TarmTramite a where a.pk = t.pk.ctramite) " + + " and " + + "i.pk.catalogcode = (select a.tipoautorizacioncodigo from TarmTramite a where a.pk = t.pk.ctramite)"); + dto.addSubQuery(tramiteSQ); + + SubQuery tipoTramiteSQ = new SubQuery("TgeneCatalogDetail", "description", "tipoDeTramite", + "i.pk.catalog = (select a.tipotramite from TarmTramite a where a.pk = t.pk.ctramite) " + + " and " + + "i.pk.catalogcode = (select a.tipotramitecodigo from TarmTramite a where a.pk = t.pk.ctramite)"); + dto.addSubQuery(tipoTramiteSQ); + + SubQuery categoriaSQ = new SubQuery("TgeneCatalogDetail", "description", "categoria", + "i.pk.catalog = (select a.categoria from TarmTramite a where a.pk = t.pk.ctramite) " + + " and " + + "i.pk.catalogcode = (select a.categoriacodigo from TarmTramite a where a.pk = t.pk.ctramite)"); + dto.addSubQuery(categoriaSQ); + + SubQuery usoActividadSQ = new SubQuery("TgeneCatalogDetail", "description", "actividad", + "i.pk.catalog = (select a.usoactividad from TarmTramite a where a.pk = t.pk.ctramite) " + + " and " + + "i.pk.catalogcode = (select a.usoactividadcodigo from TarmTramite a where a.pk = t.pk.ctramite)"); + dto.addSubQuery(usoActividadSQ); + + SubQuery adquisicionSQ = new SubQuery("TgeneCatalogDetail", "description", "adquisicion", + "i.pk.catalog = t.pk.origencatalog and i.pk.catalogcode = t.pk.origencatalogcode"); + dto.addSubQuery(adquisicionSQ); + + Filter filtro = new Filter(); + StringBuilder sql = new StringBuilder(); + if (this.origenAdquisicion != null && !this.origenAdquisicion.equals("")) { + sql.append("t.pk.origencatalog='" + this.origenAdquisicion + "'"); + existeFiltro = Boolean.TRUE; + } + if (this.tarmTramite != null) { + if (this.origenAdquisicion != null && !this.origenAdquisicion.equals("")) { + sql.append(" and "); + } + sql.append("t.pk.ctramite='" + this.tarmTramite.getPk() + "'"); + existeFiltro = Boolean.TRUE; + } + if (existeFiltro) { + filtro.setSql(sql.toString()); + dto.addFiltro(filtro); + } + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + protected void querydatabasesimple() { + try { + + Boolean existeFiltro = Boolean.FALSE; + DtoQuery dto = super.getDtoQuery(true); + Filter filtro = new Filter(); + StringBuilder sql = new StringBuilder(); + + if (this.tarmTramite != null) { + sql.append("t.pk.ctramite='" + this.tarmTramite.getPk() + "'"); + existeFiltro = Boolean.TRUE; + } + if (existeFiltro) { + filtro.setSql(sql.toString()); + dto.addFiltro(filtro); + } + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Abre el LOV de trámite + */ + public void openLovTramite() { + Map> params = new HashMap>(); + List ltipopersona = new ArrayList<>(); + +// ltipopersona.add(ParametersController.find("CODIGO.PERSONTYPE.NATURAL", "1").getTextvalue());//1 +// +// ltipopersona.add(ParametersController.find("CODIGO.PERSONTYPE.JURIDICA", "1").getTextvalue());//2 +// +// +// params.put("tipopersonasol", ltipopersona); + BuscarTramiteLovController.openLov(params); + } + + /** + * Regresa del LOV para cargar valores + * + * @param event {@link SelectEvent} + */ + public void onReturnTramite(SelectEvent event) { + try { + TarmTramite tramite = (TarmTramite) event.getObject(); + this.tarmTramite = tramite; + TgeneCatalogDetail tipoTramiteCD = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + TgeneCatalogDetail tipoAutorizacionCD = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail categoriaCD = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + TgeneCatalogDetail actividadCD = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + tipoDeTramite = tipoTramiteCD != null ? tipoTramiteCD.getDescription() : ""; + tipoAutorizacion = tipoAutorizacionCD != null ? tipoAutorizacionCD.getDescription() : ""; + categoria = categoriaCD != null ? categoriaCD.getDescription() : ""; + actividad = actividadCD != null ? actividadCD.getDescription() : ""; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Regresa del LOV para cargar valores + * + * @param event {@link SelectEvent} + */ + public void onReturnTramiteDialog(SelectEvent event) { + try { + TarmTramite tramite = (TarmTramite) event.getObject(); + this.tarmTramite = tramite; + TgeneCatalogDetail tipoTramiteCD = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + TgeneCatalogDetail tipoAutorizacionCD = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail categoriaCD = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + TgeneCatalogDetail actividadCD = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + TgeneCatalogDetail adquisicionCD = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + record.getModifiedData().put("tipoDeTramite", tipoTramiteCD != null ? tipoTramiteCD.getDescription() : ""); + record.getModifiedData().put("tipoAutorizacion", tipoAutorizacionCD != null ? tipoAutorizacionCD.getDescription() : ""); + record.getModifiedData().put("categoria", categoriaCD != null ? categoriaCD.getDescription() : ""); + record.getModifiedData().put("actividad", actividadCD != null ? actividadCD.getDescription() : ""); + record.getModifiedData().put("adquisicion", adquisicionCD != null ? adquisicionCD.getDescription() : ""); + this.record.getPk().setCtramite(tramite.getPk()); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Regresa del LOV para cargar valores + * + * @param tarmTramite Tarm Tramite + * @param event {@link SelectEvent} + */ + public static List findOrigenTramite(TarmTramite tarmTramite) { + try { + OrigenTramiteController cc = new OrigenTramiteController(); + cc.init(); + cc.recperpage = 1000; + cc.setTarmTramite(tarmTramite); + cc.querydatabasesimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Actualiza la lista de registros a grabar + * + * @throws Exception + */ + public void update() throws Exception { + + if (this.record.getPk().getCtramite() == null) { + MessageHelper.setMessageError("DEBE SELECCIONAR UN TRAMITE", "formOrigenTramiteDialog"); + return; + } + + this.record.getPk().setOrigencatalogcode("ORIGENADQUISICION"); + TgeneCatalogDetail adquisicionCD = CatalogDetailController.findxCodigoCodcatalogo(this.record.getPk().getOrigencatalog(), this.record.getPk().getOrigencatalogcode()); + record.getModifiedData().put("adquisicion", adquisicionCD != null ? adquisicionCD.getDescription() : ""); + super.update(); + tarmTramite = null; + origenAdquisicion = null; + } + + public TarmTipoTramite getTipoTramite() { + return tipoTramite; + } + + public void setTipoTramite(TarmTipoTramite tipoTramite) { + this.tipoTramite = tipoTramite; + } + + public String getOrigenAdquisicion() { + return origenAdquisicion; + } + + public void setOrigenAdquisicion(String origenAdquisicion) { + this.origenAdquisicion = origenAdquisicion; + } + + public List getLorigenadquisicion() { + return lorigenadquisicion; + } + + public void setLorigenadquisicion(List lorigenadquisicion) { + this.lorigenadquisicion = lorigenadquisicion; + } + + public String getTipoPersona() { + return tipoPersona; + } + + public void setTipoPersona(String tipoPersona) { + this.tipoPersona = tipoPersona; + } + + public TarmTramite getTarmTramite() { + return tarmTramite; + } + + public void setTarmTramite(TarmTramite tarmTramite) { + this.tarmTramite = tarmTramite; + } + + public String getTipoAutorizacion() { + return tipoAutorizacion; + } + + public void setTipoAutorizacion(String tipoAutorizacion) { + this.tipoAutorizacion = tipoAutorizacion; + } + + public String getCategoria() { + return categoria; + } + + public void setCategoria(String categoria) { + this.categoria = categoria; + } + + public String getActividad() { + return actividad; + } + + public void setActividad(String actividad) { + this.actividad = actividad; + } + + public String getTipoDeTramite() { + return tipoDeTramite; + } + + public void setTipoDeTramite(String tipoDeTramite) { + this.tipoDeTramite = tipoDeTramite; + } + + public String getTipoDeTramiteD() { + return tipoDeTramiteD; + } + + public void setTipoDeTramiteD(String tipoDeTramiteD) { + this.tipoDeTramiteD = tipoDeTramiteD; + } + + public String getTipoAutorizacionD() { + return tipoAutorizacionD; + } + + public void setTipoAutorizacionD(String tipoAutorizacionD) { + this.tipoAutorizacionD = tipoAutorizacionD; + } + + public String getCategoriaD() { + return categoriaD; + } + + public void setCategoriaD(String categoriaD) { + this.categoriaD = categoriaD; + } + + public String getActividadD() { + return actividadD; + } + + public void setActividadD(String actividadD) { + this.actividadD = actividadD; + } + + public String getOrigenAdquisicionD() { + return origenAdquisicionD; + } + + public void setOrigenAdquisicionD(String origenAdquisicionD) { + this.origenAdquisicionD = origenAdquisicionD; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/PreguntasParaEvaluacionesController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/PreguntasParaEvaluacionesController.java new file mode 100644 index 0000000..0b40e0c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/PreguntasParaEvaluacionesController.java @@ -0,0 +1,478 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.eval.RespuestasController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.eval.TarmPreguntas; +import com.fp.persistence.parmas.eval.TarmRespuestas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TarmPreguntas. + * + * @author Christian Pazmino + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class PreguntasParaEvaluacionesController extends + AbstractController { + + /** + * Lista de catalogos de tipos de evaluaciones + */ + List lTipoEvaluacion; + /** + * Lista de catalogos de tipos de personas + */ + List lTipoPersona; + /** + * Lista de catalogos de tipos de estados de preguntas + */ + List lEstados; + /** + * Variable tipo map utilizada para generar el numero de pregunta segun el + * tipo de persona y tipo de evaluacion escogidos + */ + private Map numeroPreguntaMAP = new HashMap(); + /** + * Constante usada para referirse al codigo de tipo de evaluacion + */ + private final String TIPOEVALUACIONCODIGO = "TIPOEVALUACION"; + /** + * Constante usada para referirse al codigo de tipo de persona + */ + private final String TIPOPERSONACODIGO = "PERSONTYPE"; + /** + * Constante usada para referirse a codigo de estado de preguntas + */ + private final String ESTADOPREGUNTACODIGO = "ESTADOPRUEBAS"; + /** + * Variable de tipo boleano para indicar si el dialog esta en modo edicion o + * creacion + */ + private Boolean esEdicionBln; + /** + * Variable de tipo boleano para indicar si existe alguna respuesta a la + * pregunta + */ + private Boolean existeRespuestasBln; + + public PreguntasParaEvaluacionesController() throws Exception { + super(TarmPreguntas.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + lTipoEvaluacion = CatalogDetailController.find("TIPOEVALUACION"); + lTipoPersona = CatalogDetailController.find(TIPOPERSONACODIGO); + lEstados = CatalogDetailController.find("ESTADOPRUEBAS"); + if (lEstados != null && lEstados.size() == 2) { + TgeneCatalogDetail activado = lEstados.get(0); + lEstados.set(0, lEstados.get(1)); + lEstados.set(1, activado); + + } + for (TgeneCatalogDetail tEvaluacion : lTipoEvaluacion) { + for (TgeneCatalogDetail tPersona : lTipoPersona) { + numeroPreguntaMAP.put(tEvaluacion.getPk().getCatalog() + + tPersona.getPk().getCatalog(), 0); + } + } + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Método de busqueda que consulta una lista de preguntas mediante + * codigo de evaluacion y codigo de persona + * + * @param String codigoEvaluacion + * @param String codigoPersona + * @return List lista de pregunta + */ + public List findByCodEvaluacionPersona(String codigoEvaluacion, String codigoPersona) { + try { + PreguntasParaEvaluacionesController cc = new PreguntasParaEvaluacionesController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("tipoevaluacion", codigoEvaluacion); + cc.addFilter("tipopersona", codigoPersona); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Método que obtiene el numero de pregunta + * + * @param String codigo Evaluacion + * @param String codigo Persona + * @return numero de pregunta + */ + private void generaNumeroPregunta(String codigoEvaluacion, String codigoPersona) { + if (codigoEvaluacion != null && codigoPersona != null) { + List lista = findByCodEvaluacionPersona(codigoEvaluacion, codigoPersona); + if (lista != null) { + Integer ultimoValor = 0; + for (TarmPreguntas pregunta : lista) { + if ((codigoEvaluacion.compareTo(pregunta.getTipoevaluacion()) == 0) && (codigoPersona.compareTo(pregunta.getTipopersona()) == 0)) { + if (ultimoValor < pregunta.getNumeropregunta()) { + ultimoValor = pregunta.getNumeropregunta(); + } + } + } + record.setNumeropregunta(ultimoValor + 1); + } else { + record.setNumeropregunta(1); + } + } else { + record.setNumeropregunta(null); + } + } + + /** + * Método que gestiona el cambio de tipo de evaluacion por parte del + * usuario en el dialogo de crear + * + * @return numero de pregunta + */ + public void setNombreTipoEvaluacion() { + for (TgeneCatalogDetail r : lTipoEvaluacion) { + if (r.getPk().getCatalog().compareTo(record.getTipoevaluacion()) == 0) { + record.put("nTipoEvaluacion", r.getDescription()); + } + } + record.setTipoevaluacioncodigo(TIPOEVALUACIONCODIGO); + generaNumeroPregunta(record.getTipoevaluacion(), record.getTipopersona()); + } + + /** + * Método que gestiona el cambio de tipo de persona por parte del + * usuario en el dialogo de crear + */ + public void setNombreTipoPersona() { + for (TgeneCatalogDetail r : lTipoPersona) { + if (r.getPk().getCatalog().compareTo(record.getTipopersona()) == 0) { + record.put("nTipoPersona", r.getDescription()); + } + } + record.setTipopersonacodigo(TIPOPERSONACODIGO); + generaNumeroPregunta(record.getTipoevaluacion(), record.getTipopersona()); + } + + /** + * Método que devuelve el estado de la pregunta + */ + public void setEstadoPregunta() { + for (TgeneCatalogDetail r : lEstados) { + if (r.getPk().getCatalog().compareTo(record.getEstadopregunta()) == 0) { + record.put("nEstado", r.getDescription()); + } + } + record.setEstadopreguntacodigo(ESTADOPREGUNTACODIGO); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "PREGUNTASPARAEVALUACIONES"; + esEdicionBln = Boolean.FALSE; + existeRespuestasBln = Boolean.FALSE; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + + for (TgeneCatalogDetail estadoObj : lEstados) { + if (estadoObj.getPk().getCatalog().equalsIgnoreCase("INA")) { + record.setEstadopregunta("INA"); + record.setEstadopreguntacodigo(ESTADOPREGUNTACODIGO); + record.getModifiedData().put("nEstado", estadoObj.getDescription()); + } + } + esEdicionBln = Boolean.FALSE; + existeRespuestasBln = Boolean.FALSE; + } + + /** + * Metodo ejecutado al editar un item de la tabla + */ + public void edicion() { + esEdicionBln = Boolean.TRUE; + existeRespuestasBln = consultarExisteResuestas(); + } + + /** + * Metodo que verifica si existe o no al menos una respuesta para la + * pregunta + */ + public Boolean consultarExisteResuestas() { + List respuestaList = RespuestasController.findxPregunta(record.getPk().toString()); + if (respuestaList != null && respuestaList.size() > 0) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.numeropregunta"); + // Subquery + SubQuery subqueryTipoEval = new SubQuery("TgeneCatalogDetail", + "description", "nTipoEvaluacion", + "i.pk.catalog = t.tipoevaluacion and i.pk.catalogcode = t.tipoevaluacioncodigo"); + dto.addSubQuery(subqueryTipoEval); + + // Subquery + SubQuery subqueryTipoPers = new SubQuery("TgeneCatalogDetail", + "description", "nTipoPersona", + "i.pk.catalog = t.tipopersona and i.pk.catalogcode = t.tipopersonacodigo"); + dto.addSubQuery(subqueryTipoPers); + + // Subquery de Estado Pregunta + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", + "description", "nEstado", + "i.pk.catalog = t.estadopregunta and i.pk.catalogcode = t.estadopreguntacodigo"); + dto.addSubQuery(subqueryEstado); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (lEstados == null) { + lEstados = CatalogDetailController.find("ESTADOPRUEBAS"); + } + for (TarmPreguntas pregunta : lrecord) { + for (TgeneCatalogDetail estado : lEstados) { + if (pregunta.getEstadopregunta() != null && pregunta.getEstadopregunta().equalsIgnoreCase(estado.getPk().getCatalog())) { + pregunta.modifiedData.put("nEstado", estado.getDescription()); + } + } + } + + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Consulta preguntas por codigo de pregunta + * + * @param cpreguntas + * @return + * @throws Exception + */ + public static List find(String cpreguntas) throws Exception { + PreguntasParaEvaluacionesController r = new PreguntasParaEvaluacionesController(); + r.addFilter("pk", cpreguntas); + r.querydatabase(); + return r.getLrecord(); + } + + /** + * Consulta todas las preguntas filtradas por tipo de persona y por tipo de + * evaluacion + */ + public static List findxPregunta(String tipopersona, String tipoevaluacion) { + try { + PreguntasParaEvaluacionesController cc = new PreguntasParaEvaluacionesController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("tipopersona", tipopersona); + cc.addFilter("tipoevaluacion", tipoevaluacion); + cc.addFilter("estadopregunta", "ACT"); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca en la lista de estados la descripcion del codigo de estado recibido + * como parametro + */ + public String descripcionEstadoPregunta(String estadoCodigo) { + String estado = ""; + + for (TgeneCatalogDetail e : lEstados) { + if (estadoCodigo.equalsIgnoreCase(e.getPk().getCatalog())) { + return e.getDescription(); + } + } + + return estado; + } + + public List getlTipoEvaluacion() { + return lTipoEvaluacion; + } + + public void setlTipoEvaluacion(List lTipoEvaluacion) { + this.lTipoEvaluacion = lTipoEvaluacion; + } + + public List getlTipoPersona() { + return lTipoPersona; + } + + public void setlTipoPersona(List lTipoPersona) { + this.lTipoPersona = lTipoPersona; + } + + public Map getNumeroPreguntaMAP() { + return numeroPreguntaMAP; + } + + public void setNumeroPreguntaMAP(Map numeroPreguntaMAP) { + this.numeroPreguntaMAP = numeroPreguntaMAP; + } + + public Boolean getEsEdicionBln() { + return esEdicionBln; + } + + public void setEsEdicionBln(Boolean esEdicionBln) { + this.esEdicionBln = esEdicionBln; + } + + public Boolean getExisteRespuestasBln() { + return existeRespuestasBln; + } + + public void setExisteRespuestasBln(Boolean existeRespuestasBln) { + this.existeRespuestasBln = existeRespuestasBln; + } + + /** + * Abre el dialogo de respuestas desde la pantalla principal para la + * pregunta seleccionada + */ + public void openRespuestasLov(TarmPreguntas preguntaSel) { + Map> params = new HashMap<>(); + List preguntaPKLst = new ArrayList<>(); + preguntaPKLst.add(preguntaSel.getPk().toString()); + params.put("preguntaPK", preguntaPKLst); + RespuestasLovController.openLov(params); + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo de respuestas + */ + public void onReturnRespuestasLov(SelectEvent event) throws Exception { + System.out.println("*** Retorna del LOV de respuestas..."); +// querydatabase(); + } + + public List getlEstados() { + return lEstados; + } + + public void setlEstados(List lEstados) { + this.lEstados = lEstados; + } + + /** + * Metodo usado por controladores externos para cargar en el bean pasado + * como parametro en la variable record + */ + public void update(TarmPreguntas bean) throws Exception { + record = bean; + update(); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/RequisitoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/RequisitoController.java new file mode 100644 index 0000000..4756bfc --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/RequisitoController.java @@ -0,0 +1,227 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmRequisito; +import com.fp.persistence.parmas.param.TarmRequisitoPorTipoTramite; + +/** + * Clase controladora del bean TarmRequisito. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RequisitoController extends AbstractController { + + public RequisitoController() throws Exception { + super(TarmRequisito.class); + } + + @ManagedProperty(value = "#{requisitoPorTramiteController}") + private RequisitoPorTramiteController requisitoPorTramiteController; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "REQUISITO"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + record.setActive("Y"); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + HashMap msave = new HashMap(); + Request request = callerhelper.getRequest(); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + dtosave.setPosition(1); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + for (TarmRequisito requisito : lrecord) { + if (requisito.getActive() != null && requisito.getActive().equals("N")) { + //consulta de requisitosportramite + requisitoPorTramiteController.setLrecord(RequisitoPorTramiteController.findxrequisito(requisito.getPk())); + if (requisitoPorTramiteController.getLrecord() != null) { + for (TarmRequisitoPorTipoTramite requisitoPorTipoTramite : requisitoPorTramiteController.getLrecord()) { + requisitoPorTramiteController.setRecord(requisitoPorTipoTramite); + requisitoPorTramiteController.getRecord().setActive("N"); + requisitoPorTramiteController.update(); + } + } + } + } + + DtoSave dtosaverequisitotramite = requisitoPorTramiteController.getDtoSave(); + dtosaverequisitotramite.setPosition(2); + msave.put(requisitoPorTramiteController.getBeanalias(), dtosaverequisitotramite); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + public void eliminar(TarmRequisito requisito) throws Exception { + requisito.setActive("N"); + setRecord(requisito); + super.update(); + } + + /** + * Entrega una lista de requisitos. + * + * @return List + */ + public static List find() { + try { + RequisitoController cc = new RequisitoController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + public static List findActivos() { + try { + RequisitoController cc = new RequisitoController(); + cc.init(); + cc.recperpage = 300; + cc.getMfilters().put("active", "Y"); + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Método que retorna un Requisito en base al id enviado + * + * @param crequisito + * @return + */ + public static TarmRequisito findxId(String crequisito) { + try { + RequisitoController cc = new RequisitoController(); + cc.getMfilters().put("pk", crequisito); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + public RequisitoPorTramiteController getRequisitoPorTramiteController() { + return requisitoPorTramiteController; + } + + public void setRequisitoPorTramiteController( + RequisitoPorTramiteController requisitoPorTramiteController) { + this.requisitoPorTramiteController = requisitoPorTramiteController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/RequisitoPorTramiteController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/RequisitoPorTramiteController.java new file mode 100644 index 0000000..e0d9ca4 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/RequisitoPorTramiteController.java @@ -0,0 +1,437 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmRequisito; +import com.fp.persistence.parmas.param.TarmRequisitoPorTipoTramite; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean requisitos por tramite, tabla + * TarmRequisitoPorTipoTramite + * + * @author Christian Pazmino + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean(name = "requisitoPorTramiteController") +@ViewScoped +public class RequisitoPorTramiteController extends + AbstractController { + + /** + * Lista de tipos de tramites + */ + List ltipotramite; + + /** + * Lista de tipos de requisitos + */ + List lrequisito; + + /** + * Booleano que indica si el deposito es por tramite + */ + private boolean depositoPorTramite; + /** + * Booleano que indica si el deposito es por custodio + */ + private boolean depositoPorCustodio; + /** + * Codigo de tramite + */ + private Long cTramite; + + public RequisitoPorTramiteController() throws Exception { + super(TarmRequisitoPorTipoTramite.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + ltipotramite = CatalogDetailController.find("TIPOTRAMITE"); + lrequisito = RequisitoController.findActivos(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "REQUISITOPORTRAMITE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TarmRequisitoPorTipoTramite y marca el registro + * como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (cTramite == null) { + MessageHelper.setMessageError("POR FAVOR SELECCIONE UN TR\u00c1MITE"); + return; + } + super.create(); + this.record.setActive("Y"); + depositoPorCustodio = false; + depositoPorTramite = false; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if (cTramite != null) { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.crequisito"); + Filter filtro = new Filter(); + filtro.setSql(" t.active = 'Y'"); + dto.addFiltro(filtro); + // Subquery + SubQuery subquerypk = new SubQuery("TarmRequisito", "pk", "crequisito", "i.pk = t.pk.crequisito"); + dto.addSubQuery(subquerypk); + SubQuery subquery = new SubQuery("TarmRequisito", "nombre", "nrequisito", "i.pk = t.pk.crequisito"); + dto.addSubQuery(subquery); + SubQuery subqueryDescCorta = new SubQuery("TarmRequisito", "descripcioncorta", "ndescripcion", "i.pk = t.pk.crequisito"); + dto.addSubQuery(subqueryDescCorta); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp + .get(beanalias); + super.postQuery(lrecord); + } + } else { + MessageHelper.setMessageError("POR FAVOR SELECCIONE UN TR\u00c1MITE"); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaseConsultas() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.crequisito"); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Actualiza datos de registros nuevos o modifiados, si el registro es nuevo + * se adiciona a lista de nuevos, si es actualizado se adiciona a la lista + * de actualizados. + * + * @throws Exception + */ + @Override + public void update() throws Exception { + List lista = findInactiveTramiteRequisito(cTramite.toString(), record.getPk().getCrequisito()); + if (lista != null && !lista.isEmpty()) { + System.out.println("existe resultado : " + lista.get(0).getPk().getCrequisito() + "------------- " + lista.get(0).getPk().getCtramite()); + record.setIsnew(false); + record.put("ORIGINALBEAN", lista.get(0).get("ORIGINALBEAN")); + this.lrecord.add(record); + } + super.update(); + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void borrarRequisitos() { + try { + this.record.setActive("N"); + update(); + this.lrecord.remove(this.record); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Fija la descripcion del requisito desde el dialogo de requisitos en el + * objeto record a persistir + */ + public void setNombreReqisito() { + for (TarmRequisito r : lrequisito) { + if (r.getPk().compareTo(record.getPk().getCrequisito()) == 0) { + record.put("nrequisito", r.getNombre()); + } + } + record.getPk().setCtramite(cTramite); + } + + public List getLtipotramite() { + return ltipotramite; + } + + public void setLtipotramite(List ltipotramite) { + this.ltipotramite = ltipotramite; + } + + /** + * @return the lrequisito + */ + public List getLrequisito() { + return lrequisito; + } + + /** + * @param lrequisito the lrequisito to set + */ + public void setLrequisito(List lrequisito) { + this.lrequisito = lrequisito; + } + + /** + * Consulta una lista de requisitos por tipo de tramite. + * + * @param ctipotramite + * @return + * @throws Exception + */ + public static List find(String ctipotramite) + throws Exception { + RequisitoPorTramiteController r = new RequisitoPorTramiteController(); + r.addFilter("pk.ctipotramite", ctipotramite); + r.querydatabase(); + return r.getLrecord(); + } + + public static List findxrequisito(String crequisito) + throws Exception { + RequisitoPorTramiteController r = new RequisitoPorTramiteController(); + r.addFilter("pk.crequisito", crequisito); + r.querydatabasesimple(); + return r.getLrecord(); + } + + /** + * Metodo que encuentra TarmRequisitoPorTipoTramite por tramite y por + * requisito en estado inactivo + * + * @param codigoSolicitud + * @return + */ + public static List findInactiveTramiteRequisito(String tramite, String requisito) { + try { + RequisitoPorTramiteController cc = new RequisitoPorTramiteController(); + cc.init(); + cc.recperpage = 300; + if (tramite != null) { + cc.addFilter("pk.ctramite", tramite); + } + if (requisito != null) { + cc.addFilter("pk.crequisito", requisito); + } + cc.addFilter("active", "N"); + cc.querydatabaseConsultas(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public boolean isDepositoPorTramite() { + return depositoPorTramite; + } + + public void setDepositoPorTramite(boolean depositoPorTramite) { + this.depositoPorTramite = depositoPorTramite; + } + + public boolean isDepositoPorCustodio() { + return depositoPorCustodio; + } + + public void setDepositoPorCustodio(boolean depositoPorCustodio) { + this.depositoPorCustodio = depositoPorCustodio; + } + + public Long getcTramite() { + return cTramite; + } + + public void setcTramite(Long cTramite) { + this.cTramite = cTramite; + } + + /** + * Método para manejar el evento change en el CheckBox + * DepositoPorTramite + */ + public void onChangeDepositoPorTramite() { + if (depositoPorTramite) { + record.setDepositoportramite("Y"); + } else { + record.setDepositoportramite("N"); + } + } + + /** + * Método para manejar el evento change en el CheckBox + * DepositoPorCustodio + */ + public void onChangeDepositoPorCustodio() { + if (depositoPorCustodio) { + record.setDepositoporcustodio("Y"); + } else { + record.setDepositoporcustodio("N"); + } + } + + /** + * Abre el dialog para seleccionar un tramite + */ + public void openRequisitosPorTramiteLov() { + Map> params = new HashMap<>(); + BuscarTramiteLovController.openLov(params); + } + + /** + * Completa las acciones pertinentes al momento en que se cierra el dialog + * para seleccionar un tramite + */ + public void onReturnRequisitosPorTramiteLov(SelectEvent event) + throws Exception { + TarmTramite t = (TarmTramite) event.getObject(); + super.addFilter("pk.ctramite", t.getPk().toString()); + super.addField("tipoTramiteName", + t.getModifiedData().get("destipoTramite")); + super.addField("tipoAutorizacionName", + t.getModifiedData().get("destipoAutorizacion")); + super.addField("categoriaName", t.getModifiedData().get("descategoria")); + super.addField("usoActividadName", + t.getModifiedData().get("desusoactividad")); + cTramite = t.getPk(); + this.query(); + } + + protected void querydatabasesimple() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.crequisito"); + Filter filtro = new Filter(); + filtro.setSql(" t.active = 'Y'"); + dto.addFiltro(filtro); + // Subquery + SubQuery subquery = new SubQuery("TarmRequisito", "nombre", "nrequisito", "i.pk = t.pk.crequisito"); + dto.addSubQuery(subquery); + SubQuery subqueryDescCorta = new SubQuery("TarmRequisito", "descripcioncorta", "ndescripcion", "i.pk = t.pk.crequisito"); + dto.addSubQuery(subqueryDescCorta); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/RespuestasLovController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/RespuestasLovController.java new file mode 100644 index 0000000..7e3bd3b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/RespuestasLovController.java @@ -0,0 +1,283 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.eval.TarmPreguntas; +import com.fp.persistence.parmas.eval.TarmRespuestas; + +/** + * Clase controller de respuestas para preguntas + * + * @author Christian Pazmino + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class RespuestasLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + /** + * Variable que contiene la pregunta a las que corresponden las respuestas + * presentadas + */ + private TarmPreguntas pregunta; + /** + * Variable de tipo boleano que indica si una respuesta es o no correcta + */ + private Boolean isCorrecta; + /** + * Estado de la respuesta + */ + private String estado; + /** + * Constante usada para referirse al estado activo de una respuesta + */ + private final String ESTADOACTIVO = "ACT"; + /** + * Constante usada para referirse al estado inactivo de una respuesta + */ + private final String ESTADOINACTIVO = "INA"; + + /** + * Referencia al controlador de la clase pregunta + */ + @ManagedProperty(value = "#{preguntasParaEvaluacionesController}") + private PreguntasParaEvaluacionesController preguntasController; + + public RespuestasLovController() throws Exception { + super(TarmRespuestas.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + try { + String preguntaPK = CallerHelper.getLovParameter("preguntaPK"); + pregunta = PreguntasParaEvaluacionesController.find(preguntaPK).get(0); + if (pregunta.getEstadopregunta().equalsIgnoreCase(ESTADOACTIVO)) { + estado = CatalogDetailController.findxCodigoCodcatalogo(ESTADOACTIVO, "ESTADOPRUEBAS").getDescription(); + } else if (pregunta.getEstadopregunta().equalsIgnoreCase(ESTADOINACTIVO)) { + estado = CatalogDetailController.findxCodigoCodcatalogo(ESTADOINACTIVO, "ESTADOPRUEBAS").getDescription(); + } + this.addFilter("cpregunta", pregunta.getPk().toString()); + this.querydatabase(); + //super.startQuery(); + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "RESPUESTASLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.descripcion"); + + Filter f = new Filter(); + f.setSql("t.isactive = 'Y'"); + dto.addFiltro(f); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Abre el dialogo de crear/editar respuestas desde la pantalla de + * respuestas + */ + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/respuestasLov.xhtml", options, params); + } + + /** + * Crea una instancia y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + isCorrecta = false; + record.setCpregunta(pregunta.getPk()); + record.setIsactive("Y"); + } + + /** + * Actualiza la lista de registros a grabar + * + * @throws Exception + */ + public void update() throws Exception { + if (record.getEscorrecta() == null) { + record.setEscorrecta("N"); + } + super.update(); + } + + public void eliminarLogico() throws Exception { + record.setIsactive("N"); + super.update(); + this.lrecord.remove(record); + + } + + @Override + public void save() { + try { + if (lrecord.size() >= 2) { + int numRespuestasCorrectas = 0; + for (TarmRespuestas respuesta : lrecord) { + if (respuesta.getEscorrecta().equals("Y")) { + numRespuestasCorrectas++; + } + if (numRespuestasCorrectas > 1) { + break; + } + } + if (numRespuestasCorrectas == 1) { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + // Cambiar el estado de la pregunta + if (pregunta.getEstadopregunta().equalsIgnoreCase(ESTADOINACTIVO)) { + pregunta.isnew = false; + pregunta.setEstadopregunta(ESTADOACTIVO); + preguntasController.update(pregunta); + preguntasController.save(); + } + + RequestContext.getCurrentInstance().closeDialog(pregunta); + } else if (numRespuestasCorrectas > 1) { + MessageHelper.setMessageError("LA PREGUNTA PUEDE TENER MARCADA SOLO UNA RESPUESTA CORRECTA"); + } else if (numRespuestasCorrectas == 0) { + MessageHelper.setMessageError("LA PREGUNTA DEBE TENER MARCADA UNA RESPUESTA CORRECTA"); + } + } else { + MessageHelper.setMessageError("DEBEN HABER AL MENOS DOS RESPUESTAS"); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public TarmPreguntas getPregunta() { + return pregunta; + } + + public void setPregunta(TarmPreguntas pregunta) { + this.pregunta = pregunta; + } + + public Boolean getIsCorrecta() { + return isCorrecta; + } + + public void setIsCorrecta(Boolean isCorrecta) { + this.isCorrecta = isCorrecta; + } + + /** + * Metodo para manejar el evento change en el CheckBox "respuesta correcta" + * y convertir valor TRUE en "Y" y FALSE en "N" + */ + public void onChangeEsCorrecta() { + if (isCorrecta) { + record.setEscorrecta("Y"); + } else { + record.setEscorrecta("N"); + } + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public PreguntasParaEvaluacionesController getPreguntasController() { + return preguntasController; + } + + public void setPreguntasController( + PreguntasParaEvaluacionesController preguntasController) { + this.preguntasController = preguntasController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/SancionesController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/SancionesController.java new file mode 100644 index 0000000..beb13fa --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/SancionesController.java @@ -0,0 +1,239 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.CatalogLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TgeneCatalogDetail. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SancionesController extends AbstractController { + + public SancionesController() throws Exception { + super(TgeneCatalogDetail.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOGDETAIL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.catalogcode") == null) { + MessageHelper.setMessageError("msg_catalogrequird"); + return; + } + super.create(); + this.record.getPk().setCatalogcode(super.getMfilters().get("pk.catalogcode")); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void openCatalogLov() { + Map> params = new HashMap<>(); + CatalogLovController.openLov(params); + } + + public void onReturnCatalogLov(SelectEvent event) throws Exception { + TgeneCatalog t = (TgeneCatalog) event.getObject(); + super.addFilter("pk.catalogcode", t.getPk()); + super.addField("catalogname", t.getDescription()); + this.query(); + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * + * @param catalogcode Có de catálogo + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static List find(String catalogcode) { + try { + SancionesController cc = new SancionesController(); + cc.init(); + cc.recperpage = 10000; + cc.addFilter("pk.catalogcode", catalogcode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * + * @param catalogcode Có de catálogo + * @param legalcode Código legal + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static List find(String catalogcode, String legalcode) { + try { + SancionesController cc = new SancionesController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalogcode", catalogcode); + cc.addFilter("legalcode", legalcode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que consulta por Catalog y Catalogcode ambos requeridos + */ + public static TgeneCatalogDetail findxCodigoCodcatalogo(String catalog, String catalogcode) { + try {//TgeneCatalogDetailKey + if (catalog != null && catalogcode != null) { + SancionesController cc = new SancionesController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalogcode", catalogcode); + cc.addFilter("pk.catalog", catalog); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TgeneCatalogDetail findxCodigo(String catalog) { + try {//TgeneCatalogDetailKey + SancionesController cc = new SancionesController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalog", catalog); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que llena lal lista de géneros + */ + public static List getListGender() { + List gender = new ArrayList(); + String[] male = {"M", "MASCULINO"}; + String[] female = {"F", "FEMENINO"}; + gender.add(male); + gender.add(female); + return gender; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/SitioAlmacenamientoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/SitioAlmacenamientoController.java new file mode 100644 index 0000000..624e86b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/SitioAlmacenamientoController.java @@ -0,0 +1,616 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmSitioAlmacenamiento; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Clase controladora del bean TarmSitioAlmacenamiento. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SitioAlmacenamientoController extends AbstractController { + + /** + * latitud de la direccin en el google map + */ + private String latitud; + /** + * longitud de la direccin en el google map + */ + private String longitud; + /** + * direccion en la que se va ha visualizar el map + */ + private String direccionGoogleMap; + + public SitioAlmacenamientoController() throws Exception { + super(TarmSitioAlmacenamiento.class); + } + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lprovinces; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcantones; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lparroquias; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcities; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List tipoComercio; + + private Boolean btnEditar = Boolean.FALSE; + + /** + * tipoMapa permite visualizar la posicion del mapa por direccion o por + * coordenadas + */ + private String tipoMapa; + + private String latitudG; + private String latitudM; + private String latitudS; + private String longuitudG; + private String longuitudM; + private String longuitudS; + + private String latitudGMS; + private String longitudGMS; + + @PostConstruct + private void postconstruct() { + setDireccionGoogleMap("Ecuador"); + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOGDETAIL"; + lprovinces = ProvinceController.find("EC"); + tipoComercio = CatalogDetailController.find("TIPOCOMERCIO"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + record.setCountrycode("EC"); + record.setTipocomerciocodigo("TIPOCOMERCIO"); + record.setEstado("ACT"); + btnEditar = Boolean.FALSE; + + if (this.getMfilters().get("pk.personcode") != null) { + record.setPersoncode(Integer.parseInt(this.getMfilters().get("pk.personcode").toString())); + record.getModifiedData().put("nombre", this.getMfilelds().get("nombre")); + record.getModifiedData().put("numeroDocumento", this.getMfilelds().get("numeroDocumento")); + } + if (this.getMfilters().get("tipocomercio") != null) { + record.setTipocomercio(this.getMfilters().get("tipocomercio").toString()); + } + } + + @Override + public void update() throws Exception { +//-------------------validar SELECCION TIPO UBICACION + if (tipoMapa == null || "".equals(tipoMapa)) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipoMapa")); + return; + } +//-------------------validar LATITUD Y LONGITUD + if (record.getLatitud() == null || record.getLongitud() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselongitudlatitud")); + return; + } + + if (record.getPersoncode() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_numerodocumento")); + return; + } + catalogos(tipoComercio, record.getTipocomercio(), "tipocomercio"); + super.update(); + btnEditar = Boolean.TRUE; + } + + public void edit() { + executeProvince(); + executeCanton(); + btnEditar = Boolean.TRUE; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + this.addFilter("estado", "ACT"); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.bodega"); + SubQuery snombre = new SubQuery("TcustPersonDetail", "name", "nombre", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery snumerodocumento = new SubQuery("TcustPersonDetail", "identification", "numeroDocumento", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery tipoComercio = new SubQuery("TgeneCatalogDetail", "description", "tipocomercio", "i.pk.catalog = t.tipocomercio and i.pk.catalogcode=t.tipocomerciocodigo"); + + dto.addSubQuery(snombre); + dto.addSubQuery(snumerodocumento); + dto.addSubQuery(tipoComercio); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void remove() { + if (this.record != null) { + this.record.setEstado("INA"); + try { + removefromlista(lrecord, record); + this.addUpdated(record); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + } + + private void removefromlista(List ldata, TarmSitioAlmacenamiento abstractbean) + throws Exception { + int size = ldata.size(); + for (int i = 0; i < size; i++) { + if (ldata.get(i).rowkey() == abstractbean.rowkey()) { + ldata.remove(i); + break; + } + } + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince() { + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + lcities = CityController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + } + } + + /** + * Método para el evento change del combo ciudad + */ + public void executeCiudad() { + if ((getRecord().getCantoncode() != null) && (getRecord().getCantoncode().compareTo("") != 0)) { + List lcities = CityController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + setDireccionGoogleMap(lcities.get(0).getDescription() + ", " + "Ecuador"); + } + } + + /** + * Método para abrir el lov de persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Método para obtener la persona al cerrar el lov de persona + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail tp = (TcustPersonDetail) event.getObject(); + super.addFilter("pk.personcode", tp.getPk().getPersoncode().toString()); + super.addField("nombre", tp.getName()); + super.addField("numeroDocumento", tp.getIdentification()); + } + + /** + * Método para obtener la persona al cerrar el lov de persona + * + * @param event + * @throws Exception + */ + public void onReturnPersonDialogLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + record.getModifiedData().put("nombre", t.getName()); + record.getModifiedData().put("numeroDocumento", t.getIdentification()); + record.setPersoncode(t.getPk().getPersoncode()); + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * + * @param catalogcode Có de catálogo + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static List find(String code) { + try { + SitioAlmacenamientoController cc = new SitioAlmacenamientoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", code); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para recorreer los combos y setear las descripciones de lo q se + * escoge para la vista + * + * @param list + * @param codigo + * @param pk + */ + public void catalogos(List list, String codigo, String pk) { + for (TgeneCatalogDetail item : list) { + if (codigo.equals(item.getPk().getCatalog())) { + record.modifiedData.put(pk, item.getDescription()); + break; + } + } + } + + /** + * Metodo que permite setear los datos de coordenadas relacionados a la + * entidad TarmDecomiso, una vez seleccionado un punto en el Map desde + * pantalla + */ + public void evento() { + getRecord().setLatitud(new BigDecimal(getLatitud())); + getRecord().setLongitud(new BigDecimal(getLongitud())); + + String longitudString = getRecord().getLongitud().toString(); + if (longitudString.contains("-")) { + longitudString = longitudString.replace("-", ""); + setLongitudGMS("oeste"); + } else { + setLongitudGMS("este"); + } + String[] longitud = transformarGrados(longitudString); + + String latitudString = getRecord().getLatitud().toString(); + if (latitudString.contains("-")) { + latitudString = latitudString.replace("-", ""); + setLatitudGMS("sur"); + } else { + setLatitudGMS("norte"); + } + String[] latitud = transformarGrados(latitudString); + + setLatitudG(latitud[0]); + setLatitudM(latitud[1]); + setLatitudS(latitud[2]); + setLonguitudG(longitud[0]); + setLonguitudM(longitud[1]); + setLonguitudS(longitud[2]); + } + + /** + * Inicializa los campos al cambiar el tipo de Ubicacion desde la pagina + */ + public void changeUbicacion() { + getRecord().setLatitud(null); + getRecord().setLongitud(null); + setLatitudG(""); + setLatitudM(""); + setLatitudS(""); + setLonguitudG(""); + setLonguitudM(""); + setLonguitudS(""); + setLatitud(""); + setLongitud(""); + setLongitudGMS(null); + setLatitudGMS(null); + } + + /** + * Permite inicializar los campos de longitud y lalitud y cargar a los datos + * de coordenadas relacionados a la entidad TarmDecomiso + */ + public void openMapPorCoordenandas() { + setLatitud(""); + setLongitud(""); + if ("coodernadas".equals(tipoMapa)) { + getRecord().setLatitud(new BigDecimal(transformarCoordenadas(latitudG, latitudM, latitudS, "sur".equals(latitudGMS)))); + getRecord().setLongitud(new BigDecimal(transformarCoordenadas(longuitudG, longuitudM, longuitudS, "oeste".equals(longitudGMS)))); + } + } + + /** + * Metodo que permite transformar de Coordenadas Hexadecimales a Coordenadas + * en Grados, Minutos y Seguntos + * + * @param coordenada + * @return vector con las Coordenadas en Grados, Minutos y Seguntos + */ + public String[] transformarGrados(String coordenada) { + int grados = new BigDecimal(coordenada).intValue(); + BigDecimal minutos = new BigDecimal(coordenada).subtract(new BigDecimal(grados)).multiply(new BigDecimal(60)); + int min = minutos.intValue(); + BigDecimal segundos = minutos.subtract(new BigDecimal(min)).multiply(new BigDecimal(60)).setScale(4, BigDecimal.ROUND_FLOOR); + //System.out.println("latitude: " + grados + " " + min + " " + segundos); + return (grados + "," + min + "," + segundos).split(","); + } + + public String transformarCoordenadas(String grados, String minutos, String segundos, boolean negativo) { + BigDecimal resultado = new BigDecimal(grados).add(new BigDecimal(minutos).divide(new BigDecimal(60), 12, BigDecimal.ROUND_FLOOR)).add(new BigDecimal(segundos).divide(new BigDecimal(3600), 12, BigDecimal.ROUND_FLOOR)); + resultado = resultado.setScale(12, BigDecimal.ROUND_FLOOR); + if (negativo) { + resultado = resultado.multiply(new BigDecimal(-1)); + } + return resultado.toString(); + } + + public List getLprovinces() { + return lprovinces; + } + + public void setLprovinces(List lprovinces) { + this.lprovinces = lprovinces; + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public List getLparroquias() { + return lparroquias; + } + + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + public List getLcities() { + return lcities; + } + + public void setLcities(List lcities) { + this.lcities = lcities; + } + + public List getTipoComercio() { + return tipoComercio; + } + + public void setTipoComercio(List tipoComercio) { + this.tipoComercio = tipoComercio; + } + + public Boolean getBtnEditar() { + return btnEditar; + } + + public void setBtnEditar(Boolean btnEditar) { + this.btnEditar = btnEditar; + } + + public String getLatitud() { + return latitud; + } + + public void setLatitud(String latitud) { + this.latitud = latitud; + } + + public String getLongitud() { + return longitud; + } + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + public String getDireccionGoogleMap() { + return direccionGoogleMap; + } + + public void setDireccionGoogleMap(String direccionGoogleMap) { + this.direccionGoogleMap = direccionGoogleMap; + } + + public String getTipoMapa() { + return tipoMapa; + } + + public void setTipoMapa(String tipoMapa) { + this.tipoMapa = tipoMapa; + } + + public String getLatitudG() { + return latitudG; + } + + public void setLatitudG(String latitudG) { + this.latitudG = latitudG; + } + + public String getLatitudM() { + return latitudM; + } + + public void setLatitudM(String latitudM) { + this.latitudM = latitudM; + } + + public String getLatitudS() { + return latitudS; + } + + public void setLatitudS(String latitudS) { + this.latitudS = latitudS; + } + + public String getLonguitudG() { + return longuitudG; + } + + public void setLonguitudG(String longuitudG) { + this.longuitudG = longuitudG; + } + + public String getLonguitudM() { + return longuitudM; + } + + public void setLonguitudM(String longuitudM) { + this.longuitudM = longuitudM; + } + + public String getLonguitudS() { + return longuitudS; + } + + public void setLonguitudS(String longuitudS) { + this.longuitudS = longuitudS; + } + + /** + * @return the latitudGMS + */ + public String getLatitudGMS() { + return latitudGMS; + } + + /** + * @param latitudGMS the latitudGMS to set + */ + public void setLatitudGMS(String latitudGMS) { + this.latitudGMS = latitudGMS; + } + + /** + * @return the longitudGMS + */ + public String getLongitudGMS() { + return longitudGMS; + } + + /** + * @param longitudGMS the longitudGMS to set + */ + public void setLongitudGMS(String longitudGMS) { + this.longitudGMS = longitudGMS; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/SolicitudImportacionArmasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/SolicitudImportacionArmasController.java new file mode 100644 index 0000000..544fa22 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/SolicitudImportacionArmasController.java @@ -0,0 +1,102 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmSolicitudImportacion; + +/** + * Clase controladora del bean TarmSolicitudImportacion. + * + * @author Andres Cevallos. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SolicitudImportacionArmasController extends AbstractController { + + public SolicitudImportacionArmasController() throws Exception { + super(TarmSolicitudImportacion.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //Ingreso de Datos Quemados + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + // record = new TarmSolicitudImportacion(); + this.beanalias = "TDIRECCIONES"; + this.create(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void executeProvincia() { + + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + } + + public void update(TarmSolicitudImportacion bean) throws Exception { + record = bean; + update(); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/TarmCentroControlJurController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/TarmCentroControlJurController.java new file mode 100644 index 0000000..23e154c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/TarmCentroControlJurController.java @@ -0,0 +1,379 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.model.DefaultTreeNode; +import org.primefaces.model.TreeNode; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Clase controladora del bean TarmCentroControlJur. + * + * @author C.P. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TarmCentroControlJurController extends AbstractController { + + private static final long serialVersionUID = 1L; + + /** + * Nodos para la creacion del arbol + */ + private TreeNode root; + /** + * Variable que se carga cuando selecciona un nodo del arbol + */ + private TreeNode selectedNode; + /** + * Recupera el codigo de la provincia selecionada + */ + private String codigoProvincia; + /** + * Recupera la descripcion de la provincia selecionada + */ + private String descripcionProvincia; + /** + * Carga la lista de las provincias + */ + private List lprovinces; + /** + * Carga el centro de control + */ + private TarmCentroControl tarmCentroControl; + + /** + * Inyeccion del controlador centroControlArmasController + */ + @ManagedProperty(value = "#{centroControlArmasController}") + private CentroControlArmasController centroControlArmasController; + + public TarmCentroControlJurController() throws Exception { + super(TarmCentroControlJur.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TARMCENTROCONTROLJURIS"; + tarmCentroControl = new TarmCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + SubQuery sprovincia = new SubQuery("TgeneProvince", "description", "desprovincia", "i.pk.countrycode = t.countrycode and i.pk.provincecode= t.provincecode"); + dto.addSubQuery(sprovincia); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp + .get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Metodo que se ejecuta al pulsar jurisdiccion Inicializa las variables, + * lista las provincias y el arbol de jurisdiccion + */ + public void loadEdit() { + centroControlArmasController.getRecord();// contiene el registro seleccionado + clearAll(); + listarProvincias(); + root = null; + getMfilters().put("ccentrocontrol", centroControlArmasController.getRecord().getPk()); + querydatabase(); + root = createTree();//carga el arbol + } + + /** + * selecciona un registro para anadir una jurisdiccion + * + * @throws Exception + */ + public void displaySelectedSingle() throws Exception { + if (selectedNode != null) { + super.create(); + record.setCountrycode("EC"); + record.setCcentrocontrol(centroControlArmasController.getRecord().getPk()); + listarProvincias(); + } + } + + /** + * elimna la jurisdiccion + * + * @throws Exception + */ + public void deleteNode() throws Exception { + record = (TarmCentroControlJur) selectedNode.getData(); + if (record.getCcentrocontrol() == null || record.getCcentrocontrol().trim().length() == 0) { + MessageHelper.setMessageError("NO SE PUEDE ELIMINAR EL NODO"); + return; + } + record.setProvincianombre(null); + super.remove(); + selectedNode.getChildren().clear(); + selectedNode.getParent().getChildren().remove(selectedNode); + selectedNode.setParent(null); + selectedNode = null; + } + + /** + * arma el arbol + * + * @return + */ + @SuppressWarnings("unused") + public TreeNode createTree() { + TarmCentroControlJur cabecera = new TarmCentroControlJur(); + cabecera.setProvincianombre(centroControlArmasController.getRecord().getModifiedData().get("desinstitucion").toString()); + + TarmCentroControlJur reg1 = new TarmCentroControlJur(); + reg1.setProvincianombre(centroControlArmasController.getRecord().getModifiedData().get("desinstitucion").toString()); + + TarmCentroControlJur reg2 = new TarmCentroControlJur(); + reg2.setProvincianombre(centroControlArmasController.getRecord().getModifiedData().get("desnombreinstitucion").toString()); + + TreeNode root = new DefaultTreeNode(cabecera, null); + TreeNode nombreCentro = new DefaultTreeNode(cabecera, root); + TreeNode Default2 = new DefaultTreeNode(reg2, nombreCentro); + //se recorre para el arbol + if (lrecord != null && lrecord.size() > 0) { + for (TarmCentroControlJur jurisdiccion : lrecord) { + jurisdiccion.setProvincianombre(nombreProvincia(lprovinces, jurisdiccion.getProvincecode())); + TreeNode documents = new DefaultTreeNode(jurisdiccion, Default2); + } + } + return root; + } + + /** + * Metodo para obtener la descripcion de la provincia + * + * @param list + * @param codigo + * @return + */ + public String nombreProvincia(List list, String codigo) { + for (TgeneProvince item : list) { + if (item.getPk().getProvincecode().equals(codigo)) { + return item.getDescription(); + } + } + return ""; + } + + /** + * metodo para a\u00F1adir un nuevo registro de jurisdiccion + * + * @param province + * @throws Exception + */ + public void setProvincia(TgeneProvince province) throws Exception { + System.out.println(province.getDescription()); + //validamos que el registro no este ingresado + List listaJurisdicciones = find(); + if (listaJurisdicciones != null && listaJurisdicciones.size() > 0) { + for (TarmCentroControlJur item : listaJurisdicciones) { + if (item.getProvincecode().equals(province.getPk().getProvincecode())) { + MessageHelper.setMessageError("LA JURISDICCI\u00D3N YA PERTENECE A UN CENTRO DE CONTROL DE ARMAS"); + return; + } + } + } + //validamos sobre la lista que vamos a guardar + if (this.lrecord != null && this.lrecord.size() > 0) { + for (TarmCentroControlJur item : this.lrecord) { + if (item.getProvincecode().equals(province.getPk().getProvincecode())) { + MessageHelper.setMessageError("LA JURISDICCI\u00D3N YA PERTENECE A UN CENTRO DE CONTROL DE ARMAS"); + return; + } + } + } + + record.setProvincecode(province.getPk().getProvincecode()); + addNew(record); + getLrecord().add(record); + root = createTree(); + super.update(); + } + + /** + * Metodo para listar las provincias + */ + public void listarProvincias() { + if (lprovinces == null || lprovinces.size() == 0) { + lprovinces = ProvinceController.findxDescripcion("EC", codigoProvincia, descripcionProvincia); + } + } + + public static List find() { + try { + TarmCentroControlJurController cc = new TarmCentroControlJurController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmCentroControlJur findxProvincia(String provincecode) { + try { + TarmCentroControlJurController cc = new TarmCentroControlJurController(); + cc.init(); + cc.addFilter("provincecode", provincecode); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public TreeNode getRoot() { + return root; + } + + public void setRoot(TreeNode root) { + this.root = root; + } + + public TreeNode getSelectedNode() { + return selectedNode; + } + + public void setSelectedNode(TreeNode selectedNode) { + this.selectedNode = selectedNode; + } + + public CentroControlArmasController getCentroControlArmasController() { + return centroControlArmasController; + } + + public void setCentroControlArmasController( + CentroControlArmasController centroControlArmasController) { + this.centroControlArmasController = centroControlArmasController; + } + + public List getLprovinces() { + return lprovinces; + } + + public void setLprovinces(List lprovinces) { + this.lprovinces = lprovinces; + } + + public String getCodigoProvincia() { + return codigoProvincia; + } + + public void setCodigoProvincia(String codigoProvincia) { + this.codigoProvincia = codigoProvincia; + } + + public String getDescripcionProvincia() { + return descripcionProvincia; + } + + public void setDescripcionProvincia(String descripcionProvincia) { + this.descripcionProvincia = descripcionProvincia; + } + + public TarmCentroControl getTarmCentroControl() { + return tarmCentroControl; + } + + public void setTarmCentroControl(TarmCentroControl tarmCentroControl) { + this.tarmCentroControl = tarmCentroControl; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/TarmVentaArmaTemporalController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/TarmVentaArmaTemporalController.java new file mode 100644 index 0000000..7ede4c0 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/TarmVentaArmaTemporalController.java @@ -0,0 +1,182 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmVentaArmaTem; + +@ManagedBean +@ViewScoped +public class TarmVentaArmaTemporalController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public TarmVentaArmaTemporalController() throws Exception { + super(TarmVentaArmaTem.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + private void init() { + try { + recperpage = 15; + lrecord = new ArrayList<>(); + beanalias = "VENTAARMATEMPORAL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static TarmVentaArmaTem findPendienteCarma(String carma) { + try { + TarmVentaArmaTemporalController cc = new TarmVentaArmaTemporalController(); + cc.init(); + cc.recperpage = 5000; + if (carma != null && !carma.isEmpty()) { + cc.addFilter("carma", carma); + } + cc.addFilter("estado", "PENDIENTE"); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findLote(String lote) { + try { + TarmVentaArmaTemporalController cc = new TarmVentaArmaTemporalController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("estado", "APROBADO"); + cc.querydatabaselote(lote); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaselote(String lote) { + try { + DtoQuery dto = this.getDtoQueryLote(); + dto.setOrderby("pk"); + String sqlFinal = " t.carma in (select p.pk from TarmArmas p where p.lote='" + lote + "') "; + Filter filtroFinal = new Filter(); + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private DtoQuery getDtoQueryLote() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryTipoFab = new SubQuery("TgeneCatalogDetail", "description", "tipofabricacion", "i.pk.catalog= (select p.tipofabricacion from TarmArmas p where p.pk=t.carma)"//t.tipofabricacion + + " and i.pk.catalogcode='TIPOFABRICACION'"); + dto.addSubQuery(subqueryTipoFab); + SubQuery subqueryTipo = new SubQuery("TgeneCatalogDetail", "description", "tipo", "i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o " + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma)) "//t.ctipoarmaexplosivo + + " and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o " + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))");//t.ctipoarmaexplosivo + dto.addSubQuery(subqueryTipo); + SubQuery subqueryClasecatalogo = new SubQuery("TgeneCatalogDetail", "description", "clase", "i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o " + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))"//t.ctipoarmaexplosivo + + " and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o " + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))");//t.ctipoarmaexplosivo + dto.addSubQuery(subqueryClasecatalogo); + return dto; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/TipoArmaExpLovController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/TipoArmaExpLovController.java new file mode 100644 index 0000000..acd9582 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/TipoArmaExpLovController.java @@ -0,0 +1,145 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TipoArmaExpLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private String legalCode = ""; + + public TipoArmaExpLovController() throws Exception { + super(TgeneCatalogDetail.class); + } + + @PostConstruct + private void postconstruct() { + try { + this.init(); + String isArmaFuego = CallerHelper.getLovParameter("isArmaFuego"); + if (isArmaFuego.equals("true")) { + legalCode = CallerHelper.getLovParameter("longitud"); +// this.getMfilters().put("legalcode", longitudcode); + } else { + legalCode = CallerHelper.getLovParameter("clase"); +// this.getMfilters().put("legalcode", clasecode); + } + // Inicializa autoconsulta + super.startQuery(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TIPOARMEXPLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + +// this.getMfilters().put("pk.catalogcode", "TIPOARMAEXPLOSIVO"); + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + + Filter filtro = new Filter(); + filtro.setSql("t.legalcode='" + legalCode + "' and t.pk.catalogcode='TIPOARMAEXPLOSIVO'"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + /** + * Metodo sobrecargado ejecutado al cerrar el dialogo actual + */ + public void setcatalog(TgeneCatalogDetail tgeneCatalogDetail) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneCatalogDetail); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/armas/lov/TipoArmaExpLov.xhtml", options, params); + } + + public String getLegalCode() { + return legalCode; + } + + public void setLegalCode(String legalCode) { + this.legalCode = legalCode; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/TiposArmasExplosivosController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/TiposArmasExplosivosController.java new file mode 100644 index 0000000..fa7bbe4 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/TiposArmasExplosivosController.java @@ -0,0 +1,991 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.sql.Date; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmUnidadTipo; +import com.fp.persistence.parmas.param.TarmUnidadTipoKey; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TarmTipoArmaExplosivo. + * + * @author Christian Pazmino + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class TiposArmasExplosivosController extends + AbstractController { + + /** + * Variable que contiene el String (nombre de clase) del dialogo seleccionar + * clase de la pantalla principal + */ + private String clase; + /** + * Variable que contiene el String (codigo de clase) del dialogo seleccionar + * clase de la pantalla principal + */ + private String claseCodigo; + + /** + * Variable que contiene el String (nombre de clase) del dialogo seleccionar + * clase de la pantalla principal + */ + private String unidadMedidaPesoD; + /** + * Variable que contiene el String (codigo de clase) del dialogo seleccionar + * clase de la pantalla principal + */ + private String unidadMedidaPesoCodigoD; + + /** + * Variable que contiene el String (nombre de clase) del dialogo seleccionar + * clase de la pantalla crear/editar + */ + private String claseD; + /** + * Variable que contiene el String (codigo de clase) del dialogo seleccionar + * clase de la pantalla crear/editar + */ + private String claseCodigoD; + /** + * Variable que contiene el String (codigo de longitud) del dialogo + * seleccionar longitud de la pantalla principal + */ + private String longitud; + /** + * Variable que contiene el String (codigo de longitud) del dialogo + * seleccionar longitud de la pantalla crear/editar + */ + private String longitudD; + /** + * Variable de tipo boleano (TRUE o FALSE) que indica si la clase + * seleccionada en la pantalla principal es un arma de fuego + */ + private Boolean isArmaFuego; + /** + * Variable de tipo boleano (TRUE o FALSE) que indica si la clase + * seleccionada en la pantalla crear/editar es un arma de fuego + */ + private Boolean isArmaFuegoD; + /** + * Constante usada para referirse a la clase arma de fuego + */ + private final String CODIGOARMADEFUEGO = "0010000001"; + + @ManagedProperty(value = "#{unidadTipoController}") + private UnidadTipoController unidadTipoController; + + /** + * Map que contiene los criterios de busqueda de una tabla previos a los + * criterios de creacion. + */ + private Map mfiltersBKP = new HashMap(); + + public TiposArmasExplosivosController() throws Exception { + super(TarmTipoArmaExplosivo.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + isArmaFuego = false; + isArmaFuegoD = false; + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "TIPOARMAEXPLOSIVO"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + super.addField("clasedescriptionD", null); + super.addField("longituddescriptionD", null); + super.addField("tipodescriptionD", null); + super.addField("calibredescriptionD", null); + super.addField("unidaddescriptionD", null); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + // Subquery + SubQuery subqueryClase = new SubQuery("TgeneCatalogDetail", + "description", "nclase", + "i.pk.catalog = t.clase and i.pk.catalogcode = t.clasecodigo"); + dto.addSubQuery(subqueryClase); + + SubQuery subqueryLongitud = new SubQuery("TgeneCatalogDetail", + "description", "nlongitud", + "i.pk.catalog = t.longitud and i.pk.catalogcode = t.longitudcodigo"); + dto.addSubQuery(subqueryLongitud); + + SubQuery subqueryTipoArmaExplosivo = new SubQuery( + "TgeneCatalogDetail", + "description", + "ntipo", + "i.pk.catalog = t.tipoarmaexplosivo and i.pk.catalogcode = t.tipoarmaexplosivocodigo"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + + SubQuery subqueryCalibre = new SubQuery("TgeneCatalogDetail", + "description", "ncalibre", + "i.pk.catalog = t.calibre and i.pk.catalogcode = t.calibrecodigo"); + dto.addSubQuery(subqueryCalibre); + + SubQuery subqueryUnidad = new SubQuery("TgeneCatalogDetail", + "description", "nunidadMedidaPeso", + "i.pk.catalog = t.unidadmedidapeso and i.pk.catalogcode = t.unidadmedidapesocodigo"); + dto.addSubQuery(subqueryUnidad); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * ? + */ + protected void queryDatbase(String longitud, String calibre) { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + // Subquery + if (longitud == null && calibre == null) { + Filter longitudFiltro = new Filter(); + longitudFiltro + .setSql("t.longitud is null and t.calibre is null"); + dto.addFiltro(longitudFiltro); + } else if (longitud == null) { + Filter longitudFiltro = new Filter(); + longitudFiltro.setSql("t.longitud is null"); + dto.addFiltro(longitudFiltro); + } else if (calibre == null) { + Filter calibreFiltro = new Filter(); + calibreFiltro.setSql("t.calibre is null"); + dto.addFiltro(calibreFiltro); + } + + SubQuery subqueryClase = new SubQuery("TgeneCatalogDetail", + "description", "nclase", + "i.pk.catalog = t.clase and i.pk.catalogcode = t.clasecodigo"); + dto.addSubQuery(subqueryClase); + + SubQuery subqueryLongitud = new SubQuery("TgeneCatalogDetail", + "description", "nlongitud", + "i.pk.catalog = t.longitud and i.pk.catalogcode = t.longitudcodigo"); + dto.addSubQuery(subqueryLongitud); + + SubQuery subqueryTipoArmaExplosivo = new SubQuery( + "TgeneCatalogDetail", + "description", + "ntipo", + "i.pk.catalog = t.tipoarmaexplosivo and i.pk.catalogcode = t.tipoarmaexplosivocodigo"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + + SubQuery subqueryCalibre = new SubQuery("TgeneCatalogDetail", + "description", "ncalibre", + "i.pk.catalog = t.calibre and i.pk.catalogcode = t.calibrecodigo"); + dto.addSubQuery(subqueryCalibre); + + SubQuery subunidad = new SubQuery( + "TgeneCatalogDetail", + "description", + "desunidad", + "i.pk.catalog = t.pk.unidadmedidapeso and i.pk.catalogcode=t.pk.unidadmedidapesocodigo"); + dto.addSubQuery(subunidad); + + SubQuery subunidadlegalcode = new SubQuery( + "TgeneCatalogDetail", + "legalcode", + "deslegalcode", + "i.pk.catalog = t.pk.unidadmedidapeso and i.pk.catalogcode=t.pk.unidadmedidapesocodigo"); + dto.addSubQuery(subunidadlegalcode); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + dtosave.setPosition(2); + + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada tabla. + + TarmUnidadTipo tipoUnidadSeleccionada = UnidadTipoController.findByClaseAndClasecode(record.getClase(), record.getClasecodigo(), record.getTipoarmaexplosivo(), record.getUnidadmedidapeso()); + if (tipoUnidadSeleccionada == null) { + TarmUnidadTipoKey tarmUnidadTipoKey = new TarmUnidadTipoKey(); + tarmUnidadTipoKey.setClase(record.getClase()); + tarmUnidadTipoKey.setClasecode(record.getClasecodigo()); + + tarmUnidadTipoKey.setTipoarmaexplosivo(record.getTipoarmaexplosivo()); + tarmUnidadTipoKey.setTipoarmaexplosivocodigo(record.getTipoarmaexplosivocodigo()); + + tarmUnidadTipoKey.setUnidadmedidapeso(record.getUnidadmedidapeso()); + tarmUnidadTipoKey.setUnidadmedidapesocodigo(record.getUnidadmedidapesocodigo()); + + tipoUnidadSeleccionada = new TarmUnidadTipo(); + tipoUnidadSeleccionada.setPk(tarmUnidadTipoKey); + tipoUnidadSeleccionada.setRecordversion(0); + tipoUnidadSeleccionada.setIsnew(Boolean.TRUE); + tipoUnidadSeleccionada.setFecharegistro(new Date(new java.util.Date().getTime())); + + unidadTipoController.update(tipoUnidadSeleccionada); + } + + DtoSave dtosaveUnidadTipo = unidadTipoController.getDtoSave(true); + dtosaveUnidadTipo.setPosition(1); + msave.put(unidadTipoController.getBeanalias(), dtosaveUnidadTipo); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.unidadTipoController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + public String getClase() { + return clase; + } + + public void setClase(String clase) { + this.clase = clase; + } + + public String getClaseCodigo() { + return claseCodigo; + } + + public void setClaseCodigo(String claseCodigo) { + this.claseCodigo = claseCodigo; + } + + public String getLongitud() { + return longitud; + } + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + public Boolean getIsArmaFuego() { + return isArmaFuego; + } + + public Boolean getIsArmaFuegoD() { + return isArmaFuegoD; + } + + public void setIsArmaFuegoD(Boolean isArmaFuegoD) { + this.isArmaFuegoD = isArmaFuegoD; + } + + public String getClaseD() { + return claseD; + } + + public void setClaseD(String claseD) { + this.claseD = claseD; + } + + public String getClaseCodigoD() { + return claseCodigoD; + } + + public void setClaseCodigoD(String claseCodigoD) { + this.claseCodigoD = claseCodigoD; + } + + public String getLongitudD() { + return longitudD; + } + + public void setLongitudD(String longitudD) { + this.longitudD = longitudD; + } + + public Map getMfiltersBKP() { + return mfiltersBKP; + } + + public void setMfiltersBKP(Map mfiltersBKP) { + this.mfiltersBKP = mfiltersBKP; + } + + public UnidadTipoController getUnidadTipoController() { + return unidadTipoController; + } + + public void setUnidadTipoController(UnidadTipoController unidadTipoController) { + this.unidadTipoController = unidadTipoController; + } + + /** + * Metodo utilizado para limpiar las variables que contienen las + * descripciones de los dialogos de seleccion de la pantalla principal + */ + public void actualizarElementosBusqueda(String tipoBusqueda) { + if (tipoBusqueda.equals("todo")) { + super.addField("clasedescription", null); + super.addField("longituddescription", null); + super.addField("tipodescription", null); + super.addField("calibredescription", null); + super.getMfilters().remove("clase"); + super.getMfilters().remove("clasecodigo"); + super.getMfilters().remove("longitud"); + super.getMfilters().remove("longitudcodigo"); + super.getMfilters().remove("tipoarmaexplosivo"); + super.getMfilters().remove("tipoarmaexplosivocodigo"); + super.getMfilters().remove("calibre"); + super.getMfilters().remove("calibrecodigo"); + } else if (tipoBusqueda.equals("clase")) { + super.addField("longituddescription", null); + super.addField("tipodescription", null); + super.addField("calibredescription", null); + super.getMfilters().remove("longitud"); + super.getMfilters().remove("longitudcodigo"); + super.getMfilters().remove("tipoarmaexplosivo"); + super.getMfilters().remove("tipoarmaexplosivocodigo"); + super.getMfilters().remove("calibre"); + super.getMfilters().remove("calibrecodigo"); + } else if (tipoBusqueda.equals("longitud")) { + super.addField("tipodescription", null); + super.addField("calibredescription", null); + super.getMfilters().remove("tipoarmaexplosivo"); + super.getMfilters().remove("tipoarmaexplosivocodigo"); + super.getMfilters().remove("calibre"); + super.getMfilters().remove("calibrecodigo"); + } else if (tipoBusqueda.equals("tipo")) { + super.addField("calibredescription", null); + super.getMfilters().remove("calibre"); + super.getMfilters().remove("calibrecodigo"); + } + } + + /** + * Metodo utilizado para limpiar las variables que contienen las + * descripciones de los dialogos de seleccion de la pantalla crear/editar + */ + public void actualizarElementosBusquedaDialog(String tipoBusqueda) { + if (tipoBusqueda.equals("clase")) { + super.addField("longituddescriptionD", null); + super.addField("tipodescriptionD", null); + super.addField("calibredescriptionD", null); + super.addField("unidaddescriptionD", null); + } else if (tipoBusqueda.equals("longitud")) { + super.addField("tipodescriptionD", null); + super.addField("calibredescriptionD", null); + super.addField("unidaddescriptionD", null); + } else if (tipoBusqueda.equals("tipo")) { + super.addField("calibredescriptionD", null); + super.addField("unidaddescriptionD", null); + } + } + + /** + * Metodo usado para abrir el dialogo seleccionar clase de la pantalla + * principal y del dialogo crear/editar + */ + public void openClaseLov() { + try { + Map> params = new HashMap<>(); + List lcat = new ArrayList<>(); + lcat.add("CLASE"); + params.put("catalogcode", lcat); + //tITULO DEL LOV + List ltituloLOV = new ArrayList<>(); + ltituloLOV.add("lov_unidades"); + params.put("tituloLOV", ltituloLOV); + ClaseLovController.openLov(params); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo usado para abrir el dialogo seleccionar clase de la pantalla + * principal y del dialogo crear/editar + */ + public void openUnidadLov() { + try { + Map> params = new HashMap<>(); + // CATALOGCODE + List lcatalogcode = new ArrayList<>(); + lcatalogcode.add("UNIDADMEDIDA"); + params.put("catalogcode", lcatalogcode); + //tITULO DEL LOV + List ltituloLOV = new ArrayList<>(); + ltituloLOV.add("lov_unidades"); + params.put("tituloLOV", ltituloLOV); + ClaseLovController.openLov(params); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar + * clase de la pantalla principal + */ + public void onReturnClaseLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.addFilter("clase", t.getPk().getCatalog()); + super.addFilter("clasecodigo", t.getPk().getCatalogcode()); + clase = t.getPk().getCatalog(); + claseCodigo = t.getPk().getCatalogcode(); + if (clase.equalsIgnoreCase(CODIGOARMADEFUEGO)) { + isArmaFuego = true; + } else { + isArmaFuego = false; + } + super.addField("clasedescription", t.getDescription()); + actualizarElementosBusqueda("clase"); + this.query(); + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar + * clase de la pantalla principal + */ + public void onReturnUnidadDialogLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.addField("unidaddescriptionD", t.getDescription()); + this.record.setUnidadmedidapeso(t.getPk().getCatalog()); + this.record.setUnidadmedidapesocodigo(t.getPk().getCatalogcode()); + unidadMedidaPesoD = t.getPk().getCatalog(); + unidadMedidaPesoCodigoD = t.getPk().getCatalogcode(); + this.record.put("nunidadMedidaPeso", t.getDescription()); + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar + * clase de la pantalla crear/editar + */ + public void onReturnClaseDialogLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + claseD = t.getPk().getCatalog(); + claseCodigoD = t.getPk().getCatalogcode(); + if (claseD.equalsIgnoreCase(CODIGOARMADEFUEGO)) { + isArmaFuegoD = true; + } else { + isArmaFuegoD = false; + } + super.addField("clasedescriptionD", t.getDescription()); + this.record.setClase(t.getPk().getCatalog()); + ; + this.record.setClasecodigo(t.getPk().getCatalogcode()); + record.put("nclase", t.getDescription()); + actualizarElementosBusquedaDialog("clase"); + } + + /** + * Metodo usado para abrir el dialogo seleccionar longitud de la pantalla + * principal + */ + public void openLogitudLov() { + if (clase != null && claseCodigo != null) { + Map> params = new HashMap<>(); + LongitudLovController.openLov(params); + } else { + MessageHelper + .setMessageError("POR FAVOR SELECCIONE UNA CLASE DE ARMA O EXPLOSIVO"); + } + } + + /** + * Metodo usado para abrir el dialogo seleccionar longitud de la pantalla + * crear/editar + */ + public void openLogitudDialogLov() { + if (claseD != null && claseCodigoD != null) { + Map> params = new HashMap<>(); + LongitudLovController.openLov(params); + } else { + MessageHelper + .setMessageError("POR FAVOR SELECCIONE UNA CLASE DE ARMA O EXPLOSIVO"); + } + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar + * longitud de la pantalla principal + */ + public void onReturnLogitudLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.addFilter("longitud", t.getPk().getCatalog()); + super.addFilter("longitudcodigo", t.getPk().getCatalogcode()); + longitud = t.getPk().getCatalog(); + super.addField("longituddescription", t.getDescription()); + actualizarElementosBusqueda("longitud"); + this.query(); + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar + * longitud de la pantalla crear/editar + */ + public void onReturnLogitudDialogLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + longitudD = t.getPk().getCatalog(); + super.addField("longituddescriptionD", t.getDescription()); + this.record.setLongitud(longitudD); + this.record.setLongitudcodigo(t.getPk().getCatalogcode()); + record.put("nlongitud", t.getDescription()); + actualizarElementosBusquedaDialog("longitudD"); + } + + /** + * Metodo usado para abrir el dialogo seleccionar tipo de arma o explosivo + * de la pantalla principal + */ + public void openTipoLov() { + + if (clase != null && claseCodigo != null) { + Map> params = new HashMap<>(); + List valuesArmaFuego = new ArrayList(); + valuesArmaFuego.add(isArmaFuego.toString()); + params.put("isArmaFuego", valuesArmaFuego); + if (isArmaFuego) { + List valuesLongitud = new ArrayList(); + valuesLongitud.add(longitud); + params.put("longitud", valuesLongitud); + } else { + List valuesClase = new ArrayList(); + valuesClase.add(clase); + params.put("clase", valuesClase); + } + TipoArmaExpLovController.openLov(params); + } else { + MessageHelper + .setMessageError("POR FAVOR SELECCIONE UNA CLASE DE ARMA O EXPLOSIVO"); + } + } + + /** + * Metodo usado para abrir el dialogo seleccionar tipo de arma o explosivo + * de la pantalla crear/editar + */ + public void openTipoDialogLov() { + if (record.isnew) { + if (claseD != null && claseCodigoD != null) { + Map> params = new HashMap<>(); + List valuesArmaFuego = new ArrayList(); + valuesArmaFuego.add(isArmaFuegoD.toString()); + params.put("isArmaFuego", valuesArmaFuego); + if (isArmaFuegoD) { + List valuesLongitud = new ArrayList(); + valuesLongitud.add(longitudD); + params.put("longitud", valuesLongitud); + } else { + List valuesClase = new ArrayList(); + valuesClase.add(claseD); + params.put("clase", valuesClase); + } + TipoArmaExpLovController.openLov(params); + } else { + MessageHelper + .setMessageError("POR FAVOR SELECCIONE UNA CLASE DE ARMA O EXPLOSIVO"); + } + } else { + Map> params = new HashMap<>(); + List valuesArmaFuego = new ArrayList(); + valuesArmaFuego.add(isArmaFuegoD.toString()); + params.put("isArmaFuego", valuesArmaFuego); + if (isArmaFuegoD) { + List valuesLongitud = new ArrayList(); + valuesLongitud.add(longitudD); + params.put("longitud", valuesLongitud); + } else { + List valuesClase = new ArrayList(); + valuesClase.add(claseD); + params.put("clase", valuesClase); + } + TipoArmaExpLovController.openLov(params); + } + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar + * tipo de arma o explosivo de la pantalla principal + */ + public void onReturnTipoLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.addFilter("tipoarmaexplosivo", t.getPk().getCatalog()); + super.addFilter("tipoarmaexplosivocodigo", t.getPk().getCatalogcode()); + super.addField("tipodescription", t.getDescription()); + actualizarElementosBusqueda("tipo"); + this.query(); + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar + * tipo de arma o explosivo de la pantalla crear/editar + */ + public void onReturnTipoDialogLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.addField("tipodescriptionD", t.getDescription()); + this.record.setTipoarmaexplosivo(t.getPk().getCatalog()); + ; + this.record.setTipoarmaexplosivocodigo(t.getPk().getCatalogcode()); + record.put("ntipo", t.getDescription()); + actualizarElementosBusquedaDialog("tipo"); + } + + /** + * Metodo usado para abrir el dialogo seleccionar calibre de arma o + * explosivo de la pantalla principal y del dialogo crear/editar + */ + public void openCalibreLov() { + Map> params = new HashMap<>(); + CalibreLovController.openLov(params); + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar + * calibre de la pantalla principal + */ + public void onReturnCalibreLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.addFilter("calibre", t.getPk().getCatalog()); + super.addFilter("calibrecodigo", t.getPk().getCatalogcode()); + super.addField("calibredescription", t.getDescription()); + this.query(); + } + + /** + * Metodo usado para completar acciones al cerrar el dialogo seleccionar + * calibre de la pantalla crear/editar + */ + public void onReturnCalibreDialogLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.addField("calibredescriptionD", t.getDescription()); + this.record.setCalibre(t.getPk().getCatalog()); + this.record.setCalibrecodigo(t.getPk().getCatalogcode()); + record.put("ncalibre", t.getDescription()); + } + + /** + * Metodo que actualiza las descripciones seleccionadas en el dialogo + * crear/editar a la variable record y calcula valor de la variable + * isArmaFuegoD + */ + public void actualizar() { + super.addField("clasedescriptionD", record.get("nclase")); + super.addField("longituddescriptionD", record.get("nlongitud")); + super.addField("tipodescriptionD", record.get("ntipo")); + super.addField("calibredescriptionD", record.get("ncalibre")); + super.addField("unidaddescriptionD", record.get("nunidadMedidaPeso")); + claseD = record.getClase(); + claseCodigoD = record.getClasecodigo(); + if (record.getClase().equalsIgnoreCase(CODIGOARMADEFUEGO)) { + isArmaFuegoD = true; + longitudD = record.getLongitud(); + } else { + isArmaFuegoD = false; + } + } + + @Override + public void update() throws Exception { + if (record.getClase() != null) { + if (record.getClase().equalsIgnoreCase(CODIGOARMADEFUEGO)) { + if (record.getLongitud() != null) { + if (record.getTipoarmaexplosivo() != null) { + if (record.getCalibre() != null) { + if (record.getUnidadmedidapeso() != null) { + super.update(); + } else { + MessageHelper.setMessageError("SELECCIONE UNA UNIDAD PARA EL ARMA O EXPLOSIVO"); + } + } else { + MessageHelper + .setMessageError("SELECCIONE UN CALIBRE PARA EL ARMA O EXPLOSIVO"); + } + } else { + MessageHelper + .setMessageError("SELECCIONE UN TIPO PARA EL ARMA O EXPLOSIVO"); + } + } else { + MessageHelper + .setMessageError("SELECCIONE UNA LONGITUD PARA EL ARMA O EXPLOSIVO"); + } + } else if (record.getTipoarmaexplosivo() != null) { + if (record.getUnidadmedidapeso() != null) { + super.update(); + } else { + MessageHelper.setMessageError("SELECCIONE UNA UNIDAD PARA EL ARMA O EXPLOSIVO"); + } + } else { + MessageHelper.setMessageError("SELECCIONE UN TIPO DE ARMA O EXPLOSIVO"); + } + } else { + MessageHelper.setMessageError("SELECCIONE UNA CLASE DE ARMA O EXPLOSIVO"); + } + } + + /** + * Find para encontrar las caracteristicas del arma mediante el pk. ctipo - + * tipo de arma o explosivo + */ + public static TarmTipoArmaExplosivo findarma(String ctipo) { + try { + if (ctipo == null) { + return null; + } + TiposArmasExplosivosController cc = new TiposArmasExplosivosController(); + + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", ctipo); + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Find para encontrar el pk del arma mediante las caracteristicas. Andres + * Cevallos + */ + public static TarmTipoArmaExplosivo findpk(String longitud, String calibre, + String clase, String tipoarmaexplosivo) { + try { + TiposArmasExplosivosController cc = new TiposArmasExplosivosController(); + + cc.init(); + cc.recperpage = 300; + cc.addFilter("longitud", longitud); + cc.addFilter("calibre", calibre); + cc.addFilter("clase", clase); + cc.addFilter("tipoarmaexplosivo", tipoarmaexplosivo); + cc.queryDatbase(longitud, calibre); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Find para encontrar el pk del arma mediante las caracteristicas. Andres + * Cevallos + */ + public static TarmTipoArmaExplosivo findByClaseLongitudCalibreTipoArma(String longitud, String calibre, String clase, + String tipoarmaexplosivo, String unidadmedidapeso) { + try { + TiposArmasExplosivosController cc = new TiposArmasExplosivosController(); + + cc.init(); + cc.recperpage = 300; + cc.addFilter("longitud", longitud); + cc.addFilter("calibre", calibre); + cc.addFilter("clase", clase); + cc.addFilter("tipoarmaexplosivo", tipoarmaexplosivo); + cc.addFilter("unidadmedidapeso", unidadmedidapeso); + cc.queryDatbase(longitud, calibre); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Find para encontrar el pk del arma mediante las caracteristicas. FPazmino + * Cevallos + */ + public static TarmTipoArmaExplosivo findByClaseCalibreTipoArma(String clase, String calibre, + String tipoarmaexplosivo, String unidadmedidapeso) { + try { + TiposArmasExplosivosController cc = new TiposArmasExplosivosController(); + + cc.init(); + cc.recperpage = 300; + cc.addFilter("clase", clase); + cc.addFilter("calibre", calibre); + cc.addFilter("tipoarmaexplosivo", tipoarmaexplosivo); + cc.addFilter("unidadmedidapeso", unidadmedidapeso); + cc.queryDatbase(null, calibre); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que busca una combinacion de tipo arma explosivo por la clase y el + * tipo de arma pasados como parametro + * + * @param clase + * @param tipoarmaexplosivo + * @return + */ + public static TarmTipoArmaExplosivo findByClaseTipo(String clase, + String tipoarmaexplosivo, String unidadmedidapeso) { + try { + TiposArmasExplosivosController cc = new TiposArmasExplosivosController(); + + cc.init(); + cc.recperpage = 300; + cc.addFilter("clase", clase); + cc.addFilter("tipoarmaexplosivo", tipoarmaexplosivo); + cc.addFilter("unidadmedidapeso", unidadmedidapeso); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que busca todas las combinaciones de tipos armas explosivos por la + * clase y el tipo de arma pasados como parametro + * + * @param clase + * @param tipoarmaexplosivo + * @return + */ + public static List findByClaseTipoAll(String clase, + String tipoarmaexplosivo) { + try { + TiposArmasExplosivosController cc = new TiposArmasExplosivosController(); + + cc.init(); + cc.recperpage = 300; + cc.addFilter("clase", clase); + cc.addFilter("tipoarmaexplosivo", tipoarmaexplosivo); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/TotalPersonaController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/TotalPersonaController.java new file mode 100644 index 0000000..bb2b868 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/TotalPersonaController.java @@ -0,0 +1,172 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmTotalPersona; + +public class TotalPersonaController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public TotalPersonaController() throws Exception { + super(TarmTotalPersona.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + private void init() { + try { + recperpage = 100; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "TOTALPERSONACONTROLLER"; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + + if (this.getMfilelds().get("fechamaxima") != null) { + Filter filter = new Filter(); + filter.setSql(this.getMfilelds().get("fechamaxima").toString()); + dto.addFiltro(filter); + } + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + Collections.sort(lrecord, new Comparator() { + public int compare(TarmTotalPersona o1, TarmTotalPersona o2) { + return ((Date) (o1.getFecha())).after((Date) (o2.getFecha())) ? -1 : 1; + } + }); + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + public void update(TarmTotalPersona bean) throws Exception { + record = bean; + super.update(); + } + + /** + * Busca el total de un arma para una persona + */ + public static TarmTotalPersona find(String clase, String tipoArmaEplosivo, String codigoPersona) { + try { + TotalPersonaController cc = new TotalPersonaController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("clase", clase); + cc.addFilter("tipoarmaexplosivo", tipoArmaEplosivo); + cc.addFilter("personcodigo", codigoPersona); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca el total de un arma para una persona + */ + public static TarmTotalPersona findMaxFecha(String clase, String tipoArmaEplosivo, String codigoPersona, String unidad) { + try { + TotalPersonaController cc = new TotalPersonaController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("clase", clase); + cc.addFilter("tipoarmaexplosivo", tipoArmaEplosivo); + cc.addFilter("personcodigo", codigoPersona); + cc.addField("fechamaxima", "t.fecha=(select max(o.fecha) from TarmTotalPersona o where o.clase='" + clase + "' and tipoarmaexplosivo='" + tipoArmaEplosivo + "' and o.personcodigo='" + codigoPersona + "')"); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/UnidadTipoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/UnidadTipoController.java new file mode 100644 index 0000000..4d47fc6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/UnidadTipoController.java @@ -0,0 +1,446 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmUnidadTipo; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TarmUnidTipo. + * + * @author C.P. + * @version 2 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class UnidadTipoController extends AbstractController { + + /** + * catalogo de las unidades + */ + private List lunidades; + /** + * atributo para la descripcion de la clase del arma + */ + private String descripcionClase; + /** + * atributo para la descripcion del tipo del arma + */ + private String descripcionTipoArma; + + public UnidadTipoController() throws Exception { + super(TarmUnidadTipo.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + lunidades = CatalogDetailController.find("UNIDADMEDIDA"); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "UNIDTIPO"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); +// dto.setOrderby("t.description"); + + SubQuery sclasearma = new SubQuery("TgeneCatalogDetail", "description", "desclasearma", "i.pk.catalog = t.pk.clase and i.pk.catalogcode=t.pk.clasecode"); + SubQuery stipoarma = new SubQuery("TgeneCatalogDetail", "description", "destipoarma", "i.pk.catalog = t.pk.tipoarmaexplosivo and i.pk.catalogcode=t.pk.tipoarmaexplosivocodigo"); + SubQuery sunidad = new SubQuery("TgeneCatalogDetail", "description", "desunidad", "i.pk.catalog = t.pk.unidadmedidapeso and i.pk.catalogcode=t.pk.unidadmedidapesocodigo"); + + dto.addSubQuery(stipoarma); + dto.addSubQuery(sclasearma); + dto.addSubQuery(sunidad); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp + .get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaseSimple() { + try { + DtoQuery dto = super.getDtoQuery(true); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp + .get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia del registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @Override + public void update() throws Exception { + if (record.getModifiedData().get("desclasearma") == null || record.getModifiedData().get("desclasearma").toString().trim().length() == 0) { + MessageHelper.setMessageError("SELECCIONE LA CLASE"); + return; + } + if (record.getModifiedData().get("destipoarma") == null || record.getModifiedData().get("destipoarma").toString().trim().length() == 0) { + MessageHelper.setMessageError("SELECCIONE EL TIPO DE ARMA"); + return; + } + this.record.getPk().setUnidadmedidapesocodigo("UNIDADMEDIDA"); + record.setFecharegistro(new java.sql.Date(new Date().getTime())); + catalogos(lunidades, record.getPk().getUnidadmedidapeso(), "desunidad"); + super.update(); + } + + public void update(TarmUnidadTipo bean) throws Exception { + record = bean; + super.update(); + } + + /** + * Metodo para recorreer los combos y setear las descripciones de lo q se + * escoge para la vista + * + * @param list + * @param codigo + * @param pk + */ + public void catalogos(List list, String codigo, String pk) { + for (TgeneCatalogDetail item : list) { + if (codigo.equals(item.getPk().getCatalog())) { + record.modifiedData.put(pk, item.getDescription()); + break; + } + } + } + + public void openClaseLov() { + Map> params = new HashMap<>(); + List lcat = new ArrayList<>(); + lcat.add("CLASE"); + params.put("catalogcode", lcat); + List ldescripcion = new ArrayList<>(); + ldescripcion.add(MsgControlArmas.getProperty("lvh_clase")); + params.put("tituloLOV", ldescripcion); + ClaseLovController.openLov(params); + + } + + private String codigoClase; + + public void openTipoArmaLov() { + if (codigoClase == null || codigoClase.trim().length() == 0) { + MessageHelper.setMessageError("SELECCIONE LA CLASE"); + return; + } + Map> params = new HashMap<>(); + String codigoslonguitud = ""; + String codigoslonguitud2 = ""; + List lista = CatalogDetailController.find("LONGITUD", codigoClase); + if (lista != null) { + for (TgeneCatalogDetail catalogo : lista) { + if (codigoslonguitud == null || codigoslonguitud.length() == 0) { + codigoslonguitud += catalogo.getPk().getCatalog(); + } else if (codigoslonguitud2 == null || codigoslonguitud2.length() == 0) { + codigoslonguitud2 += " legalcode= '" + catalogo.getPk().getCatalog() + "'"; + } else { + codigoslonguitud2 += " or t.legalcode= '" + catalogo.getPk().getCatalog() + "'"; + } + } + } + List l = new ArrayList<>(); + if (codigoslonguitud != null && codigoslonguitud.length() > 0) { + l.add(codigoslonguitud); + } else { + l.add(codigoClase); + } + params.put("legalcode", l); + + List l2 = new ArrayList<>(); + if (codigoslonguitud2 != null && codigoslonguitud2.length() > 0) { + l2.add(codigoslonguitud2); + } + params.put("legalcode2", l2); + List lcat = new ArrayList<>(); + lcat.add("TIPOARMAEXPLOSIVO"); + params.put("catalogcode", lcat); + + List ldescripcion = new ArrayList<>(); + ldescripcion.add(MsgControlArmas.getProperty("lvh_tipoarma")); + params.put("tituloLOV", ldescripcion); + ClaseLovController.openLov(params); + + } + + private String codigoClaseD; + + public void openTipoArmaDialogLov() { + if (codigoClaseD == null || codigoClaseD.trim().length() == 0) { + MessageHelper.setMessageError("SELECCIONE LA CLASE"); + return; + } + Map> params = new HashMap<>(); + String codigoslonguitud = ""; + String codigoslonguitud2 = ""; + List lista = CatalogDetailController.find("LONGITUD", codigoClaseD); + if (lista != null) { + for (TgeneCatalogDetail catalogo : lista) { + if (codigoslonguitud == null || codigoslonguitud.length() == 0) { + codigoslonguitud += catalogo.getPk().getCatalog(); + } else if (codigoslonguitud2 == null || codigoslonguitud2.length() == 0) { + codigoslonguitud2 += " legalcode= '" + catalogo.getPk().getCatalog() + "'"; + } else { + codigoslonguitud2 += " or t.legalcode= '" + catalogo.getPk().getCatalog() + "'"; + } + } + } + List l = new ArrayList<>(); + if (codigoslonguitud != null && codigoslonguitud.length() > 0) { + l.add(codigoslonguitud); + } else { + l.add(codigoClaseD); + } + params.put("legalcode", l); + + List l2 = new ArrayList<>(); + if (codigoslonguitud2 != null && codigoslonguitud2.length() > 0) { + l2.add(codigoslonguitud2); + } + params.put("legalcode2", l2); + List lcat = new ArrayList<>(); + lcat.add("TIPOARMAEXPLOSIVO"); + params.put("catalogcode", lcat); + + List ldescripcion = new ArrayList<>(); + ldescripcion.add(MsgControlArmas.getProperty("lvh_tipoarma")); + params.put("tituloLOV", ldescripcion); + ClaseLovController.openLov(params); + + } + + public void onReturnClaseLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.getMfilters().put("pk.clase", t.getPk().getCatalog()); + descripcionClase = t.getDescription(); + codigoClase = t.getPk().getCatalog(); + //encero + super.getMfilters().put("pk.tipoarmaexplosivo", null); + descripcionTipoArma = null; + } + + public void onReturnTipoArmaLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + super.getMfilters().put("pk.tipoarmaexplosivo", t.getPk().getCatalog()); + descripcionTipoArma = t.getDescription(); + } + + public void onReturnClaseDialogLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + record.getPk().setClase(t.getPk().getCatalog()); + record.getPk().setClasecode(t.getPk().getCatalogcode()); + record.getModifiedData().put("desclasearma", t.getDescription()); + codigoClaseD = t.getPk().getCatalog(); + //encero + record.getPk().setTipoarmaexplosivo(null); + record.getPk().setTipoarmaexplosivocodigo(null); + record.getModifiedData().put("destipoarma", null); + } + + public void onReturnTipoArmaDialogLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + record.getPk().setTipoarmaexplosivo(t.getPk().getCatalog()); + record.getPk().setTipoarmaexplosivocodigo(t.getPk().getCatalogcode()); + record.getModifiedData().put("destipoarma", t.getDescription()); +// codigoClase=t.getPk().getCatalog(); + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * + * @param catalogcode Có de catálogo + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static List find(String catalogcode) { + try { + UnidadTipoController cc = new UnidadTipoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", catalogcode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Obtiene un tipo de unidad por la clase y el codigo de clase + */ + public static TarmUnidadTipo findByClaseAndClasecode(String clase, String clasecode, String tipoArmaExplosivo, String unidadMedida) { + try { + UnidadTipoController cc = new UnidadTipoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.clase", clase); + cc.addFilter("pk.clasecode", clasecode); + cc.addFilter("pk.tipoarmaexplosivo", tipoArmaExplosivo); + cc.addFilter("pk.unidadmedidapeso", unidadMedida); + cc.querydatabaseSimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmUnidadTipo find(String clase, String tipoarmaexplosivo) { + try { + UnidadTipoController cc = new UnidadTipoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.clase", clase); + cc.addFilter("pk.tipoarmaexplosivo", tipoarmaexplosivo); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public List getLunidades() { + return lunidades; + } + + public void setLunidades(List lunidades) { + this.lunidades = lunidades; + } + + public String getDescripcionClase() { + return descripcionClase; + } + + public void setDescripcionClase(String descripcionClase) { + this.descripcionClase = descripcionClase; + } + + public String getDescripcionTipoArma() { + return descripcionTipoArma; + } + + public void setDescripcionTipoArma(String descripcionTipoArma) { + this.descripcionTipoArma = descripcionTipoArma; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/VentaTotalPersonaController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/VentaTotalPersonaController.java new file mode 100644 index 0000000..2c1cb9a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/VentaTotalPersonaController.java @@ -0,0 +1,95 @@ +package com.fp.frontend.controller.armas.parametros; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmTotalPersona; + +@ManagedBean +@ViewScoped +public class VentaTotalPersonaController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public VentaTotalPersonaController() throws Exception { + super(TarmTotalPersona.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + private void init() { + try { + recperpage = 15; + lrecord = new ArrayList<>(); + beanalias = "VENTATOTALPERSONA"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/util/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/util/.svn/entries new file mode 100644 index 0000000..cc7d205 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/util/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/util +svn://172.17.26.185/COMACO + + + +2020-01-15T23:50:20.451652Z +4625 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +EstadosSolicitudBPM.java +file + + + + +2022-07-28T03:39:54.458594Z +15988f3215210fb76970fedfe9ec97a1 +2020-01-15T23:50:20.451652Z +4625 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1358 + +TipoArmaExplosivoPKExcel.java +file + + + + +2022-07-28T03:39:54.458594Z +1c33271492445c2c408ba1dcd0b3e679 +2020-01-15T23:50:20.451652Z +4625 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1821 + +ArmasExcel.java +file + + + + +2022-07-28T03:39:54.458594Z +44a43c721b6bbbc3a0a56850b34061fc +2020-01-15T23:50:20.451652Z +4625 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +3494 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/util/.svn/text-base/ArmasExcel.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/util/.svn/text-base/ArmasExcel.java.svn-base new file mode 100644 index 0000000..d9a4171 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/util/.svn/text-base/ArmasExcel.java.svn-base @@ -0,0 +1,136 @@ +package com.fp.frontend.controller.armas.parametros.util; + +import java.io.Serializable; + + +public class ArmasExcel implements Serializable { + + + private static final long serialVersionUID = 1L; + + String orden; + String longuitud; + String calibre; + String clase;//material + String tipoArmaExplosivo;// modelo: REVOLVER CARTUCHERA CARTUCHERANO CARABINA SUB-AMETRALLADORA*revisar + String marca; + String tipoFabricacion; + String serie; + String fechaRecepcion; + String motivo; + String descripcionProvincia; + String descripcionCanton; + String observaciones; + int cont; + + public ArmasExcel(){ + } + + public ArmasExcel(String orden,String longuitud,String calibre, + String clase,String tipoArmaExplosivo,String marca, + String tipoFabricacion,String serie,String fechaRecepcion, + String motivo,String descripcionProvincia,String descripcionCanton, + String observaciones, int cont) { + super(); + this.orden = orden; + this.longuitud = longuitud; + this.calibre = calibre; + this.clase = clase; + this.tipoArmaExplosivo = tipoArmaExplosivo; + this.marca = marca; + this.tipoFabricacion = tipoFabricacion; + this.serie = serie; + this.fechaRecepcion = fechaRecepcion; + this.motivo = motivo; + this.descripcionProvincia = descripcionProvincia; + this.descripcionCanton = descripcionCanton; + this.observaciones = observaciones; + this.cont = cont; + } + public String getOrden() { + return orden; + } + public void setOrden(String orden) { + this.orden = orden; + } + public String getLonguitud() { + return longuitud; + } + public void setLonguitud(String longuitud) { + this.longuitud = longuitud; + } + public String getCalibre() { + return calibre; + } + public void setCalibre(String calibre) { + this.calibre = calibre; + } + public String getClase() { + return clase; + } + public void setClase(String clase) { + this.clase = clase; + } + public String getTipoArmaExplosivo() { + return tipoArmaExplosivo; + } + public void setTipoArmaExplosivo(String tipoArmaExplosivo) { + this.tipoArmaExplosivo = tipoArmaExplosivo; + } + public String getMarca() { + return marca; + } + public void setMarca(String marca) { + this.marca = marca; + } + public String getTipoFabricacion() { + return tipoFabricacion; + } + public void setTipoFabricacion(String tipoFabricacion) { + this.tipoFabricacion = tipoFabricacion; + } + public String getSerie() { + return serie; + } + public void setSerie(String serie) { + this.serie = serie; + } + public String getFechaRecepcion() { + return fechaRecepcion; + } + public void setFechaRecepcion(String fechaRecepcion) { + this.fechaRecepcion = fechaRecepcion; + } + public String getMotivo() { + return motivo; + } + public void setMotivo(String motivo) { + this.motivo = motivo; + } + public String getDescripcionProvincia() { + return descripcionProvincia; + } + public void setDescripcionProvincia(String descripcionProvincia) { + this.descripcionProvincia = descripcionProvincia; + } + public String getDescripcionCanton() { + return descripcionCanton; + } + public void setDescripcionCanton(String descripcionCanton) { + this.descripcionCanton = descripcionCanton; + } + public String getObservaciones() { + return observaciones; + } + public void setObservaciones(String observaciones) { + this.observaciones = observaciones; + } + public int getCont() { + return cont; + } + public void setCont(int cont) { + this.cont = cont; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/util/.svn/text-base/EstadosSolicitudBPM.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/util/.svn/text-base/EstadosSolicitudBPM.java.svn-base new file mode 100644 index 0000000..e3aa2a3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/util/.svn/text-base/EstadosSolicitudBPM.java.svn-base @@ -0,0 +1,59 @@ +package com.fp.frontend.controller.armas.parametros.util; + +import java.util.Date; + +public class EstadosSolicitudBPM { + + String actividad; + String usuarioasignado; + String grupoasignado; + String estado; + Date fechacreacion; + Date fechainicio; + Date fechacompleta; + + public String getActividad() { + return actividad; + } + public void setActividad(String actividad) { + this.actividad = actividad; + } + public String getUsuarioasignado() { + return usuarioasignado; + } + public void setUsuarioasignado(String usuarioasignado) { + this.usuarioasignado = usuarioasignado; + } + public String getGrupoasignado() { + return grupoasignado; + } + public void setGrupoasignado(String grupoasignado) { + this.grupoasignado = grupoasignado; + } + public String getEstado() { + return estado; + } + public void setEstado(String estado) { + this.estado = estado; + } + public Date getFechacreacion() { + return fechacreacion; + } + public void setFechacreacion(Date fechacreacion) { + this.fechacreacion = fechacreacion; + } + public Date getFechainicio() { + return fechainicio; + } + public void setFechainicio(Date fechainicio) { + this.fechainicio = fechainicio; + } + public Date getFechacompleta() { + return fechacompleta; + } + public void setFechacompleta(Date fechacompleta) { + this.fechacompleta = fechacompleta; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/util/.svn/text-base/TipoArmaExplosivoPKExcel.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/util/.svn/text-base/TipoArmaExplosivoPKExcel.java.svn-base new file mode 100644 index 0000000..4d3c31c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/util/.svn/text-base/TipoArmaExplosivoPKExcel.java.svn-base @@ -0,0 +1,65 @@ +package com.fp.frontend.controller.armas.parametros.util; + +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; + +public class TipoArmaExplosivoPKExcel { + + private String longitud; + private String calibre; + private String clase; + private String tipoarmaexplosivo; + private String unidadmedidapeso; + private TarmTipoArmaExplosivo tipoArmaExplosivoClase; + + + public TipoArmaExplosivoPKExcel(String longitud, String calibre, + String clase, String tipoarmaexplosivo, String unidadmedidapeso, + TarmTipoArmaExplosivo tipoArmaExplosivoClase) { + super(); + this.longitud = longitud; + this.calibre = calibre; + this.clase = clase; + this.tipoarmaexplosivo = tipoarmaexplosivo; + this.unidadmedidapeso = unidadmedidapeso; + this.tipoArmaExplosivoClase = tipoArmaExplosivoClase; + } + public String getLongitud() { + return longitud; + } + public void setLongitud(String longitud) { + this.longitud = longitud; + } + public String getCalibre() { + return calibre; + } + public void setCalibre(String calibre) { + this.calibre = calibre; + } + public String getClase() { + return clase; + } + public void setClase(String clase) { + this.clase = clase; + } + public String getTipoarmaexplosivo() { + return tipoarmaexplosivo; + } + public void setTipoarmaexplosivo(String tipoarmaexplosivo) { + this.tipoarmaexplosivo = tipoarmaexplosivo; + } + public String getUnidadmedidapeso() { + return unidadmedidapeso; + } + public void setUnidadmedidapeso(String unidadmedidapeso) { + this.unidadmedidapeso = unidadmedidapeso; + } + public TarmTipoArmaExplosivo getTipoArmaExplosivoClase() { + return tipoArmaExplosivoClase; + } + public void setTipoArmaExplosivoClase( + TarmTipoArmaExplosivo tipoArmaExplosivoClase) { + this.tipoArmaExplosivoClase = tipoArmaExplosivoClase; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/util/ArmasExcel.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/util/ArmasExcel.java new file mode 100644 index 0000000..400f378 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/util/ArmasExcel.java @@ -0,0 +1,161 @@ +package com.fp.frontend.controller.armas.parametros.util; + +import java.io.Serializable; + +public class ArmasExcel implements Serializable { + + private static final long serialVersionUID = 1L; + + String orden; + String longuitud; + String calibre; + String clase;//material + String tipoArmaExplosivo;// modelo: REVOLVER CARTUCHERA CARTUCHERANO CARABINA SUB-AMETRALLADORA*revisar + String marca; + String tipoFabricacion; + String serie; + String fechaRecepcion; + String motivo; + String descripcionProvincia; + String descripcionCanton; + String observaciones; + int cont; + + public ArmasExcel() { + } + + public ArmasExcel(String orden, String longuitud, String calibre, + String clase, String tipoArmaExplosivo, String marca, + String tipoFabricacion, String serie, String fechaRecepcion, + String motivo, String descripcionProvincia, String descripcionCanton, + String observaciones, int cont) { + super(); + this.orden = orden; + this.longuitud = longuitud; + this.calibre = calibre; + this.clase = clase; + this.tipoArmaExplosivo = tipoArmaExplosivo; + this.marca = marca; + this.tipoFabricacion = tipoFabricacion; + this.serie = serie; + this.fechaRecepcion = fechaRecepcion; + this.motivo = motivo; + this.descripcionProvincia = descripcionProvincia; + this.descripcionCanton = descripcionCanton; + this.observaciones = observaciones; + this.cont = cont; + } + + public String getOrden() { + return orden; + } + + public void setOrden(String orden) { + this.orden = orden; + } + + public String getLonguitud() { + return longuitud; + } + + public void setLonguitud(String longuitud) { + this.longuitud = longuitud; + } + + public String getCalibre() { + return calibre; + } + + public void setCalibre(String calibre) { + this.calibre = calibre; + } + + public String getClase() { + return clase; + } + + public void setClase(String clase) { + this.clase = clase; + } + + public String getTipoArmaExplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoArmaExplosivo(String tipoArmaExplosivo) { + this.tipoArmaExplosivo = tipoArmaExplosivo; + } + + public String getMarca() { + return marca; + } + + public void setMarca(String marca) { + this.marca = marca; + } + + public String getTipoFabricacion() { + return tipoFabricacion; + } + + public void setTipoFabricacion(String tipoFabricacion) { + this.tipoFabricacion = tipoFabricacion; + } + + public String getSerie() { + return serie; + } + + public void setSerie(String serie) { + this.serie = serie; + } + + public String getFechaRecepcion() { + return fechaRecepcion; + } + + public void setFechaRecepcion(String fechaRecepcion) { + this.fechaRecepcion = fechaRecepcion; + } + + public String getMotivo() { + return motivo; + } + + public void setMotivo(String motivo) { + this.motivo = motivo; + } + + public String getDescripcionProvincia() { + return descripcionProvincia; + } + + public void setDescripcionProvincia(String descripcionProvincia) { + this.descripcionProvincia = descripcionProvincia; + } + + public String getDescripcionCanton() { + return descripcionCanton; + } + + public void setDescripcionCanton(String descripcionCanton) { + this.descripcionCanton = descripcionCanton; + } + + public String getObservaciones() { + return observaciones; + } + + public void setObservaciones(String observaciones) { + this.observaciones = observaciones; + } + + public int getCont() { + return cont; + } + + public void setCont(int cont) { + this.cont = cont; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/util/EstadosSolicitudBPM.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/util/EstadosSolicitudBPM.java new file mode 100644 index 0000000..5efa878 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/util/EstadosSolicitudBPM.java @@ -0,0 +1,71 @@ +package com.fp.frontend.controller.armas.parametros.util; + +import java.util.Date; + +public class EstadosSolicitudBPM { + + String actividad; + String usuarioasignado; + String grupoasignado; + String estado; + Date fechacreacion; + Date fechainicio; + Date fechacompleta; + + public String getActividad() { + return actividad; + } + + public void setActividad(String actividad) { + this.actividad = actividad; + } + + public String getUsuarioasignado() { + return usuarioasignado; + } + + public void setUsuarioasignado(String usuarioasignado) { + this.usuarioasignado = usuarioasignado; + } + + public String getGrupoasignado() { + return grupoasignado; + } + + public void setGrupoasignado(String grupoasignado) { + this.grupoasignado = grupoasignado; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public Date getFechacreacion() { + return fechacreacion; + } + + public void setFechacreacion(Date fechacreacion) { + this.fechacreacion = fechacreacion; + } + + public Date getFechainicio() { + return fechainicio; + } + + public void setFechainicio(Date fechainicio) { + this.fechainicio = fechainicio; + } + + public Date getFechacompleta() { + return fechacompleta; + } + + public void setFechacompleta(Date fechacompleta) { + this.fechacompleta = fechacompleta; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/util/TipoArmaExplosivoPKExcel.java b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/util/TipoArmaExplosivoPKExcel.java new file mode 100644 index 0000000..4b54541 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/parametros/util/TipoArmaExplosivoPKExcel.java @@ -0,0 +1,75 @@ +package com.fp.frontend.controller.armas.parametros.util; + +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; + +public class TipoArmaExplosivoPKExcel { + + private String longitud; + private String calibre; + private String clase; + private String tipoarmaexplosivo; + private String unidadmedidapeso; + private TarmTipoArmaExplosivo tipoArmaExplosivoClase; + + public TipoArmaExplosivoPKExcel(String longitud, String calibre, + String clase, String tipoarmaexplosivo, String unidadmedidapeso, + TarmTipoArmaExplosivo tipoArmaExplosivoClase) { + super(); + this.longitud = longitud; + this.calibre = calibre; + this.clase = clase; + this.tipoarmaexplosivo = tipoarmaexplosivo; + this.unidadmedidapeso = unidadmedidapeso; + this.tipoArmaExplosivoClase = tipoArmaExplosivoClase; + } + + public String getLongitud() { + return longitud; + } + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + public String getCalibre() { + return calibre; + } + + public void setCalibre(String calibre) { + this.calibre = calibre; + } + + public String getClase() { + return clase; + } + + public void setClase(String clase) { + this.clase = clase; + } + + public String getTipoarmaexplosivo() { + return tipoarmaexplosivo; + } + + public void setTipoarmaexplosivo(String tipoarmaexplosivo) { + this.tipoarmaexplosivo = tipoarmaexplosivo; + } + + public String getUnidadmedidapeso() { + return unidadmedidapeso; + } + + public void setUnidadmedidapeso(String unidadmedidapeso) { + this.unidadmedidapeso = unidadmedidapeso; + } + + public TarmTipoArmaExplosivo getTipoArmaExplosivoClase() { + return tipoArmaExplosivoClase; + } + + public void setTipoArmaExplosivoClase( + TarmTipoArmaExplosivo tipoArmaExplosivoClase) { + this.tipoArmaExplosivoClase = tipoArmaExplosivoClase; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/entries new file mode 100644 index 0000000..345f967 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/entries @@ -0,0 +1,3360 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +DocumentoHabilitanteDetalleController.java +file + + + + +2022-07-28T03:39:52.562586Z +df47b6b679bf1ac5b90e1e0e2a5fbe93 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +5267 + +ReporteAutorizacionesController.java +file + + + + +2022-07-28T03:39:52.563586Z +4787be155cf70635112d168bee04ff3b +2016-01-13T17:51:54.677065Z +4375 +cflores + + + + + + + + + + + + + + + + + + + + + +18934 + +TarmSolicitudDocumentoController.java +file + + + + +2022-07-28T03:39:52.564586Z +ba6dfef3a400f1bd1983282b952b2802 +2015-01-19T06:22:07.034172Z +3764 +cpiedra + + + + + + + + + + + + + + + + + + + + + +18808 + +ValidacionTramiteLibreTransitoController.java +file + + + + +2022-07-28T03:39:52.563586Z +b27b9b44b1fd12f67d9460ad478c484d +2014-12-01T11:13:36.691599Z +3201 +cpiedra + + + + + + + + + + + + + + + + + + + + + +29676 + +DocumentoHabilitanteController.java +file + + + + +2022-07-28T03:39:52.564586Z +85a2a90c142a3e77a0401b70d18fc511 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +65876 + +RegistrarNovedadController.java +file + + + + +2022-07-28T03:39:52.565586Z +38a8f0c8029bd96921e7247ff59bb266 +2014-11-20T09:32:50.992676Z +3017 +cpiedra + + + + + + + + + + + + + + + + + + + + + +21444 + +DecomisoArmaController.java +file + + + + +2022-07-28T03:39:52.565586Z +b8813b4546081da877f1ea84f70da9aa +2016-02-18T13:51:38.807107Z +4458 +cvasquez + + + + + + + + + + + + + + + + + + + + + +15831 + +VerificacionBodegaController.java +file + + + + +2022-07-28T03:39:52.564586Z +4740f4f97b1d7be9b08ea6df41120ac1 +2016-06-09T15:42:54.046599Z +4544 +cvasquez + + + + + + + + + + + + + + + + + + + + + +43502 + +ReclamoDecomisoController.java +file + + + + +2022-07-28T03:39:52.565586Z +e3848f6601db2d0d5eeb99b305621beb +2021-12-08T19:17:47.063140Z +4656 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +18585 + +CargarDepositoController.java +file + + + + +2022-07-28T03:39:52.565586Z +3fb7b2512fe778d2aa2f1888f0d4374c +2019-01-14T03:06:37.641608Z +4617 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +25071 + +CustodiaTempAeropuertoController.java +file + + + + +2022-07-28T03:39:52.566586Z +88ebd61fc2b73c4e1800b18be91b1891 +2015-05-04T05:47:02.244193Z +4070 +fpazmino + + + + + + + + + + + + + + + + + + + + + +27450 + +ReporteConsultaSolicitudController.java +file + + + + +2022-07-28T03:39:52.567586Z +47eeb0b2d5a94c97a95308eb1457cb20 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +40022 + +AgenciaSucursalController.java +file + + + + +2022-07-28T03:39:52.566586Z +8733466e2b910302ab57f9491bac14ec +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +9214 + +FichasTecnicasFlatantesController.java +file + + + + +2022-07-28T03:39:52.566586Z +aa51cd383e8d89dd3cd7a176ac667dbb +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +45383 + +RevisarRprteArmasADestJefDepController.java +file + + + + +2022-07-28T03:39:52.567586Z +2e264fce4cb3b21768e340c62c814050 +2014-11-18T04:01:43.417846Z +2898 +fpazmino + + + + + + + + + + + + + + + + + + + + + +9817 + +ConsultaArmasController.java +file + + + + +2022-07-28T03:39:52.567586Z +d052f814d0e1236a231452b20d542030 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +26259 + +CustodiosController.java +file + + + + +2022-07-28T03:39:52.568586Z +0e8342839afa58e0da4cbbf5b4739b3d +2014-11-28T07:52:43.760654Z +3171 +ogarcia + + + + + + + + + + + + + + + + + + + + + +7130 + +SancionarController.java +file + + + + +2022-07-28T03:39:52.568586Z +9fa74fbb76b796af1241e581a830d776 +2016-02-18T13:51:38.807107Z +4458 +cvasquez + + + + + + + + + + + + + + + + + + + + + +37485 + +ReporteLiquidacionEconomicaController.java +file + + + + +2022-07-28T03:39:52.568586Z +2102f9e8aa14907fb6ad2e2d0ba8bd02 +2015-01-13T12:03:46.449074Z +3748 +cguzman + + + + + + + + + + + + + + + + + + + + + +12340 + +InspeccionCambioArchivoController.java +file + + + + +2022-07-28T03:39:52.568586Z +3a33a35c1396244734281d9a520a0119 +2021-12-29T13:49:22.967449Z +4659 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +7597 + +BodegaController.java +file + + + + +2022-07-28T03:39:52.569586Z +e0bd2030587bf33630f542e30d36daee +2014-11-14T09:53:08.008087Z +2804 +fpazmino + + + + + + + + + + + + + + + + + + + + + +3352 + +SancionRecomendacionController.java +file + + + + +2022-07-28T03:39:52.569586Z +4b9b8b6eeb2252a45b481f7b5982ffda +2014-10-21T05:29:57.678112Z +1765 +acevallos + + + + + + + + + + + + + + + + + + + + + +3145 + +VerificarMaterialDecomisadoController.java +file + + + + +2022-07-28T03:39:52.569586Z +24ec282627751215a9fc33144aeb8d07 +2016-02-15T19:57:14.669988Z +4444 +cvasquez + + + + + + + + + + + + + + + + + + + + + +11897 + +ReporteSancionesController.java +file + + + + +2022-07-28T03:39:52.569586Z +2f3ecaf99d9318c01bff2706fe228380 +2016-01-13T17:51:54.677065Z +4375 +cflores + + + + + + + + + + + + + + + + + + + + + +15198 + +ReporteAgenciasSucursalesController.java +file + + + + +2022-07-28T03:39:52.570586Z +e4e6abb54d0f6474836a3a7007d8b941 +2017-05-29T03:14:21.052978Z +4595 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +8347 + +SolicitudTramiteController.java +file + + + + +2022-07-28T03:39:52.570586Z +fbba33212a96e9b5e12b6e57d4afbcb4 +2015-11-13T11:16:52.799869Z +4317 +fpazmino + + + + + + + + + + + + + + + + + + + + + +9393 + +SolicitudRequisitosController.java +file + + + + +2022-07-28T03:39:52.570586Z +d6db505e3c8e4f0d6767705311b81be4 +2015-06-15T14:16:38.090960Z +4109 +cpiedra + + + + + + + + + + + + + + + + + + + + + +10895 + +SolicitudCertificadoController.java +file + + + + +2022-07-28T03:39:52.571586Z +534718bece8f9f331d16c7a56bfd700a +2016-02-15T20:31:49.189787Z +4447 +cvasquez + + + + + + + + + + + + + + + + + + + + + +14453 + +AutorizacionDevolucionController.java +file + + + + +2022-07-28T03:39:52.571586Z +63f4ef4786752c94ebd0f9d02f8ff047 +2014-12-23T07:49:12.063421Z +3632 +cpiedra + + + + + + + + + + + + + + + + + + + + + +19421 + +SolicitudController.java +file + + + + +2022-07-28T03:39:52.571586Z +eb22e7b41661dde986ca90cdccbf7308 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +7111 + +DecomisoController.java +file + + + + +2022-07-28T03:39:52.571586Z +6013a85688a949bb29a5304641872b90 +2016-02-18T22:06:53.744044Z +4464 +cvasquez + + + + + + + + + + + + + + + + + + + + + +10588 + +RecepcionArmasNoEnviadasController.java +file + + + + +2022-07-28T03:39:52.572586Z +9e77cd4a499a4d66de6e1f8c3b7631b1 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +18095 + +ArticuloRegistradoController.java +file + + + + +2022-07-28T03:39:52.572586Z +b5c95865793777539b80bf5dffc532b8 +2020-01-15T23:50:20.451652Z +4625 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +17956 + +EnvioArmasNoIniciadasFlujoController.java +file + + + + +2022-07-28T03:39:52.572586Z +7017d8c6da01a36f1aa6dd112b030d35 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +18490 + +CertificadoFiscaliaController.java +file + + + + +2022-07-28T03:39:52.573586Z +b28ae1177c42b39f13846ed30faf537c +2016-02-04T16:55:05.043192Z +4429 +mcepeda + + + + + + + + + + + + + + + + + + + + + +32902 + +TarmSolicitudTramiteController.java +file + + + + +2022-07-28T03:39:52.573586Z +17d2e27ee2a7c85825f207a86c313ebe +2016-02-29T22:54:14.303059Z +4480 +fpazmino + + + + + + + + + + + + + + + + + + + + + +11230 + +ReclamoDecomisoCoordinadorMilitarController.java +file + + + + +2022-07-28T03:39:52.573586Z +57e39820173ff32081bff3b7607a211d +2021-12-08T19:17:47.063140Z +4656 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +9688 + +DocumentoHabilitanteConErrorController.java +file + + + + +2022-07-28T03:39:52.573586Z +d0e13907f91ac9a5fd01af8c35274adc +2016-02-25T17:54:21.420708Z +4477 +fpazmino + + + + + + + + + + + + + + + + + + + + + +39205 + +ReporteConsultaSolicitudClienteController.java +file + + + + +2022-07-28T03:39:52.574586Z +925912b4b11f5ea6244b15e2ffd9c694 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +39301 + +SancionDecomisoController.java +file + + + + +2022-07-28T03:39:52.574586Z +343a587f85fb28b57248592a890db389 +2014-12-22T09:40:55.014033Z +3622 +acevallos + + + + + + + + + + + + + + + + + + + + + +4241 + +SolicitudGuardiasController.java +file + + + + +2022-07-28T03:39:52.575586Z +0602afd6d6543471dd651a8150a52741 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +7949 + +VerificacionInformacionCertificado.java +file + + + + +2022-07-28T03:39:52.574586Z +0a3bfa677b0d2759aba13ac0b6056302 +2014-12-02T11:43:32.450015Z +3243 +dlopez + + + + + + + + + + + + + + + + + + + + + +13638 + +NotificarEmisionDocumentoController.java +file + + + + +2022-07-28T03:39:52.575586Z +22888d56d65f2c8ea61a2a60958bec76 +2015-08-19T12:13:44.250953Z +4271 +fpazmino + + + + + + + + + + + + + + + + + + + + + +22001 + +DecomisoMaterialController.java +file + + + + +2022-07-28T03:39:52.575586Z +7a586fd0b1666f295a012e5f4cf0956b +2021-12-08T19:17:47.063140Z +4656 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +84876 + +SolicitudArmasBPMController.java +file + + + + +2022-07-28T03:39:52.575586Z +f1f88d32c8139334492829c80410efb7 +2021-05-14T20:37:22.948846Z +4633 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +7128 + +RevisarReporteArmasADestruirController.java +file + + + + +2022-07-28T03:39:52.576586Z +a6213aedfceb0bf91c7aa2fc08b5d6af +2014-11-10T09:09:50.222744Z +2533 +fpazmino + + + + + + + + + + + + + + + + + + + + + +7021 + +SolicitudArmasController.java +file + + + + +2022-07-28T03:39:52.576586Z +bb4605c3168672a95a4b51cccded9ef1 +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +12882 + +ImprimirVerificacionReimpresionController.java +file + + + + +2022-07-28T03:39:52.576586Z +31828af55e003ccf7297259c0b46bb05 +2017-02-08T23:36:42.563355Z +4575 +jespinosa + + + + + + + + + + + + + + + + + + + + + +16627 + +RevisarRprteArmasADestJefCCController.java +file + + + + +2022-07-28T03:39:52.577586Z +1d3ba4020766b637b4750ccba5c0b102 +2014-11-18T04:01:13.380364Z +2897 +fpazmino + + + + + + + + + + + + + + + + + + + + + +9693 + +DetRepDestruirArmasController.java +file + + + + +2022-07-28T03:39:52.577586Z +838d9e76817aa4bb035273179882f6fe +2014-11-21T11:51:52.609481Z +3063 +fpazmino + + + + + + + + + + + + + + + + + + + + + +5572 + +TarmTramiteController.java +file + + + + +2022-07-28T03:39:52.577586Z +c156c544a5cf650d2d57ec50c4c21921 +2015-12-29T18:34:31.727682Z +4362 +cvasquez + + + + + + + + + + + + + + + + + + + + + +23683 + +ValidarDepositoController.java +file + + + + +2022-07-28T03:39:52.577586Z +b5adaf8769f6f7e38b22cc2ea1ce7fd5 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +33881 + +ReporteEstadisticasTramitesController.java +file + + + + +2022-07-28T03:39:52.578586Z +9fc32eb9f633e6d90da07f205a27c2ed +2014-12-12T04:27:00.576768Z +3447 +cguzman + + + + + + + + + + + + + + + + + + + + + +9408 + +InventariosController.java +file + + + + +2022-07-28T03:39:52.578586Z +4d92f0c33d7541bf7dd8f8a6e2dc270d +2016-02-15T19:57:14.669988Z +4444 +cvasquez + + + + + + + + + + + + + + + + + + + + + +85071 + +CabRepDestruirArmasController.java +file + + + + +2022-07-28T03:39:52.578586Z +45f628cd1034fd310d1bdd0ef08576a4 +2014-11-21T11:51:52.609481Z +3063 +fpazmino + + + + + + + + + + + + + + + + + + + + + +4879 + +ArmasController.java +file + + + + +2022-07-28T03:39:52.579586Z +88ebb392d031d08c570d48084915e9a2 +2021-12-29T13:49:22.967449Z +4659 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +91676 + +ReporteDestruccionArmasController.java +file + + + + +2022-07-28T03:39:52.579586Z +56d3bbdbce143c7e2311eab5ea895591 +2017-02-08T23:37:42.623840Z +4576 +jespinosa + + + + + + + + + + + + + + + + + + + + + +52579 + +ConsultaAlfrescoController.java +file + + + + +2022-07-28T03:39:52.579586Z +6374cfd75c089014b9ad3914bc544ece +2021-09-08T21:20:21.811590Z +4650 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +23263 + +TarmSolicitudArmasController.java +file + + + + +2022-07-28T03:39:52.579586Z +266e67fe8a4efe1f4920e48fc55aa9cf +2015-07-22T07:06:26.167523Z +4229 +fpazmino + + + + + + + + + + + + + + + + + + + + + +9090 + +VerificacionRequisitosSolicitudController.java +file + + + + +2022-07-28T03:39:52.580586Z +ace94c134d935f97450d82c745a1533c +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +45748 + +PlanificacionInspeccionController.java +file + + + + +2022-07-28T03:39:52.580586Z +951a45ad9cf0512c3249074625aff000 +2016-02-05T15:43:09.161911Z +4433 +cflores + + + + + + + + + + + + + + + + + + + + + +39013 + +GenerarOrdenTrabajoCustodiosController.java +file + + + + +2022-07-28T03:39:52.580586Z +cecf65df600c2c8aece71a47b621114b +2020-01-15T23:50:20.451652Z +4625 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +24725 + +IngresoFichaTecnicaArmasController.java +file + + + + +2022-07-28T03:39:52.581586Z +0b1aba4820471aa33352c4f220239827 +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +51156 + +RegistroInspeccionPlaniNoPlaniController.java +file + + + + +2022-07-28T03:39:52.581586Z +0e298eb933121bb7750df9e4e82c13eb +2016-01-20T17:08:28.980461Z +4390 +mcepeda + + + + + + + + + + + + + + + + + + + + + +26033 + +VerificacionInformacionDevolucionController.java +file + + + + +2022-07-28T03:39:52.581586Z +80f7a2581d31b82127274c8859289b0e +2015-03-09T12:24:00.615353Z +3918 +cpiedra + + + + + + + + + + + + + + + + + + + + + +24825 + +emitirDocumentoHabilitanteportransaccion.java +file + + + + +2022-07-28T03:39:52.582586Z +1517a85e7df571ff5bba9583945dffd5 +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +42026 + +CustodiaTemporalController.java +file + + + + +2022-07-28T03:39:52.582586Z +263ea67688d9de9aebc17f10d0d8fa57 +2014-10-09T04:34:07.557465Z +1512 +cpiedra + + + + + + + + + + + + + + + + + + + + + +3971 + +PermisosAutorizacionesController.java +file + + + + +2022-07-28T03:39:52.582586Z +cee21e71239938ad88f8a870d84faf82 +2021-05-14T20:37:22.948846Z +4633 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +5949 + +AuxArmasController.java +file + + + + +2022-07-28T03:39:52.582586Z +628ed07589fcf70557d0f3d91a9755c6 +2021-05-14T20:37:22.948846Z +4633 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +12852 + +ModificarPlanificacionInspeccionController.java +file + + + + +2022-07-28T03:39:52.583586Z +6250e54f4780328dfea352e8bea04db1 +2015-03-09T12:24:00.615353Z +3918 +cpiedra + + + + + + + + + + + + + + + + + + + + + +19623 + +RecepcionArmasController.java +file + + + + +2022-07-28T03:39:52.583586Z +ad1e8b65eddffe0d9689c006fc574650 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +81956 + +CertificadoArmasController.java +file + + + + +2022-07-28T03:39:52.583586Z +8b6f0b03b89bad6fd5a3821e1fbe5369 +2015-07-21T07:23:40.321166Z +4223 +fpazmino + + + + + + + + + + + + + + + + + + + + + +3707 + +AprobacionPlanInspeccionController.java +file + + + + +2022-07-28T03:39:52.584586Z +41b64d17e3e109f8f4197ab864bf7681 +2016-01-14T15:03:56.159217Z +4379 +cflores + + + + + + + + + + + + + + + + + + + + + +24051 + +ColaImpresionController.java +file + + + + +2022-07-28T03:39:52.584586Z +7abda1db59b69797da72811b53a45539 +2020-01-15T23:50:20.451652Z +4625 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +4845 + +InspeccionArchivoController.java +file + + + + +2022-07-28T03:39:52.584586Z +55dc1c8c03018e545ea5fdde2342116a +2014-11-05T09:48:41.903467Z +2353 +cguzman + + + + + + + + + + + + + + + + + + + + + +5066 + +ArmaEntidadReporte.java +file + + + + +2022-07-28T03:39:52.584586Z +22e7b098d8ce1f05c0060c46428e7c7a +2014-09-09T11:17:58.435724Z +615 +ogarcia + + + + + + + + + + + + + + + + + + + + + +1313 + +TransaccionArmaBodegaController.java +file + + + + +2022-07-28T03:39:52.585586Z +657c603f59773322f1aebcfc03d7039c +2015-03-25T04:25:30.232796Z +3963 +cpiedra + + + + + + + + + + + + + + + + + + + + + +5034 + +EmitirDocumentoHabilitante.java +file + + + + +2022-07-28T03:39:52.585586Z +f2bc01acadea0a494947b874584d01c7 +2015-12-29T18:34:31.727682Z +4362 +cvasquez + + + + + + + + + + + + + + + + + + + + + +33535 + +RegistroInspeccionController.java +file + + + + +2022-07-28T03:39:52.585586Z +6466ebdb64bba4cb5d40f2b12c67b223 +2016-01-27T21:58:21.965036Z +4413 +fpazmino + + + + + + + + + + + + + + + + + + + + + +38616 + +OrdenTrabajoController.java +file + + + + +2022-07-28T03:39:52.585586Z +858ac55964e2e0ef2cf5c189a86e4a28 +2014-10-25T06:02:14.991516Z +1939 +ogarcia + + + + + + + + + + + + + + + + + + + + + +11460 + +ImportacionProduccionController.java +file + + + + +2022-07-28T03:39:52.586586Z +47e24f94eeb7983e4b5ab02e9c4fa376 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +86465 + +VerificacionReimpresion.java +file + + + + +2022-07-28T03:39:52.586586Z +c2cdd14864e230b733b1aa47d23a9a4c +2015-09-30T04:00:04.739636Z +4289 +fpazmino + + + + + + + + + + + + + + + + + + + + + +20972 + +ReporteDestruccionDeArmasController.java +file + + + + +2022-07-28T03:39:52.586586Z +0e0b43aa425308d8f25f4ef5fe5db068 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +33906 + +ReporteControlInventarioController.java +file + + + + +2022-07-28T03:39:52.587586Z +e28e3359f0dcba4cbdae31317c9ef289 +2015-05-07T05:06:31.163329Z +4076 +fpazmino + + + + + + + + + + + + + + + + + + + + + +13893 + +ReporteIngresoVentaArmExpUserController.java +file + + + + +2022-07-28T03:39:52.587586Z +b044898ac35100ff1839184815043cea +2021-05-14T20:37:22.948846Z +4633 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +17714 + +SolicitudCambioDepositoController.java +file + + + + +2022-07-28T03:39:52.587586Z +27cb8591d57297bc37761b7cb19c82a5 +2021-12-29T13:49:22.967449Z +4659 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +7039 + +ReporteIngresoVentaArmExpController.java +file + + + + +2022-07-28T03:39:52.588586Z +8c7bf57084202fd2557adb9ca1fcae39 +2015-04-08T12:45:11.093711Z +4022 +dlopez + + + + + + + + + + + + + + + + + + + + + +17216 + +CertificadosArmasController.java +file + + + + +2022-07-28T03:39:52.588586Z +6d9882138d02461bc9b3832bf74feea3 +2015-09-18T03:29:01.430566Z +4280 +fpazmino + + + + + + + + + + + + + + + + + + + + + +23925 + +ReporteInspeccionesRealizadasController.java +file + + + + +2022-07-28T03:39:52.588586Z +535c3114949b5457175fffc54d0eb5e5 +2015-07-02T06:30:40.740078Z +4165 +cpiedra + + + + + + + + + + + + + + + + + + + + + +17205 + +PermisosAutorizacionesAnularController.java +file + + + + +2022-07-28T03:39:52.588586Z +7aca484d860dcb03267a8c50f60b029e +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +11400 + +PlanificacionTramiteController.java +file + + + + +2022-07-28T03:39:52.589586Z +118ac421045011b5f26637824b382a7c +2016-02-15T19:57:14.669988Z +4444 +cvasquez + + + + + + + + + + + + + + + + + + + + + +12748 + +MantenimientoDocumentosAlfrescoController.java +file + + + + +2022-07-28T03:39:52.589586Z +57c98697dae89a539a617a9fdfbe9c44 +2016-03-01T21:59:52.999404Z +4482 +mcepeda + + + + + + + + + + + + + + + + + + + + + +9402 + +AgenciaArmaController.java +file + + + + +2022-07-28T03:39:52.589586Z +3cbeb9933fe8d0072c82456dc1465b77 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +3128 + +DecomisoArmaTransaccionController.java +file + + + + +2022-07-28T03:39:52.590586Z +6b9d32fe4ca0f23b0d69a40ceda277d1 +2016-09-21T19:29:01.490332Z +4566 +jespinosa + + + + + + + + + + + + + + + + + + + + + +11782 + +SolicitudAgenciaSucursalController.java +file + + + + +2022-07-28T03:39:52.590586Z +b9f67f7af10d3987b186647e0f594938 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +6708 + +TramiteArmasController.java +file + + + + +2022-07-28T03:39:52.590586Z +3d1d5de44b6d09cfff7b64ec4e594c78 +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +115904 + +InspeccionController.java +file + + + + +2022-07-28T03:39:52.591586Z +f9e3259d28106002c91a4cf5280e0b7d +2016-01-20T17:08:28.980461Z +4390 +mcepeda + + + + + + + + + + + + + + + + + + + + + +4540 + +ArmasBloqueoController.java +file + + + + +2022-07-28T03:39:52.591586Z +50d4baad5d2026551426f7d6c49234d4 +2021-12-15T03:30:14.444318Z +4658 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +32019 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/prop-base/AgenciaArmaController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/prop-base/AgenciaArmaController.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/prop-base/AgenciaArmaController.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/prop-base/AgenciaSucursalController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/prop-base/AgenciaSucursalController.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/prop-base/AgenciaSucursalController.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/prop-base/DocumentoHabilitanteController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/prop-base/DocumentoHabilitanteController.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/prop-base/DocumentoHabilitanteController.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/prop-base/ReporteConsultaSolicitudController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/prop-base/ReporteConsultaSolicitudController.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/prop-base/ReporteConsultaSolicitudController.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/prop-base/SolicitudAgenciaSucursalController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/prop-base/SolicitudAgenciaSucursalController.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/prop-base/SolicitudAgenciaSucursalController.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/prop-base/SolicitudController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/prop-base/SolicitudController.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/prop-base/SolicitudController.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/prop-base/SolicitudGuardiasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/prop-base/SolicitudGuardiasController.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/prop-base/SolicitudGuardiasController.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/AgenciaArmaController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/AgenciaArmaController.java.svn-base new file mode 100644 index 0000000..7d77b26 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/AgenciaArmaController.java.svn-base @@ -0,0 +1,107 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmAgenciaArma; +import com.fp.persistence.parmas.soli.TarmSolicitud; + +@ManagedBean +@ViewScoped +public class AgenciaArmaController extends AbstractController { + + private static final long serialVersionUID = -8596957712603749520L; + + public AgenciaArmaController() throws Exception{ + super(TarmAgenciaArma.class); + } + + @PostConstruct + private void postconstruct(){ + this.init(); + } + + private void init(){ + this.beanalias = "AGENCIAARMAS"; + this.recperpage = 10; + this.lrecord = new ArrayList<>(); + } + + /** + * Busca las Agencias asociadas a las armas según los criterios indicados + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(Boolean.TRUE); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response response = callerhelper.executeQuery(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + this.lrecord = (List) response.get(beanalias); + this.postQuery(lrecord); + } else{ + this.lrecord = new ArrayList<>(); + MessageHelper.setMessageError(response); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dto = this.getDtoSave(); + dto.setReturnpk(Boolean.TRUE); + HashMap msaves = new HashMap(); + + msaves.put(this.beanalias, dto); + Request request = callerhelper.getRequest(); + request.setSaveTables(msaves); + + Response response = callerhelper.executeSave(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + this.postCommit(response); + MessageHelper.setMessageInfo(response); + } else{ + MessageHelper.setMessageError(response); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static TarmAgenciaArma findByCArma(String cArma, String cAgencia) { + try { + AgenciaArmaController cc = new AgenciaArmaController(); + cc.init(); + cc.recperpage = 10000; + cc.addFilter("pk.carma", cArma); + cc.addFilter("pk.cagencia", cAgencia); + cc.querydatabase(); + if (cc.lrecord.size()>0) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/AgenciaSucursalController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/AgenciaSucursalController.java.svn-base new file mode 100644 index 0000000..f6f88e6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/AgenciaSucursalController.java.svn-base @@ -0,0 +1,259 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.event.AjaxBehaviorEvent; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmAgenciaSucursal; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Controlador que maneja la entidad de {@link TarmAgenciaSucursal} + * @author dcruz + * + */ +@ManagedBean +@ViewScoped +public class AgenciaSucursalController extends + AbstractController { + + private List estadoAgencias; + private List tipoAgencias; + private List lprovincias; + private List lcantones; + private List lparroquias; + private List lcities; + + private static final long serialVersionUID = 4621335239110508027L; + + public AgenciaSucursalController() throws Exception{ + super(TarmAgenciaSucursal.class); + } + + @PostConstruct + public void postConstruct() { + this.init(); + super.startQuery(); + } + + private void init(){ + this.beanalias = "AGENCIASUCURSAL"; + this.lrecord = new ArrayList<>(); + this.recperpage = 15; + this.estadoAgencias = CatalogDetailController.find("ESTADOAGENCIA"); + this.tipoAgencias = CatalogDetailController.find("TIPOAGENCIA"); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto);//se puede aniadir mas tablas + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response response = callerhelper.executeQuery(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0){ + this.lrecord = new ArrayList<>(); + MessageHelper.setMessageError(response); + } else{ + this.lrecord = (List) response.get(beanalias); + this.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + @Override + public void save() { + try { + DtoSave dto = super.getDtoSave(); + if(!dto.pendingProcess()){ + return; + } + dto.setReturnpk(Boolean.TRUE); + HashMap msaves = new HashMap(); + msaves.put(beanalias, dto); + Request request = callerhelper.getRequest(); + request.setSaveTables(msaves); + Response response = callerhelper.executeSave(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + this.postCommit(response); + MessageHelper.setMessageInfo(response); + } else{ + MessageHelper.setMessageError(response); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + SubQuery subQueryTipo = new SubQuery("TgeneCatalogDetail", "description", "ntipo", "i.pk.catalog=t.tipo and i.pk.catalogcode=t.tipocodigo"); + dto.addSubQuery(subQueryTipo); + SubQuery subQueryEstado = new SubQuery("TgeneCatalogDetail", "description", "nestado", "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subQueryEstado); + SubQuery subQueryProvincia = new SubQuery("TgeneProvince", "description", "nprovincia", "i.pk.provincecode=t.provincecode and i.pk.countrycode=t.countrycode"); + dto.addSubQuery(subQueryProvincia); + SubQuery subQueryCanton = new SubQuery("TgeneCanton", "description", "ncanton", "i.pk.countrycode=t.countrycode and i.pk.provincecode=t.provincecode and i.pk.cantoncode=t.cantoncode"); + dto.addSubQuery(subQueryCanton); + SubQuery subQueryParroquia = new SubQuery("TgeneParroquia", "description", "nparroquia", "i.pk.countrycode=t.countrycode and i.pk.provincecode=t.provincecode and i.pk.cantoncode=t.cantoncode and i.pk.parroquiacode=t.parroquiacode"); + dto.addSubQuery(subQueryParroquia); + SubQuery subQueryCiudad = new SubQuery("TgeneCity", "description", "nciudad", "i.pk.countrycode=t.countrycode and i.pk.provincecode=t.provincecode and i.pk.cantoncode=t.cantoncode and i.pk.citycode=t.citycode"); + dto.addSubQuery(subQueryCiudad); + return dto; + } + + public void loadEdit() { + lprovincias = ProvinceController.find(record.getCountrycode()); + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + lcities = CityController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + } + + @Override + public void create() throws Exception { + super.create(); + this.record.setCountrycode("EC"); + this.record.setTipocodigo("TIPOAGENCIA"); + this.record.setEstadocodigo("ESTADOAGENCIA"); + this.record.setFautorizacion(new Date()); + if(this.record.isnew){ + this.record.setEstado("REG"); + } + this.lprovincias = ProvinceController.find(record.getCountrycode()); + this.executeProvince(); + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + lcities = CityController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + } + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if(Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")){ + valorColocar = Boolean.TRUE; + } + for (TarmAgenciaSucursal agenciaSucursal : lrecord) { + agenciaSucursal.getModifiedData().put("seleccionado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static TarmAgenciaSucursal find(String cagencia) { + TarmAgenciaSucursal agenciaSucursal = null; + try { + AgenciaSucursalController cc = new AgenciaSucursalController(); + cc.addFilter("pk", cagencia); + cc.init(); + cc.recperpage = 300; + cc.query(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + agenciaSucursal = cc.lrecord.get(0); + } + return agenciaSucursal; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return agenciaSucursal; + } + } + + public List getEstadoAgencias() { + return estadoAgencias; + } + + public void setEstadoAgencias(List estadoAgencias) { + this.estadoAgencias = estadoAgencias; + } + + public List getTipoAgencias() { + return tipoAgencias; + } + + public void setTipoAgencias(List tipoAgencias) { + this.tipoAgencias = tipoAgencias; + } + + public List getLprovincias() { + return lprovincias; + } + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public List getLparroquias() { + return lparroquias; + } + + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + public List getLcities() { + return lcities; + } + + public void setLcities(List lcities) { + this.lcities = lcities; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/AprobacionPlanInspeccionController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/AprobacionPlanInspeccionController.java.svn-base new file mode 100644 index 0000000..2ae00c3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/AprobacionPlanInspeccionController.java.svn-base @@ -0,0 +1,671 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.ins.TarmPlanificacionInspeccion; +import com.fp.persistence.parmas.ins.TarmPlanificacionTramite; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmInspeccion; +import com.fp.persistence.parmas.soli.TarmInspeccionArchivo; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class AprobacionPlanInspeccionController extends AbstractController { + + //Codigo de planificacion(Variable de flujo) + private Long cplanificacion; + + private TarmCentroControl centroControl; + String jefeCentroControl; + private String nombreCentroControl; + private Boolean reporteGenerado=false; + private String opcion=""; + private String observaciones=""; + private Boolean reporteHabilitado=false; + private String gradoFuncionario=""; + private TcustPersonDetail usuario; + private String xpathflujo=""; + + private List listainsepcion; + + private Boolean btnFlujo=false; + + @ManagedProperty(value = "#{planificacionTramiteController}") + private PlanificacionTramiteController planificacionTramiteController; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value="#{alfrescoController}") + private AlfrescoController alfrescoController; + + public AprobacionPlanInspeccionController() throws Exception { + super(TarmPlanificacionInspeccion.class); + } + + @PostConstruct + private void postconstruct() { + try { + this.startQuery(); + this.init(); + //super.query(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void startQuery(){ + try { + this.pasteBpmScreenParameters(); + if(super.getMfilters().get("cplanificacion")!=null){ + cplanificacion=Long.parseLong(super.getMfilters().get("cplanificacion").toString()); + } + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + private void init() { + try { + recperpage = 15; + lrecord = new ArrayList<>(); + record=new TarmPlanificacionInspeccion(); + beanalias = "APROBACIONPLANINSPECCIONCONTROLLER"; + this.planificacionTramiteController=new PlanificacionTramiteController(); + this.planificacionTramiteController.setLrecord(new ArrayList()); + btnFlujo=false; + + //Cargando la planificacion por el codigo + this.record=PlanificacionInspeccionController.findPorCodigo(this.cplanificacion); + + // this.listainsepcion=PlanificacionTramiteController.findPorCodigoPlanificacion(this.cplanificacion); + + + if(this.record!=null && this.record.getPk()!=null){ + //Cargando las inspecciones + this.planificacionTramiteController.setCplanificacion(this.record.getPk()); + this.planificacionTramiteController.setRecperpage(4000); + //PlanificacionInspeccionController inspeccion = new PlanificacionInspeccionController(); + //inspeccion.getPresupuesto1(); + this.record.getPresupuesto().toString(); + this.planificacionTramiteController.querydatabaseAprobacion(); + + Collections.sort(planificacionTramiteController.getLrecord(), new Comparator() { + public int compare(TarmPlanificacionTramite p1, TarmPlanificacionTramite p2) { + return new Long(p1.getMesnumero()).compareTo(p2.getMesnumero()); + } + }); + + //Cargando el centro de control + this.centroControl=CentroControlArmasController.findPorCodigo(this.record.getCcentrocontrol()); + this.nombreCentroControl=centroControl.getModifiedData().get("desnombreinstitucion")+""; + + //Obteniendo el jefe del centro de control + this.jefeCentroControl=centroControl.getModifiedData().get("nombre")+"";//PersonDetailController.find(this.centroControl.getPersoncode().toString()); + + //Obteniendo el grado del jefe del centro de control + gradoFuncionario=centroControl.getModifiedData().get("desgrado")+""+" - "; + + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + this.usuario=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + private void initConsulta() { + try { + recperpage = 15; + lrecord = new ArrayList<>(); + record=new TarmPlanificacionInspeccion(); + beanalias = "APROBACIONPLANINSPECCIONCONTROLLER"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + public void query() throws Exception { + MessageHelper.setMessageError("msg_notQuery"); + super.query(); + } + + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); +// if(!lrecord.isEmpty() ){ +// record=lrecord.get(0); +// } + super.postQuery(lrecord); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + request.modifiedData().put("cplanificacion", this.record.getPk()); + bpmDataStatus="A"; + if(this.opcion.equalsIgnoreCase("rechazar")){ + bpmDataStatus="D"; + } + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.planificacionTramiteController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + this.reporteHabilitado=true; + btnFlujo=true; + } else { + MessageHelper.setMessageError(resp); + //this.planificacionSalvada=false; + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que persiste la planificacion con el xpath + * del pdf del reporte en el alfresco + */ + public void saveXpathReporte() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Metodo que aprueba el plan + * @throws Exception + */ + public void aprobar() throws Exception{ + try { + if(this.opcion.equalsIgnoreCase("Aprobar")){ + this.record.setAprobada("Y"); + update(); + save(); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Ejecuta un reporte de custodios + * @param name Nombre del reporte a generar. + */ + public InputStream generateReport() { + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + String path = "armas/reports/planInspeccion"; + String filename=MsgControlArmas.getProperty("lbl_planInspeccionAnual"); + + //Cargando la planificacion + this.record=PlanificacionInspeccionController.findPorCodigo(cplanificacion); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //cplanificacion + parameters.put("cplanificacion", this.record.getPk()); + + //Fecha actual + parameters.put("fechaActual", new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + + //Codigo + parameters.put("codigo", this.record.getCodigo()); + + //Anno + parameters.put("anno", this.record.getAnno().toString()); + + //Codigo + parameters.put("codigo", this.record.getCodigo()); + + //Nombre del centro de control + parameters.put("nombreCentro", this.nombreCentroControl); + + //Fecha actual + parameters.put("fechaActual", Calendar.getInstance().getTime()); + + //cplanificacion + parameters.put("cplanificacion", this.record.getPk()); + + //Fecha actual + parameters.put("fechaActual", new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + + //Fecha generacion + parameters.put("fechaGeneracion", sdf.format(this.record.getFechageneracion())); + + //Anno + parameters.put("anno", this.record.getAnno().toString()); + + //Codigo + parameters.put("codigo", this.record.getCodigo()); + + //Fecha Inicio + parameters.put("fechaInicio", sdf.format(this.record.getFechainicio())); + + //Fecha Fin + parameters.put("fechaFin", sdf.format(this.record.getFechafin())); + + + //Funcionario + parameters.put("gradoNombreFuncionario",gradoFuncionario+this.jefeCentroControl); + parameters.put("personcode",this.centroControl.getPersoncode()); + parameters.put("centroControl","JEFE DEL "+this.nombreCentroControl); + + //presupuesto anual + + TgeneCatalogDetail obj = CatalogDetailController.findCatalogo("TIPOPLANIFICACION", this.record.getIdPlanificacion()); + parameters.put("ctiplanificacion", obj.getDescription()) ; + + // presupuesto anual + parameters.put("cpresupuestoanual",this.record.getPresupuesto()); + + + //Usuario + parameters.put("usuario",this.usuario.getName()); + sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + String fechaHora=sdf.format(Calendar.getInstance().getTime()); + parameters.put("fechaHora",fechaHora); + + String format = "pdf"; + + InputStream pdf=null; + try { + //this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + pdf = this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + + //Generando el xpath + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta=new StringBuilder("cm:Planificacion"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + ruta = ruta.append("/cm:"+"reportePlanInspeccion"); + xpathflujo=ruta.toString(); + this.record.setXpath(xpathflujo+"/cm:"+this.record.getCodigo()+".pdf"); + + //Subiendo el pdf al alfresco + alfrescoController.uploadFile(pdf, this.record.getCodigo()+".pdf", xpathflujo) ; + + update(); + saveXpathReporte(); + + this.reporteGenerado=true; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + return pdf; + } + + public void probarReporte() { + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + String path = "armas/reports/planInspeccion"; + String filename=MsgControlArmas.getProperty("lbl_planInspeccionAnual"); + + //Cargando la planificacion + this.record=PlanificacionInspeccionController.findPorCodigo(28L); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //cplanificacion + parameters.put("cplanificacion", this.record.getPk()); + + //Fecha actual + parameters.put("fechaActual", new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + + //Fecha generacion + parameters.put("fechaGeneracion", sdf.format(this.record.getFechageneracion())); + + //Anno + parameters.put("anno", this.record.getAnno().toString()); + + //Codigo + parameters.put("codigo", this.record.getCodigo()); + + //Fecha Innicio + parameters.put("fechaInicio", sdf.format(this.record.getFechainicio())); + + //Fecha Innicio + parameters.put("fechaFin", sdf.format(this.record.getFechafin())); + + //Nombre del centro de control + parameters.put("nombreCentro", this.nombreCentroControl); + + //Fecha actual + parameters.put("fechaActual", Calendar.getInstance().getTime()); + + //Funcionario + parameters.put("gradoNombreFuncionario",gradoFuncionario+this.jefeCentroControl); + parameters.put("personcode",this.centroControl.getPersoncode()); + parameters.put("centroControl","JEFE DEL "+this.nombreCentroControl); + + //Usuario + parameters.put("usuario",this.usuario.getName()); + sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + String fechaHora=sdf.format(Calendar.getInstance().getTime()); + parameters.put("fechaHora",fechaHora); + + String format = "pdf"; + + try { + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + this.reporteGenerado=true; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public void habilitarFirma(){ + + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + if(!btnFlujo){ + MessageHelper.setMessageInfo("GUARDE LOS CAMBIOS"); + } + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("cplanificacion", this.cplanificacion); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + btnFlujo=false; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTareaReporte() { + + try { + if(!reporteGenerado){ + MessageHelper.setMessageError("GENERE EL REPORTE"); + return; + } + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("cplanificacion", this.cplanificacion); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + reporteGenerado=false; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * + * @param codigoSolicitud + * @return + */ + public static List findPorAnno(String centro, String year) { + try { + AprobacionPlanInspeccionController cc = new AprobacionPlanInspeccionController(); + cc.initConsulta(); + cc.recperpage = 300; + if(year != null){ + cc.addFilter("anno", year); + } + cc.addFilter("ccentrocontrol", centro); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; +// if (cc.record != null) { +// return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + public PlanificacionTramiteController getPlanificacionTramiteController() { + return planificacionTramiteController; + } + + public void setPlanificacionTramiteController( + PlanificacionTramiteController planificacionTramiteController) { + this.planificacionTramiteController = planificacionTramiteController; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getNombreCentroControl() { + return nombreCentroControl; + } + + public void setNombreCentroControl(String nombreCentroControl) { + this.nombreCentroControl = nombreCentroControl; + } + + public Long getCplanificacion() { + return cplanificacion; + } + + public void setCplanificacion(Long cplanificacion) { + this.cplanificacion = cplanificacion; + } + + public Boolean getReporteGenerado() { + return reporteGenerado; + } + + public void setReporteGenerado(Boolean reporteGenerado) { + this.reporteGenerado = reporteGenerado; + } + + public String getOpcion() { + return opcion; + } + + public void setOpcion(String opcion) { + this.opcion = opcion; + } + + public String getObservaciones() { + return observaciones; + } + + public void setObservaciones(String observaciones) { + this.observaciones = observaciones; + } + + public Boolean getReporteHabilitado() { + return reporteHabilitado; + } + + public void setReporteHabilitado(Boolean reporteHabilitado) { + this.reporteHabilitado = reporteHabilitado; + } + + public String getGradoFuncionario() { + return gradoFuncionario; + } + + public void setGradoFuncionario(String gradoFuncionario) { + this.gradoFuncionario = gradoFuncionario; + } + + public TcustPersonDetail getUsuario() { + return usuario; + } + + public void setUsuario(TcustPersonDetail usuario) { + this.usuario = usuario; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + + + public List getListaInsepcion() { + return listainsepcion; + } + + public void setListaInsepcion(List listainsepcion) { + this.listainsepcion = listainsepcion; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ArmaEntidadReporte.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ArmaEntidadReporte.java.svn-base new file mode 100644 index 0000000..90b3b61 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ArmaEntidadReporte.java.svn-base @@ -0,0 +1,82 @@ +package com.fp.frontend.controller.armas.solicitud; + +public class ArmaEntidadReporte { + + private Long numero; + private String clase; + private String tipo; + private String marca; + private String modelo; + private String calibre; + private String serie; + private String estado; + + public ArmaEntidadReporte() { + } + + public Long getNumero() { + return numero; + } + + public void setNumero(Long numero) { + this.numero = numero; + } + + public String getClase() { + return clase; + } + + public void setClase(String clase) { + this.clase = clase; + } + + public String getTipo() { + return tipo; + } + + public void setTipo(String tipo) { + this.tipo = tipo; + } + + public String getMarca() { + return marca; + } + + public void setMarca(String marca) { + this.marca = marca; + } + + public String getModelo() { + return modelo; + } + + public void setModelo(String modelo) { + this.modelo = modelo; + } + + public String getSerie() { + return serie; + } + + public void setSerie(String serie) { + this.serie = serie; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public String getCalibre() { + return calibre; + } + + public void setCalibre(String calibre) { + this.calibre = calibre; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ArmasBloqueoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ArmasBloqueoController.java.svn-base new file mode 100644 index 0000000..0a177e3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ArmasBloqueoController.java.svn-base @@ -0,0 +1,927 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.event.AjaxBehaviorEvent; + +import org.apache.commons.lang3.StringUtils; +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.CalibreLovController; +import com.fp.frontend.controller.armas.parametros.ClaseLovController; +import com.fp.frontend.controller.armas.parametros.LongitudLovController; +import com.fp.frontend.controller.armas.parametros.TipoArmaExpLovController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.ValidateIdentification; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +/** + * Controlador principal de armas + * @author dcruz + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ArmasBloqueoController extends AbstractController { + + @ManagedProperty(value = "#{tiposArmasExplosivosController}") + private TiposArmasExplosivosController tiposArmasExplosivosController; + + /** + * Lista de tipos de identificación + */ + private List ltipoidentificacion; + /** + * Listado de estados del arma + */ + private List lestadoarma; + + /** + * Tipo documento + */ + private String tipoDoc; + + /** + * Número documento + */ + private String numDoc; + + /** + * Nombre/razón social + */ + private String nombreRazon; + + /** + * Longitud arma + */ + private String longitud; + /** + * Calibre arma + */ + private String calibre; + /** + * Clase arma + */ + private String clase; + /** + * Tipo de arma + */ + private String tipoarma; + /** + * unidad medida peso + */ + private String unidadmedidapeso; + + /** + * Bloquea la unidad de cantidad + */ + private boolean bloquearUnidadCantidad = Boolean.TRUE; + + /** + * Bloquea la unidad de peso + */ + private boolean bloquearUnidadPeso = Boolean.TRUE; + /** + * Contiene la fecha actual del sistema + */ + private Date fechaActual; + /** + * codigo del ruc + */ + private String codigoRuc; + /** + * codigo del ruc + */ + private String codigoCedula; + + private String razonSocial; + + private String numeroDocumento; + + private String filtroPersona; + + public ArmasBloqueoController() throws Exception { + super(TarmArmas.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + fechaActual = new Date(); + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "ARMAS"; + ltipoidentificacion = CatalogDetailController.find("IDENTIFICATION"); + codigoRuc=codigos("CODIGO.RUC"); + codigoCedula=codigos("CODIGO.CEDULA"); + filtroPersona = ""; + //userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + String sqlFiltroPersona = ""; + if(this.getMfilelds().get("personcode") != null){ + sqlFiltroPersona = " t.cregistro in (SELECT c.pk FROM TarmRegistroArmas c WHERE c.personcode="+this.getMfilelds().get("personcode")+")"; + } + + dto.setOrderby("pk"); + + //estados del armas + + String sqlActual = ""; + if(this.getMfilelds().get("personcode")==null){ + sqlActual = " t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma) " + + " and t.estado !='DEST' and t.estado!='VEND' and t.estado!='MING' and t.estado!='DUPL' and t.estado!='CUSTEM'" + + " and (t.peso>0 or t.cantidad>0)";//distintas de destruidas y cambio de propietario and t.cregistro=ta.cregistro para el manejo de los explosivos + }else{ + sqlActual = " t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) " + + " and t.estado !='DEST' and t.estado!='VEND' and t.estado!='MING' and t.estado!='DUPL' and t.estado!='CUSTEM'" + + " and (t.peso>0 or t.cantidad>0)";//distintas de destruidas y cambio de propietario and t.cregistro=ta.cregistro para el manejo de los explosivos + } + + sqlActual=sqlActual+ filtroPersona; + + String sqlFinal = obtenerFiltroBusquedaGeneral(sqlFiltroPersona,sqlActual); + Filter filtroFinal = new Filter(); + sqlFinal= sqlFinal+ " and t.estadoventa is null "; + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private String obtenerFiltroBusquedaGeneral(String... sqlFiltros ){ + StringBuffer sqlFinal = new StringBuffer(); + for (int i = 0; i < sqlFiltros.length ; i++) { + if(sqlFinal.length() > 0 && !StringUtils.endsWith(StringUtils.trim(sqlFinal.toString()), "AND")){ + sqlFinal.append( " AND "); + } + sqlFinal.append(sqlFiltros[i]); + } + return sqlFinal.toString(); + } + + + @Override + public void next() throws Exception { + // TODO Auto-generated method stub + super.next(); + } + + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception{ + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryTipoFab= new SubQuery("TgeneCatalogDetail","description","tipofabricacion","i.pk.catalog=t.tipofabricacion and i.pk.catalogcode='TIPOFABRICACION'"); + dto.addSubQuery(subqueryTipoFab); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TarmTipoArmaExplosivo","clase","cclase","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo= new SubQuery("TarmTipoArmaExplosivo","clasecodigo","cclasecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud= new SubQuery("TarmTipoArmaExplosivo","longitud","clongitud","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo= new SubQuery("TarmTipoArmaExplosivo","longitudcodigo","clongitudcodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ccalibre","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo= new SubQuery("TarmTipoArmaExplosivo","calibrecodigo","ccalibrecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivo","ctipoarmaexplosivo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivocodigo","ctipoarmaexplosivocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapeso","cunidadmedidapeso","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadTipo= new SubQuery("TgeneCatalogDetail","description","unidadmedidadesc","i.pk.catalog= (select o.unidadmedidapeso from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryUnidadTipo); + SubQuery subqueryUnidadCodigo= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapesocodigo","cunidadmedidapesocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida= new SubQuery("TgeneCatalogDetail","description","unidadmedida","i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode= new SubQuery("TarmRegistroArmas","personcode","personcode","i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + SubQuery subqueryTipo= new SubQuery("TgeneCatalogDetail","description","tipo","i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipo); + SubQuery subqueryTipoArmaExplosivo= new SubQuery("TgeneCatalogDetail","description","tipoarmaexplosivo","i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + SubQuery subqueryClasecatalogo= new SubQuery("TgeneCatalogDetail","description","clase","i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClasecatalogo); + + return dto; + } + + + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(Boolean.TRUE); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + msave.put(beanalias, dtosave); + + Request request = callerhelper.getRequest(); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + querydatabase(); + } + + @Override + public void update() throws Exception { + TgeneCatalogDetail estado = CatalogDetailController.findxCodigoCodcatalogo(record.getEstado(), record.getEstadocodigo()); + record.getModifiedData().put("estado", estado.getDescription()); + super.update(); + } + + /* + * Metodo que retorna la extencion del documento que se desea subir al alfresco + */ + public String getExtension(String filename) { + int index = filename.lastIndexOf('.'); + if (index == -1) { + return ""; + } else { + return filename.substring(index + 1); + } + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase(String carpeta) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta = new StringBuilder("cm:Registro"); + ruta = ruta.append("/cm:"+carpeta); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + ruta = ruta.append("/cm:D-").append(calendar.get(Calendar.DAY_OF_WEEK)); + return ruta.toString(); + } + public void updateAutorizacion()throws Exception { + super.update(); + } + + /** + * Método que se ejecuta al carga edición + * @throws Exception + */ + public void loadEdit() throws Exception { + if(record.getCountrycode() == null){ + record.setCountrycode("EC"); + } + if(record.getCtipoarmaexplosivo()==null){ + MessageHelper.setMessageError("NO ESTA ASOCIADO A UN TIPO DE ARMA EXPLOSIVO"); + return; + } + TarmRegistroArmas registroArmas=RegistroArmController.findByCodigo( record.getCregistro().toString()); + TcustPersonDetail tcustPersonDetail = PersonDetailController.find(registroArmas.getPersoncode().toString()); + tipoDoc = tcustPersonDetail.getIdentificationcatalog(); + numDoc = tcustPersonDetail.getIdentification(); + nombreRazon = tcustPersonDetail.getName(); + // + lestadoarma= new ArrayList<>(); + String catalogoabre=record.getEstado()!=null && record.getEstado().equals("BLOQ")?"REG":"BLOQ"; + TgeneCatalogDetail catalogo=CatalogDetailController.findCatalogo("ESTADOARMA",catalogoabre); + lestadoarma.add(catalogo); + } + + + /** + * Recorta el nombre del archivo a cargarse + * @param nombre + * @return nombre recortado + */ + public String recorteNombre(String nombre){ + String fielname=nombre; + if(fielname.length()>30){ + fielname=fielname.substring(0,30)+extencionArchivo(nombre); + } + return fielname; + } + /** + * Obtiene la extencion del archivo a cargar + * @param nombre + * @return + */ + private String extencionArchivo(String nombre){ + int pos=nombre.lastIndexOf('.'); + nombre=nombre.substring(pos); + return nombre; + } + + @Override + public void create() throws Exception { + super.create(); + this.tipoDoc = null; + this.numDoc = null; + this.nombreRazon = null; + this.record.setCountrycode("EC"); +// this.record.setEstado("REG"); + this.record.setEstado("PREG"); + this.record.setEstadocodigo("ESTADOARMA"); + this.record.setMarcacodigo("MARCA"); + this.record.setGeneracertificado("NO"); + } + + public void update(TarmArmas bean) throws Exception { + record=bean; + updateAutorizacion(); + } + + public void validacionDocumento(String numeroDocumento, String tipoDocumento){ + if(numeroDocumento==null || tipoDocumento==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselacedula")); + return; + } + TcustPersonDetail tcustPersonDetail=null; + if(tipoDocumento.equals(codigoCedula)){ +//----------validamos si es valida la CEDULA + if(!ValidateIdentification.cedula(numeroDocumento)){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en MAIA + tcustPersonDetail=buscarPersonaMaia(numeroDocumento,tipoDocumento); + }else if(tipoDocumento.equals(codigoRuc)){ +//----------validamos si es valida el RUC + if(!ValidateIdentification.ruc(numeroDocumento)){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en maia + tcustPersonDetail=buscarPersonaMaia(numeroDocumento,tipoDocumento); + }else{ +//----------si es PASAPORTE + tcustPersonDetail=buscarPersonaMaia(numeroDocumento,tipoDocumento); + } + if(tcustPersonDetail==null){ + nombreRazon=null; + numDoc=null; + MessageHelper.setMessageError("La datos de la persona ingresada no existen, por favor crear primero la persona"); + return; + }else{ + nombreRazon=tcustPersonDetail.getName(); + } + } + + /** Método para validar si la persona existe en la BD de Maia + * @param numeroDocumento + * @param tipoDocumento + * @return TcustPersonDetail + */ + public TcustPersonDetail buscarPersonaMaia(String numeroDocumento, String tipoDocumento){ + return PersonDetailController.findxidentification(numeroDocumento,tipoDocumento); + } + + + /** + * Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findXCodigo(String armaCode) { + try { + + ArmasBloqueoController cc = new ArmasBloqueoController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + //cc.addFilter("REG", "ESTADOARMA"); + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + /** + * + * + * @param personCode + * @param estados estados del arma separados por coma + * @param tipoFab tipos de fabricacion del arma separados por coma + * @return Una lista de Armas encontradas + */ + public List findxPersona(Long personCode, String estados, String tipoFab, String clase, String fechaCaducidad) { + List armasLista = null; + try { + armasLista = new ArrayList(); + ArmasBloqueoController armas = new ArmasBloqueoController(); + armas.init(); + armas.recperpage = 4000; + armas.addField("personcode", personCode); + if(this.getMfilelds().get("sancion") != null){ + armas.addField("sancion", this.getMfilelds().get("sancion")); + } + if(this.getMfilelds().get("TRAMITE") != null){ + armas.addField("TRAMITE", this.getMfilelds().get("TRAMITE")); + } + if(estados == null){ + armas.addFilter("estado", "REG"); + } else{ + armas.addField("ESTADOS", estados); + } + if(tipoFab != null && tipoFab .trim().length()>0){ + armas.addField("TIPOFABRICACION", tipoFab); + } + if(clase != null && clase .trim().length()>0){ + armas.addField("CLASEARMAS", clase); + } +// if(fechaCaducidad != null && fechaCaducidad .trim().length()>0){ +// armas.addField("FECHACADUCIDADARM", fechaCaducidad); +// } + armas.query(); + if(armas.getLrecord() != null && !armas.getLrecord().isEmpty()){ + armasLista.addAll(armas.getLrecord()); + } + + return armasLista; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return armasLista; + } + } + + + /** + * Lista de Armas por Registro + **/ + public static List findxRegistro(String registrocode) { + try { + ArmasBloqueoController cc = new ArmasBloqueoController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("cregistro", registrocode); + + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + for(TarmArmas item : cc.lrecord){ + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(item.getCtipoarmaexplosivo()); + item.modifiedData().put("clase",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription()); + if(tarmTipoArmaExplosivo.getLongitud()!=null && tarmTipoArmaExplosivo.getLongitudcodigo()!=null){ + item.modifiedData().put("longitud",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getLongitud(), tarmTipoArmaExplosivo.getLongitudcodigo()).getDescription()); + } + item.modifiedData().put("tipo",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription()); + if(tarmTipoArmaExplosivo.getCalibre()!=null && tarmTipoArmaExplosivo.getCalibrecodigo()!=null){ + item.modifiedData().put("calibre",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription()); + } + item.modifiedData().put("unidadMedidaCantidad",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getUnidadmedidapeso(), tarmTipoArmaExplosivo.getUnidadmedidapesocodigo()).getDescription()); + } + + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Abre el LOV de la clase del arma + */ + public void openLovClase() { + Map> params = new HashMap>(); + ClaseLovController.openLov(params); + } + + /** + * Regresa del LOV de armas + * @param event + */ + public void onReturnClase(SelectEvent event) { + TgeneCatalogDetail clase = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("clase", clase.getDescription()); + this.clase = clase.getPk().getCatalog(); + this.verificarClaseArma(); + } + + + /** + * Método en el cual se determina si se bloquea unidad o cantidad al momento de cargar los datos del arma + * @param clase + */ + private void verificarClaseArma(){ + if(this.clase==null){ + this.bloquearUnidadPeso = Boolean.TRUE; + this.bloquearUnidadCantidad = Boolean.TRUE; + return; + } + + if( this.clase.equals("0010000003") || this.clase.equals("0010000005") || this.clase.equals("0010000007") || this.clase.equals("0010000006")){ + this.bloquearUnidadPeso = Boolean.FALSE; + } else{ + this.bloquearUnidadPeso = Boolean.TRUE; + } + if(this.clase.equals("0010000001") || this.clase.equals("0010000002") || this.clase.equals("0010000004")){ + this.bloquearUnidadCantidad = Boolean.FALSE; + } else{ + this.bloquearUnidadCantidad = Boolean.TRUE; + } + } + + /** + * Abre el LOV de la longitud del arma + */ + public void openLovLongitud() { + Map> params = new HashMap>(); + LongitudLovController.openLov(params); + } + + /** + * Regresa del LOV de longitud + * @param event + */ + public void onReturnLongitud(SelectEvent event) { + TgeneCatalogDetail longitud = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("longitud", longitud.getDescription()); + this.longitud = longitud.getPk().getCatalog(); + } + + /** + * Abre el LOV del tipo de arma + */ + public void openLovTipoArma() { + Map> params = new HashMap>(); + TipoArmaExpLovController.openLov(params); + } + + /** + * Regresa del LOV de tipo de arma + * @param event + */ + public void onReturnTipoArma(SelectEvent event) { + TgeneCatalogDetail tipoArma = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("tipoarmaexplosivo", tipoArma.getDescription()); + this.tipoarma = tipoArma.getPk().getCatalog(); + } + + /** + * Abre el LOV de Calibre + */ + public void openLovCalibre() { + Map> params = new HashMap>(); + CalibreLovController.openLov(params); + } + + /** + * Regresa del LOV del calibre + * @param event + */ + public void onReturnCalibre(SelectEvent event) { + TgeneCatalogDetail calibre = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("calibre", calibre.getDescription()); + this.calibre = calibre.getPk().getCatalog(); + } + + /** + * Abre el LOV cambio de usuario + */ + public void openLovCambioUsuario() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if(Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")){ + valorColocar = Boolean.TRUE; + } + for (TarmArmas guardias : lrecord) { + guardias.getModifiedData().put("seleccionado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + + /** + * Metodo para obtener los codigos + */ + private static String codigos(String parametro){ + TgeneParameters tgeneParameters= ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + + public void actualizar(TarmArmas arma) throws Exception{ + record=arma; + super.update(); + } + + public TiposArmasExplosivosController getTiposArmasExplosivosController() { + return tiposArmasExplosivosController; + } + + + public void setTiposArmasExplosivosController( + TiposArmasExplosivosController tiposArmasExplosivosController) { + this.tiposArmasExplosivosController = tiposArmasExplosivosController; + } + + + public List getLtipoidentificacion() { + return ltipoidentificacion; + } + + + public void setLtipoidentificacion(List ltipoidentificacion) { + this.ltipoidentificacion = ltipoidentificacion; + } + + + public String getTipoDoc() { + return tipoDoc; + } + + + public void setTipoDoc(String tipoDoc) { + this.tipoDoc = tipoDoc; + } + + + public String getNumDoc() { + return numDoc; + } + + + public void setNumDoc(String numDoc) { + this.numDoc = numDoc; + } + + + public String getNombreRazon() { + return nombreRazon; + } + + + public void setNombreRazon(String nombreRazon) { + this.nombreRazon = nombreRazon; + } + + + public List getLestadoarma() { + return lestadoarma; + } + + + public void setLestadoarma(List lestadoarma) { + this.lestadoarma = lestadoarma; + } + + + public String getLongitud() { + return longitud; + } + + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + + public String getCalibre() { + return calibre; + } + + + public void setCalibre(String calibre) { + this.calibre = calibre; + } + + + public String getClase() { + return clase; + } + + + public void setClase(String clase) { + this.clase = clase; + } + + + public String getTipoarma() { + return tipoarma; + } + + + public void setTipoarma(String tipoarma) { + this.tipoarma = tipoarma; + } + + + public String getUnidadmedidapeso() { + return unidadmedidapeso; + } + + + public void setUnidadmedidapeso(String unidadmedidapeso) { + this.unidadmedidapeso = unidadmedidapeso; + } + + public boolean isBloquearUnidadCantidad() { + return bloquearUnidadCantidad; + } + + public void setBloquearUnidadCantidad(boolean bloquearUnidadCantidad) { + this.bloquearUnidadCantidad = bloquearUnidadCantidad; + } + + public boolean isBloquearUnidadPeso() { + return bloquearUnidadPeso; + } + + public void setBloquearUnidadPeso(boolean bloquearUnidadPeso) { + this.bloquearUnidadPeso = bloquearUnidadPeso; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public String getRazonSocial() { + return razonSocial; + } + + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public String getFiltroPersona() { + return filtroPersona; + } + + public void setFiltroPersona(String filtroPersona) { + this.filtroPersona = filtroPersona; + } + + + /** + * Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findXCodigoArma(String armaCode) { + try { + ArmasBloqueoController cc = new ArmasBloqueoController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("codigoarma", armaCode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Abre el lov de persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + /** + * Maneja la respuesta del Lov de Personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + + TcustPersonDetail personaDetailSelecionada = (TcustPersonDetail) event.getObject(); + razonSocial = personaDetailSelecionada.getName(); + numeroDocumento = personaDetailSelecionada.getIdentification(); + filtroPersona = " and t.cregistro in (select i.pk from TarmRegistroArmas i where i.personcode =" + + personaDetailSelecionada.getPk().getPersoncode() + ")"; + + querydatabase(); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ArmasController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ArmasController.java.netbeans-base new file mode 100644 index 0000000..67bae88 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ArmasController.java.netbeans-base @@ -0,0 +1,2325 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.apache.commons.lang3.StringUtils; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.SelectEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.common.helper.Constant; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.lov.ArmaExplosivoLovController; +import com.fp.frontend.controller.armas.parametros.CalibreLovController; +import com.fp.frontend.controller.armas.parametros.ClaseLovController; +import com.fp.frontend.controller.armas.parametros.LongitudLovController; +import com.fp.frontend.controller.armas.parametros.TipoArmaExpLovController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.frontend.utility.ValidateIdentification; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Controlador principal de armas + * @author dcruz + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ArmasController extends AbstractController { + + @ManagedProperty(value = "#{tiposArmasExplosivosController}") + private TiposArmasExplosivosController tiposArmasExplosivosController; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmas; + + /** + * Lista de tipos de identificación + */ + private List ltipoidentificacion; + /** + * Listado de estados del arma + */ + private List lestadoarma; + /** + * Listado de marcas + */ + private List lmarca; + /** + * Listado de colores + */ + private List lcolor; + /** + * Listado de tipos de fabricación + */ + private List ltipofabricacion; + /** + * Listado de unidad de medida cantidad + */ + private List lunidadmedidacantidad; + /** + * Listado de unidad medida peso + */ + private List lunidadmedidapeso; + /** + * Listado de paises + */ + private List lcountry; + /** + * Listado de provincias + */ + private List lprovincias; + /** + * Listado de cantones + */ + private List lcantones; + /** + * Listado de parroquias + */ + private List lparroquias; + /** + * Listado de ciudades + */ + private List lcities; + + /** + * Tipo documento + */ + private String tipoDoc; + + /** + * Número documento + */ + private String numDoc; + + /** + * Nombre/razón social + */ + private String nombreRazon; + + /** + * Longitud arma + */ + private String longitud; + /** + * Calibre arma + */ + private String calibre; + /** + * Clase arma + */ + private String clase; + /** + * Tipo de arma + */ + private String tipoarma; + /** + * unidad medida peso + */ + private String unidadmedidapeso; + + /** + * Bandera que indica que en realidad existe luego del ingreso de datos un tipo de arma explosivo válido + */ + private boolean existeTipoArmaExplosivo; + + /** + * Bandera que escifica que se deba verificar que exista un arma explosivo válida + */ + private boolean verificaArmaExplosivo = Boolean.TRUE; + + /** + * Bloquea la unidad de cantidad + */ + private boolean bloquearUnidadCantidad = Boolean.TRUE; + + /** + * Bloquea la unidad de peso + */ + private boolean bloquearUnidadPeso = Boolean.TRUE; + /** + * Contiene la fecha actual del sistema + */ + private Date fechaActual; + /** + * Contiene la referencia a nuevo propietario del arma + */ + private TcustPersonDetail nuevoPropietarioArma; + /** + * Tipo del arma explosivo + */ + private TarmTipoArmaExplosivo tipoArmaExplosivo ; + /** + * codigo del ruc + */ + private String codigoRuc; + /** + * codigo del ruc + */ + private String codigoCedula; + /** + * codigo del ruc + */ + private String codigoPasaporte; + + + private String razonSocial; + + private String numeroDocumento; + + private String filtroPersona; + + private TsafeUserDetail userDetail; + /** + * Variable que nos permite cargar el documento al Alfresco + */ + private UploadedFile uploadedFile; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + public ArmasController() throws Exception { + super(TarmArmas.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + fechaActual = new Date(); + recperpage = 15; // Cambiar al # reg a mirar. +// record = new TarmArmas(); + lrecord = new ArrayList<>(); + beanalias = "ARMAS"; + ltipoidentificacion = CatalogDetailController.find("IDENTIFICATION"); + lestadoarma = CatalogDetailController.find("ESTADOARMA"); + //remover el estado bloqueado + Listlistaremover= new ArrayList<>(); + for (TgeneCatalogDetail item : lestadoarma) { + if(item.getPk().getCatalog().equals("BLOQ")){ + listaremover.add(item); + } + } + lestadoarma.removeAll(listaremover); + + lmarca = CatalogDetailController.find("MARCA"); + lcolor = CatalogDetailController.find("COLOR"); + ltipofabricacion = CatalogDetailController.find("TIPOFABRICACION"); +// lunidadmedidacantidad = CatalogDetailController.find("UCANTIDAD"); + lunidadmedidapeso = CatalogDetailController.find("UNIDADMEDIDA"); + lcountry = CountryController.find(); + codigoRuc=codigos("CODIGO.RUC"); + codigoCedula=codigos("CODIGO.CEDULA"); + codigoPasaporte=codigos("CODIGO.PASAPORTE"); + filtroPersona = ""; + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + String sqlFiltroPersona = ""; + String sqlFiltroSancion = ""; + String sqlFiltroEstados = ""; + String sqlFiltroTipoFabricacion = ""; + String sqlFiltroClaseArmas = ""; +// String sqlFiltroFechaCaducidad = ""; + String sqlFiltroValidacionArma = "";//si entre los estados existe renovacion entonces validamos que no pueda seleccionar las mismas armas + if(this.getMfilelds().get("personcode") != null){ + sqlFiltroPersona = " t.cregistro in (SELECT c.pk FROM TarmRegistroArmas c WHERE c.personcode="+this.getMfilelds().get("personcode")+")"; + } + //agregamos los filtros en base a la consideracion del field sancion, en caso de que lo sea buscamos los sancionados que hayan cumplido el tiempo de sancion + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + if(this.getMfilelds().containsKey("sancion") && this.getMfilelds().get("sancion").toString().equals(Constant.STR_Y)){ + sqlFiltroSancion = " t.pk in (SELECT max(a.pk) FROM TarmArmas a WHERE a.codigoarma in (SELECT distinct(h.codigoarma) from TarmDocumentoHabilitante h WHERE h.pk in (SELECT d.cdocumento FROM TarmSancionDecomiso d WHERE d.personcode="+this.getMfilelds().get("personcode")+" AND d.fechafinal < TO_DATE('"+dateFormat.format(Calendar.getInstance().getTime())+"', 'YYYY-MM-DD'))) GROUP BY a.codigoarma)"; + } + + dto.setOrderby("pk"); + if(this.getMfilelds().get("ESTADOS") != null){ + String[] estados = this.getMfilelds().get("ESTADOS").toString().split(","); + StringBuffer sqlEstados = new StringBuffer(" t.estado IN ("); + for (int i = 0; i < estados.length; i++) { + sqlEstados.append("'").append(estados[i]).append("'"); + if(i < estados.length - 1){ + sqlEstados.append(","); + } + } + sqlEstados.append(")"); + sqlFiltroEstados = sqlEstados.toString(); + } + + if(this.getMfilelds().get("TIPOFABRICACION") != null){ + String[] tipoFabricacion = this.getMfilelds().get("TIPOFABRICACION").toString().split(","); + StringBuffer sqlTipoFabricacion = new StringBuffer(" t.tipofabricacion IN ("); + for (int i = 0; i < tipoFabricacion.length; i++) { + sqlTipoFabricacion.append("'").append(tipoFabricacion[i]).append("'"); + if(i < tipoFabricacion.length - 1){ + sqlTipoFabricacion.append(","); + } + } + sqlTipoFabricacion.append(")"); + sqlFiltroTipoFabricacion = sqlTipoFabricacion.toString(); + } + + if(this.getMfilelds().get("TRAMITE") != null){ + TarmTramite tarmTramite = (TarmTramite) this.getMfilelds().get("TRAMITE"); + sqlFiltroValidacionArma = "t.pk not in (SELECT coalesce(max(a.pk),'-1') FROM TarmArmas a WHERE a.codigoarma in (SELECT distinct(h.codigoarma) from TarmDocumentoHabilitante h WHERE h.personcode="+this.getMfilelds().get("personcode")+" AND h.ctramite="+tarmTramite.getPk()+" AND h.estado = 'APR' AND trunc(h.fechaexpiracion) >= " + "TO_DATE('" +dateFormat.format(Calendar.getInstance().getTime())+ "','yyyy-MM-dd')) GROUP BY a.codigoarma)"; + } + //estados del armas + if(this.getMfilelds().get("CLASEARMAS") != null){ + String[] clasesarma = this.getMfilelds().get("CLASEARMAS").toString().split(","); + StringBuffer sqlclasesarmas = new StringBuffer(" t.ctipoarmaexplosivo IN (select o.pk from TarmTipoArmaExplosivo o where o.clase in("); + for (int i = 0; i < clasesarma.length; i++) { + sqlclasesarmas.append("'").append(clasesarma[i]).append("'"); + if(i < clasesarma.length - 1){ + sqlclasesarmas.append(","); + } + } + sqlclasesarmas.append(")) "); + sqlFiltroClaseArmas = sqlclasesarmas.toString(); + } + +// if(this.getMfilelds().get("FECHACADUCIDADARM") != null){ +// sqlFiltroFechaCaducidad="t.fechacaducidad "+this.getMfilelds().get("FECHACADUCIDADARM"); +// } + String sqlActual = ""; + if(this.getMfilelds().get("personcode")==null){ + sqlActual = " t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma) " + + " and t.estado !='DEST' and t.estado!='VEND' and t.estado!='MING' and t.estado!='DUPL' and t.estado!='CUSTEM' and t.estado!='BLOQ'" + + " and (t.peso>0 or t.cantidad>0)";//distintas de destruidas y cambio de propietario and t.cregistro=ta.cregistro para el manejo de los explosivos + }else{ + sqlActual = " t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) " + + " and t.estado !='DEST' and t.estado!='VEND' and t.estado!='MING' and t.estado!='DUPL' and t.estado!='CUSTEM' and t.estado!='BLOQ'" + + " and (t.peso>0 or t.cantidad>0)";//distintas de destruidas y cambio de propietario and t.cregistro=ta.cregistro para el manejo de los explosivos + } + + sqlActual=sqlActual+ filtroPersona; + +// String sqlFinal = obtenerFiltroBusquedaGeneral(sqlFiltroPersona, sqlFiltroEstados, sqlFiltroSancion, sqlFiltroValidacionArma,sqlFiltroClaseArmas,sqlFiltroFechaCaducidad, sqlActual); + String sqlFinal = obtenerFiltroBusquedaGeneral(sqlFiltroPersona, sqlFiltroEstados,sqlFiltroTipoFabricacion, sqlFiltroSancion, sqlFiltroValidacionArma,sqlFiltroClaseArmas,sqlActual); + Filter filtroFinal = new Filter(); + sqlFinal= sqlFinal+ " and t.estadoventa is null "; + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private String obtenerFiltroBusquedaGeneral(String... sqlFiltros ){ + StringBuffer sqlFinal = new StringBuffer(); + for (int i = 0; i < sqlFiltros.length ; i++) { + if(sqlFinal.length() > 0 && !StringUtils.endsWith(StringUtils.trim(sqlFinal.toString()), "AND")){ + sqlFinal.append( " AND "); + } + sqlFinal.append(sqlFiltros[i]); + } + return sqlFinal.toString(); + } + + @SuppressWarnings("unchecked") + public void querydatabaseSinFiltros() { + try { + DtoQuery dto = this.getDtoQuery(); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql=" t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() throws Exception { + // TODO Auto-generated method stub + super.next(); + } + + @SuppressWarnings("unchecked") + protected void querydatabasePorCodigo() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql=" t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception{ + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryTipoFab= new SubQuery("TgeneCatalogDetail","description","tipofabricacion","i.pk.catalog=t.tipofabricacion and i.pk.catalogcode='TIPOFABRICACION'"); + dto.addSubQuery(subqueryTipoFab); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TarmTipoArmaExplosivo","clase","cclase","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo= new SubQuery("TarmTipoArmaExplosivo","clasecodigo","cclasecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud= new SubQuery("TarmTipoArmaExplosivo","longitud","clongitud","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo= new SubQuery("TarmTipoArmaExplosivo","longitudcodigo","clongitudcodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ccalibre","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo= new SubQuery("TarmTipoArmaExplosivo","calibrecodigo","ccalibrecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivo","ctipoarmaexplosivo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivocodigo","ctipoarmaexplosivocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapeso","cunidadmedidapeso","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadTipo= new SubQuery("TgeneCatalogDetail","description","unidadmedidadesc","i.pk.catalog= (select o.unidadmedidapeso from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryUnidadTipo); + SubQuery subqueryUnidadCodigo= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapesocodigo","cunidadmedidapesocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida= new SubQuery("TgeneCatalogDetail","description","unidadmedida","i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode= new SubQuery("TarmRegistroArmas","personcode","personcode","i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + SubQuery subqueryTipo= new SubQuery("TgeneCatalogDetail","description","tipo","i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipo); + SubQuery subqueryTipoArmaExplosivo= new SubQuery("TgeneCatalogDetail","description","tipoarmaexplosivo","i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + SubQuery subqueryClasecatalogo= new SubQuery("TgeneCatalogDetail","description","clase","i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClasecatalogo); + + return dto; + } + + @SuppressWarnings("unchecked") + protected void querydatabaseSimple() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql=" t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + public void save() { + try { + this.registroArmas.update(); + DtoSave dtoSaveRegistro = registroArmas.getDtoSave(); + dtoSaveRegistro.setIsForm(Boolean.TRUE); + dtoSaveRegistro.setReturnpk(Boolean.TRUE); + dtoSaveRegistro.setPosition(1); + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(Boolean.TRUE); // Para que el core devuelva el pk de los registros nuevos. + dtosave.setPosition(2); + HashMap msave = new HashMap(); + msave.put(registroArmas.getBeanalias(), dtoSaveRegistro); + msave.put(beanalias, dtosave); + + Request request = callerhelper.getRequest(); + request.put("TIPODOC", tipoDoc); + request.put("NUMDOC", numDoc); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + querydatabase(); + } + + public void saveFile() { + try { + DtoSave dtosave = super.getDtoSave(); + HashMap msave = new HashMap(); + msave.put(beanalias, dtosave); + Request request = callerhelper.getRequest(); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + querydatabase(); + } + + public void saveArmaSolicitud() { + try { + + if(!isArmaDuplicada(record)){ + + record.getModifiedData().put("edit", "S"); + + this.registroArmas.update(); + update(); + if(!existeTipoArmaExplosivo){ + return; + } + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(Boolean.TRUE); // Para que el core devuelva el pk de los registros nuevos. + dtosave.setPosition(2); + HashMap msave = new HashMap(); + DtoSave dtoSaveRegistro = registroArmas.getDtoSave(); + dtoSaveRegistro.setIsForm(Boolean.TRUE); + dtoSaveRegistro.setReturnpk(Boolean.TRUE); + dtoSaveRegistro.setPosition(1); + + Request request = callerhelper.getRequest(); + request.setTransactionModule("30"); + request.setTransactionCode(15); + request.setTransactionVersion(1); + if(!verificaArmaExplosivo){ + request.put("eseliminacion", Constant.STR_Y); + }else{ + msave.put(registroArmas.getBeanalias(), dtoSaveRegistro); + } + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.put("TIPODOC", this.getMfilelds().get("tipodoc")); + request.put("NUMDOC", this.getMfilelds().get("numdoc")); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.registroArmas.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + }else{ + record= null; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_armaDuplicada")); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void update() throws Exception { + TgeneCatalogDetail estado = CatalogDetailController.findxCodigoCodcatalogo(record.getEstado(), record.getEstadocodigo()); + TgeneCatalogDetail marca = CatalogDetailController.findxCodigoCodcatalogo(record.getMarca(), record.getMarcacodigo()); + record.getModifiedData().put("estado", estado.getDescription()); + record.getModifiedData().put("marca", marca.getDescription()); + for(TgeneCatalogDetail color:lcolor){ + if(record.getColor()!=null && record.getColor().equals(color.getPk().getCatalog())){ + record.getModifiedData().put("color", color.getDescription()); + break; + } + } + if(verificaArmaExplosivo){ + if(tipoArmaExplosivo == null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionClase")); + existeTipoArmaExplosivo = Boolean.FALSE; + return; + }else{ + this.record.setCtipoarmaexplosivo(tipoArmaExplosivo.getPk()); + existeTipoArmaExplosivo = Boolean.TRUE; + } + } + //valida si el estado es de perdida robo para obligar el adjuntar + if((record.getEstado()!=null && record.getEstado().equals("RPER")) || + (record.getPk()==null)){ + String xPathLocation=""; + if(record.getEstado()!=null && record.getEstado().equals("RPER")){ + xPathLocation= getRutaDocumentoSolBase("PerdidaRobo") + "/cm:"+record.getEstado()+"-" +this.record.getCodigoarma() ; + }else{ + xPathLocation= getRutaDocumentoSolBase("Crear") +"/cm:"+record.getEstado()+"-" +this.numDoc ; + } + if(uploadedFile!=null && uploadedFile.getFileName()!=null){ + String extencionArchivo=getExtension(uploadedFile.getFileName()); + String nombreArchivo = record.getEstado()+"-"+(this.record.getPk()!=null?this.record.getPk():"NUEVA")+"."+extencionArchivo; + if(alfrescoController.uploadFile(uploadedFile.getInputstream(),nombreArchivo, xPathLocation)){ + String pathRuta=xPathLocation + "/cm:" + nombreArchivo; + this.record.setPathDocumento(pathRuta); + uploadedFile=null; + }else{ + MessageHelper.setMessageError("Adjunte el documento"); + return; + } + }else{ + MessageHelper.setMessageError("Adjunte el documento"); + return; + } + } + + super.update(); + } + + /* + * Metodo que retorna la extencion del documento que se desea subir al alfresco + */ + public String getExtension(String filename) { + int index = filename.lastIndexOf('.'); + if (index == -1) { + return ""; + } else { + return filename.substring(index + 1); + } + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase(String carpeta) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta = new StringBuilder("cm:Registro"); + ruta = ruta.append("/cm:"+carpeta); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + ruta = ruta.append("/cm:D-").append(calendar.get(Calendar.DAY_OF_WEEK)); + return ruta.toString(); + } + public void updateAutorizacion()throws Exception { + super.update(); + } + + /** + * Método que se ejecuta al carga edición + * @throws Exception + */ + public void loadEdit() throws Exception { + verificaArmaExplosivo = Boolean.TRUE; + if(record.getCountrycode() == null){ + record.setCountrycode("EC"); + } + if(record.getCtipoarmaexplosivo()==null){ + MessageHelper.setMessageError("NO ESTA ASOCIADO A UN TIPO DE ARMA EXPLOSIVO"); + return; + } + tipoArmaExplosivo= TiposArmasExplosivosController.findarma(record.getCtipoarmaexplosivo()); + lprovincias = ProvinceController.find(record.getCountrycode()); + executeProvince(); + if(record.getProvincecode() != null){ + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + executeCanton(); + } + completaInfTipoArma(); + // Anade la descripcion del tipo de arma explosivo + if(tipoArmaExplosivo!=null){ + if(this.tipoArmaExplosivo.getClase().equals("0010000003") || this.tipoArmaExplosivo.getClase().equals("0010000005") || this.tipoArmaExplosivo.getClase().equals("0010000007") || this.tipoArmaExplosivo.getClase().equals("0010000006")){ + this.record.getModifiedData().put("unidadMedidaCantidad", null); + this.record.getModifiedData().put("unidadMedidaPeso", tipoArmaExplosivo.getModifiedData().get("nunidadMedidaPeso")); + }else if(this.tipoArmaExplosivo.getClase().equals("0010000001") || this.tipoArmaExplosivo.getClase().equals("0010000002") || this.tipoArmaExplosivo.getClase().equals("0010000004") || this.tipoArmaExplosivo.getClase().equals("0010000008")){ + this.record.getModifiedData().put("unidadMedidaCantidad", tipoArmaExplosivo.getModifiedData().get("nunidadMedidaPeso")); + this.record.getModifiedData().put("unidadMedidaPeso", null); + } + } + verificarClaseArma(); + registroArmas.clearAll(); + registroArmas.addFilter("pk", record.getCregistro().toString()); + registroArmas.query(); + List registroArmasList = registroArmas.getLrecord(); + registroArmas.setRecord(registroArmasList.get(0)); + registroArmas.getRecord().setIsnew(Boolean.FALSE); + TcustPersonDetail tcustPersonDetail = PersonDetailController.find(registroArmas.getRecord().getPersoncode().toString()); + tipoDoc = tcustPersonDetail.getIdentificationcatalog(); + numDoc = tcustPersonDetail.getIdentification(); + nombreRazon = tcustPersonDetail.getName(); + } + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en el Alfresco + */ + public void handleUpload(FileUploadEvent event){ + uploadedFile = event.getFile(); + } + + /** + * Recorta el nombre del archivo a cargarse + * @param nombre + * @return nombre recortado + */ + public String recorteNombre(String nombre){ + String fielname=nombre; + if(fielname.length()>30){ + fielname=fielname.substring(0,30)+extencionArchivo(nombre); + } + return fielname; + } + /** + * Obtiene la extencion del archivo a cargar + * @param nombre + * @return + */ + private String extencionArchivo(String nombre){ + int pos=nombre.lastIndexOf('.'); + nombre=nombre.substring(pos); + return nombre; + } + /** + * Método que completa la informaci´n del arma una vez se presiona el botón crear + */ + private void completaInfTipoArma(){ + TarmArmas recordArma = findPorCodigo(record.getPk()); + record.setCountrycode("EC"); + clase = record.getModifiedData().get("clase") != null ? recordArma.getModifiedData().get("clase").toString() : null; + calibre = record.getModifiedData().get("ccalibre") != null ? Utilidades.formatearDecimalesEnTexto((recordArma.getModifiedData().get("ccalibre").toString()).replace("null", ""), "#.00") : null; + longitud = record.getModifiedData().get("clongitud") != null ? recordArma.getModifiedData().get("clongitud").toString() : null; + tipoarma = record.getModifiedData().get("ctipoarmaexplosivo") != null ? recordArma.getModifiedData().get("ctipoarmaexplosivo").toString() : null; + } + + @Override + public void create() throws Exception { + super.create(); + this.tipoDoc = null; + this.numDoc = null; + this.nombreRazon = null; + this.verificaArmaExplosivo = Boolean.TRUE; + this.registroArmas.create(); + this.registroArmas.setLrecord(new ArrayList()); + this.record.setCountrycode("EC"); +// this.record.setEstado("REG"); + this.record.setEstado("PREG"); + this.record.setEstadocodigo("ESTADOARMA"); + this.record.setMarcacodigo("MARCA"); + this.record.setGeneracertificado("NO"); + this.lprovincias = ProvinceController.find(record.getCountrycode()); + this.executeProvince(); + } + + public void update(TarmArmas bean) throws Exception { + record=bean; + updateAutorizacion(); + } + + public void validacionDocumento(String numeroDocumento, String tipoDocumento){ + if(numeroDocumento==null || tipoDocumento==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselacedula")); + return; + } + TcustPersonDetail tcustPersonDetail=null; + if(tipoDocumento.equals(codigoCedula)){ +//----------validamos si es valida la CEDULA + if(!ValidateIdentification.cedula(numeroDocumento)){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en MAIA + tcustPersonDetail=buscarPersonaMaia(numeroDocumento,tipoDocumento); + }else if(tipoDocumento.equals(codigoRuc)){ +//----------validamos si es valida el RUC + if(!ValidateIdentification.ruc(numeroDocumento)){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en maia + tcustPersonDetail=buscarPersonaMaia(numeroDocumento,tipoDocumento); + }else{ +//----------si es PASAPORTE + tcustPersonDetail=buscarPersonaMaia(numeroDocumento,tipoDocumento); + } + if(tcustPersonDetail==null){ + nombreRazon=null; + numDoc=null; + MessageHelper.setMessageError("La datos de la persona ingresada no existen, por favor crear primero la persona"); + return; + }else{ + nombreRazon=tcustPersonDetail.getName(); + } + } + + /** Método para validar si la persona existe en la BD de Maia + * @param numeroDocumento + * @param tipoDocumento + * @return TcustPersonDetail + */ + public TcustPersonDetail buscarPersonaMaia(String numeroDocumento, String tipoDocumento){ + return PersonDetailController.findxidentification(numeroDocumento,tipoDocumento); + } + /** + * Busca un arma por código y estado + * @param armaCode código del arma + * @param estado estado del arma + * @return + */ + public static TarmArmas find(String armaCode,String estado) { + try { + + if(armaCode==null){ + return null; + } + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + if(estado!=null){ + cc.addFilter("estado", estado); + cc.addFilter("estadocodigo", "ESTADOARMA"); + } + cc.querydatabaseArmas(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = new TarmTipoArmaExplosivo(); + tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if(tarmTipoArmaExplosivo!=null && tarmTipoArmaExplosivo.getCalibrecodigo()!=null) + cc.record.modifiedData().put("calibre",tarmTipoArmaExplosivo==null?"":Utilidades.formatearDecimalesEnTexto((CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription()), "#.000")); + cc.record.modifiedData().put("tipo",tarmTipoArmaExplosivo==null?"":CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription()); + cc.record.modifiedData().put("clase",tarmTipoArmaExplosivo==null?"":CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription()); + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + cc.record.modifiedData().put("pais", cc.record.getCpaisorigen()==null?"":CountryController.findcountry(cc.record.getCpaisorigen()).getDescription()); + + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * + * @param codigopersona + * @return + */ + public static TarmArmas findBySerieMarca(String serie, String marca) { + try { + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + if(serie!=null && !serie.isEmpty()){ + cc.addFilter("lote", serie); + } + cc.addFilter("marca", marca); + cc.querydatabaseSimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findByPK(String cArma) { + try { + + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", cArma); + cc.querydatabaseSinFiltros(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + cc.record=cc.lrecord.get(0); + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if(tarmTipoArmaExplosivo!=null){ + if(tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null){ + cc.record.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getTipoarmaexplosivo() != null && tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo() != null){ + cc.record.modifiedData().put("tipo",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo())!=null? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(),tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getClase() != null && tarmTipoArmaExplosivo.getClasecodigo() != null){ + cc.record.modifiedData().put("clase",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription():""); + } + + TarmRegistroArmas registroArmas = new TarmRegistroArmas(); + TcustPersonDetail detallePersona = new TcustPersonDetail(); + if(cc.record.getCregistro()!=null ){ + registroArmas = RegistroArmController.findByCodigo(String.valueOf(cc.record.getCregistro())); + if(registroArmas!=null){ + detallePersona= PersonDetailController.find(String.valueOf(registroArmas.getPersoncode())); + } + } + cc.record.modifiedData().put("razonsPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getName()); + cc.record.modifiedData().put("documentoPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getIdentification()); + + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findPorCodigo(String armaCode) { + try { + + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + //cc.addFilter("REG", "ESTADOARMA"); + cc.querydatabaseArmas(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if(tarmTipoArmaExplosivo!=null){ + if(tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null){ + cc.record.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getTipoarmaexplosivo() != null && tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo() != null){ + cc.record.modifiedData().put("tipo",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo())!=null? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(),tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getClase() != null && tarmTipoArmaExplosivo.getClasecodigo() != null){ + cc.record.modifiedData().put("clase",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription():""); + } + + TarmRegistroArmas registroArmas = new TarmRegistroArmas(); + TcustPersonDetail detallePersona = new TcustPersonDetail(); + if(cc.record.getCregistro()!=null ){ + registroArmas = RegistroArmController.findByCodigo(String.valueOf(cc.record.getCregistro())); + if(registroArmas!=null){ + detallePersona= PersonDetailController.find(String.valueOf(registroArmas.getPersoncode())); + } + } + cc.record.modifiedData().put("razonsPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getName()); + cc.record.modifiedData().put("documentoPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getIdentification()); + cc.record.modifiedData().put("marca",(cc.record ==null || cc.record.getMarca()==null || cc.record.getMarca().isEmpty() || cc.record.getMarcacodigo()==null || cc.record.getMarcacodigo().isEmpty())?"":CatalogDetailController.findxCodigoCodcatalogo(cc.record.getMarca(), cc.record.getMarcacodigo()).getDescription()); + + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findXCodigo(String armaCode) { + try { + + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + //cc.addFilter("REG", "ESTADOARMA"); + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + lcities = CityController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + } + } + + + /** + * + * + * @param personCode + * @param estados estados del arma separados por coma + * @param tipoFab tipos de fabricacion del arma separados por coma + * @return Una lista de Armas encontradas + */ + public List findxPersona(Long personCode, String estados, String tipoFab, String clase, String fechaCaducidad) { + List armasLista = null; + try { + armasLista = new ArrayList(); + ArmasController armas = new ArmasController(); + armas.init(); + armas.recperpage = 4000; + armas.addField("personcode", personCode); + if(this.getMfilelds().get("sancion") != null){ + armas.addField("sancion", this.getMfilelds().get("sancion")); + } + if(this.getMfilelds().get("TRAMITE") != null){ + armas.addField("TRAMITE", this.getMfilelds().get("TRAMITE")); + } + if(estados == null){ + armas.addFilter("estado", "REG"); + } else{ + armas.addField("ESTADOS", estados); + } + if(tipoFab != null && tipoFab .trim().length()>0){ + armas.addField("TIPOFABRICACION", tipoFab); + } + if(clase != null && clase .trim().length()>0){ + armas.addField("CLASEARMAS", clase); + } +// if(fechaCaducidad != null && fechaCaducidad .trim().length()>0){ +// armas.addField("FECHACADUCIDADARM", fechaCaducidad); +// } + armas.query(); + if(armas.getLrecord() != null && !armas.getLrecord().isEmpty()){ + armasLista.addAll(armas.getLrecord()); + } + + return armasLista; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return armasLista; + } + } + + + /** + * Lista de Armas por Registro + **/ + public static List findxRegistro(String registrocode) { + try { + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("cregistro", registrocode); + + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + for(TarmArmas item : cc.lrecord){ + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(item.getCtipoarmaexplosivo()); + item.modifiedData().put("clase",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription()); + if(tarmTipoArmaExplosivo.getLongitud()!=null && tarmTipoArmaExplosivo.getLongitudcodigo()!=null){ + item.modifiedData().put("longitud",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getLongitud(), tarmTipoArmaExplosivo.getLongitudcodigo()).getDescription()); + } + item.modifiedData().put("tipo",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription()); + if(tarmTipoArmaExplosivo.getCalibre()!=null && tarmTipoArmaExplosivo.getCalibrecodigo()!=null){ + item.modifiedData().put("calibre",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription()); + } + item.modifiedData().put("unidadMedidaCantidad",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getUnidadmedidapeso(), tarmTipoArmaExplosivo.getUnidadmedidapesocodigo()).getDescription()); + } + + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Abre el LOV de la clase del arma + */ + public void openLovClase() { + Map> params = new HashMap>(); + ClaseLovController.openLov(params); + } + + /** + * Regresa del LOV de armas + * @param event + */ + public void onReturnClase(SelectEvent event) { + TgeneCatalogDetail clase = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("clase", clase.getDescription()); + this.clase = clase.getPk().getCatalog(); + this.verificarClaseArma(); + } + + /** + * Abre el LOV de la clase del arma + */ + public void openArmaExplosivoLov() { + this.record.getModifiedData().put("longitud", null); + this.record.getModifiedData().put("tipoarmaexplosivo", null); + this.record.getModifiedData().put("calibre", null); + record.setCantidad(null); +// descripcionUnidadpeso=null; + Map> params = new HashMap<>(); + ArmaExplosivoLovController.openLov(params); + } + + /** + * Regresa del LOV de armas + * @param event + */ + public void onReturnArmaExplosivo(SelectEvent event) { + tipoArmaExplosivo = (TarmTipoArmaExplosivo) event.getObject(); + //Setear descripciones a presentarse + this.record.getModifiedData().put("clase", tipoArmaExplosivo.getModifiedData().get("nclase")); + this.record.getModifiedData().put("tipoarmaexplosivo", tipoArmaExplosivo.getModifiedData().get("ntipo")); + this.record.getModifiedData().put("longitud", tipoArmaExplosivo.getModifiedData().get("nlongitud")); + this.record.getModifiedData().put("calibre", tipoArmaExplosivo.getModifiedData().get("ncalibre")); + // Setear valores en las variables correspondientes + if(tipoArmaExplosivo!=null){ + this.clase = tipoArmaExplosivo.getClase(); + this.longitud = tipoArmaExplosivo.getLongitud(); + this.tipoarma = tipoArmaExplosivo.getTipoarmaexplosivo(); + this.calibre = tipoArmaExplosivo.getCalibre(); + this.record.setUnidadmedidacantidad(tipoArmaExplosivo.getUnidadmedidapeso()); + if(tipoArmaExplosivo.getModifiedData().get("desunidad")!=null){ + if(this.clase.equals("0010000003") || this.clase.equals("0010000005") || this.clase.equals("0010000007") || this.clase.equals("0010000006")){ + this.record.getModifiedData().put("unidadMedidaCantidad", null); + this.record.getModifiedData().put("unidadMedidaPeso", tipoArmaExplosivo.getModifiedData().get("desunidad")); + }else if(this.clase.equals("0010000001") || this.clase.equals("0010000002") || this.clase.equals("0010000004") || this.clase.equals("0010000008")){ + this.record.getModifiedData().put("unidadMedidaCantidad", tipoArmaExplosivo.getModifiedData().get("desunidad")); + this.record.getModifiedData().put("unidadMedidaPeso", null); + } + } + } + this.verificarClaseArma(); + if(this.clase.equals("0010000001")||this.clase.equals("0010000008")){ + record.setCantidad(1);//si es arma de fuego por default sea uno y no deje editar + this.bloquearUnidadCantidad = Boolean.TRUE; + } +// else{ +// record.setCantidad(null); +// } + } + + /** + * Método en el cual se determina si se bloquea unidad o cantidad al momento de cargar los datos del arma + * @param clase + */ + private void verificarClaseArma(){ + if(this.clase==null){ + this.bloquearUnidadPeso = Boolean.TRUE; + this.bloquearUnidadCantidad = Boolean.TRUE; + return; + } + + if( this.clase.equals("0010000003") || this.clase.equals("0010000005") || this.clase.equals("0010000007") || this.clase.equals("0010000006")){ + this.bloquearUnidadPeso = Boolean.FALSE; + } else{ + this.bloquearUnidadPeso = Boolean.TRUE; + } + if(this.clase.equals("0010000001") || this.clase.equals("0010000002") || this.clase.equals("0010000004")){ + this.bloquearUnidadCantidad = Boolean.FALSE; + } else{ + this.bloquearUnidadCantidad = Boolean.TRUE; + } + } + + /** + * Abre el LOV de la longitud del arma + */ + public void openLovLongitud() { + Map> params = new HashMap>(); + LongitudLovController.openLov(params); + } + + /** + * Regresa del LOV de longitud + * @param event + */ + public void onReturnLongitud(SelectEvent event) { + TgeneCatalogDetail longitud = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("longitud", longitud.getDescription()); + this.longitud = longitud.getPk().getCatalog(); + } + + /** + * Abre el LOV del tipo de arma + */ + public void openLovTipoArma() { + Map> params = new HashMap>(); + TipoArmaExpLovController.openLov(params); + } + + /** + * Regresa del LOV de tipo de arma + * @param event + */ + public void onReturnTipoArma(SelectEvent event) { + TgeneCatalogDetail tipoArma = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("tipoarmaexplosivo", tipoArma.getDescription()); + this.tipoarma = tipoArma.getPk().getCatalog(); + } + + /** + * Abre el LOV de Calibre + */ + public void openLovCalibre() { + Map> params = new HashMap>(); + CalibreLovController.openLov(params); + } + + /** + * Regresa del LOV del calibre + * @param event + */ + public void onReturnCalibre(SelectEvent event) { + TgeneCatalogDetail calibre = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("calibre", calibre.getDescription()); + this.calibre = calibre.getPk().getCatalog(); + } + + /** + * Abre el LOV cambio de usuario + */ + public void openLovCambioUsuario() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Acción de retorno de la selección del usuario + * @param event de retorno de la selección + */ + public void onReturnCambioUsuario(SelectEvent event) { + nuevoPropietarioArma = (TcustPersonDetail) event.getObject(); + } + + /** + * Abre el dialog del cambio de persona + */ + public void abrirDialogCambio() { + this.nuevoPropietarioArma = null; + } + + /** + * Se cambia el propietario del arma + */ + public void cambiarArmaUsuario() { + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.setTransactionModule("30"); + request.setTransactionCode(151); + request.setTransactionVersion(1); + request.put("ARMAACTUAL", this.record); + request.put("NUEVAPERSONA", this.nuevoPropietarioArma); + Response response = callerHelper.executeSave(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + MessageHelper.setMessageInfo(response); + this.querydatabase(); + } else{ + MessageHelper.setMessageError(response); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if(Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")){ + valorColocar = Boolean.TRUE; + } + for (TarmArmas guardias : lrecord) { + guardias.getModifiedData().put("seleccionado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Metodo para obtener el listado de las armas por la serie/lote + * @param serieLote + * @return + */ + public static List findxSerieLote(String serieLote) { + try { + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 1000; + cc.addFilter("lote", serieLote); + cc.querydatabaseFechaMax(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para obtener el listado de las armas por la lote + * @param serieLote + * @return + */ + public static List findPorLote(String lote) { + try { + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 10000; + cc.addFilter("lote", lote); + cc.querydatabaseArmas(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para obtener los codigos + */ + private static String codigos(String parametro){ + TgeneParameters tgeneParameters= ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + @SuppressWarnings("unchecked") + protected void querydatabaseFechaMax() { + try { + DtoQuery dto = this.getDtoQuery(); + dto.setOrderby("pk"); + String codigoEstadoIncautada=codigos("CODIGO.INCAUTADA"); + String codigoEstadoDecomisada=codigos("CODIGO.DECOMISADA"); + String codigoEstadoVendida=codigos("CODIGO.VENDIDA"); + String codigoEstadoMatPrima=codigos("CODIGO.MATERIAPRIMA"); + Filter filtro = new Filter(); + String sql="t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro)"//and t.cregistro=ta.cregistro para el manejo de los explosivos + + " and t.estado !='DEST' and t.estado !='CDP' and t.estado !='"+codigoEstadoIncautada+"' and t.estado !='"+codigoEstadoDecomisada+"' and t.estado !='"+codigoEstadoVendida+"' and t.estado !='"+codigoEstadoMatPrima+"' "; + filtro.setSql(sql); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void actualizar(TarmArmas arma) throws Exception{ + record=arma; + super.update(); + } + + /*Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findxCodigo(String armaCode) { + try { + + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + cc.querydatabaseArmas(); + cc.getRecord().getModifiedData().put("lmarca", cc.getLmarca()); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * @param lote + * @return + */ + public static List findxLotePerdidaRobo(String lote) { + List armasLista = null; + try { + armasLista = new ArrayList(); + ArmasController armas = new ArmasController(); + armas.init(); + armas.recperpage = 4000; + armas.addFilter("lote", lote);//("personcode", personCode); + armas.querydatabaseArmaVenta(" and t.pathDocumento like '%/cm:PerdidaRobo/%'"); + if(armas.getLrecord() != null && !armas.getLrecord().isEmpty()){ + armasLista.addAll(armas.getLrecord()); + } + return armasLista; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return armasLista; + } + } + + /** + * @param lote + * @return + */ + public static List findxLoteRegistro(String lote) { + List armasLista = null; + try { + armasLista = new ArrayList(); + ArmasController armas = new ArmasController(); + armas.init(); + armas.recperpage = 4000; + armas.addFilter("lote", lote);//("personcode", personCode); + armas.querydatabaseArmaVenta(" and t.pathDocumento like '%/cm:Crear/%'"); + if(armas.getLrecord() != null && !armas.getLrecord().isEmpty()){ + armasLista.addAll(armas.getLrecord()); + } + return armasLista; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return armasLista; + } + } + + @SuppressWarnings("unchecked") +protected void querydatabaseArmaVenta(String crear) { + try { + DtoQuery dto = this.getDtoQuery(); + dto.setOrderby("pk"); + String sqlFinal = " t.pathDocumento is not null "+crear; + Filter filtroFinal = new Filter(); + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + + public void generarReporte(TarmArmas arma) { + String path = "armas/reports/certificadoArmaCrear"; + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda","repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + try { + // Usuario logueado en la aplicacion + String nombreUsuario; + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + } else { + nombreUsuario = ""; + } + parameters.put("filtro", arma.getPk()); + parameters.put("usuario", nombreUsuario); + //Fecha actual + Calendar fechaActualCldr = Calendar.getInstance(); + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH)+1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarfecha", fechaActualSB.toString()); + + String format = "pdf"; + String filename = "certificadoArma"; + + InputStream inputStream = this.reportController.jaspertoInputstream(path,parameters, format, filename, this.getLoginController()); + + String nombreArchivo = (filename!=null && !filename.isEmpty()) ? filename+"."+format : null; + String xPathLocation= getRutaDocumentoSolBase()+"/cm:"+arma.getEstado() + "/cm:CP-" + arma.getModifiedData().get("personcode") + "/cm:CA-" + arma.getCodigoarma() ; + if (nombreArchivo != null && xPathLocation != null && inputStream != null) { + setRecord(arma); + if (alfrescoController.uploadFile(inputStream, nombreArchivo, xPathLocation)) { + record.setPathDocumentocrear(xPathLocation + "/cm:" + nombreArchivo); + record.setGeneracertificado("SI"); + super.update(); + saveFile(); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_subiroarchivoregistrorecibo").concat("("+nombreArchivo+")")); + + } + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase() { + Calendar calendar = Calendar.getInstance(); + StringBuilder ruta = new StringBuilder("cm:Armas/cm:Crear"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + ruta = ruta.append("/cm:D-").append(calendar.get(Calendar.DAY_OF_MONTH)); + return ruta.toString(); + } + + public TiposArmasExplosivosController getTiposArmasExplosivosController() { + return tiposArmasExplosivosController; + } + + + public void setTiposArmasExplosivosController( + TiposArmasExplosivosController tiposArmasExplosivosController) { + this.tiposArmasExplosivosController = tiposArmasExplosivosController; + } + + + public RegistroArmController getRegistroArmas() { + return registroArmas; + } + + + public void setRegistroArmas(RegistroArmController registroArmas) { + this.registroArmas = registroArmas; + } + + + public List getLtipoidentificacion() { + return ltipoidentificacion; + } + + + public void setLtipoidentificacion(List ltipoidentificacion) { + this.ltipoidentificacion = ltipoidentificacion; + } + + + public String getTipoDoc() { + return tipoDoc; + } + + + public void setTipoDoc(String tipoDoc) { + this.tipoDoc = tipoDoc; + } + + + public String getNumDoc() { + return numDoc; + } + + + public void setNumDoc(String numDoc) { + this.numDoc = numDoc; + } + + + public String getNombreRazon() { + return nombreRazon; + } + + + public void setNombreRazon(String nombreRazon) { + this.nombreRazon = nombreRazon; + } + + + public List getLestadoarma() { + return lestadoarma; + } + + + public void setLestadoarma(List lestadoarma) { + this.lestadoarma = lestadoarma; + } + + + public List getLmarca() { + return lmarca; + } + + + public void setLmarca(List lmarca) { + this.lmarca = lmarca; + } + + + public List getLcolor() { + return lcolor; + } + + + public void setLcolor(List lcolor) { + this.lcolor = lcolor; + } + + + public List getLtipofabricacion() { + return ltipofabricacion; + } + + + public void setLtipofabricacion(List ltipofabricacion) { + this.ltipofabricacion = ltipofabricacion; + } + + + public List getLcountry() { + return lcountry; + } + + + public void setLcountry(List lcountry) { + this.lcountry = lcountry; + } + + + public List getLunidadmedidacantidad() { + return lunidadmedidacantidad; + } + + + public void setLunidadmedidacantidad( + List lunidadmedidacantidad) { + this.lunidadmedidacantidad = lunidadmedidacantidad; + } + + + public String getLongitud() { + return longitud; + } + + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + + public String getCalibre() { + return calibre; + } + + + public void setCalibre(String calibre) { + this.calibre = calibre; + } + + + public String getClase() { + return clase; + } + + + public void setClase(String clase) { + this.clase = clase; + } + + + public String getTipoarma() { + return tipoarma; + } + + + public void setTipoarma(String tipoarma) { + this.tipoarma = tipoarma; + } + + + public String getUnidadmedidapeso() { + return unidadmedidapeso; + } + + + public void setUnidadmedidapeso(String unidadmedidapeso) { + this.unidadmedidapeso = unidadmedidapeso; + } + + + public List getLunidadmedidapeso() { + return lunidadmedidapeso; + } + + + public void setLunidadmedidapeso(List lunidadmedidapeso) { + this.lunidadmedidapeso = lunidadmedidapeso; + } + + + public List getLprovincias() { + return lprovincias; + } + + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + + public List getLcantones() { + return lcantones; + } + + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + + public List getLparroquias() { + return lparroquias; + } + + + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + + public List getLcities() { + return lcities; + } + + + public void setLcities(List lcities) { + this.lcities = lcities; + } + + + public boolean isExisteTipoArmaExplosivo() { + return existeTipoArmaExplosivo; + } + + + public void setExisteTipoArmaExplosivo(boolean existeTipoArmaExplosivo) { + this.existeTipoArmaExplosivo = existeTipoArmaExplosivo; + } + + + public boolean isVerificaArmaExplosivo() { + return verificaArmaExplosivo; + } + + + public void setVerificaArmaExplosivo(boolean verificaArmaExplosivo) { + this.verificaArmaExplosivo = verificaArmaExplosivo; + } + + public boolean isBloquearUnidadCantidad() { + return bloquearUnidadCantidad; + } + + public void setBloquearUnidadCantidad(boolean bloquearUnidadCantidad) { + this.bloquearUnidadCantidad = bloquearUnidadCantidad; + } + + public boolean isBloquearUnidadPeso() { + return bloquearUnidadPeso; + } + + public void setBloquearUnidadPeso(boolean bloquearUnidadPeso) { + this.bloquearUnidadPeso = bloquearUnidadPeso; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public TarmTipoArmaExplosivo getTipoArmaExplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoArmaExplosivo(TarmTipoArmaExplosivo tipoArmaExplosivo) { + this.tipoArmaExplosivo = tipoArmaExplosivo; + } + + + + + public String getRazonSocial() { + return razonSocial; + } + + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public String getFiltroPersona() { + return filtroPersona; + } + + public void setFiltroPersona(String filtroPersona) { + this.filtroPersona = filtroPersona; + } + + protected void querydatabaseArmas() { + try { + DtoQuery dto = this.getDtoQuery(); + + dto.setOrderby("pk"); + if(this.getMfilelds().get("ESTADOS") != null){ + Filter filtroEstados = new Filter(); + String[] estados = this.getMfilelds().get("ESTADOS").toString().split(","); + StringBuffer sqlEstados = new StringBuffer(" t.estado IN ("); + for (int i = 0; i < estados.length; i++) { + sqlEstados.append("'").append(estados[i]).append("'"); + if(i < estados.length - 1){ + sqlEstados.append(","); + } + } + sqlEstados.append(")"); + filtroEstados.setSql(sqlEstados.toString()); + dto.addFiltro(filtroEstados); + }else{ + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql=" t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + } + + + + if(this.getMfilelds().get("ESTADOS") != null){ + Filter filtroEstados = new Filter(); + String[] estados = this.getMfilelds().get("ESTADOS").toString().split(","); + StringBuffer sqlEstados = new StringBuffer(" t.estado IN ("); + for (int i = 0; i < estados.length; i++) { + sqlEstados.append("'").append(estados[i]).append("'"); + if(i < estados.length - 1){ + sqlEstados.append(","); + } + } + sqlEstados.append(")"); + filtroEstados.setSql(sqlEstados.toString()); + dto.addFiltro(filtroEstados); + } + + if(this.getMfilelds().get("TIPOFABRICACION") != null){ + Filter filtroTipoFab = new Filter(); + String[] tipoFab = this.getMfilelds().get("TIPOFABRICACION").toString().split(","); + StringBuffer sqlTipoFab = new StringBuffer(" t.tipofabricacion IN ("); + for (int i = 0; i < tipoFab.length; i++) { + sqlTipoFab.append("'").append(tipoFab[i]).append("'"); + if(i < tipoFab.length - 1){ + sqlTipoFab.append(","); + } + } + sqlTipoFab.append(")"); + filtroTipoFab.setSql(sqlTipoFab.toString()); + dto.addFiltro(filtroTipoFab); + } + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public TcustPersonDetail getNuevoPropietarioArma() { + return nuevoPropietarioArma; + } + + public void setNuevoPropietarioArma(TcustPersonDetail nuevoPropietarioArma) { + this.nuevoPropietarioArma = nuevoPropietarioArma; + } + + /** + * Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findXCodigoArma(String armaCode) { + try { + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("codigoarma", armaCode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public List findArmaRecep(String csolicitud) { + try { + ArmasController cc = new ArmasController(); + cc.init(); + cc.querydatabaserecep(csolicitud); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + public void querydatabaserecep(String csolicitud) { + try { + DtoQuery dto = this.getDtoQuery(); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.put("csolicitud", csolicitud); + //QueryRule ArmasRecepcionQuery + request.put("queryalias", "ARMASRECEPLIST"); + + + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void querydatabasesimple() { + try { + DtoQuery dto = this.getDtoQuery(); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + @SuppressWarnings("unchecked") + public void querydatabaseArmaDuplicada(TarmArmas armaObj) { + try { + DtoQuery dto = this.getDtoQuery(); + + Filter filtro = new Filter(); + filtro.setSql("t.marca='"+armaObj.getMarca()+"' and t.marcacodigo='"+armaObj.getMarcacodigo()+"' and upper(t.lote)='"+ armaObj.getLote().toUpperCase()+"'"); + dto.addFiltro(filtro); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static TarmArmas findSimple(String carma) { + try { + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", carma); + cc.querydatabasesimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static Boolean isArmaDuplicada(TarmArmas armaObj) { + Boolean isDuplicada = Boolean.FALSE; + ArmasController cc; + try { + cc = new ArmasController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabaseArmaDuplicada(armaObj); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + for(TarmArmas armaTmp:cc.lrecord){ + TarmTipoArmaExplosivo tipoArmaExpTmp = TiposArmasExplosivosController.findarma(armaTmp.getCtipoarmaexplosivo()); + TgeneCatalogDetail claseTmp = CatalogDetailController.findCatalogo(tipoArmaExpTmp.getClasecodigo(), tipoArmaExpTmp.getClase()); + TgeneCatalogDetail tipoArmaTmp = CatalogDetailController.findCatalogo(tipoArmaExpTmp.getTipoarmaexplosivocodigo(), tipoArmaExpTmp.getTipoarmaexplosivo()); + TgeneCatalogDetail calibreTmp = CatalogDetailController.findCatalogo(tipoArmaExpTmp.getCalibrecodigo(), tipoArmaExpTmp.getCalibre()); + // Valido la clase, tipoarma y calibre solo para armas de fuego y armas no letales + if(claseTmp.getPk().getCatalog().equals("0010000001") || claseTmp.getPk().getCatalog().equals("0010000008")){ + if(armaObj.getModifiedData().get("clase")!=null && armaObj.getModifiedData().get("tipoarmaexplosivo")!=null){ + if(armaObj.getModifiedData().get("clase").toString().equalsIgnoreCase(claseTmp!=null?claseTmp.getDescription():"")&& + armaObj.getModifiedData().get("tipoarmaexplosivo").toString().equalsIgnoreCase(tipoArmaTmp!=null?tipoArmaTmp.getDescription():"")){ + if(armaObj.getModifiedData().get("calibre")!=null && calibreTmp!=null && armaObj.getModifiedData().get("calibre").toString().equalsIgnoreCase(calibreTmp.getDescription())){ + isDuplicada = Boolean.TRUE; + break; + } + } + }else{ + MessageHelper.setMessageError("CLASE Y/O TIPO DE ARMA EXPLOSIVO INCORRECTOS"); + } + } + } + + } + return isDuplicada; + } catch (Exception e) { + // TODO Auto-generated catch block + MessageHelper.setMessageError(e); + return null; + } + } + + + public static TarmArmas find(String carma) { + try { + + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", carma); + cc.querydatabasesimple(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if(tarmTipoArmaExplosivo!=null){ + if(tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null){ + cc.record.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getTipoarmaexplosivo() != null && tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo() != null){ + cc.record.modifiedData().put("tipo",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo())!=null? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(),tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getClase() != null && tarmTipoArmaExplosivo.getClasecodigo() != null){ + cc.record.modifiedData().put("clase",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription():""); + } + TarmRegistroArmas registroArmas = new TarmRegistroArmas(); + TcustPersonDetail detallePersona = new TcustPersonDetail(); + if(cc.record.getCregistro()!=null ){ + registroArmas = RegistroArmController.findByCodigo(String.valueOf(cc.record.getCregistro())); + if(registroArmas!=null){ + detallePersona= PersonDetailController.find(String.valueOf(registroArmas.getPersoncode())); + } + } + cc.record.modifiedData().put("razonsPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getName()); + cc.record.modifiedData().put("documentoPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getIdentification()); + cc.record.modifiedData().put("marca",(cc.record ==null || cc.record.getMarca()==null || cc.record.getMarca().isEmpty() || cc.record.getMarcacodigo()==null || cc.record.getMarcacodigo().isEmpty())?"":CatalogDetailController.findxCodigoCodcatalogo(cc.record.getMarca(), cc.record.getMarcacodigo()).getDescription()); + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Abre el lov de persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + /** + * Maneja la respuesta del Lov de Personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + + TcustPersonDetail personaDetailSelecionada = (TcustPersonDetail) event.getObject(); + razonSocial = personaDetailSelecionada.getName(); + numeroDocumento = personaDetailSelecionada.getIdentification(); + filtroPersona = " and t.cregistro in (select i.pk from TarmRegistroArmas i where i.personcode =" + + personaDetailSelecionada.getPk().getPersoncode() + ")"; + + querydatabase(); + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ArmasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ArmasController.java.svn-base new file mode 100644 index 0000000..67bae88 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ArmasController.java.svn-base @@ -0,0 +1,2325 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.apache.commons.lang3.StringUtils; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.SelectEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.common.helper.Constant; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.lov.ArmaExplosivoLovController; +import com.fp.frontend.controller.armas.parametros.CalibreLovController; +import com.fp.frontend.controller.armas.parametros.ClaseLovController; +import com.fp.frontend.controller.armas.parametros.LongitudLovController; +import com.fp.frontend.controller.armas.parametros.TipoArmaExpLovController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.frontend.utility.ValidateIdentification; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Controlador principal de armas + * @author dcruz + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ArmasController extends AbstractController { + + @ManagedProperty(value = "#{tiposArmasExplosivosController}") + private TiposArmasExplosivosController tiposArmasExplosivosController; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmas; + + /** + * Lista de tipos de identificación + */ + private List ltipoidentificacion; + /** + * Listado de estados del arma + */ + private List lestadoarma; + /** + * Listado de marcas + */ + private List lmarca; + /** + * Listado de colores + */ + private List lcolor; + /** + * Listado de tipos de fabricación + */ + private List ltipofabricacion; + /** + * Listado de unidad de medida cantidad + */ + private List lunidadmedidacantidad; + /** + * Listado de unidad medida peso + */ + private List lunidadmedidapeso; + /** + * Listado de paises + */ + private List lcountry; + /** + * Listado de provincias + */ + private List lprovincias; + /** + * Listado de cantones + */ + private List lcantones; + /** + * Listado de parroquias + */ + private List lparroquias; + /** + * Listado de ciudades + */ + private List lcities; + + /** + * Tipo documento + */ + private String tipoDoc; + + /** + * Número documento + */ + private String numDoc; + + /** + * Nombre/razón social + */ + private String nombreRazon; + + /** + * Longitud arma + */ + private String longitud; + /** + * Calibre arma + */ + private String calibre; + /** + * Clase arma + */ + private String clase; + /** + * Tipo de arma + */ + private String tipoarma; + /** + * unidad medida peso + */ + private String unidadmedidapeso; + + /** + * Bandera que indica que en realidad existe luego del ingreso de datos un tipo de arma explosivo válido + */ + private boolean existeTipoArmaExplosivo; + + /** + * Bandera que escifica que se deba verificar que exista un arma explosivo válida + */ + private boolean verificaArmaExplosivo = Boolean.TRUE; + + /** + * Bloquea la unidad de cantidad + */ + private boolean bloquearUnidadCantidad = Boolean.TRUE; + + /** + * Bloquea la unidad de peso + */ + private boolean bloquearUnidadPeso = Boolean.TRUE; + /** + * Contiene la fecha actual del sistema + */ + private Date fechaActual; + /** + * Contiene la referencia a nuevo propietario del arma + */ + private TcustPersonDetail nuevoPropietarioArma; + /** + * Tipo del arma explosivo + */ + private TarmTipoArmaExplosivo tipoArmaExplosivo ; + /** + * codigo del ruc + */ + private String codigoRuc; + /** + * codigo del ruc + */ + private String codigoCedula; + /** + * codigo del ruc + */ + private String codigoPasaporte; + + + private String razonSocial; + + private String numeroDocumento; + + private String filtroPersona; + + private TsafeUserDetail userDetail; + /** + * Variable que nos permite cargar el documento al Alfresco + */ + private UploadedFile uploadedFile; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + public ArmasController() throws Exception { + super(TarmArmas.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + fechaActual = new Date(); + recperpage = 15; // Cambiar al # reg a mirar. +// record = new TarmArmas(); + lrecord = new ArrayList<>(); + beanalias = "ARMAS"; + ltipoidentificacion = CatalogDetailController.find("IDENTIFICATION"); + lestadoarma = CatalogDetailController.find("ESTADOARMA"); + //remover el estado bloqueado + Listlistaremover= new ArrayList<>(); + for (TgeneCatalogDetail item : lestadoarma) { + if(item.getPk().getCatalog().equals("BLOQ")){ + listaremover.add(item); + } + } + lestadoarma.removeAll(listaremover); + + lmarca = CatalogDetailController.find("MARCA"); + lcolor = CatalogDetailController.find("COLOR"); + ltipofabricacion = CatalogDetailController.find("TIPOFABRICACION"); +// lunidadmedidacantidad = CatalogDetailController.find("UCANTIDAD"); + lunidadmedidapeso = CatalogDetailController.find("UNIDADMEDIDA"); + lcountry = CountryController.find(); + codigoRuc=codigos("CODIGO.RUC"); + codigoCedula=codigos("CODIGO.CEDULA"); + codigoPasaporte=codigos("CODIGO.PASAPORTE"); + filtroPersona = ""; + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + String sqlFiltroPersona = ""; + String sqlFiltroSancion = ""; + String sqlFiltroEstados = ""; + String sqlFiltroTipoFabricacion = ""; + String sqlFiltroClaseArmas = ""; +// String sqlFiltroFechaCaducidad = ""; + String sqlFiltroValidacionArma = "";//si entre los estados existe renovacion entonces validamos que no pueda seleccionar las mismas armas + if(this.getMfilelds().get("personcode") != null){ + sqlFiltroPersona = " t.cregistro in (SELECT c.pk FROM TarmRegistroArmas c WHERE c.personcode="+this.getMfilelds().get("personcode")+")"; + } + //agregamos los filtros en base a la consideracion del field sancion, en caso de que lo sea buscamos los sancionados que hayan cumplido el tiempo de sancion + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + if(this.getMfilelds().containsKey("sancion") && this.getMfilelds().get("sancion").toString().equals(Constant.STR_Y)){ + sqlFiltroSancion = " t.pk in (SELECT max(a.pk) FROM TarmArmas a WHERE a.codigoarma in (SELECT distinct(h.codigoarma) from TarmDocumentoHabilitante h WHERE h.pk in (SELECT d.cdocumento FROM TarmSancionDecomiso d WHERE d.personcode="+this.getMfilelds().get("personcode")+" AND d.fechafinal < TO_DATE('"+dateFormat.format(Calendar.getInstance().getTime())+"', 'YYYY-MM-DD'))) GROUP BY a.codigoarma)"; + } + + dto.setOrderby("pk"); + if(this.getMfilelds().get("ESTADOS") != null){ + String[] estados = this.getMfilelds().get("ESTADOS").toString().split(","); + StringBuffer sqlEstados = new StringBuffer(" t.estado IN ("); + for (int i = 0; i < estados.length; i++) { + sqlEstados.append("'").append(estados[i]).append("'"); + if(i < estados.length - 1){ + sqlEstados.append(","); + } + } + sqlEstados.append(")"); + sqlFiltroEstados = sqlEstados.toString(); + } + + if(this.getMfilelds().get("TIPOFABRICACION") != null){ + String[] tipoFabricacion = this.getMfilelds().get("TIPOFABRICACION").toString().split(","); + StringBuffer sqlTipoFabricacion = new StringBuffer(" t.tipofabricacion IN ("); + for (int i = 0; i < tipoFabricacion.length; i++) { + sqlTipoFabricacion.append("'").append(tipoFabricacion[i]).append("'"); + if(i < tipoFabricacion.length - 1){ + sqlTipoFabricacion.append(","); + } + } + sqlTipoFabricacion.append(")"); + sqlFiltroTipoFabricacion = sqlTipoFabricacion.toString(); + } + + if(this.getMfilelds().get("TRAMITE") != null){ + TarmTramite tarmTramite = (TarmTramite) this.getMfilelds().get("TRAMITE"); + sqlFiltroValidacionArma = "t.pk not in (SELECT coalesce(max(a.pk),'-1') FROM TarmArmas a WHERE a.codigoarma in (SELECT distinct(h.codigoarma) from TarmDocumentoHabilitante h WHERE h.personcode="+this.getMfilelds().get("personcode")+" AND h.ctramite="+tarmTramite.getPk()+" AND h.estado = 'APR' AND trunc(h.fechaexpiracion) >= " + "TO_DATE('" +dateFormat.format(Calendar.getInstance().getTime())+ "','yyyy-MM-dd')) GROUP BY a.codigoarma)"; + } + //estados del armas + if(this.getMfilelds().get("CLASEARMAS") != null){ + String[] clasesarma = this.getMfilelds().get("CLASEARMAS").toString().split(","); + StringBuffer sqlclasesarmas = new StringBuffer(" t.ctipoarmaexplosivo IN (select o.pk from TarmTipoArmaExplosivo o where o.clase in("); + for (int i = 0; i < clasesarma.length; i++) { + sqlclasesarmas.append("'").append(clasesarma[i]).append("'"); + if(i < clasesarma.length - 1){ + sqlclasesarmas.append(","); + } + } + sqlclasesarmas.append(")) "); + sqlFiltroClaseArmas = sqlclasesarmas.toString(); + } + +// if(this.getMfilelds().get("FECHACADUCIDADARM") != null){ +// sqlFiltroFechaCaducidad="t.fechacaducidad "+this.getMfilelds().get("FECHACADUCIDADARM"); +// } + String sqlActual = ""; + if(this.getMfilelds().get("personcode")==null){ + sqlActual = " t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma) " + + " and t.estado !='DEST' and t.estado!='VEND' and t.estado!='MING' and t.estado!='DUPL' and t.estado!='CUSTEM' and t.estado!='BLOQ'" + + " and (t.peso>0 or t.cantidad>0)";//distintas de destruidas y cambio de propietario and t.cregistro=ta.cregistro para el manejo de los explosivos + }else{ + sqlActual = " t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) " + + " and t.estado !='DEST' and t.estado!='VEND' and t.estado!='MING' and t.estado!='DUPL' and t.estado!='CUSTEM' and t.estado!='BLOQ'" + + " and (t.peso>0 or t.cantidad>0)";//distintas de destruidas y cambio de propietario and t.cregistro=ta.cregistro para el manejo de los explosivos + } + + sqlActual=sqlActual+ filtroPersona; + +// String sqlFinal = obtenerFiltroBusquedaGeneral(sqlFiltroPersona, sqlFiltroEstados, sqlFiltroSancion, sqlFiltroValidacionArma,sqlFiltroClaseArmas,sqlFiltroFechaCaducidad, sqlActual); + String sqlFinal = obtenerFiltroBusquedaGeneral(sqlFiltroPersona, sqlFiltroEstados,sqlFiltroTipoFabricacion, sqlFiltroSancion, sqlFiltroValidacionArma,sqlFiltroClaseArmas,sqlActual); + Filter filtroFinal = new Filter(); + sqlFinal= sqlFinal+ " and t.estadoventa is null "; + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private String obtenerFiltroBusquedaGeneral(String... sqlFiltros ){ + StringBuffer sqlFinal = new StringBuffer(); + for (int i = 0; i < sqlFiltros.length ; i++) { + if(sqlFinal.length() > 0 && !StringUtils.endsWith(StringUtils.trim(sqlFinal.toString()), "AND")){ + sqlFinal.append( " AND "); + } + sqlFinal.append(sqlFiltros[i]); + } + return sqlFinal.toString(); + } + + @SuppressWarnings("unchecked") + public void querydatabaseSinFiltros() { + try { + DtoQuery dto = this.getDtoQuery(); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql=" t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() throws Exception { + // TODO Auto-generated method stub + super.next(); + } + + @SuppressWarnings("unchecked") + protected void querydatabasePorCodigo() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql=" t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception{ + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryTipoFab= new SubQuery("TgeneCatalogDetail","description","tipofabricacion","i.pk.catalog=t.tipofabricacion and i.pk.catalogcode='TIPOFABRICACION'"); + dto.addSubQuery(subqueryTipoFab); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TarmTipoArmaExplosivo","clase","cclase","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo= new SubQuery("TarmTipoArmaExplosivo","clasecodigo","cclasecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud= new SubQuery("TarmTipoArmaExplosivo","longitud","clongitud","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo= new SubQuery("TarmTipoArmaExplosivo","longitudcodigo","clongitudcodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ccalibre","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo= new SubQuery("TarmTipoArmaExplosivo","calibrecodigo","ccalibrecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivo","ctipoarmaexplosivo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivocodigo","ctipoarmaexplosivocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapeso","cunidadmedidapeso","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadTipo= new SubQuery("TgeneCatalogDetail","description","unidadmedidadesc","i.pk.catalog= (select o.unidadmedidapeso from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryUnidadTipo); + SubQuery subqueryUnidadCodigo= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapesocodigo","cunidadmedidapesocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida= new SubQuery("TgeneCatalogDetail","description","unidadmedida","i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode= new SubQuery("TarmRegistroArmas","personcode","personcode","i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + SubQuery subqueryTipo= new SubQuery("TgeneCatalogDetail","description","tipo","i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipo); + SubQuery subqueryTipoArmaExplosivo= new SubQuery("TgeneCatalogDetail","description","tipoarmaexplosivo","i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + SubQuery subqueryClasecatalogo= new SubQuery("TgeneCatalogDetail","description","clase","i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClasecatalogo); + + return dto; + } + + @SuppressWarnings("unchecked") + protected void querydatabaseSimple() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql=" t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + public void save() { + try { + this.registroArmas.update(); + DtoSave dtoSaveRegistro = registroArmas.getDtoSave(); + dtoSaveRegistro.setIsForm(Boolean.TRUE); + dtoSaveRegistro.setReturnpk(Boolean.TRUE); + dtoSaveRegistro.setPosition(1); + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(Boolean.TRUE); // Para que el core devuelva el pk de los registros nuevos. + dtosave.setPosition(2); + HashMap msave = new HashMap(); + msave.put(registroArmas.getBeanalias(), dtoSaveRegistro); + msave.put(beanalias, dtosave); + + Request request = callerhelper.getRequest(); + request.put("TIPODOC", tipoDoc); + request.put("NUMDOC", numDoc); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + querydatabase(); + } + + public void saveFile() { + try { + DtoSave dtosave = super.getDtoSave(); + HashMap msave = new HashMap(); + msave.put(beanalias, dtosave); + Request request = callerhelper.getRequest(); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + querydatabase(); + } + + public void saveArmaSolicitud() { + try { + + if(!isArmaDuplicada(record)){ + + record.getModifiedData().put("edit", "S"); + + this.registroArmas.update(); + update(); + if(!existeTipoArmaExplosivo){ + return; + } + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(Boolean.TRUE); // Para que el core devuelva el pk de los registros nuevos. + dtosave.setPosition(2); + HashMap msave = new HashMap(); + DtoSave dtoSaveRegistro = registroArmas.getDtoSave(); + dtoSaveRegistro.setIsForm(Boolean.TRUE); + dtoSaveRegistro.setReturnpk(Boolean.TRUE); + dtoSaveRegistro.setPosition(1); + + Request request = callerhelper.getRequest(); + request.setTransactionModule("30"); + request.setTransactionCode(15); + request.setTransactionVersion(1); + if(!verificaArmaExplosivo){ + request.put("eseliminacion", Constant.STR_Y); + }else{ + msave.put(registroArmas.getBeanalias(), dtoSaveRegistro); + } + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.put("TIPODOC", this.getMfilelds().get("tipodoc")); + request.put("NUMDOC", this.getMfilelds().get("numdoc")); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.registroArmas.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + }else{ + record= null; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_armaDuplicada")); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void update() throws Exception { + TgeneCatalogDetail estado = CatalogDetailController.findxCodigoCodcatalogo(record.getEstado(), record.getEstadocodigo()); + TgeneCatalogDetail marca = CatalogDetailController.findxCodigoCodcatalogo(record.getMarca(), record.getMarcacodigo()); + record.getModifiedData().put("estado", estado.getDescription()); + record.getModifiedData().put("marca", marca.getDescription()); + for(TgeneCatalogDetail color:lcolor){ + if(record.getColor()!=null && record.getColor().equals(color.getPk().getCatalog())){ + record.getModifiedData().put("color", color.getDescription()); + break; + } + } + if(verificaArmaExplosivo){ + if(tipoArmaExplosivo == null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionClase")); + existeTipoArmaExplosivo = Boolean.FALSE; + return; + }else{ + this.record.setCtipoarmaexplosivo(tipoArmaExplosivo.getPk()); + existeTipoArmaExplosivo = Boolean.TRUE; + } + } + //valida si el estado es de perdida robo para obligar el adjuntar + if((record.getEstado()!=null && record.getEstado().equals("RPER")) || + (record.getPk()==null)){ + String xPathLocation=""; + if(record.getEstado()!=null && record.getEstado().equals("RPER")){ + xPathLocation= getRutaDocumentoSolBase("PerdidaRobo") + "/cm:"+record.getEstado()+"-" +this.record.getCodigoarma() ; + }else{ + xPathLocation= getRutaDocumentoSolBase("Crear") +"/cm:"+record.getEstado()+"-" +this.numDoc ; + } + if(uploadedFile!=null && uploadedFile.getFileName()!=null){ + String extencionArchivo=getExtension(uploadedFile.getFileName()); + String nombreArchivo = record.getEstado()+"-"+(this.record.getPk()!=null?this.record.getPk():"NUEVA")+"."+extencionArchivo; + if(alfrescoController.uploadFile(uploadedFile.getInputstream(),nombreArchivo, xPathLocation)){ + String pathRuta=xPathLocation + "/cm:" + nombreArchivo; + this.record.setPathDocumento(pathRuta); + uploadedFile=null; + }else{ + MessageHelper.setMessageError("Adjunte el documento"); + return; + } + }else{ + MessageHelper.setMessageError("Adjunte el documento"); + return; + } + } + + super.update(); + } + + /* + * Metodo que retorna la extencion del documento que se desea subir al alfresco + */ + public String getExtension(String filename) { + int index = filename.lastIndexOf('.'); + if (index == -1) { + return ""; + } else { + return filename.substring(index + 1); + } + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase(String carpeta) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta = new StringBuilder("cm:Registro"); + ruta = ruta.append("/cm:"+carpeta); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + ruta = ruta.append("/cm:D-").append(calendar.get(Calendar.DAY_OF_WEEK)); + return ruta.toString(); + } + public void updateAutorizacion()throws Exception { + super.update(); + } + + /** + * Método que se ejecuta al carga edición + * @throws Exception + */ + public void loadEdit() throws Exception { + verificaArmaExplosivo = Boolean.TRUE; + if(record.getCountrycode() == null){ + record.setCountrycode("EC"); + } + if(record.getCtipoarmaexplosivo()==null){ + MessageHelper.setMessageError("NO ESTA ASOCIADO A UN TIPO DE ARMA EXPLOSIVO"); + return; + } + tipoArmaExplosivo= TiposArmasExplosivosController.findarma(record.getCtipoarmaexplosivo()); + lprovincias = ProvinceController.find(record.getCountrycode()); + executeProvince(); + if(record.getProvincecode() != null){ + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + executeCanton(); + } + completaInfTipoArma(); + // Anade la descripcion del tipo de arma explosivo + if(tipoArmaExplosivo!=null){ + if(this.tipoArmaExplosivo.getClase().equals("0010000003") || this.tipoArmaExplosivo.getClase().equals("0010000005") || this.tipoArmaExplosivo.getClase().equals("0010000007") || this.tipoArmaExplosivo.getClase().equals("0010000006")){ + this.record.getModifiedData().put("unidadMedidaCantidad", null); + this.record.getModifiedData().put("unidadMedidaPeso", tipoArmaExplosivo.getModifiedData().get("nunidadMedidaPeso")); + }else if(this.tipoArmaExplosivo.getClase().equals("0010000001") || this.tipoArmaExplosivo.getClase().equals("0010000002") || this.tipoArmaExplosivo.getClase().equals("0010000004") || this.tipoArmaExplosivo.getClase().equals("0010000008")){ + this.record.getModifiedData().put("unidadMedidaCantidad", tipoArmaExplosivo.getModifiedData().get("nunidadMedidaPeso")); + this.record.getModifiedData().put("unidadMedidaPeso", null); + } + } + verificarClaseArma(); + registroArmas.clearAll(); + registroArmas.addFilter("pk", record.getCregistro().toString()); + registroArmas.query(); + List registroArmasList = registroArmas.getLrecord(); + registroArmas.setRecord(registroArmasList.get(0)); + registroArmas.getRecord().setIsnew(Boolean.FALSE); + TcustPersonDetail tcustPersonDetail = PersonDetailController.find(registroArmas.getRecord().getPersoncode().toString()); + tipoDoc = tcustPersonDetail.getIdentificationcatalog(); + numDoc = tcustPersonDetail.getIdentification(); + nombreRazon = tcustPersonDetail.getName(); + } + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en el Alfresco + */ + public void handleUpload(FileUploadEvent event){ + uploadedFile = event.getFile(); + } + + /** + * Recorta el nombre del archivo a cargarse + * @param nombre + * @return nombre recortado + */ + public String recorteNombre(String nombre){ + String fielname=nombre; + if(fielname.length()>30){ + fielname=fielname.substring(0,30)+extencionArchivo(nombre); + } + return fielname; + } + /** + * Obtiene la extencion del archivo a cargar + * @param nombre + * @return + */ + private String extencionArchivo(String nombre){ + int pos=nombre.lastIndexOf('.'); + nombre=nombre.substring(pos); + return nombre; + } + /** + * Método que completa la informaci´n del arma una vez se presiona el botón crear + */ + private void completaInfTipoArma(){ + TarmArmas recordArma = findPorCodigo(record.getPk()); + record.setCountrycode("EC"); + clase = record.getModifiedData().get("clase") != null ? recordArma.getModifiedData().get("clase").toString() : null; + calibre = record.getModifiedData().get("ccalibre") != null ? Utilidades.formatearDecimalesEnTexto((recordArma.getModifiedData().get("ccalibre").toString()).replace("null", ""), "#.00") : null; + longitud = record.getModifiedData().get("clongitud") != null ? recordArma.getModifiedData().get("clongitud").toString() : null; + tipoarma = record.getModifiedData().get("ctipoarmaexplosivo") != null ? recordArma.getModifiedData().get("ctipoarmaexplosivo").toString() : null; + } + + @Override + public void create() throws Exception { + super.create(); + this.tipoDoc = null; + this.numDoc = null; + this.nombreRazon = null; + this.verificaArmaExplosivo = Boolean.TRUE; + this.registroArmas.create(); + this.registroArmas.setLrecord(new ArrayList()); + this.record.setCountrycode("EC"); +// this.record.setEstado("REG"); + this.record.setEstado("PREG"); + this.record.setEstadocodigo("ESTADOARMA"); + this.record.setMarcacodigo("MARCA"); + this.record.setGeneracertificado("NO"); + this.lprovincias = ProvinceController.find(record.getCountrycode()); + this.executeProvince(); + } + + public void update(TarmArmas bean) throws Exception { + record=bean; + updateAutorizacion(); + } + + public void validacionDocumento(String numeroDocumento, String tipoDocumento){ + if(numeroDocumento==null || tipoDocumento==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselacedula")); + return; + } + TcustPersonDetail tcustPersonDetail=null; + if(tipoDocumento.equals(codigoCedula)){ +//----------validamos si es valida la CEDULA + if(!ValidateIdentification.cedula(numeroDocumento)){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en MAIA + tcustPersonDetail=buscarPersonaMaia(numeroDocumento,tipoDocumento); + }else if(tipoDocumento.equals(codigoRuc)){ +//----------validamos si es valida el RUC + if(!ValidateIdentification.ruc(numeroDocumento)){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en maia + tcustPersonDetail=buscarPersonaMaia(numeroDocumento,tipoDocumento); + }else{ +//----------si es PASAPORTE + tcustPersonDetail=buscarPersonaMaia(numeroDocumento,tipoDocumento); + } + if(tcustPersonDetail==null){ + nombreRazon=null; + numDoc=null; + MessageHelper.setMessageError("La datos de la persona ingresada no existen, por favor crear primero la persona"); + return; + }else{ + nombreRazon=tcustPersonDetail.getName(); + } + } + + /** Método para validar si la persona existe en la BD de Maia + * @param numeroDocumento + * @param tipoDocumento + * @return TcustPersonDetail + */ + public TcustPersonDetail buscarPersonaMaia(String numeroDocumento, String tipoDocumento){ + return PersonDetailController.findxidentification(numeroDocumento,tipoDocumento); + } + /** + * Busca un arma por código y estado + * @param armaCode código del arma + * @param estado estado del arma + * @return + */ + public static TarmArmas find(String armaCode,String estado) { + try { + + if(armaCode==null){ + return null; + } + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + if(estado!=null){ + cc.addFilter("estado", estado); + cc.addFilter("estadocodigo", "ESTADOARMA"); + } + cc.querydatabaseArmas(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = new TarmTipoArmaExplosivo(); + tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if(tarmTipoArmaExplosivo!=null && tarmTipoArmaExplosivo.getCalibrecodigo()!=null) + cc.record.modifiedData().put("calibre",tarmTipoArmaExplosivo==null?"":Utilidades.formatearDecimalesEnTexto((CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription()), "#.000")); + cc.record.modifiedData().put("tipo",tarmTipoArmaExplosivo==null?"":CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription()); + cc.record.modifiedData().put("clase",tarmTipoArmaExplosivo==null?"":CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription()); + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + cc.record.modifiedData().put("pais", cc.record.getCpaisorigen()==null?"":CountryController.findcountry(cc.record.getCpaisorigen()).getDescription()); + + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * + * @param codigopersona + * @return + */ + public static TarmArmas findBySerieMarca(String serie, String marca) { + try { + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + if(serie!=null && !serie.isEmpty()){ + cc.addFilter("lote", serie); + } + cc.addFilter("marca", marca); + cc.querydatabaseSimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findByPK(String cArma) { + try { + + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", cArma); + cc.querydatabaseSinFiltros(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + cc.record=cc.lrecord.get(0); + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if(tarmTipoArmaExplosivo!=null){ + if(tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null){ + cc.record.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getTipoarmaexplosivo() != null && tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo() != null){ + cc.record.modifiedData().put("tipo",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo())!=null? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(),tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getClase() != null && tarmTipoArmaExplosivo.getClasecodigo() != null){ + cc.record.modifiedData().put("clase",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription():""); + } + + TarmRegistroArmas registroArmas = new TarmRegistroArmas(); + TcustPersonDetail detallePersona = new TcustPersonDetail(); + if(cc.record.getCregistro()!=null ){ + registroArmas = RegistroArmController.findByCodigo(String.valueOf(cc.record.getCregistro())); + if(registroArmas!=null){ + detallePersona= PersonDetailController.find(String.valueOf(registroArmas.getPersoncode())); + } + } + cc.record.modifiedData().put("razonsPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getName()); + cc.record.modifiedData().put("documentoPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getIdentification()); + + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findPorCodigo(String armaCode) { + try { + + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + //cc.addFilter("REG", "ESTADOARMA"); + cc.querydatabaseArmas(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if(tarmTipoArmaExplosivo!=null){ + if(tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null){ + cc.record.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getTipoarmaexplosivo() != null && tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo() != null){ + cc.record.modifiedData().put("tipo",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo())!=null? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(),tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getClase() != null && tarmTipoArmaExplosivo.getClasecodigo() != null){ + cc.record.modifiedData().put("clase",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription():""); + } + + TarmRegistroArmas registroArmas = new TarmRegistroArmas(); + TcustPersonDetail detallePersona = new TcustPersonDetail(); + if(cc.record.getCregistro()!=null ){ + registroArmas = RegistroArmController.findByCodigo(String.valueOf(cc.record.getCregistro())); + if(registroArmas!=null){ + detallePersona= PersonDetailController.find(String.valueOf(registroArmas.getPersoncode())); + } + } + cc.record.modifiedData().put("razonsPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getName()); + cc.record.modifiedData().put("documentoPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getIdentification()); + cc.record.modifiedData().put("marca",(cc.record ==null || cc.record.getMarca()==null || cc.record.getMarca().isEmpty() || cc.record.getMarcacodigo()==null || cc.record.getMarcacodigo().isEmpty())?"":CatalogDetailController.findxCodigoCodcatalogo(cc.record.getMarca(), cc.record.getMarcacodigo()).getDescription()); + + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findXCodigo(String armaCode) { + try { + + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + //cc.addFilter("REG", "ESTADOARMA"); + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + lcities = CityController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + } + } + + + /** + * + * + * @param personCode + * @param estados estados del arma separados por coma + * @param tipoFab tipos de fabricacion del arma separados por coma + * @return Una lista de Armas encontradas + */ + public List findxPersona(Long personCode, String estados, String tipoFab, String clase, String fechaCaducidad) { + List armasLista = null; + try { + armasLista = new ArrayList(); + ArmasController armas = new ArmasController(); + armas.init(); + armas.recperpage = 4000; + armas.addField("personcode", personCode); + if(this.getMfilelds().get("sancion") != null){ + armas.addField("sancion", this.getMfilelds().get("sancion")); + } + if(this.getMfilelds().get("TRAMITE") != null){ + armas.addField("TRAMITE", this.getMfilelds().get("TRAMITE")); + } + if(estados == null){ + armas.addFilter("estado", "REG"); + } else{ + armas.addField("ESTADOS", estados); + } + if(tipoFab != null && tipoFab .trim().length()>0){ + armas.addField("TIPOFABRICACION", tipoFab); + } + if(clase != null && clase .trim().length()>0){ + armas.addField("CLASEARMAS", clase); + } +// if(fechaCaducidad != null && fechaCaducidad .trim().length()>0){ +// armas.addField("FECHACADUCIDADARM", fechaCaducidad); +// } + armas.query(); + if(armas.getLrecord() != null && !armas.getLrecord().isEmpty()){ + armasLista.addAll(armas.getLrecord()); + } + + return armasLista; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return armasLista; + } + } + + + /** + * Lista de Armas por Registro + **/ + public static List findxRegistro(String registrocode) { + try { + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("cregistro", registrocode); + + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + for(TarmArmas item : cc.lrecord){ + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(item.getCtipoarmaexplosivo()); + item.modifiedData().put("clase",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription()); + if(tarmTipoArmaExplosivo.getLongitud()!=null && tarmTipoArmaExplosivo.getLongitudcodigo()!=null){ + item.modifiedData().put("longitud",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getLongitud(), tarmTipoArmaExplosivo.getLongitudcodigo()).getDescription()); + } + item.modifiedData().put("tipo",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription()); + if(tarmTipoArmaExplosivo.getCalibre()!=null && tarmTipoArmaExplosivo.getCalibrecodigo()!=null){ + item.modifiedData().put("calibre",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription()); + } + item.modifiedData().put("unidadMedidaCantidad",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getUnidadmedidapeso(), tarmTipoArmaExplosivo.getUnidadmedidapesocodigo()).getDescription()); + } + + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Abre el LOV de la clase del arma + */ + public void openLovClase() { + Map> params = new HashMap>(); + ClaseLovController.openLov(params); + } + + /** + * Regresa del LOV de armas + * @param event + */ + public void onReturnClase(SelectEvent event) { + TgeneCatalogDetail clase = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("clase", clase.getDescription()); + this.clase = clase.getPk().getCatalog(); + this.verificarClaseArma(); + } + + /** + * Abre el LOV de la clase del arma + */ + public void openArmaExplosivoLov() { + this.record.getModifiedData().put("longitud", null); + this.record.getModifiedData().put("tipoarmaexplosivo", null); + this.record.getModifiedData().put("calibre", null); + record.setCantidad(null); +// descripcionUnidadpeso=null; + Map> params = new HashMap<>(); + ArmaExplosivoLovController.openLov(params); + } + + /** + * Regresa del LOV de armas + * @param event + */ + public void onReturnArmaExplosivo(SelectEvent event) { + tipoArmaExplosivo = (TarmTipoArmaExplosivo) event.getObject(); + //Setear descripciones a presentarse + this.record.getModifiedData().put("clase", tipoArmaExplosivo.getModifiedData().get("nclase")); + this.record.getModifiedData().put("tipoarmaexplosivo", tipoArmaExplosivo.getModifiedData().get("ntipo")); + this.record.getModifiedData().put("longitud", tipoArmaExplosivo.getModifiedData().get("nlongitud")); + this.record.getModifiedData().put("calibre", tipoArmaExplosivo.getModifiedData().get("ncalibre")); + // Setear valores en las variables correspondientes + if(tipoArmaExplosivo!=null){ + this.clase = tipoArmaExplosivo.getClase(); + this.longitud = tipoArmaExplosivo.getLongitud(); + this.tipoarma = tipoArmaExplosivo.getTipoarmaexplosivo(); + this.calibre = tipoArmaExplosivo.getCalibre(); + this.record.setUnidadmedidacantidad(tipoArmaExplosivo.getUnidadmedidapeso()); + if(tipoArmaExplosivo.getModifiedData().get("desunidad")!=null){ + if(this.clase.equals("0010000003") || this.clase.equals("0010000005") || this.clase.equals("0010000007") || this.clase.equals("0010000006")){ + this.record.getModifiedData().put("unidadMedidaCantidad", null); + this.record.getModifiedData().put("unidadMedidaPeso", tipoArmaExplosivo.getModifiedData().get("desunidad")); + }else if(this.clase.equals("0010000001") || this.clase.equals("0010000002") || this.clase.equals("0010000004") || this.clase.equals("0010000008")){ + this.record.getModifiedData().put("unidadMedidaCantidad", tipoArmaExplosivo.getModifiedData().get("desunidad")); + this.record.getModifiedData().put("unidadMedidaPeso", null); + } + } + } + this.verificarClaseArma(); + if(this.clase.equals("0010000001")||this.clase.equals("0010000008")){ + record.setCantidad(1);//si es arma de fuego por default sea uno y no deje editar + this.bloquearUnidadCantidad = Boolean.TRUE; + } +// else{ +// record.setCantidad(null); +// } + } + + /** + * Método en el cual se determina si se bloquea unidad o cantidad al momento de cargar los datos del arma + * @param clase + */ + private void verificarClaseArma(){ + if(this.clase==null){ + this.bloquearUnidadPeso = Boolean.TRUE; + this.bloquearUnidadCantidad = Boolean.TRUE; + return; + } + + if( this.clase.equals("0010000003") || this.clase.equals("0010000005") || this.clase.equals("0010000007") || this.clase.equals("0010000006")){ + this.bloquearUnidadPeso = Boolean.FALSE; + } else{ + this.bloquearUnidadPeso = Boolean.TRUE; + } + if(this.clase.equals("0010000001") || this.clase.equals("0010000002") || this.clase.equals("0010000004")){ + this.bloquearUnidadCantidad = Boolean.FALSE; + } else{ + this.bloquearUnidadCantidad = Boolean.TRUE; + } + } + + /** + * Abre el LOV de la longitud del arma + */ + public void openLovLongitud() { + Map> params = new HashMap>(); + LongitudLovController.openLov(params); + } + + /** + * Regresa del LOV de longitud + * @param event + */ + public void onReturnLongitud(SelectEvent event) { + TgeneCatalogDetail longitud = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("longitud", longitud.getDescription()); + this.longitud = longitud.getPk().getCatalog(); + } + + /** + * Abre el LOV del tipo de arma + */ + public void openLovTipoArma() { + Map> params = new HashMap>(); + TipoArmaExpLovController.openLov(params); + } + + /** + * Regresa del LOV de tipo de arma + * @param event + */ + public void onReturnTipoArma(SelectEvent event) { + TgeneCatalogDetail tipoArma = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("tipoarmaexplosivo", tipoArma.getDescription()); + this.tipoarma = tipoArma.getPk().getCatalog(); + } + + /** + * Abre el LOV de Calibre + */ + public void openLovCalibre() { + Map> params = new HashMap>(); + CalibreLovController.openLov(params); + } + + /** + * Regresa del LOV del calibre + * @param event + */ + public void onReturnCalibre(SelectEvent event) { + TgeneCatalogDetail calibre = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("calibre", calibre.getDescription()); + this.calibre = calibre.getPk().getCatalog(); + } + + /** + * Abre el LOV cambio de usuario + */ + public void openLovCambioUsuario() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Acción de retorno de la selección del usuario + * @param event de retorno de la selección + */ + public void onReturnCambioUsuario(SelectEvent event) { + nuevoPropietarioArma = (TcustPersonDetail) event.getObject(); + } + + /** + * Abre el dialog del cambio de persona + */ + public void abrirDialogCambio() { + this.nuevoPropietarioArma = null; + } + + /** + * Se cambia el propietario del arma + */ + public void cambiarArmaUsuario() { + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.setTransactionModule("30"); + request.setTransactionCode(151); + request.setTransactionVersion(1); + request.put("ARMAACTUAL", this.record); + request.put("NUEVAPERSONA", this.nuevoPropietarioArma); + Response response = callerHelper.executeSave(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + MessageHelper.setMessageInfo(response); + this.querydatabase(); + } else{ + MessageHelper.setMessageError(response); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if(Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")){ + valorColocar = Boolean.TRUE; + } + for (TarmArmas guardias : lrecord) { + guardias.getModifiedData().put("seleccionado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Metodo para obtener el listado de las armas por la serie/lote + * @param serieLote + * @return + */ + public static List findxSerieLote(String serieLote) { + try { + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 1000; + cc.addFilter("lote", serieLote); + cc.querydatabaseFechaMax(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para obtener el listado de las armas por la lote + * @param serieLote + * @return + */ + public static List findPorLote(String lote) { + try { + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 10000; + cc.addFilter("lote", lote); + cc.querydatabaseArmas(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para obtener los codigos + */ + private static String codigos(String parametro){ + TgeneParameters tgeneParameters= ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + @SuppressWarnings("unchecked") + protected void querydatabaseFechaMax() { + try { + DtoQuery dto = this.getDtoQuery(); + dto.setOrderby("pk"); + String codigoEstadoIncautada=codigos("CODIGO.INCAUTADA"); + String codigoEstadoDecomisada=codigos("CODIGO.DECOMISADA"); + String codigoEstadoVendida=codigos("CODIGO.VENDIDA"); + String codigoEstadoMatPrima=codigos("CODIGO.MATERIAPRIMA"); + Filter filtro = new Filter(); + String sql="t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro)"//and t.cregistro=ta.cregistro para el manejo de los explosivos + + " and t.estado !='DEST' and t.estado !='CDP' and t.estado !='"+codigoEstadoIncautada+"' and t.estado !='"+codigoEstadoDecomisada+"' and t.estado !='"+codigoEstadoVendida+"' and t.estado !='"+codigoEstadoMatPrima+"' "; + filtro.setSql(sql); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void actualizar(TarmArmas arma) throws Exception{ + record=arma; + super.update(); + } + + /*Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findxCodigo(String armaCode) { + try { + + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + cc.querydatabaseArmas(); + cc.getRecord().getModifiedData().put("lmarca", cc.getLmarca()); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * @param lote + * @return + */ + public static List findxLotePerdidaRobo(String lote) { + List armasLista = null; + try { + armasLista = new ArrayList(); + ArmasController armas = new ArmasController(); + armas.init(); + armas.recperpage = 4000; + armas.addFilter("lote", lote);//("personcode", personCode); + armas.querydatabaseArmaVenta(" and t.pathDocumento like '%/cm:PerdidaRobo/%'"); + if(armas.getLrecord() != null && !armas.getLrecord().isEmpty()){ + armasLista.addAll(armas.getLrecord()); + } + return armasLista; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return armasLista; + } + } + + /** + * @param lote + * @return + */ + public static List findxLoteRegistro(String lote) { + List armasLista = null; + try { + armasLista = new ArrayList(); + ArmasController armas = new ArmasController(); + armas.init(); + armas.recperpage = 4000; + armas.addFilter("lote", lote);//("personcode", personCode); + armas.querydatabaseArmaVenta(" and t.pathDocumento like '%/cm:Crear/%'"); + if(armas.getLrecord() != null && !armas.getLrecord().isEmpty()){ + armasLista.addAll(armas.getLrecord()); + } + return armasLista; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return armasLista; + } + } + + @SuppressWarnings("unchecked") +protected void querydatabaseArmaVenta(String crear) { + try { + DtoQuery dto = this.getDtoQuery(); + dto.setOrderby("pk"); + String sqlFinal = " t.pathDocumento is not null "+crear; + Filter filtroFinal = new Filter(); + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + + public void generarReporte(TarmArmas arma) { + String path = "armas/reports/certificadoArmaCrear"; + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda","repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + try { + // Usuario logueado en la aplicacion + String nombreUsuario; + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + } else { + nombreUsuario = ""; + } + parameters.put("filtro", arma.getPk()); + parameters.put("usuario", nombreUsuario); + //Fecha actual + Calendar fechaActualCldr = Calendar.getInstance(); + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH)+1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarfecha", fechaActualSB.toString()); + + String format = "pdf"; + String filename = "certificadoArma"; + + InputStream inputStream = this.reportController.jaspertoInputstream(path,parameters, format, filename, this.getLoginController()); + + String nombreArchivo = (filename!=null && !filename.isEmpty()) ? filename+"."+format : null; + String xPathLocation= getRutaDocumentoSolBase()+"/cm:"+arma.getEstado() + "/cm:CP-" + arma.getModifiedData().get("personcode") + "/cm:CA-" + arma.getCodigoarma() ; + if (nombreArchivo != null && xPathLocation != null && inputStream != null) { + setRecord(arma); + if (alfrescoController.uploadFile(inputStream, nombreArchivo, xPathLocation)) { + record.setPathDocumentocrear(xPathLocation + "/cm:" + nombreArchivo); + record.setGeneracertificado("SI"); + super.update(); + saveFile(); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_subiroarchivoregistrorecibo").concat("("+nombreArchivo+")")); + + } + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase() { + Calendar calendar = Calendar.getInstance(); + StringBuilder ruta = new StringBuilder("cm:Armas/cm:Crear"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + ruta = ruta.append("/cm:D-").append(calendar.get(Calendar.DAY_OF_MONTH)); + return ruta.toString(); + } + + public TiposArmasExplosivosController getTiposArmasExplosivosController() { + return tiposArmasExplosivosController; + } + + + public void setTiposArmasExplosivosController( + TiposArmasExplosivosController tiposArmasExplosivosController) { + this.tiposArmasExplosivosController = tiposArmasExplosivosController; + } + + + public RegistroArmController getRegistroArmas() { + return registroArmas; + } + + + public void setRegistroArmas(RegistroArmController registroArmas) { + this.registroArmas = registroArmas; + } + + + public List getLtipoidentificacion() { + return ltipoidentificacion; + } + + + public void setLtipoidentificacion(List ltipoidentificacion) { + this.ltipoidentificacion = ltipoidentificacion; + } + + + public String getTipoDoc() { + return tipoDoc; + } + + + public void setTipoDoc(String tipoDoc) { + this.tipoDoc = tipoDoc; + } + + + public String getNumDoc() { + return numDoc; + } + + + public void setNumDoc(String numDoc) { + this.numDoc = numDoc; + } + + + public String getNombreRazon() { + return nombreRazon; + } + + + public void setNombreRazon(String nombreRazon) { + this.nombreRazon = nombreRazon; + } + + + public List getLestadoarma() { + return lestadoarma; + } + + + public void setLestadoarma(List lestadoarma) { + this.lestadoarma = lestadoarma; + } + + + public List getLmarca() { + return lmarca; + } + + + public void setLmarca(List lmarca) { + this.lmarca = lmarca; + } + + + public List getLcolor() { + return lcolor; + } + + + public void setLcolor(List lcolor) { + this.lcolor = lcolor; + } + + + public List getLtipofabricacion() { + return ltipofabricacion; + } + + + public void setLtipofabricacion(List ltipofabricacion) { + this.ltipofabricacion = ltipofabricacion; + } + + + public List getLcountry() { + return lcountry; + } + + + public void setLcountry(List lcountry) { + this.lcountry = lcountry; + } + + + public List getLunidadmedidacantidad() { + return lunidadmedidacantidad; + } + + + public void setLunidadmedidacantidad( + List lunidadmedidacantidad) { + this.lunidadmedidacantidad = lunidadmedidacantidad; + } + + + public String getLongitud() { + return longitud; + } + + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + + public String getCalibre() { + return calibre; + } + + + public void setCalibre(String calibre) { + this.calibre = calibre; + } + + + public String getClase() { + return clase; + } + + + public void setClase(String clase) { + this.clase = clase; + } + + + public String getTipoarma() { + return tipoarma; + } + + + public void setTipoarma(String tipoarma) { + this.tipoarma = tipoarma; + } + + + public String getUnidadmedidapeso() { + return unidadmedidapeso; + } + + + public void setUnidadmedidapeso(String unidadmedidapeso) { + this.unidadmedidapeso = unidadmedidapeso; + } + + + public List getLunidadmedidapeso() { + return lunidadmedidapeso; + } + + + public void setLunidadmedidapeso(List lunidadmedidapeso) { + this.lunidadmedidapeso = lunidadmedidapeso; + } + + + public List getLprovincias() { + return lprovincias; + } + + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + + public List getLcantones() { + return lcantones; + } + + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + + public List getLparroquias() { + return lparroquias; + } + + + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + + public List getLcities() { + return lcities; + } + + + public void setLcities(List lcities) { + this.lcities = lcities; + } + + + public boolean isExisteTipoArmaExplosivo() { + return existeTipoArmaExplosivo; + } + + + public void setExisteTipoArmaExplosivo(boolean existeTipoArmaExplosivo) { + this.existeTipoArmaExplosivo = existeTipoArmaExplosivo; + } + + + public boolean isVerificaArmaExplosivo() { + return verificaArmaExplosivo; + } + + + public void setVerificaArmaExplosivo(boolean verificaArmaExplosivo) { + this.verificaArmaExplosivo = verificaArmaExplosivo; + } + + public boolean isBloquearUnidadCantidad() { + return bloquearUnidadCantidad; + } + + public void setBloquearUnidadCantidad(boolean bloquearUnidadCantidad) { + this.bloquearUnidadCantidad = bloquearUnidadCantidad; + } + + public boolean isBloquearUnidadPeso() { + return bloquearUnidadPeso; + } + + public void setBloquearUnidadPeso(boolean bloquearUnidadPeso) { + this.bloquearUnidadPeso = bloquearUnidadPeso; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public TarmTipoArmaExplosivo getTipoArmaExplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoArmaExplosivo(TarmTipoArmaExplosivo tipoArmaExplosivo) { + this.tipoArmaExplosivo = tipoArmaExplosivo; + } + + + + + public String getRazonSocial() { + return razonSocial; + } + + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public String getFiltroPersona() { + return filtroPersona; + } + + public void setFiltroPersona(String filtroPersona) { + this.filtroPersona = filtroPersona; + } + + protected void querydatabaseArmas() { + try { + DtoQuery dto = this.getDtoQuery(); + + dto.setOrderby("pk"); + if(this.getMfilelds().get("ESTADOS") != null){ + Filter filtroEstados = new Filter(); + String[] estados = this.getMfilelds().get("ESTADOS").toString().split(","); + StringBuffer sqlEstados = new StringBuffer(" t.estado IN ("); + for (int i = 0; i < estados.length; i++) { + sqlEstados.append("'").append(estados[i]).append("'"); + if(i < estados.length - 1){ + sqlEstados.append(","); + } + } + sqlEstados.append(")"); + filtroEstados.setSql(sqlEstados.toString()); + dto.addFiltro(filtroEstados); + }else{ + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql=" t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + } + + + + if(this.getMfilelds().get("ESTADOS") != null){ + Filter filtroEstados = new Filter(); + String[] estados = this.getMfilelds().get("ESTADOS").toString().split(","); + StringBuffer sqlEstados = new StringBuffer(" t.estado IN ("); + for (int i = 0; i < estados.length; i++) { + sqlEstados.append("'").append(estados[i]).append("'"); + if(i < estados.length - 1){ + sqlEstados.append(","); + } + } + sqlEstados.append(")"); + filtroEstados.setSql(sqlEstados.toString()); + dto.addFiltro(filtroEstados); + } + + if(this.getMfilelds().get("TIPOFABRICACION") != null){ + Filter filtroTipoFab = new Filter(); + String[] tipoFab = this.getMfilelds().get("TIPOFABRICACION").toString().split(","); + StringBuffer sqlTipoFab = new StringBuffer(" t.tipofabricacion IN ("); + for (int i = 0; i < tipoFab.length; i++) { + sqlTipoFab.append("'").append(tipoFab[i]).append("'"); + if(i < tipoFab.length - 1){ + sqlTipoFab.append(","); + } + } + sqlTipoFab.append(")"); + filtroTipoFab.setSql(sqlTipoFab.toString()); + dto.addFiltro(filtroTipoFab); + } + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public TcustPersonDetail getNuevoPropietarioArma() { + return nuevoPropietarioArma; + } + + public void setNuevoPropietarioArma(TcustPersonDetail nuevoPropietarioArma) { + this.nuevoPropietarioArma = nuevoPropietarioArma; + } + + /** + * Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findXCodigoArma(String armaCode) { + try { + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("codigoarma", armaCode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public List findArmaRecep(String csolicitud) { + try { + ArmasController cc = new ArmasController(); + cc.init(); + cc.querydatabaserecep(csolicitud); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + public void querydatabaserecep(String csolicitud) { + try { + DtoQuery dto = this.getDtoQuery(); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.put("csolicitud", csolicitud); + //QueryRule ArmasRecepcionQuery + request.put("queryalias", "ARMASRECEPLIST"); + + + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void querydatabasesimple() { + try { + DtoQuery dto = this.getDtoQuery(); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + @SuppressWarnings("unchecked") + public void querydatabaseArmaDuplicada(TarmArmas armaObj) { + try { + DtoQuery dto = this.getDtoQuery(); + + Filter filtro = new Filter(); + filtro.setSql("t.marca='"+armaObj.getMarca()+"' and t.marcacodigo='"+armaObj.getMarcacodigo()+"' and upper(t.lote)='"+ armaObj.getLote().toUpperCase()+"'"); + dto.addFiltro(filtro); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static TarmArmas findSimple(String carma) { + try { + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", carma); + cc.querydatabasesimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static Boolean isArmaDuplicada(TarmArmas armaObj) { + Boolean isDuplicada = Boolean.FALSE; + ArmasController cc; + try { + cc = new ArmasController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabaseArmaDuplicada(armaObj); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + for(TarmArmas armaTmp:cc.lrecord){ + TarmTipoArmaExplosivo tipoArmaExpTmp = TiposArmasExplosivosController.findarma(armaTmp.getCtipoarmaexplosivo()); + TgeneCatalogDetail claseTmp = CatalogDetailController.findCatalogo(tipoArmaExpTmp.getClasecodigo(), tipoArmaExpTmp.getClase()); + TgeneCatalogDetail tipoArmaTmp = CatalogDetailController.findCatalogo(tipoArmaExpTmp.getTipoarmaexplosivocodigo(), tipoArmaExpTmp.getTipoarmaexplosivo()); + TgeneCatalogDetail calibreTmp = CatalogDetailController.findCatalogo(tipoArmaExpTmp.getCalibrecodigo(), tipoArmaExpTmp.getCalibre()); + // Valido la clase, tipoarma y calibre solo para armas de fuego y armas no letales + if(claseTmp.getPk().getCatalog().equals("0010000001") || claseTmp.getPk().getCatalog().equals("0010000008")){ + if(armaObj.getModifiedData().get("clase")!=null && armaObj.getModifiedData().get("tipoarmaexplosivo")!=null){ + if(armaObj.getModifiedData().get("clase").toString().equalsIgnoreCase(claseTmp!=null?claseTmp.getDescription():"")&& + armaObj.getModifiedData().get("tipoarmaexplosivo").toString().equalsIgnoreCase(tipoArmaTmp!=null?tipoArmaTmp.getDescription():"")){ + if(armaObj.getModifiedData().get("calibre")!=null && calibreTmp!=null && armaObj.getModifiedData().get("calibre").toString().equalsIgnoreCase(calibreTmp.getDescription())){ + isDuplicada = Boolean.TRUE; + break; + } + } + }else{ + MessageHelper.setMessageError("CLASE Y/O TIPO DE ARMA EXPLOSIVO INCORRECTOS"); + } + } + } + + } + return isDuplicada; + } catch (Exception e) { + // TODO Auto-generated catch block + MessageHelper.setMessageError(e); + return null; + } + } + + + public static TarmArmas find(String carma) { + try { + + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", carma); + cc.querydatabasesimple(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if(tarmTipoArmaExplosivo!=null){ + if(tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null){ + cc.record.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getTipoarmaexplosivo() != null && tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo() != null){ + cc.record.modifiedData().put("tipo",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo())!=null? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(),tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getClase() != null && tarmTipoArmaExplosivo.getClasecodigo() != null){ + cc.record.modifiedData().put("clase",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription():""); + } + TarmRegistroArmas registroArmas = new TarmRegistroArmas(); + TcustPersonDetail detallePersona = new TcustPersonDetail(); + if(cc.record.getCregistro()!=null ){ + registroArmas = RegistroArmController.findByCodigo(String.valueOf(cc.record.getCregistro())); + if(registroArmas!=null){ + detallePersona= PersonDetailController.find(String.valueOf(registroArmas.getPersoncode())); + } + } + cc.record.modifiedData().put("razonsPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getName()); + cc.record.modifiedData().put("documentoPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getIdentification()); + cc.record.modifiedData().put("marca",(cc.record ==null || cc.record.getMarca()==null || cc.record.getMarca().isEmpty() || cc.record.getMarcacodigo()==null || cc.record.getMarcacodigo().isEmpty())?"":CatalogDetailController.findxCodigoCodcatalogo(cc.record.getMarca(), cc.record.getMarcacodigo()).getDescription()); + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Abre el lov de persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + /** + * Maneja la respuesta del Lov de Personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + + TcustPersonDetail personaDetailSelecionada = (TcustPersonDetail) event.getObject(); + razonSocial = personaDetailSelecionada.getName(); + numeroDocumento = personaDetailSelecionada.getIdentification(); + filtroPersona = " and t.cregistro in (select i.pk from TarmRegistroArmas i where i.personcode =" + + personaDetailSelecionada.getPk().getPersoncode() + ")"; + + querydatabase(); + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ArticuloRegistradoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ArticuloRegistradoController.java.svn-base new file mode 100644 index 0000000..f83f0d5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ArticuloRegistradoController.java.svn-base @@ -0,0 +1,522 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Controlador principal de la funcionalidad de armas Registradas + * + * @author H.Y Sinfo + * + */ + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ArticuloRegistradoController extends AbstractController{ + /** + * Tipo documento + */ + private String tipoDoc; + + /** + * Número documento + */ + private String numDoc; + + /** + * Nombre/razón social + */ + private String nombreRazon; + + /** + * Longitud arma + */ + private String longitud; + /** + * Calibre arma + */ + private String calibre; + /** + * Clase arma + */ + private String clase; + /** + * Tipo de arma + */ + private String tipoarma; + /** + * unidad medida peso + */ + private String unidadmedidapeso; + + /** + * Bandera que indica que en realidad existe luego del ingreso de datos un tipo + * de arma explosivo válido + */ + private boolean existeTipoArmaExplosivo; + + /** + * Bandera que escifica que se deba verificar que exista un arma explosivo + * válida + */ + private boolean verificaArmaExplosivo = Boolean.TRUE; + + /** + * Bloquea la unidad de cantidad + */ + private boolean bloquearUnidadCantidad = Boolean.TRUE; + + /** + * Bloquea la unidad de peso + */ + private boolean bloquearUnidadPeso = Boolean.TRUE; + + private Date fechaActual; + + private String razonSocial; + + private String numeroDocumento; + + private String filtroPersona; + + private String descategoria; + private String usoActividad; + + + /** + * Usuario actual logueado en el sistema + * */ + private TsafeUserDetail userDetail; + + + public ArticuloRegistradoController() throws Exception { + super(TarmArmas.class); + } + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + } + + + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + fechaActual = new Date(); + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "ARMAS"; + filtroPersona = " and t.cregistro in (select i.pk from TarmRegistroArmas i where i.personcode =" + + userDetail.getPk().getPersoncode() + ")"; + if(userDetail.getPk().getPersoncode()!=null){ + razonSocial = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + numeroDocumento=PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getIdentification(); + } + else{ + razonSocial = ""; + numeroDocumento=""; + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + @SuppressWarnings("unchecked") + protected void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + dto.setOrderby("pk"); + Filter filtro = new Filter(); + String sql = "t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma) and t.estado !='DEST' and t.estado!='VEND' and t.estado!='MING' and t.estado!='DUPL' and t.estado!='CUSTEM' and t.estado !='CDP'" + + " and (t.peso>0 or t.cantidad>0) " + filtroPersona;// + filtro.setSql(sql); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + for (TarmArmas armasObj : lrecord) { + TarmRegistroArmas registroArmasObj = RegistroArmController + .findByCodigo(armasObj.getCregistro().toString()); + if (registroArmasObj != null && registroArmasObj.getPersoncode() != null) { + TcustPersonDetail propietarioObj = PersonDetailController + .find(registroArmasObj.getPersoncode().toString()); + if (propietarioObj.getIdentificationcatalog() != null + && propietarioObj.getIdentificationcatalogcode() != null) { + armasObj.getModifiedData() + .put("tipoDocumento", + CatalogDetailController + .findxCodigoCodcatalogo(propietarioObj.getIdentificationcatalog(), + propietarioObj.getIdentificationcatalogcode()) + .getDescription()); + } + armasObj.getModifiedData().put("noDocumento", propietarioObj.getIdentification()); + armasObj.getModifiedData().put("nombrerazonsocial", propietarioObj.getName()); + armasObj.getModifiedData().put("paisorigencode", registroArmasObj.getPaisorigen()); + if (armasObj.getModifiedData().get("cclase") != null) { + armasObj.getModifiedData().put("clase", + CatalogDetailController + .findxCodigoCodcatalogo(armasObj.getModifiedData().get("cclase").toString(), + armasObj.getModifiedData().get("cclasecodigo").toString()) + .getDescription()); + } + if (armasObj.getModifiedData().get("ctipoarmaexplosivo") != null) { + armasObj.getModifiedData().put("tipoarmaexplosivo", + CatalogDetailController.findxCodigoCodcatalogo( + armasObj.getModifiedData().get("ctipoarmaexplosivo").toString(), + armasObj.getModifiedData().get("ctipoarmaexplosivocodigo").toString()) + .getDescription()); + } + if (armasObj.getModifiedData().get("ccalibre") != null) { + armasObj.getModifiedData().put("calibre", CatalogDetailController + .findxCodigoCodcatalogo(armasObj.getModifiedData().get("ccalibre").toString(), + armasObj.getModifiedData().get("ccalibrecodigo").toString()) + .getDescription()); + } + + } + } + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() throws Exception { + // TODO Auto-generated method stub + super.next(); + } + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", + "i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", + "i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", + "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase = new SubQuery("TarmTipoArmaExplosivo", "clase", "cclase", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo = new SubQuery("TarmTipoArmaExplosivo", "clasecodigo", "cclasecodigo", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud = new SubQuery("TarmTipoArmaExplosivo", "longitud", "clongitud", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo = new SubQuery("TarmTipoArmaExplosivo", "longitudcodigo", "clongitudcodigo", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre = new SubQuery("TarmTipoArmaExplosivo", "calibre", "ccalibre", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo = new SubQuery("TarmTipoArmaExplosivo", "calibrecodigo", "ccalibrecodigo", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivo", "ctipoarmaexplosivo", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivocodigo", + "ctipoarmaexplosivocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapeso", "cunidadmedidapeso", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapesocodigo", + "cunidadmedidapesocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida = new SubQuery("TgeneCatalogDetail", "description", "unidadmedida", + "i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode = new SubQuery("TarmRegistroArmas", "personcode", "personcode", + "i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + + SubQuery subqueryFechaemiperm = new SubQuery("TarmDocumentoHabilitante", "fechaemision", "fechaemision", + // " i.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = + // t.cregistro) and i.carma = t.pk and "+ + " i.pk=(select max(doc.pk) from TarmDocumentoHabilitante doc where doc.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro)" + + " and doc.carma in (select arm1.pk from TarmArmas arm1 where arm1.codigoarma in (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))"); + dto.addSubQuery(subqueryFechaemiperm); + SubQuery subqueryFechaexpperm = new SubQuery("TarmDocumentoHabilitante", "fechaexpiracion", "fechaexpiracion", + // " i.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = + // t.cregistro) and i.carma = t.pk and "+ + " i.pk=(select max(doc.pk) from TarmDocumentoHabilitante doc where doc.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) " + + "and doc.carma in (select arm1.pk from TarmArmas arm1 where arm1.codigoarma in (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))"); + dto.addSubQuery(subqueryFechaexpperm); + + return dto; + } + + /** + * Método que se ejecuta al abrir el LOV de visualizar item seleccionado + * + * @throws Exception + */ + public void loadEdit() throws Exception { + verificaArmaExplosivo = Boolean.TRUE; + record.getModifiedData().put("provincia", + ProvinceController.getDescProvByCodigo(record.getCountrycode(), record.getProvincecode())); + record.getModifiedData().put("canton", CantonController.getDescCantonByCodigo(record.getCountrycode(), + record.getProvincecode(), record.getCantoncode())); + record.getModifiedData().put("ciudad", CityController.getDescCiudadByCodigo(record.getCountrycode(), + record.getProvincecode(), record.getCantoncode(), record.getCitycode())); + record.getModifiedData().put("parroquia", ParroquiaController.getDescParroquiaByCodigo(record.getCountrycode(), + record.getProvincecode(), record.getCantoncode(), record.getParroquiacode())); + if (record.getModifiedData().get("paisorigencode") != null) { + record.getModifiedData().put("paisorigen", CountryController + .findcountry(record.getModifiedData().get("paisorigencode").toString()).getDescription()); + } + if (record.getColor() != null) { + record.getModifiedData().put("colorD", CatalogDetailController + .findxCodigoCodcatalogo(record.getColor(), record.getColorcodigo()).getDescription()); + } + /* Aumentado */ + TarmDocumentoHabilitante documento = DocumentoHabilitanteController + .findxarma(record.getCodigoarma().toString()); + + TarmTramite tramite = TarmTramiteController.find(documento.getCtramite().toString()); + TgeneCatalogDetail catalogo = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), + tramite.getCategoriacodigo()); + descategoria = catalogo.getDescription(); + TgeneCatalogDetail uso = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), + tramite.getUsoactividadcodigo()); + usoActividad = uso.getDescription(); + } + + @Override + public void save() { + + } + public String getTipoDoc() { + return tipoDoc; + } + + public void setTipoDoc(String tipoDoc) { + this.tipoDoc = tipoDoc; + } + + public String getNumDoc() { + return numDoc; + } + + public void setNumDoc(String numDoc) { + this.numDoc = numDoc; + } + + public String getNombreRazon() { + return nombreRazon; + } + + public void setNombreRazon(String nombreRazon) { + this.nombreRazon = nombreRazon; + } + + public String getLongitud() { + return longitud; + } + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + public String getCalibre() { + return calibre; + } + + public void setCalibre(String calibre) { + this.calibre = calibre; + } + + public String getClase() { + return clase; + } + + public void setClase(String clase) { + this.clase = clase; + } + + public String getTipoarma() { + return tipoarma; + } + + public void setTipoarma(String tipoarma) { + this.tipoarma = tipoarma; + } + + public String getUnidadmedidapeso() { + return unidadmedidapeso; + } + + public void setUnidadmedidapeso(String unidadmedidapeso) { + this.unidadmedidapeso = unidadmedidapeso; + } + + public boolean isExisteTipoArmaExplosivo() { + return existeTipoArmaExplosivo; + } + + public void setExisteTipoArmaExplosivo(boolean existeTipoArmaExplosivo) { + this.existeTipoArmaExplosivo = existeTipoArmaExplosivo; + } + + public boolean isVerificaArmaExplosivo() { + return verificaArmaExplosivo; + } + + public void setVerificaArmaExplosivo(boolean verificaArmaExplosivo) { + this.verificaArmaExplosivo = verificaArmaExplosivo; + } + + public boolean isBloquearUnidadCantidad() { + return bloquearUnidadCantidad; + } + + public void setBloquearUnidadCantidad(boolean bloquearUnidadCantidad) { + this.bloquearUnidadCantidad = bloquearUnidadCantidad; + } + + public boolean isBloquearUnidadPeso() { + return bloquearUnidadPeso; + } + + public void setBloquearUnidadPeso(boolean bloquearUnidadPeso) { + this.bloquearUnidadPeso = bloquearUnidadPeso; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public String getRazonSocial() { + return razonSocial; + } + + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public String getDescategoria() { + return descategoria; + } + + public void setDescategoria(String descategoria) { + this.descategoria = descategoria; + } + + public String getUsoActividad() { + return usoActividad; + } + + public void setUsoActividad(String usoActividad) { + this.usoActividad = usoActividad; + } + + + /** + * Metodo que genera el reporte para el registro seleccionado + * + * @param event + * @throws Exception + */ + public void imprimir() { + System.out.println("Imprimir un reporte en PDF.. Pendiente implementar"); + } + + public String retornaDatosArma(String codArma, int opc) { + String resp = ""; + try { + if (codArma!=null) { + TarmDocumentoHabilitante documento = DocumentoHabilitanteController.findxarma(codArma); + if (documento.getCtramite()!=null) { + TarmTramite tramite = TarmTramiteController.find(documento.getCtramite().toString()); + if (opc == 1) { + TgeneCatalogDetail catalogo = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), + tramite.getCategoriacodigo()); + resp = catalogo.getDescription(); + } + if (opc == 2) { + TgeneCatalogDetail uso = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), + tramite.getUsoactividadcodigo()); + resp = uso.getDescription(); + + } + } + + } + + } catch (Exception e) { + resp=""; + MessageHelper.setMessageError(e); + } + return resp; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/AutorizacionDevolucionController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/AutorizacionDevolucionController.java.svn-base new file mode 100644 index 0000000..fc22b97 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/AutorizacionDevolucionController.java.svn-base @@ -0,0 +1,522 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.general.mail.EnvioMail; +import com.fp.general.mail.dto.EnvioCorreoDTO; +import com.fp.general.mail.exception.EnvioMailException; +import com.fp.general.mail.factory.EnvioMailFactory; +/* +import com.fp.general.mail.EnvioMail; +import com.fp.general.mail.dto.EnvioCorreoDTO; +import com.fp.general.mail.exception.EnvioMailException; +import com.fp.general.mail.factory.EnvioMailFactory; +*/ +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class AutorizacionDevolucionController extends AbstractController { + + TarmSolicitudTramite solicitudTramite; + Boolean actualizada=false; + /** + * + */ + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{tarmSolicitudArmasController}") + private TarmSolicitudArmasController tarmSolicitudArmasController; + + @ManagedProperty(value = "#{armasController}") + private ArmasController armasController; + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddressController; + + TgeneProvince provincia; + TgeneCanton canton; + TgeneCity ciudad; + TgeneParroquia parroquia; + String direccion; + + TcustPersonDetail detallesPersona; + TcustPersonDetail usuario; + TarmCentroControl centroControl; + TcustPersonAddress direccionPersona; + String nombreInstitucion; + private Boolean btnEnviar; + /** + * Atributo que se recupera del flujo + */ + private String csolicitud; + + public AutorizacionDevolucionController() throws Exception { + super(TarmSolicitudTramite.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + startQuery(); + this.init(); + try { + super.query(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para recuperar la variable del flujo + */ + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + csolicitud=super.getMfilters().get("csolicitud");//1 + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "AUTORIZACIONDEVOLUCIONCONTROLLER"; + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(csolicitud); + btnEnviar=Boolean.FALSE; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void query() throws Exception { + // TODO Auto-generated method stub + MessageHelper.setMessageError("msg_notQuery"); + super.query(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + + Filter fCSolicitud=new Filter("pk.csolicitud", csolicitud); + dto.addFiltro(fCSolicitud); + + //Aplicandole filtros a las armas + tarmSolicitudArmasController.setCsolicitud(csolicitud); + tarmSolicitudArmasController.setPorDevolucion("Y"); + tarmSolicitudArmasController.getMfilters().clear(); + tarmSolicitudArmasController.query(); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + + //Numero de tramite + if(solicitudTramite!=null){ + this.record.put("ntramite", solicitudTramite.getNumerotramite()); + } + + //Obteniendo la solicitud + TarmSolicitud solicitud=ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(this.record.getPk().getCsolicitud()); + + //Obteniendo la direccion del cliente + String tipoDireccion=""; + if(solicitud!=null){ + detallesPersona= PersonDetailController.find(String.valueOf(solicitud.getPersoncode().toString())); + + if(detallesPersona!=null){ + switch(detallesPersona.getIdentificationcatalog()){ + case "CED": + tipoDireccion = "1"; + break; + case "RUC": + tipoDireccion= "2"; + break; + default: + tipoDireccion= ""; + break; + } + } + + if(solicitud!=null){ + //personAddressController.findPersonaPorDireccionTipoCatalogo(String.valueOf(solicitud.getPersoncode()), tipoDireccion); + String codigoMail=codigoParameter("CODIGO.MAIL");//3 + this.direccionPersona=personAddressController.findByPersonCode(solicitud.getPersoncode().toString(),codigoMail); + + provincia = personAddressController.getLprovinces()==null || personAddressController.getLprovinces().isEmpty()?null:personAddressController.getLprovinces().get(0); + canton = personAddressController.getLcantones()==null || personAddressController.getLcantones().isEmpty()?null:personAddressController.getLcantones().get(0); + ciudad = personAddressController.getLcities()==null || personAddressController.getLcities().isEmpty()?null:personAddressController.getLcities().get(0); + parroquia = personAddressController.getLparroquias()==null || personAddressController.getLparroquias().isEmpty()?null:personAddressController.getLparroquias().get(0); + direccion= personAddressController.getRecord().getAddress(); + } + } + + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + //Obteniendo el centro de control + centroControl=CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + if(centroControl!=null && centroControl.getNombreinstitucion()!=null && !centroControl.getNombreinstitucion().isEmpty() + && centroControl.getNombreinstitucioncodigo()!=null && !centroControl.getNombreinstitucioncodigo().isEmpty()){ + + TgeneCatalogDetail catalogoInstitucion=CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()); + this.nombreInstitucion=catalogoInstitucion.getDescription(); + } + + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public String codigoParameter(String codigo){ + TgeneParameters parameter= ParametersController.find(codigo, "1"); + return parameter.getTextvalue(); + } + + @Override + public void save() { + try { + record.setEstadotramite("APB"); + update(); + + //Modificando la direccion de las armas con del cliente y el estado del arma + this.armasController.getLrecord().clear(); + this.armasController.setLrecord(this.tarmSolicitudArmasController.getlArmas()); + for (TarmArmas arma : this.armasController.getLrecord()) { + if(provincia!=null){ + arma.setProvincecode(provincia.getPk().getProvincecode()); + } + + if(canton!=null){ + arma.setCantoncode(canton.getPk().getCantoncode()); + } + + if(ciudad!=null){ + arma.setCitycode(ciudad.getPk().getCitycode()); + } + + if(parroquia!=null){ + arma.setParroquiacode(parroquia.getPk().getParroquiacode()); + } + + arma.setDireccion(direccion); + arma.setEstado("DEV"); + + this.armasController.update(arma); + } + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); + + //Modificando el estado y direccion de las armas + this.armasController.setLrecord(this.tarmSolicitudArmasController.getlArmas()); + + DtoSave dtosaveArmas = this.armasController.getDtoSave(true); + msave.put(this.armasController.getBeanalias(), dtosaveArmas); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + this.actualizada=true; + btnEnviar=Boolean.TRUE; + } else { + MessageHelper.setMessageError(resp); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que envia un mail de notificación + */ + public void enviarNotificacion(){ + try { + if(direccionPersona==null || direccionPersona.getAddress()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_notienedireccioncorreo")); + return; + } + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + + String asunto = MsgControlArmas.getProperty("lbl_asuntoNotificarFecha"); + SimpleDateFormat format=new SimpleDateFormat(MsgGeneral.getProperty("dateformat")); + String textoFecha=" "+format.format(new Date())+" "; + if(solicitudTramite.getFentregaarmas()!=null){ + textoFecha=sdf.format(solicitudTramite.getFentregaarmas()); + } + + String cuerpo = MessageFormat.format(MsgControlArmas.getProperty("cuerpo.mensaje.envio.correo"), detallesPersona.getName(), + solicitudTramite.getNumerotramite().toString(), textoFecha, usuario.getName(),this.nombreInstitucion); + + EnvioCorreoDTO envioCorreo = new EnvioCorreoDTO(); + envioCorreo.setCorreoDesde(MsgControlArmas.getProperty("correoDesde")); + envioCorreo.setCorreoPara(new String[]{this.direccionPersona.getAddress()}); + envioCorreo.setAsunto(asunto); + envioCorreo.setMensajeHTML(cuerpo); + EnvioMail envioMail = EnvioMailFactory.getInstancia(); + envioMail.envioMail(envioCorreo); + actualizada=false; + } catch(EnvioMailException e){ + MessageHelper.setMessageError(new Throwable("Se produjo un error al enviar el correo")); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("csolicitud", csolicitud); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + btnEnviar=Boolean.FALSE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene los detalles de las armas segun el catalogo + * @param catalogo + * @param catalogoCode + * @return + */ + public String aspectoArmaCatalogo(String catalogo, String catalogoCode){ + if(catalogo!=null && catalogoCode!=null && !catalogo.isEmpty() && !catalogoCode.isEmpty()){ + return CatalogDetailController.findxCodigoCodcatalogo(catalogo, catalogoCode).getDescription(); + } + return null; + } + + /** + * Devuelve una descripcion de catalogo segun un tipo de aspecto + * @param arma + * @param tipoAspecto + * @return + */ + public String aspectoArmaExplosivoCatalogo(TarmArmas arma,String tipoAspecto){ + String aspecto=""; + + try { + TarmTipoArmaExplosivo explosivo=TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo()); + if(explosivo!=null){ + if(tipoAspecto.equalsIgnoreCase("clase") && explosivo.getClase()!=null && !explosivo.getClase().isEmpty() + && explosivo.getClasecodigo()!=null && !explosivo.getClasecodigo().isEmpty()){ + aspecto=CatalogDetailController.findxCodigoCodcatalogo(explosivo.getClase(), explosivo.getClasecodigo()).getDescription(); + + }else if(tipoAspecto.equalsIgnoreCase("tipo") && explosivo.getTipoarmaexplosivo()!=null && !explosivo.getTipoarmaexplosivo().isEmpty() + && explosivo.getTipoarmaexplosivocodigo()!=null && !explosivo.getTipoarmaexplosivocodigo().isEmpty()){ + aspecto=CatalogDetailController.findxCodigoCodcatalogo(explosivo.getTipoarmaexplosivo(), explosivo.getTipoarmaexplosivocodigo()).getDescription(); + + }else if(tipoAspecto.equalsIgnoreCase("calibre") && explosivo.getCalibre()!=null && !explosivo.getCalibre().isEmpty() + && explosivo.getCalibrecodigo()!=null && !explosivo.getCalibrecodigo().isEmpty()){ + aspecto=CatalogDetailController.findxCodigoCodcatalogo(explosivo.getCalibre(), explosivo.getCalibrecodigo()).getDescription(); + } + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + return aspecto; + } + + public String aspectoExplosivoArma(TarmSolicitudArmas solicitudArma,String aspecto){ + String descripcionAspecto=""; + try { + TarmArmas arma=ArmasController.findPorCodigo(solicitudArma.getPk().getCarma()); + + if(arma!=null){ + return this.aspectoArmaExplosivoCatalogo(arma,aspecto); + } + + } catch (Exception e) { + MessageHelper.setMessageWarn(e.getMessage()); + } + + return descripcionAspecto; + } + + public TarmSolicitudArmasController getTarmSolicitudArmasController() { + return tarmSolicitudArmasController; + } + + public void setTarmSolicitudArmasController( + TarmSolicitudArmasController tarmSolicitudArmasController) { + this.tarmSolicitudArmasController = tarmSolicitudArmasController; + } + + public Boolean getActualizada() { + return actualizada; + } + + public void setActualizada(Boolean actualizada) { + this.actualizada = actualizada; + } + + public TarmSolicitudTramite getSolicitudTramite() { + return solicitudTramite; + } + + public void setSolicitudTramite(TarmSolicitudTramite solicitudTramite) { + this.solicitudTramite = solicitudTramite; + } + + public ArmasController getArmasController() { + return armasController; + } + + public void setArmasController(ArmasController armasController) { + this.armasController = armasController; + } + + public PersonAddressController getPersonAddressController() { + return personAddressController; + } + + public void setPersonAddressController( + PersonAddressController personAddressController) { + this.personAddressController = personAddressController; + } + + public TgeneProvince getProvincia() { + return provincia; + } + + public void setProvincia(TgeneProvince provincia) { + this.provincia = provincia; + } + + public TgeneCanton getCanton() { + return canton; + } + + public void setCanton(TgeneCanton canton) { + this.canton = canton; + } + + public TgeneCity getCiudad() { + return ciudad; + } + + public void setCiudad(TgeneCity ciudad) { + this.ciudad = ciudad; + } + + public TgeneParroquia getParroquia() { + return parroquia; + } + + public void setParroquia(TgeneParroquia parroquia) { + this.parroquia = parroquia; + } + + public String getDireccion() { + return direccion; + } + + public void setDireccion(String direccion) { + this.direccion = direccion; + } + + public Boolean getBtnEnviar() { + return btnEnviar; + } + + public void setBtnEnviar(Boolean btnEnviar) { + this.btnEnviar = btnEnviar; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/AuxArmasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/AuxArmasController.java.svn-base new file mode 100644 index 0000000..83537f6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/AuxArmasController.java.svn-base @@ -0,0 +1,385 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.event.AjaxBehaviorEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.ClaseLovController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +/** + * Controlador principal de armas + * @author dcruz + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class AuxArmasController extends AbstractController { + + + public AuxArmasController() throws Exception { + super(TarmArmas.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. +// record = new TarmArmas(); + lrecord = new ArrayList<>(); + beanalias = "ARMAS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + + @SuppressWarnings("unchecked") + protected void querydatabaseP(String carma) { + try { + DtoQuery dto = this.getDtoQuery(true); + dto.setOrderby("pk"); + //cc.addField("codigoArma", cArma); + String sqlActual = " t.codigoarma =(select p.codigoarma from TarmArmas p where p.pk = '"+carma+"')" + + " and t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where ta.codigoarma=t.codigoarma)" + + " and t.estado !='DEST' " + + " and (t.peso>0 or t.cantidad>0)";//distintas de destruidas y cambio de propietario and t.cregistro=ta.cregistro para el manejo de los explosivos + + Filter filtroFinal = new Filter(); + filtroFinal.setSql(sqlActual); + dto.addFiltro(filtroFinal); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + + + @Override + public void save() { + } + + @Override + public void update() throws Exception { + } + + public void updateAutorizacion()throws Exception { + super.update(); + } + + + + @Override + public void create() throws Exception { + } + + + /** + * Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findByPK(String cArma) { + try { + AuxArmasController cc = new AuxArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.querydatabaseP(cArma); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + /** + * Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findXCodigo(String armaCode) { + try { + + AuxArmasController cc = new AuxArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + //cc.addFilter("REG", "ESTADOARMA"); + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + + /** + * Lista de Armas por Registro + **/ + public static List findxRegistro(String registrocode) { + try { + AuxArmasController cc = new AuxArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("cregistro", registrocode); + + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + for(TarmArmas item : cc.lrecord){ + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(item.getCtipoarmaexplosivo()); + item.modifiedData().put("clase",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription()); + if(tarmTipoArmaExplosivo.getLongitud()!=null && tarmTipoArmaExplosivo.getLongitudcodigo()!=null){ + item.modifiedData().put("longitud",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getLongitud(), tarmTipoArmaExplosivo.getLongitudcodigo()).getDescription()); + } + item.modifiedData().put("tipo",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription()); + if(tarmTipoArmaExplosivo.getCalibre()!=null && tarmTipoArmaExplosivo.getCalibrecodigo()!=null){ + item.modifiedData().put("calibre",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription()); + } + item.modifiedData().put("unidadMedidaCantidad",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getUnidadmedidapeso(), tarmTipoArmaExplosivo.getUnidadmedidapesocodigo()).getDescription()); + } + + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Abre el LOV de la clase del arma + */ + public void openLovClase() { + Map> params = new HashMap>(); + ClaseLovController.openLov(params); + } + + + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if(Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")){ + valorColocar = Boolean.TRUE; + } + for (TarmArmas guardias : lrecord) { + guardias.getModifiedData().put("seleccionado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Metodo para obtener el listado de las armas por la serie/lote + * @param serieLote + * @return + */ + public static List findxSerieLote(String serieLote) { + try { + AuxArmasController cc = new AuxArmasController(); + cc.init(); + cc.recperpage = 1000; + cc.addFilter("lote", serieLote); + cc.querydatabaseFechaMax(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + /** + * Metodo para obtener los codigos + */ + private static String codigos(String parametro){ + TgeneParameters tgeneParameters= ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + @SuppressWarnings("unchecked") + protected void querydatabaseFechaMax() { + try { + DtoQuery dto = this.getDtoQuery(true); + dto.setOrderby("pk"); + String codigoEstadoIncautada=codigos("CODIGO.INCAUTADA"); + String codigoEstadoDecomisada=codigos("CODIGO.DECOMISADA"); + String codigoEstadoVendida=codigos("CODIGO.VENDIDA"); + String codigoEstadoMatPrima=codigos("CODIGO.MATERIAPRIMA"); + Filter filtro = new Filter(); + String sql="t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro)"//and t.cregistro=ta.cregistro para el manejo de los explosivos + + " and t.estado !='DEST' and t.estado !='CDP' and t.estado !='"+codigoEstadoIncautada+"' and t.estado !='"+codigoEstadoDecomisada+"' and t.estado !='"+codigoEstadoVendida+"' and t.estado !='"+codigoEstadoMatPrima+"' "; + filtro.setSql(sql); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findXCodigoArma(String armaCode) { + try { + AuxArmasController cc = new AuxArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("codigoarma", armaCode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * @param armaCode + * @return + */ + public static List findListXCodigoArma(String armaCode) { + try { + AuxArmasController cc = new AuxArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("codigoarma", armaCode); + cc.querybatabasearmas(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + } + + @SuppressWarnings("unchecked") + protected void querybatabasearmas(){ + try { + DtoQuery dto = this.getDtoQuery(true); + SubQuery subqueryPersonCode= new SubQuery("TarmRegistroArmas","personcode","personcode","i.pk=t.cregistro"); + dto.addSubQuery(subqueryPersonCode); + + dto.setOrderby("pk"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/BodegaController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/BodegaController.java.svn-base new file mode 100644 index 0000000..95156e5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/BodegaController.java.svn-base @@ -0,0 +1,116 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.CatalogLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmBodega; +import com.fp.persistence.parmas.soli.TarmTransaccionArmaBodega; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TarmTransaccionArmaBodega. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class BodegaController extends AbstractController { + + public BodegaController() throws Exception { + super(TarmBodega.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "BODEGA"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CabRepDestruirArmasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CabRepDestruirArmasController.java.svn-base new file mode 100644 index 0000000..167fc36 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CabRepDestruirArmasController.java.svn-base @@ -0,0 +1,174 @@ +package com.fp.frontend.controller.armas.solicitud; + + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmCabRepDestruirArmas; + +/** + * Clase controladora del bean TarmCabRepDestruirArmas + * + * @author Christian Pazmino + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CabRepDestruirArmasController extends AbstractController { + + + + + public CabRepDestruirArmasController() throws Exception { + super(TarmCabRepDestruirArmas.class); + } + + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //Ingreso de Datos Quemados + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + public void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + // record = new TarmSolicitudImportacion(); + this.beanalias = "CABREPORTEDESTRUIRARMAS"; +// this.create(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que busca todas las cabeceras de reporte de destruccion de armas generadas + * + */ + public static List find() { + try { + CabRepDestruirArmasController cc = new CabRepDestruirArmasController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Metodo que busca una cabecera de reporte de destruccion de armas mediante el PK + * + */ + public static TarmCabRepDestruirArmas findByCodigo(String cCabReporte) { + try { + CabRepDestruirArmasController cc = new CabRepDestruirArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", cCabReporte); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + + + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + /** + * Metodo para actualizar un bean en el core + * + */ + public void update(TarmCabRepDestruirArmas bean) throws Exception { + record=bean; + update(); + } +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CargarDepositoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CargarDepositoController.java.svn-base new file mode 100644 index 0000000..0725305 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CargarDepositoController.java.svn-base @@ -0,0 +1,667 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.IngresoDatosTipoTramite; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pgeneral.date.TgeneNotAccountingDayController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora para el ingreso de comprobante de deposito + * + * @author CHRISTIAN PAZMINO + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CargarDepositoController extends AbstractController { + /** + * Variable que contiene el numero de tramite con el que inicia el flujo + */ + private String numTramite; + /** + * Variable que contiene el codigo de solicitud pasado en el flujo + */ + private String csolicitud; + /** + * Variable del tipo TgeneCatalogDetail(catalogo del tramite) + */ + private TgeneCatalogDetail nombreTramite; + /** + * Variable del tipo TgeneCatalogDetail(catalogo de la categoria) + */ + private TgeneCatalogDetail nombreCategoria; + /** + * Variable del tipo TgeneCatalogDetail(catalogo del uso actividad del tramite) + */ + private TgeneCatalogDetail nombreUsoActividad; + /** + * Bandera de tipo booleano para indicar si se habilita el boton de completar tarea + */ + private Boolean isEnableCompletarTarea= Boolean.FALSE; + /** + * Propiedad que premite controlar operaciones de cargar archivos al Alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * Variable que contiene los datos de la solicitud actual + */ + private TarmSolicitud solicitud; + /** + * Variable que nos permite cargar el comprobante de deposito al Alfresco + */ + private UploadedFile uploadedFile; + /** + * Variable que nos permite cargar la resolucion al Alfresco + */ + private UploadedFile uploadedFileResolucion; + /** + * Variable que indica si el usuario esta negado para continuear el tramite, su tramite pasa a estado anulado + */ + private Boolean isDenied; + /** + * Variable auxiliar usada para diferenciar cuando se presenta o no el mensaje de validacion de fecha expiracion solicitud + */ + private Boolean isOnlyMsj; + /** + * Variable que indica si el numero de comprobante ingresado es correcto + */ + private Boolean isTrueNComprobante; + /** + * Dias laborables permitidos para completar el tramite + */ + private Integer diasLaborablesPermitidos; + /** + * Bandera de tipo booleano para indicar si se ha grabado el reporte generado + * */ + private Boolean isEnableGrabar; + /** + * codigo de la provincia del usuario logeado + */ + private String cprovincia; + + private Boolean requiereNoSolAucpBln; + + /** + *Referencia al Centro de control; + */ + private TarmCentroControl centroControl = new TarmCentroControl(); + + /** + *Nombre de la Institucion + */ + private String nombreInstitucion; + + public CargarDepositoController() throws Exception { + super(TarmSolicitudTramite.class); + } + + + @PostConstruct + private void postconstruct() { +// super.startQuery(); +// csolicitud = this.getMfilters().get("csolicitud"); +// this.getMfilters().clear(); + + init(); + requiereNoSolAucpBln=Boolean.FALSE; + } + + public void consultarSolicitud() throws Exception{ + if(numTramite!=null){ + this.record = SolicitudTramiteController.findByNumTramite(numTramite); + if(record != null && record.getPk().getCsolicitud()!=null){ + csolicitud = record.getPk().getCsolicitud(); + // csolicitud=csolicitud.replace("TRA","SOL"); + + try { + if(record!=null){ + solicitud = SolicitudArmasController.findByCSolicitud(csolicitud); + if(solicitud!=null && solicitud.getCtramite()!=null){ + TarmTramite tramite = IngresoDatosTipoTramite.find(solicitud.getCtramite().toString()); + if(tramite!=null){ + //Tramite + nombreTramite= CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + nombreCategoria= CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + nombreUsoActividad= CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + if(tramite.getCategoria().equals("14")){ + requiereNoSolAucpBln=Boolean.TRUE; + obtenerCentroControl(solicitud); + }else{ + requiereNoSolAucpBln=Boolean.FALSE; + } + + + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_tramiteSinDatosAsociados")); + } + + Date fechaLimiteDate = TgeneNotAccountingDayController.diasLaborablesPreviosAUnaFecha(new Date(), diasLaborablesPermitidos); + Calendar fechaLimite = Calendar.getInstance(); + fechaLimite.setTime(fechaLimiteDate); + fechaLimite.set(Calendar.HOUR_OF_DAY, 0); + fechaLimite.set(Calendar.MINUTE, 0); + fechaLimite.set(Calendar.SECOND, 0); + + Calendar fechaSolicitud = Calendar.getInstance(); + fechaSolicitud.setTime(solicitud.getFverificarequisitos()); + fechaSolicitud.set(Calendar.SECOND, 1); + + if(fechaSolicitud.compareTo(fechaLimite)<0){ + isOnlyMsj = true; + record.setEstadotramite("ANU"); + record.setEstadotramitecodigo("ESTADOSOLICITUD"); + super.update(); + // this.save(); + RequestContext.getCurrentInstance().update("messages"); + } + else{ + isDenied = false; + } + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_tramiteSinDatosAsociados")); + } + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_tramiteSinDatosAsociados")); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * @param solicitud + * @throws Exception + * + */ + private void obtenerCentroControl(TarmSolicitud solicitud) throws Exception { + + this.centroControl= CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + this.setNombreInstitucion(CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 500; + this.beanalias = "CARGARDEPOSITO"; + isDenied = true; + diasLaborablesPermitidos = Integer.parseInt(ParametersController.find("DIASDEPOSITO", "1").getNumbervalue().toString()); + isTrueNComprobante = Boolean.TRUE; + isOnlyMsj = false; + isEnableGrabar = Boolean.TRUE; + isEnableCompletarTarea = Boolean.FALSE; + obtenerCentroControlSolicitante(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Metodo que devuelve el centro de control al que pertenece el cliente dueno de la solicitud + * @throws Exception + */ + private void obtenerCentroControlSolicitante() throws Exception { + TsafeUserDetail tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if(tcustPersonAddres!=null && tcustPersonAddres.getProvincecode()!=null){ + }else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_notienedireccionprincipal")); + return; + } + + } + + /** + * Accion que reinicia todas las variables de la pagina + */ + public void cancelar(){ + init(); + } + + /** + * Metodo que permite grabar el formulario junto al comprobante de deposito en el Alfresco + * */ + @Override + public void save() { + try { + String xPathLocation= getRutaDocumentoSolBase() + "/cm:" + solicitud.getNumerosolicitud() + "/cm:" + "Deposito"; + if(record.getValorverificacion() != null && record.getValorverificacion().doubleValue()>0){ + if(isTrueNComprobante){ + if(!record.getFechacomprobante().after(new Date())){ + if(uploadedFile!=null && uploadedFile.getFileName()!=null){ + String extencionArchivo=getExtension(uploadedFile.getFileName()); + String nombreArchivo = "CMPRBNT-"+solicitud.getNumerosolicitud()+"."+extencionArchivo; + if(alfrescoController.uploadFile(uploadedFile.getInputstream(),nombreArchivo, xPathLocation)){ + record.setXpathcomprobante(xPathLocation + "/cm:" + nombreArchivo); + //validamos si adjunta la resolucion + if(uploadedFileResolucion != null && uploadedFileResolucion.getFileName()!=null){ + String xPathLocationResolucion= getRutaDocumentoSolBase() + "/cm:" + solicitud.getNumerosolicitud() + "/cm:" + "Resolucion"; + String extencionArchivoResolucion=getExtension(uploadedFileResolucion.getFileName()); + String nombreArchivoResolucion = "RESOLUCION-"+solicitud.getNumerosolicitud()+"."+extencionArchivoResolucion; + if(alfrescoController.uploadFile(uploadedFileResolucion.getInputstream(),nombreArchivoResolucion, xPathLocationResolucion)){ + record.setXpathresolucion(xPathLocationResolucion + "/cm:" + nombreArchivoResolucion); + }else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_adjuntar_resolucion")); + return; + } + } + super.update(); + DtoSave dtosave = super.getDtoSave(); + HashMap msave = new HashMap(); + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + isDenied = true; + isEnableCompletarTarea = Boolean.TRUE; + isEnableGrabar = Boolean.FALSE; + FacesContext context = FacesContext.getCurrentInstance(); + context.addMessage(null, new FacesMessage("RECUERDE", MsgControlArmas.getProperty("msg_recuerdeClickContinuarTramite"))); + } else { + MessageHelper.setMessageError(resp); + } + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_tramiteSinDatosAsociados")); + } + } + else{ +// MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_archivo")); + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingreseComprobanteDeposito")); + } + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_fechaDepositoMayorFechaActual")); + } + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_comprobanteDepositoUsado")); + } + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_valorDepositoNegativoCero")); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Throwable e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Metodo que retorna la extencion del comprobante de deposito que se desea subir al alfresco + */ + public String getExtension(String filename) { + int index = filename.lastIndexOf('.'); + if (index == -1) { + return ""; + } else { + return filename.substring(index + 1); + } + } + + /** + * Metodo de consulta no utilizado pero sobrescrito por requisito de herencia + */ + @Override + protected void querydatabase() { + try { + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void consultaTramites(){ + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + + SubQuery subqueryTipo= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog= (select o.estado from TarmSolicitud o where o.pk=t.pk.csolicitud) and " + + " i.pk.catalogcode=(select o.estadocodigo from TarmSolicitud o where o.pk=t.pk.csolicitud)"); + SubQuery subqueryEstadoTramite= new SubQuery("TgeneCatalogDetail","description","estadotramite","i.pk.catalog= t.estadotramite and" + + " i.pk.catalogcode=t.estadotramitecodigo"); + + dto.addSubQuery(subqueryEstadoTramite); + SubQuery subquerysolicitud= new SubQuery("TarmSolicitud","numerosolicitud","solicitud","i.pk=t.pk.csolicitud"); + dto.addSubQuery(subquerysolicitud); + dto.setOrderby("t.pk"); + + TsafeUserDetail tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + Filter filtro= new Filter(); + filtro.setSql("(numerocomprobante is null OR inicioFlujo is null) and estadotramite='REG' and valorapagar>0 and " + + " csolicitud in(select o.pk from TarmSolicitud o where o.personcode ='"+tsafeUserDetailUsuario.getPk().getPersoncode()+"' and o.estado ='APB')"); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void solicitudSeleccionada(TarmSolicitudTramite tarmSolicitudTramite){ + try { + numTramite=tarmSolicitudTramite.getNumerotramite(); + consultarSolicitud(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(solicitud.getFregistro()); + StringBuilder ruta = new StringBuilder("cm:Solicitudes"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + return ruta.toString(); + } + + /** + * Metodo para validar el comprobante de deposito/ + */ + public void validarComprobanteDeposito(){ + List usandoComprobanteList = SolicitudTramiteController.findByNumeroComprobante(this.record.getNumerocomprobante()); + if(usandoComprobanteList!=null && usandoComprobanteList.size()>0){ + isTrueNComprobante = Boolean.FALSE; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_comprobanteDepositoUsado")); + } + else{ + isTrueNComprobante = Boolean.TRUE; + } + } + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en el Alfresco + */ + public void handleUpload(FileUploadEvent event){ + uploadedFile = event.getFile(); + } + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en el Alfresco + */ + public void handleUploadResolucion(FileUploadEvent event){ + uploadedFileResolucion = event.getFile(); + } + + /** + * Recorta el nombre del archivo a cargarse + * @param nombre + * @return nombre recortado + */ + public String recorteNombre(String nombre){ + String fielname=nombre; + if(fielname.length()>30){ + fielname=fielname.substring(0,30)+extencionArchivo(nombre); + } + return fielname; + } + + /** + * Obtiene la extencion del archivo a cargar + * @param nombre + * @return + */ + private String extencionArchivo(String nombre){ + int pos=nombre.lastIndexOf('.'); + nombre=nombre.substring(pos); + return nombre; + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void iniciarFlujo() { + + try { + TarmSolicitud tarmSolicitud=SolicitudController.findSolicitudxcodsolicitud(record.getPk().getCsolicitud()); + if(tarmSolicitud==null || tarmSolicitud.getModifiedData()==null || tarmSolicitud.getModifiedData().get("provincecode")==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinprovincia")); + return; + } + cprovincia=tarmSolicitud.getModifiedData().get("provincecode").toString(); + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("isnew", "Y"); + request.modifiedData().put("csolicitud", record.getPk().getCsolicitud()); + request.modifiedData().put("numerotransaccion", record.getPk().getCtramite()); + request.modifiedData().put("numerosolicitud", solicitud.getNumerosolicitud()); + request.modifiedData().put("cprovincia", cprovincia); + request.setLogsolicitude(solicitud.getNumerosolicitud()); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + " No SOLICITUD: " +solicitud.getNumerosolicitud()); + isEnableCompletarTarea = Boolean.FALSE; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para validar que el valor del comprobante de deposito sea mayor a cero + */ + public void valorMayorACero(){ + if(record.getValorverificacion().doubleValue()<=0){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_valorDepositoNegativoCero")); + } + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public TgeneCatalogDetail getNombreTramite() { + return nombreTramite; + } + + public void setNombreTramite(TgeneCatalogDetail nombreTramite) { + this.nombreTramite = nombreTramite; + } + + public TgeneCatalogDetail getNombreCategoria() { + return nombreCategoria; + } + + public void setNombreCategoria(TgeneCatalogDetail nombreCategoria) { + this.nombreCategoria = nombreCategoria; + } + + public TgeneCatalogDetail getNombreUsoActividad() { + return nombreUsoActividad; + } + + public void setNombreUsoActividad(TgeneCatalogDetail nombreUsoActividad) { + this.nombreUsoActividad = nombreUsoActividad; + } + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + + this.uploadedFile = uploadedFile; + } + + public Boolean getIsDenied() { + return isDenied; + } + + public void setIsDenied(Boolean isDenied) { + this.isDenied = isDenied; + } + + public Boolean getIsOnlyMsj() { + return isOnlyMsj; + } + + public void setIsOnlyMsj(Boolean isOnlyMsj) { + this.isOnlyMsj = isOnlyMsj; + } + + public Boolean getIsTrueNComprobante() { + return isTrueNComprobante; + } + + public void setIsTrueNComprobante(Boolean isTrueNComprobante) { + this.isTrueNComprobante = isTrueNComprobante; + } + + public Boolean getIsEnableCompletarTarea() { + return isEnableCompletarTarea; + } + + public void setIsEnableCompletarTarea(Boolean isEnableCompletarTarea) { + this.isEnableCompletarTarea = isEnableCompletarTarea; + } + + public String getNumTramite() { + return numTramite; + } + + public void setNumTramite(String numTramite) { + this.numTramite = numTramite; + } + + + public Boolean getIsEnableGrabar() { + return isEnableGrabar; + } + + + public void setIsEnableGrabar(Boolean isEnableGrabar) { + this.isEnableGrabar = isEnableGrabar; + } + + public Boolean getRequiereNoSolAucpBln() { + return requiereNoSolAucpBln; + } + + public void setRequiereNoSolAucpBln(Boolean requiereNoSolAucpBln) { + this.requiereNoSolAucpBln = requiereNoSolAucpBln; + } + + public String getNombreInstitucion() { + return nombreInstitucion; + } + + public String setNombreInstitucion(String nombreInstitucion) { + if(nombreInstitucion!=null && !nombreInstitucion.isEmpty()){ + this.nombreInstitucion = nombreInstitucion; + }else{ + this.nombreInstitucion = ""; + } + + return nombreInstitucion; + } + + + public UploadedFile getUploadedFileResolucion() { + return uploadedFileResolucion; + } + + + public void setUploadedFileResolucion(UploadedFile uploadedFileResolucion) { + this.uploadedFileResolucion = uploadedFileResolucion; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CertificadoArmasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CertificadoArmasController.java.svn-base new file mode 100644 index 0000000..3e186e7 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CertificadoArmasController.java.svn-base @@ -0,0 +1,126 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pentaho.PentahoController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmCertificadoArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; + +/** + * Clase controladora del bean TarmCertificadoArmas. + * + * @author Christian Pazmino + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CertificadoArmasController extends AbstractController { + + /** + * Constructor + * @throws Exception + */ + public CertificadoArmasController() throws Exception { + super(TarmCertificadoArmas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CERTIFICADOARMAS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + public void update(TarmCertificadoArmas bean) throws Exception { + this.setRecord(bean); + super.update(); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CertificadoFiscaliaController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CertificadoFiscaliaController.java.netbeans-base new file mode 100644 index 0000000..8cc0e3d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CertificadoFiscaliaController.java.netbeans-base @@ -0,0 +1,836 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.math.BigDecimal; +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; +import javax.servlet.http.HttpSession; + +import org.apache.commons.lang3.StringUtils; +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.menu.MenuController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmCertificadoArmas; +import com.fp.persistence.parmas.soli.TarmCertificadoArmasKey; +import com.fp.persistence.parmas.soli.TarmCertificadoFiscalia; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Controlador que permite genereal los certificados de Fiscalia + * @author Manuel Cepeda + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CertificadoFiscaliaController extends AbstractController { + + private String razonSocial; + private String numeroDocumento; + private String lote; + private boolean panelPerson; + private boolean panelSinDatosPerson; + private boolean panelSinDatosArma; + private String filtroPersona; + private List listaArmas; + private List listaArmasBySerie; + + @ManagedProperty(value = "#{personLovController}") + private PersonLovController personLovController; + + @ManagedProperty(value = "#{certificadoArmasController}") + private CertificadoArmasController certificadoArmasController; + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + private String sessionID; + private TcustPersonDetail tcustPersonDetail; + private String nroSolicitud; + private TarmCentroControl centroControl; + private TarmCertificadoFiscalia certificadoFiscalia; + @ManagedProperty(value = "#{solicitudCertificadoController}") + private SolicitudCertificadoController solicitudCertificadoController; + /** + * Bandera de tipo booleano para indicar si se habilita el boton de completar tarea + */ + private Boolean esTareaCompleta = Boolean.FALSE; + + + /** + * Clase controladora de funcionalidad del Alfresco + */ + @ManagedProperty(value="#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * Deshabilita la pantalla después de grabar la solicitud + */ + private boolean deshabilitarPantalla; + + + public CertificadoFiscaliaController() throws Exception { + super(TarmArmas.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + try { + super.startQuery(); + nroSolicitud = this.getMfilters().get("csolicitud"); + this.getMfilters().clear(); + this.getPersonLovController().getMfilters().clear(); + this.getCertificadoArmasController().getMfilters().clear(); + this.getSolicitudCertificadoController().getMfilters().clear(); + + this.init(); + panelPerson = true; + panelSinDatosPerson = false; + panelSinDatosArma = false; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + panelSinDatosPerson = false; + panelSinDatosArma = false; + + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + + filtroPersona = ""; + certificadoFiscalia = SolicitudCertificadoController.findPorSolicitud(nroSolicitud.trim()); + HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false); + sessionID = session.getId(); +// recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + centroControl=Utilidades.obtenerCentroControl(); + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + if(tsafeUserDetail!=null && tsafeUserDetail.getPk().getPersoncode()!=null){ + tcustPersonDetail=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() throws Exception { + super.next(); + } + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception{ + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TarmTipoArmaExplosivo","clase","cclase","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo= new SubQuery("TarmTipoArmaExplosivo","clasecodigo","cclasecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud= new SubQuery("TarmTipoArmaExplosivo","longitud","clongitud","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo= new SubQuery("TarmTipoArmaExplosivo","longitudcodigo","clongitudcodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ccalibre","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo= new SubQuery("TarmTipoArmaExplosivo","calibrecodigo","ccalibrecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivo","ctipoarmaexplosivo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivocodigo","ctipoarmaexplosivocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapeso","cunidadmedidapeso","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapesocodigo","cunidadmedidapesocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida= new SubQuery("TgeneCatalogDetail","description","unidadmedida","i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode= new SubQuery("TarmRegistroArmas","personcode","personcode","i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + + return dto; + } + + @Override + public void save() { + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + if(esTareaCompleta){ + return; + } + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("csolicitud", nroSolicitud); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + esTareaCompleta=Boolean.TRUE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + /** + * Genera el certificado de armas para la Fiscalia y sube al Alfresco el pdf + */ + public void generarReporte() { + if(deshabilitarPantalla){ + return; + } + + String path = "armas/reports/certificadosArmas"; + Boolean aux=Boolean.FALSE; + java.util.Date today = new java.util.Date(); + java.sql.Timestamp fechaReporte = new java.sql.Timestamp(today.getTime()); + Random aleatorio = new Random(); + int ticketGenerado = aleatorio.nextInt(); + int i=0; + + for(TarmArmas armasel:lrecord){ + i++; + if(armasel.getModifiedData().get("seleccionado")!=null && armasel.getModifiedData().get("seleccionado").equals(Boolean.TRUE)){ + aux=Boolean.TRUE; + guardarCertificadoReporte(armasel, i, ticketGenerado, fechaReporte); + } + } + if(!aux){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nohaseleccionadoarmas")); + return; + } + certificadoArmasController.save(); + try { + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("codResponsable", centroControl.getPersoncode()); + parameters.put("gradoresponsable","" ); //centroControl.getModifiedData().get("desgrado") + parameters.put("nombreresponsable",centroControl.getModifiedData().get("desgrado")+" "+ centroControl.getModifiedData().get("nombre")); + parameters.put("centrocontrol", String.valueOf(centroControl.getModifiedData().get("desnombreinstitucion"))); + parameters.put("sessionID",sessionID); + parameters.put("nroSolicitud",certificadoFiscalia.getNroficiofiscalia()); +// parameters.put("fechaReporte",fechaReporte); + + parameters.put("ticket",ticketGenerado); + parameters.put("personCodeLogin",(tcustPersonDetail!=null && tcustPersonDetail.getPk()!=null)?tcustPersonDetail.getPk().getPersoncode():null); + if(tcustPersonDetail!=null){ + parameters.put("usuario", tcustPersonDetail.getName()); + } + parameters.put("unidadmilitar", MsgControlArmas.getProperty("msg_inf_digitadordel")+" "+String.valueOf(centroControl.getModifiedData().get("desnombreinstitucion"))); + String format="pdf"; + String filename="Certificado"; + + InputStream file =this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + String xPathLocation= getRutaDocumentoCertificadoBase() + "/cm:" + this.nroSolicitud; + String nombreArchivo = "CERT" + nroSolicitud + ".pdf"; + alfrescoController.uploadFile(file, nombreArchivo, xPathLocation); + + //actualizar solicitudCertificadoController + solicitudCertificadoController.getMfilters().put("nrsolicitud", nroSolicitud); + solicitudCertificadoController.querydatabase(); + TarmCertificadoFiscalia tarmCertificadoFiscalia = solicitudCertificadoController.getRecord(); + tarmCertificadoFiscalia.setIsnew(false); + tarmCertificadoFiscalia.setXpathSolicitudArma(xPathLocation+"/cm:"+nombreArchivo); + + solicitudCertificadoController.getLrecord().add(tarmCertificadoFiscalia); + solicitudCertificadoController.update(); + solicitudCertificadoController.save(); + deshabilitarPantalla = Boolean.TRUE; + MessageHelper.setMessageInfo("Se genero el certificado exitosamente."); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoCertificadoBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new java.util.Date()); + StringBuilder ruta = new StringBuilder("cm:Certificados"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + return ruta.toString(); + } + + /** + * Guarda los datos de las Armas solicitadas por el Fiscal a la bdd + * @param armaObj + * @param orden + * @param ticket + * @param fechaReporte + */ + private void guardarCertificadoReporte(TarmArmas armaObj,int orden,int ticket, java.sql.Timestamp fechaReporte){ + TarmCertificadoArmas certificadoArmasObj = new TarmCertificadoArmas(); + TarmCertificadoArmasKey pk = new TarmCertificadoArmasKey(); + certificadoArmasObj.setPk(pk); + try { + certificadoArmasObj.getPk().setFechareporte(fechaReporte); + certificadoArmasObj.getPk().setSessionid(sessionID); + certificadoArmasObj.getPk().setOrden(orden); + certificadoArmasObj.setIdentification(armaObj.getModifiedData().get("noDocumento")!=null?armaObj.getModifiedData().get("noDocumento").toString():null); + certificadoArmasObj.setName(armaObj.getModifiedData().get("propietario")!=null?armaObj.getModifiedData().get("propietario").toString():null); + certificadoArmasObj.setRegisterdate(armaObj.getFecharegistro()); + certificadoArmasObj.setClase(armaObj.getModifiedData().get("clase")!=null?armaObj.getModifiedData().get("clase").toString():null); + certificadoArmasObj.setTipoarmaexplosivo(armaObj.getModifiedData().get("tipoarmaexplosivo")!=null?armaObj.getModifiedData().get("tipoarmaexplosivo").toString():null); + certificadoArmasObj.setMarca(armaObj.getModifiedData().get("marca")!=null?armaObj.getModifiedData().get("marca").toString():null); + certificadoArmasObj.setCalibre(armaObj.getModifiedData().get("calibre")!=null?armaObj.getModifiedData().get("calibre").toString():null); + certificadoArmasObj.setLote(armaObj.getLote()); + certificadoArmasObj.setPaisfabricacion(armaObj.getModifiedData().get("paisorigen")!=null?armaObj.getModifiedData().get("paisorigen").toString():null); + certificadoArmasObj.setEstado(armaObj.getModifiedData().get("estado")!=null?armaObj.getModifiedData().get("estado").toString():null); + certificadoArmasObj.setUsercode((tcustPersonDetail!=null && tcustPersonDetail.getPk()!=null)?tcustPersonDetail.getPk().getPersoncode().toString():null); + certificadoArmasObj.setTicket(ticket); + certificadoArmasObj.setPermiso((armaObj.getModifiedData().get("permiso") != null) ? armaObj.getModifiedData().get("permiso").toString() : "");//armaObj.getModifiedData().get("permiso").toString()); + certificadoArmasObj.setFechaemison((Date) armaObj.getModifiedData().get("fechaemision")); + certificadoArmasObj.setFechaexpiracion((Date)armaObj.getModifiedData().get("fechaexpiracion")); + certificadoArmasObj.setIsnew(true); + certificadoArmasController.update(certificadoArmasObj); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Selecciona el objeto TcustPersonDetail de la tabla actual de la pagina + * @param person + */ + public void setPerson(TcustPersonDetail person) { + if(person != null){ + panelPerson = false; + filtroPersona = " and t.cregistro in (select i.pk from TarmRegistroArmas i where i.personcode ="+person.getPk().getPersoncode()+")"; + querydatabaseArma(); + setRazonSocial(person.getName()); + setNumeroDocumento(person.getIdentification()); + } + } + + /** + * Permite consultar en la tabla armas mediante el codigo de la persona + */ + protected void querydatabaseArma() { + try { + DtoQuery dto = this.getDtoQuery(); + dto.setOrderby("pk"); + Filter filtro = new Filter(); + String sql="t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma) and t.estado !='DEST' and t.estado!='VEND' and t.estado!='MING' and t.estado!='DUPL' and t.estado!='CUSTEM'" + + " and (t.peso>0 or t.cantidad>0) " + filtroPersona;// + filtro.setSql(sql); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + listaArmas = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + listaArmas= (List) resp.get(this.beanalias); + actualizarDatos(listaArmas); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Permite actualizar los datos de la Entidad TarmAmas + * @param listaArmas + */ + private void actualizarDatos(List listaArmas){ + for(TarmArmas armasObj:listaArmas){ + TarmRegistroArmas registroArmasObj = RegistroArmController.findByCodigo(armasObj.getCregistro().toString()); + if(registroArmasObj!=null && registroArmasObj.getPersoncode()!=null){ + TcustPersonDetail propietarioObj = PersonDetailController.find(registroArmasObj.getPersoncode().toString()); + if(propietarioObj.getIdentificationcatalog()!=null && propietarioObj.getIdentificationcatalogcode()!=null){ + armasObj.getModifiedData().put("tipoDocumento", CatalogDetailController.findxCodigoCodcatalogo(propietarioObj.getIdentificationcatalog(), propietarioObj.getIdentificationcatalogcode()).getDescription()); + } + armasObj.getModifiedData().put("noDocumento", propietarioObj.getIdentification()); + armasObj.getModifiedData().put("nombrerazonsocial", propietarioObj.getName()); + armasObj.getModifiedData().put("paisorigencode", registroArmasObj.getPaisorigen()); + if(armasObj.getModifiedData().get("cclase")!=null){ + armasObj.getModifiedData().put("clase", CatalogDetailController.findxCodigoCodcatalogo(armasObj.getModifiedData().get("cclase").toString(), armasObj.getModifiedData().get("cclasecodigo").toString()).getDescription()); + } + if(armasObj.getModifiedData().get("ctipoarmaexplosivo")!=null){ + armasObj.getModifiedData().put("tipoarmaexplosivo", CatalogDetailController.findxCodigoCodcatalogo(armasObj.getModifiedData().get("ctipoarmaexplosivo").toString(), armasObj.getModifiedData().get("ctipoarmaexplosivocodigo").toString()).getDescription()); + } + if(armasObj.getModifiedData().get("ccalibre")!=null){ + armasObj.getModifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(armasObj.getModifiedData().get("ccalibre").toString(), armasObj.getModifiedData().get("ccalibrecodigo").toString()).getDescription()); + } + + TarmDocumentoHabilitante documentoHabilitante = DocumentoHabilitanteController.findxarma(armasObj.getPk()); + if(documentoHabilitante != null ){ + armasObj.getModifiedData().put("fechaemision", documentoHabilitante.getFechaemision()); + armasObj.getModifiedData().put("fechaexpiracion", documentoHabilitante.getFechaexpiracion()); + TarmTramite tarmTramite = TarmTramiteController.find(documentoHabilitante.getCtramite().toString()); + if(tarmTramite != null){ + armasObj.getModifiedData().put("permiso", tarmTramite.getModifiedData().get("usoactividad")); + } + } + + //cargarPropietario + armasObj.getModifiedData().put("ordenarma",armasObj.getPk()); + if(armasObj.getModifiedData().get("personcode")!=null){ + TcustPersonDetail personaDetalle=PersonDetailController.find(armasObj.getModifiedData().get("personcode").toString()); + armasObj.getModifiedData().put("propietario", personaDetalle.getName()); + armasObj.getModifiedData().put("noDocumento", personaDetalle.getIdentification()); + armasObj.getModifiedData().put("nombrerazonsocial", personaDetalle.getName()); + } + } + } + } + + /** + * Permite consultar en la tabla armas mediante el lote/serie de armas + */ + public void querydatabaseSerie() { + try { + DtoQuery dto = this.getDtoQuery(); + String sqlFiltroEstados = ""; + String sqlFiltroCodigosArmas = "";//1 + + dto.setOrderby("pk"); + String sqlActual = " t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma) " + + " and (t.peso>0 or t.cantidad>0)";// and (t.cregistro=ta.cregistro) para el manejo de los explosivos + String sqlFinal = obtenerFiltroBusquedaGeneral(sqlFiltroEstados, sqlFiltroCodigosArmas, sqlActual); + Filter filtroFinal = new Filter(); + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + listaArmasBySerie = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + listaArmasBySerie = (List) resp.get(this.beanalias); + actualizarDatos(listaArmasBySerie); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que agrega dinamicamente los filtros a una consulta SQL + * @param sqlFiltros + * @return String + */ + private String obtenerFiltroBusquedaGeneral(String... sqlFiltros ){ + StringBuffer sqlFinal = new StringBuffer(); + for (int i = 0; i < sqlFiltros.length ; i++) { + if(sqlFinal.length() > 0 && !StringUtils.endsWith(StringUtils.trim(sqlFinal.toString()), "AND")){ + sqlFinal.append( " AND "); + } + sqlFinal.append(sqlFiltros[i]); + } + return sqlFinal.toString(); + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if(Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")){ + valorColocar = Boolean.TRUE; + } + for (TarmArmas tarmArmas : listaArmas) { + tarmArmas.getModifiedData().put("seleccionado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Permite actualizar el campo seleccionado en la entidad tarmArmas + */ + public void actualizarDatosArma(){ + for(TarmArmas tarmArmas : listaArmas){ + if(tarmArmas.getModifiedData().get("seleccionado").equals(Boolean.TRUE)){ + this.getLrecord().add(tarmArmas); + } + } + panelPerson = true; + personLovController.init(); + personLovController.getMfilters().clear(); + getMfilters().clear(); + } + + /** + * Permite actualizar el campo seleccionado en la entidad tarmArmas + */ + public void actualizarDatosArmaSerie(){ + for(TarmArmas tarmArmas : listaArmasBySerie){ + if(tarmArmas.getModifiedData().get("seleccionado").equals(Boolean.TRUE)){ + this.getLrecord().add(tarmArmas); + } + } + panelPerson = true; + setPanelSinDatosPerson(false); + listaArmasBySerie = new ArrayList<>(); + this.getMfilters().clear(); + } + + /** + * Metodo para extrer solo elnoimbre del archivo + * @param xpath xpath del archivo en alfresco + * @return solo la parte correspondiente al nombre del archivo + */ + public String soloNombreArchivo(String xpath){ + return xpath.substring(xpath.lastIndexOf(":") + 1,xpath.length()); + } + + public void onReturnPersonLov(){ + numeroDocumento = ""; + razonSocial = ""; + setPanelPerson(true); + setPanelSinDatosPerson(false); + setPanelSinDatosArma(false); + getMfilters().clear(); + } + + + public void emptyPerson(){ + if((lote == null || "".equals(lote)) && (numeroDocumento == null || "".equals(numeroDocumento)) && (razonSocial == null || "".equals(razonSocial))){ + MessageHelper.setMessageError("Ingrese el campo Identificacin o el campo Nombre"); + return; + } + + TarmArmas obj = new TarmArmas(); + if(razonSocial == null || "".equals(razonSocial)){ + razonSocial = "N/A"; + } + + if(lote != null && !"".equals(lote)){ + obj.setLote(lote); + } + + if(numeroDocumento != null || !"".equals(numeroDocumento)){ + obj.getModifiedData().put("noDocumento", numeroDocumento); + } + + obj.getModifiedData().put("nombrerazonsocial", razonSocial); + obj.getModifiedData().put("propietario", razonSocial); + obj.getModifiedData().put("permiso", "No se registra permisos en el sistema"); + lrecord.add(obj); + + personLovController.init(); + personLovController.getMfilters().clear(); + setLote(""); + numeroDocumento = ""; + razonSocial = ""; + } + + public boolean isPanelPerson() { + return panelPerson; + } + + public void setPanelPerson(boolean panelPerson) { + this.panelPerson = panelPerson; + } + + public List getListaArmas() { + return listaArmas; + } + + public void setListaArmas(List listaArmas) { + this.listaArmas = listaArmas; + } + + /** + * @return the razonSocial + */ + public String getRazonSocial() { + return razonSocial; + } + + /** + * @param razonSocial the razonSocial to set + */ + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + /** + * @return the numeroDocumento + */ + public String getNumeroDocumento() { + return numeroDocumento; + } + + /** + * @param numeroDocumento the numeroDocumento to set + */ + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + /** + * @return the personLovController + */ + public PersonLovController getPersonLovController() { + return personLovController; + } + + /** + * @param personLovController the personLovController to set + */ + public void setPersonLovController(PersonLovController personLovController) { + this.personLovController = personLovController; + } + + /** + * @return the listaArmasBySerie + */ + public List getListaArmasBySerie() { + return listaArmasBySerie; + } + + /** + * @param listaArmasBySerie the listaArmasBySerie to set + */ + public void setListaArmasBySerie(List listaArmasBySerie) { + this.listaArmasBySerie = listaArmasBySerie; + } + + /** + * @return the certificadoArmasController + */ + public CertificadoArmasController getCertificadoArmasController() { + return certificadoArmasController; + } + + /** + * @param certificadoArmasController the certificadoArmasController to set + */ + public void setCertificadoArmasController( + CertificadoArmasController certificadoArmasController) { + this.certificadoArmasController = certificadoArmasController; + } + + /** + * @return the reportController + */ + public ReportController getReportController() { + return reportController; + } + + /** + * @param reportController the reportController to set + */ + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + } + + /** + * @return the alfrescoController + */ + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + /** + * @param alfrescoController the alfrescoController to set + */ + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + /** + * @return the solicitudCertificadoController + */ + public SolicitudCertificadoController getSolicitudCertificadoController() { + return solicitudCertificadoController; + } + + /** + * @param solicitudCertificadoController the solicitudCertificadoController to set + */ + public void setSolicitudCertificadoController( + SolicitudCertificadoController solicitudCertificadoController) { + this.solicitudCertificadoController = solicitudCertificadoController; + } + + /** + * @return the certificadoFiscalia + */ + public TarmCertificadoFiscalia getCertificadoFiscalia() { + return certificadoFiscalia; + } + + /** + * @param certificadoFiscalia the certificadoFiscalia to set + */ + public void setCertificadoFiscalia(TarmCertificadoFiscalia certificadoFiscalia) { + this.certificadoFiscalia = certificadoFiscalia; + } + + /** + * @return the nroSolicitud + */ + public String getNroSolicitud() { + return nroSolicitud; + } + + /** + * @param nroSolicitud the nroSolicitud to set + */ + public void setNroSolicitud(String nroSolicitud) { + this.nroSolicitud = nroSolicitud; + } + + /** + * @return the esTareaCompleta + */ + public boolean isEsTareaCompleta() { + return esTareaCompleta; + } + + /** + * @param esTareaCompleta the esTareaCompleta to set + */ + public void setEsTareaCompleta(boolean esTareaCompleta) { + this.esTareaCompleta = esTareaCompleta; + } + + /** + * @return the panelSinDatosPerson + */ + public boolean isPanelSinDatosPerson() { + return panelSinDatosPerson; + } + + /** + * @param panelSinDatosPerson the panelSinDatosPerson to set + */ + public void setPanelSinDatosPerson(boolean panelSinDatosPerson) { + this.panelSinDatosPerson = panelSinDatosPerson; + } + + /** + * @return the panelSinDatosArma + */ + public boolean isPanelSinDatosArma() { + return panelSinDatosArma; + } + + /** + * @param panelSinDatosArma the panelSinDatosArma to set + */ + public void setPanelSinDatosArma(boolean panelSinDatosArma) { + this.panelSinDatosArma = panelSinDatosArma; + } + + /** + * @return the lote + */ + public String getLote() { + return lote; + } + + /** + * @param lote the lote to set + */ + public void setLote(String lote) { + this.lote = lote; + } + + /** + * @return the deshabilitarPantalla + */ + public boolean isDeshabilitarPantalla() { + return deshabilitarPantalla; + } + + /** + * @param deshabilitarPantalla the deshabilitarPantalla to set + */ + public void setDeshabilitarPantalla(boolean deshabilitarPantalla) { + this.deshabilitarPantalla = deshabilitarPantalla; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CertificadoFiscaliaController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CertificadoFiscaliaController.java.svn-base new file mode 100644 index 0000000..8cc0e3d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CertificadoFiscaliaController.java.svn-base @@ -0,0 +1,836 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.math.BigDecimal; +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; +import javax.servlet.http.HttpSession; + +import org.apache.commons.lang3.StringUtils; +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.menu.MenuController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmCertificadoArmas; +import com.fp.persistence.parmas.soli.TarmCertificadoArmasKey; +import com.fp.persistence.parmas.soli.TarmCertificadoFiscalia; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Controlador que permite genereal los certificados de Fiscalia + * @author Manuel Cepeda + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CertificadoFiscaliaController extends AbstractController { + + private String razonSocial; + private String numeroDocumento; + private String lote; + private boolean panelPerson; + private boolean panelSinDatosPerson; + private boolean panelSinDatosArma; + private String filtroPersona; + private List listaArmas; + private List listaArmasBySerie; + + @ManagedProperty(value = "#{personLovController}") + private PersonLovController personLovController; + + @ManagedProperty(value = "#{certificadoArmasController}") + private CertificadoArmasController certificadoArmasController; + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + private String sessionID; + private TcustPersonDetail tcustPersonDetail; + private String nroSolicitud; + private TarmCentroControl centroControl; + private TarmCertificadoFiscalia certificadoFiscalia; + @ManagedProperty(value = "#{solicitudCertificadoController}") + private SolicitudCertificadoController solicitudCertificadoController; + /** + * Bandera de tipo booleano para indicar si se habilita el boton de completar tarea + */ + private Boolean esTareaCompleta = Boolean.FALSE; + + + /** + * Clase controladora de funcionalidad del Alfresco + */ + @ManagedProperty(value="#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * Deshabilita la pantalla después de grabar la solicitud + */ + private boolean deshabilitarPantalla; + + + public CertificadoFiscaliaController() throws Exception { + super(TarmArmas.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + try { + super.startQuery(); + nroSolicitud = this.getMfilters().get("csolicitud"); + this.getMfilters().clear(); + this.getPersonLovController().getMfilters().clear(); + this.getCertificadoArmasController().getMfilters().clear(); + this.getSolicitudCertificadoController().getMfilters().clear(); + + this.init(); + panelPerson = true; + panelSinDatosPerson = false; + panelSinDatosArma = false; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + panelSinDatosPerson = false; + panelSinDatosArma = false; + + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + + filtroPersona = ""; + certificadoFiscalia = SolicitudCertificadoController.findPorSolicitud(nroSolicitud.trim()); + HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false); + sessionID = session.getId(); +// recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + centroControl=Utilidades.obtenerCentroControl(); + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + if(tsafeUserDetail!=null && tsafeUserDetail.getPk().getPersoncode()!=null){ + tcustPersonDetail=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() throws Exception { + super.next(); + } + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception{ + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TarmTipoArmaExplosivo","clase","cclase","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo= new SubQuery("TarmTipoArmaExplosivo","clasecodigo","cclasecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud= new SubQuery("TarmTipoArmaExplosivo","longitud","clongitud","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo= new SubQuery("TarmTipoArmaExplosivo","longitudcodigo","clongitudcodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ccalibre","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo= new SubQuery("TarmTipoArmaExplosivo","calibrecodigo","ccalibrecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivo","ctipoarmaexplosivo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivocodigo","ctipoarmaexplosivocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapeso","cunidadmedidapeso","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapesocodigo","cunidadmedidapesocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida= new SubQuery("TgeneCatalogDetail","description","unidadmedida","i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode= new SubQuery("TarmRegistroArmas","personcode","personcode","i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + + return dto; + } + + @Override + public void save() { + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + if(esTareaCompleta){ + return; + } + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("csolicitud", nroSolicitud); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + esTareaCompleta=Boolean.TRUE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + /** + * Genera el certificado de armas para la Fiscalia y sube al Alfresco el pdf + */ + public void generarReporte() { + if(deshabilitarPantalla){ + return; + } + + String path = "armas/reports/certificadosArmas"; + Boolean aux=Boolean.FALSE; + java.util.Date today = new java.util.Date(); + java.sql.Timestamp fechaReporte = new java.sql.Timestamp(today.getTime()); + Random aleatorio = new Random(); + int ticketGenerado = aleatorio.nextInt(); + int i=0; + + for(TarmArmas armasel:lrecord){ + i++; + if(armasel.getModifiedData().get("seleccionado")!=null && armasel.getModifiedData().get("seleccionado").equals(Boolean.TRUE)){ + aux=Boolean.TRUE; + guardarCertificadoReporte(armasel, i, ticketGenerado, fechaReporte); + } + } + if(!aux){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nohaseleccionadoarmas")); + return; + } + certificadoArmasController.save(); + try { + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("codResponsable", centroControl.getPersoncode()); + parameters.put("gradoresponsable","" ); //centroControl.getModifiedData().get("desgrado") + parameters.put("nombreresponsable",centroControl.getModifiedData().get("desgrado")+" "+ centroControl.getModifiedData().get("nombre")); + parameters.put("centrocontrol", String.valueOf(centroControl.getModifiedData().get("desnombreinstitucion"))); + parameters.put("sessionID",sessionID); + parameters.put("nroSolicitud",certificadoFiscalia.getNroficiofiscalia()); +// parameters.put("fechaReporte",fechaReporte); + + parameters.put("ticket",ticketGenerado); + parameters.put("personCodeLogin",(tcustPersonDetail!=null && tcustPersonDetail.getPk()!=null)?tcustPersonDetail.getPk().getPersoncode():null); + if(tcustPersonDetail!=null){ + parameters.put("usuario", tcustPersonDetail.getName()); + } + parameters.put("unidadmilitar", MsgControlArmas.getProperty("msg_inf_digitadordel")+" "+String.valueOf(centroControl.getModifiedData().get("desnombreinstitucion"))); + String format="pdf"; + String filename="Certificado"; + + InputStream file =this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + String xPathLocation= getRutaDocumentoCertificadoBase() + "/cm:" + this.nroSolicitud; + String nombreArchivo = "CERT" + nroSolicitud + ".pdf"; + alfrescoController.uploadFile(file, nombreArchivo, xPathLocation); + + //actualizar solicitudCertificadoController + solicitudCertificadoController.getMfilters().put("nrsolicitud", nroSolicitud); + solicitudCertificadoController.querydatabase(); + TarmCertificadoFiscalia tarmCertificadoFiscalia = solicitudCertificadoController.getRecord(); + tarmCertificadoFiscalia.setIsnew(false); + tarmCertificadoFiscalia.setXpathSolicitudArma(xPathLocation+"/cm:"+nombreArchivo); + + solicitudCertificadoController.getLrecord().add(tarmCertificadoFiscalia); + solicitudCertificadoController.update(); + solicitudCertificadoController.save(); + deshabilitarPantalla = Boolean.TRUE; + MessageHelper.setMessageInfo("Se genero el certificado exitosamente."); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoCertificadoBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new java.util.Date()); + StringBuilder ruta = new StringBuilder("cm:Certificados"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + return ruta.toString(); + } + + /** + * Guarda los datos de las Armas solicitadas por el Fiscal a la bdd + * @param armaObj + * @param orden + * @param ticket + * @param fechaReporte + */ + private void guardarCertificadoReporte(TarmArmas armaObj,int orden,int ticket, java.sql.Timestamp fechaReporte){ + TarmCertificadoArmas certificadoArmasObj = new TarmCertificadoArmas(); + TarmCertificadoArmasKey pk = new TarmCertificadoArmasKey(); + certificadoArmasObj.setPk(pk); + try { + certificadoArmasObj.getPk().setFechareporte(fechaReporte); + certificadoArmasObj.getPk().setSessionid(sessionID); + certificadoArmasObj.getPk().setOrden(orden); + certificadoArmasObj.setIdentification(armaObj.getModifiedData().get("noDocumento")!=null?armaObj.getModifiedData().get("noDocumento").toString():null); + certificadoArmasObj.setName(armaObj.getModifiedData().get("propietario")!=null?armaObj.getModifiedData().get("propietario").toString():null); + certificadoArmasObj.setRegisterdate(armaObj.getFecharegistro()); + certificadoArmasObj.setClase(armaObj.getModifiedData().get("clase")!=null?armaObj.getModifiedData().get("clase").toString():null); + certificadoArmasObj.setTipoarmaexplosivo(armaObj.getModifiedData().get("tipoarmaexplosivo")!=null?armaObj.getModifiedData().get("tipoarmaexplosivo").toString():null); + certificadoArmasObj.setMarca(armaObj.getModifiedData().get("marca")!=null?armaObj.getModifiedData().get("marca").toString():null); + certificadoArmasObj.setCalibre(armaObj.getModifiedData().get("calibre")!=null?armaObj.getModifiedData().get("calibre").toString():null); + certificadoArmasObj.setLote(armaObj.getLote()); + certificadoArmasObj.setPaisfabricacion(armaObj.getModifiedData().get("paisorigen")!=null?armaObj.getModifiedData().get("paisorigen").toString():null); + certificadoArmasObj.setEstado(armaObj.getModifiedData().get("estado")!=null?armaObj.getModifiedData().get("estado").toString():null); + certificadoArmasObj.setUsercode((tcustPersonDetail!=null && tcustPersonDetail.getPk()!=null)?tcustPersonDetail.getPk().getPersoncode().toString():null); + certificadoArmasObj.setTicket(ticket); + certificadoArmasObj.setPermiso((armaObj.getModifiedData().get("permiso") != null) ? armaObj.getModifiedData().get("permiso").toString() : "");//armaObj.getModifiedData().get("permiso").toString()); + certificadoArmasObj.setFechaemison((Date) armaObj.getModifiedData().get("fechaemision")); + certificadoArmasObj.setFechaexpiracion((Date)armaObj.getModifiedData().get("fechaexpiracion")); + certificadoArmasObj.setIsnew(true); + certificadoArmasController.update(certificadoArmasObj); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Selecciona el objeto TcustPersonDetail de la tabla actual de la pagina + * @param person + */ + public void setPerson(TcustPersonDetail person) { + if(person != null){ + panelPerson = false; + filtroPersona = " and t.cregistro in (select i.pk from TarmRegistroArmas i where i.personcode ="+person.getPk().getPersoncode()+")"; + querydatabaseArma(); + setRazonSocial(person.getName()); + setNumeroDocumento(person.getIdentification()); + } + } + + /** + * Permite consultar en la tabla armas mediante el codigo de la persona + */ + protected void querydatabaseArma() { + try { + DtoQuery dto = this.getDtoQuery(); + dto.setOrderby("pk"); + Filter filtro = new Filter(); + String sql="t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma) and t.estado !='DEST' and t.estado!='VEND' and t.estado!='MING' and t.estado!='DUPL' and t.estado!='CUSTEM'" + + " and (t.peso>0 or t.cantidad>0) " + filtroPersona;// + filtro.setSql(sql); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + listaArmas = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + listaArmas= (List) resp.get(this.beanalias); + actualizarDatos(listaArmas); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Permite actualizar los datos de la Entidad TarmAmas + * @param listaArmas + */ + private void actualizarDatos(List listaArmas){ + for(TarmArmas armasObj:listaArmas){ + TarmRegistroArmas registroArmasObj = RegistroArmController.findByCodigo(armasObj.getCregistro().toString()); + if(registroArmasObj!=null && registroArmasObj.getPersoncode()!=null){ + TcustPersonDetail propietarioObj = PersonDetailController.find(registroArmasObj.getPersoncode().toString()); + if(propietarioObj.getIdentificationcatalog()!=null && propietarioObj.getIdentificationcatalogcode()!=null){ + armasObj.getModifiedData().put("tipoDocumento", CatalogDetailController.findxCodigoCodcatalogo(propietarioObj.getIdentificationcatalog(), propietarioObj.getIdentificationcatalogcode()).getDescription()); + } + armasObj.getModifiedData().put("noDocumento", propietarioObj.getIdentification()); + armasObj.getModifiedData().put("nombrerazonsocial", propietarioObj.getName()); + armasObj.getModifiedData().put("paisorigencode", registroArmasObj.getPaisorigen()); + if(armasObj.getModifiedData().get("cclase")!=null){ + armasObj.getModifiedData().put("clase", CatalogDetailController.findxCodigoCodcatalogo(armasObj.getModifiedData().get("cclase").toString(), armasObj.getModifiedData().get("cclasecodigo").toString()).getDescription()); + } + if(armasObj.getModifiedData().get("ctipoarmaexplosivo")!=null){ + armasObj.getModifiedData().put("tipoarmaexplosivo", CatalogDetailController.findxCodigoCodcatalogo(armasObj.getModifiedData().get("ctipoarmaexplosivo").toString(), armasObj.getModifiedData().get("ctipoarmaexplosivocodigo").toString()).getDescription()); + } + if(armasObj.getModifiedData().get("ccalibre")!=null){ + armasObj.getModifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(armasObj.getModifiedData().get("ccalibre").toString(), armasObj.getModifiedData().get("ccalibrecodigo").toString()).getDescription()); + } + + TarmDocumentoHabilitante documentoHabilitante = DocumentoHabilitanteController.findxarma(armasObj.getPk()); + if(documentoHabilitante != null ){ + armasObj.getModifiedData().put("fechaemision", documentoHabilitante.getFechaemision()); + armasObj.getModifiedData().put("fechaexpiracion", documentoHabilitante.getFechaexpiracion()); + TarmTramite tarmTramite = TarmTramiteController.find(documentoHabilitante.getCtramite().toString()); + if(tarmTramite != null){ + armasObj.getModifiedData().put("permiso", tarmTramite.getModifiedData().get("usoactividad")); + } + } + + //cargarPropietario + armasObj.getModifiedData().put("ordenarma",armasObj.getPk()); + if(armasObj.getModifiedData().get("personcode")!=null){ + TcustPersonDetail personaDetalle=PersonDetailController.find(armasObj.getModifiedData().get("personcode").toString()); + armasObj.getModifiedData().put("propietario", personaDetalle.getName()); + armasObj.getModifiedData().put("noDocumento", personaDetalle.getIdentification()); + armasObj.getModifiedData().put("nombrerazonsocial", personaDetalle.getName()); + } + } + } + } + + /** + * Permite consultar en la tabla armas mediante el lote/serie de armas + */ + public void querydatabaseSerie() { + try { + DtoQuery dto = this.getDtoQuery(); + String sqlFiltroEstados = ""; + String sqlFiltroCodigosArmas = "";//1 + + dto.setOrderby("pk"); + String sqlActual = " t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma) " + + " and (t.peso>0 or t.cantidad>0)";// and (t.cregistro=ta.cregistro) para el manejo de los explosivos + String sqlFinal = obtenerFiltroBusquedaGeneral(sqlFiltroEstados, sqlFiltroCodigosArmas, sqlActual); + Filter filtroFinal = new Filter(); + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + listaArmasBySerie = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + listaArmasBySerie = (List) resp.get(this.beanalias); + actualizarDatos(listaArmasBySerie); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que agrega dinamicamente los filtros a una consulta SQL + * @param sqlFiltros + * @return String + */ + private String obtenerFiltroBusquedaGeneral(String... sqlFiltros ){ + StringBuffer sqlFinal = new StringBuffer(); + for (int i = 0; i < sqlFiltros.length ; i++) { + if(sqlFinal.length() > 0 && !StringUtils.endsWith(StringUtils.trim(sqlFinal.toString()), "AND")){ + sqlFinal.append( " AND "); + } + sqlFinal.append(sqlFiltros[i]); + } + return sqlFinal.toString(); + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if(Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")){ + valorColocar = Boolean.TRUE; + } + for (TarmArmas tarmArmas : listaArmas) { + tarmArmas.getModifiedData().put("seleccionado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Permite actualizar el campo seleccionado en la entidad tarmArmas + */ + public void actualizarDatosArma(){ + for(TarmArmas tarmArmas : listaArmas){ + if(tarmArmas.getModifiedData().get("seleccionado").equals(Boolean.TRUE)){ + this.getLrecord().add(tarmArmas); + } + } + panelPerson = true; + personLovController.init(); + personLovController.getMfilters().clear(); + getMfilters().clear(); + } + + /** + * Permite actualizar el campo seleccionado en la entidad tarmArmas + */ + public void actualizarDatosArmaSerie(){ + for(TarmArmas tarmArmas : listaArmasBySerie){ + if(tarmArmas.getModifiedData().get("seleccionado").equals(Boolean.TRUE)){ + this.getLrecord().add(tarmArmas); + } + } + panelPerson = true; + setPanelSinDatosPerson(false); + listaArmasBySerie = new ArrayList<>(); + this.getMfilters().clear(); + } + + /** + * Metodo para extrer solo elnoimbre del archivo + * @param xpath xpath del archivo en alfresco + * @return solo la parte correspondiente al nombre del archivo + */ + public String soloNombreArchivo(String xpath){ + return xpath.substring(xpath.lastIndexOf(":") + 1,xpath.length()); + } + + public void onReturnPersonLov(){ + numeroDocumento = ""; + razonSocial = ""; + setPanelPerson(true); + setPanelSinDatosPerson(false); + setPanelSinDatosArma(false); + getMfilters().clear(); + } + + + public void emptyPerson(){ + if((lote == null || "".equals(lote)) && (numeroDocumento == null || "".equals(numeroDocumento)) && (razonSocial == null || "".equals(razonSocial))){ + MessageHelper.setMessageError("Ingrese el campo Identificacin o el campo Nombre"); + return; + } + + TarmArmas obj = new TarmArmas(); + if(razonSocial == null || "".equals(razonSocial)){ + razonSocial = "N/A"; + } + + if(lote != null && !"".equals(lote)){ + obj.setLote(lote); + } + + if(numeroDocumento != null || !"".equals(numeroDocumento)){ + obj.getModifiedData().put("noDocumento", numeroDocumento); + } + + obj.getModifiedData().put("nombrerazonsocial", razonSocial); + obj.getModifiedData().put("propietario", razonSocial); + obj.getModifiedData().put("permiso", "No se registra permisos en el sistema"); + lrecord.add(obj); + + personLovController.init(); + personLovController.getMfilters().clear(); + setLote(""); + numeroDocumento = ""; + razonSocial = ""; + } + + public boolean isPanelPerson() { + return panelPerson; + } + + public void setPanelPerson(boolean panelPerson) { + this.panelPerson = panelPerson; + } + + public List getListaArmas() { + return listaArmas; + } + + public void setListaArmas(List listaArmas) { + this.listaArmas = listaArmas; + } + + /** + * @return the razonSocial + */ + public String getRazonSocial() { + return razonSocial; + } + + /** + * @param razonSocial the razonSocial to set + */ + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + /** + * @return the numeroDocumento + */ + public String getNumeroDocumento() { + return numeroDocumento; + } + + /** + * @param numeroDocumento the numeroDocumento to set + */ + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + /** + * @return the personLovController + */ + public PersonLovController getPersonLovController() { + return personLovController; + } + + /** + * @param personLovController the personLovController to set + */ + public void setPersonLovController(PersonLovController personLovController) { + this.personLovController = personLovController; + } + + /** + * @return the listaArmasBySerie + */ + public List getListaArmasBySerie() { + return listaArmasBySerie; + } + + /** + * @param listaArmasBySerie the listaArmasBySerie to set + */ + public void setListaArmasBySerie(List listaArmasBySerie) { + this.listaArmasBySerie = listaArmasBySerie; + } + + /** + * @return the certificadoArmasController + */ + public CertificadoArmasController getCertificadoArmasController() { + return certificadoArmasController; + } + + /** + * @param certificadoArmasController the certificadoArmasController to set + */ + public void setCertificadoArmasController( + CertificadoArmasController certificadoArmasController) { + this.certificadoArmasController = certificadoArmasController; + } + + /** + * @return the reportController + */ + public ReportController getReportController() { + return reportController; + } + + /** + * @param reportController the reportController to set + */ + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + } + + /** + * @return the alfrescoController + */ + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + /** + * @param alfrescoController the alfrescoController to set + */ + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + /** + * @return the solicitudCertificadoController + */ + public SolicitudCertificadoController getSolicitudCertificadoController() { + return solicitudCertificadoController; + } + + /** + * @param solicitudCertificadoController the solicitudCertificadoController to set + */ + public void setSolicitudCertificadoController( + SolicitudCertificadoController solicitudCertificadoController) { + this.solicitudCertificadoController = solicitudCertificadoController; + } + + /** + * @return the certificadoFiscalia + */ + public TarmCertificadoFiscalia getCertificadoFiscalia() { + return certificadoFiscalia; + } + + /** + * @param certificadoFiscalia the certificadoFiscalia to set + */ + public void setCertificadoFiscalia(TarmCertificadoFiscalia certificadoFiscalia) { + this.certificadoFiscalia = certificadoFiscalia; + } + + /** + * @return the nroSolicitud + */ + public String getNroSolicitud() { + return nroSolicitud; + } + + /** + * @param nroSolicitud the nroSolicitud to set + */ + public void setNroSolicitud(String nroSolicitud) { + this.nroSolicitud = nroSolicitud; + } + + /** + * @return the esTareaCompleta + */ + public boolean isEsTareaCompleta() { + return esTareaCompleta; + } + + /** + * @param esTareaCompleta the esTareaCompleta to set + */ + public void setEsTareaCompleta(boolean esTareaCompleta) { + this.esTareaCompleta = esTareaCompleta; + } + + /** + * @return the panelSinDatosPerson + */ + public boolean isPanelSinDatosPerson() { + return panelSinDatosPerson; + } + + /** + * @param panelSinDatosPerson the panelSinDatosPerson to set + */ + public void setPanelSinDatosPerson(boolean panelSinDatosPerson) { + this.panelSinDatosPerson = panelSinDatosPerson; + } + + /** + * @return the panelSinDatosArma + */ + public boolean isPanelSinDatosArma() { + return panelSinDatosArma; + } + + /** + * @param panelSinDatosArma the panelSinDatosArma to set + */ + public void setPanelSinDatosArma(boolean panelSinDatosArma) { + this.panelSinDatosArma = panelSinDatosArma; + } + + /** + * @return the lote + */ + public String getLote() { + return lote; + } + + /** + * @param lote the lote to set + */ + public void setLote(String lote) { + this.lote = lote; + } + + /** + * @return the deshabilitarPantalla + */ + public boolean isDeshabilitarPantalla() { + return deshabilitarPantalla; + } + + /** + * @param deshabilitarPantalla the deshabilitarPantalla to set + */ + public void setDeshabilitarPantalla(boolean deshabilitarPantalla) { + this.deshabilitarPantalla = deshabilitarPantalla; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CertificadosArmasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CertificadosArmasController.java.svn-base new file mode 100644 index 0000000..fa25a70 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CertificadosArmasController.java.svn-base @@ -0,0 +1,624 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.security.Timestamp; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; + +import javax.annotation.PostConstruct; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpSession; + +import org.hibernate.HibernateException; +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.lov.ArmasLovController; +import com.fp.frontend.controller.armas.lov.CertArmasLovController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmCertificadoArmas; +import com.fp.persistence.parmas.soli.TarmCertificadoArmasKey; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Controlador principal de la funcionalidad de consulta de armas + * @author Christian Pazmino + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CertificadosArmasController extends AbstractController { + + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmas; + + /** + * Tipo documento + */ + private String tipoDoc; + + /** + * Número documento + */ + private String numDoc; + + /** + * Nombre/razón social + */ + private String nombreRazon; + + /** + * Longitud arma + */ + private String longitud; + /** + * Calibre arma + */ + private String calibre; + /** + * Clase arma + */ + private String clase; + /** + * Tipo de arma + */ + private String tipoarma; + /** + * unidad medida peso + */ + private String unidadmedidapeso; + + /** + * Bandera que indica que en realidad existe luego del ingreso de datos un tipo de arma explosivo válido + */ + private boolean existeTipoArmaExplosivo; + + /** + * Bandera que escifica que se deba verificar que exista un arma explosivo válida + */ + private boolean verificaArmaExplosivo = Boolean.TRUE; + + /** + * Bloquea la unidad de cantidad + */ + private boolean bloquearUnidadCantidad = Boolean.TRUE; + + /** + * Bloquea la unidad de peso + */ + private boolean bloquearUnidadPeso = Boolean.TRUE; + + private Date fechaActual; + + private String razonSocial; + + private String numeroDocumento; + + private String filtroPersona; + private TarmCentroControl centroControl; + + private String sessionID; + + private Timestamp fechaReporte; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{certificadoArmasController}") + private CertificadoArmasController certificadoArmasController; + + private TcustPersonDetail tcustPersonDetail; + + public CertificadosArmasController() throws Exception { + super(TarmArmas.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + // querydatabase(); +// super.startQuery(); + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + fechaActual = new Date(); + HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false); + sessionID = session.getId(); + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "ARMAS"; + filtroPersona = ""; + // obtiene el centro de conrtrol + centroControl=Utilidades.obtenerCentroControl(); + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + if(tsafeUserDetail!=null && tsafeUserDetail.getPk().getPersoncode()!=null){ + tcustPersonDetail=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + protected void querydatabase() { + try { +// DtoQuery dto = this.getDtoQuery(); +// dto.setOrderby("pk"); +// Filter filtro = new Filter(); +// String sql="t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) and t.estado !='DEST' and t.estado !='CDP' " + filtroPersona; +// filtro.setSql(sql); +// dto.addFiltro(filtro); +// +// HashMap mtables = new HashMap(); +// mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. +// +// Request request = this.callerhelper.getRequest(); +// request.setQueryTables(mtables); +// Response resp = this.callerhelper.executeQuery(request); +// if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { +// this.lrecord = new ArrayList(); +// MessageHelper.setMessageError(resp); +// } else { +// this.lrecord = (List) resp.get(this.beanalias); +// for(TarmArmas armasObj:lrecord){ +// TarmRegistroArmas registroArmasObj = RegistroArmController.findByCodigo(armasObj.getCregistro().toString()); +// if(registroArmasObj!=null && registroArmasObj.getPersoncode()!=null){ +// TcustPersonDetail propietarioObj = PersonDetailController.find(registroArmasObj.getPersoncode().toString()); +// armasObj.getModifiedData().put("tipoDocumento", CatalogDetailController.findxCodigoCodcatalogo(propietarioObj.getIdentificationcatalog(), propietarioObj.getIdentificationcatalogcode()).getDescription()); +// armasObj.getModifiedData().put("noDocumento", propietarioObj.getIdentification()); +// armasObj.getModifiedData().put("nombrerazonsocial", propietarioObj.getName()); +// armasObj.getModifiedData().put("paisorigencode", registroArmasObj.getPaisorigen()); +// if(armasObj.getModifiedData().get("cclase")!=null){ +// armasObj.getModifiedData().put("clase", CatalogDetailController.findxCodigoCodcatalogo(armasObj.getModifiedData().get("cclase").toString(), armasObj.getModifiedData().get("cclasecodigo").toString()).getDescription()); +// } +// if(armasObj.getModifiedData().get("ctipoarmaexplosivo")!=null){ +// armasObj.getModifiedData().put("tipoarmaexplosivo", CatalogDetailController.findxCodigoCodcatalogo(armasObj.getModifiedData().get("ctipoarmaexplosivo").toString(), armasObj.getModifiedData().get("ctipoarmaexplosivocodigo").toString()).getDescription()); +// } +// if(armasObj.getModifiedData().get("ccalibre")!=null){ +// armasObj.getModifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(armasObj.getModifiedData().get("ccalibre").toString(), armasObj.getModifiedData().get("ccalibrecodigo").toString()).getDescription()); +// } +// } +// } +// super.postQuery(this.lrecord); +// } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() throws Exception { + super.next(); + } + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception{ + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TarmTipoArmaExplosivo","clase","cclase","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo= new SubQuery("TarmTipoArmaExplosivo","clasecodigo","cclasecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud= new SubQuery("TarmTipoArmaExplosivo","longitud","clongitud","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo= new SubQuery("TarmTipoArmaExplosivo","longitudcodigo","clongitudcodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ccalibre","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo= new SubQuery("TarmTipoArmaExplosivo","calibrecodigo","ccalibrecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivo","ctipoarmaexplosivo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivocodigo","ctipoarmaexplosivocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapeso","cunidadmedidapeso","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapesocodigo","cunidadmedidapesocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida= new SubQuery("TgeneCatalogDetail","description","unidadmedida","i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode= new SubQuery("TarmRegistroArmas","personcode","personcode","i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + + return dto; + } + + @Override + public void save() { + } + + /** + * Abre el lov de persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + + /** + * Maneja la respuesta del Lov de Personas + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + filtroPersona = ""; + TcustPersonDetail personaDetailSelecionada = (TcustPersonDetail) event.getObject(); + razonSocial=personaDetailSelecionada.getName(); + numeroDocumento=personaDetailSelecionada.getIdentification(); + filtroPersona=personaDetailSelecionada.getPk().getPersoncode().toString(); + this.setLrecord(new ArrayList()); + FacesContext context = FacesContext.getCurrentInstance(); + context.addMessage(null, new FacesMessage("RECUERDE", MsgControlArmas.getProperty("msg_recuerdeClickSeleccionarArmas"))); +// List registroArmasList = RegistroArmController.findxPersoncode(personaDetailSelecionada.getPk().getPersoncode().toString()); +// if(registroArmasList!=null && registroArmasList.size()>0){ +// filtroPersona = " and t.cregistro in ("; +// for(TarmRegistroArmas regArmaObj : registroArmasList){ +// filtroPersona+=regArmaObj.getPk().toString() + ","; +// } +// filtroPersona=filtroPersona.substring(0, filtroPersona.length()-1); +// filtroPersona+=")"; +// }else{ +// filtroPersona = " and t.cregistro = -10023"; +// } + //querydatabase(); + } + + /* Abre el LOV de la clase del arma + */ + public void openLovArma() { + Map> params = new HashMap>(); + ListcodigosArma=new ArrayList<>(); + String codigos=null; + if(this.getLrecord()!=null && this.getLrecord().size()>0){ + for(TarmArmas arma:this.getLrecord()){ + if(codigos==null){ + codigos=" t.pk !='"+arma.getPk()+"' "; + }else{ + codigos=codigos+" and t.pk !='"+arma.getPk()+"' "; + } + } + } + codigosArma.add(codigos); + ListestadossArma=new ArrayList<>(); + estadossArma.add(" t.estado !='CDP' and t.estado !='VEND' and t.estado!='TRAS' and t.estado!='MING' and t.estado!='DEST' and t.estado!='DUPL' and t.estado!='CUSTEM' and t.estado!='ENTR'" + + " and (t.peso>0 or t.cantidad>0) ");//t.estado !='DEST' and and t.estado !='DEC'//destruidas - cambiodepropietario - vendidas - decomisadas - suspendida - cancelada - incautada + + ListcodigoPersona=new ArrayList<>(); + codigoPersona.add(filtroPersona); + + params.put("ccodigosarmas", codigosArma); + params.put("estadosarmas", estadossArma); + params.put("codigopersona", codigoPersona); + CertArmasLovController.openLov(params); + } + + /** + * Regresa del LOV de armas + * @param event + */ + @SuppressWarnings("unchecked") + public void onReturnArma(SelectEvent event) { + List tarmArmas = (List) event.getObject(); + if(tarmArmas!=null && tarmArmas.size()>0){ + for(TarmArmas arma:tarmArmas){ + arma.getModifiedData().put("seleccionada",Boolean.TRUE); + this.getLrecord().add(arma); + } + } + //ordenamos la lista +// Collections.sort(armasController.getLrecord(), new Comparator() { +// public int compare(TarmArmas p1, TarmArmas p2) { +// return new Integer(p1.getModifiedData().get("ordenarma").toString()).compareTo(new Integer(p2.getModifiedData().get("ordenarma").toString())); +// } +// }); + } + + public void generarReporte() { + String path = "armas/reports/certificadosArmas"; + Boolean aux=Boolean.FALSE; + java.util.Date today = new java.util.Date(); + java.sql.Timestamp fechaReporte = new java.sql.Timestamp(today.getTime()); + Random aleatorio = new Random(); + int ticketGenerado = aleatorio.nextInt(); +// String filtro=null; +// ListcodArmas=new ArrayList(); + int i=0; + + for(TarmArmas armasel:lrecord){ + i++; + if(armasel.getModifiedData().get("seleccionada")!=null && armasel.getModifiedData().get("seleccionada").equals(Boolean.TRUE)){ + aux=Boolean.TRUE; + guardarCertificadoReporte(armasel, i, ticketGenerado, fechaReporte); +// codArmas.add(armasel.getPk()); + } + } + if(!aux){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nohaseleccionadoarmas")); + return; + } + certificadoArmasController.save(); + try { + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("codResponsable", centroControl.getPersoncode()); + parameters.put("gradoresponsable","" ); //centroControl.getModifiedData().get("desgrado") + parameters.put("nombreresponsable",centroControl.getModifiedData().get("desgrado")+" "+ centroControl.getModifiedData().get("nombre")); + parameters.put("centrocontrol", String.valueOf(centroControl.getModifiedData().get("desnombreinstitucion"))); + parameters.put("sessionID",sessionID); +// parameters.put("fechaReporte",fechaReporte); + + parameters.put("ticket",ticketGenerado); + parameters.put("personCodeLogin",(tcustPersonDetail!=null && tcustPersonDetail.getPk()!=null)?tcustPersonDetail.getPk().getPersoncode():null); + if(tcustPersonDetail!=null){ + parameters.put("usuario", tcustPersonDetail.getName()); + } + // String[] selectedEstados = filtro.split(","); +// parameters.put("filtro", codArmas); + parameters.put("unidadmilitar", MsgControlArmas.getProperty("msg_inf_digitadordel")+" "+String.valueOf(centroControl.getModifiedData().get("desnombreinstitucion"))); + String format="pdf"; + String filename="Certificado"; + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + private void guardarCertificadoReporte(TarmArmas armaObj,int orden,int ticket, java.sql.Timestamp fechaReporte){ + TarmCertificadoArmas certificadoArmasObj = new TarmCertificadoArmas(); + TarmCertificadoArmasKey pk = new TarmCertificadoArmasKey(); + certificadoArmasObj.setPk(pk); + try { + certificadoArmasObj.getPk().setFechareporte(fechaReporte); + certificadoArmasObj.getPk().setSessionid(sessionID); + certificadoArmasObj.getPk().setOrden(orden); + certificadoArmasObj.setIdentification(armaObj.getModifiedData().get("noDocumento")!=null?armaObj.getModifiedData().get("noDocumento").toString():null); + certificadoArmasObj.setName(armaObj.getModifiedData().get("propietario")!=null?armaObj.getModifiedData().get("propietario").toString():null); + certificadoArmasObj.setRegisterdate(armaObj.getFecharegistro()); + certificadoArmasObj.setClase(armaObj.getModifiedData().get("clase")!=null?armaObj.getModifiedData().get("clase").toString():null); + certificadoArmasObj.setTipoarmaexplosivo(armaObj.getModifiedData().get("tipoarmaexplosivo")!=null?armaObj.getModifiedData().get("tipoarmaexplosivo").toString():null); + certificadoArmasObj.setMarca(armaObj.getModifiedData().get("marca")!=null?armaObj.getModifiedData().get("marca").toString():null); + certificadoArmasObj.setCalibre(armaObj.getModifiedData().get("calibre")!=null?armaObj.getModifiedData().get("calibre").toString():null); + certificadoArmasObj.setLote(armaObj.getLote()); + certificadoArmasObj.setPaisfabricacion(armaObj.getModifiedData().get("paisorigen")!=null?armaObj.getModifiedData().get("paisorigen").toString():null); + certificadoArmasObj.setEstado(armaObj.getModifiedData().get("estado")!=null?armaObj.getModifiedData().get("estado").toString():null); + certificadoArmasObj.setUsercode((tcustPersonDetail!=null && tcustPersonDetail.getPk()!=null)?tcustPersonDetail.getPk().getPersoncode().toString():null); + certificadoArmasObj.setTicket(ticket); + certificadoArmasObj.setIsnew(true); + certificadoArmasController.update(certificadoArmasObj); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + + public RegistroArmController getRegistroArmas() { + return registroArmas; + } + + + public void setRegistroArmas(RegistroArmController registroArmas) { + this.registroArmas = registroArmas; + } + + public String getTipoDoc() { + return tipoDoc; + } + + + public void setTipoDoc(String tipoDoc) { + this.tipoDoc = tipoDoc; + } + + + public String getNumDoc() { + return numDoc; + } + + + public void setNumDoc(String numDoc) { + this.numDoc = numDoc; + } + + + public String getNombreRazon() { + return nombreRazon; + } + + + public void setNombreRazon(String nombreRazon) { + this.nombreRazon = nombreRazon; + } + + public String getLongitud() { + return longitud; + } + + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + + public String getCalibre() { + return calibre; + } + + + public void setCalibre(String calibre) { + this.calibre = calibre; + } + + + public String getClase() { + return clase; + } + + + public void setClase(String clase) { + this.clase = clase; + } + + + public String getTipoarma() { + return tipoarma; + } + + + public void setTipoarma(String tipoarma) { + this.tipoarma = tipoarma; + } + + + public String getUnidadmedidapeso() { + return unidadmedidapeso; + } + + + public void setUnidadmedidapeso(String unidadmedidapeso) { + this.unidadmedidapeso = unidadmedidapeso; + } + + public boolean isExisteTipoArmaExplosivo() { + return existeTipoArmaExplosivo; + } + + + public void setExisteTipoArmaExplosivo(boolean existeTipoArmaExplosivo) { + this.existeTipoArmaExplosivo = existeTipoArmaExplosivo; + } + + + public boolean isVerificaArmaExplosivo() { + return verificaArmaExplosivo; + } + + + public void setVerificaArmaExplosivo(boolean verificaArmaExplosivo) { + this.verificaArmaExplosivo = verificaArmaExplosivo; + } + + public boolean isBloquearUnidadCantidad() { + return bloquearUnidadCantidad; + } + + public void setBloquearUnidadCantidad(boolean bloquearUnidadCantidad) { + this.bloquearUnidadCantidad = bloquearUnidadCantidad; + } + + public boolean isBloquearUnidadPeso() { + return bloquearUnidadPeso; + } + + public void setBloquearUnidadPeso(boolean bloquearUnidadPeso) { + this.bloquearUnidadPeso = bloquearUnidadPeso; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public String getRazonSocial() { + return razonSocial; + } + + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public CertificadoArmasController getCertificadoArmasController() { + return certificadoArmasController; + } + + public void setCertificadoArmasController( + CertificadoArmasController certificadoArmasController) { + this.certificadoArmasController = certificadoArmasController; + } + + public String getSessionID() { + return sessionID; + } + + public void setSessionID(String sessionID) { + this.sessionID = sessionID; + } + + public Timestamp getFechaReporte() { + return fechaReporte; + } + + public void setFechaReporte(Timestamp fechaReporte) { + this.fechaReporte = fechaReporte; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ColaImpresionController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ColaImpresionController.java.svn-base new file mode 100644 index 0000000..734b7ed --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ColaImpresionController.java.svn-base @@ -0,0 +1,164 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.inte.TarmColadeImpresion; + +/** + * Clase controladora del bean TarmColadeImpresion. + * + * @author DLO + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ColaImpresionController extends AbstractController { + + public ColaImpresionController() throws Exception { + super(TarmColadeImpresion.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "BODEGA"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.cdocumento"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para actualizar un bean en el record desde otros controladores + */ + public void update(TarmColadeImpresion bean) throws Exception { + record=bean; + super.update(); + } + + /** + * Encuentra una lista en la coladeimpresion por solicitud y por documentoHabilitante + * @param cdocumento + * @param estado + * @return List + * @throws Exception + */ + public static List findByDocumentoEstado(String cdocumento, String estadoimpresion) throws Exception { + try { + ColaImpresionController cc = new ColaImpresionController(); + cc.init(); + cc.recperpage = 3000; + cc.addFilter("cdocumento", cdocumento); + cc.addFilter("estadoimpresion", estadoimpresion); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + /** + * Encuentra una lista en la coladeimpresion por solicitud y por documentoHabilitante + * @param cdocumento + * @param estado + * @return List + * @throws Exception + */ + public static List findByDocumentoCDoc(String cdocumento) throws Exception { + try { + ColaImpresionController cc = new ColaImpresionController(); + cc.init(); + cc.recperpage = 100; + cc.addFilter("cdocumento", cdocumento); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} + diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ConsultaAlfrescoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ConsultaAlfrescoController.java.svn-base new file mode 100644 index 0000000..22745cf --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ConsultaAlfrescoController.java.svn-base @@ -0,0 +1,692 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.eval.EvaluacionController; +import com.fp.frontend.controller.armas.parametros.CashManagementHistoryController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.armas.parametros.TarmVentaArmaTemporalController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.eval.TarmEvaluacion; +import com.fp.persistence.parmas.fun.TarmCashManagementHistory; +import com.fp.persistence.parmas.fun.TarmVentaArmaTem; +import com.fp.persistence.parmas.ins.TarmPlanificacionInspeccion; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.soli.TarmArmaPruebas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmCertificadoFiscalia; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.parmas.soli.TarmDocumentoAlfresco; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmInspeccion; +import com.fp.persistence.parmas.soli.TarmInspeccionArchivo; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitos; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +/** + * Clase controladora para consultar documentos en alfresco. + * + * @author Carlos Guzman. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ConsultaAlfrescoController extends AbstractController { + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + + @ManagedProperty(value = "#{ingresoFichaTecnicaArmasController}") + private IngresoFichaTecnicaArmasController ingresoFichaTecnicaArmasController; + + //Manu + @ManagedProperty(value="#{solicitudController}") + private SolicitudController solicitudController; + + @ManagedProperty(value = "#{solicitudGuardiasController}") + private SolicitudGuardiasController solicitudGuardiasController; + + /*reporte alfresco*/ + private TarmDocumentoHabilitante documentoHabilitante = new TarmDocumentoHabilitante(); + private List armaPrueba = new ArrayList<>(); + private List solicitudRequisitos = new ArrayList<>(); + private List inspeccionArchivo = new ArrayList<>(); + private TarmSolicitudTramite solicitudTramite = new TarmSolicitudTramite(); + + //Manu + private TarmSolicitud solicitud = new TarmSolicitud(); + private TarmEvaluacion tarmevaluacion = new TarmEvaluacion(); + private List listaEvaluacionGuardias = new ArrayList<>(); + private List listaCash = new ArrayList<>(); + private List listaPlanificacion; + //New + private List listaInspeccionesNoPlanificacion; + private List listTtarmdecomisoarmaEntrega; + private List listTtarmdecomisoarmaRecepcion; + private List listTarmdecomiso; + private TarmCertificadoFiscalia certificadoFiscalia; + + private String consulta; + + private String tipoDocumento; + private boolean verPanelDocumentos; + + private String year; + private String mes; + private Date fechaDesde; + private Date fechaHasta; + private String centro; + private TarmCentroControl centroControl = new TarmCentroControl(); + + private String documentos; + + private String tipoPersona; + + /** + * Lista de documentos habilitantes suspendidos + */ + private ListlistaDocumentoHabSus; + + private ListlistaArmasCompradas; + private TcustPersonDetail tcustPersonDetail; + private ListlistaTarmVentaArmaTem; + + /** + * Constructor + * @throws Exception + */ + public ConsultaAlfrescoController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + solicitudController= new SolicitudController(); + listaDocumentoHabSus= new ArrayList<>(); + listaArmasCompradas= new ArrayList<>(); + listaTarmVentaArmaTem=new ArrayList<>(); + String perfil = this.getLoginController().getRequest().getProfile(); + List lista = MantenimientoDocumentosAlfrescoController.findByProfile(perfil); + if(lista != null && !lista.isEmpty()){ + for(TarmDocumentoAlfresco docAlfresco : lista){ + if("".equals(documentos)){ + documentos += docAlfresco.getDocumento(); + }else{ + documentos += ", " + docAlfresco.getDocumento(); + } + } + } + this.init(); + } + + @Override + protected void querydatabase() { + try { + if("solicitud".equals(tipoDocumento)){ + if(consulta==null || consulta.isEmpty()){ + return ; + } + setSolicitud(SolicitudController.findSolicitudxnumerosolicitud(consulta.trim())); + if(solicitud == null){ + MsgControlArmas.getProperty("msg_error_solicitud_noencontrada"); + return; + } + String consultaCodigo = solicitud.getPk(); + + solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + if(solicitudTramite != null && ("FIN".equals(solicitudTramite.getEstadotramite()) || "APB".equals(solicitudTramite.getEstadotramite()))){ + documentoHabilitante = DocumentoHabilitanteController.findPorSolicitud(consultaCodigo); + }else{ + documentoHabilitante = null; + } + + armaPrueba = ingresoFichaTecnicaArmasController.findPorSolicitud(consultaCodigo); + solicitudRequisitos = SolicitudRequisitosController.find(consultaCodigo); + inspeccionArchivo = InspeccionArchivoController.findPorSolicitud(consultaCodigo); +// solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(consultaCodigo); + TcustPersonDetail tcustPersonDetailObj=PersonDetailController.find(solicitud.getPersoncode().toString()); + if(tcustPersonDetailObj.getPersontypecatalog().equals("2")){ + tipoPersona = "JURIDICA"; + this.listaEvaluacionGuardias.clear(); + List lsolicitudGuardias = solicitudGuardiasController.findPorSolicitud(solicitud.getPk()); + if(lsolicitudGuardias!=null && !lsolicitudGuardias.isEmpty()){ + for(TarmSolicitudGuardias solicitudGuardias : lsolicitudGuardias){ + TarmEvaluacion tarmEvaluacionGuardia = EvaluacionController.findEvaluacionesVigentes(solicitudGuardias.getPk().getCguardia().toString(), "PSICOLOGICA"); + if(tarmEvaluacionGuardia==null){ + tarmEvaluacionGuardia = new TarmEvaluacion(); + } + TcustPersonDetail tcustPersonDetailGuardia=PersonDetailController.find(solicitudGuardias.getPk().getCguardia().toString()); + tarmEvaluacionGuardia.getModifiedData().put("nombreGuardia", tcustPersonDetailGuardia.getName()); + this.listaEvaluacionGuardias.add(tarmEvaluacionGuardia); + } + } + }else{ + tipoPersona = "NATURAL"; + tarmevaluacion = EvaluacionController.findEvaluacionesVigentes(solicitud.getPersoncode().toString(), "PSICOLOGICA"); + } + }else if("cashManagement".equals(tipoDocumento)){ + listaCash = CashManagementHistoryController.findReportesByDate(fechaDesde, fechaHasta); + }else if("planificacionAnual".equals(tipoDocumento)){ + listaPlanificacion = AprobacionPlanInspeccionController.findPorAnno(centroControl.getPk(), getYear()); + + List listaInspecciones = InspeccionController.findPorAnno(centroControl.getPk(), getYear()); + if(listaInspecciones != null && !listaInspecciones.isEmpty()){ + listaInspeccionesNoPlanificacion = InspeccionArchivoController.findPorInspeccion(listaInspecciones.get(0).getPk().toString()); + } + + }else if("decomisos".equals(tipoDocumento)){ + //numero de consulta + if(consulta==null || consulta.isEmpty()){ + return ; + } + TarmDecomiso tarmDecomiso = DecomisoController.find(consulta); + if(tarmDecomiso != null){ + listTarmdecomiso = new ArrayList<>(); + listTarmdecomiso.add(tarmDecomiso); + listTtarmdecomisoarmaEntrega = DecomisoArmaTransaccionController.findPorEnvioNroDecomiso("ENTREGA", tarmDecomiso.getPk()); + listTtarmdecomisoarmaRecepcion = DecomisoArmaTransaccionController.findPorEnvioNroDecomiso("RECEPCION", tarmDecomiso.getPk()); + } + }else if("fiscalia".equals(tipoDocumento)){ + certificadoFiscalia = SolicitudCertificadoController.findPorSolicitud(consulta.trim()); + + }else if("suspenciondh".equals(tipoDocumento)){ + if(tcustPersonDetail==null || tcustPersonDetail.getPk()==null){ + MessageHelper.setMessageError("SELECCIONE UNA IDENTIFICACI\u00d3N"); + return; + } + listaDocumentoHabSus=DocumentoHabilitanteController.findByPersonCode(tcustPersonDetail.getPk().getPersoncode()); + }else if("ventaarmas".equals(tipoDocumento) ){ + solicitud=null; + if(consulta==null || consulta.trim().isEmpty()){ + MessageHelper.setMessageError("INGRESE EL LOTE"); + return; + } + listaArmasCompradas=ArmasController.findxLoteRegistro(consulta); + } + else if("roboperdida".equals(tipoDocumento)){ + solicitud=null; + if(consulta==null || consulta.trim().isEmpty()){ + MessageHelper.setMessageError("INGRESE EL LOTE"); + return; + } + listaArmasCompradas=ArmasController.findxLotePerdidaRobo(consulta); + } + else if("ventaarmas2".equals(tipoDocumento) ){ + solicitud=null; + if(consulta==null || consulta.trim().isEmpty()){ + MessageHelper.setMessageError("INGRESE EL LOTE"); + return; + } + listaTarmVentaArmaTem=TarmVentaArmaTemporalController.findLote(consulta); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para extrer solo el nombre del archivo + * @param xpath xpath del archivo en alfresco + * @return solo la parte correspondiente al nombre del archivo + */ + public String soloNombreArchivo(String xpath){ + return xpath.substring(xpath.lastIndexOf(":") + 1,xpath.length()); + } + + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.lrecord = new ArrayList<>(); + this.beanalias = "CONSULTAALFRESCO"; + verPanelDocumentos = false; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Metodo que analiza si el archivo tiene la extension permitida + * @param nombreArchivo + * @return + */ + public Boolean esExtensionDeArchivoPermitida(String nombreArchivo){ + String[]archivosPermitidosLst = {".pdf"}; + for(String extensionValida:archivosPermitidosLst){ + if(nombreArchivo.contains(extensionValida)){ + return Boolean.TRUE; + } + } + return Boolean.FALSE; + } + + public void guardarRegistro() { + } + + public boolean activarPanel(String selectedDocument){ + for(String doc : documentos.split(", ")){ + if(doc.equals(selectedDocument)){ + return true; + } + } + return false; + } + + /** + * Permite actualizar el centro de armas en caso de set tipo planificacionAnual + * @throws Exception + * + */ + public void actualizarMenu() throws Exception{ + tcustPersonDetail=null; + verPanelDocumentos = false; + consulta = ""; + fechaDesde = null; + fechaHasta = null; + year = ""; + if("planificacionAnual".equals(tipoDocumento)){ + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + setCentroControl(CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol())); + } + } + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){} + + @Override + public void query() throws Exception { + verPanelDocumentos = true; + super.query(); + } + + public static void openLov() { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), true); + // lovpersona es el nombre de la pagina + RequestContext.getCurrentInstance().openDialog("/pages/customer/lov/personLov.xhtml", options, null); + } + + /** + * Maneja la respuesta del Lov de Personas + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + tcustPersonDetail = (TcustPersonDetail) event.getObject(); + this.getMfilters().put("personcode",tcustPersonDetail.getPk().getPersoncode().toString()); + this.query(); + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + /** + * @return the solicitudController + */ + public SolicitudController getSolicitudController() { + return solicitudController; + } + + /** + * @param solicitudController the solicitudController to set + */ + public void setSolicitudController(SolicitudController solicitudController) { + this.solicitudController = solicitudController; + } + + public IngresoFichaTecnicaArmasController getIngresoFichaTecnicaArmasController() { + return ingresoFichaTecnicaArmasController; + } + + public void setIngresoFichaTecnicaArmasController( + IngresoFichaTecnicaArmasController ingresoFichaTecnicaArmasController) { + this.ingresoFichaTecnicaArmasController = ingresoFichaTecnicaArmasController; + } + + public TarmDocumentoHabilitante getDocumentoHabilitante() { + return documentoHabilitante; + } + + public void setDocumentoHabilitante( + TarmDocumentoHabilitante documentoHabilitante) { + this.documentoHabilitante = documentoHabilitante; + } + + /** + * @return the solicitud + */ + public TarmSolicitud getSolicitud() { + return solicitud; + } + + /** + * @param solicitud the solicitud to set + */ + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + public List getArmaPrueba() { + return armaPrueba; + } + + public void setArmaPrueba(List armaPrueba) { + this.armaPrueba = armaPrueba; + } + + public List getSolicitudRequisitos() { + return solicitudRequisitos; + } + + public void setSolicitudRequisitos( + List solicitudRequisitos) { + this.solicitudRequisitos = solicitudRequisitos; + } + + public List getInspeccionArchivo() { + return inspeccionArchivo; + } + + public void setInspeccionArchivo(List inspeccionArchivo) { + this.inspeccionArchivo = inspeccionArchivo; + } + + + + public TarmSolicitudTramite getSolicitudTramite() { + return solicitudTramite; + } + + public void setSolicitudTramite(TarmSolicitudTramite solicitudTramite) { + this.solicitudTramite = solicitudTramite; + } + + /** + * @return the tarmevaluacion + */ + public TarmEvaluacion getTarmevaluacion() { + return tarmevaluacion; + } + + /** + * @param tarmevaluacion the tarmevaluacion to set + */ + public void setTarmevaluacion(TarmEvaluacion tarmevaluacion) { + this.tarmevaluacion = tarmevaluacion; + } + + /** + * @return the listaCash + */ + public List getListaCash() { + return listaCash; + } + + /** + * @param listaCash the listaCash to set + */ + public void setListaCash(List listaCash) { + this.listaCash = listaCash; + } + + /** + * @return the centroControl + */ + public TarmCentroControl getCentroControl() { + return centroControl; + } + + /** + * @param centroControl the centroControl to set + */ + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + /** + * @return the listaPlanificacion + */ + public List getListaPlanificacion() { + return listaPlanificacion; + } + + /** + * @param listaPlanificacion the listaPlanificacion to set + */ + public void setListaPlanificacion( + List listaPlanificacion) { + this.listaPlanificacion = listaPlanificacion; + } + + /** + * @return the listTtarmdecomisoarmaEntrega + */ + public List getListTtarmdecomisoarmaEntrega() { + return listTtarmdecomisoarmaEntrega; + } + + /** + * @param listTtarmdecomisoarmaEntrega the listTtarmdecomisoarmaEntrega to set + */ + public void setListTtarmdecomisoarmaEntrega( + List listTtarmdecomisoarmaEntrega) { + this.listTtarmdecomisoarmaEntrega = listTtarmdecomisoarmaEntrega; + } + + /** + * @return the listTtarmdecomisoarmaRecepcion + */ + public List getListTtarmdecomisoarmaRecepcion() { + return listTtarmdecomisoarmaRecepcion; + } + + /** + * @param listTtarmdecomisoarmaRecepcion the listTtarmdecomisoarmaRecepcion to set + */ + public void setListTtarmdecomisoarmaRecepcion( + List listTtarmdecomisoarmaRecepcion) { + this.listTtarmdecomisoarmaRecepcion = listTtarmdecomisoarmaRecepcion; + } + + public String getConsulta() { + return consulta; + } + + public void setConsulta(String consulta) { + this.consulta = consulta; + } + + public String getTipoDocumento() { + return tipoDocumento; + } + + public void setTipoDocumento(String tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } + + public boolean isVerPanelDocumentos() { + return verPanelDocumentos; + } + + public void setVerPanelDocumentos(boolean verPanelDocumentos) { + this.verPanelDocumentos = verPanelDocumentos; + } + + public String getYear() { + return year; + } + + public void setYear(String year) { + this.year = year; + } + + public String getMes() { + return mes; + } + + public void setMes(String mes) { + this.mes = mes; + } + + public Date getFechaDesde() { + return fechaDesde; + } + + public void setFechaDesde(Date fechaDesde) { + this.fechaDesde = fechaDesde; + } + + public Date getFechaHasta() { + return fechaHasta; + } + + public void setFechaHasta(Date fechaHasta) { + this.fechaHasta = fechaHasta; + } + + public String getCentro() { + return centro; + } + + public void setCentro(String centro) { + this.centro = centro; + } + + /** + * @return the certificadoFiscalia + */ + public TarmCertificadoFiscalia getCertificadoFiscalia() { + return certificadoFiscalia; + } + + /** + * @param certificadoFiscalia the certificadoFiscalia to set + */ + public void setCertificadoFiscalia(TarmCertificadoFiscalia certificadoFiscalia) { + this.certificadoFiscalia = certificadoFiscalia; + } + + public List getListaInspeccionesNoPlanificacion() { + return listaInspeccionesNoPlanificacion; + } + + public void setListaInspeccionesNoPlanificacion( + List listaInspeccionesNoPlanificacion) { + this.listaInspeccionesNoPlanificacion = listaInspeccionesNoPlanificacion; + } + + public List getListTarmdecomiso() { + return listTarmdecomiso; + } + + public void setListTarmdecomiso(List listTarmdecomiso) { + this.listTarmdecomiso = listTarmdecomiso; + } + + public List getListaEvaluacionGuardias() { + return listaEvaluacionGuardias; + } + + public void setListaEvaluacionGuardias( + List listaEvaluacionGuardias) { + this.listaEvaluacionGuardias = listaEvaluacionGuardias; + } + + public String getTipoPersona() { + return tipoPersona; + } + + public void setTipoPersona(String tipoPersona) { + this.tipoPersona = tipoPersona; + } + + public SolicitudGuardiasController getSolicitudGuardiasController() { + return solicitudGuardiasController; + } + + public void setSolicitudGuardiasController( + SolicitudGuardiasController solicitudGuardiasController) { + this.solicitudGuardiasController = solicitudGuardiasController; + } + + public List getListaDocumentoHabSus() { + return listaDocumentoHabSus; + } + + public void setListaDocumentoHabSus( + List listaDocumentoHabSus) { + this.listaDocumentoHabSus = listaDocumentoHabSus; + } + + public List getListaArmasCompradas() { + return listaArmasCompradas; + } + + public void setListaArmasCompradas(List listaArmasCompradas) { + this.listaArmasCompradas = listaArmasCompradas; + } + + public TcustPersonDetail getTcustPersonDetail() { + return tcustPersonDetail; + } + + public void setTcustPersonDetail(TcustPersonDetail tcustPersonDetail) { + this.tcustPersonDetail = tcustPersonDetail; + } + + public List getListaTarmVentaArmaTem() { + return listaTarmVentaArmaTem; + } + + public void setListaTarmVentaArmaTem( + List listaTarmVentaArmaTem) { + this.listaTarmVentaArmaTem = listaTarmVentaArmaTem; + } + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ConsultaArmasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ConsultaArmasController.java.svn-base new file mode 100644 index 0000000..27f3326 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ConsultaArmasController.java.svn-base @@ -0,0 +1,664 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Controlador principal de la funcionalidad de consulta de armas + * + * @author Christian Pazmino + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ConsultaArmasController extends AbstractController { + +// @ManagedProperty(value = "#{registroArmController}") +// private RegistroArmController registroArmas; + + /** + * Tipo documento + */ + private String tipoDoc; + + /** + * Número documento + */ + private String numDoc; + + /** + * Nombre/razón social + */ + private String nombreRazon; + + /** + * Longitud arma + */ + private String longitud; + /** + * Calibre arma + */ + private String calibre; + /** + * Clase arma + */ + private String clase; + /** + * Tipo de arma + */ + private String tipoarma; + /** + * unidad medida peso + */ + private String unidadmedidapeso; + + /** + * Bandera que indica que en realidad existe luego del ingreso de datos un tipo + * de arma explosivo válido + */ + private boolean existeTipoArmaExplosivo; + + /** + * Bandera que escifica que se deba verificar que exista un arma explosivo + * válida + */ + private boolean verificaArmaExplosivo = Boolean.TRUE; + + /** + * Bloquea la unidad de cantidad + */ + private boolean bloquearUnidadCantidad = Boolean.TRUE; + + /** + * Bloquea la unidad de peso + */ + private boolean bloquearUnidadPeso = Boolean.TRUE; + + private Date fechaActual; + + private String razonSocial; + + private String numeroDocumento; + + private String filtroPersona; + + + + private String descategoria; + private String usoActividad; + private Date fec_actual; + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + private TcustPersonDetail customerperson; + private TsafeUserDetail tsafeUserDetailUsuario = null; + + public ConsultaArmasController() throws Exception { + super(TarmArmas.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + fechaActual = new Date(); + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "ARMAS"; + filtroPersona = ""; + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + protected void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + dto.setOrderby("pk"); + Filter filtro = new Filter(); + String sql = "t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma) and t.estado !='DEST' and t.estado!='VEND' and t.estado!='MING' and t.estado!='DUPL' and t.estado!='CUSTEM' and t.estado !='CDP'" + + " and (t.peso>0 or t.cantidad>0) " + filtroPersona;// + filtro.setSql(sql); + dto.addFiltro(filtro); + System.out.println("dto sql: "+sql); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + for (TarmArmas armasObj : lrecord) { + TarmRegistroArmas registroArmasObj = RegistroArmController + .findByCodigo(armasObj.getCregistro().toString()); + if (registroArmasObj != null && registroArmasObj.getPersoncode() != null) { + TcustPersonDetail propietarioObj = PersonDetailController + .find(registroArmasObj.getPersoncode().toString()); + if (propietarioObj.getIdentificationcatalog() != null + && propietarioObj.getIdentificationcatalogcode() != null) { + armasObj.getModifiedData() + .put("tipoDocumento", + CatalogDetailController + .findxCodigoCodcatalogo(propietarioObj.getIdentificationcatalog(), + propietarioObj.getIdentificationcatalogcode()) + .getDescription()); + } + armasObj.getModifiedData().put("noDocumento", propietarioObj.getIdentification()); + armasObj.getModifiedData().put("nombrerazonsocial", propietarioObj.getName()); + armasObj.getModifiedData().put("paisorigencode", registroArmasObj.getPaisorigen()); + if (armasObj.getModifiedData().get("cclase") != null) { + armasObj.getModifiedData().put("clase", + CatalogDetailController + .findxCodigoCodcatalogo(armasObj.getModifiedData().get("cclase").toString(), + armasObj.getModifiedData().get("cclasecodigo").toString()) + .getDescription()); + } + if (armasObj.getModifiedData().get("ctipoarmaexplosivo") != null) { + armasObj.getModifiedData().put("tipoarmaexplosivo", + CatalogDetailController.findxCodigoCodcatalogo( + armasObj.getModifiedData().get("ctipoarmaexplosivo").toString(), + armasObj.getModifiedData().get("ctipoarmaexplosivocodigo").toString()) + .getDescription()); + } + if (armasObj.getModifiedData().get("ccalibre") != null) { + armasObj.getModifiedData().put("calibre", CatalogDetailController + .findxCodigoCodcatalogo(armasObj.getModifiedData().get("ccalibre").toString(), + armasObj.getModifiedData().get("ccalibrecodigo").toString()) + .getDescription()); + } + + } + } + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() throws Exception { + // TODO Auto-generated method stub + super.next(); + } + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", + "i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", + "i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", + "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase = new SubQuery("TarmTipoArmaExplosivo", "clase", "cclase", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo = new SubQuery("TarmTipoArmaExplosivo", "clasecodigo", "cclasecodigo", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud = new SubQuery("TarmTipoArmaExplosivo", "longitud", "clongitud", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo = new SubQuery("TarmTipoArmaExplosivo", "longitudcodigo", "clongitudcodigo", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre = new SubQuery("TarmTipoArmaExplosivo", "calibre", "ccalibre", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo = new SubQuery("TarmTipoArmaExplosivo", "calibrecodigo", "ccalibrecodigo", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivo", "ctipoarmaexplosivo", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivocodigo", + "ctipoarmaexplosivocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapeso", "cunidadmedidapeso", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapesocodigo", + "cunidadmedidapesocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida = new SubQuery("TgeneCatalogDetail", "description", "unidadmedida", + "i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode = new SubQuery("TarmRegistroArmas", "personcode", "personcode", + "i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + + SubQuery subqueryFechaemiperm = new SubQuery("TarmDocumentoHabilitante", "fechaemision", "fechaemision", + // " i.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = + // t.cregistro) and i.carma = t.pk and "+ + " i.pk=(select max(doc.pk) " + + " from TarmDocumentoHabilitante doc " + + " where doc.fechaexpiracion >= sysdate and " + + " doc.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro)" + + " and doc.carma in (select arm1.pk from TarmArmas arm1 where arm1.codigoarma in (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))"); + dto.addSubQuery(subqueryFechaemiperm); + SubQuery subqueryFechaexpperm = new SubQuery("TarmDocumentoHabilitante", "fechaexpiracion", "fechaexpiracion", + // " i.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = + // t.cregistro) and i.carma = t.pk and "+ + " i.pk=(select max(doc.pk) " + + " from TarmDocumentoHabilitante doc " + + " where doc.fechaexpiracion >= sysdate and " + + " doc.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) " + + " and doc.carma in (select arm1.pk from TarmArmas arm1 where arm1.codigoarma in (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))"); + dto.addSubQuery(subqueryFechaexpperm); + + //uso actividad + SubQuery subqueryUsoactividad = new SubQuery("TgeneCatalogDetail", "description", "usoactividad", + // " i.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = + // t.cregistro) and i.carma = t.pk and "+ + " i.pk.catalog=(select tra.usoactividad " + + " from TarmTramite tra " + + " where tra.pk=(select doc1.ctramite " + + " from TarmDocumentoHabilitante doc1 " + + " where doc1.pk=(select max(doc.pk) " + + " from TarmDocumentoHabilitante doc " + + " where doc.fechaexpiracion >= sysdate " + + " and doc.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) " + + "and doc.carma in (select arm1.pk " + + " from TarmArmas arm1 " + + " where arm1.codigoarma in (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))" + + ")) and " + + " i.pk.catalogcode=(select tra.usoactividadcodigo " + + " from TarmTramite tra " + + " where tra.pk=(select doc1.ctramite " + + " from TarmDocumentoHabilitante doc1 " + + " where doc1.pk=(select max(doc.pk) " + + " from TarmDocumentoHabilitante doc " + + " where doc.fechaexpiracion >= sysdate " + + " and doc.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) " + + "and doc.carma in (select arm1.pk from TarmArmas arm1 " + + " where arm1.codigoarma = (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))" + + ")) "); + dto.addSubQuery(subqueryUsoactividad); + + SubQuery subqueryCategoria = new SubQuery("TgeneCatalogDetail", "description", "categoria", + // " i.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = + // t.cregistro) and i.carma = t.pk and "+ + " i.pk.catalog=(select tra.categoria " + + " from TarmTramite tra " + + " where tra.pk=(select doc1.ctramite " + + " from TarmDocumentoHabilitante doc1 " + + " where doc1.fechaexpiracion >= sysdate and " + + " doc1.pk=(select max(doc.pk) " + + " from TarmDocumentoHabilitante doc " + + " where doc.personcode=(select r.personcode " + + " from TarmRegistroArmas r where r.pk = t.cregistro) " + + "and doc.carma in (select arm1.pk " + + " from TarmArmas arm1 " + + " where arm1.codigoarma in (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))" + + ")) and " + + " i.pk.catalogcode=(select tra.categoriacodigo " + + " from TarmTramite tra " + + " where tra.pk=(select doc1.ctramite " + + " from TarmDocumentoHabilitante doc1 " + + " where doc1.fechaexpiracion >= sysdate and " + + " doc1.pk=(select max(doc.pk) " + + " from TarmDocumentoHabilitante doc " + + " where doc.personcode=(select r.personcode " + + " from TarmRegistroArmas r " + + " where r.pk = t.cregistro) " + + "and doc.carma in (select arm1.pk from TarmArmas arm1 where arm1.codigoarma in (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))" + + ")) "); + dto.addSubQuery(subqueryCategoria); + + System.out.println("dto: "+dto.toString()); + return dto; + } + + /** + * Método que se ejecuta al abrir el LOV de visualizar item seleccionado + * + * @throws Exception + */ + public void loadEdit() throws Exception { + verificaArmaExplosivo = Boolean.TRUE; + record.getModifiedData().put("provincia", + ProvinceController.getDescProvByCodigo(record.getCountrycode(), record.getProvincecode())); + record.getModifiedData().put("canton", CantonController.getDescCantonByCodigo(record.getCountrycode(), + record.getProvincecode(), record.getCantoncode())); + record.getModifiedData().put("ciudad", CityController.getDescCiudadByCodigo(record.getCountrycode(), + record.getProvincecode(), record.getCantoncode(), record.getCitycode())); + record.getModifiedData().put("parroquia", ParroquiaController.getDescParroquiaByCodigo(record.getCountrycode(), + record.getProvincecode(), record.getCantoncode(), record.getParroquiacode())); + if (record.getModifiedData().get("paisorigencode") != null) { + record.getModifiedData().put("paisorigen", CountryController + .findcountry(record.getModifiedData().get("paisorigencode").toString()).getDescription()); + } + if (record.getColor() != null) { + record.getModifiedData().put("colorD", CatalogDetailController + .findxCodigoCodcatalogo(record.getColor(), record.getColorcodigo()).getDescription()); + } + /* Aumentado */ + TarmDocumentoHabilitante documento = DocumentoHabilitanteController + .findxarma(record.getCodigoarma().toString()); + + if(documento!=null){ + TarmTramite tramite = TarmTramiteController.find(documento.getCtramite().toString()); + if(tramite!=null){ + TgeneCatalogDetail catalogo = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), + tramite.getCategoriacodigo()); + descategoria = catalogo.getDescription(); + TgeneCatalogDetail uso = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), + tramite.getUsoactividadcodigo()); + usoActividad = uso.getDescription(); + } + } + + } + + @Override + public void save() { + + } + +// public RegistroArmController getRegistroArmas() { +// return registroArmas; +// } +// +// +// public void setRegistroArmas(RegistroArmController registroArmas) { +// this.registroArmas = registroArmas; +// } + + public String getTipoDoc() { + return tipoDoc; + } + + public void setTipoDoc(String tipoDoc) { + this.tipoDoc = tipoDoc; + } + + public String getNumDoc() { + return numDoc; + } + + public void setNumDoc(String numDoc) { + this.numDoc = numDoc; + } + + public String getNombreRazon() { + return nombreRazon; + } + + public void setNombreRazon(String nombreRazon) { + this.nombreRazon = nombreRazon; + } + + public String getLongitud() { + return longitud; + } + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + public String getCalibre() { + return calibre; + } + + public void setCalibre(String calibre) { + this.calibre = calibre; + } + + public String getClase() { + return clase; + } + + public void setClase(String clase) { + this.clase = clase; + } + + public String getTipoarma() { + return tipoarma; + } + + public void setTipoarma(String tipoarma) { + this.tipoarma = tipoarma; + } + + public String getUnidadmedidapeso() { + return unidadmedidapeso; + } + + public void setUnidadmedidapeso(String unidadmedidapeso) { + this.unidadmedidapeso = unidadmedidapeso; + } + + public boolean isExisteTipoArmaExplosivo() { + return existeTipoArmaExplosivo; + } + + public void setExisteTipoArmaExplosivo(boolean existeTipoArmaExplosivo) { + this.existeTipoArmaExplosivo = existeTipoArmaExplosivo; + } + + public boolean isVerificaArmaExplosivo() { + return verificaArmaExplosivo; + } + + public void setVerificaArmaExplosivo(boolean verificaArmaExplosivo) { + this.verificaArmaExplosivo = verificaArmaExplosivo; + } + + public boolean isBloquearUnidadCantidad() { + return bloquearUnidadCantidad; + } + + public void setBloquearUnidadCantidad(boolean bloquearUnidadCantidad) { + this.bloquearUnidadCantidad = bloquearUnidadCantidad; + } + + public boolean isBloquearUnidadPeso() { + return bloquearUnidadPeso; + } + + public void setBloquearUnidadPeso(boolean bloquearUnidadPeso) { + this.bloquearUnidadPeso = bloquearUnidadPeso; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public String getRazonSocial() { + return razonSocial; + } + + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public String getDescategoria() { + return descategoria; + } + + public void setDescategoria(String descategoria) { + this.descategoria = descategoria; + } + + public String getUsoActividad() { + return usoActividad; + } + + public void setUsoActividad(String usoActividad) { + this.usoActividad = usoActividad; + } + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + /** + * Abre el lov de persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Maneja la respuesta del Lov de Personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + + TcustPersonDetail personaDetailSelecionada = (TcustPersonDetail) event.getObject(); + razonSocial = personaDetailSelecionada.getName(); + numeroDocumento = personaDetailSelecionada.getIdentification(); + filtroPersona = " and t.cregistro in (select i.pk from TarmRegistroArmas i where i.personcode =" + + personaDetailSelecionada.getPk().getPersoncode() + ")"; +// List registroArmasList = RegistroArmController.findxPersoncode(personaDetailSelecionada.getPk().getPersoncode().toString()); +// if(registroArmasList!=null && registroArmasList.size()>0){ +// filtroPersona = " and t.cregistro in ("; +// for(TarmRegistroArmas regArmaObj : registroArmasList){ +// filtroPersona+=regArmaObj.getPk().toString() + ","; +// } +// filtroPersona=filtroPersona.substring(0, filtroPersona.length()-1); +// filtroPersona+=")"; +// }else{ +// filtroPersona = " and t.cregistro = -10023"; +// } + querydatabase(); + } + + /** + * Metodo que genera el reporte para el registro seleccionado + * + * @param event + * @throws Exception + */ + public void imprimir(String codigoArma) { + System.out.println("Imprimir un reporte en PDF.. Pendiente implementar"); + try { + String gradoUsuario =""; + // String path = "armas/reports/reporteArticuloControl"; + String path = "armas/reports/reporteArticuloControl"; + // String path = "armas/subreports/historicoArmasArticuloControl"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename="reporteArticuloControl"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + parameters.put("carma", codigoArma); + //Fecha actual + Calendar fechaActualCldr = Calendar.getInstance(); + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH)+1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarFecha", fechaActualSB.toString()); + +// } + + String format = "pdf"; + + try { + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CustodiaTempAeropuertoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CustodiaTempAeropuertoController.java.svn-base new file mode 100644 index 0000000..1116d1a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CustodiaTempAeropuertoController.java.svn-base @@ -0,0 +1,749 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.PersonPhoneController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora para el manejo de las custodais temporales del aeropuerto. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CustodiaTempAeropuertoController extends AbstractController { + + /** + * Constructor + * @throws Exception + */ + public CustodiaTempAeropuertoController() throws Exception { + super(AbstractDataTransport.class); + } + + /** + * Controlador que maneja la custodiaTemporalController + */ + @ManagedProperty(value = "#{custodiaTemporalController}") + private CustodiaTemporalController custodiaTemporalController; + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmController; + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{armasController}") + private ArmasController armasController; + /** + * Controlador que maneja TarmDecomisoArma + */ + @ManagedProperty(value = "#{decomisoArmaController}") + private DecomisoArmaController decomisoArmaController; + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lprovinces; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcantones; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcities; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lprovincesdest; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcantonesdest; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcitiesdest; + /** + * Atributo del tipo de registro es decomiso + */ + private TgeneCatalogDetail tipoProceso; + /** + * Atributo del tipo de aerolineas + */ + private List aerolineas; + /** + * Atributo del tipo de aeropuertos origen + */ + private List aeropuertosorigen; + /** + * Atributo del tipo de aeropuertos destino + */ + private List aeropuertosdestino; + /** + * + */ + private List lEraser; + /** + * Arma seleccionada para el decomiso + */ + private TarmArmas armaSeleccionada; + /** + * Atributo para setear el centro de control + */ + private TarmCentroControl centroControl; + /** + * Atributo para setear el usuario logeado + */ + private TsafeUserDetail tsafeUserDetail; + /** + * Codigo del catalogo de PHONETYPE telefono fijo + */ + private String codigoTelefonoFijo; + /** + * Codigo del catalogo de ESTADOARM + */ + private String codigoEntregadoEstado; + /** + * Atributo para asignar el detalle de la custodia temporal + */ + private TarmDecomisoArma tarmDecomisoArmaBuscado; + + private Boolean btn=Boolean.FALSE; + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + public void init() { + try { + this.recperpage = 15; + this.lrecord = new ArrayList<>(); + this.beanalias = "CUSTODIATEMPORALAER"; + codigoTelefonoFijo=codigos("CODIGO.PHONE.FIJO"); + codigoEntregadoEstado =codigos("COD.ENTREGADO.ESTADO"); + String proceso=codigos("COD.CUSTODIA.TEMPORAL.TIPOPRO"); + tipoProceso = CatalogDetailController.findxCodigoCodcatalogo(proceso, "TIPOREGISTRO"); + //aerolinea + aerolineas=CatalogDetailController.find("AEROLINEAS"); + //aeropuertos + aeropuertosorigen=CatalogDetailController.find("AEROPUERTOS"); + aeropuertosdestino=CatalogDetailController.find("AEROPUERTOS"); + lprovinces = ProvinceController.find("EC"); + lprovincesdest = ProvinceController.find("EC"); + this.lEraser = new ArrayList(); + // centro de control + obtenerCentroControl(); + custodiaTemporalController.create(); + // seteo de variables + custodiaTemporalController.getRecord().setFechacustodios(new java.sql.Date(new Date().getTime())); + //seteamos el pais + custodiaTemporalController.getRecord().setCountrycodeorigen("EC"); + custodiaTemporalController.getRecord().setCountrycodedest("EC"); + armaSeleccionada=null; + btn=Boolean.FALSE; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para obtener el centro de control + * @throws Exception + */ + private void obtenerCentroControl() throws Exception { + tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + HashMap mtables = new HashMap(); + registroArmController.setRecperpage(10000); + DtoQuery dtoRegistroArma = registroArmController.getDtoQuery(true); + mtables.put(registroArmController.getBeanalias(), dtoRegistroArma); + + request.setQueryTables(mtables); + request.put("queryalias", "ARMASPERSONA"); + request.put("querytype", "P"); + request.put("serielote", armasController.getMfilters().get("lote")); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(resp); + } else { + armasController.setLrecord((List)resp.get("ARMASLIST")); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + if(armaSeleccionada==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccioneelarmaacustodiatemporal")); + } + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + //tipo de registro + custodiaTemporalController.getRecord().setTiporegistro(tipoProceso.getPk().getCatalog()); + custodiaTemporalController.getRecord().setTiporegistrocode(tipoProceso.getPk().getCatalogcode()); + //aerolinea + custodiaTemporalController.getRecord().setAerolineacode("AEROLINEAS"); + //centro control + custodiaTemporalController.getRecord().setCcentrocontrol(centroControl.getPk()); + //aeropuerto origen + custodiaTemporalController.getRecord().setAeropuertoorigcode("AEROPUERTOS"); + //aeropuerto destino + custodiaTemporalController.getRecord().setAeropuertodestcode("AEROPUERTOS"); + //persona que registra la custodia + custodiaTemporalController.getRecord().setPersoncode(tsafeUserDetail.getPk().getPersoncode()); + custodiaTemporalController.update(); + DtoSave dtosaveCustodiaTem = custodiaTemporalController.getDtoSave(); + dtosaveCustodiaTem.setPosition(1); + msave.put(custodiaTemporalController.getBeanalias(), dtosaveCustodiaTem); + + //arma + armasController.clearAll(); + armaSeleccionada.setIsnew(true); + armaSeleccionada.setPk(null); + //fecha de registro + armaSeleccionada.setFecharegistro(new java.sql.Date(new Date().getTime())); + //estado anterior + armaSeleccionada.getModifiedData().put("estadoanterior", armaSeleccionada.getEstado()); + //nuevo estado + TgeneCatalogDetail estadoArma = CatalogDetailController.find("ESTADOARMA", tipoProceso.getLegalcode()).get(0); + armaSeleccionada.setEstado(estadoArma.getPk().getCatalog()); + armaSeleccionada.setEstadocodigo("ESTADOARMA"); + armasController.actualizar(armaSeleccionada); + DtoSave dtosaveArma = armasController.getDtoSave(); + dtosaveArma.setPosition(2); + msave.put(armasController.getBeanalias(), dtosaveArma); + + + //decomisoarma es el detalle de la custodia temporal + DtoSave dtosaveDecomisoArma= decomisoArmaController.getDtoSave(); + dtosaveDecomisoArma.setPosition(3); + msave.put(decomisoArmaController.getBeanalias(), dtosaveDecomisoArma); + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + custodiaTemporalController.getRecord().setNotransaccion(resp.get("numerotransaccion").toString()); + armaSeleccionada=null; + btn=Boolean.TRUE; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que debuelve los datos del la custodia temporal Arma decomisada + * @param numeroTransaccion + */ + public void buscarDecomiso(String numeroTransaccion){ + try { + if(numeroTransaccion!=null && numeroTransaccion.length()>0){ + //custodia temporal + custodiaTemporalController.setRecord(CustodiaTemporalController.findNotransaccion(numeroTransaccion)); + if(custodiaTemporalController.getRecord()!=null && custodiaTemporalController.getRecord().getPk()!=null){ + //tarmDecomisoArma + TgeneCatalogDetail estadoArma = CatalogDetailController.find("ESTADOARMA", tipoProceso.getLegalcode()).get(0); + tarmDecomisoArmaBuscado=DecomisoArmaController.findxCodigoCustTemporal(custodiaTemporalController.getRecord().getPk(),estadoArma.getPk().getCatalog()); + if(tarmDecomisoArmaBuscado!=null){ + //decomiso del arma + armaSeleccionada= ArmasController.findxCodigo(tarmDecomisoArmaBuscado.getCarma()); + armaSeleccionada.getModifiedData().put("observacion", tarmDecomisoArmaBuscado.getObservacion()); + //Se puso el PK del arma en el mapa para que se presente en el dialogo de entrega material y no desaparezca + armaSeleccionada.getModifiedData().put("pk", armaSeleccionada.getPk()); + armasController.setLrecord(new ArrayList()); + armasController.getLrecord().add(armaSeleccionada); + executeProvince(); + executeProvinceDestino(); + executeCanton(); + executeCantonDestino(); + //propietario + TcustPersonDetail personDetail= PersonDetailController.find(custodiaTemporalController.getRecord().getPersoncodeprop().toString()); + custodiaTemporalController.getRecord().getModifiedData().put("tipodocumento",personDetail.getModifiedData().get("destipoidentificacion")); + custodiaTemporalController.getRecord().getModifiedData().put("numerodocumento",personDetail.getIdentification()); + custodiaTemporalController.getRecord().getModifiedData().put("nombrerazonsocial",personDetail.getName()); + TcustPersonPhone personPhone= PersonPhoneController.find(custodiaTemporalController.getRecord().getPersoncodeprop().toString(), codigoTelefonoFijo); + if(personPhone!=null){ + custodiaTemporalController.getRecord().getModifiedData().put("telefono",personPhone.getPhonenumber()); + } + }else{ + this.init(); + } + }else{ + this.init(); + } + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para la entrega del arma y cambio de estado + * Guarda en la BD + */ + public void saveEntrega(){ + try { + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + //arma + armasController.clearAll(); + armaSeleccionada.setIsnew(true); + armaSeleccionada.setPk(null); + //fecha de registro + armaSeleccionada.setFecharegistro(new java.sql.Date(new Date().getTime())); + //nuevo estado debe regresar al estado anterior + armaSeleccionada.setEstado(tarmDecomisoArmaBuscado.getEstadoanterior()); + //fecha de registro + armaSeleccionada.setFecharegistro(new java.sql.Date(new Date().getTime())); + armasController.actualizar(armaSeleccionada); + DtoSave dtosaveArma = armasController.getDtoSave(); + dtosaveArma.setPosition(1); + msave.put(armasController.getBeanalias(), dtosaveArma); + + //decomisoarma es el detalle de la custodia temporal + decomisoArmaController.clearAll(); + tarmDecomisoArmaBuscado.setIsnew(true); + tarmDecomisoArmaBuscado.setPk(null); + //estado entregado + tarmDecomisoArmaBuscado.setEstado(codigoEntregadoEstado); + decomisoArmaController.setRecord(tarmDecomisoArmaBuscado); + //la fecha de registro + tarmDecomisoArmaBuscado.setFdecomiso((new Timestamp(new java.util.Date().getTime()))); + decomisoArmaController.update(); + DtoSave dtosaveDecomisoArma= decomisoArmaController.getDtoSave(); + dtosaveDecomisoArma.setPosition(2); + msave.put(decomisoArmaController.getBeanalias(), dtosaveDecomisoArma); + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + armaSeleccionada=null; + btn=Boolean.TRUE; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para inicializar la lista de las armas + * y la validacion del propietario del arma + */ + public void registrarMaterial(){ + try { + if(custodiaTemporalController.getRecord().getPersoncodeprop()==null ||custodiaTemporalController.getRecord().getPersoncodeprop()==0){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionepropietario")); + return; + } + armasController.setLrecord(new ArrayList()); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + //lov de persona + /** + * Método para abrir el lov de personas + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Maneja la respuesta del Lov de Personas + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail personaDetailSelecionada = (TcustPersonDetail) event.getObject(); + custodiaTemporalController.getRecord().setPersoncodeprop(personaDetailSelecionada.getPk().getPersoncode()); + custodiaTemporalController.getRecord().getModifiedData().put("tipodocumento",personaDetailSelecionada.getModifiedData().get("destipoidentificacion")); + custodiaTemporalController.getRecord().getModifiedData().put("numerodocumento",personaDetailSelecionada.getIdentification()); + custodiaTemporalController.getRecord().getModifiedData().put("nombrerazonsocial",personaDetailSelecionada.getName()); + custodiaTemporalController.getRecord().getModifiedData().put("telefono",personaDetailSelecionada.getModifiedData().get("telefono")); + registroArmController.getMfilters().put("personcode", personaDetailSelecionada.getPk().getPersoncode().toString()); + } + + /** + * Método para manejar el evento change en el CheckBox + * Arma a decomisar + * @throws Exception + */ + public void onChange(TarmArmas arma) throws Exception { + for(TarmArmas t:armasController.getLrecord()){ + t.getModifiedData().put("estado",Boolean.FALSE); + if(arma.getPk().equals(t.getPk())){ + t.getModifiedData().put("estado",Boolean.TRUE); + } + } + } + + /** + * Metodo que se ejecuta al pulsar el boton aceptar del dialog que lista las armas a seleccionar + * Valida si selecciono algun registro si no le obliga a seleccionar + */ + public void aceptarPopup(){ + //validamos que de la lista exista un registro escogido + armaSeleccionada=null; + for(TarmArmas t:armasController.getLrecord()){ + if(Boolean.TRUE.equals(t.getModifiedData().get("estado"))){ + if(t.getModifiedData().get("observacion")==null || t.getModifiedData().get("observacion").toString().length()==0){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingreselaobservacion")); + return; + } + armaSeleccionada=t; + } + } + if(armaSeleccionada==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccioneelarmaacustodiatemporal")); + return; + } + } + + /** + * Metodo que se ejecuta al pulsar el boton cancelar del dialog de listado de las armas + * Cambia el estado a false de las armas seleccionadas + */ + public void cancelarPopup(){ + armaSeleccionada=null; + for(TarmArmas t:armasController.getLrecord()){ + t.getModifiedData().put("estado",Boolean.FALSE); + } + } + + /** + * Metodo para buscar el propietario del arma y asignarle al arma + */ + public void cargarPropietario(){ + for(TarmArmas arma:armasController.getLrecord()){ + if(arma.getModifiedData().get("personcode")!=null){ + TcustPersonDetail personaDetalle=PersonDetailController.find(arma.getModifiedData().get("personcode").toString()); + arma.getModifiedData().put("propietario", personaDetalle.getName()); + } + } + } + /** + * Método para el evento change del combo provincias + */ + public void executeProvince() { + if ((custodiaTemporalController.getRecord().getCountrycodeorigen() != null) && (custodiaTemporalController.getRecord().getCountrycodeorigen().compareTo("") != 0)) { + lcantones = CantonController.find(custodiaTemporalController.getRecord().getCountrycodeorigen(), custodiaTemporalController.getRecord().getProvincecodeorigen()); + lcities = new ArrayList<>(); + lEraser = new ArrayList<>(); + lprovincesdest = new ArrayList<>(); + for(TgeneProvince prov:lprovinces){ + if(prov.getPk().getProvincecode().equals(this.custodiaTemporalController.getRecord().getProvincecodeorigen())){ + this.lEraser.add(prov); + continue; + }else { + lprovincesdest.add(prov); + } + + } + + + + } + } + + /** + * Método para el evento change del combo aereopuertos + */ + public void executeAereopuerto() { + aeropuertosdestino = new ArrayList<>(); + lEraser = new ArrayList<>(); + for(TgeneCatalogDetail aereo:this.aeropuertosorigen){ + if(aereo.getPk().getCatalog().equals(this.custodiaTemporalController.getRecord().getAeropuertoorig())){ + this.lEraser.add(aereo); + continue; + }else { + aeropuertosdestino.add(aereo); + } + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton() { + if ((custodiaTemporalController.getRecord().getCountrycodeorigen() != null) && (custodiaTemporalController.getRecord().getCountrycodeorigen().compareTo("") != 0)) { + lcities = CityController.find(custodiaTemporalController.getRecord().getCountrycodeorigen(), custodiaTemporalController.getRecord().getProvincecodeorigen(), + custodiaTemporalController.getRecord().getCantoncodeorigen()); + } + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvinceDestino() { + if ((custodiaTemporalController.getRecord().getCountrycodedest() != null) && (custodiaTemporalController.getRecord().getCountrycodedest().compareTo("") != 0)) { + lcantonesdest = CantonController.find(custodiaTemporalController.getRecord().getCountrycodedest(), custodiaTemporalController.getRecord().getProvincecodedest()); + lcitiesdest = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCantonDestino() { + if ((custodiaTemporalController.getRecord().getCountrycodedest()!= null) && (custodiaTemporalController.getRecord().getCountrycodedest().compareTo("") != 0)) { + lcitiesdest = CityController.find(custodiaTemporalController.getRecord().getCountrycodedest(), custodiaTemporalController.getRecord().getProvincecodedest(), + custodiaTemporalController.getRecord().getCantoncodedest()); + } + } + + /** + * Metodo para obtener los codigos + */ + public String codigos(String parametro){ + TgeneParameters tgeneParameters= ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + + + public CustodiaTemporalController getCustodiaTemporalController() { + return custodiaTemporalController; + } + + public void setCustodiaTemporalController( + CustodiaTemporalController custodiaTemporalController) { + this.custodiaTemporalController = custodiaTemporalController; + } + + public ArmasController getArmasController() { + return armasController; + } + + public void setArmasController(ArmasController armasController) { + this.armasController = armasController; + } + + public DecomisoArmaController getDecomisoArmaController() { + return decomisoArmaController; + } + + public void setDecomisoArmaController( + DecomisoArmaController decomisoArmaController) { + this.decomisoArmaController = decomisoArmaController; + } + + public List getLprovinces() { + return lprovinces; + } + + public void setLprovinces(List lprovinces) { + this.lprovinces = lprovinces; + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public List getLcities() { + return lcities; + } + + public void setLcities(List lcities) { + this.lcities = lcities; + } + + public TgeneCatalogDetail getTipoProceso() { + return tipoProceso; + } + + public void setTipoProceso(TgeneCatalogDetail tipoProceso) { + this.tipoProceso = tipoProceso; + } + + public List getAerolineas() { + return aerolineas; + } + + public void setAerolineas(List aerolineas) { + this.aerolineas = aerolineas; + } + + public List getLprovincesdest() { + return lprovincesdest; + } + + public void setLprovincesdest(List lprovincesdest) { + this.lprovincesdest = lprovincesdest; + } + + public List getLcantonesdest() { + return lcantonesdest; + } + + public void setLcantonesdest(List lcantonesdest) { + this.lcantonesdest = lcantonesdest; + } + + public List getLcitiesdest() { + return lcitiesdest; + } + + public void setLcitiesdest(List lcitiesdest) { + this.lcitiesdest = lcitiesdest; + } + + public TarmArmas getArmaSeleccionada() { + return armaSeleccionada; + } + + public void setArmaSeleccionada(TarmArmas armaSeleccionada) { + this.armaSeleccionada = armaSeleccionada; + } + + public RegistroArmController getRegistroArmController() { + return registroArmController; + } + + public void setRegistroArmController(RegistroArmController registroArmController) { + this.registroArmController = registroArmController; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public TsafeUserDetail getTsafeUserDetail() { + return tsafeUserDetail; + } + + public void setTsafeUserDetail(TsafeUserDetail tsafeUserDetail) { + this.tsafeUserDetail = tsafeUserDetail; + } + + public Boolean getBtn() { + return btn; + } + + public void setBtn(Boolean btn) { + this.btn = btn; + } + + public List getAeropuertosorigen() { + return aeropuertosorigen; + } + + public void setAeropuertosorigen(List aeropuertosorigen) { + this.aeropuertosorigen = aeropuertosorigen; + } + + public List getAeropuertosdestino() { + return aeropuertosdestino; + } + + public void setAeropuertosdestino(List aeropuertosdestino) { + this.aeropuertosdestino = aeropuertosdestino; + } + + + + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CustodiaTemporalController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CustodiaTemporalController.java.svn-base new file mode 100644 index 0000000..e08ca74 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CustodiaTemporalController.java.svn-base @@ -0,0 +1,134 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmCustodiaTemporal; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TarmDecomiso. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CustodiaTemporalController extends AbstractController { + + /** + * Constructor + * @throws Exception + */ + public CustodiaTemporalController() throws Exception { + super(TarmCustodiaTemporal.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + public void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CUSTODIATEM"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que consulta por Catalog y Catalogcode ambos requeridos + */ + public static TarmCustodiaTemporal findNotransaccion(String notransaccion) { + try {//TgeneCatalogDetailKey + CustodiaTemporalController cc = new CustodiaTemporalController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("notransaccion", notransaccion); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CustodiosController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CustodiosController.java.svn-base new file mode 100644 index 0000000..0878c9a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/CustodiosController.java.svn-base @@ -0,0 +1,238 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.soli.TarmOrdenTrabajoCustodios; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CustodiosController extends AbstractController { + + //Grados + List lGrados=new ArrayList(); + Boolean salva=false; + + public CustodiosController() throws Exception { + super(TarmOrdenTrabajoCustodios.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "CUSTODIOSCONTROLLER"; + this.record=new TarmOrdenTrabajoCustodios(); + record.isnew=true; + querydatabase(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + //Obteniendo la lista de grados militares + lGrados=CatalogDetailController.find("MILITARYGRADE"); + + /* + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + //Obteniendo la lista de grados militares + lGrados=CatalogDetailController.find("GRADOS"); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + */ + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void update(TarmOrdenTrabajoCustodios bean) throws Exception { + record=bean; + update(); + } + + public void update(List bean) throws Exception { + for (TarmOrdenTrabajoCustodios cus : bean) { + record=cus; + update(); + } + } + + @Override + public void update() throws Exception { + Boolean duplicada=false; + if(this.record!=null){ + for (TarmOrdenTrabajoCustodios custodio : this.lrecord) { + if(custodio.getCedulacustodio().equalsIgnoreCase(this.record.getCedulacustodio())){ + duplicada=true; + } + } + if(!this.salva && duplicada){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("cedulaDuplicada")); + }else{ + super.update(); + } + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Devuelve la descripcion de un grado dado su codigo + * @param gradoCodigo + * @return + */ + @SuppressWarnings("finally") + public String grado(String gradoCodigo){ + String descripcionGrado=""; + + for (TgeneCatalogDetail cd : lGrados) { + if(cd.getLegalcode().equalsIgnoreCase(gradoCodigo)){ + return cd.getDescription(); + } + } + + return descripcionGrado; + } + + /** + * Obtiene todos los custodios + * @return List + */ + public static List find() { + try { + CustodiosController cc = new CustodiosController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Obtiene los custodios de una orden de trabajo + * @return List + */ + public static List findByCodigoOrden(Long cordentrabajo) { + try { + CustodiosController cc = new CustodiosController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("cordentrabajo", cordentrabajo.toString()); + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + public List getlGrados() { + return lGrados; + } + + public void setlGrados(List lGrados) { + this.lGrados = lGrados; + } + + public Boolean getSalva() { + return salva; + } + + public void setSalva(Boolean salva) { + this.salva = salva; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DecomisoArmaController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DecomisoArmaController.java.svn-base new file mode 100644 index 0000000..3936bbf --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DecomisoArmaController.java.svn-base @@ -0,0 +1,362 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class DecomisoArmaController extends AbstractController { + + public DecomisoArmaController() throws Exception { + super(TarmDecomisoArma.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "TARMDECOMISOARMA"; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + for(TarmDecomisoArma decomisoArma:lrecord){ + TarmArmas arma = ArmasController.findPorCodigo(decomisoArma.getCarma()); + if(arma!=null){ + TarmTipoArmaExplosivo tipoArmaExplosivo = TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo()); + decomisoArma.getModifiedData().put("ntipo", arma.getModifiedData().get("tipo")); + decomisoArma.getModifiedData().put("ncalibre", arma.getModifiedData().get("calibre")); + decomisoArma.getModifiedData().put("nclase", arma.getModifiedData().get("clase")); + if(tipoArmaExplosivo.getLongitud()!=null){ + decomisoArma.getModifiedData().put("nlongitud", CatalogDetailController.findxCodigoCodcatalogo(tipoArmaExplosivo.getLongitud(), tipoArmaExplosivo.getLongitudcodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tipoArmaExplosivo.getLongitud(), tipoArmaExplosivo.getLongitudcodigo()).getDescription():""); + } + else{ + decomisoArma.getModifiedData().put("nlongitud", ""); + } + decomisoArma.getModifiedData().put("nmarca", CatalogDetailController.findxCodigoCodcatalogo( arma.getMarca(), arma.getMarcacodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo( arma.getMarca(), arma.getMarcacodigo()).getDescription():""); + decomisoArma.getModifiedData().put("nserie", arma.getSeriecanon()); + decomisoArma.getModifiedData().put("nlote", arma.getLote()); + decomisoArma.getModifiedData().put("nunidad", CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getUnidadmedida(), decomisoArma.getUnidadmedidacode())!=null?CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getUnidadmedida(), decomisoArma.getUnidadmedidacode()).getDescription():""); + + decomisoArma.getModifiedData().put("nmotivodecomiso", CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getMotivodecomiso(), decomisoArma.getMotivodecomisocodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getMotivodecomiso(), decomisoArma.getMotivodecomisocodigo()).getDescription():""); + + TarmRegistroArmas registroArma = RegistroArmController.findByCodigo(arma.getCregistro().toString()); + if(registroArma!=null && registroArma.getPersoncode()!=null){ + Integer personCodePropietario = registroArma.getPersoncode(); + decomisoArma.getModifiedData().put("npropietario", PersonDetailController.find(personCodePropietario.toString()).getName()); + } + else{ + decomisoArma.getModifiedData().put("npropietario", ""); + } + } + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + protected void consulta() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + Filter filtro=new Filter(); + filtro.setSql("t.fdecomiso=(select max(te.fdecomiso) from TarmDecomisoArma te where te.ccustemp=t.ccustemp)"); + dto.addFiltro(filtro); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + public static TarmDecomisoArma findByCodigo(String cDecomisoArma) { + try { + DecomisoArmaController cc = new DecomisoArmaController(); + cc. init(); + cc.recperpage = 300; + cc.addFilter("pk", cDecomisoArma); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findByCodigoDecomiso(String cDecomiso) { + try { + DecomisoArmaController cc = new DecomisoArmaController(); + cc. init(); + cc.recperpage = 300; + cc.addFilter("cdecomiso", cDecomiso); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmDecomisoArma findxCodigoCustTemporal(String ccustemp,String estado) { + try { + DecomisoArmaController cc = new DecomisoArmaController(); + cc. init(); + cc.recperpage = 300; + cc.addFilter("ccustemp", ccustemp); + cc.addFilter("estado", estado); + cc.consulta(); + if (cc.lrecord != null && cc.lrecord.size()>0) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + public void update(TarmDecomisoArma bean) throws Exception { + record=bean; + update(); + } + + public static List find(Long codigoenvio) { + try { + DecomisoArmaController cc = new DecomisoArmaController(); + cc. init(); + cc.recperpage = 300; + cc.addFilter("cdecarmtranrecepcion", codigoenvio.toString()); + cc.querydatabaseSimple(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findArmasPorSancionar(Long codigoenvio) { + try { + DecomisoArmaController cc = new DecomisoArmaController(); + cc. init(); + cc.recperpage = 300; + cc.addFilter("cdecarmtranrecepcion", codigoenvio.toString()); + cc.addFilter("estado", "RECL"); + cc.querydatabaseSimple(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findEnvio(Long codigoenvio) { + try { + DecomisoArmaController cc = new DecomisoArmaController(); + cc. init(); + cc.recperpage = 300; + cc.addFilter("cdecomisoarmatransaccion", codigoenvio.toString()); + cc.querydatabaseSimple(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaseSimple() { + try { + DtoQuery dto = this.getDtoQuery(); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private DtoQuery getDtoQuery() throws Exception{ + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryClasecatalogo= new SubQuery("TgeneCatalogDetail","description","nclase","i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma)) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o " + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))"); + dto.addSubQuery(subqueryClasecatalogo); + SubQuery subqueryTipoArmaExplosivo= new SubQuery("TgeneCatalogDetail","description","ntipo","i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o " + + " where o.pk= (select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))" + + " and i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","nmarca","i.pk.catalog= (select o.marca from TarmArmas o where o.pk=t.carma)" + + " and i.pk.catalogcode=(select o.marcacodigo from TarmArmas o where o.pk=t.carma)"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ncalibre","i.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma)"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryLote= new SubQuery("TarmArmas","lote","nserie","i.pk=t.carma"); + dto.addSubQuery(subqueryLote); + + SubQuery subqueryNRecivo= new SubQuery("TarmDecomiso","numerorecibo","nrecibo","i.pk=t.cdecomiso"); + dto.addSubQuery(subqueryNRecivo); + SubQuery subqueryNTransaccion= new SubQuery("TarmDecomiso","numerotransaccion","numerotransaccion","i.pk=t.cdecomiso"); + dto.addSubQuery(subqueryNTransaccion); + SubQuery subqueryUnidadTipo= new SubQuery("TgeneCatalogDetail","description","nunidad","i.pk.catalog= (select o.unidadmedidapeso from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma)) and " + + " i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))"); + dto.addSubQuery(subqueryUnidadTipo); + + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog= (select o.color from TarmArmas o where o.pk=t.carma)" + + " and i.pk.catalogcode=(select o.colorcodigo from TarmArmas o where o.pk=t.carma)"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog= (select o.estado from TarmArmas o where o.pk=t.carma) " + + " and i.pk.catalogcode=(select o.estadocodigo from TarmArmas o where o.pk=t.carma)"); + dto.addSubQuery(subqueryEstado); + + SubQuery subqueryIndentificacion= new SubQuery("TcustPersonDetail","identification","identification","i.pk.personcode=(select p from TarmRegistroArmas p where p.pk=(select o.cregistro from TarmArmas o where o.pk=t.carma)) " + + " and i.pk.dateto=to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryIndentificacion); + SubQuery subqueryRazonSocial= new SubQuery("TcustPersonDetail","name","nrazons","i.pk.personcode=(select p.personcode from TarmRegistroArmas p where p.pk=(select o.cregistro from TarmArmas o where o.pk=t.carma)) " + + " and i.pk.dateto=to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryRazonSocial); + return dto; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DecomisoArmaTransaccionController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DecomisoArmaTransaccionController.java.svn-base new file mode 100644 index 0000000..843be61 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DecomisoArmaTransaccionController.java.svn-base @@ -0,0 +1,322 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class DecomisoArmaTransaccionController extends AbstractController { + + public DecomisoArmaTransaccionController() + throws Exception { + super(TarmDecomisoArmaTransaccion.class); + } + + @Override + protected void querydatabase() { + + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "DECOMISOARMATRANSACCION"; + querydatabase(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void save() { + try { + update(); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Metodo para encontrar por numero de envío + * @param envio + * @param esRecepcion + * @return listado de los registros que cumplen el criterio de busqueda + */ + public static List findPorEnvio(String envio,boolean esRecepcion) { + try { + DecomisoArmaTransaccionController cc = new DecomisoArmaTransaccionController(); + cc.init(); + cc.recperpage = 15; + cc.addFilter("numerotransaccion", envio); + if(esRecepcion){ + cc.addFilter("estadofirma", "Y"); + } + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para encontrar por el pk + * @param cdeocmisoarmatransaccion + */ + public static TarmDecomisoArmaTransaccion find(String cdeocmisoarmatransaccion) { + try { + DecomisoArmaTransaccionController cc = new DecomisoArmaTransaccionController(); + cc.init(); + cc.recperpage = 15; + cc.addFilter("pk", cdeocmisoarmatransaccion); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * + * @param envio + * @return + */ + public static List findPorEnvioNroDecomiso(String tipoDecomiso, Long numeroDecomiso) { + try { + DecomisoArmaTransaccionController cc = new DecomisoArmaTransaccionController(); + cc.init(); + cc.recperpage = 15; + cc.querydatabaseManu(tipoDecomiso, numeroDecomiso); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + protected void querydatabaseManu(String tipoDecomiso, Long numeroDecomiso) { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + if (numeroDecomiso != null) { + Filter f = null; + f = new Filter(); + + if("ENTREGA".equals(tipoDecomiso)){ + f.setSql("t.pk in (select tr.cdecomisoarmatransaccion from com.fp.persistence.parmas.soli.TarmDecomisoArma tr where tr.cdecomiso = " + numeroDecomiso + ")"); + }else if("RECEPCION".equals(tipoDecomiso)){ + f.setSql("t.pk in (select tr.cdecarmtranrecepcion from com.fp.persistence.parmas.soli.TarmDecomisoArma tr where tr.cdecomiso = " + numeroDecomiso + ")"); + } + dto.addFiltro(f); + } + + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + + } + + /** + * + * @param envio + * @return + */ + public static List findPorOrganismoUnidad(String codigoUnidadControl, Date fechaCorte, String operacion) { + try { + DecomisoArmaTransaccionController cc = new DecomisoArmaTransaccionController(); + cc.init(); + cc.recperpage = 10000; + cc.querydatabaseByFechaCorte(fechaCorte, codigoUnidadControl, operacion); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + protected void querydatabaseByFechaCorte(Date fechaCorte, String codigoUnidadControl, String operacion) { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + Filter f = null; + f = new Filter(); + SimpleDateFormat formato= new SimpleDateFormat("yyyy-MM-dd"); + String ccentrocontrol = ""; + ccentrocontrol = "tb.ccentrocontroldestino = '" + codigoUnidadControl+"'" ; +// if(operacion.equals("ENVIO")){ +// ccentrocontrol = "tb.ccentrocontroldestino = '" + codigoUnidadControl+"'" ; +// }else{ +// ccentrocontrol = "tb.ccentrocontrolorigen = '" + codigoUnidadControl+"'" ; +// } + + f.setSql("trunc(t.ftransaccion) <= " + "TO_DATE('" +formato.format(fechaCorte)+ "','yyyy-MM-dd')" + + " and t.pk in (select tb.cdecomisoarmatransaccion from com.fp.persistence.parmas.soli.TarmTransaccionArmaBodega tb where " + + ccentrocontrol + " and tb.operacion = '"+ operacion+"') and estadofirma = 'Y'" + ); + dto.addFiltro(f); + + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + + } + + + /** + * + * @param envio + * @return + */ + public static List findParaReception(String codigoUnidadControl) { + try { + DecomisoArmaTransaccionController cc = new DecomisoArmaTransaccionController(); + cc.init(); + cc.recperpage = 100; + cc.querydatabaseForReception(codigoUnidadControl); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + protected void querydatabaseForReception(String codigoUnidadControl) { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + Filter f = new Filter(); + f.setSql("t.estadoflujo = 'ENV' and t.estadofirma = 'Y' and " + + " t.pk in (select tb.cdecomisoarmatransaccion from com.fp.persistence.parmas.soli.TarmDecomisoArma tb where tb.coperaciontransaccion = 'ENVIO')" + + " and t.pk in (select tba.cdecomisoarmatransaccion from com.fp.persistence.parmas.soli.TarmTransaccionArmaBodega tba where tba.ccentrocontroldestino = '" + codigoUnidadControl + "')"); + dto.addFiltro(f); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DecomisoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DecomisoController.java.svn-base new file mode 100644 index 0000000..9bbd707 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DecomisoController.java.svn-base @@ -0,0 +1,336 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pentaho.PentahoController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TarmDecomiso. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class DecomisoController extends AbstractController { + + /** + * Constructor + * @throws Exception + */ + public DecomisoController() throws Exception { + super(TarmDecomiso.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "DECOMISO"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + if(getMfilelds().get("ccentrocontroldestino")!=null){ + Filter filtro = new Filter(); + filtro.setSql(getMfilelds().get("ccentrocontroldestino").toString()); + dto.addFiltro(filtro); + } + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + protected void querydatabaseSimple() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + Filter filtroFinal = new Filter(); + String format = new SimpleDateFormat("MM-YY").format(Calendar.getInstance().getTime()); + String sqlFiltro = "TO_CHAR(t.fecharegistro, 'MM-YY') = '"+format+"'"; + filtroFinal.setSql(sqlFiltro); + dto.addFiltro(filtroFinal); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void updateDecomiso(TarmDecomiso bean) throws Exception{ + record = bean; + record.setIsnew(false); + record.put("ORIGINALBEAN", bean.get("ORIGINALBEAN")); + super.update(); + } + + @ManagedProperty(value = "#{pentahoController}") + private PentahoController pentahoController; + + public PentahoController getPentahoController() { + return pentahoController; + } + + public void setPentahoController(PentahoController pentahoController) { + this.pentahoController = pentahoController; + } + + /** + * Método para obtener el decomiso por el codigo de decomiso + * @param cRecibo + * @return + */ + public static TarmDecomiso findByCodigo(String cRecibo) { + try { + DecomisoController cc = new DecomisoController(); + cc. init(); + cc.recperpage = 300; + cc.addFilter("pk", cRecibo); + + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para filtrar por codigo de centro de control + * @param ccentroControl + * @param numerotransaccion + * @return + */ + public static List findByCodigoCentroControl(String ccentroControl, String numerotransaccion) { + try { + DecomisoController cc = new DecomisoController(); + cc. init(); + cc.recperpage = 10000; + + if(ccentroControl!=null && !ccentroControl.isEmpty()){ + cc.addFilter("ccentrocontrol", ccentroControl); + } + if(numerotransaccion!=null && !numerotransaccion.isEmpty()){ + cc.addFilter("numerotransaccion", numerotransaccion); + } + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para filtrar por codigo de centro de control + * @param ccentroControl + * @return + */ + public static List findByCentroControl(String ccentroControl) { + try { + DecomisoController cc = new DecomisoController(); + cc. init(); + cc.recperpage = 10000; + + if(ccentroControl!=null && !ccentroControl.isEmpty()){ + cc.addField("ccentrocontroldestino","(ccentrocontrol='"+ccentroControl+"' and ccentrocontroldestino is null) or (ccentrocontroldestino='"+ccentroControl+"')"); + } + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + /** + * Metodo para filtrar por OrganismoControl y Unidad + * @param organismoControlCode + * @return + */ + public static List findByOrganismoControlUnidad(String organismoControlCode, String unidadCode) { + try { + DecomisoController cc = new DecomisoController(); + cc. init(); + cc.recperpage = 10000; + + TgeneCatalogDetail organismoControlCatalog = CatalogDetailController.findCatalogo("INSTITUCION", organismoControlCode); + + if(organismoControlCatalog!=null && unidadCode!=null){ + cc.addField("ccentrocontroldestino","(unidad='"+unidadCode+"' and organismocontrol='"+organismoControlCatalog.getDescription()+"')"); + } + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para filtrar por OrganismoControl + * + * @param numeroRecibo numero de recibo + * @param tipoProceso tipo de proceso + * @param organismoControl organismo de control + * @return + */ + public static boolean findReciboByTipoProcesoOrganismoControl(String numeroRecibo, String tipoProceso, String organismoControl) { + + try { + DecomisoController cc = new DecomisoController(); + cc.init(); + cc.recperpage = 1000; + if (numeroRecibo != null && !numeroRecibo.isEmpty()) { + cc.addFilter("numerorecibo", numeroRecibo); + } + if (tipoProceso != null && !tipoProceso.isEmpty()) { + cc.addFilter("tipoproceso", tipoProceso); + } + if (organismoControl != null && !organismoControl.isEmpty()) { + cc.addFilter("ccentrocontrol", organismoControl); + } + + cc.querydatabaseSimple(); + if (cc.lrecord != null && cc.lrecord.size() > 0) { + return true; + } + return false; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return false; + } + } + + + + public static TarmDecomiso find(String numerotransaccion) { + try { + DecomisoController cc = new DecomisoController(); + cc. init(); + cc.recperpage = 300; + cc.addFilter("numerotransaccion", numerotransaccion); + cc.querydatabase(); + if (cc.lrecord != null && cc.lrecord.size()>0) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DecomisoMaterialController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DecomisoMaterialController.java.svn-base new file mode 100644 index 0000000..3404d51 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DecomisoMaterialController.java.svn-base @@ -0,0 +1,2373 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang.StringUtils; +import org.primefaces.context.RequestContext; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.SelectEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.lov.ArmaExplosivoLovController; +import com.fp.frontend.controller.armas.lov.ArmasLovController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.PersonPhoneController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.ValidateIdentification; +import com.fp.frontend.webservices.snap.cedula.ClienteCedula; +import com.fp.frontend.webservices.snap.ruc.ClienteRUC; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +import ec.gob.registrocivil.consultacedula.Cedula; +import ec.gov.sri.wsconsultacontribuyente.Contribuyente; + +/** + * Clase controladora del bean TarmDecomiso. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class DecomisoMaterialController extends AbstractController { + + /** + * Constructor + * @throws Exception + */ + public DecomisoMaterialController() throws Exception { + super(AbstractDataTransport.class); + } + /** + * Controlador que maneja el decomiso + */ + @ManagedProperty(value = "#{decomisoController}") + private DecomisoController decomisoController; + /** + * Controlador que maneja PersonDetail + */ + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController personDetailController; + /** + * Controlador que maneja PersonPhone + */ + @ManagedProperty(value = "#{personPhoneController}") + private PersonPhoneController personPhoneController; + + /** + * Detalle del usuario + */ + private TcustPersonDetail usuario; + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{armasController}") + private ArmasController armasController; + + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{armasLovController}") + private ArmasLovController armasLovController; + /** + * Controlador que maneja TarmRegistroArmas + */ + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmController; + /** + * Controlador que maneja TarmDecomisoArma + */ + @ManagedProperty(value = "#{decomisoArmaController}") + private DecomisoArmaController decomisoArmaController; + /** + * Controlador Inyectado ReportController + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lprovinces; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcantones; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lparroquias; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcities; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List tipoProceso; + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List tipoDocumeno; + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List grados; + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List unidades; + + private TsafeUserDetail tsafeUserDetail; + + private String centroControl; + + private String unidad; + + private TarmCentroControl centroControlLogeado; + + private List centroControls; + /** + * Deshabilita la pantalla después de grabar la solicitud + */ + private boolean deshabilitarPantalla; + /** + * Deshabilita la pantalla materiales después de grabar la solicitud + */ + private boolean deshabilitarPantallaMaterial; + /** + * Atributo para setear el portador del arma + */ + private TcustPersonDetail tcustPersonDetailPortador; + + private String nombrePortador; + /** + /** + * Atributo para ingresar el numero de identificacion del propietario + */ + private String identificacionPro; + /** + * Atributo para ingresar el tipo de identificacion del propietario + */ + private String tipoIdentificacionPro; + /** + * Variables de tipo boolean para selecionar el usuario sin portador + */ + private boolean sinPortador; + /** + * Variables de tipo boolean para selecionar el usuario sin documento + */ + private boolean sinDocumento; + + /** + * Variables de tipo boolean para habilitar el boton crear en el lov registro material + */ + private boolean habilitaNoDecomiso; + /** + * Variables que permite el ingreso de un portador + */ + private String ingresoPortador; + /** + * Variables de tipo boolean para selecionar el usuario sin portador + */ + private boolean sinIdentificacion; + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List motivoDecomisoList; + /** + * Listado de marcas + */ + private List lmarca; + /** + * Listado de colores + */ + private List lcolor; + /** + * Listado de tipos de fabricación + */ + private List ltipofabricacion; + /** + * Listado de paises + */ + private List lcountry; + + /** + * codigo del de arma + */ + private String codigoArma; + /** + * codigo del ruc + */ + private String codigoRuc; + /** + * codigo del ruc + */ + private String codigoCedula; + /** + * codigo de la persona por defaul + */ + private String codigoPersonaSinIdentificacion; + + private String codigoTelefonoFijo; + /** + * descripción de la unidad de medida + */ + private String codigoUnidadpeso; + /** + * codigo del ruc + */ + private String codigoPasaporte; + /** + * descripción de la unidad de medida + */ + private String unidadpeso; + /** + * descripción de la unidad de medida + */ + private String descripcionUnidadpeso; + /** + * Tipo del arma explosivo + */ + private TarmTipoArmaExplosivo tipoArmaExplosivo ; + /** + * Arma seleccionada para el decomiso + */ + private List armaSeleccionadaList; + /** + * atributo para bloquear el boton + */ + private Boolean btn; + + /** + * atributo para bloquear el boton + */ + private Boolean btnfileUpload; + + /** + * atributo para bloquear el boton save + */ + private Boolean btnSave; + + /** + * atributo para bloquear el boton + */ + private Boolean btnRegistro; + + /** + * atributo para bloquear el boton tramite sino executa el reporte registo + */ + private Boolean isExecuteRegistro; + /** + * codigo del pais de origen + */ + private String codigoPaisOrigen; + /** + * Variable para el envio del mail + */ + private String cdecomiso; + + private Boolean btnPeso; + + private Boolean btnCantidad; + /** + * codigo de la provincia del usuario que se logueo + */ + private String cprovincia; + + /** + * latitud de la direccin en el google map + */ + private String latitud; + /** + * longitud de la direccin en el google map + */ + private String longitud; + /** + * direccion en la que se va ha visualizar el map + */ + private String direccionGoogleMap; + /** + * Propiedad que premite controlar operaciones de cargar archivos al Alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + /** + * Variable que nos permite cargar el comprobante de deposito al Alfresco + */ + private UploadedFile uploadedFile; + /** + * tipoMapa permite visualizar la posicion del mapa por direccion o por coordenadas + */ + private String tipoMapa; + /** + * Nombre de la persona o empresa del decomisado sin documento + */ + private String nombrerazonsocialsindoc; + + private String latitudG; + private String latitudM; + private String latitudS; + private String longuitudG; + private String longuitudM; + private String longuitudS; + + private String latitudGMS; + private String longitudGMS; + /** + * Se recupera el filename del pdf para la descarga. + */ + private String filename; + /** + * Se recupera del pdf el byteArray para la descarga. + */ + private byte[] byteArray; + + /** + * Indica si se debe activar la pestana de seleccionar material + */ + private boolean seleccionarMaterial; + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + public void init() { + try { + setDireccionGoogleMap("Ecuador"); + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "DECOMISOMATERIAL"; + decomisoController.create(); + decomisoController.clearAll(); + personDetailController.create(); + armasController.clearAll(); + getArmasLovController().clearAll(); + seleccionarMaterial = Boolean.FALSE; + btn= Boolean.FALSE; + btnfileUpload= Boolean.FALSE; + btnSave= Boolean.TRUE; + btnRegistro= Boolean.TRUE; + isExecuteRegistro= Boolean.FALSE; + deshabilitarPantalla = Boolean.FALSE; + deshabilitarPantallaMaterial = Boolean.FALSE; + sinDocumento = Boolean.FALSE; + habilitaNoDecomiso = Boolean.FALSE; + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + //obtencion del centro de control + obtenerProvincia(); + //centroControls=CatalogDetailController.find("INSTITUCION"); + centroControl = tsafeUserDetail.getModifiedData().get("centrocontrol").toString(); + unidad = tsafeUserDetail.getModifiedData().get("unidad").toString(); + + lprovinces = ProvinceController.find("EC"); + //catalogo de (decomiso incautacion) + tipoProceso = CatalogDetailController.find("TIPOREGISTRO", "DECINC"); + tipoDocumeno = CatalogDetailController.find("IDENTIFICATION"); + grados = CatalogDetailController.find("MILITARYGRADE"); + unidades = new ArrayList<>(); + + lmarca = CatalogDetailController.find("MARCA"); + lcolor = CatalogDetailController.find("COLOR"); + ltipofabricacion = CatalogDetailController.find("TIPOFABRICACION"); + lcountry = CountryController.find(); + // seteo de variables + decomisoController.getRecord().setFecharegistro(new java.sql.Date(new Date().getTime())); + //decomisoController.getRecord().setOrganismocontrol(centroControl.getModifiedData().get("desinstitucion").toString()); + decomisoController.getRecord().setCountrycode("EC"); + //consulta de los codigos a utilizarse en la pantalla + codigoArma=codigos("CODIGO.ARMADEFUEGO"); + codigoRuc=codigos("CODIGO.RUC"); + codigoCedula=codigos("CODIGO.CEDULA"); + codigoPasaporte=codigos("CODIGO.PASAPORTE"); + codigoUnidadpeso=codigos("CODIGO.PESO"); + //codigoPersonaPortador=codigos("CODIGO.PERSONA.SINPORTADOR"); + codigoTelefonoFijo=codigos("CODIGO.PHONE.FIJO"); + codigoPersonaSinIdentificacion=codigos("CODIGO.PERSONA.SINPROPIETARIO"); + tcustPersonDetailPortador=null; + sinPortador=Boolean.FALSE; + armaSeleccionadaList=new ArrayList(); + cdecomiso=null; + btnPeso=Boolean.FALSE; + btnCantidad=Boolean.FALSE; + latitudG = ""; + latitudM = ""; + latitudS = ""; + longuitudG = ""; + longuitudM = ""; + longuitudS = ""; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para obtener el centro de control + * @throws Exception + */ + private void obtenerProvincia() throws Exception { + tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + if(tcustPersonAddres!=null && tcustPersonAddres.getProvincecode()!=null){ + cprovincia=tcustPersonAddres.getProvincecode(); + }else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_notienedireccionprincipal")); + return; + } + } + + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = getDtoQuery(true); + HashMap mtables = new HashMap(); + mtables.put(getBeanalias(), dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(resp); + } else { + resp.get(getBeanalias()); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + + //valida que el documento de activida de control este cargado + if(uploadedFile == null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionearchivodecomisoincautacion")); + return; + } + + //valida si esta ingresado el funcionario + if(decomisoController.getRecord().getFuncionario()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingrese_funcionario")); + return; + } + //Accion de dialog materiales + //armasSeleccionada(); + + //valida que el arma este seleccionada + if(armaSeleccionadaList==null || armaSeleccionadaList.size()==0){ + String tipoprocesoStr = catalogoDescripcion(tipoProceso,decomisoController.getRecord().getTipoproceso()); + if(tipoprocesoStr == null || tipoprocesoStr.isEmpty()){ + tipoprocesoStr = " DECOMISO"; + } + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccioneelarmaarealizareldecomisoincautacion") +" "+tipoprocesoStr); + return; + } + + if(sinDocumento){//validamos que se haya pulsado el boton de verificar o selecionado no propietario + tcustPersonDetailPortador=PersonDetailController.find(codigoPersonaSinIdentificacion); + decomisoController.getRecord().setNumerodocumento(tcustPersonDetailPortador.getIdentification()); + if(nombrerazonsocialsindoc!=null && !nombrerazonsocialsindoc.isEmpty()){ + decomisoController.getRecord().setNombrerazonsocial(nombrerazonsocialsindoc); + } + } + //validamos si tcustPersonDetailPortador este lleno o si han seleccionado sin portador para asignarle el por default + if(sinPortador){//validamos que se haya pulsado el boton de verificar o selecionado no propietario + tcustPersonDetailPortador=PersonDetailController.find(codigoPersonaSinIdentificacion); + decomisoController.getRecord().setNumerodocumento(tcustPersonDetailPortador.getIdentification()); + } + if(tcustPersonDetailPortador==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionesinportadoroverifiqueusuarioexistente")); + return; + } + HashMap msave = new HashMap(); +//----------datos del PERSONA + actualizaDatosPersonaPortador(); + //persona detalle + DtoSave dtosavePersondetail = personDetailController.getDtoSave(); + dtosavePersondetail.setReturnpk(true); + dtosavePersondetail.setPosition(1); + msave.put(personDetailController.getBeanalias(), dtosavePersondetail); + //telefono + DtoSave dtosavePersonphone = personPhoneController.getDtoSave(); + dtosavePersonphone.setReturnpk(true); + dtosavePersonphone.setPosition(6); + msave.put(personPhoneController.getBeanalias(), dtosavePersonphone); + //----------DATOS DE ARMAS-REGISTRO DE ARMAS + //registro de armas + armasSeleccionadas(); + //armas + DtoSave dtosaveArma = armasController.getDtoSave();//lleno + dtosaveArma.setPosition(3); + msave.put(armasController.getBeanalias(), dtosaveArma); + //registroarma + DtoSave dtosaveRegistroArma= registroArmController.getDtoSave();//vacio + dtosaveRegistroArma.setReturnpk(true); + dtosaveRegistroArma.setPosition(2); + msave.put(registroArmController.getBeanalias(), dtosaveRegistroArma); +//----------DECOMISO + //decomiso incautacion + //codigo de la person a que realiza el decomiso + decomisoController.getRecord().setPersoncoderegistra(tsafeUserDetail.getPk().getPersoncode()); + //tipo proceso + decomisoController.getRecord().setTipoprocesocode("TIPOREGISTRO"); + //tipo identificacion + decomisoController.getRecord().setTipodocumentocode("IDENTIFICATION"); + //tipo de gardo del militar + decomisoController.getRecord().setGradofuncionariocode("MILITARYGRADE"); + //catalogo del centro de control + decomisoController.getRecord().setCcentrocontrol(tsafeUserDetail.getCcentrocontrol()); + decomisoController.getRecord().setOrganismocontrol(centroControl); + decomisoController.update(); + + DtoSave dtosaveDecomiso= decomisoController.getDtoSave(); + dtosaveDecomiso.setPosition(4); + dtosaveDecomiso.setReturnpk(true); + msave.put(decomisoController.getBeanalias(), dtosaveDecomiso); +//----------DECOMISO ARMA CONTROLLER + DtoSave dtosaveDecomisoArma= decomisoArmaController.getDtoSave(); + dtosaveDecomisoArma.setPosition(5); + msave.put(decomisoArmaController.getBeanalias(), dtosaveDecomisoArma); + + msave.put(this.beanalias, dtosave); + request.setSaveTables(msave); +//---------TransactionRule DecomisoMAterial + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + btn = Boolean.TRUE; + btnSave = Boolean.TRUE; + btnRegistro = Boolean.FALSE; + deshabilitarPantalla = Boolean.TRUE; + deshabilitarPantallaMaterial = Boolean.TRUE; + decomisoController.postCommit(resp); + decomisoController.getRecord().setNumerotransaccion(resp.get("numerotransaccion").toString()); + cdecomiso=resp.get("cdecomiso").toString(); + + //----------ARCHIVO ALFRESCO + subirArchivoAlfresco(); + imprimir(); + decomisoController.getRecord().setIsnew(false); + //Se actualizan los path de los reportes en el alfresco + decomisoController.update(); + decomisoController.save(); + + uploadedFile = null; + armaSeleccionadaList = null; + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("lbl_numerotransaccion") +": "+resp.get("numerotransaccion").toString()); + + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + + /** + * Metodo que permite grabar el documento de decommiso en el Alfresco + * @param decomiso + * */ + public void subirArchivoAlfresco() { + try { + + String tipoprocesoStr = catalogoDescripcion(tipoProceso,decomisoController.getRecord().getTipoproceso()); + + String xPathLocation= getRutaDocumentoSolBase() + "/cm:" + unidad.replace(" ", "_") + "/cm:" + tipoprocesoStr.replace(" ", "_") + "/cm:" + decomisoController.getRecord().getNumerotransaccion(); + if(uploadedFile!=null && uploadedFile.getFileName()!=null){ + String extencionArchivo=getExtension(uploadedFile.getFileName()); + String nombreArchivo = "CMPREC-"+decomisoController.getRecord().getNumerorecibo()+"."+extencionArchivo; + //"cm:Decomiso/cm:A-2016/cm:M-01/cm:CENTRO CONTROL/cm:ABANDONO/cm:ABAN-00000123/cm:CMPREC-000000319.pdf" + decomisoController.getRecord().setXpath(xPathLocation + "/cm:" + nombreArchivo); + if(alfrescoController.uploadFile(uploadedFile.getInputstream(),nombreArchivo, xPathLocation)){ + decomisoController.getRecord().setXpath(xPathLocation + "/cm:" + nombreArchivo); + + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_decomisoSinDatosAsociados")); + } + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingreseDocumentoDecomiso")); + } + + + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Throwable e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Metodo que genera el reporte recibo registro + * @param fila + */ + public void imprimir() { + try { + + querydatabase(); + //String gradoUsuario =""; + String path = "armas/reports/registrodecomisomaterial"; + //String filename="REGISTRODECOMISO"+"-"+decomisoController.getRecord().getNumerorecibo(); + filename = "CMPREG-"+decomisoController.getRecord().getNumerorecibo(); + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + String tipoprocesoStr = catalogoDescripcion(tipoProceso,decomisoController.getRecord().getTipoproceso()); + String provinciaStr = ProvinceController.getDescProvByCodigo(decomisoController.getRecord().getCountrycode(),decomisoController.getRecord().getProvincecode()); + String cantonStr = CantonController.getDescCantonByCodigo(decomisoController.getRecord().getCountrycode(),decomisoController.getRecord().getProvincecode(),decomisoController.getRecord().getCantoncode()); + String cuidadStr = CityController.getDescCiudadByCodigo(decomisoController.getRecord().getCountrycode(),decomisoController.getRecord().getProvincecode(),decomisoController.getRecord().getCantoncode(),decomisoController.getRecord().getCitycode()); + String parroquiaStr = ParroquiaController.getDescParroquiaByCodigo(decomisoController.getRecord().getCountrycode(),decomisoController.getRecord().getProvincecode(),decomisoController.getRecord().getCantoncode(),decomisoController.getRecord().getParroquiacode()); + + + //Tipo Proceso + parameters.put("tipoproceso", "RECIBO DE REGISTRO "+tipoprocesoStr); + //No. Transaccion + parameters.put("pnumerotransaccion", decomisoController.getRecord().getNumerotransaccion()); + //Nombre de la persona que decommisa + parameters.put("nombredecomisadopor", decomisoController.getRecord().getFuncionario()); + //No. Documento + parameters.put("numerodocumento", decomisoController.getRecord().getCedulafuncionario()); + //Organismo de Control + parameters.put("organismocontrol", decomisoController.getRecord().getOrganismocontrol()); + //Unidad de Control + parameters.put("unidadcontrol", unidad); + //No. Comprobante recibo + parameters.put("numerocomprobante", decomisoController.getRecord().getNumerorecibo()); + //Fecha Decomiso + parameters.put("fechadecomiso", decomisoController.getRecord().getFechadecomiso()); + //Fecha Registro Decomiso + parameters.put("fecharegistrodecomiso", decomisoController.getRecord().getFecharegistro()); + //Provincia Decomiso + parameters.put("provinciadecomiso", provinciaStr); + //Canton Decomiso + parameters.put("cantondecomiso", cantonStr); + //Cuidad Decomiso + parameters.put("cuidaddecomiso", cuidadStr); + //Parroquia Decomiso + parameters.put("parroquiadecomiso", parroquiaStr); + //Direccion Decomiso + parameters.put("direcciondecomiso", decomisoController.getRecord().getDireccion()); + //Portador Decomiso + parameters.put("portadordecomiso", decomisoController.getRecord().getNombrerazonsocial()); + //No. Documento Portador + parameters.put("numerodocumentoportador", decomisoController.getRecord().getNumerodocumento()); + //Usuario + parameters.put("usuario",this.usuario.getName()); + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + + String format = "pdf"; + + byteArray = this.reportController.jaspertoByteArray(path, parameters, format, filename, this.getLoginController()); + + // Se obtiene el InputStream para subir el archivo alfresco + InputStream inputStream = new ByteArrayInputStream(byteArray); + + String nombreArchivo = (filename!=null && !filename.isEmpty()) ? filename+"."+format : null; + String xPathLocation= getRutaDocumentoSolBase() + "/cm:" + unidad.replace(" ", "_") + "/cm:" + tipoprocesoStr.replace(" ", "_") + "/cm:" + decomisoController.getRecord().getNumerotransaccion(); + //="cm:Decomiso/cm:A-2016/cm:M-01/cm:CENTRO CONTROL/cm:ABANDONO/cm:ABAN-00000123/cm:CMPREG-000000319.pdf" + if (nombreArchivo != null && xPathLocation != null && inputStream != null) { + decomisoController.getRecord().setComprobantexpath(xPathLocation + "/cm:" + nombreArchivo); + if (alfrescoController.uploadFile(inputStream, nombreArchivo, xPathLocation)) { + decomisoController.getRecord().setComprobantexpath(xPathLocation + "/cm:" + nombreArchivo); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_subiroarchivoregistrorecibo").concat("("+nombreArchivo+")")); + + } + //Se executo el reporte + //isExecuteRegistro= Boolean.TRUE; + } catch (Exception ex) { + //isExecuteRegistro= Boolean.FALSE; + MessageHelper.setMessageError(ex); + return; + } + + } + + /** + * Metodo que genera el reporte recibo registro + */ + public void imprimirDocGenerado() { + try{ + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + // Se nombra igual que el documento pdf que se encuentra en el alfresco + response.addHeader("Content-disposition", "attachment; filename=" + filename + ".pdf"); + + OutputStream outputStream = response.getOutputStream(); + // Se escribe en el documento pdf el byte array recuperado del metodo imprimir + outputStream.write(byteArray); + outputStream.flush(); + outputStream.close(); + FacesContext.getCurrentInstance().responseComplete(); + } catch (Exception ex) { + + MessageHelper.setMessageError(ex); + return; + } + } + + + + /** + * Actualiza los datos del portador del arma + * @throws Exception + */ + private void actualizaDatosPersonaPortador() throws Exception { + personDetailController.clearAll(); + // VALIDAMOS EL PORTADOR + if (tcustPersonDetailPortador.getPk() == null|| tcustPersonDetailPortador.getPk().getPersoncode() == null) { + // seteamos al portador + tcustPersonDetailPortador.setIsnew(true); + tcustPersonDetailPortador.setName(decomisoController.getRecord().getNombrerazonsocial()); + tcustPersonDetailPortador.setIdentification(decomisoController.getRecord().getNumerodocumento()); + tcustPersonDetailPortador.setIdentificationcatalog(decomisoController.getRecord().getTipodocumento()); + tcustPersonDetailPortador.setIdentificationcatalogcode("IDENTIFICATION"); + personDetailController.setRecord(tcustPersonDetailPortador); + personDetailController.update(); + // creacion del telefono + if (decomisoController.getRecord().getTelefono() != null&& decomisoController.getRecord().getTelefono().length() > 0) { + personPhoneController.create(); + personPhoneController.getRecord().setPhonetypecatalog(codigoTelefonoFijo); + personPhoneController.getRecord().setPhonetypecatalogcode("PHONETYPE"); + personPhoneController.getRecord().setPhonenumber(decomisoController.getRecord().getTelefono()); + personPhoneController.actualizar(); + } + } else { + decomisoController.getRecord().setPersoncode(tcustPersonDetailPortador.getPk().getPersoncode()); + } + } + + + + + /** + * Valida el si selecciona un arma + * @throws Exception + */ + private void armasSeleccionadas() throws Exception{ + armasController.clearAll(); + TgeneCatalogDetail estadoArma = CatalogDetailController.find("ESTADOARMA", decomisoController.getRecord().getTipoproceso()).get(0); + for(TarmArmas armas:armaSeleccionadaList){ + //TarmArmas t= (TarmArmas)armas.cloneMe(); + armasController.setRecord((TarmArmas)armas.cloneMe()); + //t.getModifiedData().put("estadoseleccion",Boolean.FALSE); //selecciona solo un registro + if(armasController.getRecord().getModifiedData().get("estadoseleccion").equals(Boolean.TRUE)){ + armasController.getRecord().setIsnew(true); + armasController.getRecord().setPk(null); + armasController.getRecord().setEstado(estadoArma.getPk().getCatalog()); + armasController.getRecord().setEstadocodigo("ESTADOARMA"); + //fech de registro + armasController.getRecord().setFecharegistro(new java.sql.Date(new Date().getTime())); + armasController.actualizar(armasController.getRecord()); + } + } + } + + /** + * Método que limpia las variables cuando escoge tipo documento + */ +// public void tipoDocumentoSel(AjaxBehaviorEvent event){ +// if(event.getComponent().getAttributes().get("value") != null){ + public void tipoDocumentoSel(){ + if(this.decomisoController.getRecord().getTipodocumento() != null){ + ingresoPortador = "CON DOCUMENTO"; + validacioIngresoPortador(); + }else{ + ingresoPortador = null; + validacioIngresoPortador(); + + } + } + + /** + * Método que limpia las variables cundo chequea sin portador + */ + public void sinPortador(){ + + if(sinPortador){ + ingresoPortador = "SIN PORTADOR"; + validacioIngresoPortador(); + }else{ + ingresoPortador = null; + validacioIngresoPortador(); + } + + } + + /** + * Método que limpia las variables cundo chequea sin portador + */ + public void sinDocumento(){ + if(sinDocumento){ + ingresoPortador = "SIN DOCUMENTO"; + validacioIngresoPortador(); + }else{ + ingresoPortador = null; + validacioIngresoPortador(); + } + + + + } + + private void validacioIngresoPortador(){ + if(ingresoPortador==null){ + sinDocumento = Boolean.FALSE; + sinPortador = Boolean.FALSE; + this.decomisoController.getRecord().setTipodocumento(null); + this.decomisoController.getRecord().setNumerodocumento(null); + this.decomisoController.getRecord().setNombrerazonsocial(null); + }else if(ingresoPortador.equals("SIN PORTADOR")){ + sinDocumento = Boolean.FALSE; + this.decomisoController.getRecord().setTipodocumento(null); + this.decomisoController.getRecord().setNumerodocumento(null); + this.decomisoController.getRecord().setNombrerazonsocial(null); + }else if(ingresoPortador.equals("SIN DOCUMENTO")){ + sinPortador = Boolean.FALSE; + this.decomisoController.getRecord().setTipodocumento(null); + this.decomisoController.getRecord().setNumerodocumento(null); + this.decomisoController.getRecord().setNombrerazonsocial(null); + + }else if(ingresoPortador.equals("CON DOCUMENTO")){ + sinPortador = Boolean.FALSE; + sinDocumento = Boolean.FALSE; + /*this.decomisoController.getRecord().setNumerodocumento(null); + this.decomisoController.getRecord().setNombrerazonsocial(null);*/ + } + + } + + + /** + * Método para inicializar la lista de las armas + * y validacién de los datos del portador + */ + public void registrarMaterial(){ + if(!sinPortador && !sinDocumento){ + validarPortador(); + } + //valida que el documento de activida de control este cargado + if(uploadedFile == null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_recuerdeClickCargarDocActControl")); + return; + } + armasController.setLrecord(new ArrayList()); + armasController.getMfilters().put("lote", null); + + if (decomisoController.getRecord().getTipoproceso().equals("INCA")) { + habilitaNoDecomiso = Boolean.TRUE; + } + deshabilitarPantalla = Boolean.TRUE; + seleccionarMaterial = Boolean.TRUE; + btnfileUpload= Boolean.TRUE; + btn= Boolean.TRUE; + btnSave= Boolean.TRUE; + FacesContext context = FacesContext.getCurrentInstance(); + context.addMessage(null, new FacesMessage("RECUERDE", MsgControlArmas.getProperty("msg_recuerdeClickTabRegMaterial"))); + + } + + public void changeTipoProceso(){ + + if (decomisoController.getRecord().getTipoproceso().equals("INCA")) { + habilitaNoDecomiso = Boolean.TRUE; + }else{ + habilitaNoDecomiso = Boolean.FALSE; + } + + String catalogReg = decomisoController.getRecord().getTipoproceso(); + motivoDecomisoList = new ArrayList(); + if (catalogReg != null && !catalogReg.equals("")) { + if (catalogReg.equals("INCA")) { + catalogReg = "DECO"; + } + motivoDecomisoList = CatalogDetailController.find("MOTIVODECOMISO", + catalogReg); + } else { + motivoDecomisoList = CatalogDetailController.find("MOTIVODECOMISO"); + } + } + + /** + * Método que se ejecuta al pulsar el boton aceptar del dialog que lista las armas a seleccionar + * Valida si selecciono algun registro si no le obliga a seleccionar + */ + public void armasSeleccionada(){ + //validamos que de la lista exista un registro escogido + armaSeleccionadaList=new ArrayList(); + for(TarmArmas t:armasController.getLrecord()){ + if(Boolean.TRUE.equals(t.getModifiedData().get("estadoseleccion"))){ + armaSeleccionadaList.add(t); + } + } + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince() { + if ((decomisoController.getRecord().getCountrycode() != null) && (decomisoController.getRecord().getCountrycode().compareTo("") != 0)) { + lcantones = CantonController.find(decomisoController.getRecord().getCountrycode(), decomisoController.getRecord().getProvincecode()); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton() { + if ((decomisoController.getRecord().getCountrycode() != null) && (decomisoController.getRecord().getCountrycode().compareTo("") != 0)) { + lparroquias = ParroquiaController.find(decomisoController.getRecord().getCountrycode(), decomisoController.getRecord().getProvincecode(), decomisoController.getRecord().getCantoncode()); + lcities = CityController.find(decomisoController.getRecord().getCountrycode(), decomisoController.getRecord().getProvincecode(), decomisoController.getRecord().getCantoncode()); + } + } + + /** + * Método para el evento change del combo ciudad + */ + public void executeCiudad() { + if ((decomisoController.getRecord().getCantoncode() != null) && (decomisoController.getRecord().getCantoncode().compareTo("") != 0)) { + List lcities = CityController.find(decomisoController.getRecord().getCountrycode(), decomisoController.getRecord().getProvincecode(), decomisoController.getRecord().getCantoncode()); + setDireccionGoogleMap(lcities.get(0).getDescription() + ", " + "Ecuador"); + } + } + + /** + * Método que valida la persona portadora del arma o explosivo + * en las tablas de maia y en la snap + * + */ + public void validarPortador(){ + //this.decomisoController.getRecord().setNombrerazonsocial(null); +//-------------------validar SELECCION TIPO UBICACION + if(tipoMapa == null || "".equals(tipoMapa)){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipoMapa")); + return; + } +//-------------------validar LATITUD Y LONGITUD + if(decomisoController.getRecord().getLatitud()==null || decomisoController.getRecord().getLongitud()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselongitudlatitud")); + return; + } + if(decomisoController.getRecord().getNumerodocumento()==null || decomisoController.getRecord().getTipodocumento()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselacedula")); + return; + } + if(decomisoController.getRecord().getTipodocumento().equals(codigoCedula)){ +//----------validamos si es valida la CEDULA + if(!ValidateIdentification.cedula(decomisoController.getRecord().getNumerodocumento())){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en MAIA + tcustPersonDetailPortador=buscarPersonaMaia(decomisoController.getRecord().getNumerodocumento(),decomisoController.getRecord().getTipodocumento()); + if(tcustPersonDetailPortador==null){ + //envia a buscar en la SNAP + tcustPersonDetailPortador=buscarPersonaSnap(decomisoController.getRecord().getNumerodocumento(),decomisoController.getRecord().getTipodocumento()); + } + }else if(decomisoController.getRecord().getTipodocumento().equals(codigoRuc)){ +//----------validamos si es valida el RUC + if(!ValidateIdentification.ruc(decomisoController.getRecord().getNumerodocumento())){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en maia + tcustPersonDetailPortador=buscarPersonaMaia(decomisoController.getRecord().getNumerodocumento(),decomisoController.getRecord().getTipodocumento()); + if(tcustPersonDetailPortador==null){ + //envia a buscar en la snap + tcustPersonDetailPortador=buscarPersonaSnap(decomisoController.getRecord().getNumerodocumento(),decomisoController.getRecord().getTipodocumento()); + } + }else{ +//----------si es PASAPORTE + tcustPersonDetailPortador=buscarPersonaMaia(decomisoController.getRecord().getNumerodocumento(),decomisoController.getRecord().getTipodocumento()); + if(tcustPersonDetailPortador==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_usuarionoencontrado")); + tcustPersonDetailPortador= new TcustPersonDetail(); + tcustPersonDetailPortador.setIdentification(decomisoController.getRecord().getNumerodocumento()); + tcustPersonDetailPortador.setIdentificationcatalog(decomisoController.getRecord().getTipodocumento()); + tcustPersonDetailPortador.setIdentificationcatalogcode("IDENTIFICATION"); + tcustPersonDetailPortador.setName(decomisoController.getRecord().getNombrerazonsocial()); + + } + } + //validamos que existe la persona en Maia o SNAP + if(tcustPersonDetailPortador!=null && tcustPersonDetailPortador.getIdentification()!=null && tcustPersonDetailPortador.getName()!=null){ + //seteamos el nombre para visualizarle + decomisoController.getRecord().setNombrerazonsocial(tcustPersonDetailPortador.getName()); + nombrePortador = tcustPersonDetailPortador.getName(); + }else if(!decomisoController.getRecord().getTipodocumento().equals(codigoPasaporte)){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_usuarionoencontrado")); + tcustPersonDetailPortador= new TcustPersonDetail(); + + } + + } + + /** + * Método para validar si la persona existe en la BD de Maia + * @param numeroDocumento + * @param tipoDocumento + * @return TcustPersonDetail + */ + public TcustPersonDetail buscarPersonaMaia(String numeroDocumento, String tipoDocumento){ + return PersonDetailController.findxidentification(numeroDocumento,tipoDocumento); + } + + /** + * Método para buscar a la persona en la snap + * @param documento + */ + public TcustPersonDetail buscarPersonaSnap(String documento,String tipoDocumento){ + if(tipoDocumento.equals(codigoCedula)){ + Cedula cedula= ClienteCedula.obtenerCedula(documento); + if(cedula!=null){ + TcustPersonDetail detail= new TcustPersonDetail(); + detail.setName(cedula.getNombre()); + detail.setIdentification(cedula.getCedula()); + detail.setIdentificationcatalog("CED"); + detail.setIdentificationcatalogcode("IDENTIFICATION"); + detail.setDatefrom(new Timestamp(System.currentTimeMillis())); + return detail; + }else{ + return null; + } + }else { + Contribuyente contribuyente= ClienteRUC.obtenerRUC(documento); + if(contribuyente!=null){ + TcustPersonDetail detail= new TcustPersonDetail(); + detail.setName(contribuyente.getRazonSocial()); + detail.setIdentification(contribuyente.getNumeroRuc()); + detail.setIdentificationcatalog("RUC"); + detail.setIdentificationcatalogcode("IDENTIFICATION"); + detail.setDatefrom(new Timestamp(System.currentTimeMillis())); + return detail; + }else{ + return null; + } + } + } + + + /** + * Método para manejar el evento change en el CheckBox + * Arma a decomisar + * @throws Exception + */ + public void onChange(TarmArmas arma) throws Exception { + + for(TarmArmas t:armasController.getLrecord()){ + //t.getModifiedData().put("estadoseleccion",Boolean.FALSE); //selecciona solo un registro + if(arma.getPk()==null && t.getPk()==null){ + if(validacioncampos(arma)){ + }else{ + t.getModifiedData().put("estadoseleccion",Boolean.FALSE); + } + }else if(arma.getPk()!=null && arma.getPk().equals(t.getPk())){ + if(validacioncampos(arma)){ + //arma.getModifiedData().put("estadoseleccion",Boolean.TRUE); + //le asignamos un umero para que le ordene + if (armaSeleccionadaList.contains(arma)) { + arma.getModifiedData().put("ordenarma", 0); + armaSeleccionadaList.remove(arma); + armaSeleccionadaList.add(arma); + }else{ + armaSeleccionadaList.add(arma); + } + }else{ + t.getModifiedData().put("estadoseleccion",Boolean.FALSE); + if(armaSeleccionadaList.contains(arma)){ + armaSeleccionadaList.remove(arma); + } + } + } + + + } + + } + + /** + * Método para validar los campos esten ingresados + * @param arma + * @return + */ + private Boolean validacioncampos(TarmArmas arma){ + if(arma.getModifiedData().get("motivocatalogo")==null){ + MessageHelper.setMessageError("INGRESE EL MOTIVO DE DECOMISO/INCAUTACION DEL ARMA CODIDGO : "+arma.getPk()); + return false; + } + if(arma.getModifiedData().get("cantidad")==null){ + MessageHelper.setMessageError("INGRESE EL MOTIVO DE DECOMISO/INCAUTACION DEL ARMA CODIDGO : "+arma.getPk()); + return false; + } + if(arma.getModifiedData().get("observaciondecomiso")==null){ + MessageHelper.setMessageError("INGRESE EL MOTIVO DE DECOMISO/INCAUTACION DEL ARMA CODIDGO : "+arma.getPk()); + return false; + } + + return true ; + } + /** + * Método para ingresar el motivo del decomiso + * desde el popup + */ + public void datosDecomiso(){ + if(decomisoController.getRecord().getTipoproceso()==null ||decomisoController.getRecord().getTipoproceso().isEmpty()){ + MessageHelper.setMessageError("INGRESE EL TIPO DE PROCESO EN DATOS GENERALES"); + return; + }/*else{ + String catalogReg = decomisoController.getRecord().getTipoproceso(); + if(catalogReg.equals("INCA")){ + catalogReg = "DECO"; + } + motivoDecomisoList = CatalogDetailController.find("MOTIVODECOMISO",catalogReg); + }*/ + + try { + //se setea el tipo del proceso + if(armasController.getRecord().getModifiedData().get("estadodecomiso")==null){ + armasController.getRecord().getModifiedData().put("estadodecomiso", decomisoController.getRecord().getTipoproceso()); + } + + if(armasController.getRecord().getCantidad()!=null){ + armasController.getRecord().getModifiedData().put("cantidad", armasController.getRecord().getCantidad()); + } + if(armasController.getRecord().getPeso()!=null){ + armasController.getRecord().getModifiedData().put("cantidad", armasController.getRecord().getPeso()); + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para actualizar el motivo del decomiso del arma arma existente + * se ejecuta en el botón del formulario del motivo de decomiso + */ + public void actualizarDecomiso(){ + + TgeneCatalogDetail estadoArma = CatalogDetailController.find("ESTADOARMA", decomisoController.getRecord().getTipoproceso()).get(0); + if(estadoArma!=null){ + armasController.getRecord().getModifiedData().put("estadodecomisodesc", estadoArma.getDescription()); + } + //seteod de los codigos + armasController.getRecord().getModifiedData().put("motivocatalogocode", "MOTIVODECOMISO"); + armasController.getRecord().getModifiedData().put("estadodecomisocode", "TIPOREGISTRO"); + //descripcion del motivodecomiso + catalogos(motivoDecomisoList, armasController.getRecord().getModifiedData().get("motivocatalogo").toString(), "motivodecomisodesc"); + } + + /** + * Método para actualizar el arma cuando ya llena los datos en el formulario de crear arma + * @throws Exception + */ + public void actualizarArmaCreada() throws Exception { + //valida la combinacion del arma que exista + if(tipoArmaExplosivo == null || tipoArmaExplosivo.getPk()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_camposrequeridos")); + return; + } + //armasController.clearAll(); +// for(TarmArmas t:armasController.getLrecord()){ +// t.getModifiedData().put("estadoseleccion",Boolean.FALSE); +// } + //DATOS PARA VISUALIZAR EN PANTALLA + //DATOS DE LA GRILLA + //cantidad + if(armasController.getRecord().getCantidad()!=null && armasController.getRecord().getCantidad()>0){ + armasController.getRecord().getModifiedData().put("cantidad", armasController.getRecord().getCantidad()); + } + if(armasController.getRecord().getPeso()!=null && armasController.getRecord().getPeso().compareTo(new BigDecimal(0))>0){ + armasController.getRecord().getModifiedData().put("cantidad", armasController.getRecord().getPeso()); + } + //propietario + TcustPersonDetail tcustPersonDetail=PersonDetailController.find(codigoPersonaSinIdentificacion); + armasController.getRecord().getModifiedData().put("propietario", tcustPersonDetail.getName()); + //unidad de medida + armasController.getRecord().getModifiedData().put("unidadmedida",tipoArmaExplosivo.getUnidadmedidapeso()); + //unidad de medida + armasController.getRecord().getModifiedData().put("unidadmedidadesc",tipoArmaExplosivo.getUnidadmedidapeso()); + //le asignamos una marca + + TgeneCatalogDetail marcaArma = CatalogDetailController.findCatalog("MARCA", armasController.getRecord().getMarca()).get(0); + if(marcaArma!=null){ + armasController.getRecord().getModifiedData().put("marca",marcaArma.getDescription()); + } + TgeneCatalogDetail estadoArma = CatalogDetailController.find("ESTADOARMA", decomisoController.getRecord().getTipoproceso()).get(0); + if(estadoArma!=null){ + armasController.getRecord().getModifiedData().put("estado",estadoArma.getDescription()); + armasController.getRecord().getModifiedData().put("estadodecomisodesc", estadoArma.getDescription()); + } + + //motivo del decomiso + catalogos(motivoDecomisoList, armasController.getRecord().getModifiedData().get("motivocatalogo").toString(), "motivodecomisodesc"); + + //seteamos el check + armasController.getRecord().getModifiedData().put("estadoseleccion",Boolean.TRUE); + + //seteo de codigos + armasController.getRecord().getModifiedData().put("motivocatalogocode", "MOTIVODECOMISO");//['motivocatalogo'] + armasController.getRecord().getModifiedData().put("estadodecomisocode", "TIPOREGISTRO");//['estadodecomiso'] + + //datos para el REGISTROARMA + //personcode + armasController.getRecord().getModifiedData().put("personcode",tcustPersonDetail.getPk().getPersoncode()); + armasController.getRecord().getModifiedData().put("tiporegistro",decomisoController.getRecord().getTipoproceso()); + armasController.getRecord().getModifiedData().put("tiporegistrocode","TIPOREGISTRO"); + //pais de origen + armasController.getRecord().getModifiedData().put("paisorigen",codigoPaisOrigen); + //fecha de creacion + armasController.getRecord().getModifiedData().put("fechacreacion",new java.sql.Date(new Date().getTime())); + + //pais de origen + armasController.getRecord().setCpaisorigen(codigoPaisOrigen); + armasController.getRecord().setColorcodigo("COLOR"); + armasController.getRecord().setTipofabricacioncodigo("TIPOFABRICACION"); + //unidad de medida + armasController.getRecord().setUnidadmedidacantidad(tipoArmaExplosivo.getUnidadmedidapeso()); + armasController.getRecord().setUnidadmedidacantidadcodigo("UNIDADMEDIDA"); + //fech de registro + armasController.getRecord().setFecharegistro(new java.sql.Date(new Date().getTime())); + //le asignamos un umero para que le ordene + armasController.getRecord().getModifiedData().put("ordenarma",0); + //ACTUALIZA EL ARMA + armasController.actualizar(armasController.getRecord()); + //Valor razon social + //nombrePortador + decomisoController.getRecord().setNombrerazonsocial(nombrePortador); + //limpiamos la variable + tipoArmaExplosivo=null; + btnPeso=Boolean.FALSE; + btnCantidad=Boolean.FALSE; + + //ordena la lista lvigenciaMeses + Collections.sort(armasController.getLrecord(), new Comparator() { + public int compare(TarmArmas p1, TarmArmas p2) { + return String.valueOf(p1.getModifiedData().get("ordenarma")).compareTo(String.valueOf(p2.getModifiedData().get("ordenarma"))); + } + }); + + armaSeleccionadaList.add(armasController.getRecord()); + + } + + + /** + * Método para recorreer los combos y setear las descripciones de lo q se escoge + * para la vista + * @param list + * @param codigo + * @param pk + */ + public void catalogos(Listlist, String codigo,String pk){ + for(TgeneCatalogDetail item:list){ + if(codigo.equals(item.getPk().getCatalog())){ + armasController.getRecord().getModifiedData().put(pk, item.getDescription()); + break; + } + } + } + + /** + * Método para devolver la descripcion + * + * @param list + * @param codigo + * @return + */ + public String catalogoDescripcion(List list, String codigo) { + for (TgeneCatalogDetail item : list) { + if (codigo.equals(item.getPk().getCatalog())) { + return item.getDescription(); + } + } + return null; + } + + + /** + * Método para crear un arma a decomisar + * @throws Exception + */ + public void createArmaDecomisada() throws Exception { + //inicializamos el amra + armasController.create(); + armasController.getRecord().setCountrycode("EC"); + TgeneCatalogDetail estadoArma = CatalogDetailController.find("ESTADOARMA", decomisoController.getRecord().getTipoproceso()).get(0); + if(estadoArma!=null){ + armasController.getRecord().setEstado(estadoArma.getPk().getCatalog()); + } + armasController.getRecord().setEstadocodigo("ESTADOARMA"); + armasController.getRecord().setMarcacodigo("MARCA"); + armasController.setLprovincias(ProvinceController.find(armasController.getRecord().getCountrycode())); + armasController.executeProvince(); + unidadpeso=null; + descripcionUnidadpeso=null; +// tcustPersonDetailPropietario= new TcustPersonDetail(); + //se setea el tipo del proceso + armasController.getRecord().getModifiedData().put("estadodecomiso", decomisoController.getRecord().getTipoproceso()); + if(!sinPortador){ + //cargamos los datos del usuario portador + //tipo de identificacion + tipoIdentificacionPro=decomisoController.getRecord().getTipodocumento(); + //numero de documento + identificacionPro=decomisoController.getRecord().getNumerodocumento(); + //nombre razon social +// tcustPersonDetailPropietario.setName(decomisoController.getRecord().getNombrerazonsocial()); + } + //NUEVO + if(!sinDocumento){ + decomisoController.getRecord().setNombrerazonsocial(nombrerazonsocialsindoc); + } + codigoPaisOrigen=null; + descripcionUnidadpeso=null; + btnPeso=Boolean.FALSE; + btnCantidad=Boolean.FALSE; + } + + + /** + * Abre el LOV de la clase del arma + */ + public void openArmaExplosivoLov() { + armasController.getRecord().getModifiedData().put("longitud", null); + armasController.getRecord().getModifiedData().put("tipoarmaexplosivo", null); + armasController.getRecord().getModifiedData().put("calibre", null); + descripcionUnidadpeso=null; + Map> params = new HashMap<>(); + ArmaExplosivoLovController.openLov(params); + } + + /** + * Regresa del LOV de armas + * @param event + */ + public void onReturnArmaExplosivo(SelectEvent event) { + tipoArmaExplosivo = (TarmTipoArmaExplosivo) event.getObject(); + armasController.getRecord().setCantidad(null); + armasController.getRecord().setPeso(null); + armasController.getRecord().getModifiedData().put("clase", tipoArmaExplosivo.getModifiedData().get("nclase")); + armasController.getRecord().getModifiedData().put("tipoarmaexplosivo", tipoArmaExplosivo.getModifiedData().get("ntipo")); + armasController.getRecord().getModifiedData().put("longitud", tipoArmaExplosivo.getModifiedData().get("nlongitud")); + armasController.getRecord().getModifiedData().put("calibre", tipoArmaExplosivo.getModifiedData().get("ncalibre")); + if(tipoArmaExplosivo.getModifiedData().get("desunidad")!=null){ + unidadpeso=tipoArmaExplosivo.getModifiedData().get("desunidad").toString(); + }else{ + unidadpeso=null; + } + if(tipoArmaExplosivo.getClase().equals(codigoArma)){ + armasController.getRecord().setCantidad(1); + armasController.getRecord().getModifiedData().put("cantidad", 1); + }else{ + armasController.getRecord().setCantidad(null); + armasController.getRecord().getModifiedData().put("cantidad",null); + } + //codigo del arma explosivo + armasController.getRecord().setCtipoarmaexplosivo(tipoArmaExplosivo.getPk()); + btnPeso=Boolean.FALSE; + btnCantidad=Boolean.FALSE; + if(tipoArmaExplosivo.getModifiedData().get("deslegalcode")!=null){ + descripcionUnidadpeso=tipoArmaExplosivo.getModifiedData().get("deslegalcode").toString(); + if(codigoUnidadpeso.equals(descripcionUnidadpeso)){ + btnPeso=Boolean.TRUE; + }else{ + btnCantidad=Boolean.TRUE; + } + }else{ + descripcionUnidadpeso=null; + } + } + + /** + * Método para inicilalizar los campos segun la unidad de medida (unidad, kg) + + * @param cantidad + */ + public void cantidad(Integer cantidad){ + armasController.getRecord().setPeso(null); + armasController.getRecord().getModifiedData().put("cantidad", cantidad); + } + /** + * Método para inicilalizar los campos segun la unidad de medida (unidad, kg) + + * @param peso + */ + public void peso(BigDecimal peso){ + armasController.getRecord().setCantidad(null); + armasController.getRecord().getModifiedData().put("cantidad", peso); + } + + /** + * Método que elimina el arma creada solamente de la vista + * @param arma + */ + public void eliminarArmaVista(TarmArmas arma){ + try { + armasController.remove(); +// tcustPersonDetailPropietario= new TcustPersonDetail(); + tipoDocumeno=null; + identificacionPro=null; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Validacion de las fechas que no se amayor a la actual + * @param fech + */ + public void validarComprobanteRecibo(String numerorecibo){ + String tipoproceso = this.decomisoController.getRecord().getTipoproceso(); + String organismoControl = tsafeUserDetail.getCcentrocontrol(); + + if(tipoproceso ==null || tipoproceso.isEmpty()){ + decomisoController.getRecord().setNumerorecibo(""); + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_validarnumerocomprobanterecibo")); + return; + } + boolean isRecibo = DecomisoController.findReciboByTipoProcesoOrganismoControl(numerorecibo, tipoproceso, organismoControl); + if(isRecibo){ + decomisoController.getRecord().setNumerorecibo(""); + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_numerocomprobanterecibo")); + return; + } + } + + /** + * Validacion de las fechas que no se amayor a la actual + * @param fech + */ + public void validarfecha(Date fech){ + if(fech.getTime()>(new Date()).getTime()){ + fech=new Date(); + decomisoController.getRecord().setFechadecomiso(new java.sql.Date(new Date().getTime())); + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_fechadecomisonopuedesermayoralaactual")); + } + } + + /** + * Método para obtener los codigos + */ + public String codigos(String parametro){ + TgeneParameters tgeneParameters= ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + public void querySelMaterial(){ + + try { + + noFiltrarCodigosEstados(); + armasLovController.setRecperpage(500); + armasLovController.query(); + + armasController.getLrecord().clear(); + + if (armasLovController.getLrecord() != null + || !armasLovController.getLrecord().isEmpty()) { + armasController.getLrecord().addAll(armasLovController.getLrecord()); + } + + if(armaSeleccionadaList !=null && !armaSeleccionadaList.isEmpty()){ + armasController.getLrecord().addAll(armaSeleccionadaList); + } + + //ordenamos la lista + Collections.sort(armasController.getLrecord(), new Comparator() { + public int compare(TarmArmas p1, TarmArmas p2) { + return String.valueOf(p1.getModifiedData().get("ordenarma")).compareTo(String.valueOf(p2.getModifiedData().get("ordenarma"))); + } + }); + + } catch (Exception e) { + + e.printStackTrace(); + } + } + + /* Abre el LOV de la clase del arma + */ + public void noFiltrarCodigosEstados() { + Map mfileldsArm = new HashMap(); + //No filtra los codigos de armas ya consultados + String sqlFiltroCodigoArma = ""; + if(armaSeleccionadaList != null && !armaSeleccionadaList.isEmpty()){ + StringBuffer sqlCodigos = new StringBuffer(); + for(TarmArmas tarmArmas : armaSeleccionadaList){ + if(!sqlCodigos.toString().isEmpty()){ + sqlCodigos.append(" , "); + } + sqlCodigos.append("'" + tarmArmas.getPk()+"'"); + } + sqlFiltroCodigoArma = (!sqlCodigos.toString().trim().isEmpty())?" t.pk not in( " + sqlCodigos.toString() + ") ":""; + + } + + mfileldsArm.put("codigosarmasdec", sqlFiltroCodigoArma); + + //mfileldsArm.put("estadosarmasdec", " t.estado not in('DEST','CANC','SUSP','DEC','INC','ENTR','ABA','RECL') "); + mfileldsArm.put("estadosarmasdec", " t.estado not in('DEST','CDP','VEND','SUSP','RECL') "); + + armasLovController.setMfilelds(mfileldsArm); + } + + + + public void validacionFuncionario(){ + if(decomisoController.getRecord().getCedulafuncionario()!=null){ + TcustPersonDetail personDetail= buscarPersonaSnap(decomisoController.getRecord().getCedulafuncionario(), "CED"); + decomisoController.getRecord().setFuncionario(null); + if(personDetail!=null && personDetail.getName()!=null){ + decomisoController.getRecord().setFuncionario(personDetail.getName()); + }else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + } + } + + /** + * Recorta el nombre del archivo a cargarse + * @param nombre + * @return nombre recortado + */ + public String recorteNombre(String nombre){ + String fielname=nombre; + if(fielname.length()>30){ + fielname=fielname.substring(0,30)+extencionArchivo(nombre); + } + return fielname; + } + + /** + * Obtiene la extencion del archivo a cargar + * @param nombre + * @return + */ + private String extencionArchivo(String nombre){ + int pos=nombre.lastIndexOf('.'); + nombre=nombre.substring(pos); + return nombre; + } + /** + * Metodo que retorna la extencion del comprobante de deposito que se desea subir al alfresco + */ + public String getExtension(String filename) { + int index = filename.lastIndexOf('.'); + if (index == -1) { + return ""; + } else { + return filename.substring(index + 1); + } + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(decomisoController.getRecord().getFechadecomiso()); + StringBuilder ruta = new StringBuilder("cm:Decomiso"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + return ruta.toString(); + } + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en el Alfresco + */ + public void handleUpload(FileUploadEvent event){ + uploadedFile = event.getFile(); + btnfileUpload = Boolean.TRUE; + FacesContext context = FacesContext.getCurrentInstance(); + context.addMessage(null, new FacesMessage("RECUERDE", MsgControlArmas.getProperty("msg_recuerdeClickBtnRegMaterial"))); + + } + + /** + * Metodo que permite setear los datos de coordenadas relacionados a la entidad TarmDecomiso, una vez seleccionado un punto en el Map desde pantalla + */ + public void evento(){ + getDecomisoController().getRecord().setLatitud(new BigDecimal(getLatitud())); + getDecomisoController().getRecord().setLongitud(new BigDecimal(getLongitud())); + String longitudString = getDecomisoController().getRecord().getLongitud().toString(); + if(longitudString.contains("-")){ + longitudString = longitudString.replace("-", ""); + setLongitudGMS("oeste"); + }else{ + setLongitudGMS("este"); + } + String[] longitud = transformarGrados(longitudString); + + + + String latitudString = getDecomisoController().getRecord().getLatitud().toString(); + if(latitudString.contains("-")){ + latitudString = latitudString.replace("-", ""); + setLatitudGMS("sur"); + }else{ + setLatitudGMS("norte"); + } + String[] latitud = transformarGrados(latitudString); + setLatitudG(latitud[0]); + setLatitudM(latitud[1]); + setLatitudS(latitud[2]); + setLonguitudG(longitud[0]); + setLonguitudM(longitud[1]); + setLonguitudS(longitud[2]); + } + + /** + * Inicializa los campos al cambiar el tipo de Ubicacion desde la pagina + */ + public void changeUbicacion(){ + getDecomisoController().getRecord().setLatitud(null); + getDecomisoController().getRecord().setLongitud(null); + setLatitudG(""); + setLatitudM(""); + setLatitudS(""); + setLonguitudG(""); + setLonguitudM(""); + setLonguitudS(""); + setLatitud(""); + setLongitud(""); + setLongitudGMS(null); + setLatitudGMS(null); + } + + /** + * Permite inicializar los campos de longitud y lalitud y cargar a los datos de coordenadas relacionados a la entidad TarmDecomiso + */ + public void openMapPorCoordenandas(){ + setLatitud(""); + setLongitud(""); + if("coodernadas".equals(tipoMapa)){ + getDecomisoController().getRecord().setLatitud(new BigDecimal(transformarCoordenadas(latitudG, latitudM, latitudS, "sur".equals(latitudGMS)))); + getDecomisoController().getRecord().setLongitud(new BigDecimal(transformarCoordenadas(longuitudG, longuitudM, longuitudS, "oeste".equals(longitudGMS)))); + + } + } + + /** + * Metodo que permite transformar de Coordenadas Hexadecimales a Coordenadas en Grados, Minutos y Seguntos + * @param coordenada + * @return vector con las Coordenadas en Grados, Minutos y Seguntos + */ + public String[] transformarGrados(String coordenada){ + int grados = new BigDecimal(coordenada).intValue(); + BigDecimal minutos = new BigDecimal(coordenada).subtract(new BigDecimal(grados)).multiply(new BigDecimal(60)); + int min = minutos.intValue(); + BigDecimal segundos = minutos.subtract(new BigDecimal(min)).multiply(new BigDecimal(60)).setScale(4, BigDecimal.ROUND_FLOOR); + //System.out.println("latitude: " + grados + " " + min + " " + segundos); + return (grados + "," + min + "," + segundos).split(","); + } + + /** + * Metodo que permite transformar de coordenadas en Grados, Minutos y Seguntos a Coordenadas Hexadecimales + * @param grados + * @param minutos + * @param segundos + * @return coordenadas Hexadecimales + */ + public String transformarCoordenadas(String grados, String minutos, String segundos, boolean negativo){ + BigDecimal resultado = new BigDecimal(grados).add(new BigDecimal(minutos).divide(new BigDecimal(60), 12, BigDecimal.ROUND_FLOOR)).add(new BigDecimal(segundos).divide(new BigDecimal(3600), 12, BigDecimal.ROUND_FLOOR)); + resultado = resultado.setScale(12, BigDecimal.ROUND_FLOOR); + if(negativo){ + resultado = resultado.multiply(new BigDecimal(-1)); + } + return resultado.toString(); + } + + + /** + * Muestra un mensaje de error siempre y cuando sea un error de componente y se lo muestra como general + * @return + */ + public Boolean getExisteMensajesError() { + Boolean resp = Boolean.FALSE; + FacesContext facesContext = FacesContext.getCurrentInstance(); + final Iterator idComponentesMensajes = facesContext.getClientIdsWithMessages(); + while(idComponentesMensajes.hasNext()){ + String idComp = idComponentesMensajes.next(); + if(StringUtils.isNotBlank(idComp)){ + System.out.println("El id es "+idComp.replace(":", "\\\\:")); + System.out.println("$('#"+idComp.replace(":", "\\\\:")+"').focus();"); + facesContext.validationFailed(); + resp = Boolean.TRUE; + RequestContext.getCurrentInstance().execute("$('#"+idComp.replace(":", "\\\\:")+"').focus();"); + break; + } + } + return resp; + } + + public DecomisoController getDecomisoController() { + return decomisoController; + } + + + public void setDecomisoController(DecomisoController decomisoController) { + this.decomisoController = decomisoController; + } + + public List getLprovinces() { + return lprovinces; + } + + public void setLprovinces(List lprovinces) { + this.lprovinces = lprovinces; + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public List getLparroquias() { + return lparroquias; + } + + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + public List getLcities() { + return lcities; + } + + public void setLcities(List lcities) { + this.lcities = lcities; + } + + public List getTipoProceso() { + return tipoProceso; + } + + public void setTipoProceso(List tipoProceso) { + this.tipoProceso = tipoProceso; + } + + public List getTipoDocumeno() { + return tipoDocumeno; + } + + public void setTipoDocumeno(List tipoDocumeno) { + this.tipoDocumeno = tipoDocumeno; + } + + public List getGrados() { + return grados; + } + + public void setGrados(List grados) { + this.grados = grados; + } + + public List getUnidades() { + return unidades; + } + + public void setUnidades(List unidades) { + this.unidades = unidades; + } + + public ArmasController getArmasController() { + return armasController; + } + + public void setArmasController(ArmasController armasController) { + this.armasController = armasController; + } + + public TsafeUserDetail getTsafeUserDetail() { + return tsafeUserDetail; + } + + public void setTsafeUserDetail(TsafeUserDetail tsafeUserDetail) { + this.tsafeUserDetail = tsafeUserDetail; + } + + public TcustPersonDetail getTcustPersonDetailPortador() { + return tcustPersonDetailPortador; + } + + public void setTcustPersonDetailPortador( + TcustPersonDetail tcustPersonDetailPortador) { + this.tcustPersonDetailPortador = tcustPersonDetailPortador; + } + + public boolean isSinPortador() { + return sinPortador; + } + + public void setSinPortador(boolean sinPortador) { + this.sinPortador = sinPortador; + } + + public List getMotivoDecomisoList() { + return motivoDecomisoList; + } + + public void setMotivoDecomisoList(List motivoDecomisoList) { + this.motivoDecomisoList = motivoDecomisoList; + } + + public List getLmarca() { + return lmarca; + } + + public void setLmarca(List lmarca) { + this.lmarca = lmarca; + } + + public List getLcolor() { + return lcolor; + } + + public void setLcolor(List lcolor) { + this.lcolor = lcolor; + } + + public List getLtipofabricacion() { + return ltipofabricacion; + } + + public void setLtipofabricacion(List ltipofabricacion) { + this.ltipofabricacion = ltipofabricacion; + } + + public List getLcountry() { + return lcountry; + } + + public void setLcountry(List lcountry) { + this.lcountry = lcountry; + } + + public String getCodigoArma() { + return codigoArma; + } + + public void setCodigoArma(String codigoArma) { + this.codigoArma = codigoArma; + } + + public String getIdentificacionPro() { + return identificacionPro; + } + + public void setIdentificacionPro(String identificacionPro) { + this.identificacionPro = identificacionPro; + } + + public String getTipoIdentificacionPro() { + return tipoIdentificacionPro; + } + + public void setTipoIdentificacionPro(String tipoIdentificacionPro) { + this.tipoIdentificacionPro = tipoIdentificacionPro; + } + + public boolean isSinIdentificacion() { + return sinIdentificacion; + } + + public void setSinIdentificacion(boolean sinIdentificacion) { + this.sinIdentificacion = sinIdentificacion; + } + + public PersonDetailController getPersonDetailController() { + return personDetailController; + } + + public void setPersonDetailController( + PersonDetailController personDetailController) { + this.personDetailController = personDetailController; + } + + public String getUnidadpeso() { + return unidadpeso; + } + + public void setUnidadpeso(String unidadpeso) { + this.unidadpeso = unidadpeso; + } + + public TarmTipoArmaExplosivo getTipoArmaExplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoArmaExplosivo(TarmTipoArmaExplosivo tipoArmaExplosivo) { + this.tipoArmaExplosivo = tipoArmaExplosivo; + } + + public String getDescripcionUnidadpeso() { + return descripcionUnidadpeso; + } + + public void setDescripcionUnidadpeso(String descripcionUnidadpeso) { + this.descripcionUnidadpeso = descripcionUnidadpeso; + } + + public String getCodigoUnidadpeso() { + return codigoUnidadpeso; + } + + public void setCodigoUnidadpeso(String codigoUnidadpeso) { + this.codigoUnidadpeso = codigoUnidadpeso; + } + + public RegistroArmController getRegistroArmController() { + return registroArmController; + } + + public void setRegistroArmController(RegistroArmController registroArmController) { + this.registroArmController = registroArmController; + } + + public String getCodigoPasaporte() { + return codigoPasaporte; + } + + public void setCodigoPasaporte(String codigoPasaporte) { + this.codigoPasaporte = codigoPasaporte; + } + + public DecomisoArmaController getDecomisoArmaController() { + return decomisoArmaController; + } + + public void setDecomisoArmaController( + DecomisoArmaController decomisoArmaController) { + this.decomisoArmaController = decomisoArmaController; + } + + public PersonPhoneController getPersonPhoneController() { + return personPhoneController; + } + + public void setPersonPhoneController(PersonPhoneController personPhoneController) { + this.personPhoneController = personPhoneController; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public Boolean getBtn() { + return btn; + } + + public void setBtn(Boolean btn) { + this.btn = btn; + } + + public String getCodigoPaisOrigen() { + return codigoPaisOrigen; + } + + public void setCodigoPaisOrigen(String codigoPaisOrigen) { + this.codigoPaisOrigen = codigoPaisOrigen; + } + + public List getArmaSeleccionadaList() { + return armaSeleccionadaList; + } + + public void setArmaSeleccionadaList(List armaSeleccionadaList) { + this.armaSeleccionadaList = armaSeleccionadaList; + } + + public String getCdecomiso() { + return cdecomiso; + } + + public void setCdecomiso(String cdecomiso) { + this.cdecomiso = cdecomiso; + } + + public Boolean getBtnPeso() { + return btnPeso; + } + + public void setBtnPeso(Boolean btnPeso) { + this.btnPeso = btnPeso; + } + + public Boolean getBtnCantidad() { + return btnCantidad; + } + + public void setBtnCantidad(Boolean btnCantidad) { + this.btnCantidad = btnCantidad; + } + + public List getCentroControls() { + return centroControls; + } + + public void setCentroControls(List centroControls) { + this.centroControls = centroControls; + } + + public String getCentroControl() { + return centroControl; + } + + public void setCentroControl(String centroControl) { + this.centroControl = centroControl; + } + + public String getLatitud() { + return latitud; + } + + public void setLatitud(String latitud) { + this.latitud = latitud; + } + + public String getLongitud() { + return longitud; + } + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + public String getDireccionGoogleMap() { + return direccionGoogleMap; + } + + public void setDireccionGoogleMap(String direccionGoogleMap) { + this.direccionGoogleMap = direccionGoogleMap; + } + + public String getTipoMapa() { + return tipoMapa; + } + + public void setTipoMapa(String tipoMapa) { + this.tipoMapa = tipoMapa; + } + + public String getLatitudG() { + return latitudG; + } + + public void setLatitudG(String latitudG) { + this.latitudG = latitudG; + } + + public String getLatitudM() { + return latitudM; + } + + public void setLatitudM(String latitudM) { + this.latitudM = latitudM; + } + + public String getLatitudS() { + return latitudS; + } + + public void setLatitudS(String latitudS) { + this.latitudS = latitudS; + } + + public String getLonguitudG() { + return longuitudG; + } + + public void setLonguitudG(String longuitudG) { + this.longuitudG = longuitudG; + } + + public String getLonguitudM() { + return longuitudM; + } + + public void setLonguitudM(String longuitudM) { + this.longuitudM = longuitudM; + } + + public String getLonguitudS() { + return longuitudS; + } + + public void setLonguitudS(String longuitudS) { + this.longuitudS = longuitudS; + } + + /** + * @return the latitudGMS + */ + public String getLatitudGMS() { + return latitudGMS; + } + + /** + * @param latitudGMS the latitudGMS to set + */ + public void setLatitudGMS(String latitudGMS) { + this.latitudGMS = latitudGMS; + } + + /** + * @return the longitudGMS + */ + public String getLongitudGMS() { + return longitudGMS; + } + + /** + * @param longitudGMS the longitudGMS to set + */ + public void setLongitudGMS(String longitudGMS) { + this.longitudGMS = longitudGMS; + } + + + public boolean isSinDocumento() { + return sinDocumento; + } + + public void setSinDocumento(boolean sinDocumento) { + this.sinDocumento = sinDocumento; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + + public String getIngresoPortador() { + return ingresoPortador; + } + + public void setIngresoPortador(String ingresoPortador) { + this.ingresoPortador = ingresoPortador; + } + + public String getNombrerazonsocialsindoc() { + return nombrerazonsocialsindoc; + } + + public void setNombrerazonsocialsindoc(String nombrerazonsocialsindoc) { + this.nombrerazonsocialsindoc = nombrerazonsocialsindoc; + } + + public boolean isHabilitaNoDecomiso() { + return habilitaNoDecomiso; + } + + public void setHabilitaNoDecomiso(boolean habilitaNoDecomiso) { + this.habilitaNoDecomiso = habilitaNoDecomiso; + } + + public Boolean getBtnfileUpload() { + return btnfileUpload; + } + + public void setBtnfileUpload(Boolean btnfileUpload) { + this.btnfileUpload = btnfileUpload; + } + + public boolean isDeshabilitarPantalla() { + return deshabilitarPantalla; + } + + public void setDeshabilitarPantalla(boolean deshabilitarPantalla) { + this.deshabilitarPantalla = deshabilitarPantalla; + } + + public boolean isDeshabilitarPantallaMaterial() { + return deshabilitarPantallaMaterial; + } + + public void setDeshabilitarPantallaMaterial(boolean deshabilitarPantalla) { + this.deshabilitarPantallaMaterial = deshabilitarPantalla; + } + + public Boolean getBtnSave() { + return btnSave; + } + + public void setBtnSave(Boolean btnSave) { + this.btnSave = btnSave; + } + + public Boolean getIsExecuteRegistro() { + return isExecuteRegistro; + } + + public void setIsExecuteRegistro(Boolean isExecuteRegistro) { + this.isExecuteRegistro = isExecuteRegistro; + } + + public String getUnidad() { + return unidad; + } + + public void setUnidad(String unidad) { + this.unidad = unidad; + } + + public Boolean getBtnRegistro() { + return btnRegistro; + } + + public void setBtnRegistro(Boolean btnRegistro) { + this.btnRegistro = btnRegistro; + } + + public String getFilename() { + return filename; + } + + public void setFilename(String filename) { + this.filename = filename; + } + + + public byte[] getByteArray() { + return byteArray; + } + + public void setByteArray(byte[] byteArray) { + this.byteArray = byteArray; + } + + public boolean isSeleccionarMaterial() { + return seleccionarMaterial; + } + + public void setSeleccionarMaterial(boolean seleccionarMaterial) { + this.seleccionarMaterial = seleccionarMaterial; + } + + public ArmasLovController getArmasLovController() { + return armasLovController; + } + + public void setArmasLovController(ArmasLovController armasLovController) { + this.armasLovController = armasLovController; + } + + public String getNombrePortador() { + return nombrePortador; + } + + public void setNombrePortador(String nombrePortador) { + this.nombrePortador = nombrePortador; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DetRepDestruirArmasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DetRepDestruirArmasController.java.svn-base new file mode 100644 index 0000000..6665d8d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DetRepDestruirArmasController.java.svn-base @@ -0,0 +1,190 @@ +package com.fp.frontend.controller.armas.solicitud; + + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmDetRepDestruirArmas; + +/** + * Clase controladora del bean TarmDetRepDestruirArmas + * + * @author Christian Pazmino + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class DetRepDestruirArmasController extends AbstractController { + + + + + public DetRepDestruirArmasController() throws Exception { + super(TarmDetRepDestruirArmas.class); + } + + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //Ingreso de Datos Quemados + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + public void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + // record = new TarmSolicitudImportacion(); + this.beanalias = "DETREPORTEDESTRUIRARMAS"; +// this.create(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + public static List find() { + try { + DetRepDestruirArmasController cc = new DetRepDestruirArmasController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Metodo que busca un item de la tabla de detalle de reporte de destruccion de armas mediante la clave primaria + * + */ + public static TarmDetRepDestruirArmas findByCodigo(String cRegistro) { + try { + DetRepDestruirArmasController cc = new DetRepDestruirArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", cRegistro); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Metodo que busca una cabecera de reporte de destruccion de armas mediante el codigo de reporte + * @param cReporte codigo de reporte + * @return Lista de objetos de tipo TarmDetRepDestruirArmas que tienen el mismo cReporte + */ + public static List findByCReporte(String cReporte) { + try { + DetRepDestruirArmasController cc = new DetRepDestruirArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("creporte", cReporte); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + + + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + public void update(TarmDetRepDestruirArmas bean) throws Exception { + record=bean; + update(); + } +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DocumentoHabilitanteConErrorController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DocumentoHabilitanteConErrorController.java.netbeans-base new file mode 100644 index 0000000..38524c8 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DocumentoHabilitanteConErrorController.java.netbeans-base @@ -0,0 +1,934 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class DocumentoHabilitanteConErrorController extends AbstractController { + + + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value="#{alfrescoController}") + private AlfrescoController alfrescoController; + + @ManagedProperty(value="#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitanteController; + + @ManagedProperty(value="#{pesonAddressController}") + private PersonAddressController pesonAddressController; + + @ManagedProperty(value="#{solicitudController}") + private SolicitudController solicitudController; + + + + TarmSolicitudTramite solicitudTramite; + TarmSolicitud solicitud; + TarmTramite fila; + TcustPersonDetail detallesPersona; + TcustPersonDetail usuario; + TarmDocumentoHabilitante documentoHabilitante; + String numeroSolicitud; + String numeroTramite; + String nombreRazonSocial; + private String xpathflujo="";//cm:Pruebas/cm:ID_1715819825001"; + private String formato = "pdf"; + private String mostrarFormato="PDF"; +// TcustPersonDetail detallesPersona; + List lsolicitud; +// String numeroTramite; +// String nombreRazonSocial; + String identificacion; + String tipoidentificacion; + private String tramiteflujo=""; + private String solicitudflujo=""; + + + private List ldocumentos; + private String institucionCentroControl=""; + private TarmCentroControl centroControl = new TarmCentroControl(); + private TcustPersonDetail responsableCentroControl= null; + + public DocumentoHabilitanteConErrorController() throws Exception { + super(TarmSolicitudTramite.class); + } + + @PostConstruct + private void postconstruct() { + try { +// this.pasteBpmScreenParameters(); +// tramiteflujo=super.getMfilters().get("numerotransaccion"); +// solicitudflujo=super.getMfilters().get("csolicitud"); + + this.init(); +// super.getMfilters().clear(); + +// super.query(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + // lrecord = new ArrayList<>(); + beanalias = "EMITIRDOCUMENTOHABILITANTE"; + ldocumentos = new ArrayList(); + ldocumentos = CatalogDetailController.find("IDENTIFICATION"); + //Obteniendo el tramite + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(solicitudflujo); + + //Obteniendo la solicitud + solicitud=ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(solicitudflujo); + this.numeroTramite=solicitudTramite.getNumerotramite(); + + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + //Obteniendo el documento habilitante + documentoHabilitante=DocumentoHabilitanteController.findPorSolicitud(solicitudflujo); + obtenerCentroControl(); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public String getNumeroTramite() { + return numeroTramite; + } + + public void setNumeroTramite(String numeroTramite) { + this.numeroTramite = numeroTramite; + } + + @Override + protected void querydatabase() { + TarmSolicitud solicitudObj=SolicitudController.findSolicitudxnumerosolicitud(numeroSolicitud); + if(solicitudObj!=null && solicitudObj.getPk()!=null && solicitudObj.getCtramite()!=null){ + tramiteflujo=solicitudObj.getCtramite().toString(); + solicitudflujo=solicitudObj.getPk(); + } + init(); + try { + addFilter("numerotramite", numeroTramite); + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + SubQuery subqueryUso= new SubQuery("TarmTramite","usoactividad","actividad","i.pk=t.pk.ctramite"); + dto.addSubQuery(subqueryUso); + SubQuery subqueryPersona= new SubQuery("TarmSolicitud","personcode","persona","i.pk=t.pk.csolicitud"); + dto.addSubQuery(subqueryPersona); + SubQuery subqueryTipo=new SubQuery("TarmTramite", "tipoautorizacion", "tramite", "i.pk=t.pk.ctramite"); + dto.addSubQuery(subqueryTipo); + SubQuery subqueryTipocodigo=new SubQuery("TarmTramite", "tipoautorizacioncodigo", "tramitecodigo", "i.pk=t.pk.ctramite"); + dto.addSubQuery(subqueryTipocodigo); + SubQuery subqueryEstado=new SubQuery("TgeneCatalogDetail","description","desc","i.pk.catalog=t.estadotramite and i.pk.catalogcode=t.estadotramitecodigo"); + dto.addSubQuery(subqueryEstado); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + for(int i=0;i< this.lrecord.size();i++){ + this.lrecord.get(i).getModifiedData().put("usodes", CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("actividad").toString(), "USOACTIVIDAD").getDescription()); + TcustPersonDetail person = PersonDetailController.find(this.lrecord.get(i).getModifiedData().get("persona").toString()); + this.lrecord.get(i).getModifiedData().put("nombre", person.getName()); + this.lrecord.get(i).getModifiedData().put("identificacion", person.getIdentification()); + TgeneCatalogDetail tipo = CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("tramite").toString(), this.lrecord.get(i).getModifiedData().get("tramitecodigo").toString()); + this.lrecord.get(i).getModifiedData().put("tipotramdesc", tipo.getDescription()); + } + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para completar la tarea + */ + public void completarTarea() { + try { + if(xpathflujo==null || xpathflujo.isEmpty()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generarReporteRequerido")); + return; + } + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + + public void imprimir(TarmSolicitudTramite fila){ + try { + boolean flagRequisitos = false; + boolean flagArmas = false; + boolean flagGuardias = false; + boolean flagAgencia = false; + boolean flagDoc = false; + String tipotramite=fila.getModifiedData().get("tramite").toString(); + String nombreArchivo = fila.getModifiedData().get("tipotramdesc").toString(); + TarmSolicitud solicitud = SolicitudController.findSolicitudxcodsolicitud(fila.getPk().getCsolicitud()); + TarmTramite tramite = TarmTramiteController.findSimple(fila.getPk().getCtramite().toString()); + documentoHabilitante=documentoHabilitanteController.findPorSolicitud(fila.getPk().getCsolicitud()); + + xpathflujo=generarXpath(fila.getNumerotramite()); + System.out.println("..." + xpathflujo); + + //solicitud=ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(tipotramite); + if(tipotramite==null){ + MessageHelper.setMessageError("ERROR NO MANEJADO POR LA APLICACION CONTACTE AL PROVEEDOR"); + return; + } + if(tipotramite.equals("2")){ + if(tramite.getRegistroagenciasucursal().equalsIgnoreCase("Y")){ + flagAgencia = true; + } + if (tramite.getRegistroarmas().equalsIgnoreCase("Y")) { + flagArmas = true; + } + if (tramite.getRegistroguardia().equalsIgnoreCase("Y")) { + flagGuardias = true; + } + if(tramite.getDocumentohabilitante().equalsIgnoreCase("Y")) { + flagDoc = true; + } + //this.reporteCertificados(solicitud.getPk(), flagAgencia, flagArmas, flagDoc, flagGuardias); + InputStream pdf=this.reporteCertificados(solicitud.getPk(), flagAgencia, flagArmas, flagDoc, flagGuardias); + alfrescoController.uploadFile(pdf, documentoHabilitante.getNumerodocumento()+".pdf", xpathflujo) ; + xpathflujo = xpathflujo + "/cm:" + documentoHabilitante.getNumerodocumento()+".pdf"; + actualizarXpath(documentoHabilitante, xpathflujo); + return; + }else if (tipotramite.equals("4")) { + InputStream pdf=this.reporteGuiaLibreTransito(); + alfrescoController.uploadFile(pdf, documentoHabilitante.getNumerodocumento()+".pdf", xpathflujo) ; + xpathflujo = xpathflujo + "/cm:" + documentoHabilitante.getNumerodocumento()+".pdf"; + actualizarXpath(documentoHabilitante, xpathflujo); + return; + }else { + if(tramite.getRegistroagenciasucursal().equalsIgnoreCase("Y")){ + flagAgencia = true; + } + if (tramite.getRegistroarmas().equalsIgnoreCase("Y")) { + flagArmas = true; + } + if (tramite.getRegistroguardia().equalsIgnoreCase("Y")) { + flagGuardias = true; + } + if(tramite.getDocumentohabilitante().equalsIgnoreCase("Y")) { + flagDoc = true; + } + } + InputStream pdf=this.reporteGeneral(solicitud.getPk(),flagAgencia,flagArmas,flagDoc,flagGuardias,flagRequisitos,nombreArchivo); + alfrescoController.uploadFile(pdf, documentoHabilitante.getNumerodocumento()+".pdf", xpathflujo) ; + xpathflujo = xpathflujo + "/cm:" + documentoHabilitante.getNumerodocumento()+".pdf"; + actualizarXpath(documentoHabilitante, xpathflujo); + + } catch (Exception e) { + xpathflujo=null; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generar_reporte")); + } + } + + + /** + * Metodo para actualziar en la tabla tarmdocumentohabilitante con el xpath de la ruta de alfreco donde se guardo el documento + * @param documentoHabilitante + * @param xPath + * @throws Exception + */ + private void actualizarXpath(TarmDocumentoHabilitante documentoHabilitante, String xPath) throws Exception{ + documentoHabilitanteController.setRecord(documentoHabilitante); + documentoHabilitanteController.getRecord().setXpath(xPath); + documentoHabilitanteController.update(); + documentoHabilitanteController.save(); + } + + public String generarXpath(String tramite){ + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + tramite=tramite.replace("TRA", "SOL"); + StringBuilder ruta=new StringBuilder("cm:Solicitud"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + ruta = ruta.append("/cm:"+tramite); + return ruta.toString(); + } + + public String encontrarUsuario(){ + if(identificacion==null || identificacion=="") + return null; + detallesPersona=PersonDetailController.findxidentification(identificacion, tipoidentificacion); + if(detallesPersona==null) + return null; + lsolicitud=SolicitudController.findSolicitudxPersona(detallesPersona.getPk().getPersoncode().toString()); + + String csolicitud=null; + for(TarmSolicitud soli : lsolicitud){ + if(csolicitud==null){ + csolicitud="csolicitud='"+soli.getPk()+"'"; + } + else{ + csolicitud+=" or csolicitud='"+soli.getPk()+"'"; + } + } + return csolicitud; + } + + + @Override + public void save() { + // TODO Auto-generated method stub + super.save(); + } + + /** + * Ejecuta un reporte de armas + * @param name Nombre del reporte a generar. + */ + public InputStream reporteGuiaLibreTransito() { + try { + String path = "armas/reports/guiaLibreTransito"; + String filename=MsgControlArmas.getProperty("lbl_guiaLibreTransito"); + + detallesPersona = PersonDetailController.find(String.valueOf(solicitud.getPersoncode().toString())); + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + TarmSolicitud sol = this.solicitudController.findSolicitudxcodsolicitud(this.solicitudflujo); + //No. Guia + parameters.put("noGuia", this.numeroTramite); + + //Codigo de barras + String codigoBarras=this.numeroTramite.replace("-", "").toLowerCase(); + Boolean caracterEliminado=false; + for (int i = 0; i < codigoBarras.length(); i++) { + if(caracterEliminado){ + i=0; + caracterEliminado=false; + } + if(codigoBarras.toCharArray()[i]!='0' && codigoBarras.toCharArray()[i]!='1' && codigoBarras.toCharArray()[i]!='2' + && codigoBarras.toCharArray()[i]!='3' && codigoBarras.toCharArray()[i]!='4' && codigoBarras.toCharArray()[i]!='5' + && codigoBarras.toCharArray()[i]!='6' && codigoBarras.toCharArray()[i]!='7' && codigoBarras.toCharArray()[i]!='8' + && codigoBarras.toCharArray()[i]!='9'){ + + String caracterExtranno=""; + caracterExtranno+=codigoBarras.toCharArray()[i]; + codigoBarras=codigoBarras.replace(caracterExtranno, ""); + caracterEliminado=true; + } + } + parameters.put("codigoBarras", codigoBarras); + + //Nombre/Razon Social + parameters.put("nombreRazon", detallesPersona.getName()); + + //Cedula + parameters.put("cedula", detallesPersona.getIdentification()); + + //Desde + parameters.put("desde", solicitud.getLugarorigen()); + + //Hasta + parameters.put("hasta", solicitud.getLugardestino()); + + //Fechas + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + if(documentoHabilitante!=null){ + parameters.put("fechaExpide", sdf.format(documentoHabilitante.getFechaemision())); + parameters.put("fechaCaduca", sdf.format(documentoHabilitante.getFechaexpiracion())); + }else{ + parameters.put("fechaExpide", " "); + parameters.put("fechaCaduca", " "); + } + + //Grado + String gradoFuncionario=""; + TgeneCatalogDetail grado=CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), + this.responsableCentroControl.getMilitarygradecode()); + if(grado!=null){ + gradoFuncionario=grado.getDescription()+" - "; + } + + //Lugar origen y destino + if(sol!=null){ + parameters.put("provinciaorigen", sol.modifiedData().get("provinciaorigen").toString()); + parameters.put("cantonorigen", sol.modifiedData().get("cantonorigen").toString()); + parameters.put("lugarorigen", sol.getLugarorigen().toString()); + parameters.put("provinciadestino", sol.modifiedData().get("provinciadestino").toString()); + parameters.put("cantondestino", sol.modifiedData().get("cantondestino").toString()); + parameters.put("lugardestino", sol.getLugardestino().toString()); + + } + + //Funcionario + parameters.put("gradoNombreFuncionario",gradoFuncionario+this.responsableCentroControl.getName()); + parameters.put("personcode",this.responsableCentroControl.getPk().getPersoncode()); + parameters.put("centroControl","JEFE DEL "+this.institucionCentroControl); + parameters.put("nombreCentro", this.institucionCentroControl); + //Usuario + parameters.put("usuario",this.usuario.getName()); + sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + String fechaHora=sdf.format(Calendar.getInstance().getTime()); + parameters.put("fechaHora",fechaHora); + + String format = "pdf"; + InputStream pdf = this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + return pdf; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + return null; + } + + /** + * Ejecuta un reporte de certificado de armas + * @param name Nombre del reporte a generar. + */ + + + + public void reporteCertificadoArmas() { + try { + String path = "armas/reports/certificadoArmas"; + String filename="certificadoarmas"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + + String format = "pdf"; + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Ejecuta un reporte de certificado de armas + * @param name Nombre del reporte a generar. + */ + + + + public void reporteAgencias() { + try { + String path = "armas/reports/aperturaAgenciasSucursales"; + String filename="aperturaagenciassucursales"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + String format = "pdf"; + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + +/* public void reporteInscripcion(TarmSolicitud solicitud) { + try { + String path = "armas/reports/reporteInscripcion"; + String filename="armas"; + + detallesPersona = PersonDetailController.find(String.valueOf(solicitud.getPersoncode().toString())); + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + + //No. Guia + parameters.put("nombreCompania", detallesPersona.getName()); + + //Nombre/Razon Social + parameters.put("nombrepersona",detallesPersona.getLegalrepresent()); + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("fecha", sdf.format(solicitud.getFregistro())); + parameters.put("ciudad", "Quito"); + + String format = "pdf"; + + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + */ + /** + * Ejecuta reporte general de informacion de armas, guardias, agencias y sucursales + * @param name Nombre del reporte a generar. + */ + + public InputStream reporteGeneral(String solicitud,boolean flagAgencia,boolean flagArmas,boolean flagDoc,boolean flagGuardias,boolean flagRequisitos,String nombreArchivo) { + try { + String path = "armas/reports/generalReportHabilita"; + String filename=nombreArchivo; + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail user = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); +// TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(user.getMilitarygrade(), user.getMilitarygradecode()); + TgeneCatalogDetail grado =null; + if(this.responsableCentroControl.getMilitarygrade()!=null && this.responsableCentroControl.getMilitarygradecode()!=null){ + grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + } + + String gradoUsuario=""; + if(grado!=null){ + gradoUsuario = grado.getDescription()+" - "+this.responsableCentroControl.getName(); + }else{ + gradoUsuario = this.responsableCentroControl.getName(); + } + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("csolicitud", solicitudflujo); + + //Obteniendo la solicitud + TarmSolicitud s=SolicitudController.findSolicitudxcodsolicitud(solicitudflujo); + TarmTramite t; + Boolean datosTramiteVacios=false; + + if(s!=null){ + //Obteniendo el tramite + t=TarmTramiteController.find(s.getCtramite().toString()); + + //Obteniendo la solicitud trmite + TarmSolicitudTramite st=TarmSolicitudTramiteController.findPorCSolicitud(solicitudflujo); + + + if(t!=null){ + + //No de tramite + if(st!=null){ + parameters.put("noTramite", st.getNumerotramite()); + }else{ + parameters.put("noTramite", " "); + } + + //Tipo de tramite + if(t.getModifiedData().get("tipotramite")!=null){ + parameters.put("tipoTramite", t.getModifiedData().get("tipotramite")); + }else{ + parameters.put("tipoTramite", " "); + } + + //Tipo de autorizacion + if(t.getModifiedData().get("tipoautorizacion")!=null){ + parameters.put("tipoAutorizacion", t.getModifiedData().get("tipoautorizacion")); + }else{ + parameters.put("tipoAutorizacion", " "); + } + + //Categoria + if(t.getModifiedData().get("categoria")!=null){ + parameters.put("categoria", t.getModifiedData().get("categoria")); + }else{ + parameters.put("categoria", " "); + } + + //Uso actividad + if(t.getModifiedData().get("usoactividad")!=null){ + parameters.put("usoActividad", t.getModifiedData().get("usoactividad")); + }else{ + parameters.put("usoActividad", " "); + } + + //Cabecera + if(t.getCabecera()!=null){ + parameters.put("cabecera", t.getCabecera()); + }else{ + parameters.put("cabecera", " "); + } + + //Pie + if(t.getPie()!=null){ + parameters.put("pie", t.getPie()); + }else{ + parameters.put("pie", " "); + } + + //fecha de solicitud + if(s.getFregistro()!=null){ + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fecSolicitud", sdf.format(s.getFregistro())); + } + else { + parameters.put("fecSolicitud", ""); + } + + + + }else{ + datosTramiteVacios=true; + } + }else{ + datosTramiteVacios=true; + } + + if(datosTramiteVacios){ + parameters.put("noTramite", " "); + parameters.put("tipoTramite", " "); + parameters.put("tipoAutorizacion", " "); + parameters.put("categoria", " "); + parameters.put("usoActividad", " "); + parameters.put("cabecera", " "); + parameters.put("pie", " "); + } + + //Obteniendo la direccion + String email=" ",direccion=" "; + List direcciones=PersonAddressController.findAllByPersonCode(s.getPersoncode().toString()); + for (TcustPersonAddress d : direcciones) { + Calendar calendario=Calendar.getInstance(); + calendario.setTime(d.getPk().getDateto()); + if(calendario.get(Calendar.YEAR)==2999){ + if(d.getAddresstypecatalog().equalsIgnoreCase("3")){ + email=d.getAddress(); + }else if(d.getPrincipal()!=null && d.getPrincipal().equalsIgnoreCase("Y")){ + direccion=d.getAddress(); + } + } + } + + //Email + parameters.put("email", email); + + //Direccion + parameters.put("direccion", direccion); + + + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + parameters.put("flagAgencia", flagAgencia); + parameters.put("flagArmas", flagArmas); + parameters.put("flagDoc", flagDoc); + parameters.put("flagGuardias", flagGuardias); + parameters.put("flagRequisitos", flagRequisitos); + parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("codResponsable", this.responsableCentroControl.getPk().getPersoncode()); + parameters.put("usuario",user.getName()); + String format = "pdf"; + InputStream pdf=this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + return pdf; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + return null; + } + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController direccion = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres= direccion.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + this.centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + //Reponsable + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + return setInstitucionCentroControl(CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + + + + } + + /** + * Ejecuta reporte general de informacion de armas, guardias, agencias y sucursales + * @param name Nombre del reporte a generar. + */ + + public InputStream reporteCertificados(String solicitud,boolean flagAgencia,boolean flagArmas,boolean flagDoc,boolean flagGuardias) { + try { + String gradoUsuario =""; + String path = "armas/reports/reporteCertificado"; + String filename="reporteCertificado"; + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail user = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if(grado != null){ + gradoUsuario = grado.getDescription()+" - "+this.responsableCentroControl.getName(); + }else{ + gradoUsuario = "Sin Grado - "+this.responsableCentroControl.getName(); + } + + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("csolicitud", solicitud); + //Obteniendo la solicitud + TarmSolicitud s=SolicitudController.findSolicitudxcodsolicitud(solicitudflujo); + //Obteniendo la direccion + String email=" ",direccion=" "; + List direcciones=PersonAddressController.findAllByPersonCode(s.getPersoncode().toString()); + for (TcustPersonAddress d : direcciones) { + Calendar calendario=Calendar.getInstance(); + calendario.setTime(d.getPk().getDateto()); + if(calendario.get(Calendar.YEAR)==2999){ + if(d.getAddresstypecatalog().equalsIgnoreCase("3")){ + email=d.getAddress(); + }else if(d.getAddresstypecatalog().equalsIgnoreCase("1")){ + direccion=d.getAddress(); + } + } + } + + //Email + parameters.put("email", email); + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + parameters.put("flagAgencia", flagAgencia); + parameters.put("flagArmas", flagArmas); + parameters.put("flagDoc", flagDoc); + parameters.put("flagGuardias", flagGuardias); + parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("usuario",user.getName()); + parameters.put("codResponsable", this.responsableCentroControl.getPk().getPersoncode()); + String format = "pdf"; + //this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + InputStream pdf=this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + return pdf; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + return null; + } + + public List getLdocumentos() { + return ldocumentos; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + public void setLdocumentos(List ldocumentos) { + this.ldocumentos = ldocumentos; + } + + public String getIdentificacion() { + return identificacion; + } + + public void setIdentificacion(String identificacion) { + this.identificacion = identificacion; + } + + public String getTipoidentificacion() { + return tipoidentificacion; + } + + public void setTipoidentificacion(String tipoidentificacion) { + this.tipoidentificacion = tipoidentificacion; + } + + TarmTramite getFila() { + return fila; + } + + public void setFila(TarmTramite fila) { + this.fila = fila; + } + + + + public String getFormato() { + return formato; + } + + public void setFormato(String formato) { + this.formato = formato; + } + + public String getMostrarFormato() { + return mostrarFormato; + } + + public void setMostrarFormato(String mostrarFormato) { + this.mostrarFormato = mostrarFormato; + } + + public String getTramiteflujo() { + return tramiteflujo; + } + + public void setTramiteflujo(String tramiteflujo) { + this.tramiteflujo = tramiteflujo; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public String setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + return institucionCentroControl; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public DocumentoHabilitanteController getDocumentoHabilitanteController() { + return documentoHabilitanteController; + } + + public void setDocumentoHabilitanteController( + DocumentoHabilitanteController documentoHabilitanteController) { + this.documentoHabilitanteController = documentoHabilitanteController; + } + + public PersonAddressController getPesonAddressController() { + return pesonAddressController; + } + + public void setPesonAddressController( + PersonAddressController pesonAddressController) { + this.pesonAddressController = pesonAddressController; + } + + public SolicitudController getSolicitudController() { + return solicitudController; + } + + public void setSolicitudController(SolicitudController solicitudController) { + this.solicitudController = solicitudController; + } + + public String getNumeroSolicitud() { + return numeroSolicitud; + } + + public void setNumeroSolicitud(String numeroSolicitud) { + this.numeroSolicitud = numeroSolicitud; + } + + + + + +} + diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DocumentoHabilitanteConErrorController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DocumentoHabilitanteConErrorController.java.svn-base new file mode 100644 index 0000000..38524c8 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DocumentoHabilitanteConErrorController.java.svn-base @@ -0,0 +1,934 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class DocumentoHabilitanteConErrorController extends AbstractController { + + + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value="#{alfrescoController}") + private AlfrescoController alfrescoController; + + @ManagedProperty(value="#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitanteController; + + @ManagedProperty(value="#{pesonAddressController}") + private PersonAddressController pesonAddressController; + + @ManagedProperty(value="#{solicitudController}") + private SolicitudController solicitudController; + + + + TarmSolicitudTramite solicitudTramite; + TarmSolicitud solicitud; + TarmTramite fila; + TcustPersonDetail detallesPersona; + TcustPersonDetail usuario; + TarmDocumentoHabilitante documentoHabilitante; + String numeroSolicitud; + String numeroTramite; + String nombreRazonSocial; + private String xpathflujo="";//cm:Pruebas/cm:ID_1715819825001"; + private String formato = "pdf"; + private String mostrarFormato="PDF"; +// TcustPersonDetail detallesPersona; + List lsolicitud; +// String numeroTramite; +// String nombreRazonSocial; + String identificacion; + String tipoidentificacion; + private String tramiteflujo=""; + private String solicitudflujo=""; + + + private List ldocumentos; + private String institucionCentroControl=""; + private TarmCentroControl centroControl = new TarmCentroControl(); + private TcustPersonDetail responsableCentroControl= null; + + public DocumentoHabilitanteConErrorController() throws Exception { + super(TarmSolicitudTramite.class); + } + + @PostConstruct + private void postconstruct() { + try { +// this.pasteBpmScreenParameters(); +// tramiteflujo=super.getMfilters().get("numerotransaccion"); +// solicitudflujo=super.getMfilters().get("csolicitud"); + + this.init(); +// super.getMfilters().clear(); + +// super.query(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + // lrecord = new ArrayList<>(); + beanalias = "EMITIRDOCUMENTOHABILITANTE"; + ldocumentos = new ArrayList(); + ldocumentos = CatalogDetailController.find("IDENTIFICATION"); + //Obteniendo el tramite + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(solicitudflujo); + + //Obteniendo la solicitud + solicitud=ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(solicitudflujo); + this.numeroTramite=solicitudTramite.getNumerotramite(); + + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + //Obteniendo el documento habilitante + documentoHabilitante=DocumentoHabilitanteController.findPorSolicitud(solicitudflujo); + obtenerCentroControl(); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public String getNumeroTramite() { + return numeroTramite; + } + + public void setNumeroTramite(String numeroTramite) { + this.numeroTramite = numeroTramite; + } + + @Override + protected void querydatabase() { + TarmSolicitud solicitudObj=SolicitudController.findSolicitudxnumerosolicitud(numeroSolicitud); + if(solicitudObj!=null && solicitudObj.getPk()!=null && solicitudObj.getCtramite()!=null){ + tramiteflujo=solicitudObj.getCtramite().toString(); + solicitudflujo=solicitudObj.getPk(); + } + init(); + try { + addFilter("numerotramite", numeroTramite); + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + SubQuery subqueryUso= new SubQuery("TarmTramite","usoactividad","actividad","i.pk=t.pk.ctramite"); + dto.addSubQuery(subqueryUso); + SubQuery subqueryPersona= new SubQuery("TarmSolicitud","personcode","persona","i.pk=t.pk.csolicitud"); + dto.addSubQuery(subqueryPersona); + SubQuery subqueryTipo=new SubQuery("TarmTramite", "tipoautorizacion", "tramite", "i.pk=t.pk.ctramite"); + dto.addSubQuery(subqueryTipo); + SubQuery subqueryTipocodigo=new SubQuery("TarmTramite", "tipoautorizacioncodigo", "tramitecodigo", "i.pk=t.pk.ctramite"); + dto.addSubQuery(subqueryTipocodigo); + SubQuery subqueryEstado=new SubQuery("TgeneCatalogDetail","description","desc","i.pk.catalog=t.estadotramite and i.pk.catalogcode=t.estadotramitecodigo"); + dto.addSubQuery(subqueryEstado); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + for(int i=0;i< this.lrecord.size();i++){ + this.lrecord.get(i).getModifiedData().put("usodes", CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("actividad").toString(), "USOACTIVIDAD").getDescription()); + TcustPersonDetail person = PersonDetailController.find(this.lrecord.get(i).getModifiedData().get("persona").toString()); + this.lrecord.get(i).getModifiedData().put("nombre", person.getName()); + this.lrecord.get(i).getModifiedData().put("identificacion", person.getIdentification()); + TgeneCatalogDetail tipo = CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("tramite").toString(), this.lrecord.get(i).getModifiedData().get("tramitecodigo").toString()); + this.lrecord.get(i).getModifiedData().put("tipotramdesc", tipo.getDescription()); + } + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para completar la tarea + */ + public void completarTarea() { + try { + if(xpathflujo==null || xpathflujo.isEmpty()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generarReporteRequerido")); + return; + } + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + + public void imprimir(TarmSolicitudTramite fila){ + try { + boolean flagRequisitos = false; + boolean flagArmas = false; + boolean flagGuardias = false; + boolean flagAgencia = false; + boolean flagDoc = false; + String tipotramite=fila.getModifiedData().get("tramite").toString(); + String nombreArchivo = fila.getModifiedData().get("tipotramdesc").toString(); + TarmSolicitud solicitud = SolicitudController.findSolicitudxcodsolicitud(fila.getPk().getCsolicitud()); + TarmTramite tramite = TarmTramiteController.findSimple(fila.getPk().getCtramite().toString()); + documentoHabilitante=documentoHabilitanteController.findPorSolicitud(fila.getPk().getCsolicitud()); + + xpathflujo=generarXpath(fila.getNumerotramite()); + System.out.println("..." + xpathflujo); + + //solicitud=ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(tipotramite); + if(tipotramite==null){ + MessageHelper.setMessageError("ERROR NO MANEJADO POR LA APLICACION CONTACTE AL PROVEEDOR"); + return; + } + if(tipotramite.equals("2")){ + if(tramite.getRegistroagenciasucursal().equalsIgnoreCase("Y")){ + flagAgencia = true; + } + if (tramite.getRegistroarmas().equalsIgnoreCase("Y")) { + flagArmas = true; + } + if (tramite.getRegistroguardia().equalsIgnoreCase("Y")) { + flagGuardias = true; + } + if(tramite.getDocumentohabilitante().equalsIgnoreCase("Y")) { + flagDoc = true; + } + //this.reporteCertificados(solicitud.getPk(), flagAgencia, flagArmas, flagDoc, flagGuardias); + InputStream pdf=this.reporteCertificados(solicitud.getPk(), flagAgencia, flagArmas, flagDoc, flagGuardias); + alfrescoController.uploadFile(pdf, documentoHabilitante.getNumerodocumento()+".pdf", xpathflujo) ; + xpathflujo = xpathflujo + "/cm:" + documentoHabilitante.getNumerodocumento()+".pdf"; + actualizarXpath(documentoHabilitante, xpathflujo); + return; + }else if (tipotramite.equals("4")) { + InputStream pdf=this.reporteGuiaLibreTransito(); + alfrescoController.uploadFile(pdf, documentoHabilitante.getNumerodocumento()+".pdf", xpathflujo) ; + xpathflujo = xpathflujo + "/cm:" + documentoHabilitante.getNumerodocumento()+".pdf"; + actualizarXpath(documentoHabilitante, xpathflujo); + return; + }else { + if(tramite.getRegistroagenciasucursal().equalsIgnoreCase("Y")){ + flagAgencia = true; + } + if (tramite.getRegistroarmas().equalsIgnoreCase("Y")) { + flagArmas = true; + } + if (tramite.getRegistroguardia().equalsIgnoreCase("Y")) { + flagGuardias = true; + } + if(tramite.getDocumentohabilitante().equalsIgnoreCase("Y")) { + flagDoc = true; + } + } + InputStream pdf=this.reporteGeneral(solicitud.getPk(),flagAgencia,flagArmas,flagDoc,flagGuardias,flagRequisitos,nombreArchivo); + alfrescoController.uploadFile(pdf, documentoHabilitante.getNumerodocumento()+".pdf", xpathflujo) ; + xpathflujo = xpathflujo + "/cm:" + documentoHabilitante.getNumerodocumento()+".pdf"; + actualizarXpath(documentoHabilitante, xpathflujo); + + } catch (Exception e) { + xpathflujo=null; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generar_reporte")); + } + } + + + /** + * Metodo para actualziar en la tabla tarmdocumentohabilitante con el xpath de la ruta de alfreco donde se guardo el documento + * @param documentoHabilitante + * @param xPath + * @throws Exception + */ + private void actualizarXpath(TarmDocumentoHabilitante documentoHabilitante, String xPath) throws Exception{ + documentoHabilitanteController.setRecord(documentoHabilitante); + documentoHabilitanteController.getRecord().setXpath(xPath); + documentoHabilitanteController.update(); + documentoHabilitanteController.save(); + } + + public String generarXpath(String tramite){ + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + tramite=tramite.replace("TRA", "SOL"); + StringBuilder ruta=new StringBuilder("cm:Solicitud"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + ruta = ruta.append("/cm:"+tramite); + return ruta.toString(); + } + + public String encontrarUsuario(){ + if(identificacion==null || identificacion=="") + return null; + detallesPersona=PersonDetailController.findxidentification(identificacion, tipoidentificacion); + if(detallesPersona==null) + return null; + lsolicitud=SolicitudController.findSolicitudxPersona(detallesPersona.getPk().getPersoncode().toString()); + + String csolicitud=null; + for(TarmSolicitud soli : lsolicitud){ + if(csolicitud==null){ + csolicitud="csolicitud='"+soli.getPk()+"'"; + } + else{ + csolicitud+=" or csolicitud='"+soli.getPk()+"'"; + } + } + return csolicitud; + } + + + @Override + public void save() { + // TODO Auto-generated method stub + super.save(); + } + + /** + * Ejecuta un reporte de armas + * @param name Nombre del reporte a generar. + */ + public InputStream reporteGuiaLibreTransito() { + try { + String path = "armas/reports/guiaLibreTransito"; + String filename=MsgControlArmas.getProperty("lbl_guiaLibreTransito"); + + detallesPersona = PersonDetailController.find(String.valueOf(solicitud.getPersoncode().toString())); + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + TarmSolicitud sol = this.solicitudController.findSolicitudxcodsolicitud(this.solicitudflujo); + //No. Guia + parameters.put("noGuia", this.numeroTramite); + + //Codigo de barras + String codigoBarras=this.numeroTramite.replace("-", "").toLowerCase(); + Boolean caracterEliminado=false; + for (int i = 0; i < codigoBarras.length(); i++) { + if(caracterEliminado){ + i=0; + caracterEliminado=false; + } + if(codigoBarras.toCharArray()[i]!='0' && codigoBarras.toCharArray()[i]!='1' && codigoBarras.toCharArray()[i]!='2' + && codigoBarras.toCharArray()[i]!='3' && codigoBarras.toCharArray()[i]!='4' && codigoBarras.toCharArray()[i]!='5' + && codigoBarras.toCharArray()[i]!='6' && codigoBarras.toCharArray()[i]!='7' && codigoBarras.toCharArray()[i]!='8' + && codigoBarras.toCharArray()[i]!='9'){ + + String caracterExtranno=""; + caracterExtranno+=codigoBarras.toCharArray()[i]; + codigoBarras=codigoBarras.replace(caracterExtranno, ""); + caracterEliminado=true; + } + } + parameters.put("codigoBarras", codigoBarras); + + //Nombre/Razon Social + parameters.put("nombreRazon", detallesPersona.getName()); + + //Cedula + parameters.put("cedula", detallesPersona.getIdentification()); + + //Desde + parameters.put("desde", solicitud.getLugarorigen()); + + //Hasta + parameters.put("hasta", solicitud.getLugardestino()); + + //Fechas + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + if(documentoHabilitante!=null){ + parameters.put("fechaExpide", sdf.format(documentoHabilitante.getFechaemision())); + parameters.put("fechaCaduca", sdf.format(documentoHabilitante.getFechaexpiracion())); + }else{ + parameters.put("fechaExpide", " "); + parameters.put("fechaCaduca", " "); + } + + //Grado + String gradoFuncionario=""; + TgeneCatalogDetail grado=CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), + this.responsableCentroControl.getMilitarygradecode()); + if(grado!=null){ + gradoFuncionario=grado.getDescription()+" - "; + } + + //Lugar origen y destino + if(sol!=null){ + parameters.put("provinciaorigen", sol.modifiedData().get("provinciaorigen").toString()); + parameters.put("cantonorigen", sol.modifiedData().get("cantonorigen").toString()); + parameters.put("lugarorigen", sol.getLugarorigen().toString()); + parameters.put("provinciadestino", sol.modifiedData().get("provinciadestino").toString()); + parameters.put("cantondestino", sol.modifiedData().get("cantondestino").toString()); + parameters.put("lugardestino", sol.getLugardestino().toString()); + + } + + //Funcionario + parameters.put("gradoNombreFuncionario",gradoFuncionario+this.responsableCentroControl.getName()); + parameters.put("personcode",this.responsableCentroControl.getPk().getPersoncode()); + parameters.put("centroControl","JEFE DEL "+this.institucionCentroControl); + parameters.put("nombreCentro", this.institucionCentroControl); + //Usuario + parameters.put("usuario",this.usuario.getName()); + sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + String fechaHora=sdf.format(Calendar.getInstance().getTime()); + parameters.put("fechaHora",fechaHora); + + String format = "pdf"; + InputStream pdf = this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + return pdf; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + return null; + } + + /** + * Ejecuta un reporte de certificado de armas + * @param name Nombre del reporte a generar. + */ + + + + public void reporteCertificadoArmas() { + try { + String path = "armas/reports/certificadoArmas"; + String filename="certificadoarmas"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + + String format = "pdf"; + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Ejecuta un reporte de certificado de armas + * @param name Nombre del reporte a generar. + */ + + + + public void reporteAgencias() { + try { + String path = "armas/reports/aperturaAgenciasSucursales"; + String filename="aperturaagenciassucursales"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + String format = "pdf"; + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + +/* public void reporteInscripcion(TarmSolicitud solicitud) { + try { + String path = "armas/reports/reporteInscripcion"; + String filename="armas"; + + detallesPersona = PersonDetailController.find(String.valueOf(solicitud.getPersoncode().toString())); + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + + //No. Guia + parameters.put("nombreCompania", detallesPersona.getName()); + + //Nombre/Razon Social + parameters.put("nombrepersona",detallesPersona.getLegalrepresent()); + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("fecha", sdf.format(solicitud.getFregistro())); + parameters.put("ciudad", "Quito"); + + String format = "pdf"; + + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + */ + /** + * Ejecuta reporte general de informacion de armas, guardias, agencias y sucursales + * @param name Nombre del reporte a generar. + */ + + public InputStream reporteGeneral(String solicitud,boolean flagAgencia,boolean flagArmas,boolean flagDoc,boolean flagGuardias,boolean flagRequisitos,String nombreArchivo) { + try { + String path = "armas/reports/generalReportHabilita"; + String filename=nombreArchivo; + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail user = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); +// TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(user.getMilitarygrade(), user.getMilitarygradecode()); + TgeneCatalogDetail grado =null; + if(this.responsableCentroControl.getMilitarygrade()!=null && this.responsableCentroControl.getMilitarygradecode()!=null){ + grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + } + + String gradoUsuario=""; + if(grado!=null){ + gradoUsuario = grado.getDescription()+" - "+this.responsableCentroControl.getName(); + }else{ + gradoUsuario = this.responsableCentroControl.getName(); + } + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("csolicitud", solicitudflujo); + + //Obteniendo la solicitud + TarmSolicitud s=SolicitudController.findSolicitudxcodsolicitud(solicitudflujo); + TarmTramite t; + Boolean datosTramiteVacios=false; + + if(s!=null){ + //Obteniendo el tramite + t=TarmTramiteController.find(s.getCtramite().toString()); + + //Obteniendo la solicitud trmite + TarmSolicitudTramite st=TarmSolicitudTramiteController.findPorCSolicitud(solicitudflujo); + + + if(t!=null){ + + //No de tramite + if(st!=null){ + parameters.put("noTramite", st.getNumerotramite()); + }else{ + parameters.put("noTramite", " "); + } + + //Tipo de tramite + if(t.getModifiedData().get("tipotramite")!=null){ + parameters.put("tipoTramite", t.getModifiedData().get("tipotramite")); + }else{ + parameters.put("tipoTramite", " "); + } + + //Tipo de autorizacion + if(t.getModifiedData().get("tipoautorizacion")!=null){ + parameters.put("tipoAutorizacion", t.getModifiedData().get("tipoautorizacion")); + }else{ + parameters.put("tipoAutorizacion", " "); + } + + //Categoria + if(t.getModifiedData().get("categoria")!=null){ + parameters.put("categoria", t.getModifiedData().get("categoria")); + }else{ + parameters.put("categoria", " "); + } + + //Uso actividad + if(t.getModifiedData().get("usoactividad")!=null){ + parameters.put("usoActividad", t.getModifiedData().get("usoactividad")); + }else{ + parameters.put("usoActividad", " "); + } + + //Cabecera + if(t.getCabecera()!=null){ + parameters.put("cabecera", t.getCabecera()); + }else{ + parameters.put("cabecera", " "); + } + + //Pie + if(t.getPie()!=null){ + parameters.put("pie", t.getPie()); + }else{ + parameters.put("pie", " "); + } + + //fecha de solicitud + if(s.getFregistro()!=null){ + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fecSolicitud", sdf.format(s.getFregistro())); + } + else { + parameters.put("fecSolicitud", ""); + } + + + + }else{ + datosTramiteVacios=true; + } + }else{ + datosTramiteVacios=true; + } + + if(datosTramiteVacios){ + parameters.put("noTramite", " "); + parameters.put("tipoTramite", " "); + parameters.put("tipoAutorizacion", " "); + parameters.put("categoria", " "); + parameters.put("usoActividad", " "); + parameters.put("cabecera", " "); + parameters.put("pie", " "); + } + + //Obteniendo la direccion + String email=" ",direccion=" "; + List direcciones=PersonAddressController.findAllByPersonCode(s.getPersoncode().toString()); + for (TcustPersonAddress d : direcciones) { + Calendar calendario=Calendar.getInstance(); + calendario.setTime(d.getPk().getDateto()); + if(calendario.get(Calendar.YEAR)==2999){ + if(d.getAddresstypecatalog().equalsIgnoreCase("3")){ + email=d.getAddress(); + }else if(d.getPrincipal()!=null && d.getPrincipal().equalsIgnoreCase("Y")){ + direccion=d.getAddress(); + } + } + } + + //Email + parameters.put("email", email); + + //Direccion + parameters.put("direccion", direccion); + + + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + parameters.put("flagAgencia", flagAgencia); + parameters.put("flagArmas", flagArmas); + parameters.put("flagDoc", flagDoc); + parameters.put("flagGuardias", flagGuardias); + parameters.put("flagRequisitos", flagRequisitos); + parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("codResponsable", this.responsableCentroControl.getPk().getPersoncode()); + parameters.put("usuario",user.getName()); + String format = "pdf"; + InputStream pdf=this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + return pdf; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + return null; + } + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController direccion = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres= direccion.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + this.centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + //Reponsable + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + return setInstitucionCentroControl(CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + + + + } + + /** + * Ejecuta reporte general de informacion de armas, guardias, agencias y sucursales + * @param name Nombre del reporte a generar. + */ + + public InputStream reporteCertificados(String solicitud,boolean flagAgencia,boolean flagArmas,boolean flagDoc,boolean flagGuardias) { + try { + String gradoUsuario =""; + String path = "armas/reports/reporteCertificado"; + String filename="reporteCertificado"; + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail user = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if(grado != null){ + gradoUsuario = grado.getDescription()+" - "+this.responsableCentroControl.getName(); + }else{ + gradoUsuario = "Sin Grado - "+this.responsableCentroControl.getName(); + } + + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("csolicitud", solicitud); + //Obteniendo la solicitud + TarmSolicitud s=SolicitudController.findSolicitudxcodsolicitud(solicitudflujo); + //Obteniendo la direccion + String email=" ",direccion=" "; + List direcciones=PersonAddressController.findAllByPersonCode(s.getPersoncode().toString()); + for (TcustPersonAddress d : direcciones) { + Calendar calendario=Calendar.getInstance(); + calendario.setTime(d.getPk().getDateto()); + if(calendario.get(Calendar.YEAR)==2999){ + if(d.getAddresstypecatalog().equalsIgnoreCase("3")){ + email=d.getAddress(); + }else if(d.getAddresstypecatalog().equalsIgnoreCase("1")){ + direccion=d.getAddress(); + } + } + } + + //Email + parameters.put("email", email); + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + parameters.put("flagAgencia", flagAgencia); + parameters.put("flagArmas", flagArmas); + parameters.put("flagDoc", flagDoc); + parameters.put("flagGuardias", flagGuardias); + parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("usuario",user.getName()); + parameters.put("codResponsable", this.responsableCentroControl.getPk().getPersoncode()); + String format = "pdf"; + //this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + InputStream pdf=this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + return pdf; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + return null; + } + + public List getLdocumentos() { + return ldocumentos; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + public void setLdocumentos(List ldocumentos) { + this.ldocumentos = ldocumentos; + } + + public String getIdentificacion() { + return identificacion; + } + + public void setIdentificacion(String identificacion) { + this.identificacion = identificacion; + } + + public String getTipoidentificacion() { + return tipoidentificacion; + } + + public void setTipoidentificacion(String tipoidentificacion) { + this.tipoidentificacion = tipoidentificacion; + } + + TarmTramite getFila() { + return fila; + } + + public void setFila(TarmTramite fila) { + this.fila = fila; + } + + + + public String getFormato() { + return formato; + } + + public void setFormato(String formato) { + this.formato = formato; + } + + public String getMostrarFormato() { + return mostrarFormato; + } + + public void setMostrarFormato(String mostrarFormato) { + this.mostrarFormato = mostrarFormato; + } + + public String getTramiteflujo() { + return tramiteflujo; + } + + public void setTramiteflujo(String tramiteflujo) { + this.tramiteflujo = tramiteflujo; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public String setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + return institucionCentroControl; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public DocumentoHabilitanteController getDocumentoHabilitanteController() { + return documentoHabilitanteController; + } + + public void setDocumentoHabilitanteController( + DocumentoHabilitanteController documentoHabilitanteController) { + this.documentoHabilitanteController = documentoHabilitanteController; + } + + public PersonAddressController getPesonAddressController() { + return pesonAddressController; + } + + public void setPesonAddressController( + PersonAddressController pesonAddressController) { + this.pesonAddressController = pesonAddressController; + } + + public SolicitudController getSolicitudController() { + return solicitudController; + } + + public void setSolicitudController(SolicitudController solicitudController) { + this.solicitudController = solicitudController; + } + + public String getNumeroSolicitud() { + return numeroSolicitud; + } + + public void setNumeroSolicitud(String numeroSolicitud) { + this.numeroSolicitud = numeroSolicitud; + } + + + + + +} + diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DocumentoHabilitanteController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DocumentoHabilitanteController.java.svn-base new file mode 100644 index 0000000..99f03dc --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DocumentoHabilitanteController.java.svn-base @@ -0,0 +1,1456 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.event.AjaxBehaviorEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.IngresoDatosTipoTramite; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Controlador que maneja los documentos habilitantes del sistema + * @author dcruz + *O + */ +@ManagedBean +@ViewScoped +public class DocumentoHabilitanteController extends + AbstractController { + + private static final long serialVersionUID = 1L; + + Date fechaInicio, fechaFin; + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddressController; + + public DocumentoHabilitanteController() throws Exception{ + super(TarmDocumentoHabilitante.class); + } + + @PostConstruct + public void postConstruct() { + this.init(); + super.startQuery(); + } + + private void init(){ + this.beanalias = "DOCUMENTOHABILITANTE"; + this.recperpage = 15; + this.lrecord = new ArrayList<>(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + SubQuery subqueryCategoriaCodigo= new SubQuery("TgeneCatalogDetail", "description", "description", "i.pk.catalog = (select a.tipotramite from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.tipotramitecodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryCategoriaCodigo); + SubQuery subqueryTipocodigo=new SubQuery("TgeneCatalogDetail", "description", "descriptiontram", "i.pk.catalog = (select a.categoria from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.categoriacodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryTipocodigo); + SubQuery subqueryUsocodigo=new SubQuery("TgeneCatalogDetail", "description", "descriptionact", "i.pk.catalog = (select a.usoactividad from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.usoactividadcodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryUsocodigo); + + SubQuery subqueryEstadoDoc=new SubQuery("TgeneCatalogDetail", "description", "estadodocumento", "i.pk.catalog = t.estado" + + " and i.pk.catalogcode= t.estadocode"); + dto.addSubQuery(subqueryEstadoDoc); + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(lrecord!=null && !lrecord.isEmpty()){ + for (TarmDocumentoHabilitante doc : lrecord) { + doc.put("seleccionado", Boolean.FALSE); + TarmArmas tarmArma = new TarmArmas(); + tarmArma = ArmasController.find(doc.getCarma(), null); + doc.modifiedData().put("carma",tarmArma==null?"":tarmArma.getPk()); + doc.modifiedData().put("clase", tarmArma==null || tarmArma.getModifiedData().get("clase")==null?"":tarmArma.getModifiedData().get("clase")); + doc.modifiedData().put("tipo", tarmArma==null || tarmArma.getModifiedData().get("tipo")==null ?"":tarmArma.getModifiedData().get("tipo")); + doc.modifiedData().put("seriecanon",tarmArma==null || tarmArma.getSeriecanon()==null || tarmArma.getSeriecanon().isEmpty()?"":tarmArma.getSeriecanon()); + doc.modifiedData().put("calibre", tarmArma==null || tarmArma.getModifiedData().get("calibre")==null?"":Utilidades.formatearDecimalesEnTexto(tarmArma.getModifiedData().get("calibre").toString(), "#.000")); + doc.modifiedData().put("marca", tarmArma==null || tarmArma.getModifiedData().get("marca")==null?"":tarmArma.getModifiedData().get("marca")); + doc.modifiedData().put("estado", tarmArma==null || tarmArma.getEstado()==null || tarmArma.getEstado().isEmpty() || tarmArma.getEstadocodigo()==null || tarmArma.getEstadocodigo().isEmpty()?"":CatalogDetailController.findxCodigoCodcatalogo( tarmArma.getEstado(), tarmArma.getEstadocodigo()).getDescription()); + } + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Query para filtro por ciertos registros de codigo de tramites + * @param listadosTramites + */ + protected void querydatabaseDocumentosCriterioFiltro(List listadosTramites, Boolean validarCaducidadBln, String codigopersona) { + try { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + java.util.Date fechaActual = new java.util.Date(); + Filter filtroDocumento = new Filter(); + StringBuffer bufferQuery = new StringBuffer(); + SimpleDateFormat formato= new SimpleDateFormat("yyyy-MM-dd"); + bufferQuery.append("("); + if(validarCaducidadBln){ + bufferQuery.append("t.fechaexpiracion >= " + "TO_DATE('" + + formato.format(fechaActual)+ "','yyyy-MM-dd') and "); + } + int count=0; + bufferQuery.append("t.personcode = " + codigopersona); + bufferQuery.append(" and t.ctramite in ("); + for(TarmTramite tramite:listadosTramites){ + count++; + bufferQuery.append(tramite.getPk()); + if(count <= listadosTramites.size()-1){ + bufferQuery.append(","); + } + } + bufferQuery.append(")"); + bufferQuery.append(" and t.estado = 'APR'"); + bufferQuery.append(")"); + + filtroDocumento.setSql(bufferQuery.toString()); + dto.addFiltro(filtroDocumento); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(lrecord!=null && !lrecord.isEmpty()){ + for (TarmDocumentoHabilitante doc : lrecord) { + doc.put("seleccionado", Boolean.FALSE); + TarmArmas tarmArma = new TarmArmas(); + tarmArma = ArmasController.find(doc.getCarma(), null); + doc.modifiedData().put("carma",tarmArma==null?"":tarmArma.getCodigoarma()); + doc.modifiedData().put("clase", tarmArma==null || tarmArma.getModifiedData().get("clase")==null?"":tarmArma.getModifiedData().get("clase")); + doc.modifiedData().put("tipo", tarmArma==null || tarmArma.getModifiedData().get("tipo")==null ?"":tarmArma.getModifiedData().get("tipo")); + doc.modifiedData().put("seriecanon",tarmArma==null || tarmArma.getSeriecanon()==null || tarmArma.getSeriecanon().isEmpty()?"":tarmArma.getSeriecanon()); + doc.modifiedData().put("calibre", tarmArma==null || tarmArma.getModifiedData().get("calibre")==null?"":Utilidades.formatearDecimalesEnTexto(tarmArma.getModifiedData().get("calibre").toString(), "#.000")); + doc.modifiedData().put("marca", tarmArma==null || tarmArma.getModifiedData().get("marca")==null?"":tarmArma.getModifiedData().get("marca")); + doc.modifiedData().put("estado", tarmArma==null || tarmArma.getEstado()==null || tarmArma.getEstado().isEmpty() || tarmArma.getEstadocodigo()==null || tarmArma.getEstadocodigo().isEmpty()?"":CatalogDetailController.findxCodigoCodcatalogo( tarmArma.getEstado(), tarmArma.getEstadocodigo()).getDescription()); + } + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + protected void documentosXPersona(Integer codigoPersona) throws Exception { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + + java.util.Date fechaActual = new java.util.Date(); + //Filter fechaFiltro= new Filter(); + SimpleDateFormat formato= new SimpleDateFormat("yyyy-MM-dd"); + + Filter fechaEstadoFiltro= new Filter(); + StringBuffer bufferQuery = new StringBuffer(); + int count=0; + bufferQuery.append("t.estado = 'APR' and" + + " t.personcode = '" + codigoPersona.toString() + "' and trunc(t.fechaexpiracion) >= " + "TO_DATE('" + formato.format(fechaActual)+ "','yyyy-MM-dd')"); + + fechaEstadoFiltro.setSql(bufferQuery.toString()); + dto.addFiltro(fechaEstadoFiltro); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp; + try { + try { + resp = callerhelper.executeQuery(request); + } catch (Throwable e) { + // TODO Auto-generated catch block + throw new Exception(); + } + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + //MessageHelper.setMessageError(resp); + throw new Exception(); + } else { + lrecord = (List) resp.get(beanalias); + if(lrecord!=null && !lrecord.isEmpty()){ + for (TarmDocumentoHabilitante doc : lrecord) { + doc.put("seleccionado", Boolean.FALSE); + TarmArmas tarmArma = new TarmArmas(); + tarmArma = ArmasController.find(doc.getCarma(), null); + doc.modifiedData().put("carma",tarmArma==null?"":tarmArma.getCodigoarma()); + doc.modifiedData().put("clase", tarmArma==null || tarmArma.getModifiedData().get("clase")==null?"":tarmArma.getModifiedData().get("clase")); + doc.modifiedData().put("tipo", tarmArma==null || tarmArma.getModifiedData().get("tipo")==null ?"":tarmArma.getModifiedData().get("tipo")); + doc.modifiedData().put("lote",tarmArma==null || tarmArma.getLote()==null || tarmArma.getLote().isEmpty()?"":tarmArma.getLote()); + doc.modifiedData().put("calibre", tarmArma==null || tarmArma.getModifiedData().get("calibre")==null?"":Utilidades.formatearDecimalesEnTexto(tarmArma.getModifiedData().get("calibre").toString(), "#.00")); + doc.modifiedData().put("marca", tarmArma==null || tarmArma.getModifiedData().get("marca")==null?"":tarmArma.getModifiedData().get("marca")); + doc.modifiedData().put("estado", tarmArma==null || tarmArma.getEstado()==null || tarmArma.getEstado().isEmpty() || tarmArma.getEstadocodigo()==null || tarmArma.getEstadocodigo().isEmpty()?"":CatalogDetailController.findxCodigoCodcatalogo( tarmArma.getEstado(), tarmArma.getEstadocodigo()).getDescription()); + + TarmTramite tramiteDocumento = IngresoDatosTipoTramite.find(doc.getCtramite().toString()); + if(tramiteDocumento!=null){ + doc.modifiedData().put("destipoTramite", tramiteDocumento.getModifiedData().get("destipoTramite")!=null?tramiteDocumento.getModifiedData().get("destipoTramite").toString():null); + doc.modifiedData().put("destipoAutorizacion", tramiteDocumento.getModifiedData().get("destipoAutorizacion")!=null?tramiteDocumento.getModifiedData().get("destipoAutorizacion").toString():null); + doc.modifiedData().put("descategoria", tramiteDocumento.getModifiedData().get("descategoria")!=null?tramiteDocumento.getModifiedData().get("descategoria").toString():null); + doc.modifiedData().put("desusoactividad", tramiteDocumento.getModifiedData().get("desusoactividad")!=null?tramiteDocumento.getModifiedData().get("desusoactividad").toString():null); + } + else{ + doc.modifiedData().put("destipoTramite", null); + doc.modifiedData().put("destipoAutorizacion", null); + doc.modifiedData().put("descategoria", null); + doc.modifiedData().put("desusoactividad", null); + } + } + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Exception e) { + // TODO Auto-generated catch block + throw new Exception(); + } +} + + + protected void documentosXTramite(List listadoTramites, Integer codigoPersona) throws Exception { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + + java.util.Date fechaActual = new java.util.Date(); + //Filter fechaFiltro= new Filter(); + SimpleDateFormat formato= new SimpleDateFormat("yyyy-MM-dd"); + + Filter tramitesFiltro= new Filter(); + StringBuffer bufferQuery = new StringBuffer(); + int count=0; + bufferQuery.append("("); + if(listadoTramites!=null){ + for(TarmTramite tramite:listadoTramites){ + count++; + bufferQuery.append("(t.ctramite = " + tramite.getPk() +") "); + if(count <= listadoTramites.size()-1){ + bufferQuery.append(" or "); + } + } + } + bufferQuery.append(") and t.estado = 'APR' and" + + " t.personcode = '" + codigoPersona.toString() + "' and trunc(t.fechaexpiracion) >= " + "TO_DATE('" + formato.format(fechaActual)+ "','yyyy-MM-dd')"); + + tramitesFiltro.setSql(bufferQuery.toString()); + dto.addFiltro(tramitesFiltro); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp; + try { + try { + resp = callerhelper.executeQuery(request); + } catch (Throwable e) { + // TODO Auto-generated catch block + throw new Exception(); + } + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + //MessageHelper.setMessageError(resp); + throw new Exception(); + } else { + lrecord = (List) resp.get(beanalias); + if(lrecord!=null && !lrecord.isEmpty()){ + for (TarmDocumentoHabilitante doc : lrecord) { + doc.put("seleccionado", Boolean.FALSE); + TarmArmas tarmArma = new TarmArmas(); + tarmArma = ArmasController.find(doc.getCarma(), null); + doc.modifiedData().put("carma",tarmArma==null?"":tarmArma.getCodigoarma()); + doc.modifiedData().put("clase", tarmArma==null || tarmArma.getModifiedData().get("clase")==null?"":tarmArma.getModifiedData().get("clase")); + doc.modifiedData().put("tipo", tarmArma==null || tarmArma.getModifiedData().get("tipo")==null ?"":tarmArma.getModifiedData().get("tipo")); + doc.modifiedData().put("lote",tarmArma==null || tarmArma.getLote()==null || tarmArma.getLote().isEmpty()?"":tarmArma.getLote()); + doc.modifiedData().put("calibre", tarmArma==null || tarmArma.getModifiedData().get("calibre")==null?"":Utilidades.formatearDecimalesEnTexto(tarmArma.getModifiedData().get("calibre").toString(), "#.00")); + doc.modifiedData().put("marca", tarmArma==null || tarmArma.getModifiedData().get("marca")==null?"":tarmArma.getModifiedData().get("marca")); + doc.modifiedData().put("estado", tarmArma==null || tarmArma.getEstado()==null || tarmArma.getEstado().isEmpty() || tarmArma.getEstadocodigo()==null || tarmArma.getEstadocodigo().isEmpty()?"":CatalogDetailController.findxCodigoCodcatalogo( tarmArma.getEstado(), tarmArma.getEstadocodigo()).getDescription()); + + TarmTramite tramiteDocumento = IngresoDatosTipoTramite.find(doc.getCtramite().toString()); + if(tramiteDocumento!=null){ + doc.modifiedData().put("destipoTramite", tramiteDocumento.getModifiedData().get("destipoTramite")!=null?tramiteDocumento.getModifiedData().get("destipoTramite").toString():null); + doc.modifiedData().put("destipoAutorizacion", tramiteDocumento.getModifiedData().get("destipoAutorizacion")!=null?tramiteDocumento.getModifiedData().get("destipoAutorizacion").toString():null); + doc.modifiedData().put("descategoria", tramiteDocumento.getModifiedData().get("descategoria")!=null?tramiteDocumento.getModifiedData().get("descategoria").toString():null); + doc.modifiedData().put("desusoactividad", tramiteDocumento.getModifiedData().get("desusoactividad")!=null?tramiteDocumento.getModifiedData().get("desusoactividad").toString():null); + } + else{ + doc.modifiedData().put("destipoTramite", null); + doc.modifiedData().put("destipoAutorizacion", null); + doc.modifiedData().put("descategoria", null); + doc.modifiedData().put("desusoactividad", null); + } + } + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Exception e) { + // TODO Auto-generated catch block + throw new Exception(); + } +} + + /** + * Query para filtro por ciertos registros de codigo de tramites + * @param listadoSolicitudes + * @throws Exception + * @throws Throwable + */ + protected void querydatabaseDocumentosCriterioFiltro(List listadoSolicitudes, Integer codigoPersona) throws Exception { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + java.util.Date fechaActual = new java.util.Date(); + //Filter fechaFiltro= new Filter(); + SimpleDateFormat formato= new SimpleDateFormat("yyyy-MM-dd"); + + Filter tramitesFiltro= new Filter(); + StringBuffer bufferQuery = new StringBuffer(); + int count=0; + bufferQuery.append("("); + if(listadoSolicitudes!=null){ + for(TarmSolicitud solicitud:listadoSolicitudes){ + count++; + bufferQuery.append("(t.ctramite = " + solicitud.getCtramite() + " and t.csolicitud = " + solicitud.getPk() + ") "); + if(count <= listadoSolicitudes.size()-1){ + bufferQuery.append(" or "); + } + } + } + bufferQuery.append(") and t.estado = 'APR' and" + + " t.personcode = '" + codigoPersona.toString() + "' and trunc(t.fechaexpiracion) >= " + "TO_DATE('" + + formato.format(fechaActual)+ "','yyyy-MM-dd')"); + + tramitesFiltro.setSql(bufferQuery.toString()); + dto.addFiltro(tramitesFiltro); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp; + try { + try { + resp = callerhelper.executeQuery(request); + } catch (Throwable e) { + // TODO Auto-generated catch block + throw new Exception(); + } + + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + //MessageHelper.setMessageError(resp); + throw new Exception(); + } else { + lrecord = (List) resp.get(beanalias); + if(lrecord!=null && !lrecord.isEmpty()){ + for (TarmDocumentoHabilitante doc : lrecord) { + doc.put("seleccionado", Boolean.FALSE); + TarmArmas tarmArma = new TarmArmas(); + tarmArma = ArmasController.find(doc.getCarma(), null); + doc.modifiedData().put("carma",tarmArma==null?"":tarmArma.getCodigoarma()); + doc.modifiedData().put("clase", tarmArma==null || tarmArma.getModifiedData().get("clase")==null?"":tarmArma.getModifiedData().get("clase")); + doc.modifiedData().put("tipo", tarmArma==null || tarmArma.getModifiedData().get("tipo")==null ?"":tarmArma.getModifiedData().get("tipo")); + doc.modifiedData().put("seriecanon",tarmArma==null || tarmArma.getSeriecanon()==null || tarmArma.getSeriecanon().isEmpty()?"":tarmArma.getSeriecanon()); + doc.modifiedData().put("calibre", tarmArma==null || tarmArma.getModifiedData().get("calibre")==null?"":Utilidades.formatearDecimalesEnTexto(tarmArma.getModifiedData().get("calibre").toString(), "#.00")); + doc.modifiedData().put("marca", tarmArma==null || tarmArma.getModifiedData().get("marca")==null?"":tarmArma.getModifiedData().get("marca")); + doc.modifiedData().put("estado", tarmArma==null || tarmArma.getEstado()==null || tarmArma.getEstado().isEmpty() || tarmArma.getEstadocodigo()==null || tarmArma.getEstadocodigo().isEmpty()?"":CatalogDetailController.findxCodigoCodcatalogo( tarmArma.getEstado(), tarmArma.getEstadocodigo()).getDescription()); + } + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Exception e) { + // TODO Auto-generated catch block + throw new Exception(); + } + + } + + + @SuppressWarnings("unchecked") + protected void querybase() { + try { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + dto.setOrderby("t.fechaemision"); + + if(getMfilelds().get("auxfiltro")!=null){ + Filter filtro= new Filter(); + filtro.setSql(getMfilelds().get("auxfiltro").toString());//"t.ctramite in (Select ctramite from tarmtramite where tipoautorizacion='1'"); + dto.addFiltro(filtro); + } + + if(getMfilelds().get("fechafiltro")!=null){ + Filter filtrofecha=new Filter(); + filtrofecha.setSql(getMfilelds().get("fechafiltro").toString()); + dto.addFiltro(filtrofecha); + } + + if(getMfilelds().get("numdocumentoshabilitante")!=null){ + Filter filtrodoc=new Filter(); + filtrodoc.setSql(getMfilelds().get("numdocumentoshabilitante").toString()); + dto.addFiltro(filtrodoc); + } + + SubQuery subQuerytipotramite= new SubQuery("TarmTramite","tipotramite","tipotramite","i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipotramite); + + SubQuery subQuerytipotramitecodigo= new SubQuery("TarmTramite","tipotramitecodigo","tipotramitecodigo","i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipotramitecodigo); + + SubQuery subQuerytipoautorizacion= new SubQuery("TarmTramite","tipoautorizacion","tipoautorizacion","i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipoautorizacion); + + SubQuery subQuerytipoautorizacioncodigo= new SubQuery("TarmTramite","tipoautorizacioncodigo","tipoautorizacioncodigo","i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipoautorizacioncodigo); + + SubQuery subQuerycategoria= new SubQuery("TarmTramite","categoria","categoria","i.pk=t.ctramite"); + dto.addSubQuery(subQuerycategoria); + + SubQuery subQuerycategoriacodigo= new SubQuery("TarmTramite","categoriacodigo","categoriacodigo","i.pk=t.ctramite"); + dto.addSubQuery(subQuerycategoriacodigo); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + + + lrecord = (List) resp.get(beanalias); + if(lrecord!=null && !lrecord.isEmpty()){ + + record=lrecord.get(0); + } + super.postQuery(lrecord); + + + + for(int i=0;i< this.lrecord.size();i++){ + + try{ + TgeneCatalogDetail tipotramite=CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("tipotramite").toString(),this.lrecord.get(i).getModifiedData().get("tipotramitecodigo").toString() ); + this.lrecord.get(i).getModifiedData().put("tipotramitedesc", tipotramite.getDescription()); + } + catch(Exception e){ + e.printStackTrace(); + } + try{ + TgeneCatalogDetail tipo = CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("tipoautorizacion").toString(), this.lrecord.get(i).getModifiedData().get("tipoautorizacioncodigo").toString()); + this.lrecord.get(i).getModifiedData().put("tipoautorizacioncodigodesc", tipo.getDescription()); + + } + + catch(Exception e){ + e.printStackTrace(); + } + try{ + TgeneCatalogDetail tipo = CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("categoria").toString(), this.lrecord.get(i).getModifiedData().get("categoriacodigo").toString()); + this.lrecord.get(i).getModifiedData().put("categoriacodigodesc", tipo.getDescription()); + + } + + catch(Exception e){ + e.printStackTrace(); + } + } + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + protected void querydatabaseInspeccion2(Date fechaInicio, Date fechaFin,TarmCentroControl centroControl){ + try { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + dto.setOrderby("fechaexpiracion"); + + //Nombre/Razon social + SubQuery subqueryNombre= new SubQuery("TcustPersonDetail","name", "nombre", "i.pk.personcode=t.personcode and i.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryNombre); + SubQuery subqueryNDocumento= new SubQuery("TcustPersonDetail","identification","nodocumento","i.pk.personcode=t.personcode and i.pk.dateto= to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryNDocumento); + //datos del tramite + //Tipo de tramite + SubQuery subqueryTipoTramite= new SubQuery("TgeneCatalogDetail","description","tipotramite","i.pk.catalog= (select o.tipotramite from TarmTramite o where o.pk=t.ctramite) and" + + " i.pk.catalogcode=(select o.tipotramitecodigo from TarmTramite o where o.pk=t.ctramite)"); + dto.addSubQuery(subqueryTipoTramite); + SubQuery subqueryTramite= new SubQuery("TgeneCatalogDetail","description","tipoautorizacion","i.pk.catalog= (select o.tipoautorizacion from TarmTramite o where o.pk=t.ctramite) and" + + " i.pk.catalogcode=(select o.tipoautorizacioncodigo from TarmTramite o where o.pk=t.ctramite) "); + dto.addSubQuery(subqueryTramite); + //Uso/Actividad + SubQuery subqueryUsoActividad= new SubQuery("TgeneCatalogDetail","description","usoactividad","i.pk.catalog= (select o.usoactividad from TarmTramite o where o.pk=t.ctramite) and" + + " i.pk.catalogcode=(select o.usoactividadcodigo from TarmTramite o where o.pk=t.ctramite)"); + dto.addSubQuery(subqueryUsoActividad); + //Categoria + SubQuery subqueryCategoria= new SubQuery("TgeneCatalogDetail","description","categoria","i.pk.catalog= (select o.categoria from TarmTramite o where o.pk=t.ctramite) and" + + " i.pk.catalogcode=(select o.categoriacodigo from TarmTramite o where o.pk=t.ctramite)"); + dto.addSubQuery(subqueryCategoria); + + SubQuery subqueryCodTramite=new SubQuery("TarmTramite", "pk", "ctramite", "i.pk= t.ctramite"); + dto.addSubQuery(subqueryCodTramite); + + //Filtros de fecha inicio y fin + if(fechaInicio!=null){ + //dto.addFiltro(new Filter("fechaexpiracion", ">=", fechaInicio.toString())); + //dto.addFiltro(new Filter("fechaexpiracion", "<", this.fechaFin.toString())); + Filter filtro= new Filter(); + filtro.setSql( + //+ "t.fechaexpiracion>=TO_DATE('" + dateFormat.format(fechaInicio)+ "','yyyy-MM-dd')" + "TRUNC(t.fechaexpiracion)<=TO_DATE('" + dateFormat.format(fechaFin)+ "','yyyy-MM-dd')" + + " and t.ctramite in (select o.pk from TarmTramite o where o.tipoautorizacion = '1' and o.requiereinspeccion = 'Y') " + +" and t.centrocontrol ='" + centroControl.getPk() + "'" + //+ " and t.csolicitud in (select q.pk from TarmSolicitud q where q.ccentrocontrol = '" + centroControl.getPk() + "' )" + + " and t.estado = 'APR'"); + + dto.addFiltro(filtro); + } + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(lrecord!=null && !lrecord.isEmpty()){ + for (TarmDocumentoHabilitante doc : lrecord) { + doc.put("seleccionado", Boolean.FALSE); + } + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + //Anteriormente se usaba para consultar actualmente ya no + protected void querydatabaseInspeccion() { + try { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + dto.setOrderby("fechaexpiracion"); + + //Nombre/Razon social + //SubQuery subqueryNombre= new SubQuery("TcustPersonDetail","name","nombre","i.pk.personcode=t.personcode"); + //dto.addSubQuery(subqueryNombre); + + //Filtros de fecha inicio y fin + if(this.fechaInicio!=null){ + dto.addFiltro(new Filter("fechaexpiracion", ">=", this.fechaInicio.toString())); + //dto.addFiltro(new Filter("fechaexpiracion", "<", this.fechaFin.toString())); + } + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(lrecord!=null && !lrecord.isEmpty()){ + for (TarmDocumentoHabilitante doc : lrecord) { + doc.put("seleccionado", Boolean.FALSE); + } + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Metodo para guardar el documento habilitante + * @throws Throwable + */ + public void saveDocumentoHabilitante() throws Throwable { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } + + /** + * Devueleve el tipo de tramite de un documento + * @param documento + * @return + */ + public String tipoTramite(TarmDocumentoHabilitante documento){ + String tipo=""; + try { + //Obteniendo la solicitud + TarmSolicitud solicitud= ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(documento.getCsolicitud()); + + if(solicitud!=null){ + TarmTramite tramite=TarmTramiteController.find(solicitud.getCtramite().toString()); + if(tramite!=null && tramite.getTipotramite()!=null && !tramite.getTipotramite().isEmpty() + && tramite.getTipotramitecodigo()!=null && !tramite.getTipotramitecodigo().isEmpty()){ + TgeneCatalogDetail catalogoTipoTramite= CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + if(catalogoTipoTramite!=null){ + tipo=catalogoTipoTramite.getDescription(); + } + } + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + return tipo; + } + + public String tramite(TarmDocumentoHabilitante documento) { + String tipo=""; + try { + //Obteniendo la solicitud + TarmSolicitud solicitud= ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(documento.getCsolicitud()); + + if(solicitud!=null){ + TarmTramite tramite=TarmTramiteController.find(solicitud.getCtramite().toString()); + if(tramite!=null && tramite.getTipoautorizacion()!=null && !tramite.getTipoautorizacion().isEmpty() + && tramite.getTipoautorizacioncodigo()!=null && !tramite.getTipoautorizacioncodigo().isEmpty()){ + TgeneCatalogDetail catalogoTramite= CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + if(catalogoTramite!=null){ + tipo=catalogoTramite.getDescription(); + } + } + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + return tipo; + } + + /** + * Devueleve la categoria de un documento + * @param documento + * @return + */ + public String categoria(TarmDocumentoHabilitante documento){ + String categoria=""; + try { + //Obteniendo la solicitud + TarmSolicitud solicitud= ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(documento.getCsolicitud()); + + if(solicitud!=null){ + TarmTramite tramite=TarmTramiteController.find(solicitud.getCtramite().toString()); + if(tramite!=null && tramite.getCategoria()!=null && !tramite.getCategoria().isEmpty() + && tramite.getCategoriacodigo()!=null && !tramite.getCategoriacodigo().isEmpty()){ + TgeneCatalogDetail catalogoCategoria= CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + if(catalogoCategoria!=null){ + categoria=catalogoCategoria.getDescription(); + } + } + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + return categoria; + } + + public static List findInspeccionesGenerar(Date fechaInicio, Date fechaFin, TarmCentroControl centroControl) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 300000; + //cc.addFilter("personcode", personcode); + cc.querydatabaseInspeccion2(fechaInicio,fechaFin,centroControl); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findDocumentosDelTramite(String personcode, String filtro) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 3000; + cc.addFilter("personcode", personcode); + cc.getMfilelds().put("auxfiltro",filtro); + cc.querybase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findPorPersoncode(String personcode) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 3000; + cc.addFilter("personcode", personcode); + cc.querybase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * buscar el permiso de coumento habilitante por arma + * @return + */ + public static TarmDocumentoHabilitante findxarma( String codigoarma, String personcode){ + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 30; + cc.addFilter("codigoarma", codigoarma); + cc.addFilter("personcode", personcode); + cc.querybase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + public static List findPorPersoncodeaut(String personcode) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 30; + cc.addFilter("personcode", personcode); + cc.addFilter("estado", "APR"); + cc.getMfilelds().put("auxfiltro", "t.ctramite in (Select ta.pk from com.fp.persistence.parmas.param.TarmTramite ta where ta.tipoautorizacion='1') and" + +" ctramite in (select o from TarmTramite o where o.sancionable is not null and o.sancionable='Y') ");//tramite que sean sancionables + cc.getMfilelds().put("fechafiltro", "t.fechaemision = (Select max(ta.fechaemision) from com.fp.persistence.parmas.soli.TarmDocumentoHabilitante ta where t.ctramite=ta.ctramite and t.personcode=ta.personcode )"); + cc.querybase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + public static List findXSolicitudNueva(String csolicitud) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 30; + cc.getMfilelds().put("numdocumentoshabilitante", "t.pk in (Select sd.pk.cdocumento from com.fp.persistence.parmas.soli.TarmSolicitud s, com.fp.persistence.parmas.soli.TarmSolicitudDocumento sd where s.pk = sd.pk.csolicitud and s.pk = '"+csolicitud+"')"); + cc.querybase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Devueleve la categoria de un documento + * @param documento + * @return + */ + public String usoActividad(TarmDocumentoHabilitante documento){ + String usoActividad=""; + try { + //Obteniendo la solicitud + TarmSolicitud solicitud= ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(documento.getCsolicitud()); + + if(solicitud!=null){ + TarmTramite tramite=TarmTramiteController.find(solicitud.getCtramite().toString()); + if(tramite!=null && tramite.getUsoactividad()!=null && !tramite.getUsoactividad().isEmpty() + && tramite.getUsoactividadcodigo()!=null && !tramite.getUsoactividadcodigo().isEmpty()){ + TgeneCatalogDetail catalogoUso= CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + if(catalogoUso!=null){ + usoActividad=catalogoUso.getDescription(); + } + } + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + return usoActividad; + } + + /** + * Devueleve la ubicacion de un documento + * @param documento + * @return + */ + public String ubicacion(TarmDocumentoHabilitante documento){ + String ubicacion=""; + try { + TcustPersonDetail detallesPersona=PersonDetailController.find(documento.getPersoncode().toString()); + + if(detallesPersona!=null){ + personAddressController.findPrincipal(String.valueOf(documento.getPersoncode())) ; + + if(personAddressController.getLrecord().get(0).getProvincecode()!=null && !personAddressController.getLrecord().get(0).getProvincecode().isEmpty()){ + + List provinceList = ProvinceController.findPorCodigo("EC", personAddressController.getLrecord().get(0).getProvincecode()); + ubicacion = provinceList.get(0).getDescription(); + } + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + return ubicacion; + } + + + /** + * Devuelve el estado de un documento habilitante + * @param documento documento + * @return estado + */ + public String estado(TarmDocumentoHabilitante documento){ + TgeneCatalogDetail estado = new TgeneCatalogDetail(); + try { + if(documento==null){ + return ""; + } + estado = CatalogDetailController.findxCodigoCodcatalogo(documento.getEstado(),documento.getEstadocode()); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + return estado.getDescription(); + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if(Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")){ + valorColocar = Boolean.TRUE; + } + for (TarmDocumentoHabilitante documentoHabilitante : lrecord) { + documentoHabilitante.getModifiedData().put("seleccionado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodod que devuelve un documento habilitante por el codigo de solicitud + * @param codigoSolicitud + * @return + */ + public static TarmDocumentoHabilitante findPorSolicitud(String codigoSolicitud) { + try { + if(codigoSolicitud==null || codigoSolicitud.isEmpty()){ + return null; + } + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("csolicitud", codigoSolicitud); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodod que devuelve un documento habilitante por el codigo de solicitud + * @param codigoSolicitud + * @return + */ + public static TarmDocumentoHabilitante findPorTramite(String codigoTramite) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("ctramite", codigoTramite); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodod que obtiene un documento habilitante por su codigo + * @param codigoSolicitud + * @return + */ + public static TarmDocumentoHabilitante findPorCodigo(String cdocumento) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", cdocumento); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Método que retorna el documento habilitante por id + * @param cdocumento + * @return + */ + public static TarmDocumentoHabilitante find(String cdocumento) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", cdocumento); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * buscar el permiso de coumento habilitante por arma + * @return + */ + public static TarmDocumentoHabilitante findxarma( String codigoarma){ + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("codigoarma", codigoarma); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Método que consulta de la entidad TarmDocumentoHabilitante por código de documento + */ + public static TarmDocumentoHabilitante findPorCDocumento(String cdocumento) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 15; + cc.addFilter("pk", cdocumento); + cc.querybase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findByPerson_Inventario(String personcode) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 30; + cc.addFilter("personcode", personcode); + cc.addFilter("estado", "APR"); + cc.getMfilelds().put("fechafiltro", "t.fechaexpiracion >=sysdate and" + + " ctramite in (select tra.pk from TarmTramite tra where tra.categoria in ('2','3','4','5','8','11') and tipoautorizacion='1')");//1 autorizacion + cc.querybasesimle(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findpersoncode(String personcode,String categoria) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 30; + cc.addFilter("personcode", personcode); + cc.addFilter("estado", "APR"); + if(categoria.equals("4")){ + cc.getMfilelds().put("fechafiltro", "t.fechaexpiracion >=sysdate and" + + " ctramite in (select tra.pk from TarmTramite tra where tra.categoria in ('2','3','4','5','8','11') and tipoautorizacion='1')");//1 autorizacion + } + else{ + cc.getMfilelds().put("fechafiltro", "t.fechaexpiracion >=to_date(sysdate,'dd/MM/yyyy') and" + + " ctramite in (select tra.pk from TarmTramite tra where tra.categoria='"+categoria+"' and tipoautorizacion='1')");//1 autorizacion + } + cc.querybasesimle(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + public static List findpersoncodeInventario(String personcode,String categoria) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 30; + cc.addFilter("personcode", personcode); + cc.addFilter("estado", "APR"); + if(categoria.equals("4")){ + cc.getMfilelds().put("fechafiltro", "ctramite in (select tra.pk from TarmTramite tra where tra.categoria in ('2','3','4','5','8','11') and tipoautorizacion='1')");//1 autorizacion + } + else{ + cc.getMfilelds().put("fechafiltro", "ctramite in (select tra.pk from TarmTramite tra where tra.categoria='"+categoria+"' and tipoautorizacion='1')");//1 autorizacion + } + cc.querybasesimle(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que busca los documentos habilitantes por persona para registro de produccion + * @param personcode + * @return List + */ + public static List findByPerson_Produccion(String personcode) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("personcode", personcode); + cc.addFilter("estado", "APR"); + + cc.getMfilelds().put("fechafiltro", "t.fechaexpiracion >=sysdate and" + + " ctramite in (select tra.pk from TarmTramite tra where tra.categoria in ('4','5') and tipoautorizacion='1')");//1 autorizacion + + cc.querybasesimle(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que busca los documentos habilitantes por persona para registro de importaciones + * @param personcode + * @return List + */ + public static List findByPerson_Importacion(String personcode) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("personcode", personcode); + cc.addFilter("estado", "APR"); + // FILTROS: tipoautorizacion='1' --> 1 AUTORIZACION + // FILTROS: tra.categoria='8' --> 8 IMPORTADOR + cc.getMfilelds().put("fechafiltro", "t.fechaexpiracion >=to_date(sysdate,'dd/MM/yyyy') and" + + " ctramite in (select tra.pk from TarmTramite tra where tra.categoria='8' and tipoautorizacion='1')"); + + cc.querybasesimle(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + @SuppressWarnings("unchecked") + protected void querybasesimle() { + try { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + dto.setOrderby("t.fechaemision"); + + if(getMfilelds().get("auxfiltro")!=null){ + Filter filtro= new Filter(); + filtro.setSql(getMfilelds().get("auxfiltro").toString());//"t.ctramite in (Select ctramite from tarmtramite where tipoautorizacion='1'"); + dto.addFiltro(filtro); + } + + if(getMfilelds().get("fechafiltro")!=null){ + Filter filtrofecha=new Filter(); + filtrofecha.setSql(getMfilelds().get("fechafiltro").toString()); + dto.addFiltro(filtrofecha); + } + + if(getMfilelds().get("numdocumentoshabilitante")!=null){ + Filter filtrodoc=new Filter(); + filtrodoc.setSql(getMfilelds().get("numdocumentoshabilitante").toString()); + dto.addFiltro(filtrodoc); + } + + SubQuery subqueryCategoriaCodigo= new SubQuery("TgeneCatalogDetail", "description", "description", "i.pk.catalog = (select a.tipotramite from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.tipotramitecodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryCategoriaCodigo); + SubQuery subqueryTipocodigo=new SubQuery("TgeneCatalogDetail", "description", "descriptiontram", "i.pk.catalog = (select a.categoria from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.categoriacodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryTipocodigo); + SubQuery subqueryUsocodigo=new SubQuery("TgeneCatalogDetail", "description", "descriptionact", "i.pk.catalog = (select a.usoactividad from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.usoactividadcodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryUsocodigo); + + SubQuery subQuerytipotramite= new SubQuery("TarmTramite","tipotramite","tipotramite","i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipotramite); + + SubQuery subQuerytipotramitecodigo= new SubQuery("TarmTramite","tipotramitecodigo","tipotramitecodigo","i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipotramitecodigo); + + SubQuery subQuerytipoautorizacion= new SubQuery("TarmTramite","tipoautorizacion","tipoautorizacion","i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipoautorizacion); + + SubQuery subQuerytipoautorizacioncodigo= new SubQuery("TarmTramite","tipoautorizacioncodigo","tipoautorizacioncodigo","i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipoautorizacioncodigo); + + SubQuery subQuerycategoria= new SubQuery("TarmTramite","categoria","categoria","i.pk=t.ctramite"); + dto.addSubQuery(subQuerycategoria); + + SubQuery subQuerycategoriacodigo= new SubQuery("TarmTramite","categoriacodigo","categoriacodigo","i.pk=t.ctramite"); + dto.addSubQuery(subQuerycategoriacodigo); + + SubQuery subQueryclase= new SubQuery("TarmTramite","clase","clase","i.pk=t.ctramite"); + dto.addSubQuery(subQueryclase); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + public static List findByPersonCode(Integer personcode) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 5000; + if(personcode!=null){ + cc.addFilter("personcode", personcode.toString()); + } + cc.getMfilelds().put("pathSuspencion", "t.pathSuspencion is not null"); + cc.querydocumhabsusp(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + @SuppressWarnings("unchecked") + protected void querydocumhabsusp() { + try { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + dto.setOrderby("t.fechaemision"); + + if(getMfilelds().get("pathSuspencion")!=null){ + Filter filtrodoc=new Filter(); + filtrodoc.setSql(getMfilelds().get("pathSuspencion").toString()); + dto.addFiltro(filtrodoc); + } + //Nombre/Razon social + SubQuery subqueryNombre= new SubQuery("TcustPersonDetail","name","nombre","i.pk.personcode=t.personcode and i.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryNombre); + SubQuery subqueryNDocumento= new SubQuery("TcustPersonDetail","identification","nodocumento","i.pk.personcode=t.personcode and i.pk.dateto= to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryNDocumento); + + SubQuery subqueryCategoriaCodigo= new SubQuery("TgeneCatalogDetail", "description", "description", "i.pk.catalog = (select a.tipotramite from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.tipotramitecodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryCategoriaCodigo); + SubQuery subqueryTipocodigo=new SubQuery("TgeneCatalogDetail", "description", "descriptiontram", "i.pk.catalog = (select a.categoria from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.categoriacodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryTipocodigo); + SubQuery subqueryUsocodigo=new SubQuery("TgeneCatalogDetail", "description", "descriptionact", "i.pk.catalog = (select a.usoactividad from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.usoactividadcodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryUsocodigo); + + SubQuery subQuerytipotramite= new SubQuery("TarmTramite","tipotramite","tipotramite","i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipotramite); + + SubQuery subQuerytipotramitecodigo= new SubQuery("TarmTramite","tipotramitecodigo","tipotramitecodigo","i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipotramitecodigo); + + SubQuery subQuerytipoautorizacion= new SubQuery("TarmTramite","tipoautorizacion","tipoautorizacion","i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipoautorizacion); + + SubQuery subQuerytipoautorizacioncodigo= new SubQuery("TarmTramite","tipoautorizacioncodigo","tipoautorizacioncodigo","i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipoautorizacioncodigo); + + SubQuery subQuerycategoria= new SubQuery("TarmTramite","categoria","categoria","i.pk=t.ctramite"); + dto.addSubQuery(subQuerycategoria); + + SubQuery subQuerycategoriacodigo= new SubQuery("TarmTramite","categoriacodigo","categoriacodigo","i.pk=t.ctramite"); + dto.addSubQuery(subQuerycategoriacodigo); + + SubQuery subQueryclase= new SubQuery("TarmTramite","clase","clase","i.pk=t.ctramite"); + dto.addSubQuery(subQueryclase); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + + public PersonAddressController getPersonAddressController() { + return personAddressController; + } + + public void setPersonAddressController( + PersonAddressController personAddressController) { + this.personAddressController = personAddressController; + } + + public Date getFechaInicio() { + return fechaInicio; + } + + public void setFechaInicio(Date fechaInicio) { + this.fechaInicio = fechaInicio; + } + + public Date getFechaFin() { + return fechaFin; + } + + public void setFechaFin(Date fechaFin) { + this.fechaFin = fechaFin; + } + + /** + * Valida que no se puedan seleccionar documentos de fecha emision anterior al sistema MAIA + * @param event + */ + public void validaNoSeleccionDocAnteriores(AjaxBehaviorEvent event) { + TarmDocumentoHabilitante documentoSeleccionado = this.getLrecord().get(Integer.parseInt(event.getComponent().getAttributes().get("documentoSeleccionado").toString())); + // FECHA 15 DE JUNIO DEL 2015 - PUESTA EN PRODUCCION + Calendar datePuestaProduccion = new GregorianCalendar(2015, 5, 15); //2015, 06, 15 + if(documentoSeleccionado.getFechaemision().before(datePuestaProduccion.getTime())){ + documentoSeleccionado.getModifiedData().put("seleccionado", Boolean.FALSE); + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_reimpresionprevianopermitida")); + } + } + + public void update(TarmDocumentoHabilitante bean) throws Exception { + record=bean; + super.update(); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DocumentoHabilitanteDetalleController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DocumentoHabilitanteDetalleController.java.svn-base new file mode 100644 index 0000000..5856a51 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/DocumentoHabilitanteDetalleController.java.svn-base @@ -0,0 +1,173 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitanteDetall; + + +/** + * @author Carlos Guzman + * + */ +@ManagedBean +@ViewScoped +public class DocumentoHabilitanteDetalleController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 8586936319898253550L; + + + public DocumentoHabilitanteDetalleController() throws Exception{ + super(TarmDocumentoHabilitanteDetall.class); + } + + @PostConstruct + public void postConstruct() { + this.init(); + super.startQuery(); + } + + private void init(){ + this.beanalias = "DOCUMENTOHABILITANTEDETAIL"; + this.recperpage = 15; + this.lrecord = new ArrayList<>(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Metodod que devuelve un documento habilitante detalle por el codigo de documento + * @param codigoDocumento + * @return + */ + public static TarmDocumentoHabilitanteDetall findPorCodigoDocumento(String codigoDocumento) { + try { + DocumentoHabilitanteDetalleController cc = new DocumentoHabilitanteDetalleController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("cdocumento", codigoDocumento); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + /** + * Metodod que devuelve un documento habilitante detalle por el codigo de documento + * @param codigoDocumento + * @return + */ + public static TarmDocumentoHabilitanteDetall findPorCDocumento(String cDocumento) { + try { + DocumentoHabilitanteDetalleController cc = new DocumentoHabilitanteDetalleController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("cdocumento", cDocumento); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodod que obtiene un documento habilitante por su codigo + * @param codigoSolicitud + * @return + */ + public static TarmDocumentoHabilitanteDetall findPorCodigo(String cdetalle) { + try { + DocumentoHabilitanteDetalleController cc = new DocumentoHabilitanteDetalleController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", cdetalle); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/EmitirDocumentoHabilitante.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/EmitirDocumentoHabilitante.java.svn-base new file mode 100644 index 0000000..0a7e45e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/EmitirDocumentoHabilitante.java.svn-base @@ -0,0 +1,841 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + + +/** + * Descarga el Documento Habilitante dependidendo del tramite que se seleccione + * @author Andres Cevallos + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class EmitirDocumentoHabilitante extends AbstractController { + + + + + /** + * Controlador Inyectado ReportController + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + /** + *Controador Inyectado TarmTramiteController + */ + @ManagedProperty(value = "#{tramiteController}") + private TarmTramiteController tramiteController; + + + + /** + *Referencia al Centro de control; + */ + private TarmCentroControl centroControl = new TarmCentroControl(); + + + /** + *Referencia a la solicitud del tramite + */ + private TarmSolicitudTramite solicitudTramite; + + /** + *Referencia a la Solicitud + */ + private TarmSolicitud solicitud; + /** + *Fila de la lista de tramites + */ + private TarmTramite fila; + /** + *Detalles de la persona + */ + private TcustPersonDetail detallesPersona; + /** + * Detalle del usuario + */ + private TcustPersonDetail usuario; + /** + *Documento Habilitante relacionado con el tramite + */ + private TarmDocumentoHabilitante documentoHabilitante; + /** + * Numero de Tramite realizado + */ + private String numeroTramite; + /** + * Nombre de la persona + */ + private String nombreRazonSocial; + /** + * Formato de generacion de pdf + */ + private String formato = "pdf"; + /** + * Formato que se muestra en pantalla + */ + private String mostrarFormato="PDF"; +// TcustPersonDetail detallesPersona; + /** + *Lista de Solicitudes + */ + private List lsolicitud; + /** + *Responsable de centro de control + */ + private TcustPersonDetail responsableCentroControl= null; + /** + * Detalle de Usuarios + */ + private TsafeUserDetail tsafeUserDetailUsuario = null; +// String numeroTramite; +// String nombreRazonSocial; + /** + * Detalle de identificacion + */ + private String identificacion; + /** + * Tipo de identificacion + */ + private String tipoidentificacion; + /** + *Habilita y deshabilita la impresion + */ + private boolean imprimir; + + /** + *Nombre de la Institucion + */ + private String nombreInstitucion; + + + + private List ldocumentos; + + public EmitirDocumentoHabilitante() throws Exception { + super(TarmSolicitudTramite.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // super.startQuery(); + } + + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + // lrecord = new ArrayList<>(); + beanalias = "EMITIRDOCUMENTOHABILITANTE"; + ldocumentos = new ArrayList(); + ldocumentos = CatalogDetailController.find("IDENTIFICATION"); + //Obteniendo el tramite + //solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud("1"); + + //Obteniendo la solicitud + //solicitud=ValidacionTramiteLibreTransitoController.findPorSolicitudSimple("1"); + //this.numeroTramite=solicitudTramite.getNumerotramite(); + + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + //Obteniendo el documento habilitante + // documentoHabilitante=DocumentoHabilitanteController.findPorSolicitud("1"); + this.responsableCentroControl = new TcustPersonDetail(); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + this.obtenerCentroControl(); + this.obtenerResponsableCentroControl(); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + + try { + String sql=encontrarUsuario(); + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + if(sql!=null){ + Filter filtro = new Filter(); + filtro.setSql(sql); + dto.addFiltro(filtro); + } + else{ + this.lrecord = null; + return; + } + SubQuery subqueryUso= new SubQuery("TarmTramite","usoactividad","actividad","i.pk in (select a.ctramite from TarmSolicitud a where a.pk=t.pk.csolicitud)"); + dto.addSubQuery(subqueryUso); + SubQuery subqueryPersona= new SubQuery("TarmSolicitud","personcode","persona","i.pk=t.pk.csolicitud"); + dto.addSubQuery(subqueryPersona); + SubQuery subqueryTipo=new SubQuery("TarmTramite", "tipoautorizacion", "tramite", "i.pk in (select a.ctramite from TarmSolicitud a where a.pk=t.pk.csolicitud)"); + dto.addSubQuery(subqueryTipo); + SubQuery subqueryCategoria= new SubQuery("TarmTramite", "categoria", "categoria", "i.pk in (select a.ctramite from TarmSolicitud a where a.pk=t.pk.csolicitud)"); + dto.addSubQuery(subqueryCategoria); + SubQuery subqueryCategoriaCodigo= new SubQuery("TarmTramite", "categoriacodigo", "categoriacodigo", "i.pk in (select a.ctramite from TarmSolicitud a where a.pk=t.pk.csolicitud)"); + dto.addSubQuery(subqueryCategoriaCodigo); + SubQuery subqueryTipocodigo=new SubQuery("TarmTramite", "tipoautorizacioncodigo", "tramitecodigo", "i.pk in (select a.ctramite from TarmSolicitud a where a.pk=t.pk.csolicitud)"); + dto.addSubQuery(subqueryTipocodigo); + SubQuery subqueryEstado=new SubQuery("TgeneCatalogDetail","description","desc","i.pk.catalog=t.estadotramite and i.pk.catalogcode=t.estadotramitecodigo"); + dto.addSubQuery(subqueryEstado); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + for(int i=0;i< this.lrecord.size();i++){ + this.lrecord.get(i).getModifiedData().put("usodes", CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("actividad").toString(), "USOACTIVIDAD").getDescription()); + this.lrecord.get(i).getModifiedData().put("imprimir", true); + TcustPersonDetail person = PersonDetailController.find(this.lrecord.get(i).getModifiedData().get("persona").toString()); + this.lrecord.get(i).getModifiedData().put("nombre",person!=null?person.getName():""); + this.lrecord.get(i).getModifiedData().put("identificacion", person!=null?person.getIdentification():""); + try{ + TgeneCatalogDetail cate=CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("categoria").toString(),this.lrecord.get(i).getModifiedData().get("categoriacodigo").toString() ); + this.lrecord.get(i).getModifiedData().put("categoriadesc", cate!=null?cate.getDescription():""); + } + catch(Exception e){ + e.printStackTrace(); + } + try{ + TgeneCatalogDetail tipo = CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("tramite").toString(), this.lrecord.get(i).getModifiedData().get("tramitecodigo").toString()); + this.lrecord.get(i).getModifiedData().put("tipotramdesc", tipo!=null?tipo.getDescription():""); + if(!lrecord.get(i).getEstadotramite().equals("APB")){ + lrecord.get(i).getModifiedData().put("imprimir", "true"); + } + else{ + lrecord.get(i).getModifiedData().put("imprimir", "false"); + } + } + + catch(Exception e){ + e.printStackTrace(); + } + } + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que genera el reporte + * @param fila + */ + public void imprimir(TarmSolicitudTramite fila){ + boolean flagArmas = false; + boolean flagGuardias = false; + boolean flagAgencia = false; + boolean flagDoc = false; + String tipotramite=fila.getModifiedData().get("tramite").toString(); + String nombreArchivo = fila.getModifiedData().get("tipotramdesc").toString(); + solicitud = SolicitudController.findSolicitudxcodsolicitud(fila.getPk().getCsolicitud()); + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(fila.getPk().getCsolicitud()); + numeroTramite=solicitudTramite.getNumerotramite(); + documentoHabilitante=DocumentoHabilitanteController.findPorSolicitud(fila.getPk().getCsolicitud()); + TarmTramite tramite = TarmTramiteController.findSimple(fila.getPk().getCtramite().toString()); + String tipoReporte = tramite.getRegistroagenciasucursal(); + //solicitud=ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(tipotramite); + if(tipotramite==null){ + MessageHelper.setMessageError("ERROR NO MANEJADO POR LA APLICACION CONTACTE AL PROVEEDOR"); + return; + } + + + if(tipotramite.equals("2")){ + if(tramite.getRegistroagenciasucursal().equalsIgnoreCase("Y")){ + flagAgencia = true; + } + if (tramite.getRegistroarmas().equalsIgnoreCase("Y")) { + flagArmas = true; + } + if (tramite.getRegistroguardia().equalsIgnoreCase("Y")) { + flagGuardias = true; + } + if(tramite.getDocumentohabilitante().equalsIgnoreCase("Y")) { + flagDoc = true; + } + this.reporteCertificados(solicitud.getPk(), flagAgencia, flagArmas, flagDoc, flagGuardias); + return; + }else if (tipotramite.equals("4")) { + this.reporteGuiaLibreTransito(); + return; + }else { + if(tramite.getRegistroagenciasucursal().equalsIgnoreCase("Y")){ + flagAgencia = true; + } + if (tramite.getRegistroarmas().equalsIgnoreCase("Y")) { + flagArmas = true; + } + if (tramite.getRegistroguardia().equalsIgnoreCase("Y")) { + flagGuardias = true; + } + if(tramite.getDocumentohabilitante().equalsIgnoreCase("Y")) { + flagDoc = true; + } + } + + this.reporteGeneral(solicitud.getPk(),flagAgencia,flagArmas,flagDoc,flagGuardias,nombreArchivo); + + } + + /** + * Encuentra el usuario logueado + * @return + */ + public String encontrarUsuario(){ + if(identificacion==null || identificacion=="") + return null; + detallesPersona=PersonDetailController.findxidentification(identificacion, tipoidentificacion); + if(detallesPersona==null) + return null; + lsolicitud=SolicitudController.findSolicitudxPersona(detallesPersona.getPk().getPersoncode().toString()); + + if(lsolicitud == null || lsolicitud.isEmpty()){ + return null; + } + + String csolicitud=null; + for(TarmSolicitud soli : lsolicitud){ + if(csolicitud==null){ + csolicitud="csolicitud='"+soli.getPk()+"'"; + } + else{ + csolicitud+=" or csolicitud='"+soli.getPk()+"'"; + } + } + return csolicitud ; + } + + public List getLdocumentos() { + return ldocumentos; + } + + public void setLdocumentos(List ldocumentos) { + this.ldocumentos = ldocumentos; + } + + @Override + public void save() { + // TODO Auto-generated method stub + super.save(); + } + + /** + * Ejecuta un reporte de armas + * @param name Nombre del reporte a generar. + */ + public void reporteGuiaLibreTransito() { + try { + String path = "armas/reports/guiaLibreTransito"; + String filename=MsgControlArmas.getProperty("lbl_guiaLibreTransito"); + + detallesPersona = PersonDetailController.find(String.valueOf(solicitud.getPersoncode().toString())); + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + + //Nombre del centro de control + parameters.put("nombreCentro", this.nombreInstitucion); + + //No. Guia + parameters.put("noGuia", this.numeroTramite); + + //Codigo de barras + String codigoBarras=this.numeroTramite.replace("-", "").toLowerCase(); + Boolean caracterEliminado=false; + for (int i = 0; i < codigoBarras.length(); i++) { + if(caracterEliminado){ + i=0; + caracterEliminado=false; + } + if(codigoBarras.toCharArray()[i]!='0' && codigoBarras.toCharArray()[i]!='1' && codigoBarras.toCharArray()[i]!='2' + && codigoBarras.toCharArray()[i]!='3' && codigoBarras.toCharArray()[i]!='4' && codigoBarras.toCharArray()[i]!='5' + && codigoBarras.toCharArray()[i]!='6' && codigoBarras.toCharArray()[i]!='7' && codigoBarras.toCharArray()[i]!='8' + && codigoBarras.toCharArray()[i]!='9'){ + + String caracterExtranno=""; + caracterExtranno+=codigoBarras.toCharArray()[i]; + codigoBarras=codigoBarras.replace(caracterExtranno, ""); + caracterEliminado=true; + } + } + parameters.put("codigoBarras", codigoBarras); + + //Nombre/Razon Social + parameters.put("nombreRazon", detallesPersona.getName()); + + // Vendedor + parameters.put("tipodocumentoorigen", solicitud.getTipodocumentoorigen()); + parameters.put("numerodocumentoorigen", solicitud.getNumerodocumentoorigen()); + parameters.put("nombrerazonsocialorigen", solicitud.getNombrerazonsocialorigen()); + + //Cedula + parameters.put("cedula", detallesPersona.getIdentification()); + + //Desde + parameters.put("desde", solicitud.getLugarorigen()); + + //Hasta + parameters.put("hasta", solicitud.getLugardestino()); + + //Fechas + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + if(documentoHabilitante!=null){ + parameters.put("fechaExpide", sdf.format(documentoHabilitante.getFechaemision())); + parameters.put("fechaCaduca", sdf.format(documentoHabilitante.getFechaexpiracion())); + }else{ + parameters.put("fechaExpide", " "); + parameters.put("fechaCaduca", " "); + } + + //Grado + String gradoFuncionario=""; + TgeneCatalogDetail grado=CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), + this.responsableCentroControl.getMilitarygradecode()); + if(grado!=null){ + gradoFuncionario=grado.getDescription()+" - "; + } + + //Funcionario + parameters.put("gradoNombreFuncionario",gradoFuncionario+this.responsableCentroControl.getName()); + parameters.put("personcode",this.responsableCentroControl.getPk().getPersoncode()); + parameters.put("centroControl","JEFE DEL "+this.nombreInstitucion); + + //Usuario + parameters.put("usuario",this.usuario.getName()); + sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + String fechaHora=sdf.format(Calendar.getInstance().getTime()); + parameters.put("fechaHora",fechaHora); + + String format = "pdf"; + + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Ejecuta un reporte de certificado de armas + * @param name Nombre del reporte a generar. + */ + + public void reporteCertificadoArmas() { + try { + String path = "armas/reports/certificadoArmas"; + String filename="certificadoarmas"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + + + + String format = "pdf"; + + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Ejecuta un reporte de certificado de armas + * @param name Nombre del reporte a generar. + */ + + + + /** + * Reporte de Agencias + */ + public void reporteAgencias() { + try { + String path = "armas/reports/aperturaAgenciasSucursales"; + String filename="aperturaagenciassucursales"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + + + + String format = "pdf"; + + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Reporte de Inscripcion de Armas + * @param solicitud + */ + public void reporteInscripcion(TarmSolicitud solicitud) { + try { + String path = "armas/reports/reporteInscripcion"; + String filename="armas"; + + detallesPersona = PersonDetailController.find(String.valueOf(solicitud.getPersoncode().toString())); + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + + //No. Guia + parameters.put("nombreCompania", detallesPersona.getName()); + + //Nombre/Razon Social + parameters.put("nombrepersona",detallesPersona.getLegalrepresent()); + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("fecha", sdf.format(solicitud.getFregistro())); + parameters.put("ciudad", "Quito"); + + //Grado + /* String gradoFuncionario=""; + TgeneCatalogDetail grado=CatalogDetailController.findxCodigoCodcatalogo(usuario.getMilitarygrade(), usuario.getMilitarygradecode()); + if(grado!=null){ + gradoFuncionario=grado.getDescription()+" - "; + } + + //Funcionario + parameters.put("gradoNombreFuncionario",gradoFuncionario+usuario.getName()); + */ + String format = "pdf"; + + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + String institucionCentroControl=""; + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController direccion = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres= direccion.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + this.centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + this.nombreInstitucion=CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + institucionCentroControl=this.nombreInstitucion; + + return institucionCentroControl; + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl(){ + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + /** + * Ejecuta reporte general de informacion de armas, guardias, agencias y sucursales + * @param name Nombre del reporte a generar. + */ + + public void reporteGeneral(String solicitud,boolean flagAgencia,boolean flagArmas,boolean flagDoc,boolean flagGuardias,String nombreArchivo) { + try { + String gradoUsuario =""; + String path = "armas/reports/generalReportHabilita"; + String filename=nombreArchivo; + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if(grado != null){ + gradoUsuario = grado.getDescription()+" - "+this.responsableCentroControl.getName(); + }else{ + gradoUsuario = "Sin Grado - "+this.responsableCentroControl.getName(); + } + + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("csolicitud", solicitud); + + //Obteniendo la solicitud + TarmSolicitud s=SolicitudController.findSolicitudxcodsolicitud(solicitud); + TarmTramite t; + Boolean datosTramiteVacios=false; + + if(s!=null){ + //Obteniendo el tramite + t=TarmTramiteController.find(s.getCtramite().toString()); + + //Obteniendo la solicitud trmite + TarmSolicitudTramite st=TarmSolicitudTramiteController.findPorCSolicitud(solicitud); + + if(t!=null){ + + //No de tramite + if(st!=null){ + parameters.put("noTramite", st.getNumerotramite()); + }else{ + parameters.put("noTramite", " "); + } + + //Tipo de tramite + if(t.getModifiedData().get("tipotramite")!=null){ + parameters.put("tipoTramite", t.getModifiedData().get("tipotramite")); + }else{ + parameters.put("tipoTramite", " "); + } + + //Tipo de autorizacion + if(t.getModifiedData().get("tipoautorizacion")!=null){ + parameters.put("tipoAutorizacion", t.getModifiedData().get("tipoautorizacion")); + }else{ + parameters.put("tipoAutorizacion", " "); + } + + //Categoria + if(t.getModifiedData().get("categoria")!=null){ + parameters.put("categoria", t.getModifiedData().get("categoria")); + }else{ + parameters.put("categoria", " "); + } + + //Uso actividad + if(t.getModifiedData().get("usoactividad")!=null){ + parameters.put("usoActividad", t.getModifiedData().get("usoactividad")); + }else{ + parameters.put("usoActividad", " "); + } + + //Cabecera + if(t.getCabecera()!=null){ + parameters.put("cabecera", t.getCabecera()); + }else{ + parameters.put("cabecera", " "); + } + + }else{ + datosTramiteVacios=true; + } + }else{ + datosTramiteVacios=true; + } + + if(datosTramiteVacios){ + parameters.put("noTramite", " "); + parameters.put("tipoTramite", " "); + parameters.put("tipoAutorizacion", " "); + parameters.put("categoria", "-"); + parameters.put("usoActividad", " "); + parameters.put("cabecera", " "); + } + + + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + parameters.put("flagAgencia", flagAgencia); + parameters.put("flagArmas", flagArmas); + parameters.put("flagDoc", flagDoc); + parameters.put("flagGuardias", flagGuardias); + parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("usuario",PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()).getName()); + parameters.put("codResponsable", this.responsableCentroControl.getPk().getPersoncode()); + String format = "pdf"; + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Ejecuta reporte general de informacion de armas, guardias, agencias y sucursales + * @param name Nombre del reporte a generar. + */ + + public void reporteCertificados(String solicitud,boolean flagAgencia,boolean flagArmas,boolean flagDoc,boolean flagGuardias) { + try { + String gradoUsuario =""; + String path = "armas/reports/reporteCertificado"; + String filename="reporteCertificado"; + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if(grado != null){ + gradoUsuario = grado.getDescription()+" - "+this.responsableCentroControl.getName(); + }else{ + gradoUsuario = "Sin Grado - "+this.responsableCentroControl.getName(); + } + + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("csolicitud", solicitud); + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + parameters.put("flagAgencia", flagAgencia); + parameters.put("flagArmas", flagArmas); + parameters.put("flagDoc", flagDoc); + parameters.put("flagGuardias", flagGuardias); + parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("usuario",PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()).getName()); + parameters.put("codResponsable", this.responsableCentroControl.getPk().getPersoncode()); + String format = "pdf"; + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public String getFormato() { + return formato; + } + + public void setFormato(String formato) { + this.formato = formato; + } + + public String getMostrarFormato() { + return mostrarFormato; + } + + public void setMostrarFormato(String mostrarFormato) { + this.mostrarFormato = mostrarFormato; + } + + public boolean isImprimir() { + return imprimir; + } + + public void setImprimir(boolean imprimir) { + this.imprimir = imprimir; + } + + + public TarmTramiteController getTramiteController() { + return tramiteController; + } + + public void setTramiteController(TarmTramiteController tramiteController) { + this.tramiteController = tramiteController; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + + public TarmTramite getFila() { + return fila; + } + + public void setFila(TarmTramite fila) { + this.fila = fila; + } + + public String getIdentificacion() { + return identificacion; + } + + public void setIdentificacion(String identificacion) { + this.identificacion = identificacion; + } + + public String getTipoidentificacion() { + return tipoidentificacion; + } + + public void setTipoidentificacion(String tipoidentificacion) { + this.tipoidentificacion = tipoidentificacion; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/EnvioArmasNoIniciadasFlujoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/EnvioArmasNoIniciadasFlujoController.java.svn-base new file mode 100644 index 0000000..00b52f2 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/EnvioArmasNoIniciadasFlujoController.java.svn-base @@ -0,0 +1,432 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.model.SelectItem; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.parmas.soli.TarmTransaccionArmaBodega; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TarmDecomisoArmaTransaccion. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class EnvioArmasNoIniciadasFlujoController extends AbstractController { + + public EnvioArmasNoIniciadasFlujoController() throws Exception { + super(TarmDecomisoArmaTransaccion.class); + } + + /** + * Controlador para generar el reporte + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + /** + * Controlador para caragar el archivo al alfresco + */ + @ManagedProperty(value="#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * atributo con los datos del usuario logeado + */ + private TsafeUserDetail userDetail; + + private String xpathflujo; + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //consulta la lista + this.querydatabase(); + } + + private List decomisoArmas; + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 300; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "RECEPCIONARMASNOENV"; + userDetail= (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + obtenerCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * nombre del centro de control + */ + private String institucionCentroControl; + private ListitemUnidadDestino; + /** + * nombre del centro de control + */ + private String instiCentroControlCode; + /** + * Método para obtener el centro de control + * @throws Exception + */ + private void obtenerCentroControl() throws Exception { + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(userDetail.getPk().getPersoncode().toString()); + if(tcustPersonAddres!=null && tcustPersonAddres.getProvincecode()!=null){ + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + if(centroControlJur!=null && centroControlJur.getCcentrocontrol()!=null){ + TarmCentroControl centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + itemUnidadDestino= new ArrayList(); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + //codigo del centro de control de pichincha + TgeneParameters paramCentroControlDestino=ParametersController.find("CODIGO.CENT.CONTROL.PICHINCHA", "1");//000030//CAPI + //validamos si la persona que ingreso pertenece al centro de control pichincha para darle al opcion de seleccionar el deparatmento de control para la recepcion + if(paramCentroControlDestino.getTextvalue().equals(centroControl.getNombreinstitucion())){ + itemUnidadDestino.add(new SelectItem(centroControl.getPk(), institucionCentroControl)); + //codigo del departamento de control + TgeneParameters paramDepartamentoControl=ParametersController.find("CODIGO.DEPT.CONTROL", "1");//DPCA + TarmCentroControl institCentroControlDestino= CentroControlArmasController.findPorCentroControl(paramDepartamentoControl.getTextvalue());//000077 + itemUnidadDestino.add(new SelectItem(institCentroControlDestino.getPk(), ""+institCentroControlDestino.getModifiedData().get("desnombreinstitucion"))); + }else{ + instiCentroControlCode=centroControl.getPk(); + } + }else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_laprovinciasinccontrol")); + return; + } + }else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_notienedireccionprincipal")); + return; + } + } + + public void executeUnidad() { + for(SelectItem item: itemUnidadDestino){ + if(item.getValue().equals(instiCentroControlCode)){ + institucionCentroControl=item.getLabel(); + } + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + Filter filtro = new Filter(); + filtro.setSql("estadoflujo='NOENV' and numerotransaccion like '%ENV-%' and ccentrocontrol='"+instiCentroControlCode+"'"); + dto.addFiltro(filtro); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * + * @param codigo + * @return + */ + public static TarmDecomisoArmaTransaccion find(String codigo) { + try { + EnvioArmasNoIniciadasFlujoController cc = new EnvioArmasNoIniciadasFlujoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", codigo); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * lista las armas decomisadas asociadas al numero de transaccion + * @param decomisoArmaTransaccion + */ + public void listarArmas(TarmDecomisoArmaTransaccion decomisoArmaTransaccion){ + record=decomisoArmaTransaccion; + decomisoArmas=DecomisoArmaController.findEnvio(decomisoArmaTransaccion.getPk()); + } + + + public void generarActa(){ + String gradoUsuario =""; + Calendar fechaActualCldr = Calendar.getInstance(); + TcustPersonDetail usuario = PersonDetailController.find(this.userDetail.getPk().getPersoncode().toString()); + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(usuario.getMilitarygrade(), usuario.getMilitarygradecode()); + if(grado != null){ + gradoUsuario = grado.getDescription()+" - "+usuario.getName(); + }else{ + gradoUsuario = usuario.getName(); + } + // String codigoreporte=record.getModifiedData().get("cdecomiso").toString();//listTarmDecomisoArma.get(0).getPk().toString(); + String path = "armas/reports/entregaArmasacta"; + String filename=record.getNumerotransaccion(); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("fechaCorte", (new SimpleDateFormat("dd-MM-yyyy").format(record.getFcorte()))); + parameters.put("codResponsable",usuario.getPk().getPersoncode()); + parameters.put("gradoUsuario",gradoUsuario); + try { + + //Usuario logueado en la aplicacion + String nombreUsuario; + if(userDetail.getPk().getPersoncode()!=null){ + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + } + else{ + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario); + parameters.put("unidadmilitar", institucionCentroControl); + parameters.put("tecnicoAlmacenamiento",MsgControlArmas.getProperty("tecnicoAlmacenamiento")+" "+institucionCentroControl); + parameters.put("jefe",MsgControlArmas.getProperty("jefe")+" "+institucionCentroControl); + parameters.put("codigodecomisoarma",record.getPk().toString()); + parameters.put("tramite", record.getNumerotransaccion()); + //Fecha actual + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH)+1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarFecha", fechaActualSB.toString()); + InputStream file =this.reportController.jaspertoInputstream(path, parameters, "pdf", filename, this.getLoginController()); + xpathflujo = generarXpath(record.getNumerotransaccion()); + if(!alfrescoController.uploadFile(file, record.getNumerotransaccion()+ ".pdf", xpathflujo)){ + xpathflujo=null; + } + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Metodo para generar la ruta donde se carga el archivo + * @param numeroTransaccionRecepcion + * @return + */ + public String generarXpath(String numeroTransaccionRecepcion){ + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta=new StringBuilder("cm:Decomiso"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + ruta = ruta.append("/cm:"+numeroTransaccionRecepcion); + return ruta.toString(); + } + public List getDecomisoArmas() { + return decomisoArmas; + } + + public void setDecomisoArmas(List decomisoArmas) { + this.decomisoArmas = decomisoArmas; + } + + public void iniciarFlujo() { + try { + + if(xpathflujo==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generereporte")); + return; + } + TarmTransaccionArmaBodega armaBodegas= TransaccionArmaBodegaController.find(record.getPk().toString()); + + if(armaBodegas.getModifiedData().get("provincecodeorig")==null || armaBodegas.getModifiedData().get("provincecodeorig").toString().length()==0){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinprovincia")); + return; + } + String cprovincia=armaBodegas.getModifiedData().get("provincecodeorig").toString(); + //Se comenta por validacion de provincia en el flujo de EnvioArmas clase com.fp.armas.task.ValidacionGrupo + // cualquier error analizar esta validacion de provincia + + /*TgeneParameters paramDepartamentoControl=ParametersController.find("CODIGO.DEPT.CONTROL", "1");//DPCA + if(armaBodegas.getModifiedData().get("nombreinstitucion").equals(paramDepartamentoControl.getTextvalue())){ + cprovincia=paramDepartamentoControl.getTextvalue(); + }*/ + + String xpath=xpathflujo+"/cm:"+record.getNumerotransaccion()+ ".pdf"; + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + //codigo de la tabla TarmDecomisoArmaTransaccion + request.modifiedData().put("numerotransaccion", record.getPk()); + request.modifiedData().put("cprovincia", cprovincia); + request.modifiedData().put("numerosolicitud", record.getNumerotransaccion()); + //ruta del archivo para la firma + request.modifiedData().put("xpath", xpath); + request.modifiedData().put("isnew", "Y"); + request.setLogsolicitude(record.getNumerotransaccion()); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.setShowRow(true); + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + " TRANSACCION: "+ record.getNumerotransaccion()); + xpathflujo=null; + //quita el registro de la lista en vista + lrecord.remove(record); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public List getItemUnidadDestino() { + return itemUnidadDestino; + } + + public void setItemUnidadDestino(List itemUnidadDestino) { + this.itemUnidadDestino = itemUnidadDestino; + } + + public String getInstiCentroControlCode() { + return instiCentroControlCode; + } + + public void setInstiCentroControlCode(String instiCentroControlCode) { + this.instiCentroControlCode = instiCentroControlCode; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/FichasTecnicasFlatantesController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/FichasTecnicasFlatantesController.java.netbeans-base new file mode 100644 index 0000000..83a6f5a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/FichasTecnicasFlatantesController.java.netbeans-base @@ -0,0 +1,1201 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.CashManagementHistoryController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmaPruebas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * + * Genrera fichas tecnicas de armas faltantes + * @author Christian Pazmino + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class FichasTecnicasFlatantesController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 8843091476010012919L; + + /** + * Controlador que maneja alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * Controlador que maneja reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{armasController}") + private ArmasController armas; + + private TarmArmas arma = new TarmArmas(); + + private String editarReg; + + private String codigoSolicitud; + + private boolean habilitaButtom; + + private TarmCentroControl centroControl = new TarmCentroControl(); + + private List listadoArmasPruebas = new ArrayList<>(); + + private String observacion; + + private String estado; + + private Date fec_actual; + + private String formato; + + private String xpathflujo; + + private TcustPersonDetail responsableCentroControl= null; + + private TsafeUserDetail tsafeUserDetailUsuario = null; + + private Boolean btnFlujo; + + private List tarmArmaPruebasList; + /** + * lista del catalogo de las acciones (Aceptar o rechazar) + */ + private List laccion; + + private boolean deshabilitadoGenerarReporte=true; + + private TarmSolicitud solicitud; + private TarmSolicitudTramite solicitudTramite; + private TarmTramite tramite; + private TcustPersonAddress direccionCliente; + private String provincia; + private String canton; + private String ciudad; + private String direccion; + private TgeneCatalogDetail estadotramite; + private TgeneCatalogDetail usoActividad; + private TcustPersonDetail personaDetalle; + private TgeneCatalogDetail identificacion; + private TgeneCatalogDetail detallecatalogoTipoTramite; + private TgeneCatalogDetail detallecatalogo; + private TgeneParameters fichasFaltantesParametro; + + private Integer cPruebaInicio; + private Integer cPruebaFin; + + /** + * Controlador que maneja los datos de generacion ultima vez del reporte + */ + @ManagedProperty(value = "#{parametersController}") + private ParametersController parametersController; + + + public FichasTecnicasFlatantesController() throws Exception { + super(TarmArmaPruebas.class); + } + + @PostConstruct + private void postconstruct() { + try { + init(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + + } + } + + + private void init() { + recperpage = 13000; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + record=new TarmArmaPruebas(); + beanalias = "INGRESOFICHASFALTANTES"; + fichasFaltantesParametro =ParametersController.find("FICHASFALTANTES", "1"); + cPruebaInicio = fichasFaltantesParametro.getNumbervalue().intValue(); + cPruebaFin = 13187; + } + + + @Override + public void create() throws Exception { + super.create(); + } + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void uploadImpronta(FileUploadEvent event) { + record.modifiedData().put("FileUploadImpronta", event.getFile()); + } + + public void uploadFoto(FileUploadEvent event) { + record.modifiedData().put("FileUploadFoto", event.getFile()); + } + + public void generarReportesFaltantes(){ + try{ + for(int i=cPruebaInicio;i<=cPruebaFin;i++){ + this.record = IngresoFichaTecnicaArmasController.findByPk(String.valueOf(i)); + + // Comentar numeroArmasEnSolicitud(xxx) para volver a generar cualquier ficha de solicitud con una unica arma.. + // Validamos solo para solicitudes que tienen path y cuya solicitud tiene mas de una arma + if(this.record!=null && numeroArmasEnSolicitud(record.getCsolicitud())>1 && (this.record.getXpathfichatecarmas()!=null || this.record.getXpathfotografia()!=null || this.record.getXpathimpronta()!=null)){ + System.out.println("*****GENERACION DE FICHA TECNICA: "+i+" *****"); + this.solicitud = SolicitudArmasController.findByCSolicitud(this.record.getCsolicitud()); + this.codigoSolicitud = solicitud.getPk(); + this.solicitudTramite=SolicitudTramiteController.findByCSolicitud(codigoSolicitud); + this.tramite=TarmTramiteController.find(solicitud.getCtramite()+""); + this.personaDetalle = PersonDetailController.find(String.valueOf(solicitud.getPersoncode())); + direccionCliente=PersonAddressController.find(String.valueOf(solicitud.getPersoncode())) ; + provincia = direccionCliente.modifiedData().get("provincia")==null?null: direccionCliente.modifiedData().get("provincia").toString(); //personAddressController.getLprovinces()==null || .getLprovinces().isEmpty()?null:personAddressController.getLprovinces().get(0); + canton = direccionCliente.modifiedData().get("canton")==null?null: direccionCliente.modifiedData().get("canton").toString();//personAddressController.getLcantones()==null || personAddressController.getLcantones().isEmpty()?null:personAddressController.getLcantones().get(0); + ciudad = direccionCliente.modifiedData().get("ciudad")==null?null: direccionCliente.modifiedData().get("ciudad").toString();//personAddressController.getLcities()==null || personAddressController.getLcities().isEmpty()?null:personAddressController.getLcities().get(0); + direccion= direccionCliente.getAddress(); + estadotramite = (solicitudTramite.getEstadotramite()==null || solicitudTramite.getEstadotramitecodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(solicitudTramite.getEstadotramite(), solicitudTramite.getEstadotramitecodigo()); + usoActividad = (tramite.getUsoactividad()==null || tramite.getUsoactividadcodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + identificacion = (personaDetalle.getIdentificationcatalog()==null || personaDetalle.getIdentificationcatalogcode()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(personaDetalle.getIdentificationcatalog(), personaDetalle.getIdentificationcatalogcode()); + detallecatalogoTipoTramite = (tramite.getTipoautorizacion()==null || tramite.getTipoautorizacioncodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + detallecatalogo = (tramite.getCategoria()==null || tramite.getCategoriacodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + this.obtenerCentroControl(); + this.obtenerResponsableCentroControl(); + reporteFichaArmas(i); + } + } + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Metodo para extrer solo el nombre del archivo + * @param xpath xpath del archivo en alfresco + * @return solo la parte correspondiente al nombre del archivo + */ + public String soloNombreArchivo(String xpath){ + return xpath.substring(xpath.lastIndexOf(":") + 1,xpath.length()); + } + + /** + * Retorna el xpath de la ruta en donde se va a almacenar el documento + * @param xpath ruta en donde se almacenará el archivo + * @return + */ + private String obtenerXpath(String xpath) { + String rutaXpath = null; + int indice = xpath.lastIndexOf("/cm:"); + rutaXpath = xpath.substring(0, indice); + return rutaXpath; + } + + /** + * Retorna el xpath de la ruta en donde se va a almacenar el documento + * @param xpath ruta en donde se almacenará el archivo + * @return + */ + private String obtenerXpathDesdeFotografia(String xpath) { + String rutaXpath = null; + int indice = xpath.lastIndexOf("/cm:fotografia/cm:"); + rutaXpath = xpath.substring(0, indice); + return rutaXpath; + } + + private String obtenerXpathDesdeImpronta(String xpath) { + String rutaXpath = null; + int indice = xpath.lastIndexOf("/cm:impronta/cm:"); + rutaXpath = xpath.substring(0, indice); + return rutaXpath; + } + + private Date obtenerFechaEmision(String xpath) { + String rutaXpath = null; + int indice = xpath.lastIndexOf("/cm:SOL-"); + rutaXpath = xpath.substring(0, indice); + rutaXpath=rutaXpath.replace("cm:Solicitudes/cm:A-", "").replace("/cm:M", "").replace("/cm:D", ""); + Calendar cal = Calendar.getInstance(); + cal.set(Calendar.YEAR, Integer.valueOf(rutaXpath.substring(0, 4))); + cal.set(Calendar.MONTH, Integer.valueOf(rutaXpath.substring(5, 7))); + cal.set(Calendar.DAY_OF_MONTH, Integer.valueOf(rutaXpath.substring(8, 10))); + return cal.getTime(); + } + + + /** + * @return + * @throws Exception + */ + public String codigoAceptado() throws Exception { + TgeneParameters f = ParametersController.find("ACEPTADO", "1"); + return f.getTextvalue(); + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + + /** + * Metodo que indica si se debe habilitar el boton del pantalla ficha tecnica + */ + public void habilitarBoton() { + this.habilitaButtom = true; + } + + + /** + * Metodo que indica si se debe habilitar el boton del pantalla ficha tecnica + */ + public void cerrar() { + if(record.modifiedData().get("GUARDA")!=null && record.modifiedData().get("GUARDA").equals("S") && + record.modifiedData().get("IMPRIME")!=null && record.modifiedData().get("IMPRIME").equals("S") ){ + }else{ + MessageHelper.setMessageError("GUARDE Y GENERE EL REPORTE"); + } + } + + + /** + * Ejecuta reporte de registro balistico + * + */ + public void reporteRegistroBalistico() { + try { + String gradoUsuario =""; + String path = "armas/reports/registroBalistico"; + String filename=MsgControlArmas.getProperty("lbl_registroBalistico"); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + + //Logos + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Obteniendo la solicitud + TarmSolicitud solicitud=SolicitudController.findSolicitudxcodsolicitud(this.codigoSolicitud); + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + + //Codigo solicitud + parameters.put("csolicitud", this.codigoSolicitud); + + //Fecha de solicitud + parameters.put("fechaSolicitud", sdf.format(solicitud.getFregistro())); + + //Obteniendo los datos del tramite + TarmTramite tramite=TarmTramiteController.find(solicitud.getCtramite().toString()); + TgeneCatalogDetail tipoTramite=CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + TgeneCatalogDetail categoria=CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + TarmSolicitudTramite solicitudTramite=SolicitudTramiteController.findByCSolicitud(this.codigoSolicitud); + TgeneCatalogDetail tipoAutorizacion=CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail usoActividad=CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + + //Tipo de tramite + if(tipoTramite!=null && tipoTramite.getDescription()!=null){ + parameters.put("tipoTramite", tipoTramite.getDescription()); + }else{ + parameters.put("tipoTramite", " "); + } + + //Categoria + if(categoria!=null && categoria.getDescription()!=null){ + parameters.put("categoria", categoria.getDescription()); + }else{ + parameters.put("categoria", " "); + } + + //No tramite + if(solicitudTramite!=null){ + parameters.put("noTramite", solicitudTramite.getNumerotramite()); + }else{ + parameters.put("noTramite", " "); + } + + //Tipo de autorizacion + if(tipoAutorizacion!=null && tipoAutorizacion.getDescription()!=null){ + parameters.put("tipoAutorizacion", tipoAutorizacion.getDescription()); + }else{ + parameters.put("tipoAutorizacion", " "); + } + + //Uso-actividad + if(usoActividad!=null && usoActividad.getDescription()!=null){ + parameters.put("usoActividad", usoActividad.getDescription()); + }else{ + parameters.put("usoActividad", " "); + } + + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if(grado != null){ + gradoUsuario = grado.getDescription()+" - "+this.responsableCentroControl.getName(); + }else{ + gradoUsuario = "Sin Grado - "+this.responsableCentroControl.getName(); + } + TcustPersonDetail person = PersonDetailController.find(String.valueOf(solicitud.getPersoncode())); + //PersonDetailController.find(String.valueOf(solicitud.getPersoncode())); + //Fecha + parameters.put("fechaActual", sdf.format(this.fec_actual)); + parameters.put("fecActualHora", new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss").format(this.fec_actual)); + parameters.put("personCode", person.getPk().getPersoncode()); + parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("usuario", this.tsafeUserDetailUsuario.getNickname()); + String format = this.formato; + try { + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + btnFlujo=Boolean.TRUE; + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if(tcustPersonAddres == null){ + return null; + } + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl(){ + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + +// public void saveImprimir() { +// try { +//// if(!record.modifiedData().get("GUARDA").equals("S")){ +//// MessageHelper.setMessageError("GUARDE LA FICHA PARA GENERAR EL REPORTE"); +//// return; +//// } +// reporteFichaArmas(); +// record.setIsimpreso("Y"); +// update(); +// Request request = callerhelper.getRequest(); +// HashMap msave = new HashMap(); +// request.setSaveTables(msave); +// DtoSave dtosave = super.getDtoSave(); +// dtosave.setReturnpk(true); +// msave.put(beanalias, dtosave); +// request.setSaveTables(msave); +// Response resp = callerhelper.executeSave(request); +// if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { +// this.postCommit(resp); +// MessageHelper.setMessageInfo(resp); +// record.modifiedData().put("IMPRIME", "S"); +// MessageHelper.setMessageInfo(resp); +// } else { +// record.modifiedData().put("IMPRIME", "N"); +// MessageHelper.setMessageError(resp); +// } +// } catch (Throwable e) { +// record.modifiedData().put("IMPRIME", "N"); +// MessageHelper.setMessageError(e); +// } +// } + /** + * Obtiene el reporte de Ficha de Armas + * @throws Exception + */ + public void reporteFichaArmas(int i) throws Exception { + String gradoUsuario =""; + String path = "armas/reports/fichaTecArmas"; + TgeneParameters parametro=ParametersController.find("CODIGO.FICHANOLETAL", "1"); + if(parametro!=null && parametro.getTextvalue()!=null && !parametro.getTextvalue().trim().isEmpty()){ + String [] arrayCodTramite=parametro.getTextvalue().split(","); + ListlistaCodTraite=Arrays.asList(arrayCodTramite); + for (String item : listaCodTraite) { + Long codigotramite=Long.parseLong(item); + if(solicitud.getCtramite().equals(codigotramite) || + codigotramite.longValue()==solicitud.getCtramite().longValue()){ + path = "armas/reports/fichaTecArmasNoLetales"; + } + } + } + parametro=ParametersController.find("CODIGO.FICHACOLECCION", "1"); + if(parametro!=null && parametro.getTextvalue()!=null && !parametro.getTextvalue().trim().isEmpty()){ + String [] arrayCodTramite=parametro.getTextvalue().split(","); + ListlistaCodTraite=Arrays.asList(arrayCodTramite); + for (String item : listaCodTraite) { + Long codigotramite=Long.parseLong(item); + if(solicitud.getCtramite().equals(codigotramite) || + codigotramite.longValue()==solicitud.getCtramite().longValue()){ + path = "armas/reports/fichaTecArmasColeccion"; + } + } + } + String filename=MsgControlArmas.getProperty("lbl_fichaTecnicaArmas"); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + parameters.put("centroControl", this.obtenerCentroControl()); + + //Fecha actual + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + //Fecha de solicitud + if(solicitud!=null && solicitud.getFregistro()!=null){ + parameters.put("fechaSolicitud", sdf.format(solicitud.getFregistro())); + }else{ + parameters.put("fechaSolicitud", " "); + } + //No tramite + if(solicitudTramite!=null && solicitudTramite.getNumerotramite()!=null){ + parameters.put("noTramite", solicitudTramite.getNumerotramite()); + }else{ + parameters.put("noTramite", " "); + } + + //Tipo de tramites + if(detallecatalogoTipoTramite!=null && detallecatalogoTipoTramite.getDescription()!=null){ + parameters.put("tipoTramite", detallecatalogoTipoTramite.getDescription()); + }else{ + parameters.put("tipoTramite", " "); + } + //Estado tramite + if(estadotramite!=null && estadotramite.getDescription()!=null){ + parameters.put("estadoTramite", estadotramite.getDescription()); + }else{ + parameters.put("estadoTramite", " "); + } + + //Uso actividad + if(usoActividad!=null && usoActividad.getDescription()!=null){ + parameters.put("usoActividad",usoActividad.getDescription()); + }else{ + parameters.put("usoActividad", " "); + } + //Tipo de documento + if(identificacion!=null){ + parameters.put("tipoDocumento", identificacion.getDescription()); + }else{ + parameters.put("tipoDocumento", " "); + } + //No documento + if(personaDetalle!=null){ + parameters.put("cedula", personaDetalle.getIdentification()); + }else{ + parameters.put("cedula", " "); + } + //Nombre razon social + if(personaDetalle!=null){ + parameters.put("nombreRazon", personaDetalle.getName()); + }else{ + parameters.put("nombreRazon", " "); + } + //Provincia + if(provincia !=null){ + parameters.put("provincia", provincia); + }else{ + parameters.put("provincia", " "); + } + //Canton + if(canton!=null){ + parameters.put("canton", canton); + }else{ + parameters.put("canton", " "); + } + //Ciudad + if(ciudad!=null){ + parameters.put("ciudad", ciudad); + }else{ + parameters.put("ciudad", " "); + } + //Direccion + if(direccion!=null){ + parameters.put("direccion",direccion); + }else{ + parameters.put("direccion", " "); + } + //Codigo de arma + parameters.put("codigoArma", this.record.getCarma()); + //Codigo de registro de TarmArmaPrueba + parameters.put("cArmaPrueba", record.getPk().toString()); + TarmArmas arma= ArmasController.findPorCodigo(this.record.getCarma()); + TarmRegistroArmas regArma = RegistroArmController.findByCodigo(arma.getCregistro().toString()); + TgeneCountry paisOrigen=CountryController.findcountry(regArma.getPaisorigen()); + //Clase + if(arma.getModifiedData().get("clase")!=null){ + parameters.put("clase", arma.getModifiedData().get("clase")==null?"":arma.getModifiedData().get("clase")); + }else{ + parameters.put("clase", " "); + } + //Obtniendo el tipo arma explosivo + TarmTipoArmaExplosivo tae=arma==null?null:TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo()); + //Tipo arma + TgeneCatalogDetail tipoArma=tae==null?null:CatalogDetailController.findxCodigoCodcatalogo(tae.getTipoarmaexplosivo(), "TIPOARMAEXPLOSIVO"); + parameters.put("tipoArma", (tipoArma==null || tipoArma.getDescription().isEmpty())?"": tipoArma.getDescription()); + //Serie + parameters.put("serie", (arma==null || arma.getLote()==null || arma.getLote().isEmpty())?"":arma.getLote()); + //Pais fabricacion + parameters.put("paisFabricacion", (paisOrigen==null)?"":(paisOrigen.getDescription())); + //Calibre + parameters.put("calibre", (arma.getModifiedData().get("calibre")==null)?"":arma.getModifiedData().get("calibre")); + //Longitud + TgeneCatalogDetail longitud=(tae==null || tae.getLongitud()==null || tae.getLongitudcodigo()==null || tae.getLongitud().isEmpty() || tae.getLongitudcodigo().isEmpty())?null:CatalogDetailController.findxCodigoCodcatalogo(tae.getLongitud(),tae.getLongitudcodigo()); + if(longitud!=null && longitud.getDescription()!=null){ + parameters.put("longitud", longitud.getDescription()); + }else{ + parameters.put("longitud", " "); + } + //Marca + parameters.put("marca", arma.getModifiedData().get("marca")); + //Modelo + parameters.put("modelo", arma.getModelo()); + //Color + parameters.put("color", arma.getModifiedData().get("color")); + //Observacion + parameters.put("observacion", this.record.getObservacion()); + //Aptitud de disparo + String aptitudDisparo=" "; + if(this.record.getAptituddisparo()!=null){ + if(this.record.getAptituddisparo().equalsIgnoreCase("Y")){ + aptitudDisparo="BUENO"; + }else{ + aptitudDisparo="MALO"; + } + }else{ + aptitudDisparo=""; + } + + parameters.put("aptitudDisparo", aptitudDisparo); + + //Balas testigo + String balasTestigo=" "; + if(this.record.getBalastestigo()!=null){ + if(this.record.getBalastestigo().equalsIgnoreCase("Y")){ + balasTestigo=MsgControlArmas.getProperty("lbl_si"); + }else{ + balasTestigo="NO"; + } + }else{ + balasTestigo=""; + } + parameters.put("balasTestigo", balasTestigo); + + //Vainas testigo + String vainasTestigo=" "; + if(this.record.getVainastestigo()!=null){ + if(this.record.getVainastestigo().equalsIgnoreCase("Y")){ + vainasTestigo=MsgControlArmas.getProperty("lbl_si"); + }else{ + vainasTestigo="NO"; + } + }else{ + vainasTestigo=""; + } + parameters.put("vainasTestigo", vainasTestigo); + + //Estado final + String estadoFinal=" "; + if(this.record.getApruebaevaluacion()!=null){ + if(this.record.getApruebaevaluacion().equalsIgnoreCase("Y")){ + estadoFinal="APROBADA"; + }else{ + estadoFinal="REPROBADA"; + } + }else{ + estadoFinal=""; + } + parameters.put("estadoFinal", estadoFinal); + //Codigo de persona + parameters.put("personcode",record.getPersoncode()); + //Codigo de arma + parameters.put("codArma", record.getCarma()); + //codigo solicitud + parameters.put("csolicitud", this.codigoSolicitud); + //Grado del funcionario + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if(grado != null){ + gradoUsuario = grado.getDescription()+" - "+this.responsableCentroControl.getName(); + }else{ + gradoUsuario = "Sin Grado - "+this.responsableCentroControl.getName(); + } + parameters.put("personcode",responsableCentroControl.getPk().getPersoncode()); + parameters.put("gradoUsuario", gradoUsuario); + String format = "pdf"; + +// String nombreArchivo = soloNombreArchivo(armaPruebasObj.getXpathfichatecarmas()); +// String pathArchivo = obtenerXpath(armaPruegetxbasObj.getXpathfichatecarmas()); + if(this.record.getXpathfichatecarmas()!=null){ + this.xpathflujo = obtenerXpath(this.record.getXpathfichatecarmas()); + this.fec_actual = obtenerFechaEmision(this.record.getXpathfichatecarmas()); + }else if(this.record.getXpathfotografia()!=null){ + this.xpathflujo = obtenerXpathDesdeFotografia(this.record.getXpathfotografia()); + this.fec_actual = obtenerFechaEmision(this.record.getXpathfotografia()); + }else if(this.record.getXpathimpronta()!=null){ + this.xpathflujo = obtenerXpathDesdeImpronta(this.record.getXpathimpronta()); + this.fec_actual = obtenerFechaEmision(this.record.getXpathimpronta()); + } + if(xpathflujo!=null){ + parameters.put("fechaActual", sdf.format(this.fec_actual)); + filename = filename + this.record.getPk().toString(); + InputStream report=this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + if(!this.alfrescoController.uploadFile(report, filename+".pdf", this.xpathflujo)){ + throw new Exception("ERROR AL CARGAR EL REPORTE"); + } + this.record.setXpathfichatecarmas(this.xpathflujo + "/cm:" + filename+".pdf"); + update(); + save(); + fichasFaltantesParametro.setNumbervalue(new BigDecimal(i)); + parametersController.update(fichasFaltantesParametro); + parametersController.save(); + } + } + + + +// /** +// * Metodo para encontrar por codigo de solicitud +// * @param codigoSolicitud +// * @return registro de armaPrueba encontrado +// */ +// public List findPorSolicitud(String codigoSolicitud){ +// try { +// FichasTecnicasFlatantesController cc = new FichasTecnicasFlatantesController(); +// cc.init(); +// cc.recperpage = 300; +// cc.addFilter("csolicitud", codigoSolicitud); +// cc.querydatabaseArma(); +// if (cc.lrecord != null) { +// return cc.lrecord; +// } +// return null; +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// return null; +// } +// } + +// /** +// * Metodo para encontrar por codigo de solicitud +// * @param codigoSolicitud +// * @return registro de armaPrueba encontrado +// */ +// public static List buscarFichasPorSolicitud(String codigoSolicitud){ +// try { +// FichasTecnicasFlatantesController cc = new FichasTecnicasFlatantesController(); +// cc.init(); +// cc.recperpage = 300; +// cc.addFilter("csolicitud", codigoSolicitud); +// cc.querydatabaseArma(); +// if (cc.lrecord != null) { +// return cc.lrecord; +// } +// return null; +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// return null; +// } +// } + +// public TarmArmaPruebas find(String codigoSolicitud, String carma){ +// try { +// FichasTecnicasFlatantesController cc = new FichasTecnicasFlatantesController(); +// cc.init(); +// cc.recperpage = 300; +// cc.addFilter("carma", carma); +// cc.addFilter("csolicitud", codigoSolicitud); +// cc.querydatabaseArma(); +// if (cc.lrecord != null && cc.lrecord.size()>0) { +// return cc.lrecord.get(0); +// } +// return null; +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// return null; +// } +// } +// + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + + public TarmArmas getArma() { + return arma; + } + + public void setArma(TarmArmas arma) { + this.arma = arma; + } + + public String getEditarReg() { + return editarReg; + } + + public void setEditarReg(String editarReg) { + this.editarReg = editarReg; + } + + public String getCodigoSolicitud() { + return codigoSolicitud; + } + + public void setCodigoSolicitud(String codigoSolicitud) { + this.codigoSolicitud = codigoSolicitud; + } + + public List getListadoArmasPruebas() { + return listadoArmasPruebas; + } + + public void setListadoArmasPruebas(List listadoArmasPruebas) { + this.listadoArmasPruebas = listadoArmasPruebas; + } + + +// /** +// * metodo que registra el cambio de la seleccion del recuperador balisitico y segun esto aprueba la evaluacion +// */ +// public void cambia(TarmArmaPruebas armaPruebas){ +// record=null; +// record=armaPruebas; +// if("Y".equals(record.getAptituddisparo()) && "Y".equals(record.getVainastestigo()) && "Y".equals(record.getBalastestigo())){ +// record.setApruebaevaluacion("Y"); +// } +// else{ +// record.setApruebaevaluacion("N"); +// } +// habilitaButtom = true; +// armaPruebas.modifiedData().put("GUARDA", "N"); +// armaPruebas.modifiedData().put("IMPRIME", "N"); +// record.modifiedData().put("GUARDA", "N"); +// record.modifiedData().put("IMPRIME", "N"); +// } +// + + public String getObservacion() { + return observacion; + } + + public void setObservacion(String observacion) { + this.observacion = observacion; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public List getLaccion() { + return laccion; + } + + public void setLaccion(List laccion) { + this.laccion = laccion; + } + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public boolean isHabilitaButtom() { + return habilitaButtom; + } + + public void setHabilitaButtom(boolean habilitaButtom) { + this.habilitaButtom = habilitaButtom; + } + public String getFormato() { + return formato; + } + + public void setFormato(String formato) { + this.formato = formato; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public Boolean getBtnFlujo() { + return btnFlujo; + } + + public void setBtnFlujo(Boolean btnFlujo) { + this.btnFlujo = btnFlujo; + } + + public boolean isDeshabilitadoGenerarReporte() { + return deshabilitadoGenerarReporte; + } + + public void setDeshabilitadoGenerarReporte(boolean deshabilitadoGenerarReporte) { + this.deshabilitadoGenerarReporte = deshabilitadoGenerarReporte; + } + + + public void changeApruebaEvaluacion(){ + if(this.record.getAptituddisparo()!=null && ("Y".equalsIgnoreCase(this.record.getAptituddisparo())) && + (this.record.getBalastestigo()!=null && "Y".equalsIgnoreCase(this.record.getBalastestigo())) && + (this.record.getVainastestigo()!=null && "Y".equalsIgnoreCase(this.record.getVainastestigo()))){ + this.record.setApruebaevaluacion("Y"); + } + else{ + this.record.setApruebaevaluacion("N"); + } + } + + /** + * Metodo para encontrar por codigo de solicitud + * @param codigoSolicitud + * @return registro de armaPrueba encontrado + */ + public Integer numeroArmasEnSolicitud(String codigoSolicitud){ + try { + FichasTecnicasFlatantesController cc = new FichasTecnicasFlatantesController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("csolicitud", codigoSolicitud); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord.size(); + } + return 0; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return 0; + } + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + public TarmSolicitudTramite getSolicitudTramite() { + return solicitudTramite; + } + + public void setSolicitudTramite(TarmSolicitudTramite solicitudTramite) { + this.solicitudTramite = solicitudTramite; + } + + public TarmTramite getTramite() { + return tramite; + } + + public void setTramite(TarmTramite tramite) { + this.tramite = tramite; + } + + public TcustPersonAddress getDireccionCliente() { + return direccionCliente; + } + + public void setDireccionCliente(TcustPersonAddress direccionCliente) { + this.direccionCliente = direccionCliente; + } + + public String getProvincia() { + return provincia; + } + + public void setProvincia(String provincia) { + this.provincia = provincia; + } + + public String getCanton() { + return canton; + } + + public void setCanton(String canton) { + this.canton = canton; + } + + public String getCiudad() { + return ciudad; + } + + public void setCiudad(String ciudad) { + this.ciudad = ciudad; + } + + public String getDireccion() { + return direccion; + } + + public void setDireccion(String direccion) { + this.direccion = direccion; + } + + public TgeneCatalogDetail getEstadotramite() { + return estadotramite; + } + + public void setEstadotramite(TgeneCatalogDetail estadotramite) { + this.estadotramite = estadotramite; + } + + public TgeneCatalogDetail getUsoActividad() { + return usoActividad; + } + + public void setUsoActividad(TgeneCatalogDetail usoActividad) { + this.usoActividad = usoActividad; + } + + public TcustPersonDetail getPersonaDetalle() { + return personaDetalle; + } + + public void setPersonaDetalle(TcustPersonDetail personaDetalle) { + this.personaDetalle = personaDetalle; + } + + public TgeneCatalogDetail getIdentificacion() { + return identificacion; + } + + public void setIdentificacion(TgeneCatalogDetail identificacion) { + this.identificacion = identificacion; + } + + public TgeneCatalogDetail getDetallecatalogoTipoTramite() { + return detallecatalogoTipoTramite; + } + + public void setDetallecatalogoTipoTramite( + TgeneCatalogDetail detallecatalogoTipoTramite) { + this.detallecatalogoTipoTramite = detallecatalogoTipoTramite; + } + + public TgeneCatalogDetail getDetallecatalogo() { + return detallecatalogo; + } + + public void setDetallecatalogo(TgeneCatalogDetail detallecatalogo) { + this.detallecatalogo = detallecatalogo; + } + + public List getTarmArmaPruebasList() { + return tarmArmaPruebasList; + } + + public void setTarmArmaPruebasList(List tarmArmaPruebasList) { + this.tarmArmaPruebasList = tarmArmaPruebasList; + } + + public ArmasController getArmas() { + return armas; + } + + public void setArmas(ArmasController armas) { + this.armas = armas; + } + + public Integer getcPruebaInicio() { + return cPruebaInicio; + } + + public void setcPruebaInicio(Integer cPruebaInicio) { + this.cPruebaInicio = cPruebaInicio; + } + + public Integer getcPruebaFin() { + return cPruebaFin; + } + + public void setcPruebaFin(Integer cPruebaFin) { + this.cPruebaFin = cPruebaFin; + } + + public TgeneParameters getFichasFaltantesParametro() { + return fichasFaltantesParametro; + } + + public void setFichasFaltantesParametro(TgeneParameters fichasFaltantesParametro) { + this.fichasFaltantesParametro = fichasFaltantesParametro; + } + + public ParametersController getParametersController() { + return parametersController; + } + + public void setParametersController(ParametersController parametersController) { + this.parametersController = parametersController; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/FichasTecnicasFlatantesController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/FichasTecnicasFlatantesController.java.svn-base new file mode 100644 index 0000000..83a6f5a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/FichasTecnicasFlatantesController.java.svn-base @@ -0,0 +1,1201 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.CashManagementHistoryController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmaPruebas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * + * Genrera fichas tecnicas de armas faltantes + * @author Christian Pazmino + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class FichasTecnicasFlatantesController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 8843091476010012919L; + + /** + * Controlador que maneja alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * Controlador que maneja reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{armasController}") + private ArmasController armas; + + private TarmArmas arma = new TarmArmas(); + + private String editarReg; + + private String codigoSolicitud; + + private boolean habilitaButtom; + + private TarmCentroControl centroControl = new TarmCentroControl(); + + private List listadoArmasPruebas = new ArrayList<>(); + + private String observacion; + + private String estado; + + private Date fec_actual; + + private String formato; + + private String xpathflujo; + + private TcustPersonDetail responsableCentroControl= null; + + private TsafeUserDetail tsafeUserDetailUsuario = null; + + private Boolean btnFlujo; + + private List tarmArmaPruebasList; + /** + * lista del catalogo de las acciones (Aceptar o rechazar) + */ + private List laccion; + + private boolean deshabilitadoGenerarReporte=true; + + private TarmSolicitud solicitud; + private TarmSolicitudTramite solicitudTramite; + private TarmTramite tramite; + private TcustPersonAddress direccionCliente; + private String provincia; + private String canton; + private String ciudad; + private String direccion; + private TgeneCatalogDetail estadotramite; + private TgeneCatalogDetail usoActividad; + private TcustPersonDetail personaDetalle; + private TgeneCatalogDetail identificacion; + private TgeneCatalogDetail detallecatalogoTipoTramite; + private TgeneCatalogDetail detallecatalogo; + private TgeneParameters fichasFaltantesParametro; + + private Integer cPruebaInicio; + private Integer cPruebaFin; + + /** + * Controlador que maneja los datos de generacion ultima vez del reporte + */ + @ManagedProperty(value = "#{parametersController}") + private ParametersController parametersController; + + + public FichasTecnicasFlatantesController() throws Exception { + super(TarmArmaPruebas.class); + } + + @PostConstruct + private void postconstruct() { + try { + init(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + + } + } + + + private void init() { + recperpage = 13000; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + record=new TarmArmaPruebas(); + beanalias = "INGRESOFICHASFALTANTES"; + fichasFaltantesParametro =ParametersController.find("FICHASFALTANTES", "1"); + cPruebaInicio = fichasFaltantesParametro.getNumbervalue().intValue(); + cPruebaFin = 13187; + } + + + @Override + public void create() throws Exception { + super.create(); + } + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void uploadImpronta(FileUploadEvent event) { + record.modifiedData().put("FileUploadImpronta", event.getFile()); + } + + public void uploadFoto(FileUploadEvent event) { + record.modifiedData().put("FileUploadFoto", event.getFile()); + } + + public void generarReportesFaltantes(){ + try{ + for(int i=cPruebaInicio;i<=cPruebaFin;i++){ + this.record = IngresoFichaTecnicaArmasController.findByPk(String.valueOf(i)); + + // Comentar numeroArmasEnSolicitud(xxx) para volver a generar cualquier ficha de solicitud con una unica arma.. + // Validamos solo para solicitudes que tienen path y cuya solicitud tiene mas de una arma + if(this.record!=null && numeroArmasEnSolicitud(record.getCsolicitud())>1 && (this.record.getXpathfichatecarmas()!=null || this.record.getXpathfotografia()!=null || this.record.getXpathimpronta()!=null)){ + System.out.println("*****GENERACION DE FICHA TECNICA: "+i+" *****"); + this.solicitud = SolicitudArmasController.findByCSolicitud(this.record.getCsolicitud()); + this.codigoSolicitud = solicitud.getPk(); + this.solicitudTramite=SolicitudTramiteController.findByCSolicitud(codigoSolicitud); + this.tramite=TarmTramiteController.find(solicitud.getCtramite()+""); + this.personaDetalle = PersonDetailController.find(String.valueOf(solicitud.getPersoncode())); + direccionCliente=PersonAddressController.find(String.valueOf(solicitud.getPersoncode())) ; + provincia = direccionCliente.modifiedData().get("provincia")==null?null: direccionCliente.modifiedData().get("provincia").toString(); //personAddressController.getLprovinces()==null || .getLprovinces().isEmpty()?null:personAddressController.getLprovinces().get(0); + canton = direccionCliente.modifiedData().get("canton")==null?null: direccionCliente.modifiedData().get("canton").toString();//personAddressController.getLcantones()==null || personAddressController.getLcantones().isEmpty()?null:personAddressController.getLcantones().get(0); + ciudad = direccionCliente.modifiedData().get("ciudad")==null?null: direccionCliente.modifiedData().get("ciudad").toString();//personAddressController.getLcities()==null || personAddressController.getLcities().isEmpty()?null:personAddressController.getLcities().get(0); + direccion= direccionCliente.getAddress(); + estadotramite = (solicitudTramite.getEstadotramite()==null || solicitudTramite.getEstadotramitecodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(solicitudTramite.getEstadotramite(), solicitudTramite.getEstadotramitecodigo()); + usoActividad = (tramite.getUsoactividad()==null || tramite.getUsoactividadcodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + identificacion = (personaDetalle.getIdentificationcatalog()==null || personaDetalle.getIdentificationcatalogcode()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(personaDetalle.getIdentificationcatalog(), personaDetalle.getIdentificationcatalogcode()); + detallecatalogoTipoTramite = (tramite.getTipoautorizacion()==null || tramite.getTipoautorizacioncodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + detallecatalogo = (tramite.getCategoria()==null || tramite.getCategoriacodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + this.obtenerCentroControl(); + this.obtenerResponsableCentroControl(); + reporteFichaArmas(i); + } + } + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Metodo para extrer solo el nombre del archivo + * @param xpath xpath del archivo en alfresco + * @return solo la parte correspondiente al nombre del archivo + */ + public String soloNombreArchivo(String xpath){ + return xpath.substring(xpath.lastIndexOf(":") + 1,xpath.length()); + } + + /** + * Retorna el xpath de la ruta en donde se va a almacenar el documento + * @param xpath ruta en donde se almacenará el archivo + * @return + */ + private String obtenerXpath(String xpath) { + String rutaXpath = null; + int indice = xpath.lastIndexOf("/cm:"); + rutaXpath = xpath.substring(0, indice); + return rutaXpath; + } + + /** + * Retorna el xpath de la ruta en donde se va a almacenar el documento + * @param xpath ruta en donde se almacenará el archivo + * @return + */ + private String obtenerXpathDesdeFotografia(String xpath) { + String rutaXpath = null; + int indice = xpath.lastIndexOf("/cm:fotografia/cm:"); + rutaXpath = xpath.substring(0, indice); + return rutaXpath; + } + + private String obtenerXpathDesdeImpronta(String xpath) { + String rutaXpath = null; + int indice = xpath.lastIndexOf("/cm:impronta/cm:"); + rutaXpath = xpath.substring(0, indice); + return rutaXpath; + } + + private Date obtenerFechaEmision(String xpath) { + String rutaXpath = null; + int indice = xpath.lastIndexOf("/cm:SOL-"); + rutaXpath = xpath.substring(0, indice); + rutaXpath=rutaXpath.replace("cm:Solicitudes/cm:A-", "").replace("/cm:M", "").replace("/cm:D", ""); + Calendar cal = Calendar.getInstance(); + cal.set(Calendar.YEAR, Integer.valueOf(rutaXpath.substring(0, 4))); + cal.set(Calendar.MONTH, Integer.valueOf(rutaXpath.substring(5, 7))); + cal.set(Calendar.DAY_OF_MONTH, Integer.valueOf(rutaXpath.substring(8, 10))); + return cal.getTime(); + } + + + /** + * @return + * @throws Exception + */ + public String codigoAceptado() throws Exception { + TgeneParameters f = ParametersController.find("ACEPTADO", "1"); + return f.getTextvalue(); + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + + /** + * Metodo que indica si se debe habilitar el boton del pantalla ficha tecnica + */ + public void habilitarBoton() { + this.habilitaButtom = true; + } + + + /** + * Metodo que indica si se debe habilitar el boton del pantalla ficha tecnica + */ + public void cerrar() { + if(record.modifiedData().get("GUARDA")!=null && record.modifiedData().get("GUARDA").equals("S") && + record.modifiedData().get("IMPRIME")!=null && record.modifiedData().get("IMPRIME").equals("S") ){ + }else{ + MessageHelper.setMessageError("GUARDE Y GENERE EL REPORTE"); + } + } + + + /** + * Ejecuta reporte de registro balistico + * + */ + public void reporteRegistroBalistico() { + try { + String gradoUsuario =""; + String path = "armas/reports/registroBalistico"; + String filename=MsgControlArmas.getProperty("lbl_registroBalistico"); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + + //Logos + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Obteniendo la solicitud + TarmSolicitud solicitud=SolicitudController.findSolicitudxcodsolicitud(this.codigoSolicitud); + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + + //Codigo solicitud + parameters.put("csolicitud", this.codigoSolicitud); + + //Fecha de solicitud + parameters.put("fechaSolicitud", sdf.format(solicitud.getFregistro())); + + //Obteniendo los datos del tramite + TarmTramite tramite=TarmTramiteController.find(solicitud.getCtramite().toString()); + TgeneCatalogDetail tipoTramite=CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + TgeneCatalogDetail categoria=CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + TarmSolicitudTramite solicitudTramite=SolicitudTramiteController.findByCSolicitud(this.codigoSolicitud); + TgeneCatalogDetail tipoAutorizacion=CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail usoActividad=CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + + //Tipo de tramite + if(tipoTramite!=null && tipoTramite.getDescription()!=null){ + parameters.put("tipoTramite", tipoTramite.getDescription()); + }else{ + parameters.put("tipoTramite", " "); + } + + //Categoria + if(categoria!=null && categoria.getDescription()!=null){ + parameters.put("categoria", categoria.getDescription()); + }else{ + parameters.put("categoria", " "); + } + + //No tramite + if(solicitudTramite!=null){ + parameters.put("noTramite", solicitudTramite.getNumerotramite()); + }else{ + parameters.put("noTramite", " "); + } + + //Tipo de autorizacion + if(tipoAutorizacion!=null && tipoAutorizacion.getDescription()!=null){ + parameters.put("tipoAutorizacion", tipoAutorizacion.getDescription()); + }else{ + parameters.put("tipoAutorizacion", " "); + } + + //Uso-actividad + if(usoActividad!=null && usoActividad.getDescription()!=null){ + parameters.put("usoActividad", usoActividad.getDescription()); + }else{ + parameters.put("usoActividad", " "); + } + + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if(grado != null){ + gradoUsuario = grado.getDescription()+" - "+this.responsableCentroControl.getName(); + }else{ + gradoUsuario = "Sin Grado - "+this.responsableCentroControl.getName(); + } + TcustPersonDetail person = PersonDetailController.find(String.valueOf(solicitud.getPersoncode())); + //PersonDetailController.find(String.valueOf(solicitud.getPersoncode())); + //Fecha + parameters.put("fechaActual", sdf.format(this.fec_actual)); + parameters.put("fecActualHora", new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss").format(this.fec_actual)); + parameters.put("personCode", person.getPk().getPersoncode()); + parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("usuario", this.tsafeUserDetailUsuario.getNickname()); + String format = this.formato; + try { + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + btnFlujo=Boolean.TRUE; + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if(tcustPersonAddres == null){ + return null; + } + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl(){ + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + +// public void saveImprimir() { +// try { +//// if(!record.modifiedData().get("GUARDA").equals("S")){ +//// MessageHelper.setMessageError("GUARDE LA FICHA PARA GENERAR EL REPORTE"); +//// return; +//// } +// reporteFichaArmas(); +// record.setIsimpreso("Y"); +// update(); +// Request request = callerhelper.getRequest(); +// HashMap msave = new HashMap(); +// request.setSaveTables(msave); +// DtoSave dtosave = super.getDtoSave(); +// dtosave.setReturnpk(true); +// msave.put(beanalias, dtosave); +// request.setSaveTables(msave); +// Response resp = callerhelper.executeSave(request); +// if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { +// this.postCommit(resp); +// MessageHelper.setMessageInfo(resp); +// record.modifiedData().put("IMPRIME", "S"); +// MessageHelper.setMessageInfo(resp); +// } else { +// record.modifiedData().put("IMPRIME", "N"); +// MessageHelper.setMessageError(resp); +// } +// } catch (Throwable e) { +// record.modifiedData().put("IMPRIME", "N"); +// MessageHelper.setMessageError(e); +// } +// } + /** + * Obtiene el reporte de Ficha de Armas + * @throws Exception + */ + public void reporteFichaArmas(int i) throws Exception { + String gradoUsuario =""; + String path = "armas/reports/fichaTecArmas"; + TgeneParameters parametro=ParametersController.find("CODIGO.FICHANOLETAL", "1"); + if(parametro!=null && parametro.getTextvalue()!=null && !parametro.getTextvalue().trim().isEmpty()){ + String [] arrayCodTramite=parametro.getTextvalue().split(","); + ListlistaCodTraite=Arrays.asList(arrayCodTramite); + for (String item : listaCodTraite) { + Long codigotramite=Long.parseLong(item); + if(solicitud.getCtramite().equals(codigotramite) || + codigotramite.longValue()==solicitud.getCtramite().longValue()){ + path = "armas/reports/fichaTecArmasNoLetales"; + } + } + } + parametro=ParametersController.find("CODIGO.FICHACOLECCION", "1"); + if(parametro!=null && parametro.getTextvalue()!=null && !parametro.getTextvalue().trim().isEmpty()){ + String [] arrayCodTramite=parametro.getTextvalue().split(","); + ListlistaCodTraite=Arrays.asList(arrayCodTramite); + for (String item : listaCodTraite) { + Long codigotramite=Long.parseLong(item); + if(solicitud.getCtramite().equals(codigotramite) || + codigotramite.longValue()==solicitud.getCtramite().longValue()){ + path = "armas/reports/fichaTecArmasColeccion"; + } + } + } + String filename=MsgControlArmas.getProperty("lbl_fichaTecnicaArmas"); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + parameters.put("centroControl", this.obtenerCentroControl()); + + //Fecha actual + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + //Fecha de solicitud + if(solicitud!=null && solicitud.getFregistro()!=null){ + parameters.put("fechaSolicitud", sdf.format(solicitud.getFregistro())); + }else{ + parameters.put("fechaSolicitud", " "); + } + //No tramite + if(solicitudTramite!=null && solicitudTramite.getNumerotramite()!=null){ + parameters.put("noTramite", solicitudTramite.getNumerotramite()); + }else{ + parameters.put("noTramite", " "); + } + + //Tipo de tramites + if(detallecatalogoTipoTramite!=null && detallecatalogoTipoTramite.getDescription()!=null){ + parameters.put("tipoTramite", detallecatalogoTipoTramite.getDescription()); + }else{ + parameters.put("tipoTramite", " "); + } + //Estado tramite + if(estadotramite!=null && estadotramite.getDescription()!=null){ + parameters.put("estadoTramite", estadotramite.getDescription()); + }else{ + parameters.put("estadoTramite", " "); + } + + //Uso actividad + if(usoActividad!=null && usoActividad.getDescription()!=null){ + parameters.put("usoActividad",usoActividad.getDescription()); + }else{ + parameters.put("usoActividad", " "); + } + //Tipo de documento + if(identificacion!=null){ + parameters.put("tipoDocumento", identificacion.getDescription()); + }else{ + parameters.put("tipoDocumento", " "); + } + //No documento + if(personaDetalle!=null){ + parameters.put("cedula", personaDetalle.getIdentification()); + }else{ + parameters.put("cedula", " "); + } + //Nombre razon social + if(personaDetalle!=null){ + parameters.put("nombreRazon", personaDetalle.getName()); + }else{ + parameters.put("nombreRazon", " "); + } + //Provincia + if(provincia !=null){ + parameters.put("provincia", provincia); + }else{ + parameters.put("provincia", " "); + } + //Canton + if(canton!=null){ + parameters.put("canton", canton); + }else{ + parameters.put("canton", " "); + } + //Ciudad + if(ciudad!=null){ + parameters.put("ciudad", ciudad); + }else{ + parameters.put("ciudad", " "); + } + //Direccion + if(direccion!=null){ + parameters.put("direccion",direccion); + }else{ + parameters.put("direccion", " "); + } + //Codigo de arma + parameters.put("codigoArma", this.record.getCarma()); + //Codigo de registro de TarmArmaPrueba + parameters.put("cArmaPrueba", record.getPk().toString()); + TarmArmas arma= ArmasController.findPorCodigo(this.record.getCarma()); + TarmRegistroArmas regArma = RegistroArmController.findByCodigo(arma.getCregistro().toString()); + TgeneCountry paisOrigen=CountryController.findcountry(regArma.getPaisorigen()); + //Clase + if(arma.getModifiedData().get("clase")!=null){ + parameters.put("clase", arma.getModifiedData().get("clase")==null?"":arma.getModifiedData().get("clase")); + }else{ + parameters.put("clase", " "); + } + //Obtniendo el tipo arma explosivo + TarmTipoArmaExplosivo tae=arma==null?null:TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo()); + //Tipo arma + TgeneCatalogDetail tipoArma=tae==null?null:CatalogDetailController.findxCodigoCodcatalogo(tae.getTipoarmaexplosivo(), "TIPOARMAEXPLOSIVO"); + parameters.put("tipoArma", (tipoArma==null || tipoArma.getDescription().isEmpty())?"": tipoArma.getDescription()); + //Serie + parameters.put("serie", (arma==null || arma.getLote()==null || arma.getLote().isEmpty())?"":arma.getLote()); + //Pais fabricacion + parameters.put("paisFabricacion", (paisOrigen==null)?"":(paisOrigen.getDescription())); + //Calibre + parameters.put("calibre", (arma.getModifiedData().get("calibre")==null)?"":arma.getModifiedData().get("calibre")); + //Longitud + TgeneCatalogDetail longitud=(tae==null || tae.getLongitud()==null || tae.getLongitudcodigo()==null || tae.getLongitud().isEmpty() || tae.getLongitudcodigo().isEmpty())?null:CatalogDetailController.findxCodigoCodcatalogo(tae.getLongitud(),tae.getLongitudcodigo()); + if(longitud!=null && longitud.getDescription()!=null){ + parameters.put("longitud", longitud.getDescription()); + }else{ + parameters.put("longitud", " "); + } + //Marca + parameters.put("marca", arma.getModifiedData().get("marca")); + //Modelo + parameters.put("modelo", arma.getModelo()); + //Color + parameters.put("color", arma.getModifiedData().get("color")); + //Observacion + parameters.put("observacion", this.record.getObservacion()); + //Aptitud de disparo + String aptitudDisparo=" "; + if(this.record.getAptituddisparo()!=null){ + if(this.record.getAptituddisparo().equalsIgnoreCase("Y")){ + aptitudDisparo="BUENO"; + }else{ + aptitudDisparo="MALO"; + } + }else{ + aptitudDisparo=""; + } + + parameters.put("aptitudDisparo", aptitudDisparo); + + //Balas testigo + String balasTestigo=" "; + if(this.record.getBalastestigo()!=null){ + if(this.record.getBalastestigo().equalsIgnoreCase("Y")){ + balasTestigo=MsgControlArmas.getProperty("lbl_si"); + }else{ + balasTestigo="NO"; + } + }else{ + balasTestigo=""; + } + parameters.put("balasTestigo", balasTestigo); + + //Vainas testigo + String vainasTestigo=" "; + if(this.record.getVainastestigo()!=null){ + if(this.record.getVainastestigo().equalsIgnoreCase("Y")){ + vainasTestigo=MsgControlArmas.getProperty("lbl_si"); + }else{ + vainasTestigo="NO"; + } + }else{ + vainasTestigo=""; + } + parameters.put("vainasTestigo", vainasTestigo); + + //Estado final + String estadoFinal=" "; + if(this.record.getApruebaevaluacion()!=null){ + if(this.record.getApruebaevaluacion().equalsIgnoreCase("Y")){ + estadoFinal="APROBADA"; + }else{ + estadoFinal="REPROBADA"; + } + }else{ + estadoFinal=""; + } + parameters.put("estadoFinal", estadoFinal); + //Codigo de persona + parameters.put("personcode",record.getPersoncode()); + //Codigo de arma + parameters.put("codArma", record.getCarma()); + //codigo solicitud + parameters.put("csolicitud", this.codigoSolicitud); + //Grado del funcionario + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if(grado != null){ + gradoUsuario = grado.getDescription()+" - "+this.responsableCentroControl.getName(); + }else{ + gradoUsuario = "Sin Grado - "+this.responsableCentroControl.getName(); + } + parameters.put("personcode",responsableCentroControl.getPk().getPersoncode()); + parameters.put("gradoUsuario", gradoUsuario); + String format = "pdf"; + +// String nombreArchivo = soloNombreArchivo(armaPruebasObj.getXpathfichatecarmas()); +// String pathArchivo = obtenerXpath(armaPruegetxbasObj.getXpathfichatecarmas()); + if(this.record.getXpathfichatecarmas()!=null){ + this.xpathflujo = obtenerXpath(this.record.getXpathfichatecarmas()); + this.fec_actual = obtenerFechaEmision(this.record.getXpathfichatecarmas()); + }else if(this.record.getXpathfotografia()!=null){ + this.xpathflujo = obtenerXpathDesdeFotografia(this.record.getXpathfotografia()); + this.fec_actual = obtenerFechaEmision(this.record.getXpathfotografia()); + }else if(this.record.getXpathimpronta()!=null){ + this.xpathflujo = obtenerXpathDesdeImpronta(this.record.getXpathimpronta()); + this.fec_actual = obtenerFechaEmision(this.record.getXpathimpronta()); + } + if(xpathflujo!=null){ + parameters.put("fechaActual", sdf.format(this.fec_actual)); + filename = filename + this.record.getPk().toString(); + InputStream report=this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + if(!this.alfrescoController.uploadFile(report, filename+".pdf", this.xpathflujo)){ + throw new Exception("ERROR AL CARGAR EL REPORTE"); + } + this.record.setXpathfichatecarmas(this.xpathflujo + "/cm:" + filename+".pdf"); + update(); + save(); + fichasFaltantesParametro.setNumbervalue(new BigDecimal(i)); + parametersController.update(fichasFaltantesParametro); + parametersController.save(); + } + } + + + +// /** +// * Metodo para encontrar por codigo de solicitud +// * @param codigoSolicitud +// * @return registro de armaPrueba encontrado +// */ +// public List findPorSolicitud(String codigoSolicitud){ +// try { +// FichasTecnicasFlatantesController cc = new FichasTecnicasFlatantesController(); +// cc.init(); +// cc.recperpage = 300; +// cc.addFilter("csolicitud", codigoSolicitud); +// cc.querydatabaseArma(); +// if (cc.lrecord != null) { +// return cc.lrecord; +// } +// return null; +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// return null; +// } +// } + +// /** +// * Metodo para encontrar por codigo de solicitud +// * @param codigoSolicitud +// * @return registro de armaPrueba encontrado +// */ +// public static List buscarFichasPorSolicitud(String codigoSolicitud){ +// try { +// FichasTecnicasFlatantesController cc = new FichasTecnicasFlatantesController(); +// cc.init(); +// cc.recperpage = 300; +// cc.addFilter("csolicitud", codigoSolicitud); +// cc.querydatabaseArma(); +// if (cc.lrecord != null) { +// return cc.lrecord; +// } +// return null; +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// return null; +// } +// } + +// public TarmArmaPruebas find(String codigoSolicitud, String carma){ +// try { +// FichasTecnicasFlatantesController cc = new FichasTecnicasFlatantesController(); +// cc.init(); +// cc.recperpage = 300; +// cc.addFilter("carma", carma); +// cc.addFilter("csolicitud", codigoSolicitud); +// cc.querydatabaseArma(); +// if (cc.lrecord != null && cc.lrecord.size()>0) { +// return cc.lrecord.get(0); +// } +// return null; +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// return null; +// } +// } +// + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + + public TarmArmas getArma() { + return arma; + } + + public void setArma(TarmArmas arma) { + this.arma = arma; + } + + public String getEditarReg() { + return editarReg; + } + + public void setEditarReg(String editarReg) { + this.editarReg = editarReg; + } + + public String getCodigoSolicitud() { + return codigoSolicitud; + } + + public void setCodigoSolicitud(String codigoSolicitud) { + this.codigoSolicitud = codigoSolicitud; + } + + public List getListadoArmasPruebas() { + return listadoArmasPruebas; + } + + public void setListadoArmasPruebas(List listadoArmasPruebas) { + this.listadoArmasPruebas = listadoArmasPruebas; + } + + +// /** +// * metodo que registra el cambio de la seleccion del recuperador balisitico y segun esto aprueba la evaluacion +// */ +// public void cambia(TarmArmaPruebas armaPruebas){ +// record=null; +// record=armaPruebas; +// if("Y".equals(record.getAptituddisparo()) && "Y".equals(record.getVainastestigo()) && "Y".equals(record.getBalastestigo())){ +// record.setApruebaevaluacion("Y"); +// } +// else{ +// record.setApruebaevaluacion("N"); +// } +// habilitaButtom = true; +// armaPruebas.modifiedData().put("GUARDA", "N"); +// armaPruebas.modifiedData().put("IMPRIME", "N"); +// record.modifiedData().put("GUARDA", "N"); +// record.modifiedData().put("IMPRIME", "N"); +// } +// + + public String getObservacion() { + return observacion; + } + + public void setObservacion(String observacion) { + this.observacion = observacion; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public List getLaccion() { + return laccion; + } + + public void setLaccion(List laccion) { + this.laccion = laccion; + } + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public boolean isHabilitaButtom() { + return habilitaButtom; + } + + public void setHabilitaButtom(boolean habilitaButtom) { + this.habilitaButtom = habilitaButtom; + } + public String getFormato() { + return formato; + } + + public void setFormato(String formato) { + this.formato = formato; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public Boolean getBtnFlujo() { + return btnFlujo; + } + + public void setBtnFlujo(Boolean btnFlujo) { + this.btnFlujo = btnFlujo; + } + + public boolean isDeshabilitadoGenerarReporte() { + return deshabilitadoGenerarReporte; + } + + public void setDeshabilitadoGenerarReporte(boolean deshabilitadoGenerarReporte) { + this.deshabilitadoGenerarReporte = deshabilitadoGenerarReporte; + } + + + public void changeApruebaEvaluacion(){ + if(this.record.getAptituddisparo()!=null && ("Y".equalsIgnoreCase(this.record.getAptituddisparo())) && + (this.record.getBalastestigo()!=null && "Y".equalsIgnoreCase(this.record.getBalastestigo())) && + (this.record.getVainastestigo()!=null && "Y".equalsIgnoreCase(this.record.getVainastestigo()))){ + this.record.setApruebaevaluacion("Y"); + } + else{ + this.record.setApruebaevaluacion("N"); + } + } + + /** + * Metodo para encontrar por codigo de solicitud + * @param codigoSolicitud + * @return registro de armaPrueba encontrado + */ + public Integer numeroArmasEnSolicitud(String codigoSolicitud){ + try { + FichasTecnicasFlatantesController cc = new FichasTecnicasFlatantesController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("csolicitud", codigoSolicitud); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord.size(); + } + return 0; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return 0; + } + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + public TarmSolicitudTramite getSolicitudTramite() { + return solicitudTramite; + } + + public void setSolicitudTramite(TarmSolicitudTramite solicitudTramite) { + this.solicitudTramite = solicitudTramite; + } + + public TarmTramite getTramite() { + return tramite; + } + + public void setTramite(TarmTramite tramite) { + this.tramite = tramite; + } + + public TcustPersonAddress getDireccionCliente() { + return direccionCliente; + } + + public void setDireccionCliente(TcustPersonAddress direccionCliente) { + this.direccionCliente = direccionCliente; + } + + public String getProvincia() { + return provincia; + } + + public void setProvincia(String provincia) { + this.provincia = provincia; + } + + public String getCanton() { + return canton; + } + + public void setCanton(String canton) { + this.canton = canton; + } + + public String getCiudad() { + return ciudad; + } + + public void setCiudad(String ciudad) { + this.ciudad = ciudad; + } + + public String getDireccion() { + return direccion; + } + + public void setDireccion(String direccion) { + this.direccion = direccion; + } + + public TgeneCatalogDetail getEstadotramite() { + return estadotramite; + } + + public void setEstadotramite(TgeneCatalogDetail estadotramite) { + this.estadotramite = estadotramite; + } + + public TgeneCatalogDetail getUsoActividad() { + return usoActividad; + } + + public void setUsoActividad(TgeneCatalogDetail usoActividad) { + this.usoActividad = usoActividad; + } + + public TcustPersonDetail getPersonaDetalle() { + return personaDetalle; + } + + public void setPersonaDetalle(TcustPersonDetail personaDetalle) { + this.personaDetalle = personaDetalle; + } + + public TgeneCatalogDetail getIdentificacion() { + return identificacion; + } + + public void setIdentificacion(TgeneCatalogDetail identificacion) { + this.identificacion = identificacion; + } + + public TgeneCatalogDetail getDetallecatalogoTipoTramite() { + return detallecatalogoTipoTramite; + } + + public void setDetallecatalogoTipoTramite( + TgeneCatalogDetail detallecatalogoTipoTramite) { + this.detallecatalogoTipoTramite = detallecatalogoTipoTramite; + } + + public TgeneCatalogDetail getDetallecatalogo() { + return detallecatalogo; + } + + public void setDetallecatalogo(TgeneCatalogDetail detallecatalogo) { + this.detallecatalogo = detallecatalogo; + } + + public List getTarmArmaPruebasList() { + return tarmArmaPruebasList; + } + + public void setTarmArmaPruebasList(List tarmArmaPruebasList) { + this.tarmArmaPruebasList = tarmArmaPruebasList; + } + + public ArmasController getArmas() { + return armas; + } + + public void setArmas(ArmasController armas) { + this.armas = armas; + } + + public Integer getcPruebaInicio() { + return cPruebaInicio; + } + + public void setcPruebaInicio(Integer cPruebaInicio) { + this.cPruebaInicio = cPruebaInicio; + } + + public Integer getcPruebaFin() { + return cPruebaFin; + } + + public void setcPruebaFin(Integer cPruebaFin) { + this.cPruebaFin = cPruebaFin; + } + + public TgeneParameters getFichasFaltantesParametro() { + return fichasFaltantesParametro; + } + + public void setFichasFaltantesParametro(TgeneParameters fichasFaltantesParametro) { + this.fichasFaltantesParametro = fichasFaltantesParametro; + } + + public ParametersController getParametersController() { + return parametersController; + } + + public void setParametersController(ParametersController parametersController) { + this.parametersController = parametersController; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/GenerarOrdenTrabajoCustodiosController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/GenerarOrdenTrabajoCustodiosController.java.svn-base new file mode 100644 index 0000000..a15318c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/GenerarOrdenTrabajoCustodiosController.java.svn-base @@ -0,0 +1,699 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; +import org.apache.taglibs.standard.tag.common.fmt.BundleSupport; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmOrdenTrabajo; +import com.fp.persistence.parmas.soli.TarmOrdenTrabajoCustodios; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class GenerarOrdenTrabajoCustodiosController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private Date fechaHoy; + private Date inicio; + private Date fin; + private java.sql.Date fechaInicio; + private java.sql.Date fechaFin; + + private TarmSolicitud solicitud=new TarmSolicitud(); + private TarmSolicitudTramite solicitudTramite=new TarmSolicitudTramite(); + private TarmTramite tramite=new TarmTramite(); + private String usoActividad; + private Long numeroOrden; + + private String documentoReferencia; + private String empresa; + private String lugarDireccion; + private String ruta; + private String tiempoEstimado; + private String observaciones; + + private Boolean aceptarHabilitado=true; + + TcustPersonDetail detallesPersona=new TcustPersonDetail(); + + //Grados + List lGrados=new ArrayList(); + + TcustPersonDetail usuario; + TcustPersonDetail jefeCentroControl; + TarmCentroControl centroControl; + String nombreInstitucion=""; + String gradoFuncionario=""; + private String csolicitud; + private Boolean btnEnviar; + + @ManagedProperty(value = "#{ordenTrabajoController}") + private OrdenTrabajoController ordenTrabajoController; + + @ManagedProperty(value = "#{custodiosController}") + private CustodiosController custodiosController; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + public GenerarOrdenTrabajoCustodiosController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + startQuery(); + this.init(); + // Inicializa autoconsulta + // super.startQuery(); + } + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + csolicitud=super.getMfilters().get("csolicitud"); + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + fechaHoy=Calendar.getInstance().getTime(); + + this.ordenTrabajoController.create(); + this.custodiosController.create(); + this.lrecord = new ArrayList<>(); + this.beanalias="GENERARORDENCUSTODIOSCONTROLLER"; + //ordenTrabajoController.setRecord(new TarmOrdenTrabajo()); + + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + btnEnviar=Boolean.FALSE; + + querydatabase(); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @Override + public void query() throws Exception { + // TODO Auto-generated method stub + MessageHelper.setMessageError("msg_notQuery"); + super.query(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + //Obteniendo la solicitud + solicitud= ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(csolicitud); + if(solicitud!=null && solicitud.getPk()!=null){ + + //Datos de la persona + detallesPersona = PersonDetailController.find(String.valueOf(solicitud.getPersoncode().toString())); + + this.ordenTrabajoController.getRecord().setCsolicitud(solicitud.getPk()); + this.ordenTrabajoController.getRecord().setFsolicitud(solicitud.getFregistro()); + + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + + if(solicitudTramite!=null && solicitudTramite.getPk().getCtramite()!=null){ + + tramite=TarmTramiteController.find(solicitudTramite.getPk().getCtramite().toString()); + + if(tramite!=null && tramite.getPk()!=null){ + this.ordenTrabajoController.getRecord().setCtramite(tramite.getPk()); + + //Uso actividad + TgeneCatalogDetail catalogDetailTramite=CatalogDetailController.findxCodigoCodcatalogo(solicitudTramite.getEstadotramite(), solicitudTramite.getEstadotramitecodigo()); + catalogDetailTramite=CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + if(catalogDetailTramite!=null && tramite.getUsoactividad()!=null && tramite.getUsoactividadcodigo()!=null){ + usoActividad=catalogDetailTramite.getDescription(); + } + + } + } + + //Obteniendo el centro de control + centroControl=CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + if(centroControl!=null && centroControl.getNombreinstitucion()!=null && !centroControl.getNombreinstitucion().isEmpty() + && centroControl.getNombreinstitucioncodigo()!=null && !centroControl.getNombreinstitucioncodigo().isEmpty()){ + + TgeneCatalogDetail catalogoInstitucion=CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()); + this.nombreInstitucion=catalogoInstitucion.getDescription(); + } + + //Obteniendo el jefe del centro de control + this.jefeCentroControl=PersonDetailController.find(this.centroControl.getPersoncode().toString()); + + //Obteniendo el grado del jefe del centro de control + TgeneCatalogDetail grado=CatalogDetailController.findxCodigoCodcatalogo(this.jefeCentroControl.getMilitarygrade(), this.jefeCentroControl.getMilitarygradecode()); + if(grado!=null){ + gradoFuncionario=grado.getDescription()+" - "; + } + + } + + //Obteniendo la lista de grados militares + lGrados=CatalogDetailController.find("GRADOS"); + + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("querytype", "T"); + + Response resp = callerhelper.executeQuery(request); + + //Obteniendo el numero de orden + this.numeroOrden=Long.parseLong(resp.get("SECUENCIALSOLORDENTRABAJO").toString()); + this.ordenTrabajoController.getRecord().setPk(numeroOrden); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + + MessageHelper.setMessageError(resp); + } else { + super.postQuery(lrecord); + + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + if(custodiosController.getLrecord().isEmpty()){ + MessageHelper.setMessageError("LA ORDEN DE TRABAJO NO TIENE CUSTODIOS ASIGNADOS.", null); + }else{ + //Asignando los campos a la orden de trabajo + this.ordenTrabajoController.getRecord().setDocumentoreferencia(this.solicitudTramite.getNumerotramite()); + this.ordenTrabajoController.getRecord().setEmpresasolicita(this.detallesPersona.getName()); + this.ordenTrabajoController.getRecord().setDireccioncomision(this.lugarDireccion); + this.ordenTrabajoController.getRecord().setRuta(this.ruta); + this.ordenTrabajoController.getRecord().setTiempoestimado(this.tiempoEstimado); + + Calendar c=Calendar.getInstance(); + c.setTime(inicio); + fechaInicio=new java.sql.Date(c.getTimeInMillis()); + this.ordenTrabajoController.getRecord().setFinicio(this.fechaInicio); + + c=Calendar.getInstance(); + c.setTime(fin); + fechaFin=new java.sql.Date(c.getTimeInMillis()); + this.ordenTrabajoController.getRecord().setFfinalizacion(this.fechaFin); + + this.ordenTrabajoController.getRecord().setObservaciones(this.observaciones); + + this.ordenTrabajoController.update(); + this.ordenTrabajoController.getLrecord().add(this.ordenTrabajoController.getRecord()); + this.ordenTrabajoController.update(this.ordenTrabajoController.getLrecord().get(0)); + + this.custodiosController.setSalva(true); + for (TarmOrdenTrabajoCustodios custodio : this.custodiosController.getLrecord()) { + + //Asignando el codigo del grado + custodio.setCordentrabajo(this.numeroOrden); + this.custodiosController.update(custodio); + } + + + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + + DtoSave dtosaveOrdenTrabajo = this.ordenTrabajoController.getDtoSave(true); + dtosaveOrdenTrabajo.setPosition(1); + msave.put(this.ordenTrabajoController.getBeanalias(), dtosaveOrdenTrabajo); + + DtoSave dtosaveCustodios = this.custodiosController.getDtoSave(true); + dtosaveCustodios.setPosition(2); + msave.put(this.custodiosController.getBeanalias(), dtosaveCustodios); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.aceptarHabilitado=false; + this.ordenTrabajoController.postCommit(resp); + this.custodiosController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + this.ordenTrabajoController.postCommit(response); + this.custodiosController.postCommit(response); + } + + public void cancelar(){ + this.ordenTrabajoController.setRecord(new TarmOrdenTrabajo()); + this.custodiosController.getLrecord().clear(); + } + + /** + */ + @SuppressWarnings("finally") + public String grado(String grado, String gradoCodigo){ + String descripcionGrado=""; + try { + TgeneCatalogDetail catalogDetailTramite=CatalogDetailController.findxCodigoCodcatalogo(grado, gradoCodigo); + if(catalogDetailTramite!=null && grado!=null && gradoCodigo!=null){ + descripcionGrado=catalogDetailTramite.getDescription(); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + }finally{ + return descripcionGrado; + } + } + + /** + * Ejecuta un reporte de custodios + * @param name Nombre del reporte a generar. + */ + public void generateReport() { + String path = "armas/reports/ordenTrabajoCustodios"; + String filename=MsgControlArmas.getProperty("lbl_ordenTrabajoCustodios"); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("codigoOrden", this.numeroOrden.toString()); + + //Centro de control + parameters.put("nombreCentro", this.nombreInstitucion); + + //Numero de orden de trabajo + parameters.put("numeroOrdenTrabajo", this.numeroOrden); + + //Documento de referencia + parameters.put("documentoReferencia", this.solicitudTramite.getNumerotramite()); + + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("fecha", sdf.format(this.fechaHoy)); + + //Comision actividad + parameters.put("comisionActividad", "Custodia Militar"); + + //Empresa solicita + parameters.put("empresaSolicita", this.detallesPersona.getName()); + + //Tiempo estimado + parameters.put("tiempoEstimado", this.tiempoEstimado); + + //Fecha inicio + parameters.put("fechaInicio", sdf.format(this.inicio)); + + //Fecha fin + parameters.put("fechaFin", sdf.format(this.fin)); + + //Lugar + parameters.put("lugar", this.lugarDireccion); + + //Ruta + parameters.put("ruta", this.ruta); + + //Funcionario + parameters.put("gradoNombreFuncionario",gradoFuncionario+this.jefeCentroControl.getName()); + parameters.put("personcode",this.jefeCentroControl.getPk().getPersoncode()); + parameters.put("centroControl","JEFE DEL "+this.nombreInstitucion); + + + //Usuario + parameters.put("usuario",this.usuario.getName()); + sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + String fechaHora=sdf.format(Calendar.getInstance().getTime()); + parameters.put("fechaHora",fechaHora); + + parameters.put("codigoQR",csolicitud+" "+ fechaHora+" "+" "+sdf.format(this.fin)+" "+gradoFuncionario+this.jefeCentroControl.getName()); + + String format = "pdf"; + + try { + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + btnEnviar=Boolean.TRUE; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public void probarReporte() { + try { + TarmOrdenTrabajo orden=ordenTrabajoController.find("128"); + + String path = "armas/reports/ordenTrabajoCustodios"; + String filename=MsgControlArmas.getProperty("lbl_ordenTrabajoCustodios"); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("codigoOrden", "128"); + + //Centro de control + parameters.put("nombreCentro", this.nombreInstitucion); + + //Numero de orden de trabajo + parameters.put("numeroOrdenTrabajo", 128L); + + //Documento de referencia + parameters.put("documentoReferencia", this.solicitudTramite.getNumerotramite()); + + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("fecha", sdf.format(this.fechaHoy)); + + //Comision actividad + parameters.put("comisionActividad", "Custodia Militar"); + + //Empresa solicita + parameters.put("empresaSolicita", this.detallesPersona.getName()); + + //Tiempo estimado + parameters.put("tiempoEstimado", orden.getTiempoestimado()); + + //Fecha inicio + parameters.put("fechaInicio", sdf.format(orden.getFinicio())); + + //Fecha fin + parameters.put("fechaFin", sdf.format(orden.getFfinalizacion())); + + //Lugar + parameters.put("lugar", orden.getDireccioncomision()); + + //Ruta + parameters.put("ruta", orden.getRuta()); + + //Funcionario + parameters.put("gradoNombreFuncionario",gradoFuncionario+this.jefeCentroControl.getName()); + parameters.put("personcode",this.jefeCentroControl.getPk().getPersoncode()); + parameters.put("centroControl","JEFE DEL "+this.nombreInstitucion); + + //Usuario + parameters.put("usuario",this.usuario.getName()); + sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + String fechaHora=sdf.format(Calendar.getInstance().getTime()); + parameters.put("fechaHora",fechaHora); + + String format = "pdf"; + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + if(!btnEnviar){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_avanzar_flujo")); + return; + } + + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("csolicitud", csolicitud); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + btnEnviar=Boolean.FALSE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public OrdenTrabajoController getOrdenTrabajoController() { + return ordenTrabajoController; + } + + public void setOrdenTrabajoController( + OrdenTrabajoController ordenTrabajoController) { + this.ordenTrabajoController = ordenTrabajoController; + } + + public CustodiosController getCustodiosController() { + return custodiosController; + } + + public void setCustodiosController(CustodiosController custodiosController) { + this.custodiosController = custodiosController; + } + + public Date getFechaHoy() { + return fechaHoy; + } + + public void setFechaHoy(Date fechaHoy) { + this.fechaHoy = fechaHoy; + } + + public Date getFechaInicio() { + return fechaInicio; + } + + public void setFechaInicio(java.sql.Date fechaInicio) { + this.fechaInicio = fechaInicio; + } + + public Date getFechaFin() { + return fechaFin; + } + + public void setFechaFin(java.sql.Date fechaFin) { + this.fechaFin = fechaFin; + } + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + public TarmSolicitudTramite getSolicitudTramite() { + return solicitudTramite; + } + + public void setSolicitudTramite(TarmSolicitudTramite solicitudTramite) { + this.solicitudTramite = solicitudTramite; + } + + public TarmTramite getTramite() { + return tramite; + } + + public void setTramite(TarmTramite tramite) { + this.tramite = tramite; + } + + public String getUsoActividad() { + return usoActividad; + } + + public void setUsoActividad(String usoActividad) { + this.usoActividad = usoActividad; + } + + public List getlGrados() { + return lGrados; + } + + public void setlGrados(List lGrados) { + this.lGrados = lGrados; + } + + public Long getNumeroOrden() { + return numeroOrden; + } + + public void setNumeroOrden(Long numeroOrden) { + this.numeroOrden = numeroOrden; + } + + public String getDocumentoReferencia() { + return documentoReferencia; + } + + public void setDocumentoReferencia(String documentoReferencia) { + this.documentoReferencia = documentoReferencia; + } + + public String getEmpresa() { + return empresa; + } + + public void setEmpresa(String empresa) { + this.empresa = empresa; + } + + public String getLugarDireccion() { + return lugarDireccion; + } + + public void setLugarDireccion(String lugarDireccion) { + this.lugarDireccion = lugarDireccion; + } + + public String getRuta() { + return ruta; + } + + public void setRuta(String ruta) { + this.ruta = ruta; + } + + public String getObservaciones() { + return observaciones; + } + + public void setObservaciones(String observaciones) { + this.observaciones = observaciones; + } + + public String getTiempoEstimado() { + return tiempoEstimado; + } + + public void setTiempoEstimado(String tiempoEstimado) { + this.tiempoEstimado = tiempoEstimado; + } + + public Date getInicio() { + return inicio; + } + + public void setInicio(Date inicio) { + this.inicio = inicio; + } + + public Date getFin() { + return fin; + } + + public void setFin(Date fin) { + this.fin = fin; + } + + public Boolean getAceptarHabilitado() { + return aceptarHabilitado; + } + + public void setAceptarHabilitado(Boolean aceptarHabilitado) { + this.aceptarHabilitado = aceptarHabilitado; + } + + public TcustPersonDetail getDetallesPersona() { + return detallesPersona; + } + + public void setDetallesPersona(TcustPersonDetail detallesPersona) { + this.detallesPersona = detallesPersona; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public Boolean getBtnEnviar() { + return btnEnviar; + } + + public void setBtnEnviar(Boolean btnEnviar) { + this.btnEnviar = btnEnviar; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ImportacionProduccionController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ImportacionProduccionController.java.svn-base new file mode 100644 index 0000000..cd5f404 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ImportacionProduccionController.java.svn-base @@ -0,0 +1,2257 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.apache.commons.lang3.StringUtils; +import org.primefaces.context.RequestContext; +import org.primefaces.event.SelectEvent; +import org.primefaces.extensions.component.inputnumber.InputNumber; + +import com.fp.common.helper.Constant; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.CargaController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.lov.ArmaExplosivoLovController; +import com.fp.frontend.controller.armas.lov.CargasLovController; +import com.fp.frontend.controller.armas.parametros.CalibreLovController; +import com.fp.frontend.controller.armas.parametros.ClaseLovController; +import com.fp.frontend.controller.armas.parametros.LongitudLovController; +import com.fp.frontend.controller.armas.parametros.TipoArmaExpLovController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.frontend.utility.ValidateIdentification; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Controlador principal de armas + * @author Christian Pazmino + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ImportacionProduccionController extends AbstractController { + + private Boolean estadoDesaduanizado = Boolean.FALSE; + private Boolean esNuevaImportacion = Boolean.TRUE; + private String filterAUCP; + //P lpartidaArancelaria=new ArrayList<>(); + private TarmCarga carga = new TarmCarga(); + private Boolean isSelectAucpPrevio = Boolean.FALSE; + private Boolean isSave=Boolean.FALSE; + private Boolean isEnableCategoria = Boolean.TRUE; + InputNumber cantidadTxt = new InputNumber(); + List ldeleteItems = new ArrayList(); + + @ManagedProperty(value = "#{tiposArmasExplosivosController}") + private TiposArmasExplosivosController tiposArmasExplosivosController; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmas; + + // Datos generales + private TgeneCatalogDetail tipoDocumento; + private TcustPersonDetail detallesPersona; + // Catalogo que contiene tipos de registros + private List tiposRegistro; + private TcustPersonDetail usuario; + +// private String tipoRegistro; + + //Registro armas + TarmRegistroArmas registro=new TarmRegistroArmas(); + + //Detalle de localizacion para el caso de importaciones + private List lpaises; +// private TgeneCountry pais; + //private String pais; + + //Provincia + private List lprovincias; + private String codigoProvincia; + + //Canton + private List lcantones; + private String codigoCanton; + + //Ciudad + private List lciudades; +// private TgeneCity ciudad; + + //Aeropuertos + private List laeropuertos=new ArrayList<>(); + + private List ldocumentospersona; + +// /** +// * Lista de tipos de identificación +// */ +// private List ltipoidentificacion; + /** + * Listado de estados del arma + */ + private List lestadoarma; + /** + * Listado de marcas + */ + private List lmarca; + /** + * Listado de colores + */ + private List lcolor; + /** + * Listado de tipos de fabricación + */ + private List ltipofabricacion; + /** + * Listado de unidad de medida cantidad + */ + private List lunidadmedidacantidad; + /** + * Listado de unidad medida peso + */ + private List lunidadmedidapeso; +// /** +// * Listado de paises +// */ +// private List lcountry; +// /** +// * Listado de provincias +// */ +// private List lprovincias; +// /** +// * Listado de cantones +// */ +// private List lcantones; + /** + * Listado de parroquias + */ + private List lparroquias; + /** + * Listado de ciudades + */ + private List lcities; + +// /** +// * Tipo documento +// */ +// private String tipoDoc; + +// /** +// * Número documento +// */ +// private String numDoc; + +// /** +// * Nombre/razón social +// */ +// private String nombreRazon; + + /** + * Longitud arma + */ + private String longitud; + /** + * Calibre arma + */ + private String calibre; + /** + * Clase arma + */ + private String clase; + /** + * Clase arma + */ + private String categoria; + /** + * Tipo de arma + */ + private String tipoarma; + /** + * unidad medida peso + */ + private String unidadmedidapeso; + + /** + * Bandera que indica que en realidad existe luego del ingreso de datos un tipo de arma explosivo válido + */ + private boolean existeTipoArmaExplosivo; + + /** + * Bandera que especifica que se deba verificar que exista un arma explosivo válido + */ + private boolean verificaArmaExplosivo = Boolean.TRUE; + + /** + * Bloquea la unidad de cantidad + */ + private boolean bloquearUnidadCantidad = Boolean.TRUE; + + /** + * Bloquea la unidad de peso + */ + private boolean bloquearUnidadPeso = Boolean.TRUE; + /** + * Contiene la fecha actual del sistema + */ + private Date fechaActual; + /** + * Contiene la referencia a nuevo propietario del arma + */ + private TcustPersonDetail nuevoPropietarioArma; + /** + * Tipo del arma explosivo + */ + private TarmTipoArmaExplosivo tipoArmaExplosivo ; + /** + * codigo del ruc + */ + private String codigoRuc; + /** + * codigo del ruc + */ + private String codigoCedula; + /** + * codigo del ruc + */ + private String codigoPasaporte; + + public ImportacionProduccionController() throws Exception { + super(TarmArmas.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + carga.setIsnew(Boolean.TRUE); + //Localizacion + lpaises=CountryController.find(); + this.lprovincias=ProvinceController.find("EC"); + //Obteniendo los aeropuertos + this.laeropuertos=CatalogDetailController.find("AEROPUERTOS"); + this.lpartidaArancelaria=CatalogDetailController.find("PARTIDAARANCELARIA"); + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + detallesPersona= PersonDetailController.find(String.valueOf(usuario.getPk().getPersoncode())); + //Tipo de documento + tipoDocumento = CatalogDetailController.findxCodigoCodcatalogo(detallesPersona.getIdentificationcatalog(),detallesPersona.getIdentificationcatalogcode()); + //Tipos de registro + tiposRegistro=CatalogDetailController.find("TIPOREGISTRO", "REG"); + fechaActual = new Date(); + recperpage = 5000; // Cambiar al # reg a mirar. +// record = new TarmArmas(); + lrecord = new ArrayList<>(); + beanalias = "ARMAS"; +// ltipoidentificacion = CatalogDetailController.find("IDENTIFICATION"); + lestadoarma = CatalogDetailController.find("ESTADOARMA"); + lmarca = CatalogDetailController.find("MARCA"); + lcolor = CatalogDetailController.find("COLOR"); + ltipofabricacion = CatalogDetailController.find("TIPOFABRICACION"); +// lunidadmedidacantidad = CatalogDetailController.find("UCANTIDAD"); + lunidadmedidapeso = CatalogDetailController.find("UNIDADMEDIDA"); +// lcountry = CountryController.find(); + codigoRuc=codigos("CODIGO.RUC"); + codigoCedula=codigos("CODIGO.CEDULA"); + codigoPasaporte=codigos("CODIGO.PASAPORTE"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void cargarCategorias(){ + System.out.println("cargarCategorias 1"); + // Cargamos la lista de categorias disponibles para el usuario (en funcion de sus documentos habilitantes) + ldocumentospersona= new ArrayList<>(); + List listadocum= new ArrayList<>(); + System.out.println("registro.getTiporegistro() "+registro.getTiporegistro()); + if(registro.getTiporegistro()!=null){ + if("PRO".equals(registro.getTiporegistro())){ + listadocum=DocumentoHabilitanteController.findByPerson_Produccion(usuario.getPk().getPersoncode().toString()); + carga=new TarmCarga(); + carga.setIsnew(Boolean.TRUE); + registro.setIsnew(Boolean.TRUE); + }else{ + if(esNuevaImportacion){ + registro.setIsnew(Boolean.TRUE); + } + listadocum=DocumentoHabilitanteController.findByPerson_Importacion(usuario.getPk().getPersoncode().toString()); + } + }else{ + ldocumentospersona=new ArrayList<>(); + } + //Forma numero 1 (Uso de Maps). + Map mapaSinRepetidos = new HashMap(listadocum.size()); + for(TarmDocumentoHabilitante p : listadocum) { + mapaSinRepetidos.put(p.getCtramite(), p); + } + //Agrego cada elemento del map a una nueva lista y muestro cada elemento. + for(Entry p : mapaSinRepetidos.entrySet()) { + ldocumentospersona.add(p.getValue()); + } + } + + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + String sqlFiltroPersona = ""; + String sqlFiltroSancion = ""; + String sqlFiltroEstados = ""; + String sqlFiltroClaseArmas = ""; +// String sqlFiltroFechaCaducidad = ""; + String sqlFiltroValidacionArma = "";//si entre los estados existe renovacion entonces validamos que no pueda seleccionar las mismas armas + if(this.getMfilelds().get("personcode") != null){ + sqlFiltroPersona = " t.cregistro in (SELECT c.pk FROM TarmRegistroArmas c WHERE c.personcode="+this.getMfilelds().get("personcode")+")"; + } + //agregamos los filtros en base a la consideracion del field sancion, en caso de que lo sea buscamos los sancionados que hayan cumplido el tiempo de sancion + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + if(this.getMfilelds().containsKey("sancion") && this.getMfilelds().get("sancion").toString().equals(Constant.STR_Y)){ + sqlFiltroSancion = " t.pk in (SELECT max(a.pk) FROM TarmArmas a WHERE a.codigoarma in (SELECT distinct(h.codigoarma) from TarmDocumentoHabilitante h WHERE h.pk in (SELECT d.cdocumento FROM TarmSancionDecomiso d WHERE d.personcode="+this.getMfilelds().get("personcode")+" AND d.fechafinal < TO_DATE('"+dateFormat.format(Calendar.getInstance().getTime())+"', 'YYYY-MM-DD'))) GROUP BY a.codigoarma)"; + } + + dto.setOrderby("pk"); + if(this.getMfilelds().get("ESTADOS") != null){ + String[] estados = this.getMfilelds().get("ESTADOS").toString().split(","); + StringBuffer sqlEstados = new StringBuffer(" t.estado IN ("); + for (int i = 0; i < estados.length; i++) { + sqlEstados.append("'").append(estados[i]).append("'"); + if(i < estados.length - 1){ + sqlEstados.append(","); + } + } + sqlEstados.append(")"); + sqlFiltroEstados = sqlEstados.toString(); + } + + if(this.getMfilelds().get("TRAMITE") != null){ + TarmTramite tarmTramite = (TarmTramite) this.getMfilelds().get("TRAMITE"); + sqlFiltroValidacionArma = "t.pk not in (SELECT coalesce(max(a.pk),'-1') FROM TarmArmas a WHERE a.codigoarma in (SELECT distinct(h.codigoarma) from TarmDocumentoHabilitante h WHERE h.personcode="+this.getMfilelds().get("personcode")+" AND h.ctramite="+tarmTramite.getPk()+" AND h.estado = 'APR' AND trunc(h.fechaexpiracion) >= " + "TO_DATE('" +dateFormat.format(Calendar.getInstance().getTime())+ "','yyyy-MM-dd')) GROUP BY a.codigoarma)"; + } + //estados del armas + if(this.getMfilelds().get("CLASEARMAS") != null){ + String[] clasesarma = this.getMfilelds().get("CLASEARMAS").toString().split(","); + StringBuffer sqlclasesarmas = new StringBuffer(" t.ctipoarmaexplosivo IN (select o.pk from TarmTipoArmaExplosivo o where o.clase in("); + for (int i = 0; i < clasesarma.length; i++) { + sqlclasesarmas.append("'").append(clasesarma[i]).append("'"); + if(i < clasesarma.length - 1){ + sqlclasesarmas.append(","); + } + } + sqlclasesarmas.append(")) "); + sqlFiltroClaseArmas = sqlclasesarmas.toString(); + } + +// if(this.getMfilelds().get("FECHACADUCIDADARM") != null){ +// sqlFiltroFechaCaducidad="t.fechacaducidad "+this.getMfilelds().get("FECHACADUCIDADARM"); +// } + String sqlActual = " t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma) and t.estado !='DEST' and t.estado!='VEND' and t.estado!='MING' and t.estado!='DUPL' and t.estado!='CUSTEM'" + + " and (t.peso>0 or t.cantidad>0)";//distintas de destruidas y cambio de propietario and t.cregistro=ta.cregistro para el manejo de los explosivos + +// String sqlFinal = obtenerFiltroBusquedaGeneral(sqlFiltroPersona, sqlFiltroEstados, sqlFiltroSancion, sqlFiltroValidacionArma,sqlFiltroClaseArmas,sqlFiltroFechaCaducidad, sqlActual); + String sqlFinal = obtenerFiltroBusquedaGeneral(sqlFiltroPersona, sqlFiltroEstados, sqlFiltroSancion, sqlFiltroValidacionArma,sqlFiltroClaseArmas,sqlActual); + Filter filtroFinal = new Filter(); + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void actualizaPanelImportacion(){ + if(esNuevaImportacion){ + System.out.println("Logica para cuando es una nueva importacion: " + esNuevaImportacion); + carga=new TarmCarga(); + carga.setIsnew(Boolean.TRUE); + registro.setIsnew(Boolean.TRUE); +// if(registro.getPk()!=null){ +// registro.setPk(null); +// +// } + }else{ + System.out.println("Logica para cuando es una importacion ya cargada y se consultara por AUCP: " + esNuevaImportacion); + } +// registro = new TarmRegistroArmas(); +// this.lrecord = new ArrayList(); + + } + + + private String obtenerFiltroBusquedaGeneral(String... sqlFiltros ){ + StringBuffer sqlFinal = new StringBuffer(); + for (int i = 0; i < sqlFiltros.length ; i++) { + if(sqlFinal.length() > 0 && !StringUtils.endsWith(StringUtils.trim(sqlFinal.toString()), "AND")){ + sqlFinal.append( " AND "); + } + sqlFinal.append(sqlFiltros[i]); + } + return sqlFinal.toString(); + } + + @SuppressWarnings("unchecked") + public void querydatabaseSinFiltros() { + try { + DtoQuery dto = this.getDtoQuery(); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql=" t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() throws Exception { + // TODO Auto-generated method stub + super.next(); + } + + @SuppressWarnings("unchecked") + protected void querydatabasePorCodigo() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql=" t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception{ + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TarmTipoArmaExplosivo","clase","cclase","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo= new SubQuery("TarmTipoArmaExplosivo","clasecodigo","cclasecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud= new SubQuery("TarmTipoArmaExplosivo","longitud","clongitud","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo= new SubQuery("TarmTipoArmaExplosivo","longitudcodigo","clongitudcodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ccalibre","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo= new SubQuery("TarmTipoArmaExplosivo","calibrecodigo","ccalibrecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivo","ctipoarmaexplosivo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivocodigo","ctipoarmaexplosivocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapeso","cunidadmedidapeso","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapesocodigo","cunidadmedidapesocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida= new SubQuery("TgeneCatalogDetail","description","unidadmedida","i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode= new SubQuery("TarmRegistroArmas","personcode","personcode","i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + SubQuery subqueryTipo= new SubQuery("TgeneCatalogDetail","description","tipo","i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipo); + SubQuery subqueryTipoArmaExplosivo= new SubQuery("TgeneCatalogDetail","description","tipoarmaexplosivo","i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + SubQuery subqueryClasecatalogo= new SubQuery("TgeneCatalogDetail","description","clase","i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClasecatalogo); + + return dto; + } + + @SuppressWarnings("unchecked") + protected void querydatabaseSimple() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql=" t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void remove() throws Exception { + if(record.getPk()==null){ + super.remove(); + } + else{ + ldeleteItems.add(this.record); + super.remove(); + } + } + + + @Override + public void save() { + try { + if(registro.getTiporegistro().equals("IMP") && registro.isnew){ + TarmCarga aucpUsadoPrevio = CargaController.findByAUCP(registro.getSolicitudnum()); + if(aucpUsadoPrevio!=null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_aucp_previamente_cargado")); + return; + } + if(this.registro.getPaisorigen()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_paisOrigenRequerido")); + return; + } + if(this.carga.getProvincecode() ==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_provinciaRequerido")); + return; + } + if(this.carga.getCantoncode() ==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_cantonRequerido")); + return; + } + if(this.carga.getCitycode()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ciudadRequerido")); + return; + } + if(this.registro.getAeropuertopuerto()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_aeropuertoRequerido")); + return; + } + } + if(this.getLrecord().isEmpty()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_carga_armas_inexistentes")); + return; + } + this.registroArmas.update(); + Request request = callerhelper.getRequest(); + this.registro.setPersoncode(usuario.getPk().getPersoncode()); + this.registro.setFechasolicitud(new java.sql.Date((new Date()).getTime())); + this.registro.setTiporegistrocodigo("TIPOREGISTRO"); +// this.registro.setPaisorigen("EC"); + this.registro.setFcreacion(new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + request.getModifiedData().put("LISTAARMAS", this.lrecord); + request.getModifiedData().put("LISTAARMASELIMINADAS", this.ldeleteItems); + request.getModifiedData().put("TIPOREGISTRO", this.registro.getTiporegistro()); + request.getModifiedData().put("REGISTRO", this.registro); + request.getModifiedData().put("PERSONCODE", usuario.getPk().getPersoncode()); + request.getModifiedData().put("ESNUEVAIMPORTACION", esNuevaImportacion); + carga.setCategoria(this.categoria); + request.getModifiedData().put("TARMCARGA",carga); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + isSave=Boolean.TRUE; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void saveArmaSolicitud() { + try { + + if(!isArmaDuplicada(record)){ + + record.getModifiedData().put("edit", "S"); + + this.registroArmas.update(); + update(); + if(!existeTipoArmaExplosivo){ + return; + } + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(Boolean.TRUE); // Para que el core devuelva el pk de los registros nuevos. + dtosave.setPosition(2); + HashMap msave = new HashMap(); + DtoSave dtoSaveRegistro = registroArmas.getDtoSave(); + dtoSaveRegistro.setIsForm(Boolean.TRUE); + dtoSaveRegistro.setReturnpk(Boolean.TRUE); + dtoSaveRegistro.setPosition(1); + + Request request = callerhelper.getRequest(); + request.setTransactionModule("30"); + request.setTransactionCode(15); + request.setTransactionVersion(1); + if(!verificaArmaExplosivo){ + request.put("eseliminacion", Constant.STR_Y); + }else{ + msave.put(registroArmas.getBeanalias(), dtoSaveRegistro); + } + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.put("TIPODOC", this.getMfilelds().get("tipodoc")); + request.put("NUMDOC", this.getMfilelds().get("numdoc")); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.registroArmas.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + }else{ + record= null; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_armaDuplicada")); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void update() throws Exception { +// TgeneCatalogDetail estado = CatalogDetailController.findxCodigoCodcatalogo(record.getEstado(), record.getEstadocodigo()); + TgeneCatalogDetail marca = CatalogDetailController.findxCodigoCodcatalogo(record.getMarca(), record.getMarcacodigo()); +// record.getModifiedData().put("estado", estado.getDescription()); + isEnableCategoria = Boolean.FALSE; + record.setPartidaarancelariacodigo("PARTIDAARANCELARIA"); + record.setTipofabricacion("TIPOFABRICACION2"); + record.setTipofabricacioncodigo("TIPOFABRICACION"); + record.getModifiedData().put("marca", marca.getDescription()); + for(TgeneCatalogDetail color:lcolor){ + if(record.getColor()!=null && record.getColor().equals(color.getPk().getCatalog())){ + record.getModifiedData().put("color", color.getDescription()); + break; + } + } + if(verificaArmaExplosivo){ + if(tipoArmaExplosivo == null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionClase")); + existeTipoArmaExplosivo = Boolean.FALSE; + return; + }else{ + this.record.setCtipoarmaexplosivo(tipoArmaExplosivo.getPk()); + record.getModifiedData().put("unidadMedidaCantidad", tipoArmaExplosivo.getUnidadmedidapeso()); + existeTipoArmaExplosivo = Boolean.TRUE; + } + } + super.update(); + } + + public Boolean existeDuplicidad(){ + if(this.lrecord.contains(record)){ + return Boolean.TRUE; + } + return Boolean.FALSE; + } + + + public void updateAutorizacion()throws Exception { + super.update(); + } + + /** + * Método que se ejecuta al carga edición + * @throws Exception + */ + public void loadEdit() throws Exception { + verificaArmaExplosivo = Boolean.TRUE; + if(record.getCountrycode() == null){ + record.setCountrycode("EC"); + } + if(record.getCtipoarmaexplosivo()==null){ + MessageHelper.setMessageError("NO ESTA ASOCIADO A UN TIPO DE ARMA EXPLOSIVO"); + return; + } + tipoArmaExplosivo= TiposArmasExplosivosController.findarma(record.getCtipoarmaexplosivo()); +// lprovincias = ProvinceController.find(record.getCountrycode()); +// executeProvince(); +// if(record.getProvincecode() != null){ +// lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); +// executeCanton(); +// } +// completaInfTipoArma(); + // Anade la descripcion del tipo de arma explosivo + if(tipoArmaExplosivo!=null){ + this.clase = tipoArmaExplosivo.getClase(); + this.longitud = tipoArmaExplosivo.getLongitud(); + this.tipoarma = tipoArmaExplosivo.getTipoarmaexplosivo(); + this.calibre = tipoArmaExplosivo.getCalibre(); + } + verificarClaseArma(); + } + +// /** +// * Método que completa la informaci´n del arma una vez se presiona el botón crear +// */ +// private void completaInfTipoArma(){ +// TarmArmas recordArma = findPorCodigo(record.getPk()); +// record.setCountrycode("EC"); +// clase = record.getModifiedData().get("clase") != null ? recordArma.getModifiedData().get("clase").toString() : null; +// calibre = record.getModifiedData().get("ccalibre") != null ? Utilidades.formatearDecimalesEnTexto((recordArma.getModifiedData().get("ccalibre").toString()).replace("null", ""), "#.00") : null; +// longitud = record.getModifiedData().get("clongitud") != null ? recordArma.getModifiedData().get("clongitud").toString() : null; +// tipoarma = record.getModifiedData().get("ctipoarmaexplosivo") != null ? recordArma.getModifiedData().get("ctipoarmaexplosivo").toString() : null; +// } + + @Override + public void create() throws Exception { + if(categoria!=null){ + super.create(); + this.record.setEstadocodigo("ESTADOARMA"); + this.record.setMarcacodigo("MARCA"); + this.record.setCantidad(null); + this.record.setPeso(null); + this.lprovincias = ProvinceController.find(record.getCountrycode()); + this.executeProvince(); + this.bloquearUnidadCantidad = Boolean.TRUE; + this.bloquearUnidadPeso = Boolean.TRUE; + RequestContext.getCurrentInstance().execute("PF('dialog').show()"); + }else{ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_categoriaRequerida")); + return; + } + } + + public void update(TarmArmas bean) throws Exception { + record=bean; + updateAutorizacion(); + } + + public void validacionDocumento(String numeroDocumento, String tipoDocumento){ + if(numeroDocumento==null || tipoDocumento==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselacedula")); + return; + } + TcustPersonDetail tcustPersonDetail=null; + if(tipoDocumento.equals(codigoCedula)){ +//----------validamos si es valida la CEDULA + if(!ValidateIdentification.cedula(numeroDocumento)){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en MAIA + tcustPersonDetail=buscarPersonaMaia(numeroDocumento,tipoDocumento); + }else if(tipoDocumento.equals(codigoRuc)){ +//----------validamos si es valida el RUC + if(!ValidateIdentification.ruc(numeroDocumento)){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en maia + tcustPersonDetail=buscarPersonaMaia(numeroDocumento,tipoDocumento); + }else{ +//----------si es PASAPORTE + tcustPersonDetail=buscarPersonaMaia(numeroDocumento,tipoDocumento); + } +// if(tcustPersonDetail==null){ +// nombreRazon=null; +//// numDoc=null; +// MessageHelper.setMessageError("La datos de la persona ingresada no existen, por favor crear primero la persona"); +// return; +// }else{ +// nombreRazon=tcustPersonDetail.getName(); +// } + } + + /** Método para validar si la persona existe en la BD de Maia + * @param numeroDocumento + * @param tipoDocumento + * @return TcustPersonDetail + */ + public TcustPersonDetail buscarPersonaMaia(String numeroDocumento, String tipoDocumento){ + return PersonDetailController.findxidentification(numeroDocumento,tipoDocumento); + } + /** + * Busca un arma por código y estado + * @param armaCode código del arma + * @param estado estado del arma + * @return + */ + public static TarmArmas find(String armaCode,String estado) { + try { + + if(armaCode==null){ + return null; + } + ImportacionProduccionController cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + if(estado!=null){ + cc.addFilter("estado", estado); + cc.addFilter("estadocodigo", "ESTADOARMA"); + } + cc.querydatabaseArmas(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = new TarmTipoArmaExplosivo(); + tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if(tarmTipoArmaExplosivo!=null && tarmTipoArmaExplosivo.getCalibrecodigo()!=null) + cc.record.modifiedData().put("calibre",tarmTipoArmaExplosivo==null?"":Utilidades.formatearDecimalesEnTexto((CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription()), "#.000")); + cc.record.modifiedData().put("tipo",tarmTipoArmaExplosivo==null?"":CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription()); + cc.record.modifiedData().put("clase",tarmTipoArmaExplosivo==null?"":CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription()); + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + cc.record.modifiedData().put("pais", cc.record.getCpaisorigen()==null?"":CountryController.findcountry(cc.record.getCpaisorigen()).getDescription()); + + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * + * @param codigopersona + * @return + */ + public static TarmArmas findBySerieMarca(String serie, String marca) { + try { + ImportacionProduccionController cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 5000; + if(serie!=null && !serie.isEmpty()){ + cc.addFilter("lote", serie); + } + cc.addFilter("marca", marca); + cc.querydatabaseSimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findByPK(String cArma) { + try { + + ImportacionProduccionController cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", cArma); + cc.querydatabaseSinFiltros(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + cc.record=cc.lrecord.get(0); + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if(tarmTipoArmaExplosivo!=null){ + if(tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null){ + cc.record.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getTipoarmaexplosivo() != null && tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo() != null){ + cc.record.modifiedData().put("tipo",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo())!=null? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(),tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getClase() != null && tarmTipoArmaExplosivo.getClasecodigo() != null){ + cc.record.modifiedData().put("clase",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription():""); + } + + TarmRegistroArmas registroArmas = new TarmRegistroArmas(); + TcustPersonDetail detallePersona = new TcustPersonDetail(); + if(cc.record.getCregistro()!=null ){ + registroArmas = RegistroArmController.findByCodigo(String.valueOf(cc.record.getCregistro())); + if(registroArmas!=null){ + detallePersona= PersonDetailController.find(String.valueOf(registroArmas.getPersoncode())); + } + } + cc.record.modifiedData().put("razonsPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getName()); + cc.record.modifiedData().put("documentoPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getIdentification()); + + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findPorCodigo(String armaCode) { + try { + + ImportacionProduccionController cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + //cc.addFilter("REG", "ESTADOARMA"); + cc.querydatabaseArmas(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if(tarmTipoArmaExplosivo!=null){ + if(tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null){ + cc.record.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getTipoarmaexplosivo() != null && tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo() != null){ + cc.record.modifiedData().put("tipo",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo())!=null? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(),tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getClase() != null && tarmTipoArmaExplosivo.getClasecodigo() != null){ + cc.record.modifiedData().put("clase",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription():""); + } + + TarmRegistroArmas registroArmas = new TarmRegistroArmas(); + TcustPersonDetail detallePersona = new TcustPersonDetail(); + if(cc.record.getCregistro()!=null ){ + registroArmas = RegistroArmController.findByCodigo(String.valueOf(cc.record.getCregistro())); + if(registroArmas!=null){ + detallePersona= PersonDetailController.find(String.valueOf(registroArmas.getPersoncode())); + } + } + cc.record.modifiedData().put("razonsPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getName()); + cc.record.modifiedData().put("documentoPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getIdentification()); + cc.record.modifiedData().put("marca",(cc.record ==null || cc.record.getMarca()==null || cc.record.getMarca().isEmpty() || cc.record.getMarcacodigo()==null || cc.record.getMarcacodigo().isEmpty())?"":CatalogDetailController.findxCodigoCodcatalogo(cc.record.getMarca(), cc.record.getMarcacodigo()).getDescription()); + + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findXCodigo(String armaCode) { + try { + + ImportacionProduccionController cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + //cc.addFilter("REG", "ESTADOARMA"); + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + lcities = CityController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + } + } + + + /** + * + * + * @param personCode + * @param estados estados del arma separados por coma + * @return Una lista de Armas encontradas + */ + public List findxPersona(Long personCode, String estados, String clase, String fechaCaducidad) { + List armasLista = null; + try { + armasLista = new ArrayList(); + ImportacionProduccionController armas = new ImportacionProduccionController(); + armas.init(); + armas.recperpage = 4000; + armas.addField("personcode", personCode); + if(this.getMfilelds().get("sancion") != null){ + armas.addField("sancion", this.getMfilelds().get("sancion")); + } + if(this.getMfilelds().get("TRAMITE") != null){ + armas.addField("TRAMITE", this.getMfilelds().get("TRAMITE")); + } + if(estados == null){ + armas.addFilter("estado", "REG"); + } else{ + armas.addField("ESTADOS", estados); + } + if(clase != null && clase .trim().length()>0){ + armas.addField("CLASEARMAS", clase); + } +// if(fechaCaducidad != null && fechaCaducidad .trim().length()>0){ +// armas.addField("FECHACADUCIDADARM", fechaCaducidad); +// } + armas.query(); + if(armas.getLrecord() != null && !armas.getLrecord().isEmpty()){ + armasLista.addAll(armas.getLrecord()); + } + + return armasLista; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return armasLista; + } + } + + + /** + * Lista de Armas por Registro + **/ + public static List findxRegistro(String registrocode) { + try { + ImportacionProduccionController cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("cregistro", registrocode); + + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + for(TarmArmas item : cc.lrecord){ + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(item.getCtipoarmaexplosivo()); + item.modifiedData().put("calibre",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription()); + item.modifiedData().put("tipo",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription()); + item.modifiedData().put("clase",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription()); + item.modifiedData().put("longitud",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getLongitud(), tarmTipoArmaExplosivo.getLongitudcodigo()).getDescription()); + } + + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Abre el LOV de la clase del arma + */ + public void openLovClase() { + Map> params = new HashMap>(); + ClaseLovController.openLov(params); + } + + /** + * Regresa del LOV de armas + * @param event + */ + public void onReturnClase(SelectEvent event) { + TgeneCatalogDetail clase = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("clase", clase.getDescription()); + this.clase = clase.getPk().getCatalog(); + this.verificarClaseArma(); + } + + /** + * Abre el LOV de la clase del arma + */ + public void openArmaExplosivoLov() { + + this.record.getModifiedData().put("longitud", null); + this.record.getModifiedData().put("tipoarmaexplosivo", null); + this.record.getModifiedData().put("calibre", null); + // descripcionUnidadpeso=null; + Map> params = new HashMap<>(); + List lcategoriaParam = new ArrayList<>(); + lcategoriaParam.add(categoria); + params.put("categoria", lcategoriaParam); + ArmaExplosivoLovController.openLov(params); + + } + + /** + * Abre el LOV de busqueda de importaciones por codigo solicitud (AUCP) + */ + public void openCargaPrevia() { + Map> params = new HashMap<>(); + List lPersoncodeParam = new ArrayList<>(); + lPersoncodeParam.add(usuario.getPk().getPersoncode().toString()); + params.put("personcode", lPersoncodeParam); + CargasLovController.openLov(params); + } + + /** + * Regresa del LOV de armas + * @param event + */ + public void onReturnArmaExplosivo(SelectEvent event) { + tipoArmaExplosivo = (TarmTipoArmaExplosivo) event.getObject(); + //Setear descripciones a presentarse + this.record.getModifiedData().put("clase", tipoArmaExplosivo.getModifiedData().get("nclase")); + this.record.getModifiedData().put("tipoarmaexplosivo", tipoArmaExplosivo.getModifiedData().get("ntipo")); + this.record.getModifiedData().put("longitud", tipoArmaExplosivo.getModifiedData().get("nlongitud")); + this.record.getModifiedData().put("calibre", tipoArmaExplosivo.getModifiedData().get("ncalibre")); + // Setear valores en las variables correspondientes + if(tipoArmaExplosivo!=null){ + this.clase = tipoArmaExplosivo.getClase(); + this.longitud = tipoArmaExplosivo.getLongitud(); + this.tipoarma = tipoArmaExplosivo.getTipoarmaexplosivo(); + this.calibre = tipoArmaExplosivo.getCalibre(); + this.record.setUnidadmedidacantidad(tipoArmaExplosivo.getUnidadmedidapeso()); + } + this.verificarClaseArma(); + // valida cantidad para registro de produccion + cantidadTxt.setValue(null); + if(registro.getTiporegistro().equals("PRO")){ + if((this.clase.equals("0010000001") || this.clase.equals("0010000004") || this.clase.equals("0010000008")) && this.bloquearUnidadPeso){ + cantidadTxt.setValue("1"); + cantidadTxt.setDisabled(true); + } + } + } + + /** + * Regresa del LOV de carga + * @param event + */ + public void onReturnCarga(SelectEvent event) { + System.out.println("Retorno del lov carga"); + isSelectAucpPrevio = Boolean.TRUE; + carga = (TarmCarga) event.getObject(); + this.categoria = carga.getCategoria(); + this.isEnableCategoria = Boolean.FALSE; + if(carga.getEsdesaduanizado().equals("S")){ + this.isSave = Boolean.TRUE; + } + carga.setIsnew(Boolean.FALSE); + registro = RegistroArmController.findByCodigo(carga.getCregistro().toString()); + registro.setIsnew(Boolean.FALSE); + TgeneCountry paisOrigen = CountryController.findcountry(registro.getPaisorigen()); + registro.getModifiedData().put("paisorigen", paisOrigen!=null?paisOrigen.getDescription():""); + // Provincia + TgeneProvince provinciaTmp = ProvinceController.findPorCodigo("EC", carga.getProvincecode()).get(0); + if(provinciaTmp!=null){ + carga.getModifiedData().put("provinceCode",provinciaTmp.getDescription()); + } + // Canton + TgeneCanton cantonTmp = CantonController.findPorCodigo("EC", carga.getProvincecode(), carga.getCantoncode()).get(0); + if(cantonTmp!=null){ + carga.getModifiedData().put("cantonCode",cantonTmp.getDescription()); + } + // Ciudad + TgeneCity ciudadTmp = CityController.findPorCodigo("EC", carga.getProvincecode(), carga.getCantoncode(), carga.getCitycode()).get(0); + if(ciudadTmp!=null){ + carga.getModifiedData().put("cityCode",ciudadTmp.getDescription()); + } + + lrecord = ArmasController.findxRegistro(registro.getPk().toString()); + if(lrecord==null){ + this.lrecord = new ArrayList(); + } + + } + + /** + * Método en el cual se determina si se bloquea unidad o cantidad al momento de cargar los datos del arma + * @param clase + */ + private void verificarClaseArma(){ + if(tipoArmaExplosivo!=null){ + TgeneCatalogDetail unidadesCatalog = CatalogDetailController.findCatalogo(tipoArmaExplosivo.getUnidadmedidapesocodigo(),tipoArmaExplosivo.getUnidadmedidapeso()); + if(unidadesCatalog!=null && unidadesCatalog.getLegalcode().equals("CANTIDAD")){ + this.record.getModifiedData().put("unidadMedidaCantidad", tipoArmaExplosivo.getUnidadmedidapeso()); + this.record.getModifiedData().put("unidadMedidaPeso", null); + this.bloquearUnidadCantidad = Boolean.FALSE; + this.bloquearUnidadPeso = Boolean.TRUE; + this.record.setPeso(null); + }else if(unidadesCatalog!=null && unidadesCatalog.getLegalcode().equals("PESO")){ + this.record.getModifiedData().put("unidadMedidaCantidad", null); + this.record.getModifiedData().put("unidadMedidaPeso", tipoArmaExplosivo.getUnidadmedidapeso()); + this.bloquearUnidadCantidad = Boolean.TRUE; + this.bloquearUnidadPeso = Boolean.FALSE; + this.record.setCantidad(null); + }else{ + this.record.getModifiedData().put("unidadMedidaCantidad", null); + this.record.getModifiedData().put("unidadMedidaPeso", null); + this.bloquearUnidadCantidad = Boolean.TRUE; + this.bloquearUnidadPeso = Boolean.TRUE; + } + } + } + + /** + * Abre el LOV de la longitud del arma + */ + public void openLovLongitud() { + Map> params = new HashMap>(); + LongitudLovController.openLov(params); + } + + /** + * Regresa del LOV de longitud + * @param event + */ + public void onReturnLongitud(SelectEvent event) { + TgeneCatalogDetail longitud = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("longitud", longitud.getDescription()); + this.longitud = longitud.getPk().getCatalog(); + } + + /** + * Abre el LOV del tipo de arma + */ + public void openLovTipoArma() { + Map> params = new HashMap>(); + TipoArmaExpLovController.openLov(params); + } + + /** + * Regresa del LOV de tipo de arma + * @param event + */ + public void onReturnTipoArma(SelectEvent event) { + TgeneCatalogDetail tipoArma = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("tipoarmaexplosivo", tipoArma.getDescription()); + this.tipoarma = tipoArma.getPk().getCatalog(); + } + + /** + * Abre el LOV de Calibre + */ + public void openLovCalibre() { + Map> params = new HashMap>(); + CalibreLovController.openLov(params); + } + + /** + * Regresa del LOV del calibre + * @param event + */ + public void onReturnCalibre(SelectEvent event) { + TgeneCatalogDetail calibre = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("calibre", calibre.getDescription()); + this.calibre = calibre.getPk().getCatalog(); + } + + /** + * Abre el LOV cambio de usuario + */ + public void openLovCambioUsuario() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Acción de retorno de la selección del usuario + * @param event de retorno de la selección + */ + public void onReturnCambioUsuario(SelectEvent event) { + nuevoPropietarioArma = (TcustPersonDetail) event.getObject(); + } + + /** + * Abre el dialog del cambio de persona + */ + public void abrirDialogCambio() { + this.nuevoPropietarioArma = null; + } + + /** + * Se cambia el propietario del arma + */ + public void cambiarArmaUsuario() { + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.setTransactionModule("30"); + request.setTransactionCode(151); + request.setTransactionVersion(1); + request.put("ARMAACTUAL", this.record); + request.put("NUEVAPERSONA", this.nuevoPropietarioArma); + Response response = callerHelper.executeSave(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + MessageHelper.setMessageInfo(response); + this.querydatabase(); + } else{ + MessageHelper.setMessageError(response); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Carga las listas de cantones y limpia la lista de ciudades + */ + public void seleccionarProvincia(){ + try { +// codigoProvincia=this.record.getProvincecode(); + lcantones = CantonController.find("EC", carga.getProvincecode()); + lciudades = new ArrayList<>(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + /** + * Carga las listas de ciudades + */ + public void seleccionarCanton(){ + try { +// codigoCanton = this.record.getCantoncode(); + lciudades = CityController.find("EC", carga.getProvincecode(), carga.getCantoncode()); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if(Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")){ + valorColocar = Boolean.TRUE; + } + for (TarmArmas guardias : lrecord) { + guardias.getModifiedData().put("seleccionado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Metodo para obtener el listado de las armas por la serie/lote + * @param serieLote + * @return + */ + public static List findxSerieLote(String serieLote) { + try { + ImportacionProduccionController cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 1000; + cc.addFilter("lote", serieLote); + cc.querydatabaseFechaMax(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para obtener los codigos + */ + private static String codigos(String parametro){ + TgeneParameters tgeneParameters= ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + @SuppressWarnings("unchecked") + protected void querydatabaseFechaMax() { + try { + DtoQuery dto = this.getDtoQuery(); + dto.setOrderby("pk"); + String codigoEstadoIncautada=codigos("CODIGO.INCAUTADA"); + String codigoEstadoDecomisada=codigos("CODIGO.DECOMISADA"); + String codigoEstadoVendida=codigos("CODIGO.VENDIDA"); + String codigoEstadoMatPrima=codigos("CODIGO.MATERIAPRIMA"); + Filter filtro = new Filter(); + String sql="t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro)"//and t.cregistro=ta.cregistro para el manejo de los explosivos + + " and t.estado !='DEST' and t.estado !='CDP' and t.estado !='"+codigoEstadoIncautada+"' and t.estado !='"+codigoEstadoDecomisada+"' and t.estado !='"+codigoEstadoVendida+"' and t.estado !='"+codigoEstadoMatPrima+"' "; + filtro.setSql(sql); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void actualizar(TarmArmas arma) throws Exception{ + record=arma; + super.update(); + } + + /*Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findxCodigo(String armaCode) { + try { + + ImportacionProduccionController cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + cc.querydatabaseArmas(); + cc.getRecord().getModifiedData().put("lmarca", cc.getLmarca()); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public TiposArmasExplosivosController getTiposArmasExplosivosController() { + return tiposArmasExplosivosController; + } + + + public void setTiposArmasExplosivosController( + TiposArmasExplosivosController tiposArmasExplosivosController) { + this.tiposArmasExplosivosController = tiposArmasExplosivosController; + } + + + public RegistroArmController getRegistroArmas() { + return registroArmas; + } + + + public void setRegistroArmas(RegistroArmController registroArmas) { + this.registroArmas = registroArmas; + } + + +// public List getLtipoidentificacion() { +// return ltipoidentificacion; +// } +// +// +// public void setLtipoidentificacion(List ltipoidentificacion) { +// this.ltipoidentificacion = ltipoidentificacion; +// } +// +// +// public String getTipoDoc() { +// return tipoDoc; +// } +// +// +// public void setTipoDoc(String tipoDoc) { +// this.tipoDoc = tipoDoc; +// } + + +// public String getNumDoc() { +// return numDoc; +// } +// +// +// public void setNumDoc(String numDoc) { +// this.numDoc = numDoc; +// } + + +// public String getNombreRazon() { +// return nombreRazon; +// } +// +// +// public void setNombreRazon(String nombreRazon) { +// this.nombreRazon = nombreRazon; +// } + + + public List getLestadoarma() { + return lestadoarma; + } + + + public void setLestadoarma(List lestadoarma) { + this.lestadoarma = lestadoarma; + } + + + public List getLmarca() { + return lmarca; + } + + + public void setLmarca(List lmarca) { + this.lmarca = lmarca; + } + + + public List getLcolor() { + return lcolor; + } + + + public void setLcolor(List lcolor) { + this.lcolor = lcolor; + } + + + public List getLtipofabricacion() { + return ltipofabricacion; + } + + + public void setLtipofabricacion(List ltipofabricacion) { + this.ltipofabricacion = ltipofabricacion; + } + + +// public List getLcountry() { +// return lcountry; +// } +// +// +// public void setLcountry(List lcountry) { +// this.lcountry = lcountry; +// } + + + public List getLunidadmedidacantidad() { + return lunidadmedidacantidad; + } + + + public void setLunidadmedidacantidad( + List lunidadmedidacantidad) { + this.lunidadmedidacantidad = lunidadmedidacantidad; + } + + + public String getLongitud() { + return longitud; + } + + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + + public String getCalibre() { + return calibre; + } + + + public void setCalibre(String calibre) { + this.calibre = calibre; + } + + + public String getClase() { + return clase; + } + + + public void setClase(String clase) { + this.clase = clase; + } + + + public String getTipoarma() { + return tipoarma; + } + + + public void setTipoarma(String tipoarma) { + this.tipoarma = tipoarma; + } + + + public String getUnidadmedidapeso() { + return unidadmedidapeso; + } + + + public void setUnidadmedidapeso(String unidadmedidapeso) { + this.unidadmedidapeso = unidadmedidapeso; + } + + + public List getLunidadmedidapeso() { + return lunidadmedidapeso; + } + + + public void setLunidadmedidapeso(List lunidadmedidapeso) { + this.lunidadmedidapeso = lunidadmedidapeso; + } + + + public List getLprovincias() { + return lprovincias; + } + + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + + public List getLcantones() { + return lcantones; + } + + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + + public List getLparroquias() { + return lparroquias; + } + + + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + + public List getLcities() { + return lcities; + } + + + public void setLcities(List lcities) { + this.lcities = lcities; + } + + + public boolean isExisteTipoArmaExplosivo() { + return existeTipoArmaExplosivo; + } + + + public void setExisteTipoArmaExplosivo(boolean existeTipoArmaExplosivo) { + this.existeTipoArmaExplosivo = existeTipoArmaExplosivo; + } + + + public boolean isVerificaArmaExplosivo() { + return verificaArmaExplosivo; + } + + + public void setVerificaArmaExplosivo(boolean verificaArmaExplosivo) { + this.verificaArmaExplosivo = verificaArmaExplosivo; + } + + public boolean isBloquearUnidadCantidad() { + return bloquearUnidadCantidad; + } + + public void setBloquearUnidadCantidad(boolean bloquearUnidadCantidad) { + this.bloquearUnidadCantidad = bloquearUnidadCantidad; + } + + public boolean isBloquearUnidadPeso() { + return bloquearUnidadPeso; + } + + public void setBloquearUnidadPeso(boolean bloquearUnidadPeso) { + this.bloquearUnidadPeso = bloquearUnidadPeso; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public TarmTipoArmaExplosivo getTipoArmaExplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoArmaExplosivo(TarmTipoArmaExplosivo tipoArmaExplosivo) { + this.tipoArmaExplosivo = tipoArmaExplosivo; + } + protected void querydatabaseArmas() { + try { + DtoQuery dto = this.getDtoQuery(); + + dto.setOrderby("pk"); + if(this.getMfilelds().get("ESTADOS") != null){ + Filter filtroEstados = new Filter(); + String[] estados = this.getMfilelds().get("ESTADOS").toString().split(","); + StringBuffer sqlEstados = new StringBuffer(" t.estado IN ("); + for (int i = 0; i < estados.length; i++) { + sqlEstados.append("'").append(estados[i]).append("'"); + if(i < estados.length - 1){ + sqlEstados.append(","); + } + } + sqlEstados.append(")"); + filtroEstados.setSql(sqlEstados.toString()); + dto.addFiltro(filtroEstados); + }else{ + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql=" t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + } + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public TcustPersonDetail getNuevoPropietarioArma() { + return nuevoPropietarioArma; + } + + public void setNuevoPropietarioArma(TcustPersonDetail nuevoPropietarioArma) { + this.nuevoPropietarioArma = nuevoPropietarioArma; + } + + /** + * Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findXCodigoArma(String armaCode) { + try { + ImportacionProduccionController cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("codigoarma", armaCode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + @SuppressWarnings("unchecked") + public void querydatabasesimple() { + try { + DtoQuery dto = this.getDtoQuery(); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + @SuppressWarnings("unchecked") + public void querydatabaseArmaDuplicada(TarmArmas armaObj) { + try { + DtoQuery dto = this.getDtoQuery(); + + Filter filtro = new Filter(); + filtro.setSql("t.marca='"+armaObj.getMarca()+"' and t.marcacodigo='"+armaObj.getMarcacodigo()+"' and upper(t.lote)='"+ armaObj.getLote().toUpperCase()+"'"); + dto.addFiltro(filtro); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static TarmArmas findSimple(String carma) { + try { + ImportacionProduccionController cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", carma); + cc.querydatabasesimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static Boolean isArmaDuplicada(TarmArmas armaObj) { + Boolean isDuplicada = Boolean.FALSE; + ImportacionProduccionController cc; + try { + cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabaseArmaDuplicada(armaObj); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + for(TarmArmas armaTmp:cc.lrecord){ + TarmTipoArmaExplosivo tipoArmaExpTmp = TiposArmasExplosivosController.findarma(armaTmp.getCtipoarmaexplosivo()); + TgeneCatalogDetail claseTmp = CatalogDetailController.findCatalogo(tipoArmaExpTmp.getClasecodigo(), tipoArmaExpTmp.getClase()); + TgeneCatalogDetail tipoArmaTmp = CatalogDetailController.findCatalogo(tipoArmaExpTmp.getTipoarmaexplosivocodigo(), tipoArmaExpTmp.getTipoarmaexplosivo()); + TgeneCatalogDetail calibreTmp = CatalogDetailController.findCatalogo(tipoArmaExpTmp.getCalibrecodigo(), tipoArmaExpTmp.getCalibre()); + // Valido la clase, tipoarma y calibre solo para armas de fuego y armas no letales + if(claseTmp.getPk().getCatalog().equals("0010000001") || claseTmp.getPk().getCatalog().equals("0010000008")){ + if(armaObj.getModifiedData().get("clase")!=null && armaObj.getModifiedData().get("tipoarmaexplosivo")!=null){ + if(armaObj.getModifiedData().get("clase").toString().equalsIgnoreCase(claseTmp!=null?claseTmp.getDescription():"")&& + armaObj.getModifiedData().get("tipoarmaexplosivo").toString().equalsIgnoreCase(tipoArmaTmp!=null?tipoArmaTmp.getDescription():"")){ + if(armaObj.getModifiedData().get("calibre")!=null && calibreTmp!=null && armaObj.getModifiedData().get("calibre").toString().equalsIgnoreCase(calibreTmp.getDescription())){ + isDuplicada = Boolean.TRUE; + break; + } + } + }else{ + MessageHelper.setMessageError("CLASE Y/O TIPO DE ARMA EXPLOSIVO INCORRECTOS"); + } + } + } + + } + return isDuplicada; + } catch (Exception e) { + // TODO Auto-generated catch block + MessageHelper.setMessageError(e); + return null; + } + } + + + public static TarmArmas find(String carma) { + try { + + ImportacionProduccionController cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", carma); + cc.querydatabasesimple(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if(tarmTipoArmaExplosivo!=null){ + if(tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null){ + cc.record.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getTipoarmaexplosivo() != null && tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo() != null){ + cc.record.modifiedData().put("tipo",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo())!=null? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(),tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getClase() != null && tarmTipoArmaExplosivo.getClasecodigo() != null){ + cc.record.modifiedData().put("clase",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription():""); + } + TarmRegistroArmas registroArmas = new TarmRegistroArmas(); + TcustPersonDetail detallePersona = new TcustPersonDetail(); + if(cc.record.getCregistro()!=null ){ + registroArmas = RegistroArmController.findByCodigo(String.valueOf(cc.record.getCregistro())); + if(registroArmas!=null){ + detallePersona= PersonDetailController.find(String.valueOf(registroArmas.getPersoncode())); + } + } + cc.record.modifiedData().put("razonsPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getName()); + cc.record.modifiedData().put("documentoPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getIdentification()); + cc.record.modifiedData().put("marca",(cc.record ==null || cc.record.getMarca()==null || cc.record.getMarca().isEmpty() || cc.record.getMarcacodigo()==null || cc.record.getMarcacodigo().isEmpty())?"":CatalogDetailController.findxCodigoCodcatalogo(cc.record.getMarca(), cc.record.getMarcacodigo()).getDescription()); + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public TgeneCatalogDetail getTipoDocumento() { + return tipoDocumento; + } + + public void setTipoDocumento(TgeneCatalogDetail tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } + + public TcustPersonDetail getDetallesPersona() { + return detallesPersona; + } + + public void setDetallesPersona(TcustPersonDetail detallesPersona) { + this.detallesPersona = detallesPersona; + } + + public List getTiposRegistro() { + return tiposRegistro; + } + + public void setTiposRegistro(List tiposRegistro) { + this.tiposRegistro = tiposRegistro; + } + + public TcustPersonDetail getUsuario() { + return usuario; + } + + public void setUsuario(TcustPersonDetail usuario) { + this.usuario = usuario; + } + + public List getLdocumentospersona() { + return ldocumentospersona; + } + + public void setLdocumentospersona( + List ldocumentospersona) { + this.ldocumentospersona = ldocumentospersona; + } + +// public TarmRegistroArmas getRegistro() { +// return registro; +// } +// +// public void setRegistro(TarmRegistroArmas registro) { +// this.registro = registro; +// } + + public List getLpaises() { + return lpaises; + } + + public void setLpaises(List lpaises) { + this.lpaises = lpaises; + } + + public List getLciudades() { + return lciudades; + } + + public void setLciudades(List lciudades) { + this.lciudades = lciudades; + } + + public List getLaeropuertos() { + return laeropuertos; + } + + public void setLaeropuertos(List laeropuertos) { + this.laeropuertos = laeropuertos; + } + + public String getCodigoProvincia() { + return codigoProvincia; + } + + public void setCodigoProvincia(String codigoProvincia) { + this.codigoProvincia = codigoProvincia; + } + + public String getCodigoCanton() { + return codigoCanton; + } + + public void setCodigoCanton(String codigoCanton) { + this.codigoCanton = codigoCanton; + } + + public TarmRegistroArmas getRegistro() { + return registro; + } + + public void setRegistro(TarmRegistroArmas registro) { + this.registro = registro; + } + + public String getCategoria() { + return categoria; + } + + public void setCategoria(String categoria) { + this.categoria = categoria; + } + + public Boolean getEstadoDesaduanizado() { + return estadoDesaduanizado; + } + + public void setEstadoDesaduanizado(Boolean estadoDesaduanizado) { + this.estadoDesaduanizado = estadoDesaduanizado; + } + + public Boolean getEsNuevaImportacion() { + return esNuevaImportacion; + } + + public void setEsNuevaImportacion(Boolean esNuevaImportacion) { + this.esNuevaImportacion = esNuevaImportacion; + } + + public String getFilterAUCP() { + return filterAUCP; + } + + public void setFilterAUCP(String filterAUCP) { + this.filterAUCP = filterAUCP; + } + + public TarmCarga getCarga() { + return carga; + } + + public void setCarga(TarmCarga carga) { + this.carga = carga; + } + + public Boolean getIsSelectAucpPrevio() { + return isSelectAucpPrevio; + } + + public void setIsSelectAucpPrevio(Boolean isSelectAucpPrevio) { + this.isSelectAucpPrevio = isSelectAucpPrevio; + } + + public Boolean getIsSave() { + return isSave; + } + + public void setIsSave(Boolean isSave) { + this.isSave = isSave; + } + + public InputNumber getCantidadTxt() { + return cantidadTxt; + } + + public void setCantidadTxt(InputNumber cantidadTxt) { + this.cantidadTxt = cantidadTxt; + } + + public List getLpartidaArancelaria() { + return lpartidaArancelaria; + } + + public void setLpartidaArancelaria(List lpartidaArancelaria) { + this.lpartidaArancelaria = lpartidaArancelaria; + } + + public Boolean getIsEnableCategoria() { + return isEnableCategoria; + } + + public void setIsEnableCategoria(Boolean isEnableCategoria) { + this.isEnableCategoria = isEnableCategoria; + } + + + +} + + diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ImprimirVerificacionReimpresionController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ImprimirVerificacionReimpresionController.java.svn-base new file mode 100644 index 0000000..e70cfb5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ImprimirVerificacionReimpresionController.java.svn-base @@ -0,0 +1,451 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.event.AjaxBehaviorEvent; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ImprimirVerificacionReimpresionController extends AbstractController { + + + /* + * Variable para verificar seleccion de documento + */ + private Boolean verifica = false; + /* + * Variable para habilitar documentos a imprimir + */ + private Boolean habimprimir = Boolean.TRUE; + /* + * Variable que coloca en verdadero o en falso. + */ + private Boolean valorColocar = Boolean.FALSE; + /* + * Hailita el boton del flujo + */ + private Boolean btnFlujo = Boolean.FALSE; + /* + * Bean del tipo TarmSolicitud + */ + TarmSolicitud solic= new TarmSolicitud(); + /* + * Variable que almacena el codigo de la solicitud + */ + private String csolicitud; + + @ManagedProperty(value = "#{solicitudController}") + private SolicitudController solicitudController; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * Constructor + * @throws Exception + */ + public ImprimirVerificacionReimpresionController() throws Exception { + super(TarmSolicitudDocumento.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + try { + this.pasteBpmScreenParameters(); + super.startQuery(); + + if(super.getMfilters().get("csolicitud")==null || super.getMfilters().get("csolicitud").isEmpty()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_noexistesolicitud")); + return; + } + + csolicitud=super.getMfilters().get("csolicitud"); + this.getMfilters().clear(); + //this.getMfilters().put("pk.csolicitud", csolicitud); + solic= SolicitudController.findSolicitudxcodsolicitud(csolicitud); + this.getMfilelds().put("numerosolicitud", solic.getNumerosolicitud()); + // Inicializa autoconsulta + this.init(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "VERIFICARDOCUMENTOS"; + querydatabase(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + Filter filtroSinImpresionSolicitud=new Filter(); + filtroSinImpresionSolicitud.setSql("t.chkimpresion='Y' and t.pk.csolicitud = '" + solic.getPk() + "'"); + dto.addFiltro(filtroSinImpresionSolicitud); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + SubQuery qry = new SubQuery("TarmSolicitud", "ccentrocontrol", "ccentrocontrol", "i.pk = t.pk.csolicitud"); + dto.addSubQuery(qry); + SubQuery qry2 = new SubQuery("TgeneCatalogDetail", "description", "tramitedesc", + "i.pk.catalog = (select a.tipotramite from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento))) "// t.pk.csolicitud + + " and " + + "i.pk.catalogcode = (select a.tipotramitecodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))"); + dto.addSubQuery(qry2); + SubQuery qry3 = new SubQuery("TgeneCatalogDetail", "description", "categoriadesc", + "i.pk.catalog = (select a.categoria from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))" + + " and " + + "i.pk.catalogcode = (select a.categoriacodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))"); + dto.addSubQuery(qry3); + SubQuery qry4 = new SubQuery("TgeneCatalogDetail", "description", "usoactdesc", + "i.pk.catalog = (select a.usoactividad from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))" + + " and " + + "i.pk.catalogcode = (select a.usoactividadcodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))"); + dto.addSubQuery(qry4); + SubQuery qry42 = new SubQuery("TgeneCatalogDetail", "description", "tipoautodesc", + "i.pk.catalog = (select a.tipoautorizacion from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))" + + " and " + + "i.pk.catalogcode = (select a.tipoautorizacioncodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))"); + dto.addSubQuery(qry42); + + + //ubicacion + SubQuery qryUbicacion = new SubQuery("TgeneProvince", "description", "ubicaciondesc", + "i.pk.countrycode = 'EC'" + + " and " + + "i.pk.provincecode = (select a.provincecode from TcustPersonAddress a where a.pk.personcode =(select o.personcode from TarmDocumentoHabilitante o where o.pk= t.pk.cdocumento )" + + " and a.principal='Y'" + + " and a.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD') )");// + dto.addSubQuery(qryUbicacion); + //TarmSolicitudDocumento + + SubQuery qry5 = new SubQuery("TarmDocumentoHabilitante", "fechaemision", "fechaemision", "i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry5); + SubQuery qry6 = new SubQuery("TarmDocumentoHabilitante", "fechaexpiracion", "fechaexpiracion", "i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry6); + SubQuery qry61 = new SubQuery("TarmDocumentoHabilitante", "estado ", "estado1", "i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry61); + SubQuery qry611 = new SubQuery("TarmDocumentoHabilitante", "estadocode ", "estado11", "i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry611); + SubQuery qry7 = new SubQuery("TgeneCatalogDetail", "description", "estado", + "i.pk.catalog = (select a.estado from TarmDocumentoHabilitante a where a.pk= t.pk.cdocumento) and " + + "i.pk.catalogcode = (select a.estadocode from TarmDocumentoHabilitante a where a.pk= t.pk.cdocumento)"); + dto.addSubQuery(qry7); + SubQuery qry8 = new SubQuery("TarmDocumentoHabilitante", "carma", "carma", "i.pk = t.pk.cdocumento and i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry8); + SubQuery qry9 = new SubQuery("TarmDocumentoHabilitante", "codigoarma", "codigoarma", "i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry9); + SubQuery qry10 = new SubQuery("TgeneCatalogDetail", "description", "tipoautorizacion", + "i.pk.catalog = (select a.tipoautorizacion from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud)) and " + + "i.pk.catalogcode = (select a.tipoautorizacioncodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud))"); + dto.addSubQuery(qry10); + + SubQuery qry11 = new SubQuery("TarmDocumentoHabilitante", "xpath", "xpath", "i.pk = t.pk.cdocumento "); + dto.addSubQuery(qry11); +/* Filter seleccionados = new Filter(); + seleccionados.setSql("chkimpresion = 'Y'"); + dto.getLfilter().add(seleccionados);*/ + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + request.put("querytype", "P"); + request.put("queryalias", "VDOCUMENTO"); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + this.completaArmas(); + super.postQuery(this.lrecord); + lista(); + + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Verifica la selección del documento según el check de reimpresión + */ + public void lista(){ + for (TarmSolicitudDocumento solicituddoc : lrecord) { + if(solicituddoc.getChkimpresion().equals("Y")){ + solicituddoc.getModifiedData().put("verificador", Boolean.TRUE); + }else{ + solicituddoc.getModifiedData().put("verificador", Boolean.FALSE); + } + } + } + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + this.actualizaVerificado(); + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + /*if(!dtosave.pendingProcess()){ + return; + }*/ + + + + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + btnFlujo = true; + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Selecciona los registros para establecer si el registro se reimprime o no. + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + + if(Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")){ + this.valorColocar = Boolean.TRUE; + }else { + this.valorColocar = Boolean.FALSE; + } + for (TarmSolicitudDocumento solicituddoc : lrecord) { + solicituddoc.getModifiedData().put("verificado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que verifica la eleccion del check + */ + public void verificar(){ + for (TarmSolicitudDocumento solicituddoc : lrecord) { + if(solicituddoc.getChkimpresion() == "Y"){ + this.verifica = true; + }else { + this.verifica = false; + } + } + } + /** + * Método que actualiza la elección del check + * @throws Exception + */ + public void actualizaVerificado() throws Exception{ + for (TarmSolicitudDocumento solicituddoc : lrecord) { + if( solicituddoc.getModifiedData().get("verificado").equals(Boolean.TRUE)){ + solicituddoc.setVerificado("Y"); + }else { + solicituddoc.setVerificado("N"); + } + record=solicituddoc; + super.update(); + } + } + /** + * Método que habilita el botón imprimir según check seleccionado + * @param event + */ + public void habilitaImprimir(AjaxBehaviorEvent event){ + try { + if(Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")){ + this.habimprimir = Boolean.FALSE; + }else { + this.habimprimir = Boolean.TRUE; + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método que completa la información del arma para los registros de la + * tabla TarmSolicitudDocumento + */ + public void completaArmas(){ + for(int i=0;i { + + /** + * + */ + private static final long serialVersionUID = 8843091476010012919L; + + /** + * Controlador que maneja alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * Controlador que maneja reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{armasController}") + private ArmasController armas; + + private TarmArmas arma = new TarmArmas(); + + private String editarReg; + + private String codigoSolicitud; + + private boolean habilitaButtom; + + private TarmCentroControl centroControl = new TarmCentroControl(); + + private List listadoArmasPruebas = new ArrayList<>(); + + private String observacion; + + private String estado; + + private Date fec_actual; + + private String formato; + + private String xpathflujo; + + private TcustPersonDetail responsableCentroControl= null; + + private TsafeUserDetail tsafeUserDetailUsuario = null; + + private Boolean btnFlujo; + + private List tarmArmaPruebasList; + /** + * lista del catalogo de las acciones (Aceptar o rechazar) + */ + private List laccion; + + private boolean deshabilitadoGenerarReporte=true; + + private TarmSolicitud solicitud; + private TarmSolicitudTramite solicitudTramite; + private TarmTramite tramite; + private TcustPersonAddress direccionCliente; + private String provincia; + private String canton; + private String ciudad; + private String direccion; + private TgeneCatalogDetail estadotramite; + private TgeneCatalogDetail usoActividad; + private TcustPersonDetail personaDetalle; + private TgeneCatalogDetail identificacion; + private TgeneCatalogDetail detallecatalogoTipoTramite; + private TgeneCatalogDetail detallecatalogo; + /*** + * Bandera para saber el tramite seleccionano, NOLETAL,COLECCION,.. + * @throws Exception + */ + private String tramiteingresado; + + public IngresoFichaTecnicaArmasController() throws Exception { + super(TarmArmaPruebas.class); + } + + @PostConstruct + private void postconstruct() { + System.out.println("postconstruct"); + try { + startQuery(); + this.init(); + laccion=CatalogDetailController.find("ACCION"); + if(codigoSolicitud!=null){ + caragarArmas(); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + + } + } + + public void startQuery() { + System.out.println("startQuery"); + try { + this.pasteBpmScreenParameters(); + codigoSolicitud=super.getMfilters().get("csolicitud");//"1012";//2656 + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + private void init() { + System.out.println("init"); + recperpage = 3000; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "INGRESOFICHAARMAS"; + try { + if(this.obtenerCentroControl()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sin_centrocontrol")); + return; + } + + solicitud=SolicitudController.findSolicitudxcodsolicitud(codigoSolicitud); + //VALIDA EL tramite seleccionado + this.validarTramite(); + solicitudTramite=SolicitudTramiteController.findByCSolicitud(codigoSolicitud); + tramite=TarmTramiteController.find(solicitud.getCtramite()+""); + direccionCliente=PersonAddressController.find(String.valueOf(solicitud.getPersoncode())) ; + provincia = direccionCliente.modifiedData().get("provincia")==null?null: direccionCliente.modifiedData().get("provincia").toString(); //personAddressController.getLprovinces()==null || .getLprovinces().isEmpty()?null:personAddressController.getLprovinces().get(0); + canton = direccionCliente.modifiedData().get("canton")==null?null: direccionCliente.modifiedData().get("canton").toString();//personAddressController.getLcantones()==null || personAddressController.getLcantones().isEmpty()?null:personAddressController.getLcantones().get(0); + ciudad = direccionCliente.modifiedData().get("ciudad")==null?null: direccionCliente.modifiedData().get("ciudad").toString();//personAddressController.getLcities()==null || personAddressController.getLcities().isEmpty()?null:personAddressController.getLcities().get(0); + direccion= direccionCliente.getAddress(); + estadotramite = (solicitudTramite.getEstadotramite()==null || solicitudTramite.getEstadotramitecodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(solicitudTramite.getEstadotramite(), solicitudTramite.getEstadotramitecodigo()); + usoActividad = (tramite.getUsoactividad()==null || tramite.getUsoactividadcodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + personaDetalle = PersonDetailController.find(String.valueOf(solicitud.getPersoncode())); + identificacion = (personaDetalle.getIdentificationcatalog()==null || personaDetalle.getIdentificationcatalogcode()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(personaDetalle.getIdentificationcatalog(), personaDetalle.getIdentificationcatalogcode()); + detallecatalogoTipoTramite = (tramite.getTipoautorizacion()==null || tramite.getTipoautorizacioncodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + detallecatalogo = (tramite.getCategoria()==null || tramite.getCategoriacodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + + record=new TarmArmaPruebas(); + this.fec_actual = new Date(); + this.habilitaButtom = true; + this.responsableCentroControl = new TcustPersonDetail(); + this.responsableCentroControl = new TcustPersonDetail(); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + this.obtenerResponsableCentroControl(); + btnFlujo=Boolean.FALSE; + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void validarTramite(){ + tramiteingresado = "OTROS"; + TgeneParameters parametrofichanoletal=ParametersController.find("CODIGO.FICHANOLETAL", "1"); + if(parametrofichanoletal!=null && parametrofichanoletal.getTextvalue()!=null && !parametrofichanoletal.getTextvalue().trim().isEmpty()){ + String [] arrayCodTramite=parametrofichanoletal.getTextvalue().split(","); + ListlistaCodTraite=Arrays.asList(arrayCodTramite); + for (String item : listaCodTraite) { + Long codigotramite=Long.parseLong(item); + if(solicitud.getCtramite().equals(codigotramite) || + codigotramite.longValue()==solicitud.getCtramite().longValue()){ + tramiteingresado = "NOLETAL"; + } + } + } + TgeneParameters parametrofichacoleccion=ParametersController.find("CODIGO.FICHACOLECCION", "1"); + if(parametrofichacoleccion!=null && parametrofichacoleccion.getTextvalue()!=null && !parametrofichacoleccion.getTextvalue().trim().isEmpty()){ + String [] arrayCodTramite=parametrofichacoleccion.getTextvalue().split(","); + ListlistaCodTraite=Arrays.asList(arrayCodTramite); + for (String item : listaCodTraite) { + Long codigotramite=Long.parseLong(item); + if(solicitud.getCtramite().equals(codigotramite) || + codigotramite.longValue()==solicitud.getCtramite().longValue()){ + tramiteingresado = "COLECCION"; + } + } + } + } + + + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + private void querydatabaseArma(){ + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void caragarArmas() { + try { + List listaSolicitudArmas = RecepcionArmasController.findPorSolicitudTodas(codigoSolicitud); + tarmArmaPruebasList = new ArrayList<>(); + for (TarmSolicitudArmas solicitudArmas : listaSolicitudArmas) { + TarmArmaPruebas armaPrueba = find(codigoSolicitud,solicitudArmas.getPk().getCarma()); + if (armaPrueba != null) { + armaPrueba.getModifiedData().put("tarmArmarecordPruebas", armaPrueba); + // + TarmArmas tarmArma = ArmasController.find(solicitudArmas.getPk().getCarma(), null); + armaPrueba.modifiedData().put("arma",tarmArma!=null?tarmArma:new TarmArmas()); + armaPrueba.modifiedData().put("impresion",Boolean.FALSE); + tarmArmaPruebasList.add(armaPrueba); + } else { + this.create(); + record.getModifiedData().put("tarmArmaPruebas", armaPrueba); + this.record.setCarma(solicitudArmas.getPk().getCarma()); + this.record.setCsolicitud(codigoSolicitud); + this.record.setPersoncode(solicitudArmas.getPk().getPersoncode()); + this.record.isnew = true; + // + TarmArmas tarmArma = ArmasController.find(solicitudArmas.getPk().getCarma(), null); + record.modifiedData().put("arma",tarmArma!=null?tarmArma:new TarmArmas()); + record.modifiedData().put("impresion",Boolean.FALSE); + tarmArmaPruebasList.add(record); + } + } + } catch (Throwable e) { + e.printStackTrace(); + } + } + + @Override + public void save() { + try { + if(cargarArchivo()){ + return; + } + // Validacion para cambio de estado de arma a estado aprobada + TarmArmas tarmArmaObj = ArmasController.find(record.getCarma(), null); + if(record.getApruebaevaluacion().equals("Y")){ + String estadoarma="APTA"; + System.out.println("solicitud.getCtramite() "+solicitud.getCtramite()); + if(tramiteingresado!=null && !tramiteingresado.trim().isEmpty() && tramiteingresado.equals("COLECCION")){ + estadoarma="COLE"; + } + tarmArmaObj.setEstado(estadoarma); + if(armas.getMfilters().get("csolicitud")!=null){ + armas.getMfilters().remove("csolicitud"); + } + armas.update(tarmArmaObj); + armas.save(); + }else if(record.getApruebaevaluacion().equals("N")){ + tarmArmaObj.setEstado("NAPT"); + armas.update(tarmArmaObj); + armas.save(); + } + + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + request.setSaveTables(msave); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + dtosave.setPosition(2); + msave.put(beanalias, dtosave); + request.setSaveTables(msave); + + DtoSave dtoSaveArma = armas.getDtoSave(); + dtoSaveArma.setIsForm(Boolean.TRUE); + dtoSaveArma.setReturnpk(Boolean.TRUE); + dtoSaveArma.setPosition(1); + msave.put(armas.getBeanalias(), dtoSaveArma); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + record.modifiedData().put("GUARDA", "S"); + MessageHelper.setMessageInfo(resp); + } else { + record.modifiedData().put("GUARDA", "N"); + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + record.modifiedData().put("GUARDA", "N"); + MessageHelper.setMessageError(e); + } + } + + public void uploadImpronta(FileUploadEvent event) { + record.modifiedData().put("FileUploadImpronta", event.getFile()); + } + + public void uploadFoto(FileUploadEvent event) { + record.modifiedData().put("FileUploadFoto", event.getFile()); + } + + /** + * Metodo invocado al cerrar el dialogo del registro de la ficha tecnica de las armas + * @throws Exception + */ + public Boolean cargarArchivo() throws Exception { + Boolean msgArchivos=Boolean.FALSE; + //Impronta + UploadedFile uploadedFileImpronta=null; + if(record.modifiedData().get("FileUploadImpronta")!=null){ + uploadedFileImpronta= (UploadedFile)record.modifiedData().get("FileUploadImpronta"); + }else{ + MessageHelper.setMessageError("INGRESE LA IMPRONTA"); + msgArchivos=Boolean.TRUE; + } + //FOTO + UploadedFile uploadedFoto=null; + if(record.modifiedData().get("FileUploadFoto")!=null){ + uploadedFoto= (UploadedFile)record.modifiedData().get("FileUploadFoto"); + }else{ + MessageHelper.setMessageError("INGRESE LA FOTO"); + msgArchivos=Boolean.TRUE; + } + if(msgArchivos){ + return msgArchivos; + } + String xPathLocation= getRutaDocumento(); + String xphat1=uploadedFoto.getFileName(); + if(xphat1.length()<9){ + xphat1="DOCUMENTO-"+xphat1; + } + if(alfrescoController.uploadFile(uploadedFoto.getInputstream(),xphat1, xPathLocation+ "/cm:fotografia")){ + record.setXpathfotografia(xPathLocation + "/cm:fotografia/cm:" + xphat1); + record.setImagenfotografia(uploadedFoto.getContents()); + }else{ + MessageHelper.setMessageError("ERROR AL CARGAR LA FOTO"); + return Boolean.TRUE; + } + String xphat2=uploadedFileImpronta.getFileName(); + if(xphat2.length()<9){ + xphat2="DOCUMENTO-"+xphat2; + } + if(alfrescoController.uploadFile(uploadedFileImpronta.getInputstream(),xphat2, xPathLocation+ "/cm:impronta")){ + record.setXpathimpronta(xPathLocation + "/cm:impronta/cm:" + xphat2); + this.record.setImagenimpronta(uploadedFileImpronta.getContents()); + }else{ + MessageHelper.setMessageError("ERROR AL CARGAR LA IMPRONTA"); + return Boolean.TRUE; + } + record.modifiedData().remove("FileUploadImpronta"); + record.modifiedData().remove("FileUploadFoto"); + super.update(); + this.habilitaButtom = false; + return msgArchivos; + } + + + public void verificarPuedeGenerarReporte(){ + for(TarmArmaPruebas tarmArmaPruebas:this.tarmArmaPruebasList){ + //IMPRIME record.modifiedData().get("IMPRIME").equals("S") + if(tarmArmaPruebas.getPk()==null ||tarmArmaPruebas.getImagenfotografia()==null||tarmArmaPruebas.getImagenimpronta()==null + ||tarmArmaPruebas.getXpathfichatecarmas()==null + || tarmArmaPruebas.getIsimpreso()==null || !tarmArmaPruebas.getIsimpreso().equalsIgnoreCase("Y")){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("lbl_impresionarma1") + tarmArmaPruebas.getCarma() + MsgControlArmas.getProperty("lbl_impresionarma2")); + deshabilitadoGenerarReporte = true; + return; + } + } + deshabilitadoGenerarReporte = false; + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + if(deshabilitadoGenerarReporte && !btnFlujo){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generereporte")); + return; + } + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("csolicitud", codigoSolicitud); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + btnFlujo=Boolean.FALSE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * @return + * @throws Exception + */ + public String codigoAceptado() throws Exception { + TgeneParameters f = ParametersController.find("ACEPTADO", "1"); + return f.getTextvalue(); + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Metodo para armar la ruta del documento + * @return + */ + public String getRutaDocumento() { + Calendar calendar = Calendar.getInstance(); + StringBuilder ruta = new StringBuilder("cm:Solicitudes"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append( + (calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + ruta = ruta.append("/cm:D-").append( + (calendar.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (calendar.get(Calendar.DAY_OF_MONTH)) : (calendar.get(Calendar.DAY_OF_MONTH))); + TarmSolicitud solicitud = SolicitudArmasController.find(codigoSolicitud); + ruta = ruta.append("/cm:").append(solicitud.getNumerosolicitud()); + ruta = ruta.append("/cm:").append("armas"); + return ruta.toString(); + } + + /** + * Metodo que indica si se debe habilitar el boton del pantalla ficha tecnica + */ + public void habilitarBoton() { + this.habilitaButtom = true; + } + + + /** + * Metodo que indica si se debe habilitar el boton del pantalla ficha tecnica + */ + public void cerrar() { + if(record.modifiedData().get("GUARDA")!=null && record.modifiedData().get("GUARDA").equals("S") && + record.modifiedData().get("IMPRIME")!=null && record.modifiedData().get("IMPRIME").equals("S") ){ + }else{ + MessageHelper.setMessageError("GUARDE Y GENERE EL REPORTE"); + } + } + + + /** + * Ejecuta reporte de registro balistico + * + */ + public void reporteRegistroBalistico() { + try { + String gradoUsuario =""; + String path = "armas/reports/registroBalistico"; + String filename=MsgControlArmas.getProperty("lbl_registroBalistico"); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + + //Logos + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Obteniendo la solicitud + TarmSolicitud solicitud=SolicitudController.findSolicitudxcodsolicitud(this.codigoSolicitud); + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + + //Codigo solicitud + parameters.put("csolicitud", this.codigoSolicitud); + + //Fecha de solicitud + parameters.put("fechaSolicitud", sdf.format(solicitud.getFregistro())); + + //Obteniendo los datos del tramite + TarmTramite tramite=TarmTramiteController.find(solicitud.getCtramite().toString()); + TgeneCatalogDetail tipoTramite=CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + TgeneCatalogDetail categoria=CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + TarmSolicitudTramite solicitudTramite=SolicitudTramiteController.findByCSolicitud(this.codigoSolicitud); + TgeneCatalogDetail tipoAutorizacion=CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail usoActividad=CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + + //Tipo de tramite + if(tipoTramite!=null && tipoTramite.getDescription()!=null){ + parameters.put("tipoTramite", tipoTramite.getDescription()); + }else{ + parameters.put("tipoTramite", " "); + } + + //Categoria + if(categoria!=null && categoria.getDescription()!=null){ + parameters.put("categoria", categoria.getDescription()); + }else{ + parameters.put("categoria", " "); + } + + //No tramite + if(solicitudTramite!=null){ + parameters.put("noTramite", solicitudTramite.getNumerotramite()); + }else{ + parameters.put("noTramite", " "); + } + + //Tipo de autorizacion + if(tipoAutorizacion!=null && tipoAutorizacion.getDescription()!=null){ + parameters.put("tipoAutorizacion", tipoAutorizacion.getDescription()); + }else{ + parameters.put("tipoAutorizacion", " "); + } + + //Uso-actividad + if(usoActividad!=null && usoActividad.getDescription()!=null){ + parameters.put("usoActividad", usoActividad.getDescription()); + }else{ + parameters.put("usoActividad", " "); + } + + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if(grado != null){ + gradoUsuario = grado.getDescription()+" - "+this.responsableCentroControl.getName(); + }else{ + gradoUsuario = "Sin Grado - "+this.responsableCentroControl.getName(); + } + TcustPersonDetail person = PersonDetailController.find(String.valueOf(solicitud.getPersoncode())); + //PersonDetailController.find(String.valueOf(solicitud.getPersoncode())); + //Fecha + parameters.put("fechaActual", sdf.format(this.fec_actual)); + parameters.put("fecActualHora", new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss").format(this.fec_actual)); + parameters.put("personCode", person.getPk().getPersoncode()); + parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("usuario", this.tsafeUserDetailUsuario.getNickname()); + String format = this.formato; + try { + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + btnFlujo=Boolean.TRUE; + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if(tcustPersonAddres == null){ + return null; + } + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl(){ + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + + public void saveImprimir() { + try { + if(!record.modifiedData().get("GUARDA").equals("S")){ + MessageHelper.setMessageError("GUARDE LA FICHA PARA GENERAR EL REPORTE"); + return; + } + reporteFichaArmas(); + record.setIsimpreso("Y"); + update(); + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + request.setSaveTables(msave); + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + msave.put(beanalias, dtosave); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + record.modifiedData().put("IMPRIME", "S"); + MessageHelper.setMessageInfo(resp); + } else { + record.modifiedData().put("IMPRIME", "N"); + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + record.modifiedData().put("IMPRIME", "N"); + MessageHelper.setMessageError(e); + } + } + /** + * Obtiene el reporte de Ficha de Armas + * @throws Exception + */ + public void reporteFichaArmas() throws Exception { + String gradoUsuario =""; + String path = "armas/reports/fichaTecArmas"; + if(tramiteingresado!=null && !tramiteingresado.trim().isEmpty() && tramiteingresado.equals("NOLETAL")){ + path = "armas/reports/fichaTecArmasNoLetales"; + } + if(tramiteingresado!=null && !tramiteingresado.trim().isEmpty() && tramiteingresado.equals("COLECCION")){ + path = "armas/reports/fichaTecArmasColeccion"; + } + + String filename=MsgControlArmas.getProperty("lbl_fichaTecnicaArmas"); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + parameters.put("centroControl", this.obtenerCentroControl()); + + //Fecha actual + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("fechaActual", sdf.format(this.fec_actual)); + //Fecha de solicitud + if(solicitud!=null && solicitud.getFregistro()!=null){ + parameters.put("fechaSolicitud", sdf.format(solicitud.getFregistro())); + }else{ + parameters.put("fechaSolicitud", " "); + } + //No tramite + if(solicitudTramite!=null && solicitudTramite.getNumerotramite()!=null){ + parameters.put("noTramite", solicitudTramite.getNumerotramite()); + }else{ + parameters.put("noTramite", " "); + } + + //Tipo de tramites + if(detallecatalogoTipoTramite!=null && detallecatalogoTipoTramite.getDescription()!=null){ + parameters.put("tipoTramite", detallecatalogoTipoTramite.getDescription()); + }else{ + parameters.put("tipoTramite", " "); + } + //Estado tramite + if(estadotramite!=null && estadotramite.getDescription()!=null){ + parameters.put("estadoTramite", estadotramite.getDescription()); + }else{ + parameters.put("estadoTramite", " "); + } + + //Uso actividad + if(usoActividad!=null && usoActividad.getDescription()!=null){ + parameters.put("usoActividad",usoActividad.getDescription()); + }else{ + parameters.put("usoActividad", " "); + } + //Tipo de documento + if(identificacion!=null){ + parameters.put("tipoDocumento", identificacion.getDescription()); + }else{ + parameters.put("tipoDocumento", " "); + } + //No documento + if(personaDetalle!=null){ + parameters.put("cedula", personaDetalle.getIdentification()); + }else{ + parameters.put("cedula", " "); + } + //Nombre razon social + if(personaDetalle!=null){ + parameters.put("nombreRazon", personaDetalle.getName()); + }else{ + parameters.put("nombreRazon", " "); + } + //Provincia + if(provincia !=null){ + parameters.put("provincia", provincia); + }else{ + parameters.put("provincia", " "); + } + //Canton + if(canton!=null){ + parameters.put("canton", canton); + }else{ + parameters.put("canton", " "); + } + //Ciudad + if(ciudad!=null){ + parameters.put("ciudad", ciudad); + }else{ + parameters.put("ciudad", " "); + } + //Direccion + if(direccion!=null){ + parameters.put("direccion",direccion); + }else{ + parameters.put("direccion", " "); + } + //Codigo de arma + parameters.put("codigoArma", this.record.getCarma()); + //Codigo de registro de TarmArmaPrueba + parameters.put("cArmaPrueba", record.getPk().toString()); + TarmArmas arma=(TarmArmas)this.record.getModifiedData().get("arma"); + TarmRegistroArmas regArma = RegistroArmController.findByCodigo(arma.getCregistro().toString()); + TgeneCountry paisOrigen=CountryController.findcountry(regArma.getPaisorigen()); + //Clase + if(arma.getModifiedData().get("clase")!=null){ + parameters.put("clase", arma.getModifiedData().get("clase")==null?"":arma.getModifiedData().get("clase")); + }else{ + parameters.put("clase", " "); + } + //Obtniendo el tipo arma explosivo + TarmTipoArmaExplosivo tae=arma==null?null:TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo()); + //Tipo arma + TgeneCatalogDetail tipoArma=tae==null?null:CatalogDetailController.findxCodigoCodcatalogo(tae.getTipoarmaexplosivo(), "TIPOARMAEXPLOSIVO"); + parameters.put("tipoArma", (tipoArma==null || tipoArma.getDescription().isEmpty())?"": tipoArma.getDescription()); + //Serie + parameters.put("serie", (arma==null || arma.getLote()==null || arma.getLote().isEmpty())?"":arma.getLote()); + //Pais fabricacion + parameters.put("paisFabricacion", (paisOrigen==null)?"":(paisOrigen.getDescription())); + //Calibre + parameters.put("calibre", (arma.getModifiedData().get("calibre")==null)?"":arma.getModifiedData().get("calibre")); + //Longitud + TgeneCatalogDetail longitud=(tae==null || tae.getLongitud()==null || tae.getLongitudcodigo()==null || tae.getLongitud().isEmpty() || tae.getLongitudcodigo().isEmpty())?null:CatalogDetailController.findxCodigoCodcatalogo(tae.getLongitud(),tae.getLongitudcodigo()); + if(longitud!=null && longitud.getDescription()!=null){ + parameters.put("longitud", longitud.getDescription()); + }else{ + parameters.put("longitud", " "); + } + //Marca + parameters.put("marca", arma.getModifiedData().get("marca")); + //Modelo + parameters.put("modelo", arma.getModelo()); + //Color + parameters.put("color", arma.getModifiedData().get("color")); + //Observacion + parameters.put("observacion", this.record.getObservacion()); + //Aptitud de disparo + String aptitudDisparo=" "; + if(this.record.getAptituddisparo().equalsIgnoreCase("Y")){ + aptitudDisparo="BUENO"; + }else{ + aptitudDisparo="MALO"; + } + parameters.put("aptitudDisparo", aptitudDisparo); + + //Balas testigo + String balasTestigo=" "; + if(this.record.getBalastestigo()!=null && this.record.getBalastestigo().equalsIgnoreCase("Y")){ + balasTestigo=MsgControlArmas.getProperty("lbl_si"); + }else if(this.record.getBalastestigo()!=null){ + balasTestigo="NO"; + } + parameters.put("balasTestigo", balasTestigo); + + //Vainas testigo + String vainasTestigo=" "; + if(this.record.getVainastestigo()!=null && this.record.getVainastestigo().equalsIgnoreCase("Y")){ + vainasTestigo=MsgControlArmas.getProperty("lbl_si"); + }else if(this.record.getVainastestigo()!=null){ + vainasTestigo="NO"; + } + parameters.put("vainasTestigo", vainasTestigo); + + //tubocanion + String tubocanion=" "; + if(this.record.getTubocanion()!=null && this.record.getTubocanion().equalsIgnoreCase("Y")){ + tubocanion=MsgControlArmas.getProperty("lbl_si"); + parameters.put("balasTestigo", tubocanion); + }else if(this.record.getTubocanion()!=null){ + tubocanion="NO"; + parameters.put("balasTestigo", tubocanion); + } + + + //Estado final + String estadoFinal=" "; + if(this.record.getApruebaevaluacion().equalsIgnoreCase("Y")){ + estadoFinal="APROBADA"; + }else{ + estadoFinal="REPROBADA"; + } + parameters.put("estadoFinal", estadoFinal); + //Codigo de persona + parameters.put("personcode",record.getPersoncode()); + //Codigo de arma + parameters.put("codArma", record.getCarma()); + //codigo solicitud + parameters.put("csolicitud", this.codigoSolicitud); + //Grado del funcionario + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if(grado != null){ + gradoUsuario = grado.getDescription()+" - "+this.responsableCentroControl.getName(); + }else{ + gradoUsuario = "Sin Grado - "+this.responsableCentroControl.getName(); + } + parameters.put("personcode",responsableCentroControl.getPk().getPersoncode()); + parameters.put("gradoUsuario", gradoUsuario); + String format = "pdf"; + + this.xpathflujo = this.getRutaDocumento(); + filename = filename + this.record.getPk().toString(); + InputStream report=this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + if(!this.alfrescoController.uploadFile(report, filename+".pdf", this.xpathflujo)){ + throw new Exception("ERROR AL CARGAR EL REPORTE"); + } + this.record.setXpathfichatecarmas(this.xpathflujo + "/cm:" + filename+".pdf"); + this.record.getModifiedData().put("impresion",Boolean.TRUE); + } + + /** + * Metodo para encontrar por codigo de solicitud + * @param codigoSolicitud + * @return registro de armaPrueba encontrado + */ + public List findPorSolicitud(String codigoSolicitud){ + try { + IngresoFichaTecnicaArmasController cc = new IngresoFichaTecnicaArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("csolicitud", codigoSolicitud); + cc.querydatabaseArma(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para encontrar por codigo de solicitud + * @param codigoSolicitud + * @return registro de armaPrueba encontrado + */ + public static List buscarFichasPorSolicitud(String codigoSolicitud){ + try { + IngresoFichaTecnicaArmasController cc = new IngresoFichaTecnicaArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("csolicitud", codigoSolicitud); + cc.querydatabaseArma(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public TarmArmaPruebas find(String codigoSolicitud, String carma){ + try { + IngresoFichaTecnicaArmasController cc = new IngresoFichaTecnicaArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("carma", carma); + cc.addFilter("csolicitud", codigoSolicitud); + cc.querydatabaseArma(); + if (cc.lrecord != null && cc.lrecord.size()>0) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmArmaPruebas findByPk(String pk){ + try { + IngresoFichaTecnicaArmasController cc = new IngresoFichaTecnicaArmasController(); + cc.init(); + cc.recperpage = 10; + cc.addFilter("pk", pk); + cc.querydatabaseArma(); + if (cc.lrecord != null && cc.lrecord.size()>0) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + + public TarmArmas getArma() { + return arma; + } + + public void setArma(TarmArmas arma) { + this.arma = arma; + } + + public String getEditarReg() { + return editarReg; + } + + public void setEditarReg(String editarReg) { + this.editarReg = editarReg; + } + + public String getCodigoSolicitud() { + return codigoSolicitud; + } + + public void setCodigoSolicitud(String codigoSolicitud) { + this.codigoSolicitud = codigoSolicitud; + } + + public List getListadoArmasPruebas() { + return listadoArmasPruebas; + } + + public void setListadoArmasPruebas(List listadoArmasPruebas) { + this.listadoArmasPruebas = listadoArmasPruebas; + } + + + /** + * metodo que registra el cambio de la seleccion del recuperador balisitico y segun esto aprueba la evaluacion + */ + public void cambia(TarmArmaPruebas armaPruebas){ + record=null; + record=armaPruebas; + if("Y".equals(record.getAptituddisparo()) && "Y".equals(record.getVainastestigo()) && "Y".equals(record.getBalastestigo())){ + record.setApruebaevaluacion("Y"); + } + else{ + record.setApruebaevaluacion("N"); + } + habilitaButtom = true; + armaPruebas.modifiedData().put("GUARDA", "N"); + armaPruebas.modifiedData().put("IMPRIME", "N"); + record.modifiedData().put("GUARDA", "N"); + record.modifiedData().put("IMPRIME", "N"); + } + + + public String getObservacion() { + return observacion; + } + + public void setObservacion(String observacion) { + this.observacion = observacion; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public List getLaccion() { + return laccion; + } + + public void setLaccion(List laccion) { + this.laccion = laccion; + } + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public boolean isHabilitaButtom() { + return habilitaButtom; + } + + public void setHabilitaButtom(boolean habilitaButtom) { + this.habilitaButtom = habilitaButtom; + } + public String getFormato() { + return formato; + } + + public void setFormato(String formato) { + this.formato = formato; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public Boolean getBtnFlujo() { + return btnFlujo; + } + + public void setBtnFlujo(Boolean btnFlujo) { + this.btnFlujo = btnFlujo; + } + + public boolean isDeshabilitadoGenerarReporte() { + return deshabilitadoGenerarReporte; + } + + public void setDeshabilitadoGenerarReporte(boolean deshabilitadoGenerarReporte) { + this.deshabilitadoGenerarReporte = deshabilitadoGenerarReporte; + } + + + public void changeApruebaEvaluacion(){ + if(tramiteingresado!=null && !tramiteingresado.trim().isEmpty() && tramiteingresado.equals("NOLETAL")){ + if(this.record.getAptituddisparo()!=null && ("Y".equalsIgnoreCase(this.record.getAptituddisparo())) && + (this.record.getTubocanion()!=null && "Y".equalsIgnoreCase(this.record.getTubocanion())) ){ + this.record.setApruebaevaluacion("Y"); + } + else{ + this.record.setApruebaevaluacion("N"); + } + }else if(tramiteingresado!=null && !tramiteingresado.trim().isEmpty() && tramiteingresado.equals("COLECCION")){ + if(this.record.getAptituddisparo()!=null && ("Y".equalsIgnoreCase(this.record.getAptituddisparo()))){ + this.record.setApruebaevaluacion("Y"); + } + else{ + this.record.setApruebaevaluacion("N"); + } + }else{ + if(this.record.getAptituddisparo()!=null && ("Y".equalsIgnoreCase(this.record.getAptituddisparo())) && + (this.record.getBalastestigo()!=null && "Y".equalsIgnoreCase(this.record.getBalastestigo())) && + (this.record.getVainastestigo()!=null && "Y".equalsIgnoreCase(this.record.getVainastestigo()))){ + this.record.setApruebaevaluacion("Y"); + }else{ + this.record.setApruebaevaluacion("N"); + } + } + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + public TarmSolicitudTramite getSolicitudTramite() { + return solicitudTramite; + } + + public void setSolicitudTramite(TarmSolicitudTramite solicitudTramite) { + this.solicitudTramite = solicitudTramite; + } + + public TarmTramite getTramite() { + return tramite; + } + + public void setTramite(TarmTramite tramite) { + this.tramite = tramite; + } + + public TcustPersonAddress getDireccionCliente() { + return direccionCliente; + } + + public void setDireccionCliente(TcustPersonAddress direccionCliente) { + this.direccionCliente = direccionCliente; + } + + public String getProvincia() { + return provincia; + } + + public void setProvincia(String provincia) { + this.provincia = provincia; + } + + public String getCanton() { + return canton; + } + + public void setCanton(String canton) { + this.canton = canton; + } + + public String getCiudad() { + return ciudad; + } + + public void setCiudad(String ciudad) { + this.ciudad = ciudad; + } + + public String getDireccion() { + return direccion; + } + + public void setDireccion(String direccion) { + this.direccion = direccion; + } + + public TgeneCatalogDetail getEstadotramite() { + return estadotramite; + } + + public void setEstadotramite(TgeneCatalogDetail estadotramite) { + this.estadotramite = estadotramite; + } + + public TgeneCatalogDetail getUsoActividad() { + return usoActividad; + } + + public void setUsoActividad(TgeneCatalogDetail usoActividad) { + this.usoActividad = usoActividad; + } + + public TcustPersonDetail getPersonaDetalle() { + return personaDetalle; + } + + public void setPersonaDetalle(TcustPersonDetail personaDetalle) { + this.personaDetalle = personaDetalle; + } + + public TgeneCatalogDetail getIdentificacion() { + return identificacion; + } + + public void setIdentificacion(TgeneCatalogDetail identificacion) { + this.identificacion = identificacion; + } + + public TgeneCatalogDetail getDetallecatalogoTipoTramite() { + return detallecatalogoTipoTramite; + } + + public void setDetallecatalogoTipoTramite( + TgeneCatalogDetail detallecatalogoTipoTramite) { + this.detallecatalogoTipoTramite = detallecatalogoTipoTramite; + } + + public TgeneCatalogDetail getDetallecatalogo() { + return detallecatalogo; + } + + public void setDetallecatalogo(TgeneCatalogDetail detallecatalogo) { + this.detallecatalogo = detallecatalogo; + } + + public List getTarmArmaPruebasList() { + return tarmArmaPruebasList; + } + + public void setTarmArmaPruebasList(List tarmArmaPruebasList) { + this.tarmArmaPruebasList = tarmArmaPruebasList; + } + + public ArmasController getArmas() { + return armas; + } + + public void setArmas(ArmasController armas) { + this.armas = armas; + } + + public String getTramiteingresado() { + return tramiteingresado; + } + + public void setTramiteingresado(String tramiteingresado) { + this.tramiteingresado = tramiteingresado; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/IngresoFichaTecnicaArmasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/IngresoFichaTecnicaArmasController.java.svn-base new file mode 100644 index 0000000..e5c44f7 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/IngresoFichaTecnicaArmasController.java.svn-base @@ -0,0 +1,1328 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmaPruebas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * + * Controlador que administra la ficha tecnica de armas + * @author Carlos Guzman + * + */ +@ManagedBean +@ViewScoped +public class IngresoFichaTecnicaArmasController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 8843091476010012919L; + + /** + * Controlador que maneja alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * Controlador que maneja reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{armasController}") + private ArmasController armas; + + private TarmArmas arma = new TarmArmas(); + + private String editarReg; + + private String codigoSolicitud; + + private boolean habilitaButtom; + + private TarmCentroControl centroControl = new TarmCentroControl(); + + private List listadoArmasPruebas = new ArrayList<>(); + + private String observacion; + + private String estado; + + private Date fec_actual; + + private String formato; + + private String xpathflujo; + + private TcustPersonDetail responsableCentroControl= null; + + private TsafeUserDetail tsafeUserDetailUsuario = null; + + private Boolean btnFlujo; + + private List tarmArmaPruebasList; + /** + * lista del catalogo de las acciones (Aceptar o rechazar) + */ + private List laccion; + + private boolean deshabilitadoGenerarReporte=true; + + private TarmSolicitud solicitud; + private TarmSolicitudTramite solicitudTramite; + private TarmTramite tramite; + private TcustPersonAddress direccionCliente; + private String provincia; + private String canton; + private String ciudad; + private String direccion; + private TgeneCatalogDetail estadotramite; + private TgeneCatalogDetail usoActividad; + private TcustPersonDetail personaDetalle; + private TgeneCatalogDetail identificacion; + private TgeneCatalogDetail detallecatalogoTipoTramite; + private TgeneCatalogDetail detallecatalogo; + /*** + * Bandera para saber el tramite seleccionano, NOLETAL,COLECCION,.. + * @throws Exception + */ + private String tramiteingresado; + + public IngresoFichaTecnicaArmasController() throws Exception { + super(TarmArmaPruebas.class); + } + + @PostConstruct + private void postconstruct() { + System.out.println("postconstruct"); + try { + startQuery(); + this.init(); + laccion=CatalogDetailController.find("ACCION"); + if(codigoSolicitud!=null){ + caragarArmas(); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + + } + } + + public void startQuery() { + System.out.println("startQuery"); + try { + this.pasteBpmScreenParameters(); + codigoSolicitud=super.getMfilters().get("csolicitud");//"1012";//2656 + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + private void init() { + System.out.println("init"); + recperpage = 3000; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "INGRESOFICHAARMAS"; + try { + if(this.obtenerCentroControl()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sin_centrocontrol")); + return; + } + + solicitud=SolicitudController.findSolicitudxcodsolicitud(codigoSolicitud); + //VALIDA EL tramite seleccionado + this.validarTramite(); + solicitudTramite=SolicitudTramiteController.findByCSolicitud(codigoSolicitud); + tramite=TarmTramiteController.find(solicitud.getCtramite()+""); + direccionCliente=PersonAddressController.find(String.valueOf(solicitud.getPersoncode())) ; + provincia = direccionCliente.modifiedData().get("provincia")==null?null: direccionCliente.modifiedData().get("provincia").toString(); //personAddressController.getLprovinces()==null || .getLprovinces().isEmpty()?null:personAddressController.getLprovinces().get(0); + canton = direccionCliente.modifiedData().get("canton")==null?null: direccionCliente.modifiedData().get("canton").toString();//personAddressController.getLcantones()==null || personAddressController.getLcantones().isEmpty()?null:personAddressController.getLcantones().get(0); + ciudad = direccionCliente.modifiedData().get("ciudad")==null?null: direccionCliente.modifiedData().get("ciudad").toString();//personAddressController.getLcities()==null || personAddressController.getLcities().isEmpty()?null:personAddressController.getLcities().get(0); + direccion= direccionCliente.getAddress(); + estadotramite = (solicitudTramite.getEstadotramite()==null || solicitudTramite.getEstadotramitecodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(solicitudTramite.getEstadotramite(), solicitudTramite.getEstadotramitecodigo()); + usoActividad = (tramite.getUsoactividad()==null || tramite.getUsoactividadcodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + personaDetalle = PersonDetailController.find(String.valueOf(solicitud.getPersoncode())); + identificacion = (personaDetalle.getIdentificationcatalog()==null || personaDetalle.getIdentificationcatalogcode()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(personaDetalle.getIdentificationcatalog(), personaDetalle.getIdentificationcatalogcode()); + detallecatalogoTipoTramite = (tramite.getTipoautorizacion()==null || tramite.getTipoautorizacioncodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + detallecatalogo = (tramite.getCategoria()==null || tramite.getCategoriacodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + + record=new TarmArmaPruebas(); + this.fec_actual = new Date(); + this.habilitaButtom = true; + this.responsableCentroControl = new TcustPersonDetail(); + this.responsableCentroControl = new TcustPersonDetail(); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + this.obtenerResponsableCentroControl(); + btnFlujo=Boolean.FALSE; + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void validarTramite(){ + tramiteingresado = "OTROS"; + TgeneParameters parametrofichanoletal=ParametersController.find("CODIGO.FICHANOLETAL", "1"); + if(parametrofichanoletal!=null && parametrofichanoletal.getTextvalue()!=null && !parametrofichanoletal.getTextvalue().trim().isEmpty()){ + String [] arrayCodTramite=parametrofichanoletal.getTextvalue().split(","); + ListlistaCodTraite=Arrays.asList(arrayCodTramite); + for (String item : listaCodTraite) { + Long codigotramite=Long.parseLong(item); + if(solicitud.getCtramite().equals(codigotramite) || + codigotramite.longValue()==solicitud.getCtramite().longValue()){ + tramiteingresado = "NOLETAL"; + } + } + } + TgeneParameters parametrofichacoleccion=ParametersController.find("CODIGO.FICHACOLECCION", "1"); + if(parametrofichacoleccion!=null && parametrofichacoleccion.getTextvalue()!=null && !parametrofichacoleccion.getTextvalue().trim().isEmpty()){ + String [] arrayCodTramite=parametrofichacoleccion.getTextvalue().split(","); + ListlistaCodTraite=Arrays.asList(arrayCodTramite); + for (String item : listaCodTraite) { + Long codigotramite=Long.parseLong(item); + if(solicitud.getCtramite().equals(codigotramite) || + codigotramite.longValue()==solicitud.getCtramite().longValue()){ + tramiteingresado = "COLECCION"; + } + } + } + } + + + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + private void querydatabaseArma(){ + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void caragarArmas() { + try { + List listaSolicitudArmas = RecepcionArmasController.findPorSolicitudTodas(codigoSolicitud); + tarmArmaPruebasList = new ArrayList<>(); + for (TarmSolicitudArmas solicitudArmas : listaSolicitudArmas) { + TarmArmaPruebas armaPrueba = find(codigoSolicitud,solicitudArmas.getPk().getCarma()); + if (armaPrueba != null) { + armaPrueba.getModifiedData().put("tarmArmarecordPruebas", armaPrueba); + // + TarmArmas tarmArma = ArmasController.find(solicitudArmas.getPk().getCarma(), null); + armaPrueba.modifiedData().put("arma",tarmArma!=null?tarmArma:new TarmArmas()); + armaPrueba.modifiedData().put("impresion",Boolean.FALSE); + tarmArmaPruebasList.add(armaPrueba); + } else { + this.create(); + record.getModifiedData().put("tarmArmaPruebas", armaPrueba); + this.record.setCarma(solicitudArmas.getPk().getCarma()); + this.record.setCsolicitud(codigoSolicitud); + this.record.setPersoncode(solicitudArmas.getPk().getPersoncode()); + this.record.isnew = true; + // + TarmArmas tarmArma = ArmasController.find(solicitudArmas.getPk().getCarma(), null); + record.modifiedData().put("arma",tarmArma!=null?tarmArma:new TarmArmas()); + record.modifiedData().put("impresion",Boolean.FALSE); + tarmArmaPruebasList.add(record); + } + } + } catch (Throwable e) { + e.printStackTrace(); + } + } + + @Override + public void save() { + try { + if(cargarArchivo()){ + return; + } + // Validacion para cambio de estado de arma a estado aprobada + TarmArmas tarmArmaObj = ArmasController.find(record.getCarma(), null); + if(record.getApruebaevaluacion().equals("Y")){ + String estadoarma="APTA"; + System.out.println("solicitud.getCtramite() "+solicitud.getCtramite()); + if(tramiteingresado!=null && !tramiteingresado.trim().isEmpty() && tramiteingresado.equals("COLECCION")){ + estadoarma="COLE"; + } + tarmArmaObj.setEstado(estadoarma); + if(armas.getMfilters().get("csolicitud")!=null){ + armas.getMfilters().remove("csolicitud"); + } + armas.update(tarmArmaObj); + armas.save(); + }else if(record.getApruebaevaluacion().equals("N")){ + tarmArmaObj.setEstado("NAPT"); + armas.update(tarmArmaObj); + armas.save(); + } + + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + request.setSaveTables(msave); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + dtosave.setPosition(2); + msave.put(beanalias, dtosave); + request.setSaveTables(msave); + + DtoSave dtoSaveArma = armas.getDtoSave(); + dtoSaveArma.setIsForm(Boolean.TRUE); + dtoSaveArma.setReturnpk(Boolean.TRUE); + dtoSaveArma.setPosition(1); + msave.put(armas.getBeanalias(), dtoSaveArma); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + record.modifiedData().put("GUARDA", "S"); + MessageHelper.setMessageInfo(resp); + } else { + record.modifiedData().put("GUARDA", "N"); + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + record.modifiedData().put("GUARDA", "N"); + MessageHelper.setMessageError(e); + } + } + + public void uploadImpronta(FileUploadEvent event) { + record.modifiedData().put("FileUploadImpronta", event.getFile()); + } + + public void uploadFoto(FileUploadEvent event) { + record.modifiedData().put("FileUploadFoto", event.getFile()); + } + + /** + * Metodo invocado al cerrar el dialogo del registro de la ficha tecnica de las armas + * @throws Exception + */ + public Boolean cargarArchivo() throws Exception { + Boolean msgArchivos=Boolean.FALSE; + //Impronta + UploadedFile uploadedFileImpronta=null; + if(record.modifiedData().get("FileUploadImpronta")!=null){ + uploadedFileImpronta= (UploadedFile)record.modifiedData().get("FileUploadImpronta"); + }else{ + MessageHelper.setMessageError("INGRESE LA IMPRONTA"); + msgArchivos=Boolean.TRUE; + } + //FOTO + UploadedFile uploadedFoto=null; + if(record.modifiedData().get("FileUploadFoto")!=null){ + uploadedFoto= (UploadedFile)record.modifiedData().get("FileUploadFoto"); + }else{ + MessageHelper.setMessageError("INGRESE LA FOTO"); + msgArchivos=Boolean.TRUE; + } + if(msgArchivos){ + return msgArchivos; + } + String xPathLocation= getRutaDocumento(); + String xphat1=uploadedFoto.getFileName(); + if(xphat1.length()<9){ + xphat1="DOCUMENTO-"+xphat1; + } + if(alfrescoController.uploadFile(uploadedFoto.getInputstream(),xphat1, xPathLocation+ "/cm:fotografia")){ + record.setXpathfotografia(xPathLocation + "/cm:fotografia/cm:" + xphat1); + record.setImagenfotografia(uploadedFoto.getContents()); + }else{ + MessageHelper.setMessageError("ERROR AL CARGAR LA FOTO"); + return Boolean.TRUE; + } + String xphat2=uploadedFileImpronta.getFileName(); + if(xphat2.length()<9){ + xphat2="DOCUMENTO-"+xphat2; + } + if(alfrescoController.uploadFile(uploadedFileImpronta.getInputstream(),xphat2, xPathLocation+ "/cm:impronta")){ + record.setXpathimpronta(xPathLocation + "/cm:impronta/cm:" + xphat2); + this.record.setImagenimpronta(uploadedFileImpronta.getContents()); + }else{ + MessageHelper.setMessageError("ERROR AL CARGAR LA IMPRONTA"); + return Boolean.TRUE; + } + record.modifiedData().remove("FileUploadImpronta"); + record.modifiedData().remove("FileUploadFoto"); + super.update(); + this.habilitaButtom = false; + return msgArchivos; + } + + + public void verificarPuedeGenerarReporte(){ + for(TarmArmaPruebas tarmArmaPruebas:this.tarmArmaPruebasList){ + //IMPRIME record.modifiedData().get("IMPRIME").equals("S") + if(tarmArmaPruebas.getPk()==null ||tarmArmaPruebas.getImagenfotografia()==null||tarmArmaPruebas.getImagenimpronta()==null + ||tarmArmaPruebas.getXpathfichatecarmas()==null + || tarmArmaPruebas.getIsimpreso()==null || !tarmArmaPruebas.getIsimpreso().equalsIgnoreCase("Y")){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("lbl_impresionarma1") + tarmArmaPruebas.getCarma() + MsgControlArmas.getProperty("lbl_impresionarma2")); + deshabilitadoGenerarReporte = true; + return; + } + } + deshabilitadoGenerarReporte = false; + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + if(deshabilitadoGenerarReporte && !btnFlujo){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generereporte")); + return; + } + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("csolicitud", codigoSolicitud); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + btnFlujo=Boolean.FALSE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * @return + * @throws Exception + */ + public String codigoAceptado() throws Exception { + TgeneParameters f = ParametersController.find("ACEPTADO", "1"); + return f.getTextvalue(); + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Metodo para armar la ruta del documento + * @return + */ + public String getRutaDocumento() { + Calendar calendar = Calendar.getInstance(); + StringBuilder ruta = new StringBuilder("cm:Solicitudes"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append( + (calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + ruta = ruta.append("/cm:D-").append( + (calendar.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (calendar.get(Calendar.DAY_OF_MONTH)) : (calendar.get(Calendar.DAY_OF_MONTH))); + TarmSolicitud solicitud = SolicitudArmasController.find(codigoSolicitud); + ruta = ruta.append("/cm:").append(solicitud.getNumerosolicitud()); + ruta = ruta.append("/cm:").append("armas"); + return ruta.toString(); + } + + /** + * Metodo que indica si se debe habilitar el boton del pantalla ficha tecnica + */ + public void habilitarBoton() { + this.habilitaButtom = true; + } + + + /** + * Metodo que indica si se debe habilitar el boton del pantalla ficha tecnica + */ + public void cerrar() { + if(record.modifiedData().get("GUARDA")!=null && record.modifiedData().get("GUARDA").equals("S") && + record.modifiedData().get("IMPRIME")!=null && record.modifiedData().get("IMPRIME").equals("S") ){ + }else{ + MessageHelper.setMessageError("GUARDE Y GENERE EL REPORTE"); + } + } + + + /** + * Ejecuta reporte de registro balistico + * + */ + public void reporteRegistroBalistico() { + try { + String gradoUsuario =""; + String path = "armas/reports/registroBalistico"; + String filename=MsgControlArmas.getProperty("lbl_registroBalistico"); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + + //Logos + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Obteniendo la solicitud + TarmSolicitud solicitud=SolicitudController.findSolicitudxcodsolicitud(this.codigoSolicitud); + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + + //Codigo solicitud + parameters.put("csolicitud", this.codigoSolicitud); + + //Fecha de solicitud + parameters.put("fechaSolicitud", sdf.format(solicitud.getFregistro())); + + //Obteniendo los datos del tramite + TarmTramite tramite=TarmTramiteController.find(solicitud.getCtramite().toString()); + TgeneCatalogDetail tipoTramite=CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + TgeneCatalogDetail categoria=CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + TarmSolicitudTramite solicitudTramite=SolicitudTramiteController.findByCSolicitud(this.codigoSolicitud); + TgeneCatalogDetail tipoAutorizacion=CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail usoActividad=CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + + //Tipo de tramite + if(tipoTramite!=null && tipoTramite.getDescription()!=null){ + parameters.put("tipoTramite", tipoTramite.getDescription()); + }else{ + parameters.put("tipoTramite", " "); + } + + //Categoria + if(categoria!=null && categoria.getDescription()!=null){ + parameters.put("categoria", categoria.getDescription()); + }else{ + parameters.put("categoria", " "); + } + + //No tramite + if(solicitudTramite!=null){ + parameters.put("noTramite", solicitudTramite.getNumerotramite()); + }else{ + parameters.put("noTramite", " "); + } + + //Tipo de autorizacion + if(tipoAutorizacion!=null && tipoAutorizacion.getDescription()!=null){ + parameters.put("tipoAutorizacion", tipoAutorizacion.getDescription()); + }else{ + parameters.put("tipoAutorizacion", " "); + } + + //Uso-actividad + if(usoActividad!=null && usoActividad.getDescription()!=null){ + parameters.put("usoActividad", usoActividad.getDescription()); + }else{ + parameters.put("usoActividad", " "); + } + + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if(grado != null){ + gradoUsuario = grado.getDescription()+" - "+this.responsableCentroControl.getName(); + }else{ + gradoUsuario = "Sin Grado - "+this.responsableCentroControl.getName(); + } + TcustPersonDetail person = PersonDetailController.find(String.valueOf(solicitud.getPersoncode())); + //PersonDetailController.find(String.valueOf(solicitud.getPersoncode())); + //Fecha + parameters.put("fechaActual", sdf.format(this.fec_actual)); + parameters.put("fecActualHora", new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss").format(this.fec_actual)); + parameters.put("personCode", person.getPk().getPersoncode()); + parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("usuario", this.tsafeUserDetailUsuario.getNickname()); + String format = this.formato; + try { + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + btnFlujo=Boolean.TRUE; + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if(tcustPersonAddres == null){ + return null; + } + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl(){ + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + + public void saveImprimir() { + try { + if(!record.modifiedData().get("GUARDA").equals("S")){ + MessageHelper.setMessageError("GUARDE LA FICHA PARA GENERAR EL REPORTE"); + return; + } + reporteFichaArmas(); + record.setIsimpreso("Y"); + update(); + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + request.setSaveTables(msave); + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + msave.put(beanalias, dtosave); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + record.modifiedData().put("IMPRIME", "S"); + MessageHelper.setMessageInfo(resp); + } else { + record.modifiedData().put("IMPRIME", "N"); + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + record.modifiedData().put("IMPRIME", "N"); + MessageHelper.setMessageError(e); + } + } + /** + * Obtiene el reporte de Ficha de Armas + * @throws Exception + */ + public void reporteFichaArmas() throws Exception { + String gradoUsuario =""; + String path = "armas/reports/fichaTecArmas"; + if(tramiteingresado!=null && !tramiteingresado.trim().isEmpty() && tramiteingresado.equals("NOLETAL")){ + path = "armas/reports/fichaTecArmasNoLetales"; + } + if(tramiteingresado!=null && !tramiteingresado.trim().isEmpty() && tramiteingresado.equals("COLECCION")){ + path = "armas/reports/fichaTecArmasColeccion"; + } + + String filename=MsgControlArmas.getProperty("lbl_fichaTecnicaArmas"); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + parameters.put("centroControl", this.obtenerCentroControl()); + + //Fecha actual + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("fechaActual", sdf.format(this.fec_actual)); + //Fecha de solicitud + if(solicitud!=null && solicitud.getFregistro()!=null){ + parameters.put("fechaSolicitud", sdf.format(solicitud.getFregistro())); + }else{ + parameters.put("fechaSolicitud", " "); + } + //No tramite + if(solicitudTramite!=null && solicitudTramite.getNumerotramite()!=null){ + parameters.put("noTramite", solicitudTramite.getNumerotramite()); + }else{ + parameters.put("noTramite", " "); + } + + //Tipo de tramites + if(detallecatalogoTipoTramite!=null && detallecatalogoTipoTramite.getDescription()!=null){ + parameters.put("tipoTramite", detallecatalogoTipoTramite.getDescription()); + }else{ + parameters.put("tipoTramite", " "); + } + //Estado tramite + if(estadotramite!=null && estadotramite.getDescription()!=null){ + parameters.put("estadoTramite", estadotramite.getDescription()); + }else{ + parameters.put("estadoTramite", " "); + } + + //Uso actividad + if(usoActividad!=null && usoActividad.getDescription()!=null){ + parameters.put("usoActividad",usoActividad.getDescription()); + }else{ + parameters.put("usoActividad", " "); + } + //Tipo de documento + if(identificacion!=null){ + parameters.put("tipoDocumento", identificacion.getDescription()); + }else{ + parameters.put("tipoDocumento", " "); + } + //No documento + if(personaDetalle!=null){ + parameters.put("cedula", personaDetalle.getIdentification()); + }else{ + parameters.put("cedula", " "); + } + //Nombre razon social + if(personaDetalle!=null){ + parameters.put("nombreRazon", personaDetalle.getName()); + }else{ + parameters.put("nombreRazon", " "); + } + //Provincia + if(provincia !=null){ + parameters.put("provincia", provincia); + }else{ + parameters.put("provincia", " "); + } + //Canton + if(canton!=null){ + parameters.put("canton", canton); + }else{ + parameters.put("canton", " "); + } + //Ciudad + if(ciudad!=null){ + parameters.put("ciudad", ciudad); + }else{ + parameters.put("ciudad", " "); + } + //Direccion + if(direccion!=null){ + parameters.put("direccion",direccion); + }else{ + parameters.put("direccion", " "); + } + //Codigo de arma + parameters.put("codigoArma", this.record.getCarma()); + //Codigo de registro de TarmArmaPrueba + parameters.put("cArmaPrueba", record.getPk().toString()); + TarmArmas arma=(TarmArmas)this.record.getModifiedData().get("arma"); + TarmRegistroArmas regArma = RegistroArmController.findByCodigo(arma.getCregistro().toString()); + TgeneCountry paisOrigen=CountryController.findcountry(regArma.getPaisorigen()); + //Clase + if(arma.getModifiedData().get("clase")!=null){ + parameters.put("clase", arma.getModifiedData().get("clase")==null?"":arma.getModifiedData().get("clase")); + }else{ + parameters.put("clase", " "); + } + //Obtniendo el tipo arma explosivo + TarmTipoArmaExplosivo tae=arma==null?null:TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo()); + //Tipo arma + TgeneCatalogDetail tipoArma=tae==null?null:CatalogDetailController.findxCodigoCodcatalogo(tae.getTipoarmaexplosivo(), "TIPOARMAEXPLOSIVO"); + parameters.put("tipoArma", (tipoArma==null || tipoArma.getDescription().isEmpty())?"": tipoArma.getDescription()); + //Serie + parameters.put("serie", (arma==null || arma.getLote()==null || arma.getLote().isEmpty())?"":arma.getLote()); + //Pais fabricacion + parameters.put("paisFabricacion", (paisOrigen==null)?"":(paisOrigen.getDescription())); + //Calibre + parameters.put("calibre", (arma.getModifiedData().get("calibre")==null)?"":arma.getModifiedData().get("calibre")); + //Longitud + TgeneCatalogDetail longitud=(tae==null || tae.getLongitud()==null || tae.getLongitudcodigo()==null || tae.getLongitud().isEmpty() || tae.getLongitudcodigo().isEmpty())?null:CatalogDetailController.findxCodigoCodcatalogo(tae.getLongitud(),tae.getLongitudcodigo()); + if(longitud!=null && longitud.getDescription()!=null){ + parameters.put("longitud", longitud.getDescription()); + }else{ + parameters.put("longitud", " "); + } + //Marca + parameters.put("marca", arma.getModifiedData().get("marca")); + //Modelo + parameters.put("modelo", arma.getModelo()); + //Color + parameters.put("color", arma.getModifiedData().get("color")); + //Observacion + parameters.put("observacion", this.record.getObservacion()); + //Aptitud de disparo + String aptitudDisparo=" "; + if(this.record.getAptituddisparo().equalsIgnoreCase("Y")){ + aptitudDisparo="BUENO"; + }else{ + aptitudDisparo="MALO"; + } + parameters.put("aptitudDisparo", aptitudDisparo); + + //Balas testigo + String balasTestigo=" "; + if(this.record.getBalastestigo()!=null && this.record.getBalastestigo().equalsIgnoreCase("Y")){ + balasTestigo=MsgControlArmas.getProperty("lbl_si"); + }else if(this.record.getBalastestigo()!=null){ + balasTestigo="NO"; + } + parameters.put("balasTestigo", balasTestigo); + + //Vainas testigo + String vainasTestigo=" "; + if(this.record.getVainastestigo()!=null && this.record.getVainastestigo().equalsIgnoreCase("Y")){ + vainasTestigo=MsgControlArmas.getProperty("lbl_si"); + }else if(this.record.getVainastestigo()!=null){ + vainasTestigo="NO"; + } + parameters.put("vainasTestigo", vainasTestigo); + + //tubocanion + String tubocanion=" "; + if(this.record.getTubocanion()!=null && this.record.getTubocanion().equalsIgnoreCase("Y")){ + tubocanion=MsgControlArmas.getProperty("lbl_si"); + parameters.put("balasTestigo", tubocanion); + }else if(this.record.getTubocanion()!=null){ + tubocanion="NO"; + parameters.put("balasTestigo", tubocanion); + } + + + //Estado final + String estadoFinal=" "; + if(this.record.getApruebaevaluacion().equalsIgnoreCase("Y")){ + estadoFinal="APROBADA"; + }else{ + estadoFinal="REPROBADA"; + } + parameters.put("estadoFinal", estadoFinal); + //Codigo de persona + parameters.put("personcode",record.getPersoncode()); + //Codigo de arma + parameters.put("codArma", record.getCarma()); + //codigo solicitud + parameters.put("csolicitud", this.codigoSolicitud); + //Grado del funcionario + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if(grado != null){ + gradoUsuario = grado.getDescription()+" - "+this.responsableCentroControl.getName(); + }else{ + gradoUsuario = "Sin Grado - "+this.responsableCentroControl.getName(); + } + parameters.put("personcode",responsableCentroControl.getPk().getPersoncode()); + parameters.put("gradoUsuario", gradoUsuario); + String format = "pdf"; + + this.xpathflujo = this.getRutaDocumento(); + filename = filename + this.record.getPk().toString(); + InputStream report=this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + if(!this.alfrescoController.uploadFile(report, filename+".pdf", this.xpathflujo)){ + throw new Exception("ERROR AL CARGAR EL REPORTE"); + } + this.record.setXpathfichatecarmas(this.xpathflujo + "/cm:" + filename+".pdf"); + this.record.getModifiedData().put("impresion",Boolean.TRUE); + } + + /** + * Metodo para encontrar por codigo de solicitud + * @param codigoSolicitud + * @return registro de armaPrueba encontrado + */ + public List findPorSolicitud(String codigoSolicitud){ + try { + IngresoFichaTecnicaArmasController cc = new IngresoFichaTecnicaArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("csolicitud", codigoSolicitud); + cc.querydatabaseArma(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para encontrar por codigo de solicitud + * @param codigoSolicitud + * @return registro de armaPrueba encontrado + */ + public static List buscarFichasPorSolicitud(String codigoSolicitud){ + try { + IngresoFichaTecnicaArmasController cc = new IngresoFichaTecnicaArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("csolicitud", codigoSolicitud); + cc.querydatabaseArma(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public TarmArmaPruebas find(String codigoSolicitud, String carma){ + try { + IngresoFichaTecnicaArmasController cc = new IngresoFichaTecnicaArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("carma", carma); + cc.addFilter("csolicitud", codigoSolicitud); + cc.querydatabaseArma(); + if (cc.lrecord != null && cc.lrecord.size()>0) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmArmaPruebas findByPk(String pk){ + try { + IngresoFichaTecnicaArmasController cc = new IngresoFichaTecnicaArmasController(); + cc.init(); + cc.recperpage = 10; + cc.addFilter("pk", pk); + cc.querydatabaseArma(); + if (cc.lrecord != null && cc.lrecord.size()>0) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + + public TarmArmas getArma() { + return arma; + } + + public void setArma(TarmArmas arma) { + this.arma = arma; + } + + public String getEditarReg() { + return editarReg; + } + + public void setEditarReg(String editarReg) { + this.editarReg = editarReg; + } + + public String getCodigoSolicitud() { + return codigoSolicitud; + } + + public void setCodigoSolicitud(String codigoSolicitud) { + this.codigoSolicitud = codigoSolicitud; + } + + public List getListadoArmasPruebas() { + return listadoArmasPruebas; + } + + public void setListadoArmasPruebas(List listadoArmasPruebas) { + this.listadoArmasPruebas = listadoArmasPruebas; + } + + + /** + * metodo que registra el cambio de la seleccion del recuperador balisitico y segun esto aprueba la evaluacion + */ + public void cambia(TarmArmaPruebas armaPruebas){ + record=null; + record=armaPruebas; + if("Y".equals(record.getAptituddisparo()) && "Y".equals(record.getVainastestigo()) && "Y".equals(record.getBalastestigo())){ + record.setApruebaevaluacion("Y"); + } + else{ + record.setApruebaevaluacion("N"); + } + habilitaButtom = true; + armaPruebas.modifiedData().put("GUARDA", "N"); + armaPruebas.modifiedData().put("IMPRIME", "N"); + record.modifiedData().put("GUARDA", "N"); + record.modifiedData().put("IMPRIME", "N"); + } + + + public String getObservacion() { + return observacion; + } + + public void setObservacion(String observacion) { + this.observacion = observacion; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public List getLaccion() { + return laccion; + } + + public void setLaccion(List laccion) { + this.laccion = laccion; + } + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public boolean isHabilitaButtom() { + return habilitaButtom; + } + + public void setHabilitaButtom(boolean habilitaButtom) { + this.habilitaButtom = habilitaButtom; + } + public String getFormato() { + return formato; + } + + public void setFormato(String formato) { + this.formato = formato; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public Boolean getBtnFlujo() { + return btnFlujo; + } + + public void setBtnFlujo(Boolean btnFlujo) { + this.btnFlujo = btnFlujo; + } + + public boolean isDeshabilitadoGenerarReporte() { + return deshabilitadoGenerarReporte; + } + + public void setDeshabilitadoGenerarReporte(boolean deshabilitadoGenerarReporte) { + this.deshabilitadoGenerarReporte = deshabilitadoGenerarReporte; + } + + + public void changeApruebaEvaluacion(){ + if(tramiteingresado!=null && !tramiteingresado.trim().isEmpty() && tramiteingresado.equals("NOLETAL")){ + if(this.record.getAptituddisparo()!=null && ("Y".equalsIgnoreCase(this.record.getAptituddisparo())) && + (this.record.getTubocanion()!=null && "Y".equalsIgnoreCase(this.record.getTubocanion())) ){ + this.record.setApruebaevaluacion("Y"); + } + else{ + this.record.setApruebaevaluacion("N"); + } + }else if(tramiteingresado!=null && !tramiteingresado.trim().isEmpty() && tramiteingresado.equals("COLECCION")){ + if(this.record.getAptituddisparo()!=null && ("Y".equalsIgnoreCase(this.record.getAptituddisparo()))){ + this.record.setApruebaevaluacion("Y"); + } + else{ + this.record.setApruebaevaluacion("N"); + } + }else{ + if(this.record.getAptituddisparo()!=null && ("Y".equalsIgnoreCase(this.record.getAptituddisparo())) && + (this.record.getBalastestigo()!=null && "Y".equalsIgnoreCase(this.record.getBalastestigo())) && + (this.record.getVainastestigo()!=null && "Y".equalsIgnoreCase(this.record.getVainastestigo()))){ + this.record.setApruebaevaluacion("Y"); + }else{ + this.record.setApruebaevaluacion("N"); + } + } + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + public TarmSolicitudTramite getSolicitudTramite() { + return solicitudTramite; + } + + public void setSolicitudTramite(TarmSolicitudTramite solicitudTramite) { + this.solicitudTramite = solicitudTramite; + } + + public TarmTramite getTramite() { + return tramite; + } + + public void setTramite(TarmTramite tramite) { + this.tramite = tramite; + } + + public TcustPersonAddress getDireccionCliente() { + return direccionCliente; + } + + public void setDireccionCliente(TcustPersonAddress direccionCliente) { + this.direccionCliente = direccionCliente; + } + + public String getProvincia() { + return provincia; + } + + public void setProvincia(String provincia) { + this.provincia = provincia; + } + + public String getCanton() { + return canton; + } + + public void setCanton(String canton) { + this.canton = canton; + } + + public String getCiudad() { + return ciudad; + } + + public void setCiudad(String ciudad) { + this.ciudad = ciudad; + } + + public String getDireccion() { + return direccion; + } + + public void setDireccion(String direccion) { + this.direccion = direccion; + } + + public TgeneCatalogDetail getEstadotramite() { + return estadotramite; + } + + public void setEstadotramite(TgeneCatalogDetail estadotramite) { + this.estadotramite = estadotramite; + } + + public TgeneCatalogDetail getUsoActividad() { + return usoActividad; + } + + public void setUsoActividad(TgeneCatalogDetail usoActividad) { + this.usoActividad = usoActividad; + } + + public TcustPersonDetail getPersonaDetalle() { + return personaDetalle; + } + + public void setPersonaDetalle(TcustPersonDetail personaDetalle) { + this.personaDetalle = personaDetalle; + } + + public TgeneCatalogDetail getIdentificacion() { + return identificacion; + } + + public void setIdentificacion(TgeneCatalogDetail identificacion) { + this.identificacion = identificacion; + } + + public TgeneCatalogDetail getDetallecatalogoTipoTramite() { + return detallecatalogoTipoTramite; + } + + public void setDetallecatalogoTipoTramite( + TgeneCatalogDetail detallecatalogoTipoTramite) { + this.detallecatalogoTipoTramite = detallecatalogoTipoTramite; + } + + public TgeneCatalogDetail getDetallecatalogo() { + return detallecatalogo; + } + + public void setDetallecatalogo(TgeneCatalogDetail detallecatalogo) { + this.detallecatalogo = detallecatalogo; + } + + public List getTarmArmaPruebasList() { + return tarmArmaPruebasList; + } + + public void setTarmArmaPruebasList(List tarmArmaPruebasList) { + this.tarmArmaPruebasList = tarmArmaPruebasList; + } + + public ArmasController getArmas() { + return armas; + } + + public void setArmas(ArmasController armas) { + this.armas = armas; + } + + public String getTramiteingresado() { + return tramiteingresado; + } + + public void setTramiteingresado(String tramiteingresado) { + this.tramiteingresado = tramiteingresado; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/InspeccionArchivoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/InspeccionArchivoController.java.svn-base new file mode 100644 index 0000000..1ee661e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/InspeccionArchivoController.java.svn-base @@ -0,0 +1,161 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmInspeccion; +import com.fp.persistence.parmas.soli.TarmInspeccionArchivo; + +/** + * Clase controladora del bean TgeneCatalogDetail. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class InspeccionArchivoController extends AbstractController { + + public InspeccionArchivoController() throws Exception { + super(TarmInspeccionArchivo.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "INSPECCIONARCHIVO"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.cinspeccion"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para encontrar por codigo de inspeccion + * @param codigoSolicitud + * @return registro de archivo inspeccion encontrado + */ + public static List findPorInspeccion(String codigoInspeccion){ + try { + InspeccionArchivoController cc = new InspeccionArchivoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("cinspeccion", codigoInspeccion); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que encuentra los archivos de inspeccion por codigo de solicitud + * @param codigoSolicitud + * @return una lista de archivos que cumplen todos los criterios de busqueda + */ + public static List findPorSolicitud(String codigoSolicitud){ + try { + List lInspeccion = InspeccionController.findPorSolicitud(codigoSolicitud); + List lInspeccionArchivo = new ArrayList<>(); + for(TarmInspeccion inspeccion:lInspeccion){ + List lInspeccionesArchivoEncontradas = findPorInspeccion(String.valueOf(inspeccion.getPk())); + if(lInspeccionesArchivoEncontradas!=null && !lInspeccionesArchivoEncontradas.isEmpty()){ + lInspeccionArchivo.addAll(lInspeccionesArchivoEncontradas); + } + } + return lInspeccionArchivo; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/InspeccionCambioArchivoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/InspeccionCambioArchivoController.java.svn-base new file mode 100644 index 0000000..f6e62e1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/InspeccionCambioArchivoController.java.svn-base @@ -0,0 +1,248 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmInspeccionArchivo; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TarmInspeccionArchivo. + * Se reemplaza el archivo de inspeccion, se filtra por el codigo de solicitud + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class InspeccionCambioArchivoController extends AbstractController { + + public InspeccionCambioArchivoController() throws Exception { + super(TarmInspeccionArchivo.class); + } + + /** + * Variable que nos permite cargar el documento al Alfresco + */ + private UploadedFile uploadedFile; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "INSPECCIONARCHIVO"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if(getMfilelds().get("codigosolicitud")==null && + getMfilelds().get("codigosolicitud").toString().trim().isEmpty()){ + MessageHelper.setMessageError("Ingrese el cdigo de solicitud"); + return; + } + DtoQuery dto = super.getDtoQuery(true); + + Filter filtroFinal = new Filter(); + String sqlFinal = " t.cinspeccion in (select p.pk from TarmInspeccion p where p.csolicitud in " + + "(select s.pk from TarmSolicitud s where s.numerosolicitud='"+getMfilelds().get("codigosolicitud").toString().trim()+"' )) "; + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + + dto.setOrderby("t.cinspeccion"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + for (TarmInspeccionArchivo item : lrecord) { + item.getModifiedData().put("codigosolicitud", getMfilelds().get("codigosolicitud").toString().trim()); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void update(){ + try { + String pathRuta=""; + + String xPathLocation= getRutaDocumentoSolBase(record.getXpath()); + if(uploadedFile!=null && uploadedFile.getFileName()!=null){ + String nombreArchivo = uploadedFile.getFileName(); + if(alfrescoController.uploadFile(uploadedFile.getInputstream(),nombreArchivo, xPathLocation)){ + pathRuta=xPathLocation + "/cm:" + nombreArchivo; + record.setXpathoriginal(record.getXpath()); + record.setXpath(pathRuta); + TsafeUserDetail userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + record.setUsuariocambio(userDetail.getNickname()); + super.update(); + }else{ + MessageHelper.setMessageError("Adjunte el documento"); + return; + } + }else{ + MessageHelper.setMessageError("Adjunte el documento"); + return; + } + save(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase(String xpath) { + int index = xpath.lastIndexOf('/'); + xpath = xpath.substring(0,index); + xpath = xpath+"/cm:Cambio"; + System.out.println(xpath); + return xpath; + } + + /** + * Metodo que retorna la extencion del documento que se desea subir al alfresco + */ + public String getNombre(String ruta) { + int index = ruta.lastIndexOf('/'); + if (index == -1) { + return "cambiodocumento.jpg"; + } else { + return (ruta.substring(index + 1)).replace("cm:", ""); + } + } + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en el Alfresco + */ + public void handleUpload(FileUploadEvent event){ + uploadedFile = event.getFile(); + } + + /** + * Recorta el nombre del archivo a cargarse + * @param nombre + * @return nombre recortado + */ + public String recorteNombre(String nombre){ + String fielname=nombre; + if(fielname.length()>30){ + fielname=fielname.substring(0,30)+extencionArchivo(nombre); + } + return fielname; + } + + /** + * Obtiene la extencion del archivo a cargar + * @param nombre + * @return + */ + private String extencionArchivo(String nombre){ + int pos=nombre.lastIndexOf('.'); + nombre=nombre.substring(pos); + return nombre; + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/InspeccionController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/InspeccionController.java.svn-base new file mode 100644 index 0000000..edba8d2 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/InspeccionController.java.svn-base @@ -0,0 +1,160 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.ins.TarmPlanificacionInspeccion; +import com.fp.persistence.parmas.soli.TarmInspeccion; + +/** + * Clase controladora del bean TgeneInspeccion. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class InspeccionController extends AbstractController { + + + public InspeccionController() throws Exception { + super(TarmInspeccion.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "INSPECCION"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para encontrar por codigo de solicitud + * @param codigoSolicitud + * @return registro de inspeccion encontrado + */ + public static List findPorSolicitud(String codigoSolicitud){ + try { + InspeccionController cc = new InspeccionController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("csolicitud", codigoSolicitud); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + /** + * Metodo que encuentra TarmInspeccion por year y por centro de control + * @param codigoSolicitud + * @return + */ + public static List findPorAnno(String centro, String year) { + try { + InspeccionController cc = new InspeccionController(); + cc.init(); + cc.recperpage = 300; + if(year != null){ + cc.addFilter("anno", year); + } + cc.addFilter("centrocontrol", centro); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; +// if (cc.record != null) { +// return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/InventariosController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/InventariosController.java.svn-base new file mode 100644 index 0000000..2eb8405 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/InventariosController.java.svn-base @@ -0,0 +1,2239 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.apache.commons.lang3.StringUtils; +import org.primefaces.context.RequestContext; +import org.primefaces.event.SelectEvent; +import org.primefaces.extensions.component.inputnumber.InputNumber; + +import com.fp.common.helper.Constant; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.CargaController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.lov.ArmaExplosivoLovController; +import com.fp.frontend.controller.armas.lov.CargasLovController; +import com.fp.frontend.controller.armas.parametros.CalibreLovController; +import com.fp.frontend.controller.armas.parametros.ClaseLovController; +import com.fp.frontend.controller.armas.parametros.InventarioSubidoController; +import com.fp.frontend.controller.armas.parametros.LongitudLovController; +import com.fp.frontend.controller.armas.parametros.TipoArmaExpLovController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.frontend.utility.ValidateIdentification; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.fun.TarmInventarioSubidoPorPersona; +import com.fp.persistence.parmas.fun.TarmInventarioSubidoPorPersonaKey; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Controlador principal de armas + * @author Christian Pazmino + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class InventariosController extends AbstractController { + + private Boolean estadoDesaduanizado = Boolean.FALSE; + private Boolean esNuevaImportacion = Boolean.TRUE; + private String filterAUCP; + //P lpartidaArancelaria=new ArrayList<>(); + private TarmCarga carga = new TarmCarga(); + private Boolean isSelectAucpPrevio = Boolean.FALSE; + private Boolean isSave=Boolean.FALSE; + private Boolean isEnableCategoria = Boolean.TRUE; + InputNumber cantidadTxt = new InputNumber(); + List ldeleteItems = new ArrayList(); + + @ManagedProperty(value = "#{tiposArmasExplosivosController}") + private TiposArmasExplosivosController tiposArmasExplosivosController; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmas; + + // Datos generales + private TgeneCatalogDetail tipoDocumento; + private TcustPersonDetail detallesPersona; + // Catalogo que contiene tipos de registros + private List tiposRegistro; + private TcustPersonDetail usuario; + +// private String tipoRegistro; + + //Registro armas + TarmRegistroArmas registro=new TarmRegistroArmas(); + + //Detalle de localizacion para el caso de importaciones + private List lpaises; +// private TgeneCountry pais; + //private String pais; + + //Provincia + private List lprovincias; + private String codigoProvincia; + + //Canton + private List lcantones; + private String codigoCanton; + + //Ciudad + private List lciudades; +// private TgeneCity ciudad; + + //Aeropuertos + private List laeropuertos=new ArrayList<>(); + + private List ldocumentospersona; + +// /** +// * Lista de tipos de identificación +// */ +// private List ltipoidentificacion; + /** + * Listado de estados del arma + */ + private List lestadoarma; + /** + * Listado de marcas + */ + private List lmarca; + /** + * Listado de colores + */ + private List lcolor; + /** + * Listado de tipos de fabricación + */ + private List ltipofabricacion; + /** + * Listado de unidad de medida cantidad + */ + private List lunidadmedidacantidad; + /** + * Listado de unidad medida peso + */ + private List lunidadmedidapeso; +// /** +// * Listado de paises +// */ +// private List lcountry; +// /** +// * Listado de provincias +// */ +// private List lprovincias; +// /** +// * Listado de cantones +// */ +// private List lcantones; + /** + * Listado de parroquias + */ + private List lparroquias; + /** + * Listado de ciudades + */ + private List lcities; + +// /** +// * Tipo documento +// */ +// private String tipoDoc; + +// /** +// * Número documento +// */ +// private String numDoc; + +// /** +// * Nombre/razón social +// */ +// private String nombreRazon; + + /** + * Longitud arma + */ + private String longitud; + /** + * Calibre arma + */ + private String calibre; + /** + * Clase arma + */ + private String clase; + /** + * Clase arma + */ + private String categoria; + /** + * Tipo de arma + */ + private String tipoarma; + /** + * unidad medida peso + */ + private String unidadmedidapeso; + + /** + * Bandera que indica que en realidad existe luego del ingreso de datos un tipo de arma explosivo válido + */ + private boolean existeTipoArmaExplosivo; + + /** + * Bandera que especifica que se deba verificar que exista un arma explosivo válido + */ + private boolean verificaArmaExplosivo = Boolean.TRUE; + + /** + * Bloquea la unidad de cantidad + */ + private boolean bloquearUnidadCantidad = Boolean.TRUE; + + /** + * Bloquea la unidad de peso + */ + private boolean bloquearUnidadPeso = Boolean.TRUE; + /** + * Contiene la fecha actual del sistema + */ + private Date fechaActual; + /** + * Contiene la referencia a nuevo propietario del arma + */ + private TcustPersonDetail nuevoPropietarioArma; + /** + * Tipo del arma explosivo + */ + private TarmTipoArmaExplosivo tipoArmaExplosivo ; + /** + * codigo del ruc + */ + private String codigoRuc; + /** + * codigo del ruc + */ + private String codigoCedula; + /** + * codigo del ruc + */ + private String codigoPasaporte; + + public InventariosController() throws Exception { + super(TarmArmas.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + carga.setIsnew(Boolean.TRUE); + //Localizacion + lpaises=CountryController.find(); + this.lprovincias=ProvinceController.find("EC"); + //Obteniendo los aeropuertos + this.laeropuertos=CatalogDetailController.find("AEROPUERTOS"); + this.lpartidaArancelaria=CatalogDetailController.find("PARTIDAARANCELARIA"); + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + detallesPersona= PersonDetailController.find(String.valueOf(usuario.getPk().getPersoncode())); + //Tipo de documento + tipoDocumento = CatalogDetailController.findxCodigoCodcatalogo(detallesPersona.getIdentificationcatalog(),detallesPersona.getIdentificationcatalogcode()); + //Tipos de registro +// tiposRegistro=CatalogDetailController.find("TIPOREGISTRO", "REG"); + //Tipos de registro + ListtiposRegistroAux = CatalogDetailController.find("TIPOREGISTRO", "REG"); + tiposRegistro = new ArrayList(); + for(TgeneCatalogDetail tipoReg : tiposRegistroAux){ + if(tipoReg.getPk().getCatalog().equalsIgnoreCase("PRO")){ + tiposRegistro.add(tipoReg); + } + } + + fechaActual = new Date(); + recperpage = 5000; // Cambiar al # reg a mirar. +// record = new TarmArmas(); + lrecord = new ArrayList<>(); + beanalias = "ARMAS"; +// ltipoidentificacion = CatalogDetailController.find("IDENTIFICATION"); + lestadoarma = CatalogDetailController.find("ESTADOARMA"); + lmarca = CatalogDetailController.find("MARCA"); + lcolor = CatalogDetailController.find("COLOR"); + ltipofabricacion = CatalogDetailController.find("TIPOFABRICACION"); +// lunidadmedidacantidad = CatalogDetailController.find("UCANTIDAD"); + lunidadmedidapeso = CatalogDetailController.find("UNIDADMEDIDA"); +// lcountry = CountryController.find(); + codigoRuc=codigos("CODIGO.RUC"); + codigoCedula=codigos("CODIGO.CEDULA"); + codigoPasaporte=codigos("CODIGO.PASAPORTE"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void cargarCategorias(){ + // Cargamos la lista de categorias disponibles para el usuario (en funcion de sus documentos habilitantes) + ldocumentospersona= new ArrayList<>(); + List listadocum= new ArrayList<>(); + if(registro.getTiporegistro()!=null){ + if("PRO".equals(registro.getTiporegistro())){ + listadocum=DocumentoHabilitanteController.findByPerson_Inventario(usuario.getPk().getPersoncode().toString()); + carga=new TarmCarga(); + carga.setIsnew(Boolean.TRUE); + registro.setIsnew(Boolean.TRUE); + } + }else{ + ldocumentospersona=new ArrayList<>(); + } + //Forma numero 1 (Uso de Maps). + Map mapaSinRepetidos = new HashMap(listadocum.size()); + for(TarmDocumentoHabilitante p : listadocum) { + mapaSinRepetidos.put(p.getCtramite(), p); + } + //Agrego cada elemento del map a una nueva lista y muestro cada elemento. + for(Entry p : mapaSinRepetidos.entrySet()) { + ldocumentospersona.add(p.getValue()); + } + } + + public void validarCategoria(){ + String tipoCarga = "INV"; + List cargaLst = CargaController.findXPersonaYCategoria(this.usuario.getPk().getPersoncode().toString(), categoria, tipoCarga); + if(cargaLst!=null){ +// isEnableCategoria = Boolean.FALSE; + isSave = Boolean.TRUE; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_inventarioCargadoPreviamente")); + return; + }else{ +// isEnableCategoria = Boolean.TRUE; + isSave = Boolean.FALSE; + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + String sqlFiltroPersona = ""; + String sqlFiltroSancion = ""; + String sqlFiltroEstados = ""; + String sqlFiltroClaseArmas = ""; +// String sqlFiltroFechaCaducidad = ""; + String sqlFiltroValidacionArma = "";//si entre los estados existe renovacion entonces validamos que no pueda seleccionar las mismas armas + if(this.getMfilelds().get("personcode") != null){ + sqlFiltroPersona = " t.cregistro in (SELECT c.pk FROM TarmRegistroArmas c WHERE c.personcode="+this.getMfilelds().get("personcode")+")"; + } + //agregamos los filtros en base a la consideracion del field sancion, en caso de que lo sea buscamos los sancionados que hayan cumplido el tiempo de sancion + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + if(this.getMfilelds().containsKey("sancion") && this.getMfilelds().get("sancion").toString().equals(Constant.STR_Y)){ + sqlFiltroSancion = " t.pk in (SELECT max(a.pk) FROM TarmArmas a WHERE a.codigoarma in (SELECT distinct(h.codigoarma) from TarmDocumentoHabilitante h WHERE h.pk in (SELECT d.cdocumento FROM TarmSancionDecomiso d WHERE d.personcode="+this.getMfilelds().get("personcode")+" AND d.fechafinal < TO_DATE('"+dateFormat.format(Calendar.getInstance().getTime())+"', 'YYYY-MM-DD'))) GROUP BY a.codigoarma)"; + } + + dto.setOrderby("pk"); + if(this.getMfilelds().get("ESTADOS") != null){ + String[] estados = this.getMfilelds().get("ESTADOS").toString().split(","); + StringBuffer sqlEstados = new StringBuffer(" t.estado IN ("); + for (int i = 0; i < estados.length; i++) { + sqlEstados.append("'").append(estados[i]).append("'"); + if(i < estados.length - 1){ + sqlEstados.append(","); + } + } + sqlEstados.append(")"); + sqlFiltroEstados = sqlEstados.toString(); + } + + if(this.getMfilelds().get("TRAMITE") != null){ + TarmTramite tarmTramite = (TarmTramite) this.getMfilelds().get("TRAMITE"); + sqlFiltroValidacionArma = "t.pk not in (SELECT coalesce(max(a.pk),'-1') FROM TarmArmas a WHERE a.codigoarma in (SELECT distinct(h.codigoarma) from TarmDocumentoHabilitante h WHERE h.personcode="+this.getMfilelds().get("personcode")+" AND h.ctramite="+tarmTramite.getPk()+" AND h.estado = 'APR' AND trunc(h.fechaexpiracion) >= " + "TO_DATE('" +dateFormat.format(Calendar.getInstance().getTime())+ "','yyyy-MM-dd')) GROUP BY a.codigoarma)"; + } + //estados del armas + if(this.getMfilelds().get("CLASEARMAS") != null){ + String[] clasesarma = this.getMfilelds().get("CLASEARMAS").toString().split(","); + StringBuffer sqlclasesarmas = new StringBuffer(" t.ctipoarmaexplosivo IN (select o.pk from TarmTipoArmaExplosivo o where o.clase in("); + for (int i = 0; i < clasesarma.length; i++) { + sqlclasesarmas.append("'").append(clasesarma[i]).append("'"); + if(i < clasesarma.length - 1){ + sqlclasesarmas.append(","); + } + } + sqlclasesarmas.append(")) "); + sqlFiltroClaseArmas = sqlclasesarmas.toString(); + } + +// if(this.getMfilelds().get("FECHACADUCIDADARM") != null){ +// sqlFiltroFechaCaducidad="t.fechacaducidad "+this.getMfilelds().get("FECHACADUCIDADARM"); +// } + String sqlActual = " t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma) and t.estado !='DEST' and t.estado!='VEND' and t.estado!='MING' and t.estado!='DUPL' and t.estado!='CUSTEM'" + + " and (t.peso>0 or t.cantidad>0)";//distintas de destruidas y cambio de propietario and t.cregistro=ta.cregistro para el manejo de los explosivos + +// String sqlFinal = obtenerFiltroBusquedaGeneral(sqlFiltroPersona, sqlFiltroEstados, sqlFiltroSancion, sqlFiltroValidacionArma,sqlFiltroClaseArmas,sqlFiltroFechaCaducidad, sqlActual); + String sqlFinal = obtenerFiltroBusquedaGeneral(sqlFiltroPersona, sqlFiltroEstados, sqlFiltroSancion, sqlFiltroValidacionArma,sqlFiltroClaseArmas,sqlActual); + Filter filtroFinal = new Filter(); + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void actualizaPanelImportacion(){ + if(esNuevaImportacion){ + System.out.println("Logica para cuando es una nueva importacion: " + esNuevaImportacion); + carga=new TarmCarga(); + carga.setIsnew(Boolean.TRUE); + registro.setIsnew(Boolean.TRUE); +// if(registro.getPk()!=null){ +// registro.setPk(null); +// +// } + }else{ + System.out.println("Logica para cuando es una importacion ya cargada y se consultara por AUCP: " + esNuevaImportacion); + } +// registro = new TarmRegistroArmas(); +// this.lrecord = new ArrayList(); + + } + + + private String obtenerFiltroBusquedaGeneral(String... sqlFiltros ){ + StringBuffer sqlFinal = new StringBuffer(); + for (int i = 0; i < sqlFiltros.length ; i++) { + if(sqlFinal.length() > 0 && !StringUtils.endsWith(StringUtils.trim(sqlFinal.toString()), "AND")){ + sqlFinal.append( " AND "); + } + sqlFinal.append(sqlFiltros[i]); + } + return sqlFinal.toString(); + } + + @SuppressWarnings("unchecked") + public void querydatabaseSinFiltros() { + try { + DtoQuery dto = this.getDtoQuery(); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql=" t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() throws Exception { + // TODO Auto-generated method stub + super.next(); + } + + @SuppressWarnings("unchecked") + protected void querydatabasePorCodigo() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql=" t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception{ + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TarmTipoArmaExplosivo","clase","cclase","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo= new SubQuery("TarmTipoArmaExplosivo","clasecodigo","cclasecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud= new SubQuery("TarmTipoArmaExplosivo","longitud","clongitud","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo= new SubQuery("TarmTipoArmaExplosivo","longitudcodigo","clongitudcodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ccalibre","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo= new SubQuery("TarmTipoArmaExplosivo","calibrecodigo","ccalibrecodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivo","ctipoarmaexplosivo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo= new SubQuery("TarmTipoArmaExplosivo","tipoarmaexplosivocodigo","ctipoarmaexplosivocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapeso","cunidadmedidapeso","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo= new SubQuery("TarmTipoArmaExplosivo","unidadmedidapesocodigo","cunidadmedidapesocodigo","i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida= new SubQuery("TgeneCatalogDetail","description","unidadmedida","i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode= new SubQuery("TarmRegistroArmas","personcode","personcode","i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + SubQuery subqueryTipo= new SubQuery("TgeneCatalogDetail","description","tipo","i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipo); + SubQuery subqueryTipoArmaExplosivo= new SubQuery("TgeneCatalogDetail","description","tipoarmaexplosivo","i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + SubQuery subqueryClasecatalogo= new SubQuery("TgeneCatalogDetail","description","clase","i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClasecatalogo); + + return dto; + } + + @SuppressWarnings("unchecked") + protected void querydatabaseSimple() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql=" t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void remove() throws Exception { + if(record.getPk()==null){ + super.remove(); + } + else{ + ldeleteItems.add(this.record); + super.remove(); + } + } + + @Override + public void save() { + try { + if(registro.getTiporegistro().equals("IMP") && registro.isnew){ + TarmCarga aucpUsadoPrevio = CargaController.findByAUCP(registro.getSolicitudnum()); + if(aucpUsadoPrevio!=null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_aucp_previamente_cargado")); + return; + } + } + if(this.getLrecord().isEmpty()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_carga_armas_inexistentes")); + return; + } + this.registroArmas.update(); + Request request = callerhelper.getRequest(); + this.registro.setPersoncode(usuario.getPk().getPersoncode()); + this.registro.setFechasolicitud(new java.sql.Date((new Date()).getTime())); + this.registro.setTiporegistrocodigo("TIPOREGISTRO"); +// this.registro.setPaisorigen("EC"); + this.registro.setFcreacion(new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + request.getModifiedData().put("LISTAARMAS", this.lrecord); + request.getModifiedData().put("LISTAARMASELIMINADAS", this.ldeleteItems); + request.getModifiedData().put("TIPOREGISTRO", this.registro.getTiporegistro()); + request.getModifiedData().put("REGISTRO", this.registro); + request.getModifiedData().put("PERSONCODE", usuario.getPk().getPersoncode()); + request.getModifiedData().put("ESNUEVAIMPORTACION", esNuevaImportacion); + carga.setCategoria(this.categoria); + request.getModifiedData().put("TARMCARGA",carga); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + isSave=Boolean.TRUE; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void saveArmaSolicitud() { + try { + + if(!isArmaDuplicada(record)){ + + record.getModifiedData().put("edit", "S"); + + this.registroArmas.update(); + update(); + if(!existeTipoArmaExplosivo){ + return; + } + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(Boolean.TRUE); // Para que el core devuelva el pk de los registros nuevos. + dtosave.setPosition(2); + HashMap msave = new HashMap(); + DtoSave dtoSaveRegistro = registroArmas.getDtoSave(); + dtoSaveRegistro.setIsForm(Boolean.TRUE); + dtoSaveRegistro.setReturnpk(Boolean.TRUE); + dtoSaveRegistro.setPosition(1); + + Request request = callerhelper.getRequest(); + request.setTransactionModule("30"); + request.setTransactionCode(15); + request.setTransactionVersion(1); + if(!verificaArmaExplosivo){ + request.put("eseliminacion", Constant.STR_Y); + }else{ + msave.put(registroArmas.getBeanalias(), dtoSaveRegistro); + } + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.put("TIPODOC", this.getMfilelds().get("tipodoc")); + request.put("NUMDOC", this.getMfilelds().get("numdoc")); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.registroArmas.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + }else{ + record= null; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_armaDuplicada")); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void update() throws Exception { +// TgeneCatalogDetail estado = CatalogDetailController.findxCodigoCodcatalogo(record.getEstado(), record.getEstadocodigo()); + TgeneCatalogDetail marca = CatalogDetailController.findxCodigoCodcatalogo(record.getMarca(), record.getMarcacodigo()); +// record.getModifiedData().put("estado", estado.getDescription()); + isEnableCategoria = Boolean.FALSE; + record.setPartidaarancelariacodigo("PARTIDAARANCELARIA"); + record.setTipofabricacion("TIPOFABRICACION2"); + record.setTipofabricacioncodigo("TIPOFABRICACION"); + record.getModifiedData().put("marca", marca.getDescription()); + for(TgeneCatalogDetail color:lcolor){ + if(record.getColor()!=null && record.getColor().equals(color.getPk().getCatalog())){ + record.getModifiedData().put("color", color.getDescription()); + break; + } + } + if(verificaArmaExplosivo){ + if(tipoArmaExplosivo == null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionClase")); + existeTipoArmaExplosivo = Boolean.FALSE; + return; + }else{ + this.record.setCtipoarmaexplosivo(tipoArmaExplosivo.getPk()); + record.getModifiedData().put("unidadMedidaCantidad", tipoArmaExplosivo.getUnidadmedidapeso()); + existeTipoArmaExplosivo = Boolean.TRUE; + } + } + super.update(); + } + + public Boolean existeDuplicidad(){ + if(this.lrecord.contains(record)){ + return Boolean.TRUE; + } + return Boolean.FALSE; + } + + + public void updateAutorizacion()throws Exception { + super.update(); + } + + /** + * Método que se ejecuta al carga edición + * @throws Exception + */ + public void loadEdit() throws Exception { + verificaArmaExplosivo = Boolean.TRUE; + if(record.getCountrycode() == null){ + record.setCountrycode("EC"); + } + if(record.getCtipoarmaexplosivo()==null){ + MessageHelper.setMessageError("NO ESTA ASOCIADO A UN TIPO DE ARMA EXPLOSIVO"); + return; + } + tipoArmaExplosivo= TiposArmasExplosivosController.findarma(record.getCtipoarmaexplosivo()); +// lprovincias = ProvinceController.find(record.getCountrycode()); +// executeProvince(); +// if(record.getProvincecode() != null){ +// lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); +// executeCanton(); +// } +// completaInfTipoArma(); + // Anade la descripcion del tipo de arma explosivo + if(tipoArmaExplosivo!=null){ + this.clase = tipoArmaExplosivo.getClase(); + this.longitud = tipoArmaExplosivo.getLongitud(); + this.tipoarma = tipoArmaExplosivo.getTipoarmaexplosivo(); + this.calibre = tipoArmaExplosivo.getCalibre(); + } + verificarClaseArma(); + } + + + @Override + public void create() throws Exception { + if(categoria!=null){ + super.create(); + this.record.setEstadocodigo("ESTADOARMA"); + this.record.setMarcacodigo("MARCA"); + this.record.setCantidad(null); + this.record.setPeso(null); + this.lprovincias = ProvinceController.find(record.getCountrycode()); + this.executeProvince(); + this.bloquearUnidadCantidad = Boolean.TRUE; + this.bloquearUnidadPeso = Boolean.TRUE; + RequestContext.getCurrentInstance().execute("PF('dialog').show()"); + }else{ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_categoriaRequerida")); + return; + } + } + + public void update(TarmArmas bean) throws Exception { + record=bean; + updateAutorizacion(); + } + + public void validacionDocumento(String numeroDocumento, String tipoDocumento){ + if(numeroDocumento==null || tipoDocumento==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselacedula")); + return; + } + TcustPersonDetail tcustPersonDetail=null; + if(tipoDocumento.equals(codigoCedula)){ +//----------validamos si es valida la CEDULA + if(!ValidateIdentification.cedula(numeroDocumento)){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en MAIA + tcustPersonDetail=buscarPersonaMaia(numeroDocumento,tipoDocumento); + }else if(tipoDocumento.equals(codigoRuc)){ +//----------validamos si es valida el RUC + if(!ValidateIdentification.ruc(numeroDocumento)){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en maia + tcustPersonDetail=buscarPersonaMaia(numeroDocumento,tipoDocumento); + }else{ +//----------si es PASAPORTE + tcustPersonDetail=buscarPersonaMaia(numeroDocumento,tipoDocumento); + } +// if(tcustPersonDetail==null){ +// nombreRazon=null; +//// numDoc=null; +// MessageHelper.setMessageError("La datos de la persona ingresada no existen, por favor crear primero la persona"); +// return; +// }else{ +// nombreRazon=tcustPersonDetail.getName(); +// } + } + + /** Método para validar si la persona existe en la BD de Maia + * @param numeroDocumento + * @param tipoDocumento + * @return TcustPersonDetail + */ + public TcustPersonDetail buscarPersonaMaia(String numeroDocumento, String tipoDocumento){ + return PersonDetailController.findxidentification(numeroDocumento,tipoDocumento); + } + /** + * Busca un arma por código y estado + * @param armaCode código del arma + * @param estado estado del arma + * @return + */ + public static TarmArmas find(String armaCode,String estado) { + try { + + if(armaCode==null){ + return null; + } + InventariosController cc = new InventariosController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + if(estado!=null){ + cc.addFilter("estado", estado); + cc.addFilter("estadocodigo", "ESTADOARMA"); + } + cc.querydatabaseArmas(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = new TarmTipoArmaExplosivo(); + tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if(tarmTipoArmaExplosivo!=null && tarmTipoArmaExplosivo.getCalibrecodigo()!=null) + cc.record.modifiedData().put("calibre",tarmTipoArmaExplosivo==null?"":Utilidades.formatearDecimalesEnTexto((CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription()), "#.000")); + cc.record.modifiedData().put("tipo",tarmTipoArmaExplosivo==null?"":CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription()); + cc.record.modifiedData().put("clase",tarmTipoArmaExplosivo==null?"":CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription()); + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + cc.record.modifiedData().put("pais", cc.record.getCpaisorigen()==null?"":CountryController.findcountry(cc.record.getCpaisorigen()).getDescription()); + + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * + * @param codigopersona + * @return + */ + public static TarmArmas findBySerieMarca(String serie, String marca) { + try { + InventariosController cc = new InventariosController(); + cc.init(); + cc.recperpage = 5000; + if(serie!=null && !serie.isEmpty()){ + cc.addFilter("lote", serie); + } + cc.addFilter("marca", marca); + cc.querydatabaseSimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findByPK(String cArma) { + try { + + InventariosController cc = new InventariosController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", cArma); + cc.querydatabaseSinFiltros(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + cc.record=cc.lrecord.get(0); + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if(tarmTipoArmaExplosivo!=null){ + if(tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null){ + cc.record.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getTipoarmaexplosivo() != null && tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo() != null){ + cc.record.modifiedData().put("tipo",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo())!=null? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(),tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getClase() != null && tarmTipoArmaExplosivo.getClasecodigo() != null){ + cc.record.modifiedData().put("clase",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription():""); + } + + TarmRegistroArmas registroArmas = new TarmRegistroArmas(); + TcustPersonDetail detallePersona = new TcustPersonDetail(); + if(cc.record.getCregistro()!=null ){ + registroArmas = RegistroArmController.findByCodigo(String.valueOf(cc.record.getCregistro())); + if(registroArmas!=null){ + detallePersona= PersonDetailController.find(String.valueOf(registroArmas.getPersoncode())); + } + } + cc.record.modifiedData().put("razonsPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getName()); + cc.record.modifiedData().put("documentoPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getIdentification()); + + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findPorCodigo(String armaCode) { + try { + + InventariosController cc = new InventariosController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + //cc.addFilter("REG", "ESTADOARMA"); + cc.querydatabaseArmas(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if(tarmTipoArmaExplosivo!=null){ + if(tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null){ + cc.record.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getTipoarmaexplosivo() != null && tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo() != null){ + cc.record.modifiedData().put("tipo",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo())!=null? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(),tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getClase() != null && tarmTipoArmaExplosivo.getClasecodigo() != null){ + cc.record.modifiedData().put("clase",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription():""); + } + + TarmRegistroArmas registroArmas = new TarmRegistroArmas(); + TcustPersonDetail detallePersona = new TcustPersonDetail(); + if(cc.record.getCregistro()!=null ){ + registroArmas = RegistroArmController.findByCodigo(String.valueOf(cc.record.getCregistro())); + if(registroArmas!=null){ + detallePersona= PersonDetailController.find(String.valueOf(registroArmas.getPersoncode())); + } + } + cc.record.modifiedData().put("razonsPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getName()); + cc.record.modifiedData().put("documentoPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getIdentification()); + cc.record.modifiedData().put("marca",(cc.record ==null || cc.record.getMarca()==null || cc.record.getMarca().isEmpty() || cc.record.getMarcacodigo()==null || cc.record.getMarcacodigo().isEmpty())?"":CatalogDetailController.findxCodigoCodcatalogo(cc.record.getMarca(), cc.record.getMarcacodigo()).getDescription()); + + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findXCodigo(String armaCode) { + try { + + InventariosController cc = new InventariosController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + //cc.addFilter("REG", "ESTADOARMA"); + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + lcities = CityController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + } + } + + + /** + * + * + * @param personCode + * @param estados estados del arma separados por coma + * @return Una lista de Armas encontradas + */ + public List findxPersona(Long personCode, String estados, String clase, String fechaCaducidad) { + List armasLista = null; + try { + armasLista = new ArrayList(); + InventariosController armas = new InventariosController(); + armas.init(); + armas.recperpage = 4000; + armas.addField("personcode", personCode); + if(this.getMfilelds().get("sancion") != null){ + armas.addField("sancion", this.getMfilelds().get("sancion")); + } + if(this.getMfilelds().get("TRAMITE") != null){ + armas.addField("TRAMITE", this.getMfilelds().get("TRAMITE")); + } + if(estados == null){ + armas.addFilter("estado", "REG"); + } else{ + armas.addField("ESTADOS", estados); + } + if(clase != null && clase .trim().length()>0){ + armas.addField("CLASEARMAS", clase); + } +// if(fechaCaducidad != null && fechaCaducidad .trim().length()>0){ +// armas.addField("FECHACADUCIDADARM", fechaCaducidad); +// } + armas.query(); + if(armas.getLrecord() != null && !armas.getLrecord().isEmpty()){ + armasLista.addAll(armas.getLrecord()); + } + + return armasLista; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return armasLista; + } + } + + + /** + * Lista de Armas por Registro + **/ + public static List findxRegistro(String registrocode) { + try { + InventariosController cc = new InventariosController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("cregistro", registrocode); + + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + for(TarmArmas item : cc.lrecord){ + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(item.getCtipoarmaexplosivo()); + item.modifiedData().put("calibre",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription()); + item.modifiedData().put("tipo",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription()); + item.modifiedData().put("clase",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription()); + item.modifiedData().put("longitud",CatalogDetailController.findxCodigoCodcatalogo( tarmTipoArmaExplosivo.getLongitud(), tarmTipoArmaExplosivo.getLongitudcodigo()).getDescription()); + } + + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Abre el LOV de la clase del arma + */ + public void openLovClase() { + Map> params = new HashMap>(); + ClaseLovController.openLov(params); + } + + /** + * Regresa del LOV de armas + * @param event + */ + public void onReturnClase(SelectEvent event) { + TgeneCatalogDetail clase = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("clase", clase.getDescription()); + this.clase = clase.getPk().getCatalog(); + this.verificarClaseArma(); + } + + /** + * Abre el LOV de la clase del arma + */ + public void openArmaExplosivoLov() { + + this.record.getModifiedData().put("longitud", null); + this.record.getModifiedData().put("tipoarmaexplosivo", null); + this.record.getModifiedData().put("calibre", null); + // descripcionUnidadpeso=null; + Map> params = new HashMap<>(); + List lcategoriaParam = new ArrayList<>(); + lcategoriaParam.add(categoria); + params.put("categoria", lcategoriaParam); + ArmaExplosivoLovController.openLov(params); + + } + + /** + * Abre el LOV de busqueda de importaciones por codigo solicitud (AUCP) + */ + public void openCargaPrevia() { + Map> params = new HashMap<>(); + List lPersoncodeParam = new ArrayList<>(); + lPersoncodeParam.add(usuario.getPk().getPersoncode().toString()); + params.put("personcode", lPersoncodeParam); + CargasLovController.openLov(params); + } + + /** + * Regresa del LOV de armas + * @param event + */ + public void onReturnArmaExplosivo(SelectEvent event) { + tipoArmaExplosivo = (TarmTipoArmaExplosivo) event.getObject(); + //Setear descripciones a presentarse + this.record.getModifiedData().put("clase", tipoArmaExplosivo.getModifiedData().get("nclase")); + this.record.getModifiedData().put("tipoarmaexplosivo", tipoArmaExplosivo.getModifiedData().get("ntipo")); + this.record.getModifiedData().put("longitud", tipoArmaExplosivo.getModifiedData().get("nlongitud")); + this.record.getModifiedData().put("calibre", tipoArmaExplosivo.getModifiedData().get("ncalibre")); + // Setear valores en las variables correspondientes + if(tipoArmaExplosivo!=null){ + this.clase = tipoArmaExplosivo.getClase(); + this.longitud = tipoArmaExplosivo.getLongitud(); + this.tipoarma = tipoArmaExplosivo.getTipoarmaexplosivo(); + this.calibre = tipoArmaExplosivo.getCalibre(); + this.record.setUnidadmedidacantidad(tipoArmaExplosivo.getUnidadmedidapeso()); + } + this.verificarClaseArma(); + // valida cantidad para registro de produccion + cantidadTxt.setValue(null); + if(registro.getTiporegistro().equals("PRO")){ + if((this.clase.equals("0010000001") || this.clase.equals("0010000004") || this.clase.equals("0010000008")) && this.bloquearUnidadPeso){ + cantidadTxt.setValue("1"); + cantidadTxt.setDisabled(true); + } + } + } + + /** + * Regresa del LOV de carga + * @param event + */ + public void onReturnCarga(SelectEvent event) { + System.out.println("Retorno del lov carga"); + isSelectAucpPrevio = Boolean.TRUE; + carga = (TarmCarga) event.getObject(); + this.categoria = carga.getCategoria(); + this.isEnableCategoria = Boolean.FALSE; + carga.setIsnew(Boolean.FALSE); + registro = RegistroArmController.findByCodigo(carga.getCregistro().toString()); + registro.setIsnew(Boolean.FALSE); + TgeneCountry paisOrigen = CountryController.findcountry(registro.getPaisorigen()); + registro.getModifiedData().put("paisorigen", paisOrigen!=null?paisOrigen.getDescription():""); + // Provincia + TgeneProvince provinciaTmp = ProvinceController.findPorCodigo("EC", carga.getProvincecode()).get(0); + if(provinciaTmp!=null){ + carga.getModifiedData().put("provinceCode",provinciaTmp.getDescription()); + } + // Canton + TgeneCanton cantonTmp = CantonController.findPorCodigo("EC", carga.getProvincecode(), carga.getCantoncode()).get(0); + if(cantonTmp!=null){ + carga.getModifiedData().put("cantonCode",cantonTmp.getDescription()); + } + // Ciudad + TgeneCity ciudadTmp = CityController.findPorCodigo("EC", carga.getProvincecode(), carga.getCantoncode(), carga.getCitycode()).get(0); + if(ciudadTmp!=null){ + carga.getModifiedData().put("cityCode",ciudadTmp.getDescription()); + } + + lrecord = ArmasController.findxRegistro(registro.getPk().toString()); + if(lrecord==null){ + this.lrecord = new ArrayList(); + } + + } + + /** + * Método en el cual se determina si se bloquea unidad o cantidad al momento de cargar los datos del arma + * @param clase + */ + private void verificarClaseArma(){ + if(tipoArmaExplosivo!=null){ + TgeneCatalogDetail unidadesCatalog = CatalogDetailController.findCatalogo(tipoArmaExplosivo.getUnidadmedidapesocodigo(),tipoArmaExplosivo.getUnidadmedidapeso()); + if(unidadesCatalog!=null && unidadesCatalog.getLegalcode().equals("CANTIDAD")){ + this.record.getModifiedData().put("unidadMedidaCantidad", tipoArmaExplosivo.getUnidadmedidapeso()); + this.record.getModifiedData().put("unidadMedidaPeso", null); + this.bloquearUnidadCantidad = Boolean.FALSE; + this.bloquearUnidadPeso = Boolean.TRUE; + this.record.setPeso(null); + }else if(unidadesCatalog!=null && unidadesCatalog.getLegalcode().equals("PESO")){ + this.record.getModifiedData().put("unidadMedidaCantidad", null); + this.record.getModifiedData().put("unidadMedidaPeso", tipoArmaExplosivo.getUnidadmedidapeso()); + this.bloquearUnidadCantidad = Boolean.TRUE; + this.bloquearUnidadPeso = Boolean.FALSE; + this.record.setCantidad(null); + }else{ + this.record.getModifiedData().put("unidadMedidaCantidad", null); + this.record.getModifiedData().put("unidadMedidaPeso", null); + this.bloquearUnidadCantidad = Boolean.TRUE; + this.bloquearUnidadPeso = Boolean.TRUE; + } + } + } + + /** + * Abre el LOV de la longitud del arma + */ + public void openLovLongitud() { + Map> params = new HashMap>(); + LongitudLovController.openLov(params); + } + + /** + * Regresa del LOV de longitud + * @param event + */ + public void onReturnLongitud(SelectEvent event) { + TgeneCatalogDetail longitud = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("longitud", longitud.getDescription()); + this.longitud = longitud.getPk().getCatalog(); + } + + /** + * Abre el LOV del tipo de arma + */ + public void openLovTipoArma() { + Map> params = new HashMap>(); + TipoArmaExpLovController.openLov(params); + } + + /** + * Regresa del LOV de tipo de arma + * @param event + */ + public void onReturnTipoArma(SelectEvent event) { + TgeneCatalogDetail tipoArma = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("tipoarmaexplosivo", tipoArma.getDescription()); + this.tipoarma = tipoArma.getPk().getCatalog(); + } + + /** + * Abre el LOV de Calibre + */ + public void openLovCalibre() { + Map> params = new HashMap>(); + CalibreLovController.openLov(params); + } + + /** + * Regresa del LOV del calibre + * @param event + */ + public void onReturnCalibre(SelectEvent event) { + TgeneCatalogDetail calibre = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("calibre", calibre.getDescription()); + this.calibre = calibre.getPk().getCatalog(); + } + + /** + * Abre el LOV cambio de usuario + */ + public void openLovCambioUsuario() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Acción de retorno de la selección del usuario + * @param event de retorno de la selección + */ + public void onReturnCambioUsuario(SelectEvent event) { + nuevoPropietarioArma = (TcustPersonDetail) event.getObject(); + } + + /** + * Abre el dialog del cambio de persona + */ + public void abrirDialogCambio() { + this.nuevoPropietarioArma = null; + } + + /** + * Se cambia el propietario del arma + */ + public void cambiarArmaUsuario() { + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.setTransactionModule("30"); + request.setTransactionCode(151); + request.setTransactionVersion(1); + request.put("ARMAACTUAL", this.record); + request.put("NUEVAPERSONA", this.nuevoPropietarioArma); + Response response = callerHelper.executeSave(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + MessageHelper.setMessageInfo(response); + this.querydatabase(); + } else{ + MessageHelper.setMessageError(response); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Carga las listas de cantones y limpia la lista de ciudades + */ + public void seleccionarProvincia(){ + try { +// codigoProvincia=this.record.getProvincecode(); + lcantones = CantonController.find("EC", carga.getProvincecode()); + lciudades = new ArrayList<>(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + /** + * Carga las listas de ciudades + */ + public void seleccionarCanton(){ + try { +// codigoCanton = this.record.getCantoncode(); + lciudades = CityController.find("EC", carga.getProvincecode(), carga.getCantoncode()); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if(Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")){ + valorColocar = Boolean.TRUE; + } + for (TarmArmas guardias : lrecord) { + guardias.getModifiedData().put("seleccionado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Metodo para obtener el listado de las armas por la serie/lote + * @param serieLote + * @return + */ + public static List findxSerieLote(String serieLote) { + try { + InventariosController cc = new InventariosController(); + cc.init(); + cc.recperpage = 1000; + cc.addFilter("lote", serieLote); + cc.querydatabaseFechaMax(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para obtener los codigos + */ + private static String codigos(String parametro){ + TgeneParameters tgeneParameters= ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + @SuppressWarnings("unchecked") + protected void querydatabaseFechaMax() { + try { + DtoQuery dto = this.getDtoQuery(); + dto.setOrderby("pk"); + String codigoEstadoIncautada=codigos("CODIGO.INCAUTADA"); + String codigoEstadoDecomisada=codigos("CODIGO.DECOMISADA"); + String codigoEstadoVendida=codigos("CODIGO.VENDIDA"); + String codigoEstadoMatPrima=codigos("CODIGO.MATERIAPRIMA"); + Filter filtro = new Filter(); + String sql="t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro)"//and t.cregistro=ta.cregistro para el manejo de los explosivos + + " and t.estado !='DEST' and t.estado !='CDP' and t.estado !='"+codigoEstadoIncautada+"' and t.estado !='"+codigoEstadoDecomisada+"' and t.estado !='"+codigoEstadoVendida+"' and t.estado !='"+codigoEstadoMatPrima+"' "; + filtro.setSql(sql); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void actualizar(TarmArmas arma) throws Exception{ + record=arma; + super.update(); + } + + /*Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findxCodigo(String armaCode) { + try { + + InventariosController cc = new InventariosController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + cc.querydatabaseArmas(); + cc.getRecord().getModifiedData().put("lmarca", cc.getLmarca()); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public TiposArmasExplosivosController getTiposArmasExplosivosController() { + return tiposArmasExplosivosController; + } + + + public void setTiposArmasExplosivosController( + TiposArmasExplosivosController tiposArmasExplosivosController) { + this.tiposArmasExplosivosController = tiposArmasExplosivosController; + } + + + public RegistroArmController getRegistroArmas() { + return registroArmas; + } + + + public void setRegistroArmas(RegistroArmController registroArmas) { + this.registroArmas = registroArmas; + } + + +// public List getLtipoidentificacion() { +// return ltipoidentificacion; +// } +// +// +// public void setLtipoidentificacion(List ltipoidentificacion) { +// this.ltipoidentificacion = ltipoidentificacion; +// } +// +// +// public String getTipoDoc() { +// return tipoDoc; +// } +// +// +// public void setTipoDoc(String tipoDoc) { +// this.tipoDoc = tipoDoc; +// } + + +// public String getNumDoc() { +// return numDoc; +// } +// +// +// public void setNumDoc(String numDoc) { +// this.numDoc = numDoc; +// } + + +// public String getNombreRazon() { +// return nombreRazon; +// } +// +// +// public void setNombreRazon(String nombreRazon) { +// this.nombreRazon = nombreRazon; +// } + + + public List getLestadoarma() { + return lestadoarma; + } + + + public void setLestadoarma(List lestadoarma) { + this.lestadoarma = lestadoarma; + } + + + public List getLmarca() { + return lmarca; + } + + + public void setLmarca(List lmarca) { + this.lmarca = lmarca; + } + + + public List getLcolor() { + return lcolor; + } + + + public void setLcolor(List lcolor) { + this.lcolor = lcolor; + } + + + public List getLtipofabricacion() { + return ltipofabricacion; + } + + + public void setLtipofabricacion(List ltipofabricacion) { + this.ltipofabricacion = ltipofabricacion; + } + + +// public List getLcountry() { +// return lcountry; +// } +// +// +// public void setLcountry(List lcountry) { +// this.lcountry = lcountry; +// } + + + public List getLunidadmedidacantidad() { + return lunidadmedidacantidad; + } + + + public void setLunidadmedidacantidad( + List lunidadmedidacantidad) { + this.lunidadmedidacantidad = lunidadmedidacantidad; + } + + + public String getLongitud() { + return longitud; + } + + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + + public String getCalibre() { + return calibre; + } + + + public void setCalibre(String calibre) { + this.calibre = calibre; + } + + + public String getClase() { + return clase; + } + + + public void setClase(String clase) { + this.clase = clase; + } + + + public String getTipoarma() { + return tipoarma; + } + + + public void setTipoarma(String tipoarma) { + this.tipoarma = tipoarma; + } + + + public String getUnidadmedidapeso() { + return unidadmedidapeso; + } + + + public void setUnidadmedidapeso(String unidadmedidapeso) { + this.unidadmedidapeso = unidadmedidapeso; + } + + + public List getLunidadmedidapeso() { + return lunidadmedidapeso; + } + + + public void setLunidadmedidapeso(List lunidadmedidapeso) { + this.lunidadmedidapeso = lunidadmedidapeso; + } + + + public List getLprovincias() { + return lprovincias; + } + + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + + public List getLcantones() { + return lcantones; + } + + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + + public List getLparroquias() { + return lparroquias; + } + + + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + + public List getLcities() { + return lcities; + } + + + public void setLcities(List lcities) { + this.lcities = lcities; + } + + + public boolean isExisteTipoArmaExplosivo() { + return existeTipoArmaExplosivo; + } + + + public void setExisteTipoArmaExplosivo(boolean existeTipoArmaExplosivo) { + this.existeTipoArmaExplosivo = existeTipoArmaExplosivo; + } + + + public boolean isVerificaArmaExplosivo() { + return verificaArmaExplosivo; + } + + + public void setVerificaArmaExplosivo(boolean verificaArmaExplosivo) { + this.verificaArmaExplosivo = verificaArmaExplosivo; + } + + public boolean isBloquearUnidadCantidad() { + return bloquearUnidadCantidad; + } + + public void setBloquearUnidadCantidad(boolean bloquearUnidadCantidad) { + this.bloquearUnidadCantidad = bloquearUnidadCantidad; + } + + public boolean isBloquearUnidadPeso() { + return bloquearUnidadPeso; + } + + public void setBloquearUnidadPeso(boolean bloquearUnidadPeso) { + this.bloquearUnidadPeso = bloquearUnidadPeso; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public TarmTipoArmaExplosivo getTipoArmaExplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoArmaExplosivo(TarmTipoArmaExplosivo tipoArmaExplosivo) { + this.tipoArmaExplosivo = tipoArmaExplosivo; + } + protected void querydatabaseArmas() { + try { + DtoQuery dto = this.getDtoQuery(); + + dto.setOrderby("pk"); + if(this.getMfilelds().get("ESTADOS") != null){ + Filter filtroEstados = new Filter(); + String[] estados = this.getMfilelds().get("ESTADOS").toString().split(","); + StringBuffer sqlEstados = new StringBuffer(" t.estado IN ("); + for (int i = 0; i < estados.length; i++) { + sqlEstados.append("'").append(estados[i]).append("'"); + if(i < estados.length - 1){ + sqlEstados.append(","); + } + } + sqlEstados.append(")"); + filtroEstados.setSql(sqlEstados.toString()); + dto.addFiltro(filtroEstados); + }else{ + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql=" t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + } + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public TcustPersonDetail getNuevoPropietarioArma() { + return nuevoPropietarioArma; + } + + public void setNuevoPropietarioArma(TcustPersonDetail nuevoPropietarioArma) { + this.nuevoPropietarioArma = nuevoPropietarioArma; + } + + /** + * Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findXCodigoArma(String armaCode) { + try { + InventariosController cc = new InventariosController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("codigoarma", armaCode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + @SuppressWarnings("unchecked") + public void querydatabasesimple() { + try { + DtoQuery dto = this.getDtoQuery(); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + @SuppressWarnings("unchecked") + public void querydatabaseArmaDuplicada(TarmArmas armaObj) { + try { + DtoQuery dto = this.getDtoQuery(); + + Filter filtro = new Filter(); + filtro.setSql("t.marca='"+armaObj.getMarca()+"' and t.marcacodigo='"+armaObj.getMarcacodigo()+"' and upper(t.lote)='"+ armaObj.getLote().toUpperCase()+"'"); + dto.addFiltro(filtro); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static TarmArmas findSimple(String carma) { + try { + InventariosController cc = new InventariosController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", carma); + cc.querydatabasesimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static Boolean isArmaDuplicada(TarmArmas armaObj) { + Boolean isDuplicada = Boolean.FALSE; + InventariosController cc; + try { + cc = new InventariosController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabaseArmaDuplicada(armaObj); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + for(TarmArmas armaTmp:cc.lrecord){ + TarmTipoArmaExplosivo tipoArmaExpTmp = TiposArmasExplosivosController.findarma(armaTmp.getCtipoarmaexplosivo()); + TgeneCatalogDetail claseTmp = CatalogDetailController.findCatalogo(tipoArmaExpTmp.getClasecodigo(), tipoArmaExpTmp.getClase()); + TgeneCatalogDetail tipoArmaTmp = CatalogDetailController.findCatalogo(tipoArmaExpTmp.getTipoarmaexplosivocodigo(), tipoArmaExpTmp.getTipoarmaexplosivo()); + TgeneCatalogDetail calibreTmp = CatalogDetailController.findCatalogo(tipoArmaExpTmp.getCalibrecodigo(), tipoArmaExpTmp.getCalibre()); + // Valido la clase, tipoarma y calibre solo para armas de fuego y armas no letales + if(claseTmp.getPk().getCatalog().equals("0010000001") || claseTmp.getPk().getCatalog().equals("0010000008")){ + if(armaObj.getModifiedData().get("clase")!=null && armaObj.getModifiedData().get("tipoarmaexplosivo")!=null){ + if(armaObj.getModifiedData().get("clase").toString().equalsIgnoreCase(claseTmp!=null?claseTmp.getDescription():"")&& + armaObj.getModifiedData().get("tipoarmaexplosivo").toString().equalsIgnoreCase(tipoArmaTmp!=null?tipoArmaTmp.getDescription():"")){ + if(armaObj.getModifiedData().get("calibre")!=null && calibreTmp!=null && armaObj.getModifiedData().get("calibre").toString().equalsIgnoreCase(calibreTmp.getDescription())){ + isDuplicada = Boolean.TRUE; + break; + } + } + }else{ + MessageHelper.setMessageError("CLASE Y/O TIPO DE ARMA EXPLOSIVO INCORRECTOS"); + } + } + } + + } + return isDuplicada; + } catch (Exception e) { + // TODO Auto-generated catch block + MessageHelper.setMessageError(e); + return null; + } + } + + + public static TarmArmas find(String carma) { + try { + + InventariosController cc = new InventariosController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", carma); + cc.querydatabasesimple(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if(tarmTipoArmaExplosivo!=null){ + if(tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null){ + cc.record.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getTipoarmaexplosivo() != null && tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo() != null){ + cc.record.modifiedData().put("tipo",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo())!=null? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(),tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription():""); + } + if(tarmTipoArmaExplosivo.getClase() != null && tarmTipoArmaExplosivo.getClasecodigo() != null){ + cc.record.modifiedData().put("clase",CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription():""); + } + TarmRegistroArmas registroArmas = new TarmRegistroArmas(); + TcustPersonDetail detallePersona = new TcustPersonDetail(); + if(cc.record.getCregistro()!=null ){ + registroArmas = RegistroArmController.findByCodigo(String.valueOf(cc.record.getCregistro())); + if(registroArmas!=null){ + detallePersona= PersonDetailController.find(String.valueOf(registroArmas.getPersoncode())); + } + } + cc.record.modifiedData().put("razonsPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getName()); + cc.record.modifiedData().put("documentoPropietario",registroArmas ==null || detallePersona==null?"":detallePersona.getIdentification()); + cc.record.modifiedData().put("marca",(cc.record ==null || cc.record.getMarca()==null || cc.record.getMarca().isEmpty() || cc.record.getMarcacodigo()==null || cc.record.getMarcacodigo().isEmpty())?"":CatalogDetailController.findxCodigoCodcatalogo(cc.record.getMarca(), cc.record.getMarcacodigo()).getDescription()); + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public TgeneCatalogDetail getTipoDocumento() { + return tipoDocumento; + } + + public void setTipoDocumento(TgeneCatalogDetail tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } + + public TcustPersonDetail getDetallesPersona() { + return detallesPersona; + } + + public void setDetallesPersona(TcustPersonDetail detallesPersona) { + this.detallesPersona = detallesPersona; + } + + public List getTiposRegistro() { + return tiposRegistro; + } + + public void setTiposRegistro(List tiposRegistro) { + this.tiposRegistro = tiposRegistro; + } + + public TcustPersonDetail getUsuario() { + return usuario; + } + + public void setUsuario(TcustPersonDetail usuario) { + this.usuario = usuario; + } + + public List getLdocumentospersona() { + return ldocumentospersona; + } + + public void setLdocumentospersona( + List ldocumentospersona) { + this.ldocumentospersona = ldocumentospersona; + } + +// public TarmRegistroArmas getRegistro() { +// return registro; +// } +// +// public void setRegistro(TarmRegistroArmas registro) { +// this.registro = registro; +// } + + public List getLpaises() { + return lpaises; + } + + public void setLpaises(List lpaises) { + this.lpaises = lpaises; + } + + public List getLciudades() { + return lciudades; + } + + public void setLciudades(List lciudades) { + this.lciudades = lciudades; + } + + public List getLaeropuertos() { + return laeropuertos; + } + + public void setLaeropuertos(List laeropuertos) { + this.laeropuertos = laeropuertos; + } + + public String getCodigoProvincia() { + return codigoProvincia; + } + + public void setCodigoProvincia(String codigoProvincia) { + this.codigoProvincia = codigoProvincia; + } + + public String getCodigoCanton() { + return codigoCanton; + } + + public void setCodigoCanton(String codigoCanton) { + this.codigoCanton = codigoCanton; + } + + public TarmRegistroArmas getRegistro() { + return registro; + } + + public void setRegistro(TarmRegistroArmas registro) { + this.registro = registro; + } + + public String getCategoria() { + return categoria; + } + + public void setCategoria(String categoria) { + this.categoria = categoria; + } + + public Boolean getEstadoDesaduanizado() { + return estadoDesaduanizado; + } + + public void setEstadoDesaduanizado(Boolean estadoDesaduanizado) { + this.estadoDesaduanizado = estadoDesaduanizado; + } + + public Boolean getEsNuevaImportacion() { + return esNuevaImportacion; + } + + public void setEsNuevaImportacion(Boolean esNuevaImportacion) { + this.esNuevaImportacion = esNuevaImportacion; + } + + public String getFilterAUCP() { + return filterAUCP; + } + + public void setFilterAUCP(String filterAUCP) { + this.filterAUCP = filterAUCP; + } + + public TarmCarga getCarga() { + return carga; + } + + public void setCarga(TarmCarga carga) { + this.carga = carga; + } + + public Boolean getIsSelectAucpPrevio() { + return isSelectAucpPrevio; + } + + public void setIsSelectAucpPrevio(Boolean isSelectAucpPrevio) { + this.isSelectAucpPrevio = isSelectAucpPrevio; + } + + public Boolean getIsSave() { + return isSave; + } + + public void setIsSave(Boolean isSave) { + this.isSave = isSave; + } + + public InputNumber getCantidadTxt() { + return cantidadTxt; + } + + public void setCantidadTxt(InputNumber cantidadTxt) { + this.cantidadTxt = cantidadTxt; + } + + public List getLpartidaArancelaria() { + return lpartidaArancelaria; + } + + public void setLpartidaArancelaria(List lpartidaArancelaria) { + this.lpartidaArancelaria = lpartidaArancelaria; + } + + public Boolean getIsEnableCategoria() { + return isEnableCategoria; + } + + public void setIsEnableCategoria(Boolean isEnableCategoria) { + this.isEnableCategoria = isEnableCategoria; + } + + + +} + + diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/MantenimientoDocumentosAlfrescoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/MantenimientoDocumentosAlfrescoController.java.svn-base new file mode 100644 index 0000000..72479a8 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/MantenimientoDocumentosAlfrescoController.java.svn-base @@ -0,0 +1,287 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.menu.MenuController; +import com.fp.frontend.controller.security.ProfileController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmDocumentoAlfresco; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeProfile; + +/** + * Controlador principal del mantenimiento de documentos alfresco + * @author Manuel Cepeda + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class MantenimientoDocumentosAlfrescoController extends AbstractController { + + @ManagedProperty(value = "#{menuController}") + private MenuController menuController; + + /** + * Lista de perfiles asociados al usuario que hace login a la aplicacion. + */ + private List lprofile; + + /** + * Listado de estados del arma + */ + private List ltipodocumento; + + /** + * Listado de estados del arma + */ + private List ldocumento; + + private String[] selectedDocumentos; + + + + public MantenimientoDocumentosAlfrescoController() throws Exception { + super(TarmDocumentoAlfresco.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + setLprofile(ProfileController.find()); + querydatabase(); + } + + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + record = new TarmDocumentoAlfresco(); + beanalias = "DOCUMENTOALFRESCO"; + ltipodocumento = CatalogDetailController.find("TIPODOCUMENTO"); + ldocumento = CatalogDetailController.find("DOCUMENTO"); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("pk"); + + // subqueries 1 + SubQuery subqueryPerfil = new SubQuery("TsafeProfile", "description", "perfilDescription", "i.pk = t.perfil"); + dto.addSubQuery(subqueryPerfil); + + SubQuery subqueryTipoDocumento = new SubQuery("TgeneCatalogDetail","description","tipoDocumento","i.pk.catalog=t.catalogo and i.pk.catalogcode=t.catalogoCode"); + dto.addSubQuery(subqueryTipoDocumento); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "DOCUMENTOALFRESCOCOMPLETE"); + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /*/ + * Permite obtener elementos de la entidad TarmDocumentoAlfresco dado el perfil + */ + public static List findByProfile(String perfil) { + try { + MantenimientoDocumentosAlfrescoController cc = new MantenimientoDocumentosAlfrescoController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("perfil", perfil); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + @Override + public void next() throws Exception { + // TODO Auto-generated method stub + super.next(); + } + + @Override + public void save() { + try { + List listaNueva = new ArrayList<>(); + for(TarmDocumentoAlfresco tarmDocumentoAlfresco : lrecord){ + for(TarmDocumentoAlfresco documentoAlfresco : listaNueva){ + if(tarmDocumentoAlfresco.getModifiedData().get("perfilDescription").equals(documentoAlfresco.getModifiedData().get("perfilDescription")) + && tarmDocumentoAlfresco.getModifiedData().get("tipoDocumento").equals(documentoAlfresco.getModifiedData().get("tipoDocumento"))){ + MessageHelper.setMessageError(" Ya se encuentra creada una combinacin: " + tarmDocumentoAlfresco.getModifiedData().get("perfilDescription") + " - " + tarmDocumentoAlfresco.getModifiedData().get("tipoDocumento")); + return; + } + } + listaNueva.add(tarmDocumentoAlfresco); + } + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void update() throws Exception { + record.setCatalogoCode("TIPODOCUMENTO"); + record.setDocumento(""); + if(menuController.findPerfil(record.getPerfil()) != null){ + record.getModifiedData().put("perfilDescription", menuController.findPerfil(record.getPerfil()).getDescription()); + } + if(CatalogDetailController.findxCodigoCodcatalogo(record.getCatalogo(), record.getCatalogoCode()) != null){ + record.getModifiedData().put("tipoDocumento", CatalogDetailController.findxCodigoCodcatalogo(record.getCatalogo(), record.getCatalogoCode()).getDescription()); + } + for(String documento : selectedDocumentos){ + if(record.getDocumento() == null || "".equals(record.getDocumento())){ + record.setDocumento(documento); + }else{ + record.setDocumento(record.getDocumento() + ", " + documento); + } + + } + super.update(); + } + + public void updateAutorizacion()throws Exception { + super.update(); + } + + /** + * Método que se ejecuta al carga edición + * @throws Exception + */ + public void loadEdit() throws Exception { + setSelectedDocumentos(record.getDocumento().split(", ")); + } + + + @Override + public void create() throws Exception { + setSelectedDocumentos(null); + super.create(); + } + + public void update(TarmDocumentoAlfresco bean) throws Exception { + record=bean; + updateAutorizacion(); + } + + public void actualizar(TarmDocumentoAlfresco arma) throws Exception{ + record=arma; + super.update(); + } + + public List getLprofile() { + return lprofile; + } + + public void setLprofile(List lprofile) { + this.lprofile = lprofile; + } + + public MenuController getMenuController() { + return menuController; + } + + public void setMenuController(MenuController menuController) { + this.menuController = menuController; + } + + public List getLtipodocumento() { + return ltipodocumento; + } + + public void setLtipodocumento(List ltipodocumento) { + this.ltipodocumento = ltipodocumento; + } + + public List getLdocumento() { + return ldocumento; + } + + public void setLdocumento(List ldocumento) { + this.ldocumento = ldocumento; + } + + /** + * @return the selectedDocumentos + */ + public String[] getSelectedDocumentos() { + return selectedDocumentos; + } + + /** + * @param selectedDocumentos the selectedDocumentos to set + */ + public void setSelectedDocumentos(String[] selectedDocumentos) { + this.selectedDocumentos = selectedDocumentos; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ModificarPlanificacionInspeccionController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ModificarPlanificacionInspeccionController.java.svn-base new file mode 100644 index 0000000..ed8e529 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ModificarPlanificacionInspeccionController.java.svn-base @@ -0,0 +1,513 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.ins.TarmPlanificacionInspeccion; +import com.fp.persistence.parmas.ins.TarmPlanificacionTramite; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ModificarPlanificacionInspeccionController extends AbstractController { + + private TarmCentroControl centroControl; + + private String nombreCentroControl; + + private TarmCentroControlJur jurisdiccionCentroControl; + + private Boolean planificacionSalvada = false; + + // Codigo de planificacion (Variable de flujo) + private Long cplanificacion; + + private List listaMeses = new ArrayList(); + + private List listaAnnos = new ArrayList(); + + List planificaciones; + + @ManagedProperty(value = "#{planificacionTramiteController}") + private PlanificacionTramiteController planificacionTramiteController; + + @ManagedProperty(value = "#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitanteController; + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddressController; + /** + * Atibuto para la habilitacion del boton de completar la tarea del flujo + */ + private Boolean btnFlujo; + + public ModificarPlanificacionInspeccionController() throws Exception { + super(TarmPlanificacionInspeccion.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + try { + this.startQuery(); + this.init(); + super.query(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public void startQuery(){ + try { + this.pasteBpmScreenParameters(); + if(super.getMfilters().get("cplanificacion")!=null){ + cplanificacion=Long.parseLong(super.getMfilters().get("cplanificacion").toString()); + } + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + record = new TarmPlanificacionInspeccion(); + beanalias = "MODIFICARPLANIFICACIONCONTROLLER"; + btnFlujo=Boolean.FALSE; + this.planificacionTramiteController = new PlanificacionTramiteController(); + this.planificacionTramiteController.setLrecord(new ArrayList()); + + //Quemando el codigo de planificacion + //this.cplanificacion=99L; + + //Obteniendo la planificacion + if(this.cplanificacion!=null){ + this.record=PlanificacionInspeccionController.findPorCodigo(this.cplanificacion); + + if(this.record!=null){ + // Obteniendo el centro de control + this.centroControl = CentroControlArmasController.findPorCodigo(this.record.getCcentrocontrol()); + this.nombreCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), + centroControl.getNombreinstitucioncodigo()).getDescription(); + + //Obteniendo los tramites + this.planificacionTramiteController.setCplanificacion(this.record.getPk()); + this.planificacionTramiteController.setRecperpage(4000); + this.planificacionTramiteController.querydatabaseAprobacion(); + Collections.sort(planificacionTramiteController.getLrecord(), new Comparator() { + public int compare(TarmPlanificacionTramite p1, TarmPlanificacionTramite p2) { + return new Long(p1.getMesnumero()).compareTo(p2.getMesnumero()); + } + }); + } + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void query() throws Exception { + // TODO Auto-generated method stub + MessageHelper.setMessageError("msg_notQuery"); + super.query(); + } + + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("anno desc"); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + // record=lrecord.get(0); + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + + request.getModifiedData().put("INSPECCIONES", this.planificacionTramiteController.getLrecord()); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.planificacionTramiteController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + this.planificacionSalvada = true; + btnFlujo=Boolean.TRUE; + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Metodo que carga los meses disponibles atendiendo a la fecha de expiracion del documento + * + * @param tramite + */ + public void cargarMeses(TarmPlanificacionTramite inspeccion) { + this.listaMeses.clear(); + Calendar calendario = Calendar.getInstance(); + Integer intmesnumero = calendario.get(Calendar.MONTH); + this.planificacionTramiteController.getRecord().setMesnumero(Long.parseLong(intmesnumero.toString())); + switch (calendario.get(Calendar.MONTH)) { + case 0: + listaMeses.add("Enero"); + listaMeses.add("Febrero"); + listaMeses.add("Marzo"); + listaMeses.add("Abril"); + listaMeses.add("Mayo"); + listaMeses.add("Junio"); + listaMeses.add("Julio"); + listaMeses.add("Agosto"); + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + break; + case 1: + listaMeses.add("Febrero"); + listaMeses.add("Marzo"); + listaMeses.add("Abril"); + listaMeses.add("Mayo"); + listaMeses.add("Junio"); + listaMeses.add("Julio"); + listaMeses.add("Agosto"); + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + break; + case 2: + listaMeses.add("Marzo"); + listaMeses.add("Abril"); + listaMeses.add("Mayo"); + listaMeses.add("Junio"); + listaMeses.add("Julio"); + listaMeses.add("Agosto"); + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + break; + case 3: + listaMeses.add("Abril"); + listaMeses.add("Mayo"); + listaMeses.add("Junio"); + listaMeses.add("Julio"); + listaMeses.add("Agosto"); + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + break; + case 4: + listaMeses.add("Mayo"); + listaMeses.add("Junio"); + listaMeses.add("Julio"); + listaMeses.add("Agosto"); + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + break; + case 5: + listaMeses.add("Junio"); + listaMeses.add("Julio"); + listaMeses.add("Agosto"); + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + break; + case 6: + listaMeses.add("Julio"); + listaMeses.add("Agosto"); + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + break; + case 7: + listaMeses.add("Agosto"); + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + break; + case 8: + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + break; + case 9: + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + break; + case 10: + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + break; + case 11: + inspeccion.setMes("Diciembre"); + break; + } + } + + /** + * Metodo que ordena las inspecciones por mes y por nombre Ordenamiento simple de burbujas + */ + public void ordenarPorMesNombre() { + try { + // Ordenando por mes + for (int i = 0; i < this.planificacionTramiteController.getLrecord().size() - 1; i++) { + for (int j = i + 1; j < this.planificacionTramiteController.getLrecord().size(); j++) { + // Verificando que la ispeccion en j tenga un mes anterior + // a la inspeccion en i + if (this.planificacionTramiteController.getLrecord().get(j).getMesnumero() < this.planificacionTramiteController.getLrecord() + .get(i).getMesnumero()) { + TarmPlanificacionTramite temp = this.planificacionTramiteController.getLrecord().get(j); + this.planificacionTramiteController.getLrecord().set(j, this.planificacionTramiteController.getLrecord().get(i)); + this.planificacionTramiteController.getLrecord().set(i, temp); + } + } + } + + // Ordenando por Nombre + for (int i = 0; i < this.planificacionTramiteController.getLrecord().size() - 1; i++) { + for (int j = i + 1; j < this.planificacionTramiteController.getLrecord().size(); j++) { + + // Obteniendo el documento en i + TarmDocumentoHabilitante documentoi = DocumentoHabilitanteController.findPorCodigo(this.planificacionTramiteController + .getLrecord().get(i).getCdocumento().toString()); + + // Obteniendo el documento en j + TarmDocumentoHabilitante documentoj = DocumentoHabilitanteController.findPorCodigo(this.planificacionTramiteController + .getLrecord().get(j).getCdocumento().toString()); + + // Obteniendo la persona en i + TcustPersonDetail personai = PersonDetailController.find(documentoi.getPersoncode().toString()); + + // Obteniendo la persona en j + TcustPersonDetail personaj = PersonDetailController.find(documentoj.getPersoncode().toString()); + + // Verificando que la ispeccion en j tenga un nombre menor + // a la inspeccion en i si la inspeccion es del mismo mes + if (this.planificacionTramiteController.getLrecord().get(i).getMesnumero() == this.planificacionTramiteController.getLrecord() + .get(j).getMesnumero() + && personaj.getName().toLowerCase().compareToIgnoreCase(personai.getName().toLowerCase()) < 0) { + TarmPlanificacionTramite temp = this.planificacionTramiteController.getLrecord().get(j); + this.planificacionTramiteController.getLrecord().set(j, this.planificacionTramiteController.getLrecord().get(i)); + this.planificacionTramiteController.getLrecord().set(i, temp); + } + } + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + if(!btnFlujo){ + MessageHelper.setMessageInfo("GUARDE LOS CAMBIOS"); + } + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("cplanificacion", this.cplanificacion); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + btnFlujo=false; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public PlanificacionTramiteController getPlanificacionTramiteController() { + return planificacionTramiteController; + } + + public void setPlanificacionTramiteController(PlanificacionTramiteController planificacionTramiteController) { + this.planificacionTramiteController = planificacionTramiteController; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getNombreCentroControl() { + return nombreCentroControl; + } + + public void setNombreCentroControl(String nombreCentroControl) { + this.nombreCentroControl = nombreCentroControl; + } + + public DocumentoHabilitanteController getDocumentoHabilitanteController() { + return documentoHabilitanteController; + } + + public void setDocumentoHabilitanteController(DocumentoHabilitanteController documentoHabilitanteController) { + this.documentoHabilitanteController = documentoHabilitanteController; + } + + public Boolean getPlanificacionSalvada() { + return planificacionSalvada; + } + + public void setPlanificacionSalvada(Boolean planificacionSalvada) { + this.planificacionSalvada = planificacionSalvada; + } + + public List getListaMeses() { + return listaMeses; + } + + public void setListaMeses(List listaMeses) { + this.listaMeses = listaMeses; + } + + public List getListaAnnos() { + return listaAnnos; + } + + public void setListaAnnos(List listaAnnos) { + this.listaAnnos = listaAnnos; + } + + public TarmCentroControlJur getJurisdiccionCentroControl() { + return jurisdiccionCentroControl; + } + + public void setJurisdiccionCentroControl(TarmCentroControlJur jurisdiccionCentroControl) { + this.jurisdiccionCentroControl = jurisdiccionCentroControl; + } + + public List getPlanificaciones() { + return planificaciones; + } + + public void setPlanificaciones(List planificaciones) { + this.planificaciones = planificaciones; + } + + public PersonAddressController getPersonAddressController() { + return personAddressController; + } + + public void setPersonAddressController(PersonAddressController personAddressController) { + this.personAddressController = personAddressController; + } + + public Long getCplanificacion() { + return cplanificacion; + } + + public void setCplanificacion(Long cplanificacion) { + this.cplanificacion = cplanificacion; + } + + public Boolean getBtnFlujo() { + return btnFlujo; + } + + public void setBtnFlujo(Boolean btnFlujo) { + this.btnFlujo = btnFlujo; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/NotificarEmisionDocumentoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/NotificarEmisionDocumentoController.java.svn-base new file mode 100644 index 0000000..bf01c18 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/NotificarEmisionDocumentoController.java.svn-base @@ -0,0 +1,588 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.date.TgeneNotAccountingDayController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.param.TarmTramitesAtendidos; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class NotificarEmisionDocumentoController extends AbstractController { + + private TgeneCatalogDetail detallecatalogo = new TgeneCatalogDetail(); + private TgeneCatalogDetail detallecatalogoTipoTramite = new TgeneCatalogDetail(); + private TgeneCatalogDetail usoActividad = new TgeneCatalogDetail(); + private TgeneCatalogDetail identificacion = new TgeneCatalogDetail(); + private TgeneCatalogDetail estadotramite = new TgeneCatalogDetail(); + private TarmSolicitudTramite solicitudTramite=new TarmSolicitudTramite(); + private TarmCentroControl centroControl = new TarmCentroControl(); + private TarmTramite tramite=new TarmTramite(); + private TarmSolicitud solicitud = new TarmSolicitud(); + private String codigoSolicitud = ""; + private boolean habilitarGrabar = false; + private boolean habilitarEnviar = false; + private boolean habilitarGeneraFecha; + + Date fechaNotificacion = null; + + @ManagedProperty(value="#{solicitudTramiteController}") + private SolicitudTramiteController solicitudTramiteController; + + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{armasController}") + private ArmasController armas; + + + public NotificarEmisionDocumentoController() throws Exception { + super(TarmTramitesAtendidos.class); + } + + + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "NOTIFICAREMISIONDOCUMENTO"; + this.record=new TarmTramitesAtendidos(); + record.isnew=true; + habilitarGeneraFecha=false; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } } + + + @PostConstruct + private void postconstruct() { + startQuery(); + this.init(); + cargarDatos(); + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + //xpathflujo=super.getMfilters().get("xpath");//"cm:Decomiso/cm:A-2014/cm:M-10/cm:ENV-000000319/cm:ENV-000000319.pdf";// + codigoSolicitud=super.getMfilters().get("csolicitud"); + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + + @Override + public void save() { + try { + if(fechaNotificacion==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_camponotificacion")); + return; + } + + record.setCcentrocontrol(centroControl.getPk()); + record.setCtramite(tramite.getPk()); + + java.sql.Date sFechaActual=new java.sql.Date(Calendar.getInstance().getTimeInMillis()); + + Calendar cal = Calendar.getInstance(); + cal.setTime(fechaNotificacion); + java.sql.Date sFechaNotificacion=new java.sql.Date(cal.getTimeInMillis()); + + record.setFechaatencion(sFechaNotificacion); + record.setFecharegistro(sFechaActual); + + this.update(); + + aprobarTramite(); + + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + dtosave.setPosition(1); + msave.put(beanalias, dtosave); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + + habilitarEnviar = true; + habilitarGrabar = false; + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute( + "Maia.refreshusertasks()"); + habilitarGeneraFecha = true; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + // validamos si cargamos los datos cuando apruebe + Map datosmail = new HashMap(); + + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail persona = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + SimpleDateFormat sdf1 = new SimpleDateFormat(MsgGeneral.getProperty("dateformat")); + datosmail.put("funcionario",persona ==null?"":((persona.getMilitarygrade()==null)?"":CatalogDetailController.findxCodigoCodcatalogo(persona.getMilitarygrade(),"MILITARYGRADE").getDescription()) + " " + persona.getName()); + datosmail.put("razons",(solicitud==null || solicitud.getModifiedData().get("nombre")==null)?"":solicitud.getModifiedData().get("nombre")); + datosmail.put("tramite",solicitudTramite.getNumerotramite()); + datosmail.put("centrocontrol",(centroControl==null || centroControl.getNombreinstitucion()==null || centroControl.getNombreinstitucioncodigo()==null)?"":CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + datosmail.put("fechanotificacion",sdf1.format(fechaNotificacion)); + + TarmTramite tramite =TarmTramiteController.find(String.valueOf(solicitud.getCtramite())); + datosmail.put("tipoTramite",(tramite==null || tramite.getModifiedData().get("tipotramite")==null)?"":tramite.getModifiedData().get("tipotramite")); + datosmail.put("tipoAutorizacion",(tramite==null || tramite.getModifiedData().get("tipoautorizacion")==null)?"":tramite.getModifiedData().get("tipoautorizacion")); + datosmail.put("usoactividad",(tramite==null || tramite.getModifiedData().get("usoactividad")==null)?"":tramite.getModifiedData().get("usoactividad")); + datosmail.put("categoria",(tramite==null || tramite.getModifiedData().get("categoria")==null)?"":tramite.getModifiedData().get("categoria")); + + request.modifiedData().put("TID", tid); + request.modifiedData().put("datosmail", datosmail); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + ponerEstadoRegistradoArmas(); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void ponerEstadoRegistradoArmas() { + try { + Boolean grabarCambioEstado = Boolean.FALSE; + List armasSolicitudLst = TarmSolicitudArmasController.findPorCSolicitud(codigoSolicitud); + for(TarmSolicitudArmas armaSolicitud:armasSolicitudLst){ + TarmArmas armaObj = ArmasController.findSimple(armaSolicitud.getPk().getCarma()); + if(armaObj.getEstado().equals("PREG")){ + armaObj.setIsnew(false); + armaObj.setEstado("APTA"); + armas.update(armaObj); + grabarCambioEstado = Boolean.TRUE; + // Cambia el estado del arma en caso de existir un estado posterior en el historial + TarmArmas armaUltimoEstadoObj = ArmasController.findXCodigoArma(armaObj.getCodigoarma()); + if(armaUltimoEstadoObj!=null){ + armaUltimoEstadoObj.setIsnew(false); + armaUltimoEstadoObj.setEstado("APTA"); + armas.update(armaUltimoEstadoObj); + } + } + } + if(grabarCambioEstado){ + armas.save(); + } + + DtoSave dtoArmas = armas.getDtoSave(); + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + msave.put(armas.getBeanalias(), dtoArmas); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + armas.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + + try { + if(fechaNotificacion==null){ + return; + } + + DtoQuery dto = super.getDtoQuery(true); + Filter filtro = new Filter(); + Calendar cal = Calendar.getInstance(); + cal.setTime(fechaNotificacion); + java.sql.Date sFechaNotificacion=new java.sql.Date(cal.getTimeInMillis()); + + dto.addFiltro(new Filter("fechaatencion", ">=", sFechaNotificacion.toString())); + dto.addFiltro(filtro); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + /** + * Metodo para cargar los datos iniciales + */ + private void cargarDatos(){ + try { + solicitud = SolicitudArmasController.find(codigoSolicitud); + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(codigoSolicitud); + if(solicitudTramite!=null && solicitudTramite.getPk().getCtramite()!=null){ + tramite=TarmTramiteController.find(solicitudTramite.getPk().getCtramite().toString()); + estadotramite = (solicitudTramite.getEstadotramite()==null || solicitudTramite.getEstadotramitecodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(solicitudTramite.getEstadotramite(), solicitudTramite.getEstadotramitecodigo()); + } + + if(tramite!=null){ + detallecatalogo = (tramite.getCategoria()==null || tramite.getCategoriacodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + detallecatalogoTipoTramite = (tramite.getTipoautorizacion()==null || tramite.getTipoautorizacioncodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + usoActividad = (tramite.getUsoactividad()==null || tramite.getUsoactividadcodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + } + + if(this.getLoginController()!=null && 108 == this.getLoginController().getRequest().getTransactionCode() && "30".equals(getLoginController().getRequest().getTransactionModule())){ + TarmDocumentoHabilitante documentohabilitante =DocumentoHabilitanteController.findPorSolicitud(codigoSolicitud); + fechaNotificacion = documentohabilitante.getFechaemision(); + } + obtenerCentroControl(); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private void obtenerCentroControl() throws Exception { +// TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); +// PersonAddressController personAddressController = new PersonAddressController(); +// TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); +// TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + //institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Metodo para filtrar por centro de control + * @param ccentroControl + * @return + */ + public List findPorCentroControlFechaAtencion(String ccentroControl) { + try { + this.init(); + this.recperpage = 15; + this.addFilter("ccentrocontrol", ccentroControl); + this.querydatabase(); + if ((this.lrecord != null) && !this.lrecord.isEmpty()) { + return this.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + @Override + public void query() throws Exception { + MessageHelper.setMessageError("msg_notQuery"); + super.query(); + } + @Override + public void next() throws Exception { + // TODO Auto-generated method stub + super.next(); + } + + /** + * Metodo raiz para generar la fecha de notificacion a partir de la fecha actual + */ + public void generarFecha(){ + Calendar calendario = Calendar.getInstance(); + calendario.setTime(new Date()); + calendario.add(Calendar.DAY_OF_YEAR,0);//adiciona los dias a partir de los cuales debe empezar la notificacion + generarFecha(calendario.getTime()); + } + + + /** + * Metodo recursivo para generar una fecha de Notificacion, siempre y cuando la fecha se encuentre disponible + * para ese centro de control + * @param fecha + */ + public void generarFecha(Date fecha){ + fechaNotificacion =TgeneNotAccountingDayController.isfechalaboral(fecha); + List listaCentroControl= CentroControlArmasController.find(solicitud.getCcentrocontrol()); + int tramitesPorDia = 0; + + if(listaCentroControl!=null && !listaCentroControl.isEmpty()){ + centroControl = listaCentroControl.get(0); + if(listaCentroControl.get(0).getTramitespordia()!=null){ + tramitesPorDia = centroControl.getTramitespordia().intValue(); + } + } + Calendar fNotificacion = Calendar.getInstance(); + fNotificacion.setTime(fechaNotificacion); + + Calendar fActualUnDia = Calendar.getInstance(); + fActualUnDia.setTime(new Date()); + fActualUnDia.add(Calendar.DAY_OF_YEAR,1); + long fechaDiferencia = (fActualUnDia.getTimeInMillis() - fNotificacion.getTimeInMillis())/(24 * 60 * 60 * 1000); + + List listaTramitesAtendidos = findPorCentroControlFechaAtencion(solicitud.getCcentrocontrol()); + + if( fechaDiferencia == 1L || fechaDiferencia == 0 || (listaTramitesAtendidos!=null && !listaTramitesAtendidos.isEmpty() && tramitesPorDia >0 && listaTramitesAtendidos.size()>=tramitesPorDia)){ + Calendar calendario = Calendar.getInstance(); + calendario.setTime(fechaNotificacion); + calendario.add(Calendar.DAY_OF_YEAR,1); + generarFecha(calendario.getTime()); + } + + habilitarGrabar=true; + + + } + + /** + * Metodo para anular el tramite + * @throws Exception + */ + private void aprobarTramite() throws Exception { + solicitudTramite=solicitudTramiteController.findByCSolicitud(codigoSolicitud); + solicitudTramiteController.setRecord(solicitudTramite); + solicitudTramiteController.getRecord().setEstadotramite("APB"); + solicitudTramiteController.getRecord().setEstadotramitecodigo("ESTADOSOLICITUD"); + solicitudTramiteController.update(); + solicitudTramiteController.save(); + } + + public SolicitudTramiteController getSolicitudTramiteController() { + return solicitudTramiteController; + } + + public void setSolicitudTramiteController( + SolicitudTramiteController solicitudTramiteController) { + this.solicitudTramiteController = solicitudTramiteController; + } + + + + public TgeneCatalogDetail getDetallecatalogo() { + return detallecatalogo; + } + + + public void setDetallecatalogo(TgeneCatalogDetail detallecatalogo) { + this.detallecatalogo = detallecatalogo; + } + + + public TgeneCatalogDetail getDetallecatalogoTipoTramite() { + return detallecatalogoTipoTramite; + } + + + public void setDetallecatalogoTipoTramite( + TgeneCatalogDetail detallecatalogoTipoTramite) { + this.detallecatalogoTipoTramite = detallecatalogoTipoTramite; + } + + + public TgeneCatalogDetail getUsoActividad() { + return usoActividad; + } + + + public void setUsoActividad(TgeneCatalogDetail usoActividad) { + this.usoActividad = usoActividad; + } + + + public TgeneCatalogDetail getIdentificacion() { + return identificacion; + } + + + public void setIdentificacion(TgeneCatalogDetail identificacion) { + this.identificacion = identificacion; + } + + + public TgeneCatalogDetail getEstadotramite() { + return estadotramite; + } + + + public void setEstadotramite(TgeneCatalogDetail estadotramite) { + this.estadotramite = estadotramite; + } + + + public TarmSolicitudTramite getSolicitudTramite() { + return solicitudTramite; + } + + + public void setSolicitudTramite(TarmSolicitudTramite solicitudTramite) { + this.solicitudTramite = solicitudTramite; + } + + + public TarmTramite getTramite() { + return tramite; + } + + + public void setTramite(TarmTramite tramite) { + this.tramite = tramite; + } + + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + + public Date getFechaNotificacion() { + return fechaNotificacion; + } + + + public void setFechaNotificacion(Date fechaNotificacion) { + this.fechaNotificacion = fechaNotificacion; + } + + + public boolean isHabilitarGrabar() { + return habilitarGrabar; + } + + + public void setHabilitarGrabar(boolean habilitarGrabar) { + this.habilitarGrabar = habilitarGrabar; + } + + + public boolean isHabilitarEnviar() { + return habilitarEnviar; + } + + + public void setHabilitarEnviar(boolean habilitarEnviar) { + this.habilitarEnviar = habilitarEnviar; + } + + + public boolean isHabilitarGeneraFecha() { + return habilitarGeneraFecha; + } + + + public void setHabilitarGeneraFecha(boolean habilitarGeneraFecha) { + this.habilitarGeneraFecha = habilitarGeneraFecha; + } + + + public ArmasController getArmas() { + return armas; + } + + + public void setArmas(ArmasController armas) { + this.armas = armas; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/OrdenTrabajoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/OrdenTrabajoController.java.svn-base new file mode 100644 index 0000000..ea20720 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/OrdenTrabajoController.java.svn-base @@ -0,0 +1,387 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.RequisitoController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmSolicitudImportacion; +import com.fp.persistence.parmas.param.TarmRequisito; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmOrdenTrabajo; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class OrdenTrabajoController extends AbstractController { + + private Date fechaHoy; + private Date inicio; + private Date fin; + private java.sql.Date fechaInicio; + private java.sql.Date fechaFin; + + private TarmSolicitud solicitud=new TarmSolicitud(); + private TarmSolicitudTramite solicitudTramite=new TarmSolicitudTramite(); + private TarmTramite tramite=new TarmTramite(); + private String usoActividad; + private Long numeroOrden; + + private String documentoReferencia; + private String empresa; + private String lugarDireccion; + private String ruta; + private String tiempoEstimado; + private String observaciones; + + public OrdenTrabajoController() throws Exception { + super(TarmOrdenTrabajo.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "ORDENTRABAJOCONTROLLER"; + + fechaHoy=Calendar.getInstance().getTime(); + record=new TarmOrdenTrabajo(); + record.setIsnew(true); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + //Obteniendo la solicitud + solicitud= ValidacionTramiteLibreTransitoController.findPorSolicitudSimple("1"); + if(solicitud!=null && solicitud.getPk()!=null){ + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + + if(solicitudTramite!=null && solicitudTramite.getPk().getCtramite()!=null){ + tramite=TarmTramiteController.find(solicitudTramite.getPk().getCtramite().toString()); + + if(tramite!=null && tramite.getPk()!=null){ + //Uso actividad + TgeneCatalogDetail catalogDetailTramite=CatalogDetailController.findxCodigoCodcatalogo(solicitudTramite.getEstadotramite(), solicitudTramite.getEstadotramitecodigo()); + catalogDetailTramite=CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + if(catalogDetailTramite!=null && tramite.getUsoactividad()!=null && tramite.getUsoactividadcodigo()!=null){ + usoActividad=catalogDetailTramite.getDescription(); + } + + } + } + } + + //Obteniendo el numero de orden + List listaOrdenes=OrdenTrabajoController.findAll(); + if(listaOrdenes==null || listaOrdenes.isEmpty()){ + numeroOrden=1L; + }else{ + numeroOrden=listaOrdenes.get(listaOrdenes.size()-1).getPk()+1; + } + + + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaseAll() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + update(); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void update(TarmOrdenTrabajo bean) throws Exception { + record=bean; + update(); + } + + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Obtiene una orden de trabajo por su codigo + * @param cordentrabajo + * @return + */ + public static TarmOrdenTrabajo find(String cordentrabajo) { + try { + OrdenTrabajoController cc = new OrdenTrabajoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", cordentrabajo); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findAll() { + try { + OrdenTrabajoController cc = new OrdenTrabajoController(); + cc.init(); + //cc.recperpage = 300; + cc.querydatabaseAll(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public Date getFechaHoy() { + return fechaHoy; + } + + public void setFechaHoy(Date fechaHoy) { + this.fechaHoy = fechaHoy; + } + + public Date getInicio() { + return inicio; + } + + public void setInicio(Date inicio) { + this.inicio = inicio; + } + + public Date getFin() { + return fin; + } + + public void setFin(Date fin) { + this.fin = fin; + } + + public java.sql.Date getFechaInicio() { + return fechaInicio; + } + + public void setFechaInicio(java.sql.Date fechaInicio) { + this.fechaInicio = fechaInicio; + } + + public java.sql.Date getFechaFin() { + return fechaFin; + } + + public void setFechaFin(java.sql.Date fechaFin) { + this.fechaFin = fechaFin; + } + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + public TarmSolicitudTramite getSolicitudTramite() { + return solicitudTramite; + } + + public void setSolicitudTramite(TarmSolicitudTramite solicitudTramite) { + this.solicitudTramite = solicitudTramite; + } + + public TarmTramite getTramite() { + return tramite; + } + + public void setTramite(TarmTramite tramite) { + this.tramite = tramite; + } + + public String getUsoActividad() { + return usoActividad; + } + + public void setUsoActividad(String usoActividad) { + this.usoActividad = usoActividad; + } + + public Long getNumeroOrden() { + return numeroOrden; + } + + public void setNumeroOrden(Long numeroOrden) { + this.numeroOrden = numeroOrden; + } + + public String getDocumentoReferencia() { + return documentoReferencia; + } + + public void setDocumentoReferencia(String documentoReferencia) { + this.documentoReferencia = documentoReferencia; + } + + public String getEmpresa() { + return empresa; + } + + public void setEmpresa(String empresa) { + this.empresa = empresa; + } + + public String getLugarDireccion() { + return lugarDireccion; + } + + public void setLugarDireccion(String lugarDireccion) { + this.lugarDireccion = lugarDireccion; + } + + public String getRuta() { + return ruta; + } + + public void setRuta(String ruta) { + this.ruta = ruta; + } + + public String getTiempoEstimado() { + return tiempoEstimado; + } + + public void setTiempoEstimado(String tiempoEstimado) { + this.tiempoEstimado = tiempoEstimado; + } + + public String getObservaciones() { + return observaciones; + } + + public void setObservaciones(String observaciones) { + this.observaciones = observaciones; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/PermisosAutorizacionesAnularController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/PermisosAutorizacionesAnularController.java.svn-base new file mode 100644 index 0000000..eee6e9a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/PermisosAutorizacionesAnularController.java.svn-base @@ -0,0 +1,292 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.sql.Date; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.SelectEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; + +/** + * Controlador para listar los documentos habilitantes del sistema + * + */ + +@ManagedBean +@ViewScoped +public class PermisosAutorizacionesAnularController extends AbstractController { + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + private TcustPersonDetail tcustPersonDetail; + + + /** + * Variable que nos permite cargar el documento al Alfresco + */ + private UploadedFile uploadedFile; + + public PermisosAutorizacionesAnularController() throws Exception{ + super(TarmDocumentoHabilitante.class); + } + + @PostConstruct + public void postConstruct() { + this.init(); + super.startQuery(); + } + + private void init(){ + this.beanalias = "PERMISOSAUTORIZACIONES"; + this.recperpage = 15; + this.lrecord = new ArrayList<>(); + } + + @SuppressWarnings({ "unchecked", "deprecation" }) + @Override + protected void querydatabase() { + try { + if(!this.getMfilters().containsKey("personcode") || this.getMfilters().get("personcode")==null){ + MessageHelper.setMessageError("SELECCIONE UNA IDENTIFICACI\u00d3N"); + return; + } + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + HashMap mtables = new HashMap(); + //nombre + SubQuery snombre= new SubQuery + ("TcustPersonDetail", "name", "nombre", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + dto.addSubQuery(snombre); + SubQuery snumerodocumento= new SubQuery + ("TcustPersonDetail", "identification", "identification", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + dto.addSubQuery(snumerodocumento); + SubQuery subqueryCategoriaCodigo= new SubQuery("TgeneCatalogDetail", "description", "description", "i.pk.catalog = (select a.tipotramite from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.tipotramitecodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryCategoriaCodigo); + + SubQuery subqueryipoAutorizacion= new SubQuery("TgeneCatalogDetail", "description", "descriptionTipoAut", "i.pk.catalog = (select a.tipoautorizacion from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.tipoautorizacioncodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryipoAutorizacion); + + SubQuery subqueryTipocodigo=new SubQuery("TgeneCatalogDetail", "description", "descriptiontram", "i.pk.catalog = (select a.categoria from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.categoriacodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryTipocodigo); + SubQuery subqueryUsocodigo=new SubQuery("TgeneCatalogDetail", "description", "descriptionact", "i.pk.catalog = (select a.usoactividad from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.usoactividadcodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryUsocodigo); + SubQuery subqueryEstadoDoc=new SubQuery("TgeneCatalogDetail", "description", "estadodocumento", "i.pk.catalog = t.estado" + + " and i.pk.catalogcode= t.estadocode"); + dto.addSubQuery(subqueryEstadoDoc); + + dto.setOrderby("t.fechaemision desc"); + //filtro + Filter filtroFinal = new Filter(); + String sqlFinal= " t.fechaemision is not null "; + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + java.util.Date fecha2=new java.util.Date(); + fecha2.setHours(0); + fecha2.setMinutes(0); + fecha2.setSeconds(0); + for (TarmDocumentoHabilitante item : lrecord) { + item.getModifiedData().put("btnanular", Boolean.TRUE); + java.util.Date fecha1=new java.util.Date(item.getFechaexpiracion().getTime()) ; + fecha1.setHours(0); + fecha1.setMinutes(0); + fecha1.setSeconds(0); + if(fecha1.getTime() msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + querydatabase(); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static void openLov() { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), true); + // lovpersona es el nombre de la pagina + RequestContext.getCurrentInstance().openDialog("/pages/customer/lov/personLov.xhtml", options, null); + } + + + /** + * Maneja la respuesta del Lov de Personas + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + tcustPersonDetail = (TcustPersonDetail) event.getObject(); + this.getMfilters().put("personcode",tcustPersonDetail.getPk().getPersoncode().toString()); + this.query(); + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new java.util.Date()); + StringBuilder ruta = new StringBuilder("cm:Suspencion"); + ruta = ruta.append("/cm:Suspencion-"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + return ruta.toString(); + } + + /** + * Metodo que retorna la extencion del documento que se desea subir al alfresco + */ + public String getExtension(String filename) { + int index = filename.lastIndexOf('.'); + if (index == -1) { + return ""; + } else { + return filename.substring(index + 1); + } + } + /** + * Recorta el nombre del archivo a cargarse + * @param nombre + * @return nombre recortado + */ + public String recorteNombre(String nombre){ + String fielname=nombre; + if(fielname.length()>30){ + fielname=fielname.substring(0,30)+extencionArchivo(nombre); + } + return fielname; + } + /** + * Obtiene la extencion del archivo a cargar + * @param nombre + * @return + */ + private String extencionArchivo(String nombre){ + int pos=nombre.lastIndexOf('.'); + nombre=nombre.substring(pos); + return nombre; + } + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en el Alfresco + */ + public void handleUpload(FileUploadEvent event){ + uploadedFile = event.getFile(); + } + + public TcustPersonDetail getTcustPersonDetail() { + return tcustPersonDetail; + } + + public void setTcustPersonDetail(TcustPersonDetail tcustPersonDetail) { + this.tcustPersonDetail = tcustPersonDetail; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/PermisosAutorizacionesController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/PermisosAutorizacionesController.java.svn-base new file mode 100644 index 0000000..4ef282c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/PermisosAutorizacionesController.java.svn-base @@ -0,0 +1,154 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; + +/** + * Controlador para listar los documentos habilitantes del sistema + * + */ + +@ManagedBean +@ViewScoped +public class PermisosAutorizacionesController extends AbstractController { + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + private TcustPersonDetail tcustPersonDetail; + + public PermisosAutorizacionesController() throws Exception{ + super(TarmDocumentoHabilitante.class); + } + + @PostConstruct + public void postConstruct() { + this.init(); + super.startQuery(); + } + + private void init(){ + this.beanalias = "PERMISOSAUTORIZACIONES"; + this.recperpage = 15; + this.lrecord = new ArrayList<>(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if(!this.getMfilters().containsKey("personcode") || this.getMfilters().get("personcode")==null){ + MessageHelper.setMessageError("SELECCIONE UNA IDENTIFICACI\u00d3N"); + return; + } + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + HashMap mtables = new HashMap(); + SubQuery subqueryCategoriaCodigo= new SubQuery("TgeneCatalogDetail", "description", "description", "i.pk.catalog = (select a.tipotramite from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.tipotramitecodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryCategoriaCodigo); + + SubQuery subqueryipoAutorizacion= new SubQuery("TgeneCatalogDetail", "description", "descriptionTipoAut", "i.pk.catalog = (select a.tipoautorizacion from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.tipoautorizacioncodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryipoAutorizacion); + + SubQuery subqueryTipocodigo=new SubQuery("TgeneCatalogDetail", "description", "descriptiontram", "i.pk.catalog = (select a.categoria from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.categoriacodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryTipocodigo); + SubQuery subqueryUsocodigo=new SubQuery("TgeneCatalogDetail", "description", "descriptionact", "i.pk.catalog = (select a.usoactividad from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.usoactividadcodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryUsocodigo); + SubQuery subqueryEstadoDoc=new SubQuery("TgeneCatalogDetail", "description", "estadodocumento", "i.pk.catalog = t.estado" + + " and i.pk.catalogcode= t.estadocode"); + dto.addSubQuery(subqueryEstadoDoc); + + dto.setOrderby("t.fechaemision desc"); + + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + public void save() { + } + + public static void openLov() { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), true); + // lovpersona es el nombre de la pagina + RequestContext.getCurrentInstance().openDialog("/pages/customer/lov/personLov.xhtml", options, null); + } + + + /** + * Maneja la respuesta del Lov de Personas + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + tcustPersonDetail = (TcustPersonDetail) event.getObject(); + this.getMfilters().put("personcode",tcustPersonDetail.getPk().getPersoncode().toString()); + this.query(); + } + + + + + public TcustPersonDetail getTcustPersonDetail() { + return tcustPersonDetail; + } + + public void setTcustPersonDetail(TcustPersonDetail tcustPersonDetail) { + this.tcustPersonDetail = tcustPersonDetail; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/PlanificacionInspeccionController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/PlanificacionInspeccionController.java.svn-base new file mode 100644 index 0000000..68c9068 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/PlanificacionInspeccionController.java.svn-base @@ -0,0 +1,930 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.ins.TarmPlanificacionInspeccion; +import com.fp.persistence.parmas.ins.TarmPlanificacionTramite; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class PlanificacionInspeccionController extends AbstractController { + + private TarmCentroControl centroControl; + + TgeneCatalogDetail actividad = null; + private String meses; + private String Periodo; + private List tipoplanificacionList; + private String idPlanificacion; + + private List listaPeriodo = new ArrayList(); + private String nombreCentroControl; + + private Boolean planificacionSalvada = false; + + private Boolean planificacionGenerada = false; + + private Boolean habilitarGeneracion = false; + + private Boolean planificacionesPrevias = false; + + private TarmCentroControlJur jurisdiccionCentroControl; + + // Codigo de planificacion (Variable de flujo) + private Long cplanificacion; + + private Float presupuesto1; + + private List listaMeses = new ArrayList(); + + private List listaAnnos = new ArrayList(); + + List planificaciones; + + @ManagedProperty(value = "#{planificacionTramiteController}") + private PlanificacionTramiteController planificacionTramiteController; + + @ManagedProperty(value = "#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitanteController; + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddressController; + + private Boolean btnFlujo; + private String codigoPlanificacion; + /** + * codigo de la provincia del usuario logeado + */ + private String cprovincia; + public PlanificacionInspeccionController() throws Exception { + super(TarmPlanificacionInspeccion.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + record = new TarmPlanificacionInspeccion(); + beanalias = "PLANIFICACIONINSPECCIONCONTROLLER"; + btnFlujo=Boolean.FALSE; + // Obteniendo el centro de control + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController direccion = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = direccion.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + this.jurisdiccionCentroControl = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + this.centroControl = CentroControlArmasController.findPorCodigo(this.jurisdiccionCentroControl.getCcentrocontrol()); + this.nombreCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(),centroControl.getNombreinstitucioncodigo()).getDescription(); + //codigo de la provincia del centro de control logeado + cprovincia=centroControl.getProvincecode(); + + // cargar tipo de planificacion + tipoplanificacionList = CatalogDetailController.find("TIPOPLANIFICACION"); + // Fecha de generacion + Calendar calendar = Calendar.getInstance(); + this.record.setFechageneracion(new Date(calendar.getTimeInMillis())); + + // Generando los annos posibles + planificaciones = PlanificacionInspeccionController.findAllByCentroControl(this.centroControl.getPk()); + Integer canno = Calendar.getInstance().get(Calendar.YEAR); + if (planificaciones != null && !planificaciones.isEmpty()) { + this.planificacionesPrevias = true; + //this.record.setAnno(Long.parseLong(canno.toString())); + this.listaAnnos.add(Long.parseLong(canno.toString())); + + } else { + this.planificacionesPrevias = false; + this.listaAnnos.add(Long.parseLong(canno.toString())); + canno++; + this.listaAnnos.add(Long.parseLong(canno.toString())); + } + + this.planificacionTramiteController = new PlanificacionTramiteController(); + this.planificacionTramiteController.setLrecord(new ArrayList()); + + this.documentoHabilitanteController = new DocumentoHabilitanteController(); + this.documentoHabilitanteController.setLrecord(new ArrayList()); + + //validamos si viene del flujo + if(cplanificacion!=null){ + TarmPlanificacionInspeccion planificacion=PlanificacionInspeccionController.findPorCodigo(cplanificacion); + if(planificacion!=null){ + if("N".equals(planificacion.getAprobada())){ + //listamos la planificacion en estado Negado + this.planificacionTramiteController.setLrecord(new ArrayList()); + this.planificacionTramiteController.setLrecord(PlanificacionTramiteController.findPorCodigoPlanificacion(cplanificacion)); + Collections.sort(planificacionTramiteController.getLrecord(), new Comparator() { + public int compare(TarmPlanificacionTramite p1, TarmPlanificacionTramite p2) { + return new Integer(Integer.parseInt(p1.getModifiedData().get("ordena").toString())).compareTo(new Integer(p2.getModifiedData().get("ordena").toString())); + } + }); + } + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_existePlanificacionAnno")); + } + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void query() throws Exception { + // TODO Auto-generated method stub + MessageHelper.setMessageError("msg_notQuery"); + super.query(); + } + + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("anno desc"); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + // record=lrecord.get(0); + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + + if (this.planificacionGenerada) { + int i = 0; + float pre=0; + float tot = this.presupuesto1; + for (TarmPlanificacionTramite tramite : planificacionTramiteController.getLrecord()) { + i++; + if (tramite.getInspectores()==null || tramite.getPeriodo()==null || tramite.getVehiculos()==null || tramite.getPresupuesto()==null){ + MessageHelper.setMessageError("ERROR deben estar todos los campos llenos"); + return; + } + + + pre=pre+tramite.getPresupuesto(); + + + + } + + // MessageHelper.setMessageError(""+pre); + + + if (pre > tot){ + MessageHelper.setMessageError("ERROR Valor : "+tot+"es menor que : "+pre); + return; + } + //MessageHelper.setMessageError("ERROR "+i); + //break; + //Asignando el centro de control + this.record.setCcentrocontrol(this.centroControl.getPk()); + + // tipo de planificacion codigo + this.record.setIdPlanificacion(this.idPlanificacion); + + // tipo de planificacion catalogo + this.record.setPlanificacion("TIPOPLANIFICACION"); + + // presupuesto + + this.record.setPresupuesto(this.presupuesto1); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + + request.getModifiedData().put("PLANIFICACION", this.record); + codigoPlanificacion=this.record.getCodigo(); + request.getModifiedData().put("INSPECCIONES", this.planificacionTramiteController.getLrecord()); + + Response resp = callerhelper.executeSave(request); + + this.cplanificacion = (Long) resp.get("CPLANIFICACION"); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.planificacionTramiteController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + this.planificacionSalvada = true; + btnFlujo=Boolean.TRUE; + } else { + // MessageHelper.setMessageError(resp); + // this.planificacionSalvada=false; + } + } else { + // MessageHelper.setMessageError(new Exception(MsgControlArmas.getProperty("msg_planificacionNoGenerada"))); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Metodo que inicia el flujo + */ + @Override + public void iniciarFlujo() { + try { + if(cplanificacion==null || cplanificacion==0){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generarlaplanificacion")); + return; + } + Request request = this.callerhelper.getRequest(); + super.cleanRequest(request); + // Iniciando el flujo + request.modifiedData().put("cplanificacion", this.cplanificacion); + request.modifiedData().put("cprovincia", cprovincia); + request.modifiedData().put("isnew", "Y"); + request.setLogsolicitude(codigoPlanificacion);//codigo de la planificaion PAB-2014-01 + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.setShowRow(true); + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") +" "+ MsgControlArmas.getProperty("msg_noplanificacion")+ " : " +codigoPlanificacion); + cplanificacion=null; + btnFlujo=Boolean.FALSE; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que genera la planificacion + */ + public void generarPlanificacion() { + try { + + //Verificando que no existan planificaciones previas para + //el centro de control y el anno seleccionado + List planificaciones=PlanificacionInspeccionController.findAllByCentroControlAnno(this.centroControl.getPk() + ,this.record.getAnno().toString()); + if(!planificaciones.isEmpty()){ + MessageHelper.setMessageError(new Exception(MsgControlArmas.getProperty("msg_existePlanificacionAnno"))); + }else{ + this.planificacionGenerada = false; + this.planificacionTramiteController.getLrecord().clear(); + + // Cargando los documentos habilitantes + //this.documentoHabilitanteController.setFechaInicio(this.record.getFechainicio()); + //this.documentoHabilitanteController.setFechaFin(this.record.getFechafin()); + List lstDocumentohabilitantes= DocumentoHabilitanteController.findInspeccionesGenerar(this.record.getFechainicio(), this.record.getFechafin(), this.centroControl); + + if (lstDocumentohabilitantes != null && !lstDocumentohabilitantes.isEmpty()) { + int i=0; + for (TarmDocumentoHabilitante documento : lstDocumentohabilitantes) { + System.out.println("i.."+i); + i++; + // Persona + // TcustPersonDetail detallesPersona = PersonDetailController.find(documento.getPersoncode().toString()); + // Tramite + if(documento.getCtramite()!=null){ + //TarmTramite tramite = TarmTramiteController.find(documento.getCtramite().toString()); + + if(documento.getModifiedData().get("ctramite")!=null){ + + TarmPlanificacionTramite inspeccion = new TarmPlanificacionTramite(); + inspeccion.setCsolicitud(documento.getCsolicitud()); + + inspeccion.setCtramite(Long.parseLong(documento.getModifiedData().get("ctramite").toString())); + inspeccion.setCdocumento(documento.getPk()); + inspeccion.setIsnew(true); + + inspeccion.getModifiedData().put("nombre", documento.getModifiedData().get("nombre")); + inspeccion.getModifiedData().put("nodocumento", documento.getModifiedData().get("nodocumento")); + inspeccion.getModifiedData().put("tipotramite", documento.getModifiedData().get("tipotramite")); + inspeccion.getModifiedData().put("usoactividad", documento.getModifiedData().get("usoactividad")); + inspeccion.getModifiedData().put("categoria", documento.getModifiedData().get("categoria")); + inspeccion.getModifiedData().put("fechacaducidad", documento.getFechaexpiracion()); + + Calendar calendario = Calendar.getInstance(); + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + Integer dia = calendario.get(Calendar.DAY_OF_MONTH); + Integer mes = calendario.get(Calendar.MONTH); + Integer anno = calendario.get(Calendar.YEAR); + + // Fecha actual + java.util.Date fechaActual = sdf.parse(dia.toString() + "-" + mes.toString() + "-" + anno.toString()); + + // Fecha expiracion + calendario.setTime(documento.getFechaexpiracion()); + dia = calendario.get(Calendar.DAY_OF_MONTH); + mes = calendario.get(Calendar.MONTH); + anno = calendario.get(Calendar.YEAR); + java.util.Date fechaExpiracion = sdf.parse(dia.toString() + "-" + mes.toString() + "-" + anno.toString()); + + // Asignando el estado del tramite Caducada o Vigente + if (fechaExpiracion.compareTo(fechaActual) < 0) { + inspeccion.getModifiedData().put("estado", "Caducada"); + } else { + inspeccion.getModifiedData().put("estado", "Vigente"); + } + + // Calendar calendar = Calendar.getInstance(); + // this.record.setFechageneracion(new Date(calendar.getTimeInMillis())); + + // Asignando el mes + calendario.setTime(documento.getFechaexpiracion()); + Integer intmesnumero = calendario.get(Calendar.MONTH); + inspeccion.setMesnumero(Long.parseLong(intmesnumero.toString())); + switch (calendario.get(Calendar.MONTH)) { + case 0: + //inspeccion.setMes("Enero"); + inspeccion.getModifiedData().put("ordena",0); + break; + case 1: + //inspeccion.setMes("Febrero"); + inspeccion.getModifiedData().put("ordena",1); + break; + case 2: + //inspeccion.setMes("Marzo"); + inspeccion.getModifiedData().put("ordena",2); + break; + case 3: + //inspeccion.setMes("Abril"); + inspeccion.getModifiedData().put("ordena",3); + break; + case 4: + //inspeccion.setMes("Mayo"); + inspeccion.getModifiedData().put("ordena",4); + break; + case 5: + //inspeccion.setMes("Junio"); + inspeccion.getModifiedData().put("ordena",5); + break; + case 6: + //inspeccion.setMes("Julio"); + inspeccion.getModifiedData().put("ordena",6); + break; + case 7: + //inspeccion.setMes("Agosto"); + inspeccion.getModifiedData().put("ordena",7); + break; + case 8: + // inspeccion.setMes("Septiembre"); + inspeccion.getModifiedData().put("ordena",8); + break; + case 9: + // inspeccion.setMes("Octubre"); + inspeccion.getModifiedData().put("ordena",9); + break; + case 10: + // inspeccion.setMes("Noviembre"); + inspeccion.getModifiedData().put("ordena",10); + break; + case 11: + // inspeccion.setMes("Diciembre"); + inspeccion.getModifiedData().put("ordena",11); + break; + } + + + inspeccion.setMes(""); +// Inspectores + + inspeccion.getModifiedData().put("inspectores", "0"); + + // Vehiculos + + inspeccion.getModifiedData().put("vehiculos", "0"); + + // periodo + // inspeccion.setPeriodo("1er Trimestre"); + inspeccion.getModifiedData().put("periodo", ""); + + + // presupuesto + + inspeccion.getModifiedData().put("presupuesto", ""); + + // Asignando el record + this.planificacionTramiteController.create(); + this.planificacionTramiteController.setRecord(inspeccion); + this.planificacionTramiteController.update(); + } + } + } + + // Ordenando las inspecciones por Mes y por Nombre + //ordena la lista lvigenciaMeses TarmDocumentoHabilitante documento : lstDocumentohabilitantes + Collections.sort(planificacionTramiteController.getLrecord(), new Comparator() { + public int compare(TarmPlanificacionTramite p1, TarmPlanificacionTramite p2) { + return new Integer(Integer.parseInt(p1.getModifiedData().get("ordena").toString())).compareTo(new Integer(p2.getModifiedData().get("ordena").toString())); + } + }); + + if (!this.planificacionTramiteController.getLrecord().isEmpty()) { + this.planificacionGenerada = true; + } else { + this.planificacionGenerada = false; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_noExistenTramitesAnno") + " " + this.record.getAnno(), + new Object()); + } + } else { + this.planificacionGenerada = false; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_noExistenTramitesAnno") + " " + this.record.getAnno(), new Object()); + } + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que carga los meses disponibles atendiendo a la fecha de expiracion del documento + * + * @param tramite + */ + public void cargarMeses() { + + this.listaMeses.clear(); + + this.meses = this.planificacionTramiteController.getRecord().getPeriodo(); + + // this.planificacionTramiteController.getRecord().getPeriodo(); + + // MessageHelper.setMessageError(prueba.trim()); + + + + + + // 1er Cuatrimestre + if(this.meses!=null){ + + if (this.meses.equalsIgnoreCase("Mensual")){ + listaMeses.add("Enero"); + listaMeses.add("Febrero"); + listaMeses.add("Marzo"); + listaMeses.add("Abril"); + listaMeses.add("Mayo"); + listaMeses.add("Junio"); + listaMeses.add("Julio"); + listaMeses.add("Agosto"); + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + } + + if (this.meses.equalsIgnoreCase("1er Cuatrimestre")){ + listaMeses.add("Enero"); + listaMeses.add("Febrero"); + listaMeses.add("Marzo"); + listaMeses.add("Abril"); + } + if( this.meses.equalsIgnoreCase("2do Cuatrimestre")){ + + listaMeses.add("Mayo"); + listaMeses.add("Junio"); + listaMeses.add("Julio"); + listaMeses.add("Agosto"); + } if( this.meses.equalsIgnoreCase("3er Cuatrimestre")){ + + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + } + + if (this.meses.equalsIgnoreCase("1er Semestre")){ + listaMeses.add("Enero"); + listaMeses.add("Febrero"); + listaMeses.add("Marzo"); + listaMeses.add("Abril"); + listaMeses.add("Mayo"); + listaMeses.add("Junio"); + + } + + if (this.meses.equalsIgnoreCase("2do Semestre")){ + + listaMeses.add("Julio"); + listaMeses.add("Agosto"); + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + + } + }else + this.listaMeses.clear(); + + + + + + + // } + } + + public void cargarPeriodo(TarmPlanificacionTramite inspeccion) { + + + + this.listaMeses.clear(); + this.listaPeriodo.clear(); + + switch (this.idPlanificacion) { + case "1": + + listaPeriodo.add("Mensual"); + + + break; + case "2": + listaPeriodo.add("1er Cuatrimestre"); + listaPeriodo.add("2do Cuatrimestre"); + listaPeriodo.add("3er Cuatrimestre"); + + + break; + case "3": + listaPeriodo.add("1er Semestre"); + listaPeriodo.add("2do Semestre"); + + + break; + + } + cargarMeses(); + + } + + /** + * Metodo que genera el codigo de la planificacion teniendo en cuenta el anio introducido por el usuario + */ + public void generarCodigoPlanificacion() { + try { + // Descripcion + this.record.setDescripcion(MsgControlArmas.getProperty("lbl_planificacionAnual") + " " + this.record.getAnno().toString()); + + // Codigo + Integer numeroPlanificacion = 1; + String textoNoPlanificacion = ""; + List planificacionesTmp = PlanificacionInspeccionController.findPorAnno(this.record.getAnno()); + if (planificacionesTmp != null && !planificacionesTmp.isEmpty()) { + numeroPlanificacion = planificacionesTmp.size() + 1; + } + if (numeroPlanificacion < 10) { + textoNoPlanificacion = "0" + numeroPlanificacion.toString(); + } else { + textoNoPlanificacion = numeroPlanificacion.toString(); + } + this.record.setCodigo("PAP-" + this.record.getAnno().toString() + "-" + textoNoPlanificacion); + + // Fecha inicio + Calendar calendario = Calendar.getInstance(); + calendario.set(Calendar.YEAR, Integer.parseInt(this.record.getAnno().toString())); + calendario.set(Calendar.DAY_OF_MONTH, 1); + calendario.set(Calendar.MONTH, 0); + this.record.setFechainicio(new Date(calendario.getTimeInMillis())); + + calendario.set(Calendar.DAY_OF_MONTH, 31); + calendario.set(Calendar.MONTH, 11); + this.record.setFechafin(new Date(calendario.getTimeInMillis())); + + this.habilitarGeneracion = true; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Busca las planificaciones de un anio + * + * @param codigoSolicitud + * @return + */ + public static List findPorAnno(Long anno) { + try { + PlanificacionInspeccionController cc = new PlanificacionInspeccionController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("anno", anno.toString()); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca todas las planificaciones + * + * @param codigoSolicitud + * @return + */ + public static List findAllByCentroControl(String ccentrocontrol) { + try { + PlanificacionInspeccionController cc = new PlanificacionInspeccionController(); + // cc.init(); + cc.recperpage = 300; + cc.addFilter("ccentrocontrol", ccentrocontrol); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca todas las planificaciones + * + * @param codigoSolicitud + * @return + */ + public static List findAllByCentroControlAnno(String ccentrocontrol,String anno) { + try { + PlanificacionInspeccionController cc = new PlanificacionInspeccionController(); + // cc.init(); + cc.recperpage = 300; + cc.addFilter("ccentrocontrol", ccentrocontrol); + cc.addFilter("anno", anno); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca una planificacion por su codigo + * + * @param codigoSolicitud + * @return + */ + public static TarmPlanificacionInspeccion findPorCodigo(Long cplanificacion) { + try { + PlanificacionInspeccionController cc = new PlanificacionInspeccionController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", cplanificacion.toString()); + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public PlanificacionTramiteController getPlanificacionTramiteController() { + return planificacionTramiteController; + } + + public void setPlanificacionTramiteController(PlanificacionTramiteController planificacionTramiteController) { + this.planificacionTramiteController = planificacionTramiteController; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getNombreCentroControl() { + return nombreCentroControl; + } + + public void setNombreCentroControl(String nombreCentroControl) { + this.nombreCentroControl = nombreCentroControl; + } + + public DocumentoHabilitanteController getDocumentoHabilitanteController() { + return documentoHabilitanteController; + } + + public void setDocumentoHabilitanteController(DocumentoHabilitanteController documentoHabilitanteController) { + this.documentoHabilitanteController = documentoHabilitanteController; + } + + public Boolean getPlanificacionSalvada() { + return planificacionSalvada; + } + + public void setPlanificacionSalvada(Boolean planificacionSalvada) { + this.planificacionSalvada = planificacionSalvada; + } + + public Boolean getPlanificacionGenerada() { + return planificacionGenerada; + } + + public void setPlanificacionGenerada(Boolean planificacionGenerada) { + this.planificacionGenerada = planificacionGenerada; + } + + public List getListaMeses() { + return listaMeses; + } + + public void setListaMeses(List listaMeses) { + this.listaMeses = listaMeses; + } + + public List getListaPeriodo() { + return listaPeriodo; + } + + public void setListaPeriodo(List listaPeriodo) { + this.listaPeriodo = listaPeriodo; + } + + public String getPeriodo() { + return Periodo; + } + + public void setPeriodo(String Periodo) { + this.Periodo = Periodo; + } + + public Boolean getHabilitarGeneracion() { + return habilitarGeneracion; + } + + public void setHabilitarGeneracion(Boolean habilitarGeneracion) { + this.habilitarGeneracion = habilitarGeneracion; + } + + public List getListaAnnos() { + return listaAnnos; + } + + public void setListaAnnos(List listaAnnos) { + this.listaAnnos = listaAnnos; + } + + public Boolean getPlanificacionesPrevias() { + return planificacionesPrevias; + } + + public void setPlanificacionesPrevias(Boolean planificacionesPrevias) { + this.planificacionesPrevias = planificacionesPrevias; + } + + public TarmCentroControlJur getJurisdiccionCentroControl() { + return jurisdiccionCentroControl; + } + + public void setJurisdiccionCentroControl(TarmCentroControlJur jurisdiccionCentroControl) { + this.jurisdiccionCentroControl = jurisdiccionCentroControl; + } + + public List getPlanificaciones() { + return planificaciones; + } + + public void setPlanificaciones(List planificaciones) { + this.planificaciones = planificaciones; + } + + public PersonAddressController getPersonAddressController() { + return personAddressController; + } + + public void setPersonAddressController(PersonAddressController personAddressController) { + this.personAddressController = personAddressController; + } + + public Long getCplanificacion() { + return cplanificacion; + } + + public void setCplanificacion(Long cplanificacion) { + this.cplanificacion = cplanificacion; + } + + public Boolean getBtnFlujo() { + return btnFlujo; + } + + public void setBtnFlujo(Boolean btnFlujo) { + this.btnFlujo = btnFlujo; + } + /*CFLORES*/ + public List getTipoplanificacionList() { + return tipoplanificacionList; + } + + public void setTipoplanificacionList(List tipoplanificacionList) { + this.tipoplanificacionList = tipoplanificacionList; + } + + public String getIdPlanificacion() { + return idPlanificacion; + } + + public void setIdPlanificacion(String idPlanificacion) { + this.idPlanificacion = idPlanificacion; + } + + public Float getPresupuesto1() { + return presupuesto1; + } + + public void setPresupuesto1(Float presupuesto1) { + this.presupuesto1 = presupuesto1; + } + + +/**/ +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/PlanificacionTramiteController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/PlanificacionTramiteController.java.svn-base new file mode 100644 index 0000000..1b15a6e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/PlanificacionTramiteController.java.svn-base @@ -0,0 +1,328 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.ins.TarmPlanificacionTramite; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class PlanificacionTramiteController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 1L; + + private Long cplanificacion; + + public String Periodo; + + public PlanificacionTramiteController() throws Exception { + super(TarmPlanificacionTramite.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "PLANIFICACIONTRAMITECONTROLLER"; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void query() throws Exception { + // TODO Auto-generated method stub + MessageHelper.setMessageError("msg_notQuery"); + super.query(); + } + + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Busca las inspecciones solo para la Tarea de Aprobacion + */ + @SuppressWarnings("unchecked") + protected void querydatabaseAprobacion() { + try { + DtoQuery dto = super.getDtoQuery(true); +// //Nombre/Razon social + SubQuery subqueryNombre= new SubQuery("TcustPersonDetail","name","nombre", "i.pk.personcode=(select o.personcode from TarmDocumentoHabilitante o where o.pk=t.cdocumento) and" + + " i.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryNombre); + SubQuery subqueryNDocumento=new SubQuery("TcustPersonDetail","identification","nodocumento", "i.pk.personcode=(select o.personcode from TarmDocumentoHabilitante o where o.pk=t.cdocumento) and" + + " i.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryNDocumento); +// //datos del tramite +// //Tipo de tramite + SubQuery subqueryTipoTramite= new SubQuery("TgeneCatalogDetail","description","tipotramite","i.pk.catalog= (select o.tipotramite from TarmTramite o where o.pk=t.ctramite) and" + + " i.pk.catalogcode=(select o.tipotramitecodigo from TarmTramite o where o.pk=t.ctramite)"); + dto.addSubQuery(subqueryTipoTramite); + SubQuery subqueryTramite= new SubQuery("TgeneCatalogDetail","description","tipoautorizacion","i.pk.catalog= (select o.tipoautorizacion from TarmTramite o where o.pk=t.ctramite) and" + + " i.pk.catalogcode=(select o.tipoautorizacioncodigo from TarmTramite o where o.pk=t.ctramite) "); + dto.addSubQuery(subqueryTramite); +// //Uso/Actividad + SubQuery subqueryUsoActividad= new SubQuery("TgeneCatalogDetail","description","usoactividad","i.pk.catalog= (select o.usoactividad from TarmTramite o where o.pk=t.ctramite) and" + + " i.pk.catalogcode=(select o.usoactividadcodigo from TarmTramite o where o.pk=t.ctramite)"); + dto.addSubQuery(subqueryUsoActividad); +// //Categoria + SubQuery subqueryCategoria= new SubQuery("TgeneCatalogDetail","description","categoria","i.pk.catalog= (select o.categoria from TarmTramite o where o.pk=t.ctramite) and" + + " i.pk.catalogcode=(select o.categoriacodigo from TarmTramite o where o.pk=t.ctramite)"); + dto.addSubQuery(subqueryCategoria); + + SubQuery subqueryCodTramite=new SubQuery("TarmDocumentoHabilitante", "fechaexpiracion", "fechacaducidad", "i.pk= t.cdocumento"); + dto.addSubQuery(subqueryCodTramite); + //Filtro de codigo de planificacion + if(this.cplanificacion!=null){ + dto.addFiltro(new Filter("cplanificacion", this.cplanificacion.toString())); + } + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + for (TarmPlanificacionTramite inspeccion : this.lrecord) { + + Calendar calendario=Calendar.getInstance(); + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + Integer dia=calendario.get(Calendar.DAY_OF_MONTH); + Integer mes=calendario.get(Calendar.MONTH); + Integer anno=calendario.get(Calendar.YEAR); + + //Fecha actual + java.util.Date fechaActual=sdf.parse(dia.toString()+"-"+mes.toString()+"-"+anno.toString()); + + //Fecha expiracion + calendario.setTime((Date)inspeccion.getModifiedData().get("fechacaducidad")); + dia=calendario.get(Calendar.DAY_OF_MONTH); + mes=calendario.get(Calendar.MONTH); + anno=calendario.get(Calendar.YEAR); + java.util.Date fechaExpiracion=sdf.parse(dia.toString()+"-"+mes.toString()+"-"+anno.toString()); + + //Asignando el estado del tramite Caducada o Vigente + if(fechaExpiracion.compareTo(fechaActual)<0){ + inspeccion.getModifiedData().put("estado", "Caducada"); + }else{ + inspeccion.getModifiedData().put("estado", "Vigente"); + } + + + + + inspeccion.getModifiedData().put("presupuesto", inspeccion.getPresupuesto()); + inspeccion.getModifiedData().put("inspectores", this.record.getInspectores()); +// } + } + } + super.postQuery(lrecord); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + @Override + public void update() throws Exception { + try { + if(this.record.getMes().equalsIgnoreCase("Enero")){ + this.record.setMesnumero(0L); + }else if(this.record.getMes().equalsIgnoreCase("Febrero")){ + this.record.setMesnumero(1L); + }else if(this.record.getMes().equalsIgnoreCase("Marzo")){ + this.record.setMesnumero(2L); + }else if(this.record.getMes().equalsIgnoreCase("Abril")){ + this.record.setMesnumero(3L); + }else if(this.record.getMes().equalsIgnoreCase("Mayo")){ + this.record.setMesnumero(4L); + }else if(this.record.getMes().equalsIgnoreCase("Junio")){ + this.record.setMesnumero(5L); + }else if(this.record.getMes().equalsIgnoreCase("Julio")){ + this.record.setMesnumero(6L); + }else if(this.record.getMes().equalsIgnoreCase("Agosto")){ + this.record.setMesnumero(7L); + }else if(this.record.getMes().equalsIgnoreCase("Spetiembre")){ + this.record.setMesnumero(8L); + }else if(this.record.getMes().equalsIgnoreCase("Octubre")){ + this.record.setMesnumero(9L); + }else if(this.record.getMes().equalsIgnoreCase("Noviembre")){ + this.record.setMesnumero(10L); + }else if(this.record.getMes().equalsIgnoreCase("Diciembre")){ + this.record.setMesnumero(11L); + } + + + + // this.record.setPeriodo("hola1"); + + + + super.update(); + //ordenarPorMesNombre(); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + + /** + * Busca las las inspecciones de una planificacion dado su codigo + * @param codigoSolicitud + * @return + */ + public static List findPorCodigoPlanificacion(Long cplanificacion) { + try { + PlanificacionTramiteController cc = new PlanificacionTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("cplanificacion", cplanificacion.toString()); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo apara actualizar el registro + * @throws Exception + */ + public void actualizar(TarmPlanificacionTramite planificacionTramite) throws Exception{ + record=planificacionTramite; + super.update(); + } + + public Long getCplanificacion() { + return cplanificacion; + } + + public void setCplanificacion(Long cplanificacion) { + this.cplanificacion = cplanificacion; + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + public String getPeriodo() { + return Periodo; + } + + public void setPeriodo(String Periodo) { + this.Periodo = Periodo; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RecepcionArmasController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RecepcionArmasController.java.netbeans-base new file mode 100644 index 0000000..c4eb9c7 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RecepcionArmasController.java.netbeans-base @@ -0,0 +1,1919 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.CargaController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.inte.TarmColadeImpresion; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmAgenciaArma; +import com.fp.persistence.parmas.soli.TarmArmaPruebas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.parmas.soli.TarmSolicitudGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + + +/** + * Controlador principal que maneja la entidad TarmSolicitudArmas + * @author Carlos Guzman + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RecepcionArmasController extends AbstractController { + + private TcustPersonDetail personaDetalle; + private String provincia; + private String canton; + private String ciudad; + private String direccion; + private List lArmas = new ArrayList(); + private List lSolicitudGuardias = new ArrayList(); + private List lGuardias = new ArrayList(); + private TgeneCatalogDetail detallecatalogo = new TgeneCatalogDetail(); + private TgeneCatalogDetail detallecatalogoTipoTramite = new TgeneCatalogDetail(); + private TgeneCatalogDetail usoActividad = new TgeneCatalogDetail(); + private TgeneCatalogDetail tipoAutorizacion = new TgeneCatalogDetail(); + private TgeneCatalogDetail categoria = new TgeneCatalogDetail(); + private TgeneCatalogDetail identificacion = new TgeneCatalogDetail(); + private TgeneCatalogDetail estadotramite = new TgeneCatalogDetail(); + private TgeneCatalogDetail tipoArchivo = new TgeneCatalogDetail(); + private TgeneCatalogDetail tipoCosto = new TgeneCatalogDetail(); + private TgeneCatalogDetail vigencia = new TgeneCatalogDetail(); + private TarmSolicitudTramite solicitudTramite=new TarmSolicitudTramite(); + private TsafeUserDetail tsafeUserDetailUsuario = null; + private TarmTramite tramite=new TarmTramite(); + private TarmSolicitud solicitud = new TarmSolicitud(); + private TarmTipoArmaExplosivo tipoArmaExplosivo = new TarmTipoArmaExplosivo(); + private boolean controlPantallaEntregado; + private boolean controlPantallaVisualizarTramiteFirmar; + private boolean controlPantallaVerificarInformacionDevolucion; + private String codigoSolicitud = ""; + private String observacion; + private String estado; + private Date fec_actual; + private String xpathflujo; + private TcustPersonDetail responsableCentroControl= null; + private TsafeUserDetail usuario; + private Boolean btnFlujo; + private Boolean btnGrabar; + /** + * lista del catalogo de las acciones (Aceptar o rechazar) + */ + private List laccion; + + private TarmCentroControl centroControl = new TarmCentroControl(); + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddressController; + + @ManagedProperty(value = "#{solicitudGuardiasController}") + private SolicitudGuardiasController solicitudGuardiasController; + + @ManagedProperty(value = "#{armasController}") + private ArmasController armasController; + + @ManagedProperty(value = "#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitanteController; + + @ManagedProperty(value = "#{colaImpresionController}") + private ColaImpresionController colaImpresionController; + + @ManagedProperty(value = "#{documentoHabilitanteDetalleController}") + private DocumentoHabilitanteDetalleController documentoHabilitanteDetalleController; + + @ManagedProperty(value="#{solicitudTramiteController}") + private SolicitudTramiteController solicitudTramiteController; + + @ManagedProperty(value="#{solicitudController}") + private SolicitudController solicitudController; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * Controlador que maneja cargas para previa importacion + */ + @ManagedProperty(value = "#{cargaController}") + private CargaController cargaController; + + /** + * controlador de la solicitud + */ + @ManagedProperty(value = "#{solicitudArmasController}") + private SolicitudArmasController solicitudMP; + + /** + * Controlador que maneja las armas asociadas a las agencias + */ + @ManagedProperty(value="#{agenciaArmaController}") + private AgenciaArmaController agenciaArma; + + + private String numeroTransaccion=""; + + private List solAgenciaSucursals; + + private List documentosList; + + private Boolean requiereNoSolAucpBln; + + /** + *Nombre de la Institucion + */ + private String nombreInstitucion; + + public RecepcionArmasController() throws Exception { + super(TarmSolicitudArmas.class); + } + + + @PostConstruct + private void postconstruct() throws Exception { + startQuery(); + this.init(); + querydatabase(); + + solicitudController= new SolicitudController(); + + Boolean aprobarFichaBLN = Boolean.FALSE; + + laccion = new ArrayList(); + + // Validamos en el caso de permisos + TarmTramite tramite = TarmTramiteController.find(numeroTransaccion); + TgeneCatalogDetail tipoAutorizacion = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + + if(tipoAutorizacion!=null && tipoAutorizacion.getDescription().equalsIgnoreCase("PERMISO")){ + ListarmaPruebaList = IngresoFichaTecnicaArmasController.buscarFichasPorSolicitud(codigoSolicitud); + for(TarmArmaPruebas armaPruebaObj:armaPruebaList){ + if(armaPruebaObj.getApruebaevaluacion().equalsIgnoreCase("Y")){ + aprobarFichaBLN = Boolean.TRUE; + break; + } + } + if(aprobarFichaBLN){ + laccion=CatalogDetailController.find("ACCION"); + } + else{ + TgeneCatalogDetail catalogRechazar = CatalogDetailController.findCatalogo("ACCION","RECH"); + laccion.add(catalogRechazar); + } + } + else{ + laccion=CatalogDetailController.find("ACCION"); + } + + + try { + //consulta de agencias + cargarAgencias(); + //consulta de documentos + cargarDocumentos(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Método en el cual se cargan las agencias que corresponden a la solicitud + * @throws Exception + */ + private void cargarAgencias() throws Exception{ + if(codigoSolicitud!=null){ + solAgenciaSucursals=SolicitudAgenciaSucursalController.findPorSolicitud(codigoSolicitud); + } + } + + /** + * Método en el cual se cargan las agencias que corresponden a la solicitud + * @throws Exception + */ + private void cargarDocumentos() throws Exception{ + if(codigoSolicitud!=null){ + documentosList=TarmSolicitudDocumentoController.findPorSolicitud(codigoSolicitud);//documentoHabilitanteController.lrecord + } + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + //xpathflujo=super.getMfilters().get("xpath");//"cm:Decomiso/cm:A-2014/cm:M-10/cm:ENV-000000319/cm:ENV-000000319.pdf";// + numeroTransaccion=super.getMfilters().get("numerotransaccion"); + codigoSolicitud=super.getMfilters().get("csolicitud"); + System.out.println("numeroTransaccion .."+numeroTransaccion); + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + private void init() { + try { + validarpantallaActual(); + recperpage = 500; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "RECEPCIONARMAS"; + this.responsableCentroControl = new TcustPersonDetail(); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + usuario=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + this.fec_actual = new Date(); + btnFlujo=Boolean.FALSE; + btnGrabar=Boolean.TRUE; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + this.lArmas.clear(); + this.lGuardias.clear(); + if (codigoSolicitud==null){ + return; + } + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.csolicitud"); + + SubQuery subquerymodelo= new SubQuery("TarmArmas","modelo","modelo","i.pk=t.pk.carma"); + dto.addSubQuery(subquerymodelo); + SubQuery subqueryacrma= new SubQuery("TarmArmas","pk","carma","i.pk=t.pk.carma"); + dto.addSubQuery(subqueryacrma); + + SubQuery subqueryserie= new SubQuery("TarmArmas","lote","lote","i.pk=t.pk.carma"); + dto.addSubQuery(subqueryserie); + + SubQuery subqueryCantidad= new SubQuery("TarmArmas","cantidad","cantidad","i.pk=t.pk.carma"); + dto.addSubQuery(subqueryCantidad); + + SubQuery subqueryPeso= new SubQuery("TarmArmas","peso","peso","i.pk=t.pk.carma"); + dto.addSubQuery(subqueryPeso); + + SubQuery subqueryUnidadMedida= new SubQuery("TgeneCatalogDetail","description","unidadmedida","i.pk.catalog=(select p.unidadmedidacantidad from TarmArmas p where p.pk=t.pk.carma) and" + + " i.pk.catalogcode=(select p.unidadmedidacantidadcodigo from TarmArmas p where p.pk=t.pk.carma)"); + dto.addSubQuery(subqueryUnidadMedida); + + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog= (select o.marca from TarmArmas o where o.pk=t.pk.carma) " + + " and i.pk.catalogcode=(select o.marcacodigo from TarmArmas o where o.pk=t.pk.carma)"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=(select o.color from TarmArmas o where o.pk=t.pk.carma)" + + " and i.pk.catalogcode=(select o.colorcodigo from TarmArmas o where o.pk=t.pk.carma)"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=(select o.estado from TarmArmas o where o.pk=t.pk.carma)" + + " and i.pk.catalogcode=(select o.estadocodigo from TarmArmas o where o.pk=t.pk.carma)"); + dto.addSubQuery(subqueryEstado); + + SubQuery subqueryClase= new SubQuery("TgeneCatalogDetail","description","clase","i.pk.catalog=(select o.clase from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + dto.addSubQuery(subqueryClase); + + SubQuery subqueryLongitud= new SubQuery("TgeneCatalogDetail","description","longitud","i.pk.catalog=(select o.longitud from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.longitudcodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + dto.addSubQuery(subqueryLongitud); + + SubQuery subqueryCalibre= new SubQuery("TgeneCatalogDetail","description","calibre","i.pk.catalog=(select o.calibre from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.calibrecodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + dto.addSubQuery(subqueryCalibre); + + SubQuery subqueryTipoArma= new SubQuery("TgeneCatalogDetail","description","tipo","i.pk.catalog=(select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + + dto.addSubQuery(subqueryTipoArma); + + + Filter filtro = new Filter(); + filtro.setField("pk.csolicitud"); + filtro.setValue(codigoSolicitud); + dto.addFiltro(filtro); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + solicitudGuardiasController.addFilter("pk.csolicitud", codigoSolicitud); + solicitudGuardiasController.findPorSolicitud(codigoSolicitud); + solicitudGuardiasController.query(); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(beanalias); + if ((this.lrecord != null) && !this.lrecord.isEmpty()) { + } + + super.postQuery(this.lrecord); + } + + solicitud = SolicitudArmasController.find(codigoSolicitud); + + if (solicitud!=null){ + personaDetalle = PersonDetailController.find(String.valueOf(solicitud.getPersoncode())); + identificacion = (personaDetalle.getIdentificationcatalog()==null || personaDetalle.getIdentificationcatalogcode()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(personaDetalle.getIdentificationcatalog(), personaDetalle.getIdentificationcatalogcode()); + + if(identificacion!=null){ + //personAddressController.findPersonaPorDireccionTipoCatalogo(String.valueOf(solicitud.getPersoncode()), tipoDireccion); + TcustPersonAddress direccionCliente=personAddressController.findPrincipal(String.valueOf(solicitud.getPersoncode())) ; + provincia = direccionCliente.modifiedData().get("provincia")==null?null: direccionCliente.modifiedData().get("provincia").toString(); //personAddressController.getLprovinces()==null || .getLprovinces().isEmpty()?null:personAddressController.getLprovinces().get(0); + canton = direccionCliente.modifiedData().get("canton")==null?null: direccionCliente.modifiedData().get("canton").toString();//personAddressController.getLcantones()==null || personAddressController.getLcantones().isEmpty()?null:personAddressController.getLcantones().get(0); + ciudad = direccionCliente.modifiedData().get("ciudad")==null?null: direccionCliente.modifiedData().get("ciudad").toString();//personAddressController.getLcities()==null || personAddressController.getLcities().isEmpty()?null:personAddressController.getLcities().get(0); + direccion= direccionCliente.getAddress(); + } + + } + + //Proceso de tramite + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(codigoSolicitud); + if(solicitudTramite!=null && solicitudTramite.getPk().getCtramite()!=null){ + tramite=TarmTramiteController.find(solicitudTramite.getPk().getCtramite().toString()); + estadotramite = (solicitudTramite.getEstadotramite()==null || solicitudTramite.getEstadotramitecodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(solicitudTramite.getEstadotramite(), solicitudTramite.getEstadotramitecodigo()); + } + + if(tramite!=null && tramite.getPk() != null){ + detallecatalogo = (tramite.getCategoria()==null || tramite.getCategoriacodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + detallecatalogoTipoTramite = (tramite.getTipoautorizacion()==null || tramite.getTipoautorizacioncodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + vigencia = CatalogDetailController.findxCodigoCodcatalogo( tramite.getVigencia(), tramite.getVigenciacodigo()); + tipoArchivo = CatalogDetailController.findxCodigoCodcatalogo( tramite.getTipoarchivo(), tramite.getTipoarchivocodigo()); + tipoCosto = CatalogDetailController.findxCodigoCodcatalogo( tramite.getTipocosto(), tramite.getTipocostocodigo()); + usoActividad = (tramite.getUsoactividad()==null || tramite.getUsoactividadcodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + tipoAutorizacion = (tramite.getTipoautorizacion()==null || tramite.getTipoautorizacioncodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + categoria = (tramite.getCategoria()==null || tramite.getCategoriacodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + // CATEGORIA 14 PREVIA IMPORTACION + if(tramite!=null && tramite.getCategoria().equals("14")){ + requiereNoSolAucpBln=Boolean.TRUE; + nombreInstitucion = obtenerCentroControl(); + }else{ + requiereNoSolAucpBln=Boolean.FALSE; + } + } + + armasController.setRecperpage(500); + + //lArmas = armasController.findArmaRecep(lrecord.get(0).getPk().getCsolicitud()); + for(TarmSolicitudArmas solicitudArmas:lrecord){ + TarmArmas armas = new TarmArmas(); + armas = armasController.find(solicitudArmas.getPk().getCarma(),null); + lArmas.add(armas); + } + armasController.setLrecord(lArmas); + actualizarArmas(); + List listaCentroControl=null; + if(solicitud!=null && solicitud.getCcentrocontrol()!=null){ + listaCentroControl= CentroControlArmasController.find(solicitud.getCcentrocontrol()); + } + + if(listaCentroControl!=null && !listaCentroControl.isEmpty() ){//&& listaCentroControl.get(0).getTramitespordia()!=null){ + centroControl = listaCentroControl.get(0); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que usa para pasar el flujo al seleccionar el boton guardar + */ + public void guardar(){ + + } + + private void guardarcolaImpresionController(HashMap msave) throws Throwable{ + System.out.println("ACTUALIZA COLA DE IMPRESION"); + TarmDocumentoHabilitante docHabilitante=DocumentoHabilitanteController.findPorSolicitud(codigoSolicitud); + if(docHabilitante!=null && docHabilitante.getPk()!=null){ + System.out.println("ACTUALIZA COLA DE IMPRESION 1"); + ListlistaColaImprecion=ColaImpresionController.findByDocumentoCDoc(docHabilitante.getPk().toString()); + if(listaColaImprecion!=null && listaColaImprecion.size()>0){ + System.out.println("ACTUALIZA COLA DE IMPRESION 2"); + for (TarmColadeImpresion item : listaColaImprecion) { + item.setEstadoimpresion("PIMPR"); + item.setEstadoimpresioncode("ESTADOIMPRESION"); + colaImpresionController.update(item); + } + System.out.println("ACTUALIZA COLA DE IMPRESION 3"); + registrarGuardadoColaImpresion(msave); + System.out.println("ACTUALIZA COLA DE IMPRESION 4"); + } + } + + } + + private void registrarGuardadoColaImpresion(HashMap msave) throws Throwable{ + //= new HashMap(); + Request request = callerhelper.getRequest(); + DtoSave dtosaveColaImpresion = this.colaImpresionController.getDtoSave(true); + dtosaveColaImpresion.setReturnpk(true); + dtosaveColaImpresion.setPosition(1); + msave.put(colaImpresionController.getBeanalias(), dtosaveColaImpresion); + request.setSaveTables(msave); +// Response resp = callerhelper.executeSave(request); +// if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { +// this.colaImpresionController.postCommit(resp); +// this.postCommit(resp); +// MessageHelper.setMessageInfo(resp); +// } else { +// MessageHelper.setMessageError(resp); +// throw new Exception(""+resp); +// } + } + + /** + * Metodo para guardar los documentos habilitantes + * @throws Throwable + */ + public void guardarDocumentoHabilitante() throws Throwable{ + HashMap msave = new HashMap(); + Calendar cal = Calendar.getInstance(); + String estado="APR"; + System.out.println("vigencia.getDescription() "+vigencia.getDescription()); + System.out.println("vigencia.getDescription().trim().equals(1200) "+vigencia.getDescription().trim().equals("1200")); + if(vigencia.getDescription()!=null && vigencia.getDescription().trim().equals("1200")){ + cal.set(Calendar.YEAR, 2999); + cal.set(Calendar.MONTH, 12); + cal.set(Calendar.DAY_OF_MONTH, 31); + }else{ + cal.add(Calendar.MONTH, Integer.valueOf(vigencia.getDescription())); + } + System.out.println(cal); + System.out.println(cal.getTime()); + TarmSolicitudTramite solicitudtramite =TarmSolicitudTramiteController.findPorCSolicitud(codigoSolicitud); + if("CARNET".equalsIgnoreCase(tipoArchivo.getDescription())){ + if("TOTAL".equalsIgnoreCase(tipoCosto.getDescription())){ + documentoHabilitanteController.create(); + documentoHabilitanteController.getRecord().setIsnew(true); + documentoHabilitanteController.getRecord().setCsolicitud(codigoSolicitud); + documentoHabilitanteController.getRecord().setCentrocontrol(centroControl.getPk()); + documentoHabilitanteController.getRecord().setCarma(null); + documentoHabilitanteController.getRecord().setCuentareimpresion(0); + documentoHabilitanteController.getRecord().setCtramite(solicitudtramite.getPk().getCtramite()); + documentoHabilitanteController.getRecord().setFechaemision(new java.sql.Date((new Date()).getTime())); + documentoHabilitanteController.getRecord().setFechaexpiracion(new java.sql.Date((cal.getTime()).getTime())); + documentoHabilitanteController.getRecord().setPersoncode(solicitud.getPersoncode()); + documentoHabilitanteController.getRecord().setEstado(estado); + documentoHabilitanteController.getRecord().setEstadocode("ESTADODOCUMENTO"); + documentoHabilitanteController.update(); + + //Grabacion en la cola de impresion + colaImpresionController.create(); + colaImpresionController.getRecord().setIsnew(true); + //colaImpresionController.getRecord().setEstadoimpresion("PIMPR"); + //colaImpresionController.getRecord().setEstadoimpresioncode("ESTADOIMPRESION"); + java.util.Date date = new java.util.Date(); + colaImpresionController.getRecord().setFecharegistro(new java.sql.Date(date.getTime())); + colaImpresionController.update(); + + } + if("TOTAL".equalsIgnoreCase(tipoCosto.getDescription()) && (this.lrecord==null || this.lrecord.isEmpty())){ + registrarGuardadoDocumentoHabilitante(msave); + } + + for(TarmSolicitudArmas armaSolicitud:this.lrecord){ + + if("PARCIAL".equalsIgnoreCase(tipoCosto.getDescription())){ + documentoHabilitanteController.create(); + documentoHabilitanteController.getRecord().setIsnew(true); + documentoHabilitanteController.getRecord().setCsolicitud(codigoSolicitud); + documentoHabilitanteController.getRecord().setCentrocontrol(centroControl.getPk()); + documentoHabilitanteController.getRecord().setCarma(armaSolicitud.getPk().getCarma()); + documentoHabilitanteController.getRecord().setCodigoarma(ArmasController.findPorCodigo(armaSolicitud.getPk().getCarma()).getCodigoarma()); + documentoHabilitanteController.getRecord().setCuentareimpresion(0); + documentoHabilitanteController.getRecord().setCtramite(solicitudtramite.getPk().getCtramite()); + documentoHabilitanteController.getRecord().setFechaemision(new java.sql.Date((new Date()).getTime())); + documentoHabilitanteController.getRecord().setFechaexpiracion(new java.sql.Date((cal.getTime()).getTime())); + documentoHabilitanteController.getRecord().setPersoncode(solicitud.getPersoncode()); + documentoHabilitanteController.getRecord().setEstado(estado); + documentoHabilitanteController.getRecord().setEstadocode("ESTADODOCUMENTO"); + documentoHabilitanteController.update(); + + //Grabacion en la cola de impresion + colaImpresionController.create(); + colaImpresionController.getRecord().setIsnew(true); + //colaImpresionController.getRecord().setEstadoimpresion("PIMPR"); + //colaImpresionController.getRecord().setEstadoimpresioncode("ESTADOIMPRESION"); + java.util.Date date = new java.util.Date(); + colaImpresionController.getRecord().setFecharegistro(new java.sql.Date(date.getTime())); + colaImpresionController.update(); + } + documentoHabilitanteDetalleController.create(); + documentoHabilitanteDetalleController.getRecord().setIsnew(true); + documentoHabilitanteDetalleController.getRecord().setCarma(armaSolicitud.getPk().getCarma()); + documentoHabilitanteDetalleController.getRecord().setCodigoarma(ArmasController.findPorCodigo(armaSolicitud.getPk().getCarma()).getCodigoarma()); + documentoHabilitanteDetalleController.update(); + if("PARCIAL".equalsIgnoreCase(tipoCosto.getDescription())){ + registrarGuardadoDocumentoHabilitante(msave); + } + } + + if("TOTAL".equalsIgnoreCase(tipoCosto.getDescription()) && (this.lrecord!=null && !this.lrecord.isEmpty())){ + registrarGuardadoDocumentoHabilitante(msave); + return; + } + + }else + if("REPORTE".equalsIgnoreCase(tipoArchivo.getDescription())){ + documentoHabilitanteController.create(); + //TarmSolicitudTramite solicitudtramite =TarmSolicitudTramiteController.findPorCSolicitud(codigoSolicitud); + documentoHabilitanteController.getRecord().setIsnew(true); + documentoHabilitanteController.getRecord().setCsolicitud(codigoSolicitud); + documentoHabilitanteController.getRecord().setCentrocontrol(centroControl.getPk()); + documentoHabilitanteController.getRecord().setCuentareimpresion(0); + documentoHabilitanteController.getRecord().setCtramite(solicitudtramite.getPk().getCtramite()); + documentoHabilitanteController.getRecord().setCarma((this.lrecord!=null &&!this.lrecord.isEmpty() && this.lrecord.size()>0)? this.lrecord.get(0).getPk().getCarma():null); + documentoHabilitanteController.getRecord().setFechaemision(new java.sql.Date((new Date()).getTime())); + documentoHabilitanteController.getRecord().setFechaexpiracion(new java.sql.Date((cal.getTime()).getTime())); + documentoHabilitanteController.getRecord().setPersoncode(solicitud.getPersoncode()); + documentoHabilitanteController.getRecord().setEstado(estado); + documentoHabilitanteController.getRecord().setEstadocode("ESTADODOCUMENTO"); + documentoHabilitanteController.update(); + + for(TarmSolicitudArmas armaSolicitud:this.lrecord){ + documentoHabilitanteDetalleController.create(); + documentoHabilitanteDetalleController.getRecord().setIsnew(true); + documentoHabilitanteDetalleController.getRecord().setCarma(armaSolicitud.getPk().getCarma()); + documentoHabilitanteDetalleController.getRecord().setCodigoarma(ArmasController.findPorCodigo(armaSolicitud.getPk().getCarma()).getCodigoarma()); + documentoHabilitanteDetalleController.update(); + } + + registrarGuardadoDocumentoHabilitante(msave); + }else{ + throw new Exception("TIPO DOCUMENTO DE INVALIDO: "+tipoArchivo.getDescription()); + } + } + + /** Metodo para realizar el guardado del documento habilitante + * @param msave variable save + * @throws Throwable + */ + private void registrarGuardadoDocumentoHabilitante(HashMap msave) throws Throwable{ + Request request = callerhelper.getRequest(); + + DtoSave dtosaveDocumento = this.documentoHabilitanteController.getDtoSave(true); + dtosaveDocumento.setReturnpk(true); + dtosaveDocumento.setPosition(1); + DtoSave dtosaveDocumentoDetalle = this.documentoHabilitanteDetalleController.getDtoSave(true); + dtosaveDocumentoDetalle.setReturnpk(true); + dtosaveDocumentoDetalle.setPosition(2); + DtoSave dtosaveColaImpresion = this.colaImpresionController.getDtoSave(true); + dtosaveColaImpresion.setReturnpk(true); + dtosaveColaImpresion.setPosition(3); + + msave.put(documentoHabilitanteController.getBeanalias(), dtosaveDocumento); + msave.put(documentoHabilitanteDetalleController.getBeanalias(), dtosaveDocumentoDetalle); + msave.put(colaImpresionController.getBeanalias(), dtosaveColaImpresion); + + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.documentoHabilitanteController.postCommit(resp); + this.documentoHabilitanteDetalleController.postCommit(resp); + this.colaImpresionController.postCommit(resp); + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + throw new Exception(""+resp); + } + } + + + + /** + * Metodo que valida cual es la pantalla que se encuentra activa este controlador + */ + private void validarpantallaActual(){ + if(this.getLoginController()!=null && 24 == this.getLoginController().getRequest().getTransactionCode() && "30".equals(getLoginController().getRequest().getTransactionModule())){ + controlPantallaEntregado=true; + } + else{ + controlPantallaEntregado=false; + } + + if(this.getLoginController()!=null && 34 == this.getLoginController().getRequest().getTransactionCode() && "30".equals(getLoginController().getRequest().getTransactionModule())){ + controlPantallaVisualizarTramiteFirmar = true; + } + else{ + controlPantallaVisualizarTramiteFirmar = false; + } + + if(this.getLoginController()!=null && 33 == this.getLoginController().getRequest().getTransactionCode() && "30".equals(getLoginController().getRequest().getTransactionModule())){ + controlPantallaVerificarInformacionDevolucion = true; + } + else{ + controlPantallaVerificarInformacionDevolucion = false; + } + } + + @Override + public void query() throws Exception { + MessageHelper.setMessageError("msg_notQuery"); + super.query(); + } + @Override + public void next() throws Exception { + // TODO Auto-generated method stub + super.next(); + } + + + /** + * Metodo para enviar el documento habilitante por el flujo + */ + public void enviarDocumentoHabilitante(){ + + + } + + @Override + public void save() { + try { + if (!validarSeleccion()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_validar_seleccion_armas")); + return; + } + + actualizarArmas(); + actualizarSolicitudArmas(); + + TarmSolicitud sol = this.solicitudController.findSolicitudxcodsolicitud(this.codigoSolicitud); + String ruta = this.getRutaDocumento()+"/cm:actaEntregaRecepcionArmas.pdf"; + System.out.println("ruta : " + ruta); + sol.setXpathacta(ruta); + this.solicitudController.updateSolicitud(sol); + + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + btnFlujo=Boolean.TRUE; + btnGrabar=Boolean.FALSE; + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Metodo que guarda el documento + */ + public void saveDocumentoHabilitante() { + + try { + // validamos si cargamos los datos cuando apruebe + Map datosmail = new HashMap(); + Request request = callerhelper.getRequest(); + + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail persona = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + + if (codigoAceptado().equals(estado)) { + request.modifiedData().put("BPMStatus", + bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + } else { + request.modifiedData().put("BPMStatus", + bpmDataStatus == null ? "D" : bpmDataStatus); // A,D,R + datosmail.put("funcionario",persona ==null?"":((persona.getMilitarygrade()==null && persona.getMilitarygradecode()==null)?"":CatalogDetailController.findxCodigoCodcatalogo(persona.getMilitarygrade(),persona.getMilitarygradecode()).getDescription()) + " " + persona.getName()); + datosmail.put("razons",(solicitud==null || solicitud.getModifiedData().get("nombre")==null)?"":solicitud.getModifiedData().get("nombre")); + datosmail.put("sol", solicitud==null?"":solicitud.getPk()); + datosmail.put("centrocontrol",(centroControl==null || centroControl.getNombreinstitucion()==null || centroControl.getNombreinstitucioncodigo()==null)?"":CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + + } + + this.update(); + + HashMap msave = new HashMap(); + + request.modifiedData().put("datosmail", datosmail); + request.modifiedData().put("csolicitud", codigoSolicitud); + //request.modifiedData().put("numerotramite", "32"); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMObs", "Analizar documento habilitante"); + request.modifiedData().put("observacion", observacion); + + + request.setSaveTables(msave); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + dtosave.setPosition(1); + msave.put(beanalias, dtosave); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute( + "Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + + } + + /** + * M\u00e9todo que valida si todas las armas se encuentran seleccionadas + * @return + */ + public boolean validarSeleccion(){ + for(TarmSolicitudArmas armaSeleccionada:lrecord){ + if(!armaSeleccionada.modifiedData().containsValue(Boolean.TRUE)){ + return false; + } + } + return true; + } + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if(tcustPersonAddres == null){ + return null; + } + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl(){ + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + /** + * Metodo para armar la ruta del documento + * @return + */ + public String getRutaDocumento() { + Calendar calendar = Calendar.getInstance(); + StringBuilder ruta = new StringBuilder("cm:Solicitudes"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append( + (calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + ruta = ruta.append("/cm:D-").append( + (calendar.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (calendar.get(Calendar.DAY_OF_MONTH)) : (calendar.get(Calendar.DAY_OF_MONTH))); + TarmSolicitud solicitud = SolicitudArmasController.find(codigoSolicitud); + ruta = ruta.append("/cm:").append(solicitud.getNumerosolicitud()); + ruta = ruta.append("/cm:").append("armas"); + return ruta.toString(); + } + + + + /** + * M\u00e9todo para imprimir + */ + public void imprimir(){ + try { + if (!validarSeleccion()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_imprimir_recepcion_armas")); + return; + } + this.reporteActaEntregaRecepArmas(); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + /** + * Obtiene el reporte de Acta de Entrega Recepción de Armas + */ + private void reporteActaEntregaRecepArmas() throws Exception{ + try { + //this.querydatabase(); + //buttonAction(); + Calendar fechaActualCldr = Calendar.getInstance(); + Calendar fechaCorteCldr = Calendar.getInstance(); + String gradoUsuario =""; + TarmSolicitud sol = this.solicitudController.findSolicitudxcodsolicitud(this.codigoSolicitud); + TarmSolicitudTramite soltra = SolicitudTramiteController.findByCSolicitud(this.codigoSolicitud); + + String path = "armas/reports/repo"; + String filename="actaEntregaRecepcionArmas";//MsgControlArmas.getProperty("lbl_fichaTecnicaArmas"); + String nombreUsuario; + if(usuario.getPk().getPersoncode()!=null){ + nombreUsuario = PersonDetailController.find(usuario.getPk().getPersoncode().toString()).getName(); + } + else{ + nombreUsuario = ""; + } + + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("usuario", nombreUsuario); + //Centro de control + parameters.put("centroControl", this.obtenerCentroControl()); + + //Fecha actual + + //Fecha de solicitud + if(sol!=null && sol.getNumerosolicitud()!=null){ + if(soltra != null && soltra.getNumerotramite()!=null){ + parameters.put("numsolicitud", sol.getNumerosolicitud()); + parameters.put("numtramite", soltra.getNumerotramite()); + TcustPersonDetail persona = PersonDetailController.find(sol.getPersoncode().toString()); + parameters.put("cliente", persona.getName()); + } + }else{ + parameters.put("numsolicitud", " "); + } + + //No tramite + if(sol!=null && sol.getFregistro()!=null){ + SimpleDateFormat sdf2=new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fechaSolicitud", sdf2.format(sol.getFregistro())); + }else{ + parameters.put("fechaSolicitud", " "); + } + + //codigo solicitud + parameters.put("csolicitud", this.codigoSolicitud); + parameters.put("personcode", usuario.getPk().getPersoncode()); + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH)+1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("fecActual", fechaActualSB.toString()); + //Grado del funcionario + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if(grado != null){ + gradoUsuario = grado.getDescription()+" - "+this.responsableCentroControl.getName(); + }else{ + gradoUsuario = "Sin Grado - "+this.responsableCentroControl.getName(); + } + parameters.put("gradoUsuario", gradoUsuario); + //parameters.put("usuario", this.tsafeUserDetailUsuario.getNickname()); + //parameters.put("codResponsable", this.responsableCentroControl.getPk().getPersoncode().toString()); + + String format = "pdf"; + + parameters.put("tipotram", this.tipoAutorizacion.getDescription()+" - "+this.categoria.getDescription()+" - "+this.usoActividad.getDescription()); + parameters.put("codResponsable",usuario.getPk().getPersoncode()); + + parameters.put("codigoQR",(sol!=null?sol.getNumerosolicitud():"")+" "+fechaActualSB.toString()+" "+ + gradoUsuario); + + try { + this.xpathflujo = this.getRutaDocumento(); + InputStream report=this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + this.alfrescoController.uploadFile(report, filename+".pdf", this.xpathflujo); + //this.record.setXpathfichatecarmas(this.xpathflujo + "/cm:" + filename+".pdf"); + //this.record.getModifiedData().put("impresion",Boolean.TRUE); + //this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } + + /** + * @return + * @throws Exception + */ + public String codigoAceptado() throws Exception { + TgeneParameters f = ParametersController.find("ACEPTADO", "1"); + return f.getTextvalue(); + } + + /** + * M\u00e9todo para fimar documentos + */ + public void firmar(){ + System.out.println("Firmar"); + } + + /** + * M\u00e9todo para actualizar las armas en la base de datos seg\u00fan la pantalla en que se encuentre + * @throws Exception + */ + private void actualizarSolicitudArmas() throws Exception{ + for(TarmSolicitudArmas armaSeleccionada:lrecord){ + record = armaSeleccionada; + if(armaSeleccionada.modifiedData().get("seleccion").equals(Boolean.TRUE)){ + if(controlPantallaEntregado){ + record.setEntregada("Y"); + } + else{ + record.setAprobada("Y"); + } + } + if(!armaSeleccionada.modifiedData().get("seleccion").equals(Boolean.TRUE)){ + if(controlPantallaEntregado){ + record.setEntregada("N"); + } + else{ + record.setAprobada("N"); + } + } + update(); + } + + } + + + + + /** + * M\u00e9todo para leer las selecciones guardadas en la base y setearlas seg\u00fan la pantalla en la que se encuentre + * @throws Exception + */ + private void actualizarArmas() throws Exception{ + for(TarmSolicitudArmas solicitudArmas:lrecord){ + if("Y".equals(solicitudArmas.getEntregada()) && controlPantallaEntregado){ + solicitudArmas.modifiedData().put("seleccion", Boolean.TRUE); + } + if("Y".equals(solicitudArmas.getAprobada()) && !controlPantallaEntregado){ + solicitudArmas.modifiedData().put("seleccion", Boolean.TRUE); + } + } + } + + + @SuppressWarnings("unchecked") + protected void querydatabaseValidacionTransito() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para completar la tarea + */ + public void completarTareaAutorizarTramite() { + try { + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + super.cleanRequest(request); + request.modifiedData().put("csolicitud", codigoSolicitud); + request.modifiedData().put("numerotransaccion", numeroTransaccion); + request.modifiedData().put("TID", tid); + if(bpmDataStatus.equalsIgnoreCase("APR") || bpmDataStatus == null){ + bpmDataStatus="A"; + if(this.getLoginController()!=null && 30 == this.getLoginController().getRequest().getTransactionCode() && + "30".equals(getLoginController().getRequest().getTransactionModule())){ + guardarcolaImpresionController(msave); + } + }else{ + bpmDataStatus="D"; + } + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Map datosmail = new HashMap(); + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail persona = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + if (bpmDataStatus.equals("D")) { + datosmail.put("funcionario",persona ==null?"":((persona.getMilitarygrade()==null && persona.getMilitarygradecode()==null)?"":CatalogDetailController.findxCodigoCodcatalogo(persona.getMilitarygrade(),persona.getMilitarygradecode()).getDescription()) + " " + persona.getName()); + datosmail.put("razons",(solicitud==null || solicitud.getModifiedData().get("nombre")==null)?"":solicitud.getModifiedData().get("nombre")); + datosmail.put("sol", solicitud==null?"":solicitud.getPk()); + datosmail.put("observaciones", bpmDataComment); + datosmail.put("centrocontrol",(centroControl==null || centroControl.getNombreinstitucion()==null || centroControl.getNombreinstitucioncodigo()==null)?"":CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + request.modifiedData().put("datosmail", datosmail); + }else{ + SimpleDateFormat sdf1 = new SimpleDateFormat(MsgGeneral.getProperty("dateformat")); + datosmail.put("funcionario",persona ==null?"":((persona.getMilitarygrade()==null)?"":CatalogDetailController.findxCodigoCodcatalogo(persona.getMilitarygrade(),"MILITARYGRADE").getDescription()) + " " + persona.getName()); + datosmail.put("razons",(solicitud==null || solicitud.getModifiedData().get("nombre")==null)?"":solicitud.getModifiedData().get("nombre")); + datosmail.put("tramite",solicitudTramite.getNumerotramite()); + datosmail.put("centrocontrol",(centroControl==null || centroControl.getNombreinstitucion()==null || centroControl.getNombreinstitucioncodigo()==null)?"":CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + datosmail.put("fechanotificacion",sdf1.format(new Date())); + + TarmTramite tramite =TarmTramiteController.find(String.valueOf(solicitud.getCtramite())); + datosmail.put("tipoTramite",(tramite==null || tramite.getModifiedData().get("tipotramite")==null)?"":tramite.getModifiedData().get("tipotramite")); + datosmail.put("tipoAutorizacion",(tramite==null || tramite.getModifiedData().get("tipoautorizacion")==null)?"":tramite.getModifiedData().get("tipoautorizacion")); + datosmail.put("usoactividad",(tramite==null || tramite.getModifiedData().get("usoactividad")==null)?"":tramite.getModifiedData().get("usoactividad")); + datosmail.put("categoria",(tramite==null || tramite.getModifiedData().get("categoria")==null)?"":tramite.getModifiedData().get("categoria")); + request.modifiedData().put("datosmail", datosmail); + } + + request.setSaveTables(msave); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + if(bpmDataStatus.equals("D")){ + saveAnularSolicitud(); + } + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void saveAnularSolicitud() { + try { + TarmTramite tarmTramite = null; + // CATEGORIA 14 PREVIA IMPORTACION + if(this.getLoginController().getRequest().getTransactionCode()==33){ + tarmTramite = TarmTramiteController.find(this.solicitud.getCtramite().toString()); + }else if(this.getLoginController().getRequest().getTransactionCode()==30){ + tarmTramite = TarmTramiteController.find(this.solicitudMP.getRecord().getCtramite().toString()); + } + if(tarmTramite!=null && tarmTramite.getCategoria().equals("14")){ + desasociarCargaSolicitud(); + } + //Poner la solicitud en estado anulado + solicitud.setEstado("ANU"); + solicitud.setAucp(null); + solicitudMP.setRecord(solicitud); + solicitudMP.update(); + DtoSave dtoSolicitud = solicitudMP.getDtoSave(); + + TarmSolicitudTramite solicitudTramiteObj = SolicitudTramiteController.findByCSolicitud(solicitud.getPk()); + if(solicitudTramiteObj!=null){ + solicitudTramiteObj.setIsnew(false); + solicitudTramiteObj.setEstadotramite("ANU"); + solicitudTramiteController.updateSolicitud(solicitudTramiteObj); + } + // DocumentoHabilitanteController documentoHabilitanteController + TarmDocumentoHabilitante documentoHabilitanteTmp = DocumentoHabilitanteController.findPorSolicitud(codigoSolicitud); + if(documentoHabilitanteTmp!=null){ + documentoHabilitanteTmp.setFechaexpiracion(new java.sql.Date(new java.util.Date().getTime())); + this.documentoHabilitanteController.setRecord(documentoHabilitanteTmp); + this.documentoHabilitanteController.save(); + } +// if(documentoHabilitanteTmp!=null){ +// TarmDocumentoHabilitanteDetall documentoHabilitanteDetTmp = DocumentoHabilitanteDetalleController.findPorCDocumento(documentoHabilitanteTmp.getPk().toString()); +// if(documentoHabilitanteDetTmp!=null){ +// this.documentoHabilitanteDetalleController.setRecord(documentoHabilitanteDetTmp); +// this.documentoHabilitanteDetalleController.remove(); +// this.documentoHabilitanteDetalleController.save(); +// } +// +// this.documentoHabilitanteController.setRecord(documentoHabilitanteTmp); +// this.documentoHabilitanteController.remove(); +// this.documentoHabilitanteController.save(); +// } + + //Desasociar las armas en apertura de agencias y apertura de sucursales + if(solicitud.getCtramite()==44 || solicitud.getCtramite()==48){ + List armasSolicitudList = RecepcionArmasController.findPorSolicitud(solicitud.getPk()); + for(TarmSolicitudArmas armaObj:armasSolicitudList){ + + // Codigo agencia de la solicitud + ListsolicitudAgenciaLst = SolicitudAgenciaSucursalController.findPorSolicitud(solicitud.getPk()); + for(TarmSolicitudAgenciaSucursal solicitudAgenciaSucursalObj:solicitudAgenciaLst){ + String cAgencia = solicitudAgenciaSucursalObj.getPk().getCagencia().toString(); + TarmAgenciaArma agenciaArmaObj = AgenciaArmaController.findByCArma(armaObj.getPk().getCarma(), cAgencia); + agenciaArma.setRecord(agenciaArmaObj); + agenciaArma.remove(); + } + } + } + + DtoSave dtoSolicitudTramite = solicitudTramiteController.getDtoSave(); + DtoSave dtoAgenciaArma = agenciaArma.getDtoSave(); + + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + msave.put(solicitudMP.getBeanalias(), dtoSolicitud); // adicionar metadata de mantenimiento para cada tabla. + msave.put(solicitudTramiteController.getBeanalias(), dtoSolicitudTramite); + msave.put(agenciaArma.getBeanalias(), dtoAgenciaArma); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + solicitudMP.postCommit(resp); + solicitudTramiteController.postCommit(resp); + agenciaArma.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void desasociarCargaSolicitud(){ + try{ + TarmCarga carga =null; + if(this.getLoginController().getRequest().getTransactionCode()==33){ + carga = CargaController.findByAUCP(this.solicitud.getAucp()); + }else if(this.getLoginController().getRequest().getTransactionCode()==30){ + carga = CargaController.findByAUCP(solicitudMP.getRecord().getAucp()); + } + if(carga!=null){ + carga.setCsolicitud(null); + cargaController.update(carga); + cargaController.save(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para completar la tarea + */ + public void completarTarea() { + + try { + + Map datosmail = new HashMap(); + Request request = callerhelper.getRequest(); + + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail persona = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + if (bpmDataStatus.equals("A")) { + guardarDocumentoHabilitante(); + request.modifiedData().put("BPMStatus",bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + } else { + request.modifiedData().put("BPMStatus",bpmDataStatus == null ? "D" : bpmDataStatus); // A,D,R + + anularTramite(); + datosmail.put("funcionario",persona ==null?"":((persona.getMilitarygrade()==null && persona.getMilitarygradecode()==null)?"":CatalogDetailController.findxCodigoCodcatalogo(persona.getMilitarygrade(),persona.getMilitarygradecode()).getDescription()) + " " + persona.getName()); + datosmail.put("razons",(solicitud==null || solicitud.getModifiedData().get("nombre")==null)?"":solicitud.getModifiedData().get("nombre")); + datosmail.put("sol", solicitud==null?"":solicitud.getPk()); + datosmail.put("centrocontrol",(centroControl==null || centroControl.getNombreinstitucion()==null || centroControl.getNombreinstitucioncodigo()==null)?"":CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + + } + + this.update(); + + HashMap msave = new HashMap(); + + request.modifiedData().put("datosmail", datosmail); + request.modifiedData().put("csolicitud", codigoSolicitud); + request.modifiedData().put("numerotransaccion", numeroTransaccion); + //request.modifiedData().put("xpath", "c"); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMObs", "Analizar documento habilitante"); + request.modifiedData().put("observacion", observacion); + + request.setSaveTables(msave); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + dtosave.setPosition(1); + msave.put(beanalias, dtosave); + + request.setSaveTables(msave); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + if(bpmDataStatus.equals("D")){ + saveAnularSolicitud(); + } + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute( + "Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + /** + * Metodo para anular el tramite + * @throws Exception + */ + private void anularTramite() throws Exception { + solicitudTramite=solicitudTramiteController.findByCSolicitud(codigoSolicitud); + solicitudTramiteController.setRecord(solicitudTramite); + solicitudTramiteController.getRecord().setEstadotramite("ANU"); + solicitudTramiteController.getRecord().setEstadotramitecodigo("ESTADOSOLICITUD"); + solicitudTramiteController.update(); + solicitudTramiteController.save(); + } + + + /** + * M\u00e9todo para encontrar por solicitud + * @param solicitudCode + * @return + */ + public static List findPorSolicitud(String solicitudCode) { + try { + RecepcionArmasController cc = new RecepcionArmasController(); + cc.init(); + cc.recperpage = 500; + cc.addFilter("pk.csolicitud", solicitudCode); + cc.querydatabaseValidacionTransito(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Método para encontrar un objeto de tipo TarmSolicitudArmas por código de solicitud + * @param solicitudCode + * @param cc + * @return lrecord de tipo TarmSolicitudArmas + */ + public static List findPorSolicitudTodas(String solicitudCode) { + try { +// this.codigoSolicitud = solicitudCode; + RecepcionArmasController cc = new RecepcionArmasController(); + cc.init(); + cc.recperpage = 10000; + cc.addFilter("pk.csolicitud", solicitudCode); + cc.querydatabaseSolicitudArmas(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + protected void querydatabaseSolicitudArmas() { + try { + this.lArmas.clear(); + this.lGuardias.clear(); + if (codigoSolicitud==null){ + return; + } + DtoQuery dto = this.getDtoQuery(); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public DtoQuery getDtoQuery() throws Exception{ + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.csolicitud"); + dto.setOrderby("t.pk.csolicitud"); + SubQuery subquerymodelo= new SubQuery("TarmArmas","modelo","modelo","i.pk=t.pk.carma"); + dto.addSubQuery(subquerymodelo); + SubQuery subqueryacrma= new SubQuery("TarmArmas","pk","carma","i.pk=t.pk.carma"); + dto.addSubQuery(subqueryacrma); + SubQuery subqueryserie= new SubQuery("TarmArmas","lote","lote","i.pk=t.pk.carma"); + dto.addSubQuery(subqueryserie); + SubQuery subqueryCantidad= new SubQuery("TarmArmas","cantidad","cantidad","i.pk=t.pk.carma"); + dto.addSubQuery(subqueryCantidad); + SubQuery subqueryPeso= new SubQuery("TarmArmas","peso","peso","i.pk=t.pk.carma"); + dto.addSubQuery(subqueryPeso); + SubQuery subqueryUnidadMedida= new SubQuery("TgeneCatalogDetail","description","unidadmedida","i.pk.catalog=(select p.unidadmedidacantidad from TarmArmas p where p.pk=t.pk.carma) and" + + " i.pk.catalogcode=(select p.unidadmedidacantidadcodigo from TarmArmas p where p.pk=t.pk.carma)"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog= (select o.marca from TarmArmas o where o.pk=t.pk.carma) " + + " and i.pk.catalogcode=(select o.marcacodigo from TarmArmas o where o.pk=t.pk.carma)"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=(select o.color from TarmArmas o where o.pk=t.pk.carma)" + + " and i.pk.catalogcode=(select o.colorcodigo from TarmArmas o where o.pk=t.pk.carma)"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=(select o.estado from TarmArmas o where o.pk=t.pk.carma)" + + " and i.pk.catalogcode=(select o.estadocodigo from TarmArmas o where o.pk=t.pk.carma)"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TgeneCatalogDetail","description","clase","i.pk.catalog=(select o.clase from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryLongitud= new SubQuery("TgeneCatalogDetail","description","longitud","i.pk.catalog=(select o.longitud from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.longitudcodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryCalibre= new SubQuery("TgeneCatalogDetail","description","calibre","i.pk.catalog=(select o.calibre from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.calibrecodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryTipoArma= new SubQuery("TgeneCatalogDetail","description","tipo","i.pk.catalog=(select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + dto.addSubQuery(subqueryTipoArma); + return dto; + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTareaReceptaArma() { + + try { + if (!validarSeleccion()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_validar_seleccion_armas")); + return; + } + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("csolicitud", codigoSolicitud); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + btnFlujo=Boolean.FALSE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public TcustPersonDetail getPersonaDetalle() { + return personaDetalle; + } + + + public void setPersonaDetalle(TcustPersonDetail personaDetalle) { + this.personaDetalle = personaDetalle; + } + + + public PersonAddressController getPersonAddressController() { + return personAddressController; + } + + + public void setPersonAddressController( + PersonAddressController personAddressController) { + this.personAddressController = personAddressController; + } + + + public SolicitudTramiteController getSolicitudTramiteController() { + return solicitudTramiteController; + } + + + public void setSolicitudTramiteController( + SolicitudTramiteController solicitudTramiteController) { + this.solicitudTramiteController = solicitudTramiteController; + } + + + + public String getProvincia() { + return provincia; + } + + + public void setProvincia(String provincia) { + this.provincia = provincia; + } + + + public String getCanton() { + return canton; + } + + + public void setCanton(String canton) { + this.canton = canton; + } + + + public String getCiudad() { + return ciudad; + } + + + public void setCiudad(String ciudad) { + this.ciudad = ciudad; + } + + + public List getlArmas() { + return lArmas; + } + + + public void setlArmas(List lArmas) { + this.lArmas = lArmas; + } + + + public TarmSolicitudTramite getSolicitudTramite() { + return solicitudTramite; + } + + + public void setSolicitudTramite(TarmSolicitudTramite solicitudTramite) { + this.solicitudTramite = solicitudTramite; + } + + + public TarmTramite getTramite() { + return tramite; + } + + + public void setTramite(TarmTramite tramite) { + this.tramite = tramite; + } + + + public TgeneCatalogDetail getEstadotramite() { + return estadotramite; + } + + + public void setEstadotramite(TgeneCatalogDetail estadotramite) { + this.estadotramite = estadotramite; + } + + + public TgeneCatalogDetail getDetallecatalogo() { + return detallecatalogo; + } + + public boolean isControlPantallaEntregado() { + return controlPantallaEntregado; + } + + + public void setControlPantallaEntregado(boolean controlPantallaEntregado) { + this.controlPantallaEntregado = controlPantallaEntregado; + } + + + public boolean isControlPantallaVisualizarTramiteFirmar() { + return controlPantallaVisualizarTramiteFirmar; + } + + + public void setControlPantallaVisualizarTramiteFirmar( + boolean controlPantallaVisualizarTramiteFirmar) { + this.controlPantallaVisualizarTramiteFirmar = controlPantallaVisualizarTramiteFirmar; + } + + + public boolean isControlPantallaVerificarInformacionDevolucion() { + return controlPantallaVerificarInformacionDevolucion; + } + + + public void setControlPantallaVerificarInformacionDevolucion( + boolean controlPantallaVerificarInformacionDevolucion) { + this.controlPantallaVerificarInformacionDevolucion = controlPantallaVerificarInformacionDevolucion; + } + + + public TgeneCatalogDetail getDetallecatalogoTipoTramite() { + return detallecatalogoTipoTramite; + } + + + public void setDetallecatalogoTipoTramite( + TgeneCatalogDetail detallecatalogoTipoTramite) { + this.detallecatalogoTipoTramite = detallecatalogoTipoTramite; + } + + + public void setDetallecatalogo(TgeneCatalogDetail detallecatalogo) { + this.detallecatalogo = detallecatalogo; + } + + + public TgeneCatalogDetail getUsoActividad() { + return usoActividad; + } + + + public void setUsoActividad(TgeneCatalogDetail usoActividad) { + this.usoActividad = usoActividad; + } + + + public TgeneCatalogDetail getIdentificacion() { + return identificacion; + } + + + public void setIdentificacion(TgeneCatalogDetail identificacion) { + this.identificacion = identificacion; + } + + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + + public TarmTipoArmaExplosivo getTipoArmaExplosivo() { + return tipoArmaExplosivo; + } + + + public void setTipoArmaExplosivo(TarmTipoArmaExplosivo tipoArmaExplosivo) { + this.tipoArmaExplosivo = tipoArmaExplosivo; + } + + + public String getCodigoSolicitud() { + return codigoSolicitud; + } + + + public void setCodigoSolicitud(String codigoSolicitud) { + this.codigoSolicitud = codigoSolicitud; + } + + + + + public SolicitudGuardiasController getSolicitudGuardiasController() { + return solicitudGuardiasController; + } + + + public void setSolicitudGuardiasController( + SolicitudGuardiasController solicitudGuardiasController) { + this.solicitudGuardiasController = solicitudGuardiasController; + } + + + + public DocumentoHabilitanteController getDocumentoHabilitanteController() { + return documentoHabilitanteController; + } + + + public void setDocumentoHabilitanteController( + DocumentoHabilitanteController documentoHabilitanteController) { + this.documentoHabilitanteController = documentoHabilitanteController; + } + + + public ArmasController getArmasController() { + return armasController; + } + + + public void setArmasController(ArmasController armasController) { + this.armasController = armasController; + } + + + + public List getlSolicitudGuardias() { + return lSolicitudGuardias; + } + + + public List getLaccion() { + return laccion; + } + + + public void setLaccion(List laccion) { + this.laccion = laccion; + } + + + public void setlSolicitudGuardias(List lSolicitudGuardias) { + this.lSolicitudGuardias = lSolicitudGuardias; + } + + + public List getlGuardias() { + return lGuardias; + } + + + public void setlGuardias(List lGuardias) { + this.lGuardias = lGuardias; + } + + + public String getObservacion() { + return observacion; + } + + + public void setObservacion(String observacion) { + this.observacion = observacion; + } + + + public String getEstado() { + return estado; + } + + + public void setEstado(String estado) { + this.estado = estado; + } + + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + + public DocumentoHabilitanteDetalleController getDocumentoHabilitanteDetalleController() { + return documentoHabilitanteDetalleController; + } + + + public void setDocumentoHabilitanteDetalleController( + DocumentoHabilitanteDetalleController documentoHabilitanteDetalleController) { + this.documentoHabilitanteDetalleController = documentoHabilitanteDetalleController; + } + + + public Boolean getBtnFlujo() { + return btnFlujo; + } + + + public void setBtnFlujo(Boolean btnFlujo) { + this.btnFlujo = btnFlujo; + } + + public String getDireccion() { + return direccion; + } + + + public void setDireccion(String direccion) { + this.direccion = direccion; + } + + public SolicitudController getSolicitudController() { + return solicitudController; + } + + + public void setSolicitudController(SolicitudController solicitudController) { + this.solicitudController = solicitudController; + } + + + public ReportController getReportController() { + return reportController; + } + + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + + public ColaImpresionController getColaImpresionController() { + return colaImpresionController; + } + + + public void setColaImpresionController( + ColaImpresionController colaImpresionController) { + this.colaImpresionController = colaImpresionController; + } + + + public Boolean getBtnGrabar() { + return btnGrabar; + } + + + public void setBtnGrabar(Boolean btnGrabar) { + this.btnGrabar = btnGrabar; + } + + + public List getSolAgenciaSucursals() { + return solAgenciaSucursals; + } + + + public void setSolAgenciaSucursals( + List solAgenciaSucursals) { + this.solAgenciaSucursals = solAgenciaSucursals; + } + + + public List getDocumentosList() { + return documentosList; + } + + + public void setDocumentosList(List documentosList) { + this.documentosList = documentosList; + } + + + public AgenciaArmaController getAgenciaArma() { + return agenciaArma; + } + + + public void setAgenciaArma(AgenciaArmaController agenciaArma) { + this.agenciaArma = agenciaArma; + } + + + public SolicitudArmasController getSolicitudMP() { + return solicitudMP; + } + + + public void setSolicitudMP(SolicitudArmasController solicitudMP) { + this.solicitudMP = solicitudMP; + } + + + public CargaController getCargaController() { + return cargaController; + } + + + public void setCargaController(CargaController cargaController) { + this.cargaController = cargaController; + } + + public Boolean getRequiereNoSolAucpBln() { + return requiereNoSolAucpBln; + } + + public void setRequiereNoSolAucpBln(Boolean requiereNoSolAucpBln) { + this.requiereNoSolAucpBln = requiereNoSolAucpBln; + } + + public String getNombreInstitucion() { + return nombreInstitucion; + } + + public String setNombreInstitucion(String nombreInstitucion) { + if(nombreInstitucion!=null && !nombreInstitucion.isEmpty()){ + this.nombreInstitucion = nombreInstitucion; + }else{ + this.nombreInstitucion = ""; + } + + return nombreInstitucion; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RecepcionArmasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RecepcionArmasController.java.svn-base new file mode 100644 index 0000000..c4eb9c7 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RecepcionArmasController.java.svn-base @@ -0,0 +1,1919 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.CargaController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.inte.TarmColadeImpresion; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmAgenciaArma; +import com.fp.persistence.parmas.soli.TarmArmaPruebas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.parmas.soli.TarmSolicitudGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + + +/** + * Controlador principal que maneja la entidad TarmSolicitudArmas + * @author Carlos Guzman + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RecepcionArmasController extends AbstractController { + + private TcustPersonDetail personaDetalle; + private String provincia; + private String canton; + private String ciudad; + private String direccion; + private List lArmas = new ArrayList(); + private List lSolicitudGuardias = new ArrayList(); + private List lGuardias = new ArrayList(); + private TgeneCatalogDetail detallecatalogo = new TgeneCatalogDetail(); + private TgeneCatalogDetail detallecatalogoTipoTramite = new TgeneCatalogDetail(); + private TgeneCatalogDetail usoActividad = new TgeneCatalogDetail(); + private TgeneCatalogDetail tipoAutorizacion = new TgeneCatalogDetail(); + private TgeneCatalogDetail categoria = new TgeneCatalogDetail(); + private TgeneCatalogDetail identificacion = new TgeneCatalogDetail(); + private TgeneCatalogDetail estadotramite = new TgeneCatalogDetail(); + private TgeneCatalogDetail tipoArchivo = new TgeneCatalogDetail(); + private TgeneCatalogDetail tipoCosto = new TgeneCatalogDetail(); + private TgeneCatalogDetail vigencia = new TgeneCatalogDetail(); + private TarmSolicitudTramite solicitudTramite=new TarmSolicitudTramite(); + private TsafeUserDetail tsafeUserDetailUsuario = null; + private TarmTramite tramite=new TarmTramite(); + private TarmSolicitud solicitud = new TarmSolicitud(); + private TarmTipoArmaExplosivo tipoArmaExplosivo = new TarmTipoArmaExplosivo(); + private boolean controlPantallaEntregado; + private boolean controlPantallaVisualizarTramiteFirmar; + private boolean controlPantallaVerificarInformacionDevolucion; + private String codigoSolicitud = ""; + private String observacion; + private String estado; + private Date fec_actual; + private String xpathflujo; + private TcustPersonDetail responsableCentroControl= null; + private TsafeUserDetail usuario; + private Boolean btnFlujo; + private Boolean btnGrabar; + /** + * lista del catalogo de las acciones (Aceptar o rechazar) + */ + private List laccion; + + private TarmCentroControl centroControl = new TarmCentroControl(); + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddressController; + + @ManagedProperty(value = "#{solicitudGuardiasController}") + private SolicitudGuardiasController solicitudGuardiasController; + + @ManagedProperty(value = "#{armasController}") + private ArmasController armasController; + + @ManagedProperty(value = "#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitanteController; + + @ManagedProperty(value = "#{colaImpresionController}") + private ColaImpresionController colaImpresionController; + + @ManagedProperty(value = "#{documentoHabilitanteDetalleController}") + private DocumentoHabilitanteDetalleController documentoHabilitanteDetalleController; + + @ManagedProperty(value="#{solicitudTramiteController}") + private SolicitudTramiteController solicitudTramiteController; + + @ManagedProperty(value="#{solicitudController}") + private SolicitudController solicitudController; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * Controlador que maneja cargas para previa importacion + */ + @ManagedProperty(value = "#{cargaController}") + private CargaController cargaController; + + /** + * controlador de la solicitud + */ + @ManagedProperty(value = "#{solicitudArmasController}") + private SolicitudArmasController solicitudMP; + + /** + * Controlador que maneja las armas asociadas a las agencias + */ + @ManagedProperty(value="#{agenciaArmaController}") + private AgenciaArmaController agenciaArma; + + + private String numeroTransaccion=""; + + private List solAgenciaSucursals; + + private List documentosList; + + private Boolean requiereNoSolAucpBln; + + /** + *Nombre de la Institucion + */ + private String nombreInstitucion; + + public RecepcionArmasController() throws Exception { + super(TarmSolicitudArmas.class); + } + + + @PostConstruct + private void postconstruct() throws Exception { + startQuery(); + this.init(); + querydatabase(); + + solicitudController= new SolicitudController(); + + Boolean aprobarFichaBLN = Boolean.FALSE; + + laccion = new ArrayList(); + + // Validamos en el caso de permisos + TarmTramite tramite = TarmTramiteController.find(numeroTransaccion); + TgeneCatalogDetail tipoAutorizacion = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + + if(tipoAutorizacion!=null && tipoAutorizacion.getDescription().equalsIgnoreCase("PERMISO")){ + ListarmaPruebaList = IngresoFichaTecnicaArmasController.buscarFichasPorSolicitud(codigoSolicitud); + for(TarmArmaPruebas armaPruebaObj:armaPruebaList){ + if(armaPruebaObj.getApruebaevaluacion().equalsIgnoreCase("Y")){ + aprobarFichaBLN = Boolean.TRUE; + break; + } + } + if(aprobarFichaBLN){ + laccion=CatalogDetailController.find("ACCION"); + } + else{ + TgeneCatalogDetail catalogRechazar = CatalogDetailController.findCatalogo("ACCION","RECH"); + laccion.add(catalogRechazar); + } + } + else{ + laccion=CatalogDetailController.find("ACCION"); + } + + + try { + //consulta de agencias + cargarAgencias(); + //consulta de documentos + cargarDocumentos(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Método en el cual se cargan las agencias que corresponden a la solicitud + * @throws Exception + */ + private void cargarAgencias() throws Exception{ + if(codigoSolicitud!=null){ + solAgenciaSucursals=SolicitudAgenciaSucursalController.findPorSolicitud(codigoSolicitud); + } + } + + /** + * Método en el cual se cargan las agencias que corresponden a la solicitud + * @throws Exception + */ + private void cargarDocumentos() throws Exception{ + if(codigoSolicitud!=null){ + documentosList=TarmSolicitudDocumentoController.findPorSolicitud(codigoSolicitud);//documentoHabilitanteController.lrecord + } + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + //xpathflujo=super.getMfilters().get("xpath");//"cm:Decomiso/cm:A-2014/cm:M-10/cm:ENV-000000319/cm:ENV-000000319.pdf";// + numeroTransaccion=super.getMfilters().get("numerotransaccion"); + codigoSolicitud=super.getMfilters().get("csolicitud"); + System.out.println("numeroTransaccion .."+numeroTransaccion); + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + private void init() { + try { + validarpantallaActual(); + recperpage = 500; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "RECEPCIONARMAS"; + this.responsableCentroControl = new TcustPersonDetail(); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + usuario=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + this.fec_actual = new Date(); + btnFlujo=Boolean.FALSE; + btnGrabar=Boolean.TRUE; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + this.lArmas.clear(); + this.lGuardias.clear(); + if (codigoSolicitud==null){ + return; + } + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.csolicitud"); + + SubQuery subquerymodelo= new SubQuery("TarmArmas","modelo","modelo","i.pk=t.pk.carma"); + dto.addSubQuery(subquerymodelo); + SubQuery subqueryacrma= new SubQuery("TarmArmas","pk","carma","i.pk=t.pk.carma"); + dto.addSubQuery(subqueryacrma); + + SubQuery subqueryserie= new SubQuery("TarmArmas","lote","lote","i.pk=t.pk.carma"); + dto.addSubQuery(subqueryserie); + + SubQuery subqueryCantidad= new SubQuery("TarmArmas","cantidad","cantidad","i.pk=t.pk.carma"); + dto.addSubQuery(subqueryCantidad); + + SubQuery subqueryPeso= new SubQuery("TarmArmas","peso","peso","i.pk=t.pk.carma"); + dto.addSubQuery(subqueryPeso); + + SubQuery subqueryUnidadMedida= new SubQuery("TgeneCatalogDetail","description","unidadmedida","i.pk.catalog=(select p.unidadmedidacantidad from TarmArmas p where p.pk=t.pk.carma) and" + + " i.pk.catalogcode=(select p.unidadmedidacantidadcodigo from TarmArmas p where p.pk=t.pk.carma)"); + dto.addSubQuery(subqueryUnidadMedida); + + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog= (select o.marca from TarmArmas o where o.pk=t.pk.carma) " + + " and i.pk.catalogcode=(select o.marcacodigo from TarmArmas o where o.pk=t.pk.carma)"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=(select o.color from TarmArmas o where o.pk=t.pk.carma)" + + " and i.pk.catalogcode=(select o.colorcodigo from TarmArmas o where o.pk=t.pk.carma)"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=(select o.estado from TarmArmas o where o.pk=t.pk.carma)" + + " and i.pk.catalogcode=(select o.estadocodigo from TarmArmas o where o.pk=t.pk.carma)"); + dto.addSubQuery(subqueryEstado); + + SubQuery subqueryClase= new SubQuery("TgeneCatalogDetail","description","clase","i.pk.catalog=(select o.clase from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + dto.addSubQuery(subqueryClase); + + SubQuery subqueryLongitud= new SubQuery("TgeneCatalogDetail","description","longitud","i.pk.catalog=(select o.longitud from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.longitudcodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + dto.addSubQuery(subqueryLongitud); + + SubQuery subqueryCalibre= new SubQuery("TgeneCatalogDetail","description","calibre","i.pk.catalog=(select o.calibre from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.calibrecodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + dto.addSubQuery(subqueryCalibre); + + SubQuery subqueryTipoArma= new SubQuery("TgeneCatalogDetail","description","tipo","i.pk.catalog=(select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + + dto.addSubQuery(subqueryTipoArma); + + + Filter filtro = new Filter(); + filtro.setField("pk.csolicitud"); + filtro.setValue(codigoSolicitud); + dto.addFiltro(filtro); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + solicitudGuardiasController.addFilter("pk.csolicitud", codigoSolicitud); + solicitudGuardiasController.findPorSolicitud(codigoSolicitud); + solicitudGuardiasController.query(); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(beanalias); + if ((this.lrecord != null) && !this.lrecord.isEmpty()) { + } + + super.postQuery(this.lrecord); + } + + solicitud = SolicitudArmasController.find(codigoSolicitud); + + if (solicitud!=null){ + personaDetalle = PersonDetailController.find(String.valueOf(solicitud.getPersoncode())); + identificacion = (personaDetalle.getIdentificationcatalog()==null || personaDetalle.getIdentificationcatalogcode()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(personaDetalle.getIdentificationcatalog(), personaDetalle.getIdentificationcatalogcode()); + + if(identificacion!=null){ + //personAddressController.findPersonaPorDireccionTipoCatalogo(String.valueOf(solicitud.getPersoncode()), tipoDireccion); + TcustPersonAddress direccionCliente=personAddressController.findPrincipal(String.valueOf(solicitud.getPersoncode())) ; + provincia = direccionCliente.modifiedData().get("provincia")==null?null: direccionCliente.modifiedData().get("provincia").toString(); //personAddressController.getLprovinces()==null || .getLprovinces().isEmpty()?null:personAddressController.getLprovinces().get(0); + canton = direccionCliente.modifiedData().get("canton")==null?null: direccionCliente.modifiedData().get("canton").toString();//personAddressController.getLcantones()==null || personAddressController.getLcantones().isEmpty()?null:personAddressController.getLcantones().get(0); + ciudad = direccionCliente.modifiedData().get("ciudad")==null?null: direccionCliente.modifiedData().get("ciudad").toString();//personAddressController.getLcities()==null || personAddressController.getLcities().isEmpty()?null:personAddressController.getLcities().get(0); + direccion= direccionCliente.getAddress(); + } + + } + + //Proceso de tramite + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(codigoSolicitud); + if(solicitudTramite!=null && solicitudTramite.getPk().getCtramite()!=null){ + tramite=TarmTramiteController.find(solicitudTramite.getPk().getCtramite().toString()); + estadotramite = (solicitudTramite.getEstadotramite()==null || solicitudTramite.getEstadotramitecodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(solicitudTramite.getEstadotramite(), solicitudTramite.getEstadotramitecodigo()); + } + + if(tramite!=null && tramite.getPk() != null){ + detallecatalogo = (tramite.getCategoria()==null || tramite.getCategoriacodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + detallecatalogoTipoTramite = (tramite.getTipoautorizacion()==null || tramite.getTipoautorizacioncodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + vigencia = CatalogDetailController.findxCodigoCodcatalogo( tramite.getVigencia(), tramite.getVigenciacodigo()); + tipoArchivo = CatalogDetailController.findxCodigoCodcatalogo( tramite.getTipoarchivo(), tramite.getTipoarchivocodigo()); + tipoCosto = CatalogDetailController.findxCodigoCodcatalogo( tramite.getTipocosto(), tramite.getTipocostocodigo()); + usoActividad = (tramite.getUsoactividad()==null || tramite.getUsoactividadcodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + tipoAutorizacion = (tramite.getTipoautorizacion()==null || tramite.getTipoautorizacioncodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + categoria = (tramite.getCategoria()==null || tramite.getCategoriacodigo()==null)?null:CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + // CATEGORIA 14 PREVIA IMPORTACION + if(tramite!=null && tramite.getCategoria().equals("14")){ + requiereNoSolAucpBln=Boolean.TRUE; + nombreInstitucion = obtenerCentroControl(); + }else{ + requiereNoSolAucpBln=Boolean.FALSE; + } + } + + armasController.setRecperpage(500); + + //lArmas = armasController.findArmaRecep(lrecord.get(0).getPk().getCsolicitud()); + for(TarmSolicitudArmas solicitudArmas:lrecord){ + TarmArmas armas = new TarmArmas(); + armas = armasController.find(solicitudArmas.getPk().getCarma(),null); + lArmas.add(armas); + } + armasController.setLrecord(lArmas); + actualizarArmas(); + List listaCentroControl=null; + if(solicitud!=null && solicitud.getCcentrocontrol()!=null){ + listaCentroControl= CentroControlArmasController.find(solicitud.getCcentrocontrol()); + } + + if(listaCentroControl!=null && !listaCentroControl.isEmpty() ){//&& listaCentroControl.get(0).getTramitespordia()!=null){ + centroControl = listaCentroControl.get(0); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que usa para pasar el flujo al seleccionar el boton guardar + */ + public void guardar(){ + + } + + private void guardarcolaImpresionController(HashMap msave) throws Throwable{ + System.out.println("ACTUALIZA COLA DE IMPRESION"); + TarmDocumentoHabilitante docHabilitante=DocumentoHabilitanteController.findPorSolicitud(codigoSolicitud); + if(docHabilitante!=null && docHabilitante.getPk()!=null){ + System.out.println("ACTUALIZA COLA DE IMPRESION 1"); + ListlistaColaImprecion=ColaImpresionController.findByDocumentoCDoc(docHabilitante.getPk().toString()); + if(listaColaImprecion!=null && listaColaImprecion.size()>0){ + System.out.println("ACTUALIZA COLA DE IMPRESION 2"); + for (TarmColadeImpresion item : listaColaImprecion) { + item.setEstadoimpresion("PIMPR"); + item.setEstadoimpresioncode("ESTADOIMPRESION"); + colaImpresionController.update(item); + } + System.out.println("ACTUALIZA COLA DE IMPRESION 3"); + registrarGuardadoColaImpresion(msave); + System.out.println("ACTUALIZA COLA DE IMPRESION 4"); + } + } + + } + + private void registrarGuardadoColaImpresion(HashMap msave) throws Throwable{ + //= new HashMap(); + Request request = callerhelper.getRequest(); + DtoSave dtosaveColaImpresion = this.colaImpresionController.getDtoSave(true); + dtosaveColaImpresion.setReturnpk(true); + dtosaveColaImpresion.setPosition(1); + msave.put(colaImpresionController.getBeanalias(), dtosaveColaImpresion); + request.setSaveTables(msave); +// Response resp = callerhelper.executeSave(request); +// if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { +// this.colaImpresionController.postCommit(resp); +// this.postCommit(resp); +// MessageHelper.setMessageInfo(resp); +// } else { +// MessageHelper.setMessageError(resp); +// throw new Exception(""+resp); +// } + } + + /** + * Metodo para guardar los documentos habilitantes + * @throws Throwable + */ + public void guardarDocumentoHabilitante() throws Throwable{ + HashMap msave = new HashMap(); + Calendar cal = Calendar.getInstance(); + String estado="APR"; + System.out.println("vigencia.getDescription() "+vigencia.getDescription()); + System.out.println("vigencia.getDescription().trim().equals(1200) "+vigencia.getDescription().trim().equals("1200")); + if(vigencia.getDescription()!=null && vigencia.getDescription().trim().equals("1200")){ + cal.set(Calendar.YEAR, 2999); + cal.set(Calendar.MONTH, 12); + cal.set(Calendar.DAY_OF_MONTH, 31); + }else{ + cal.add(Calendar.MONTH, Integer.valueOf(vigencia.getDescription())); + } + System.out.println(cal); + System.out.println(cal.getTime()); + TarmSolicitudTramite solicitudtramite =TarmSolicitudTramiteController.findPorCSolicitud(codigoSolicitud); + if("CARNET".equalsIgnoreCase(tipoArchivo.getDescription())){ + if("TOTAL".equalsIgnoreCase(tipoCosto.getDescription())){ + documentoHabilitanteController.create(); + documentoHabilitanteController.getRecord().setIsnew(true); + documentoHabilitanteController.getRecord().setCsolicitud(codigoSolicitud); + documentoHabilitanteController.getRecord().setCentrocontrol(centroControl.getPk()); + documentoHabilitanteController.getRecord().setCarma(null); + documentoHabilitanteController.getRecord().setCuentareimpresion(0); + documentoHabilitanteController.getRecord().setCtramite(solicitudtramite.getPk().getCtramite()); + documentoHabilitanteController.getRecord().setFechaemision(new java.sql.Date((new Date()).getTime())); + documentoHabilitanteController.getRecord().setFechaexpiracion(new java.sql.Date((cal.getTime()).getTime())); + documentoHabilitanteController.getRecord().setPersoncode(solicitud.getPersoncode()); + documentoHabilitanteController.getRecord().setEstado(estado); + documentoHabilitanteController.getRecord().setEstadocode("ESTADODOCUMENTO"); + documentoHabilitanteController.update(); + + //Grabacion en la cola de impresion + colaImpresionController.create(); + colaImpresionController.getRecord().setIsnew(true); + //colaImpresionController.getRecord().setEstadoimpresion("PIMPR"); + //colaImpresionController.getRecord().setEstadoimpresioncode("ESTADOIMPRESION"); + java.util.Date date = new java.util.Date(); + colaImpresionController.getRecord().setFecharegistro(new java.sql.Date(date.getTime())); + colaImpresionController.update(); + + } + if("TOTAL".equalsIgnoreCase(tipoCosto.getDescription()) && (this.lrecord==null || this.lrecord.isEmpty())){ + registrarGuardadoDocumentoHabilitante(msave); + } + + for(TarmSolicitudArmas armaSolicitud:this.lrecord){ + + if("PARCIAL".equalsIgnoreCase(tipoCosto.getDescription())){ + documentoHabilitanteController.create(); + documentoHabilitanteController.getRecord().setIsnew(true); + documentoHabilitanteController.getRecord().setCsolicitud(codigoSolicitud); + documentoHabilitanteController.getRecord().setCentrocontrol(centroControl.getPk()); + documentoHabilitanteController.getRecord().setCarma(armaSolicitud.getPk().getCarma()); + documentoHabilitanteController.getRecord().setCodigoarma(ArmasController.findPorCodigo(armaSolicitud.getPk().getCarma()).getCodigoarma()); + documentoHabilitanteController.getRecord().setCuentareimpresion(0); + documentoHabilitanteController.getRecord().setCtramite(solicitudtramite.getPk().getCtramite()); + documentoHabilitanteController.getRecord().setFechaemision(new java.sql.Date((new Date()).getTime())); + documentoHabilitanteController.getRecord().setFechaexpiracion(new java.sql.Date((cal.getTime()).getTime())); + documentoHabilitanteController.getRecord().setPersoncode(solicitud.getPersoncode()); + documentoHabilitanteController.getRecord().setEstado(estado); + documentoHabilitanteController.getRecord().setEstadocode("ESTADODOCUMENTO"); + documentoHabilitanteController.update(); + + //Grabacion en la cola de impresion + colaImpresionController.create(); + colaImpresionController.getRecord().setIsnew(true); + //colaImpresionController.getRecord().setEstadoimpresion("PIMPR"); + //colaImpresionController.getRecord().setEstadoimpresioncode("ESTADOIMPRESION"); + java.util.Date date = new java.util.Date(); + colaImpresionController.getRecord().setFecharegistro(new java.sql.Date(date.getTime())); + colaImpresionController.update(); + } + documentoHabilitanteDetalleController.create(); + documentoHabilitanteDetalleController.getRecord().setIsnew(true); + documentoHabilitanteDetalleController.getRecord().setCarma(armaSolicitud.getPk().getCarma()); + documentoHabilitanteDetalleController.getRecord().setCodigoarma(ArmasController.findPorCodigo(armaSolicitud.getPk().getCarma()).getCodigoarma()); + documentoHabilitanteDetalleController.update(); + if("PARCIAL".equalsIgnoreCase(tipoCosto.getDescription())){ + registrarGuardadoDocumentoHabilitante(msave); + } + } + + if("TOTAL".equalsIgnoreCase(tipoCosto.getDescription()) && (this.lrecord!=null && !this.lrecord.isEmpty())){ + registrarGuardadoDocumentoHabilitante(msave); + return; + } + + }else + if("REPORTE".equalsIgnoreCase(tipoArchivo.getDescription())){ + documentoHabilitanteController.create(); + //TarmSolicitudTramite solicitudtramite =TarmSolicitudTramiteController.findPorCSolicitud(codigoSolicitud); + documentoHabilitanteController.getRecord().setIsnew(true); + documentoHabilitanteController.getRecord().setCsolicitud(codigoSolicitud); + documentoHabilitanteController.getRecord().setCentrocontrol(centroControl.getPk()); + documentoHabilitanteController.getRecord().setCuentareimpresion(0); + documentoHabilitanteController.getRecord().setCtramite(solicitudtramite.getPk().getCtramite()); + documentoHabilitanteController.getRecord().setCarma((this.lrecord!=null &&!this.lrecord.isEmpty() && this.lrecord.size()>0)? this.lrecord.get(0).getPk().getCarma():null); + documentoHabilitanteController.getRecord().setFechaemision(new java.sql.Date((new Date()).getTime())); + documentoHabilitanteController.getRecord().setFechaexpiracion(new java.sql.Date((cal.getTime()).getTime())); + documentoHabilitanteController.getRecord().setPersoncode(solicitud.getPersoncode()); + documentoHabilitanteController.getRecord().setEstado(estado); + documentoHabilitanteController.getRecord().setEstadocode("ESTADODOCUMENTO"); + documentoHabilitanteController.update(); + + for(TarmSolicitudArmas armaSolicitud:this.lrecord){ + documentoHabilitanteDetalleController.create(); + documentoHabilitanteDetalleController.getRecord().setIsnew(true); + documentoHabilitanteDetalleController.getRecord().setCarma(armaSolicitud.getPk().getCarma()); + documentoHabilitanteDetalleController.getRecord().setCodigoarma(ArmasController.findPorCodigo(armaSolicitud.getPk().getCarma()).getCodigoarma()); + documentoHabilitanteDetalleController.update(); + } + + registrarGuardadoDocumentoHabilitante(msave); + }else{ + throw new Exception("TIPO DOCUMENTO DE INVALIDO: "+tipoArchivo.getDescription()); + } + } + + /** Metodo para realizar el guardado del documento habilitante + * @param msave variable save + * @throws Throwable + */ + private void registrarGuardadoDocumentoHabilitante(HashMap msave) throws Throwable{ + Request request = callerhelper.getRequest(); + + DtoSave dtosaveDocumento = this.documentoHabilitanteController.getDtoSave(true); + dtosaveDocumento.setReturnpk(true); + dtosaveDocumento.setPosition(1); + DtoSave dtosaveDocumentoDetalle = this.documentoHabilitanteDetalleController.getDtoSave(true); + dtosaveDocumentoDetalle.setReturnpk(true); + dtosaveDocumentoDetalle.setPosition(2); + DtoSave dtosaveColaImpresion = this.colaImpresionController.getDtoSave(true); + dtosaveColaImpresion.setReturnpk(true); + dtosaveColaImpresion.setPosition(3); + + msave.put(documentoHabilitanteController.getBeanalias(), dtosaveDocumento); + msave.put(documentoHabilitanteDetalleController.getBeanalias(), dtosaveDocumentoDetalle); + msave.put(colaImpresionController.getBeanalias(), dtosaveColaImpresion); + + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.documentoHabilitanteController.postCommit(resp); + this.documentoHabilitanteDetalleController.postCommit(resp); + this.colaImpresionController.postCommit(resp); + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + throw new Exception(""+resp); + } + } + + + + /** + * Metodo que valida cual es la pantalla que se encuentra activa este controlador + */ + private void validarpantallaActual(){ + if(this.getLoginController()!=null && 24 == this.getLoginController().getRequest().getTransactionCode() && "30".equals(getLoginController().getRequest().getTransactionModule())){ + controlPantallaEntregado=true; + } + else{ + controlPantallaEntregado=false; + } + + if(this.getLoginController()!=null && 34 == this.getLoginController().getRequest().getTransactionCode() && "30".equals(getLoginController().getRequest().getTransactionModule())){ + controlPantallaVisualizarTramiteFirmar = true; + } + else{ + controlPantallaVisualizarTramiteFirmar = false; + } + + if(this.getLoginController()!=null && 33 == this.getLoginController().getRequest().getTransactionCode() && "30".equals(getLoginController().getRequest().getTransactionModule())){ + controlPantallaVerificarInformacionDevolucion = true; + } + else{ + controlPantallaVerificarInformacionDevolucion = false; + } + } + + @Override + public void query() throws Exception { + MessageHelper.setMessageError("msg_notQuery"); + super.query(); + } + @Override + public void next() throws Exception { + // TODO Auto-generated method stub + super.next(); + } + + + /** + * Metodo para enviar el documento habilitante por el flujo + */ + public void enviarDocumentoHabilitante(){ + + + } + + @Override + public void save() { + try { + if (!validarSeleccion()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_validar_seleccion_armas")); + return; + } + + actualizarArmas(); + actualizarSolicitudArmas(); + + TarmSolicitud sol = this.solicitudController.findSolicitudxcodsolicitud(this.codigoSolicitud); + String ruta = this.getRutaDocumento()+"/cm:actaEntregaRecepcionArmas.pdf"; + System.out.println("ruta : " + ruta); + sol.setXpathacta(ruta); + this.solicitudController.updateSolicitud(sol); + + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + btnFlujo=Boolean.TRUE; + btnGrabar=Boolean.FALSE; + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Metodo que guarda el documento + */ + public void saveDocumentoHabilitante() { + + try { + // validamos si cargamos los datos cuando apruebe + Map datosmail = new HashMap(); + Request request = callerhelper.getRequest(); + + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail persona = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + + if (codigoAceptado().equals(estado)) { + request.modifiedData().put("BPMStatus", + bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + } else { + request.modifiedData().put("BPMStatus", + bpmDataStatus == null ? "D" : bpmDataStatus); // A,D,R + datosmail.put("funcionario",persona ==null?"":((persona.getMilitarygrade()==null && persona.getMilitarygradecode()==null)?"":CatalogDetailController.findxCodigoCodcatalogo(persona.getMilitarygrade(),persona.getMilitarygradecode()).getDescription()) + " " + persona.getName()); + datosmail.put("razons",(solicitud==null || solicitud.getModifiedData().get("nombre")==null)?"":solicitud.getModifiedData().get("nombre")); + datosmail.put("sol", solicitud==null?"":solicitud.getPk()); + datosmail.put("centrocontrol",(centroControl==null || centroControl.getNombreinstitucion()==null || centroControl.getNombreinstitucioncodigo()==null)?"":CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + + } + + this.update(); + + HashMap msave = new HashMap(); + + request.modifiedData().put("datosmail", datosmail); + request.modifiedData().put("csolicitud", codigoSolicitud); + //request.modifiedData().put("numerotramite", "32"); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMObs", "Analizar documento habilitante"); + request.modifiedData().put("observacion", observacion); + + + request.setSaveTables(msave); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + dtosave.setPosition(1); + msave.put(beanalias, dtosave); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute( + "Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + + } + + /** + * M\u00e9todo que valida si todas las armas se encuentran seleccionadas + * @return + */ + public boolean validarSeleccion(){ + for(TarmSolicitudArmas armaSeleccionada:lrecord){ + if(!armaSeleccionada.modifiedData().containsValue(Boolean.TRUE)){ + return false; + } + } + return true; + } + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if(tcustPersonAddres == null){ + return null; + } + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl(){ + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + /** + * Metodo para armar la ruta del documento + * @return + */ + public String getRutaDocumento() { + Calendar calendar = Calendar.getInstance(); + StringBuilder ruta = new StringBuilder("cm:Solicitudes"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append( + (calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + ruta = ruta.append("/cm:D-").append( + (calendar.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (calendar.get(Calendar.DAY_OF_MONTH)) : (calendar.get(Calendar.DAY_OF_MONTH))); + TarmSolicitud solicitud = SolicitudArmasController.find(codigoSolicitud); + ruta = ruta.append("/cm:").append(solicitud.getNumerosolicitud()); + ruta = ruta.append("/cm:").append("armas"); + return ruta.toString(); + } + + + + /** + * M\u00e9todo para imprimir + */ + public void imprimir(){ + try { + if (!validarSeleccion()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_imprimir_recepcion_armas")); + return; + } + this.reporteActaEntregaRecepArmas(); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + /** + * Obtiene el reporte de Acta de Entrega Recepción de Armas + */ + private void reporteActaEntregaRecepArmas() throws Exception{ + try { + //this.querydatabase(); + //buttonAction(); + Calendar fechaActualCldr = Calendar.getInstance(); + Calendar fechaCorteCldr = Calendar.getInstance(); + String gradoUsuario =""; + TarmSolicitud sol = this.solicitudController.findSolicitudxcodsolicitud(this.codigoSolicitud); + TarmSolicitudTramite soltra = SolicitudTramiteController.findByCSolicitud(this.codigoSolicitud); + + String path = "armas/reports/repo"; + String filename="actaEntregaRecepcionArmas";//MsgControlArmas.getProperty("lbl_fichaTecnicaArmas"); + String nombreUsuario; + if(usuario.getPk().getPersoncode()!=null){ + nombreUsuario = PersonDetailController.find(usuario.getPk().getPersoncode().toString()).getName(); + } + else{ + nombreUsuario = ""; + } + + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("usuario", nombreUsuario); + //Centro de control + parameters.put("centroControl", this.obtenerCentroControl()); + + //Fecha actual + + //Fecha de solicitud + if(sol!=null && sol.getNumerosolicitud()!=null){ + if(soltra != null && soltra.getNumerotramite()!=null){ + parameters.put("numsolicitud", sol.getNumerosolicitud()); + parameters.put("numtramite", soltra.getNumerotramite()); + TcustPersonDetail persona = PersonDetailController.find(sol.getPersoncode().toString()); + parameters.put("cliente", persona.getName()); + } + }else{ + parameters.put("numsolicitud", " "); + } + + //No tramite + if(sol!=null && sol.getFregistro()!=null){ + SimpleDateFormat sdf2=new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fechaSolicitud", sdf2.format(sol.getFregistro())); + }else{ + parameters.put("fechaSolicitud", " "); + } + + //codigo solicitud + parameters.put("csolicitud", this.codigoSolicitud); + parameters.put("personcode", usuario.getPk().getPersoncode()); + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH)+1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("fecActual", fechaActualSB.toString()); + //Grado del funcionario + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if(grado != null){ + gradoUsuario = grado.getDescription()+" - "+this.responsableCentroControl.getName(); + }else{ + gradoUsuario = "Sin Grado - "+this.responsableCentroControl.getName(); + } + parameters.put("gradoUsuario", gradoUsuario); + //parameters.put("usuario", this.tsafeUserDetailUsuario.getNickname()); + //parameters.put("codResponsable", this.responsableCentroControl.getPk().getPersoncode().toString()); + + String format = "pdf"; + + parameters.put("tipotram", this.tipoAutorizacion.getDescription()+" - "+this.categoria.getDescription()+" - "+this.usoActividad.getDescription()); + parameters.put("codResponsable",usuario.getPk().getPersoncode()); + + parameters.put("codigoQR",(sol!=null?sol.getNumerosolicitud():"")+" "+fechaActualSB.toString()+" "+ + gradoUsuario); + + try { + this.xpathflujo = this.getRutaDocumento(); + InputStream report=this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + this.alfrescoController.uploadFile(report, filename+".pdf", this.xpathflujo); + //this.record.setXpathfichatecarmas(this.xpathflujo + "/cm:" + filename+".pdf"); + //this.record.getModifiedData().put("impresion",Boolean.TRUE); + //this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } + + /** + * @return + * @throws Exception + */ + public String codigoAceptado() throws Exception { + TgeneParameters f = ParametersController.find("ACEPTADO", "1"); + return f.getTextvalue(); + } + + /** + * M\u00e9todo para fimar documentos + */ + public void firmar(){ + System.out.println("Firmar"); + } + + /** + * M\u00e9todo para actualizar las armas en la base de datos seg\u00fan la pantalla en que se encuentre + * @throws Exception + */ + private void actualizarSolicitudArmas() throws Exception{ + for(TarmSolicitudArmas armaSeleccionada:lrecord){ + record = armaSeleccionada; + if(armaSeleccionada.modifiedData().get("seleccion").equals(Boolean.TRUE)){ + if(controlPantallaEntregado){ + record.setEntregada("Y"); + } + else{ + record.setAprobada("Y"); + } + } + if(!armaSeleccionada.modifiedData().get("seleccion").equals(Boolean.TRUE)){ + if(controlPantallaEntregado){ + record.setEntregada("N"); + } + else{ + record.setAprobada("N"); + } + } + update(); + } + + } + + + + + /** + * M\u00e9todo para leer las selecciones guardadas en la base y setearlas seg\u00fan la pantalla en la que se encuentre + * @throws Exception + */ + private void actualizarArmas() throws Exception{ + for(TarmSolicitudArmas solicitudArmas:lrecord){ + if("Y".equals(solicitudArmas.getEntregada()) && controlPantallaEntregado){ + solicitudArmas.modifiedData().put("seleccion", Boolean.TRUE); + } + if("Y".equals(solicitudArmas.getAprobada()) && !controlPantallaEntregado){ + solicitudArmas.modifiedData().put("seleccion", Boolean.TRUE); + } + } + } + + + @SuppressWarnings("unchecked") + protected void querydatabaseValidacionTransito() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para completar la tarea + */ + public void completarTareaAutorizarTramite() { + try { + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + super.cleanRequest(request); + request.modifiedData().put("csolicitud", codigoSolicitud); + request.modifiedData().put("numerotransaccion", numeroTransaccion); + request.modifiedData().put("TID", tid); + if(bpmDataStatus.equalsIgnoreCase("APR") || bpmDataStatus == null){ + bpmDataStatus="A"; + if(this.getLoginController()!=null && 30 == this.getLoginController().getRequest().getTransactionCode() && + "30".equals(getLoginController().getRequest().getTransactionModule())){ + guardarcolaImpresionController(msave); + } + }else{ + bpmDataStatus="D"; + } + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Map datosmail = new HashMap(); + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail persona = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + if (bpmDataStatus.equals("D")) { + datosmail.put("funcionario",persona ==null?"":((persona.getMilitarygrade()==null && persona.getMilitarygradecode()==null)?"":CatalogDetailController.findxCodigoCodcatalogo(persona.getMilitarygrade(),persona.getMilitarygradecode()).getDescription()) + " " + persona.getName()); + datosmail.put("razons",(solicitud==null || solicitud.getModifiedData().get("nombre")==null)?"":solicitud.getModifiedData().get("nombre")); + datosmail.put("sol", solicitud==null?"":solicitud.getPk()); + datosmail.put("observaciones", bpmDataComment); + datosmail.put("centrocontrol",(centroControl==null || centroControl.getNombreinstitucion()==null || centroControl.getNombreinstitucioncodigo()==null)?"":CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + request.modifiedData().put("datosmail", datosmail); + }else{ + SimpleDateFormat sdf1 = new SimpleDateFormat(MsgGeneral.getProperty("dateformat")); + datosmail.put("funcionario",persona ==null?"":((persona.getMilitarygrade()==null)?"":CatalogDetailController.findxCodigoCodcatalogo(persona.getMilitarygrade(),"MILITARYGRADE").getDescription()) + " " + persona.getName()); + datosmail.put("razons",(solicitud==null || solicitud.getModifiedData().get("nombre")==null)?"":solicitud.getModifiedData().get("nombre")); + datosmail.put("tramite",solicitudTramite.getNumerotramite()); + datosmail.put("centrocontrol",(centroControl==null || centroControl.getNombreinstitucion()==null || centroControl.getNombreinstitucioncodigo()==null)?"":CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + datosmail.put("fechanotificacion",sdf1.format(new Date())); + + TarmTramite tramite =TarmTramiteController.find(String.valueOf(solicitud.getCtramite())); + datosmail.put("tipoTramite",(tramite==null || tramite.getModifiedData().get("tipotramite")==null)?"":tramite.getModifiedData().get("tipotramite")); + datosmail.put("tipoAutorizacion",(tramite==null || tramite.getModifiedData().get("tipoautorizacion")==null)?"":tramite.getModifiedData().get("tipoautorizacion")); + datosmail.put("usoactividad",(tramite==null || tramite.getModifiedData().get("usoactividad")==null)?"":tramite.getModifiedData().get("usoactividad")); + datosmail.put("categoria",(tramite==null || tramite.getModifiedData().get("categoria")==null)?"":tramite.getModifiedData().get("categoria")); + request.modifiedData().put("datosmail", datosmail); + } + + request.setSaveTables(msave); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + if(bpmDataStatus.equals("D")){ + saveAnularSolicitud(); + } + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void saveAnularSolicitud() { + try { + TarmTramite tarmTramite = null; + // CATEGORIA 14 PREVIA IMPORTACION + if(this.getLoginController().getRequest().getTransactionCode()==33){ + tarmTramite = TarmTramiteController.find(this.solicitud.getCtramite().toString()); + }else if(this.getLoginController().getRequest().getTransactionCode()==30){ + tarmTramite = TarmTramiteController.find(this.solicitudMP.getRecord().getCtramite().toString()); + } + if(tarmTramite!=null && tarmTramite.getCategoria().equals("14")){ + desasociarCargaSolicitud(); + } + //Poner la solicitud en estado anulado + solicitud.setEstado("ANU"); + solicitud.setAucp(null); + solicitudMP.setRecord(solicitud); + solicitudMP.update(); + DtoSave dtoSolicitud = solicitudMP.getDtoSave(); + + TarmSolicitudTramite solicitudTramiteObj = SolicitudTramiteController.findByCSolicitud(solicitud.getPk()); + if(solicitudTramiteObj!=null){ + solicitudTramiteObj.setIsnew(false); + solicitudTramiteObj.setEstadotramite("ANU"); + solicitudTramiteController.updateSolicitud(solicitudTramiteObj); + } + // DocumentoHabilitanteController documentoHabilitanteController + TarmDocumentoHabilitante documentoHabilitanteTmp = DocumentoHabilitanteController.findPorSolicitud(codigoSolicitud); + if(documentoHabilitanteTmp!=null){ + documentoHabilitanteTmp.setFechaexpiracion(new java.sql.Date(new java.util.Date().getTime())); + this.documentoHabilitanteController.setRecord(documentoHabilitanteTmp); + this.documentoHabilitanteController.save(); + } +// if(documentoHabilitanteTmp!=null){ +// TarmDocumentoHabilitanteDetall documentoHabilitanteDetTmp = DocumentoHabilitanteDetalleController.findPorCDocumento(documentoHabilitanteTmp.getPk().toString()); +// if(documentoHabilitanteDetTmp!=null){ +// this.documentoHabilitanteDetalleController.setRecord(documentoHabilitanteDetTmp); +// this.documentoHabilitanteDetalleController.remove(); +// this.documentoHabilitanteDetalleController.save(); +// } +// +// this.documentoHabilitanteController.setRecord(documentoHabilitanteTmp); +// this.documentoHabilitanteController.remove(); +// this.documentoHabilitanteController.save(); +// } + + //Desasociar las armas en apertura de agencias y apertura de sucursales + if(solicitud.getCtramite()==44 || solicitud.getCtramite()==48){ + List armasSolicitudList = RecepcionArmasController.findPorSolicitud(solicitud.getPk()); + for(TarmSolicitudArmas armaObj:armasSolicitudList){ + + // Codigo agencia de la solicitud + ListsolicitudAgenciaLst = SolicitudAgenciaSucursalController.findPorSolicitud(solicitud.getPk()); + for(TarmSolicitudAgenciaSucursal solicitudAgenciaSucursalObj:solicitudAgenciaLst){ + String cAgencia = solicitudAgenciaSucursalObj.getPk().getCagencia().toString(); + TarmAgenciaArma agenciaArmaObj = AgenciaArmaController.findByCArma(armaObj.getPk().getCarma(), cAgencia); + agenciaArma.setRecord(agenciaArmaObj); + agenciaArma.remove(); + } + } + } + + DtoSave dtoSolicitudTramite = solicitudTramiteController.getDtoSave(); + DtoSave dtoAgenciaArma = agenciaArma.getDtoSave(); + + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + msave.put(solicitudMP.getBeanalias(), dtoSolicitud); // adicionar metadata de mantenimiento para cada tabla. + msave.put(solicitudTramiteController.getBeanalias(), dtoSolicitudTramite); + msave.put(agenciaArma.getBeanalias(), dtoAgenciaArma); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + solicitudMP.postCommit(resp); + solicitudTramiteController.postCommit(resp); + agenciaArma.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void desasociarCargaSolicitud(){ + try{ + TarmCarga carga =null; + if(this.getLoginController().getRequest().getTransactionCode()==33){ + carga = CargaController.findByAUCP(this.solicitud.getAucp()); + }else if(this.getLoginController().getRequest().getTransactionCode()==30){ + carga = CargaController.findByAUCP(solicitudMP.getRecord().getAucp()); + } + if(carga!=null){ + carga.setCsolicitud(null); + cargaController.update(carga); + cargaController.save(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para completar la tarea + */ + public void completarTarea() { + + try { + + Map datosmail = new HashMap(); + Request request = callerhelper.getRequest(); + + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail persona = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + if (bpmDataStatus.equals("A")) { + guardarDocumentoHabilitante(); + request.modifiedData().put("BPMStatus",bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + } else { + request.modifiedData().put("BPMStatus",bpmDataStatus == null ? "D" : bpmDataStatus); // A,D,R + + anularTramite(); + datosmail.put("funcionario",persona ==null?"":((persona.getMilitarygrade()==null && persona.getMilitarygradecode()==null)?"":CatalogDetailController.findxCodigoCodcatalogo(persona.getMilitarygrade(),persona.getMilitarygradecode()).getDescription()) + " " + persona.getName()); + datosmail.put("razons",(solicitud==null || solicitud.getModifiedData().get("nombre")==null)?"":solicitud.getModifiedData().get("nombre")); + datosmail.put("sol", solicitud==null?"":solicitud.getPk()); + datosmail.put("centrocontrol",(centroControl==null || centroControl.getNombreinstitucion()==null || centroControl.getNombreinstitucioncodigo()==null)?"":CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + + } + + this.update(); + + HashMap msave = new HashMap(); + + request.modifiedData().put("datosmail", datosmail); + request.modifiedData().put("csolicitud", codigoSolicitud); + request.modifiedData().put("numerotransaccion", numeroTransaccion); + //request.modifiedData().put("xpath", "c"); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMObs", "Analizar documento habilitante"); + request.modifiedData().put("observacion", observacion); + + request.setSaveTables(msave); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + dtosave.setPosition(1); + msave.put(beanalias, dtosave); + + request.setSaveTables(msave); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + if(bpmDataStatus.equals("D")){ + saveAnularSolicitud(); + } + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute( + "Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + /** + * Metodo para anular el tramite + * @throws Exception + */ + private void anularTramite() throws Exception { + solicitudTramite=solicitudTramiteController.findByCSolicitud(codigoSolicitud); + solicitudTramiteController.setRecord(solicitudTramite); + solicitudTramiteController.getRecord().setEstadotramite("ANU"); + solicitudTramiteController.getRecord().setEstadotramitecodigo("ESTADOSOLICITUD"); + solicitudTramiteController.update(); + solicitudTramiteController.save(); + } + + + /** + * M\u00e9todo para encontrar por solicitud + * @param solicitudCode + * @return + */ + public static List findPorSolicitud(String solicitudCode) { + try { + RecepcionArmasController cc = new RecepcionArmasController(); + cc.init(); + cc.recperpage = 500; + cc.addFilter("pk.csolicitud", solicitudCode); + cc.querydatabaseValidacionTransito(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Método para encontrar un objeto de tipo TarmSolicitudArmas por código de solicitud + * @param solicitudCode + * @param cc + * @return lrecord de tipo TarmSolicitudArmas + */ + public static List findPorSolicitudTodas(String solicitudCode) { + try { +// this.codigoSolicitud = solicitudCode; + RecepcionArmasController cc = new RecepcionArmasController(); + cc.init(); + cc.recperpage = 10000; + cc.addFilter("pk.csolicitud", solicitudCode); + cc.querydatabaseSolicitudArmas(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + protected void querydatabaseSolicitudArmas() { + try { + this.lArmas.clear(); + this.lGuardias.clear(); + if (codigoSolicitud==null){ + return; + } + DtoQuery dto = this.getDtoQuery(); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public DtoQuery getDtoQuery() throws Exception{ + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.csolicitud"); + dto.setOrderby("t.pk.csolicitud"); + SubQuery subquerymodelo= new SubQuery("TarmArmas","modelo","modelo","i.pk=t.pk.carma"); + dto.addSubQuery(subquerymodelo); + SubQuery subqueryacrma= new SubQuery("TarmArmas","pk","carma","i.pk=t.pk.carma"); + dto.addSubQuery(subqueryacrma); + SubQuery subqueryserie= new SubQuery("TarmArmas","lote","lote","i.pk=t.pk.carma"); + dto.addSubQuery(subqueryserie); + SubQuery subqueryCantidad= new SubQuery("TarmArmas","cantidad","cantidad","i.pk=t.pk.carma"); + dto.addSubQuery(subqueryCantidad); + SubQuery subqueryPeso= new SubQuery("TarmArmas","peso","peso","i.pk=t.pk.carma"); + dto.addSubQuery(subqueryPeso); + SubQuery subqueryUnidadMedida= new SubQuery("TgeneCatalogDetail","description","unidadmedida","i.pk.catalog=(select p.unidadmedidacantidad from TarmArmas p where p.pk=t.pk.carma) and" + + " i.pk.catalogcode=(select p.unidadmedidacantidadcodigo from TarmArmas p where p.pk=t.pk.carma)"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","marca","i.pk.catalog= (select o.marca from TarmArmas o where o.pk=t.pk.carma) " + + " and i.pk.catalogcode=(select o.marcacodigo from TarmArmas o where o.pk=t.pk.carma)"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog=(select o.color from TarmArmas o where o.pk=t.pk.carma)" + + " and i.pk.catalogcode=(select o.colorcodigo from TarmArmas o where o.pk=t.pk.carma)"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog=(select o.estado from TarmArmas o where o.pk=t.pk.carma)" + + " and i.pk.catalogcode=(select o.estadocodigo from TarmArmas o where o.pk=t.pk.carma)"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase= new SubQuery("TgeneCatalogDetail","description","clase","i.pk.catalog=(select o.clase from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryLongitud= new SubQuery("TgeneCatalogDetail","description","longitud","i.pk.catalog=(select o.longitud from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.longitudcodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryCalibre= new SubQuery("TgeneCatalogDetail","description","calibre","i.pk.catalog=(select o.calibre from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.calibrecodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryTipoArma= new SubQuery("TgeneCatalogDetail","description","tipo","i.pk.catalog=(select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + dto.addSubQuery(subqueryTipoArma); + return dto; + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTareaReceptaArma() { + + try { + if (!validarSeleccion()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_validar_seleccion_armas")); + return; + } + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("csolicitud", codigoSolicitud); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + btnFlujo=Boolean.FALSE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public TcustPersonDetail getPersonaDetalle() { + return personaDetalle; + } + + + public void setPersonaDetalle(TcustPersonDetail personaDetalle) { + this.personaDetalle = personaDetalle; + } + + + public PersonAddressController getPersonAddressController() { + return personAddressController; + } + + + public void setPersonAddressController( + PersonAddressController personAddressController) { + this.personAddressController = personAddressController; + } + + + public SolicitudTramiteController getSolicitudTramiteController() { + return solicitudTramiteController; + } + + + public void setSolicitudTramiteController( + SolicitudTramiteController solicitudTramiteController) { + this.solicitudTramiteController = solicitudTramiteController; + } + + + + public String getProvincia() { + return provincia; + } + + + public void setProvincia(String provincia) { + this.provincia = provincia; + } + + + public String getCanton() { + return canton; + } + + + public void setCanton(String canton) { + this.canton = canton; + } + + + public String getCiudad() { + return ciudad; + } + + + public void setCiudad(String ciudad) { + this.ciudad = ciudad; + } + + + public List getlArmas() { + return lArmas; + } + + + public void setlArmas(List lArmas) { + this.lArmas = lArmas; + } + + + public TarmSolicitudTramite getSolicitudTramite() { + return solicitudTramite; + } + + + public void setSolicitudTramite(TarmSolicitudTramite solicitudTramite) { + this.solicitudTramite = solicitudTramite; + } + + + public TarmTramite getTramite() { + return tramite; + } + + + public void setTramite(TarmTramite tramite) { + this.tramite = tramite; + } + + + public TgeneCatalogDetail getEstadotramite() { + return estadotramite; + } + + + public void setEstadotramite(TgeneCatalogDetail estadotramite) { + this.estadotramite = estadotramite; + } + + + public TgeneCatalogDetail getDetallecatalogo() { + return detallecatalogo; + } + + public boolean isControlPantallaEntregado() { + return controlPantallaEntregado; + } + + + public void setControlPantallaEntregado(boolean controlPantallaEntregado) { + this.controlPantallaEntregado = controlPantallaEntregado; + } + + + public boolean isControlPantallaVisualizarTramiteFirmar() { + return controlPantallaVisualizarTramiteFirmar; + } + + + public void setControlPantallaVisualizarTramiteFirmar( + boolean controlPantallaVisualizarTramiteFirmar) { + this.controlPantallaVisualizarTramiteFirmar = controlPantallaVisualizarTramiteFirmar; + } + + + public boolean isControlPantallaVerificarInformacionDevolucion() { + return controlPantallaVerificarInformacionDevolucion; + } + + + public void setControlPantallaVerificarInformacionDevolucion( + boolean controlPantallaVerificarInformacionDevolucion) { + this.controlPantallaVerificarInformacionDevolucion = controlPantallaVerificarInformacionDevolucion; + } + + + public TgeneCatalogDetail getDetallecatalogoTipoTramite() { + return detallecatalogoTipoTramite; + } + + + public void setDetallecatalogoTipoTramite( + TgeneCatalogDetail detallecatalogoTipoTramite) { + this.detallecatalogoTipoTramite = detallecatalogoTipoTramite; + } + + + public void setDetallecatalogo(TgeneCatalogDetail detallecatalogo) { + this.detallecatalogo = detallecatalogo; + } + + + public TgeneCatalogDetail getUsoActividad() { + return usoActividad; + } + + + public void setUsoActividad(TgeneCatalogDetail usoActividad) { + this.usoActividad = usoActividad; + } + + + public TgeneCatalogDetail getIdentificacion() { + return identificacion; + } + + + public void setIdentificacion(TgeneCatalogDetail identificacion) { + this.identificacion = identificacion; + } + + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + + public TarmTipoArmaExplosivo getTipoArmaExplosivo() { + return tipoArmaExplosivo; + } + + + public void setTipoArmaExplosivo(TarmTipoArmaExplosivo tipoArmaExplosivo) { + this.tipoArmaExplosivo = tipoArmaExplosivo; + } + + + public String getCodigoSolicitud() { + return codigoSolicitud; + } + + + public void setCodigoSolicitud(String codigoSolicitud) { + this.codigoSolicitud = codigoSolicitud; + } + + + + + public SolicitudGuardiasController getSolicitudGuardiasController() { + return solicitudGuardiasController; + } + + + public void setSolicitudGuardiasController( + SolicitudGuardiasController solicitudGuardiasController) { + this.solicitudGuardiasController = solicitudGuardiasController; + } + + + + public DocumentoHabilitanteController getDocumentoHabilitanteController() { + return documentoHabilitanteController; + } + + + public void setDocumentoHabilitanteController( + DocumentoHabilitanteController documentoHabilitanteController) { + this.documentoHabilitanteController = documentoHabilitanteController; + } + + + public ArmasController getArmasController() { + return armasController; + } + + + public void setArmasController(ArmasController armasController) { + this.armasController = armasController; + } + + + + public List getlSolicitudGuardias() { + return lSolicitudGuardias; + } + + + public List getLaccion() { + return laccion; + } + + + public void setLaccion(List laccion) { + this.laccion = laccion; + } + + + public void setlSolicitudGuardias(List lSolicitudGuardias) { + this.lSolicitudGuardias = lSolicitudGuardias; + } + + + public List getlGuardias() { + return lGuardias; + } + + + public void setlGuardias(List lGuardias) { + this.lGuardias = lGuardias; + } + + + public String getObservacion() { + return observacion; + } + + + public void setObservacion(String observacion) { + this.observacion = observacion; + } + + + public String getEstado() { + return estado; + } + + + public void setEstado(String estado) { + this.estado = estado; + } + + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + + public DocumentoHabilitanteDetalleController getDocumentoHabilitanteDetalleController() { + return documentoHabilitanteDetalleController; + } + + + public void setDocumentoHabilitanteDetalleController( + DocumentoHabilitanteDetalleController documentoHabilitanteDetalleController) { + this.documentoHabilitanteDetalleController = documentoHabilitanteDetalleController; + } + + + public Boolean getBtnFlujo() { + return btnFlujo; + } + + + public void setBtnFlujo(Boolean btnFlujo) { + this.btnFlujo = btnFlujo; + } + + public String getDireccion() { + return direccion; + } + + + public void setDireccion(String direccion) { + this.direccion = direccion; + } + + public SolicitudController getSolicitudController() { + return solicitudController; + } + + + public void setSolicitudController(SolicitudController solicitudController) { + this.solicitudController = solicitudController; + } + + + public ReportController getReportController() { + return reportController; + } + + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + + public ColaImpresionController getColaImpresionController() { + return colaImpresionController; + } + + + public void setColaImpresionController( + ColaImpresionController colaImpresionController) { + this.colaImpresionController = colaImpresionController; + } + + + public Boolean getBtnGrabar() { + return btnGrabar; + } + + + public void setBtnGrabar(Boolean btnGrabar) { + this.btnGrabar = btnGrabar; + } + + + public List getSolAgenciaSucursals() { + return solAgenciaSucursals; + } + + + public void setSolAgenciaSucursals( + List solAgenciaSucursals) { + this.solAgenciaSucursals = solAgenciaSucursals; + } + + + public List getDocumentosList() { + return documentosList; + } + + + public void setDocumentosList(List documentosList) { + this.documentosList = documentosList; + } + + + public AgenciaArmaController getAgenciaArma() { + return agenciaArma; + } + + + public void setAgenciaArma(AgenciaArmaController agenciaArma) { + this.agenciaArma = agenciaArma; + } + + + public SolicitudArmasController getSolicitudMP() { + return solicitudMP; + } + + + public void setSolicitudMP(SolicitudArmasController solicitudMP) { + this.solicitudMP = solicitudMP; + } + + + public CargaController getCargaController() { + return cargaController; + } + + + public void setCargaController(CargaController cargaController) { + this.cargaController = cargaController; + } + + public Boolean getRequiereNoSolAucpBln() { + return requiereNoSolAucpBln; + } + + public void setRequiereNoSolAucpBln(Boolean requiereNoSolAucpBln) { + this.requiereNoSolAucpBln = requiereNoSolAucpBln; + } + + public String getNombreInstitucion() { + return nombreInstitucion; + } + + public String setNombreInstitucion(String nombreInstitucion) { + if(nombreInstitucion!=null && !nombreInstitucion.isEmpty()){ + this.nombreInstitucion = nombreInstitucion; + }else{ + this.nombreInstitucion = ""; + } + + return nombreInstitucion; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RecepcionArmasNoEnviadasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RecepcionArmasNoEnviadasController.java.svn-base new file mode 100644 index 0000000..4029ccd --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RecepcionArmasNoEnviadasController.java.svn-base @@ -0,0 +1,436 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.model.SelectItem; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.parmas.soli.TarmTransaccionArmaBodega; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TarmDecomisoArmaTransaccion. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RecepcionArmasNoEnviadasController extends AbstractController { + + public RecepcionArmasNoEnviadasController() throws Exception { + super(TarmDecomisoArmaTransaccion.class); + } + + /** + * Controlador para generar el reporte + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + /** + * Controlador para caragar el archivo al alfresco + */ + @ManagedProperty(value="#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * atributo con los datos del usuario logeado + */ + private TsafeUserDetail userDetail; + + private String xpathflujo; + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + this.querydatabase(); + } + + private List decomisoArmas; + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 300; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "RECEPCIONARMASNOENV"; + userDetail= (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + obtenerCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * nombre del centro de control + */ + private String institucionCentroControl; + private ListitemUnidadDestino; + /** + * nombre del centro de control + */ + private String instiCentroControlCode; + /** + * Método para obtener el centro de control + * @throws Exception + */ + private void obtenerCentroControl() throws Exception { + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(userDetail.getPk().getPersoncode().toString()); + if(tcustPersonAddres!=null && tcustPersonAddres.getProvincecode()!=null){ + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + if(centroControlJur!=null && centroControlJur.getCcentrocontrol()!=null){ + TarmCentroControl centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + itemUnidadDestino= new ArrayList(); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + //codigo del centro de control de pichincha + TgeneParameters paramCentroControlDestino=ParametersController.find("CODIGO.CENT.CONTROL.PICHINCHA", "1");//000030//CAPI + //validamos si la persona que ingreso pertenece al centro de control pichincha para darle al opcion de seleccionar el deparatmento de control para la recepcion + if(paramCentroControlDestino.getTextvalue().equals(centroControl.getNombreinstitucion())){ + itemUnidadDestino.add(new SelectItem(centroControl.getPk(), institucionCentroControl)); + //codigo del departamento de control + TgeneParameters paramDepartamentoControl=ParametersController.find("CODIGO.DEPT.CONTROL", "1");//DPCA + TarmCentroControl institCentroControlDestino= CentroControlArmasController.findPorCentroControl(paramDepartamentoControl.getTextvalue());//000077 + itemUnidadDestino.add(new SelectItem(institCentroControlDestino.getPk(), ""+institCentroControlDestino.getModifiedData().get("desnombreinstitucion"))); + }else{ + instiCentroControlCode=centroControl.getPk(); + } + }else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_laprovinciasinccontrol")); + return; + } + }else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_notienedireccionprincipal")); + return; + } + } + + public void executeUnidad() { + + for(SelectItem item: itemUnidadDestino){ + if(item.getValue().equals(instiCentroControlCode)){ + institucionCentroControl=item.getLabel(); + } + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + Filter filtro = new Filter(); + filtro.setSql("estadoflujo='NOENV' and numerotransaccion like '%REC-%' and ccentrocontrol='"+instiCentroControlCode+"'"); + dto.addFiltro(filtro); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * + * @param codigo + * @return + */ + public static TarmDecomisoArmaTransaccion find(String codigo) { + try { + RecepcionArmasNoEnviadasController cc = new RecepcionArmasNoEnviadasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", codigo); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * lista las armas decomisadas asociadas al numero de transaccion + * @param decomisoArmaTransaccion + */ + public void listarArmas(TarmDecomisoArmaTransaccion decomisoArmaTransaccion){ + record=decomisoArmaTransaccion; + decomisoArmas=DecomisoArmaController.find(decomisoArmaTransaccion.getPk()); + } + + /** + * Metodo para generar el acta de recepcion + * y cargar el archivo en el alfresco + */ + public void generarActa() { + Calendar fechaActualCldr = Calendar.getInstance(); + String path = "armas/reports/repo2"; + String filename = "actaRecepciondeArmas"; + String gradoUsuario = ""; + TcustPersonDetail usuario = PersonDetailController.find(this.userDetail.getPk().getPersoncode().toString()); + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(usuario.getMilitarygrade(), usuario.getMilitarygradecode()); + if(grado != null){ + gradoUsuario = grado.getDescription()+" - "+usuario.getName(); + }else{ + gradoUsuario = "Sin Grado - "+usuario.getName(); + } + + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda","repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + try { + // Usuario logueado en la aplicacion + String nombreUsuario; + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } else { + nombreUsuario = ""; + } + TarmTransaccionArmaBodega armaBodegas= TransaccionArmaBodegaController.find(record.getPk().toString()); + parameters.put("user", nombreUsuario); + parameters.put("unidadmilitar", armaBodegas.getModifiedData().get("nombreinstituciondest")); + parameters.put("codigodec", record.getPk().toString());//este + parameters.put("fechaCorte", new SimpleDateFormat("dd-MM-yyyy").format(record.getFcorte()));//este + parameters.put("numtransaccion", record.getNumerotransaccion()); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + parameters.put("nombregrado", gradoUsuario);//este + // Fecha actual + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0"+ (fechaActualCldr.get(Calendar.DAY_OF_MONTH)): (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH) + 1) <= 9 ? "0"+ (fechaActualCldr.get(Calendar.MONTH) + 1): (fechaActualCldr.get(Calendar.MONTH) + 1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0"+ (fechaActualCldr.get(Calendar.MINUTE)): (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarFecha", fechaActualSB.toString()); + + + parameters.put("orgControl", armaBodegas.getModifiedData().get("nombreinstitucionorig")); + + InputStream file = this.reportController.jaspertoInputstream(path, parameters, "pdf", filename,this.getLoginController()); + xpathflujo = generarXpath(record.getNumerotransaccion()); + if(!alfrescoController.uploadFile(file, record.getNumerotransaccion()+ ".pdf", xpathflujo)){ + xpathflujo=null; + } + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Metodo para generar la ruta donde se carga el archivo + * @param numeroTransaccionRecepcion + * @return + */ + public String generarXpath(String numeroTransaccionRecepcion){ + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta=new StringBuilder("cm:Decomiso"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + ruta = ruta.append("/cm:"+numeroTransaccionRecepcion); + return ruta.toString(); + } + public List getDecomisoArmas() { + return decomisoArmas; + } + + public void setDecomisoArmas(List decomisoArmas) { + this.decomisoArmas = decomisoArmas; + } + + public void iniciarFlujo() { + try { + + if(xpathflujo==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generereporte")); + return; + } + TarmTransaccionArmaBodega armaBodegas= TransaccionArmaBodegaController.find(record.getPk().toString()); + + if(armaBodegas.getModifiedData().get("provincecodeorig")==null || armaBodegas.getModifiedData().get("provincecodeorig").toString().length()==0){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinprovincia")); + return; + } + + //instiCentroControlCode + TarmCentroControl centroControl= CentroControlArmasController.findPorCodigo(instiCentroControlCode); + String cprovincia=centroControl.getProvincecode();//armaBodegas.getModifiedData().get("provincecodeorig").toString(); + TgeneParameters paramDepartamentoControl=ParametersController.find("CODIGO.DEPT.CONTROL", "1");//DPCA + if(armaBodegas.getModifiedData().get("nombreinstitucion").equals(paramDepartamentoControl.getTextvalue())){ + cprovincia=paramDepartamentoControl.getTextvalue(); + } + //itemUnidadDestino + + String xpath=xpathflujo+"/cm:"+record.getNumerotransaccion()+ ".pdf"; + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + //codigo de la tabla TarmDecomisoArmaTransaccion + request.modifiedData().put("numerotransaccion", record.getPk()); + request.modifiedData().put("cprovincia", cprovincia); + request.modifiedData().put("numerosolicitud", record.getNumerotransaccion()); + //ruta del archivo para la firma + //TODO Falta crear la variable en maia 2-8 + request.modifiedData().put("xpath", xpath); + request.modifiedData().put("isnew", "Y"); + request.setLogsolicitude(record.getNumerotransaccion()); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.setShowRow(true); + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + " TRANSACCION: "+ record.getNumerotransaccion()); + xpathflujo=null; + //quita de la lista + lrecord.remove(record); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public List getItemUnidadDestino() { + return itemUnidadDestino; + } + + public void setItemUnidadDestino(List itemUnidadDestino) { + this.itemUnidadDestino = itemUnidadDestino; + } + + public String getInstiCentroControlCode() { + return instiCentroControlCode; + } + + public void setInstiCentroControlCode(String instiCentroControlCode) { + this.instiCentroControlCode = instiCentroControlCode; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReclamoDecomisoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReclamoDecomisoController.java.svn-base new file mode 100644 index 0000000..b91104e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReclamoDecomisoController.java.svn-base @@ -0,0 +1,424 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Controlar que permite el cambio de estado de los decomisosArma y tarmArma a RECL + * @author Manuel Cepeda + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReclamoDecomisoController extends AbstractController { + + private String personCode; + + @ManagedProperty(value="#{armasController}") + private ArmasController armasController; + + + public ReclamoDecomisoController() throws Exception { + super(TarmDecomisoArma.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + personCode = tsafeUserDetail.getPk().getPersoncode().toString(); + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 10000; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "TARMDECOMISOARMA"; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + //Cambio de funcionalidad a las armas decomisadas DEC por las incautadas INC + Filter decomisoFiltro= new Filter(); + decomisoFiltro.setSql( + "t.estado = 'INC' " + + " and t.carma in (select arm.pk " + + " from TarmArmas arm, TarmRegistroArmas regarm " + + " where arm.cregistro = regarm.pk and arm.estado = 'INC' " + + " and regarm.personcode = " + personCode + ")"); + dto.addFiltro(decomisoFiltro); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + for(TarmDecomisoArma decomisoArma:lrecord){ + TarmArmas arma = ArmasController.findPorCodigo(decomisoArma.getCarma()); + if(arma!=null){ + TarmTipoArmaExplosivo tipoArmaExplosivo = TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo()); + decomisoArma.getModifiedData().put("ntipo", arma.getModifiedData().get("tipo")); + decomisoArma.getModifiedData().put("ncalibre", arma.getModifiedData().get("calibre")); + decomisoArma.getModifiedData().put("nclase", arma.getModifiedData().get("clase")); + decomisoArma.getModifiedData().put("ncantidad", arma.getCantidad()); + decomisoArma.getModifiedData().put("nestado", CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getEstado(), decomisoArma.getEstadocode())!=null?CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getEstado(), decomisoArma.getEstadocode()).getDescription():""); + + if(tipoArmaExplosivo.getLongitud()!=null){ + decomisoArma.getModifiedData().put("nlongitud", CatalogDetailController.findxCodigoCodcatalogo(tipoArmaExplosivo.getLongitud(), tipoArmaExplosivo.getLongitudcodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tipoArmaExplosivo.getLongitud(), tipoArmaExplosivo.getLongitudcodigo()).getDescription():""); + } + else{ + decomisoArma.getModifiedData().put("nlongitud", ""); + } + decomisoArma.getModifiedData().put("nmarca", CatalogDetailController.findxCodigoCodcatalogo( arma.getMarca(), arma.getMarcacodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo( arma.getMarca(), arma.getMarcacodigo()).getDescription():""); + decomisoArma.getModifiedData().put("nserie", arma.getSeriecanon()); + decomisoArma.getModifiedData().put("nlote", arma.getLote()); + decomisoArma.getModifiedData().put("nunidad", CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getUnidadmedida(), decomisoArma.getUnidadmedidacode())!=null?CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getUnidadmedida(), decomisoArma.getUnidadmedidacode()).getDescription():""); + + decomisoArma.getModifiedData().put("nmotivodecomiso", CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getMotivodecomiso(), decomisoArma.getMotivodecomisocodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getMotivodecomiso(), decomisoArma.getMotivodecomisocodigo()).getDescription():""); + + TarmDecomiso decomiso = DecomisoController.findByCodigo(decomisoArma.getCdecomiso().toString()); + if(decomiso!=null && decomiso.getPersoncode()!=null){ + decomisoArma.getModifiedData().put("nrodecomiso", decomiso.getNumerotransaccion()); + } + else{ + decomisoArma.getModifiedData().put("nrodecomiso", ""); + } + decomisoArma.getModifiedData().put("seleccionado", false); + } + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + +// @SuppressWarnings("unchecked") +// protected void consulta() { +// try { +// DtoQuery dto = super.getDtoQuery(true); +// dto.setOrderby("t.pk"); +// Filter filtro=new Filter(); +// filtro.setSql("t.fdecomiso=(select max(te.fdecomiso) from TarmDecomisoArma te where te.ccustemp=t.ccustemp)"); +// dto.addFiltro(filtro); +// HashMap mtables = new HashMap(); +// mtables.put(beanalias, dto); // permite adicionar mas de una tabla. +// +// Request request = callerhelper.getRequest(); +// request.setQueryTables(mtables); +// Response resp = callerhelper.executeQuery(request); +// if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { +// lrecord = new ArrayList(); +// MessageHelper.setMessageError(resp); +// } else { +// lrecord = (List) resp.get(beanalias); +// super.postQuery(lrecord); +// querydatabase(); +// } +// +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// } +// } +// + @Override + public void save() { + try { + + for(TarmDecomisoArma tarmDecomisoArma : lrecord){ + if(tarmDecomisoArma.getModifiedData().get("seleccionado")!=null && tarmDecomisoArma.getModifiedData().get("seleccionado").equals(Boolean.TRUE)){ + TarmArmas arma = ArmasController.findPorCodigo(tarmDecomisoArma.getCarma()); + arma.setEstado("RECL"); + armasController.update(arma); + + tarmDecomisoArma.setEstado("RECL"); + update(tarmDecomisoArma); + } + } + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + DtoSave dtosaveArma = this.armasController.getDtoSave(); + dtosaveArma.setReturnpk(true); + dtosaveArma.setPosition(1); + msave.put( this.armasController.getBeanalias(), dtosaveArma); + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + querydatabase(); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if(Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")){ + valorColocar = Boolean.TRUE; + } + for (TarmDecomisoArma tarmDecomisoArma : this.lrecord) { + tarmDecomisoArma.getModifiedData().put("seleccionado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + + +// public static TarmDecomisoArma findByCodigo(String cDecomisoArma) { +// try { +// ReclamoDecomisoController cc = new ReclamoDecomisoController(); +// cc. init(); +// cc.recperpage = 300; +// cc.addFilter("pk", cDecomisoArma); +// cc.querydatabase(); +// if (cc.lrecord != null) { +// return cc.lrecord.get(0); +// } +// return null; +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// return null; +// } +// } +// +// public static List findByCodigoDecomiso(String cDecomiso) { +// try { +// ReclamoDecomisoController cc = new ReclamoDecomisoController(); +// cc. init(); +// cc.recperpage = 300; +// cc.addFilter("cdecomiso", cDecomiso); +// cc.querydatabase(); +// if (cc.lrecord != null) { +// return cc.lrecord; +// } +// return null; +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// return null; +// } +// } +// +// public static TarmDecomisoArma findxCodigoCustTemporal(String ccustemp,String estado) { +// try { +// ReclamoDecomisoController cc = new ReclamoDecomisoController(); +// cc. init(); +// cc.recperpage = 300; +// cc.addFilter("ccustemp", ccustemp); +// cc.addFilter("estado", estado); +// cc.consulta(); +// if (cc.lrecord != null && cc.lrecord.size()>0) { +// return cc.lrecord.get(0); +// } +// return null; +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// return null; +// } +// } + + public void update(TarmDecomisoArma bean) throws Exception { + record=bean; + super.update(); + } + +// +// public static List find(Long codigoenvio) { +// try { +// ReclamoDecomisoController cc = new ReclamoDecomisoController(); +// cc. init(); +// cc.recperpage = 300; +// cc.addFilter("cdecarmtranrecepcion", codigoenvio.toString()); +// cc.querydatabaseSimple(); +// if (cc.lrecord != null) { +// return cc.lrecord; +// } +// return null; +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// return null; +// } +// } +// +// public static List findEnvio(Long codigoenvio) { +// try { +// ReclamoDecomisoController cc = new ReclamoDecomisoController(); +// cc. init(); +// cc.recperpage = 300; +// cc.addFilter("cdecomisoarmatransaccion", codigoenvio.toString()); +// cc.querydatabaseSimple(); +// if (cc.lrecord != null) { +// return cc.lrecord; +// } +// return null; +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// return null; +// } +// } + +// @SuppressWarnings("unchecked") +// protected void querydatabaseSimple() { +// try { +// DtoQuery dto = this.getDtoQuery(); +// dto.setOrderby("t.pk"); +// +// HashMap mtables = new HashMap(); +// mtables.put(beanalias, dto); // permite adicionar mas de una tabla. +// +// Request request = callerhelper.getRequest(); +// request.setQueryTables(mtables); +// +// Response resp = callerhelper.executeQuery(request); +// +// if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { +// lrecord = new ArrayList(); +// MessageHelper.setMessageError(resp); +// } else { +// lrecord = (List) resp.get(beanalias); +// super.postQuery(lrecord); +// } +// +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// } +// } + + private DtoQuery getDtoQuery() throws Exception{ + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryClasecatalogo= new SubQuery("TgeneCatalogDetail","description","nclase","i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma)) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o " + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))"); + dto.addSubQuery(subqueryClasecatalogo); + SubQuery subqueryTipoArmaExplosivo= new SubQuery("TgeneCatalogDetail","description","ntipo","i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o " + + " where o.pk= (select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))" + + " and i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","nmarca","i.pk.catalog= (select o.marca from TarmArmas o where o.pk=t.carma)" + + " and i.pk.catalogcode=(select o.marcacodigo from TarmArmas o where o.pk=t.carma)"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ncalibre","i.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma)"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryLote= new SubQuery("TarmArmas","lote","nserie","i.pk=t.carma"); + dto.addSubQuery(subqueryLote); + + SubQuery subqueryNRecivo= new SubQuery("TarmDecomiso","numerorecibo","nrecibo","i.pk=t.cdecomiso"); + dto.addSubQuery(subqueryNRecivo); + SubQuery subqueryNTransaccion= new SubQuery("TarmDecomiso","numerotransaccion","numerotransaccion","i.pk=t.cdecomiso"); + dto.addSubQuery(subqueryNTransaccion); + SubQuery subqueryUnidadTipo= new SubQuery("TgeneCatalogDetail","description","nunidad","i.pk.catalog= (select o.unidadmedidapeso from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma)) and " + + " i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))"); + dto.addSubQuery(subqueryUnidadTipo); + + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog= (select o.color from TarmArmas o where o.pk=t.carma)" + + " and i.pk.catalogcode=(select o.colorcodigo from TarmArmas o where o.pk=t.carma)"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog= (select o.estado from TarmArmas o where o.pk=t.carma) " + + " and i.pk.catalogcode=(select o.estadocodigo from TarmArmas o where o.pk=t.carma)"); + dto.addSubQuery(subqueryEstado); + + SubQuery subqueryIndentificacion= new SubQuery("TcustPersonDetail","identification","identification","i.pk.personcode=(select p from TarmRegistroArmas p where p.pk=(select o.cregistro from TarmArmas o where o.pk=t.carma)) " + + " and i.pk.dateto=to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryIndentificacion); + SubQuery subqueryRazonSocial= new SubQuery("TcustPersonDetail","name","nrazons","i.pk.personcode=(select p.personcode from TarmRegistroArmas p where p.pk=(select o.cregistro from TarmArmas o where o.pk=t.carma)) " + + " and i.pk.dateto=to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryRazonSocial); + return dto; + } + + /** + * @return the armasController + */ + public ArmasController getArmasController() { + return armasController; + } + + /** + * @param armasController the armasController to set + */ + public void setArmasController(ArmasController armasController) { + this.armasController = armasController; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReclamoDecomisoCoordinadorMilitarController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReclamoDecomisoCoordinadorMilitarController.java.svn-base new file mode 100644 index 0000000..5f6f6a0 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReclamoDecomisoCoordinadorMilitarController.java.svn-base @@ -0,0 +1,240 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.event.AjaxBehaviorEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +/** + * Controlar que permite el cambio de estado de los decomisosArma y tarmArma a RECL + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReclamoDecomisoCoordinadorMilitarController extends AbstractController { + + + @ManagedProperty(value="#{armasController}") + private ArmasController armasController; + + private Integer numeroDias; + + public ReclamoDecomisoCoordinadorMilitarController() throws Exception { + super(TarmDecomisoArma.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 10000; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "TARMDECOMISOARMA"; + numeroDias=codigos("NUMERO.DIAS.DECOMISO"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para obtener los codigos + */ + private Integer codigos(String parametro){ + TgeneParameters tgeneParameters= ParametersController.find(parametro, "1"); + return tgeneParameters.getNumbervalue().intValue(); + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + //Cambio de funcionalidad a las armas decomisadas DEC por las incautadas INC-INCA + Filter decomisoFiltro= new Filter(); + decomisoFiltro.setSql("t.estado = 'RECL' and" + + " t.carma in (select arm.pk from TarmArmas arm, TarmRegistroArmas regarm" + + " where arm.cregistro = regarm.pk " + + " and arm.estado = 'RECL' )");//and regarm.personcode = " + personCode + " + dto.addFiltro(decomisoFiltro); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + ListlistaRemover= new ArrayList(); + for(TarmDecomisoArma decomisoArma:lrecord){ + TarmArmas arma = ArmasController.findPorCodigo(decomisoArma.getCarma()); + if(arma!=null){ + TarmTipoArmaExplosivo tipoArmaExplosivo = TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo()); + decomisoArma.getModifiedData().put("ntipo", arma.getModifiedData().get("tipo")); + decomisoArma.getModifiedData().put("ncalibre", arma.getModifiedData().get("calibre")); + decomisoArma.getModifiedData().put("nclase", arma.getModifiedData().get("clase")); + decomisoArma.getModifiedData().put("ncantidad", arma.getCantidad()); + decomisoArma.getModifiedData().put("nestado", CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getEstado(), decomisoArma.getEstadocode())!=null?CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getEstado(), decomisoArma.getEstadocode()).getDescription():""); + + if(tipoArmaExplosivo.getLongitud()!=null){ + decomisoArma.getModifiedData().put("nlongitud", CatalogDetailController.findxCodigoCodcatalogo(tipoArmaExplosivo.getLongitud(), tipoArmaExplosivo.getLongitudcodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tipoArmaExplosivo.getLongitud(), tipoArmaExplosivo.getLongitudcodigo()).getDescription():""); + } + else{ + decomisoArma.getModifiedData().put("nlongitud", ""); + } + decomisoArma.getModifiedData().put("nmarca", CatalogDetailController.findxCodigoCodcatalogo( arma.getMarca(), arma.getMarcacodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo( arma.getMarca(), arma.getMarcacodigo()).getDescription():""); + decomisoArma.getModifiedData().put("nserie", arma.getSeriecanon()); + decomisoArma.getModifiedData().put("nlote", arma.getLote()); + decomisoArma.getModifiedData().put("nunidad", CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getUnidadmedida(), decomisoArma.getUnidadmedidacode())!=null?CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getUnidadmedida(), decomisoArma.getUnidadmedidacode()).getDescription():""); + + decomisoArma.getModifiedData().put("nmotivodecomiso", CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getMotivodecomiso(), decomisoArma.getMotivodecomisocodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getMotivodecomiso(), decomisoArma.getMotivodecomisocodigo()).getDescription():""); + + TarmDecomiso decomiso = DecomisoController.findByCodigo(decomisoArma.getCdecomiso().toString()); + if(decomiso!=null && decomiso.getPersoncode()!=null){ + decomisoArma.getModifiedData().put("nrodecomiso", decomiso.getNumerotransaccion()); + } + else{ + decomisoArma.getModifiedData().put("nrodecomiso", ""); + } + decomisoArma.getModifiedData().put("seleccionado", false); + } + } + lrecord.removeAll(listaRemover); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + for(TarmDecomisoArma tarmDecomisoArma : lrecord){ + if(tarmDecomisoArma.getModifiedData().get("seleccionado")!=null && tarmDecomisoArma.getModifiedData().get("seleccionado").equals(Boolean.TRUE)){ + TarmArmas arma = ArmasController.findPorCodigo(tarmDecomisoArma.getCarma()); + arma.setEstado("RECL"); + armasController.update(arma); + tarmDecomisoArma.setEstado("RECL"); + update(tarmDecomisoArma); + } + } + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + DtoSave dtosaveArma = this.armasController.getDtoSave(); + dtosaveArma.setReturnpk(true); + dtosaveArma.setPosition(1); + msave.put( this.armasController.getBeanalias(), dtosaveArma); + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + querydatabase(); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if(Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")){ + valorColocar = Boolean.TRUE; + } + for (TarmDecomisoArma tarmDecomisoArma : this.lrecord) { + tarmDecomisoArma.getModifiedData().put("seleccionado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + + + public void update(TarmDecomisoArma bean) throws Exception { + record=bean; + super.update(); + } + + /** + * @return the armasController + */ + public ArmasController getArmasController() { + return armasController; + } + + /** + * @param armasController the armasController to set + */ + public void setArmasController(ArmasController armasController) { + this.armasController = armasController; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RegistrarNovedadController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RegistrarNovedadController.java.svn-base new file mode 100644 index 0000000..d2127bb --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RegistrarNovedadController.java.svn-base @@ -0,0 +1,519 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.general.mail.EnvioMail; +import com.fp.general.mail.dto.EnvioCorreoDTO; +import com.fp.general.mail.exception.EnvioMailException; +import com.fp.general.mail.factory.EnvioMailFactory; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RegistrarNovedadController extends AbstractController { + + TarmSolicitudTramite solicitudTramite; + + @ManagedProperty(value = "#{tarmSolicitudArmasController}") + private TarmSolicitudArmasController tarmSolicitudArmasController; + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddressController; + + TcustPersonDetail detallesPersona; + TcustPersonAddress direccionPersona; + TcustPersonDetail usuario; + TarmCentroControl centroControl; + String nombreInstitucion; + String gradoFuncionario=""; + private Boolean btnEnviar; + private String csolicitud; + + public RegistrarNovedadController() throws Exception { + super(TarmSolicitudTramite.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + csolicitud=FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("CSOLICITUD").toString();//"175"; + // Inicializa autoconsulta + super.startQuery(); + this.init(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "REGISTRARNOVEDADCONTROLLER"; + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(csolicitud); + btnEnviar=Boolean.FALSE; + querydatabase(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @Override + public void query() throws Exception { + // TODO Auto-generated method stub + MessageHelper.setMessageError("msg_notQuery"); + super.query(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + + //Quemando el personcode de la persona + Filter filtro=new Filter("pk.csolicitud", csolicitud); + dto.addFiltro(filtro); + + //Obteniendo el tramite + TarmSolicitudTramite solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(csolicitud); + + tarmSolicitudArmasController.setCsolicitud(csolicitud); + tarmSolicitudArmasController.setPorDevolucion("N"); + tarmSolicitudArmasController.query(); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(lrecord!=null && !lrecord.isEmpty()){ + + record=lrecord.get(0); + + //Numero de tramite + if(solicitudTramite!=null){ + this.record.put("ntramite", solicitudTramite.getNumerotramite()); + } + + //Obteniendo la solicitud + TarmSolicitud solicitud=ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(this.record.getPk().getCsolicitud()); + + //Obteniendo los datos y la direccion de la persona + if(solicitud!=null){ + detallesPersona= PersonDetailController.find(String.valueOf(solicitud.getPersoncode().toString())); + + String tipoDireccion=""; + + switch(detallesPersona.getIdentificationcatalog()){ + case "CED": + tipoDireccion = "1"; + break; + case "RUC": + tipoDireccion= "2"; + break; + default: + tipoDireccion= ""; + break; + } + + personAddressController.findPersonaPorDireccionTipoCatalogo(String.valueOf(detallesPersona.getPk().getPersoncode()), tipoDireccion); + direccionPersona= personAddressController.getRecord(); + + } + + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + //Obteniendo el grado + TgeneCatalogDetail grado=CatalogDetailController.findxCodigoCodcatalogo(usuario.getMilitarygrade(), usuario.getMilitarygradecode()); + if(grado!=null){ + gradoFuncionario=grado.getDescription()+" - "; + } + + //Obteniendo el centro de control + centroControl=CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + if(centroControl!=null && centroControl.getNombreinstitucion()!=null && !centroControl.getNombreinstitucion().isEmpty() + && centroControl.getNombreinstitucioncodigo()!=null && !centroControl.getNombreinstitucioncodigo().isEmpty()){ + + TgeneCatalogDetail catalogoInstitucion=CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()); + this.nombreInstitucion=catalogoInstitucion.getDescription(); + } + + + } + super.postQuery(lrecord); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + update(); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + btnEnviar=true; + TgeneCatalogDetail tipoDireccion=null; + if(direccionPersona.getAddresstypecatalog()!=null && !direccionPersona.getAddresstypecatalog().isEmpty() + && direccionPersona.getAddresstypecatalogcode()!=null && !direccionPersona.getAddresstypecatalogcode().isEmpty()){ + tipoDireccion=CatalogDetailController.findxCodigoCodcatalogo(direccionPersona.getAddresstypecatalog(),direccionPersona.getAddresstypecatalogcode()); + } + + if(tipoDireccion!=null && tipoDireccion.getDescription().equalsIgnoreCase("Mail")){ + enviarNotificacion(); + } + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + //completa la tarea del flujo + //complete la tarea del flujo pasa a Autorizar la devolucion + request.modifiedData().put("csolicitud", csolicitud); + request.modifiedData().put("TID", FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TID")); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "D" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", record.getObservacionnovedad() == null ? "OK" : record.getObservacionnovedad()); + + Mapdatosmail = new HashMap(); + datosmail.put("razons",detallesPersona.getName()); + datosmail.put("sol",solicitudTramite.getNumerotramite()); + if(record.getObservacionnovedad()!=null){ + datosmail.put("observaciones",record.getObservacionnovedad()); + }else{ + datosmail.put("observaciones","ok"); + } + + //grado funcionario de la persona logeada + TsafeUserDetail userDetailObj=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personDetailObj=PersonDetailController.find(userDetailObj.getPk().getPersoncode().toString()); + datosmail.put("grado",personDetailObj.getMilitarygrade()); + datosmail.put("funcionario",personDetailObj.getName()); + // Centro de control de armas + datosmail.put("centrocontrol",centroControl.getModifiedData().get("desinstitucion")); + request.modifiedData().put("datosmail", datosmail); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + btnEnviar=Boolean.FALSE; + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().remove("TID"); + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().remove("CSOLICITUD"); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que envia un mail de notificación + */ + public void enviarNotificacion(){ + try { + String asunto = MsgControlArmas.getProperty("lbl_asuntoNotificarNovedad"); + String cuerpo=""; + String cuerpo1 = MessageFormat.format(MsgControlArmas.getProperty("cuerpo.mensaje.envio.correo.novedad1"), detallesPersona.getName(), + solicitudTramite.getPk().getCtramite().toString()); + + String cuerpo2="

"; + cuerpo2=cuerpo2.concat(""); + + cuerpo2=cuerpo2.concat(""); + + cuerpo2=cuerpo2.concat(""); + + cuerpo2=cuerpo2.concat(""); + + cuerpo2=cuerpo2.concat(""); + + cuerpo2=cuerpo2.concat(""); + + cuerpo2=cuerpo2.concat(""); + + cuerpo2=cuerpo2.concat(""); + + cuerpo2=cuerpo2.concat(""); + + cuerpo2=cuerpo2.concat(""); + + cuerpo2=cuerpo2.concat(""); + + for (int i = 0; i < tarmSolicitudArmasController.getLrecord().size(); i++) { + cuerpo2=cuerpo2.concat(""); + + //No + cuerpo2=cuerpo2.concat(""); + + //Clase + cuerpo2=cuerpo2.concat(""); + + //Tipo + cuerpo2=cuerpo2.concat(""); + + //Marca + cuerpo2=cuerpo2.concat(""); + + //Modelo + cuerpo2=cuerpo2.concat(""); + + //Calibre + cuerpo2=cuerpo2.concat(""); + + //Serie + cuerpo2=cuerpo2.concat(""); + + //Estado + cuerpo2=cuerpo2.concat(""); + + cuerpo2=cuerpo2.concat(""); + + } + + cuerpo2=cuerpo2.concat("
"); + cuerpo2=cuerpo2.concat("No."); + cuerpo2=cuerpo2.concat(""); + cuerpo2=cuerpo2.concat("Clase"); + cuerpo2=cuerpo2.concat(""); + cuerpo2=cuerpo2.concat("Tipo"); + cuerpo2=cuerpo2.concat(""); + cuerpo2=cuerpo2.concat("Marca"); + cuerpo2=cuerpo2.concat(""); + cuerpo2=cuerpo2.concat("Modelo"); + cuerpo2=cuerpo2.concat(""); + cuerpo2=cuerpo2.concat("Calibre"); + cuerpo2=cuerpo2.concat(""); + cuerpo2=cuerpo2.concat("Serie"); + cuerpo2=cuerpo2.concat(""); + cuerpo2=cuerpo2.concat("Estado"); + cuerpo2=cuerpo2.concat("
"); + Integer no=i+1; + cuerpo2=cuerpo2.concat(no.toString()); + cuerpo2=cuerpo2.concat(""); + if(tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("clase")!=null){ + cuerpo2=cuerpo2.concat(tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("clase").toString()); + }else{ + cuerpo2=cuerpo2.concat(""); + } + cuerpo2=cuerpo2.concat(""); + if(tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("tipo")!=null){ + cuerpo2=cuerpo2.concat(tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("tipo").toString()); + }else{ + cuerpo2=cuerpo2.concat(""); + } + cuerpo2=cuerpo2.concat(""); + if(tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("marca")!=null){ + cuerpo2=cuerpo2.concat(tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("marca").toString()); + }else{ + cuerpo2=cuerpo2.concat(""); + } + cuerpo2=cuerpo2.concat(""); + if(tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("modelo")!=null){ + cuerpo2=cuerpo2.concat(tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("modelo").toString()); + }else{ + cuerpo2=cuerpo2.concat(""); + } + cuerpo2=cuerpo2.concat(""); + if(tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("calibre")!=null){ + cuerpo2=cuerpo2.concat(tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("calibre").toString()); + }else{ + cuerpo2=cuerpo2.concat(""); + } + cuerpo2=cuerpo2.concat(""); + if(tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("seriecanon")!=null){ + cuerpo2=cuerpo2.concat(tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("seriecanon").toString()); + }else{ + cuerpo2=cuerpo2.concat(" "); + } + cuerpo2=cuerpo2.concat(""); + if(tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("estado")!=null){ + cuerpo2=cuerpo2.concat(tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("estado").toString()); + }else{ + cuerpo2=cuerpo2.concat(" "); + } + cuerpo2=cuerpo2.concat("

"); + cuerpo2=cuerpo2.concat("Observaciones:
"); + + String cuerpo3 = MessageFormat.format(MsgControlArmas.getProperty("cuerpo.mensaje.envio.correo.novedad2"), this.record.getObservacionnovedad(), + gradoFuncionario+usuario.getName(),this.nombreInstitucion); + + cuerpo=cuerpo1+cuerpo2+cuerpo3; + + EnvioCorreoDTO envioCorreo = new EnvioCorreoDTO(); + envioCorreo.setCorreoDesde(MsgControlArmas.getProperty("correoDesde")); + envioCorreo.setCorreoPara(new String[]{direccionPersona.getAddress()}); + //envioCorreo.setCorreoPara(new String[]{"ogarcia@bupartech.com"}); + envioCorreo.setAsunto(asunto); + envioCorreo.setMensajeHTML(cuerpo); + EnvioMail envioMail = EnvioMailFactory.getInstancia(); + envioMail.envioMail(envioCorreo); + } catch(EnvioMailException e){ + MessageHelper.setMessageError(new Throwable("Se produjo un error al enviar el correo")); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + public TarmSolicitudTramite getSolicitudTramite() { + return solicitudTramite; + } + + public void setSolicitudTramite(TarmSolicitudTramite solicitudTramite) { + this.solicitudTramite = solicitudTramite; + } + + public TarmSolicitudArmasController getTarmSolicitudArmasController() { + return tarmSolicitudArmasController; + } + + public void setTarmSolicitudArmasController( + TarmSolicitudArmasController tarmSolicitudArmasController) { + this.tarmSolicitudArmasController = tarmSolicitudArmasController; + } + + public PersonAddressController getPersonAddressController() { + return personAddressController; + } + + public void setPersonAddressController( + PersonAddressController personAddressController) { + this.personAddressController = personAddressController; + } + + public TcustPersonDetail getDetallesPersona() { + return detallesPersona; + } + + public void setDetallesPersona(TcustPersonDetail detallesPersona) { + this.detallesPersona = detallesPersona; + } + + public TcustPersonAddress getDireccionPersona() { + return direccionPersona; + } + + public void setDireccionPersona(TcustPersonAddress direccionPersona) { + this.direccionPersona = direccionPersona; + } + + public TcustPersonDetail getUsuario() { + return usuario; + } + + public void setUsuario(TcustPersonDetail usuario) { + this.usuario = usuario; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getNombreInstitucion() { + return nombreInstitucion; + } + + public void setNombreInstitucion(String nombreInstitucion) { + this.nombreInstitucion = nombreInstitucion; + } + + public Boolean getBtnEnviar() { + return btnEnviar; + } + + public void setBtnEnviar(Boolean btnEnviar) { + this.btnEnviar = btnEnviar; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RegistroInspeccionController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RegistroInspeccionController.java.svn-base new file mode 100644 index 0000000..02434b0 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RegistroInspeccionController.java.svn-base @@ -0,0 +1,1002 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.SelectEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.CargaController; +import com.fp.frontend.controller.armas.lov.SitioAlmacenamientoLovController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.IngresoDatosTipoTramite; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.PersonPhoneController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.param.TarmSitioAlmacenamiento; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmAgenciaArma; +import com.fp.persistence.parmas.soli.TarmSolicitudAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TgeneInspeccion. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RegistroInspeccionController extends AbstractController{ + + public RegistroInspeccionController() throws Exception { + super(AbstractDataTransport.class); + } + + /** + * Atributo para obtener el valor del flujo + */ + private String codigoSolicitud; + /** + * Atributo para obtener el valor del flujo + */ + private String numeroSolicitud; + + @ManagedProperty(value = "#{inspeccionController}") + private InspeccionController inspeccionController; + + @ManagedProperty(value = "#{solicitudTramiteController}") + private SolicitudTramiteController solicitudTramiteController; + + @ManagedProperty(value = "#{solicitudArmasController}") + private SolicitudArmasController solicitudArmasController; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController persondetail; + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController address; + + @ManagedProperty(value = "#{centroControlArmasController}") + private CentroControlArmasController centroControlArmasController; + + @ManagedProperty(value = "#{personPhoneController}") + private PersonPhoneController personPhoneController; + + //PARA LOS ARCHIVOS + @ManagedProperty(value = "#{inspeccionArchivoController}") + private InspeccionArchivoController inspeccionArchivoController; +// TRAMITE + @ManagedProperty(value = "#{ingresoDatosTipoTramite}") + private IngresoDatosTipoTramite tarmTramiteController; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * Controlador que maneja las armas asociadas a las agencias + */ + @ManagedProperty(value="#{agenciaArmaController}") + private AgenciaArmaController agenciaArma; + + /** + * Controlador que maneja cargas para previa importacion + */ + @ManagedProperty(value = "#{cargaController}") + private CargaController cargaController; + + + /** + * Campo para seleccionar si el tramite sigue el proceso + */ + private Boolean tramiteProceso=Boolean.FALSE; + /** + * Campo para seleccionar si se niega el tramite + */ + private Boolean tramiteProcesoNegar=Boolean.FALSE; + private String aplicaDecomiso; + private Integer codigoPersona; + //sitio de almacenamiento + private TarmSitioAlmacenamiento sitioAlmacenamiento; + //propietario + private TcustPersonAddress personAddressDireccion; + private TcustPersonAddress personAddressCorreo; + private TcustPersonDetail tcustPersonDetailProp; + private TcustPersonPhone personPhoneDomiProp; + //PERSONA RESPONSABLE + private TcustPersonDetail tcustPersonDetailResp; + /** + * campo para cargar al usuario logeado + */ + private TsafeUserDetail tsafeUserDetail; + private TcustPersonPhone personPhoneDomiResp; + private TcustPersonPhone personPhoneCelResp; + private TcustPersonAddress personAddressCorreoresp; + /** + * Atributos para cargar los archivos + */ + private UploadedFile file; + private UploadedFile uploadedFileFoto1; + private UploadedFile uploadedFileFoto2; + private UploadedFile uploadedFileFoto3; + /** + * Atributos para obtener los codigos pra las validaciones + */ + private String codigoMail; + private String codigoOficina; + private String codigoPhoneFijo; + private String codigoPhoneCelular; + /** + * campo para desabilitar el boton + */ + private Boolean btn=Boolean.FALSE; + + private Boolean btnFlujo; + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + this.startQuery(); + querydatabase(); + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + codigoSolicitud=super.getMfilters().get("csolicitud"); + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "REGISTROINSP"; + inspeccionController.create(); + inspeccionArchivoController.create(); + sitioAlmacenamiento= new TarmSitioAlmacenamiento(); + //propietario + personAddressDireccion= new TcustPersonAddress(); + personAddressCorreo= new TcustPersonAddress(); + tcustPersonDetailProp= new TcustPersonDetail(); + personPhoneDomiProp= new TcustPersonPhone(); + //PERSONA RESPONSABLE + tcustPersonDetailResp= new TcustPersonDetail(); + tsafeUserDetail= new TsafeUserDetail(); + personPhoneDomiResp= new TcustPersonPhone(); + personPhoneCelResp= new TcustPersonPhone(); + personAddressCorreoresp= new TcustPersonAddress(); + //se obtiene el usuario logeado + tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + //codigos + codigoMail=codigoParameter("CODIGO.MAIL"); + codigoOficina=codigoParameter("CODIGO.OFICINA"); + codigoPhoneFijo=codigoParameter("CODIGO.PHONE.FIJO"); + codigoPhoneCelular=codigoParameter("CODIGO.PHONE.CELULAR"); + btnFlujo=Boolean.FALSE; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public String codigoParameter(String codigo){ + TgeneParameters parameter= ParametersController.find(codigo, "1"); + return parameter.getTextvalue(); + } + + @Override + protected void querydatabase() { + try { + solicitudArmasController.getMfilters().clear(); + solicitudArmasController.getMfilters().put("pk", codigoSolicitud); + solicitudArmasController.query();//devuelve el record + codigoPersona=solicitudArmasController.getRecord().getPersoncode(); + String centroControl=solicitudArmasController.getRecord().getCcentrocontrol(); + Long ctramite=solicitudArmasController.getRecord().getCtramite(); + numeroSolicitud=solicitudArmasController.getRecord().getNumerosolicitud(); + + solicitudTramiteController.getMfilters().clear(); + solicitudTramiteController.getMfilters().put("pk.csolicitud", codigoSolicitud); + solicitudTramiteController.getMfilters().put("pk.ctramite", solicitudArmasController.getRecord().getCtramite().toString()); + solicitudTramiteController.query(); + solicitudTramiteController.setRecord(solicitudTramiteController.getLrecord().get(0)); + + persondetail.getMfilters().clear(); + persondetail.getMfilters().put("pk.personcode", codigoPersona.toString()); + persondetail.addFilterDateto(); + persondetail.query(); + tcustPersonDetailProp=persondetail.getRecord(); + + address.getMfilters().clear(); + address.addPersoncodeFilter(codigoPersona.toString()); + address.addFilterDateto(); + address.query(); + if(address.getLrecord()!=null && address.getLrecord().size()>0){ + for(TcustPersonAddress direccion:address.getLrecord()){ + if(direccion.getAddresstypecatalog().equals(codigoOficina)){//1-CODIGO.OFICINA + personAddressDireccion=direccion; + }else{ + personAddressCorreo=direccion; + } + } + } + + //telefono + personPhoneController.getMfilters().clear(); + personPhoneController.addPersoncodeFilter(codigoPersona.toString()); + personPhoneController.addFilterDateto(); + personPhoneController.getMfilters().put("phonetypecatalog", codigoPhoneFijo);//1 CODIGO.PHONE.FIJO + personPhoneController.query(); + if(personPhoneController.getLrecord()!=null && personPhoneController.getLrecord().size()>0){ + personPhoneDomiProp=personPhoneController.getLrecord().get(0); + } + + centroControlArmasController.getMfilters().clear(); + centroControlArmasController.getMfilters().put("pk", centroControl); + centroControlArmasController.query(); + centroControlArmasController.setRecord(centroControlArmasController.getLrecord().get(0)); + String numOrdenTrabajo=""; + if(solicitudTramiteController.getRecord().getNumerotramite().contains("TRA")){ + numOrdenTrabajo=solicitudTramiteController.getRecord().getNumerotramite().replace("TRA", "INS"); + }else{ + numOrdenTrabajo="TRA"+solicitudTramiteController.getRecord().getNumerotramite(); + } + + inspeccionController.getRecord().setNumordentrabajo(numOrdenTrabajo); + inspeccionController.getRecord().setFecharegistro(new Date(new java.util.Date().getTime())); + //TRAMITE + tarmTramiteController.getMfilters().clear(); + tarmTramiteController.getMfilters().put("pk", ctramite.toString()); + tarmTramiteController.query(); + if(tarmTramiteController.getLrecord()!= null && tarmTramiteController.getLrecord().size()>0){ + tarmTramiteController.setRecord(tarmTramiteController.getLrecord().get(0)); + } + + //responsable--------------------------------------------------------------------------------------- + persondetail.getMfilters().clear(); + persondetail.getMfilters().put("pk.personcode", tsafeUserDetail.getPk().getPersoncode().toString()); + persondetail.getMfilters().put("pk.dateto", tsafeUserDetail.getPk().getDateto().toString()); + persondetail.query(); + tcustPersonDetailResp=persondetail.getRecord(); + + personPhoneController.getMfilters().clear(); + personPhoneController.addPersoncodeFilter(tsafeUserDetail.getPk().getPersoncode().toString()); + personPhoneController.addFilterDateto(); + personPhoneController.query(); + if(personPhoneController.getLrecord()!=null && personPhoneController.getLrecord().size()>0){ + for(TcustPersonPhone tel:personPhoneController.getLrecord()){ + if(tel.getPhonetypecatalog().equals(codigoPhoneFijo)){ // CODIGO.PHONE.FIJO + personPhoneDomiResp=tel; + }else if(tel.getPhonetypecatalog().equals(codigoPhoneCelular)){// CODIGO.PHONE.CELULAR + personPhoneCelResp=tel; + } + } + } + address.getMfilters().clear(); + address.addPersoncodeFilter(tsafeUserDetail.getPk().getPersoncode().toString()); + address.addFilterDateto(); + address.getMfilters().put("addresstypecatalog", codigoMail);// 3 CODIGO.MAIL personaddress + address.query(); + if(address.getLrecord()!=null && address.getLrecord().size()>0){ + address.setRecord(address.getLrecord().get(0)); + personAddressCorreoresp=address.getRecord(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeAprobar() { + if (tramiteProceso) { + tramiteProcesoNegar=false; + inspeccionController.getRecord().setTramiteproceso("Y"); + } else { + tramiteProcesoNegar=true; + inspeccionController.getRecord().setTramiteproceso("N"); + } + aplicaDecomiso=null; + } + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeRechazar() { + if (tramiteProcesoNegar) { + tramiteProceso=false; + inspeccionController.getRecord().setTramiteproceso("N"); + } else { + tramiteProceso=true; + inspeccionController.getRecord().setTramiteproceso("Y"); + } + aplicaDecomiso="N"; + } + + //lov de persona + /** + * Método para abrir el lov de personas + */ + public void openSitioLov() { + if(codigoPersona==null || codigoPersona==0){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_realizelabusqueda")); + return; + } + Map> params = new HashMap<>(); + List lcat = new ArrayList<>(); + lcat.add(codigoPersona.toString()); + params.put("personcode", lcat); + SitioAlmacenamientoLovController.openLov(params); + } + + + /** + * Maneja la respuesta del Lov de Personas + * @param event + * @throws Exception + */ + public void onReturnSitioLov(SelectEvent event) throws Exception { + sitioAlmacenamiento=(TarmSitioAlmacenamiento) event.getObject();; + } + + @Override + public void save() { + Boolean msg=Boolean.FALSE; + try { + if(sitioAlmacenamiento==null || sitioAlmacenamiento.getPk()==null + || sitioAlmacenamiento.getPk().trim().length()==0){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionenesitioinspeccion")); + msg=Boolean.TRUE; + } + if(tramiteProceso== false && tramiteProcesoNegar == false){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionenegarocontinuartramiteproceso")); + msg=Boolean.TRUE; + } + if(msg){ + return; + } + HashMap msave = new HashMap(); + Request request = callerhelper.getRequest(); + if(!saveWithDocumentAlfresco()){ + return; + } + if(tramiteProceso){ + bpmDataStatus="A"; + // request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + }else{ + if(aplicaDecomiso==null ||(!aplicaDecomiso.equals("Y") && !aplicaDecomiso.equals("N"))){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionesionoenaplicadecomiso")); + return; + } + inspeccionController.getRecord().setAplicadecomiso(aplicaDecomiso); + bpmDataStatus="D"; + //request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "D" : bpmDataStatus); // A,D,R + } + //request.modifiedData().put("csolicitud",codigoSolicitud); + //request.modifiedData().put("TID", tid); + bpmDataComment= inspeccionController.getRecord().getObservacion(); + //request.modifiedData().put("BPMObs", inspeccionController.getRecord().getObservacion()); + inspeccionController.getRecord().setPlanificado("T"); + inspeccionController.getRecord().setCsolicitud(codigoSolicitud); + inspeccionController.getRecord().setCtramite(solicitudArmasController.getRecord().getCtramite()); + inspeccionController.getRecord().setCsitioalmacenamiento(sitioAlmacenamiento.getPk()); + inspeccionController.getRecord().setPersoncode(tsafeUserDetail.getPk().getPersoncode()); + inspeccionController.update(); + + DtoSave dtosaveInspeccion = inspeccionController.getDtoSave(); + dtosaveInspeccion.setReturnpk(true); + + DtoSave dtosave = inspeccionArchivoController.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + + msave.put(inspeccionController.getBeanalias(), dtosaveInspeccion); // adicionar metadata de mantenimiento para cada tabla. + msave.put(inspeccionArchivoController.getBeanalias(), dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + btn=Boolean.TRUE; + btnFlujo=Boolean.TRUE; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void handleUpload(FileUploadEvent event){ + file = event.getFile(); + } + /** + * Método para cargar el archivo pdf + * @param event + */ + public void upload(FileUploadEvent event) { + file = event.getFile(); + } + /** + * Método para cargar la imagen 1 + * @param event + */ + public void upload1(FileUploadEvent event) { + uploadedFileFoto1 = event.getFile(); + } + /** + * Método para cargar la imagen 2 + * @param event + */ + public void upload2(FileUploadEvent event) { + uploadedFileFoto2 = event.getFile(); + } + /** + * Método para cargar la imagen 3 + * @param event + */ + public void upload3(FileUploadEvent event) { + uploadedFileFoto3 = event.getFile(); + } + + /** + * Método para cargar los archivos al alfresco + * */ + public Boolean saveWithDocumentAlfresco() { + try { + Boolean msgArchivos=Boolean.FALSE; + //pdf + if(file==null || file.getFileName()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingreseelformatodeinspeccion")); + msgArchivos=Boolean.TRUE; + } + if(uploadedFileFoto1==null || uploadedFileFoto1.getFileName()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingreselafoto1")); + msgArchivos=Boolean.TRUE; + } + if(uploadedFileFoto2==null || uploadedFileFoto2.getFileName()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingreselafoto2")); + msgArchivos=Boolean.TRUE; + } + if(uploadedFileFoto3==null || uploadedFileFoto3.getFileName()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingreselafoto3")); + msgArchivos=Boolean.TRUE; + } + if(msgArchivos){ + return false; + } + String xPathLocation= getRutaDocumentoSolBase() + "/cm:"+numeroSolicitud+"/cm:Inspeccion"; + + //String xphat1="FormatoInspeccion-"+forma.format(fecha)+extencionArchivo(file.getFileName()); + String xphat1=eliminaCaractersEspeciales(Utilidades.obtieneNombreLimpio(recorteNombre(file.getFileName()))); + if(alfrescoController.uploadFile(file.getInputstream(),xphat1, xPathLocation)){ + inspeccionArchivoController.create(); + inspeccionArchivoController.getRecord().setXpath(xPathLocation + "/cm:"+xphat1); + String fielname=file.getFileName(); + if(fielname.length()>99){ + fielname=fielname.substring(0, 95)+extencionArchivo(file.getFileName()); + } + inspeccionArchivoController.getRecord().setDescripcion(fielname); + inspeccionArchivoController.update(); + }else{ + return false; + } + //String xphat2="Foto1-"+forma.format(fecha)+extencionArchivo(uploadedFileFoto1.getFileName()); + String xphat2=eliminaCaractersEspeciales(Utilidades.obtieneNombreLimpio(recorteNombre(uploadedFileFoto1.getFileName()))); + if(alfrescoController.uploadFile(uploadedFileFoto1.getInputstream(),xphat2, xPathLocation)){ + inspeccionArchivoController.create(); + inspeccionArchivoController.getRecord().setXpath(xPathLocation + "/cm:"+xphat2); + String fielname=uploadedFileFoto1.getFileName(); + if(fielname.length()>99){ + fielname=fielname.substring(0, 95)+extencionArchivo(uploadedFileFoto1.getFileName()); + } + inspeccionArchivoController.getRecord().setDescripcion(fielname); + inspeccionArchivoController.update(); + }else{ + return false; + } + //String xphat3="Foto2-"+forma.format(fecha)+extencionArchivo(uploadedFileFoto2.getFileName()); + String xphat3=eliminaCaractersEspeciales(Utilidades.obtieneNombreLimpio(recorteNombre(uploadedFileFoto2.getFileName()))); + if(alfrescoController.uploadFile(uploadedFileFoto2.getInputstream(),xphat3, xPathLocation)){ + inspeccionArchivoController.create(); + inspeccionArchivoController.getRecord().setXpath(xPathLocation + "/cm:"+xphat3); + String fielname=uploadedFileFoto2.getFileName(); + if(fielname.length()>99){ + fielname=fielname.substring(0, 95)+extencionArchivo(uploadedFileFoto2.getFileName()); + } + inspeccionArchivoController.getRecord().setDescripcion(fielname); + inspeccionArchivoController.update(); + }else{ + return false; + } + //String xphat4="Foto3-"+forma.format(fecha)+extencionArchivo(uploadedFileFoto3.getFileName()); + String xphat4=eliminaCaractersEspeciales(Utilidades.obtieneNombreLimpio(recorteNombre(uploadedFileFoto3.getFileName()))); + if(alfrescoController.uploadFile(uploadedFileFoto3.getInputstream(),xphat4, xPathLocation)){ + inspeccionArchivoController.create(); + inspeccionArchivoController.getRecord().setXpath(xPathLocation + "/cm:"+xphat4); + String fielname=uploadedFileFoto3.getFileName(); + if(fielname.length()>99){ + fielname=fielname.substring(0, 95)+extencionArchivo(uploadedFileFoto3.getFileName()); + } + inspeccionArchivoController.getRecord().setDescripcion(fielname); + inspeccionArchivoController.update(); + }else{ + return false; + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + return true; + } + + public String eliminaCaractersEspeciales(String nombre){ + nombre=nombre.replace("(", ""); + nombre=nombre.replace(")", ""); + String numero="1234567890"; + if(numero.contains(nombre.substring(0, 1))){ + nombre=nombre.replace(nombre.substring(0, 1), "A"); + } + if(nombre.length()<10){ + nombre="ARC"+nombre; + } + return nombre; + } + + /** + * obtiene la extencion del archivo + * @param nombre + * @return + */ + private String extencionArchivo(String nombre){ + int pos=nombre.lastIndexOf('.'); + nombre=nombre.substring(pos); + return nombre; + } + + /** + * recorta el nombre + * @param nombre + * @return + */ + public String recorteNombre(String nombre){ + String fielname=nombre; + if(fielname.length()>30){ + fielname=fielname.substring(0,30)+extencionArchivo(nombre); + } + return fielname; + } + /** + * Retorna la ruta de documento base en donde se almacenará dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(inspeccionController.getRecord().getFecharegistro()); + StringBuilder ruta = new StringBuilder("cm:Solicitudes"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + return ruta.toString(); + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("csolicitud", codigoSolicitud); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "-" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + if(bpmDataStatus!= null && bpmDataStatus.equals("D")){ + Mapdatosmail = new HashMap(); + datosmail.put("razons",tcustPersonDetailProp.getName()); + datosmail.put("sol",solicitudArmasController.getRecord().getNumerosolicitud()); + datosmail.put("observaciones",bpmDataComment); + //grado funcionario de la persona logeada + TsafeUserDetail userDetailObj=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personDetailObj=PersonDetailController.find(userDetailObj.getPk().getPersoncode().toString()); + datosmail.put("grado",personDetailObj.getMilitarygrade()); + datosmail.put("funcionario",personDetailObj.getName()); + // Centro de control de armas + datosmail.put("centrocontrol",centroControlArmasController.getRecord().getModifiedData().get("desnombreinstitucion")); + request.modifiedData().put("datosmail", datosmail); + } + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + if(bpmDataStatus.equals("D")){ + saveAnularSolicitud(); + } + btnFlujo=Boolean.FALSE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void saveAnularSolicitud() { + try { + // CATEGORIA 14 PREVIA IMPORTACION + TarmTramite tarmTramite = TarmTramiteController.find(this.solicitudArmasController.getRecord().getCtramite().toString()); + if(tarmTramite.getCategoria().equals("14")){ + desasociarCargaSolicitud(); + } + + //Poner la solicitud en estado anulado + this.solicitudArmasController.getRecord().setEstado("ANU"); + this.solicitudArmasController.update(); + DtoSave dtoSolicitud = this.solicitudArmasController.getDtoSave(); + + TarmSolicitudTramite solicitudTramiteObj = SolicitudTramiteController.findByCSolicitud(this.solicitudArmasController.getRecord().getPk()); + if(solicitudTramiteObj!=null){ + solicitudTramiteObj.setIsnew(false); + solicitudTramiteObj.setEstadotramite("ANU"); + solicitudTramiteController.updateSolicitud(solicitudTramiteObj); + } + //Desasociar las armas en apertura de agencias y apertura de sucursales + if(this.solicitudArmasController.getRecord().getCtramite()==44 || this.solicitudArmasController.getRecord().getCtramite()==48){ + List armasSolicitudList = RecepcionArmasController.findPorSolicitud(this.solicitudArmasController.getRecord().getPk()); + for(TarmSolicitudArmas armaObj:armasSolicitudList){ + + // Codigo agencia de la solicitud + ListsolicitudAgenciaLst = SolicitudAgenciaSucursalController.findPorSolicitud(this.solicitudArmasController.getRecord().getPk()); + for(TarmSolicitudAgenciaSucursal solicitudAgenciaSucursalObj:solicitudAgenciaLst){ + String cAgencia = solicitudAgenciaSucursalObj.getPk().getCagencia().toString(); + TarmAgenciaArma agenciaArmaObj = AgenciaArmaController.findByCArma(armaObj.getPk().getCarma(), cAgencia); + agenciaArma.setRecord(agenciaArmaObj); + agenciaArma.remove(); + } + } + } + + DtoSave dtoSolicitudTramite = solicitudTramiteController.getDtoSave(); + DtoSave dtoAgenciaArma = agenciaArma.getDtoSave(); + + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + msave.put(solicitudArmasController.getBeanalias(), dtoSolicitud); // adicionar metadata de mantenimiento para cada tabla. + msave.put(solicitudTramiteController.getBeanalias(), dtoSolicitudTramite); + msave.put(agenciaArma.getBeanalias(), dtoAgenciaArma); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + solicitudArmasController.postCommit(resp); + solicitudTramiteController.postCommit(resp); + agenciaArma.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void desasociarCargaSolicitud(){ + try{ + TarmCarga carga = CargaController.findByAUCP(solicitudArmasController.getRecord().getAucp()); + if(carga!=null){ + carga.setCsolicitud(null); + cargaController.update(carga); + cargaController.save(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public InspeccionController getInspeccionController() { + return inspeccionController; + } + public void setInspeccionController(InspeccionController inspeccionController) { + this.inspeccionController = inspeccionController; + } + public SolicitudTramiteController getSolicitudTramiteController() { + return solicitudTramiteController; + } + public void setSolicitudTramiteController( + SolicitudTramiteController solicitudTramiteController) { + this.solicitudTramiteController = solicitudTramiteController; + } + public SolicitudArmasController getSolicitudArmasController() { + return solicitudArmasController; + } + public void setSolicitudArmasController( + SolicitudArmasController solicitudArmasController) { + this.solicitudArmasController = solicitudArmasController; + } + public PersonDetailController getPersondetail() { + return persondetail; + } + public void setPersondetail(PersonDetailController persondetail) { + this.persondetail = persondetail; + } + public PersonAddressController getAddress() { + return address; + } + public void setAddress(PersonAddressController address) { + this.address = address; + } + public TarmSitioAlmacenamiento getSitioAlmacenamiento() { + return sitioAlmacenamiento; + } + public void setSitioAlmacenamiento(TarmSitioAlmacenamiento sitioAlmacenamiento) { + this.sitioAlmacenamiento = sitioAlmacenamiento; + } + public Boolean getTramiteProceso() { + return tramiteProceso; + } + public void setTramiteProceso(Boolean tramiteProceso) { + this.tramiteProceso = tramiteProceso; + } + + public String getAplicaDecomiso() { + return aplicaDecomiso; + } + + public void setAplicaDecomiso(String aplicaDecomiso) { + this.aplicaDecomiso = aplicaDecomiso; + } + + public CentroControlArmasController getCentroControlArmasController() { + return centroControlArmasController; + } + + public void setCentroControlArmasController( + CentroControlArmasController centroControlArmasController) { + this.centroControlArmasController = centroControlArmasController; + } + + public TcustPersonAddress getPersonAddressDireccion() { + return personAddressDireccion; + } + + public void setPersonAddressDireccion(TcustPersonAddress personAddressDireccion) { + this.personAddressDireccion = personAddressDireccion; + } + + public TcustPersonAddress getPersonAddressCorreo() { + return personAddressCorreo; + } + + public void setPersonAddressCorreo(TcustPersonAddress personAddressCorreo) { + this.personAddressCorreo = personAddressCorreo; + } + + public PersonPhoneController getPersonPhoneController() { + return personPhoneController; + } + + public void setPersonPhoneController(PersonPhoneController personPhoneController) { + this.personPhoneController = personPhoneController; + } + + public TcustPersonDetail getTcustPersonDetailProp() { + return tcustPersonDetailProp; + } + + public void setTcustPersonDetailProp(TcustPersonDetail tcustPersonDetailProp) { + this.tcustPersonDetailProp = tcustPersonDetailProp; + } + + public TcustPersonDetail getTcustPersonDetailResp() { + return tcustPersonDetailResp; + } + + public void setTcustPersonDetailResp(TcustPersonDetail tcustPersonDetailResp) { + this.tcustPersonDetailResp = tcustPersonDetailResp; + } + + public TsafeUserDetail getTsafeUserDetail() { + return tsafeUserDetail; + } + + public void setTsafeUserDetail(TsafeUserDetail tsafeUserDetail) { + this.tsafeUserDetail = tsafeUserDetail; + } + + public TcustPersonPhone getPersonPhoneDomiProp() { + return personPhoneDomiProp; + } + + public void setPersonPhoneDomiProp(TcustPersonPhone personPhoneDomiProp) { + this.personPhoneDomiProp = personPhoneDomiProp; + } + + public TcustPersonPhone getPersonPhoneDomiResp() { + return personPhoneDomiResp; + } + + public void setPersonPhoneDomiResp(TcustPersonPhone personPhoneDomiResp) { + this.personPhoneDomiResp = personPhoneDomiResp; + } + + public TcustPersonPhone getPersonPhoneCelResp() { + return personPhoneCelResp; + } + + public void setPersonPhoneCelResp(TcustPersonPhone personPhoneCelResp) { + this.personPhoneCelResp = personPhoneCelResp; + } + + public TcustPersonAddress getPersonAddressCorreoresp() { + return personAddressCorreoresp; + } + + public void setPersonAddressCorreoresp( + TcustPersonAddress personAddressCorreoresp) { + this.personAddressCorreoresp = personAddressCorreoresp; + } + + public Integer getCodigoPersona() { + return codigoPersona; + } + + public void setCodigoPersona(Integer codigoPersona) { + this.codigoPersona = codigoPersona; + } + + public InspeccionArchivoController getInspeccionArchivoController() { + return inspeccionArchivoController; + } + + public void setInspeccionArchivoController( + InspeccionArchivoController inspeccionArchivoController) { + this.inspeccionArchivoController = inspeccionArchivoController; + } + + public UploadedFile getFile() { + return file; + } + + public void setFile(UploadedFile file) { + this.file = file; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public UploadedFile getUploadedFileFoto1() { + return uploadedFileFoto1; + } + + public void setUploadedFileFoto1(UploadedFile uploadedFileFoto1) { + this.uploadedFileFoto1 = uploadedFileFoto1; + } + + public UploadedFile getUploadedFileFoto2() { + return uploadedFileFoto2; + } + + public void setUploadedFileFoto2(UploadedFile uploadedFileFoto2) { + this.uploadedFileFoto2 = uploadedFileFoto2; + } + + public UploadedFile getUploadedFileFoto3() { + return uploadedFileFoto3; + } + + public void setUploadedFileFoto3(UploadedFile uploadedFileFoto3) { + this.uploadedFileFoto3 = uploadedFileFoto3; + } + + public String getCodigoSolicitud() { + return codigoSolicitud; + } + + public void setCodigoSolicitud(String codigoSolicitud) { + this.codigoSolicitud = codigoSolicitud; + } + + public IngresoDatosTipoTramite getTarmTramiteController() { + return tarmTramiteController; + } + + public void setTarmTramiteController( + IngresoDatosTipoTramite tarmTramiteController) { + this.tarmTramiteController = tarmTramiteController; + } + + public Boolean getTramiteProcesoNegar() { + return tramiteProcesoNegar; + } + + public void setTramiteProcesoNegar(Boolean tramiteProcesoNegar) { + this.tramiteProcesoNegar = tramiteProcesoNegar; + } + + public Boolean getBtn() { + return btn; + } + + public void setBtn(Boolean btn) { + this.btn = btn; + } + + public Boolean getBtnFlujo() { + return btnFlujo; + } + + public void setBtnFlujo(Boolean btnFlujo) { + this.btnFlujo = btnFlujo; + } + + public AgenciaArmaController getAgenciaArma() { + return agenciaArma; + } + + public void setAgenciaArma(AgenciaArmaController agenciaArma) { + this.agenciaArma = agenciaArma; + } + + public CargaController getCargaController() { + return cargaController; + } + + public void setCargaController(CargaController cargaController) { + this.cargaController = cargaController; + } + + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RegistroInspeccionPlaniNoPlaniController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RegistroInspeccionPlaniNoPlaniController.java.svn-base new file mode 100644 index 0000000..2401de1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RegistroInspeccionPlaniNoPlaniController.java.svn-base @@ -0,0 +1,725 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.sql.Date; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.SelectEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.lov.PlanificacionTramiteLovController; +import com.fp.frontend.controller.armas.lov.SitioAlmacenamientoLovController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.ins.TarmPlanificacionTramite; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmSitioAlmacenamiento; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TgeneCatalog. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RegistroInspeccionPlaniNoPlaniController extends AbstractController { + + @ManagedProperty(value = "#{inspeccionController}") + private InspeccionController inspeccionController; + + //PARA LOS ARCHIVOS + @ManagedProperty(value = "#{inspeccionArchivoController}") + private InspeccionArchivoController inspeccionArchivoController; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + @ManagedProperty(value = "#{planificacionTramiteController}") + PlanificacionTramiteController planificacionTramiteController; + + private TarmPlanificacionTramite planificacionTramite; + + private TcustPersonDetail tcustPersonDetailInspeccion; + + private TarmSitioAlmacenamiento sitioAlmacenamiento; + + private TsafeUserDetail tsafeUserDetail; + + private List lplanificacion; + /** + * Campo para seleccionar si el tramite sigue el proceso + */ + private Boolean tramiteProceso = Boolean.FALSE; + + private Boolean tramiteProcesoNegar=Boolean.FALSE; + + private Map personaPropietario; + + private TarmCentroControl centroControl; + private String aplicaDecomiso; + + private String codigoPersonaSitioAlm; + + private String numerotrabajo; + /** + * Atributos para cargar los archivos + */ + private UploadedFile file; + private UploadedFile uploadedFileFoto1; + private UploadedFile uploadedFileFoto2; + private UploadedFile uploadedFileFoto3; + /** + * campo para desabilitar el boton + */ + private Boolean btn=Boolean.FALSE; + + /** + * Constructor + * @throws Exception + */ + public RegistroInspeccionPlaniNoPlaniController() throws Exception { + super(TcustPersonDetail.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.personaPropietario = new HashMap<>(); + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "REGINSPECPLANINO"; + tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + String legalcodepla=codigoParameter("LEGALCODE.PLAN"); + lplanificacion=CatalogDetailController.find("OPERACIONINSPECCION",legalcodepla); + inspeccionController.create(); + inspeccionController.getRecord().setFecharegistro(new Date(new java.util.Date().getTime())); + numerotrabajo=null; + obtenerCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para obtener el centro de control + * @throws Exception + */ + private void obtenerCentroControl() throws Exception { + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + this.getMfilters().put("pk.personcode", tsafeUserDetail.getPk().getPersoncode().toString()); + addFilterDateto(); + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(false); + dto.setOrderby("t.pk"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); + request.setQueryTables(mtables); + request.put("queryalias", "INSPECCIONPLANIFICADA"); + request.put("querytype", "P"); + //DATOS ADICIONALES + if(planificacionTramite!=null){ + request.put("personcodepropietario", planificacionTramite.getModifiedData().get("personcode")); + codigoPersonaSitioAlm=planificacionTramite.getModifiedData().get("personcode").toString(); + } + if(tcustPersonDetailInspeccion!=null){ + request.put("personcodepropietario", tcustPersonDetailInspeccion.getPk().getPersoncode()); + codigoPersonaSitioAlm=tcustPersonDetailInspeccion.getPk().getPersoncode().toString(); + } + + request.put("ccentrocontrol","0035"); + //com.fp.armas.rules.query.solicitud.CompletaDatosInspeccionPlan + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.record = new TcustPersonDetail(); + MessageHelper.setMessageError(resp); + } else { + this.record = (TcustPersonDetail) resp.get(this.beanalias); + this.personaPropietario = (Map) resp.get("PERSONAPROPIETARIO"); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private String codigoParameter(String codigo) throws Exception{ + TgeneParameters parameter= ParametersController.find(codigo, "1"); + return parameter.getTextvalue(); + } + + public void openPlanificacionTramiteLov() { + Map> params = new HashMap<>(); + List lcat = new ArrayList<>(); + lcat.add(centroControl.getPk()); + params.put("centrocontrol", lcat); + PlanificacionTramiteLovController.openLov(params); + } + + public void onReturnPlanificacionTramiteLov(SelectEvent event) throws Exception { + planificacionTramite=(TarmPlanificacionTramite) event.getObject(); + tcustPersonDetailInspeccion=null; + querydatabase(); + } + + /** + * Método para abrir el lov de sitio de almacenamineot + */ + public void openSitioLov() { + if(codigoPersonaSitioAlm==null || codigoPersonaSitioAlm.trim().length()==0){ + MessageHelper.setMessageError("SELECCIONE UN PROPIETARIO O RESPONSABLE"); + return; + } + Map> params = new HashMap<>(); + List lcat = new ArrayList<>(); + lcat.add(codigoPersonaSitioAlm); + params.put("personcode", lcat); + SitioAlmacenamientoLovController.openLov(params); + } + + + /** + * Maneja la respuesta del Lov de Personas + * @param event + * @throws Exception + */ + public void onReturnSitioLov(SelectEvent event) throws Exception { + sitioAlmacenamiento=(TarmSitioAlmacenamiento) event.getObject(); + } + + + /** + * Método para abrir el lov de personas + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Maneja la respuesta del Lov de Personas + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + tcustPersonDetailInspeccion = (TcustPersonDetail) event.getObject(); + planificacionTramite=null; + querydatabase(); + } + + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeAprobar() { + if (tramiteProceso) { + tramiteProcesoNegar=false; + inspeccionController.getRecord().setTramiteproceso("Y"); + } else { + tramiteProcesoNegar=true; + inspeccionController.getRecord().setTramiteproceso("N"); + } + aplicaDecomiso=null; + } + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeRechazar() { + if (tramiteProcesoNegar) { + tramiteProceso=false; + inspeccionController.getRecord().setTramiteproceso("N"); + } else { + tramiteProceso=true; + inspeccionController.getRecord().setTramiteproceso("Y"); + } + aplicaDecomiso="N"; + } + + + @Override + public void save() { + Boolean msg=Boolean.FALSE; + try { + if(sitioAlmacenamiento==null || sitioAlmacenamiento.getPk()==null + || sitioAlmacenamiento.getPk().trim().length()==0){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionenesitioinspeccion")); + msg=Boolean.TRUE; + } + if(tramiteProceso== false && tramiteProcesoNegar == false){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionenegarocontinuartramiteproceso")); + msg=Boolean.TRUE; + } + if(msg){ + return; + } + HashMap msave = new HashMap(); + Request request = callerhelper.getRequest(); + if(!saveWithDocumentAlfresco()){ + return; + } + if(tramiteProceso){ + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + }else{ + if(aplicaDecomiso==null ||(!aplicaDecomiso.equals("N") && !aplicaDecomiso.equals("N"))){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionesionoenaplicadecomiso")); + return; + } + inspeccionController.getRecord().setAplicadecomiso(aplicaDecomiso); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "D" : bpmDataStatus); // A,D,R + } + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMObs", inspeccionController.getRecord().getObservacion()); + + + //actualiza el campo de la planificacion + if(planificacionTramite!=null){ + planificacionTramiteController.create(); + planificacionTramiteController.setRecord(planificacionTramite); + planificacionTramiteController.getRecord().setInspeccion("Y"); + planificacionTramiteController.actualizar(planificacionTramiteController.getRecord()); + DtoSave dtosavePlanificacion = planificacionTramiteController.getDtoSave(); + dtosavePlanificacion.setReturnpk(true); + dtosavePlanificacion.setPosition(3); + msave.put(planificacionTramiteController.getBeanalias(), dtosavePlanificacion); + inspeccionController.getRecord().setCplanificaciontramite(planificacionTramite.getPk()); + } + + inspeccionController.getRecord().setCsitioalmacenamiento(sitioAlmacenamiento.getPk()); + inspeccionController.getRecord().setPersoncode(tsafeUserDetail.getPk().getPersoncode()); + inspeccionController.getRecord().setCentrocontrol(centroControl.getPk()); + Integer canno = Calendar.getInstance().get(Calendar.YEAR); + inspeccionController.getRecord().setAnno(Long.parseLong(canno.toString())); + inspeccionController.update(); + + DtoSave dtosaveInspeccion = inspeccionController.getDtoSave(); + dtosaveInspeccion.setReturnpk(true); + dtosaveInspeccion.setPosition(2); + msave.put(inspeccionController.getBeanalias(), dtosaveInspeccion); + + DtoSave dtosave = inspeccionArchivoController.getDtoSave(); + dtosave.setReturnpk(true); + dtosave.setPosition(1); + msave.put(inspeccionArchivoController.getBeanalias(), dtosave); + + + request.setSaveTables(msave); + //com.fp.armas.rules.save.solicitud.RegistroInspeccion (TransactionRule) + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + inspeccionController.postCommit(resp); + inspeccionArchivoController.postCommit(resp); + planificacionTramiteController.postCommit(resp); + numerotrabajo=""+resp.get("numerotrabajo"); + MessageHelper.setMessageInfo(resp); + btn=Boolean.TRUE; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void handleUpload(FileUploadEvent event){ + file = event.getFile(); + } + + public void upload(FileUploadEvent event) { + file = event.getFile(); + } + public void upload1(FileUploadEvent event) { + uploadedFileFoto1 = event.getFile(); + } + public void upload2(FileUploadEvent event) { + uploadedFileFoto2 = event.getFile(); + } + public void upload3(FileUploadEvent event) { + uploadedFileFoto3 = event.getFile(); + } + + /** + * Método para cargar los archivos al alfresco + * */ + public Boolean saveWithDocumentAlfresco() { + try { + Boolean msgArchivos=Boolean.FALSE; + //pdf + if(file==null || file.getFileName()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingreseelformatodeinspeccion")); + msgArchivos=Boolean.TRUE; + } + if(uploadedFileFoto1==null || uploadedFileFoto1.getFileName()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingreselafoto1")); + msgArchivos=Boolean.TRUE; + } + if(uploadedFileFoto2==null || uploadedFileFoto2.getFileName()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingreselafoto2")); + msgArchivos=Boolean.TRUE; + } + if(uploadedFileFoto3==null || uploadedFileFoto3.getFileName()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingreselafoto3")); + msgArchivos=Boolean.TRUE; + } + if(msgArchivos){ + return false; + } + String xPathLocation=null; + if(planificacionTramite!=null){ + xPathLocation= getRutaDocumentoSolBase() + "/cm:Inspeccion/cm:NO-PLANIFICADA-"+codigoPersonaSitioAlm; + //codigoPersonaSitioAlm=planificacionTramite.getModifiedData().get("personcode").toString(); + } + if(tcustPersonDetailInspeccion!=null){ + xPathLocation= getRutaDocumentoSolBase() + "/cm:Inspeccion/cm:PLANIFICADA-"+codigoPersonaSitioAlm; + //codigoPersonaSitioAlm=tcustPersonDetailInspeccion.getPk().getPersoncode().toString(); + } + //String xphat1="FormatoInspeccion-"+forma.format(fecha)+extencionArchivo(file.getFileName()); + String xphat1=eliminaCaractersEspeciales(Utilidades.obtieneNombreLimpio(recorteNombre(file.getFileName()))); + if(alfrescoController.uploadFile(file.getInputstream(),xphat1, xPathLocation)){ + inspeccionArchivoController.create(); + inspeccionArchivoController.getRecord().setXpath(xPathLocation + "/cm:"+xphat1); + String fielname=file.getFileName(); + if(fielname.length()>99){ + fielname=fielname.substring(0, 95)+extencionArchivo(file.getFileName()); + } + inspeccionArchivoController.getRecord().setDescripcion(fielname); + inspeccionArchivoController.update(); + }else{ + return false; + } + //String xphat2="Foto1-"+forma.format(fecha)+extencionArchivo(uploadedFileFoto1.getFileName()); + String xphat2=eliminaCaractersEspeciales(Utilidades.obtieneNombreLimpio(recorteNombre(uploadedFileFoto1.getFileName()))); + if(alfrescoController.uploadFile(uploadedFileFoto1.getInputstream(),xphat2, xPathLocation)){ + inspeccionArchivoController.create(); + inspeccionArchivoController.getRecord().setXpath(xPathLocation + "/cm:"+xphat2); + String fielname=uploadedFileFoto1.getFileName(); + if(fielname.length()>99){ + fielname=fielname.substring(0, 95)+extencionArchivo(uploadedFileFoto1.getFileName()); + } + inspeccionArchivoController.getRecord().setDescripcion(fielname); + inspeccionArchivoController.update(); + }else{ + return false; + } + //String xphat3="Foto2-"+forma.format(fecha)+extencionArchivo(uploadedFileFoto2.getFileName()); + String xphat3=eliminaCaractersEspeciales(Utilidades.obtieneNombreLimpio(recorteNombre(uploadedFileFoto2.getFileName()))); + if(alfrescoController.uploadFile(uploadedFileFoto2.getInputstream(),xphat3, xPathLocation)){ + inspeccionArchivoController.create(); + inspeccionArchivoController.getRecord().setXpath(xPathLocation + "/cm:"+xphat3); + String fielname=uploadedFileFoto2.getFileName(); + if(fielname.length()>99){ + fielname=fielname.substring(0, 95)+extencionArchivo(uploadedFileFoto2.getFileName()); + } + inspeccionArchivoController.getRecord().setDescripcion(fielname); + inspeccionArchivoController.update(); + }else{ + return false; + } + //String xphat4="Foto3-"+forma.format(fecha)+extencionArchivo(uploadedFileFoto3.getFileName()); + String xphat4=eliminaCaractersEspeciales(Utilidades.obtieneNombreLimpio(recorteNombre(uploadedFileFoto3.getFileName()))); + if(alfrescoController.uploadFile(uploadedFileFoto3.getInputstream(),xphat4, xPathLocation)){ + inspeccionArchivoController.create(); + inspeccionArchivoController.getRecord().setXpath(xPathLocation + "/cm:"+xphat4); + String fielname=uploadedFileFoto3.getFileName(); + if(fielname.length()>99){ + fielname=fielname.substring(0, 95)+extencionArchivo(uploadedFileFoto3.getFileName()); + } + inspeccionArchivoController.getRecord().setDescripcion(fielname); + inspeccionArchivoController.update(); + }else{ + return false; + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + return true; + } + + public String eliminaCaractersEspeciales(String nombre){ + nombre=nombre.replace("(", ""); + nombre=nombre.replace(")", ""); + return nombre; + } + + /** + * obtiene la extencion del archivo + * @param nombre + * @return + */ + private String extencionArchivo(String nombre){ + int pos=nombre.lastIndexOf('.'); + nombre=nombre.substring(pos); + return nombre; + } + + /** + * recorta el nombre + * @param nombre + * @return + */ + public String recorteNombre(String nombre){ + String fielname=nombre; + if(fielname.length()>30){ + fielname=fielname.substring(0,30)+extencionArchivo(nombre); + } + return fielname; + } + /** + * Retorna la ruta de documento base en donde se almacenará dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(inspeccionController.getRecord().getFecharegistro()); + StringBuilder ruta = new StringBuilder("cm:Solicitudes"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + return ruta.toString(); + } + public InspeccionController getInspeccionController() { + return inspeccionController; + } + + public void setInspeccionController(InspeccionController inspeccionController) { + this.inspeccionController = inspeccionController; + } + + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public Map getPersonaPropietario() { + return personaPropietario; + } + public void setPersonaPropietario(Map personaPropietario) { + this.personaPropietario = personaPropietario; + } + + + public TarmPlanificacionTramite getPlanificacionTramite() { + return planificacionTramite; + } + + + public void setPlanificacionTramite( + TarmPlanificacionTramite planificacionTramite) { + this.planificacionTramite = planificacionTramite; + } + + + public TarmSitioAlmacenamiento getSitioAlmacenamiento() { + return sitioAlmacenamiento; + } + + + public void setSitioAlmacenamiento(TarmSitioAlmacenamiento sitioAlmacenamiento) { + this.sitioAlmacenamiento = sitioAlmacenamiento; + } + + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + + public Boolean getTramiteProceso() { + return tramiteProceso; + } + + + public void setTramiteProceso(Boolean tramiteProceso) { + this.tramiteProceso = tramiteProceso; + } + + + public TsafeUserDetail getTsafeUserDetail() { + return tsafeUserDetail; + } + + + public void setTsafeUserDetail(TsafeUserDetail tsafeUserDetail) { + this.tsafeUserDetail = tsafeUserDetail; + } + + + public Boolean getTramiteProcesoNegar() { + return tramiteProcesoNegar; + } + + + public void setTramiteProcesoNegar(Boolean tramiteProcesoNegar) { + this.tramiteProcesoNegar = tramiteProcesoNegar; + } + + + public String getAplicaDecomiso() { + return aplicaDecomiso; + } + + + public void setAplicaDecomiso(String aplicaDecomiso) { + this.aplicaDecomiso = aplicaDecomiso; + } + + + public UploadedFile getFile() { + return file; + } + + + public void setFile(UploadedFile file) { + this.file = file; + } + + + public UploadedFile getUploadedFileFoto1() { + return uploadedFileFoto1; + } + + + public void setUploadedFileFoto1(UploadedFile uploadedFileFoto1) { + this.uploadedFileFoto1 = uploadedFileFoto1; + } + + + public UploadedFile getUploadedFileFoto2() { + return uploadedFileFoto2; + } + + + public void setUploadedFileFoto2(UploadedFile uploadedFileFoto2) { + this.uploadedFileFoto2 = uploadedFileFoto2; + } + + + public UploadedFile getUploadedFileFoto3() { + return uploadedFileFoto3; + } + + + public void setUploadedFileFoto3(UploadedFile uploadedFileFoto3) { + this.uploadedFileFoto3 = uploadedFileFoto3; + } + + public List getLplanificacion() { + return lplanificacion; + } + + public void setLplanificacion(List lplanificacion) { + this.lplanificacion = lplanificacion; + } + + public InspeccionArchivoController getInspeccionArchivoController() { + return inspeccionArchivoController; + } + + public void setInspeccionArchivoController( + InspeccionArchivoController inspeccionArchivoController) { + this.inspeccionArchivoController = inspeccionArchivoController; + } + + public PlanificacionTramiteController getPlanificacionTramiteController() { + return planificacionTramiteController; + } + + public void setPlanificacionTramiteController( + PlanificacionTramiteController planificacionTramiteController) { + this.planificacionTramiteController = planificacionTramiteController; + } + + public TcustPersonDetail getTcustPersonDetailInspeccion() { + return tcustPersonDetailInspeccion; + } + + public void setTcustPersonDetailInspeccion( + TcustPersonDetail tcustPersonDetailInspeccion) { + this.tcustPersonDetailInspeccion = tcustPersonDetailInspeccion; + } + + public Boolean getBtn() { + return btn; + } + + public void setBtn(Boolean btn) { + this.btn = btn; + } + + public String getCodigoPersonaSitioAlm() { + return codigoPersonaSitioAlm; + } + + public void setCodigoPersonaSitioAlm(String codigoPersonaSitioAlm) { + this.codigoPersonaSitioAlm = codigoPersonaSitioAlm; + } + + public String getNumerotrabajo() { + return numerotrabajo; + } + + public void setNumerotrabajo(String numerotrabajo) { + this.numerotrabajo = numerotrabajo; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteAgenciasSucursalesController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteAgenciasSucursalesController.java.svn-base new file mode 100644 index 0000000..1537d65 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteAgenciasSucursalesController.java.svn-base @@ -0,0 +1,239 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Controlador principal Consulta Agencias y Sucursales + * + */ +@SuppressWarnings("serial") +@ManagedBean(name="reporteAgenciasSucursalesController") +@ViewScoped +public class ReporteAgenciasSucursalesController extends AbstractController { + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + private String institucionCentroControl=""; + private TarmCentroControl centroControl = new TarmCentroControl(); + + /** + * Nombre/razón social + */ + private String nombreRazonSocial; + /** + * numedo de identificacion + */ + private String numeroDocumento; + + /** + * Filtro de los codigos de los tramites + */ + private String filtro; + + /** + * Codigo de la persona + */ + private Integer personcode; + + + public ReporteAgenciasSucursalesController() throws Exception { + super(AbstractDataTransport.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "REPORTEAGENCIASUCURSAL"; + TsafeUserDetail userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TgeneParameters parametroCodigosTramite = ParametersController.find("CODTRAMAGESUC", userDetail.getCompanycode().toString()); + filtro=parametroCodigosTramite.getTextvalue(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + protected void querydatabase() { + } + + @Override + public void save() { + } + + /** + * Abre el lov de persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Maneja la respuesta del Lov de Personas + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + + TcustPersonDetail personaDetailSelecionada = (TcustPersonDetail) event.getObject(); + nombreRazonSocial=personaDetailSelecionada.getName(); + numeroDocumento=personaDetailSelecionada.getIdentification(); + personcode=personaDetailSelecionada.getPk().getPersoncode(); + } + + /** + * Metodo que se debe ejecutar cuando es una transaccion de tipo verificar armas + * @throws Exception + */ + private void obtenerCentroControl() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + public void generarReporte(){ + if(personcode==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_seleccione_nombre")); + return; + } + String path = "armas/reports/reporteAgenciaSucursal"; + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + TsafeUserDetail userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + if(userDetail.getPk().getPersoncode()!=null){ + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + } + else{ + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario); + obtenerCentroControl(); + parameters.put("unidadmilitar", institucionCentroControl); + + parameters.put("nombreRazonSocial", nombreRazonSocial); + parameters.put("centroControl", institucionCentroControl); + Date fechaActual= new Date(); + SimpleDateFormat parseador = new SimpleDateFormat("dd/MM/yyyy hh:mm"); + parameters.put("fecActual", parseador.format(fechaActual)); + + parameters.put("filtro",filtro); + parameters.put("filtro2",personcode); + + String format="pdf"; + String filename="Certificado"; + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getNombreRazonSocial() { + return nombreRazonSocial; + } + + public void setNombreRazonSocial(String nombreRazonSocial) { + this.nombreRazonSocial = nombreRazonSocial; + } + + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public Integer getPersoncode() { + return personcode; + } + + public void setPersoncode(Integer personcode) { + this.personcode = personcode; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteAutorizacionesController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteAutorizacionesController.java.svn-base new file mode 100644 index 0000000..59a2868 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteAutorizacionesController.java.svn-base @@ -0,0 +1,576 @@ +package com.fp.frontend.controller.armas.solicitud; + + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.common.helper.Constant; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.BuscarTramiteLovController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.OrigenTramiteController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmOrigenTramite; +import com.fp.persistence.parmas.param.TarmRequisitoPorTipoTramite; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitosKey; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de reporte de liquidacion economica + * + * @author Christian Pazmino. + * @version 2.1 + */ + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReporteAutorizacionesController extends AbstractController { + + /** + * Fecha a partir de la cual se sacan datos para el reporte + * */ + + /** + * Controlador que maneja las armas dentro de la solicitud + */ + @ManagedProperty(value = "#{solicitudArmasController}") + private SolicitudArmasController solicitud; + + + private TarmTramite tarmTramite; + + TgeneCatalogDetail tipoTramite = null ; + TgeneCatalogDetail tipoAutorizacion = null; + TgeneCatalogDetail actividad = null; + TgeneCatalogDetail categoria = null; + + /** + * Habilita campos en actualización de datos generales + */ + private boolean actualizaDatosGenerales; + + /** + * Aprueba si es guía de libre tránsito + */ + private boolean guiaLibreTransito; + + /** + * Indica si se debe activar la pestana de ingresar requisitos + */ + private boolean ingresarRequisitos; + + /** + * Indica si se debe activar la pestana de seleccionar armas + */ + private boolean seleccionarArmas; + + private Date fechaInicio; + /** + * Fecha a partir de la cual se sacan datos para el reporte + * */ + private Date fechaFin; + /** + * Formato de reporte que se va a generar + * */ + private String format = "pdf"; + /** + * Usuario actual logueado en el sistema + * */ + private TsafeUserDetail userDetail; + /** + * Nombre del reporte generado en el Alfresco + * */ + private String nombreReporte; + + /** + * Id del centro de control seleccionado por el usuario + * */ + private String idCentroControl; + + /** + * Id del tipo de tramite + */ + private String idAutorizacion; + private String idIdentificacion; + + private String numeroDocumento; + + private String idCategoria; + + private String idActividad; + + /** + * Id del tipo de tramite + */ + private String idControl; + + /** + * Lista de centros de control de armas + */ + // private List centroControlList; + private List tipoDocumentoList; + + private List centroControlList; + + private List autorizacionList; + + private List categoriaList; + + private List actividadList; + + private List controlList; + + private TgeneCatalogDetail tipoControl = new TgeneCatalogDetail(); + + private String institucionCentroControl=""; + private TarmCentroControl centroControl = new TarmCentroControl(); + + + + /** + * Clase controladora de reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{logincontroller}") + private LoginController logincontroller; + + + public ReporteAutorizacionesController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + recperpage = 10000; // Cambiar al # reg a mirar. + beanalias = "RPRTEAUTORIZACIONES"; + // centroControlList = CentroControlArmasController.findAll(); + centroControlList = CatalogDetailController.find("ESTADOAUTORIZACION"); + // autorizacionList = CatalogDetailController.find("TIPOAUTORIZACION"); // tipo de tramite + // categoriaList = CatalogDetailController.find("CATEGORIA"); //catetegoria + // actividadList = CatalogDetailController.find("USOACTIVIDAD"); // actividad + tipoDocumentoList = CatalogDetailController.find("IDENTIFICATION"); + controlList = CatalogDetailController.find("NOMBREINSTITUCION"); + //obtenerCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + + } + + /** + * Metodo para reconsultar en base a una nueva fecha de corte seleccionada + */ + public void cambioFechaDeCorte(SelectEvent event){ + querydatabase(); + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport() { + + if(this.tipoTramite == null){ + MessageHelper.setMessageError("ERROR: CAMPO TIPO TRMITE REQUERIDO"); + return; + } + + + if(this.fechaInicio!=null || this.fechaFin!=null) + { + if(this.fechaInicio.getTime() > this.fechaFin.getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaFin")); + return; + } + if(this.fechaInicio.getTime() > new Date().getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaActual")); + return; + } + if(this.fechaFin.getTime() > new Date().getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaFinMayorAFechaActual")); + return; + } + } + + Calendar fechaActualCldr = Calendar.getInstance(); + String path = "armas/reports/autorizaciones"; + String filename="autorizaciones"; + String nombreUsuario=""; + + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + + if(userDetail.getPk().getPersoncode()!=null){ + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } + else{ + nombreUsuario = ""; + } + // institucionCentroControl + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + //parameters.put("unidadmilitar", "hola"); + parameters.put("lugarFecha", Utilidades.armarFormatoFechaConHora(fechaActualCldr)); + parameters.put("usuario", nombreUsuario); + parameters.put("numeroDocumento"," ".equalsIgnoreCase(numeroDocumento)?null:numeroDocumento); + parameters.put("idControl", "TODOS".equalsIgnoreCase(idControl)?null:idControl); //centro de control + parameters.put("idCentroControl","TODOS".equalsIgnoreCase(idCentroControl)?null:idCentroControl); // estado + //parameters.put("idAutorizacion", "TODOS".equalsIgnoreCase(idAutorizacion)?null:idAutorizacion); // tipo de tramite + //parameters.put("idCategoria", "TODOS".equalsIgnoreCase(idCategoria)?null:idCategoria); // categoria + //parameters.put("idActividad", "TODOS".equalsIgnoreCase(idActividad)?null:idActividad); // uso actividad + parameters.put("idIdentificacion", "TODOS".equalsIgnoreCase(idIdentificacion)?null:idIdentificacion); // tipo de identificacion + parameters.put("fechaInicio", this.fechaInicio==null?null:Utilidades.armarFormatoFechaSinHora(this.fechaInicio)); + parameters.put("fechaFin", this.fechaFin==null?null:Utilidades.armarFormatoFechaSinHora(this.fechaFin)); + TgeneCatalogDetail obj = CatalogDetailController.findCatalogo("NOMBREINSTITUCION", idControl); + parameters.put("tipocentro", "TODOS".equalsIgnoreCase(idControl)?"TODOS":obj.getDescription()) ; //centro de control detalle + TgeneCatalogDetail obj1 = CatalogDetailController.findCatalogo("ESTADOAUTORIZACION", idCentroControl); + parameters.put("pestado", "TODOS".equalsIgnoreCase(idCentroControl)?"TODOS":obj1.getDescription()) ; //estado detalle + TgeneCatalogDetail obj2 = CatalogDetailController.findCatalogo("IDENTIFICATION", idIdentificacion); + parameters.put("pdocumento", "TODOS".equalsIgnoreCase(idIdentificacion)?"TODOS":obj2.getDescription()) ; //tipo documento detalle + + parameters.put("idAutorizacion", tipoAutorizacion.getPk().getCatalog()); + parameters.put("idCategoria", categoria.getPk().getCatalog()); + parameters.put("idActividad", actividad.getPk().getCatalog()); + parameters.put("Tipotramite", tipoTramite.getPk().getCatalog()); + + + + try{ + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + + } + + + /** + * Abre el LOV de trámite + */ + public void openLovTramite() { + Map> params = new HashMap>(); + List ltipopersona = new ArrayList<>(); + ltipopersona = null; + params.put("tipopersonasol", ltipopersona); + BuscarTramiteLovController.openLov(params); + } + + + + /** + * Regresa del LOV para cargar valores + * @param event {@link SelectEvent} + */ + public void onReturnTramite(SelectEvent event) { + try{ + TarmTramite tramite = (TarmTramite) event.getObject(); + this.tarmTramite = tramite; +// if(!procedeTramite(TarmTramiteController.find(tramite.getCtramitepadre() != null ? tramite.getCtramitepadre().toString() : "-1"),tramite.getPk())){ + + + solicitud.getRecord().setCtramite(tramite.getPk()); + tipoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + tipoAutorizacion = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + categoria = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + actividad = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + this.getSolicitud().addField("tipoTramite", tipoTramite.getDescription()); + this.getSolicitud().addField("tipoAutorizacion", tipoAutorizacion.getDescription()); + this.getSolicitud().addField("categoria", categoria.getDescription()); + this.getSolicitud().addField("actividad", actividad.getDescription()); + + + + + } catch(Throwable e){ + MessageHelper.setMessageError(e); + } + + + } + + private void obtenerCentroControl() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + + /** + * Método para el inicio de flujo. Guardar el reporte creado para su posterior aprobacion en otras instancias del flujo + */ + @Override + public void save(){ + + } + + public Date getFechaInicio() { + return fechaInicio; + } + + public void setFechaInicio(Date fechaInicio) { + this.fechaInicio = fechaInicio; + } + + public Date getFechaFin() { + return fechaFin; + } + + public void setFechaFin(Date fechaFin) { + this.fechaFin = fechaFin; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public String getNombreReporte() { + return nombreReporte; + } + + public void setNombreReporte(String nombreReporte) { + this.nombreReporte = nombreReporte; + } + + public String getIdCentroControl() { + return idCentroControl; + } + + public void setIdCentroControl(String idCentroControl) { + this.idCentroControl = idCentroControl; + } + + public String getIdAutorizacion() { + return idAutorizacion; + } + + public void setIdAutorizacion(String idAutorizacion) { + this.idAutorizacion = idAutorizacion; + } + + //idIdentificacion + + public String getIdIdentificacion() { + return idIdentificacion; + } + + public void setIdIdentificacion(String idIdentificacion) { + this.idIdentificacion = idIdentificacion; + } + //public List getCentroControlList() { +// return centroControlList; + //} + + //public void setCentroControlList(List centroControlList) { + //this.centroControlList = centroControlList; + //} + + public List getCentroControlList() { + return centroControlList; + } + + public void setCentroControlList(List centroControlList) { + this.centroControlList = centroControlList; + } + + /*CFLORES*/ + public List getTipoDocumentoList() { + return tipoDocumentoList; + } + + public void getTipoDocumentoList(List tipoDocumentoList) { + this.tipoDocumentoList = tipoDocumentoList; + } + /**/ + + public List getAutorizacionList() { + return autorizacionList; + } + + public void setAutorizacionList(List autorizacionList) { + this.autorizacionList = autorizacionList; + } + + /*cflores*/ + public List getControlList() { + return controlList; + } + + public void setControlList(List controlList) { + this.controlList = controlList; + } + + public String getIdControl() { + return idControl; + } + + public void setIdControl(String idControl) { + this.idControl = idControl; + } + /*categoria*/ + public List getCategoriaList() { + return categoriaList; + } + + public void setCategoriaList(List categoriaList) { + this.categoriaList = categoriaList; + } + + public String getIdCategoria() { + return idCategoria; + } + + public void setIdCategoria(String idCategoria) { + this.idCategoria = idCategoria; + } + /**/ + + /*actividad*/ + public List getActividadList() { + return actividadList; + } + + public void setActividadList(List actividadList) { + this.actividadList = actividadList; + } + + public String getIdActividad() { + return idActividad; + } + + public void setIdActividad(String idActividad) { + this.idActividad = idActividad; + } + /**/ + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + /**/ + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public LoginController getLogincontroller() { + return logincontroller; + } + + public void setLogincontroller(LoginController logincontroller) { + this.logincontroller = logincontroller; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + /** + * Entrega el valor de: solicitud + * + * @return SolicitudArmasController + */ + public SolicitudArmasController getSolicitud() { + return solicitud; + } + + /** + * Fija el valor de: solicitud + * + * @param solicitud Valor a fijar en el atributo. + */ + public void setSolicitud(SolicitudArmasController solicitud) { + this.solicitud = solicitud; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteConsultaSolicitudClienteController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteConsultaSolicitudClienteController.java.netbeans-base new file mode 100644 index 0000000..0112405 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteConsultaSolicitudClienteController.java.netbeans-base @@ -0,0 +1,971 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.PredicateUtils; +import org.apache.commons.collections.TransformerUtils; +import org.primefaces.context.RequestContext; + +import com.fp.common.helper.Constant; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.CargaController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.GuardiasController; +import com.fp.frontend.controller.armas.parametros.RequisitoController; +import com.fp.frontend.controller.pcustomer.PeopleController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.PersonPhoneController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.controller.pgeneral.safe.UserDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.parmas.soli.TarmSolicitudGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitos; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@ManagedBean +@ViewScoped +public class ReporteConsultaSolicitudClienteController extends + AbstractController { + + private static final long serialVersionUID = -4049698904561227471L; + + /** + * Lista de tipos de persona. + */ + private List ltipopersona; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de identificación + */ + private List ltipoidenti; + + /** + * Lista de tipos de trámite. + */ + private List ltipotramite; + + /** + * Lista de origen de adquisición + */ + private List lorigenadquisicion; + /** + * Bandera que indica si existe o no un registro para mostrar la solicitud + */ + private boolean existeSolicitud; + /** + * Indica si se debe activar la pestana de ingresar requisitos + */ + private boolean ingresarRequisitos; + + /** + * Indica si se debe activar la pestana de seleccionar armas + */ + private boolean seleccionarArmas; + + /** + * Indica si se debe activar la pestana seleccionar guardias + */ + private boolean seleccionarGuardias; + + /** + * Indica si se debe activar la pestana seleccionar agencias + */ + private boolean seleccionarAgencias; + + /** + * Indica si se debe activar la pestana listar guardias + */ + private boolean listarDocumentos; + + private List lprovincias; + private List lcantones; + private List lparroquias; + private List lcities; + + private List lmarca; + /** + * Controlador de la solicitud + */ + /** + * Controlador que maneja el usuario + */ + @ManagedProperty(value = "#{userDetailController}") + private UserDetailController detalleusuario; + + /** + * Controlador que maneja las armas dentro de la solicitud + */ +// @ManagedProperty(value = "#{solicitudArmasBPMController}") +// private SolicitudArmasBPMController solicitud; + + @ManagedProperty(value = "#{solicitudArmasController}") + private SolicitudArmasController solicitud; + + /** + * Controlador que maneja la persona + */ + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController detallepersona; + + /** + * Controlador que maneja los datos de personas naturales + */ + @ManagedProperty(value = "#{peopleController}") + private PeopleController natural; + + /** + * Controlador que maneja direcciones de la persona + */ + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController direccion; + + /** + * Controlador que maneja teléfonos de la persona + */ + @ManagedProperty(value = "#{personPhoneController}") + private PersonPhoneController telefono; + + /** + * Controlador que maneja requisitos dentro de la solicitud + */ + @ManagedProperty(value = "#{solicitudRequisitosController}") + private SolicitudRequisitosController requisitos; + + /** + * Controlador que maneja los guardias en la solicitud + */ + @ManagedProperty(value = "#{solicitudGuardiasController}") + private SolicitudGuardiasController solicitudGuardias; + + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{armasController}") + private ArmasController armas; + + /** + * Controlador que maneja las armas dentro de la solicitud + */ + @ManagedProperty(value = "#{recepcionArmasController}") + private RecepcionArmasController solicitudArmas; + + /** + * Controlador que maneja registro de armas + */ + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmas; + + /** + * Controlador que maneja agencias y sucursales + */ + @ManagedProperty(value = "#{agenciaSucursalController}") + private AgenciaSucursalController agenciaSucursal; + + /** + * Controlador que maneja las agencias y sucursales dentro de la solicitud + */ + @ManagedProperty(value = "#{solicitudAgenciaSucursalController}") + private SolicitudAgenciaSucursalController solicitudAgenciaSucursal; + + /** + * Controlador que maneja los documentos habilitantes + */ + @ManagedProperty(value = "#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitante; + + /** + * Controlador que maneja los documentos dentro de la solicitud + */ + @ManagedProperty(value = "#{tarmSolicitudDocumentoController}") + private TarmSolicitudDocumentoController solicitudDocumento; + + /** + * Controlador que maneja cargas para previa importacion + */ + @ManagedProperty(value = "#{cargaController}") + private CargaController cargaController; + + private Boolean requiereNoSolAucpBln; + + /** + *Referencia al Centro de control; + */ + private TarmCentroControl centroControl = new TarmCentroControl(); + + /** + *Nombre de la Institucion + */ + private String nombreInstitucion; + + private TsafeUserDetail userDetail; + + /** + * + * @throws Exception + */ + public ReporteConsultaSolicitudClienteController() throws Exception{ + super(AbstractDataTransport.class); + } + + /** + * postCosntruct + * @throws Exception + */ + @PostConstruct + private void postconstruct() throws Exception{ + this.init(); + requiereNoSolAucpBln=Boolean.FALSE; + this.startQuery(); + } + + private void init(){ + this.beanalias = "REPORTESOLICITUD"; + ltipopersona = CatalogDetailController.find("PERSONTYPE"); + ltipoidenti = CatalogDetailController.find("IDENTIFICATION"); + ltipotramite = CatalogDetailController.find("TIPOTRAMITE"); + lorigenadquisicion = CatalogDetailController.find("ORIGENADQUISICION"); + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + } + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + //Realizo las busquedas en base a los controladores + try { + limpiaDatos(); +// if(solicitud.getRecord() == null || solicitud.getRecord().getPk()==null){ + Utilidades.caracterEspecial(solicitud.getMfilters().get("numerosolicitud")); + solicitud.query(); +// } + if(solicitud.getRecord() != null && solicitud.getRecord().getPk() != null){ + //Valida que corresponda al mismo cliente + if(!userDetail.getPk().getPersoncode().equals(solicitud.getRecord().getPersoncode())){ + MessageHelper.setMessageWarn("Solicitud no corresponde a la persona"); + return; + } + + if(this.solicitud.getMfilters().get("numerosolicitud")==null || this.solicitud.getMfilters().get("numerosolicitud").equals("")) + this.solicitud.getMfilters().put("numerosolicitud",solicitud.getRecord().getNumerosolicitud()); + existeSolicitud = Boolean.TRUE; +// solicitud.setRecord(solicitud.getLrecord().get(0)); + detallepersona.getMfilters().clear(); + detallepersona.getMfilters().put("pk.personcode", solicitud.getRecord().getPersoncode().toString()); + detallepersona.addFilterDateto(); + detallepersona.query(); + + natural.getMfilters().clear(); + natural.addPersoncodeFilter(solicitud.getRecord().getPersoncode().toString()); + natural.addFilterDateto(); + natural.query(); + + direccion.getMfilters().clear(); + direccion.addPersoncodeFilter(solicitud.getRecord().getPersoncode().toString()); + direccion.addFilterDateto(); + direccion.query(); + + this.obtenerDireccionesGenerales(); + + telefono.getMfilters().clear(); + telefono.addPersoncodeFilter(solicitud.getRecord().getPersoncode().toString()); + telefono.addFilterDateto(); + telefono.query(); + this.obtenerTelefonos(); +// this.setearCodigoCentroControl(); + this.setearTramite(); + } else{ + existeSolicitud = Boolean.FALSE; + } + } catch (Throwable e) { + // TODO Auto-generated catch block + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void loadEdit() throws Exception { + //TarmArmas arma = ((TarmArmas) solicitudArmas.getRecord().getModifiedData().get("arma")); + TarmArmas arma = ArmasController.findxCodigo(solicitudArmas.getRecord().getModifiedData().get("carma").toString()); + if(arma.getCountrycode() == null){ + arma.setCountrycode("EC"); + } + this.lmarca =(List) ArmasController.findxCodigo(solicitudArmas.getRecord().getModifiedData().get("carma").toString()).getModifiedData().get("lmarca"); + lprovincias = ProvinceController.find(arma.getCountrycode()); + executeProvince(arma); + if(arma.getProvincecode() != null){ + lcantones = CantonController.find(arma.getCountrycode(), arma.getProvincecode()); + executeCanton(arma); + } + completaInfTipoArma(arma); + registroArmas.clearAll(); + if(arma.getCregistro() != null){ + registroArmas.addFilter("pk", arma.getCregistro().toString()); + registroArmas.query(); + List registroArmasList = registroArmas.getLrecord(); + registroArmas.setRecord(registroArmasList.get(0)); + registroArmas.getRecord().setIsnew(Boolean.FALSE); + } + + } + + public void loadShowAgencia() { + TarmAgenciaSucursal tarmAgenciaSucursal = (TarmAgenciaSucursal) solicitudAgenciaSucursal.getRecord().getModifiedData().get("agencia"); + lprovincias = ProvinceController.find(tarmAgenciaSucursal.getCountrycode()); + lcantones = CantonController.find(tarmAgenciaSucursal.getCountrycode(), tarmAgenciaSucursal.getProvincecode()); + lparroquias = ParroquiaController.find(tarmAgenciaSucursal.getCountrycode(), tarmAgenciaSucursal.getProvincecode(), tarmAgenciaSucursal.getCantoncode()); + lcities = CityController.find(tarmAgenciaSucursal.getCountrycode(), tarmAgenciaSucursal.getProvincecode(), tarmAgenciaSucursal.getCantoncode()); + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince(TarmArmas arma) { + if ((arma != null) && (arma.getCountrycode().compareTo("") != 0)) { + lcantones = CantonController.find(arma.getCountrycode(), arma.getProvincecode()); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton(TarmArmas arma) { + //TarmArmas arma = (((TarmArmas) solicitudArmas.getRecord().getModifiedData().get("arma"))); + if (arma.getCountrycode() != null && arma.getCountrycode().compareTo("") != 0) { + lparroquias = ParroquiaController.find(arma.getCountrycode(), + arma.getProvincecode(), + arma.getCantoncode()); + lcities = CityController.find(arma.getCountrycode(), arma.getProvincecode(), arma.getCantoncode()); + } + } + + private void limpiaDatos(){ + this.detallepersona.clearAll(); + this.detalleusuario.clearAll(); + this.agenciaSucursal.clearAll(); + this.armas.clearAll(); + this.direccion.clearAll(); + this.documentoHabilitante.clearAll(); + this.natural.clearAll(); + this.registroArmas.clearAll(); + this.requisitos.clearAll(); + this.solicitudAgenciaSucursal.clearAll(); + this.solicitudArmas.clearAll(); + this.solicitudDocumento.clearAll(); + this.solicitudGuardias.clearAll(); + this.telefono.clearAll(); + existeSolicitud = Boolean.FALSE; + } + + /** + * Método que completa la informaci´n del arma una vez se presiona el botón crear + */ + private void completaInfTipoArma(TarmArmas arma){ + solicitudArmas.getRecord().getModifiedData().put("estado", arma.getEstado()); + solicitudArmas.getRecord().getModifiedData().put("marca", arma.getMarca()); +// record.setCountrycode("EC"); +// clase = ((TarmArmas)record.getModifiedData().get("arma")).getModifiedData().get("cclase") != null ? ((TarmArmas)record.getModifiedData().get("arma")).getModifiedData().get("cclase").toString() : null; +// calibre = record.getModifiedData().get("ccalibre") != null ? record.getModifiedData().get("ccalibre").toString() : null; +// longitud = record.getModifiedData().get("clongitud") != null ? record.getModifiedData().get("clongitud").toString() : null; +// tipoarma = record.getModifiedData().get("ctipoarmaexplosivo") != null ? record.getModifiedData().get("ctipoarmaexplosivo").toString() : null; + } + + /** + * Recupera en base al tipo de identificación la dirección de la oficina o de la casa + */ + private void obtenerDireccionesGenerales(){ + TcustPersonAddress direccionPersona = null; + direccionPersona = direccion.findPrincipal(detallepersona.getRecord().getPk().getPersoncode().toString()); + + if(direccionPersona != null){ + direccion.getMfilelds().put("solcodpais", direccionPersona.getCountrycode()); + direccion.getMfilelds().put("solcodprovincia", direccionPersona.getProvincecode()); + direccion.setLprovinces(ProvinceController.find(direccionPersona.getCountrycode())); + direccion.getMfilelds().put("solcodcanton", direccionPersona.getCantoncode()); + direccion.setLcantones(CantonController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode())); + direccion.getMfilelds().put("solcodciudad", direccionPersona.getCitycode()); + direccion.setLcities(CityController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode(), direccionPersona.getCantoncode())); + direccion.getMfilelds().put("solcodparroquia", direccionPersona.getParroquiacode()); + direccion.setLparroquias(ParroquiaController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode(), direccionPersona.getCantoncode())); + direccion.getMfilelds().put("soldireccion", direccionPersona.getAddress()); + } + + TcustPersonAddress correo = (TcustPersonAddress) CollectionUtils.find(direccion.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getAddresstypecatalog"), PredicateUtils.equalPredicate("3"))); + if(correo != null){ + direccion.getMfilelds().put("solcorreopersona", correo.getAddress()); + } + } + + /** + * Retorna el telefono fijo y celular de la persona + */ + private void obtenerTelefonos(){ + TcustPersonPhone telf = null; + telf = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getPhonetypecatalog"), PredicateUtils.equalPredicate("1"))); + if(telf != null){ + telefono.getMfilelds().put("soltelfijo", telf.getPhonenumber()); + } + telf = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getPhonetypecatalog"), PredicateUtils.equalPredicate("2"))); + if(telf != null){ + telefono.getMfilelds().put("soltelcelular", telf.getPhonenumber()); + } + } + + + /** + * En base a la provincia y sus jurisdicciones se obtiene y se coloca el centro de control + */ + /*private void setearCodigoCentroControl(){ + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(direccion.getMfilelds().get("solcodprovincia") != null ? + direccion.getMfilelds().get("solcodprovincia").toString() : StringUtils.EMPTY); + if(centroControlJur != null){ + this.solicitud.getRecord().setCcentrocontrol(centroControlJur.getCcentrocontrol()); + } + }*/ + + /** + * + */ + private void setearTramite() { + try{ + if(solicitud.getRecord().getCtramite()==null){ + return; + } + TarmTramite tramite = TarmTramiteController.find(solicitud.getRecord().getCtramite().toString()); + solicitud.getRecord().setCtramite(tramite.getPk()); + TgeneCatalogDetail tipoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + TgeneCatalogDetail tipoAutorizacion = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail categoria = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + TgeneCatalogDetail actividad = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + this.getSolicitud().addField("tipoTramite", tipoTramite.getDescription()); + this.getSolicitud().addField("tipoAutorizacion", tipoAutorizacion.getDescription()); + this.getSolicitud().addField("categoria", categoria.getDescription()); + this.getSolicitud().addField("actividad", actividad.getDescription()); + this.ingresarRequisitos = Boolean.TRUE; + obtenerCentroControl(solicitud.getRecord()); + if(tramite.getCategoria().equals("14")){ + requiereNoSolAucpBln=Boolean.TRUE; + }else{ + requiereNoSolAucpBln=Boolean.FALSE; + } + if(Constant.ifYes(tramite.getRegistroarmas())){ + this.seleccionarArmas = Boolean.TRUE; + this.cargaArmas(); + }else{ + this.seleccionarArmas = Boolean.FALSE; + this.solicitudArmas.clearAll(); + } + if(Constant.ifYes(tramite.getRegistroguardia())){ + this.seleccionarGuardias = Boolean.TRUE; + this.cargaGuardias(); + }else{ + this.seleccionarGuardias = Boolean.FALSE; + this.solicitudGuardias.clearAll(); + } + if(Constant.ifYes(tramite.getRegistroagenciasucursal())){ + this.seleccionarAgencias = Boolean.TRUE; + this.cargarAgencias(); + }else{ + this.seleccionarAgencias = Boolean.FALSE; + this.solicitudAgenciaSucursal.clearAll(); + } + + if(Constant.ifYes(tramite.getDocumentohabilitante()) || tipoTramite.getPk().getCatalog().equals(ParametersController.find("CODIGO.TRAMITEREIMPRESION", "1").getTextvalue())){ + this.listarDocumentos = Boolean.TRUE; + this.cargarDocumentos(); + }else{ + this.listarDocumentos = Boolean.FALSE; + this.solicitudDocumento.clearAll(); + } + + if(tramite != null){ + this.cargarRequisitos(); + } + } catch(Throwable e){ + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * @param solicitud + * @throws Exception + * + */ + private void obtenerCentroControl(TarmSolicitud solicitud) throws Exception { + + this.centroControl= CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + this.setNombreInstitucion(CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + + } + + private void cargaArmas() throws Exception{ + + solicitudArmas.clearAll(); + solicitudArmas.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudArmas.setCodigoSolicitud(solicitud.getRecord().getPk()); + solicitudArmas.setRecperpage(5000); + solicitudArmas.querydatabase(); + } + + + private void cargaGuardias() throws Exception{ + solicitudGuardias.clearAll(); + solicitudGuardias.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudGuardias.query(); + for (TarmSolicitudGuardias solicitudGuardia : solicitudGuardias.getLrecord()) { + solicitudGuardia.getModifiedData().put("guardia", GuardiasController.find(solicitudGuardia.getPk().getCguardia().toString(), solicitudGuardia.getPk().getCempresa().toString())); + } + } + + private void cargarAgencias() throws Exception{ + solicitudAgenciaSucursal.clearAll(); + solicitudAgenciaSucursal.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudAgenciaSucursal.query(); + for (TarmSolicitudAgenciaSucursal solAgenciaSucursal : solicitudAgenciaSucursal.getLrecord()) { + solAgenciaSucursal.getModifiedData().put("agencia", AgenciaSucursalController.find(solAgenciaSucursal.getPk().getCagencia().toString())); + } + } + + private void cargarDocumentos() throws Exception { + solicitudDocumento.clearAll(); + solicitudDocumento.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudDocumento.query(); + + SolicitudController.findSolicitudxcodsolicitud(solicitud.getRecord().getPk()); + TarmTramite tramite = TarmTramiteController.find(String.valueOf(SolicitudController.findSolicitudxcodsolicitud(solicitud.getRecord().getPk()).getCtramite())); + TgeneCatalogDetail tipoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + TgeneCatalogDetail tipoAutorizacion = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail actividad = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + Boolean muestraArmas = listarArmas(tipoTramite,tipoAutorizacion, actividad); + + + for (TarmSolicitudDocumento solDocumento : solicitudDocumento.getLrecord()) { + TarmDocumentoHabilitante documentoHabilitante =DocumentoHabilitanteController.find(solDocumento.getPk().getCdocumento().toString()); + solDocumento.getModifiedData().put("documento", documentoHabilitante); + solDocumento.getModifiedData().put("arma", muestraArmas?ArmasController.findPorCodigo(documentoHabilitante.getCarma()):null); + } + } + + + /** + * Metodo para listar las armas segun la combinacion de tipo de tramite + * @param tipoTramite tipo del tramite + * @param tipoAutorizacion tipo de la autorizacion + * @param actividad tipo de la actividad + * @return valor booleano que indica si se muestran o no als armas + * @throws Exception + */ + private boolean listarArmas(TgeneCatalogDetail tipoTramite,TgeneCatalogDetail tipoAutorizacion, TgeneCatalogDetail actividad) throws Exception{ + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())){ + return false; + } + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())){ + return true; + } + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog())){ + return false; + } + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog())){ + return true; + } + return true; + } + + private void cargarRequisitos() throws Exception { + requisitos.clearAll(); + requisitos.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + requisitos.query(); + for (TarmSolicitudRequisitos solicitudRequisitos : requisitos.getLrecord()) { + solicitudRequisitos.getModifiedData().put("requisito", RequisitoController.findxId(solicitudRequisitos.getPk().getCrequisito())); + } + } + + public List getLtipopersona() { + return ltipopersona; + } + + public void setLtipopersona(List ltipopersona) { + this.ltipopersona = ltipopersona; + } + + public List getLtipoidenti() { + return ltipoidenti; + } + + public void setLtipoidenti(List ltipoidenti) { + this.ltipoidenti = ltipoidenti; + } + + public List getLtipotramite() { + return ltipotramite; + } + + public void setLtipotramite(List ltipotramite) { + this.ltipotramite = ltipotramite; + } + + public List getLorigenadquisicion() { + return lorigenadquisicion; + } + + public void setLorigenadquisicion(List lorigenadquisicion) { + this.lorigenadquisicion = lorigenadquisicion; + } + + public boolean isExisteSolicitud() { + return existeSolicitud; + } + + public void setExisteSolicitud(boolean existeSolicitud) { + this.existeSolicitud = existeSolicitud; + } + + public boolean isIngresarRequisitos() { + return ingresarRequisitos; + } + + public void setIngresarRequisitos(boolean ingresarRequisitos) { + this.ingresarRequisitos = ingresarRequisitos; + } + + public boolean isSeleccionarArmas() { + return seleccionarArmas; + } + + public void setSeleccionarArmas(boolean seleccionarArmas) { + this.seleccionarArmas = seleccionarArmas; + } + + public boolean isSeleccionarGuardias() { + return seleccionarGuardias; + } + + public void setSeleccionarGuardias(boolean seleccionarGuardias) { + this.seleccionarGuardias = seleccionarGuardias; + } + + public boolean isSeleccionarAgencias() { + return seleccionarAgencias; + } + + public void setSeleccionarAgencias(boolean seleccionarAgencias) { + this.seleccionarAgencias = seleccionarAgencias; + } + + public boolean isListarDocumentos() { + return listarDocumentos; + } + + public void setListarDocumentos(boolean listarDocumentos) { + this.listarDocumentos = listarDocumentos; + } + + public UserDetailController getDetalleusuario() { + return detalleusuario; + } + + public void setDetalleusuario(UserDetailController detalleusuario) { + this.detalleusuario = detalleusuario; + } + + public SolicitudArmasController getSolicitud() { + return solicitud; + } + + public void setSolicitud(SolicitudArmasController solicitud) { + this.solicitud = solicitud; + } + + public PersonDetailController getDetallepersona() { + return detallepersona; + } + + public void setDetallepersona(PersonDetailController detallepersona) { + this.detallepersona = detallepersona; + } + + public PeopleController getNatural() { + return natural; + } + + public void setNatural(PeopleController natural) { + this.natural = natural; + } + + public PersonAddressController getDireccion() { + return direccion; + } + + public void setDireccion(PersonAddressController direccion) { + this.direccion = direccion; + } + + public PersonPhoneController getTelefono() { + return telefono; + } + + public void setTelefono(PersonPhoneController telefono) { + this.telefono = telefono; + } + + public SolicitudRequisitosController getRequisitos() { + return requisitos; + } + + public void setRequisitos(SolicitudRequisitosController requisitos) { + this.requisitos = requisitos; + } + + public SolicitudGuardiasController getSolicitudGuardias() { + return solicitudGuardias; + } + + public void setSolicitudGuardias(SolicitudGuardiasController solicitudGuardias) { + this.solicitudGuardias = solicitudGuardias; + } + + public ArmasController getArmas() { + return armas; + } + + public void setArmas(ArmasController armas) { + this.armas = armas; + } + + public RecepcionArmasController getSolicitudArmas() { + return solicitudArmas; + } + + public void setSolicitudArmas(RecepcionArmasController solicitudArmas) { + this.solicitudArmas = solicitudArmas; + } + + public RegistroArmController getRegistroArmas() { + return registroArmas; + } + + public void setRegistroArmas(RegistroArmController registroArmas) { + this.registroArmas = registroArmas; + } + + public AgenciaSucursalController getAgenciaSucursal() { + return agenciaSucursal; + } + + public void setAgenciaSucursal(AgenciaSucursalController agenciaSucursal) { + this.agenciaSucursal = agenciaSucursal; + } + + public SolicitudAgenciaSucursalController getSolicitudAgenciaSucursal() { + return solicitudAgenciaSucursal; + } + + public void setSolicitudAgenciaSucursal( + SolicitudAgenciaSucursalController solicitudAgenciaSucursal) { + this.solicitudAgenciaSucursal = solicitudAgenciaSucursal; + } + + public DocumentoHabilitanteController getDocumentoHabilitante() { + return documentoHabilitante; + } + + public void setDocumentoHabilitante( + DocumentoHabilitanteController documentoHabilitante) { + this.documentoHabilitante = documentoHabilitante; + } + + public TarmSolicitudDocumentoController getSolicitudDocumento() { + return solicitudDocumento; + } + + public void setSolicitudDocumento( + TarmSolicitudDocumentoController solicitudDocumento) { + this.solicitudDocumento = solicitudDocumento; + } + + public List getLprovincias() { + return lprovincias; + } + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public List getLparroquias() { + return lparroquias; + } + + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + public List getLcities() { + return lcities; + } + + public void setLcities(List lcities) { + this.lcities = lcities; + } + @Override + public void completarTarea() { + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + System.out.println("1.....csolicitud :"+solicitud); + System.out.println("2.....csolicitud :"+solicitud.getRecord()); + System.out.println("3.....csolicitud :"+solicitud.getRecord().getPk()); + request.modifiedData().put("csolicitud", solicitud.getRecord().getPk()); + if(tid==null){ + tid = FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("taskId").toString(); + } + request.modifiedData().put("TID", tid); + if(bpmDataStatus.equals("D")){ + // Se aumento las observaciones para ser enviadas en el mail + Mapdatosmail = new HashMap(); + datosmail.put("razons",detallepersona.getRecord().getName()); + datosmail.put("sol",solicitud.getRecord().getNumerosolicitud()); + datosmail.put("observaciones",bpmDataComment); + //grado funcionario de la persona logeada + TsafeUserDetail userDetailObj=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personDetailObj=PersonDetailController.find(userDetailObj.getPk().getPersoncode().toString()); + datosmail.put("grado",personDetailObj.getMilitarygrade()); + datosmail.put("funcionario",personDetailObj.getName()); + // CCA + TarmCentroControl centroControl=CentroControlArmasController.findPorCodigo(solicitud.getRecord().getCcentrocontrol()); + datosmail.put("centrocontrol",centroControl.getModifiedData().get("desinstitucion")); + request.modifiedData().put("datosmail", datosmail); + } + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + + request.modifiedData().put("BPMObs", bpmDataComment); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + // CATEGORIA 14 PREVIA IMPORTACION + if(bpmDataStatus.equals("D")){ + TarmTramite tarmTramite = TarmTramiteController.find(this.solicitud.getRecord().getCtramite().toString()); + if(tarmTramite.getCategoria().equals("14")){ + desasociarCargaSolicitud(); + } + } + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void desasociarCargaSolicitud(){ + try{ + TarmCarga carga = CargaController.findByAUCP(solicitud.getRecord().getAucp()); + if(carga!=null){ + carga.setCsolicitud(null); + cargaController.update(carga); + cargaController.save(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public List getLmarca() { + return lmarca; + } + + public void setLmarca(List lmarca) { + this.lmarca = lmarca; + } + + public CargaController getCargaController() { + return cargaController; + } + + public void setCargaController(CargaController cargaController) { + this.cargaController = cargaController; + } + + public Boolean getRequiereNoSolAucpBln() { + return requiereNoSolAucpBln; + } + + public void setRequiereNoSolAucpBln(Boolean requiereNoSolAucpBln) { + this.requiereNoSolAucpBln = requiereNoSolAucpBln; + } + + public String getNombreInstitucion() { + return nombreInstitucion; + } + + public String setNombreInstitucion(String nombreInstitucion) { + if(nombreInstitucion!=null && !nombreInstitucion.isEmpty()){ + this.nombreInstitucion = nombreInstitucion; + }else{ + this.nombreInstitucion = ""; + } + + return nombreInstitucion; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteConsultaSolicitudClienteController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteConsultaSolicitudClienteController.java.svn-base new file mode 100644 index 0000000..0112405 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteConsultaSolicitudClienteController.java.svn-base @@ -0,0 +1,971 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.PredicateUtils; +import org.apache.commons.collections.TransformerUtils; +import org.primefaces.context.RequestContext; + +import com.fp.common.helper.Constant; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.CargaController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.GuardiasController; +import com.fp.frontend.controller.armas.parametros.RequisitoController; +import com.fp.frontend.controller.pcustomer.PeopleController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.PersonPhoneController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.controller.pgeneral.safe.UserDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.parmas.soli.TarmSolicitudGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitos; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@ManagedBean +@ViewScoped +public class ReporteConsultaSolicitudClienteController extends + AbstractController { + + private static final long serialVersionUID = -4049698904561227471L; + + /** + * Lista de tipos de persona. + */ + private List ltipopersona; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de identificación + */ + private List ltipoidenti; + + /** + * Lista de tipos de trámite. + */ + private List ltipotramite; + + /** + * Lista de origen de adquisición + */ + private List lorigenadquisicion; + /** + * Bandera que indica si existe o no un registro para mostrar la solicitud + */ + private boolean existeSolicitud; + /** + * Indica si se debe activar la pestana de ingresar requisitos + */ + private boolean ingresarRequisitos; + + /** + * Indica si se debe activar la pestana de seleccionar armas + */ + private boolean seleccionarArmas; + + /** + * Indica si se debe activar la pestana seleccionar guardias + */ + private boolean seleccionarGuardias; + + /** + * Indica si se debe activar la pestana seleccionar agencias + */ + private boolean seleccionarAgencias; + + /** + * Indica si se debe activar la pestana listar guardias + */ + private boolean listarDocumentos; + + private List lprovincias; + private List lcantones; + private List lparroquias; + private List lcities; + + private List lmarca; + /** + * Controlador de la solicitud + */ + /** + * Controlador que maneja el usuario + */ + @ManagedProperty(value = "#{userDetailController}") + private UserDetailController detalleusuario; + + /** + * Controlador que maneja las armas dentro de la solicitud + */ +// @ManagedProperty(value = "#{solicitudArmasBPMController}") +// private SolicitudArmasBPMController solicitud; + + @ManagedProperty(value = "#{solicitudArmasController}") + private SolicitudArmasController solicitud; + + /** + * Controlador que maneja la persona + */ + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController detallepersona; + + /** + * Controlador que maneja los datos de personas naturales + */ + @ManagedProperty(value = "#{peopleController}") + private PeopleController natural; + + /** + * Controlador que maneja direcciones de la persona + */ + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController direccion; + + /** + * Controlador que maneja teléfonos de la persona + */ + @ManagedProperty(value = "#{personPhoneController}") + private PersonPhoneController telefono; + + /** + * Controlador que maneja requisitos dentro de la solicitud + */ + @ManagedProperty(value = "#{solicitudRequisitosController}") + private SolicitudRequisitosController requisitos; + + /** + * Controlador que maneja los guardias en la solicitud + */ + @ManagedProperty(value = "#{solicitudGuardiasController}") + private SolicitudGuardiasController solicitudGuardias; + + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{armasController}") + private ArmasController armas; + + /** + * Controlador que maneja las armas dentro de la solicitud + */ + @ManagedProperty(value = "#{recepcionArmasController}") + private RecepcionArmasController solicitudArmas; + + /** + * Controlador que maneja registro de armas + */ + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmas; + + /** + * Controlador que maneja agencias y sucursales + */ + @ManagedProperty(value = "#{agenciaSucursalController}") + private AgenciaSucursalController agenciaSucursal; + + /** + * Controlador que maneja las agencias y sucursales dentro de la solicitud + */ + @ManagedProperty(value = "#{solicitudAgenciaSucursalController}") + private SolicitudAgenciaSucursalController solicitudAgenciaSucursal; + + /** + * Controlador que maneja los documentos habilitantes + */ + @ManagedProperty(value = "#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitante; + + /** + * Controlador que maneja los documentos dentro de la solicitud + */ + @ManagedProperty(value = "#{tarmSolicitudDocumentoController}") + private TarmSolicitudDocumentoController solicitudDocumento; + + /** + * Controlador que maneja cargas para previa importacion + */ + @ManagedProperty(value = "#{cargaController}") + private CargaController cargaController; + + private Boolean requiereNoSolAucpBln; + + /** + *Referencia al Centro de control; + */ + private TarmCentroControl centroControl = new TarmCentroControl(); + + /** + *Nombre de la Institucion + */ + private String nombreInstitucion; + + private TsafeUserDetail userDetail; + + /** + * + * @throws Exception + */ + public ReporteConsultaSolicitudClienteController() throws Exception{ + super(AbstractDataTransport.class); + } + + /** + * postCosntruct + * @throws Exception + */ + @PostConstruct + private void postconstruct() throws Exception{ + this.init(); + requiereNoSolAucpBln=Boolean.FALSE; + this.startQuery(); + } + + private void init(){ + this.beanalias = "REPORTESOLICITUD"; + ltipopersona = CatalogDetailController.find("PERSONTYPE"); + ltipoidenti = CatalogDetailController.find("IDENTIFICATION"); + ltipotramite = CatalogDetailController.find("TIPOTRAMITE"); + lorigenadquisicion = CatalogDetailController.find("ORIGENADQUISICION"); + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + } + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + //Realizo las busquedas en base a los controladores + try { + limpiaDatos(); +// if(solicitud.getRecord() == null || solicitud.getRecord().getPk()==null){ + Utilidades.caracterEspecial(solicitud.getMfilters().get("numerosolicitud")); + solicitud.query(); +// } + if(solicitud.getRecord() != null && solicitud.getRecord().getPk() != null){ + //Valida que corresponda al mismo cliente + if(!userDetail.getPk().getPersoncode().equals(solicitud.getRecord().getPersoncode())){ + MessageHelper.setMessageWarn("Solicitud no corresponde a la persona"); + return; + } + + if(this.solicitud.getMfilters().get("numerosolicitud")==null || this.solicitud.getMfilters().get("numerosolicitud").equals("")) + this.solicitud.getMfilters().put("numerosolicitud",solicitud.getRecord().getNumerosolicitud()); + existeSolicitud = Boolean.TRUE; +// solicitud.setRecord(solicitud.getLrecord().get(0)); + detallepersona.getMfilters().clear(); + detallepersona.getMfilters().put("pk.personcode", solicitud.getRecord().getPersoncode().toString()); + detallepersona.addFilterDateto(); + detallepersona.query(); + + natural.getMfilters().clear(); + natural.addPersoncodeFilter(solicitud.getRecord().getPersoncode().toString()); + natural.addFilterDateto(); + natural.query(); + + direccion.getMfilters().clear(); + direccion.addPersoncodeFilter(solicitud.getRecord().getPersoncode().toString()); + direccion.addFilterDateto(); + direccion.query(); + + this.obtenerDireccionesGenerales(); + + telefono.getMfilters().clear(); + telefono.addPersoncodeFilter(solicitud.getRecord().getPersoncode().toString()); + telefono.addFilterDateto(); + telefono.query(); + this.obtenerTelefonos(); +// this.setearCodigoCentroControl(); + this.setearTramite(); + } else{ + existeSolicitud = Boolean.FALSE; + } + } catch (Throwable e) { + // TODO Auto-generated catch block + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void loadEdit() throws Exception { + //TarmArmas arma = ((TarmArmas) solicitudArmas.getRecord().getModifiedData().get("arma")); + TarmArmas arma = ArmasController.findxCodigo(solicitudArmas.getRecord().getModifiedData().get("carma").toString()); + if(arma.getCountrycode() == null){ + arma.setCountrycode("EC"); + } + this.lmarca =(List) ArmasController.findxCodigo(solicitudArmas.getRecord().getModifiedData().get("carma").toString()).getModifiedData().get("lmarca"); + lprovincias = ProvinceController.find(arma.getCountrycode()); + executeProvince(arma); + if(arma.getProvincecode() != null){ + lcantones = CantonController.find(arma.getCountrycode(), arma.getProvincecode()); + executeCanton(arma); + } + completaInfTipoArma(arma); + registroArmas.clearAll(); + if(arma.getCregistro() != null){ + registroArmas.addFilter("pk", arma.getCregistro().toString()); + registroArmas.query(); + List registroArmasList = registroArmas.getLrecord(); + registroArmas.setRecord(registroArmasList.get(0)); + registroArmas.getRecord().setIsnew(Boolean.FALSE); + } + + } + + public void loadShowAgencia() { + TarmAgenciaSucursal tarmAgenciaSucursal = (TarmAgenciaSucursal) solicitudAgenciaSucursal.getRecord().getModifiedData().get("agencia"); + lprovincias = ProvinceController.find(tarmAgenciaSucursal.getCountrycode()); + lcantones = CantonController.find(tarmAgenciaSucursal.getCountrycode(), tarmAgenciaSucursal.getProvincecode()); + lparroquias = ParroquiaController.find(tarmAgenciaSucursal.getCountrycode(), tarmAgenciaSucursal.getProvincecode(), tarmAgenciaSucursal.getCantoncode()); + lcities = CityController.find(tarmAgenciaSucursal.getCountrycode(), tarmAgenciaSucursal.getProvincecode(), tarmAgenciaSucursal.getCantoncode()); + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince(TarmArmas arma) { + if ((arma != null) && (arma.getCountrycode().compareTo("") != 0)) { + lcantones = CantonController.find(arma.getCountrycode(), arma.getProvincecode()); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton(TarmArmas arma) { + //TarmArmas arma = (((TarmArmas) solicitudArmas.getRecord().getModifiedData().get("arma"))); + if (arma.getCountrycode() != null && arma.getCountrycode().compareTo("") != 0) { + lparroquias = ParroquiaController.find(arma.getCountrycode(), + arma.getProvincecode(), + arma.getCantoncode()); + lcities = CityController.find(arma.getCountrycode(), arma.getProvincecode(), arma.getCantoncode()); + } + } + + private void limpiaDatos(){ + this.detallepersona.clearAll(); + this.detalleusuario.clearAll(); + this.agenciaSucursal.clearAll(); + this.armas.clearAll(); + this.direccion.clearAll(); + this.documentoHabilitante.clearAll(); + this.natural.clearAll(); + this.registroArmas.clearAll(); + this.requisitos.clearAll(); + this.solicitudAgenciaSucursal.clearAll(); + this.solicitudArmas.clearAll(); + this.solicitudDocumento.clearAll(); + this.solicitudGuardias.clearAll(); + this.telefono.clearAll(); + existeSolicitud = Boolean.FALSE; + } + + /** + * Método que completa la informaci´n del arma una vez se presiona el botón crear + */ + private void completaInfTipoArma(TarmArmas arma){ + solicitudArmas.getRecord().getModifiedData().put("estado", arma.getEstado()); + solicitudArmas.getRecord().getModifiedData().put("marca", arma.getMarca()); +// record.setCountrycode("EC"); +// clase = ((TarmArmas)record.getModifiedData().get("arma")).getModifiedData().get("cclase") != null ? ((TarmArmas)record.getModifiedData().get("arma")).getModifiedData().get("cclase").toString() : null; +// calibre = record.getModifiedData().get("ccalibre") != null ? record.getModifiedData().get("ccalibre").toString() : null; +// longitud = record.getModifiedData().get("clongitud") != null ? record.getModifiedData().get("clongitud").toString() : null; +// tipoarma = record.getModifiedData().get("ctipoarmaexplosivo") != null ? record.getModifiedData().get("ctipoarmaexplosivo").toString() : null; + } + + /** + * Recupera en base al tipo de identificación la dirección de la oficina o de la casa + */ + private void obtenerDireccionesGenerales(){ + TcustPersonAddress direccionPersona = null; + direccionPersona = direccion.findPrincipal(detallepersona.getRecord().getPk().getPersoncode().toString()); + + if(direccionPersona != null){ + direccion.getMfilelds().put("solcodpais", direccionPersona.getCountrycode()); + direccion.getMfilelds().put("solcodprovincia", direccionPersona.getProvincecode()); + direccion.setLprovinces(ProvinceController.find(direccionPersona.getCountrycode())); + direccion.getMfilelds().put("solcodcanton", direccionPersona.getCantoncode()); + direccion.setLcantones(CantonController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode())); + direccion.getMfilelds().put("solcodciudad", direccionPersona.getCitycode()); + direccion.setLcities(CityController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode(), direccionPersona.getCantoncode())); + direccion.getMfilelds().put("solcodparroquia", direccionPersona.getParroquiacode()); + direccion.setLparroquias(ParroquiaController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode(), direccionPersona.getCantoncode())); + direccion.getMfilelds().put("soldireccion", direccionPersona.getAddress()); + } + + TcustPersonAddress correo = (TcustPersonAddress) CollectionUtils.find(direccion.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getAddresstypecatalog"), PredicateUtils.equalPredicate("3"))); + if(correo != null){ + direccion.getMfilelds().put("solcorreopersona", correo.getAddress()); + } + } + + /** + * Retorna el telefono fijo y celular de la persona + */ + private void obtenerTelefonos(){ + TcustPersonPhone telf = null; + telf = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getPhonetypecatalog"), PredicateUtils.equalPredicate("1"))); + if(telf != null){ + telefono.getMfilelds().put("soltelfijo", telf.getPhonenumber()); + } + telf = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getPhonetypecatalog"), PredicateUtils.equalPredicate("2"))); + if(telf != null){ + telefono.getMfilelds().put("soltelcelular", telf.getPhonenumber()); + } + } + + + /** + * En base a la provincia y sus jurisdicciones se obtiene y se coloca el centro de control + */ + /*private void setearCodigoCentroControl(){ + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(direccion.getMfilelds().get("solcodprovincia") != null ? + direccion.getMfilelds().get("solcodprovincia").toString() : StringUtils.EMPTY); + if(centroControlJur != null){ + this.solicitud.getRecord().setCcentrocontrol(centroControlJur.getCcentrocontrol()); + } + }*/ + + /** + * + */ + private void setearTramite() { + try{ + if(solicitud.getRecord().getCtramite()==null){ + return; + } + TarmTramite tramite = TarmTramiteController.find(solicitud.getRecord().getCtramite().toString()); + solicitud.getRecord().setCtramite(tramite.getPk()); + TgeneCatalogDetail tipoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + TgeneCatalogDetail tipoAutorizacion = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail categoria = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + TgeneCatalogDetail actividad = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + this.getSolicitud().addField("tipoTramite", tipoTramite.getDescription()); + this.getSolicitud().addField("tipoAutorizacion", tipoAutorizacion.getDescription()); + this.getSolicitud().addField("categoria", categoria.getDescription()); + this.getSolicitud().addField("actividad", actividad.getDescription()); + this.ingresarRequisitos = Boolean.TRUE; + obtenerCentroControl(solicitud.getRecord()); + if(tramite.getCategoria().equals("14")){ + requiereNoSolAucpBln=Boolean.TRUE; + }else{ + requiereNoSolAucpBln=Boolean.FALSE; + } + if(Constant.ifYes(tramite.getRegistroarmas())){ + this.seleccionarArmas = Boolean.TRUE; + this.cargaArmas(); + }else{ + this.seleccionarArmas = Boolean.FALSE; + this.solicitudArmas.clearAll(); + } + if(Constant.ifYes(tramite.getRegistroguardia())){ + this.seleccionarGuardias = Boolean.TRUE; + this.cargaGuardias(); + }else{ + this.seleccionarGuardias = Boolean.FALSE; + this.solicitudGuardias.clearAll(); + } + if(Constant.ifYes(tramite.getRegistroagenciasucursal())){ + this.seleccionarAgencias = Boolean.TRUE; + this.cargarAgencias(); + }else{ + this.seleccionarAgencias = Boolean.FALSE; + this.solicitudAgenciaSucursal.clearAll(); + } + + if(Constant.ifYes(tramite.getDocumentohabilitante()) || tipoTramite.getPk().getCatalog().equals(ParametersController.find("CODIGO.TRAMITEREIMPRESION", "1").getTextvalue())){ + this.listarDocumentos = Boolean.TRUE; + this.cargarDocumentos(); + }else{ + this.listarDocumentos = Boolean.FALSE; + this.solicitudDocumento.clearAll(); + } + + if(tramite != null){ + this.cargarRequisitos(); + } + } catch(Throwable e){ + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * @param solicitud + * @throws Exception + * + */ + private void obtenerCentroControl(TarmSolicitud solicitud) throws Exception { + + this.centroControl= CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + this.setNombreInstitucion(CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + + } + + private void cargaArmas() throws Exception{ + + solicitudArmas.clearAll(); + solicitudArmas.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudArmas.setCodigoSolicitud(solicitud.getRecord().getPk()); + solicitudArmas.setRecperpage(5000); + solicitudArmas.querydatabase(); + } + + + private void cargaGuardias() throws Exception{ + solicitudGuardias.clearAll(); + solicitudGuardias.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudGuardias.query(); + for (TarmSolicitudGuardias solicitudGuardia : solicitudGuardias.getLrecord()) { + solicitudGuardia.getModifiedData().put("guardia", GuardiasController.find(solicitudGuardia.getPk().getCguardia().toString(), solicitudGuardia.getPk().getCempresa().toString())); + } + } + + private void cargarAgencias() throws Exception{ + solicitudAgenciaSucursal.clearAll(); + solicitudAgenciaSucursal.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudAgenciaSucursal.query(); + for (TarmSolicitudAgenciaSucursal solAgenciaSucursal : solicitudAgenciaSucursal.getLrecord()) { + solAgenciaSucursal.getModifiedData().put("agencia", AgenciaSucursalController.find(solAgenciaSucursal.getPk().getCagencia().toString())); + } + } + + private void cargarDocumentos() throws Exception { + solicitudDocumento.clearAll(); + solicitudDocumento.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudDocumento.query(); + + SolicitudController.findSolicitudxcodsolicitud(solicitud.getRecord().getPk()); + TarmTramite tramite = TarmTramiteController.find(String.valueOf(SolicitudController.findSolicitudxcodsolicitud(solicitud.getRecord().getPk()).getCtramite())); + TgeneCatalogDetail tipoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + TgeneCatalogDetail tipoAutorizacion = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail actividad = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + Boolean muestraArmas = listarArmas(tipoTramite,tipoAutorizacion, actividad); + + + for (TarmSolicitudDocumento solDocumento : solicitudDocumento.getLrecord()) { + TarmDocumentoHabilitante documentoHabilitante =DocumentoHabilitanteController.find(solDocumento.getPk().getCdocumento().toString()); + solDocumento.getModifiedData().put("documento", documentoHabilitante); + solDocumento.getModifiedData().put("arma", muestraArmas?ArmasController.findPorCodigo(documentoHabilitante.getCarma()):null); + } + } + + + /** + * Metodo para listar las armas segun la combinacion de tipo de tramite + * @param tipoTramite tipo del tramite + * @param tipoAutorizacion tipo de la autorizacion + * @param actividad tipo de la actividad + * @return valor booleano que indica si se muestran o no als armas + * @throws Exception + */ + private boolean listarArmas(TgeneCatalogDetail tipoTramite,TgeneCatalogDetail tipoAutorizacion, TgeneCatalogDetail actividad) throws Exception{ + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())){ + return false; + } + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())){ + return true; + } + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog())){ + return false; + } + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog())){ + return true; + } + return true; + } + + private void cargarRequisitos() throws Exception { + requisitos.clearAll(); + requisitos.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + requisitos.query(); + for (TarmSolicitudRequisitos solicitudRequisitos : requisitos.getLrecord()) { + solicitudRequisitos.getModifiedData().put("requisito", RequisitoController.findxId(solicitudRequisitos.getPk().getCrequisito())); + } + } + + public List getLtipopersona() { + return ltipopersona; + } + + public void setLtipopersona(List ltipopersona) { + this.ltipopersona = ltipopersona; + } + + public List getLtipoidenti() { + return ltipoidenti; + } + + public void setLtipoidenti(List ltipoidenti) { + this.ltipoidenti = ltipoidenti; + } + + public List getLtipotramite() { + return ltipotramite; + } + + public void setLtipotramite(List ltipotramite) { + this.ltipotramite = ltipotramite; + } + + public List getLorigenadquisicion() { + return lorigenadquisicion; + } + + public void setLorigenadquisicion(List lorigenadquisicion) { + this.lorigenadquisicion = lorigenadquisicion; + } + + public boolean isExisteSolicitud() { + return existeSolicitud; + } + + public void setExisteSolicitud(boolean existeSolicitud) { + this.existeSolicitud = existeSolicitud; + } + + public boolean isIngresarRequisitos() { + return ingresarRequisitos; + } + + public void setIngresarRequisitos(boolean ingresarRequisitos) { + this.ingresarRequisitos = ingresarRequisitos; + } + + public boolean isSeleccionarArmas() { + return seleccionarArmas; + } + + public void setSeleccionarArmas(boolean seleccionarArmas) { + this.seleccionarArmas = seleccionarArmas; + } + + public boolean isSeleccionarGuardias() { + return seleccionarGuardias; + } + + public void setSeleccionarGuardias(boolean seleccionarGuardias) { + this.seleccionarGuardias = seleccionarGuardias; + } + + public boolean isSeleccionarAgencias() { + return seleccionarAgencias; + } + + public void setSeleccionarAgencias(boolean seleccionarAgencias) { + this.seleccionarAgencias = seleccionarAgencias; + } + + public boolean isListarDocumentos() { + return listarDocumentos; + } + + public void setListarDocumentos(boolean listarDocumentos) { + this.listarDocumentos = listarDocumentos; + } + + public UserDetailController getDetalleusuario() { + return detalleusuario; + } + + public void setDetalleusuario(UserDetailController detalleusuario) { + this.detalleusuario = detalleusuario; + } + + public SolicitudArmasController getSolicitud() { + return solicitud; + } + + public void setSolicitud(SolicitudArmasController solicitud) { + this.solicitud = solicitud; + } + + public PersonDetailController getDetallepersona() { + return detallepersona; + } + + public void setDetallepersona(PersonDetailController detallepersona) { + this.detallepersona = detallepersona; + } + + public PeopleController getNatural() { + return natural; + } + + public void setNatural(PeopleController natural) { + this.natural = natural; + } + + public PersonAddressController getDireccion() { + return direccion; + } + + public void setDireccion(PersonAddressController direccion) { + this.direccion = direccion; + } + + public PersonPhoneController getTelefono() { + return telefono; + } + + public void setTelefono(PersonPhoneController telefono) { + this.telefono = telefono; + } + + public SolicitudRequisitosController getRequisitos() { + return requisitos; + } + + public void setRequisitos(SolicitudRequisitosController requisitos) { + this.requisitos = requisitos; + } + + public SolicitudGuardiasController getSolicitudGuardias() { + return solicitudGuardias; + } + + public void setSolicitudGuardias(SolicitudGuardiasController solicitudGuardias) { + this.solicitudGuardias = solicitudGuardias; + } + + public ArmasController getArmas() { + return armas; + } + + public void setArmas(ArmasController armas) { + this.armas = armas; + } + + public RecepcionArmasController getSolicitudArmas() { + return solicitudArmas; + } + + public void setSolicitudArmas(RecepcionArmasController solicitudArmas) { + this.solicitudArmas = solicitudArmas; + } + + public RegistroArmController getRegistroArmas() { + return registroArmas; + } + + public void setRegistroArmas(RegistroArmController registroArmas) { + this.registroArmas = registroArmas; + } + + public AgenciaSucursalController getAgenciaSucursal() { + return agenciaSucursal; + } + + public void setAgenciaSucursal(AgenciaSucursalController agenciaSucursal) { + this.agenciaSucursal = agenciaSucursal; + } + + public SolicitudAgenciaSucursalController getSolicitudAgenciaSucursal() { + return solicitudAgenciaSucursal; + } + + public void setSolicitudAgenciaSucursal( + SolicitudAgenciaSucursalController solicitudAgenciaSucursal) { + this.solicitudAgenciaSucursal = solicitudAgenciaSucursal; + } + + public DocumentoHabilitanteController getDocumentoHabilitante() { + return documentoHabilitante; + } + + public void setDocumentoHabilitante( + DocumentoHabilitanteController documentoHabilitante) { + this.documentoHabilitante = documentoHabilitante; + } + + public TarmSolicitudDocumentoController getSolicitudDocumento() { + return solicitudDocumento; + } + + public void setSolicitudDocumento( + TarmSolicitudDocumentoController solicitudDocumento) { + this.solicitudDocumento = solicitudDocumento; + } + + public List getLprovincias() { + return lprovincias; + } + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public List getLparroquias() { + return lparroquias; + } + + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + public List getLcities() { + return lcities; + } + + public void setLcities(List lcities) { + this.lcities = lcities; + } + @Override + public void completarTarea() { + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + System.out.println("1.....csolicitud :"+solicitud); + System.out.println("2.....csolicitud :"+solicitud.getRecord()); + System.out.println("3.....csolicitud :"+solicitud.getRecord().getPk()); + request.modifiedData().put("csolicitud", solicitud.getRecord().getPk()); + if(tid==null){ + tid = FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("taskId").toString(); + } + request.modifiedData().put("TID", tid); + if(bpmDataStatus.equals("D")){ + // Se aumento las observaciones para ser enviadas en el mail + Mapdatosmail = new HashMap(); + datosmail.put("razons",detallepersona.getRecord().getName()); + datosmail.put("sol",solicitud.getRecord().getNumerosolicitud()); + datosmail.put("observaciones",bpmDataComment); + //grado funcionario de la persona logeada + TsafeUserDetail userDetailObj=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personDetailObj=PersonDetailController.find(userDetailObj.getPk().getPersoncode().toString()); + datosmail.put("grado",personDetailObj.getMilitarygrade()); + datosmail.put("funcionario",personDetailObj.getName()); + // CCA + TarmCentroControl centroControl=CentroControlArmasController.findPorCodigo(solicitud.getRecord().getCcentrocontrol()); + datosmail.put("centrocontrol",centroControl.getModifiedData().get("desinstitucion")); + request.modifiedData().put("datosmail", datosmail); + } + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + + request.modifiedData().put("BPMObs", bpmDataComment); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + // CATEGORIA 14 PREVIA IMPORTACION + if(bpmDataStatus.equals("D")){ + TarmTramite tarmTramite = TarmTramiteController.find(this.solicitud.getRecord().getCtramite().toString()); + if(tarmTramite.getCategoria().equals("14")){ + desasociarCargaSolicitud(); + } + } + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void desasociarCargaSolicitud(){ + try{ + TarmCarga carga = CargaController.findByAUCP(solicitud.getRecord().getAucp()); + if(carga!=null){ + carga.setCsolicitud(null); + cargaController.update(carga); + cargaController.save(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public List getLmarca() { + return lmarca; + } + + public void setLmarca(List lmarca) { + this.lmarca = lmarca; + } + + public CargaController getCargaController() { + return cargaController; + } + + public void setCargaController(CargaController cargaController) { + this.cargaController = cargaController; + } + + public Boolean getRequiereNoSolAucpBln() { + return requiereNoSolAucpBln; + } + + public void setRequiereNoSolAucpBln(Boolean requiereNoSolAucpBln) { + this.requiereNoSolAucpBln = requiereNoSolAucpBln; + } + + public String getNombreInstitucion() { + return nombreInstitucion; + } + + public String setNombreInstitucion(String nombreInstitucion) { + if(nombreInstitucion!=null && !nombreInstitucion.isEmpty()){ + this.nombreInstitucion = nombreInstitucion; + }else{ + this.nombreInstitucion = ""; + } + + return nombreInstitucion; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteConsultaSolicitudController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteConsultaSolicitudController.java.netbeans-base new file mode 100644 index 0000000..1be0f3d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteConsultaSolicitudController.java.netbeans-base @@ -0,0 +1,990 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.PredicateUtils; +import org.apache.commons.collections.TransformerUtils; +import org.apache.commons.lang.StringUtils; +import org.primefaces.context.RequestContext; + +import com.fp.common.helper.Constant; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.CargaController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.GuardiasController; +import com.fp.frontend.controller.armas.parametros.RequisitoController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PeopleController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.PersonPhoneController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.controller.pgeneral.safe.UserDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.parmas.soli.TarmSolicitudGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitos; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@ManagedBean +@ViewScoped +public class ReporteConsultaSolicitudController extends + AbstractController { + + private static final long serialVersionUID = -4049698904561227471L; + + /** + * Lista de tipos de persona. + */ + private List ltipopersona; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de identificación + */ + private List ltipoidenti; + + /** + * Lista de tipos de trámite. + */ + private List ltipotramite; + + /** + * Lista de origen de adquisición + */ + private List lorigenadquisicion; + /** + * Bandera que indica si existe o no un registro para mostrar la solicitud + */ + private boolean existeSolicitud; + /** + * Indica si se debe activar la pestana de ingresar requisitos + */ + private boolean ingresarRequisitos; + + /** + * Indica si se debe activar la pestana de seleccionar armas + */ + private boolean seleccionarArmas; + + /** + * Indica si se debe activar la pestana seleccionar guardias + */ + private boolean seleccionarGuardias; + + /** + * Indica si se debe activar la pestana seleccionar agencias + */ + private boolean seleccionarAgencias; + + /** + * Indica si se debe activar la pestana listar guardias + */ + private boolean listarDocumentos; + /** + * Bandera que indica si la transacción inicio por flujo + */ + private boolean inicioPorFlujo; + + private List lprovincias; + private List lcantones; + private List lparroquias; + private List lcities; + + private List lmarca; + /** + * Controlador de la solicitud + */ + /** + * Controlador que maneja el usuario + */ + @ManagedProperty(value = "#{userDetailController}") + private UserDetailController detalleusuario; + + /** + * Controlador que maneja las armas dentro de la solicitud + */ +// @ManagedProperty(value = "#{solicitudArmasBPMController}") +// private SolicitudArmasBPMController solicitud; + + @ManagedProperty(value = "#{solicitudArmasController}") + private SolicitudArmasController solicitud; + + /** + * Controlador que maneja la persona + */ + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController detallepersona; + + /** + * Controlador que maneja los datos de personas naturales + */ + @ManagedProperty(value = "#{peopleController}") + private PeopleController natural; + + /** + * Controlador que maneja direcciones de la persona + */ + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController direccion; + + /** + * Controlador que maneja teléfonos de la persona + */ + @ManagedProperty(value = "#{personPhoneController}") + private PersonPhoneController telefono; + + /** + * Controlador que maneja requisitos dentro de la solicitud + */ + @ManagedProperty(value = "#{solicitudRequisitosController}") + private SolicitudRequisitosController requisitos; + + /** + * Controlador que maneja los guardias en la solicitud + */ + @ManagedProperty(value = "#{solicitudGuardiasController}") + private SolicitudGuardiasController solicitudGuardias; + + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{armasController}") + private ArmasController armas; + + /** + * Controlador que maneja las armas dentro de la solicitud + */ + @ManagedProperty(value = "#{recepcionArmasController}") + private RecepcionArmasController solicitudArmas; + + /** + * Controlador que maneja registro de armas + */ + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmas; + + /** + * Controlador que maneja agencias y sucursales + */ + @ManagedProperty(value = "#{agenciaSucursalController}") + private AgenciaSucursalController agenciaSucursal; + + /** + * Controlador que maneja las agencias y sucursales dentro de la solicitud + */ + @ManagedProperty(value = "#{solicitudAgenciaSucursalController}") + private SolicitudAgenciaSucursalController solicitudAgenciaSucursal; + + /** + * Controlador que maneja los documentos habilitantes + */ + @ManagedProperty(value = "#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitante; + + /** + * Controlador que maneja los documentos dentro de la solicitud + */ + @ManagedProperty(value = "#{tarmSolicitudDocumentoController}") + private TarmSolicitudDocumentoController solicitudDocumento; + + /** + * Controlador que maneja cargas para previa importacion + */ + @ManagedProperty(value = "#{cargaController}") + private CargaController cargaController; + + private Boolean requiereNoSolAucpBln; + + /** + *Referencia al Centro de control; + */ + private TarmCentroControl centroControl = new TarmCentroControl(); + + /** + *Nombre de la Institucion + */ + private String nombreInstitucion; + + /** + * + * @throws Exception + */ + public ReporteConsultaSolicitudController() throws Exception{ + super(AbstractDataTransport.class); + } + + /** + * postCosntruct + * @throws Exception + */ + @PostConstruct + private void postconstruct() throws Exception{ + this.init(); + requiereNoSolAucpBln=Boolean.FALSE; + this.startQuery(); + if(tid!=null){ + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("taskId", tid); + } + if(this.getMfilters().get("pk")!=null && !this.getMfilters().get("pk").equals("")){ + this.solicitud.getMfilters().clear(); + this.solicitud.getMfilters().put("pk", this.getMfilters().get("pk")); + solicitud.query(); + this.inicioPorFlujo = Boolean.TRUE; + if(this.solicitud.getMfilters().get("numerosolicitud")==null || this.solicitud.getMfilters().get("numerosolicitud").equals("")){ + this.solicitud.getMfilters().put("numerosolicitud",solicitud.getRecord().getNumerosolicitud()); + this.querydatabase(); + } + } else{ + this.inicioPorFlujo = Boolean.FALSE; + } + } + + private void init(){ + this.beanalias = "REPORTESOLICITUD"; + ltipopersona = CatalogDetailController.find("PERSONTYPE"); + ltipoidenti = CatalogDetailController.find("IDENTIFICATION"); + ltipotramite = CatalogDetailController.find("TIPOTRAMITE"); + lorigenadquisicion = CatalogDetailController.find("ORIGENADQUISICION"); + } + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + //Realizo las busquedas en base a los controladores + try { + limpiaDatos(); +// if(solicitud.getRecord() == null || solicitud.getRecord().getPk()==null){ + Utilidades.caracterEspecial(solicitud.getMfilters().get("numerosolicitud")); + solicitud.query(); +// } + if(solicitud.getRecord() != null && solicitud.getRecord().getPk() != null){ + if(this.solicitud.getMfilters().get("numerosolicitud")==null || this.solicitud.getMfilters().get("numerosolicitud").equals("")) + this.solicitud.getMfilters().put("numerosolicitud",solicitud.getRecord().getNumerosolicitud()); + existeSolicitud = Boolean.TRUE; +// solicitud.setRecord(solicitud.getLrecord().get(0)); + detallepersona.getMfilters().clear(); + detallepersona.getMfilters().put("pk.personcode", solicitud.getRecord().getPersoncode().toString()); + detallepersona.addFilterDateto(); + detallepersona.query(); + + natural.getMfilters().clear(); + natural.addPersoncodeFilter(solicitud.getRecord().getPersoncode().toString()); + natural.addFilterDateto(); + natural.query(); + + direccion.getMfilters().clear(); + direccion.addPersoncodeFilter(solicitud.getRecord().getPersoncode().toString()); + direccion.addFilterDateto(); + direccion.query(); + + this.obtenerDireccionesGenerales(); + + telefono.getMfilters().clear(); + telefono.addPersoncodeFilter(solicitud.getRecord().getPersoncode().toString()); + telefono.addFilterDateto(); + telefono.query(); + this.obtenerTelefonos(); +// this.setearCodigoCentroControl(); + this.setearTramite(); + } else{ + existeSolicitud = Boolean.FALSE; + } + } catch (Throwable e) { + // TODO Auto-generated catch block + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void loadEdit() throws Exception { + //TarmArmas arma = ((TarmArmas) solicitudArmas.getRecord().getModifiedData().get("arma")); + TarmArmas arma = ArmasController.findxCodigo(solicitudArmas.getRecord().getModifiedData().get("carma").toString()); + if(arma.getCountrycode() == null){ + arma.setCountrycode("EC"); + } + this.lmarca =(List) ArmasController.findxCodigo(solicitudArmas.getRecord().getModifiedData().get("carma").toString()).getModifiedData().get("lmarca"); + lprovincias = ProvinceController.find(arma.getCountrycode()); + executeProvince(arma); + if(arma.getProvincecode() != null){ + lcantones = CantonController.find(arma.getCountrycode(), arma.getProvincecode()); + executeCanton(arma); + } + completaInfTipoArma(arma); + registroArmas.clearAll(); + if(arma.getCregistro() != null){ + registroArmas.addFilter("pk", arma.getCregistro().toString()); + registroArmas.query(); + List registroArmasList = registroArmas.getLrecord(); + registroArmas.setRecord(registroArmasList.get(0)); + registroArmas.getRecord().setIsnew(Boolean.FALSE); + } + + } + + public void loadShowAgencia() { + TarmAgenciaSucursal tarmAgenciaSucursal = (TarmAgenciaSucursal) solicitudAgenciaSucursal.getRecord().getModifiedData().get("agencia"); + lprovincias = ProvinceController.find(tarmAgenciaSucursal.getCountrycode()); + lcantones = CantonController.find(tarmAgenciaSucursal.getCountrycode(), tarmAgenciaSucursal.getProvincecode()); + lparroquias = ParroquiaController.find(tarmAgenciaSucursal.getCountrycode(), tarmAgenciaSucursal.getProvincecode(), tarmAgenciaSucursal.getCantoncode()); + lcities = CityController.find(tarmAgenciaSucursal.getCountrycode(), tarmAgenciaSucursal.getProvincecode(), tarmAgenciaSucursal.getCantoncode()); + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince(TarmArmas arma) { + if ((arma != null) && (arma.getCountrycode().compareTo("") != 0)) { + lcantones = CantonController.find(arma.getCountrycode(), arma.getProvincecode()); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton(TarmArmas arma) { + //TarmArmas arma = (((TarmArmas) solicitudArmas.getRecord().getModifiedData().get("arma"))); + if (arma.getCountrycode() != null && arma.getCountrycode().compareTo("") != 0) { + lparroquias = ParroquiaController.find(arma.getCountrycode(), + arma.getProvincecode(), + arma.getCantoncode()); + lcities = CityController.find(arma.getCountrycode(), arma.getProvincecode(), arma.getCantoncode()); + } + } + + private void limpiaDatos(){ + this.detallepersona.clearAll(); + this.detalleusuario.clearAll(); + this.agenciaSucursal.clearAll(); + this.armas.clearAll(); + this.direccion.clearAll(); + this.documentoHabilitante.clearAll(); + this.natural.clearAll(); + this.registroArmas.clearAll(); + this.requisitos.clearAll(); + this.solicitudAgenciaSucursal.clearAll(); + this.solicitudArmas.clearAll(); + this.solicitudDocumento.clearAll(); + this.solicitudGuardias.clearAll(); + this.telefono.clearAll(); + } + + /** + * Método que completa la informaci´n del arma una vez se presiona el botón crear + */ + private void completaInfTipoArma(TarmArmas arma){ + solicitudArmas.getRecord().getModifiedData().put("estado", arma.getEstado()); + solicitudArmas.getRecord().getModifiedData().put("marca", arma.getMarca()); +// record.setCountrycode("EC"); +// clase = ((TarmArmas)record.getModifiedData().get("arma")).getModifiedData().get("cclase") != null ? ((TarmArmas)record.getModifiedData().get("arma")).getModifiedData().get("cclase").toString() : null; +// calibre = record.getModifiedData().get("ccalibre") != null ? record.getModifiedData().get("ccalibre").toString() : null; +// longitud = record.getModifiedData().get("clongitud") != null ? record.getModifiedData().get("clongitud").toString() : null; +// tipoarma = record.getModifiedData().get("ctipoarmaexplosivo") != null ? record.getModifiedData().get("ctipoarmaexplosivo").toString() : null; + } + + /** + * Recupera en base al tipo de identificación la dirección de la oficina o de la casa + */ + private void obtenerDireccionesGenerales(){ + TcustPersonAddress direccionPersona = null; + direccionPersona = direccion.findPrincipal(detallepersona.getRecord().getPk().getPersoncode().toString()); + + if(direccionPersona != null){ + direccion.getMfilelds().put("solcodpais", direccionPersona.getCountrycode()); + direccion.getMfilelds().put("solcodprovincia", direccionPersona.getProvincecode()); + direccion.setLprovinces(ProvinceController.find(direccionPersona.getCountrycode())); + direccion.getMfilelds().put("solcodcanton", direccionPersona.getCantoncode()); + direccion.setLcantones(CantonController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode())); + direccion.getMfilelds().put("solcodciudad", direccionPersona.getCitycode()); + direccion.setLcities(CityController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode(), direccionPersona.getCantoncode())); + direccion.getMfilelds().put("solcodparroquia", direccionPersona.getParroquiacode()); + direccion.setLparroquias(ParroquiaController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode(), direccionPersona.getCantoncode())); + direccion.getMfilelds().put("soldireccion", direccionPersona.getAddress()); + } + + TcustPersonAddress correo = (TcustPersonAddress) CollectionUtils.find(direccion.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getAddresstypecatalog"), PredicateUtils.equalPredicate("3"))); + if(correo != null){ + direccion.getMfilelds().put("solcorreopersona", correo.getAddress()); + } + } + + /** + * Retorna el telefono fijo y celular de la persona + */ + private void obtenerTelefonos(){ + TcustPersonPhone telf = null; + telf = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getPhonetypecatalog"), PredicateUtils.equalPredicate("1"))); + if(telf != null){ + telefono.getMfilelds().put("soltelfijo", telf.getPhonenumber()); + } + telf = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getPhonetypecatalog"), PredicateUtils.equalPredicate("2"))); + if(telf != null){ + telefono.getMfilelds().put("soltelcelular", telf.getPhonenumber()); + } + } + + /** + * En base a la provincia y sus jurisdicciones se obtiene y se coloca el centro de control + */ + private void setearCodigoCentroControl(){ + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(direccion.getMfilelds().get("solcodprovincia") != null ? + direccion.getMfilelds().get("solcodprovincia").toString() : StringUtils.EMPTY); + if(centroControlJur != null){ + this.solicitud.getRecord().setCcentrocontrol(centroControlJur.getCcentrocontrol()); + } + } + + /** + * + */ + private void setearTramite() { + try{ + if(solicitud.getRecord().getCtramite()==null){ + return; + } + TarmTramite tramite = TarmTramiteController.find(solicitud.getRecord().getCtramite().toString()); + solicitud.getRecord().setCtramite(tramite.getPk()); + TgeneCatalogDetail tipoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + TgeneCatalogDetail tipoAutorizacion = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail categoria = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + TgeneCatalogDetail actividad = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + this.getSolicitud().addField("tipoTramite", tipoTramite.getDescription()); + this.getSolicitud().addField("tipoAutorizacion", tipoAutorizacion.getDescription()); + this.getSolicitud().addField("categoria", categoria.getDescription()); + this.getSolicitud().addField("actividad", actividad.getDescription()); + this.ingresarRequisitos = Boolean.TRUE; + obtenerCentroControl(solicitud.getRecord()); + if(tramite.getCategoria().equals("14")){ + requiereNoSolAucpBln=Boolean.TRUE; + }else{ + requiereNoSolAucpBln=Boolean.FALSE; + } + if(Constant.ifYes(tramite.getRegistroarmas())){ + this.seleccionarArmas = Boolean.TRUE; + this.cargaArmas(); + }else{ + this.seleccionarArmas = Boolean.FALSE; + this.solicitudArmas.clearAll(); + } + if(Constant.ifYes(tramite.getRegistroguardia())){ + this.seleccionarGuardias = Boolean.TRUE; + this.cargaGuardias(); + }else{ + this.seleccionarGuardias = Boolean.FALSE; + this.solicitudGuardias.clearAll(); + } + if(Constant.ifYes(tramite.getRegistroagenciasucursal())){ + this.seleccionarAgencias = Boolean.TRUE; + this.cargarAgencias(); + }else{ + this.seleccionarAgencias = Boolean.FALSE; + this.solicitudAgenciaSucursal.clearAll(); + } + + if(Constant.ifYes(tramite.getDocumentohabilitante()) || tipoTramite.getPk().getCatalog().equals(ParametersController.find("CODIGO.TRAMITEREIMPRESION", "1").getTextvalue())){ + this.listarDocumentos = Boolean.TRUE; + this.cargarDocumentos(); + }else{ + this.listarDocumentos = Boolean.FALSE; + this.solicitudDocumento.clearAll(); + } + + if(tramite != null){ + this.cargarRequisitos(); + } + } catch(Throwable e){ + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * @param solicitud + * @throws Exception + * + */ + private void obtenerCentroControl(TarmSolicitud solicitud) throws Exception { + + this.centroControl= CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + this.setNombreInstitucion(CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + + } + + private void cargaArmas() throws Exception{ + + solicitudArmas.clearAll(); + solicitudArmas.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudArmas.setCodigoSolicitud(solicitud.getRecord().getPk()); + solicitudArmas.setRecperpage(5000); + solicitudArmas.querydatabase(); + } + + + private void cargaGuardias() throws Exception{ + solicitudGuardias.clearAll(); + solicitudGuardias.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudGuardias.query(); + for (TarmSolicitudGuardias solicitudGuardia : solicitudGuardias.getLrecord()) { + solicitudGuardia.getModifiedData().put("guardia", GuardiasController.find(solicitudGuardia.getPk().getCguardia().toString(), solicitudGuardia.getPk().getCempresa().toString())); + } + } + + private void cargarAgencias() throws Exception{ + solicitudAgenciaSucursal.clearAll(); + solicitudAgenciaSucursal.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudAgenciaSucursal.query(); + for (TarmSolicitudAgenciaSucursal solAgenciaSucursal : solicitudAgenciaSucursal.getLrecord()) { + solAgenciaSucursal.getModifiedData().put("agencia", AgenciaSucursalController.find(solAgenciaSucursal.getPk().getCagencia().toString())); + } + } + + private void cargarDocumentos() throws Exception { + solicitudDocumento.clearAll(); + solicitudDocumento.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudDocumento.query(); + + SolicitudController.findSolicitudxcodsolicitud(solicitud.getRecord().getPk()); + TarmTramite tramite = TarmTramiteController.find(String.valueOf(SolicitudController.findSolicitudxcodsolicitud(solicitud.getRecord().getPk()).getCtramite())); + TgeneCatalogDetail tipoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + TgeneCatalogDetail tipoAutorizacion = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail actividad = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + Boolean muestraArmas = listarArmas(tipoTramite,tipoAutorizacion, actividad); + + + for (TarmSolicitudDocumento solDocumento : solicitudDocumento.getLrecord()) { + TarmDocumentoHabilitante documentoHabilitante =DocumentoHabilitanteController.find(solDocumento.getPk().getCdocumento().toString()); + solDocumento.getModifiedData().put("documento", documentoHabilitante); + solDocumento.getModifiedData().put("arma", muestraArmas?ArmasController.findPorCodigo(documentoHabilitante.getCarma()):null); + } + } + + + /** + * Metodo para listar las armas segun la combinacion de tipo de tramite + * @param tipoTramite tipo del tramite + * @param tipoAutorizacion tipo de la autorizacion + * @param actividad tipo de la actividad + * @return valor booleano que indica si se muestran o no als armas + * @throws Exception + */ + private boolean listarArmas(TgeneCatalogDetail tipoTramite,TgeneCatalogDetail tipoAutorizacion, TgeneCatalogDetail actividad) throws Exception{ + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())){ + return false; + } + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())){ + return true; + } + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog())){ + return false; + } + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog())){ + return true; + } + return true; + } + + private void cargarRequisitos() throws Exception { + requisitos.clearAll(); + requisitos.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + requisitos.query(); + for (TarmSolicitudRequisitos solicitudRequisitos : requisitos.getLrecord()) { + solicitudRequisitos.getModifiedData().put("requisito", RequisitoController.findxId(solicitudRequisitos.getPk().getCrequisito())); + } + } + + public List getLtipopersona() { + return ltipopersona; + } + + public void setLtipopersona(List ltipopersona) { + this.ltipopersona = ltipopersona; + } + + public List getLtipoidenti() { + return ltipoidenti; + } + + public void setLtipoidenti(List ltipoidenti) { + this.ltipoidenti = ltipoidenti; + } + + public List getLtipotramite() { + return ltipotramite; + } + + public void setLtipotramite(List ltipotramite) { + this.ltipotramite = ltipotramite; + } + + public List getLorigenadquisicion() { + return lorigenadquisicion; + } + + public void setLorigenadquisicion(List lorigenadquisicion) { + this.lorigenadquisicion = lorigenadquisicion; + } + + public boolean isExisteSolicitud() { + return existeSolicitud; + } + + public void setExisteSolicitud(boolean existeSolicitud) { + this.existeSolicitud = existeSolicitud; + } + + public boolean isIngresarRequisitos() { + return ingresarRequisitos; + } + + public void setIngresarRequisitos(boolean ingresarRequisitos) { + this.ingresarRequisitos = ingresarRequisitos; + } + + public boolean isSeleccionarArmas() { + return seleccionarArmas; + } + + public void setSeleccionarArmas(boolean seleccionarArmas) { + this.seleccionarArmas = seleccionarArmas; + } + + public boolean isSeleccionarGuardias() { + return seleccionarGuardias; + } + + public void setSeleccionarGuardias(boolean seleccionarGuardias) { + this.seleccionarGuardias = seleccionarGuardias; + } + + public boolean isSeleccionarAgencias() { + return seleccionarAgencias; + } + + public void setSeleccionarAgencias(boolean seleccionarAgencias) { + this.seleccionarAgencias = seleccionarAgencias; + } + + public boolean isListarDocumentos() { + return listarDocumentos; + } + + public void setListarDocumentos(boolean listarDocumentos) { + this.listarDocumentos = listarDocumentos; + } + + public UserDetailController getDetalleusuario() { + return detalleusuario; + } + + public void setDetalleusuario(UserDetailController detalleusuario) { + this.detalleusuario = detalleusuario; + } + + public SolicitudArmasController getSolicitud() { + return solicitud; + } + + public void setSolicitud(SolicitudArmasController solicitud) { + this.solicitud = solicitud; + } + + public PersonDetailController getDetallepersona() { + return detallepersona; + } + + public void setDetallepersona(PersonDetailController detallepersona) { + this.detallepersona = detallepersona; + } + + public PeopleController getNatural() { + return natural; + } + + public void setNatural(PeopleController natural) { + this.natural = natural; + } + + public PersonAddressController getDireccion() { + return direccion; + } + + public void setDireccion(PersonAddressController direccion) { + this.direccion = direccion; + } + + public PersonPhoneController getTelefono() { + return telefono; + } + + public void setTelefono(PersonPhoneController telefono) { + this.telefono = telefono; + } + + public SolicitudRequisitosController getRequisitos() { + return requisitos; + } + + public void setRequisitos(SolicitudRequisitosController requisitos) { + this.requisitos = requisitos; + } + + public SolicitudGuardiasController getSolicitudGuardias() { + return solicitudGuardias; + } + + public void setSolicitudGuardias(SolicitudGuardiasController solicitudGuardias) { + this.solicitudGuardias = solicitudGuardias; + } + + public ArmasController getArmas() { + return armas; + } + + public void setArmas(ArmasController armas) { + this.armas = armas; + } + + public RecepcionArmasController getSolicitudArmas() { + return solicitudArmas; + } + + public void setSolicitudArmas(RecepcionArmasController solicitudArmas) { + this.solicitudArmas = solicitudArmas; + } + + public RegistroArmController getRegistroArmas() { + return registroArmas; + } + + public void setRegistroArmas(RegistroArmController registroArmas) { + this.registroArmas = registroArmas; + } + + public AgenciaSucursalController getAgenciaSucursal() { + return agenciaSucursal; + } + + public void setAgenciaSucursal(AgenciaSucursalController agenciaSucursal) { + this.agenciaSucursal = agenciaSucursal; + } + + public SolicitudAgenciaSucursalController getSolicitudAgenciaSucursal() { + return solicitudAgenciaSucursal; + } + + public void setSolicitudAgenciaSucursal( + SolicitudAgenciaSucursalController solicitudAgenciaSucursal) { + this.solicitudAgenciaSucursal = solicitudAgenciaSucursal; + } + + public DocumentoHabilitanteController getDocumentoHabilitante() { + return documentoHabilitante; + } + + public void setDocumentoHabilitante( + DocumentoHabilitanteController documentoHabilitante) { + this.documentoHabilitante = documentoHabilitante; + } + + public TarmSolicitudDocumentoController getSolicitudDocumento() { + return solicitudDocumento; + } + + public void setSolicitudDocumento( + TarmSolicitudDocumentoController solicitudDocumento) { + this.solicitudDocumento = solicitudDocumento; + } + + public List getLprovincias() { + return lprovincias; + } + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public List getLparroquias() { + return lparroquias; + } + + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + public List getLcities() { + return lcities; + } + + public void setLcities(List lcities) { + this.lcities = lcities; + } + @Override + public void completarTarea() { + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + System.out.println("1.....csolicitud :"+solicitud); + System.out.println("2.....csolicitud :"+solicitud.getRecord()); + System.out.println("3.....csolicitud :"+solicitud.getRecord().getPk()); + request.modifiedData().put("csolicitud", solicitud.getRecord().getPk()); + if(tid==null){ + tid = FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("taskId").toString(); + } + request.modifiedData().put("TID", tid); + if(bpmDataStatus.equals("D")){ + // Se aumento las observaciones para ser enviadas en el mail + Mapdatosmail = new HashMap(); + datosmail.put("razons",detallepersona.getRecord().getName()); + datosmail.put("sol",solicitud.getRecord().getNumerosolicitud()); + datosmail.put("observaciones",bpmDataComment); + //grado funcionario de la persona logeada + TsafeUserDetail userDetailObj=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personDetailObj=PersonDetailController.find(userDetailObj.getPk().getPersoncode().toString()); + datosmail.put("grado",personDetailObj.getMilitarygrade()); + datosmail.put("funcionario",personDetailObj.getName()); + // CCA + TarmCentroControl centroControl=CentroControlArmasController.findPorCodigo(solicitud.getRecord().getCcentrocontrol()); + datosmail.put("centrocontrol",centroControl.getModifiedData().get("desinstitucion")); + request.modifiedData().put("datosmail", datosmail); + } + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + + request.modifiedData().put("BPMObs", bpmDataComment); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + // CATEGORIA 14 PREVIA IMPORTACION + if(bpmDataStatus.equals("D")){ + TarmTramite tarmTramite = TarmTramiteController.find(this.solicitud.getRecord().getCtramite().toString()); + if(tarmTramite.getCategoria().equals("14")){ + desasociarCargaSolicitud(); + } + } + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void desasociarCargaSolicitud(){ + try{ + TarmCarga carga = CargaController.findByAUCP(solicitud.getRecord().getAucp()); + if(carga!=null){ + carga.setCsolicitud(null); + cargaController.update(carga); + cargaController.save(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public boolean isInicioPorFlujo() { + return inicioPorFlujo; + } + + public void setInicioPorFlujo(boolean inicioPorFlujo) { + this.inicioPorFlujo = inicioPorFlujo; + } + + public List getLmarca() { + return lmarca; + } + + public void setLmarca(List lmarca) { + this.lmarca = lmarca; + } + + public CargaController getCargaController() { + return cargaController; + } + + public void setCargaController(CargaController cargaController) { + this.cargaController = cargaController; + } + + public Boolean getRequiereNoSolAucpBln() { + return requiereNoSolAucpBln; + } + + public void setRequiereNoSolAucpBln(Boolean requiereNoSolAucpBln) { + this.requiereNoSolAucpBln = requiereNoSolAucpBln; + } + + public String getNombreInstitucion() { + return nombreInstitucion; + } + + public String setNombreInstitucion(String nombreInstitucion) { + if(nombreInstitucion!=null && !nombreInstitucion.isEmpty()){ + this.nombreInstitucion = nombreInstitucion; + }else{ + this.nombreInstitucion = ""; + } + + return nombreInstitucion; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteConsultaSolicitudController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteConsultaSolicitudController.java.svn-base new file mode 100644 index 0000000..1be0f3d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteConsultaSolicitudController.java.svn-base @@ -0,0 +1,990 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.PredicateUtils; +import org.apache.commons.collections.TransformerUtils; +import org.apache.commons.lang.StringUtils; +import org.primefaces.context.RequestContext; + +import com.fp.common.helper.Constant; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.CargaController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.GuardiasController; +import com.fp.frontend.controller.armas.parametros.RequisitoController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PeopleController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.PersonPhoneController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.controller.pgeneral.safe.UserDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.parmas.soli.TarmSolicitudGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitos; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@ManagedBean +@ViewScoped +public class ReporteConsultaSolicitudController extends + AbstractController { + + private static final long serialVersionUID = -4049698904561227471L; + + /** + * Lista de tipos de persona. + */ + private List ltipopersona; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de identificación + */ + private List ltipoidenti; + + /** + * Lista de tipos de trámite. + */ + private List ltipotramite; + + /** + * Lista de origen de adquisición + */ + private List lorigenadquisicion; + /** + * Bandera que indica si existe o no un registro para mostrar la solicitud + */ + private boolean existeSolicitud; + /** + * Indica si se debe activar la pestana de ingresar requisitos + */ + private boolean ingresarRequisitos; + + /** + * Indica si se debe activar la pestana de seleccionar armas + */ + private boolean seleccionarArmas; + + /** + * Indica si se debe activar la pestana seleccionar guardias + */ + private boolean seleccionarGuardias; + + /** + * Indica si se debe activar la pestana seleccionar agencias + */ + private boolean seleccionarAgencias; + + /** + * Indica si se debe activar la pestana listar guardias + */ + private boolean listarDocumentos; + /** + * Bandera que indica si la transacción inicio por flujo + */ + private boolean inicioPorFlujo; + + private List lprovincias; + private List lcantones; + private List lparroquias; + private List lcities; + + private List lmarca; + /** + * Controlador de la solicitud + */ + /** + * Controlador que maneja el usuario + */ + @ManagedProperty(value = "#{userDetailController}") + private UserDetailController detalleusuario; + + /** + * Controlador que maneja las armas dentro de la solicitud + */ +// @ManagedProperty(value = "#{solicitudArmasBPMController}") +// private SolicitudArmasBPMController solicitud; + + @ManagedProperty(value = "#{solicitudArmasController}") + private SolicitudArmasController solicitud; + + /** + * Controlador que maneja la persona + */ + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController detallepersona; + + /** + * Controlador que maneja los datos de personas naturales + */ + @ManagedProperty(value = "#{peopleController}") + private PeopleController natural; + + /** + * Controlador que maneja direcciones de la persona + */ + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController direccion; + + /** + * Controlador que maneja teléfonos de la persona + */ + @ManagedProperty(value = "#{personPhoneController}") + private PersonPhoneController telefono; + + /** + * Controlador que maneja requisitos dentro de la solicitud + */ + @ManagedProperty(value = "#{solicitudRequisitosController}") + private SolicitudRequisitosController requisitos; + + /** + * Controlador que maneja los guardias en la solicitud + */ + @ManagedProperty(value = "#{solicitudGuardiasController}") + private SolicitudGuardiasController solicitudGuardias; + + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{armasController}") + private ArmasController armas; + + /** + * Controlador que maneja las armas dentro de la solicitud + */ + @ManagedProperty(value = "#{recepcionArmasController}") + private RecepcionArmasController solicitudArmas; + + /** + * Controlador que maneja registro de armas + */ + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmas; + + /** + * Controlador que maneja agencias y sucursales + */ + @ManagedProperty(value = "#{agenciaSucursalController}") + private AgenciaSucursalController agenciaSucursal; + + /** + * Controlador que maneja las agencias y sucursales dentro de la solicitud + */ + @ManagedProperty(value = "#{solicitudAgenciaSucursalController}") + private SolicitudAgenciaSucursalController solicitudAgenciaSucursal; + + /** + * Controlador que maneja los documentos habilitantes + */ + @ManagedProperty(value = "#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitante; + + /** + * Controlador que maneja los documentos dentro de la solicitud + */ + @ManagedProperty(value = "#{tarmSolicitudDocumentoController}") + private TarmSolicitudDocumentoController solicitudDocumento; + + /** + * Controlador que maneja cargas para previa importacion + */ + @ManagedProperty(value = "#{cargaController}") + private CargaController cargaController; + + private Boolean requiereNoSolAucpBln; + + /** + *Referencia al Centro de control; + */ + private TarmCentroControl centroControl = new TarmCentroControl(); + + /** + *Nombre de la Institucion + */ + private String nombreInstitucion; + + /** + * + * @throws Exception + */ + public ReporteConsultaSolicitudController() throws Exception{ + super(AbstractDataTransport.class); + } + + /** + * postCosntruct + * @throws Exception + */ + @PostConstruct + private void postconstruct() throws Exception{ + this.init(); + requiereNoSolAucpBln=Boolean.FALSE; + this.startQuery(); + if(tid!=null){ + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("taskId", tid); + } + if(this.getMfilters().get("pk")!=null && !this.getMfilters().get("pk").equals("")){ + this.solicitud.getMfilters().clear(); + this.solicitud.getMfilters().put("pk", this.getMfilters().get("pk")); + solicitud.query(); + this.inicioPorFlujo = Boolean.TRUE; + if(this.solicitud.getMfilters().get("numerosolicitud")==null || this.solicitud.getMfilters().get("numerosolicitud").equals("")){ + this.solicitud.getMfilters().put("numerosolicitud",solicitud.getRecord().getNumerosolicitud()); + this.querydatabase(); + } + } else{ + this.inicioPorFlujo = Boolean.FALSE; + } + } + + private void init(){ + this.beanalias = "REPORTESOLICITUD"; + ltipopersona = CatalogDetailController.find("PERSONTYPE"); + ltipoidenti = CatalogDetailController.find("IDENTIFICATION"); + ltipotramite = CatalogDetailController.find("TIPOTRAMITE"); + lorigenadquisicion = CatalogDetailController.find("ORIGENADQUISICION"); + } + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + //Realizo las busquedas en base a los controladores + try { + limpiaDatos(); +// if(solicitud.getRecord() == null || solicitud.getRecord().getPk()==null){ + Utilidades.caracterEspecial(solicitud.getMfilters().get("numerosolicitud")); + solicitud.query(); +// } + if(solicitud.getRecord() != null && solicitud.getRecord().getPk() != null){ + if(this.solicitud.getMfilters().get("numerosolicitud")==null || this.solicitud.getMfilters().get("numerosolicitud").equals("")) + this.solicitud.getMfilters().put("numerosolicitud",solicitud.getRecord().getNumerosolicitud()); + existeSolicitud = Boolean.TRUE; +// solicitud.setRecord(solicitud.getLrecord().get(0)); + detallepersona.getMfilters().clear(); + detallepersona.getMfilters().put("pk.personcode", solicitud.getRecord().getPersoncode().toString()); + detallepersona.addFilterDateto(); + detallepersona.query(); + + natural.getMfilters().clear(); + natural.addPersoncodeFilter(solicitud.getRecord().getPersoncode().toString()); + natural.addFilterDateto(); + natural.query(); + + direccion.getMfilters().clear(); + direccion.addPersoncodeFilter(solicitud.getRecord().getPersoncode().toString()); + direccion.addFilterDateto(); + direccion.query(); + + this.obtenerDireccionesGenerales(); + + telefono.getMfilters().clear(); + telefono.addPersoncodeFilter(solicitud.getRecord().getPersoncode().toString()); + telefono.addFilterDateto(); + telefono.query(); + this.obtenerTelefonos(); +// this.setearCodigoCentroControl(); + this.setearTramite(); + } else{ + existeSolicitud = Boolean.FALSE; + } + } catch (Throwable e) { + // TODO Auto-generated catch block + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void loadEdit() throws Exception { + //TarmArmas arma = ((TarmArmas) solicitudArmas.getRecord().getModifiedData().get("arma")); + TarmArmas arma = ArmasController.findxCodigo(solicitudArmas.getRecord().getModifiedData().get("carma").toString()); + if(arma.getCountrycode() == null){ + arma.setCountrycode("EC"); + } + this.lmarca =(List) ArmasController.findxCodigo(solicitudArmas.getRecord().getModifiedData().get("carma").toString()).getModifiedData().get("lmarca"); + lprovincias = ProvinceController.find(arma.getCountrycode()); + executeProvince(arma); + if(arma.getProvincecode() != null){ + lcantones = CantonController.find(arma.getCountrycode(), arma.getProvincecode()); + executeCanton(arma); + } + completaInfTipoArma(arma); + registroArmas.clearAll(); + if(arma.getCregistro() != null){ + registroArmas.addFilter("pk", arma.getCregistro().toString()); + registroArmas.query(); + List registroArmasList = registroArmas.getLrecord(); + registroArmas.setRecord(registroArmasList.get(0)); + registroArmas.getRecord().setIsnew(Boolean.FALSE); + } + + } + + public void loadShowAgencia() { + TarmAgenciaSucursal tarmAgenciaSucursal = (TarmAgenciaSucursal) solicitudAgenciaSucursal.getRecord().getModifiedData().get("agencia"); + lprovincias = ProvinceController.find(tarmAgenciaSucursal.getCountrycode()); + lcantones = CantonController.find(tarmAgenciaSucursal.getCountrycode(), tarmAgenciaSucursal.getProvincecode()); + lparroquias = ParroquiaController.find(tarmAgenciaSucursal.getCountrycode(), tarmAgenciaSucursal.getProvincecode(), tarmAgenciaSucursal.getCantoncode()); + lcities = CityController.find(tarmAgenciaSucursal.getCountrycode(), tarmAgenciaSucursal.getProvincecode(), tarmAgenciaSucursal.getCantoncode()); + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince(TarmArmas arma) { + if ((arma != null) && (arma.getCountrycode().compareTo("") != 0)) { + lcantones = CantonController.find(arma.getCountrycode(), arma.getProvincecode()); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton(TarmArmas arma) { + //TarmArmas arma = (((TarmArmas) solicitudArmas.getRecord().getModifiedData().get("arma"))); + if (arma.getCountrycode() != null && arma.getCountrycode().compareTo("") != 0) { + lparroquias = ParroquiaController.find(arma.getCountrycode(), + arma.getProvincecode(), + arma.getCantoncode()); + lcities = CityController.find(arma.getCountrycode(), arma.getProvincecode(), arma.getCantoncode()); + } + } + + private void limpiaDatos(){ + this.detallepersona.clearAll(); + this.detalleusuario.clearAll(); + this.agenciaSucursal.clearAll(); + this.armas.clearAll(); + this.direccion.clearAll(); + this.documentoHabilitante.clearAll(); + this.natural.clearAll(); + this.registroArmas.clearAll(); + this.requisitos.clearAll(); + this.solicitudAgenciaSucursal.clearAll(); + this.solicitudArmas.clearAll(); + this.solicitudDocumento.clearAll(); + this.solicitudGuardias.clearAll(); + this.telefono.clearAll(); + } + + /** + * Método que completa la informaci´n del arma una vez se presiona el botón crear + */ + private void completaInfTipoArma(TarmArmas arma){ + solicitudArmas.getRecord().getModifiedData().put("estado", arma.getEstado()); + solicitudArmas.getRecord().getModifiedData().put("marca", arma.getMarca()); +// record.setCountrycode("EC"); +// clase = ((TarmArmas)record.getModifiedData().get("arma")).getModifiedData().get("cclase") != null ? ((TarmArmas)record.getModifiedData().get("arma")).getModifiedData().get("cclase").toString() : null; +// calibre = record.getModifiedData().get("ccalibre") != null ? record.getModifiedData().get("ccalibre").toString() : null; +// longitud = record.getModifiedData().get("clongitud") != null ? record.getModifiedData().get("clongitud").toString() : null; +// tipoarma = record.getModifiedData().get("ctipoarmaexplosivo") != null ? record.getModifiedData().get("ctipoarmaexplosivo").toString() : null; + } + + /** + * Recupera en base al tipo de identificación la dirección de la oficina o de la casa + */ + private void obtenerDireccionesGenerales(){ + TcustPersonAddress direccionPersona = null; + direccionPersona = direccion.findPrincipal(detallepersona.getRecord().getPk().getPersoncode().toString()); + + if(direccionPersona != null){ + direccion.getMfilelds().put("solcodpais", direccionPersona.getCountrycode()); + direccion.getMfilelds().put("solcodprovincia", direccionPersona.getProvincecode()); + direccion.setLprovinces(ProvinceController.find(direccionPersona.getCountrycode())); + direccion.getMfilelds().put("solcodcanton", direccionPersona.getCantoncode()); + direccion.setLcantones(CantonController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode())); + direccion.getMfilelds().put("solcodciudad", direccionPersona.getCitycode()); + direccion.setLcities(CityController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode(), direccionPersona.getCantoncode())); + direccion.getMfilelds().put("solcodparroquia", direccionPersona.getParroquiacode()); + direccion.setLparroquias(ParroquiaController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode(), direccionPersona.getCantoncode())); + direccion.getMfilelds().put("soldireccion", direccionPersona.getAddress()); + } + + TcustPersonAddress correo = (TcustPersonAddress) CollectionUtils.find(direccion.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getAddresstypecatalog"), PredicateUtils.equalPredicate("3"))); + if(correo != null){ + direccion.getMfilelds().put("solcorreopersona", correo.getAddress()); + } + } + + /** + * Retorna el telefono fijo y celular de la persona + */ + private void obtenerTelefonos(){ + TcustPersonPhone telf = null; + telf = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getPhonetypecatalog"), PredicateUtils.equalPredicate("1"))); + if(telf != null){ + telefono.getMfilelds().put("soltelfijo", telf.getPhonenumber()); + } + telf = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getPhonetypecatalog"), PredicateUtils.equalPredicate("2"))); + if(telf != null){ + telefono.getMfilelds().put("soltelcelular", telf.getPhonenumber()); + } + } + + /** + * En base a la provincia y sus jurisdicciones se obtiene y se coloca el centro de control + */ + private void setearCodigoCentroControl(){ + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(direccion.getMfilelds().get("solcodprovincia") != null ? + direccion.getMfilelds().get("solcodprovincia").toString() : StringUtils.EMPTY); + if(centroControlJur != null){ + this.solicitud.getRecord().setCcentrocontrol(centroControlJur.getCcentrocontrol()); + } + } + + /** + * + */ + private void setearTramite() { + try{ + if(solicitud.getRecord().getCtramite()==null){ + return; + } + TarmTramite tramite = TarmTramiteController.find(solicitud.getRecord().getCtramite().toString()); + solicitud.getRecord().setCtramite(tramite.getPk()); + TgeneCatalogDetail tipoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + TgeneCatalogDetail tipoAutorizacion = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail categoria = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + TgeneCatalogDetail actividad = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + this.getSolicitud().addField("tipoTramite", tipoTramite.getDescription()); + this.getSolicitud().addField("tipoAutorizacion", tipoAutorizacion.getDescription()); + this.getSolicitud().addField("categoria", categoria.getDescription()); + this.getSolicitud().addField("actividad", actividad.getDescription()); + this.ingresarRequisitos = Boolean.TRUE; + obtenerCentroControl(solicitud.getRecord()); + if(tramite.getCategoria().equals("14")){ + requiereNoSolAucpBln=Boolean.TRUE; + }else{ + requiereNoSolAucpBln=Boolean.FALSE; + } + if(Constant.ifYes(tramite.getRegistroarmas())){ + this.seleccionarArmas = Boolean.TRUE; + this.cargaArmas(); + }else{ + this.seleccionarArmas = Boolean.FALSE; + this.solicitudArmas.clearAll(); + } + if(Constant.ifYes(tramite.getRegistroguardia())){ + this.seleccionarGuardias = Boolean.TRUE; + this.cargaGuardias(); + }else{ + this.seleccionarGuardias = Boolean.FALSE; + this.solicitudGuardias.clearAll(); + } + if(Constant.ifYes(tramite.getRegistroagenciasucursal())){ + this.seleccionarAgencias = Boolean.TRUE; + this.cargarAgencias(); + }else{ + this.seleccionarAgencias = Boolean.FALSE; + this.solicitudAgenciaSucursal.clearAll(); + } + + if(Constant.ifYes(tramite.getDocumentohabilitante()) || tipoTramite.getPk().getCatalog().equals(ParametersController.find("CODIGO.TRAMITEREIMPRESION", "1").getTextvalue())){ + this.listarDocumentos = Boolean.TRUE; + this.cargarDocumentos(); + }else{ + this.listarDocumentos = Boolean.FALSE; + this.solicitudDocumento.clearAll(); + } + + if(tramite != null){ + this.cargarRequisitos(); + } + } catch(Throwable e){ + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * @param solicitud + * @throws Exception + * + */ + private void obtenerCentroControl(TarmSolicitud solicitud) throws Exception { + + this.centroControl= CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + this.setNombreInstitucion(CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + + } + + private void cargaArmas() throws Exception{ + + solicitudArmas.clearAll(); + solicitudArmas.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudArmas.setCodigoSolicitud(solicitud.getRecord().getPk()); + solicitudArmas.setRecperpage(5000); + solicitudArmas.querydatabase(); + } + + + private void cargaGuardias() throws Exception{ + solicitudGuardias.clearAll(); + solicitudGuardias.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudGuardias.query(); + for (TarmSolicitudGuardias solicitudGuardia : solicitudGuardias.getLrecord()) { + solicitudGuardia.getModifiedData().put("guardia", GuardiasController.find(solicitudGuardia.getPk().getCguardia().toString(), solicitudGuardia.getPk().getCempresa().toString())); + } + } + + private void cargarAgencias() throws Exception{ + solicitudAgenciaSucursal.clearAll(); + solicitudAgenciaSucursal.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudAgenciaSucursal.query(); + for (TarmSolicitudAgenciaSucursal solAgenciaSucursal : solicitudAgenciaSucursal.getLrecord()) { + solAgenciaSucursal.getModifiedData().put("agencia", AgenciaSucursalController.find(solAgenciaSucursal.getPk().getCagencia().toString())); + } + } + + private void cargarDocumentos() throws Exception { + solicitudDocumento.clearAll(); + solicitudDocumento.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudDocumento.query(); + + SolicitudController.findSolicitudxcodsolicitud(solicitud.getRecord().getPk()); + TarmTramite tramite = TarmTramiteController.find(String.valueOf(SolicitudController.findSolicitudxcodsolicitud(solicitud.getRecord().getPk()).getCtramite())); + TgeneCatalogDetail tipoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + TgeneCatalogDetail tipoAutorizacion = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail actividad = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + Boolean muestraArmas = listarArmas(tipoTramite,tipoAutorizacion, actividad); + + + for (TarmSolicitudDocumento solDocumento : solicitudDocumento.getLrecord()) { + TarmDocumentoHabilitante documentoHabilitante =DocumentoHabilitanteController.find(solDocumento.getPk().getCdocumento().toString()); + solDocumento.getModifiedData().put("documento", documentoHabilitante); + solDocumento.getModifiedData().put("arma", muestraArmas?ArmasController.findPorCodigo(documentoHabilitante.getCarma()):null); + } + } + + + /** + * Metodo para listar las armas segun la combinacion de tipo de tramite + * @param tipoTramite tipo del tramite + * @param tipoAutorizacion tipo de la autorizacion + * @param actividad tipo de la actividad + * @return valor booleano que indica si se muestran o no als armas + * @throws Exception + */ + private boolean listarArmas(TgeneCatalogDetail tipoTramite,TgeneCatalogDetail tipoAutorizacion, TgeneCatalogDetail actividad) throws Exception{ + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())){ + return false; + } + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())){ + return true; + } + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog())){ + return false; + } + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog())){ + return true; + } + return true; + } + + private void cargarRequisitos() throws Exception { + requisitos.clearAll(); + requisitos.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + requisitos.query(); + for (TarmSolicitudRequisitos solicitudRequisitos : requisitos.getLrecord()) { + solicitudRequisitos.getModifiedData().put("requisito", RequisitoController.findxId(solicitudRequisitos.getPk().getCrequisito())); + } + } + + public List getLtipopersona() { + return ltipopersona; + } + + public void setLtipopersona(List ltipopersona) { + this.ltipopersona = ltipopersona; + } + + public List getLtipoidenti() { + return ltipoidenti; + } + + public void setLtipoidenti(List ltipoidenti) { + this.ltipoidenti = ltipoidenti; + } + + public List getLtipotramite() { + return ltipotramite; + } + + public void setLtipotramite(List ltipotramite) { + this.ltipotramite = ltipotramite; + } + + public List getLorigenadquisicion() { + return lorigenadquisicion; + } + + public void setLorigenadquisicion(List lorigenadquisicion) { + this.lorigenadquisicion = lorigenadquisicion; + } + + public boolean isExisteSolicitud() { + return existeSolicitud; + } + + public void setExisteSolicitud(boolean existeSolicitud) { + this.existeSolicitud = existeSolicitud; + } + + public boolean isIngresarRequisitos() { + return ingresarRequisitos; + } + + public void setIngresarRequisitos(boolean ingresarRequisitos) { + this.ingresarRequisitos = ingresarRequisitos; + } + + public boolean isSeleccionarArmas() { + return seleccionarArmas; + } + + public void setSeleccionarArmas(boolean seleccionarArmas) { + this.seleccionarArmas = seleccionarArmas; + } + + public boolean isSeleccionarGuardias() { + return seleccionarGuardias; + } + + public void setSeleccionarGuardias(boolean seleccionarGuardias) { + this.seleccionarGuardias = seleccionarGuardias; + } + + public boolean isSeleccionarAgencias() { + return seleccionarAgencias; + } + + public void setSeleccionarAgencias(boolean seleccionarAgencias) { + this.seleccionarAgencias = seleccionarAgencias; + } + + public boolean isListarDocumentos() { + return listarDocumentos; + } + + public void setListarDocumentos(boolean listarDocumentos) { + this.listarDocumentos = listarDocumentos; + } + + public UserDetailController getDetalleusuario() { + return detalleusuario; + } + + public void setDetalleusuario(UserDetailController detalleusuario) { + this.detalleusuario = detalleusuario; + } + + public SolicitudArmasController getSolicitud() { + return solicitud; + } + + public void setSolicitud(SolicitudArmasController solicitud) { + this.solicitud = solicitud; + } + + public PersonDetailController getDetallepersona() { + return detallepersona; + } + + public void setDetallepersona(PersonDetailController detallepersona) { + this.detallepersona = detallepersona; + } + + public PeopleController getNatural() { + return natural; + } + + public void setNatural(PeopleController natural) { + this.natural = natural; + } + + public PersonAddressController getDireccion() { + return direccion; + } + + public void setDireccion(PersonAddressController direccion) { + this.direccion = direccion; + } + + public PersonPhoneController getTelefono() { + return telefono; + } + + public void setTelefono(PersonPhoneController telefono) { + this.telefono = telefono; + } + + public SolicitudRequisitosController getRequisitos() { + return requisitos; + } + + public void setRequisitos(SolicitudRequisitosController requisitos) { + this.requisitos = requisitos; + } + + public SolicitudGuardiasController getSolicitudGuardias() { + return solicitudGuardias; + } + + public void setSolicitudGuardias(SolicitudGuardiasController solicitudGuardias) { + this.solicitudGuardias = solicitudGuardias; + } + + public ArmasController getArmas() { + return armas; + } + + public void setArmas(ArmasController armas) { + this.armas = armas; + } + + public RecepcionArmasController getSolicitudArmas() { + return solicitudArmas; + } + + public void setSolicitudArmas(RecepcionArmasController solicitudArmas) { + this.solicitudArmas = solicitudArmas; + } + + public RegistroArmController getRegistroArmas() { + return registroArmas; + } + + public void setRegistroArmas(RegistroArmController registroArmas) { + this.registroArmas = registroArmas; + } + + public AgenciaSucursalController getAgenciaSucursal() { + return agenciaSucursal; + } + + public void setAgenciaSucursal(AgenciaSucursalController agenciaSucursal) { + this.agenciaSucursal = agenciaSucursal; + } + + public SolicitudAgenciaSucursalController getSolicitudAgenciaSucursal() { + return solicitudAgenciaSucursal; + } + + public void setSolicitudAgenciaSucursal( + SolicitudAgenciaSucursalController solicitudAgenciaSucursal) { + this.solicitudAgenciaSucursal = solicitudAgenciaSucursal; + } + + public DocumentoHabilitanteController getDocumentoHabilitante() { + return documentoHabilitante; + } + + public void setDocumentoHabilitante( + DocumentoHabilitanteController documentoHabilitante) { + this.documentoHabilitante = documentoHabilitante; + } + + public TarmSolicitudDocumentoController getSolicitudDocumento() { + return solicitudDocumento; + } + + public void setSolicitudDocumento( + TarmSolicitudDocumentoController solicitudDocumento) { + this.solicitudDocumento = solicitudDocumento; + } + + public List getLprovincias() { + return lprovincias; + } + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public List getLparroquias() { + return lparroquias; + } + + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + public List getLcities() { + return lcities; + } + + public void setLcities(List lcities) { + this.lcities = lcities; + } + @Override + public void completarTarea() { + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + System.out.println("1.....csolicitud :"+solicitud); + System.out.println("2.....csolicitud :"+solicitud.getRecord()); + System.out.println("3.....csolicitud :"+solicitud.getRecord().getPk()); + request.modifiedData().put("csolicitud", solicitud.getRecord().getPk()); + if(tid==null){ + tid = FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("taskId").toString(); + } + request.modifiedData().put("TID", tid); + if(bpmDataStatus.equals("D")){ + // Se aumento las observaciones para ser enviadas en el mail + Mapdatosmail = new HashMap(); + datosmail.put("razons",detallepersona.getRecord().getName()); + datosmail.put("sol",solicitud.getRecord().getNumerosolicitud()); + datosmail.put("observaciones",bpmDataComment); + //grado funcionario de la persona logeada + TsafeUserDetail userDetailObj=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personDetailObj=PersonDetailController.find(userDetailObj.getPk().getPersoncode().toString()); + datosmail.put("grado",personDetailObj.getMilitarygrade()); + datosmail.put("funcionario",personDetailObj.getName()); + // CCA + TarmCentroControl centroControl=CentroControlArmasController.findPorCodigo(solicitud.getRecord().getCcentrocontrol()); + datosmail.put("centrocontrol",centroControl.getModifiedData().get("desinstitucion")); + request.modifiedData().put("datosmail", datosmail); + } + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + + request.modifiedData().put("BPMObs", bpmDataComment); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + // CATEGORIA 14 PREVIA IMPORTACION + if(bpmDataStatus.equals("D")){ + TarmTramite tarmTramite = TarmTramiteController.find(this.solicitud.getRecord().getCtramite().toString()); + if(tarmTramite.getCategoria().equals("14")){ + desasociarCargaSolicitud(); + } + } + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void desasociarCargaSolicitud(){ + try{ + TarmCarga carga = CargaController.findByAUCP(solicitud.getRecord().getAucp()); + if(carga!=null){ + carga.setCsolicitud(null); + cargaController.update(carga); + cargaController.save(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public boolean isInicioPorFlujo() { + return inicioPorFlujo; + } + + public void setInicioPorFlujo(boolean inicioPorFlujo) { + this.inicioPorFlujo = inicioPorFlujo; + } + + public List getLmarca() { + return lmarca; + } + + public void setLmarca(List lmarca) { + this.lmarca = lmarca; + } + + public CargaController getCargaController() { + return cargaController; + } + + public void setCargaController(CargaController cargaController) { + this.cargaController = cargaController; + } + + public Boolean getRequiereNoSolAucpBln() { + return requiereNoSolAucpBln; + } + + public void setRequiereNoSolAucpBln(Boolean requiereNoSolAucpBln) { + this.requiereNoSolAucpBln = requiereNoSolAucpBln; + } + + public String getNombreInstitucion() { + return nombreInstitucion; + } + + public String setNombreInstitucion(String nombreInstitucion) { + if(nombreInstitucion!=null && !nombreInstitucion.isEmpty()){ + this.nombreInstitucion = nombreInstitucion; + }else{ + this.nombreInstitucion = ""; + } + + return nombreInstitucion; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteControlInventarioController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteControlInventarioController.java.svn-base new file mode 100644 index 0000000..dc486b0 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteControlInventarioController.java.svn-base @@ -0,0 +1,372 @@ +package com.fp.frontend.controller.armas.solicitud; + + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de reporte de liquidacion economica + * + * @author Christian Pazmino. + * @version 2.1 + */ + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReporteControlInventarioController extends AbstractController { + + + /** + * Fecha a partir de la cual se sacan datos para el reporte + * */ + private Date fechaFin; + /** + * Formato de reporte que se va a generar + * */ + private String format = "xls"; + /** + * Usuario actual logueado en el sistema + * */ + private TsafeUserDetail userDetail; + /** + * Nombre del reporte generado en el Alfresco + * */ + private String nombreReporte; + /** + * Id del centro de control seleccionado por el usuario + * */ + private String idCentroControl; + + /** + * Ruta base del reporte generado en el Alfresco + * */ + private String xPathLocation; + + private String institucionCentroControl=""; + private TarmCentroControl centroControl = new TarmCentroControl(); + + /** + * Clase controladora de reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + /** + * Clase controladora de funcionalidad del Alfresco + */ + @ManagedProperty(value="#{alfrescoController}") + private AlfrescoController alfrescoController; + + + public ReporteControlInventarioController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + recperpage = 10000; // Cambiar al # reg a mirar. + lrecord = new ArrayList(); + beanalias = "RPRTECONTROLINVENTARIO"; + obtenerCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + +// /** +// * Crea una instancia y marca el registro como nuevo. +// * +// * @throws Exception +// */ +// @Override +// public void create() throws Exception { +// super.create(); +// } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if(Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")){ + valorColocar = Boolean.TRUE; + } + for (AbstractDataTransport decomisoArmaObj : lrecord) { + decomisoArmaObj.getModifiedData().put("isSelect", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + + } + + /** + * Metodo para reconsultar en base a una nueva fecha de corte seleccionada + */ + public void cambioFechaDeCorte(SelectEvent event){ + querydatabase(); + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport() { + Calendar fechaActualCldr = Calendar.getInstance(); + Calendar fechaInicioCldr = Calendar.getInstance(); + Calendar fechaFinCldr = Calendar.getInstance(); +// fechaInicioCldr.setTime(fechaInicio); + fechaFinCldr.setTime(fechaFin); + + if(fechaActualCldr.compareTo(fechaFinCldr)>=0){ + String filename="controlInventario"; + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + TcustPersonDetail personaLogObj; + if(userDetail.getPk().getPersoncode()!=null){ + personaLogObj = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()); + nombreUsuario = personaLogObj.getName(); + } + else{ + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario); + parameters.put("fechaInicio", armarFormatoFechaSinHora(fechaInicioCldr)); +// fechaFinCldr.add(Calendar.DAY_OF_MONTH, 1); + parameters.put("fechaFin", armarFormatoFechaSinHora(fechaFinCldr)); + parameters.put("fechaReporte", armarFormatoFechaConHora(fechaActualCldr)); + + String path; + + path = "armas/reports/controlInventario"; + parameters.put("idCentroControl", centroControl.getPk()); + // Datos del CENTRO DE CONTROL + parameters.put("nombreCentroControl", institucionCentroControl); + // Datos del jefe del centro + if(centroControl.getPersoncode()!=null){ + TcustPersonDetail jefeCentroObj = PersonDetailController.find(centroControl.getPersoncode().toString()); + String gradoJefeCentro = jefeCentroObj.getMilitarygrade()==null?"": jefeCentroObj.getMilitarygrade() + " - "; + parameters.put("nombreJefCentro", gradoJefeCentro + jefeCentroObj.getName()==null?"":jefeCentroObj.getName()); + parameters.put("personCodeJefCentro", jefeCentroObj.getPk().getPersoncode()==null?"1001":jefeCentroObj.getPk().getPersoncode()); + } + xPathLocation= getRutaDocumentoRepBase() + "/cm:"+ Utilidades.obtieneNombreLimpio(institucionCentroControl); + nombreReporte = "controlInventario.xls"; + //this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + InputStream file = this.reportController.jaspertoInputstreamXls(path, parameters, format, filename, this.getLoginController()); + if(!alfrescoController.uploadFile(file, nombreReporte, xPathLocation)){ + xPathLocation=null; + } + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + }else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_coninv_fechaMayorAFechaActual")); + } + } + + /** + * Retorna la ruta de documento base en donde se almacenará el reporte + * + * @return + */ + public String getRutaDocumentoRepBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta = new StringBuilder("cm:Inventario"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); +// nombreReporte = "controlInventario " + calendar.get(Calendar.DAY_OF_MONTH) + "-" + calendar.get(Calendar.MONTH) + " " +// + calendar.get(Calendar.HOUR_OF_DAY) + "H" + calendar.get(Calendar.MINUTE) + "M.xlsx"; + return ruta.toString(); + } + + /** + * Metodo que se debe ejecutar cuando es una transaccion de tipo verificar armas + * @throws Exception + */ + private void obtenerCentroControl() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + + } + +// parameters.put("fechaCorte", fechaCorteSB.toString()); +// parameters.put("codArmasDecomisadasLst", actualizarArmasSeleccionadas()); + + public StringBuilder armarFormatoFechaSinHora(Calendar fechaCldr){ + StringBuilder fechaStr= new StringBuilder(); + fechaStr = fechaStr.append((fechaCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCldr.get(Calendar.DAY_OF_MONTH))); + fechaStr = fechaStr.append("-").append((fechaCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaCldr.get(Calendar.MONTH) + 1) : (fechaCldr.get(Calendar.MONTH)+1)); + fechaStr = fechaStr.append("-").append(fechaCldr.get(Calendar.YEAR)); + return fechaStr; + } + + public StringBuilder armarFormatoFechaConHora(Calendar fechaCldr){ + StringBuilder fechaStr= new StringBuilder(); + fechaStr = fechaStr.append((fechaCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCldr.get(Calendar.DAY_OF_MONTH))); + fechaStr = fechaStr.append("-").append((fechaCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaCldr.get(Calendar.MONTH) + 1) : (fechaCldr.get(Calendar.MONTH)+1)); + fechaStr = fechaStr.append("-").append(fechaCldr.get(Calendar.YEAR)); + fechaStr = fechaStr.append(" ").append(fechaCldr.get(Calendar.HOUR_OF_DAY)); + fechaStr = fechaStr.append(":").append((fechaCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaCldr.get(Calendar.MINUTE)) : (fechaCldr.get(Calendar.MINUTE))); + return fechaStr; + } + + /** + * Método para el inicio de flujo. Guardar el reporte creado para su posterior aprobacion en otras instancias del flujo + */ + @Override + public void save(){ + + } + + public Date getFechaFin() { + return fechaFin; + } + + public void setFechaFin(Date fechaFin) { + this.fechaFin = fechaFin; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public String getNombreReporte() { + return nombreReporte; + } + + public void setNombreReporte(String nombreReporte) { + this.nombreReporte = nombreReporte; + } + + public String getIdCentroControl() { + return idCentroControl; + } + + public void setIdCentroControl(String idCentroControl) { + this.idCentroControl = idCentroControl; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public String getxPathLocation() { + return xPathLocation; + } + + public void setxPathLocation(String xPathLocation) { + this.xPathLocation = xPathLocation; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteDestruccionArmasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteDestruccionArmasController.java.svn-base new file mode 100644 index 0000000..7c767a2 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteDestruccionArmasController.java.svn-base @@ -0,0 +1,1308 @@ +package com.fp.frontend.controller.armas.solicitud; + + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.apache.commons.lang.StringUtils; +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReporteDestruccionArmasController extends AbstractController { + + private List lTipoReporte=new ArrayList(); + private TcustPersonDetail usuario; + // Filtros de busqueda + private Date fechaCorte = new Date(); + private String numeroSerie; + /** + * atributo para habilitar o desabilitar al boton + * genera acta + */ + private Boolean btnGenerarActa; + /** + * atributo para habilitar o desabilitar al boton + * de seleccion por registro + */ + private Boolean btnTabGrid; + /** + * numero de custodia del arma + */ + private String numeroDecomiso; + private String institucionCentroControl=""; + private String institucionUnidadControl=""; + //Control destino + private String centroControlDestino; + + private String unidadDestino; + + private Boolean isCentroDpto = Boolean.FALSE; + + + /** + * Codigo del centro de control + */ + private String codigoOrganismoControlDestino; + /** + * codigo de la unidad de control + */ + private String codigoUnidadControlDestino; + + private String centroControlActual; + private String unidadActual; + + private List centroControlsDestinos; + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List unidadesDestinos; + + private String format; + private String tipoReporte; + private TsafeUserDetail userDetail; + private Integer diasParaDestruirArma; + private TarmCentroControl centroControl = new TarmCentroControl(); + + private String numeroTransaccionEnvio=""; + private String numeroTransaccionRecepcion=""; + private String numeroTransaccion; + private String numeroTransaccionEnvioConvertido=""; + private String filtroData=""; + private boolean transaccionVerificarArmas; + private boolean transaccionAprobarActaEntrega; + private String xpathflujo; + private TcustPersonDetail responsableCentroControl= null; + List listTarmDecomisoArma = new ArrayList<>(); + private String envioFlujo;//recibe del flujo el numero de transaccion = "ENV-000000310" + private String pathflujo;//recibe del flujo la ruta del archivo + private String cprovincia; + private Boolean btnFlujo; + private Boolean btnGrabar; + /** + * codigo del decomiso del catalogo ESTADOARMA + */ + private String codigoDecomiso; + /** + * codigo de la incautacion del catalogo ESTADOARMA + */ + private String codigoIncautacion; + /** + * codigo de la entrega voluntaria del catalogo ESTADOARMA + */ + private String codigoEntVol; + /** + * codigo del abandono del catalogo ESTADOARMA + */ + private String codigoAbandono; + /** + * codigo del reclamo del catalogo ESTADOARMA + */ + private String codigoReclamo; + + /** + * estado operacion del decomiso del catalogo ESTADOARMA + */ + private String estadoOperacion; + + /** + * Deshabilita la pantalla después de grabar la solicitud + */ + private boolean btnSelTodos; + /** + * Deshabilita la pantalla para filtros después de grabar la solicitud + */ + private boolean btnFiltros; + + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value="#{alfrescoController}") + private AlfrescoController alfrescoController; + + @ManagedProperty(value = "#{transaccionArmaBodegaController}") + private TransaccionArmaBodegaController transaccionArmaBodegaController; + + @ManagedProperty(value = "#{bodegaController}") + private BodegaController bodegaController; + + @ManagedProperty(value = "#{decomisoArmaTransaccionController}") + private DecomisoArmaTransaccionController decomisoArmaTransaccionController; + + public ReporteDestruccionArmasController() throws Exception { + super(TarmDecomisoArma.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + startQuery(); + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + xpathflujo=super.getMfilters().get("xpath");//"cm:Decomiso/cm:A-2014/cm:M-10/cm:ENV-000000319/cm:ENV-000000319.pdf";// + String numerotransaccion=super.getMfilters().get("numerotransaccion"); + TarmDecomisoArmaTransaccion decomisoArmaTransaccion =decomisoArmaTransaccionController.find(numerotransaccion); + envioFlujo=decomisoArmaTransaccion.getNumerotransaccion(); + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + format = "pdf"; + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + diasParaDestruirArma = ParametersController.find("DIASENBODEGA.DESTRUIRARMAS", "1").getNumbervalue().intValue(); + lTipoReporte = CatalogDetailController.find("TIPOREPORTE"); + this.unidadesDestinos = new ArrayList<>(); + this.unidadDestino = ""; + this.centroControlsDestinos = CatalogDetailController.find("INSTITUCION"); + //Tenia antes 10000 + recperpage = 30000; + lrecord = new ArrayList<>(); + beanalias = "RPRTEDESTRUCCIONDEARMAS"; + obtenerCentroControl(); + + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + centroControlActual = tsafeUserDetail.getModifiedData().get("centrocontrol").toString(); + unidadActual = tsafeUserDetail.getModifiedData().get("unidad").toString(); + + //codigoOrganismoControl = tsafeUserDetail.getCcentrocontrol(); + //codigoUnidadControl = tsafeUserDetail.getCcentrocontrol(); + //querydatabase(); + this.responsableCentroControl = new TcustPersonDetail(); + this.obtenerResponsableCentroControl(); + this.numeroTransaccion=null; + this.btnFlujo=Boolean.FALSE; + //boton desabilitado + this.btnGrabar=Boolean.TRUE; + this.btnGenerarActa=Boolean.TRUE; + this.btnTabGrid=Boolean.TRUE; + this.btnSelTodos = Boolean.TRUE; + this.btnFiltros = Boolean.FALSE; + this.estadoOperacion = "RECEPCION"; + this.codigoDecomiso=codigos("CODIGO.DECOMISADA");//DECOMISO + this.codigoIncautacion=codigos("CODIGO.INCAUTADA");//INCAUTACION + this.codigoEntVol=codigos("CODIGO.ENTV");//ENTREGA VOLUNTARIA + this.codigoAbandono=codigos("CODIGO.ABAN");//ABANDONO + this.codigoReclamo=codigos("CODIGO.RECL");//RECLAMO + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para obtener los codigos + */ + private String codigos(String parametro){ + TgeneParameters tgeneParameters= ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + /** + * Metodo que se debe ejecutar cuando es una transaccion de tipo verificar armas + * @throws Exception + */ + private void obtenerCentroControl() throws Exception { + + if(this.getLoginController()!=null && 53 == this.getLoginController().getRequest().getTransactionCode() && "30".equals(getLoginController().getRequest().getTransactionModule())){ + transaccionVerificarArmas = true; + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + centroControl= CentroControlArmasController.findPorCodigo(tsafeUserDetail.getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo( centroControl.getInstitucion(), centroControl.getInstituciontipo()).getDescription(); + institucionUnidadControl = CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + cprovincia=centroControl.getProvincecode(); + } + /** + * Obtiene el responsable del Centro de Control + */ + + + if(this.getLoginController()!=null && 58 == this.getLoginController().getRequest().getTransactionCode() && "30".equals(getLoginController().getRequest().getTransactionModule())){ + + transaccionAprobarActaEntrega=true; + numeroTransaccionEnvio = envioFlujo; + listTarmDecomisoArma = DecomisoArmaTransaccionController.findPorEnvio(numeroTransaccionEnvio,false); + centroControl= CentroControlArmasController.findPorCodigo(listTarmDecomisoArma.get(0).getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo( centroControl.getInstitucion(), centroControl.getInstituciontipo()).getDescription(); + institucionUnidadControl = CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + fechaCorte = listTarmDecomisoArma.get(0).getFcorte(); + querydatabase(); + + } + + } + + public void obtenerResponsableCentroControl(){ + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + /** + * Carga las unidades de control por el centro de control + */ + public void seleccionaCentroControlDestino(){ + if(centroControlDestino!=null){ + unidadesDestinos = CentroControlArmasController.findxInstitucion(centroControlDestino); + }else{ + unidadesDestinos=new ArrayList<>(); + } + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if(Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")){ + valorColocar = Boolean.TRUE; + } + + btnGrabar=Boolean.TRUE; + for (TarmDecomisoArma decomisoArma : lrecord) { + decomisoArma.getModifiedData().put("seleccion", valorColocar); + if(decomisoArma.getModifiedData().get("seleccion").equals(Boolean.TRUE)){ + btnGrabar=Boolean.FALSE; + //itemsUnidadBolean=Boolean.TRUE; + } + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Generar Acta + */ + public void generarActa(){ + String gradoUsuario =""; + + if(fechaCorte!=null){ + Calendar fechaActualCldr = Calendar.getInstance(); + List listTarmDecomisoArma = DecomisoArmaTransaccionController.findPorEnvio(numeroTransaccionEnvioConvertido,false); + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if(grado != null){ + gradoUsuario = grado.getDescription()+" - "+this.responsableCentroControl.getName(); + }else{ + gradoUsuario = "Sin Grado - "+this.responsableCentroControl.getName(); + } + + String codigoreporte=listTarmDecomisoArma.get(0).getPk().toString(); + String path = "armas/reports/entregaArmasacta"; + String filename=numeroTransaccionEnvioConvertido; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("fechaCorte", (new SimpleDateFormat("dd-MM-yyyy")).format(fechaCorte).toString()); + parameters.put("codResponsable",this.responsableCentroControl.getPk().getPersoncode()); + parameters.put("gradoUsuario",gradoUsuario.trim()); + try { + + //Usuario logueado en la aplicacion + String nombreUsuario; + if(userDetail.getPk().getPersoncode()!=null){ + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + } + else{ + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario.trim()); + parameters.put("centrocontrolorigen", institucionCentroControl.trim()); + parameters.put("unidadcontrolorigen", institucionUnidadControl.trim()); + TarmCentroControl centroControlDestino = CentroControlArmasController.findPorCodigo(unidadDestino); + String centroControlDestinoStr = CatalogDetailController.findxCodigoCodcatalogo( centroControlDestino.getInstitucion(), centroControlDestino.getInstituciontipo()).getDescription(); + String unidadControlDestinoStr = CatalogDetailController.findxCodigoCodcatalogo( centroControlDestino.getNombreinstitucion(), centroControlDestino.getNombreinstitucioncodigo()).getDescription(); + + parameters.put("centrocontroldestino", centroControlDestinoStr.trim()); + parameters.put("unidadcontroldestino", unidadControlDestinoStr.trim()); + parameters.put("tecnicoAlmacenamiento",MsgControlArmas.getProperty("tecnicoAlmacenamiento")+" "+institucionCentroControl); + parameters.put("jefe",MsgControlArmas.getProperty("jefe")+" "+institucionCentroControl); + parameters.put("codigodecomisoarma",codigoreporte); + parameters.put("tramite", numeroTransaccionEnvioConvertido); + //Fecha actual + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH)+1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarFecha", fechaActualSB.toString()); + //parameters.put("transaccion",numeroTransaccionEnvioConvertido); + + + //format = CatalogDetailController.findxCodigoCodcatalogo(tipoReporte, "TIPOREPORTE").getLegalcode(); + format = "pdf"; + InputStream file =this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + xpathflujo = generarXpath(); + + alfrescoController.uploadFile(file,numeroTransaccionEnvioConvertido+".pdf",xpathflujo); + //="cm:Decomiso/cm:A-2016/cm:M-01/cm:CENTRO CONTROL/cm:ABANDONO/cm:ENV/cm:ENV-000000319.pdf" + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } + } + + /** + * Método para habilitar o desabilitar el btn + * Arma a decomisar + * @throws Exception + */ + public void onChange(TarmDecomisoArma decomisoArma ) throws Exception { + btnGrabar=Boolean.TRUE; + //itemsUnidadBolean=Boolean.FALSE; + for(TarmDecomisoArma t:lrecord){ + if(t.getModifiedData().get("seleccion").equals(Boolean.TRUE)){ + btnGrabar=Boolean.FALSE; + //itemsUnidadBolean=Boolean.TRUE; + } + } + } + + /** + * Metodo para generar la ruta del alfresco + * @return + */ + public String generarXpath(){ + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta=new StringBuilder("cm:Decomiso"); + + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + String centrocontrol=institucionUnidadControl.replaceAll("\\s+", "_"); + ruta = ruta.append("/cm:").append(centrocontrol); + ruta = ruta.append("/cm:"+"ENV"); + + return ruta.toString(); + } + + /** + * Método para devolver la descripcion + * + * @param list + * @param codigo + * @return + */ + public String catalogoDescripcion(List list, String codigo) { + for (TgeneCatalogDetail item : list) { + if (codigo.equals(item.getPk().getCatalog())) { + return item.getDescription(); + } + } + return null; + } + + /** + * Ejecuta un reporte de armas a destruir + * Método para el inicio de flujo + */ + public void iniciarFlujo() { + try { + if(xpathflujo==null || numeroTransaccion==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generereporte")); + return; + } + if(cprovincia==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinprovincia")); + return; + } + String xpath=xpathflujo+"/cm:"+numeroTransaccionEnvioConvertido+ ".pdf"; + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + //codigo de la tabla TarmDecomisoArmaTransaccion + request.modifiedData().put("numerotransaccion", numeroTransaccion); + //codigo de la provincia + request.modifiedData().put("cprovincia", cprovincia); + //ruta del archivo para la firma + //TODO Falta crear la variable en maia 2-8 + request.modifiedData().put("xpath", xpath); + request.modifiedData().put("numerosolicitud", numeroTransaccionEnvioConvertido); + request.modifiedData().put("isnew", "Y"); + request.setLogsolicitude(numeroTransaccionEnvioConvertido); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.setShowRow(true); + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + " NUMERO TRANSACCION: " +numeroTransaccion); + xpathflujo=null; + numeroTransaccion=null; + this.btnGrabar = Boolean.TRUE; + this.btnFlujo = Boolean.FALSE; + this.btnSelTodos = Boolean.TRUE; + this.btnGenerarActa=Boolean.TRUE; + numeroTransaccionEnvioConvertido=null; + + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + + /** + * Metodo para filtrar por el numero de transaccion despues de la realizacion del guardado + * @throws Exception + */ + protected void querydata() throws Exception { + filtroData = numeroTransaccionEnvio; + query(); + setFiltroData(""); + } + /** + * Se ejecuta cuando seleccionamos forzar consulta cuando hay data en el grid + */ + @Override + public void forcedQuery() throws Exception { + centroControlDestino = null; + this.init(); + super.forcedQuery(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + //clearAll(); + + /*this.btnGrabar=Boolean.TRUE; + this.btnGenerarActa=Boolean.TRUE; + this.btnSelTodos = Boolean.TRUE;*/ + + //Verificar si tiene o no contenido seleccionado + if (lrecord != null && !lrecord.isEmpty() && btnTabGrid) { + for (TarmDecomisoArma decomisoArma : lrecord) { + if (decomisoArma.getModifiedData().get("seleccion") + .equals(Boolean.TRUE)) { + RequestContext.getCurrentInstance().execute( + "PF('queryConfirmDialog').show()"); + return; + } + + } + + } + try { + numeroTransaccionEnvio=filtroData; + if(fechaCorte!=null && !fechaCorte.after(new Date())){ + + DtoQuery dto = this.getDtoQuery(); + dto.setOrderby("t.fdecomiso"); + Request request = this.callerhelper.getRequest(); + if((transaccionVerificarArmas || transaccionAprobarActaEntrega) && centroControl==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sin_centrocontrol")); + return; + } + if(numeroTransaccionRecepcion!=null && !numeroTransaccionRecepcion.isEmpty() && !numeroTransaccionRecepcion.substring(0, 3).equalsIgnoreCase("REC")){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_numero_recepcion")); + return; + } + + if(transaccionVerificarArmas){ + try { + + //Valores para el filtro + request.put("centroControl", centroControl.getPk()); + request.put("numeroDecomiso", numeroDecomiso); + request.put("numeroserie", numeroSerie); + request.put("fechacorte", fechaCorte.toString()); + //QueryRule VerificarArmasQuery + request.put("queryalias", "TRANSVERIFICARARMAS"); + + } catch (Exception e) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sin_decomisos")); + return; + } + }else if (transaccionAprobarActaEntrega){ + try { + dto = filtroAprobarActaEntrega(dto); + } catch (Exception e) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sin_decomisos")); + return; + } + } + else{ + Filter fechaFiltro= new Filter(); + fechaFiltro.setSql("t.fdecomiso < " + "TO_DATE('" + fechaCorte.toString() + "','yyyy-mm-dd')"); + dto.addFiltro(fechaFiltro); + } + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + btnSelTodos = Boolean.TRUE; + + MessageHelper.setMessageError(resp); + } else { + + lrecord = (List) resp.get(beanalias); + + if(lrecord!=null && !lrecord.isEmpty()){ + btnSelTodos = Boolean.FALSE; + + List listaNoenviada=new ArrayList(); + for(TarmDecomisoArma decomisoArma:lrecord){ + if(!filtroData.isEmpty()){ + + decomisoArma.getModifiedData().put("seleccion", Boolean.TRUE); + } + else{ + decomisoArma.getModifiedData().put("seleccion", Boolean.FALSE); + } + if(decomisoArma.getModifiedData().get("estadoflujo")!=null && decomisoArma.getModifiedData().get("estadoflujo").equals("NOENV")){ + listaNoenviada.add(decomisoArma); + } + } + for(TarmDecomisoArma decomisoArma:listaNoenviada){ + lrecord.remove(decomisoArma); + } + super.postQuery(lrecord); + }else{ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_info_consultarArmasDecomidas")); + } + + } + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_fechaCorteMayorAFechaActual")); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private DtoQuery getDtoQuery() throws Exception{ + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryCarma= new SubQuery("TarmArmas","pk","ncodigoarma","i.pk=t.carma"); + dto.addSubQuery(subqueryCarma); + SubQuery subqueryTipoArmaExplosivo= new SubQuery("TgeneCatalogDetail","description","ntipo","i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o " + + " where o.pk= (select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))" + + " and i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + SubQuery subqueryClasecatalogo= new SubQuery("TgeneCatalogDetail","description","nclase","i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma)) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o " + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))"); + dto.addSubQuery(subqueryClasecatalogo); + SubQuery subqueryRazonSocial= new SubQuery("TcustPersonDetail","name","razonsPropietario","i.pk.personcode=(select p.personcode from TarmRegistroArmas p where p.pk=(select o.cregistro from TarmArmas o where o.pk=t.carma)) " + + " and i.pk.dateto=to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryRazonSocial); + SubQuery subqueryIndentificacion= new SubQuery("TcustPersonDetail","identification","documentoPropietario","i.pk.personcode=(select p from TarmRegistroArmas p where p.pk=(select o.cregistro from TarmArmas o where o.pk=t.carma)) " + + " and i.pk.dateto=to_date('2999-12-31', 'YYYY-MM-DD')"); + + dto.addSubQuery(subqueryIndentificacion); + + + SubQuery subquerylonguitud= new SubQuery("TgeneCatalogDetail","description","nlongitud","i.pk.catalog= (select o.longitud from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma)) and " + + " i.pk.catalogcode=(select o.longitudcodigo from TarmTipoArmaExplosivo o " + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))"); + dto.addSubQuery(subquerylonguitud); + SubQuery subqueryCalibre= new SubQuery("TarmTipoArmaExplosivo","calibre","ncalibre","i.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma)"); + dto.addSubQuery(subqueryCalibre); + + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","nmarca","i.pk.catalog= (select o.marca from TarmArmas o where o.pk=t.carma)" + + " and i.pk.catalogcode=(select o.marcacodigo from TarmArmas o where o.pk=t.carma)"); + dto.addSubQuery(subqueryMarca); + + SubQuery subqueryLote= new SubQuery("TarmArmas","lote","nserie","i.pk=t.carma"); + dto.addSubQuery(subqueryLote); + + + SubQuery subqueryNRecivo= new SubQuery("TarmDecomiso","numerorecibo","nrecibo","i.pk=t.cdecomiso"); + dto.addSubQuery(subqueryNRecivo); + SubQuery subqueryNTransaccion= new SubQuery("TarmDecomiso","numerotransaccion","numerotransaccion","i.pk=t.cdecomiso"); + dto.addSubQuery(subqueryNTransaccion); + SubQuery subqueryUnidadTipo= new SubQuery("TgeneCatalogDetail","description","nunidad","i.pk.catalog= (select o.unidadmedidapeso from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma)) and " + + " i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))"); + dto.addSubQuery(subqueryUnidadTipo); + + SubQuery subqueryColor= new SubQuery("TgeneCatalogDetail","description","color","i.pk.catalog= (select o.color from TarmArmas o where o.pk=t.carma)" + + " and i.pk.catalogcode=(select o.colorcodigo from TarmArmas o where o.pk=t.carma)"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado= new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog= (select o.estado from TarmArmas o where o.pk=t.carma) " + + " and i.pk.catalogcode=(select o.estadocodigo from TarmArmas o where o.pk=t.carma)"); + dto.addSubQuery(subqueryEstado); + //tarmdecomiso + SubQuery subquerynrecibo= new SubQuery("TarmDecomiso","numerorecibo","nrecibo","i.pk=t.cdecomiso"); + dto.addSubQuery(subquerynrecibo); + SubQuery subquerynrazon= new SubQuery("TarmDecomiso","nombrerazonsocial","nrazons","i.pk=t.cdecomiso"); + dto.addSubQuery(subquerynrazon); + SubQuery subquerydocumento= new SubQuery("TarmDecomiso","numerodocumento","documento","i.pk=t.cdecomiso"); + dto.addSubQuery(subquerydocumento); + + SubQuery subqueryestadoflujo= new SubQuery("TarmDecomisoArmaTransaccion","estadoflujo","estadoflujo","i.pk=t.cdecomisoarmatransaccion"); + dto.addSubQuery(subqueryestadoflujo); + return dto; + } + + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + if(unidadDestino==null || unidadDestino.isEmpty() || centroControlDestino==null || centroControlDestino.isEmpty()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_verificarcentcontdestino")); + return; + } + if(this.getLoginController()!=null && 53 == this.getLoginController().getRequest().getTransactionCode() && "30".equals(getLoginController().getRequest().getTransactionModule())){ + List listaSeleccionada = new ArrayList(); + Boolean seleccion = Boolean.FALSE; + + for(TarmDecomisoArma decomisoArma:this.lrecord){ + record = decomisoArma; + + if(record.getModifiedData().get("seleccion").equals(Boolean.TRUE)){ + seleccion = true; + record.setCdecomisoarmatransaccion(0l);//valor cualquiera seteado para que el transaction rule lo tome como actualizacion + record.setCoperaciontransaccion("ENVIO"); + transaccionArmaBodegaController.create(); + transaccionArmaBodegaController.getRecord().setCarma(record.getCarma()); + transaccionArmaBodegaController.getRecord().setCcentrocontrolorigen(centroControl.getPk()); + //Nuevo le doy destino de envio + transaccionArmaBodegaController.getRecord().setCcentrocontroldestino(unidadDestino); + transaccionArmaBodegaController.update(); + + bodegaController.create(); + bodegaController.getRecord().setCarma(record.getCarma()); + bodegaController.getRecord().setCcentrocontrol(centroControl.getPk()); + bodegaController.update(); + listaSeleccionada.add(record); + } + this.update(); + } + + if(!seleccion){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_verificararmas")); + return; + } + + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + + Calendar cal=Calendar.getInstance(); + cal.setTime(fechaCorte); + java.sql.Date fechaCorteRegistro=new java.sql.Date(cal.getTimeInMillis()); + + this.decomisoArmaTransaccionController.create(); + this.decomisoArmaTransaccionController.getRecord().setFtransaccion(null); + this.decomisoArmaTransaccionController.getRecord().setFcorte(fechaCorteRegistro); + this.decomisoArmaTransaccionController.getRecord().setCcentrocontrol(centroControl.getPk()); + + if(!"1".equals(CatalogDetailController.findxCodigoCodcatalogo( centroControl.getInstitucion(), centroControl.getInstituciontipo()).getPk().getCatalog())){ + this.decomisoArmaTransaccionController.getRecord().setEstadofirma("Y"); + this.decomisoArmaTransaccionController.getRecord().setEstadoflujo("ENV"); + isCentroDpto = Boolean.FALSE; + }else{ + this.decomisoArmaTransaccionController.getRecord().setEstadofirma("N"); + this.decomisoArmaTransaccionController.getRecord().setEstadoflujo("NOENV"); + isCentroDpto = Boolean.TRUE; + } + + this.decomisoArmaTransaccionController.update(); + + DtoSave dtosaveDecomisoTran = this.decomisoArmaTransaccionController.getDtoSave(true); + dtosaveDecomisoTran.setReturnpk(true); + dtosaveDecomisoTran.setPosition(1); + msave.put(decomisoArmaTransaccionController.getBeanalias(), dtosaveDecomisoTran); + + DtoSave dtosaveDecomiso = this.getDtoSave(true); + dtosaveDecomiso.setReturnpk(true); + dtosaveDecomiso.setPosition(2); + msave.put(getBeanalias(), dtosaveDecomiso); + + DtoSave dtosaveBodegaTransaccion = this.transaccionArmaBodegaController.getDtoSave(); + dtosaveBodegaTransaccion.setReturnpk(true); + dtosaveBodegaTransaccion.setPosition(3); + msave.put( this.transaccionArmaBodegaController.getBeanalias(), dtosaveBodegaTransaccion); + + DtoSave dtosaveBodega = this.bodegaController.getDtoSave(); + dtosaveBodega.setReturnpk(true); + dtosaveBodega.setPosition(4); + msave.put( this.bodegaController.getBeanalias(), dtosaveBodega); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + + this.decomisoArmaTransaccionController.postCommit(resp); + this.transaccionArmaBodegaController.postCommit(resp); + this.bodegaController.postCommit(resp); + numeroTransaccionEnvio = String.valueOf(((TarmDecomisoArmaTransaccion)(dtosaveDecomisoTran.getLinsert().get(0))).getPk()); + numeroTransaccion=numeroTransaccionEnvio; + setNumeroTransaccionEnvioConvertido("ENV"+"-"+StringUtils.leftPad(numeroTransaccionEnvio, 9, '0')); + this.btnGrabar = Boolean.TRUE; + this.btnFlujo = Boolean.TRUE; + this.btnSelTodos = Boolean.TRUE; + this.btnFiltros = Boolean.TRUE; + this.btnTabGrid=Boolean.FALSE; + this.postCommit(resp); + lrecord = listaSeleccionada; + MessageHelper.setMessageInfo(resp); + + FacesContext context = FacesContext.getCurrentInstance(); + context.addMessage(null, new FacesMessage("RECUERDE", MsgControlArmas.getProperty("msg_recuerdeClickGenerarActa"))); + context.addMessage(null, new FacesMessage("RECUERDE", MsgControlArmas.getProperty("msg_recuerdeClickContinuarTramite"))); + } else { + MessageHelper.setMessageError(resp); + } + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + /** + * Para realizar el filtro por acta de aprobación + * @param dto Dto de los datos consultados + * @return + * @throws Exception + */ + private DtoQuery filtroAprobarActaEntrega(DtoQuery dto) throws Exception { + + fechaCorte=new Date(); + numeroTransaccionEnvio=envioFlujo; + + Filter decomisoFiltro= new Filter(); + + decomisoFiltro.setSql(" t.cdecomisoarmatransaccion= '" + listTarmDecomisoArma.get(0).getPk() + "'"); + dto.addFiltro(decomisoFiltro); + + + return dto; + } + + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport() { + if(fechaCorte!=null){ + Calendar fechaActualCldr = Calendar.getInstance(); + Calendar fechaCorteCldr = Calendar.getInstance(); + fechaCorteCldr.setTime(fechaCorte); + if(fechaActualCldr.compareTo(fechaCorteCldr)>=0){ + String path = "armas/reports/destruccionArmas"; + String filename="armas"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + try { + + //Usuario logueado en la aplicacion + String nombreUsuario; + if(userDetail.getPk().getPersoncode()!=null){ + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } + else{ + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario); + + //Fecha de corte + StringBuilder fechaCorteSB= new StringBuilder(); + fechaCorteSB = fechaCorteSB.append((fechaCorteCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCorteCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCorteCldr.get(Calendar.DAY_OF_MONTH))); + fechaCorteSB = fechaCorteSB.append("-").append((fechaCorteCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaCorteCldr.get(Calendar.MONTH) + 1) : (fechaCorteCldr.get(Calendar.MONTH)+1)); + fechaCorteSB = fechaCorteSB.append("-").append(fechaCorteCldr.get(Calendar.YEAR)); + parameters.put("fechaCorte", fechaCorteSB.toString()); + + //Fecha actual + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH)+1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarFecha", fechaActualSB.toString()); + + //Fecha de referencia + Calendar fechaReferenciaReporteCldr = Calendar.getInstance(); + fechaReferenciaReporteCldr.setTime(fechaCorte); + fechaReferenciaReporteCldr.add(Calendar.DAY_OF_MONTH, -diasParaDestruirArma); + StringBuilder fechaReferenciaSB = new StringBuilder(); + fechaReferenciaSB = fechaReferenciaSB.append((fechaReferenciaReporteCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaReferenciaReporteCldr.get(Calendar.DAY_OF_MONTH)) : (fechaReferenciaReporteCldr.get(Calendar.DAY_OF_MONTH))); + fechaReferenciaSB = fechaReferenciaSB.append("-").append((fechaReferenciaReporteCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaReferenciaReporteCldr.get(Calendar.MONTH) + 1) : (fechaReferenciaReporteCldr.get(Calendar.MONTH)+1)); + fechaReferenciaSB = fechaReferenciaSB.append("-").append(fechaReferenciaReporteCldr.get(Calendar.YEAR)); + parameters.put("fechaReferenciaReporte", fechaReferenciaSB.toString()); + + //format = CatalogDetailController.findxCodigoCodcatalogo(tipoReporte, "TIPOREPORTE").getLegalcode(); + format = "pdf"; + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_fechaCorteMayorAFechaActual")); + } + } + } + + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("numerotransaccion", envioFlujo); + request.modifiedData().put("xpath", pathflujo); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public List getlTipoReporte() { + return lTipoReporte; + } + + public void setlTipoReporte(List lTipoReporte) { + this.lTipoReporte = lTipoReporte; + } + + public TcustPersonDetail getUsuario() { + return usuario; + } + + public void setUsuario(TcustPersonDetail usuario) { + this.usuario = usuario; + } + + public Date getFechaCorte() { + return fechaCorte; + } + + public void setFechaCorte(Date fechaCorte) { + this.fechaCorte = fechaCorte; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getTipoReporte() { + return tipoReporte; + } + + public void setTipoReporte(String tipoReporte) { + this.tipoReporte = tipoReporte; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public Integer getDiasParaDestruirArma() { + return diasParaDestruirArma; + } + + public void setDiasParaDestruirArma(Integer diasParaDestruirArma) { + this.diasParaDestruirArma = diasParaDestruirArma; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public boolean isTransaccionVerificarArmas() { + return transaccionVerificarArmas; + } + + public void setTransaccionVerificarArmas(boolean transaccionVerificarArmas) { + this.transaccionVerificarArmas = transaccionVerificarArmas; + } + + public DecomisoArmaTransaccionController getDecomisoArmaTransaccionController() { + return decomisoArmaTransaccionController; + } + + public void setDecomisoArmaTransaccionController( + DecomisoArmaTransaccionController decomisoArmaTransaccionController) { + this.decomisoArmaTransaccionController = decomisoArmaTransaccionController; + } + + public TransaccionArmaBodegaController getTransaccionArmaBodegaController() { + return transaccionArmaBodegaController; + } + + public void setTransaccionArmaBodegaController( + TransaccionArmaBodegaController transaccionArmaBodegaController) { + this.transaccionArmaBodegaController = transaccionArmaBodegaController; + } + + public String getNumeroTransaccionEnvio() { + return numeroTransaccionEnvio; + } + + public void setNumeroTransaccionEnvio(String numeroTransaccionEnvio) { + this.numeroTransaccionEnvio = numeroTransaccionEnvio; + } + + public String getNumeroTransaccionEnvioConvertido() { + return numeroTransaccionEnvioConvertido; + } + + public void setNumeroTransaccionEnvioConvertido( + String numeroTransaccionEnvioConvertido) { + this.numeroTransaccionEnvioConvertido = numeroTransaccionEnvioConvertido; + } + + public String getFiltroData() { + return filtroData; + } + + public void setFiltroData(String filtroData) { + this.filtroData = filtroData; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + public String getNumeroTransaccion() { + return numeroTransaccion; + } + + public void setNumeroTransaccion(String numeroTransaccion) { + this.numeroTransaccion = numeroTransaccion; + } + + public Boolean getBtnFlujo() { + return btnFlujo; + } + + public void setBtnFlujo(Boolean btnFlujo) { + this.btnFlujo = btnFlujo; + } + + public Boolean getBtnGrabar() { + return btnGrabar; + } + + public void setBtnGrabar(Boolean btnGrabar) { + this.btnGrabar = btnGrabar; + } + + public BodegaController getBodegaController() { + return bodegaController; + } + + public void setBodegaController(BodegaController bodegaController) { + this.bodegaController = bodegaController; + } + + public String getInstitucionUnidadControl() { + return institucionUnidadControl; + } + + public void setInstitucionUnidadControl(String institucionUnidadControl) { + this.institucionUnidadControl = institucionUnidadControl; + } + + public String getNumeroSerie() { + return numeroSerie; + } + + public void setNumeroSerie(String numeroSerie) { + this.numeroSerie = numeroSerie; + } + + public String getNumeroDecomiso() { + return numeroDecomiso; + } + + public void setNumeroDecomiso(String numeroDecomiso) { + this.numeroDecomiso = numeroDecomiso; + } + + public String getCentroControlDestino() { + return centroControlDestino; + } + + public void setCentroControlDestino(String centroControlDestino) { + this.centroControlDestino = centroControlDestino; + } + + public String getUnidadDestino() { + return unidadDestino; + } + + public void setUnidadDestino(String unidadDestino) { + this.unidadDestino = unidadDestino; + } + + public List getCentroControlsDestinos() { + return centroControlsDestinos; + } + + public void setCentroControlsDestinos(List centroControlsDestinos) { + this.centroControlsDestinos = centroControlsDestinos; + } + + public List getUnidadesDestinos() { + return unidadesDestinos; + } + + public void setUnidadesDestinos(List unidadesDestinos) { + this.unidadesDestinos = unidadesDestinos; + } + + public Boolean getBtnGenerarActa() { + return btnGenerarActa; + } + + public void setBtnGenerarActa(Boolean btnGenerarActa) { + this.btnGenerarActa = btnGenerarActa; + } + + public String getCodigoOrganismoControlDestino() { + return codigoOrganismoControlDestino; + } + + public void setCodigoOrganismoControlDestino( + String codigoOrganismoControlDestino) { + this.codigoOrganismoControlDestino = codigoOrganismoControlDestino; + } + + public String getCodigoUnidadControlDestino() { + return codigoUnidadControlDestino; + } + + public void setCodigoUnidadControlDestino(String codigoUnidadControlDestino) { + this.codigoUnidadControlDestino = codigoUnidadControlDestino; + } + + /** + * @return the centroControlActual + */ + public String getCentroControlActual() { + return centroControlActual; + } + + /** + * @param centroControlActual the centroControlActual to set + */ + public void setCentroControlActual(String centroControlActual) { + this.centroControlActual = centroControlActual; + } + + /** + * @return the unidadActual + */ + public String getUnidadActual() { + return unidadActual; + } + + /** + * @param unidadActual the unidadActual to set + */ + public void setUnidadActual(String unidadActual) { + this.unidadActual = unidadActual; + } + + public boolean isBtnSelTodos() { + return btnSelTodos; + } + + public void setBtnSelTodos(boolean btnSelTodos) { + this.btnSelTodos = btnSelTodos; + } + + /** + * @return the numeroTransaccionRecepcion + */ + public String getNumeroTransaccionRecepcion() { + return numeroTransaccionRecepcion; + } + + /** + * @param numeroTransaccionRecepcion the numeroTransaccionRecepcion to set + */ + public void setNumeroTransaccionRecepcion(String numeroTransaccionRecepcion) { + this.numeroTransaccionRecepcion = numeroTransaccionRecepcion; + } + + /** + * @return the btnTabGrid + */ + public Boolean getBtnTabGrid() { + return btnTabGrid; + } + + /** + * @param btnTabGrid the btnTabGrid to set + */ + public void setBtnTabGrid(Boolean btnTabGrid) { + this.btnTabGrid = btnTabGrid; + } + + /** + * @return the btnFiltros + */ + public boolean isBtnFiltros() { + return btnFiltros; + } + + /** + * @param btnFiltros the btnFiltros to set + */ + public void setBtnFiltros(boolean btnFiltros) { + this.btnFiltros = btnFiltros; + } + + public Boolean getIsCentroDpto() { + return isCentroDpto; + } + + public void setIsCentroDpto(Boolean isCentroDpto) { + this.isCentroDpto = isCentroDpto; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteDestruccionDeArmasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteDestruccionDeArmasController.java.svn-base new file mode 100644 index 0000000..ce04581 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteDestruccionDeArmasController.java.svn-base @@ -0,0 +1,784 @@ +package com.fp.frontend.controller.armas.solicitud; + + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.primefaces.component.selectbooleancheckbox.SelectBooleanCheckbox; +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmCabRepDestruirArmas; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDetRepDestruirArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de la generación de reporte de armas a destruirse + * + * @author Christian Pazmino. + * @version 2.1 + */ + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReporteDestruccionDeArmasController extends AbstractController { + + /** + * Fecha de corte a la que se generara el reporte + * */ + private Date fechaCorte; + /** + * Formato de reporte que se va a generar + * */ + private String format = "pdf"; + /** + * Usuario actual loogueado en el sistema + * */ + private TsafeUserDetail userDetail; + /** + * Variable de tipo entero que lee de la tabla parámetros el número de días en decomiso previo a la destrucción del arma + * */ + private Integer diasParaDestruirArma; + /** + * Catalogcode de la tabla Catálogos que funciona como bandera para indicar si un arma ya se encuentra en algún reporte previo. + * */ + private final String CATALOGCODEADESTRUIRSE = "ADESTRUIRSE"; + /** + * Ruta base del reporte generado en el Alfresco + * */ + private String xPathLocation; + /** + * Ubicacion completa del reporte generado en el Alfresco + * */ + private String xPath; + /** + * Nombre del reporte generado en el Alfresco + * */ + private String nombreReporte; + /** + * Codigo de cabecera del reporte generado en base de datos + * */ + private String creporte; + /** + * Bandera de tipo booleano para indicar si se genero o no el reporte + * */ + private Boolean seGeneroReporte; + /** + * Bandera de tipo booleano para indicar si se ha grabado el reporte generado + * */ + private Boolean isEnableGrabar; + /** + * Bandera de tipo booleano para indicar que se debe deshabilitar el boton iniciar flujo + * */ + private Boolean isEnableEnviar; + /** + * Variable del tipo TgeneCatalogDetail(Esta en reporte de armas a destruirse) + */ + private TgeneCatalogDetail aDestruirseCatalog; + /** + * Clase controladora de reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + /** + * Clase controladora de cabecera de reporte de armas a destruir + */ + @ManagedProperty(value = "#{cabRepDestruirArmasController}") + private CabRepDestruirArmasController cabRepDestruirArmasController; + /** + * Clase controladora de detalle de reporte de armas a destruir + */ + @ManagedProperty(value = "#{detRepDestruirArmasController}") + private DetRepDestruirArmasController detRepDestruirArmasController; + /** + * Clase controladora de funcionalidad del Alfresco + */ + @ManagedProperty(value="#{alfrescoController}") + private AlfrescoController alfrescoController; + /** + * codigo de la provincia del usuario logeado + */ + private String cprovincia; + public ReporteDestruccionDeArmasController() throws Exception { + super(TarmDecomisoArma.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + diasParaDestruirArma = ParametersController.find("DIASENBODEGA.DESTRUIRARMAS", "1").getNumbervalue().intValue(); + aDestruirseCatalog = CatalogDetailController.findxCodigoCodcatalogo("1", CATALOGCODEADESTRUIRSE); + recperpage = 10000; // Cambiar al # reg a mirar. + lrecord = new ArrayList(); + beanalias = "RPRTEDESTRUCCIONDEARMAS"; + seGeneroReporte = Boolean.FALSE; + isEnableGrabar = Boolean.TRUE; + isEnableEnviar = Boolean.FALSE; + TarmCentroControl centroControl=Utilidades.obtenerCentroControl(); + cprovincia=centroControl.getProvincecode(); + querydatabase(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + /** + * Metodo que se debe ejecutar cuando es una transaccion de tipo verificar armas + * @throws Exception + */ +// private void provinciaUsuario() throws Exception { +// PersonAddressController personAddressController = new PersonAddressController(); +// TcustPersonAddress tcustPersonAddres= personAddressController.findPrincipal(userDetail.getPk().getPersoncode().toString()); +// cprovincia=tcustPersonAddres.getProvincecode(); +// } + + /** + * Crea una instancia y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if(Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")){ + valorColocar = Boolean.TRUE; + } + for (TarmDecomisoArma decomisoArmaObj : lrecord) { + decomisoArmaObj.getModifiedData().put("isSelect", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if(fechaCorte!=null){ + Calendar fechaActualCldr = Calendar.getInstance(); + Calendar fechaCorteCldr = Calendar.getInstance(); + fechaCorteCldr.setTime(fechaCorte); + if(fechaActualCldr.compareTo(fechaCorteCldr)>=0){ + + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.fdecomiso"); + + Calendar fechaReferenciaReporteCldr = Calendar.getInstance(); + + fechaReferenciaReporteCldr.setTime(fechaCorte); + + fechaReferenciaReporteCldr.add(Calendar.DAY_OF_MONTH, -diasParaDestruirArma); + StringBuilder fechaReferenciaSB = new StringBuilder(); + fechaReferenciaSB = fechaReferenciaSB.append((fechaReferenciaReporteCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaReferenciaReporteCldr.get(Calendar.DAY_OF_MONTH)) : (fechaReferenciaReporteCldr.get(Calendar.DAY_OF_MONTH))); + fechaReferenciaSB = fechaReferenciaSB.append("-").append((fechaReferenciaReporteCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaReferenciaReporteCldr.get(Calendar.MONTH) + 1) : (fechaReferenciaReporteCldr.get(Calendar.MONTH)+1)); + fechaReferenciaSB = fechaReferenciaSB.append("-").append(fechaReferenciaReporteCldr.get(Calendar.YEAR)); + + Filter fechaFiltro= new Filter(); + fechaFiltro.setSql("(t.estado='DEC' or t.estado='INC' or t.estado='ABA' or t.estado='ENTR') and t.adestruirse is null and t.adestruirsecode is null and t.fdecomiso < " + "TO_DATE('" + fechaReferenciaSB.toString() + "','dd-mm-yyyy') and not exists(select 1 from TarmArmas ta where ta.estado = 'SUSP' and t.carma = (select max(tax.pk) from TarmArmas tax where ta.pk = tax.pk))"); + dto.addFiltro(fechaFiltro); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + for(TarmDecomisoArma decomisoArma:lrecord){ + if(decomisoArma.getCdecomiso()!=null){ + decomisoArma.getModifiedData().put("isSelect",Boolean.FALSE); + TarmArmas arma = ArmasController.findByPK(decomisoArma.getCarma()); + TarmTipoArmaExplosivo tipoArmaExplosivo = TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo()); + decomisoArma.getModifiedData().put("ntipo", arma.getModifiedData().get("tipo")); + decomisoArma.getModifiedData().put("nclase", arma.getModifiedData().get("clase")); + if(tipoArmaExplosivo.getLongitud()!=null){ + decomisoArma.getModifiedData().put("nlongitud", CatalogDetailController.findxCodigoCodcatalogo(tipoArmaExplosivo.getLongitud(), tipoArmaExplosivo.getLongitudcodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tipoArmaExplosivo.getLongitud(), tipoArmaExplosivo.getLongitudcodigo()).getDescription():""); + } + else{ + decomisoArma.getModifiedData().put("nlongitud", ""); + } + if(tipoArmaExplosivo.getCalibre()!=null){ + decomisoArma.getModifiedData().put("ncalibre", CatalogDetailController.findxCodigoCodcatalogo(tipoArmaExplosivo.getCalibre(), tipoArmaExplosivo.getCalibrecodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo(tipoArmaExplosivo.getCalibre(), tipoArmaExplosivo.getCalibrecodigo()).getDescription():""); + } + else{ + decomisoArma.getModifiedData().put("ncalibre", ""); + } + + decomisoArma.getModifiedData().put("nmarca", CatalogDetailController.findxCodigoCodcatalogo( arma.getMarca(), arma.getMarcacodigo())!=null?CatalogDetailController.findxCodigoCodcatalogo( arma.getMarca(), arma.getMarcacodigo()).getDescription():""); + decomisoArma.getModifiedData().put("nserie", arma.getLote()); + decomisoArma.getModifiedData().put("nunidad", CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getUnidadmedida(), decomisoArma.getUnidadmedidacode())!=null?CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getUnidadmedida(), decomisoArma.getUnidadmedidacode()).getDescription():""); + + TarmRegistroArmas registroArma = RegistroArmController.findByCodigo(arma.getCregistro().toString()); + if(registroArma!=null && registroArma.getPersoncode()!=null){ + Integer personCodePropietario = registroArma.getPersoncode(); + decomisoArma.getModifiedData().put("npropietario", PersonDetailController.find(personCodePropietario.toString()).getName()); + } + else{ + decomisoArma.getModifiedData().put("npropietario", ""); + } + TarmDecomiso decomiso = DecomisoController.findByCodigo(decomisoArma.getCdecomiso().toString()); + if(decomiso!=null && decomiso.getNumerodocumento()!=null){ + decomisoArma.getModifiedData().put("nrecibo", decomiso.getNumerorecibo()); + } + else{ + decomisoArma.getModifiedData().put("nrecibo", ""); + } + } + else{ + lrecord.remove(decomisoArma); + } + } + super.postQuery(lrecord); + } + } + else{ + lrecord = new ArrayList(); + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_fechaCorteMayorAFechaActual")); + } + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para reconsultar en base a una nueva fecha de corte seleccionada + */ + public void cambioFechaDeCorte(SelectEvent event){ + querydatabase(); + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + cabRepDestruirArmasController.postCommit(response); + detRepDestruirArmasController.postCommit(response); + } + + + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport() { + if(fechaCorte!=null){ + if(existeArmasSeleccionadas()){ + Calendar fechaActualCldr = Calendar.getInstance(); + Calendar fechaCorteCldr = Calendar.getInstance(); + fechaCorteCldr.setTime(fechaCorte); + if(fechaActualCldr.compareTo(fechaCorteCldr)>=0){ + String path = "armas/reports/bajaDestruccion"; + String filename="ArmasADestruirse"; + + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + // Datos del supervisor militar + String CISupervisorMilitar = ParametersController.find("IDSUPERMILITDPTOARMSPICH", "1").getTextvalue(); + TcustPersonDetail supervisorMilitarObj = PersonDetailController.findxidentification(CISupervisorMilitar, "CED"); + String gradoSupMilitar = supervisorMilitarObj.getMilitarygrade()==null?"": supervisorMilitarObj.getMilitarygrade() + " - "; + parameters.put("nombreSupMilitar", gradoSupMilitar + supervisorMilitarObj.getName()==null?"":supervisorMilitarObj.getName()); + parameters.put("personCodeSupMilitar", supervisorMilitarObj.getPk().getPersoncode()==null?"1001":supervisorMilitarObj.getPk().getPersoncode()); + // Datos del coordinador militar + String CICoordinadorMilitar = ParametersController.find("IDCOORDMILITDPTOARMSPICH", "1").getTextvalue(); + TcustPersonDetail coordinadorMilitarObj = PersonDetailController.findxidentification(CICoordinadorMilitar, "CED"); + String gradoCoordMilitar = coordinadorMilitarObj.getMilitarygrade()==null?"":coordinadorMilitarObj.getMilitarygrade() + " - "; + parameters.put("nombreCoordMilitar", gradoCoordMilitar + coordinadorMilitarObj.getName()==null?"":coordinadorMilitarObj.getName()); + parameters.put("personCodeCoordMilitar", coordinadorMilitarObj.getPk().getPersoncode()==null?"1001":coordinadorMilitarObj.getPk().getPersoncode()); + + try { + + //Usuario logueado en la aplicacion + String nombreUsuario; + if(userDetail.getPk().getPersoncode()!=null){ + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } + else{ + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario); + + //Fecha de corte + StringBuilder fechaCorteSB= new StringBuilder(); + fechaCorteSB = fechaCorteSB.append((fechaCorteCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCorteCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCorteCldr.get(Calendar.DAY_OF_MONTH))); + fechaCorteSB = fechaCorteSB.append("-").append((fechaCorteCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaCorteCldr.get(Calendar.MONTH) + 1) : (fechaCorteCldr.get(Calendar.MONTH)+1)); + fechaCorteSB = fechaCorteSB.append("-").append(fechaCorteCldr.get(Calendar.YEAR)); + parameters.put("fechaCorte", fechaCorteSB.toString()); + parameters.put("codArmasDecomisadasLst", actualizarArmasSeleccionadas()); + //Fecha actual + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH)+1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarFecha", fechaActualSB.toString()); + + //Fecha de referencia + Calendar fechaReferenciaReporteCldr = Calendar.getInstance(); + fechaReferenciaReporteCldr.setTime(fechaCorte); + fechaReferenciaReporteCldr.add(Calendar.DAY_OF_MONTH, -diasParaDestruirArma); + StringBuilder fechaReferenciaSB = new StringBuilder(); + fechaReferenciaSB = fechaReferenciaSB.append((fechaReferenciaReporteCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaReferenciaReporteCldr.get(Calendar.DAY_OF_MONTH)) : (fechaReferenciaReporteCldr.get(Calendar.DAY_OF_MONTH))); + fechaReferenciaSB = fechaReferenciaSB.append("-").append((fechaReferenciaReporteCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaReferenciaReporteCldr.get(Calendar.MONTH) + 1) : (fechaReferenciaReporteCldr.get(Calendar.MONTH)+1)); + fechaReferenciaSB = fechaReferenciaSB.append("-").append(fechaReferenciaReporteCldr.get(Calendar.YEAR)); + parameters.put("fechaReferenciaReporte", fechaReferenciaSB.toString()); + + // Verifico si el reporte fue enviado en el flujo y debe subirse al Alfresco +// if(isDenied){ + InputStream file =this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + alfrescoController.uploadFile(file, nombreReporte, this.xPathLocation); + seGeneroReporte = Boolean.TRUE; +// }else{ +// this.reportController.execute(path, parameters, format, filename, this.getLoginController()); +// } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_fechaCorteMayorAFechaActual")); + } + }else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccioneAlmenosUnArma")); + } + } + } + + + /** + * Retorna la ruta de documento base en donde se almacenará el reporte + * + * @return + */ + public String getRutaDocumentoRepBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta = new StringBuilder("cm:Decomiso"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + return ruta.toString(); + } + + + public String getxPath() { + return xPath; + } + + public void setxPath(String xPath) { + this.xPath = xPath; + } + + /** + * Método para el inicio de flujo. Guardar el reporte creado para su posterior aprobacion en otras instancias del flujo + */ + @Override + public void save(){ + try { + if(lrecord!=null && lrecord.size()>0){ + if(validaSiExisteArmasSeleccionadas()){ + TarmCabRepDestruirArmas cabeceraReporteObj = new TarmCabRepDestruirArmas(); + cabeceraReporteObj.setFreporte((java.sql.Date)fechaCorte); + xPathLocation= getRutaDocumentoRepBase() + "/cm:BAJA"; + cabeceraReporteObj.setXpath(xPathLocation); + cabeceraReporteObj.setIsnew(Boolean.TRUE); + //Guarda la ruta donde se almacenara el reporte + cabRepDestruirArmasController.update(cabeceraReporteObj); + Boolean existArmasEnReporte = Boolean.FALSE; + for(TarmDecomisoArma decomisoArmaObj:lrecord){ + if(decomisoArmaObj.getAdestruirse()==null){ + if(decomisoArmaObj.getModifiedData().get("isSelect")==null || decomisoArmaObj.getModifiedData().get("isSelect").equals(Boolean.FALSE)){ + continue; + } + TarmDetRepDestruirArmas detalleReporteObj = new TarmDetRepDestruirArmas(); + detalleReporteObj.setIsnew(Boolean.TRUE); + if(decomisoArmaObj.getCdecomiso()!=null){ + detalleReporteObj.setCdecomisoarma(decomisoArmaObj.getPk()); + } + if(decomisoArmaObj.getModifiedData().get("nclase")!=null){ + detalleReporteObj.setClase(decomisoArmaObj.getModifiedData().get("nclase").toString()); + } + if(decomisoArmaObj.getModifiedData().get("ntipo")!=null){ + detalleReporteObj.setTipo(decomisoArmaObj.getModifiedData().get("ntipo").toString()); + } + if(decomisoArmaObj.getModifiedData().get("ncalibre")!=null){ + detalleReporteObj.setCalibre(decomisoArmaObj.getModifiedData().get("ncalibre").toString()); + } + if(decomisoArmaObj.getModifiedData().get("nmarca")!=null){ + detalleReporteObj.setMarca(decomisoArmaObj.getModifiedData().get("nmarca").toString()); + } + if(decomisoArmaObj.getModifiedData().get("nserie")!=null){ + detalleReporteObj.setSerie(decomisoArmaObj.getModifiedData().get("nserie").toString()); + } + if(decomisoArmaObj.getCantidad()!=null){ + detalleReporteObj.setCantidad(decomisoArmaObj.getCantidad().toString()); + } + if(decomisoArmaObj.getModifiedData().get("nunidad")!=null){ + detalleReporteObj.setUnidad(decomisoArmaObj.getModifiedData().get("nunidad").toString()); + } + if(decomisoArmaObj.getFdecomiso()!=null){ + java.sql.Date date =new java.sql.Date(decomisoArmaObj.getFdecomiso().getTime()); + detalleReporteObj.setFdecomiso(date); + } + if(decomisoArmaObj.getModifiedData().get("npropietario")!=null){ + detalleReporteObj.setPropietario(decomisoArmaObj.getModifiedData().get("npropietario").toString()); + } + if(decomisoArmaObj.getModifiedData().get("nrecibo")!=null){ + detalleReporteObj.setNrecibo(decomisoArmaObj.getModifiedData().get("nrecibo").toString()); + } + if(!existArmasEnReporte){ + existArmasEnReporte = Boolean.TRUE; + } + + // Marca que indica que el arma decomisada ya se encuentra dentro de un reporte de armas a destruir + decomisoArmaObj.setAdestruirse(aDestruirseCatalog.getPk().getCatalog()); + decomisoArmaObj.setAdestruirsecode(aDestruirseCatalog.getPk().getCatalogcode()); + record = decomisoArmaObj; + super.update(); + detRepDestruirArmasController.update(detalleReporteObj); + + } + } + + if(existArmasEnReporte){ + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + dtosave.setPosition(1); + + DtoSave dtoSaveCabecera = cabRepDestruirArmasController.getDtoSave(); + dtoSaveCabecera.setIsForm(Boolean.TRUE); + dtoSaveCabecera.setReturnpk(Boolean.TRUE); + dtoSaveCabecera.setPosition(2); + + DtoSave dtoSaveDetalle = detRepDestruirArmasController.getDtoSave(); + dtoSaveDetalle.setReturnpk(Boolean.TRUE); + dtoSaveDetalle.setPosition(3); + + HashMap msave = new HashMap(); + + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + msave.put(cabRepDestruirArmasController.getBeanalias(),dtoSaveCabecera); + msave.put(detRepDestruirArmasController.getBeanalias(),dtoSaveDetalle); + + request.setSaveTables(msave); + + Response resp = this.callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.cabRepDestruirArmasController.postCommit(resp); + this.detRepDestruirArmasController.postCommit(resp); + isEnableGrabar = Boolean.FALSE; + isEnableEnviar = Boolean.TRUE; + MessageHelper.setMessageInfo(resp); + this.nombreReporte = resp.get("nombreReporte").toString(); + this.creporte = resp.get("creporte").toString(); + this.xPath = resp.get("xpath").toString(); + } else { + MessageHelper.setMessageError(resp); + } + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccioneAlmenosUnArma")); + } + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccioneAlmenosUnArma")); + } + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo usado para validar si existen armas seleccionadas por el usuario + */ + public Boolean validaSiExisteArmasSeleccionadas() { + Boolean bandera = Boolean.FALSE; + if(lrecord!=null && lrecord.size()>0){ + for(TarmDecomisoArma decomisoArmaObj:lrecord){ + if(decomisoArmaObj.getModifiedData().get("isSelect")!=null && decomisoArmaObj.getModifiedData().get("isSelect").equals(Boolean.TRUE)){ + bandera = Boolean.TRUE; + } + } + } + return bandera; + } + + /** + * Metodo que inicia el flujo de baja y destruccion de armas + */ + public void iniciarFlujo() { + try { + if(seGeneroReporte){ + Request request = this.callerhelper.getRequest(); + super.cleanRequest(request); + request.modifiedData().put("isnew", "Y"); + request.modifiedData().put("xpath", this.xPath); + request.modifiedData().put("creporte", this.creporte); + request.modifiedData().put("cprovincia", cprovincia); + request.setLogsolicitude(this.creporte); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + isEnableEnviar = Boolean.FALSE; +// RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generarReporteRequerido")); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public Date getFechaCorte() { + return fechaCorte; + } + + public void setFechaCorte(Date fechaCorte) { + this.fechaCorte = fechaCorte; + } + + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public Integer getDiasParaDestruirArma() { + return diasParaDestruirArma; + } + + public void setDiasParaDestruirArma(Integer diasParaDestruirArma) { + this.diasParaDestruirArma = diasParaDestruirArma; + } + + public CabRepDestruirArmasController getCabRepDestruirArmasController() { + return cabRepDestruirArmasController; + } + + public void setCabRepDestruirArmasController( + CabRepDestruirArmasController cabRepDestruirArmasController) { + this.cabRepDestruirArmasController = cabRepDestruirArmasController; + } + + public DetRepDestruirArmasController getDetRepDestruirArmasController() { + return detRepDestruirArmasController; + } + + public void setDetRepDestruirArmasController( + DetRepDestruirArmasController detRepDestruirArmasController) { + this.detRepDestruirArmasController = detRepDestruirArmasController; + } + + public TgeneCatalogDetail getaDestruirseCatalog() { + return aDestruirseCatalog; + } + + public void setaDestruirseCatalog(TgeneCatalogDetail aDestruirseCatalog) { + this.aDestruirseCatalog = aDestruirseCatalog; + } + + public String getxPathLocation() { + return xPathLocation; + } + + public void setxPathLocation(String xPathLocation) { + this.xPathLocation = xPathLocation; + } + + public String getNombreReporte() { + return nombreReporte; + } + + public void setNombreReporte(String nombreReporte) { + this.nombreReporte = nombreReporte; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public String getCreporte() { + return creporte; + } + + public void setCreporte(String creporte) { + this.creporte = creporte; + } + + public Boolean getSeGeneroReporte() { + return seGeneroReporte; + } + + public void setSeGeneroReporte(Boolean seGeneroReporte) { + this.seGeneroReporte = seGeneroReporte; + } + + public Boolean getIsEnableGrabar() { + return isEnableGrabar; + } + + public void setIsEnableGrabar(Boolean isEnableGrabar) { + this.isEnableGrabar = isEnableGrabar; + } + + public Boolean getIsEnableEnviar() { + return isEnableEnviar; + } + + public void setIsEnableEnviar(Boolean isEnableEnviar) { + this.isEnableEnviar = isEnableEnviar; + } + + /** + * Metodo encargado de marcar un registro de la tabla como seleccionado + */ + public void seleccionarArma(AjaxBehaviorEvent event){ + try { + SelectBooleanCheckbox booleanCheckbox = (SelectBooleanCheckbox) event.getComponent(); + record = (TarmDecomisoArma) booleanCheckbox.getAttributes().get("armaDecomisadaObj"); + boolean checked = (Boolean) booleanCheckbox.getValue(); + if (checked) { + record.getModifiedData().put("isSelect",Boolean.TRUE); + }else{ + record.getModifiedData().put("isSelect",Boolean.FALSE); + this.getMfilelds().put("seleccionarTodos", Boolean.FALSE); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Metodo encargado de obtener todas las claves primarias de los elementos seleccionados en la tabla + */ + public Collection actualizarArmasSeleccionadas (){ + ListarmasSeleccionadasLst = new ArrayList<>(); + for(TarmDecomisoArma decomisoArmaObj:lrecord){ + if(decomisoArmaObj.getModifiedData().get("isSelect").equals(Boolean.TRUE)){ + armasSeleccionadasLst.add(decomisoArmaObj.getPk()); + } + } + return armasSeleccionadasLst; + } + + /** + * Metodo encargado de verificar si existe al menos un registro seleccionado en la tabla + */ + public Boolean existeArmasSeleccionadas(){ + Boolean flag = Boolean.FALSE; + for(TarmDecomisoArma decomisoArmaObj:lrecord){ + if(decomisoArmaObj.getModifiedData().get("isSelect").equals(Boolean.TRUE)){ + flag = Boolean.TRUE; + break; + } + } + return flag; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteEstadisticasTramitesController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteEstadisticasTramitesController.java.svn-base new file mode 100644 index 0000000..9a25e83 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteEstadisticasTramitesController.java.svn-base @@ -0,0 +1,306 @@ +package com.fp.frontend.controller.armas.solicitud; + + +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de reporte de liquidacion economica + * + * @author Christian Pazmino. + * @version 2.1 + */ + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReporteEstadisticasTramitesController extends AbstractController { + + /** + * Fecha a partir de la cual se sacan datos para el reporte + * */ + private Date fechaInicio; + /** + * Fecha a partir de la cual se sacan datos para el reporte + * */ + private Date fechaFin; + /** + * Formato de reporte que se va a generar + * */ + private String format = "pdf"; + /** + * Usuario actual logueado en el sistema + * */ + private TsafeUserDetail userDetail; + /** + * Nombre del reporte generado en el Alfresco + * */ + private String nombreReporte; + + /** + * Id del centro de control seleccionado por el usuario + * */ + private String idCentroControl; + + + + /** + * Id del tipo de tramite + */ + private String idAutorizacion; + + /** + * Lista de centros de control de armas + */ + private List centroControlList; + + + private List autorizacionList; + + private String institucionCentroControl=""; + private TarmCentroControl centroControl = new TarmCentroControl(); + + + + /** + * Clase controladora de reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{logincontroller}") + private LoginController logincontroller; + + + public ReporteEstadisticasTramitesController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + recperpage = 10000; // Cambiar al # reg a mirar. + beanalias = "RPRTEESTADISTICASTRAMITE"; + centroControlList = CentroControlArmasController.findAll(); + autorizacionList = CatalogDetailController.find("TIPOAUTORIZACION"); + obtenerCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + + } + + + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport() { + Calendar fechaActualCldr = Calendar.getInstance(); + String path = "armas/reports/estadisticastramites"; + String filename="estadisticastramites"; + String nombreUsuario=""; + + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + + if(userDetail.getPk().getPersoncode()!=null){ + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } + else{ + nombreUsuario = ""; + } + + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("unidadmilitar", institucionCentroControl); + parameters.put("lugarFecha", Utilidades.armarFormatoFechaConHora(fechaActualCldr)); + parameters.put("usuario", nombreUsuario); + parameters.put("idCentroControl", "TODOS".equalsIgnoreCase(idCentroControl)?null:idCentroControl); + parameters.put("idAutorizacion", "TODOS".equalsIgnoreCase(idAutorizacion)?null:idAutorizacion); + parameters.put("fechaInicio", this.fechaInicio==null?null:Utilidades.armarFormatoFechaSinHora(this.fechaInicio)); + parameters.put("fechaFin", this.fechaFin==null?null:Utilidades.armarFormatoFechaSinHora(this.fechaFin)); + + try{ + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + + } + + private void obtenerCentroControl() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + + /** + * Método para el inicio de flujo. Guardar el reporte creado para su posterior aprobacion en otras instancias del flujo + */ + @Override + public void save(){ + + } + + public Date getFechaInicio() { + return fechaInicio; + } + + public void setFechaInicio(Date fechaInicio) { + this.fechaInicio = fechaInicio; + } + + public Date getFechaFin() { + return fechaFin; + } + + public void setFechaFin(Date fechaFin) { + this.fechaFin = fechaFin; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public String getNombreReporte() { + return nombreReporte; + } + + public void setNombreReporte(String nombreReporte) { + this.nombreReporte = nombreReporte; + } + + public String getIdCentroControl() { + return idCentroControl; + } + + public void setIdCentroControl(String idCentroControl) { + this.idCentroControl = idCentroControl; + } + + public String getIdAutorizacion() { + return idAutorizacion; + } + + public void setIdAutorizacion(String idAutorizacion) { + this.idAutorizacion = idAutorizacion; + } + + public List getCentroControlList() { + return centroControlList; + } + + public void setCentroControlList(List centroControlList) { + this.centroControlList = centroControlList; + } + + public List getAutorizacionList() { + return autorizacionList; + } + + public void setAutorizacionList(List autorizacionList) { + this.autorizacionList = autorizacionList; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public LoginController getLogincontroller() { + return logincontroller; + } + + public void setLogincontroller(LoginController logincontroller) { + this.logincontroller = logincontroller; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteIngresoVentaArmExpController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteIngresoVentaArmExpController.java.svn-base new file mode 100644 index 0000000..314ce52 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteIngresoVentaArmExpController.java.svn-base @@ -0,0 +1,422 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.PersonPhoneController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de reporte de liquidacion economica + * + * @author Christian Pazmino. + * @version 2.1 + */ + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReporteIngresoVentaArmExpController extends AbstractController { + + /** + * Fecha a partir de la cual se sacan datos para el reporte + * */ + private Date fechaInicio; + /** + * Fecha a partir de la cual se sacan datos para el reporte + * */ + private Date fechaFin; + /** + * Formato de reporte que se va a generar + * */ + private String format = "pdf"; + /** + * Usuario actual logueado en el sistema + * */ + private TsafeUserDetail userDetail; + /** + * Nombre del reporte generado en el Alfresco + * */ + private String nombreReporte; + /** + * Id del centro de control seleccionado por el usuario + * */ + private String numeroDocumento; + + + /** + * Tipo de documento seleccionado cedula/ruc + */ + private String tipoDocumento; + /** + * Lista de centros de control de armas + */ + private List centroControlList; + /** + * Codigo del catalogo de PHONETYPE telefono fijo + */ + private String codigoTelefonoFijo; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de identificación + */ + private List ltipoidenti; + + /** + * Clase controladora de reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + + public ReporteIngresoVentaArmExpController() throws Exception { + super(TarmDecomisoArma.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + recperpage = 10000; // Cambiar al # reg a mirar. + lrecord = new ArrayList(); + codigoTelefonoFijo=codigos("CODIGO.PHONE.FIJO"); + beanalias = "RPRTELIQUIDACIONECONOMICA"; + centroControlList = CentroControlArmasController.findAll(); + //TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + ltipoidenti = CatalogDetailController.find("IDENTIFICATION"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para obtener los codigos + */ + public String codigos(String parametro){ + TgeneParameters tgeneParameters= ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + + } + + /** + * Metodo para reconsultar en base a una nueva fecha de corte seleccionada + */ + public void cambioFechaDeCorte(SelectEvent event){ + querydatabase(); + } + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport2() { + + if(this.fechaInicio.getTime() > this.fechaFin.getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaFin")); + return; + } + if(this.fechaInicio.getTime() > new Date().getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaActual")); + return; + } + if(this.fechaFin.getTime() > new Date().getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaFinMayorAFechaActual")); + return; + } + try { + String path = "armas/reports/ingresoVentaArmasExplosivos"; + String filename="ingresoVentaArmasExplosivos"; + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //usuario + TsafeUserDetail tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personLoged = PersonDetailController.find(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + TcustPersonDetail personConsulted = PersonDetailController.findByIdentification(this.numeroDocumento); + parameters.put("usuario", personLoged.getName()); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fechaInicio", sdf.format(this.fechaInicio)); + parameters.put("fechaFin", sdf.format(this.fechaFin)); + parameters.put("fechaReporte", sdf.format(new Date())); + + if(personConsulted != null){ + parameters.put("nombreRazonSocial", personConsulted.getName()); + parameters.put("tipoDocumento", personConsulted.getIdentificationcatalog()); + parameters.put("numeroDocumento", personConsulted.getIdentification()); + parameters.put("representanteLegal", personConsulted.getLegalrepresent()); + parameters.put("representanteLegalIdent", personConsulted.getLegalrepresentidentification()); + parameters.put("personcode", personConsulted.getPk().getPersoncode().toString()); + PersonAddressController address = new PersonAddressController(); + TcustPersonAddress personAddress = address.findPrincipal(personConsulted.getPk().getPersoncode().toString()); + if(personAddress != null){ + parameters.put("direccion", personAddress.getAddress()); + }else { + parameters.put("direccion", ""); + } + } + + TcustPersonPhone personPhone = PersonPhoneController.find(personConsulted.getPk().getPersoncode().toString(), "2"); + if(personPhone != null && personPhone.getPhonenumber() != null){ + parameters.put("telefono",personPhone.getPhonenumber()); + }else { + parameters.put("telefono",""); + } + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception e) { + // TODO: handle exception + } + + + } + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport() { + Calendar fechaActualCldr = Calendar.getInstance(); + Calendar fechaInicioCldr = Calendar.getInstance(); + Calendar fechaFinCldr = Calendar.getInstance(); + fechaInicioCldr.setTime(fechaInicio); + fechaFinCldr.setTime(fechaFin); + if(fechaActualCldr.compareTo(fechaInicioCldr)>=0){ + if(fechaActualCldr.compareTo(fechaFinCldr)>=0){ + if(fechaFinCldr.compareTo(fechaInicioCldr)>=0){ + String filename="ingresoVentaArmasExplosivos"; + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + if(userDetail.getPk().getPersoncode()!=null){ + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } + else{ + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario); + parameters.put("fechaInicio", armarFormatoFechaSinHora(fechaInicioCldr)); + parameters.put("fechaFin", armarFormatoFechaSinHora(fechaFinCldr)); + parameters.put("fechaReporte", armarFormatoFechaConHora(fechaActualCldr)); + + String path; + + path = "armas/reports/ingresoVentaArmasExplosivos"; + parameters.put("numeroDocumento", numeroDocumento); + // Persona objetivo de la consulta de movimientos + TcustPersonDetail personDetailConsultadaObj = PersonDetailController.findxidentification(numeroDocumento,tipoDocumento); + if(personDetailConsultadaObj != null){ + parameters.put("nombreRazonSocial", personDetailConsultadaObj.getName()); + parameters.put("tipoDocumento", tipoDocumento); + parameters.put("numeroDocumento", personDetailConsultadaObj.getIdentification()); + parameters.put("representanteLegal", personDetailConsultadaObj.getLegalrepresent()); + parameters.put("representanteLegalIdent", personDetailConsultadaObj.getLegalrepresentidentification()); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddresObj=personAddressController.findPrincipal (personDetailConsultadaObj.getPk().getPersoncode().toString()); + if(tcustPersonAddresObj!=null){ + parameters.put("direccion", tcustPersonAddresObj.getAddress()); + } + else{ + parameters.put("direccion", ""); + } + TcustPersonPhone personPhoneObj= PersonPhoneController.find(personDetailConsultadaObj.getPk().getPersoncode().toString(), codigoTelefonoFijo); + if(personPhoneObj!=null){ + parameters.put("telefono",personPhoneObj.getPhonenumber()); + } + else{ + parameters.put("telefono",""); + } + } + + // Datos del CENTRO DE CONTROL +// TarmCentroControl centroControlObj = CentroControlArmasController.findPorCodigo(idCentroControl); +// String nombreCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControlObj.getNombreinstitucion(),centroControlObj.getNombreinstitucioncodigo()).getDescription(); +// parameters.put("nombreCentroControl", nombreCentroControl); +// // Datos del jefe del centro +// if(centroControlObj.getPersoncode()!=null){ +// TcustPersonDetail supervisorMilitarObj = PersonDetailController.find(centroControlObj.getPersoncode().toString()); +// String gradoSupMilitar = supervisorMilitarObj.getMilitarygrade()==null?"": supervisorMilitarObj.getMilitarygrade() + " - "; +// parameters.put("nombreJefCentro", gradoSupMilitar + supervisorMilitarObj.getName()==null?"":supervisorMilitarObj.getName()); +// parameters.put("personCodeJefCentro", supervisorMilitarObj.getPk().getPersoncode()==null?"1001":supervisorMilitarObj.getPk().getPersoncode()); +// +// } + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaFin")); + } + }else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaFinMayorAFechaActual")); + } + }else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaActual")); + } + + } + +// parameters.put("fechaCorte", fechaCorteSB.toString()); +// parameters.put("codArmasDecomisadasLst", actualizarArmasSeleccionadas()); + + public StringBuilder armarFormatoFechaSinHora(Calendar fechaCldr){ + StringBuilder fechaStr= new StringBuilder(); + fechaStr = fechaStr.append((fechaCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCldr.get(Calendar.DAY_OF_MONTH))); + fechaStr = fechaStr.append("-").append((fechaCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaCldr.get(Calendar.MONTH) + 1) : (fechaCldr.get(Calendar.MONTH)+1)); + fechaStr = fechaStr.append("-").append(fechaCldr.get(Calendar.YEAR)); + return fechaStr; + } + + public StringBuilder armarFormatoFechaConHora(Calendar fechaCldr){ + StringBuilder fechaStr= new StringBuilder(); + fechaStr = fechaStr.append((fechaCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCldr.get(Calendar.DAY_OF_MONTH))); + fechaStr = fechaStr.append("-").append((fechaCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaCldr.get(Calendar.MONTH) + 1) : (fechaCldr.get(Calendar.MONTH)+1)); + fechaStr = fechaStr.append("-").append(fechaCldr.get(Calendar.YEAR)); + fechaStr = fechaStr.append(" ").append(fechaCldr.get(Calendar.HOUR_OF_DAY)); + fechaStr = fechaStr.append(":").append((fechaCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaCldr.get(Calendar.MINUTE)) : (fechaCldr.get(Calendar.MINUTE))); + return fechaStr; + } + + /** + * Método para el inicio de flujo. Guardar el reporte creado para su posterior aprobacion en otras instancias del flujo + */ + @Override + public void save(){ + + } + + public Date getFechaInicio() { + return fechaInicio; + } + + public void setFechaInicio(Date fechaInicio) { + this.fechaInicio = fechaInicio; + } + + public Date getFechaFin() { + return fechaFin; + } + + public void setFechaFin(Date fechaFin) { + this.fechaFin = fechaFin; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public String getNombreReporte() { + return nombreReporte; + } + + public void setNombreReporte(String nombreReporte) { + this.nombreReporte = nombreReporte; + } + + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public String getTipoDocumento() { + return tipoDocumento; + } + + public void setTipoDocumento(String tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } + + public List getLtipoidenti() { + return ltipoidenti; + } + + public void setLtipoidenti(List ltipoidenti) { + this.ltipoidenti = ltipoidenti; + } + + public List getCentroControlList() { + return centroControlList; + } + + public void setCentroControlList(List centroControlList) { + this.centroControlList = centroControlList; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteIngresoVentaArmExpUserController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteIngresoVentaArmExpUserController.java.svn-base new file mode 100644 index 0000000..dc31cdb --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteIngresoVentaArmExpUserController.java.svn-base @@ -0,0 +1,436 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.PersonPhoneController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de reporte de liquidacion economica + * + * @author Christian Pazmino. + * @version 2.1 + */ + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReporteIngresoVentaArmExpUserController extends AbstractController { + + /** + * Fecha a partir de la cual se sacan datos para el reporte + * */ + private Date fechaInicio; + /** + * Fecha a partir de la cual se sacan datos para el reporte + * */ + private Date fechaFin; + /** + * Formato de reporte que se va a generar + * */ + private String format = "pdf"; + /** + * Usuario actual logueado en el sistema + * */ + private TsafeUserDetail userDetail; + /** + * Nombre del reporte generado en el Alfresco + * */ + private String nombreReporte; + /** + * Id del centro de control seleccionado por el usuario + * */ + private String numeroDocumento; + + + /** + * Tipo de documento seleccionado cedula/ruc + */ + private String tipoDocumento; + /** + * Lista de centros de control de armas + */ + private List centroControlList; + /** + * Codigo del catalogo de PHONETYPE telefono fijo + */ + private String codigoTelefonoFijo; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de identificación + */ + private List ltipoidenti; + + /** + * Clase controladora de reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + private String razonSocial; + + public ReporteIngresoVentaArmExpUserController() throws Exception { + super(TarmDecomisoArma.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + recperpage = 10000; // Cambiar al # reg a mirar. + lrecord = new ArrayList(); + codigoTelefonoFijo=codigos("CODIGO.PHONE.FIJO"); + beanalias = "RPRTELIQUIDACIONECONOMICA"; + centroControlList = CentroControlArmasController.findAll(); + //TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + ltipoidenti = CatalogDetailController.find("IDENTIFICATION"); + if(userDetail.getPk().getPersoncode()!=null){ + razonSocial = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + numeroDocumento=PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getIdentification(); + } + else{ + razonSocial = ""; + numeroDocumento=""; + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para obtener los codigos + */ + public String codigos(String parametro){ + TgeneParameters tgeneParameters= ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + + } + + /** + * Metodo para reconsultar en base a una nueva fecha de corte seleccionada + */ + public void cambioFechaDeCorte(SelectEvent event){ + querydatabase(); + } + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport2() { + + if(this.fechaInicio.getTime() > this.fechaFin.getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaFin")); + return; + } + if(this.fechaInicio.getTime() > new Date().getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaActual")); + return; + } + if(this.fechaFin.getTime() > new Date().getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaFinMayorAFechaActual")); + return; + } + try { + String path = "armas/reports/ingresoVentaArmasExplosivosUser"; + String filename="ingresoVentaArmasExplosivos"; + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //usuario + TsafeUserDetail tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personLoged = PersonDetailController.find(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + TcustPersonDetail personConsulted = PersonDetailController.findByIdentification(this.numeroDocumento); + parameters.put("usuario", personLoged.getName()); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fechaInicio", sdf.format(this.fechaInicio)); + parameters.put("fechaFin", sdf.format(this.fechaFin)); + parameters.put("fechaReporte", sdf.format(new Date())); + + if(personConsulted != null){ + parameters.put("nombreRazonSocial", personConsulted.getName()); + parameters.put("tipoDocumento", personConsulted.getIdentificationcatalog()); + parameters.put("numeroDocumento", personConsulted.getIdentification()); + parameters.put("representanteLegal", personConsulted.getLegalrepresent()); + parameters.put("representanteLegalIdent", personConsulted.getLegalrepresentidentification()); + parameters.put("personcode", personConsulted.getPk().getPersoncode().toString()); + PersonAddressController address = new PersonAddressController(); + TcustPersonAddress personAddress = address.findPrincipal(personConsulted.getPk().getPersoncode().toString()); + if(personAddress != null){ + parameters.put("direccion", personAddress.getAddress()); + }else { + parameters.put("direccion", ""); + } + } + + TcustPersonPhone personPhone = PersonPhoneController.find(personConsulted.getPk().getPersoncode().toString(), "2"); + if(personPhone != null && personPhone.getPhonenumber() != null){ + parameters.put("telefono",personPhone.getPhonenumber()); + }else { + parameters.put("telefono",""); + } + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception e) { + // TODO: handle exception + } + + + } + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport() { + Calendar fechaActualCldr = Calendar.getInstance(); + Calendar fechaInicioCldr = Calendar.getInstance(); + Calendar fechaFinCldr = Calendar.getInstance(); + fechaInicioCldr.setTime(fechaInicio); + fechaFinCldr.setTime(fechaFin); + if(fechaActualCldr.compareTo(fechaInicioCldr)>=0){ + if(fechaActualCldr.compareTo(fechaFinCldr)>=0){ + if(fechaFinCldr.compareTo(fechaInicioCldr)>=0){ + String filename="ingresoVentaArmasExplosivos"; + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + if(userDetail.getPk().getPersoncode()!=null){ + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } + else{ + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario); + parameters.put("fechaInicio", armarFormatoFechaSinHora(fechaInicioCldr)); + parameters.put("fechaFin", armarFormatoFechaSinHora(fechaFinCldr)); + parameters.put("fechaReporte", armarFormatoFechaConHora(fechaActualCldr)); + + String path; + + path = "armas/reports/ingresoVentaArmasExplosivos"; + parameters.put("numeroDocumento", numeroDocumento); + // Persona objetivo de la consulta de movimientos + TcustPersonDetail personDetailConsultadaObj = PersonDetailController.findxidentification(numeroDocumento,tipoDocumento); + if(personDetailConsultadaObj != null){ + parameters.put("nombreRazonSocial", personDetailConsultadaObj.getName()); + parameters.put("tipoDocumento", tipoDocumento); + parameters.put("numeroDocumento", personDetailConsultadaObj.getIdentification()); + parameters.put("representanteLegal", personDetailConsultadaObj.getLegalrepresent()); + parameters.put("representanteLegalIdent", personDetailConsultadaObj.getLegalrepresentidentification()); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddresObj=personAddressController.findPrincipal (personDetailConsultadaObj.getPk().getPersoncode().toString()); + if(tcustPersonAddresObj!=null){ + parameters.put("direccion", tcustPersonAddresObj.getAddress()); + } + else{ + parameters.put("direccion", ""); + } + TcustPersonPhone personPhoneObj= PersonPhoneController.find(personDetailConsultadaObj.getPk().getPersoncode().toString(), codigoTelefonoFijo); + if(personPhoneObj!=null){ + parameters.put("telefono",personPhoneObj.getPhonenumber()); + } + else{ + parameters.put("telefono",""); + } + } + + // Datos del CENTRO DE CONTROL +// TarmCentroControl centroControlObj = CentroControlArmasController.findPorCodigo(idCentroControl); +// String nombreCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControlObj.getNombreinstitucion(),centroControlObj.getNombreinstitucioncodigo()).getDescription(); +// parameters.put("nombreCentroControl", nombreCentroControl); +// // Datos del jefe del centro +// if(centroControlObj.getPersoncode()!=null){ +// TcustPersonDetail supervisorMilitarObj = PersonDetailController.find(centroControlObj.getPersoncode().toString()); +// String gradoSupMilitar = supervisorMilitarObj.getMilitarygrade()==null?"": supervisorMilitarObj.getMilitarygrade() + " - "; +// parameters.put("nombreJefCentro", gradoSupMilitar + supervisorMilitarObj.getName()==null?"":supervisorMilitarObj.getName()); +// parameters.put("personCodeJefCentro", supervisorMilitarObj.getPk().getPersoncode()==null?"1001":supervisorMilitarObj.getPk().getPersoncode()); +// +// } + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaFin")); + } + }else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaFinMayorAFechaActual")); + } + }else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaActual")); + } + + } + +// parameters.put("fechaCorte", fechaCorteSB.toString()); +// parameters.put("codArmasDecomisadasLst", actualizarArmasSeleccionadas()); + + public StringBuilder armarFormatoFechaSinHora(Calendar fechaCldr){ + StringBuilder fechaStr= new StringBuilder(); + fechaStr = fechaStr.append((fechaCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCldr.get(Calendar.DAY_OF_MONTH))); + fechaStr = fechaStr.append("-").append((fechaCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaCldr.get(Calendar.MONTH) + 1) : (fechaCldr.get(Calendar.MONTH)+1)); + fechaStr = fechaStr.append("-").append(fechaCldr.get(Calendar.YEAR)); + return fechaStr; + } + + public StringBuilder armarFormatoFechaConHora(Calendar fechaCldr){ + StringBuilder fechaStr= new StringBuilder(); + fechaStr = fechaStr.append((fechaCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCldr.get(Calendar.DAY_OF_MONTH))); + fechaStr = fechaStr.append("-").append((fechaCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaCldr.get(Calendar.MONTH) + 1) : (fechaCldr.get(Calendar.MONTH)+1)); + fechaStr = fechaStr.append("-").append(fechaCldr.get(Calendar.YEAR)); + fechaStr = fechaStr.append(" ").append(fechaCldr.get(Calendar.HOUR_OF_DAY)); + fechaStr = fechaStr.append(":").append((fechaCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaCldr.get(Calendar.MINUTE)) : (fechaCldr.get(Calendar.MINUTE))); + return fechaStr; + } + + /** + * Método para el inicio de flujo. Guardar el reporte creado para su posterior aprobacion en otras instancias del flujo + */ + @Override + public void save(){ + + } + + public Date getFechaInicio() { + return fechaInicio; + } + + public void setFechaInicio(Date fechaInicio) { + this.fechaInicio = fechaInicio; + } + + public Date getFechaFin() { + return fechaFin; + } + + public void setFechaFin(Date fechaFin) { + this.fechaFin = fechaFin; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public String getNombreReporte() { + return nombreReporte; + } + + public void setNombreReporte(String nombreReporte) { + this.nombreReporte = nombreReporte; + } + + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public String getTipoDocumento() { + return tipoDocumento; + } + + public void setTipoDocumento(String tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } + + public List getLtipoidenti() { + return ltipoidenti; + } + + public void setLtipoidenti(List ltipoidenti) { + this.ltipoidenti = ltipoidenti; + } + + public List getCentroControlList() { + return centroControlList; + } + + public void setCentroControlList(List centroControlList) { + this.centroControlList = centroControlList; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getRazonSocial() { + return razonSocial; + } + + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteInspeccionesRealizadasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteInspeccionesRealizadasController.java.svn-base new file mode 100644 index 0000000..ea587a4 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteInspeccionesRealizadasController.java.svn-base @@ -0,0 +1,433 @@ +package com.fp.frontend.controller.armas.solicitud; + + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.primefaces.component.selectbooleancheckbox.SelectBooleanCheckbox; +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmCabRepDestruirArmas; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDetRepDestruirArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de reporte de liquidacion economica + * + * @author Christian Pazmino. + * @version 2.1 + */ + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReporteInspeccionesRealizadasController extends AbstractController { + + /** + * Fecha a partir de la cual se sacan datos para el reporte + * */ + private Date fechaInicio; + /** + * Fecha a partir de la cual se sacan datos para el reporte + * */ + private Date fechaFin; + /** + * Formato de reporte que se va a generar + * */ + private String format = "pdf"; + /** + * Usuario actual logueado en el sistema + * */ + private TsafeUserDetail userDetail; + /** + * Nombre del reporte generado en el Alfresco + * */ + private String nombreReporte; + /** + * Id del centro de control seleccionado por el usuario + * */ + private String idCentroControl; + /** + * Lista de centros de control de armas + */ + private List centroControlList; + +// private List lTipoReporte=new ArrayList(); + + private TsafeUserDetail tsafeUserDetailUsuario = null; + + private TarmCentroControl centroControl = new TarmCentroControl(); + + private TcustPersonDetail responsableCentroControl= null; + + /** + * Clase controladora de reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + + public ReporteInspeccionesRealizadasController() throws Exception { + super(TarmDecomisoArma.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + recperpage = 10000; // Cambiar al # reg a mirar. + lrecord = new ArrayList(); + beanalias = "RPRTELIQUIDACIONECONOMICA"; + centroControlList = CentroControlArmasController.findEstado("Y"); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + this.responsableCentroControl = new TcustPersonDetail(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + +// /** +// * Crea una instancia y marca el registro como nuevo. +// * +// * @throws Exception +// */ +// @Override +// public void create() throws Exception { +// super.create(); +// } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if(Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")){ + valorColocar = Boolean.TRUE; + } + for (TarmDecomisoArma decomisoArmaObj : lrecord) { + decomisoArmaObj.getModifiedData().put("isSelect", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + + } + + /** + * Metodo para reconsultar en base a una nueva fecha de corte seleccionada + */ + public void cambioFechaDeCorte(SelectEvent event){ + querydatabase(); + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if(tcustPersonAddres == null){ + return null; + } + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl(){ + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport2() { + String filtro = ""; + + if(this.fechaInicio.getTime() > this.fechaFin.getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaFin")); + return; + } + if(this.fechaInicio.getTime() > new Date().getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaActual")); + return; + } + if(this.fechaFin.getTime() > new Date().getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaFinMayorAFechaActual")); + return; + } + try { + String path = "armas/reports/inspeccionesRealizadas"; + String filename="inspeccionesRealizadas"; + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //usuario + TsafeUserDetail tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail person = PersonDetailController.find(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", person.getName()); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fechaInicio", sdf.format(this.fechaInicio)); + parameters.put("fechaFin", sdf.format(this.fechaFin)); + parameters.put("fechaReporte", sdf.format(new Date())); + + + + if(this.idCentroControl.equals("TODOS")){ + parameters.put("filtro", ""); + }else { + filtro = " and c.ccentrocontrol = '"+this.idCentroControl+"' "; + parameters.put("filtro", filtro); + } + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception e) { + // TODO: handle exception + } + + + } + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport() { + Calendar fechaActualCldr = Calendar.getInstance(); + Calendar fechaInicioCldr = Calendar.getInstance(); + Calendar fechaFinCldr = Calendar.getInstance(); + fechaInicioCldr.setTime(fechaInicio); + fechaFinCldr.setTime(fechaFin); + if(fechaActualCldr.compareTo(fechaInicioCldr)>=0){ + if(fechaActualCldr.compareTo(fechaFinCldr)>=0){ + if(fechaFinCldr.compareTo(fechaInicioCldr)>=0){ + String filename="inspeccionesRealizadas"; + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + if(userDetail.getPk().getPersoncode()!=null){ + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } + else{ + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario); + parameters.put("fechaInicio", armarFormatoFechaSinHora(fechaInicioCldr)); + fechaFinCldr.add(Calendar.DAY_OF_MONTH, 1); + parameters.put("fechaFin", armarFormatoFechaSinHora(fechaFinCldr)); + parameters.put("fechaReporte", armarFormatoFechaConHora(fechaActualCldr)); + + String path; + if(!idCentroControl.equalsIgnoreCase("TODOS")){ + path = "armas/reports/inspeccionesRealizadas"; + parameters.put("idCentroControl", idCentroControl); + // Datos del CENTRO DE CONTROL + TarmCentroControl centroControlObj = CentroControlArmasController.findPorCodigo(idCentroControl); + String nombreCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControlObj.getNombreinstitucion(),centroControlObj.getNombreinstitucioncodigo()).getDescription(); + parameters.put("nombreCentroControl", nombreCentroControl); + // Datos del jefe del centro + if(centroControlObj.getPersoncode()!=null){ + TcustPersonDetail supervisorMilitarObj = PersonDetailController.find(centroControlObj.getPersoncode().toString()); + String gradoSupMilitar = supervisorMilitarObj.getMilitarygrade()==null?"": supervisorMilitarObj.getMilitarygrade() + " - "; + parameters.put("nombreJefCentro", gradoSupMilitar + supervisorMilitarObj.getName()==null?"":supervisorMilitarObj.getName()); + parameters.put("personCodeJefCentro", supervisorMilitarObj.getPk().getPersoncode()==null?"1001":supervisorMilitarObj.getPk().getPersoncode()); + + } + }else{ + path = "armas/reports/inspeccionesRealizadas"; + filename="inspeccionesRealizadasCCA"; + parameters.put("idCentroControl", null); + parameters.put("nombreCentroControl", "TODOS"); + parameters.put("nombreJefCentro", "Juan Todos"); + parameters.put("personCodeJefCentro", 1001); + } + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaFin")); + } + }else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaFinMayorAFechaActual")); + } + }else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaActual")); + } + + } + +// parameters.put("fechaCorte", fechaCorteSB.toString()); +// parameters.put("codArmasDecomisadasLst", actualizarArmasSeleccionadas()); + + public StringBuilder armarFormatoFechaSinHora(Calendar fechaCldr){ + StringBuilder fechaStr= new StringBuilder(); + fechaStr = fechaStr.append((fechaCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCldr.get(Calendar.DAY_OF_MONTH))); + fechaStr = fechaStr.append("-").append((fechaCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaCldr.get(Calendar.MONTH) + 1) : (fechaCldr.get(Calendar.MONTH)+1)); + fechaStr = fechaStr.append("-").append(fechaCldr.get(Calendar.YEAR)); + return fechaStr; + } + + public StringBuilder armarFormatoFechaConHora(Calendar fechaCldr){ + StringBuilder fechaStr= new StringBuilder(); + fechaStr = fechaStr.append((fechaCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCldr.get(Calendar.DAY_OF_MONTH))); + fechaStr = fechaStr.append("-").append((fechaCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaCldr.get(Calendar.MONTH) + 1) : (fechaCldr.get(Calendar.MONTH)+1)); + fechaStr = fechaStr.append("-").append(fechaCldr.get(Calendar.YEAR)); + fechaStr = fechaStr.append(" ").append(fechaCldr.get(Calendar.HOUR_OF_DAY)); + fechaStr = fechaStr.append(":").append((fechaCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaCldr.get(Calendar.MINUTE)) : (fechaCldr.get(Calendar.MINUTE))); + return fechaStr; + } + + /** + * Método para el inicio de flujo. Guardar el reporte creado para su posterior aprobacion en otras instancias del flujo + */ + @Override + public void save(){ + + } + + public Date getFechaInicio() { + return fechaInicio; + } + + public void setFechaInicio(Date fechaInicio) { + this.fechaInicio = fechaInicio; + } + + public Date getFechaFin() { + return fechaFin; + } + + public void setFechaFin(Date fechaFin) { + this.fechaFin = fechaFin; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public String getNombreReporte() { + return nombreReporte; + } + + public void setNombreReporte(String nombreReporte) { + this.nombreReporte = nombreReporte; + } + + public String getIdCentroControl() { + return idCentroControl; + } + + public void setIdCentroControl(String idCentroControl) { + this.idCentroControl = idCentroControl; + } + + public List getCentroControlList() { + return centroControlList; + } + + public void setCentroControlList(List centroControlList) { + this.centroControlList = centroControlList; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteLiquidacionEconomicaController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteLiquidacionEconomicaController.java.svn-base new file mode 100644 index 0000000..78f8ef6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteLiquidacionEconomicaController.java.svn-base @@ -0,0 +1,330 @@ +package com.fp.frontend.controller.armas.solicitud; + + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de reporte de liquidacion economica + * + * @author Christian Pazmino. + * @version 2.1 + */ + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReporteLiquidacionEconomicaController extends AbstractController { + + /** + * Fecha a partir de la cual se sacan datos para el reporte + * */ + private Date fechaInicio; + /** + * Fecha a partir de la cual se sacan datos para el reporte + * */ + private Date fechaFin; + /** + * Formato de reporte que se va a generar + * */ + private String format = "pdf"; + /** + * Usuario actual logueado en el sistema + * */ + private TsafeUserDetail userDetail; + /** + * Nombre del reporte generado en el Alfresco + * */ + private String nombreReporte; + /** + * Id del centro de control seleccionado por el usuario + * */ + private String idCentroControl; + /** + * Lista de centros de control de armas + */ + private List centroControlList; + + private String institucionCentroControl=""; + private TarmCentroControl centroControl = new TarmCentroControl(); + +// private List lTipoReporte=new ArrayList(); + + /** + * Clase controladora de reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + + public ReporteLiquidacionEconomicaController() throws Exception { + super(TarmDecomisoArma.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + recperpage = 10000; // Cambiar al # reg a mirar. + lrecord = new ArrayList(); + beanalias = "RPRTELIQUIDACIONECONOMICA"; + centroControlList = CentroControlArmasController.findAll(); + obtenerCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + +// /** +// * Crea una instancia y marca el registro como nuevo. +// * +// * @throws Exception +// */ +// @Override +// public void create() throws Exception { +// super.create(); +// } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if(Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")){ + valorColocar = Boolean.TRUE; + } + for (TarmDecomisoArma decomisoArmaObj : lrecord) { + decomisoArmaObj.getModifiedData().put("isSelect", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + + } + + /** + * Metodo para reconsultar en base a una nueva fecha de corte seleccionada + */ + public void cambioFechaDeCorte(SelectEvent event){ + querydatabase(); + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport() { + Calendar fechaActualCldr = Calendar.getInstance(); + Calendar fechaInicioCldr = Calendar.getInstance(); + Calendar fechaFinCldr = Calendar.getInstance(); + fechaInicioCldr.setTime(fechaInicio); + fechaFinCldr.setTime(fechaFin); + if(fechaActualCldr.compareTo(fechaInicioCldr)>=0){ + if(fechaActualCldr.compareTo(fechaFinCldr)>=0){ + if(fechaFinCldr.compareTo(fechaInicioCldr)>=0){ + String filename="liquidacionEconomica"; + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + if(userDetail.getPk().getPersoncode()!=null){ + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } + else{ + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario); + parameters.put("fechaInicio", armarFormatoFechaSinHora(fechaInicioCldr)); + parameters.put("fechaFin", armarFormatoFechaSinHora(fechaFinCldr)); + parameters.put("fechaReporte", armarFormatoFechaConHora(fechaActualCldr)); + + String path; + path = "armas/reports/liquidacionEconomica"; + parameters.put("idCentroControl", "TODOS".equalsIgnoreCase(idCentroControl)?null:idCentroControl); + parameters.put("nombreCentroControl", institucionCentroControl); + // Datos del jefe del centro + if(centroControl.getPersoncode()!=null){ + TcustPersonDetail supervisorMilitarObj = PersonDetailController.find(centroControl.getPersoncode().toString()); + String gradoSupMilitar = (supervisorMilitarObj==null || supervisorMilitarObj.getMilitarygrade()==null)?"": supervisorMilitarObj.getMilitarygrade() + " - "; + parameters.put("nombreJefCentro", (supervisorMilitarObj==null || supervisorMilitarObj.getName()==null)?"":gradoSupMilitar + supervisorMilitarObj.getName()); + parameters.put("personCodeJefCentro", (supervisorMilitarObj==null || supervisorMilitarObj.getPk().getPersoncode()==null)?"":supervisorMilitarObj.getPk().getPersoncode()); + + } + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaFin")); + } + }else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaFinMayorAFechaActual")); + } + }else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaActual")); + } + + } + + private void obtenerCentroControl() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + +// parameters.put("fechaCorte", fechaCorteSB.toString()); +// parameters.put("codArmasDecomisadasLst", actualizarArmasSeleccionadas()); + + public StringBuilder armarFormatoFechaSinHora(Calendar fechaCldr){ + StringBuilder fechaStr= new StringBuilder(); + fechaStr = fechaStr.append((fechaCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCldr.get(Calendar.DAY_OF_MONTH))); + fechaStr = fechaStr.append("-").append((fechaCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaCldr.get(Calendar.MONTH) + 1) : (fechaCldr.get(Calendar.MONTH)+1)); + fechaStr = fechaStr.append("-").append(fechaCldr.get(Calendar.YEAR)); + return fechaStr; + } + + public StringBuilder armarFormatoFechaConHora(Calendar fechaCldr){ + StringBuilder fechaStr= new StringBuilder(); + fechaStr = fechaStr.append((fechaCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCldr.get(Calendar.DAY_OF_MONTH))); + fechaStr = fechaStr.append("-").append((fechaCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaCldr.get(Calendar.MONTH) + 1) : (fechaCldr.get(Calendar.MONTH)+1)); + fechaStr = fechaStr.append("-").append(fechaCldr.get(Calendar.YEAR)); + fechaStr = fechaStr.append(" ").append(fechaCldr.get(Calendar.HOUR_OF_DAY)); + fechaStr = fechaStr.append(":").append((fechaCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaCldr.get(Calendar.MINUTE)) : (fechaCldr.get(Calendar.MINUTE))); + return fechaStr; + } + + /** + * Método para el inicio de flujo. Guardar el reporte creado para su posterior aprobacion en otras instancias del flujo + */ + @Override + public void save(){ + + } + + public Date getFechaInicio() { + return fechaInicio; + } + + public void setFechaInicio(Date fechaInicio) { + this.fechaInicio = fechaInicio; + } + + public Date getFechaFin() { + return fechaFin; + } + + public void setFechaFin(Date fechaFin) { + this.fechaFin = fechaFin; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public String getNombreReporte() { + return nombreReporte; + } + + public void setNombreReporte(String nombreReporte) { + this.nombreReporte = nombreReporte; + } + + public String getIdCentroControl() { + return idCentroControl; + } + + public void setIdCentroControl(String idCentroControl) { + this.idCentroControl = idCentroControl; + } + + public List getCentroControlList() { + return centroControlList; + } + + public void setCentroControlList(List centroControlList) { + this.centroControlList = centroControlList; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteSancionesController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteSancionesController.java.svn-base new file mode 100644 index 0000000..42ece3a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ReporteSancionesController.java.svn-base @@ -0,0 +1,482 @@ +package com.fp.frontend.controller.armas.solicitud; + + +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de reporte de liquidacion economica + * + * @author Christian Pazmino. + * @version 2.1 + */ + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReporteSancionesController extends AbstractController { + + /** + * Fecha a partir de la cual se sacan datos para el reporte + * */ + private Date fechaInicio; + /** + * Fecha a partir de la cual se sacan datos para el reporte + * */ + private Date fechaFin; + /** + * Formato de reporte que se va a generar + * */ + + private Date fechaDecomiso; + + private String format = "pdf"; + /** + * Usuario actual logueado en el sistema + * */ + private TsafeUserDetail userDetail; + /** + * Nombre del reporte generado en el Alfresco + * */ + private String nombreReporte; + + /** + * Id del centro de control seleccionado por el usuario + * */ + private String idCentroControl; + + /** + * Id del tipo de tramite + */ + private String idAutorizacion; + private String idIdentificacion; + + private String numeroDocumento; + + /** + * Id del tipo de tramite + */ + private String idControl; + + private Boolean habilitar; + + /** + * Lista de centros de control de armas + */ + // private List centroControlList; + private List tipoDocumentoList; + + private List centroControlList; + + private List autorizacionList; + + private List controlList; + + private String institucionCentroControl=""; + private TarmCentroControl centroControl = new TarmCentroControl(); + + + + /** + * Clase controladora de reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{logincontroller}") + private LoginController logincontroller; + + + public ReporteSancionesController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + recperpage = 10000; // Cambiar al # reg a mirar. + beanalias = "RPRTEAUTORIZACIONES"; + // centroControlList = CentroControlArmasController.findAll(); + centroControlList = CatalogDetailController.find("TIPODEFALTA"); + + autorizacionList = CatalogDetailController.find("USOACTIVIDAD"); + tipoDocumentoList = CatalogDetailController.find("IDENTIFICATION"); + controlList = CatalogDetailController.find("NOMBREINSTITUCION"); + this.habilitar = true; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + + } + + /** + * Metodo para reconsultar en base a una nueva fecha de corte seleccionada + */ + public void cambioFechaDeCorte(SelectEvent event){ + querydatabase(); + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * + * + */ + + public void habilitarfechadecomiso(){ + if (this.idAutorizacion.equals( "6")){ + this.habilitar = false; + + + } + else + { + this.habilitar = true; + this.fechaDecomiso = null; + } + } + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport() { + if(this.fechaInicio!=null || this.fechaFin!=null || this.fechaDecomiso!=null ) + { + if(this.fechaInicio!=null && this.fechaFin!=null ) + { + if(this.fechaInicio.getTime() > this.fechaFin.getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaFin1")); + return; + } + } + + if(this.fechaInicio!=null && this.fechaFin==null ) + { + if(this.fechaInicio.getTime() > new Date().getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaActual")); + return; + } + } + if(this.fechaInicio==null && this.fechaFin!=null ) + { + if(this.fechaFin.getTime() > new Date().getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaFinMayorAFechaActual")); + return; + + } + } + + if(this.fechaDecomiso!=null ) + { + if(this.fechaDecomiso.getTime() > new Date().getTime()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaDecomisoMayorAFechaActual")); + return; + } + + + } + } + + String path = ""; + + if (this.idAutorizacion.equals( "1")){ + path = "armas/reports/sancionesa"; + + } + if (this.idAutorizacion.equals( "6")){ + path = "armas/reports/sancionesp"; + + } + + Calendar fechaActualCldr = Calendar.getInstance(); + //String path = "armas/reports/autorizaciones"; + String filename="sanciones"; + String nombreUsuario=""; + + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + + if(userDetail.getPk().getPersoncode()!=null){ + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } + else{ + nombreUsuario = ""; + } + // institucionCentroControl + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + //parameters.put("unidadmilitar", "hola"); + parameters.put("lugarFecha", Utilidades.armarFormatoFechaConHora(fechaActualCldr)); + parameters.put("usuario", nombreUsuario); + parameters.put("numeroDocumento"," ".equalsIgnoreCase(numeroDocumento)?null:numeroDocumento); + parameters.put("Pcentro", "TODOS".equalsIgnoreCase(idControl)?null:idControl); //centro de control + parameters.put("Pcausa_sancion","TODOS".equalsIgnoreCase(idCentroControl)?null:idCentroControl); // estado + //parameters.put("idAutorizacion", "TODOS".equalsIgnoreCase(idAutorizacion)?null:idAutorizacion); // tipo de auturizacion + parameters.put("Ptidentificacion", "TODOS".equalsIgnoreCase(idIdentificacion)?null:idIdentificacion); // tipo de identificacion + parameters.put("fechaInicio", this.fechaInicio==null?null:Utilidades.armarFormatoFechaSinHora(this.fechaInicio)); + parameters.put("fechaFin", this.fechaFin==null?null:Utilidades.armarFormatoFechaSinHora(this.fechaFin)); + parameters.put("fechaDecomiso", this.fechaDecomiso==null?null:Utilidades.armarFormatoFechaSinHora(this.fechaDecomiso)); + + TgeneCatalogDetail obj = CatalogDetailController.findCatalogo("NOMBREINSTITUCION", idControl); + parameters.put("tipocentro", "TODOS".equalsIgnoreCase(idControl)?"TODOS":obj.getDescription()) ; //centro de control detalle + + TgeneCatalogDetail obj2 = CatalogDetailController.findCatalogo("IDENTIFICATION", idIdentificacion); + parameters.put("pdocumento", "TODOS".equalsIgnoreCase(idIdentificacion)?"TODOS":obj2.getDescription()) ; //tipo documento detalle + + TgeneCatalogDetail obj3 = CatalogDetailController.findCatalogo("TIPOAUTORIZACION", idAutorizacion); + parameters.put("pautorizacion", "TODOS".equalsIgnoreCase(idAutorizacion)?"TODOS":obj3.getDescription()) ; //tipo autorizacion detalle + + TgeneCatalogDetail obj4 = CatalogDetailController.findCatalogo("TIPODEFALTA", idCentroControl); + parameters.put("psancion", "TODOS".equalsIgnoreCase(idCentroControl)?"TODOS":obj4.getDescription()) ; //causa sancion detalle + + try{ + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + + } + + private void obtenerCentroControl() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + + /** + * Método para el inicio de flujo. Guardar el reporte creado para su posterior aprobacion en otras instancias del flujo + */ + @Override + public void save(){ + + } + + public Date getFechaInicio() { + return fechaInicio; + } + + public void setFechaInicio(Date fechaInicio) { + this.fechaInicio = fechaInicio; + } + + public Date getFechaDecomiso() { + return fechaDecomiso; + } + + public void setFechaDecomiso(Date fechaDecomiso) { + this.fechaDecomiso = fechaDecomiso; + } + public Date getFechaFin() { + return fechaFin; + } + + public void setFechaFin(Date fechaFin) { + this.fechaFin = fechaFin; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public String getNombreReporte() { + return nombreReporte; + } + + public void setNombreReporte(String nombreReporte) { + this.nombreReporte = nombreReporte; + } + + public String getIdCentroControl() { + return idCentroControl; + } + + public void setIdCentroControl(String idCentroControl) { + this.idCentroControl = idCentroControl; + } + + public String getIdAutorizacion() { + return idAutorizacion; + } + + public void setIdAutorizacion(String idAutorizacion) { + this.idAutorizacion = idAutorizacion; + } + + //idIdentificacion + + public String getIdIdentificacion() { + return idIdentificacion; + } + + public void setIdIdentificacion(String idIdentificacion) { + this.idIdentificacion = idIdentificacion; + } + //public List getCentroControlList() { +// return centroControlList; + //} + + //public void setCentroControlList(List centroControlList) { + //this.centroControlList = centroControlList; + //} + + public List getCentroControlList() { + return centroControlList; + } + + public void setCentroControlList(List centroControlList) { + this.centroControlList = centroControlList; + } + + /*CFLORES*/ + public List getTipoDocumentoList() { + return tipoDocumentoList; + } + + public void getTipoDocumentoList(List tipoDocumentoList) { + this.tipoDocumentoList = tipoDocumentoList; + } + /**/ + + public List getAutorizacionList() { + return autorizacionList; + } + + public void setAutorizacionList(List autorizacionList) { + this.autorizacionList = autorizacionList; + } + + /*cflores*/ + public List getControlList() { + return controlList; + } + + public void setControlList(List controlList) { + this.controlList = controlList; + } + + public String getIdControl() { + return idControl; + } + + public void setIdControl(String idControl) { + this.idControl = idControl; + } + public void setHabilitar(Boolean habilitar) { + this.habilitar = habilitar; + } + + public Boolean getHabilitar() { + return habilitar; + } + + + + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + /**/ + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public LoginController getLogincontroller() { + return logincontroller; + } + + public void setLogincontroller(LoginController logincontroller) { + this.logincontroller = logincontroller; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RevisarReporteArmasADestruirController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RevisarReporteArmasADestruirController.java.svn-base new file mode 100644 index 0000000..c9519c7 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RevisarReporteArmasADestruirController.java.svn-base @@ -0,0 +1,227 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.soli.TarmCabRepDestruirArmas; +import com.fp.persistence.parmas.soli.TarmDetRepDestruirArmas; + +/** + * Clase controladora de la revision de reporte de armas a destruirse por parte del supervisor militar + * @author Christian Pazmino + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RevisarReporteArmasADestruirController extends AbstractController { + + private Integer creporte; + private Date fechaCorte; + /** + * Variable que indica si el funcionario esta negado para iniciar el flujo y enviar el reporte a su superior para aprobacion + */ + private Boolean isDenied; + + private TarmCabRepDestruirArmas cabRepDestruirArmasObj; + + @ManagedProperty(value="#{cabRepDestruirArmasController}") + private CabRepDestruirArmasController cabRepDestruirArmasController; + + @ManagedProperty(value="#{detRepDestruirArmasController}") + private DetRepDestruirArmasController detRepDestruirArmasController; + + public RevisarReporteArmasADestruirController() throws Exception { + super(TarmCabRepDestruirArmas.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + super.startQuery(); + if(this.getMfilters().get("creporte")!=null){ + creporte = Integer.parseInt(this.getMfilters().get("creporte")); + } + if(creporte!=null){ + this.getMfilters().clear(); + this.init(); + } + else{ + detRepDestruirArmasController.setLrecord(new ArrayList()); + } +// this.querydatabase(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + isDenied = Boolean.FALSE; + cabRepDestruirArmasObj = CabRepDestruirArmasController.findByCodigo(creporte.toString()); + detRepDestruirArmasController.addFilter("creporte", creporte.toString()); + detRepDestruirArmasController.query(); +// detRepDestruirArmasLst = DetRepDestruirArmasController.findByCReporte(creporte.toString()); + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList(); + beanalias = "TARMREVISAREPDECARMAS"; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next(){ + try { + if(creporte!=null){ + this.detRepDestruirArmasController.next(); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + public void previous(){ + try { + if(creporte!=null){ + this.detRepDestruirArmasController.previous(); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + super.addFilter("pk", creporte.toString()); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(lrecord.size()>0){ + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public Integer getCreporte() { + return creporte; + } + + public void setCreporte(Integer creporte) { + this.creporte = creporte; + } + + public Date getFechaCorte() { + return fechaCorte; + } + + public void setFechaCorte(Date fechaCorte) { + this.fechaCorte = fechaCorte; + } + + public CabRepDestruirArmasController getCabRepDestruirArmasController() { + return cabRepDestruirArmasController; + } + + public void setCabRepDestruirArmasController( + CabRepDestruirArmasController cabRepDestruirArmasController) { + this.cabRepDestruirArmasController = cabRepDestruirArmasController; + } + + public DetRepDestruirArmasController getDetRepDestruirArmasController() { + return detRepDestruirArmasController; + } + + public void setDetRepDestruirArmasController( + DetRepDestruirArmasController detRepDestruirArmasController) { + this.detRepDestruirArmasController = detRepDestruirArmasController; + } + + public Boolean getIsDenied() { + return isDenied; + } + + public void setIsDenied(Boolean isDenied) { + this.isDenied = isDenied; + } + + public TarmCabRepDestruirArmas getCabRepDestruirArmasObj() { + return cabRepDestruirArmasObj; + } + + public void setCabRepDestruirArmasObj( + TarmCabRepDestruirArmas cabRepDestruirArmasObj) { + this.cabRepDestruirArmasObj = cabRepDestruirArmasObj; + } + + @Override + public void save() { + try { + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + request.modifiedData().put("BPMStatus", "A"); +// request.modifiedData().put("creporte", creporte); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMObs", "Revision del supervisor militar"); + request.modifiedData().put("comment", ""); + request.modifiedData().put("observacion", ""); + Mapdatosmail = new HashMap(); + request.modifiedData().put("datosmail", datosmail); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.setShowRow(true); + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + "CREPORTE: 1" ); + isDenied = Boolean.TRUE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RevisarRprteArmasADestJefCCController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RevisarRprteArmasADestJefCCController.java.svn-base new file mode 100644 index 0000000..f97b1c1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RevisarRprteArmasADestJefCCController.java.svn-base @@ -0,0 +1,305 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.soli.TarmCabRepDestruirArmas; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDetRepDestruirArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +/** + * Clase controladora de la revision de reporte de armas a destruirse por parte del jefe del comando conjunto + * @author JALVARADO + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RevisarRprteArmasADestJefCCController extends AbstractController { + + private Integer creporte; + private Date fechaCorte; + private String estado; + + /** + * lista del catalogo de las acciones (Aceptar o rechazar) + **/ + private List laccion; + + /** + * Variable que indica si el funcionario esta negado para iniciar el flujo y enviar el reporte a su superior para aprobacion + */ + private Boolean isDenied; + + private String observacion; + + private TarmCabRepDestruirArmas tarmCabRepDestruirArmas; + + @ManagedProperty(value="#{cabRepDestruirArmasController}") + private CabRepDestruirArmasController cabRepDestruirArmasController; + + @ManagedProperty(value="#{detRepDestruirArmasController}") + private DetRepDestruirArmasController detRepDestruirArmasController; + + @ManagedProperty(value="#{decomisoArmaController}") + private DecomisoArmaController decomisoArmaController; + + + public RevisarRprteArmasADestJefCCController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + super.startQuery(); + if(this.getMfilters().get("creporte")!=null){ + creporte = Integer.parseInt(this.getMfilters().get("creporte")); + } + if(creporte!=null){ + this.getMfilters().clear(); + this.init(); + this.querydatabase(); + } + else{ + detRepDestruirArmasController.setLrecord(new ArrayList()); + } + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + isDenied = Boolean.FALSE; + tarmCabRepDestruirArmas = CabRepDestruirArmasController.findByCodigo(creporte.toString()); + detRepDestruirArmasController.addFilter("creporte", creporte.toString()); + detRepDestruirArmasController.query(); + TgeneParameters tgeneparam=ParametersController.find("CODIGO.AR", "1"); + laccion=CatalogDetailController.find("ESTADOSOLICITUD",tgeneparam.getTextvalue()); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next(){ + try { + if(creporte!=null){ + this.detRepDestruirArmasController.next(); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + public void previous(){ + try { + if(creporte!=null){ + this.detRepDestruirArmasController.previous(); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + protected void querydatabase() { + + } + + public Integer getCreporte() { + return creporte; + } + + public void setCreporte(Integer creporte) { + this.creporte = creporte; + } + + public Date getFechaCorte() { + return fechaCorte; + } + + public void setFechaCorte(Date fechaCorte) { + this.fechaCorte = fechaCorte; + } + + public CabRepDestruirArmasController getCabRepDestruirArmasController() { + return cabRepDestruirArmasController; + } + + public void setCabRepDestruirArmasController( + CabRepDestruirArmasController cabRepDestruirArmasController) { + this.cabRepDestruirArmasController = cabRepDestruirArmasController; + } + + public DetRepDestruirArmasController getDetRepDestruirArmasController() { + return detRepDestruirArmasController; + } + + public void setDetRepDestruirArmasController( + DetRepDestruirArmasController detRepDestruirArmasController) { + this.detRepDestruirArmasController = detRepDestruirArmasController; + } + + public TarmCabRepDestruirArmas getTarmCabRepDestruirArmas() { + return tarmCabRepDestruirArmas; + } + + public void setTarmCabRepDestruirArmas( + TarmCabRepDestruirArmas tarmCabRepDestruirArmas) { + this.tarmCabRepDestruirArmas = tarmCabRepDestruirArmas; + } + + public DecomisoArmaController getDecomisoArmaController() { + return decomisoArmaController; + } + + public void setDecomisoArmaController( + DecomisoArmaController decomisoArmaController) { + this.decomisoArmaController = decomisoArmaController; + } + + public List getLaccion() { + return laccion; + } + + public void setLaccion(List laccion) { + this.laccion = laccion; + } + + public Boolean getIsDenied() { + return isDenied; + } + + public void setIsDenied(Boolean isDenied) { + this.isDenied = isDenied; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public String getObservacion() { + return observacion; + } + + public void setObservacion(String observacion) { + this.observacion = observacion; + } + + public String codigoAceptado() throws Exception { + TgeneParameters f = ParametersController.find("ACEPTADO", "1"); + return f.getTextvalue(); + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + if(observacion!=null){ + request.modifiedData().put("observacion", observacion); + tarmCabRepDestruirArmas.setObsjefecc(observacion); + tarmCabRepDestruirArmas.setIsnew(Boolean.FALSE); + cabRepDestruirArmasController.update(tarmCabRepDestruirArmas); + DtoSave dtoSaveCAC = cabRepDestruirArmasController.getDtoSave(); + if(dtoSaveCAC.pendingProcess()){ + dtoSaveCAC.setPosition(1); + msave.put(cabRepDestruirArmasController.getBeanalias(), dtoSaveCAC); + } + } + // Si el reporte es rechazado se vuelven las armas del reporte a la lista de armas para ser seleccionadas en nuevos reportes + if (!codigoAceptado().equals(estado)){ + for(TarmDetRepDestruirArmas armasDecomRprteObj:detRepDestruirArmasController.getLrecord()){ + TarmDecomisoArma armasDecomisadasObj = DecomisoArmaController.findByCodigo(armasDecomRprteObj.getCdecomisoarma()); + armasDecomisadasObj.setAdestruirse(null); + armasDecomisadasObj.setAdestruirsecode(null); + armasDecomisadasObj.setIsnew(Boolean.FALSE); + decomisoArmaController.update(armasDecomisadasObj); + } + DtoSave dtoSaveDAC = decomisoArmaController.getDtoSave(); + if(dtoSaveDAC.pendingProcess()){ + dtoSaveDAC.setPosition(2); + msave.put(decomisoArmaController.getBeanalias(), dtoSaveDAC); + } + } + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.cabRepDestruirArmasController.postCommit(resp); + this.decomisoArmaController.postCommit(resp); + this.setShowRow(true); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + completarTarea(); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + try { + Request request = callerhelper.getRequest(); + + super.cleanRequest(request); + // validamos si cargamos los datos cuando apruebe + Mapdatosmail = new HashMap(); + request.modifiedData().put("TID", tid); + request.modifiedData().put("creporte", creporte); + request.modifiedData().put("BPMObs", observacion); + if (codigoAceptado().equals(estado)) { + request.modifiedData().put("BPMStatus", "A"); + }else{ + request.modifiedData().put("BPMStatus", "D"); + } + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + "jefe dpto - CREPORTE: " + creporte); + isDenied = Boolean.TRUE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RevisarRprteArmasADestJefDepController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RevisarRprteArmasADestJefDepController.java.svn-base new file mode 100644 index 0000000..ef611b1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/RevisarRprteArmasADestJefDepController.java.svn-base @@ -0,0 +1,308 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.soli.TarmCabRepDestruirArmas; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDetRepDestruirArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +/** + * Clase controladora de la revision de reporte de armas a destruirse por parte del jefe de departamento + * @author JALVARADO + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RevisarRprteArmasADestJefDepController extends AbstractController { + + private Integer creporte; + private Date fechaCorte; + private String estado; + + /** + * lista del catalogo de las acciones (Aceptar o rechazar) + **/ + private List laccion; + + /** + * Variable que indica si el funcionario esta negado para iniciar el flujo y enviar el reporte a su superior para aprobacion + */ + private Boolean isDenied; + + private String observacion; + + private TarmCabRepDestruirArmas tarmCabRepDestruirArmas; + + @ManagedProperty(value="#{cabRepDestruirArmasController}") + private CabRepDestruirArmasController cabRepDestruirArmasController; + + @ManagedProperty(value="#{detRepDestruirArmasController}") + private DetRepDestruirArmasController detRepDestruirArmasController; + + @ManagedProperty(value="#{decomisoArmaController}") + private DecomisoArmaController decomisoArmaController; + + + public RevisarRprteArmasADestJefDepController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + super.startQuery(); + if(this.getMfilters().get("creporte")!=null){ + creporte = Integer.parseInt(this.getMfilters().get("creporte")); + } + if(creporte!=null){ + this.getMfilters().clear(); + this.init(); + this.querydatabase(); + } + else{ + detRepDestruirArmasController.setLrecord(new ArrayList()); + } + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + isDenied = Boolean.FALSE; + tarmCabRepDestruirArmas = CabRepDestruirArmasController.findByCodigo(creporte.toString()); + detRepDestruirArmasController.addFilter("creporte", creporte.toString()); + detRepDestruirArmasController.query(); + TgeneParameters tgeneparam=ParametersController.find("CODIGO.AR", "1"); + laccion=CatalogDetailController.find("ESTADOSOLICITUD",tgeneparam.getTextvalue()); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next(){ + try { + if(creporte!=null){ + this.detRepDestruirArmasController.next(); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + public void previous(){ + try { + if(creporte!=null){ + this.detRepDestruirArmasController.previous(); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + protected void querydatabase() { + + } + + public Integer getCreporte() { + return creporte; + } + + public void setCreporte(Integer creporte) { + this.creporte = creporte; + } + + public Date getFechaCorte() { + return fechaCorte; + } + + public void setFechaCorte(Date fechaCorte) { + this.fechaCorte = fechaCorte; + } + + public CabRepDestruirArmasController getCabRepDestruirArmasController() { + return cabRepDestruirArmasController; + } + + public void setCabRepDestruirArmasController( + CabRepDestruirArmasController cabRepDestruirArmasController) { + this.cabRepDestruirArmasController = cabRepDestruirArmasController; + } + + public DetRepDestruirArmasController getDetRepDestruirArmasController() { + return detRepDestruirArmasController; + } + + public void setDetRepDestruirArmasController( + DetRepDestruirArmasController detRepDestruirArmasController) { + this.detRepDestruirArmasController = detRepDestruirArmasController; + } + + public TarmCabRepDestruirArmas getTarmCabRepDestruirArmas() { + return tarmCabRepDestruirArmas; + } + + public void setTarmCabRepDestruirArmas( + TarmCabRepDestruirArmas tarmCabRepDestruirArmas) { + this.tarmCabRepDestruirArmas = tarmCabRepDestruirArmas; + } + + public DecomisoArmaController getDecomisoArmaController() { + return decomisoArmaController; + } + + public void setDecomisoArmaController( + DecomisoArmaController decomisoArmaController) { + this.decomisoArmaController = decomisoArmaController; + } + + public List getLaccion() { + return laccion; + } + + public void setLaccion(List laccion) { + this.laccion = laccion; + } + + public Boolean getIsDenied() { + return isDenied; + } + + public void setIsDenied(Boolean isDenied) { + this.isDenied = isDenied; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public String getObservacion() { + return observacion; + } + + public void setObservacion(String observacion) { + this.observacion = observacion; + } + + /** + * Metodo que retorna un parametro del sistema el cual es el codigo para Aprobar una solicitud en un flujo + **/ + public String codigoAceptado() throws Exception { + TgeneParameters f = ParametersController.find("ACEPTADO", "1"); + return f.getTextvalue(); + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + if(observacion!=null){ + request.modifiedData().put("observacion", observacion); + tarmCabRepDestruirArmas.setObsjefecc(observacion); + tarmCabRepDestruirArmas.setIsnew(Boolean.FALSE); + cabRepDestruirArmasController.update(tarmCabRepDestruirArmas); + DtoSave dtoSaveCAC = cabRepDestruirArmasController.getDtoSave(); + if(dtoSaveCAC.pendingProcess()){ + dtoSaveCAC.setPosition(1); + msave.put(cabRepDestruirArmasController.getBeanalias(), dtoSaveCAC); + } + } + // Si el reporte es rechazado se vuelven las armas del reporte a la lista de armas para ser seleccionadas en nuevos reportes + if (!codigoAceptado().equals(estado)){ + for(TarmDetRepDestruirArmas armasDecomRprteObj:detRepDestruirArmasController.getLrecord()){ + TarmDecomisoArma armasDecomisadasObj = DecomisoArmaController.findByCodigo(armasDecomRprteObj.getCdecomisoarma()); + armasDecomisadasObj.setAdestruirse(null); + armasDecomisadasObj.setAdestruirsecode(null); + armasDecomisadasObj.setIsnew(Boolean.FALSE); + decomisoArmaController.update(armasDecomisadasObj); + } + DtoSave dtoSaveDAC = decomisoArmaController.getDtoSave(); + if(dtoSaveDAC.pendingProcess()){ + dtoSaveDAC.setPosition(2); + msave.put(decomisoArmaController.getBeanalias(), dtoSaveDAC); + } + } + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.cabRepDestruirArmasController.postCommit(resp); + this.decomisoArmaController.postCommit(resp); + this.setShowRow(true); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + completarTarea(); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + try { + Request request = callerhelper.getRequest(); + + super.cleanRequest(request); + // validamos si cargamos los datos cuando apruebe + Mapdatosmail = new HashMap(); + request.modifiedData().put("TID", tid); + request.modifiedData().put("creporte", creporte); + request.modifiedData().put("BPMObs", observacion); + if (codigoAceptado().equals(estado)) { + request.modifiedData().put("BPMStatus", "A"); + }else{ + request.modifiedData().put("BPMStatus", "D"); + } + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + "jefe dpto - CREPORTE: " + creporte); + isDenied = Boolean.TRUE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SancionDecomisoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SancionDecomisoController.java.svn-base new file mode 100644 index 0000000..731e384 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SancionDecomisoController.java.svn-base @@ -0,0 +1,148 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmSancionDecomiso; + + + +/** + * Clase controladora del bean TarmSancionDecomiso. + * + * @author Andres Cevallos. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SancionDecomisoController extends AbstractController { + + public SancionDecomisoController() throws Exception { + super(TarmSancionDecomiso.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + //super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "SANCIONDECOMISO"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.cdecomiso"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + public List findxdecomiso(String cdecomiso){ + try {//TgeneCatalogDetailKey + SancionDecomisoController cc = new SancionDecomisoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.cdecomiso", cdecomiso); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + public static TarmSancionDecomiso findsancionarmadec(String cdecomiso, String carma){ + try {//TgeneCatalogDetailKey + SancionDecomisoController cc = new SancionDecomisoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.cdecomiso", cdecomiso); + cc.addFilter("carma",carma); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SancionRecomendacionController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SancionRecomendacionController.java.svn-base new file mode 100644 index 0000000..774a866 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SancionRecomendacionController.java.svn-base @@ -0,0 +1,112 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmSancionRecomendacion; + + + + +/** + * Clase controladora del bean TarmSancionRecomendacion. + * + * @author Andres Cevallos. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SancionRecomendacionController extends AbstractController { + + public SancionRecomendacionController() throws Exception { + super(TarmSancionRecomendacion.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "SANCIONRECOMENDACION"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.cdecomiso"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SancionarController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SancionarController.java.svn-base new file mode 100644 index 0000000..53d76b4 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SancionarController.java.svn-base @@ -0,0 +1,1095 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.primefaces.component.selectbooleancheckbox.SelectBooleanCheckbox; +import org.primefaces.context.RequestContext; +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.lov.SancionarLovController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.DatosParaSancionesController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmTipoSancion; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * @author Andres Cevallos + * Sanciona un arma + */ + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SancionarController extends AbstractController { + + @ManagedProperty(value="#{alfrescoController}") + private AlfrescoController alfrescoController; + /** + * Boleano que activa el boton de generarreporte + */ + private Boolean reporte; + /** + * Codigo de Transaccion + */ + private Long cTransaccion; + /** + * Activa el boton enviar + */ + private String btnEnviar; + /** + * Controlador inyectado decomiso arma controller + */ + @ManagedProperty(value = "#{decomisoArmaController}") + private DecomisoArmaController decomisoArmaController; + + @ManagedProperty(value = "#{sancionDecomisoController}") + private SancionDecomisoController sancionDecomisoController; + /** + * Controlador inyectado documento habilitante + */ + @ManagedProperty(value = "#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitanteController; + /** + * controlador inyectado sancion recomendacion + */ + @ManagedProperty(value = "#{sancionRecomendacionController}") + private SancionRecomendacionController sancionRecomendacionController; + + @ManagedProperty(value = "#{armasController}") + private ArmasController armasController; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + /** + * Controlador inyectado sanciondecomiso controller + */ + private long cdocumentohabilitanteaut; + + private TarmArmas armaactual; + /** + * Instancia de la entidad Tarmdecomiso + */ + private TarmDecomiso decomiso; + /** + * Instancia de la entidad TarmDecomisoArma + */ + private Boolean sanc=false; + + private TcustPersonDetail personaUsuario; + /** + * Instancia de la entidad TarmDecomisoArma + */ + private TarmDecomisoArma decomisoArmaObj; + /** + * Instancia de la entidad TarmTipoArmaExplosivo + */ + private TarmTipoArmaExplosivo tipoarmaexplosivo; + + // private String tabid1 = "tabDetalleDeArmas"; + /** + * Bandera de tipo booleano para indicar si se ha grabado el reporte generado + * */ + private Boolean isEnableGrabar; + /** + * Bandera de tipo booleano para indicar que se debe deshabilitar el boton ENVIAR + * */ + private Boolean isEnableEnviar; + + private List autorizacion; + + private Boolean aut; + /** + * Atributo para listar las armas decomisadas + */ + private List larmas; + /** + * Instancia de una lista de tipo de sancion + */ + private List tsancion1; + /** + * Provincia + */ + private String provincia; + /** + * Instan de un tipo de sancion + */ + private TarmTipoSancion sancion; + /** + * Canton + */ + private TarmCentroControl centroControl; + + private String canton; + /** + * Ciudad + */ + private String ciudad; + /** + * Parroquia + */ + private String parroquia; + /** + * Clase de arma + */ + private String clasearma; + /** + * Detalle de grado + */ + private TgeneCatalogDetail gradoCatalogDatail; + /** + * Detalle de unidad + */ + private TgeneCatalogDetail unidadCatalogDatail; + + private TsafeUserDetail userDetail; + /** + * Atributo asociado a al documento de la utorizacion que se seleccione + */ + private TarmTramite tramite; + /** + *Tipo de sancion, a la autorización o al permiso + */ + private String tipsancion=""; + + private TarmRegistroArmas regarma; + + private List documentos; + + //private TarmDocumentoHabilitante doc1; + + private String institucionCentroControl=""; + + /** + * Bandera usada para identificar si existe o no un documento habilitante para el arma a sancionarse + */ + private Boolean isExistDocHabilitante = Boolean.FALSE; + + private TcustPersonDetail responsableCentroControl= null; + private Boolean grillaAut; + private String sanciontipo; + + @Override + public void query() { + + } + + @Override + protected void querydatabase() { + } + + public SancionarController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + startQuery(); + this.init(); + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + //cDecomiso=(long)376; + cTransaccion=Long.parseLong(super.getMfilters().get("numerotransaccion")); + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + aut=false; + userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + isEnableGrabar=Boolean.TRUE; + isEnableEnviar=Boolean.FALSE; + grillaAut=true; + larmas=new ArrayList(); + personaUsuario=PersonDetailController.find(userDetail.getPk().getPersoncode().toString()); +// //lista de las armas decomisadas +// List lRecepcionArmasDetalle = DecomisoArmaController.findByCodigoDecomiso(cDecomiso.toString()); + List lRecepcionArmasDetalle = DecomisoArmaController.findArmasPorSancionar(cTransaccion); + for(TarmDecomisoArma decomisoArmaDetalle : lRecepcionArmasDetalle ){ + TarmArmas arma = ArmasController.findPorCodigo(decomisoArmaDetalle.getCarma()); + TarmRegistroArmas regarmaa= RegistroArmController.findByCodigo(arma.getCregistro().toString()); + arma.getModifiedData().put("tipoarmaexplosivos", TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo())); + TarmTipoArmaExplosivo tipoarmaexplosivo = (TarmTipoArmaExplosivo) arma.getModifiedData().get("tipoarmaexplosivos"); + String clasearma = CatalogDetailController.findxCodigoCodcatalogo(tipoarmaexplosivo.getClase(), tipoarmaexplosivo.getClasecodigo()).getDescription(); + + arma.getModifiedData().put("clase", clasearma); + // arma.getModifiedData().put("tsancion", DatosParaSancionesController.find(tipoarmaexplosivo.getClase())); + arma.getModifiedData().put("persona", regarmaa.getPersoncode().toString()); + +// if(SancionDecomisoController.findsancionarmadec(cDecomiso.toString(),arma.getPk().toString()) != null){ + if(SancionDecomisoController.findsancionarmadec(decomisoArmaDetalle.getCdecomiso().toString(),arma.getPk().toString()) != null){ + arma.getModifiedData().put("sancionada", "true"); + } + //seteo del deomiso del arma TarmDecomiso + arma.getModifiedData().put("decomisoArma", decomisoArmaDetalle); + larmas.add(arma); + } + // sancion=new TarmTipoSancion(); + btnEnviar=null; + checkenviar(); +// } +// else{ +// MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_numReciboNoRegistrado")); +// } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void checkenviar(){ + for(TarmArmas arm : larmas){ + if(arm.getModifiedData().get("sancionada")==null || arm.getModifiedData().get("sancionada").toString()!="true") + {return;} + } + isEnableEnviar=Boolean.TRUE; + btnEnviar="ok"; + } + + /** + * Metodo para seleccionar el documento en el combo de la autorizacion + * @throws Exception + */ + @SuppressWarnings("static-access") + public void changetype() throws Exception{ + if( cdocumentohabilitanteaut!=0){ + documentoHabilitanteController.setRecord(documentoHabilitanteController.find(cdocumentohabilitanteaut+"")); + tramite=TarmTramiteController.find(documentoHabilitanteController.getRecord().getCtramite().toString()); + isExistDocHabilitante = Boolean.TRUE; + tipsancion="AUTORIZACION"; + sancion=new TarmTipoSancion(); + } + else{ + tramite= new TarmTramite(); + documentoHabilitanteController.setRecord(null); + //cuando no tiene asociado a un documento + sancion=DatosParaSancionesController.findxPk("0"); + sancion.getModifiedData().put("nfalta", null); + sancion.getModifiedData().put("ntipoFalta", null); + sancionDecomisoController.create(); + + btnEnviar="true"; + tipsancion=""; + isExistDocHabilitante = Boolean.FALSE; + } + } + + public void setDocumentoHabilitanteController( + DocumentoHabilitanteController documentoHabilitanteController) { + this.documentoHabilitanteController = documentoHabilitanteController; + } + + /** + * Sancion Aplicada al permiso + */ + @SuppressWarnings("unchecked") + public void sancionarPermiso(TarmArmas armar){ + //inicializamos las variables + TarmDecomisoArma decomisoArmaSel = (TarmDecomisoArma) armar.getModifiedData().get("decomisoArma"); + decomiso = DecomisoController.findByCodigo(decomisoArmaSel.getCdecomiso().toString()); + + provincia = ProvinceController.getDescProvByCodigo(decomiso.getCountrycode(), decomiso.getProvincecode()); + canton = CantonController.getDescCantonByCodigo(decomiso.getCountrycode(), decomiso.getProvincecode(), decomiso.getCantoncode()); + ciudad = CityController.getDescCiudadByCodigo(decomiso.getCountrycode(), decomiso.getProvincecode(), decomiso.getCantoncode(), decomiso.getCitycode()); + parroquia = ParroquiaController.getDescParroquiaByCodigo(decomiso.getCountrycode(), decomiso.getProvincecode(), decomiso.getCantoncode(), decomiso.getParroquiacode()); + gradoCatalogDatail = CatalogDetailController.findxCodigoCodcatalogo(decomiso.getGradofuncionario(), decomiso.getGradofuncionariocode()); + TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(decomiso.getCcentrocontrol()); + unidadCatalogDatail = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()); + + tramite=new TarmTramite(); + documentoHabilitanteController.setRecord(null); + sancion=null; + regarma=null; + cdocumentohabilitanteaut=0; + sancionRecomendacionController.clearAll(); + autorizacion= new ArrayList(); + + //arma actual + armaactual=armar; + reporte=Boolean.FALSE; + //registro del arma obtiene el codigo del propietario del arma + regarma= RegistroArmController.findByCodigo(armar.getCregistro().toString()); + tipoarmaexplosivo = (TarmTipoArmaExplosivo) armar.getModifiedData().get("tipoarmaexplosivos"); + //clase del arma + clasearma = CatalogDetailController.findxCodigoCodcatalogo(tipoarmaexplosivo.getClase(), tipoarmaexplosivo.getClasecodigo()).getDescription(); + //tsancion=(List) armar.getModifiedData().get("tsancion"); + //documento habilitante por codigo del arma y codigo de la persona + System.out.println("codigo de la persona: "+armaactual.getModifiedData().get("persona")+" - codigo arma: "+ armaactual.getCodigoarma()); + TarmDocumentoHabilitante permiso=null; + if(armaactual.getModifiedData().get("persona")!=null && armaactual.getCodigoarma()!=null){ + permiso = DocumentoHabilitanteController.findxarma(armaactual.getCodigoarma(),armaactual.getModifiedData().get("persona").toString()); + } + //lista de documentos habilitantes por codigo de la persona (lista las autorizaciones para el combo del dialog) 1 TIPOAUTORIZACION 0 AUTORIZACION + if(armaactual.getModifiedData().get("persona")!=null && permiso==null){ + autorizacion=DocumentoHabilitanteController.findPorPersoncodeaut(armaactual.getModifiedData().get("persona").toString()); + } + try { + //se crea la sancion + sancionDecomisoController.create(); + sancionDecomisoController.getRecord().setFechainicio(new java.sql.Date(new Date().getTime())); + //no tiene documents + if(permiso==null && autorizacion.isEmpty()){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_nopermiso")); + //no tiene documentos la sancion va por default + sancion=DatosParaSancionesController.findxPk("0"); + sancion.getModifiedData().put("nfalta", null); + sancion.getModifiedData().put("ntipoFalta", null); + + btnEnviar="true"; + aut=Boolean.FALSE; + tipsancion="AUTORIZACION"; + //ltramite="1"; + isExistDocHabilitante = Boolean.FALSE; + } + else if(permiso!=null) { + aut=Boolean.FALSE; + sancion=new TarmTipoSancion(); +// permiso.setEstado("SAN"); + documentoHabilitanteController.setRecord(permiso); + //consulta el tramite + tramite=TarmTramiteController.find(documentoHabilitanteController.getRecord().getCtramite().toString()); + sancionDecomisoController.getRecord().setCdocumento(documentoHabilitanteController.getRecord().getPk()); + tipsancion="PERMISO"; + //ltramite="6"; + isExistDocHabilitante=Boolean.TRUE; + //limpiamos la list + autorizacion=new ArrayList(); + }else{ + //no tiene documentos la sancion va por default + sancion=DatosParaSancionesController.findxPk("0"); + sancion.getModifiedData().put("nfalta", null); + sancion.getModifiedData().put("ntipoFalta", null); + //documentoHabilitanteController.setRecord(new TarmDocumentoHabilitante()); + + isExistDocHabilitante = Boolean.FALSE; + //ltramite="1"; + aut=Boolean.TRUE; + // isExistDocHabilitante=Boolean.TRUE; + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Carga los datos de la sancion dentro del lrecord + */ + public void actualizarSancion(){ + if(sancion==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_ingresesancion")); + return; + } + try { + TgeneCatalogDetail tiempo= CatalogDetailController.findxCodigoCodcatalogo(sancion.getTiempo(), sancion.getTiempocodigo()); + Calendar calendario = Calendar.getInstance(); + if(sancionDecomisoController.getRecord()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_ingresesancion")); + return; + } + try{ + calendario.add(Calendar.DAY_OF_YEAR,Integer.parseInt(tiempo.getDescription())); + } + catch(Exception e){ + e.printStackTrace(); + MessageHelper.setMessageError("EL CATALOGO SE ENCUENTRA MAL PARAMETRIZADO"); + return; + } + Date fechalaboral=calendario.getTime(); + sancionDecomisoController.getRecord().setCtiposancion(sancion.getPk()); + sancionDecomisoController.getRecord().getPk().setCdecomiso(decomiso.getPk()); + // PENDIENTE CFPH LINEA SUPERIOS COMENTADA + sancionDecomisoController.getRecord().setPersoncode(regarma.getPersoncode()); + sancionDecomisoController.getRecord().setFechafinal(new java.sql.Date(fechalaboral.getTime())); + sancionDecomisoController.getRecord().setCarma(armaactual.getPk()); + if(documentoHabilitanteController!=null && documentoHabilitanteController.getRecord()!=null && documentoHabilitanteController.getRecord().getPk()!=null){ + sancionDecomisoController.getRecord().setCdocumento(documentoHabilitanteController.getRecord().getPk()); + //documento + if(documentoHabilitanteController!=null){ + if(sancion.getSancion()=="1" || sancion.getSancion()=="1") + documentoHabilitanteController.getRecord().setEstado("CAN"); + else{ + documentoHabilitanteController.getRecord().setEstado("SUS"); + } + } + documentoHabilitanteController.update(); + } + //seteamos el ARMA DECOMISADA + sancionDecomisoController.getRecord().getModifiedData().put("arma", armaactual); + //lista de las RECOMENDACIONES + sancionDecomisoController.getRecord().getModifiedData().put("recomendaciones", sancionRecomendacionController.getLrecord()); + sancionDecomisoController.update(); + + sanc=true; + //graba la sancion + save(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Crea una nueva recomendacion + */ + public void createRecomendacion(){ + try { + sancionRecomendacionController.create(); + sancionRecomendacionController.getRecord().setPersoncode(personaUsuario.getPk().getPersoncode()); + sancionRecomendacionController.getRecord().getModifiedData().put("usuario", personaUsuario.getName()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Guarda la recomendacion en el lrecord de sanciones + */ + public void actualizarRecomendacion(){ + try { + sancionRecomendacionController.update(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Obtiene los datos del lov de sancion + * @param event + * @throws Exception + */ + public void onReturnSancionLov(SelectEvent event) throws Exception{ + sancion=(TarmTipoSancion) event.getObject(); + + } + + /** + * Abre el Lov de Sanciones + */ + public void openSancionarLov() { + if(tramite==null || tramite.getTipoautorizacion()==null){ + MessageHelper.setMessageError("DOCUMENTO SIN SIN TRAMITE"); + return; + } + if(tipoarmaexplosivo==null || tipoarmaexplosivo.getClase()==null){ + MessageHelper.setMessageError("ARMA SIN CLASE"); + return; + } + Map> params = new HashMap<>(); + + List tramitePa = new ArrayList(); + tramitePa.add(tramite.getTipoautorizacion()); + params.put("tramite", tramitePa); + List clasePa = new ArrayList(); + clasePa.add(tipoarmaexplosivo.getClase()); + params.put("clase", clasePa); + System.out.println("Tramite: "+tramite.getTipoautorizacion()+" clase arma: "+tipoarmaexplosivo.getClase()); + SancionarLovController.openLov(params);//, tipoarmaexplosivo, tsancion, + } + + public void reporteSancion(){ + String gradoUsuario =""; + + Calendar fechaActualCldr = Calendar.getInstance(); + String path = "armas/reports/sancionReporte"; + String filename="Sancion"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + try { + String nombreUsuario; + if(userDetail.getPk().getPersoncode()!=null){ + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } + else{ + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario); + //Fecha actual + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH)+1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH)+1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarFecha", fechaActualSB.toString()); + // parameters.put("transaccion",numeroTransaccionEnvioConvertido); + String format="pdf"; + + InputStream file =this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + String xpathflujo = generarXpath(); + + alfrescoController.uploadFile(file,filename+".pdf",xpathflujo); + // iniciarFlujo(xpathflujo+"/cm:"+numeroTransaccionEnvioConvertido+ ".pdf");//="cm:Decomiso/cm:A-2014/cm:M-10/cm:ENV-000000319/cm:ENV-000000319.pdf" + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + finally{ + reporte=Boolean.FALSE; + } + } + + /** + * Metodo para generar la ruta del alfresco + * @return + */ + public String generarXpath(){ + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta=new StringBuilder("cm:Decomiso"); + String centrocontrol=institucionCentroControl.replaceAll("\\s+", "_"); + ruta = ruta.append("/cm:").append(centrocontrol); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + + return ruta.toString(); + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + if(sancionDecomisoController.getLrecord()==null || sancionDecomisoController.getLrecord().isEmpty()){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_realiceunasancion")); + return; + } + try { + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + //cargado las sanciones + DtoSave dtosaveSancionDecomiso = sancionDecomisoController.getDtoSave(); + dtosaveSancionDecomiso.setPosition(1); + msave.put(this.sancionDecomisoController.getBeanalias(), dtosaveSancionDecomiso); + + //cargado las recomendaciones + DtoSave dtosaveSancionRecomend = sancionRecomendacionController.getDtoSave(); + dtosaveSancionRecomend.setPosition(2); + msave.put(this.sancionRecomendacionController.getBeanalias(), dtosaveSancionRecomend); + + //cargado para actualizarse + DtoSave dtosaveDocumentoHabilitante= documentoHabilitanteController.getDtoSave(); + dtosaveDocumentoHabilitante.setPosition(3); + msave.put(this.documentoHabilitanteController.getBeanalias(), dtosaveDocumentoHabilitante); + + //decomiso del arma(vacio) + DtoSave dtosaveDecomisoArma= decomisoArmaController.getDtoSave(); + dtosaveDecomisoArma.setPosition(4); + msave.put(this.decomisoArmaController.getBeanalias(), dtosaveDecomisoArma); + + //arma(vacio) + DtoSave dtosaveArmasController= armasController.getDtoSave(); + dtosaveArmasController.setPosition(5); + msave.put(this.armasController.getBeanalias(), dtosaveArmasController); + + request.setSaveTables(msave); + // query transaction Sancionar + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.sancionDecomisoController.postCommit(resp); + sancionDecomisoController.clearAll(); + this.sancionRecomendacionController.postCommit(resp); + sancionRecomendacionController.clearAll(); + this.documentoHabilitanteController.postCommit(resp); + this.decomisoArmaController.postCommit(resp); + this.armasController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + reporte=Boolean.TRUE; + //cambio a sancionada el arma + for(TarmArmas arma:larmas){ + if(arma.getPk().equals(armaactual.getPk())){ + arma.getModifiedData().put("sancionada", "true"); + } + } + checkenviar(); + //reporteSancion(); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + finally{ + btnEnviar="true"; + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); +// request.modifiedData().put("cdecomiso",cDecomiso); + request.modifiedData().put("TID", tid); + request.modifiedData().put("isnew", "Y"); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs",bpmDataComment == null ? "OK" : bpmDataComment); + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + btnEnviar=null; + isEnableEnviar = Boolean.FALSE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Seleccionar Arma para sancionarla + * @param event + */ + public void seleccionarArma1212(AjaxBehaviorEvent event){ + try { + SelectBooleanCheckbox booleanCheckbox = (SelectBooleanCheckbox) event.getComponent(); + decomisoArmaObj = (TarmDecomisoArma) booleanCheckbox.getAttributes().get("armaDecomisadaObj"); + boolean checked = (Boolean) booleanCheckbox.getValue(); + if (checked) { + decomisoArmaObj.setEnbodega("Y"); + }else{ + decomisoArmaObj.setEnbodega(null); + } + decomisoArmaController.update(decomisoArmaObj); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Sancion Para la autorizacion + * @param pCdocumento + */ + public void sancionarAutorizaciona121212(Long pCdocumento){ + try { + sancionDecomisoController.create(); + sancionDecomisoController.getRecord().setCdocumento(pCdocumento); + tipsancion="AUTORIZACION"; + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Busca la sancion + */ + public void changeType1212(){ + sancion=DatosParaSancionesController.findxPk(sancion.getPk()); + } + + public DecomisoArmaController getDecomisoArmaController() { + return decomisoArmaController; + } + + public void setDecomisoArmaController( + DecomisoArmaController decomisoArmaController) { + this.decomisoArmaController = decomisoArmaController; + } + + public TarmDecomiso getDecomiso() { + return decomiso; + } + + public void setDecomiso(TarmDecomiso decomiso) { + this.decomiso = decomiso; + } + + public String getProvincia() { + return provincia; + } + + public void setProvincia(String provincia) { + this.provincia = provincia; + } + + public String getCanton() { + return canton; + } + + public void setCanton(String canton) { + this.canton = canton; + } + + public String getCiudad() { + return ciudad; + } + + public void setCiudad(String ciudad) { + this.ciudad = ciudad; + } + + public String getParroquia() { + return parroquia; + } + + public void setParroquia(String parroquia) { + this.parroquia = parroquia; + } + + public TgeneCatalogDetail getGradoCatalogDatail() { + return gradoCatalogDatail; + } + + public void setGradoCatalogDatail(TgeneCatalogDetail gradoCatalogDatail) { + this.gradoCatalogDatail = gradoCatalogDatail; + } + + public TgeneCatalogDetail getUnidadCatalogDatail() { + return unidadCatalogDatail; + } + + public void setUnidadCatalogDatail(TgeneCatalogDetail unidadCatalogDatail) { + this.unidadCatalogDatail = unidadCatalogDatail; + } + + + + public TarmDecomisoArma getDecomisoArmaObj() { + return decomisoArmaObj; + } + + public void setDecomisoArmaObj(TarmDecomisoArma decomisoArmaObj) { + this.decomisoArmaObj = decomisoArmaObj; + } + + + + public SancionDecomisoController getSancionDecomisoController() { + return sancionDecomisoController; + } + + public void setSancionDecomisoController( + SancionDecomisoController sancionDecomisoController) { + this.sancionDecomisoController = sancionDecomisoController; + } + + public SancionRecomendacionController getSancionRecomendacionController() { + return sancionRecomendacionController; + } + + public void setSancionRecomendacionController( + SancionRecomendacionController sancionRecomendacionController) { + this.sancionRecomendacionController = sancionRecomendacionController; + } + + public String getClasearma() { + return clasearma; + } + + public void setClasearma(String clasearma) { + this.clasearma = clasearma; + } + +// public List getTsancion() { +// return tsancion; +// } +// +// public void setTsancion(List tsancion) { +// this.tsancion = tsancion; +// } + + public TarmTipoSancion getSancion() { + return sancion; + } + + public void setSancion(TarmTipoSancion sancion) { + this.sancion = sancion; + } + + public String getSanciontipo() { + return sanciontipo; + } + + public void setSanciontipo(String sanciontipo) { + this.sanciontipo = sanciontipo; + } + + public Boolean getGrillaAut() { + return grillaAut; + } + + public void setGrillaAut(Boolean grillaAut) { + this.grillaAut = grillaAut; + } + +// public Long getcDecomiso() { +// return cDecomiso; +// } +// +// public void setcDecomiso(Long cDecomiso) { +// this.cDecomiso = cDecomiso; +// } + + public String getBtnEnviar() { + return btnEnviar; + } + + public Long getcTransaccion() { + return cTransaccion; + } + + public void setcTransaccion(Long cTransaccion) { + this.cTransaccion = cTransaccion; + } + + public void setBtnEnviar(String btnEnviar) { + this.btnEnviar = btnEnviar; + } + + public List getDocumentos() { + return documentos; + } + + public void setDocumentos(List documentos) { + this.documentos = documentos; + } + + + public String getTipsancion() { + return tipsancion; + } + + public void setTipsancion(String tipsancion) { + this.tipsancion = tipsancion; + } + + public Boolean getSanc() { + return sanc; + } + + public void setSanc(Boolean sanc) { + this.sanc = sanc; + } + + public Boolean getIsExistDocHabilitante() { + return isExistDocHabilitante; + } + + public void setIsExistDocHabilitante(Boolean isExistDocHabilitante) { + this.isExistDocHabilitante = isExistDocHabilitante; + } + + public Boolean getIsEnableGrabar() { + return isEnableGrabar; + } + + public void setIsEnableGrabar(Boolean isEnableGrabar) { + this.isEnableGrabar = isEnableGrabar; + } + + public Boolean getIsEnableEnviar() { + return isEnableEnviar; + } + + public void setIsEnableEnviar(Boolean isEnableEnviar) { + this.isEnableEnviar = isEnableEnviar; + } + + public List getLarmas() { + return larmas; + } + + public void setLarmas(List larmas) { + this.larmas = larmas; + } + + public TarmRegistroArmas getRegarma() { + return regarma; + } + + public void setRegarma(TarmRegistroArmas regarma) { + this.regarma = regarma; + } + + public TarmArmas getArmaactual() { + return armaactual; + } + + public void setArmaactual(TarmArmas armaactual) { + this.armaactual = armaactual; + } + + public List getAutorizacion() { + return autorizacion; + } + + public void setAutorizacion(List autorizacion) { + this.autorizacion = autorizacion; + } + + public long getCdocumentohabilitanteaut() { + return cdocumentohabilitanteaut; + } + + public void setCdocumentohabilitanteaut(long cdocumentohabilitanteaut) { + this.cdocumentohabilitanteaut = cdocumentohabilitanteaut; + } + + public Boolean getAut() { + return aut; + } + + public void setAut(Boolean aut) { + this.aut = aut; + } + + public TarmCentroControl getCentrocontrol() { + return centroControl; + } + + public void setCentrocontrol(TarmCentroControl centrocontrol) { + this.centroControl = centrocontrol; + } + + public Boolean getReporte() { + return reporte; + } + + public void setReporte(Boolean reporte) { + this.reporte = reporte; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public TarmTipoArmaExplosivo getTipoarmaexplosivo() { + return tipoarmaexplosivo; + } + + public void setTipoarmaexplosivo(TarmTipoArmaExplosivo tipoarmaexplosivo) { + this.tipoarmaexplosivo = tipoarmaexplosivo; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TarmTramite getTramite() { + return tramite; + } + + public void setTramite(TarmTramite tramite) { + this.tramite = tramite; + } + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + public ReportController getReportController() { + return reportController; + } + + public ArmasController getArmasController() { + return armasController; + } + + public void setArmasController(ArmasController armasController) { + this.armasController = armasController; + } + + public TcustPersonDetail getPersonaUsuario() { + return personaUsuario; + } + + public void setPersonaUsuario(TcustPersonDetail personaUsuario) { + this.personaUsuario = personaUsuario; + } + public DocumentoHabilitanteController getDocumentoHabilitanteController() { + return documentoHabilitanteController; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudAgenciaSucursalController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudAgenciaSucursalController.java.svn-base new file mode 100644 index 0000000..1f46ee6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudAgenciaSucursalController.java.svn-base @@ -0,0 +1,150 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmSolicitudAgenciaSucursal; + +/** + * Controlador que maneja {@link TarmSolicitudAgenciaSucursal} + * @author dcruz + * + */ +@ManagedBean +@ViewScoped +public class SolicitudAgenciaSucursalController extends + AbstractController { + + private static final long serialVersionUID = 1L; + + public SolicitudAgenciaSucursalController() throws Exception { + super(TarmSolicitudAgenciaSucursal.class); + } + + @PostConstruct + public void postConstruct() { + this.init(); +// this.querydatabase(); + } + + private void init(){ + this.lrecord = new ArrayList<>(); + this.beanalias = "SOLICITUDAGENCIA"; + this.recperpage = 15; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto);//se puede aniadir mas tablas + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response response = callerhelper.executeQuery(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0){ + this.lrecord = new ArrayList<>(); + MessageHelper.setMessageError(response); + } else{ + this.lrecord = (List) response.get(beanalias); + this.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + SubQuery subQueryNombre = new SubQuery("TarmAgenciaSucursal","nombre","nombre"," i.pk=t.pk.cagencia"); + dto.addSubQuery(subQueryNombre); + + SubQuery subQueryResponsable = new SubQuery("TarmAgenciaSucursal","responsable","responsable"," i.pk=t.pk.cagencia"); + dto.addSubQuery(subQueryResponsable); + + SubQuery subQueryTipo = new SubQuery("TgeneCatalogDetail", "description", "ntipo", "i.pk.catalog = (select o.tipo from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)" + + " and i.pk.catalogcode=(select o.tipocodigo from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)"); + dto.addSubQuery(subQueryTipo); + SubQuery subQueryEstado = new SubQuery("TgeneCatalogDetail", "description", "nestado", "i.pk.catalog = (select o.estado from TarmAgenciaSucursal o where o.pk=t.pk.cagencia) " + + " and i.pk.catalogcode=(select o.estadocodigo from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)"); + dto.addSubQuery(subQueryEstado); + SubQuery subQueryProvincia = new SubQuery("TgeneProvince", "description", "nprovincia", "i.pk.provincecode=(select o.provincecode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)" + + " and i.pk.countrycode= (select o.countrycode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)"); + dto.addSubQuery(subQueryProvincia); + SubQuery subQueryCanton = new SubQuery("TgeneCanton", "description", "ncanton", "i.pk.countrycode= (select o.countrycode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)" + + " and i.pk.provincecode=(select o.provincecode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)" + + " and i.pk.cantoncode= (select o.cantoncode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)"); + dto.addSubQuery(subQueryCanton); + SubQuery subQueryParroquia = new SubQuery("TgeneParroquia","description","nparroquia","i.pk.countrycode= (select o.countrycode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia) " + + " and i.pk.provincecode=(select o.provincecode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia) " + + " and i.pk.cantoncode= (select o.cantoncode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia) " + + " and i.pk.parroquiacode=(select o.parroquiacode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)"); + dto.addSubQuery(subQueryParroquia); + SubQuery subQueryCiudad = new SubQuery("TgeneCity","description","nciudad","i.pk.countrycode= (select o.countrycode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia) " + + " and i.pk.provincecode=(select o.provincecode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)" + + " and i.pk.cantoncode=(select o.cantoncode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)" + + " and i.pk.citycode=(select o.citycode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)"); + dto.addSubQuery(subQueryCiudad); + return dto; + } + + + @Override + public void save() { + try { + DtoSave dto = super.getDtoSave(); + if(!dto.pendingProcess()){ + return; + } + HashMap msaves = new HashMap(); + msaves.put(beanalias, dto); + Request request = callerhelper.getRequest(); + request.setSaveTables(msaves); + Response response = callerhelper.executeSave(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + this.postCommit(response); + MessageHelper.setMessageInfo(response); + } else{ + MessageHelper.setMessageError(response); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * M\u00e9todo para encontrar por solicitud + * @param solicitudCode + * @return List + */ + public static List findPorSolicitud(String solicitudCode) { + try { + SolicitudAgenciaSucursalController cc = new SolicitudAgenciaSucursalController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.csolicitud", solicitudCode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudArmasBPMController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudArmasBPMController.java.svn-base new file mode 100644 index 0000000..8459b10 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudArmasBPMController.java.svn-base @@ -0,0 +1,175 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.util.EstadosSolicitudBPM; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmSolicitud; + +/** + * Clase controladora del bean TarmSolicitud. + * + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SolicitudArmasBPMController extends AbstractController { + + + + public SolicitudArmasBPMController() throws Exception { + super(TarmSolicitud.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); +// beanalias = "SOLICITUDBPM"; +// listaEstadoSolicitud= new ArrayList(); + this.create(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { +// listaEstadoSolicitud = new ArrayList<>(); + DtoQuery dto = super.getDtoQuery(true); + dto.setMultirecord(false); + //nombre + SubQuery snombre= new SubQuery + ("TcustPersonDetail", "name", "nombre", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery snumerodocumento= new SubQuery + ("TcustPersonDetail", "identification", "identification", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery identificationcatalog= new SubQuery + ("TcustPersonDetail", "identificationcatalog", "identificationcatalog", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery identificationcatalogcode= new SubQuery + ("TcustPersonDetail", "identificationcatalogcode", "identificationcatalogcode", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + //tramite +// TarmTramite + SubQuery codigoTramite= new SubQuery + ("TarmTramite", "pk", "pk", "i.pk = t.ctramite"); + SubQuery tramitetipoautorizacion= new SubQuery + ("TarmTramite", "tipoautorizacion", "tipoautorizacion", "i.pk = t.ctramite"); + SubQuery tramitetipoautorizacioncode= new SubQuery + ("TarmTramite","tipoautorizacioncodigo", "tipoautorizacioncodigo", "i.pk = t.ctramite"); + SubQuery tramitecategoria= new SubQuery + ("TarmTramite", "categoria", "categoria", "i.pk = t.ctramite"); + SubQuery tramitecategoriacodigo= new SubQuery + ("TarmTramite","categoriacodigo", "categoriacodigo", "i.pk = t.ctramite"); + SubQuery tramiteusoactividad= new SubQuery + ("TarmTramite", "usoactividad", "usoactividad", "i.pk = t.ctramite"); + SubQuery tramiteusoactividadcodigo= new SubQuery + ("TarmTramite","usoactividadcodigo", "usoactividadcodigo", "i.pk = t.ctramite"); + //estado + SubQuery estado= new SubQuery("TgeneCatalogDetail","description","estadoSolicitud","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(estado); + + dto.addSubQuery(snumerodocumento); + dto.addSubQuery(snombre); + dto.addSubQuery(identificationcatalog); + dto.addSubQuery(identificationcatalogcode); + + dto.addSubQuery(codigoTramite); + dto.addSubQuery(tramitetipoautorizacion); + dto.addSubQuery(tramitetipoautorizacioncode); + dto.addSubQuery(tramitecategoria); + dto.addSubQuery(tramitecategoriacodigo); + dto.addSubQuery(tramiteusoactividad); + dto.addSubQuery(tramiteusoactividadcodigo); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); +// request.put("queryalias", "ESTADOSSOLICITUDBPMQUERY"); +// request.put("codigosolicitudbpm", this.getMfilters().get("numerosolicitud")); + + Response resp = callerhelper.executeQuery(request); +// if(resp.get("LISTASESTADOSOLICITUDBPM")!=null){ +// System.out.println("------------"+resp.get("LISTASESTADOSOLICITUDBPM").toString()); +// List listaEstadosSolicitud = (List)resp.get("LISTASESTADOSOLICITUDBPM"); +// for (Object[] item : listaEstadosSolicitud) { +// EstadosSolicitudBPM estados = new EstadosSolicitudBPM(); +// estados.setActividad(item[0]!=null?item[0].toString():""); +// estados.setUsuarioasignado(item[1]!=null?item[1].toString():""); +// estados.setGrupoasignado(item[2]!=null?item[2].toString():""); +// estados.setEstado(item[3]!=null?item[3].toString():""); +// estados.setFechacreacion(item[4]!=null?(Date)item[4]:null); +// estados.setFechainicio(item[5]!=null?(Date)item[5]:null); +// estados.setFechacompleta(item[6]!=null?(Date)item[6]:null); +// listaEstadoSolicitud.add(estados); +// } +// } + + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + record = (TarmSolicitud) resp.get(beanalias); + super.postQuery((AbstractDataTransport) resp.get(beanalias)); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + + @Override + public void save() { + } + + +// public List getListaEstadoSolicitud() { +// return listaEstadoSolicitud; +// } +// +// public void setListaEstadoSolicitud( +// List listaEstadoSolicitud) { +// this.listaEstadoSolicitud = listaEstadoSolicitud; +// } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudArmasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudArmasController.java.svn-base new file mode 100644 index 0000000..7fad4dd --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudArmasController.java.svn-base @@ -0,0 +1,350 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.util.EstadosSolicitudBPM; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; + +/** + * Clase controladora del bean TarmSolicitud. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SolicitudArmasController extends AbstractController { + + private ListlistaEstadoSolicitud; + + public SolicitudArmasController() throws Exception { + super(TarmSolicitud.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "SOLICITUD"; + listaEstadoSolicitud= new ArrayList(); + this.create(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + listaEstadoSolicitud = new ArrayList<>(); + DtoQuery dto = super.getDtoQuery(true); + dto.setMultirecord(false); + //nombre + SubQuery snombre= new SubQuery + ("TcustPersonDetail", "name", "nombre", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery snumerodocumento= new SubQuery + ("TcustPersonDetail", "identification", "identification", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery identificationcatalog= new SubQuery + ("TcustPersonDetail", "identificationcatalog", "identificationcatalog", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery identificationcatalogcode= new SubQuery + ("TcustPersonDetail", "identificationcatalogcode", "identificationcatalogcode", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + //tramite +// TarmTramite + SubQuery codigoTramite= new SubQuery + ("TarmTramite", "pk", "pk", "i.pk = t.ctramite"); + SubQuery tramitetipoautorizacion= new SubQuery + ("TarmTramite", "tipoautorizacion", "tipoautorizacion", "i.pk = t.ctramite"); + SubQuery tramitetipoautorizacioncode= new SubQuery + ("TarmTramite","tipoautorizacioncodigo", "tipoautorizacioncodigo", "i.pk = t.ctramite"); + SubQuery tramitecategoria= new SubQuery + ("TarmTramite", "categoria", "categoria", "i.pk = t.ctramite"); + SubQuery tramitecategoriacodigo= new SubQuery + ("TarmTramite","categoriacodigo", "categoriacodigo", "i.pk = t.ctramite"); + SubQuery tramiteusoactividad= new SubQuery + ("TarmTramite", "usoactividad", "usoactividad", "i.pk = t.ctramite"); + SubQuery tramiteusoactividadcodigo= new SubQuery + ("TarmTramite","usoactividadcodigo", "usoactividadcodigo", "i.pk = t.ctramite"); + //estado + SubQuery estado= new SubQuery("TgeneCatalogDetail","description","estadoSolicitud","i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(estado); + + dto.addSubQuery(snumerodocumento); + dto.addSubQuery(snombre); + dto.addSubQuery(identificationcatalog); + dto.addSubQuery(identificationcatalogcode); + + dto.addSubQuery(codigoTramite); + dto.addSubQuery(tramitetipoautorizacion); + dto.addSubQuery(tramitetipoautorizacioncode); + dto.addSubQuery(tramitecategoria); + dto.addSubQuery(tramitecategoriacodigo); + dto.addSubQuery(tramiteusoactividad); + dto.addSubQuery(tramiteusoactividadcodigo); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + if(this.getMfilters().get("numerosolicitud")!=null){ + request.put("queryalias", "ESTADOSSOLICITUDBPMQUERY"); + request.put("codigosolicitudbpm", this.getMfilters().get("numerosolicitud")); + } + + Response resp = callerhelper.executeQuery(request); + if(resp.get("LISTASESTADOSOLICITUDBPM")!=null){ + System.out.println("------------"+resp.get("LISTASESTADOSOLICITUDBPM").toString()); + List listaEstadosSolicitud = (List)resp.get("LISTASESTADOSOLICITUDBPM"); + for (Object[] item : listaEstadosSolicitud) { + EstadosSolicitudBPM estados = new EstadosSolicitudBPM(); + estados.setActividad(item[0]!=null?item[0].toString():""); + estados.setUsuarioasignado(item[1]!=null?item[1].toString():""); + estados.setGrupoasignado(item[2]!=null?item[2].toString():""); + estados.setEstado(item[3]!=null?item[3].toString():""); + estados.setFechacreacion(item[4]!=null?(Date)item[4]:null); + estados.setFechainicio(item[5]!=null?(Date)item[5]:null); + estados.setFechacompleta(item[6]!=null?(Date)item[6]:null); + listaEstadoSolicitud.add(estados); + } + } + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + record = (TarmSolicitud) resp.get(beanalias); + super.postQuery((AbstractDataTransport) resp.get(beanalias)); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + public void fijaPersona(TcustPersonDetail persondetail) throws Exception { + if (persondetail == null) { + return; + } + record.setPersoncode(persondetail.getPk().getPersoncode()); + } + + public void fijaInicioFlujoEnNO() throws Exception { + record.setInicioFlujo("N"); + } + + public void fijaInicioFlujoEnYES() throws Exception { + record.setInicioFlujo("Y"); + } + + public static TarmSolicitud findxSolicitudCodpersona(String codigoSolicitud,String codigoPersona) { + try { + SolicitudArmasController cc = new SolicitudArmasController(); + cc.init(); + cc.recperpage = 10000; + cc.addFilter("pk", codigoSolicitud); + cc.addFilter("personcode", codigoPersona); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmSolicitud findByCSolicitud(String cSolicitud) { + try { + SolicitudArmasController cc = new SolicitudArmasController(); + cc.init(); + cc.recperpage = 10000; + cc.addFilter("pk", cSolicitud); + cc.queryDBNormal(); + if (cc.lrecord.size()>0) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + + public static List findByCTramite(String cTramite) { + try { + SolicitudArmasController cc = new SolicitudArmasController(); + cc.init(); + cc.recperpage = 10000; + cc.addFilter("ctramite", cTramite); + cc.queryDBNormal(); + if (cc.lrecord.size()>0) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * + * Metodo para encopntrar los tramites pertenecientes a una persona + * @param cPersona codigo de la persona + * @param cTramite codigo del tramite + * @return Listado de las solicitudes encontradas + */ + public static List findByPersonaCTramite(Integer cPersona, String cTramite) { + try { + SolicitudArmasController cc = new SolicitudArmasController(); + cc.init(); + cc.recperpage = 10000; + cc.addFilter("ctramite", cTramite); + cc.addFilter("personcode", String.valueOf(cPersona)); + + cc.queryDBNormal(); + if (cc.lrecord.size()>0) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + // Version del metodo querydatabase normal sin filtros adicionales + @SuppressWarnings("unchecked") + protected void queryDBNormal() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + // Subquery + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void update(TarmSolicitud bean) throws Exception{ + record=bean; + super.update(); + } + + public static TarmSolicitud find(String codigoSolicitud) { + try { + if(codigoSolicitud == null || codigoSolicitud.isEmpty()){ + return null; + } + SolicitudArmasController cc = new SolicitudArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", codigoSolicitud); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + public List getListaEstadoSolicitud() { + return listaEstadoSolicitud; + } + + public void setListaEstadoSolicitud( + List listaEstadoSolicitud) { + this.listaEstadoSolicitud = listaEstadoSolicitud; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudCambioDepositoController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudCambioDepositoController.java.netbeans-base new file mode 100644 index 0000000..7608728 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudCambioDepositoController.java.netbeans-base @@ -0,0 +1,237 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TarmSolicitudTramite. + * Se reemplaza el archivo de deposito, se filtra por el codigo de solicitud + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SolicitudCambioDepositoController extends AbstractController { + + public SolicitudCambioDepositoController() throws Exception { + super(TarmSolicitudTramite.class); + } + + /** + * Variable que nos permite cargar el documento al Alfresco + */ + private UploadedFile uploadedFile; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "SOLICITUDDEPOSITO"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if(getMfilters().get("numerotramite")==null && + getMfilters().get("numerotramite").toString().trim().isEmpty()){ + MessageHelper.setMessageError("Ingrese el cdigo de solicitud"); + return; + } + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void update(){ + try { + String pathRuta=""; + + String xPathLocation= getRutaDocumentoSolBase(record.getXpathcomprobante()); + if(uploadedFile!=null && uploadedFile.getFileName()!=null){ + String nombreArchivo = uploadedFile.getFileName(); + if(alfrescoController.uploadFile(uploadedFile.getInputstream(),nombreArchivo, xPathLocation)){ + pathRuta=xPathLocation + "/cm:" + nombreArchivo; + record.setXpathcomprobanteorignal(record.getXpathcomprobante()); + record.setXpathcomprobante(pathRuta); + TsafeUserDetail userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + record.setUsuariocambio(userDetail.getNickname()); + super.update(); + }else{ + MessageHelper.setMessageError("Adjunte el documento"); + return; + } + }else{ + MessageHelper.setMessageError("Adjunte el documento"); + return; + } + save(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase(String xpath) { + int index = xpath.lastIndexOf('/'); + xpath = xpath.substring(0,index); + xpath = xpath+"/cm:Cambio"; + System.out.println(xpath); + return xpath; + } + + /** + * Metodo que retorna la extencion del documento que se desea subir al alfresco + */ + public String getNombre(String ruta) { + int index = ruta.lastIndexOf('/'); + if (index == -1) { + return "cambiodocumento.jpg"; + } else { + return (ruta.substring(index + 1)).replace("cm:", ""); + } + } + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en el Alfresco + */ + public void handleUpload(FileUploadEvent event){ + uploadedFile = event.getFile(); + } + + /** + * Recorta el nombre del archivo a cargarse + * @param nombre + * @return nombre recortado + */ + public String recorteNombre(String nombre){ + String fielname=nombre; + if(fielname.length()>30){ + fielname=fielname.substring(0,30)+extencionArchivo(nombre); + } + return fielname; + } + + /** + * Obtiene la extencion del archivo a cargar + * @param nombre + * @return + */ + private String extencionArchivo(String nombre){ + int pos=nombre.lastIndexOf('.'); + nombre=nombre.substring(pos); + return nombre; + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudCambioDepositoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudCambioDepositoController.java.svn-base new file mode 100644 index 0000000..7608728 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudCambioDepositoController.java.svn-base @@ -0,0 +1,237 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TarmSolicitudTramite. + * Se reemplaza el archivo de deposito, se filtra por el codigo de solicitud + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SolicitudCambioDepositoController extends AbstractController { + + public SolicitudCambioDepositoController() throws Exception { + super(TarmSolicitudTramite.class); + } + + /** + * Variable que nos permite cargar el documento al Alfresco + */ + private UploadedFile uploadedFile; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "SOLICITUDDEPOSITO"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if(getMfilters().get("numerotramite")==null && + getMfilters().get("numerotramite").toString().trim().isEmpty()){ + MessageHelper.setMessageError("Ingrese el cdigo de solicitud"); + return; + } + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void update(){ + try { + String pathRuta=""; + + String xPathLocation= getRutaDocumentoSolBase(record.getXpathcomprobante()); + if(uploadedFile!=null && uploadedFile.getFileName()!=null){ + String nombreArchivo = uploadedFile.getFileName(); + if(alfrescoController.uploadFile(uploadedFile.getInputstream(),nombreArchivo, xPathLocation)){ + pathRuta=xPathLocation + "/cm:" + nombreArchivo; + record.setXpathcomprobanteorignal(record.getXpathcomprobante()); + record.setXpathcomprobante(pathRuta); + TsafeUserDetail userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + record.setUsuariocambio(userDetail.getNickname()); + super.update(); + }else{ + MessageHelper.setMessageError("Adjunte el documento"); + return; + } + }else{ + MessageHelper.setMessageError("Adjunte el documento"); + return; + } + save(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase(String xpath) { + int index = xpath.lastIndexOf('/'); + xpath = xpath.substring(0,index); + xpath = xpath+"/cm:Cambio"; + System.out.println(xpath); + return xpath; + } + + /** + * Metodo que retorna la extencion del documento que se desea subir al alfresco + */ + public String getNombre(String ruta) { + int index = ruta.lastIndexOf('/'); + if (index == -1) { + return "cambiodocumento.jpg"; + } else { + return (ruta.substring(index + 1)).replace("cm:", ""); + } + } + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en el Alfresco + */ + public void handleUpload(FileUploadEvent event){ + uploadedFile = event.getFile(); + } + + /** + * Recorta el nombre del archivo a cargarse + * @param nombre + * @return nombre recortado + */ + public String recorteNombre(String nombre){ + String fielname=nombre; + if(fielname.length()>30){ + fielname=fielname.substring(0,30)+extencionArchivo(nombre); + } + return fielname; + } + + /** + * Obtiene la extencion del archivo a cargar + * @param nombre + * @return + */ + private String extencionArchivo(String nombre){ + int pos=nombre.lastIndexOf('.'); + nombre=nombre.substring(pos); + return nombre; + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudCertificadoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudCertificadoController.java.svn-base new file mode 100644 index 0000000..0d98f13 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudCertificadoController.java.svn-base @@ -0,0 +1,459 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.apache.commons.io.FilenameUtils; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.common.helper.Constant; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +//import com.fp.frontend.controller.pgeneral.menu.MenuController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmCertificadoFiscalia; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +/** + * Clase controladora para subir solicitudes de Certificados de Fiscalia. + * + * @author Manuel Cepeda. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SolicitudCertificadoController extends AbstractController { + +// @ManagedProperty(value = "#{menuController}") +// private MenuController menuController; + + /** + * Propiedad que premite controlar operaciones de cargar archivos al Alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * codigo de la provincia del usuario logeado + */ + private String cprovincia; + + /** + * Variable que nos permite cargar el comprobante de deposito al Alfresco + */ + private UploadedFile uploadedFile; + private TsafeUserDetail tsafeUserDetail; + private String cargado; + /** + * Deshabilita la pantalla después de grabar la solicitud + */ + private boolean deshabilitarPantalla; + /** + * Indica si el flujo ya fue iniciado, sirve para controlar que no iniciar el flujo mas de una vez. + */ + private boolean flujoiniciado; + private boolean grabarInformacion; + + + public SolicitudCertificadoController() throws Exception { + super(TarmCertificadoFiscalia.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + record = new TarmCertificadoFiscalia(); + beanalias = "CERTIFICADOFISCALIA"; + tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + record.setNrsolicitud(null); + TarmCentroControl centroControl=Utilidades.obtenerCentroControl(); + cprovincia=centroControl.getProvincecode(); + grabarInformacion = true; + flujoiniciado = true; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if(deshabilitarPantalla){ + return; + } + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("pk desc"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + if(request.containsKey("querytype")){ + request.remove("querytype"); + } + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if(lrecord != null && !lrecord.isEmpty()){ + record=lrecord.get(0); + super.postQuery(this.lrecord); + } + + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + public void next() throws Exception { + // TODO Auto-generated method stub + super.next(); + } + + @Override + public void save() { + try { + if(grabarInformacion){ + return; + } + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + uploadCertificado(); + if(tsafeUserDetail != null){ + record.setPersoncode(tsafeUserDetail.getPk().getPersoncode()); + } + Request request = callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + deshabilitarPantalla = Boolean.TRUE; + flujoiniciado = Boolean.FALSE; + grabarInformacion = Boolean.TRUE; + MessageHelper.setMessageInfo(resp); +// init(); + } else { + //MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + //MessageHelper.setMessageError(e); + } + } + + /** + * Método para el inicio de flujo + */ + public void iniciarFlujo() { + try { + if(flujoiniciado){ + return; + } + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + request.modifiedData().put("isnew", "Y"); + request.modifiedData().put("csolicitud", record.getNrsolicitud()); + request.modifiedData().put("numerosolicitud", record.getNrsolicitud()); + request.modifiedData().put("cprovincia", cprovincia); + request.modifiedData().put("xpath", record.getXpath()); + + request.setLogsolicitude(record.getNrsolicitud()); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.setShowRow(true); + + deshabilitarPantalla = Boolean.FALSE; + flujoiniciado = Boolean.TRUE; + grabarInformacion = Boolean.TRUE; + + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + " SOLICITUD: " + record.getNrsolicitud()); + +// RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + public void updateAutorizacion()throws Exception { + super.update(); + } + + /** + * Método que se ejecuta al carga edición + * @throws Exception + */ + public void loadEdit() throws Exception { +// setSelectedDocumentos(record.getDocumento().split(", ")); + } + + + @Override + public void create() throws Exception { + super.create(); + if(record != null){ + record.setFcreacion(new Date()); + if(tsafeUserDetail != null){ + TcustPersonDetail personDetail = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + if(personDetail != null){ + record.setNombresolicitante(personDetail.getName()); + } + } + try { + obtenerSecuencialSolicitud(); + } catch (Throwable e) { + e.printStackTrace(); + } + uploadedFile = null; + setCargado(Constant.STR_N); + setGrabarInformacion(true); + setFlujoiniciado(false); + } + } + + public void update(TarmCertificadoFiscalia bean) throws Exception { + record=bean; + updateAutorizacion(); + } + + public void actualizar(TarmCertificadoFiscalia arma) throws Exception{ + record=arma; + super.update(); + } + + + /** + * Permite obtener el Archivo previamente cargado en la pagina + * @param event + */ + public void handleUpload(FileUploadEvent event){ + uploadedFile = event.getFile(); + setCargado(Constant.STR_Y); + } + + + /** + * Método de carga de archivos en Alfresco + * @param event + */ + public void uploadCertificado() { + try { + if(uploadedFile != null && uploadedFile.getFileName() != null && !"".equals(uploadedFile.getFileName())){ + String xPathLocation= getRutaDocumentoCertificadoBase() + "/cm:" + record.getNrsolicitud(); + String nombreArchivo = "Certificado_01."+FilenameUtils.getExtension(uploadedFile.getFileName()); + if(alfrescoController.uploadFile(uploadedFile.getInputstream(), nombreArchivo, xPathLocation)){ + setCargado(Constant.STR_Y); + record.setXpath(xPathLocation+"/cm:"+nombreArchivo); + + } + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoCertificadoBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta = new StringBuilder("cm:Certificados"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + return ruta.toString(); + } + + + /** + * Arma la petición al core para solicitar un número de secuencial para la solicitud antes de guardarla + * @throws Throwable + */ + private void obtenerSecuencialSolicitud() throws Throwable{ + Request request = callerhelper.getRequest(); + DtoQuery dtoQuery = super.getDtoQuery(true); + HashMap mapQuery = new HashMap(); + mapQuery.put(beanalias, dtoQuery); + request.put("querytype", "T"); + request.setQueryTables(mapQuery); + Response response = callerhelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(response); + }else{ + getRecord().setNrsolicitud(response.get("SECUENCIALCERTIFICADOFISCAL").toString()); + } + } + + + /** + * Metodod que devuelve un CertificadoFiscalia por el codigo de solicitud + * @param codigoSolicitud + * @return TarmCertificadoFiscalia + */ + public static TarmCertificadoFiscalia findPorSolicitud(String codigoSolicitud) { + try { + if(codigoSolicitud==null || codigoSolicitud.isEmpty()){ + return null; + } + SolicitudCertificadoController cc = new SolicitudCertificadoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("nrsolicitud", codigoSolicitud); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + @Override + public void update() throws Exception{ + grabarInformacion = Boolean.FALSE; + flujoiniciado = Boolean.TRUE; + deshabilitarPantalla = Boolean.TRUE; + super.update(); + } + +// public MenuController getMenuController() { +// return menuController; +// } +// +// public void setMenuController(MenuController menuController) { +// this.menuController = menuController; +// } + + /** + * @return the uploadedFile + */ + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + /** + * @param uploadedFile the uploadedFile to set + */ + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + + /** + * @return the alfrescoController + */ + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + /** + * @param alfrescoController the alfrescoController to set + */ + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + /** + * @return the cargado + */ + public String getCargado() { + return cargado; + } + + /** + * @param cargado the cargado to set + */ + public void setCargado(String cargado) { + this.cargado = cargado; + } + + public boolean isDeshabilitarPantalla() { + return deshabilitarPantalla; + } + + public void setDeshabilitarPantalla(boolean deshabilitarPantalla) { + this.deshabilitarPantalla = deshabilitarPantalla; + } + + public boolean isFlujoiniciado() { + return flujoiniciado; + } + + public void setFlujoiniciado(boolean flujoiniciado) { + this.flujoiniciado = flujoiniciado; + } + + public String getCprovincia() { + return cprovincia; + } + + public void setCprovincia(String cprovincia) { + this.cprovincia = cprovincia; + } + + /** + * @return the grabarInformacion + */ + public boolean isGrabarInformacion() { + return grabarInformacion; + } + + /** + * @param grabarInformacion the grabarInformacion to set + */ + public void setGrabarInformacion(boolean grabarInformacion) { + this.grabarInformacion = grabarInformacion; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudController.java.svn-base new file mode 100644 index 0000000..2df6bd6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudController.java.svn-base @@ -0,0 +1,222 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmSolicitud; + +/** + * Controlador que se encarga del manejo de {@link TarmSolicitud} + * @author dcruz + * + */ +public class SolicitudController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public SolicitudController() throws Exception{ + super(TarmSolicitud.class); + } + + @PostConstruct + public void postConstruct(){ + this.init(); +// super.startQuery(); + } + + private void init(){ + this.beanalias = "SOLICITUD"; + this.recperpage = 15; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + SubQuery qryprovorigen = new SubQuery("TgeneProvince", "description", "provinciaorigen", "i.pk.countrycode = t.cpaisorigen and i.pk.provincecode=t.cprovinciaorigen"); + dto.addSubQuery(qryprovorigen); + SubQuery qryctnorigen = new SubQuery("TgeneCanton", "description", "cantonorigen", "i.pk.countrycode = t.cpaisorigen and i.pk.provincecode=t.cprovinciaorigen and i.pk.cantoncode=t.ccantonorigen"); + dto.addSubQuery(qryctnorigen); + SubQuery qryprovdest = new SubQuery("TgeneProvince", "description", "provinciadestino", "i.pk.countrycode = t.cpaisdestino and i.pk.provincecode=t.cprovinciadestino"); + dto.addSubQuery(qryprovdest); + SubQuery qryctndest = new SubQuery("TgeneCanton", "description", "cantondestino", "i.pk.countrycode = t.cpaisdestino and i.pk.provincecode=t.cprovinciadestino and i.pk.cantoncode=t.ccantondestino"); + dto.addSubQuery(qryctndest); + SubQuery qrycprovincecode = new SubQuery("TarmCentroControl", "provincecode", "provincecode", "i.pk = t.ccentrocontrol"); + dto.addSubQuery(qrycprovincecode); + //dto.setOrderby("t.nombre"); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + + public static List find() { + return null; + } + + public static List findSolicitudxPersona(String personcode) { + try{ + SolicitudController cc = new SolicitudController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("personcode",personcode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmSolicitud findSolicitudxcodsolicitud(String csolicitud) { + System.out.println("Codigo de solicitud SolicitudCOntroller.." + csolicitud); + try{ + SolicitudController cc = new SolicitudController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk",csolicitud); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para encontrar por numero de solicitud + * @param numeroSolicitud + * @return solicitud encontrada con este numero + */ + public static TarmSolicitud findSolicitudxnumerosolicitud(String numeroSolicitud) { + try{ + SolicitudController cc = new SolicitudController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("numerosolicitud",numeroSolicitud); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que obtiene una solicitud por el codigo del tramite + * @param csolicitud + * @return + */ + public static TarmSolicitud findSolicitudByCtramite(String ctramite) { + try{ + SolicitudController cc = new SolicitudController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("ctramite",ctramite); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + /** + * Find con el cual se valida una persona con una solicitud + * @param personcode + * @param csolicitud + * @return + */ + public static Boolean existeRegistroPersona(Integer personcode, String csolicitud){ + try { + SolicitudController cc = new SolicitudController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", csolicitud); + cc.addFilter("personcode",personcode.toString()); + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return true; + } + return false; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return false; + } + + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void updateSolicitud(TarmSolicitud bean) throws Exception{ + this.beanalias = "SOLICITUD"; + this.record = bean; + super.update(); + this.save(); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudGuardiasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudGuardiasController.java.svn-base new file mode 100644 index 0000000..9f264b0 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudGuardiasController.java.svn-base @@ -0,0 +1,216 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.GuardiasController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitudGuardias; + +@ManagedBean +@ViewScoped +public class SolicitudGuardiasController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public SolicitudGuardiasController() throws Exception{ + super(TarmSolicitudGuardias.class); + } + + /** + * Método que se ejecuta despues del controlador + */ + @PostConstruct + public void postConstruct() { + this.init(); + super.startQuery(); + this.getMfilters().clear(); + } + + /** + * Inicializa variables + */ + private void init() { + try { + recperpage = 300; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); +// record = new TarmSolicitudGuardias(); + beanalias = "SOLICITUDGUARDIAS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dtoQuery = super.getDtoQuery(Boolean.TRUE); + HashMap mtables = new HashMap(); + dtoQuery.setOrderby("pk.csolicitud"); + mtables.put(beanalias, dtoQuery); + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response response = this.callerhelper.executeQuery(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0){ + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(response); + } else{ + this.lrecord = (List) response.get(beanalias); + for(TarmSolicitudGuardias tarmSolicitudGuardias:this.lrecord){ + TarmGuardias guardia = new TarmGuardias(); + guardia = GuardiasController.find(String.valueOf(tarmSolicitudGuardias.getPk().getCguardia()), String.valueOf(tarmSolicitudGuardias.getPk().getCempresa())); + //tarmSolicitudGuardias.modifiedData().put("guardia",guardia!=null?guardia:new TarmGuardias()); + tarmSolicitudGuardias.modifiedData().put("nombre",guardia==null?"":guardia.getModifiedData().get("gnombre")); + tarmSolicitudGuardias.modifiedData().put("identificador",guardia==null?"":guardia.getModifiedData().get("gcedula")); + tarmSolicitudGuardias.modifiedData().put("estado",guardia==null?"":guardia.getEstado()); + tarmSolicitudGuardias.modifiedData().put("guardia",guardia==null?"":guardia.getPk()); + + } + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaseGuardia() { + try { + DtoQuery dtoQuery = super.getDtoQuery(Boolean.TRUE); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dtoQuery); + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response response = this.callerhelper.executeQuery(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0){ + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(response); + } else{ + this.lrecord = (List) response.get(beanalias); + for(TarmSolicitudGuardias tarmSolicitudGuardias:this.lrecord){ + TarmGuardias guardia = new TarmGuardias(); + guardia = GuardiasController.find(String.valueOf(tarmSolicitudGuardias.getPk().getCguardia()), String.valueOf(tarmSolicitudGuardias.getPk().getCempresa())); + //tarmSolicitudGuardias.modifiedData().put("guardia",guardia!=null?guardia:new TarmGuardias()); + tarmSolicitudGuardias.modifiedData().put("nombre",guardia==null?"":guardia.getModifiedData().get("gnombre")); + tarmSolicitudGuardias.modifiedData().put("identificador",guardia==null?"":guardia.getModifiedData().get("gcedula")); + tarmSolicitudGuardias.modifiedData().put("estado",guardia==null?"":guardia.getModifiedData().get("estado")); + + } + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Retorna guardias en base a un criterio + * @param solicitudCode código de la solicitud + * @return + */ + public List findPorSolicitud(String solicitudCode) { + try { + SolicitudGuardiasController cc = new SolicitudGuardiasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.csolicitud", solicitudCode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Devuelve todas las solicitudes encontradas + * @return + */ + public static List find() { + try { + SolicitudGuardiasController cc = new SolicitudGuardiasController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + @Override + public void save() { + try { + DtoSave dtoSave = super.getDtoSave(); + dtoSave.setReturnpk(Boolean.TRUE); + if(!dtoSave.pendingProcess()){ + return; + } + HashMap msaves = new HashMap(); + msaves.put(beanalias, dtoSave); + Request request = callerhelper.getRequest(); + request.setSaveTables(msaves); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para el inicio de flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("pk.csolicitud", "1"); + request.modifiedData().put("csolicitud", "1"); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudRequisitosController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudRequisitosController.java.svn-base new file mode 100644 index 0000000..9cb838b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudRequisitosController.java.svn-base @@ -0,0 +1,313 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.event.ActionEvent; + +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang.StringUtils; +import org.primefaces.event.FileUploadEvent; + +import com.fp.common.helper.Constant; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.RequisitoPorTipoTramiteController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmRequisitoPorTipoTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitos; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitosKey; + +/** + * Clase controladora del bean TarmSolicitud. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SolicitudRequisitosController extends AbstractController { + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + private Boolean auxBotonVerificacion; + + public SolicitudRequisitosController() throws Exception { + super(TarmSolicitudRequisitos.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 100; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "REQUISITOPORTIPOTRAMITE"; + auxBotonVerificacion=Boolean.FALSE; + this.create(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + // dto.setOrderby("t.nombre"); + + SubQuery subNombre= new SubQuery + ("TarmRequisito","nombre", "nombre", "i.pk = t.pk.crequisito"); + + dto.addSubQuery(subNombre); + SubQuery subDesCorta= new SubQuery + ("TarmRequisito","descripcioncorta", "descripcion", "i.pk = t.pk.crequisito"); + + dto.addSubQuery(subDesCorta); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + public void fijaSolicitud(String csolicitud) throws Exception { + if (csolicitud == null) { + return; + } + record.getPk().setCsolicitud(csolicitud); + } + + public void consultaPorTipoTramite(String ctipotramite) throws Exception { + if (record == null) { + super.create(); + } + List lrequisitos = RequisitoPorTipoTramiteController.find(ctipotramite); + for (TarmRequisitoPorTipoTramite obj : lrequisitos) { + TarmSolicitudRequisitosKey key = new TarmSolicitudRequisitosKey(); + key.setCrequisito(obj.getPk().getCrequisito()); + // key.setCtipotramite(obj.getPk().getCtipotramite()); + TarmSolicitudRequisitos sol = new TarmSolicitudRequisitos(); + sol.setPk(key); + sol.modifiedData.put("nrequisito", obj.modifiedData.get("nrequisito")); + sol.setCargado("N"); + lrecord.add(sol); + } + } + + /** + * Retorna la ruta de documento base en donde se almacenará dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta=new StringBuilder("cm:Solicitudes"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + return ruta.toString(); + } + + + /** + * guarda actualiza el numero de documentos subidos a alfresco + */ + public void guardarRegistro(ActionEvent event) { + System.out.println("Actualizo la fila requisito"); + System.out.println(event.getComponent().getAttributes().get("xPathLocation")); + record.setCargado(Constant.STR_Y); + } + + public static List find(String codigoSolicitud) { + try { + SolicitudRequisitosController cc = new SolicitudRequisitosController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.csolicitud", codigoSolicitud); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + /** + * Método para manejar el evento change en el CheckBox + * @throws Exception + */ + public void onActualizar(TarmSolicitudRequisitos bean) throws Exception { + record=bean; + update(); + } + + /** + * Método para manejar el evento change en el CheckBox + * @throws Exception + */ + public void onChangeAprobado(TarmSolicitudRequisitos principal) throws Exception { + if (principal.getEstadovalidacion()==null || principal.getEstadovalidacion().equals("N")) { + principal.setEstadovalidacion("Y"); + } else { + principal.setEstadovalidacion("N"); + } + record=principal; + update(); + validaiones(); + } + + public void validaiones() { + auxBotonVerificacion= Boolean.TRUE; + for(TarmSolicitudRequisitos item:lrecord){ + if(item.getEstadovalidacion()==null || item.getEstadovalidacion().equals("N")){ + auxBotonVerificacion =Boolean.FALSE; + return; + } + } + } + + /** + * Método de carga de archivos en Alfresco + * @param event + */ + public void uploadRequisitos(FileUploadEvent event) { + TarmSolicitudRequisitos solicitudRequisitos = null; + try { + String xPathLocation = (String) event.getComponent().getAttributes().get("xPathLocation"); + solicitudRequisitos = (TarmSolicitudRequisitos) event.getComponent().getAttributes().get("record"); + String nombreArchivo = "Documento_"+obtieneNombreLimpio(solicitudRequisitos.getModifiedData().get("crequisito") != null ? solicitudRequisitos.getModifiedData().get("crequisito").toString():"")+"."+FilenameUtils.getExtension(event.getFile().getFileName()); + if(solicitudRequisitos != null + && alfrescoController.uploadFile(event.getFile().getInputstream(), + nombreArchivo, + xPathLocation)){ + solicitudRequisitos.setCargado(Constant.STR_Y); + solicitudRequisitos.setXpathrequisito(xPathLocation+"/cm:"+nombreArchivo); + this.record = solicitudRequisitos; + this.record.setIsnew(Boolean.FALSE); + this.update(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Reemplazo un string los caracteres en blanco y reemplazo caracteres especiales + * @param toConvert + * @return la cadena convertida + */ + private String obtieneNombreLimpio(String toConvert){ + return StringUtils.replaceEach(StringUtils.deleteWhitespace(toConvert), + new String[]{"\u00e1","\u00e9","\u00ed","\u00f3","\u00fa","\u00c1","\u00c9","\u00cd","\u00d3","\u00da","\u00F1","\u00d1"}, + new String[]{"a","e","i","o","u","A","E","I","O","U","n","N"}); + } + + /** + * Entrega el valor de: alfrescoController + * + * @return AlfrescoController + */ + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + /** + * Fija el valor de: alfrescoController + * + * @param alfrescoController Valor a fijar en el atributo. + */ + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public Boolean getAuxBotonVerificacion() { + return auxBotonVerificacion; + } + + public void setAuxBotonVerificacion(Boolean auxBotonVerificacion) { + this.auxBotonVerificacion = auxBotonVerificacion; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudTramiteController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudTramiteController.java.svn-base new file mode 100644 index 0000000..2e4038e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/SolicitudTramiteController.java.svn-base @@ -0,0 +1,277 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.apache.commons.httpclient.methods.GetMethod; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pentaho.PentahoController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SolicitudTramiteController extends AbstractController { + + /** + * Constructor + * @throws Exception + */ + public SolicitudTramiteController() throws Exception { + super(TarmSolicitudTramite.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "SOLICITUDTRAM"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + + SubQuery subqueryestadosolicitud= new SubQuery("TarmSolicitud","estado","estadoSolicitud","i.pk=t.pk.csolicitud"); + dto.addSubQuery(subqueryestadosolicitud); + + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + if(getMfilelds().get("cargadeposito")!=null){ + Filter filtro= new Filter(); + filtro.setSql(getMfilelds().get("cargadeposito").toString()); + dto.addFiltro(filtro); + } + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + public void updateSolicitud(TarmSolicitudTramite bean) throws Exception{ + this.setRecord(bean); + super.update(); + } + + /** + * Metod para actualizar registro + * @param bean + * @throws Exception + */ + public void updateSimple(TarmSolicitudTramite bean) throws Exception{ + try { + this.record = bean; + super.update(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Metod para crear un nuevo registro y poner en la lista new + * @param bean + * @throws Exception + */ + public void update(TarmSolicitudTramite bean) throws Exception{ + super.create(); + record.getPk().setCsolicitud(bean.getPk().getCsolicitud()); + record.getPk().setCtramite(bean.getPk().getCtramite()); + record.setNumerotramite(bean.getNumerotramite()); + record.setValorapagar(bean.getValorapagar()); + record.setValorcustodios(bean.getValorcustodios()); + record.setValortramitearmas(bean.getValortramitearmas()); + record.setValormulta(bean.getValormulta()); + record.setEstadotramite(bean.getEstadotramite()); + record.setEstadotramitecodigo(bean.getEstadotramitecodigo()); + super.update(); + } + + public static TarmSolicitudTramite findByCSolicitud(String csolicitud) { + try { + SolicitudTramiteController cc = new SolicitudTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.csolicitud", csolicitud); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmSolicitudTramite findByNumTramite(String numerotramite) { + try { + SolicitudTramiteController cc = new SolicitudTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("numerotramite", numerotramite); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmSolicitudTramite findByNumeroTramiteCarga(String numerotramite) { + try { + SolicitudTramiteController cc = new SolicitudTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("numerotramite", numerotramite); + cc.getMfilelds().put("cargadeposito", "numerocomprobante is null ");//and csolicitud =" + //+ "(select o.pk from TarmSolicitud o where o.estado='APB' and o.pk=(select p.numerotramite from TarmSolicitudTramite p where p.numerotramite='"+numerotramite+"'))");// + cc.querydatabase(); + if (cc.lrecord != null && cc.lrecord.size()>0) { + if(codigoParametro("ACEPTADO").equals(cc.lrecord.get(0).getModifiedData().get("estadoSolicitud"))){//"APB" + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Método para obtener los codigos de la tabla de parametros + * @return codigoAceptado + * @throws Exception + */ + private static String codigoParametro(String codigo) throws Exception { + TgeneParameters f = ParametersController.find(codigo, "1");//APB ESTADOSOLICITUD + return f.getTextvalue(); + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + protected void querydatabaseNumeroComprobante() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + Filter filtro = new Filter(); + filtro.setSql("(t.estadotramite<>'ANU' AND t.estadotramite<>'ANUDEP')"); + dto.addFiltro(filtro); + SubQuery subqueryestadosolicitud= new SubQuery("TarmSolicitud","estado","estadoSolicitud","i.pk=t.pk.csolicitud"); + dto.addSubQuery(subqueryestadosolicitud); + + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static List findByNumeroComprobante(String numComprobante) { + try { + SolicitudTramiteController cc = new SolicitudTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("numerocomprobante", numComprobante); + cc.querydatabaseNumeroComprobante(); + return cc.lrecord; + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/TarmSolicitudArmasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/TarmSolicitudArmasController.java.svn-base new file mode 100644 index 0000000..668e614 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/TarmSolicitudArmasController.java.svn-base @@ -0,0 +1,234 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class TarmSolicitudArmasController extends AbstractController { + + String csolicitud; + String aprobada; + String porDevolucion; + + private List lArmas=new ArrayList(); + + public TarmSolicitudArmasController() throws Exception { + super(TarmSolicitudArmas.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + private void init() { + try { + recperpage = 100; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "TARMSOLICITUDARMASCONTROLLER"; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + + if (csolicitud!=null) { + dto.addFiltro(new Filter("pk.csolicitud",csolicitud)); + } + + if(porDevolucion!=null){ + dto.addFiltro(new Filter("pordevolucion",porDevolucion)); + } + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + + lArmas.clear(); + + //Obteniendo los datos de las armas + for(TarmSolicitudArmas solicitudArmas:lrecord){ + TarmArmas tarmArma = new TarmArmas(); + tarmArma = ArmasController.findPorCodigo(solicitudArmas.getPk().getCarma()); + lArmas.add(tarmArma); + solicitudArmas.modifiedData().put("clase", tarmArma==null || tarmArma.getModifiedData().get("clase")==null?"":tarmArma.getModifiedData().get("clase")); + solicitudArmas.modifiedData().put("tipo", tarmArma==null || tarmArma.getModifiedData().get("tipo")==null?"":tarmArma.getModifiedData().get("tipo")); + solicitudArmas.modifiedData().put("calibre", tarmArma==null || tarmArma.getModifiedData().get("calibre")==null?"":Utilidades.formatearDecimalesEnTexto(tarmArma.getModifiedData().get("calibre").toString(), "#.000")); + solicitudArmas.modifiedData().put("modelo", tarmArma==null || tarmArma.getModelo()==null || tarmArma.getModelo().isEmpty()?"":tarmArma.getModelo()); + solicitudArmas.modifiedData().put("marca",tarmArma==null || tarmArma.getMarca()==null || tarmArma.getMarca().isEmpty() || tarmArma.getMarcacodigo()==null || tarmArma.getMarcacodigo().isEmpty()?"":CatalogDetailController.findxCodigoCodcatalogo( tarmArma.getMarca(), tarmArma.getMarcacodigo()).getDescription()); + solicitudArmas.modifiedData().put("color",tarmArma==null || tarmArma.getColor()==null || tarmArma.getColor().isEmpty() || tarmArma.getColorcodigo()==null || tarmArma.getColorcodigo().isEmpty()?"":CatalogDetailController.findxCodigoCodcatalogo( tarmArma.getColor(), tarmArma.getColorcodigo()).getDescription()); + solicitudArmas.modifiedData().put("carma",tarmArma==null?"":tarmArma.getPk()); + solicitudArmas.modifiedData().put("seriecannon",tarmArma==null || tarmArma.getSeriecanon()==null || tarmArma.getSeriecanon().isEmpty()?"":tarmArma.getSeriecanon()); + solicitudArmas.modifiedData().put("estado", tarmArma==null || tarmArma.getEstado()==null || tarmArma.getEstado().isEmpty() || tarmArma.getEstadocodigo()==null || tarmArma.getEstadocodigo().isEmpty()?"":CatalogDetailController.findxCodigoCodcatalogo( tarmArma.getEstado(), tarmArma.getEstadocodigo()).getDescription()); + solicitudArmas.modifiedData().put("cantidad",tarmArma==null || tarmArma.getCantidad()==null?"":tarmArma.getCantidad()); + solicitudArmas.modifiedData().put("unidadmedida",tarmArma==null || tarmArma.getUnidadmedidacantidad()==null?"":tarmArma.getUnidadmedidacantidad()); + solicitudArmas.modifiedData().put("lote",tarmArma==null || tarmArma.getLote()==null?"":tarmArma.getLote()); + solicitudArmas.modifiedData().put("modelo",tarmArma==null || tarmArma.getModelo()==null?"":tarmArma.getModelo()); + solicitudArmas.modifiedData().put("peso",tarmArma==null || tarmArma.getPeso()==null?"":tarmArma.getPeso()); + } + + + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private void querydatabaseCountArmas() { + try { + DtoQuery dto = super.getDtoQuery(true); + HashMap mtables = new HashMap(); + mtables.put("TARMSOLICITUDARMASCONTROLLER", dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get("TARMSOLICITUDARMASCONTROLLER"); + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static List findPorSolicitud(Integer personcode) { + try { + TarmSolicitudArmasController cc = new TarmSolicitudArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("personcode", personcode.toString()); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * M\u00e9todo para calcular el n\u00famero de armas de una solicitud. Recibe codigo de solicitud + * @param cSolicitud + * */ + public static Integer getNumeroArmasPorSolicitud(String cSolicitud){ + TarmSolicitudArmasController solicitudArmasController; + try { + solicitudArmasController = new TarmSolicitudArmasController(); + solicitudArmasController.addFilter("pk.csolicitud", cSolicitud); + solicitudArmasController.setRecperpage(15000); + solicitudArmasController.querydatabaseCountArmas(); + return solicitudArmasController.lrecord.size(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return 0; + } + + } + + /** + * M\u00e9todo para encontrar por solicitud + * @param solicitudCode + * @return + */ + public static List findPorCSolicitud(String solicitudCode) { + try { + TarmSolicitudArmasController cc = new TarmSolicitudArmasController(); + cc.init(); + cc.recperpage = 30000; + cc.addFilter("pk.csolicitud", solicitudCode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public String getAprobada() { + return aprobada; + } + + public void setAprobada(String aprobada) { + this.aprobada = aprobada; + } + + public List getlArmas() { + return lArmas; + } + + public void setlArmas(List lArmas) { + this.lArmas = lArmas; + } + + public String getPorDevolucion() { + return porDevolucion; + } + + public void setPorDevolucion(String porDevolucion) { + this.porDevolucion = porDevolucion; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/TarmSolicitudDocumentoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/TarmSolicitudDocumentoController.java.svn-base new file mode 100644 index 0000000..5c34a12 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/TarmSolicitudDocumentoController.java.svn-base @@ -0,0 +1,415 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +@ManagedBean +@ViewScoped +public class TarmSolicitudDocumentoController extends AbstractController { + + List documentos; +// String csolicitud; + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddressController; + + public TarmSolicitudDocumentoController() throws Exception { + super(TarmSolicitudDocumento.class); + // TODO Auto-generated constructor stub + } + + /** + * + */ + private static final long serialVersionUID = -1407102577264256543L; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta +// super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "DOCUMENTOSCONTROLLER"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + //Quemando el codigo de solicitud +// this.csolicitud="1"; + + DtoQuery dto = this.getDtoQuery(); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(lrecord!=null && !lrecord.isEmpty()){ + for (TarmSolicitudDocumento doc : lrecord) { + doc.put("seleccionado", Boolean.FALSE); + } + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private DtoQuery getDtoQuery() throws Exception{ + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + SubQuery subQueryNumeroDoc = new SubQuery("TarmDocumentoHabilitante", "numerodocumento", "numerodocumento", "i.pk=t.pk.cdocumento"); + dto.addSubQuery(subQueryNumeroDoc); + SubQuery subQueryFechaEmision = new SubQuery("TarmDocumentoHabilitante", "fechaemision", "fechaemision", "i.pk=t.pk.cdocumento"); + dto.addSubQuery(subQueryFechaEmision); + SubQuery subQueryFechaExpiracion = new SubQuery("TarmDocumentoHabilitante", "fechaexpiracion", "fechaexpiracion", "i.pk=t.pk.cdocumento"); + dto.addSubQuery(subQueryFechaExpiracion); + // + SubQuery subQueryTipoTramite= new SubQuery("TgeneCatalogDetail","description","tipoTramite" ,"i.pk.catalog= (select o.tipotramite from TarmTramite o where o.pk=(select p.ctramite from TarmDocumentoHabilitante p where p.pk=t.pk.cdocumento )) " + + " and i.pk.catalogcode=(select o.tipotramitecodigo from TarmTramite o where o.pk=(select p.ctramite from TarmDocumentoHabilitante p where p.pk=t.pk.cdocumento ))"); + dto.addSubQuery(subQueryTipoTramite); + SubQuery subQueryTramite= new SubQuery("TgeneCatalogDetail","description","tramite" ,"i.pk.catalog= (select o.tipoautorizacion from TarmTramite o where o.pk=(select p.ctramite from TarmDocumentoHabilitante p where p.pk=t.pk.cdocumento )) " + + " and i.pk.catalogcode=(select o.tipoautorizacioncodigo from TarmTramite o where o.pk=(select p.ctramite from TarmDocumentoHabilitante p where p.pk=t.pk.cdocumento ))"); + dto.addSubQuery(subQueryTramite); + SubQuery subQueryCategoria= new SubQuery("TgeneCatalogDetail","description","categoria" ,"i.pk.catalog= (select o.categoria from TarmTramite o where o.pk=(select p.ctramite from TarmDocumentoHabilitante p where p.pk=t.pk.cdocumento )) " + + " and i.pk.catalogcode=(select o.categoriacodigo from TarmTramite o where o.pk=(select p.ctramite from TarmDocumentoHabilitante p where p.pk=t.pk.cdocumento ))"); + dto.addSubQuery(subQueryCategoria); + SubQuery subQueryUsoActivid = new SubQuery("TgeneCatalogDetail","description","usoactividad","i.pk.catalog= (select o.usoactividad from TarmTramite o where o.pk=(select p.ctramite from TarmDocumentoHabilitante p where p.pk=t.pk.cdocumento )) " + + " and i.pk.catalogcode=(select o.usoactividadcodigo from TarmTramite o where o.pk=(select p.ctramite from TarmDocumentoHabilitante p where p.pk=t.pk.cdocumento ))"); + dto.addSubQuery(subQueryUsoActivid); + + SubQuery subQueryEstado = new SubQuery("TgeneCatalogDetail","description","estado","i.pk.catalog= (select p.estado from TarmDocumentoHabilitante p where p.pk=t.pk.cdocumento ) " + + " and i.pk.catalogcode=(select p.estadocode from TarmDocumentoHabilitante p where p.pk=t.pk.cdocumento )"); + dto.addSubQuery(subQueryEstado); +// SubQuery subQueryFechaEmision = new SubQuery("TarmDocumentoHabilitante","fechaemision","fechaemision","i.pk=t.pk.cdocumento"); +// dto.addSubQuery(subQueryFechaEmision); +// SubQuery subQueryFechaCaducidad = new SubQuery("TarmDocumentoHabilitante","fechaexpiracion","fechaexpiracion","i.pk=t.pk.cdocumento"); +// dto.addSubQuery(subQueryFechaCaducidad); + //arma + SubQuery subcodigoArma= new SubQuery("TarmArmas","pk","carma" ,"i.pk= (select p.carma from TarmDocumentoHabilitante p where p.pk=t.pk.cdocumento)"); + dto.addSubQuery(subcodigoArma); + + SubQuery subQueryClase= new SubQuery("TgeneCatalogDetail","description","clase" ,"i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=(select q.carma from TarmDocumentoHabilitante q where q.pk=t.pk.cdocumento))) " + + " and i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=(select q.carma from TarmDocumentoHabilitante q where q.pk=t.pk.cdocumento))) "); + dto.addSubQuery(subQueryClase); + SubQuery subQueryTipo= new SubQuery("TgeneCatalogDetail","description","tipoarmaexplosivo" ,"i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=(select q.carma from TarmDocumentoHabilitante q where q.pk=t.pk.cdocumento))) " + + " and i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=(select q.carma from TarmDocumentoHabilitante q where q.pk=t.pk.cdocumento))) "); + dto.addSubQuery(subQueryTipo); + SubQuery subQueryMarca= new SubQuery("TarmArmas","marca","marca" ,"i.pk=(select q.carma from TarmDocumentoHabilitante q where q.pk=t.pk.cdocumento) "); + dto.addSubQuery(subQueryMarca); + + SubQuery subQueryCalibre= new SubQuery("TgeneCatalogDetail","description","calibre" ,"i.pk.catalog= (select o.calibre from TarmTipoArmaExplosivo o where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=(select q.carma from TarmDocumentoHabilitante q where q.pk=t.pk.cdocumento))) " + + " and i.pk.catalogcode=(select o.calibrecodigo from TarmTipoArmaExplosivo o where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=(select q.carma from TarmDocumentoHabilitante q where q.pk=t.pk.cdocumento))) "); + dto.addSubQuery(subQueryCalibre); + + SubQuery subQueryLote= new SubQuery("TarmArmas","lote","lote" ,"i.pk=(select q.carma from TarmDocumentoHabilitante q where q.pk=t.pk.cdocumento) "); + dto.addSubQuery(subQueryLote); + return dto; + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + + + /** + * Devueleve el tipo de tramite de un documento + * @param documento + * @return + */ + public String tipoTramite(TarmSolicitudDocumento documento){ + String tipo=""; + String codigoSolicitud; + try { + TarmDocumentoHabilitante documentoHabilitante= DocumentoHabilitanteController.find(String.valueOf(documento.getPk().getCdocumento())); + codigoSolicitud = documentoHabilitante.getCsolicitud(); + + //Obteniendo la solicitud + TarmSolicitud solicitud= SolicitudArmasController.find(codigoSolicitud); + + if(solicitud!=null){ + TarmTramite tramite=TarmTramiteController.find(solicitud.getCtramite().toString()); + if(tramite!=null && tramite.getTipotramite()!=null && !tramite.getTipotramite().isEmpty() + && tramite.getTipotramitecodigo()!=null && !tramite.getTipotramitecodigo().isEmpty()){ + TgeneCatalogDetail catalogoTipoTramite= CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + if(catalogoTipoTramite!=null){ + tipo=catalogoTipoTramite.getDescription(); + } + } + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + return tipo; + } + + public String tramite(TarmSolicitudDocumento documento) { + String tipo=""; + String codigoSolicitud; + try { + TarmDocumentoHabilitante documentoHabilitante= DocumentoHabilitanteController.find(String.valueOf(documento.getPk().getCdocumento())); + codigoSolicitud = documentoHabilitante.getCsolicitud(); + //Obteniendo la solicitud + TarmSolicitud solicitud= SolicitudArmasController.find(codigoSolicitud); + + if(solicitud!=null){ + TarmTramite tramite=TarmTramiteController.find(solicitud.getCtramite().toString()); + if(tramite!=null && tramite.getTipoautorizacion()!=null && !tramite.getTipoautorizacion().isEmpty() + && tramite.getTipoautorizacioncodigo()!=null && !tramite.getTipoautorizacioncodigo().isEmpty()){ + TgeneCatalogDetail catalogoTramite= CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + if(catalogoTramite!=null){ + tipo=catalogoTramite.getDescription(); + } + } + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + return tipo; + } + + /** + * Devueleve la categoria de un documento + * @param documento + * @return + */ + public String categoria(TarmSolicitudDocumento documento){ + String categoria=""; + String codigoSolicitud; + try { + TarmDocumentoHabilitante documentoHabilitante= DocumentoHabilitanteController.find(String.valueOf(documento.getPk().getCdocumento())); + codigoSolicitud = documentoHabilitante.getCsolicitud(); + //Obteniendo la solicitud + TarmSolicitud solicitud= SolicitudArmasController.find(codigoSolicitud); + + if(solicitud!=null){ + TarmTramite tramite=TarmTramiteController.find(solicitud.getCtramite().toString()); + if(tramite!=null && tramite.getCategoria()!=null && !tramite.getCategoria().isEmpty() + && tramite.getCategoriacodigo()!=null && !tramite.getCategoriacodigo().isEmpty()){ + TgeneCatalogDetail catalogoCategoria= CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + if(catalogoCategoria!=null){ + categoria=catalogoCategoria.getDescription(); + } + } + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + return categoria; + } + + /** + * Devueleve la categoria de un documento + * @param documento + * @return + */ + public String usoActividad(TarmSolicitudDocumento documento){ + String usoActividad=""; + String codigoSolicitud; + try { + TarmDocumentoHabilitante documentoHabilitante= DocumentoHabilitanteController.find(String.valueOf(documento.getPk().getCdocumento())); + codigoSolicitud = documentoHabilitante.getCsolicitud(); + //Obteniendo la solicitud + TarmSolicitud solicitud= SolicitudArmasController.find(codigoSolicitud); + + if(solicitud!=null){ + TarmTramite tramite=TarmTramiteController.find(solicitud.getCtramite().toString()); + if(tramite!=null && tramite.getUsoactividad()!=null && !tramite.getUsoactividad().isEmpty() + && tramite.getUsoactividadcodigo()!=null && !tramite.getUsoactividadcodigo().isEmpty()){ + TgeneCatalogDetail catalogoUso= CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + if(catalogoUso!=null){ + usoActividad=catalogoUso.getDescription(); + } + } + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + return usoActividad; + } + + /** + * Devueleve la categoria de un documento + * @param documento + * @return + */ + public String ubicacion(TarmSolicitudDocumento documento){ + String ubicacion=""; + try { + //Obteniendo el documento habilitante + TarmDocumentoHabilitante documentoHabilitante=DocumentoHabilitanteController.find(documento.getPk().getCdocumento().toString()); + + TcustPersonDetail detallesPersona=PersonDetailController.find(String.valueOf(documentoHabilitante.getPersoncode().toString())); + + if(detallesPersona!=null){ + String tipoDireccion=""; + + switch(detallesPersona.getIdentificationcatalog()){ + case "CED": + tipoDireccion = "1"; + break; + case "RUC": + tipoDireccion= "2"; + break; + default: + tipoDireccion= ""; + break; + } + + // personAddressController.findPersonaPorDireccionTipoCatalogo(String.valueOf(documentoHabilitante.getPersoncode()), tipoDireccion); + personAddressController.findPrincipal(String.valueOf(documentoHabilitante.getPersoncode())) ; + if(personAddressController.getLprovinces()!=null && !personAddressController.getLprovinces().isEmpty()){ + ubicacion=personAddressController.getLprovinces().get(0).getDescription(); + } + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + return ubicacion; + } + + /** + * Devuelve las armas de un documento + * @param documento + * @return + */ + public TarmArmas armas(TarmSolicitudDocumento documento){ + try { + TarmDocumentoHabilitante documentoHabilitante=DocumentoHabilitanteController.find(documento.getPk().getCdocumento().toString()); + return ArmasController.findPorCodigo(documentoHabilitante.getCarma()); + }catch (Exception e) { + return null; + } + } + + /** + * M\u00e9todo para encontrar por solicitud + * @param solicitudCode + * @return List + */ + public static List findPorSolicitud(String solicitudCode) { + try { + TarmSolicitudDocumentoController cc = new TarmSolicitudDocumentoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.csolicitud", solicitudCode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public List getDocumentos() { + return documentos; + } + + public void setDocumentos(List documentos) { + this.documentos = documentos; + } + + public PersonAddressController getPersonAddressController() { + return personAddressController; + } + + public void setPersonAddressController( + PersonAddressController personAddressController) { + this.personAddressController = personAddressController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/TarmSolicitudTramiteController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/TarmSolicitudTramiteController.java.svn-base new file mode 100644 index 0000000..c8abc55 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/TarmSolicitudTramiteController.java.svn-base @@ -0,0 +1,282 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.context.FacesContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +public class TarmSolicitudTramiteController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 3067036498159997318L; + + private static TsafeUserDetail tsafeUserDetailUsuario = null; + + private static TarmCentroControl centroControl = null; + + + + + protected TarmSolicitudTramiteController() throws Exception { + super(TarmSolicitudTramite.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + super.getMfilters().clear(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "TARMSOLICITUDTRAMITECONTROLLER"; + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + this.centroControl = new TarmCentroControl(); + this.create(); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk desc"); + Filter f=new Filter(); + if(this.getMfilelds().get("tramites")!=null){ + f.setSql(this.getMfilelds().get("tramites").toString()); + dto.addFiltro(f); + } + + SubQuery qry2 = new SubQuery("TgeneCatalogDetail", "description", "tipotramitedesc", + "i.pk.catalog = (select a.tipoautorizacion from TarmTramite a where a.pk = t.pk.ctramite) "// t.pk.csolicitud + + " and " + + "i.pk.catalogcode = (select a.tipoautorizacioncodigo from TarmTramite a where a.pk = t.pk.ctramite)"); + dto.addSubQuery(qry2); + + SubQuery qry3 = new SubQuery("TgeneCatalogDetail", "description", "categoriadesc", + "i.pk.catalog = (select a.categoria from TarmTramite a where a.pk = t.pk.ctramite) "// t.pk.csolicitud + + " and " + + "i.pk.catalogcode = (select a.categoriacodigo from TarmTramite a where a.pk = t.pk.ctramite)"); + dto.addSubQuery(qry3); + + SubQuery qry4 = new SubQuery("TgeneCatalogDetail", "description", "usodesc", + "i.pk.catalog = (select a.usoactividad from TarmTramite a where a.pk = t.pk.ctramite) "// t.pk.csolicitud + + " and " + + "i.pk.catalogcode = (select a.usoactividadcodigo from TarmTramite a where a.pk = t.pk.ctramite)"); + dto.addSubQuery(qry4); + + SubQuery qry5 = new SubQuery("TcustPersonDetail", "identification", "cedula", + "i.pk.personcode = (select a.personcode from TarmSolicitud a where a.pk = t.pk.csolicitud) and i.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(qry5); + + SubQuery qry6 = new SubQuery("TcustPersonDetail", "name", "nombre", + "i.pk.personcode = (select a.personcode from TarmSolicitud a where a.pk = t.pk.csolicitud) and i.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(qry6); + + SubQuery qry7 = new SubQuery("TcustPersonDetail", "pk.personcode", "personcode", + "i.pk.personcode = (select a.personcode from TarmSolicitud a where a.pk = t.pk.csolicitud) and i.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(qry7); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void cambiarEstado(String estadoTramite,String estadoTramiteCodigo){ + record.setEstadotramite(estadoTramite); + record.setEstadotramitecodigo(estadoTramiteCodigo); + } + + @Override + public void save() { + try { + update(); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private static String obtenerCentroControl() throws Exception { + + tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if(tcustPersonAddres == null){ + return null; + } + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + + public static TarmSolicitudTramite findPorCtramite(String ctramite) { + try { + TarmSolicitudTramiteController cc = new TarmSolicitudTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.ctramite", ctramite); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findPorCodigoTramite(String ctramite) { + try { + TarmSolicitudTramiteController cc = new TarmSolicitudTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.ctramite", ctramite); + cc.querydatabase(); + if (cc.record != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmSolicitudTramite findPorCSolicitud(String csolicitud) { + try { + if(csolicitud==null || csolicitud.isEmpty()){ + return null; + } + TarmSolicitudTramiteController cc = new TarmSolicitudTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.csolicitud", csolicitud); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + public static TarmSolicitudTramite findPorCSolicitudYCTramite(String csolicitud,String ctramite) { + try { + TarmSolicitudTramiteController cc = new TarmSolicitudTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.csolicitud", csolicitud); + cc.addFilter("pk.ctramite", ctramite); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findTramites() { + try { + TarmSolicitudTramiteController cc = new TarmSolicitudTramiteController(); + cc.init(); + cc.recperpage = 30000000; + obtenerCentroControl(); + cc.addField("tramites", " ctramite in (select b.pk from TarmTramite b where b.tipoautorizacion = 1 and b.categoria = 14) and estadotramite in ('APB','FIN') and csolicitud in (select a.pk from TarmSolicitud a where a.ccentrocontrol = '"+centroControl.getPk()+"') and csolicitud in (select d.csolicitud from TarmDocumentoHabilitante d where d.estado = 'APR' )" + + " AND EXISTS(SELECT ARM FROM TarmSolicitudArmas solarm, TarmArmas arm WHERE solarm.pk.csolicitud = t.pk.csolicitud AND solarm.pk.carma = arm.pk AND arm.lote is null)"); + cc.querydatabase(); + if (cc.record != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/TarmTramiteController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/TarmTramiteController.java.svn-base new file mode 100644 index 0000000..9020417 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/TarmTramiteController.java.svn-base @@ -0,0 +1,594 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class TarmTramiteController extends AbstractController { + + public TarmTramiteController() throws Exception { + super(TarmTramite.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "TARMTRAMITECONTROLLER"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + + //Tipo de tramite + SubQuery subqueryTipoTramite= new SubQuery("TgeneCatalogDetail","description","tipotramite","i.pk.catalog=t.tipotramite and i.pk.catalogcode=t.tipotramitecodigo"); + dto.addSubQuery(subqueryTipoTramite); + + SubQuery subqueryTramite= new SubQuery("TgeneCatalogDetail","description","tipoautorizacion","i.pk.catalog=t.tipoautorizacion and i.pk.catalogcode=t.tipoautorizacioncodigo"); + dto.addSubQuery(subqueryTramite); + + //Uso/Actividad + SubQuery subqueryUsoActividad= new SubQuery("TgeneCatalogDetail","description","usoactividad","i.pk.catalog=t.usoactividad and i.pk.catalogcode=t.usoactividadcodigo"); + dto.addSubQuery(subqueryUsoActividad); + + //Categoria + SubQuery subqueryCategoria= new SubQuery("TgeneCatalogDetail","description","categoria","i.pk.catalog=t.categoria and i.pk.catalogcode=t.categoriacodigo"); + dto.addSubQuery(subqueryCategoria); + + /* + //No. Tramite + SubQuery subqueryNoTramite= new SubQuery("TarmSolicitudTramite","numerotramite","numerotramite","i.pk.ctramite=t.pk"); + dto.addSubQuery(subqueryNoTramite); + + //Codigo de solicitud + SubQuery subqueryCSolicitud= new SubQuery("TarmSolicitudTramite","pk.csolicitud","csolicitud","i.pk.ctramite=t.pk"); + dto.addSubQuery(subqueryCSolicitud); + + //No. Documento + SubQuery subqueryNoDocumento= new SubQuery("TarmDocumentoHabilitante","numerodocumento","nodocumento","i.ctramite=t.pk"); + dto.addSubQuery(subqueryNoDocumento); + + //Fecha emision + SubQuery subqueryFechaEmision= new SubQuery("TarmDocumentoHabilitante","fechaemision","fechaemision","i.ctramite=t.pk"); + dto.addSubQuery(subqueryFechaEmision); + + //Fecha expiracion + SubQuery subqueryFechaExpiracion= new SubQuery("TarmDocumentoHabilitante","fechaexpiracion","fechaexpiracion","i.ctramite=t.pk"); + dto.addSubQuery(subqueryFechaExpiracion); + */ + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + + //Tipo de autorizacion + if(record.getTipoautorizacion()!=null && !record.getTipoautorizacion().isEmpty() + && record.getTipoautorizacioncodigo()!=null && !record.getTipoautorizacioncodigo().isEmpty()){ + TgeneCatalogDetail tipoAturizacion=CatalogDetailController.findxCodigoCodcatalogo(record.getTipoautorizacion(), record.getTipoautorizacioncodigo()); + if(tipoAturizacion!=null){ + record.getModifiedData().put("tipoautorizacion", tipoAturizacion.getDescription()); + } + } + + //Poniendo el nombre de la persona al tramite + if(record.getModifiedData().get("csolicitud")!=null){ + TarmSolicitud solicitud=SolicitudController.findSolicitudxcodsolicitud(record.getModifiedData().get("csolicitud").toString()); + if(solicitud!=null){ + TcustPersonDetail detallesPersona=PersonDetailController.find(solicitud.getPersoncode().toString()); + if(detallesPersona!=null){ + record.getModifiedData().put("nombre", detallesPersona.getName()); + } + } + } + + } + super.postQuery(lrecord); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Query por criterios de tramite + */ + protected void querydatabaseCriteriosTramite(String tipoAutorizacion, String tipoTramiteCodigo, String tipoTramiteCodigo2) { + try { + DtoQuery dto = super.getDtoQuery(true); + + Filter tipoTramiteFiltro= new Filter(); +/* if(tipoAutorizacion!=null){ + cc.addFilter("tipoautorizacion", tipoAutorizacion); + } +*/ + tipoTramiteFiltro.setSql("t.tipoautorizacion = " + tipoAutorizacion + " and (t.tipotramite = " + tipoTramiteCodigo + " or t.tipotramite = " + tipoTramiteCodigo2 + ")" ); + + dto.addFiltro(tipoTramiteFiltro); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + + //Tipo de autorizacion + if(record.getTipoautorizacion()!=null && !record.getTipoautorizacion().isEmpty() + && record.getTipoautorizacioncodigo()!=null && !record.getTipoautorizacioncodigo().isEmpty()){ + TgeneCatalogDetail tipoAturizacion=CatalogDetailController.findxCodigoCodcatalogo(record.getTipoautorizacion(), record.getTipoautorizacioncodigo()); + if(tipoAturizacion!=null){ + record.getModifiedData().put("tipoautorizacion", tipoAturizacion.getDescription()); + } + } + + //Poniendo el nombre de la persona al tramite + if(record.getModifiedData().get("csolicitud")!=null){ + TarmSolicitud solicitud=SolicitudController.findSolicitudxcodsolicitud(record.getModifiedData().get("csolicitud").toString()); + if(solicitud!=null){ + TcustPersonDetail detallesPersona=PersonDetailController.find(solicitud.getPersoncode().toString()); + if(detallesPersona!=null){ + record.getModifiedData().put("nombre", detallesPersona.getName()); + } + } + } + + } + super.postQuery(lrecord); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Query por criterios de tramite + */ + protected void querydatabaseCriteriosTramite(String tipoAutorizacion) { + try { + DtoQuery dto = super.getDtoQuery(true); + + Filter tipoTramiteFiltro= new Filter(); + + tipoTramiteFiltro.setSql("t.tipotramitecodigo = 'TIPOTRAMITE' and t.tipoautorizacion = " + tipoAutorizacion); + + dto.addFiltro(tipoTramiteFiltro); + + SubQuery stipoAutorizacion= new SubQuery + ("TgeneCatalogDetail", "description", "tipotramite", "i.pk.catalog=t.tipotramite and i.pk.catalogcode=t.tipotramitecodigo and t.tipotramitecodigo = 'TIPOTRAMITE'"); + + dto.addSubQuery(stipoAutorizacion); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + + lrecord = (List) resp.get(beanalias); + + + + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + + //Tipo de autorizacion + if(record.getTipoautorizacion()!=null && !record.getTipoautorizacion().isEmpty() + && record.getTipoautorizacioncodigo()!=null && !record.getTipoautorizacioncodigo().isEmpty()){ + TgeneCatalogDetail tipoAturizacion=CatalogDetailController.findxCodigoCodcatalogo(record.getTipoautorizacion(), record.getTipoautorizacioncodigo()); + if(tipoAturizacion!=null){ + record.getModifiedData().put("tipoautorizacion", tipoAturizacion.getDescription()); + } + } + + //Poniendo el nombre de la persona al tramite + if(record.getModifiedData().get("csolicitud")!=null){ + TarmSolicitud solicitud=SolicitudController.findSolicitudxcodsolicitud(record.getModifiedData().get("csolicitud").toString()); + if(solicitud!=null){ + TcustPersonDetail detallesPersona=PersonDetailController.find(solicitud.getPersoncode().toString()); + if(detallesPersona!=null){ + record.getModifiedData().put("nombre", detallesPersona.getName()); + } + } + } + + } + super.postQuery(lrecord); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Query por criterios de tramite + */ + protected void querydatabaseCriteriosTramite(String tipoAutorizacion, String tipoTramite) { + try { + DtoQuery dto = super.getDtoQuery(true); + + Filter tipoTramiteFiltro= new Filter(); + + tipoTramiteFiltro.setSql("t.tipotramitecodigo = 'TIPOTRAMITE' and t.tipoautorizacion = " + tipoAutorizacion); + + dto.addFiltro(tipoTramiteFiltro); + + SubQuery stipoAutorizacion= new SubQuery + ("TgeneCatalogDetail", "description", "tipotramite", "i.pk.catalog=t.tipotramite and i.pk.catalogcode=t.tipotramitecodigo and t.tipotramitecodigo = 'TIPOTRAMITE'"); + + dto.addSubQuery(stipoAutorizacion); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + + lrecord = (List) resp.get(beanalias); + + + + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + + //Tipo de autorizacion + if(record.getTipoautorizacion()!=null && !record.getTipoautorizacion().isEmpty() + && record.getTipoautorizacioncodigo()!=null && !record.getTipoautorizacioncodigo().isEmpty()){ + TgeneCatalogDetail tipoAturizacion=CatalogDetailController.findxCodigoCodcatalogo(record.getTipoautorizacion(), record.getTipoautorizacioncodigo()); + if(tipoAturizacion!=null){ + record.getModifiedData().put("tipoautorizacion", tipoAturizacion.getDescription()); + } + } + + //Poniendo el nombre de la persona al tramite + if(record.getModifiedData().get("csolicitud")!=null){ + TarmSolicitud solicitud=SolicitudController.findSolicitudxcodsolicitud(record.getModifiedData().get("csolicitud").toString()); + if(solicitud!=null){ + TcustPersonDetail detallesPersona=PersonDetailController.find(solicitud.getPersoncode().toString()); + if(detallesPersona!=null){ + record.getModifiedData().put("nombre", detallesPersona.getName()); + } + } + } + + } + super.postQuery(lrecord); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + protected void querydatabaseDesaduanizacion() { + try { + DtoQuery dto = super.getDtoQuery(true); + + //Tipo de tramite + SubQuery subqueryTipoTramite= new SubQuery("TgeneCatalogDetail","description","tipotramite","i.pk.catalog=t.tipotramite and i.pk.catalogcode=t.tipotramitecodigo"); + dto.addSubQuery(subqueryTipoTramite); + + //Uso/Actividad + SubQuery subqueryUsoActividad= new SubQuery("TgeneCatalogDetail","description","usoactividad","i.pk.catalog=t.usoactividad and i.pk.catalogcode=t.usoactividadcodigo"); + dto.addSubQuery(subqueryUsoActividad); + + //Categoria + SubQuery subqueryCategoria= new SubQuery("TgeneCatalogDetail","description","categoria","i.pk.catalog=t.categoria and i.pk.catalogcode=t.categoriacodigo"); + dto.addSubQuery(subqueryCategoria); + + /* + //No. Tramite + SubQuery subqueryNoTramite= new SubQuery("TarmSolicitudTramite","numerotramite","numerotramite","i.pk.ctramite=t.pk"); + dto.addSubQuery(subqueryNoTramite); + + //Codigo de solicitud + SubQuery subqueryCSolicitud= new SubQuery("TarmSolicitudTramite","pk.csolicitud","csolicitud","i.pk.ctramite=t.pk"); + dto.addSubQuery(subqueryCSolicitud); + + //Estado tramite + SubQuery subqueryEstado= new SubQuery("TarmSolicitudTramite","estadotramite","estadotramite","i.pk.ctramite=t.pk"); + dto.addSubQuery(subqueryEstado); + + //No. Documento + SubQuery subqueryNoDocumento= new SubQuery("TarmDocumentoHabilitante","numerodocumento","nodocumento","i.ctramite=t.pk"); + dto.addSubQuery(subqueryNoDocumento); + + //Fecha emision + SubQuery subqueryFechaEmision= new SubQuery("TarmDocumentoHabilitante","fechaemision","fechaemision","i.ctramite=t.pk"); + dto.addSubQuery(subqueryFechaEmision); + + //Fecha expiracion + SubQuery subqueryFechaExpiracion= new SubQuery("TarmDocumentoHabilitante","fechaexpiracion","fechaexpiracion","i.ctramite=t.pk"); + dto.addSubQuery(subqueryFechaExpiracion); + */ + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + + } + super.postQuery(lrecord); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + protected void querydatabaseSimple() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + + } + super.postQuery(lrecord); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Entrega una lista de requisitos. + * + * @return List + */ + public static TarmTramite find(String ctramite) { + try { + TarmTramiteController cc = new TarmTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", ctramite); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para buscar tramite por criterios de busqueda + * @param tipoAutorizacion el codigo del tipo de autorizacion + * @return el registro de tramite encontrado + */ + public static List findPorCriteriosTramite(String tipoAutorizacion) { + try { + TarmTramiteController cc = new TarmTramiteController(); + cc.init(); + cc.recperpage = 30000; + + cc.querydatabaseCriteriosTramite(tipoAutorizacion); + + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para buscar tramite por criterios de busqueda + * @param tipoTramite el codigo del tipo de tramite + * @param tipoTramite2 otro codigo de tipo de tramite + * @param tipoAutorizacion el codigo del tipo de autorizacion + * @return el registro de tramite encontrado + */ + public static List findPorCriteriosTramite(String tipoTramite, String tipoTramite2, String tipoAutorizacion) { + try { + TarmTramiteController cc = new TarmTramiteController(); + cc.init(); + cc.recperpage = 30000; + + cc.querydatabaseCriteriosTramite(tipoAutorizacion, tipoTramite, tipoTramite2); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Entrega una lista de requisitos. + * + * @return List + */ + public static TarmTramite findSimple(String ctramite) { + try { + TarmTramiteController cc = new TarmTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", ctramite); + cc.querydatabaseSimple(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca tramites para desaduanizacion + */ + public static List findTramitesDesaduanizar() { + try { + TarmTramiteController cc = new TarmTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("tipoautorizacion", "1"); + cc.addFilter("categoria", "14"); + //cc.addFilter("usoactividad", "27"); + cc.querydatabaseDesaduanizacion(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/TramiteArmasController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/TramiteArmasController.java.netbeans-base new file mode 100644 index 0000000..fdd13c8 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/TramiteArmasController.java.netbeans-base @@ -0,0 +1,2788 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.annotation.PostConstruct; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.PredicateUtils; +import org.apache.commons.collections.TransformerUtils; +import org.apache.commons.lang.StringUtils; +import org.primefaces.context.RequestContext; +import org.primefaces.event.SelectEvent; + +import com.fp.common.helper.Constant; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.eval.EvaluacionController; +import com.fp.frontend.controller.armas.funcionalidad.CargaController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.lov.CargasLovController; +import com.fp.frontend.controller.armas.parametros.BuscarTramiteLovController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.ClaseLovController; +import com.fp.frontend.controller.armas.parametros.GuardiasController; +import com.fp.frontend.controller.armas.parametros.OrigenTramiteController; +import com.fp.frontend.controller.armas.parametros.RequisitoPorTramiteController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PeopleController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.PersonPhoneController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.controller.pgeneral.safe.UserDetailController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.CommonTransformer; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.frontend.utility.Utilidades; +import com.fp.frontend.webservices.snap.cedula.ClienteCedula; +import com.fp.frontend.webservices.snap.ruc.ClienteRUC; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmOrigenTramite; +import com.fp.persistence.parmas.param.TarmRequisitoPorTipoTramite; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.parmas.soli.TarmSolicitudGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitos; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitosKey; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +import ec.gob.registrocivil.consultacedula.Cedula; +import ec.gov.sri.wsconsultacontribuyente.Contribuyente; + +/** + * Clase controladora de ingreso de tramites de control de armas. + * + * @author Jorge Vaca. + * @author dcruz + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class TramiteArmasController extends AbstractController { + + private Boolean mostrarFiltroAUCP = Boolean.FALSE; + + private String filterAUCP; + + /** + *Responsable de centro de control + */ + private TcustPersonDetail responsableCentroControl= null; + /** + * Detalle de Usuarios + */ + private TsafeUserDetail tsafeUserDetailUsuario = null; + /** + *Referencia al Centro de control; + */ + private TarmCentroControl centroControl = new TarmCentroControl(); + /** + *Nombre de la Institucion + */ + private String nombreInstitucion; + /** + * Lista de tipos de persona. + */ + private List ltipopersona; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de identificación + */ + private List ltipoidenti; + + /** + * Lista de tipos de trámite. + */ + private List ltipotramite; + + /** + * Lista de origen de adquisición + */ + private List lorigenadquisicion; + + /** + * Lista de provincias + */ + private List lprovincias; + + /** + * Lista de cantones de origen + */ + private List lcantonOrigen; + + /** + * Lista de cantones de destino + */ + private List lcantonDestino; + /** + * Longitud de la identificacion de una persona. + */ + private Integer longitudid; + + /** + * Indica si se debe activar la pestana de ingresar requisitos + */ + private boolean ingresarRequisitos; + + /** + * Indica si se debe activar la pestana de seleccionar armas + */ + private boolean seleccionarArmas; + + /** + * Indica si se debe activar la pestana seleccionar guardias + */ + private boolean seleccionarGuardias; + + /** + * Indica si se debe activar la pestana seleccionar agencias + */ + private boolean seleccionarAgencias; + + /** + * Indica si se debe activar la pestana listar guardias + */ + private boolean listarDocumentos; + + /** + * Atributo para activar el keyFilter + */ + private boolean activarRegExIdentificacion; + + /** + * Indica si el flujo ya fue iniciado, sirve para controlar que no iniciar el flujo mas de una vez. + */ + private boolean flujoiniciado = false; + + private boolean esaprobacion = false; + + /** + * Deshabilita la pantalla después de grabar la solicitud + */ + private boolean deshabilitarPantalla; + + /** + * Muestra el botón de ingreso de armas + */ + private boolean mostrarIngresoArmas; + /** + * codigo de la persona que hace la solicitud + */ + private Integer cpersona = 0; + /** + * Atributo que oculpa botones del flujo + */ + private boolean ocultarBotonInicioFlujo = true; + + /** + * Fecha actual + */ + private Date fechaActual = new Date(); + + + private String csolicitud; + + /** + * Bandera de tipo booleano para indicar si se ha grabado el reporte generado + * */ + private Boolean isEnableGrabar; + /** + * Trámite seleccionado + */ + private TarmTramite tarmTramite; + + /** + * Habilita campos en actualización de datos generales + */ + private boolean actualizaDatosGenerales; + + /** + * Aprueba si es guía de libre tránsito + */ + private boolean guiaLibreTransito; + + /** + * Lista Personas vendedoreas + */ + private Set listaPersonasDetailVen; + /** + * Vendedor seleccionado + */ + private Integer selecionaCodigoVendedor; + + /** + * Controlador de login + */ + @ManagedProperty(value = "#{loginController}") + private LoginController login; + + /** + * Controlador que maneja el usuario + */ + @ManagedProperty(value = "#{userDetailController}") + private UserDetailController detalleusuario; + + /** + * Controlador que maneja las armas dentro de la solicitud + */ + @ManagedProperty(value = "#{solicitudArmasController}") + private SolicitudArmasController solicitud; + + /** + * Controlador que maneja cargas para previa importacion + */ + @ManagedProperty(value = "#{cargaController}") + private CargaController cargaController; + + /** + * Controlador que maneja la persona + */ + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController detallepersona; + + /** + * Controlador que maneja los datos de personas naturales + */ + @ManagedProperty(value = "#{peopleController}") + private PeopleController natural; + + /** + * Controlador que maneja direcciones de la persona + */ + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController direccion; + + /** + * Controlador que maneja teléfonos de la persona + */ + @ManagedProperty(value = "#{personPhoneController}") + private PersonPhoneController telefono; + + /** + * Controlador que maneja requisitos dentro de la solicitud + */ + @ManagedProperty(value = "#{solicitudRequisitosController}") + private SolicitudRequisitosController requisitos; + + /** + * Controlador que maneja los requisitos + */ + @ManagedProperty(value = "#{requisitoPorTramiteController}") + private RequisitoPorTramiteController requisitoPorTramite; + + /** + * Controlador que maneja guardias + */ + @ManagedProperty(value = "#{guardiasController}") + private GuardiasController guardias; + + /** + * Controlador que maneja los guardias en la solicitud + */ + @ManagedProperty(value = "#{solicitudGuardiasController}") + private SolicitudGuardiasController solicitudGuardias; + + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{armasController}") + private ArmasController armas; + + /** + * Controlador que maneja las armas dentro de la solicitud + */ + @ManagedProperty(value = "#{recepcionArmasController}") + private RecepcionArmasController solicitudArmas; + + /** + * Controlador que maneja registro de armas + */ + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmas; + + /** + * Controlador que maneja agencias y sucursales + */ + @ManagedProperty(value = "#{agenciaSucursalController}") + private AgenciaSucursalController agenciaSucursal; + + /** + * Controlador que maneja las agencias y sucursales dentro de la solicitud + */ + @ManagedProperty(value = "#{solicitudAgenciaSucursalController}") + private SolicitudAgenciaSucursalController solicitudAgenciaSucursal; + + /** + * Controlador que maneja los documentos habilitantes + */ + @ManagedProperty(value = "#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitante; + + /** + * Controlador que maneja los documentos dentro de la solicitud + */ + @ManagedProperty(value = "#{tarmSolicitudDocumentoController}") + private TarmSolicitudDocumentoController solicitudDocumento; + /** + * Controlador Inyectado ReportController + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + /** + * Controlador que maneja las evaluaciones de las personas + */ + @ManagedProperty(value="#{evaluacionController}") + private EvaluacionController evaluacionController; + /** + * Controlador que maneja las armas asociadas a las agencias + */ + @ManagedProperty(value="#{agenciaArmaController}") + private AgenciaArmaController agenciaArma; + + TgeneCatalogDetail tipoTramite = null ; + TgeneCatalogDetail tipoAutorizacion = null; + TgeneCatalogDetail actividad = null; + /** + * codigo de la provincia del usuario logueado + */ + private String cprovincia; + + private List centroControlList; + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List tipoDocumento; + + /** + * codigo del ruc + */ + private String codigoRuc; + /** + * codigo del ruc + */ + private String codigoCedula; + + /** + * codigo del ruc + */ + private String codigoPasaporte; + + /** + * Atributo para setear el vendedor + */ + private TcustPersonDetail tcustPersonDetailVendedor; + + public TramiteArmasController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + try { + this.init(); + ltipopersona = CatalogDetailController.find("PERSONTYPE"); + ltipoidenti = CatalogDetailController.find("IDENTIFICATION"); + ltipotramite = CatalogDetailController.find("TIPOTRAMITE"); + lprovincias = ProvinceController.find("EC"); + lorigenadquisicion = new ArrayList(); + + // Inicializa autoconsulta +// super.startQuery(); + ocultarBotonInicioFlujo = true; + isEnableGrabar = Boolean.TRUE; + if (super.getMfilters().get("pk.csolicitud") != null) { + esaprobacion = true; + } + centroControlList=CentroControlArmasController.findEstadoInst("Y","1");//Departamento + this.querydatabase(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + * @throws Exception + */ + private void init() throws Exception { + this.beanalias="SOLICITUD"; + this.responsableCentroControl = new TcustPersonDetail(); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + tipoDocumento = CatalogDetailController.find("IDENTIFICATION"); + listaPersonasDetailVen = new HashSet(); + tcustPersonDetailVendedor=null; + codigoRuc=codigos("CODIGO.RUC"); + codigoCedula=codigos("CODIGO.CEDULA"); + codigoPasaporte=codigos("CODIGO.PASAPORTE"); + this.obtenerCentroControl(); + this.obtenerResponsableCentroControl(); + } + +// public String onFlowProcess(FlowEvent event) { +// if (!flujoiniciado) { +// this.saveCabecera(); +// } +// return event.getNewStep(); +// } + + @Override + public void save() { + try { + if(deshabilitarPantalla){ + return; + } + try { + if(!noValidaDocumentoHabilitante(tipoTramite,tipoAutorizacion,actividad)){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_listardocumentos_solo")); + return; + } + } catch (Exception e) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_listardocumentos")); + return; + } + + //validamos si tcustPersonDetailPortador este lleno o si han seleccionado sin portador para asignarle el por default + if(tcustPersonDetailVendedor==null && tarmTramite.getTipoautorizacion().equals("4")){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionesinportadoroverifiqueusuarioexistentevendedor")); + return; + } + + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + solicitud.fijaPersona(detallepersona.getRecord()); + solicitud.fijaInicioFlujoEnNO(); + solicitud.update(); + + DtoSave dtosavesol = solicitud.getDtoSave(); + dtosavesol.setIsForm(true); + dtosavesol.setReturnpk(true); + dtosavesol.setPosition(1); + msave.put(solicitud.getBeanalias(), dtosavesol); // adicionar metadata de mantenimiento para cada tabla. + + DtoSave dtosavereq = requisitos.getDtoSave(); + dtosavereq.setReturnpk(true); + dtosavereq.setPosition(2); + msave.put(requisitos.getBeanalias(), dtosavereq); // adicionar metadata de mantenimiento para cada tabla. + + + request.modifiedData().put("csolicitud", solicitud.getRecord().getPk()); + request.modifiedData().put("isnew", "N"); + request.setSaveTables(msave); + + //this.setearCodigoCentroControl(); + + this.modificaDatosGenerales(); + + this.actualizaDirecciones(); + + this.actualizarTelefonos(); + + //guardias + this.copiaGuardias(); + + //armas + this.copiaArmas(); + + //agencias + this.copiaAgencias(); + + //documentos + this.copiaDocumentos(); + + //agencia armas + this.copiaAgenciaArmas(); + + if(!validacionFormulario()){ + return; + } + + //guardias + DtoSave dtosaveguardias = solicitudGuardias.getDtoSave(); + dtosaveguardias.setReturnpk(Boolean.TRUE); + dtosaveguardias.setPosition(3); + msave.put(solicitudGuardias.getBeanalias(), dtosaveguardias); + + //armas + DtoSave dtosavearmas = solicitudArmas.getDtoSave(); + dtosavearmas.setReturnpk(Boolean.TRUE); + dtosavearmas.setPosition(4); + msave.put(solicitudArmas.getBeanalias(), dtosavearmas); + + //agencias + DtoSave dtosaveagencias = solicitudAgenciaSucursal.getDtoSave(); + dtosaveagencias.setReturnpk(Boolean.TRUE); + dtosaveagencias.setPosition(5); + msave.put(solicitudAgenciaSucursal.getBeanalias(), dtosaveagencias); + + //solicitud_documentos + DtoSave dtosavedocumentos = solicitudDocumento.getDtoSave(); + dtosavedocumentos.setReturnpk(Boolean.TRUE); + dtosavedocumentos.setPosition(6); + msave.put(solicitudDocumento.getBeanalias(), dtosavedocumentos); + + //direcciones + DtoSave dtosavedirecciones = direccion.getDtoSave(); + dtosavedirecciones.setReturnpk(Boolean.TRUE); + dtosavedirecciones.setPosition(7); + msave.put(direccion.getBeanalias(), dtosavedirecciones); + + DtoSave dtosavetelefono = telefono.getDtoSave(); + dtosavetelefono.setReturnpk(Boolean.TRUE); + dtosavetelefono.setPosition(8); + msave.put(telefono.getBeanalias(), dtosavetelefono); + + DtoSave dtodatosgenerales = detallepersona.getDtoSave(); + dtodatosgenerales.setReturnpk(Boolean.TRUE); + dtodatosgenerales.setPosition(9); + msave.put(detallepersona.getBeanalias(), dtodatosgenerales); + + DtoSave dtosaveagenciaarmas = agenciaArma.getDtoSave(); + dtosaveagenciaarmas.setPosition(10); + msave.put(agenciaArma.getBeanalias(), dtosaveagenciaarmas); + + //documentoHabilitante + DtoSave dtosaveDocumentoHabilitante = documentoHabilitante.getDtoSave(); + dtosaveDocumentoHabilitante.setReturnpk(Boolean.TRUE); + dtosaveDocumentoHabilitante.setPosition(11); + msave.put(documentoHabilitante.getBeanalias(), dtosaveDocumentoHabilitante); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + managedSaveResponse(resp); + // CATEGORIA 14 PREVIA IMPORTACION + if(tarmTramite.getCategoria().equals("14")){ + asociarCargaSolicitud(); + } + MessageHelper.setMessageInfo(resp); + FacesContext context = FacesContext.getCurrentInstance(); + context.addMessage(null, new FacesMessage("RECUERDE", MsgControlArmas.getProperty("msg_recuerdeClickContinuarTramite"))); + } else { + ocultarBotonInicioFlujo = true; + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void asociarCargaSolicitud(){ + try{ + TarmCarga carga = CargaController.findByAUCP(solicitud.getRecord().getAucp()); + if(carga!=null){ + carga.setCsolicitud(solicitud.getRecord().getPk()); + cargaController.update(carga); + cargaController.save(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + public void saveInicioFlujoEnYES() { + try { + + solicitud.fijaInicioFlujoEnYES(); + solicitud.update(); + + DtoSave dtoSolicitud = solicitud.getDtoSave(); + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + msave.put(solicitud.getBeanalias(), dtoSolicitud); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + solicitud.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + private void managedSaveResponse(Response response) throws Exception{ + csolicitud = response.get("csolicitud").toString(); + solicitud.postCommit(response); + requisitos.postCommit(response); + solicitudGuardias.postCommit(response); + solicitudArmas.postCommit(response); + solicitudAgenciaSucursal.postCommit(response); + solicitudDocumento.postCommit(response); + // flujoiniciado = Boolean.TRUE; + isEnableGrabar = Boolean.FALSE; + deshabilitarPantalla = Boolean.TRUE; + solicitud.getMfilelds().put("estadoSolicitud", "REGISTRADO"); + } + + + /** + * Metodo que valida si ha sido seleccionado ams de un documento en el criterio validado + * @param tipoTramite + * @param tipoAutorizacion + * @param actividad + * @return + * @throws Exception + */ + private boolean noValidaDocumentoHabilitante(TgeneCatalogDetail tipoTramite,TgeneCatalogDetail tipoAutorizacion, TgeneCatalogDetail actividad) throws Exception{ + int count= 0 ; + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())){ + + for(TarmDocumentoHabilitante documento:documentoHabilitante.getLrecord()){ + if(documento.getModifiedData().get("seleccionado").equals(Boolean.TRUE) ){ + count++; + } + if(count>1){ + return false; + } + } + if(count==0){ + throw new Exception(MsgControlArmas.getProperty("msg_error_listardocumentos")); + + } + } + + if((tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())) || + (tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog())) || + (tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog()))) + { + //validamos si el tramite esta chequeado documentohabilitante + if(tarmTramite.getDocumentohabilitante().equals(Constant.STR_Y)){ + for(TarmDocumentoHabilitante documento:documentoHabilitante.getLrecord()){ + if(count>0){ + break; + } + + if(documento.getModifiedData().get("seleccionado").equals(Boolean.TRUE) ){ + count++; + } + } + if(count==0){ + throw new Exception(MsgControlArmas.getProperty("msg_error_listardocumentos")); + } + } + } + + return true; + } + + /** + * Actualizo datos de la persona + * @throws Exception + */ + private void modificaDatosGenerales() throws Exception{ + detallepersona.update(); + } + + /** + * Actualizo el valor de las direcciones siempre y cuando haya existido un cambio en su valor + */ + private void actualizaDirecciones(){ + TcustPersonAddress direccionPersona = null; + direccionPersona = direccion.findPrincipal(detallepersona.getRecord().getPk().getPersoncode().toString()); + + if(direccionPersona != null){ + direccion.setRecord(direccionPersona); + direccion.getRecord().setCountrycode(direccion.getMfilelds().get("solcodpais").toString()); + direccion.getRecord().setProvincecode(direccion.getMfilelds().get("solcodprovincia").toString()); + direccion.getRecord().setCantoncode(direccion.getMfilelds().get("solcodcanton").toString()); + direccion.getRecord().setCitycode(direccion.getMfilelds().get("solcodciudad").toString()); + direccion.getRecord().setParroquiacode(direccion.getMfilelds().get("solcodparroquia").toString()); + direccion.getRecord().setAddress(direccion.getMfilelds().get("soldireccion").toString()); + direccion.update(); + } + + TcustPersonAddress correo = (TcustPersonAddress) CollectionUtils.find(direccion.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getAddresstypecatalog"), PredicateUtils.equalPredicate("3"))); + if(correo != null){ + direccion.setRecord(correo); + direccion.getRecord().setAddress(direccion.getMfilelds().get("solcorreopersona").toString()); + direccion.update(); + } + } + + /** + * Actualizo los números de teléfono si es que existe un cambio + * @throws Exception + */ + private void actualizarTelefonos() throws Exception { + TcustPersonPhone telefonoLocal = null; + telefonoLocal = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(new CommonTransformer("phonetypecatalog"), PredicateUtils.equalPredicate("1"))); + TcustPersonAddress direccionPrincipal = (TcustPersonAddress) CollectionUtils.find(direccion.getLrecord(), PredicateUtils.transformedPredicate(new CommonTransformer("principal"), PredicateUtils.equalPredicate(Constant.STR_Y))); + Integer codigodireccion = direccionPrincipal != null ? direccionPrincipal.getPk().getAddressnumber() : null; + if(telefonoLocal != null){ + telefono.setRecord(telefonoLocal); + telefono.getRecord().setPhonenumber(telefono.getMfilelds().get("soltelfijo") != null ? telefono.getMfilelds().get("soltelfijo").toString() : null); + telefono.update(); + }else{ + telefono.create(); + telefono.getRecord().getPk().setPersoncode(cpersona); + telefono.getRecord().getPk().setPhonesequence(1); + telefono.getRecord().getPk().setDateto(Utilidades.getFechaExpiracion()); + telefono.getRecord().setPhonenumber(telefono.getMfilelds().get("soltelfijo") != null ? telefono.getMfilelds().get("soltelfijo").toString() : null); + telefono.getRecord().setDatefrom(new Timestamp(System.currentTimeMillis())); + telefono.getRecord().setPhonetypecatalogcode("PHONETYPE"); + telefono.getRecord().setPhonetypecatalog("1"); + telefono.getRecord().setAddressnumber(codigodireccion); + telefono.update(); + } + TcustPersonPhone telefonoCelular = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(new CommonTransformer("phonetypecatalog"), PredicateUtils.equalPredicate("2"))); + if(telefonoCelular != null){ + telefono.setRecord(telefonoCelular); + telefono.getRecord().setPhonenumber(telefono.getMfilelds().get("soltelcelular") != null ? telefono.getMfilelds().get("soltelcelular").toString() : null); + telefono.update(); + }else{ + telefono.create(); + telefono.getRecord().getPk().setPersoncode(cpersona); + telefono.getRecord().getPk().setPhonesequence(2); + telefono.getRecord().getPk().setDateto(Utilidades.getFechaExpiracion()); + telefono.getRecord().setPhonenumber(telefono.getMfilelds().get("soltelcelular") != null ? telefono.getMfilelds().get("soltelcelular").toString() : null); + telefono.getRecord().setDatefrom(new Timestamp(System.currentTimeMillis())); + telefono.getRecord().setPhonetypecatalogcode("PHONETYPE"); + telefono.getRecord().setPhonetypecatalog("2"); + telefono.getRecord().setAddressnumber(codigodireccion); + telefono.update(); + } + } + + /** + * Copia los guardias de la tabla {@link TarmGuardias} a {@link TarmSolicitudGuardias} + * @throws Exception + */ + private void copiaGuardias() throws Exception { + if(seleccionarGuardias && guardias.getLrecord() != null && !guardias.getLrecord().isEmpty()){ + for (TarmGuardias guardia : guardias.getLrecord()) { + TarmSolicitudGuardias guardiaSeleccionado = (TarmSolicitudGuardias) CollectionUtils.find(solicitudGuardias.getLrecord(), + PredicateUtils.andPredicate( + PredicateUtils.transformedPredicate(new CommonTransformer("pk.cempresa"), PredicateUtils.equalPredicate(cpersona)), + PredicateUtils.transformedPredicate(new CommonTransformer("pk.cguardia"), PredicateUtils.equalPredicate(guardia.getPk())))); + if(guardia.getModifiedData().get("seleccionado") != null && Boolean.valueOf(guardia.getModifiedData().get("seleccionado").toString())){ + if(guardiaSeleccionado == null){ + solicitudGuardias.create(); + solicitudGuardias.getRecord().getPk().setCempresa(cpersona); + solicitudGuardias.getRecord().getPk().setCguardia(guardia.getPk()); + solicitudGuardias.update(); + } + }else{ + if(guardiaSeleccionado != null){ + solicitudGuardias.setRecord(guardiaSeleccionado); + solicitudGuardias.remove(); +// solicitudGuardias.update(); + } + } + } + } + } + + /** + * Copia las armas a {@link TarmSolicitudArmas} + * @throws Exception + */ + private void copiaArmas() throws Exception { + if(seleccionarArmas && armas.getLrecord() != null && !armas.getLrecord().isEmpty()){ + for (TarmArmas arma : armas.getLrecord()) { + TarmSolicitudArmas armaSeleccionada = (TarmSolicitudArmas) CollectionUtils.find(solicitudArmas.getLrecord(), + PredicateUtils.andPredicate( + PredicateUtils.transformedPredicate(new CommonTransformer("pk.personcode"), PredicateUtils.equalPredicate(cpersona)), + PredicateUtils.transformedPredicate(new CommonTransformer("pk.carma"), PredicateUtils.equalPredicate(arma.getPk())))); + if(arma.getModifiedData().get("seleccionado") != null && Boolean.valueOf(arma.getModifiedData().get("seleccionado").toString())){ + if(armaSeleccionada == null){ + solicitudArmas.create(); + solicitudArmas.getRecord().getPk().setPersoncode(cpersona); + solicitudArmas.getRecord().getPk().setCarma(arma.getPk()); + solicitudArmas.update(); + } + }else{ + if(armaSeleccionada != null){ + solicitudArmas.setRecord(armaSeleccionada); + solicitudArmas.remove(); +// solicitudArmas.update(); + } + } + } + } + } + + /** + * Copia las agencias a {@link TarmSolicitud} + * @throws Exception + */ + private void copiaAgencias() throws Exception{ + if(seleccionarAgencias && agenciaSucursal.getLrecord() != null && !agenciaSucursal.getLrecord().isEmpty()){ + for (TarmAgenciaSucursal agencia : agenciaSucursal.getLrecord()) { + TarmSolicitudAgenciaSucursal agenciaSeleccionada = (TarmSolicitudAgenciaSucursal) CollectionUtils.find(solicitudAgenciaSucursal.getLrecord(), + PredicateUtils.transformedPredicate(new CommonTransformer("pk.cagencia"), PredicateUtils.equalPredicate(agencia.getPk()))); + if(agencia.getModifiedData().get("seleccionado") != null && Boolean.valueOf(agencia.getModifiedData().get("seleccionado").toString())){ + if(agenciaSeleccionada == null){ + solicitudAgenciaSucursal.create(); + solicitudAgenciaSucursal.getRecord().getPk().setCagencia(agencia.getPk()); + solicitudAgenciaSucursal.update(); + } + }else{ + if(agenciaSeleccionada != null){ + solicitudAgenciaSucursal.setRecord(agenciaSeleccionada); + solicitudAgenciaSucursal.remove(); +// solicitudAgenciaSucursal.update(); + } + } + } + } + } + + /** + * Copia los documentos para procesarse en la solcitud + * @throws Exception + */ + private void copiaDocumentos() throws Exception{ + if(listarDocumentos && documentoHabilitante.getLrecord() != null && !documentoHabilitante.getLrecord().isEmpty()){ + for (TarmDocumentoHabilitante docHabilitante : documentoHabilitante.getLrecord()) { + TarmSolicitudDocumento documentoSeleccionado = (TarmSolicitudDocumento) CollectionUtils.find(solicitudDocumento.getLrecord(), + PredicateUtils.transformedPredicate(new CommonTransformer("pk.cdocumento"), PredicateUtils.equalPredicate(docHabilitante.getPk()))); + if(docHabilitante.getModifiedData().get("seleccionado") != null && Boolean.valueOf(docHabilitante.getModifiedData().get("seleccionado").toString())){ + if(documentoSeleccionado == null){ + solicitudDocumento.create(); + solicitudDocumento.getRecord().getPk().setCdocumento(docHabilitante.getPk()); + solicitudDocumento.update(); + // Cambiar el centro de control del documento al centro control de armas actual + if(docHabilitante.getCentrocontrol().equalsIgnoreCase("999999")){ + docHabilitante.setCentrocontrol(centroControl.getPk()); + documentoHabilitante.update(docHabilitante); + } + } + }else{ + if(documentoSeleccionado != null){ + solicitudDocumento.setRecord(documentoSeleccionado); + solicitudDocumento.remove(); +// solicitudDocumento.update(); + } + } + } + } + } + + /** + * Copia las armas seleccionadas a la agencia seleccionada debe ejecutarse después de + * @throws Exception + */ + private void copiaAgenciaArmas() throws Exception{ + if(seleccionarAgencias){ + Long cagencia = solicitudAgenciaSucursal.getLrecord().iterator().next().getPk().getCagencia(); + for (TarmSolicitudArmas tarmSolicitudArmas : solicitudArmas.getLrecord()) { + agenciaArma.create(); + agenciaArma.getRecord().getPk().setCagencia(cagencia); + agenciaArma.getRecord().getPk().setCarma(tarmSolicitudArmas.getPk().getCarma()); + agenciaArma.update(); + } + } + } + + /** + * Valida que solo se seleccione una agencia en la solicitud + * @param event + */ + public void validaAgenciaUnica(AjaxBehaviorEvent event) { + Boolean valorComponente = (Boolean) (event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value") : null); + if(valorComponente){ + int cont = 0; + for (TarmAgenciaSucursal tarmAgenciaSucursal : agenciaSucursal.getLrecord()) { + if(tarmAgenciaSucursal.getModifiedData().get("seleccionado") != null && Boolean.parseBoolean(tarmAgenciaSucursal.getModifiedData().get("seleccionado").toString())){ + cont++; + } + if(cont > 1){ + agenciaSucursal.getLrecord().get(Integer.parseInt(event.getComponent().getAttributes().get("indiceActual").toString())).getModifiedData().put("seleccionado", Boolean.FALSE); + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_unicidad_agencia")); + break; + } + } + } + } + + /** + * Realiza las validaciones pertinentes del formulario + * @return + */ + private boolean validacionFormulario(){ + //Valido el tramite que se ha escogido un tramite + Boolean valido = Boolean.TRUE; + if(solicitud.getRecord().getCtramite() == null){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_tramite")); + valido = Boolean.FALSE; + } + if(ingresarRequisitos){ + int tamReq = requisitos.getLrecord().size(); + int tamReqSel = 0; + for (TarmSolicitudRequisitos solicitudRequisitos : requisitos.getLrecord()) { + if(solicitudRequisitos.getCargado() != null && solicitudRequisitos.getCargado().equals(Constant.STR_Y)){ + tamReqSel++; + } + } + if(tamReq==0){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_no_requisitos")); + valido = Boolean.FALSE; + }else if(tamReq != tamReqSel){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_requisitos")); + valido = Boolean.FALSE; + } + } + if(seleccionarArmas){ + //tramite autorizacion primera vez/renovacion Estableciiento de agencias Companias de vigilancia y seguridad + TgeneParameters parametro=ParametersController.find("CODIGO.TRAMITE.NOVALIDAARMAS", "1"); + ListcodigoTramiteNoValidaArma=null; + if(parametro!=null){ + codigoTramiteNoValidaArma=new ArrayList<>(); + String []arrayTramitesNoValidaArmas= parametro.getTextvalue().split(","); + for (String item : arrayTramitesNoValidaArmas) { + codigoTramiteNoValidaArma.add(Long.parseLong(item)); + } + } + + if(this.tarmTramite!= null && codigoTramiteNoValidaArma!=null && codigoTramiteNoValidaArma.contains(this.tarmTramite.getPk())){ + System.out.println("Tramite-"+this.tarmTramite.getPk()); + //pasa + }else if(solicitudArmas.getLrecord() == null || solicitudArmas.getLrecord().isEmpty()){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_armas")); + valido = Boolean.FALSE; + } else if(tarmTramite.getNumeromaxarmas() != null && tarmTramite.getNumeromaxarmas().intValue() < solicitudArmas.getLrecord().size()){ + MessageHelper.setMessageWarn(MsgControlArmas.getProperty("msg_error_maximo_armas"), tarmTramite.getNumeromaxarmas()); + valido = Boolean.FALSE; + } + } + if(seleccionarGuardias){ + if(solicitudGuardias.getLrecord() == null || solicitudGuardias.getLrecord().isEmpty()){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_guardias")); + valido = Boolean.FALSE; + } + } + if(seleccionarAgencias){ + if(solicitudAgenciaSucursal.getLrecord() == null || solicitudAgenciaSucursal.getLrecord().isEmpty()){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_agencias")); + valido = Boolean.FALSE; + } + } + if(listarDocumentos){ + if(documentoHabilitante.getLrecord() == null || documentoHabilitante.getLrecord().isEmpty()){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_noexistendocumentos")); + valido = Boolean.FALSE; + }else if(solicitudDocumento.getLrecord() == null || solicitudDocumento.getLrecord().isEmpty()){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_documento")); + valido = Boolean.FALSE; + } + } + return valido; + } + +// public void saveCabecera() { +// try { +// Request request = callerhelper.getRequest(); +// HashMap msave = new HashMap(); +// solicitud.fijaPersona(detallepersona.getRecord()); +// solicitud.update(); +// +// DtoSave dtosavesol = solicitud.getDtoSave(); +// dtosavesol.setIsForm(true); +// dtosavesol.setReturnpk(true); +// dtosavesol.setPosition(1); +// msave.put(solicitud.getBeanalias(), dtosavesol); // adicionar metadata de mantenimiento para cada tabla. +// +// request.setSaveTables(msave); +// request.modifiedData().put("csolicitud", solicitud.getRecord().getPk()); +// request.modifiedData().put("isnew", "N"); +// +// Response resp = callerhelper.executeSave(request); +// if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { +// solicitud.postCommit(resp); +// ocultarBotonInicioFlujo = false; +// MessageHelper.setMessageInfo(resp); +// } else { +// ocultarBotonInicioFlujo = true; +// MessageHelper.setMessageError(resp); +// } +// +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// } +// } + + @Override + protected void querydatabase() { + try { + if(deshabilitarPantalla){ + return; + } + detalleusuario.getMfilters().clear(); + detalleusuario.getMfilters().put("pk.usercode", login.getRequest().getUser()); + detalleusuario.addFilterDateto(); + detalleusuario.query(); + if (detalleusuario.getRecord() == null || detalleusuario.getRecord().getPk().getPersoncode() == null) { + return; + } + + cpersona = detalleusuario.getRecord().getPk().getPersoncode(); + detallepersona.getMfilters().clear(); + detallepersona.getMfilters().put("pk.personcode", cpersona.toString()); + detallepersona.addFilterDateto(); + detallepersona.query(); + + natural.getMfilters().clear(); + natural.addPersoncodeFilter(cpersona.toString()); + natural.addFilterDateto(); + natural.query(); + + direccion.getMfilters().clear(); + direccion.addPersoncodeFilter(cpersona.toString()); + direccion.addFilterDateto(); + direccion.query(); + + this.obtenerDireccionesGenerales(); + + telefono.getMfilters().clear(); + telefono.addPersoncodeFilter(cpersona.toString()); + telefono.addFilterDateto(); + telefono.query(); + + this.obtenerTelefonos(); + + this.setearDatosGenerales(); + //creamos una solicitud por default cuando se consulta por primera vez y al transaccion es 20 + if (this.getLoginController().getRequest().getTransactionModule().equals("30") && this.getLoginController().getRequest().getTransactionCode() == 20) { + solicitud.create(); + solicitud.getRecord().setFregistro(new java.sql.Date(System.currentTimeMillis())); + this.obtenerSecuencialSolicitud(); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Muestra un mensaje de error siempre y cuando sea un error de componente y se lo muestra como general + * @return + */ + public Boolean getExisteMensajesError() { + Boolean resp = Boolean.FALSE; + FacesContext facesContext = FacesContext.getCurrentInstance(); + final Iterator idComponentesMensajes = facesContext.getClientIdsWithMessages(); + while(idComponentesMensajes.hasNext()){ + String idComp = idComponentesMensajes.next(); + if(StringUtils.isNotBlank(idComp)){ + System.out.println("El id es "+idComp.replace(":", "\\\\:")); + System.out.println("$('#"+idComp.replace(":", "\\\\:")+"').focus();"); + facesContext.validationFailed(); + resp = Boolean.TRUE; + RequestContext.getCurrentInstance().execute("$('#"+idComp.replace(":", "\\\\:")+"').focus();"); + break; + } + } + return resp; + } + + /** + * En base a la provincia y sus jurisdicciones se obtiene y se coloca el centro de control + */ +// private void setearCodigoCentroControl(){ +// TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(direccion.getMfilelds().get("solcodprovincia") != null ? +// direccion.getMfilelds().get("solcodprovincia").toString() : StringUtils.EMPTY); +// if(centroControlJur != null){ +// this.solicitud.getRecord().setCcentrocontrol(centroControlJur.getCcentrocontrol()); +// } +// } + + /** + * Ingresa datos que se necesitan en arma + */ + private void setearDatosGenerales(){ + TcustPersonDetail tcustPersonDetail = PersonDetailController.find(cpersona.toString()); + armas.getMfilelds().put("numdoc", tcustPersonDetail.getIdentification()); + armas.getMfilelds().put("tipodoc", tcustPersonDetail.getIdentificationcatalog()); + } + + /** + * Arma la petición al core para solicitar un número de secuencial para la solicitud antes de guardarla + * @throws Throwable + */ + private void obtenerSecuencialSolicitud() throws Throwable{ + Request request = callerhelper.getRequest(); + DtoQuery dtoQuery = super.getDtoQuery(true); + HashMap mapQuery = new HashMap(); + mapQuery.put(beanalias, dtoQuery); + request.put("querytype", "T"); + request.setQueryTables(mapQuery); + Response response = callerhelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(response); + }else{ + solicitud.getRecord().setNumerosolicitud(response.get("SECUENCIALSOLICITUD").toString()); + } + } + + /** + * Recupera en base al tipo de identificación la dirección de la oficina o de la casa + */ + private void obtenerDireccionesGenerales(){ + TcustPersonAddress direccionPersona = null; + direccionPersona = direccion.findPrincipal(detallepersona.getRecord().getPk().getPersoncode().toString()); + + if(direccionPersona != null){ + direccion.getMfilelds().put("solcodpais", direccionPersona.getCountrycode()); + direccion.setLprovinces(ProvinceController.find(direccionPersona.getCountrycode())); + direccion.getMfilelds().put("solcodprovincia", direccionPersona.getProvincecode()); + direccion.setLcantones(CantonController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode())); + direccion.getMfilelds().put("solcodcanton", direccionPersona.getCantoncode()); + direccion.setLcities(CityController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode(), direccionPersona.getCantoncode())); + direccion.getMfilelds().put("solcodciudad", direccionPersona.getCitycode()); + direccion.setLparroquias(ParroquiaController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode(), direccionPersona.getCantoncode())); + direccion.getMfilelds().put("solcodparroquia", direccionPersona.getParroquiacode()); + direccion.getMfilelds().put("soldireccion", direccionPersona.getAddress()); + } + + TcustPersonAddress correo = (TcustPersonAddress) CollectionUtils.find(direccion.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getAddresstypecatalog"), PredicateUtils.equalPredicate("3"))); + if(correo != null){ + direccion.getMfilelds().put("solcorreopersona", correo.getAddress()); + } + } + + /** + * Retorna el telefono fijo y celular de la persona + */ + private void obtenerTelefonos(){ + TcustPersonPhone telf = null; + telf = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getPhonetypecatalog"), PredicateUtils.equalPredicate("1"))); + if(telf != null){ + telefono.getMfilelds().put("soltelfijo", telf.getPhonenumber()); + } + telf = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getPhonetypecatalog"), PredicateUtils.equalPredicate("2"))); + if(telf != null){ + telefono.getMfilelds().put("soltelcelular", telf.getPhonenumber()); + } + } + + /** + * Método para el inicio de flujo + */ + public void iniciarFlujo() { + try { + cprovincia=null; + for(TarmCentroControl centro: centroControlList){ + if(solicitud.getRecord().getCcentrocontrol().equals(centro.getPk())){ + cprovincia=centro.getProvincecode(); + } + } + ; + if(cprovincia==null || cprovincia.length()==0){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinprovincia")); + return; + } + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + + request.modifiedData().put("csolicitud", solicitud.getRecord().getPk()); + request.modifiedData().put("numerosolicitud", solicitud.getRecord().getNumerosolicitud()); + request.modifiedData().put("numerotransaccion", solicitud.getRecord().getCtramite()); + request.modifiedData().put("cprovincia", cprovincia); + request.modifiedData().put("isnew", "Y"); + + request.setLogsolicitude(solicitud.getRecord().getNumerosolicitud()); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.setShowRow(true); + flujoiniciado = true; + deshabilitarPantalla = Boolean.TRUE; + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + " SOLICITUD: " + solicitud.getRecord().getNumerosolicitud()); + saveInicioFlujoEnYES(); +// RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para el inicio de flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + + request.modifiedData().put("csolicitud", solicitud.getRecord().getPk()); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Evento que se ejecuta cuando cambia el origen de adquisición + */ + public void executeOrigenAdquisicion() { + + TarmTramite tramite = this.solicitud.getRecord().getCtramite() != null ? TarmTramiteController.find(this.solicitud.getRecord().getCtramite().toString()) : null; + if((this.solicitud.getRecord().getOrigenadquisicion() != null && this.solicitud.getRecord().getOrigenadquisicion().equals("DEC")) + || (tramite != null && tramite.getTipoautorizacion().equals("1") && tramite.getCategoria().equals("10"))){ + this.mostrarIngresoArmas = Boolean.TRUE; + } else{ + this.mostrarIngresoArmas = Boolean.FALSE; + } + } + + @Override + public void postCommit(Response response) throws Exception { + } + + /** + * Datos de control de la identificacion de la persona. + */ + public void onChangeTipoId() { + String tipoid = super.getMfilelds().get("tipoidentificacion").toString(); + switch (tipoid) { + case "CED": + longitudid = 10; + activarRegExIdentificacion = true; + break; + case "RUC": + longitudid = 13; + activarRegExIdentificacion = true; + break; + default: + longitudid = 13; + activarRegExIdentificacion = false; + break; + } + } + + /** + * Abre el LOV de trámite + */ + public void openLovTramite() { + Map> params = new HashMap>(); + List ltipopersona = new ArrayList<>(); + if(validaNumeros(detallepersona.getRecord().getIdentification())){ + if(detallepersona.getRecord().getIdentification().length()==10){ + ltipopersona.add(ParametersController.find("CODIGO.PERSONTYPE.NATURAL", "1").getTextvalue());//1 + }else{ + ltipopersona.add(ParametersController.find("CODIGO.PERSONTYPE.JURIDICA", "1").getTextvalue());//2 + } + } + params.put("tipopersonasol", ltipopersona); + BuscarTramiteLovController.openLov(params); + } + + private boolean validaNumeros(String cadena){ + Boolean aux=Boolean.FALSE; + if (cadena.matches("[0-9]*")){ + System.out.println("Es un n�mero"); + aux=Boolean.TRUE; + }else{ + System.out.println("No es un n�mero"); + aux=Boolean.FALSE; + } + return aux; + } + + /** + * Abre el LOV de la clase del arma + */ + public void openLovClase() { + Map> params = new HashMap>(); + ClaseLovController.openLov(params); + } + + /** + * Regresa del LOV de armas + * @param event + */ + public void onReturnClase(SelectEvent event) { + TgeneCatalogDetail clase = (TgeneCatalogDetail) event.getObject(); + this.armas.getRecord().getModifiedData().put("clase", clase.getDescription()); + this.armas.setClase(clase.getPk().getCatalog()); + } + + /** + * Regresa del LOV para cargar valores + * @param event {@link SelectEvent} + */ + public void onReturnTramite(SelectEvent event) { + try{ + TarmTramite tramite = (TarmTramite) event.getObject(); + this.tarmTramite = tramite; +// if(!procedeTramite(TarmTramiteController.find(tramite.getCtramitepadre() != null ? tramite.getCtramitepadre().toString() : "-1"),tramite.getPk())){ + if(!procedeTramite(tramite)){ + return; + } + if(!verificaAptitudPersona(tarmTramite)){ + return; + } + solicitud.getRecord().setCtramite(tramite.getPk()); + tipoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + tipoAutorizacion = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail categoria = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + actividad = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + this.getSolicitud().addField("tipoTramite", tipoTramite.getDescription()); + this.getSolicitud().addField("tipoAutorizacion", tipoAutorizacion.getDescription()); + this.getSolicitud().addField("categoria", categoria.getDescription()); + this.getSolicitud().addField("actividad", actividad.getDescription()); + + if(tarmTramite.getTipotramite().equals(ParametersController.find("CODIGO.TRAMITEREIMPRESION", "1").getTextvalue())){ + this.actualizaDatosGenerales = Boolean.TRUE; + } else{ + this.actualizaDatosGenerales = Boolean.FALSE; + } + + if(tarmTramite.getTipoautorizacion().equals("4")){//Guia de libre transito + this.guiaLibreTransito = Boolean.TRUE; + if(!this.actualizaDatosGenerales){ + this.actualizaDatosGenerales = Boolean.TRUE; + } + } else{ + this.guiaLibreTransito = Boolean.FALSE; + } + + this.ingresarRequisitos = Boolean.TRUE; + if(Constant.ifYes(tramite.getRegistroarmas())){ + this.seleccionarArmas = Boolean.TRUE; + this.cargaArmas(); + }else{ + this.seleccionarArmas = Boolean.FALSE; + this.solicitudArmas.clearAll(); + } + if(Constant.ifYes(tramite.getRegistroguardia())){ + this.seleccionarGuardias = Boolean.TRUE; + this.cargaGuardias(); + }else{ + this.seleccionarGuardias = Boolean.FALSE; + this.solicitudGuardias.clearAll(); + } + if(Constant.ifYes(tramite.getRegistroagenciasucursal())){ + this.seleccionarAgencias = Boolean.TRUE; + this.cargarAgencias(); + }else{ + this.seleccionarAgencias = Boolean.FALSE; + this.solicitudAgenciaSucursal.clearAll(); + } + + if(Constant.ifYes(tramite.getDocumentohabilitante()) || tipoTramite.getPk().getCatalog().equals(ParametersController.find("CODIGO.TRAMITEREIMPRESION", "1").getTextvalue())){ + this.listarDocumentos = Boolean.TRUE; + listarDocumentos(tipoTramite,tipoAutorizacion, actividad);//Se listan los documentos en el tab listar documentos + }else{ + this.listarDocumentos = Boolean.FALSE; + this.solicitudDocumento.clearAll(); + } + + if(tramite != null){ + requisitoPorTramite.getMfilters().put("pk.ctramite", tramite.getPk().toString()); + requisitoPorTramite.setRecperpage(3000000); + requisitoPorTramite.setcTramite(tramite.getPk()); + requisitoPorTramite.query(); + requisitos.clearAll();//limpio los datos del requisito anterior + for (TarmRequisitoPorTipoTramite requisitoPorTipoTramite : requisitoPorTramite.getLrecord()) { + requisitos.create(); + requisitos.getRecord().setCargado(Constant.STR_N); + requisitos.getRecord().setPk(new TarmSolicitudRequisitosKey()); + requisitos.getRecord().getPk().setCrequisito(requisitoPorTipoTramite.getPk().getCrequisito()); + requisitos.getRecord().getPk().setCtramite(tramite.getPk()); + requisitos.getRecord().getModifiedData().put("crequisito", requisitoPorTipoTramite.getModifiedData().get("crequisito")); + requisitos.getRecord().getModifiedData().put("nrequisito", requisitoPorTipoTramite.getModifiedData().get("nrequisito")); + requisitos.getRecord().getModifiedData().put("ndescripcion", requisitoPorTipoTramite.getModifiedData().get("ndescripcion")); + requisitos.update(); + } + } + + if(tarmTramite.getUsoactividad().equals("2") || tarmTramite.getUsoactividad().equals("24")){//2 AGENCIA // 24 SUCURSAL + if(agenciaSucursal!= null && agenciaSucursal.getTipoAgencias()!=null && agenciaSucursal.getTipoAgencias().size()>0){ + TgeneCatalogDetail remover=new TgeneCatalogDetail(); + agenciaSucursal.setTipoAgencias(CatalogDetailController.find("TIPOAGENCIA")); + for(TgeneCatalogDetail item:agenciaSucursal.getTipoAgencias()){ + if(!tarmTramite.getUsoactividad().equals("2")){ + if(item.getPk().getCatalog().equals(ParametersController.find("CODIGO.AGENCIA.TIPOAGENCIA", "1").getTextvalue())){//"AGE" + remover=item; + } + } + if(!tarmTramite.getUsoactividad().equals("24")){ + if(item.getPk().getCatalog().equals(ParametersController.find("CODIGO.SUCURSAL.TIPOAGENCIA", "1").getTextvalue())){//"SUC" + remover=item; + } + } + } + agenciaSucursal.getTipoAgencias().remove(remover); + } + } + + //AQUI VA EL CODIGO PARA LLENAR LAS ADQUISICION + lorigenadquisicion = null; + lorigenadquisicion = new ArrayList(); + List origenTramites = OrigenTramiteController.findOrigenTramite(tarmTramite); + if(origenTramites!=null && !origenTramites.isEmpty()){ + for (int i = 0; i < origenTramites.size(); i++) { + TarmOrigenTramite origenTramite = origenTramites.get(i); + if(origenTramite!= null && origenTramite.getPk().getOrigencatalog()!=null && origenTramite.getPk().getOrigencatalogcode() != null && + !origenTramite.getPk().getOrigencatalog().isEmpty() && !origenTramite.getPk().getOrigencatalogcode().isEmpty()){ + lorigenadquisicion.add(CatalogDetailController.findCatalogo(origenTramite.getPk().getOrigencatalogcode(), origenTramite.getPk().getOrigencatalog())); + } + } + } + } catch(Throwable e){ + MessageHelper.setMessageError(e); + } + + + } + + /** + * Metodo para listar el listado de documentos para los diferentes critesrios de seleccion + * @param tipoTramite tipo del tramite + * @param tipoAutorizacion tipo de la autorizacion + * @param actividad actividad + * @throws Exception + */ + private void listarDocumentos(TgeneCatalogDetail tipoTramite,TgeneCatalogDetail tipoAutorizacion, TgeneCatalogDetail actividad) throws Exception{ + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())){ + this.cargarDocumentos(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog()); + } + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_actualizacionDeDatos")).getPk().getCatalog())){ + this.cargarTodosDocumentosPersona(); + } + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())){ + this.cargarDocumentos(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_renovacion")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog()); + } + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog())){ + this.cargarDocumentos(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_renovacion")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog()); + } + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog())){ + this.cargarDocumentos(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_renovacion")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog()); + } + if(documentoHabilitante.getLrecord() == null || documentoHabilitante.getLrecord().isEmpty()){ + MessageHelper.setMessageWarn(MsgControlArmas.getProperty("msg_error_noexistendocumentos")); + } + } + + + /** + * Verifica si el trámite ingresado cumple la prevalidación + * TarmTramite tramite es el tramite padre validamos si este tiene codigo alterno + * Creado FPAZMINO + * @return + */ + private boolean procedeTramite(TarmTramite tramite){ + if(tramite.getCtramitepadre() == null && tramite.getCtramitepadrealt() == null){ + return Boolean.TRUE; + } + Boolean procede = Boolean.FALSE; + String msgErrorTramitePadre = ""; + //consulta del tramite padre + TarmTramite tramitePadre = TarmTramiteController.find(tramite.getCtramitepadre() != null ? tramite.getCtramitepadre().toString() : "-1"); + //consulta por tramite padre + if(tramitePadre!=null){ + Boolean debeValidarCaducidad = (tramite.getValidacaducidadpadre()!=null && tramite.getValidacaducidadpadre().equalsIgnoreCase("Y"))?true:false; + //consulta documento habilitante del codigo padre alterno + documentoHabilitante.querydatabaseDocumentosCriterioFiltro(Arrays.asList(tramitePadre), debeValidarCaducidad, cpersona.toString()); + if(documentoHabilitante.getLrecord() != null && !documentoHabilitante.getLrecord().isEmpty()){ + if(tramitePadre.getCtramitepadre() == null && tramitePadre.getCtramitepadrealt() == null){ + return Boolean.TRUE; + } + else{ + procede = procedeTramite(tramitePadre); + } + } else{ + procede = Boolean.FALSE; + msgErrorTramitePadre = MsgControlArmas.getProperty("msg_error_tramite_padre", tramitePadre.getModifiedData().get("tipotramite"), tramitePadre.getModifiedData().get("tipoautorizacion"), tramitePadre.getModifiedData().get("categoria") , tramitePadre.getModifiedData().get("usoactividad")); +// MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_tramite_padre", tramite.getModifiedData().get("tipotramite"), tramite.getModifiedData().get("tipoautorizacion"), tramite.getModifiedData().get("categoria") , tramite.getModifiedData().get("usoactividad"))); + } + } + //consulta del tramite padre alterno, seria el tramite de renovacion + TarmTramite tramitePadreAlterno =TarmTramiteController.find(tramite.getCtramitepadrealt() != null ? tramite.getCtramitepadrealt().toString() : "-1"); + //consulta por tramite padre alterno + if(tramitePadreAlterno!=null && !procede){ + Boolean debeValidarCaducidad = (tramite.getValidacaducidadpadre()!=null && tramite.getValidacaducidadpadre().equalsIgnoreCase("Y"))?true:false; + //consulta documento habilitante del codigo padre alterno + documentoHabilitante.querydatabaseDocumentosCriterioFiltro(Arrays.asList(tramitePadreAlterno), debeValidarCaducidad, cpersona.toString()); + if(documentoHabilitante.getLrecord() != null && !documentoHabilitante.getLrecord().isEmpty()){ + if(tramitePadreAlterno.getCtramitepadre() == null && tramitePadreAlterno.getCtramitepadrealt() == null){ + return Boolean.TRUE; + } + else{ + procede = procedeTramite(tramitePadreAlterno); + } + } else{ + procede = Boolean.FALSE; + msgErrorTramitePadre = MsgControlArmas.getProperty("msg_error_tramite_padre", tramitePadreAlterno.getModifiedData().get("tipotramite"), tramitePadreAlterno.getModifiedData().get("tipoautorizacion"), tramitePadreAlterno.getModifiedData().get("categoria") , tramitePadreAlterno.getModifiedData().get("usoactividad")); +// MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_tramite_padre", tramite.getModifiedData().get("tipotramite"), tramite.getModifiedData().get("tipoautorizacion"), tramite.getModifiedData().get("categoria") , tramite.getModifiedData().get("usoactividad"))); + } + } + + if(!procede && !msgErrorTramitePadre.equalsIgnoreCase("")){ + MessageHelper.setMessageInfo(msgErrorTramitePadre); + } + return procede; + } + + /** + * Verifica si la persona es apta para dicho tramite + * @param tramite + * @return + * @throws Exception + */ + private boolean verificaAptitudPersona(TarmTramite tramite) throws Exception { + boolean verificaApto = Boolean.TRUE; + if(tramite.getRequiereevaluacion() != null && tramite.getRequiereevaluacion().equals(Constant.STR_Y)){ + evaluacionController.addFilter("personcode", cpersona.toString()); + evaluacionController.addFilter("resultado", MsgControlArmas.getProperty("ctg_resultado_aprobado")); + evaluacionController.addFilter("resultadocodigo", MsgControlArmas.getProperty("ctg_resultado_codigo")); + evaluacionController.addFilter("tipoevaluacion", MsgControlArmas.getProperty("ctg_tipo_evaluacion_conocimiento")); + evaluacionController.addFilter("tipoevaluacioncodigo", MsgControlArmas.getProperty("ctg_tipo_evaluacion_codigo")); + evaluacionController.setTipoTest("CONOCIMIENTO"); + evaluacionController.query(); + if(evaluacionController.getLrecord() == null || evaluacionController.getLrecord().isEmpty()){ + verificaApto = Boolean.FALSE; + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_requiere_validacion_tecnica")); + } + evaluacionController.clearAll(); + evaluacionController.addFilter("personcode", cpersona.toString()); + evaluacionController.addFilter("resultado", MsgControlArmas.getProperty("ctg_resultado_aprobado")); + evaluacionController.addFilter("resultadocodigo", MsgControlArmas.getProperty("ctg_resultado_codigo")); + evaluacionController.addFilter("tipoevaluacion", MsgControlArmas.getProperty("ctg_tipo_evaluacion_psicologica")); + evaluacionController.addFilter("tipoevaluacioncodigo", MsgControlArmas.getProperty("ctg_tipo_evaluacion_codigo")); + evaluacionController.setTipoTest("PSICOLOGICA"); + evaluacionController.query(); + if(evaluacionController.getLrecord() == null || evaluacionController.getLrecord().isEmpty()){ + verificaApto = Boolean.FALSE; + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_requiere_validacion_psicologica")); + } + } + return verificaApto; + } + + /** + * Método en el cual se cargan los guardias de seguridad de una determina empresa + * @throws Exception + */ + private void cargaGuardias() throws Exception{ + guardias.addFilter("cempresa", this.cpersona.toString()); + guardias.addFilter("estado", "APT"); + guardias.setRecperpage(3000000); + guardias.query(); + } + + /** + * Método en el cual se cargan las armas de la persona registrada + * @throws Exception + */ + public void cargaArmas() throws Exception { + String estadosarma; + String tipoFab; + armas.setRecperpage(5000); + String fechaCaducidad=null; + estadosarma = tarmTramite.getEstados(); + tipoFab = tarmTramite.getTipofabricacion(); + if(tarmTramite.getTipoautorizacion().equals("3")){//devolucion 3 + armas.addField("sancion", Constant.STR_Y); + armas.addField("personcode", cpersona.toString()); + } + if(estadosarma != null && estadosarma.contains("REN")){ + armas.addField("TRAMITE", tarmTramite); + } + if(tipoFab != null){ + armas.addField("TIPOFABRICACION", tipoFab); + } + + if(tarmTramite.getTipotramite().equals("1")){//primera vez + if(!tarmTramite.getCategoria().equals("1") && //Categoria APERTURA + !tarmTramite.getTipoautorizacion().equals("2") && !tarmTramite.getTipoautorizacion().equals("4")){//tipoautorizacion=CERTIFICADOS 2 GUiA DE LIBRE TRaNSITO 4 + fechaCaducidad=" is null "; + } + }else if(tarmTramite.getTipotramite().equals("3")){//renovacion + fechaCaducidad=" <> null "; + }else if(tarmTramite.getTipotramite().equals("2")){//reimpresion + Date fechaActual= new Date(); + SimpleDateFormat format= new SimpleDateFormat("dd/MM/yyyy"); + fechaCaducidad=" > "+"to_date("+format.format(fechaActual+",'dd/MM/yyyy')"); + } + // CATEGORIA 14 PREVIA IMPORTACION + if(!tarmTramite.getCategoria().equals("14")){ + armas.setLrecord(armas.findxPersona(cpersona.longValue(), estadosarma, tipoFab, tarmTramite.getClase(), fechaCaducidad)); + mostrarFiltroAUCP=Boolean.FALSE; + } + else{ + armas.setLrecord(new ArrayList()); + mostrarFiltroAUCP=Boolean.TRUE; + } + // + listaPersonasDetailVen = new HashSet(); + SetlistaCodigos= new HashSet(); + for(TarmArmas arma: armas.getLrecord()){ + if(arma.getLote()==null){ + arma.setLote(" "); + } + //carga los posibles vendedoeres + if(this.guiaLibreTransito){ + System.out.println("guiaLibreTransito "+guiaLibreTransito); + ListlistaArmas=AuxArmasController.findListXCodigoArma(arma.getCodigoarma()); + if(listaArmas!=null && listaArmas.size()>0){ + for (TarmArmas tarmArmasVendedor : listaArmas) { + System.out.println("arma.getCregistro(): " +tarmArmasVendedor.getModifiedData().get("personcode")); + if(tarmArmasVendedor.getModifiedData().get("personcode")!=null && + !listaCodigos.contains(tarmArmasVendedor.getModifiedData().get("personcode").toString())){ + listaCodigos.add(tarmArmasVendedor.getModifiedData().get("personcode").toString()); + TcustPersonDetail personaDetail=PersonDetailController.find(tarmArmasVendedor.getModifiedData().get("personcode").toString()); + listaPersonasDetailVen.add(personaDetail); + + } + } + } + } + + } + System.out.println("listaPersonasDetailVen: " +listaPersonasDetailVen.size()); + + Collections.sort(armas.getLrecord(), new Comparator() { + public int compare(TarmArmas p1, TarmArmas p2) { + return p1.getLote().compareTo(p2.getLote()); + } + }); + + if(armas.getLrecord() == null || armas.getLrecord().isEmpty()){ + MessageHelper.setMessageWarn(MsgControlArmas.getProperty("msg_error_armas_inexistentes")); + } + } + + /** + * Método en el cual se cargan las agencias de la persona registrada + * @throws Exception + */ + private void cargarAgencias() throws Exception{ + agenciaSucursal.setRecperpage(3000000); + agenciaSucursal.addFilter("personcode", this.cpersona.toString()); + agenciaSucursal.query(); + // agenciaSucursal.record.fautorizacion + } + + /** + * Método en el cual se cargan los documentos habilitantes de la persona registrada + * @throws Exception + */ + private void cargarTodosDocumentosPersona(){ + try { + documentoHabilitante.setRecperpage(3000000); + documentoHabilitante.documentosXPersona(cpersona); + + } catch (Exception e) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_noexistendocumentos")); + return; + + } + } + + /** + * Método en el cual se cargan los documentos habilitantes de la persona registrada + * @throws Exception + */ + private void cargarDocumentos(String tipoTramite, String tipoTramite2, String tipoAutorizacion){ + try { + List listTramites = TarmTramiteController.findPorCriteriosTramite(tipoTramite,tipoTramite2,tipoAutorizacion); +// List listSolicitudes = new ArrayList<>(); +// for(TarmTramite tramite:listTramites){ +// List listSolicitud = SolicitudArmasController.findByPersonaCTramite(cpersona, String.valueOf(tramite.getPk())); +// if(listSolicitud!=null && !listSolicitud.isEmpty()){ +// listSolicitudes.addAll(listSolicitud); +// } +// } + if(listTramites==null || listTramites.isEmpty()){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_noexistendocumentos")); + return; + } + documentoHabilitante.setRecperpage(3000000); + documentoHabilitante.documentosXTramite(listTramites,cpersona); + } catch (Exception e) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_noexistendocumentos")); + return; + + } + } + + /** + * Se almacena las agencias en su tabla + * @throws Exception + */ + public void guardarAgencias() throws Exception { + agenciaSucursal.getRecord().setPersoncode(cpersona); + agenciaSucursal.update(); + agenciaSucursal.save(); + this.cargarAgencias(); + agenciaSucursal.setRecord(null); + } + + /** + * Elimina las agencias sucursales de la base de datos + * @throws Exception + */ + public void eliminarAgencias() throws Exception { + agenciaSucursal.remove(); + agenciaSucursal.update(); + agenciaSucursal.save(); + agenciaSucursal.setRecord(null); + } + + /** + * Guarda las armas + * @throws Exception + */ + public void guardarArmas() throws Exception { + armas.getRegistroArmas().getRecord().setPersoncode(cpersona); +// armas.getRegistroArmas().update(); +// armas.update(); + armas.saveArmaSolicitud(); + if(this.armas.isExisteTipoArmaExplosivo()){ + armas.setRecord(null); + } + } + + /** + * Elimina armas de la base de datos + * @throws Exception + */ + public void eliminarArmas() throws Exception{ + armas.remove(); + armas.update(); + armas.save(); + cargaArmas(); + armas.setRecord(null); + } + + + /** + * Datos de control de ingreso de informacion dado el tipo de tramite. + */ + public void onChangeTipoTramite() throws Exception { + String ctipotramite = solicitud.getRecord().getCcentrocontrol();//getCtipotramite(); + requisitos.consultaPorTipoTramite(ctipotramite); + } + + /** + * Cambia país + */ + public void executePais() { + if(direccion.getMfilelds().get("solcodpais") != null && StringUtils.isNotBlank(direccion.getMfilelds().get("solcodpais").toString())){ + direccion.setLprovinces(ProvinceController.find(direccion.getMfilelds().get("solcodpais").toString())); + direccion.setLcantones(new ArrayList()); + direccion.setLparroquias(new ArrayList()); + direccion.setLcities(new ArrayList()); + } + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvincia() { + if (direccion.getMfilelds().get("solcodpais") != null && StringUtils.isNotBlank(direccion.getMfilelds().get("solcodpais").toString())) { + direccion.setLcantones(CantonController.find(direccion.getMfilelds().get("solcodpais").toString(), direccion.getMfilelds().get("solcodprovincia").toString())); + direccion.setLparroquias(new ArrayList()); + direccion.setLcities(new ArrayList()); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton() { + if (direccion.getMfilelds().get("solcodpais") != null && StringUtils.isNotBlank(direccion.getMfilelds().get("solcodpais").toString())) { + direccion.setLparroquias(ParroquiaController.find(direccion.getMfilelds().get("solcodpais").toString(), direccion.getMfilelds().get("solcodprovincia").toString(), direccion.getMfilelds().get("solcodcanton").toString())); + direccion.setLcities(CityController.find(direccion.getMfilelds().get("solcodpais").toString(), direccion.getMfilelds().get("solcodprovincia").toString(), direccion.getMfilelds().get("solcodcanton").toString())); + } + } + + /** + * Cambio la provincia de origen + */ + public void cambioProvinciasOrigen() { + if(solicitud.getRecord().getCprovinciaorigen() != null){ + this.lcantonOrigen = CantonController.find("EC", solicitud.getRecord().getCprovinciaorigen()); + this.solicitud.getRecord().setCpaisorigen("EC"); + } else{ + this.lcantonOrigen.clear(); + this.solicitud.getRecord().setCpaisorigen(null); + } + } + + /** + * Cambio la provincia destino + */ + public void cambioProvinciaDestino() { + if(solicitud.getRecord().getCprovinciadestino() != null){ + this.lcantonDestino = CantonController.find("EC", solicitud.getRecord().getCprovinciadestino()); + this.solicitud.getRecord().setCpaisdestino("EC"); + } else{ + this.lcantonDestino.clear(); + this.solicitud.getRecord().setCpaisdestino(null); + } + } + + /** + * Metodo que genera el reporte + * @param fila + */ + public void imprimir(){ + boolean flagArmas = false; + boolean flagGuardias = false; + boolean flagAgencia = false; + + if(tarmTramite==null){ + MessageHelper.setMessageError("ERROR NO MANEJADO POR LA APLICACION CONTACTE AL PROVEEDOR"); + return; + } + if(tarmTramite.getRegistroguardia().equalsIgnoreCase("Y")){ + flagGuardias = true; + } + if (tarmTramite.getRegistroarmas().equalsIgnoreCase("Y")) { + flagArmas = true; + } + if (tarmTramite.getRegistroagenciasucursal().equalsIgnoreCase("Y")) { + flagAgencia = true; + } + this.reporteGeneral(csolicitud,flagAgencia,flagArmas,flagGuardias); + + FacesContext context = FacesContext.getCurrentInstance(); + context.addMessage(null, new FacesMessage("RECUERDE", MsgControlArmas.getProperty("msg_recuerdeClickContinuarTramite"))); + } + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + String institucionCentroControl=""; + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres= personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + //cprovincia=tcustPersonAddres.getProvincecode(); + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + this.centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + this.nombreInstitucion=CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + institucionCentroControl=this.nombreInstitucion; + + return institucionCentroControl; + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl(){ + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + public TarmCentroControl obtenerCentro(){ + for(TarmCentroControl centro:this.centroControlList){ + if(this.solicitud.getRecord().getCcentrocontrol().equals(centro.getPk())){ + return centro; + } + } + return null; + } + + public void reporteGeneral(String solicitud,boolean flagAgencia,boolean flagArmas,boolean flagGuardias) { + try { + querydatabase(); + String gradoUsuario =""; + String path = "armas/reports/generalReport"; + String filename="Solicitud"; + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if(grado != null){ + gradoUsuario = grado.getDescription()+" - "+this.responsableCentroControl.getName(); + }else{ + gradoUsuario = "Sin Grado - "+this.responsableCentroControl.getName(); + } + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("csolicitud", solicitud); + + //Obteniendo la solicitud + TarmSolicitud s=SolicitudController.findSolicitudxcodsolicitud(solicitud); + TarmTramite t; + Boolean datosTramiteVacios=false; + + // + if(this.obtenerCentro() != null){ + parameters.put("centroControl", this.obtenerCentro().modifiedData().get("desnombreinstitucion")); + } + + if(s!=null){ + //Obteniendo el tramite + t=TarmTramiteController.find(s.getCtramite().toString()); + + //Obteniendo la solicitud trmite + TarmSolicitudTramite st=TarmSolicitudTramiteController.findPorCSolicitud(solicitud); + + if(t!=null){ + + //No de solicitud + if(st!=null){ + parameters.put("noSolicitud", s.getNumerosolicitud()); + }else{ + parameters.put("noSolicitud", " "); + } + //No de tramite + if(st!=null){ + parameters.put("noTramite", st.getNumerotramite()); + }else{ + parameters.put("noTramite", " "); + } + + //Tipo de tramite + if(t.getModifiedData().get("tipotramite")!=null){ + parameters.put("tipoTramite", t.getModifiedData().get("tipotramite")); + }else{ + parameters.put("tipoTramite", " "); + } + + //Tipo de autorizacion + if(t.getModifiedData().get("tipoautorizacion")!=null){ + parameters.put("tipoAutorizacion", t.getModifiedData().get("tipoautorizacion")); + }else{ + parameters.put("tipoAutorizacion", " "); + } + + //Categoria + if(t.getModifiedData().get("categoria")!=null){ + parameters.put("categoria", t.getModifiedData().get("categoria")); + }else{ + parameters.put("categoria", " "); + } + + //Uso actividad + if(t.getModifiedData().get("usoactividad")!=null){ + parameters.put("usoActividad", t.getModifiedData().get("usoactividad")); + }else{ + parameters.put("usoActividad", " "); + } + + //Cabecera + if(t.getCabecera()!=null){ + parameters.put("cabecera", t.getCabecera()); + }else{ + parameters.put("cabecera", " "); + } + + }else{ + datosTramiteVacios=true; + } + }else{ + datosTramiteVacios=true; + } + + if(datosTramiteVacios){ + parameters.put("noTramite", " "); + parameters.put("tipoTramite", " "); + parameters.put("tipoAutorizacion", " "); + parameters.put("categoria", " "); + parameters.put("usoActividad", " "); + parameters.put("cabecera", " "); + } + + //Obteniendo la direccion + String email=" ",direccion=" "; + List direcciones=PersonAddressController.findAllByPersonCode(s.getPersoncode().toString()); + for (TcustPersonAddress d : direcciones) { + Calendar calendario=Calendar.getInstance(); + calendario.setTime(d.getPk().getDateto()); + if(calendario.get(Calendar.YEAR)==2999){ + if(d.getAddresstypecatalog().equalsIgnoreCase("3")){ + email=d.getAddress(); + }else if(d.getPrincipal()!=null && d.getPrincipal().equalsIgnoreCase("Y")){ + direccion=d.getAddress(); + } + } + } + + //Email + parameters.put("email", email); + + //Direccion + parameters.put("direccion", direccion); + + //Actividad Economica + TcustPersonDetail person = PersonDetailController.find(s.getPersoncode().toString()); + if(person != null && person.getEconimicact() != null){ + parameters.put("actividadeco", person.getEconimicact()); + }else { + parameters.put("actividadeco", ""); + } + + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + parameters.put("flagAgencia", flagAgencia); + parameters.put("flagArmas", flagArmas); + parameters.put("flagGuardias", flagGuardias); + //parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("usuario",PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()).getName()); + parameters.put("codResponsable", this.responsableCentroControl.getPk().getPersoncode()); + + parameters.put("codigoQR",(s!=null?s.getNumerosolicitud():solicitud)+" "+sdf.format(Calendar.getInstance().getTime())+" "+ + gradoUsuario+" "+this.nombreInstitucion); + + String format = "pdf"; + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Abre el LOV de busqueda de importaciones por codigo solicitud (AUCP) + */ + public void openCargaPrevia() { + Map> params = new HashMap<>(); + List lPersoncodeParam = new ArrayList<>(); + lPersoncodeParam.add(detallepersona.getRecord().getPk().getPersoncode().toString()); + params.put("personcode", lPersoncodeParam); + CargasLovController.openLov(params); + } + + /** + * Regresa del LOV de carga + * @param event + */ + public void onReturnCarga(SelectEvent event) { + System.out.println("Retorno del lov carga"); + TarmCarga carga = (TarmCarga) event.getObject(); + filterAUCP=carga.getAucp(); + solicitud.getRecord().setAucp(filterAUCP); + TarmRegistroArmas registro = RegistroArmController.findByCodigo(carga.getCregistro().toString()); + armas.setLrecord(ArmasController.findxRegistro(registro.getPk().toString())); + if(armas.getLrecord()==null){ + armas.setLrecord(new ArrayList()); + } + } + + /** + * Método que valida la persona vendedora + * en las tablas de maia y en la snap + * + */ + public void validarVendedor(){ + tcustPersonDetailVendedor=null; + if(selecionaCodigoVendedor==null){ + MessageHelper.setMessageError("Seleccione el vendedor"); + return; + } + tcustPersonDetailVendedor=PersonDetailController.find(selecionaCodigoVendedor.toString()); + solicitud.getRecord().setNumerodocumentoorigen(tcustPersonDetailVendedor.getIdentification()); + solicitud.getRecord().setTipodocumentoorigen(tcustPersonDetailVendedor.getIdentificationcatalog()); + solicitud.getRecord().setNombrerazonsocialorigen(tcustPersonDetailVendedor.getName()); + /* + if(solicitud.getRecord().getNumerodocumentoorigen()==null || solicitud.getRecord().getTipodocumentoorigen()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselacedulavendedor")); + return; + } + if(solicitud.getRecord().getTipodocumentoorigen().equals(codigoCedula)){ + //----------validamos si es valida la CEDULA + if(!ValidateIdentification.cedula(solicitud.getRecord().getNumerodocumentoorigen())){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalidovendedor")); + return; + } + //envia a buscar en MAIA + tcustPersonDetailVendedor=buscarPersonaMaia(solicitud.getRecord().getNumerodocumentoorigen(),solicitud.getRecord().getTipodocumentoorigen()); + if(tcustPersonDetailVendedor==null){ + //envia a buscar en la SNAP + tcustPersonDetailVendedor=buscarPersonaSnap(solicitud.getRecord().getNumerodocumentoorigen(),solicitud.getRecord().getTipodocumentoorigen()); + } + }else if(solicitud.getRecord().getTipodocumentoorigen().equals(codigoRuc)){ + //----------validamos si es valida el RUC + if(!ValidateIdentification.ruc(solicitud.getRecord().getNumerodocumentoorigen())){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalidovendedor")); + return; + } + //envia a buscar en maia + tcustPersonDetailVendedor=buscarPersonaMaia(solicitud.getRecord().getNumerodocumentoorigen(),solicitud.getRecord().getTipodocumentoorigen()); + if(tcustPersonDetailVendedor==null){ + //envia a buscar en la snap + tcustPersonDetailVendedor=buscarPersonaSnap(solicitud.getRecord().getNumerodocumentoorigen(),solicitud.getRecord().getTipodocumentoorigen()); + } + }else{ + //----------si es PASAPORTE + tcustPersonDetailVendedor=buscarPersonaMaia(solicitud.getRecord().getNumerodocumentoorigen(),solicitud.getRecord().getTipodocumentoorigen()); + if(tcustPersonDetailVendedor==null){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("mg_error_usuarionoencontradovendedor")); + tcustPersonDetailVendedor= new TcustPersonDetail(); + tcustPersonDetailVendedor.setIdentification(solicitud.getRecord().getNumerodocumentoorigen()); + tcustPersonDetailVendedor.setIdentificationcatalog(solicitud.getRecord().getTipodocumentoorigen()); + tcustPersonDetailVendedor.setIdentificationcatalogcode("IDENTIFICATION"); + tcustPersonDetailVendedor.setName(solicitud.getRecord().getNombrerazonsocialorigen()); + //solicitud.getRecord().setNombrerazonsocialorigen(null); + } + } + //validamos que existe la persona en Maia o SNAP + if(tcustPersonDetailVendedor!=null && tcustPersonDetailVendedor.getIdentification()!=null && tcustPersonDetailVendedor.getName()!=null){ + //seteamos el nombre para visualizarle + solicitud.getRecord().setNombrerazonsocialorigen(tcustPersonDetailVendedor.getName()); + }else if(!solicitud.getRecord().getTipodocumentoorigen().equals(codigoPasaporte)){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_usuarionoencontradovendedor")); + tcustPersonDetailVendedor= new TcustPersonDetail(); + solicitud.getRecord().setNombrerazonsocialorigen(null); + } + */ + } + + /** + * Método para validar si la persona existe en la BD de Maia + * @param numeroDocumento + * @param tipoDocumento + * @return TcustPersonDetail + */ + public TcustPersonDetail buscarPersonaMaia(String numeroDocumento, String tipoDocumento){ + return PersonDetailController.findxidentification(numeroDocumento,tipoDocumento); + } + + /** + * Método para obtener los codigos + */ + public String codigos(String parametro){ + TgeneParameters tgeneParameters= ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + /** + * Método para buscar a la persona en la snap + * @param documento + */ + public TcustPersonDetail buscarPersonaSnap(String documento,String tipoDocumento){ + if(tipoDocumento.equals(codigoCedula)){ + Cedula cedula= ClienteCedula.obtenerCedula(documento); + if(cedula!=null){ + TcustPersonDetail detail= new TcustPersonDetail(); + detail.setName(cedula.getNombre()); + detail.setIdentification(cedula.getCedula()); + detail.setIdentificationcatalog("CED"); + detail.setIdentificationcatalogcode("IDENTIFICATION"); + return detail; + }else{ + return null; + } + }else { + Contribuyente contribuyente= ClienteRUC.obtenerRUC(documento); + if(contribuyente!=null){ + TcustPersonDetail detail= new TcustPersonDetail(); + detail.setName(contribuyente.getRazonSocial()); + detail.setIdentification(contribuyente.getNumeroRuc()); + detail.setIdentificationcatalog("RUC"); + detail.setIdentificationcatalogcode("IDENTIFICATION"); + return detail; + }else{ + return null; + } + } + } + + /** + * Entrega el valor de: ltipopersona + * + * @return List + */ + public List getLtipopersona() { + return ltipopersona; + } + + /** + * Entrega el valor de: ltipoidenti + * + * @return List + */ + public List getLtipoidenti() { + return ltipoidenti; + } + + /** + * Entrega el valor de: ltipotramite + * + * @return List + */ + public List getLtipotramite() { + return ltipotramite; + } + + /** + * Entrega el valor de: longitudid + * + * @return Integer + */ + public Integer getLongitudid() { + return longitudid; + } + + /** + * Entrega el valor de: activarRegExIdentificacion + * + * @return boolean + */ + public boolean isActivarRegExIdentificacion() { + return activarRegExIdentificacion; + } + + /** + * Entrega el valor de: solicitud + * + * @return SolicitudArmasController + */ + public SolicitudArmasController getSolicitud() { + return solicitud; + } + + /** + * Fija el valor de: solicitud + * + * @param solicitud Valor a fijar en el atributo. + */ + public void setSolicitud(SolicitudArmasController solicitud) { + this.solicitud = solicitud; + } + + /** + * Entrega el valor de: detallepersona + * + * @return PersonDetailController + */ + public PersonDetailController getDetallepersona() { + return detallepersona; + } + + /** + * Fija el valor de: detallepersona + * + * @param detallepersona Valor a fijar en el atributo. + */ + public void setDetallepersona(PersonDetailController detallepersona) { + this.detallepersona = detallepersona; + } + + /** + * Entrega el valor de: natural + * + * @return PeopleController + */ + public PeopleController getNatural() { + return natural; + } + + /** + * Fija el valor de: natural + * + * @param natural Valor a fijar en el atributo. + */ + public void setNatural(PeopleController natural) { + this.natural = natural; + } + + /** + * Entrega el valor de: direccion + * + * @return PersonAddressController + */ + public PersonAddressController getDireccion() { + return direccion; + } + + /** + * Fija el valor de: direccion + * + * @param direccion Valor a fijar en el atributo. + */ + public void setDireccion(PersonAddressController direccion) { + this.direccion = direccion; + } + + /** + * Entrega el valor de: telefono + * + * @return PersonPhoneController + */ + public PersonPhoneController getTelefono() { + return telefono; + } + + /** + * Fija el valor de: telefono + * + * @param telefono Valor a fijar en el atributo. + */ + public void setTelefono(PersonPhoneController telefono) { + this.telefono = telefono; + } + + /** + * Entrega el valor de: requisitos + * + * @return SolicitudRequisitosController + */ + public SolicitudRequisitosController getRequisitos() { + return requisitos; + } + + /** + * Fija el valor de: requisitos + * + * @param requisitos Valor a fijar en el atributo. + */ + public void setRequisitos(SolicitudRequisitosController requisitos) { + this.requisitos = requisitos; + } + + /** + * Entrega el valor de: flujoiniciado + * + * @return boolean + */ + public boolean isFlujoiniciado() { + return flujoiniciado; + } + + /** + * Entrega el valor de: ocultarBotonInicioFlujo + * + * @return boolean + */ + public boolean isOcultarBotonInicioFlujo() { + return ocultarBotonInicioFlujo; + } + + /** + * Fija el valor de: ocultarBotonInicioFlujo + * + * @param ocultarBotonInicioFlujo Valor a fijar en el atributo. + */ + public void setOcultarBotonInicioFlujo(boolean ocultarBotonInicioFlujo) { + this.ocultarBotonInicioFlujo = ocultarBotonInicioFlujo; + } + + /** + * Entrega el valor de: esaprobacion + * + * @return boolean + */ + public boolean isEsaprobacion() { + return esaprobacion; + } + + public LoginController getLogin() { + return login; + } + + public void setLogin(LoginController login) { + this.login = login; + } + + public UserDetailController getDetalleusuario() { + return detalleusuario; + } + + public void setDetalleusuario(UserDetailController detalleusuario) { + this.detalleusuario = detalleusuario; + } + + public List getLorigenadquisicion() { + return lorigenadquisicion; + } + + public void setLorigenadquisicion(List lorigenadquisicion) { + this.lorigenadquisicion = lorigenadquisicion; + } + + public boolean isIngresarRequisitos() { + return ingresarRequisitos; + } + + public void setIngresarRequisitos(boolean ingresarRequisitos) { + this.ingresarRequisitos = ingresarRequisitos; + } + + public boolean isSeleccionarArmas() { + return seleccionarArmas; + } + + public void setSeleccionarArmas(boolean seleccionarArmas) { + this.seleccionarArmas = seleccionarArmas; + } + + public boolean isSeleccionarGuardias() { + return seleccionarGuardias; + } + + public void setSeleccionarGuardias(boolean seleccionarGuardias) { + this.seleccionarGuardias = seleccionarGuardias; + } + + public boolean isSeleccionarAgencias() { + return seleccionarAgencias; + } + + public void setSeleccionarAgencias(boolean seleccionarAgencias) { + this.seleccionarAgencias = seleccionarAgencias; + } + + public boolean isListarDocumentos() { + return listarDocumentos; + } + + public void setListarDocumentos(boolean listarDocumentos) { + this.listarDocumentos = listarDocumentos; + } + + public RequisitoPorTramiteController getRequisitoPorTramite() { + return requisitoPorTramite; + } + + public void setRequisitoPorTramite( + RequisitoPorTramiteController requisitoPorTramite) { + this.requisitoPorTramite = requisitoPorTramite; + } + + public GuardiasController getGuardias() { + return guardias; + } + + public void setGuardias(GuardiasController guardias) { + this.guardias = guardias; + } + + public SolicitudGuardiasController getSolicitudGuardias() { + return solicitudGuardias; + } + + public void setSolicitudGuardias(SolicitudGuardiasController solicitudGuardias) { + this.solicitudGuardias = solicitudGuardias; + } + + public ArmasController getArmas() { + return armas; + } + + public void setArmas(ArmasController armas) { + this.armas = armas; + } + + public RegistroArmController getRegistroArmas() { + return registroArmas; + } + + public void setRegistroArmas(RegistroArmController registroArmas) { + this.registroArmas = registroArmas; + } + + public AgenciaSucursalController getAgenciaSucursal() { + return agenciaSucursal; + } + + public void setAgenciaSucursal(AgenciaSucursalController agenciaSucursal) { + this.agenciaSucursal = agenciaSucursal; + } + + public RecepcionArmasController getSolicitudArmas() { + return solicitudArmas; + } + + public void setSolicitudArmas(RecepcionArmasController solicitudArmas) { + this.solicitudArmas = solicitudArmas; + } + + public SolicitudAgenciaSucursalController getSolicitudAgenciaSucursal() { + return solicitudAgenciaSucursal; + } + + public void setSolicitudAgenciaSucursal( + SolicitudAgenciaSucursalController solicitudAgenciaSucursal) { + this.solicitudAgenciaSucursal = solicitudAgenciaSucursal; + } + + public TarmSolicitudDocumentoController getSolicitudDocumento() { + return solicitudDocumento; + } + + public void setSolicitudDocumento( + TarmSolicitudDocumentoController solicitudDocumento) { + this.solicitudDocumento = solicitudDocumento; + } + + public DocumentoHabilitanteController getDocumentoHabilitante() { + return documentoHabilitante; + } + + public void setDocumentoHabilitante( + DocumentoHabilitanteController documentoHabilitante) { + this.documentoHabilitante = documentoHabilitante; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public boolean isDeshabilitarPantalla() { + return deshabilitarPantalla; + } + + public void setDeshabilitarPantalla(boolean deshabilitarPantalla) { + this.deshabilitarPantalla = deshabilitarPantalla; + } + + public boolean isMostrarIngresoArmas() { + return mostrarIngresoArmas; + } + + public void setMostrarIngresoArmas(boolean mostrarIngresoArmas) { + this.mostrarIngresoArmas = mostrarIngresoArmas; + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public Boolean getIsEnableGrabar() { + return isEnableGrabar; + } + + public void setIsEnableGrabar(Boolean isEnableGrabar) { + this.isEnableGrabar = isEnableGrabar; + } + + public boolean isActualizaDatosGenerales() { + return actualizaDatosGenerales; + } + + public void setActualizaDatosGenerales(boolean actualizaDatosGenerales) { + this.actualizaDatosGenerales = actualizaDatosGenerales; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + + public boolean isGuiaLibreTransito() { + return guiaLibreTransito; + } + + public void setGuiaLibreTransito(boolean guiaLibreTransito) { + this.guiaLibreTransito = guiaLibreTransito; + } + + public EvaluacionController getEvaluacionController() { + return evaluacionController; + } + + public void setEvaluacionController(EvaluacionController evaluacionController) { + this.evaluacionController = evaluacionController; + } + + public AgenciaArmaController getAgenciaArma() { + return agenciaArma; + } + + public void setAgenciaArma(AgenciaArmaController agenciaArma) { + this.agenciaArma = agenciaArma; + } + + public List getLprovincias() { + return lprovincias; + } + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + public List getLcantonOrigen() { + return lcantonOrigen; + } + + public void setLcantonOrigen(List lcantonOrigen) { + this.lcantonOrigen = lcantonOrigen; + } + + public List getLcantonDestino() { + return lcantonDestino; + } + + public void setLcantonDestino(List lcantonDestino) { + this.lcantonDestino = lcantonDestino; + } + + public List getCentroControlList() { + return centroControlList; + } + + public void setCentroControlList(List centroControlList) { + this.centroControlList = centroControlList; + } + + public List getTipoDocumento() { + return tipoDocumento; + } + + public void setTipoDocumento(List tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } + + public Boolean getMostrarFiltroAUCP() { + return mostrarFiltroAUCP; + } + + public void setMostrarFiltroAUCP(Boolean mostrarFiltroAUCP) { + this.mostrarFiltroAUCP = mostrarFiltroAUCP; + } + + public String getFilterAUCP() { + return filterAUCP; + } + + public void setFilterAUCP(String filterAUCP) { + this.filterAUCP = filterAUCP; + } + + public CargaController getCargaController() { + return cargaController; + } + + public void setCargaController(CargaController cargaController) { + this.cargaController = cargaController; + } + + public Set getListaPersonasDetailVen() { + return listaPersonasDetailVen; + } + + public void setListaPersonasDetailVen( + Set listaPersonasDetailVen) { + this.listaPersonasDetailVen = listaPersonasDetailVen; + } + + public Integer getSelecionaCodigoVendedor() { + return selecionaCodigoVendedor; + } + + public void setSelecionaCodigoVendedor(Integer selecionaCodigoVendedor) { + this.selecionaCodigoVendedor = selecionaCodigoVendedor; + } + + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/TramiteArmasController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/TramiteArmasController.java.svn-base new file mode 100644 index 0000000..fdd13c8 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/TramiteArmasController.java.svn-base @@ -0,0 +1,2788 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.annotation.PostConstruct; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.PredicateUtils; +import org.apache.commons.collections.TransformerUtils; +import org.apache.commons.lang.StringUtils; +import org.primefaces.context.RequestContext; +import org.primefaces.event.SelectEvent; + +import com.fp.common.helper.Constant; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.eval.EvaluacionController; +import com.fp.frontend.controller.armas.funcionalidad.CargaController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.lov.CargasLovController; +import com.fp.frontend.controller.armas.parametros.BuscarTramiteLovController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.ClaseLovController; +import com.fp.frontend.controller.armas.parametros.GuardiasController; +import com.fp.frontend.controller.armas.parametros.OrigenTramiteController; +import com.fp.frontend.controller.armas.parametros.RequisitoPorTramiteController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PeopleController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.PersonPhoneController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.controller.pgeneral.safe.UserDetailController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.CommonTransformer; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.frontend.utility.Utilidades; +import com.fp.frontend.webservices.snap.cedula.ClienteCedula; +import com.fp.frontend.webservices.snap.ruc.ClienteRUC; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmOrigenTramite; +import com.fp.persistence.parmas.param.TarmRequisitoPorTipoTramite; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.parmas.soli.TarmSolicitudGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitos; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitosKey; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +import ec.gob.registrocivil.consultacedula.Cedula; +import ec.gov.sri.wsconsultacontribuyente.Contribuyente; + +/** + * Clase controladora de ingreso de tramites de control de armas. + * + * @author Jorge Vaca. + * @author dcruz + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class TramiteArmasController extends AbstractController { + + private Boolean mostrarFiltroAUCP = Boolean.FALSE; + + private String filterAUCP; + + /** + *Responsable de centro de control + */ + private TcustPersonDetail responsableCentroControl= null; + /** + * Detalle de Usuarios + */ + private TsafeUserDetail tsafeUserDetailUsuario = null; + /** + *Referencia al Centro de control; + */ + private TarmCentroControl centroControl = new TarmCentroControl(); + /** + *Nombre de la Institucion + */ + private String nombreInstitucion; + /** + * Lista de tipos de persona. + */ + private List ltipopersona; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de identificación + */ + private List ltipoidenti; + + /** + * Lista de tipos de trámite. + */ + private List ltipotramite; + + /** + * Lista de origen de adquisición + */ + private List lorigenadquisicion; + + /** + * Lista de provincias + */ + private List lprovincias; + + /** + * Lista de cantones de origen + */ + private List lcantonOrigen; + + /** + * Lista de cantones de destino + */ + private List lcantonDestino; + /** + * Longitud de la identificacion de una persona. + */ + private Integer longitudid; + + /** + * Indica si se debe activar la pestana de ingresar requisitos + */ + private boolean ingresarRequisitos; + + /** + * Indica si se debe activar la pestana de seleccionar armas + */ + private boolean seleccionarArmas; + + /** + * Indica si se debe activar la pestana seleccionar guardias + */ + private boolean seleccionarGuardias; + + /** + * Indica si se debe activar la pestana seleccionar agencias + */ + private boolean seleccionarAgencias; + + /** + * Indica si se debe activar la pestana listar guardias + */ + private boolean listarDocumentos; + + /** + * Atributo para activar el keyFilter + */ + private boolean activarRegExIdentificacion; + + /** + * Indica si el flujo ya fue iniciado, sirve para controlar que no iniciar el flujo mas de una vez. + */ + private boolean flujoiniciado = false; + + private boolean esaprobacion = false; + + /** + * Deshabilita la pantalla después de grabar la solicitud + */ + private boolean deshabilitarPantalla; + + /** + * Muestra el botón de ingreso de armas + */ + private boolean mostrarIngresoArmas; + /** + * codigo de la persona que hace la solicitud + */ + private Integer cpersona = 0; + /** + * Atributo que oculpa botones del flujo + */ + private boolean ocultarBotonInicioFlujo = true; + + /** + * Fecha actual + */ + private Date fechaActual = new Date(); + + + private String csolicitud; + + /** + * Bandera de tipo booleano para indicar si se ha grabado el reporte generado + * */ + private Boolean isEnableGrabar; + /** + * Trámite seleccionado + */ + private TarmTramite tarmTramite; + + /** + * Habilita campos en actualización de datos generales + */ + private boolean actualizaDatosGenerales; + + /** + * Aprueba si es guía de libre tránsito + */ + private boolean guiaLibreTransito; + + /** + * Lista Personas vendedoreas + */ + private Set listaPersonasDetailVen; + /** + * Vendedor seleccionado + */ + private Integer selecionaCodigoVendedor; + + /** + * Controlador de login + */ + @ManagedProperty(value = "#{loginController}") + private LoginController login; + + /** + * Controlador que maneja el usuario + */ + @ManagedProperty(value = "#{userDetailController}") + private UserDetailController detalleusuario; + + /** + * Controlador que maneja las armas dentro de la solicitud + */ + @ManagedProperty(value = "#{solicitudArmasController}") + private SolicitudArmasController solicitud; + + /** + * Controlador que maneja cargas para previa importacion + */ + @ManagedProperty(value = "#{cargaController}") + private CargaController cargaController; + + /** + * Controlador que maneja la persona + */ + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController detallepersona; + + /** + * Controlador que maneja los datos de personas naturales + */ + @ManagedProperty(value = "#{peopleController}") + private PeopleController natural; + + /** + * Controlador que maneja direcciones de la persona + */ + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController direccion; + + /** + * Controlador que maneja teléfonos de la persona + */ + @ManagedProperty(value = "#{personPhoneController}") + private PersonPhoneController telefono; + + /** + * Controlador que maneja requisitos dentro de la solicitud + */ + @ManagedProperty(value = "#{solicitudRequisitosController}") + private SolicitudRequisitosController requisitos; + + /** + * Controlador que maneja los requisitos + */ + @ManagedProperty(value = "#{requisitoPorTramiteController}") + private RequisitoPorTramiteController requisitoPorTramite; + + /** + * Controlador que maneja guardias + */ + @ManagedProperty(value = "#{guardiasController}") + private GuardiasController guardias; + + /** + * Controlador que maneja los guardias en la solicitud + */ + @ManagedProperty(value = "#{solicitudGuardiasController}") + private SolicitudGuardiasController solicitudGuardias; + + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{armasController}") + private ArmasController armas; + + /** + * Controlador que maneja las armas dentro de la solicitud + */ + @ManagedProperty(value = "#{recepcionArmasController}") + private RecepcionArmasController solicitudArmas; + + /** + * Controlador que maneja registro de armas + */ + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmas; + + /** + * Controlador que maneja agencias y sucursales + */ + @ManagedProperty(value = "#{agenciaSucursalController}") + private AgenciaSucursalController agenciaSucursal; + + /** + * Controlador que maneja las agencias y sucursales dentro de la solicitud + */ + @ManagedProperty(value = "#{solicitudAgenciaSucursalController}") + private SolicitudAgenciaSucursalController solicitudAgenciaSucursal; + + /** + * Controlador que maneja los documentos habilitantes + */ + @ManagedProperty(value = "#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitante; + + /** + * Controlador que maneja los documentos dentro de la solicitud + */ + @ManagedProperty(value = "#{tarmSolicitudDocumentoController}") + private TarmSolicitudDocumentoController solicitudDocumento; + /** + * Controlador Inyectado ReportController + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + /** + * Controlador que maneja las evaluaciones de las personas + */ + @ManagedProperty(value="#{evaluacionController}") + private EvaluacionController evaluacionController; + /** + * Controlador que maneja las armas asociadas a las agencias + */ + @ManagedProperty(value="#{agenciaArmaController}") + private AgenciaArmaController agenciaArma; + + TgeneCatalogDetail tipoTramite = null ; + TgeneCatalogDetail tipoAutorizacion = null; + TgeneCatalogDetail actividad = null; + /** + * codigo de la provincia del usuario logueado + */ + private String cprovincia; + + private List centroControlList; + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List tipoDocumento; + + /** + * codigo del ruc + */ + private String codigoRuc; + /** + * codigo del ruc + */ + private String codigoCedula; + + /** + * codigo del ruc + */ + private String codigoPasaporte; + + /** + * Atributo para setear el vendedor + */ + private TcustPersonDetail tcustPersonDetailVendedor; + + public TramiteArmasController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + try { + this.init(); + ltipopersona = CatalogDetailController.find("PERSONTYPE"); + ltipoidenti = CatalogDetailController.find("IDENTIFICATION"); + ltipotramite = CatalogDetailController.find("TIPOTRAMITE"); + lprovincias = ProvinceController.find("EC"); + lorigenadquisicion = new ArrayList(); + + // Inicializa autoconsulta +// super.startQuery(); + ocultarBotonInicioFlujo = true; + isEnableGrabar = Boolean.TRUE; + if (super.getMfilters().get("pk.csolicitud") != null) { + esaprobacion = true; + } + centroControlList=CentroControlArmasController.findEstadoInst("Y","1");//Departamento + this.querydatabase(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + * @throws Exception + */ + private void init() throws Exception { + this.beanalias="SOLICITUD"; + this.responsableCentroControl = new TcustPersonDetail(); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + tipoDocumento = CatalogDetailController.find("IDENTIFICATION"); + listaPersonasDetailVen = new HashSet(); + tcustPersonDetailVendedor=null; + codigoRuc=codigos("CODIGO.RUC"); + codigoCedula=codigos("CODIGO.CEDULA"); + codigoPasaporte=codigos("CODIGO.PASAPORTE"); + this.obtenerCentroControl(); + this.obtenerResponsableCentroControl(); + } + +// public String onFlowProcess(FlowEvent event) { +// if (!flujoiniciado) { +// this.saveCabecera(); +// } +// return event.getNewStep(); +// } + + @Override + public void save() { + try { + if(deshabilitarPantalla){ + return; + } + try { + if(!noValidaDocumentoHabilitante(tipoTramite,tipoAutorizacion,actividad)){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_listardocumentos_solo")); + return; + } + } catch (Exception e) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_listardocumentos")); + return; + } + + //validamos si tcustPersonDetailPortador este lleno o si han seleccionado sin portador para asignarle el por default + if(tcustPersonDetailVendedor==null && tarmTramite.getTipoautorizacion().equals("4")){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionesinportadoroverifiqueusuarioexistentevendedor")); + return; + } + + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + solicitud.fijaPersona(detallepersona.getRecord()); + solicitud.fijaInicioFlujoEnNO(); + solicitud.update(); + + DtoSave dtosavesol = solicitud.getDtoSave(); + dtosavesol.setIsForm(true); + dtosavesol.setReturnpk(true); + dtosavesol.setPosition(1); + msave.put(solicitud.getBeanalias(), dtosavesol); // adicionar metadata de mantenimiento para cada tabla. + + DtoSave dtosavereq = requisitos.getDtoSave(); + dtosavereq.setReturnpk(true); + dtosavereq.setPosition(2); + msave.put(requisitos.getBeanalias(), dtosavereq); // adicionar metadata de mantenimiento para cada tabla. + + + request.modifiedData().put("csolicitud", solicitud.getRecord().getPk()); + request.modifiedData().put("isnew", "N"); + request.setSaveTables(msave); + + //this.setearCodigoCentroControl(); + + this.modificaDatosGenerales(); + + this.actualizaDirecciones(); + + this.actualizarTelefonos(); + + //guardias + this.copiaGuardias(); + + //armas + this.copiaArmas(); + + //agencias + this.copiaAgencias(); + + //documentos + this.copiaDocumentos(); + + //agencia armas + this.copiaAgenciaArmas(); + + if(!validacionFormulario()){ + return; + } + + //guardias + DtoSave dtosaveguardias = solicitudGuardias.getDtoSave(); + dtosaveguardias.setReturnpk(Boolean.TRUE); + dtosaveguardias.setPosition(3); + msave.put(solicitudGuardias.getBeanalias(), dtosaveguardias); + + //armas + DtoSave dtosavearmas = solicitudArmas.getDtoSave(); + dtosavearmas.setReturnpk(Boolean.TRUE); + dtosavearmas.setPosition(4); + msave.put(solicitudArmas.getBeanalias(), dtosavearmas); + + //agencias + DtoSave dtosaveagencias = solicitudAgenciaSucursal.getDtoSave(); + dtosaveagencias.setReturnpk(Boolean.TRUE); + dtosaveagencias.setPosition(5); + msave.put(solicitudAgenciaSucursal.getBeanalias(), dtosaveagencias); + + //solicitud_documentos + DtoSave dtosavedocumentos = solicitudDocumento.getDtoSave(); + dtosavedocumentos.setReturnpk(Boolean.TRUE); + dtosavedocumentos.setPosition(6); + msave.put(solicitudDocumento.getBeanalias(), dtosavedocumentos); + + //direcciones + DtoSave dtosavedirecciones = direccion.getDtoSave(); + dtosavedirecciones.setReturnpk(Boolean.TRUE); + dtosavedirecciones.setPosition(7); + msave.put(direccion.getBeanalias(), dtosavedirecciones); + + DtoSave dtosavetelefono = telefono.getDtoSave(); + dtosavetelefono.setReturnpk(Boolean.TRUE); + dtosavetelefono.setPosition(8); + msave.put(telefono.getBeanalias(), dtosavetelefono); + + DtoSave dtodatosgenerales = detallepersona.getDtoSave(); + dtodatosgenerales.setReturnpk(Boolean.TRUE); + dtodatosgenerales.setPosition(9); + msave.put(detallepersona.getBeanalias(), dtodatosgenerales); + + DtoSave dtosaveagenciaarmas = agenciaArma.getDtoSave(); + dtosaveagenciaarmas.setPosition(10); + msave.put(agenciaArma.getBeanalias(), dtosaveagenciaarmas); + + //documentoHabilitante + DtoSave dtosaveDocumentoHabilitante = documentoHabilitante.getDtoSave(); + dtosaveDocumentoHabilitante.setReturnpk(Boolean.TRUE); + dtosaveDocumentoHabilitante.setPosition(11); + msave.put(documentoHabilitante.getBeanalias(), dtosaveDocumentoHabilitante); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + managedSaveResponse(resp); + // CATEGORIA 14 PREVIA IMPORTACION + if(tarmTramite.getCategoria().equals("14")){ + asociarCargaSolicitud(); + } + MessageHelper.setMessageInfo(resp); + FacesContext context = FacesContext.getCurrentInstance(); + context.addMessage(null, new FacesMessage("RECUERDE", MsgControlArmas.getProperty("msg_recuerdeClickContinuarTramite"))); + } else { + ocultarBotonInicioFlujo = true; + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void asociarCargaSolicitud(){ + try{ + TarmCarga carga = CargaController.findByAUCP(solicitud.getRecord().getAucp()); + if(carga!=null){ + carga.setCsolicitud(solicitud.getRecord().getPk()); + cargaController.update(carga); + cargaController.save(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + public void saveInicioFlujoEnYES() { + try { + + solicitud.fijaInicioFlujoEnYES(); + solicitud.update(); + + DtoSave dtoSolicitud = solicitud.getDtoSave(); + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + msave.put(solicitud.getBeanalias(), dtoSolicitud); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + solicitud.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + private void managedSaveResponse(Response response) throws Exception{ + csolicitud = response.get("csolicitud").toString(); + solicitud.postCommit(response); + requisitos.postCommit(response); + solicitudGuardias.postCommit(response); + solicitudArmas.postCommit(response); + solicitudAgenciaSucursal.postCommit(response); + solicitudDocumento.postCommit(response); + // flujoiniciado = Boolean.TRUE; + isEnableGrabar = Boolean.FALSE; + deshabilitarPantalla = Boolean.TRUE; + solicitud.getMfilelds().put("estadoSolicitud", "REGISTRADO"); + } + + + /** + * Metodo que valida si ha sido seleccionado ams de un documento en el criterio validado + * @param tipoTramite + * @param tipoAutorizacion + * @param actividad + * @return + * @throws Exception + */ + private boolean noValidaDocumentoHabilitante(TgeneCatalogDetail tipoTramite,TgeneCatalogDetail tipoAutorizacion, TgeneCatalogDetail actividad) throws Exception{ + int count= 0 ; + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())){ + + for(TarmDocumentoHabilitante documento:documentoHabilitante.getLrecord()){ + if(documento.getModifiedData().get("seleccionado").equals(Boolean.TRUE) ){ + count++; + } + if(count>1){ + return false; + } + } + if(count==0){ + throw new Exception(MsgControlArmas.getProperty("msg_error_listardocumentos")); + + } + } + + if((tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())) || + (tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog())) || + (tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog()))) + { + //validamos si el tramite esta chequeado documentohabilitante + if(tarmTramite.getDocumentohabilitante().equals(Constant.STR_Y)){ + for(TarmDocumentoHabilitante documento:documentoHabilitante.getLrecord()){ + if(count>0){ + break; + } + + if(documento.getModifiedData().get("seleccionado").equals(Boolean.TRUE) ){ + count++; + } + } + if(count==0){ + throw new Exception(MsgControlArmas.getProperty("msg_error_listardocumentos")); + } + } + } + + return true; + } + + /** + * Actualizo datos de la persona + * @throws Exception + */ + private void modificaDatosGenerales() throws Exception{ + detallepersona.update(); + } + + /** + * Actualizo el valor de las direcciones siempre y cuando haya existido un cambio en su valor + */ + private void actualizaDirecciones(){ + TcustPersonAddress direccionPersona = null; + direccionPersona = direccion.findPrincipal(detallepersona.getRecord().getPk().getPersoncode().toString()); + + if(direccionPersona != null){ + direccion.setRecord(direccionPersona); + direccion.getRecord().setCountrycode(direccion.getMfilelds().get("solcodpais").toString()); + direccion.getRecord().setProvincecode(direccion.getMfilelds().get("solcodprovincia").toString()); + direccion.getRecord().setCantoncode(direccion.getMfilelds().get("solcodcanton").toString()); + direccion.getRecord().setCitycode(direccion.getMfilelds().get("solcodciudad").toString()); + direccion.getRecord().setParroquiacode(direccion.getMfilelds().get("solcodparroquia").toString()); + direccion.getRecord().setAddress(direccion.getMfilelds().get("soldireccion").toString()); + direccion.update(); + } + + TcustPersonAddress correo = (TcustPersonAddress) CollectionUtils.find(direccion.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getAddresstypecatalog"), PredicateUtils.equalPredicate("3"))); + if(correo != null){ + direccion.setRecord(correo); + direccion.getRecord().setAddress(direccion.getMfilelds().get("solcorreopersona").toString()); + direccion.update(); + } + } + + /** + * Actualizo los números de teléfono si es que existe un cambio + * @throws Exception + */ + private void actualizarTelefonos() throws Exception { + TcustPersonPhone telefonoLocal = null; + telefonoLocal = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(new CommonTransformer("phonetypecatalog"), PredicateUtils.equalPredicate("1"))); + TcustPersonAddress direccionPrincipal = (TcustPersonAddress) CollectionUtils.find(direccion.getLrecord(), PredicateUtils.transformedPredicate(new CommonTransformer("principal"), PredicateUtils.equalPredicate(Constant.STR_Y))); + Integer codigodireccion = direccionPrincipal != null ? direccionPrincipal.getPk().getAddressnumber() : null; + if(telefonoLocal != null){ + telefono.setRecord(telefonoLocal); + telefono.getRecord().setPhonenumber(telefono.getMfilelds().get("soltelfijo") != null ? telefono.getMfilelds().get("soltelfijo").toString() : null); + telefono.update(); + }else{ + telefono.create(); + telefono.getRecord().getPk().setPersoncode(cpersona); + telefono.getRecord().getPk().setPhonesequence(1); + telefono.getRecord().getPk().setDateto(Utilidades.getFechaExpiracion()); + telefono.getRecord().setPhonenumber(telefono.getMfilelds().get("soltelfijo") != null ? telefono.getMfilelds().get("soltelfijo").toString() : null); + telefono.getRecord().setDatefrom(new Timestamp(System.currentTimeMillis())); + telefono.getRecord().setPhonetypecatalogcode("PHONETYPE"); + telefono.getRecord().setPhonetypecatalog("1"); + telefono.getRecord().setAddressnumber(codigodireccion); + telefono.update(); + } + TcustPersonPhone telefonoCelular = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(new CommonTransformer("phonetypecatalog"), PredicateUtils.equalPredicate("2"))); + if(telefonoCelular != null){ + telefono.setRecord(telefonoCelular); + telefono.getRecord().setPhonenumber(telefono.getMfilelds().get("soltelcelular") != null ? telefono.getMfilelds().get("soltelcelular").toString() : null); + telefono.update(); + }else{ + telefono.create(); + telefono.getRecord().getPk().setPersoncode(cpersona); + telefono.getRecord().getPk().setPhonesequence(2); + telefono.getRecord().getPk().setDateto(Utilidades.getFechaExpiracion()); + telefono.getRecord().setPhonenumber(telefono.getMfilelds().get("soltelcelular") != null ? telefono.getMfilelds().get("soltelcelular").toString() : null); + telefono.getRecord().setDatefrom(new Timestamp(System.currentTimeMillis())); + telefono.getRecord().setPhonetypecatalogcode("PHONETYPE"); + telefono.getRecord().setPhonetypecatalog("2"); + telefono.getRecord().setAddressnumber(codigodireccion); + telefono.update(); + } + } + + /** + * Copia los guardias de la tabla {@link TarmGuardias} a {@link TarmSolicitudGuardias} + * @throws Exception + */ + private void copiaGuardias() throws Exception { + if(seleccionarGuardias && guardias.getLrecord() != null && !guardias.getLrecord().isEmpty()){ + for (TarmGuardias guardia : guardias.getLrecord()) { + TarmSolicitudGuardias guardiaSeleccionado = (TarmSolicitudGuardias) CollectionUtils.find(solicitudGuardias.getLrecord(), + PredicateUtils.andPredicate( + PredicateUtils.transformedPredicate(new CommonTransformer("pk.cempresa"), PredicateUtils.equalPredicate(cpersona)), + PredicateUtils.transformedPredicate(new CommonTransformer("pk.cguardia"), PredicateUtils.equalPredicate(guardia.getPk())))); + if(guardia.getModifiedData().get("seleccionado") != null && Boolean.valueOf(guardia.getModifiedData().get("seleccionado").toString())){ + if(guardiaSeleccionado == null){ + solicitudGuardias.create(); + solicitudGuardias.getRecord().getPk().setCempresa(cpersona); + solicitudGuardias.getRecord().getPk().setCguardia(guardia.getPk()); + solicitudGuardias.update(); + } + }else{ + if(guardiaSeleccionado != null){ + solicitudGuardias.setRecord(guardiaSeleccionado); + solicitudGuardias.remove(); +// solicitudGuardias.update(); + } + } + } + } + } + + /** + * Copia las armas a {@link TarmSolicitudArmas} + * @throws Exception + */ + private void copiaArmas() throws Exception { + if(seleccionarArmas && armas.getLrecord() != null && !armas.getLrecord().isEmpty()){ + for (TarmArmas arma : armas.getLrecord()) { + TarmSolicitudArmas armaSeleccionada = (TarmSolicitudArmas) CollectionUtils.find(solicitudArmas.getLrecord(), + PredicateUtils.andPredicate( + PredicateUtils.transformedPredicate(new CommonTransformer("pk.personcode"), PredicateUtils.equalPredicate(cpersona)), + PredicateUtils.transformedPredicate(new CommonTransformer("pk.carma"), PredicateUtils.equalPredicate(arma.getPk())))); + if(arma.getModifiedData().get("seleccionado") != null && Boolean.valueOf(arma.getModifiedData().get("seleccionado").toString())){ + if(armaSeleccionada == null){ + solicitudArmas.create(); + solicitudArmas.getRecord().getPk().setPersoncode(cpersona); + solicitudArmas.getRecord().getPk().setCarma(arma.getPk()); + solicitudArmas.update(); + } + }else{ + if(armaSeleccionada != null){ + solicitudArmas.setRecord(armaSeleccionada); + solicitudArmas.remove(); +// solicitudArmas.update(); + } + } + } + } + } + + /** + * Copia las agencias a {@link TarmSolicitud} + * @throws Exception + */ + private void copiaAgencias() throws Exception{ + if(seleccionarAgencias && agenciaSucursal.getLrecord() != null && !agenciaSucursal.getLrecord().isEmpty()){ + for (TarmAgenciaSucursal agencia : agenciaSucursal.getLrecord()) { + TarmSolicitudAgenciaSucursal agenciaSeleccionada = (TarmSolicitudAgenciaSucursal) CollectionUtils.find(solicitudAgenciaSucursal.getLrecord(), + PredicateUtils.transformedPredicate(new CommonTransformer("pk.cagencia"), PredicateUtils.equalPredicate(agencia.getPk()))); + if(agencia.getModifiedData().get("seleccionado") != null && Boolean.valueOf(agencia.getModifiedData().get("seleccionado").toString())){ + if(agenciaSeleccionada == null){ + solicitudAgenciaSucursal.create(); + solicitudAgenciaSucursal.getRecord().getPk().setCagencia(agencia.getPk()); + solicitudAgenciaSucursal.update(); + } + }else{ + if(agenciaSeleccionada != null){ + solicitudAgenciaSucursal.setRecord(agenciaSeleccionada); + solicitudAgenciaSucursal.remove(); +// solicitudAgenciaSucursal.update(); + } + } + } + } + } + + /** + * Copia los documentos para procesarse en la solcitud + * @throws Exception + */ + private void copiaDocumentos() throws Exception{ + if(listarDocumentos && documentoHabilitante.getLrecord() != null && !documentoHabilitante.getLrecord().isEmpty()){ + for (TarmDocumentoHabilitante docHabilitante : documentoHabilitante.getLrecord()) { + TarmSolicitudDocumento documentoSeleccionado = (TarmSolicitudDocumento) CollectionUtils.find(solicitudDocumento.getLrecord(), + PredicateUtils.transformedPredicate(new CommonTransformer("pk.cdocumento"), PredicateUtils.equalPredicate(docHabilitante.getPk()))); + if(docHabilitante.getModifiedData().get("seleccionado") != null && Boolean.valueOf(docHabilitante.getModifiedData().get("seleccionado").toString())){ + if(documentoSeleccionado == null){ + solicitudDocumento.create(); + solicitudDocumento.getRecord().getPk().setCdocumento(docHabilitante.getPk()); + solicitudDocumento.update(); + // Cambiar el centro de control del documento al centro control de armas actual + if(docHabilitante.getCentrocontrol().equalsIgnoreCase("999999")){ + docHabilitante.setCentrocontrol(centroControl.getPk()); + documentoHabilitante.update(docHabilitante); + } + } + }else{ + if(documentoSeleccionado != null){ + solicitudDocumento.setRecord(documentoSeleccionado); + solicitudDocumento.remove(); +// solicitudDocumento.update(); + } + } + } + } + } + + /** + * Copia las armas seleccionadas a la agencia seleccionada debe ejecutarse después de + * @throws Exception + */ + private void copiaAgenciaArmas() throws Exception{ + if(seleccionarAgencias){ + Long cagencia = solicitudAgenciaSucursal.getLrecord().iterator().next().getPk().getCagencia(); + for (TarmSolicitudArmas tarmSolicitudArmas : solicitudArmas.getLrecord()) { + agenciaArma.create(); + agenciaArma.getRecord().getPk().setCagencia(cagencia); + agenciaArma.getRecord().getPk().setCarma(tarmSolicitudArmas.getPk().getCarma()); + agenciaArma.update(); + } + } + } + + /** + * Valida que solo se seleccione una agencia en la solicitud + * @param event + */ + public void validaAgenciaUnica(AjaxBehaviorEvent event) { + Boolean valorComponente = (Boolean) (event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value") : null); + if(valorComponente){ + int cont = 0; + for (TarmAgenciaSucursal tarmAgenciaSucursal : agenciaSucursal.getLrecord()) { + if(tarmAgenciaSucursal.getModifiedData().get("seleccionado") != null && Boolean.parseBoolean(tarmAgenciaSucursal.getModifiedData().get("seleccionado").toString())){ + cont++; + } + if(cont > 1){ + agenciaSucursal.getLrecord().get(Integer.parseInt(event.getComponent().getAttributes().get("indiceActual").toString())).getModifiedData().put("seleccionado", Boolean.FALSE); + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_unicidad_agencia")); + break; + } + } + } + } + + /** + * Realiza las validaciones pertinentes del formulario + * @return + */ + private boolean validacionFormulario(){ + //Valido el tramite que se ha escogido un tramite + Boolean valido = Boolean.TRUE; + if(solicitud.getRecord().getCtramite() == null){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_tramite")); + valido = Boolean.FALSE; + } + if(ingresarRequisitos){ + int tamReq = requisitos.getLrecord().size(); + int tamReqSel = 0; + for (TarmSolicitudRequisitos solicitudRequisitos : requisitos.getLrecord()) { + if(solicitudRequisitos.getCargado() != null && solicitudRequisitos.getCargado().equals(Constant.STR_Y)){ + tamReqSel++; + } + } + if(tamReq==0){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_no_requisitos")); + valido = Boolean.FALSE; + }else if(tamReq != tamReqSel){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_requisitos")); + valido = Boolean.FALSE; + } + } + if(seleccionarArmas){ + //tramite autorizacion primera vez/renovacion Estableciiento de agencias Companias de vigilancia y seguridad + TgeneParameters parametro=ParametersController.find("CODIGO.TRAMITE.NOVALIDAARMAS", "1"); + ListcodigoTramiteNoValidaArma=null; + if(parametro!=null){ + codigoTramiteNoValidaArma=new ArrayList<>(); + String []arrayTramitesNoValidaArmas= parametro.getTextvalue().split(","); + for (String item : arrayTramitesNoValidaArmas) { + codigoTramiteNoValidaArma.add(Long.parseLong(item)); + } + } + + if(this.tarmTramite!= null && codigoTramiteNoValidaArma!=null && codigoTramiteNoValidaArma.contains(this.tarmTramite.getPk())){ + System.out.println("Tramite-"+this.tarmTramite.getPk()); + //pasa + }else if(solicitudArmas.getLrecord() == null || solicitudArmas.getLrecord().isEmpty()){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_armas")); + valido = Boolean.FALSE; + } else if(tarmTramite.getNumeromaxarmas() != null && tarmTramite.getNumeromaxarmas().intValue() < solicitudArmas.getLrecord().size()){ + MessageHelper.setMessageWarn(MsgControlArmas.getProperty("msg_error_maximo_armas"), tarmTramite.getNumeromaxarmas()); + valido = Boolean.FALSE; + } + } + if(seleccionarGuardias){ + if(solicitudGuardias.getLrecord() == null || solicitudGuardias.getLrecord().isEmpty()){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_guardias")); + valido = Boolean.FALSE; + } + } + if(seleccionarAgencias){ + if(solicitudAgenciaSucursal.getLrecord() == null || solicitudAgenciaSucursal.getLrecord().isEmpty()){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_agencias")); + valido = Boolean.FALSE; + } + } + if(listarDocumentos){ + if(documentoHabilitante.getLrecord() == null || documentoHabilitante.getLrecord().isEmpty()){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_noexistendocumentos")); + valido = Boolean.FALSE; + }else if(solicitudDocumento.getLrecord() == null || solicitudDocumento.getLrecord().isEmpty()){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_documento")); + valido = Boolean.FALSE; + } + } + return valido; + } + +// public void saveCabecera() { +// try { +// Request request = callerhelper.getRequest(); +// HashMap msave = new HashMap(); +// solicitud.fijaPersona(detallepersona.getRecord()); +// solicitud.update(); +// +// DtoSave dtosavesol = solicitud.getDtoSave(); +// dtosavesol.setIsForm(true); +// dtosavesol.setReturnpk(true); +// dtosavesol.setPosition(1); +// msave.put(solicitud.getBeanalias(), dtosavesol); // adicionar metadata de mantenimiento para cada tabla. +// +// request.setSaveTables(msave); +// request.modifiedData().put("csolicitud", solicitud.getRecord().getPk()); +// request.modifiedData().put("isnew", "N"); +// +// Response resp = callerhelper.executeSave(request); +// if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { +// solicitud.postCommit(resp); +// ocultarBotonInicioFlujo = false; +// MessageHelper.setMessageInfo(resp); +// } else { +// ocultarBotonInicioFlujo = true; +// MessageHelper.setMessageError(resp); +// } +// +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// } +// } + + @Override + protected void querydatabase() { + try { + if(deshabilitarPantalla){ + return; + } + detalleusuario.getMfilters().clear(); + detalleusuario.getMfilters().put("pk.usercode", login.getRequest().getUser()); + detalleusuario.addFilterDateto(); + detalleusuario.query(); + if (detalleusuario.getRecord() == null || detalleusuario.getRecord().getPk().getPersoncode() == null) { + return; + } + + cpersona = detalleusuario.getRecord().getPk().getPersoncode(); + detallepersona.getMfilters().clear(); + detallepersona.getMfilters().put("pk.personcode", cpersona.toString()); + detallepersona.addFilterDateto(); + detallepersona.query(); + + natural.getMfilters().clear(); + natural.addPersoncodeFilter(cpersona.toString()); + natural.addFilterDateto(); + natural.query(); + + direccion.getMfilters().clear(); + direccion.addPersoncodeFilter(cpersona.toString()); + direccion.addFilterDateto(); + direccion.query(); + + this.obtenerDireccionesGenerales(); + + telefono.getMfilters().clear(); + telefono.addPersoncodeFilter(cpersona.toString()); + telefono.addFilterDateto(); + telefono.query(); + + this.obtenerTelefonos(); + + this.setearDatosGenerales(); + //creamos una solicitud por default cuando se consulta por primera vez y al transaccion es 20 + if (this.getLoginController().getRequest().getTransactionModule().equals("30") && this.getLoginController().getRequest().getTransactionCode() == 20) { + solicitud.create(); + solicitud.getRecord().setFregistro(new java.sql.Date(System.currentTimeMillis())); + this.obtenerSecuencialSolicitud(); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Muestra un mensaje de error siempre y cuando sea un error de componente y se lo muestra como general + * @return + */ + public Boolean getExisteMensajesError() { + Boolean resp = Boolean.FALSE; + FacesContext facesContext = FacesContext.getCurrentInstance(); + final Iterator idComponentesMensajes = facesContext.getClientIdsWithMessages(); + while(idComponentesMensajes.hasNext()){ + String idComp = idComponentesMensajes.next(); + if(StringUtils.isNotBlank(idComp)){ + System.out.println("El id es "+idComp.replace(":", "\\\\:")); + System.out.println("$('#"+idComp.replace(":", "\\\\:")+"').focus();"); + facesContext.validationFailed(); + resp = Boolean.TRUE; + RequestContext.getCurrentInstance().execute("$('#"+idComp.replace(":", "\\\\:")+"').focus();"); + break; + } + } + return resp; + } + + /** + * En base a la provincia y sus jurisdicciones se obtiene y se coloca el centro de control + */ +// private void setearCodigoCentroControl(){ +// TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(direccion.getMfilelds().get("solcodprovincia") != null ? +// direccion.getMfilelds().get("solcodprovincia").toString() : StringUtils.EMPTY); +// if(centroControlJur != null){ +// this.solicitud.getRecord().setCcentrocontrol(centroControlJur.getCcentrocontrol()); +// } +// } + + /** + * Ingresa datos que se necesitan en arma + */ + private void setearDatosGenerales(){ + TcustPersonDetail tcustPersonDetail = PersonDetailController.find(cpersona.toString()); + armas.getMfilelds().put("numdoc", tcustPersonDetail.getIdentification()); + armas.getMfilelds().put("tipodoc", tcustPersonDetail.getIdentificationcatalog()); + } + + /** + * Arma la petición al core para solicitar un número de secuencial para la solicitud antes de guardarla + * @throws Throwable + */ + private void obtenerSecuencialSolicitud() throws Throwable{ + Request request = callerhelper.getRequest(); + DtoQuery dtoQuery = super.getDtoQuery(true); + HashMap mapQuery = new HashMap(); + mapQuery.put(beanalias, dtoQuery); + request.put("querytype", "T"); + request.setQueryTables(mapQuery); + Response response = callerhelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(response); + }else{ + solicitud.getRecord().setNumerosolicitud(response.get("SECUENCIALSOLICITUD").toString()); + } + } + + /** + * Recupera en base al tipo de identificación la dirección de la oficina o de la casa + */ + private void obtenerDireccionesGenerales(){ + TcustPersonAddress direccionPersona = null; + direccionPersona = direccion.findPrincipal(detallepersona.getRecord().getPk().getPersoncode().toString()); + + if(direccionPersona != null){ + direccion.getMfilelds().put("solcodpais", direccionPersona.getCountrycode()); + direccion.setLprovinces(ProvinceController.find(direccionPersona.getCountrycode())); + direccion.getMfilelds().put("solcodprovincia", direccionPersona.getProvincecode()); + direccion.setLcantones(CantonController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode())); + direccion.getMfilelds().put("solcodcanton", direccionPersona.getCantoncode()); + direccion.setLcities(CityController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode(), direccionPersona.getCantoncode())); + direccion.getMfilelds().put("solcodciudad", direccionPersona.getCitycode()); + direccion.setLparroquias(ParroquiaController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode(), direccionPersona.getCantoncode())); + direccion.getMfilelds().put("solcodparroquia", direccionPersona.getParroquiacode()); + direccion.getMfilelds().put("soldireccion", direccionPersona.getAddress()); + } + + TcustPersonAddress correo = (TcustPersonAddress) CollectionUtils.find(direccion.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getAddresstypecatalog"), PredicateUtils.equalPredicate("3"))); + if(correo != null){ + direccion.getMfilelds().put("solcorreopersona", correo.getAddress()); + } + } + + /** + * Retorna el telefono fijo y celular de la persona + */ + private void obtenerTelefonos(){ + TcustPersonPhone telf = null; + telf = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getPhonetypecatalog"), PredicateUtils.equalPredicate("1"))); + if(telf != null){ + telefono.getMfilelds().put("soltelfijo", telf.getPhonenumber()); + } + telf = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getPhonetypecatalog"), PredicateUtils.equalPredicate("2"))); + if(telf != null){ + telefono.getMfilelds().put("soltelcelular", telf.getPhonenumber()); + } + } + + /** + * Método para el inicio de flujo + */ + public void iniciarFlujo() { + try { + cprovincia=null; + for(TarmCentroControl centro: centroControlList){ + if(solicitud.getRecord().getCcentrocontrol().equals(centro.getPk())){ + cprovincia=centro.getProvincecode(); + } + } + ; + if(cprovincia==null || cprovincia.length()==0){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinprovincia")); + return; + } + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + + request.modifiedData().put("csolicitud", solicitud.getRecord().getPk()); + request.modifiedData().put("numerosolicitud", solicitud.getRecord().getNumerosolicitud()); + request.modifiedData().put("numerotransaccion", solicitud.getRecord().getCtramite()); + request.modifiedData().put("cprovincia", cprovincia); + request.modifiedData().put("isnew", "Y"); + + request.setLogsolicitude(solicitud.getRecord().getNumerosolicitud()); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.setShowRow(true); + flujoiniciado = true; + deshabilitarPantalla = Boolean.TRUE; + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + " SOLICITUD: " + solicitud.getRecord().getNumerosolicitud()); + saveInicioFlujoEnYES(); +// RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para el inicio de flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + + request.modifiedData().put("csolicitud", solicitud.getRecord().getPk()); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Evento que se ejecuta cuando cambia el origen de adquisición + */ + public void executeOrigenAdquisicion() { + + TarmTramite tramite = this.solicitud.getRecord().getCtramite() != null ? TarmTramiteController.find(this.solicitud.getRecord().getCtramite().toString()) : null; + if((this.solicitud.getRecord().getOrigenadquisicion() != null && this.solicitud.getRecord().getOrigenadquisicion().equals("DEC")) + || (tramite != null && tramite.getTipoautorizacion().equals("1") && tramite.getCategoria().equals("10"))){ + this.mostrarIngresoArmas = Boolean.TRUE; + } else{ + this.mostrarIngresoArmas = Boolean.FALSE; + } + } + + @Override + public void postCommit(Response response) throws Exception { + } + + /** + * Datos de control de la identificacion de la persona. + */ + public void onChangeTipoId() { + String tipoid = super.getMfilelds().get("tipoidentificacion").toString(); + switch (tipoid) { + case "CED": + longitudid = 10; + activarRegExIdentificacion = true; + break; + case "RUC": + longitudid = 13; + activarRegExIdentificacion = true; + break; + default: + longitudid = 13; + activarRegExIdentificacion = false; + break; + } + } + + /** + * Abre el LOV de trámite + */ + public void openLovTramite() { + Map> params = new HashMap>(); + List ltipopersona = new ArrayList<>(); + if(validaNumeros(detallepersona.getRecord().getIdentification())){ + if(detallepersona.getRecord().getIdentification().length()==10){ + ltipopersona.add(ParametersController.find("CODIGO.PERSONTYPE.NATURAL", "1").getTextvalue());//1 + }else{ + ltipopersona.add(ParametersController.find("CODIGO.PERSONTYPE.JURIDICA", "1").getTextvalue());//2 + } + } + params.put("tipopersonasol", ltipopersona); + BuscarTramiteLovController.openLov(params); + } + + private boolean validaNumeros(String cadena){ + Boolean aux=Boolean.FALSE; + if (cadena.matches("[0-9]*")){ + System.out.println("Es un n�mero"); + aux=Boolean.TRUE; + }else{ + System.out.println("No es un n�mero"); + aux=Boolean.FALSE; + } + return aux; + } + + /** + * Abre el LOV de la clase del arma + */ + public void openLovClase() { + Map> params = new HashMap>(); + ClaseLovController.openLov(params); + } + + /** + * Regresa del LOV de armas + * @param event + */ + public void onReturnClase(SelectEvent event) { + TgeneCatalogDetail clase = (TgeneCatalogDetail) event.getObject(); + this.armas.getRecord().getModifiedData().put("clase", clase.getDescription()); + this.armas.setClase(clase.getPk().getCatalog()); + } + + /** + * Regresa del LOV para cargar valores + * @param event {@link SelectEvent} + */ + public void onReturnTramite(SelectEvent event) { + try{ + TarmTramite tramite = (TarmTramite) event.getObject(); + this.tarmTramite = tramite; +// if(!procedeTramite(TarmTramiteController.find(tramite.getCtramitepadre() != null ? tramite.getCtramitepadre().toString() : "-1"),tramite.getPk())){ + if(!procedeTramite(tramite)){ + return; + } + if(!verificaAptitudPersona(tarmTramite)){ + return; + } + solicitud.getRecord().setCtramite(tramite.getPk()); + tipoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + tipoAutorizacion = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail categoria = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + actividad = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + this.getSolicitud().addField("tipoTramite", tipoTramite.getDescription()); + this.getSolicitud().addField("tipoAutorizacion", tipoAutorizacion.getDescription()); + this.getSolicitud().addField("categoria", categoria.getDescription()); + this.getSolicitud().addField("actividad", actividad.getDescription()); + + if(tarmTramite.getTipotramite().equals(ParametersController.find("CODIGO.TRAMITEREIMPRESION", "1").getTextvalue())){ + this.actualizaDatosGenerales = Boolean.TRUE; + } else{ + this.actualizaDatosGenerales = Boolean.FALSE; + } + + if(tarmTramite.getTipoautorizacion().equals("4")){//Guia de libre transito + this.guiaLibreTransito = Boolean.TRUE; + if(!this.actualizaDatosGenerales){ + this.actualizaDatosGenerales = Boolean.TRUE; + } + } else{ + this.guiaLibreTransito = Boolean.FALSE; + } + + this.ingresarRequisitos = Boolean.TRUE; + if(Constant.ifYes(tramite.getRegistroarmas())){ + this.seleccionarArmas = Boolean.TRUE; + this.cargaArmas(); + }else{ + this.seleccionarArmas = Boolean.FALSE; + this.solicitudArmas.clearAll(); + } + if(Constant.ifYes(tramite.getRegistroguardia())){ + this.seleccionarGuardias = Boolean.TRUE; + this.cargaGuardias(); + }else{ + this.seleccionarGuardias = Boolean.FALSE; + this.solicitudGuardias.clearAll(); + } + if(Constant.ifYes(tramite.getRegistroagenciasucursal())){ + this.seleccionarAgencias = Boolean.TRUE; + this.cargarAgencias(); + }else{ + this.seleccionarAgencias = Boolean.FALSE; + this.solicitudAgenciaSucursal.clearAll(); + } + + if(Constant.ifYes(tramite.getDocumentohabilitante()) || tipoTramite.getPk().getCatalog().equals(ParametersController.find("CODIGO.TRAMITEREIMPRESION", "1").getTextvalue())){ + this.listarDocumentos = Boolean.TRUE; + listarDocumentos(tipoTramite,tipoAutorizacion, actividad);//Se listan los documentos en el tab listar documentos + }else{ + this.listarDocumentos = Boolean.FALSE; + this.solicitudDocumento.clearAll(); + } + + if(tramite != null){ + requisitoPorTramite.getMfilters().put("pk.ctramite", tramite.getPk().toString()); + requisitoPorTramite.setRecperpage(3000000); + requisitoPorTramite.setcTramite(tramite.getPk()); + requisitoPorTramite.query(); + requisitos.clearAll();//limpio los datos del requisito anterior + for (TarmRequisitoPorTipoTramite requisitoPorTipoTramite : requisitoPorTramite.getLrecord()) { + requisitos.create(); + requisitos.getRecord().setCargado(Constant.STR_N); + requisitos.getRecord().setPk(new TarmSolicitudRequisitosKey()); + requisitos.getRecord().getPk().setCrequisito(requisitoPorTipoTramite.getPk().getCrequisito()); + requisitos.getRecord().getPk().setCtramite(tramite.getPk()); + requisitos.getRecord().getModifiedData().put("crequisito", requisitoPorTipoTramite.getModifiedData().get("crequisito")); + requisitos.getRecord().getModifiedData().put("nrequisito", requisitoPorTipoTramite.getModifiedData().get("nrequisito")); + requisitos.getRecord().getModifiedData().put("ndescripcion", requisitoPorTipoTramite.getModifiedData().get("ndescripcion")); + requisitos.update(); + } + } + + if(tarmTramite.getUsoactividad().equals("2") || tarmTramite.getUsoactividad().equals("24")){//2 AGENCIA // 24 SUCURSAL + if(agenciaSucursal!= null && agenciaSucursal.getTipoAgencias()!=null && agenciaSucursal.getTipoAgencias().size()>0){ + TgeneCatalogDetail remover=new TgeneCatalogDetail(); + agenciaSucursal.setTipoAgencias(CatalogDetailController.find("TIPOAGENCIA")); + for(TgeneCatalogDetail item:agenciaSucursal.getTipoAgencias()){ + if(!tarmTramite.getUsoactividad().equals("2")){ + if(item.getPk().getCatalog().equals(ParametersController.find("CODIGO.AGENCIA.TIPOAGENCIA", "1").getTextvalue())){//"AGE" + remover=item; + } + } + if(!tarmTramite.getUsoactividad().equals("24")){ + if(item.getPk().getCatalog().equals(ParametersController.find("CODIGO.SUCURSAL.TIPOAGENCIA", "1").getTextvalue())){//"SUC" + remover=item; + } + } + } + agenciaSucursal.getTipoAgencias().remove(remover); + } + } + + //AQUI VA EL CODIGO PARA LLENAR LAS ADQUISICION + lorigenadquisicion = null; + lorigenadquisicion = new ArrayList(); + List origenTramites = OrigenTramiteController.findOrigenTramite(tarmTramite); + if(origenTramites!=null && !origenTramites.isEmpty()){ + for (int i = 0; i < origenTramites.size(); i++) { + TarmOrigenTramite origenTramite = origenTramites.get(i); + if(origenTramite!= null && origenTramite.getPk().getOrigencatalog()!=null && origenTramite.getPk().getOrigencatalogcode() != null && + !origenTramite.getPk().getOrigencatalog().isEmpty() && !origenTramite.getPk().getOrigencatalogcode().isEmpty()){ + lorigenadquisicion.add(CatalogDetailController.findCatalogo(origenTramite.getPk().getOrigencatalogcode(), origenTramite.getPk().getOrigencatalog())); + } + } + } + } catch(Throwable e){ + MessageHelper.setMessageError(e); + } + + + } + + /** + * Metodo para listar el listado de documentos para los diferentes critesrios de seleccion + * @param tipoTramite tipo del tramite + * @param tipoAutorizacion tipo de la autorizacion + * @param actividad actividad + * @throws Exception + */ + private void listarDocumentos(TgeneCatalogDetail tipoTramite,TgeneCatalogDetail tipoAutorizacion, TgeneCatalogDetail actividad) throws Exception{ + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())){ + this.cargarDocumentos(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog()); + } + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_actualizacionDeDatos")).getPk().getCatalog())){ + this.cargarTodosDocumentosPersona(); + } + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())){ + this.cargarDocumentos(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_renovacion")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog()); + } + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog())){ + this.cargarDocumentos(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_renovacion")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog()); + } + if(tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_usoactividad"),MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog())){ + this.cargarDocumentos(CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipotramite"),MsgControlArmas.getProperty("ctg_renovacion")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption( MsgControlArmas.getProperty("ctg_tipoautorizacion"),MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog()); + } + if(documentoHabilitante.getLrecord() == null || documentoHabilitante.getLrecord().isEmpty()){ + MessageHelper.setMessageWarn(MsgControlArmas.getProperty("msg_error_noexistendocumentos")); + } + } + + + /** + * Verifica si el trámite ingresado cumple la prevalidación + * TarmTramite tramite es el tramite padre validamos si este tiene codigo alterno + * Creado FPAZMINO + * @return + */ + private boolean procedeTramite(TarmTramite tramite){ + if(tramite.getCtramitepadre() == null && tramite.getCtramitepadrealt() == null){ + return Boolean.TRUE; + } + Boolean procede = Boolean.FALSE; + String msgErrorTramitePadre = ""; + //consulta del tramite padre + TarmTramite tramitePadre = TarmTramiteController.find(tramite.getCtramitepadre() != null ? tramite.getCtramitepadre().toString() : "-1"); + //consulta por tramite padre + if(tramitePadre!=null){ + Boolean debeValidarCaducidad = (tramite.getValidacaducidadpadre()!=null && tramite.getValidacaducidadpadre().equalsIgnoreCase("Y"))?true:false; + //consulta documento habilitante del codigo padre alterno + documentoHabilitante.querydatabaseDocumentosCriterioFiltro(Arrays.asList(tramitePadre), debeValidarCaducidad, cpersona.toString()); + if(documentoHabilitante.getLrecord() != null && !documentoHabilitante.getLrecord().isEmpty()){ + if(tramitePadre.getCtramitepadre() == null && tramitePadre.getCtramitepadrealt() == null){ + return Boolean.TRUE; + } + else{ + procede = procedeTramite(tramitePadre); + } + } else{ + procede = Boolean.FALSE; + msgErrorTramitePadre = MsgControlArmas.getProperty("msg_error_tramite_padre", tramitePadre.getModifiedData().get("tipotramite"), tramitePadre.getModifiedData().get("tipoautorizacion"), tramitePadre.getModifiedData().get("categoria") , tramitePadre.getModifiedData().get("usoactividad")); +// MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_tramite_padre", tramite.getModifiedData().get("tipotramite"), tramite.getModifiedData().get("tipoautorizacion"), tramite.getModifiedData().get("categoria") , tramite.getModifiedData().get("usoactividad"))); + } + } + //consulta del tramite padre alterno, seria el tramite de renovacion + TarmTramite tramitePadreAlterno =TarmTramiteController.find(tramite.getCtramitepadrealt() != null ? tramite.getCtramitepadrealt().toString() : "-1"); + //consulta por tramite padre alterno + if(tramitePadreAlterno!=null && !procede){ + Boolean debeValidarCaducidad = (tramite.getValidacaducidadpadre()!=null && tramite.getValidacaducidadpadre().equalsIgnoreCase("Y"))?true:false; + //consulta documento habilitante del codigo padre alterno + documentoHabilitante.querydatabaseDocumentosCriterioFiltro(Arrays.asList(tramitePadreAlterno), debeValidarCaducidad, cpersona.toString()); + if(documentoHabilitante.getLrecord() != null && !documentoHabilitante.getLrecord().isEmpty()){ + if(tramitePadreAlterno.getCtramitepadre() == null && tramitePadreAlterno.getCtramitepadrealt() == null){ + return Boolean.TRUE; + } + else{ + procede = procedeTramite(tramitePadreAlterno); + } + } else{ + procede = Boolean.FALSE; + msgErrorTramitePadre = MsgControlArmas.getProperty("msg_error_tramite_padre", tramitePadreAlterno.getModifiedData().get("tipotramite"), tramitePadreAlterno.getModifiedData().get("tipoautorizacion"), tramitePadreAlterno.getModifiedData().get("categoria") , tramitePadreAlterno.getModifiedData().get("usoactividad")); +// MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_tramite_padre", tramite.getModifiedData().get("tipotramite"), tramite.getModifiedData().get("tipoautorizacion"), tramite.getModifiedData().get("categoria") , tramite.getModifiedData().get("usoactividad"))); + } + } + + if(!procede && !msgErrorTramitePadre.equalsIgnoreCase("")){ + MessageHelper.setMessageInfo(msgErrorTramitePadre); + } + return procede; + } + + /** + * Verifica si la persona es apta para dicho tramite + * @param tramite + * @return + * @throws Exception + */ + private boolean verificaAptitudPersona(TarmTramite tramite) throws Exception { + boolean verificaApto = Boolean.TRUE; + if(tramite.getRequiereevaluacion() != null && tramite.getRequiereevaluacion().equals(Constant.STR_Y)){ + evaluacionController.addFilter("personcode", cpersona.toString()); + evaluacionController.addFilter("resultado", MsgControlArmas.getProperty("ctg_resultado_aprobado")); + evaluacionController.addFilter("resultadocodigo", MsgControlArmas.getProperty("ctg_resultado_codigo")); + evaluacionController.addFilter("tipoevaluacion", MsgControlArmas.getProperty("ctg_tipo_evaluacion_conocimiento")); + evaluacionController.addFilter("tipoevaluacioncodigo", MsgControlArmas.getProperty("ctg_tipo_evaluacion_codigo")); + evaluacionController.setTipoTest("CONOCIMIENTO"); + evaluacionController.query(); + if(evaluacionController.getLrecord() == null || evaluacionController.getLrecord().isEmpty()){ + verificaApto = Boolean.FALSE; + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_requiere_validacion_tecnica")); + } + evaluacionController.clearAll(); + evaluacionController.addFilter("personcode", cpersona.toString()); + evaluacionController.addFilter("resultado", MsgControlArmas.getProperty("ctg_resultado_aprobado")); + evaluacionController.addFilter("resultadocodigo", MsgControlArmas.getProperty("ctg_resultado_codigo")); + evaluacionController.addFilter("tipoevaluacion", MsgControlArmas.getProperty("ctg_tipo_evaluacion_psicologica")); + evaluacionController.addFilter("tipoevaluacioncodigo", MsgControlArmas.getProperty("ctg_tipo_evaluacion_codigo")); + evaluacionController.setTipoTest("PSICOLOGICA"); + evaluacionController.query(); + if(evaluacionController.getLrecord() == null || evaluacionController.getLrecord().isEmpty()){ + verificaApto = Boolean.FALSE; + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_requiere_validacion_psicologica")); + } + } + return verificaApto; + } + + /** + * Método en el cual se cargan los guardias de seguridad de una determina empresa + * @throws Exception + */ + private void cargaGuardias() throws Exception{ + guardias.addFilter("cempresa", this.cpersona.toString()); + guardias.addFilter("estado", "APT"); + guardias.setRecperpage(3000000); + guardias.query(); + } + + /** + * Método en el cual se cargan las armas de la persona registrada + * @throws Exception + */ + public void cargaArmas() throws Exception { + String estadosarma; + String tipoFab; + armas.setRecperpage(5000); + String fechaCaducidad=null; + estadosarma = tarmTramite.getEstados(); + tipoFab = tarmTramite.getTipofabricacion(); + if(tarmTramite.getTipoautorizacion().equals("3")){//devolucion 3 + armas.addField("sancion", Constant.STR_Y); + armas.addField("personcode", cpersona.toString()); + } + if(estadosarma != null && estadosarma.contains("REN")){ + armas.addField("TRAMITE", tarmTramite); + } + if(tipoFab != null){ + armas.addField("TIPOFABRICACION", tipoFab); + } + + if(tarmTramite.getTipotramite().equals("1")){//primera vez + if(!tarmTramite.getCategoria().equals("1") && //Categoria APERTURA + !tarmTramite.getTipoautorizacion().equals("2") && !tarmTramite.getTipoautorizacion().equals("4")){//tipoautorizacion=CERTIFICADOS 2 GUiA DE LIBRE TRaNSITO 4 + fechaCaducidad=" is null "; + } + }else if(tarmTramite.getTipotramite().equals("3")){//renovacion + fechaCaducidad=" <> null "; + }else if(tarmTramite.getTipotramite().equals("2")){//reimpresion + Date fechaActual= new Date(); + SimpleDateFormat format= new SimpleDateFormat("dd/MM/yyyy"); + fechaCaducidad=" > "+"to_date("+format.format(fechaActual+",'dd/MM/yyyy')"); + } + // CATEGORIA 14 PREVIA IMPORTACION + if(!tarmTramite.getCategoria().equals("14")){ + armas.setLrecord(armas.findxPersona(cpersona.longValue(), estadosarma, tipoFab, tarmTramite.getClase(), fechaCaducidad)); + mostrarFiltroAUCP=Boolean.FALSE; + } + else{ + armas.setLrecord(new ArrayList()); + mostrarFiltroAUCP=Boolean.TRUE; + } + // + listaPersonasDetailVen = new HashSet(); + SetlistaCodigos= new HashSet(); + for(TarmArmas arma: armas.getLrecord()){ + if(arma.getLote()==null){ + arma.setLote(" "); + } + //carga los posibles vendedoeres + if(this.guiaLibreTransito){ + System.out.println("guiaLibreTransito "+guiaLibreTransito); + ListlistaArmas=AuxArmasController.findListXCodigoArma(arma.getCodigoarma()); + if(listaArmas!=null && listaArmas.size()>0){ + for (TarmArmas tarmArmasVendedor : listaArmas) { + System.out.println("arma.getCregistro(): " +tarmArmasVendedor.getModifiedData().get("personcode")); + if(tarmArmasVendedor.getModifiedData().get("personcode")!=null && + !listaCodigos.contains(tarmArmasVendedor.getModifiedData().get("personcode").toString())){ + listaCodigos.add(tarmArmasVendedor.getModifiedData().get("personcode").toString()); + TcustPersonDetail personaDetail=PersonDetailController.find(tarmArmasVendedor.getModifiedData().get("personcode").toString()); + listaPersonasDetailVen.add(personaDetail); + + } + } + } + } + + } + System.out.println("listaPersonasDetailVen: " +listaPersonasDetailVen.size()); + + Collections.sort(armas.getLrecord(), new Comparator() { + public int compare(TarmArmas p1, TarmArmas p2) { + return p1.getLote().compareTo(p2.getLote()); + } + }); + + if(armas.getLrecord() == null || armas.getLrecord().isEmpty()){ + MessageHelper.setMessageWarn(MsgControlArmas.getProperty("msg_error_armas_inexistentes")); + } + } + + /** + * Método en el cual se cargan las agencias de la persona registrada + * @throws Exception + */ + private void cargarAgencias() throws Exception{ + agenciaSucursal.setRecperpage(3000000); + agenciaSucursal.addFilter("personcode", this.cpersona.toString()); + agenciaSucursal.query(); + // agenciaSucursal.record.fautorizacion + } + + /** + * Método en el cual se cargan los documentos habilitantes de la persona registrada + * @throws Exception + */ + private void cargarTodosDocumentosPersona(){ + try { + documentoHabilitante.setRecperpage(3000000); + documentoHabilitante.documentosXPersona(cpersona); + + } catch (Exception e) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_noexistendocumentos")); + return; + + } + } + + /** + * Método en el cual se cargan los documentos habilitantes de la persona registrada + * @throws Exception + */ + private void cargarDocumentos(String tipoTramite, String tipoTramite2, String tipoAutorizacion){ + try { + List listTramites = TarmTramiteController.findPorCriteriosTramite(tipoTramite,tipoTramite2,tipoAutorizacion); +// List listSolicitudes = new ArrayList<>(); +// for(TarmTramite tramite:listTramites){ +// List listSolicitud = SolicitudArmasController.findByPersonaCTramite(cpersona, String.valueOf(tramite.getPk())); +// if(listSolicitud!=null && !listSolicitud.isEmpty()){ +// listSolicitudes.addAll(listSolicitud); +// } +// } + if(listTramites==null || listTramites.isEmpty()){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_noexistendocumentos")); + return; + } + documentoHabilitante.setRecperpage(3000000); + documentoHabilitante.documentosXTramite(listTramites,cpersona); + } catch (Exception e) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_noexistendocumentos")); + return; + + } + } + + /** + * Se almacena las agencias en su tabla + * @throws Exception + */ + public void guardarAgencias() throws Exception { + agenciaSucursal.getRecord().setPersoncode(cpersona); + agenciaSucursal.update(); + agenciaSucursal.save(); + this.cargarAgencias(); + agenciaSucursal.setRecord(null); + } + + /** + * Elimina las agencias sucursales de la base de datos + * @throws Exception + */ + public void eliminarAgencias() throws Exception { + agenciaSucursal.remove(); + agenciaSucursal.update(); + agenciaSucursal.save(); + agenciaSucursal.setRecord(null); + } + + /** + * Guarda las armas + * @throws Exception + */ + public void guardarArmas() throws Exception { + armas.getRegistroArmas().getRecord().setPersoncode(cpersona); +// armas.getRegistroArmas().update(); +// armas.update(); + armas.saveArmaSolicitud(); + if(this.armas.isExisteTipoArmaExplosivo()){ + armas.setRecord(null); + } + } + + /** + * Elimina armas de la base de datos + * @throws Exception + */ + public void eliminarArmas() throws Exception{ + armas.remove(); + armas.update(); + armas.save(); + cargaArmas(); + armas.setRecord(null); + } + + + /** + * Datos de control de ingreso de informacion dado el tipo de tramite. + */ + public void onChangeTipoTramite() throws Exception { + String ctipotramite = solicitud.getRecord().getCcentrocontrol();//getCtipotramite(); + requisitos.consultaPorTipoTramite(ctipotramite); + } + + /** + * Cambia país + */ + public void executePais() { + if(direccion.getMfilelds().get("solcodpais") != null && StringUtils.isNotBlank(direccion.getMfilelds().get("solcodpais").toString())){ + direccion.setLprovinces(ProvinceController.find(direccion.getMfilelds().get("solcodpais").toString())); + direccion.setLcantones(new ArrayList()); + direccion.setLparroquias(new ArrayList()); + direccion.setLcities(new ArrayList()); + } + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvincia() { + if (direccion.getMfilelds().get("solcodpais") != null && StringUtils.isNotBlank(direccion.getMfilelds().get("solcodpais").toString())) { + direccion.setLcantones(CantonController.find(direccion.getMfilelds().get("solcodpais").toString(), direccion.getMfilelds().get("solcodprovincia").toString())); + direccion.setLparroquias(new ArrayList()); + direccion.setLcities(new ArrayList()); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton() { + if (direccion.getMfilelds().get("solcodpais") != null && StringUtils.isNotBlank(direccion.getMfilelds().get("solcodpais").toString())) { + direccion.setLparroquias(ParroquiaController.find(direccion.getMfilelds().get("solcodpais").toString(), direccion.getMfilelds().get("solcodprovincia").toString(), direccion.getMfilelds().get("solcodcanton").toString())); + direccion.setLcities(CityController.find(direccion.getMfilelds().get("solcodpais").toString(), direccion.getMfilelds().get("solcodprovincia").toString(), direccion.getMfilelds().get("solcodcanton").toString())); + } + } + + /** + * Cambio la provincia de origen + */ + public void cambioProvinciasOrigen() { + if(solicitud.getRecord().getCprovinciaorigen() != null){ + this.lcantonOrigen = CantonController.find("EC", solicitud.getRecord().getCprovinciaorigen()); + this.solicitud.getRecord().setCpaisorigen("EC"); + } else{ + this.lcantonOrigen.clear(); + this.solicitud.getRecord().setCpaisorigen(null); + } + } + + /** + * Cambio la provincia destino + */ + public void cambioProvinciaDestino() { + if(solicitud.getRecord().getCprovinciadestino() != null){ + this.lcantonDestino = CantonController.find("EC", solicitud.getRecord().getCprovinciadestino()); + this.solicitud.getRecord().setCpaisdestino("EC"); + } else{ + this.lcantonDestino.clear(); + this.solicitud.getRecord().setCpaisdestino(null); + } + } + + /** + * Metodo que genera el reporte + * @param fila + */ + public void imprimir(){ + boolean flagArmas = false; + boolean flagGuardias = false; + boolean flagAgencia = false; + + if(tarmTramite==null){ + MessageHelper.setMessageError("ERROR NO MANEJADO POR LA APLICACION CONTACTE AL PROVEEDOR"); + return; + } + if(tarmTramite.getRegistroguardia().equalsIgnoreCase("Y")){ + flagGuardias = true; + } + if (tarmTramite.getRegistroarmas().equalsIgnoreCase("Y")) { + flagArmas = true; + } + if (tarmTramite.getRegistroagenciasucursal().equalsIgnoreCase("Y")) { + flagAgencia = true; + } + this.reporteGeneral(csolicitud,flagAgencia,flagArmas,flagGuardias); + + FacesContext context = FacesContext.getCurrentInstance(); + context.addMessage(null, new FacesMessage("RECUERDE", MsgControlArmas.getProperty("msg_recuerdeClickContinuarTramite"))); + } + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + String institucionCentroControl=""; + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres= personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + //cprovincia=tcustPersonAddres.getProvincecode(); + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + this.centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + this.nombreInstitucion=CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + institucionCentroControl=this.nombreInstitucion; + + return institucionCentroControl; + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl(){ + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + public TarmCentroControl obtenerCentro(){ + for(TarmCentroControl centro:this.centroControlList){ + if(this.solicitud.getRecord().getCcentrocontrol().equals(centro.getPk())){ + return centro; + } + } + return null; + } + + public void reporteGeneral(String solicitud,boolean flagAgencia,boolean flagArmas,boolean flagGuardias) { + try { + querydatabase(); + String gradoUsuario =""; + String path = "armas/reports/generalReport"; + String filename="Solicitud"; + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if(grado != null){ + gradoUsuario = grado.getDescription()+" - "+this.responsableCentroControl.getName(); + }else{ + gradoUsuario = "Sin Grado - "+this.responsableCentroControl.getName(); + } + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("csolicitud", solicitud); + + //Obteniendo la solicitud + TarmSolicitud s=SolicitudController.findSolicitudxcodsolicitud(solicitud); + TarmTramite t; + Boolean datosTramiteVacios=false; + + // + if(this.obtenerCentro() != null){ + parameters.put("centroControl", this.obtenerCentro().modifiedData().get("desnombreinstitucion")); + } + + if(s!=null){ + //Obteniendo el tramite + t=TarmTramiteController.find(s.getCtramite().toString()); + + //Obteniendo la solicitud trmite + TarmSolicitudTramite st=TarmSolicitudTramiteController.findPorCSolicitud(solicitud); + + if(t!=null){ + + //No de solicitud + if(st!=null){ + parameters.put("noSolicitud", s.getNumerosolicitud()); + }else{ + parameters.put("noSolicitud", " "); + } + //No de tramite + if(st!=null){ + parameters.put("noTramite", st.getNumerotramite()); + }else{ + parameters.put("noTramite", " "); + } + + //Tipo de tramite + if(t.getModifiedData().get("tipotramite")!=null){ + parameters.put("tipoTramite", t.getModifiedData().get("tipotramite")); + }else{ + parameters.put("tipoTramite", " "); + } + + //Tipo de autorizacion + if(t.getModifiedData().get("tipoautorizacion")!=null){ + parameters.put("tipoAutorizacion", t.getModifiedData().get("tipoautorizacion")); + }else{ + parameters.put("tipoAutorizacion", " "); + } + + //Categoria + if(t.getModifiedData().get("categoria")!=null){ + parameters.put("categoria", t.getModifiedData().get("categoria")); + }else{ + parameters.put("categoria", " "); + } + + //Uso actividad + if(t.getModifiedData().get("usoactividad")!=null){ + parameters.put("usoActividad", t.getModifiedData().get("usoactividad")); + }else{ + parameters.put("usoActividad", " "); + } + + //Cabecera + if(t.getCabecera()!=null){ + parameters.put("cabecera", t.getCabecera()); + }else{ + parameters.put("cabecera", " "); + } + + }else{ + datosTramiteVacios=true; + } + }else{ + datosTramiteVacios=true; + } + + if(datosTramiteVacios){ + parameters.put("noTramite", " "); + parameters.put("tipoTramite", " "); + parameters.put("tipoAutorizacion", " "); + parameters.put("categoria", " "); + parameters.put("usoActividad", " "); + parameters.put("cabecera", " "); + } + + //Obteniendo la direccion + String email=" ",direccion=" "; + List direcciones=PersonAddressController.findAllByPersonCode(s.getPersoncode().toString()); + for (TcustPersonAddress d : direcciones) { + Calendar calendario=Calendar.getInstance(); + calendario.setTime(d.getPk().getDateto()); + if(calendario.get(Calendar.YEAR)==2999){ + if(d.getAddresstypecatalog().equalsIgnoreCase("3")){ + email=d.getAddress(); + }else if(d.getPrincipal()!=null && d.getPrincipal().equalsIgnoreCase("Y")){ + direccion=d.getAddress(); + } + } + } + + //Email + parameters.put("email", email); + + //Direccion + parameters.put("direccion", direccion); + + //Actividad Economica + TcustPersonDetail person = PersonDetailController.find(s.getPersoncode().toString()); + if(person != null && person.getEconimicact() != null){ + parameters.put("actividadeco", person.getEconimicact()); + }else { + parameters.put("actividadeco", ""); + } + + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + parameters.put("flagAgencia", flagAgencia); + parameters.put("flagArmas", flagArmas); + parameters.put("flagGuardias", flagGuardias); + //parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("usuario",PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()).getName()); + parameters.put("codResponsable", this.responsableCentroControl.getPk().getPersoncode()); + + parameters.put("codigoQR",(s!=null?s.getNumerosolicitud():solicitud)+" "+sdf.format(Calendar.getInstance().getTime())+" "+ + gradoUsuario+" "+this.nombreInstitucion); + + String format = "pdf"; + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Abre el LOV de busqueda de importaciones por codigo solicitud (AUCP) + */ + public void openCargaPrevia() { + Map> params = new HashMap<>(); + List lPersoncodeParam = new ArrayList<>(); + lPersoncodeParam.add(detallepersona.getRecord().getPk().getPersoncode().toString()); + params.put("personcode", lPersoncodeParam); + CargasLovController.openLov(params); + } + + /** + * Regresa del LOV de carga + * @param event + */ + public void onReturnCarga(SelectEvent event) { + System.out.println("Retorno del lov carga"); + TarmCarga carga = (TarmCarga) event.getObject(); + filterAUCP=carga.getAucp(); + solicitud.getRecord().setAucp(filterAUCP); + TarmRegistroArmas registro = RegistroArmController.findByCodigo(carga.getCregistro().toString()); + armas.setLrecord(ArmasController.findxRegistro(registro.getPk().toString())); + if(armas.getLrecord()==null){ + armas.setLrecord(new ArrayList()); + } + } + + /** + * Método que valida la persona vendedora + * en las tablas de maia y en la snap + * + */ + public void validarVendedor(){ + tcustPersonDetailVendedor=null; + if(selecionaCodigoVendedor==null){ + MessageHelper.setMessageError("Seleccione el vendedor"); + return; + } + tcustPersonDetailVendedor=PersonDetailController.find(selecionaCodigoVendedor.toString()); + solicitud.getRecord().setNumerodocumentoorigen(tcustPersonDetailVendedor.getIdentification()); + solicitud.getRecord().setTipodocumentoorigen(tcustPersonDetailVendedor.getIdentificationcatalog()); + solicitud.getRecord().setNombrerazonsocialorigen(tcustPersonDetailVendedor.getName()); + /* + if(solicitud.getRecord().getNumerodocumentoorigen()==null || solicitud.getRecord().getTipodocumentoorigen()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselacedulavendedor")); + return; + } + if(solicitud.getRecord().getTipodocumentoorigen().equals(codigoCedula)){ + //----------validamos si es valida la CEDULA + if(!ValidateIdentification.cedula(solicitud.getRecord().getNumerodocumentoorigen())){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalidovendedor")); + return; + } + //envia a buscar en MAIA + tcustPersonDetailVendedor=buscarPersonaMaia(solicitud.getRecord().getNumerodocumentoorigen(),solicitud.getRecord().getTipodocumentoorigen()); + if(tcustPersonDetailVendedor==null){ + //envia a buscar en la SNAP + tcustPersonDetailVendedor=buscarPersonaSnap(solicitud.getRecord().getNumerodocumentoorigen(),solicitud.getRecord().getTipodocumentoorigen()); + } + }else if(solicitud.getRecord().getTipodocumentoorigen().equals(codigoRuc)){ + //----------validamos si es valida el RUC + if(!ValidateIdentification.ruc(solicitud.getRecord().getNumerodocumentoorigen())){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalidovendedor")); + return; + } + //envia a buscar en maia + tcustPersonDetailVendedor=buscarPersonaMaia(solicitud.getRecord().getNumerodocumentoorigen(),solicitud.getRecord().getTipodocumentoorigen()); + if(tcustPersonDetailVendedor==null){ + //envia a buscar en la snap + tcustPersonDetailVendedor=buscarPersonaSnap(solicitud.getRecord().getNumerodocumentoorigen(),solicitud.getRecord().getTipodocumentoorigen()); + } + }else{ + //----------si es PASAPORTE + tcustPersonDetailVendedor=buscarPersonaMaia(solicitud.getRecord().getNumerodocumentoorigen(),solicitud.getRecord().getTipodocumentoorigen()); + if(tcustPersonDetailVendedor==null){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("mg_error_usuarionoencontradovendedor")); + tcustPersonDetailVendedor= new TcustPersonDetail(); + tcustPersonDetailVendedor.setIdentification(solicitud.getRecord().getNumerodocumentoorigen()); + tcustPersonDetailVendedor.setIdentificationcatalog(solicitud.getRecord().getTipodocumentoorigen()); + tcustPersonDetailVendedor.setIdentificationcatalogcode("IDENTIFICATION"); + tcustPersonDetailVendedor.setName(solicitud.getRecord().getNombrerazonsocialorigen()); + //solicitud.getRecord().setNombrerazonsocialorigen(null); + } + } + //validamos que existe la persona en Maia o SNAP + if(tcustPersonDetailVendedor!=null && tcustPersonDetailVendedor.getIdentification()!=null && tcustPersonDetailVendedor.getName()!=null){ + //seteamos el nombre para visualizarle + solicitud.getRecord().setNombrerazonsocialorigen(tcustPersonDetailVendedor.getName()); + }else if(!solicitud.getRecord().getTipodocumentoorigen().equals(codigoPasaporte)){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_usuarionoencontradovendedor")); + tcustPersonDetailVendedor= new TcustPersonDetail(); + solicitud.getRecord().setNombrerazonsocialorigen(null); + } + */ + } + + /** + * Método para validar si la persona existe en la BD de Maia + * @param numeroDocumento + * @param tipoDocumento + * @return TcustPersonDetail + */ + public TcustPersonDetail buscarPersonaMaia(String numeroDocumento, String tipoDocumento){ + return PersonDetailController.findxidentification(numeroDocumento,tipoDocumento); + } + + /** + * Método para obtener los codigos + */ + public String codigos(String parametro){ + TgeneParameters tgeneParameters= ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + /** + * Método para buscar a la persona en la snap + * @param documento + */ + public TcustPersonDetail buscarPersonaSnap(String documento,String tipoDocumento){ + if(tipoDocumento.equals(codigoCedula)){ + Cedula cedula= ClienteCedula.obtenerCedula(documento); + if(cedula!=null){ + TcustPersonDetail detail= new TcustPersonDetail(); + detail.setName(cedula.getNombre()); + detail.setIdentification(cedula.getCedula()); + detail.setIdentificationcatalog("CED"); + detail.setIdentificationcatalogcode("IDENTIFICATION"); + return detail; + }else{ + return null; + } + }else { + Contribuyente contribuyente= ClienteRUC.obtenerRUC(documento); + if(contribuyente!=null){ + TcustPersonDetail detail= new TcustPersonDetail(); + detail.setName(contribuyente.getRazonSocial()); + detail.setIdentification(contribuyente.getNumeroRuc()); + detail.setIdentificationcatalog("RUC"); + detail.setIdentificationcatalogcode("IDENTIFICATION"); + return detail; + }else{ + return null; + } + } + } + + /** + * Entrega el valor de: ltipopersona + * + * @return List + */ + public List getLtipopersona() { + return ltipopersona; + } + + /** + * Entrega el valor de: ltipoidenti + * + * @return List + */ + public List getLtipoidenti() { + return ltipoidenti; + } + + /** + * Entrega el valor de: ltipotramite + * + * @return List + */ + public List getLtipotramite() { + return ltipotramite; + } + + /** + * Entrega el valor de: longitudid + * + * @return Integer + */ + public Integer getLongitudid() { + return longitudid; + } + + /** + * Entrega el valor de: activarRegExIdentificacion + * + * @return boolean + */ + public boolean isActivarRegExIdentificacion() { + return activarRegExIdentificacion; + } + + /** + * Entrega el valor de: solicitud + * + * @return SolicitudArmasController + */ + public SolicitudArmasController getSolicitud() { + return solicitud; + } + + /** + * Fija el valor de: solicitud + * + * @param solicitud Valor a fijar en el atributo. + */ + public void setSolicitud(SolicitudArmasController solicitud) { + this.solicitud = solicitud; + } + + /** + * Entrega el valor de: detallepersona + * + * @return PersonDetailController + */ + public PersonDetailController getDetallepersona() { + return detallepersona; + } + + /** + * Fija el valor de: detallepersona + * + * @param detallepersona Valor a fijar en el atributo. + */ + public void setDetallepersona(PersonDetailController detallepersona) { + this.detallepersona = detallepersona; + } + + /** + * Entrega el valor de: natural + * + * @return PeopleController + */ + public PeopleController getNatural() { + return natural; + } + + /** + * Fija el valor de: natural + * + * @param natural Valor a fijar en el atributo. + */ + public void setNatural(PeopleController natural) { + this.natural = natural; + } + + /** + * Entrega el valor de: direccion + * + * @return PersonAddressController + */ + public PersonAddressController getDireccion() { + return direccion; + } + + /** + * Fija el valor de: direccion + * + * @param direccion Valor a fijar en el atributo. + */ + public void setDireccion(PersonAddressController direccion) { + this.direccion = direccion; + } + + /** + * Entrega el valor de: telefono + * + * @return PersonPhoneController + */ + public PersonPhoneController getTelefono() { + return telefono; + } + + /** + * Fija el valor de: telefono + * + * @param telefono Valor a fijar en el atributo. + */ + public void setTelefono(PersonPhoneController telefono) { + this.telefono = telefono; + } + + /** + * Entrega el valor de: requisitos + * + * @return SolicitudRequisitosController + */ + public SolicitudRequisitosController getRequisitos() { + return requisitos; + } + + /** + * Fija el valor de: requisitos + * + * @param requisitos Valor a fijar en el atributo. + */ + public void setRequisitos(SolicitudRequisitosController requisitos) { + this.requisitos = requisitos; + } + + /** + * Entrega el valor de: flujoiniciado + * + * @return boolean + */ + public boolean isFlujoiniciado() { + return flujoiniciado; + } + + /** + * Entrega el valor de: ocultarBotonInicioFlujo + * + * @return boolean + */ + public boolean isOcultarBotonInicioFlujo() { + return ocultarBotonInicioFlujo; + } + + /** + * Fija el valor de: ocultarBotonInicioFlujo + * + * @param ocultarBotonInicioFlujo Valor a fijar en el atributo. + */ + public void setOcultarBotonInicioFlujo(boolean ocultarBotonInicioFlujo) { + this.ocultarBotonInicioFlujo = ocultarBotonInicioFlujo; + } + + /** + * Entrega el valor de: esaprobacion + * + * @return boolean + */ + public boolean isEsaprobacion() { + return esaprobacion; + } + + public LoginController getLogin() { + return login; + } + + public void setLogin(LoginController login) { + this.login = login; + } + + public UserDetailController getDetalleusuario() { + return detalleusuario; + } + + public void setDetalleusuario(UserDetailController detalleusuario) { + this.detalleusuario = detalleusuario; + } + + public List getLorigenadquisicion() { + return lorigenadquisicion; + } + + public void setLorigenadquisicion(List lorigenadquisicion) { + this.lorigenadquisicion = lorigenadquisicion; + } + + public boolean isIngresarRequisitos() { + return ingresarRequisitos; + } + + public void setIngresarRequisitos(boolean ingresarRequisitos) { + this.ingresarRequisitos = ingresarRequisitos; + } + + public boolean isSeleccionarArmas() { + return seleccionarArmas; + } + + public void setSeleccionarArmas(boolean seleccionarArmas) { + this.seleccionarArmas = seleccionarArmas; + } + + public boolean isSeleccionarGuardias() { + return seleccionarGuardias; + } + + public void setSeleccionarGuardias(boolean seleccionarGuardias) { + this.seleccionarGuardias = seleccionarGuardias; + } + + public boolean isSeleccionarAgencias() { + return seleccionarAgencias; + } + + public void setSeleccionarAgencias(boolean seleccionarAgencias) { + this.seleccionarAgencias = seleccionarAgencias; + } + + public boolean isListarDocumentos() { + return listarDocumentos; + } + + public void setListarDocumentos(boolean listarDocumentos) { + this.listarDocumentos = listarDocumentos; + } + + public RequisitoPorTramiteController getRequisitoPorTramite() { + return requisitoPorTramite; + } + + public void setRequisitoPorTramite( + RequisitoPorTramiteController requisitoPorTramite) { + this.requisitoPorTramite = requisitoPorTramite; + } + + public GuardiasController getGuardias() { + return guardias; + } + + public void setGuardias(GuardiasController guardias) { + this.guardias = guardias; + } + + public SolicitudGuardiasController getSolicitudGuardias() { + return solicitudGuardias; + } + + public void setSolicitudGuardias(SolicitudGuardiasController solicitudGuardias) { + this.solicitudGuardias = solicitudGuardias; + } + + public ArmasController getArmas() { + return armas; + } + + public void setArmas(ArmasController armas) { + this.armas = armas; + } + + public RegistroArmController getRegistroArmas() { + return registroArmas; + } + + public void setRegistroArmas(RegistroArmController registroArmas) { + this.registroArmas = registroArmas; + } + + public AgenciaSucursalController getAgenciaSucursal() { + return agenciaSucursal; + } + + public void setAgenciaSucursal(AgenciaSucursalController agenciaSucursal) { + this.agenciaSucursal = agenciaSucursal; + } + + public RecepcionArmasController getSolicitudArmas() { + return solicitudArmas; + } + + public void setSolicitudArmas(RecepcionArmasController solicitudArmas) { + this.solicitudArmas = solicitudArmas; + } + + public SolicitudAgenciaSucursalController getSolicitudAgenciaSucursal() { + return solicitudAgenciaSucursal; + } + + public void setSolicitudAgenciaSucursal( + SolicitudAgenciaSucursalController solicitudAgenciaSucursal) { + this.solicitudAgenciaSucursal = solicitudAgenciaSucursal; + } + + public TarmSolicitudDocumentoController getSolicitudDocumento() { + return solicitudDocumento; + } + + public void setSolicitudDocumento( + TarmSolicitudDocumentoController solicitudDocumento) { + this.solicitudDocumento = solicitudDocumento; + } + + public DocumentoHabilitanteController getDocumentoHabilitante() { + return documentoHabilitante; + } + + public void setDocumentoHabilitante( + DocumentoHabilitanteController documentoHabilitante) { + this.documentoHabilitante = documentoHabilitante; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public boolean isDeshabilitarPantalla() { + return deshabilitarPantalla; + } + + public void setDeshabilitarPantalla(boolean deshabilitarPantalla) { + this.deshabilitarPantalla = deshabilitarPantalla; + } + + public boolean isMostrarIngresoArmas() { + return mostrarIngresoArmas; + } + + public void setMostrarIngresoArmas(boolean mostrarIngresoArmas) { + this.mostrarIngresoArmas = mostrarIngresoArmas; + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public Boolean getIsEnableGrabar() { + return isEnableGrabar; + } + + public void setIsEnableGrabar(Boolean isEnableGrabar) { + this.isEnableGrabar = isEnableGrabar; + } + + public boolean isActualizaDatosGenerales() { + return actualizaDatosGenerales; + } + + public void setActualizaDatosGenerales(boolean actualizaDatosGenerales) { + this.actualizaDatosGenerales = actualizaDatosGenerales; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + + public boolean isGuiaLibreTransito() { + return guiaLibreTransito; + } + + public void setGuiaLibreTransito(boolean guiaLibreTransito) { + this.guiaLibreTransito = guiaLibreTransito; + } + + public EvaluacionController getEvaluacionController() { + return evaluacionController; + } + + public void setEvaluacionController(EvaluacionController evaluacionController) { + this.evaluacionController = evaluacionController; + } + + public AgenciaArmaController getAgenciaArma() { + return agenciaArma; + } + + public void setAgenciaArma(AgenciaArmaController agenciaArma) { + this.agenciaArma = agenciaArma; + } + + public List getLprovincias() { + return lprovincias; + } + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + public List getLcantonOrigen() { + return lcantonOrigen; + } + + public void setLcantonOrigen(List lcantonOrigen) { + this.lcantonOrigen = lcantonOrigen; + } + + public List getLcantonDestino() { + return lcantonDestino; + } + + public void setLcantonDestino(List lcantonDestino) { + this.lcantonDestino = lcantonDestino; + } + + public List getCentroControlList() { + return centroControlList; + } + + public void setCentroControlList(List centroControlList) { + this.centroControlList = centroControlList; + } + + public List getTipoDocumento() { + return tipoDocumento; + } + + public void setTipoDocumento(List tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } + + public Boolean getMostrarFiltroAUCP() { + return mostrarFiltroAUCP; + } + + public void setMostrarFiltroAUCP(Boolean mostrarFiltroAUCP) { + this.mostrarFiltroAUCP = mostrarFiltroAUCP; + } + + public String getFilterAUCP() { + return filterAUCP; + } + + public void setFilterAUCP(String filterAUCP) { + this.filterAUCP = filterAUCP; + } + + public CargaController getCargaController() { + return cargaController; + } + + public void setCargaController(CargaController cargaController) { + this.cargaController = cargaController; + } + + public Set getListaPersonasDetailVen() { + return listaPersonasDetailVen; + } + + public void setListaPersonasDetailVen( + Set listaPersonasDetailVen) { + this.listaPersonasDetailVen = listaPersonasDetailVen; + } + + public Integer getSelecionaCodigoVendedor() { + return selecionaCodigoVendedor; + } + + public void setSelecionaCodigoVendedor(Integer selecionaCodigoVendedor) { + this.selecionaCodigoVendedor = selecionaCodigoVendedor; + } + + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/TransaccionArmaBodegaController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/TransaccionArmaBodegaController.java.svn-base new file mode 100644 index 0000000..51a221b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/TransaccionArmaBodegaController.java.svn-base @@ -0,0 +1,147 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmTransaccionArmaBodega; + +/** + * Clase controladora del bean TarmTransaccionArmaBodega. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class TransaccionArmaBodegaController extends AbstractController { + + public TransaccionArmaBodegaController() throws Exception { + super(TarmTransaccionArmaBodega.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TRANSACCIONARMABODEGA"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + SubQuery subqueryCentroControlOrig= new SubQuery("TgeneCatalogDetail","description","nombreinstitucionorig", + "i.pk.catalog= (select o.nombreinstitucion from TarmCentroControl o where o.pk=t.ccentrocontrolorigen)" + + " and i.pk.catalogcode=(select o.nombreinstitucioncodigo from TarmCentroControl o where o.pk=t.ccentrocontrolorigen)"); + dto.addSubQuery(subqueryCentroControlOrig); + + SubQuery subqueryCentroControlDest= new SubQuery("TgeneCatalogDetail","description","nombreinstituciondest", + "i.pk.catalog= (select o.nombreinstitucion from TarmCentroControl o where o.pk=t.ccentrocontroldestino)" + + " and i.pk.catalogcode=(select o.nombreinstitucioncodigo from TarmCentroControl o where o.pk=t.ccentrocontroldestino)"); + dto.addSubQuery(subqueryCentroControlDest); + + SubQuery subqueryPaisDes= new SubQuery("TarmCentroControl","provincecode","provincecodeorig", "i.pk=t.ccentrocontrolorigen"); + dto.addSubQuery(subqueryPaisDes); + + SubQuery subqueryNombreinstitucion= new SubQuery("TarmCentroControl","nombreinstitucion","nombreinstitucion", "i.pk=t.ccentrocontrolorigen"); + dto.addSubQuery(subqueryNombreinstitucion); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * + * @param codigo + * @return + */ + public static TarmTransaccionArmaBodega find(String codigo) { + try { + TransaccionArmaBodegaController cc = new TransaccionArmaBodegaController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("cdecomisoarmatransaccion", codigo); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ValidacionTramiteLibreTransitoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ValidacionTramiteLibreTransitoController.java.svn-base new file mode 100644 index 0000000..ff009be --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ValidacionTramiteLibreTransitoController.java.svn-base @@ -0,0 +1,804 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.general.mail.EnvioMail; +import com.fp.general.mail.dto.EnvioCorreoDTO; +import com.fp.general.mail.exception.EnvioMailException; +import com.fp.general.mail.factory.EnvioMailFactory; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ValidacionTramiteLibreTransitoController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 1L; + + TarmSolicitudTramite solicitudTramite=new TarmSolicitudTramite(); + TarmTramite tramite=new TarmTramite(); + TcustPersonDetail detallesPersona=new TcustPersonDetail(); + TarmSolicitudArmas solicitudArmas=new TarmSolicitudArmas(); + + private String provincia; + private String canton; + private String ciudad; + private TgeneParroquia parroquia; + private TcustPersonAddress direccionCliente; + String tipoDireccion=""; + private List lArmas; + private String direccion; + private String estadoTramite; + private String tipoDocumento; + private String tipoTramite; + private String usoActividad; + private String observaciones="Prueba observaciones"; + private String gradoFuncionario=""; + private TcustPersonDetail usuario; + private String nombreInstitucion; + private TarmCentroControl centroControl; + private String csolicitud=""; + private String opcion=""; + private String numeroSolicitud; + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddressController; + + @ManagedProperty(value = "#{tarmSolicitudTramiteController}") + private TarmSolicitudTramiteController tarmSolicitudTramiteController; + + @ManagedProperty(value = "#{tarmSolicitudArmasController}") + private TarmSolicitudArmasController tarmSolicitudArmasController; + + public ValidacionTramiteLibreTransitoController() throws Exception { + super(TarmSolicitud.class); + } + + @PostConstruct + private void postconstruct() { + try { + startQuery(); + this.init(); + // Inicializa autoconsulta + super.getMfilters().clear(); + super.query(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + csolicitud=super.getMfilters().get("csolicitud"); + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "VALIDACIONTRANSITO"; + + // this.csolicitud="1"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @Override + public void query() throws Exception { + // TODO Auto-generated method stub + MessageHelper.setMessageError("msg_notQuery"); + super.query(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + + //Filtrando las armas + tarmSolicitudArmasController.setCsolicitud(csolicitud); + tarmSolicitudArmasController.getMfilters().clear(); + tarmSolicitudArmasController.query(); + + Filter filtro=new Filter("pk", csolicitud); + dto.addFiltro(filtro); + + SubQuery sNumeroTramite= new SubQuery + ("TarmSolicitudTramite", "numerotramite", "ntramite", "i.pk.csolicitud = t.pk"); + dto.addSubQuery(sNumeroTramite); + + SubQuery sEstadoSolicitud= new SubQuery + ("TarmSolicitudTramite", "numerotramite", "ntramite", "i.pk.csolicitud = t.pk"); + dto.addSubQuery(sEstadoSolicitud); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + + //Obteniendo la solicitud + TarmSolicitud solicitud=ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(this.csolicitud); + numeroSolicitud =solicitud.getNumerosolicitud(); + //Obteniendo el tramite + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(record.getPk()); + + if(solicitudTramite!=null && solicitudTramite.getPk().getCtramite()!=null){ + tarmSolicitudTramiteController=new TarmSolicitudTramiteController(); + tarmSolicitudTramiteController.setRecord(solicitudTramite); + tramite=TarmTramiteController.find(solicitudTramite.getPk().getCtramite().toString()); + + //Estado tramite + TgeneCatalogDetail catalogDetailTramite=null; + if(solicitudTramite.getEstadotramite()!=null && solicitudTramite.getEstadotramitecodigo()!=null){ + catalogDetailTramite=CatalogDetailController.findxCodigoCodcatalogo(solicitudTramite.getEstadotramite(), solicitudTramite.getEstadotramitecodigo()); + } + + if(catalogDetailTramite!=null){ + estadoTramite=catalogDetailTramite.getDescription(); + } + + //Tipo tramite + if(tramite.getTipotramite()!=null && tramite.getTipotramitecodigo()!=null){ + catalogDetailTramite=CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + + if(catalogDetailTramite!=null){ + tipoTramite=catalogDetailTramite.getDescription(); + } + + //Uso actividad + catalogDetailTramite=CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + if(catalogDetailTramite!=null && tramite.getUsoactividad()!=null && tramite.getUsoactividadcodigo()!=null){ + usoActividad=catalogDetailTramite.getDescription(); + } + } + } + + //Datos de la persona + detallesPersona = PersonDetailController.find(String.valueOf(record.getPersoncode().toString())); + switch(detallesPersona.getIdentificationcatalog()){ + case "CED": + tipoDireccion = "1"; + break; + case "RUC": + tipoDireccion= "2"; + break; + default: + tipoDireccion= ""; + break; + } + + //Tipo de documento + TgeneCatalogDetail catalogDetailDocumento=null; + if(detallesPersona.getIdentificationcatalog()!=null && detallesPersona.getIdentificationcatalogcode()!=null){ + catalogDetailDocumento=CatalogDetailController.findxCodigoCodcatalogo(detallesPersona.getIdentificationcatalog(), detallesPersona.getIdentificationcatalogcode()); + + if(catalogDetailDocumento!=null){ + tipoDocumento=catalogDetailDocumento.getDescription(); + } + } + + //Obteniendo la direccion del cliente + //this.direccionCliente=personAddressController.findPersonaPorDireccionTipoCatalogo(String.valueOf(record.getPersoncode()), tipoDireccion); + this.direccionCliente=personAddressController.findPrincipal(String.valueOf(record.getPersoncode())) ; + provincia = direccionCliente.modifiedData().get("provincia")==null?null: direccionCliente.modifiedData().get("provincia").toString(); //personAddressController.getLprovinces()==null || personAddressController.getLprovinces().isEmpty()?null:personAddressController.getLprovinces().get(0); + canton = direccionCliente.modifiedData().get("canton")==null?null: direccionCliente.modifiedData().get("canton").toString();//personAddressController.getLcantones()==null || personAddressController.getLcantones().isEmpty()?null:personAddressController.getLcantones().get(0); + ciudad = direccionCliente.modifiedData().get("ciudad")==null?null: direccionCliente.modifiedData().get("ciudad").toString();//personAddressController.getLcities()==null || personAddressController.getLcities().isEmpty()?null:personAddressController.getLcities().get(0); + direccion= direccionCliente.getAddress(); + + //Obteniendo las armas + lArmas = new ArrayList(); + List listaSolicitudArmas=TarmSolicitudArmasController.findPorCSolicitud(record.getPk()); + + for (TarmSolicitudArmas sa : listaSolicitudArmas) { + TarmArmas arma=ArmasController.find(sa.getPk().getCarma(),"REG"); + lArmas.add(arma); + } + + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + //Obteniendo el grado del funcionario + TgeneCatalogDetail grado=CatalogDetailController.findxCodigoCodcatalogo(usuario.getMilitarygrade(), usuario.getMilitarygradecode()); + if(grado!=null){ + gradoFuncionario=grado.getDescription()+" - "; + } + + + //Obteniendo el centro de control + centroControl=CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + if(centroControl!=null && centroControl.getNombreinstitucion()!=null && !centroControl.getNombreinstitucion().isEmpty() + && centroControl.getNombreinstitucioncodigo()!=null && !centroControl.getNombreinstitucioncodigo().isEmpty()){ + + TgeneCatalogDetail catalogoInstitucion=CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()); + this.nombreInstitucion=catalogoInstitucion.getDescription(); + } + + } + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + @SuppressWarnings("unchecked") + protected void querydatabaseSolicitud() { + try { + DtoQuery dto = super.getDtoQuery(true); + + + SubQuery sNumeroTramite= new SubQuery + ("TarmSolicitudTramite", "numerotramite", "ntramite", "i.pk.csolicitud = t.pk"); + dto.addSubQuery(sNumeroTramite); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + + @Override + public void save() { + try { + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + //Aqui se le cambia el estado a TarmSolicitudTramite + //segun se apruebe o se anule + /* + if(condicionAprobado){ + this.tarmSolicitudTramiteController.cambiarEstado(estadoTramiteAprobado, estadoTramiteAprobadoCodigo); + }else{ + this.tarmSolicitudTramiteController.cambiarEstado(estadoTramiteAnulado, estadoTramiteAnuladoCodigo); + }*/ + + DtoSave dtosaveSolicitudTramite = this.tarmSolicitudTramiteController.getDtoSave(); + if(dtosaveSolicitudTramite.pendingProcess()){ + dtosaveSolicitudTramite.setReturnpk(true); + msave.put(this.tarmSolicitudTramiteController.getBeanalias(), dtosaveSolicitudTramite); + } + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.tarmSolicitudTramiteController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Metodo que envia un mail de notificacion de tramite anulado + */ + public void enviarNotificacion(){ + try { + if(this.opcion!=null && !this.opcion.isEmpty() && this.opcion.equalsIgnoreCase("D")){ + String asunto = MsgControlArmas.getProperty("msg_asuntoNotificacionGuiaTranistoAnulada"); + String cuerpo = MessageFormat.format(MsgControlArmas.getProperty("msg_cuerpoNotificacionGuiaTransitoAnulada"), detallesPersona.getName(), + this.record.getModifiedData().get("ntramite"), this.observaciones,this.gradoFuncionario+usuario.getName(),this.nombreInstitucion); + + EnvioCorreoDTO envioCorreo = new EnvioCorreoDTO(); + envioCorreo.setCorreoDesde(MsgControlArmas.getProperty("correoDesde")); + //Cambiar por el correo del cliente + envioCorreo.setCorreoPara(new String[]{MsgControlArmas.getProperty("correoDestino")}); + envioCorreo.setAsunto(asunto); + envioCorreo.setMensajeHTML(cuerpo); + EnvioMail envioMail = EnvioMailFactory.getInstancia(); + envioMail.envioMail(envioCorreo); + + } + completarTarea(); + } catch(EnvioMailException e){ + MessageHelper.setMessageError(new Throwable("Se produjo un error al enviar el correo.")); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("csolicitud", csolicitud); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + if(bpmDataStatus!= null && bpmDataStatus.equals("D")){ + Mapdatosmail = new HashMap(); + datosmail.put("razons",detallesPersona.getName()); + datosmail.put("sol",numeroSolicitud); + datosmail.put("observaciones",bpmDataComment); + //grado funcionario de la persona logeada + TsafeUserDetail userDetailObj=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personDetailObj=PersonDetailController.find(userDetailObj.getPk().getPersoncode().toString()); + datosmail.put("grado",personDetailObj.getMilitarygrade()); + datosmail.put("funcionario",personDetailObj.getName()); + // Centro de control de armas + datosmail.put("centrocontrol",centroControl.getModifiedData().get("desinstitucion")); + request.modifiedData().put("datosmail", datosmail); + } + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Busca una solicitud por su codigo + * @param codigoSolicitud + * @return + */ + public static TarmSolicitud findPorSolicitud(String codigoSolicitud) { + try { + ValidacionTramiteLibreTransitoController cc = new ValidacionTramiteLibreTransitoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", codigoSolicitud); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + /** + * Busca una solicitud por su codigo + * @param codigoSolicitud + * @return + */ + public static TarmSolicitud findPorSolicitudSimple(String codigoSolicitud) { + try { + ValidacionTramiteLibreTransitoController cc = new ValidacionTramiteLibreTransitoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", codigoSolicitud); + cc.querydatabaseSolicitud(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Incrementa el numero del arma + * @param arma + * @return + */ + public int incrementarRowkey(TarmArmas arma){ + int n=0; + + for (int i = 0; i < lArmas.size(); i++) { + if(arma.getPk()==lArmas.get(i).getPk()){ + n=i+1; + break; + } + } + + return n; + } + + /** + * Obtiene los detalles de las armas segun el catalogo + * @param catalogo + * @param catalogoCode + * @return + */ + public String aspectoArmaCatalogo(String catalogo, String catalogoCode){ + if(catalogo!=null && catalogoCode!=null && !catalogo.isEmpty() && !catalogoCode.isEmpty()){ + return CatalogDetailController.findxCodigoCodcatalogo(catalogo, catalogoCode).getDescription(); + } + return null; + } + + /** + * Devuelve una descripcion de catalogo segun un tipo de aspecto + * @param arma + * @param tipoAspecto + * @return + */ + public String aspectoArmaExplosivoCatalogo(TarmArmas arma,String tipoAspecto){ + String aspecto=""; + + try { + TarmTipoArmaExplosivo explosivo=TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo()); + if(explosivo!=null){ + if(tipoAspecto.equalsIgnoreCase("clase") && explosivo.getClase()!=null && !explosivo.getClase().isEmpty() + && explosivo.getClasecodigo()!=null && !explosivo.getClasecodigo().isEmpty()){ + aspecto=CatalogDetailController.findxCodigoCodcatalogo(explosivo.getClase(), explosivo.getClasecodigo()).getDescription(); + + }else if(tipoAspecto.equalsIgnoreCase("tipo") && explosivo.getTipoarmaexplosivo()!=null && !explosivo.getTipoarmaexplosivo().isEmpty() + && explosivo.getTipoarmaexplosivocodigo()!=null && !explosivo.getTipoarmaexplosivocodigo().isEmpty()){ + aspecto=CatalogDetailController.findxCodigoCodcatalogo(explosivo.getTipoarmaexplosivo(), explosivo.getTipoarmaexplosivocodigo()).getDescription(); + + }else if(tipoAspecto.equalsIgnoreCase("calibre") && explosivo.getCalibre()!=null && !explosivo.getCalibre().isEmpty() + && explosivo.getCalibrecodigo()!=null && !explosivo.getCalibrecodigo().isEmpty()){ + aspecto=CatalogDetailController.findxCodigoCodcatalogo(explosivo.getCalibre(), explosivo.getCalibrecodigo()).getDescription(); + } + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + return aspecto; + } + + public TarmTipoArmaExplosivo explosivoPorArma(TarmArmas arma){ + TarmTipoArmaExplosivo explosivo=new TarmTipoArmaExplosivo(); + + try { + explosivo=TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo()); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + return explosivo; + } + + + public TarmSolicitudTramite getSolicitudTramite() { + return solicitudTramite; + } + + public void setSolicitudTramite(TarmSolicitudTramite solicitudTramite) { + this.solicitudTramite = solicitudTramite; + } + + public TarmTramite getTramite() { + return tramite; + } + + public void setTramite(TarmTramite tramite) { + this.tramite = tramite; + } + + public TcustPersonDetail getDetallesPersona() { + return detallesPersona; + } + + public void setDetallesPersona(TcustPersonDetail detallesPersona) { + this.detallesPersona = detallesPersona; + } + + + + public String getProvincia() { + return provincia; + } + + public void setProvincia(String provincia) { + this.provincia = provincia; + } + + public String getCanton() { + return canton; + } + + public void setCanton(String canton) { + this.canton = canton; + } + + public String getCiudad() { + return ciudad; + } + + public void setCiudad(String ciudad) { + this.ciudad = ciudad; + } + + public String getNumeroSolicitud() { + return numeroSolicitud; + } + + public void setNumeroSolicitud(String numeroSolicitud) { + this.numeroSolicitud = numeroSolicitud; + } + + public List getlArmas() { + return lArmas; + } + + public void setlArmas(List lArmas) { + this.lArmas = lArmas; + } + + public PersonAddressController getPersonAddressController() { + return personAddressController; + } + + public void setPersonAddressController( + PersonAddressController personAddressController) { + this.personAddressController = personAddressController; + } + + public TarmSolicitudArmas getSolicitudArmas() { + return solicitudArmas; + } + + public void setSolicitudArmas(TarmSolicitudArmas solicitudArmas) { + this.solicitudArmas = solicitudArmas; + } + + public String getDireccion() { + return direccion; + } + + public void setDireccion(String direccion) { + this.direccion = direccion; + } + + public String getEstadoTramite() { + return estadoTramite; + } + + public void setEstadoTramite(String estadoTramite) { + this.estadoTramite = estadoTramite; + } + + public String getTipoDocumento() { + return tipoDocumento; + } + + public void setTipoDocumento(String tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } + + public String getTipoTramite() { + return tipoTramite; + } + + public void setTipoTramite(String tipoTramite) { + this.tipoTramite = tipoTramite; + } + + public String getUsoActividad() { + return usoActividad; + } + + public void setUsoActividad(String usoActividad) { + this.usoActividad = usoActividad; + } + + public TarmSolicitudTramiteController getTarmSolicitudTramiteController() { + return tarmSolicitudTramiteController; + } + + public void setTarmSolicitudTramiteController( + TarmSolicitudTramiteController tarmSolicitudTramiteController) { + this.tarmSolicitudTramiteController = tarmSolicitudTramiteController; + } + + public TarmSolicitudArmasController getTarmSolicitudArmasController() { + return tarmSolicitudArmasController; + } + + public void setTarmSolicitudArmasController( + TarmSolicitudArmasController tarmSolicitudArmasController) { + this.tarmSolicitudArmasController = tarmSolicitudArmasController; + } + + public TgeneParroquia getParroquia() { + return parroquia; + } + + public void setParroquia(TgeneParroquia parroquia) { + this.parroquia = parroquia; + } + + public TcustPersonAddress getDireccionCliente() { + return direccionCliente; + } + + public void setDireccionCliente(TcustPersonAddress direccionCliente) { + this.direccionCliente = direccionCliente; + } + + public String getTipoDireccion() { + return tipoDireccion; + } + + public void setTipoDireccion(String tipoDireccion) { + this.tipoDireccion = tipoDireccion; + } + + public String getObservaciones() { + return observaciones; + } + + public void setObservaciones(String observaciones) { + this.observaciones = observaciones; + } + + public String getGradoFuncionario() { + return gradoFuncionario; + } + + public void setGradoFuncionario(String gradoFuncionario) { + this.gradoFuncionario = gradoFuncionario; + } + + public TcustPersonDetail getUsuario() { + return usuario; + } + + public void setUsuario(TcustPersonDetail usuario) { + this.usuario = usuario; + } + + public String getNombreInstitucion() { + return nombreInstitucion; + } + + public void setNombreInstitucion(String nombreInstitucion) { + this.nombreInstitucion = nombreInstitucion; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public String getOpcion() { + return opcion; + } + + public void setOpcion(String opcion) { + this.opcion = opcion; + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ValidarDepositoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ValidarDepositoController.java.svn-base new file mode 100644 index 0000000..acf0d88 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/ValidarDepositoController.java.svn-base @@ -0,0 +1,879 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.CargaController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.IngresoDatosTipoTramite; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.date.TgeneNotAccountingDayController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.ConvertNumberToText; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmAgenciaArma; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora para la validacion del deposito + * + * @author CHRISTIAN PAZMINO + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ValidarDepositoController extends AbstractController { + /** + * Codigo de solicitud + */ + private String csolicitud; + /** + * Variable del tipo TgeneCatalogDetail(catalogo del tramite) + */ + private TgeneCatalogDetail nombreTramite; + /** + * Variable del tipo TgeneCatalogDetail(catalogo de la categoria) + */ + private TgeneCatalogDetail nombreCategoria; + /** + * Variable del tipo TgeneCatalogDetail(catalogo del uso actividad del tramite) + */ + private TgeneCatalogDetail nombreUsoActividad; + /** + * Opciones de aceptar o rechazar + */ + private List accionList; + /** + * Propiedad usada para el manejo del Alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + /** + * Propiedad usada para el manejo del numero de armas de la solicitud + */ + @ManagedProperty(value = "#{recepcionArmasController}") + private RecepcionArmasController recepcionArmasController; + /** + * Propiedad usada para el manejo del centro de control de armas + */ + @ManagedProperty(value = "#{centroControlArmasController}") + private CentroControlArmasController centroControlArmasController; + /** + * controlador de la solicitud + */ + @ManagedProperty(value = "#{solicitudArmasController}") + private SolicitudArmasController solicitudMP; + + /** + * Propiedad usada para el manejo de reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + /** + * Controlador que maneja las armas asociadas a las agencias + */ + @ManagedProperty(value="#{agenciaArmaController}") + private AgenciaArmaController agenciaArma; + + /** + * Controlador que maneja cargas para previa importacion + */ + @ManagedProperty(value = "#{cargaController}") + private CargaController cargaController; + + /** + * Propiedad usada para el manejo de la solicitud actual + */ + private TarmSolicitud solicitud; + /** + * Accion tomada por el usuario, aprobar o rechazar + */ + private String accionTomada; + /** + * Constante usada para referirse a la opcion general aprobar + */ + private final String APROBAR = "APR"; + /** + * Constante usada para referirse a la opcion general rechazar + */ + private final String REPROBAR = "RECH"; + /** + * Constante usada para referirse a la opcion aprobar deposito + */ + private final String APROBAR_DEPOSITO = "APBDEP"; + /** + * Constante usada para referirse a la opcion rechazar deposito + */ + private final String ANULAR_DEPOSITO = "ANUDEP"; + /** + * Propiedad usada para el manejo del tramite actual + */ + private TarmTramite tramite; + /** + * Fecha de atencion del proximo tramite + */ + private Date fechaAtencionTramite; + /** + * Variable que indica si el usuario esta negado para continuar en la pantalla + */ + private Boolean isDenied; + /** + * Variable auxiliar usada para diferenciar cuando se presenta o no el mensaje de validacion de fecha expiracion solicitud + */ + private Boolean isOnlyMsj; + /** + * Obtiene el centro d control de armas de la solicitud actual + */ + private TarmCentroControl centroControlObj; + /** + * Bandera de tipo booleano para indicar si se habilita el boton de completar tarea + */ + private Boolean isEnableCompletarTarea= Boolean.FALSE; + + /** + * Nombre del centro de control + */ + private String nombreCentroControl; + + private Boolean requiereNoSolAucpBln; + + private Boolean btnImprimir; + public ValidarDepositoController() throws Exception { + super(TarmSolicitudTramite.class); + } + + @PostConstruct + private void postconstruct() { + super.startQuery(); + csolicitud = this.getMfilters().get("csolicitud"); + this.getMfilters().clear(); + init(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + this.beanalias = "VALIDARDEPOSITO"; + // Recuperamos el centro de control de armas correspondiente al solicitante + accionList=CatalogDetailController.find("ACCION"); + this.record = SolicitudTramiteController.findByCSolicitud(csolicitud); + isOnlyMsj = false; + btnImprimir=Boolean.FALSE; + requiereNoSolAucpBln=Boolean.FALSE; + try { + isDenied = true; + if(record!=null){ + solicitud = SolicitudArmasController.find(csolicitud); + if(solicitud!=null && solicitud.getCtramite()!=null){ + + tramite = IngresoDatosTipoTramite.find(solicitud.getCtramite().toString()); + if(tramite!=null){ + //Tramite + nombreTramite= CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + nombreCategoria= CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + nombreUsoActividad= CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + if(tramite.getCategoria().equals("14")){ + requiereNoSolAucpBln=Boolean.TRUE; + }else{ + requiereNoSolAucpBln=Boolean.FALSE; + } + } + else{ + MessageHelper.setMessageError("NO EXISTE UN TIPO DE TR\u00c1MITE ASOCIADO A LA SOLICITUD"); + return; + } + } + else{ + MessageHelper.setMessageError("NO EXISTE UNA SOLICITUD ASOCIADA AL TR\u00c1MITE"); + return; + } + //Obteniendo el centro de control +// TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); +// PersonAddressController direccion = new PersonAddressController(); +// TcustPersonAddress tcustPersonAddres= direccion.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); +// TarmCentroControlJur jurisdiccionCentroControl; +// jurisdiccionCentroControl= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControlObj = CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + this.setNombreCentroControl(CatalogDetailController.findxCodigoCodcatalogo( centroControlObj.getNombreinstitucion(), + centroControlObj.getNombreinstitucioncodigo()).getDescription()); + } + else{ + MessageHelper.setMessageError("NO EXISTE EL TR\u00c1MITE EN LA BASE DE DATOS"); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que devuelve el centro de control al que pertenece el cliente dueno de la solicitud + * @throws Exception + */ +// private String obtenerCentroControlSolicitante() throws Exception { +// PersonAddressController personAddressController = new PersonAddressController(); +// TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(solicitud.getPersoncode().toString()); +// TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); +// TarmCentroControl centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); +// String institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); +// return institucionCentroControl; +// } + + /** + * ? + */ + public void cancelar(){ + init(); + } + + /** + * Genera la fecha disponible para el proximo tramite en el centro de control de armas respectivo + */ + public void generarFechaProximoTramite(){ + try { + // Validamos si ya existe una fecha para realizar el proximo tramite + centroControlObj.isnew = false; + Date fechaActual=new Date(Calendar.getInstance().getTimeInMillis()); + if(centroControlObj.getFechaproximotramite()==null || centroControlObj.getFechaproximotramite().before(fechaActual)){ + fechaAtencionTramite = TgeneNotAccountingDayController.diasLaborablesPosterioresAUnaFecha(new Date(), 1); + }else{ + fechaAtencionTramite = centroControlObj.getFechaproximotramite(); + } + // Numero de armas de la solicitud + ListarmasList = RecepcionArmasController.findPorSolicitud(csolicitud); + int numArmasSolicitud = armasList.size(); + int salvedad = 10; + int capacidadCentroUltDia = 0; + if(centroControlObj.getCuposlibresultimodia()!=null){ + capacidadCentroUltDia = centroControlObj.getCuposlibresultimodia(); + } + else{ + capacidadCentroUltDia = centroControlObj.getTramitespordia(); + } + // Si la capacidad del centro en el ultimo dia es mayor al numero de armas a revisarse + if(numArmasSolicitud < capacidadCentroUltDia){ + centroControlObj.setCuposlibresultimodia(capacidadCentroUltDia - numArmasSolicitud); + centroControlArmasController.update(centroControlObj); + centroControlArmasController.save(); + + } + else if((numArmasSolicitud == capacidadCentroUltDia) || (numArmasSolicitud <= (capacidadCentroUltDia + salvedad))){ + // Si la capacidad del centro es igual al numero de armas a revisarse o ajusta cupo con la salvedad + centroControlObj.setCuposlibresultimodia(centroControlObj.getTramitespordia()); + Date newFechaAtencionTramite = TgeneNotAccountingDayController.diasLaborablesPosterioresAUnaFecha(fechaAtencionTramite, 1); + centroControlObj.setFechaproximotramite(new java.sql.Date(newFechaAtencionTramite.getTime())); + centroControlArmasController.update(centroControlObj); + centroControlArmasController.save(); + + } + else{ + // Cociente y residuo para los casos donde se tiene 50 armas o mas a tramitarse + int diasRequeridos = numArmasSolicitud/centroControlObj.getTramitespordia(); + // Requerido para el calculo de los cupos disponibles para el ultimo dia + int residuoDiasRequeridos = numArmasSolicitud%centroControlObj.getTramitespordia(); + fechaAtencionTramite = TgeneNotAccountingDayController.diasLaborablesPosterioresAUnaFecha(fechaAtencionTramite, 1); + Date newFechaAtencionTramite; + + centroControlObj.setCuposlibresultimodia(centroControlObj.getTramitespordia()-residuoDiasRequeridos); + newFechaAtencionTramite = TgeneNotAccountingDayController.diasLaborablesPosterioresAUnaFecha(fechaAtencionTramite, diasRequeridos); + + centroControlObj.setFechaproximotramite(new java.sql.Date(newFechaAtencionTramite.getTime())); + centroControlArmasController.update(centroControlObj); + centroControlArmasController.save(); + + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + + } + } + + /** + * Método para finalizar la tarea del flujo + */ + public void completarTarea() { + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("csolicitud", csolicitud); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + // Completar tarea en el flujo + Mapdatosmail = new HashMap(); + if(accionTomada.equalsIgnoreCase(APROBAR)){ + request.modifiedData().put("BPMStatus", "A"); + if(tramite!=null && tramite.getTipotramite()!=null){ + // En el caso de permisos enviamos una notificacion al cliente con algunos parametros adicionales + if(tramite.getTipoautorizacion().equalsIgnoreCase("6")){ + datosmail.put("razonsocial",solicitud.getModifiedData().get("nombre")); +// datosmail.put("csolicitud",csolicitud); +// datosmail.put("numcomprobante",record.getNumerocomprobante()); + TsafeUserDetail userDetailObj=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personDetailObj=PersonDetailController.find(userDetailObj.getPk().getPersoncode().toString()); + // Datos del funcionario que valida + datosmail.put("funcionario",personDetailObj.getName()); + datosmail.put("grado",personDetailObj.getMilitarygrade()==null?"":personDetailObj.getMilitarygrade()); + String nombreCCA = CatalogDetailController.findxCodigoCodcatalogo(centroControlObj.getNombreinstitucion(), centroControlObj.getNombreinstitucioncodigo()).getDescription(); + datosmail.put("nombreCCA",nombreCCA); + datosmail.put("nombreCCACliente",nombreCCA); + datosmail.put("numeroTramite",solicitud.getNumerosolicitud().replace("SOL", "TRA")); + generarFechaProximoTramite(); + SimpleDateFormat sdf = new SimpleDateFormat(MsgGeneral.getProperty("dateformat")); + datosmail.put("fechaGenerada",sdf.format(fechaAtencionTramite)); + } + } + }else{ + request.modifiedData().put("BPMStatus", "D"); + datosmail.put("razonsocial",solicitud.getModifiedData().get("nombre")); + datosmail.put("numeroSolicitud",solicitud.getNumerosolicitud()); + datosmail.put("numcomprobante",record.getNumerocomprobante()); + TsafeUserDetail userDetailObj=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personDetailObj=PersonDetailController.find(userDetailObj.getPk().getPersoncode().toString()); + // Datos del funcionario que valida + datosmail.put("funcionario",personDetailObj.getName()); + datosmail.put("grado",personDetailObj.getMilitarygrade()==null?"":personDetailObj.getMilitarygrade()); + String nombreCCA = CatalogDetailController.findxCodigoCodcatalogo(centroControlObj.getNombreinstitucion(), centroControlObj.getNombreinstitucioncodigo()).getDescription(); + datosmail.put("nombreCCA",nombreCCA); + + } + request.modifiedData().put("datosmail", datosmail); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + btnImprimir=Boolean.FALSE; + if(!accionTomada.equalsIgnoreCase(APROBAR)){ + saveAnularSolicitud(); + } + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + isDenied = true; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Throwable e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public void saveAnularSolicitud() { + try { + // CATEGORIA 14 PREVIA IMPORTACION + if(tramite.getCategoria().equals("14")){ + desasociarCargaSolicitud(); + } + //Poner la solicitud en estado anulado deposito + solicitud.setEstado("ANUDEP"); + solicitud.setAucp(null); + solicitudMP.setRecord(solicitud); + solicitudMP.update(); + DtoSave dtoSolicitud = solicitudMP.getDtoSave(); + + if(record!=null){ + record.setIsnew(false); + record.setEstadotramite("ANUDEP"); + super.update(); + } + + //Desasociar las armas en apertura de agencias y apertura de sucursales + if(solicitud.getCtramite()==44 || solicitud.getCtramite()==48){ + List armasSolicitudList = RecepcionArmasController.findPorSolicitud(solicitud.getPk()); + for(TarmSolicitudArmas armaObj:armasSolicitudList){ + + // Codigo agencia de la solicitud + ListsolicitudAgenciaLst = SolicitudAgenciaSucursalController.findPorSolicitud(solicitud.getPk()); + for(TarmSolicitudAgenciaSucursal solicitudAgenciaSucursalObj:solicitudAgenciaLst){ + String cAgencia = solicitudAgenciaSucursalObj.getPk().getCagencia().toString(); + TarmAgenciaArma agenciaArmaObj = AgenciaArmaController.findByCArma(armaObj.getPk().getCarma(), cAgencia); + agenciaArma.setRecord(agenciaArmaObj); + agenciaArma.remove(); + } + } + } + + DtoSave dtoSolicitudTramite = this.getDtoSave(); + DtoSave dtoAgenciaArma = agenciaArma.getDtoSave(); + + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + msave.put(solicitudMP.getBeanalias(), dtoSolicitud); // adicionar metadata de mantenimiento para cada tabla. + msave.put(this.getBeanalias(), dtoSolicitudTramite); + msave.put(agenciaArma.getBeanalias(), dtoAgenciaArma); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + solicitudMP.postCommit(resp); + agenciaArma.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void desasociarCargaSolicitud(){ + try{ + TarmCarga carga = CargaController.findByAUCP(solicitud.getAucp()); + if(carga!=null){ + carga.setCsolicitud(null); + cargaController.update(carga); + cargaController.save(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + super.update(); + DtoSave dtosave = super.getDtoSave(); + HashMap msave = new HashMap(); + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + if(accionTomada.equalsIgnoreCase(APROBAR)){ + record.setEstadotramite(APROBAR_DEPOSITO); + btnImprimir=Boolean.TRUE; + }else{ + record.setEstadotramite(ANULAR_DEPOSITO); + } + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + isDenied = true; + isEnableCompletarTarea = Boolean.TRUE; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Throwable e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + protected void querydatabase() { + try { + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Consulta y retorna el codigo de un aprobado + */ + public String codigoAceptado() throws Exception { + TgeneParameters f = ParametersController.find("ACEPTADO", "1"); + return f.getTextvalue(); + } + + /** + * Retorna la ruta de documento base en donde se almacenará dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(solicitud.getFregistro()); + StringBuilder ruta = new StringBuilder("cm:Solicitudes"); + ruta = ruta.append("/cm:").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + return ruta.toString(); + } + + /** + * Metodo para validar el valor a pagar + */ + public void validarValorDelDeposito(){ + if(record.getValorapagar().compareTo(record.getValorverificado())!=0){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_vVerificDiferenteDeVAPagar")); + } + } + + /** + * Genera el reporte del comprobante de caja + * @param name Nombre del reporte a generar. + */ + public void generateReport() { + String path = "armas/reports/comprobanteCaja"; + String filename=MsgControlArmas.getProperty("lbl_comprobanteCaja"); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //RUC de COMACO + String rucComaco="-"; + TgeneParameters parametroRUC=ParametersController.find("RUCCOMACO", "1"); + if(parametroRUC!=null){ + rucComaco=parametroRUC.getTextvalue(); + } + parameters.put("rucComaco", rucComaco); + + //Nombre centro + parameters.put("nombreCentro", this.getNombreCentroControl()); + + //No comprobante + String noComprobante="-"; + TarmSolicitudTramite solicitudTramite=SolicitudTramiteController.findByCSolicitud(this.solicitud.getPk()); + if(solicitudTramite!=null){ + noComprobante=solicitudTramite.getNumerotramite(); + } + parameters.put("noComprobante", noComprobante); + + //Fecha de emision + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("fechaSistema", sdf.format(Calendar.getInstance().getTime())); + + //Ruc del usuario + if(this.solicitud.getModifiedData().get("identification")!=null){ + parameters.put("ruc", this.solicitud.getModifiedData().get("identification")); + }else { + parameters.put("ruc", " "); + } + + //Nombre-razon social + if(this.solicitud.getModifiedData().get("nombre")!=null){ + parameters.put("nombreRazon", this.solicitud.getModifiedData().get("nombre")); + }else { + parameters.put("nombreRazon", " "); + } + + + //Cantidad en letras + String cantidadLetras= ConvertNumberToText.convertNumberToLetter(this.record.getValorapagar().toString()); + parameters.put("cantidadLetras", cantidadLetras); + + //Tramite-categoria-uso + if(this.nombreTramite!=null && this.nombreCategoria!=null && this.nombreUsoActividad!=null){ + parameters.put("tramiteCategoriaUso", this.nombreTramite.getDescription()+"-"+this.nombreCategoria.getDescription()+"-"+this.nombreUsoActividad.getDescription()); + }else { + parameters.put("tramiteCategoriaUso", " "); + } + + + //No comprobante del deposito + String noComprobanteDeposito=this.record.getNumerocomprobante().replace("-", "").toLowerCase(); + Boolean caracterEliminado=false; + for (int i = 0; i < noComprobanteDeposito.length(); i++) { + if(caracterEliminado){ + i=0; + caracterEliminado=false; + } + if(noComprobanteDeposito.toCharArray()[i]!='0' && noComprobanteDeposito.toCharArray()[i]!='1' && noComprobanteDeposito.toCharArray()[i]!='2' + && noComprobanteDeposito.toCharArray()[i]!='3' && noComprobanteDeposito.toCharArray()[i]!='4' && noComprobanteDeposito.toCharArray()[i]!='5' + && noComprobanteDeposito.toCharArray()[i]!='6' && noComprobanteDeposito.toCharArray()[i]!='7' && noComprobanteDeposito.toCharArray()[i]!='8' + && noComprobanteDeposito.toCharArray()[i]!='9'){ + + String caracterExtranno=""; + caracterExtranno+=noComprobanteDeposito.toCharArray()[i]; + noComprobanteDeposito=noComprobanteDeposito.replace(caracterExtranno, ""); + caracterEliminado=true; + } + } + parameters.put("noComprobanteDeposito", noComprobanteDeposito); + + //Banco-cuenta + String banco="-"; + TgeneParameters parametroBanco=ParametersController.find("BANCODEPOSITO", "1"); + if(parametroBanco!=null){ + banco=parametroBanco.getTextvalue(); + } + + String cuenta="-"; + TgeneParameters parametroCuenta=ParametersController.find("CUENTADEPOSITO", "1"); + if(parametroCuenta!=null){ + cuenta=parametroCuenta.getTextvalue(); + } + + //Banco-Cuenta + parameters.put("banco", "Banco "+banco+" "+"No. "+cuenta); + + //Valor deposito + parameters.put("valorDeposito", this.record.getValorapagar().toString()); + + //Fecha deposito + parameters.put("fechaDeposito", sdf.format(this.record.getFechacomprobante())); + + String format = "pdf"; + + try { + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public TgeneCatalogDetail getNombreTramite() { + return nombreTramite; + } + + public void setNombreTramite(TgeneCatalogDetail nombreTramite) { + this.nombreTramite = nombreTramite; + } + + public TgeneCatalogDetail getNombreCategoria() { + return nombreCategoria; + } + + public void setNombreCategoria(TgeneCatalogDetail nombreCategoria) { + this.nombreCategoria = nombreCategoria; + } + + public TgeneCatalogDetail getNombreUsoActividad() { + return nombreUsoActividad; + } + + public void setNombreUsoActividad(TgeneCatalogDetail nombreUsoActividad) { + this.nombreUsoActividad = nombreUsoActividad; + } + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + public Boolean getIsDenied() { + return isDenied; + } + + public void setIsDenied(Boolean isDenied) { + this.isDenied = isDenied; + } + + public Boolean getIsOnlyMsj() { + return isOnlyMsj; + } + + public void setIsOnlyMsj(Boolean isOnlyMsj) { + this.isOnlyMsj = isOnlyMsj; + } + + public List getAccionList() { + return accionList; + } + + public void setAccionList(List accionList) { + this.accionList = accionList; + } + + public String getAccionTomada() { + return accionTomada; + } + + public void setAccionTomada(String accionTomada) { + this.accionTomada = accionTomada; + } + + public RecepcionArmasController getRecepcionArmasController() { + return recepcionArmasController; + } + + public void setRecepcionArmasController( + RecepcionArmasController recepcionArmasController) { + this.recepcionArmasController = recepcionArmasController; + } + + public CentroControlArmasController getCentroControlArmasController() { + return centroControlArmasController; + } + + public void setCentroControlArmasController( + CentroControlArmasController centroControlArmasController) { + this.centroControlArmasController = centroControlArmasController; + } + + public Boolean getIsEnableCompletarTarea() { + return isEnableCompletarTarea; + } + + public void setIsEnableCompletarTarea(Boolean isEnableCompletarTarea) { + this.isEnableCompletarTarea = isEnableCompletarTarea; + } + + /** + * Metodo utilizado para determinar la accion a tomar, de forma automatica la accion es reprobar en caso de encontrarse un valor de deposito incorrecto + */ + public void aceptar(){ + if(record.getValorapagar().compareTo(record.getValorverificado())!=0){ + accionTomada = REPROBAR; + isDenied = true; + }else{ + accionTomada = ""; + isDenied = false; + } + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TarmTramite getTramite() { + return tramite; + } + + public void setTramite(TarmTramite tramite) { + this.tramite = tramite; + } + + public Date getFechaAtencionTramite() { + return fechaAtencionTramite; + } + + public void setFechaAtencionTramite(Date fechaAtencionTramite) { + this.fechaAtencionTramite = fechaAtencionTramite; + } + + public TarmCentroControl getCentroControlObj() { + return centroControlObj; + } + + public void setCentroControlObj(TarmCentroControl centroControlObj) { + this.centroControlObj = centroControlObj; + } + + public String getAPROBAR() { + return APROBAR; + } + + public String getREPROBAR() { + return REPROBAR; + } + + public String getAPROBAR_DEPOSITO() { + return APROBAR_DEPOSITO; + } + + public String getANULAR_DEPOSITO() { + return ANULAR_DEPOSITO; + } + + public Boolean getBtnImprimir() { + return btnImprimir; + } + + public void setBtnImprimir(Boolean btnImprimir) { + this.btnImprimir = btnImprimir; + } + + public SolicitudArmasController getSolicitudMP() { + return solicitudMP; + } + + public void setSolicitudMP(SolicitudArmasController solicitudMP) { + this.solicitudMP = solicitudMP; + } + + public AgenciaArmaController getAgenciaArma() { + return agenciaArma; + } + + public void setAgenciaArma(AgenciaArmaController agenciaArma) { + this.agenciaArma = agenciaArma; + } + + public CargaController getCargaController() { + return cargaController; + } + + public void setCargaController(CargaController cargaController) { + this.cargaController = cargaController; + } + + public Boolean getRequiereNoSolAucpBln() { + return requiereNoSolAucpBln; + } + + public void setRequiereNoSolAucpBln(Boolean requiereNoSolAucpBln) { + this.requiereNoSolAucpBln = requiereNoSolAucpBln; + } + + public String getNombreCentroControl() { + return nombreCentroControl; + } + + public void setNombreCentroControl(String nombreCentroControl) { + this.nombreCentroControl = nombreCentroControl; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/VerificacionBodegaController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/VerificacionBodegaController.java.svn-base new file mode 100644 index 0000000..de2c1b4 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/VerificacionBodegaController.java.svn-base @@ -0,0 +1,1120 @@ +package com.fp.frontend.controller.armas.solicitud; + + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; +import javax.faces.model.SelectItem; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.parmas.soli.TarmTransaccionArmaBodega; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TarmDecomisoArma. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class VerificacionBodegaController extends AbstractController { + + /** + * prefijo para la generacion del numero de transaccion + */ + private static final String prefijo="REC"; + + @ManagedProperty(value = "#{decomisoArmaTransaccionController}") + private DecomisoArmaTransaccionController decomisoArmaTransaccionController; + + @ManagedProperty(value = "#{transaccionArmaBodegaController}") + private TransaccionArmaBodegaController transaccionArmaBodegaController; + + @ManagedProperty(value = "#{bodegaController}") + private BodegaController bodegaController; + + @ManagedProperty(value = "#{decomisoController}") + private DecomisoController decomisoController; + + /** + * Controlador para generar el reporte + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + /** + * Controlador para caragar el archivo al alfresco + */ + @ManagedProperty(value="#{alfrescoController}") + private AlfrescoController alfrescoController; + + private Boolean isCentroDpto = Boolean.FALSE; + + /** + * ruta para cargar el archivo + */ + private String xpathflujo; + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ +// private List linstitucion; + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ +// private List lnombreInstitucion; + /** + * Fecha de corte + */ + private Date fechaCorte; + /** + * Codigo del centro de control + */ + private String codigoOrganismoControl; + /** + * codigo de la unidad de control + */ + private String codigoUnidadControl; + /** + * numero de custodia del arma + */ +// private String numeroDecomiso; + + private String numerotransaccionEnvio; + /** + * atributo con los datos del usuario logeado + */ + private TsafeUserDetail userDetail; + /** + * catalogo de tipos de reporte + */ + private List lTipoReporte; + /** + * atributo para habilitar o desabilitar al boton + * guaradr + */ + private Boolean btnSave; + /** + * Deshabilita la pantalla después de grabar la solicitud + */ + private boolean btnSelTodos; + /** + * Deshabilita la pantalla después de grabar la solicitud + */ + private boolean cmbTransaccionenvio; + /** + * atributo para habilitar o desabilitar al boton + * genera acta + */ + private Boolean btnGenerarActa; + /** + * Atributo para el numero de transacion + * de recibido que se genera al pulsar el + * boton generar acta + */ + private String numRecepcionGenerado; + /** + * Atributo para el numero de transacion + * de recibido que se genera al pulsar el + * boton generar acta + */ + private String numRecepcionGeneradoAux; + /** + * clave primaria de la tabla TarmDecomisoArmaTransaccion + */ + private String numerotransaccionpk; + /** + * clave primaria de la tabla TarmDecomisoArmaTransaccion + */ + private String numerotransaccionpkAux; + /** + * fecha con la que se realizo el reporte + */ + private Date fechaCorteg; + /** + * formato del reporte PDF + */ + private String format; + /** + * Tipo de reporte PDF + */ + private String tipoReporte; + /** + * centro de control + */ + private TarmCentroControl centroControl; + /** + * nombre del centro de control + */ + private String institucionCentroControl; + /** + * nombre del centro de control + */ + private String instiCentroControlCode; + /** + * codigo del decomiso del catalogo ESTADOARMA + */ + private String codigoDecomiso; + /** + * codigo de la incautacion del catalogo ESTADOARMA + */ + private String codigoIncautacion; + /** + * codigo de entrega voluntaria del catalogo ESTADOARMA + */ + private String entregaVoluntaria; + /** + * codigo de abandono del catalogo ESTADOARMA + */ + private String abandono; + /** + * codigo del reclamo del catalogo ESTADOARMA + */ + private String codigoReclamo; + /** + * codigo de la provincia del usuario que se logeo + */ + private String cprovincia; + + private Boolean itemsUnidadBolean; + + //Manu + /** + * centro de control destino + */ + private String organismoControlDestino; + /** + * codigo de la unidad de control + */ + private String unidadControlDestino; + /** + * unidad de control destino + */ + private String codigoUnidadControlDestino; + + private String centroControlOrigenStr; + private String unidadOrigenStr; + /** + * estado operacion del decomiso del catalogo ESTADOARMA + */ + private String estadoOperacion; + + private ListitemUnidadDestino; + private List listaEnviosRealizados; + + public VerificacionBodegaController() throws Exception { + super(TarmDecomisoArma.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 100000; // Cambiar al # reg a mirar. + lrecord = new ArrayList(); + beanalias = "DECOMARMTRANRECECCION"; + //boton desabilitado + btnSave=Boolean.TRUE; + btnGenerarActa=Boolean.TRUE; + btnSelTodos = Boolean.TRUE; + cmbTransaccionenvio = Boolean.TRUE; + //fecha actual para el corte + fechaCorte=new Date(); + //CARGA DE CATALOGOS +// linstitucion=CatalogDetailController.find("INSTITUCION"); + lTipoReporte = CatalogDetailController.find("TIPOREPORTE"); + //obtiene el centro de control + obtenerCentroControl(); + format = "pdf"; + numerotransaccionpk=null; + codigoDecomiso=codigos("CODIGO.DECOMISADA");//DEC + codigoIncautacion=codigos("CODIGO.INCAUTADA");//INC + entregaVoluntaria = codigos("CODIGO.ENTV"); + abandono = codigos("CODIGO.ABAN"); + codigoReclamo=codigos("CODIGO.RECL");//RECLAMO + xpathflujo=null; + itemsUnidadBolean=Boolean.FALSE; + estadoOperacion = "ENVIO"; + + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + codigoUnidadControlDestino = tsafeUserDetail.getCcentrocontrol(); + + organismoControlDestino = tsafeUserDetail.getModifiedData().get("centrocontrol").toString(); + unidadControlDestino = tsafeUserDetail.getModifiedData().get("unidad").toString(); + + //codigoOrganismoControl = tsafeUserDetail.getCcentrocontrol(); + codigoUnidadControl = tsafeUserDetail.getCcentrocontrol(); + listaEnviosRealizados = DecomisoArmaTransaccionController.findParaReception(codigoUnidadControl); +// System.out.println(listaDecomisoArmaTrans1.size()); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para obtener el centro de control + * @throws Exception + */ + private void obtenerCentroControl() throws Exception { + userDetail= (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + centroControl= CentroControlArmasController.findPorCodigo(userDetail.getCcentrocontrol()); + cprovincia=centroControl.getProvincecode(); + itemUnidadDestino= new ArrayList(); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + //codigo del centro de control de pichincha + TgeneParameters paramCentroControlDestino=ParametersController.find("CODIGO.CENT.CONTROL.PICHINCHA", "1");//000030//CAPI + //validamos si la persona que ingreso pertenece al centro de control pichincha para darle al opcion de seleccionar el deparatmento de control para la recepcion + if(paramCentroControlDestino.getTextvalue().equals(centroControl.getNombreinstitucion())){ + itemUnidadDestino.add(new SelectItem(centroControl.getPk(), institucionCentroControl)); + //codigo del departamento de control + TgeneParameters paramDepartamentoControl=ParametersController.find("CODIGO.DEPT.CONTROL", "1");//DPCA + TarmCentroControl institCentroControlDestino= CentroControlArmasController.findPorCentroControl(paramDepartamentoControl.getTextvalue());//000077 + itemUnidadDestino.add(new SelectItem(institCentroControlDestino.getPk(), ""+institCentroControlDestino.getModifiedData().get("desnombreinstitucion"))); + }else{ + instiCentroControlCode=centroControl.getPk(); + } + } + + /** + * Metodo para obtener los codigos + */ + private String codigos(String parametro){ + TgeneParameters tgeneParameters= ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if(fechaCorte!=null){ + DtoQuery dto = this.getDtoQuery(); + dto.setOrderby("t.fdecomiso"); + if(numerotransaccionpk!=null){ + SimpleDateFormat formato= new SimpleDateFormat("yyyy-MM-dd"); + Filter decomisoFiltro= new Filter(); + decomisoFiltro.setSql("trunc(t.fdecomiso) <= " + "TO_DATE('" + + formato.format(fechaCorte)+ "','yyyy-MM-dd') and (t.estado='"+codigoDecomiso+"' or t.estado='"+codigoIncautacion+"' or t.estado='"+abandono+"' or t.estado='"+codigoReclamo+"') and t.cdecarmtranrecepcion = "+numerotransaccionpk); + dto.addFiltro(decomisoFiltro); + }else{//aniadimos los filtros de busqueda + dto = filtroVerificarArmas(dto); + numRecepcionGenerado=null; + //codigoOrganismoControlDestino = null; + //codigoUnidadControlDestino = null; + } + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + btnSelTodos = Boolean.TRUE; + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + //metodo para completar la informacion + completarInformacionArma(); + btnSave=Boolean.TRUE; + btnSelTodos = Boolean.FALSE; + btnGenerarActa=Boolean.TRUE; + numerotransaccionpk=null; + super.postQuery(lrecord); + } + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception{ + DtoQuery dto = super.getDtoQuery(true); + + SubQuery subqueryNumRec= new SubQuery("TarmDecomiso","numerorecibo","nrecibo","i.pk=t.cdecomiso"); + dto.addSubQuery(subqueryNumRec); + SubQuery subqueryNumTransac= new SubQuery("TarmDecomiso","numerotransaccion","numerotransaccion","i.pk=t.cdecomiso"); + dto.addSubQuery(subqueryNumTransac); + SubQuery subqueryCentroControl= new SubQuery("TarmDecomiso","ccentrocontrol","ccentrocontrol","i.pk=t.cdecomiso"); + dto.addSubQuery(subqueryCentroControl); + SubQuery subqueryMarca= new SubQuery("TgeneCatalogDetail","description","nmarca", + "i.pk.catalog=(select o.marca from TarmArmas o where o.pk=t.carma)" + + " and i.pk.catalogcode=(select o.marcacodigo from TarmArmas o where o.pk=t.carma)"); + dto.addSubQuery(subqueryMarca); + SubQuery subquerySerieArma= new SubQuery("TarmArmas","lote","nserie","i.pk=t.carma"); + dto.addSubQuery(subquerySerieArma); + + SubQuery subqueryCalibre= new SubQuery("TgeneCatalogDetail","description","ncalibre", + "i.pk.catalog =(select o.calibre from TarmTipoArmaExplosivo o where o.pk=(select a.ctipoarmaexplosivo from TarmArmas a where a.pk=t.carma))" + + " and i.pk.catalogcode=(select o.calibrecodigo from TarmTipoArmaExplosivo o where o.pk=(select a.ctipoarmaexplosivo from TarmArmas a where a.pk=t.carma))");//calibrecodigo + dto.addSubQuery(subqueryCalibre); + + SubQuery subqueryCodigoReg= new SubQuery("TarmArmas","cregistro","cregistro","i.pk=t.carma"); + dto.addSubQuery(subqueryCodigoReg); + SubQuery subqueryCodigoArmaExplo= new SubQuery("TarmArmas","ctipoarmaexplosivo","ctipoarmaexplosivo","i.pk=t.carma"); + dto.addSubQuery(subqueryCodigoArmaExplo); + //tipo, clase, unidad de TarmTipoArmaExplosivo + SubQuery subqueryTipo= new SubQuery("TgeneCatalogDetail","description","ntipo", + "i.pk.catalog =(select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=(select a.ctipoarmaexplosivo from TarmArmas a where a.pk=t.carma))" + + " and i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=(select a.ctipoarmaexplosivo from TarmArmas a where a.pk=t.carma))"); + dto.addSubQuery(subqueryTipo); + SubQuery subqueryClase= new SubQuery("TgeneCatalogDetail","description","nclase", + "i.pk.catalog =(select o.clase from TarmTipoArmaExplosivo o where o.pk=(select a.ctipoarmaexplosivo from TarmArmas a where a.pk=t.carma))" + + " and i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=(select a.ctipoarmaexplosivo from TarmArmas a where a.pk=t.carma))"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryUnidad= new SubQuery("TgeneCatalogDetail","description","nunidad", + "i.pk.catalog =(select o.unidadmedidapeso from TarmTipoArmaExplosivo o where o.pk=(select a.ctipoarmaexplosivo from TarmArmas a where a.pk=t.carma))" + + " and i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o where o.pk=(select a.ctipoarmaexplosivo from TarmArmas a where a.pk=t.carma))"); + dto.addSubQuery(subqueryUnidad); + //personcode + //TarmRegistroArmas registroArma = RegistroArmController.findByCodigo(decomisoArma.getModifiedData().get("cregistro").toString()); + SubQuery subqueryPersonCode= new SubQuery("TarmRegistroArmas","personcode","personcode", " i.pk =(select o.cregistro from TarmArmas o where o.pk=t.carma)"); + dto.addSubQuery(subqueryPersonCode); + + SubQuery subquerEstadoFlujo= new SubQuery("TarmDecomisoArmaTransaccion","estadoflujo","estadoflujo","i.pk=t.cdecomisoarmatransaccion"); + dto.addSubQuery(subquerEstadoFlujo); + return dto; + } + + + @Override + public void save() { + try { + Boolean seleccion = Boolean.FALSE; + for(TarmDecomisoArma decomisoArma:this.lrecord){ + record = decomisoArma; + if(record.getModifiedData().get("seleccion").equals(Boolean.TRUE)){ + seleccion = true; + record.setCdecarmtranrecepcion(0l); + record.setCoperaciontransaccion("RECEPCION"); + } + this.update(); + } + if(!seleccion){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_verificararmas")); + return; + } + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + + Calendar cal=Calendar.getInstance(); + cal.setTime(fechaCorte); + java.sql.Date fechaCorteRegistro=new java.sql.Date(cal.getTimeInMillis()); + + this.decomisoArmaTransaccionController.create(); + this.decomisoArmaTransaccionController.getRecord().setFtransaccion(null); + this.decomisoArmaTransaccionController.getRecord().setFcorte(fechaCorteRegistro); + this.decomisoArmaTransaccionController.getRecord().setCcentrocontrol(codigoUnidadControlDestino);//de la persona que revcibe//centroControl.getPk() codigoUnidadControlDestino + + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TarmCentroControl centroControlLogin= CentroControlArmasController.findPorCodigo(tsafeUserDetail.getCcentrocontrol()); + + if(!"1".equals(CatalogDetailController.findxCodigoCodcatalogo(centroControlLogin.getInstitucion(), centroControlLogin.getInstituciontipo()).getPk().getCatalog())){ + this.decomisoArmaTransaccionController.getRecord().setEstadofirma("Y"); + this.decomisoArmaTransaccionController.getRecord().setEstadoflujo("ENV"); + isCentroDpto = Boolean.FALSE; + }else{ + this.decomisoArmaTransaccionController.getRecord().setEstadofirma("N"); + this.decomisoArmaTransaccionController.getRecord().setEstadoflujo("NOENV"); + isCentroDpto = Boolean.TRUE; + } + + this.decomisoArmaTransaccionController.update(); + DtoSave dtosaveDecomisoTran = this.decomisoArmaTransaccionController.getDtoSave(true); + dtosaveDecomisoTran.setReturnpk(true); + dtosaveDecomisoTran.setPosition(1); + msave.put(decomisoArmaTransaccionController.getBeanalias(), dtosaveDecomisoTran); + + DtoSave dtosaveDecomiso = this.getDtoSave(true); + dtosaveDecomiso.setReturnpk(true); + dtosaveDecomiso.setPosition(2); + msave.put(getBeanalias(), dtosaveDecomiso); + + //transacciones del arma + DtoSave dtosaveArmaBodega = transaccionArmaBodegaController.getDtoSave(true); + dtosaveArmaBodega.setReturnpk(true); + dtosaveArmaBodega.setPosition(3); + msave.put(transaccionArmaBodegaController.getBeanalias(), dtosaveArmaBodega); + //bodega del arma + DtoSave dtosaveBodega = bodegaController.getDtoSave(true); + dtosaveBodega.setReturnpk(true); + dtosaveBodega.setPosition(4); + msave.put(bodegaController.getBeanalias(), dtosaveBodega); + + //para la actualizacion del centro de control destino + DtoSave dtosaveDecomisoCab = decomisoController.getDtoSave(true); + dtosaveDecomisoCab.setPosition(5); + msave.put(decomisoController.getBeanalias(), dtosaveDecomisoCab); + + + request.setSaveTables(msave); + //prefijo + request.put("prefijo", prefijo); + // para el flujo + request.modifiedData().put("isnew", "N");//para que ejecute desde un boton + //completa la informacion en un transaction rule DecomisoArmaRecepcion + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.decomisoArmaTransaccionController.postCommit(resp); + this.postCommit(resp); + TarmDecomisoArmaTransaccion decomisoArmaTransaccion=(TarmDecomisoArmaTransaccion)dtosaveDecomisoTran.getLinsert().get(0); + numerotransaccionpk=decomisoArmaTransaccion.getPk().toString(); + numerotransaccionpkAux=decomisoArmaTransaccion.getPk().toString(); + //numereo de transaccion + numRecepcionGenerado=resp.get("numerotransaccionrecep").toString(); + numRecepcionGeneradoAux=resp.get("numerotransaccionrecep").toString(); + fechaCorteg=decomisoArmaTransaccion.getFcorte(); + //metodo para generar el acta + querydatabase(); + btnSave=Boolean.TRUE; + btnSelTodos = Boolean.TRUE; + cmbTransaccionenvio = Boolean.FALSE; + btnGenerarActa=Boolean.FALSE; +// numerotransaccionEnvio = ""; + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Método para el evento change del combo transaccion + */ + public void executeTransaccion() { + List decomisoArmaTransaccionOrigen = DecomisoArmaTransaccionController.findPorEnvio(numerotransaccionEnvio, true); + if(decomisoArmaTransaccionOrigen != null && !decomisoArmaTransaccionOrigen.isEmpty()){ +// codigoUnidadControlDestino = decomisoArmaTransaccionOrigen.get(0).getCcentrocontrol(); + TarmCentroControl centroControlOrigen = CentroControlArmasController.findPorCodigo(decomisoArmaTransaccionOrigen.get(0).getCcentrocontrol()); + centroControlOrigenStr = CatalogDetailController.findxCodigoCodcatalogo( centroControlOrigen.getInstitucion(), centroControlOrigen.getInstituciontipo()).getDescription(); + unidadOrigenStr = CatalogDetailController.findxCodigoCodcatalogo( centroControlOrigen.getNombreinstitucion(), centroControlOrigen.getNombreinstitucioncodigo()).getDescription(); + } + } + + /** + * Completa las caracteristicas del arma de los catalogos correspondientes + */ + public void completarInformacionArma(){ + ListarmasNoenviadas=new ArrayList(); + for(TarmDecomisoArma decomisoArma:lrecord){ + decomisoArma.getModifiedData().put("seleccion",false); + //TarmRegistroArmas registroArma = RegistroArmController.findByCodigo(decomisoArma.getModifiedData().get("cregistro").toString()); + if(decomisoArma.getModifiedData().get("personcode")!=null){ + TcustPersonDetail tcustPersonDetail=PersonDetailController.find(decomisoArma.getModifiedData().get("personcode").toString()); + decomisoArma.getModifiedData().put("nrazons", tcustPersonDetail.getName()); + decomisoArma.getModifiedData().put("documento", tcustPersonDetail.getIdentification()); + } + if(decomisoArma.getModifiedData().get("estadoflujo")!=null && decomisoArma.getModifiedData().get("estadoflujo").equals("NOENV") ){ + armasNoenviadas.add(decomisoArma); + } + } + + for(TarmDecomisoArma decomisoArma:armasNoenviadas){ + lrecord.remove(decomisoArma); + } + } + + /** + * Método para habilitar o desabilitar el btn + * Arma a decomisar + * @throws Exception + */ + public void onChange(TarmDecomisoArma decomisoArma ) throws Exception { + btnSave=Boolean.TRUE; + itemsUnidadBolean=Boolean.FALSE; + for(TarmDecomisoArma t:lrecord){ + if(t.getModifiedData().get("seleccion").equals(Boolean.TRUE)){ + btnSave=Boolean.FALSE; + itemsUnidadBolean=Boolean.TRUE; + } + } + } + + /** + * Metodo para filtrar por Unidad de Control + * @param dto Dto sobre el que se va a ejecutar el filtro + * @throws Exception + */ + private DtoQuery filtroVerificarArmas(DtoQuery dto) throws Exception{ + Filter decomisoFiltro= new Filter(); + List listaDecomisoArmaTrans = new ArrayList<>(); + if(numerotransaccionEnvio != null && !"".equals(numerotransaccionEnvio)){ + listaDecomisoArmaTrans = DecomisoArmaTransaccionController.findPorEnvio(numerotransaccionEnvio,true); + }else{ + listaDecomisoArmaTrans = DecomisoArmaTransaccionController.findPorOrganismoUnidad(codigoUnidadControl, fechaCorte, estadoOperacion); + } + + String filtroDecomisoArmaTrans=""; + if(listaDecomisoArmaTrans != null && !listaDecomisoArmaTrans.isEmpty()){ + StringBuffer lstBuffer = new StringBuffer(); + for(TarmDecomisoArmaTransaccion decomisoArmaTrans : listaDecomisoArmaTrans){ + if(!lstBuffer.toString().isEmpty()){ + lstBuffer.append(" or "); + } + lstBuffer.append("t.cdecomisoarmatransaccion = " + decomisoArmaTrans.getPk()); + } + filtroDecomisoArmaTrans = (!lstBuffer.toString().trim().isEmpty())?" and (" + lstBuffer.toString() + ")":""; + }else{ + filtroDecomisoArmaTrans = "and (t.cdecomisoarmatransaccion = 999999)"; + } + decomisoFiltro.setSql("(t.estado='"+codigoDecomiso+"' or t.estado='"+codigoIncautacion+"' or t.estado='"+entregaVoluntaria+"' or t.estado='"+abandono+"' or t.estado='"+codigoReclamo+"') and t.cdecomiso is not null and t.coperaciontransaccion = '" + estadoOperacion + "' and t.enbodega='Y'" + filtroDecomisoArmaTrans); + dto.addFiltro(decomisoFiltro); + return dto; + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if(Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")){ + valorColocar = Boolean.TRUE; + } + + btnSave=Boolean.TRUE; + for (TarmDecomisoArma decomisoArma : lrecord) { + decomisoArma.getModifiedData().put("seleccion", valorColocar); + if(decomisoArma.getModifiedData().get("seleccion").equals(Boolean.TRUE)){ + btnSave=Boolean.FALSE; + //itemsUnidadBolean=Boolean.TRUE; + } + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para generar el acta de recepcion + * y cargar el archivo en el alfresco + */ + public void generarActa() { + if (fechaCorteg != null) { + Calendar fechaActualCldr = Calendar.getInstance(); + + String codigoreporte = numerotransaccionpkAux; + String path = "armas/reports/repo2"; + String filename = numRecepcionGenerado; + String gradoUsuario = ""; + TcustPersonDetail usuario = PersonDetailController.find(this.userDetail.getPk().getPersoncode().toString()); + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(usuario.getMilitarygrade(), usuario.getMilitarygradecode()); + if(grado != null){ + gradoUsuario = grado.getDescription()+" - "+usuario.getName(); + }else{ + gradoUsuario = "Sin Grado - "+usuario.getName(); + } + + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda","repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + try { + // Usuario logueado en la aplicacion + String nombreUsuario; + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } else { + nombreUsuario = ""; + } + +// TarmCentroControl centroControlDestino = CentroControlArmasController.findPorCodigo(codigoUnidadControlDestino); +// String centroControlDestinoStr = CatalogDetailController.findxCodigoCodcatalogo( centroControlDestino.getInstitucion(), centroControlDestino.getInstituciontipo()).getDescription(); +// String unidadControlDestinoStr = CatalogDetailController.findxCodigoCodcatalogo( centroControlDestino.getNombreinstitucion(), centroControlDestino.getNombreinstitucioncodigo()).getDescription(); + + parameters.put("user", nombreUsuario); + parameters.put("organismoControlOrigen", centroControlOrigenStr); + parameters.put("unidadControlOrigen", unidadOrigenStr); + parameters.put("organismoControlDestino", organismoControlDestino); + parameters.put("unidadControlDestino", unidadControlDestino); + parameters.put("codigodec", codigoreporte.toString());//este + parameters.put("fechaCorte", new SimpleDateFormat("dd-MM-yyyy").format(fechaCorteg));//este + parameters.put("numtransaccion", numRecepcionGeneradoAux); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + parameters.put("nombregrado", gradoUsuario);//este + // Fecha actual + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0"+ (fechaActualCldr.get(Calendar.DAY_OF_MONTH)): (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH) + 1) <= 9 ? "0"+ (fechaActualCldr.get(Calendar.MONTH) + 1): (fechaActualCldr.get(Calendar.MONTH) + 1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0"+ (fechaActualCldr.get(Calendar.MINUTE)): (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarFecha", fechaActualSB.toString()); + + + TgeneCatalogDetail orgControl = CatalogDetailController.findCatalogo("NOMBREINSTITUCION", this.codigoUnidadControl); + if(orgControl != null){ + parameters.put("orgControl", orgControl.getDescription()); + }else { + parameters.put("orgControl", ""); + } + + format = "pdf"; + InputStream file = this.reportController.jaspertoInputstream(path, parameters, format, filename,this.getLoginController()); + xpathflujo = generarXpath(); + if(!alfrescoController.uploadFile(file, numRecepcionGeneradoAux+ ".pdf", xpathflujo)){ + xpathflujo=null; + } + System.out.println(xpathflujo+"/cm:"+numRecepcionGeneradoAux+ ".pdf"); + numerotransaccionEnvio = ""; + //="cm:Decomiso/cm:A-2016/cm:M-01/cm:CENTRO CONTROL/cm:ABANDONO/cm:REC/cm:REC-000000319.pdf" + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + } + + /** + * Metodo para generar la ruta donde se carga el archivo + * @return + */ + public String generarXpath(){ + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta=new StringBuilder("cm:Decomiso"); + + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + String centrocontrol=unidadControlDestino.replaceAll("\\s+", "_"); + ruta = ruta.append("/cm:").append(centrocontrol); + ruta = ruta.append("/cm:"+"REC"); + + return ruta.toString(); + } + /** + * Validacion de las fechas que no se amayor a la actual + * @param fech + */ + public void validarfecha(Date fech){ + if(fech.getTime()>(new Date()).getTime()){ + fech=new Date(); + fechaCorte=new java.sql.Date(new Date().getTime()); + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_fechadecomisonopuedesermayoralaactual")); + } + } + + /** + * Ejecuta un reporte de armas a destruir + * Método para el inicio de flujo + */ + public void iniciarFlujo() { + try { + if(xpathflujo==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generereporte")); + return; + } + if(cprovincia==null || cprovincia.length()==0){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinprovincia")); + return; + } + + //instiCentroControlCode + TarmCentroControl centroControl= CentroControlArmasController.findPorCodigo(instiCentroControlCode); + if(centroControl==null || centroControl.getPk()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinprovincia")); + return; + } + TgeneParameters paramDepartamentoControl=ParametersController.find("CODIGO.DEPT.CONTROL", "1");//DPCA + if(centroControl.getNombreinstitucion().equals(paramDepartamentoControl.getTextvalue())){ + cprovincia=paramDepartamentoControl.getTextvalue(); + } + //itemUnidadDestino + + String xpath=xpathflujo+"/cm:"+numRecepcionGeneradoAux+ ".pdf"; + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + //codigo de la tabla TarmDecomisoArmaTransaccion + request.modifiedData().put("numerotransaccion", numerotransaccionpkAux); + request.modifiedData().put("cprovincia", cprovincia); + request.modifiedData().put("numerosolicitud", numRecepcionGeneradoAux); + //ruta del archivo para la firma + //TODO Falta crear la variable en maia 2-8 + request.modifiedData().put("xpath", xpath); + request.modifiedData().put("isnew", "Y"); + request.setLogsolicitude(numRecepcionGeneradoAux); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.setShowRow(true); + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + " TRANSACCION: "+ numerotransaccionpkAux); + xpathflujo=null; + btnGenerarActa=Boolean.TRUE; + btnSelTodos = Boolean.TRUE; + cmbTransaccionenvio = Boolean.FALSE; + btnSave = Boolean.TRUE; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void executeUnidad() { + + for(SelectItem item: itemUnidadDestino){ + if(item.getValue().equals(instiCentroControlCode)){ + institucionCentroControl=item.getLabel(); + } + } + } + + public List getlTipoReporte() { + return lTipoReporte; + } + + public void setlTipoReporte(List lTipoReporte) { + this.lTipoReporte = lTipoReporte; + } + + + public Date getFechaCorte() { + return fechaCorte; + } + + public void setFechaCorte(Date fechaCorte) { + this.fechaCorte = fechaCorte; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getTipoReporte() { + return tipoReporte; + } + + public void setTipoReporte(String tipoReporte) { + this.tipoReporte = tipoReporte; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + /** + * @return the listaEnviosRealizados + */ + public List getListaEnviosRealizados() { + return listaEnviosRealizados; + } + + /** + * @param listaEnviosRealizados the listaEnviosRealizados to set + */ + public void setListaEnviosRealizados( + List listaEnviosRealizados) { + this.listaEnviosRealizados = listaEnviosRealizados; + } + + public String getCodigoOrganismoControl() { + return codigoOrganismoControl; + } + + public void setCodigoOrganismoControl(String codigoOrganismoControl) { + this.codigoOrganismoControl = codigoOrganismoControl; + } + + public String getCodigoUnidadControl() { + return codigoUnidadControl; + } + + public void setCodigoUnidadControl(String codigoUnidadControl) { + this.codigoUnidadControl = codigoUnidadControl; + } + + + + + public Boolean getBtnSave() { + return btnSave; + } + + public void setBtnSave(Boolean btnSave) { + this.btnSave = btnSave; + } + + public String getNumRecepcionGenerado() { + return numRecepcionGenerado; + } + + public void setNumRecepcionGenerado(String numRecepcionGenerado) { + this.numRecepcionGenerado = numRecepcionGenerado; + } + + public DecomisoArmaTransaccionController getDecomisoArmaTransaccionController() { + return decomisoArmaTransaccionController; + } + + public void setDecomisoArmaTransaccionController( + DecomisoArmaTransaccionController decomisoArmaTransaccionController) { + this.decomisoArmaTransaccionController = decomisoArmaTransaccionController; + } + + public String getNumerotransaccionEnvio() { + return numerotransaccionEnvio; + } + + public void setNumerotransaccionEnvio(String numerotransaccionEnvio) { + this.numerotransaccionEnvio = numerotransaccionEnvio; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + public String getNumerotransaccionpk() { + return numerotransaccionpk; + } + + public void setNumerotransaccionpk(String numerotransaccionpk) { + this.numerotransaccionpk = numerotransaccionpk; + } + + public Boolean getBtnGenerarActa() { + return btnGenerarActa; + } + + public void setBtnGenerarActa(Boolean btnGenerarActa) { + this.btnGenerarActa = btnGenerarActa; + } + + public TransaccionArmaBodegaController getTransaccionArmaBodegaController() { + return transaccionArmaBodegaController; + } + + public void setTransaccionArmaBodegaController( + TransaccionArmaBodegaController transaccionArmaBodegaController) { + this.transaccionArmaBodegaController = transaccionArmaBodegaController; + } + + public BodegaController getBodegaController() { + return bodegaController; + } + + public void setBodegaController(BodegaController bodegaController) { + this.bodegaController = bodegaController; + } + + public String getInstiCentroControlCode() { + return instiCentroControlCode; + } + + public void setInstiCentroControlCode(String instiCentroControlCode) { + this.instiCentroControlCode = instiCentroControlCode; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public List getItemUnidadDestino() { + return itemUnidadDestino; + } + + public void setItemUnidadDestino(List itemUnidadDestino) { + this.itemUnidadDestino = itemUnidadDestino; + } + + public Boolean getItemsUnidadBolean() { + return itemsUnidadBolean; + } + + public void setItemsUnidadBolean(Boolean itemsUnidadBolean) { + this.itemsUnidadBolean = itemsUnidadBolean; + } + + public DecomisoController getDecomisoController() { + return decomisoController; + } + + public void setDecomisoController(DecomisoController decomisoController) { + this.decomisoController = decomisoController; + } + + /** + * @return the organismoControlDestino + */ + public String getOrganismoControlDestino() { + return organismoControlDestino; + } + + /** + * @param organismoControlDestino the organismoControlDestino to set + */ + public void setOrganismoControlDestino(String organismoControlDestino) { + this.organismoControlDestino = organismoControlDestino; + } + + /** + * @return the unidadControlDestino + */ + public String getUnidadControlDestino() { + return unidadControlDestino; + } + + /** + * @param unidadControlDestino the unidadControlDestino to set + */ + public void setUnidadControlDestino(String unidadControlDestino) { + this.unidadControlDestino = unidadControlDestino; + } + + public String getCodigoUnidadControlDestino() { + return codigoUnidadControlDestino; + } + + public void setCodigoUnidadControlDestino(String codigoUnidadControlDestino) { + this.codigoUnidadControlDestino = codigoUnidadControlDestino; + } + + public String getCentroControlOrigenStr() { + return centroControlOrigenStr; + } + + public void setCentroControlOrigenStr(String centroControlOrigenStr) { + this.centroControlOrigenStr = centroControlOrigenStr; + } + + public String getUnidadOrigenStr() { + return unidadOrigenStr; + } + + public void setUnidadOrigenStr(String unidadOrigenStr) { + this.unidadOrigenStr = unidadOrigenStr; + } + + public Boolean getIsCentroDpto() { + return isCentroDpto; + } + + public void setIsCentroDpto(Boolean isCentroDpto) { + this.isCentroDpto = isCentroDpto; + } + + public boolean isBtnSelTodos() { + return btnSelTodos; + } + + public void setBtnSelTodos(boolean btnSelTodos) { + this.btnSelTodos = btnSelTodos; + } + + public boolean isCmbTransaccionenvio() { + return cmbTransaccionenvio; + } + + public void setCmbTransaccionenvio(boolean cmbTransaccionenvio) { + this.cmbTransaccionenvio = cmbTransaccionenvio; + } + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/VerificacionInformacionCertificado.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/VerificacionInformacionCertificado.java.svn-base new file mode 100644 index 0000000..800963e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/VerificacionInformacionCertificado.java.svn-base @@ -0,0 +1,379 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.sql.Date; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.event.AjaxBehaviorEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.inte.TarmColadeImpresion; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; + + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class VerificacionInformacionCertificado extends AbstractController { + + + /* + * Variable que indica si se seleciona el check o no + */ + private Boolean verifica = false; + /* + * Variable que almacena el código de solicitud + */ + private String csolicitud; + /* + * Bean de tipo TarmSolicitud + */ + private TarmSolicitud solicitud = new TarmSolicitud(); + /* + * Bean del tipo ColaImpresionController + */ + private ColaImpresionController colaimpresion = new ColaImpresionController(); + + @ManagedProperty(value = "#{docHabilitanteController}") + private DocumentoHabilitanteController docHabilitanteController; + + @ManagedProperty(value = "#{solicitudController}") + private SolicitudController solicitudController; + + @ManagedProperty(value = "#{recepcionArmasController}") + private RecepcionArmasController recepcionArmasController; + + /** + * Constructor + * @throws Exception + */ + public VerificacionInformacionCertificado() throws Exception { + super(TarmSolicitudDocumento.class); + } + + /** + * Método invocado después de instanciar el controlador + * @throws Exception + */ + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + this.solicitud= SolicitudController.findSolicitudxcodsolicitud("135"); + this.getMfilters().put("pk.csolicitud", this.solicitud.getPk()); + this.getMfilelds().put("numerosolicitud", this.solicitud.getNumerosolicitud()); + + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se está utilizando una página que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "VERIFICARDOCUMENTOS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + SubQuery qry = new SubQuery("TarmSolicitud", "ccentrocontrol", "ccentrocontrol", "i.pk = t.pk.csolicitud"); + dto.addSubQuery(qry); + SubQuery qry2 = new SubQuery("TgeneCatalogDetail", "description", "tramitedesc", + "i.pk.catalog = (select a.tipotramite from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud)) and " + + "i.pk.catalogcode = (select a.tipotramitecodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud))"); + dto.addSubQuery(qry2); + SubQuery qry3 = new SubQuery("TgeneCatalogDetail", "description", "categoriadesc", + "i.pk.catalog = (select a.categoria from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud)) and " + + "i.pk.catalogcode = (select a.categoriacodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud))"); + dto.addSubQuery(qry3); + SubQuery qry4 = new SubQuery("TgeneCatalogDetail", "description", "usoactdesc", + "i.pk.catalog = (select a.usoactividad from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud)) and " + + "i.pk.catalogcode = (select a.usoactividadcodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud))"); + dto.addSubQuery(qry4); + SubQuery qry5 = new SubQuery("TarmDocumentoHabilitante", "fechaemision", "fechaemision", "i.pk = t.pk.cdocumento and i.csolicitud = t.pk.csolicitud"); + dto.addSubQuery(qry5); + SubQuery qry6 = new SubQuery("TarmDocumentoHabilitante", "fechaexpiracion", "fechaexpiracion", "i.pk = t.pk.cdocumento and i.csolicitud = t.pk.csolicitud"); + dto.addSubQuery(qry6); + SubQuery qry7 = new SubQuery("TgeneCatalogDetail", "description", "estado", + "i.pk.catalog = (select a.estado from TarmDocumentoHabilitante a where a.csolicitud = t.pk.csolicitud and a.pk = t.pk.cdocumento) and " + + "i.pk.catalogcode = (select a.estadocode from TarmDocumentoHabilitante a where a.csolicitud = t.pk.csolicitud and a.pk = t.pk.cdocumento)"); + dto.addSubQuery(qry7); + SubQuery qry8 = new SubQuery("TarmDocumentoHabilitante", "carma", "carma", "i.pk = t.pk.cdocumento and i.csolicitud = t.pk.csolicitud"); + dto.addSubQuery(qry8); + SubQuery qry9 = new SubQuery("TarmDocumentoHabilitante", "codigoarma", "codigoarma", "i.pk = t.pk.cdocumento and i.csolicitud = t.pk.csolicitud"); + dto.addSubQuery(qry9); + SubQuery qry10 = new SubQuery("TgeneCatalogDetail", "description", "tipoautorizacion", + "i.pk.catalog = (select a.tipoautorizacion from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud)) and " + + "i.pk.catalogcode = (select a.tipoautorizacioncodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud))"); + dto.addSubQuery(qry10); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + request.put("querytype", "P"); + request.put("queryalias", "VDOCUMENTO"); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + this.completaArmas(); + super.postQuery(this.lrecord); + lista(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Verifica la selección del documento según el check de + * reimpresion + */ + public void lista(){ + for (TarmSolicitudDocumento solicituddoc : lrecord) { + if(solicituddoc.getChkcertificado()!= null && solicituddoc.getChkcertificado().equals("Y")){ + solicituddoc.getModifiedData().put("verificador", Boolean.TRUE); + }else{ + solicituddoc.getModifiedData().put("verificador", Boolean.FALSE); + } + } + } + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + this.actualizaVerificado(); + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Selecciona los registros para establecer si el registro se reimprime o no. + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if(Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")){ + valorColocar = Boolean.TRUE; + } + for (TarmSolicitudDocumento solicituddoc : lrecord) { + solicituddoc.getModifiedData().put("verificador", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Actualiza la selección del documento según el check de + * reimpresion + * @throws Exception + */ + public void actualizaVerificado() throws Exception{ + for (TarmSolicitudDocumento solicituddoc : lrecord) { + if(solicituddoc.getModifiedData().get("verificador").equals(Boolean.TRUE)){ + solicituddoc.setChkcertificado("Y"); + }else { + solicituddoc.setChkcertificado("N"); + } + record=solicituddoc; + super.update(); + } + } + + + + + + @SuppressWarnings("unchecked") + protected void querydatabaseDocumentos() { + try { + + DtoQuery dto = super.getDtoQuery(true); + + if(csolicitud !=null ) + { + dto.addFiltro(new Filter("pk.csolicitud", csolicitud)); + } + + //solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(codigoSolicitud); + solicitud = ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(csolicitud); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (lrecord != null && !lrecord.isEmpty()) { + record = lrecord.get(0); + + + seleccionarDocumentos(); + } + super.postQuery(lrecord); + + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + /** + * Método que asigna la selección del documento según el check de + * reimpresion + * + * @throws Exception + */ + @SuppressWarnings("unused") + private void seleccionarDocumentos() throws Exception { + for (int i = 0; i < lrecord.size(); i++) { + TarmSolicitudDocumento docSeleccionada = lrecord.get(i); + + if (docSeleccionada.getVerificado().equalsIgnoreCase("Y")) { + docSeleccionada.modifiedData().put("seleccion", Boolean.TRUE); + } else { + docSeleccionada.modifiedData().put("seleccion", Boolean.FALSE); + } + } + + } + + /** + * Método que completa la información del arma para los registros de la + * tabla TarmSolicitudDocumento + */ + public void completaArmas(){ + for(int i=0;i { + + private TarmCentroControl centroControl; + TarmCentroControlJur jurisdiccionCentroControl; + private String nombreCentroControl; + TcustPersonDetail jefeCentroControl; + String gradoFuncionario=""; + + private String csolicitud; + + private List lArmas=new ArrayList(); + + private Boolean seleccionTodas=false; + + TarmSolicitudTramite solicitudTramite; + TcustPersonDetail detallesPersona; + TcustPersonDetail usuario; + String numeroTramite; + String nombreRazonSocial; + String tipoDocumento; + private Boolean generaReporte=Boolean.FALSE; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + public VerificacionInformacionDevolucionController() throws Exception { + super(TarmSolicitudArmas.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + startQuery(); + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + csolicitud=super.getMfilters().get("csolicitud");//"cm:Decomiso/cm:A-2014/cm:M-10/cm:ENV-000000319/cm:ENV-000000319.pdf";// + if(csolicitud!=null){ + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("CSOLICITUD", csolicitud); + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("TID", tid); + } + if(csolicitud==null){ + csolicitud=FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("CSOLICITUD").toString(); + } + if(tid==null){ + tid=""+FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TID"); + } + super.getMfilters().clear(); + super.getMfilters().put("pk.csolicitud", csolicitud); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "VERIFICACIONINFORMACIONCONTROLLER"; + querydatabase(); + + //Obteniendo el centro de control + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController direccion= new PersonAddressController(); + TcustPersonAddress tcustPersonAddres= direccion.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + this.jurisdiccionCentroControl= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl= CentroControlArmasController.findPorCodigo(this.jurisdiccionCentroControl.getCcentrocontrol()); + this.nombreCentroControl = CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), + centroControl.getNombreinstitucioncodigo()).getDescription(); + + //Obteniendo el jefe del centro de control + this.jefeCentroControl=PersonDetailController.find(this.centroControl.getPersoncode().toString()); + + //Obteniendo el grado del jefe del centro de control + TgeneCatalogDetail grado=CatalogDetailController.findxCodigoCodcatalogo(this.jefeCentroControl.getMilitarygrade(), this.jefeCentroControl.getMilitarygradecode()); + if(grado!=null){ + gradoFuncionario=grado.getDescription()+" - "; + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @Override + public void query() throws Exception { + // TODO Auto-generated method stub + MessageHelper.setMessageError("msg_notQuery"); + super.query(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + this.lArmas.clear(); + + DtoQuery dto = super.getDtoQuery(true); + + //Quemando el codigo de la solicitud + if(csolicitud!=null){ + Filter filtro=new Filter("pk.csolicitud", csolicitud); + dto.addFiltro(filtro); + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("CSOLICITUD", csolicitud); + }else{ + Filter filtro=new Filter("pk.csolicitud", ""+FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("CSOLICITUD")); + dto.addFiltro(filtro); + } + + + //Obteniendo el tramite + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(csolicitud); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(lrecord!=null && !lrecord.isEmpty()){ + + record=lrecord.get(0); + + //Numero de tramite + if(solicitudTramite!=null){ + this.numeroTramite=solicitudTramite.getNumerotramite(); + this.record.put("ntramite", solicitudTramite.getNumerotramite()); + } + + //Obteniendo la solicitud + TarmSolicitud solicitud=ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(solicitudTramite.getPk().getCsolicitud()); + if(solicitud!=null){ + detallesPersona= PersonDetailController.find(String.valueOf(solicitud.getPersoncode())); + } + + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + //Obteniendo las armas + for(TarmSolicitudArmas solicitudArmas:lrecord){ + TarmArmas arma=ArmasController.findPorCodigo(solicitudArmas.getPk().getCarma()); + if(arma!=null){ + lArmas.add(arma); + } + } + actualizarArmas(); + } + super.postQuery(lrecord); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaseArmas() { + try { + this.lArmas.clear(); + + DtoQuery dto = super.getDtoQuery(true); + + if(csolicitud !=null ) + { + dto.addFiltro(new Filter("pk.csolicitud", csolicitud)); + } + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(lrecord!=null && !lrecord.isEmpty()){ + + record=lrecord.get(0); + + //Obteniendo las armas + for(TarmSolicitudArmas solicitudArmas:lrecord){ + TarmArmas arma=ArmasController.findPorCodigo(solicitudArmas.getPk().getCarma()); + if(arma!=null){ + lArmas.add(ArmasController.findPorCodigo(solicitudArmas.getPk().getCarma())); + } + } + actualizarArmas(); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + + //Actualizando el estado de las armas + for(TarmArmas armaSeleccionada:lArmas){ + for(TarmSolicitudArmas solicitudArmas:lrecord){ + if(armaSeleccionada.getPk().equals(solicitudArmas.getPk().getCarma())){ + record = solicitudArmas; + if(armaSeleccionada.modifiedData().containsValue(Boolean.TRUE)){ + record.setPordevolucion("Y"); + }else{ + record.setPordevolucion("N"); + } + update(); + } + } + } + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + generateReport(); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + if(!generaReporte){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generereporte")); + return; + } + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + //completa la tarea del flujo + request.modifiedData().put("csolicitud", csolicitud); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + request.modifiedData().put("isnew", "Y"); + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + MessageHelper.setMessageInfo("COMPLETA LA TAREA DEL FLUJO"); + generaReporte=Boolean.FALSE; + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().remove("TID"); + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().remove("CSOLICITUD"); + org.primefaces.context.RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Salva los datos de la verificaion + */ + public String saveVerification() { + String direccion=""; + try { + + //Actualizando el estado de las armas + for(TarmArmas armaSeleccionada:lArmas){ + for(TarmSolicitudArmas solicitudArmas:lrecord){ + if(armaSeleccionada.getPk().equals(solicitudArmas.getPk().getCarma())){ + record = solicitudArmas; + if(armaSeleccionada.modifiedData().containsValue(Boolean.TRUE)){ + record.setPordevolucion("Y"); + }else{ + record.setPordevolucion("N"); + } + update(); + } + } + } + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + direccion="/pages/armas/registrarNovedad?faces-redirect=true?csolicitud="+csolicitud; + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + return direccion; + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Genera el reporte de la verificacion de las armas + * @param name Nombre del reporte a generar. + */ + public void generateReport() { + String path = "armas/reports/actaDevolucion2"; + String filename=MsgControlArmas.getProperty("lbl_actaDeDevolucion"); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + parameters.put("numeroTramite", this.numeroTramite); + + //Nombre del centro de control + parameters.put("nombreCentro", this.nombreCentroControl); + + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + + //Nombre y cedula + parameters.put("nombreRazon", detallesPersona.getName()); + parameters.put("cedula", detallesPersona.getIdentification()); + + //Codigo persona + parameters.put("personcode", usuario.getPk().getPersoncode()); + + //Funcionario + parameters.put("gradoNombreFuncionario",gradoFuncionario+this.jefeCentroControl.getName()); + parameters.put("personcode",this.jefeCentroControl.getPk().getPersoncode()); + parameters.put("centroControl","JEFE DEL "+this.nombreCentroControl); + + //Usuario + parameters.put("usuario",this.usuario.getName()); + sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + String fechaHora=sdf.format(Calendar.getInstance().getTime()); + parameters.put("fechaHora",fechaHora); + + String format = "pdf"; + + try { + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + // + generaReporte=Boolean.TRUE; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Metodod que asigna la seleccion del arma segun el estado de la solicitud arma + * @throws Exception + */ + @SuppressWarnings("unused") + private void actualizarArmas() throws Exception{ + for(TarmSolicitudArmas solicitudArmas:lrecord){ + for (int i = 0; i < lArmas.size(); i++) { + TarmArmas armaSeleccionada=lArmas.get(i); + if(armaSeleccionada.getPk().equals(solicitudArmas.getPk().getCarma())){ + if(solicitudArmas.getPordevolucion()!=null && !solicitudArmas.getPordevolucion().isEmpty() + && solicitudArmas.getPordevolucion().equalsIgnoreCase("Y")){ + armaSeleccionada.modifiedData().put("seleccion", Boolean.TRUE); + }else{ + armaSeleccionada.modifiedData().put("seleccion", Boolean.FALSE); + } + } + } + } + } + + /** + * Metodo que selecciona todas las armas + */ + public void seleccionarTodasArmas(){ + for(TarmArmas arma:lArmas){ + arma.put("seleccion", Boolean.TRUE); + } + } + + /** + * Obtiene los detalles de las armas segun el catalogo + * @param catalogo + * @param catalogoCode + * @return + */ + public String aspectoArmaCatalogo(String catalogo, String catalogoCode){ + if(catalogo!=null && catalogoCode!=null && !catalogo.isEmpty() && !catalogoCode.isEmpty()){ + return CatalogDetailController.findxCodigoCodcatalogo(catalogo, catalogoCode).getDescription(); + } + return null; + } + + /** + * Devuelve una descripcion de catalogo segun un tipo de aspecto + * @param arma + * @param tipoAspecto + * @return + */ + public String aspectoArmaExplosivoCatalogo(TarmArmas arma,String tipoAspecto){ + String aspecto=""; + + try { + TarmTipoArmaExplosivo explosivo=TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo()); + if(explosivo!=null){ + if(tipoAspecto.equalsIgnoreCase("clase") && explosivo.getClase()!=null && !explosivo.getClase().isEmpty() + && explosivo.getClasecodigo()!=null && !explosivo.getClasecodigo().isEmpty()){ + aspecto=CatalogDetailController.findxCodigoCodcatalogo(explosivo.getClase(), explosivo.getClasecodigo()).getDescription(); + + }else if(tipoAspecto.equalsIgnoreCase("tipo") && explosivo.getTipoarmaexplosivo()!=null && !explosivo.getTipoarmaexplosivo().isEmpty() + && explosivo.getTipoarmaexplosivocodigo()!=null && !explosivo.getTipoarmaexplosivocodigo().isEmpty()){ + aspecto=CatalogDetailController.findxCodigoCodcatalogo(explosivo.getTipoarmaexplosivo(), explosivo.getTipoarmaexplosivocodigo()).getDescription(); + + }else if(tipoAspecto.equalsIgnoreCase("calibre") && explosivo.getCalibre()!=null && !explosivo.getCalibre().isEmpty() + && explosivo.getCalibrecodigo()!=null && !explosivo.getCalibrecodigo().isEmpty()){ + aspecto=CatalogDetailController.findxCodigoCodcatalogo(explosivo.getCalibre(), explosivo.getCalibrecodigo()).getDescription(); + } + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + return aspecto; + } + + public String aspectoExplosivoArma(TarmSolicitudArmas solicitudArma,String aspecto){ + String descripcionAspecto=""; + try { + TarmArmas arma=ArmasController.findPorCodigo(solicitudArma.getPk().getCarma()); + + if(arma!=null){ + return this.aspectoArmaExplosivoCatalogo(arma,aspecto); + } + + } catch (Exception e) { + MessageHelper.setMessageWarn(e.getMessage()); + } + + return descripcionAspecto; + } + + /** + * Incrementa el numero del arma + * @param arma + * @return + */ + public int incrementarRowkey(TarmArmas arma){ + int n=0; + + for (int i = 0; i < lArmas.size(); i++) { + if(arma.getPk()==lArmas.get(i).getPk()){ + n=i+1; + break; + } + } + + return n; + } + + /** + * M\u00e9todo para encontrar por solicitud + * @param solicitudCode + * @return + */ + public static List findSolicitudArmas(String solicitudCode) { + try { + VerificacionInformacionDevolucionController cc = new VerificacionInformacionDevolucionController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.csolicitud", solicitudCode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + public List getlArmas() { + return lArmas; + } + + public void setlArmas(List lArmas) { + this.lArmas = lArmas; + } + + public Boolean getSeleccionTodas() { + int verificadas=0; + for (TarmArmas arma : lArmas) { + if(Boolean.parseBoolean(arma.modifiedData.get("seleccion").toString())==Boolean.TRUE){ + verificadas++; + } + } + if(verificadas==lArmas.size()){ + seleccionTodas=true; + }else{ + seleccionTodas=false; + } + + return seleccionTodas; + } + + public void setSeleccionTodas(Boolean seleccionTodas) { + this.seleccionTodas = seleccionTodas; + + if(this.seleccionTodas){ + for(TarmArmas arma:lArmas){ + arma.put("seleccion", Boolean.TRUE); + } + }else{ + for(TarmArmas arma:lArmas){ + arma.put("seleccion", Boolean.FALSE); + } + } + + } + + + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public Boolean getGeneraReporte() { + return generaReporte; + } + + public void setGeneraReporte(Boolean generaReporte) { + this.generaReporte = generaReporte; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/VerificacionReimpresion.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/VerificacionReimpresion.java.svn-base new file mode 100644 index 0000000..fbcb8e5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/VerificacionReimpresion.java.svn-base @@ -0,0 +1,559 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.event.AjaxBehaviorEvent; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.inte.TarmColadeImpresion; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class VerificacionReimpresion extends AbstractController { + + + /* + * Variable que indica si se seleciona el check o no + */ + private Boolean verifica = false; + + + /** + * Variable que indica si se ha seleccionado un registro + */ + private boolean esCola = false; + + + /** + * Hailita el boton del flujo + */ + private boolean btnFlujo = false; + /* + * Variable que almacena el código de solicitud + */ + private String csolicitud; + /* + * Bean de tipo TarmSolicitud + */ + private TarmSolicitud solicitud = new TarmSolicitud(); + + @ManagedProperty(value = "#{docHabilitanteController}") + private DocumentoHabilitanteController docHabilitanteController; + + @ManagedProperty(value = "#{solicitudController}") + private SolicitudController solicitudController; + + @ManagedProperty(value = "#{recepcionArmasController}") + private RecepcionArmasController recepcionArmasController; + + + @ManagedProperty(value = "#{colaImpresionController}") + private ColaImpresionController colaImpresionController; + + /** + * Constructor + * @throws Exception + */ + public VerificacionReimpresion() throws Exception { + super(TarmSolicitudDocumento.class); + } + + /** + * Método invocado después de instanciar el controlador + * @throws Exception + */ + @PostConstruct + private void postconstruct() throws Exception { + // Inicializa autoconsulta + this.pasteBpmScreenParameters(); + super.startQuery(); + + if(super.getMfilters().get("csolicitud")==null || super.getMfilters().get("csolicitud").isEmpty()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_noexistesolicitud")); + return; + } + + csolicitud=super.getMfilters().get("csolicitud"); + this.getMfilters().clear(); + //this.getMfilters().put("pk.csolicitud", csolicitud); + this.solicitud= SolicitudController.findSolicitudxcodsolicitud(csolicitud); + this.getMfilelds().put("numerosolicitud", this.solicitud.getNumerosolicitud()); + + this.init(); + } + + /** + * Incializa variables del controlador, cuando se está utilizando una página que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "VERIFICARDOCUMENTOS"; + querydatabase(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + Filter filtroSinImpresionSolicitud=new Filter(); + filtroSinImpresionSolicitud.setSql("(t.chkimpresion='N' or t.chkimpresion is null) and t.pk.csolicitud = '" + this.solicitud.getPk() + "'"); + dto.addFiltro(filtroSinImpresionSolicitud); + + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + SubQuery qry = new SubQuery("TarmSolicitud", "ccentrocontrol", "ccentrocontrol", "i.pk = t.pk.csolicitud"); + dto.addSubQuery(qry); + SubQuery qry2 = new SubQuery("TgeneCatalogDetail", "description", "tramitedesc", + "i.pk.catalog = (select a.tipotramite from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento))) "// t.pk.csolicitud + + " and " + + "i.pk.catalogcode = (select a.tipotramitecodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))"); + dto.addSubQuery(qry2); + SubQuery qry3 = new SubQuery("TgeneCatalogDetail", "description", "categoriadesc", + "i.pk.catalog = (select a.categoria from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))" + + " and " + + "i.pk.catalogcode = (select a.categoriacodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))"); + dto.addSubQuery(qry3); + SubQuery qry4 = new SubQuery("TgeneCatalogDetail", "description", "usoactdesc", + "i.pk.catalog = (select a.usoactividad from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))" + + " and " + + "i.pk.catalogcode = (select a.usoactividadcodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))"); + dto.addSubQuery(qry4); + + + //ubicacion + SubQuery qryUbicacion = new SubQuery("TgeneProvince", "description", "ubicaciondesc", + "i.pk.countrycode = 'EC'" + + " and " + + "i.pk.provincecode = (select a.provincecode from TcustPersonAddress a where a.pk.personcode =(select o.personcode from TarmDocumentoHabilitante o where o.pk= t.pk.cdocumento )" + + " and a.principal='Y'" + + " and a.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD') )");// + dto.addSubQuery(qryUbicacion); + //TarmSolicitudDocumento + + SubQuery qry5 = new SubQuery("TarmDocumentoHabilitante", "fechaemision", "fechaemision", "i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry5); + SubQuery qry6 = new SubQuery("TarmDocumentoHabilitante", "fechaexpiracion", "fechaexpiracion", "i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry6); + SubQuery qry61 = new SubQuery("TarmDocumentoHabilitante", "estado ", "estado1", "i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry61); + SubQuery qry611 = new SubQuery("TarmDocumentoHabilitante", "estadocode ", "estado11", "i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry611); + SubQuery qry7 = new SubQuery("TgeneCatalogDetail", "description", "estado", + "i.pk.catalog = (select a.estado from TarmDocumentoHabilitante a where a.pk= t.pk.cdocumento) and " + + "i.pk.catalogcode = (select a.estadocode from TarmDocumentoHabilitante a where a.pk= t.pk.cdocumento)"); + dto.addSubQuery(qry7); + SubQuery qry8 = new SubQuery("TarmDocumentoHabilitante", "carma", "carma", "i.pk = t.pk.cdocumento and i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry8); + SubQuery qry9 = new SubQuery("TarmDocumentoHabilitante", "codigoarma", "codigoarma", "i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry9); + SubQuery qry10 = new SubQuery("TgeneCatalogDetail", "description", "tipoautorizacion", + "i.pk.catalog = (select a.tipoautorizacion from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud)) and " + + "i.pk.catalogcode = (select a.tipoautorizacioncodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud))"); + dto.addSubQuery(qry10); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + request.put("querytype", "P"); + request.put("queryalias", "VDOCUMENTO"); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + this.completaArmas(); + super.postQuery(this.lrecord); + lista(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Verifica la selección del documento según el check de + * reimpresion + */ + public void lista(){ + for (TarmSolicitudDocumento solicituddoc : lrecord) { + if(solicituddoc.getChkimpresion()!= null && solicituddoc.getChkimpresion().equals("Y")){ + solicituddoc.getModifiedData().put("verificador", Boolean.TRUE); + }else{ + solicituddoc.getModifiedData().put("verificador", Boolean.FALSE); + } + } + } + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + if(!validaSeleccion()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_reimpresion")); + return; + } + + this.actualizaVerificado(); + + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + dtosave.setPosition(2); + +// if(!dtosave.pendingProcess()){ +// return; +// } + //En caso de que los documentos sean de tipo de cola de impresion + enviaColaImpresion(); + + DtoSave dtosacola = colaImpresionController.getDtoSave(); + dtosacola.setReturnpk(true); + dtosacola.setPosition(1); + + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + msave.put(colaImpresionController.getBeanalias(), dtosacola); + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + btnFlujo=Boolean.TRUE; + this.postCommit(resp); + this.colaImpresionController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Selecciona los registros para establecer si el registro se reimprime o no. + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if(Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")){ + valorColocar = Boolean.TRUE; + } + for (TarmSolicitudDocumento solicituddoc : lrecord) { + solicituddoc.getModifiedData().put("verificador", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Actualiza la selección del documento según el check de + * reimpresion + * @throws Exception + */ + public void actualizaVerificado() throws Exception{ + for (TarmSolicitudDocumento solicituddoc : lrecord) { + if(solicituddoc.getModifiedData().get("verificador").equals(Boolean.TRUE)){ + solicituddoc.setChkimpresion("Y"); + }else { + solicituddoc.setChkimpresion("N"); + } + record=solicituddoc; + super.update(); + } + } + + + + /** + * + */ + @SuppressWarnings("unchecked") + protected void querydatabaseDocumentos() { + try { + + DtoQuery dto = super.getDtoQuery(true); + + if(csolicitud !=null ) + { + dto.addFiltro(new Filter("pk.csolicitud", csolicitud)); + } + + //solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(codigoSolicitud); + solicitud = ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(csolicitud); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (lrecord != null && !lrecord.isEmpty()) { + record = lrecord.get(0); + + + seleccionarDocumentos(); + } + super.postQuery(lrecord); + + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + /** + * Método que asigna la selección del documento según el check de + * reimpresion + * + * @throws Exception + */ + @SuppressWarnings("unused") + private void seleccionarDocumentos() throws Exception { + for (int i = 0; i < lrecord.size(); i++) { + TarmSolicitudDocumento docSeleccionada = lrecord.get(i); + if (docSeleccionada.getVerificado().equalsIgnoreCase("Y")) { + docSeleccionada.modifiedData().put("seleccion", Boolean.TRUE); + } else { + docSeleccionada.modifiedData().put("seleccion", Boolean.FALSE); + } + } + + } + + /** + * Método que completa la información del arma para los registros de la + * tabla TarmSolicitudDocumento + */ + public void completaArmas(){ + for(int i=0;idocumentosEnColaList = ColaImpresionController.findByDocumentoEstado(habilitante.getPk().toString(),"PIMPR"); + if(documentosEnColaList==null || documentosEnColaList.size()==0){ + esCola=true; + TarmColadeImpresion colaimpr = new TarmColadeImpresion(); + colaimpr.setCdocumento(habilitante.getPk()); + colaimpr.setEstadoimpresion("PIMPR"); + colaimpr.setEstadoimpresioncode("ESTADOIMPRESION"); + colaimpr.setFecharegistro(habilitante.getFechaemision()); + colaimpr.setIsnew(Boolean.TRUE); + colaImpresionController.update(colaimpr); + } + } + } + + } + } + + public Boolean getVerifica() { + return verifica; + } + + public void setVerifica(Boolean verifica) { + this.verifica = verifica; + } + + public SolicitudController getSolicitudController() { + return solicitudController; + } + + public void setSolicitudController(SolicitudController solicitudController) { + this.solicitudController = solicitudController; + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public RecepcionArmasController getRecepcionArmasController() { + return recepcionArmasController; + } + + public void setRecepcionArmasController( + RecepcionArmasController recepcionArmasController) { + this.recepcionArmasController = recepcionArmasController; + } + + public DocumentoHabilitanteController getDocHabilitanteController() { + return docHabilitanteController; + } + + public void setDocHabilitanteController( + DocumentoHabilitanteController docHabilitanteController) { + this.docHabilitanteController = docHabilitanteController; + } + + public ColaImpresionController getColaImpresionController() { + return colaImpresionController; + } + + public void setColaImpresionController( + ColaImpresionController colaImpresionController) { + this.colaImpresionController = colaImpresionController; + } + + public boolean isBtnFlujo() { + return btnFlujo; + } + + public void setBtnFlujo(boolean btnFlujo) { + this.btnFlujo = btnFlujo; + } + + public boolean isEsCola() { + return esCola; + } + + public void setEsCola(boolean esCola) { + this.esCola = esCola; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/VerificacionRequisitosSolicitudController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/VerificacionRequisitosSolicitudController.java.svn-base new file mode 100644 index 0000000..b16c3eb --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/VerificacionRequisitosSolicitudController.java.svn-base @@ -0,0 +1,1119 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.math.BigDecimal; +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.CargaController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.IngresoDatosTipoTramite; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.date.TgeneNotAccountingDayController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmAgenciaArma; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitos; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudTramiteKey; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora para la verificacion de los requisitos del tramite. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class VerificacionRequisitosSolicitudController extends AbstractController { + + /** + * codigo del flujo + */ + private String codigoSolicitud; + private BigDecimal costoTramite = new BigDecimal("0"); + private BigDecimal numeroArmas = new BigDecimal("0"); + private BigDecimal numeroDocuementos = new BigDecimal("0"); + private BigDecimal cantidad = new BigDecimal("0"); + private String numeroTramite; + private String tipoautorizacion; + private String usoactividad; + private Boolean btnGuardar= Boolean.FALSE; + private Boolean requiereCustodiosBln; + private Boolean requiereNoSolAucpBln; + + private List armas; + /** + * Fecha de atencion del proximo tramite + */ + private java.util.Date fechaAtencionTramite; + /** + * Bandera de tipo booleano para indicar si se habilita el boton de completar tarea + */ + private Boolean isEnableCompletarTarea= Boolean.FALSE; + + /** + * Codigo de la tabla TGENECATALOGDETAIL para indicar que el tipo de costo es Total + */ + private final String TIPOCOSTOTOTAL = "2"; + /** + * Codigo de la tabla TGENECATALOGDETAIL para indicar que el registro a buscarse eN CATALOG es COSTOCUSTODIO + */ + private final String CODIGOCOSTOCUSTODIO = "COSTOCUSTODIO"; + + /** + * Variable del tipo TarmSolicitudnal + */ + private TarmSolicitud recordsolicitud; + /** + * Variable del tipo TarmSolicitudnal + */ + TarmSolicitudTramite recordSolicitudTra; + + /** + * Variable del tipo TgeneCatalogDetail(catalogo del tipo de documento) + */ + private TgeneCatalogDetail nombreDocumento; + /** + * Variable del tipo TgeneCatalogDetail(catalogo del tramite) + */ + private TgeneCatalogDetail nombreTramite; + /** + * Variable del tipo TgeneCatalogDetail(catalogo de la categoria) + */ + private TgeneCatalogDetail nombreCategoria; + /** + * Variable del tipo TgeneCatalogDetail(catalogo del uso actividad del tramite) + */ + private TgeneCatalogDetail nombreUsoActividad; + /** + * lista del catalogo de las acciones (Aceptar o rechazar) + */ + private List laccion; + /** + * atributo para el estado de la solicitud aprobado o anulado + */ + private String estado; + /** + * observacion de la solicitud + */ + private String observacion; + /** + * controlador de los requisitos de la solicitud + */ + @ManagedProperty(value = "#{solicitudRequisitosController}") + private SolicitudRequisitosController requisitos; + /** + * controlador si aprueban la solicitud se genera el numero de tramite + */ + @ManagedProperty(value = "#{solicitudTramiteController}") + private SolicitudTramiteController solicitudTramiteController; + /** + * controlador de la solicitud + */ + @ManagedProperty(value = "#{solicitudArmasController}") + private SolicitudArmasController solicitud; + /** + * controlador para el manejo de los archivos del alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + /** + * Controlador del tramite + */ + @ManagedProperty(value = "#{ingresoDatosTipoTramite}") + private IngresoDatosTipoTramite tramite; + + /** + * Propiedad usada para el manejo del centro de control de armas + */ + @ManagedProperty(value = "#{centroControlArmasController}") + private CentroControlArmasController centroControlArmasController; + + /** + * Controlador de Documento Habilitante + */ + @ManagedProperty(value = "#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitanteController; + + /** + * Controlador que maneja las armas asociadas a las agencias + */ + @ManagedProperty(value="#{agenciaArmaController}") + private AgenciaArmaController agenciaArma; + + /** + *Referencia al Centro de control; + */ + private TarmCentroControl centroControl = new TarmCentroControl(); + + /** + *Nombre de la Institucion + */ + private String nombreInstitucion; + + public VerificacionRequisitosSolicitudController() throws Exception { + super(AbstractDataTransport.class); + } + + /** + * Controlador que maneja cargas para previa importacion + */ + @ManagedProperty(value = "#{cargaController}") + private CargaController cargaController; + + @PostConstruct + private void postconstruct() { + + try { + super.startQuery(); + fechaAtencionTramite = new Date(new java.util.Date().getTime()); + codigoSolicitud = this.getMfilters().get("codigoSolicitud"); + int numArmasInt = TarmSolicitudArmasController.getNumeroArmasPorSolicitud(codigoSolicitud); + numeroArmas = new BigDecimal(numArmasInt); + habilitarIngresoCustodios(); + this.getMfilters().clear(); + this.getRequisitos().getMfilters().clear(); + this.getSolicitud().getMfilters().clear(); + this.getSolicitudTramiteController().getMfilters().clear(); + this.getTramite().getMfilters().clear(); + this.init(); + cargaDatos(); + mostrarNoSolAucp(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que se encarga de determinar si se requiere o no ingresar numero de custodios + */ + private void habilitarIngresoCustodios(){ + TgeneParameters minArmasReqCustodiaObj = ParametersController.find("NUMERO.ARMAS.FLUJO", "1"); + if(numeroArmas.compareTo(minArmasReqCustodiaObj.getNumbervalue())<=0){ + requiereCustodiosBln = Boolean.FALSE; + }else{ + requiereCustodiosBln = Boolean.TRUE; + } + } + + /** + * Metodo que se encarga de mostrar el numero de solicitud aucp o no si la categoria es igual previa importacion + */ + private void mostrarNoSolAucp(){ + // CATEGORIA 14 PREVIA IMPORTACION + TarmTramite tarmTramite = TarmTramiteController.find(this.recordsolicitud.getCtramite().toString()); + if(tarmTramite.getCategoria().equals("14")){ + requiereNoSolAucpBln=Boolean.TRUE; + }else{ + requiereNoSolAucpBln=Boolean.FALSE; + } + + } + + /** + * Metodo para obtener los datos iniciales + * @throws Exception + */ + public void cargaDatos() throws Exception{ + //solicitud(Persona tramite) + recordsolicitud=SolicitudArmasController.find(codigoSolicitud); + this.armas= TarmSolicitudArmasController.findPorCSolicitud(this.codigoSolicitud); + //Comprobando que tenga tramites anteriores caducados + //Obteniendo la solicitud + TarmSolicitud solicitud=SolicitudController.findSolicitudxcodsolicitud(this.codigoSolicitud); + +// if(solicitud!=null){ + + //Obteniendo el tramite de la solicitud +// TarmTramite tramite=TarmTramiteController.find(solicitud.getCtramite().toString()); + + //Validando que el tipo de tramite sea de Renovacion +// if(tramite.getTipotramite().equalsIgnoreCase("3")){ + //Obteniendo los documentos habilitantes +// List documentosPersona=DocumentoHabilitanteController.findPorPersoncode(solicitud.getPersoncode().toString()); +// List documentosTramite=new ArrayList(); +// List tramites=new ArrayList(); + +// for (TarmDocumentoHabilitante d : documentosPersona) { +// //Obteniendo el tramite del documento +// TarmTramite t=TarmTramiteController.find(d.getCtramite().toString()); +// if(t!=null && t.getTipoautorizacion().equalsIgnoreCase(tramite.getTipoautorizacion()) +// && t.getCategoria().equalsIgnoreCase(tramite.getCategoria()) +// && t.getUsoactividad().equalsIgnoreCase(tramite.getUsoactividad())){ +// tramites.add(t); +// documentosTramite.add(d); +// } +// } + + //Obteniendo el documento de mayor fecha(ultimo documento) +// TarmDocumentoHabilitante ultimoDocumento=documentosTramite.get(0); +// TarmTramite ultimoTramite=tramites.get(0); +// +// for (int i = 1; i < documentosTramite.size(); i++) { +// if(documentosTramite.get(i).getFechaemision().after(ultimoDocumento.getFechaemision())){ +// ultimoDocumento=documentosTramite.get(i); +// ultimoTramite=tramites.get(i); +// } +// } + + //Verificando que el documento este caducado +// Date fechaActual=new Date(Calendar.getInstance().getTimeInMillis()); +// if(ultimoDocumento.getFechaexpiracion().before(fechaActual)){ +// //Calculando el valor de la multa +// Long MILISEGUNDOS_POR_DIA = 24 * 60 * 60 * 1000L; //Milisegundos al dia +// java.util.Date fechaActual2=Calendar.getInstance().getTime(); +// +// Calendar calendar=Calendar.getInstance(); +// calendar.setTime(ultimoDocumento.getFechaexpiracion()); +// java.sql.Date fechaAnterior = new java.sql.Date(calendar.getTimeInMillis()); +// +// Long diferenciaDias = ( fechaActual2.getTime() - fechaAnterior.getTime() )/MILISEGUNDOS_POR_DIA; +// Double valorMulta=0.0; +// Double multaConfig=0.0; +// if(tramite.getMulta()!=null){ +// multaConfig=Double.parseDouble(tramite.getMulta().toString()); +// } +// +// //Autorizacion +// if(ultimoTramite.getTipoautorizacion().equalsIgnoreCase("1")){ +// if(diferenciaDias>30){ +// valorMulta=multaConfig*((diferenciaDias-30)/365); +// } +// +// //Permiso +// }else if(ultimoTramite.getTipoautorizacion().equalsIgnoreCase("6")){ +// //Obteniendo las armas +// this.armas= TarmSolicitudArmasController.findPorCSolicitud(this.codigoSolicitud); +// int totalArmas=this.armas.size(); +// valorMulta=(multaConfig/12)*(diferenciaDias/30)*totalArmas; +// } +// +// this.recordsolicitud.setMulta(new BigDecimal(valorMulta.toString())); +// this.recordsolicitud.setMulta(BigDecimal.ZERO); +// } +// } +// } + + //nombre documento + nombreDocumento= CatalogDetailController.findxCodigoCodcatalogo + (recordsolicitud.getModifiedData().get("identificationcatalog").toString(), recordsolicitud.getModifiedData().get("identificationcatalogcode").toString()); + if(nombreDocumento!=null){ + //Tramite + nombreTramite= CatalogDetailController.findxCodigoCodcatalogo + (recordsolicitud.getModifiedData().get("tipoautorizacion").toString(), recordsolicitud.getModifiedData().get("tipoautorizacioncodigo").toString()); + nombreCategoria= CatalogDetailController.findxCodigoCodcatalogo + (recordsolicitud.getModifiedData().get("categoria").toString(), recordsolicitud.getModifiedData().get("categoriacodigo").toString()); + nombreUsoActividad= CatalogDetailController.findxCodigoCodcatalogo + (recordsolicitud.getModifiedData().get("usoactividad").toString(), recordsolicitud.getModifiedData().get("usoactividadcodigo").toString()); + //lista de requisitos + requisitos.getMfilters().put("pk.csolicitud", codigoSolicitud); + requisitos.query(); + //variable para validar el boton + requisitos.setAuxBotonVerificacion(Boolean.TRUE); + for(TarmSolicitudRequisitos item:requisitos.getLrecord()){ + if(item.getEstadovalidacion()!=null && item.getEstadovalidacion().equals("Y")){ + item.modifiedData().put("estado", Boolean.TRUE); + }else{ + //item.modifiedData().put("estado", Boolean.FALSE); + requisitos.setAuxBotonVerificacion(Boolean.FALSE); + } + } + this.obtenerCentroControl(solicitud); + //valida lo del combo del flujo + validacioComboFlujo(); + }else{ + MessageHelper.setMessageError("NO EXISTE SOLICITUD PENDIENTE"); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + @SuppressWarnings("unused") + private void init() { + TgeneParameters parametersAutorizacion= ParametersController.find("CODIGO.GUIA.LIBRETRANSITO", "1"); //4 + TgeneParameters parametersUsoActividad= ParametersController.find("CODIGO.FUEGOS.PIROTECNICOS", "1");//17 + tipoautorizacion=parametersAutorizacion.getTextvalue(); + usoactividad=parametersUsoActividad.getTextvalue(); + } + + /** + * Metodo para cargar actualizar la solicitud + * validando que el numero de custodio sea mayor a cero y cumpla con la condicion + * @throws Exception + */ + public void cargarSolicitud() throws Exception{ + recordsolicitud.setFverificarequisitos(new Date(new java.util.Date().getTime())); + if(codigoAceptado().equals(estado)){ + //validacion drf Tramite es Guia de Libre Transito y el Uso/Actividad es diferente a Fuegos Pirotecnicos, el campo No. Custodios sea mayor que cero. + if(recordsolicitud.getModifiedData().get("tipoautorizacion").toString().equals(tipoautorizacion) && + !recordsolicitud.getModifiedData().get("usoactividad").toString().equals(usoactividad)){ + if(recordsolicitud.getNumerocustodios()<0){ + MessageHelper.setMessageError("EL N\u00DAMERO DE CUSTODIOS DEBE SER POSITIVO"); + return; + } + } + recordsolicitud.setObservacion(observacion); + recordsolicitud.setEstado(estado); + recordsolicitud.setEstadocodigo("ESTADOSOLICITUD"); + solicitud.update(recordsolicitud); + }else{ + recordsolicitud.setObservacion(observacion); + recordsolicitud.setEstadocodigo("ESTADOSOLICITUD"); + recordsolicitud.setEstado(estado);//ACCION + solicitud.update(recordsolicitud); + } + + } + + /** + * Obtiene el centro de control segun usurio logeado. + * @param solicitud + * @throws Exception + * + */ + private void obtenerCentroControl(TarmSolicitud solicitud) throws Exception { + + this.centroControl= CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + this.setNombreInstitucion(CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + + } + + /** + * Metodo para cargar el registro de la solicitud tramite en la lista new + * @throws Exception + */ + public void cargaDatosSolicitudTramite() throws Exception{ + recordSolicitudTra = new TarmSolicitudTramite(); + TarmSolicitudTramiteKey pk=new TarmSolicitudTramiteKey(); + // Setear el valor a pagar en la tabla tramite + TarmTramite tramiteActual = IngresoDatosTipoTramite.find(recordsolicitud.getCtramite().toString()); + List ldocumentos = this.documentoHabilitanteController.findXSolicitudNueva(codigoSolicitud); + // Valor a pagar por concepto de custudios + BigDecimal valorAPagarArmas = new BigDecimal("0"); + /*if(tramiteActual.getTipocosto().equals("2")){ + valorAPagarArmas = tramiteActual.getCosto(); + } + else{ +// numeroArmas = new BigDecimal(TarmSolicitudArmasController.getNumeroArmasPorSolicitud(codigoSolicitud)); + BigDecimal costoPorArma = tramiteActual.getCosto(); + valorAPagarArmas = costoPorArma.multiply(numeroArmas); + } */ + if(tramiteActual.getTipocosto().equals("2")){ + valorAPagarArmas = tramiteActual.getCosto(); + } + else if (numeroArmas!=null && numeroArmas.compareTo(new BigDecimal(0))>0) { + numeroArmas = new BigDecimal(TarmSolicitudArmasController.getNumeroArmasPorSolicitud(codigoSolicitud)); + this.cantidad = this.numeroArmas; + BigDecimal costoPorArma = tramiteActual.getCosto(); + valorAPagarArmas = costoPorArma.multiply(numeroArmas); + }else { + numeroDocuementos = new BigDecimal(ldocumentos.size()); + this.cantidad = this.numeroDocuementos; + BigDecimal costoPorArma = tramiteActual.getCosto(); + valorAPagarArmas = costoPorArma.multiply(numeroDocuementos); + } + recordSolicitudTra.setValortramitearmas(valorAPagarArmas); + // Valor a pagar por concepto de custudios + BigDecimal numeroCustodios = new BigDecimal("0"); + if(recordsolicitud.getNumerocustodios()!=null){ + numeroCustodios = new BigDecimal(recordsolicitud.getNumerocustodios()); + } + BigDecimal costoCustodio = new BigDecimal("0"); + if(tramiteActual.getCostocustodio()!=null){ + costoCustodio = tramiteActual.getCostocustodio(); + } + BigDecimal valorAPagarCustodio = costoCustodio.multiply(numeroCustodios); + recordSolicitudTra.setValorcustodios(valorAPagarCustodio); + // Valor a pagar por concepto de multas + BigDecimal multa=new BigDecimal("0"); + if(recordsolicitud.getMulta()!=null){ + multa = recordsolicitud.getMulta(); + } + recordSolicitudTra.setValormulta(multa); + // Sumamos el valor de a pagar de las armas, custodios y multa + costoTramite = valorAPagarArmas.add(valorAPagarCustodio).add(multa); + + recordSolicitudTra.setValorapagar(costoTramite); + pk.setCsolicitud(codigoSolicitud); + pk.setCtramite(Long.valueOf(recordsolicitud.getModifiedData().get("pk").toString())); + recordSolicitudTra.setPk(pk); + numeroTramite=recordsolicitud.getNumerosolicitud().replace("SOL", "TRA"); + recordSolicitudTra.setNumerotramite(numeroTramite); + recordSolicitudTra.setEstadotramite(codigo("CODIGO.REG.ESTADOSOLICITUD"));//CODIGO.REG.ESTADOSOLICITUD REG + recordSolicitudTra.setEstadotramitecodigo("ESTADOSOLICITUD"); + solicitudTramiteController.update(recordSolicitudTra); + } + + /** + * Metodo para generar el numero de tramite + */ + public void generaNumeroTramite(){ + if(recordsolicitud.getModifiedData().get("tipoautorizacion").toString().equals(tipoautorizacion) && + !recordsolicitud.getModifiedData().get("usoactividad").toString().equals(usoactividad)){ + if(recordsolicitud.getNumerocustodios()==null || recordsolicitud.getNumerocustodios()<0){ + MessageHelper.setMessageError("EL N\u00DAMERO DE CUSTODIOS DEBE SER POSITIVO"); + return; + } + } + numeroTramite=recordsolicitud.getNumerosolicitud().replace("SOL", "TRA"); + validacioComboFlujo(); + } + + public void validacioComboFlujo(){ + try { + TgeneParameters tgeneparam=ParametersController.find("CODIGO.AR", "1"); + laccion=CatalogDetailController.find("ESTADOSOLICITUD",tgeneparam.getTextvalue()); + TgeneCatalogDetail catalogDetail=null; + for(TgeneCatalogDetail item:laccion){ + if(requisitos.getAuxBotonVerificacion()){ + if(!item.getPk().getCatalog().equals(codigoAceptado())){ + catalogDetail=item; + estado = "APB"; + } + }else{ + if(item.getPk().getCatalog().equals(codigoAceptado())){ + catalogDetail=item; + estado = "ANU"; + } + } + } + laccion.remove(catalogDetail); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("TID", tid); + request.modifiedData().put("csolicitud", recordsolicitud.getPk()); + Mapdatosmail = new HashMap(); + if (codigoAceptado().equals(estado)) { + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + datosmail.put("razonsocial",recordsolicitud.getModifiedData().get("nombre")); + datosmail.put("tipoTramite",nombreTramite.getDescription()); + datosmail.put("actividad",nombreUsoActividad.getDescription()); + datosmail.put("categoria",nombreCategoria.getDescription()); + datosmail.put("numeroTramite", numeroTramite); + datosmail.put("costoTramite", costoTramite); + datosmail.put("abrevMoneda", ParametersController.find("ABREVMONEDA", "1").getTextvalue()); + datosmail.put("nombreDelBanco",ParametersController.find("BANCODEPOSITO", "1").getTextvalue()); + datosmail.put("cuentaCorriente",ParametersController.find("CUENTADEPOSITO", "1").getTextvalue()); + datosmail.put("diasLaborablesDeposito",ParametersController.find("DIASDEPOSITO", "1").getNumbervalue().toString()); + TsafeUserDetail userDetailObj=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personDetailObj=PersonDetailController.find(userDetailObj.getPk().getPersoncode().toString()); + // Datos del funcionario que valida + datosmail.put("funcionario",personDetailObj.getName()); + datosmail.put("grado",personDetailObj.getMilitarygrade()==null?"":personDetailObj.getMilitarygrade()); + // Centro de control de armas + TarmCentroControl centroControlObj=CentroControlArmasController.findPorCodigo(solicitud.getRecord().getCcentrocontrol()); + datosmail.put("nombreCCAsignado",centroControlObj.getModifiedData().get("desnombreinstitucion")); + datosmail.put("nombreCCA",centroControlObj.getModifiedData().get("desnombreinstitucion")); //Pendiente + if(recordsolicitud.getModifiedData().get("tipoautorizacion")!=null && costoTramite.compareTo(new BigDecimal("0"))==0){ + // En el caso de permisos enviamos una notificacion al cliente con algunos parametros adicionales + if(recordsolicitud.getModifiedData().get("tipoautorizacion").toString().equalsIgnoreCase("6")){ + generarFechaProximoTramite(); + SimpleDateFormat sdf = new SimpleDateFormat(MsgGeneral.getProperty("dateformat")); + datosmail.put("fechaGenerada",sdf.format(fechaAtencionTramite)); + datosmail.put("nombreCCACliente",obtenerCentroControlSolicitante()); + } + } + } else { + datosmail.put("razonsocial",recordsolicitud.getModifiedData().get("nombre")); + datosmail.put("nombre",recordsolicitud.getModifiedData().get("nombre")); + datosmail.put("numerosolicitud",recordsolicitud.getNumerosolicitud()); + SimpleDateFormat fm= new SimpleDateFormat("dd-MM-yyyy"); + datosmail.put("fechasolicitud",fm.format(recordsolicitud.getFregistro())); + datosmail.put("observaciones",observacion); + //grado funcionario de la persona logeada + TsafeUserDetail userDetailObj=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personDetailObj=PersonDetailController.find(userDetailObj.getPk().getPersoncode().toString()); + datosmail.put("grado",personDetailObj.getMilitarygrade()); + datosmail.put("funcionario",personDetailObj.getName()); + // Centro de control de armas + TarmCentroControl centroControlObj=CentroControlArmasController.findPorCodigo(solicitud.getRecord().getCcentrocontrol()); + String nombreCentroControl=CatalogDetailController.findxCodigoCodcatalogo( centroControlObj.getNombreinstitucion(), + centroControlObj.getNombreinstitucioncodigo()).getDescription(); + datosmail.put("centrocontrol",nombreCentroControl); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "D" : bpmDataStatus); // A,D,R + } + + datosmail.put("costoTramite", costoTramite); + request.modifiedData().put("datosmail", datosmail); + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + if(estado.equalsIgnoreCase("ANU")){ + saveAnularSolicitud(); + } + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void saveAnularSolicitud() { + try { + // CATEGORIA 14 PREVIA IMPORTACION + TarmTramite tarmTramite = TarmTramiteController.find(this.solicitud.getRecord().getCtramite().toString()); + if(tarmTramite.getCategoria().equals("14")){ + desasociarCargaSolicitud(); + } + + //Poner la solicitud en estado anulado + recordsolicitud.setEstado("ANU"); + recordsolicitud.setAucp(null); + solicitud.setRecord(recordsolicitud); + solicitud.update(); + DtoSave dtoSolicitud = solicitud.getDtoSave(); + + TarmSolicitudTramite solicitudTramiteObj = SolicitudTramiteController.findByCSolicitud(recordsolicitud.getPk()); + if(solicitudTramiteObj!=null){ + solicitudTramiteObj.setIsnew(false); + solicitudTramiteObj.setEstadotramite("ANU"); + solicitudTramiteController.updateSolicitud(solicitudTramiteObj); + } + //Desasociar las armas en apertura de agencias y apertura de sucursales + if(recordsolicitud.getCtramite()==44 || recordsolicitud.getCtramite()==48){ + List armasSolicitudList = RecepcionArmasController.findPorSolicitud(recordsolicitud.getPk()); + for(TarmSolicitudArmas armaObj:armasSolicitudList){ + + // Codigo agencia de la solicitud + ListsolicitudAgenciaLst = SolicitudAgenciaSucursalController.findPorSolicitud(recordsolicitud.getPk()); + for(TarmSolicitudAgenciaSucursal solicitudAgenciaSucursalObj:solicitudAgenciaLst){ + String cAgencia = solicitudAgenciaSucursalObj.getPk().getCagencia().toString(); + TarmAgenciaArma agenciaArmaObj = AgenciaArmaController.findByCArma(armaObj.getPk().getCarma(), cAgencia); + agenciaArma.setRecord(agenciaArmaObj); + agenciaArma.remove(); + } + } + } + + DtoSave dtoSolicitudTramite = solicitudTramiteController.getDtoSave(); + DtoSave dtoAgenciaArma = agenciaArma.getDtoSave(); + + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + msave.put(solicitud.getBeanalias(), dtoSolicitud); // adicionar metadata de mantenimiento para cada tabla. + msave.put(solicitudTramiteController.getBeanalias(), dtoSolicitudTramite); + msave.put(agenciaArma.getBeanalias(), dtoAgenciaArma); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + solicitud.postCommit(resp); + solicitudTramiteController.postCommit(resp); + agenciaArma.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Genera la fecha disponible para el proximo tramite en el centro de control de armas respectivo + */ + public void generarFechaProximoTramite(){ + try { + // Validamos si ya existe una fecha para realizar el proximo tramite + TarmCentroControl centroControlObj = CentroControlArmasController.findPorCodigo(recordsolicitud.getCcentrocontrol()); + centroControlObj.isnew = false; + Date fechaActual=new Date(Calendar.getInstance().getTimeInMillis()); + if(centroControlObj.getFechaproximotramite()==null || centroControlObj.getFechaproximotramite().before(fechaActual)){ + fechaAtencionTramite = TgeneNotAccountingDayController.diasLaborablesPosterioresAUnaFecha(new java.util.Date(), 1); + }else{ + fechaAtencionTramite = centroControlObj.getFechaproximotramite(); + } + // Numero de armas de la solicitud + ListarmasList = RecepcionArmasController.findPorSolicitud(recordsolicitud.getPk()); + int numArmasSolicitud = armasList.size(); + int salvedad = 10; + int capacidadCentroUltDia = 0; + if(centroControlObj.getCuposlibresultimodia()!=null){ + capacidadCentroUltDia = centroControlObj.getCuposlibresultimodia(); + } + else{ + capacidadCentroUltDia = centroControlObj.getTramitespordia(); + } + // Si la capacidad del centro en el ultimo dia es mayor al numero de armas a revisarse + if(numArmasSolicitud < capacidadCentroUltDia){ + centroControlObj.setCuposlibresultimodia(capacidadCentroUltDia - numArmasSolicitud); + centroControlArmasController.update(centroControlObj); + centroControlArmasController.save(); + + } + else if((numArmasSolicitud == capacidadCentroUltDia) || (numArmasSolicitud <= (capacidadCentroUltDia + salvedad))){ + // Si la capacidad del centro es igual al numero de armas a revisarse o ajusta cupo con la salvedad + centroControlObj.setCuposlibresultimodia(centroControlObj.getTramitespordia()); + java.util.Date newFechaAtencionTramite = TgeneNotAccountingDayController.diasLaborablesPosterioresAUnaFecha(fechaAtencionTramite, 1); + centroControlObj.setFechaproximotramite(new java.sql.Date(newFechaAtencionTramite.getTime())); + centroControlArmasController.update(centroControlObj); + centroControlArmasController.save(); + + } + else{ + // Cociente y residuo para los casos donde se tiene 50 armas o mas a tramitarse + int diasRequeridos = numArmasSolicitud/centroControlObj.getTramitespordia(); + // Requerido para el calculo de los cupos disponibles para el ultimo dia + int residuoDiasRequeridos = numArmasSolicitud%centroControlObj.getTramitespordia(); + fechaAtencionTramite = TgeneNotAccountingDayController.diasLaborablesPosterioresAUnaFecha(fechaAtencionTramite, 1); + java.util.Date newFechaAtencionTramite; + + centroControlObj.setCuposlibresultimodia(centroControlObj.getTramitespordia()-residuoDiasRequeridos); + newFechaAtencionTramite = TgeneNotAccountingDayController.diasLaborablesPosterioresAUnaFecha(fechaAtencionTramite, diasRequeridos); + + centroControlObj.setFechaproximotramite(new java.sql.Date(newFechaAtencionTramite.getTime())); + centroControlArmasController.update(centroControlObj); + centroControlArmasController.save(); + + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + + } + } + + /** + * Metodo que devuelve el centro de control al que pertenece el cliente dueno de la solicitud + * @throws Exception + */ + private String obtenerCentroControlSolicitante() throws Exception { + String institucionCentroControl=""; + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(recordsolicitud.getPersoncode().toString()); + if(tcustPersonAddres!=null && tcustPersonAddres.getProvincecode()!=null){ + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + if(centroControlJur!=null && centroControlJur.getCcentrocontrol()!=null){ + TarmCentroControl centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + }else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_laprovinciasinccontrol")); + return MsgControlArmas.getProperty("msg_error_laprovinciasinccontrol"); + } + }else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_notienedireccionprincipal")); + return MsgControlArmas.getProperty("msg_error_notienedireccionprincipal"); + } + + return institucionCentroControl; + } + + + @Override + public void save() { + try { + Request request = callerhelper.getRequest(); + // validamos si cargamos los datos cuando apruebe + if (codigoAceptado().equals(estado)) { + cargaDatosSolicitudTramite(); + } + HashMap msave = new HashMap(); + cargarSolicitud(); + // actualiza los requisitos + DtoSave dtosavereq = requisitos.getDtoSave(); + dtosavereq.setReturnpk(true); + dtosavereq.setPosition(1); + msave.put(requisitos.getBeanalias(), dtosavereq); + + // inserta un nuevo registro en tarmSolicitudTramite + DtoSave dtosavesol = solicitudTramiteController.getDtoSave(); + dtosavesol.setIsForm(true); + dtosavesol.setReturnpk(true); + dtosavesol.setPosition(2); + msave.put(solicitudTramiteController.getBeanalias(), dtosavesol); + + // actualiza la solicitud el numero de custodios + DtoSave dtossolicitud = solicitud.getDtoSave(); + dtosavesol.setIsForm(true); + dtosavesol.setReturnpk(true); + dtosavesol.setPosition(3); + msave.put(solicitud.getBeanalias(), dtossolicitud); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + requisitos.postCommit(resp); + solicitudTramiteController.postCommit(resp); + // ocultarBotonInicioFlujo = false; + MessageHelper.setMessageInfo(resp); + btnGuardar = Boolean.TRUE; + isEnableCompletarTarea = Boolean.TRUE; + } else { + // ocultarBotonInicioFlujo = true; + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void desasociarCargaSolicitud(){ + try{ + TarmCarga carga = CargaController.findByAUCP(solicitud.getRecord().getAucp()); + if(carga!=null){ + carga.setCsolicitud(null); + cargaController.update(carga); + cargaController.save(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public String codigoAceptado() throws Exception { + TgeneParameters f = ParametersController.find("ACEPTADO", "1");//APB ESTADOSOLICITUD + return f.getTextvalue(); + } + + public String codigo(String codigo) throws Exception { + TgeneParameters f = ParametersController.find(codigo, "1");//APB ESTADOSOLICITUD + return f.getTextvalue(); + } + + @Override + protected void querydatabase() { + try { + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + public void postCommit(Response response) throws Exception { + } + + + public String getCodigoSolicitud() { + return codigoSolicitud; + } + + public void setCodigoSolicitud(String codigoSolicitud) { + this.codigoSolicitud = codigoSolicitud; + } + + + public SolicitudRequisitosController getRequisitos() { + return requisitos; + } + + public void setRequisitos(SolicitudRequisitosController requisitos) { + this.requisitos = requisitos; + } + + public TarmSolicitud getRecordsolicitud() { + return recordsolicitud; + } + + public void setRecordsolicitud(TarmSolicitud recordsolicitud) { + this.recordsolicitud = recordsolicitud; + } + + public TgeneCatalogDetail getNombreDocumento() { + return nombreDocumento; + } + + public void setNombreDocumento(TgeneCatalogDetail nombreDocumento) { + this.nombreDocumento = nombreDocumento; + } + + public TgeneCatalogDetail getNombreTramite() { + return nombreTramite; + } + + public void setNombreTramite(TgeneCatalogDetail nombreTramite) { + this.nombreTramite = nombreTramite; + } + + public TgeneCatalogDetail getNombreCategoria() { + return nombreCategoria; + } + + public void setNombreCategoria(TgeneCatalogDetail nombreCategoria) { + this.nombreCategoria = nombreCategoria; + } + + public TgeneCatalogDetail getNombreUsoActividad() { + return nombreUsoActividad; + } + + public void setNombreUsoActividad(TgeneCatalogDetail nombreUsoActividad) { + this.nombreUsoActividad = nombreUsoActividad; + } + + public SolicitudTramiteController getSolicitudTramiteController() { + return solicitudTramiteController; + } + + public void setSolicitudTramiteController( + SolicitudTramiteController solicitudTramiteController) { + this.solicitudTramiteController = solicitudTramiteController; + } + + public List getLaccion() { + return laccion; + } + + public void setLaccion(List laccion) { + this.laccion = laccion; + } + + public SolicitudArmasController getSolicitud() { + return solicitud; + } + + public void setSolicitud(SolicitudArmasController solicitud) { + this.solicitud = solicitud; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public IngresoDatosTipoTramite getTramite() { + return tramite; + } + + public void setTramite(IngresoDatosTipoTramite tramite) { + this.tramite = tramite; + } + + public BigDecimal getCostoTramite() { + return costoTramite; + } + + public void setCostoTramite(BigDecimal costoTramite) { + this.costoTramite = costoTramite; + } + + public BigDecimal getNumeroArmas() { + return numeroArmas; + } + + public void setNumeroArmas(BigDecimal numeroArmas) { + this.numeroArmas = numeroArmas; + } + + public String getNumeroTramite() { + return numeroTramite; + } + + public void setNumeroTramite(String numeroTramite) { + this.numeroTramite = numeroTramite; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public String getObservacion() { + return observacion; + } + + public void setObservacion(String observacion) { + this.observacion = observacion; + } + + public String getTipoautorizacion() { + return tipoautorizacion; + } + + public void setTipoautorizacion(String tipoautorizacion) { + this.tipoautorizacion = tipoautorizacion; + } + + public String getUsoactividad() { + return usoactividad; + } + + public void setUsoactividad(String usoactividad) { + this.usoactividad = usoactividad; + } + + public Boolean getBtnGuardar() { + return btnGuardar; + } + + public void setBtnGuardar(Boolean btnGuardar) { + this.btnGuardar = btnGuardar; + } + + public Boolean getIsEnableCompletarTarea() { + return isEnableCompletarTarea; + } + + public void setIsEnableCompletarTarea(Boolean isEnableCompletarTarea) { + this.isEnableCompletarTarea = isEnableCompletarTarea; + } + + public java.util.Date getFechaAtencionTramite() { + return fechaAtencionTramite; + } + + public void setFechaAtencionTramite(java.util.Date fechaAtencionTramite) { + this.fechaAtencionTramite = fechaAtencionTramite; + } + + public CentroControlArmasController getCentroControlArmasController() { + return centroControlArmasController; + } + + public void setCentroControlArmasController( + CentroControlArmasController centroControlArmasController) { + this.centroControlArmasController = centroControlArmasController; + } + + public Boolean getRequiereCustodiosBln() { + return requiereCustodiosBln; + } + + public void setRequiereCustodiosBln(Boolean requiereCustodiosBln) { + this.requiereCustodiosBln = requiereCustodiosBln; + } + + public void changeEstado(){ + System.out.println("EL ESTADO ACTUAL ES:"+ estado); + } + + public DocumentoHabilitanteController getDocumentoHabilitanteController() { + return documentoHabilitanteController; + } + + public void setDocumentoHabilitanteController( + DocumentoHabilitanteController documentoHabilitanteController) { + this.documentoHabilitanteController = documentoHabilitanteController; + } + + public BigDecimal getCantidad() { + return cantidad; + } + + public void setCantidad(BigDecimal cantidad) { + this.cantidad = cantidad; + } + + public List getArmas() { + return armas; + } + + public void setArmas(List armas) { + this.armas = armas; + } + + public TarmSolicitudTramite getRecordSolicitudTra() { + return recordSolicitudTra; + } + + public void setRecordSolicitudTra(TarmSolicitudTramite recordSolicitudTra) { + this.recordSolicitudTra = recordSolicitudTra; + } + + public AgenciaArmaController getAgenciaArma() { + return agenciaArma; + } + + public void setAgenciaArma(AgenciaArmaController agenciaArma) { + this.agenciaArma = agenciaArma; + } + + public CargaController getCargaController() { + return cargaController; + } + + public void setCargaController(CargaController cargaController) { + this.cargaController = cargaController; + } + + public Boolean getRequiereNoSolAucpBln() { + return requiereNoSolAucpBln; + } + + public void setRequiereNoSolAucpBln(Boolean requiereNoSolAucpBln) { + this.requiereNoSolAucpBln = requiereNoSolAucpBln; + } + + public String getNombreInstitucion() { + return nombreInstitucion; + } + + public String setNombreInstitucion(String nombreInstitucion) { + if(nombreInstitucion!=null && !nombreInstitucion.isEmpty()){ + this.nombreInstitucion = nombreInstitucion; + }else{ + this.nombreInstitucion = ""; + } + + return nombreInstitucion; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/VerificarMaterialDecomisadoController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/VerificarMaterialDecomisadoController.java.netbeans-base new file mode 100644 index 0000000..9a4660a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/VerificarMaterialDecomisadoController.java.netbeans-base @@ -0,0 +1,394 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.event.AjaxBehaviorEvent; + +import org.primefaces.component.selectbooleancheckbox.SelectBooleanCheckbox; +import org.primefaces.context.RequestContext; +import org.primefaces.event.TabChangeEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class VerificarMaterialDecomisadoController extends AbstractController { + /** + * Código de decomiso + */ + private String cDecomiso; + + /** + * Manejador de decomiso armas controller + */ + @ManagedProperty(value = "#{decomisoArmaController}") + private DecomisoArmaController decomisoArmaController; + + /** + * Variable que incluye datos de la cabecera de decomiso + */ + private TarmDecomiso decomiso; + /** + * Variable que incluye datos del detalle del decomiso + */ + private TarmDecomisoArma decomisoArmaObj; + /** + * Provincia + */ + private String provincia; + /** + * Cantón + */ + private String canton; + /** + * Ciudad + */ + private String ciudad; + /** + * Parroquia + */ + private String parroquia; + + /** + * Variable usada para activar el botón de generar reporte + */ + private Boolean isEnableImprimir; + /** + * Cat´logo Grado + */ + private TgeneCatalogDetail gradoCatalogDatail; + /** + * Cat´logo Unidad + */ + private TgeneCatalogDetail unidadCatalogDatail; + + private Boolean btnFlujo; + //private List armasDecomisadasLst = new ArrayList(); + + public VerificarMaterialDecomisadoController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + + @PostConstruct + private void postconstruct() { + // Inicializa autoconsulta + startQuery(); + // cDecomiso="357"; + if(cDecomiso!=null){ + this.init(); + this.query(); + } + else{ + decomisoArmaController.setLrecord(new ArrayList()); + } + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + cDecomiso=super.getMfilters().get("cdecomiso"); + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + decomiso = DecomisoController.findByCodigo(cDecomiso); + if(decomiso!=null){ + provincia = ProvinceController.getDescProvByCodigo(decomiso.getCountrycode(), decomiso.getProvincecode()); + canton = CantonController.getDescCantonByCodigo(decomiso.getCountrycode(), decomiso.getProvincecode(), decomiso.getCantoncode()); + ciudad = CityController.getDescCiudadByCodigo(decomiso.getCountrycode(), decomiso.getProvincecode(), decomiso.getCantoncode(), decomiso.getCitycode()); + parroquia = ParroquiaController.getDescParroquiaByCodigo(decomiso.getCountrycode(), decomiso.getProvincecode(), decomiso.getCantoncode(), decomiso.getParroquiacode()); + gradoCatalogDatail = CatalogDetailController.findxCodigoCodcatalogo(decomiso.getGradofuncionario(), decomiso.getGradofuncionariocode()); + TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(decomiso.getCcentrocontrol()); + unidadCatalogDatail = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()); + decomisoArmaController.addFilter("cdecomiso", cDecomiso); + decomisoArmaController.query(); + isEnableImprimir = Boolean.FALSE; + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_numReciboNoRegistrado")); + } + btnFlujo=Boolean.FALSE; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void query() { + try { + this.decomisoArmaController.query(); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() { + try { + if(cDecomiso!=null){ + this.decomisoArmaController.next(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void previous() { + try { + if(cDecomiso!=null){ + this.decomisoArmaController.previous(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + if(decomisoArmaObj==null || decomisoArmaObj.getEnbodega()==null || decomisoArmaObj.getEnbodega().compareTo("Y")!=0){ + MessageHelper.setMessageWarn(MsgControlArmas.getProperty("msg_proceso")); + return; + } + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + DtoSave dtosaveDA = decomisoArmaController.getDtoSave(); + + if(dtosaveDA.pendingProcess()){ + dtosaveDA.setReturnpk(true); + msave.put(this.decomisoArmaController.getBeanalias(), dtosaveDA); + } + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.decomisoArmaController.postCommit(resp); + isEnableImprimir = Boolean.TRUE; + btnFlujo=Boolean.TRUE; + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("cdecomiso",cDecomiso); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs",bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + btnFlujo=Boolean.FALSE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + public DecomisoArmaController getDecomisoArmaController() { + return decomisoArmaController; + } + + public void setDecomisoArmaController( + DecomisoArmaController decomisoArmaController) { + this.decomisoArmaController = decomisoArmaController; + } + + public TarmDecomiso getDecomiso() { + return decomiso; + } + + public void setDecomiso(TarmDecomiso decomiso) { + this.decomiso = decomiso; + } + + public String getProvincia() { + return provincia; + } + + public void setProvincia(String provincia) { + this.provincia = provincia; + } + + public String getCanton() { + return canton; + } + + public void setCanton(String canton) { + this.canton = canton; + } + + public String getCiudad() { + return ciudad; + } + + public void setCiudad(String ciudad) { + this.ciudad = ciudad; + } + + public String getParroquia() { + return parroquia; + } + + public void setParroquia(String parroquia) { + this.parroquia = parroquia; + } + + public TgeneCatalogDetail getGradoCatalogDatail() { + return gradoCatalogDatail; + } + + public void setGradoCatalogDatail(TgeneCatalogDetail gradoCatalogDatail) { + this.gradoCatalogDatail = gradoCatalogDatail; + } + + public TgeneCatalogDetail getUnidadCatalogDatail() { + return unidadCatalogDatail; + } + + public void setUnidadCatalogDatail(TgeneCatalogDetail unidadCatalogDatail) { + this.unidadCatalogDatail = unidadCatalogDatail; + } + + public TarmDecomisoArma getDecomisoArmaObj() { + return decomisoArmaObj; + } + + public void setDecomisoArmaObj(TarmDecomisoArma decomisoArmaObj) { + this.decomisoArmaObj = decomisoArmaObj; + } + + public Boolean getIsEnableImprimir() { + return isEnableImprimir; + } + + + public void setIsEnableImprimir(Boolean isEnableImprimir) { + this.isEnableImprimir = isEnableImprimir; + } + + + public void seleccionarArma(AjaxBehaviorEvent event){ + try { + SelectBooleanCheckbox booleanCheckbox = (SelectBooleanCheckbox) event.getComponent(); + decomisoArmaObj = (TarmDecomisoArma) booleanCheckbox.getAttributes().get("armaDecomisadaObj"); + boolean checked = (Boolean) booleanCheckbox.getValue(); + if (checked) { + decomisoArmaObj.setEnbodega("Y"); + }else{ + decomisoArmaObj.setEnbodega(null); + } + decomisoArmaController.update(decomisoArmaObj); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + + public Boolean getBtnFlujo() { + return btnFlujo; + } + + + public void setBtnFlujo(Boolean btnFlujo) { + this.btnFlujo = btnFlujo; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/VerificarMaterialDecomisadoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/VerificarMaterialDecomisadoController.java.svn-base new file mode 100644 index 0000000..9a4660a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/VerificarMaterialDecomisadoController.java.svn-base @@ -0,0 +1,394 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.event.AjaxBehaviorEvent; + +import org.primefaces.component.selectbooleancheckbox.SelectBooleanCheckbox; +import org.primefaces.context.RequestContext; +import org.primefaces.event.TabChangeEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class VerificarMaterialDecomisadoController extends AbstractController { + /** + * Código de decomiso + */ + private String cDecomiso; + + /** + * Manejador de decomiso armas controller + */ + @ManagedProperty(value = "#{decomisoArmaController}") + private DecomisoArmaController decomisoArmaController; + + /** + * Variable que incluye datos de la cabecera de decomiso + */ + private TarmDecomiso decomiso; + /** + * Variable que incluye datos del detalle del decomiso + */ + private TarmDecomisoArma decomisoArmaObj; + /** + * Provincia + */ + private String provincia; + /** + * Cantón + */ + private String canton; + /** + * Ciudad + */ + private String ciudad; + /** + * Parroquia + */ + private String parroquia; + + /** + * Variable usada para activar el botón de generar reporte + */ + private Boolean isEnableImprimir; + /** + * Cat´logo Grado + */ + private TgeneCatalogDetail gradoCatalogDatail; + /** + * Cat´logo Unidad + */ + private TgeneCatalogDetail unidadCatalogDatail; + + private Boolean btnFlujo; + //private List armasDecomisadasLst = new ArrayList(); + + public VerificarMaterialDecomisadoController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + + @PostConstruct + private void postconstruct() { + // Inicializa autoconsulta + startQuery(); + // cDecomiso="357"; + if(cDecomiso!=null){ + this.init(); + this.query(); + } + else{ + decomisoArmaController.setLrecord(new ArrayList()); + } + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + cDecomiso=super.getMfilters().get("cdecomiso"); + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + decomiso = DecomisoController.findByCodigo(cDecomiso); + if(decomiso!=null){ + provincia = ProvinceController.getDescProvByCodigo(decomiso.getCountrycode(), decomiso.getProvincecode()); + canton = CantonController.getDescCantonByCodigo(decomiso.getCountrycode(), decomiso.getProvincecode(), decomiso.getCantoncode()); + ciudad = CityController.getDescCiudadByCodigo(decomiso.getCountrycode(), decomiso.getProvincecode(), decomiso.getCantoncode(), decomiso.getCitycode()); + parroquia = ParroquiaController.getDescParroquiaByCodigo(decomiso.getCountrycode(), decomiso.getProvincecode(), decomiso.getCantoncode(), decomiso.getParroquiacode()); + gradoCatalogDatail = CatalogDetailController.findxCodigoCodcatalogo(decomiso.getGradofuncionario(), decomiso.getGradofuncionariocode()); + TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(decomiso.getCcentrocontrol()); + unidadCatalogDatail = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()); + decomisoArmaController.addFilter("cdecomiso", cDecomiso); + decomisoArmaController.query(); + isEnableImprimir = Boolean.FALSE; + } + else{ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_numReciboNoRegistrado")); + } + btnFlujo=Boolean.FALSE; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void query() { + try { + this.decomisoArmaController.query(); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() { + try { + if(cDecomiso!=null){ + this.decomisoArmaController.next(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void previous() { + try { + if(cDecomiso!=null){ + this.decomisoArmaController.previous(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + if(decomisoArmaObj==null || decomisoArmaObj.getEnbodega()==null || decomisoArmaObj.getEnbodega().compareTo("Y")!=0){ + MessageHelper.setMessageWarn(MsgControlArmas.getProperty("msg_proceso")); + return; + } + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + DtoSave dtosaveDA = decomisoArmaController.getDtoSave(); + + if(dtosaveDA.pendingProcess()){ + dtosaveDA.setReturnpk(true); + msave.put(this.decomisoArmaController.getBeanalias(), dtosaveDA); + } + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.decomisoArmaController.postCommit(resp); + isEnableImprimir = Boolean.TRUE; + btnFlujo=Boolean.TRUE; + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("cdecomiso",cDecomiso); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs",bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + btnFlujo=Boolean.FALSE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + public DecomisoArmaController getDecomisoArmaController() { + return decomisoArmaController; + } + + public void setDecomisoArmaController( + DecomisoArmaController decomisoArmaController) { + this.decomisoArmaController = decomisoArmaController; + } + + public TarmDecomiso getDecomiso() { + return decomiso; + } + + public void setDecomiso(TarmDecomiso decomiso) { + this.decomiso = decomiso; + } + + public String getProvincia() { + return provincia; + } + + public void setProvincia(String provincia) { + this.provincia = provincia; + } + + public String getCanton() { + return canton; + } + + public void setCanton(String canton) { + this.canton = canton; + } + + public String getCiudad() { + return ciudad; + } + + public void setCiudad(String ciudad) { + this.ciudad = ciudad; + } + + public String getParroquia() { + return parroquia; + } + + public void setParroquia(String parroquia) { + this.parroquia = parroquia; + } + + public TgeneCatalogDetail getGradoCatalogDatail() { + return gradoCatalogDatail; + } + + public void setGradoCatalogDatail(TgeneCatalogDetail gradoCatalogDatail) { + this.gradoCatalogDatail = gradoCatalogDatail; + } + + public TgeneCatalogDetail getUnidadCatalogDatail() { + return unidadCatalogDatail; + } + + public void setUnidadCatalogDatail(TgeneCatalogDetail unidadCatalogDatail) { + this.unidadCatalogDatail = unidadCatalogDatail; + } + + public TarmDecomisoArma getDecomisoArmaObj() { + return decomisoArmaObj; + } + + public void setDecomisoArmaObj(TarmDecomisoArma decomisoArmaObj) { + this.decomisoArmaObj = decomisoArmaObj; + } + + public Boolean getIsEnableImprimir() { + return isEnableImprimir; + } + + + public void setIsEnableImprimir(Boolean isEnableImprimir) { + this.isEnableImprimir = isEnableImprimir; + } + + + public void seleccionarArma(AjaxBehaviorEvent event){ + try { + SelectBooleanCheckbox booleanCheckbox = (SelectBooleanCheckbox) event.getComponent(); + decomisoArmaObj = (TarmDecomisoArma) booleanCheckbox.getAttributes().get("armaDecomisadaObj"); + boolean checked = (Boolean) booleanCheckbox.getValue(); + if (checked) { + decomisoArmaObj.setEnbodega("Y"); + }else{ + decomisoArmaObj.setEnbodega(null); + } + decomisoArmaController.update(decomisoArmaObj); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + + public Boolean getBtnFlujo() { + return btnFlujo; + } + + + public void setBtnFlujo(Boolean btnFlujo) { + this.btnFlujo = btnFlujo; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/emitirDocumentoHabilitanteportransaccion.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/emitirDocumentoHabilitanteportransaccion.java.netbeans-base new file mode 100644 index 0000000..2dc36aa --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/emitirDocumentoHabilitanteportransaccion.java.netbeans-base @@ -0,0 +1,985 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class emitirDocumentoHabilitanteportransaccion extends AbstractController { + + + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value="#{alfrescoController}") + private AlfrescoController alfrescoController; + + @ManagedProperty(value="#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitanteController; + + @ManagedProperty(value="#{pesonAddressController}") + private PersonAddressController pesonAddressController; + + @ManagedProperty(value="#{solicitudController}") + private SolicitudController solicitudController; + + + + TarmSolicitudTramite solicitudTramite; + TarmSolicitud solicitud; + TarmTramite fila; + TcustPersonDetail detallesPersona; + TcustPersonDetail usuario; + TarmDocumentoHabilitante documentoHabilitante; + String numeroTramite; + String nombreRazonSocial; + private String xpathflujo="";//cm:Pruebas/cm:ID_1715819825001"; + private String formato = "pdf"; + private String mostrarFormato="PDF"; +// TcustPersonDetail detallesPersona; + List lsolicitud; +// String numeroTramite; +// String nombreRazonSocial; + String identificacion; + String tipoidentificacion; + private String tramiteflujo=""; + private String solicitudflujo=""; + + + private List ldocumentos; + private String institucionCentroControl=""; + private TarmCentroControl centroControl = new TarmCentroControl(); + private TcustPersonDetail responsableCentroControl= null; + private String tramiteingresado; + + public emitirDocumentoHabilitanteportransaccion() throws Exception { + super(TarmSolicitudTramite.class); + } + + @PostConstruct + private void postconstruct() { + try { + this.pasteBpmScreenParameters(); + tramiteflujo=super.getMfilters().get("numerotransaccion"); + solicitudflujo=super.getMfilters().get("csolicitud"); + this.init(); + super.getMfilters().clear(); + + super.query(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + // lrecord = new ArrayList<>(); + beanalias = "EMITIRDOCUMENTOHABILITANTE"; + ldocumentos = new ArrayList(); + ldocumentos = CatalogDetailController.find("IDENTIFICATION"); + //Obteniendo el tramite + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(solicitudflujo); + + //Obteniendo la solicitud + solicitud=ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(solicitudflujo); + //valida el tipo de tramite ingresado + validarTramite(); + if (solicitudTramite!=null) + this.numeroTramite=solicitudTramite.getNumerotramite(); + + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + //Obteniendo el documento habilitante + documentoHabilitante=DocumentoHabilitanteController.findPorSolicitud(solicitudflujo); + obtenerCentroControl(); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + private void validarTramite(){ + tramiteingresado = "OTROS"; + TgeneParameters parametrofichanoletal=ParametersController.find("CODIGO.FICHANOLETAL", "1"); + if(parametrofichanoletal!=null && parametrofichanoletal.getTextvalue()!=null && !parametrofichanoletal.getTextvalue().trim().isEmpty()){ + String [] arrayCodTramite=parametrofichanoletal.getTextvalue().split(","); + ListlistaCodTraite=Arrays.asList(arrayCodTramite); + for (String item : listaCodTraite) { + Long codigotramite=Long.parseLong(item); + if(solicitud.getCtramite().equals(codigotramite) || + codigotramite.longValue()==solicitud.getCtramite().longValue()){ + tramiteingresado = "NOLETAL"; + } + } + } + } + + public String getNumeroTramite() { + return numeroTramite; + } + + public void setNumeroTramite(String numeroTramite) { + this.numeroTramite = numeroTramite; + } + + @Override + protected void querydatabase() { + + try { + addFilter("numerotramite", numeroTramite); + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + SubQuery subqueryUso= new SubQuery("TarmTramite","usoactividad","actividad","i.pk=t.pk.ctramite"); + dto.addSubQuery(subqueryUso); + SubQuery subqueryPersona= new SubQuery("TarmSolicitud","personcode","persona","i.pk=t.pk.csolicitud"); + dto.addSubQuery(subqueryPersona); + SubQuery subqueryTipo=new SubQuery("TarmTramite", "tipoautorizacion", "tramite", "i.pk=t.pk.ctramite"); + dto.addSubQuery(subqueryTipo); + SubQuery subqueryTipocodigo=new SubQuery("TarmTramite", "tipoautorizacioncodigo", "tramitecodigo", "i.pk=t.pk.ctramite"); + dto.addSubQuery(subqueryTipocodigo); + SubQuery subqueryEstado=new SubQuery("TgeneCatalogDetail","description","desc","i.pk.catalog=t.estadotramite and i.pk.catalogcode=t.estadotramitecodigo"); + dto.addSubQuery(subqueryEstado); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + for(int i=0;i< this.lrecord.size();i++){ + this.lrecord.get(i).getModifiedData().put("usodes", CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("actividad").toString(), "USOACTIVIDAD").getDescription()); + TcustPersonDetail person = PersonDetailController.find(this.lrecord.get(i).getModifiedData().get("persona").toString()); + this.lrecord.get(i).getModifiedData().put("nombre", person.getName()); + this.lrecord.get(i).getModifiedData().put("identificacion", person.getIdentification()); + TgeneCatalogDetail tipo = CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("tramite").toString(), this.lrecord.get(i).getModifiedData().get("tramitecodigo").toString()); + this.lrecord.get(i).getModifiedData().put("tipotramdesc", tipo.getDescription()); + } + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para completar la tarea + */ + public void completarTarea() { + try { + if(xpathflujo==null || xpathflujo.isEmpty()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generarReporteRequerido")); + return; + } + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + + public void imprimir(TarmSolicitudTramite fila){ + try { + boolean flagRequisitos = false; + boolean flagArmas = false; + boolean flagGuardias = false; + boolean flagAgencia = false; + boolean flagDoc = false; + String tipotramite=fila.getModifiedData().get("tramite").toString(); + String nombreArchivo = fila.getModifiedData().get("tipotramdesc").toString(); + TarmSolicitud solicitud = SolicitudController.findSolicitudxcodsolicitud(fila.getPk().getCsolicitud()); + TarmTramite tramite = TarmTramiteController.findSimple(fila.getPk().getCtramite().toString()); + documentoHabilitante=documentoHabilitanteController.findPorSolicitud(fila.getPk().getCsolicitud()); + + xpathflujo=generarXpath(fila.getNumerotramite()); + System.out.println("..." + xpathflujo); + + //solicitud=ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(tipotramite); + if(tipotramite==null){ + MessageHelper.setMessageError("ERROR NO MANEJADO POR LA APLICACION CONTACTE AL PROVEEDOR"); + return; + } + if(tipotramite.equals("2")){ + if(tramite.getRegistroagenciasucursal().equalsIgnoreCase("Y")){ + flagAgencia = true; + } + if (tramite.getRegistroarmas().equalsIgnoreCase("Y")) { + flagArmas = true; + } + if (tramite.getRegistroguardia().equalsIgnoreCase("Y")) { + flagGuardias = true; + } + if(tramite.getDocumentohabilitante().equalsIgnoreCase("Y")) { + flagDoc = true; + } + //this.reporteCertificados(solicitud.getPk(), flagAgencia, flagArmas, flagDoc, flagGuardias); + InputStream pdf=this.reporteCertificados(solicitud.getPk(), flagAgencia, flagArmas, flagDoc, flagGuardias); + alfrescoController.uploadFile(pdf, documentoHabilitante.getNumerodocumento()+".pdf", xpathflujo) ; + xpathflujo = xpathflujo + "/cm:" + documentoHabilitante.getNumerodocumento()+".pdf"; + actualizarXpath(documentoHabilitante, xpathflujo); + return; + }else if (tipotramite.equals("4")) { + InputStream pdf=this.reporteGuiaLibreTransito(); + alfrescoController.uploadFile(pdf, documentoHabilitante.getNumerodocumento()+".pdf", xpathflujo) ; + xpathflujo = xpathflujo + "/cm:" + documentoHabilitante.getNumerodocumento()+".pdf"; + actualizarXpath(documentoHabilitante, xpathflujo); + return; + }else { + if(tramite.getRegistroagenciasucursal().equalsIgnoreCase("Y")){ + flagAgencia = true; + } + if (tramite.getRegistroarmas().equalsIgnoreCase("Y")) { + flagArmas = true; + } + if (tramite.getRegistroguardia().equalsIgnoreCase("Y")) { + flagGuardias = true; + } + if(tramite.getDocumentohabilitante().equalsIgnoreCase("Y")) { + flagDoc = true; + } + } + InputStream pdf=this.reporteGeneral(solicitud.getPk(),flagAgencia,flagArmas,flagDoc,flagGuardias,flagRequisitos,nombreArchivo); + alfrescoController.uploadFile(pdf, documentoHabilitante.getNumerodocumento()+".pdf", xpathflujo) ; + xpathflujo = xpathflujo + "/cm:" + documentoHabilitante.getNumerodocumento()+".pdf"; + actualizarXpath(documentoHabilitante, xpathflujo); + + } catch (Exception e) { + xpathflujo=null; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generar_reporte")); + } + } + + + /** + * Metodo para actualziar en la tabla tarmdocumentohabilitante con el xpath de la ruta de alfreco donde se guardo el documento + * @param documentoHabilitante + * @param xPath + * @throws Exception + */ + private void actualizarXpath(TarmDocumentoHabilitante documentoHabilitante, String xPath) throws Exception{ + documentoHabilitanteController.setRecord(documentoHabilitante); + documentoHabilitanteController.getRecord().setXpath(xPath); + documentoHabilitanteController.update(); + documentoHabilitanteController.save(); + } + + public String generarXpath(String tramite){ + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + tramite=tramite.replace("TRA", "SOL"); + StringBuilder ruta=new StringBuilder("cm:Solicitud"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + ruta = ruta.append("/cm:"+tramite); + return ruta.toString(); + } + + public String encontrarUsuario(){ + if(identificacion==null || identificacion=="") + return null; + detallesPersona=PersonDetailController.findxidentification(identificacion, tipoidentificacion); + if(detallesPersona==null) + return null; + lsolicitud=SolicitudController.findSolicitudxPersona(detallesPersona.getPk().getPersoncode().toString()); + + String csolicitud=null; + for(TarmSolicitud soli : lsolicitud){ + if(csolicitud==null){ + csolicitud="csolicitud='"+soli.getPk()+"'"; + } + else{ + csolicitud+=" or csolicitud='"+soli.getPk()+"'"; + } + } + return csolicitud; + } + + + @Override + public void save() { + // TODO Auto-generated method stub + super.save(); + } + + /** + * Ejecuta un reporte de armas + * @param name Nombre del reporte a generar. + */ + public InputStream reporteGuiaLibreTransito() { + try { + String path = "armas/reports/guiaLibreTransito"; + String filename=MsgControlArmas.getProperty("lbl_guiaLibreTransito"); + + detallesPersona = PersonDetailController.find(String.valueOf(solicitud.getPersoncode().toString())); + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + TarmSolicitud sol = this.solicitudController.findSolicitudxcodsolicitud(this.solicitudflujo); + //No. Guia + parameters.put("noGuia", this.numeroTramite); + + //Codigo de barras + String codigoBarras=this.numeroTramite.replace("-", "").toLowerCase(); + Boolean caracterEliminado=false; + for (int i = 0; i < codigoBarras.length(); i++) { + if(caracterEliminado){ + i=0; + caracterEliminado=false; + } + if(codigoBarras.toCharArray()[i]!='0' && codigoBarras.toCharArray()[i]!='1' && codigoBarras.toCharArray()[i]!='2' + && codigoBarras.toCharArray()[i]!='3' && codigoBarras.toCharArray()[i]!='4' && codigoBarras.toCharArray()[i]!='5' + && codigoBarras.toCharArray()[i]!='6' && codigoBarras.toCharArray()[i]!='7' && codigoBarras.toCharArray()[i]!='8' + && codigoBarras.toCharArray()[i]!='9'){ + + String caracterExtranno=""; + caracterExtranno+=codigoBarras.toCharArray()[i]; + codigoBarras=codigoBarras.replace(caracterExtranno, ""); + caracterEliminado=true; + } + } + parameters.put("codigoBarras", codigoBarras); + + //Nombre/Razon Social + parameters.put("nombreRazon", detallesPersona.getName()); + + //Cedula + parameters.put("cedula", detallesPersona.getIdentification()); + + //Desde + parameters.put("desde", solicitud.getLugarorigen()); + + //Hasta + parameters.put("hasta", solicitud.getLugardestino()); + + //Fechas + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + if(documentoHabilitante!=null){ + parameters.put("fechaExpide", sdf.format(documentoHabilitante.getFechaemision())); + parameters.put("fechaCaduca", sdf.format(documentoHabilitante.getFechaexpiracion())); + }else{ + parameters.put("fechaExpide", " "); + parameters.put("fechaCaduca", " "); + } + + //Grado + String gradoFuncionario=""; + TgeneCatalogDetail grado=CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), + this.responsableCentroControl.getMilitarygradecode()); + if(grado!=null){ + gradoFuncionario=grado.getDescription()+" - "; + } + + //Lugar origen y destino + if(sol!=null){ + parameters.put("provinciaorigen", sol.modifiedData().get("provinciaorigen").toString()); + parameters.put("cantonorigen", sol.modifiedData().get("cantonorigen").toString()); + parameters.put("lugarorigen", sol.getLugarorigen().toString()); + parameters.put("provinciadestino", sol.modifiedData().get("provinciadestino").toString()); + parameters.put("cantondestino", sol.modifiedData().get("cantondestino").toString()); + parameters.put("lugardestino", sol.getLugardestino().toString()); + + } + + //Funcionario + parameters.put("gradoNombreFuncionario",gradoFuncionario+this.responsableCentroControl.getName()); + parameters.put("personcode",this.responsableCentroControl.getPk().getPersoncode()); + parameters.put("centroControl","JEFE DEL "+this.institucionCentroControl); + parameters.put("nombreCentro", this.institucionCentroControl); + //Usuario + parameters.put("usuario",this.usuario.getName()); + sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + String fechaHora=sdf.format(Calendar.getInstance().getTime()); + parameters.put("fechaHora",fechaHora); + + System.out.println("1. emitirDocumento"); + parameters.put("codigoQR",solicitudTramite.getNumerotramite()+" "+parameters.get("fechaExpide")+" "+ + parameters.get("fechaCaduca")+" "+gradoFuncionario+this.responsableCentroControl.getName()+" "+this.institucionCentroControl); + + + String format = "pdf"; + InputStream pdf = this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + return pdf; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + return null; + } + + /** + * Ejecuta un reporte de certificado de armas + * @param name Nombre del reporte a generar. + */ + + + + public void reporteCertificadoArmas() { + try { + String path = "armas/reports/certificadoArmas"; + String filename="certificadoarmas"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + + //Grado + String gradoFuncionario=""; + TgeneCatalogDetail grado=CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), + this.responsableCentroControl.getMilitarygradecode()); + if(grado!=null){ + gradoFuncionario=grado.getDescription()+" - "; + } + System.out.println("2. emitirDocumento"); + parameters.put("codigoQR",solicitudTramite.getNumerotramite()+" "+ + sdf.format(Calendar.getInstance().getTime())+" "+gradoFuncionario+this.responsableCentroControl.getName()+" "+this.institucionCentroControl); + + + String format = "pdf"; + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Ejecuta un reporte de certificado de armas + * @param name Nombre del reporte a generar. + */ + + + + public void reporteAgencias() { + try { + String path = "armas/reports/aperturaAgenciasSucursales"; + String filename="aperturaagenciassucursales"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + + //Grado + String gradoFuncionario=""; + TgeneCatalogDetail grado=CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), + this.responsableCentroControl.getMilitarygradecode()); + if(grado!=null){ + gradoFuncionario=grado.getDescription()+" - "; + } + System.out.println("3. emitirDocumento"); + parameters.put("codigoQR",solicitudTramite.getNumerotramite()+" "+sdf.format(Calendar.getInstance().getTime())+" "+ + gradoFuncionario+this.responsableCentroControl.getName()+" "+this.institucionCentroControl); + + + String format = "pdf"; + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + +/* public void reporteInscripcion(TarmSolicitud solicitud) { + try { + String path = "armas/reports/reporteInscripcion"; + String filename="armas"; + + detallesPersona = PersonDetailController.find(String.valueOf(solicitud.getPersoncode().toString())); + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + + //No. Guia + parameters.put("nombreCompania", detallesPersona.getName()); + + //Nombre/Razon Social + parameters.put("nombrepersona",detallesPersona.getLegalrepresent()); + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("fecha", sdf.format(solicitud.getFregistro())); + parameters.put("ciudad", "Quito"); + + String format = "pdf"; + + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + */ + /** + * Ejecuta reporte general de informacion de armas, guardias, agencias y sucursales + * @param name Nombre del reporte a generar. + */ + + public InputStream reporteGeneral(String solicitud,boolean flagAgencia,boolean flagArmas,boolean flagDoc,boolean flagGuardias,boolean flagRequisitos,String nombreArchivo) { + try { + String path = "armas/reports/generalReportHabilita"; + String filename=nombreArchivo; + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail user = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); +// TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(user.getMilitarygrade(), user.getMilitarygradecode()); + TgeneCatalogDetail grado =null; + if(this.responsableCentroControl.getMilitarygrade()!=null && this.responsableCentroControl.getMilitarygradecode()!=null){ + grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + } + + String gradoUsuario=""; + if(grado!=null){ + gradoUsuario = grado.getDescription()+" - "+this.responsableCentroControl.getName(); + }else{ + gradoUsuario = this.responsableCentroControl.getName(); + } + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("csolicitud", solicitudflujo); + + //Obteniendo la solicitud + TarmSolicitud s=SolicitudController.findSolicitudxcodsolicitud(solicitudflujo); + TarmTramite t; + Boolean datosTramiteVacios=false; + + if(s!=null){ + //Obteniendo el tramite + t=TarmTramiteController.find(s.getCtramite().toString()); + + //Obteniendo la solicitud trmite + TarmSolicitudTramite st=TarmSolicitudTramiteController.findPorCSolicitud(solicitudflujo); + + + if(t!=null){ + + //No de tramite + if(st!=null){ + parameters.put("noTramite", st.getNumerotramite()); + }else{ + parameters.put("noTramite", " "); + } + + //Tipo de tramite + if(t.getModifiedData().get("tipotramite")!=null){ + parameters.put("tipoTramite", t.getModifiedData().get("tipotramite")); + }else{ + parameters.put("tipoTramite", " "); + } + + //Tipo de autorizacion + if(t.getModifiedData().get("tipoautorizacion")!=null){ + parameters.put("tipoAutorizacion", t.getModifiedData().get("tipoautorizacion")); + }else{ + parameters.put("tipoAutorizacion", " "); + } + + //Categoria + if(t.getModifiedData().get("categoria")!=null){ + parameters.put("categoria", t.getModifiedData().get("categoria")); + }else{ + parameters.put("categoria", " "); + } + + //Uso actividad + if(t.getModifiedData().get("usoactividad")!=null){ + parameters.put("usoActividad", t.getModifiedData().get("usoactividad")); + }else{ + parameters.put("usoActividad", " "); + } + + //Cabecera + if(t.getCabecera()!=null){ + parameters.put("cabecera", t.getCabecera()); + }else{ + parameters.put("cabecera", " "); + } + + //Pie + if(t.getPie()!=null){ + parameters.put("pie", t.getPie()); + }else{ + parameters.put("pie", " "); + } + + //fecha de solicitud + if(s.getFregistro()!=null){ + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fecSolicitud", sdf.format(s.getFregistro())); + } + else { + parameters.put("fecSolicitud", ""); + } + + + + }else{ + datosTramiteVacios=true; + } + }else{ + datosTramiteVacios=true; + } + + if(datosTramiteVacios){ + parameters.put("noTramite", " "); + parameters.put("tipoTramite", " "); + parameters.put("tipoAutorizacion", " "); + parameters.put("categoria", " "); + parameters.put("usoActividad", " "); + parameters.put("cabecera", " "); + parameters.put("pie", " "); + } + + //Obteniendo la direccion + String email=" ",direccion=" "; + List direcciones=PersonAddressController.findAllByPersonCode(s.getPersoncode().toString()); + for (TcustPersonAddress d : direcciones) { + Calendar calendario=Calendar.getInstance(); + calendario.setTime(d.getPk().getDateto()); + if(calendario.get(Calendar.YEAR)==2999){ + if(d.getAddresstypecatalog().equalsIgnoreCase("3")){ + email=d.getAddress(); + }else if(d.getPrincipal()!=null && d.getPrincipal().equalsIgnoreCase("Y")){ + direccion=d.getAddress(); + } + } + } + + //Email + parameters.put("email", email); + + //Direccion + parameters.put("direccion", direccion); + + + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + parameters.put("flagAgencia", flagAgencia); + parameters.put("flagArmas", flagArmas); + parameters.put("flagDoc", flagDoc); + parameters.put("flagGuardias", flagGuardias); + parameters.put("flagRequisitos", flagRequisitos); + parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("codResponsable", this.responsableCentroControl.getPk().getPersoncode()); + parameters.put("usuario",user.getName()); + + System.out.println("4. emitirDocumento"); + parameters.put("codigoQR",solicitud+" "+sdf.format(Calendar.getInstance().getTime())+" "+gradoUsuario+" "+this.institucionCentroControl); + + + String format = "pdf"; + InputStream pdf=this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + return pdf; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + return null; + } + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController direccion = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres= direccion.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + this.centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + //Reponsable + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + return setInstitucionCentroControl(CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + + + + } + + /** + * Ejecuta reporte general de informacion de armas, guardias, agencias y sucursales + * @param name Nombre del reporte a generar. + */ + + public InputStream reporteCertificados(String solicitud,boolean flagAgencia,boolean flagArmas,boolean flagDoc,boolean flagGuardias) { + try { + String gradoUsuario =""; + String path = "armas/reports/reporteCertificado"; + if(tramiteingresado.equals("NOLETAL")){ + path = "armas/reports/reporteCertificadoNoLetal"; + } + String filename="reporteCertificado"; + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail user = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if(grado != null){ + gradoUsuario = grado.getDescription()+" - "+this.responsableCentroControl.getName(); + }else{ + gradoUsuario = "Sin Grado - "+this.responsableCentroControl.getName(); + } + + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("csolicitud", solicitud); + //Obteniendo la solicitud + TarmSolicitud s=SolicitudController.findSolicitudxcodsolicitud(solicitudflujo); + //Obteniendo la direccion + String email=" ",direccion=" "; + List direcciones=PersonAddressController.findAllByPersonCode(s.getPersoncode().toString()); + for (TcustPersonAddress d : direcciones) { + Calendar calendario=Calendar.getInstance(); + calendario.setTime(d.getPk().getDateto()); + if(calendario.get(Calendar.YEAR)==2999){ + if(d.getAddresstypecatalog().equalsIgnoreCase("3")){ + email=d.getAddress(); + }else if(d.getAddresstypecatalog().equalsIgnoreCase("1")){ + direccion=d.getAddress(); + } + } + } + + //Email + parameters.put("email", email); + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + parameters.put("fechaExpiracion", sdf.format(documentoHabilitante.getFechaexpiracion())); + parameters.put("flagAgencia", flagAgencia); + parameters.put("flagArmas", flagArmas); + parameters.put("flagDoc", flagDoc); + parameters.put("flagGuardias", flagGuardias); + parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("usuario",user.getName()); + parameters.put("codResponsable", this.responsableCentroControl.getPk().getPersoncode()); + + System.out.println("5. emitirDocumento"); + parameters.put("codigoQR",solicitud+" "+sdf.format(Calendar.getInstance().getTime())+" "+ + gradoUsuario+" "+this.institucionCentroControl); + + + String format = "pdf"; + //this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + InputStream pdf=this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + return pdf; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + return null; + } + + public List getLdocumentos() { + return ldocumentos; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + public void setLdocumentos(List ldocumentos) { + this.ldocumentos = ldocumentos; + } + + public String getIdentificacion() { + return identificacion; + } + + public void setIdentificacion(String identificacion) { + this.identificacion = identificacion; + } + + public String getTipoidentificacion() { + return tipoidentificacion; + } + + public void setTipoidentificacion(String tipoidentificacion) { + this.tipoidentificacion = tipoidentificacion; + } + + TarmTramite getFila() { + return fila; + } + + public void setFila(TarmTramite fila) { + this.fila = fila; + } + + + + public String getFormato() { + return formato; + } + + public void setFormato(String formato) { + this.formato = formato; + } + + public String getMostrarFormato() { + return mostrarFormato; + } + + public void setMostrarFormato(String mostrarFormato) { + this.mostrarFormato = mostrarFormato; + } + + public String getTramiteflujo() { + return tramiteflujo; + } + + public void setTramiteflujo(String tramiteflujo) { + this.tramiteflujo = tramiteflujo; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public String setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + return institucionCentroControl; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public DocumentoHabilitanteController getDocumentoHabilitanteController() { + return documentoHabilitanteController; + } + + public void setDocumentoHabilitanteController( + DocumentoHabilitanteController documentoHabilitanteController) { + this.documentoHabilitanteController = documentoHabilitanteController; + } + + public PersonAddressController getPesonAddressController() { + return pesonAddressController; + } + + public void setPesonAddressController( + PersonAddressController pesonAddressController) { + this.pesonAddressController = pesonAddressController; + } + + public SolicitudController getSolicitudController() { + return solicitudController; + } + + public void setSolicitudController(SolicitudController solicitudController) { + this.solicitudController = solicitudController; + } + + + + + +} + diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/emitirDocumentoHabilitanteportransaccion.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/emitirDocumentoHabilitanteportransaccion.java.svn-base new file mode 100644 index 0000000..2dc36aa --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/.svn/text-base/emitirDocumentoHabilitanteportransaccion.java.svn-base @@ -0,0 +1,985 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class emitirDocumentoHabilitanteportransaccion extends AbstractController { + + + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value="#{alfrescoController}") + private AlfrescoController alfrescoController; + + @ManagedProperty(value="#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitanteController; + + @ManagedProperty(value="#{pesonAddressController}") + private PersonAddressController pesonAddressController; + + @ManagedProperty(value="#{solicitudController}") + private SolicitudController solicitudController; + + + + TarmSolicitudTramite solicitudTramite; + TarmSolicitud solicitud; + TarmTramite fila; + TcustPersonDetail detallesPersona; + TcustPersonDetail usuario; + TarmDocumentoHabilitante documentoHabilitante; + String numeroTramite; + String nombreRazonSocial; + private String xpathflujo="";//cm:Pruebas/cm:ID_1715819825001"; + private String formato = "pdf"; + private String mostrarFormato="PDF"; +// TcustPersonDetail detallesPersona; + List lsolicitud; +// String numeroTramite; +// String nombreRazonSocial; + String identificacion; + String tipoidentificacion; + private String tramiteflujo=""; + private String solicitudflujo=""; + + + private List ldocumentos; + private String institucionCentroControl=""; + private TarmCentroControl centroControl = new TarmCentroControl(); + private TcustPersonDetail responsableCentroControl= null; + private String tramiteingresado; + + public emitirDocumentoHabilitanteportransaccion() throws Exception { + super(TarmSolicitudTramite.class); + } + + @PostConstruct + private void postconstruct() { + try { + this.pasteBpmScreenParameters(); + tramiteflujo=super.getMfilters().get("numerotransaccion"); + solicitudflujo=super.getMfilters().get("csolicitud"); + this.init(); + super.getMfilters().clear(); + + super.query(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + // lrecord = new ArrayList<>(); + beanalias = "EMITIRDOCUMENTOHABILITANTE"; + ldocumentos = new ArrayList(); + ldocumentos = CatalogDetailController.find("IDENTIFICATION"); + //Obteniendo el tramite + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(solicitudflujo); + + //Obteniendo la solicitud + solicitud=ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(solicitudflujo); + //valida el tipo de tramite ingresado + validarTramite(); + if (solicitudTramite!=null) + this.numeroTramite=solicitudTramite.getNumerotramite(); + + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario=PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + //Obteniendo el documento habilitante + documentoHabilitante=DocumentoHabilitanteController.findPorSolicitud(solicitudflujo); + obtenerCentroControl(); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + private void validarTramite(){ + tramiteingresado = "OTROS"; + TgeneParameters parametrofichanoletal=ParametersController.find("CODIGO.FICHANOLETAL", "1"); + if(parametrofichanoletal!=null && parametrofichanoletal.getTextvalue()!=null && !parametrofichanoletal.getTextvalue().trim().isEmpty()){ + String [] arrayCodTramite=parametrofichanoletal.getTextvalue().split(","); + ListlistaCodTraite=Arrays.asList(arrayCodTramite); + for (String item : listaCodTraite) { + Long codigotramite=Long.parseLong(item); + if(solicitud.getCtramite().equals(codigotramite) || + codigotramite.longValue()==solicitud.getCtramite().longValue()){ + tramiteingresado = "NOLETAL"; + } + } + } + } + + public String getNumeroTramite() { + return numeroTramite; + } + + public void setNumeroTramite(String numeroTramite) { + this.numeroTramite = numeroTramite; + } + + @Override + protected void querydatabase() { + + try { + addFilter("numerotramite", numeroTramite); + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + SubQuery subqueryUso= new SubQuery("TarmTramite","usoactividad","actividad","i.pk=t.pk.ctramite"); + dto.addSubQuery(subqueryUso); + SubQuery subqueryPersona= new SubQuery("TarmSolicitud","personcode","persona","i.pk=t.pk.csolicitud"); + dto.addSubQuery(subqueryPersona); + SubQuery subqueryTipo=new SubQuery("TarmTramite", "tipoautorizacion", "tramite", "i.pk=t.pk.ctramite"); + dto.addSubQuery(subqueryTipo); + SubQuery subqueryTipocodigo=new SubQuery("TarmTramite", "tipoautorizacioncodigo", "tramitecodigo", "i.pk=t.pk.ctramite"); + dto.addSubQuery(subqueryTipocodigo); + SubQuery subqueryEstado=new SubQuery("TgeneCatalogDetail","description","desc","i.pk.catalog=t.estadotramite and i.pk.catalogcode=t.estadotramitecodigo"); + dto.addSubQuery(subqueryEstado); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + for(int i=0;i< this.lrecord.size();i++){ + this.lrecord.get(i).getModifiedData().put("usodes", CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("actividad").toString(), "USOACTIVIDAD").getDescription()); + TcustPersonDetail person = PersonDetailController.find(this.lrecord.get(i).getModifiedData().get("persona").toString()); + this.lrecord.get(i).getModifiedData().put("nombre", person.getName()); + this.lrecord.get(i).getModifiedData().put("identificacion", person.getIdentification()); + TgeneCatalogDetail tipo = CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("tramite").toString(), this.lrecord.get(i).getModifiedData().get("tramitecodigo").toString()); + this.lrecord.get(i).getModifiedData().put("tipotramdesc", tipo.getDescription()); + } + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para completar la tarea + */ + public void completarTarea() { + try { + if(xpathflujo==null || xpathflujo.isEmpty()){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generarReporteRequerido")); + return; + } + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + + public void imprimir(TarmSolicitudTramite fila){ + try { + boolean flagRequisitos = false; + boolean flagArmas = false; + boolean flagGuardias = false; + boolean flagAgencia = false; + boolean flagDoc = false; + String tipotramite=fila.getModifiedData().get("tramite").toString(); + String nombreArchivo = fila.getModifiedData().get("tipotramdesc").toString(); + TarmSolicitud solicitud = SolicitudController.findSolicitudxcodsolicitud(fila.getPk().getCsolicitud()); + TarmTramite tramite = TarmTramiteController.findSimple(fila.getPk().getCtramite().toString()); + documentoHabilitante=documentoHabilitanteController.findPorSolicitud(fila.getPk().getCsolicitud()); + + xpathflujo=generarXpath(fila.getNumerotramite()); + System.out.println("..." + xpathflujo); + + //solicitud=ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(tipotramite); + if(tipotramite==null){ + MessageHelper.setMessageError("ERROR NO MANEJADO POR LA APLICACION CONTACTE AL PROVEEDOR"); + return; + } + if(tipotramite.equals("2")){ + if(tramite.getRegistroagenciasucursal().equalsIgnoreCase("Y")){ + flagAgencia = true; + } + if (tramite.getRegistroarmas().equalsIgnoreCase("Y")) { + flagArmas = true; + } + if (tramite.getRegistroguardia().equalsIgnoreCase("Y")) { + flagGuardias = true; + } + if(tramite.getDocumentohabilitante().equalsIgnoreCase("Y")) { + flagDoc = true; + } + //this.reporteCertificados(solicitud.getPk(), flagAgencia, flagArmas, flagDoc, flagGuardias); + InputStream pdf=this.reporteCertificados(solicitud.getPk(), flagAgencia, flagArmas, flagDoc, flagGuardias); + alfrescoController.uploadFile(pdf, documentoHabilitante.getNumerodocumento()+".pdf", xpathflujo) ; + xpathflujo = xpathflujo + "/cm:" + documentoHabilitante.getNumerodocumento()+".pdf"; + actualizarXpath(documentoHabilitante, xpathflujo); + return; + }else if (tipotramite.equals("4")) { + InputStream pdf=this.reporteGuiaLibreTransito(); + alfrescoController.uploadFile(pdf, documentoHabilitante.getNumerodocumento()+".pdf", xpathflujo) ; + xpathflujo = xpathflujo + "/cm:" + documentoHabilitante.getNumerodocumento()+".pdf"; + actualizarXpath(documentoHabilitante, xpathflujo); + return; + }else { + if(tramite.getRegistroagenciasucursal().equalsIgnoreCase("Y")){ + flagAgencia = true; + } + if (tramite.getRegistroarmas().equalsIgnoreCase("Y")) { + flagArmas = true; + } + if (tramite.getRegistroguardia().equalsIgnoreCase("Y")) { + flagGuardias = true; + } + if(tramite.getDocumentohabilitante().equalsIgnoreCase("Y")) { + flagDoc = true; + } + } + InputStream pdf=this.reporteGeneral(solicitud.getPk(),flagAgencia,flagArmas,flagDoc,flagGuardias,flagRequisitos,nombreArchivo); + alfrescoController.uploadFile(pdf, documentoHabilitante.getNumerodocumento()+".pdf", xpathflujo) ; + xpathflujo = xpathflujo + "/cm:" + documentoHabilitante.getNumerodocumento()+".pdf"; + actualizarXpath(documentoHabilitante, xpathflujo); + + } catch (Exception e) { + xpathflujo=null; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generar_reporte")); + } + } + + + /** + * Metodo para actualziar en la tabla tarmdocumentohabilitante con el xpath de la ruta de alfreco donde se guardo el documento + * @param documentoHabilitante + * @param xPath + * @throws Exception + */ + private void actualizarXpath(TarmDocumentoHabilitante documentoHabilitante, String xPath) throws Exception{ + documentoHabilitanteController.setRecord(documentoHabilitante); + documentoHabilitanteController.getRecord().setXpath(xPath); + documentoHabilitanteController.update(); + documentoHabilitanteController.save(); + } + + public String generarXpath(String tramite){ + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + tramite=tramite.replace("TRA", "SOL"); + StringBuilder ruta=new StringBuilder("cm:Solicitud"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + ruta = ruta.append("/cm:"+tramite); + return ruta.toString(); + } + + public String encontrarUsuario(){ + if(identificacion==null || identificacion=="") + return null; + detallesPersona=PersonDetailController.findxidentification(identificacion, tipoidentificacion); + if(detallesPersona==null) + return null; + lsolicitud=SolicitudController.findSolicitudxPersona(detallesPersona.getPk().getPersoncode().toString()); + + String csolicitud=null; + for(TarmSolicitud soli : lsolicitud){ + if(csolicitud==null){ + csolicitud="csolicitud='"+soli.getPk()+"'"; + } + else{ + csolicitud+=" or csolicitud='"+soli.getPk()+"'"; + } + } + return csolicitud; + } + + + @Override + public void save() { + // TODO Auto-generated method stub + super.save(); + } + + /** + * Ejecuta un reporte de armas + * @param name Nombre del reporte a generar. + */ + public InputStream reporteGuiaLibreTransito() { + try { + String path = "armas/reports/guiaLibreTransito"; + String filename=MsgControlArmas.getProperty("lbl_guiaLibreTransito"); + + detallesPersona = PersonDetailController.find(String.valueOf(solicitud.getPersoncode().toString())); + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + TarmSolicitud sol = this.solicitudController.findSolicitudxcodsolicitud(this.solicitudflujo); + //No. Guia + parameters.put("noGuia", this.numeroTramite); + + //Codigo de barras + String codigoBarras=this.numeroTramite.replace("-", "").toLowerCase(); + Boolean caracterEliminado=false; + for (int i = 0; i < codigoBarras.length(); i++) { + if(caracterEliminado){ + i=0; + caracterEliminado=false; + } + if(codigoBarras.toCharArray()[i]!='0' && codigoBarras.toCharArray()[i]!='1' && codigoBarras.toCharArray()[i]!='2' + && codigoBarras.toCharArray()[i]!='3' && codigoBarras.toCharArray()[i]!='4' && codigoBarras.toCharArray()[i]!='5' + && codigoBarras.toCharArray()[i]!='6' && codigoBarras.toCharArray()[i]!='7' && codigoBarras.toCharArray()[i]!='8' + && codigoBarras.toCharArray()[i]!='9'){ + + String caracterExtranno=""; + caracterExtranno+=codigoBarras.toCharArray()[i]; + codigoBarras=codigoBarras.replace(caracterExtranno, ""); + caracterEliminado=true; + } + } + parameters.put("codigoBarras", codigoBarras); + + //Nombre/Razon Social + parameters.put("nombreRazon", detallesPersona.getName()); + + //Cedula + parameters.put("cedula", detallesPersona.getIdentification()); + + //Desde + parameters.put("desde", solicitud.getLugarorigen()); + + //Hasta + parameters.put("hasta", solicitud.getLugardestino()); + + //Fechas + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + if(documentoHabilitante!=null){ + parameters.put("fechaExpide", sdf.format(documentoHabilitante.getFechaemision())); + parameters.put("fechaCaduca", sdf.format(documentoHabilitante.getFechaexpiracion())); + }else{ + parameters.put("fechaExpide", " "); + parameters.put("fechaCaduca", " "); + } + + //Grado + String gradoFuncionario=""; + TgeneCatalogDetail grado=CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), + this.responsableCentroControl.getMilitarygradecode()); + if(grado!=null){ + gradoFuncionario=grado.getDescription()+" - "; + } + + //Lugar origen y destino + if(sol!=null){ + parameters.put("provinciaorigen", sol.modifiedData().get("provinciaorigen").toString()); + parameters.put("cantonorigen", sol.modifiedData().get("cantonorigen").toString()); + parameters.put("lugarorigen", sol.getLugarorigen().toString()); + parameters.put("provinciadestino", sol.modifiedData().get("provinciadestino").toString()); + parameters.put("cantondestino", sol.modifiedData().get("cantondestino").toString()); + parameters.put("lugardestino", sol.getLugardestino().toString()); + + } + + //Funcionario + parameters.put("gradoNombreFuncionario",gradoFuncionario+this.responsableCentroControl.getName()); + parameters.put("personcode",this.responsableCentroControl.getPk().getPersoncode()); + parameters.put("centroControl","JEFE DEL "+this.institucionCentroControl); + parameters.put("nombreCentro", this.institucionCentroControl); + //Usuario + parameters.put("usuario",this.usuario.getName()); + sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + String fechaHora=sdf.format(Calendar.getInstance().getTime()); + parameters.put("fechaHora",fechaHora); + + System.out.println("1. emitirDocumento"); + parameters.put("codigoQR",solicitudTramite.getNumerotramite()+" "+parameters.get("fechaExpide")+" "+ + parameters.get("fechaCaduca")+" "+gradoFuncionario+this.responsableCentroControl.getName()+" "+this.institucionCentroControl); + + + String format = "pdf"; + InputStream pdf = this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + return pdf; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + return null; + } + + /** + * Ejecuta un reporte de certificado de armas + * @param name Nombre del reporte a generar. + */ + + + + public void reporteCertificadoArmas() { + try { + String path = "armas/reports/certificadoArmas"; + String filename="certificadoarmas"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + + //Grado + String gradoFuncionario=""; + TgeneCatalogDetail grado=CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), + this.responsableCentroControl.getMilitarygradecode()); + if(grado!=null){ + gradoFuncionario=grado.getDescription()+" - "; + } + System.out.println("2. emitirDocumento"); + parameters.put("codigoQR",solicitudTramite.getNumerotramite()+" "+ + sdf.format(Calendar.getInstance().getTime())+" "+gradoFuncionario+this.responsableCentroControl.getName()+" "+this.institucionCentroControl); + + + String format = "pdf"; + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Ejecuta un reporte de certificado de armas + * @param name Nombre del reporte a generar. + */ + + + + public void reporteAgencias() { + try { + String path = "armas/reports/aperturaAgenciasSucursales"; + String filename="aperturaagenciassucursales"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + + //Grado + String gradoFuncionario=""; + TgeneCatalogDetail grado=CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), + this.responsableCentroControl.getMilitarygradecode()); + if(grado!=null){ + gradoFuncionario=grado.getDescription()+" - "; + } + System.out.println("3. emitirDocumento"); + parameters.put("codigoQR",solicitudTramite.getNumerotramite()+" "+sdf.format(Calendar.getInstance().getTime())+" "+ + gradoFuncionario+this.responsableCentroControl.getName()+" "+this.institucionCentroControl); + + + String format = "pdf"; + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + +/* public void reporteInscripcion(TarmSolicitud solicitud) { + try { + String path = "armas/reports/reporteInscripcion"; + String filename="armas"; + + detallesPersona = PersonDetailController.find(String.valueOf(solicitud.getPersoncode().toString())); + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + + //No. Guia + parameters.put("nombreCompania", detallesPersona.getName()); + + //Nombre/Razon Social + parameters.put("nombrepersona",detallesPersona.getLegalrepresent()); + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("fecha", sdf.format(solicitud.getFregistro())); + parameters.put("ciudad", "Quito"); + + String format = "pdf"; + + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + */ + /** + * Ejecuta reporte general de informacion de armas, guardias, agencias y sucursales + * @param name Nombre del reporte a generar. + */ + + public InputStream reporteGeneral(String solicitud,boolean flagAgencia,boolean flagArmas,boolean flagDoc,boolean flagGuardias,boolean flagRequisitos,String nombreArchivo) { + try { + String path = "armas/reports/generalReportHabilita"; + String filename=nombreArchivo; + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail user = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); +// TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(user.getMilitarygrade(), user.getMilitarygradecode()); + TgeneCatalogDetail grado =null; + if(this.responsableCentroControl.getMilitarygrade()!=null && this.responsableCentroControl.getMilitarygradecode()!=null){ + grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + } + + String gradoUsuario=""; + if(grado!=null){ + gradoUsuario = grado.getDescription()+" - "+this.responsableCentroControl.getName(); + }else{ + gradoUsuario = this.responsableCentroControl.getName(); + } + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("csolicitud", solicitudflujo); + + //Obteniendo la solicitud + TarmSolicitud s=SolicitudController.findSolicitudxcodsolicitud(solicitudflujo); + TarmTramite t; + Boolean datosTramiteVacios=false; + + if(s!=null){ + //Obteniendo el tramite + t=TarmTramiteController.find(s.getCtramite().toString()); + + //Obteniendo la solicitud trmite + TarmSolicitudTramite st=TarmSolicitudTramiteController.findPorCSolicitud(solicitudflujo); + + + if(t!=null){ + + //No de tramite + if(st!=null){ + parameters.put("noTramite", st.getNumerotramite()); + }else{ + parameters.put("noTramite", " "); + } + + //Tipo de tramite + if(t.getModifiedData().get("tipotramite")!=null){ + parameters.put("tipoTramite", t.getModifiedData().get("tipotramite")); + }else{ + parameters.put("tipoTramite", " "); + } + + //Tipo de autorizacion + if(t.getModifiedData().get("tipoautorizacion")!=null){ + parameters.put("tipoAutorizacion", t.getModifiedData().get("tipoautorizacion")); + }else{ + parameters.put("tipoAutorizacion", " "); + } + + //Categoria + if(t.getModifiedData().get("categoria")!=null){ + parameters.put("categoria", t.getModifiedData().get("categoria")); + }else{ + parameters.put("categoria", " "); + } + + //Uso actividad + if(t.getModifiedData().get("usoactividad")!=null){ + parameters.put("usoActividad", t.getModifiedData().get("usoactividad")); + }else{ + parameters.put("usoActividad", " "); + } + + //Cabecera + if(t.getCabecera()!=null){ + parameters.put("cabecera", t.getCabecera()); + }else{ + parameters.put("cabecera", " "); + } + + //Pie + if(t.getPie()!=null){ + parameters.put("pie", t.getPie()); + }else{ + parameters.put("pie", " "); + } + + //fecha de solicitud + if(s.getFregistro()!=null){ + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fecSolicitud", sdf.format(s.getFregistro())); + } + else { + parameters.put("fecSolicitud", ""); + } + + + + }else{ + datosTramiteVacios=true; + } + }else{ + datosTramiteVacios=true; + } + + if(datosTramiteVacios){ + parameters.put("noTramite", " "); + parameters.put("tipoTramite", " "); + parameters.put("tipoAutorizacion", " "); + parameters.put("categoria", " "); + parameters.put("usoActividad", " "); + parameters.put("cabecera", " "); + parameters.put("pie", " "); + } + + //Obteniendo la direccion + String email=" ",direccion=" "; + List direcciones=PersonAddressController.findAllByPersonCode(s.getPersoncode().toString()); + for (TcustPersonAddress d : direcciones) { + Calendar calendario=Calendar.getInstance(); + calendario.setTime(d.getPk().getDateto()); + if(calendario.get(Calendar.YEAR)==2999){ + if(d.getAddresstypecatalog().equalsIgnoreCase("3")){ + email=d.getAddress(); + }else if(d.getPrincipal()!=null && d.getPrincipal().equalsIgnoreCase("Y")){ + direccion=d.getAddress(); + } + } + } + + //Email + parameters.put("email", email); + + //Direccion + parameters.put("direccion", direccion); + + + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + parameters.put("flagAgencia", flagAgencia); + parameters.put("flagArmas", flagArmas); + parameters.put("flagDoc", flagDoc); + parameters.put("flagGuardias", flagGuardias); + parameters.put("flagRequisitos", flagRequisitos); + parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("codResponsable", this.responsableCentroControl.getPk().getPersoncode()); + parameters.put("usuario",user.getName()); + + System.out.println("4. emitirDocumento"); + parameters.put("codigoQR",solicitud+" "+sdf.format(Calendar.getInstance().getTime())+" "+gradoUsuario+" "+this.institucionCentroControl); + + + String format = "pdf"; + InputStream pdf=this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + return pdf; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + return null; + } + + /** + * Obtiene el centro de control segun usurio logeado. + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController direccion = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres= direccion.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + this.centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + //Reponsable + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + return setInstitucionCentroControl(CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + + + + } + + /** + * Ejecuta reporte general de informacion de armas, guardias, agencias y sucursales + * @param name Nombre del reporte a generar. + */ + + public InputStream reporteCertificados(String solicitud,boolean flagAgencia,boolean flagArmas,boolean flagDoc,boolean flagGuardias) { + try { + String gradoUsuario =""; + String path = "armas/reports/reporteCertificado"; + if(tramiteingresado.equals("NOLETAL")){ + path = "armas/reports/reporteCertificadoNoLetal"; + } + String filename="reporteCertificado"; + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail user = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if(grado != null){ + gradoUsuario = grado.getDescription()+" - "+this.responsableCentroControl.getName(); + }else{ + gradoUsuario = "Sin Grado - "+this.responsableCentroControl.getName(); + } + + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("csolicitud", solicitud); + //Obteniendo la solicitud + TarmSolicitud s=SolicitudController.findSolicitudxcodsolicitud(solicitudflujo); + //Obteniendo la direccion + String email=" ",direccion=" "; + List direcciones=PersonAddressController.findAllByPersonCode(s.getPersoncode().toString()); + for (TcustPersonAddress d : direcciones) { + Calendar calendario=Calendar.getInstance(); + calendario.setTime(d.getPk().getDateto()); + if(calendario.get(Calendar.YEAR)==2999){ + if(d.getAddresstypecatalog().equalsIgnoreCase("3")){ + email=d.getAddress(); + }else if(d.getAddresstypecatalog().equalsIgnoreCase("1")){ + direccion=d.getAddress(); + } + } + } + + //Email + parameters.put("email", email); + //Fecha + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + parameters.put("fechaExpiracion", sdf.format(documentoHabilitante.getFechaexpiracion())); + parameters.put("flagAgencia", flagAgencia); + parameters.put("flagArmas", flagArmas); + parameters.put("flagDoc", flagDoc); + parameters.put("flagGuardias", flagGuardias); + parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("usuario",user.getName()); + parameters.put("codResponsable", this.responsableCentroControl.getPk().getPersoncode()); + + System.out.println("5. emitirDocumento"); + parameters.put("codigoQR",solicitud+" "+sdf.format(Calendar.getInstance().getTime())+" "+ + gradoUsuario+" "+this.institucionCentroControl); + + + String format = "pdf"; + //this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + InputStream pdf=this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + return pdf; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + return null; + } + + public List getLdocumentos() { + return ldocumentos; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + public void setLdocumentos(List ldocumentos) { + this.ldocumentos = ldocumentos; + } + + public String getIdentificacion() { + return identificacion; + } + + public void setIdentificacion(String identificacion) { + this.identificacion = identificacion; + } + + public String getTipoidentificacion() { + return tipoidentificacion; + } + + public void setTipoidentificacion(String tipoidentificacion) { + this.tipoidentificacion = tipoidentificacion; + } + + TarmTramite getFila() { + return fila; + } + + public void setFila(TarmTramite fila) { + this.fila = fila; + } + + + + public String getFormato() { + return formato; + } + + public void setFormato(String formato) { + this.formato = formato; + } + + public String getMostrarFormato() { + return mostrarFormato; + } + + public void setMostrarFormato(String mostrarFormato) { + this.mostrarFormato = mostrarFormato; + } + + public String getTramiteflujo() { + return tramiteflujo; + } + + public void setTramiteflujo(String tramiteflujo) { + this.tramiteflujo = tramiteflujo; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public String setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + return institucionCentroControl; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public DocumentoHabilitanteController getDocumentoHabilitanteController() { + return documentoHabilitanteController; + } + + public void setDocumentoHabilitanteController( + DocumentoHabilitanteController documentoHabilitanteController) { + this.documentoHabilitanteController = documentoHabilitanteController; + } + + public PersonAddressController getPesonAddressController() { + return pesonAddressController; + } + + public void setPesonAddressController( + PersonAddressController pesonAddressController) { + this.pesonAddressController = pesonAddressController; + } + + public SolicitudController getSolicitudController() { + return solicitudController; + } + + public void setSolicitudController(SolicitudController solicitudController) { + this.solicitudController = solicitudController; + } + + + + + +} + diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/AgenciaArmaController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/AgenciaArmaController.java new file mode 100644 index 0000000..5e285ab --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/AgenciaArmaController.java @@ -0,0 +1,108 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmAgenciaArma; +import com.fp.persistence.parmas.soli.TarmSolicitud; + +@ManagedBean +@ViewScoped +public class AgenciaArmaController extends AbstractController { + + private static final long serialVersionUID = -8596957712603749520L; + + public AgenciaArmaController() throws Exception { + super(TarmAgenciaArma.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + } + + private void init() { + this.beanalias = "AGENCIAARMAS"; + this.recperpage = 10; + this.lrecord = new ArrayList<>(); + } + + /** + * Busca las Agencias asociadas a las armas según los criterios + * indicados + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(Boolean.TRUE); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response response = callerhelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.lrecord = (List) response.get(beanalias); + this.postQuery(lrecord); + } else { + this.lrecord = new ArrayList<>(); + MessageHelper.setMessageError(response); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dto = this.getDtoSave(); + dto.setReturnpk(Boolean.TRUE); + HashMap msaves = new HashMap(); + + msaves.put(this.beanalias, dto); + Request request = callerhelper.getRequest(); + request.setSaveTables(msaves); + + Response response = callerhelper.executeSave(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(response); + MessageHelper.setMessageInfo(response); + } else { + MessageHelper.setMessageError(response); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static TarmAgenciaArma findByCArma(String cArma, String cAgencia) { + try { + AgenciaArmaController cc = new AgenciaArmaController(); + cc.init(); + cc.recperpage = 10000; + cc.addFilter("pk.carma", cArma); + cc.addFilter("pk.cagencia", cAgencia); + cc.querydatabase(); + if (cc.lrecord.size() > 0) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/AgenciaSucursalController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/AgenciaSucursalController.java new file mode 100644 index 0000000..6afdde9 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/AgenciaSucursalController.java @@ -0,0 +1,260 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.event.AjaxBehaviorEvent; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmAgenciaSucursal; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Controlador que maneja la entidad de {@link TarmAgenciaSucursal} + * + * @author dcruz + * + */ +@ManagedBean +@ViewScoped +public class AgenciaSucursalController extends + AbstractController { + + private List estadoAgencias; + private List tipoAgencias; + private List lprovincias; + private List lcantones; + private List lparroquias; + private List lcities; + + private static final long serialVersionUID = 4621335239110508027L; + + public AgenciaSucursalController() throws Exception { + super(TarmAgenciaSucursal.class); + } + + @PostConstruct + public void postConstruct() { + this.init(); + super.startQuery(); + } + + private void init() { + this.beanalias = "AGENCIASUCURSAL"; + this.lrecord = new ArrayList<>(); + this.recperpage = 15; + this.estadoAgencias = CatalogDetailController.find("ESTADOAGENCIA"); + this.tipoAgencias = CatalogDetailController.find("TIPOAGENCIA"); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto);//se puede aniadir mas tablas + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response response = callerhelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList<>(); + MessageHelper.setMessageError(response); + } else { + this.lrecord = (List) response.get(beanalias); + this.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + @Override + public void save() { + try { + DtoSave dto = super.getDtoSave(); + if (!dto.pendingProcess()) { + return; + } + dto.setReturnpk(Boolean.TRUE); + HashMap msaves = new HashMap(); + msaves.put(beanalias, dto); + Request request = callerhelper.getRequest(); + request.setSaveTables(msaves); + Response response = callerhelper.executeSave(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(response); + MessageHelper.setMessageInfo(response); + } else { + MessageHelper.setMessageError(response); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + SubQuery subQueryTipo = new SubQuery("TgeneCatalogDetail", "description", "ntipo", "i.pk.catalog=t.tipo and i.pk.catalogcode=t.tipocodigo"); + dto.addSubQuery(subQueryTipo); + SubQuery subQueryEstado = new SubQuery("TgeneCatalogDetail", "description", "nestado", "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subQueryEstado); + SubQuery subQueryProvincia = new SubQuery("TgeneProvince", "description", "nprovincia", "i.pk.provincecode=t.provincecode and i.pk.countrycode=t.countrycode"); + dto.addSubQuery(subQueryProvincia); + SubQuery subQueryCanton = new SubQuery("TgeneCanton", "description", "ncanton", "i.pk.countrycode=t.countrycode and i.pk.provincecode=t.provincecode and i.pk.cantoncode=t.cantoncode"); + dto.addSubQuery(subQueryCanton); + SubQuery subQueryParroquia = new SubQuery("TgeneParroquia", "description", "nparroquia", "i.pk.countrycode=t.countrycode and i.pk.provincecode=t.provincecode and i.pk.cantoncode=t.cantoncode and i.pk.parroquiacode=t.parroquiacode"); + dto.addSubQuery(subQueryParroquia); + SubQuery subQueryCiudad = new SubQuery("TgeneCity", "description", "nciudad", "i.pk.countrycode=t.countrycode and i.pk.provincecode=t.provincecode and i.pk.cantoncode=t.cantoncode and i.pk.citycode=t.citycode"); + dto.addSubQuery(subQueryCiudad); + return dto; + } + + public void loadEdit() { + lprovincias = ProvinceController.find(record.getCountrycode()); + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + lcities = CityController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + } + + @Override + public void create() throws Exception { + super.create(); + this.record.setCountrycode("EC"); + this.record.setTipocodigo("TIPOAGENCIA"); + this.record.setEstadocodigo("ESTADOAGENCIA"); + this.record.setFautorizacion(new Date()); + if (this.record.isnew) { + this.record.setEstado("REG"); + } + this.lprovincias = ProvinceController.find(record.getCountrycode()); + this.executeProvince(); + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + lcities = CityController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + } + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if (Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")) { + valorColocar = Boolean.TRUE; + } + for (TarmAgenciaSucursal agenciaSucursal : lrecord) { + agenciaSucursal.getModifiedData().put("seleccionado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static TarmAgenciaSucursal find(String cagencia) { + TarmAgenciaSucursal agenciaSucursal = null; + try { + AgenciaSucursalController cc = new AgenciaSucursalController(); + cc.addFilter("pk", cagencia); + cc.init(); + cc.recperpage = 300; + cc.query(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + agenciaSucursal = cc.lrecord.get(0); + } + return agenciaSucursal; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return agenciaSucursal; + } + } + + public List getEstadoAgencias() { + return estadoAgencias; + } + + public void setEstadoAgencias(List estadoAgencias) { + this.estadoAgencias = estadoAgencias; + } + + public List getTipoAgencias() { + return tipoAgencias; + } + + public void setTipoAgencias(List tipoAgencias) { + this.tipoAgencias = tipoAgencias; + } + + public List getLprovincias() { + return lprovincias; + } + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public List getLparroquias() { + return lparroquias; + } + + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + public List getLcities() { + return lcities; + } + + public void setLcities(List lcities) { + this.lcities = lcities; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/AprobacionPlanInspeccionController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/AprobacionPlanInspeccionController.java new file mode 100644 index 0000000..a41daa2 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/AprobacionPlanInspeccionController.java @@ -0,0 +1,661 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.ins.TarmPlanificacionInspeccion; +import com.fp.persistence.parmas.ins.TarmPlanificacionTramite; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmInspeccion; +import com.fp.persistence.parmas.soli.TarmInspeccionArchivo; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class AprobacionPlanInspeccionController extends AbstractController { + + //Codigo de planificacion(Variable de flujo) + private Long cplanificacion; + + private TarmCentroControl centroControl; + String jefeCentroControl; + private String nombreCentroControl; + private Boolean reporteGenerado = false; + private String opcion = ""; + private String observaciones = ""; + private Boolean reporteHabilitado = false; + private String gradoFuncionario = ""; + private TcustPersonDetail usuario; + private String xpathflujo = ""; + + private List listainsepcion; + + private Boolean btnFlujo = false; + + @ManagedProperty(value = "#{planificacionTramiteController}") + private PlanificacionTramiteController planificacionTramiteController; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + public AprobacionPlanInspeccionController() throws Exception { + super(TarmPlanificacionInspeccion.class); + } + + @PostConstruct + private void postconstruct() { + try { + this.startQuery(); + this.init(); + //super.query(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + if (super.getMfilters().get("cplanificacion") != null) { + cplanificacion = Long.parseLong(super.getMfilters().get("cplanificacion").toString()); + } + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + private void init() { + try { + recperpage = 15; + lrecord = new ArrayList<>(); + record = new TarmPlanificacionInspeccion(); + beanalias = "APROBACIONPLANINSPECCIONCONTROLLER"; + this.planificacionTramiteController = new PlanificacionTramiteController(); + this.planificacionTramiteController.setLrecord(new ArrayList()); + btnFlujo = false; + + //Cargando la planificacion por el codigo + this.record = PlanificacionInspeccionController.findPorCodigo(this.cplanificacion); + + // this.listainsepcion=PlanificacionTramiteController.findPorCodigoPlanificacion(this.cplanificacion); + if (this.record != null && this.record.getPk() != null) { + //Cargando las inspecciones + this.planificacionTramiteController.setCplanificacion(this.record.getPk()); + this.planificacionTramiteController.setRecperpage(4000); + //PlanificacionInspeccionController inspeccion = new PlanificacionInspeccionController(); + //inspeccion.getPresupuesto1(); + this.record.getPresupuesto().toString(); + this.planificacionTramiteController.querydatabaseAprobacion(); + + Collections.sort(planificacionTramiteController.getLrecord(), new Comparator() { + public int compare(TarmPlanificacionTramite p1, TarmPlanificacionTramite p2) { + return new Long(p1.getMesnumero()).compareTo(p2.getMesnumero()); + } + }); + + //Cargando el centro de control + this.centroControl = CentroControlArmasController.findPorCodigo(this.record.getCcentrocontrol()); + this.nombreCentroControl = centroControl.getModifiedData().get("desnombreinstitucion") + ""; + + //Obteniendo el jefe del centro de control + this.jefeCentroControl = centroControl.getModifiedData().get("nombre") + "";//PersonDetailController.find(this.centroControl.getPersoncode().toString()); + + //Obteniendo el grado del jefe del centro de control + gradoFuncionario = centroControl.getModifiedData().get("desgrado") + "" + " - "; + + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + this.usuario = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + private void initConsulta() { + try { + recperpage = 15; + lrecord = new ArrayList<>(); + record = new TarmPlanificacionInspeccion(); + beanalias = "APROBACIONPLANINSPECCIONCONTROLLER"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void query() throws Exception { + MessageHelper.setMessageError("msg_notQuery"); + super.query(); + } + + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); +// if(!lrecord.isEmpty() ){ +// record=lrecord.get(0); +// } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + request.modifiedData().put("cplanificacion", this.record.getPk()); + bpmDataStatus = "A"; + if (this.opcion.equalsIgnoreCase("rechazar")) { + bpmDataStatus = "D"; + } + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.planificacionTramiteController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + this.reporteHabilitado = true; + btnFlujo = true; + } else { + MessageHelper.setMessageError(resp); + //this.planificacionSalvada=false; + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que persiste la planificacion con el xpath del pdf del reporte en + * el alfresco + */ + public void saveXpathReporte() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que aprueba el plan + * + * @throws Exception + */ + public void aprobar() throws Exception { + try { + if (this.opcion.equalsIgnoreCase("Aprobar")) { + this.record.setAprobada("Y"); + update(); + save(); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Ejecuta un reporte de custodios + * + * @param name Nombre del reporte a generar. + */ + public InputStream generateReport() { + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + String path = "armas/reports/planInspeccion"; + String filename = MsgControlArmas.getProperty("lbl_planInspeccionAnual"); + + //Cargando la planificacion + this.record = PlanificacionInspeccionController.findPorCodigo(cplanificacion); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //cplanificacion + parameters.put("cplanificacion", this.record.getPk()); + + //Fecha actual + parameters.put("fechaActual", new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + + //Codigo + parameters.put("codigo", this.record.getCodigo()); + + //Anno + parameters.put("anno", this.record.getAnno().toString()); + + //Codigo + parameters.put("codigo", this.record.getCodigo()); + + //Nombre del centro de control + parameters.put("nombreCentro", this.nombreCentroControl); + + //Fecha actual + parameters.put("fechaActual", Calendar.getInstance().getTime()); + + //cplanificacion + parameters.put("cplanificacion", this.record.getPk()); + + //Fecha actual + parameters.put("fechaActual", new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + + //Fecha generacion + parameters.put("fechaGeneracion", sdf.format(this.record.getFechageneracion())); + + //Anno + parameters.put("anno", this.record.getAnno().toString()); + + //Codigo + parameters.put("codigo", this.record.getCodigo()); + + //Fecha Inicio + parameters.put("fechaInicio", sdf.format(this.record.getFechainicio())); + + //Fecha Fin + parameters.put("fechaFin", sdf.format(this.record.getFechafin())); + + //Funcionario + parameters.put("gradoNombreFuncionario", gradoFuncionario + this.jefeCentroControl); + parameters.put("personcode", this.centroControl.getPersoncode()); + parameters.put("centroControl", "JEFE DEL " + this.nombreCentroControl); + + //presupuesto anual + TgeneCatalogDetail obj = CatalogDetailController.findCatalogo("TIPOPLANIFICACION", this.record.getIdPlanificacion()); + parameters.put("ctiplanificacion", obj.getDescription()); + + // presupuesto anual + parameters.put("cpresupuestoanual", this.record.getPresupuesto()); + + //Usuario + parameters.put("usuario", this.usuario.getName()); + sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + String fechaHora = sdf.format(Calendar.getInstance().getTime()); + parameters.put("fechaHora", fechaHora); + + String format = "pdf"; + + InputStream pdf = null; + try { + //this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + pdf = this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + + //Generando el xpath + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta = new StringBuilder("cm:Planificacion"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + ruta = ruta.append("/cm:" + "reportePlanInspeccion"); + xpathflujo = ruta.toString(); + this.record.setXpath(xpathflujo + "/cm:" + this.record.getCodigo() + ".pdf"); + + //Subiendo el pdf al alfresco + alfrescoController.uploadFile(pdf, this.record.getCodigo() + ".pdf", xpathflujo); + + update(); + saveXpathReporte(); + + this.reporteGenerado = true; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + return pdf; + } + + public void probarReporte() { + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + String path = "armas/reports/planInspeccion"; + String filename = MsgControlArmas.getProperty("lbl_planInspeccionAnual"); + + //Cargando la planificacion + this.record = PlanificacionInspeccionController.findPorCodigo(28L); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //cplanificacion + parameters.put("cplanificacion", this.record.getPk()); + + //Fecha actual + parameters.put("fechaActual", new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + + //Fecha generacion + parameters.put("fechaGeneracion", sdf.format(this.record.getFechageneracion())); + + //Anno + parameters.put("anno", this.record.getAnno().toString()); + + //Codigo + parameters.put("codigo", this.record.getCodigo()); + + //Fecha Innicio + parameters.put("fechaInicio", sdf.format(this.record.getFechainicio())); + + //Fecha Innicio + parameters.put("fechaFin", sdf.format(this.record.getFechafin())); + + //Nombre del centro de control + parameters.put("nombreCentro", this.nombreCentroControl); + + //Fecha actual + parameters.put("fechaActual", Calendar.getInstance().getTime()); + + //Funcionario + parameters.put("gradoNombreFuncionario", gradoFuncionario + this.jefeCentroControl); + parameters.put("personcode", this.centroControl.getPersoncode()); + parameters.put("centroControl", "JEFE DEL " + this.nombreCentroControl); + + //Usuario + parameters.put("usuario", this.usuario.getName()); + sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + String fechaHora = sdf.format(Calendar.getInstance().getTime()); + parameters.put("fechaHora", fechaHora); + + String format = "pdf"; + + try { + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + this.reporteGenerado = true; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public void habilitarFirma() { + + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + if (!btnFlujo) { + MessageHelper.setMessageInfo("GUARDE LOS CAMBIOS"); + } + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("cplanificacion", this.cplanificacion); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + btnFlujo = false; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTareaReporte() { + + try { + if (!reporteGenerado) { + MessageHelper.setMessageError("GENERE EL REPORTE"); + return; + } + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("cplanificacion", this.cplanificacion); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + reporteGenerado = false; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * + * @param codigoSolicitud + * @return + */ + public static List findPorAnno(String centro, String year) { + try { + AprobacionPlanInspeccionController cc = new AprobacionPlanInspeccionController(); + cc.initConsulta(); + cc.recperpage = 300; + if (year != null) { + cc.addFilter("anno", year); + } + cc.addFilter("ccentrocontrol", centro); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; +// if (cc.record != null) { +// return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public PlanificacionTramiteController getPlanificacionTramiteController() { + return planificacionTramiteController; + } + + public void setPlanificacionTramiteController( + PlanificacionTramiteController planificacionTramiteController) { + this.planificacionTramiteController = planificacionTramiteController; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getNombreCentroControl() { + return nombreCentroControl; + } + + public void setNombreCentroControl(String nombreCentroControl) { + this.nombreCentroControl = nombreCentroControl; + } + + public Long getCplanificacion() { + return cplanificacion; + } + + public void setCplanificacion(Long cplanificacion) { + this.cplanificacion = cplanificacion; + } + + public Boolean getReporteGenerado() { + return reporteGenerado; + } + + public void setReporteGenerado(Boolean reporteGenerado) { + this.reporteGenerado = reporteGenerado; + } + + public String getOpcion() { + return opcion; + } + + public void setOpcion(String opcion) { + this.opcion = opcion; + } + + public String getObservaciones() { + return observaciones; + } + + public void setObservaciones(String observaciones) { + this.observaciones = observaciones; + } + + public Boolean getReporteHabilitado() { + return reporteHabilitado; + } + + public void setReporteHabilitado(Boolean reporteHabilitado) { + this.reporteHabilitado = reporteHabilitado; + } + + public String getGradoFuncionario() { + return gradoFuncionario; + } + + public void setGradoFuncionario(String gradoFuncionario) { + this.gradoFuncionario = gradoFuncionario; + } + + public TcustPersonDetail getUsuario() { + return usuario; + } + + public void setUsuario(TcustPersonDetail usuario) { + this.usuario = usuario; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + public List getListaInsepcion() { + return listainsepcion; + } + + public void setListaInsepcion(List listainsepcion) { + this.listainsepcion = listainsepcion; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ArmaEntidadReporte.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ArmaEntidadReporte.java new file mode 100644 index 0000000..33efa22 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ArmaEntidadReporte.java @@ -0,0 +1,81 @@ +package com.fp.frontend.controller.armas.solicitud; + +public class ArmaEntidadReporte { + + private Long numero; + private String clase; + private String tipo; + private String marca; + private String modelo; + private String calibre; + private String serie; + private String estado; + + public ArmaEntidadReporte() { + } + + public Long getNumero() { + return numero; + } + + public void setNumero(Long numero) { + this.numero = numero; + } + + public String getClase() { + return clase; + } + + public void setClase(String clase) { + this.clase = clase; + } + + public String getTipo() { + return tipo; + } + + public void setTipo(String tipo) { + this.tipo = tipo; + } + + public String getMarca() { + return marca; + } + + public void setMarca(String marca) { + this.marca = marca; + } + + public String getModelo() { + return modelo; + } + + public void setModelo(String modelo) { + this.modelo = modelo; + } + + public String getSerie() { + return serie; + } + + public void setSerie(String serie) { + this.serie = serie; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public String getCalibre() { + return calibre; + } + + public void setCalibre(String calibre) { + this.calibre = calibre; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ArmasBloqueoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ArmasBloqueoController.java new file mode 100644 index 0000000..d750b23 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ArmasBloqueoController.java @@ -0,0 +1,908 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.event.AjaxBehaviorEvent; + +import org.apache.commons.lang3.StringUtils; +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.CalibreLovController; +import com.fp.frontend.controller.armas.parametros.ClaseLovController; +import com.fp.frontend.controller.armas.parametros.LongitudLovController; +import com.fp.frontend.controller.armas.parametros.TipoArmaExpLovController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.ValidateIdentification; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +/** + * Controlador principal de armas + * + * @author dcruz + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ArmasBloqueoController extends AbstractController { + + @ManagedProperty(value = "#{tiposArmasExplosivosController}") + private TiposArmasExplosivosController tiposArmasExplosivosController; + + /** + * Lista de tipos de identificación + */ + private List ltipoidentificacion; + /** + * Listado de estados del arma + */ + private List lestadoarma; + + /** + * Tipo documento + */ + private String tipoDoc; + + /** + * Número documento + */ + private String numDoc; + + /** + * Nombre/razón social + */ + private String nombreRazon; + + /** + * Longitud arma + */ + private String longitud; + /** + * Calibre arma + */ + private String calibre; + /** + * Clase arma + */ + private String clase; + /** + * Tipo de arma + */ + private String tipoarma; + /** + * unidad medida peso + */ + private String unidadmedidapeso; + + /** + * Bloquea la unidad de cantidad + */ + private boolean bloquearUnidadCantidad = Boolean.TRUE; + + /** + * Bloquea la unidad de peso + */ + private boolean bloquearUnidadPeso = Boolean.TRUE; + /** + * Contiene la fecha actual del sistema + */ + private Date fechaActual; + /** + * codigo del ruc + */ + private String codigoRuc; + /** + * codigo del ruc + */ + private String codigoCedula; + + private String razonSocial; + + private String numeroDocumento; + + private String filtroPersona; + + public ArmasBloqueoController() throws Exception { + super(TarmArmas.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + fechaActual = new Date(); + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "ARMAS"; + ltipoidentificacion = CatalogDetailController.find("IDENTIFICATION"); + codigoRuc = codigos("CODIGO.RUC"); + codigoCedula = codigos("CODIGO.CEDULA"); + filtroPersona = ""; + //userDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + String sqlFiltroPersona = ""; + if (this.getMfilelds().get("personcode") != null) { + sqlFiltroPersona = " t.cregistro in (SELECT c.pk FROM TarmRegistroArmas c WHERE c.personcode=" + this.getMfilelds().get("personcode") + ")"; + } + + dto.setOrderby("pk"); + + //estados del armas + String sqlActual = ""; + if (this.getMfilelds().get("personcode") == null) { + sqlActual = " t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma) " + + " and t.estado !='DEST' and t.estado!='VEND' and t.estado!='MING' and t.estado!='DUPL' and t.estado!='CUSTEM'" + + " and (t.peso>0 or t.cantidad>0)";//distintas de destruidas y cambio de propietario and t.cregistro=ta.cregistro para el manejo de los explosivos + } else { + sqlActual = " t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) " + + " and t.estado !='DEST' and t.estado!='VEND' and t.estado!='MING' and t.estado!='DUPL' and t.estado!='CUSTEM'" + + " and (t.peso>0 or t.cantidad>0)";//distintas de destruidas y cambio de propietario and t.cregistro=ta.cregistro para el manejo de los explosivos + } + + sqlActual = sqlActual + filtroPersona; + + String sqlFinal = obtenerFiltroBusquedaGeneral(sqlFiltroPersona, sqlActual); + Filter filtroFinal = new Filter(); + sqlFinal = sqlFinal + " and t.estadoventa is null "; + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private String obtenerFiltroBusquedaGeneral(String... sqlFiltros) { + StringBuffer sqlFinal = new StringBuffer(); + for (int i = 0; i < sqlFiltros.length; i++) { + if (sqlFinal.length() > 0 && !StringUtils.endsWith(StringUtils.trim(sqlFinal.toString()), "AND")) { + sqlFinal.append(" AND "); + } + sqlFinal.append(sqlFiltros[i]); + } + return sqlFinal.toString(); + } + + @Override + public void next() throws Exception { + // TODO Auto-generated method stub + super.next(); + } + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", "i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryTipoFab = new SubQuery("TgeneCatalogDetail", "description", "tipofabricacion", "i.pk.catalog=t.tipofabricacion and i.pk.catalogcode='TIPOFABRICACION'"); + dto.addSubQuery(subqueryTipoFab); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase = new SubQuery("TarmTipoArmaExplosivo", "clase", "cclase", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo = new SubQuery("TarmTipoArmaExplosivo", "clasecodigo", "cclasecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud = new SubQuery("TarmTipoArmaExplosivo", "longitud", "clongitud", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo = new SubQuery("TarmTipoArmaExplosivo", "longitudcodigo", "clongitudcodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre = new SubQuery("TarmTipoArmaExplosivo", "calibre", "ccalibre", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo = new SubQuery("TarmTipoArmaExplosivo", "calibrecodigo", "ccalibrecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivo", "ctipoarmaexplosivo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivocodigo", "ctipoarmaexplosivocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapeso", "cunidadmedidapeso", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadTipo = new SubQuery("TgeneCatalogDetail", "description", "unidadmedidadesc", "i.pk.catalog= (select o.unidadmedidapeso from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryUnidadTipo); + SubQuery subqueryUnidadCodigo = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapesocodigo", "cunidadmedidapesocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida = new SubQuery("TgeneCatalogDetail", "description", "unidadmedida", "i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode = new SubQuery("TarmRegistroArmas", "personcode", "personcode", "i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + SubQuery subqueryTipo = new SubQuery("TgeneCatalogDetail", "description", "tipo", "i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipo); + SubQuery subqueryTipoArmaExplosivo = new SubQuery("TgeneCatalogDetail", "description", "tipoarmaexplosivo", "i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + SubQuery subqueryClasecatalogo = new SubQuery("TgeneCatalogDetail", "description", "clase", "i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClasecatalogo); + + return dto; + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(Boolean.TRUE); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + msave.put(beanalias, dtosave); + + Request request = callerhelper.getRequest(); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + querydatabase(); + } + + @Override + public void update() throws Exception { + TgeneCatalogDetail estado = CatalogDetailController.findxCodigoCodcatalogo(record.getEstado(), record.getEstadocodigo()); + record.getModifiedData().put("estado", estado.getDescription()); + super.update(); + } + + /* + * Metodo que retorna la extencion del documento que se desea subir al alfresco + */ + public String getExtension(String filename) { + int index = filename.lastIndexOf('.'); + if (index == -1) { + return ""; + } else { + return filename.substring(index + 1); + } + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase(String carpeta) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta = new StringBuilder("cm:Registro"); + ruta = ruta.append("/cm:" + carpeta); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + ruta = ruta.append("/cm:D-").append(calendar.get(Calendar.DAY_OF_WEEK)); + return ruta.toString(); + } + + public void updateAutorizacion() throws Exception { + super.update(); + } + + /** + * Método que se ejecuta al carga edición + * + * @throws Exception + */ + public void loadEdit() throws Exception { + if (record.getCountrycode() == null) { + record.setCountrycode("EC"); + } + if (record.getCtipoarmaexplosivo() == null) { + MessageHelper.setMessageError("NO ESTA ASOCIADO A UN TIPO DE ARMA EXPLOSIVO"); + return; + } + TarmRegistroArmas registroArmas = RegistroArmController.findByCodigo(record.getCregistro().toString()); + TcustPersonDetail tcustPersonDetail = PersonDetailController.find(registroArmas.getPersoncode().toString()); + tipoDoc = tcustPersonDetail.getIdentificationcatalog(); + numDoc = tcustPersonDetail.getIdentification(); + nombreRazon = tcustPersonDetail.getName(); + // + lestadoarma = new ArrayList<>(); + String catalogoabre = record.getEstado() != null && record.getEstado().equals("BLOQ") ? "REG" : "BLOQ"; + TgeneCatalogDetail catalogo = CatalogDetailController.findCatalogo("ESTADOARMA", catalogoabre); + lestadoarma.add(catalogo); + } + + /** + * Recorta el nombre del archivo a cargarse + * + * @param nombre + * @return nombre recortado + */ + public String recorteNombre(String nombre) { + String fielname = nombre; + if (fielname.length() > 30) { + fielname = fielname.substring(0, 30) + extencionArchivo(nombre); + } + return fielname; + } + + /** + * Obtiene la extencion del archivo a cargar + * + * @param nombre + * @return + */ + private String extencionArchivo(String nombre) { + int pos = nombre.lastIndexOf('.'); + nombre = nombre.substring(pos); + return nombre; + } + + @Override + public void create() throws Exception { + super.create(); + this.tipoDoc = null; + this.numDoc = null; + this.nombreRazon = null; + this.record.setCountrycode("EC"); +// this.record.setEstado("REG"); + this.record.setEstado("PREG"); + this.record.setEstadocodigo("ESTADOARMA"); + this.record.setMarcacodigo("MARCA"); + this.record.setGeneracertificado("NO"); + } + + public void update(TarmArmas bean) throws Exception { + record = bean; + updateAutorizacion(); + } + + public void validacionDocumento(String numeroDocumento, String tipoDocumento) { + if (numeroDocumento == null || tipoDocumento == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselacedula")); + return; + } + TcustPersonDetail tcustPersonDetail = null; + if (tipoDocumento.equals(codigoCedula)) { +//----------validamos si es valida la CEDULA + if (!ValidateIdentification.cedula(numeroDocumento)) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en MAIA + tcustPersonDetail = buscarPersonaMaia(numeroDocumento, tipoDocumento); + } else if (tipoDocumento.equals(codigoRuc)) { +//----------validamos si es valida el RUC + if (!ValidateIdentification.ruc(numeroDocumento)) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en maia + tcustPersonDetail = buscarPersonaMaia(numeroDocumento, tipoDocumento); + } else { +//----------si es PASAPORTE + tcustPersonDetail = buscarPersonaMaia(numeroDocumento, tipoDocumento); + } + if (tcustPersonDetail == null) { + nombreRazon = null; + numDoc = null; + MessageHelper.setMessageError("La datos de la persona ingresada no existen, por favor crear primero la persona"); + return; + } else { + nombreRazon = tcustPersonDetail.getName(); + } + } + + /** + * Método para validar si la persona existe en la BD de Maia + * + * @param numeroDocumento + * @param tipoDocumento + * @return TcustPersonDetail + */ + public TcustPersonDetail buscarPersonaMaia(String numeroDocumento, String tipoDocumento) { + return PersonDetailController.findxidentification(numeroDocumento, tipoDocumento); + } + + /** + * Busca un arma por código + * + * @param armaCode + * @return + */ + public static TarmArmas findXCodigo(String armaCode) { + try { + + ArmasBloqueoController cc = new ArmasBloqueoController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + //cc.addFilter("REG", "ESTADOARMA"); + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * + * + * @param personCode + * @param estados estados del arma separados por coma + * @param tipoFab tipos de fabricacion del arma separados por coma + * @return Una lista de Armas encontradas + */ + public List findxPersona(Long personCode, String estados, String tipoFab, String clase, String fechaCaducidad) { + List armasLista = null; + try { + armasLista = new ArrayList(); + ArmasBloqueoController armas = new ArmasBloqueoController(); + armas.init(); + armas.recperpage = 4000; + armas.addField("personcode", personCode); + if (this.getMfilelds().get("sancion") != null) { + armas.addField("sancion", this.getMfilelds().get("sancion")); + } + if (this.getMfilelds().get("TRAMITE") != null) { + armas.addField("TRAMITE", this.getMfilelds().get("TRAMITE")); + } + if (estados == null) { + armas.addFilter("estado", "REG"); + } else { + armas.addField("ESTADOS", estados); + } + if (tipoFab != null && tipoFab.trim().length() > 0) { + armas.addField("TIPOFABRICACION", tipoFab); + } + if (clase != null && clase.trim().length() > 0) { + armas.addField("CLASEARMAS", clase); + } +// if(fechaCaducidad != null && fechaCaducidad .trim().length()>0){ +// armas.addField("FECHACADUCIDADARM", fechaCaducidad); +// } + armas.query(); + if (armas.getLrecord() != null && !armas.getLrecord().isEmpty()) { + armasLista.addAll(armas.getLrecord()); + } + + return armasLista; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return armasLista; + } + } + + /** + * Lista de Armas por Registro + * + */ + public static List findxRegistro(String registrocode) { + try { + ArmasBloqueoController cc = new ArmasBloqueoController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("cregistro", registrocode); + + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + for (TarmArmas item : cc.lrecord) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(item.getCtipoarmaexplosivo()); + item.modifiedData().put("clase", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription()); + if (tarmTipoArmaExplosivo.getLongitud() != null && tarmTipoArmaExplosivo.getLongitudcodigo() != null) { + item.modifiedData().put("longitud", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getLongitud(), tarmTipoArmaExplosivo.getLongitudcodigo()).getDescription()); + } + item.modifiedData().put("tipo", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription()); + if (tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null) { + item.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription()); + } + item.modifiedData().put("unidadMedidaCantidad", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getUnidadmedidapeso(), tarmTipoArmaExplosivo.getUnidadmedidapesocodigo()).getDescription()); + } + + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Abre el LOV de la clase del arma + */ + public void openLovClase() { + Map> params = new HashMap>(); + ClaseLovController.openLov(params); + } + + /** + * Regresa del LOV de armas + * + * @param event + */ + public void onReturnClase(SelectEvent event) { + TgeneCatalogDetail clase = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("clase", clase.getDescription()); + this.clase = clase.getPk().getCatalog(); + this.verificarClaseArma(); + } + + /** + * Método en el cual se determina si se bloquea unidad o cantidad al + * momento de cargar los datos del arma + * + * @param clase + */ + private void verificarClaseArma() { + if (this.clase == null) { + this.bloquearUnidadPeso = Boolean.TRUE; + this.bloquearUnidadCantidad = Boolean.TRUE; + return; + } + + if (this.clase.equals("0010000003") || this.clase.equals("0010000005") || this.clase.equals("0010000007") || this.clase.equals("0010000006")) { + this.bloquearUnidadPeso = Boolean.FALSE; + } else { + this.bloquearUnidadPeso = Boolean.TRUE; + } + if (this.clase.equals("0010000001") || this.clase.equals("0010000002") || this.clase.equals("0010000004")) { + this.bloquearUnidadCantidad = Boolean.FALSE; + } else { + this.bloquearUnidadCantidad = Boolean.TRUE; + } + } + + /** + * Abre el LOV de la longitud del arma + */ + public void openLovLongitud() { + Map> params = new HashMap>(); + LongitudLovController.openLov(params); + } + + /** + * Regresa del LOV de longitud + * + * @param event + */ + public void onReturnLongitud(SelectEvent event) { + TgeneCatalogDetail longitud = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("longitud", longitud.getDescription()); + this.longitud = longitud.getPk().getCatalog(); + } + + /** + * Abre el LOV del tipo de arma + */ + public void openLovTipoArma() { + Map> params = new HashMap>(); + TipoArmaExpLovController.openLov(params); + } + + /** + * Regresa del LOV de tipo de arma + * + * @param event + */ + public void onReturnTipoArma(SelectEvent event) { + TgeneCatalogDetail tipoArma = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("tipoarmaexplosivo", tipoArma.getDescription()); + this.tipoarma = tipoArma.getPk().getCatalog(); + } + + /** + * Abre el LOV de Calibre + */ + public void openLovCalibre() { + Map> params = new HashMap>(); + CalibreLovController.openLov(params); + } + + /** + * Regresa del LOV del calibre + * + * @param event + */ + public void onReturnCalibre(SelectEvent event) { + TgeneCatalogDetail calibre = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("calibre", calibre.getDescription()); + this.calibre = calibre.getPk().getCatalog(); + } + + /** + * Abre el LOV cambio de usuario + */ + public void openLovCambioUsuario() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if (Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")) { + valorColocar = Boolean.TRUE; + } + for (TarmArmas guardias : lrecord) { + guardias.getModifiedData().put("seleccionado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para obtener los codigos + */ + private static String codigos(String parametro) { + TgeneParameters tgeneParameters = ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + public void actualizar(TarmArmas arma) throws Exception { + record = arma; + super.update(); + } + + public TiposArmasExplosivosController getTiposArmasExplosivosController() { + return tiposArmasExplosivosController; + } + + public void setTiposArmasExplosivosController( + TiposArmasExplosivosController tiposArmasExplosivosController) { + this.tiposArmasExplosivosController = tiposArmasExplosivosController; + } + + public List getLtipoidentificacion() { + return ltipoidentificacion; + } + + public void setLtipoidentificacion(List ltipoidentificacion) { + this.ltipoidentificacion = ltipoidentificacion; + } + + public String getTipoDoc() { + return tipoDoc; + } + + public void setTipoDoc(String tipoDoc) { + this.tipoDoc = tipoDoc; + } + + public String getNumDoc() { + return numDoc; + } + + public void setNumDoc(String numDoc) { + this.numDoc = numDoc; + } + + public String getNombreRazon() { + return nombreRazon; + } + + public void setNombreRazon(String nombreRazon) { + this.nombreRazon = nombreRazon; + } + + public List getLestadoarma() { + return lestadoarma; + } + + public void setLestadoarma(List lestadoarma) { + this.lestadoarma = lestadoarma; + } + + public String getLongitud() { + return longitud; + } + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + public String getCalibre() { + return calibre; + } + + public void setCalibre(String calibre) { + this.calibre = calibre; + } + + public String getClase() { + return clase; + } + + public void setClase(String clase) { + this.clase = clase; + } + + public String getTipoarma() { + return tipoarma; + } + + public void setTipoarma(String tipoarma) { + this.tipoarma = tipoarma; + } + + public String getUnidadmedidapeso() { + return unidadmedidapeso; + } + + public void setUnidadmedidapeso(String unidadmedidapeso) { + this.unidadmedidapeso = unidadmedidapeso; + } + + public boolean isBloquearUnidadCantidad() { + return bloquearUnidadCantidad; + } + + public void setBloquearUnidadCantidad(boolean bloquearUnidadCantidad) { + this.bloquearUnidadCantidad = bloquearUnidadCantidad; + } + + public boolean isBloquearUnidadPeso() { + return bloquearUnidadPeso; + } + + public void setBloquearUnidadPeso(boolean bloquearUnidadPeso) { + this.bloquearUnidadPeso = bloquearUnidadPeso; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public String getRazonSocial() { + return razonSocial; + } + + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public String getFiltroPersona() { + return filtroPersona; + } + + public void setFiltroPersona(String filtroPersona) { + this.filtroPersona = filtroPersona; + } + + /** + * Busca un arma por código + * + * @param armaCode + * @return + */ + public static TarmArmas findXCodigoArma(String armaCode) { + try { + ArmasBloqueoController cc = new ArmasBloqueoController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("codigoarma", armaCode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Abre el lov de persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Maneja la respuesta del Lov de Personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + + TcustPersonDetail personaDetailSelecionada = (TcustPersonDetail) event.getObject(); + razonSocial = personaDetailSelecionada.getName(); + numeroDocumento = personaDetailSelecionada.getIdentification(); + filtroPersona = " and t.cregistro in (select i.pk from TarmRegistroArmas i where i.personcode =" + + personaDetailSelecionada.getPk().getPersoncode() + ")"; + + querydatabase(); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ArmasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ArmasController.java new file mode 100644 index 0000000..ed9b396 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ArmasController.java @@ -0,0 +1,2361 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.apache.commons.lang3.StringUtils; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.SelectEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.common.helper.Constant; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.lov.ArmaExplosivoLovController; +import com.fp.frontend.controller.armas.parametros.CalibreLovController; +import com.fp.frontend.controller.armas.parametros.ClaseLovController; +import com.fp.frontend.controller.armas.parametros.LongitudLovController; +import com.fp.frontend.controller.armas.parametros.TipoArmaExpLovController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.frontend.utility.ValidateIdentification; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import java.util.Arrays; + +/** + * Controlador principal de armas + * + * @author dcruz + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ArmasController extends AbstractController { + + @ManagedProperty(value = "#{tiposArmasExplosivosController}") + private TiposArmasExplosivosController tiposArmasExplosivosController; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmas; + + /** + * Carga el tramite + */ + private TarmTramite tarmTramite; + /** + * Lista de tipos de identificación + */ + private List ltipoidentificacion; + /** + * Listado de estados del arma + */ + private List lestadoarma; + /** + * Listado de marcas + */ + private List lmarca; + /** + * Listado de colores + */ + private List lcolor; + /** + * Listado de tipos de fabricación + */ + private List ltipofabricacion; + /** + * Listado de unidad de medida cantidad + */ + private List lunidadmedidacantidad; + /** + * Listado de unidad medida peso + */ + private List lunidadmedidapeso; + /** + * Listado de paises + */ + private List lcountry; + /** + * Listado de provincias + */ + private List lprovincias; + /** + * Listado de cantones + */ + private List lcantones; + /** + * Listado de parroquias + */ + private List lparroquias; + /** + * Listado de ciudades + */ + private List lcities; + + /** + * Tipo documento + */ + private String tipoDoc; + + /** + * Número documento + */ + private String numDoc; + + /** + * Nombre/razón social + */ + private String nombreRazon; + + /** + * Longitud arma + */ + private String longitud; + /** + * Calibre arma + */ + private String calibre; + /** + * Clase arma + */ + private String clase; + /** + * Tipo de arma + */ + private String tipoarma; + /** + * unidad medida peso + */ + private String unidadmedidapeso; + + /** + * Bandera que indica que en realidad existe luego del ingreso de datos un tipo de arma explosivo válido + */ + private boolean existeTipoArmaExplosivo; + + /** + * Bandera que escifica que se deba verificar que exista un arma explosivo válida + */ + private boolean verificaArmaExplosivo = Boolean.TRUE; + + /** + * Bloquea la unidad de cantidad + */ + private boolean bloquearUnidadCantidad = Boolean.TRUE; + + /** + * Bloquea la unidad de peso + */ + private boolean bloquearUnidadPeso = Boolean.TRUE; + /** + * Contiene la fecha actual del sistema + */ + private Date fechaActual; + /** + * Contiene la referencia a nuevo propietario del arma + */ + private TcustPersonDetail nuevoPropietarioArma; + /** + * Tipo del arma explosivo + */ + private TarmTipoArmaExplosivo tipoArmaExplosivo; + /** + * codigo del ruc + */ + private String codigoRuc; + /** + * codigo del ruc + */ + private String codigoCedula; + /** + * codigo del ruc + */ + private String codigoPasaporte; + + private String razonSocial; + + private String numeroDocumento; + + private String filtroPersona; + + private TsafeUserDetail userDetail; + /** + * Variable que nos permite cargar el documento al Alfresco + */ + private UploadedFile uploadedFile; + + /** + * Variable que nos permite saber que tipo de arma seleccionaron checkbox + */ + private String tipoSeleccionado; + + private Integer seleccionados; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + public ArmasController() throws Exception { + super(TarmArmas.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + this.seleccionados = 0; + fechaActual = new Date(); + recperpage = 15; // Cambiar al # reg a mirar. +// record = new TarmArmas(); + lrecord = new ArrayList<>(); + beanalias = "ARMAS"; + ltipoidentificacion = CatalogDetailController.find("IDENTIFICATION"); + lestadoarma = CatalogDetailController.find("ESTADOARMA"); + //remover el estado bloqueado + List listaremover = new ArrayList<>(); + for (TgeneCatalogDetail item : lestadoarma) { + if (item.getPk().getCatalog().equals("BLOQ")) { + listaremover.add(item); + } + } + lestadoarma.removeAll(listaremover); + + lmarca = CatalogDetailController.find("MARCA"); + lcolor = CatalogDetailController.find("COLOR"); + ltipofabricacion = CatalogDetailController.find("TIPOFABRICACION"); +// lunidadmedidacantidad = CatalogDetailController.find("UCANTIDAD"); + lunidadmedidapeso = CatalogDetailController.find("UNIDADMEDIDA"); + lcountry = CountryController.find(); + codigoRuc = codigos("CODIGO.RUC"); + codigoCedula = codigos("CODIGO.CEDULA"); + codigoPasaporte = codigos("CODIGO.PASAPORTE"); + filtroPersona = ""; + this.getMfilelds().put("enable", Boolean.TRUE); + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + String sqlFiltroPersona = ""; + String sqlFiltroSancion = ""; + String sqlFiltroEstados = ""; + String sqlFiltroTipoFabricacion = ""; + String sqlFiltroClaseArmas = ""; +// String sqlFiltroFechaCaducidad = ""; + String sqlFiltroValidacionArma = "";//si entre los estados existe renovacion entonces validamos que no pueda seleccionar las mismas armas + if (this.getMfilelds().get("personcode") != null) { + sqlFiltroPersona = " t.cregistro in (SELECT c.pk FROM TarmRegistroArmas c WHERE c.personcode=" + this.getMfilelds().get("personcode") + ")"; + } + //agregamos los filtros en base a la consideracion del field sancion, en caso de que lo sea buscamos los sancionados que hayan cumplido el tiempo de sancion + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + if (this.getMfilelds().containsKey("sancion") && this.getMfilelds().get("sancion").toString().equals(Constant.STR_Y)) { + sqlFiltroSancion = " t.pk in (SELECT max(a.pk) FROM TarmArmas a WHERE a.codigoarma in (SELECT distinct(h.codigoarma) from TarmDocumentoHabilitante h WHERE h.pk in (SELECT d.cdocumento FROM TarmSancionDecomiso d WHERE d.personcode=" + this.getMfilelds().get("personcode") + " AND d.fechafinal < TO_DATE('" + dateFormat.format(Calendar.getInstance().getTime()) + "', 'YYYY-MM-DD'))) GROUP BY a.codigoarma)"; + } + + dto.setOrderby("pk"); + if (this.getMfilelds().get("ESTADOS") != null) { + String[] estados = this.getMfilelds().get("ESTADOS").toString().split(","); + StringBuffer sqlEstados = new StringBuffer(" t.estado IN ("); + for (int i = 0; i < estados.length; i++) { + sqlEstados.append("'").append(estados[i]).append("'"); + if (i < estados.length - 1) { + sqlEstados.append(","); + } + } + sqlEstados.append(")"); + sqlFiltroEstados = sqlEstados.toString(); + } + + if (this.getMfilelds().get("TIPOFABRICACION") != null) { + String[] tipoFabricacion = this.getMfilelds().get("TIPOFABRICACION").toString().split(","); + StringBuffer sqlTipoFabricacion = new StringBuffer(" t.tipofabricacion IN ("); + for (int i = 0; i < tipoFabricacion.length; i++) { + sqlTipoFabricacion.append("'").append(tipoFabricacion[i]).append("'"); + if (i < tipoFabricacion.length - 1) { + sqlTipoFabricacion.append(","); + } + } + sqlTipoFabricacion.append(")"); + sqlFiltroTipoFabricacion = sqlTipoFabricacion.toString(); + } + + if (this.getMfilelds().get("TRAMITE") != null) { + TarmTramite tarmTramite = (TarmTramite) this.getMfilelds().get("TRAMITE"); + sqlFiltroValidacionArma = "t.pk not in (SELECT coalesce(max(a.pk),'-1') FROM TarmArmas a WHERE a.codigoarma in (SELECT distinct(h.codigoarma) from TarmDocumentoHabilitante h WHERE h.personcode=" + this.getMfilelds().get("personcode") + " AND h.ctramite=" + tarmTramite.getPk() + " AND h.estado = 'APR' AND h.fechaexpiracion >= " + "TO_DATE('" + dateFormat.format(Calendar.getInstance().getTime()) + "','yyyy-MM-dd')) GROUP BY a.codigoarma)"; + } + //estados del armas + if (this.getMfilelds().get("CLASEARMAS") != null) { + String[] clasesarma = this.getMfilelds().get("CLASEARMAS").toString().split(","); + StringBuffer sqlclasesarmas = new StringBuffer(" t.ctipoarmaexplosivo IN (select o.pk from TarmTipoArmaExplosivo o where o.clase in("); + for (int i = 0; i < clasesarma.length; i++) { + sqlclasesarmas.append("'").append(clasesarma[i]).append("'"); + if (i < clasesarma.length - 1) { + sqlclasesarmas.append(","); + } + } + sqlclasesarmas.append(")) "); + sqlFiltroClaseArmas = sqlclasesarmas.toString(); + } + +// if(this.getMfilelds().get("FECHACADUCIDADARM") != null){ +// sqlFiltroFechaCaducidad="t.fechacaducidad "+this.getMfilelds().get("FECHACADUCIDADARM"); +// } + String sqlActual = ""; + if (this.getMfilelds().get("personcode") == null) { + sqlActual = " t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma) " + + " and t.estado !='DEST' and t.estado!='VEND' and t.estado!='MING' and t.estado!='DUPL' and t.estado!='CUSTEM' and t.estado!='BLOQ'" + + " and (t.peso>0 or t.cantidad>0)";//distintas de destruidas y cambio de propietario and t.cregistro=ta.cregistro para el manejo de los explosivos + } else { + sqlActual = " t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) " + + " and t.estado !='DEST' and t.estado!='VEND' and t.estado!='MING' and t.estado!='DUPL' and t.estado!='CUSTEM' and t.estado!='BLOQ'" + + " and (t.peso>0 or t.cantidad>0)";//distintas de destruidas y cambio de propietario and t.cregistro=ta.cregistro para el manejo de los explosivos + } + + sqlActual = sqlActual + filtroPersona; + +// String sqlFinal = obtenerFiltroBusquedaGeneral(sqlFiltroPersona, sqlFiltroEstados, sqlFiltroSancion, sqlFiltroValidacionArma,sqlFiltroClaseArmas,sqlFiltroFechaCaducidad, sqlActual); + String sqlFinal = obtenerFiltroBusquedaGeneral(sqlFiltroPersona, sqlFiltroEstados, sqlFiltroTipoFabricacion, sqlFiltroSancion, sqlFiltroValidacionArma, sqlFiltroClaseArmas, sqlActual); + Filter filtroFinal = new Filter(); + sqlFinal = sqlFinal + " and t.estadoventa is null "; + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private String obtenerFiltroBusquedaGeneral(String... sqlFiltros) { + StringBuffer sqlFinal = new StringBuffer(); + for (int i = 0; i < sqlFiltros.length; i++) { + if (sqlFinal.length() > 0 && !StringUtils.endsWith(StringUtils.trim(sqlFinal.toString()), "AND")) { + sqlFinal.append(" AND "); + } + sqlFinal.append(sqlFiltros[i]); + } + return sqlFinal.toString(); + } + + @SuppressWarnings("unchecked") + public void querydatabaseSinFiltros() { + try { + DtoQuery dto = this.getDtoQuery(); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql = " t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() throws Exception { + // TODO Auto-generated method stub + super.next(); + } + + @SuppressWarnings("unchecked") + protected void querydatabasePorCodigo() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql = " t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", "i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryTipoFab = new SubQuery("TgeneCatalogDetail", "description", "tipofabricacion", "i.pk.catalog=t.tipofabricacion and i.pk.catalogcode='TIPOFABRICACION'"); + dto.addSubQuery(subqueryTipoFab); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase = new SubQuery("TarmTipoArmaExplosivo", "clase", "cclase", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo = new SubQuery("TarmTipoArmaExplosivo", "clasecodigo", "cclasecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud = new SubQuery("TarmTipoArmaExplosivo", "longitud", "clongitud", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo = new SubQuery("TarmTipoArmaExplosivo", "longitudcodigo", "clongitudcodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre = new SubQuery("TarmTipoArmaExplosivo", "calibre", "ccalibre", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo = new SubQuery("TarmTipoArmaExplosivo", "calibrecodigo", "ccalibrecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivo", "ctipoarmaexplosivo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivocodigo", "ctipoarmaexplosivocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapeso", "cunidadmedidapeso", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadTipo = new SubQuery("TgeneCatalogDetail", "description", "unidadmedidadesc", "i.pk.catalog= (select o.unidadmedidapeso from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryUnidadTipo); + SubQuery subqueryUnidadCodigo = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapesocodigo", "cunidadmedidapesocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida = new SubQuery("TgeneCatalogDetail", "description", "unidadmedida", "i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode = new SubQuery("TarmRegistroArmas", "personcode", "personcode", "i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + SubQuery subqueryTipo = new SubQuery("TgeneCatalogDetail", "description", "tipo", "i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipo); + SubQuery subqueryTipoArmaExplosivo = new SubQuery("TgeneCatalogDetail", "description", "tipoarmaexplosivo", "i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + SubQuery subqueryClasecatalogo = new SubQuery("TgeneCatalogDetail", "description", "clase", "i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClasecatalogo); + + return dto; + } + + @SuppressWarnings("unchecked") + protected void querydatabaseSimple() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql = " t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + this.registroArmas.update(); + DtoSave dtoSaveRegistro = registroArmas.getDtoSave(); + dtoSaveRegistro.setIsForm(Boolean.TRUE); + dtoSaveRegistro.setReturnpk(Boolean.TRUE); + dtoSaveRegistro.setPosition(1); + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(Boolean.TRUE); // Para que el core devuelva el pk de los registros nuevos. + dtosave.setPosition(2); + HashMap msave = new HashMap(); + msave.put(registroArmas.getBeanalias(), dtoSaveRegistro); + msave.put(beanalias, dtosave); + + Request request = callerhelper.getRequest(); + request.put("TIPODOC", tipoDoc); + request.put("NUMDOC", numDoc); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + querydatabase(); + } + + public void saveFile() { + try { + DtoSave dtosave = super.getDtoSave(); + HashMap msave = new HashMap(); + msave.put(beanalias, dtosave); + Request request = callerhelper.getRequest(); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + querydatabase(); + } + + public void saveArmaSolicitud() { + try { + + if (!isArmaDuplicada(record)) { + + record.getModifiedData().put("edit", "S"); + + this.registroArmas.update(); + update(); + if (!existeTipoArmaExplosivo) { + return; + } + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(Boolean.TRUE); // Para que el core devuelva el pk de los registros nuevos. + dtosave.setPosition(2); + HashMap msave = new HashMap(); + DtoSave dtoSaveRegistro = registroArmas.getDtoSave(); + dtoSaveRegistro.setIsForm(Boolean.TRUE); + dtoSaveRegistro.setReturnpk(Boolean.TRUE); + dtoSaveRegistro.setPosition(1); + + Request request = callerhelper.getRequest(); + request.setTransactionModule("30"); + request.setTransactionCode(15); + request.setTransactionVersion(1); + if (!verificaArmaExplosivo) { + request.put("eseliminacion", Constant.STR_Y); + } else { + msave.put(registroArmas.getBeanalias(), dtoSaveRegistro); + } + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.put("TIPODOC", this.getMfilelds().get("tipodoc")); + request.put("NUMDOC", this.getMfilelds().get("numdoc")); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.registroArmas.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } else { + record = null; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_armaDuplicada")); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void update() throws Exception { + TgeneCatalogDetail estado = CatalogDetailController.findxCodigoCodcatalogo(record.getEstado(), record.getEstadocodigo()); + TgeneCatalogDetail marca = CatalogDetailController.findxCodigoCodcatalogo(record.getMarca(), record.getMarcacodigo()); + record.getModifiedData().put("estado", estado.getDescription()); + record.getModifiedData().put("marca", marca.getDescription()); + for (TgeneCatalogDetail color : lcolor) { + if (record.getColor() != null && record.getColor().equals(color.getPk().getCatalog())) { + record.getModifiedData().put("color", color.getDescription()); + break; + } + } + if (verificaArmaExplosivo) { + if (tipoArmaExplosivo == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionClase")); + existeTipoArmaExplosivo = Boolean.FALSE; + return; + } else { + this.record.setCtipoarmaexplosivo(tipoArmaExplosivo.getPk()); + existeTipoArmaExplosivo = Boolean.TRUE; + } + } + //valida si el estado es de perdida robo para obligar el adjuntar + if ((record.getEstado() != null && record.getEstado().equals("RPER")) + || (record.getPk() == null)) { + String xPathLocation = ""; + if (record.getEstado() != null && record.getEstado().equals("RPER")) { + xPathLocation = getRutaDocumentoSolBase("PerdidaRobo") + "/cm:" + record.getEstado() + "-" + this.record.getCodigoarma(); + } else { + xPathLocation = getRutaDocumentoSolBase("Crear") + "/cm:" + record.getEstado() + "-" + this.numDoc; + } + if (uploadedFile != null && uploadedFile.getFileName() != null) { + String extencionArchivo = getExtension(uploadedFile.getFileName()); + String nombreArchivo = record.getEstado() + "-" + (this.record.getPk() != null ? this.record.getPk() : "NUEVA") + "." + extencionArchivo; + if (alfrescoController.uploadFile(uploadedFile.getInputstream(), nombreArchivo, xPathLocation)) { + String pathRuta = xPathLocation + "/cm:" + nombreArchivo; + this.record.setPathDocumento(pathRuta); + uploadedFile = null; + } else { + MessageHelper.setMessageError("Adjunte el documento"); + return; + } + } else { + MessageHelper.setMessageError("Adjunte el documento"); + return; + } + } + + super.update(); + } + + /* + * Metodo que retorna la extencion del documento que se desea subir al alfresco + */ + public String getExtension(String filename) { + int index = filename.lastIndexOf('.'); + if (index == -1) { + return ""; + } else { + return filename.substring(index + 1); + } + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase(String carpeta) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta = new StringBuilder("cm:Registro"); + ruta = ruta.append("/cm:" + carpeta); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + ruta = ruta.append("/cm:D-").append(calendar.get(Calendar.DAY_OF_WEEK)); + return ruta.toString(); + } + + public void updateAutorizacion() throws Exception { + super.update(); + } + + /** + * Método que se ejecuta al carga edición + * + * @throws Exception + */ + public void loadEdit() throws Exception { + verificaArmaExplosivo = Boolean.TRUE; + if (record.getCountrycode() == null) { + record.setCountrycode("EC"); + } + if (record.getCtipoarmaexplosivo() == null) { + MessageHelper.setMessageError("NO ESTA ASOCIADO A UN TIPO DE ARMA EXPLOSIVO"); + return; + } + tipoArmaExplosivo = TiposArmasExplosivosController.findarma(record.getCtipoarmaexplosivo()); + lprovincias = ProvinceController.find(record.getCountrycode()); + executeProvince(); + if (record.getProvincecode() != null) { + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + executeCanton(); + } + completaInfTipoArma(); + // Anade la descripcion del tipo de arma explosivo + if (tipoArmaExplosivo != null) { + if (this.tipoArmaExplosivo.getClase().equals("0010000003") || this.tipoArmaExplosivo.getClase().equals("0010000005") || this.tipoArmaExplosivo.getClase().equals("0010000007") || this.tipoArmaExplosivo.getClase().equals("0010000006")) { + this.record.getModifiedData().put("unidadMedidaCantidad", null); + this.record.getModifiedData().put("unidadMedidaPeso", tipoArmaExplosivo.getModifiedData().get("nunidadMedidaPeso")); + } else if (this.tipoArmaExplosivo.getClase().equals("0010000001") || this.tipoArmaExplosivo.getClase().equals("0010000002") || this.tipoArmaExplosivo.getClase().equals("0010000004") || this.tipoArmaExplosivo.getClase().equals("0010000008")) { + this.record.getModifiedData().put("unidadMedidaCantidad", tipoArmaExplosivo.getModifiedData().get("nunidadMedidaPeso")); + this.record.getModifiedData().put("unidadMedidaPeso", null); + } + } + verificarClaseArma(); + if (registroArmas == null) { + System.err.println("ERROR CONTROLADOR NULO"); + return; + } + registroArmas.clearAll(); + if (record != null && record.getCregistro() != null) { + registroArmas.addFilter("pk", record.getCregistro().toString()); + } + registroArmas.query(); + List registroArmasList = registroArmas.getLrecord(); + registroArmas.setRecord(registroArmasList.get(0)); + registroArmas.getRecord().setIsnew(Boolean.FALSE); + TcustPersonDetail tcustPersonDetail = PersonDetailController.find(registroArmas.getRecord().getPersoncode().toString()); + tipoDoc = tcustPersonDetail.getIdentificationcatalog(); + numDoc = tcustPersonDetail.getIdentification(); + nombreRazon = tcustPersonDetail.getName(); + } + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en el Alfresco + */ + public void handleUpload(FileUploadEvent event) { + uploadedFile = event.getFile(); + } + + /** + * Recorta el nombre del archivo a cargarse + * + * @param nombre + * @return nombre recortado + */ + public String recorteNombre(String nombre) { + String fielname = nombre; + if (fielname.length() > 30) { + fielname = fielname.substring(0, 30) + extencionArchivo(nombre); + } + return fielname; + } + + /** + * Obtiene la extencion del archivo a cargar + * + * @param nombre + * @return + */ + private String extencionArchivo(String nombre) { + int pos = nombre.lastIndexOf('.'); + nombre = nombre.substring(pos); + return nombre; + } + + /** + * Método que completa la informaci´n del arma una vez se presiona el botón crear + */ + private void completaInfTipoArma() { + TarmArmas recordArma = findPorCodigo(record.getPk()); + record.setCountrycode("EC"); + clase = record.getModifiedData().get("clase") != null ? recordArma.getModifiedData().get("clase").toString() : null; + calibre = record.getModifiedData().get("ccalibre") != null ? Utilidades.formatearDecimalesEnTexto((recordArma.getModifiedData().get("ccalibre").toString()).replace("null", ""), "#.00") : null; + longitud = record.getModifiedData().get("clongitud") != null ? recordArma.getModifiedData().get("clongitud").toString() : null; + tipoarma = record.getModifiedData().get("ctipoarmaexplosivo") != null ? recordArma.getModifiedData().get("ctipoarmaexplosivo").toString() : null; + } + + @Override + public void create() throws Exception { + super.create(); + this.tipoDoc = null; + this.numDoc = null; + this.nombreRazon = null; + this.verificaArmaExplosivo = Boolean.TRUE; + this.registroArmas.create(); + this.registroArmas.setLrecord(new ArrayList()); + this.record.setCountrycode("EC"); +// this.record.setEstado("REG"); + this.record.setEstado("PREG"); + this.record.setEstadocodigo("ESTADOARMA"); + this.record.setMarcacodigo("MARCA"); + this.record.setGeneracertificado("NO"); + this.lprovincias = ProvinceController.find(record.getCountrycode()); + this.executeProvince(); + } + + public void update(TarmArmas bean) throws Exception { + record = bean; + updateAutorizacion(); + } + + public void validacionDocumento(String numeroDocumento, String tipoDocumento) { + if (numeroDocumento == null || tipoDocumento == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselacedula")); + return; + } + TcustPersonDetail tcustPersonDetail = null; + if (tipoDocumento.equals(codigoCedula)) { +//----------validamos si es valida la CEDULA + if (!ValidateIdentification.cedula(numeroDocumento)) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en MAIA + tcustPersonDetail = buscarPersonaMaia(numeroDocumento, tipoDocumento); + } else if (tipoDocumento.equals(codigoRuc)) { +//----------validamos si es valida el RUC + if (!ValidateIdentification.ruc(numeroDocumento)) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en maia + tcustPersonDetail = buscarPersonaMaia(numeroDocumento, tipoDocumento); + } else { +//----------si es PASAPORTE + tcustPersonDetail = buscarPersonaMaia(numeroDocumento, tipoDocumento); + } + if (tcustPersonDetail == null) { + nombreRazon = null; + numDoc = null; + MessageHelper.setMessageError("La datos de la persona ingresada no existen, por favor crear primero la persona"); + return; + } else { + nombreRazon = tcustPersonDetail.getName(); + } + } + + /** + * Método para validar si la persona existe en la BD de Maia + * + * @param numeroDocumento + * @param tipoDocumento + * @return TcustPersonDetail + */ + public TcustPersonDetail buscarPersonaMaia(String numeroDocumento, String tipoDocumento) { + return PersonDetailController.findxidentification(numeroDocumento, tipoDocumento); + } + + /** + * Busca un arma por código y estado + * + * @param armaCode código del arma + * @param estado estado del arma + * @return + */ + public static TarmArmas find(String armaCode, String estado) { + try { + + if (armaCode == null) { + return null; + } + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + if (estado != null) { + cc.addFilter("estado", estado); + cc.addFilter("estadocodigo", "ESTADOARMA"); + } + cc.querydatabaseArmas(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = new TarmTipoArmaExplosivo(); + tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if (tarmTipoArmaExplosivo != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null) { + cc.record.modifiedData().put("calibre", tarmTipoArmaExplosivo == null ? "" : Utilidades.formatearDecimalesEnTexto((CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription()), "#.000")); + } + cc.record.modifiedData().put("tipo", tarmTipoArmaExplosivo == null ? "" : CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription()); + cc.record.modifiedData().put("clase", tarmTipoArmaExplosivo == null ? "" : CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription()); + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + + cc.record.modifiedData().put("pais", cc.record.getCpaisorigen() == null || cc.record.getCpaisorigen().trim().equals("")? + "" : + CountryController.findcountry(cc.record.getCpaisorigen()).getDescription()); + + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * + * @param codigopersona + * @return + */ + public static TarmArmas findBySerieMarca(String serie, String marca) { + try { + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + if (serie != null && !serie.isEmpty()) { + cc.addFilter("lote", serie); + } + cc.addFilter("marca", marca); + cc.querydatabaseSimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * + * @param armaCode + * @return + */ + public static TarmArmas findByPK(String cArma) { + try { + + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", cArma); + cc.querydatabaseSinFiltros(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + cc.record = cc.lrecord.get(0); + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if (tarmTipoArmaExplosivo != null) { + if (tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null) { + cc.record.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription() : ""); + } + if (tarmTipoArmaExplosivo.getTipoarmaexplosivo() != null && tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo() != null) { + cc.record.modifiedData().put("tipo", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription() : ""); + } + if (tarmTipoArmaExplosivo.getClase() != null && tarmTipoArmaExplosivo.getClasecodigo() != null) { + cc.record.modifiedData().put("clase", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription() : ""); + } + + TarmRegistroArmas registroArmas = new TarmRegistroArmas(); + TcustPersonDetail detallePersona = new TcustPersonDetail(); + if (cc.record.getCregistro() != null) { + registroArmas = RegistroArmController.findByCodigo(String.valueOf(cc.record.getCregistro())); + if (registroArmas != null) { + detallePersona = PersonDetailController.find(String.valueOf(registroArmas.getPersoncode())); + } + } + cc.record.modifiedData().put("razonsPropietario", registroArmas == null || detallePersona == null ? "" : detallePersona.getName()); + cc.record.modifiedData().put("documentoPropietario", registroArmas == null || detallePersona == null ? "" : detallePersona.getIdentification()); + + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * + * @param armaCode + * @return + */ + public static TarmArmas findPorCodigo(String armaCode) { + try { + + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + //cc.addFilter("REG", "ESTADOARMA"); + cc.querydatabaseArmas(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if (tarmTipoArmaExplosivo != null) { + if (tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null) { + cc.record.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription() : ""); + } + if (tarmTipoArmaExplosivo.getTipoarmaexplosivo() != null && tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo() != null) { + cc.record.modifiedData().put("tipo", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription() : ""); + } + if (tarmTipoArmaExplosivo.getClase() != null && tarmTipoArmaExplosivo.getClasecodigo() != null) { + cc.record.modifiedData().put("clase", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription() : ""); + } + + TarmRegistroArmas registroArmas = new TarmRegistroArmas(); + TcustPersonDetail detallePersona = new TcustPersonDetail(); + if (cc.record.getCregistro() != null) { + registroArmas = RegistroArmController.findByCodigo(String.valueOf(cc.record.getCregistro())); + if (registroArmas != null) { + detallePersona = PersonDetailController.find(String.valueOf(registroArmas.getPersoncode())); + } + } + cc.record.modifiedData().put("razonsPropietario", registroArmas == null || detallePersona == null ? "" : detallePersona.getName()); + cc.record.modifiedData().put("documentoPropietario", registroArmas == null || detallePersona == null ? "" : detallePersona.getIdentification()); + cc.record.modifiedData().put("marca", (cc.record == null || cc.record.getMarca() == null || cc.record.getMarca().isEmpty() || cc.record.getMarcacodigo() == null || cc.record.getMarcacodigo().isEmpty()) ? "" : CatalogDetailController.findxCodigoCodcatalogo(cc.record.getMarca(), cc.record.getMarcacodigo()).getDescription()); + + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * + * @param armaCode + * @return + */ + public static TarmArmas findXCodigo(String armaCode) { + try { + + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + //cc.addFilter("REG", "ESTADOARMA"); + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + lcities = CityController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + } + } + + /** + * + * + * @param personCode + * @param estados estados del arma separados por coma + * @param tipoFab tipos de fabricacion del arma separados por coma + * @return Una lista de Armas encontradas + */ + public List findxPersona(Long personCode, String estados, String tipoFab, String clase, String fechaCaducidad) { + List armasLista = null; + try { + armasLista = new ArrayList(); + ArmasController armas = new ArmasController(); + armas.init(); + armas.recperpage = 4000; + armas.addField("personcode", personCode); + if (this.getMfilelds().get("sancion") != null) { + armas.addField("sancion", this.getMfilelds().get("sancion")); + } + if (this.getMfilelds().get("TRAMITE") != null) { + armas.addField("TRAMITE", this.getMfilelds().get("TRAMITE")); + } + if (estados == null) { + armas.addFilter("estado", "REG"); + } else { + armas.addField("ESTADOS", estados); + } + if (tipoFab != null && tipoFab.trim().length() > 0) { + armas.addField("TIPOFABRICACION", tipoFab); + } + if (clase != null && clase.trim().length() > 0) { + armas.addField("CLASEARMAS", clase); + } +// if(fechaCaducidad != null && fechaCaducidad .trim().length()>0){ +// armas.addField("FECHACADUCIDADARM", fechaCaducidad); +// } + armas.query(); + if (armas.getLrecord() != null && !armas.getLrecord().isEmpty()) { + armasLista.addAll(armas.getLrecord()); + } + + return armasLista; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return armasLista; + } + } + + /** + * Lista de Armas por Registro + * + */ + public static List findxRegistro(String registrocode) { + try { + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("cregistro", registrocode); + + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + for (TarmArmas item : cc.lrecord) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(item.getCtipoarmaexplosivo()); + item.modifiedData().put("clase", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription()); + if (tarmTipoArmaExplosivo.getLongitud() != null && tarmTipoArmaExplosivo.getLongitudcodigo() != null) { + item.modifiedData().put("longitud", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getLongitud(), tarmTipoArmaExplosivo.getLongitudcodigo()).getDescription()); + } + item.modifiedData().put("tipo", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription()); + if (tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null) { + item.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription()); + } + item.modifiedData().put("unidadMedidaCantidad", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getUnidadmedidapeso(), tarmTipoArmaExplosivo.getUnidadmedidapesocodigo()).getDescription()); + } + + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Abre el LOV de la clase del arma + */ + public void openLovClase() { + Map> params = new HashMap>(); + ClaseLovController.openLov(params); + } + + /** + * Regresa del LOV de armas + * + * @param event + */ + public void onReturnClase(SelectEvent event) { + TgeneCatalogDetail clase = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("clase", clase.getDescription()); + this.clase = clase.getPk().getCatalog(); + this.verificarClaseArma(); + } + + /** + * Abre el LOV de la clase del arma + */ + public void openArmaExplosivoLov() { + this.record.getModifiedData().put("longitud", null); + this.record.getModifiedData().put("tipoarmaexplosivo", null); + this.record.getModifiedData().put("calibre", null); + record.setCantidad(null); +// descripcionUnidadpeso=null; + Map> params = new HashMap<>(); + ArmaExplosivoLovController.openLov(params); + } + + /** + * Regresa del LOV de armas + * + * @param event + */ + public void onReturnArmaExplosivo(SelectEvent event) { + tipoArmaExplosivo = (TarmTipoArmaExplosivo) event.getObject(); + //Setear descripciones a presentarse + this.record.getModifiedData().put("clase", tipoArmaExplosivo.getModifiedData().get("nclase")); + this.record.getModifiedData().put("tipoarmaexplosivo", tipoArmaExplosivo.getModifiedData().get("ntipo")); + this.record.getModifiedData().put("longitud", tipoArmaExplosivo.getModifiedData().get("nlongitud")); + this.record.getModifiedData().put("calibre", tipoArmaExplosivo.getModifiedData().get("ncalibre")); + // Setear valores en las variables correspondientes + if (tipoArmaExplosivo != null) { + this.clase = tipoArmaExplosivo.getClase(); + this.longitud = tipoArmaExplosivo.getLongitud(); + this.tipoarma = tipoArmaExplosivo.getTipoarmaexplosivo(); + this.calibre = tipoArmaExplosivo.getCalibre(); + this.record.setUnidadmedidacantidad(tipoArmaExplosivo.getUnidadmedidapeso()); + if (tipoArmaExplosivo.getModifiedData().get("desunidad") != null) { + if (this.clase.equals("0010000003") || this.clase.equals("0010000005") || this.clase.equals("0010000007") || this.clase.equals("0010000006")) { + this.record.getModifiedData().put("unidadMedidaCantidad", null); + this.record.getModifiedData().put("unidadMedidaPeso", tipoArmaExplosivo.getModifiedData().get("desunidad")); + } else if (this.clase.equals("0010000001") || this.clase.equals("0010000002") || this.clase.equals("0010000004") || this.clase.equals("0010000008")) { + this.record.getModifiedData().put("unidadMedidaCantidad", tipoArmaExplosivo.getModifiedData().get("desunidad")); + this.record.getModifiedData().put("unidadMedidaPeso", null); + } + } + } + this.verificarClaseArma(); + if (this.clase.equals("0010000001") || this.clase.equals("0010000008")) { + record.setCantidad(1);//si es arma de fuego por default sea uno y no deje editar + this.bloquearUnidadCantidad = Boolean.TRUE; + } +// else{ +// record.setCantidad(null); +// } + } + + /** + * Método en el cual se determina si se bloquea unidad o cantidad al momento de cargar los datos del arma + * + * @param clase + */ + private void verificarClaseArma() { + if (this.clase == null) { + this.bloquearUnidadPeso = Boolean.TRUE; + this.bloquearUnidadCantidad = Boolean.TRUE; + return; + } + + if (this.clase.equals("0010000003") || this.clase.equals("0010000005") || this.clase.equals("0010000007") || this.clase.equals("0010000006")) { + this.bloquearUnidadPeso = Boolean.FALSE; + } else { + this.bloquearUnidadPeso = Boolean.TRUE; + } + if (this.clase.equals("0010000001") || this.clase.equals("0010000002") || this.clase.equals("0010000004")) { + this.bloquearUnidadCantidad = Boolean.FALSE; + } else { + this.bloquearUnidadCantidad = Boolean.TRUE; + } + } + + /** + * Abre el LOV de la longitud del arma + */ + public void openLovLongitud() { + Map> params = new HashMap>(); + LongitudLovController.openLov(params); + } + + /** + * Regresa del LOV de longitud + * + * @param event + */ + public void onReturnLongitud(SelectEvent event) { + TgeneCatalogDetail longitud = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("longitud", longitud.getDescription()); + this.longitud = longitud.getPk().getCatalog(); + } + + /** + * Abre el LOV del tipo de arma + */ + public void openLovTipoArma() { + Map> params = new HashMap>(); + TipoArmaExpLovController.openLov(params); + } + + /** + * Regresa del LOV de tipo de arma + * + * @param event + */ + public void onReturnTipoArma(SelectEvent event) { + TgeneCatalogDetail tipoArma = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("tipoarmaexplosivo", tipoArma.getDescription()); + this.tipoarma = tipoArma.getPk().getCatalog(); + } + + /** + * Abre el LOV de Calibre + */ + public void openLovCalibre() { + Map> params = new HashMap>(); + CalibreLovController.openLov(params); + } + + /** + * Regresa del LOV del calibre + * + * @param event + */ + public void onReturnCalibre(SelectEvent event) { + TgeneCatalogDetail calibre = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("calibre", calibre.getDescription()); + this.calibre = calibre.getPk().getCatalog(); + } + + /** + * Abre el LOV cambio de usuario + */ + public void openLovCambioUsuario() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Acción de retorno de la selección del usuario + * + * @param event de retorno de la selección + */ + public void onReturnCambioUsuario(SelectEvent event) { + nuevoPropietarioArma = (TcustPersonDetail) event.getObject(); + } + + /** + * Abre el dialog del cambio de persona + */ + public void abrirDialogCambio() { + this.nuevoPropietarioArma = null; + } + + /** + * Se cambia el propietario del arma + */ + public void cambiarArmaUsuario() { + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.setTransactionModule("30"); + request.setTransactionCode(151); + request.setTransactionVersion(1); + request.put("ARMAACTUAL", this.record); + request.put("NUEVAPERSONA", this.nuevoPropietarioArma); + Response response = callerHelper.executeSave(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(response); + this.querydatabase(); + } else { + MessageHelper.setMessageError(response); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Para modificar el tipo y bloquear + * + * @param event + * @param codigo + */ + public void seleccionaTipo(AjaxBehaviorEvent event) { + Boolean check = Boolean.valueOf(event.getComponent().getAttributes().get("value") != null + ? event.getComponent().getAttributes().get("value").toString() : "false"); + + if (this.tarmTramite.getPk() == 233 || this.tarmTramite.getPk() == 227 || this.tarmTramite.getPk() == 147 || this.tarmTramite.getPk() == 67) { + + TarmArmas selec = (TarmArmas) event.getComponent().getAttributes().get("fila"); + TarmTipoArmaExplosivo tipo = TiposArmasExplosivosController.findarma(selec.getCtipoarmaexplosivo()); + this.tipoSeleccionado = tipo.getClase(); + + if (this.seleccionados == 0 && check) { + for (TarmArmas fila : lrecord) { + tipo = TiposArmasExplosivosController.findarma(fila.getCtipoarmaexplosivo()); + fila.getModifiedData().put("enable", !this.tipoSeleccionado.equals(tipo.getClase())); + } + } + this.seleccionados = check? this.seleccionados + 1 : this.seleccionados - 1; + + if (this.seleccionados == 0 && !check) { + this.tipoSeleccionado = null; + for (TarmArmas fila : lrecord) { + fila.getModifiedData().put("enable", Boolean.FALSE); + } + } + super.getMfilelds().put("enable", this.seleccionados > 0); + } + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.valueOf(event.getComponent().getAttributes().get("value") != null + ? event.getComponent().getAttributes().get("value").toString() : "false"); + TarmTipoArmaExplosivo tipo = TiposArmasExplosivosController.findarma(tipoSeleccionado); + + for (TarmArmas guardias : lrecord) { + tipo = TiposArmasExplosivosController.findarma(guardias.getCtipoarmaexplosivo()); + if (this.tarmTramite.getPk().equals(233) || this.tarmTramite.getPk().equals(227) + || this.tarmTramite.getPk().equals(147) || this.tarmTramite.getPk().equals(67)) { + if (tipoSeleccionado.equals(tipo.getClase())) { + guardias.getModifiedData().put("seleccionado", valorColocar); + } + } else { + guardias.getModifiedData().put("seleccionado", valorColocar); + } + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para obtener el listado de las armas por la serie/lote + * + * @param serieLote + * @return + */ + public static List findxSerieLote(String serieLote) { + try { + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 1000; + cc.addFilter("lote", serieLote); + cc.querydatabaseFechaMax(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para obtener el listado de las armas por la lote + * + * @param serieLote + * @return + */ + public static List findPorLote(String lote) { + try { + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 10000; + cc.addFilter("lote", lote); + cc.querydatabaseArmas(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para obtener los codigos + */ + private static String codigos(String parametro) { + TgeneParameters tgeneParameters = ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + @SuppressWarnings("unchecked") + protected void querydatabaseFechaMax() { + try { + DtoQuery dto = this.getDtoQuery(); + dto.setOrderby("pk"); + String codigoEstadoIncautada = codigos("CODIGO.INCAUTADA"); + String codigoEstadoDecomisada = codigos("CODIGO.DECOMISADA"); + String codigoEstadoVendida = codigos("CODIGO.VENDIDA"); + String codigoEstadoMatPrima = codigos("CODIGO.MATERIAPRIMA"); + Filter filtro = new Filter(); + String sql = "t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro)"//and t.cregistro=ta.cregistro para el manejo de los explosivos + + " and t.estado !='DEST' and t.estado !='CDP' and t.estado !='" + codigoEstadoIncautada + "' and t.estado !='" + codigoEstadoDecomisada + "' and t.estado !='" + codigoEstadoVendida + "' and t.estado !='" + codigoEstadoMatPrima + "' "; + filtro.setSql(sql); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void actualizar(TarmArmas arma) throws Exception { + record = arma; + super.update(); + } + + /*Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findxCodigo(String armaCode) { + try { + + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + cc.querydatabaseArmas(); + cc.getRecord().getModifiedData().put("lmarca", cc.getLmarca()); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * @param lote + * @return + */ + public static List findxLotePerdidaRobo(String lote) { + List armasLista = null; + try { + armasLista = new ArrayList(); + ArmasController armas = new ArmasController(); + armas.init(); + armas.recperpage = 4000; + armas.addFilter("lote", lote);//("personcode", personCode); + armas.querydatabaseArmaVenta(" and t.pathDocumento like '%/cm:PerdidaRobo/%'"); + if (armas.getLrecord() != null && !armas.getLrecord().isEmpty()) { + armasLista.addAll(armas.getLrecord()); + } + return armasLista; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return armasLista; + } + } + + /** + * @param lote + * @return + */ + public static List findxLoteRegistro(String lote) { + List armasLista = null; + try { + armasLista = new ArrayList(); + ArmasController armas = new ArmasController(); + armas.init(); + armas.recperpage = 4000; + armas.addFilter("lote", lote);//("personcode", personCode); + armas.querydatabaseArmaVenta(" and t.pathDocumento like '%/cm:Crear/%'"); + if (armas.getLrecord() != null && !armas.getLrecord().isEmpty()) { + armasLista.addAll(armas.getLrecord()); + } + return armasLista; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return armasLista; + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaseArmaVenta(String crear) { + try { + DtoQuery dto = this.getDtoQuery(); + dto.setOrderby("pk"); + String sqlFinal = " t.pathDocumento is not null " + crear; + Filter filtroFinal = new Filter(); + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void generarReporte(TarmArmas arma) { + String path = "armas/reports/certificadoArmaCrear"; + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + try { + // Usuario logueado en la aplicacion + String nombreUsuario; + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + } else { + nombreUsuario = ""; + } + parameters.put("filtro", arma.getPk()); + parameters.put("usuario", nombreUsuario); + //Fecha actual + Calendar fechaActualCldr = Calendar.getInstance(); + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH) + 1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarfecha", fechaActualSB.toString()); + + String format = "pdf"; + String filename = "certificadoArma"; + + InputStream inputStream = this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + + String nombreArchivo = (filename != null && !filename.isEmpty()) ? filename + "." + format : null; + String xPathLocation = getRutaDocumentoSolBase() + "/cm:" + arma.getEstado() + "/cm:CP-" + arma.getModifiedData().get("personcode") + "/cm:CA-" + arma.getCodigoarma(); + if (nombreArchivo != null && xPathLocation != null && inputStream != null) { + setRecord(arma); + if (alfrescoController.uploadFile(inputStream, nombreArchivo, xPathLocation)) { + record.setPathDocumentocrear(xPathLocation + "/cm:" + nombreArchivo); + record.setGeneracertificado("SI"); + super.update(); + saveFile(); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_subiroarchivoregistrorecibo").concat("(" + nombreArchivo + ")")); + + } + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase() { + Calendar calendar = Calendar.getInstance(); + StringBuilder ruta = new StringBuilder("cm:Armas/cm:Crear"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + ruta = ruta.append("/cm:D-").append(calendar.get(Calendar.DAY_OF_MONTH)); + return ruta.toString(); + } + + public TiposArmasExplosivosController getTiposArmasExplosivosController() { + return tiposArmasExplosivosController; + } + + public void setTiposArmasExplosivosController( + TiposArmasExplosivosController tiposArmasExplosivosController) { + this.tiposArmasExplosivosController = tiposArmasExplosivosController; + } + + public RegistroArmController getRegistroArmas() { + return registroArmas; + } + + public void setRegistroArmas(RegistroArmController registroArmas) { + this.registroArmas = registroArmas; + } + + public List getLtipoidentificacion() { + return ltipoidentificacion; + } + + public void setLtipoidentificacion(List ltipoidentificacion) { + this.ltipoidentificacion = ltipoidentificacion; + } + + public String getTipoDoc() { + return tipoDoc; + } + + public void setTipoDoc(String tipoDoc) { + this.tipoDoc = tipoDoc; + } + + public String getNumDoc() { + return numDoc; + } + + public void setNumDoc(String numDoc) { + this.numDoc = numDoc; + } + + public String getNombreRazon() { + return nombreRazon; + } + + public void setNombreRazon(String nombreRazon) { + this.nombreRazon = nombreRazon; + } + + public List getLestadoarma() { + return lestadoarma; + } + + public void setLestadoarma(List lestadoarma) { + this.lestadoarma = lestadoarma; + } + + public List getLmarca() { + return lmarca; + } + + public void setLmarca(List lmarca) { + this.lmarca = lmarca; + } + + public List getLcolor() { + return lcolor; + } + + public void setLcolor(List lcolor) { + this.lcolor = lcolor; + } + + public List getLtipofabricacion() { + return ltipofabricacion; + } + + public void setLtipofabricacion(List ltipofabricacion) { + this.ltipofabricacion = ltipofabricacion; + } + + public List getLcountry() { + return lcountry; + } + + public void setLcountry(List lcountry) { + this.lcountry = lcountry; + } + + public List getLunidadmedidacantidad() { + return lunidadmedidacantidad; + } + + public void setLunidadmedidacantidad( + List lunidadmedidacantidad) { + this.lunidadmedidacantidad = lunidadmedidacantidad; + } + + public String getLongitud() { + return longitud; + } + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + public String getCalibre() { + return calibre; + } + + public void setCalibre(String calibre) { + this.calibre = calibre; + } + + public String getClase() { + return clase; + } + + public void setClase(String clase) { + this.clase = clase; + } + + public String getTipoarma() { + return tipoarma; + } + + public void setTipoarma(String tipoarma) { + this.tipoarma = tipoarma; + } + + public String getUnidadmedidapeso() { + return unidadmedidapeso; + } + + public void setUnidadmedidapeso(String unidadmedidapeso) { + this.unidadmedidapeso = unidadmedidapeso; + } + + public List getLunidadmedidapeso() { + return lunidadmedidapeso; + } + + public void setLunidadmedidapeso(List lunidadmedidapeso) { + this.lunidadmedidapeso = lunidadmedidapeso; + } + + public List getLprovincias() { + return lprovincias; + } + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public List getLparroquias() { + return lparroquias; + } + + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + public List getLcities() { + return lcities; + } + + public void setLcities(List lcities) { + this.lcities = lcities; + } + + public boolean isExisteTipoArmaExplosivo() { + return existeTipoArmaExplosivo; + } + + public void setExisteTipoArmaExplosivo(boolean existeTipoArmaExplosivo) { + this.existeTipoArmaExplosivo = existeTipoArmaExplosivo; + } + + public boolean isVerificaArmaExplosivo() { + return verificaArmaExplosivo; + } + + public void setVerificaArmaExplosivo(boolean verificaArmaExplosivo) { + this.verificaArmaExplosivo = verificaArmaExplosivo; + } + + public boolean isBloquearUnidadCantidad() { + return bloquearUnidadCantidad; + } + + public void setBloquearUnidadCantidad(boolean bloquearUnidadCantidad) { + this.bloquearUnidadCantidad = bloquearUnidadCantidad; + } + + public boolean isBloquearUnidadPeso() { + return bloquearUnidadPeso; + } + + public void setBloquearUnidadPeso(boolean bloquearUnidadPeso) { + this.bloquearUnidadPeso = bloquearUnidadPeso; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public TarmTipoArmaExplosivo getTipoArmaExplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoArmaExplosivo(TarmTipoArmaExplosivo tipoArmaExplosivo) { + this.tipoArmaExplosivo = tipoArmaExplosivo; + } + + public String getRazonSocial() { + return razonSocial; + } + + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public String getFiltroPersona() { + return filtroPersona; + } + + public void setFiltroPersona(String filtroPersona) { + this.filtroPersona = filtroPersona; + } + + protected void querydatabaseArmas() { + try { + DtoQuery dto = this.getDtoQuery(); + + dto.setOrderby("pk"); + if (this.getMfilelds().get("ESTADOS") != null) { + Filter filtroEstados = new Filter(); + String[] estados = this.getMfilelds().get("ESTADOS").toString().split(","); + StringBuffer sqlEstados = new StringBuffer(" t.estado IN ("); + for (int i = 0; i < estados.length; i++) { + sqlEstados.append("'").append(estados[i]).append("'"); + if (i < estados.length - 1) { + sqlEstados.append(","); + } + } + sqlEstados.append(")"); + filtroEstados.setSql(sqlEstados.toString()); + dto.addFiltro(filtroEstados); + } else { + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql = " t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + } + + if (this.getMfilelds().get("ESTADOS") != null) { + Filter filtroEstados = new Filter(); + String[] estados = this.getMfilelds().get("ESTADOS").toString().split(","); + StringBuffer sqlEstados = new StringBuffer(" t.estado IN ("); + for (int i = 0; i < estados.length; i++) { + sqlEstados.append("'").append(estados[i]).append("'"); + if (i < estados.length - 1) { + sqlEstados.append(","); + } + } + sqlEstados.append(")"); + filtroEstados.setSql(sqlEstados.toString()); + dto.addFiltro(filtroEstados); + } + + if (this.getMfilelds().get("TIPOFABRICACION") != null) { + Filter filtroTipoFab = new Filter(); + String[] tipoFab = this.getMfilelds().get("TIPOFABRICACION").toString().split(","); + StringBuffer sqlTipoFab = new StringBuffer(" t.tipofabricacion IN ("); + for (int i = 0; i < tipoFab.length; i++) { + sqlTipoFab.append("'").append(tipoFab[i]).append("'"); + if (i < tipoFab.length - 1) { + sqlTipoFab.append(","); + } + } + sqlTipoFab.append(")"); + filtroTipoFab.setSql(sqlTipoFab.toString()); + dto.addFiltro(filtroTipoFab); + } + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public TcustPersonDetail getNuevoPropietarioArma() { + return nuevoPropietarioArma; + } + + public void setNuevoPropietarioArma(TcustPersonDetail nuevoPropietarioArma) { + this.nuevoPropietarioArma = nuevoPropietarioArma; + } + + /** + * Busca un arma por código + * + * @param armaCode + * @return + */ + public static TarmArmas findXCodigoArma(String armaCode) { + try { + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("codigoarma", armaCode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public List findArmaRecep(String csolicitud) { + try { + ArmasController cc = new ArmasController(); + cc.init(); + cc.querydatabaserecep(csolicitud); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public void querydatabaserecep(String csolicitud) { + try { + DtoQuery dto = this.getDtoQuery(); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.put("csolicitud", csolicitud); + //QueryRule ArmasRecepcionQuery + request.put("queryalias", "ARMASRECEPLIST"); + + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void querydatabasesimple() { + try { + DtoQuery dto = this.getDtoQuery(); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void querydatabaseArmaDuplicada(TarmArmas armaObj) { + try { + DtoQuery dto = this.getDtoQuery(); + + Filter filtro = new Filter(); + filtro.setSql("t.marca='" + armaObj.getMarca() + "' and t.marcacodigo='" + armaObj.getMarcacodigo() + "' and upper(t.lote)='" + armaObj.getLote().toUpperCase() + "'"); + dto.addFiltro(filtro); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static TarmArmas findSimple(String carma) { + try { + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", carma); + cc.querydatabasesimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static Boolean isArmaDuplicada(TarmArmas armaObj) { + Boolean isDuplicada = Boolean.FALSE; + ArmasController cc; + try { + cc = new ArmasController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabaseArmaDuplicada(armaObj); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + for (TarmArmas armaTmp : cc.lrecord) { + TarmTipoArmaExplosivo tipoArmaExpTmp = TiposArmasExplosivosController.findarma(armaTmp.getCtipoarmaexplosivo()); + TgeneCatalogDetail claseTmp = CatalogDetailController.findCatalogo(tipoArmaExpTmp.getClasecodigo(), tipoArmaExpTmp.getClase()); + TgeneCatalogDetail tipoArmaTmp = CatalogDetailController.findCatalogo(tipoArmaExpTmp.getTipoarmaexplosivocodigo(), tipoArmaExpTmp.getTipoarmaexplosivo()); + TgeneCatalogDetail calibreTmp = CatalogDetailController.findCatalogo(tipoArmaExpTmp.getCalibrecodigo(), tipoArmaExpTmp.getCalibre()); + // Valido la clase, tipoarma y calibre solo para armas de fuego y armas no letales + if (claseTmp.getPk().getCatalog().equals("0010000001") || claseTmp.getPk().getCatalog().equals("0010000008")) { + if (armaObj.getModifiedData().get("clase") != null && armaObj.getModifiedData().get("tipoarmaexplosivo") != null) { + if (armaObj.getModifiedData().get("clase").toString().equalsIgnoreCase(claseTmp != null ? claseTmp.getDescription() : "") + && armaObj.getModifiedData().get("tipoarmaexplosivo").toString().equalsIgnoreCase(tipoArmaTmp != null ? tipoArmaTmp.getDescription() : "")) { + if (armaObj.getModifiedData().get("calibre") != null && calibreTmp != null && armaObj.getModifiedData().get("calibre").toString().equalsIgnoreCase(calibreTmp.getDescription())) { + isDuplicada = Boolean.TRUE; + break; + } + } + } else { + MessageHelper.setMessageError("CLASE Y/O TIPO DE ARMA EXPLOSIVO INCORRECTOS"); + } + } + } + + } + return isDuplicada; + } catch (Exception e) { + // TODO Auto-generated catch block + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmArmas find(String carma) { + try { + + ArmasController cc = new ArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", carma); + cc.querydatabasesimple(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if (tarmTipoArmaExplosivo != null) { + if (tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null) { + cc.record.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription() : ""); + } + if (tarmTipoArmaExplosivo.getTipoarmaexplosivo() != null && tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo() != null) { + cc.record.modifiedData().put("tipo", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription() : ""); + } + if (tarmTipoArmaExplosivo.getClase() != null && tarmTipoArmaExplosivo.getClasecodigo() != null) { + cc.record.modifiedData().put("clase", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription() : ""); + } + TarmRegistroArmas registroArmas = new TarmRegistroArmas(); + TcustPersonDetail detallePersona = new TcustPersonDetail(); + if (cc.record.getCregistro() != null) { + registroArmas = RegistroArmController.findByCodigo(String.valueOf(cc.record.getCregistro())); + if (registroArmas != null) { + detallePersona = PersonDetailController.find(String.valueOf(registroArmas.getPersoncode())); + } + } + cc.record.modifiedData().put("razonsPropietario", registroArmas == null || detallePersona == null ? "" : detallePersona.getName()); + cc.record.modifiedData().put("documentoPropietario", registroArmas == null || detallePersona == null ? "" : detallePersona.getIdentification()); + cc.record.modifiedData().put("marca", (cc.record == null || cc.record.getMarca() == null || cc.record.getMarca().isEmpty() || cc.record.getMarcacodigo() == null || cc.record.getMarcacodigo().isEmpty()) ? "" : CatalogDetailController.findxCodigoCodcatalogo(cc.record.getMarca(), cc.record.getMarcacodigo()).getDescription()); + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Abre el lov de persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Maneja la respuesta del Lov de Personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + System.err.println("ON PERSON " + event.getObject()); + TcustPersonDetail personaDetailSelecionada = (TcustPersonDetail) event.getObject(); + razonSocial = personaDetailSelecionada.getName(); + numeroDocumento = personaDetailSelecionada.getIdentification(); + filtroPersona = " and t.cregistro in (select i.pk from TarmRegistroArmas i where i.personcode =" + + personaDetailSelecionada.getPk().getPersoncode() + ")"; + + querydatabase(); + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TarmTramite getTarmTramite() { + return tarmTramite; + } + + public void setTarmTramite(TarmTramite tarmTramite) { + this.tarmTramite = tarmTramite; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ArticuloRegistradoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ArticuloRegistradoController.java new file mode 100644 index 0000000..ad69ce3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ArticuloRegistradoController.java @@ -0,0 +1,521 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Controlador principal de la funcionalidad de armas Registradas + * + * @author H.Y Sinfo + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ArticuloRegistradoController extends AbstractController { + + /** + * Tipo documento + */ + private String tipoDoc; + + /** + * Número documento + */ + private String numDoc; + + /** + * Nombre/razón social + */ + private String nombreRazon; + + /** + * Longitud arma + */ + private String longitud; + /** + * Calibre arma + */ + private String calibre; + /** + * Clase arma + */ + private String clase; + /** + * Tipo de arma + */ + private String tipoarma; + /** + * unidad medida peso + */ + private String unidadmedidapeso; + + /** + * Bandera que indica que en realidad existe luego del ingreso de datos un + * tipo de arma explosivo válido + */ + private boolean existeTipoArmaExplosivo; + + /** + * Bandera que escifica que se deba verificar que exista un arma explosivo + * válida + */ + private boolean verificaArmaExplosivo = Boolean.TRUE; + + /** + * Bloquea la unidad de cantidad + */ + private boolean bloquearUnidadCantidad = Boolean.TRUE; + + /** + * Bloquea la unidad de peso + */ + private boolean bloquearUnidadPeso = Boolean.TRUE; + + private Date fechaActual; + + private String razonSocial; + + private String numeroDocumento; + + private String filtroPersona; + + private String descategoria; + private String usoActividad; + + /** + * Usuario actual logueado en el sistema + * + */ + private TsafeUserDetail userDetail; + + public ArticuloRegistradoController() throws Exception { + super(TarmArmas.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + fechaActual = new Date(); + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "ARMAS"; + filtroPersona = " and t.cregistro in (select i.pk from TarmRegistroArmas i where i.personcode =" + + userDetail.getPk().getPersoncode() + ")"; + if (userDetail.getPk().getPersoncode() != null) { + razonSocial = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + numeroDocumento = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getIdentification(); + } else { + razonSocial = ""; + numeroDocumento = ""; + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + protected void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + dto.setOrderby("pk"); + Filter filtro = new Filter(); + String sql = "t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma) and t.estado !='DEST' and t.estado!='VEND' and t.estado!='MING' and t.estado!='DUPL' and t.estado!='CUSTEM' and t.estado !='CDP'" + + " and (t.peso>0 or t.cantidad>0) " + filtroPersona;// + filtro.setSql(sql); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + for (TarmArmas armasObj : lrecord) { + TarmRegistroArmas registroArmasObj = RegistroArmController + .findByCodigo(armasObj.getCregistro().toString()); + if (registroArmasObj != null && registroArmasObj.getPersoncode() != null) { + TcustPersonDetail propietarioObj = PersonDetailController + .find(registroArmasObj.getPersoncode().toString()); + if (propietarioObj.getIdentificationcatalog() != null + && propietarioObj.getIdentificationcatalogcode() != null) { + armasObj.getModifiedData() + .put("tipoDocumento", + CatalogDetailController + .findxCodigoCodcatalogo(propietarioObj.getIdentificationcatalog(), + propietarioObj.getIdentificationcatalogcode()) + .getDescription()); + } + armasObj.getModifiedData().put("noDocumento", propietarioObj.getIdentification()); + armasObj.getModifiedData().put("nombrerazonsocial", propietarioObj.getName()); + armasObj.getModifiedData().put("paisorigencode", registroArmasObj.getPaisorigen()); + if (armasObj.getModifiedData().get("cclase") != null) { + armasObj.getModifiedData().put("clase", + CatalogDetailController + .findxCodigoCodcatalogo(armasObj.getModifiedData().get("cclase").toString(), + armasObj.getModifiedData().get("cclasecodigo").toString()) + .getDescription()); + } + if (armasObj.getModifiedData().get("ctipoarmaexplosivo") != null) { + armasObj.getModifiedData().put("tipoarmaexplosivo", + CatalogDetailController.findxCodigoCodcatalogo( + armasObj.getModifiedData().get("ctipoarmaexplosivo").toString(), + armasObj.getModifiedData().get("ctipoarmaexplosivocodigo").toString()) + .getDescription()); + } + if (armasObj.getModifiedData().get("ccalibre") != null) { + armasObj.getModifiedData().put("calibre", CatalogDetailController + .findxCodigoCodcatalogo(armasObj.getModifiedData().get("ccalibre").toString(), + armasObj.getModifiedData().get("ccalibrecodigo").toString()) + .getDescription()); + } + + } + } + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() throws Exception { + // TODO Auto-generated method stub + super.next(); + } + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", + "i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", + "i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", + "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase = new SubQuery("TarmTipoArmaExplosivo", "clase", "cclase", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo = new SubQuery("TarmTipoArmaExplosivo", "clasecodigo", "cclasecodigo", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud = new SubQuery("TarmTipoArmaExplosivo", "longitud", "clongitud", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo = new SubQuery("TarmTipoArmaExplosivo", "longitudcodigo", "clongitudcodigo", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre = new SubQuery("TarmTipoArmaExplosivo", "calibre", "ccalibre", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo = new SubQuery("TarmTipoArmaExplosivo", "calibrecodigo", "ccalibrecodigo", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivo", "ctipoarmaexplosivo", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivocodigo", + "ctipoarmaexplosivocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapeso", "cunidadmedidapeso", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapesocodigo", + "cunidadmedidapesocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida = new SubQuery("TgeneCatalogDetail", "description", "unidadmedida", + "i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode = new SubQuery("TarmRegistroArmas", "personcode", "personcode", + "i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + + SubQuery subqueryFechaemiperm = new SubQuery("TarmDocumentoHabilitante", "fechaemision", "fechaemision", + // " i.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = + // t.cregistro) and i.carma = t.pk and "+ + " i.pk=(select max(doc.pk) from TarmDocumentoHabilitante doc where doc.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro)" + + " and doc.carma in (select arm1.pk from TarmArmas arm1 where arm1.codigoarma in (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))"); + dto.addSubQuery(subqueryFechaemiperm); + SubQuery subqueryFechaexpperm = new SubQuery("TarmDocumentoHabilitante", "fechaexpiracion", "fechaexpiracion", + // " i.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = + // t.cregistro) and i.carma = t.pk and "+ + " i.pk=(select max(doc.pk) from TarmDocumentoHabilitante doc where doc.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) " + + "and doc.carma in (select arm1.pk from TarmArmas arm1 where arm1.codigoarma in (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))"); + dto.addSubQuery(subqueryFechaexpperm); + + return dto; + } + + /** + * Método que se ejecuta al abrir el LOV de visualizar item + * seleccionado + * + * @throws Exception + */ + public void loadEdit() throws Exception { + verificaArmaExplosivo = Boolean.TRUE; + record.getModifiedData().put("provincia", + ProvinceController.getDescProvByCodigo(record.getCountrycode(), record.getProvincecode())); + record.getModifiedData().put("canton", CantonController.getDescCantonByCodigo(record.getCountrycode(), + record.getProvincecode(), record.getCantoncode())); + record.getModifiedData().put("ciudad", CityController.getDescCiudadByCodigo(record.getCountrycode(), + record.getProvincecode(), record.getCantoncode(), record.getCitycode())); + record.getModifiedData().put("parroquia", ParroquiaController.getDescParroquiaByCodigo(record.getCountrycode(), + record.getProvincecode(), record.getCantoncode(), record.getParroquiacode())); + if (record.getModifiedData().get("paisorigencode") != null) { + record.getModifiedData().put("paisorigen", CountryController + .findcountry(record.getModifiedData().get("paisorigencode").toString()).getDescription()); + } + if (record.getColor() != null) { + record.getModifiedData().put("colorD", CatalogDetailController + .findxCodigoCodcatalogo(record.getColor(), record.getColorcodigo()).getDescription()); + } + /* Aumentado */ + TarmDocumentoHabilitante documento = DocumentoHabilitanteController + .findxarma(record.getCodigoarma().toString()); + + TarmTramite tramite = TarmTramiteController.find(documento.getCtramite().toString()); + TgeneCatalogDetail catalogo = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), + tramite.getCategoriacodigo()); + descategoria = catalogo.getDescription(); + TgeneCatalogDetail uso = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), + tramite.getUsoactividadcodigo()); + usoActividad = uso.getDescription(); + } + + @Override + public void save() { + + } + + public String getTipoDoc() { + return tipoDoc; + } + + public void setTipoDoc(String tipoDoc) { + this.tipoDoc = tipoDoc; + } + + public String getNumDoc() { + return numDoc; + } + + public void setNumDoc(String numDoc) { + this.numDoc = numDoc; + } + + public String getNombreRazon() { + return nombreRazon; + } + + public void setNombreRazon(String nombreRazon) { + this.nombreRazon = nombreRazon; + } + + public String getLongitud() { + return longitud; + } + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + public String getCalibre() { + return calibre; + } + + public void setCalibre(String calibre) { + this.calibre = calibre; + } + + public String getClase() { + return clase; + } + + public void setClase(String clase) { + this.clase = clase; + } + + public String getTipoarma() { + return tipoarma; + } + + public void setTipoarma(String tipoarma) { + this.tipoarma = tipoarma; + } + + public String getUnidadmedidapeso() { + return unidadmedidapeso; + } + + public void setUnidadmedidapeso(String unidadmedidapeso) { + this.unidadmedidapeso = unidadmedidapeso; + } + + public boolean isExisteTipoArmaExplosivo() { + return existeTipoArmaExplosivo; + } + + public void setExisteTipoArmaExplosivo(boolean existeTipoArmaExplosivo) { + this.existeTipoArmaExplosivo = existeTipoArmaExplosivo; + } + + public boolean isVerificaArmaExplosivo() { + return verificaArmaExplosivo; + } + + public void setVerificaArmaExplosivo(boolean verificaArmaExplosivo) { + this.verificaArmaExplosivo = verificaArmaExplosivo; + } + + public boolean isBloquearUnidadCantidad() { + return bloquearUnidadCantidad; + } + + public void setBloquearUnidadCantidad(boolean bloquearUnidadCantidad) { + this.bloquearUnidadCantidad = bloquearUnidadCantidad; + } + + public boolean isBloquearUnidadPeso() { + return bloquearUnidadPeso; + } + + public void setBloquearUnidadPeso(boolean bloquearUnidadPeso) { + this.bloquearUnidadPeso = bloquearUnidadPeso; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public String getRazonSocial() { + return razonSocial; + } + + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public String getDescategoria() { + return descategoria; + } + + public void setDescategoria(String descategoria) { + this.descategoria = descategoria; + } + + public String getUsoActividad() { + return usoActividad; + } + + public void setUsoActividad(String usoActividad) { + this.usoActividad = usoActividad; + } + + /** + * Metodo que genera el reporte para el registro seleccionado + * + * @param event + * @throws Exception + */ + public void imprimir() { + System.out.println("Imprimir un reporte en PDF.. Pendiente implementar"); + } + + public String retornaDatosArma(String codArma, int opc) { + String resp = ""; + try { + if (codArma != null) { + TarmDocumentoHabilitante documento = DocumentoHabilitanteController.findxarma(codArma); + if (documento.getCtramite() != null) { + TarmTramite tramite = TarmTramiteController.find(documento.getCtramite().toString()); + if (opc == 1) { + TgeneCatalogDetail catalogo = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), + tramite.getCategoriacodigo()); + resp = catalogo.getDescription(); + } + if (opc == 2) { + TgeneCatalogDetail uso = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), + tramite.getUsoactividadcodigo()); + resp = uso.getDescription(); + + } + } + + } + + } catch (Exception e) { + resp = ""; + MessageHelper.setMessageError(e); + } + return resp; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/AutorizacionDevolucionController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/AutorizacionDevolucionController.java new file mode 100644 index 0000000..c8b1c14 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/AutorizacionDevolucionController.java @@ -0,0 +1,522 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.general.mail.EnvioMail; +import com.fp.general.mail.dto.EnvioCorreoDTO; +import com.fp.general.mail.exception.EnvioMailException; +import com.fp.general.mail.factory.EnvioMailFactory; +/* +import com.fp.general.mail.EnvioMail; +import com.fp.general.mail.dto.EnvioCorreoDTO; +import com.fp.general.mail.exception.EnvioMailException; +import com.fp.general.mail.factory.EnvioMailFactory; + */ +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class AutorizacionDevolucionController extends AbstractController { + + TarmSolicitudTramite solicitudTramite; + Boolean actualizada = false; + /** + * + */ + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{tarmSolicitudArmasController}") + private TarmSolicitudArmasController tarmSolicitudArmasController; + + @ManagedProperty(value = "#{armasController}") + private ArmasController armasController; + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddressController; + + TgeneProvince provincia; + TgeneCanton canton; + TgeneCity ciudad; + TgeneParroquia parroquia; + String direccion; + + TcustPersonDetail detallesPersona; + TcustPersonDetail usuario; + TarmCentroControl centroControl; + TcustPersonAddress direccionPersona; + String nombreInstitucion; + private Boolean btnEnviar; + /** + * Atributo que se recupera del flujo + */ + private String csolicitud; + + public AutorizacionDevolucionController() throws Exception { + super(TarmSolicitudTramite.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + startQuery(); + this.init(); + try { + super.query(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para recuperar la variable del flujo + */ + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + csolicitud = super.getMfilters().get("csolicitud");//1 + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "AUTORIZACIONDEVOLUCIONCONTROLLER"; + solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(csolicitud); + btnEnviar = Boolean.FALSE; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void query() throws Exception { + // TODO Auto-generated method stub + MessageHelper.setMessageError("msg_notQuery"); + super.query(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + + Filter fCSolicitud = new Filter("pk.csolicitud", csolicitud); + dto.addFiltro(fCSolicitud); + + //Aplicandole filtros a las armas + tarmSolicitudArmasController.setCsolicitud(csolicitud); + tarmSolicitudArmasController.setPorDevolucion("Y"); + tarmSolicitudArmasController.getMfilters().clear(); + tarmSolicitudArmasController.query(); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + + //Numero de tramite + if (solicitudTramite != null) { + this.record.put("ntramite", solicitudTramite.getNumerotramite()); + } + + //Obteniendo la solicitud + TarmSolicitud solicitud = ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(this.record.getPk().getCsolicitud()); + + //Obteniendo la direccion del cliente + String tipoDireccion = ""; + if (solicitud != null) { + detallesPersona = PersonDetailController.find(String.valueOf(solicitud.getPersoncode().toString())); + + if (detallesPersona != null) { + switch (detallesPersona.getIdentificationcatalog()) { + case "CED": + tipoDireccion = "1"; + break; + case "RUC": + tipoDireccion = "2"; + break; + default: + tipoDireccion = ""; + break; + } + } + + if (solicitud != null) { + //personAddressController.findPersonaPorDireccionTipoCatalogo(String.valueOf(solicitud.getPersoncode()), tipoDireccion); + String codigoMail = codigoParameter("CODIGO.MAIL");//3 + this.direccionPersona = personAddressController.findByPersonCode(solicitud.getPersoncode().toString(), codigoMail); + + provincia = personAddressController.getLprovinces() == null || personAddressController.getLprovinces().isEmpty() ? null : personAddressController.getLprovinces().get(0); + canton = personAddressController.getLcantones() == null || personAddressController.getLcantones().isEmpty() ? null : personAddressController.getLcantones().get(0); + ciudad = personAddressController.getLcities() == null || personAddressController.getLcities().isEmpty() ? null : personAddressController.getLcities().get(0); + parroquia = personAddressController.getLparroquias() == null || personAddressController.getLparroquias().isEmpty() ? null : personAddressController.getLparroquias().get(0); + direccion = personAddressController.getRecord().getAddress(); + } + } + + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + //Obteniendo el centro de control + centroControl = CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + if (centroControl != null && centroControl.getNombreinstitucion() != null && !centroControl.getNombreinstitucion().isEmpty() + && centroControl.getNombreinstitucioncodigo() != null && !centroControl.getNombreinstitucioncodigo().isEmpty()) { + + TgeneCatalogDetail catalogoInstitucion = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()); + this.nombreInstitucion = catalogoInstitucion.getDescription(); + } + + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public String codigoParameter(String codigo) { + TgeneParameters parameter = ParametersController.find(codigo, "1"); + return parameter.getTextvalue(); + } + + @Override + public void save() { + try { + record.setEstadotramite("APB"); + update(); + + //Modificando la direccion de las armas con del cliente y el estado del arma + this.armasController.getLrecord().clear(); + this.armasController.setLrecord(this.tarmSolicitudArmasController.getlArmas()); + for (TarmArmas arma : this.armasController.getLrecord()) { + if (provincia != null) { + arma.setProvincecode(provincia.getPk().getProvincecode()); + } + + if (canton != null) { + arma.setCantoncode(canton.getPk().getCantoncode()); + } + + if (ciudad != null) { + arma.setCitycode(ciudad.getPk().getCitycode()); + } + + if (parroquia != null) { + arma.setParroquiacode(parroquia.getPk().getParroquiacode()); + } + + arma.setDireccion(direccion); + arma.setEstado("DEV"); + + this.armasController.update(arma); + } + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); + + //Modificando el estado y direccion de las armas + this.armasController.setLrecord(this.tarmSolicitudArmasController.getlArmas()); + + DtoSave dtosaveArmas = this.armasController.getDtoSave(true); + msave.put(this.armasController.getBeanalias(), dtosaveArmas); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + this.actualizada = true; + btnEnviar = Boolean.TRUE; + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que envia un mail de notificación + */ + public void enviarNotificacion() { + try { + if (direccionPersona == null || direccionPersona.getAddress() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_notienedireccioncorreo")); + return; + } + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + + String asunto = MsgControlArmas.getProperty("lbl_asuntoNotificarFecha"); + SimpleDateFormat format = new SimpleDateFormat(MsgGeneral.getProperty("dateformat")); + String textoFecha = " " + format.format(new Date()) + " "; + if (solicitudTramite.getFentregaarmas() != null) { + textoFecha = sdf.format(solicitudTramite.getFentregaarmas()); + } + + String cuerpo = MessageFormat.format(MsgControlArmas.getProperty("cuerpo.mensaje.envio.correo"), detallesPersona.getName(), + solicitudTramite.getNumerotramite().toString(), textoFecha, usuario.getName(), this.nombreInstitucion); + + EnvioCorreoDTO envioCorreo = new EnvioCorreoDTO(); + envioCorreo.setCorreoDesde(MsgControlArmas.getProperty("correoDesde")); + envioCorreo.setCorreoPara(new String[]{this.direccionPersona.getAddress()}); + envioCorreo.setAsunto(asunto); + envioCorreo.setMensajeHTML(cuerpo); + EnvioMail envioMail = EnvioMailFactory.getInstancia(); + envioMail.envioMail(envioCorreo); + actualizada = false; + } catch (EnvioMailException e) { + MessageHelper.setMessageError(new Throwable("Se produjo un error al enviar el correo")); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("csolicitud", csolicitud); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + btnEnviar = Boolean.FALSE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene los detalles de las armas segun el catalogo + * + * @param catalogo + * @param catalogoCode + * @return + */ + public String aspectoArmaCatalogo(String catalogo, String catalogoCode) { + if (catalogo != null && catalogoCode != null && !catalogo.isEmpty() && !catalogoCode.isEmpty()) { + return CatalogDetailController.findxCodigoCodcatalogo(catalogo, catalogoCode).getDescription(); + } + return null; + } + + /** + * Devuelve una descripcion de catalogo segun un tipo de aspecto + * + * @param arma + * @param tipoAspecto + * @return + */ + public String aspectoArmaExplosivoCatalogo(TarmArmas arma, String tipoAspecto) { + String aspecto = ""; + + try { + TarmTipoArmaExplosivo explosivo = TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo()); + if (explosivo != null) { + if (tipoAspecto.equalsIgnoreCase("clase") && explosivo.getClase() != null && !explosivo.getClase().isEmpty() + && explosivo.getClasecodigo() != null && !explosivo.getClasecodigo().isEmpty()) { + aspecto = CatalogDetailController.findxCodigoCodcatalogo(explosivo.getClase(), explosivo.getClasecodigo()).getDescription(); + + } else if (tipoAspecto.equalsIgnoreCase("tipo") && explosivo.getTipoarmaexplosivo() != null && !explosivo.getTipoarmaexplosivo().isEmpty() + && explosivo.getTipoarmaexplosivocodigo() != null && !explosivo.getTipoarmaexplosivocodigo().isEmpty()) { + aspecto = CatalogDetailController.findxCodigoCodcatalogo(explosivo.getTipoarmaexplosivo(), explosivo.getTipoarmaexplosivocodigo()).getDescription(); + + } else if (tipoAspecto.equalsIgnoreCase("calibre") && explosivo.getCalibre() != null && !explosivo.getCalibre().isEmpty() + && explosivo.getCalibrecodigo() != null && !explosivo.getCalibrecodigo().isEmpty()) { + aspecto = CatalogDetailController.findxCodigoCodcatalogo(explosivo.getCalibre(), explosivo.getCalibrecodigo()).getDescription(); + } + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + return aspecto; + } + + public String aspectoExplosivoArma(TarmSolicitudArmas solicitudArma, String aspecto) { + String descripcionAspecto = ""; + try { + TarmArmas arma = ArmasController.findPorCodigo(solicitudArma.getPk().getCarma()); + + if (arma != null) { + return this.aspectoArmaExplosivoCatalogo(arma, aspecto); + } + + } catch (Exception e) { + MessageHelper.setMessageWarn(e.getMessage()); + } + + return descripcionAspecto; + } + + public TarmSolicitudArmasController getTarmSolicitudArmasController() { + return tarmSolicitudArmasController; + } + + public void setTarmSolicitudArmasController( + TarmSolicitudArmasController tarmSolicitudArmasController) { + this.tarmSolicitudArmasController = tarmSolicitudArmasController; + } + + public Boolean getActualizada() { + return actualizada; + } + + public void setActualizada(Boolean actualizada) { + this.actualizada = actualizada; + } + + public TarmSolicitudTramite getSolicitudTramite() { + return solicitudTramite; + } + + public void setSolicitudTramite(TarmSolicitudTramite solicitudTramite) { + this.solicitudTramite = solicitudTramite; + } + + public ArmasController getArmasController() { + return armasController; + } + + public void setArmasController(ArmasController armasController) { + this.armasController = armasController; + } + + public PersonAddressController getPersonAddressController() { + return personAddressController; + } + + public void setPersonAddressController( + PersonAddressController personAddressController) { + this.personAddressController = personAddressController; + } + + public TgeneProvince getProvincia() { + return provincia; + } + + public void setProvincia(TgeneProvince provincia) { + this.provincia = provincia; + } + + public TgeneCanton getCanton() { + return canton; + } + + public void setCanton(TgeneCanton canton) { + this.canton = canton; + } + + public TgeneCity getCiudad() { + return ciudad; + } + + public void setCiudad(TgeneCity ciudad) { + this.ciudad = ciudad; + } + + public TgeneParroquia getParroquia() { + return parroquia; + } + + public void setParroquia(TgeneParroquia parroquia) { + this.parroquia = parroquia; + } + + public String getDireccion() { + return direccion; + } + + public void setDireccion(String direccion) { + this.direccion = direccion; + } + + public Boolean getBtnEnviar() { + return btnEnviar; + } + + public void setBtnEnviar(Boolean btnEnviar) { + this.btnEnviar = btnEnviar; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/AuxArmasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/AuxArmasController.java new file mode 100644 index 0000000..b5dd33e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/AuxArmasController.java @@ -0,0 +1,374 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.event.AjaxBehaviorEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.ClaseLovController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +/** + * Controlador principal de armas + * + * @author dcruz + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class AuxArmasController extends AbstractController { + + public AuxArmasController() throws Exception { + super(TarmArmas.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. +// record = new TarmArmas(); + lrecord = new ArrayList<>(); + beanalias = "ARMAS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaseP(String carma) { + try { + DtoQuery dto = this.getDtoQuery(true); + dto.setOrderby("pk"); + //cc.addField("codigoArma", cArma); + String sqlActual = " t.codigoarma =(select p.codigoarma from TarmArmas p where p.pk = '" + carma + "')" + + " and t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where ta.codigoarma=t.codigoarma)" + + " and t.estado !='DEST' " + + " and (t.peso>0 or t.cantidad>0)";//distintas de destruidas y cambio de propietario and t.cregistro=ta.cregistro para el manejo de los explosivos + + Filter filtroFinal = new Filter(); + filtroFinal.setSql(sqlActual); + dto.addFiltro(filtroFinal); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + } + + @Override + public void update() throws Exception { + } + + public void updateAutorizacion() throws Exception { + super.update(); + } + + @Override + public void create() throws Exception { + } + + /** + * Busca un arma por código + * + * @param armaCode + * @return + */ + public static TarmArmas findByPK(String cArma) { + try { + AuxArmasController cc = new AuxArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.querydatabaseP(cArma); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * + * @param armaCode + * @return + */ + public static TarmArmas findXCodigo(String armaCode) { + try { + + AuxArmasController cc = new AuxArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + //cc.addFilter("REG", "ESTADOARMA"); + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Lista de Armas por Registro + * + */ + public static List findxRegistro(String registrocode) { + try { + AuxArmasController cc = new AuxArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("cregistro", registrocode); + + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + for (TarmArmas item : cc.lrecord) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(item.getCtipoarmaexplosivo()); + item.modifiedData().put("clase", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription()); + if (tarmTipoArmaExplosivo.getLongitud() != null && tarmTipoArmaExplosivo.getLongitudcodigo() != null) { + item.modifiedData().put("longitud", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getLongitud(), tarmTipoArmaExplosivo.getLongitudcodigo()).getDescription()); + } + item.modifiedData().put("tipo", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription()); + if (tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null) { + item.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription()); + } + item.modifiedData().put("unidadMedidaCantidad", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getUnidadmedidapeso(), tarmTipoArmaExplosivo.getUnidadmedidapesocodigo()).getDescription()); + } + + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Abre el LOV de la clase del arma + */ + public void openLovClase() { + Map> params = new HashMap>(); + ClaseLovController.openLov(params); + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if (Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")) { + valorColocar = Boolean.TRUE; + } + for (TarmArmas guardias : lrecord) { + guardias.getModifiedData().put("seleccionado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para obtener el listado de las armas por la serie/lote + * + * @param serieLote + * @return + */ + public static List findxSerieLote(String serieLote) { + try { + AuxArmasController cc = new AuxArmasController(); + cc.init(); + cc.recperpage = 1000; + cc.addFilter("lote", serieLote); + cc.querydatabaseFechaMax(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para obtener los codigos + */ + private static String codigos(String parametro) { + TgeneParameters tgeneParameters = ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + @SuppressWarnings("unchecked") + protected void querydatabaseFechaMax() { + try { + DtoQuery dto = this.getDtoQuery(true); + dto.setOrderby("pk"); + String codigoEstadoIncautada = codigos("CODIGO.INCAUTADA"); + String codigoEstadoDecomisada = codigos("CODIGO.DECOMISADA"); + String codigoEstadoVendida = codigos("CODIGO.VENDIDA"); + String codigoEstadoMatPrima = codigos("CODIGO.MATERIAPRIMA"); + Filter filtro = new Filter(); + String sql = "t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro)"//and t.cregistro=ta.cregistro para el manejo de los explosivos + + " and t.estado !='DEST' and t.estado !='CDP' and t.estado !='" + codigoEstadoIncautada + "' and t.estado !='" + codigoEstadoDecomisada + "' and t.estado !='" + codigoEstadoVendida + "' and t.estado !='" + codigoEstadoMatPrima + "' "; + filtro.setSql(sql); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Busca un arma por código + * + * @param armaCode + * @return + */ + public static TarmArmas findXCodigoArma(String armaCode) { + try { + AuxArmasController cc = new AuxArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("codigoarma", armaCode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * + * @param armaCode + * @return + */ + public static List findListXCodigoArma(String armaCode) { + try { + AuxArmasController cc = new AuxArmasController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("codigoarma", armaCode); + cc.querybatabasearmas(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + } + + @SuppressWarnings("unchecked") + protected void querybatabasearmas() { + try { + DtoQuery dto = this.getDtoQuery(true); + SubQuery subqueryPersonCode = new SubQuery("TarmRegistroArmas", "personcode", "personcode", "i.pk=t.cregistro"); + dto.addSubQuery(subqueryPersonCode); + + dto.setOrderby("pk"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/BodegaController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/BodegaController.java new file mode 100644 index 0000000..15ffef0 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/BodegaController.java @@ -0,0 +1,114 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.CatalogLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmBodega; +import com.fp.persistence.parmas.soli.TarmTransaccionArmaBodega; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TarmTransaccionArmaBodega. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class BodegaController extends AbstractController { + + public BodegaController() throws Exception { + super(TarmBodega.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "BODEGA"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CabRepDestruirArmasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CabRepDestruirArmasController.java new file mode 100644 index 0000000..9530ffd --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CabRepDestruirArmasController.java @@ -0,0 +1,167 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmCabRepDestruirArmas; + +/** + * Clase controladora del bean TarmCabRepDestruirArmas + * + * @author Christian Pazmino + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CabRepDestruirArmasController extends AbstractController { + + public CabRepDestruirArmasController() throws Exception { + super(TarmCabRepDestruirArmas.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //Ingreso de Datos Quemados + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + public void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + // record = new TarmSolicitudImportacion(); + this.beanalias = "CABREPORTEDESTRUIRARMAS"; +// this.create(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que busca todas las cabeceras de reporte de destruccion de armas + * generadas + * + */ + public static List find() { + try { + CabRepDestruirArmasController cc = new CabRepDestruirArmasController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Metodo que busca una cabecera de reporte de destruccion de armas mediante + * el PK + * + */ + public static TarmCabRepDestruirArmas findByCodigo(String cCabReporte) { + try { + CabRepDestruirArmasController cc = new CabRepDestruirArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", cCabReporte); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + /** + * Metodo para actualizar un bean en el core + * + */ + public void update(TarmCabRepDestruirArmas bean) throws Exception { + record = bean; + update(); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CargarDepositoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CargarDepositoController.java new file mode 100644 index 0000000..b0d7791 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CargarDepositoController.java @@ -0,0 +1,670 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.IngresoDatosTipoTramite; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pgeneral.date.TgeneNotAccountingDayController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora para el ingreso de comprobante de deposito + * + * @author CHRISTIAN PAZMINO + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CargarDepositoController extends AbstractController { + + /** + * Variable que contiene el numero de tramite con el que inicia el flujo + */ + private String numTramite; + /** + * Variable que contiene el codigo de solicitud pasado en el flujo + */ + private String csolicitud; + /** + * Variable del tipo TgeneCatalogDetail(catalogo del tramite) + */ + private TgeneCatalogDetail nombreTramite; + /** + * Variable del tipo TgeneCatalogDetail(catalogo de la categoria) + */ + private TgeneCatalogDetail nombreCategoria; + /** + * Variable del tipo TgeneCatalogDetail(catalogo del uso actividad del + * tramite) + */ + private TgeneCatalogDetail nombreUsoActividad; + /** + * Bandera de tipo booleano para indicar si se habilita el boton de + * completar tarea + */ + private Boolean isEnableCompletarTarea = Boolean.FALSE; + /** + * Propiedad que premite controlar operaciones de cargar archivos al + * Alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * Variable que contiene los datos de la solicitud actual + */ + private TarmSolicitud solicitud; + /** + * Variable que nos permite cargar el comprobante de deposito al Alfresco + */ + private UploadedFile uploadedFile; + /** + * Variable que nos permite cargar la resolucion al Alfresco + */ + private UploadedFile uploadedFileResolucion; + /** + * Variable que indica si el usuario esta negado para continuear el tramite, + * su tramite pasa a estado anulado + */ + private Boolean isDenied; + /** + * Variable auxiliar usada para diferenciar cuando se presenta o no el + * mensaje de validacion de fecha expiracion solicitud + */ + private Boolean isOnlyMsj; + /** + * Variable que indica si el numero de comprobante ingresado es correcto + */ + private Boolean isTrueNComprobante; + /** + * Dias laborables permitidos para completar el tramite + */ + private Integer diasLaborablesPermitidos; + /** + * Bandera de tipo booleano para indicar si se ha grabado el reporte + * generado + * + */ + private Boolean isEnableGrabar; + /** + * codigo de la provincia del usuario logeado + */ + private String cprovincia; + + private Boolean requiereNoSolAucpBln; + + /** + * Referencia al Centro de control; + */ + private TarmCentroControl centroControl = new TarmCentroControl(); + + /** + * Nombre de la Institucion + */ + private String nombreInstitucion; + + public CargarDepositoController() throws Exception { + super(TarmSolicitudTramite.class); + } + + @PostConstruct + private void postconstruct() { +// super.startQuery(); +// csolicitud = this.getMfilters().get("csolicitud"); +// this.getMfilters().clear(); + + init(); + requiereNoSolAucpBln = Boolean.FALSE; + } + + public void consultarSolicitud() throws Exception { + if (numTramite != null) { + this.record = SolicitudTramiteController.findByNumTramite(numTramite); + if (record != null && record.getPk().getCsolicitud() != null) { + csolicitud = record.getPk().getCsolicitud(); + // csolicitud=csolicitud.replace("TRA","SOL"); + + try { + if (record != null) { + solicitud = SolicitudArmasController.findByCSolicitud(csolicitud); + if (solicitud != null && solicitud.getCtramite() != null) { + TarmTramite tramite = IngresoDatosTipoTramite.find(solicitud.getCtramite().toString()); + if (tramite != null) { + //Tramite + nombreTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + nombreCategoria = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + nombreUsoActividad = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + if (tramite.getCategoria().equals("14")) { + requiereNoSolAucpBln = Boolean.TRUE; + obtenerCentroControl(solicitud); + } else { + requiereNoSolAucpBln = Boolean.FALSE; + } + + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_tramiteSinDatosAsociados")); + } + + Date fechaLimiteDate = TgeneNotAccountingDayController.diasLaborablesPreviosAUnaFecha(new Date(), diasLaborablesPermitidos); + Calendar fechaLimite = Calendar.getInstance(); + fechaLimite.setTime(fechaLimiteDate); + fechaLimite.set(Calendar.HOUR_OF_DAY, 0); + fechaLimite.set(Calendar.MINUTE, 0); + fechaLimite.set(Calendar.SECOND, 0); + + Calendar fechaSolicitud = Calendar.getInstance(); + fechaSolicitud.setTime(solicitud.getFverificarequisitos()); + fechaSolicitud.set(Calendar.SECOND, 1); + + if (fechaSolicitud.compareTo(fechaLimite) < 0) { + isOnlyMsj = true; + record.setEstadotramite("ANU"); + record.setEstadotramitecodigo("ESTADOSOLICITUD"); + super.update(); + // this.save(); + RequestContext.getCurrentInstance().update("messages"); + } else { + isDenied = false; + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_tramiteSinDatosAsociados")); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_tramiteSinDatosAsociados")); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @param solicitud + * @throws Exception + * + */ + private void obtenerCentroControl(TarmSolicitud solicitud) throws Exception { + this.centroControl = CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + this.setNombreInstitucion(CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 500; + this.beanalias = "CARGARDEPOSITO"; + isDenied = true; + diasLaborablesPermitidos = Integer.parseInt(ParametersController.find("DIASDEPOSITO", "1").getNumbervalue().toString()); + isTrueNComprobante = Boolean.TRUE; + isOnlyMsj = false; + isEnableGrabar = Boolean.TRUE; + isEnableCompletarTarea = Boolean.FALSE; + obtenerCentroControlSolicitante(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Metodo que devuelve el centro de control al que pertenece el cliente + * dueno de la solicitud + * + * @throws Exception + */ + private void obtenerCentroControlSolicitante() throws Exception { + TsafeUserDetail tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if (tcustPersonAddres != null && tcustPersonAddres.getProvincecode() != null) { + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_notienedireccionprincipal")); + return; + } + + } + + /** + * Accion que reinicia todas las variables de la pagina + */ + public void cancelar() { + init(); + } + + /** + * Metodo que permite grabar el formulario junto al comprobante de deposito + * en el Alfresco + * + */ + @Override + public void save() { + try { + String xPathLocation = getRutaDocumentoSolBase() + "/cm:" + solicitud.getNumerosolicitud() + "/cm:" + "Deposito"; + if (record.getValorverificacion() != null && record.getValorverificacion().doubleValue() > 0) { + if (isTrueNComprobante) { + if (!record.getFechacomprobante().after(new Date())) { + if (uploadedFile != null && uploadedFile.getFileName() != null) { + String extencionArchivo = getExtension(uploadedFile.getFileName()); + String nombreArchivo = "CMPRBNT-" + solicitud.getNumerosolicitud() + "." + extencionArchivo; + if (alfrescoController.uploadFile(uploadedFile.getInputstream(), nombreArchivo, xPathLocation)) { + record.setXpathcomprobante(xPathLocation + "/cm:" + nombreArchivo); + //validamos si adjunta la resolucion + if (uploadedFileResolucion != null && uploadedFileResolucion.getFileName() != null) { + String xPathLocationResolucion = getRutaDocumentoSolBase() + "/cm:" + solicitud.getNumerosolicitud() + "/cm:" + "Resolucion"; + String extencionArchivoResolucion = getExtension(uploadedFileResolucion.getFileName()); + String nombreArchivoResolucion = "RESOLUCION-" + solicitud.getNumerosolicitud() + "." + extencionArchivoResolucion; + if (alfrescoController.uploadFile(uploadedFileResolucion.getInputstream(), nombreArchivoResolucion, xPathLocationResolucion)) { + record.setXpathresolucion(xPathLocationResolucion + "/cm:" + nombreArchivoResolucion); + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_adjuntar_resolucion")); + return; + } + } + super.update(); + DtoSave dtosave = super.getDtoSave(); + HashMap msave = new HashMap(); + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + isDenied = true; + isEnableCompletarTarea = Boolean.TRUE; + isEnableGrabar = Boolean.FALSE; + FacesContext context = FacesContext.getCurrentInstance(); + context.addMessage(null, new FacesMessage("RECUERDE", MsgControlArmas.getProperty("msg_recuerdeClickContinuarTramite"))); + } else { + MessageHelper.setMessageError(resp); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_tramiteSinDatosAsociados")); + } + } else { +// MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_archivo")); + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingreseComprobanteDeposito")); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_fechaDepositoMayorFechaActual")); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_comprobanteDepositoUsado")); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_valorDepositoNegativoCero")); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Throwable e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Metodo que retorna la extencion del comprobante de deposito que se desea + * subir al alfresco + */ + public String getExtension(String filename) { + int index = filename.lastIndexOf('.'); + if (index == -1) { + return ""; + } else { + return filename.substring(index + 1); + } + } + + /** + * Metodo de consulta no utilizado pero sobrescrito por requisito de + * herencia + */ + @Override + protected void querydatabase() { + try { + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void consultaTramites() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + + SubQuery subqueryTipo = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog= (select o.estado from TarmSolicitud o where o.pk=t.pk.csolicitud) and " + + " i.pk.catalogcode=(select o.estadocodigo from TarmSolicitud o where o.pk=t.pk.csolicitud)"); + SubQuery subqueryEstadoTramite = new SubQuery("TgeneCatalogDetail", "description", "estadotramite", "i.pk.catalog= t.estadotramite and" + + " i.pk.catalogcode=t.estadotramitecodigo"); + + dto.addSubQuery(subqueryEstadoTramite); + SubQuery subquerysolicitud = new SubQuery("TarmSolicitud", "numerosolicitud", "solicitud", "i.pk=t.pk.csolicitud"); + dto.addSubQuery(subquerysolicitud); + dto.setOrderby("t.pk"); + + TsafeUserDetail tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + Filter filtro = new Filter(); + filtro.setSql("(numerocomprobante is null OR inicioFlujo is null) and estadotramite='REG' and valorapagar>0 and " + + " csolicitud in(select o.pk from TarmSolicitud o where o.personcode ='" + tsafeUserDetailUsuario.getPk().getPersoncode() + "' and o.estado ='APB')"); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void solicitudSeleccionada(TarmSolicitudTramite tarmSolicitudTramite) { + try { + numTramite = tarmSolicitudTramite.getNumerotramite(); + consultarSolicitud(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(solicitud.getFregistro()); + StringBuilder ruta = new StringBuilder("cm:Solicitudes"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + return ruta.toString(); + } + + /** + * Metodo para validar el comprobante de deposito/ + */ + public void validarComprobanteDeposito() { + List usandoComprobanteList = SolicitudTramiteController.findByNumeroComprobante(this.record.getNumerocomprobante()); + if (usandoComprobanteList != null && usandoComprobanteList.size() > 0) { + isTrueNComprobante = Boolean.FALSE; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_comprobanteDepositoUsado")); + } else { + isTrueNComprobante = Boolean.TRUE; + } + } + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en + * el Alfresco + */ + public void handleUpload(FileUploadEvent event) { + uploadedFile = event.getFile(); + } + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en + * el Alfresco + */ + public void handleUploadResolucion(FileUploadEvent event) { + uploadedFileResolucion = event.getFile(); + } + + /** + * Recorta el nombre del archivo a cargarse + * + * @param nombre + * @return nombre recortado + */ + public String recorteNombre(String nombre) { + String fielname = nombre; + if (fielname.length() > 30) { + fielname = fielname.substring(0, 30) + extencionArchivo(nombre); + } + return fielname; + } + + /** + * Obtiene la extencion del archivo a cargar + * + * @param nombre + * @return + */ + private String extencionArchivo(String nombre) { + int pos = nombre.lastIndexOf('.'); + nombre = nombre.substring(pos); + return nombre; + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void iniciarFlujo() { + + try { + TarmSolicitud tarmSolicitud = SolicitudController.findSolicitudxcodsolicitud(record.getPk().getCsolicitud()); + if (tarmSolicitud == null || tarmSolicitud.getModifiedData() == null || tarmSolicitud.getModifiedData().get("provincecode") == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinprovincia")); + return; + } + cprovincia = tarmSolicitud.getModifiedData().get("provincecode").toString(); + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("isnew", "Y"); + request.modifiedData().put("csolicitud", record.getPk().getCsolicitud()); + request.modifiedData().put("numerotransaccion", record.getPk().getCtramite()); + request.modifiedData().put("numerosolicitud", solicitud.getNumerosolicitud()); + request.modifiedData().put("cprovincia", cprovincia); + request.setLogsolicitude(solicitud.getNumerosolicitud()); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + " No SOLICITUD: " + solicitud.getNumerosolicitud()); + isEnableCompletarTarea = Boolean.FALSE; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para validar que el valor del comprobante de deposito sea mayor a + * cero + */ + public void valorMayorACero() { + if (record.getValorverificacion().doubleValue() <= 0) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_valorDepositoNegativoCero")); + } + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public TgeneCatalogDetail getNombreTramite() { + return nombreTramite; + } + + public void setNombreTramite(TgeneCatalogDetail nombreTramite) { + this.nombreTramite = nombreTramite; + } + + public TgeneCatalogDetail getNombreCategoria() { + return nombreCategoria; + } + + public void setNombreCategoria(TgeneCatalogDetail nombreCategoria) { + this.nombreCategoria = nombreCategoria; + } + + public TgeneCatalogDetail getNombreUsoActividad() { + return nombreUsoActividad; + } + + public void setNombreUsoActividad(TgeneCatalogDetail nombreUsoActividad) { + this.nombreUsoActividad = nombreUsoActividad; + } + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + + this.uploadedFile = uploadedFile; + } + + public Boolean getIsDenied() { + return isDenied; + } + + public void setIsDenied(Boolean isDenied) { + this.isDenied = isDenied; + } + + public Boolean getIsOnlyMsj() { + return isOnlyMsj; + } + + public void setIsOnlyMsj(Boolean isOnlyMsj) { + this.isOnlyMsj = isOnlyMsj; + } + + public Boolean getIsTrueNComprobante() { + return isTrueNComprobante; + } + + public void setIsTrueNComprobante(Boolean isTrueNComprobante) { + this.isTrueNComprobante = isTrueNComprobante; + } + + public Boolean getIsEnableCompletarTarea() { + return isEnableCompletarTarea; + } + + public void setIsEnableCompletarTarea(Boolean isEnableCompletarTarea) { + this.isEnableCompletarTarea = isEnableCompletarTarea; + } + + public String getNumTramite() { + return numTramite; + } + + public void setNumTramite(String numTramite) { + this.numTramite = numTramite; + } + + public Boolean getIsEnableGrabar() { + return isEnableGrabar; + } + + public void setIsEnableGrabar(Boolean isEnableGrabar) { + this.isEnableGrabar = isEnableGrabar; + } + + public Boolean getRequiereNoSolAucpBln() { + return requiereNoSolAucpBln; + } + + public void setRequiereNoSolAucpBln(Boolean requiereNoSolAucpBln) { + this.requiereNoSolAucpBln = requiereNoSolAucpBln; + } + + public String getNombreInstitucion() { + return nombreInstitucion; + } + + public String setNombreInstitucion(String nombreInstitucion) { + if (nombreInstitucion != null && !nombreInstitucion.isEmpty()) { + this.nombreInstitucion = nombreInstitucion; + } else { + this.nombreInstitucion = ""; + } + + return nombreInstitucion; + } + + public UploadedFile getUploadedFileResolucion() { + return uploadedFileResolucion; + } + + public void setUploadedFileResolucion(UploadedFile uploadedFileResolucion) { + this.uploadedFileResolucion = uploadedFileResolucion; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CertificadoArmasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CertificadoArmasController.java new file mode 100644 index 0000000..6e0ec92 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CertificadoArmasController.java @@ -0,0 +1,127 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pentaho.PentahoController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmCertificadoArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; + +/** + * Clase controladora del bean TarmCertificadoArmas. + * + * @author Christian Pazmino + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CertificadoArmasController extends AbstractController { + + /** + * Constructor + * + * @throws Exception + */ + public CertificadoArmasController() throws Exception { + super(TarmCertificadoArmas.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CERTIFICADOARMAS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void update(TarmCertificadoArmas bean) throws Exception { + this.setRecord(bean); + super.update(); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CertificadoFiscaliaController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CertificadoFiscaliaController.java new file mode 100644 index 0000000..98d4d79 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CertificadoFiscaliaController.java @@ -0,0 +1,842 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.math.BigDecimal; +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; +import javax.servlet.http.HttpSession; + +import org.apache.commons.lang3.StringUtils; +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.menu.MenuController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmCertificadoArmas; +import com.fp.persistence.parmas.soli.TarmCertificadoArmasKey; +import com.fp.persistence.parmas.soli.TarmCertificadoFiscalia; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Controlador que permite genereal los certificados de Fiscalia + * + * @author Manuel Cepeda + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CertificadoFiscaliaController extends AbstractController { + + private String razonSocial; + private String numeroDocumento; + private String lote; + private boolean panelPerson; + private boolean panelSinDatosPerson; + private boolean panelSinDatosArma; + private String filtroPersona; + private List listaArmas; + private List listaArmasBySerie; + + @ManagedProperty(value = "#{personLovController}") + private PersonLovController personLovController; + + @ManagedProperty(value = "#{certificadoArmasController}") + private CertificadoArmasController certificadoArmasController; + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + private String sessionID; + private TcustPersonDetail tcustPersonDetail; + private String nroSolicitud; + private TarmCentroControl centroControl; + private TarmCertificadoFiscalia certificadoFiscalia; + @ManagedProperty(value = "#{solicitudCertificadoController}") + private SolicitudCertificadoController solicitudCertificadoController; + /** + * Bandera de tipo booleano para indicar si se habilita el boton de + * completar tarea + */ + private Boolean esTareaCompleta = Boolean.FALSE; + + /** + * Clase controladora de funcionalidad del Alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * Deshabilita la pantalla después de grabar la solicitud + */ + private boolean deshabilitarPantalla; + + public CertificadoFiscaliaController() throws Exception { + super(TarmArmas.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + try { + super.startQuery(); + nroSolicitud = this.getMfilters().get("csolicitud"); + this.getMfilters().clear(); + this.getPersonLovController().getMfilters().clear(); + this.getCertificadoArmasController().getMfilters().clear(); + this.getSolicitudCertificadoController().getMfilters().clear(); + + this.init(); + panelPerson = true; + panelSinDatosPerson = false; + panelSinDatosArma = false; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + panelSinDatosPerson = false; + panelSinDatosArma = false; + + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + + filtroPersona = ""; + certificadoFiscalia = SolicitudCertificadoController.findPorSolicitud(nroSolicitud.trim()); + HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false); + sessionID = session.getId(); +// recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + centroControl = Utilidades.obtenerCentroControl(); + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + if (tsafeUserDetail != null && tsafeUserDetail.getPk().getPersoncode() != null) { + tcustPersonDetail = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() throws Exception { + super.next(); + } + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", "i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase = new SubQuery("TarmTipoArmaExplosivo", "clase", "cclase", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo = new SubQuery("TarmTipoArmaExplosivo", "clasecodigo", "cclasecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud = new SubQuery("TarmTipoArmaExplosivo", "longitud", "clongitud", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo = new SubQuery("TarmTipoArmaExplosivo", "longitudcodigo", "clongitudcodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre = new SubQuery("TarmTipoArmaExplosivo", "calibre", "ccalibre", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo = new SubQuery("TarmTipoArmaExplosivo", "calibrecodigo", "ccalibrecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivo", "ctipoarmaexplosivo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivocodigo", "ctipoarmaexplosivocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapeso", "cunidadmedidapeso", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapesocodigo", "cunidadmedidapesocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida = new SubQuery("TgeneCatalogDetail", "description", "unidadmedida", "i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode = new SubQuery("TarmRegistroArmas", "personcode", "personcode", "i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + + return dto; + } + + @Override + public void save() { + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + if (esTareaCompleta) { + return; + } + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("csolicitud", nroSolicitud); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + esTareaCompleta = Boolean.TRUE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Genera el certificado de armas para la Fiscalia y sube al Alfresco el pdf + */ + public void generarReporte() { + if (deshabilitarPantalla) { + return; + } + + String path = "armas/reports/certificadosArmas"; + Boolean aux = Boolean.FALSE; + java.util.Date today = new java.util.Date(); + java.sql.Timestamp fechaReporte = new java.sql.Timestamp(today.getTime()); + Random aleatorio = new Random(); + int ticketGenerado = aleatorio.nextInt(); + int i = 0; + + for (TarmArmas armasel : lrecord) { + i++; + if (armasel.getModifiedData().get("seleccionado") != null && armasel.getModifiedData().get("seleccionado").equals(Boolean.TRUE)) { + aux = Boolean.TRUE; + guardarCertificadoReporte(armasel, i, ticketGenerado, fechaReporte); + } + } + if (!aux) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nohaseleccionadoarmas")); + return; + } + certificadoArmasController.save(); + try { + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("codResponsable", centroControl.getPersoncode()); + parameters.put("gradoresponsable", ""); //centroControl.getModifiedData().get("desgrado") + parameters.put("nombreresponsable", centroControl.getModifiedData().get("desgrado") + " " + centroControl.getModifiedData().get("nombre")); + parameters.put("centrocontrol", String.valueOf(centroControl.getModifiedData().get("desnombreinstitucion"))); + parameters.put("sessionID", sessionID); + parameters.put("nroSolicitud", certificadoFiscalia.getNroficiofiscalia()); +// parameters.put("fechaReporte",fechaReporte); + + parameters.put("ticket", ticketGenerado); + parameters.put("personCodeLogin", (tcustPersonDetail != null && tcustPersonDetail.getPk() != null) ? tcustPersonDetail.getPk().getPersoncode() : null); + if (tcustPersonDetail != null) { + parameters.put("usuario", tcustPersonDetail.getName()); + } + parameters.put("unidadmilitar", MsgControlArmas.getProperty("msg_inf_digitadordel") + " " + String.valueOf(centroControl.getModifiedData().get("desnombreinstitucion"))); + String format = "pdf"; + String filename = "Certificado"; + + InputStream file = this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + String xPathLocation = getRutaDocumentoCertificadoBase() + "/cm:" + this.nroSolicitud; + String nombreArchivo = "CERT" + nroSolicitud + ".pdf"; + alfrescoController.uploadFile(file, nombreArchivo, xPathLocation); + + //actualizar solicitudCertificadoController + solicitudCertificadoController.getMfilters().put("nrsolicitud", nroSolicitud); + solicitudCertificadoController.querydatabase(); + TarmCertificadoFiscalia tarmCertificadoFiscalia = solicitudCertificadoController.getRecord(); + tarmCertificadoFiscalia.setIsnew(false); + tarmCertificadoFiscalia.setXpathSolicitudArma(xPathLocation + "/cm:" + nombreArchivo); + + solicitudCertificadoController.getLrecord().add(tarmCertificadoFiscalia); + solicitudCertificadoController.update(); + solicitudCertificadoController.save(); + deshabilitarPantalla = Boolean.TRUE; + MessageHelper.setMessageInfo("Se genero el certificado exitosamente."); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoCertificadoBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new java.util.Date()); + StringBuilder ruta = new StringBuilder("cm:Certificados"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + return ruta.toString(); + } + + /** + * Guarda los datos de las Armas solicitadas por el Fiscal a la bdd + * + * @param armaObj + * @param orden + * @param ticket + * @param fechaReporte + */ + private void guardarCertificadoReporte(TarmArmas armaObj, int orden, int ticket, java.sql.Timestamp fechaReporte) { + TarmCertificadoArmas certificadoArmasObj = new TarmCertificadoArmas(); + TarmCertificadoArmasKey pk = new TarmCertificadoArmasKey(); + certificadoArmasObj.setPk(pk); + try { + certificadoArmasObj.getPk().setFechareporte(fechaReporte); + certificadoArmasObj.getPk().setSessionid(sessionID); + certificadoArmasObj.getPk().setOrden(orden); + certificadoArmasObj.setIdentification(armaObj.getModifiedData().get("noDocumento") != null ? armaObj.getModifiedData().get("noDocumento").toString() : null); + certificadoArmasObj.setName(armaObj.getModifiedData().get("propietario") != null ? armaObj.getModifiedData().get("propietario").toString() : null); + certificadoArmasObj.setRegisterdate(armaObj.getFecharegistro()); + certificadoArmasObj.setClase(armaObj.getModifiedData().get("clase") != null ? armaObj.getModifiedData().get("clase").toString() : null); + certificadoArmasObj.setTipoarmaexplosivo(armaObj.getModifiedData().get("tipoarmaexplosivo") != null ? armaObj.getModifiedData().get("tipoarmaexplosivo").toString() : null); + certificadoArmasObj.setMarca(armaObj.getModifiedData().get("marca") != null ? armaObj.getModifiedData().get("marca").toString() : null); + certificadoArmasObj.setCalibre(armaObj.getModifiedData().get("calibre") != null ? armaObj.getModifiedData().get("calibre").toString() : null); + certificadoArmasObj.setLote(armaObj.getLote()); + certificadoArmasObj.setPaisfabricacion(armaObj.getModifiedData().get("paisorigen") != null ? armaObj.getModifiedData().get("paisorigen").toString() : null); + certificadoArmasObj.setEstado(armaObj.getModifiedData().get("estado") != null ? armaObj.getModifiedData().get("estado").toString() : null); + certificadoArmasObj.setUsercode((tcustPersonDetail != null && tcustPersonDetail.getPk() != null) ? tcustPersonDetail.getPk().getPersoncode().toString() : null); + certificadoArmasObj.setTicket(ticket); + certificadoArmasObj.setPermiso((armaObj.getModifiedData().get("permiso") != null) ? armaObj.getModifiedData().get("permiso").toString() : "");//armaObj.getModifiedData().get("permiso").toString()); + certificadoArmasObj.setFechaemison((Date) armaObj.getModifiedData().get("fechaemision")); + certificadoArmasObj.setFechaexpiracion((Date) armaObj.getModifiedData().get("fechaexpiracion")); + certificadoArmasObj.setIsnew(true); + certificadoArmasController.update(certificadoArmasObj); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Selecciona el objeto TcustPersonDetail de la tabla actual de la pagina + * + * @param person + */ + public void setPerson(TcustPersonDetail person) { + if (person != null) { + panelPerson = false; + filtroPersona = " and t.cregistro in (select i.pk from TarmRegistroArmas i where i.personcode =" + person.getPk().getPersoncode() + ")"; + querydatabaseArma(); + setRazonSocial(person.getName()); + setNumeroDocumento(person.getIdentification()); + } + } + + /** + * Permite consultar en la tabla armas mediante el codigo de la persona + */ + protected void querydatabaseArma() { + try { + DtoQuery dto = this.getDtoQuery(); + dto.setOrderby("pk"); + Filter filtro = new Filter(); + String sql = "t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma) and t.estado !='DEST' and t.estado!='VEND' and t.estado!='MING' and t.estado!='DUPL' and t.estado!='CUSTEM'" + + " and (t.peso>0 or t.cantidad>0) " + filtroPersona;// + filtro.setSql(sql); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + listaArmas = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + listaArmas = (List) resp.get(this.beanalias); + actualizarDatos(listaArmas); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Permite actualizar los datos de la Entidad TarmAmas + * + * @param listaArmas + */ + private void actualizarDatos(List listaArmas) { + for (TarmArmas armasObj : listaArmas) { + TarmRegistroArmas registroArmasObj = RegistroArmController.findByCodigo(armasObj.getCregistro().toString()); + if (registroArmasObj != null && registroArmasObj.getPersoncode() != null) { + TcustPersonDetail propietarioObj = PersonDetailController.find(registroArmasObj.getPersoncode().toString()); + if (propietarioObj.getIdentificationcatalog() != null && propietarioObj.getIdentificationcatalogcode() != null) { + armasObj.getModifiedData().put("tipoDocumento", CatalogDetailController.findxCodigoCodcatalogo(propietarioObj.getIdentificationcatalog(), propietarioObj.getIdentificationcatalogcode()).getDescription()); + } + armasObj.getModifiedData().put("noDocumento", propietarioObj.getIdentification()); + armasObj.getModifiedData().put("nombrerazonsocial", propietarioObj.getName()); + armasObj.getModifiedData().put("paisorigencode", registroArmasObj.getPaisorigen()); + if (armasObj.getModifiedData().get("cclase") != null) { + armasObj.getModifiedData().put("clase", CatalogDetailController.findxCodigoCodcatalogo(armasObj.getModifiedData().get("cclase").toString(), armasObj.getModifiedData().get("cclasecodigo").toString()).getDescription()); + } + if (armasObj.getModifiedData().get("ctipoarmaexplosivo") != null) { + armasObj.getModifiedData().put("tipoarmaexplosivo", CatalogDetailController.findxCodigoCodcatalogo(armasObj.getModifiedData().get("ctipoarmaexplosivo").toString(), armasObj.getModifiedData().get("ctipoarmaexplosivocodigo").toString()).getDescription()); + } + if (armasObj.getModifiedData().get("ccalibre") != null) { + armasObj.getModifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(armasObj.getModifiedData().get("ccalibre").toString(), armasObj.getModifiedData().get("ccalibrecodigo").toString()).getDescription()); + } + + TarmDocumentoHabilitante documentoHabilitante = DocumentoHabilitanteController.findxarma(armasObj.getPk()); + if (documentoHabilitante != null) { + armasObj.getModifiedData().put("fechaemision", documentoHabilitante.getFechaemision()); + armasObj.getModifiedData().put("fechaexpiracion", documentoHabilitante.getFechaexpiracion()); + TarmTramite tarmTramite = TarmTramiteController.find(documentoHabilitante.getCtramite().toString()); + if (tarmTramite != null) { + armasObj.getModifiedData().put("permiso", tarmTramite.getModifiedData().get("usoactividad")); + } + } + + //cargarPropietario + armasObj.getModifiedData().put("ordenarma", armasObj.getPk()); + if (armasObj.getModifiedData().get("personcode") != null) { + TcustPersonDetail personaDetalle = PersonDetailController.find(armasObj.getModifiedData().get("personcode").toString()); + armasObj.getModifiedData().put("propietario", personaDetalle.getName()); + armasObj.getModifiedData().put("noDocumento", personaDetalle.getIdentification()); + armasObj.getModifiedData().put("nombrerazonsocial", personaDetalle.getName()); + } + } + } + } + + /** + * Permite consultar en la tabla armas mediante el lote/serie de armas + */ + public void querydatabaseSerie() { + try { + DtoQuery dto = this.getDtoQuery(); + String sqlFiltroEstados = ""; + String sqlFiltroCodigosArmas = "";//1 + + dto.setOrderby("pk"); + String sqlActual = " t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma) " + + " and (t.peso>0 or t.cantidad>0)";// and (t.cregistro=ta.cregistro) para el manejo de los explosivos + String sqlFinal = obtenerFiltroBusquedaGeneral(sqlFiltroEstados, sqlFiltroCodigosArmas, sqlActual); + Filter filtroFinal = new Filter(); + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + listaArmasBySerie = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + listaArmasBySerie = (List) resp.get(this.beanalias); + actualizarDatos(listaArmasBySerie); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que agrega dinamicamente los filtros a una consulta SQL + * + * @param sqlFiltros + * @return String + */ + private String obtenerFiltroBusquedaGeneral(String... sqlFiltros) { + StringBuffer sqlFinal = new StringBuffer(); + for (int i = 0; i < sqlFiltros.length; i++) { + if (sqlFinal.length() > 0 && !StringUtils.endsWith(StringUtils.trim(sqlFinal.toString()), "AND")) { + sqlFinal.append(" AND "); + } + sqlFinal.append(sqlFiltros[i]); + } + return sqlFinal.toString(); + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if (Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")) { + valorColocar = Boolean.TRUE; + } + for (TarmArmas tarmArmas : listaArmas) { + tarmArmas.getModifiedData().put("seleccionado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Permite actualizar el campo seleccionado en la entidad tarmArmas + */ + public void actualizarDatosArma() { + for (TarmArmas tarmArmas : listaArmas) { + if (tarmArmas.getModifiedData().get("seleccionado").equals(Boolean.TRUE)) { + this.getLrecord().add(tarmArmas); + } + } + panelPerson = true; + personLovController.init(); + personLovController.getMfilters().clear(); + getMfilters().clear(); + } + + /** + * Permite actualizar el campo seleccionado en la entidad tarmArmas + */ + public void actualizarDatosArmaSerie() { + for (TarmArmas tarmArmas : listaArmasBySerie) { + if (tarmArmas.getModifiedData().get("seleccionado").equals(Boolean.TRUE)) { + this.getLrecord().add(tarmArmas); + } + } + panelPerson = true; + setPanelSinDatosPerson(false); + listaArmasBySerie = new ArrayList<>(); + this.getMfilters().clear(); + } + + /** + * Metodo para extrer solo elnoimbre del archivo + * + * @param xpath xpath del archivo en alfresco + * @return solo la parte correspondiente al nombre del archivo + */ + public String soloNombreArchivo(String xpath) { + return xpath.substring(xpath.lastIndexOf(":") + 1, xpath.length()); + } + + public void onReturnPersonLov() { + numeroDocumento = ""; + razonSocial = ""; + setPanelPerson(true); + setPanelSinDatosPerson(false); + setPanelSinDatosArma(false); + getMfilters().clear(); + } + + public void emptyPerson() { + if ((lote == null || "".equals(lote)) && (numeroDocumento == null || "".equals(numeroDocumento)) && (razonSocial == null || "".equals(razonSocial))) { + MessageHelper.setMessageError("Ingrese el campo Identificacin o el campo Nombre"); + return; + } + + TarmArmas obj = new TarmArmas(); + if (razonSocial == null || "".equals(razonSocial)) { + razonSocial = "N/A"; + } + + if (lote != null && !"".equals(lote)) { + obj.setLote(lote); + } + + if (numeroDocumento != null || !"".equals(numeroDocumento)) { + obj.getModifiedData().put("noDocumento", numeroDocumento); + } + + obj.getModifiedData().put("nombrerazonsocial", razonSocial); + obj.getModifiedData().put("propietario", razonSocial); + obj.getModifiedData().put("permiso", "No se registra permisos en el sistema"); + lrecord.add(obj); + + personLovController.init(); + personLovController.getMfilters().clear(); + setLote(""); + numeroDocumento = ""; + razonSocial = ""; + } + + public boolean isPanelPerson() { + return panelPerson; + } + + public void setPanelPerson(boolean panelPerson) { + this.panelPerson = panelPerson; + } + + public List getListaArmas() { + return listaArmas; + } + + public void setListaArmas(List listaArmas) { + this.listaArmas = listaArmas; + } + + /** + * @return the razonSocial + */ + public String getRazonSocial() { + return razonSocial; + } + + /** + * @param razonSocial the razonSocial to set + */ + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + /** + * @return the numeroDocumento + */ + public String getNumeroDocumento() { + return numeroDocumento; + } + + /** + * @param numeroDocumento the numeroDocumento to set + */ + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + /** + * @return the personLovController + */ + public PersonLovController getPersonLovController() { + return personLovController; + } + + /** + * @param personLovController the personLovController to set + */ + public void setPersonLovController(PersonLovController personLovController) { + this.personLovController = personLovController; + } + + /** + * @return the listaArmasBySerie + */ + public List getListaArmasBySerie() { + return listaArmasBySerie; + } + + /** + * @param listaArmasBySerie the listaArmasBySerie to set + */ + public void setListaArmasBySerie(List listaArmasBySerie) { + this.listaArmasBySerie = listaArmasBySerie; + } + + /** + * @return the certificadoArmasController + */ + public CertificadoArmasController getCertificadoArmasController() { + return certificadoArmasController; + } + + /** + * @param certificadoArmasController the certificadoArmasController to set + */ + public void setCertificadoArmasController( + CertificadoArmasController certificadoArmasController) { + this.certificadoArmasController = certificadoArmasController; + } + + /** + * @return the reportController + */ + public ReportController getReportController() { + return reportController; + } + + /** + * @param reportController the reportController to set + */ + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + } + + /** + * @return the alfrescoController + */ + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + /** + * @param alfrescoController the alfrescoController to set + */ + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + /** + * @return the solicitudCertificadoController + */ + public SolicitudCertificadoController getSolicitudCertificadoController() { + return solicitudCertificadoController; + } + + /** + * @param solicitudCertificadoController the solicitudCertificadoController + * to set + */ + public void setSolicitudCertificadoController( + SolicitudCertificadoController solicitudCertificadoController) { + this.solicitudCertificadoController = solicitudCertificadoController; + } + + /** + * @return the certificadoFiscalia + */ + public TarmCertificadoFiscalia getCertificadoFiscalia() { + return certificadoFiscalia; + } + + /** + * @param certificadoFiscalia the certificadoFiscalia to set + */ + public void setCertificadoFiscalia(TarmCertificadoFiscalia certificadoFiscalia) { + this.certificadoFiscalia = certificadoFiscalia; + } + + /** + * @return the nroSolicitud + */ + public String getNroSolicitud() { + return nroSolicitud; + } + + /** + * @param nroSolicitud the nroSolicitud to set + */ + public void setNroSolicitud(String nroSolicitud) { + this.nroSolicitud = nroSolicitud; + } + + /** + * @return the esTareaCompleta + */ + public boolean isEsTareaCompleta() { + return esTareaCompleta; + } + + /** + * @param esTareaCompleta the esTareaCompleta to set + */ + public void setEsTareaCompleta(boolean esTareaCompleta) { + this.esTareaCompleta = esTareaCompleta; + } + + /** + * @return the panelSinDatosPerson + */ + public boolean isPanelSinDatosPerson() { + return panelSinDatosPerson; + } + + /** + * @param panelSinDatosPerson the panelSinDatosPerson to set + */ + public void setPanelSinDatosPerson(boolean panelSinDatosPerson) { + this.panelSinDatosPerson = panelSinDatosPerson; + } + + /** + * @return the panelSinDatosArma + */ + public boolean isPanelSinDatosArma() { + return panelSinDatosArma; + } + + /** + * @param panelSinDatosArma the panelSinDatosArma to set + */ + public void setPanelSinDatosArma(boolean panelSinDatosArma) { + this.panelSinDatosArma = panelSinDatosArma; + } + + /** + * @return the lote + */ + public String getLote() { + return lote; + } + + /** + * @param lote the lote to set + */ + public void setLote(String lote) { + this.lote = lote; + } + + /** + * @return the deshabilitarPantalla + */ + public boolean isDeshabilitarPantalla() { + return deshabilitarPantalla; + } + + /** + * @param deshabilitarPantalla the deshabilitarPantalla to set + */ + public void setDeshabilitarPantalla(boolean deshabilitarPantalla) { + this.deshabilitarPantalla = deshabilitarPantalla; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CertificadosArmasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CertificadosArmasController.java new file mode 100644 index 0000000..b1d7e00 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CertificadosArmasController.java @@ -0,0 +1,607 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.security.Timestamp; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; + +import javax.annotation.PostConstruct; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpSession; + +import org.hibernate.HibernateException; +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.lov.ArmasLovController; +import com.fp.frontend.controller.armas.lov.CertArmasLovController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.commondb.helper.FormatDates; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmCertificadoArmas; +import com.fp.persistence.parmas.soli.TarmCertificadoArmasKey; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Controlador principal de la funcionalidad de consulta de armas + * + * @author Christian Pazmino + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CertificadosArmasController extends AbstractController { + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmas; + + /** + * Tipo documento + */ + private String tipoDoc; + + /** + * Número documento + */ + private String numDoc; + + /** + * Nombre/razón social + */ + private String nombreRazon; + + /** + * Longitud arma + */ + private String longitud; + /** + * Calibre arma + */ + private String calibre; + /** + * Clase arma + */ + private String clase; + /** + * Tipo de arma + */ + private String tipoarma; + /** + * unidad medida peso + */ + private String unidadmedidapeso; + + /** + * Bandera que indica que en realidad existe luego del ingreso de datos un + * tipo de arma explosivo válido + */ + private boolean existeTipoArmaExplosivo; + + /** + * Bandera que escifica que se deba verificar que exista un arma explosivo + * válida + */ + private boolean verificaArmaExplosivo = Boolean.TRUE; + + /** + * Bloquea la unidad de cantidad + */ + private boolean bloquearUnidadCantidad = Boolean.TRUE; + + /** + * Bloquea la unidad de peso + */ + private boolean bloquearUnidadPeso = Boolean.TRUE; + + private Date fechaActual; + + private String razonSocial; + + private String numeroDocumento; + + private String filtroPersona; + private TarmCentroControl centroControl; + + private String sessionID; + + private Timestamp fechaReporte; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{certificadoArmasController}") + private CertificadoArmasController certificadoArmasController; + + private TcustPersonDetail tcustPersonDetail; + + public CertificadosArmasController() throws Exception { + super(TarmArmas.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + // querydatabase(); +// super.startQuery(); + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + fechaActual = new Date(); + HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false); + sessionID = session.getId(); + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "ARMAS"; + filtroPersona = ""; + // obtiene el centro de conrtrol + centroControl = Utilidades.obtenerCentroControl(); + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + if (tsafeUserDetail != null && tsafeUserDetail.getPk().getPersoncode() != null) { + tcustPersonDetail = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + protected void querydatabase() { + try { +// DtoQuery dto = this.getDtoQuery(); +// dto.setOrderby("pk"); +// Filter filtro = new Filter(); +// String sql="t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro) and t.estado !='DEST' and t.estado !='CDP' " + filtroPersona; +// filtro.setSql(sql); +// dto.addFiltro(filtro); +// +// HashMap mtables = new HashMap(); +// mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. +// +// Request request = this.callerhelper.getRequest(); +// request.setQueryTables(mtables); +// Response resp = this.callerhelper.executeQuery(request); +// if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { +// this.lrecord = new ArrayList(); +// MessageHelper.setMessageError(resp); +// } else { +// this.lrecord = (List) resp.get(this.beanalias); +// for(TarmArmas armasObj:lrecord){ +// TarmRegistroArmas registroArmasObj = RegistroArmController.findByCodigo(armasObj.getCregistro().toString()); +// if(registroArmasObj!=null && registroArmasObj.getPersoncode()!=null){ +// TcustPersonDetail propietarioObj = PersonDetailController.find(registroArmasObj.getPersoncode().toString()); +// armasObj.getModifiedData().put("tipoDocumento", CatalogDetailController.findxCodigoCodcatalogo(propietarioObj.getIdentificationcatalog(), propietarioObj.getIdentificationcatalogcode()).getDescription()); +// armasObj.getModifiedData().put("noDocumento", propietarioObj.getIdentification()); +// armasObj.getModifiedData().put("nombrerazonsocial", propietarioObj.getName()); +// armasObj.getModifiedData().put("paisorigencode", registroArmasObj.getPaisorigen()); +// if(armasObj.getModifiedData().get("cclase")!=null){ +// armasObj.getModifiedData().put("clase", CatalogDetailController.findxCodigoCodcatalogo(armasObj.getModifiedData().get("cclase").toString(), armasObj.getModifiedData().get("cclasecodigo").toString()).getDescription()); +// } +// if(armasObj.getModifiedData().get("ctipoarmaexplosivo")!=null){ +// armasObj.getModifiedData().put("tipoarmaexplosivo", CatalogDetailController.findxCodigoCodcatalogo(armasObj.getModifiedData().get("ctipoarmaexplosivo").toString(), armasObj.getModifiedData().get("ctipoarmaexplosivocodigo").toString()).getDescription()); +// } +// if(armasObj.getModifiedData().get("ccalibre")!=null){ +// armasObj.getModifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(armasObj.getModifiedData().get("ccalibre").toString(), armasObj.getModifiedData().get("ccalibrecodigo").toString()).getDescription()); +// } +// } +// } +// super.postQuery(this.lrecord); +// } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() throws Exception { + super.next(); + } + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", "i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase = new SubQuery("TarmTipoArmaExplosivo", "clase", "cclase", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo = new SubQuery("TarmTipoArmaExplosivo", "clasecodigo", "cclasecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud = new SubQuery("TarmTipoArmaExplosivo", "longitud", "clongitud", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo = new SubQuery("TarmTipoArmaExplosivo", "longitudcodigo", "clongitudcodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre = new SubQuery("TarmTipoArmaExplosivo", "calibre", "ccalibre", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo = new SubQuery("TarmTipoArmaExplosivo", "calibrecodigo", "ccalibrecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivo", "ctipoarmaexplosivo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivocodigo", "ctipoarmaexplosivocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapeso", "cunidadmedidapeso", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapesocodigo", "cunidadmedidapesocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida = new SubQuery("TgeneCatalogDetail", "description", "unidadmedida", "i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode = new SubQuery("TarmRegistroArmas", "personcode", "personcode", "i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + + return dto; + } + + @Override + public void save() { + } + + /** + * Abre el lov de persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Maneja la respuesta del Lov de Personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + filtroPersona = ""; + TcustPersonDetail personaDetailSelecionada = (TcustPersonDetail) event.getObject(); + razonSocial = personaDetailSelecionada.getName(); + numeroDocumento = personaDetailSelecionada.getIdentification(); + filtroPersona = personaDetailSelecionada.getPk().getPersoncode().toString(); + this.setLrecord(new ArrayList()); + FacesContext context = FacesContext.getCurrentInstance(); + context.addMessage(null, new FacesMessage("RECUERDE", MsgControlArmas.getProperty("msg_recuerdeClickSeleccionarArmas"))); +// List registroArmasList = RegistroArmController.findxPersoncode(personaDetailSelecionada.getPk().getPersoncode().toString()); +// if(registroArmasList!=null && registroArmasList.size()>0){ +// filtroPersona = " and t.cregistro in ("; +// for(TarmRegistroArmas regArmaObj : registroArmasList){ +// filtroPersona+=regArmaObj.getPk().toString() + ","; +// } +// filtroPersona=filtroPersona.substring(0, filtroPersona.length()-1); +// filtroPersona+=")"; +// }else{ +// filtroPersona = " and t.cregistro = -10023"; +// } + //querydatabase(); + } + + /* Abre el LOV de la clase del arma + */ + public void openLovArma() { + Map> params = new HashMap>(); + List codigosArma = new ArrayList<>(); + String codigos = null; + if (this.getLrecord() != null && this.getLrecord().size() > 0) { + for (TarmArmas arma : this.getLrecord()) { + if (codigos == null) { + codigos = " t.pk !='" + arma.getPk() + "' "; + } else { + codigos = codigos + " and t.pk !='" + arma.getPk() + "' "; + } + } + } + codigosArma.add(codigos); + List estadossArma = new ArrayList<>(); + estadossArma.add(" t.estado !='CDP' and t.estado !='VEND' and t.estado!='TRAS' and t.estado!='MING' and t.estado!='DEST' and t.estado!='DUPL' and t.estado!='CUSTEM' and t.estado!='ENTR'" + + " and (t.peso>0 or t.cantidad>0) ");//t.estado !='DEST' and and t.estado !='DEC'//destruidas - cambiodepropietario - vendidas - decomisadas - suspendida - cancelada - incautada + + List codigoPersona = new ArrayList<>(); + codigoPersona.add(filtroPersona); + + params.put("ccodigosarmas", codigosArma); + params.put("estadosarmas", estadossArma); + params.put("codigopersona", codigoPersona); + CertArmasLovController.openLov(params); + } + + /** + * Regresa del LOV de armas + * + * @param event + */ + @SuppressWarnings("unchecked") + public void onReturnArma(SelectEvent event) { + List tarmArmas = (List) event.getObject(); + if (tarmArmas != null && tarmArmas.size() > 0) { + for (TarmArmas arma : tarmArmas) { + arma.getModifiedData().put("seleccionada", Boolean.TRUE); + this.getLrecord().add(arma); + } + } + //ordenamos la lista +// Collections.sort(armasController.getLrecord(), new Comparator() { +// public int compare(TarmArmas p1, TarmArmas p2) { +// return new Integer(p1.getModifiedData().get("ordenarma").toString()).compareTo(new Integer(p2.getModifiedData().get("ordenarma").toString())); +// } +// }); + } + + public void generarReporte() { + String path = "armas/reports/certificadosArmas"; + Boolean aux = Boolean.FALSE; + java.util.Date today = new java.util.Date(); + java.sql.Timestamp fechaReporte = new java.sql.Timestamp(today.getTime()); + Random aleatorio = new Random(); + int ticketGenerado = aleatorio.nextInt(); +// String filtro=null; +// ListcodArmas=new ArrayList(); + int i = 0; + + for (TarmArmas armasel : lrecord) { + i++; + if (armasel.getModifiedData().get("seleccionada") != null && armasel.getModifiedData().get("seleccionada").equals(Boolean.TRUE)) { + aux = Boolean.TRUE; + guardarCertificadoReporte(armasel, i, ticketGenerado, fechaReporte); +// codArmas.add(armasel.getPk()); + } + } + if (!aux) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nohaseleccionadoarmas")); + return; + } + certificadoArmasController.save(); + try { + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("codResponsable", centroControl.getPersoncode()); + parameters.put("gradoresponsable", ""); //centroControl.getModifiedData().get("desgrado") + parameters.put("nombreresponsable", centroControl.getModifiedData().get("desgrado") + " " + centroControl.getModifiedData().get("nombre")); + parameters.put("centrocontrol", String.valueOf(centroControl.getModifiedData().get("desnombreinstitucion"))); + parameters.put("sessionID", sessionID); +// parameters.put("fechaReporte",fechaReporte); + + parameters.put("ticket", ticketGenerado); + parameters.put("personCodeLogin", (tcustPersonDetail != null && tcustPersonDetail.getPk() != null) ? tcustPersonDetail.getPk().getPersoncode() : null); + if (tcustPersonDetail != null) { + parameters.put("usuario", tcustPersonDetail.getName()); + } + // String[] selectedEstados = filtro.split(","); +// parameters.put("filtro", codArmas); + parameters.put("unidadmilitar", MsgControlArmas.getProperty("msg_inf_digitadordel") + " " + String.valueOf(centroControl.getModifiedData().get("desnombreinstitucion"))); + String format = "pdf"; + String filename = "Certificado"; + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + private void guardarCertificadoReporte(TarmArmas armaObj, int orden, int ticket, java.sql.Timestamp fechaReporte) { + TarmCertificadoArmas certificadoArmasObj = new TarmCertificadoArmas(); + TarmCertificadoArmasKey pk = new TarmCertificadoArmasKey(); + certificadoArmasObj.setPk(pk); + try { + certificadoArmasObj.getPk().setFechareporte(fechaReporte); + certificadoArmasObj.getPk().setSessionid(sessionID); + certificadoArmasObj.getPk().setOrden(orden); + certificadoArmasObj.setIdentification(armaObj.getModifiedData().get("noDocumento") != null ? armaObj.getModifiedData().get("noDocumento").toString() : null); + certificadoArmasObj.setName(armaObj.getModifiedData().get("propietario") != null ? armaObj.getModifiedData().get("propietario").toString() : null); + certificadoArmasObj.setRegisterdate(armaObj.getFecharegistro()); + certificadoArmasObj.setClase(armaObj.getModifiedData().get("clase") != null ? armaObj.getModifiedData().get("clase").toString() : null); + certificadoArmasObj.setTipoarmaexplosivo(armaObj.getModifiedData().get("tipoarmaexplosivo") != null ? armaObj.getModifiedData().get("tipoarmaexplosivo").toString() : null); + certificadoArmasObj.setMarca(armaObj.getModifiedData().get("marca") != null ? armaObj.getModifiedData().get("marca").toString() : null); + certificadoArmasObj.setCalibre(armaObj.getModifiedData().get("calibre") != null ? armaObj.getModifiedData().get("calibre").toString() : null); + certificadoArmasObj.setLote(armaObj.getLote()); + certificadoArmasObj.setPaisfabricacion(armaObj.getModifiedData().get("paisorigen") != null ? armaObj.getModifiedData().get("paisorigen").toString() : null); + certificadoArmasObj.setEstado(armaObj.getModifiedData().get("estado") != null ? armaObj.getModifiedData().get("estado").toString() : null); + certificadoArmasObj.setUsercode((tcustPersonDetail != null && tcustPersonDetail.getPk() != null) ? tcustPersonDetail.getPk().getPersoncode().toString() : null); + certificadoArmasObj.setTicket(ticket); + certificadoArmasObj.setIsnew(true); + certificadoArmasController.update(certificadoArmasObj); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public RegistroArmController getRegistroArmas() { + return registroArmas; + } + + public void setRegistroArmas(RegistroArmController registroArmas) { + this.registroArmas = registroArmas; + } + + public String getTipoDoc() { + return tipoDoc; + } + + public void setTipoDoc(String tipoDoc) { + this.tipoDoc = tipoDoc; + } + + public String getNumDoc() { + return numDoc; + } + + public void setNumDoc(String numDoc) { + this.numDoc = numDoc; + } + + public String getNombreRazon() { + return nombreRazon; + } + + public void setNombreRazon(String nombreRazon) { + this.nombreRazon = nombreRazon; + } + + public String getLongitud() { + return longitud; + } + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + public String getCalibre() { + return calibre; + } + + public void setCalibre(String calibre) { + this.calibre = calibre; + } + + public String getClase() { + return clase; + } + + public void setClase(String clase) { + this.clase = clase; + } + + public String getTipoarma() { + return tipoarma; + } + + public void setTipoarma(String tipoarma) { + this.tipoarma = tipoarma; + } + + public String getUnidadmedidapeso() { + return unidadmedidapeso; + } + + public void setUnidadmedidapeso(String unidadmedidapeso) { + this.unidadmedidapeso = unidadmedidapeso; + } + + public boolean isExisteTipoArmaExplosivo() { + return existeTipoArmaExplosivo; + } + + public void setExisteTipoArmaExplosivo(boolean existeTipoArmaExplosivo) { + this.existeTipoArmaExplosivo = existeTipoArmaExplosivo; + } + + public boolean isVerificaArmaExplosivo() { + return verificaArmaExplosivo; + } + + public void setVerificaArmaExplosivo(boolean verificaArmaExplosivo) { + this.verificaArmaExplosivo = verificaArmaExplosivo; + } + + public boolean isBloquearUnidadCantidad() { + return bloquearUnidadCantidad; + } + + public void setBloquearUnidadCantidad(boolean bloquearUnidadCantidad) { + this.bloquearUnidadCantidad = bloquearUnidadCantidad; + } + + public boolean isBloquearUnidadPeso() { + return bloquearUnidadPeso; + } + + public void setBloquearUnidadPeso(boolean bloquearUnidadPeso) { + this.bloquearUnidadPeso = bloquearUnidadPeso; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public String getRazonSocial() { + return razonSocial; + } + + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public CertificadoArmasController getCertificadoArmasController() { + return certificadoArmasController; + } + + public void setCertificadoArmasController( + CertificadoArmasController certificadoArmasController) { + this.certificadoArmasController = certificadoArmasController; + } + + public String getSessionID() { + return sessionID; + } + + public void setSessionID(String sessionID) { + this.sessionID = sessionID; + } + + public Timestamp getFechaReporte() { + return fechaReporte; + } + + public void setFechaReporte(Timestamp fechaReporte) { + this.fechaReporte = fechaReporte; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ColaImpresionController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ColaImpresionController.java new file mode 100644 index 0000000..6dc8dd5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ColaImpresionController.java @@ -0,0 +1,168 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.inte.TarmColadeImpresion; + +/** + * Clase controladora del bean TarmColadeImpresion. + * + * @author DLO + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ColaImpresionController extends AbstractController { + + public ColaImpresionController() throws Exception { + super(TarmColadeImpresion.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "BODEGA"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.cdocumento"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para actualizar un bean en el record desde otros controladores + */ + public void update(TarmColadeImpresion bean) throws Exception { + record = bean; + super.update(); + } + + /** + * Encuentra una lista en la coladeimpresion por solicitud y por + * documentoHabilitante + * + * @param cdocumento + * @param estado + * @return List + * @throws Exception + */ + public static List findByDocumentoEstado(String cdocumento, String estadoimpresion) throws Exception { + try { + ColaImpresionController cc = new ColaImpresionController(); + cc.init(); + cc.recperpage = 3000; + cc.addFilter("cdocumento", cdocumento); + cc.addFilter("estadoimpresion", estadoimpresion); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Encuentra una lista en la coladeimpresion por solicitud y por + * documentoHabilitante + * + * @param cdocumento + * @param estado + * @return List + * @throws Exception + */ + public static List findByDocumentoCDoc(String cdocumento) throws Exception { + try { + ColaImpresionController cc = new ColaImpresionController(); + cc.init(); + cc.recperpage = 100; + cc.addFilter("cdocumento", cdocumento); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ConsultaAlfrescoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ConsultaAlfrescoController.java new file mode 100644 index 0000000..88f3bff --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ConsultaAlfrescoController.java @@ -0,0 +1,697 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.eval.EvaluacionController; +import com.fp.frontend.controller.armas.parametros.CashManagementHistoryController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.armas.parametros.TarmVentaArmaTemporalController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.eval.TarmEvaluacion; +import com.fp.persistence.parmas.fun.TarmCashManagementHistory; +import com.fp.persistence.parmas.fun.TarmVentaArmaTem; +import com.fp.persistence.parmas.ins.TarmPlanificacionInspeccion; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.soli.TarmArmaPruebas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmCertificadoFiscalia; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.parmas.soli.TarmDocumentoAlfresco; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmInspeccion; +import com.fp.persistence.parmas.soli.TarmInspeccionArchivo; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitos; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora para consultar documentos en alfresco. + * + * @author Carlos Guzman. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ConsultaAlfrescoController extends AbstractController { + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + @ManagedProperty(value = "#{ingresoFichaTecnicaArmasController}") + private IngresoFichaTecnicaArmasController ingresoFichaTecnicaArmasController; + + //Manu + @ManagedProperty(value = "#{solicitudController}") + private SolicitudController solicitudController; + + @ManagedProperty(value = "#{solicitudGuardiasController}") + private SolicitudGuardiasController solicitudGuardiasController; + + /*reporte alfresco*/ + private TarmDocumentoHabilitante documentoHabilitante = new TarmDocumentoHabilitante(); + private List armaPrueba = new ArrayList<>(); + private List solicitudRequisitos = new ArrayList<>(); + private List inspeccionArchivo = new ArrayList<>(); + private TarmSolicitudTramite solicitudTramite = new TarmSolicitudTramite(); + + //Manu + private TarmSolicitud solicitud = new TarmSolicitud(); + private TarmEvaluacion tarmevaluacion = new TarmEvaluacion(); + private List listaEvaluacionGuardias = new ArrayList<>(); + private List listaCash = new ArrayList<>(); + private List listaPlanificacion; + //New + private List listaInspeccionesNoPlanificacion; + private List listTtarmdecomisoarmaEntrega; + private List listTtarmdecomisoarmaRecepcion; + private List listTarmdecomiso; + private TarmCertificadoFiscalia certificadoFiscalia; + + private String consulta; + + private String tipoDocumento; + private boolean verPanelDocumentos; + + private String year; + private String mes; + private Date fechaDesde; + private Date fechaHasta; + private String centro; + private TarmCentroControl centroControl = new TarmCentroControl(); + + private String documentos; + + private String tipoPersona; + + /** + * Lista de documentos habilitantes suspendidos + */ + private List listaDocumentoHabSus; + + private List listaArmasCompradas; + private TcustPersonDetail tcustPersonDetail; + private List listaTarmVentaArmaTem; + + /** + * Constructor + * + * @throws Exception + */ + public ConsultaAlfrescoController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + solicitudController = new SolicitudController(); + listaDocumentoHabSus = new ArrayList<>(); + listaArmasCompradas = new ArrayList<>(); + listaTarmVentaArmaTem = new ArrayList<>(); + String perfil = this.getLoginController().getRequest().getProfile(); + List lista = MantenimientoDocumentosAlfrescoController.findByProfile(perfil); + if (lista != null && !lista.isEmpty()) { + for (TarmDocumentoAlfresco docAlfresco : lista) { + if ("".equals(documentos)) { + documentos += docAlfresco.getDocumento(); + } else { + documentos += ", " + docAlfresco.getDocumento(); + } + } + } + this.init(); + } + + @Override + protected void querydatabase() { + try { + if ("solicitud".equals(tipoDocumento)) { + if (consulta == null || consulta.isEmpty()) { + return; + } + setSolicitud(SolicitudController.findSolicitudxnumerosolicitud(consulta.trim())); + if (solicitud == null) { + MsgControlArmas.getProperty("msg_error_solicitud_noencontrada"); + return; + } + String consultaCodigo = solicitud.getPk(); + + solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + if (solicitudTramite != null && ("FIN".equals(solicitudTramite.getEstadotramite()) || "APB".equals(solicitudTramite.getEstadotramite()))) { + documentoHabilitante = DocumentoHabilitanteController.findPorSolicitud(consultaCodigo); + } else { + documentoHabilitante = null; + } + + armaPrueba = ingresoFichaTecnicaArmasController.findPorSolicitud(consultaCodigo); + solicitudRequisitos = SolicitudRequisitosController.find(consultaCodigo); + inspeccionArchivo = InspeccionArchivoController.findPorSolicitud(consultaCodigo); +// solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(consultaCodigo); + TcustPersonDetail tcustPersonDetailObj = PersonDetailController.find(solicitud.getPersoncode().toString()); + if (tcustPersonDetailObj.getPersontypecatalog().equals("2")) { + tipoPersona = "JURIDICA"; + this.listaEvaluacionGuardias.clear(); + List lsolicitudGuardias = solicitudGuardiasController.findPorSolicitud(solicitud.getPk()); + if (lsolicitudGuardias != null && !lsolicitudGuardias.isEmpty()) { + for (TarmSolicitudGuardias solicitudGuardias : lsolicitudGuardias) { + TarmEvaluacion tarmEvaluacionGuardia = EvaluacionController.findEvaluacionesVigentes(solicitudGuardias.getPk().getCguardia().toString(), "PSICOLOGICA"); + if (tarmEvaluacionGuardia == null) { + tarmEvaluacionGuardia = new TarmEvaluacion(); + } + TcustPersonDetail tcustPersonDetailGuardia = PersonDetailController.find(solicitudGuardias.getPk().getCguardia().toString()); + tarmEvaluacionGuardia.getModifiedData().put("nombreGuardia", tcustPersonDetailGuardia.getName()); + this.listaEvaluacionGuardias.add(tarmEvaluacionGuardia); + } + } + } else { + tipoPersona = "NATURAL"; + tarmevaluacion = EvaluacionController.findEvaluacionesVigentes(solicitud.getPersoncode().toString(), "PSICOLOGICA"); + } + } else if ("cashManagement".equals(tipoDocumento)) { + listaCash = CashManagementHistoryController.findReportesByDate(fechaDesde, fechaHasta); + } else if ("planificacionAnual".equals(tipoDocumento)) { + listaPlanificacion = AprobacionPlanInspeccionController.findPorAnno(centroControl.getPk(), getYear()); + + List listaInspecciones = InspeccionController.findPorAnno(centroControl.getPk(), getYear()); + if (listaInspecciones != null && !listaInspecciones.isEmpty()) { + listaInspeccionesNoPlanificacion = InspeccionArchivoController.findPorInspeccion(listaInspecciones.get(0).getPk().toString()); + } + + } else if ("decomisos".equals(tipoDocumento)) { + //numero de consulta + if (consulta == null || consulta.isEmpty()) { + return; + } + TarmDecomiso tarmDecomiso = DecomisoController.find(consulta); + if (tarmDecomiso != null) { + listTarmdecomiso = new ArrayList<>(); + listTarmdecomiso.add(tarmDecomiso); + listTtarmdecomisoarmaEntrega = DecomisoArmaTransaccionController.findPorEnvioNroDecomiso("ENTREGA", tarmDecomiso.getPk()); + listTtarmdecomisoarmaRecepcion = DecomisoArmaTransaccionController.findPorEnvioNroDecomiso("RECEPCION", tarmDecomiso.getPk()); + } + } else if ("fiscalia".equals(tipoDocumento)) { + certificadoFiscalia = SolicitudCertificadoController.findPorSolicitud(consulta.trim()); + + } else if ("suspenciondh".equals(tipoDocumento)) { + if (tcustPersonDetail == null || tcustPersonDetail.getPk() == null) { + MessageHelper.setMessageError("SELECCIONE UNA IDENTIFICACI\u00d3N"); + return; + } + listaDocumentoHabSus = DocumentoHabilitanteController.findByPersonCode(tcustPersonDetail.getPk().getPersoncode()); + } else if ("ventaarmas".equals(tipoDocumento)) { + solicitud = null; + if (consulta == null || consulta.trim().isEmpty()) { + MessageHelper.setMessageError("INGRESE EL LOTE"); + return; + } + listaArmasCompradas = ArmasController.findxLoteRegistro(consulta); + } else if ("roboperdida".equals(tipoDocumento)) { + solicitud = null; + if (consulta == null || consulta.trim().isEmpty()) { + MessageHelper.setMessageError("INGRESE EL LOTE"); + return; + } + listaArmasCompradas = ArmasController.findxLotePerdidaRobo(consulta); + } else if ("ventaarmas2".equals(tipoDocumento)) { + solicitud = null; + if (consulta == null || consulta.trim().isEmpty()) { + MessageHelper.setMessageError("INGRESE EL LOTE"); + return; + } + listaTarmVentaArmaTem = TarmVentaArmaTemporalController.findLote(consulta); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para extrer solo el nombre del archivo + * + * @param xpath xpath del archivo en alfresco + * @return solo la parte correspondiente al nombre del archivo + */ + public String soloNombreArchivo(String xpath) { + return xpath.substring(xpath.lastIndexOf(":") + 1, xpath.length()); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.lrecord = new ArrayList<>(); + this.beanalias = "CONSULTAALFRESCO"; + verPanelDocumentos = false; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que analiza si el archivo tiene la extension permitida + * + * @param nombreArchivo + * @return + */ + public Boolean esExtensionDeArchivoPermitida(String nombreArchivo) { + String[] archivosPermitidosLst = {".pdf"}; + for (String extensionValida : archivosPermitidosLst) { + if (nombreArchivo.contains(extensionValida)) { + return Boolean.TRUE; + } + } + return Boolean.FALSE; + } + + public void guardarRegistro() { + } + + public boolean activarPanel(String selectedDocument) { + for (String doc : documentos.split(", ")) { + if (doc.equals(selectedDocument)) { + return true; + } + } + return false; + } + + /** + * Permite actualizar el centro de armas en caso de set tipo + * planificacionAnual + * + * @throws Exception + * + */ + public void actualizarMenu() throws Exception { + tcustPersonDetail = null; + verPanelDocumentos = false; + consulta = ""; + fechaDesde = null; + fechaHasta = null; + year = ""; + if ("planificacionAnual".equals(tipoDocumento)) { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + setCentroControl(CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol())); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + } + + @Override + public void query() throws Exception { + verPanelDocumentos = true; + super.query(); + } + + public static void openLov() { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), true); + // lovpersona es el nombre de la pagina + RequestContext.getCurrentInstance().openDialog("/pages/customer/lov/personLov.xhtml", options, null); + } + + /** + * Maneja la respuesta del Lov de Personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + tcustPersonDetail = (TcustPersonDetail) event.getObject(); + this.getMfilters().put("personcode", tcustPersonDetail.getPk().getPersoncode().toString()); + this.query(); + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + /** + * @return the solicitudController + */ + public SolicitudController getSolicitudController() { + return solicitudController; + } + + /** + * @param solicitudController the solicitudController to set + */ + public void setSolicitudController(SolicitudController solicitudController) { + this.solicitudController = solicitudController; + } + + public IngresoFichaTecnicaArmasController getIngresoFichaTecnicaArmasController() { + return ingresoFichaTecnicaArmasController; + } + + public void setIngresoFichaTecnicaArmasController( + IngresoFichaTecnicaArmasController ingresoFichaTecnicaArmasController) { + this.ingresoFichaTecnicaArmasController = ingresoFichaTecnicaArmasController; + } + + public TarmDocumentoHabilitante getDocumentoHabilitante() { + return documentoHabilitante; + } + + public void setDocumentoHabilitante( + TarmDocumentoHabilitante documentoHabilitante) { + this.documentoHabilitante = documentoHabilitante; + } + + /** + * @return the solicitud + */ + public TarmSolicitud getSolicitud() { + return solicitud; + } + + /** + * @param solicitud the solicitud to set + */ + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + public List getArmaPrueba() { + return armaPrueba; + } + + public void setArmaPrueba(List armaPrueba) { + this.armaPrueba = armaPrueba; + } + + public List getSolicitudRequisitos() { + return solicitudRequisitos; + } + + public void setSolicitudRequisitos( + List solicitudRequisitos) { + this.solicitudRequisitos = solicitudRequisitos; + } + + public List getInspeccionArchivo() { + return inspeccionArchivo; + } + + public void setInspeccionArchivo(List inspeccionArchivo) { + this.inspeccionArchivo = inspeccionArchivo; + } + + public TarmSolicitudTramite getSolicitudTramite() { + return solicitudTramite; + } + + public void setSolicitudTramite(TarmSolicitudTramite solicitudTramite) { + this.solicitudTramite = solicitudTramite; + } + + /** + * @return the tarmevaluacion + */ + public TarmEvaluacion getTarmevaluacion() { + return tarmevaluacion; + } + + /** + * @param tarmevaluacion the tarmevaluacion to set + */ + public void setTarmevaluacion(TarmEvaluacion tarmevaluacion) { + this.tarmevaluacion = tarmevaluacion; + } + + /** + * @return the listaCash + */ + public List getListaCash() { + return listaCash; + } + + /** + * @param listaCash the listaCash to set + */ + public void setListaCash(List listaCash) { + this.listaCash = listaCash; + } + + /** + * @return the centroControl + */ + public TarmCentroControl getCentroControl() { + return centroControl; + } + + /** + * @param centroControl the centroControl to set + */ + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + /** + * @return the listaPlanificacion + */ + public List getListaPlanificacion() { + return listaPlanificacion; + } + + /** + * @param listaPlanificacion the listaPlanificacion to set + */ + public void setListaPlanificacion( + List listaPlanificacion) { + this.listaPlanificacion = listaPlanificacion; + } + + /** + * @return the listTtarmdecomisoarmaEntrega + */ + public List getListTtarmdecomisoarmaEntrega() { + return listTtarmdecomisoarmaEntrega; + } + + /** + * @param listTtarmdecomisoarmaEntrega the listTtarmdecomisoarmaEntrega to + * set + */ + public void setListTtarmdecomisoarmaEntrega( + List listTtarmdecomisoarmaEntrega) { + this.listTtarmdecomisoarmaEntrega = listTtarmdecomisoarmaEntrega; + } + + /** + * @return the listTtarmdecomisoarmaRecepcion + */ + public List getListTtarmdecomisoarmaRecepcion() { + return listTtarmdecomisoarmaRecepcion; + } + + /** + * @param listTtarmdecomisoarmaRecepcion the listTtarmdecomisoarmaRecepcion + * to set + */ + public void setListTtarmdecomisoarmaRecepcion( + List listTtarmdecomisoarmaRecepcion) { + this.listTtarmdecomisoarmaRecepcion = listTtarmdecomisoarmaRecepcion; + } + + public String getConsulta() { + return consulta; + } + + public void setConsulta(String consulta) { + this.consulta = consulta; + } + + public String getTipoDocumento() { + return tipoDocumento; + } + + public void setTipoDocumento(String tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } + + public boolean isVerPanelDocumentos() { + return verPanelDocumentos; + } + + public void setVerPanelDocumentos(boolean verPanelDocumentos) { + this.verPanelDocumentos = verPanelDocumentos; + } + + public String getYear() { + return year; + } + + public void setYear(String year) { + this.year = year; + } + + public String getMes() { + return mes; + } + + public void setMes(String mes) { + this.mes = mes; + } + + public Date getFechaDesde() { + return fechaDesde; + } + + public void setFechaDesde(Date fechaDesde) { + this.fechaDesde = fechaDesde; + } + + public Date getFechaHasta() { + return fechaHasta; + } + + public void setFechaHasta(Date fechaHasta) { + this.fechaHasta = fechaHasta; + } + + public String getCentro() { + return centro; + } + + public void setCentro(String centro) { + this.centro = centro; + } + + /** + * @return the certificadoFiscalia + */ + public TarmCertificadoFiscalia getCertificadoFiscalia() { + return certificadoFiscalia; + } + + /** + * @param certificadoFiscalia the certificadoFiscalia to set + */ + public void setCertificadoFiscalia(TarmCertificadoFiscalia certificadoFiscalia) { + this.certificadoFiscalia = certificadoFiscalia; + } + + public List getListaInspeccionesNoPlanificacion() { + return listaInspeccionesNoPlanificacion; + } + + public void setListaInspeccionesNoPlanificacion( + List listaInspeccionesNoPlanificacion) { + this.listaInspeccionesNoPlanificacion = listaInspeccionesNoPlanificacion; + } + + public List getListTarmdecomiso() { + return listTarmdecomiso; + } + + public void setListTarmdecomiso(List listTarmdecomiso) { + this.listTarmdecomiso = listTarmdecomiso; + } + + public List getListaEvaluacionGuardias() { + return listaEvaluacionGuardias; + } + + public void setListaEvaluacionGuardias( + List listaEvaluacionGuardias) { + this.listaEvaluacionGuardias = listaEvaluacionGuardias; + } + + public String getTipoPersona() { + return tipoPersona; + } + + public void setTipoPersona(String tipoPersona) { + this.tipoPersona = tipoPersona; + } + + public SolicitudGuardiasController getSolicitudGuardiasController() { + return solicitudGuardiasController; + } + + public void setSolicitudGuardiasController( + SolicitudGuardiasController solicitudGuardiasController) { + this.solicitudGuardiasController = solicitudGuardiasController; + } + + public List getListaDocumentoHabSus() { + return listaDocumentoHabSus; + } + + public void setListaDocumentoHabSus( + List listaDocumentoHabSus) { + this.listaDocumentoHabSus = listaDocumentoHabSus; + } + + public List getListaArmasCompradas() { + return listaArmasCompradas; + } + + public void setListaArmasCompradas(List listaArmasCompradas) { + this.listaArmasCompradas = listaArmasCompradas; + } + + public TcustPersonDetail getTcustPersonDetail() { + return tcustPersonDetail; + } + + public void setTcustPersonDetail(TcustPersonDetail tcustPersonDetail) { + this.tcustPersonDetail = tcustPersonDetail; + } + + public List getListaTarmVentaArmaTem() { + return listaTarmVentaArmaTem; + } + + public void setListaTarmVentaArmaTem( + List listaTarmVentaArmaTem) { + this.listaTarmVentaArmaTem = listaTarmVentaArmaTem; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ConsultaArmasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ConsultaArmasController.java new file mode 100644 index 0000000..86ddac0 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ConsultaArmasController.java @@ -0,0 +1,664 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Controlador principal de la funcionalidad de consulta de armas + * + * @author Christian Pazmino + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ConsultaArmasController extends AbstractController { + +// @ManagedProperty(value = "#{registroArmController}") +// private RegistroArmController registroArmas; + /** + * Tipo documento + */ + private String tipoDoc; + + /** + * Número documento + */ + private String numDoc; + + /** + * Nombre/razón social + */ + private String nombreRazon; + + /** + * Longitud arma + */ + private String longitud; + /** + * Calibre arma + */ + private String calibre; + /** + * Clase arma + */ + private String clase; + /** + * Tipo de arma + */ + private String tipoarma; + /** + * unidad medida peso + */ + private String unidadmedidapeso; + + /** + * Bandera que indica que en realidad existe luego del ingreso de datos un + * tipo de arma explosivo válido + */ + private boolean existeTipoArmaExplosivo; + + /** + * Bandera que escifica que se deba verificar que exista un arma explosivo + * válida + */ + private boolean verificaArmaExplosivo = Boolean.TRUE; + + /** + * Bloquea la unidad de cantidad + */ + private boolean bloquearUnidadCantidad = Boolean.TRUE; + + /** + * Bloquea la unidad de peso + */ + private boolean bloquearUnidadPeso = Boolean.TRUE; + + private Date fechaActual; + + private String razonSocial; + + private String numeroDocumento; + + private String filtroPersona; + + private String descategoria; + private String usoActividad; + private Date fec_actual; + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + private TcustPersonDetail customerperson; + private TsafeUserDetail tsafeUserDetailUsuario = null; + + public ConsultaArmasController() throws Exception { + super(TarmArmas.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + fechaActual = new Date(); + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "ARMAS"; + filtroPersona = ""; + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + protected void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + dto.setOrderby("pk"); + Filter filtro = new Filter(); + String sql = "t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma) and t.estado !='DEST' and t.estado!='VEND' and t.estado!='MING' and t.estado!='DUPL' and t.estado!='CUSTEM' and t.estado !='CDP'" + + " and (t.peso>0 or t.cantidad>0) " + filtroPersona;// + filtro.setSql(sql); + dto.addFiltro(filtro); + + + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + for (TarmArmas armasObj : lrecord) { + TarmRegistroArmas registroArmasObj = RegistroArmController + .findByCodigo(armasObj.getCregistro().toString()); + if (registroArmasObj != null && registroArmasObj.getPersoncode() != null) { + TcustPersonDetail propietarioObj = PersonDetailController + .find(registroArmasObj.getPersoncode().toString()); + if (propietarioObj.getIdentificationcatalog() != null + && propietarioObj.getIdentificationcatalogcode() != null) { + armasObj.getModifiedData() + .put("tipoDocumento", + CatalogDetailController + .findxCodigoCodcatalogo(propietarioObj.getIdentificationcatalog(), + propietarioObj.getIdentificationcatalogcode()) + .getDescription()); + } + armasObj.getModifiedData().put("noDocumento", propietarioObj.getIdentification()); + armasObj.getModifiedData().put("nombrerazonsocial", propietarioObj.getName()); + armasObj.getModifiedData().put("paisorigencode", registroArmasObj.getPaisorigen()); + if (armasObj.getModifiedData().get("cclase") != null) { + armasObj.getModifiedData().put("clase", + CatalogDetailController + .findxCodigoCodcatalogo(armasObj.getModifiedData().get("cclase").toString(), + armasObj.getModifiedData().get("cclasecodigo").toString()) + .getDescription()); + } + if (armasObj.getModifiedData().get("ctipoarmaexplosivo") != null) { + armasObj.getModifiedData().put("tipoarmaexplosivo", + CatalogDetailController.findxCodigoCodcatalogo( + armasObj.getModifiedData().get("ctipoarmaexplosivo").toString(), + armasObj.getModifiedData().get("ctipoarmaexplosivocodigo").toString()) + .getDescription()); + } + if (armasObj.getModifiedData().get("ccalibre") != null) { + armasObj.getModifiedData().put("calibre", CatalogDetailController + .findxCodigoCodcatalogo(armasObj.getModifiedData().get("ccalibre").toString(), + armasObj.getModifiedData().get("ccalibrecodigo").toString()) + .getDescription()); + } + + } + } + super.postQuery(this.lrecord); + int i =1; + + + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() throws Exception { + // TODO Auto-generated method stub + super.next(); + } + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", + "i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", + "i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", + "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase = new SubQuery("TarmTipoArmaExplosivo", "clase", "cclase", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo = new SubQuery("TarmTipoArmaExplosivo", "clasecodigo", "cclasecodigo", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud = new SubQuery("TarmTipoArmaExplosivo", "longitud", "clongitud", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo = new SubQuery("TarmTipoArmaExplosivo", "longitudcodigo", "clongitudcodigo", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre = new SubQuery("TarmTipoArmaExplosivo", "calibre", "ccalibre", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo = new SubQuery("TarmTipoArmaExplosivo", "calibrecodigo", "ccalibrecodigo", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivo", "ctipoarmaexplosivo", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivocodigo", + "ctipoarmaexplosivocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapeso", "cunidadmedidapeso", + "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapesocodigo", + "cunidadmedidapesocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida = new SubQuery("TgeneCatalogDetail", "description", "unidadmedida", + "i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode = new SubQuery("TarmRegistroArmas", "personcode", "personcode", + "i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + + SubQuery subqueryFechaemiperm = new SubQuery("TarmDocumentoHabilitante", "fechaemision", "fechaemision", + // " i.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = + // t.cregistro) and i.carma = t.pk and "+ + " i.pk=(select max(doc.pk) " + + " from TarmDocumentoHabilitante doc " + + " where doc.fechaexpiracion >= now() and " + + " doc.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro)" + + " and doc.carma in (select arm1.pk from TarmArmas arm1 where arm1.codigoarma in (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))"); + dto.addSubQuery(subqueryFechaemiperm); + SubQuery subqueryFechaexpperm = new SubQuery("TarmDocumentoHabilitante", "fechaexpiracion", "fechaexpiracion", + // " i.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = + // t.cregistro) and i.carma = t.pk and "+ + " i.pk=(select max(doc.pk) " + + " from TarmDocumentoHabilitante doc " + + " where doc.fechaexpiracion >= now() and " + + " doc.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) " + + " and doc.carma in (select arm1.pk from TarmArmas arm1 where arm1.codigoarma in (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))"); + dto.addSubQuery(subqueryFechaexpperm); + + //uso actividad + SubQuery subqueryUsoactividad = new SubQuery("TgeneCatalogDetail", "description", "usoactividad", + // " i.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = + // t.cregistro) and i.carma = t.pk and "+ + " i.pk.catalog=(select tra.usoactividad " + + " from TarmTramite tra " + + " where tra.pk=(select doc1.ctramite " + + " from TarmDocumentoHabilitante doc1 " + + " where doc1.pk=(select max(doc.pk) " + + " from TarmDocumentoHabilitante doc " + + " where doc.fechaexpiracion >= now() " + + " and doc.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) " + + "and doc.carma in (select arm1.pk " + + " from TarmArmas arm1 " + + " where arm1.codigoarma in (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))" + + ")) and " + + " i.pk.catalogcode=(select tra.usoactividadcodigo " + + " from TarmTramite tra " + + " where tra.pk=(select doc1.ctramite " + + " from TarmDocumentoHabilitante doc1 " + + " where doc1.pk=(select max(doc.pk) " + + " from TarmDocumentoHabilitante doc " + + " where doc.fechaexpiracion >= now() " + + " and doc.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = t.cregistro) " + + "and doc.carma in (select arm1.pk from TarmArmas arm1 " + + " where arm1.codigoarma = (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))" + + ")) "); + dto.addSubQuery(subqueryUsoactividad); + + SubQuery subqueryCategoria = new SubQuery("TgeneCatalogDetail", "description", "categoria", + // " i.personcode=(select r.personcode from TarmRegistroArmas r where r.pk = + // t.cregistro) and i.carma = t.pk and "+ + " i.pk.catalog=(select tra.categoria " + + " from TarmTramite tra " + + " where tra.pk=(select doc1.ctramite " + + " from TarmDocumentoHabilitante doc1 " + + " where doc1.fechaexpiracion >= now() and " + + " doc1.pk=(select max(doc.pk) " + + " from TarmDocumentoHabilitante doc " + + " where doc.personcode=(select r.personcode " + + " from TarmRegistroArmas r where r.pk = t.cregistro) " + + "and doc.carma in (select arm1.pk " + + " from TarmArmas arm1 " + + " where arm1.codigoarma in (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))" + + ")) and " + + " i.pk.catalogcode=(select tra.categoriacodigo " + + " from TarmTramite tra " + + " where tra.pk=(select doc1.ctramite " + + " from TarmDocumentoHabilitante doc1 " + + " where doc1.fechaexpiracion >= now() and " + + " doc1.pk=(select max(doc.pk) " + + " from TarmDocumentoHabilitante doc " + + " where doc.personcode=(select r.personcode " + + " from TarmRegistroArmas r " + + " where r.pk = t.cregistro) " + + "and doc.carma in (select arm1.pk from TarmArmas arm1 where arm1.codigoarma in (select arm.codigoarma from TarmArmas arm where arm.pk=t.pk)))" + + ")) "); + dto.addSubQuery(subqueryCategoria); + + return dto; + } + + /** + * Método que se ejecuta al abrir el LOV de visualizar item + * seleccionado + * + * @throws Exception + */ + public void loadEdit() throws Exception { + verificaArmaExplosivo = Boolean.TRUE; + record.getModifiedData().put("provincia", + ProvinceController.getDescProvByCodigo(record.getCountrycode(), record.getProvincecode())); + record.getModifiedData().put("canton", CantonController.getDescCantonByCodigo(record.getCountrycode(), + record.getProvincecode(), record.getCantoncode())); + record.getModifiedData().put("ciudad", CityController.getDescCiudadByCodigo(record.getCountrycode(), + record.getProvincecode(), record.getCantoncode(), record.getCitycode())); + record.getModifiedData().put("parroquia", ParroquiaController.getDescParroquiaByCodigo(record.getCountrycode(), + record.getProvincecode(), record.getCantoncode(), record.getParroquiacode())); + if (record.getModifiedData().get("paisorigencode") != null) { + record.getModifiedData().put("paisorigen", CountryController + .findcountry(record.getModifiedData().get("paisorigencode").toString()).getDescription()); + } + if (record.getColor() != null) { + record.getModifiedData().put("colorD", CatalogDetailController + .findxCodigoCodcatalogo(record.getColor(), record.getColorcodigo()).getDescription()); + } + /* Aumentado */ + TarmDocumentoHabilitante documento = DocumentoHabilitanteController + .findxarma(record.getCodigoarma().toString()); + + if (documento != null) { + TarmTramite tramite = TarmTramiteController.find(documento.getCtramite().toString()); + if (tramite != null) { + TgeneCatalogDetail catalogo = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), + tramite.getCategoriacodigo()); + descategoria = catalogo.getDescription(); + TgeneCatalogDetail uso = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), + tramite.getUsoactividadcodigo()); + usoActividad = uso.getDescription(); + } + } + + } + + @Override + public void save() { + + } + +// public RegistroArmController getRegistroArmas() { +// return registroArmas; +// } +// +// +// public void setRegistroArmas(RegistroArmController registroArmas) { +// this.registroArmas = registroArmas; +// } + public String getTipoDoc() { + return tipoDoc; + } + + public void setTipoDoc(String tipoDoc) { + this.tipoDoc = tipoDoc; + } + + public String getNumDoc() { + return numDoc; + } + + public void setNumDoc(String numDoc) { + this.numDoc = numDoc; + } + + public String getNombreRazon() { + return nombreRazon; + } + + public void setNombreRazon(String nombreRazon) { + this.nombreRazon = nombreRazon; + } + + public String getLongitud() { + return longitud; + } + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + public String getCalibre() { + return calibre; + } + + public void setCalibre(String calibre) { + this.calibre = calibre; + } + + public String getClase() { + return clase; + } + + public void setClase(String clase) { + this.clase = clase; + } + + public String getTipoarma() { + return tipoarma; + } + + public void setTipoarma(String tipoarma) { + this.tipoarma = tipoarma; + } + + public String getUnidadmedidapeso() { + return unidadmedidapeso; + } + + public void setUnidadmedidapeso(String unidadmedidapeso) { + this.unidadmedidapeso = unidadmedidapeso; + } + + public boolean isExisteTipoArmaExplosivo() { + return existeTipoArmaExplosivo; + } + + public void setExisteTipoArmaExplosivo(boolean existeTipoArmaExplosivo) { + this.existeTipoArmaExplosivo = existeTipoArmaExplosivo; + } + + public boolean isVerificaArmaExplosivo() { + return verificaArmaExplosivo; + } + + public void setVerificaArmaExplosivo(boolean verificaArmaExplosivo) { + this.verificaArmaExplosivo = verificaArmaExplosivo; + } + + public boolean isBloquearUnidadCantidad() { + return bloquearUnidadCantidad; + } + + public void setBloquearUnidadCantidad(boolean bloquearUnidadCantidad) { + this.bloquearUnidadCantidad = bloquearUnidadCantidad; + } + + public boolean isBloquearUnidadPeso() { + return bloquearUnidadPeso; + } + + public void setBloquearUnidadPeso(boolean bloquearUnidadPeso) { + this.bloquearUnidadPeso = bloquearUnidadPeso; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public String getRazonSocial() { + return razonSocial; + } + + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public String getDescategoria() { + return descategoria; + } + + public void setDescategoria(String descategoria) { + this.descategoria = descategoria; + } + + public String getUsoActividad() { + return usoActividad; + } + + public void setUsoActividad(String usoActividad) { + this.usoActividad = usoActividad; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + /** + * Abre el lov de persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Maneja la respuesta del Lov de Personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + + TcustPersonDetail personaDetailSelecionada = (TcustPersonDetail) event.getObject(); + razonSocial = personaDetailSelecionada.getName(); + numeroDocumento = personaDetailSelecionada.getIdentification(); + filtroPersona = " and t.cregistro in (select i.pk from TarmRegistroArmas i where i.personcode =" + + personaDetailSelecionada.getPk().getPersoncode() + ")"; +// List registroArmasList = RegistroArmController.findxPersoncode(personaDetailSelecionada.getPk().getPersoncode().toString()); +// if(registroArmasList!=null && registroArmasList.size()>0){ +// filtroPersona = " and t.cregistro in ("; +// for(TarmRegistroArmas regArmaObj : registroArmasList){ +// filtroPersona+=regArmaObj.getPk().toString() + ","; +// } +// filtroPersona=filtroPersona.substring(0, filtroPersona.length()-1); +// filtroPersona+=")"; +// }else{ +// filtroPersona = " and t.cregistro = -10023"; +// } + querydatabase(); + } + + /** + * Metodo que genera el reporte para el registro seleccionado + * + * @param event + * @throws Exception + */ + public void imprimir(String codigoArma) { + System.out.println("Imprimir un reporte en PDF.. Pendiente implementar"); + try { + String gradoUsuario = ""; + // String path = "armas/reports/reporteArticuloControl"; + String path = "armas/reports/reporteArticuloControl"; + // String path = "armas/subreports/historicoArmasArticuloControl"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename = "reporteArticuloControl"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + //Fecha actual + this.fec_actual = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + parameters.put("fecActual", sdf.format(this.fec_actual)); + + //usuario + customerperson = PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", customerperson.getName()); + parameters.put("carma", codigoArma); + //Fecha actual + Calendar fechaActualCldr = Calendar.getInstance(); + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH) + 1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarFecha", fechaActualSB.toString()); + +// } + String format = "pdf"; + + try { + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CustodiaTempAeropuertoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CustodiaTempAeropuertoController.java new file mode 100644 index 0000000..b91bc97 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CustodiaTempAeropuertoController.java @@ -0,0 +1,747 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.PersonPhoneController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora para el manejo de las custodais temporales del aeropuerto. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CustodiaTempAeropuertoController extends AbstractController { + + /** + * Constructor + * + * @throws Exception + */ + public CustodiaTempAeropuertoController() throws Exception { + super(AbstractDataTransport.class); + } + + /** + * Controlador que maneja la custodiaTemporalController + */ + @ManagedProperty(value = "#{custodiaTemporalController}") + private CustodiaTemporalController custodiaTemporalController; + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmController; + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{armasController}") + private ArmasController armasController; + /** + * Controlador que maneja TarmDecomisoArma + */ + @ManagedProperty(value = "#{decomisoArmaController}") + private DecomisoArmaController decomisoArmaController; + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lprovinces; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcantones; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcities; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lprovincesdest; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcantonesdest; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcitiesdest; + /** + * Atributo del tipo de registro es decomiso + */ + private TgeneCatalogDetail tipoProceso; + /** + * Atributo del tipo de aerolineas + */ + private List aerolineas; + /** + * Atributo del tipo de aeropuertos origen + */ + private List aeropuertosorigen; + /** + * Atributo del tipo de aeropuertos destino + */ + private List aeropuertosdestino; + /** + * + */ + private List lEraser; + /** + * Arma seleccionada para el decomiso + */ + private TarmArmas armaSeleccionada; + /** + * Atributo para setear el centro de control + */ + private TarmCentroControl centroControl; + /** + * Atributo para setear el usuario logeado + */ + private TsafeUserDetail tsafeUserDetail; + /** + * Codigo del catalogo de PHONETYPE telefono fijo + */ + private String codigoTelefonoFijo; + /** + * Codigo del catalogo de ESTADOARM + */ + private String codigoEntregadoEstado; + /** + * Atributo para asignar el detalle de la custodia temporal + */ + private TarmDecomisoArma tarmDecomisoArmaBuscado; + + private Boolean btn = Boolean.FALSE; + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + public void init() { + try { + this.recperpage = 15; + this.lrecord = new ArrayList<>(); + this.beanalias = "CUSTODIATEMPORALAER"; + codigoTelefonoFijo = codigos("CODIGO.PHONE.FIJO"); + codigoEntregadoEstado = codigos("COD.ENTREGADO.ESTADO"); + String proceso = codigos("COD.CUSTODIA.TEMPORAL.TIPOPRO"); + tipoProceso = CatalogDetailController.findxCodigoCodcatalogo(proceso, "TIPOREGISTRO"); + //aerolinea + aerolineas = CatalogDetailController.find("AEROLINEAS"); + //aeropuertos + aeropuertosorigen = CatalogDetailController.find("AEROPUERTOS"); + aeropuertosdestino = CatalogDetailController.find("AEROPUERTOS"); + lprovinces = ProvinceController.find("EC"); + lprovincesdest = ProvinceController.find("EC"); + this.lEraser = new ArrayList(); + // centro de control + obtenerCentroControl(); + custodiaTemporalController.create(); + // seteo de variables + custodiaTemporalController.getRecord().setFechacustodios(new java.sql.Date(new Date().getTime())); + //seteamos el pais + custodiaTemporalController.getRecord().setCountrycodeorigen("EC"); + custodiaTemporalController.getRecord().setCountrycodedest("EC"); + armaSeleccionada = null; + btn = Boolean.FALSE; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para obtener el centro de control + * + * @throws Exception + */ + private void obtenerCentroControl() throws Exception { + tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + HashMap mtables = new HashMap(); + registroArmController.setRecperpage(10000); + DtoQuery dtoRegistroArma = registroArmController.getDtoQuery(true); + mtables.put(registroArmController.getBeanalias(), dtoRegistroArma); + + request.setQueryTables(mtables); + request.put("queryalias", "ARMASPERSONA"); + request.put("querytype", "P"); + request.put("serielote", armasController.getMfilters().get("lote")); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(resp); + } else { + armasController.setLrecord((List) resp.get("ARMASLIST")); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + if (armaSeleccionada == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccioneelarmaacustodiatemporal")); + } + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + //tipo de registro + custodiaTemporalController.getRecord().setTiporegistro(tipoProceso.getPk().getCatalog()); + custodiaTemporalController.getRecord().setTiporegistrocode(tipoProceso.getPk().getCatalogcode()); + //aerolinea + custodiaTemporalController.getRecord().setAerolineacode("AEROLINEAS"); + //centro control + custodiaTemporalController.getRecord().setCcentrocontrol(centroControl.getPk()); + //aeropuerto origen + custodiaTemporalController.getRecord().setAeropuertoorigcode("AEROPUERTOS"); + //aeropuerto destino + custodiaTemporalController.getRecord().setAeropuertodestcode("AEROPUERTOS"); + //persona que registra la custodia + custodiaTemporalController.getRecord().setPersoncode(tsafeUserDetail.getPk().getPersoncode()); + custodiaTemporalController.update(); + DtoSave dtosaveCustodiaTem = custodiaTemporalController.getDtoSave(); + dtosaveCustodiaTem.setPosition(1); + msave.put(custodiaTemporalController.getBeanalias(), dtosaveCustodiaTem); + + //arma + armasController.clearAll(); + armaSeleccionada.setIsnew(true); + armaSeleccionada.setPk(null); + //fecha de registro + armaSeleccionada.setFecharegistro(new java.sql.Date(new Date().getTime())); + //estado anterior + armaSeleccionada.getModifiedData().put("estadoanterior", armaSeleccionada.getEstado()); + //nuevo estado + TgeneCatalogDetail estadoArma = CatalogDetailController.find("ESTADOARMA", tipoProceso.getLegalcode()).get(0); + armaSeleccionada.setEstado(estadoArma.getPk().getCatalog()); + armaSeleccionada.setEstadocodigo("ESTADOARMA"); + armasController.actualizar(armaSeleccionada); + DtoSave dtosaveArma = armasController.getDtoSave(); + dtosaveArma.setPosition(2); + msave.put(armasController.getBeanalias(), dtosaveArma); + + //decomisoarma es el detalle de la custodia temporal + DtoSave dtosaveDecomisoArma = decomisoArmaController.getDtoSave(); + dtosaveDecomisoArma.setPosition(3); + msave.put(decomisoArmaController.getBeanalias(), dtosaveDecomisoArma); + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + custodiaTemporalController.getRecord().setNotransaccion(resp.get("numerotransaccion").toString()); + armaSeleccionada = null; + btn = Boolean.TRUE; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que debuelve los datos del la custodia temporal Arma decomisada + * + * @param numeroTransaccion + */ + public void buscarDecomiso(String numeroTransaccion) { + try { + if (numeroTransaccion != null && numeroTransaccion.length() > 0) { + //custodia temporal + custodiaTemporalController.setRecord(CustodiaTemporalController.findNotransaccion(numeroTransaccion)); + if (custodiaTemporalController.getRecord() != null && custodiaTemporalController.getRecord().getPk() != null) { + //tarmDecomisoArma + TgeneCatalogDetail estadoArma = CatalogDetailController.find("ESTADOARMA", tipoProceso.getLegalcode()).get(0); + tarmDecomisoArmaBuscado = DecomisoArmaController.findxCodigoCustTemporal(custodiaTemporalController.getRecord().getPk(), estadoArma.getPk().getCatalog()); + if (tarmDecomisoArmaBuscado != null) { + //decomiso del arma + armaSeleccionada = ArmasController.findxCodigo(tarmDecomisoArmaBuscado.getCarma()); + armaSeleccionada.getModifiedData().put("observacion", tarmDecomisoArmaBuscado.getObservacion()); + //Se puso el PK del arma en el mapa para que se presente en el dialogo de entrega material y no desaparezca + armaSeleccionada.getModifiedData().put("pk", armaSeleccionada.getPk()); + armasController.setLrecord(new ArrayList()); + armasController.getLrecord().add(armaSeleccionada); + executeProvince(); + executeProvinceDestino(); + executeCanton(); + executeCantonDestino(); + //propietario + TcustPersonDetail personDetail = PersonDetailController.find(custodiaTemporalController.getRecord().getPersoncodeprop().toString()); + custodiaTemporalController.getRecord().getModifiedData().put("tipodocumento", personDetail.getModifiedData().get("destipoidentificacion")); + custodiaTemporalController.getRecord().getModifiedData().put("numerodocumento", personDetail.getIdentification()); + custodiaTemporalController.getRecord().getModifiedData().put("nombrerazonsocial", personDetail.getName()); + TcustPersonPhone personPhone = PersonPhoneController.find(custodiaTemporalController.getRecord().getPersoncodeprop().toString(), codigoTelefonoFijo); + if (personPhone != null) { + custodiaTemporalController.getRecord().getModifiedData().put("telefono", personPhone.getPhonenumber()); + } + } else { + this.init(); + } + } else { + this.init(); + } + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para la entrega del arma y cambio de estado Guarda en la BD + */ + public void saveEntrega() { + try { + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + //arma + armasController.clearAll(); + armaSeleccionada.setIsnew(true); + armaSeleccionada.setPk(null); + //fecha de registro + armaSeleccionada.setFecharegistro(new java.sql.Date(new Date().getTime())); + //nuevo estado debe regresar al estado anterior + armaSeleccionada.setEstado(tarmDecomisoArmaBuscado.getEstadoanterior()); + //fecha de registro + armaSeleccionada.setFecharegistro(new java.sql.Date(new Date().getTime())); + armasController.actualizar(armaSeleccionada); + DtoSave dtosaveArma = armasController.getDtoSave(); + dtosaveArma.setPosition(1); + msave.put(armasController.getBeanalias(), dtosaveArma); + + //decomisoarma es el detalle de la custodia temporal + decomisoArmaController.clearAll(); + tarmDecomisoArmaBuscado.setIsnew(true); + tarmDecomisoArmaBuscado.setPk(null); + //estado entregado + tarmDecomisoArmaBuscado.setEstado(codigoEntregadoEstado); + decomisoArmaController.setRecord(tarmDecomisoArmaBuscado); + //la fecha de registro + tarmDecomisoArmaBuscado.setFdecomiso((new Timestamp(new java.util.Date().getTime()))); + decomisoArmaController.update(); + DtoSave dtosaveDecomisoArma = decomisoArmaController.getDtoSave(); + dtosaveDecomisoArma.setPosition(2); + msave.put(decomisoArmaController.getBeanalias(), dtosaveDecomisoArma); + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + armaSeleccionada = null; + btn = Boolean.TRUE; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para inicializar la lista de las armas y la validacion del + * propietario del arma + */ + public void registrarMaterial() { + try { + if (custodiaTemporalController.getRecord().getPersoncodeprop() == null || custodiaTemporalController.getRecord().getPersoncodeprop() == 0) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionepropietario")); + return; + } + armasController.setLrecord(new ArrayList()); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + //lov de persona + /** + * Método para abrir el lov de personas + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Maneja la respuesta del Lov de Personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail personaDetailSelecionada = (TcustPersonDetail) event.getObject(); + custodiaTemporalController.getRecord().setPersoncodeprop(personaDetailSelecionada.getPk().getPersoncode()); + custodiaTemporalController.getRecord().getModifiedData().put("tipodocumento", personaDetailSelecionada.getModifiedData().get("destipoidentificacion")); + custodiaTemporalController.getRecord().getModifiedData().put("numerodocumento", personaDetailSelecionada.getIdentification()); + custodiaTemporalController.getRecord().getModifiedData().put("nombrerazonsocial", personaDetailSelecionada.getName()); + custodiaTemporalController.getRecord().getModifiedData().put("telefono", personaDetailSelecionada.getModifiedData().get("telefono")); + registroArmController.getMfilters().put("personcode", personaDetailSelecionada.getPk().getPersoncode().toString()); + } + + /** + * Método para manejar el evento change en el CheckBox Arma a + * decomisar + * + * @throws Exception + */ + public void onChange(TarmArmas arma) throws Exception { + for (TarmArmas t : armasController.getLrecord()) { + t.getModifiedData().put("estado", Boolean.FALSE); + if (arma.getPk().equals(t.getPk())) { + t.getModifiedData().put("estado", Boolean.TRUE); + } + } + } + + /** + * Metodo que se ejecuta al pulsar el boton aceptar del dialog que lista las + * armas a seleccionar Valida si selecciono algun registro si no le obliga a + * seleccionar + */ + public void aceptarPopup() { + //validamos que de la lista exista un registro escogido + armaSeleccionada = null; + for (TarmArmas t : armasController.getLrecord()) { + if (Boolean.TRUE.equals(t.getModifiedData().get("estado"))) { + if (t.getModifiedData().get("observacion") == null || t.getModifiedData().get("observacion").toString().length() == 0) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingreselaobservacion")); + return; + } + armaSeleccionada = t; + } + } + if (armaSeleccionada == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccioneelarmaacustodiatemporal")); + return; + } + } + + /** + * Metodo que se ejecuta al pulsar el boton cancelar del dialog de listado + * de las armas Cambia el estado a false de las armas seleccionadas + */ + public void cancelarPopup() { + armaSeleccionada = null; + for (TarmArmas t : armasController.getLrecord()) { + t.getModifiedData().put("estado", Boolean.FALSE); + } + } + + /** + * Metodo para buscar el propietario del arma y asignarle al arma + */ + public void cargarPropietario() { + for (TarmArmas arma : armasController.getLrecord()) { + if (arma.getModifiedData().get("personcode") != null) { + TcustPersonDetail personaDetalle = PersonDetailController.find(arma.getModifiedData().get("personcode").toString()); + arma.getModifiedData().put("propietario", personaDetalle.getName()); + } + } + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince() { + if ((custodiaTemporalController.getRecord().getCountrycodeorigen() != null) && (custodiaTemporalController.getRecord().getCountrycodeorigen().compareTo("") != 0)) { + lcantones = CantonController.find(custodiaTemporalController.getRecord().getCountrycodeorigen(), custodiaTemporalController.getRecord().getProvincecodeorigen()); + lcities = new ArrayList<>(); + lEraser = new ArrayList<>(); + lprovincesdest = new ArrayList<>(); + for (TgeneProvince prov : lprovinces) { + if (prov.getPk().getProvincecode().equals(this.custodiaTemporalController.getRecord().getProvincecodeorigen())) { + this.lEraser.add(prov); + continue; + } else { + lprovincesdest.add(prov); + } + + } + + } + } + + /** + * Método para el evento change del combo aereopuertos + */ + public void executeAereopuerto() { + aeropuertosdestino = new ArrayList<>(); + lEraser = new ArrayList<>(); + for (TgeneCatalogDetail aereo : this.aeropuertosorigen) { + if (aereo.getPk().getCatalog().equals(this.custodiaTemporalController.getRecord().getAeropuertoorig())) { + this.lEraser.add(aereo); + continue; + } else { + aeropuertosdestino.add(aereo); + } + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton() { + if ((custodiaTemporalController.getRecord().getCountrycodeorigen() != null) && (custodiaTemporalController.getRecord().getCountrycodeorigen().compareTo("") != 0)) { + lcities = CityController.find(custodiaTemporalController.getRecord().getCountrycodeorigen(), custodiaTemporalController.getRecord().getProvincecodeorigen(), + custodiaTemporalController.getRecord().getCantoncodeorigen()); + } + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvinceDestino() { + if ((custodiaTemporalController.getRecord().getCountrycodedest() != null) && (custodiaTemporalController.getRecord().getCountrycodedest().compareTo("") != 0)) { + lcantonesdest = CantonController.find(custodiaTemporalController.getRecord().getCountrycodedest(), custodiaTemporalController.getRecord().getProvincecodedest()); + lcitiesdest = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCantonDestino() { + if ((custodiaTemporalController.getRecord().getCountrycodedest() != null) && (custodiaTemporalController.getRecord().getCountrycodedest().compareTo("") != 0)) { + lcitiesdest = CityController.find(custodiaTemporalController.getRecord().getCountrycodedest(), custodiaTemporalController.getRecord().getProvincecodedest(), + custodiaTemporalController.getRecord().getCantoncodedest()); + } + } + + /** + * Metodo para obtener los codigos + */ + public String codigos(String parametro) { + TgeneParameters tgeneParameters = ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + public CustodiaTemporalController getCustodiaTemporalController() { + return custodiaTemporalController; + } + + public void setCustodiaTemporalController( + CustodiaTemporalController custodiaTemporalController) { + this.custodiaTemporalController = custodiaTemporalController; + } + + public ArmasController getArmasController() { + return armasController; + } + + public void setArmasController(ArmasController armasController) { + this.armasController = armasController; + } + + public DecomisoArmaController getDecomisoArmaController() { + return decomisoArmaController; + } + + public void setDecomisoArmaController( + DecomisoArmaController decomisoArmaController) { + this.decomisoArmaController = decomisoArmaController; + } + + public List getLprovinces() { + return lprovinces; + } + + public void setLprovinces(List lprovinces) { + this.lprovinces = lprovinces; + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public List getLcities() { + return lcities; + } + + public void setLcities(List lcities) { + this.lcities = lcities; + } + + public TgeneCatalogDetail getTipoProceso() { + return tipoProceso; + } + + public void setTipoProceso(TgeneCatalogDetail tipoProceso) { + this.tipoProceso = tipoProceso; + } + + public List getAerolineas() { + return aerolineas; + } + + public void setAerolineas(List aerolineas) { + this.aerolineas = aerolineas; + } + + public List getLprovincesdest() { + return lprovincesdest; + } + + public void setLprovincesdest(List lprovincesdest) { + this.lprovincesdest = lprovincesdest; + } + + public List getLcantonesdest() { + return lcantonesdest; + } + + public void setLcantonesdest(List lcantonesdest) { + this.lcantonesdest = lcantonesdest; + } + + public List getLcitiesdest() { + return lcitiesdest; + } + + public void setLcitiesdest(List lcitiesdest) { + this.lcitiesdest = lcitiesdest; + } + + public TarmArmas getArmaSeleccionada() { + return armaSeleccionada; + } + + public void setArmaSeleccionada(TarmArmas armaSeleccionada) { + this.armaSeleccionada = armaSeleccionada; + } + + public RegistroArmController getRegistroArmController() { + return registroArmController; + } + + public void setRegistroArmController(RegistroArmController registroArmController) { + this.registroArmController = registroArmController; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public TsafeUserDetail getTsafeUserDetail() { + return tsafeUserDetail; + } + + public void setTsafeUserDetail(TsafeUserDetail tsafeUserDetail) { + this.tsafeUserDetail = tsafeUserDetail; + } + + public Boolean getBtn() { + return btn; + } + + public void setBtn(Boolean btn) { + this.btn = btn; + } + + public List getAeropuertosorigen() { + return aeropuertosorigen; + } + + public void setAeropuertosorigen(List aeropuertosorigen) { + this.aeropuertosorigen = aeropuertosorigen; + } + + public List getAeropuertosdestino() { + return aeropuertosdestino; + } + + public void setAeropuertosdestino(List aeropuertosdestino) { + this.aeropuertosdestino = aeropuertosdestino; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CustodiaTemporalController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CustodiaTemporalController.java new file mode 100644 index 0000000..8b05f9a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CustodiaTemporalController.java @@ -0,0 +1,136 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmCustodiaTemporal; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TarmDecomiso. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CustodiaTemporalController extends AbstractController { + + /** + * Constructor + * + * @throws Exception + */ + public CustodiaTemporalController() throws Exception { + super(TarmCustodiaTemporal.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + public void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CUSTODIATEM"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que consulta por Catalog y Catalogcode ambos requeridos + */ + public static TarmCustodiaTemporal findNotransaccion(String notransaccion) { + try {//TgeneCatalogDetailKey + CustodiaTemporalController cc = new CustodiaTemporalController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("notransaccion", notransaccion); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CustodiosController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CustodiosController.java new file mode 100644 index 0000000..8546469 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/CustodiosController.java @@ -0,0 +1,240 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.soli.TarmOrdenTrabajoCustodios; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CustodiosController extends AbstractController { + + //Grados + List lGrados = new ArrayList(); + Boolean salva = false; + + public CustodiosController() throws Exception { + super(TarmOrdenTrabajoCustodios.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "CUSTODIOSCONTROLLER"; + this.record = new TarmOrdenTrabajoCustodios(); + record.isnew = true; + querydatabase(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + //Obteniendo la lista de grados militares + lGrados = CatalogDetailController.find("MILITARYGRADE"); + + /* + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + //Obteniendo la lista de grados militares + lGrados=CatalogDetailController.find("GRADOS"); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + */ + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void update(TarmOrdenTrabajoCustodios bean) throws Exception { + record = bean; + update(); + } + + public void update(List bean) throws Exception { + for (TarmOrdenTrabajoCustodios cus : bean) { + record = cus; + update(); + } + } + + @Override + public void update() throws Exception { + Boolean duplicada = false; + if (this.record != null) { + for (TarmOrdenTrabajoCustodios custodio : this.lrecord) { + if (custodio.getCedulacustodio().equalsIgnoreCase(this.record.getCedulacustodio())) { + duplicada = true; + } + } + if (!this.salva && duplicada) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("cedulaDuplicada")); + } else { + super.update(); + } + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Devuelve la descripcion de un grado dado su codigo + * + * @param gradoCodigo + * @return + */ + @SuppressWarnings("finally") + public String grado(String gradoCodigo) { + String descripcionGrado = ""; + + for (TgeneCatalogDetail cd : lGrados) { + if (cd.getLegalcode().equalsIgnoreCase(gradoCodigo)) { + return cd.getDescription(); + } + } + + return descripcionGrado; + } + + /** + * Obtiene todos los custodios + * + * @return List + */ + public static List find() { + try { + CustodiosController cc = new CustodiosController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Obtiene los custodios de una orden de trabajo + * + * @return List + */ + public static List findByCodigoOrden(Long cordentrabajo) { + try { + CustodiosController cc = new CustodiosController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("cordentrabajo", cordentrabajo.toString()); + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public List getlGrados() { + return lGrados; + } + + public void setlGrados(List lGrados) { + this.lGrados = lGrados; + } + + public Boolean getSalva() { + return salva; + } + + public void setSalva(Boolean salva) { + this.salva = salva; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DecomisoArmaController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DecomisoArmaController.java new file mode 100644 index 0000000..356292c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DecomisoArmaController.java @@ -0,0 +1,363 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class DecomisoArmaController extends AbstractController { + + public DecomisoArmaController() throws Exception { + super(TarmDecomisoArma.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "TARMDECOMISOARMA"; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + for (TarmDecomisoArma decomisoArma : lrecord) { + TarmArmas arma = ArmasController.findPorCodigo(decomisoArma.getCarma()); + if (arma != null) { + TarmTipoArmaExplosivo tipoArmaExplosivo = TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo()); + decomisoArma.getModifiedData().put("ntipo", arma.getModifiedData().get("tipo")); + decomisoArma.getModifiedData().put("ncalibre", arma.getModifiedData().get("calibre")); + decomisoArma.getModifiedData().put("nclase", arma.getModifiedData().get("clase")); + if (tipoArmaExplosivo.getLongitud() != null) { + decomisoArma.getModifiedData().put("nlongitud", CatalogDetailController.findxCodigoCodcatalogo(tipoArmaExplosivo.getLongitud(), tipoArmaExplosivo.getLongitudcodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tipoArmaExplosivo.getLongitud(), tipoArmaExplosivo.getLongitudcodigo()).getDescription() : ""); + } else { + decomisoArma.getModifiedData().put("nlongitud", ""); + } + decomisoArma.getModifiedData().put("nmarca", CatalogDetailController.findxCodigoCodcatalogo(arma.getMarca(), arma.getMarcacodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(arma.getMarca(), arma.getMarcacodigo()).getDescription() : ""); + decomisoArma.getModifiedData().put("nserie", arma.getSeriecanon()); + decomisoArma.getModifiedData().put("nlote", arma.getLote()); + decomisoArma.getModifiedData().put("nunidad", CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getUnidadmedida(), decomisoArma.getUnidadmedidacode()) != null ? CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getUnidadmedida(), decomisoArma.getUnidadmedidacode()).getDescription() : ""); + + decomisoArma.getModifiedData().put("nmotivodecomiso", CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getMotivodecomiso(), decomisoArma.getMotivodecomisocodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getMotivodecomiso(), decomisoArma.getMotivodecomisocodigo()).getDescription() : ""); + + TarmRegistroArmas registroArma = RegistroArmController.findByCodigo(arma.getCregistro().toString()); + if (registroArma != null && registroArma.getPersoncode() != null) { + Integer personCodePropietario = registroArma.getPersoncode(); + decomisoArma.getModifiedData().put("npropietario", PersonDetailController.find(personCodePropietario.toString()).getName()); + } else { + decomisoArma.getModifiedData().put("npropietario", ""); + } + } + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + protected void consulta() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + Filter filtro = new Filter(); + filtro.setSql("t.fdecomiso=(select max(te.fdecomiso) from TarmDecomisoArma te where te.ccustemp=t.ccustemp)"); + dto.addFiltro(filtro); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + public static TarmDecomisoArma findByCodigo(String cDecomisoArma) { + try { + DecomisoArmaController cc = new DecomisoArmaController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", cDecomisoArma); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findByCodigoDecomiso(String cDecomiso) { + try { + DecomisoArmaController cc = new DecomisoArmaController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("cdecomiso", cDecomiso); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmDecomisoArma findxCodigoCustTemporal(String ccustemp, String estado) { + try { + DecomisoArmaController cc = new DecomisoArmaController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("ccustemp", ccustemp); + cc.addFilter("estado", estado); + cc.consulta(); + if (cc.lrecord != null && cc.lrecord.size() > 0) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public void update(TarmDecomisoArma bean) throws Exception { + record = bean; + update(); + } + + public static List find(Long codigoenvio) { + try { + DecomisoArmaController cc = new DecomisoArmaController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("cdecarmtranrecepcion", codigoenvio.toString()); + cc.querydatabaseSimple(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findArmasPorSancionar(Long codigoenvio) { + try { + DecomisoArmaController cc = new DecomisoArmaController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("cdecarmtranrecepcion", codigoenvio.toString()); + cc.addFilter("estado", "RECL"); + cc.querydatabaseSimple(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findEnvio(Long codigoenvio) { + try { + DecomisoArmaController cc = new DecomisoArmaController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("cdecomisoarmatransaccion", codigoenvio.toString()); + cc.querydatabaseSimple(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaseSimple() { + try { + DtoQuery dto = this.getDtoQuery(); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryClasecatalogo = new SubQuery("TgeneCatalogDetail", "description", "nclase", "i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma)) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o " + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))"); + dto.addSubQuery(subqueryClasecatalogo); + SubQuery subqueryTipoArmaExplosivo = new SubQuery("TgeneCatalogDetail", "description", "ntipo", "i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o " + + " where o.pk= (select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))" + + " and i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "nmarca", "i.pk.catalog= (select o.marca from TarmArmas o where o.pk=t.carma)" + + " and i.pk.catalogcode=(select o.marcacodigo from TarmArmas o where o.pk=t.carma)"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryCalibre = new SubQuery("TarmTipoArmaExplosivo", "calibre", "ncalibre", "i.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma)"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryLote = new SubQuery("TarmArmas", "lote", "nserie", "i.pk=t.carma"); + dto.addSubQuery(subqueryLote); + + SubQuery subqueryNRecivo = new SubQuery("TarmDecomiso", "numerorecibo", "nrecibo", "i.pk=t.cdecomiso"); + dto.addSubQuery(subqueryNRecivo); + SubQuery subqueryNTransaccion = new SubQuery("TarmDecomiso", "numerotransaccion", "numerotransaccion", "i.pk=t.cdecomiso"); + dto.addSubQuery(subqueryNTransaccion); + SubQuery subqueryUnidadTipo = new SubQuery("TgeneCatalogDetail", "description", "nunidad", "i.pk.catalog= (select o.unidadmedidapeso from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma)) and " + + " i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))"); + dto.addSubQuery(subqueryUnidadTipo); + + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog= (select o.color from TarmArmas o where o.pk=t.carma)" + + " and i.pk.catalogcode=(select o.colorcodigo from TarmArmas o where o.pk=t.carma)"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog= (select o.estado from TarmArmas o where o.pk=t.carma) " + + " and i.pk.catalogcode=(select o.estadocodigo from TarmArmas o where o.pk=t.carma)"); + dto.addSubQuery(subqueryEstado); + + SubQuery subqueryIndentificacion = new SubQuery("TcustPersonDetail", "identification", "identification", "i.pk.personcode=(select p from TarmRegistroArmas p where p.pk=(select o.cregistro from TarmArmas o where o.pk=t.carma)) " + + " and i.pk.dateto=to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryIndentificacion); + SubQuery subqueryRazonSocial = new SubQuery("TcustPersonDetail", "name", "nrazons", "i.pk.personcode=(select p.personcode from TarmRegistroArmas p where p.pk=(select o.cregistro from TarmArmas o where o.pk=t.carma)) " + + " and i.pk.dateto=to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryRazonSocial); + return dto; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DecomisoArmaTransaccionController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DecomisoArmaTransaccionController.java new file mode 100644 index 0000000..715110b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DecomisoArmaTransaccionController.java @@ -0,0 +1,314 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class DecomisoArmaTransaccionController extends AbstractController { + + public DecomisoArmaTransaccionController() + throws Exception { + super(TarmDecomisoArmaTransaccion.class); + } + + @Override + protected void querydatabase() { + + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "DECOMISOARMATRANSACCION"; + querydatabase(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void save() { + try { + update(); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para encontrar por numero de envío + * + * @param envio + * @param esRecepcion + * @return listado de los registros que cumplen el criterio de busqueda + */ + public static List findPorEnvio(String envio, boolean esRecepcion) { + try { + DecomisoArmaTransaccionController cc = new DecomisoArmaTransaccionController(); + cc.init(); + cc.recperpage = 15; + cc.addFilter("numerotransaccion", envio); + if (esRecepcion) { + cc.addFilter("estadofirma", "Y"); + } + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para encontrar por el pk + * + * @param cdeocmisoarmatransaccion + */ + public static TarmDecomisoArmaTransaccion find(String cdeocmisoarmatransaccion) { + try { + DecomisoArmaTransaccionController cc = new DecomisoArmaTransaccionController(); + cc.init(); + cc.recperpage = 15; + cc.addFilter("pk", cdeocmisoarmatransaccion); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * + * @param envio + * @return + */ + public static List findPorEnvioNroDecomiso(String tipoDecomiso, Long numeroDecomiso) { + try { + DecomisoArmaTransaccionController cc = new DecomisoArmaTransaccionController(); + cc.init(); + cc.recperpage = 15; + cc.querydatabaseManu(tipoDecomiso, numeroDecomiso); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + protected void querydatabaseManu(String tipoDecomiso, Long numeroDecomiso) { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + if (numeroDecomiso != null) { + Filter f = null; + f = new Filter(); + + if ("ENTREGA".equals(tipoDecomiso)) { + f.setSql("t.pk in (select tr.cdecomisoarmatransaccion from com.fp.persistence.parmas.soli.TarmDecomisoArma tr where tr.cdecomiso = " + numeroDecomiso + ")"); + } else if ("RECEPCION".equals(tipoDecomiso)) { + f.setSql("t.pk in (select tr.cdecarmtranrecepcion from com.fp.persistence.parmas.soli.TarmDecomisoArma tr where tr.cdecomiso = " + numeroDecomiso + ")"); + } + dto.addFiltro(f); + } + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + /** + * + * @param envio + * @return + */ + public static List findPorOrganismoUnidad(String codigoUnidadControl, Date fechaCorte, String operacion) { + try { + DecomisoArmaTransaccionController cc = new DecomisoArmaTransaccionController(); + cc.init(); + cc.recperpage = 10000; + cc.querydatabaseByFechaCorte(fechaCorte, codigoUnidadControl, operacion); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + protected void querydatabaseByFechaCorte(Date fechaCorte, String codigoUnidadControl, String operacion) { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + Filter f = null; + f = new Filter(); + SimpleDateFormat formato = new SimpleDateFormat("yyyy-MM-dd"); + String ccentrocontrol = ""; + ccentrocontrol = "tb.ccentrocontroldestino = '" + codigoUnidadControl + "'"; +// if(operacion.equals("ENVIO")){ +// ccentrocontrol = "tb.ccentrocontroldestino = '" + codigoUnidadControl+"'" ; +// }else{ +// ccentrocontrol = "tb.ccentrocontrolorigen = '" + codigoUnidadControl+"'" ; +// } + + f.setSql("t.ftransaccion <= " + "TO_DATE('" + formato.format(fechaCorte) + "','yyyy-MM-dd')" + + " and t.pk in (select tb.cdecomisoarmatransaccion from com.fp.persistence.parmas.soli.TarmTransaccionArmaBodega tb where " + + ccentrocontrol + " and tb.operacion = '" + operacion + "') and estadofirma = 'Y'" + ); + dto.addFiltro(f); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + /** + * + * @param envio + * @return + */ + public static List findParaReception(String codigoUnidadControl) { + try { + DecomisoArmaTransaccionController cc = new DecomisoArmaTransaccionController(); + cc.init(); + cc.recperpage = 100; + cc.querydatabaseForReception(codigoUnidadControl); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + protected void querydatabaseForReception(String codigoUnidadControl) { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + Filter f = new Filter(); + f.setSql("t.estadoflujo = 'ENV' and t.estadofirma = 'Y' and " + + " t.pk in (select tb.cdecomisoarmatransaccion from com.fp.persistence.parmas.soli.TarmDecomisoArma tb where tb.coperaciontransaccion = 'ENVIO')" + + " and t.pk in (select tba.cdecomisoarmatransaccion from com.fp.persistence.parmas.soli.TarmTransaccionArmaBodega tba where tba.ccentrocontroldestino = '" + codigoUnidadControl + "')"); + dto.addFiltro(f); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DecomisoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DecomisoController.java new file mode 100644 index 0000000..e4774c6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DecomisoController.java @@ -0,0 +1,338 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pentaho.PentahoController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TarmDecomiso. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class DecomisoController extends AbstractController { + + /** + * Constructor + * + * @throws Exception + */ + public DecomisoController() throws Exception { + super(TarmDecomiso.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "DECOMISO"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + if (getMfilelds().get("ccentrocontroldestino") != null) { + Filter filtro = new Filter(); + filtro.setSql(getMfilelds().get("ccentrocontroldestino").toString()); + dto.addFiltro(filtro); + } + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + protected void querydatabaseSimple() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + Filter filtroFinal = new Filter(); + String format = new SimpleDateFormat("MM-YY").format(Calendar.getInstance().getTime()); + String sqlFiltro = "TO_CHAR(t.fecharegistro, 'MM-YY') = '" + format + "'"; + filtroFinal.setSql(sqlFiltro); + dto.addFiltro(filtroFinal); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void updateDecomiso(TarmDecomiso bean) throws Exception { + record = bean; + record.setIsnew(false); + record.put("ORIGINALBEAN", bean.get("ORIGINALBEAN")); + super.update(); + } + + @ManagedProperty(value = "#{pentahoController}") + private PentahoController pentahoController; + + public PentahoController getPentahoController() { + return pentahoController; + } + + public void setPentahoController(PentahoController pentahoController) { + this.pentahoController = pentahoController; + } + + /** + * Método para obtener el decomiso por el codigo de decomiso + * + * @param cRecibo + * @return + */ + public static TarmDecomiso findByCodigo(String cRecibo) { + try { + DecomisoController cc = new DecomisoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", cRecibo); + + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para filtrar por codigo de centro de control + * + * @param ccentroControl + * @param numerotransaccion + * @return + */ + public static List findByCodigoCentroControl(String ccentroControl, String numerotransaccion) { + try { + DecomisoController cc = new DecomisoController(); + cc.init(); + cc.recperpage = 10000; + + if (ccentroControl != null && !ccentroControl.isEmpty()) { + cc.addFilter("ccentrocontrol", ccentroControl); + } + if (numerotransaccion != null && !numerotransaccion.isEmpty()) { + cc.addFilter("numerotransaccion", numerotransaccion); + } + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para filtrar por codigo de centro de control + * + * @param ccentroControl + * @return + */ + public static List findByCentroControl(String ccentroControl) { + try { + DecomisoController cc = new DecomisoController(); + cc.init(); + cc.recperpage = 10000; + + if (ccentroControl != null && !ccentroControl.isEmpty()) { + cc.addField("ccentrocontroldestino", "(ccentrocontrol='" + ccentroControl + "' and ccentrocontroldestino is null) or (ccentrocontroldestino='" + ccentroControl + "')"); + } + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para filtrar por OrganismoControl y Unidad + * + * @param organismoControlCode + * @return + */ + public static List findByOrganismoControlUnidad(String organismoControlCode, String unidadCode) { + try { + DecomisoController cc = new DecomisoController(); + cc.init(); + cc.recperpage = 10000; + + TgeneCatalogDetail organismoControlCatalog = CatalogDetailController.findCatalogo("INSTITUCION", organismoControlCode); + + if (organismoControlCatalog != null && unidadCode != null) { + cc.addField("ccentrocontroldestino", "(unidad='" + unidadCode + "' and organismocontrol='" + organismoControlCatalog.getDescription() + "')"); + } + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para filtrar por OrganismoControl + * + * @param numeroRecibo numero de recibo + * @param tipoProceso tipo de proceso + * @param organismoControl organismo de control + * @return + */ + public static boolean findReciboByTipoProcesoOrganismoControl(String numeroRecibo, String tipoProceso, String organismoControl) { + + try { + DecomisoController cc = new DecomisoController(); + cc.init(); + cc.recperpage = 1000; + if (numeroRecibo != null && !numeroRecibo.isEmpty()) { + cc.addFilter("numerorecibo", numeroRecibo); + } + if (tipoProceso != null && !tipoProceso.isEmpty()) { + cc.addFilter("tipoproceso", tipoProceso); + } + if (organismoControl != null && !organismoControl.isEmpty()) { + cc.addFilter("ccentrocontrol", organismoControl); + } + + cc.querydatabaseSimple(); + if (cc.lrecord != null && cc.lrecord.size() > 0) { + return true; + } + return false; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return false; + } + } + + public static TarmDecomiso find(String numerotransaccion) { + try { + DecomisoController cc = new DecomisoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("numerotransaccion", numerotransaccion); + cc.querydatabase(); + if (cc.lrecord != null && cc.lrecord.size() > 0) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DecomisoMaterialController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DecomisoMaterialController.java new file mode 100644 index 0000000..91f24b0 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DecomisoMaterialController.java @@ -0,0 +1,2387 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang.StringUtils; +import org.primefaces.context.RequestContext; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.SelectEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.lov.ArmaExplosivoLovController; +import com.fp.frontend.controller.armas.lov.ArmasLovController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.PersonPhoneController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.ValidateIdentification; +import com.fp.frontend.webservices.snap.cedula.ClienteCedula; +import com.fp.frontend.webservices.snap.ruc.ClienteRUC; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +import ec.gob.registrocivil.consultacedula.Cedula; +import ec.gov.sri.wsconsultacontribuyente.Contribuyente; + +/** + * Clase controladora del bean TarmDecomiso. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class DecomisoMaterialController extends AbstractController { + + /** + * Constructor + * + * @throws Exception + */ + public DecomisoMaterialController() throws Exception { + super(AbstractDataTransport.class); + } + /** + * Controlador que maneja el decomiso + */ + @ManagedProperty(value = "#{decomisoController}") + private DecomisoController decomisoController; + /** + * Controlador que maneja PersonDetail + */ + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController personDetailController; + /** + * Controlador que maneja PersonPhone + */ + @ManagedProperty(value = "#{personPhoneController}") + private PersonPhoneController personPhoneController; + + /** + * Detalle del usuario + */ + private TcustPersonDetail usuario; + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{armasController}") + private ArmasController armasController; + + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{armasLovController}") + private ArmasLovController armasLovController; + /** + * Controlador que maneja TarmRegistroArmas + */ + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmController; + /** + * Controlador que maneja TarmDecomisoArma + */ + @ManagedProperty(value = "#{decomisoArmaController}") + private DecomisoArmaController decomisoArmaController; + /** + * Controlador Inyectado ReportController + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lprovinces; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcantones; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lparroquias; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcities; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List tipoProceso; + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List tipoDocumeno; + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List grados; + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List unidades; + + private TsafeUserDetail tsafeUserDetail; + + private String centroControl; + + private String unidad; + + private TarmCentroControl centroControlLogeado; + + private List centroControls; + /** + * Deshabilita la pantalla después de grabar la solicitud + */ + private boolean deshabilitarPantalla; + /** + * Deshabilita la pantalla materiales después de grabar la solicitud + */ + private boolean deshabilitarPantallaMaterial; + /** + * Atributo para setear el portador del arma + */ + private TcustPersonDetail tcustPersonDetailPortador; + + private String nombrePortador; + /** + * /** + * Atributo para ingresar el numero de identificacion del propietario + */ + private String identificacionPro; + /** + * Atributo para ingresar el tipo de identificacion del propietario + */ + private String tipoIdentificacionPro; + /** + * Variables de tipo boolean para selecionar el usuario sin portador + */ + private boolean sinPortador; + /** + * Variables de tipo boolean para selecionar el usuario sin documento + */ + private boolean sinDocumento; + + /** + * Variables de tipo boolean para habilitar el boton crear en el lov + * registro material + */ + private boolean habilitaNoDecomiso; + /** + * Variables que permite el ingreso de un portador + */ + private String ingresoPortador; + /** + * Variables de tipo boolean para selecionar el usuario sin portador + */ + private boolean sinIdentificacion; + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List motivoDecomisoList; + /** + * Listado de marcas + */ + private List lmarca; + /** + * Listado de colores + */ + private List lcolor; + /** + * Listado de tipos de fabricación + */ + private List ltipofabricacion; + /** + * Listado de paises + */ + private List lcountry; + + /** + * codigo del de arma + */ + private String codigoArma; + /** + * codigo del ruc + */ + private String codigoRuc; + /** + * codigo del ruc + */ + private String codigoCedula; + /** + * codigo de la persona por defaul + */ + private String codigoPersonaSinIdentificacion; + + private String codigoTelefonoFijo; + /** + * descripción de la unidad de medida + */ + private String codigoUnidadpeso; + /** + * codigo del ruc + */ + private String codigoPasaporte; + /** + * descripción de la unidad de medida + */ + private String unidadpeso; + /** + * descripción de la unidad de medida + */ + private String descripcionUnidadpeso; + /** + * Tipo del arma explosivo + */ + private TarmTipoArmaExplosivo tipoArmaExplosivo; + /** + * Arma seleccionada para el decomiso + */ + private List armaSeleccionadaList; + /** + * atributo para bloquear el boton + */ + private Boolean btn; + + /** + * atributo para bloquear el boton + */ + private Boolean btnfileUpload; + + /** + * atributo para bloquear el boton save + */ + private Boolean btnSave; + + /** + * atributo para bloquear el boton + */ + private Boolean btnRegistro; + + /** + * atributo para bloquear el boton tramite sino executa el reporte registo + */ + private Boolean isExecuteRegistro; + /** + * codigo del pais de origen + */ + private String codigoPaisOrigen; + /** + * Variable para el envio del mail + */ + private String cdecomiso; + + private Boolean btnPeso; + + private Boolean btnCantidad; + /** + * codigo de la provincia del usuario que se logueo + */ + private String cprovincia; + + /** + * latitud de la direccin en el google map + */ + private String latitud; + /** + * longitud de la direccin en el google map + */ + private String longitud; + /** + * direccion en la que se va ha visualizar el map + */ + private String direccionGoogleMap; + /** + * Propiedad que premite controlar operaciones de cargar archivos al + * Alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + /** + * Variable que nos permite cargar el comprobante de deposito al Alfresco + */ + private UploadedFile uploadedFile; + /** + * tipoMapa permite visualizar la posicion del mapa por direccion o por + * coordenadas + */ + private String tipoMapa; + /** + * Nombre de la persona o empresa del decomisado sin documento + */ + private String nombrerazonsocialsindoc; + + private String latitudG; + private String latitudM; + private String latitudS; + private String longuitudG; + private String longuitudM; + private String longuitudS; + + private String latitudGMS; + private String longitudGMS; + /** + * Se recupera el filename del pdf para la descarga. + */ + private String filename; + /** + * Se recupera del pdf el byteArray para la descarga. + */ + private byte[] byteArray; + + /** + * Indica si se debe activar la pestana de seleccionar material + */ + private boolean seleccionarMaterial; + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + public void init() { + try { + setDireccionGoogleMap("Ecuador"); + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "DECOMISOMATERIAL"; + decomisoController.create(); + decomisoController.clearAll(); + personDetailController.create(); + armasController.clearAll(); + getArmasLovController().clearAll(); + seleccionarMaterial = Boolean.FALSE; + btn = Boolean.FALSE; + btnfileUpload = Boolean.FALSE; + btnSave = Boolean.TRUE; + btnRegistro = Boolean.TRUE; + isExecuteRegistro = Boolean.FALSE; + deshabilitarPantalla = Boolean.FALSE; + deshabilitarPantallaMaterial = Boolean.FALSE; + sinDocumento = Boolean.FALSE; + habilitaNoDecomiso = Boolean.FALSE; + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + //obtencion del centro de control + obtenerProvincia(); + //centroControls=CatalogDetailController.find("INSTITUCION"); + centroControl = tsafeUserDetail.getModifiedData().get("centrocontrol").toString(); + unidad = tsafeUserDetail.getModifiedData().get("unidad").toString(); + + lprovinces = ProvinceController.find("EC"); + //catalogo de (decomiso incautacion) + tipoProceso = CatalogDetailController.find("TIPOREGISTRO", "DECINC"); + tipoDocumeno = CatalogDetailController.find("IDENTIFICATION"); + grados = CatalogDetailController.find("MILITARYGRADE"); + unidades = new ArrayList<>(); + + lmarca = CatalogDetailController.find("MARCA"); + lcolor = CatalogDetailController.find("COLOR"); + ltipofabricacion = CatalogDetailController.find("TIPOFABRICACION"); + lcountry = CountryController.find(); + // seteo de variables + decomisoController.getRecord().setFecharegistro(new java.sql.Date(new Date().getTime())); + //decomisoController.getRecord().setOrganismocontrol(centroControl.getModifiedData().get("desinstitucion").toString()); + decomisoController.getRecord().setCountrycode("EC"); + //consulta de los codigos a utilizarse en la pantalla + codigoArma = codigos("CODIGO.ARMADEFUEGO"); + codigoRuc = codigos("CODIGO.RUC"); + codigoCedula = codigos("CODIGO.CEDULA"); + codigoPasaporte = codigos("CODIGO.PASAPORTE"); + codigoUnidadpeso = codigos("CODIGO.PESO"); + //codigoPersonaPortador=codigos("CODIGO.PERSONA.SINPORTADOR"); + codigoTelefonoFijo = codigos("CODIGO.PHONE.FIJO"); + codigoPersonaSinIdentificacion = codigos("CODIGO.PERSONA.SINPROPIETARIO"); + tcustPersonDetailPortador = null; + sinPortador = Boolean.FALSE; + armaSeleccionadaList = new ArrayList(); + cdecomiso = null; + btnPeso = Boolean.FALSE; + btnCantidad = Boolean.FALSE; + latitudG = ""; + latitudM = ""; + latitudS = ""; + longuitudG = ""; + longuitudM = ""; + longuitudS = ""; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para obtener el centro de control + * + * @throws Exception + */ + private void obtenerProvincia() throws Exception { + tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + if (tcustPersonAddres != null && tcustPersonAddres.getProvincecode() != null) { + cprovincia = tcustPersonAddres.getProvincecode(); + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_notienedireccionprincipal")); + return; + } + } + + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = getDtoQuery(true); + HashMap mtables = new HashMap(); + mtables.put(getBeanalias(), dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(resp); + } else { + resp.get(getBeanalias()); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + + //valida que el documento de activida de control este cargado + if (uploadedFile == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionearchivodecomisoincautacion")); + return; + } + + //valida si esta ingresado el funcionario + if (decomisoController.getRecord().getFuncionario() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingrese_funcionario")); + return; + } + //Accion de dialog materiales + //armasSeleccionada(); + + //valida que el arma este seleccionada + if (armaSeleccionadaList == null || armaSeleccionadaList.size() == 0) { + String tipoprocesoStr = catalogoDescripcion(tipoProceso, decomisoController.getRecord().getTipoproceso()); + if (tipoprocesoStr == null || tipoprocesoStr.isEmpty()) { + tipoprocesoStr = " DECOMISO"; + } + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccioneelarmaarealizareldecomisoincautacion") + " " + tipoprocesoStr); + return; + } + + if (sinDocumento) {//validamos que se haya pulsado el boton de verificar o selecionado no propietario + tcustPersonDetailPortador = PersonDetailController.find(codigoPersonaSinIdentificacion); + decomisoController.getRecord().setNumerodocumento(tcustPersonDetailPortador.getIdentification()); + if (nombrerazonsocialsindoc != null && !nombrerazonsocialsindoc.isEmpty()) { + decomisoController.getRecord().setNombrerazonsocial(nombrerazonsocialsindoc); + } + } + //validamos si tcustPersonDetailPortador este lleno o si han seleccionado sin portador para asignarle el por default + if (sinPortador) {//validamos que se haya pulsado el boton de verificar o selecionado no propietario + tcustPersonDetailPortador = PersonDetailController.find(codigoPersonaSinIdentificacion); + decomisoController.getRecord().setNumerodocumento(tcustPersonDetailPortador.getIdentification()); + } + if (tcustPersonDetailPortador == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionesinportadoroverifiqueusuarioexistente")); + return; + } + HashMap msave = new HashMap(); +//----------datos del PERSONA + actualizaDatosPersonaPortador(); + //persona detalle + DtoSave dtosavePersondetail = personDetailController.getDtoSave(); + dtosavePersondetail.setReturnpk(true); + dtosavePersondetail.setPosition(1); + msave.put(personDetailController.getBeanalias(), dtosavePersondetail); + //telefono + DtoSave dtosavePersonphone = personPhoneController.getDtoSave(); + dtosavePersonphone.setReturnpk(true); + dtosavePersonphone.setPosition(6); + msave.put(personPhoneController.getBeanalias(), dtosavePersonphone); + //----------DATOS DE ARMAS-REGISTRO DE ARMAS + //registro de armas + armasSeleccionadas(); + //armas + DtoSave dtosaveArma = armasController.getDtoSave();//lleno + dtosaveArma.setPosition(3); + msave.put(armasController.getBeanalias(), dtosaveArma); + //registroarma + DtoSave dtosaveRegistroArma = registroArmController.getDtoSave();//vacio + dtosaveRegistroArma.setReturnpk(true); + dtosaveRegistroArma.setPosition(2); + msave.put(registroArmController.getBeanalias(), dtosaveRegistroArma); +//----------DECOMISO + //decomiso incautacion + //codigo de la person a que realiza el decomiso + decomisoController.getRecord().setPersoncoderegistra(tsafeUserDetail.getPk().getPersoncode()); + //tipo proceso + decomisoController.getRecord().setTipoprocesocode("TIPOREGISTRO"); + //tipo identificacion + decomisoController.getRecord().setTipodocumentocode("IDENTIFICATION"); + //tipo de gardo del militar + decomisoController.getRecord().setGradofuncionariocode("MILITARYGRADE"); + //catalogo del centro de control + decomisoController.getRecord().setCcentrocontrol(tsafeUserDetail.getCcentrocontrol()); + decomisoController.getRecord().setOrganismocontrol(centroControl); + decomisoController.update(); + + DtoSave dtosaveDecomiso = decomisoController.getDtoSave(); + dtosaveDecomiso.setPosition(4); + dtosaveDecomiso.setReturnpk(true); + msave.put(decomisoController.getBeanalias(), dtosaveDecomiso); +//----------DECOMISO ARMA CONTROLLER + DtoSave dtosaveDecomisoArma = decomisoArmaController.getDtoSave(); + dtosaveDecomisoArma.setPosition(5); + msave.put(decomisoArmaController.getBeanalias(), dtosaveDecomisoArma); + + msave.put(this.beanalias, dtosave); + request.setSaveTables(msave); +//---------TransactionRule DecomisoMAterial + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + btn = Boolean.TRUE; + btnSave = Boolean.TRUE; + btnRegistro = Boolean.FALSE; + deshabilitarPantalla = Boolean.TRUE; + deshabilitarPantallaMaterial = Boolean.TRUE; + decomisoController.postCommit(resp); + decomisoController.getRecord().setNumerotransaccion(resp.get("numerotransaccion").toString()); + cdecomiso = resp.get("cdecomiso").toString(); + + //----------ARCHIVO ALFRESCO + subirArchivoAlfresco(); + imprimir(); + decomisoController.getRecord().setIsnew(false); + //Se actualizan los path de los reportes en el alfresco + decomisoController.update(); + decomisoController.save(); + + uploadedFile = null; + armaSeleccionadaList = null; + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("lbl_numerotransaccion") + ": " + resp.get("numerotransaccion").toString()); + + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que permite grabar el documento de decommiso en el Alfresco + * + * @param decomiso + * + */ + public void subirArchivoAlfresco() { + try { + + String tipoprocesoStr = catalogoDescripcion(tipoProceso, decomisoController.getRecord().getTipoproceso()); + + String xPathLocation = getRutaDocumentoSolBase() + "/cm:" + unidad.replace(" ", "_") + "/cm:" + tipoprocesoStr.replace(" ", "_") + "/cm:" + decomisoController.getRecord().getNumerotransaccion(); + if (uploadedFile != null && uploadedFile.getFileName() != null) { + String extencionArchivo = getExtension(uploadedFile.getFileName()); + String nombreArchivo = "CMPREC-" + decomisoController.getRecord().getNumerorecibo() + "." + extencionArchivo; + //"cm:Decomiso/cm:A-2016/cm:M-01/cm:CENTRO CONTROL/cm:ABANDONO/cm:ABAN-00000123/cm:CMPREC-000000319.pdf" + decomisoController.getRecord().setXpath(xPathLocation + "/cm:" + nombreArchivo); + if (alfrescoController.uploadFile(uploadedFile.getInputstream(), nombreArchivo, xPathLocation)) { + decomisoController.getRecord().setXpath(xPathLocation + "/cm:" + nombreArchivo); + + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_decomisoSinDatosAsociados")); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingreseDocumentoDecomiso")); + } + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Throwable e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Metodo que genera el reporte recibo registro + * + * @param fila + */ + public void imprimir() { + try { + + querydatabase(); + //String gradoUsuario =""; + String path = "armas/reports/registrodecomisomaterial"; + //String filename="REGISTRODECOMISO"+"-"+decomisoController.getRecord().getNumerorecibo(); + filename = "CMPREG-" + decomisoController.getRecord().getNumerorecibo(); + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + String tipoprocesoStr = catalogoDescripcion(tipoProceso, decomisoController.getRecord().getTipoproceso()); + String provinciaStr = ProvinceController.getDescProvByCodigo(decomisoController.getRecord().getCountrycode(), decomisoController.getRecord().getProvincecode()); + String cantonStr = CantonController.getDescCantonByCodigo(decomisoController.getRecord().getCountrycode(), decomisoController.getRecord().getProvincecode(), decomisoController.getRecord().getCantoncode()); + String cuidadStr = CityController.getDescCiudadByCodigo(decomisoController.getRecord().getCountrycode(), decomisoController.getRecord().getProvincecode(), decomisoController.getRecord().getCantoncode(), decomisoController.getRecord().getCitycode()); + String parroquiaStr = ParroquiaController.getDescParroquiaByCodigo(decomisoController.getRecord().getCountrycode(), decomisoController.getRecord().getProvincecode(), decomisoController.getRecord().getCantoncode(), decomisoController.getRecord().getParroquiacode()); + + //Tipo Proceso + parameters.put("tipoproceso", "RECIBO DE REGISTRO " + tipoprocesoStr); + //No. Transaccion + parameters.put("pnumerotransaccion", decomisoController.getRecord().getNumerotransaccion()); + //Nombre de la persona que decommisa + parameters.put("nombredecomisadopor", decomisoController.getRecord().getFuncionario()); + //No. Documento + parameters.put("numerodocumento", decomisoController.getRecord().getCedulafuncionario()); + //Organismo de Control + parameters.put("organismocontrol", decomisoController.getRecord().getOrganismocontrol()); + //Unidad de Control + parameters.put("unidadcontrol", unidad); + //No. Comprobante recibo + parameters.put("numerocomprobante", decomisoController.getRecord().getNumerorecibo()); + //Fecha Decomiso + parameters.put("fechadecomiso", decomisoController.getRecord().getFechadecomiso()); + //Fecha Registro Decomiso + parameters.put("fecharegistrodecomiso", decomisoController.getRecord().getFecharegistro()); + //Provincia Decomiso + parameters.put("provinciadecomiso", provinciaStr); + //Canton Decomiso + parameters.put("cantondecomiso", cantonStr); + //Cuidad Decomiso + parameters.put("cuidaddecomiso", cuidadStr); + //Parroquia Decomiso + parameters.put("parroquiadecomiso", parroquiaStr); + //Direccion Decomiso + parameters.put("direcciondecomiso", decomisoController.getRecord().getDireccion()); + //Portador Decomiso + parameters.put("portadordecomiso", decomisoController.getRecord().getNombrerazonsocial()); + //No. Documento Portador + parameters.put("numerodocumentoportador", decomisoController.getRecord().getNumerodocumento()); + //Usuario + parameters.put("usuario", this.usuario.getName()); + //Fecha + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + + String format = "pdf"; + + byteArray = this.reportController.jaspertoByteArray(path, parameters, format, filename, this.getLoginController()); + + // Se obtiene el InputStream para subir el archivo alfresco + InputStream inputStream = new ByteArrayInputStream(byteArray); + + String nombreArchivo = (filename != null && !filename.isEmpty()) ? filename + "." + format : null; + String xPathLocation = getRutaDocumentoSolBase() + "/cm:" + unidad.replace(" ", "_") + "/cm:" + tipoprocesoStr.replace(" ", "_") + "/cm:" + decomisoController.getRecord().getNumerotransaccion(); + //="cm:Decomiso/cm:A-2016/cm:M-01/cm:CENTRO CONTROL/cm:ABANDONO/cm:ABAN-00000123/cm:CMPREG-000000319.pdf" + if (nombreArchivo != null && xPathLocation != null && inputStream != null) { + decomisoController.getRecord().setComprobantexpath(xPathLocation + "/cm:" + nombreArchivo); + if (alfrescoController.uploadFile(inputStream, nombreArchivo, xPathLocation)) { + decomisoController.getRecord().setComprobantexpath(xPathLocation + "/cm:" + nombreArchivo); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_subiroarchivoregistrorecibo").concat("(" + nombreArchivo + ")")); + + } + //Se executo el reporte + //isExecuteRegistro= Boolean.TRUE; + } catch (Exception ex) { + //isExecuteRegistro= Boolean.FALSE; + MessageHelper.setMessageError(ex); + return; + } + + } + + /** + * Metodo que genera el reporte recibo registro + */ + public void imprimirDocGenerado() { + try { + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + // Se nombra igual que el documento pdf que se encuentra en el alfresco + response.addHeader("Content-disposition", "attachment; filename=" + filename + ".pdf"); + + OutputStream outputStream = response.getOutputStream(); + // Se escribe en el documento pdf el byte array recuperado del metodo imprimir + outputStream.write(byteArray); + outputStream.flush(); + outputStream.close(); + FacesContext.getCurrentInstance().responseComplete(); + } catch (Exception ex) { + + MessageHelper.setMessageError(ex); + return; + } + } + + /** + * Actualiza los datos del portador del arma + * + * @throws Exception + */ + private void actualizaDatosPersonaPortador() throws Exception { + personDetailController.clearAll(); + // VALIDAMOS EL PORTADOR + if (tcustPersonDetailPortador.getPk() == null || tcustPersonDetailPortador.getPk().getPersoncode() == null) { + // seteamos al portador + tcustPersonDetailPortador.setIsnew(true); + tcustPersonDetailPortador.setName(decomisoController.getRecord().getNombrerazonsocial()); + tcustPersonDetailPortador.setIdentification(decomisoController.getRecord().getNumerodocumento()); + tcustPersonDetailPortador.setIdentificationcatalog(decomisoController.getRecord().getTipodocumento()); + tcustPersonDetailPortador.setIdentificationcatalogcode("IDENTIFICATION"); + personDetailController.setRecord(tcustPersonDetailPortador); + personDetailController.update(); + // creacion del telefono + if (decomisoController.getRecord().getTelefono() != null && decomisoController.getRecord().getTelefono().length() > 0) { + personPhoneController.create(); + personPhoneController.getRecord().setPhonetypecatalog(codigoTelefonoFijo); + personPhoneController.getRecord().setPhonetypecatalogcode("PHONETYPE"); + personPhoneController.getRecord().setPhonenumber(decomisoController.getRecord().getTelefono()); + personPhoneController.actualizar(); + } + } else { + decomisoController.getRecord().setPersoncode(tcustPersonDetailPortador.getPk().getPersoncode()); + } + } + + /** + * Valida el si selecciona un arma + * + * @throws Exception + */ + private void armasSeleccionadas() throws Exception { + armasController.clearAll(); + TgeneCatalogDetail estadoArma = CatalogDetailController.find("ESTADOARMA", decomisoController.getRecord().getTipoproceso()).get(0); + for (TarmArmas armas : armaSeleccionadaList) { + //TarmArmas t= (TarmArmas)armas.cloneMe(); + armasController.setRecord((TarmArmas) armas.cloneMe()); + //t.getModifiedData().put("estadoseleccion",Boolean.FALSE); //selecciona solo un registro + if (armasController.getRecord().getModifiedData().get("estadoseleccion").equals(Boolean.TRUE)) { + armasController.getRecord().setIsnew(true); + armasController.getRecord().setPk(null); + armasController.getRecord().setEstado(estadoArma.getPk().getCatalog()); + armasController.getRecord().setEstadocodigo("ESTADOARMA"); + //fech de registro + armasController.getRecord().setFecharegistro(new java.sql.Date(new Date().getTime())); + armasController.actualizar(armasController.getRecord()); + } + } + } + + /** + * Método que limpia las variables cuando escoge tipo documento + */ +// public void tipoDocumentoSel(AjaxBehaviorEvent event){ +// if(event.getComponent().getAttributes().get("value") != null){ + public void tipoDocumentoSel() { + if (this.decomisoController.getRecord().getTipodocumento() != null) { + ingresoPortador = "CON DOCUMENTO"; + validacioIngresoPortador(); + } else { + ingresoPortador = null; + validacioIngresoPortador(); + + } + } + + /** + * Método que limpia las variables cundo chequea sin portador + */ + public void sinPortador() { + + if (sinPortador) { + ingresoPortador = "SIN PORTADOR"; + validacioIngresoPortador(); + } else { + ingresoPortador = null; + validacioIngresoPortador(); + } + + } + + /** + * Método que limpia las variables cundo chequea sin portador + */ + public void sinDocumento() { + if (sinDocumento) { + ingresoPortador = "SIN DOCUMENTO"; + validacioIngresoPortador(); + } else { + ingresoPortador = null; + validacioIngresoPortador(); + } + + } + + private void validacioIngresoPortador() { + if (ingresoPortador == null) { + sinDocumento = Boolean.FALSE; + sinPortador = Boolean.FALSE; + this.decomisoController.getRecord().setTipodocumento(null); + this.decomisoController.getRecord().setNumerodocumento(null); + this.decomisoController.getRecord().setNombrerazonsocial(null); + } else if (ingresoPortador.equals("SIN PORTADOR")) { + sinDocumento = Boolean.FALSE; + this.decomisoController.getRecord().setTipodocumento(null); + this.decomisoController.getRecord().setNumerodocumento(null); + this.decomisoController.getRecord().setNombrerazonsocial(null); + } else if (ingresoPortador.equals("SIN DOCUMENTO")) { + sinPortador = Boolean.FALSE; + this.decomisoController.getRecord().setTipodocumento(null); + this.decomisoController.getRecord().setNumerodocumento(null); + this.decomisoController.getRecord().setNombrerazonsocial(null); + + } else if (ingresoPortador.equals("CON DOCUMENTO")) { + sinPortador = Boolean.FALSE; + sinDocumento = Boolean.FALSE; + /*this.decomisoController.getRecord().setNumerodocumento(null); + this.decomisoController.getRecord().setNombrerazonsocial(null);*/ + } + + } + + /** + * Método para inicializar la lista de las armas y validacién + * de los datos del portador + */ + public void registrarMaterial() { + if (!sinPortador && !sinDocumento) { + validarPortador(); + } + //valida que el documento de activida de control este cargado + if (uploadedFile == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_recuerdeClickCargarDocActControl")); + return; + } + armasController.setLrecord(new ArrayList()); + armasController.getMfilters().put("lote", null); + + if (decomisoController.getRecord().getTipoproceso().equals("INCA")) { + habilitaNoDecomiso = Boolean.TRUE; + } + deshabilitarPantalla = Boolean.TRUE; + seleccionarMaterial = Boolean.TRUE; + btnfileUpload = Boolean.TRUE; + btn = Boolean.TRUE; + btnSave = Boolean.TRUE; + FacesContext context = FacesContext.getCurrentInstance(); + context.addMessage(null, new FacesMessage("RECUERDE", MsgControlArmas.getProperty("msg_recuerdeClickTabRegMaterial"))); + + } + + public void changeTipoProceso() { + + if (decomisoController.getRecord().getTipoproceso().equals("INCA")) { + habilitaNoDecomiso = Boolean.TRUE; + } else { + habilitaNoDecomiso = Boolean.FALSE; + } + + String catalogReg = decomisoController.getRecord().getTipoproceso(); + motivoDecomisoList = new ArrayList(); + if (catalogReg != null && !catalogReg.equals("")) { + if (catalogReg.equals("INCA")) { + catalogReg = "DECO"; + } + motivoDecomisoList = CatalogDetailController.find("MOTIVODECOMISO", + catalogReg); + } else { + motivoDecomisoList = CatalogDetailController.find("MOTIVODECOMISO"); + } + } + + /** + * Método que se ejecuta al pulsar el boton aceptar del dialog que + * lista las armas a seleccionar Valida si selecciono algun registro si no + * le obliga a seleccionar + */ + public void armasSeleccionada() { + //validamos que de la lista exista un registro escogido + armaSeleccionadaList = new ArrayList(); + for (TarmArmas t : armasController.getLrecord()) { + if (Boolean.TRUE.equals(t.getModifiedData().get("estadoseleccion"))) { + armaSeleccionadaList.add(t); + } + } + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince() { + if ((decomisoController.getRecord().getCountrycode() != null) && (decomisoController.getRecord().getCountrycode().compareTo("") != 0)) { + lcantones = CantonController.find(decomisoController.getRecord().getCountrycode(), decomisoController.getRecord().getProvincecode()); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton() { + if ((decomisoController.getRecord().getCountrycode() != null) && (decomisoController.getRecord().getCountrycode().compareTo("") != 0)) { + lparroquias = ParroquiaController.find(decomisoController.getRecord().getCountrycode(), decomisoController.getRecord().getProvincecode(), decomisoController.getRecord().getCantoncode()); + lcities = CityController.find(decomisoController.getRecord().getCountrycode(), decomisoController.getRecord().getProvincecode(), decomisoController.getRecord().getCantoncode()); + } + } + + /** + * Método para el evento change del combo ciudad + */ + public void executeCiudad() { + if ((decomisoController.getRecord().getCantoncode() != null) && (decomisoController.getRecord().getCantoncode().compareTo("") != 0)) { + List lcities = CityController.find(decomisoController.getRecord().getCountrycode(), decomisoController.getRecord().getProvincecode(), decomisoController.getRecord().getCantoncode()); + setDireccionGoogleMap(lcities.get(0).getDescription() + ", " + "Ecuador"); + } + } + + /** + * Método que valida la persona portadora del arma o explosivo en las + * tablas de maia y en la snap + * + */ + public void validarPortador() { + //this.decomisoController.getRecord().setNombrerazonsocial(null); +//-------------------validar SELECCION TIPO UBICACION + if (tipoMapa == null || "".equals(tipoMapa)) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipoMapa")); + return; + } +//-------------------validar LATITUD Y LONGITUD + if (decomisoController.getRecord().getLatitud() == null || decomisoController.getRecord().getLongitud() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselongitudlatitud")); + return; + } + if (decomisoController.getRecord().getNumerodocumento() == null || decomisoController.getRecord().getTipodocumento() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselacedula")); + return; + } + if (decomisoController.getRecord().getTipodocumento().equals(codigoCedula)) { +//----------validamos si es valida la CEDULA + if (!ValidateIdentification.cedula(decomisoController.getRecord().getNumerodocumento())) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en MAIA + tcustPersonDetailPortador = buscarPersonaMaia(decomisoController.getRecord().getNumerodocumento(), decomisoController.getRecord().getTipodocumento()); + if (tcustPersonDetailPortador == null) { + //envia a buscar en la SNAP + tcustPersonDetailPortador = buscarPersonaSnap(decomisoController.getRecord().getNumerodocumento(), decomisoController.getRecord().getTipodocumento()); + } + } else if (decomisoController.getRecord().getTipodocumento().equals(codigoRuc)) { +//----------validamos si es valida el RUC + if (!ValidateIdentification.ruc(decomisoController.getRecord().getNumerodocumento())) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en maia + tcustPersonDetailPortador = buscarPersonaMaia(decomisoController.getRecord().getNumerodocumento(), decomisoController.getRecord().getTipodocumento()); + if (tcustPersonDetailPortador == null) { + //envia a buscar en la snap + tcustPersonDetailPortador = buscarPersonaSnap(decomisoController.getRecord().getNumerodocumento(), decomisoController.getRecord().getTipodocumento()); + } + } else { +//----------si es PASAPORTE + tcustPersonDetailPortador = buscarPersonaMaia(decomisoController.getRecord().getNumerodocumento(), decomisoController.getRecord().getTipodocumento()); + if (tcustPersonDetailPortador == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_usuarionoencontrado")); + tcustPersonDetailPortador = new TcustPersonDetail(); + tcustPersonDetailPortador.setIdentification(decomisoController.getRecord().getNumerodocumento()); + tcustPersonDetailPortador.setIdentificationcatalog(decomisoController.getRecord().getTipodocumento()); + tcustPersonDetailPortador.setIdentificationcatalogcode("IDENTIFICATION"); + tcustPersonDetailPortador.setName(decomisoController.getRecord().getNombrerazonsocial()); + + } + } + //validamos que existe la persona en Maia o SNAP + if (tcustPersonDetailPortador != null && tcustPersonDetailPortador.getIdentification() != null && tcustPersonDetailPortador.getName() != null) { + //seteamos el nombre para visualizarle + decomisoController.getRecord().setNombrerazonsocial(tcustPersonDetailPortador.getName()); + nombrePortador = tcustPersonDetailPortador.getName(); + } else if (!decomisoController.getRecord().getTipodocumento().equals(codigoPasaporte)) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_usuarionoencontrado")); + tcustPersonDetailPortador = new TcustPersonDetail(); + + } + + } + + /** + * Método para validar si la persona existe en la BD de Maia + * + * @param numeroDocumento + * @param tipoDocumento + * @return TcustPersonDetail + */ + public TcustPersonDetail buscarPersonaMaia(String numeroDocumento, String tipoDocumento) { + return PersonDetailController.findxidentification(numeroDocumento, tipoDocumento); + } + + /** + * Método para buscar a la persona en la snap + * + * @param documento + */ + public TcustPersonDetail buscarPersonaSnap(String documento, String tipoDocumento) { + if (tipoDocumento.equals(codigoCedula)) { + Cedula cedula = ClienteCedula.obtenerCedula(documento); + if (cedula != null) { + TcustPersonDetail detail = new TcustPersonDetail(); + detail.setName(cedula.getNombre()); + detail.setIdentification(cedula.getCedula()); + detail.setIdentificationcatalog("CED"); + detail.setIdentificationcatalogcode("IDENTIFICATION"); + detail.setDatefrom(new Timestamp(System.currentTimeMillis())); + return detail; + } else { + return null; + } + } else { + Contribuyente contribuyente = ClienteRUC.obtenerRUC(documento); + if (contribuyente != null) { + TcustPersonDetail detail = new TcustPersonDetail(); + detail.setName(contribuyente.getRazonSocial()); + detail.setIdentification(contribuyente.getNumeroRuc()); + detail.setIdentificationcatalog("RUC"); + detail.setIdentificationcatalogcode("IDENTIFICATION"); + detail.setDatefrom(new Timestamp(System.currentTimeMillis())); + return detail; + } else { + return null; + } + } + } + + /** + * Método para manejar el evento change en el CheckBox Arma a + * decomisar + * + * @throws Exception + */ + public void onChange(TarmArmas arma) throws Exception { + + for (TarmArmas t : armasController.getLrecord()) { + //t.getModifiedData().put("estadoseleccion",Boolean.FALSE); //selecciona solo un registro + if (arma.getPk() == null && t.getPk() == null) { + if (validacioncampos(arma)) { + } else { + t.getModifiedData().put("estadoseleccion", Boolean.FALSE); + } + } else if (arma.getPk() != null && arma.getPk().equals(t.getPk())) { + if (validacioncampos(arma)) { + //arma.getModifiedData().put("estadoseleccion",Boolean.TRUE); + //le asignamos un umero para que le ordene + if (armaSeleccionadaList.contains(arma)) { + arma.getModifiedData().put("ordenarma", 0); + armaSeleccionadaList.remove(arma); + armaSeleccionadaList.add(arma); + } else { + armaSeleccionadaList.add(arma); + } + } else { + t.getModifiedData().put("estadoseleccion", Boolean.FALSE); + if (armaSeleccionadaList.contains(arma)) { + armaSeleccionadaList.remove(arma); + } + } + } + + } + + } + + /** + * Método para validar los campos esten ingresados + * + * @param arma + * @return + */ + private Boolean validacioncampos(TarmArmas arma) { + if (arma.getModifiedData().get("motivocatalogo") == null) { + MessageHelper.setMessageError("INGRESE EL MOTIVO DE DECOMISO/INCAUTACION DEL ARMA CODIDGO : " + arma.getPk()); + return false; + } + if (arma.getModifiedData().get("cantidad") == null) { + MessageHelper.setMessageError("INGRESE EL MOTIVO DE DECOMISO/INCAUTACION DEL ARMA CODIDGO : " + arma.getPk()); + return false; + } + if (arma.getModifiedData().get("observaciondecomiso") == null) { + MessageHelper.setMessageError("INGRESE EL MOTIVO DE DECOMISO/INCAUTACION DEL ARMA CODIDGO : " + arma.getPk()); + return false; + } + + return true; + } + + /** + * Método para ingresar el motivo del decomiso desde el popup + */ + public void datosDecomiso() { + if (decomisoController.getRecord().getTipoproceso() == null || decomisoController.getRecord().getTipoproceso().isEmpty()) { + MessageHelper.setMessageError("INGRESE EL TIPO DE PROCESO EN DATOS GENERALES"); + return; + }/*else{ + String catalogReg = decomisoController.getRecord().getTipoproceso(); + if(catalogReg.equals("INCA")){ + catalogReg = "DECO"; + } + motivoDecomisoList = CatalogDetailController.find("MOTIVODECOMISO",catalogReg); + }*/ + + try { + //se setea el tipo del proceso + if (armasController.getRecord().getModifiedData().get("estadodecomiso") == null) { + armasController.getRecord().getModifiedData().put("estadodecomiso", decomisoController.getRecord().getTipoproceso()); + } + + if (armasController.getRecord().getCantidad() != null) { + armasController.getRecord().getModifiedData().put("cantidad", armasController.getRecord().getCantidad()); + } + if (armasController.getRecord().getPeso() != null) { + armasController.getRecord().getModifiedData().put("cantidad", armasController.getRecord().getPeso()); + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para actualizar el motivo del decomiso del arma arma + * existente se ejecuta en el botón del formulario del motivo de + * decomiso + */ + public void actualizarDecomiso() { + + TgeneCatalogDetail estadoArma = CatalogDetailController.find("ESTADOARMA", decomisoController.getRecord().getTipoproceso()).get(0); + if (estadoArma != null) { + armasController.getRecord().getModifiedData().put("estadodecomisodesc", estadoArma.getDescription()); + } + //seteod de los codigos + armasController.getRecord().getModifiedData().put("motivocatalogocode", "MOTIVODECOMISO"); + armasController.getRecord().getModifiedData().put("estadodecomisocode", "TIPOREGISTRO"); + //descripcion del motivodecomiso + catalogos(motivoDecomisoList, armasController.getRecord().getModifiedData().get("motivocatalogo").toString(), "motivodecomisodesc"); + } + + /** + * Método para actualizar el arma cuando ya llena los datos en el + * formulario de crear arma + * + * @throws Exception + */ + public void actualizarArmaCreada() throws Exception { + //valida la combinacion del arma que exista + if (tipoArmaExplosivo == null || tipoArmaExplosivo.getPk() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_camposrequeridos")); + return; + } + //armasController.clearAll(); +// for(TarmArmas t:armasController.getLrecord()){ +// t.getModifiedData().put("estadoseleccion",Boolean.FALSE); +// } + //DATOS PARA VISUALIZAR EN PANTALLA + //DATOS DE LA GRILLA + //cantidad + if (armasController.getRecord().getCantidad() != null && armasController.getRecord().getCantidad() > 0) { + armasController.getRecord().getModifiedData().put("cantidad", armasController.getRecord().getCantidad()); + } + if (armasController.getRecord().getPeso() != null && armasController.getRecord().getPeso().compareTo(new BigDecimal(0)) > 0) { + armasController.getRecord().getModifiedData().put("cantidad", armasController.getRecord().getPeso()); + } + //propietario + TcustPersonDetail tcustPersonDetail = PersonDetailController.find(codigoPersonaSinIdentificacion); + armasController.getRecord().getModifiedData().put("propietario", tcustPersonDetail.getName()); + //unidad de medida + armasController.getRecord().getModifiedData().put("unidadmedida", tipoArmaExplosivo.getUnidadmedidapeso()); + //unidad de medida + armasController.getRecord().getModifiedData().put("unidadmedidadesc", tipoArmaExplosivo.getUnidadmedidapeso()); + //le asignamos una marca + + TgeneCatalogDetail marcaArma = CatalogDetailController.findCatalog("MARCA", armasController.getRecord().getMarca()).get(0); + if (marcaArma != null) { + armasController.getRecord().getModifiedData().put("marca", marcaArma.getDescription()); + } + TgeneCatalogDetail estadoArma = CatalogDetailController.find("ESTADOARMA", decomisoController.getRecord().getTipoproceso()).get(0); + if (estadoArma != null) { + armasController.getRecord().getModifiedData().put("estado", estadoArma.getDescription()); + armasController.getRecord().getModifiedData().put("estadodecomisodesc", estadoArma.getDescription()); + } + + //motivo del decomiso + catalogos(motivoDecomisoList, armasController.getRecord().getModifiedData().get("motivocatalogo").toString(), "motivodecomisodesc"); + + //seteamos el check + armasController.getRecord().getModifiedData().put("estadoseleccion", Boolean.TRUE); + + //seteo de codigos + armasController.getRecord().getModifiedData().put("motivocatalogocode", "MOTIVODECOMISO");//['motivocatalogo'] + armasController.getRecord().getModifiedData().put("estadodecomisocode", "TIPOREGISTRO");//['estadodecomiso'] + + //datos para el REGISTROARMA + //personcode + armasController.getRecord().getModifiedData().put("personcode", tcustPersonDetail.getPk().getPersoncode()); + armasController.getRecord().getModifiedData().put("tiporegistro", decomisoController.getRecord().getTipoproceso()); + armasController.getRecord().getModifiedData().put("tiporegistrocode", "TIPOREGISTRO"); + //pais de origen + armasController.getRecord().getModifiedData().put("paisorigen", codigoPaisOrigen); + //fecha de creacion + armasController.getRecord().getModifiedData().put("fechacreacion", new java.sql.Date(new Date().getTime())); + + //pais de origen + armasController.getRecord().setCpaisorigen(codigoPaisOrigen); + armasController.getRecord().setColorcodigo("COLOR"); + armasController.getRecord().setTipofabricacioncodigo("TIPOFABRICACION"); + //unidad de medida + armasController.getRecord().setUnidadmedidacantidad(tipoArmaExplosivo.getUnidadmedidapeso()); + armasController.getRecord().setUnidadmedidacantidadcodigo("UNIDADMEDIDA"); + //fech de registro + armasController.getRecord().setFecharegistro(new java.sql.Date(new Date().getTime())); + //le asignamos un umero para que le ordene + armasController.getRecord().getModifiedData().put("ordenarma", 0); + //ACTUALIZA EL ARMA + armasController.actualizar(armasController.getRecord()); + //Valor razon social + //nombrePortador + decomisoController.getRecord().setNombrerazonsocial(nombrePortador); + //limpiamos la variable + tipoArmaExplosivo = null; + btnPeso = Boolean.FALSE; + btnCantidad = Boolean.FALSE; + + //ordena la lista lvigenciaMeses + Collections.sort(armasController.getLrecord(), new Comparator() { + public int compare(TarmArmas p1, TarmArmas p2) { + return String.valueOf(p1.getModifiedData().get("ordenarma")).compareTo(String.valueOf(p2.getModifiedData().get("ordenarma"))); + } + }); + + armaSeleccionadaList.add(armasController.getRecord()); + + } + + /** + * Método para recorreer los combos y setear las descripciones de lo + * q se escoge para la vista + * + * @param list + * @param codigo + * @param pk + */ + public void catalogos(List list, String codigo, String pk) { + for (TgeneCatalogDetail item : list) { + if (codigo.equals(item.getPk().getCatalog())) { + armasController.getRecord().getModifiedData().put(pk, item.getDescription()); + break; + } + } + } + + /** + * Método para devolver la descripcion + * + * @param list + * @param codigo + * @return + */ + public String catalogoDescripcion(List list, String codigo) { + for (TgeneCatalogDetail item : list) { + if (codigo.equals(item.getPk().getCatalog())) { + return item.getDescription(); + } + } + return null; + } + + /** + * Método para crear un arma a decomisar + * + * @throws Exception + */ + public void createArmaDecomisada() throws Exception { + //inicializamos el amra + armasController.create(); + armasController.getRecord().setCountrycode("EC"); + TgeneCatalogDetail estadoArma = CatalogDetailController.find("ESTADOARMA", decomisoController.getRecord().getTipoproceso()).get(0); + if (estadoArma != null) { + armasController.getRecord().setEstado(estadoArma.getPk().getCatalog()); + } + armasController.getRecord().setEstadocodigo("ESTADOARMA"); + armasController.getRecord().setMarcacodigo("MARCA"); + armasController.setLprovincias(ProvinceController.find(armasController.getRecord().getCountrycode())); + armasController.executeProvince(); + unidadpeso = null; + descripcionUnidadpeso = null; +// tcustPersonDetailPropietario= new TcustPersonDetail(); + //se setea el tipo del proceso + armasController.getRecord().getModifiedData().put("estadodecomiso", decomisoController.getRecord().getTipoproceso()); + if (!sinPortador) { + //cargamos los datos del usuario portador + //tipo de identificacion + tipoIdentificacionPro = decomisoController.getRecord().getTipodocumento(); + //numero de documento + identificacionPro = decomisoController.getRecord().getNumerodocumento(); + //nombre razon social +// tcustPersonDetailPropietario.setName(decomisoController.getRecord().getNombrerazonsocial()); + } + //NUEVO + if (!sinDocumento) { + decomisoController.getRecord().setNombrerazonsocial(nombrerazonsocialsindoc); + } + codigoPaisOrigen = null; + descripcionUnidadpeso = null; + btnPeso = Boolean.FALSE; + btnCantidad = Boolean.FALSE; + } + + /** + * Abre el LOV de la clase del arma + */ + public void openArmaExplosivoLov() { + armasController.getRecord().getModifiedData().put("longitud", null); + armasController.getRecord().getModifiedData().put("tipoarmaexplosivo", null); + armasController.getRecord().getModifiedData().put("calibre", null); + descripcionUnidadpeso = null; + Map> params = new HashMap<>(); + ArmaExplosivoLovController.openLov(params); + } + + /** + * Regresa del LOV de armas + * + * @param event + */ + public void onReturnArmaExplosivo(SelectEvent event) { + tipoArmaExplosivo = (TarmTipoArmaExplosivo) event.getObject(); + armasController.getRecord().setCantidad(null); + armasController.getRecord().setPeso(null); + armasController.getRecord().getModifiedData().put("clase", tipoArmaExplosivo.getModifiedData().get("nclase")); + armasController.getRecord().getModifiedData().put("tipoarmaexplosivo", tipoArmaExplosivo.getModifiedData().get("ntipo")); + armasController.getRecord().getModifiedData().put("longitud", tipoArmaExplosivo.getModifiedData().get("nlongitud")); + armasController.getRecord().getModifiedData().put("calibre", tipoArmaExplosivo.getModifiedData().get("ncalibre")); + if (tipoArmaExplosivo.getModifiedData().get("desunidad") != null) { + unidadpeso = tipoArmaExplosivo.getModifiedData().get("desunidad").toString(); + } else { + unidadpeso = null; + } + if (tipoArmaExplosivo.getClase().equals(codigoArma)) { + armasController.getRecord().setCantidad(1); + armasController.getRecord().getModifiedData().put("cantidad", 1); + } else { + armasController.getRecord().setCantidad(null); + armasController.getRecord().getModifiedData().put("cantidad", null); + } + //codigo del arma explosivo + armasController.getRecord().setCtipoarmaexplosivo(tipoArmaExplosivo.getPk()); + btnPeso = Boolean.FALSE; + btnCantidad = Boolean.FALSE; + if (tipoArmaExplosivo.getModifiedData().get("deslegalcode") != null) { + descripcionUnidadpeso = tipoArmaExplosivo.getModifiedData().get("deslegalcode").toString(); + if (codigoUnidadpeso.equals(descripcionUnidadpeso)) { + btnPeso = Boolean.TRUE; + } else { + btnCantidad = Boolean.TRUE; + } + } else { + descripcionUnidadpeso = null; + } + } + + /** + * Método para inicilalizar los campos segun la unidad de medida + * (unidad, kg) + * + * @param cantidad + */ + public void cantidad(Integer cantidad) { + armasController.getRecord().setPeso(null); + armasController.getRecord().getModifiedData().put("cantidad", cantidad); + } + + /** + * Método para inicilalizar los campos segun la unidad de medida + * (unidad, kg) + * + * @param peso + */ + public void peso(BigDecimal peso) { + armasController.getRecord().setCantidad(null); + armasController.getRecord().getModifiedData().put("cantidad", peso); + } + + /** + * Método que elimina el arma creada solamente de la vista + * + * @param arma + */ + public void eliminarArmaVista(TarmArmas arma) { + try { + armasController.remove(); +// tcustPersonDetailPropietario= new TcustPersonDetail(); + tipoDocumeno = null; + identificacionPro = null; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Validacion de las fechas que no se amayor a la actual + * + * @param fech + */ + public void validarComprobanteRecibo(String numerorecibo) { + String tipoproceso = this.decomisoController.getRecord().getTipoproceso(); + String organismoControl = tsafeUserDetail.getCcentrocontrol(); + + if (tipoproceso == null || tipoproceso.isEmpty()) { + decomisoController.getRecord().setNumerorecibo(""); + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_validarnumerocomprobanterecibo")); + return; + } + boolean isRecibo = DecomisoController.findReciboByTipoProcesoOrganismoControl(numerorecibo, tipoproceso, organismoControl); + if (isRecibo) { + decomisoController.getRecord().setNumerorecibo(""); + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_numerocomprobanterecibo")); + return; + } + } + + /** + * Validacion de las fechas que no se amayor a la actual + * + * @param fech + */ + public void validarfecha(Date fech) { + if (fech.getTime() > (new Date()).getTime()) { + fech = new Date(); + decomisoController.getRecord().setFechadecomiso(new java.sql.Date(new Date().getTime())); + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_fechadecomisonopuedesermayoralaactual")); + } + } + + /** + * Método para obtener los codigos + */ + public String codigos(String parametro) { + TgeneParameters tgeneParameters = ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + public void querySelMaterial() { + + try { + + noFiltrarCodigosEstados(); + armasLovController.setRecperpage(500); + armasLovController.query(); + + armasController.getLrecord().clear(); + + if (armasLovController.getLrecord() != null + || !armasLovController.getLrecord().isEmpty()) { + armasController.getLrecord().addAll(armasLovController.getLrecord()); + } + + if (armaSeleccionadaList != null && !armaSeleccionadaList.isEmpty()) { + armasController.getLrecord().addAll(armaSeleccionadaList); + } + + //ordenamos la lista + Collections.sort(armasController.getLrecord(), new Comparator() { + public int compare(TarmArmas p1, TarmArmas p2) { + return String.valueOf(p1.getModifiedData().get("ordenarma")).compareTo(String.valueOf(p2.getModifiedData().get("ordenarma"))); + } + }); + + } catch (Exception e) { + + e.printStackTrace(); + } + } + + /* Abre el LOV de la clase del arma + */ + public void noFiltrarCodigosEstados() { + Map mfileldsArm = new HashMap(); + //No filtra los codigos de armas ya consultados + String sqlFiltroCodigoArma = ""; + if (armaSeleccionadaList != null && !armaSeleccionadaList.isEmpty()) { + StringBuffer sqlCodigos = new StringBuffer(); + for (TarmArmas tarmArmas : armaSeleccionadaList) { + if (!sqlCodigos.toString().isEmpty()) { + sqlCodigos.append(" , "); + } + sqlCodigos.append("'" + tarmArmas.getPk() + "'"); + } + sqlFiltroCodigoArma = (!sqlCodigos.toString().trim().isEmpty()) ? " t.pk not in( " + sqlCodigos.toString() + ") " : ""; + + } + + mfileldsArm.put("codigosarmasdec", sqlFiltroCodigoArma); + + //mfileldsArm.put("estadosarmasdec", " t.estado not in('DEST','CANC','SUSP','DEC','INC','ENTR','ABA','RECL') "); + mfileldsArm.put("estadosarmasdec", " t.estado not in('DEST','CDP','VEND','SUSP','RECL') "); + + armasLovController.setMfilelds(mfileldsArm); + } + + public void validacionFuncionario() { + if (decomisoController.getRecord().getCedulafuncionario() != null) { + TcustPersonDetail personDetail = buscarPersonaSnap(decomisoController.getRecord().getCedulafuncionario(), "CED"); + decomisoController.getRecord().setFuncionario(null); + if (personDetail != null && personDetail.getName() != null) { + decomisoController.getRecord().setFuncionario(personDetail.getName()); + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + } + } + + /** + * Recorta el nombre del archivo a cargarse + * + * @param nombre + * @return nombre recortado + */ + public String recorteNombre(String nombre) { + String fielname = nombre; + if (fielname.length() > 30) { + fielname = fielname.substring(0, 30) + extencionArchivo(nombre); + } + return fielname; + } + + /** + * Obtiene la extencion del archivo a cargar + * + * @param nombre + * @return + */ + private String extencionArchivo(String nombre) { + int pos = nombre.lastIndexOf('.'); + nombre = nombre.substring(pos); + return nombre; + } + + /** + * Metodo que retorna la extencion del comprobante de deposito que se desea + * subir al alfresco + */ + public String getExtension(String filename) { + int index = filename.lastIndexOf('.'); + if (index == -1) { + return ""; + } else { + return filename.substring(index + 1); + } + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(decomisoController.getRecord().getFechadecomiso()); + StringBuilder ruta = new StringBuilder("cm:Decomiso"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + return ruta.toString(); + } + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en + * el Alfresco + */ + public void handleUpload(FileUploadEvent event) { + uploadedFile = event.getFile(); + btnfileUpload = Boolean.TRUE; + FacesContext context = FacesContext.getCurrentInstance(); + context.addMessage(null, new FacesMessage("RECUERDE", MsgControlArmas.getProperty("msg_recuerdeClickBtnRegMaterial"))); + + } + + /** + * Metodo que permite setear los datos de coordenadas relacionados a la + * entidad TarmDecomiso, una vez seleccionado un punto en el Map desde + * pantalla + */ + public void evento() { + getDecomisoController().getRecord().setLatitud(new BigDecimal(getLatitud())); + getDecomisoController().getRecord().setLongitud(new BigDecimal(getLongitud())); + String longitudString = getDecomisoController().getRecord().getLongitud().toString(); + if (longitudString.contains("-")) { + longitudString = longitudString.replace("-", ""); + setLongitudGMS("oeste"); + } else { + setLongitudGMS("este"); + } + String[] longitud = transformarGrados(longitudString); + + String latitudString = getDecomisoController().getRecord().getLatitud().toString(); + if (latitudString.contains("-")) { + latitudString = latitudString.replace("-", ""); + setLatitudGMS("sur"); + } else { + setLatitudGMS("norte"); + } + String[] latitud = transformarGrados(latitudString); + setLatitudG(latitud[0]); + setLatitudM(latitud[1]); + setLatitudS(latitud[2]); + setLonguitudG(longitud[0]); + setLonguitudM(longitud[1]); + setLonguitudS(longitud[2]); + } + + /** + * Inicializa los campos al cambiar el tipo de Ubicacion desde la pagina + */ + public void changeUbicacion() { + getDecomisoController().getRecord().setLatitud(null); + getDecomisoController().getRecord().setLongitud(null); + setLatitudG(""); + setLatitudM(""); + setLatitudS(""); + setLonguitudG(""); + setLonguitudM(""); + setLonguitudS(""); + setLatitud(""); + setLongitud(""); + setLongitudGMS(null); + setLatitudGMS(null); + } + + /** + * Permite inicializar los campos de longitud y lalitud y cargar a los datos + * de coordenadas relacionados a la entidad TarmDecomiso + */ + public void openMapPorCoordenandas() { + setLatitud(""); + setLongitud(""); + if ("coodernadas".equals(tipoMapa)) { + getDecomisoController().getRecord().setLatitud(new BigDecimal(transformarCoordenadas(latitudG, latitudM, latitudS, "sur".equals(latitudGMS)))); + getDecomisoController().getRecord().setLongitud(new BigDecimal(transformarCoordenadas(longuitudG, longuitudM, longuitudS, "oeste".equals(longitudGMS)))); + + } + } + + /** + * Metodo que permite transformar de Coordenadas Hexadecimales a Coordenadas + * en Grados, Minutos y Seguntos + * + * @param coordenada + * @return vector con las Coordenadas en Grados, Minutos y Seguntos + */ + public String[] transformarGrados(String coordenada) { + int grados = new BigDecimal(coordenada).intValue(); + BigDecimal minutos = new BigDecimal(coordenada).subtract(new BigDecimal(grados)).multiply(new BigDecimal(60)); + int min = minutos.intValue(); + BigDecimal segundos = minutos.subtract(new BigDecimal(min)).multiply(new BigDecimal(60)).setScale(4, BigDecimal.ROUND_FLOOR); + //System.out.println("latitude: " + grados + " " + min + " " + segundos); + return (grados + "," + min + "," + segundos).split(","); + } + + /** + * Metodo que permite transformar de coordenadas en Grados, Minutos y + * Seguntos a Coordenadas Hexadecimales + * + * @param grados + * @param minutos + * @param segundos + * @return coordenadas Hexadecimales + */ + public String transformarCoordenadas(String grados, String minutos, String segundos, boolean negativo) { + BigDecimal resultado = new BigDecimal(grados).add(new BigDecimal(minutos).divide(new BigDecimal(60), 12, BigDecimal.ROUND_FLOOR)).add(new BigDecimal(segundos).divide(new BigDecimal(3600), 12, BigDecimal.ROUND_FLOOR)); + resultado = resultado.setScale(12, BigDecimal.ROUND_FLOOR); + if (negativo) { + resultado = resultado.multiply(new BigDecimal(-1)); + } + return resultado.toString(); + } + + /** + * Muestra un mensaje de error siempre y cuando sea un error de componente y + * se lo muestra como general + * + * @return + */ + public Boolean getExisteMensajesError() { + Boolean resp = Boolean.FALSE; + FacesContext facesContext = FacesContext.getCurrentInstance(); + final Iterator idComponentesMensajes = facesContext.getClientIdsWithMessages(); + while (idComponentesMensajes.hasNext()) { + String idComp = idComponentesMensajes.next(); + if (StringUtils.isNotBlank(idComp)) { + System.out.println("El id es " + idComp.replace(":", "\\\\:")); + System.out.println("$('#" + idComp.replace(":", "\\\\:") + "').focus();"); + facesContext.validationFailed(); + resp = Boolean.TRUE; + RequestContext.getCurrentInstance().execute("$('#" + idComp.replace(":", "\\\\:") + "').focus();"); + break; + } + } + return resp; + } + + public DecomisoController getDecomisoController() { + return decomisoController; + } + + public void setDecomisoController(DecomisoController decomisoController) { + this.decomisoController = decomisoController; + } + + public List getLprovinces() { + return lprovinces; + } + + public void setLprovinces(List lprovinces) { + this.lprovinces = lprovinces; + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public List getLparroquias() { + return lparroquias; + } + + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + public List getLcities() { + return lcities; + } + + public void setLcities(List lcities) { + this.lcities = lcities; + } + + public List getTipoProceso() { + return tipoProceso; + } + + public void setTipoProceso(List tipoProceso) { + this.tipoProceso = tipoProceso; + } + + public List getTipoDocumeno() { + return tipoDocumeno; + } + + public void setTipoDocumeno(List tipoDocumeno) { + this.tipoDocumeno = tipoDocumeno; + } + + public List getGrados() { + return grados; + } + + public void setGrados(List grados) { + this.grados = grados; + } + + public List getUnidades() { + return unidades; + } + + public void setUnidades(List unidades) { + this.unidades = unidades; + } + + public ArmasController getArmasController() { + return armasController; + } + + public void setArmasController(ArmasController armasController) { + this.armasController = armasController; + } + + public TsafeUserDetail getTsafeUserDetail() { + return tsafeUserDetail; + } + + public void setTsafeUserDetail(TsafeUserDetail tsafeUserDetail) { + this.tsafeUserDetail = tsafeUserDetail; + } + + public TcustPersonDetail getTcustPersonDetailPortador() { + return tcustPersonDetailPortador; + } + + public void setTcustPersonDetailPortador( + TcustPersonDetail tcustPersonDetailPortador) { + this.tcustPersonDetailPortador = tcustPersonDetailPortador; + } + + public boolean isSinPortador() { + return sinPortador; + } + + public void setSinPortador(boolean sinPortador) { + this.sinPortador = sinPortador; + } + + public List getMotivoDecomisoList() { + return motivoDecomisoList; + } + + public void setMotivoDecomisoList(List motivoDecomisoList) { + this.motivoDecomisoList = motivoDecomisoList; + } + + public List getLmarca() { + return lmarca; + } + + public void setLmarca(List lmarca) { + this.lmarca = lmarca; + } + + public List getLcolor() { + return lcolor; + } + + public void setLcolor(List lcolor) { + this.lcolor = lcolor; + } + + public List getLtipofabricacion() { + return ltipofabricacion; + } + + public void setLtipofabricacion(List ltipofabricacion) { + this.ltipofabricacion = ltipofabricacion; + } + + public List getLcountry() { + return lcountry; + } + + public void setLcountry(List lcountry) { + this.lcountry = lcountry; + } + + public String getCodigoArma() { + return codigoArma; + } + + public void setCodigoArma(String codigoArma) { + this.codigoArma = codigoArma; + } + + public String getIdentificacionPro() { + return identificacionPro; + } + + public void setIdentificacionPro(String identificacionPro) { + this.identificacionPro = identificacionPro; + } + + public String getTipoIdentificacionPro() { + return tipoIdentificacionPro; + } + + public void setTipoIdentificacionPro(String tipoIdentificacionPro) { + this.tipoIdentificacionPro = tipoIdentificacionPro; + } + + public boolean isSinIdentificacion() { + return sinIdentificacion; + } + + public void setSinIdentificacion(boolean sinIdentificacion) { + this.sinIdentificacion = sinIdentificacion; + } + + public PersonDetailController getPersonDetailController() { + return personDetailController; + } + + public void setPersonDetailController( + PersonDetailController personDetailController) { + this.personDetailController = personDetailController; + } + + public String getUnidadpeso() { + return unidadpeso; + } + + public void setUnidadpeso(String unidadpeso) { + this.unidadpeso = unidadpeso; + } + + public TarmTipoArmaExplosivo getTipoArmaExplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoArmaExplosivo(TarmTipoArmaExplosivo tipoArmaExplosivo) { + this.tipoArmaExplosivo = tipoArmaExplosivo; + } + + public String getDescripcionUnidadpeso() { + return descripcionUnidadpeso; + } + + public void setDescripcionUnidadpeso(String descripcionUnidadpeso) { + this.descripcionUnidadpeso = descripcionUnidadpeso; + } + + public String getCodigoUnidadpeso() { + return codigoUnidadpeso; + } + + public void setCodigoUnidadpeso(String codigoUnidadpeso) { + this.codigoUnidadpeso = codigoUnidadpeso; + } + + public RegistroArmController getRegistroArmController() { + return registroArmController; + } + + public void setRegistroArmController(RegistroArmController registroArmController) { + this.registroArmController = registroArmController; + } + + public String getCodigoPasaporte() { + return codigoPasaporte; + } + + public void setCodigoPasaporte(String codigoPasaporte) { + this.codigoPasaporte = codigoPasaporte; + } + + public DecomisoArmaController getDecomisoArmaController() { + return decomisoArmaController; + } + + public void setDecomisoArmaController( + DecomisoArmaController decomisoArmaController) { + this.decomisoArmaController = decomisoArmaController; + } + + public PersonPhoneController getPersonPhoneController() { + return personPhoneController; + } + + public void setPersonPhoneController(PersonPhoneController personPhoneController) { + this.personPhoneController = personPhoneController; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public Boolean getBtn() { + return btn; + } + + public void setBtn(Boolean btn) { + this.btn = btn; + } + + public String getCodigoPaisOrigen() { + return codigoPaisOrigen; + } + + public void setCodigoPaisOrigen(String codigoPaisOrigen) { + this.codigoPaisOrigen = codigoPaisOrigen; + } + + public List getArmaSeleccionadaList() { + return armaSeleccionadaList; + } + + public void setArmaSeleccionadaList(List armaSeleccionadaList) { + this.armaSeleccionadaList = armaSeleccionadaList; + } + + public String getCdecomiso() { + return cdecomiso; + } + + public void setCdecomiso(String cdecomiso) { + this.cdecomiso = cdecomiso; + } + + public Boolean getBtnPeso() { + return btnPeso; + } + + public void setBtnPeso(Boolean btnPeso) { + this.btnPeso = btnPeso; + } + + public Boolean getBtnCantidad() { + return btnCantidad; + } + + public void setBtnCantidad(Boolean btnCantidad) { + this.btnCantidad = btnCantidad; + } + + public List getCentroControls() { + return centroControls; + } + + public void setCentroControls(List centroControls) { + this.centroControls = centroControls; + } + + public String getCentroControl() { + return centroControl; + } + + public void setCentroControl(String centroControl) { + this.centroControl = centroControl; + } + + public String getLatitud() { + return latitud; + } + + public void setLatitud(String latitud) { + this.latitud = latitud; + } + + public String getLongitud() { + return longitud; + } + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + public String getDireccionGoogleMap() { + return direccionGoogleMap; + } + + public void setDireccionGoogleMap(String direccionGoogleMap) { + this.direccionGoogleMap = direccionGoogleMap; + } + + public String getTipoMapa() { + return tipoMapa; + } + + public void setTipoMapa(String tipoMapa) { + this.tipoMapa = tipoMapa; + } + + public String getLatitudG() { + return latitudG; + } + + public void setLatitudG(String latitudG) { + this.latitudG = latitudG; + } + + public String getLatitudM() { + return latitudM; + } + + public void setLatitudM(String latitudM) { + this.latitudM = latitudM; + } + + public String getLatitudS() { + return latitudS; + } + + public void setLatitudS(String latitudS) { + this.latitudS = latitudS; + } + + public String getLonguitudG() { + return longuitudG; + } + + public void setLonguitudG(String longuitudG) { + this.longuitudG = longuitudG; + } + + public String getLonguitudM() { + return longuitudM; + } + + public void setLonguitudM(String longuitudM) { + this.longuitudM = longuitudM; + } + + public String getLonguitudS() { + return longuitudS; + } + + public void setLonguitudS(String longuitudS) { + this.longuitudS = longuitudS; + } + + /** + * @return the latitudGMS + */ + public String getLatitudGMS() { + return latitudGMS; + } + + /** + * @param latitudGMS the latitudGMS to set + */ + public void setLatitudGMS(String latitudGMS) { + this.latitudGMS = latitudGMS; + } + + /** + * @return the longitudGMS + */ + public String getLongitudGMS() { + return longitudGMS; + } + + /** + * @param longitudGMS the longitudGMS to set + */ + public void setLongitudGMS(String longitudGMS) { + this.longitudGMS = longitudGMS; + } + + public boolean isSinDocumento() { + return sinDocumento; + } + + public void setSinDocumento(boolean sinDocumento) { + this.sinDocumento = sinDocumento; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + + public String getIngresoPortador() { + return ingresoPortador; + } + + public void setIngresoPortador(String ingresoPortador) { + this.ingresoPortador = ingresoPortador; + } + + public String getNombrerazonsocialsindoc() { + return nombrerazonsocialsindoc; + } + + public void setNombrerazonsocialsindoc(String nombrerazonsocialsindoc) { + this.nombrerazonsocialsindoc = nombrerazonsocialsindoc; + } + + public boolean isHabilitaNoDecomiso() { + return habilitaNoDecomiso; + } + + public void setHabilitaNoDecomiso(boolean habilitaNoDecomiso) { + this.habilitaNoDecomiso = habilitaNoDecomiso; + } + + public Boolean getBtnfileUpload() { + return btnfileUpload; + } + + public void setBtnfileUpload(Boolean btnfileUpload) { + this.btnfileUpload = btnfileUpload; + } + + public boolean isDeshabilitarPantalla() { + return deshabilitarPantalla; + } + + public void setDeshabilitarPantalla(boolean deshabilitarPantalla) { + this.deshabilitarPantalla = deshabilitarPantalla; + } + + public boolean isDeshabilitarPantallaMaterial() { + return deshabilitarPantallaMaterial; + } + + public void setDeshabilitarPantallaMaterial(boolean deshabilitarPantalla) { + this.deshabilitarPantallaMaterial = deshabilitarPantalla; + } + + public Boolean getBtnSave() { + return btnSave; + } + + public void setBtnSave(Boolean btnSave) { + this.btnSave = btnSave; + } + + public Boolean getIsExecuteRegistro() { + return isExecuteRegistro; + } + + public void setIsExecuteRegistro(Boolean isExecuteRegistro) { + this.isExecuteRegistro = isExecuteRegistro; + } + + public String getUnidad() { + return unidad; + } + + public void setUnidad(String unidad) { + this.unidad = unidad; + } + + public Boolean getBtnRegistro() { + return btnRegistro; + } + + public void setBtnRegistro(Boolean btnRegistro) { + this.btnRegistro = btnRegistro; + } + + public String getFilename() { + return filename; + } + + public void setFilename(String filename) { + this.filename = filename; + } + + public byte[] getByteArray() { + return byteArray; + } + + public void setByteArray(byte[] byteArray) { + this.byteArray = byteArray; + } + + public boolean isSeleccionarMaterial() { + return seleccionarMaterial; + } + + public void setSeleccionarMaterial(boolean seleccionarMaterial) { + this.seleccionarMaterial = seleccionarMaterial; + } + + public ArmasLovController getArmasLovController() { + return armasLovController; + } + + public void setArmasLovController(ArmasLovController armasLovController) { + this.armasLovController = armasLovController; + } + + public String getNombrePortador() { + return nombrePortador; + } + + public void setNombrePortador(String nombrePortador) { + this.nombrePortador = nombrePortador; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DetRepDestruirArmasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DetRepDestruirArmasController.java new file mode 100644 index 0000000..8cc55a1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DetRepDestruirArmasController.java @@ -0,0 +1,184 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmDetRepDestruirArmas; + +/** + * Clase controladora del bean TarmDetRepDestruirArmas + * + * @author Christian Pazmino + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class DetRepDestruirArmasController extends AbstractController { + + public DetRepDestruirArmasController() throws Exception { + super(TarmDetRepDestruirArmas.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //Ingreso de Datos Quemados + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + public void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + // record = new TarmSolicitudImportacion(); + this.beanalias = "DETREPORTEDESTRUIRARMAS"; +// this.create(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static List find() { + try { + DetRepDestruirArmasController cc = new DetRepDestruirArmasController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Metodo que busca un item de la tabla de detalle de reporte de destruccion + * de armas mediante la clave primaria + * + */ + public static TarmDetRepDestruirArmas findByCodigo(String cRegistro) { + try { + DetRepDestruirArmasController cc = new DetRepDestruirArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", cRegistro); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Metodo que busca una cabecera de reporte de destruccion de armas mediante + * el codigo de reporte + * + * @param cReporte codigo de reporte + * @return Lista de objetos de tipo TarmDetRepDestruirArmas que tienen el + * mismo cReporte + */ + public static List findByCReporte(String cReporte) { + try { + DetRepDestruirArmasController cc = new DetRepDestruirArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("creporte", cReporte); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + public void update(TarmDetRepDestruirArmas bean) throws Exception { + record = bean; + update(); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DocumentoHabilitanteConErrorController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DocumentoHabilitanteConErrorController.java new file mode 100644 index 0000000..3161c11 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DocumentoHabilitanteConErrorController.java @@ -0,0 +1,913 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class DocumentoHabilitanteConErrorController extends AbstractController { + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + @ManagedProperty(value = "#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitanteController; + + @ManagedProperty(value = "#{pesonAddressController}") + private PersonAddressController pesonAddressController; + + @ManagedProperty(value = "#{solicitudController}") + private SolicitudController solicitudController; + + TarmSolicitudTramite solicitudTramite; + TarmSolicitud solicitud; + TarmTramite fila; + TcustPersonDetail detallesPersona; + TcustPersonDetail usuario; + TarmDocumentoHabilitante documentoHabilitante; + String numeroSolicitud; + String numeroTramite; + String nombreRazonSocial; + private String xpathflujo = "";//cm:Pruebas/cm:ID_1715819825001"; + private String formato = "pdf"; + private String mostrarFormato = "PDF"; +// TcustPersonDetail detallesPersona; + List lsolicitud; +// String numeroTramite; +// String nombreRazonSocial; + String identificacion; + String tipoidentificacion; + private String tramiteflujo = ""; + private String solicitudflujo = ""; + + private List ldocumentos; + private String institucionCentroControl = ""; + private TarmCentroControl centroControl = new TarmCentroControl(); + private TcustPersonDetail responsableCentroControl = null; + + public DocumentoHabilitanteConErrorController() throws Exception { + super(TarmSolicitudTramite.class); + } + + @PostConstruct + private void postconstruct() { + try { +// this.pasteBpmScreenParameters(); +// tramiteflujo=super.getMfilters().get("numerotransaccion"); +// solicitudflujo=super.getMfilters().get("csolicitud"); + + this.init(); +// super.getMfilters().clear(); + +// super.query(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + // lrecord = new ArrayList<>(); + beanalias = "EMITIRDOCUMENTOHABILITANTE"; + ldocumentos = new ArrayList(); + ldocumentos = CatalogDetailController.find("IDENTIFICATION"); + //Obteniendo el tramite + solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(solicitudflujo); + + //Obteniendo la solicitud + solicitud = ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(solicitudflujo); + this.numeroTramite = solicitudTramite.getNumerotramite(); + + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + //Obteniendo el documento habilitante + documentoHabilitante = DocumentoHabilitanteController.findPorSolicitud(solicitudflujo); + obtenerCentroControl(); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public String getNumeroTramite() { + return numeroTramite; + } + + public void setNumeroTramite(String numeroTramite) { + this.numeroTramite = numeroTramite; + } + + @Override + protected void querydatabase() { + TarmSolicitud solicitudObj = SolicitudController.findSolicitudxnumerosolicitud(numeroSolicitud); + if (solicitudObj != null && solicitudObj.getPk() != null && solicitudObj.getCtramite() != null) { + tramiteflujo = solicitudObj.getCtramite().toString(); + solicitudflujo = solicitudObj.getPk(); + } + init(); + try { + addFilter("numerotramite", numeroTramite); + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + SubQuery subqueryUso = new SubQuery("TarmTramite", "usoactividad", "actividad", "i.pk=t.pk.ctramite"); + dto.addSubQuery(subqueryUso); + SubQuery subqueryPersona = new SubQuery("TarmSolicitud", "personcode", "persona", "i.pk=t.pk.csolicitud"); + dto.addSubQuery(subqueryPersona); + SubQuery subqueryTipo = new SubQuery("TarmTramite", "tipoautorizacion", "tramite", "i.pk=t.pk.ctramite"); + dto.addSubQuery(subqueryTipo); + SubQuery subqueryTipocodigo = new SubQuery("TarmTramite", "tipoautorizacioncodigo", "tramitecodigo", "i.pk=t.pk.ctramite"); + dto.addSubQuery(subqueryTipocodigo); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "desc", "i.pk.catalog=t.estadotramite and i.pk.catalogcode=t.estadotramitecodigo"); + dto.addSubQuery(subqueryEstado); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + for (int i = 0; i < this.lrecord.size(); i++) { + this.lrecord.get(i).getModifiedData().put("usodes", CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("actividad").toString(), "USOACTIVIDAD").getDescription()); + TcustPersonDetail person = PersonDetailController.find(this.lrecord.get(i).getModifiedData().get("persona").toString()); + this.lrecord.get(i).getModifiedData().put("nombre", person.getName()); + this.lrecord.get(i).getModifiedData().put("identificacion", person.getIdentification()); + TgeneCatalogDetail tipo = CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("tramite").toString(), this.lrecord.get(i).getModifiedData().get("tramitecodigo").toString()); + this.lrecord.get(i).getModifiedData().put("tipotramdesc", tipo.getDescription()); + } + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para completar la tarea + */ + public void completarTarea() { + try { + if (xpathflujo == null || xpathflujo.isEmpty()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generarReporteRequerido")); + return; + } + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + public void imprimir(TarmSolicitudTramite fila) { + try { + boolean flagRequisitos = false; + boolean flagArmas = false; + boolean flagGuardias = false; + boolean flagAgencia = false; + boolean flagDoc = false; + String tipotramite = fila.getModifiedData().get("tramite").toString(); + String nombreArchivo = fila.getModifiedData().get("tipotramdesc").toString(); + TarmSolicitud solicitud = SolicitudController.findSolicitudxcodsolicitud(fila.getPk().getCsolicitud()); + TarmTramite tramite = TarmTramiteController.findSimple(fila.getPk().getCtramite().toString()); + documentoHabilitante = documentoHabilitanteController.findPorSolicitud(fila.getPk().getCsolicitud()); + + xpathflujo = generarXpath(fila.getNumerotramite()); + System.out.println("..." + xpathflujo); + + //solicitud=ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(tipotramite); + if (tipotramite == null) { + MessageHelper.setMessageError("ERROR NO MANEJADO POR LA APLICACION CONTACTE AL PROVEEDOR"); + return; + } + if (tipotramite.equals("2")) { + if (tramite.getRegistroagenciasucursal().equalsIgnoreCase("Y")) { + flagAgencia = true; + } + if (tramite.getRegistroarmas().equalsIgnoreCase("Y")) { + flagArmas = true; + } + if (tramite.getRegistroguardia().equalsIgnoreCase("Y")) { + flagGuardias = true; + } + if (tramite.getDocumentohabilitante().equalsIgnoreCase("Y")) { + flagDoc = true; + } + //this.reporteCertificados(solicitud.getPk(), flagAgencia, flagArmas, flagDoc, flagGuardias); + InputStream pdf = this.reporteCertificados(solicitud.getPk(), flagAgencia, flagArmas, flagDoc, flagGuardias); + alfrescoController.uploadFile(pdf, documentoHabilitante.getNumerodocumento() + ".pdf", xpathflujo); + xpathflujo = xpathflujo + "/cm:" + documentoHabilitante.getNumerodocumento() + ".pdf"; + actualizarXpath(documentoHabilitante, xpathflujo); + return; + } else if (tipotramite.equals("4")) { + InputStream pdf = this.reporteGuiaLibreTransito(); + alfrescoController.uploadFile(pdf, documentoHabilitante.getNumerodocumento() + ".pdf", xpathflujo); + xpathflujo = xpathflujo + "/cm:" + documentoHabilitante.getNumerodocumento() + ".pdf"; + actualizarXpath(documentoHabilitante, xpathflujo); + return; + } else { + if (tramite.getRegistroagenciasucursal().equalsIgnoreCase("Y")) { + flagAgencia = true; + } + if (tramite.getRegistroarmas().equalsIgnoreCase("Y")) { + flagArmas = true; + } + if (tramite.getRegistroguardia().equalsIgnoreCase("Y")) { + flagGuardias = true; + } + if (tramite.getDocumentohabilitante().equalsIgnoreCase("Y")) { + flagDoc = true; + } + } + InputStream pdf = this.reporteGeneral(solicitud.getPk(), flagAgencia, flagArmas, flagDoc, flagGuardias, flagRequisitos, nombreArchivo); + alfrescoController.uploadFile(pdf, documentoHabilitante.getNumerodocumento() + ".pdf", xpathflujo); + xpathflujo = xpathflujo + "/cm:" + documentoHabilitante.getNumerodocumento() + ".pdf"; + actualizarXpath(documentoHabilitante, xpathflujo); + + } catch (Exception e) { + xpathflujo = null; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generar_reporte")); + } + } + + /** + * Metodo para actualziar en la tabla tarmdocumentohabilitante con el xpath + * de la ruta de alfreco donde se guardo el documento + * + * @param documentoHabilitante + * @param xPath + * @throws Exception + */ + private void actualizarXpath(TarmDocumentoHabilitante documentoHabilitante, String xPath) throws Exception { + documentoHabilitanteController.setRecord(documentoHabilitante); + documentoHabilitanteController.getRecord().setXpath(xPath); + documentoHabilitanteController.update(); + documentoHabilitanteController.save(); + } + + public String generarXpath(String tramite) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + tramite = tramite.replace("TRA", "SOL"); + StringBuilder ruta = new StringBuilder("cm:Solicitud"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + ruta = ruta.append("/cm:" + tramite); + return ruta.toString(); + } + + public String encontrarUsuario() { + if (identificacion == null || identificacion == "") { + return null; + } + detallesPersona = PersonDetailController.findxidentification(identificacion, tipoidentificacion); + if (detallesPersona == null) { + return null; + } + lsolicitud = SolicitudController.findSolicitudxPersona(detallesPersona.getPk().getPersoncode().toString()); + + String csolicitud = null; + for (TarmSolicitud soli : lsolicitud) { + if (csolicitud == null) { + csolicitud = "csolicitud='" + soli.getPk() + "'"; + } else { + csolicitud += " or csolicitud='" + soli.getPk() + "'"; + } + } + return csolicitud; + } + + @Override + public void save() { + // TODO Auto-generated method stub + super.save(); + } + + /** + * Ejecuta un reporte de armas + * + * @param name Nombre del reporte a generar. + */ + public InputStream reporteGuiaLibreTransito() { + try { + String path = "armas/reports/guiaLibreTransito"; + String filename = MsgControlArmas.getProperty("lbl_guiaLibreTransito"); + + detallesPersona = PersonDetailController.find(String.valueOf(solicitud.getPersoncode().toString())); + solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + TarmSolicitud sol = this.solicitudController.findSolicitudxcodsolicitud(this.solicitudflujo); + //No. Guia + parameters.put("noGuia", this.numeroTramite); + + //Codigo de barras + String codigoBarras = this.numeroTramite.replace("-", "").toLowerCase(); + Boolean caracterEliminado = false; + for (int i = 0; i < codigoBarras.length(); i++) { + if (caracterEliminado) { + i = 0; + caracterEliminado = false; + } + if (codigoBarras.toCharArray()[i] != '0' && codigoBarras.toCharArray()[i] != '1' && codigoBarras.toCharArray()[i] != '2' + && codigoBarras.toCharArray()[i] != '3' && codigoBarras.toCharArray()[i] != '4' && codigoBarras.toCharArray()[i] != '5' + && codigoBarras.toCharArray()[i] != '6' && codigoBarras.toCharArray()[i] != '7' && codigoBarras.toCharArray()[i] != '8' + && codigoBarras.toCharArray()[i] != '9') { + + String caracterExtranno = ""; + caracterExtranno += codigoBarras.toCharArray()[i]; + codigoBarras = codigoBarras.replace(caracterExtranno, ""); + caracterEliminado = true; + } + } + parameters.put("codigoBarras", codigoBarras); + + //Nombre/Razon Social + parameters.put("nombreRazon", detallesPersona.getName()); + + //Cedula + parameters.put("cedula", detallesPersona.getIdentification()); + + //Desde + parameters.put("desde", solicitud.getLugarorigen()); + + //Hasta + parameters.put("hasta", solicitud.getLugardestino()); + + //Fechas + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + if (documentoHabilitante != null) { + parameters.put("fechaExpide", sdf.format(documentoHabilitante.getFechaemision())); + parameters.put("fechaCaduca", sdf.format(documentoHabilitante.getFechaexpiracion())); + } else { + parameters.put("fechaExpide", " "); + parameters.put("fechaCaduca", " "); + } + + //Grado + String gradoFuncionario = ""; + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), + this.responsableCentroControl.getMilitarygradecode()); + if (grado != null) { + gradoFuncionario = grado.getDescription() + " - "; + } + + //Lugar origen y destino + if (sol != null) { + parameters.put("provinciaorigen", sol.modifiedData().get("provinciaorigen").toString()); + parameters.put("cantonorigen", sol.modifiedData().get("cantonorigen").toString()); + parameters.put("lugarorigen", sol.getLugarorigen().toString()); + parameters.put("provinciadestino", sol.modifiedData().get("provinciadestino").toString()); + parameters.put("cantondestino", sol.modifiedData().get("cantondestino").toString()); + parameters.put("lugardestino", sol.getLugardestino().toString()); + + } + + //Funcionario + parameters.put("gradoNombreFuncionario", gradoFuncionario + this.responsableCentroControl.getName()); + parameters.put("personcode", this.responsableCentroControl.getPk().getPersoncode()); + parameters.put("centroControl", "JEFE DEL " + this.institucionCentroControl); + parameters.put("nombreCentro", this.institucionCentroControl); + //Usuario + parameters.put("usuario", this.usuario.getName()); + sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + String fechaHora = sdf.format(Calendar.getInstance().getTime()); + parameters.put("fechaHora", fechaHora); + + String format = "pdf"; + InputStream pdf = this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + return pdf; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + return null; + } + + /** + * Ejecuta un reporte de certificado de armas + * + * @param name Nombre del reporte a generar. + */ + public void reporteCertificadoArmas() { + try { + String path = "armas/reports/certificadoArmas"; + String filename = "certificadoarmas"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + + //Fecha + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + + String format = "pdf"; + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Ejecuta un reporte de certificado de armas + * + * @param name Nombre del reporte a generar. + */ + public void reporteAgencias() { + try { + String path = "armas/reports/aperturaAgenciasSucursales"; + String filename = "aperturaagenciassucursales"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + + //Fecha + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + String format = "pdf"; + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /* public void reporteInscripcion(TarmSolicitud solicitud) { + try { + String path = "armas/reports/reporteInscripcion"; + String filename="armas"; + + detallesPersona = PersonDetailController.find(String.valueOf(solicitud.getPersoncode().toString())); + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + + //No. Guia + parameters.put("nombreCompania", detallesPersona.getName()); + + //Nombre/Razon Social + parameters.put("nombrepersona",detallesPersona.getLegalrepresent()); + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("fecha", sdf.format(solicitud.getFregistro())); + parameters.put("ciudad", "Quito"); + + String format = "pdf"; + + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + */ + /** + * Ejecuta reporte general de informacion de armas, guardias, agencias y + * sucursales + * + * @param name Nombre del reporte a generar. + */ + public InputStream reporteGeneral(String solicitud, boolean flagAgencia, boolean flagArmas, boolean flagDoc, boolean flagGuardias, boolean flagRequisitos, String nombreArchivo) { + try { + String path = "armas/reports/generalReportHabilita"; + String filename = nombreArchivo; + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail user = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); +// TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(user.getMilitarygrade(), user.getMilitarygradecode()); + TgeneCatalogDetail grado = null; + if (this.responsableCentroControl.getMilitarygrade() != null && this.responsableCentroControl.getMilitarygradecode() != null) { + grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + } + + String gradoUsuario = ""; + if (grado != null) { + gradoUsuario = grado.getDescription() + " - " + this.responsableCentroControl.getName(); + } else { + gradoUsuario = this.responsableCentroControl.getName(); + } + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("csolicitud", solicitudflujo); + + //Obteniendo la solicitud + TarmSolicitud s = SolicitudController.findSolicitudxcodsolicitud(solicitudflujo); + TarmTramite t; + Boolean datosTramiteVacios = false; + + if (s != null) { + //Obteniendo el tramite + t = TarmTramiteController.find(s.getCtramite().toString()); + + //Obteniendo la solicitud trmite + TarmSolicitudTramite st = TarmSolicitudTramiteController.findPorCSolicitud(solicitudflujo); + + if (t != null) { + + //No de tramite + if (st != null) { + parameters.put("noTramite", st.getNumerotramite()); + } else { + parameters.put("noTramite", " "); + } + + //Tipo de tramite + if (t.getModifiedData().get("tipotramite") != null) { + parameters.put("tipoTramite", t.getModifiedData().get("tipotramite")); + } else { + parameters.put("tipoTramite", " "); + } + + //Tipo de autorizacion + if (t.getModifiedData().get("tipoautorizacion") != null) { + parameters.put("tipoAutorizacion", t.getModifiedData().get("tipoautorizacion")); + } else { + parameters.put("tipoAutorizacion", " "); + } + + //Categoria + if (t.getModifiedData().get("categoria") != null) { + parameters.put("categoria", t.getModifiedData().get("categoria")); + } else { + parameters.put("categoria", " "); + } + + //Uso actividad + if (t.getModifiedData().get("usoactividad") != null) { + parameters.put("usoActividad", t.getModifiedData().get("usoactividad")); + } else { + parameters.put("usoActividad", " "); + } + + //Cabecera + if (t.getCabecera() != null) { + parameters.put("cabecera", t.getCabecera()); + } else { + parameters.put("cabecera", " "); + } + + //Pie + if (t.getPie() != null) { + parameters.put("pie", t.getPie()); + } else { + parameters.put("pie", " "); + } + + //fecha de solicitud + if (s.getFregistro() != null) { + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fecSolicitud", sdf.format(s.getFregistro())); + } else { + parameters.put("fecSolicitud", ""); + } + + } else { + datosTramiteVacios = true; + } + } else { + datosTramiteVacios = true; + } + + if (datosTramiteVacios) { + parameters.put("noTramite", " "); + parameters.put("tipoTramite", " "); + parameters.put("tipoAutorizacion", " "); + parameters.put("categoria", " "); + parameters.put("usoActividad", " "); + parameters.put("cabecera", " "); + parameters.put("pie", " "); + } + + //Obteniendo la direccion + String email = " ", direccion = " "; + List direcciones = PersonAddressController.findAllByPersonCode(s.getPersoncode().toString()); + for (TcustPersonAddress d : direcciones) { + Calendar calendario = Calendar.getInstance(); + calendario.setTime(d.getPk().getDateto()); + if (calendario.get(Calendar.YEAR) == 2999) { + if (d.getAddresstypecatalog().equalsIgnoreCase("3")) { + email = d.getAddress(); + } else if (d.getPrincipal() != null && d.getPrincipal().equalsIgnoreCase("Y")) { + direccion = d.getAddress(); + } + } + } + + //Email + parameters.put("email", email); + + //Direccion + parameters.put("direccion", direccion); + + //Fecha + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + parameters.put("flagAgencia", flagAgencia); + parameters.put("flagArmas", flagArmas); + parameters.put("flagDoc", flagDoc); + parameters.put("flagGuardias", flagGuardias); + parameters.put("flagRequisitos", flagRequisitos); + parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("codResponsable", this.responsableCentroControl.getPk().getPersoncode()); + parameters.put("usuario", user.getName()); + String format = "pdf"; + InputStream pdf = this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + return pdf; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + return null; + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController direccion = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = direccion.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + this.centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + //Reponsable + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + return setInstitucionCentroControl(CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + + } + + /** + * Ejecuta reporte general de informacion de armas, guardias, agencias y + * sucursales + * + * @param name Nombre del reporte a generar. + */ + public InputStream reporteCertificados(String solicitud, boolean flagAgencia, boolean flagArmas, boolean flagDoc, boolean flagGuardias) { + try { + String gradoUsuario = ""; + String path = "armas/reports/reporteCertificado"; + String filename = "reporteCertificado"; + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail user = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if (grado != null) { + gradoUsuario = grado.getDescription() + " - " + this.responsableCentroControl.getName(); + } else { + gradoUsuario = "Sin Grado - " + this.responsableCentroControl.getName(); + } + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("csolicitud", solicitud); + //Obteniendo la solicitud + TarmSolicitud s = SolicitudController.findSolicitudxcodsolicitud(solicitudflujo); + //Obteniendo la direccion + String email = " ", direccion = " "; + List direcciones = PersonAddressController.findAllByPersonCode(s.getPersoncode().toString()); + for (TcustPersonAddress d : direcciones) { + Calendar calendario = Calendar.getInstance(); + calendario.setTime(d.getPk().getDateto()); + if (calendario.get(Calendar.YEAR) == 2999) { + if (d.getAddresstypecatalog().equalsIgnoreCase("3")) { + email = d.getAddress(); + } else if (d.getAddresstypecatalog().equalsIgnoreCase("1")) { + direccion = d.getAddress(); + } + } + } + + //Email + parameters.put("email", email); + //Fecha + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + parameters.put("flagAgencia", flagAgencia); + parameters.put("flagArmas", flagArmas); + parameters.put("flagDoc", flagDoc); + parameters.put("flagGuardias", flagGuardias); + parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("usuario", user.getName()); + parameters.put("codResponsable", this.responsableCentroControl.getPk().getPersoncode()); + String format = "pdf"; + //this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + InputStream pdf = this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + return pdf; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + return null; + } + + public List getLdocumentos() { + return ldocumentos; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + public void setLdocumentos(List ldocumentos) { + this.ldocumentos = ldocumentos; + } + + public String getIdentificacion() { + return identificacion; + } + + public void setIdentificacion(String identificacion) { + this.identificacion = identificacion; + } + + public String getTipoidentificacion() { + return tipoidentificacion; + } + + public void setTipoidentificacion(String tipoidentificacion) { + this.tipoidentificacion = tipoidentificacion; + } + + TarmTramite getFila() { + return fila; + } + + public void setFila(TarmTramite fila) { + this.fila = fila; + } + + public String getFormato() { + return formato; + } + + public void setFormato(String formato) { + this.formato = formato; + } + + public String getMostrarFormato() { + return mostrarFormato; + } + + public void setMostrarFormato(String mostrarFormato) { + this.mostrarFormato = mostrarFormato; + } + + public String getTramiteflujo() { + return tramiteflujo; + } + + public void setTramiteflujo(String tramiteflujo) { + this.tramiteflujo = tramiteflujo; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public String setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + return institucionCentroControl; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public DocumentoHabilitanteController getDocumentoHabilitanteController() { + return documentoHabilitanteController; + } + + public void setDocumentoHabilitanteController( + DocumentoHabilitanteController documentoHabilitanteController) { + this.documentoHabilitanteController = documentoHabilitanteController; + } + + public PersonAddressController getPesonAddressController() { + return pesonAddressController; + } + + public void setPesonAddressController( + PersonAddressController pesonAddressController) { + this.pesonAddressController = pesonAddressController; + } + + public SolicitudController getSolicitudController() { + return solicitudController; + } + + public void setSolicitudController(SolicitudController solicitudController) { + this.solicitudController = solicitudController; + } + + public String getNumeroSolicitud() { + return numeroSolicitud; + } + + public void setNumeroSolicitud(String numeroSolicitud) { + this.numeroSolicitud = numeroSolicitud; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DocumentoHabilitanteController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DocumentoHabilitanteController.java new file mode 100644 index 0000000..39546d7 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DocumentoHabilitanteController.java @@ -0,0 +1,1447 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.event.AjaxBehaviorEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.IngresoDatosTipoTramite; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Controlador que maneja los documentos habilitantes del sistema + * + * @author dcruz O + */ +@ManagedBean +@ViewScoped +public class DocumentoHabilitanteController extends + AbstractController { + + private static final long serialVersionUID = 1L; + + Date fechaInicio, fechaFin; + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddressController; + + public DocumentoHabilitanteController() throws Exception { + super(TarmDocumentoHabilitante.class); + } + + @PostConstruct + public void postConstruct() { + this.init(); + super.startQuery(); + } + + private void init() { + this.beanalias = "DOCUMENTOHABILITANTE"; + this.recperpage = 15; + this.lrecord = new ArrayList<>(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + SubQuery subqueryCategoriaCodigo = new SubQuery("TgeneCatalogDetail", "description", "description", "i.pk.catalog = (select a.tipotramite from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.tipotramitecodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryCategoriaCodigo); + SubQuery subqueryTipocodigo = new SubQuery("TgeneCatalogDetail", "description", "descriptiontram", "i.pk.catalog = (select a.categoria from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.categoriacodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryTipocodigo); + SubQuery subqueryUsocodigo = new SubQuery("TgeneCatalogDetail", "description", "descriptionact", "i.pk.catalog = (select a.usoactividad from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.usoactividadcodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryUsocodigo); + + SubQuery subqueryEstadoDoc = new SubQuery("TgeneCatalogDetail", "description", "estadodocumento", "i.pk.catalog = t.estado" + + " and i.pk.catalogcode= t.estadocode"); + dto.addSubQuery(subqueryEstadoDoc); + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (lrecord != null && !lrecord.isEmpty()) { + for (TarmDocumentoHabilitante doc : lrecord) { + doc.put("seleccionado", Boolean.FALSE); + TarmArmas tarmArma = new TarmArmas(); + tarmArma = ArmasController.find(doc.getCarma(), null); + doc.modifiedData().put("carma", tarmArma == null ? "" : tarmArma.getPk()); + doc.modifiedData().put("clase", tarmArma == null || tarmArma.getModifiedData().get("clase") == null ? "" : tarmArma.getModifiedData().get("clase")); + doc.modifiedData().put("tipo", tarmArma == null || tarmArma.getModifiedData().get("tipo") == null ? "" : tarmArma.getModifiedData().get("tipo")); + doc.modifiedData().put("seriecanon", tarmArma == null || tarmArma.getSeriecanon() == null || tarmArma.getSeriecanon().isEmpty() ? "" : tarmArma.getSeriecanon()); + doc.modifiedData().put("calibre", tarmArma == null || tarmArma.getModifiedData().get("calibre") == null ? "" : Utilidades.formatearDecimalesEnTexto(tarmArma.getModifiedData().get("calibre").toString(), "#.000")); + doc.modifiedData().put("marca", tarmArma == null || tarmArma.getModifiedData().get("marca") == null ? "" : tarmArma.getModifiedData().get("marca")); + doc.modifiedData().put("estado", tarmArma == null || tarmArma.getEstado() == null || tarmArma.getEstado().isEmpty() || tarmArma.getEstadocodigo() == null || tarmArma.getEstadocodigo().isEmpty() ? "" : CatalogDetailController.findxCodigoCodcatalogo(tarmArma.getEstado(), tarmArma.getEstadocodigo()).getDescription()); + } + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Query para filtro por ciertos registros de codigo de tramites + * + * @param listadosTramites + */ + protected void querydatabaseDocumentosCriterioFiltro(List listadosTramites, Boolean validarCaducidadBln, String codigopersona) { + try { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + java.util.Date fechaActual = new java.util.Date(); + Filter filtroDocumento = new Filter(); + StringBuffer bufferQuery = new StringBuffer(); + SimpleDateFormat formato = new SimpleDateFormat("yyyy-MM-dd"); + bufferQuery.append("("); + if (validarCaducidadBln) { + bufferQuery.append("t.fechaexpiracion >= " + "TO_DATE('" + + formato.format(fechaActual) + "','yyyy-MM-dd') and "); + } + int count = 0; + bufferQuery.append("t.personcode = " + codigopersona); + bufferQuery.append(" and t.ctramite in ("); + for (TarmTramite tramite : listadosTramites) { + count++; + bufferQuery.append(tramite.getPk()); + if (count <= listadosTramites.size() - 1) { + bufferQuery.append(","); + } + } + bufferQuery.append(")"); + bufferQuery.append(" and t.estado = 'APR'"); + bufferQuery.append(")"); + + filtroDocumento.setSql(bufferQuery.toString()); + dto.addFiltro(filtroDocumento); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (lrecord != null && !lrecord.isEmpty()) { + for (TarmDocumentoHabilitante doc : lrecord) { + doc.put("seleccionado", Boolean.FALSE); + TarmArmas tarmArma = new TarmArmas(); + tarmArma = ArmasController.find(doc.getCarma(), null); + doc.modifiedData().put("carma", tarmArma == null ? "" : tarmArma.getCodigoarma()); + doc.modifiedData().put("clase", tarmArma == null || tarmArma.getModifiedData().get("clase") == null ? "" : tarmArma.getModifiedData().get("clase")); + doc.modifiedData().put("tipo", tarmArma == null || tarmArma.getModifiedData().get("tipo") == null ? "" : tarmArma.getModifiedData().get("tipo")); + doc.modifiedData().put("seriecanon", tarmArma == null || tarmArma.getSeriecanon() == null || tarmArma.getSeriecanon().isEmpty() ? "" : tarmArma.getSeriecanon()); + doc.modifiedData().put("calibre", tarmArma == null || tarmArma.getModifiedData().get("calibre") == null ? "" : Utilidades.formatearDecimalesEnTexto(tarmArma.getModifiedData().get("calibre").toString(), "#.000")); + doc.modifiedData().put("marca", tarmArma == null || tarmArma.getModifiedData().get("marca") == null ? "" : tarmArma.getModifiedData().get("marca")); + doc.modifiedData().put("estado", tarmArma == null || tarmArma.getEstado() == null || tarmArma.getEstado().isEmpty() || tarmArma.getEstadocodigo() == null || tarmArma.getEstadocodigo().isEmpty() ? "" : CatalogDetailController.findxCodigoCodcatalogo(tarmArma.getEstado(), tarmArma.getEstadocodigo()).getDescription()); + } + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + protected void documentosXPersona(Integer codigoPersona) throws Exception { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + + java.util.Date fechaActual = new java.util.Date(); + //Filter fechaFiltro= new Filter(); + SimpleDateFormat formato = new SimpleDateFormat("yyyy-MM-dd"); + + Filter fechaEstadoFiltro = new Filter(); + StringBuffer bufferQuery = new StringBuffer(); + int count = 0; + bufferQuery.append("t.estado = 'APR' and" + + " t.personcode = '" + codigoPersona.toString() + "' and t.fechaexpiracion >= " + "TO_DATE('" + formato.format(fechaActual) + "','yyyy-MM-dd')"); + + fechaEstadoFiltro.setSql(bufferQuery.toString()); + dto.addFiltro(fechaEstadoFiltro); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp; + try { + try { + resp = callerhelper.executeQuery(request); + } catch (Throwable e) { + // TODO Auto-generated catch block + throw new Exception(); + } + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + //MessageHelper.setMessageError(resp); + throw new Exception(); + } else { + lrecord = (List) resp.get(beanalias); + if (lrecord != null && !lrecord.isEmpty()) { + for (TarmDocumentoHabilitante doc : lrecord) { + doc.put("seleccionado", Boolean.FALSE); + TarmArmas tarmArma = new TarmArmas(); + tarmArma = ArmasController.find(doc.getCarma(), null); + doc.modifiedData().put("carma", tarmArma == null ? "" : tarmArma.getCodigoarma()); + doc.modifiedData().put("clase", tarmArma == null || tarmArma.getModifiedData().get("clase") == null ? "" : tarmArma.getModifiedData().get("clase")); + doc.modifiedData().put("tipo", tarmArma == null || tarmArma.getModifiedData().get("tipo") == null ? "" : tarmArma.getModifiedData().get("tipo")); + doc.modifiedData().put("lote", tarmArma == null || tarmArma.getLote() == null || tarmArma.getLote().isEmpty() ? "" : tarmArma.getLote()); + doc.modifiedData().put("calibre", tarmArma == null || tarmArma.getModifiedData().get("calibre") == null ? "" : Utilidades.formatearDecimalesEnTexto(tarmArma.getModifiedData().get("calibre").toString(), "#.00")); + doc.modifiedData().put("marca", tarmArma == null || tarmArma.getModifiedData().get("marca") == null ? "" : tarmArma.getModifiedData().get("marca")); + doc.modifiedData().put("estado", tarmArma == null || tarmArma.getEstado() == null || tarmArma.getEstado().isEmpty() || tarmArma.getEstadocodigo() == null || tarmArma.getEstadocodigo().isEmpty() ? "" : CatalogDetailController.findxCodigoCodcatalogo(tarmArma.getEstado(), tarmArma.getEstadocodigo()).getDescription()); + + TarmTramite tramiteDocumento = IngresoDatosTipoTramite.find(doc.getCtramite().toString()); + if (tramiteDocumento != null) { + doc.modifiedData().put("destipoTramite", tramiteDocumento.getModifiedData().get("destipoTramite") != null ? tramiteDocumento.getModifiedData().get("destipoTramite").toString() : null); + doc.modifiedData().put("destipoAutorizacion", tramiteDocumento.getModifiedData().get("destipoAutorizacion") != null ? tramiteDocumento.getModifiedData().get("destipoAutorizacion").toString() : null); + doc.modifiedData().put("descategoria", tramiteDocumento.getModifiedData().get("descategoria") != null ? tramiteDocumento.getModifiedData().get("descategoria").toString() : null); + doc.modifiedData().put("desusoactividad", tramiteDocumento.getModifiedData().get("desusoactividad") != null ? tramiteDocumento.getModifiedData().get("desusoactividad").toString() : null); + } else { + doc.modifiedData().put("destipoTramite", null); + doc.modifiedData().put("destipoAutorizacion", null); + doc.modifiedData().put("descategoria", null); + doc.modifiedData().put("desusoactividad", null); + } + } + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Exception e) { + // TODO Auto-generated catch block + throw new Exception(); + } + } + + protected void documentosXTramite(List listadoTramites, Integer codigoPersona) throws Exception { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + + java.util.Date fechaActual = new java.util.Date(); + //Filter fechaFiltro= new Filter(); + SimpleDateFormat formato = new SimpleDateFormat("yyyy-MM-dd"); + + Filter tramitesFiltro = new Filter(); + StringBuffer bufferQuery = new StringBuffer(); + int count = 0; + bufferQuery.append("("); + if (listadoTramites != null) { + for (TarmTramite tramite : listadoTramites) { + count++; + bufferQuery.append("(t.ctramite = " + tramite.getPk() + ") "); + if (count <= listadoTramites.size() - 1) { + bufferQuery.append(" or "); + } + } + } + bufferQuery.append(") and t.estado = 'APR' and" + + " t.personcode = '" + codigoPersona.toString() + "' and t.fechaexpiracion >= " + "TO_DATE('" + formato.format(fechaActual) + "','yyyy-MM-dd')"); + + tramitesFiltro.setSql(bufferQuery.toString()); + dto.addFiltro(tramitesFiltro); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp; + try { + try { + resp = callerhelper.executeQuery(request); + } catch (Throwable e) { + // TODO Auto-generated catch block + throw new Exception(); + } + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + //MessageHelper.setMessageError(resp); + throw new Exception(); + } else { + lrecord = (List) resp.get(beanalias); + if (lrecord != null && !lrecord.isEmpty()) { + for (TarmDocumentoHabilitante doc : lrecord) { + doc.put("seleccionado", Boolean.FALSE); + TarmArmas tarmArma = new TarmArmas(); + tarmArma = ArmasController.find(doc.getCarma(), null); + doc.modifiedData().put("carma", tarmArma == null ? "" : tarmArma.getCodigoarma()); + doc.modifiedData().put("clase", tarmArma == null || tarmArma.getModifiedData().get("clase") == null ? "" : tarmArma.getModifiedData().get("clase")); + doc.modifiedData().put("tipo", tarmArma == null || tarmArma.getModifiedData().get("tipo") == null ? "" : tarmArma.getModifiedData().get("tipo")); + doc.modifiedData().put("lote", tarmArma == null || tarmArma.getLote() == null || tarmArma.getLote().isEmpty() ? "" : tarmArma.getLote()); + doc.modifiedData().put("calibre", tarmArma == null || tarmArma.getModifiedData().get("calibre") == null ? "" : Utilidades.formatearDecimalesEnTexto(tarmArma.getModifiedData().get("calibre").toString(), "#.00")); + doc.modifiedData().put("marca", tarmArma == null || tarmArma.getModifiedData().get("marca") == null ? "" : tarmArma.getModifiedData().get("marca")); + doc.modifiedData().put("estado", tarmArma == null || tarmArma.getEstado() == null || tarmArma.getEstado().isEmpty() || tarmArma.getEstadocodigo() == null || tarmArma.getEstadocodigo().isEmpty() ? "" : CatalogDetailController.findxCodigoCodcatalogo(tarmArma.getEstado(), tarmArma.getEstadocodigo()).getDescription()); + + TarmTramite tramiteDocumento = IngresoDatosTipoTramite.find(doc.getCtramite().toString()); + if (tramiteDocumento != null) { + doc.modifiedData().put("destipoTramite", tramiteDocumento.getModifiedData().get("destipoTramite") != null ? tramiteDocumento.getModifiedData().get("destipoTramite").toString() : null); + doc.modifiedData().put("destipoAutorizacion", tramiteDocumento.getModifiedData().get("destipoAutorizacion") != null ? tramiteDocumento.getModifiedData().get("destipoAutorizacion").toString() : null); + doc.modifiedData().put("descategoria", tramiteDocumento.getModifiedData().get("descategoria") != null ? tramiteDocumento.getModifiedData().get("descategoria").toString() : null); + doc.modifiedData().put("desusoactividad", tramiteDocumento.getModifiedData().get("desusoactividad") != null ? tramiteDocumento.getModifiedData().get("desusoactividad").toString() : null); + } else { + doc.modifiedData().put("destipoTramite", null); + doc.modifiedData().put("destipoAutorizacion", null); + doc.modifiedData().put("descategoria", null); + doc.modifiedData().put("desusoactividad", null); + } + } + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Exception e) { + // TODO Auto-generated catch block + throw new Exception(); + } + } + + /** + * Query para filtro por ciertos registros de codigo de tramites + * + * @param listadoSolicitudes + * @throws Exception + * @throws Throwable + */ + protected void querydatabaseDocumentosCriterioFiltro(List listadoSolicitudes, Integer codigoPersona) throws Exception { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + java.util.Date fechaActual = new java.util.Date(); + //Filter fechaFiltro= new Filter(); + SimpleDateFormat formato = new SimpleDateFormat("yyyy-MM-dd"); + + Filter tramitesFiltro = new Filter(); + StringBuffer bufferQuery = new StringBuffer(); + int count = 0; + bufferQuery.append("("); + if (listadoSolicitudes != null) { + for (TarmSolicitud solicitud : listadoSolicitudes) { + count++; + bufferQuery.append("(t.ctramite = " + solicitud.getCtramite() + " and t.csolicitud = " + solicitud.getPk() + ") "); + if (count <= listadoSolicitudes.size() - 1) { + bufferQuery.append(" or "); + } + } + } + bufferQuery.append(") and t.estado = 'APR' and" + + " t.personcode = '" + codigoPersona.toString() + "' and t.fechaexpiracion >= " + "TO_DATE('" + + formato.format(fechaActual) + "','yyyy-MM-dd')"); + + tramitesFiltro.setSql(bufferQuery.toString()); + dto.addFiltro(tramitesFiltro); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp; + try { + try { + resp = callerhelper.executeQuery(request); + } catch (Throwable e) { + // TODO Auto-generated catch block + throw new Exception(); + } + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + //MessageHelper.setMessageError(resp); + throw new Exception(); + } else { + lrecord = (List) resp.get(beanalias); + if (lrecord != null && !lrecord.isEmpty()) { + for (TarmDocumentoHabilitante doc : lrecord) { + doc.put("seleccionado", Boolean.FALSE); + TarmArmas tarmArma = new TarmArmas(); + tarmArma = ArmasController.find(doc.getCarma(), null); + doc.modifiedData().put("carma", tarmArma == null ? "" : tarmArma.getCodigoarma()); + doc.modifiedData().put("clase", tarmArma == null || tarmArma.getModifiedData().get("clase") == null ? "" : tarmArma.getModifiedData().get("clase")); + doc.modifiedData().put("tipo", tarmArma == null || tarmArma.getModifiedData().get("tipo") == null ? "" : tarmArma.getModifiedData().get("tipo")); + doc.modifiedData().put("seriecanon", tarmArma == null || tarmArma.getSeriecanon() == null || tarmArma.getSeriecanon().isEmpty() ? "" : tarmArma.getSeriecanon()); + doc.modifiedData().put("calibre", tarmArma == null || tarmArma.getModifiedData().get("calibre") == null ? "" : Utilidades.formatearDecimalesEnTexto(tarmArma.getModifiedData().get("calibre").toString(), "#.00")); + doc.modifiedData().put("marca", tarmArma == null || tarmArma.getModifiedData().get("marca") == null ? "" : tarmArma.getModifiedData().get("marca")); + doc.modifiedData().put("estado", tarmArma == null || tarmArma.getEstado() == null || tarmArma.getEstado().isEmpty() || tarmArma.getEstadocodigo() == null || tarmArma.getEstadocodigo().isEmpty() ? "" : CatalogDetailController.findxCodigoCodcatalogo(tarmArma.getEstado(), tarmArma.getEstadocodigo()).getDescription()); + } + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Exception e) { + // TODO Auto-generated catch block + throw new Exception(); + } + + } + + @SuppressWarnings("unchecked") + protected void querybase() { + try { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + dto.setOrderby("t.fechaemision"); + + if (getMfilelds().get("auxfiltro") != null) { + Filter filtro = new Filter(); + filtro.setSql(getMfilelds().get("auxfiltro").toString());//"t.ctramite in (Select ctramite from tarmtramite where tipoautorizacion='1'"); + dto.addFiltro(filtro); + } + + if (getMfilelds().get("fechafiltro") != null) { + Filter filtrofecha = new Filter(); + filtrofecha.setSql(getMfilelds().get("fechafiltro").toString()); + dto.addFiltro(filtrofecha); + } + + if (getMfilelds().get("numdocumentoshabilitante") != null) { + Filter filtrodoc = new Filter(); + filtrodoc.setSql(getMfilelds().get("numdocumentoshabilitante").toString()); + dto.addFiltro(filtrodoc); + } + + SubQuery subQuerytipotramite = new SubQuery("TarmTramite", "tipotramite", "tipotramite", "i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipotramite); + + SubQuery subQuerytipotramitecodigo = new SubQuery("TarmTramite", "tipotramitecodigo", "tipotramitecodigo", "i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipotramitecodigo); + + SubQuery subQuerytipoautorizacion = new SubQuery("TarmTramite", "tipoautorizacion", "tipoautorizacion", "i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipoautorizacion); + + SubQuery subQuerytipoautorizacioncodigo = new SubQuery("TarmTramite", "tipoautorizacioncodigo", "tipoautorizacioncodigo", "i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipoautorizacioncodigo); + + SubQuery subQuerycategoria = new SubQuery("TarmTramite", "categoria", "categoria", "i.pk=t.ctramite"); + dto.addSubQuery(subQuerycategoria); + + SubQuery subQuerycategoriacodigo = new SubQuery("TarmTramite", "categoriacodigo", "categoriacodigo", "i.pk=t.ctramite"); + dto.addSubQuery(subQuerycategoriacodigo); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + + lrecord = (List) resp.get(beanalias); + if (lrecord != null && !lrecord.isEmpty()) { + + record = lrecord.get(0); + } + super.postQuery(lrecord); + + for (int i = 0; i < this.lrecord.size(); i++) { + + try { + TgeneCatalogDetail tipotramite = CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("tipotramite").toString(), this.lrecord.get(i).getModifiedData().get("tipotramitecodigo").toString()); + this.lrecord.get(i).getModifiedData().put("tipotramitedesc", tipotramite.getDescription()); + } catch (Exception e) { + e.printStackTrace(); + } + try { + TgeneCatalogDetail tipo = CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("tipoautorizacion").toString(), this.lrecord.get(i).getModifiedData().get("tipoautorizacioncodigo").toString()); + this.lrecord.get(i).getModifiedData().put("tipoautorizacioncodigodesc", tipo.getDescription()); + + } catch (Exception e) { + e.printStackTrace(); + } + try { + TgeneCatalogDetail tipo = CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("categoria").toString(), this.lrecord.get(i).getModifiedData().get("categoriacodigo").toString()); + this.lrecord.get(i).getModifiedData().put("categoriacodigodesc", tipo.getDescription()); + + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + protected void querydatabaseInspeccion2(Date fechaInicio, Date fechaFin, TarmCentroControl centroControl) { + try { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + dto.setOrderby("fechaexpiracion"); + + //Nombre/Razon social + SubQuery subqueryNombre = new SubQuery("TcustPersonDetail", "name", "nombre", "i.pk.personcode=t.personcode and i.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryNombre); + SubQuery subqueryNDocumento = new SubQuery("TcustPersonDetail", "identification", "nodocumento", "i.pk.personcode=t.personcode and i.pk.dateto= to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryNDocumento); + //datos del tramite + //Tipo de tramite + SubQuery subqueryTipoTramite = new SubQuery("TgeneCatalogDetail", "description", "tipotramite", "i.pk.catalog= (select o.tipotramite from TarmTramite o where o.pk=t.ctramite) and" + + " i.pk.catalogcode=(select o.tipotramitecodigo from TarmTramite o where o.pk=t.ctramite)"); + dto.addSubQuery(subqueryTipoTramite); + SubQuery subqueryTramite = new SubQuery("TgeneCatalogDetail", "description", "tipoautorizacion", "i.pk.catalog= (select o.tipoautorizacion from TarmTramite o where o.pk=t.ctramite) and" + + " i.pk.catalogcode=(select o.tipoautorizacioncodigo from TarmTramite o where o.pk=t.ctramite) "); + dto.addSubQuery(subqueryTramite); + //Uso/Actividad + SubQuery subqueryUsoActividad = new SubQuery("TgeneCatalogDetail", "description", "usoactividad", "i.pk.catalog= (select o.usoactividad from TarmTramite o where o.pk=t.ctramite) and" + + " i.pk.catalogcode=(select o.usoactividadcodigo from TarmTramite o where o.pk=t.ctramite)"); + dto.addSubQuery(subqueryUsoActividad); + //Categoria + SubQuery subqueryCategoria = new SubQuery("TgeneCatalogDetail", "description", "categoria", "i.pk.catalog= (select o.categoria from TarmTramite o where o.pk=t.ctramite) and" + + " i.pk.catalogcode=(select o.categoriacodigo from TarmTramite o where o.pk=t.ctramite)"); + dto.addSubQuery(subqueryCategoria); + + SubQuery subqueryCodTramite = new SubQuery("TarmTramite", "pk", "ctramite", "i.pk= t.ctramite"); + dto.addSubQuery(subqueryCodTramite); + + //Filtros de fecha inicio y fin + if (fechaInicio != null) { + //dto.addFiltro(new Filter("fechaexpiracion", ">=", fechaInicio.toString())); + //dto.addFiltro(new Filter("fechaexpiracion", "<", this.fechaFin.toString())); + Filter filtro = new Filter(); + filtro.setSql( + //+ "t.fechaexpiracion>=TO_DATE('" + dateFormat.format(fechaInicio)+ "','yyyy-MM-dd')" + "t.fechaexpiracion<=TO_DATE('" + dateFormat.format(fechaFin) + "','yyyy-MM-dd')" + + " and t.ctramite in (select o.pk from TarmTramite o where o.tipoautorizacion = '1' and o.requiereinspeccion = 'Y') " + + " and t.centrocontrol ='" + centroControl.getPk() + "'" + //+ " and t.csolicitud in (select q.pk from TarmSolicitud q where q.ccentrocontrol = '" + centroControl.getPk() + "' )" + + " and t.estado = 'APR'"); + + dto.addFiltro(filtro); + } + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (lrecord != null && !lrecord.isEmpty()) { + for (TarmDocumentoHabilitante doc : lrecord) { + doc.put("seleccionado", Boolean.FALSE); + } + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + //Anteriormente se usaba para consultar actualmente ya no + protected void querydatabaseInspeccion() { + try { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + dto.setOrderby("fechaexpiracion"); + + //Nombre/Razon social + //SubQuery subqueryNombre= new SubQuery("TcustPersonDetail","name","nombre","i.pk.personcode=t.personcode"); + //dto.addSubQuery(subqueryNombre); + //Filtros de fecha inicio y fin + if (this.fechaInicio != null) { + dto.addFiltro(new Filter("fechaexpiracion", ">=", this.fechaInicio.toString())); + //dto.addFiltro(new Filter("fechaexpiracion", "<", this.fechaFin.toString())); + } + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (lrecord != null && !lrecord.isEmpty()) { + for (TarmDocumentoHabilitante doc : lrecord) { + doc.put("seleccionado", Boolean.FALSE); + } + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para guardar el documento habilitante + * + * @throws Throwable + */ + public void saveDocumentoHabilitante() throws Throwable { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } + + /** + * Devueleve el tipo de tramite de un documento + * + * @param documento + * @return + */ + public String tipoTramite(TarmDocumentoHabilitante documento) { + String tipo = ""; + try { + //Obteniendo la solicitud + TarmSolicitud solicitud = ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(documento.getCsolicitud()); + + if (solicitud != null) { + TarmTramite tramite = TarmTramiteController.find(solicitud.getCtramite().toString()); + if (tramite != null && tramite.getTipotramite() != null && !tramite.getTipotramite().isEmpty() + && tramite.getTipotramitecodigo() != null && !tramite.getTipotramitecodigo().isEmpty()) { + TgeneCatalogDetail catalogoTipoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + if (catalogoTipoTramite != null) { + tipo = catalogoTipoTramite.getDescription(); + } + } + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + return tipo; + } + + public String tramite(TarmDocumentoHabilitante documento) { + String tipo = ""; + try { + //Obteniendo la solicitud + TarmSolicitud solicitud = ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(documento.getCsolicitud()); + + if (solicitud != null) { + TarmTramite tramite = TarmTramiteController.find(solicitud.getCtramite().toString()); + if (tramite != null && tramite.getTipoautorizacion() != null && !tramite.getTipoautorizacion().isEmpty() + && tramite.getTipoautorizacioncodigo() != null && !tramite.getTipoautorizacioncodigo().isEmpty()) { + TgeneCatalogDetail catalogoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + if (catalogoTramite != null) { + tipo = catalogoTramite.getDescription(); + } + } + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + return tipo; + } + + /** + * Devueleve la categoria de un documento + * + * @param documento + * @return + */ + public String categoria(TarmDocumentoHabilitante documento) { + String categoria = ""; + try { + //Obteniendo la solicitud + TarmSolicitud solicitud = ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(documento.getCsolicitud()); + + if (solicitud != null) { + TarmTramite tramite = TarmTramiteController.find(solicitud.getCtramite().toString()); + if (tramite != null && tramite.getCategoria() != null && !tramite.getCategoria().isEmpty() + && tramite.getCategoriacodigo() != null && !tramite.getCategoriacodigo().isEmpty()) { + TgeneCatalogDetail catalogoCategoria = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + if (catalogoCategoria != null) { + categoria = catalogoCategoria.getDescription(); + } + } + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + return categoria; + } + + public static List findInspeccionesGenerar(Date fechaInicio, Date fechaFin, TarmCentroControl centroControl) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 300000; + //cc.addFilter("personcode", personcode); + cc.querydatabaseInspeccion2(fechaInicio, fechaFin, centroControl); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findDocumentosDelTramite(String personcode, String filtro) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 3000; + cc.addFilter("personcode", personcode); + cc.getMfilelds().put("auxfiltro", filtro); + cc.querybase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findPorPersoncode(String personcode) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 3000; + cc.addFilter("personcode", personcode); + cc.querybase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * buscar el permiso de coumento habilitante por arma + * + * @return + */ + public static TarmDocumentoHabilitante findxarma(String codigoarma, String personcode) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 30; + cc.addFilter("codigoarma", codigoarma); + cc.addFilter("personcode", personcode); + cc.querybase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findPorPersoncodeaut(String personcode) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 30; + cc.addFilter("personcode", personcode); + cc.addFilter("estado", "APR"); + cc.getMfilelds().put("auxfiltro", "t.ctramite in (Select ta.pk from com.fp.persistence.parmas.param.TarmTramite ta where ta.tipoautorizacion='1') and" + + " ctramite in (select o from TarmTramite o where o.sancionable is not null and o.sancionable='Y') ");//tramite que sean sancionables + cc.getMfilelds().put("fechafiltro", "t.fechaemision = (Select max(ta.fechaemision) from com.fp.persistence.parmas.soli.TarmDocumentoHabilitante ta where t.ctramite=ta.ctramite and t.personcode=ta.personcode )"); + cc.querybase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findXSolicitudNueva(String csolicitud) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 30; + cc.getMfilelds().put("numdocumentoshabilitante", "t.pk in (Select sd.pk.cdocumento from com.fp.persistence.parmas.soli.TarmSolicitud s, com.fp.persistence.parmas.soli.TarmSolicitudDocumento sd where s.pk = sd.pk.csolicitud and s.pk = '" + csolicitud + "')"); + cc.querybase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Devueleve la categoria de un documento + * + * @param documento + * @return + */ + public String usoActividad(TarmDocumentoHabilitante documento) { + String usoActividad = ""; + try { + //Obteniendo la solicitud + TarmSolicitud solicitud = ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(documento.getCsolicitud()); + + if (solicitud != null) { + TarmTramite tramite = TarmTramiteController.find(solicitud.getCtramite().toString()); + if (tramite != null && tramite.getUsoactividad() != null && !tramite.getUsoactividad().isEmpty() + && tramite.getUsoactividadcodigo() != null && !tramite.getUsoactividadcodigo().isEmpty()) { + TgeneCatalogDetail catalogoUso = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + if (catalogoUso != null) { + usoActividad = catalogoUso.getDescription(); + } + } + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + return usoActividad; + } + + /** + * Devueleve la ubicacion de un documento + * + * @param documento + * @return + */ + public String ubicacion(TarmDocumentoHabilitante documento) { + String ubicacion = ""; + try { + TcustPersonDetail detallesPersona = PersonDetailController.find(documento.getPersoncode().toString()); + + if (detallesPersona != null) { + personAddressController.findPrincipal(String.valueOf(documento.getPersoncode())); + + if (personAddressController.getLrecord().get(0).getProvincecode() != null && !personAddressController.getLrecord().get(0).getProvincecode().isEmpty()) { + + List provinceList = ProvinceController.findPorCodigo("EC", personAddressController.getLrecord().get(0).getProvincecode()); + ubicacion = provinceList.get(0).getDescription(); + } + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + return ubicacion; + } + + /** + * Devuelve el estado de un documento habilitante + * + * @param documento documento + * @return estado + */ + public String estado(TarmDocumentoHabilitante documento) { + TgeneCatalogDetail estado = new TgeneCatalogDetail(); + try { + if (documento == null) { + return ""; + } + estado = CatalogDetailController.findxCodigoCodcatalogo(documento.getEstado(), documento.getEstadocode()); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + return estado.getDescription(); + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if (Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")) { + valorColocar = Boolean.TRUE; + } + for (TarmDocumentoHabilitante documentoHabilitante : lrecord) { + documentoHabilitante.getModifiedData().put("seleccionado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodod que devuelve un documento habilitante por el codigo de solicitud + * + * @param codigoSolicitud + * @return + */ + public static TarmDocumentoHabilitante findPorSolicitud(String codigoSolicitud) { + try { + if (codigoSolicitud == null || codigoSolicitud.isEmpty()) { + return null; + } + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("csolicitud", codigoSolicitud); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodod que devuelve un documento habilitante por el codigo de solicitud + * + * @param codigoSolicitud + * @return + */ + public static TarmDocumentoHabilitante findPorTramite(String codigoTramite) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("ctramite", codigoTramite); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodod que obtiene un documento habilitante por su codigo + * + * @param codigoSolicitud + * @return + */ + public static TarmDocumentoHabilitante findPorCodigo(String cdocumento) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", cdocumento); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Método que retorna el documento habilitante por id + * + * @param cdocumento + * @return + */ + public static TarmDocumentoHabilitante find(String cdocumento) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", cdocumento); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * buscar el permiso de coumento habilitante por arma + * + * @return + */ + public static TarmDocumentoHabilitante findxarma(String codigoarma) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("codigoarma", codigoarma); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Método que consulta de la entidad TarmDocumentoHabilitante por + * código de documento + */ + public static TarmDocumentoHabilitante findPorCDocumento(String cdocumento) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 15; + cc.addFilter("pk", cdocumento); + cc.querybase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findByPerson_Inventario(String personcode) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 30; + cc.addFilter("personcode", personcode); + cc.addFilter("estado", "APR"); + cc.getMfilelds().put("fechafiltro", "t.fechaexpiracion >=now() and" + + " ctramite in (select tra.pk from TarmTramite tra where tra.categoria in ('2','3','4','5','8','11') and tipoautorizacion='1')");//1 autorizacion + cc.querybasesimle(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findpersoncode(String personcode, String categoria) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 30; + cc.addFilter("personcode", personcode); + cc.addFilter("estado", "APR"); + if (categoria.equals("4")) { + cc.getMfilelds().put("fechafiltro", "t.fechaexpiracion >=now() and" + + " ctramite in (select tra.pk from TarmTramite tra where tra.categoria in ('2','3','4','5','8','11') and tipoautorizacion='1')");//1 autorizacion + } else { + cc.getMfilelds().put("fechafiltro", "t.fechaexpiracion >=to_date(now(),'dd/MM/yyyy') and" + + " ctramite in (select tra.pk from TarmTramite tra where tra.categoria='" + categoria + "' and tipoautorizacion='1')");//1 autorizacion + } + cc.querybasesimle(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findpersoncodeInventario(String personcode, String categoria) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 30; + cc.addFilter("personcode", personcode); + cc.addFilter("estado", "APR"); + if (categoria.equals("4")) { + cc.getMfilelds().put("fechafiltro", "ctramite in (select tra.pk from TarmTramite tra where tra.categoria in ('2','3','4','5','8','11') and tipoautorizacion='1')");//1 autorizacion + } else { + cc.getMfilelds().put("fechafiltro", "ctramite in (select tra.pk from TarmTramite tra where tra.categoria='" + categoria + "' and tipoautorizacion='1')");//1 autorizacion + } + cc.querybasesimle(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que busca los documentos habilitantes por persona para registro de + * produccion + * + * @param personcode + * @return List + */ + public static List findByPerson_Produccion(String personcode) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("personcode", personcode); + cc.addFilter("estado", "APR"); + + cc.getMfilelds().put("fechafiltro", "t.fechaexpiracion >=now() and" + + " ctramite in (select tra.pk from TarmTramite tra where tra.categoria in ('4','5') and tipoautorizacion='1')");//1 autorizacion + + cc.querybasesimle(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que busca los documentos habilitantes por persona para registro de + * importaciones + * + * @param personcode + * @return List + */ + public static List findByPerson_Importacion(String personcode) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("personcode", personcode); + cc.addFilter("estado", "APR"); + // FILTROS: tipoautorizacion='1' --> 1 AUTORIZACION + // FILTROS: tra.categoria='8' --> 8 IMPORTADOR + cc.getMfilelds().put("fechafiltro", "t.fechaexpiracion >=to_date(now(),'dd/MM/yyyy') and" + + " ctramite in (select tra.pk from TarmTramite tra where tra.categoria='8' and tipoautorizacion='1')"); + + cc.querybasesimle(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + @SuppressWarnings("unchecked") + protected void querybasesimle() { + try { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + dto.setOrderby("t.fechaemision"); + + if (getMfilelds().get("auxfiltro") != null) { + Filter filtro = new Filter(); + filtro.setSql(getMfilelds().get("auxfiltro").toString());//"t.ctramite in (Select ctramite from tarmtramite where tipoautorizacion='1'"); + dto.addFiltro(filtro); + } + + if (getMfilelds().get("fechafiltro") != null) { + Filter filtrofecha = new Filter(); + filtrofecha.setSql(getMfilelds().get("fechafiltro").toString()); + dto.addFiltro(filtrofecha); + } + + if (getMfilelds().get("numdocumentoshabilitante") != null) { + Filter filtrodoc = new Filter(); + filtrodoc.setSql(getMfilelds().get("numdocumentoshabilitante").toString()); + dto.addFiltro(filtrodoc); + } + + SubQuery subqueryCategoriaCodigo = new SubQuery("TgeneCatalogDetail", "description", "description", "i.pk.catalog = (select a.tipotramite from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.tipotramitecodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryCategoriaCodigo); + SubQuery subqueryTipocodigo = new SubQuery("TgeneCatalogDetail", "description", "descriptiontram", "i.pk.catalog = (select a.categoria from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.categoriacodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryTipocodigo); + SubQuery subqueryUsocodigo = new SubQuery("TgeneCatalogDetail", "description", "descriptionact", "i.pk.catalog = (select a.usoactividad from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.usoactividadcodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryUsocodigo); + + SubQuery subQuerytipotramite = new SubQuery("TarmTramite", "tipotramite", "tipotramite", "i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipotramite); + + SubQuery subQuerytipotramitecodigo = new SubQuery("TarmTramite", "tipotramitecodigo", "tipotramitecodigo", "i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipotramitecodigo); + + SubQuery subQuerytipoautorizacion = new SubQuery("TarmTramite", "tipoautorizacion", "tipoautorizacion", "i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipoautorizacion); + + SubQuery subQuerytipoautorizacioncodigo = new SubQuery("TarmTramite", "tipoautorizacioncodigo", "tipoautorizacioncodigo", "i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipoautorizacioncodigo); + + SubQuery subQuerycategoria = new SubQuery("TarmTramite", "categoria", "categoria", "i.pk=t.ctramite"); + dto.addSubQuery(subQuerycategoria); + + SubQuery subQuerycategoriacodigo = new SubQuery("TarmTramite", "categoriacodigo", "categoriacodigo", "i.pk=t.ctramite"); + dto.addSubQuery(subQuerycategoriacodigo); + + SubQuery subQueryclase = new SubQuery("TarmTramite", "clase", "clase", "i.pk=t.ctramite"); + dto.addSubQuery(subQueryclase); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static List findByPersonCode(Integer personcode) { + try { + DocumentoHabilitanteController cc = new DocumentoHabilitanteController(); + cc.init(); + cc.recperpage = 5000; + if (personcode != null) { + cc.addFilter("personcode", personcode.toString()); + } + cc.getMfilelds().put("pathSuspencion", "t.pathSuspencion is not null"); + cc.querydocumhabsusp(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + @SuppressWarnings("unchecked") + protected void querydocumhabsusp() { + try { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + dto.setOrderby("t.fechaemision"); + + if (getMfilelds().get("pathSuspencion") != null) { + Filter filtrodoc = new Filter(); + filtrodoc.setSql(getMfilelds().get("pathSuspencion").toString()); + dto.addFiltro(filtrodoc); + } + //Nombre/Razon social + SubQuery subqueryNombre = new SubQuery("TcustPersonDetail", "name", "nombre", "i.pk.personcode=t.personcode and i.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryNombre); + SubQuery subqueryNDocumento = new SubQuery("TcustPersonDetail", "identification", "nodocumento", "i.pk.personcode=t.personcode and i.pk.dateto= to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryNDocumento); + + SubQuery subqueryCategoriaCodigo = new SubQuery("TgeneCatalogDetail", "description", "description", "i.pk.catalog = (select a.tipotramite from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.tipotramitecodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryCategoriaCodigo); + SubQuery subqueryTipocodigo = new SubQuery("TgeneCatalogDetail", "description", "descriptiontram", "i.pk.catalog = (select a.categoria from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.categoriacodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryTipocodigo); + SubQuery subqueryUsocodigo = new SubQuery("TgeneCatalogDetail", "description", "descriptionact", "i.pk.catalog = (select a.usoactividad from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.usoactividadcodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryUsocodigo); + + SubQuery subQuerytipotramite = new SubQuery("TarmTramite", "tipotramite", "tipotramite", "i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipotramite); + + SubQuery subQuerytipotramitecodigo = new SubQuery("TarmTramite", "tipotramitecodigo", "tipotramitecodigo", "i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipotramitecodigo); + + SubQuery subQuerytipoautorizacion = new SubQuery("TarmTramite", "tipoautorizacion", "tipoautorizacion", "i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipoautorizacion); + + SubQuery subQuerytipoautorizacioncodigo = new SubQuery("TarmTramite", "tipoautorizacioncodigo", "tipoautorizacioncodigo", "i.pk=t.ctramite"); + dto.addSubQuery(subQuerytipoautorizacioncodigo); + + SubQuery subQuerycategoria = new SubQuery("TarmTramite", "categoria", "categoria", "i.pk=t.ctramite"); + dto.addSubQuery(subQuerycategoria); + + SubQuery subQuerycategoriacodigo = new SubQuery("TarmTramite", "categoriacodigo", "categoriacodigo", "i.pk=t.ctramite"); + dto.addSubQuery(subQuerycategoriacodigo); + + SubQuery subQueryclase = new SubQuery("TarmTramite", "clase", "clase", "i.pk=t.ctramite"); + dto.addSubQuery(subQueryclase); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public PersonAddressController getPersonAddressController() { + return personAddressController; + } + + public void setPersonAddressController( + PersonAddressController personAddressController) { + this.personAddressController = personAddressController; + } + + public Date getFechaInicio() { + return fechaInicio; + } + + public void setFechaInicio(Date fechaInicio) { + this.fechaInicio = fechaInicio; + } + + public Date getFechaFin() { + return fechaFin; + } + + public void setFechaFin(Date fechaFin) { + this.fechaFin = fechaFin; + } + + /** + * Valida que no se puedan seleccionar documentos de fecha emision anterior + * al sistema MAIA + * + * @param event + */ + public void validaNoSeleccionDocAnteriores(AjaxBehaviorEvent event) { + TarmDocumentoHabilitante documentoSeleccionado = this.getLrecord().get(Integer.parseInt(event.getComponent().getAttributes().get("documentoSeleccionado").toString())); + // FECHA 15 DE JUNIO DEL 2015 - PUESTA EN PRODUCCION + Calendar datePuestaProduccion = new GregorianCalendar(2015, 5, 15); //2015, 06, 15 + if (documentoSeleccionado.getFechaemision().before(datePuestaProduccion.getTime())) { + documentoSeleccionado.getModifiedData().put("seleccionado", Boolean.FALSE); + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_reimpresionprevianopermitida")); + } + } + + public void update(TarmDocumentoHabilitante bean) throws Exception { + record = bean; + super.update(); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DocumentoHabilitanteDetalleController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DocumentoHabilitanteDetalleController.java new file mode 100644 index 0000000..216de69 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/DocumentoHabilitanteDetalleController.java @@ -0,0 +1,172 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitanteDetall; + +/** + * @author Carlos Guzman + * + */ +@ManagedBean +@ViewScoped +public class DocumentoHabilitanteDetalleController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 8586936319898253550L; + + public DocumentoHabilitanteDetalleController() throws Exception { + super(TarmDocumentoHabilitanteDetall.class); + } + + @PostConstruct + public void postConstruct() { + this.init(); + super.startQuery(); + } + + private void init() { + this.beanalias = "DOCUMENTOHABILITANTEDETAIL"; + this.recperpage = 15; + this.lrecord = new ArrayList<>(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodod que devuelve un documento habilitante detalle por el codigo de + * documento + * + * @param codigoDocumento + * @return + */ + public static TarmDocumentoHabilitanteDetall findPorCodigoDocumento(String codigoDocumento) { + try { + DocumentoHabilitanteDetalleController cc = new DocumentoHabilitanteDetalleController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("cdocumento", codigoDocumento); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodod que devuelve un documento habilitante detalle por el codigo de + * documento + * + * @param codigoDocumento + * @return + */ + public static TarmDocumentoHabilitanteDetall findPorCDocumento(String cDocumento) { + try { + DocumentoHabilitanteDetalleController cc = new DocumentoHabilitanteDetalleController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("cdocumento", cDocumento); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodod que obtiene un documento habilitante por su codigo + * + * @param codigoSolicitud + * @return + */ + public static TarmDocumentoHabilitanteDetall findPorCodigo(String cdetalle) { + try { + DocumentoHabilitanteDetalleController cc = new DocumentoHabilitanteDetalleController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", cdetalle); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/EmitirDocumentoHabilitante.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/EmitirDocumentoHabilitante.java new file mode 100644 index 0000000..6e89ab1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/EmitirDocumentoHabilitante.java @@ -0,0 +1,816 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Descarga el Documento Habilitante dependidendo del tramite que se seleccione + * + * @author Andres Cevallos + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class EmitirDocumentoHabilitante extends AbstractController { + + /** + * Controlador Inyectado ReportController + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + /** + * Controador Inyectado TarmTramiteController + */ + @ManagedProperty(value = "#{tramiteController}") + private TarmTramiteController tramiteController; + + /** + * Referencia al Centro de control; + */ + private TarmCentroControl centroControl = new TarmCentroControl(); + + /** + * Referencia a la solicitud del tramite + */ + private TarmSolicitudTramite solicitudTramite; + + /** + * Referencia a la Solicitud + */ + private TarmSolicitud solicitud; + /** + * Fila de la lista de tramites + */ + private TarmTramite fila; + /** + * Detalles de la persona + */ + private TcustPersonDetail detallesPersona; + /** + * Detalle del usuario + */ + private TcustPersonDetail usuario; + /** + * Documento Habilitante relacionado con el tramite + */ + private TarmDocumentoHabilitante documentoHabilitante; + /** + * Numero de Tramite realizado + */ + private String numeroTramite; + /** + * Nombre de la persona + */ + private String nombreRazonSocial; + /** + * Formato de generacion de pdf + */ + private String formato = "pdf"; + /** + * Formato que se muestra en pantalla + */ + private String mostrarFormato = "PDF"; +// TcustPersonDetail detallesPersona; + /** + * Lista de Solicitudes + */ + private List lsolicitud; + /** + * Responsable de centro de control + */ + private TcustPersonDetail responsableCentroControl = null; + /** + * Detalle de Usuarios + */ + private TsafeUserDetail tsafeUserDetailUsuario = null; +// String numeroTramite; +// String nombreRazonSocial; + /** + * Detalle de identificacion + */ + private String identificacion; + /** + * Tipo de identificacion + */ + private String tipoidentificacion; + /** + * Habilita y deshabilita la impresion + */ + private boolean imprimir; + + /** + * Nombre de la Institucion + */ + private String nombreInstitucion; + + private List ldocumentos; + + public EmitirDocumentoHabilitante() throws Exception { + super(TarmSolicitudTramite.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // super.startQuery(); + } + + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + // lrecord = new ArrayList<>(); + beanalias = "EMITIRDOCUMENTOHABILITANTE"; + ldocumentos = new ArrayList(); + ldocumentos = CatalogDetailController.find("IDENTIFICATION"); + //Obteniendo el tramite + //solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud("1"); + + //Obteniendo la solicitud + //solicitud=ValidacionTramiteLibreTransitoController.findPorSolicitudSimple("1"); + //this.numeroTramite=solicitudTramite.getNumerotramite(); + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + //Obteniendo el documento habilitante + // documentoHabilitante=DocumentoHabilitanteController.findPorSolicitud("1"); + this.responsableCentroControl = new TcustPersonDetail(); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + this.obtenerCentroControl(); + this.obtenerResponsableCentroControl(); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + + try { + String sql = encontrarUsuario(); + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + if (sql != null) { + Filter filtro = new Filter(); + filtro.setSql(sql); + dto.addFiltro(filtro); + } else { + this.lrecord = null; + return; + } + SubQuery subqueryUso = new SubQuery("TarmTramite", "usoactividad", "actividad", "i.pk in (select a.ctramite from TarmSolicitud a where a.pk=t.pk.csolicitud)"); + dto.addSubQuery(subqueryUso); + SubQuery subqueryPersona = new SubQuery("TarmSolicitud", "personcode", "persona", "i.pk=t.pk.csolicitud"); + dto.addSubQuery(subqueryPersona); + SubQuery subqueryTipo = new SubQuery("TarmTramite", "tipoautorizacion", "tramite", "i.pk in (select a.ctramite from TarmSolicitud a where a.pk=t.pk.csolicitud)"); + dto.addSubQuery(subqueryTipo); + SubQuery subqueryCategoria = new SubQuery("TarmTramite", "categoria", "categoria", "i.pk in (select a.ctramite from TarmSolicitud a where a.pk=t.pk.csolicitud)"); + dto.addSubQuery(subqueryCategoria); + SubQuery subqueryCategoriaCodigo = new SubQuery("TarmTramite", "categoriacodigo", "categoriacodigo", "i.pk in (select a.ctramite from TarmSolicitud a where a.pk=t.pk.csolicitud)"); + dto.addSubQuery(subqueryCategoriaCodigo); + SubQuery subqueryTipocodigo = new SubQuery("TarmTramite", "tipoautorizacioncodigo", "tramitecodigo", "i.pk in (select a.ctramite from TarmSolicitud a where a.pk=t.pk.csolicitud)"); + dto.addSubQuery(subqueryTipocodigo); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "desc", "i.pk.catalog=t.estadotramite and i.pk.catalogcode=t.estadotramitecodigo"); + dto.addSubQuery(subqueryEstado); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + for (int i = 0; i < this.lrecord.size(); i++) { + this.lrecord.get(i).getModifiedData().put("usodes", CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("actividad").toString(), "USOACTIVIDAD").getDescription()); + this.lrecord.get(i).getModifiedData().put("imprimir", true); + TcustPersonDetail person = PersonDetailController.find(this.lrecord.get(i).getModifiedData().get("persona").toString()); + this.lrecord.get(i).getModifiedData().put("nombre", person != null ? person.getName() : ""); + this.lrecord.get(i).getModifiedData().put("identificacion", person != null ? person.getIdentification() : ""); + try { + TgeneCatalogDetail cate = CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("categoria").toString(), this.lrecord.get(i).getModifiedData().get("categoriacodigo").toString()); + this.lrecord.get(i).getModifiedData().put("categoriadesc", cate != null ? cate.getDescription() : ""); + } catch (Exception e) { + e.printStackTrace(); + } + try { + TgeneCatalogDetail tipo = CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("tramite").toString(), this.lrecord.get(i).getModifiedData().get("tramitecodigo").toString()); + this.lrecord.get(i).getModifiedData().put("tipotramdesc", tipo != null ? tipo.getDescription() : ""); + if (!lrecord.get(i).getEstadotramite().equals("APB")) { + lrecord.get(i).getModifiedData().put("imprimir", "true"); + } else { + lrecord.get(i).getModifiedData().put("imprimir", "false"); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que genera el reporte + * + * @param fila + */ + public void imprimir(TarmSolicitudTramite fila) { + boolean flagArmas = false; + boolean flagGuardias = false; + boolean flagAgencia = false; + boolean flagDoc = false; + String tipotramite = fila.getModifiedData().get("tramite").toString(); + String nombreArchivo = fila.getModifiedData().get("tipotramdesc").toString(); + solicitud = SolicitudController.findSolicitudxcodsolicitud(fila.getPk().getCsolicitud()); + solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(fila.getPk().getCsolicitud()); + numeroTramite = solicitudTramite.getNumerotramite(); + documentoHabilitante = DocumentoHabilitanteController.findPorSolicitud(fila.getPk().getCsolicitud()); + TarmTramite tramite = TarmTramiteController.findSimple(fila.getPk().getCtramite().toString()); + String tipoReporte = tramite.getRegistroagenciasucursal(); + //solicitud=ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(tipotramite); + if (tipotramite == null) { + MessageHelper.setMessageError("ERROR NO MANEJADO POR LA APLICACION CONTACTE AL PROVEEDOR"); + return; + } + + if (tipotramite.equals("2")) { + if (tramite.getRegistroagenciasucursal().equalsIgnoreCase("Y")) { + flagAgencia = true; + } + if (tramite.getRegistroarmas().equalsIgnoreCase("Y")) { + flagArmas = true; + } + if (tramite.getRegistroguardia().equalsIgnoreCase("Y")) { + flagGuardias = true; + } + if (tramite.getDocumentohabilitante().equalsIgnoreCase("Y")) { + flagDoc = true; + } + this.reporteCertificados(solicitud.getPk(), flagAgencia, flagArmas, flagDoc, flagGuardias); + return; + } else if (tipotramite.equals("4")) { + this.reporteGuiaLibreTransito(); + return; + } else { + if (tramite.getRegistroagenciasucursal().equalsIgnoreCase("Y")) { + flagAgencia = true; + } + if (tramite.getRegistroarmas().equalsIgnoreCase("Y")) { + flagArmas = true; + } + if (tramite.getRegistroguardia().equalsIgnoreCase("Y")) { + flagGuardias = true; + } + if (tramite.getDocumentohabilitante().equalsIgnoreCase("Y")) { + flagDoc = true; + } + } + + this.reporteGeneral(solicitud.getPk(), flagAgencia, flagArmas, flagDoc, flagGuardias, nombreArchivo); + + } + + /** + * Encuentra el usuario logueado + * + * @return + */ + public String encontrarUsuario() { + if (identificacion == null || identificacion == "") { + return null; + } + detallesPersona = PersonDetailController.findxidentification(identificacion, tipoidentificacion); + if (detallesPersona == null) { + return null; + } + lsolicitud = SolicitudController.findSolicitudxPersona(detallesPersona.getPk().getPersoncode().toString()); + + if (lsolicitud == null || lsolicitud.isEmpty()) { + return null; + } + + String csolicitud = null; + for (TarmSolicitud soli : lsolicitud) { + if (csolicitud == null) { + csolicitud = "csolicitud='" + soli.getPk() + "'"; + } else { + csolicitud += " or csolicitud='" + soli.getPk() + "'"; + } + } + return csolicitud; + } + + public List getLdocumentos() { + return ldocumentos; + } + + public void setLdocumentos(List ldocumentos) { + this.ldocumentos = ldocumentos; + } + + @Override + public void save() { + // TODO Auto-generated method stub + super.save(); + } + + /** + * Ejecuta un reporte de armas + * + * @param name Nombre del reporte a generar. + */ + public void reporteGuiaLibreTransito() { + try { + String path = "armas/reports/guiaLibreTransito"; + String filename = MsgControlArmas.getProperty("lbl_guiaLibreTransito"); + + detallesPersona = PersonDetailController.find(String.valueOf(solicitud.getPersoncode().toString())); + solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + + //Nombre del centro de control + parameters.put("nombreCentro", this.nombreInstitucion); + + //No. Guia + parameters.put("noGuia", this.numeroTramite); + + //Codigo de barras + String codigoBarras = this.numeroTramite.replace("-", "").toLowerCase(); + Boolean caracterEliminado = false; + for (int i = 0; i < codigoBarras.length(); i++) { + if (caracterEliminado) { + i = 0; + caracterEliminado = false; + } + if (codigoBarras.toCharArray()[i] != '0' && codigoBarras.toCharArray()[i] != '1' && codigoBarras.toCharArray()[i] != '2' + && codigoBarras.toCharArray()[i] != '3' && codigoBarras.toCharArray()[i] != '4' && codigoBarras.toCharArray()[i] != '5' + && codigoBarras.toCharArray()[i] != '6' && codigoBarras.toCharArray()[i] != '7' && codigoBarras.toCharArray()[i] != '8' + && codigoBarras.toCharArray()[i] != '9') { + + String caracterExtranno = ""; + caracterExtranno += codigoBarras.toCharArray()[i]; + codigoBarras = codigoBarras.replace(caracterExtranno, ""); + caracterEliminado = true; + } + } + parameters.put("codigoBarras", codigoBarras); + + //Nombre/Razon Social + parameters.put("nombreRazon", detallesPersona.getName()); + + // Vendedor + parameters.put("tipodocumentoorigen", solicitud.getTipodocumentoorigen()); + parameters.put("numerodocumentoorigen", solicitud.getNumerodocumentoorigen()); + parameters.put("nombrerazonsocialorigen", solicitud.getNombrerazonsocialorigen()); + + //Cedula + parameters.put("cedula", detallesPersona.getIdentification()); + + //Desde + parameters.put("desde", solicitud.getLugarorigen()); + + //Hasta + parameters.put("hasta", solicitud.getLugardestino()); + + //Fechas + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + if (documentoHabilitante != null) { + parameters.put("fechaExpide", sdf.format(documentoHabilitante.getFechaemision())); + parameters.put("fechaCaduca", sdf.format(documentoHabilitante.getFechaexpiracion())); + } else { + parameters.put("fechaExpide", " "); + parameters.put("fechaCaduca", " "); + } + + //Grado + String gradoFuncionario = ""; + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), + this.responsableCentroControl.getMilitarygradecode()); + if (grado != null) { + gradoFuncionario = grado.getDescription() + " - "; + } + + //Funcionario + parameters.put("gradoNombreFuncionario", gradoFuncionario + this.responsableCentroControl.getName()); + parameters.put("personcode", this.responsableCentroControl.getPk().getPersoncode()); + parameters.put("centroControl", "JEFE DEL " + this.nombreInstitucion); + + //Usuario + parameters.put("usuario", this.usuario.getName()); + sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + String fechaHora = sdf.format(Calendar.getInstance().getTime()); + parameters.put("fechaHora", fechaHora); + + String format = "pdf"; + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Ejecuta un reporte de certificado de armas + * + * @param name Nombre del reporte a generar. + */ + public void reporteCertificadoArmas() { + try { + String path = "armas/reports/certificadoArmas"; + String filename = "certificadoarmas"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + + //Fecha + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + + String format = "pdf"; + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Ejecuta un reporte de certificado de armas + * + * @param name Nombre del reporte a generar. + */ + /** + * Reporte de Agencias + */ + public void reporteAgencias() { + try { + String path = "armas/reports/aperturaAgenciasSucursales"; + String filename = "aperturaagenciassucursales"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + + //Fecha + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + + String format = "pdf"; + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Reporte de Inscripcion de Armas + * + * @param solicitud + */ + public void reporteInscripcion(TarmSolicitud solicitud) { + try { + String path = "armas/reports/reporteInscripcion"; + String filename = "armas"; + + detallesPersona = PersonDetailController.find(String.valueOf(solicitud.getPersoncode().toString())); + solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //No. Guia + parameters.put("nombreCompania", detallesPersona.getName()); + + //Nombre/Razon Social + parameters.put("nombrepersona", detallesPersona.getLegalrepresent()); + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("fecha", sdf.format(solicitud.getFregistro())); + parameters.put("ciudad", "Quito"); + + //Grado + /* String gradoFuncionario=""; + TgeneCatalogDetail grado=CatalogDetailController.findxCodigoCodcatalogo(usuario.getMilitarygrade(), usuario.getMilitarygradecode()); + if(grado!=null){ + gradoFuncionario=grado.getDescription()+" - "; + } + + //Funcionario + parameters.put("gradoNombreFuncionario",gradoFuncionario+usuario.getName()); + */ + String format = "pdf"; + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + String institucionCentroControl = ""; + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController direccion = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = direccion.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + this.centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + this.nombreInstitucion = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + institucionCentroControl = this.nombreInstitucion; + + return institucionCentroControl; + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl() { + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + /** + * Ejecuta reporte general de informacion de armas, guardias, agencias y + * sucursales + * + * @param name Nombre del reporte a generar. + */ + public void reporteGeneral(String solicitud, boolean flagAgencia, boolean flagArmas, boolean flagDoc, boolean flagGuardias, String nombreArchivo) { + try { + String gradoUsuario = ""; + String path = "armas/reports/generalReportHabilita"; + String filename = nombreArchivo; + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if (grado != null) { + gradoUsuario = grado.getDescription() + " - " + this.responsableCentroControl.getName(); + } else { + gradoUsuario = "Sin Grado - " + this.responsableCentroControl.getName(); + } + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("csolicitud", solicitud); + + //Obteniendo la solicitud + TarmSolicitud s = SolicitudController.findSolicitudxcodsolicitud(solicitud); + TarmTramite t; + Boolean datosTramiteVacios = false; + + if (s != null) { + //Obteniendo el tramite + t = TarmTramiteController.find(s.getCtramite().toString()); + + //Obteniendo la solicitud trmite + TarmSolicitudTramite st = TarmSolicitudTramiteController.findPorCSolicitud(solicitud); + + if (t != null) { + + //No de tramite + if (st != null) { + parameters.put("noTramite", st.getNumerotramite()); + } else { + parameters.put("noTramite", " "); + } + + //Tipo de tramite + if (t.getModifiedData().get("tipotramite") != null) { + parameters.put("tipoTramite", t.getModifiedData().get("tipotramite")); + } else { + parameters.put("tipoTramite", " "); + } + + //Tipo de autorizacion + if (t.getModifiedData().get("tipoautorizacion") != null) { + parameters.put("tipoAutorizacion", t.getModifiedData().get("tipoautorizacion")); + } else { + parameters.put("tipoAutorizacion", " "); + } + + //Categoria + if (t.getModifiedData().get("categoria") != null) { + parameters.put("categoria", t.getModifiedData().get("categoria")); + } else { + parameters.put("categoria", " "); + } + + //Uso actividad + if (t.getModifiedData().get("usoactividad") != null) { + parameters.put("usoActividad", t.getModifiedData().get("usoactividad")); + } else { + parameters.put("usoActividad", " "); + } + + //Cabecera + if (t.getCabecera() != null) { + parameters.put("cabecera", t.getCabecera()); + } else { + parameters.put("cabecera", " "); + } + + } else { + datosTramiteVacios = true; + } + } else { + datosTramiteVacios = true; + } + + if (datosTramiteVacios) { + parameters.put("noTramite", " "); + parameters.put("tipoTramite", " "); + parameters.put("tipoAutorizacion", " "); + parameters.put("categoria", "-"); + parameters.put("usoActividad", " "); + parameters.put("cabecera", " "); + } + + //Fecha + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + parameters.put("flagAgencia", flagAgencia); + parameters.put("flagArmas", flagArmas); + parameters.put("flagDoc", flagDoc); + parameters.put("flagGuardias", flagGuardias); + parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("usuario", PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()).getName()); + parameters.put("codResponsable", this.responsableCentroControl.getPk().getPersoncode()); + String format = "pdf"; + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Ejecuta reporte general de informacion de armas, guardias, agencias y + * sucursales + * + * @param name Nombre del reporte a generar. + */ + public void reporteCertificados(String solicitud, boolean flagAgencia, boolean flagArmas, boolean flagDoc, boolean flagGuardias) { + try { + String gradoUsuario = ""; + String path = "armas/reports/reporteCertificado"; + String filename = "reporteCertificado"; + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if (grado != null) { + gradoUsuario = grado.getDescription() + " - " + this.responsableCentroControl.getName(); + } else { + gradoUsuario = "Sin Grado - " + this.responsableCentroControl.getName(); + } + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("csolicitud", solicitud); + //Fecha + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + parameters.put("flagAgencia", flagAgencia); + parameters.put("flagArmas", flagArmas); + parameters.put("flagDoc", flagDoc); + parameters.put("flagGuardias", flagGuardias); + parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("usuario", PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()).getName()); + parameters.put("codResponsable", this.responsableCentroControl.getPk().getPersoncode()); + String format = "pdf"; + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public String getFormato() { + return formato; + } + + public void setFormato(String formato) { + this.formato = formato; + } + + public String getMostrarFormato() { + return mostrarFormato; + } + + public void setMostrarFormato(String mostrarFormato) { + this.mostrarFormato = mostrarFormato; + } + + public boolean isImprimir() { + return imprimir; + } + + public void setImprimir(boolean imprimir) { + this.imprimir = imprimir; + } + + public TarmTramiteController getTramiteController() { + return tramiteController; + } + + public void setTramiteController(TarmTramiteController tramiteController) { + this.tramiteController = tramiteController; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TarmTramite getFila() { + return fila; + } + + public void setFila(TarmTramite fila) { + this.fila = fila; + } + + public String getIdentificacion() { + return identificacion; + } + + public void setIdentificacion(String identificacion) { + this.identificacion = identificacion; + } + + public String getTipoidentificacion() { + return tipoidentificacion; + } + + public void setTipoidentificacion(String tipoidentificacion) { + this.tipoidentificacion = tipoidentificacion; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/EnvioArmasNoIniciadasFlujoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/EnvioArmasNoIniciadasFlujoController.java new file mode 100644 index 0000000..702bc24 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/EnvioArmasNoIniciadasFlujoController.java @@ -0,0 +1,437 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.model.SelectItem; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.parmas.soli.TarmTransaccionArmaBodega; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TarmDecomisoArmaTransaccion. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class EnvioArmasNoIniciadasFlujoController extends AbstractController { + + public EnvioArmasNoIniciadasFlujoController() throws Exception { + super(TarmDecomisoArmaTransaccion.class); + } + + /** + * Controlador para generar el reporte + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + /** + * Controlador para caragar el archivo al alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * atributo con los datos del usuario logeado + */ + private TsafeUserDetail userDetail; + + private String xpathflujo; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //consulta la lista + this.querydatabase(); + } + + private List decomisoArmas; + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 300; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "RECEPCIONARMASNOENV"; + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + obtenerCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * nombre del centro de control + */ + private String institucionCentroControl; + private List itemUnidadDestino; + /** + * nombre del centro de control + */ + private String instiCentroControlCode; + + /** + * Método para obtener el centro de control + * + * @throws Exception + */ + private void obtenerCentroControl() throws Exception { + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(userDetail.getPk().getPersoncode().toString()); + if (tcustPersonAddres != null && tcustPersonAddres.getProvincecode() != null) { + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + if (centroControlJur != null && centroControlJur.getCcentrocontrol() != null) { + TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + itemUnidadDestino = new ArrayList(); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + //codigo del centro de control de pichincha + TgeneParameters paramCentroControlDestino = ParametersController.find("CODIGO.CENT.CONTROL.PICHINCHA", "1");//000030//CAPI + //validamos si la persona que ingreso pertenece al centro de control pichincha para darle al opcion de seleccionar el deparatmento de control para la recepcion + if (paramCentroControlDestino.getTextvalue().equals(centroControl.getNombreinstitucion())) { + itemUnidadDestino.add(new SelectItem(centroControl.getPk(), institucionCentroControl)); + //codigo del departamento de control + TgeneParameters paramDepartamentoControl = ParametersController.find("CODIGO.DEPT.CONTROL", "1");//DPCA + TarmCentroControl institCentroControlDestino = CentroControlArmasController.findPorCentroControl(paramDepartamentoControl.getTextvalue());//000077 + itemUnidadDestino.add(new SelectItem(institCentroControlDestino.getPk(), "" + institCentroControlDestino.getModifiedData().get("desnombreinstitucion"))); + } else { + instiCentroControlCode = centroControl.getPk(); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_laprovinciasinccontrol")); + return; + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_notienedireccionprincipal")); + return; + } + } + + public void executeUnidad() { + for (SelectItem item : itemUnidadDestino) { + if (item.getValue().equals(instiCentroControlCode)) { + institucionCentroControl = item.getLabel(); + } + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + Filter filtro = new Filter(); + filtro.setSql("estadoflujo='NOENV' and numerotransaccion like '%ENV-%' and ccentrocontrol='" + instiCentroControlCode + "'"); + dto.addFiltro(filtro); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * + * @param codigo + * @return + */ + public static TarmDecomisoArmaTransaccion find(String codigo) { + try { + EnvioArmasNoIniciadasFlujoController cc = new EnvioArmasNoIniciadasFlujoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", codigo); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * lista las armas decomisadas asociadas al numero de transaccion + * + * @param decomisoArmaTransaccion + */ + public void listarArmas(TarmDecomisoArmaTransaccion decomisoArmaTransaccion) { + record = decomisoArmaTransaccion; + decomisoArmas = DecomisoArmaController.findEnvio(decomisoArmaTransaccion.getPk()); + } + + public void generarActa() { + String gradoUsuario = ""; + Calendar fechaActualCldr = Calendar.getInstance(); + TcustPersonDetail usuario = PersonDetailController.find(this.userDetail.getPk().getPersoncode().toString()); + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(usuario.getMilitarygrade(), usuario.getMilitarygradecode()); + if (grado != null) { + gradoUsuario = grado.getDescription() + " - " + usuario.getName(); + } else { + gradoUsuario = usuario.getName(); + } + // String codigoreporte=record.getModifiedData().get("cdecomiso").toString();//listTarmDecomisoArma.get(0).getPk().toString(); + String path = "armas/reports/entregaArmasacta"; + String filename = record.getNumerotransaccion(); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("fechaCorte", (new SimpleDateFormat("dd-MM-yyyy").format(record.getFcorte()))); + parameters.put("codResponsable", usuario.getPk().getPersoncode()); + parameters.put("gradoUsuario", gradoUsuario); + try { + + //Usuario logueado en la aplicacion + String nombreUsuario; + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + } else { + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario); + parameters.put("unidadmilitar", institucionCentroControl); + parameters.put("tecnicoAlmacenamiento", MsgControlArmas.getProperty("tecnicoAlmacenamiento") + " " + institucionCentroControl); + parameters.put("jefe", MsgControlArmas.getProperty("jefe") + " " + institucionCentroControl); + parameters.put("codigodecomisoarma", record.getPk().toString()); + parameters.put("tramite", record.getNumerotransaccion()); + //Fecha actual + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH) + 1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarFecha", fechaActualSB.toString()); + InputStream file = this.reportController.jaspertoInputstream(path, parameters, "pdf", filename, this.getLoginController()); + xpathflujo = generarXpath(record.getNumerotransaccion()); + if (!alfrescoController.uploadFile(file, record.getNumerotransaccion() + ".pdf", xpathflujo)) { + xpathflujo = null; + } + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Metodo para generar la ruta donde se carga el archivo + * + * @param numeroTransaccionRecepcion + * @return + */ + public String generarXpath(String numeroTransaccionRecepcion) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta = new StringBuilder("cm:Decomiso"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + ruta = ruta.append("/cm:" + numeroTransaccionRecepcion); + return ruta.toString(); + } + + public List getDecomisoArmas() { + return decomisoArmas; + } + + public void setDecomisoArmas(List decomisoArmas) { + this.decomisoArmas = decomisoArmas; + } + + public void iniciarFlujo() { + try { + + if (xpathflujo == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generereporte")); + return; + } + TarmTransaccionArmaBodega armaBodegas = TransaccionArmaBodegaController.find(record.getPk().toString()); + + if (armaBodegas.getModifiedData().get("provincecodeorig") == null || armaBodegas.getModifiedData().get("provincecodeorig").toString().length() == 0) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinprovincia")); + return; + } + String cprovincia = armaBodegas.getModifiedData().get("provincecodeorig").toString(); + //Se comenta por validacion de provincia en el flujo de EnvioArmas clase com.fp.armas.task.ValidacionGrupo + // cualquier error analizar esta validacion de provincia + + /*TgeneParameters paramDepartamentoControl=ParametersController.find("CODIGO.DEPT.CONTROL", "1");//DPCA + if(armaBodegas.getModifiedData().get("nombreinstitucion").equals(paramDepartamentoControl.getTextvalue())){ + cprovincia=paramDepartamentoControl.getTextvalue(); + }*/ + String xpath = xpathflujo + "/cm:" + record.getNumerotransaccion() + ".pdf"; + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + //codigo de la tabla TarmDecomisoArmaTransaccion + request.modifiedData().put("numerotransaccion", record.getPk()); + request.modifiedData().put("cprovincia", cprovincia); + request.modifiedData().put("numerosolicitud", record.getNumerotransaccion()); + //ruta del archivo para la firma + request.modifiedData().put("xpath", xpath); + request.modifiedData().put("isnew", "Y"); + request.setLogsolicitude(record.getNumerotransaccion()); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.setShowRow(true); + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + " TRANSACCION: " + record.getNumerotransaccion()); + xpathflujo = null; + //quita el registro de la lista en vista + lrecord.remove(record); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public List getItemUnidadDestino() { + return itemUnidadDestino; + } + + public void setItemUnidadDestino(List itemUnidadDestino) { + this.itemUnidadDestino = itemUnidadDestino; + } + + public String getInstiCentroControlCode() { + return instiCentroControlCode; + } + + public void setInstiCentroControlCode(String instiCentroControlCode) { + this.instiCentroControlCode = instiCentroControlCode; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/FichasTecnicasFlatantesController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/FichasTecnicasFlatantesController.java new file mode 100644 index 0000000..a3d5ae7 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/FichasTecnicasFlatantesController.java @@ -0,0 +1,1190 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.CashManagementHistoryController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmaPruebas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * + * Genrera fichas tecnicas de armas faltantes + * + * @author Christian Pazmino + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class FichasTecnicasFlatantesController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 8843091476010012919L; + + /** + * Controlador que maneja alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * Controlador que maneja reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{armasController}") + private ArmasController armas; + + private TarmArmas arma = new TarmArmas(); + + private String editarReg; + + private String codigoSolicitud; + + private boolean habilitaButtom; + + private TarmCentroControl centroControl = new TarmCentroControl(); + + private List listadoArmasPruebas = new ArrayList<>(); + + private String observacion; + + private String estado; + + private Date fec_actual; + + private String formato; + + private String xpathflujo; + + private TcustPersonDetail responsableCentroControl = null; + + private TsafeUserDetail tsafeUserDetailUsuario = null; + + private Boolean btnFlujo; + + private List tarmArmaPruebasList; + /** + * lista del catalogo de las acciones (Aceptar o rechazar) + */ + private List laccion; + + private boolean deshabilitadoGenerarReporte = true; + + private TarmSolicitud solicitud; + private TarmSolicitudTramite solicitudTramite; + private TarmTramite tramite; + private TcustPersonAddress direccionCliente; + private String provincia; + private String canton; + private String ciudad; + private String direccion; + private TgeneCatalogDetail estadotramite; + private TgeneCatalogDetail usoActividad; + private TcustPersonDetail personaDetalle; + private TgeneCatalogDetail identificacion; + private TgeneCatalogDetail detallecatalogoTipoTramite; + private TgeneCatalogDetail detallecatalogo; + private TgeneParameters fichasFaltantesParametro; + + private Integer cPruebaInicio; + private Integer cPruebaFin; + + /** + * Controlador que maneja los datos de generacion ultima vez del reporte + */ + @ManagedProperty(value = "#{parametersController}") + private ParametersController parametersController; + + public FichasTecnicasFlatantesController() throws Exception { + super(TarmArmaPruebas.class); + } + + @PostConstruct + private void postconstruct() { + try { + init(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + + } + } + + private void init() { + recperpage = 13000; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + record = new TarmArmaPruebas(); + beanalias = "INGRESOFICHASFALTANTES"; + fichasFaltantesParametro = ParametersController.find("FICHASFALTANTES", "1"); + cPruebaInicio = fichasFaltantesParametro.getNumbervalue().intValue(); + cPruebaFin = 13187; + } + + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void uploadImpronta(FileUploadEvent event) { + record.modifiedData().put("FileUploadImpronta", event.getFile()); + } + + public void uploadFoto(FileUploadEvent event) { + record.modifiedData().put("FileUploadFoto", event.getFile()); + } + + public void generarReportesFaltantes() { + try { + for (int i = cPruebaInicio; i <= cPruebaFin; i++) { + this.record = IngresoFichaTecnicaArmasController.findByPk(String.valueOf(i)); + + // Comentar numeroArmasEnSolicitud(xxx) para volver a generar cualquier ficha de solicitud con una unica arma.. + // Validamos solo para solicitudes que tienen path y cuya solicitud tiene mas de una arma + if (this.record != null && numeroArmasEnSolicitud(record.getCsolicitud()) > 1 && (this.record.getXpathfichatecarmas() != null || this.record.getXpathfotografia() != null || this.record.getXpathimpronta() != null)) { + System.out.println("*****GENERACION DE FICHA TECNICA: " + i + " *****"); + this.solicitud = SolicitudArmasController.findByCSolicitud(this.record.getCsolicitud()); + this.codigoSolicitud = solicitud.getPk(); + this.solicitudTramite = SolicitudTramiteController.findByCSolicitud(codigoSolicitud); + this.tramite = TarmTramiteController.find(solicitud.getCtramite() + ""); + this.personaDetalle = PersonDetailController.find(String.valueOf(solicitud.getPersoncode())); + direccionCliente = PersonAddressController.find(String.valueOf(solicitud.getPersoncode())); + provincia = direccionCliente.modifiedData().get("provincia") == null ? null : direccionCliente.modifiedData().get("provincia").toString(); //personAddressController.getLprovinces()==null || .getLprovinces().isEmpty()?null:personAddressController.getLprovinces().get(0); + canton = direccionCliente.modifiedData().get("canton") == null ? null : direccionCliente.modifiedData().get("canton").toString();//personAddressController.getLcantones()==null || personAddressController.getLcantones().isEmpty()?null:personAddressController.getLcantones().get(0); + ciudad = direccionCliente.modifiedData().get("ciudad") == null ? null : direccionCliente.modifiedData().get("ciudad").toString();//personAddressController.getLcities()==null || personAddressController.getLcities().isEmpty()?null:personAddressController.getLcities().get(0); + direccion = direccionCliente.getAddress(); + estadotramite = (solicitudTramite.getEstadotramite() == null || solicitudTramite.getEstadotramitecodigo() == null) ? null : CatalogDetailController.findxCodigoCodcatalogo(solicitudTramite.getEstadotramite(), solicitudTramite.getEstadotramitecodigo()); + usoActividad = (tramite.getUsoactividad() == null || tramite.getUsoactividadcodigo() == null) ? null : CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + identificacion = (personaDetalle.getIdentificationcatalog() == null || personaDetalle.getIdentificationcatalogcode() == null) ? null : CatalogDetailController.findxCodigoCodcatalogo(personaDetalle.getIdentificationcatalog(), personaDetalle.getIdentificationcatalogcode()); + detallecatalogoTipoTramite = (tramite.getTipoautorizacion() == null || tramite.getTipoautorizacioncodigo() == null) ? null : CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + detallecatalogo = (tramite.getCategoria() == null || tramite.getCategoriacodigo() == null) ? null : CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + this.obtenerCentroControl(); + this.obtenerResponsableCentroControl(); + reporteFichaArmas(i); + } + } + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Metodo para extrer solo el nombre del archivo + * + * @param xpath xpath del archivo en alfresco + * @return solo la parte correspondiente al nombre del archivo + */ + public String soloNombreArchivo(String xpath) { + return xpath.substring(xpath.lastIndexOf(":") + 1, xpath.length()); + } + + /** + * Retorna el xpath de la ruta en donde se va a almacenar el documento + * + * @param xpath ruta en donde se almacenará el archivo + * @return + */ + private String obtenerXpath(String xpath) { + String rutaXpath = null; + int indice = xpath.lastIndexOf("/cm:"); + rutaXpath = xpath.substring(0, indice); + return rutaXpath; + } + + /** + * Retorna el xpath de la ruta en donde se va a almacenar el documento + * + * @param xpath ruta en donde se almacenará el archivo + * @return + */ + private String obtenerXpathDesdeFotografia(String xpath) { + String rutaXpath = null; + int indice = xpath.lastIndexOf("/cm:fotografia/cm:"); + rutaXpath = xpath.substring(0, indice); + return rutaXpath; + } + + private String obtenerXpathDesdeImpronta(String xpath) { + String rutaXpath = null; + int indice = xpath.lastIndexOf("/cm:impronta/cm:"); + rutaXpath = xpath.substring(0, indice); + return rutaXpath; + } + + private Date obtenerFechaEmision(String xpath) { + String rutaXpath = null; + int indice = xpath.lastIndexOf("/cm:SOL-"); + rutaXpath = xpath.substring(0, indice); + rutaXpath = rutaXpath.replace("cm:Solicitudes/cm:A-", "").replace("/cm:M", "").replace("/cm:D", ""); + Calendar cal = Calendar.getInstance(); + cal.set(Calendar.YEAR, Integer.valueOf(rutaXpath.substring(0, 4))); + cal.set(Calendar.MONTH, Integer.valueOf(rutaXpath.substring(5, 7))); + cal.set(Calendar.DAY_OF_MONTH, Integer.valueOf(rutaXpath.substring(8, 10))); + return cal.getTime(); + } + + /** + * @return @throws Exception + */ + public String codigoAceptado() throws Exception { + TgeneParameters f = ParametersController.find("ACEPTADO", "1"); + return f.getTextvalue(); + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Metodo que indica si se debe habilitar el boton del pantalla ficha + * tecnica + */ + public void habilitarBoton() { + this.habilitaButtom = true; + } + + /** + * Metodo que indica si se debe habilitar el boton del pantalla ficha + * tecnica + */ + public void cerrar() { + if (record.modifiedData().get("GUARDA") != null && record.modifiedData().get("GUARDA").equals("S") + && record.modifiedData().get("IMPRIME") != null && record.modifiedData().get("IMPRIME").equals("S")) { + } else { + MessageHelper.setMessageError("GUARDE Y GENERE EL REPORTE"); + } + } + + /** + * Ejecuta reporte de registro balistico + * + */ + public void reporteRegistroBalistico() { + try { + String gradoUsuario = ""; + String path = "armas/reports/registroBalistico"; + String filename = MsgControlArmas.getProperty("lbl_registroBalistico"); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + + //Logos + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Obteniendo la solicitud + TarmSolicitud solicitud = SolicitudController.findSolicitudxcodsolicitud(this.codigoSolicitud); + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + + //Codigo solicitud + parameters.put("csolicitud", this.codigoSolicitud); + + //Fecha de solicitud + parameters.put("fechaSolicitud", sdf.format(solicitud.getFregistro())); + + //Obteniendo los datos del tramite + TarmTramite tramite = TarmTramiteController.find(solicitud.getCtramite().toString()); + TgeneCatalogDetail tipoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + TgeneCatalogDetail categoria = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + TarmSolicitudTramite solicitudTramite = SolicitudTramiteController.findByCSolicitud(this.codigoSolicitud); + TgeneCatalogDetail tipoAutorizacion = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail usoActividad = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + + //Tipo de tramite + if (tipoTramite != null && tipoTramite.getDescription() != null) { + parameters.put("tipoTramite", tipoTramite.getDescription()); + } else { + parameters.put("tipoTramite", " "); + } + + //Categoria + if (categoria != null && categoria.getDescription() != null) { + parameters.put("categoria", categoria.getDescription()); + } else { + parameters.put("categoria", " "); + } + + //No tramite + if (solicitudTramite != null) { + parameters.put("noTramite", solicitudTramite.getNumerotramite()); + } else { + parameters.put("noTramite", " "); + } + + //Tipo de autorizacion + if (tipoAutorizacion != null && tipoAutorizacion.getDescription() != null) { + parameters.put("tipoAutorizacion", tipoAutorizacion.getDescription()); + } else { + parameters.put("tipoAutorizacion", " "); + } + + //Uso-actividad + if (usoActividad != null && usoActividad.getDescription() != null) { + parameters.put("usoActividad", usoActividad.getDescription()); + } else { + parameters.put("usoActividad", " "); + } + + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if (grado != null) { + gradoUsuario = grado.getDescription() + " - " + this.responsableCentroControl.getName(); + } else { + gradoUsuario = "Sin Grado - " + this.responsableCentroControl.getName(); + } + TcustPersonDetail person = PersonDetailController.find(String.valueOf(solicitud.getPersoncode())); + //PersonDetailController.find(String.valueOf(solicitud.getPersoncode())); + //Fecha + parameters.put("fechaActual", sdf.format(this.fec_actual)); + parameters.put("fecActualHora", new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss").format(this.fec_actual)); + parameters.put("personCode", person.getPk().getPersoncode()); + parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("usuario", this.tsafeUserDetailUsuario.getNickname()); + String format = this.formato; + try { + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + btnFlujo = Boolean.TRUE; + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if (tcustPersonAddres == null) { + return null; + } + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl() { + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + +// public void saveImprimir() { +// try { +//// if(!record.modifiedData().get("GUARDA").equals("S")){ +//// MessageHelper.setMessageError("GUARDE LA FICHA PARA GENERAR EL REPORTE"); +//// return; +//// } +// reporteFichaArmas(); +// record.setIsimpreso("Y"); +// update(); +// Request request = callerhelper.getRequest(); +// HashMap msave = new HashMap(); +// request.setSaveTables(msave); +// DtoSave dtosave = super.getDtoSave(); +// dtosave.setReturnpk(true); +// msave.put(beanalias, dtosave); +// request.setSaveTables(msave); +// Response resp = callerhelper.executeSave(request); +// if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { +// this.postCommit(resp); +// MessageHelper.setMessageInfo(resp); +// record.modifiedData().put("IMPRIME", "S"); +// MessageHelper.setMessageInfo(resp); +// } else { +// record.modifiedData().put("IMPRIME", "N"); +// MessageHelper.setMessageError(resp); +// } +// } catch (Throwable e) { +// record.modifiedData().put("IMPRIME", "N"); +// MessageHelper.setMessageError(e); +// } +// } + /** + * Obtiene el reporte de Ficha de Armas + * + * @throws Exception + */ + public void reporteFichaArmas(int i) throws Exception { + String gradoUsuario = ""; + String path = "armas/reports/fichaTecArmas"; + TgeneParameters parametro = ParametersController.find("CODIGO.FICHANOLETAL", "1"); + if (parametro != null && parametro.getTextvalue() != null && !parametro.getTextvalue().trim().isEmpty()) { + String[] arrayCodTramite = parametro.getTextvalue().split(","); + List listaCodTraite = Arrays.asList(arrayCodTramite); + for (String item : listaCodTraite) { + Long codigotramite = Long.parseLong(item); + if (solicitud.getCtramite().equals(codigotramite) + || codigotramite.longValue() == solicitud.getCtramite().longValue()) { + path = "armas/reports/fichaTecArmasNoLetales"; + } + } + } + parametro = ParametersController.find("CODIGO.FICHACOLECCION", "1"); + if (parametro != null && parametro.getTextvalue() != null && !parametro.getTextvalue().trim().isEmpty()) { + String[] arrayCodTramite = parametro.getTextvalue().split(","); + List listaCodTraite = Arrays.asList(arrayCodTramite); + for (String item : listaCodTraite) { + Long codigotramite = Long.parseLong(item); + if (solicitud.getCtramite().equals(codigotramite) + || codigotramite.longValue() == solicitud.getCtramite().longValue()) { + path = "armas/reports/fichaTecArmasColeccion"; + } + } + } + String filename = MsgControlArmas.getProperty("lbl_fichaTecnicaArmas"); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + parameters.put("centroControl", this.obtenerCentroControl()); + + //Fecha actual + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + //Fecha de solicitud + if (solicitud != null && solicitud.getFregistro() != null) { + parameters.put("fechaSolicitud", sdf.format(solicitud.getFregistro())); + } else { + parameters.put("fechaSolicitud", " "); + } + //No tramite + if (solicitudTramite != null && solicitudTramite.getNumerotramite() != null) { + parameters.put("noTramite", solicitudTramite.getNumerotramite()); + } else { + parameters.put("noTramite", " "); + } + + //Tipo de tramites + if (detallecatalogoTipoTramite != null && detallecatalogoTipoTramite.getDescription() != null) { + parameters.put("tipoTramite", detallecatalogoTipoTramite.getDescription()); + } else { + parameters.put("tipoTramite", " "); + } + //Estado tramite + if (estadotramite != null && estadotramite.getDescription() != null) { + parameters.put("estadoTramite", estadotramite.getDescription()); + } else { + parameters.put("estadoTramite", " "); + } + + //Uso actividad + if (usoActividad != null && usoActividad.getDescription() != null) { + parameters.put("usoActividad", usoActividad.getDescription()); + } else { + parameters.put("usoActividad", " "); + } + //Tipo de documento + if (identificacion != null) { + parameters.put("tipoDocumento", identificacion.getDescription()); + } else { + parameters.put("tipoDocumento", " "); + } + //No documento + if (personaDetalle != null) { + parameters.put("cedula", personaDetalle.getIdentification()); + } else { + parameters.put("cedula", " "); + } + //Nombre razon social + if (personaDetalle != null) { + parameters.put("nombreRazon", personaDetalle.getName()); + } else { + parameters.put("nombreRazon", " "); + } + //Provincia + if (provincia != null) { + parameters.put("provincia", provincia); + } else { + parameters.put("provincia", " "); + } + //Canton + if (canton != null) { + parameters.put("canton", canton); + } else { + parameters.put("canton", " "); + } + //Ciudad + if (ciudad != null) { + parameters.put("ciudad", ciudad); + } else { + parameters.put("ciudad", " "); + } + //Direccion + if (direccion != null) { + parameters.put("direccion", direccion); + } else { + parameters.put("direccion", " "); + } + //Codigo de arma + parameters.put("codigoArma", this.record.getCarma()); + //Codigo de registro de TarmArmaPrueba + parameters.put("cArmaPrueba", record.getPk().toString()); + TarmArmas arma = ArmasController.findPorCodigo(this.record.getCarma()); + TarmRegistroArmas regArma = RegistroArmController.findByCodigo(arma.getCregistro().toString()); + TgeneCountry paisOrigen = CountryController.findcountry(regArma.getPaisorigen()); + //Clase + if (arma.getModifiedData().get("clase") != null) { + parameters.put("clase", arma.getModifiedData().get("clase") == null ? "" : arma.getModifiedData().get("clase")); + } else { + parameters.put("clase", " "); + } + //Obtniendo el tipo arma explosivo + TarmTipoArmaExplosivo tae = arma == null ? null : TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo()); + //Tipo arma + TgeneCatalogDetail tipoArma = tae == null ? null : CatalogDetailController.findxCodigoCodcatalogo(tae.getTipoarmaexplosivo(), "TIPOARMAEXPLOSIVO"); + parameters.put("tipoArma", (tipoArma == null || tipoArma.getDescription().isEmpty()) ? "" : tipoArma.getDescription()); + //Serie + parameters.put("serie", (arma == null || arma.getLote() == null || arma.getLote().isEmpty()) ? "" : arma.getLote()); + //Pais fabricacion + parameters.put("paisFabricacion", (paisOrigen == null) ? "" : (paisOrigen.getDescription())); + //Calibre + parameters.put("calibre", (arma.getModifiedData().get("calibre") == null) ? "" : arma.getModifiedData().get("calibre")); + //Longitud + TgeneCatalogDetail longitud = (tae == null || tae.getLongitud() == null || tae.getLongitudcodigo() == null || tae.getLongitud().isEmpty() || tae.getLongitudcodigo().isEmpty()) ? null : CatalogDetailController.findxCodigoCodcatalogo(tae.getLongitud(), tae.getLongitudcodigo()); + if (longitud != null && longitud.getDescription() != null) { + parameters.put("longitud", longitud.getDescription()); + } else { + parameters.put("longitud", " "); + } + //Marca + parameters.put("marca", arma.getModifiedData().get("marca")); + //Modelo + parameters.put("modelo", arma.getModelo()); + //Color + parameters.put("color", arma.getModifiedData().get("color")); + //Observacion + parameters.put("observacion", this.record.getObservacion()); + //Aptitud de disparo + String aptitudDisparo = " "; + if (this.record.getAptituddisparo() != null) { + if (this.record.getAptituddisparo().equalsIgnoreCase("Y")) { + aptitudDisparo = "BUENO"; + } else { + aptitudDisparo = "MALO"; + } + } else { + aptitudDisparo = ""; + } + + parameters.put("aptitudDisparo", aptitudDisparo); + + //Balas testigo + String balasTestigo = " "; + if (this.record.getBalastestigo() != null) { + if (this.record.getBalastestigo().equalsIgnoreCase("Y")) { + balasTestigo = MsgControlArmas.getProperty("lbl_si"); + } else { + balasTestigo = "NO"; + } + } else { + balasTestigo = ""; + } + parameters.put("balasTestigo", balasTestigo); + + //Vainas testigo + String vainasTestigo = " "; + if (this.record.getVainastestigo() != null) { + if (this.record.getVainastestigo().equalsIgnoreCase("Y")) { + vainasTestigo = MsgControlArmas.getProperty("lbl_si"); + } else { + vainasTestigo = "NO"; + } + } else { + vainasTestigo = ""; + } + parameters.put("vainasTestigo", vainasTestigo); + + //Estado final + String estadoFinal = " "; + if (this.record.getApruebaevaluacion() != null) { + if (this.record.getApruebaevaluacion().equalsIgnoreCase("Y")) { + estadoFinal = "APROBADA"; + } else { + estadoFinal = "REPROBADA"; + } + } else { + estadoFinal = ""; + } + parameters.put("estadoFinal", estadoFinal); + //Codigo de persona + parameters.put("personcode", record.getPersoncode()); + //Codigo de arma + parameters.put("codArma", record.getCarma()); + //codigo solicitud + parameters.put("csolicitud", this.codigoSolicitud); + //Grado del funcionario + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if (grado != null) { + gradoUsuario = grado.getDescription() + " - " + this.responsableCentroControl.getName(); + } else { + gradoUsuario = "Sin Grado - " + this.responsableCentroControl.getName(); + } + parameters.put("personcode", responsableCentroControl.getPk().getPersoncode()); + parameters.put("gradoUsuario", gradoUsuario); + String format = "pdf"; + +// String nombreArchivo = soloNombreArchivo(armaPruebasObj.getXpathfichatecarmas()); +// String pathArchivo = obtenerXpath(armaPruegetxbasObj.getXpathfichatecarmas()); + if (this.record.getXpathfichatecarmas() != null) { + this.xpathflujo = obtenerXpath(this.record.getXpathfichatecarmas()); + this.fec_actual = obtenerFechaEmision(this.record.getXpathfichatecarmas()); + } else if (this.record.getXpathfotografia() != null) { + this.xpathflujo = obtenerXpathDesdeFotografia(this.record.getXpathfotografia()); + this.fec_actual = obtenerFechaEmision(this.record.getXpathfotografia()); + } else if (this.record.getXpathimpronta() != null) { + this.xpathflujo = obtenerXpathDesdeImpronta(this.record.getXpathimpronta()); + this.fec_actual = obtenerFechaEmision(this.record.getXpathimpronta()); + } + if (xpathflujo != null) { + parameters.put("fechaActual", sdf.format(this.fec_actual)); + filename = filename + this.record.getPk().toString(); + InputStream report = this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + if (!this.alfrescoController.uploadFile(report, filename + ".pdf", this.xpathflujo)) { + throw new Exception("ERROR AL CARGAR EL REPORTE"); + } + this.record.setXpathfichatecarmas(this.xpathflujo + "/cm:" + filename + ".pdf"); + update(); + save(); + fichasFaltantesParametro.setNumbervalue(new BigDecimal(i)); + parametersController.update(fichasFaltantesParametro); + + parametersController.save(); + } + } + +// /** +// * Metodo para encontrar por codigo de solicitud +// * @param codigoSolicitud +// * @return registro de armaPrueba encontrado +// */ +// public List findPorSolicitud(String codigoSolicitud){ +// try { +// FichasTecnicasFlatantesController cc = new FichasTecnicasFlatantesController(); +// cc.init(); +// cc.recperpage = 300; +// cc.addFilter("csolicitud", codigoSolicitud); +// cc.querydatabaseArma(); +// if (cc.lrecord != null) { +// return cc.lrecord; +// } +// return null; +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// return null; +// } +// } +// /** +// * Metodo para encontrar por codigo de solicitud +// * @param codigoSolicitud +// * @return registro de armaPrueba encontrado +// */ +// public static List buscarFichasPorSolicitud(String codigoSolicitud){ +// try { +// FichasTecnicasFlatantesController cc = new FichasTecnicasFlatantesController(); +// cc.init(); +// cc.recperpage = 300; +// cc.addFilter("csolicitud", codigoSolicitud); +// cc.querydatabaseArma(); +// if (cc.lrecord != null) { +// return cc.lrecord; +// } +// return null; +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// return null; +// } +// } +// public TarmArmaPruebas find(String codigoSolicitud, String carma){ +// try { +// FichasTecnicasFlatantesController cc = new FichasTecnicasFlatantesController(); +// cc.init(); +// cc.recperpage = 300; +// cc.addFilter("carma", carma); +// cc.addFilter("csolicitud", codigoSolicitud); +// cc.querydatabaseArma(); +// if (cc.lrecord != null && cc.lrecord.size()>0) { +// return cc.lrecord.get(0); +// } +// return null; +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// return null; +// } +// } +// + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public TarmArmas getArma() { + return arma; + } + + public void setArma(TarmArmas arma) { + this.arma = arma; + } + + public String getEditarReg() { + return editarReg; + } + + public void setEditarReg(String editarReg) { + this.editarReg = editarReg; + } + + public String getCodigoSolicitud() { + return codigoSolicitud; + } + + public void setCodigoSolicitud(String codigoSolicitud) { + this.codigoSolicitud = codigoSolicitud; + } + + public List getListadoArmasPruebas() { + return listadoArmasPruebas; + } + + public void setListadoArmasPruebas(List listadoArmasPruebas) { + this.listadoArmasPruebas = listadoArmasPruebas; + } + +// /** +// * metodo que registra el cambio de la seleccion del recuperador balisitico y segun esto aprueba la evaluacion +// */ +// public void cambia(TarmArmaPruebas armaPruebas){ +// record=null; +// record=armaPruebas; +// if("Y".equals(record.getAptituddisparo()) && "Y".equals(record.getVainastestigo()) && "Y".equals(record.getBalastestigo())){ +// record.setApruebaevaluacion("Y"); +// } +// else{ +// record.setApruebaevaluacion("N"); +// } +// habilitaButtom = true; +// armaPruebas.modifiedData().put("GUARDA", "N"); +// armaPruebas.modifiedData().put("IMPRIME", "N"); +// record.modifiedData().put("GUARDA", "N"); +// record.modifiedData().put("IMPRIME", "N"); +// } +// + public String getObservacion() { + return observacion; + } + + public void setObservacion(String observacion) { + this.observacion = observacion; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public List getLaccion() { + return laccion; + } + + public void setLaccion(List laccion) { + this.laccion = laccion; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public boolean isHabilitaButtom() { + return habilitaButtom; + } + + public void setHabilitaButtom(boolean habilitaButtom) { + this.habilitaButtom = habilitaButtom; + } + + public String getFormato() { + return formato; + } + + public void setFormato(String formato) { + this.formato = formato; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public Boolean getBtnFlujo() { + return btnFlujo; + } + + public void setBtnFlujo(Boolean btnFlujo) { + this.btnFlujo = btnFlujo; + } + + public boolean isDeshabilitadoGenerarReporte() { + return deshabilitadoGenerarReporte; + } + + public void setDeshabilitadoGenerarReporte(boolean deshabilitadoGenerarReporte) { + this.deshabilitadoGenerarReporte = deshabilitadoGenerarReporte; + } + + public void changeApruebaEvaluacion() { + if (this.record.getAptituddisparo() != null && ("Y".equalsIgnoreCase(this.record.getAptituddisparo())) + && (this.record.getBalastestigo() != null && "Y".equalsIgnoreCase(this.record.getBalastestigo())) + && (this.record.getVainastestigo() != null && "Y".equalsIgnoreCase(this.record.getVainastestigo()))) { + this.record.setApruebaevaluacion("Y"); + } else { + this.record.setApruebaevaluacion("N"); + } + } + + /** + * Metodo para encontrar por codigo de solicitud + * + * @param codigoSolicitud + * @return registro de armaPrueba encontrado + */ + public Integer numeroArmasEnSolicitud(String codigoSolicitud) { + try { + FichasTecnicasFlatantesController cc = new FichasTecnicasFlatantesController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("csolicitud", codigoSolicitud); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord.size(); + } + return 0; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return 0; + } + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + public TarmSolicitudTramite getSolicitudTramite() { + return solicitudTramite; + } + + public void setSolicitudTramite(TarmSolicitudTramite solicitudTramite) { + this.solicitudTramite = solicitudTramite; + } + + public TarmTramite getTramite() { + return tramite; + } + + public void setTramite(TarmTramite tramite) { + this.tramite = tramite; + } + + public TcustPersonAddress getDireccionCliente() { + return direccionCliente; + } + + public void setDireccionCliente(TcustPersonAddress direccionCliente) { + this.direccionCliente = direccionCliente; + } + + public String getProvincia() { + return provincia; + } + + public void setProvincia(String provincia) { + this.provincia = provincia; + } + + public String getCanton() { + return canton; + } + + public void setCanton(String canton) { + this.canton = canton; + } + + public String getCiudad() { + return ciudad; + } + + public void setCiudad(String ciudad) { + this.ciudad = ciudad; + } + + public String getDireccion() { + return direccion; + } + + public void setDireccion(String direccion) { + this.direccion = direccion; + } + + public TgeneCatalogDetail getEstadotramite() { + return estadotramite; + } + + public void setEstadotramite(TgeneCatalogDetail estadotramite) { + this.estadotramite = estadotramite; + } + + public TgeneCatalogDetail getUsoActividad() { + return usoActividad; + } + + public void setUsoActividad(TgeneCatalogDetail usoActividad) { + this.usoActividad = usoActividad; + } + + public TcustPersonDetail getPersonaDetalle() { + return personaDetalle; + } + + public void setPersonaDetalle(TcustPersonDetail personaDetalle) { + this.personaDetalle = personaDetalle; + } + + public TgeneCatalogDetail getIdentificacion() { + return identificacion; + } + + public void setIdentificacion(TgeneCatalogDetail identificacion) { + this.identificacion = identificacion; + } + + public TgeneCatalogDetail getDetallecatalogoTipoTramite() { + return detallecatalogoTipoTramite; + } + + public void setDetallecatalogoTipoTramite( + TgeneCatalogDetail detallecatalogoTipoTramite) { + this.detallecatalogoTipoTramite = detallecatalogoTipoTramite; + } + + public TgeneCatalogDetail getDetallecatalogo() { + return detallecatalogo; + } + + public void setDetallecatalogo(TgeneCatalogDetail detallecatalogo) { + this.detallecatalogo = detallecatalogo; + } + + public List getTarmArmaPruebasList() { + return tarmArmaPruebasList; + } + + public void setTarmArmaPruebasList(List tarmArmaPruebasList) { + this.tarmArmaPruebasList = tarmArmaPruebasList; + } + + public ArmasController getArmas() { + return armas; + } + + public void setArmas(ArmasController armas) { + this.armas = armas; + } + + public Integer getcPruebaInicio() { + return cPruebaInicio; + } + + public void setcPruebaInicio(Integer cPruebaInicio) { + this.cPruebaInicio = cPruebaInicio; + } + + public Integer getcPruebaFin() { + return cPruebaFin; + } + + public void setcPruebaFin(Integer cPruebaFin) { + this.cPruebaFin = cPruebaFin; + } + + public TgeneParameters getFichasFaltantesParametro() { + return fichasFaltantesParametro; + } + + public void setFichasFaltantesParametro(TgeneParameters fichasFaltantesParametro) { + this.fichasFaltantesParametro = fichasFaltantesParametro; + } + + public ParametersController getParametersController() { + return parametersController; + } + + public void setParametersController(ParametersController parametersController) { + this.parametersController = parametersController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/GenerarOrdenTrabajoCustodiosController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/GenerarOrdenTrabajoCustodiosController.java new file mode 100644 index 0000000..ea7ce1c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/GenerarOrdenTrabajoCustodiosController.java @@ -0,0 +1,699 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; +import org.apache.taglibs.standard.tag.common.fmt.BundleSupport; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.commondb.PersistenceHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmOrdenTrabajo; +import com.fp.persistence.parmas.soli.TarmOrdenTrabajoCustodios; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class GenerarOrdenTrabajoCustodiosController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private Date fechaHoy; + private Date inicio; + private Date fin; + private java.sql.Date fechaInicio; + private java.sql.Date fechaFin; + + private TarmSolicitud solicitud = new TarmSolicitud(); + private TarmSolicitudTramite solicitudTramite = new TarmSolicitudTramite(); + private TarmTramite tramite = new TarmTramite(); + private String usoActividad; + private Long numeroOrden; + + private String documentoReferencia; + private String empresa; + private String lugarDireccion; + private String ruta; + private String tiempoEstimado; + private String observaciones; + + private Boolean aceptarHabilitado = true; + + TcustPersonDetail detallesPersona = new TcustPersonDetail(); + + //Grados + List lGrados = new ArrayList(); + + TcustPersonDetail usuario; + TcustPersonDetail jefeCentroControl; + TarmCentroControl centroControl; + String nombreInstitucion = ""; + String gradoFuncionario = ""; + private String csolicitud; + private Boolean btnEnviar; + + @ManagedProperty(value = "#{ordenTrabajoController}") + private OrdenTrabajoController ordenTrabajoController; + + @ManagedProperty(value = "#{custodiosController}") + private CustodiosController custodiosController; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + public GenerarOrdenTrabajoCustodiosController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + startQuery(); + this.init(); + // Inicializa autoconsulta + // super.startQuery(); + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + csolicitud = super.getMfilters().get("csolicitud"); + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + fechaHoy = Calendar.getInstance().getTime(); + + this.ordenTrabajoController.create(); + this.custodiosController.create(); + this.lrecord = new ArrayList<>(); + this.beanalias = "GENERARORDENCUSTODIOSCONTROLLER"; + //ordenTrabajoController.setRecord(new TarmOrdenTrabajo()); + + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + btnEnviar = Boolean.FALSE; + + querydatabase(); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @Override + public void query() throws Exception { + // TODO Auto-generated method stub + MessageHelper.setMessageError("msg_notQuery"); + super.query(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + //Obteniendo la solicitud + solicitud = ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(csolicitud); + if (solicitud != null && solicitud.getPk() != null) { + + //Datos de la persona + detallesPersona = PersonDetailController.find(String.valueOf(solicitud.getPersoncode().toString())); + + this.ordenTrabajoController.getRecord().setCsolicitud(solicitud.getPk()); + this.ordenTrabajoController.getRecord().setFsolicitud(solicitud.getFregistro()); + + solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + + if (solicitudTramite != null && solicitudTramite.getPk().getCtramite() != null) { + + tramite = TarmTramiteController.find(solicitudTramite.getPk().getCtramite().toString()); + + if (tramite != null && tramite.getPk() != null) { + this.ordenTrabajoController.getRecord().setCtramite(tramite.getPk()); + + //Uso actividad + TgeneCatalogDetail catalogDetailTramite = CatalogDetailController.findxCodigoCodcatalogo(solicitudTramite.getEstadotramite(), solicitudTramite.getEstadotramitecodigo()); + catalogDetailTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + if (catalogDetailTramite != null && tramite.getUsoactividad() != null && tramite.getUsoactividadcodigo() != null) { + usoActividad = catalogDetailTramite.getDescription(); + } + + } + } + + //Obteniendo el centro de control + centroControl = CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + if (centroControl != null && centroControl.getNombreinstitucion() != null && !centroControl.getNombreinstitucion().isEmpty() + && centroControl.getNombreinstitucioncodigo() != null && !centroControl.getNombreinstitucioncodigo().isEmpty()) { + + TgeneCatalogDetail catalogoInstitucion = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()); + this.nombreInstitucion = catalogoInstitucion.getDescription(); + } + + //Obteniendo el jefe del centro de control + this.jefeCentroControl = PersonDetailController.find(this.centroControl.getPersoncode().toString()); + + //Obteniendo el grado del jefe del centro de control + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.jefeCentroControl.getMilitarygrade(), this.jefeCentroControl.getMilitarygradecode()); + if (grado != null) { + gradoFuncionario = grado.getDescription() + " - "; + } + + } + + //Obteniendo la lista de grados militares + lGrados = CatalogDetailController.find("GRADOS"); + + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("querytype", "T"); + + Response resp = callerhelper.executeQuery(request); + + //Obteniendo el numero de orden + this.numeroOrden = Long.parseLong(resp.get("SECUENCIALSOLORDENTRABAJO").toString()); + this.ordenTrabajoController.getRecord().setPk(numeroOrden); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + + MessageHelper.setMessageError(resp); + } else { + super.postQuery(lrecord); + + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + if (custodiosController.getLrecord().isEmpty()) { + MessageHelper.setMessageError("LA ORDEN DE TRABAJO NO TIENE CUSTODIOS ASIGNADOS.", null); + } else { + //Asignando los campos a la orden de trabajo + this.ordenTrabajoController.getRecord().setDocumentoreferencia(this.solicitudTramite.getNumerotramite()); + this.ordenTrabajoController.getRecord().setEmpresasolicita(this.detallesPersona.getName()); + this.ordenTrabajoController.getRecord().setDireccioncomision(this.lugarDireccion); + this.ordenTrabajoController.getRecord().setRuta(this.ruta); + this.ordenTrabajoController.getRecord().setTiempoestimado(this.tiempoEstimado); + + Calendar c = Calendar.getInstance(); + c.setTime(inicio); + fechaInicio = new java.sql.Date(c.getTimeInMillis()); + this.ordenTrabajoController.getRecord().setFinicio(this.fechaInicio); + + c = Calendar.getInstance(); + c.setTime(fin); + fechaFin = new java.sql.Date(c.getTimeInMillis()); + this.ordenTrabajoController.getRecord().setFfinalizacion(this.fechaFin); + + this.ordenTrabajoController.getRecord().setObservaciones(this.observaciones); + + this.ordenTrabajoController.update(); + this.ordenTrabajoController.getLrecord().add(this.ordenTrabajoController.getRecord()); + this.ordenTrabajoController.update(this.ordenTrabajoController.getLrecord().get(0)); + + this.custodiosController.setSalva(true); + for (TarmOrdenTrabajoCustodios custodio : this.custodiosController.getLrecord()) { + + //Asignando el codigo del grado + custodio.setCordentrabajo(this.numeroOrden); + this.custodiosController.update(custodio); + } + + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + + DtoSave dtosaveOrdenTrabajo = this.ordenTrabajoController.getDtoSave(true); + dtosaveOrdenTrabajo.setPosition(1); + msave.put(this.ordenTrabajoController.getBeanalias(), dtosaveOrdenTrabajo); + + DtoSave dtosaveCustodios = this.custodiosController.getDtoSave(true); + dtosaveCustodios.setPosition(2); + msave.put(this.custodiosController.getBeanalias(), dtosaveCustodios); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.aceptarHabilitado = false; + this.ordenTrabajoController.postCommit(resp); + this.custodiosController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + this.ordenTrabajoController.postCommit(response); + this.custodiosController.postCommit(response); + } + + public void cancelar() { + this.ordenTrabajoController.setRecord(new TarmOrdenTrabajo()); + this.custodiosController.getLrecord().clear(); + } + + /** + */ + @SuppressWarnings("finally") + public String grado(String grado, String gradoCodigo) { + String descripcionGrado = ""; + try { + TgeneCatalogDetail catalogDetailTramite = CatalogDetailController.findxCodigoCodcatalogo(grado, gradoCodigo); + if (catalogDetailTramite != null && grado != null && gradoCodigo != null) { + descripcionGrado = catalogDetailTramite.getDescription(); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } finally { + return descripcionGrado; + } + } + + /** + * Ejecuta un reporte de custodios + * + * @param name Nombre del reporte a generar. + */ + public void generateReport() { + String path = "armas/reports/ordenTrabajoCustodios"; + String filename = MsgControlArmas.getProperty("lbl_ordenTrabajoCustodios"); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("codigoOrden", this.numeroOrden.toString()); + + //Centro de control + parameters.put("nombreCentro", this.nombreInstitucion); + + //Numero de orden de trabajo + parameters.put("numeroOrdenTrabajo", this.numeroOrden); + + //Documento de referencia + parameters.put("documentoReferencia", this.solicitudTramite.getNumerotramite()); + + //Fecha + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("fecha", sdf.format(this.fechaHoy)); + + //Comision actividad + parameters.put("comisionActividad", "Custodia Militar"); + + //Empresa solicita + parameters.put("empresaSolicita", this.detallesPersona.getName()); + + //Tiempo estimado + parameters.put("tiempoEstimado", this.tiempoEstimado); + + //Fecha inicio + parameters.put("fechaInicio", sdf.format(this.inicio)); + + //Fecha fin + parameters.put("fechaFin", sdf.format(this.fin)); + + //Lugar + parameters.put("lugar", this.lugarDireccion); + + //Ruta + parameters.put("ruta", this.ruta); + + //Funcionario + parameters.put("gradoNombreFuncionario", gradoFuncionario + this.jefeCentroControl.getName()); + parameters.put("personcode", this.jefeCentroControl.getPk().getPersoncode()); + parameters.put("centroControl", "JEFE DEL " + this.nombreInstitucion); + + //Usuario + parameters.put("usuario", this.usuario.getName()); + sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + String fechaHora = sdf.format(Calendar.getInstance().getTime()); + parameters.put("fechaHora", fechaHora); + + parameters.put("codigoQR", csolicitud + " " + fechaHora + " " + " " + sdf.format(this.fin) + " " + gradoFuncionario + this.jefeCentroControl.getName()); + + String format = "pdf"; + + try { + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + btnEnviar = Boolean.TRUE; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public void probarReporte() { + try { + TarmOrdenTrabajo orden = ordenTrabajoController.find("128"); + + String path = "armas/reports/ordenTrabajoCustodios"; + String filename = MsgControlArmas.getProperty("lbl_ordenTrabajoCustodios"); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("codigoOrden", "128"); + + //Centro de control + parameters.put("nombreCentro", this.nombreInstitucion); + + //Numero de orden de trabajo + parameters.put("numeroOrdenTrabajo", 128L); + + //Documento de referencia + parameters.put("documentoReferencia", this.solicitudTramite.getNumerotramite()); + + //Fecha + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("fecha", sdf.format(this.fechaHoy)); + + //Comision actividad + parameters.put("comisionActividad", "Custodia Militar"); + + //Empresa solicita + parameters.put("empresaSolicita", this.detallesPersona.getName()); + + //Tiempo estimado + parameters.put("tiempoEstimado", orden.getTiempoestimado()); + + //Fecha inicio + parameters.put("fechaInicio", sdf.format(orden.getFinicio())); + + //Fecha fin + parameters.put("fechaFin", sdf.format(orden.getFfinalizacion())); + + //Lugar + parameters.put("lugar", orden.getDireccioncomision()); + + //Ruta + parameters.put("ruta", orden.getRuta()); + + //Funcionario + parameters.put("gradoNombreFuncionario", gradoFuncionario + this.jefeCentroControl.getName()); + parameters.put("personcode", this.jefeCentroControl.getPk().getPersoncode()); + parameters.put("centroControl", "JEFE DEL " + this.nombreInstitucion); + + //Usuario + parameters.put("usuario", this.usuario.getName()); + sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + String fechaHora = sdf.format(Calendar.getInstance().getTime()); + parameters.put("fechaHora", fechaHora); + + String format = "pdf"; + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + if (!btnEnviar) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_avanzar_flujo")); + return; + } + + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("csolicitud", csolicitud); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + btnEnviar = Boolean.FALSE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public OrdenTrabajoController getOrdenTrabajoController() { + return ordenTrabajoController; + } + + public void setOrdenTrabajoController( + OrdenTrabajoController ordenTrabajoController) { + this.ordenTrabajoController = ordenTrabajoController; + } + + public CustodiosController getCustodiosController() { + return custodiosController; + } + + public void setCustodiosController(CustodiosController custodiosController) { + this.custodiosController = custodiosController; + } + + public Date getFechaHoy() { + return fechaHoy; + } + + public void setFechaHoy(Date fechaHoy) { + this.fechaHoy = fechaHoy; + } + + public Date getFechaInicio() { + return fechaInicio; + } + + public void setFechaInicio(java.sql.Date fechaInicio) { + this.fechaInicio = fechaInicio; + } + + public Date getFechaFin() { + return fechaFin; + } + + public void setFechaFin(java.sql.Date fechaFin) { + this.fechaFin = fechaFin; + } + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + public TarmSolicitudTramite getSolicitudTramite() { + return solicitudTramite; + } + + public void setSolicitudTramite(TarmSolicitudTramite solicitudTramite) { + this.solicitudTramite = solicitudTramite; + } + + public TarmTramite getTramite() { + return tramite; + } + + public void setTramite(TarmTramite tramite) { + this.tramite = tramite; + } + + public String getUsoActividad() { + return usoActividad; + } + + public void setUsoActividad(String usoActividad) { + this.usoActividad = usoActividad; + } + + public List getlGrados() { + return lGrados; + } + + public void setlGrados(List lGrados) { + this.lGrados = lGrados; + } + + public Long getNumeroOrden() { + return numeroOrden; + } + + public void setNumeroOrden(Long numeroOrden) { + this.numeroOrden = numeroOrden; + } + + public String getDocumentoReferencia() { + return documentoReferencia; + } + + public void setDocumentoReferencia(String documentoReferencia) { + this.documentoReferencia = documentoReferencia; + } + + public String getEmpresa() { + return empresa; + } + + public void setEmpresa(String empresa) { + this.empresa = empresa; + } + + public String getLugarDireccion() { + return lugarDireccion; + } + + public void setLugarDireccion(String lugarDireccion) { + this.lugarDireccion = lugarDireccion; + } + + public String getRuta() { + return ruta; + } + + public void setRuta(String ruta) { + this.ruta = ruta; + } + + public String getObservaciones() { + return observaciones; + } + + public void setObservaciones(String observaciones) { + this.observaciones = observaciones; + } + + public String getTiempoEstimado() { + return tiempoEstimado; + } + + public void setTiempoEstimado(String tiempoEstimado) { + this.tiempoEstimado = tiempoEstimado; + } + + public Date getInicio() { + return inicio; + } + + public void setInicio(Date inicio) { + this.inicio = inicio; + } + + public Date getFin() { + return fin; + } + + public void setFin(Date fin) { + this.fin = fin; + } + + public Boolean getAceptarHabilitado() { + return aceptarHabilitado; + } + + public void setAceptarHabilitado(Boolean aceptarHabilitado) { + this.aceptarHabilitado = aceptarHabilitado; + } + + public TcustPersonDetail getDetallesPersona() { + return detallesPersona; + } + + public void setDetallesPersona(TcustPersonDetail detallesPersona) { + this.detallesPersona = detallesPersona; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public Boolean getBtnEnviar() { + return btnEnviar; + } + + public void setBtnEnviar(Boolean btnEnviar) { + this.btnEnviar = btnEnviar; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ImportacionProduccionController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ImportacionProduccionController.java new file mode 100644 index 0000000..cf72f1a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ImportacionProduccionController.java @@ -0,0 +1,2217 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.apache.commons.lang3.StringUtils; +import org.primefaces.context.RequestContext; +import org.primefaces.event.SelectEvent; +import org.primefaces.extensions.component.inputnumber.InputNumber; + +import com.fp.common.helper.Constant; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.CargaController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.lov.ArmaExplosivoLovController; +import com.fp.frontend.controller.armas.lov.CargasLovController; +import com.fp.frontend.controller.armas.parametros.CalibreLovController; +import com.fp.frontend.controller.armas.parametros.ClaseLovController; +import com.fp.frontend.controller.armas.parametros.LongitudLovController; +import com.fp.frontend.controller.armas.parametros.TipoArmaExpLovController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.frontend.utility.ValidateIdentification; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Controlador principal de armas + * + * @author Christian Pazmino + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ImportacionProduccionController extends AbstractController { + + private Boolean estadoDesaduanizado = Boolean.FALSE; + private Boolean esNuevaImportacion = Boolean.TRUE; + private String filterAUCP; + //P lpartidaArancelaria = new ArrayList<>(); + private TarmCarga carga = new TarmCarga(); + private Boolean isSelectAucpPrevio = Boolean.FALSE; + private Boolean isSave = Boolean.FALSE; + private Boolean isEnableCategoria = Boolean.TRUE; + InputNumber cantidadTxt = new InputNumber(); + List ldeleteItems = new ArrayList(); + + @ManagedProperty(value = "#{tiposArmasExplosivosController}") + private TiposArmasExplosivosController tiposArmasExplosivosController; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmas; + + // Datos generales + private TgeneCatalogDetail tipoDocumento; + private TcustPersonDetail detallesPersona; + // Catalogo que contiene tipos de registros + private List tiposRegistro; + private TcustPersonDetail usuario; + +// private String tipoRegistro; + //Registro armas + TarmRegistroArmas registro = new TarmRegistroArmas(); + + //Detalle de localizacion para el caso de importaciones + private List lpaises; +// private TgeneCountry pais; + //private String pais; + + //Provincia + private List lprovincias; + private String codigoProvincia; + + //Canton + private List lcantones; + private String codigoCanton; + + //Ciudad + private List lciudades; +// private TgeneCity ciudad; + + //Aeropuertos + private List laeropuertos = new ArrayList<>(); + + private List ldocumentospersona; + +// /** +// * Lista de tipos de identificación +// */ +// private List ltipoidentificacion; + /** + * Listado de estados del arma + */ + private List lestadoarma; + /** + * Listado de marcas + */ + private List lmarca; + /** + * Listado de colores + */ + private List lcolor; + /** + * Listado de tipos de fabricación + */ + private List ltipofabricacion; + /** + * Listado de unidad de medida cantidad + */ + private List lunidadmedidacantidad; + /** + * Listado de unidad medida peso + */ + private List lunidadmedidapeso; +// /** +// * Listado de paises +// */ +// private List lcountry; +// /** +// * Listado de provincias +// */ +// private List lprovincias; +// /** +// * Listado de cantones +// */ +// private List lcantones; + /** + * Listado de parroquias + */ + private List lparroquias; + /** + * Listado de ciudades + */ + private List lcities; + +// /** +// * Tipo documento +// */ +// private String tipoDoc; +// /** +// * Número documento +// */ +// private String numDoc; +// /** +// * Nombre/razón social +// */ +// private String nombreRazon; + /** + * Longitud arma + */ + private String longitud; + /** + * Calibre arma + */ + private String calibre; + /** + * Clase arma + */ + private String clase; + /** + * Clase arma + */ + private String categoria; + /** + * Tipo de arma + */ + private String tipoarma; + /** + * unidad medida peso + */ + private String unidadmedidapeso; + + /** + * Bandera que indica que en realidad existe luego del ingreso de datos un + * tipo de arma explosivo válido + */ + private boolean existeTipoArmaExplosivo; + + /** + * Bandera que especifica que se deba verificar que exista un arma explosivo + * válido + */ + private boolean verificaArmaExplosivo = Boolean.TRUE; + + /** + * Bloquea la unidad de cantidad + */ + private boolean bloquearUnidadCantidad = Boolean.TRUE; + + /** + * Bloquea la unidad de peso + */ + private boolean bloquearUnidadPeso = Boolean.TRUE; + /** + * Contiene la fecha actual del sistema + */ + private Date fechaActual; + /** + * Contiene la referencia a nuevo propietario del arma + */ + private TcustPersonDetail nuevoPropietarioArma; + /** + * Tipo del arma explosivo + */ + private TarmTipoArmaExplosivo tipoArmaExplosivo; + /** + * codigo del ruc + */ + private String codigoRuc; + /** + * codigo del ruc + */ + private String codigoCedula; + /** + * codigo del ruc + */ + private String codigoPasaporte; + + public ImportacionProduccionController() throws Exception { + super(TarmArmas.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + carga.setIsnew(Boolean.TRUE); + //Localizacion + lpaises = CountryController.find(); + this.lprovincias = ProvinceController.find("EC"); + //Obteniendo los aeropuertos + this.laeropuertos = CatalogDetailController.find("AEROPUERTOS"); + this.lpartidaArancelaria = CatalogDetailController.find("PARTIDAARANCELARIA"); + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + detallesPersona = PersonDetailController.find(String.valueOf(usuario.getPk().getPersoncode())); + //Tipo de documento + tipoDocumento = CatalogDetailController.findxCodigoCodcatalogo(detallesPersona.getIdentificationcatalog(), detallesPersona.getIdentificationcatalogcode()); + //Tipos de registro + tiposRegistro = CatalogDetailController.find("TIPOREGISTRO", "REG"); + fechaActual = new Date(); + recperpage = 5000; // Cambiar al # reg a mirar. +// record = new TarmArmas(); + lrecord = new ArrayList<>(); + beanalias = "ARMAS"; +// ltipoidentificacion = CatalogDetailController.find("IDENTIFICATION"); + lestadoarma = CatalogDetailController.find("ESTADOARMA"); + lmarca = CatalogDetailController.find("MARCA"); + lcolor = CatalogDetailController.find("COLOR"); + ltipofabricacion = CatalogDetailController.find("TIPOFABRICACION"); +// lunidadmedidacantidad = CatalogDetailController.find("UCANTIDAD"); + lunidadmedidapeso = CatalogDetailController.find("UNIDADMEDIDA"); +// lcountry = CountryController.find(); + codigoRuc = codigos("CODIGO.RUC"); + codigoCedula = codigos("CODIGO.CEDULA"); + codigoPasaporte = codigos("CODIGO.PASAPORTE"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void cargarCategorias() { + System.out.println("cargarCategorias 1"); + // Cargamos la lista de categorias disponibles para el usuario (en funcion de sus documentos habilitantes) + ldocumentospersona = new ArrayList<>(); + List listadocum = new ArrayList<>(); + System.out.println("registro.getTiporegistro() " + registro.getTiporegistro()); + if (registro.getTiporegistro() != null) { + if ("PRO".equals(registro.getTiporegistro())) { + listadocum = DocumentoHabilitanteController.findByPerson_Produccion(usuario.getPk().getPersoncode().toString()); + carga = new TarmCarga(); + carga.setIsnew(Boolean.TRUE); + registro.setIsnew(Boolean.TRUE); + } else { + if (esNuevaImportacion) { + registro.setIsnew(Boolean.TRUE); + } + listadocum = DocumentoHabilitanteController.findByPerson_Importacion(usuario.getPk().getPersoncode().toString()); + } + } else { + ldocumentospersona = new ArrayList<>(); + } + //Forma numero 1 (Uso de Maps). + Map mapaSinRepetidos = new HashMap(listadocum.size()); + for (TarmDocumentoHabilitante p : listadocum) { + mapaSinRepetidos.put(p.getCtramite(), p); + } + //Agrego cada elemento del map a una nueva lista y muestro cada elemento. + for (Entry p : mapaSinRepetidos.entrySet()) { + ldocumentospersona.add(p.getValue()); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + String sqlFiltroPersona = ""; + String sqlFiltroSancion = ""; + String sqlFiltroEstados = ""; + String sqlFiltroClaseArmas = ""; +// String sqlFiltroFechaCaducidad = ""; + String sqlFiltroValidacionArma = "";//si entre los estados existe renovacion entonces validamos que no pueda seleccionar las mismas armas + if (this.getMfilelds().get("personcode") != null) { + sqlFiltroPersona = " t.cregistro in (SELECT c.pk FROM TarmRegistroArmas c WHERE c.personcode=" + this.getMfilelds().get("personcode") + ")"; + } + //agregamos los filtros en base a la consideracion del field sancion, en caso de que lo sea buscamos los sancionados que hayan cumplido el tiempo de sancion + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + if (this.getMfilelds().containsKey("sancion") && this.getMfilelds().get("sancion").toString().equals(Constant.STR_Y)) { + sqlFiltroSancion = " t.pk in (SELECT max(a.pk) FROM TarmArmas a WHERE a.codigoarma in (SELECT distinct(h.codigoarma) from TarmDocumentoHabilitante h WHERE h.pk in (SELECT d.cdocumento FROM TarmSancionDecomiso d WHERE d.personcode=" + this.getMfilelds().get("personcode") + " AND d.fechafinal < TO_DATE('" + dateFormat.format(Calendar.getInstance().getTime()) + "', 'YYYY-MM-DD'))) GROUP BY a.codigoarma)"; + } + + dto.setOrderby("pk"); + if (this.getMfilelds().get("ESTADOS") != null) { + String[] estados = this.getMfilelds().get("ESTADOS").toString().split(","); + StringBuffer sqlEstados = new StringBuffer(" t.estado IN ("); + for (int i = 0; i < estados.length; i++) { + sqlEstados.append("'").append(estados[i]).append("'"); + if (i < estados.length - 1) { + sqlEstados.append(","); + } + } + sqlEstados.append(")"); + sqlFiltroEstados = sqlEstados.toString(); + } + + if (this.getMfilelds().get("TRAMITE") != null) { + TarmTramite tarmTramite = (TarmTramite) this.getMfilelds().get("TRAMITE"); + sqlFiltroValidacionArma = "t.pk not in (SELECT coalesce(max(a.pk),'-1') FROM TarmArmas a WHERE a.codigoarma in (SELECT distinct(h.codigoarma) from TarmDocumentoHabilitante h WHERE h.personcode=" + this.getMfilelds().get("personcode") + " AND h.ctramite=" + tarmTramite.getPk() + " AND h.estado = 'APR' AND h.fechaexpiracion >= " + "TO_DATE('" + dateFormat.format(Calendar.getInstance().getTime()) + "','yyyy-MM-dd')) GROUP BY a.codigoarma)"; + } + //estados del armas + if (this.getMfilelds().get("CLASEARMAS") != null) { + String[] clasesarma = this.getMfilelds().get("CLASEARMAS").toString().split(","); + StringBuffer sqlclasesarmas = new StringBuffer(" t.ctipoarmaexplosivo IN (select o.pk from TarmTipoArmaExplosivo o where o.clase in("); + for (int i = 0; i < clasesarma.length; i++) { + sqlclasesarmas.append("'").append(clasesarma[i]).append("'"); + if (i < clasesarma.length - 1) { + sqlclasesarmas.append(","); + } + } + sqlclasesarmas.append(")) "); + sqlFiltroClaseArmas = sqlclasesarmas.toString(); + } + +// if(this.getMfilelds().get("FECHACADUCIDADARM") != null){ +// sqlFiltroFechaCaducidad="t.fechacaducidad "+this.getMfilelds().get("FECHACADUCIDADARM"); +// } + String sqlActual = " t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma) and t.estado !='DEST' and t.estado!='VEND' and t.estado!='MING' and t.estado!='DUPL' and t.estado!='CUSTEM'" + + " and (t.peso>0 or t.cantidad>0)";//distintas de destruidas y cambio de propietario and t.cregistro=ta.cregistro para el manejo de los explosivos + +// String sqlFinal = obtenerFiltroBusquedaGeneral(sqlFiltroPersona, sqlFiltroEstados, sqlFiltroSancion, sqlFiltroValidacionArma,sqlFiltroClaseArmas,sqlFiltroFechaCaducidad, sqlActual); + String sqlFinal = obtenerFiltroBusquedaGeneral(sqlFiltroPersona, sqlFiltroEstados, sqlFiltroSancion, sqlFiltroValidacionArma, sqlFiltroClaseArmas, sqlActual); + Filter filtroFinal = new Filter(); + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void actualizaPanelImportacion() { + if (esNuevaImportacion) { + System.out.println("Logica para cuando es una nueva importacion: " + esNuevaImportacion); + carga = new TarmCarga(); + carga.setIsnew(Boolean.TRUE); + registro.setIsnew(Boolean.TRUE); +// if(registro.getPk()!=null){ +// registro.setPk(null); +// +// } + } else { + System.out.println("Logica para cuando es una importacion ya cargada y se consultara por AUCP: " + esNuevaImportacion); + } +// registro = new TarmRegistroArmas(); +// this.lrecord = new ArrayList(); + + } + + private String obtenerFiltroBusquedaGeneral(String... sqlFiltros) { + StringBuffer sqlFinal = new StringBuffer(); + for (int i = 0; i < sqlFiltros.length; i++) { + if (sqlFinal.length() > 0 && !StringUtils.endsWith(StringUtils.trim(sqlFinal.toString()), "AND")) { + sqlFinal.append(" AND "); + } + sqlFinal.append(sqlFiltros[i]); + } + return sqlFinal.toString(); + } + + @SuppressWarnings("unchecked") + public void querydatabaseSinFiltros() { + try { + DtoQuery dto = this.getDtoQuery(); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql = " t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() throws Exception { + // TODO Auto-generated method stub + super.next(); + } + + @SuppressWarnings("unchecked") + protected void querydatabasePorCodigo() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql = " t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", "i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase = new SubQuery("TarmTipoArmaExplosivo", "clase", "cclase", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo = new SubQuery("TarmTipoArmaExplosivo", "clasecodigo", "cclasecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud = new SubQuery("TarmTipoArmaExplosivo", "longitud", "clongitud", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo = new SubQuery("TarmTipoArmaExplosivo", "longitudcodigo", "clongitudcodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre = new SubQuery("TarmTipoArmaExplosivo", "calibre", "ccalibre", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo = new SubQuery("TarmTipoArmaExplosivo", "calibrecodigo", "ccalibrecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivo", "ctipoarmaexplosivo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivocodigo", "ctipoarmaexplosivocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapeso", "cunidadmedidapeso", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapesocodigo", "cunidadmedidapesocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida = new SubQuery("TgeneCatalogDetail", "description", "unidadmedida", "i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode = new SubQuery("TarmRegistroArmas", "personcode", "personcode", "i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + SubQuery subqueryTipo = new SubQuery("TgeneCatalogDetail", "description", "tipo", "i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipo); + SubQuery subqueryTipoArmaExplosivo = new SubQuery("TgeneCatalogDetail", "description", "tipoarmaexplosivo", "i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + SubQuery subqueryClasecatalogo = new SubQuery("TgeneCatalogDetail", "description", "clase", "i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClasecatalogo); + + return dto; + } + + @SuppressWarnings("unchecked") + protected void querydatabaseSimple() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql = " t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void remove() throws Exception { + if (record.getPk() == null) { + super.remove(); + } else { + ldeleteItems.add(this.record); + super.remove(); + } + } + + @Override + public void save() { + try { + if (registro.getTiporegistro().equals("IMP") && registro.isnew) { + TarmCarga aucpUsadoPrevio = CargaController.findByAUCP(registro.getSolicitudnum()); + if (aucpUsadoPrevio != null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_aucp_previamente_cargado")); + return; + } + if (this.registro.getPaisorigen() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_paisOrigenRequerido")); + return; + } + if (this.carga.getProvincecode() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_provinciaRequerido")); + return; + } + if (this.carga.getCantoncode() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_cantonRequerido")); + return; + } + if (this.carga.getCitycode() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ciudadRequerido")); + return; + } + if (this.registro.getAeropuertopuerto() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_aeropuertoRequerido")); + return; + } + } + if (this.getLrecord().isEmpty()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_carga_armas_inexistentes")); + return; + } + this.registroArmas.update(); + Request request = callerhelper.getRequest(); + this.registro.setPersoncode(usuario.getPk().getPersoncode()); + this.registro.setFechasolicitud(new java.sql.Date((new Date()).getTime())); + this.registro.setTiporegistrocodigo("TIPOREGISTRO"); +// this.registro.setPaisorigen("EC"); + this.registro.setFcreacion(new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + request.getModifiedData().put("LISTAARMAS", this.lrecord); + request.getModifiedData().put("LISTAARMASELIMINADAS", this.ldeleteItems); + request.getModifiedData().put("TIPOREGISTRO", this.registro.getTiporegistro()); + request.getModifiedData().put("REGISTRO", this.registro); + request.getModifiedData().put("PERSONCODE", usuario.getPk().getPersoncode()); + request.getModifiedData().put("ESNUEVAIMPORTACION", esNuevaImportacion); + carga.setCategoria(this.categoria); + request.getModifiedData().put("TARMCARGA", carga); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + isSave = Boolean.TRUE; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void saveArmaSolicitud() { + try { + + if (!isArmaDuplicada(record)) { + + record.getModifiedData().put("edit", "S"); + + this.registroArmas.update(); + update(); + if (!existeTipoArmaExplosivo) { + return; + } + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(Boolean.TRUE); // Para que el core devuelva el pk de los registros nuevos. + dtosave.setPosition(2); + HashMap msave = new HashMap(); + DtoSave dtoSaveRegistro = registroArmas.getDtoSave(); + dtoSaveRegistro.setIsForm(Boolean.TRUE); + dtoSaveRegistro.setReturnpk(Boolean.TRUE); + dtoSaveRegistro.setPosition(1); + + Request request = callerhelper.getRequest(); + request.setTransactionModule("30"); + request.setTransactionCode(15); + request.setTransactionVersion(1); + if (!verificaArmaExplosivo) { + request.put("eseliminacion", Constant.STR_Y); + } else { + msave.put(registroArmas.getBeanalias(), dtoSaveRegistro); + } + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.put("TIPODOC", this.getMfilelds().get("tipodoc")); + request.put("NUMDOC", this.getMfilelds().get("numdoc")); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.registroArmas.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } else { + record = null; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_armaDuplicada")); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void update() throws Exception { +// TgeneCatalogDetail estado = CatalogDetailController.findxCodigoCodcatalogo(record.getEstado(), record.getEstadocodigo()); + TgeneCatalogDetail marca = CatalogDetailController.findxCodigoCodcatalogo(record.getMarca(), record.getMarcacodigo()); +// record.getModifiedData().put("estado", estado.getDescription()); + isEnableCategoria = Boolean.FALSE; + record.setPartidaarancelariacodigo("PARTIDAARANCELARIA"); + record.setTipofabricacion("TIPOFABRICACION2"); + record.setTipofabricacioncodigo("TIPOFABRICACION"); + record.getModifiedData().put("marca", marca.getDescription()); + for (TgeneCatalogDetail color : lcolor) { + if (record.getColor() != null && record.getColor().equals(color.getPk().getCatalog())) { + record.getModifiedData().put("color", color.getDescription()); + break; + } + } + if (verificaArmaExplosivo) { + if (tipoArmaExplosivo == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionClase")); + existeTipoArmaExplosivo = Boolean.FALSE; + return; + } else { + this.record.setCtipoarmaexplosivo(tipoArmaExplosivo.getPk()); + record.getModifiedData().put("unidadMedidaCantidad", tipoArmaExplosivo.getUnidadmedidapeso()); + existeTipoArmaExplosivo = Boolean.TRUE; + } + } + super.update(); + } + + public Boolean existeDuplicidad() { + if (this.lrecord.contains(record)) { + return Boolean.TRUE; + } + return Boolean.FALSE; + } + + public void updateAutorizacion() throws Exception { + super.update(); + } + + /** + * Método que se ejecuta al carga edición + * + * @throws Exception + */ + public void loadEdit() throws Exception { + verificaArmaExplosivo = Boolean.TRUE; + if (record.getCountrycode() == null) { + record.setCountrycode("EC"); + } + if (record.getCtipoarmaexplosivo() == null) { + MessageHelper.setMessageError("NO ESTA ASOCIADO A UN TIPO DE ARMA EXPLOSIVO"); + return; + } + tipoArmaExplosivo = TiposArmasExplosivosController.findarma(record.getCtipoarmaexplosivo()); +// lprovincias = ProvinceController.find(record.getCountrycode()); +// executeProvince(); +// if(record.getProvincecode() != null){ +// lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); +// executeCanton(); +// } +// completaInfTipoArma(); + // Anade la descripcion del tipo de arma explosivo + if (tipoArmaExplosivo != null) { + this.clase = tipoArmaExplosivo.getClase(); + this.longitud = tipoArmaExplosivo.getLongitud(); + this.tipoarma = tipoArmaExplosivo.getTipoarmaexplosivo(); + this.calibre = tipoArmaExplosivo.getCalibre(); + } + verificarClaseArma(); + } + +// /** +// * Método que completa la informaci´n del arma una vez se presiona el botón crear +// */ +// private void completaInfTipoArma(){ +// TarmArmas recordArma = findPorCodigo(record.getPk()); +// record.setCountrycode("EC"); +// clase = record.getModifiedData().get("clase") != null ? recordArma.getModifiedData().get("clase").toString() : null; +// calibre = record.getModifiedData().get("ccalibre") != null ? Utilidades.formatearDecimalesEnTexto((recordArma.getModifiedData().get("ccalibre").toString()).replace("null", ""), "#.00") : null; +// longitud = record.getModifiedData().get("clongitud") != null ? recordArma.getModifiedData().get("clongitud").toString() : null; +// tipoarma = record.getModifiedData().get("ctipoarmaexplosivo") != null ? recordArma.getModifiedData().get("ctipoarmaexplosivo").toString() : null; +// } + @Override + public void create() throws Exception { + if (categoria != null) { + super.create(); + this.record.setEstadocodigo("ESTADOARMA"); + this.record.setMarcacodigo("MARCA"); + this.record.setCantidad(null); + this.record.setPeso(null); + this.lprovincias = ProvinceController.find(record.getCountrycode()); + this.executeProvince(); + this.bloquearUnidadCantidad = Boolean.TRUE; + this.bloquearUnidadPeso = Boolean.TRUE; + RequestContext.getCurrentInstance().execute("PF('dialog').show()"); + } else { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_categoriaRequerida")); + return; + } + } + + public void update(TarmArmas bean) throws Exception { + record = bean; + updateAutorizacion(); + } + + public void validacionDocumento(String numeroDocumento, String tipoDocumento) { + if (numeroDocumento == null || tipoDocumento == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselacedula")); + return; + } + TcustPersonDetail tcustPersonDetail = null; + if (tipoDocumento.equals(codigoCedula)) { +//----------validamos si es valida la CEDULA + if (!ValidateIdentification.cedula(numeroDocumento)) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en MAIA + tcustPersonDetail = buscarPersonaMaia(numeroDocumento, tipoDocumento); + } else if (tipoDocumento.equals(codigoRuc)) { +//----------validamos si es valida el RUC + if (!ValidateIdentification.ruc(numeroDocumento)) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en maia + tcustPersonDetail = buscarPersonaMaia(numeroDocumento, tipoDocumento); + } else { +//----------si es PASAPORTE + tcustPersonDetail = buscarPersonaMaia(numeroDocumento, tipoDocumento); + } +// if(tcustPersonDetail==null){ +// nombreRazon=null; +//// numDoc=null; +// MessageHelper.setMessageError("La datos de la persona ingresada no existen, por favor crear primero la persona"); +// return; +// }else{ +// nombreRazon=tcustPersonDetail.getName(); +// } + } + + /** + * Método para validar si la persona existe en la BD de Maia + * + * @param numeroDocumento + * @param tipoDocumento + * @return TcustPersonDetail + */ + public TcustPersonDetail buscarPersonaMaia(String numeroDocumento, String tipoDocumento) { + return PersonDetailController.findxidentification(numeroDocumento, tipoDocumento); + } + + /** + * Busca un arma por código y estado + * + * @param armaCode código del arma + * @param estado estado del arma + * @return + */ + public static TarmArmas find(String armaCode, String estado) { + try { + + if (armaCode == null) { + return null; + } + ImportacionProduccionController cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + if (estado != null) { + cc.addFilter("estado", estado); + cc.addFilter("estadocodigo", "ESTADOARMA"); + } + cc.querydatabaseArmas(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = new TarmTipoArmaExplosivo(); + tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if (tarmTipoArmaExplosivo != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null) { + cc.record.modifiedData().put("calibre", tarmTipoArmaExplosivo == null ? "" : Utilidades.formatearDecimalesEnTexto((CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription()), "#.000")); + } + cc.record.modifiedData().put("tipo", tarmTipoArmaExplosivo == null ? "" : CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription()); + cc.record.modifiedData().put("clase", tarmTipoArmaExplosivo == null ? "" : CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription()); + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + cc.record.modifiedData().put("pais", cc.record.getCpaisorigen() == null ? "" : CountryController.findcountry(cc.record.getCpaisorigen()).getDescription()); + + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * + * @param codigopersona + * @return + */ + public static TarmArmas findBySerieMarca(String serie, String marca) { + try { + ImportacionProduccionController cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 5000; + if (serie != null && !serie.isEmpty()) { + cc.addFilter("lote", serie); + } + cc.addFilter("marca", marca); + cc.querydatabaseSimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * + * @param armaCode + * @return + */ + public static TarmArmas findByPK(String cArma) { + try { + + ImportacionProduccionController cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", cArma); + cc.querydatabaseSinFiltros(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + cc.record = cc.lrecord.get(0); + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if (tarmTipoArmaExplosivo != null) { + if (tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null) { + cc.record.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription() : ""); + } + if (tarmTipoArmaExplosivo.getTipoarmaexplosivo() != null && tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo() != null) { + cc.record.modifiedData().put("tipo", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription() : ""); + } + if (tarmTipoArmaExplosivo.getClase() != null && tarmTipoArmaExplosivo.getClasecodigo() != null) { + cc.record.modifiedData().put("clase", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription() : ""); + } + + TarmRegistroArmas registroArmas = new TarmRegistroArmas(); + TcustPersonDetail detallePersona = new TcustPersonDetail(); + if (cc.record.getCregistro() != null) { + registroArmas = RegistroArmController.findByCodigo(String.valueOf(cc.record.getCregistro())); + if (registroArmas != null) { + detallePersona = PersonDetailController.find(String.valueOf(registroArmas.getPersoncode())); + } + } + cc.record.modifiedData().put("razonsPropietario", registroArmas == null || detallePersona == null ? "" : detallePersona.getName()); + cc.record.modifiedData().put("documentoPropietario", registroArmas == null || detallePersona == null ? "" : detallePersona.getIdentification()); + + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * + * @param armaCode + * @return + */ + public static TarmArmas findPorCodigo(String armaCode) { + try { + + ImportacionProduccionController cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + //cc.addFilter("REG", "ESTADOARMA"); + cc.querydatabaseArmas(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if (tarmTipoArmaExplosivo != null) { + if (tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null) { + cc.record.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription() : ""); + } + if (tarmTipoArmaExplosivo.getTipoarmaexplosivo() != null && tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo() != null) { + cc.record.modifiedData().put("tipo", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription() : ""); + } + if (tarmTipoArmaExplosivo.getClase() != null && tarmTipoArmaExplosivo.getClasecodigo() != null) { + cc.record.modifiedData().put("clase", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription() : ""); + } + + TarmRegistroArmas registroArmas = new TarmRegistroArmas(); + TcustPersonDetail detallePersona = new TcustPersonDetail(); + if (cc.record.getCregistro() != null) { + registroArmas = RegistroArmController.findByCodigo(String.valueOf(cc.record.getCregistro())); + if (registroArmas != null) { + detallePersona = PersonDetailController.find(String.valueOf(registroArmas.getPersoncode())); + } + } + cc.record.modifiedData().put("razonsPropietario", registroArmas == null || detallePersona == null ? "" : detallePersona.getName()); + cc.record.modifiedData().put("documentoPropietario", registroArmas == null || detallePersona == null ? "" : detallePersona.getIdentification()); + cc.record.modifiedData().put("marca", (cc.record == null || cc.record.getMarca() == null || cc.record.getMarca().isEmpty() || cc.record.getMarcacodigo() == null || cc.record.getMarcacodigo().isEmpty()) ? "" : CatalogDetailController.findxCodigoCodcatalogo(cc.record.getMarca(), cc.record.getMarcacodigo()).getDescription()); + + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * + * @param armaCode + * @return + */ + public static TarmArmas findXCodigo(String armaCode) { + try { + + ImportacionProduccionController cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + //cc.addFilter("REG", "ESTADOARMA"); + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + lcities = CityController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + } + } + + /** + * + * + * @param personCode + * @param estados estados del arma separados por coma + * @return Una lista de Armas encontradas + */ + public List findxPersona(Long personCode, String estados, String clase, String fechaCaducidad) { + List armasLista = null; + try { + armasLista = new ArrayList(); + ImportacionProduccionController armas = new ImportacionProduccionController(); + armas.init(); + armas.recperpage = 4000; + armas.addField("personcode", personCode); + if (this.getMfilelds().get("sancion") != null) { + armas.addField("sancion", this.getMfilelds().get("sancion")); + } + if (this.getMfilelds().get("TRAMITE") != null) { + armas.addField("TRAMITE", this.getMfilelds().get("TRAMITE")); + } + if (estados == null) { + armas.addFilter("estado", "REG"); + } else { + armas.addField("ESTADOS", estados); + } + if (clase != null && clase.trim().length() > 0) { + armas.addField("CLASEARMAS", clase); + } +// if(fechaCaducidad != null && fechaCaducidad .trim().length()>0){ +// armas.addField("FECHACADUCIDADARM", fechaCaducidad); +// } + armas.query(); + if (armas.getLrecord() != null && !armas.getLrecord().isEmpty()) { + armasLista.addAll(armas.getLrecord()); + } + + return armasLista; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return armasLista; + } + } + + /** + * Lista de Armas por Registro + * + */ + public static List findxRegistro(String registrocode) { + try { + ImportacionProduccionController cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("cregistro", registrocode); + + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + for (TarmArmas item : cc.lrecord) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(item.getCtipoarmaexplosivo()); + item.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription()); + item.modifiedData().put("tipo", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription()); + item.modifiedData().put("clase", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription()); + item.modifiedData().put("longitud", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getLongitud(), tarmTipoArmaExplosivo.getLongitudcodigo()).getDescription()); + } + + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Abre el LOV de la clase del arma + */ + public void openLovClase() { + Map> params = new HashMap>(); + ClaseLovController.openLov(params); + } + + /** + * Regresa del LOV de armas + * + * @param event + */ + public void onReturnClase(SelectEvent event) { + TgeneCatalogDetail clase = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("clase", clase.getDescription()); + this.clase = clase.getPk().getCatalog(); + this.verificarClaseArma(); + } + + /** + * Abre el LOV de la clase del arma + */ + public void openArmaExplosivoLov() { + + this.record.getModifiedData().put("longitud", null); + this.record.getModifiedData().put("tipoarmaexplosivo", null); + this.record.getModifiedData().put("calibre", null); + // descripcionUnidadpeso=null; + Map> params = new HashMap<>(); + List lcategoriaParam = new ArrayList<>(); + lcategoriaParam.add(categoria); + params.put("categoria", lcategoriaParam); + ArmaExplosivoLovController.openLov(params); + + } + + /** + * Abre el LOV de busqueda de importaciones por codigo solicitud (AUCP) + */ + public void openCargaPrevia() { + Map> params = new HashMap<>(); + List lPersoncodeParam = new ArrayList<>(); + lPersoncodeParam.add(usuario.getPk().getPersoncode().toString()); + params.put("personcode", lPersoncodeParam); + CargasLovController.openLov(params); + } + + /** + * Regresa del LOV de armas + * + * @param event + */ + public void onReturnArmaExplosivo(SelectEvent event) { + tipoArmaExplosivo = (TarmTipoArmaExplosivo) event.getObject(); + //Setear descripciones a presentarse + this.record.getModifiedData().put("clase", tipoArmaExplosivo.getModifiedData().get("nclase")); + this.record.getModifiedData().put("tipoarmaexplosivo", tipoArmaExplosivo.getModifiedData().get("ntipo")); + this.record.getModifiedData().put("longitud", tipoArmaExplosivo.getModifiedData().get("nlongitud")); + this.record.getModifiedData().put("calibre", tipoArmaExplosivo.getModifiedData().get("ncalibre")); + // Setear valores en las variables correspondientes + if (tipoArmaExplosivo != null) { + this.clase = tipoArmaExplosivo.getClase(); + this.longitud = tipoArmaExplosivo.getLongitud(); + this.tipoarma = tipoArmaExplosivo.getTipoarmaexplosivo(); + this.calibre = tipoArmaExplosivo.getCalibre(); + this.record.setUnidadmedidacantidad(tipoArmaExplosivo.getUnidadmedidapeso()); + } + this.verificarClaseArma(); + // valida cantidad para registro de produccion + cantidadTxt.setValue(null); + if (registro.getTiporegistro().equals("PRO")) { + if ((this.clase.equals("0010000001") || this.clase.equals("0010000004") || this.clase.equals("0010000008")) && this.bloquearUnidadPeso) { + cantidadTxt.setValue("1"); + cantidadTxt.setDisabled(true); + } + } + } + + /** + * Regresa del LOV de carga + * + * @param event + */ + public void onReturnCarga(SelectEvent event) { + System.out.println("Retorno del lov carga"); + isSelectAucpPrevio = Boolean.TRUE; + carga = (TarmCarga) event.getObject(); + this.categoria = carga.getCategoria(); + this.isEnableCategoria = Boolean.FALSE; + if (carga.getEsdesaduanizado().equals("S")) { + this.isSave = Boolean.TRUE; + } + carga.setIsnew(Boolean.FALSE); + registro = RegistroArmController.findByCodigo(carga.getCregistro().toString()); + registro.setIsnew(Boolean.FALSE); + TgeneCountry paisOrigen = CountryController.findcountry(registro.getPaisorigen()); + registro.getModifiedData().put("paisorigen", paisOrigen != null ? paisOrigen.getDescription() : ""); + // Provincia + TgeneProvince provinciaTmp = ProvinceController.findPorCodigo("EC", carga.getProvincecode()).get(0); + if (provinciaTmp != null) { + carga.getModifiedData().put("provinceCode", provinciaTmp.getDescription()); + } + // Canton + TgeneCanton cantonTmp = CantonController.findPorCodigo("EC", carga.getProvincecode(), carga.getCantoncode()).get(0); + if (cantonTmp != null) { + carga.getModifiedData().put("cantonCode", cantonTmp.getDescription()); + } + // Ciudad + TgeneCity ciudadTmp = CityController.findPorCodigo("EC", carga.getProvincecode(), carga.getCantoncode(), carga.getCitycode()).get(0); + if (ciudadTmp != null) { + carga.getModifiedData().put("cityCode", ciudadTmp.getDescription()); + } + + lrecord = ArmasController.findxRegistro(registro.getPk().toString()); + if (lrecord == null) { + this.lrecord = new ArrayList(); + } + + } + + /** + * Método en el cual se determina si se bloquea unidad o cantidad al + * momento de cargar los datos del arma + * + * @param clase + */ + private void verificarClaseArma() { + if (tipoArmaExplosivo != null) { + TgeneCatalogDetail unidadesCatalog = CatalogDetailController.findCatalogo(tipoArmaExplosivo.getUnidadmedidapesocodigo(), tipoArmaExplosivo.getUnidadmedidapeso()); + if (unidadesCatalog != null && unidadesCatalog.getLegalcode().equals("CANTIDAD")) { + this.record.getModifiedData().put("unidadMedidaCantidad", tipoArmaExplosivo.getUnidadmedidapeso()); + this.record.getModifiedData().put("unidadMedidaPeso", null); + this.bloquearUnidadCantidad = Boolean.FALSE; + this.bloquearUnidadPeso = Boolean.TRUE; + this.record.setPeso(null); + } else if (unidadesCatalog != null && unidadesCatalog.getLegalcode().equals("PESO")) { + this.record.getModifiedData().put("unidadMedidaCantidad", null); + this.record.getModifiedData().put("unidadMedidaPeso", tipoArmaExplosivo.getUnidadmedidapeso()); + this.bloquearUnidadCantidad = Boolean.TRUE; + this.bloquearUnidadPeso = Boolean.FALSE; + this.record.setCantidad(null); + } else { + this.record.getModifiedData().put("unidadMedidaCantidad", null); + this.record.getModifiedData().put("unidadMedidaPeso", null); + this.bloquearUnidadCantidad = Boolean.TRUE; + this.bloquearUnidadPeso = Boolean.TRUE; + } + } + } + + /** + * Abre el LOV de la longitud del arma + */ + public void openLovLongitud() { + Map> params = new HashMap>(); + LongitudLovController.openLov(params); + } + + /** + * Regresa del LOV de longitud + * + * @param event + */ + public void onReturnLongitud(SelectEvent event) { + TgeneCatalogDetail longitud = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("longitud", longitud.getDescription()); + this.longitud = longitud.getPk().getCatalog(); + } + + /** + * Abre el LOV del tipo de arma + */ + public void openLovTipoArma() { + Map> params = new HashMap>(); + TipoArmaExpLovController.openLov(params); + } + + /** + * Regresa del LOV de tipo de arma + * + * @param event + */ + public void onReturnTipoArma(SelectEvent event) { + TgeneCatalogDetail tipoArma = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("tipoarmaexplosivo", tipoArma.getDescription()); + this.tipoarma = tipoArma.getPk().getCatalog(); + } + + /** + * Abre el LOV de Calibre + */ + public void openLovCalibre() { + Map> params = new HashMap>(); + CalibreLovController.openLov(params); + } + + /** + * Regresa del LOV del calibre + * + * @param event + */ + public void onReturnCalibre(SelectEvent event) { + TgeneCatalogDetail calibre = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("calibre", calibre.getDescription()); + this.calibre = calibre.getPk().getCatalog(); + } + + /** + * Abre el LOV cambio de usuario + */ + public void openLovCambioUsuario() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Acción de retorno de la selección del usuario + * + * @param event de retorno de la selección + */ + public void onReturnCambioUsuario(SelectEvent event) { + nuevoPropietarioArma = (TcustPersonDetail) event.getObject(); + } + + /** + * Abre el dialog del cambio de persona + */ + public void abrirDialogCambio() { + this.nuevoPropietarioArma = null; + } + + /** + * Se cambia el propietario del arma + */ + public void cambiarArmaUsuario() { + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.setTransactionModule("30"); + request.setTransactionCode(151); + request.setTransactionVersion(1); + request.put("ARMAACTUAL", this.record); + request.put("NUEVAPERSONA", this.nuevoPropietarioArma); + Response response = callerHelper.executeSave(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(response); + this.querydatabase(); + } else { + MessageHelper.setMessageError(response); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Carga las listas de cantones y limpia la lista de ciudades + */ + public void seleccionarProvincia() { + try { +// codigoProvincia=this.record.getProvincecode(); + lcantones = CantonController.find("EC", carga.getProvincecode()); + lciudades = new ArrayList<>(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Carga las listas de ciudades + */ + public void seleccionarCanton() { + try { +// codigoCanton = this.record.getCantoncode(); + lciudades = CityController.find("EC", carga.getProvincecode(), carga.getCantoncode()); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if (Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")) { + valorColocar = Boolean.TRUE; + } + for (TarmArmas guardias : lrecord) { + guardias.getModifiedData().put("seleccionado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para obtener el listado de las armas por la serie/lote + * + * @param serieLote + * @return + */ + public static List findxSerieLote(String serieLote) { + try { + ImportacionProduccionController cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 1000; + cc.addFilter("lote", serieLote); + cc.querydatabaseFechaMax(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para obtener los codigos + */ + private static String codigos(String parametro) { + TgeneParameters tgeneParameters = ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + @SuppressWarnings("unchecked") + protected void querydatabaseFechaMax() { + try { + DtoQuery dto = this.getDtoQuery(); + dto.setOrderby("pk"); + String codigoEstadoIncautada = codigos("CODIGO.INCAUTADA"); + String codigoEstadoDecomisada = codigos("CODIGO.DECOMISADA"); + String codigoEstadoVendida = codigos("CODIGO.VENDIDA"); + String codigoEstadoMatPrima = codigos("CODIGO.MATERIAPRIMA"); + Filter filtro = new Filter(); + String sql = "t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro)"//and t.cregistro=ta.cregistro para el manejo de los explosivos + + " and t.estado !='DEST' and t.estado !='CDP' and t.estado !='" + codigoEstadoIncautada + "' and t.estado !='" + codigoEstadoDecomisada + "' and t.estado !='" + codigoEstadoVendida + "' and t.estado !='" + codigoEstadoMatPrima + "' "; + filtro.setSql(sql); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void actualizar(TarmArmas arma) throws Exception { + record = arma; + super.update(); + } + + /*Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findxCodigo(String armaCode) { + try { + + ImportacionProduccionController cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + cc.querydatabaseArmas(); + cc.getRecord().getModifiedData().put("lmarca", cc.getLmarca()); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public TiposArmasExplosivosController getTiposArmasExplosivosController() { + return tiposArmasExplosivosController; + } + + public void setTiposArmasExplosivosController( + TiposArmasExplosivosController tiposArmasExplosivosController) { + this.tiposArmasExplosivosController = tiposArmasExplosivosController; + } + + public RegistroArmController getRegistroArmas() { + return registroArmas; + } + + public void setRegistroArmas(RegistroArmController registroArmas) { + this.registroArmas = registroArmas; + } + +// public List getLtipoidentificacion() { +// return ltipoidentificacion; +// } +// +// +// public void setLtipoidentificacion(List ltipoidentificacion) { +// this.ltipoidentificacion = ltipoidentificacion; +// } +// +// +// public String getTipoDoc() { +// return tipoDoc; +// } +// +// +// public void setTipoDoc(String tipoDoc) { +// this.tipoDoc = tipoDoc; +// } +// public String getNumDoc() { +// return numDoc; +// } +// +// +// public void setNumDoc(String numDoc) { +// this.numDoc = numDoc; +// } +// public String getNombreRazon() { +// return nombreRazon; +// } +// +// +// public void setNombreRazon(String nombreRazon) { +// this.nombreRazon = nombreRazon; +// } + public List getLestadoarma() { + return lestadoarma; + } + + public void setLestadoarma(List lestadoarma) { + this.lestadoarma = lestadoarma; + } + + public List getLmarca() { + return lmarca; + } + + public void setLmarca(List lmarca) { + this.lmarca = lmarca; + } + + public List getLcolor() { + return lcolor; + } + + public void setLcolor(List lcolor) { + this.lcolor = lcolor; + } + + public List getLtipofabricacion() { + return ltipofabricacion; + } + + public void setLtipofabricacion(List ltipofabricacion) { + this.ltipofabricacion = ltipofabricacion; + } + +// public List getLcountry() { +// return lcountry; +// } +// +// +// public void setLcountry(List lcountry) { +// this.lcountry = lcountry; +// } + public List getLunidadmedidacantidad() { + return lunidadmedidacantidad; + } + + public void setLunidadmedidacantidad( + List lunidadmedidacantidad) { + this.lunidadmedidacantidad = lunidadmedidacantidad; + } + + public String getLongitud() { + return longitud; + } + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + public String getCalibre() { + return calibre; + } + + public void setCalibre(String calibre) { + this.calibre = calibre; + } + + public String getClase() { + return clase; + } + + public void setClase(String clase) { + this.clase = clase; + } + + public String getTipoarma() { + return tipoarma; + } + + public void setTipoarma(String tipoarma) { + this.tipoarma = tipoarma; + } + + public String getUnidadmedidapeso() { + return unidadmedidapeso; + } + + public void setUnidadmedidapeso(String unidadmedidapeso) { + this.unidadmedidapeso = unidadmedidapeso; + } + + public List getLunidadmedidapeso() { + return lunidadmedidapeso; + } + + public void setLunidadmedidapeso(List lunidadmedidapeso) { + this.lunidadmedidapeso = lunidadmedidapeso; + } + + public List getLprovincias() { + return lprovincias; + } + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public List getLparroquias() { + return lparroquias; + } + + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + public List getLcities() { + return lcities; + } + + public void setLcities(List lcities) { + this.lcities = lcities; + } + + public boolean isExisteTipoArmaExplosivo() { + return existeTipoArmaExplosivo; + } + + public void setExisteTipoArmaExplosivo(boolean existeTipoArmaExplosivo) { + this.existeTipoArmaExplosivo = existeTipoArmaExplosivo; + } + + public boolean isVerificaArmaExplosivo() { + return verificaArmaExplosivo; + } + + public void setVerificaArmaExplosivo(boolean verificaArmaExplosivo) { + this.verificaArmaExplosivo = verificaArmaExplosivo; + } + + public boolean isBloquearUnidadCantidad() { + return bloquearUnidadCantidad; + } + + public void setBloquearUnidadCantidad(boolean bloquearUnidadCantidad) { + this.bloquearUnidadCantidad = bloquearUnidadCantidad; + } + + public boolean isBloquearUnidadPeso() { + return bloquearUnidadPeso; + } + + public void setBloquearUnidadPeso(boolean bloquearUnidadPeso) { + this.bloquearUnidadPeso = bloquearUnidadPeso; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public TarmTipoArmaExplosivo getTipoArmaExplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoArmaExplosivo(TarmTipoArmaExplosivo tipoArmaExplosivo) { + this.tipoArmaExplosivo = tipoArmaExplosivo; + } + + protected void querydatabaseArmas() { + try { + DtoQuery dto = this.getDtoQuery(); + + dto.setOrderby("pk"); + if (this.getMfilelds().get("ESTADOS") != null) { + Filter filtroEstados = new Filter(); + String[] estados = this.getMfilelds().get("ESTADOS").toString().split(","); + StringBuffer sqlEstados = new StringBuffer(" t.estado IN ("); + for (int i = 0; i < estados.length; i++) { + sqlEstados.append("'").append(estados[i]).append("'"); + if (i < estados.length - 1) { + sqlEstados.append(","); + } + } + sqlEstados.append(")"); + filtroEstados.setSql(sqlEstados.toString()); + dto.addFiltro(filtroEstados); + } else { + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql = " t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + } + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public TcustPersonDetail getNuevoPropietarioArma() { + return nuevoPropietarioArma; + } + + public void setNuevoPropietarioArma(TcustPersonDetail nuevoPropietarioArma) { + this.nuevoPropietarioArma = nuevoPropietarioArma; + } + + /** + * Busca un arma por código + * + * @param armaCode + * @return + */ + public static TarmArmas findXCodigoArma(String armaCode) { + try { + ImportacionProduccionController cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("codigoarma", armaCode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + @SuppressWarnings("unchecked") + public void querydatabasesimple() { + try { + DtoQuery dto = this.getDtoQuery(); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void querydatabaseArmaDuplicada(TarmArmas armaObj) { + try { + DtoQuery dto = this.getDtoQuery(); + + Filter filtro = new Filter(); + filtro.setSql("t.marca='" + armaObj.getMarca() + "' and t.marcacodigo='" + armaObj.getMarcacodigo() + "' and upper(t.lote)='" + armaObj.getLote().toUpperCase() + "'"); + dto.addFiltro(filtro); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static TarmArmas findSimple(String carma) { + try { + ImportacionProduccionController cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", carma); + cc.querydatabasesimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static Boolean isArmaDuplicada(TarmArmas armaObj) { + Boolean isDuplicada = Boolean.FALSE; + ImportacionProduccionController cc; + try { + cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabaseArmaDuplicada(armaObj); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + for (TarmArmas armaTmp : cc.lrecord) { + TarmTipoArmaExplosivo tipoArmaExpTmp = TiposArmasExplosivosController.findarma(armaTmp.getCtipoarmaexplosivo()); + TgeneCatalogDetail claseTmp = CatalogDetailController.findCatalogo(tipoArmaExpTmp.getClasecodigo(), tipoArmaExpTmp.getClase()); + TgeneCatalogDetail tipoArmaTmp = CatalogDetailController.findCatalogo(tipoArmaExpTmp.getTipoarmaexplosivocodigo(), tipoArmaExpTmp.getTipoarmaexplosivo()); + TgeneCatalogDetail calibreTmp = CatalogDetailController.findCatalogo(tipoArmaExpTmp.getCalibrecodigo(), tipoArmaExpTmp.getCalibre()); + // Valido la clase, tipoarma y calibre solo para armas de fuego y armas no letales + if (claseTmp.getPk().getCatalog().equals("0010000001") || claseTmp.getPk().getCatalog().equals("0010000008")) { + if (armaObj.getModifiedData().get("clase") != null && armaObj.getModifiedData().get("tipoarmaexplosivo") != null) { + if (armaObj.getModifiedData().get("clase").toString().equalsIgnoreCase(claseTmp != null ? claseTmp.getDescription() : "") + && armaObj.getModifiedData().get("tipoarmaexplosivo").toString().equalsIgnoreCase(tipoArmaTmp != null ? tipoArmaTmp.getDescription() : "")) { + if (armaObj.getModifiedData().get("calibre") != null && calibreTmp != null && armaObj.getModifiedData().get("calibre").toString().equalsIgnoreCase(calibreTmp.getDescription())) { + isDuplicada = Boolean.TRUE; + break; + } + } + } else { + MessageHelper.setMessageError("CLASE Y/O TIPO DE ARMA EXPLOSIVO INCORRECTOS"); + } + } + } + + } + return isDuplicada; + } catch (Exception e) { + // TODO Auto-generated catch block + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmArmas find(String carma) { + try { + + ImportacionProduccionController cc = new ImportacionProduccionController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", carma); + cc.querydatabasesimple(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if (tarmTipoArmaExplosivo != null) { + if (tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null) { + cc.record.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription() : ""); + } + if (tarmTipoArmaExplosivo.getTipoarmaexplosivo() != null && tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo() != null) { + cc.record.modifiedData().put("tipo", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription() : ""); + } + if (tarmTipoArmaExplosivo.getClase() != null && tarmTipoArmaExplosivo.getClasecodigo() != null) { + cc.record.modifiedData().put("clase", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription() : ""); + } + TarmRegistroArmas registroArmas = new TarmRegistroArmas(); + TcustPersonDetail detallePersona = new TcustPersonDetail(); + if (cc.record.getCregistro() != null) { + registroArmas = RegistroArmController.findByCodigo(String.valueOf(cc.record.getCregistro())); + if (registroArmas != null) { + detallePersona = PersonDetailController.find(String.valueOf(registroArmas.getPersoncode())); + } + } + cc.record.modifiedData().put("razonsPropietario", registroArmas == null || detallePersona == null ? "" : detallePersona.getName()); + cc.record.modifiedData().put("documentoPropietario", registroArmas == null || detallePersona == null ? "" : detallePersona.getIdentification()); + cc.record.modifiedData().put("marca", (cc.record == null || cc.record.getMarca() == null || cc.record.getMarca().isEmpty() || cc.record.getMarcacodigo() == null || cc.record.getMarcacodigo().isEmpty()) ? "" : CatalogDetailController.findxCodigoCodcatalogo(cc.record.getMarca(), cc.record.getMarcacodigo()).getDescription()); + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public TgeneCatalogDetail getTipoDocumento() { + return tipoDocumento; + } + + public void setTipoDocumento(TgeneCatalogDetail tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } + + public TcustPersonDetail getDetallesPersona() { + return detallesPersona; + } + + public void setDetallesPersona(TcustPersonDetail detallesPersona) { + this.detallesPersona = detallesPersona; + } + + public List getTiposRegistro() { + return tiposRegistro; + } + + public void setTiposRegistro(List tiposRegistro) { + this.tiposRegistro = tiposRegistro; + } + + public TcustPersonDetail getUsuario() { + return usuario; + } + + public void setUsuario(TcustPersonDetail usuario) { + this.usuario = usuario; + } + + public List getLdocumentospersona() { + return ldocumentospersona; + } + + public void setLdocumentospersona( + List ldocumentospersona) { + this.ldocumentospersona = ldocumentospersona; + } + +// public TarmRegistroArmas getRegistro() { +// return registro; +// } +// +// public void setRegistro(TarmRegistroArmas registro) { +// this.registro = registro; +// } + public List getLpaises() { + return lpaises; + } + + public void setLpaises(List lpaises) { + this.lpaises = lpaises; + } + + public List getLciudades() { + return lciudades; + } + + public void setLciudades(List lciudades) { + this.lciudades = lciudades; + } + + public List getLaeropuertos() { + return laeropuertos; + } + + public void setLaeropuertos(List laeropuertos) { + this.laeropuertos = laeropuertos; + } + + public String getCodigoProvincia() { + return codigoProvincia; + } + + public void setCodigoProvincia(String codigoProvincia) { + this.codigoProvincia = codigoProvincia; + } + + public String getCodigoCanton() { + return codigoCanton; + } + + public void setCodigoCanton(String codigoCanton) { + this.codigoCanton = codigoCanton; + } + + public TarmRegistroArmas getRegistro() { + return registro; + } + + public void setRegistro(TarmRegistroArmas registro) { + this.registro = registro; + } + + public String getCategoria() { + return categoria; + } + + public void setCategoria(String categoria) { + this.categoria = categoria; + } + + public Boolean getEstadoDesaduanizado() { + return estadoDesaduanizado; + } + + public void setEstadoDesaduanizado(Boolean estadoDesaduanizado) { + this.estadoDesaduanizado = estadoDesaduanizado; + } + + public Boolean getEsNuevaImportacion() { + return esNuevaImportacion; + } + + public void setEsNuevaImportacion(Boolean esNuevaImportacion) { + this.esNuevaImportacion = esNuevaImportacion; + } + + public String getFilterAUCP() { + return filterAUCP; + } + + public void setFilterAUCP(String filterAUCP) { + this.filterAUCP = filterAUCP; + } + + public TarmCarga getCarga() { + return carga; + } + + public void setCarga(TarmCarga carga) { + this.carga = carga; + } + + public Boolean getIsSelectAucpPrevio() { + return isSelectAucpPrevio; + } + + public void setIsSelectAucpPrevio(Boolean isSelectAucpPrevio) { + this.isSelectAucpPrevio = isSelectAucpPrevio; + } + + public Boolean getIsSave() { + return isSave; + } + + public void setIsSave(Boolean isSave) { + this.isSave = isSave; + } + + public InputNumber getCantidadTxt() { + return cantidadTxt; + } + + public void setCantidadTxt(InputNumber cantidadTxt) { + this.cantidadTxt = cantidadTxt; + } + + public List getLpartidaArancelaria() { + return lpartidaArancelaria; + } + + public void setLpartidaArancelaria(List lpartidaArancelaria) { + this.lpartidaArancelaria = lpartidaArancelaria; + } + + public Boolean getIsEnableCategoria() { + return isEnableCategoria; + } + + public void setIsEnableCategoria(Boolean isEnableCategoria) { + this.isEnableCategoria = isEnableCategoria; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ImprimirVerificacionReimpresionController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ImprimirVerificacionReimpresionController.java new file mode 100644 index 0000000..22f8c6c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ImprimirVerificacionReimpresionController.java @@ -0,0 +1,444 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.event.AjaxBehaviorEvent; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ImprimirVerificacionReimpresionController extends AbstractController { + + /* + * Variable para verificar seleccion de documento + */ + private Boolean verifica = false; + /* + * Variable para habilitar documentos a imprimir + */ + private Boolean habimprimir = Boolean.TRUE; + /* + * Variable que coloca en verdadero o en falso. + */ + private Boolean valorColocar = Boolean.FALSE; + /* + * Hailita el boton del flujo + */ + private Boolean btnFlujo = Boolean.FALSE; + /* + * Bean del tipo TarmSolicitud + */ + TarmSolicitud solic = new TarmSolicitud(); + /* + * Variable que almacena el codigo de la solicitud + */ + private String csolicitud; + + @ManagedProperty(value = "#{solicitudController}") + private SolicitudController solicitudController; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * Constructor + * + * @throws Exception + */ + public ImprimirVerificacionReimpresionController() throws Exception { + super(TarmSolicitudDocumento.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + try { + this.pasteBpmScreenParameters(); + super.startQuery(); + + if (super.getMfilters().get("csolicitud") == null || super.getMfilters().get("csolicitud").isEmpty()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_noexistesolicitud")); + return; + } + + csolicitud = super.getMfilters().get("csolicitud"); + this.getMfilters().clear(); + //this.getMfilters().put("pk.csolicitud", csolicitud); + solic = SolicitudController.findSolicitudxcodsolicitud(csolicitud); + this.getMfilelds().put("numerosolicitud", solic.getNumerosolicitud()); + // Inicializa autoconsulta + this.init(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "VERIFICARDOCUMENTOS"; + querydatabase(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + Filter filtroSinImpresionSolicitud = new Filter(); + filtroSinImpresionSolicitud.setSql("t.chkimpresion='Y' and t.pk.csolicitud = '" + solic.getPk() + "'"); + dto.addFiltro(filtroSinImpresionSolicitud); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + SubQuery qry = new SubQuery("TarmSolicitud", "ccentrocontrol", "ccentrocontrol", "i.pk = t.pk.csolicitud"); + dto.addSubQuery(qry); + SubQuery qry2 = new SubQuery("TgeneCatalogDetail", "description", "tramitedesc", + "i.pk.catalog = (select a.tipotramite from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento))) "// t.pk.csolicitud + + " and " + + "i.pk.catalogcode = (select a.tipotramitecodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))"); + dto.addSubQuery(qry2); + SubQuery qry3 = new SubQuery("TgeneCatalogDetail", "description", "categoriadesc", + "i.pk.catalog = (select a.categoria from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))" + + " and " + + "i.pk.catalogcode = (select a.categoriacodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))"); + dto.addSubQuery(qry3); + SubQuery qry4 = new SubQuery("TgeneCatalogDetail", "description", "usoactdesc", + "i.pk.catalog = (select a.usoactividad from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))" + + " and " + + "i.pk.catalogcode = (select a.usoactividadcodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))"); + dto.addSubQuery(qry4); + SubQuery qry42 = new SubQuery("TgeneCatalogDetail", "description", "tipoautodesc", + "i.pk.catalog = (select a.tipoautorizacion from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))" + + " and " + + "i.pk.catalogcode = (select a.tipoautorizacioncodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))"); + dto.addSubQuery(qry42); + + //ubicacion + SubQuery qryUbicacion = new SubQuery("TgeneProvince", "description", "ubicaciondesc", + "i.pk.countrycode = 'EC'" + + " and " + + "i.pk.provincecode = (select a.provincecode from TcustPersonAddress a where a.pk.personcode =(select o.personcode from TarmDocumentoHabilitante o where o.pk= t.pk.cdocumento )" + + " and a.principal='Y'" + + " and a.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD') )");// + dto.addSubQuery(qryUbicacion); + //TarmSolicitudDocumento + + SubQuery qry5 = new SubQuery("TarmDocumentoHabilitante", "fechaemision", "fechaemision", "i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry5); + SubQuery qry6 = new SubQuery("TarmDocumentoHabilitante", "fechaexpiracion", "fechaexpiracion", "i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry6); + SubQuery qry61 = new SubQuery("TarmDocumentoHabilitante", "estado ", "estado1", "i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry61); + SubQuery qry611 = new SubQuery("TarmDocumentoHabilitante", "estadocode ", "estado11", "i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry611); + SubQuery qry7 = new SubQuery("TgeneCatalogDetail", "description", "estado", + "i.pk.catalog = (select a.estado from TarmDocumentoHabilitante a where a.pk= t.pk.cdocumento) and " + + "i.pk.catalogcode = (select a.estadocode from TarmDocumentoHabilitante a where a.pk= t.pk.cdocumento)"); + dto.addSubQuery(qry7); + SubQuery qry8 = new SubQuery("TarmDocumentoHabilitante", "carma", "carma", "i.pk = t.pk.cdocumento and i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry8); + SubQuery qry9 = new SubQuery("TarmDocumentoHabilitante", "codigoarma", "codigoarma", "i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry9); + SubQuery qry10 = new SubQuery("TgeneCatalogDetail", "description", "tipoautorizacion", + "i.pk.catalog = (select a.tipoautorizacion from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud)) and " + + "i.pk.catalogcode = (select a.tipoautorizacioncodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud))"); + dto.addSubQuery(qry10); + + SubQuery qry11 = new SubQuery("TarmDocumentoHabilitante", "xpath", "xpath", "i.pk = t.pk.cdocumento "); + dto.addSubQuery(qry11); + /* Filter seleccionados = new Filter(); + seleccionados.setSql("chkimpresion = 'Y'"); + dto.getLfilter().add(seleccionados);*/ + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + request.put("querytype", "P"); + request.put("queryalias", "VDOCUMENTO"); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + this.completaArmas(); + super.postQuery(this.lrecord); + lista(); + + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Verifica la selección del documento según el check de + * reimpresión + */ + public void lista() { + for (TarmSolicitudDocumento solicituddoc : lrecord) { + if (solicituddoc.getChkimpresion().equals("Y")) { + solicituddoc.getModifiedData().put("verificador", Boolean.TRUE); + } else { + solicituddoc.getModifiedData().put("verificador", Boolean.FALSE); + } + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + this.actualizaVerificado(); + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + /*if(!dtosave.pendingProcess()){ + return; + }*/ + + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + btnFlujo = true; + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Selecciona los registros para establecer si el registro se reimprime o + * no. + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + + if (Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")) { + this.valorColocar = Boolean.TRUE; + } else { + this.valorColocar = Boolean.FALSE; + } + for (TarmSolicitudDocumento solicituddoc : lrecord) { + solicituddoc.getModifiedData().put("verificado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que verifica la eleccion del check + */ + public void verificar() { + for (TarmSolicitudDocumento solicituddoc : lrecord) { + if (solicituddoc.getChkimpresion() == "Y") { + this.verifica = true; + } else { + this.verifica = false; + } + } + } + + /** + * Método que actualiza la elección del check + * + * @throws Exception + */ + public void actualizaVerificado() throws Exception { + for (TarmSolicitudDocumento solicituddoc : lrecord) { + if (solicituddoc.getModifiedData().get("verificado").equals(Boolean.TRUE)) { + solicituddoc.setVerificado("Y"); + } else { + solicituddoc.setVerificado("N"); + } + record = solicituddoc; + super.update(); + } + } + + /** + * Método que habilita el botón imprimir según check + * seleccionado + * + * @param event + */ + public void habilitaImprimir(AjaxBehaviorEvent event) { + try { + if (Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")) { + this.habimprimir = Boolean.FALSE; + } else { + this.habimprimir = Boolean.TRUE; + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método que completa la información del arma para los + * registros de la tabla TarmSolicitudDocumento + */ + public void completaArmas() { + for (int i = 0; i < this.lrecord.size(); i++) { + if (lrecord.get(i).getModifiedData().get("carma") != null) { + TarmArmas arm = ArmasController.findxCodigo(lrecord.get(i).getModifiedData().get("carma").toString()); + try { + lrecord.get(i).getModifiedData().put("clasearma", arm.modifiedData.get("clase") == null ? "" : arm.modifiedData.get("clase").toString()); + } catch (Exception e) { + e.printStackTrace(); + } + try { + lrecord.get(i).getModifiedData().put("tipoarma", arm.modifiedData.get("tipo") == null ? "" : arm.modifiedData.get("tipo").toString()); + } catch (Exception e) { + e.printStackTrace(); + } + try { + lrecord.get(i).getModifiedData().put("marcaarma", arm.modifiedData.get("marca") == null ? "" : arm.modifiedData.get("marca").toString()); + } catch (Exception e) { + e.printStackTrace(); + } + try { + lrecord.get(i).getModifiedData().put("calibrearma", arm.modifiedData.get("calibre") == null ? "" : arm.modifiedData.get("calibre").toString()); + } catch (Exception e) { + e.printStackTrace(); + } + try { + lrecord.get(i).getModifiedData().put("seriearma", arm.modifiedData.get("lote") == null ? "" : arm.modifiedData.get("lote").toString()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + } + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + //request.modifiedData().put("csolicitud", this.solicitud.getPk()); + request.modifiedData().put("TID", tid); + + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); + + // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + btnFlujo = Boolean.FALSE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public Boolean getHabimprimir() { + return habimprimir; + } + + public void setHabimprimir(Boolean habimprimir) { + this.habimprimir = habimprimir; + } + + public Boolean getVerifica() { + return verifica; + } + + public void setVerifica(Boolean verifica) { + this.verifica = verifica; + } + + public SolicitudController getSolicitudController() { + return solicitudController; + } + + public void setSolicitudController(SolicitudController solicitudController) { + this.solicitudController = solicitudController; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public void verifica() { + System.out.println("RECORD " + this.record); + } + + public Boolean getValorColocar() { + return valorColocar; + } + + public void setValorColocar(Boolean valorColocar) { + this.valorColocar = valorColocar; + } + + public Boolean getBtnFlujo() { + return btnFlujo; + } + + public void setBtnFlujo(Boolean btnFlujo) { + this.btnFlujo = btnFlujo; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/IngresoFichaTecnicaArmasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/IngresoFichaTecnicaArmasController.java new file mode 100644 index 0000000..a4af2a0 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/IngresoFichaTecnicaArmasController.java @@ -0,0 +1,1341 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.ArmaController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmaPruebas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import org.openide.util.Exceptions; + +/** + * + * Controlador que administra la ficha tecnica de armas + * + * @author Carlos Guzman + * + */ +@ManagedBean +@ViewScoped +public class IngresoFichaTecnicaArmasController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 8843091476010012919L; + + /** + * Controlador que maneja alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * Controlador que maneja reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{armasController}") + private ArmasController armas; + + private TarmArmas arma = new TarmArmas(); + + private String editarReg; + + private String codigoSolicitud; + + private boolean habilitaButtom; + + private TarmCentroControl centroControl = new TarmCentroControl(); + + private List listadoArmasPruebas = new ArrayList<>(); + + private String observacion; + + private String estado; + + private Date fec_actual; + + private String formato; + + private String xpathflujo; + + private TcustPersonDetail responsableCentroControl = null; + + private TsafeUserDetail tsafeUserDetailUsuario = null; + + private Boolean btnFlujo; + + private List tarmArmaPruebasList; + /** + * lista del catalogo de las acciones (Aceptar o rechazar) + */ + private List laccion; + + private boolean deshabilitadoGenerarReporte = true; + + private TarmSolicitud solicitud; + private TarmSolicitudTramite solicitudTramite; + private TarmTramite tramite; + private TcustPersonAddress direccionCliente; + private String provincia; + private String canton; + private String ciudad; + private String direccion; + private TgeneCatalogDetail estadotramite; + private TgeneCatalogDetail usoActividad; + private TcustPersonDetail personaDetalle; + private TgeneCatalogDetail identificacion; + private TgeneCatalogDetail detallecatalogoTipoTramite; + private TgeneCatalogDetail detallecatalogo; + /** + * * + * Bandera para saber el tramite seleccionano, NOLETAL,COLECCION,.. + * + * @throws Exception + */ + private String tramiteingresado; + + public IngresoFichaTecnicaArmasController() throws Exception { + super(TarmArmaPruebas.class); + } + + @PostConstruct + private void postconstruct() { + System.out.println("postconstruct"); + try { + startQuery(); + this.init(); + laccion = CatalogDetailController.find("ACCION"); + if (codigoSolicitud != null) { + caragarArmas(); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + + } + } + + public void startQuery() { + System.out.println("startQuery"); + try { + this.pasteBpmScreenParameters(); + codigoSolicitud = super.getMfilters().get("csolicitud");//"1012";//2656 + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + private void init() { + System.out.println("init"); + recperpage = 3000; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "INGRESOFICHAARMAS"; + try { + if (this.obtenerCentroControl() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sin_centrocontrol")); + return; + } + + solicitud = SolicitudController.findSolicitudxcodsolicitud(codigoSolicitud); + //VALIDA EL tramite seleccionado + this.validarTramite(); + solicitudTramite = SolicitudTramiteController.findByCSolicitud(codigoSolicitud); + tramite = TarmTramiteController.find(solicitud.getCtramite() + ""); + direccionCliente = PersonAddressController.find(String.valueOf(solicitud.getPersoncode())); + provincia = direccionCliente.modifiedData().get("provincia") == null ? null : direccionCliente.modifiedData().get("provincia").toString(); //personAddressController.getLprovinces()==null || .getLprovinces().isEmpty()?null:personAddressController.getLprovinces().get(0); + canton = direccionCliente.modifiedData().get("canton") == null ? null : direccionCliente.modifiedData().get("canton").toString();//personAddressController.getLcantones()==null || personAddressController.getLcantones().isEmpty()?null:personAddressController.getLcantones().get(0); + ciudad = direccionCliente.modifiedData().get("ciudad") == null ? null : direccionCliente.modifiedData().get("ciudad").toString();//personAddressController.getLcities()==null || personAddressController.getLcities().isEmpty()?null:personAddressController.getLcities().get(0); + direccion = direccionCliente.getAddress(); + estadotramite = (solicitudTramite.getEstadotramite() == null || solicitudTramite.getEstadotramitecodigo() == null) ? null : CatalogDetailController.findxCodigoCodcatalogo(solicitudTramite.getEstadotramite(), solicitudTramite.getEstadotramitecodigo()); + usoActividad = (tramite.getUsoactividad() == null || tramite.getUsoactividadcodigo() == null) ? null : CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + personaDetalle = PersonDetailController.find(String.valueOf(solicitud.getPersoncode())); + identificacion = (personaDetalle.getIdentificationcatalog() == null || personaDetalle.getIdentificationcatalogcode() == null) ? null : CatalogDetailController.findxCodigoCodcatalogo(personaDetalle.getIdentificationcatalog(), personaDetalle.getIdentificationcatalogcode()); + detallecatalogoTipoTramite = (tramite.getTipoautorizacion() == null || tramite.getTipoautorizacioncodigo() == null) ? null : CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + detallecatalogo = (tramite.getCategoria() == null || tramite.getCategoriacodigo() == null) ? null : CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + + record = new TarmArmaPruebas(); + this.fec_actual = new Date(); + this.habilitaButtom = true; + this.responsableCentroControl = new TcustPersonDetail(); + this.responsableCentroControl = new TcustPersonDetail(); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + this.obtenerResponsableCentroControl(); + btnFlujo = Boolean.FALSE; + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void validarTramite() { + tramiteingresado = "OTROS"; + TgeneParameters parametrofichanoletal = ParametersController.find("CODIGO.FICHANOLETAL", "1"); + if (parametrofichanoletal != null && parametrofichanoletal.getTextvalue() != null && !parametrofichanoletal.getTextvalue().trim().isEmpty()) { + String[] arrayCodTramite = parametrofichanoletal.getTextvalue().split(","); + List listaCodTraite = Arrays.asList(arrayCodTramite); + for (String item : listaCodTraite) { + Long codigotramite = Long.parseLong(item); + if (solicitud.getCtramite().equals(codigotramite) || codigotramite.longValue() == solicitud.getCtramite().longValue()) { + tramiteingresado = "NOLETAL"; + } + } + } + TgeneParameters parametrofichacoleccion = ParametersController.find("CODIGO.FICHACOLECCION", "1"); + if (parametrofichacoleccion != null && parametrofichacoleccion.getTextvalue() != null && !parametrofichacoleccion.getTextvalue().trim().isEmpty()) { + String[] arrayCodTramite = parametrofichacoleccion.getTextvalue().split(","); + List listaCodTraite = Arrays.asList(arrayCodTramite); + for (String item : listaCodTraite) { + Long codigotramite = Long.parseLong(item); + if (solicitud.getCtramite().equals(codigotramite) || codigotramite.longValue() == solicitud.getCtramite().longValue()) { + tramiteingresado = "COLECCION"; + } + } + } + } + + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + private void querydatabaseArma() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void caragarArmas() { + try { + List listaSolicitudArmas = RecepcionArmasController.findPorSolicitudTodas(codigoSolicitud); + tarmArmaPruebasList = new ArrayList<>(); + for (TarmSolicitudArmas solicitudArmas : listaSolicitudArmas) { + TarmArmaPruebas armaPrueba = find(codigoSolicitud, solicitudArmas.getPk().getCarma()); + if (armaPrueba != null) { + armaPrueba.getModifiedData().put("tarmArmarecordPruebas", armaPrueba); + // + TarmArmas tarmArma = ArmasController.find(solicitudArmas.getPk().getCarma(), null); + armaPrueba.modifiedData().put("arma", tarmArma != null ? tarmArma : new TarmArmas()); + armaPrueba.modifiedData().put("impresion", Boolean.FALSE); + tarmArmaPruebasList.add(armaPrueba); + } else { + this.create(); + record.getModifiedData().put("tarmArmaPruebas", armaPrueba); + this.record.setCarma(solicitudArmas.getPk().getCarma()); + this.record.setCsolicitud(codigoSolicitud); + this.record.setPersoncode(solicitudArmas.getPk().getPersoncode()); + this.record.isnew = true; + // + TarmArmas tarmArma = ArmasController.find(solicitudArmas.getPk().getCarma(), null); + record.modifiedData().put("arma", tarmArma != null ? tarmArma : new TarmArmas()); + record.modifiedData().put("impresion", Boolean.FALSE); + tarmArmaPruebasList.add(record); + } + } + } catch (Throwable e) { + e.printStackTrace(); + } + } + + @Override + public void save() { + try { + if (cargarArchivo()) { + return; + } + // Validacion para cambio de estado de arma a estado aprobada + TarmArmas tarmArmaObj = ArmasController.find(record.getCarma(), null); + if (record.getApruebaevaluacion().equals("Y")) { + String estadoarma = "APTA"; + System.out.println("solicitud.getCtramite() " + solicitud.getCtramite()); + if (tramiteingresado != null && !tramiteingresado.trim().isEmpty() && tramiteingresado.equals("COLECCION")) { + estadoarma = "COLE"; + } + tarmArmaObj.setEstado(estadoarma); + if (armas.getMfilters().get("csolicitud") != null) { + armas.getMfilters().remove("csolicitud"); + } + armas.update(tarmArmaObj); + armas.save(); + } else if (record.getApruebaevaluacion().equals("N")) { + tarmArmaObj.setEstado("NAPT"); + armas.update(tarmArmaObj); + armas.save(); + } + + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + request.setSaveTables(msave); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + dtosave.setPosition(2); + msave.put(beanalias, dtosave); + request.setSaveTables(msave); + + DtoSave dtoSaveArma = armas.getDtoSave(); + dtoSaveArma.setIsForm(Boolean.TRUE); + dtoSaveArma.setReturnpk(Boolean.TRUE); + dtoSaveArma.setPosition(1); + msave.put(armas.getBeanalias(), dtoSaveArma); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + record.modifiedData().put("GUARDA", "S"); + MessageHelper.setMessageInfo(resp); + } else { + record.modifiedData().put("GUARDA", "N"); + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + record.modifiedData().put("GUARDA", "N"); + MessageHelper.setMessageError(e); + } + } + + public void uploadImpronta(FileUploadEvent event) { + record.modifiedData().put("FileUploadImpronta", event.getFile()); + } + + public void uploadFoto(FileUploadEvent event) { + record.modifiedData().put("FileUploadFoto", event.getFile()); + } + + /** + * Metodo invocado al cerrar el dialogo del registro de la ficha tecnica de las armas + * + * @throws Exception + */ + public Boolean cargarArchivo() throws Exception { + Boolean msgArchivos = Boolean.FALSE; + //Impronta + UploadedFile uploadedFileImpronta = null; + if (record.modifiedData().get("FileUploadImpronta") != null) { + uploadedFileImpronta = (UploadedFile) record.modifiedData().get("FileUploadImpronta"); + } else { + MessageHelper.setMessageError("INGRESE LA IMPRONTA"); + msgArchivos = Boolean.TRUE; + } + //FOTO + UploadedFile uploadedFoto = null; + if (record.modifiedData().get("FileUploadFoto") != null) { + uploadedFoto = (UploadedFile) record.modifiedData().get("FileUploadFoto"); + } else { + MessageHelper.setMessageError("INGRESE LA FOTO"); + msgArchivos = Boolean.TRUE; + } + if (msgArchivos) { + return msgArchivos; + } + String xPathLocation = getRutaDocumento(); + String xphat1 = uploadedFoto.getFileName(); + if (xphat1.length() < 9) { + xphat1 = "DOCUMENTO-" + xphat1; + } + if (alfrescoController.uploadFile(uploadedFoto.getInputstream(), xphat1, xPathLocation + "/cm:fotografia")) { + record.setXpathfotografia(xPathLocation + "/cm:fotografia/cm:" + xphat1); + record.setImagenfotografia(uploadedFoto.getContents()); + } else { + MessageHelper.setMessageError("ERROR AL CARGAR LA FOTO"); + return Boolean.TRUE; + } + String xphat2 = uploadedFileImpronta.getFileName(); + if (xphat2.length() < 9) { + xphat2 = "DOCUMENTO-" + xphat2; + } + if (alfrescoController.uploadFile(uploadedFileImpronta.getInputstream(), xphat2, xPathLocation + "/cm:impronta")) { + record.setXpathimpronta(xPathLocation + "/cm:impronta/cm:" + xphat2); + this.record.setImagenimpronta(uploadedFileImpronta.getContents()); + } else { + MessageHelper.setMessageError("ERROR AL CARGAR LA IMPRONTA"); + return Boolean.TRUE; + } + record.modifiedData().remove("FileUploadImpronta"); + record.modifiedData().remove("FileUploadFoto"); + super.update(); + this.habilitaButtom = false; + return msgArchivos; + } + + public void verificarPuedeGenerarReporte() { + for (TarmArmaPruebas tarmArmaPruebas : this.tarmArmaPruebasList) { + //IMPRIME record.modifiedData().get("IMPRIME").equals("S") + if (tarmArmaPruebas.getPk() == null || tarmArmaPruebas.getImagenfotografia() == null || tarmArmaPruebas.getImagenimpronta() == null + || tarmArmaPruebas.getXpathfichatecarmas() == null + || tarmArmaPruebas.getIsimpreso() == null || !tarmArmaPruebas.getIsimpreso().equalsIgnoreCase("Y")) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("lbl_impresionarma1") + tarmArmaPruebas.getCarma() + MsgControlArmas.getProperty("lbl_impresionarma2")); + deshabilitadoGenerarReporte = true; + return; + } + } + deshabilitadoGenerarReporte = false; + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + if (deshabilitadoGenerarReporte && !btnFlujo) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generereporte")); + return; + } + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("csolicitud", codigoSolicitud); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + btnFlujo = Boolean.FALSE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * @return @throws Exception + */ + public String codigoAceptado() throws Exception { + TgeneParameters f = ParametersController.find("ACEPTADO", "1"); + return f.getTextvalue(); + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Metodo para armar la ruta del documento + * + * @return + */ + public String getRutaDocumento() { + Calendar calendar = Calendar.getInstance(); + StringBuilder ruta = new StringBuilder("cm:Solicitudes"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append( + (calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + ruta = ruta.append("/cm:D-").append( + (calendar.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (calendar.get(Calendar.DAY_OF_MONTH)) : (calendar.get(Calendar.DAY_OF_MONTH))); + TarmSolicitud solicitud = SolicitudArmasController.find(codigoSolicitud); + ruta = ruta.append("/cm:").append(solicitud.getNumerosolicitud()); + ruta = ruta.append("/cm:").append("armas"); + return ruta.toString(); + } + + /** + * Metodo que indica si se debe habilitar el boton del pantalla ficha tecnica + */ + public void habilitarBoton() { + this.habilitaButtom = true; + } + + /** + * Metodo que indica si se debe habilitar el boton del pantalla ficha tecnica + */ + public void cerrar() { + if (record.modifiedData().get("GUARDA") != null && record.modifiedData().get("GUARDA").equals("S") + && record.modifiedData().get("IMPRIME") != null && record.modifiedData().get("IMPRIME").equals("S")) { + } else { + MessageHelper.setMessageError("GUARDE Y GENERE EL REPORTE"); + } + } + + /** + * Ejecuta reporte de registro balistico + * + */ + public void reporteRegistroBalistico() { + try { + String gradoUsuario = ""; + String path = "armas/reports/registroBalistico"; + String filename = MsgControlArmas.getProperty("lbl_registroBalistico"); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + + //Logos + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Obteniendo la solicitud + TarmSolicitud solicitud = SolicitudController.findSolicitudxcodsolicitud(this.codigoSolicitud); + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + + //Codigo solicitud + parameters.put("csolicitud", this.codigoSolicitud); + + //Fecha de solicitud + parameters.put("fechaSolicitud", sdf.format(solicitud.getFregistro())); + + //Obteniendo los datos del tramite + TarmTramite tramite = TarmTramiteController.find(solicitud.getCtramite().toString()); + TgeneCatalogDetail tipoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + TgeneCatalogDetail categoria = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + TarmSolicitudTramite solicitudTramite = SolicitudTramiteController.findByCSolicitud(this.codigoSolicitud); + TgeneCatalogDetail tipoAutorizacion = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail usoActividad = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + + //Tipo de tramite + if (tipoTramite != null && tipoTramite.getDescription() != null) { + parameters.put("tipoTramite", tipoTramite.getDescription()); + } else { + parameters.put("tipoTramite", " "); + } + + //Categoria + if (categoria != null && categoria.getDescription() != null) { + parameters.put("categoria", categoria.getDescription()); + } else { + parameters.put("categoria", " "); + } + + //No tramite + if (solicitudTramite != null) { + parameters.put("noTramite", solicitudTramite.getNumerotramite()); + } else { + parameters.put("noTramite", " "); + } + + //Tipo de autorizacion + if (tipoAutorizacion != null && tipoAutorizacion.getDescription() != null) { + parameters.put("tipoAutorizacion", tipoAutorizacion.getDescription()); + } else { + parameters.put("tipoAutorizacion", " "); + } + + //Uso-actividad + if (usoActividad != null && usoActividad.getDescription() != null) { + parameters.put("usoActividad", usoActividad.getDescription()); + } else { + parameters.put("usoActividad", " "); + } + + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if (grado != null) { + gradoUsuario = grado.getDescription() + " - " + this.responsableCentroControl.getName(); + } else { + gradoUsuario = "Sin Grado - " + this.responsableCentroControl.getName(); + } + TcustPersonDetail person = PersonDetailController.find(String.valueOf(solicitud.getPersoncode())); + //PersonDetailController.find(String.valueOf(solicitud.getPersoncode())); + //Fecha + parameters.put("fechaActual", sdf.format(this.fec_actual)); + parameters.put("fecActualHora", new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss").format(this.fec_actual)); + parameters.put("personCode", person.getPk().getPersoncode()); + parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("usuario", this.tsafeUserDetailUsuario.getNickname()); + String format = this.formato; + try { + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + btnFlujo = Boolean.TRUE; + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if (tcustPersonAddres == null) { + return null; + } + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl() { + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + public void saveImprimir() { + try { + if (!record.modifiedData().get("GUARDA").equals("S")) { + MessageHelper.setMessageError("GUARDE LA FICHA PARA GENERAR EL REPORTE"); + return; + } + reporteFichaArmas(); + record.setIsimpreso("Y"); + update(); + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + request.setSaveTables(msave); + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + msave.put(beanalias, dtosave); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + record.modifiedData().put("IMPRIME", "S"); + MessageHelper.setMessageInfo(resp); + } else { + record.modifiedData().put("IMPRIME", "N"); + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + record.modifiedData().put("IMPRIME", "N"); + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el reporte de Ficha de Armas + * + * @throws Exception + */ + public void reporteFichaArmas() throws Exception { + String gradoUsuario = ""; + System.out.println("=======> QUE ES " + tramiteingresado); + String path = "armas/reports/fichaTecArmas"; + if (tramiteingresado != null && !tramiteingresado.trim().isEmpty() && tramiteingresado.trim().equals("NOLETAL")) { + path = "armas/reports/fichaTecArmasNoLetales"; + } + if (tramiteingresado != null && !tramiteingresado.trim().isEmpty() && tramiteingresado.trim().equals("COLECCION")) { + path = "armas/reports/fichaTecArmasColeccion"; + } + + String filename = MsgControlArmas.getProperty("lbl_fichaTecnicaArmas"); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //Centro de control + parameters.put("centroControl", this.obtenerCentroControl()); + + //Fecha actual + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("fechaActual", sdf.format(this.fec_actual)); + //Fecha de solicitud + if (solicitud != null && solicitud.getFregistro() != null) { + parameters.put("fechaSolicitud", sdf.format(solicitud.getFregistro())); + } else { + parameters.put("fechaSolicitud", " "); + } + //No tramite + if (solicitudTramite != null && solicitudTramite.getNumerotramite() != null) { + parameters.put("noTramite", solicitudTramite.getNumerotramite()); + } else { + parameters.put("noTramite", " "); + } + + //Tipo de tramites + if (detallecatalogoTipoTramite != null && detallecatalogoTipoTramite.getDescription() != null) { + parameters.put("tipoTramite", detallecatalogoTipoTramite.getDescription()); + } else { + parameters.put("tipoTramite", " "); + } + //Estado tramite + if (estadotramite != null && estadotramite.getDescription() != null) { + parameters.put("estadoTramite", estadotramite.getDescription()); + } else { + parameters.put("estadoTramite", " "); + } + + //Uso actividad + if (usoActividad != null && usoActividad.getDescription() != null) { + parameters.put("usoActividad", usoActividad.getDescription()); + } else { + parameters.put("usoActividad", " "); + } + //Tipo de documento + if (identificacion != null) { + parameters.put("tipoDocumento", identificacion.getDescription()); + } else { + parameters.put("tipoDocumento", " "); + } + //No documento + if (personaDetalle != null) { + parameters.put("cedula", personaDetalle.getIdentification()); + } else { + parameters.put("cedula", " "); + } + //Nombre razon social + if (personaDetalle != null) { + parameters.put("nombreRazon", personaDetalle.getName()); + } else { + parameters.put("nombreRazon", " "); + } + //Provincia + if (provincia != null) { + parameters.put("provincia", provincia); + } else { + parameters.put("provincia", " "); + } + //Canton + if (canton != null) { + parameters.put("canton", canton); + } else { + parameters.put("canton", " "); + } + //Ciudad + if (ciudad != null) { + parameters.put("ciudad", ciudad); + } else { + parameters.put("ciudad", " "); + } + //Direccion + if (direccion != null) { + parameters.put("direccion", direccion); + } else { + parameters.put("direccion", " "); + } + //Codigo de arma + parameters.put("codigoArma", this.record.getCarma()); + //Codigo de registro de TarmArmaPrueba + parameters.put("cArmaPrueba", record.getPk().toString()); + TarmArmas arma = (TarmArmas) this.record.getModifiedData().get("arma"); + TarmRegistroArmas regArma = RegistroArmController.findByCodigo(arma.getCregistro().toString()); + TgeneCountry paisOrigen = CountryController.findcountry(regArma.getPaisorigen()); + //Clase + if (arma.getModifiedData().get("clase") != null) { + parameters.put("clase", arma.getModifiedData().get("clase") == null ? "" : arma.getModifiedData().get("clase")); + } else { + parameters.put("clase", " "); + } + //Obtniendo el tipo arma explosivo + TarmTipoArmaExplosivo tae = arma == null ? null : TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo()); + //Tipo arma + TgeneCatalogDetail tipoArma = tae == null ? null : CatalogDetailController.findxCodigoCodcatalogo(tae.getTipoarmaexplosivo(), "TIPOARMAEXPLOSIVO"); + parameters.put("tipoArma", (tipoArma == null || tipoArma.getDescription().isEmpty()) ? "" : tipoArma.getDescription()); + //Serie + parameters.put("serie", (arma == null || arma.getLote() == null || arma.getLote().isEmpty()) ? "" : arma.getLote()); + //Pais fabricacion + parameters.put("paisFabricacion", (paisOrigen == null) ? "" : (paisOrigen.getDescription())); + //Calibre + parameters.put("calibre", (arma.getModifiedData().get("calibre") == null) ? "" : arma.getModifiedData().get("calibre")); + //Longitud + TgeneCatalogDetail longitud = (tae == null || tae.getLongitud() == null || tae.getLongitudcodigo() == null || tae.getLongitud().isEmpty() || tae.getLongitudcodigo().isEmpty()) ? null : CatalogDetailController.findxCodigoCodcatalogo(tae.getLongitud(), tae.getLongitudcodigo()); + if (longitud != null && longitud.getDescription() != null) { + parameters.put("longitud", longitud.getDescription()); + } else { + parameters.put("longitud", " "); + } + //Marca + parameters.put("marca", arma.getModifiedData().get("marca")); + //Modelo + parameters.put("modelo", arma.getModelo()); + //Color + parameters.put("color", arma.getModifiedData().get("color")); + //Observacion + parameters.put("observacion", this.record.getObservacion()); + //Aptitud de disparo + String aptitudDisparo = " "; + if (this.record.getAptituddisparo().equalsIgnoreCase("Y")) { + aptitudDisparo = "BUENO"; + } else { + aptitudDisparo = "MALO"; + } + parameters.put("aptitudDisparo", aptitudDisparo); + + //Balas testigo + String balasTestigo = " "; + if (this.record.getBalastestigo() != null && this.record.getBalastestigo().equalsIgnoreCase("Y")) { + balasTestigo = MsgControlArmas.getProperty("lbl_si"); + } else if (this.record.getBalastestigo() != null) { + balasTestigo = "NO"; + } + parameters.put("balasTestigo", balasTestigo); + + //Vainas testigo + String vainasTestigo = " "; + if (this.record.getVainastestigo() != null && this.record.getVainastestigo().equalsIgnoreCase("Y")) { + vainasTestigo = MsgControlArmas.getProperty("lbl_si"); + } else if (this.record.getVainastestigo() != null) { + vainasTestigo = "NO"; + } + parameters.put("vainasTestigo", vainasTestigo); + + //tubocanion + String tubocanion = " "; + if (this.record.getTubocanion() != null && this.record.getTubocanion().equalsIgnoreCase("Y")) { + tubocanion = MsgControlArmas.getProperty("lbl_si"); + parameters.put("balasTestigo", tubocanion); + } else if (this.record.getTubocanion() != null) { + tubocanion = "NO"; + parameters.put("balasTestigo", tubocanion); + } + + //Estado final + String estadoFinal = " "; + if (this.record.getApruebaevaluacion().equalsIgnoreCase("Y")) { + estadoFinal = "APROBADA"; + } else { + estadoFinal = "REPROBADA"; + } + parameters.put("estadoFinal", estadoFinal); + //Codigo de persona + parameters.put("personcode", record.getPersoncode()); + //Codigo de arma + parameters.put("codArma", record.getCarma()); + //codigo solicitud + parameters.put("csolicitud", this.codigoSolicitud); + //Grado del funcionario + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if (grado != null) { + gradoUsuario = grado.getDescription() + " - " + this.responsableCentroControl.getName(); + } else { + gradoUsuario = "Sin Grado - " + this.responsableCentroControl.getName(); + } + parameters.put("personcode", responsableCentroControl.getPk().getPersoncode()); + parameters.put("gradoUsuario", gradoUsuario); + String format = "pdf"; + + this.xpathflujo = this.getRutaDocumento(); + filename = filename + this.record.getPk().toString(); + InputStream report = this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + if (!this.alfrescoController.uploadFile(report, filename + ".pdf", this.xpathflujo)) { + throw new Exception("ERROR AL CARGAR EL REPORTE"); + } + this.record.setXpathfichatecarmas(this.xpathflujo + "/cm:" + filename + ".pdf"); + this.record.getModifiedData().put("impresion", Boolean.TRUE); + } + + /** + * Metodo para encontrar por codigo de solicitud + * + * @param codigoSolicitud + * @return registro de armaPrueba encontrado + */ + public List findPorSolicitud(String codigoSolicitud) { + try { + IngresoFichaTecnicaArmasController cc = new IngresoFichaTecnicaArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("csolicitud", codigoSolicitud); + cc.querydatabaseArma(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para encontrar por codigo de solicitud + * + * @param codigoSolicitud + * @return registro de armaPrueba encontrado + */ + public static List buscarFichasPorSolicitud(String codigoSolicitud) { + try { + IngresoFichaTecnicaArmasController cc = new IngresoFichaTecnicaArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("csolicitud", codigoSolicitud); + cc.querydatabaseArma(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public TarmArmaPruebas find(String codigoSolicitud, String carma) { + try { + IngresoFichaTecnicaArmasController cc = new IngresoFichaTecnicaArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("carma", carma); + cc.addFilter("csolicitud", codigoSolicitud); + cc.querydatabaseArma(); + if (cc.lrecord != null && cc.lrecord.size() > 0) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmArmaPruebas findByPk(String pk) { + try { + IngresoFichaTecnicaArmasController cc = new IngresoFichaTecnicaArmasController(); + cc.init(); + cc.recperpage = 10; + cc.addFilter("pk", pk); + cc.querydatabaseArma(); + if (cc.lrecord != null && cc.lrecord.size() > 0) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public TarmArmas getArma() { + return arma; + } + + public void setArma(TarmArmas arma) { + this.arma = arma; + } + + public String getEditarReg() { + return editarReg; + } + + public void setEditarReg(String editarReg) { + this.editarReg = editarReg; + } + + public String getCodigoSolicitud() { + return codigoSolicitud; + } + + public void setCodigoSolicitud(String codigoSolicitud) { + this.codigoSolicitud = codigoSolicitud; + } + + public List getListadoArmasPruebas() { + return listadoArmasPruebas; + } + + public void setListadoArmasPruebas(List listadoArmasPruebas) { + this.listadoArmasPruebas = listadoArmasPruebas; + } + + /** + * metodo que registra el cambio de la seleccion del recuperador balisitico y segun esto aprueba la evaluacion + * @param armaPruebas + */ + public void cambia(TarmArmaPruebas armaPruebas) { + record = armaPruebas; + try { + ArmaController ac = new ArmaController(); + TarmArmas local = ac.findByPk(record.getCarma()); + if (local != null) { + TarmTipoArmaExplosivo tipo = TiposArmasExplosivosController.findarma(local.getCtipoarmaexplosivo()); + if (tipo.getClase().equals("0010000001")) { + tramiteingresado = "OTROS"; + } else if (tipo.getClase().equals("0010000008")) { + tramiteingresado = "NOLETAL"; + } + } + } catch (Exception ex) { + System.err.println("ERROR " + ex); + ex.printStackTrace(System.err); + } + System.out.println("=========> TIPO TRAMITE " + tramiteingresado); + if ("Y".equals(record.getAptituddisparo()) && "Y".equals(record.getVainastestigo()) && "Y".equals(record.getBalastestigo())) { + record.setApruebaevaluacion("Y"); + } else { + record.setApruebaevaluacion("N"); + } + + habilitaButtom = true; + + armaPruebas.modifiedData().put("GUARDA", "N"); + armaPruebas.modifiedData().put("IMPRIME", "N"); + record.modifiedData().put("GUARDA", "N"); + record.modifiedData().put("IMPRIME", "N"); + } + + public String getObservacion() { + return observacion; + } + + public void setObservacion(String observacion) { + this.observacion = observacion; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public List getLaccion() { + return laccion; + } + + public void setLaccion(List laccion) { + this.laccion = laccion; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public boolean isHabilitaButtom() { + return habilitaButtom; + } + + public void setHabilitaButtom(boolean habilitaButtom) { + this.habilitaButtom = habilitaButtom; + } + + public String getFormato() { + return formato; + } + + public void setFormato(String formato) { + this.formato = formato; + } + + public Date getFec_actual() { + return fec_actual; + } + + public void setFec_actual(Date fec_actual) { + this.fec_actual = fec_actual; + } + + public Boolean getBtnFlujo() { + return btnFlujo; + } + + public void setBtnFlujo(Boolean btnFlujo) { + this.btnFlujo = btnFlujo; + } + + public boolean isDeshabilitadoGenerarReporte() { + return deshabilitadoGenerarReporte; + } + + public void setDeshabilitadoGenerarReporte(boolean deshabilitadoGenerarReporte) { + this.deshabilitadoGenerarReporte = deshabilitadoGenerarReporte; + } + + public void changeApruebaEvaluacion() { + if (tramiteingresado != null && !tramiteingresado.trim().isEmpty() && tramiteingresado.equals("NOLETAL")) { + if (this.record.getAptituddisparo() != null && ("Y".equalsIgnoreCase(this.record.getAptituddisparo())) + && (this.record.getTubocanion() != null && "Y".equalsIgnoreCase(this.record.getTubocanion()))) { + this.record.setApruebaevaluacion("Y"); + } else { + this.record.setApruebaevaluacion("N"); + } + } else if (tramiteingresado != null && !tramiteingresado.trim().isEmpty() && tramiteingresado.equals("COLECCION")) { + if (this.record.getAptituddisparo() != null && ("Y".equalsIgnoreCase(this.record.getAptituddisparo()))) { + this.record.setApruebaevaluacion("Y"); + } else { + this.record.setApruebaevaluacion("N"); + } + } else if (this.record.getAptituddisparo() != null && ("Y".equalsIgnoreCase(this.record.getAptituddisparo())) + && (this.record.getBalastestigo() != null && "Y".equalsIgnoreCase(this.record.getBalastestigo())) + && (this.record.getVainastestigo() != null && "Y".equalsIgnoreCase(this.record.getVainastestigo()))) { + this.record.setApruebaevaluacion("Y"); + } else { + this.record.setApruebaevaluacion("N"); + } + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TsafeUserDetail getTsafeUserDetailUsuario() { + return tsafeUserDetailUsuario; + } + + public void setTsafeUserDetailUsuario(TsafeUserDetail tsafeUserDetailUsuario) { + this.tsafeUserDetailUsuario = tsafeUserDetailUsuario; + } + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + public TarmSolicitudTramite getSolicitudTramite() { + return solicitudTramite; + } + + public void setSolicitudTramite(TarmSolicitudTramite solicitudTramite) { + this.solicitudTramite = solicitudTramite; + } + + public TarmTramite getTramite() { + return tramite; + } + + public void setTramite(TarmTramite tramite) { + this.tramite = tramite; + } + + public TcustPersonAddress getDireccionCliente() { + return direccionCliente; + } + + public void setDireccionCliente(TcustPersonAddress direccionCliente) { + this.direccionCliente = direccionCliente; + } + + public String getProvincia() { + return provincia; + } + + public void setProvincia(String provincia) { + this.provincia = provincia; + } + + public String getCanton() { + return canton; + } + + public void setCanton(String canton) { + this.canton = canton; + } + + public String getCiudad() { + return ciudad; + } + + public void setCiudad(String ciudad) { + this.ciudad = ciudad; + } + + public String getDireccion() { + return direccion; + } + + public void setDireccion(String direccion) { + this.direccion = direccion; + } + + public TgeneCatalogDetail getEstadotramite() { + return estadotramite; + } + + public void setEstadotramite(TgeneCatalogDetail estadotramite) { + this.estadotramite = estadotramite; + } + + public TgeneCatalogDetail getUsoActividad() { + return usoActividad; + } + + public void setUsoActividad(TgeneCatalogDetail usoActividad) { + this.usoActividad = usoActividad; + } + + public TcustPersonDetail getPersonaDetalle() { + return personaDetalle; + } + + public void setPersonaDetalle(TcustPersonDetail personaDetalle) { + this.personaDetalle = personaDetalle; + } + + public TgeneCatalogDetail getIdentificacion() { + return identificacion; + } + + public void setIdentificacion(TgeneCatalogDetail identificacion) { + this.identificacion = identificacion; + } + + public TgeneCatalogDetail getDetallecatalogoTipoTramite() { + return detallecatalogoTipoTramite; + } + + public void setDetallecatalogoTipoTramite( + TgeneCatalogDetail detallecatalogoTipoTramite) { + this.detallecatalogoTipoTramite = detallecatalogoTipoTramite; + } + + public TgeneCatalogDetail getDetallecatalogo() { + return detallecatalogo; + } + + public void setDetallecatalogo(TgeneCatalogDetail detallecatalogo) { + this.detallecatalogo = detallecatalogo; + } + + public List getTarmArmaPruebasList() { + return tarmArmaPruebasList; + } + + public void setTarmArmaPruebasList(List tarmArmaPruebasList) { + this.tarmArmaPruebasList = tarmArmaPruebasList; + } + + public ArmasController getArmas() { + return armas; + } + + public void setArmas(ArmasController armas) { + this.armas = armas; + } + + public String getTramiteingresado() { + return tramiteingresado; + } + + public void setTramiteingresado(String tramiteingresado) { + this.tramiteingresado = tramiteingresado; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/InspeccionArchivoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/InspeccionArchivoController.java new file mode 100644 index 0000000..d773bb0 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/InspeccionArchivoController.java @@ -0,0 +1,165 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmInspeccion; +import com.fp.persistence.parmas.soli.TarmInspeccionArchivo; + +/** + * Clase controladora del bean TgeneCatalogDetail. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class InspeccionArchivoController extends AbstractController { + + public InspeccionArchivoController() throws Exception { + super(TarmInspeccionArchivo.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "INSPECCIONARCHIVO"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.cinspeccion"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para encontrar por codigo de inspeccion + * + * @param codigoSolicitud + * @return registro de archivo inspeccion encontrado + */ + public static List findPorInspeccion(String codigoInspeccion) { + try { + InspeccionArchivoController cc = new InspeccionArchivoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("cinspeccion", codigoInspeccion); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que encuentra los archivos de inspeccion por codigo de solicitud + * + * @param codigoSolicitud + * @return una lista de archivos que cumplen todos los criterios de busqueda + */ + public static List findPorSolicitud(String codigoSolicitud) { + try { + List lInspeccion = InspeccionController.findPorSolicitud(codigoSolicitud); + List lInspeccionArchivo = new ArrayList<>(); + for (TarmInspeccion inspeccion : lInspeccion) { + List lInspeccionesArchivoEncontradas = findPorInspeccion(String.valueOf(inspeccion.getPk())); + if (lInspeccionesArchivoEncontradas != null && !lInspeccionesArchivoEncontradas.isEmpty()) { + lInspeccionArchivo.addAll(lInspeccionesArchivoEncontradas); + } + } + return lInspeccionArchivo; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/InspeccionCambioArchivoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/InspeccionCambioArchivoController.java new file mode 100644 index 0000000..611adf5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/InspeccionCambioArchivoController.java @@ -0,0 +1,255 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmInspeccionArchivo; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TarmInspeccionArchivo. Se reemplaza el archivo de + * inspeccion, se filtra por el codigo de solicitud + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class InspeccionCambioArchivoController extends AbstractController { + + public InspeccionCambioArchivoController() throws Exception { + super(TarmInspeccionArchivo.class); + } + + /** + * Variable que nos permite cargar el documento al Alfresco + */ + private UploadedFile uploadedFile; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "INSPECCIONARCHIVO"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if (getMfilelds().get("codigosolicitud") == null + && getMfilelds().get("codigosolicitud").toString().trim().isEmpty()) { + MessageHelper.setMessageError("Ingrese el cdigo de solicitud"); + return; + } + DtoQuery dto = super.getDtoQuery(true); + + Filter filtroFinal = new Filter(); + String sqlFinal = " t.cinspeccion in (select p.pk from TarmInspeccion p where p.csolicitud in " + + "(select s.pk from TarmSolicitud s where s.numerosolicitud='" + getMfilelds().get("codigosolicitud").toString().trim() + "' )) "; + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + + dto.setOrderby("t.cinspeccion"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + for (TarmInspeccionArchivo item : lrecord) { + item.getModifiedData().put("codigosolicitud", getMfilelds().get("codigosolicitud").toString().trim()); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void update() { + try { + String pathRuta = ""; + + String xPathLocation = getRutaDocumentoSolBase(record.getXpath()); + if (uploadedFile != null && uploadedFile.getFileName() != null) { + String nombreArchivo = uploadedFile.getFileName(); + if (alfrescoController.uploadFile(uploadedFile.getInputstream(), nombreArchivo, xPathLocation)) { + pathRuta = xPathLocation + "/cm:" + nombreArchivo; + record.setXpathoriginal(record.getXpath()); + record.setXpath(pathRuta); + TsafeUserDetail userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + record.setUsuariocambio(userDetail.getNickname()); + super.update(); + } else { + MessageHelper.setMessageError("Adjunte el documento"); + return; + } + } else { + MessageHelper.setMessageError("Adjunte el documento"); + return; + } + save(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase(String xpath) { + int index = xpath.lastIndexOf('/'); + xpath = xpath.substring(0, index); + xpath = xpath + "/cm:Cambio"; + System.out.println(xpath); + return xpath; + } + + /** + * Metodo que retorna la extencion del documento que se desea subir al + * alfresco + */ + public String getNombre(String ruta) { + int index = ruta.lastIndexOf('/'); + if (index == -1) { + return "cambiodocumento.jpg"; + } else { + return (ruta.substring(index + 1)).replace("cm:", ""); + } + } + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en + * el Alfresco + */ + public void handleUpload(FileUploadEvent event) { + uploadedFile = event.getFile(); + } + + /** + * Recorta el nombre del archivo a cargarse + * + * @param nombre + * @return nombre recortado + */ + public String recorteNombre(String nombre) { + String fielname = nombre; + if (fielname.length() > 30) { + fielname = fielname.substring(0, 30) + extencionArchivo(nombre); + } + return fielname; + } + + /** + * Obtiene la extencion del archivo a cargar + * + * @param nombre + * @return + */ + private String extencionArchivo(String nombre) { + int pos = nombre.lastIndexOf('.'); + nombre = nombre.substring(pos); + return nombre; + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/InspeccionController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/InspeccionController.java new file mode 100644 index 0000000..9315c7b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/InspeccionController.java @@ -0,0 +1,160 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.ins.TarmPlanificacionInspeccion; +import com.fp.persistence.parmas.soli.TarmInspeccion; + +/** + * Clase controladora del bean TgeneInspeccion. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class InspeccionController extends AbstractController { + + public InspeccionController() throws Exception { + super(TarmInspeccion.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "INSPECCION"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para encontrar por codigo de solicitud + * + * @param codigoSolicitud + * @return registro de inspeccion encontrado + */ + public static List findPorSolicitud(String codigoSolicitud) { + try { + InspeccionController cc = new InspeccionController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("csolicitud", codigoSolicitud); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que encuentra TarmInspeccion por year y por centro de control + * + * @param codigoSolicitud + * @return + */ + public static List findPorAnno(String centro, String year) { + try { + InspeccionController cc = new InspeccionController(); + cc.init(); + cc.recperpage = 300; + if (year != null) { + cc.addFilter("anno", year); + } + cc.addFilter("centrocontrol", centro); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; +// if (cc.record != null) { +// return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/InventariosController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/InventariosController.java new file mode 100644 index 0000000..ca697f7 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/InventariosController.java @@ -0,0 +1,2202 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.apache.commons.lang3.StringUtils; +import org.primefaces.context.RequestContext; +import org.primefaces.event.SelectEvent; +import org.primefaces.extensions.component.inputnumber.InputNumber; + +import com.fp.common.helper.Constant; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.CargaController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.lov.ArmaExplosivoLovController; +import com.fp.frontend.controller.armas.lov.CargasLovController; +import com.fp.frontend.controller.armas.parametros.CalibreLovController; +import com.fp.frontend.controller.armas.parametros.ClaseLovController; +import com.fp.frontend.controller.armas.parametros.InventarioSubidoController; +import com.fp.frontend.controller.armas.parametros.LongitudLovController; +import com.fp.frontend.controller.armas.parametros.TipoArmaExpLovController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.frontend.utility.ValidateIdentification; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.fun.TarmInventarioSubidoPorPersona; +import com.fp.persistence.parmas.fun.TarmInventarioSubidoPorPersonaKey; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Controlador principal de armas + * + * @author Christian Pazmino + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class InventariosController extends AbstractController { + + private Boolean estadoDesaduanizado = Boolean.FALSE; + private Boolean esNuevaImportacion = Boolean.TRUE; + private String filterAUCP; + //P lpartidaArancelaria = new ArrayList<>(); + private TarmCarga carga = new TarmCarga(); + private Boolean isSelectAucpPrevio = Boolean.FALSE; + private Boolean isSave = Boolean.FALSE; + private Boolean isEnableCategoria = Boolean.TRUE; + InputNumber cantidadTxt = new InputNumber(); + List ldeleteItems = new ArrayList(); + + @ManagedProperty(value = "#{tiposArmasExplosivosController}") + private TiposArmasExplosivosController tiposArmasExplosivosController; + + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmas; + + // Datos generales + private TgeneCatalogDetail tipoDocumento; + private TcustPersonDetail detallesPersona; + // Catalogo que contiene tipos de registros + private List tiposRegistro; + private TcustPersonDetail usuario; + +// private String tipoRegistro; + //Registro armas + TarmRegistroArmas registro = new TarmRegistroArmas(); + + //Detalle de localizacion para el caso de importaciones + private List lpaises; +// private TgeneCountry pais; + //private String pais; + + //Provincia + private List lprovincias; + private String codigoProvincia; + + //Canton + private List lcantones; + private String codigoCanton; + + //Ciudad + private List lciudades; +// private TgeneCity ciudad; + + //Aeropuertos + private List laeropuertos = new ArrayList<>(); + + private List ldocumentospersona; + +// /** +// * Lista de tipos de identificación +// */ +// private List ltipoidentificacion; + /** + * Listado de estados del arma + */ + private List lestadoarma; + /** + * Listado de marcas + */ + private List lmarca; + /** + * Listado de colores + */ + private List lcolor; + /** + * Listado de tipos de fabricación + */ + private List ltipofabricacion; + /** + * Listado de unidad de medida cantidad + */ + private List lunidadmedidacantidad; + /** + * Listado de unidad medida peso + */ + private List lunidadmedidapeso; +// /** +// * Listado de paises +// */ +// private List lcountry; +// /** +// * Listado de provincias +// */ +// private List lprovincias; +// /** +// * Listado de cantones +// */ +// private List lcantones; + /** + * Listado de parroquias + */ + private List lparroquias; + /** + * Listado de ciudades + */ + private List lcities; + +// /** +// * Tipo documento +// */ +// private String tipoDoc; +// /** +// * Número documento +// */ +// private String numDoc; +// /** +// * Nombre/razón social +// */ +// private String nombreRazon; + /** + * Longitud arma + */ + private String longitud; + /** + * Calibre arma + */ + private String calibre; + /** + * Clase arma + */ + private String clase; + /** + * Clase arma + */ + private String categoria; + /** + * Tipo de arma + */ + private String tipoarma; + /** + * unidad medida peso + */ + private String unidadmedidapeso; + + /** + * Bandera que indica que en realidad existe luego del ingreso de datos un + * tipo de arma explosivo válido + */ + private boolean existeTipoArmaExplosivo; + + /** + * Bandera que especifica que se deba verificar que exista un arma explosivo + * válido + */ + private boolean verificaArmaExplosivo = Boolean.TRUE; + + /** + * Bloquea la unidad de cantidad + */ + private boolean bloquearUnidadCantidad = Boolean.TRUE; + + /** + * Bloquea la unidad de peso + */ + private boolean bloquearUnidadPeso = Boolean.TRUE; + /** + * Contiene la fecha actual del sistema + */ + private Date fechaActual; + /** + * Contiene la referencia a nuevo propietario del arma + */ + private TcustPersonDetail nuevoPropietarioArma; + /** + * Tipo del arma explosivo + */ + private TarmTipoArmaExplosivo tipoArmaExplosivo; + /** + * codigo del ruc + */ + private String codigoRuc; + /** + * codigo del ruc + */ + private String codigoCedula; + /** + * codigo del ruc + */ + private String codigoPasaporte; + + public InventariosController() throws Exception { + super(TarmArmas.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + carga.setIsnew(Boolean.TRUE); + //Localizacion + lpaises = CountryController.find(); + this.lprovincias = ProvinceController.find("EC"); + //Obteniendo los aeropuertos + this.laeropuertos = CatalogDetailController.find("AEROPUERTOS"); + this.lpartidaArancelaria = CatalogDetailController.find("PARTIDAARANCELARIA"); + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + detallesPersona = PersonDetailController.find(String.valueOf(usuario.getPk().getPersoncode())); + //Tipo de documento + tipoDocumento = CatalogDetailController.findxCodigoCodcatalogo(detallesPersona.getIdentificationcatalog(), detallesPersona.getIdentificationcatalogcode()); + //Tipos de registro +// tiposRegistro=CatalogDetailController.find("TIPOREGISTRO", "REG"); + //Tipos de registro + List tiposRegistroAux = CatalogDetailController.find("TIPOREGISTRO", "REG"); + tiposRegistro = new ArrayList(); + for (TgeneCatalogDetail tipoReg : tiposRegistroAux) { + if (tipoReg.getPk().getCatalog().equalsIgnoreCase("PRO")) { + tiposRegistro.add(tipoReg); + } + } + + fechaActual = new Date(); + recperpage = 5000; // Cambiar al # reg a mirar. +// record = new TarmArmas(); + lrecord = new ArrayList<>(); + beanalias = "ARMAS"; +// ltipoidentificacion = CatalogDetailController.find("IDENTIFICATION"); + lestadoarma = CatalogDetailController.find("ESTADOARMA"); + lmarca = CatalogDetailController.find("MARCA"); + lcolor = CatalogDetailController.find("COLOR"); + ltipofabricacion = CatalogDetailController.find("TIPOFABRICACION"); +// lunidadmedidacantidad = CatalogDetailController.find("UCANTIDAD"); + lunidadmedidapeso = CatalogDetailController.find("UNIDADMEDIDA"); +// lcountry = CountryController.find(); + codigoRuc = codigos("CODIGO.RUC"); + codigoCedula = codigos("CODIGO.CEDULA"); + codigoPasaporte = codigos("CODIGO.PASAPORTE"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void cargarCategorias() { + // Cargamos la lista de categorias disponibles para el usuario (en funcion de sus documentos habilitantes) + ldocumentospersona = new ArrayList<>(); + List listadocum = new ArrayList<>(); + if (registro.getTiporegistro() != null) { + if ("PRO".equals(registro.getTiporegistro())) { + listadocum = DocumentoHabilitanteController.findByPerson_Inventario(usuario.getPk().getPersoncode().toString()); + carga = new TarmCarga(); + carga.setIsnew(Boolean.TRUE); + registro.setIsnew(Boolean.TRUE); + } + } else { + ldocumentospersona = new ArrayList<>(); + } + //Forma numero 1 (Uso de Maps). + Map mapaSinRepetidos = new HashMap(listadocum.size()); + for (TarmDocumentoHabilitante p : listadocum) { + mapaSinRepetidos.put(p.getCtramite(), p); + } + //Agrego cada elemento del map a una nueva lista y muestro cada elemento. + for (Entry p : mapaSinRepetidos.entrySet()) { + ldocumentospersona.add(p.getValue()); + } + } + + public void validarCategoria() { + String tipoCarga = "INV"; + List cargaLst = CargaController.findXPersonaYCategoria(this.usuario.getPk().getPersoncode().toString(), categoria, tipoCarga); + if (cargaLst != null) { +// isEnableCategoria = Boolean.FALSE; + isSave = Boolean.TRUE; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_inventarioCargadoPreviamente")); + return; + } else { +// isEnableCategoria = Boolean.TRUE; + isSave = Boolean.FALSE; + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + String sqlFiltroPersona = ""; + String sqlFiltroSancion = ""; + String sqlFiltroEstados = ""; + String sqlFiltroClaseArmas = ""; +// String sqlFiltroFechaCaducidad = ""; + String sqlFiltroValidacionArma = "";//si entre los estados existe renovacion entonces validamos que no pueda seleccionar las mismas armas + if (this.getMfilelds().get("personcode") != null) { + sqlFiltroPersona = " t.cregistro in (SELECT c.pk FROM TarmRegistroArmas c WHERE c.personcode=" + this.getMfilelds().get("personcode") + ")"; + } + //agregamos los filtros en base a la consideracion del field sancion, en caso de que lo sea buscamos los sancionados que hayan cumplido el tiempo de sancion + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + if (this.getMfilelds().containsKey("sancion") && this.getMfilelds().get("sancion").toString().equals(Constant.STR_Y)) { + sqlFiltroSancion = " t.pk in (SELECT max(a.pk) FROM TarmArmas a WHERE a.codigoarma in (SELECT distinct(h.codigoarma) from TarmDocumentoHabilitante h WHERE h.pk in (SELECT d.cdocumento FROM TarmSancionDecomiso d WHERE d.personcode=" + this.getMfilelds().get("personcode") + " AND d.fechafinal < TO_DATE('" + dateFormat.format(Calendar.getInstance().getTime()) + "', 'YYYY-MM-DD'))) GROUP BY a.codigoarma)"; + } + + dto.setOrderby("pk"); + if (this.getMfilelds().get("ESTADOS") != null) { + String[] estados = this.getMfilelds().get("ESTADOS").toString().split(","); + StringBuffer sqlEstados = new StringBuffer(" t.estado IN ("); + for (int i = 0; i < estados.length; i++) { + sqlEstados.append("'").append(estados[i]).append("'"); + if (i < estados.length - 1) { + sqlEstados.append(","); + } + } + sqlEstados.append(")"); + sqlFiltroEstados = sqlEstados.toString(); + } + + if (this.getMfilelds().get("TRAMITE") != null) { + TarmTramite tarmTramite = (TarmTramite) this.getMfilelds().get("TRAMITE"); + sqlFiltroValidacionArma = "t.pk not in (SELECT coalesce(max(a.pk),'-1') FROM TarmArmas a WHERE a.codigoarma in (SELECT distinct(h.codigoarma) from TarmDocumentoHabilitante h WHERE h.personcode=" + this.getMfilelds().get("personcode") + " AND h.ctramite=" + tarmTramite.getPk() + " AND h.estado = 'APR' AND h.fechaexpiracion >= " + "TO_DATE('" + dateFormat.format(Calendar.getInstance().getTime()) + "','yyyy-MM-dd')) GROUP BY a.codigoarma)"; + } + //estados del armas + if (this.getMfilelds().get("CLASEARMAS") != null) { + String[] clasesarma = this.getMfilelds().get("CLASEARMAS").toString().split(","); + StringBuffer sqlclasesarmas = new StringBuffer(" t.ctipoarmaexplosivo IN (select o.pk from TarmTipoArmaExplosivo o where o.clase in("); + for (int i = 0; i < clasesarma.length; i++) { + sqlclasesarmas.append("'").append(clasesarma[i]).append("'"); + if (i < clasesarma.length - 1) { + sqlclasesarmas.append(","); + } + } + sqlclasesarmas.append(")) "); + sqlFiltroClaseArmas = sqlclasesarmas.toString(); + } + +// if(this.getMfilelds().get("FECHACADUCIDADARM") != null){ +// sqlFiltroFechaCaducidad="t.fechacaducidad "+this.getMfilelds().get("FECHACADUCIDADARM"); +// } + String sqlActual = " t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma) and t.estado !='DEST' and t.estado!='VEND' and t.estado!='MING' and t.estado!='DUPL' and t.estado!='CUSTEM'" + + " and (t.peso>0 or t.cantidad>0)";//distintas de destruidas y cambio de propietario and t.cregistro=ta.cregistro para el manejo de los explosivos + +// String sqlFinal = obtenerFiltroBusquedaGeneral(sqlFiltroPersona, sqlFiltroEstados, sqlFiltroSancion, sqlFiltroValidacionArma,sqlFiltroClaseArmas,sqlFiltroFechaCaducidad, sqlActual); + String sqlFinal = obtenerFiltroBusquedaGeneral(sqlFiltroPersona, sqlFiltroEstados, sqlFiltroSancion, sqlFiltroValidacionArma, sqlFiltroClaseArmas, sqlActual); + Filter filtroFinal = new Filter(); + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void actualizaPanelImportacion() { + if (esNuevaImportacion) { + System.out.println("Logica para cuando es una nueva importacion: " + esNuevaImportacion); + carga = new TarmCarga(); + carga.setIsnew(Boolean.TRUE); + registro.setIsnew(Boolean.TRUE); +// if(registro.getPk()!=null){ +// registro.setPk(null); +// +// } + } else { + System.out.println("Logica para cuando es una importacion ya cargada y se consultara por AUCP: " + esNuevaImportacion); + } +// registro = new TarmRegistroArmas(); +// this.lrecord = new ArrayList(); + + } + + private String obtenerFiltroBusquedaGeneral(String... sqlFiltros) { + StringBuffer sqlFinal = new StringBuffer(); + for (int i = 0; i < sqlFiltros.length; i++) { + if (sqlFinal.length() > 0 && !StringUtils.endsWith(StringUtils.trim(sqlFinal.toString()), "AND")) { + sqlFinal.append(" AND "); + } + sqlFinal.append(sqlFiltros[i]); + } + return sqlFinal.toString(); + } + + @SuppressWarnings("unchecked") + public void querydatabaseSinFiltros() { + try { + DtoQuery dto = this.getDtoQuery(); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql = " t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() throws Exception { + // TODO Auto-generated method stub + super.next(); + } + + @SuppressWarnings("unchecked") + protected void querydatabasePorCodigo() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql = " t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", "i.pk.catalog=t.marca and i.pk.catalogcode=t.marcacodigo"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog=t.color and i.pk.catalogcode=t.colorcodigo"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase = new SubQuery("TarmTipoArmaExplosivo", "clase", "cclase", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryClaseCodigo = new SubQuery("TarmTipoArmaExplosivo", "clasecodigo", "cclasecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryClaseCodigo); + SubQuery subqueryLongitud = new SubQuery("TarmTipoArmaExplosivo", "longitud", "clongitud", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryLongitudCodigo = new SubQuery("TarmTipoArmaExplosivo", "longitudcodigo", "clongitudcodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryLongitudCodigo); + SubQuery subqueryCalibre = new SubQuery("TarmTipoArmaExplosivo", "calibre", "ccalibre", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryCalibreCodigo = new SubQuery("TarmTipoArmaExplosivo", "calibrecodigo", "ccalibrecodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryCalibreCodigo); + SubQuery subqueryTipoArma = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivo", "ctipoarmaexplosivo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArma); + SubQuery subqueryTipoArmaCodigo = new SubQuery("TarmTipoArmaExplosivo", "tipoarmaexplosivocodigo", "ctipoarmaexplosivocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryTipoArmaCodigo); + SubQuery subqueryUnidad = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapeso", "cunidadmedidapeso", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidad); + SubQuery subqueryUnidadCodigo = new SubQuery("TarmTipoArmaExplosivo", "unidadmedidapesocodigo", "cunidadmedidapesocodigo", "i.pk=t.ctipoarmaexplosivo"); + dto.addSubQuery(subqueryUnidadCodigo); + SubQuery subqueryUnidadMedida = new SubQuery("TgeneCatalogDetail", "description", "unidadmedida", "i.pk.catalog=t.unidadmedidacantidad and i.pk.catalogcode=t.unidadmedidacantidadcodigo"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subquerycpersoncode = new SubQuery("TarmRegistroArmas", "personcode", "personcode", "i.pk=t.cregistro"); + dto.addSubQuery(subquerycpersoncode); + SubQuery subqueryTipo = new SubQuery("TgeneCatalogDetail", "description", "tipo", "i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipo); + SubQuery subqueryTipoArmaExplosivo = new SubQuery("TgeneCatalogDetail", "description", "tipoarmaexplosivo", "i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + SubQuery subqueryClasecatalogo = new SubQuery("TgeneCatalogDetail", "description", "clase", "i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=t.ctipoarmaexplosivo)"); + dto.addSubQuery(subqueryClasecatalogo); + + return dto; + } + + @SuppressWarnings("unchecked") + protected void querydatabaseSimple() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql = " t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void remove() throws Exception { + if (record.getPk() == null) { + super.remove(); + } else { + ldeleteItems.add(this.record); + super.remove(); + } + } + + @Override + public void save() { + try { + if (registro.getTiporegistro().equals("IMP") && registro.isnew) { + TarmCarga aucpUsadoPrevio = CargaController.findByAUCP(registro.getSolicitudnum()); + if (aucpUsadoPrevio != null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_aucp_previamente_cargado")); + return; + } + } + if (this.getLrecord().isEmpty()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_carga_armas_inexistentes")); + return; + } + this.registroArmas.update(); + Request request = callerhelper.getRequest(); + this.registro.setPersoncode(usuario.getPk().getPersoncode()); + this.registro.setFechasolicitud(new java.sql.Date((new Date()).getTime())); + this.registro.setTiporegistrocodigo("TIPOREGISTRO"); +// this.registro.setPaisorigen("EC"); + this.registro.setFcreacion(new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + request.getModifiedData().put("LISTAARMAS", this.lrecord); + request.getModifiedData().put("LISTAARMASELIMINADAS", this.ldeleteItems); + request.getModifiedData().put("TIPOREGISTRO", this.registro.getTiporegistro()); + request.getModifiedData().put("REGISTRO", this.registro); + request.getModifiedData().put("PERSONCODE", usuario.getPk().getPersoncode()); + request.getModifiedData().put("ESNUEVAIMPORTACION", esNuevaImportacion); + carga.setCategoria(this.categoria); + request.getModifiedData().put("TARMCARGA", carga); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + isSave = Boolean.TRUE; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void saveArmaSolicitud() { + try { + + if (!isArmaDuplicada(record)) { + + record.getModifiedData().put("edit", "S"); + + this.registroArmas.update(); + update(); + if (!existeTipoArmaExplosivo) { + return; + } + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(Boolean.TRUE); // Para que el core devuelva el pk de los registros nuevos. + dtosave.setPosition(2); + HashMap msave = new HashMap(); + DtoSave dtoSaveRegistro = registroArmas.getDtoSave(); + dtoSaveRegistro.setIsForm(Boolean.TRUE); + dtoSaveRegistro.setReturnpk(Boolean.TRUE); + dtoSaveRegistro.setPosition(1); + + Request request = callerhelper.getRequest(); + request.setTransactionModule("30"); + request.setTransactionCode(15); + request.setTransactionVersion(1); + if (!verificaArmaExplosivo) { + request.put("eseliminacion", Constant.STR_Y); + } else { + msave.put(registroArmas.getBeanalias(), dtoSaveRegistro); + } + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.put("TIPODOC", this.getMfilelds().get("tipodoc")); + request.put("NUMDOC", this.getMfilelds().get("numdoc")); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.registroArmas.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } else { + record = null; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_armaDuplicada")); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void update() throws Exception { +// TgeneCatalogDetail estado = CatalogDetailController.findxCodigoCodcatalogo(record.getEstado(), record.getEstadocodigo()); + TgeneCatalogDetail marca = CatalogDetailController.findxCodigoCodcatalogo(record.getMarca(), record.getMarcacodigo()); +// record.getModifiedData().put("estado", estado.getDescription()); + isEnableCategoria = Boolean.FALSE; + record.setPartidaarancelariacodigo("PARTIDAARANCELARIA"); + record.setTipofabricacion("TIPOFABRICACION2"); + record.setTipofabricacioncodigo("TIPOFABRICACION"); + record.getModifiedData().put("marca", marca.getDescription()); + for (TgeneCatalogDetail color : lcolor) { + if (record.getColor() != null && record.getColor().equals(color.getPk().getCatalog())) { + record.getModifiedData().put("color", color.getDescription()); + break; + } + } + if (verificaArmaExplosivo) { + if (tipoArmaExplosivo == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionClase")); + existeTipoArmaExplosivo = Boolean.FALSE; + return; + } else { + this.record.setCtipoarmaexplosivo(tipoArmaExplosivo.getPk()); + record.getModifiedData().put("unidadMedidaCantidad", tipoArmaExplosivo.getUnidadmedidapeso()); + existeTipoArmaExplosivo = Boolean.TRUE; + } + } + super.update(); + } + + public Boolean existeDuplicidad() { + if (this.lrecord.contains(record)) { + return Boolean.TRUE; + } + return Boolean.FALSE; + } + + public void updateAutorizacion() throws Exception { + super.update(); + } + + /** + * Método que se ejecuta al carga edición + * + * @throws Exception + */ + public void loadEdit() throws Exception { + verificaArmaExplosivo = Boolean.TRUE; + if (record.getCountrycode() == null) { + record.setCountrycode("EC"); + } + if (record.getCtipoarmaexplosivo() == null) { + MessageHelper.setMessageError("NO ESTA ASOCIADO A UN TIPO DE ARMA EXPLOSIVO"); + return; + } + tipoArmaExplosivo = TiposArmasExplosivosController.findarma(record.getCtipoarmaexplosivo()); +// lprovincias = ProvinceController.find(record.getCountrycode()); +// executeProvince(); +// if(record.getProvincecode() != null){ +// lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); +// executeCanton(); +// } +// completaInfTipoArma(); + // Anade la descripcion del tipo de arma explosivo + if (tipoArmaExplosivo != null) { + this.clase = tipoArmaExplosivo.getClase(); + this.longitud = tipoArmaExplosivo.getLongitud(); + this.tipoarma = tipoArmaExplosivo.getTipoarmaexplosivo(); + this.calibre = tipoArmaExplosivo.getCalibre(); + } + verificarClaseArma(); + } + + @Override + public void create() throws Exception { + if (categoria != null) { + super.create(); + this.record.setEstadocodigo("ESTADOARMA"); + this.record.setMarcacodigo("MARCA"); + this.record.setCantidad(null); + this.record.setPeso(null); + this.lprovincias = ProvinceController.find(record.getCountrycode()); + this.executeProvince(); + this.bloquearUnidadCantidad = Boolean.TRUE; + this.bloquearUnidadPeso = Boolean.TRUE; + RequestContext.getCurrentInstance().execute("PF('dialog').show()"); + } else { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_categoriaRequerida")); + return; + } + } + + public void update(TarmArmas bean) throws Exception { + record = bean; + updateAutorizacion(); + } + + public void validacionDocumento(String numeroDocumento, String tipoDocumento) { + if (numeroDocumento == null || tipoDocumento == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselacedula")); + return; + } + TcustPersonDetail tcustPersonDetail = null; + if (tipoDocumento.equals(codigoCedula)) { +//----------validamos si es valida la CEDULA + if (!ValidateIdentification.cedula(numeroDocumento)) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en MAIA + tcustPersonDetail = buscarPersonaMaia(numeroDocumento, tipoDocumento); + } else if (tipoDocumento.equals(codigoRuc)) { +//----------validamos si es valida el RUC + if (!ValidateIdentification.ruc(numeroDocumento)) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalido")); + return; + } + //envia a buscar en maia + tcustPersonDetail = buscarPersonaMaia(numeroDocumento, tipoDocumento); + } else { +//----------si es PASAPORTE + tcustPersonDetail = buscarPersonaMaia(numeroDocumento, tipoDocumento); + } +// if(tcustPersonDetail==null){ +// nombreRazon=null; +//// numDoc=null; +// MessageHelper.setMessageError("La datos de la persona ingresada no existen, por favor crear primero la persona"); +// return; +// }else{ +// nombreRazon=tcustPersonDetail.getName(); +// } + } + + /** + * Método para validar si la persona existe en la BD de Maia + * + * @param numeroDocumento + * @param tipoDocumento + * @return TcustPersonDetail + */ + public TcustPersonDetail buscarPersonaMaia(String numeroDocumento, String tipoDocumento) { + return PersonDetailController.findxidentification(numeroDocumento, tipoDocumento); + } + + /** + * Busca un arma por código y estado + * + * @param armaCode código del arma + * @param estado estado del arma + * @return + */ + public static TarmArmas find(String armaCode, String estado) { + try { + + if (armaCode == null) { + return null; + } + InventariosController cc = new InventariosController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + if (estado != null) { + cc.addFilter("estado", estado); + cc.addFilter("estadocodigo", "ESTADOARMA"); + } + cc.querydatabaseArmas(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = new TarmTipoArmaExplosivo(); + tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if (tarmTipoArmaExplosivo != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null) { + cc.record.modifiedData().put("calibre", tarmTipoArmaExplosivo == null ? "" : Utilidades.formatearDecimalesEnTexto((CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription()), "#.000")); + } + cc.record.modifiedData().put("tipo", tarmTipoArmaExplosivo == null ? "" : CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription()); + cc.record.modifiedData().put("clase", tarmTipoArmaExplosivo == null ? "" : CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription()); + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + cc.record.modifiedData().put("pais", cc.record.getCpaisorigen() == null ? "" : CountryController.findcountry(cc.record.getCpaisorigen()).getDescription()); + + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * + * @param codigopersona + * @return + */ + public static TarmArmas findBySerieMarca(String serie, String marca) { + try { + InventariosController cc = new InventariosController(); + cc.init(); + cc.recperpage = 5000; + if (serie != null && !serie.isEmpty()) { + cc.addFilter("lote", serie); + } + cc.addFilter("marca", marca); + cc.querydatabaseSimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * + * @param armaCode + * @return + */ + public static TarmArmas findByPK(String cArma) { + try { + + InventariosController cc = new InventariosController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", cArma); + cc.querydatabaseSinFiltros(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + cc.record = cc.lrecord.get(0); + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if (tarmTipoArmaExplosivo != null) { + if (tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null) { + cc.record.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription() : ""); + } + if (tarmTipoArmaExplosivo.getTipoarmaexplosivo() != null && tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo() != null) { + cc.record.modifiedData().put("tipo", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription() : ""); + } + if (tarmTipoArmaExplosivo.getClase() != null && tarmTipoArmaExplosivo.getClasecodigo() != null) { + cc.record.modifiedData().put("clase", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription() : ""); + } + + TarmRegistroArmas registroArmas = new TarmRegistroArmas(); + TcustPersonDetail detallePersona = new TcustPersonDetail(); + if (cc.record.getCregistro() != null) { + registroArmas = RegistroArmController.findByCodigo(String.valueOf(cc.record.getCregistro())); + if (registroArmas != null) { + detallePersona = PersonDetailController.find(String.valueOf(registroArmas.getPersoncode())); + } + } + cc.record.modifiedData().put("razonsPropietario", registroArmas == null || detallePersona == null ? "" : detallePersona.getName()); + cc.record.modifiedData().put("documentoPropietario", registroArmas == null || detallePersona == null ? "" : detallePersona.getIdentification()); + + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * + * @param armaCode + * @return + */ + public static TarmArmas findPorCodigo(String armaCode) { + try { + + InventariosController cc = new InventariosController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + //cc.addFilter("REG", "ESTADOARMA"); + cc.querydatabaseArmas(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if (tarmTipoArmaExplosivo != null) { + if (tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null) { + cc.record.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription() : ""); + } + if (tarmTipoArmaExplosivo.getTipoarmaexplosivo() != null && tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo() != null) { + cc.record.modifiedData().put("tipo", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription() : ""); + } + if (tarmTipoArmaExplosivo.getClase() != null && tarmTipoArmaExplosivo.getClasecodigo() != null) { + cc.record.modifiedData().put("clase", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription() : ""); + } + + TarmRegistroArmas registroArmas = new TarmRegistroArmas(); + TcustPersonDetail detallePersona = new TcustPersonDetail(); + if (cc.record.getCregistro() != null) { + registroArmas = RegistroArmController.findByCodigo(String.valueOf(cc.record.getCregistro())); + if (registroArmas != null) { + detallePersona = PersonDetailController.find(String.valueOf(registroArmas.getPersoncode())); + } + } + cc.record.modifiedData().put("razonsPropietario", registroArmas == null || detallePersona == null ? "" : detallePersona.getName()); + cc.record.modifiedData().put("documentoPropietario", registroArmas == null || detallePersona == null ? "" : detallePersona.getIdentification()); + cc.record.modifiedData().put("marca", (cc.record == null || cc.record.getMarca() == null || cc.record.getMarca().isEmpty() || cc.record.getMarcacodigo() == null || cc.record.getMarcacodigo().isEmpty()) ? "" : CatalogDetailController.findxCodigoCodcatalogo(cc.record.getMarca(), cc.record.getMarcacodigo()).getDescription()); + + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca un arma por código + * + * @param armaCode + * @return + */ + public static TarmArmas findXCodigo(String armaCode) { + try { + + InventariosController cc = new InventariosController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + //cc.addFilter("REG", "ESTADOARMA"); + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + lcities = CityController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + } + } + + /** + * + * + * @param personCode + * @param estados estados del arma separados por coma + * @return Una lista de Armas encontradas + */ + public List findxPersona(Long personCode, String estados, String clase, String fechaCaducidad) { + List armasLista = null; + try { + armasLista = new ArrayList(); + InventariosController armas = new InventariosController(); + armas.init(); + armas.recperpage = 4000; + armas.addField("personcode", personCode); + if (this.getMfilelds().get("sancion") != null) { + armas.addField("sancion", this.getMfilelds().get("sancion")); + } + if (this.getMfilelds().get("TRAMITE") != null) { + armas.addField("TRAMITE", this.getMfilelds().get("TRAMITE")); + } + if (estados == null) { + armas.addFilter("estado", "REG"); + } else { + armas.addField("ESTADOS", estados); + } + if (clase != null && clase.trim().length() > 0) { + armas.addField("CLASEARMAS", clase); + } +// if(fechaCaducidad != null && fechaCaducidad .trim().length()>0){ +// armas.addField("FECHACADUCIDADARM", fechaCaducidad); +// } + armas.query(); + if (armas.getLrecord() != null && !armas.getLrecord().isEmpty()) { + armasLista.addAll(armas.getLrecord()); + } + + return armasLista; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return armasLista; + } + } + + /** + * Lista de Armas por Registro + * + */ + public static List findxRegistro(String registrocode) { + try { + InventariosController cc = new InventariosController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("cregistro", registrocode); + + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + for (TarmArmas item : cc.lrecord) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(item.getCtipoarmaexplosivo()); + item.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription()); + item.modifiedData().put("tipo", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription()); + item.modifiedData().put("clase", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription()); + item.modifiedData().put("longitud", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getLongitud(), tarmTipoArmaExplosivo.getLongitudcodigo()).getDescription()); + } + + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Abre el LOV de la clase del arma + */ + public void openLovClase() { + Map> params = new HashMap>(); + ClaseLovController.openLov(params); + } + + /** + * Regresa del LOV de armas + * + * @param event + */ + public void onReturnClase(SelectEvent event) { + TgeneCatalogDetail clase = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("clase", clase.getDescription()); + this.clase = clase.getPk().getCatalog(); + this.verificarClaseArma(); + } + + /** + * Abre el LOV de la clase del arma + */ + public void openArmaExplosivoLov() { + + this.record.getModifiedData().put("longitud", null); + this.record.getModifiedData().put("tipoarmaexplosivo", null); + this.record.getModifiedData().put("calibre", null); + // descripcionUnidadpeso=null; + Map> params = new HashMap<>(); + List lcategoriaParam = new ArrayList<>(); + lcategoriaParam.add(categoria); + params.put("categoria", lcategoriaParam); + ArmaExplosivoLovController.openLov(params); + + } + + /** + * Abre el LOV de busqueda de importaciones por codigo solicitud (AUCP) + */ + public void openCargaPrevia() { + Map> params = new HashMap<>(); + List lPersoncodeParam = new ArrayList<>(); + lPersoncodeParam.add(usuario.getPk().getPersoncode().toString()); + params.put("personcode", lPersoncodeParam); + CargasLovController.openLov(params); + } + + /** + * Regresa del LOV de armas + * + * @param event + */ + public void onReturnArmaExplosivo(SelectEvent event) { + tipoArmaExplosivo = (TarmTipoArmaExplosivo) event.getObject(); + //Setear descripciones a presentarse + this.record.getModifiedData().put("clase", tipoArmaExplosivo.getModifiedData().get("nclase")); + this.record.getModifiedData().put("tipoarmaexplosivo", tipoArmaExplosivo.getModifiedData().get("ntipo")); + this.record.getModifiedData().put("longitud", tipoArmaExplosivo.getModifiedData().get("nlongitud")); + this.record.getModifiedData().put("calibre", tipoArmaExplosivo.getModifiedData().get("ncalibre")); + // Setear valores en las variables correspondientes + if (tipoArmaExplosivo != null) { + this.clase = tipoArmaExplosivo.getClase(); + this.longitud = tipoArmaExplosivo.getLongitud(); + this.tipoarma = tipoArmaExplosivo.getTipoarmaexplosivo(); + this.calibre = tipoArmaExplosivo.getCalibre(); + this.record.setUnidadmedidacantidad(tipoArmaExplosivo.getUnidadmedidapeso()); + } + this.verificarClaseArma(); + // valida cantidad para registro de produccion + cantidadTxt.setValue(null); + if (registro.getTiporegistro().equals("PRO")) { + if ((this.clase.equals("0010000001") || this.clase.equals("0010000004") || this.clase.equals("0010000008")) && this.bloquearUnidadPeso) { + cantidadTxt.setValue("1"); + cantidadTxt.setDisabled(true); + } + } + } + + /** + * Regresa del LOV de carga + * + * @param event + */ + public void onReturnCarga(SelectEvent event) { + System.out.println("Retorno del lov carga"); + isSelectAucpPrevio = Boolean.TRUE; + carga = (TarmCarga) event.getObject(); + this.categoria = carga.getCategoria(); + this.isEnableCategoria = Boolean.FALSE; + carga.setIsnew(Boolean.FALSE); + registro = RegistroArmController.findByCodigo(carga.getCregistro().toString()); + registro.setIsnew(Boolean.FALSE); + TgeneCountry paisOrigen = CountryController.findcountry(registro.getPaisorigen()); + registro.getModifiedData().put("paisorigen", paisOrigen != null ? paisOrigen.getDescription() : ""); + // Provincia + TgeneProvince provinciaTmp = ProvinceController.findPorCodigo("EC", carga.getProvincecode()).get(0); + if (provinciaTmp != null) { + carga.getModifiedData().put("provinceCode", provinciaTmp.getDescription()); + } + // Canton + TgeneCanton cantonTmp = CantonController.findPorCodigo("EC", carga.getProvincecode(), carga.getCantoncode()).get(0); + if (cantonTmp != null) { + carga.getModifiedData().put("cantonCode", cantonTmp.getDescription()); + } + // Ciudad + TgeneCity ciudadTmp = CityController.findPorCodigo("EC", carga.getProvincecode(), carga.getCantoncode(), carga.getCitycode()).get(0); + if (ciudadTmp != null) { + carga.getModifiedData().put("cityCode", ciudadTmp.getDescription()); + } + + lrecord = ArmasController.findxRegistro(registro.getPk().toString()); + if (lrecord == null) { + this.lrecord = new ArrayList(); + } + + } + + /** + * Método en el cual se determina si se bloquea unidad o cantidad al + * momento de cargar los datos del arma + * + * @param clase + */ + private void verificarClaseArma() { + if (tipoArmaExplosivo != null) { + TgeneCatalogDetail unidadesCatalog = CatalogDetailController.findCatalogo(tipoArmaExplosivo.getUnidadmedidapesocodigo(), tipoArmaExplosivo.getUnidadmedidapeso()); + if (unidadesCatalog != null && unidadesCatalog.getLegalcode().equals("CANTIDAD")) { + this.record.getModifiedData().put("unidadMedidaCantidad", tipoArmaExplosivo.getUnidadmedidapeso()); + this.record.getModifiedData().put("unidadMedidaPeso", null); + this.bloquearUnidadCantidad = Boolean.FALSE; + this.bloquearUnidadPeso = Boolean.TRUE; + this.record.setPeso(null); + } else if (unidadesCatalog != null && unidadesCatalog.getLegalcode().equals("PESO")) { + this.record.getModifiedData().put("unidadMedidaCantidad", null); + this.record.getModifiedData().put("unidadMedidaPeso", tipoArmaExplosivo.getUnidadmedidapeso()); + this.bloquearUnidadCantidad = Boolean.TRUE; + this.bloquearUnidadPeso = Boolean.FALSE; + this.record.setCantidad(null); + } else { + this.record.getModifiedData().put("unidadMedidaCantidad", null); + this.record.getModifiedData().put("unidadMedidaPeso", null); + this.bloquearUnidadCantidad = Boolean.TRUE; + this.bloquearUnidadPeso = Boolean.TRUE; + } + } + } + + /** + * Abre el LOV de la longitud del arma + */ + public void openLovLongitud() { + Map> params = new HashMap>(); + LongitudLovController.openLov(params); + } + + /** + * Regresa del LOV de longitud + * + * @param event + */ + public void onReturnLongitud(SelectEvent event) { + TgeneCatalogDetail longitud = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("longitud", longitud.getDescription()); + this.longitud = longitud.getPk().getCatalog(); + } + + /** + * Abre el LOV del tipo de arma + */ + public void openLovTipoArma() { + Map> params = new HashMap>(); + TipoArmaExpLovController.openLov(params); + } + + /** + * Regresa del LOV de tipo de arma + * + * @param event + */ + public void onReturnTipoArma(SelectEvent event) { + TgeneCatalogDetail tipoArma = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("tipoarmaexplosivo", tipoArma.getDescription()); + this.tipoarma = tipoArma.getPk().getCatalog(); + } + + /** + * Abre el LOV de Calibre + */ + public void openLovCalibre() { + Map> params = new HashMap>(); + CalibreLovController.openLov(params); + } + + /** + * Regresa del LOV del calibre + * + * @param event + */ + public void onReturnCalibre(SelectEvent event) { + TgeneCatalogDetail calibre = (TgeneCatalogDetail) event.getObject(); + this.record.getModifiedData().put("calibre", calibre.getDescription()); + this.calibre = calibre.getPk().getCatalog(); + } + + /** + * Abre el LOV cambio de usuario + */ + public void openLovCambioUsuario() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Acción de retorno de la selección del usuario + * + * @param event de retorno de la selección + */ + public void onReturnCambioUsuario(SelectEvent event) { + nuevoPropietarioArma = (TcustPersonDetail) event.getObject(); + } + + /** + * Abre el dialog del cambio de persona + */ + public void abrirDialogCambio() { + this.nuevoPropietarioArma = null; + } + + /** + * Se cambia el propietario del arma + */ + public void cambiarArmaUsuario() { + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.setTransactionModule("30"); + request.setTransactionCode(151); + request.setTransactionVersion(1); + request.put("ARMAACTUAL", this.record); + request.put("NUEVAPERSONA", this.nuevoPropietarioArma); + Response response = callerHelper.executeSave(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(response); + this.querydatabase(); + } else { + MessageHelper.setMessageError(response); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Carga las listas de cantones y limpia la lista de ciudades + */ + public void seleccionarProvincia() { + try { +// codigoProvincia=this.record.getProvincecode(); + lcantones = CantonController.find("EC", carga.getProvincecode()); + lciudades = new ArrayList<>(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Carga las listas de ciudades + */ + public void seleccionarCanton() { + try { +// codigoCanton = this.record.getCantoncode(); + lciudades = CityController.find("EC", carga.getProvincecode(), carga.getCantoncode()); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if (Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")) { + valorColocar = Boolean.TRUE; + } + for (TarmArmas guardias : lrecord) { + guardias.getModifiedData().put("seleccionado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para obtener el listado de las armas por la serie/lote + * + * @param serieLote + * @return + */ + public static List findxSerieLote(String serieLote) { + try { + InventariosController cc = new InventariosController(); + cc.init(); + cc.recperpage = 1000; + cc.addFilter("lote", serieLote); + cc.querydatabaseFechaMax(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para obtener los codigos + */ + private static String codigos(String parametro) { + TgeneParameters tgeneParameters = ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + @SuppressWarnings("unchecked") + protected void querydatabaseFechaMax() { + try { + DtoQuery dto = this.getDtoQuery(); + dto.setOrderby("pk"); + String codigoEstadoIncautada = codigos("CODIGO.INCAUTADA"); + String codigoEstadoDecomisada = codigos("CODIGO.DECOMISADA"); + String codigoEstadoVendida = codigos("CODIGO.VENDIDA"); + String codigoEstadoMatPrima = codigos("CODIGO.MATERIAPRIMA"); + Filter filtro = new Filter(); + String sql = "t.fecharegistro=(select max(ta.fecharegistro) from TarmArmas ta where t.codigoarma=ta.codigoarma and t.cregistro=ta.cregistro)"//and t.cregistro=ta.cregistro para el manejo de los explosivos + + " and t.estado !='DEST' and t.estado !='CDP' and t.estado !='" + codigoEstadoIncautada + "' and t.estado !='" + codigoEstadoDecomisada + "' and t.estado !='" + codigoEstadoVendida + "' and t.estado !='" + codigoEstadoMatPrima + "' "; + filtro.setSql(sql); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void actualizar(TarmArmas arma) throws Exception { + record = arma; + super.update(); + } + + /*Busca un arma por código + * @param armaCode + * @return + */ + public static TarmArmas findxCodigo(String armaCode) { + try { + + InventariosController cc = new InventariosController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", armaCode); + cc.querydatabaseArmas(); + cc.getRecord().getModifiedData().put("lmarca", cc.getLmarca()); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public TiposArmasExplosivosController getTiposArmasExplosivosController() { + return tiposArmasExplosivosController; + } + + public void setTiposArmasExplosivosController( + TiposArmasExplosivosController tiposArmasExplosivosController) { + this.tiposArmasExplosivosController = tiposArmasExplosivosController; + } + + public RegistroArmController getRegistroArmas() { + return registroArmas; + } + + public void setRegistroArmas(RegistroArmController registroArmas) { + this.registroArmas = registroArmas; + } + +// public List getLtipoidentificacion() { +// return ltipoidentificacion; +// } +// +// +// public void setLtipoidentificacion(List ltipoidentificacion) { +// this.ltipoidentificacion = ltipoidentificacion; +// } +// +// +// public String getTipoDoc() { +// return tipoDoc; +// } +// +// +// public void setTipoDoc(String tipoDoc) { +// this.tipoDoc = tipoDoc; +// } +// public String getNumDoc() { +// return numDoc; +// } +// +// +// public void setNumDoc(String numDoc) { +// this.numDoc = numDoc; +// } +// public String getNombreRazon() { +// return nombreRazon; +// } +// +// +// public void setNombreRazon(String nombreRazon) { +// this.nombreRazon = nombreRazon; +// } + public List getLestadoarma() { + return lestadoarma; + } + + public void setLestadoarma(List lestadoarma) { + this.lestadoarma = lestadoarma; + } + + public List getLmarca() { + return lmarca; + } + + public void setLmarca(List lmarca) { + this.lmarca = lmarca; + } + + public List getLcolor() { + return lcolor; + } + + public void setLcolor(List lcolor) { + this.lcolor = lcolor; + } + + public List getLtipofabricacion() { + return ltipofabricacion; + } + + public void setLtipofabricacion(List ltipofabricacion) { + this.ltipofabricacion = ltipofabricacion; + } + +// public List getLcountry() { +// return lcountry; +// } +// +// +// public void setLcountry(List lcountry) { +// this.lcountry = lcountry; +// } + public List getLunidadmedidacantidad() { + return lunidadmedidacantidad; + } + + public void setLunidadmedidacantidad( + List lunidadmedidacantidad) { + this.lunidadmedidacantidad = lunidadmedidacantidad; + } + + public String getLongitud() { + return longitud; + } + + public void setLongitud(String longitud) { + this.longitud = longitud; + } + + public String getCalibre() { + return calibre; + } + + public void setCalibre(String calibre) { + this.calibre = calibre; + } + + public String getClase() { + return clase; + } + + public void setClase(String clase) { + this.clase = clase; + } + + public String getTipoarma() { + return tipoarma; + } + + public void setTipoarma(String tipoarma) { + this.tipoarma = tipoarma; + } + + public String getUnidadmedidapeso() { + return unidadmedidapeso; + } + + public void setUnidadmedidapeso(String unidadmedidapeso) { + this.unidadmedidapeso = unidadmedidapeso; + } + + public List getLunidadmedidapeso() { + return lunidadmedidapeso; + } + + public void setLunidadmedidapeso(List lunidadmedidapeso) { + this.lunidadmedidapeso = lunidadmedidapeso; + } + + public List getLprovincias() { + return lprovincias; + } + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public List getLparroquias() { + return lparroquias; + } + + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + public List getLcities() { + return lcities; + } + + public void setLcities(List lcities) { + this.lcities = lcities; + } + + public boolean isExisteTipoArmaExplosivo() { + return existeTipoArmaExplosivo; + } + + public void setExisteTipoArmaExplosivo(boolean existeTipoArmaExplosivo) { + this.existeTipoArmaExplosivo = existeTipoArmaExplosivo; + } + + public boolean isVerificaArmaExplosivo() { + return verificaArmaExplosivo; + } + + public void setVerificaArmaExplosivo(boolean verificaArmaExplosivo) { + this.verificaArmaExplosivo = verificaArmaExplosivo; + } + + public boolean isBloquearUnidadCantidad() { + return bloquearUnidadCantidad; + } + + public void setBloquearUnidadCantidad(boolean bloquearUnidadCantidad) { + this.bloquearUnidadCantidad = bloquearUnidadCantidad; + } + + public boolean isBloquearUnidadPeso() { + return bloquearUnidadPeso; + } + + public void setBloquearUnidadPeso(boolean bloquearUnidadPeso) { + this.bloquearUnidadPeso = bloquearUnidadPeso; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public TarmTipoArmaExplosivo getTipoArmaExplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoArmaExplosivo(TarmTipoArmaExplosivo tipoArmaExplosivo) { + this.tipoArmaExplosivo = tipoArmaExplosivo; + } + + protected void querydatabaseArmas() { + try { + DtoQuery dto = this.getDtoQuery(); + + dto.setOrderby("pk"); + if (this.getMfilelds().get("ESTADOS") != null) { + Filter filtroEstados = new Filter(); + String[] estados = this.getMfilelds().get("ESTADOS").toString().split(","); + StringBuffer sqlEstados = new StringBuffer(" t.estado IN ("); + for (int i = 0; i < estados.length; i++) { + sqlEstados.append("'").append(estados[i]).append("'"); + if (i < estados.length - 1) { + sqlEstados.append(","); + } + } + sqlEstados.append(")"); + filtroEstados.setSql(sqlEstados.toString()); + dto.addFiltro(filtroEstados); + } else { + //se discrima las armas que sean distintas de destruidas y cambio de propietario + Filter filtro = new Filter(); + String sql = " t.estado !='DEST' and t.estado !='CDP'"; + filtro.setSql(sql); + dto.addFiltro(filtro); + } + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "ARMASCOMPLETE"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public TcustPersonDetail getNuevoPropietarioArma() { + return nuevoPropietarioArma; + } + + public void setNuevoPropietarioArma(TcustPersonDetail nuevoPropietarioArma) { + this.nuevoPropietarioArma = nuevoPropietarioArma; + } + + /** + * Busca un arma por código + * + * @param armaCode + * @return + */ + public static TarmArmas findXCodigoArma(String armaCode) { + try { + InventariosController cc = new InventariosController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("codigoarma", armaCode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + @SuppressWarnings("unchecked") + public void querydatabasesimple() { + try { + DtoQuery dto = this.getDtoQuery(); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void querydatabaseArmaDuplicada(TarmArmas armaObj) { + try { + DtoQuery dto = this.getDtoQuery(); + + Filter filtro = new Filter(); + filtro.setSql("t.marca='" + armaObj.getMarca() + "' and t.marcacodigo='" + armaObj.getMarcacodigo() + "' and upper(t.lote)='" + armaObj.getLote().toUpperCase() + "'"); + dto.addFiltro(filtro); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static TarmArmas findSimple(String carma) { + try { + InventariosController cc = new InventariosController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", carma); + cc.querydatabasesimple(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static Boolean isArmaDuplicada(TarmArmas armaObj) { + Boolean isDuplicada = Boolean.FALSE; + InventariosController cc; + try { + cc = new InventariosController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabaseArmaDuplicada(armaObj); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + for (TarmArmas armaTmp : cc.lrecord) { + TarmTipoArmaExplosivo tipoArmaExpTmp = TiposArmasExplosivosController.findarma(armaTmp.getCtipoarmaexplosivo()); + TgeneCatalogDetail claseTmp = CatalogDetailController.findCatalogo(tipoArmaExpTmp.getClasecodigo(), tipoArmaExpTmp.getClase()); + TgeneCatalogDetail tipoArmaTmp = CatalogDetailController.findCatalogo(tipoArmaExpTmp.getTipoarmaexplosivocodigo(), tipoArmaExpTmp.getTipoarmaexplosivo()); + TgeneCatalogDetail calibreTmp = CatalogDetailController.findCatalogo(tipoArmaExpTmp.getCalibrecodigo(), tipoArmaExpTmp.getCalibre()); + // Valido la clase, tipoarma y calibre solo para armas de fuego y armas no letales + if (claseTmp.getPk().getCatalog().equals("0010000001") || claseTmp.getPk().getCatalog().equals("0010000008")) { + if (armaObj.getModifiedData().get("clase") != null && armaObj.getModifiedData().get("tipoarmaexplosivo") != null) { + if (armaObj.getModifiedData().get("clase").toString().equalsIgnoreCase(claseTmp != null ? claseTmp.getDescription() : "") + && armaObj.getModifiedData().get("tipoarmaexplosivo").toString().equalsIgnoreCase(tipoArmaTmp != null ? tipoArmaTmp.getDescription() : "")) { + if (armaObj.getModifiedData().get("calibre") != null && calibreTmp != null && armaObj.getModifiedData().get("calibre").toString().equalsIgnoreCase(calibreTmp.getDescription())) { + isDuplicada = Boolean.TRUE; + break; + } + } + } else { + MessageHelper.setMessageError("CLASE Y/O TIPO DE ARMA EXPLOSIVO INCORRECTOS"); + } + } + } + + } + return isDuplicada; + } catch (Exception e) { + // TODO Auto-generated catch block + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmArmas find(String carma) { + try { + + InventariosController cc = new InventariosController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("pk", carma); + cc.querydatabasesimple(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TarmTipoArmaExplosivo tarmTipoArmaExplosivo = TiposArmasExplosivosController.findarma(cc.lrecord.get(0).getCtipoarmaexplosivo()); + if (tarmTipoArmaExplosivo != null) { + if (tarmTipoArmaExplosivo.getCalibre() != null && tarmTipoArmaExplosivo.getCalibrecodigo() != null) { + cc.record.modifiedData().put("calibre", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getCalibre(), tarmTipoArmaExplosivo.getCalibrecodigo()).getDescription() : ""); + } + if (tarmTipoArmaExplosivo.getTipoarmaexplosivo() != null && tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo() != null) { + cc.record.modifiedData().put("tipo", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getTipoarmaexplosivo(), tarmTipoArmaExplosivo.getTipoarmaexplosivocodigo()).getDescription() : ""); + } + if (tarmTipoArmaExplosivo.getClase() != null && tarmTipoArmaExplosivo.getClasecodigo() != null) { + cc.record.modifiedData().put("clase", CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tarmTipoArmaExplosivo.getClase(), tarmTipoArmaExplosivo.getClasecodigo()).getDescription() : ""); + } + TarmRegistroArmas registroArmas = new TarmRegistroArmas(); + TcustPersonDetail detallePersona = new TcustPersonDetail(); + if (cc.record.getCregistro() != null) { + registroArmas = RegistroArmController.findByCodigo(String.valueOf(cc.record.getCregistro())); + if (registroArmas != null) { + detallePersona = PersonDetailController.find(String.valueOf(registroArmas.getPersoncode())); + } + } + cc.record.modifiedData().put("razonsPropietario", registroArmas == null || detallePersona == null ? "" : detallePersona.getName()); + cc.record.modifiedData().put("documentoPropietario", registroArmas == null || detallePersona == null ? "" : detallePersona.getIdentification()); + cc.record.modifiedData().put("marca", (cc.record == null || cc.record.getMarca() == null || cc.record.getMarca().isEmpty() || cc.record.getMarcacodigo() == null || cc.record.getMarcacodigo().isEmpty()) ? "" : CatalogDetailController.findxCodigoCodcatalogo(cc.record.getMarca(), cc.record.getMarcacodigo()).getDescription()); + cc.record.modifiedData().put("seleccion", Boolean.FALSE); + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public TgeneCatalogDetail getTipoDocumento() { + return tipoDocumento; + } + + public void setTipoDocumento(TgeneCatalogDetail tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } + + public TcustPersonDetail getDetallesPersona() { + return detallesPersona; + } + + public void setDetallesPersona(TcustPersonDetail detallesPersona) { + this.detallesPersona = detallesPersona; + } + + public List getTiposRegistro() { + return tiposRegistro; + } + + public void setTiposRegistro(List tiposRegistro) { + this.tiposRegistro = tiposRegistro; + } + + public TcustPersonDetail getUsuario() { + return usuario; + } + + public void setUsuario(TcustPersonDetail usuario) { + this.usuario = usuario; + } + + public List getLdocumentospersona() { + return ldocumentospersona; + } + + public void setLdocumentospersona( + List ldocumentospersona) { + this.ldocumentospersona = ldocumentospersona; + } + +// public TarmRegistroArmas getRegistro() { +// return registro; +// } +// +// public void setRegistro(TarmRegistroArmas registro) { +// this.registro = registro; +// } + public List getLpaises() { + return lpaises; + } + + public void setLpaises(List lpaises) { + this.lpaises = lpaises; + } + + public List getLciudades() { + return lciudades; + } + + public void setLciudades(List lciudades) { + this.lciudades = lciudades; + } + + public List getLaeropuertos() { + return laeropuertos; + } + + public void setLaeropuertos(List laeropuertos) { + this.laeropuertos = laeropuertos; + } + + public String getCodigoProvincia() { + return codigoProvincia; + } + + public void setCodigoProvincia(String codigoProvincia) { + this.codigoProvincia = codigoProvincia; + } + + public String getCodigoCanton() { + return codigoCanton; + } + + public void setCodigoCanton(String codigoCanton) { + this.codigoCanton = codigoCanton; + } + + public TarmRegistroArmas getRegistro() { + return registro; + } + + public void setRegistro(TarmRegistroArmas registro) { + this.registro = registro; + } + + public String getCategoria() { + return categoria; + } + + public void setCategoria(String categoria) { + this.categoria = categoria; + } + + public Boolean getEstadoDesaduanizado() { + return estadoDesaduanizado; + } + + public void setEstadoDesaduanizado(Boolean estadoDesaduanizado) { + this.estadoDesaduanizado = estadoDesaduanizado; + } + + public Boolean getEsNuevaImportacion() { + return esNuevaImportacion; + } + + public void setEsNuevaImportacion(Boolean esNuevaImportacion) { + this.esNuevaImportacion = esNuevaImportacion; + } + + public String getFilterAUCP() { + return filterAUCP; + } + + public void setFilterAUCP(String filterAUCP) { + this.filterAUCP = filterAUCP; + } + + public TarmCarga getCarga() { + return carga; + } + + public void setCarga(TarmCarga carga) { + this.carga = carga; + } + + public Boolean getIsSelectAucpPrevio() { + return isSelectAucpPrevio; + } + + public void setIsSelectAucpPrevio(Boolean isSelectAucpPrevio) { + this.isSelectAucpPrevio = isSelectAucpPrevio; + } + + public Boolean getIsSave() { + return isSave; + } + + public void setIsSave(Boolean isSave) { + this.isSave = isSave; + } + + public InputNumber getCantidadTxt() { + return cantidadTxt; + } + + public void setCantidadTxt(InputNumber cantidadTxt) { + this.cantidadTxt = cantidadTxt; + } + + public List getLpartidaArancelaria() { + return lpartidaArancelaria; + } + + public void setLpartidaArancelaria(List lpartidaArancelaria) { + this.lpartidaArancelaria = lpartidaArancelaria; + } + + public Boolean getIsEnableCategoria() { + return isEnableCategoria; + } + + public void setIsEnableCategoria(Boolean isEnableCategoria) { + this.isEnableCategoria = isEnableCategoria; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/InvoiceHistoryController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/InvoiceHistoryController.java new file mode 100644 index 0000000..dd7280b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/InvoiceHistoryController.java @@ -0,0 +1,88 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package com.fp.frontend.controller.armas.solicitud; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmInvoiceHistory; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +/** + * + * @author developer2 + */ +@ManagedBean +@ViewScoped +public class InvoiceHistoryController extends AbstractController{ + private static final long serialVersionUID = 1L; + public InvoiceHistoryController() throws Exception { + super(TarmInvoiceHistory.class); + } + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + // + //super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + + } + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "INVOICEHISTORYS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void update(TarmInvoiceHistory bean) { + try { + this.record = bean; + super.update(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/MantenimientoDocumentosAlfrescoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/MantenimientoDocumentosAlfrescoController.java new file mode 100644 index 0000000..569995e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/MantenimientoDocumentosAlfrescoController.java @@ -0,0 +1,282 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.menu.MenuController; +import com.fp.frontend.controller.security.ProfileController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmDocumentoAlfresco; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeProfile; + +/** + * Controlador principal del mantenimiento de documentos alfresco + * + * @author Manuel Cepeda + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class MantenimientoDocumentosAlfrescoController extends AbstractController { + + @ManagedProperty(value = "#{menuController}") + private MenuController menuController; + + /** + * Lista de perfiles asociados al usuario que hace login a la aplicacion. + */ + private List lprofile; + + /** + * Listado de estados del arma + */ + private List ltipodocumento; + + /** + * Listado de estados del arma + */ + private List ldocumento; + + private String[] selectedDocumentos; + + public MantenimientoDocumentosAlfrescoController() throws Exception { + super(TarmDocumentoAlfresco.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + setLprofile(ProfileController.find()); + querydatabase(); + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + record = new TarmDocumentoAlfresco(); + beanalias = "DOCUMENTOALFRESCO"; + ltipodocumento = CatalogDetailController.find("TIPODOCUMENTO"); + ldocumento = CatalogDetailController.find("DOCUMENTO"); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("pk"); + + // subqueries 1 + SubQuery subqueryPerfil = new SubQuery("TsafeProfile", "description", "perfilDescription", "i.pk = t.perfil"); + dto.addSubQuery(subqueryPerfil); + + SubQuery subqueryTipoDocumento = new SubQuery("TgeneCatalogDetail", "description", "tipoDocumento", "i.pk.catalog=t.catalogo and i.pk.catalogcode=t.catalogoCode"); + dto.addSubQuery(subqueryTipoDocumento); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + request.put("queryalias", "DOCUMENTOALFRESCOCOMPLETE"); + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /*/ + * Permite obtener elementos de la entidad TarmDocumentoAlfresco dado el perfil + */ + public static List findByProfile(String perfil) { + try { + MantenimientoDocumentosAlfrescoController cc = new MantenimientoDocumentosAlfrescoController(); + cc.init(); + cc.recperpage = 5000; + cc.addFilter("perfil", perfil); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + @Override + public void next() throws Exception { + // TODO Auto-generated method stub + super.next(); + } + + @Override + public void save() { + try { + List listaNueva = new ArrayList<>(); + for (TarmDocumentoAlfresco tarmDocumentoAlfresco : lrecord) { + for (TarmDocumentoAlfresco documentoAlfresco : listaNueva) { + if (tarmDocumentoAlfresco.getModifiedData().get("perfilDescription").equals(documentoAlfresco.getModifiedData().get("perfilDescription")) + && tarmDocumentoAlfresco.getModifiedData().get("tipoDocumento").equals(documentoAlfresco.getModifiedData().get("tipoDocumento"))) { + MessageHelper.setMessageError(" Ya se encuentra creada una combinacin: " + tarmDocumentoAlfresco.getModifiedData().get("perfilDescription") + " - " + tarmDocumentoAlfresco.getModifiedData().get("tipoDocumento")); + return; + } + } + listaNueva.add(tarmDocumentoAlfresco); + } + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void update() throws Exception { + record.setCatalogoCode("TIPODOCUMENTO"); + record.setDocumento(""); + if (menuController.findPerfil(record.getPerfil()) != null) { + record.getModifiedData().put("perfilDescription", menuController.findPerfil(record.getPerfil()).getDescription()); + } + if (CatalogDetailController.findxCodigoCodcatalogo(record.getCatalogo(), record.getCatalogoCode()) != null) { + record.getModifiedData().put("tipoDocumento", CatalogDetailController.findxCodigoCodcatalogo(record.getCatalogo(), record.getCatalogoCode()).getDescription()); + } + for (String documento : selectedDocumentos) { + if (record.getDocumento() == null || "".equals(record.getDocumento())) { + record.setDocumento(documento); + } else { + record.setDocumento(record.getDocumento() + ", " + documento); + } + + } + super.update(); + } + + public void updateAutorizacion() throws Exception { + super.update(); + } + + /** + * Método que se ejecuta al carga edición + * + * @throws Exception + */ + public void loadEdit() throws Exception { + setSelectedDocumentos(record.getDocumento().split(", ")); + } + + @Override + public void create() throws Exception { + setSelectedDocumentos(null); + super.create(); + } + + public void update(TarmDocumentoAlfresco bean) throws Exception { + record = bean; + updateAutorizacion(); + } + + public void actualizar(TarmDocumentoAlfresco arma) throws Exception { + record = arma; + super.update(); + } + + public List getLprofile() { + return lprofile; + } + + public void setLprofile(List lprofile) { + this.lprofile = lprofile; + } + + public MenuController getMenuController() { + return menuController; + } + + public void setMenuController(MenuController menuController) { + this.menuController = menuController; + } + + public List getLtipodocumento() { + return ltipodocumento; + } + + public void setLtipodocumento(List ltipodocumento) { + this.ltipodocumento = ltipodocumento; + } + + public List getLdocumento() { + return ldocumento; + } + + public void setLdocumento(List ldocumento) { + this.ldocumento = ldocumento; + } + + /** + * @return the selectedDocumentos + */ + public String[] getSelectedDocumentos() { + return selectedDocumentos; + } + + /** + * @param selectedDocumentos the selectedDocumentos to set + */ + public void setSelectedDocumentos(String[] selectedDocumentos) { + this.selectedDocumentos = selectedDocumentos; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ModificarPlanificacionInspeccionController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ModificarPlanificacionInspeccionController.java new file mode 100644 index 0000000..463cbee --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ModificarPlanificacionInspeccionController.java @@ -0,0 +1,514 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.ins.TarmPlanificacionInspeccion; +import com.fp.persistence.parmas.ins.TarmPlanificacionTramite; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ModificarPlanificacionInspeccionController extends AbstractController { + + private TarmCentroControl centroControl; + + private String nombreCentroControl; + + private TarmCentroControlJur jurisdiccionCentroControl; + + private Boolean planificacionSalvada = false; + + // Codigo de planificacion (Variable de flujo) + private Long cplanificacion; + + private List listaMeses = new ArrayList(); + + private List listaAnnos = new ArrayList(); + + List planificaciones; + + @ManagedProperty(value = "#{planificacionTramiteController}") + private PlanificacionTramiteController planificacionTramiteController; + + @ManagedProperty(value = "#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitanteController; + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddressController; + /** + * Atibuto para la habilitacion del boton de completar la tarea del flujo + */ + private Boolean btnFlujo; + + public ModificarPlanificacionInspeccionController() throws Exception { + super(TarmPlanificacionInspeccion.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + try { + this.startQuery(); + this.init(); + super.query(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + if (super.getMfilters().get("cplanificacion") != null) { + cplanificacion = Long.parseLong(super.getMfilters().get("cplanificacion").toString()); + } + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + record = new TarmPlanificacionInspeccion(); + beanalias = "MODIFICARPLANIFICACIONCONTROLLER"; + btnFlujo = Boolean.FALSE; + this.planificacionTramiteController = new PlanificacionTramiteController(); + this.planificacionTramiteController.setLrecord(new ArrayList()); + + //Quemando el codigo de planificacion + //this.cplanificacion=99L; + //Obteniendo la planificacion + if (this.cplanificacion != null) { + this.record = PlanificacionInspeccionController.findPorCodigo(this.cplanificacion); + + if (this.record != null) { + // Obteniendo el centro de control + this.centroControl = CentroControlArmasController.findPorCodigo(this.record.getCcentrocontrol()); + this.nombreCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), + centroControl.getNombreinstitucioncodigo()).getDescription(); + + //Obteniendo los tramites + this.planificacionTramiteController.setCplanificacion(this.record.getPk()); + this.planificacionTramiteController.setRecperpage(4000); + this.planificacionTramiteController.querydatabaseAprobacion(); + Collections.sort(planificacionTramiteController.getLrecord(), new Comparator() { + public int compare(TarmPlanificacionTramite p1, TarmPlanificacionTramite p2) { + return new Long(p1.getMesnumero()).compareTo(p2.getMesnumero()); + } + }); + } + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void query() throws Exception { + // TODO Auto-generated method stub + MessageHelper.setMessageError("msg_notQuery"); + super.query(); + } + + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("anno desc"); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + // record=lrecord.get(0); + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + + request.getModifiedData().put("INSPECCIONES", this.planificacionTramiteController.getLrecord()); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.planificacionTramiteController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + this.planificacionSalvada = true; + btnFlujo = Boolean.TRUE; + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Metodo que carga los meses disponibles atendiendo a la fecha de + * expiracion del documento + * + * @param tramite + */ + public void cargarMeses(TarmPlanificacionTramite inspeccion) { + this.listaMeses.clear(); + Calendar calendario = Calendar.getInstance(); + Integer intmesnumero = calendario.get(Calendar.MONTH); + this.planificacionTramiteController.getRecord().setMesnumero(Long.parseLong(intmesnumero.toString())); + switch (calendario.get(Calendar.MONTH)) { + case 0: + listaMeses.add("Enero"); + listaMeses.add("Febrero"); + listaMeses.add("Marzo"); + listaMeses.add("Abril"); + listaMeses.add("Mayo"); + listaMeses.add("Junio"); + listaMeses.add("Julio"); + listaMeses.add("Agosto"); + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + break; + case 1: + listaMeses.add("Febrero"); + listaMeses.add("Marzo"); + listaMeses.add("Abril"); + listaMeses.add("Mayo"); + listaMeses.add("Junio"); + listaMeses.add("Julio"); + listaMeses.add("Agosto"); + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + break; + case 2: + listaMeses.add("Marzo"); + listaMeses.add("Abril"); + listaMeses.add("Mayo"); + listaMeses.add("Junio"); + listaMeses.add("Julio"); + listaMeses.add("Agosto"); + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + break; + case 3: + listaMeses.add("Abril"); + listaMeses.add("Mayo"); + listaMeses.add("Junio"); + listaMeses.add("Julio"); + listaMeses.add("Agosto"); + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + break; + case 4: + listaMeses.add("Mayo"); + listaMeses.add("Junio"); + listaMeses.add("Julio"); + listaMeses.add("Agosto"); + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + break; + case 5: + listaMeses.add("Junio"); + listaMeses.add("Julio"); + listaMeses.add("Agosto"); + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + break; + case 6: + listaMeses.add("Julio"); + listaMeses.add("Agosto"); + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + break; + case 7: + listaMeses.add("Agosto"); + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + break; + case 8: + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + break; + case 9: + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + break; + case 10: + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + break; + case 11: + inspeccion.setMes("Diciembre"); + break; + } + } + + /** + * Metodo que ordena las inspecciones por mes y por nombre Ordenamiento + * simple de burbujas + */ + public void ordenarPorMesNombre() { + try { + // Ordenando por mes + for (int i = 0; i < this.planificacionTramiteController.getLrecord().size() - 1; i++) { + for (int j = i + 1; j < this.planificacionTramiteController.getLrecord().size(); j++) { + // Verificando que la ispeccion en j tenga un mes anterior + // a la inspeccion en i + if (this.planificacionTramiteController.getLrecord().get(j).getMesnumero() < this.planificacionTramiteController.getLrecord() + .get(i).getMesnumero()) { + TarmPlanificacionTramite temp = this.planificacionTramiteController.getLrecord().get(j); + this.planificacionTramiteController.getLrecord().set(j, this.planificacionTramiteController.getLrecord().get(i)); + this.planificacionTramiteController.getLrecord().set(i, temp); + } + } + } + + // Ordenando por Nombre + for (int i = 0; i < this.planificacionTramiteController.getLrecord().size() - 1; i++) { + for (int j = i + 1; j < this.planificacionTramiteController.getLrecord().size(); j++) { + + // Obteniendo el documento en i + TarmDocumentoHabilitante documentoi = DocumentoHabilitanteController.findPorCodigo(this.planificacionTramiteController + .getLrecord().get(i).getCdocumento().toString()); + + // Obteniendo el documento en j + TarmDocumentoHabilitante documentoj = DocumentoHabilitanteController.findPorCodigo(this.planificacionTramiteController + .getLrecord().get(j).getCdocumento().toString()); + + // Obteniendo la persona en i + TcustPersonDetail personai = PersonDetailController.find(documentoi.getPersoncode().toString()); + + // Obteniendo la persona en j + TcustPersonDetail personaj = PersonDetailController.find(documentoj.getPersoncode().toString()); + + // Verificando que la ispeccion en j tenga un nombre menor + // a la inspeccion en i si la inspeccion es del mismo mes + if (this.planificacionTramiteController.getLrecord().get(i).getMesnumero() == this.planificacionTramiteController.getLrecord() + .get(j).getMesnumero() + && personaj.getName().toLowerCase().compareToIgnoreCase(personai.getName().toLowerCase()) < 0) { + TarmPlanificacionTramite temp = this.planificacionTramiteController.getLrecord().get(j); + this.planificacionTramiteController.getLrecord().set(j, this.planificacionTramiteController.getLrecord().get(i)); + this.planificacionTramiteController.getLrecord().set(i, temp); + } + } + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + if (!btnFlujo) { + MessageHelper.setMessageInfo("GUARDE LOS CAMBIOS"); + } + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("cplanificacion", this.cplanificacion); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + btnFlujo = false; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public PlanificacionTramiteController getPlanificacionTramiteController() { + return planificacionTramiteController; + } + + public void setPlanificacionTramiteController(PlanificacionTramiteController planificacionTramiteController) { + this.planificacionTramiteController = planificacionTramiteController; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getNombreCentroControl() { + return nombreCentroControl; + } + + public void setNombreCentroControl(String nombreCentroControl) { + this.nombreCentroControl = nombreCentroControl; + } + + public DocumentoHabilitanteController getDocumentoHabilitanteController() { + return documentoHabilitanteController; + } + + public void setDocumentoHabilitanteController(DocumentoHabilitanteController documentoHabilitanteController) { + this.documentoHabilitanteController = documentoHabilitanteController; + } + + public Boolean getPlanificacionSalvada() { + return planificacionSalvada; + } + + public void setPlanificacionSalvada(Boolean planificacionSalvada) { + this.planificacionSalvada = planificacionSalvada; + } + + public List getListaMeses() { + return listaMeses; + } + + public void setListaMeses(List listaMeses) { + this.listaMeses = listaMeses; + } + + public List getListaAnnos() { + return listaAnnos; + } + + public void setListaAnnos(List listaAnnos) { + this.listaAnnos = listaAnnos; + } + + public TarmCentroControlJur getJurisdiccionCentroControl() { + return jurisdiccionCentroControl; + } + + public void setJurisdiccionCentroControl(TarmCentroControlJur jurisdiccionCentroControl) { + this.jurisdiccionCentroControl = jurisdiccionCentroControl; + } + + public List getPlanificaciones() { + return planificaciones; + } + + public void setPlanificaciones(List planificaciones) { + this.planificaciones = planificaciones; + } + + public PersonAddressController getPersonAddressController() { + return personAddressController; + } + + public void setPersonAddressController(PersonAddressController personAddressController) { + this.personAddressController = personAddressController; + } + + public Long getCplanificacion() { + return cplanificacion; + } + + public void setCplanificacion(Long cplanificacion) { + this.cplanificacion = cplanificacion; + } + + public Boolean getBtnFlujo() { + return btnFlujo; + } + + public void setBtnFlujo(Boolean btnFlujo) { + this.btnFlujo = btnFlujo; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/NotificarEmisionDocumentoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/NotificarEmisionDocumentoController.java new file mode 100644 index 0000000..0b963cc --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/NotificarEmisionDocumentoController.java @@ -0,0 +1,555 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.date.TgeneNotAccountingDayController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.param.TarmTramitesAtendidos; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class NotificarEmisionDocumentoController extends AbstractController { + + private TgeneCatalogDetail detallecatalogo = new TgeneCatalogDetail(); + private TgeneCatalogDetail detallecatalogoTipoTramite = new TgeneCatalogDetail(); + private TgeneCatalogDetail usoActividad = new TgeneCatalogDetail(); + private TgeneCatalogDetail identificacion = new TgeneCatalogDetail(); + private TgeneCatalogDetail estadotramite = new TgeneCatalogDetail(); + private TarmSolicitudTramite solicitudTramite = new TarmSolicitudTramite(); + private TarmCentroControl centroControl = new TarmCentroControl(); + private TarmTramite tramite = new TarmTramite(); + private TarmSolicitud solicitud = new TarmSolicitud(); + private String codigoSolicitud = ""; + private boolean habilitarGrabar = false; + private boolean habilitarEnviar = false; + private boolean habilitarGeneraFecha; + + Date fechaNotificacion = null; + + @ManagedProperty(value = "#{solicitudTramiteController}") + private SolicitudTramiteController solicitudTramiteController; + + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{armasController}") + private ArmasController armas; + + public NotificarEmisionDocumentoController() throws Exception { + super(TarmTramitesAtendidos.class); + } + + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "NOTIFICAREMISIONDOCUMENTO"; + this.record = new TarmTramitesAtendidos(); + record.isnew = true; + habilitarGeneraFecha = false; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @PostConstruct + private void postconstruct() { + startQuery(); + this.init(); + cargarDatos(); + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + //xpathflujo=super.getMfilters().get("xpath");//"cm:Decomiso/cm:A-2014/cm:M-10/cm:ENV-000000319/cm:ENV-000000319.pdf";// + codigoSolicitud = super.getMfilters().get("csolicitud"); + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + if (fechaNotificacion == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_camponotificacion")); + return; + } + + record.setCcentrocontrol(centroControl.getPk()); + record.setCtramite(tramite.getPk()); + + java.sql.Date sFechaActual = new java.sql.Date(Calendar.getInstance().getTimeInMillis()); + + Calendar cal = Calendar.getInstance(); + cal.setTime(fechaNotificacion); + java.sql.Date sFechaNotificacion = new java.sql.Date(cal.getTimeInMillis()); + + record.setFechaatencion(sFechaNotificacion); + record.setFecharegistro(sFechaActual); + + this.update(); + + aprobarTramite(); + + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + dtosave.setPosition(1); + msave.put(beanalias, dtosave); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + + habilitarEnviar = true; + habilitarGrabar = false; + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute( + "Maia.refreshusertasks()"); + habilitarGeneraFecha = true; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + // validamos si cargamos los datos cuando apruebe + Map datosmail = new HashMap(); + + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail persona = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + SimpleDateFormat sdf1 = new SimpleDateFormat(MsgGeneral.getProperty("dateformat")); + datosmail.put("funcionario", persona == null ? "" : ((persona.getMilitarygrade() == null) ? "" : CatalogDetailController.findxCodigoCodcatalogo(persona.getMilitarygrade(), "MILITARYGRADE").getDescription()) + " " + persona.getName()); + datosmail.put("razons", (solicitud == null || solicitud.getModifiedData().get("nombre") == null) ? "" : solicitud.getModifiedData().get("nombre")); + datosmail.put("tramite", solicitudTramite.getNumerotramite()); + datosmail.put("centrocontrol", (centroControl == null || centroControl.getNombreinstitucion() == null || centroControl.getNombreinstitucioncodigo() == null) ? "" : CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + datosmail.put("fechanotificacion", sdf1.format(fechaNotificacion)); + + TarmTramite tramite = TarmTramiteController.find(String.valueOf(solicitud.getCtramite())); + datosmail.put("tipoTramite", (tramite == null || tramite.getModifiedData().get("tipotramite") == null) ? "" : tramite.getModifiedData().get("tipotramite")); + datosmail.put("tipoAutorizacion", (tramite == null || tramite.getModifiedData().get("tipoautorizacion") == null) ? "" : tramite.getModifiedData().get("tipoautorizacion")); + datosmail.put("usoactividad", (tramite == null || tramite.getModifiedData().get("usoactividad") == null) ? "" : tramite.getModifiedData().get("usoactividad")); + datosmail.put("categoria", (tramite == null || tramite.getModifiedData().get("categoria") == null) ? "" : tramite.getModifiedData().get("categoria")); + + request.modifiedData().put("TID", tid); + request.modifiedData().put("datosmail", datosmail); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + ponerEstadoRegistradoArmas(); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void ponerEstadoRegistradoArmas() { + try { + Boolean grabarCambioEstado = Boolean.FALSE; + List armasSolicitudLst = TarmSolicitudArmasController.findPorCSolicitud(codigoSolicitud); + for (TarmSolicitudArmas armaSolicitud : armasSolicitudLst) { + TarmArmas armaObj = ArmasController.findSimple(armaSolicitud.getPk().getCarma()); + if (armaObj.getEstado().equals("PREG")) { + armaObj.setIsnew(false); + armaObj.setEstado("APTA"); + armas.update(armaObj); + grabarCambioEstado = Boolean.TRUE; + // Cambia el estado del arma en caso de existir un estado posterior en el historial + TarmArmas armaUltimoEstadoObj = ArmasController.findXCodigoArma(armaObj.getCodigoarma()); + if (armaUltimoEstadoObj != null) { + armaUltimoEstadoObj.setIsnew(false); + armaUltimoEstadoObj.setEstado("APTA"); + armas.update(armaUltimoEstadoObj); + } + } + } + if (grabarCambioEstado) { + armas.save(); + } + + DtoSave dtoArmas = armas.getDtoSave(); + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + msave.put(armas.getBeanalias(), dtoArmas); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + armas.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + + try { + if (fechaNotificacion == null) { + return; + } + + DtoQuery dto = super.getDtoQuery(true); + Filter filtro = new Filter(); + Calendar cal = Calendar.getInstance(); + cal.setTime(fechaNotificacion); + java.sql.Date sFechaNotificacion = new java.sql.Date(cal.getTimeInMillis()); + + dto.addFiltro(new Filter("fechaatencion", ">=", sFechaNotificacion.toString())); + dto.addFiltro(filtro); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + /** + * Metodo para cargar los datos iniciales + */ + private void cargarDatos() { + try { + solicitud = SolicitudArmasController.find(codigoSolicitud); + solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(codigoSolicitud); + if (solicitudTramite != null && solicitudTramite.getPk().getCtramite() != null) { + tramite = TarmTramiteController.find(solicitudTramite.getPk().getCtramite().toString()); + estadotramite = (solicitudTramite.getEstadotramite() == null || solicitudTramite.getEstadotramitecodigo() == null) ? null : CatalogDetailController.findxCodigoCodcatalogo(solicitudTramite.getEstadotramite(), solicitudTramite.getEstadotramitecodigo()); + } + + if (tramite != null) { + detallecatalogo = (tramite.getCategoria() == null || tramite.getCategoriacodigo() == null) ? null : CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + detallecatalogoTipoTramite = (tramite.getTipoautorizacion() == null || tramite.getTipoautorizacioncodigo() == null) ? null : CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + usoActividad = (tramite.getUsoactividad() == null || tramite.getUsoactividadcodigo() == null) ? null : CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + } + + if (this.getLoginController() != null && 108 == this.getLoginController().getRequest().getTransactionCode() && "30".equals(getLoginController().getRequest().getTransactionModule())) { + TarmDocumentoHabilitante documentohabilitante = DocumentoHabilitanteController.findPorSolicitud(codigoSolicitud); + fechaNotificacion = documentohabilitante.getFechaemision(); + } + obtenerCentroControl(); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private void obtenerCentroControl() throws Exception { +// TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); +// PersonAddressController personAddressController = new PersonAddressController(); +// TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); +// TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + //institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Metodo para filtrar por centro de control + * + * @param ccentroControl + * @return + */ + public List findPorCentroControlFechaAtencion(String ccentroControl) { + try { + this.init(); + this.recperpage = 15; + this.addFilter("ccentrocontrol", ccentroControl); + this.querydatabase(); + if ((this.lrecord != null) && !this.lrecord.isEmpty()) { + return this.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + @Override + public void query() throws Exception { + MessageHelper.setMessageError("msg_notQuery"); + super.query(); + } + + @Override + public void next() throws Exception { + // TODO Auto-generated method stub + super.next(); + } + + /** + * Metodo raiz para generar la fecha de notificacion a partir de la fecha + * actual + */ + public void generarFecha() { + Calendar calendario = Calendar.getInstance(); + calendario.setTime(new Date()); + calendario.add(Calendar.DAY_OF_YEAR, 0);//adiciona los dias a partir de los cuales debe empezar la notificacion + generarFecha(calendario.getTime()); + } + + /** + * Metodo recursivo para generar una fecha de Notificacion, siempre y cuando + * la fecha se encuentre disponible para ese centro de control + * + * @param fecha + */ + public void generarFecha(Date fecha) { + fechaNotificacion = TgeneNotAccountingDayController.isfechalaboral(fecha); + List listaCentroControl = CentroControlArmasController.find(solicitud.getCcentrocontrol()); + int tramitesPorDia = 0; + + if (listaCentroControl != null && !listaCentroControl.isEmpty()) { + centroControl = listaCentroControl.get(0); + if (listaCentroControl.get(0).getTramitespordia() != null) { + tramitesPorDia = centroControl.getTramitespordia().intValue(); + } + } + Calendar fNotificacion = Calendar.getInstance(); + fNotificacion.setTime(fechaNotificacion); + + Calendar fActualUnDia = Calendar.getInstance(); + fActualUnDia.setTime(new Date()); + fActualUnDia.add(Calendar.DAY_OF_YEAR, 1); + long fechaDiferencia = (fActualUnDia.getTimeInMillis() - fNotificacion.getTimeInMillis()) / (24 * 60 * 60 * 1000); + + List listaTramitesAtendidos = findPorCentroControlFechaAtencion(solicitud.getCcentrocontrol()); + + if (fechaDiferencia == 1L || fechaDiferencia == 0 || (listaTramitesAtendidos != null && !listaTramitesAtendidos.isEmpty() && tramitesPorDia > 0 && listaTramitesAtendidos.size() >= tramitesPorDia)) { + Calendar calendario = Calendar.getInstance(); + calendario.setTime(fechaNotificacion); + calendario.add(Calendar.DAY_OF_YEAR, 1); + generarFecha(calendario.getTime()); + } + + habilitarGrabar = true; + + } + + /** + * Metodo para anular el tramite + * + * @throws Exception + */ + private void aprobarTramite() throws Exception { + solicitudTramite = solicitudTramiteController.findByCSolicitud(codigoSolicitud); + solicitudTramiteController.setRecord(solicitudTramite); + solicitudTramiteController.getRecord().setEstadotramite("APB"); + solicitudTramiteController.getRecord().setEstadotramitecodigo("ESTADOSOLICITUD"); + solicitudTramiteController.update(); + solicitudTramiteController.save(); + } + + public SolicitudTramiteController getSolicitudTramiteController() { + return solicitudTramiteController; + } + + public void setSolicitudTramiteController( + SolicitudTramiteController solicitudTramiteController) { + this.solicitudTramiteController = solicitudTramiteController; + } + + public TgeneCatalogDetail getDetallecatalogo() { + return detallecatalogo; + } + + public void setDetallecatalogo(TgeneCatalogDetail detallecatalogo) { + this.detallecatalogo = detallecatalogo; + } + + public TgeneCatalogDetail getDetallecatalogoTipoTramite() { + return detallecatalogoTipoTramite; + } + + public void setDetallecatalogoTipoTramite( + TgeneCatalogDetail detallecatalogoTipoTramite) { + this.detallecatalogoTipoTramite = detallecatalogoTipoTramite; + } + + public TgeneCatalogDetail getUsoActividad() { + return usoActividad; + } + + public void setUsoActividad(TgeneCatalogDetail usoActividad) { + this.usoActividad = usoActividad; + } + + public TgeneCatalogDetail getIdentificacion() { + return identificacion; + } + + public void setIdentificacion(TgeneCatalogDetail identificacion) { + this.identificacion = identificacion; + } + + public TgeneCatalogDetail getEstadotramite() { + return estadotramite; + } + + public void setEstadotramite(TgeneCatalogDetail estadotramite) { + this.estadotramite = estadotramite; + } + + public TarmSolicitudTramite getSolicitudTramite() { + return solicitudTramite; + } + + public void setSolicitudTramite(TarmSolicitudTramite solicitudTramite) { + this.solicitudTramite = solicitudTramite; + } + + public TarmTramite getTramite() { + return tramite; + } + + public void setTramite(TarmTramite tramite) { + this.tramite = tramite; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + public Date getFechaNotificacion() { + return fechaNotificacion; + } + + public void setFechaNotificacion(Date fechaNotificacion) { + this.fechaNotificacion = fechaNotificacion; + } + + public boolean isHabilitarGrabar() { + return habilitarGrabar; + } + + public void setHabilitarGrabar(boolean habilitarGrabar) { + this.habilitarGrabar = habilitarGrabar; + } + + public boolean isHabilitarEnviar() { + return habilitarEnviar; + } + + public void setHabilitarEnviar(boolean habilitarEnviar) { + this.habilitarEnviar = habilitarEnviar; + } + + public boolean isHabilitarGeneraFecha() { + return habilitarGeneraFecha; + } + + public void setHabilitarGeneraFecha(boolean habilitarGeneraFecha) { + this.habilitarGeneraFecha = habilitarGeneraFecha; + } + + public ArmasController getArmas() { + return armas; + } + + public void setArmas(ArmasController armas) { + this.armas = armas; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/OrdenTrabajoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/OrdenTrabajoController.java new file mode 100644 index 0000000..3e779de --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/OrdenTrabajoController.java @@ -0,0 +1,386 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.RequisitoController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmSolicitudImportacion; +import com.fp.persistence.parmas.param.TarmRequisito; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmOrdenTrabajo; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class OrdenTrabajoController extends AbstractController { + + private Date fechaHoy; + private Date inicio; + private Date fin; + private java.sql.Date fechaInicio; + private java.sql.Date fechaFin; + + private TarmSolicitud solicitud = new TarmSolicitud(); + private TarmSolicitudTramite solicitudTramite = new TarmSolicitudTramite(); + private TarmTramite tramite = new TarmTramite(); + private String usoActividad; + private Long numeroOrden; + + private String documentoReferencia; + private String empresa; + private String lugarDireccion; + private String ruta; + private String tiempoEstimado; + private String observaciones; + + public OrdenTrabajoController() throws Exception { + super(TarmOrdenTrabajo.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "ORDENTRABAJOCONTROLLER"; + + fechaHoy = Calendar.getInstance().getTime(); + record = new TarmOrdenTrabajo(); + record.setIsnew(true); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + //Obteniendo la solicitud + solicitud = ValidacionTramiteLibreTransitoController.findPorSolicitudSimple("1"); + if (solicitud != null && solicitud.getPk() != null) { + solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + + if (solicitudTramite != null && solicitudTramite.getPk().getCtramite() != null) { + tramite = TarmTramiteController.find(solicitudTramite.getPk().getCtramite().toString()); + + if (tramite != null && tramite.getPk() != null) { + //Uso actividad + TgeneCatalogDetail catalogDetailTramite = CatalogDetailController.findxCodigoCodcatalogo(solicitudTramite.getEstadotramite(), solicitudTramite.getEstadotramitecodigo()); + catalogDetailTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + if (catalogDetailTramite != null && tramite.getUsoactividad() != null && tramite.getUsoactividadcodigo() != null) { + usoActividad = catalogDetailTramite.getDescription(); + } + + } + } + } + + //Obteniendo el numero de orden + List listaOrdenes = OrdenTrabajoController.findAll(); + if (listaOrdenes == null || listaOrdenes.isEmpty()) { + numeroOrden = 1L; + } else { + numeroOrden = listaOrdenes.get(listaOrdenes.size() - 1).getPk() + 1; + } + + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaseAll() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + update(); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void update(TarmOrdenTrabajo bean) throws Exception { + record = bean; + update(); + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Obtiene una orden de trabajo por su codigo + * + * @param cordentrabajo + * @return + */ + public static TarmOrdenTrabajo find(String cordentrabajo) { + try { + OrdenTrabajoController cc = new OrdenTrabajoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", cordentrabajo); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findAll() { + try { + OrdenTrabajoController cc = new OrdenTrabajoController(); + cc.init(); + //cc.recperpage = 300; + cc.querydatabaseAll(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public Date getFechaHoy() { + return fechaHoy; + } + + public void setFechaHoy(Date fechaHoy) { + this.fechaHoy = fechaHoy; + } + + public Date getInicio() { + return inicio; + } + + public void setInicio(Date inicio) { + this.inicio = inicio; + } + + public Date getFin() { + return fin; + } + + public void setFin(Date fin) { + this.fin = fin; + } + + public java.sql.Date getFechaInicio() { + return fechaInicio; + } + + public void setFechaInicio(java.sql.Date fechaInicio) { + this.fechaInicio = fechaInicio; + } + + public java.sql.Date getFechaFin() { + return fechaFin; + } + + public void setFechaFin(java.sql.Date fechaFin) { + this.fechaFin = fechaFin; + } + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + public TarmSolicitudTramite getSolicitudTramite() { + return solicitudTramite; + } + + public void setSolicitudTramite(TarmSolicitudTramite solicitudTramite) { + this.solicitudTramite = solicitudTramite; + } + + public TarmTramite getTramite() { + return tramite; + } + + public void setTramite(TarmTramite tramite) { + this.tramite = tramite; + } + + public String getUsoActividad() { + return usoActividad; + } + + public void setUsoActividad(String usoActividad) { + this.usoActividad = usoActividad; + } + + public Long getNumeroOrden() { + return numeroOrden; + } + + public void setNumeroOrden(Long numeroOrden) { + this.numeroOrden = numeroOrden; + } + + public String getDocumentoReferencia() { + return documentoReferencia; + } + + public void setDocumentoReferencia(String documentoReferencia) { + this.documentoReferencia = documentoReferencia; + } + + public String getEmpresa() { + return empresa; + } + + public void setEmpresa(String empresa) { + this.empresa = empresa; + } + + public String getLugarDireccion() { + return lugarDireccion; + } + + public void setLugarDireccion(String lugarDireccion) { + this.lugarDireccion = lugarDireccion; + } + + public String getRuta() { + return ruta; + } + + public void setRuta(String ruta) { + this.ruta = ruta; + } + + public String getTiempoEstimado() { + return tiempoEstimado; + } + + public void setTiempoEstimado(String tiempoEstimado) { + this.tiempoEstimado = tiempoEstimado; + } + + public String getObservaciones() { + return observaciones; + } + + public void setObservaciones(String observaciones) { + this.observaciones = observaciones; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/PagarTarjetaController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/PagarTarjetaController.java new file mode 100644 index 0000000..6057bf1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/PagarTarjetaController.java @@ -0,0 +1,551 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package com.fp.frontend.controller.armas.solicitud; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.IngresoDatosTipoTramite; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pgeneral.date.TgeneNotAccountingDayController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import javax.annotation.PostConstruct; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import org.primefaces.context.RequestContext; +import org.primefaces.model.UploadedFile; + +/** + * + * @author developer2 + */ +/** =============== CODIGO TOMADO DE CARGAR DEPOSITO CONTROLLER*/ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class PagarTarjetaController extends AbstractController{ + /** + * Variable que contiene los datos de la solicitud actual + */ + private TarmSolicitud solicitud; + /** + * Variable que contiene el numero de tramite con el que inicia el flujo + */ + private String numTramite; + /** + * Variable que contiene el codigo de solicitud pasado en el flujo + */ + private String csolicitud; + /** + * valor para calular el interes de pagos con tarjeta + */ + private Double interes; + + /** + * Mostrar interes en relacion a 100 + */ + private String interesPorcentaje; + /** + * valor para calular el interes de pagos con tarjeta + */ + private Double totalPagar; + /** + * Variable del tipo TgeneCatalogDetail(catalogo del tramite) + */ + private TgeneCatalogDetail nombreTramite; + /** + * Variable del tipo TgeneCatalogDetail(catalogo de la categoria) + */ + private TgeneCatalogDetail nombreCategoria; + /** + * Variable del tipo TgeneCatalogDetail(catalogo del uso actividad del + * tramite) + */ + private TgeneCatalogDetail nombreUsoActividad; + /** + * Bandera de tipo booleano para indicar si se habilita el boton de + * completar tarea + */ + private Boolean isEnableCompletarTarea = Boolean.FALSE; + + private UploadedFile uploadedFileResolucion; + /** + * Variable que indica si el usuario esta negado para continuear el tramite, + * su tramite pasa a estado anulado + */ + private Boolean isDenied; + /** + * Variable auxiliar usada para diferenciar cuando se presenta o no el + * mensaje de validacion de fecha expiracion solicitud + */ + private Boolean isOnlyMsj; + /** + * Variable que indica si el numero de comprobante ingresado es correcto + */ + private Boolean isTrueNComprobante; + /** + * Dias laborables permitidos para completar el tramite + */ + private Integer diasLaborablesPermitidos; + //TsafeUserDetail tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + private Boolean requiereNoSolAucpBln; + /** + * Bandera de tipo booleano para indicar si se ha grabado el reporte + * generado + * + */ + private Boolean isEnableGrabar; + /** + * Referencia al Centro de control; + */ + private TarmCentroControl centroControl = new TarmCentroControl(); + /** + * Nombre de la Institucion + */ + private String nombreInstitucion; + @PostConstruct + private void postconstruct() { +// super.startQuery(); +// csolicitud = this.getMfilters().get("csolicitud"); +// this.getMfilters().clear(); + + init(); + requiereNoSolAucpBln = Boolean.FALSE; + } + + private void init() { + try { + this.recperpage = 500; + this.beanalias = "CARGARDEPOSITO"; + isDenied = true; + diasLaborablesPermitidos = Integer.parseInt(ParametersController.find("DIASDEPOSITO", "1").getNumbervalue().toString()); + isTrueNComprobante = Boolean.TRUE; + isOnlyMsj = false; + isEnableGrabar = Boolean.TRUE; + isEnableCompletarTarea = Boolean.FALSE; + obtenerCentroControlSolicitante(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + /** + * Metodo que devuelve el centro de control al que pertenece el cliente + * dueno de la solicitud + * + * @throws Exception + */ + private void obtenerCentroControlSolicitante() throws Exception { + TsafeUserDetail tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if (tcustPersonAddres != null && tcustPersonAddres.getProvincecode() != null) { + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_notienedireccionprincipal")); + return; + } + + } + + /** =========== metodo para buscar solicitud ==============*/ + + public void consultarSolicitud() throws Exception { + if (numTramite != null) { + this.record = SolicitudTramiteController.findByNumTramite(numTramite); + TgeneParameters pt = ParametersController.find("INTERESTARJETA", "1"); + + this.interes = pt == null ? 0 : pt.getNumbervalue().doubleValue(); + this.interesPorcentaje = pt == null ? "0" : pt.getTextvalue(); + if (record != null && record.getPk().getCsolicitud() != null) { + csolicitud = record.getPk().getCsolicitud(); + // csolicitud=csolicitud.replace("TRA","SOL"); + + try { + if (record != null) { + solicitud = SolicitudArmasController.findByCSolicitud(csolicitud); + if (solicitud != null && solicitud.getCtramite() != null) { + TarmTramite tramite = IngresoDatosTipoTramite.find(solicitud.getCtramite().toString()); + if (tramite != null) { + //Tramite + nombreTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + nombreCategoria = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + nombreUsoActividad = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + totalPagar = record.getValorapagar().doubleValue() + (record.getValorapagar().doubleValue() * interes); + + if (tramite.getCategoria().equals("14")) { + requiereNoSolAucpBln = Boolean.TRUE; + obtenerCentroControl(solicitud); + } else { + requiereNoSolAucpBln = Boolean.FALSE; + } + + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_tramiteSinDatosAsociados")); + } + + Date fechaLimiteDate = TgeneNotAccountingDayController.diasLaborablesPreviosAUnaFecha(new Date(), diasLaborablesPermitidos); + Calendar fechaLimite = Calendar.getInstance(); + fechaLimite.setTime(fechaLimiteDate); + fechaLimite.set(Calendar.HOUR_OF_DAY, 0); + fechaLimite.set(Calendar.MINUTE, 0); + fechaLimite.set(Calendar.SECOND, 0); + + Calendar fechaSolicitud = Calendar.getInstance(); + fechaSolicitud.setTime(solicitud.getFverificarequisitos()); + fechaSolicitud.set(Calendar.SECOND, 1); + + if (fechaSolicitud.compareTo(fechaLimite) < 0) { + isOnlyMsj = true; + record.setEstadotramite("ANU"); + record.setEstadotramitecodigo("ESTADOSOLICITUD"); + super.update(); + // this.save(); + RequestContext.getCurrentInstance().update("messages"); + } else { + isDenied = false; + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_tramiteSinDatosAsociados")); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_tramiteSinDatosAsociados")); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + } + } + + /** + * Metodo consulta tramites .. + */ + @SuppressWarnings("unchecked") + public void consultaTramites() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + + SubQuery subqueryTipo = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog= (select o.estado from TarmSolicitud o where o.pk=t.pk.csolicitud) and " + + " i.pk.catalogcode=(select o.estadocodigo from TarmSolicitud o where o.pk=t.pk.csolicitud)"); + SubQuery subqueryEstadoTramite = new SubQuery("TgeneCatalogDetail", "description", "estadotramite", "i.pk.catalog= t.estadotramite and" + + " i.pk.catalogcode=t.estadotramitecodigo"); + + dto.addSubQuery(subqueryEstadoTramite); + SubQuery subquerysolicitud = new SubQuery("TarmSolicitud", "numerosolicitud", "solicitud", "i.pk=t.pk.csolicitud"); + dto.addSubQuery(subquerysolicitud); + dto.setOrderby("t.pk"); + + TsafeUserDetail tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + Filter filtro = new Filter(); + filtro.setSql("(numerocomprobante is null OR inicioFlujo is null) and estadotramite='REG' and valorapagar>0 and " + + " csolicitud in(select o.pk from TarmSolicitud o where o.personcode ='" + tsafeUserDetailUsuario.getPk().getPersoncode() + "' and o.estado ='APB')"); + dto.addFiltro(filtro); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * GENERACION DE GETTERS Y SETTERS AUTOMATICAMENTE + * @return + */ + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public TgeneCatalogDetail getNombreTramite() { + return nombreTramite; + } + + public void setNombreTramite(TgeneCatalogDetail nombreTramite) { + this.nombreTramite = nombreTramite; + } + + public TgeneCatalogDetail getNombreCategoria() { + return nombreCategoria; + } + + public void setNombreCategoria(TgeneCatalogDetail nombreCategoria) { + this.nombreCategoria = nombreCategoria; + } + + public TgeneCatalogDetail getNombreUsoActividad() { + return nombreUsoActividad; + } + + public void setNombreUsoActividad(TgeneCatalogDetail nombreUsoActividad) { + this.nombreUsoActividad = nombreUsoActividad; + } + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + public Boolean getIsDenied() { + return isDenied; + } + + public void setIsDenied(Boolean isDenied) { + this.isDenied = isDenied; + } + + public Boolean getIsOnlyMsj() { + return isOnlyMsj; + } + + public void setIsOnlyMsj(Boolean isOnlyMsj) { + this.isOnlyMsj = isOnlyMsj; + } + + public Boolean getIsTrueNComprobante() { + return isTrueNComprobante; + } + public void setIsTrueNComprobante(Boolean isTrueNComprobante) { + this.isTrueNComprobante = isTrueNComprobante; + } + + public Boolean getIsEnableCompletarTarea() { + return isEnableCompletarTarea; + } + + public void setIsEnableCompletarTarea(Boolean isEnableCompletarTarea) { + this.isEnableCompletarTarea = isEnableCompletarTarea; + } + + public String getNumTramite() { + return numTramite; + } + + public void setNumTramite(String numTramite) { + this.numTramite = numTramite; + } + + public Boolean getIsEnableGrabar() { + return isEnableGrabar; + } + + public void setIsEnableGrabar(Boolean isEnableGrabar) { + this.isEnableGrabar = isEnableGrabar; + } + + public Boolean getRequiereNoSolAucpBln() { + return requiereNoSolAucpBln; + } + + public void setRequiereNoSolAucpBln(Boolean requiereNoSolAucpBln) { + this.requiereNoSolAucpBln = requiereNoSolAucpBln; + } + + public String getNombreInstitucion() { + return nombreInstitucion; + } + + public String setNombreInstitucion(String nombreInstitucion) { + if (nombreInstitucion != null && !nombreInstitucion.isEmpty()) { + this.nombreInstitucion = nombreInstitucion; + } else { + this.nombreInstitucion = ""; + } + + return nombreInstitucion; + } + + public UploadedFile getUploadedFileResolucion() { + return uploadedFileResolucion; + } + + public void setUploadedFileResolucion(UploadedFile uploadedFileResolucion) { + this.uploadedFileResolucion = uploadedFileResolucion; + } + + public Double getInteres() { + return interes; + } + + public void setInteres(Double interes) { + this.interes = interes; + } + + public String getInteresPorcentaje() { + return interesPorcentaje; + } + + public void setInteresPorcentaje(String interesPorcentaje) { + this.interesPorcentaje = interesPorcentaje; + } + + public Double getTotalPagar() { + return totalPagar; + } + + public void setTotalPagar(Double totalPagar) { + this.totalPagar = totalPagar; + } + /** + * Metodo para validar que el valor a pagar sea mayor a cero + * cero + */ + public void valorMayorACero() { + if (record.getValorverificacion().doubleValue() <= 0) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_valorDepositoNegativoCero")); + } + } + + public void solicitudSeleccionada(TarmSolicitudTramite tarmSolicitudTramite) { + try { + numTramite = tarmSolicitudTramite.getNumerotramite(); + consultarSolicitud(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + public void guardarTransaccion(String mostrar){ + System.out.println(new Date()+".. QMasVe Please>>>>>"+mostrar); + } + + /**=========================================================*/ + + private void obtenerCentroControl(TarmSolicitud solicitud) throws Exception { + this.centroControl = CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + this.setNombreInstitucion(CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + } + + public PagarTarjetaController() throws Exception{ + super(TarmSolicitudTramite.class); + } + @Override + protected void querydatabase() { + try { + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + /** + * Metodo que permite grabar el formulario junto al comprobante de deposito + * en el Alfresco + * + */ + public void openPay(){ + } + + @Override + public void save() { + try { + /** + String xPathLocation = getRutaDocumentoSolBase() + "/cm:" + solicitud.getNumerosolicitud() + "/cm:" + "Deposito"; + if (record.getValorverificacion() != null && record.getValorverificacion().doubleValue() > 0) { + if (isTrueNComprobante) { + if (!record.getFechacomprobante().after(new Date())) { + if (uploadedFile != null && uploadedFile.getFileName() != null) { + String extencionArchivo = getExtension(uploadedFile.getFileName()); + String nombreArchivo = "CMPRBNT-" + solicitud.getNumerosolicitud() + "." + extencionArchivo; + if (alfrescoController.uploadFile(uploadedFile.getInputstream(), nombreArchivo, xPathLocation)) { + record.setXpathcomprobante(xPathLocation + "/cm:" + nombreArchivo); + //validamos si adjunta la resolucion + if (uploadedFileResolucion != null && uploadedFileResolucion.getFileName() != null) { + String xPathLocationResolucion = getRutaDocumentoSolBase() + "/cm:" + solicitud.getNumerosolicitud() + "/cm:" + "Resolucion"; + String extencionArchivoResolucion = getExtension(uploadedFileResolucion.getFileName()); + String nombreArchivoResolucion = "RESOLUCION-" + solicitud.getNumerosolicitud() + "." + extencionArchivoResolucion; + if (alfrescoController.uploadFile(uploadedFileResolucion.getInputstream(), nombreArchivoResolucion, xPathLocationResolucion)) { + record.setXpathresolucion(xPathLocationResolucion + "/cm:" + nombreArchivoResolucion); + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_adjuntar_resolucion")); + return; + } + } + super.update(); + DtoSave dtosave = super.getDtoSave(); + HashMap msave = new HashMap(); + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + isDenied = true; + isEnableCompletarTarea = Boolean.TRUE; + isEnableGrabar = Boolean.FALSE; + FacesContext context = FacesContext.getCurrentInstance(); + context.addMessage(null, new FacesMessage("RECUERDE", MsgControlArmas.getProperty("msg_recuerdeClickContinuarTramite"))); + } else { + MessageHelper.setMessageError(resp); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_tramiteSinDatosAsociados")); + } + } else { +// MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_archivo")); + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingreseComprobanteDeposito")); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_fechaDepositoMayorFechaActual")); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_comprobanteDepositoUsado")); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_valorDepositoNegativoCero")); + }*/ + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Throwable e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/PermisosAutorizacionesAnularController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/PermisosAutorizacionesAnularController.java new file mode 100644 index 0000000..40eb1d2 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/PermisosAutorizacionesAnularController.java @@ -0,0 +1,296 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.sql.Date; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.SelectEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; + +/** + * Controlador para listar los documentos habilitantes del sistema + * + */ +@ManagedBean +@ViewScoped +public class PermisosAutorizacionesAnularController extends AbstractController { + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + private TcustPersonDetail tcustPersonDetail; + + /** + * Variable que nos permite cargar el documento al Alfresco + */ + private UploadedFile uploadedFile; + + public PermisosAutorizacionesAnularController() throws Exception { + super(TarmDocumentoHabilitante.class); + } + + @PostConstruct + public void postConstruct() { + this.init(); + super.startQuery(); + } + + private void init() { + this.beanalias = "PERMISOSAUTORIZACIONES"; + this.recperpage = 15; + this.lrecord = new ArrayList<>(); + } + + @SuppressWarnings({"unchecked", "deprecation"}) + @Override + protected void querydatabase() { + try { + if (!this.getMfilters().containsKey("personcode") || this.getMfilters().get("personcode") == null) { + MessageHelper.setMessageError("SELECCIONE UNA IDENTIFICACI\u00d3N"); + return; + } + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + HashMap mtables = new HashMap(); + //nombre + SubQuery snombre = new SubQuery("TcustPersonDetail", "name", "nombre", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + dto.addSubQuery(snombre); + SubQuery snumerodocumento = new SubQuery("TcustPersonDetail", "identification", "identification", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + dto.addSubQuery(snumerodocumento); + SubQuery subqueryCategoriaCodigo = new SubQuery("TgeneCatalogDetail", "description", "description", "i.pk.catalog = (select a.tipotramite from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.tipotramitecodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryCategoriaCodigo); + + SubQuery subqueryipoAutorizacion = new SubQuery("TgeneCatalogDetail", "description", "descriptionTipoAut", "i.pk.catalog = (select a.tipoautorizacion from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.tipoautorizacioncodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryipoAutorizacion); + + SubQuery subqueryTipocodigo = new SubQuery("TgeneCatalogDetail", "description", "descriptiontram", "i.pk.catalog = (select a.categoria from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.categoriacodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryTipocodigo); + SubQuery subqueryUsocodigo = new SubQuery("TgeneCatalogDetail", "description", "descriptionact", "i.pk.catalog = (select a.usoactividad from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.usoactividadcodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryUsocodigo); + SubQuery subqueryEstadoDoc = new SubQuery("TgeneCatalogDetail", "description", "estadodocumento", "i.pk.catalog = t.estado" + + " and i.pk.catalogcode= t.estadocode"); + dto.addSubQuery(subqueryEstadoDoc); + + dto.setOrderby("t.fechaemision desc"); + //filtro + Filter filtroFinal = new Filter(); + String sqlFinal = " t.fechaemision is not null "; + filtroFinal.setSql(sqlFinal); + dto.addFiltro(filtroFinal); + + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + java.util.Date fecha2 = new java.util.Date(); + fecha2.setHours(0); + fecha2.setMinutes(0); + fecha2.setSeconds(0); + for (TarmDocumentoHabilitante item : lrecord) { + item.getModifiedData().put("btnanular", Boolean.TRUE); + java.util.Date fecha1 = new java.util.Date(item.getFechaexpiracion().getTime()); + fecha1.setHours(0); + fecha1.setMinutes(0); + fecha1.setSeconds(0); + if (fecha1.getTime() < fecha2.getTime()) { + item.getModifiedData().put("btnanular", Boolean.FALSE); + } + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void update() throws Exception { + record.setEstado("SUS"); + record.setFechacambioexpiracion(record.getFechaexpiracion()); + record.setFechaexpiracion(new Date(new java.util.Date().getTime())); + //Valida si el archivo esta adjunto + String xPathLocation = getRutaDocumentoSolBase() + "/cm:I-" + record.getModifiedData().get("identification") + "/cm:C-" + record.getCodigoarma(); + if (uploadedFile != null && uploadedFile.getFileName() != null) { + String extencionArchivo = getExtension(uploadedFile.getFileName()); + String nombreArchivo = "SUS-" + this.record.getCodigoarma() + "." + extencionArchivo; + if (alfrescoController.uploadFile(uploadedFile.getInputstream(), nombreArchivo, xPathLocation)) { + record.setPathSuspencion(xPathLocation + "/cm:" + nombreArchivo); + } else { + MessageHelper.setMessageError("Adjunte el documento"); + return; + } + } else { + MessageHelper.setMessageError("Adjunte el documento"); + return; + } + super.update(); + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + querydatabase(); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static void openLov() { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), true); + // lovpersona es el nombre de la pagina + RequestContext.getCurrentInstance().openDialog("/pages/customer/lov/personLov.xhtml", options, null); + } + + /** + * Maneja la respuesta del Lov de Personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + tcustPersonDetail = (TcustPersonDetail) event.getObject(); + this.getMfilters().put("personcode", tcustPersonDetail.getPk().getPersoncode().toString()); + this.query(); + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new java.util.Date()); + StringBuilder ruta = new StringBuilder("cm:Suspencion"); + ruta = ruta.append("/cm:Suspencion-"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + return ruta.toString(); + } + + /** + * Metodo que retorna la extencion del documento que se desea subir al + * alfresco + */ + public String getExtension(String filename) { + int index = filename.lastIndexOf('.'); + if (index == -1) { + return ""; + } else { + return filename.substring(index + 1); + } + } + + /** + * Recorta el nombre del archivo a cargarse + * + * @param nombre + * @return nombre recortado + */ + public String recorteNombre(String nombre) { + String fielname = nombre; + if (fielname.length() > 30) { + fielname = fielname.substring(0, 30) + extencionArchivo(nombre); + } + return fielname; + } + + /** + * Obtiene la extencion del archivo a cargar + * + * @param nombre + * @return + */ + private String extencionArchivo(String nombre) { + int pos = nombre.lastIndexOf('.'); + nombre = nombre.substring(pos); + return nombre; + } + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en + * el Alfresco + */ + public void handleUpload(FileUploadEvent event) { + uploadedFile = event.getFile(); + } + + public TcustPersonDetail getTcustPersonDetail() { + return tcustPersonDetail; + } + + public void setTcustPersonDetail(TcustPersonDetail tcustPersonDetail) { + this.tcustPersonDetail = tcustPersonDetail; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/PermisosAutorizacionesController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/PermisosAutorizacionesController.java new file mode 100644 index 0000000..f092958 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/PermisosAutorizacionesController.java @@ -0,0 +1,149 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; + +/** + * Controlador para listar los documentos habilitantes del sistema + * + */ +@ManagedBean +@ViewScoped +public class PermisosAutorizacionesController extends AbstractController { + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + private TcustPersonDetail tcustPersonDetail; + + public PermisosAutorizacionesController() throws Exception { + super(TarmDocumentoHabilitante.class); + } + + @PostConstruct + public void postConstruct() { + this.init(); + super.startQuery(); + } + + private void init() { + this.beanalias = "PERMISOSAUTORIZACIONES"; + this.recperpage = 15; + this.lrecord = new ArrayList<>(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if (!this.getMfilters().containsKey("personcode") || this.getMfilters().get("personcode") == null) { + MessageHelper.setMessageError("SELECCIONE UNA IDENTIFICACI\u00d3N"); + return; + } + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + HashMap mtables = new HashMap(); + SubQuery subqueryCategoriaCodigo = new SubQuery("TgeneCatalogDetail", "description", "description", "i.pk.catalog = (select a.tipotramite from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.tipotramitecodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryCategoriaCodigo); + + SubQuery subqueryipoAutorizacion = new SubQuery("TgeneCatalogDetail", "description", "descriptionTipoAut", "i.pk.catalog = (select a.tipoautorizacion from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.tipoautorizacioncodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryipoAutorizacion); + + SubQuery subqueryTipocodigo = new SubQuery("TgeneCatalogDetail", "description", "descriptiontram", "i.pk.catalog = (select a.categoria from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.categoriacodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryTipocodigo); + SubQuery subqueryUsocodigo = new SubQuery("TgeneCatalogDetail", "description", "descriptionact", "i.pk.catalog = (select a.usoactividad from TarmTramite a where a.pk=t.ctramite)" + + "and i.pk.catalogcode=(select a.usoactividadcodigo from TarmTramite a where a.pk=t.ctramite)"); + dto.addSubQuery(subqueryUsocodigo); + SubQuery subqueryEstadoDoc = new SubQuery("TgeneCatalogDetail", "description", "estadodocumento", "i.pk.catalog = t.estado" + + " and i.pk.catalogcode= t.estadocode"); + dto.addSubQuery(subqueryEstadoDoc); + + dto.setOrderby("t.fechaemision desc"); + + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + } + + public static void openLov() { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), true); + // lovpersona es el nombre de la pagina + RequestContext.getCurrentInstance().openDialog("/pages/customer/lov/personLov.xhtml", options, null); + } + + /** + * Maneja la respuesta del Lov de Personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + tcustPersonDetail = (TcustPersonDetail) event.getObject(); + this.getMfilters().put("personcode", tcustPersonDetail.getPk().getPersoncode().toString()); + this.query(); + } + + public TcustPersonDetail getTcustPersonDetail() { + return tcustPersonDetail; + } + + public void setTcustPersonDetail(TcustPersonDetail tcustPersonDetail) { + this.tcustPersonDetail = tcustPersonDetail; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/PlanificacionInspeccionController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/PlanificacionInspeccionController.java new file mode 100644 index 0000000..abaa088 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/PlanificacionInspeccionController.java @@ -0,0 +1,907 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.ins.TarmPlanificacionInspeccion; +import com.fp.persistence.parmas.ins.TarmPlanificacionTramite; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class PlanificacionInspeccionController extends AbstractController { + + private TarmCentroControl centroControl; + + TgeneCatalogDetail actividad = null; + private String meses; + private String Periodo; + private List tipoplanificacionList; + private String idPlanificacion; + + private List listaPeriodo = new ArrayList(); + private String nombreCentroControl; + + private Boolean planificacionSalvada = false; + + private Boolean planificacionGenerada = false; + + private Boolean habilitarGeneracion = false; + + private Boolean planificacionesPrevias = false; + + private TarmCentroControlJur jurisdiccionCentroControl; + + // Codigo de planificacion (Variable de flujo) + private Long cplanificacion; + + private Float presupuesto1; + + private List listaMeses = new ArrayList(); + + private List listaAnnos = new ArrayList(); + + List planificaciones; + + @ManagedProperty(value = "#{planificacionTramiteController}") + private PlanificacionTramiteController planificacionTramiteController; + + @ManagedProperty(value = "#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitanteController; + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddressController; + + private Boolean btnFlujo; + private String codigoPlanificacion; + /** + * codigo de la provincia del usuario logeado + */ + private String cprovincia; + + public PlanificacionInspeccionController() throws Exception { + super(TarmPlanificacionInspeccion.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + record = new TarmPlanificacionInspeccion(); + beanalias = "PLANIFICACIONINSPECCIONCONTROLLER"; + btnFlujo = Boolean.FALSE; + // Obteniendo el centro de control + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController direccion = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = direccion.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + this.jurisdiccionCentroControl = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + this.centroControl = CentroControlArmasController.findPorCodigo(this.jurisdiccionCentroControl.getCcentrocontrol()); + this.nombreCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + //codigo de la provincia del centro de control logeado + cprovincia = centroControl.getProvincecode(); + + // cargar tipo de planificacion + tipoplanificacionList = CatalogDetailController.find("TIPOPLANIFICACION"); + // Fecha de generacion + Calendar calendar = Calendar.getInstance(); + this.record.setFechageneracion(new Date(calendar.getTimeInMillis())); + + // Generando los annos posibles + planificaciones = PlanificacionInspeccionController.findAllByCentroControl(this.centroControl.getPk()); + Integer canno = Calendar.getInstance().get(Calendar.YEAR); + if (planificaciones != null && !planificaciones.isEmpty()) { + this.planificacionesPrevias = true; + //this.record.setAnno(Long.parseLong(canno.toString())); + this.listaAnnos.add(Long.parseLong(canno.toString())); + + } else { + this.planificacionesPrevias = false; + this.listaAnnos.add(Long.parseLong(canno.toString())); + canno++; + this.listaAnnos.add(Long.parseLong(canno.toString())); + } + + this.planificacionTramiteController = new PlanificacionTramiteController(); + this.planificacionTramiteController.setLrecord(new ArrayList()); + + this.documentoHabilitanteController = new DocumentoHabilitanteController(); + this.documentoHabilitanteController.setLrecord(new ArrayList()); + + //validamos si viene del flujo + if (cplanificacion != null) { + TarmPlanificacionInspeccion planificacion = PlanificacionInspeccionController.findPorCodigo(cplanificacion); + if (planificacion != null) { + if ("N".equals(planificacion.getAprobada())) { + //listamos la planificacion en estado Negado + this.planificacionTramiteController.setLrecord(new ArrayList()); + this.planificacionTramiteController.setLrecord(PlanificacionTramiteController.findPorCodigoPlanificacion(cplanificacion)); + Collections.sort(planificacionTramiteController.getLrecord(), new Comparator() { + public int compare(TarmPlanificacionTramite p1, TarmPlanificacionTramite p2) { + return new Integer(Integer.parseInt(p1.getModifiedData().get("ordena").toString())).compareTo(new Integer(p2.getModifiedData().get("ordena").toString())); + } + }); + } + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_existePlanificacionAnno")); + } + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void query() throws Exception { + // TODO Auto-generated method stub + MessageHelper.setMessageError("msg_notQuery"); + super.query(); + } + + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("anno desc"); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + // record=lrecord.get(0); + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + + if (this.planificacionGenerada) { + int i = 0; + float pre = 0; + float tot = this.presupuesto1; + for (TarmPlanificacionTramite tramite : planificacionTramiteController.getLrecord()) { + i++; + if (tramite.getInspectores() == null || tramite.getPeriodo() == null || tramite.getVehiculos() == null || tramite.getPresupuesto() == null) { + MessageHelper.setMessageError("ERROR deben estar todos los campos llenos"); + return; + } + + pre = pre + tramite.getPresupuesto(); + + } + + // MessageHelper.setMessageError(""+pre); + if (pre > tot) { + MessageHelper.setMessageError("ERROR Valor : " + tot + "es menor que : " + pre); + return; + } + //MessageHelper.setMessageError("ERROR "+i); + //break; + //Asignando el centro de control + this.record.setCcentrocontrol(this.centroControl.getPk()); + + // tipo de planificacion codigo + this.record.setIdPlanificacion(this.idPlanificacion); + + // tipo de planificacion catalogo + this.record.setPlanificacion("TIPOPLANIFICACION"); + + // presupuesto + this.record.setPresupuesto(this.presupuesto1); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + + request.getModifiedData().put("PLANIFICACION", this.record); + codigoPlanificacion = this.record.getCodigo(); + request.getModifiedData().put("INSPECCIONES", this.planificacionTramiteController.getLrecord()); + + Response resp = callerhelper.executeSave(request); + + this.cplanificacion = (Long) resp.get("CPLANIFICACION"); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.planificacionTramiteController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + this.planificacionSalvada = true; + btnFlujo = Boolean.TRUE; + } else { + // MessageHelper.setMessageError(resp); + // this.planificacionSalvada=false; + } + } else { + // MessageHelper.setMessageError(new Exception(MsgControlArmas.getProperty("msg_planificacionNoGenerada"))); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Metodo que inicia el flujo + */ + @Override + public void iniciarFlujo() { + try { + if (cplanificacion == null || cplanificacion == 0) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generarlaplanificacion")); + return; + } + Request request = this.callerhelper.getRequest(); + super.cleanRequest(request); + // Iniciando el flujo + request.modifiedData().put("cplanificacion", this.cplanificacion); + request.modifiedData().put("cprovincia", cprovincia); + request.modifiedData().put("isnew", "Y"); + request.setLogsolicitude(codigoPlanificacion);//codigo de la planificaion PAB-2014-01 + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.setShowRow(true); + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + " " + MsgControlArmas.getProperty("msg_noplanificacion") + " : " + codigoPlanificacion); + cplanificacion = null; + btnFlujo = Boolean.FALSE; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que genera la planificacion + */ + public void generarPlanificacion() { + try { + + //Verificando que no existan planificaciones previas para + //el centro de control y el anno seleccionado + List planificaciones = PlanificacionInspeccionController.findAllByCentroControlAnno(this.centroControl.getPk(), this.record.getAnno().toString()); + if (!planificaciones.isEmpty()) { + MessageHelper.setMessageError(new Exception(MsgControlArmas.getProperty("msg_existePlanificacionAnno"))); + } else { + this.planificacionGenerada = false; + this.planificacionTramiteController.getLrecord().clear(); + + // Cargando los documentos habilitantes + //this.documentoHabilitanteController.setFechaInicio(this.record.getFechainicio()); + //this.documentoHabilitanteController.setFechaFin(this.record.getFechafin()); + List lstDocumentohabilitantes = DocumentoHabilitanteController.findInspeccionesGenerar(this.record.getFechainicio(), this.record.getFechafin(), this.centroControl); + + if (lstDocumentohabilitantes != null && !lstDocumentohabilitantes.isEmpty()) { + int i = 0; + for (TarmDocumentoHabilitante documento : lstDocumentohabilitantes) { + System.out.println("i.." + i); + i++; + // Persona + // TcustPersonDetail detallesPersona = PersonDetailController.find(documento.getPersoncode().toString()); + // Tramite + if (documento.getCtramite() != null) { + //TarmTramite tramite = TarmTramiteController.find(documento.getCtramite().toString()); + + if (documento.getModifiedData().get("ctramite") != null) { + + TarmPlanificacionTramite inspeccion = new TarmPlanificacionTramite(); + inspeccion.setCsolicitud(documento.getCsolicitud()); + + inspeccion.setCtramite(Long.parseLong(documento.getModifiedData().get("ctramite").toString())); + inspeccion.setCdocumento(documento.getPk()); + inspeccion.setIsnew(true); + + inspeccion.getModifiedData().put("nombre", documento.getModifiedData().get("nombre")); + inspeccion.getModifiedData().put("nodocumento", documento.getModifiedData().get("nodocumento")); + inspeccion.getModifiedData().put("tipotramite", documento.getModifiedData().get("tipotramite")); + inspeccion.getModifiedData().put("usoactividad", documento.getModifiedData().get("usoactividad")); + inspeccion.getModifiedData().put("categoria", documento.getModifiedData().get("categoria")); + inspeccion.getModifiedData().put("fechacaducidad", documento.getFechaexpiracion()); + + Calendar calendario = Calendar.getInstance(); + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + Integer dia = calendario.get(Calendar.DAY_OF_MONTH); + Integer mes = calendario.get(Calendar.MONTH); + Integer anno = calendario.get(Calendar.YEAR); + + // Fecha actual + java.util.Date fechaActual = sdf.parse(dia.toString() + "-" + mes.toString() + "-" + anno.toString()); + + // Fecha expiracion + calendario.setTime(documento.getFechaexpiracion()); + dia = calendario.get(Calendar.DAY_OF_MONTH); + mes = calendario.get(Calendar.MONTH); + anno = calendario.get(Calendar.YEAR); + java.util.Date fechaExpiracion = sdf.parse(dia.toString() + "-" + mes.toString() + "-" + anno.toString()); + + // Asignando el estado del tramite Caducada o Vigente + if (fechaExpiracion.compareTo(fechaActual) < 0) { + inspeccion.getModifiedData().put("estado", "Caducada"); + } else { + inspeccion.getModifiedData().put("estado", "Vigente"); + } + + // Calendar calendar = Calendar.getInstance(); + // this.record.setFechageneracion(new Date(calendar.getTimeInMillis())); + // Asignando el mes + calendario.setTime(documento.getFechaexpiracion()); + Integer intmesnumero = calendario.get(Calendar.MONTH); + inspeccion.setMesnumero(Long.parseLong(intmesnumero.toString())); + switch (calendario.get(Calendar.MONTH)) { + case 0: + //inspeccion.setMes("Enero"); + inspeccion.getModifiedData().put("ordena", 0); + break; + case 1: + //inspeccion.setMes("Febrero"); + inspeccion.getModifiedData().put("ordena", 1); + break; + case 2: + //inspeccion.setMes("Marzo"); + inspeccion.getModifiedData().put("ordena", 2); + break; + case 3: + //inspeccion.setMes("Abril"); + inspeccion.getModifiedData().put("ordena", 3); + break; + case 4: + //inspeccion.setMes("Mayo"); + inspeccion.getModifiedData().put("ordena", 4); + break; + case 5: + //inspeccion.setMes("Junio"); + inspeccion.getModifiedData().put("ordena", 5); + break; + case 6: + //inspeccion.setMes("Julio"); + inspeccion.getModifiedData().put("ordena", 6); + break; + case 7: + //inspeccion.setMes("Agosto"); + inspeccion.getModifiedData().put("ordena", 7); + break; + case 8: + // inspeccion.setMes("Septiembre"); + inspeccion.getModifiedData().put("ordena", 8); + break; + case 9: + // inspeccion.setMes("Octubre"); + inspeccion.getModifiedData().put("ordena", 9); + break; + case 10: + // inspeccion.setMes("Noviembre"); + inspeccion.getModifiedData().put("ordena", 10); + break; + case 11: + // inspeccion.setMes("Diciembre"); + inspeccion.getModifiedData().put("ordena", 11); + break; + } + + inspeccion.setMes(""); +// Inspectores + + inspeccion.getModifiedData().put("inspectores", "0"); + + // Vehiculos + inspeccion.getModifiedData().put("vehiculos", "0"); + + // periodo + // inspeccion.setPeriodo("1er Trimestre"); + inspeccion.getModifiedData().put("periodo", ""); + + // presupuesto + inspeccion.getModifiedData().put("presupuesto", ""); + + // Asignando el record + this.planificacionTramiteController.create(); + this.planificacionTramiteController.setRecord(inspeccion); + this.planificacionTramiteController.update(); + } + } + } + + // Ordenando las inspecciones por Mes y por Nombre + //ordena la lista lvigenciaMeses TarmDocumentoHabilitante documento : lstDocumentohabilitantes + Collections.sort(planificacionTramiteController.getLrecord(), new Comparator() { + public int compare(TarmPlanificacionTramite p1, TarmPlanificacionTramite p2) { + return new Integer(Integer.parseInt(p1.getModifiedData().get("ordena").toString())).compareTo(new Integer(p2.getModifiedData().get("ordena").toString())); + } + }); + + if (!this.planificacionTramiteController.getLrecord().isEmpty()) { + this.planificacionGenerada = true; + } else { + this.planificacionGenerada = false; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_noExistenTramitesAnno") + " " + this.record.getAnno(), + new Object()); + } + } else { + this.planificacionGenerada = false; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_noExistenTramitesAnno") + " " + this.record.getAnno(), new Object()); + } + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que carga los meses disponibles atendiendo a la fecha de + * expiracion del documento + * + * @param tramite + */ + public void cargarMeses() { + + this.listaMeses.clear(); + + this.meses = this.planificacionTramiteController.getRecord().getPeriodo(); + + // this.planificacionTramiteController.getRecord().getPeriodo(); + // MessageHelper.setMessageError(prueba.trim()); + // 1er Cuatrimestre + if (this.meses != null) { + + if (this.meses.equalsIgnoreCase("Mensual")) { + listaMeses.add("Enero"); + listaMeses.add("Febrero"); + listaMeses.add("Marzo"); + listaMeses.add("Abril"); + listaMeses.add("Mayo"); + listaMeses.add("Junio"); + listaMeses.add("Julio"); + listaMeses.add("Agosto"); + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + } + + if (this.meses.equalsIgnoreCase("1er Cuatrimestre")) { + listaMeses.add("Enero"); + listaMeses.add("Febrero"); + listaMeses.add("Marzo"); + listaMeses.add("Abril"); + } + if (this.meses.equalsIgnoreCase("2do Cuatrimestre")) { + + listaMeses.add("Mayo"); + listaMeses.add("Junio"); + listaMeses.add("Julio"); + listaMeses.add("Agosto"); + } + if (this.meses.equalsIgnoreCase("3er Cuatrimestre")) { + + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + } + + if (this.meses.equalsIgnoreCase("1er Semestre")) { + listaMeses.add("Enero"); + listaMeses.add("Febrero"); + listaMeses.add("Marzo"); + listaMeses.add("Abril"); + listaMeses.add("Mayo"); + listaMeses.add("Junio"); + + } + + if (this.meses.equalsIgnoreCase("2do Semestre")) { + + listaMeses.add("Julio"); + listaMeses.add("Agosto"); + listaMeses.add("Septiembre"); + listaMeses.add("Octubre"); + listaMeses.add("Noviembre"); + listaMeses.add("Diciembre"); + + } + } else { + this.listaMeses.clear(); + } + + // } + } + + public void cargarPeriodo(TarmPlanificacionTramite inspeccion) { + + this.listaMeses.clear(); + this.listaPeriodo.clear(); + + switch (this.idPlanificacion) { + case "1": + + listaPeriodo.add("Mensual"); + + break; + case "2": + listaPeriodo.add("1er Cuatrimestre"); + listaPeriodo.add("2do Cuatrimestre"); + listaPeriodo.add("3er Cuatrimestre"); + + break; + case "3": + listaPeriodo.add("1er Semestre"); + listaPeriodo.add("2do Semestre"); + + break; + + } + cargarMeses(); + + } + + /** + * Metodo que genera el codigo de la planificacion teniendo en cuenta el + * anio introducido por el usuario + */ + public void generarCodigoPlanificacion() { + try { + // Descripcion + this.record.setDescripcion(MsgControlArmas.getProperty("lbl_planificacionAnual") + " " + this.record.getAnno().toString()); + + // Codigo + Integer numeroPlanificacion = 1; + String textoNoPlanificacion = ""; + List planificacionesTmp = PlanificacionInspeccionController.findPorAnno(this.record.getAnno()); + if (planificacionesTmp != null && !planificacionesTmp.isEmpty()) { + numeroPlanificacion = planificacionesTmp.size() + 1; + } + if (numeroPlanificacion < 10) { + textoNoPlanificacion = "0" + numeroPlanificacion.toString(); + } else { + textoNoPlanificacion = numeroPlanificacion.toString(); + } + this.record.setCodigo("PAP-" + this.record.getAnno().toString() + "-" + textoNoPlanificacion); + + // Fecha inicio + Calendar calendario = Calendar.getInstance(); + calendario.set(Calendar.YEAR, Integer.parseInt(this.record.getAnno().toString())); + calendario.set(Calendar.DAY_OF_MONTH, 1); + calendario.set(Calendar.MONTH, 0); + this.record.setFechainicio(new Date(calendario.getTimeInMillis())); + + calendario.set(Calendar.DAY_OF_MONTH, 31); + calendario.set(Calendar.MONTH, 11); + this.record.setFechafin(new Date(calendario.getTimeInMillis())); + + this.habilitarGeneracion = true; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Busca las planificaciones de un anio + * + * @param codigoSolicitud + * @return + */ + public static List findPorAnno(Long anno) { + try { + PlanificacionInspeccionController cc = new PlanificacionInspeccionController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("anno", anno.toString()); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca todas las planificaciones + * + * @param codigoSolicitud + * @return + */ + public static List findAllByCentroControl(String ccentrocontrol) { + try { + PlanificacionInspeccionController cc = new PlanificacionInspeccionController(); + // cc.init(); + cc.recperpage = 300; + cc.addFilter("ccentrocontrol", ccentrocontrol); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca todas las planificaciones + * + * @param codigoSolicitud + * @return + */ + public static List findAllByCentroControlAnno(String ccentrocontrol, String anno) { + try { + PlanificacionInspeccionController cc = new PlanificacionInspeccionController(); + // cc.init(); + cc.recperpage = 300; + cc.addFilter("ccentrocontrol", ccentrocontrol); + cc.addFilter("anno", anno); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca una planificacion por su codigo + * + * @param codigoSolicitud + * @return + */ + public static TarmPlanificacionInspeccion findPorCodigo(Long cplanificacion) { + try { + PlanificacionInspeccionController cc = new PlanificacionInspeccionController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", cplanificacion.toString()); + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public PlanificacionTramiteController getPlanificacionTramiteController() { + return planificacionTramiteController; + } + + public void setPlanificacionTramiteController(PlanificacionTramiteController planificacionTramiteController) { + this.planificacionTramiteController = planificacionTramiteController; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getNombreCentroControl() { + return nombreCentroControl; + } + + public void setNombreCentroControl(String nombreCentroControl) { + this.nombreCentroControl = nombreCentroControl; + } + + public DocumentoHabilitanteController getDocumentoHabilitanteController() { + return documentoHabilitanteController; + } + + public void setDocumentoHabilitanteController(DocumentoHabilitanteController documentoHabilitanteController) { + this.documentoHabilitanteController = documentoHabilitanteController; + } + + public Boolean getPlanificacionSalvada() { + return planificacionSalvada; + } + + public void setPlanificacionSalvada(Boolean planificacionSalvada) { + this.planificacionSalvada = planificacionSalvada; + } + + public Boolean getPlanificacionGenerada() { + return planificacionGenerada; + } + + public void setPlanificacionGenerada(Boolean planificacionGenerada) { + this.planificacionGenerada = planificacionGenerada; + } + + public List getListaMeses() { + return listaMeses; + } + + public void setListaMeses(List listaMeses) { + this.listaMeses = listaMeses; + } + + public List getListaPeriodo() { + return listaPeriodo; + } + + public void setListaPeriodo(List listaPeriodo) { + this.listaPeriodo = listaPeriodo; + } + + public String getPeriodo() { + return Periodo; + } + + public void setPeriodo(String Periodo) { + this.Periodo = Periodo; + } + + public Boolean getHabilitarGeneracion() { + return habilitarGeneracion; + } + + public void setHabilitarGeneracion(Boolean habilitarGeneracion) { + this.habilitarGeneracion = habilitarGeneracion; + } + + public List getListaAnnos() { + return listaAnnos; + } + + public void setListaAnnos(List listaAnnos) { + this.listaAnnos = listaAnnos; + } + + public Boolean getPlanificacionesPrevias() { + return planificacionesPrevias; + } + + public void setPlanificacionesPrevias(Boolean planificacionesPrevias) { + this.planificacionesPrevias = planificacionesPrevias; + } + + public TarmCentroControlJur getJurisdiccionCentroControl() { + return jurisdiccionCentroControl; + } + + public void setJurisdiccionCentroControl(TarmCentroControlJur jurisdiccionCentroControl) { + this.jurisdiccionCentroControl = jurisdiccionCentroControl; + } + + public List getPlanificaciones() { + return planificaciones; + } + + public void setPlanificaciones(List planificaciones) { + this.planificaciones = planificaciones; + } + + public PersonAddressController getPersonAddressController() { + return personAddressController; + } + + public void setPersonAddressController(PersonAddressController personAddressController) { + this.personAddressController = personAddressController; + } + + public Long getCplanificacion() { + return cplanificacion; + } + + public void setCplanificacion(Long cplanificacion) { + this.cplanificacion = cplanificacion; + } + + public Boolean getBtnFlujo() { + return btnFlujo; + } + + public void setBtnFlujo(Boolean btnFlujo) { + this.btnFlujo = btnFlujo; + } + + /*CFLORES*/ + public List getTipoplanificacionList() { + return tipoplanificacionList; + } + + public void setTipoplanificacionList(List tipoplanificacionList) { + this.tipoplanificacionList = tipoplanificacionList; + } + + public String getIdPlanificacion() { + return idPlanificacion; + } + + public void setIdPlanificacion(String idPlanificacion) { + this.idPlanificacion = idPlanificacion; + } + + public Float getPresupuesto1() { + return presupuesto1; + } + + public void setPresupuesto1(Float presupuesto1) { + this.presupuesto1 = presupuesto1; + } + + /**/ +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/PlanificacionTramiteController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/PlanificacionTramiteController.java new file mode 100644 index 0000000..ba9648d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/PlanificacionTramiteController.java @@ -0,0 +1,318 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.ins.TarmPlanificacionTramite; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class PlanificacionTramiteController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 1L; + + private Long cplanificacion; + + public String Periodo; + + public PlanificacionTramiteController() throws Exception { + super(TarmPlanificacionTramite.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "PLANIFICACIONTRAMITECONTROLLER"; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void query() throws Exception { + // TODO Auto-generated method stub + MessageHelper.setMessageError("msg_notQuery"); + super.query(); + } + + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Busca las inspecciones solo para la Tarea de Aprobacion + */ + @SuppressWarnings("unchecked") + protected void querydatabaseAprobacion() { + try { + DtoQuery dto = super.getDtoQuery(true); +// //Nombre/Razon social + SubQuery subqueryNombre = new SubQuery("TcustPersonDetail", "name", "nombre", "i.pk.personcode=(select o.personcode from TarmDocumentoHabilitante o where o.pk=t.cdocumento) and" + + " i.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryNombre); + SubQuery subqueryNDocumento = new SubQuery("TcustPersonDetail", "identification", "nodocumento", "i.pk.personcode=(select o.personcode from TarmDocumentoHabilitante o where o.pk=t.cdocumento) and" + + " i.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryNDocumento); +// //datos del tramite +// //Tipo de tramite + SubQuery subqueryTipoTramite = new SubQuery("TgeneCatalogDetail", "description", "tipotramite", "i.pk.catalog= (select o.tipotramite from TarmTramite o where o.pk=t.ctramite) and" + + " i.pk.catalogcode=(select o.tipotramitecodigo from TarmTramite o where o.pk=t.ctramite)"); + dto.addSubQuery(subqueryTipoTramite); + SubQuery subqueryTramite = new SubQuery("TgeneCatalogDetail", "description", "tipoautorizacion", "i.pk.catalog= (select o.tipoautorizacion from TarmTramite o where o.pk=t.ctramite) and" + + " i.pk.catalogcode=(select o.tipoautorizacioncodigo from TarmTramite o where o.pk=t.ctramite) "); + dto.addSubQuery(subqueryTramite); +// //Uso/Actividad + SubQuery subqueryUsoActividad = new SubQuery("TgeneCatalogDetail", "description", "usoactividad", "i.pk.catalog= (select o.usoactividad from TarmTramite o where o.pk=t.ctramite) and" + + " i.pk.catalogcode=(select o.usoactividadcodigo from TarmTramite o where o.pk=t.ctramite)"); + dto.addSubQuery(subqueryUsoActividad); +// //Categoria + SubQuery subqueryCategoria = new SubQuery("TgeneCatalogDetail", "description", "categoria", "i.pk.catalog= (select o.categoria from TarmTramite o where o.pk=t.ctramite) and" + + " i.pk.catalogcode=(select o.categoriacodigo from TarmTramite o where o.pk=t.ctramite)"); + dto.addSubQuery(subqueryCategoria); + + SubQuery subqueryCodTramite = new SubQuery("TarmDocumentoHabilitante", "fechaexpiracion", "fechacaducidad", "i.pk= t.cdocumento"); + dto.addSubQuery(subqueryCodTramite); + //Filtro de codigo de planificacion + if (this.cplanificacion != null) { + dto.addFiltro(new Filter("cplanificacion", this.cplanificacion.toString())); + } + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + for (TarmPlanificacionTramite inspeccion : this.lrecord) { + + Calendar calendario = Calendar.getInstance(); + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + Integer dia = calendario.get(Calendar.DAY_OF_MONTH); + Integer mes = calendario.get(Calendar.MONTH); + Integer anno = calendario.get(Calendar.YEAR); + + //Fecha actual + java.util.Date fechaActual = sdf.parse(dia.toString() + "-" + mes.toString() + "-" + anno.toString()); + + //Fecha expiracion + calendario.setTime((Date) inspeccion.getModifiedData().get("fechacaducidad")); + dia = calendario.get(Calendar.DAY_OF_MONTH); + mes = calendario.get(Calendar.MONTH); + anno = calendario.get(Calendar.YEAR); + java.util.Date fechaExpiracion = sdf.parse(dia.toString() + "-" + mes.toString() + "-" + anno.toString()); + + //Asignando el estado del tramite Caducada o Vigente + if (fechaExpiracion.compareTo(fechaActual) < 0) { + inspeccion.getModifiedData().put("estado", "Caducada"); + } else { + inspeccion.getModifiedData().put("estado", "Vigente"); + } + + inspeccion.getModifiedData().put("presupuesto", inspeccion.getPresupuesto()); + inspeccion.getModifiedData().put("inspectores", this.record.getInspectores()); +// } + } + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + @Override + public void update() throws Exception { + try { + if (this.record.getMes().equalsIgnoreCase("Enero")) { + this.record.setMesnumero(0L); + } else if (this.record.getMes().equalsIgnoreCase("Febrero")) { + this.record.setMesnumero(1L); + } else if (this.record.getMes().equalsIgnoreCase("Marzo")) { + this.record.setMesnumero(2L); + } else if (this.record.getMes().equalsIgnoreCase("Abril")) { + this.record.setMesnumero(3L); + } else if (this.record.getMes().equalsIgnoreCase("Mayo")) { + this.record.setMesnumero(4L); + } else if (this.record.getMes().equalsIgnoreCase("Junio")) { + this.record.setMesnumero(5L); + } else if (this.record.getMes().equalsIgnoreCase("Julio")) { + this.record.setMesnumero(6L); + } else if (this.record.getMes().equalsIgnoreCase("Agosto")) { + this.record.setMesnumero(7L); + } else if (this.record.getMes().equalsIgnoreCase("Spetiembre")) { + this.record.setMesnumero(8L); + } else if (this.record.getMes().equalsIgnoreCase("Octubre")) { + this.record.setMesnumero(9L); + } else if (this.record.getMes().equalsIgnoreCase("Noviembre")) { + this.record.setMesnumero(10L); + } else if (this.record.getMes().equalsIgnoreCase("Diciembre")) { + this.record.setMesnumero(11L); + } + + // this.record.setPeriodo("hola1"); + super.update(); + //ordenarPorMesNombre(); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Busca las las inspecciones de una planificacion dado su codigo + * + * @param codigoSolicitud + * @return + */ + public static List findPorCodigoPlanificacion(Long cplanificacion) { + try { + PlanificacionTramiteController cc = new PlanificacionTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("cplanificacion", cplanificacion.toString()); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo apara actualizar el registro + * + * @throws Exception + */ + public void actualizar(TarmPlanificacionTramite planificacionTramite) throws Exception { + record = planificacionTramite; + super.update(); + } + + public Long getCplanificacion() { + return cplanificacion; + } + + public void setCplanificacion(Long cplanificacion) { + this.cplanificacion = cplanificacion; + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + + public String getPeriodo() { + return Periodo; + } + + public void setPeriodo(String Periodo) { + this.Periodo = Periodo; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RecepcionArmasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RecepcionArmasController.java new file mode 100644 index 0000000..81f8596 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RecepcionArmasController.java @@ -0,0 +1,1827 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.CargaController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.inte.TarmColadeImpresion; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmAgenciaArma; +import com.fp.persistence.parmas.soli.TarmArmaPruebas; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.parmas.soli.TarmSolicitudGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Controlador principal que maneja la entidad TarmSolicitudArmas + * + * @author Carlos Guzman + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RecepcionArmasController extends AbstractController { + + private TcustPersonDetail personaDetalle; + private String provincia; + private String canton; + private String ciudad; + private String direccion; + private List lArmas = new ArrayList(); + private List lSolicitudGuardias = new ArrayList(); + private List lGuardias = new ArrayList(); + private TgeneCatalogDetail detallecatalogo = new TgeneCatalogDetail(); + private TgeneCatalogDetail detallecatalogoTipoTramite = new TgeneCatalogDetail(); + private TgeneCatalogDetail usoActividad = new TgeneCatalogDetail(); + private TgeneCatalogDetail tipoAutorizacion = new TgeneCatalogDetail(); + private TgeneCatalogDetail categoria = new TgeneCatalogDetail(); + private TgeneCatalogDetail identificacion = new TgeneCatalogDetail(); + private TgeneCatalogDetail estadotramite = new TgeneCatalogDetail(); + private TgeneCatalogDetail tipoArchivo = new TgeneCatalogDetail(); + private TgeneCatalogDetail tipoCosto = new TgeneCatalogDetail(); + private TgeneCatalogDetail vigencia = new TgeneCatalogDetail(); + private TarmSolicitudTramite solicitudTramite = new TarmSolicitudTramite(); + private TsafeUserDetail tsafeUserDetailUsuario = null; + private TarmTramite tramite = new TarmTramite(); + private TarmSolicitud solicitud = new TarmSolicitud(); + private TarmTipoArmaExplosivo tipoArmaExplosivo = new TarmTipoArmaExplosivo(); + private boolean controlPantallaEntregado; + private boolean controlPantallaVisualizarTramiteFirmar; + private boolean controlPantallaVerificarInformacionDevolucion; + private String codigoSolicitud = ""; + private String observacion; + private String estado; + private Date fec_actual; + private String xpathflujo; + private TcustPersonDetail responsableCentroControl = null; + private TsafeUserDetail usuario; + private Boolean btnFlujo; + private Boolean btnGrabar; + /** + * lista del catalogo de las acciones (Aceptar o rechazar) + */ + private List laccion; + + private TarmCentroControl centroControl = new TarmCentroControl(); + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddressController; + + @ManagedProperty(value = "#{solicitudGuardiasController}") + private SolicitudGuardiasController solicitudGuardiasController; + + @ManagedProperty(value = "#{armasController}") + private ArmasController armasController; + + @ManagedProperty(value = "#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitanteController; + + @ManagedProperty(value = "#{colaImpresionController}") + private ColaImpresionController colaImpresionController; + + @ManagedProperty(value = "#{documentoHabilitanteDetalleController}") + private DocumentoHabilitanteDetalleController documentoHabilitanteDetalleController; + + @ManagedProperty(value = "#{solicitudTramiteController}") + private SolicitudTramiteController solicitudTramiteController; + + @ManagedProperty(value = "#{solicitudController}") + private SolicitudController solicitudController; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * Controlador que maneja cargas para previa importacion + */ + @ManagedProperty(value = "#{cargaController}") + private CargaController cargaController; + + /** + * controlador de la solicitud + */ + @ManagedProperty(value = "#{solicitudArmasController}") + private SolicitudArmasController solicitudMP; + + /** + * Controlador que maneja las armas asociadas a las agencias + */ + @ManagedProperty(value = "#{agenciaArmaController}") + private AgenciaArmaController agenciaArma; + + private String numeroTransaccion = ""; + + private List solAgenciaSucursals; + + private List documentosList; + + private Boolean requiereNoSolAucpBln; + + /** + * Nombre de la Institucion + */ + private String nombreInstitucion; + + public RecepcionArmasController() throws Exception { + super(TarmSolicitudArmas.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + startQuery(); + this.init(); + querydatabase(); + + solicitudController = new SolicitudController(); + + Boolean aprobarFichaBLN = Boolean.FALSE; + + laccion = new ArrayList(); + + // Validamos en el caso de permisos + TarmTramite tramite = TarmTramiteController.find(numeroTransaccion); + TgeneCatalogDetail tipoAutorizacion = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + + if (tipoAutorizacion != null && tipoAutorizacion.getDescription().equalsIgnoreCase("PERMISO")) { + List armaPruebaList = IngresoFichaTecnicaArmasController.buscarFichasPorSolicitud(codigoSolicitud); + for (TarmArmaPruebas armaPruebaObj : armaPruebaList) { + if (armaPruebaObj.getApruebaevaluacion().equalsIgnoreCase("Y")) { + aprobarFichaBLN = Boolean.TRUE; + break; + } + } + if (aprobarFichaBLN) { + laccion = CatalogDetailController.find("ACCION"); + } else { + TgeneCatalogDetail catalogRechazar = CatalogDetailController.findCatalogo("ACCION", "RECH"); + laccion.add(catalogRechazar); + } + } else { + laccion = CatalogDetailController.find("ACCION"); + } + + try { + //consulta de agencias + cargarAgencias(); + //consulta de documentos + cargarDocumentos(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Método en el cual se cargan las agencias que corresponden a la + * solicitud + * + * @throws Exception + */ + private void cargarAgencias() throws Exception { + if (codigoSolicitud != null) { + solAgenciaSucursals = SolicitudAgenciaSucursalController.findPorSolicitud(codigoSolicitud); + } + } + + /** + * Método en el cual se cargan las agencias que corresponden a la + * solicitud + * + * @throws Exception + */ + private void cargarDocumentos() throws Exception { + if (codigoSolicitud != null) { + documentosList = TarmSolicitudDocumentoController.findPorSolicitud(codigoSolicitud);//documentoHabilitanteController.lrecord + } + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + //xpathflujo=super.getMfilters().get("xpath");//"cm:Decomiso/cm:A-2014/cm:M-10/cm:ENV-000000319/cm:ENV-000000319.pdf";// + numeroTransaccion = super.getMfilters().get("numerotransaccion"); + codigoSolicitud = super.getMfilters().get("csolicitud"); + System.out.println("numeroTransaccion .." + numeroTransaccion); + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + private void init() { + try { + validarpantallaActual(); + recperpage = 500; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "RECEPCIONARMAS"; + this.responsableCentroControl = new TcustPersonDetail(); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + usuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + this.fec_actual = new Date(); + btnFlujo = Boolean.FALSE; + btnGrabar = Boolean.TRUE; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + this.lArmas.clear(); + this.lGuardias.clear(); + if (codigoSolicitud == null) { + return; + } + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.csolicitud"); + + SubQuery subquerymodelo = new SubQuery("TarmArmas", "modelo", "modelo", "i.pk=t.pk.carma"); + dto.addSubQuery(subquerymodelo); + SubQuery subqueryacrma = new SubQuery("TarmArmas", "pk", "carma", "i.pk=t.pk.carma"); + dto.addSubQuery(subqueryacrma); + + SubQuery subqueryserie = new SubQuery("TarmArmas", "lote", "lote", "i.pk=t.pk.carma"); + dto.addSubQuery(subqueryserie); + + SubQuery subqueryCantidad = new SubQuery("TarmArmas", "cantidad", "cantidad", "i.pk=t.pk.carma"); + dto.addSubQuery(subqueryCantidad); + + SubQuery subqueryPeso = new SubQuery("TarmArmas", "peso", "peso", "i.pk=t.pk.carma"); + dto.addSubQuery(subqueryPeso); + + SubQuery subqueryUnidadMedida = new SubQuery("TgeneCatalogDetail", "description", "unidadmedida", "i.pk.catalog=(select p.unidadmedidacantidad from TarmArmas p where p.pk=t.pk.carma) and" + + " i.pk.catalogcode=(select p.unidadmedidacantidadcodigo from TarmArmas p where p.pk=t.pk.carma)"); + dto.addSubQuery(subqueryUnidadMedida); + + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", "i.pk.catalog= (select o.marca from TarmArmas o where o.pk=t.pk.carma) " + + " and i.pk.catalogcode=(select o.marcacodigo from TarmArmas o where o.pk=t.pk.carma)"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog=(select o.color from TarmArmas o where o.pk=t.pk.carma)" + + " and i.pk.catalogcode=(select o.colorcodigo from TarmArmas o where o.pk=t.pk.carma)"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog=(select o.estado from TarmArmas o where o.pk=t.pk.carma)" + + " and i.pk.catalogcode=(select o.estadocodigo from TarmArmas o where o.pk=t.pk.carma)"); + dto.addSubQuery(subqueryEstado); + + SubQuery subqueryClase = new SubQuery("TgeneCatalogDetail", "description", "clase", "i.pk.catalog=(select o.clase from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + dto.addSubQuery(subqueryClase); + + SubQuery subqueryLongitud = new SubQuery("TgeneCatalogDetail", "description", "longitud", "i.pk.catalog=(select o.longitud from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.longitudcodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + dto.addSubQuery(subqueryLongitud); + + SubQuery subqueryCalibre = new SubQuery("TgeneCatalogDetail", "description", "calibre", "i.pk.catalog=(select o.calibre from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.calibrecodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + dto.addSubQuery(subqueryCalibre); + + SubQuery subqueryTipoArma = new SubQuery("TgeneCatalogDetail", "description", "tipo", "i.pk.catalog=(select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + + dto.addSubQuery(subqueryTipoArma); + + Filter filtro = new Filter(); + filtro.setField("pk.csolicitud"); + filtro.setValue(codigoSolicitud); + dto.addFiltro(filtro); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + solicitudGuardiasController.addFilter("pk.csolicitud", codigoSolicitud); + solicitudGuardiasController.findPorSolicitud(codigoSolicitud); + solicitudGuardiasController.query(); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(beanalias); + if ((this.lrecord != null) && !this.lrecord.isEmpty()) { + } + + super.postQuery(this.lrecord); + } + + solicitud = SolicitudArmasController.find(codigoSolicitud); + + if (solicitud != null) { + personaDetalle = PersonDetailController.find(String.valueOf(solicitud.getPersoncode())); + identificacion = (personaDetalle.getIdentificationcatalog() == null || personaDetalle.getIdentificationcatalogcode() == null) ? null : CatalogDetailController.findxCodigoCodcatalogo(personaDetalle.getIdentificationcatalog(), personaDetalle.getIdentificationcatalogcode()); + + if (identificacion != null) { + //personAddressController.findPersonaPorDireccionTipoCatalogo(String.valueOf(solicitud.getPersoncode()), tipoDireccion); + TcustPersonAddress direccionCliente = personAddressController.findPrincipal(String.valueOf(solicitud.getPersoncode())); + provincia = direccionCliente.modifiedData().get("provincia") == null ? null : direccionCliente.modifiedData().get("provincia").toString(); //personAddressController.getLprovinces()==null || .getLprovinces().isEmpty()?null:personAddressController.getLprovinces().get(0); + canton = direccionCliente.modifiedData().get("canton") == null ? null : direccionCliente.modifiedData().get("canton").toString();//personAddressController.getLcantones()==null || personAddressController.getLcantones().isEmpty()?null:personAddressController.getLcantones().get(0); + ciudad = direccionCliente.modifiedData().get("ciudad") == null ? null : direccionCliente.modifiedData().get("ciudad").toString();//personAddressController.getLcities()==null || personAddressController.getLcities().isEmpty()?null:personAddressController.getLcities().get(0); + direccion = direccionCliente.getAddress(); + } + + } + + //Proceso de tramite + solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(codigoSolicitud); + if (solicitudTramite != null && solicitudTramite.getPk().getCtramite() != null) { + tramite = TarmTramiteController.find(solicitudTramite.getPk().getCtramite().toString()); + estadotramite = (solicitudTramite.getEstadotramite() == null || solicitudTramite.getEstadotramitecodigo() == null) ? null : CatalogDetailController.findxCodigoCodcatalogo(solicitudTramite.getEstadotramite(), solicitudTramite.getEstadotramitecodigo()); + } + + if (tramite != null && tramite.getPk() != null) { + detallecatalogo = (tramite.getCategoria() == null || tramite.getCategoriacodigo() == null) ? null : CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + detallecatalogoTipoTramite = (tramite.getTipoautorizacion() == null || tramite.getTipoautorizacioncodigo() == null) ? null : CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + vigencia = CatalogDetailController.findxCodigoCodcatalogo(tramite.getVigencia(), tramite.getVigenciacodigo()); + tipoArchivo = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoarchivo(), tramite.getTipoarchivocodigo()); + tipoCosto = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipocosto(), tramite.getTipocostocodigo()); + usoActividad = (tramite.getUsoactividad() == null || tramite.getUsoactividadcodigo() == null) ? null : CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + tipoAutorizacion = (tramite.getTipoautorizacion() == null || tramite.getTipoautorizacioncodigo() == null) ? null : CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + categoria = (tramite.getCategoria() == null || tramite.getCategoriacodigo() == null) ? null : CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + // CATEGORIA 14 PREVIA IMPORTACION + if (tramite != null && tramite.getCategoria().equals("14")) { + requiereNoSolAucpBln = Boolean.TRUE; + nombreInstitucion = obtenerCentroControl(); + } else { + requiereNoSolAucpBln = Boolean.FALSE; + } + } + + armasController.setRecperpage(500); + + //lArmas = armasController.findArmaRecep(lrecord.get(0).getPk().getCsolicitud()); + for (TarmSolicitudArmas solicitudArmas : lrecord) { + TarmArmas armas = new TarmArmas(); + armas = armasController.find(solicitudArmas.getPk().getCarma(), null); + lArmas.add(armas); + } + armasController.setLrecord(lArmas); + actualizarArmas(); + List listaCentroControl = null; + if (solicitud != null && solicitud.getCcentrocontrol() != null) { + listaCentroControl = CentroControlArmasController.find(solicitud.getCcentrocontrol()); + } + + if (listaCentroControl != null && !listaCentroControl.isEmpty()) {//&& listaCentroControl.get(0).getTramitespordia()!=null){ + centroControl = listaCentroControl.get(0); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que usa para pasar el flujo al seleccionar el boton guardar + */ + public void guardar() { + + } + + private void guardarcolaImpresionController(HashMap msave) throws Throwable { + System.out.println("ACTUALIZA COLA DE IMPRESION"); + TarmDocumentoHabilitante docHabilitante = DocumentoHabilitanteController.findPorSolicitud(codigoSolicitud); + if (docHabilitante != null && docHabilitante.getPk() != null) { + System.out.println("ACTUALIZA COLA DE IMPRESION 1"); + List listaColaImprecion = ColaImpresionController.findByDocumentoCDoc(docHabilitante.getPk().toString()); + if (listaColaImprecion != null && listaColaImprecion.size() > 0) { + System.out.println("ACTUALIZA COLA DE IMPRESION 2"); + for (TarmColadeImpresion item : listaColaImprecion) { + item.setEstadoimpresion("PIMPR"); + item.setEstadoimpresioncode("ESTADOIMPRESION"); + colaImpresionController.update(item); + } + System.out.println("ACTUALIZA COLA DE IMPRESION 3"); + registrarGuardadoColaImpresion(msave); + System.out.println("ACTUALIZA COLA DE IMPRESION 4"); + } + } + + } + + private void registrarGuardadoColaImpresion(HashMap msave) throws Throwable { + //= new HashMap(); + Request request = callerhelper.getRequest(); + DtoSave dtosaveColaImpresion = this.colaImpresionController.getDtoSave(true); + dtosaveColaImpresion.setReturnpk(true); + dtosaveColaImpresion.setPosition(1); + msave.put(colaImpresionController.getBeanalias(), dtosaveColaImpresion); + request.setSaveTables(msave); +// Response resp = callerhelper.executeSave(request); +// if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { +// this.colaImpresionController.postCommit(resp); +// this.postCommit(resp); +// MessageHelper.setMessageInfo(resp); +// } else { +// MessageHelper.setMessageError(resp); +// throw new Exception(""+resp); +// } + } + + /** + * Metodo para guardar los documentos habilitantes + * + * @throws Throwable + */ + public void guardarDocumentoHabilitante() throws Throwable { + HashMap msave = new HashMap(); + Calendar cal = Calendar.getInstance(); + String estado = "APR"; + System.out.println("vigencia.getDescription() " + vigencia.getDescription()); + System.out.println("vigencia.getDescription().trim().equals(1200) " + vigencia.getDescription().trim().equals("1200")); + if (vigencia.getDescription() != null && vigencia.getDescription().trim().equals("1200")) { + cal.set(Calendar.YEAR, 2999); + cal.set(Calendar.MONTH, 12); + cal.set(Calendar.DAY_OF_MONTH, 31); + } else { + cal.add(Calendar.MONTH, Integer.valueOf(vigencia.getDescription())); + } + System.out.println(cal); + System.out.println(cal.getTime()); + TarmSolicitudTramite solicitudtramite = TarmSolicitudTramiteController.findPorCSolicitud(codigoSolicitud); + if ("CARNET".equalsIgnoreCase(tipoArchivo.getDescription())) { + if ("TOTAL".equalsIgnoreCase(tipoCosto.getDescription())) { + documentoHabilitanteController.create(); + documentoHabilitanteController.getRecord().setIsnew(true); + documentoHabilitanteController.getRecord().setCsolicitud(codigoSolicitud); + documentoHabilitanteController.getRecord().setCentrocontrol(centroControl.getPk()); + documentoHabilitanteController.getRecord().setCarma(null); + documentoHabilitanteController.getRecord().setCuentareimpresion(0); + documentoHabilitanteController.getRecord().setCtramite(solicitudtramite.getPk().getCtramite()); + documentoHabilitanteController.getRecord().setFechaemision(new java.sql.Date((new Date()).getTime())); + documentoHabilitanteController.getRecord().setFechaexpiracion(new java.sql.Date((cal.getTime()).getTime())); + documentoHabilitanteController.getRecord().setPersoncode(solicitud.getPersoncode()); + documentoHabilitanteController.getRecord().setEstado(estado); + documentoHabilitanteController.getRecord().setEstadocode("ESTADODOCUMENTO"); + documentoHabilitanteController.update(); + + //Grabacion en la cola de impresion + colaImpresionController.create(); + colaImpresionController.getRecord().setIsnew(true); + //colaImpresionController.getRecord().setEstadoimpresion("PIMPR"); + //colaImpresionController.getRecord().setEstadoimpresioncode("ESTADOIMPRESION"); + java.util.Date date = new java.util.Date(); + colaImpresionController.getRecord().setFecharegistro(new java.sql.Date(date.getTime())); + colaImpresionController.update(); + + } + if ("TOTAL".equalsIgnoreCase(tipoCosto.getDescription()) && (this.lrecord == null || this.lrecord.isEmpty())) { + registrarGuardadoDocumentoHabilitante(msave); + } + + for (TarmSolicitudArmas armaSolicitud : this.lrecord) { + + if ("PARCIAL".equalsIgnoreCase(tipoCosto.getDescription())) { + documentoHabilitanteController.create(); + documentoHabilitanteController.getRecord().setIsnew(true); + documentoHabilitanteController.getRecord().setCsolicitud(codigoSolicitud); + documentoHabilitanteController.getRecord().setCentrocontrol(centroControl.getPk()); + documentoHabilitanteController.getRecord().setCarma(armaSolicitud.getPk().getCarma()); + documentoHabilitanteController.getRecord().setCodigoarma(ArmasController.findPorCodigo(armaSolicitud.getPk().getCarma()).getCodigoarma()); + documentoHabilitanteController.getRecord().setCuentareimpresion(0); + documentoHabilitanteController.getRecord().setCtramite(solicitudtramite.getPk().getCtramite()); + documentoHabilitanteController.getRecord().setFechaemision(new java.sql.Date((new Date()).getTime())); + documentoHabilitanteController.getRecord().setFechaexpiracion(new java.sql.Date((cal.getTime()).getTime())); + documentoHabilitanteController.getRecord().setPersoncode(solicitud.getPersoncode()); + documentoHabilitanteController.getRecord().setEstado(estado); + documentoHabilitanteController.getRecord().setEstadocode("ESTADODOCUMENTO"); + documentoHabilitanteController.update(); + + //Grabacion en la cola de impresion + colaImpresionController.create(); + colaImpresionController.getRecord().setIsnew(true); + //colaImpresionController.getRecord().setEstadoimpresion("PIMPR"); + //colaImpresionController.getRecord().setEstadoimpresioncode("ESTADOIMPRESION"); + java.util.Date date = new java.util.Date(); + colaImpresionController.getRecord().setFecharegistro(new java.sql.Date(date.getTime())); + colaImpresionController.update(); + } + documentoHabilitanteDetalleController.create(); + documentoHabilitanteDetalleController.getRecord().setIsnew(true); + documentoHabilitanteDetalleController.getRecord().setCarma(armaSolicitud.getPk().getCarma()); + documentoHabilitanteDetalleController.getRecord().setCodigoarma(ArmasController.findPorCodigo(armaSolicitud.getPk().getCarma()).getCodigoarma()); + documentoHabilitanteDetalleController.update(); + if ("PARCIAL".equalsIgnoreCase(tipoCosto.getDescription())) { + registrarGuardadoDocumentoHabilitante(msave); + } + } + + if ("TOTAL".equalsIgnoreCase(tipoCosto.getDescription()) && (this.lrecord != null && !this.lrecord.isEmpty())) { + registrarGuardadoDocumentoHabilitante(msave); + return; + } + + } else if ("REPORTE".equalsIgnoreCase(tipoArchivo.getDescription())) { + documentoHabilitanteController.create(); + //TarmSolicitudTramite solicitudtramite =TarmSolicitudTramiteController.findPorCSolicitud(codigoSolicitud); + documentoHabilitanteController.getRecord().setIsnew(true); + documentoHabilitanteController.getRecord().setCsolicitud(codigoSolicitud); + documentoHabilitanteController.getRecord().setCentrocontrol(centroControl.getPk()); + documentoHabilitanteController.getRecord().setCuentareimpresion(0); + documentoHabilitanteController.getRecord().setCtramite(solicitudtramite.getPk().getCtramite()); + documentoHabilitanteController.getRecord().setCarma((this.lrecord != null && !this.lrecord.isEmpty() && this.lrecord.size() > 0) ? this.lrecord.get(0).getPk().getCarma() : null); + documentoHabilitanteController.getRecord().setFechaemision(new java.sql.Date((new Date()).getTime())); + documentoHabilitanteController.getRecord().setFechaexpiracion(new java.sql.Date((cal.getTime()).getTime())); + documentoHabilitanteController.getRecord().setPersoncode(solicitud.getPersoncode()); + documentoHabilitanteController.getRecord().setEstado(estado); + documentoHabilitanteController.getRecord().setEstadocode("ESTADODOCUMENTO"); + documentoHabilitanteController.update(); + + for (TarmSolicitudArmas armaSolicitud : this.lrecord) { + documentoHabilitanteDetalleController.create(); + documentoHabilitanteDetalleController.getRecord().setIsnew(true); + documentoHabilitanteDetalleController.getRecord().setCarma(armaSolicitud.getPk().getCarma()); + documentoHabilitanteDetalleController.getRecord().setCodigoarma(ArmasController.findPorCodigo(armaSolicitud.getPk().getCarma()).getCodigoarma()); + documentoHabilitanteDetalleController.update(); + } + + registrarGuardadoDocumentoHabilitante(msave); + } else { + throw new Exception("TIPO DOCUMENTO DE INVALIDO: " + tipoArchivo.getDescription()); + } + } + + /** + * Metodo para realizar el guardado del documento habilitante + * + * @param msave variable save + * @throws Throwable + */ + private void registrarGuardadoDocumentoHabilitante(HashMap msave) throws Throwable { + Request request = callerhelper.getRequest(); + + DtoSave dtosaveDocumento = this.documentoHabilitanteController.getDtoSave(true); + dtosaveDocumento.setReturnpk(true); + dtosaveDocumento.setPosition(1); + DtoSave dtosaveDocumentoDetalle = this.documentoHabilitanteDetalleController.getDtoSave(true); + dtosaveDocumentoDetalle.setReturnpk(true); + dtosaveDocumentoDetalle.setPosition(2); + DtoSave dtosaveColaImpresion = this.colaImpresionController.getDtoSave(true); + dtosaveColaImpresion.setReturnpk(true); + dtosaveColaImpresion.setPosition(3); + + msave.put(documentoHabilitanteController.getBeanalias(), dtosaveDocumento); + msave.put(documentoHabilitanteDetalleController.getBeanalias(), dtosaveDocumentoDetalle); + msave.put(colaImpresionController.getBeanalias(), dtosaveColaImpresion); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.documentoHabilitanteController.postCommit(resp); + this.documentoHabilitanteDetalleController.postCommit(resp); + this.colaImpresionController.postCommit(resp); + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + throw new Exception("" + resp); + } + } + + /** + * Metodo que valida cual es la pantalla que se encuentra activa este + * controlador + */ + private void validarpantallaActual() { + if (this.getLoginController() != null && 24 == this.getLoginController().getRequest().getTransactionCode() && "30".equals(getLoginController().getRequest().getTransactionModule())) { + controlPantallaEntregado = true; + } else { + controlPantallaEntregado = false; + } + + if (this.getLoginController() != null && 34 == this.getLoginController().getRequest().getTransactionCode() && "30".equals(getLoginController().getRequest().getTransactionModule())) { + controlPantallaVisualizarTramiteFirmar = true; + } else { + controlPantallaVisualizarTramiteFirmar = false; + } + + if (this.getLoginController() != null && 33 == this.getLoginController().getRequest().getTransactionCode() && "30".equals(getLoginController().getRequest().getTransactionModule())) { + controlPantallaVerificarInformacionDevolucion = true; + } else { + controlPantallaVerificarInformacionDevolucion = false; + } + } + + @Override + public void query() throws Exception { + MessageHelper.setMessageError("msg_notQuery"); + super.query(); + } + + @Override + public void next() throws Exception { + // TODO Auto-generated method stub + super.next(); + } + + /** + * Metodo para enviar el documento habilitante por el flujo + */ + public void enviarDocumentoHabilitante() { + + } + + @Override + public void save() { + try { + if (!validarSeleccion()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_validar_seleccion_armas")); + return; + } + + actualizarArmas(); + actualizarSolicitudArmas(); + + TarmSolicitud sol = this.solicitudController.findSolicitudxcodsolicitud(this.codigoSolicitud); + String ruta = this.getRutaDocumento() + "/cm:actaEntregaRecepcionArmas.pdf"; + System.out.println("ruta : " + ruta); + sol.setXpathacta(ruta); + this.solicitudController.updateSolicitud(sol); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + btnFlujo = Boolean.TRUE; + btnGrabar = Boolean.FALSE; + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que guarda el documento + */ + public void saveDocumentoHabilitante() { + + try { + // validamos si cargamos los datos cuando apruebe + Map datosmail = new HashMap(); + Request request = callerhelper.getRequest(); + + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail persona = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + if (codigoAceptado().equals(estado)) { + request.modifiedData().put("BPMStatus", + bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + } else { + request.modifiedData().put("BPMStatus", + bpmDataStatus == null ? "D" : bpmDataStatus); // A,D,R + datosmail.put("funcionario", persona == null ? "" : ((persona.getMilitarygrade() == null && persona.getMilitarygradecode() == null) ? "" : CatalogDetailController.findxCodigoCodcatalogo(persona.getMilitarygrade(), persona.getMilitarygradecode()).getDescription()) + " " + persona.getName()); + datosmail.put("razons", (solicitud == null || solicitud.getModifiedData().get("nombre") == null) ? "" : solicitud.getModifiedData().get("nombre")); + datosmail.put("sol", solicitud == null ? "" : solicitud.getPk()); + datosmail.put("centrocontrol", (centroControl == null || centroControl.getNombreinstitucion() == null || centroControl.getNombreinstitucioncodigo() == null) ? "" : CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + + } + + this.update(); + + HashMap msave = new HashMap(); + + request.modifiedData().put("datosmail", datosmail); + request.modifiedData().put("csolicitud", codigoSolicitud); + //request.modifiedData().put("numerotramite", "32"); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMObs", "Analizar documento habilitante"); + request.modifiedData().put("observacion", observacion); + + request.setSaveTables(msave); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + dtosave.setPosition(1); + msave.put(beanalias, dtosave); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute( + "Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + /** + * M\u00e9todo que valida si todas las armas se encuentran seleccionadas + * + * @return + */ + public boolean validarSeleccion() { + for (TarmSolicitudArmas armaSeleccionada : lrecord) { + if (!armaSeleccionada.modifiedData().containsValue(Boolean.TRUE)) { + return false; + } + } + return true; + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if (tcustPersonAddres == null) { + return null; + } + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl() { + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + /** + * Metodo para armar la ruta del documento + * + * @return + */ + public String getRutaDocumento() { + Calendar calendar = Calendar.getInstance(); + StringBuilder ruta = new StringBuilder("cm:Solicitudes"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append( + (calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + ruta = ruta.append("/cm:D-").append( + (calendar.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (calendar.get(Calendar.DAY_OF_MONTH)) : (calendar.get(Calendar.DAY_OF_MONTH))); + TarmSolicitud solicitud = SolicitudArmasController.find(codigoSolicitud); + ruta = ruta.append("/cm:").append(solicitud.getNumerosolicitud()); + ruta = ruta.append("/cm:").append("armas"); + return ruta.toString(); + } + + /** + * M\u00e9todo para imprimir + */ + public void imprimir() { + try { + if (!validarSeleccion()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_imprimir_recepcion_armas")); + return; + } + this.reporteActaEntregaRecepArmas(); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Obtiene el reporte de Acta de Entrega Recepción de Armas + */ + private void reporteActaEntregaRecepArmas() throws Exception { + try { + //this.querydatabase(); + //buttonAction(); + Calendar fechaActualCldr = Calendar.getInstance(); + Calendar fechaCorteCldr = Calendar.getInstance(); + String gradoUsuario = ""; + TarmSolicitud sol = this.solicitudController.findSolicitudxcodsolicitud(this.codigoSolicitud); + TarmSolicitudTramite soltra = SolicitudTramiteController.findByCSolicitud(this.codigoSolicitud); + + String path = "armas/reports/repo"; + String filename = "actaEntregaRecepcionArmas";//MsgControlArmas.getProperty("lbl_fichaTecnicaArmas"); + String nombreUsuario; + if (usuario.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(usuario.getPk().getPersoncode().toString()).getName(); + } else { + nombreUsuario = ""; + } + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("usuario", nombreUsuario); + //Centro de control + parameters.put("centroControl", this.obtenerCentroControl()); + + //Fecha actual + //Fecha de solicitud + if (sol != null && sol.getNumerosolicitud() != null) { + if (soltra != null && soltra.getNumerotramite() != null) { + parameters.put("numsolicitud", sol.getNumerosolicitud()); + parameters.put("numtramite", soltra.getNumerotramite()); + TcustPersonDetail persona = PersonDetailController.find(sol.getPersoncode().toString()); + parameters.put("cliente", persona.getName()); + } + } else { + parameters.put("numsolicitud", " "); + } + + //No tramite + if (sol != null && sol.getFregistro() != null) { + SimpleDateFormat sdf2 = new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fechaSolicitud", sdf2.format(sol.getFregistro())); + } else { + parameters.put("fechaSolicitud", " "); + } + + //codigo solicitud + parameters.put("csolicitud", this.codigoSolicitud); + parameters.put("personcode", usuario.getPk().getPersoncode()); + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH) + 1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("fecActual", fechaActualSB.toString()); + //Grado del funcionario + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if (grado != null) { + gradoUsuario = grado.getDescription() + " - " + this.responsableCentroControl.getName(); + } else { + gradoUsuario = "Sin Grado - " + this.responsableCentroControl.getName(); + } + parameters.put("gradoUsuario", gradoUsuario); + //parameters.put("usuario", this.tsafeUserDetailUsuario.getNickname()); + //parameters.put("codResponsable", this.responsableCentroControl.getPk().getPersoncode().toString()); + + String format = "pdf"; + + parameters.put("tipotram", this.tipoAutorizacion.getDescription() + " - " + this.categoria.getDescription() + " - " + this.usoActividad.getDescription()); + parameters.put("codResponsable", usuario.getPk().getPersoncode()); + + parameters.put("codigoQR", (sol != null ? sol.getNumerosolicitud() : "") + " " + fechaActualSB.toString() + " " + gradoUsuario); + + try { + System.err.println("==========> PARAMETROS " + parameters); + System.err.println("========>\t" + path); + System.err.println("========>\t" + format); + System.err.println("========>\t" + filename); + System.err.println("========>\t" + this.getLoginController()); + this.xpathflujo = this.getRutaDocumento(); + InputStream report = this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + this.alfrescoController.uploadFile(report, filename + ".pdf", this.xpathflujo); + //this.record.setXpathfichatecarmas(this.xpathflujo + "/cm:" + filename+".pdf"); + //this.record.getModifiedData().put("impresion",Boolean.TRUE); + //this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } + + /** + * @return @throws Exception + */ + public String codigoAceptado() throws Exception { + TgeneParameters f = ParametersController.find("ACEPTADO", "1"); + return f.getTextvalue(); + } + + /** + * M\u00e9todo para fimar documentos + */ + public void firmar() { + System.out.println("Firmar"); + } + + /** + * M\u00e9todo para actualizar las armas en la base de datos seg\u00fan la + * pantalla en que se encuentre + * + * @throws Exception + */ + private void actualizarSolicitudArmas() throws Exception { + for (TarmSolicitudArmas armaSeleccionada : lrecord) { + record = armaSeleccionada; + if (armaSeleccionada.modifiedData().get("seleccion").equals(Boolean.TRUE)) { + if (controlPantallaEntregado) { + record.setEntregada("Y"); + } else { + record.setAprobada("Y"); + } + } + if (!armaSeleccionada.modifiedData().get("seleccion").equals(Boolean.TRUE)) { + if (controlPantallaEntregado) { + record.setEntregada("N"); + } else { + record.setAprobada("N"); + } + } + update(); + } + + } + + /** + * M\u00e9todo para leer las selecciones guardadas en la base y setearlas + * seg\u00fan la pantalla en la que se encuentre + * + * @throws Exception + */ + private void actualizarArmas() throws Exception { + for (TarmSolicitudArmas solicitudArmas : lrecord) { + if ("Y".equals(solicitudArmas.getEntregada()) && controlPantallaEntregado) { + solicitudArmas.modifiedData().put("seleccion", Boolean.TRUE); + } + if ("Y".equals(solicitudArmas.getAprobada()) && !controlPantallaEntregado) { + solicitudArmas.modifiedData().put("seleccion", Boolean.TRUE); + } + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaseValidacionTransito() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para completar la tarea + */ + public void completarTareaAutorizarTramite() { + try { + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + super.cleanRequest(request); + request.modifiedData().put("csolicitud", codigoSolicitud); + request.modifiedData().put("numerotransaccion", numeroTransaccion); + request.modifiedData().put("TID", tid); + if (bpmDataStatus.equalsIgnoreCase("APR") || bpmDataStatus == null) { + bpmDataStatus = "A"; + if (this.getLoginController() != null && 30 == this.getLoginController().getRequest().getTransactionCode() + && "30".equals(getLoginController().getRequest().getTransactionModule())) { + guardarcolaImpresionController(msave); + } + } else { + bpmDataStatus = "D"; + } + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Map datosmail = new HashMap(); + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail persona = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + if (bpmDataStatus.equals("D")) { + datosmail.put("funcionario", persona == null ? "" : ((persona.getMilitarygrade() == null && persona.getMilitarygradecode() == null) ? "" : CatalogDetailController.findxCodigoCodcatalogo(persona.getMilitarygrade(), persona.getMilitarygradecode()).getDescription()) + " " + persona.getName()); + datosmail.put("razons", (solicitud == null || solicitud.getModifiedData().get("nombre") == null) ? "" : solicitud.getModifiedData().get("nombre")); + datosmail.put("sol", solicitud == null ? "" : solicitud.getPk()); + datosmail.put("observaciones", bpmDataComment); + datosmail.put("centrocontrol", (centroControl == null || centroControl.getNombreinstitucion() == null || centroControl.getNombreinstitucioncodigo() == null) ? "" : CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + request.modifiedData().put("datosmail", datosmail); + } else { + SimpleDateFormat sdf1 = new SimpleDateFormat(MsgGeneral.getProperty("dateformat")); + datosmail.put("funcionario", persona == null ? "" : ((persona.getMilitarygrade() == null) ? "" : CatalogDetailController.findxCodigoCodcatalogo(persona.getMilitarygrade(), "MILITARYGRADE").getDescription()) + " " + persona.getName()); + datosmail.put("razons", (solicitud == null || solicitud.getModifiedData().get("nombre") == null) ? "" : solicitud.getModifiedData().get("nombre")); + datosmail.put("tramite", solicitudTramite.getNumerotramite()); + datosmail.put("centrocontrol", (centroControl == null || centroControl.getNombreinstitucion() == null || centroControl.getNombreinstitucioncodigo() == null) ? "" : CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + datosmail.put("fechanotificacion", sdf1.format(new Date())); + + TarmTramite tramite = TarmTramiteController.find(String.valueOf(solicitud.getCtramite())); + datosmail.put("tipoTramite", (tramite == null || tramite.getModifiedData().get("tipotramite") == null) ? "" : tramite.getModifiedData().get("tipotramite")); + datosmail.put("tipoAutorizacion", (tramite == null || tramite.getModifiedData().get("tipoautorizacion") == null) ? "" : tramite.getModifiedData().get("tipoautorizacion")); + datosmail.put("usoactividad", (tramite == null || tramite.getModifiedData().get("usoactividad") == null) ? "" : tramite.getModifiedData().get("usoactividad")); + datosmail.put("categoria", (tramite == null || tramite.getModifiedData().get("categoria") == null) ? "" : tramite.getModifiedData().get("categoria")); + request.modifiedData().put("datosmail", datosmail); + } + + request.setSaveTables(msave); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + if (bpmDataStatus.equals("D")) { + saveAnularSolicitud(); + } + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void saveAnularSolicitud() { + try { + TarmTramite tarmTramite = null; + // CATEGORIA 14 PREVIA IMPORTACION + if (this.getLoginController().getRequest().getTransactionCode() == 33) { + tarmTramite = TarmTramiteController.find(this.solicitud.getCtramite().toString()); + } else if (this.getLoginController().getRequest().getTransactionCode() == 30) { + tarmTramite = TarmTramiteController.find(this.solicitudMP.getRecord().getCtramite().toString()); + } + if (tarmTramite != null && tarmTramite.getCategoria().equals("14")) { + desasociarCargaSolicitud(); + } + //Poner la solicitud en estado anulado + solicitud.setEstado("ANU"); + solicitud.setAucp(null); + solicitudMP.setRecord(solicitud); + solicitudMP.update(); + DtoSave dtoSolicitud = solicitudMP.getDtoSave(); + + TarmSolicitudTramite solicitudTramiteObj = SolicitudTramiteController.findByCSolicitud(solicitud.getPk()); + if (solicitudTramiteObj != null) { + solicitudTramiteObj.setIsnew(false); + solicitudTramiteObj.setEstadotramite("ANU"); + solicitudTramiteController.updateSolicitud(solicitudTramiteObj); + } + // DocumentoHabilitanteController documentoHabilitanteController + TarmDocumentoHabilitante documentoHabilitanteTmp = DocumentoHabilitanteController.findPorSolicitud(codigoSolicitud); + if (documentoHabilitanteTmp != null) { + documentoHabilitanteTmp.setFechaexpiracion(new java.sql.Date(new java.util.Date().getTime())); + this.documentoHabilitanteController.setRecord(documentoHabilitanteTmp); + this.documentoHabilitanteController.save(); + } +// if(documentoHabilitanteTmp!=null){ +// TarmDocumentoHabilitanteDetall documentoHabilitanteDetTmp = DocumentoHabilitanteDetalleController.findPorCDocumento(documentoHabilitanteTmp.getPk().toString()); +// if(documentoHabilitanteDetTmp!=null){ +// this.documentoHabilitanteDetalleController.setRecord(documentoHabilitanteDetTmp); +// this.documentoHabilitanteDetalleController.remove(); +// this.documentoHabilitanteDetalleController.save(); +// } +// +// this.documentoHabilitanteController.setRecord(documentoHabilitanteTmp); +// this.documentoHabilitanteController.remove(); +// this.documentoHabilitanteController.save(); +// } + + //Desasociar las armas en apertura de agencias y apertura de sucursales + if (solicitud.getCtramite() == 44 || solicitud.getCtramite() == 48) { + List armasSolicitudList = RecepcionArmasController.findPorSolicitud(solicitud.getPk()); + for (TarmSolicitudArmas armaObj : armasSolicitudList) { + + // Codigo agencia de la solicitud + List solicitudAgenciaLst = SolicitudAgenciaSucursalController.findPorSolicitud(solicitud.getPk()); + for (TarmSolicitudAgenciaSucursal solicitudAgenciaSucursalObj : solicitudAgenciaLst) { + String cAgencia = solicitudAgenciaSucursalObj.getPk().getCagencia().toString(); + TarmAgenciaArma agenciaArmaObj = AgenciaArmaController.findByCArma(armaObj.getPk().getCarma(), cAgencia); + agenciaArma.setRecord(agenciaArmaObj); + agenciaArma.remove(); + } + } + } + + DtoSave dtoSolicitudTramite = solicitudTramiteController.getDtoSave(); + DtoSave dtoAgenciaArma = agenciaArma.getDtoSave(); + + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + msave.put(solicitudMP.getBeanalias(), dtoSolicitud); // adicionar metadata de mantenimiento para cada tabla. + msave.put(solicitudTramiteController.getBeanalias(), dtoSolicitudTramite); + msave.put(agenciaArma.getBeanalias(), dtoAgenciaArma); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + solicitudMP.postCommit(resp); + solicitudTramiteController.postCommit(resp); + agenciaArma.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void desasociarCargaSolicitud() { + try { + TarmCarga carga = null; + if (this.getLoginController().getRequest().getTransactionCode() == 33) { + carga = CargaController.findByAUCP(this.solicitud.getAucp()); + } else if (this.getLoginController().getRequest().getTransactionCode() == 30) { + carga = CargaController.findByAUCP(solicitudMP.getRecord().getAucp()); + } + if (carga != null) { + carga.setCsolicitud(null); + cargaController.update(carga); + cargaController.save(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para completar la tarea + */ + public void completarTarea() { + + try { + + Map datosmail = new HashMap(); + Request request = callerhelper.getRequest(); + + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail persona = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + if (bpmDataStatus.equals("A")) { + guardarDocumentoHabilitante(); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + } else { + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "D" : bpmDataStatus); // A,D,R + + anularTramite(); + datosmail.put("funcionario", persona == null ? "" : ((persona.getMilitarygrade() == null && persona.getMilitarygradecode() == null) ? "" : CatalogDetailController.findxCodigoCodcatalogo(persona.getMilitarygrade(), persona.getMilitarygradecode()).getDescription()) + " " + persona.getName()); + datosmail.put("razons", (solicitud == null || solicitud.getModifiedData().get("nombre") == null) ? "" : solicitud.getModifiedData().get("nombre")); + datosmail.put("sol", solicitud == null ? "" : solicitud.getPk()); + datosmail.put("centrocontrol", (centroControl == null || centroControl.getNombreinstitucion() == null || centroControl.getNombreinstitucioncodigo() == null) ? "" : CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + + } + + this.update(); + + HashMap msave = new HashMap(); + + request.modifiedData().put("datosmail", datosmail); + request.modifiedData().put("csolicitud", codigoSolicitud); + request.modifiedData().put("numerotransaccion", numeroTransaccion); + //request.modifiedData().put("xpath", "c"); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMObs", "Analizar documento habilitante"); + request.modifiedData().put("observacion", observacion); + + request.setSaveTables(msave); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + dtosave.setPosition(1); + msave.put(beanalias, dtosave); + + request.setSaveTables(msave); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + if (bpmDataStatus.equals("D")) { + saveAnularSolicitud(); + } + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute( + "Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + /** + * Metodo para anular el tramite + * + * @throws Exception + */ + private void anularTramite() throws Exception { + solicitudTramite = solicitudTramiteController.findByCSolicitud(codigoSolicitud); + solicitudTramiteController.setRecord(solicitudTramite); + solicitudTramiteController.getRecord().setEstadotramite("ANU"); + solicitudTramiteController.getRecord().setEstadotramitecodigo("ESTADOSOLICITUD"); + solicitudTramiteController.update(); + solicitudTramiteController.save(); + } + + /** + * M\u00e9todo para encontrar por solicitud + * + * @param solicitudCode + * @return + */ + public static List findPorSolicitud(String solicitudCode) { + try { + RecepcionArmasController cc = new RecepcionArmasController(); + cc.init(); + cc.recperpage = 500; + cc.addFilter("pk.csolicitud", solicitudCode); + cc.querydatabaseValidacionTransito(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Método para encontrar un objeto de tipo TarmSolicitudArmas por + * código de solicitud + * + * @param solicitudCode + * @param cc + * @return lrecord de tipo TarmSolicitudArmas + */ + public static List findPorSolicitudTodas(String solicitudCode) { + try { +// this.codigoSolicitud = solicitudCode; + RecepcionArmasController cc = new RecepcionArmasController(); + cc.init(); + cc.recperpage = 10000; + cc.addFilter("pk.csolicitud", solicitudCode); + cc.querydatabaseSolicitudArmas(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + protected void querydatabaseSolicitudArmas() { + try { + this.lArmas.clear(); + this.lGuardias.clear(); + if (codigoSolicitud == null) { + return; + } + DtoQuery dto = this.getDtoQuery(); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.csolicitud"); + dto.setOrderby("t.pk.csolicitud"); + SubQuery subquerymodelo = new SubQuery("TarmArmas", "modelo", "modelo", "i.pk=t.pk.carma"); + dto.addSubQuery(subquerymodelo); + SubQuery subqueryacrma = new SubQuery("TarmArmas", "pk", "carma", "i.pk=t.pk.carma"); + dto.addSubQuery(subqueryacrma); + SubQuery subqueryserie = new SubQuery("TarmArmas", "lote", "lote", "i.pk=t.pk.carma"); + dto.addSubQuery(subqueryserie); + SubQuery subqueryCantidad = new SubQuery("TarmArmas", "cantidad", "cantidad", "i.pk=t.pk.carma"); + dto.addSubQuery(subqueryCantidad); + SubQuery subqueryPeso = new SubQuery("TarmArmas", "peso", "peso", "i.pk=t.pk.carma"); + dto.addSubQuery(subqueryPeso); + SubQuery subqueryUnidadMedida = new SubQuery("TgeneCatalogDetail", "description", "unidadmedida", "i.pk.catalog=(select p.unidadmedidacantidad from TarmArmas p where p.pk=t.pk.carma) and" + + " i.pk.catalogcode=(select p.unidadmedidacantidadcodigo from TarmArmas p where p.pk=t.pk.carma)"); + dto.addSubQuery(subqueryUnidadMedida); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "marca", "i.pk.catalog= (select o.marca from TarmArmas o where o.pk=t.pk.carma) " + + " and i.pk.catalogcode=(select o.marcacodigo from TarmArmas o where o.pk=t.pk.carma)"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog=(select o.color from TarmArmas o where o.pk=t.pk.carma)" + + " and i.pk.catalogcode=(select o.colorcodigo from TarmArmas o where o.pk=t.pk.carma)"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog=(select o.estado from TarmArmas o where o.pk=t.pk.carma)" + + " and i.pk.catalogcode=(select o.estadocodigo from TarmArmas o where o.pk=t.pk.carma)"); + dto.addSubQuery(subqueryEstado); + SubQuery subqueryClase = new SubQuery("TgeneCatalogDetail", "description", "clase", "i.pk.catalog=(select o.clase from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryLongitud = new SubQuery("TgeneCatalogDetail", "description", "longitud", "i.pk.catalog=(select o.longitud from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.longitudcodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + dto.addSubQuery(subqueryLongitud); + SubQuery subqueryCalibre = new SubQuery("TgeneCatalogDetail", "description", "calibre", "i.pk.catalog=(select o.calibre from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.calibrecodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryTipoArma = new SubQuery("TgeneCatalogDetail", "description", "tipo", "i.pk.catalog=(select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))" + + " and i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.pk.carma))"); + dto.addSubQuery(subqueryTipoArma); + return dto; + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTareaReceptaArma() { + + try { + if (!validarSeleccion()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_validar_seleccion_armas")); + return; + } + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("csolicitud", codigoSolicitud); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + btnFlujo = Boolean.FALSE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public TcustPersonDetail getPersonaDetalle() { + return personaDetalle; + } + + public void setPersonaDetalle(TcustPersonDetail personaDetalle) { + this.personaDetalle = personaDetalle; + } + + public PersonAddressController getPersonAddressController() { + return personAddressController; + } + + public void setPersonAddressController( + PersonAddressController personAddressController) { + this.personAddressController = personAddressController; + } + + public SolicitudTramiteController getSolicitudTramiteController() { + return solicitudTramiteController; + } + + public void setSolicitudTramiteController( + SolicitudTramiteController solicitudTramiteController) { + this.solicitudTramiteController = solicitudTramiteController; + } + + public String getProvincia() { + return provincia; + } + + public void setProvincia(String provincia) { + this.provincia = provincia; + } + + public String getCanton() { + return canton; + } + + public void setCanton(String canton) { + this.canton = canton; + } + + public String getCiudad() { + return ciudad; + } + + public void setCiudad(String ciudad) { + this.ciudad = ciudad; + } + + public List getlArmas() { + return lArmas; + } + + public void setlArmas(List lArmas) { + this.lArmas = lArmas; + } + + public TarmSolicitudTramite getSolicitudTramite() { + return solicitudTramite; + } + + public void setSolicitudTramite(TarmSolicitudTramite solicitudTramite) { + this.solicitudTramite = solicitudTramite; + } + + public TarmTramite getTramite() { + return tramite; + } + + public void setTramite(TarmTramite tramite) { + this.tramite = tramite; + } + + public TgeneCatalogDetail getEstadotramite() { + return estadotramite; + } + + public void setEstadotramite(TgeneCatalogDetail estadotramite) { + this.estadotramite = estadotramite; + } + + public TgeneCatalogDetail getDetallecatalogo() { + return detallecatalogo; + } + + public boolean isControlPantallaEntregado() { + return controlPantallaEntregado; + } + + public void setControlPantallaEntregado(boolean controlPantallaEntregado) { + this.controlPantallaEntregado = controlPantallaEntregado; + } + + public boolean isControlPantallaVisualizarTramiteFirmar() { + return controlPantallaVisualizarTramiteFirmar; + } + + public void setControlPantallaVisualizarTramiteFirmar( + boolean controlPantallaVisualizarTramiteFirmar) { + this.controlPantallaVisualizarTramiteFirmar = controlPantallaVisualizarTramiteFirmar; + } + + public boolean isControlPantallaVerificarInformacionDevolucion() { + return controlPantallaVerificarInformacionDevolucion; + } + + public void setControlPantallaVerificarInformacionDevolucion( + boolean controlPantallaVerificarInformacionDevolucion) { + this.controlPantallaVerificarInformacionDevolucion = controlPantallaVerificarInformacionDevolucion; + } + + public TgeneCatalogDetail getDetallecatalogoTipoTramite() { + return detallecatalogoTipoTramite; + } + + public void setDetallecatalogoTipoTramite( + TgeneCatalogDetail detallecatalogoTipoTramite) { + this.detallecatalogoTipoTramite = detallecatalogoTipoTramite; + } + + public void setDetallecatalogo(TgeneCatalogDetail detallecatalogo) { + this.detallecatalogo = detallecatalogo; + } + + public TgeneCatalogDetail getUsoActividad() { + return usoActividad; + } + + public void setUsoActividad(TgeneCatalogDetail usoActividad) { + this.usoActividad = usoActividad; + } + + public TgeneCatalogDetail getIdentificacion() { + return identificacion; + } + + public void setIdentificacion(TgeneCatalogDetail identificacion) { + this.identificacion = identificacion; + } + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + public TarmTipoArmaExplosivo getTipoArmaExplosivo() { + return tipoArmaExplosivo; + } + + public void setTipoArmaExplosivo(TarmTipoArmaExplosivo tipoArmaExplosivo) { + this.tipoArmaExplosivo = tipoArmaExplosivo; + } + + public String getCodigoSolicitud() { + return codigoSolicitud; + } + + public void setCodigoSolicitud(String codigoSolicitud) { + this.codigoSolicitud = codigoSolicitud; + } + + public SolicitudGuardiasController getSolicitudGuardiasController() { + return solicitudGuardiasController; + } + + public void setSolicitudGuardiasController( + SolicitudGuardiasController solicitudGuardiasController) { + this.solicitudGuardiasController = solicitudGuardiasController; + } + + public DocumentoHabilitanteController getDocumentoHabilitanteController() { + return documentoHabilitanteController; + } + + public void setDocumentoHabilitanteController( + DocumentoHabilitanteController documentoHabilitanteController) { + this.documentoHabilitanteController = documentoHabilitanteController; + } + + public ArmasController getArmasController() { + return armasController; + } + + public void setArmasController(ArmasController armasController) { + this.armasController = armasController; + } + + public List getlSolicitudGuardias() { + return lSolicitudGuardias; + } + + public List getLaccion() { + return laccion; + } + + public void setLaccion(List laccion) { + this.laccion = laccion; + } + + public void setlSolicitudGuardias(List lSolicitudGuardias) { + this.lSolicitudGuardias = lSolicitudGuardias; + } + + public List getlGuardias() { + return lGuardias; + } + + public void setlGuardias(List lGuardias) { + this.lGuardias = lGuardias; + } + + public String getObservacion() { + return observacion; + } + + public void setObservacion(String observacion) { + this.observacion = observacion; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public DocumentoHabilitanteDetalleController getDocumentoHabilitanteDetalleController() { + return documentoHabilitanteDetalleController; + } + + public void setDocumentoHabilitanteDetalleController( + DocumentoHabilitanteDetalleController documentoHabilitanteDetalleController) { + this.documentoHabilitanteDetalleController = documentoHabilitanteDetalleController; + } + + public Boolean getBtnFlujo() { + return btnFlujo; + } + + public void setBtnFlujo(Boolean btnFlujo) { + this.btnFlujo = btnFlujo; + } + + public String getDireccion() { + return direccion; + } + + public void setDireccion(String direccion) { + this.direccion = direccion; + } + + public SolicitudController getSolicitudController() { + return solicitudController; + } + + public void setSolicitudController(SolicitudController solicitudController) { + this.solicitudController = solicitudController; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public ColaImpresionController getColaImpresionController() { + return colaImpresionController; + } + + public void setColaImpresionController( + ColaImpresionController colaImpresionController) { + this.colaImpresionController = colaImpresionController; + } + + public Boolean getBtnGrabar() { + return btnGrabar; + } + + public void setBtnGrabar(Boolean btnGrabar) { + this.btnGrabar = btnGrabar; + } + + public List getSolAgenciaSucursals() { + return solAgenciaSucursals; + } + + public void setSolAgenciaSucursals( + List solAgenciaSucursals) { + this.solAgenciaSucursals = solAgenciaSucursals; + } + + public List getDocumentosList() { + return documentosList; + } + + public void setDocumentosList(List documentosList) { + this.documentosList = documentosList; + } + + public AgenciaArmaController getAgenciaArma() { + return agenciaArma; + } + + public void setAgenciaArma(AgenciaArmaController agenciaArma) { + this.agenciaArma = agenciaArma; + } + + public SolicitudArmasController getSolicitudMP() { + return solicitudMP; + } + + public void setSolicitudMP(SolicitudArmasController solicitudMP) { + this.solicitudMP = solicitudMP; + } + + public CargaController getCargaController() { + return cargaController; + } + + public void setCargaController(CargaController cargaController) { + this.cargaController = cargaController; + } + + public Boolean getRequiereNoSolAucpBln() { + return requiereNoSolAucpBln; + } + + public void setRequiereNoSolAucpBln(Boolean requiereNoSolAucpBln) { + this.requiereNoSolAucpBln = requiereNoSolAucpBln; + } + + public String getNombreInstitucion() { + return nombreInstitucion; + } + + public String setNombreInstitucion(String nombreInstitucion) { + if (nombreInstitucion != null && !nombreInstitucion.isEmpty()) { + this.nombreInstitucion = nombreInstitucion; + } else { + this.nombreInstitucion = ""; + } + + return nombreInstitucion; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RecepcionArmasNoEnviadasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RecepcionArmasNoEnviadasController.java new file mode 100644 index 0000000..e1af42c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RecepcionArmasNoEnviadasController.java @@ -0,0 +1,443 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.model.SelectItem; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.parmas.soli.TarmTransaccionArmaBodega; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TarmDecomisoArmaTransaccion. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RecepcionArmasNoEnviadasController extends AbstractController { + + public RecepcionArmasNoEnviadasController() throws Exception { + super(TarmDecomisoArmaTransaccion.class); + } + + /** + * Controlador para generar el reporte + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + /** + * Controlador para caragar el archivo al alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * atributo con los datos del usuario logeado + */ + private TsafeUserDetail userDetail; + + private String xpathflujo; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + this.querydatabase(); + } + + private List decomisoArmas; + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 300; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "RECEPCIONARMASNOENV"; + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + obtenerCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * nombre del centro de control + */ + private String institucionCentroControl; + private List itemUnidadDestino; + /** + * nombre del centro de control + */ + private String instiCentroControlCode; + + /** + * Método para obtener el centro de control + * + * @throws Exception + */ + private void obtenerCentroControl() throws Exception { + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(userDetail.getPk().getPersoncode().toString()); + if (tcustPersonAddres != null && tcustPersonAddres.getProvincecode() != null) { + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + if (centroControlJur != null && centroControlJur.getCcentrocontrol() != null) { + TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + itemUnidadDestino = new ArrayList(); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + //codigo del centro de control de pichincha + TgeneParameters paramCentroControlDestino = ParametersController.find("CODIGO.CENT.CONTROL.PICHINCHA", "1");//000030//CAPI + //validamos si la persona que ingreso pertenece al centro de control pichincha para darle al opcion de seleccionar el deparatmento de control para la recepcion + if (paramCentroControlDestino.getTextvalue().equals(centroControl.getNombreinstitucion())) { + itemUnidadDestino.add(new SelectItem(centroControl.getPk(), institucionCentroControl)); + //codigo del departamento de control + TgeneParameters paramDepartamentoControl = ParametersController.find("CODIGO.DEPT.CONTROL", "1");//DPCA + TarmCentroControl institCentroControlDestino = CentroControlArmasController.findPorCentroControl(paramDepartamentoControl.getTextvalue());//000077 + itemUnidadDestino.add(new SelectItem(institCentroControlDestino.getPk(), "" + institCentroControlDestino.getModifiedData().get("desnombreinstitucion"))); + } else { + instiCentroControlCode = centroControl.getPk(); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_laprovinciasinccontrol")); + return; + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_notienedireccionprincipal")); + return; + } + } + + public void executeUnidad() { + + for (SelectItem item : itemUnidadDestino) { + if (item.getValue().equals(instiCentroControlCode)) { + institucionCentroControl = item.getLabel(); + } + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + Filter filtro = new Filter(); + filtro.setSql("estadoflujo='NOENV' and numerotransaccion like '%REC-%' and ccentrocontrol='" + instiCentroControlCode + "'"); + dto.addFiltro(filtro); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * + * @param codigo + * @return + */ + public static TarmDecomisoArmaTransaccion find(String codigo) { + try { + RecepcionArmasNoEnviadasController cc = new RecepcionArmasNoEnviadasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", codigo); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * lista las armas decomisadas asociadas al numero de transaccion + * + * @param decomisoArmaTransaccion + */ + public void listarArmas(TarmDecomisoArmaTransaccion decomisoArmaTransaccion) { + record = decomisoArmaTransaccion; + decomisoArmas = DecomisoArmaController.find(decomisoArmaTransaccion.getPk()); + } + + /** + * Metodo para generar el acta de recepcion y cargar el archivo en el + * alfresco + */ + public void generarActa() { + Calendar fechaActualCldr = Calendar.getInstance(); + String path = "armas/reports/repo2"; + String filename = "actaRecepciondeArmas"; + String gradoUsuario = ""; + TcustPersonDetail usuario = PersonDetailController.find(this.userDetail.getPk().getPersoncode().toString()); + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(usuario.getMilitarygrade(), usuario.getMilitarygradecode()); + if (grado != null) { + gradoUsuario = grado.getDescription() + " - " + usuario.getName(); + } else { + gradoUsuario = "Sin Grado - " + usuario.getName(); + } + + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + try { + // Usuario logueado en la aplicacion + String nombreUsuario; + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } else { + nombreUsuario = ""; + } + TarmTransaccionArmaBodega armaBodegas = TransaccionArmaBodegaController.find(record.getPk().toString()); + parameters.put("user", nombreUsuario); + parameters.put("unidadmilitar", armaBodegas.getModifiedData().get("nombreinstituciondest")); + parameters.put("codigodec", record.getPk().toString());//este + parameters.put("fechaCorte", new SimpleDateFormat("dd-MM-yyyy").format(record.getFcorte()));//este + parameters.put("numtransaccion", record.getNumerotransaccion()); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + parameters.put("nombregrado", gradoUsuario);//este + // Fecha actual + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH) + 1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarFecha", fechaActualSB.toString()); + + parameters.put("orgControl", armaBodegas.getModifiedData().get("nombreinstitucionorig")); + + InputStream file = this.reportController.jaspertoInputstream(path, parameters, "pdf", filename, this.getLoginController()); + xpathflujo = generarXpath(record.getNumerotransaccion()); + if (!alfrescoController.uploadFile(file, record.getNumerotransaccion() + ".pdf", xpathflujo)) { + xpathflujo = null; + } + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Metodo para generar la ruta donde se carga el archivo + * + * @param numeroTransaccionRecepcion + * @return + */ + public String generarXpath(String numeroTransaccionRecepcion) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta = new StringBuilder("cm:Decomiso"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + ruta = ruta.append("/cm:" + numeroTransaccionRecepcion); + return ruta.toString(); + } + + public List getDecomisoArmas() { + return decomisoArmas; + } + + public void setDecomisoArmas(List decomisoArmas) { + this.decomisoArmas = decomisoArmas; + } + + public void iniciarFlujo() { + try { + + if (xpathflujo == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generereporte")); + return; + } + TarmTransaccionArmaBodega armaBodegas = TransaccionArmaBodegaController.find(record.getPk().toString()); + + if (armaBodegas.getModifiedData().get("provincecodeorig") == null || armaBodegas.getModifiedData().get("provincecodeorig").toString().length() == 0) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinprovincia")); + return; + } + + //instiCentroControlCode + TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(instiCentroControlCode); + String cprovincia = centroControl.getProvincecode();//armaBodegas.getModifiedData().get("provincecodeorig").toString(); + TgeneParameters paramDepartamentoControl = ParametersController.find("CODIGO.DEPT.CONTROL", "1");//DPCA + if (armaBodegas.getModifiedData().get("nombreinstitucion").equals(paramDepartamentoControl.getTextvalue())) { + cprovincia = paramDepartamentoControl.getTextvalue(); + } + //itemUnidadDestino + + String xpath = xpathflujo + "/cm:" + record.getNumerotransaccion() + ".pdf"; + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + //codigo de la tabla TarmDecomisoArmaTransaccion + request.modifiedData().put("numerotransaccion", record.getPk()); + request.modifiedData().put("cprovincia", cprovincia); + request.modifiedData().put("numerosolicitud", record.getNumerotransaccion()); + //ruta del archivo para la firma + //TODO Falta crear la variable en maia 2-8 + request.modifiedData().put("xpath", xpath); + request.modifiedData().put("isnew", "Y"); + request.setLogsolicitude(record.getNumerotransaccion()); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.setShowRow(true); + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + " TRANSACCION: " + record.getNumerotransaccion()); + xpathflujo = null; + //quita de la lista + lrecord.remove(record); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public List getItemUnidadDestino() { + return itemUnidadDestino; + } + + public void setItemUnidadDestino(List itemUnidadDestino) { + this.itemUnidadDestino = itemUnidadDestino; + } + + public String getInstiCentroControlCode() { + return instiCentroControlCode; + } + + public void setInstiCentroControlCode(String instiCentroControlCode) { + this.instiCentroControlCode = instiCentroControlCode; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReclamoDecomisoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReclamoDecomisoController.java new file mode 100644 index 0000000..fccbbf5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReclamoDecomisoController.java @@ -0,0 +1,418 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Controlar que permite el cambio de estado de los decomisosArma y tarmArma a + * RECL + * + * @author Manuel Cepeda + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReclamoDecomisoController extends AbstractController { + + private String personCode; + + @ManagedProperty(value = "#{armasController}") + private ArmasController armasController; + + public ReclamoDecomisoController() throws Exception { + super(TarmDecomisoArma.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + personCode = tsafeUserDetail.getPk().getPersoncode().toString(); + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 10000; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "TARMDECOMISOARMA"; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + //Cambio de funcionalidad a las armas decomisadas DEC por las incautadas INC + Filter decomisoFiltro = new Filter(); + decomisoFiltro.setSql( + "t.estado = 'INC' " + + " and t.carma in (select arm.pk " + + " from TarmArmas arm, TarmRegistroArmas regarm " + + " where arm.cregistro = regarm.pk and arm.estado = 'INC' " + + " and regarm.personcode = " + personCode + ")"); + dto.addFiltro(decomisoFiltro); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + for (TarmDecomisoArma decomisoArma : lrecord) { + TarmArmas arma = ArmasController.findPorCodigo(decomisoArma.getCarma()); + if (arma != null) { + TarmTipoArmaExplosivo tipoArmaExplosivo = TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo()); + decomisoArma.getModifiedData().put("ntipo", arma.getModifiedData().get("tipo")); + decomisoArma.getModifiedData().put("ncalibre", arma.getModifiedData().get("calibre")); + decomisoArma.getModifiedData().put("nclase", arma.getModifiedData().get("clase")); + decomisoArma.getModifiedData().put("ncantidad", arma.getCantidad()); + decomisoArma.getModifiedData().put("nestado", CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getEstado(), decomisoArma.getEstadocode()) != null ? CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getEstado(), decomisoArma.getEstadocode()).getDescription() : ""); + + if (tipoArmaExplosivo.getLongitud() != null) { + decomisoArma.getModifiedData().put("nlongitud", CatalogDetailController.findxCodigoCodcatalogo(tipoArmaExplosivo.getLongitud(), tipoArmaExplosivo.getLongitudcodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tipoArmaExplosivo.getLongitud(), tipoArmaExplosivo.getLongitudcodigo()).getDescription() : ""); + } else { + decomisoArma.getModifiedData().put("nlongitud", ""); + } + decomisoArma.getModifiedData().put("nmarca", CatalogDetailController.findxCodigoCodcatalogo(arma.getMarca(), arma.getMarcacodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(arma.getMarca(), arma.getMarcacodigo()).getDescription() : ""); + decomisoArma.getModifiedData().put("nserie", arma.getSeriecanon()); + decomisoArma.getModifiedData().put("nlote", arma.getLote()); + decomisoArma.getModifiedData().put("nunidad", CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getUnidadmedida(), decomisoArma.getUnidadmedidacode()) != null ? CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getUnidadmedida(), decomisoArma.getUnidadmedidacode()).getDescription() : ""); + + decomisoArma.getModifiedData().put("nmotivodecomiso", CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getMotivodecomiso(), decomisoArma.getMotivodecomisocodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getMotivodecomiso(), decomisoArma.getMotivodecomisocodigo()).getDescription() : ""); + + TarmDecomiso decomiso = DecomisoController.findByCodigo(decomisoArma.getCdecomiso().toString()); + if (decomiso != null && decomiso.getPersoncode() != null) { + decomisoArma.getModifiedData().put("nrodecomiso", decomiso.getNumerotransaccion()); + } else { + decomisoArma.getModifiedData().put("nrodecomiso", ""); + } + decomisoArma.getModifiedData().put("seleccionado", false); + } + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + +// @SuppressWarnings("unchecked") +// protected void consulta() { +// try { +// DtoQuery dto = super.getDtoQuery(true); +// dto.setOrderby("t.pk"); +// Filter filtro=new Filter(); +// filtro.setSql("t.fdecomiso=(select max(te.fdecomiso) from TarmDecomisoArma te where te.ccustemp=t.ccustemp)"); +// dto.addFiltro(filtro); +// HashMap mtables = new HashMap(); +// mtables.put(beanalias, dto); // permite adicionar mas de una tabla. +// +// Request request = callerhelper.getRequest(); +// request.setQueryTables(mtables); +// Response resp = callerhelper.executeQuery(request); +// if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { +// lrecord = new ArrayList(); +// MessageHelper.setMessageError(resp); +// } else { +// lrecord = (List) resp.get(beanalias); +// super.postQuery(lrecord); +// querydatabase(); +// } +// +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// } +// } +// + @Override + public void save() { + try { + + for (TarmDecomisoArma tarmDecomisoArma : lrecord) { + if (tarmDecomisoArma.getModifiedData().get("seleccionado") != null && tarmDecomisoArma.getModifiedData().get("seleccionado").equals(Boolean.TRUE)) { + TarmArmas arma = ArmasController.findPorCodigo(tarmDecomisoArma.getCarma()); + arma.setEstado("RECL"); + armasController.update(arma); + + tarmDecomisoArma.setEstado("RECL"); + update(tarmDecomisoArma); + } + } + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + DtoSave dtosaveArma = this.armasController.getDtoSave(); + dtosaveArma.setReturnpk(true); + dtosaveArma.setPosition(1); + msave.put(this.armasController.getBeanalias(), dtosaveArma); + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + querydatabase(); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if (Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")) { + valorColocar = Boolean.TRUE; + } + for (TarmDecomisoArma tarmDecomisoArma : this.lrecord) { + tarmDecomisoArma.getModifiedData().put("seleccionado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + +// public static TarmDecomisoArma findByCodigo(String cDecomisoArma) { +// try { +// ReclamoDecomisoController cc = new ReclamoDecomisoController(); +// cc. init(); +// cc.recperpage = 300; +// cc.addFilter("pk", cDecomisoArma); +// cc.querydatabase(); +// if (cc.lrecord != null) { +// return cc.lrecord.get(0); +// } +// return null; +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// return null; +// } +// } +// +// public static List findByCodigoDecomiso(String cDecomiso) { +// try { +// ReclamoDecomisoController cc = new ReclamoDecomisoController(); +// cc. init(); +// cc.recperpage = 300; +// cc.addFilter("cdecomiso", cDecomiso); +// cc.querydatabase(); +// if (cc.lrecord != null) { +// return cc.lrecord; +// } +// return null; +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// return null; +// } +// } +// +// public static TarmDecomisoArma findxCodigoCustTemporal(String ccustemp,String estado) { +// try { +// ReclamoDecomisoController cc = new ReclamoDecomisoController(); +// cc. init(); +// cc.recperpage = 300; +// cc.addFilter("ccustemp", ccustemp); +// cc.addFilter("estado", estado); +// cc.consulta(); +// if (cc.lrecord != null && cc.lrecord.size()>0) { +// return cc.lrecord.get(0); +// } +// return null; +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// return null; +// } +// } + public void update(TarmDecomisoArma bean) throws Exception { + record = bean; + super.update(); + } + +// +// public static List find(Long codigoenvio) { +// try { +// ReclamoDecomisoController cc = new ReclamoDecomisoController(); +// cc. init(); +// cc.recperpage = 300; +// cc.addFilter("cdecarmtranrecepcion", codigoenvio.toString()); +// cc.querydatabaseSimple(); +// if (cc.lrecord != null) { +// return cc.lrecord; +// } +// return null; +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// return null; +// } +// } +// +// public static List findEnvio(Long codigoenvio) { +// try { +// ReclamoDecomisoController cc = new ReclamoDecomisoController(); +// cc. init(); +// cc.recperpage = 300; +// cc.addFilter("cdecomisoarmatransaccion", codigoenvio.toString()); +// cc.querydatabaseSimple(); +// if (cc.lrecord != null) { +// return cc.lrecord; +// } +// return null; +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// return null; +// } +// } +// @SuppressWarnings("unchecked") +// protected void querydatabaseSimple() { +// try { +// DtoQuery dto = this.getDtoQuery(); +// dto.setOrderby("t.pk"); +// +// HashMap mtables = new HashMap(); +// mtables.put(beanalias, dto); // permite adicionar mas de una tabla. +// +// Request request = callerhelper.getRequest(); +// request.setQueryTables(mtables); +// +// Response resp = callerhelper.executeQuery(request); +// +// if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { +// lrecord = new ArrayList(); +// MessageHelper.setMessageError(resp); +// } else { +// lrecord = (List) resp.get(beanalias); +// super.postQuery(lrecord); +// } +// +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// } +// } + private DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryClasecatalogo = new SubQuery("TgeneCatalogDetail", "description", "nclase", "i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma)) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o " + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))"); + dto.addSubQuery(subqueryClasecatalogo); + SubQuery subqueryTipoArmaExplosivo = new SubQuery("TgeneCatalogDetail", "description", "ntipo", "i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o " + + " where o.pk= (select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))" + + " and i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "nmarca", "i.pk.catalog= (select o.marca from TarmArmas o where o.pk=t.carma)" + + " and i.pk.catalogcode=(select o.marcacodigo from TarmArmas o where o.pk=t.carma)"); + dto.addSubQuery(subqueryMarca); + SubQuery subqueryCalibre = new SubQuery("TarmTipoArmaExplosivo", "calibre", "ncalibre", "i.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma)"); + dto.addSubQuery(subqueryCalibre); + SubQuery subqueryLote = new SubQuery("TarmArmas", "lote", "nserie", "i.pk=t.carma"); + dto.addSubQuery(subqueryLote); + + SubQuery subqueryNRecivo = new SubQuery("TarmDecomiso", "numerorecibo", "nrecibo", "i.pk=t.cdecomiso"); + dto.addSubQuery(subqueryNRecivo); + SubQuery subqueryNTransaccion = new SubQuery("TarmDecomiso", "numerotransaccion", "numerotransaccion", "i.pk=t.cdecomiso"); + dto.addSubQuery(subqueryNTransaccion); + SubQuery subqueryUnidadTipo = new SubQuery("TgeneCatalogDetail", "description", "nunidad", "i.pk.catalog= (select o.unidadmedidapeso from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma)) and " + + " i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))"); + dto.addSubQuery(subqueryUnidadTipo); + + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog= (select o.color from TarmArmas o where o.pk=t.carma)" + + " and i.pk.catalogcode=(select o.colorcodigo from TarmArmas o where o.pk=t.carma)"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog= (select o.estado from TarmArmas o where o.pk=t.carma) " + + " and i.pk.catalogcode=(select o.estadocodigo from TarmArmas o where o.pk=t.carma)"); + dto.addSubQuery(subqueryEstado); + + SubQuery subqueryIndentificacion = new SubQuery("TcustPersonDetail", "identification", "identification", "i.pk.personcode=(select p from TarmRegistroArmas p where p.pk=(select o.cregistro from TarmArmas o where o.pk=t.carma)) " + + " and i.pk.dateto=to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryIndentificacion); + SubQuery subqueryRazonSocial = new SubQuery("TcustPersonDetail", "name", "nrazons", "i.pk.personcode=(select p.personcode from TarmRegistroArmas p where p.pk=(select o.cregistro from TarmArmas o where o.pk=t.carma)) " + + " and i.pk.dateto=to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryRazonSocial); + return dto; + } + + /** + * @return the armasController + */ + public ArmasController getArmasController() { + return armasController; + } + + /** + * @param armasController the armasController to set + */ + public void setArmasController(ArmasController armasController) { + this.armasController = armasController; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReclamoDecomisoCoordinadorMilitarController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReclamoDecomisoCoordinadorMilitarController.java new file mode 100644 index 0000000..772ca4a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReclamoDecomisoCoordinadorMilitarController.java @@ -0,0 +1,236 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.event.AjaxBehaviorEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +/** + * Controlar que permite el cambio de estado de los decomisosArma y tarmArma a + * RECL + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReclamoDecomisoCoordinadorMilitarController extends AbstractController { + + @ManagedProperty(value = "#{armasController}") + private ArmasController armasController; + + private Integer numeroDias; + + public ReclamoDecomisoCoordinadorMilitarController() throws Exception { + super(TarmDecomisoArma.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 10000; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "TARMDECOMISOARMA"; + numeroDias = codigos("NUMERO.DIAS.DECOMISO"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para obtener los codigos + */ + private Integer codigos(String parametro) { + TgeneParameters tgeneParameters = ParametersController.find(parametro, "1"); + return tgeneParameters.getNumbervalue().intValue(); + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + //Cambio de funcionalidad a las armas decomisadas DEC por las incautadas INC-INCA + Filter decomisoFiltro = new Filter(); + decomisoFiltro.setSql("t.estado = 'RECL' and" + + " t.carma in (select arm.pk from TarmArmas arm, TarmRegistroArmas regarm" + + " where arm.cregistro = regarm.pk " + + " and arm.estado = 'RECL' )");//and regarm.personcode = " + personCode + " + dto.addFiltro(decomisoFiltro); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + List listaRemover = new ArrayList(); + for (TarmDecomisoArma decomisoArma : lrecord) { + TarmArmas arma = ArmasController.findPorCodigo(decomisoArma.getCarma()); + if (arma != null) { + TarmTipoArmaExplosivo tipoArmaExplosivo = TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo()); + decomisoArma.getModifiedData().put("ntipo", arma.getModifiedData().get("tipo")); + decomisoArma.getModifiedData().put("ncalibre", arma.getModifiedData().get("calibre")); + decomisoArma.getModifiedData().put("nclase", arma.getModifiedData().get("clase")); + decomisoArma.getModifiedData().put("ncantidad", arma.getCantidad()); + decomisoArma.getModifiedData().put("nestado", CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getEstado(), decomisoArma.getEstadocode()) != null ? CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getEstado(), decomisoArma.getEstadocode()).getDescription() : ""); + + if (tipoArmaExplosivo.getLongitud() != null) { + decomisoArma.getModifiedData().put("nlongitud", CatalogDetailController.findxCodigoCodcatalogo(tipoArmaExplosivo.getLongitud(), tipoArmaExplosivo.getLongitudcodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tipoArmaExplosivo.getLongitud(), tipoArmaExplosivo.getLongitudcodigo()).getDescription() : ""); + } else { + decomisoArma.getModifiedData().put("nlongitud", ""); + } + decomisoArma.getModifiedData().put("nmarca", CatalogDetailController.findxCodigoCodcatalogo(arma.getMarca(), arma.getMarcacodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(arma.getMarca(), arma.getMarcacodigo()).getDescription() : ""); + decomisoArma.getModifiedData().put("nserie", arma.getSeriecanon()); + decomisoArma.getModifiedData().put("nlote", arma.getLote()); + decomisoArma.getModifiedData().put("nunidad", CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getUnidadmedida(), decomisoArma.getUnidadmedidacode()) != null ? CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getUnidadmedida(), decomisoArma.getUnidadmedidacode()).getDescription() : ""); + + decomisoArma.getModifiedData().put("nmotivodecomiso", CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getMotivodecomiso(), decomisoArma.getMotivodecomisocodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getMotivodecomiso(), decomisoArma.getMotivodecomisocodigo()).getDescription() : ""); + + TarmDecomiso decomiso = DecomisoController.findByCodigo(decomisoArma.getCdecomiso().toString()); + if (decomiso != null && decomiso.getPersoncode() != null) { + decomisoArma.getModifiedData().put("nrodecomiso", decomiso.getNumerotransaccion()); + } else { + decomisoArma.getModifiedData().put("nrodecomiso", ""); + } + decomisoArma.getModifiedData().put("seleccionado", false); + } + } + lrecord.removeAll(listaRemover); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + for (TarmDecomisoArma tarmDecomisoArma : lrecord) { + if (tarmDecomisoArma.getModifiedData().get("seleccionado") != null && tarmDecomisoArma.getModifiedData().get("seleccionado").equals(Boolean.TRUE)) { + TarmArmas arma = ArmasController.findPorCodigo(tarmDecomisoArma.getCarma()); + arma.setEstado("RECL"); + armasController.update(arma); + tarmDecomisoArma.setEstado("RECL"); + update(tarmDecomisoArma); + } + } + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + DtoSave dtosaveArma = this.armasController.getDtoSave(); + dtosaveArma.setReturnpk(true); + dtosaveArma.setPosition(1); + msave.put(this.armasController.getBeanalias(), dtosaveArma); + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + querydatabase(); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if (Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")) { + valorColocar = Boolean.TRUE; + } + for (TarmDecomisoArma tarmDecomisoArma : this.lrecord) { + tarmDecomisoArma.getModifiedData().put("seleccionado", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void update(TarmDecomisoArma bean) throws Exception { + record = bean; + super.update(); + } + + /** + * @return the armasController + */ + public ArmasController getArmasController() { + return armasController; + } + + /** + * @param armasController the armasController to set + */ + public void setArmasController(ArmasController armasController) { + this.armasController = armasController; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RegistrarNovedadController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RegistrarNovedadController.java new file mode 100644 index 0000000..4493ce1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RegistrarNovedadController.java @@ -0,0 +1,517 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.general.mail.EnvioMail; +import com.fp.general.mail.dto.EnvioCorreoDTO; +import com.fp.general.mail.exception.EnvioMailException; +import com.fp.general.mail.factory.EnvioMailFactory; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RegistrarNovedadController extends AbstractController { + + TarmSolicitudTramite solicitudTramite; + + @ManagedProperty(value = "#{tarmSolicitudArmasController}") + private TarmSolicitudArmasController tarmSolicitudArmasController; + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddressController; + + TcustPersonDetail detallesPersona; + TcustPersonAddress direccionPersona; + TcustPersonDetail usuario; + TarmCentroControl centroControl; + String nombreInstitucion; + String gradoFuncionario = ""; + private Boolean btnEnviar; + private String csolicitud; + + public RegistrarNovedadController() throws Exception { + super(TarmSolicitudTramite.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + csolicitud = FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("CSOLICITUD").toString();//"175"; + // Inicializa autoconsulta + super.startQuery(); + this.init(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "REGISTRARNOVEDADCONTROLLER"; + solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(csolicitud); + btnEnviar = Boolean.FALSE; + querydatabase(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @Override + public void query() throws Exception { + // TODO Auto-generated method stub + MessageHelper.setMessageError("msg_notQuery"); + super.query(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + + //Quemando el personcode de la persona + Filter filtro = new Filter("pk.csolicitud", csolicitud); + dto.addFiltro(filtro); + + //Obteniendo el tramite + TarmSolicitudTramite solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(csolicitud); + + tarmSolicitudArmasController.setCsolicitud(csolicitud); + tarmSolicitudArmasController.setPorDevolucion("N"); + tarmSolicitudArmasController.query(); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (lrecord != null && !lrecord.isEmpty()) { + + record = lrecord.get(0); + + //Numero de tramite + if (solicitudTramite != null) { + this.record.put("ntramite", solicitudTramite.getNumerotramite()); + } + + //Obteniendo la solicitud + TarmSolicitud solicitud = ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(this.record.getPk().getCsolicitud()); + + //Obteniendo los datos y la direccion de la persona + if (solicitud != null) { + detallesPersona = PersonDetailController.find(String.valueOf(solicitud.getPersoncode().toString())); + + String tipoDireccion = ""; + + switch (detallesPersona.getIdentificationcatalog()) { + case "CED": + tipoDireccion = "1"; + break; + case "RUC": + tipoDireccion = "2"; + break; + default: + tipoDireccion = ""; + break; + } + + personAddressController.findPersonaPorDireccionTipoCatalogo(String.valueOf(detallesPersona.getPk().getPersoncode()), tipoDireccion); + direccionPersona = personAddressController.getRecord(); + + } + + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + //Obteniendo el grado + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(usuario.getMilitarygrade(), usuario.getMilitarygradecode()); + if (grado != null) { + gradoFuncionario = grado.getDescription() + " - "; + } + + //Obteniendo el centro de control + centroControl = CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + if (centroControl != null && centroControl.getNombreinstitucion() != null && !centroControl.getNombreinstitucion().isEmpty() + && centroControl.getNombreinstitucioncodigo() != null && !centroControl.getNombreinstitucioncodigo().isEmpty()) { + + TgeneCatalogDetail catalogoInstitucion = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()); + this.nombreInstitucion = catalogoInstitucion.getDescription(); + } + + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + update(); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + btnEnviar = true; + TgeneCatalogDetail tipoDireccion = null; + if (direccionPersona.getAddresstypecatalog() != null && !direccionPersona.getAddresstypecatalog().isEmpty() + && direccionPersona.getAddresstypecatalogcode() != null && !direccionPersona.getAddresstypecatalogcode().isEmpty()) { + tipoDireccion = CatalogDetailController.findxCodigoCodcatalogo(direccionPersona.getAddresstypecatalog(), direccionPersona.getAddresstypecatalogcode()); + } + + if (tipoDireccion != null && tipoDireccion.getDescription().equalsIgnoreCase("Mail")) { + enviarNotificacion(); + } + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + //completa la tarea del flujo + //complete la tarea del flujo pasa a Autorizar la devolucion + request.modifiedData().put("csolicitud", csolicitud); + request.modifiedData().put("TID", FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TID")); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "D" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", record.getObservacionnovedad() == null ? "OK" : record.getObservacionnovedad()); + + Map datosmail = new HashMap(); + datosmail.put("razons", detallesPersona.getName()); + datosmail.put("sol", solicitudTramite.getNumerotramite()); + if (record.getObservacionnovedad() != null) { + datosmail.put("observaciones", record.getObservacionnovedad()); + } else { + datosmail.put("observaciones", "ok"); + } + + //grado funcionario de la persona logeada + TsafeUserDetail userDetailObj = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personDetailObj = PersonDetailController.find(userDetailObj.getPk().getPersoncode().toString()); + datosmail.put("grado", personDetailObj.getMilitarygrade()); + datosmail.put("funcionario", personDetailObj.getName()); + // Centro de control de armas + datosmail.put("centrocontrol", centroControl.getModifiedData().get("desinstitucion")); + request.modifiedData().put("datosmail", datosmail); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + btnEnviar = Boolean.FALSE; + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().remove("TID"); + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().remove("CSOLICITUD"); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que envia un mail de notificación + */ + public void enviarNotificacion() { + try { + String asunto = MsgControlArmas.getProperty("lbl_asuntoNotificarNovedad"); + String cuerpo = ""; + String cuerpo1 = MessageFormat.format(MsgControlArmas.getProperty("cuerpo.mensaje.envio.correo.novedad1"), detallesPersona.getName(), + solicitudTramite.getPk().getCtramite().toString()); + + String cuerpo2 = "

"; + cuerpo2 = cuerpo2.concat(""); + + cuerpo2 = cuerpo2.concat(""); + + cuerpo2 = cuerpo2.concat(""); + + cuerpo2 = cuerpo2.concat(""); + + cuerpo2 = cuerpo2.concat(""); + + cuerpo2 = cuerpo2.concat(""); + + cuerpo2 = cuerpo2.concat(""); + + cuerpo2 = cuerpo2.concat(""); + + cuerpo2 = cuerpo2.concat(""); + + cuerpo2 = cuerpo2.concat(""); + + cuerpo2 = cuerpo2.concat(""); + + for (int i = 0; i < tarmSolicitudArmasController.getLrecord().size(); i++) { + cuerpo2 = cuerpo2.concat(""); + + //No + cuerpo2 = cuerpo2.concat(""); + + //Clase + cuerpo2 = cuerpo2.concat(""); + + //Tipo + cuerpo2 = cuerpo2.concat(""); + + //Marca + cuerpo2 = cuerpo2.concat(""); + + //Modelo + cuerpo2 = cuerpo2.concat(""); + + //Calibre + cuerpo2 = cuerpo2.concat(""); + + //Serie + cuerpo2 = cuerpo2.concat(""); + + //Estado + cuerpo2 = cuerpo2.concat(""); + + cuerpo2 = cuerpo2.concat(""); + + } + + cuerpo2 = cuerpo2.concat("
"); + cuerpo2 = cuerpo2.concat("No."); + cuerpo2 = cuerpo2.concat(""); + cuerpo2 = cuerpo2.concat("Clase"); + cuerpo2 = cuerpo2.concat(""); + cuerpo2 = cuerpo2.concat("Tipo"); + cuerpo2 = cuerpo2.concat(""); + cuerpo2 = cuerpo2.concat("Marca"); + cuerpo2 = cuerpo2.concat(""); + cuerpo2 = cuerpo2.concat("Modelo"); + cuerpo2 = cuerpo2.concat(""); + cuerpo2 = cuerpo2.concat("Calibre"); + cuerpo2 = cuerpo2.concat(""); + cuerpo2 = cuerpo2.concat("Serie"); + cuerpo2 = cuerpo2.concat(""); + cuerpo2 = cuerpo2.concat("Estado"); + cuerpo2 = cuerpo2.concat("
"); + Integer no = i + 1; + cuerpo2 = cuerpo2.concat(no.toString()); + cuerpo2 = cuerpo2.concat(""); + if (tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("clase") != null) { + cuerpo2 = cuerpo2.concat(tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("clase").toString()); + } else { + cuerpo2 = cuerpo2.concat(""); + } + cuerpo2 = cuerpo2.concat(""); + if (tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("tipo") != null) { + cuerpo2 = cuerpo2.concat(tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("tipo").toString()); + } else { + cuerpo2 = cuerpo2.concat(""); + } + cuerpo2 = cuerpo2.concat(""); + if (tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("marca") != null) { + cuerpo2 = cuerpo2.concat(tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("marca").toString()); + } else { + cuerpo2 = cuerpo2.concat(""); + } + cuerpo2 = cuerpo2.concat(""); + if (tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("modelo") != null) { + cuerpo2 = cuerpo2.concat(tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("modelo").toString()); + } else { + cuerpo2 = cuerpo2.concat(""); + } + cuerpo2 = cuerpo2.concat(""); + if (tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("calibre") != null) { + cuerpo2 = cuerpo2.concat(tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("calibre").toString()); + } else { + cuerpo2 = cuerpo2.concat(""); + } + cuerpo2 = cuerpo2.concat(""); + if (tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("seriecanon") != null) { + cuerpo2 = cuerpo2.concat(tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("seriecanon").toString()); + } else { + cuerpo2 = cuerpo2.concat(" "); + } + cuerpo2 = cuerpo2.concat(""); + if (tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("estado") != null) { + cuerpo2 = cuerpo2.concat(tarmSolicitudArmasController.getLrecord().get(i).getModifiedData().get("estado").toString()); + } else { + cuerpo2 = cuerpo2.concat(" "); + } + cuerpo2 = cuerpo2.concat("

"); + cuerpo2 = cuerpo2.concat("Observaciones:
"); + + String cuerpo3 = MessageFormat.format(MsgControlArmas.getProperty("cuerpo.mensaje.envio.correo.novedad2"), this.record.getObservacionnovedad(), + gradoFuncionario + usuario.getName(), this.nombreInstitucion); + + cuerpo = cuerpo1 + cuerpo2 + cuerpo3; + + EnvioCorreoDTO envioCorreo = new EnvioCorreoDTO(); + envioCorreo.setCorreoDesde(MsgControlArmas.getProperty("correoDesde")); + envioCorreo.setCorreoPara(new String[]{direccionPersona.getAddress()}); + //envioCorreo.setCorreoPara(new String[]{"ogarcia@bupartech.com"}); + envioCorreo.setAsunto(asunto); + envioCorreo.setMensajeHTML(cuerpo); + EnvioMail envioMail = EnvioMailFactory.getInstancia(); + envioMail.envioMail(envioCorreo); + } catch (EnvioMailException e) { + MessageHelper.setMessageError(new Throwable("Se produjo un error al enviar el correo")); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public TarmSolicitudTramite getSolicitudTramite() { + return solicitudTramite; + } + + public void setSolicitudTramite(TarmSolicitudTramite solicitudTramite) { + this.solicitudTramite = solicitudTramite; + } + + public TarmSolicitudArmasController getTarmSolicitudArmasController() { + return tarmSolicitudArmasController; + } + + public void setTarmSolicitudArmasController( + TarmSolicitudArmasController tarmSolicitudArmasController) { + this.tarmSolicitudArmasController = tarmSolicitudArmasController; + } + + public PersonAddressController getPersonAddressController() { + return personAddressController; + } + + public void setPersonAddressController( + PersonAddressController personAddressController) { + this.personAddressController = personAddressController; + } + + public TcustPersonDetail getDetallesPersona() { + return detallesPersona; + } + + public void setDetallesPersona(TcustPersonDetail detallesPersona) { + this.detallesPersona = detallesPersona; + } + + public TcustPersonAddress getDireccionPersona() { + return direccionPersona; + } + + public void setDireccionPersona(TcustPersonAddress direccionPersona) { + this.direccionPersona = direccionPersona; + } + + public TcustPersonDetail getUsuario() { + return usuario; + } + + public void setUsuario(TcustPersonDetail usuario) { + this.usuario = usuario; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getNombreInstitucion() { + return nombreInstitucion; + } + + public void setNombreInstitucion(String nombreInstitucion) { + this.nombreInstitucion = nombreInstitucion; + } + + public Boolean getBtnEnviar() { + return btnEnviar; + } + + public void setBtnEnviar(Boolean btnEnviar) { + this.btnEnviar = btnEnviar; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RegistroInspeccionController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RegistroInspeccionController.java new file mode 100644 index 0000000..65dfebd --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RegistroInspeccionController.java @@ -0,0 +1,1027 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.SelectEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.CargaController; +import com.fp.frontend.controller.armas.lov.SitioAlmacenamientoLovController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.IngresoDatosTipoTramite; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.PersonPhoneController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.param.TarmSitioAlmacenamiento; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmAgenciaArma; +import com.fp.persistence.parmas.soli.TarmSolicitudAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TgeneInspeccion. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RegistroInspeccionController extends AbstractController { + + public RegistroInspeccionController() throws Exception { + super(AbstractDataTransport.class); + } + + /** + * Atributo para obtener el valor del flujo + */ + private String codigoSolicitud; + /** + * Atributo para obtener el valor del flujo + */ + private String numeroSolicitud; + + @ManagedProperty(value = "#{inspeccionController}") + private InspeccionController inspeccionController; + + @ManagedProperty(value = "#{solicitudTramiteController}") + private SolicitudTramiteController solicitudTramiteController; + + @ManagedProperty(value = "#{solicitudArmasController}") + private SolicitudArmasController solicitudArmasController; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController persondetail; + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController address; + + @ManagedProperty(value = "#{centroControlArmasController}") + private CentroControlArmasController centroControlArmasController; + + @ManagedProperty(value = "#{personPhoneController}") + private PersonPhoneController personPhoneController; + + //PARA LOS ARCHIVOS + @ManagedProperty(value = "#{inspeccionArchivoController}") + private InspeccionArchivoController inspeccionArchivoController; +// TRAMITE + @ManagedProperty(value = "#{ingresoDatosTipoTramite}") + private IngresoDatosTipoTramite tarmTramiteController; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * Controlador que maneja las armas asociadas a las agencias + */ + @ManagedProperty(value = "#{agenciaArmaController}") + private AgenciaArmaController agenciaArma; + + /** + * Controlador que maneja cargas para previa importacion + */ + @ManagedProperty(value = "#{cargaController}") + private CargaController cargaController; + + /** + * Campo para seleccionar si el tramite sigue el proceso + */ + private Boolean tramiteProceso = Boolean.FALSE; + /** + * Campo para seleccionar si se niega el tramite + */ + private Boolean tramiteProcesoNegar = Boolean.FALSE; + private String aplicaDecomiso; + private Integer codigoPersona; + //sitio de almacenamiento + private TarmSitioAlmacenamiento sitioAlmacenamiento; + //propietario + private TcustPersonAddress personAddressDireccion; + private TcustPersonAddress personAddressCorreo; + private TcustPersonDetail tcustPersonDetailProp; + private TcustPersonPhone personPhoneDomiProp; + //PERSONA RESPONSABLE + private TcustPersonDetail tcustPersonDetailResp; + /** + * campo para cargar al usuario logeado + */ + private TsafeUserDetail tsafeUserDetail; + private TcustPersonPhone personPhoneDomiResp; + private TcustPersonPhone personPhoneCelResp; + private TcustPersonAddress personAddressCorreoresp; + /** + * Atributos para cargar los archivos + */ + private UploadedFile file; + private UploadedFile uploadedFileFoto1; + private UploadedFile uploadedFileFoto2; + private UploadedFile uploadedFileFoto3; + /** + * Atributos para obtener los codigos pra las validaciones + */ + private String codigoMail; + private String codigoOficina; + private String codigoPhoneFijo; + private String codigoPhoneCelular; + /** + * campo para desabilitar el boton + */ + private Boolean btn = Boolean.FALSE; + + private Boolean btnFlujo; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + this.startQuery(); + querydatabase(); + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + codigoSolicitud = super.getMfilters().get("csolicitud"); + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "REGISTROINSP"; + inspeccionController.create(); + inspeccionArchivoController.create(); + sitioAlmacenamiento = new TarmSitioAlmacenamiento(); + //propietario + personAddressDireccion = new TcustPersonAddress(); + personAddressCorreo = new TcustPersonAddress(); + tcustPersonDetailProp = new TcustPersonDetail(); + personPhoneDomiProp = new TcustPersonPhone(); + //PERSONA RESPONSABLE + tcustPersonDetailResp = new TcustPersonDetail(); + tsafeUserDetail = new TsafeUserDetail(); + personPhoneDomiResp = new TcustPersonPhone(); + personPhoneCelResp = new TcustPersonPhone(); + personAddressCorreoresp = new TcustPersonAddress(); + //se obtiene el usuario logeado + tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + //codigos + codigoMail = codigoParameter("CODIGO.MAIL"); + codigoOficina = codigoParameter("CODIGO.OFICINA"); + codigoPhoneFijo = codigoParameter("CODIGO.PHONE.FIJO"); + codigoPhoneCelular = codigoParameter("CODIGO.PHONE.CELULAR"); + btnFlujo = Boolean.FALSE; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public String codigoParameter(String codigo) { + TgeneParameters parameter = ParametersController.find(codigo, "1"); + return parameter.getTextvalue(); + } + + @Override + protected void querydatabase() { + try { + solicitudArmasController.getMfilters().clear(); + solicitudArmasController.getMfilters().put("pk", codigoSolicitud); + solicitudArmasController.query();//devuelve el record + codigoPersona = solicitudArmasController.getRecord().getPersoncode(); + String centroControl = solicitudArmasController.getRecord().getCcentrocontrol(); + Long ctramite = solicitudArmasController.getRecord().getCtramite(); + numeroSolicitud = solicitudArmasController.getRecord().getNumerosolicitud(); + + solicitudTramiteController.getMfilters().clear(); + solicitudTramiteController.getMfilters().put("pk.csolicitud", codigoSolicitud); + solicitudTramiteController.getMfilters().put("pk.ctramite", solicitudArmasController.getRecord().getCtramite().toString()); + solicitudTramiteController.query(); + solicitudTramiteController.setRecord(solicitudTramiteController.getLrecord().get(0)); + + persondetail.getMfilters().clear(); + persondetail.getMfilters().put("pk.personcode", codigoPersona.toString()); + persondetail.addFilterDateto(); + persondetail.query(); + tcustPersonDetailProp = persondetail.getRecord(); + + address.getMfilters().clear(); + address.addPersoncodeFilter(codigoPersona.toString()); + address.addFilterDateto(); + address.query(); + if (address.getLrecord() != null && address.getLrecord().size() > 0) { + for (TcustPersonAddress direccion : address.getLrecord()) { + if (direccion.getAddresstypecatalog().equals(codigoOficina)) {//1-CODIGO.OFICINA + personAddressDireccion = direccion; + } else { + personAddressCorreo = direccion; + } + } + } + + //telefono + personPhoneController.getMfilters().clear(); + personPhoneController.addPersoncodeFilter(codigoPersona.toString()); + personPhoneController.addFilterDateto(); + personPhoneController.getMfilters().put("phonetypecatalog", codigoPhoneFijo);//1 CODIGO.PHONE.FIJO + personPhoneController.query(); + if (personPhoneController.getLrecord() != null && personPhoneController.getLrecord().size() > 0) { + personPhoneDomiProp = personPhoneController.getLrecord().get(0); + } + + centroControlArmasController.getMfilters().clear(); + centroControlArmasController.getMfilters().put("pk", centroControl); + centroControlArmasController.query(); + centroControlArmasController.setRecord(centroControlArmasController.getLrecord().get(0)); + String numOrdenTrabajo = ""; + if (solicitudTramiteController.getRecord().getNumerotramite().contains("TRA")) { + numOrdenTrabajo = solicitudTramiteController.getRecord().getNumerotramite().replace("TRA", "INS"); + } else { + numOrdenTrabajo = "TRA" + solicitudTramiteController.getRecord().getNumerotramite(); + } + + inspeccionController.getRecord().setNumordentrabajo(numOrdenTrabajo); + inspeccionController.getRecord().setFecharegistro(new Date(new java.util.Date().getTime())); + //TRAMITE + tarmTramiteController.getMfilters().clear(); + tarmTramiteController.getMfilters().put("pk", ctramite.toString()); + tarmTramiteController.query(); + if (tarmTramiteController.getLrecord() != null && tarmTramiteController.getLrecord().size() > 0) { + tarmTramiteController.setRecord(tarmTramiteController.getLrecord().get(0)); + } + + //responsable--------------------------------------------------------------------------------------- + persondetail.getMfilters().clear(); + persondetail.getMfilters().put("pk.personcode", tsafeUserDetail.getPk().getPersoncode().toString()); + persondetail.getMfilters().put("pk.dateto", tsafeUserDetail.getPk().getDateto().toString()); + persondetail.query(); + tcustPersonDetailResp = persondetail.getRecord(); + + personPhoneController.getMfilters().clear(); + personPhoneController.addPersoncodeFilter(tsafeUserDetail.getPk().getPersoncode().toString()); + personPhoneController.addFilterDateto(); + personPhoneController.query(); + if (personPhoneController.getLrecord() != null && personPhoneController.getLrecord().size() > 0) { + for (TcustPersonPhone tel : personPhoneController.getLrecord()) { + if (tel.getPhonetypecatalog().equals(codigoPhoneFijo)) { // CODIGO.PHONE.FIJO + personPhoneDomiResp = tel; + } else if (tel.getPhonetypecatalog().equals(codigoPhoneCelular)) {// CODIGO.PHONE.CELULAR + personPhoneCelResp = tel; + } + } + } + address.getMfilters().clear(); + address.addPersoncodeFilter(tsafeUserDetail.getPk().getPersoncode().toString()); + address.addFilterDateto(); + address.getMfilters().put("addresstypecatalog", codigoMail);// 3 CODIGO.MAIL personaddress + address.query(); + if (address.getLrecord() != null && address.getLrecord().size() > 0) { + address.setRecord(address.getLrecord().get(0)); + personAddressCorreoresp = address.getRecord(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeAprobar() { + if (tramiteProceso) { + tramiteProcesoNegar = false; + inspeccionController.getRecord().setTramiteproceso("Y"); + } else { + tramiteProcesoNegar = true; + inspeccionController.getRecord().setTramiteproceso("N"); + } + aplicaDecomiso = null; + } + + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeRechazar() { + if (tramiteProcesoNegar) { + tramiteProceso = false; + inspeccionController.getRecord().setTramiteproceso("N"); + } else { + tramiteProceso = true; + inspeccionController.getRecord().setTramiteproceso("Y"); + } + aplicaDecomiso = "N"; + } + + //lov de persona + /** + * Método para abrir el lov de personas + */ + public void openSitioLov() { + if (codigoPersona == null || codigoPersona == 0) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_realizelabusqueda")); + return; + } + Map> params = new HashMap<>(); + List lcat = new ArrayList<>(); + lcat.add(codigoPersona.toString()); + params.put("personcode", lcat); + SitioAlmacenamientoLovController.openLov(params); + } + + /** + * Maneja la respuesta del Lov de Personas + * + * @param event + * @throws Exception + */ + public void onReturnSitioLov(SelectEvent event) throws Exception { + sitioAlmacenamiento = (TarmSitioAlmacenamiento) event.getObject();; + } + + @Override + public void save() { + Boolean msg = Boolean.FALSE; + try { + if (sitioAlmacenamiento == null || sitioAlmacenamiento.getPk() == null + || sitioAlmacenamiento.getPk().trim().length() == 0) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionenesitioinspeccion")); + msg = Boolean.TRUE; + } + if (tramiteProceso == false && tramiteProcesoNegar == false) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionenegarocontinuartramiteproceso")); + msg = Boolean.TRUE; + } + if (msg) { + return; + } + HashMap msave = new HashMap(); + Request request = callerhelper.getRequest(); + if (!saveWithDocumentAlfresco()) { + return; + } + if (tramiteProceso) { + bpmDataStatus = "A"; + // request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + } else { + if (aplicaDecomiso == null || (!aplicaDecomiso.equals("Y") && !aplicaDecomiso.equals("N"))) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionesionoenaplicadecomiso")); + return; + } + inspeccionController.getRecord().setAplicadecomiso(aplicaDecomiso); + bpmDataStatus = "D"; + //request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "D" : bpmDataStatus); // A,D,R + } + //request.modifiedData().put("csolicitud",codigoSolicitud); + //request.modifiedData().put("TID", tid); + bpmDataComment = inspeccionController.getRecord().getObservacion(); + //request.modifiedData().put("BPMObs", inspeccionController.getRecord().getObservacion()); + inspeccionController.getRecord().setPlanificado("T"); + inspeccionController.getRecord().setCsolicitud(codigoSolicitud); + inspeccionController.getRecord().setCtramite(solicitudArmasController.getRecord().getCtramite()); + inspeccionController.getRecord().setCsitioalmacenamiento(sitioAlmacenamiento.getPk()); + inspeccionController.getRecord().setPersoncode(tsafeUserDetail.getPk().getPersoncode()); + inspeccionController.update(); + + DtoSave dtosaveInspeccion = inspeccionController.getDtoSave(); + dtosaveInspeccion.setReturnpk(true); + + DtoSave dtosave = inspeccionArchivoController.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + + msave.put(inspeccionController.getBeanalias(), dtosaveInspeccion); // adicionar metadata de mantenimiento para cada tabla. + msave.put(inspeccionArchivoController.getBeanalias(), dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + btn = Boolean.TRUE; + btnFlujo = Boolean.TRUE; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void handleUpload(FileUploadEvent event) { + file = event.getFile(); + } + + /** + * Método para cargar el archivo pdf + * + * @param event + */ + public void upload(FileUploadEvent event) { + file = event.getFile(); + } + + /** + * Método para cargar la imagen 1 + * + * @param event + */ + public void upload1(FileUploadEvent event) { + uploadedFileFoto1 = event.getFile(); + } + + /** + * Método para cargar la imagen 2 + * + * @param event + */ + public void upload2(FileUploadEvent event) { + uploadedFileFoto2 = event.getFile(); + } + + /** + * Método para cargar la imagen 3 + * + * @param event + */ + public void upload3(FileUploadEvent event) { + uploadedFileFoto3 = event.getFile(); + } + + /** + * Método para cargar los archivos al alfresco + * + */ + public Boolean saveWithDocumentAlfresco() { + try { + Boolean msgArchivos = Boolean.FALSE; + //pdf + if (file == null || file.getFileName() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingreseelformatodeinspeccion")); + msgArchivos = Boolean.TRUE; + } + if (uploadedFileFoto1 == null || uploadedFileFoto1.getFileName() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingreselafoto1")); + msgArchivos = Boolean.TRUE; + } + if (uploadedFileFoto2 == null || uploadedFileFoto2.getFileName() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingreselafoto2")); + msgArchivos = Boolean.TRUE; + } + if (uploadedFileFoto3 == null || uploadedFileFoto3.getFileName() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingreselafoto3")); + msgArchivos = Boolean.TRUE; + } + if (msgArchivos) { + return false; + } + String xPathLocation = getRutaDocumentoSolBase() + "/cm:" + numeroSolicitud + "/cm:Inspeccion"; + + //String xphat1="FormatoInspeccion-"+forma.format(fecha)+extencionArchivo(file.getFileName()); + String xphat1 = eliminaCaractersEspeciales(Utilidades.obtieneNombreLimpio(recorteNombre(file.getFileName()))); + if (alfrescoController.uploadFile(file.getInputstream(), xphat1, xPathLocation)) { + inspeccionArchivoController.create(); + inspeccionArchivoController.getRecord().setXpath(xPathLocation + "/cm:" + xphat1); + String fielname = file.getFileName(); + if (fielname.length() > 99) { + fielname = fielname.substring(0, 95) + extencionArchivo(file.getFileName()); + } + inspeccionArchivoController.getRecord().setDescripcion(fielname); + inspeccionArchivoController.update(); + } else { + return false; + } + //String xphat2="Foto1-"+forma.format(fecha)+extencionArchivo(uploadedFileFoto1.getFileName()); + String xphat2 = eliminaCaractersEspeciales(Utilidades.obtieneNombreLimpio(recorteNombre(uploadedFileFoto1.getFileName()))); + if (alfrescoController.uploadFile(uploadedFileFoto1.getInputstream(), xphat2, xPathLocation)) { + inspeccionArchivoController.create(); + inspeccionArchivoController.getRecord().setXpath(xPathLocation + "/cm:" + xphat2); + String fielname = uploadedFileFoto1.getFileName(); + if (fielname.length() > 99) { + fielname = fielname.substring(0, 95) + extencionArchivo(uploadedFileFoto1.getFileName()); + } + inspeccionArchivoController.getRecord().setDescripcion(fielname); + inspeccionArchivoController.update(); + } else { + return false; + } + //String xphat3="Foto2-"+forma.format(fecha)+extencionArchivo(uploadedFileFoto2.getFileName()); + String xphat3 = eliminaCaractersEspeciales(Utilidades.obtieneNombreLimpio(recorteNombre(uploadedFileFoto2.getFileName()))); + if (alfrescoController.uploadFile(uploadedFileFoto2.getInputstream(), xphat3, xPathLocation)) { + inspeccionArchivoController.create(); + inspeccionArchivoController.getRecord().setXpath(xPathLocation + "/cm:" + xphat3); + String fielname = uploadedFileFoto2.getFileName(); + if (fielname.length() > 99) { + fielname = fielname.substring(0, 95) + extencionArchivo(uploadedFileFoto2.getFileName()); + } + inspeccionArchivoController.getRecord().setDescripcion(fielname); + inspeccionArchivoController.update(); + } else { + return false; + } + //String xphat4="Foto3-"+forma.format(fecha)+extencionArchivo(uploadedFileFoto3.getFileName()); + String xphat4 = eliminaCaractersEspeciales(Utilidades.obtieneNombreLimpio(recorteNombre(uploadedFileFoto3.getFileName()))); + if (alfrescoController.uploadFile(uploadedFileFoto3.getInputstream(), xphat4, xPathLocation)) { + inspeccionArchivoController.create(); + inspeccionArchivoController.getRecord().setXpath(xPathLocation + "/cm:" + xphat4); + String fielname = uploadedFileFoto3.getFileName(); + if (fielname.length() > 99) { + fielname = fielname.substring(0, 95) + extencionArchivo(uploadedFileFoto3.getFileName()); + } + inspeccionArchivoController.getRecord().setDescripcion(fielname); + inspeccionArchivoController.update(); + } else { + return false; + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + return true; + } + + public String eliminaCaractersEspeciales(String nombre) { + nombre = nombre.replace("(", ""); + nombre = nombre.replace(")", ""); + String numero = "1234567890"; + if (numero.contains(nombre.substring(0, 1))) { + nombre = nombre.replace(nombre.substring(0, 1), "A"); + } + if (nombre.length() < 10) { + nombre = "ARC" + nombre; + } + return nombre; + } + + /** + * obtiene la extencion del archivo + * + * @param nombre + * @return + */ + private String extencionArchivo(String nombre) { + int pos = nombre.lastIndexOf('.'); + nombre = nombre.substring(pos); + return nombre; + } + + /** + * recorta el nombre + * + * @param nombre + * @return + */ + public String recorteNombre(String nombre) { + String fielname = nombre; + if (fielname.length() > 30) { + fielname = fielname.substring(0, 30) + extencionArchivo(nombre); + } + return fielname; + } + + /** + * Retorna la ruta de documento base en donde se almacenará dicho + * archivo + * + * @return + */ + public String getRutaDocumentoSolBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(inspeccionController.getRecord().getFecharegistro()); + StringBuilder ruta = new StringBuilder("cm:Solicitudes"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + return ruta.toString(); + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("csolicitud", codigoSolicitud); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "-" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + if (bpmDataStatus != null && bpmDataStatus.equals("D")) { + Map datosmail = new HashMap(); + datosmail.put("razons", tcustPersonDetailProp.getName()); + datosmail.put("sol", solicitudArmasController.getRecord().getNumerosolicitud()); + datosmail.put("observaciones", bpmDataComment); + //grado funcionario de la persona logeada + TsafeUserDetail userDetailObj = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personDetailObj = PersonDetailController.find(userDetailObj.getPk().getPersoncode().toString()); + datosmail.put("grado", personDetailObj.getMilitarygrade()); + datosmail.put("funcionario", personDetailObj.getName()); + // Centro de control de armas + datosmail.put("centrocontrol", centroControlArmasController.getRecord().getModifiedData().get("desnombreinstitucion")); + request.modifiedData().put("datosmail", datosmail); + } + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + if (bpmDataStatus.equals("D")) { + saveAnularSolicitud(); + } + btnFlujo = Boolean.FALSE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void saveAnularSolicitud() { + try { + // CATEGORIA 14 PREVIA IMPORTACION + TarmTramite tarmTramite = TarmTramiteController.find(this.solicitudArmasController.getRecord().getCtramite().toString()); + if (tarmTramite.getCategoria().equals("14")) { + desasociarCargaSolicitud(); + } + + //Poner la solicitud en estado anulado + this.solicitudArmasController.getRecord().setEstado("ANU"); + this.solicitudArmasController.update(); + DtoSave dtoSolicitud = this.solicitudArmasController.getDtoSave(); + + TarmSolicitudTramite solicitudTramiteObj = SolicitudTramiteController.findByCSolicitud(this.solicitudArmasController.getRecord().getPk()); + if (solicitudTramiteObj != null) { + solicitudTramiteObj.setIsnew(false); + solicitudTramiteObj.setEstadotramite("ANU"); + solicitudTramiteController.updateSolicitud(solicitudTramiteObj); + } + //Desasociar las armas en apertura de agencias y apertura de sucursales + if (this.solicitudArmasController.getRecord().getCtramite() == 44 || this.solicitudArmasController.getRecord().getCtramite() == 48) { + List armasSolicitudList = RecepcionArmasController.findPorSolicitud(this.solicitudArmasController.getRecord().getPk()); + for (TarmSolicitudArmas armaObj : armasSolicitudList) { + + // Codigo agencia de la solicitud + List solicitudAgenciaLst = SolicitudAgenciaSucursalController.findPorSolicitud(this.solicitudArmasController.getRecord().getPk()); + for (TarmSolicitudAgenciaSucursal solicitudAgenciaSucursalObj : solicitudAgenciaLst) { + String cAgencia = solicitudAgenciaSucursalObj.getPk().getCagencia().toString(); + TarmAgenciaArma agenciaArmaObj = AgenciaArmaController.findByCArma(armaObj.getPk().getCarma(), cAgencia); + agenciaArma.setRecord(agenciaArmaObj); + agenciaArma.remove(); + } + } + } + + DtoSave dtoSolicitudTramite = solicitudTramiteController.getDtoSave(); + DtoSave dtoAgenciaArma = agenciaArma.getDtoSave(); + + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + msave.put(solicitudArmasController.getBeanalias(), dtoSolicitud); // adicionar metadata de mantenimiento para cada tabla. + msave.put(solicitudTramiteController.getBeanalias(), dtoSolicitudTramite); + msave.put(agenciaArma.getBeanalias(), dtoAgenciaArma); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + solicitudArmasController.postCommit(resp); + solicitudTramiteController.postCommit(resp); + agenciaArma.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void desasociarCargaSolicitud() { + try { + TarmCarga carga = CargaController.findByAUCP(solicitudArmasController.getRecord().getAucp()); + if (carga != null) { + carga.setCsolicitud(null); + cargaController.update(carga); + cargaController.save(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public InspeccionController getInspeccionController() { + return inspeccionController; + } + + public void setInspeccionController(InspeccionController inspeccionController) { + this.inspeccionController = inspeccionController; + } + + public SolicitudTramiteController getSolicitudTramiteController() { + return solicitudTramiteController; + } + + public void setSolicitudTramiteController( + SolicitudTramiteController solicitudTramiteController) { + this.solicitudTramiteController = solicitudTramiteController; + } + + public SolicitudArmasController getSolicitudArmasController() { + return solicitudArmasController; + } + + public void setSolicitudArmasController( + SolicitudArmasController solicitudArmasController) { + this.solicitudArmasController = solicitudArmasController; + } + + public PersonDetailController getPersondetail() { + return persondetail; + } + + public void setPersondetail(PersonDetailController persondetail) { + this.persondetail = persondetail; + } + + public PersonAddressController getAddress() { + return address; + } + + public void setAddress(PersonAddressController address) { + this.address = address; + } + + public TarmSitioAlmacenamiento getSitioAlmacenamiento() { + return sitioAlmacenamiento; + } + + public void setSitioAlmacenamiento(TarmSitioAlmacenamiento sitioAlmacenamiento) { + this.sitioAlmacenamiento = sitioAlmacenamiento; + } + + public Boolean getTramiteProceso() { + return tramiteProceso; + } + + public void setTramiteProceso(Boolean tramiteProceso) { + this.tramiteProceso = tramiteProceso; + } + + public String getAplicaDecomiso() { + return aplicaDecomiso; + } + + public void setAplicaDecomiso(String aplicaDecomiso) { + this.aplicaDecomiso = aplicaDecomiso; + } + + public CentroControlArmasController getCentroControlArmasController() { + return centroControlArmasController; + } + + public void setCentroControlArmasController( + CentroControlArmasController centroControlArmasController) { + this.centroControlArmasController = centroControlArmasController; + } + + public TcustPersonAddress getPersonAddressDireccion() { + return personAddressDireccion; + } + + public void setPersonAddressDireccion(TcustPersonAddress personAddressDireccion) { + this.personAddressDireccion = personAddressDireccion; + } + + public TcustPersonAddress getPersonAddressCorreo() { + return personAddressCorreo; + } + + public void setPersonAddressCorreo(TcustPersonAddress personAddressCorreo) { + this.personAddressCorreo = personAddressCorreo; + } + + public PersonPhoneController getPersonPhoneController() { + return personPhoneController; + } + + public void setPersonPhoneController(PersonPhoneController personPhoneController) { + this.personPhoneController = personPhoneController; + } + + public TcustPersonDetail getTcustPersonDetailProp() { + return tcustPersonDetailProp; + } + + public void setTcustPersonDetailProp(TcustPersonDetail tcustPersonDetailProp) { + this.tcustPersonDetailProp = tcustPersonDetailProp; + } + + public TcustPersonDetail getTcustPersonDetailResp() { + return tcustPersonDetailResp; + } + + public void setTcustPersonDetailResp(TcustPersonDetail tcustPersonDetailResp) { + this.tcustPersonDetailResp = tcustPersonDetailResp; + } + + public TsafeUserDetail getTsafeUserDetail() { + return tsafeUserDetail; + } + + public void setTsafeUserDetail(TsafeUserDetail tsafeUserDetail) { + this.tsafeUserDetail = tsafeUserDetail; + } + + public TcustPersonPhone getPersonPhoneDomiProp() { + return personPhoneDomiProp; + } + + public void setPersonPhoneDomiProp(TcustPersonPhone personPhoneDomiProp) { + this.personPhoneDomiProp = personPhoneDomiProp; + } + + public TcustPersonPhone getPersonPhoneDomiResp() { + return personPhoneDomiResp; + } + + public void setPersonPhoneDomiResp(TcustPersonPhone personPhoneDomiResp) { + this.personPhoneDomiResp = personPhoneDomiResp; + } + + public TcustPersonPhone getPersonPhoneCelResp() { + return personPhoneCelResp; + } + + public void setPersonPhoneCelResp(TcustPersonPhone personPhoneCelResp) { + this.personPhoneCelResp = personPhoneCelResp; + } + + public TcustPersonAddress getPersonAddressCorreoresp() { + return personAddressCorreoresp; + } + + public void setPersonAddressCorreoresp( + TcustPersonAddress personAddressCorreoresp) { + this.personAddressCorreoresp = personAddressCorreoresp; + } + + public Integer getCodigoPersona() { + return codigoPersona; + } + + public void setCodigoPersona(Integer codigoPersona) { + this.codigoPersona = codigoPersona; + } + + public InspeccionArchivoController getInspeccionArchivoController() { + return inspeccionArchivoController; + } + + public void setInspeccionArchivoController( + InspeccionArchivoController inspeccionArchivoController) { + this.inspeccionArchivoController = inspeccionArchivoController; + } + + public UploadedFile getFile() { + return file; + } + + public void setFile(UploadedFile file) { + this.file = file; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public UploadedFile getUploadedFileFoto1() { + return uploadedFileFoto1; + } + + public void setUploadedFileFoto1(UploadedFile uploadedFileFoto1) { + this.uploadedFileFoto1 = uploadedFileFoto1; + } + + public UploadedFile getUploadedFileFoto2() { + return uploadedFileFoto2; + } + + public void setUploadedFileFoto2(UploadedFile uploadedFileFoto2) { + this.uploadedFileFoto2 = uploadedFileFoto2; + } + + public UploadedFile getUploadedFileFoto3() { + return uploadedFileFoto3; + } + + public void setUploadedFileFoto3(UploadedFile uploadedFileFoto3) { + this.uploadedFileFoto3 = uploadedFileFoto3; + } + + public String getCodigoSolicitud() { + return codigoSolicitud; + } + + public void setCodigoSolicitud(String codigoSolicitud) { + this.codigoSolicitud = codigoSolicitud; + } + + public IngresoDatosTipoTramite getTarmTramiteController() { + return tarmTramiteController; + } + + public void setTarmTramiteController( + IngresoDatosTipoTramite tarmTramiteController) { + this.tarmTramiteController = tarmTramiteController; + } + + public Boolean getTramiteProcesoNegar() { + return tramiteProcesoNegar; + } + + public void setTramiteProcesoNegar(Boolean tramiteProcesoNegar) { + this.tramiteProcesoNegar = tramiteProcesoNegar; + } + + public Boolean getBtn() { + return btn; + } + + public void setBtn(Boolean btn) { + this.btn = btn; + } + + public Boolean getBtnFlujo() { + return btnFlujo; + } + + public void setBtnFlujo(Boolean btnFlujo) { + this.btnFlujo = btnFlujo; + } + + public AgenciaArmaController getAgenciaArma() { + return agenciaArma; + } + + public void setAgenciaArma(AgenciaArmaController agenciaArma) { + this.agenciaArma = agenciaArma; + } + + public CargaController getCargaController() { + return cargaController; + } + + public void setCargaController(CargaController cargaController) { + this.cargaController = cargaController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RegistroInspeccionPlaniNoPlaniController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RegistroInspeccionPlaniNoPlaniController.java new file mode 100644 index 0000000..e7de19a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RegistroInspeccionPlaniNoPlaniController.java @@ -0,0 +1,713 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.sql.Date; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.SelectEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.lov.PlanificacionTramiteLovController; +import com.fp.frontend.controller.armas.lov.SitioAlmacenamientoLovController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.ins.TarmPlanificacionTramite; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmSitioAlmacenamiento; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TgeneCatalog. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RegistroInspeccionPlaniNoPlaniController extends AbstractController { + + @ManagedProperty(value = "#{inspeccionController}") + private InspeccionController inspeccionController; + + //PARA LOS ARCHIVOS + @ManagedProperty(value = "#{inspeccionArchivoController}") + private InspeccionArchivoController inspeccionArchivoController; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + @ManagedProperty(value = "#{planificacionTramiteController}") + PlanificacionTramiteController planificacionTramiteController; + + private TarmPlanificacionTramite planificacionTramite; + + private TcustPersonDetail tcustPersonDetailInspeccion; + + private TarmSitioAlmacenamiento sitioAlmacenamiento; + + private TsafeUserDetail tsafeUserDetail; + + private List lplanificacion; + /** + * Campo para seleccionar si el tramite sigue el proceso + */ + private Boolean tramiteProceso = Boolean.FALSE; + + private Boolean tramiteProcesoNegar = Boolean.FALSE; + + private Map personaPropietario; + + private TarmCentroControl centroControl; + private String aplicaDecomiso; + + private String codigoPersonaSitioAlm; + + private String numerotrabajo; + /** + * Atributos para cargar los archivos + */ + private UploadedFile file; + private UploadedFile uploadedFileFoto1; + private UploadedFile uploadedFileFoto2; + private UploadedFile uploadedFileFoto3; + /** + * campo para desabilitar el boton + */ + private Boolean btn = Boolean.FALSE; + + /** + * Constructor + * + * @throws Exception + */ + public RegistroInspeccionPlaniNoPlaniController() throws Exception { + super(TcustPersonDetail.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.personaPropietario = new HashMap<>(); + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "REGINSPECPLANINO"; + tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + String legalcodepla = codigoParameter("LEGALCODE.PLAN"); + lplanificacion = CatalogDetailController.find("OPERACIONINSPECCION", legalcodepla); + inspeccionController.create(); + inspeccionController.getRecord().setFecharegistro(new Date(new java.util.Date().getTime())); + numerotrabajo = null; + obtenerCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para obtener el centro de control + * + * @throws Exception + */ + private void obtenerCentroControl() throws Exception { + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + this.getMfilters().put("pk.personcode", tsafeUserDetail.getPk().getPersoncode().toString()); + addFilterDateto(); + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(false); + dto.setOrderby("t.pk"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); + request.setQueryTables(mtables); + request.put("queryalias", "INSPECCIONPLANIFICADA"); + request.put("querytype", "P"); + //DATOS ADICIONALES + if (planificacionTramite != null) { + request.put("personcodepropietario", planificacionTramite.getModifiedData().get("personcode")); + codigoPersonaSitioAlm = planificacionTramite.getModifiedData().get("personcode").toString(); + } + if (tcustPersonDetailInspeccion != null) { + request.put("personcodepropietario", tcustPersonDetailInspeccion.getPk().getPersoncode()); + codigoPersonaSitioAlm = tcustPersonDetailInspeccion.getPk().getPersoncode().toString(); + } + + request.put("ccentrocontrol", "0035"); + //com.fp.armas.rules.query.solicitud.CompletaDatosInspeccionPlan + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.record = new TcustPersonDetail(); + MessageHelper.setMessageError(resp); + } else { + this.record = (TcustPersonDetail) resp.get(this.beanalias); + this.personaPropietario = (Map) resp.get("PERSONAPROPIETARIO"); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private String codigoParameter(String codigo) throws Exception { + TgeneParameters parameter = ParametersController.find(codigo, "1"); + return parameter.getTextvalue(); + } + + public void openPlanificacionTramiteLov() { + Map> params = new HashMap<>(); + List lcat = new ArrayList<>(); + lcat.add(centroControl.getPk()); + params.put("centrocontrol", lcat); + PlanificacionTramiteLovController.openLov(params); + } + + public void onReturnPlanificacionTramiteLov(SelectEvent event) throws Exception { + planificacionTramite = (TarmPlanificacionTramite) event.getObject(); + tcustPersonDetailInspeccion = null; + querydatabase(); + } + + /** + * Método para abrir el lov de sitio de almacenamineot + */ + public void openSitioLov() { + if (codigoPersonaSitioAlm == null || codigoPersonaSitioAlm.trim().length() == 0) { + MessageHelper.setMessageError("SELECCIONE UN PROPIETARIO O RESPONSABLE"); + return; + } + Map> params = new HashMap<>(); + List lcat = new ArrayList<>(); + lcat.add(codigoPersonaSitioAlm); + params.put("personcode", lcat); + SitioAlmacenamientoLovController.openLov(params); + } + + /** + * Maneja la respuesta del Lov de Personas + * + * @param event + * @throws Exception + */ + public void onReturnSitioLov(SelectEvent event) throws Exception { + sitioAlmacenamiento = (TarmSitioAlmacenamiento) event.getObject(); + } + + /** + * Método para abrir el lov de personas + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Maneja la respuesta del Lov de Personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + tcustPersonDetailInspeccion = (TcustPersonDetail) event.getObject(); + planificacionTramite = null; + querydatabase(); + } + + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeAprobar() { + if (tramiteProceso) { + tramiteProcesoNegar = false; + inspeccionController.getRecord().setTramiteproceso("Y"); + } else { + tramiteProcesoNegar = true; + inspeccionController.getRecord().setTramiteproceso("N"); + } + aplicaDecomiso = null; + } + + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeRechazar() { + if (tramiteProcesoNegar) { + tramiteProceso = false; + inspeccionController.getRecord().setTramiteproceso("N"); + } else { + tramiteProceso = true; + inspeccionController.getRecord().setTramiteproceso("Y"); + } + aplicaDecomiso = "N"; + } + + @Override + public void save() { + Boolean msg = Boolean.FALSE; + try { + if (sitioAlmacenamiento == null || sitioAlmacenamiento.getPk() == null + || sitioAlmacenamiento.getPk().trim().length() == 0) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionenesitioinspeccion")); + msg = Boolean.TRUE; + } + if (tramiteProceso == false && tramiteProcesoNegar == false) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionenegarocontinuartramiteproceso")); + msg = Boolean.TRUE; + } + if (msg) { + return; + } + HashMap msave = new HashMap(); + Request request = callerhelper.getRequest(); + if (!saveWithDocumentAlfresco()) { + return; + } + if (tramiteProceso) { + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + } else { + if (aplicaDecomiso == null || (!aplicaDecomiso.equals("N") && !aplicaDecomiso.equals("N"))) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionesionoenaplicadecomiso")); + return; + } + inspeccionController.getRecord().setAplicadecomiso(aplicaDecomiso); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "D" : bpmDataStatus); // A,D,R + } + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMObs", inspeccionController.getRecord().getObservacion()); + + //actualiza el campo de la planificacion + if (planificacionTramite != null) { + planificacionTramiteController.create(); + planificacionTramiteController.setRecord(planificacionTramite); + planificacionTramiteController.getRecord().setInspeccion("Y"); + planificacionTramiteController.actualizar(planificacionTramiteController.getRecord()); + DtoSave dtosavePlanificacion = planificacionTramiteController.getDtoSave(); + dtosavePlanificacion.setReturnpk(true); + dtosavePlanificacion.setPosition(3); + msave.put(planificacionTramiteController.getBeanalias(), dtosavePlanificacion); + inspeccionController.getRecord().setCplanificaciontramite(planificacionTramite.getPk()); + } + + inspeccionController.getRecord().setCsitioalmacenamiento(sitioAlmacenamiento.getPk()); + inspeccionController.getRecord().setPersoncode(tsafeUserDetail.getPk().getPersoncode()); + inspeccionController.getRecord().setCentrocontrol(centroControl.getPk()); + Integer canno = Calendar.getInstance().get(Calendar.YEAR); + inspeccionController.getRecord().setAnno(Long.parseLong(canno.toString())); + inspeccionController.update(); + + DtoSave dtosaveInspeccion = inspeccionController.getDtoSave(); + dtosaveInspeccion.setReturnpk(true); + dtosaveInspeccion.setPosition(2); + msave.put(inspeccionController.getBeanalias(), dtosaveInspeccion); + + DtoSave dtosave = inspeccionArchivoController.getDtoSave(); + dtosave.setReturnpk(true); + dtosave.setPosition(1); + msave.put(inspeccionArchivoController.getBeanalias(), dtosave); + + request.setSaveTables(msave); + //com.fp.armas.rules.save.solicitud.RegistroInspeccion (TransactionRule) + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + inspeccionController.postCommit(resp); + inspeccionArchivoController.postCommit(resp); + planificacionTramiteController.postCommit(resp); + numerotrabajo = "" + resp.get("numerotrabajo"); + MessageHelper.setMessageInfo(resp); + btn = Boolean.TRUE; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void handleUpload(FileUploadEvent event) { + file = event.getFile(); + } + + public void upload(FileUploadEvent event) { + file = event.getFile(); + } + + public void upload1(FileUploadEvent event) { + uploadedFileFoto1 = event.getFile(); + } + + public void upload2(FileUploadEvent event) { + uploadedFileFoto2 = event.getFile(); + } + + public void upload3(FileUploadEvent event) { + uploadedFileFoto3 = event.getFile(); + } + + /** + * Método para cargar los archivos al alfresco + * + */ + public Boolean saveWithDocumentAlfresco() { + try { + Boolean msgArchivos = Boolean.FALSE; + //pdf + if (file == null || file.getFileName() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingreseelformatodeinspeccion")); + msgArchivos = Boolean.TRUE; + } + if (uploadedFileFoto1 == null || uploadedFileFoto1.getFileName() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingreselafoto1")); + msgArchivos = Boolean.TRUE; + } + if (uploadedFileFoto2 == null || uploadedFileFoto2.getFileName() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingreselafoto2")); + msgArchivos = Boolean.TRUE; + } + if (uploadedFileFoto3 == null || uploadedFileFoto3.getFileName() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_ingreselafoto3")); + msgArchivos = Boolean.TRUE; + } + if (msgArchivos) { + return false; + } + String xPathLocation = null; + if (planificacionTramite != null) { + xPathLocation = getRutaDocumentoSolBase() + "/cm:Inspeccion/cm:NO-PLANIFICADA-" + codigoPersonaSitioAlm; + //codigoPersonaSitioAlm=planificacionTramite.getModifiedData().get("personcode").toString(); + } + if (tcustPersonDetailInspeccion != null) { + xPathLocation = getRutaDocumentoSolBase() + "/cm:Inspeccion/cm:PLANIFICADA-" + codigoPersonaSitioAlm; + //codigoPersonaSitioAlm=tcustPersonDetailInspeccion.getPk().getPersoncode().toString(); + } + //String xphat1="FormatoInspeccion-"+forma.format(fecha)+extencionArchivo(file.getFileName()); + String xphat1 = eliminaCaractersEspeciales(Utilidades.obtieneNombreLimpio(recorteNombre(file.getFileName()))); + if (alfrescoController.uploadFile(file.getInputstream(), xphat1, xPathLocation)) { + inspeccionArchivoController.create(); + inspeccionArchivoController.getRecord().setXpath(xPathLocation + "/cm:" + xphat1); + String fielname = file.getFileName(); + if (fielname.length() > 99) { + fielname = fielname.substring(0, 95) + extencionArchivo(file.getFileName()); + } + inspeccionArchivoController.getRecord().setDescripcion(fielname); + inspeccionArchivoController.update(); + } else { + return false; + } + //String xphat2="Foto1-"+forma.format(fecha)+extencionArchivo(uploadedFileFoto1.getFileName()); + String xphat2 = eliminaCaractersEspeciales(Utilidades.obtieneNombreLimpio(recorteNombre(uploadedFileFoto1.getFileName()))); + if (alfrescoController.uploadFile(uploadedFileFoto1.getInputstream(), xphat2, xPathLocation)) { + inspeccionArchivoController.create(); + inspeccionArchivoController.getRecord().setXpath(xPathLocation + "/cm:" + xphat2); + String fielname = uploadedFileFoto1.getFileName(); + if (fielname.length() > 99) { + fielname = fielname.substring(0, 95) + extencionArchivo(uploadedFileFoto1.getFileName()); + } + inspeccionArchivoController.getRecord().setDescripcion(fielname); + inspeccionArchivoController.update(); + } else { + return false; + } + //String xphat3="Foto2-"+forma.format(fecha)+extencionArchivo(uploadedFileFoto2.getFileName()); + String xphat3 = eliminaCaractersEspeciales(Utilidades.obtieneNombreLimpio(recorteNombre(uploadedFileFoto2.getFileName()))); + if (alfrescoController.uploadFile(uploadedFileFoto2.getInputstream(), xphat3, xPathLocation)) { + inspeccionArchivoController.create(); + inspeccionArchivoController.getRecord().setXpath(xPathLocation + "/cm:" + xphat3); + String fielname = uploadedFileFoto2.getFileName(); + if (fielname.length() > 99) { + fielname = fielname.substring(0, 95) + extencionArchivo(uploadedFileFoto2.getFileName()); + } + inspeccionArchivoController.getRecord().setDescripcion(fielname); + inspeccionArchivoController.update(); + } else { + return false; + } + //String xphat4="Foto3-"+forma.format(fecha)+extencionArchivo(uploadedFileFoto3.getFileName()); + String xphat4 = eliminaCaractersEspeciales(Utilidades.obtieneNombreLimpio(recorteNombre(uploadedFileFoto3.getFileName()))); + if (alfrescoController.uploadFile(uploadedFileFoto3.getInputstream(), xphat4, xPathLocation)) { + inspeccionArchivoController.create(); + inspeccionArchivoController.getRecord().setXpath(xPathLocation + "/cm:" + xphat4); + String fielname = uploadedFileFoto3.getFileName(); + if (fielname.length() > 99) { + fielname = fielname.substring(0, 95) + extencionArchivo(uploadedFileFoto3.getFileName()); + } + inspeccionArchivoController.getRecord().setDescripcion(fielname); + inspeccionArchivoController.update(); + } else { + return false; + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + return true; + } + + public String eliminaCaractersEspeciales(String nombre) { + nombre = nombre.replace("(", ""); + nombre = nombre.replace(")", ""); + return nombre; + } + + /** + * obtiene la extencion del archivo + * + * @param nombre + * @return + */ + private String extencionArchivo(String nombre) { + int pos = nombre.lastIndexOf('.'); + nombre = nombre.substring(pos); + return nombre; + } + + /** + * recorta el nombre + * + * @param nombre + * @return + */ + public String recorteNombre(String nombre) { + String fielname = nombre; + if (fielname.length() > 30) { + fielname = fielname.substring(0, 30) + extencionArchivo(nombre); + } + return fielname; + } + + /** + * Retorna la ruta de documento base en donde se almacenará dicho + * archivo + * + * @return + */ + public String getRutaDocumentoSolBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(inspeccionController.getRecord().getFecharegistro()); + StringBuilder ruta = new StringBuilder("cm:Solicitudes"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + return ruta.toString(); + } + + public InspeccionController getInspeccionController() { + return inspeccionController; + } + + public void setInspeccionController(InspeccionController inspeccionController) { + this.inspeccionController = inspeccionController; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public Map getPersonaPropietario() { + return personaPropietario; + } + + public void setPersonaPropietario(Map personaPropietario) { + this.personaPropietario = personaPropietario; + } + + public TarmPlanificacionTramite getPlanificacionTramite() { + return planificacionTramite; + } + + public void setPlanificacionTramite( + TarmPlanificacionTramite planificacionTramite) { + this.planificacionTramite = planificacionTramite; + } + + public TarmSitioAlmacenamiento getSitioAlmacenamiento() { + return sitioAlmacenamiento; + } + + public void setSitioAlmacenamiento(TarmSitioAlmacenamiento sitioAlmacenamiento) { + this.sitioAlmacenamiento = sitioAlmacenamiento; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public Boolean getTramiteProceso() { + return tramiteProceso; + } + + public void setTramiteProceso(Boolean tramiteProceso) { + this.tramiteProceso = tramiteProceso; + } + + public TsafeUserDetail getTsafeUserDetail() { + return tsafeUserDetail; + } + + public void setTsafeUserDetail(TsafeUserDetail tsafeUserDetail) { + this.tsafeUserDetail = tsafeUserDetail; + } + + public Boolean getTramiteProcesoNegar() { + return tramiteProcesoNegar; + } + + public void setTramiteProcesoNegar(Boolean tramiteProcesoNegar) { + this.tramiteProcesoNegar = tramiteProcesoNegar; + } + + public String getAplicaDecomiso() { + return aplicaDecomiso; + } + + public void setAplicaDecomiso(String aplicaDecomiso) { + this.aplicaDecomiso = aplicaDecomiso; + } + + public UploadedFile getFile() { + return file; + } + + public void setFile(UploadedFile file) { + this.file = file; + } + + public UploadedFile getUploadedFileFoto1() { + return uploadedFileFoto1; + } + + public void setUploadedFileFoto1(UploadedFile uploadedFileFoto1) { + this.uploadedFileFoto1 = uploadedFileFoto1; + } + + public UploadedFile getUploadedFileFoto2() { + return uploadedFileFoto2; + } + + public void setUploadedFileFoto2(UploadedFile uploadedFileFoto2) { + this.uploadedFileFoto2 = uploadedFileFoto2; + } + + public UploadedFile getUploadedFileFoto3() { + return uploadedFileFoto3; + } + + public void setUploadedFileFoto3(UploadedFile uploadedFileFoto3) { + this.uploadedFileFoto3 = uploadedFileFoto3; + } + + public List getLplanificacion() { + return lplanificacion; + } + + public void setLplanificacion(List lplanificacion) { + this.lplanificacion = lplanificacion; + } + + public InspeccionArchivoController getInspeccionArchivoController() { + return inspeccionArchivoController; + } + + public void setInspeccionArchivoController( + InspeccionArchivoController inspeccionArchivoController) { + this.inspeccionArchivoController = inspeccionArchivoController; + } + + public PlanificacionTramiteController getPlanificacionTramiteController() { + return planificacionTramiteController; + } + + public void setPlanificacionTramiteController( + PlanificacionTramiteController planificacionTramiteController) { + this.planificacionTramiteController = planificacionTramiteController; + } + + public TcustPersonDetail getTcustPersonDetailInspeccion() { + return tcustPersonDetailInspeccion; + } + + public void setTcustPersonDetailInspeccion( + TcustPersonDetail tcustPersonDetailInspeccion) { + this.tcustPersonDetailInspeccion = tcustPersonDetailInspeccion; + } + + public Boolean getBtn() { + return btn; + } + + public void setBtn(Boolean btn) { + this.btn = btn; + } + + public String getCodigoPersonaSitioAlm() { + return codigoPersonaSitioAlm; + } + + public void setCodigoPersonaSitioAlm(String codigoPersonaSitioAlm) { + this.codigoPersonaSitioAlm = codigoPersonaSitioAlm; + } + + public String getNumerotrabajo() { + return numerotrabajo; + } + + public void setNumerotrabajo(String numerotrabajo) { + this.numerotrabajo = numerotrabajo; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteAgenciasSucursalesController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteAgenciasSucursalesController.java new file mode 100644 index 0000000..f68a2e5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteAgenciasSucursalesController.java @@ -0,0 +1,240 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Controlador principal Consulta Agencias y Sucursales + * + */ +@SuppressWarnings("serial") +@ManagedBean(name = "reporteAgenciasSucursalesController") +@ViewScoped +public class ReporteAgenciasSucursalesController extends AbstractController { + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + private String institucionCentroControl = ""; + private TarmCentroControl centroControl = new TarmCentroControl(); + + /** + * Nombre/razón social + */ + private String nombreRazonSocial; + /** + * numedo de identificacion + */ + private String numeroDocumento; + + /** + * Filtro de los codigos de los tramites + */ + private String filtro; + + /** + * Codigo de la persona + */ + private Integer personcode; + + public ReporteAgenciasSucursalesController() throws Exception { + super(AbstractDataTransport.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "REPORTEAGENCIASUCURSAL"; + TsafeUserDetail userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TgeneParameters parametroCodigosTramite = ParametersController.find("CODTRAMAGESUC", userDetail.getCompanycode().toString()); + filtro = parametroCodigosTramite.getTextvalue(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + protected void querydatabase() { + } + + @Override + public void save() { + } + + /** + * Abre el lov de persona + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Maneja la respuesta del Lov de Personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + + TcustPersonDetail personaDetailSelecionada = (TcustPersonDetail) event.getObject(); + nombreRazonSocial = personaDetailSelecionada.getName(); + numeroDocumento = personaDetailSelecionada.getIdentification(); + personcode = personaDetailSelecionada.getPk().getPersoncode(); + } + + /** + * Metodo que se debe ejecutar cuando es una transaccion de tipo verificar + * armas + * + * @throws Exception + */ + private void obtenerCentroControl() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + public void generarReporte() { + if (personcode == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_seleccione_nombre")); + return; + } + String path = "armas/reports/reporteAgenciaSucursal"; + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + TsafeUserDetail userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + } else { + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario); + obtenerCentroControl(); + parameters.put("unidadmilitar", institucionCentroControl); + + parameters.put("nombreRazonSocial", nombreRazonSocial); + parameters.put("centroControl", institucionCentroControl); + Date fechaActual = new Date(); + SimpleDateFormat parseador = new SimpleDateFormat("dd/MM/yyyy hh:mm"); + parameters.put("fecActual", parseador.format(fechaActual)); + + parameters.put("filtro", filtro); + parameters.put("filtro2", personcode); + + String format = "pdf"; + String filename = "Certificado"; + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getNombreRazonSocial() { + return nombreRazonSocial; + } + + public void setNombreRazonSocial(String nombreRazonSocial) { + this.nombreRazonSocial = nombreRazonSocial; + } + + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public String getFiltro() { + return filtro; + } + + public void setFiltro(String filtro) { + this.filtro = filtro; + } + + public Integer getPersoncode() { + return personcode; + } + + public void setPersoncode(Integer personcode) { + this.personcode = personcode; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteAuditoriaAplicacionController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteAuditoriaAplicacionController.java new file mode 100644 index 0000000..f7b681c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteAuditoriaAplicacionController.java @@ -0,0 +1,233 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package com.fp.frontend.controller.armas.solicitud; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import org.primefaces.event.SelectEvent; + +/** + * + * @author developer2 + */ +@ManagedBean +@ViewScoped +public class ReporteAuditoriaAplicacionController extends AbstractController{ + public ReporteAuditoriaAplicacionController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + /** + * Clase controladora de reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + /** + * Fecha a partir de la cual se sacan datos para el reporte + * + */ + private Date fechaInicio; + /** + * Fecha a partir de la cual se sacan datos para el reporte + * + */ + private Date fechaFin; + /** + * Formato de reporte que se va a generar + * + */ + private String format = "pdf"; + /** + * Usuario actual logueado en el sistema + * + */ + + private TsafeUserDetail userDetail; + /** + * Nombre del reporte generado en el Alfresco + * + */ + private String nombreReporte; + /** + * Getters y Setters + * @return + */ + public Date getFechaInicio() { + return fechaInicio; + } + + public void setFechaInicio(Date fechaInicio) { + this.fechaInicio = fechaInicio; + } + + public Date getFechaFin() { + return fechaFin; + } + + public void setFechaFin(Date fechaFin) { + this.fechaFin = fechaFin; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public String getNombreReporte() { + return nombreReporte; + } + + public void setNombreReporte(String nombreReporte) { + this.nombreReporte = nombreReporte; + } + + /**=======================================*/ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + + } + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + recperpage = 10000; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "RPRTEAUDITORIA"; + //centroControlList = CentroControlArmasController.findAll(); + //obtenerCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Metodo para reconsultar en base a una nueva fecha de corte seleccionada + */ + public void cambioFechaDeCorte(SelectEvent event) { + querydatabase(); + } + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport() { + Calendar fechaActualCldr = Calendar.getInstance(); + Calendar fechaInicioCldr = Calendar.getInstance(); + Calendar fechaFinCldr = Calendar.getInstance(); + fechaInicioCldr.setTime(fechaInicio); + fechaFinCldr.setTime(fechaFin); + if (fechaActualCldr.compareTo(fechaInicioCldr) >= 0) { + if (fechaActualCldr.compareTo(fechaFinCldr) >= 0) { + if (fechaFinCldr.compareTo(fechaInicioCldr) >= 0) { + String filename = "reporte_app_" + .concat(Utilidades.armarFormatoFechaSinHora(fechaInicioCldr)) + .concat("_to_") + .concat(Utilidades.armarFormatoFechaSinHora(fechaFinCldr)); + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } else { + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario); + parameters.put("fechaInicio", Utilidades.armarFormatoFechaSinHora(fechaInicioCldr)); + parameters.put("fechaFin", Utilidades.armarFormatoFechaSinHora(fechaFinCldr)); + parameters.put("fechaReporte", Utilidades.armarFormatoFechaConHora(fechaActualCldr)); + + String path; + path = "armas/reports/reporteAuditoriaAplicacion"; + //parameters.put("idCentroControl", "TODOS".equalsIgnoreCase(idCentroControl) ? null : idCentroControl); + //parameters.put("nombreCentroControl", institucionCentroControl); + // Datos del jefe del centro + /** + if (centroControl.getPersoncode() != null) { + TcustPersonDetail supervisorMilitarObj = PersonDetailController.find(centroControl.getPersoncode().toString()); + String gradoSupMilitar = (supervisorMilitarObj == null || supervisorMilitarObj.getMilitarygrade() == null) ? "" : supervisorMilitarObj.getMilitarygrade() + " - "; + parameters.put("nombreJefCentro", (supervisorMilitarObj == null || supervisorMilitarObj.getName() == null) ? "" : gradoSupMilitar + supervisorMilitarObj.getName()); + parameters.put("personCodeJefCentro", (supervisorMilitarObj == null || supervisorMilitarObj.getPk().getPersoncode() == null) ? "" : supervisorMilitarObj.getPk().getPersoncode()); + + }*/ + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaFin")); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaFinMayorAFechaActual")); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaActual")); + } + + } + + + /** + * Método para el inicio de flujo. Guardar el reporte creado para su + * posterior aprobacion en otras instancias del flujo + */ + @Override + public void save() { + + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteAutorizacionesController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteAutorizacionesController.java new file mode 100644 index 0000000..4648d51 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteAutorizacionesController.java @@ -0,0 +1,563 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.common.helper.Constant; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.BuscarTramiteLovController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.OrigenTramiteController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmOrigenTramite; +import com.fp.persistence.parmas.param.TarmRequisitoPorTipoTramite; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitosKey; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de reporte de liquidacion economica + * + * @author Christian Pazmino. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReporteAutorizacionesController extends AbstractController { + + /** + * Fecha a partir de la cual se sacan datos para el reporte + * + */ + /** + * Controlador que maneja las armas dentro de la solicitud + */ + @ManagedProperty(value = "#{solicitudArmasController}") + private SolicitudArmasController solicitud; + + private TarmTramite tarmTramite; + + TgeneCatalogDetail tipoTramite = null; + TgeneCatalogDetail tipoAutorizacion = null; + TgeneCatalogDetail actividad = null; + TgeneCatalogDetail categoria = null; + + /** + * Habilita campos en actualización de datos generales + */ + private boolean actualizaDatosGenerales; + + /** + * Aprueba si es guía de libre tránsito + */ + private boolean guiaLibreTransito; + + /** + * Indica si se debe activar la pestana de ingresar requisitos + */ + private boolean ingresarRequisitos; + + /** + * Indica si se debe activar la pestana de seleccionar armas + */ + private boolean seleccionarArmas; + + private Date fechaInicio; + /** + * Fecha a partir de la cual se sacan datos para el reporte + * + */ + private Date fechaFin; + /** + * Formato de reporte que se va a generar + * + */ + private String format = "pdf"; + /** + * Usuario actual logueado en el sistema + * + */ + private TsafeUserDetail userDetail; + /** + * Nombre del reporte generado en el Alfresco + * + */ + private String nombreReporte; + + /** + * Id del centro de control seleccionado por el usuario + * + */ + private String idCentroControl; + + /** + * Id del tipo de tramite + */ + private String idAutorizacion; + private String idIdentificacion; + + private String numeroDocumento; + + private String idCategoria; + + private String idActividad; + + /** + * Id del tipo de tramite + */ + private String idControl; + + /** + * Lista de centros de control de armas + */ + // private List centroControlList; + private List tipoDocumentoList; + + private List centroControlList; + + private List autorizacionList; + + private List categoriaList; + + private List actividadList; + + private List controlList; + + private TgeneCatalogDetail tipoControl = new TgeneCatalogDetail(); + + private String institucionCentroControl = ""; + private TarmCentroControl centroControl = new TarmCentroControl(); + + /** + * Clase controladora de reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{logincontroller}") + private LoginController logincontroller; + + public ReporteAutorizacionesController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + recperpage = 10000; // Cambiar al # reg a mirar. + beanalias = "RPRTEAUTORIZACIONES"; + // centroControlList = CentroControlArmasController.findAll(); + centroControlList = CatalogDetailController.find("ESTADOAUTORIZACION"); + // autorizacionList = CatalogDetailController.find("TIPOAUTORIZACION"); // tipo de tramite + // categoriaList = CatalogDetailController.find("CATEGORIA"); //catetegoria + // actividadList = CatalogDetailController.find("USOACTIVIDAD"); // actividad + tipoDocumentoList = CatalogDetailController.find("IDENTIFICATION"); + controlList = CatalogDetailController.find("NOMBREINSTITUCION"); + //obtenerCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + + } + + /** + * Metodo para reconsultar en base a una nueva fecha de corte seleccionada + */ + public void cambioFechaDeCorte(SelectEvent event) { + querydatabase(); + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport() { + + if (this.tipoTramite == null) { + MessageHelper.setMessageError("ERROR: CAMPO TIPO TRMITE REQUERIDO"); + return; + } + + if (this.fechaInicio != null || this.fechaFin != null) { + if (this.fechaInicio.getTime() > this.fechaFin.getTime()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaFin")); + return; + } + if (this.fechaInicio.getTime() > new Date().getTime()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaActual")); + return; + } + if (this.fechaFin.getTime() > new Date().getTime()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaFinMayorAFechaActual")); + return; + } + } + + Calendar fechaActualCldr = Calendar.getInstance(); + String path = "armas/reports/autorizaciones"; + String filename = "autorizaciones"; + String nombreUsuario = ""; + + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } else { + nombreUsuario = ""; + } + // institucionCentroControl + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + //parameters.put("unidadmilitar", "hola"); + parameters.put("lugarFecha", Utilidades.armarFormatoFechaConHora(fechaActualCldr)); + parameters.put("usuario", nombreUsuario); + parameters.put("numeroDocumento", " ".equalsIgnoreCase(numeroDocumento) ? null : numeroDocumento); + parameters.put("idControl", "TODOS".equalsIgnoreCase(idControl) ? null : idControl); //centro de control + parameters.put("idCentroControl", "TODOS".equalsIgnoreCase(idCentroControl) ? null : idCentroControl); // estado + //parameters.put("idAutorizacion", "TODOS".equalsIgnoreCase(idAutorizacion)?null:idAutorizacion); // tipo de tramite + //parameters.put("idCategoria", "TODOS".equalsIgnoreCase(idCategoria)?null:idCategoria); // categoria + //parameters.put("idActividad", "TODOS".equalsIgnoreCase(idActividad)?null:idActividad); // uso actividad + parameters.put("idIdentificacion", "TODOS".equalsIgnoreCase(idIdentificacion) ? null : idIdentificacion); // tipo de identificacion + parameters.put("fechaInicio", this.fechaInicio == null ? null : Utilidades.armarFormatoFechaSinHora(this.fechaInicio)); + parameters.put("fechaFin", this.fechaFin == null ? null : Utilidades.armarFormatoFechaSinHora(this.fechaFin)); + TgeneCatalogDetail obj = CatalogDetailController.findCatalogo("NOMBREINSTITUCION", idControl); + parameters.put("tipocentro", "TODOS".equalsIgnoreCase(idControl) ? "TODOS" : obj.getDescription()); //centro de control detalle + TgeneCatalogDetail obj1 = CatalogDetailController.findCatalogo("ESTADOAUTORIZACION", idCentroControl); + parameters.put("pestado", "TODOS".equalsIgnoreCase(idCentroControl) ? "TODOS" : obj1.getDescription()); //estado detalle + TgeneCatalogDetail obj2 = CatalogDetailController.findCatalogo("IDENTIFICATION", idIdentificacion); + parameters.put("pdocumento", "TODOS".equalsIgnoreCase(idIdentificacion) ? "TODOS" : obj2.getDescription()); //tipo documento detalle + + parameters.put("idAutorizacion", tipoAutorizacion.getPk().getCatalog()); + parameters.put("idCategoria", categoria.getPk().getCatalog()); + parameters.put("idActividad", actividad.getPk().getCatalog()); + parameters.put("Tipotramite", tipoTramite.getPk().getCatalog()); + + try { + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } + + /** + * Abre el LOV de trámite + */ + public void openLovTramite() { + Map> params = new HashMap>(); + List ltipopersona = new ArrayList<>(); + ltipopersona = null; + params.put("tipopersonasol", ltipopersona); + BuscarTramiteLovController.openLov(params); + } + + /** + * Regresa del LOV para cargar valores + * + * @param event {@link SelectEvent} + */ + public void onReturnTramite(SelectEvent event) { + try { + TarmTramite tramite = (TarmTramite) event.getObject(); + this.tarmTramite = tramite; +// if(!procedeTramite(TarmTramiteController.find(tramite.getCtramitepadre() != null ? tramite.getCtramitepadre().toString() : "-1"),tramite.getPk())){ + + solicitud.getRecord().setCtramite(tramite.getPk()); + tipoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + tipoAutorizacion = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + categoria = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + actividad = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + this.getSolicitud().addField("tipoTramite", tipoTramite.getDescription()); + this.getSolicitud().addField("tipoAutorizacion", tipoAutorizacion.getDescription()); + this.getSolicitud().addField("categoria", categoria.getDescription()); + this.getSolicitud().addField("actividad", actividad.getDescription()); + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + private void obtenerCentroControl() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Método para el inicio de flujo. Guardar el reporte creado para su + * posterior aprobacion en otras instancias del flujo + */ + @Override + public void save() { + + } + + public Date getFechaInicio() { + return fechaInicio; + } + + public void setFechaInicio(Date fechaInicio) { + this.fechaInicio = fechaInicio; + } + + public Date getFechaFin() { + return fechaFin; + } + + public void setFechaFin(Date fechaFin) { + this.fechaFin = fechaFin; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public String getNombreReporte() { + return nombreReporte; + } + + public void setNombreReporte(String nombreReporte) { + this.nombreReporte = nombreReporte; + } + + public String getIdCentroControl() { + return idCentroControl; + } + + public void setIdCentroControl(String idCentroControl) { + this.idCentroControl = idCentroControl; + } + + public String getIdAutorizacion() { + return idAutorizacion; + } + + public void setIdAutorizacion(String idAutorizacion) { + this.idAutorizacion = idAutorizacion; + } + + //idIdentificacion + public String getIdIdentificacion() { + return idIdentificacion; + } + + public void setIdIdentificacion(String idIdentificacion) { + this.idIdentificacion = idIdentificacion; + } + //public List getCentroControlList() { +// return centroControlList; + //} + + //public void setCentroControlList(List centroControlList) { + //this.centroControlList = centroControlList; + //} + public List getCentroControlList() { + return centroControlList; + } + + public void setCentroControlList(List centroControlList) { + this.centroControlList = centroControlList; + } + + /*CFLORES*/ + public List getTipoDocumentoList() { + return tipoDocumentoList; + } + + public void getTipoDocumentoList(List tipoDocumentoList) { + this.tipoDocumentoList = tipoDocumentoList; + } + + /**/ + + public List getAutorizacionList() { + return autorizacionList; + } + + public void setAutorizacionList(List autorizacionList) { + this.autorizacionList = autorizacionList; + } + + /*cflores*/ + public List getControlList() { + return controlList; + } + + public void setControlList(List controlList) { + this.controlList = controlList; + } + + public String getIdControl() { + return idControl; + } + + public void setIdControl(String idControl) { + this.idControl = idControl; + } + + /*categoria*/ + public List getCategoriaList() { + return categoriaList; + } + + public void setCategoriaList(List categoriaList) { + this.categoriaList = categoriaList; + } + + public String getIdCategoria() { + return idCategoria; + } + + public void setIdCategoria(String idCategoria) { + this.idCategoria = idCategoria; + } + + /**/ + + /*actividad*/ + public List getActividadList() { + return actividadList; + } + + public void setActividadList(List actividadList) { + this.actividadList = actividadList; + } + + public String getIdActividad() { + return idActividad; + } + + public void setIdActividad(String idActividad) { + this.idActividad = idActividad; + } + + /**/ + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + /**/ + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public LoginController getLogincontroller() { + return logincontroller; + } + + public void setLogincontroller(LoginController logincontroller) { + this.logincontroller = logincontroller; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + /** + * Entrega el valor de: solicitud + * + * @return SolicitudArmasController + */ + public SolicitudArmasController getSolicitud() { + return solicitud; + } + + /** + * Fija el valor de: solicitud + * + * @param solicitud Valor a fijar en el atributo. + */ + public void setSolicitud(SolicitudArmasController solicitud) { + this.solicitud = solicitud; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteConsultaSolicitudClienteController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteConsultaSolicitudClienteController.java new file mode 100644 index 0000000..4b82e29 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteConsultaSolicitudClienteController.java @@ -0,0 +1,974 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.PredicateUtils; +import org.apache.commons.collections.TransformerUtils; +import org.primefaces.context.RequestContext; + +import com.fp.common.helper.Constant; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.CargaController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.GuardiasController; +import com.fp.frontend.controller.armas.parametros.RequisitoController; +import com.fp.frontend.controller.pcustomer.PeopleController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.PersonPhoneController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.controller.pgeneral.safe.UserDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.parmas.soli.TarmSolicitudGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitos; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@ManagedBean +@ViewScoped +public class ReporteConsultaSolicitudClienteController extends + AbstractController { + + private static final long serialVersionUID = -4049698904561227471L; + + /** + * Lista de tipos de persona. + */ + private List ltipopersona; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de + * identificación + */ + private List ltipoidenti; + + /** + * Lista de tipos de trámite. + */ + private List ltipotramite; + + /** + * Lista de origen de adquisición + */ + private List lorigenadquisicion; + /** + * Bandera que indica si existe o no un registro para mostrar la solicitud + */ + private boolean existeSolicitud; + /** + * Indica si se debe activar la pestana de ingresar requisitos + */ + private boolean ingresarRequisitos; + + /** + * Indica si se debe activar la pestana de seleccionar armas + */ + private boolean seleccionarArmas; + + /** + * Indica si se debe activar la pestana seleccionar guardias + */ + private boolean seleccionarGuardias; + + /** + * Indica si se debe activar la pestana seleccionar agencias + */ + private boolean seleccionarAgencias; + + /** + * Indica si se debe activar la pestana listar guardias + */ + private boolean listarDocumentos; + + private List lprovincias; + private List lcantones; + private List lparroquias; + private List lcities; + + private List lmarca; + /** + * Controlador de la solicitud + */ + /** + * Controlador que maneja el usuario + */ + @ManagedProperty(value = "#{userDetailController}") + private UserDetailController detalleusuario; + + /** + * Controlador que maneja las armas dentro de la solicitud + */ +// @ManagedProperty(value = "#{solicitudArmasBPMController}") +// private SolicitudArmasBPMController solicitud; + @ManagedProperty(value = "#{solicitudArmasController}") + private SolicitudArmasController solicitud; + + /** + * Controlador que maneja la persona + */ + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController detallepersona; + + /** + * Controlador que maneja los datos de personas naturales + */ + @ManagedProperty(value = "#{peopleController}") + private PeopleController natural; + + /** + * Controlador que maneja direcciones de la persona + */ + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController direccion; + + /** + * Controlador que maneja teléfonos de la persona + */ + @ManagedProperty(value = "#{personPhoneController}") + private PersonPhoneController telefono; + + /** + * Controlador que maneja requisitos dentro de la solicitud + */ + @ManagedProperty(value = "#{solicitudRequisitosController}") + private SolicitudRequisitosController requisitos; + + /** + * Controlador que maneja los guardias en la solicitud + */ + @ManagedProperty(value = "#{solicitudGuardiasController}") + private SolicitudGuardiasController solicitudGuardias; + + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{armasController}") + private ArmasController armas; + + /** + * Controlador que maneja las armas dentro de la solicitud + */ + @ManagedProperty(value = "#{recepcionArmasController}") + private RecepcionArmasController solicitudArmas; + + /** + * Controlador que maneja registro de armas + */ + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmas; + + /** + * Controlador que maneja agencias y sucursales + */ + @ManagedProperty(value = "#{agenciaSucursalController}") + private AgenciaSucursalController agenciaSucursal; + + /** + * Controlador que maneja las agencias y sucursales dentro de la solicitud + */ + @ManagedProperty(value = "#{solicitudAgenciaSucursalController}") + private SolicitudAgenciaSucursalController solicitudAgenciaSucursal; + + /** + * Controlador que maneja los documentos habilitantes + */ + @ManagedProperty(value = "#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitante; + + /** + * Controlador que maneja los documentos dentro de la solicitud + */ + @ManagedProperty(value = "#{tarmSolicitudDocumentoController}") + private TarmSolicitudDocumentoController solicitudDocumento; + + /** + * Controlador que maneja cargas para previa importacion + */ + @ManagedProperty(value = "#{cargaController}") + private CargaController cargaController; + + private Boolean requiereNoSolAucpBln; + + /** + * Referencia al Centro de control; + */ + private TarmCentroControl centroControl = new TarmCentroControl(); + + /** + * Nombre de la Institucion + */ + private String nombreInstitucion; + + private TsafeUserDetail userDetail; + + /** + * + * @throws Exception + */ + public ReporteConsultaSolicitudClienteController() throws Exception { + super(AbstractDataTransport.class); + } + + /** + * postCosntruct + * + * @throws Exception + */ + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + requiereNoSolAucpBln = Boolean.FALSE; + this.startQuery(); + } + + private void init() { + this.beanalias = "REPORTESOLICITUD"; + ltipopersona = CatalogDetailController.find("PERSONTYPE"); + ltipoidenti = CatalogDetailController.find("IDENTIFICATION"); + ltipotramite = CatalogDetailController.find("TIPOTRAMITE"); + lorigenadquisicion = CatalogDetailController.find("ORIGENADQUISICION"); + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + } + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + //Realizo las busquedas en base a los controladores + try { + limpiaDatos(); +// if(solicitud.getRecord() == null || solicitud.getRecord().getPk()==null){ + Utilidades.caracterEspecial(solicitud.getMfilters().get("numerosolicitud")); + solicitud.query(); +// } + if (solicitud.getRecord() != null && solicitud.getRecord().getPk() != null) { + //Valida que corresponda al mismo cliente + if (!userDetail.getPk().getPersoncode().equals(solicitud.getRecord().getPersoncode())) { + MessageHelper.setMessageWarn("Solicitud no corresponde a la persona"); + return; + } + + if (this.solicitud.getMfilters().get("numerosolicitud") == null || this.solicitud.getMfilters().get("numerosolicitud").equals("")) { + this.solicitud.getMfilters().put("numerosolicitud", solicitud.getRecord().getNumerosolicitud()); + } + existeSolicitud = Boolean.TRUE; +// solicitud.setRecord(solicitud.getLrecord().get(0)); + detallepersona.getMfilters().clear(); + detallepersona.getMfilters().put("pk.personcode", solicitud.getRecord().getPersoncode().toString()); + detallepersona.addFilterDateto(); + detallepersona.query(); + + natural.getMfilters().clear(); + natural.addPersoncodeFilter(solicitud.getRecord().getPersoncode().toString()); + natural.addFilterDateto(); + natural.query(); + + direccion.getMfilters().clear(); + direccion.addPersoncodeFilter(solicitud.getRecord().getPersoncode().toString()); + direccion.addFilterDateto(); + direccion.query(); + + this.obtenerDireccionesGenerales(); + + telefono.getMfilters().clear(); + telefono.addPersoncodeFilter(solicitud.getRecord().getPersoncode().toString()); + telefono.addFilterDateto(); + telefono.query(); + this.obtenerTelefonos(); +// this.setearCodigoCentroControl(); + this.setearTramite(); + } else { + existeSolicitud = Boolean.FALSE; + } + } catch (Throwable e) { + // TODO Auto-generated catch block + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void loadEdit() throws Exception { + //TarmArmas arma = ((TarmArmas) solicitudArmas.getRecord().getModifiedData().get("arma")); + TarmArmas arma = ArmasController.findxCodigo(solicitudArmas.getRecord().getModifiedData().get("carma").toString()); + if (arma.getCountrycode() == null) { + arma.setCountrycode("EC"); + } + this.lmarca = (List) ArmasController.findxCodigo(solicitudArmas.getRecord().getModifiedData().get("carma").toString()).getModifiedData().get("lmarca"); + lprovincias = ProvinceController.find(arma.getCountrycode()); + executeProvince(arma); + if (arma.getProvincecode() != null) { + lcantones = CantonController.find(arma.getCountrycode(), arma.getProvincecode()); + executeCanton(arma); + } + completaInfTipoArma(arma); + registroArmas.clearAll(); + if (arma.getCregistro() != null) { + registroArmas.addFilter("pk", arma.getCregistro().toString()); + registroArmas.query(); + List registroArmasList = registroArmas.getLrecord(); + registroArmas.setRecord(registroArmasList.get(0)); + registroArmas.getRecord().setIsnew(Boolean.FALSE); + } + + } + + public void loadShowAgencia() { + TarmAgenciaSucursal tarmAgenciaSucursal = (TarmAgenciaSucursal) solicitudAgenciaSucursal.getRecord().getModifiedData().get("agencia"); + lprovincias = ProvinceController.find(tarmAgenciaSucursal.getCountrycode()); + lcantones = CantonController.find(tarmAgenciaSucursal.getCountrycode(), tarmAgenciaSucursal.getProvincecode()); + lparroquias = ParroquiaController.find(tarmAgenciaSucursal.getCountrycode(), tarmAgenciaSucursal.getProvincecode(), tarmAgenciaSucursal.getCantoncode()); + lcities = CityController.find(tarmAgenciaSucursal.getCountrycode(), tarmAgenciaSucursal.getProvincecode(), tarmAgenciaSucursal.getCantoncode()); + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince(TarmArmas arma) { + if ((arma != null) && (arma.getCountrycode().compareTo("") != 0)) { + lcantones = CantonController.find(arma.getCountrycode(), arma.getProvincecode()); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton(TarmArmas arma) { + //TarmArmas arma = (((TarmArmas) solicitudArmas.getRecord().getModifiedData().get("arma"))); + if (arma.getCountrycode() != null && arma.getCountrycode().compareTo("") != 0) { + lparroquias = ParroquiaController.find(arma.getCountrycode(), + arma.getProvincecode(), + arma.getCantoncode()); + lcities = CityController.find(arma.getCountrycode(), arma.getProvincecode(), arma.getCantoncode()); + } + } + + private void limpiaDatos() { + this.detallepersona.clearAll(); + this.detalleusuario.clearAll(); + this.agenciaSucursal.clearAll(); + this.armas.clearAll(); + this.direccion.clearAll(); + this.documentoHabilitante.clearAll(); + this.natural.clearAll(); + this.registroArmas.clearAll(); + this.requisitos.clearAll(); + this.solicitudAgenciaSucursal.clearAll(); + this.solicitudArmas.clearAll(); + this.solicitudDocumento.clearAll(); + this.solicitudGuardias.clearAll(); + this.telefono.clearAll(); + existeSolicitud = Boolean.FALSE; + } + + /** + * Método que completa la informaci´n del arma una vez se + * presiona el botón crear + */ + private void completaInfTipoArma(TarmArmas arma) { + solicitudArmas.getRecord().getModifiedData().put("estado", arma.getEstado()); + solicitudArmas.getRecord().getModifiedData().put("marca", arma.getMarca()); +// record.setCountrycode("EC"); +// clase = ((TarmArmas)record.getModifiedData().get("arma")).getModifiedData().get("cclase") != null ? ((TarmArmas)record.getModifiedData().get("arma")).getModifiedData().get("cclase").toString() : null; +// calibre = record.getModifiedData().get("ccalibre") != null ? record.getModifiedData().get("ccalibre").toString() : null; +// longitud = record.getModifiedData().get("clongitud") != null ? record.getModifiedData().get("clongitud").toString() : null; +// tipoarma = record.getModifiedData().get("ctipoarmaexplosivo") != null ? record.getModifiedData().get("ctipoarmaexplosivo").toString() : null; + } + + /** + * Recupera en base al tipo de identificación la dirección de + * la oficina o de la casa + */ + private void obtenerDireccionesGenerales() { + TcustPersonAddress direccionPersona = null; + direccionPersona = direccion.findPrincipal(detallepersona.getRecord().getPk().getPersoncode().toString()); + + if (direccionPersona != null) { + direccion.getMfilelds().put("solcodpais", direccionPersona.getCountrycode()); + direccion.getMfilelds().put("solcodprovincia", direccionPersona.getProvincecode()); + direccion.setLprovinces(ProvinceController.find(direccionPersona.getCountrycode())); + direccion.getMfilelds().put("solcodcanton", direccionPersona.getCantoncode()); + direccion.setLcantones(CantonController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode())); + direccion.getMfilelds().put("solcodciudad", direccionPersona.getCitycode()); + direccion.setLcities(CityController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode(), direccionPersona.getCantoncode())); + direccion.getMfilelds().put("solcodparroquia", direccionPersona.getParroquiacode()); + direccion.setLparroquias(ParroquiaController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode(), direccionPersona.getCantoncode())); + direccion.getMfilelds().put("soldireccion", direccionPersona.getAddress()); + } + + TcustPersonAddress correo = (TcustPersonAddress) CollectionUtils.find(direccion.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getAddresstypecatalog"), PredicateUtils.equalPredicate("3"))); + if (correo != null) { + direccion.getMfilelds().put("solcorreopersona", correo.getAddress()); + } + } + + /** + * Retorna el telefono fijo y celular de la persona + */ + private void obtenerTelefonos() { + TcustPersonPhone telf = null; + telf = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getPhonetypecatalog"), PredicateUtils.equalPredicate("1"))); + if (telf != null) { + telefono.getMfilelds().put("soltelfijo", telf.getPhonenumber()); + } + telf = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getPhonetypecatalog"), PredicateUtils.equalPredicate("2"))); + if (telf != null) { + telefono.getMfilelds().put("soltelcelular", telf.getPhonenumber()); + } + } + + /** + * En base a la provincia y sus jurisdicciones se obtiene y se coloca el + * centro de control + */ + /*private void setearCodigoCentroControl(){ + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(direccion.getMfilelds().get("solcodprovincia") != null ? + direccion.getMfilelds().get("solcodprovincia").toString() : StringUtils.EMPTY); + if(centroControlJur != null){ + this.solicitud.getRecord().setCcentrocontrol(centroControlJur.getCcentrocontrol()); + } + }*/ + /** + * + */ + private void setearTramite() { + try { + if (solicitud.getRecord().getCtramite() == null) { + return; + } + TarmTramite tramite = TarmTramiteController.find(solicitud.getRecord().getCtramite().toString()); + solicitud.getRecord().setCtramite(tramite.getPk()); + TgeneCatalogDetail tipoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + TgeneCatalogDetail tipoAutorizacion = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail categoria = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + TgeneCatalogDetail actividad = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + this.getSolicitud().addField("tipoTramite", tipoTramite.getDescription()); + this.getSolicitud().addField("tipoAutorizacion", tipoAutorizacion.getDescription()); + this.getSolicitud().addField("categoria", categoria.getDescription()); + this.getSolicitud().addField("actividad", actividad.getDescription()); + this.ingresarRequisitos = Boolean.TRUE; + obtenerCentroControl(solicitud.getRecord()); + if (tramite.getCategoria().equals("14")) { + requiereNoSolAucpBln = Boolean.TRUE; + } else { + requiereNoSolAucpBln = Boolean.FALSE; + } + if (Constant.ifYes(tramite.getRegistroarmas())) { + this.seleccionarArmas = Boolean.TRUE; + this.cargaArmas(); + } else { + this.seleccionarArmas = Boolean.FALSE; + this.solicitudArmas.clearAll(); + } + if (Constant.ifYes(tramite.getRegistroguardia())) { + this.seleccionarGuardias = Boolean.TRUE; + this.cargaGuardias(); + } else { + this.seleccionarGuardias = Boolean.FALSE; + this.solicitudGuardias.clearAll(); + } + if (Constant.ifYes(tramite.getRegistroagenciasucursal())) { + this.seleccionarAgencias = Boolean.TRUE; + this.cargarAgencias(); + } else { + this.seleccionarAgencias = Boolean.FALSE; + this.solicitudAgenciaSucursal.clearAll(); + } + + if (Constant.ifYes(tramite.getDocumentohabilitante()) || tipoTramite.getPk().getCatalog().equals(ParametersController.find("CODIGO.TRAMITEREIMPRESION", "1").getTextvalue())) { + this.listarDocumentos = Boolean.TRUE; + this.cargarDocumentos(); + } else { + this.listarDocumentos = Boolean.FALSE; + this.solicitudDocumento.clearAll(); + } + + if (tramite != null) { + this.cargarRequisitos(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @param solicitud + * @throws Exception + * + */ + private void obtenerCentroControl(TarmSolicitud solicitud) throws Exception { + + this.centroControl = CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + this.setNombreInstitucion(CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + + } + + private void cargaArmas() throws Exception { + + solicitudArmas.clearAll(); + solicitudArmas.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudArmas.setCodigoSolicitud(solicitud.getRecord().getPk()); + solicitudArmas.setRecperpage(5000); + solicitudArmas.querydatabase(); + } + + private void cargaGuardias() throws Exception { + solicitudGuardias.clearAll(); + solicitudGuardias.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudGuardias.query(); + for (TarmSolicitudGuardias solicitudGuardia : solicitudGuardias.getLrecord()) { + solicitudGuardia.getModifiedData().put("guardia", GuardiasController.find(solicitudGuardia.getPk().getCguardia().toString(), solicitudGuardia.getPk().getCempresa().toString())); + } + } + + private void cargarAgencias() throws Exception { + solicitudAgenciaSucursal.clearAll(); + solicitudAgenciaSucursal.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudAgenciaSucursal.query(); + for (TarmSolicitudAgenciaSucursal solAgenciaSucursal : solicitudAgenciaSucursal.getLrecord()) { + solAgenciaSucursal.getModifiedData().put("agencia", AgenciaSucursalController.find(solAgenciaSucursal.getPk().getCagencia().toString())); + } + } + + private void cargarDocumentos() throws Exception { + solicitudDocumento.clearAll(); + solicitudDocumento.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudDocumento.query(); + + SolicitudController.findSolicitudxcodsolicitud(solicitud.getRecord().getPk()); + TarmTramite tramite = TarmTramiteController.find(String.valueOf(SolicitudController.findSolicitudxcodsolicitud(solicitud.getRecord().getPk()).getCtramite())); + TgeneCatalogDetail tipoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + TgeneCatalogDetail tipoAutorizacion = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail actividad = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + Boolean muestraArmas = listarArmas(tipoTramite, tipoAutorizacion, actividad); + + for (TarmSolicitudDocumento solDocumento : solicitudDocumento.getLrecord()) { + TarmDocumentoHabilitante documentoHabilitante = DocumentoHabilitanteController.find(solDocumento.getPk().getCdocumento().toString()); + solDocumento.getModifiedData().put("documento", documentoHabilitante); + solDocumento.getModifiedData().put("arma", muestraArmas ? ArmasController.findPorCodigo(documentoHabilitante.getCarma()) : null); + } + } + + /** + * Metodo para listar las armas segun la combinacion de tipo de tramite + * + * @param tipoTramite tipo del tramite + * @param tipoAutorizacion tipo de la autorizacion + * @param actividad tipo de la actividad + * @return valor booleano que indica si se muestran o no als armas + * @throws Exception + */ + private boolean listarArmas(TgeneCatalogDetail tipoTramite, TgeneCatalogDetail tipoAutorizacion, TgeneCatalogDetail actividad) throws Exception { + if (tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipoautorizacion"), MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())) { + return false; + } + if (tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipoautorizacion"), MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())) { + return true; + } + if (tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipoautorizacion"), MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog())) { + return false; + } + if (tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipoautorizacion"), MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog())) { + return true; + } + return true; + } + + private void cargarRequisitos() throws Exception { + requisitos.clearAll(); + requisitos.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + requisitos.query(); + for (TarmSolicitudRequisitos solicitudRequisitos : requisitos.getLrecord()) { + solicitudRequisitos.getModifiedData().put("requisito", RequisitoController.findxId(solicitudRequisitos.getPk().getCrequisito())); + } + } + + public List getLtipopersona() { + return ltipopersona; + } + + public void setLtipopersona(List ltipopersona) { + this.ltipopersona = ltipopersona; + } + + public List getLtipoidenti() { + return ltipoidenti; + } + + public void setLtipoidenti(List ltipoidenti) { + this.ltipoidenti = ltipoidenti; + } + + public List getLtipotramite() { + return ltipotramite; + } + + public void setLtipotramite(List ltipotramite) { + this.ltipotramite = ltipotramite; + } + + public List getLorigenadquisicion() { + return lorigenadquisicion; + } + + public void setLorigenadquisicion(List lorigenadquisicion) { + this.lorigenadquisicion = lorigenadquisicion; + } + + public boolean isExisteSolicitud() { + return existeSolicitud; + } + + public void setExisteSolicitud(boolean existeSolicitud) { + this.existeSolicitud = existeSolicitud; + } + + public boolean isIngresarRequisitos() { + return ingresarRequisitos; + } + + public void setIngresarRequisitos(boolean ingresarRequisitos) { + this.ingresarRequisitos = ingresarRequisitos; + } + + public boolean isSeleccionarArmas() { + return seleccionarArmas; + } + + public void setSeleccionarArmas(boolean seleccionarArmas) { + this.seleccionarArmas = seleccionarArmas; + } + + public boolean isSeleccionarGuardias() { + return seleccionarGuardias; + } + + public void setSeleccionarGuardias(boolean seleccionarGuardias) { + this.seleccionarGuardias = seleccionarGuardias; + } + + public boolean isSeleccionarAgencias() { + return seleccionarAgencias; + } + + public void setSeleccionarAgencias(boolean seleccionarAgencias) { + this.seleccionarAgencias = seleccionarAgencias; + } + + public boolean isListarDocumentos() { + return listarDocumentos; + } + + public void setListarDocumentos(boolean listarDocumentos) { + this.listarDocumentos = listarDocumentos; + } + + public UserDetailController getDetalleusuario() { + return detalleusuario; + } + + public void setDetalleusuario(UserDetailController detalleusuario) { + this.detalleusuario = detalleusuario; + } + + public SolicitudArmasController getSolicitud() { + return solicitud; + } + + public void setSolicitud(SolicitudArmasController solicitud) { + this.solicitud = solicitud; + } + + public PersonDetailController getDetallepersona() { + return detallepersona; + } + + public void setDetallepersona(PersonDetailController detallepersona) { + this.detallepersona = detallepersona; + } + + public PeopleController getNatural() { + return natural; + } + + public void setNatural(PeopleController natural) { + this.natural = natural; + } + + public PersonAddressController getDireccion() { + return direccion; + } + + public void setDireccion(PersonAddressController direccion) { + this.direccion = direccion; + } + + public PersonPhoneController getTelefono() { + return telefono; + } + + public void setTelefono(PersonPhoneController telefono) { + this.telefono = telefono; + } + + public SolicitudRequisitosController getRequisitos() { + return requisitos; + } + + public void setRequisitos(SolicitudRequisitosController requisitos) { + this.requisitos = requisitos; + } + + public SolicitudGuardiasController getSolicitudGuardias() { + return solicitudGuardias; + } + + public void setSolicitudGuardias(SolicitudGuardiasController solicitudGuardias) { + this.solicitudGuardias = solicitudGuardias; + } + + public ArmasController getArmas() { + return armas; + } + + public void setArmas(ArmasController armas) { + this.armas = armas; + } + + public RecepcionArmasController getSolicitudArmas() { + return solicitudArmas; + } + + public void setSolicitudArmas(RecepcionArmasController solicitudArmas) { + this.solicitudArmas = solicitudArmas; + } + + public RegistroArmController getRegistroArmas() { + return registroArmas; + } + + public void setRegistroArmas(RegistroArmController registroArmas) { + this.registroArmas = registroArmas; + } + + public AgenciaSucursalController getAgenciaSucursal() { + return agenciaSucursal; + } + + public void setAgenciaSucursal(AgenciaSucursalController agenciaSucursal) { + this.agenciaSucursal = agenciaSucursal; + } + + public SolicitudAgenciaSucursalController getSolicitudAgenciaSucursal() { + return solicitudAgenciaSucursal; + } + + public void setSolicitudAgenciaSucursal( + SolicitudAgenciaSucursalController solicitudAgenciaSucursal) { + this.solicitudAgenciaSucursal = solicitudAgenciaSucursal; + } + + public DocumentoHabilitanteController getDocumentoHabilitante() { + return documentoHabilitante; + } + + public void setDocumentoHabilitante( + DocumentoHabilitanteController documentoHabilitante) { + this.documentoHabilitante = documentoHabilitante; + } + + public TarmSolicitudDocumentoController getSolicitudDocumento() { + return solicitudDocumento; + } + + public void setSolicitudDocumento( + TarmSolicitudDocumentoController solicitudDocumento) { + this.solicitudDocumento = solicitudDocumento; + } + + public List getLprovincias() { + return lprovincias; + } + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public List getLparroquias() { + return lparroquias; + } + + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + public List getLcities() { + return lcities; + } + + public void setLcities(List lcities) { + this.lcities = lcities; + } + + @Override + public void completarTarea() { + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + System.out.println("1.....csolicitud :" + solicitud); + System.out.println("2.....csolicitud :" + solicitud.getRecord()); + System.out.println("3.....csolicitud :" + solicitud.getRecord().getPk()); + request.modifiedData().put("csolicitud", solicitud.getRecord().getPk()); + if (tid == null) { + tid = FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("taskId").toString(); + } + request.modifiedData().put("TID", tid); + if (bpmDataStatus.equals("D")) { + // Se aumento las observaciones para ser enviadas en el mail + Map datosmail = new HashMap(); + datosmail.put("razons", detallepersona.getRecord().getName()); + datosmail.put("sol", solicitud.getRecord().getNumerosolicitud()); + datosmail.put("observaciones", bpmDataComment); + //grado funcionario de la persona logeada + TsafeUserDetail userDetailObj = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personDetailObj = PersonDetailController.find(userDetailObj.getPk().getPersoncode().toString()); + datosmail.put("grado", personDetailObj.getMilitarygrade()); + datosmail.put("funcionario", personDetailObj.getName()); + // CCA + TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(solicitud.getRecord().getCcentrocontrol()); + datosmail.put("centrocontrol", centroControl.getModifiedData().get("desinstitucion")); + request.modifiedData().put("datosmail", datosmail); + } + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + + request.modifiedData().put("BPMObs", bpmDataComment); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + // CATEGORIA 14 PREVIA IMPORTACION + if (bpmDataStatus.equals("D")) { + TarmTramite tarmTramite = TarmTramiteController.find(this.solicitud.getRecord().getCtramite().toString()); + if (tarmTramite.getCategoria().equals("14")) { + desasociarCargaSolicitud(); + } + } + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void desasociarCargaSolicitud() { + try { + TarmCarga carga = CargaController.findByAUCP(solicitud.getRecord().getAucp()); + if (carga != null) { + carga.setCsolicitud(null); + cargaController.update(carga); + cargaController.save(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public List getLmarca() { + return lmarca; + } + + public void setLmarca(List lmarca) { + this.lmarca = lmarca; + } + + public CargaController getCargaController() { + return cargaController; + } + + public void setCargaController(CargaController cargaController) { + this.cargaController = cargaController; + } + + public Boolean getRequiereNoSolAucpBln() { + return requiereNoSolAucpBln; + } + + public void setRequiereNoSolAucpBln(Boolean requiereNoSolAucpBln) { + this.requiereNoSolAucpBln = requiereNoSolAucpBln; + } + + public String getNombreInstitucion() { + return nombreInstitucion; + } + + public String setNombreInstitucion(String nombreInstitucion) { + if (nombreInstitucion != null && !nombreInstitucion.isEmpty()) { + this.nombreInstitucion = nombreInstitucion; + } else { + this.nombreInstitucion = ""; + } + + return nombreInstitucion; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteConsultaSolicitudController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteConsultaSolicitudController.java new file mode 100644 index 0000000..43b2e9c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteConsultaSolicitudController.java @@ -0,0 +1,1054 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.PredicateUtils; +import org.apache.commons.collections.TransformerUtils; +import org.apache.commons.lang.StringUtils; +import org.primefaces.context.RequestContext; + +import com.fp.common.helper.Constant; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.funcionalidad.CargaController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.GuardiasController; +import com.fp.frontend.controller.armas.parametros.RequisitoController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PeopleController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.PersonPhoneController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.controller.pgeneral.safe.UserDetailController; +import com.fp.frontend.controller.pcustomer.FacturaController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.parmas.soli.TarmSolicitudGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitos; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import org.openide.util.Exceptions; + +@ManagedBean +@ViewScoped +public class ReporteConsultaSolicitudController extends + AbstractController { + + private static final long serialVersionUID = -4049698904561227471L; + + /** + * Lista de tipos de persona. + */ + private List ltipopersona; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de + * identificación + */ + private List ltipoidenti; + + /** + * Lista de tipos de trámite. + */ + private List ltipotramite; + + /** + * Lista de origen de adquisición + */ + private List lorigenadquisicion; + /** + * Bandera que indica si existe o no un registro para mostrar la solicitud + */ + private boolean existeSolicitud; + /** + + */ + /** + * Indica si se debe activar la pestana de ingresar requisitos + */ + /** + * Indica si se debe activar la pestana de ingresar requisitos + */ + + private boolean ingresarRequisitos; + + /** + * Indica si se debe activar la pestana de seleccionar armas + */ + private boolean seleccionarArmas; + + /** + * Indica si se debe activar la pestana seleccionar guardias + */ + private boolean seleccionarGuardias; + + /** + * Indica si se debe activar la pestana seleccionar agencias + */ + private boolean seleccionarAgencias; + + /** + * Indica si se debe activar la pestana listar guardias + */ + private boolean listarDocumentos; + /** + * Bandera que indica si la transacción inicio por flujo + */ + private boolean inicioPorFlujo; + private boolean depositoAprobado; + + private List lprovincias; + private List lcantones; + private List lparroquias; + private List lcities; + + private List lmarca; + /** + * Controlador de la solicitud + */ + /** + * Controlador que maneja el usuario + */ + @ManagedProperty(value = "#{userDetailController}") + private UserDetailController detalleusuario; + + /** + * Controlador que maneja las armas dentro de la solicitud + */ +// @ManagedProperty(value = "#{solicitudArmasBPMController}") +// private SolicitudArmasBPMController solicitud; + @ManagedProperty(value = "#{solicitudArmasController}") + private SolicitudArmasController solicitud; + + + @ManagedProperty(value = "#{parametersController}") + private ParametersController parametersController; + /** + * Controlador que maneja la persona + */ + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController detallepersona; + + /** + * Controlador que maneja los datos de personas naturales + */ + @ManagedProperty(value = "#{peopleController}") + private PeopleController natural; + + /** + * Controlador que maneja direcciones de la persona + */ + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController direccion; + + /** + * Controlador que maneja teléfonos de la persona + */ + @ManagedProperty(value = "#{personPhoneController}") + private PersonPhoneController telefono; + + /** + * Controlador que maneja requisitos dentro de la solicitud + */ + @ManagedProperty(value = "#{solicitudRequisitosController}") + private SolicitudRequisitosController requisitos; + + /** + * Controlador que maneja los guardias en la solicitud + */ + @ManagedProperty(value = "#{solicitudGuardiasController}") + private SolicitudGuardiasController solicitudGuardias; + + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{armasController}") + private ArmasController armas; + + /** + * Controlador que maneja las armas dentro de la solicitud + */ + @ManagedProperty(value = "#{recepcionArmasController}") + private RecepcionArmasController solicitudArmas; + + /** + * Controlador que maneja registro de armas + */ + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmas; + + /** + * Controlador que maneja agencias y sucursales + */ + @ManagedProperty(value = "#{agenciaSucursalController}") + private AgenciaSucursalController agenciaSucursal; + + /** + * Controlador que maneja las agencias y sucursales dentro de la solicitud + */ + @ManagedProperty(value = "#{solicitudAgenciaSucursalController}") + private SolicitudAgenciaSucursalController solicitudAgenciaSucursal; + + /** + * Controlador que maneja los documentos habilitantes + */ + @ManagedProperty(value = "#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitante; + + /** + * Controlador que maneja los documentos dentro de la solicitud + */ + @ManagedProperty(value = "#{tarmSolicitudDocumentoController}") + private TarmSolicitudDocumentoController solicitudDocumento; + + /** + * Controlador que maneja cargas para previa importacion + */ + @ManagedProperty(value = "#{cargaController}") + private CargaController cargaController; + + private Boolean requiereNoSolAucpBln; + + /** + * Referencia al Centro de control; + */ + private TarmCentroControl centroControl = new TarmCentroControl(); + + /** + * Nombre de la Institucion + */ + private String nombreInstitucion; + + /** + * + * @throws Exception + */ + public ReporteConsultaSolicitudController() throws Exception { + super(AbstractDataTransport.class); + } + + /** + * postCosntruct + * + * @throws Exception + */ + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + //parametersController = new ParametersController(); + requiereNoSolAucpBln = Boolean.FALSE; + depositoAprobado = Boolean.FALSE; + this.startQuery(); + if (tid != null) { + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("taskId", tid); + } + if (this.getMfilters().get("pk") != null && !this.getMfilters().get("pk").equals("")) { + this.solicitud.getMfilters().clear(); + this.solicitud.getMfilters().put("pk", this.getMfilters().get("pk")); + solicitud.query(); + this.inicioPorFlujo = Boolean.TRUE; + if (this.solicitud.getMfilters().get("numerosolicitud") == null || this.solicitud.getMfilters().get("numerosolicitud").equals("")) { + this.solicitud.getMfilters().put("numerosolicitud", solicitud.getRecord().getNumerosolicitud()); + this.querydatabase(); + + } + + } else { + this.inicioPorFlujo = Boolean.FALSE; + } + + } + + private void init() { + this.beanalias = "REPORTESOLICITUD"; + ltipopersona = CatalogDetailController.find("PERSONTYPE"); + ltipoidenti = CatalogDetailController.find("IDENTIFICATION"); + ltipotramite = CatalogDetailController.find("TIPOTRAMITE"); + lorigenadquisicion = CatalogDetailController.find("ORIGENADQUISICION"); + } + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + //Realizo las busquedas en base a los controladores + try { + limpiaDatos(); +// if(solicitud.getRecord() == null || solicitud.getRecord().getPk()==null){ + Utilidades.caracterEspecial(solicitud.getMfilters().get("numerosolicitud")); + solicitud.query(); +// } + if (solicitud.getRecord() != null && solicitud.getRecord().getPk() != null) { + if (this.solicitud.getMfilters().get("numerosolicitud") == null || this.solicitud.getMfilters().get("numerosolicitud").equals("")) { + this.solicitud.getMfilters().put("numerosolicitud", solicitud.getRecord().getNumerosolicitud()); + } + existeSolicitud = Boolean.TRUE; +// solicitud.setRecord(solicitud.getLrecord().get(0)); + detallepersona.getMfilters().clear(); + detallepersona.getMfilters().put("pk.personcode", solicitud.getRecord().getPersoncode().toString()); + detallepersona.addFilterDateto(); + detallepersona.query(); + + natural.getMfilters().clear(); + natural.addPersoncodeFilter(solicitud.getRecord().getPersoncode().toString()); + natural.addFilterDateto(); + natural.query(); + + direccion.getMfilters().clear(); + direccion.addPersoncodeFilter(solicitud.getRecord().getPersoncode().toString()); + direccion.addFilterDateto(); + direccion.query(); + + this.obtenerDireccionesGenerales(); + + telefono.getMfilters().clear(); + telefono.addPersoncodeFilter(solicitud.getRecord().getPersoncode().toString()); + telefono.addFilterDateto(); + telefono.query(); + this.obtenerTelefonos(); +// this.setearCodigoCentroControl(); + this.setearTramite(); + this.buscarEstadoTramiteAprobado(); + } else { + existeSolicitud = Boolean.FALSE; + } + } catch (Throwable e) { + // TODO Auto-generated catch block + MessageHelper.setMessageError(e); + } + } + public void crearXML(){ + try { + this.parametersController.generarFacturas(this.solicitud.getRecord().getPk()); + + } catch (Exception ex) { + Exceptions.printStackTrace(ex); + } + //FacturaController fc = new FacturaController(); + } + @SuppressWarnings("unchecked") + public void loadEdit() throws Exception { + //TarmArmas arma = ((TarmArmas) solicitudArmas.getRecord().getModifiedData().get("arma")); + TarmArmas arma = ArmasController.findxCodigo(solicitudArmas.getRecord().getModifiedData().get("carma").toString()); + if (arma.getCountrycode() == null) { + arma.setCountrycode("EC"); + } + this.lmarca = (List) ArmasController.findxCodigo(solicitudArmas.getRecord().getModifiedData().get("carma").toString()).getModifiedData().get("lmarca"); + lprovincias = ProvinceController.find(arma.getCountrycode()); + executeProvince(arma); + if (arma.getProvincecode() != null) { + lcantones = CantonController.find(arma.getCountrycode(), arma.getProvincecode()); + executeCanton(arma); + } + completaInfTipoArma(arma); + registroArmas.clearAll(); + if (arma.getCregistro() != null) { + registroArmas.addFilter("pk", arma.getCregistro().toString()); + registroArmas.query(); + List registroArmasList = registroArmas.getLrecord(); + registroArmas.setRecord(registroArmasList.get(0)); + registroArmas.getRecord().setIsnew(Boolean.FALSE); + } + + } + + public void loadShowAgencia() { + TarmAgenciaSucursal tarmAgenciaSucursal = (TarmAgenciaSucursal) solicitudAgenciaSucursal.getRecord().getModifiedData().get("agencia"); + lprovincias = ProvinceController.find(tarmAgenciaSucursal.getCountrycode()); + lcantones = CantonController.find(tarmAgenciaSucursal.getCountrycode(), tarmAgenciaSucursal.getProvincecode()); + lparroquias = ParroquiaController.find(tarmAgenciaSucursal.getCountrycode(), tarmAgenciaSucursal.getProvincecode(), tarmAgenciaSucursal.getCantoncode()); + lcities = CityController.find(tarmAgenciaSucursal.getCountrycode(), tarmAgenciaSucursal.getProvincecode(), tarmAgenciaSucursal.getCantoncode()); + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince(TarmArmas arma) { + if ((arma != null) && (arma.getCountrycode().compareTo("") != 0)) { + lcantones = CantonController.find(arma.getCountrycode(), arma.getProvincecode()); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton(TarmArmas arma) { + //TarmArmas arma = (((TarmArmas) solicitudArmas.getRecord().getModifiedData().get("arma"))); + if (arma.getCountrycode() != null && arma.getCountrycode().compareTo("") != 0) { + lparroquias = ParroquiaController.find(arma.getCountrycode(), + arma.getProvincecode(), + arma.getCantoncode()); + lcities = CityController.find(arma.getCountrycode(), arma.getProvincecode(), arma.getCantoncode()); + } + } + + private void limpiaDatos() { + this.detallepersona.clearAll(); + this.detalleusuario.clearAll(); + this.agenciaSucursal.clearAll(); + this.armas.clearAll(); + this.direccion.clearAll(); + this.documentoHabilitante.clearAll(); + this.natural.clearAll(); + this.registroArmas.clearAll(); + this.requisitos.clearAll(); + this.solicitudAgenciaSucursal.clearAll(); + this.solicitudArmas.clearAll(); + this.solicitudDocumento.clearAll(); + this.solicitudGuardias.clearAll(); + this.telefono.clearAll(); + } + + /** + * Método que completa la informaci´n del arma una vez se + * presiona el botón crear + */ + private void completaInfTipoArma(TarmArmas arma) { + solicitudArmas.getRecord().getModifiedData().put("estado", arma.getEstado()); + solicitudArmas.getRecord().getModifiedData().put("marca", arma.getMarca()); +// record.setCountrycode("EC"); +// clase = ((TarmArmas)record.getModifiedData().get("arma")).getModifiedData().get("cclase") != null ? ((TarmArmas)record.getModifiedData().get("arma")).getModifiedData().get("cclase").toString() : null; +// calibre = record.getModifiedData().get("ccalibre") != null ? record.getModifiedData().get("ccalibre").toString() : null; +// longitud = record.getModifiedData().get("clongitud") != null ? record.getModifiedData().get("clongitud").toString() : null; +// tipoarma = record.getModifiedData().get("ctipoarmaexplosivo") != null ? record.getModifiedData().get("ctipoarmaexplosivo").toString() : null; + } + + /** + * Recupera en base al tipo de identificación la dirección de + * la oficina o de la casa + */ + private void obtenerDireccionesGenerales() { + TcustPersonAddress direccionPersona = null; + direccionPersona = direccion.findPrincipal(detallepersona.getRecord().getPk().getPersoncode().toString()); + + if (direccionPersona != null) { + direccion.getMfilelds().put("solcodpais", direccionPersona.getCountrycode()); + direccion.getMfilelds().put("solcodprovincia", direccionPersona.getProvincecode()); + direccion.setLprovinces(ProvinceController.find(direccionPersona.getCountrycode())); + direccion.getMfilelds().put("solcodcanton", direccionPersona.getCantoncode()); + direccion.setLcantones(CantonController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode())); + direccion.getMfilelds().put("solcodciudad", direccionPersona.getCitycode()); + direccion.setLcities(CityController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode(), direccionPersona.getCantoncode())); + direccion.getMfilelds().put("solcodparroquia", direccionPersona.getParroquiacode()); + direccion.setLparroquias(ParroquiaController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode(), direccionPersona.getCantoncode())); + direccion.getMfilelds().put("soldireccion", direccionPersona.getAddress()); + } + + TcustPersonAddress correo = (TcustPersonAddress) CollectionUtils.find(direccion.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getAddresstypecatalog"), PredicateUtils.equalPredicate("3"))); + if (correo != null) { + direccion.getMfilelds().put("solcorreopersona", correo.getAddress()); + } + } + + /** + * Retorna el telefono fijo y celular de la persona + */ + /** ============================= buscar EstadoTramite =============================*/ + private void buscarEstadoTramiteAprobado(){ + Request request = callerhelper.getRequest(); + TarmSolicitudTramite tst = TarmSolicitudTramiteController.findPorCSolicitud(this.solicitud.getRecord().getPk()); + if(tst !=null){ + if(tst.getEstadotramite() != null && tst.getEstadotramite().equals("APBDEP") && !request.getProfile().equals("CLIENTE")){ + this.depositoAprobado = true; + }else{ + this.depositoAprobado = false; + } + } + } + private void obtenerTelefonos() { + TcustPersonPhone telf = null; + telf = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getPhonetypecatalog"), PredicateUtils.equalPredicate("1"))); + if (telf != null) { + telefono.getMfilelds().put("soltelfijo", telf.getPhonenumber()); + } + telf = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getPhonetypecatalog"), PredicateUtils.equalPredicate("2"))); + if (telf != null) { + telefono.getMfilelds().put("soltelcelular", telf.getPhonenumber()); + } + } + + /** + * En base a la provincia y sus jurisdicciones se obtiene y se coloca el + * centro de control + */ + private void setearCodigoCentroControl() { + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(direccion.getMfilelds().get("solcodprovincia") != null + ? direccion.getMfilelds().get("solcodprovincia").toString() : StringUtils.EMPTY); + if (centroControlJur != null) { + this.solicitud.getRecord().setCcentrocontrol(centroControlJur.getCcentrocontrol()); + } + } + + /** + * + */ + private void setearTramite() { + try { + if (solicitud.getRecord().getCtramite() == null) { + return; + } + TarmTramite tramite = TarmTramiteController.find(solicitud.getRecord().getCtramite().toString()); + solicitud.getRecord().setCtramite(tramite.getPk()); + TgeneCatalogDetail tipoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + TgeneCatalogDetail tipoAutorizacion = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail categoria = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + TgeneCatalogDetail actividad = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + this.getSolicitud().addField("tipoTramite", tipoTramite.getDescription()); + this.getSolicitud().addField("tipoAutorizacion", tipoAutorizacion.getDescription()); + this.getSolicitud().addField("categoria", categoria.getDescription()); + this.getSolicitud().addField("actividad", actividad.getDescription()); + this.ingresarRequisitos = Boolean.TRUE; + obtenerCentroControl(solicitud.getRecord()); + if (tramite.getCategoria().equals("14")) { + requiereNoSolAucpBln = Boolean.TRUE; + } else { + requiereNoSolAucpBln = Boolean.FALSE; + } + if (Constant.ifYes(tramite.getRegistroarmas())) { + this.seleccionarArmas = Boolean.TRUE; + this.cargaArmas(); + } else { + this.seleccionarArmas = Boolean.FALSE; + this.solicitudArmas.clearAll(); + } + if (Constant.ifYes(tramite.getRegistroguardia())) { + this.seleccionarGuardias = Boolean.TRUE; + this.cargaGuardias(); + } else { + this.seleccionarGuardias = Boolean.FALSE; + this.solicitudGuardias.clearAll(); + } + if (Constant.ifYes(tramite.getRegistroagenciasucursal())) { + this.seleccionarAgencias = Boolean.TRUE; + this.cargarAgencias(); + } else { + this.seleccionarAgencias = Boolean.FALSE; + this.solicitudAgenciaSucursal.clearAll(); + } + + if (Constant.ifYes(tramite.getDocumentohabilitante()) || tipoTramite.getPk().getCatalog().equals(ParametersController.find("CODIGO.TRAMITEREIMPRESION", "1").getTextvalue())) { + this.listarDocumentos = Boolean.TRUE; + this.cargarDocumentos(); + } else { + this.listarDocumentos = Boolean.FALSE; + this.solicitudDocumento.clearAll(); + } + + if (tramite != null) { + this.cargarRequisitos(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @param solicitud + * @throws Exception + * + */ + private void obtenerCentroControl(TarmSolicitud solicitud) throws Exception { + + this.centroControl = CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + this.setNombreInstitucion(CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + + } + + private void cargaArmas() throws Exception { + + solicitudArmas.clearAll(); + solicitudArmas.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudArmas.setCodigoSolicitud(solicitud.getRecord().getPk()); + solicitudArmas.setRecperpage(5000); + solicitudArmas.querydatabase(); + } + + private void cargaGuardias() throws Exception { + solicitudGuardias.clearAll(); + solicitudGuardias.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudGuardias.query(); + for (TarmSolicitudGuardias solicitudGuardia : solicitudGuardias.getLrecord()) { + solicitudGuardia.getModifiedData().put("guardia", GuardiasController.find(solicitudGuardia.getPk().getCguardia().toString(), solicitudGuardia.getPk().getCempresa().toString())); + } + } + + private void cargarAgencias() throws Exception { + solicitudAgenciaSucursal.clearAll(); + solicitudAgenciaSucursal.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudAgenciaSucursal.query(); + for (TarmSolicitudAgenciaSucursal solAgenciaSucursal : solicitudAgenciaSucursal.getLrecord()) { + solAgenciaSucursal.getModifiedData().put("agencia", AgenciaSucursalController.find(solAgenciaSucursal.getPk().getCagencia().toString())); + } + } + + private void cargarDocumentos() throws Exception { + solicitudDocumento.clearAll(); + solicitudDocumento.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + solicitudDocumento.query(); + + SolicitudController.findSolicitudxcodsolicitud(solicitud.getRecord().getPk()); + TarmTramite tramite = TarmTramiteController.find(String.valueOf(SolicitudController.findSolicitudxcodsolicitud(solicitud.getRecord().getPk()).getCtramite())); + TgeneCatalogDetail tipoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + TgeneCatalogDetail tipoAutorizacion = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail actividad = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + Boolean muestraArmas = listarArmas(tipoTramite, tipoAutorizacion, actividad); + + for (TarmSolicitudDocumento solDocumento : solicitudDocumento.getLrecord()) { + TarmDocumentoHabilitante documentoHabilitante = DocumentoHabilitanteController.find(solDocumento.getPk().getCdocumento().toString()); + solDocumento.getModifiedData().put("documento", documentoHabilitante); + solDocumento.getModifiedData().put("arma", muestraArmas ? ArmasController.findPorCodigo(documentoHabilitante.getCarma()) : null); + } + } + + /** + * Metodo para listar las armas segun la combinacion de tipo de tramite + * + * @param tipoTramite tipo del tramite + * @param tipoAutorizacion tipo de la autorizacion + * @param actividad tipo de la actividad + * @return valor booleano que indica si se muestran o no als armas + * @throws Exception + */ + private boolean listarArmas(TgeneCatalogDetail tipoTramite, TgeneCatalogDetail tipoAutorizacion, TgeneCatalogDetail actividad) throws Exception { + if (tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipoautorizacion"), MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())) { + return false; + } + if (tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipoautorizacion"), MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())) { + return true; + } + if (tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipoautorizacion"), MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog())) { + return false; + } + if (tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipoautorizacion"), MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog())) { + return true; + } + return true; + } + + private void cargarRequisitos() throws Exception { + requisitos.clearAll(); + requisitos.addFilter("pk.csolicitud", solicitud.getRecord().getPk()); + requisitos.query(); + for (TarmSolicitudRequisitos solicitudRequisitos : requisitos.getLrecord()) { + solicitudRequisitos.getModifiedData().put("requisito", RequisitoController.findxId(solicitudRequisitos.getPk().getCrequisito())); + } + } + + public List getLtipopersona() { + return ltipopersona; + } + + public void setLtipopersona(List ltipopersona) { + this.ltipopersona = ltipopersona; + } + + public List getLtipoidenti() { + return ltipoidenti; + } + + public void setLtipoidenti(List ltipoidenti) { + this.ltipoidenti = ltipoidenti; + } + + public List getLtipotramite() { + return ltipotramite; + } + + public void setLtipotramite(List ltipotramite) { + this.ltipotramite = ltipotramite; + } + + public List getLorigenadquisicion() { + return lorigenadquisicion; + } + + public void setLorigenadquisicion(List lorigenadquisicion) { + this.lorigenadquisicion = lorigenadquisicion; + } + + public boolean isExisteSolicitud() { + return existeSolicitud; + } + + public void setExisteSolicitud(boolean existeSolicitud) { + this.existeSolicitud = existeSolicitud; + } + + + + public boolean isIngresarRequisitos() { + return ingresarRequisitos; + } + + public void setIngresarRequisitos(boolean ingresarRequisitos) { + this.ingresarRequisitos = ingresarRequisitos; + } + + public boolean isSeleccionarArmas() { + return seleccionarArmas; + } + + public void setSeleccionarArmas(boolean seleccionarArmas) { + this.seleccionarArmas = seleccionarArmas; + } + + public boolean isSeleccionarGuardias() { + return seleccionarGuardias; + } + + public void setSeleccionarGuardias(boolean seleccionarGuardias) { + this.seleccionarGuardias = seleccionarGuardias; + } + + public boolean isSeleccionarAgencias() { + return seleccionarAgencias; + } + + public void setSeleccionarAgencias(boolean seleccionarAgencias) { + this.seleccionarAgencias = seleccionarAgencias; + } + + public boolean isListarDocumentos() { + return listarDocumentos; + } + + public void setListarDocumentos(boolean listarDocumentos) { + this.listarDocumentos = listarDocumentos; + } + + public UserDetailController getDetalleusuario() { + return detalleusuario; + } + + public void setDetalleusuario(UserDetailController detalleusuario) { + this.detalleusuario = detalleusuario; + } + + public SolicitudArmasController getSolicitud() { + return solicitud; + } + + public void setSolicitud(SolicitudArmasController solicitud) { + this.solicitud = solicitud; + } + + public PersonDetailController getDetallepersona() { + return detallepersona; + } + + public void setDetallepersona(PersonDetailController detallepersona) { + this.detallepersona = detallepersona; + } + + public PeopleController getNatural() { + return natural; + } + + public void setNatural(PeopleController natural) { + this.natural = natural; + } + + public PersonAddressController getDireccion() { + return direccion; + } + + public void setDireccion(PersonAddressController direccion) { + this.direccion = direccion; + } + + public PersonPhoneController getTelefono() { + return telefono; + } + + public void setTelefono(PersonPhoneController telefono) { + this.telefono = telefono; + } + + public SolicitudRequisitosController getRequisitos() { + return requisitos; + } + + public void setRequisitos(SolicitudRequisitosController requisitos) { + this.requisitos = requisitos; + } + + public SolicitudGuardiasController getSolicitudGuardias() { + return solicitudGuardias; + } + + public void setSolicitudGuardias(SolicitudGuardiasController solicitudGuardias) { + this.solicitudGuardias = solicitudGuardias; + } + + public ParametersController getParametersController() { + return parametersController; + } + + public void setParametersController(ParametersController parametersController) { + this.parametersController = parametersController; + } + + + public ArmasController getArmas() { + return armas; + } + + public void setArmas(ArmasController armas) { + this.armas = armas; + } + + public RecepcionArmasController getSolicitudArmas() { + return solicitudArmas; + } + + public void setSolicitudArmas(RecepcionArmasController solicitudArmas) { + this.solicitudArmas = solicitudArmas; + } + + public RegistroArmController getRegistroArmas() { + return registroArmas; + } + + public void setRegistroArmas(RegistroArmController registroArmas) { + this.registroArmas = registroArmas; + } + + public AgenciaSucursalController getAgenciaSucursal() { + return agenciaSucursal; + } + + public void setAgenciaSucursal(AgenciaSucursalController agenciaSucursal) { + this.agenciaSucursal = agenciaSucursal; + } + + public SolicitudAgenciaSucursalController getSolicitudAgenciaSucursal() { + return solicitudAgenciaSucursal; + } + + public void setSolicitudAgenciaSucursal( + SolicitudAgenciaSucursalController solicitudAgenciaSucursal) { + this.solicitudAgenciaSucursal = solicitudAgenciaSucursal; + } + + public DocumentoHabilitanteController getDocumentoHabilitante() { + return documentoHabilitante; + } + + public void setDocumentoHabilitante( + DocumentoHabilitanteController documentoHabilitante) { + this.documentoHabilitante = documentoHabilitante; + } + + public TarmSolicitudDocumentoController getSolicitudDocumento() { + return solicitudDocumento; + } + + public void setSolicitudDocumento( + TarmSolicitudDocumentoController solicitudDocumento) { + this.solicitudDocumento = solicitudDocumento; + } + + public List getLprovincias() { + return lprovincias; + } + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + public List getLcantones() { + return lcantones; + } + + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + public List getLparroquias() { + return lparroquias; + } + + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + public List getLcities() { + return lcities; + } + + public void setLcities(List lcities) { + this.lcities = lcities; + } + + @Override + public void completarTarea() { + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + System.out.println("1.....csolicitud :" + solicitud); + System.out.println("2.....csolicitud :" + solicitud.getRecord()); + System.out.println("3.....csolicitud :" + solicitud.getRecord().getPk()); + request.modifiedData().put("csolicitud", solicitud.getRecord().getPk()); + if (tid == null) { + tid = FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("taskId").toString(); + } + request.modifiedData().put("TID", tid); + if (bpmDataStatus.equals("D")) { + // Se aumento las observaciones para ser enviadas en el mail + Map datosmail = new HashMap(); + datosmail.put("razons", detallepersona.getRecord().getName()); + datosmail.put("sol", solicitud.getRecord().getNumerosolicitud()); + datosmail.put("observaciones", bpmDataComment); + //grado funcionario de la persona logeada + TsafeUserDetail userDetailObj = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personDetailObj = PersonDetailController.find(userDetailObj.getPk().getPersoncode().toString()); + datosmail.put("grado", personDetailObj.getMilitarygrade()); + datosmail.put("funcionario", personDetailObj.getName()); + // CCA + TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(solicitud.getRecord().getCcentrocontrol()); + datosmail.put("centrocontrol", centroControl.getModifiedData().get("desinstitucion")); + request.modifiedData().put("datosmail", datosmail); + } + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + + request.modifiedData().put("BPMObs", bpmDataComment); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + // CATEGORIA 14 PREVIA IMPORTACION + if (bpmDataStatus.equals("D")) { + TarmTramite tarmTramite = TarmTramiteController.find(this.solicitud.getRecord().getCtramite().toString()); + if (tarmTramite.getCategoria().equals("14")) { + desasociarCargaSolicitud(); + } + } + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void desasociarCargaSolicitud() { + try { + TarmCarga carga = CargaController.findByAUCP(solicitud.getRecord().getAucp()); + if (carga != null) { + carga.setCsolicitud(null); + cargaController.update(carga); + cargaController.save(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public boolean isInicioPorFlujo() { + return inicioPorFlujo; + } + + public void setInicioPorFlujo(boolean inicioPorFlujo) { + this.inicioPorFlujo = inicioPorFlujo; + } + + public void setDepositoAprobado(boolean depositoAprobado) { + this.depositoAprobado = depositoAprobado; + } + + public boolean isDepositoAprobado() { + return depositoAprobado; + } + + public List getLmarca() { + return lmarca; + } + + public void setLmarca(List lmarca) { + this.lmarca = lmarca; + } + + public CargaController getCargaController() { + return cargaController; + } + + public void setCargaController(CargaController cargaController) { + this.cargaController = cargaController; + } + + public Boolean getRequiereNoSolAucpBln() { + return requiereNoSolAucpBln; + } + + public void setRequiereNoSolAucpBln(Boolean requiereNoSolAucpBln) { + this.requiereNoSolAucpBln = requiereNoSolAucpBln; + } + + public String getNombreInstitucion() { + return nombreInstitucion; + } + + public String setNombreInstitucion(String nombreInstitucion) { + if (nombreInstitucion != null && !nombreInstitucion.isEmpty()) { + this.nombreInstitucion = nombreInstitucion; + } else { + this.nombreInstitucion = ""; + } + + return nombreInstitucion; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteControlInventarioController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteControlInventarioController.java new file mode 100644 index 0000000..4f7e0bd --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteControlInventarioController.java @@ -0,0 +1,373 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de reporte de liquidacion economica + * + * @author Christian Pazmino. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReporteControlInventarioController extends AbstractController { + + /** + * Fecha a partir de la cual se sacan datos para el reporte + * + */ + private Date fechaFin; + /** + * Formato de reporte que se va a generar + * + */ + private String format = "xls"; + /** + * Usuario actual logueado en el sistema + * + */ + private TsafeUserDetail userDetail; + /** + * Nombre del reporte generado en el Alfresco + * + */ + private String nombreReporte; + /** + * Id del centro de control seleccionado por el usuario + * + */ + private String idCentroControl; + + /** + * Ruta base del reporte generado en el Alfresco + * + */ + private String xPathLocation; + + private String institucionCentroControl = ""; + private TarmCentroControl centroControl = new TarmCentroControl(); + + /** + * Clase controladora de reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + /** + * Clase controladora de funcionalidad del Alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + public ReporteControlInventarioController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + recperpage = 10000; // Cambiar al # reg a mirar. + lrecord = new ArrayList(); + beanalias = "RPRTECONTROLINVENTARIO"; + obtenerCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + +// /** +// * Crea una instancia y marca el registro como nuevo. +// * +// * @throws Exception +// */ +// @Override +// public void create() throws Exception { +// super.create(); +// } + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if (Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")) { + valorColocar = Boolean.TRUE; + } + for (AbstractDataTransport decomisoArmaObj : lrecord) { + decomisoArmaObj.getModifiedData().put("isSelect", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + + } + + /** + * Metodo para reconsultar en base a una nueva fecha de corte seleccionada + */ + public void cambioFechaDeCorte(SelectEvent event) { + querydatabase(); + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport() { + Calendar fechaActualCldr = Calendar.getInstance(); + Calendar fechaInicioCldr = Calendar.getInstance(); + Calendar fechaFinCldr = Calendar.getInstance(); +// fechaInicioCldr.setTime(fechaInicio); + fechaFinCldr.setTime(fechaFin); + + if (fechaActualCldr.compareTo(fechaFinCldr) >= 0) { + String filename = "controlInventario"; + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + TcustPersonDetail personaLogObj; + if (userDetail.getPk().getPersoncode() != null) { + personaLogObj = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()); + nombreUsuario = personaLogObj.getName(); + } else { + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario); + parameters.put("fechaInicio", armarFormatoFechaSinHora(fechaInicioCldr)); +// fechaFinCldr.add(Calendar.DAY_OF_MONTH, 1); + parameters.put("fechaFin", armarFormatoFechaSinHora(fechaFinCldr)); + parameters.put("fechaReporte", armarFormatoFechaConHora(fechaActualCldr)); + + String path; + + path = "armas/reports/controlInventario"; + parameters.put("idCentroControl", centroControl.getPk()); + // Datos del CENTRO DE CONTROL + parameters.put("nombreCentroControl", institucionCentroControl); + // Datos del jefe del centro + if (centroControl.getPersoncode() != null) { + TcustPersonDetail jefeCentroObj = PersonDetailController.find(centroControl.getPersoncode().toString()); + String gradoJefeCentro = jefeCentroObj.getMilitarygrade() == null ? "" : jefeCentroObj.getMilitarygrade() + " - "; + parameters.put("nombreJefCentro", gradoJefeCentro + jefeCentroObj.getName() == null ? "" : jefeCentroObj.getName()); + parameters.put("personCodeJefCentro", jefeCentroObj.getPk().getPersoncode() == null ? "1001" : jefeCentroObj.getPk().getPersoncode()); + } + xPathLocation = getRutaDocumentoRepBase() + "/cm:" + Utilidades.obtieneNombreLimpio(institucionCentroControl); + nombreReporte = "controlInventario.xls"; + //this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + InputStream file = this.reportController.jaspertoInputstreamXls(path, parameters, format, filename, this.getLoginController()); + if (!alfrescoController.uploadFile(file, nombreReporte, xPathLocation)) { + xPathLocation = null; + } + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_coninv_fechaMayorAFechaActual")); + } + } + + /** + * Retorna la ruta de documento base en donde se almacenará el + * reporte + * + * @return + */ + public String getRutaDocumentoRepBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta = new StringBuilder("cm:Inventario"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); +// nombreReporte = "controlInventario " + calendar.get(Calendar.DAY_OF_MONTH) + "-" + calendar.get(Calendar.MONTH) + " " +// + calendar.get(Calendar.HOUR_OF_DAY) + "H" + calendar.get(Calendar.MINUTE) + "M.xlsx"; + return ruta.toString(); + } + + /** + * Metodo que se debe ejecutar cuando es una transaccion de tipo verificar + * armas + * + * @throws Exception + */ + private void obtenerCentroControl() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + + } + +// parameters.put("fechaCorte", fechaCorteSB.toString()); +// parameters.put("codArmasDecomisadasLst", actualizarArmasSeleccionadas()); + public StringBuilder armarFormatoFechaSinHora(Calendar fechaCldr) { + StringBuilder fechaStr = new StringBuilder(); + fechaStr = fechaStr.append((fechaCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCldr.get(Calendar.DAY_OF_MONTH))); + fechaStr = fechaStr.append("-").append((fechaCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaCldr.get(Calendar.MONTH) + 1) : (fechaCldr.get(Calendar.MONTH) + 1)); + fechaStr = fechaStr.append("-").append(fechaCldr.get(Calendar.YEAR)); + return fechaStr; + } + + public StringBuilder armarFormatoFechaConHora(Calendar fechaCldr) { + StringBuilder fechaStr = new StringBuilder(); + fechaStr = fechaStr.append((fechaCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCldr.get(Calendar.DAY_OF_MONTH))); + fechaStr = fechaStr.append("-").append((fechaCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaCldr.get(Calendar.MONTH) + 1) : (fechaCldr.get(Calendar.MONTH) + 1)); + fechaStr = fechaStr.append("-").append(fechaCldr.get(Calendar.YEAR)); + fechaStr = fechaStr.append(" ").append(fechaCldr.get(Calendar.HOUR_OF_DAY)); + fechaStr = fechaStr.append(":").append((fechaCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaCldr.get(Calendar.MINUTE)) : (fechaCldr.get(Calendar.MINUTE))); + return fechaStr; + } + + /** + * Método para el inicio de flujo. Guardar el reporte creado para su + * posterior aprobacion en otras instancias del flujo + */ + @Override + public void save() { + + } + + public Date getFechaFin() { + return fechaFin; + } + + public void setFechaFin(Date fechaFin) { + this.fechaFin = fechaFin; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public String getNombreReporte() { + return nombreReporte; + } + + public void setNombreReporte(String nombreReporte) { + this.nombreReporte = nombreReporte; + } + + public String getIdCentroControl() { + return idCentroControl; + } + + public void setIdCentroControl(String idCentroControl) { + this.idCentroControl = idCentroControl; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public String getxPathLocation() { + return xPathLocation; + } + + public void setxPathLocation(String xPathLocation) { + this.xPathLocation = xPathLocation; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteDestruccionArmasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteDestruccionArmasController.java new file mode 100644 index 0000000..746d801 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteDestruccionArmasController.java @@ -0,0 +1,1293 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.apache.commons.lang.StringUtils; +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReporteDestruccionArmasController extends AbstractController { + + private List lTipoReporte = new ArrayList(); + private TcustPersonDetail usuario; + // Filtros de busqueda + private Date fechaCorte = new Date(); + private String numeroSerie; + /** + * atributo para habilitar o desabilitar al boton genera acta + */ + private Boolean btnGenerarActa; + /** + * atributo para habilitar o desabilitar al boton de seleccion por registro + */ + private Boolean btnTabGrid; + /** + * numero de custodia del arma + */ + private String numeroDecomiso; + private String institucionCentroControl = ""; + private String institucionUnidadControl = ""; + //Control destino + private String centroControlDestino; + + private String unidadDestino; + + private Boolean isCentroDpto = Boolean.FALSE; + + /** + * Codigo del centro de control + */ + private String codigoOrganismoControlDestino; + /** + * codigo de la unidad de control + */ + private String codigoUnidadControlDestino; + + private String centroControlActual; + private String unidadActual; + + private List centroControlsDestinos; + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List unidadesDestinos; + + private String format; + private String tipoReporte; + private TsafeUserDetail userDetail; + private Integer diasParaDestruirArma; + private TarmCentroControl centroControl = new TarmCentroControl(); + + private String numeroTransaccionEnvio = ""; + private String numeroTransaccionRecepcion = ""; + private String numeroTransaccion; + private String numeroTransaccionEnvioConvertido = ""; + private String filtroData = ""; + private boolean transaccionVerificarArmas; + private boolean transaccionAprobarActaEntrega; + private String xpathflujo; + private TcustPersonDetail responsableCentroControl = null; + List listTarmDecomisoArma = new ArrayList<>(); + private String envioFlujo;//recibe del flujo el numero de transaccion = "ENV-000000310" + private String pathflujo;//recibe del flujo la ruta del archivo + private String cprovincia; + private Boolean btnFlujo; + private Boolean btnGrabar; + /** + * codigo del decomiso del catalogo ESTADOARMA + */ + private String codigoDecomiso; + /** + * codigo de la incautacion del catalogo ESTADOARMA + */ + private String codigoIncautacion; + /** + * codigo de la entrega voluntaria del catalogo ESTADOARMA + */ + private String codigoEntVol; + /** + * codigo del abandono del catalogo ESTADOARMA + */ + private String codigoAbandono; + /** + * codigo del reclamo del catalogo ESTADOARMA + */ + private String codigoReclamo; + + /** + * estado operacion del decomiso del catalogo ESTADOARMA + */ + private String estadoOperacion; + + /** + * Deshabilita la pantalla después de grabar la solicitud + */ + private boolean btnSelTodos; + /** + * Deshabilita la pantalla para filtros después de grabar la + * solicitud + */ + private boolean btnFiltros; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + @ManagedProperty(value = "#{transaccionArmaBodegaController}") + private TransaccionArmaBodegaController transaccionArmaBodegaController; + + @ManagedProperty(value = "#{bodegaController}") + private BodegaController bodegaController; + + @ManagedProperty(value = "#{decomisoArmaTransaccionController}") + private DecomisoArmaTransaccionController decomisoArmaTransaccionController; + + public ReporteDestruccionArmasController() throws Exception { + super(TarmDecomisoArma.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + startQuery(); + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + xpathflujo = super.getMfilters().get("xpath");//"cm:Decomiso/cm:A-2014/cm:M-10/cm:ENV-000000319/cm:ENV-000000319.pdf";// + String numerotransaccion = super.getMfilters().get("numerotransaccion"); + TarmDecomisoArmaTransaccion decomisoArmaTransaccion = decomisoArmaTransaccionController.find(numerotransaccion); + envioFlujo = decomisoArmaTransaccion.getNumerotransaccion(); + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + format = "pdf"; + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + diasParaDestruirArma = ParametersController.find("DIASENBODEGA.DESTRUIRARMAS", "1").getNumbervalue().intValue(); + lTipoReporte = CatalogDetailController.find("TIPOREPORTE"); + this.unidadesDestinos = new ArrayList<>(); + this.unidadDestino = ""; + this.centroControlsDestinos = CatalogDetailController.find("INSTITUCION"); + //Tenia antes 10000 + recperpage = 30000; + lrecord = new ArrayList<>(); + beanalias = "RPRTEDESTRUCCIONDEARMAS"; + obtenerCentroControl(); + + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + centroControlActual = tsafeUserDetail.getModifiedData().get("centrocontrol").toString(); + unidadActual = tsafeUserDetail.getModifiedData().get("unidad").toString(); + + //codigoOrganismoControl = tsafeUserDetail.getCcentrocontrol(); + //codigoUnidadControl = tsafeUserDetail.getCcentrocontrol(); + //querydatabase(); + this.responsableCentroControl = new TcustPersonDetail(); + this.obtenerResponsableCentroControl(); + this.numeroTransaccion = null; + this.btnFlujo = Boolean.FALSE; + //boton desabilitado + this.btnGrabar = Boolean.TRUE; + this.btnGenerarActa = Boolean.TRUE; + this.btnTabGrid = Boolean.TRUE; + this.btnSelTodos = Boolean.TRUE; + this.btnFiltros = Boolean.FALSE; + this.estadoOperacion = "RECEPCION"; + this.codigoDecomiso = codigos("CODIGO.DECOMISADA");//DECOMISO + this.codigoIncautacion = codigos("CODIGO.INCAUTADA");//INCAUTACION + this.codigoEntVol = codigos("CODIGO.ENTV");//ENTREGA VOLUNTARIA + this.codigoAbandono = codigos("CODIGO.ABAN");//ABANDONO + this.codigoReclamo = codigos("CODIGO.RECL");//RECLAMO + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para obtener los codigos + */ + private String codigos(String parametro) { + TgeneParameters tgeneParameters = ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + /** + * Metodo que se debe ejecutar cuando es una transaccion de tipo verificar + * armas + * + * @throws Exception + */ + private void obtenerCentroControl() throws Exception { + + if (this.getLoginController() != null && 53 == this.getLoginController().getRequest().getTransactionCode() && "30".equals(getLoginController().getRequest().getTransactionModule())) { + transaccionVerificarArmas = true; + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + centroControl = CentroControlArmasController.findPorCodigo(tsafeUserDetail.getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getInstitucion(), centroControl.getInstituciontipo()).getDescription(); + institucionUnidadControl = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + cprovincia = centroControl.getProvincecode(); + } + /** + * Obtiene el responsable del Centro de Control + */ + + if (this.getLoginController() != null && 58 == this.getLoginController().getRequest().getTransactionCode() && "30".equals(getLoginController().getRequest().getTransactionModule())) { + + transaccionAprobarActaEntrega = true; + numeroTransaccionEnvio = envioFlujo; + listTarmDecomisoArma = DecomisoArmaTransaccionController.findPorEnvio(numeroTransaccionEnvio, false); + centroControl = CentroControlArmasController.findPorCodigo(listTarmDecomisoArma.get(0).getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getInstitucion(), centroControl.getInstituciontipo()).getDescription(); + institucionUnidadControl = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + fechaCorte = listTarmDecomisoArma.get(0).getFcorte(); + querydatabase(); + + } + + } + + public void obtenerResponsableCentroControl() { + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + /** + * Carga las unidades de control por el centro de control + */ + public void seleccionaCentroControlDestino() { + if (centroControlDestino != null) { + unidadesDestinos = CentroControlArmasController.findxInstitucion(centroControlDestino); + } else { + unidadesDestinos = new ArrayList<>(); + } + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if (Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")) { + valorColocar = Boolean.TRUE; + } + + btnGrabar = Boolean.TRUE; + for (TarmDecomisoArma decomisoArma : lrecord) { + decomisoArma.getModifiedData().put("seleccion", valorColocar); + if (decomisoArma.getModifiedData().get("seleccion").equals(Boolean.TRUE)) { + btnGrabar = Boolean.FALSE; + //itemsUnidadBolean=Boolean.TRUE; + } + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Generar Acta + */ + public void generarActa() { + String gradoUsuario = ""; + + if (fechaCorte != null) { + Calendar fechaActualCldr = Calendar.getInstance(); + List listTarmDecomisoArma = DecomisoArmaTransaccionController.findPorEnvio(numeroTransaccionEnvioConvertido, false); + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if (grado != null) { + gradoUsuario = grado.getDescription() + " - " + this.responsableCentroControl.getName(); + } else { + gradoUsuario = "Sin Grado - " + this.responsableCentroControl.getName(); + } + + String codigoreporte = listTarmDecomisoArma.get(0).getPk().toString(); + String path = "armas/reports/entregaArmasacta"; + String filename = numeroTransaccionEnvioConvertido; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("fechaCorte", (new SimpleDateFormat("dd-MM-yyyy")).format(fechaCorte).toString()); + parameters.put("codResponsable", this.responsableCentroControl.getPk().getPersoncode()); + parameters.put("gradoUsuario", gradoUsuario.trim()); + try { + + //Usuario logueado en la aplicacion + String nombreUsuario; + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + } else { + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario.trim()); + parameters.put("centrocontrolorigen", institucionCentroControl.trim()); + parameters.put("unidadcontrolorigen", institucionUnidadControl.trim()); + TarmCentroControl centroControlDestino = CentroControlArmasController.findPorCodigo(unidadDestino); + String centroControlDestinoStr = CatalogDetailController.findxCodigoCodcatalogo(centroControlDestino.getInstitucion(), centroControlDestino.getInstituciontipo()).getDescription(); + String unidadControlDestinoStr = CatalogDetailController.findxCodigoCodcatalogo(centroControlDestino.getNombreinstitucion(), centroControlDestino.getNombreinstitucioncodigo()).getDescription(); + + parameters.put("centrocontroldestino", centroControlDestinoStr.trim()); + parameters.put("unidadcontroldestino", unidadControlDestinoStr.trim()); + parameters.put("tecnicoAlmacenamiento", MsgControlArmas.getProperty("tecnicoAlmacenamiento") + " " + institucionCentroControl); + parameters.put("jefe", MsgControlArmas.getProperty("jefe") + " " + institucionCentroControl); + parameters.put("codigodecomisoarma", codigoreporte); + parameters.put("tramite", numeroTransaccionEnvioConvertido); + //Fecha actual + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH) + 1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarFecha", fechaActualSB.toString()); + //parameters.put("transaccion",numeroTransaccionEnvioConvertido); + + //format = CatalogDetailController.findxCodigoCodcatalogo(tipoReporte, "TIPOREPORTE").getLegalcode(); + format = "pdf"; + InputStream file = this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + xpathflujo = generarXpath(); + + alfrescoController.uploadFile(file, numeroTransaccionEnvioConvertido + ".pdf", xpathflujo); + //="cm:Decomiso/cm:A-2016/cm:M-01/cm:CENTRO CONTROL/cm:ABANDONO/cm:ENV/cm:ENV-000000319.pdf" + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } + } + + /** + * Método para habilitar o desabilitar el btn Arma a decomisar + * + * @throws Exception + */ + public void onChange(TarmDecomisoArma decomisoArma) throws Exception { + btnGrabar = Boolean.TRUE; + //itemsUnidadBolean=Boolean.FALSE; + for (TarmDecomisoArma t : lrecord) { + if (t.getModifiedData().get("seleccion").equals(Boolean.TRUE)) { + btnGrabar = Boolean.FALSE; + //itemsUnidadBolean=Boolean.TRUE; + } + } + } + + /** + * Metodo para generar la ruta del alfresco + * + * @return + */ + public String generarXpath() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta = new StringBuilder("cm:Decomiso"); + + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + String centrocontrol = institucionUnidadControl.replaceAll("\\s+", "_"); + ruta = ruta.append("/cm:").append(centrocontrol); + ruta = ruta.append("/cm:" + "ENV"); + + return ruta.toString(); + } + + /** + * Método para devolver la descripcion + * + * @param list + * @param codigo + * @return + */ + public String catalogoDescripcion(List list, String codigo) { + for (TgeneCatalogDetail item : list) { + if (codigo.equals(item.getPk().getCatalog())) { + return item.getDescription(); + } + } + return null; + } + + /** + * Ejecuta un reporte de armas a destruir Método para el inicio de + * flujo + */ + public void iniciarFlujo() { + try { + if (xpathflujo == null || numeroTransaccion == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generereporte")); + return; + } + if (cprovincia == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinprovincia")); + return; + } + String xpath = xpathflujo + "/cm:" + numeroTransaccionEnvioConvertido + ".pdf"; + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + //codigo de la tabla TarmDecomisoArmaTransaccion + request.modifiedData().put("numerotransaccion", numeroTransaccion); + //codigo de la provincia + request.modifiedData().put("cprovincia", cprovincia); + //ruta del archivo para la firma + //TODO Falta crear la variable en maia 2-8 + request.modifiedData().put("xpath", xpath); + request.modifiedData().put("numerosolicitud", numeroTransaccionEnvioConvertido); + request.modifiedData().put("isnew", "Y"); + request.setLogsolicitude(numeroTransaccionEnvioConvertido); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.setShowRow(true); + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + " NUMERO TRANSACCION: " + numeroTransaccion); + xpathflujo = null; + numeroTransaccion = null; + this.btnGrabar = Boolean.TRUE; + this.btnFlujo = Boolean.FALSE; + this.btnSelTodos = Boolean.TRUE; + this.btnGenerarActa = Boolean.TRUE; + numeroTransaccionEnvioConvertido = null; + + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + /** + * Metodo para filtrar por el numero de transaccion despues de la + * realizacion del guardado + * + * @throws Exception + */ + protected void querydata() throws Exception { + filtroData = numeroTransaccionEnvio; + query(); + setFiltroData(""); + } + + /** + * Se ejecuta cuando seleccionamos forzar consulta cuando hay data en el + * grid + */ + @Override + public void forcedQuery() throws Exception { + centroControlDestino = null; + this.init(); + super.forcedQuery(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + //clearAll(); + + /*this.btnGrabar=Boolean.TRUE; + this.btnGenerarActa=Boolean.TRUE; + this.btnSelTodos = Boolean.TRUE;*/ + //Verificar si tiene o no contenido seleccionado + if (lrecord != null && !lrecord.isEmpty() && btnTabGrid) { + for (TarmDecomisoArma decomisoArma : lrecord) { + if (decomisoArma.getModifiedData().get("seleccion") + .equals(Boolean.TRUE)) { + RequestContext.getCurrentInstance().execute( + "PF('queryConfirmDialog').show()"); + return; + } + + } + + } + try { + numeroTransaccionEnvio = filtroData; + if (fechaCorte != null && !fechaCorte.after(new Date())) { + + DtoQuery dto = this.getDtoQuery(); + dto.setOrderby("t.fdecomiso"); + Request request = this.callerhelper.getRequest(); + if ((transaccionVerificarArmas || transaccionAprobarActaEntrega) && centroControl == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sin_centrocontrol")); + return; + } + if (numeroTransaccionRecepcion != null && !numeroTransaccionRecepcion.isEmpty() && !numeroTransaccionRecepcion.substring(0, 3).equalsIgnoreCase("REC")) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_numero_recepcion")); + return; + } + + if (transaccionVerificarArmas) { + try { + + //Valores para el filtro + request.put("centroControl", centroControl.getPk()); + request.put("numeroDecomiso", numeroDecomiso); + request.put("numeroserie", numeroSerie); + request.put("fechacorte", fechaCorte.toString()); + //QueryRule VerificarArmasQuery + request.put("queryalias", "TRANSVERIFICARARMAS"); + + } catch (Exception e) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sin_decomisos")); + return; + } + } else if (transaccionAprobarActaEntrega) { + try { + dto = filtroAprobarActaEntrega(dto); + } catch (Exception e) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sin_decomisos")); + return; + } + } else { + Filter fechaFiltro = new Filter(); + fechaFiltro.setSql("t.fdecomiso < " + "TO_DATE('" + fechaCorte.toString() + "','yyyy-mm-dd')"); + dto.addFiltro(fechaFiltro); + } + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + btnSelTodos = Boolean.TRUE; + + MessageHelper.setMessageError(resp); + } else { + + lrecord = (List) resp.get(beanalias); + + if (lrecord != null && !lrecord.isEmpty()) { + btnSelTodos = Boolean.FALSE; + + List listaNoenviada = new ArrayList(); + for (TarmDecomisoArma decomisoArma : lrecord) { + if (!filtroData.isEmpty()) { + + decomisoArma.getModifiedData().put("seleccion", Boolean.TRUE); + } else { + decomisoArma.getModifiedData().put("seleccion", Boolean.FALSE); + } + if (decomisoArma.getModifiedData().get("estadoflujo") != null && decomisoArma.getModifiedData().get("estadoflujo").equals("NOENV")) { + listaNoenviada.add(decomisoArma); + } + } + for (TarmDecomisoArma decomisoArma : listaNoenviada) { + lrecord.remove(decomisoArma); + } + super.postQuery(lrecord); + } else { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_info_consultarArmasDecomidas")); + } + + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_fechaCorteMayorAFechaActual")); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + SubQuery subqueryCarma = new SubQuery("TarmArmas", "pk", "ncodigoarma", "i.pk=t.carma"); + dto.addSubQuery(subqueryCarma); + SubQuery subqueryTipoArmaExplosivo = new SubQuery("TgeneCatalogDetail", "description", "ntipo", "i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o " + + " where o.pk= (select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))" + + " and i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))"); + dto.addSubQuery(subqueryTipoArmaExplosivo); + SubQuery subqueryClasecatalogo = new SubQuery("TgeneCatalogDetail", "description", "nclase", "i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma)) and " + + " i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o " + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))"); + dto.addSubQuery(subqueryClasecatalogo); + SubQuery subqueryRazonSocial = new SubQuery("TcustPersonDetail", "name", "razonsPropietario", "i.pk.personcode=(select p.personcode from TarmRegistroArmas p where p.pk=(select o.cregistro from TarmArmas o where o.pk=t.carma)) " + + " and i.pk.dateto=to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryRazonSocial); + SubQuery subqueryIndentificacion = new SubQuery("TcustPersonDetail", "identification", "documentoPropietario", "i.pk.personcode=(select p from TarmRegistroArmas p where p.pk=(select o.cregistro from TarmArmas o where o.pk=t.carma)) " + + " and i.pk.dateto=to_date('2999-12-31', 'YYYY-MM-DD')"); + + dto.addSubQuery(subqueryIndentificacion); + + SubQuery subquerylonguitud = new SubQuery("TgeneCatalogDetail", "description", "nlongitud", "i.pk.catalog= (select o.longitud from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma)) and " + + " i.pk.catalogcode=(select o.longitudcodigo from TarmTipoArmaExplosivo o " + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))"); + dto.addSubQuery(subquerylonguitud); + SubQuery subqueryCalibre = new SubQuery("TarmTipoArmaExplosivo", "calibre", "ncalibre", "i.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma)"); + dto.addSubQuery(subqueryCalibre); + + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "nmarca", "i.pk.catalog= (select o.marca from TarmArmas o where o.pk=t.carma)" + + " and i.pk.catalogcode=(select o.marcacodigo from TarmArmas o where o.pk=t.carma)"); + dto.addSubQuery(subqueryMarca); + + SubQuery subqueryLote = new SubQuery("TarmArmas", "lote", "nserie", "i.pk=t.carma"); + dto.addSubQuery(subqueryLote); + + SubQuery subqueryNRecivo = new SubQuery("TarmDecomiso", "numerorecibo", "nrecibo", "i.pk=t.cdecomiso"); + dto.addSubQuery(subqueryNRecivo); + SubQuery subqueryNTransaccion = new SubQuery("TarmDecomiso", "numerotransaccion", "numerotransaccion", "i.pk=t.cdecomiso"); + dto.addSubQuery(subqueryNTransaccion); + SubQuery subqueryUnidadTipo = new SubQuery("TgeneCatalogDetail", "description", "nunidad", "i.pk.catalog= (select o.unidadmedidapeso from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma)) and " + + " i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o" + + " where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=t.carma))"); + dto.addSubQuery(subqueryUnidadTipo); + + SubQuery subqueryColor = new SubQuery("TgeneCatalogDetail", "description", "color", "i.pk.catalog= (select o.color from TarmArmas o where o.pk=t.carma)" + + " and i.pk.catalogcode=(select o.colorcodigo from TarmArmas o where o.pk=t.carma)"); + dto.addSubQuery(subqueryColor); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog= (select o.estado from TarmArmas o where o.pk=t.carma) " + + " and i.pk.catalogcode=(select o.estadocodigo from TarmArmas o where o.pk=t.carma)"); + dto.addSubQuery(subqueryEstado); + //tarmdecomiso + SubQuery subquerynrecibo = new SubQuery("TarmDecomiso", "numerorecibo", "nrecibo", "i.pk=t.cdecomiso"); + dto.addSubQuery(subquerynrecibo); + SubQuery subquerynrazon = new SubQuery("TarmDecomiso", "nombrerazonsocial", "nrazons", "i.pk=t.cdecomiso"); + dto.addSubQuery(subquerynrazon); + SubQuery subquerydocumento = new SubQuery("TarmDecomiso", "numerodocumento", "documento", "i.pk=t.cdecomiso"); + dto.addSubQuery(subquerydocumento); + + SubQuery subqueryestadoflujo = new SubQuery("TarmDecomisoArmaTransaccion", "estadoflujo", "estadoflujo", "i.pk=t.cdecomisoarmatransaccion"); + dto.addSubQuery(subqueryestadoflujo); + return dto; + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + if (unidadDestino == null || unidadDestino.isEmpty() || centroControlDestino == null || centroControlDestino.isEmpty()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_verificarcentcontdestino")); + return; + } + if (this.getLoginController() != null && 53 == this.getLoginController().getRequest().getTransactionCode() && "30".equals(getLoginController().getRequest().getTransactionModule())) { + List listaSeleccionada = new ArrayList(); + Boolean seleccion = Boolean.FALSE; + + for (TarmDecomisoArma decomisoArma : this.lrecord) { + record = decomisoArma; + + if (record.getModifiedData().get("seleccion").equals(Boolean.TRUE)) { + seleccion = true; + record.setCdecomisoarmatransaccion(0l);//valor cualquiera seteado para que el transaction rule lo tome como actualizacion + record.setCoperaciontransaccion("ENVIO"); + transaccionArmaBodegaController.create(); + transaccionArmaBodegaController.getRecord().setCarma(record.getCarma()); + transaccionArmaBodegaController.getRecord().setCcentrocontrolorigen(centroControl.getPk()); + //Nuevo le doy destino de envio + transaccionArmaBodegaController.getRecord().setCcentrocontroldestino(unidadDestino); + transaccionArmaBodegaController.update(); + + bodegaController.create(); + bodegaController.getRecord().setCarma(record.getCarma()); + bodegaController.getRecord().setCcentrocontrol(centroControl.getPk()); + bodegaController.update(); + listaSeleccionada.add(record); + } + this.update(); + } + + if (!seleccion) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_verificararmas")); + return; + } + + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + + Calendar cal = Calendar.getInstance(); + cal.setTime(fechaCorte); + java.sql.Date fechaCorteRegistro = new java.sql.Date(cal.getTimeInMillis()); + + this.decomisoArmaTransaccionController.create(); + this.decomisoArmaTransaccionController.getRecord().setFtransaccion(null); + this.decomisoArmaTransaccionController.getRecord().setFcorte(fechaCorteRegistro); + this.decomisoArmaTransaccionController.getRecord().setCcentrocontrol(centroControl.getPk()); + + if (!"1".equals(CatalogDetailController.findxCodigoCodcatalogo(centroControl.getInstitucion(), centroControl.getInstituciontipo()).getPk().getCatalog())) { + this.decomisoArmaTransaccionController.getRecord().setEstadofirma("Y"); + this.decomisoArmaTransaccionController.getRecord().setEstadoflujo("ENV"); + isCentroDpto = Boolean.FALSE; + } else { + this.decomisoArmaTransaccionController.getRecord().setEstadofirma("N"); + this.decomisoArmaTransaccionController.getRecord().setEstadoflujo("NOENV"); + isCentroDpto = Boolean.TRUE; + } + + this.decomisoArmaTransaccionController.update(); + + DtoSave dtosaveDecomisoTran = this.decomisoArmaTransaccionController.getDtoSave(true); + dtosaveDecomisoTran.setReturnpk(true); + dtosaveDecomisoTran.setPosition(1); + msave.put(decomisoArmaTransaccionController.getBeanalias(), dtosaveDecomisoTran); + + DtoSave dtosaveDecomiso = this.getDtoSave(true); + dtosaveDecomiso.setReturnpk(true); + dtosaveDecomiso.setPosition(2); + msave.put(getBeanalias(), dtosaveDecomiso); + + DtoSave dtosaveBodegaTransaccion = this.transaccionArmaBodegaController.getDtoSave(); + dtosaveBodegaTransaccion.setReturnpk(true); + dtosaveBodegaTransaccion.setPosition(3); + msave.put(this.transaccionArmaBodegaController.getBeanalias(), dtosaveBodegaTransaccion); + + DtoSave dtosaveBodega = this.bodegaController.getDtoSave(); + dtosaveBodega.setReturnpk(true); + dtosaveBodega.setPosition(4); + msave.put(this.bodegaController.getBeanalias(), dtosaveBodega); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + + this.decomisoArmaTransaccionController.postCommit(resp); + this.transaccionArmaBodegaController.postCommit(resp); + this.bodegaController.postCommit(resp); + numeroTransaccionEnvio = String.valueOf(((TarmDecomisoArmaTransaccion) (dtosaveDecomisoTran.getLinsert().get(0))).getPk()); + numeroTransaccion = numeroTransaccionEnvio; + setNumeroTransaccionEnvioConvertido("ENV" + "-" + StringUtils.leftPad(numeroTransaccionEnvio, 9, '0')); + this.btnGrabar = Boolean.TRUE; + this.btnFlujo = Boolean.TRUE; + this.btnSelTodos = Boolean.TRUE; + this.btnFiltros = Boolean.TRUE; + this.btnTabGrid = Boolean.FALSE; + this.postCommit(resp); + lrecord = listaSeleccionada; + MessageHelper.setMessageInfo(resp); + + FacesContext context = FacesContext.getCurrentInstance(); + context.addMessage(null, new FacesMessage("RECUERDE", MsgControlArmas.getProperty("msg_recuerdeClickGenerarActa"))); + context.addMessage(null, new FacesMessage("RECUERDE", MsgControlArmas.getProperty("msg_recuerdeClickContinuarTramite"))); + } else { + MessageHelper.setMessageError(resp); + } + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + /** + * Para realizar el filtro por acta de aprobación + * + * @param dto Dto de los datos consultados + * @return + * @throws Exception + */ + private DtoQuery filtroAprobarActaEntrega(DtoQuery dto) throws Exception { + + fechaCorte = new Date(); + numeroTransaccionEnvio = envioFlujo; + + Filter decomisoFiltro = new Filter(); + + decomisoFiltro.setSql(" t.cdecomisoarmatransaccion= '" + listTarmDecomisoArma.get(0).getPk() + "'"); + dto.addFiltro(decomisoFiltro); + + return dto; + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport() { + if (fechaCorte != null) { + Calendar fechaActualCldr = Calendar.getInstance(); + Calendar fechaCorteCldr = Calendar.getInstance(); + fechaCorteCldr.setTime(fechaCorte); + if (fechaActualCldr.compareTo(fechaCorteCldr) >= 0) { + String path = "armas/reports/destruccionArmas"; + String filename = "armas"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + try { + + //Usuario logueado en la aplicacion + String nombreUsuario; + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } else { + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario); + + //Fecha de corte + StringBuilder fechaCorteSB = new StringBuilder(); + fechaCorteSB = fechaCorteSB.append((fechaCorteCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCorteCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCorteCldr.get(Calendar.DAY_OF_MONTH))); + fechaCorteSB = fechaCorteSB.append("-").append((fechaCorteCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaCorteCldr.get(Calendar.MONTH) + 1) : (fechaCorteCldr.get(Calendar.MONTH) + 1)); + fechaCorteSB = fechaCorteSB.append("-").append(fechaCorteCldr.get(Calendar.YEAR)); + parameters.put("fechaCorte", fechaCorteSB.toString()); + + //Fecha actual + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH) + 1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarFecha", fechaActualSB.toString()); + + //Fecha de referencia + Calendar fechaReferenciaReporteCldr = Calendar.getInstance(); + fechaReferenciaReporteCldr.setTime(fechaCorte); + fechaReferenciaReporteCldr.add(Calendar.DAY_OF_MONTH, -diasParaDestruirArma); + StringBuilder fechaReferenciaSB = new StringBuilder(); + fechaReferenciaSB = fechaReferenciaSB.append((fechaReferenciaReporteCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaReferenciaReporteCldr.get(Calendar.DAY_OF_MONTH)) : (fechaReferenciaReporteCldr.get(Calendar.DAY_OF_MONTH))); + fechaReferenciaSB = fechaReferenciaSB.append("-").append((fechaReferenciaReporteCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaReferenciaReporteCldr.get(Calendar.MONTH) + 1) : (fechaReferenciaReporteCldr.get(Calendar.MONTH) + 1)); + fechaReferenciaSB = fechaReferenciaSB.append("-").append(fechaReferenciaReporteCldr.get(Calendar.YEAR)); + parameters.put("fechaReferenciaReporte", fechaReferenciaSB.toString()); + + //format = CatalogDetailController.findxCodigoCodcatalogo(tipoReporte, "TIPOREPORTE").getLegalcode(); + format = "pdf"; + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_fechaCorteMayorAFechaActual")); + } + } + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("numerotransaccion", envioFlujo); + request.modifiedData().put("xpath", pathflujo); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public List getlTipoReporte() { + return lTipoReporte; + } + + public void setlTipoReporte(List lTipoReporte) { + this.lTipoReporte = lTipoReporte; + } + + public TcustPersonDetail getUsuario() { + return usuario; + } + + public void setUsuario(TcustPersonDetail usuario) { + this.usuario = usuario; + } + + public Date getFechaCorte() { + return fechaCorte; + } + + public void setFechaCorte(Date fechaCorte) { + this.fechaCorte = fechaCorte; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getTipoReporte() { + return tipoReporte; + } + + public void setTipoReporte(String tipoReporte) { + this.tipoReporte = tipoReporte; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public Integer getDiasParaDestruirArma() { + return diasParaDestruirArma; + } + + public void setDiasParaDestruirArma(Integer diasParaDestruirArma) { + this.diasParaDestruirArma = diasParaDestruirArma; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public boolean isTransaccionVerificarArmas() { + return transaccionVerificarArmas; + } + + public void setTransaccionVerificarArmas(boolean transaccionVerificarArmas) { + this.transaccionVerificarArmas = transaccionVerificarArmas; + } + + public DecomisoArmaTransaccionController getDecomisoArmaTransaccionController() { + return decomisoArmaTransaccionController; + } + + public void setDecomisoArmaTransaccionController( + DecomisoArmaTransaccionController decomisoArmaTransaccionController) { + this.decomisoArmaTransaccionController = decomisoArmaTransaccionController; + } + + public TransaccionArmaBodegaController getTransaccionArmaBodegaController() { + return transaccionArmaBodegaController; + } + + public void setTransaccionArmaBodegaController( + TransaccionArmaBodegaController transaccionArmaBodegaController) { + this.transaccionArmaBodegaController = transaccionArmaBodegaController; + } + + public String getNumeroTransaccionEnvio() { + return numeroTransaccionEnvio; + } + + public void setNumeroTransaccionEnvio(String numeroTransaccionEnvio) { + this.numeroTransaccionEnvio = numeroTransaccionEnvio; + } + + public String getNumeroTransaccionEnvioConvertido() { + return numeroTransaccionEnvioConvertido; + } + + public void setNumeroTransaccionEnvioConvertido( + String numeroTransaccionEnvioConvertido) { + this.numeroTransaccionEnvioConvertido = numeroTransaccionEnvioConvertido; + } + + public String getFiltroData() { + return filtroData; + } + + public void setFiltroData(String filtroData) { + this.filtroData = filtroData; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + public String getNumeroTransaccion() { + return numeroTransaccion; + } + + public void setNumeroTransaccion(String numeroTransaccion) { + this.numeroTransaccion = numeroTransaccion; + } + + public Boolean getBtnFlujo() { + return btnFlujo; + } + + public void setBtnFlujo(Boolean btnFlujo) { + this.btnFlujo = btnFlujo; + } + + public Boolean getBtnGrabar() { + return btnGrabar; + } + + public void setBtnGrabar(Boolean btnGrabar) { + this.btnGrabar = btnGrabar; + } + + public BodegaController getBodegaController() { + return bodegaController; + } + + public void setBodegaController(BodegaController bodegaController) { + this.bodegaController = bodegaController; + } + + public String getInstitucionUnidadControl() { + return institucionUnidadControl; + } + + public void setInstitucionUnidadControl(String institucionUnidadControl) { + this.institucionUnidadControl = institucionUnidadControl; + } + + public String getNumeroSerie() { + return numeroSerie; + } + + public void setNumeroSerie(String numeroSerie) { + this.numeroSerie = numeroSerie; + } + + public String getNumeroDecomiso() { + return numeroDecomiso; + } + + public void setNumeroDecomiso(String numeroDecomiso) { + this.numeroDecomiso = numeroDecomiso; + } + + public String getCentroControlDestino() { + return centroControlDestino; + } + + public void setCentroControlDestino(String centroControlDestino) { + this.centroControlDestino = centroControlDestino; + } + + public String getUnidadDestino() { + return unidadDestino; + } + + public void setUnidadDestino(String unidadDestino) { + this.unidadDestino = unidadDestino; + } + + public List getCentroControlsDestinos() { + return centroControlsDestinos; + } + + public void setCentroControlsDestinos(List centroControlsDestinos) { + this.centroControlsDestinos = centroControlsDestinos; + } + + public List getUnidadesDestinos() { + return unidadesDestinos; + } + + public void setUnidadesDestinos(List unidadesDestinos) { + this.unidadesDestinos = unidadesDestinos; + } + + public Boolean getBtnGenerarActa() { + return btnGenerarActa; + } + + public void setBtnGenerarActa(Boolean btnGenerarActa) { + this.btnGenerarActa = btnGenerarActa; + } + + public String getCodigoOrganismoControlDestino() { + return codigoOrganismoControlDestino; + } + + public void setCodigoOrganismoControlDestino( + String codigoOrganismoControlDestino) { + this.codigoOrganismoControlDestino = codigoOrganismoControlDestino; + } + + public String getCodigoUnidadControlDestino() { + return codigoUnidadControlDestino; + } + + public void setCodigoUnidadControlDestino(String codigoUnidadControlDestino) { + this.codigoUnidadControlDestino = codigoUnidadControlDestino; + } + + /** + * @return the centroControlActual + */ + public String getCentroControlActual() { + return centroControlActual; + } + + /** + * @param centroControlActual the centroControlActual to set + */ + public void setCentroControlActual(String centroControlActual) { + this.centroControlActual = centroControlActual; + } + + /** + * @return the unidadActual + */ + public String getUnidadActual() { + return unidadActual; + } + + /** + * @param unidadActual the unidadActual to set + */ + public void setUnidadActual(String unidadActual) { + this.unidadActual = unidadActual; + } + + public boolean isBtnSelTodos() { + return btnSelTodos; + } + + public void setBtnSelTodos(boolean btnSelTodos) { + this.btnSelTodos = btnSelTodos; + } + + /** + * @return the numeroTransaccionRecepcion + */ + public String getNumeroTransaccionRecepcion() { + return numeroTransaccionRecepcion; + } + + /** + * @param numeroTransaccionRecepcion the numeroTransaccionRecepcion to set + */ + public void setNumeroTransaccionRecepcion(String numeroTransaccionRecepcion) { + this.numeroTransaccionRecepcion = numeroTransaccionRecepcion; + } + + /** + * @return the btnTabGrid + */ + public Boolean getBtnTabGrid() { + return btnTabGrid; + } + + /** + * @param btnTabGrid the btnTabGrid to set + */ + public void setBtnTabGrid(Boolean btnTabGrid) { + this.btnTabGrid = btnTabGrid; + } + + /** + * @return the btnFiltros + */ + public boolean isBtnFiltros() { + return btnFiltros; + } + + /** + * @param btnFiltros the btnFiltros to set + */ + public void setBtnFiltros(boolean btnFiltros) { + this.btnFiltros = btnFiltros; + } + + public Boolean getIsCentroDpto() { + return isCentroDpto; + } + + public void setIsCentroDpto(Boolean isCentroDpto) { + this.isCentroDpto = isCentroDpto; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteDestruccionDeArmasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteDestruccionDeArmasController.java new file mode 100644 index 0000000..dc41de3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteDestruccionDeArmasController.java @@ -0,0 +1,792 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.primefaces.component.selectbooleancheckbox.SelectBooleanCheckbox; +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmCabRepDestruirArmas; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDetRepDestruirArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de la generación de reporte de armas a destruirse + * + * @author Christian Pazmino. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReporteDestruccionDeArmasController extends AbstractController { + + /** + * Fecha de corte a la que se generara el reporte + * + */ + private Date fechaCorte; + /** + * Formato de reporte que se va a generar + * + */ + private String format = "pdf"; + /** + * Usuario actual loogueado en el sistema + * + */ + private TsafeUserDetail userDetail; + /** + * Variable de tipo entero que lee de la tabla parámetros el + * número de días en decomiso previo a la destrucción + * del arma + * + */ + private Integer diasParaDestruirArma; + /** + * Catalogcode de la tabla Catálogos que funciona como bandera para + * indicar si un arma ya se encuentra en algún reporte previo. + * + */ + private final String CATALOGCODEADESTRUIRSE = "ADESTRUIRSE"; + /** + * Ruta base del reporte generado en el Alfresco + * + */ + private String xPathLocation; + /** + * Ubicacion completa del reporte generado en el Alfresco + * + */ + private String xPath; + /** + * Nombre del reporte generado en el Alfresco + * + */ + private String nombreReporte; + /** + * Codigo de cabecera del reporte generado en base de datos + * + */ + private String creporte; + /** + * Bandera de tipo booleano para indicar si se genero o no el reporte + * + */ + private Boolean seGeneroReporte; + /** + * Bandera de tipo booleano para indicar si se ha grabado el reporte + * generado + * + */ + private Boolean isEnableGrabar; + /** + * Bandera de tipo booleano para indicar que se debe deshabilitar el boton + * iniciar flujo + * + */ + private Boolean isEnableEnviar; + /** + * Variable del tipo TgeneCatalogDetail(Esta en reporte de armas a + * destruirse) + */ + private TgeneCatalogDetail aDestruirseCatalog; + /** + * Clase controladora de reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + /** + * Clase controladora de cabecera de reporte de armas a destruir + */ + @ManagedProperty(value = "#{cabRepDestruirArmasController}") + private CabRepDestruirArmasController cabRepDestruirArmasController; + /** + * Clase controladora de detalle de reporte de armas a destruir + */ + @ManagedProperty(value = "#{detRepDestruirArmasController}") + private DetRepDestruirArmasController detRepDestruirArmasController; + /** + * Clase controladora de funcionalidad del Alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + /** + * codigo de la provincia del usuario logeado + */ + private String cprovincia; + + public ReporteDestruccionDeArmasController() throws Exception { + super(TarmDecomisoArma.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + diasParaDestruirArma = ParametersController.find("DIASENBODEGA.DESTRUIRARMAS", "1").getNumbervalue().intValue(); + aDestruirseCatalog = CatalogDetailController.findxCodigoCodcatalogo("1", CATALOGCODEADESTRUIRSE); + recperpage = 10000; // Cambiar al # reg a mirar. + lrecord = new ArrayList(); + beanalias = "RPRTEDESTRUCCIONDEARMAS"; + seGeneroReporte = Boolean.FALSE; + isEnableGrabar = Boolean.TRUE; + isEnableEnviar = Boolean.FALSE; + TarmCentroControl centroControl = Utilidades.obtenerCentroControl(); + cprovincia = centroControl.getProvincecode(); + querydatabase(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @throws Exception + * + */ + /** + * Metodo que se debe ejecutar cuando es una transaccion de tipo verificar + * armas + * + * @throws Exception + */ +// private void provinciaUsuario() throws Exception { +// PersonAddressController personAddressController = new PersonAddressController(); +// TcustPersonAddress tcustPersonAddres= personAddressController.findPrincipal(userDetail.getPk().getPersoncode().toString()); +// cprovincia=tcustPersonAddres.getProvincecode(); +// } + /** + * Crea una instancia y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if (Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")) { + valorColocar = Boolean.TRUE; + } + for (TarmDecomisoArma decomisoArmaObj : lrecord) { + decomisoArmaObj.getModifiedData().put("isSelect", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if (fechaCorte != null) { + Calendar fechaActualCldr = Calendar.getInstance(); + Calendar fechaCorteCldr = Calendar.getInstance(); + fechaCorteCldr.setTime(fechaCorte); + if (fechaActualCldr.compareTo(fechaCorteCldr) >= 0) { + + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.fdecomiso"); + + Calendar fechaReferenciaReporteCldr = Calendar.getInstance(); + + fechaReferenciaReporteCldr.setTime(fechaCorte); + + fechaReferenciaReporteCldr.add(Calendar.DAY_OF_MONTH, -diasParaDestruirArma); + StringBuilder fechaReferenciaSB = new StringBuilder(); + fechaReferenciaSB = fechaReferenciaSB.append((fechaReferenciaReporteCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaReferenciaReporteCldr.get(Calendar.DAY_OF_MONTH)) : (fechaReferenciaReporteCldr.get(Calendar.DAY_OF_MONTH))); + fechaReferenciaSB = fechaReferenciaSB.append("-").append((fechaReferenciaReporteCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaReferenciaReporteCldr.get(Calendar.MONTH) + 1) : (fechaReferenciaReporteCldr.get(Calendar.MONTH) + 1)); + fechaReferenciaSB = fechaReferenciaSB.append("-").append(fechaReferenciaReporteCldr.get(Calendar.YEAR)); + + Filter fechaFiltro = new Filter(); + fechaFiltro.setSql("(t.estado='DEC' or t.estado='INC' or t.estado='ABA' or t.estado='ENTR') and t.adestruirse is null and t.adestruirsecode is null and t.fdecomiso < " + "TO_DATE('" + fechaReferenciaSB.toString() + "','dd-mm-yyyy') and not exists(select 1 from TarmArmas ta where ta.estado = 'SUSP' and t.carma = (select max(tax.pk) from TarmArmas tax where ta.pk = tax.pk))"); + dto.addFiltro(fechaFiltro); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + for (TarmDecomisoArma decomisoArma : lrecord) { + if (decomisoArma.getCdecomiso() != null) { + decomisoArma.getModifiedData().put("isSelect", Boolean.FALSE); + TarmArmas arma = ArmasController.findByPK(decomisoArma.getCarma()); + TarmTipoArmaExplosivo tipoArmaExplosivo = TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo()); + decomisoArma.getModifiedData().put("ntipo", arma.getModifiedData().get("tipo")); + decomisoArma.getModifiedData().put("nclase", arma.getModifiedData().get("clase")); + if (tipoArmaExplosivo.getLongitud() != null) { + decomisoArma.getModifiedData().put("nlongitud", CatalogDetailController.findxCodigoCodcatalogo(tipoArmaExplosivo.getLongitud(), tipoArmaExplosivo.getLongitudcodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tipoArmaExplosivo.getLongitud(), tipoArmaExplosivo.getLongitudcodigo()).getDescription() : ""); + } else { + decomisoArma.getModifiedData().put("nlongitud", ""); + } + if (tipoArmaExplosivo.getCalibre() != null) { + decomisoArma.getModifiedData().put("ncalibre", CatalogDetailController.findxCodigoCodcatalogo(tipoArmaExplosivo.getCalibre(), tipoArmaExplosivo.getCalibrecodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(tipoArmaExplosivo.getCalibre(), tipoArmaExplosivo.getCalibrecodigo()).getDescription() : ""); + } else { + decomisoArma.getModifiedData().put("ncalibre", ""); + } + + decomisoArma.getModifiedData().put("nmarca", CatalogDetailController.findxCodigoCodcatalogo(arma.getMarca(), arma.getMarcacodigo()) != null ? CatalogDetailController.findxCodigoCodcatalogo(arma.getMarca(), arma.getMarcacodigo()).getDescription() : ""); + decomisoArma.getModifiedData().put("nserie", arma.getLote()); + decomisoArma.getModifiedData().put("nunidad", CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getUnidadmedida(), decomisoArma.getUnidadmedidacode()) != null ? CatalogDetailController.findxCodigoCodcatalogo(decomisoArma.getUnidadmedida(), decomisoArma.getUnidadmedidacode()).getDescription() : ""); + + TarmRegistroArmas registroArma = RegistroArmController.findByCodigo(arma.getCregistro().toString()); + if (registroArma != null && registroArma.getPersoncode() != null) { + Integer personCodePropietario = registroArma.getPersoncode(); + decomisoArma.getModifiedData().put("npropietario", PersonDetailController.find(personCodePropietario.toString()).getName()); + } else { + decomisoArma.getModifiedData().put("npropietario", ""); + } + TarmDecomiso decomiso = DecomisoController.findByCodigo(decomisoArma.getCdecomiso().toString()); + if (decomiso != null && decomiso.getNumerodocumento() != null) { + decomisoArma.getModifiedData().put("nrecibo", decomiso.getNumerorecibo()); + } else { + decomisoArma.getModifiedData().put("nrecibo", ""); + } + } else { + lrecord.remove(decomisoArma); + } + } + super.postQuery(lrecord); + } + } else { + lrecord = new ArrayList(); + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_fechaCorteMayorAFechaActual")); + } + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para reconsultar en base a una nueva fecha de corte seleccionada + */ + public void cambioFechaDeCorte(SelectEvent event) { + querydatabase(); + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + cabRepDestruirArmasController.postCommit(response); + detRepDestruirArmasController.postCommit(response); + } + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport() { + if (fechaCorte != null) { + if (existeArmasSeleccionadas()) { + Calendar fechaActualCldr = Calendar.getInstance(); + Calendar fechaCorteCldr = Calendar.getInstance(); + fechaCorteCldr.setTime(fechaCorte); + if (fechaActualCldr.compareTo(fechaCorteCldr) >= 0) { + String path = "armas/reports/bajaDestruccion"; + String filename = "ArmasADestruirse"; + + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + // Datos del supervisor militar + String CISupervisorMilitar = ParametersController.find("IDSUPERMILITDPTOARMSPICH", "1").getTextvalue(); + TcustPersonDetail supervisorMilitarObj = PersonDetailController.findxidentification(CISupervisorMilitar, "CED"); + String gradoSupMilitar = supervisorMilitarObj.getMilitarygrade() == null ? "" : supervisorMilitarObj.getMilitarygrade() + " - "; + parameters.put("nombreSupMilitar", gradoSupMilitar + supervisorMilitarObj.getName() == null ? "" : supervisorMilitarObj.getName()); + parameters.put("personCodeSupMilitar", supervisorMilitarObj.getPk().getPersoncode() == null ? "1001" : supervisorMilitarObj.getPk().getPersoncode()); + // Datos del coordinador militar + String CICoordinadorMilitar = ParametersController.find("IDCOORDMILITDPTOARMSPICH", "1").getTextvalue(); + TcustPersonDetail coordinadorMilitarObj = PersonDetailController.findxidentification(CICoordinadorMilitar, "CED"); + String gradoCoordMilitar = coordinadorMilitarObj.getMilitarygrade() == null ? "" : coordinadorMilitarObj.getMilitarygrade() + " - "; + parameters.put("nombreCoordMilitar", gradoCoordMilitar + coordinadorMilitarObj.getName() == null ? "" : coordinadorMilitarObj.getName()); + parameters.put("personCodeCoordMilitar", coordinadorMilitarObj.getPk().getPersoncode() == null ? "1001" : coordinadorMilitarObj.getPk().getPersoncode()); + + try { + + //Usuario logueado en la aplicacion + String nombreUsuario; + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } else { + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario); + + //Fecha de corte + StringBuilder fechaCorteSB = new StringBuilder(); + fechaCorteSB = fechaCorteSB.append((fechaCorteCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCorteCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCorteCldr.get(Calendar.DAY_OF_MONTH))); + fechaCorteSB = fechaCorteSB.append("-").append((fechaCorteCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaCorteCldr.get(Calendar.MONTH) + 1) : (fechaCorteCldr.get(Calendar.MONTH) + 1)); + fechaCorteSB = fechaCorteSB.append("-").append(fechaCorteCldr.get(Calendar.YEAR)); + parameters.put("fechaCorte", fechaCorteSB.toString()); + parameters.put("codArmasDecomisadasLst", actualizarArmasSeleccionadas()); + //Fecha actual + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH) + 1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarFecha", fechaActualSB.toString()); + + //Fecha de referencia + Calendar fechaReferenciaReporteCldr = Calendar.getInstance(); + fechaReferenciaReporteCldr.setTime(fechaCorte); + fechaReferenciaReporteCldr.add(Calendar.DAY_OF_MONTH, -diasParaDestruirArma); + StringBuilder fechaReferenciaSB = new StringBuilder(); + fechaReferenciaSB = fechaReferenciaSB.append((fechaReferenciaReporteCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaReferenciaReporteCldr.get(Calendar.DAY_OF_MONTH)) : (fechaReferenciaReporteCldr.get(Calendar.DAY_OF_MONTH))); + fechaReferenciaSB = fechaReferenciaSB.append("-").append((fechaReferenciaReporteCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaReferenciaReporteCldr.get(Calendar.MONTH) + 1) : (fechaReferenciaReporteCldr.get(Calendar.MONTH) + 1)); + fechaReferenciaSB = fechaReferenciaSB.append("-").append(fechaReferenciaReporteCldr.get(Calendar.YEAR)); + parameters.put("fechaReferenciaReporte", fechaReferenciaSB.toString()); + + // Verifico si el reporte fue enviado en el flujo y debe subirse al Alfresco +// if(isDenied){ + InputStream file = this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + alfrescoController.uploadFile(file, nombreReporte, this.xPathLocation); + seGeneroReporte = Boolean.TRUE; +// }else{ +// this.reportController.execute(path, parameters, format, filename, this.getLoginController()); +// } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_fechaCorteMayorAFechaActual")); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccioneAlmenosUnArma")); + } + } + } + + /** + * Retorna la ruta de documento base en donde se almacenará el + * reporte + * + * @return + */ + public String getRutaDocumentoRepBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta = new StringBuilder("cm:Decomiso"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + return ruta.toString(); + } + + public String getxPath() { + return xPath; + } + + public void setxPath(String xPath) { + this.xPath = xPath; + } + + /** + * Método para el inicio de flujo. Guardar el reporte creado para su + * posterior aprobacion en otras instancias del flujo + */ + @Override + public void save() { + try { + if (lrecord != null && lrecord.size() > 0) { + if (validaSiExisteArmasSeleccionadas()) { + TarmCabRepDestruirArmas cabeceraReporteObj = new TarmCabRepDestruirArmas(); + cabeceraReporteObj.setFreporte((java.sql.Date) fechaCorte); + xPathLocation = getRutaDocumentoRepBase() + "/cm:BAJA"; + cabeceraReporteObj.setXpath(xPathLocation); + cabeceraReporteObj.setIsnew(Boolean.TRUE); + //Guarda la ruta donde se almacenara el reporte + cabRepDestruirArmasController.update(cabeceraReporteObj); + Boolean existArmasEnReporte = Boolean.FALSE; + for (TarmDecomisoArma decomisoArmaObj : lrecord) { + if (decomisoArmaObj.getAdestruirse() == null) { + if (decomisoArmaObj.getModifiedData().get("isSelect") == null || decomisoArmaObj.getModifiedData().get("isSelect").equals(Boolean.FALSE)) { + continue; + } + TarmDetRepDestruirArmas detalleReporteObj = new TarmDetRepDestruirArmas(); + detalleReporteObj.setIsnew(Boolean.TRUE); + if (decomisoArmaObj.getCdecomiso() != null) { + detalleReporteObj.setCdecomisoarma(decomisoArmaObj.getPk()); + } + if (decomisoArmaObj.getModifiedData().get("nclase") != null) { + detalleReporteObj.setClase(decomisoArmaObj.getModifiedData().get("nclase").toString()); + } + if (decomisoArmaObj.getModifiedData().get("ntipo") != null) { + detalleReporteObj.setTipo(decomisoArmaObj.getModifiedData().get("ntipo").toString()); + } + if (decomisoArmaObj.getModifiedData().get("ncalibre") != null) { + detalleReporteObj.setCalibre(decomisoArmaObj.getModifiedData().get("ncalibre").toString()); + } + if (decomisoArmaObj.getModifiedData().get("nmarca") != null) { + detalleReporteObj.setMarca(decomisoArmaObj.getModifiedData().get("nmarca").toString()); + } + if (decomisoArmaObj.getModifiedData().get("nserie") != null) { + detalleReporteObj.setSerie(decomisoArmaObj.getModifiedData().get("nserie").toString()); + } + if (decomisoArmaObj.getCantidad() != null) { + detalleReporteObj.setCantidad(decomisoArmaObj.getCantidad().toString()); + } + if (decomisoArmaObj.getModifiedData().get("nunidad") != null) { + detalleReporteObj.setUnidad(decomisoArmaObj.getModifiedData().get("nunidad").toString()); + } + if (decomisoArmaObj.getFdecomiso() != null) { + java.sql.Date date = new java.sql.Date(decomisoArmaObj.getFdecomiso().getTime()); + detalleReporteObj.setFdecomiso(date); + } + if (decomisoArmaObj.getModifiedData().get("npropietario") != null) { + detalleReporteObj.setPropietario(decomisoArmaObj.getModifiedData().get("npropietario").toString()); + } + if (decomisoArmaObj.getModifiedData().get("nrecibo") != null) { + detalleReporteObj.setNrecibo(decomisoArmaObj.getModifiedData().get("nrecibo").toString()); + } + if (!existArmasEnReporte) { + existArmasEnReporte = Boolean.TRUE; + } + + // Marca que indica que el arma decomisada ya se encuentra dentro de un reporte de armas a destruir + decomisoArmaObj.setAdestruirse(aDestruirseCatalog.getPk().getCatalog()); + decomisoArmaObj.setAdestruirsecode(aDestruirseCatalog.getPk().getCatalogcode()); + record = decomisoArmaObj; + super.update(); + detRepDestruirArmasController.update(detalleReporteObj); + + } + } + + if (existArmasEnReporte) { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + dtosave.setPosition(1); + + DtoSave dtoSaveCabecera = cabRepDestruirArmasController.getDtoSave(); + dtoSaveCabecera.setIsForm(Boolean.TRUE); + dtoSaveCabecera.setReturnpk(Boolean.TRUE); + dtoSaveCabecera.setPosition(2); + + DtoSave dtoSaveDetalle = detRepDestruirArmasController.getDtoSave(); + dtoSaveDetalle.setReturnpk(Boolean.TRUE); + dtoSaveDetalle.setPosition(3); + + HashMap msave = new HashMap(); + + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + msave.put(cabRepDestruirArmasController.getBeanalias(), dtoSaveCabecera); + msave.put(detRepDestruirArmasController.getBeanalias(), dtoSaveDetalle); + + request.setSaveTables(msave); + + Response resp = this.callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.cabRepDestruirArmasController.postCommit(resp); + this.detRepDestruirArmasController.postCommit(resp); + isEnableGrabar = Boolean.FALSE; + isEnableEnviar = Boolean.TRUE; + MessageHelper.setMessageInfo(resp); + this.nombreReporte = resp.get("nombreReporte").toString(); + this.creporte = resp.get("creporte").toString(); + this.xPath = resp.get("xpath").toString(); + } else { + MessageHelper.setMessageError(resp); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccioneAlmenosUnArma")); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccioneAlmenosUnArma")); + } + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo usado para validar si existen armas seleccionadas por el usuario + */ + public Boolean validaSiExisteArmasSeleccionadas() { + Boolean bandera = Boolean.FALSE; + if (lrecord != null && lrecord.size() > 0) { + for (TarmDecomisoArma decomisoArmaObj : lrecord) { + if (decomisoArmaObj.getModifiedData().get("isSelect") != null && decomisoArmaObj.getModifiedData().get("isSelect").equals(Boolean.TRUE)) { + bandera = Boolean.TRUE; + } + } + } + return bandera; + } + + /** + * Metodo que inicia el flujo de baja y destruccion de armas + */ + public void iniciarFlujo() { + try { + if (seGeneroReporte) { + Request request = this.callerhelper.getRequest(); + super.cleanRequest(request); + request.modifiedData().put("isnew", "Y"); + request.modifiedData().put("xpath", this.xPath); + request.modifiedData().put("creporte", this.creporte); + request.modifiedData().put("cprovincia", cprovincia); + request.setLogsolicitude(this.creporte); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + isEnableEnviar = Boolean.FALSE; +// RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generarReporteRequerido")); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public Date getFechaCorte() { + return fechaCorte; + } + + public void setFechaCorte(Date fechaCorte) { + this.fechaCorte = fechaCorte; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public Integer getDiasParaDestruirArma() { + return diasParaDestruirArma; + } + + public void setDiasParaDestruirArma(Integer diasParaDestruirArma) { + this.diasParaDestruirArma = diasParaDestruirArma; + } + + public CabRepDestruirArmasController getCabRepDestruirArmasController() { + return cabRepDestruirArmasController; + } + + public void setCabRepDestruirArmasController( + CabRepDestruirArmasController cabRepDestruirArmasController) { + this.cabRepDestruirArmasController = cabRepDestruirArmasController; + } + + public DetRepDestruirArmasController getDetRepDestruirArmasController() { + return detRepDestruirArmasController; + } + + public void setDetRepDestruirArmasController( + DetRepDestruirArmasController detRepDestruirArmasController) { + this.detRepDestruirArmasController = detRepDestruirArmasController; + } + + public TgeneCatalogDetail getaDestruirseCatalog() { + return aDestruirseCatalog; + } + + public void setaDestruirseCatalog(TgeneCatalogDetail aDestruirseCatalog) { + this.aDestruirseCatalog = aDestruirseCatalog; + } + + public String getxPathLocation() { + return xPathLocation; + } + + public void setxPathLocation(String xPathLocation) { + this.xPathLocation = xPathLocation; + } + + public String getNombreReporte() { + return nombreReporte; + } + + public void setNombreReporte(String nombreReporte) { + this.nombreReporte = nombreReporte; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public String getCreporte() { + return creporte; + } + + public void setCreporte(String creporte) { + this.creporte = creporte; + } + + public Boolean getSeGeneroReporte() { + return seGeneroReporte; + } + + public void setSeGeneroReporte(Boolean seGeneroReporte) { + this.seGeneroReporte = seGeneroReporte; + } + + public Boolean getIsEnableGrabar() { + return isEnableGrabar; + } + + public void setIsEnableGrabar(Boolean isEnableGrabar) { + this.isEnableGrabar = isEnableGrabar; + } + + public Boolean getIsEnableEnviar() { + return isEnableEnviar; + } + + public void setIsEnableEnviar(Boolean isEnableEnviar) { + this.isEnableEnviar = isEnableEnviar; + } + + /** + * Metodo encargado de marcar un registro de la tabla como seleccionado + */ + public void seleccionarArma(AjaxBehaviorEvent event) { + try { + SelectBooleanCheckbox booleanCheckbox = (SelectBooleanCheckbox) event.getComponent(); + record = (TarmDecomisoArma) booleanCheckbox.getAttributes().get("armaDecomisadaObj"); + boolean checked = (Boolean) booleanCheckbox.getValue(); + if (checked) { + record.getModifiedData().put("isSelect", Boolean.TRUE); + } else { + record.getModifiedData().put("isSelect", Boolean.FALSE); + this.getMfilelds().put("seleccionarTodos", Boolean.FALSE); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Metodo encargado de obtener todas las claves primarias de los elementos + * seleccionados en la tabla + */ + public Collection actualizarArmasSeleccionadas() { + List armasSeleccionadasLst = new ArrayList<>(); + for (TarmDecomisoArma decomisoArmaObj : lrecord) { + if (decomisoArmaObj.getModifiedData().get("isSelect").equals(Boolean.TRUE)) { + armasSeleccionadasLst.add(decomisoArmaObj.getPk()); + } + } + return armasSeleccionadasLst; + } + + /** + * Metodo encargado de verificar si existe al menos un registro seleccionado + * en la tabla + */ + public Boolean existeArmasSeleccionadas() { + Boolean flag = Boolean.FALSE; + for (TarmDecomisoArma decomisoArmaObj : lrecord) { + if (decomisoArmaObj.getModifiedData().get("isSelect").equals(Boolean.TRUE)) { + flag = Boolean.TRUE; + break; + } + } + return flag; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteEstadisticasTramitesController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteEstadisticasTramitesController.java new file mode 100644 index 0000000..bf22f67 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteEstadisticasTramitesController.java @@ -0,0 +1,298 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de reporte de liquidacion economica + * + * @author Christian Pazmino. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReporteEstadisticasTramitesController extends AbstractController { + + /** + * Fecha a partir de la cual se sacan datos para el reporte + * + */ + private Date fechaInicio; + /** + * Fecha a partir de la cual se sacan datos para el reporte + * + */ + private Date fechaFin; + /** + * Formato de reporte que se va a generar + * + */ + private String format = "pdf"; + /** + * Usuario actual logueado en el sistema + * + */ + private TsafeUserDetail userDetail; + /** + * Nombre del reporte generado en el Alfresco + * + */ + private String nombreReporte; + + /** + * Id del centro de control seleccionado por el usuario + * + */ + private String idCentroControl; + + /** + * Id del tipo de tramite + */ + private String idAutorizacion; + + /** + * Lista de centros de control de armas + */ + private List centroControlList; + + private List autorizacionList; + + private String institucionCentroControl = ""; + private TarmCentroControl centroControl = new TarmCentroControl(); + + /** + * Clase controladora de reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{logincontroller}") + private LoginController logincontroller; + + public ReporteEstadisticasTramitesController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + recperpage = 10000; // Cambiar al # reg a mirar. + beanalias = "RPRTEESTADISTICASTRAMITE"; + centroControlList = CentroControlArmasController.findAll(); + autorizacionList = CatalogDetailController.find("TIPOAUTORIZACION"); + obtenerCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport() { + Calendar fechaActualCldr = Calendar.getInstance(); + String path = "armas/reports/estadisticastramites"; + String filename = "estadisticastramites"; + String nombreUsuario = ""; + + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } else { + nombreUsuario = ""; + } + + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("unidadmilitar", institucionCentroControl); + parameters.put("lugarFecha", Utilidades.armarFormatoFechaConHora(fechaActualCldr)); + parameters.put("usuario", nombreUsuario); + parameters.put("idCentroControl", "TODOS".equalsIgnoreCase(idCentroControl) ? null : idCentroControl); + parameters.put("idAutorizacion", "TODOS".equalsIgnoreCase(idAutorizacion) ? null : idAutorizacion); + parameters.put("fechaInicio", this.fechaInicio == null ? null : Utilidades.armarFormatoFechaSinHora(this.fechaInicio)); + parameters.put("fechaFin", this.fechaFin == null ? null : Utilidades.armarFormatoFechaSinHora(this.fechaFin)); + + try { + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } + + private void obtenerCentroControl() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Método para el inicio de flujo. Guardar el reporte creado para su + * posterior aprobacion en otras instancias del flujo + */ + @Override + public void save() { + + } + + public Date getFechaInicio() { + return fechaInicio; + } + + public void setFechaInicio(Date fechaInicio) { + this.fechaInicio = fechaInicio; + } + + public Date getFechaFin() { + return fechaFin; + } + + public void setFechaFin(Date fechaFin) { + this.fechaFin = fechaFin; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public String getNombreReporte() { + return nombreReporte; + } + + public void setNombreReporte(String nombreReporte) { + this.nombreReporte = nombreReporte; + } + + public String getIdCentroControl() { + return idCentroControl; + } + + public void setIdCentroControl(String idCentroControl) { + this.idCentroControl = idCentroControl; + } + + public String getIdAutorizacion() { + return idAutorizacion; + } + + public void setIdAutorizacion(String idAutorizacion) { + this.idAutorizacion = idAutorizacion; + } + + public List getCentroControlList() { + return centroControlList; + } + + public void setCentroControlList(List centroControlList) { + this.centroControlList = centroControlList; + } + + public List getAutorizacionList() { + return autorizacionList; + } + + public void setAutorizacionList(List autorizacionList) { + this.autorizacionList = autorizacionList; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public LoginController getLogincontroller() { + return logincontroller; + } + + public void setLogincontroller(LoginController logincontroller) { + this.logincontroller = logincontroller; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteIngresoVentaArmExpController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteIngresoVentaArmExpController.java new file mode 100644 index 0000000..5de9292 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteIngresoVentaArmExpController.java @@ -0,0 +1,419 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.PersonPhoneController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de reporte de liquidacion economica + * + * @author Christian Pazmino. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReporteIngresoVentaArmExpController extends AbstractController { + + /** + * Fecha a partir de la cual se sacan datos para el reporte + * + */ + private Date fechaInicio; + /** + * Fecha a partir de la cual se sacan datos para el reporte + * + */ + private Date fechaFin; + /** + * Formato de reporte que se va a generar + * + */ + private String format = "pdf"; + /** + * Usuario actual logueado en el sistema + * + */ + private TsafeUserDetail userDetail; + /** + * Nombre del reporte generado en el Alfresco + * + */ + private String nombreReporte; + /** + * Id del centro de control seleccionado por el usuario + * + */ + private String numeroDocumento; + + /** + * Tipo de documento seleccionado cedula/ruc + */ + private String tipoDocumento; + /** + * Lista de centros de control de armas + */ + private List centroControlList; + /** + * Codigo del catalogo de PHONETYPE telefono fijo + */ + private String codigoTelefonoFijo; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de + * identificación + */ + private List ltipoidenti; + + /** + * Clase controladora de reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + public ReporteIngresoVentaArmExpController() throws Exception { + super(TarmDecomisoArma.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + recperpage = 10000; // Cambiar al # reg a mirar. + lrecord = new ArrayList(); + codigoTelefonoFijo = codigos("CODIGO.PHONE.FIJO"); + beanalias = "RPRTELIQUIDACIONECONOMICA"; + centroControlList = CentroControlArmasController.findAll(); + //TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + ltipoidenti = CatalogDetailController.find("IDENTIFICATION"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para obtener los codigos + */ + public String codigos(String parametro) { + TgeneParameters tgeneParameters = ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + + } + + /** + * Metodo para reconsultar en base a una nueva fecha de corte seleccionada + */ + public void cambioFechaDeCorte(SelectEvent event) { + querydatabase(); + } + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport2() { + + if (this.fechaInicio.getTime() > this.fechaFin.getTime()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaFin")); + return; + } + if (this.fechaInicio.getTime() > new Date().getTime()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaActual")); + return; + } + if (this.fechaFin.getTime() > new Date().getTime()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaFinMayorAFechaActual")); + return; + } + try { + String path = "armas/reports/ingresoVentaArmasExplosivos"; + String filename = "ingresoVentaArmasExplosivos"; + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //usuario + TsafeUserDetail tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personLoged = PersonDetailController.find(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + TcustPersonDetail personConsulted = PersonDetailController.findByIdentification(this.numeroDocumento); + parameters.put("usuario", personLoged.getName()); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fechaInicio", sdf.format(this.fechaInicio)); + parameters.put("fechaFin", sdf.format(this.fechaFin)); + parameters.put("fechaReporte", sdf.format(new Date())); + + if (personConsulted != null) { + parameters.put("nombreRazonSocial", personConsulted.getName()); + parameters.put("tipoDocumento", personConsulted.getIdentificationcatalog()); + parameters.put("numeroDocumento", personConsulted.getIdentification()); + parameters.put("representanteLegal", personConsulted.getLegalrepresent()); + parameters.put("representanteLegalIdent", personConsulted.getLegalrepresentidentification()); + parameters.put("personcode", personConsulted.getPk().getPersoncode().toString()); + PersonAddressController address = new PersonAddressController(); + TcustPersonAddress personAddress = address.findPrincipal(personConsulted.getPk().getPersoncode().toString()); + if (personAddress != null) { + parameters.put("direccion", personAddress.getAddress()); + } else { + parameters.put("direccion", ""); + } + } + + TcustPersonPhone personPhone = PersonPhoneController.find(personConsulted.getPk().getPersoncode().toString(), "2"); + if (personPhone != null && personPhone.getPhonenumber() != null) { + parameters.put("telefono", personPhone.getPhonenumber()); + } else { + parameters.put("telefono", ""); + } + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception e) { + // TODO: handle exception + } + + } + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport() { + Calendar fechaActualCldr = Calendar.getInstance(); + Calendar fechaInicioCldr = Calendar.getInstance(); + Calendar fechaFinCldr = Calendar.getInstance(); + fechaInicioCldr.setTime(fechaInicio); + fechaFinCldr.setTime(fechaFin); + if (fechaActualCldr.compareTo(fechaInicioCldr) >= 0) { + if (fechaActualCldr.compareTo(fechaFinCldr) >= 0) { + if (fechaFinCldr.compareTo(fechaInicioCldr) >= 0) { + String filename = "ingresoVentaArmasExplosivos"; + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } else { + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario); + parameters.put("fechaInicio", armarFormatoFechaSinHora(fechaInicioCldr)); + parameters.put("fechaFin", armarFormatoFechaSinHora(fechaFinCldr)); + parameters.put("fechaReporte", armarFormatoFechaConHora(fechaActualCldr)); + + String path; + + path = "armas/reports/ingresoVentaArmasExplosivos"; + parameters.put("numeroDocumento", numeroDocumento); + // Persona objetivo de la consulta de movimientos + TcustPersonDetail personDetailConsultadaObj = PersonDetailController.findxidentification(numeroDocumento, tipoDocumento); + if (personDetailConsultadaObj != null) { + parameters.put("nombreRazonSocial", personDetailConsultadaObj.getName()); + parameters.put("tipoDocumento", tipoDocumento); + parameters.put("numeroDocumento", personDetailConsultadaObj.getIdentification()); + parameters.put("representanteLegal", personDetailConsultadaObj.getLegalrepresent()); + parameters.put("representanteLegalIdent", personDetailConsultadaObj.getLegalrepresentidentification()); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddresObj = personAddressController.findPrincipal(personDetailConsultadaObj.getPk().getPersoncode().toString()); + if (tcustPersonAddresObj != null) { + parameters.put("direccion", tcustPersonAddresObj.getAddress()); + } else { + parameters.put("direccion", ""); + } + TcustPersonPhone personPhoneObj = PersonPhoneController.find(personDetailConsultadaObj.getPk().getPersoncode().toString(), codigoTelefonoFijo); + if (personPhoneObj != null) { + parameters.put("telefono", personPhoneObj.getPhonenumber()); + } else { + parameters.put("telefono", ""); + } + } + + // Datos del CENTRO DE CONTROL +// TarmCentroControl centroControlObj = CentroControlArmasController.findPorCodigo(idCentroControl); +// String nombreCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControlObj.getNombreinstitucion(),centroControlObj.getNombreinstitucioncodigo()).getDescription(); +// parameters.put("nombreCentroControl", nombreCentroControl); +// // Datos del jefe del centro +// if(centroControlObj.getPersoncode()!=null){ +// TcustPersonDetail supervisorMilitarObj = PersonDetailController.find(centroControlObj.getPersoncode().toString()); +// String gradoSupMilitar = supervisorMilitarObj.getMilitarygrade()==null?"": supervisorMilitarObj.getMilitarygrade() + " - "; +// parameters.put("nombreJefCentro", gradoSupMilitar + supervisorMilitarObj.getName()==null?"":supervisorMilitarObj.getName()); +// parameters.put("personCodeJefCentro", supervisorMilitarObj.getPk().getPersoncode()==null?"1001":supervisorMilitarObj.getPk().getPersoncode()); +// +// } + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaFin")); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaFinMayorAFechaActual")); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaActual")); + } + + } + +// parameters.put("fechaCorte", fechaCorteSB.toString()); +// parameters.put("codArmasDecomisadasLst", actualizarArmasSeleccionadas()); + public StringBuilder armarFormatoFechaSinHora(Calendar fechaCldr) { + StringBuilder fechaStr = new StringBuilder(); + fechaStr = fechaStr.append((fechaCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCldr.get(Calendar.DAY_OF_MONTH))); + fechaStr = fechaStr.append("-").append((fechaCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaCldr.get(Calendar.MONTH) + 1) : (fechaCldr.get(Calendar.MONTH) + 1)); + fechaStr = fechaStr.append("-").append(fechaCldr.get(Calendar.YEAR)); + return fechaStr; + } + + public StringBuilder armarFormatoFechaConHora(Calendar fechaCldr) { + StringBuilder fechaStr = new StringBuilder(); + fechaStr = fechaStr.append((fechaCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCldr.get(Calendar.DAY_OF_MONTH))); + fechaStr = fechaStr.append("-").append((fechaCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaCldr.get(Calendar.MONTH) + 1) : (fechaCldr.get(Calendar.MONTH) + 1)); + fechaStr = fechaStr.append("-").append(fechaCldr.get(Calendar.YEAR)); + fechaStr = fechaStr.append(" ").append(fechaCldr.get(Calendar.HOUR_OF_DAY)); + fechaStr = fechaStr.append(":").append((fechaCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaCldr.get(Calendar.MINUTE)) : (fechaCldr.get(Calendar.MINUTE))); + return fechaStr; + } + + /** + * Método para el inicio de flujo. Guardar el reporte creado para su + * posterior aprobacion en otras instancias del flujo + */ + @Override + public void save() { + + } + + public Date getFechaInicio() { + return fechaInicio; + } + + public void setFechaInicio(Date fechaInicio) { + this.fechaInicio = fechaInicio; + } + + public Date getFechaFin() { + return fechaFin; + } + + public void setFechaFin(Date fechaFin) { + this.fechaFin = fechaFin; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public String getNombreReporte() { + return nombreReporte; + } + + public void setNombreReporte(String nombreReporte) { + this.nombreReporte = nombreReporte; + } + + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public String getTipoDocumento() { + return tipoDocumento; + } + + public void setTipoDocumento(String tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } + + public List getLtipoidenti() { + return ltipoidenti; + } + + public void setLtipoidenti(List ltipoidenti) { + this.ltipoidenti = ltipoidenti; + } + + public List getCentroControlList() { + return centroControlList; + } + + public void setCentroControlList(List centroControlList) { + this.centroControlList = centroControlList; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteIngresoVentaArmExpUserController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteIngresoVentaArmExpUserController.java new file mode 100644 index 0000000..7029d4c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteIngresoVentaArmExpUserController.java @@ -0,0 +1,433 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.PersonPhoneController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de reporte de liquidacion economica + * + * @author Christian Pazmino. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReporteIngresoVentaArmExpUserController extends AbstractController { + + /** + * Fecha a partir de la cual se sacan datos para el reporte + * + */ + private Date fechaInicio; + /** + * Fecha a partir de la cual se sacan datos para el reporte + * + */ + private Date fechaFin; + /** + * Formato de reporte que se va a generar + * + */ + private String format = "pdf"; + /** + * Usuario actual logueado en el sistema + * + */ + private TsafeUserDetail userDetail; + /** + * Nombre del reporte generado en el Alfresco + * + */ + private String nombreReporte; + /** + * Id del centro de control seleccionado por el usuario + * + */ + private String numeroDocumento; + + /** + * Tipo de documento seleccionado cedula/ruc + */ + private String tipoDocumento; + /** + * Lista de centros de control de armas + */ + private List centroControlList; + /** + * Codigo del catalogo de PHONETYPE telefono fijo + */ + private String codigoTelefonoFijo; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de + * identificación + */ + private List ltipoidenti; + + /** + * Clase controladora de reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + private String razonSocial; + + public ReporteIngresoVentaArmExpUserController() throws Exception { + super(TarmDecomisoArma.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + recperpage = 10000; // Cambiar al # reg a mirar. + lrecord = new ArrayList(); + codigoTelefonoFijo = codigos("CODIGO.PHONE.FIJO"); + beanalias = "RPRTELIQUIDACIONECONOMICA"; + centroControlList = CentroControlArmasController.findAll(); + //TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + ltipoidenti = CatalogDetailController.find("IDENTIFICATION"); + if (userDetail.getPk().getPersoncode() != null) { + razonSocial = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + numeroDocumento = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getIdentification(); + } else { + razonSocial = ""; + numeroDocumento = ""; + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para obtener los codigos + */ + public String codigos(String parametro) { + TgeneParameters tgeneParameters = ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + + } + + /** + * Metodo para reconsultar en base a una nueva fecha de corte seleccionada + */ + public void cambioFechaDeCorte(SelectEvent event) { + querydatabase(); + } + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport2() { + + if (this.fechaInicio.getTime() > this.fechaFin.getTime()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaFin")); + return; + } + if (this.fechaInicio.getTime() > new Date().getTime()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaActual")); + return; + } + if (this.fechaFin.getTime() > new Date().getTime()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaFinMayorAFechaActual")); + return; + } + try { + String path = "armas/reports/ingresoVentaArmasExplosivosUser"; + String filename = "ingresoVentaArmasExplosivos"; + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //usuario + TsafeUserDetail tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personLoged = PersonDetailController.find(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + TcustPersonDetail personConsulted = PersonDetailController.findByIdentification(this.numeroDocumento); + parameters.put("usuario", personLoged.getName()); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fechaInicio", sdf.format(this.fechaInicio)); + parameters.put("fechaFin", sdf.format(this.fechaFin)); + parameters.put("fechaReporte", sdf.format(new Date())); + + if (personConsulted != null) { + parameters.put("nombreRazonSocial", personConsulted.getName()); + parameters.put("tipoDocumento", personConsulted.getIdentificationcatalog()); + parameters.put("numeroDocumento", personConsulted.getIdentification()); + parameters.put("representanteLegal", personConsulted.getLegalrepresent()); + parameters.put("representanteLegalIdent", personConsulted.getLegalrepresentidentification()); + parameters.put("personcode", personConsulted.getPk().getPersoncode().toString()); + PersonAddressController address = new PersonAddressController(); + TcustPersonAddress personAddress = address.findPrincipal(personConsulted.getPk().getPersoncode().toString()); + if (personAddress != null) { + parameters.put("direccion", personAddress.getAddress()); + } else { + parameters.put("direccion", ""); + } + } + + TcustPersonPhone personPhone = PersonPhoneController.find(personConsulted.getPk().getPersoncode().toString(), "2"); + if (personPhone != null && personPhone.getPhonenumber() != null) { + parameters.put("telefono", personPhone.getPhonenumber()); + } else { + parameters.put("telefono", ""); + } + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception e) { + // TODO: handle exception + } + + } + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport() { + Calendar fechaActualCldr = Calendar.getInstance(); + Calendar fechaInicioCldr = Calendar.getInstance(); + Calendar fechaFinCldr = Calendar.getInstance(); + fechaInicioCldr.setTime(fechaInicio); + fechaFinCldr.setTime(fechaFin); + if (fechaActualCldr.compareTo(fechaInicioCldr) >= 0) { + if (fechaActualCldr.compareTo(fechaFinCldr) >= 0) { + if (fechaFinCldr.compareTo(fechaInicioCldr) >= 0) { + String filename = "ingresoVentaArmasExplosivos"; + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } else { + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario); + parameters.put("fechaInicio", armarFormatoFechaSinHora(fechaInicioCldr)); + parameters.put("fechaFin", armarFormatoFechaSinHora(fechaFinCldr)); + parameters.put("fechaReporte", armarFormatoFechaConHora(fechaActualCldr)); + + String path; + + path = "armas/reports/ingresoVentaArmasExplosivos"; + parameters.put("numeroDocumento", numeroDocumento); + // Persona objetivo de la consulta de movimientos + TcustPersonDetail personDetailConsultadaObj = PersonDetailController.findxidentification(numeroDocumento, tipoDocumento); + if (personDetailConsultadaObj != null) { + parameters.put("nombreRazonSocial", personDetailConsultadaObj.getName()); + parameters.put("tipoDocumento", tipoDocumento); + parameters.put("numeroDocumento", personDetailConsultadaObj.getIdentification()); + parameters.put("representanteLegal", personDetailConsultadaObj.getLegalrepresent()); + parameters.put("representanteLegalIdent", personDetailConsultadaObj.getLegalrepresentidentification()); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddresObj = personAddressController.findPrincipal(personDetailConsultadaObj.getPk().getPersoncode().toString()); + if (tcustPersonAddresObj != null) { + parameters.put("direccion", tcustPersonAddresObj.getAddress()); + } else { + parameters.put("direccion", ""); + } + TcustPersonPhone personPhoneObj = PersonPhoneController.find(personDetailConsultadaObj.getPk().getPersoncode().toString(), codigoTelefonoFijo); + if (personPhoneObj != null) { + parameters.put("telefono", personPhoneObj.getPhonenumber()); + } else { + parameters.put("telefono", ""); + } + } + + // Datos del CENTRO DE CONTROL +// TarmCentroControl centroControlObj = CentroControlArmasController.findPorCodigo(idCentroControl); +// String nombreCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControlObj.getNombreinstitucion(),centroControlObj.getNombreinstitucioncodigo()).getDescription(); +// parameters.put("nombreCentroControl", nombreCentroControl); +// // Datos del jefe del centro +// if(centroControlObj.getPersoncode()!=null){ +// TcustPersonDetail supervisorMilitarObj = PersonDetailController.find(centroControlObj.getPersoncode().toString()); +// String gradoSupMilitar = supervisorMilitarObj.getMilitarygrade()==null?"": supervisorMilitarObj.getMilitarygrade() + " - "; +// parameters.put("nombreJefCentro", gradoSupMilitar + supervisorMilitarObj.getName()==null?"":supervisorMilitarObj.getName()); +// parameters.put("personCodeJefCentro", supervisorMilitarObj.getPk().getPersoncode()==null?"1001":supervisorMilitarObj.getPk().getPersoncode()); +// +// } + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaFin")); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaFinMayorAFechaActual")); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaActual")); + } + + } + +// parameters.put("fechaCorte", fechaCorteSB.toString()); +// parameters.put("codArmasDecomisadasLst", actualizarArmasSeleccionadas()); + public StringBuilder armarFormatoFechaSinHora(Calendar fechaCldr) { + StringBuilder fechaStr = new StringBuilder(); + fechaStr = fechaStr.append((fechaCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCldr.get(Calendar.DAY_OF_MONTH))); + fechaStr = fechaStr.append("-").append((fechaCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaCldr.get(Calendar.MONTH) + 1) : (fechaCldr.get(Calendar.MONTH) + 1)); + fechaStr = fechaStr.append("-").append(fechaCldr.get(Calendar.YEAR)); + return fechaStr; + } + + public StringBuilder armarFormatoFechaConHora(Calendar fechaCldr) { + StringBuilder fechaStr = new StringBuilder(); + fechaStr = fechaStr.append((fechaCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCldr.get(Calendar.DAY_OF_MONTH))); + fechaStr = fechaStr.append("-").append((fechaCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaCldr.get(Calendar.MONTH) + 1) : (fechaCldr.get(Calendar.MONTH) + 1)); + fechaStr = fechaStr.append("-").append(fechaCldr.get(Calendar.YEAR)); + fechaStr = fechaStr.append(" ").append(fechaCldr.get(Calendar.HOUR_OF_DAY)); + fechaStr = fechaStr.append(":").append((fechaCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaCldr.get(Calendar.MINUTE)) : (fechaCldr.get(Calendar.MINUTE))); + return fechaStr; + } + + /** + * Método para el inicio de flujo. Guardar el reporte creado para su + * posterior aprobacion en otras instancias del flujo + */ + @Override + public void save() { + + } + + public Date getFechaInicio() { + return fechaInicio; + } + + public void setFechaInicio(Date fechaInicio) { + this.fechaInicio = fechaInicio; + } + + public Date getFechaFin() { + return fechaFin; + } + + public void setFechaFin(Date fechaFin) { + this.fechaFin = fechaFin; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public String getNombreReporte() { + return nombreReporte; + } + + public void setNombreReporte(String nombreReporte) { + this.nombreReporte = nombreReporte; + } + + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public String getTipoDocumento() { + return tipoDocumento; + } + + public void setTipoDocumento(String tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } + + public List getLtipoidenti() { + return ltipoidenti; + } + + public void setLtipoidenti(List ltipoidenti) { + this.ltipoidenti = ltipoidenti; + } + + public List getCentroControlList() { + return centroControlList; + } + + public void setCentroControlList(List centroControlList) { + this.centroControlList = centroControlList; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getRazonSocial() { + return razonSocial; + } + + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteInspeccionesRealizadasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteInspeccionesRealizadasController.java new file mode 100644 index 0000000..36194a5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteInspeccionesRealizadasController.java @@ -0,0 +1,430 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.primefaces.component.selectbooleancheckbox.SelectBooleanCheckbox; +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmCabRepDestruirArmas; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDetRepDestruirArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de reporte de liquidacion economica + * + * @author Christian Pazmino. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReporteInspeccionesRealizadasController extends AbstractController { + + /** + * Fecha a partir de la cual se sacan datos para el reporte + * + */ + private Date fechaInicio; + /** + * Fecha a partir de la cual se sacan datos para el reporte + * + */ + private Date fechaFin; + /** + * Formato de reporte que se va a generar + * + */ + private String format = "pdf"; + /** + * Usuario actual logueado en el sistema + * + */ + private TsafeUserDetail userDetail; + /** + * Nombre del reporte generado en el Alfresco + * + */ + private String nombreReporte; + /** + * Id del centro de control seleccionado por el usuario + * + */ + private String idCentroControl; + /** + * Lista de centros de control de armas + */ + private List centroControlList; + +// private List lTipoReporte=new ArrayList(); + private TsafeUserDetail tsafeUserDetailUsuario = null; + + private TarmCentroControl centroControl = new TarmCentroControl(); + + private TcustPersonDetail responsableCentroControl = null; + + /** + * Clase controladora de reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + public ReporteInspeccionesRealizadasController() throws Exception { + super(TarmDecomisoArma.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + recperpage = 10000; // Cambiar al # reg a mirar. + lrecord = new ArrayList(); + beanalias = "RPRTELIQUIDACIONECONOMICA"; + centroControlList = CentroControlArmasController.findEstado("Y"); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + this.responsableCentroControl = new TcustPersonDetail(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + +// /** +// * Crea una instancia y marca el registro como nuevo. +// * +// * @throws Exception +// */ +// @Override +// public void create() throws Exception { +// super.create(); +// } + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if (Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")) { + valorColocar = Boolean.TRUE; + } + for (TarmDecomisoArma decomisoArmaObj : lrecord) { + decomisoArmaObj.getModifiedData().put("isSelect", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + + } + + /** + * Metodo para reconsultar en base a una nueva fecha de corte seleccionada + */ + public void cambioFechaDeCorte(SelectEvent event) { + querydatabase(); + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if (tcustPersonAddres == null) { + return null; + } + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl() { + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport2() { + String filtro = ""; + + if (this.fechaInicio.getTime() > this.fechaFin.getTime()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaFin")); + return; + } + if (this.fechaInicio.getTime() > new Date().getTime()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaActual")); + return; + } + if (this.fechaFin.getTime() > new Date().getTime()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaFinMayorAFechaActual")); + return; + } + try { + String path = "armas/reports/inspeccionesRealizadas"; + String filename = "inspeccionesRealizadas"; + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //usuario + TsafeUserDetail tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail person = PersonDetailController.find(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + parameters.put("usuario", person.getName()); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fechaInicio", sdf.format(this.fechaInicio)); + parameters.put("fechaFin", sdf.format(this.fechaFin)); + parameters.put("fechaReporte", sdf.format(new Date())); + + if (this.idCentroControl.equals("TODOS")) { + parameters.put("filtro", ""); + } else { + filtro = " and c.ccentrocontrol = '" + this.idCentroControl + "' "; + parameters.put("filtro", filtro); + } + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception e) { + // TODO: handle exception + } + + } + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport() { + Calendar fechaActualCldr = Calendar.getInstance(); + Calendar fechaInicioCldr = Calendar.getInstance(); + Calendar fechaFinCldr = Calendar.getInstance(); + fechaInicioCldr.setTime(fechaInicio); + fechaFinCldr.setTime(fechaFin); + if (fechaActualCldr.compareTo(fechaInicioCldr) >= 0) { + if (fechaActualCldr.compareTo(fechaFinCldr) >= 0) { + if (fechaFinCldr.compareTo(fechaInicioCldr) >= 0) { + String filename = "inspeccionesRealizadas"; + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } else { + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario); + parameters.put("fechaInicio", armarFormatoFechaSinHora(fechaInicioCldr)); + fechaFinCldr.add(Calendar.DAY_OF_MONTH, 1); + parameters.put("fechaFin", armarFormatoFechaSinHora(fechaFinCldr)); + parameters.put("fechaReporte", armarFormatoFechaConHora(fechaActualCldr)); + + String path; + if (!idCentroControl.equalsIgnoreCase("TODOS")) { + path = "armas/reports/inspeccionesRealizadas"; + parameters.put("idCentroControl", idCentroControl); + // Datos del CENTRO DE CONTROL + TarmCentroControl centroControlObj = CentroControlArmasController.findPorCodigo(idCentroControl); + String nombreCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControlObj.getNombreinstitucion(), centroControlObj.getNombreinstitucioncodigo()).getDescription(); + parameters.put("nombreCentroControl", nombreCentroControl); + // Datos del jefe del centro + if (centroControlObj.getPersoncode() != null) { + TcustPersonDetail supervisorMilitarObj = PersonDetailController.find(centroControlObj.getPersoncode().toString()); + String gradoSupMilitar = supervisorMilitarObj.getMilitarygrade() == null ? "" : supervisorMilitarObj.getMilitarygrade() + " - "; + parameters.put("nombreJefCentro", gradoSupMilitar + supervisorMilitarObj.getName() == null ? "" : supervisorMilitarObj.getName()); + parameters.put("personCodeJefCentro", supervisorMilitarObj.getPk().getPersoncode() == null ? "1001" : supervisorMilitarObj.getPk().getPersoncode()); + + } + } else { + path = "armas/reports/inspeccionesRealizadas"; + filename = "inspeccionesRealizadasCCA"; + parameters.put("idCentroControl", null); + parameters.put("nombreCentroControl", "TODOS"); + parameters.put("nombreJefCentro", "Juan Todos"); + parameters.put("personCodeJefCentro", 1001); + } + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaFin")); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaFinMayorAFechaActual")); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaActual")); + } + + } + +// parameters.put("fechaCorte", fechaCorteSB.toString()); +// parameters.put("codArmasDecomisadasLst", actualizarArmasSeleccionadas()); + public StringBuilder armarFormatoFechaSinHora(Calendar fechaCldr) { + StringBuilder fechaStr = new StringBuilder(); + fechaStr = fechaStr.append((fechaCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCldr.get(Calendar.DAY_OF_MONTH))); + fechaStr = fechaStr.append("-").append((fechaCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaCldr.get(Calendar.MONTH) + 1) : (fechaCldr.get(Calendar.MONTH) + 1)); + fechaStr = fechaStr.append("-").append(fechaCldr.get(Calendar.YEAR)); + return fechaStr; + } + + public StringBuilder armarFormatoFechaConHora(Calendar fechaCldr) { + StringBuilder fechaStr = new StringBuilder(); + fechaStr = fechaStr.append((fechaCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCldr.get(Calendar.DAY_OF_MONTH))); + fechaStr = fechaStr.append("-").append((fechaCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaCldr.get(Calendar.MONTH) + 1) : (fechaCldr.get(Calendar.MONTH) + 1)); + fechaStr = fechaStr.append("-").append(fechaCldr.get(Calendar.YEAR)); + fechaStr = fechaStr.append(" ").append(fechaCldr.get(Calendar.HOUR_OF_DAY)); + fechaStr = fechaStr.append(":").append((fechaCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaCldr.get(Calendar.MINUTE)) : (fechaCldr.get(Calendar.MINUTE))); + return fechaStr; + } + + /** + * Método para el inicio de flujo. Guardar el reporte creado para su + * posterior aprobacion en otras instancias del flujo + */ + @Override + public void save() { + + } + + public Date getFechaInicio() { + return fechaInicio; + } + + public void setFechaInicio(Date fechaInicio) { + this.fechaInicio = fechaInicio; + } + + public Date getFechaFin() { + return fechaFin; + } + + public void setFechaFin(Date fechaFin) { + this.fechaFin = fechaFin; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public String getNombreReporte() { + return nombreReporte; + } + + public void setNombreReporte(String nombreReporte) { + this.nombreReporte = nombreReporte; + } + + public String getIdCentroControl() { + return idCentroControl; + } + + public void setIdCentroControl(String idCentroControl) { + this.idCentroControl = idCentroControl; + } + + public List getCentroControlList() { + return centroControlList; + } + + public void setCentroControlList(List centroControlList) { + this.centroControlList = centroControlList; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteLiquidacionEconomicaController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteLiquidacionEconomicaController.java new file mode 100644 index 0000000..cddd024 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteLiquidacionEconomicaController.java @@ -0,0 +1,328 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de reporte de liquidacion economica + * + * @author Christian Pazmino. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReporteLiquidacionEconomicaController extends AbstractController { + + /** + * Fecha a partir de la cual se sacan datos para el reporte + * + */ + private Date fechaInicio; + /** + * Fecha a partir de la cual se sacan datos para el reporte + * + */ + private Date fechaFin; + /** + * Formato de reporte que se va a generar + * + */ + private String format = "pdf"; + /** + * Usuario actual logueado en el sistema + * + */ + private TsafeUserDetail userDetail; + /** + * Nombre del reporte generado en el Alfresco + * + */ + private String nombreReporte; + /** + * Id del centro de control seleccionado por el usuario + * + */ + private String idCentroControl; + /** + * Lista de centros de control de armas + */ + private List centroControlList; + + private String institucionCentroControl = ""; + private TarmCentroControl centroControl = new TarmCentroControl(); + +// private List lTipoReporte=new ArrayList(); + /** + * Clase controladora de reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + public ReporteLiquidacionEconomicaController() throws Exception { + super(TarmDecomisoArma.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + recperpage = 10000; // Cambiar al # reg a mirar. + lrecord = new ArrayList(); + beanalias = "RPRTELIQUIDACIONECONOMICA"; + centroControlList = CentroControlArmasController.findAll(); + obtenerCentroControl(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + +// /** +// * Crea una instancia y marca el registro como nuevo. +// * +// * @throws Exception +// */ +// @Override +// public void create() throws Exception { +// super.create(); +// } + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if (Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")) { + valorColocar = Boolean.TRUE; + } + for (TarmDecomisoArma decomisoArmaObj : lrecord) { + decomisoArmaObj.getModifiedData().put("isSelect", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + + } + + /** + * Metodo para reconsultar en base a una nueva fecha de corte seleccionada + */ + public void cambioFechaDeCorte(SelectEvent event) { + querydatabase(); + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport() { + Calendar fechaActualCldr = Calendar.getInstance(); + Calendar fechaInicioCldr = Calendar.getInstance(); + Calendar fechaFinCldr = Calendar.getInstance(); + fechaInicioCldr.setTime(fechaInicio); + fechaFinCldr.setTime(fechaFin); + if (fechaActualCldr.compareTo(fechaInicioCldr) >= 0) { + if (fechaActualCldr.compareTo(fechaFinCldr) >= 0) { + if (fechaFinCldr.compareTo(fechaInicioCldr) >= 0) { + String filename = "liquidacionEconomica"; + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + try { + //Usuario logueado en la aplicacion + String nombreUsuario; + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } else { + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario); + parameters.put("fechaInicio", armarFormatoFechaSinHora(fechaInicioCldr)); + parameters.put("fechaFin", armarFormatoFechaSinHora(fechaFinCldr)); + parameters.put("fechaReporte", armarFormatoFechaConHora(fechaActualCldr)); + + String path; + path = "armas/reports/liquidacionEconomica"; + parameters.put("idCentroControl", "TODOS".equalsIgnoreCase(idCentroControl) ? null : idCentroControl); + parameters.put("nombreCentroControl", institucionCentroControl); + // Datos del jefe del centro + if (centroControl.getPersoncode() != null) { + TcustPersonDetail supervisorMilitarObj = PersonDetailController.find(centroControl.getPersoncode().toString()); + String gradoSupMilitar = (supervisorMilitarObj == null || supervisorMilitarObj.getMilitarygrade() == null) ? "" : supervisorMilitarObj.getMilitarygrade() + " - "; + parameters.put("nombreJefCentro", (supervisorMilitarObj == null || supervisorMilitarObj.getName() == null) ? "" : gradoSupMilitar + supervisorMilitarObj.getName()); + parameters.put("personCodeJefCentro", (supervisorMilitarObj == null || supervisorMilitarObj.getPk().getPersoncode() == null) ? "" : supervisorMilitarObj.getPk().getPersoncode()); + + } + + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaFin")); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaFinMayorAFechaActual")); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaActual")); + } + + } + + private void obtenerCentroControl() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + +// parameters.put("fechaCorte", fechaCorteSB.toString()); +// parameters.put("codArmasDecomisadasLst", actualizarArmasSeleccionadas()); + public StringBuilder armarFormatoFechaSinHora(Calendar fechaCldr) { + StringBuilder fechaStr = new StringBuilder(); + fechaStr = fechaStr.append((fechaCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCldr.get(Calendar.DAY_OF_MONTH))); + fechaStr = fechaStr.append("-").append((fechaCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaCldr.get(Calendar.MONTH) + 1) : (fechaCldr.get(Calendar.MONTH) + 1)); + fechaStr = fechaStr.append("-").append(fechaCldr.get(Calendar.YEAR)); + return fechaStr; + } + + public StringBuilder armarFormatoFechaConHora(Calendar fechaCldr) { + StringBuilder fechaStr = new StringBuilder(); + fechaStr = fechaStr.append((fechaCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaCldr.get(Calendar.DAY_OF_MONTH)) : (fechaCldr.get(Calendar.DAY_OF_MONTH))); + fechaStr = fechaStr.append("-").append((fechaCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaCldr.get(Calendar.MONTH) + 1) : (fechaCldr.get(Calendar.MONTH) + 1)); + fechaStr = fechaStr.append("-").append(fechaCldr.get(Calendar.YEAR)); + fechaStr = fechaStr.append(" ").append(fechaCldr.get(Calendar.HOUR_OF_DAY)); + fechaStr = fechaStr.append(":").append((fechaCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaCldr.get(Calendar.MINUTE)) : (fechaCldr.get(Calendar.MINUTE))); + return fechaStr; + } + + /** + * Método para el inicio de flujo. Guardar el reporte creado para su + * posterior aprobacion en otras instancias del flujo + */ + @Override + public void save() { + + } + + public Date getFechaInicio() { + return fechaInicio; + } + + public void setFechaInicio(Date fechaInicio) { + this.fechaInicio = fechaInicio; + } + + public Date getFechaFin() { + return fechaFin; + } + + public void setFechaFin(Date fechaFin) { + this.fechaFin = fechaFin; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public String getNombreReporte() { + return nombreReporte; + } + + public void setNombreReporte(String nombreReporte) { + this.nombreReporte = nombreReporte; + } + + public String getIdCentroControl() { + return idCentroControl; + } + + public void setIdCentroControl(String idCentroControl) { + this.idCentroControl = idCentroControl; + } + + public List getCentroControlList() { + return centroControlList; + } + + public void setCentroControlList(List centroControlList) { + this.centroControlList = centroControlList; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteSancionesController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteSancionesController.java new file mode 100644 index 0000000..abb82f4 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ReporteSancionesController.java @@ -0,0 +1,471 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de reporte de liquidacion economica + * + * @author Christian Pazmino. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReporteSancionesController extends AbstractController { + + /** + * Fecha a partir de la cual se sacan datos para el reporte + * + */ + private Date fechaInicio; + /** + * Fecha a partir de la cual se sacan datos para el reporte + * + */ + private Date fechaFin; + /** + * Formato de reporte que se va a generar + * + */ + + private Date fechaDecomiso; + + private String format = "pdf"; + /** + * Usuario actual logueado en el sistema + * + */ + private TsafeUserDetail userDetail; + /** + * Nombre del reporte generado en el Alfresco + * + */ + private String nombreReporte; + + /** + * Id del centro de control seleccionado por el usuario + * + */ + private String idCentroControl; + + /** + * Id del tipo de tramite + */ + private String idAutorizacion; + private String idIdentificacion; + + private String numeroDocumento; + + /** + * Id del tipo de tramite + */ + private String idControl; + + private Boolean habilitar; + + /** + * Lista de centros de control de armas + */ + // private List centroControlList; + private List tipoDocumentoList; + + private List centroControlList; + + private List autorizacionList; + + private List controlList; + + private String institucionCentroControl = ""; + private TarmCentroControl centroControl = new TarmCentroControl(); + + /** + * Clase controladora de reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{logincontroller}") + private LoginController logincontroller; + + public ReporteSancionesController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + recperpage = 10000; // Cambiar al # reg a mirar. + beanalias = "RPRTEAUTORIZACIONES"; + // centroControlList = CentroControlArmasController.findAll(); + centroControlList = CatalogDetailController.find("TIPODEFALTA"); + + autorizacionList = CatalogDetailController.find("USOACTIVIDAD"); + tipoDocumentoList = CatalogDetailController.find("IDENTIFICATION"); + controlList = CatalogDetailController.find("NOMBREINSTITUCION"); + this.habilitar = true; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + + } + + /** + * Metodo para reconsultar en base a una nueva fecha de corte seleccionada + */ + public void cambioFechaDeCorte(SelectEvent event) { + querydatabase(); + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * + * + */ + public void habilitarfechadecomiso() { + if (this.idAutorizacion.equals("6")) { + this.habilitar = false; + + } else { + this.habilitar = true; + this.fechaDecomiso = null; + } + } + + /** + * Genera un reporte de armas a destruir + * + */ + public void generateReport() { + if (this.fechaInicio != null || this.fechaFin != null || this.fechaDecomiso != null) { + if (this.fechaInicio != null && this.fechaFin != null) { + if (this.fechaInicio.getTime() > this.fechaFin.getTime()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaFin1")); + return; + } + } + + if (this.fechaInicio != null && this.fechaFin == null) { + if (this.fechaInicio.getTime() > new Date().getTime()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaInicioMayorAFechaActual")); + return; + } + } + if (this.fechaInicio == null && this.fechaFin != null) { + if (this.fechaFin.getTime() > new Date().getTime()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaFinMayorAFechaActual")); + return; + + } + } + + if (this.fechaDecomiso != null) { + if (this.fechaDecomiso.getTime() > new Date().getTime()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_liqeco_fechaDecomisoMayorAFechaActual")); + return; + } + + } + } + + String path = ""; + + if (this.idAutorizacion.equals("1")) { + path = "armas/reports/sancionesa"; + + } + if (this.idAutorizacion.equals("6")) { + path = "armas/reports/sancionesp"; + + } + + Calendar fechaActualCldr = Calendar.getInstance(); + //String path = "armas/reports/autorizaciones"; + String filename = "sanciones"; + String nombreUsuario = ""; + + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } else { + nombreUsuario = ""; + } + // institucionCentroControl + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + //parameters.put("unidadmilitar", "hola"); + parameters.put("lugarFecha", Utilidades.armarFormatoFechaConHora(fechaActualCldr)); + parameters.put("usuario", nombreUsuario); + parameters.put("numeroDocumento", " ".equalsIgnoreCase(numeroDocumento) ? null : numeroDocumento); + parameters.put("Pcentro", "TODOS".equalsIgnoreCase(idControl) ? null : idControl); //centro de control + parameters.put("Pcausa_sancion", "TODOS".equalsIgnoreCase(idCentroControl) ? null : idCentroControl); // estado + //parameters.put("idAutorizacion", "TODOS".equalsIgnoreCase(idAutorizacion)?null:idAutorizacion); // tipo de auturizacion + parameters.put("Ptidentificacion", "TODOS".equalsIgnoreCase(idIdentificacion) ? null : idIdentificacion); // tipo de identificacion + parameters.put("fechaInicio", this.fechaInicio == null ? null : Utilidades.armarFormatoFechaSinHora(this.fechaInicio)); + parameters.put("fechaFin", this.fechaFin == null ? null : Utilidades.armarFormatoFechaSinHora(this.fechaFin)); + parameters.put("fechaDecomiso", this.fechaDecomiso == null ? null : Utilidades.armarFormatoFechaSinHora(this.fechaDecomiso)); + + TgeneCatalogDetail obj = CatalogDetailController.findCatalogo("NOMBREINSTITUCION", idControl); + parameters.put("tipocentro", "TODOS".equalsIgnoreCase(idControl) ? "TODOS" : obj.getDescription()); //centro de control detalle + + TgeneCatalogDetail obj2 = CatalogDetailController.findCatalogo("IDENTIFICATION", idIdentificacion); + parameters.put("pdocumento", "TODOS".equalsIgnoreCase(idIdentificacion) ? "TODOS" : obj2.getDescription()); //tipo documento detalle + + TgeneCatalogDetail obj3 = CatalogDetailController.findCatalogo("TIPOAUTORIZACION", idAutorizacion); + parameters.put("pautorizacion", "TODOS".equalsIgnoreCase(idAutorizacion) ? "TODOS" : obj3.getDescription()); //tipo autorizacion detalle + + TgeneCatalogDetail obj4 = CatalogDetailController.findCatalogo("TIPODEFALTA", idCentroControl); + parameters.put("psancion", "TODOS".equalsIgnoreCase(idCentroControl) ? "TODOS" : obj4.getDescription()); //causa sancion detalle + + try { + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } + + private void obtenerCentroControl() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + /** + * Método para el inicio de flujo. Guardar el reporte creado para su + * posterior aprobacion en otras instancias del flujo + */ + @Override + public void save() { + + } + + public Date getFechaInicio() { + return fechaInicio; + } + + public void setFechaInicio(Date fechaInicio) { + this.fechaInicio = fechaInicio; + } + + public Date getFechaDecomiso() { + return fechaDecomiso; + } + + public void setFechaDecomiso(Date fechaDecomiso) { + this.fechaDecomiso = fechaDecomiso; + } + + public Date getFechaFin() { + return fechaFin; + } + + public void setFechaFin(Date fechaFin) { + this.fechaFin = fechaFin; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public String getNombreReporte() { + return nombreReporte; + } + + public void setNombreReporte(String nombreReporte) { + this.nombreReporte = nombreReporte; + } + + public String getIdCentroControl() { + return idCentroControl; + } + + public void setIdCentroControl(String idCentroControl) { + this.idCentroControl = idCentroControl; + } + + public String getIdAutorizacion() { + return idAutorizacion; + } + + public void setIdAutorizacion(String idAutorizacion) { + this.idAutorizacion = idAutorizacion; + } + + //idIdentificacion + public String getIdIdentificacion() { + return idIdentificacion; + } + + public void setIdIdentificacion(String idIdentificacion) { + this.idIdentificacion = idIdentificacion; + } + //public List getCentroControlList() { +// return centroControlList; + //} + + //public void setCentroControlList(List centroControlList) { + //this.centroControlList = centroControlList; + //} + public List getCentroControlList() { + return centroControlList; + } + + public void setCentroControlList(List centroControlList) { + this.centroControlList = centroControlList; + } + + /*CFLORES*/ + public List getTipoDocumentoList() { + return tipoDocumentoList; + } + + public void getTipoDocumentoList(List tipoDocumentoList) { + this.tipoDocumentoList = tipoDocumentoList; + } + + /**/ + + public List getAutorizacionList() { + return autorizacionList; + } + + public void setAutorizacionList(List autorizacionList) { + this.autorizacionList = autorizacionList; + } + + /*cflores*/ + public List getControlList() { + return controlList; + } + + public void setControlList(List controlList) { + this.controlList = controlList; + } + + public String getIdControl() { + return idControl; + } + + public void setIdControl(String idControl) { + this.idControl = idControl; + } + + public void setHabilitar(Boolean habilitar) { + this.habilitar = habilitar; + } + + public Boolean getHabilitar() { + return habilitar; + } + + public String getNumeroDocumento() { + return numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + /**/ + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public LoginController getLogincontroller() { + return logincontroller; + } + + public void setLogincontroller(LoginController logincontroller) { + this.logincontroller = logincontroller; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RevisarReporteArmasADestruirController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RevisarReporteArmasADestruirController.java new file mode 100644 index 0000000..da290ec --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RevisarReporteArmasADestruirController.java @@ -0,0 +1,229 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.soli.TarmCabRepDestruirArmas; +import com.fp.persistence.parmas.soli.TarmDetRepDestruirArmas; + +/** + * Clase controladora de la revision de reporte de armas a destruirse por parte + * del supervisor militar + * + * @author Christian Pazmino + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RevisarReporteArmasADestruirController extends AbstractController { + + private Integer creporte; + private Date fechaCorte; + /** + * Variable que indica si el funcionario esta negado para iniciar el flujo y + * enviar el reporte a su superior para aprobacion + */ + private Boolean isDenied; + + private TarmCabRepDestruirArmas cabRepDestruirArmasObj; + + @ManagedProperty(value = "#{cabRepDestruirArmasController}") + private CabRepDestruirArmasController cabRepDestruirArmasController; + + @ManagedProperty(value = "#{detRepDestruirArmasController}") + private DetRepDestruirArmasController detRepDestruirArmasController; + + public RevisarReporteArmasADestruirController() throws Exception { + super(TarmCabRepDestruirArmas.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + super.startQuery(); + if (this.getMfilters().get("creporte") != null) { + creporte = Integer.parseInt(this.getMfilters().get("creporte")); + } + if (creporte != null) { + this.getMfilters().clear(); + this.init(); + } else { + detRepDestruirArmasController.setLrecord(new ArrayList()); + } +// this.querydatabase(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + isDenied = Boolean.FALSE; + cabRepDestruirArmasObj = CabRepDestruirArmasController.findByCodigo(creporte.toString()); + detRepDestruirArmasController.addFilter("creporte", creporte.toString()); + detRepDestruirArmasController.query(); +// detRepDestruirArmasLst = DetRepDestruirArmasController.findByCReporte(creporte.toString()); + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList(); + beanalias = "TARMREVISAREPDECARMAS"; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() { + try { + if (creporte != null) { + this.detRepDestruirArmasController.next(); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + public void previous() { + try { + if (creporte != null) { + this.detRepDestruirArmasController.previous(); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + super.addFilter("pk", creporte.toString()); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (lrecord.size() > 0) { + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public Integer getCreporte() { + return creporte; + } + + public void setCreporte(Integer creporte) { + this.creporte = creporte; + } + + public Date getFechaCorte() { + return fechaCorte; + } + + public void setFechaCorte(Date fechaCorte) { + this.fechaCorte = fechaCorte; + } + + public CabRepDestruirArmasController getCabRepDestruirArmasController() { + return cabRepDestruirArmasController; + } + + public void setCabRepDestruirArmasController( + CabRepDestruirArmasController cabRepDestruirArmasController) { + this.cabRepDestruirArmasController = cabRepDestruirArmasController; + } + + public DetRepDestruirArmasController getDetRepDestruirArmasController() { + return detRepDestruirArmasController; + } + + public void setDetRepDestruirArmasController( + DetRepDestruirArmasController detRepDestruirArmasController) { + this.detRepDestruirArmasController = detRepDestruirArmasController; + } + + public Boolean getIsDenied() { + return isDenied; + } + + public void setIsDenied(Boolean isDenied) { + this.isDenied = isDenied; + } + + public TarmCabRepDestruirArmas getCabRepDestruirArmasObj() { + return cabRepDestruirArmasObj; + } + + public void setCabRepDestruirArmasObj( + TarmCabRepDestruirArmas cabRepDestruirArmasObj) { + this.cabRepDestruirArmasObj = cabRepDestruirArmasObj; + } + + @Override + public void save() { + try { + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + request.modifiedData().put("BPMStatus", "A"); +// request.modifiedData().put("creporte", creporte); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMObs", "Revision del supervisor militar"); + request.modifiedData().put("comment", ""); + request.modifiedData().put("observacion", ""); + Map datosmail = new HashMap(); + request.modifiedData().put("datosmail", datosmail); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.setShowRow(true); + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + "CREPORTE: 1"); + isDenied = Boolean.TRUE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RevisarRprteArmasADestJefCCController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RevisarRprteArmasADestJefCCController.java new file mode 100644 index 0000000..13bcb4a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RevisarRprteArmasADestJefCCController.java @@ -0,0 +1,308 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.soli.TarmCabRepDestruirArmas; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDetRepDestruirArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +/** + * Clase controladora de la revision de reporte de armas a destruirse por parte + * del jefe del comando conjunto + * + * @author JALVARADO + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RevisarRprteArmasADestJefCCController extends AbstractController { + + private Integer creporte; + private Date fechaCorte; + private String estado; + + /** + * lista del catalogo de las acciones (Aceptar o rechazar) + * + */ + private List laccion; + + /** + * Variable que indica si el funcionario esta negado para iniciar el flujo y + * enviar el reporte a su superior para aprobacion + */ + private Boolean isDenied; + + private String observacion; + + private TarmCabRepDestruirArmas tarmCabRepDestruirArmas; + + @ManagedProperty(value = "#{cabRepDestruirArmasController}") + private CabRepDestruirArmasController cabRepDestruirArmasController; + + @ManagedProperty(value = "#{detRepDestruirArmasController}") + private DetRepDestruirArmasController detRepDestruirArmasController; + + @ManagedProperty(value = "#{decomisoArmaController}") + private DecomisoArmaController decomisoArmaController; + + public RevisarRprteArmasADestJefCCController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + super.startQuery(); + if (this.getMfilters().get("creporte") != null) { + creporte = Integer.parseInt(this.getMfilters().get("creporte")); + } + if (creporte != null) { + this.getMfilters().clear(); + this.init(); + this.querydatabase(); + } else { + detRepDestruirArmasController.setLrecord(new ArrayList()); + } + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + isDenied = Boolean.FALSE; + tarmCabRepDestruirArmas = CabRepDestruirArmasController.findByCodigo(creporte.toString()); + detRepDestruirArmasController.addFilter("creporte", creporte.toString()); + detRepDestruirArmasController.query(); + TgeneParameters tgeneparam = ParametersController.find("CODIGO.AR", "1"); + laccion = CatalogDetailController.find("ESTADOSOLICITUD", tgeneparam.getTextvalue()); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() { + try { + if (creporte != null) { + this.detRepDestruirArmasController.next(); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + public void previous() { + try { + if (creporte != null) { + this.detRepDestruirArmasController.previous(); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + protected void querydatabase() { + + } + + public Integer getCreporte() { + return creporte; + } + + public void setCreporte(Integer creporte) { + this.creporte = creporte; + } + + public Date getFechaCorte() { + return fechaCorte; + } + + public void setFechaCorte(Date fechaCorte) { + this.fechaCorte = fechaCorte; + } + + public CabRepDestruirArmasController getCabRepDestruirArmasController() { + return cabRepDestruirArmasController; + } + + public void setCabRepDestruirArmasController( + CabRepDestruirArmasController cabRepDestruirArmasController) { + this.cabRepDestruirArmasController = cabRepDestruirArmasController; + } + + public DetRepDestruirArmasController getDetRepDestruirArmasController() { + return detRepDestruirArmasController; + } + + public void setDetRepDestruirArmasController( + DetRepDestruirArmasController detRepDestruirArmasController) { + this.detRepDestruirArmasController = detRepDestruirArmasController; + } + + public TarmCabRepDestruirArmas getTarmCabRepDestruirArmas() { + return tarmCabRepDestruirArmas; + } + + public void setTarmCabRepDestruirArmas( + TarmCabRepDestruirArmas tarmCabRepDestruirArmas) { + this.tarmCabRepDestruirArmas = tarmCabRepDestruirArmas; + } + + public DecomisoArmaController getDecomisoArmaController() { + return decomisoArmaController; + } + + public void setDecomisoArmaController( + DecomisoArmaController decomisoArmaController) { + this.decomisoArmaController = decomisoArmaController; + } + + public List getLaccion() { + return laccion; + } + + public void setLaccion(List laccion) { + this.laccion = laccion; + } + + public Boolean getIsDenied() { + return isDenied; + } + + public void setIsDenied(Boolean isDenied) { + this.isDenied = isDenied; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public String getObservacion() { + return observacion; + } + + public void setObservacion(String observacion) { + this.observacion = observacion; + } + + public String codigoAceptado() throws Exception { + TgeneParameters f = ParametersController.find("ACEPTADO", "1"); + return f.getTextvalue(); + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + if (observacion != null) { + request.modifiedData().put("observacion", observacion); + tarmCabRepDestruirArmas.setObsjefecc(observacion); + tarmCabRepDestruirArmas.setIsnew(Boolean.FALSE); + cabRepDestruirArmasController.update(tarmCabRepDestruirArmas); + DtoSave dtoSaveCAC = cabRepDestruirArmasController.getDtoSave(); + if (dtoSaveCAC.pendingProcess()) { + dtoSaveCAC.setPosition(1); + msave.put(cabRepDestruirArmasController.getBeanalias(), dtoSaveCAC); + } + } + // Si el reporte es rechazado se vuelven las armas del reporte a la lista de armas para ser seleccionadas en nuevos reportes + if (!codigoAceptado().equals(estado)) { + for (TarmDetRepDestruirArmas armasDecomRprteObj : detRepDestruirArmasController.getLrecord()) { + TarmDecomisoArma armasDecomisadasObj = DecomisoArmaController.findByCodigo(armasDecomRprteObj.getCdecomisoarma()); + armasDecomisadasObj.setAdestruirse(null); + armasDecomisadasObj.setAdestruirsecode(null); + armasDecomisadasObj.setIsnew(Boolean.FALSE); + decomisoArmaController.update(armasDecomisadasObj); + } + DtoSave dtoSaveDAC = decomisoArmaController.getDtoSave(); + if (dtoSaveDAC.pendingProcess()) { + dtoSaveDAC.setPosition(2); + msave.put(decomisoArmaController.getBeanalias(), dtoSaveDAC); + } + } + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.cabRepDestruirArmasController.postCommit(resp); + this.decomisoArmaController.postCommit(resp); + this.setShowRow(true); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + completarTarea(); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + try { + Request request = callerhelper.getRequest(); + + super.cleanRequest(request); + // validamos si cargamos los datos cuando apruebe + Map datosmail = new HashMap(); + request.modifiedData().put("TID", tid); + request.modifiedData().put("creporte", creporte); + request.modifiedData().put("BPMObs", observacion); + if (codigoAceptado().equals(estado)) { + request.modifiedData().put("BPMStatus", "A"); + } else { + request.modifiedData().put("BPMStatus", "D"); + } + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + "jefe dpto - CREPORTE: " + creporte); + isDenied = Boolean.TRUE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RevisarRprteArmasADestJefDepController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RevisarRprteArmasADestJefDepController.java new file mode 100644 index 0000000..69d8b6a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/RevisarRprteArmasADestJefDepController.java @@ -0,0 +1,313 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.soli.TarmCabRepDestruirArmas; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDetRepDestruirArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +/** + * Clase controladora de la revision de reporte de armas a destruirse por parte + * del jefe de departamento + * + * @author JALVARADO + * + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class RevisarRprteArmasADestJefDepController extends AbstractController { + + private Integer creporte; + private Date fechaCorte; + private String estado; + + /** + * lista del catalogo de las acciones (Aceptar o rechazar) + * + */ + private List laccion; + + /** + * Variable que indica si el funcionario esta negado para iniciar el flujo y + * enviar el reporte a su superior para aprobacion + */ + private Boolean isDenied; + + private String observacion; + + private TarmCabRepDestruirArmas tarmCabRepDestruirArmas; + + @ManagedProperty(value = "#{cabRepDestruirArmasController}") + private CabRepDestruirArmasController cabRepDestruirArmasController; + + @ManagedProperty(value = "#{detRepDestruirArmasController}") + private DetRepDestruirArmasController detRepDestruirArmasController; + + @ManagedProperty(value = "#{decomisoArmaController}") + private DecomisoArmaController decomisoArmaController; + + public RevisarRprteArmasADestJefDepController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + super.startQuery(); + if (this.getMfilters().get("creporte") != null) { + creporte = Integer.parseInt(this.getMfilters().get("creporte")); + } + if (creporte != null) { + this.getMfilters().clear(); + this.init(); + this.querydatabase(); + } else { + detRepDestruirArmasController.setLrecord(new ArrayList()); + } + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + isDenied = Boolean.FALSE; + tarmCabRepDestruirArmas = CabRepDestruirArmasController.findByCodigo(creporte.toString()); + detRepDestruirArmasController.addFilter("creporte", creporte.toString()); + detRepDestruirArmasController.query(); + TgeneParameters tgeneparam = ParametersController.find("CODIGO.AR", "1"); + laccion = CatalogDetailController.find("ESTADOSOLICITUD", tgeneparam.getTextvalue()); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() { + try { + if (creporte != null) { + this.detRepDestruirArmasController.next(); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + public void previous() { + try { + if (creporte != null) { + this.detRepDestruirArmasController.previous(); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + protected void querydatabase() { + + } + + public Integer getCreporte() { + return creporte; + } + + public void setCreporte(Integer creporte) { + this.creporte = creporte; + } + + public Date getFechaCorte() { + return fechaCorte; + } + + public void setFechaCorte(Date fechaCorte) { + this.fechaCorte = fechaCorte; + } + + public CabRepDestruirArmasController getCabRepDestruirArmasController() { + return cabRepDestruirArmasController; + } + + public void setCabRepDestruirArmasController( + CabRepDestruirArmasController cabRepDestruirArmasController) { + this.cabRepDestruirArmasController = cabRepDestruirArmasController; + } + + public DetRepDestruirArmasController getDetRepDestruirArmasController() { + return detRepDestruirArmasController; + } + + public void setDetRepDestruirArmasController( + DetRepDestruirArmasController detRepDestruirArmasController) { + this.detRepDestruirArmasController = detRepDestruirArmasController; + } + + public TarmCabRepDestruirArmas getTarmCabRepDestruirArmas() { + return tarmCabRepDestruirArmas; + } + + public void setTarmCabRepDestruirArmas( + TarmCabRepDestruirArmas tarmCabRepDestruirArmas) { + this.tarmCabRepDestruirArmas = tarmCabRepDestruirArmas; + } + + public DecomisoArmaController getDecomisoArmaController() { + return decomisoArmaController; + } + + public void setDecomisoArmaController( + DecomisoArmaController decomisoArmaController) { + this.decomisoArmaController = decomisoArmaController; + } + + public List getLaccion() { + return laccion; + } + + public void setLaccion(List laccion) { + this.laccion = laccion; + } + + public Boolean getIsDenied() { + return isDenied; + } + + public void setIsDenied(Boolean isDenied) { + this.isDenied = isDenied; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public String getObservacion() { + return observacion; + } + + public void setObservacion(String observacion) { + this.observacion = observacion; + } + + /** + * Metodo que retorna un parametro del sistema el cual es el codigo para + * Aprobar una solicitud en un flujo + * + */ + public String codigoAceptado() throws Exception { + TgeneParameters f = ParametersController.find("ACEPTADO", "1"); + return f.getTextvalue(); + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + if (observacion != null) { + request.modifiedData().put("observacion", observacion); + tarmCabRepDestruirArmas.setObsjefecc(observacion); + tarmCabRepDestruirArmas.setIsnew(Boolean.FALSE); + cabRepDestruirArmasController.update(tarmCabRepDestruirArmas); + DtoSave dtoSaveCAC = cabRepDestruirArmasController.getDtoSave(); + if (dtoSaveCAC.pendingProcess()) { + dtoSaveCAC.setPosition(1); + msave.put(cabRepDestruirArmasController.getBeanalias(), dtoSaveCAC); + } + } + // Si el reporte es rechazado se vuelven las armas del reporte a la lista de armas para ser seleccionadas en nuevos reportes + if (!codigoAceptado().equals(estado)) { + for (TarmDetRepDestruirArmas armasDecomRprteObj : detRepDestruirArmasController.getLrecord()) { + TarmDecomisoArma armasDecomisadasObj = DecomisoArmaController.findByCodigo(armasDecomRprteObj.getCdecomisoarma()); + armasDecomisadasObj.setAdestruirse(null); + armasDecomisadasObj.setAdestruirsecode(null); + armasDecomisadasObj.setIsnew(Boolean.FALSE); + decomisoArmaController.update(armasDecomisadasObj); + } + DtoSave dtoSaveDAC = decomisoArmaController.getDtoSave(); + if (dtoSaveDAC.pendingProcess()) { + dtoSaveDAC.setPosition(2); + msave.put(decomisoArmaController.getBeanalias(), dtoSaveDAC); + } + } + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.cabRepDestruirArmasController.postCommit(resp); + this.decomisoArmaController.postCommit(resp); + this.setShowRow(true); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + completarTarea(); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + try { + Request request = callerhelper.getRequest(); + + super.cleanRequest(request); + // validamos si cargamos los datos cuando apruebe + Map datosmail = new HashMap(); + request.modifiedData().put("TID", tid); + request.modifiedData().put("creporte", creporte); + request.modifiedData().put("BPMObs", observacion); + if (codigoAceptado().equals(estado)) { + request.modifiedData().put("BPMStatus", "A"); + } else { + request.modifiedData().put("BPMStatus", "D"); + } + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + "jefe dpto - CREPORTE: " + creporte); + isDenied = Boolean.TRUE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SancionDecomisoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SancionDecomisoController.java new file mode 100644 index 0000000..84021f9 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SancionDecomisoController.java @@ -0,0 +1,142 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmSancionDecomiso; + +/** + * Clase controladora del bean TarmSancionDecomiso. + * + * @author Andres Cevallos. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SancionDecomisoController extends AbstractController { + + public SancionDecomisoController() throws Exception { + super(TarmSancionDecomiso.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + //super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "SANCIONDECOMISO"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.cdecomiso"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public List findxdecomiso(String cdecomiso) { + try {//TgeneCatalogDetailKey + SancionDecomisoController cc = new SancionDecomisoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.cdecomiso", cdecomiso); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmSancionDecomiso findsancionarmadec(String cdecomiso, String carma) { + try {//TgeneCatalogDetailKey + SancionDecomisoController cc = new SancionDecomisoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.cdecomiso", cdecomiso); + cc.addFilter("carma", carma); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SancionRecomendacionController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SancionRecomendacionController.java new file mode 100644 index 0000000..3f67e7a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SancionRecomendacionController.java @@ -0,0 +1,106 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmSancionRecomendacion; + +/** + * Clase controladora del bean TarmSancionRecomendacion. + * + * @author Andres Cevallos. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SancionRecomendacionController extends AbstractController { + + public SancionRecomendacionController() throws Exception { + super(TarmSancionRecomendacion.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "SANCIONRECOMENDACION"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.cdecomiso"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SancionarController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SancionarController.java new file mode 100644 index 0000000..846911e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SancionarController.java @@ -0,0 +1,1093 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.primefaces.component.selectbooleancheckbox.SelectBooleanCheckbox; +import org.primefaces.context.RequestContext; +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.lov.SancionarLovController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.DatosParaSancionesController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmTipoSancion; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * @author Andres Cevallos Sanciona un arma + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SancionarController extends AbstractController { + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + /** + * Boleano que activa el boton de generarreporte + */ + private Boolean reporte; + /** + * Codigo de Transaccion + */ + private Long cTransaccion; + /** + * Activa el boton enviar + */ + private String btnEnviar; + /** + * Controlador inyectado decomiso arma controller + */ + @ManagedProperty(value = "#{decomisoArmaController}") + private DecomisoArmaController decomisoArmaController; + + @ManagedProperty(value = "#{sancionDecomisoController}") + private SancionDecomisoController sancionDecomisoController; + /** + * Controlador inyectado documento habilitante + */ + @ManagedProperty(value = "#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitanteController; + /** + * controlador inyectado sancion recomendacion + */ + @ManagedProperty(value = "#{sancionRecomendacionController}") + private SancionRecomendacionController sancionRecomendacionController; + + @ManagedProperty(value = "#{armasController}") + private ArmasController armasController; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + /** + * Controlador inyectado sanciondecomiso controller + */ + private long cdocumentohabilitanteaut; + + private TarmArmas armaactual; + /** + * Instancia de la entidad Tarmdecomiso + */ + private TarmDecomiso decomiso; + /** + * Instancia de la entidad TarmDecomisoArma + */ + private Boolean sanc = false; + + private TcustPersonDetail personaUsuario; + /** + * Instancia de la entidad TarmDecomisoArma + */ + private TarmDecomisoArma decomisoArmaObj; + /** + * Instancia de la entidad TarmTipoArmaExplosivo + */ + private TarmTipoArmaExplosivo tipoarmaexplosivo; + + // private String tabid1 = "tabDetalleDeArmas"; + /** + * Bandera de tipo booleano para indicar si se ha grabado el reporte + * generado + * + */ + private Boolean isEnableGrabar; + /** + * Bandera de tipo booleano para indicar que se debe deshabilitar el boton + * ENVIAR + * + */ + private Boolean isEnableEnviar; + + private List autorizacion; + + private Boolean aut; + /** + * Atributo para listar las armas decomisadas + */ + private List larmas; + /** + * Instancia de una lista de tipo de sancion + */ + private List tsancion1; + /** + * Provincia + */ + private String provincia; + /** + * Instan de un tipo de sancion + */ + private TarmTipoSancion sancion; + /** + * Canton + */ + private TarmCentroControl centroControl; + + private String canton; + /** + * Ciudad + */ + private String ciudad; + /** + * Parroquia + */ + private String parroquia; + /** + * Clase de arma + */ + private String clasearma; + /** + * Detalle de grado + */ + private TgeneCatalogDetail gradoCatalogDatail; + /** + * Detalle de unidad + */ + private TgeneCatalogDetail unidadCatalogDatail; + + private TsafeUserDetail userDetail; + /** + * Atributo asociado a al documento de la utorizacion que se seleccione + */ + private TarmTramite tramite; + /** + * Tipo de sancion, a la autorización o al permiso + */ + private String tipsancion = ""; + + private TarmRegistroArmas regarma; + + private List documentos; + + //private TarmDocumentoHabilitante doc1; + private String institucionCentroControl = ""; + + /** + * Bandera usada para identificar si existe o no un documento habilitante + * para el arma a sancionarse + */ + private Boolean isExistDocHabilitante = Boolean.FALSE; + + private TcustPersonDetail responsableCentroControl = null; + private Boolean grillaAut; + private String sanciontipo; + + @Override + public void query() { + + } + + @Override + protected void querydatabase() { + } + + public SancionarController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + startQuery(); + this.init(); + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + //cDecomiso=(long)376; + cTransaccion = Long.parseLong(super.getMfilters().get("numerotransaccion")); + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + aut = false; + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + isEnableGrabar = Boolean.TRUE; + isEnableEnviar = Boolean.FALSE; + grillaAut = true; + larmas = new ArrayList(); + personaUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()); +// //lista de las armas decomisadas +// List lRecepcionArmasDetalle = DecomisoArmaController.findByCodigoDecomiso(cDecomiso.toString()); + List lRecepcionArmasDetalle = DecomisoArmaController.findArmasPorSancionar(cTransaccion); + for (TarmDecomisoArma decomisoArmaDetalle : lRecepcionArmasDetalle) { + TarmArmas arma = ArmasController.findPorCodigo(decomisoArmaDetalle.getCarma()); + TarmRegistroArmas regarmaa = RegistroArmController.findByCodigo(arma.getCregistro().toString()); + arma.getModifiedData().put("tipoarmaexplosivos", TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo())); + TarmTipoArmaExplosivo tipoarmaexplosivo = (TarmTipoArmaExplosivo) arma.getModifiedData().get("tipoarmaexplosivos"); + String clasearma = CatalogDetailController.findxCodigoCodcatalogo(tipoarmaexplosivo.getClase(), tipoarmaexplosivo.getClasecodigo()).getDescription(); + + arma.getModifiedData().put("clase", clasearma); + // arma.getModifiedData().put("tsancion", DatosParaSancionesController.find(tipoarmaexplosivo.getClase())); + arma.getModifiedData().put("persona", regarmaa.getPersoncode().toString()); + +// if(SancionDecomisoController.findsancionarmadec(cDecomiso.toString(),arma.getPk().toString()) != null){ + if (SancionDecomisoController.findsancionarmadec(decomisoArmaDetalle.getCdecomiso().toString(), arma.getPk().toString()) != null) { + arma.getModifiedData().put("sancionada", "true"); + } + //seteo del deomiso del arma TarmDecomiso + arma.getModifiedData().put("decomisoArma", decomisoArmaDetalle); + larmas.add(arma); + } + // sancion=new TarmTipoSancion(); + btnEnviar = null; + checkenviar(); +// } +// else{ +// MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_numReciboNoRegistrado")); +// } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void checkenviar() { + for (TarmArmas arm : larmas) { + if (arm.getModifiedData().get("sancionada") == null || arm.getModifiedData().get("sancionada").toString() != "true") { + return; + } + } + isEnableEnviar = Boolean.TRUE; + btnEnviar = "ok"; + } + + /** + * Metodo para seleccionar el documento en el combo de la autorizacion + * + * @throws Exception + */ + @SuppressWarnings("static-access") + public void changetype() throws Exception { + if (cdocumentohabilitanteaut != 0) { + documentoHabilitanteController.setRecord(documentoHabilitanteController.find(cdocumentohabilitanteaut + "")); + tramite = TarmTramiteController.find(documentoHabilitanteController.getRecord().getCtramite().toString()); + isExistDocHabilitante = Boolean.TRUE; + tipsancion = "AUTORIZACION"; + sancion = new TarmTipoSancion(); + } else { + tramite = new TarmTramite(); + documentoHabilitanteController.setRecord(null); + //cuando no tiene asociado a un documento + sancion = DatosParaSancionesController.findxPk("0"); + sancion.getModifiedData().put("nfalta", null); + sancion.getModifiedData().put("ntipoFalta", null); + sancionDecomisoController.create(); + + btnEnviar = "true"; + tipsancion = ""; + isExistDocHabilitante = Boolean.FALSE; + } + } + + public void setDocumentoHabilitanteController( + DocumentoHabilitanteController documentoHabilitanteController) { + this.documentoHabilitanteController = documentoHabilitanteController; + } + + /** + * Sancion Aplicada al permiso + */ + @SuppressWarnings("unchecked") + public void sancionarPermiso(TarmArmas armar) { + //inicializamos las variables + TarmDecomisoArma decomisoArmaSel = (TarmDecomisoArma) armar.getModifiedData().get("decomisoArma"); + decomiso = DecomisoController.findByCodigo(decomisoArmaSel.getCdecomiso().toString()); + + provincia = ProvinceController.getDescProvByCodigo(decomiso.getCountrycode(), decomiso.getProvincecode()); + canton = CantonController.getDescCantonByCodigo(decomiso.getCountrycode(), decomiso.getProvincecode(), decomiso.getCantoncode()); + ciudad = CityController.getDescCiudadByCodigo(decomiso.getCountrycode(), decomiso.getProvincecode(), decomiso.getCantoncode(), decomiso.getCitycode()); + parroquia = ParroquiaController.getDescParroquiaByCodigo(decomiso.getCountrycode(), decomiso.getProvincecode(), decomiso.getCantoncode(), decomiso.getParroquiacode()); + gradoCatalogDatail = CatalogDetailController.findxCodigoCodcatalogo(decomiso.getGradofuncionario(), decomiso.getGradofuncionariocode()); + TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(decomiso.getCcentrocontrol()); + unidadCatalogDatail = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()); + + tramite = new TarmTramite(); + documentoHabilitanteController.setRecord(null); + sancion = null; + regarma = null; + cdocumentohabilitanteaut = 0; + sancionRecomendacionController.clearAll(); + autorizacion = new ArrayList(); + + //arma actual + armaactual = armar; + reporte = Boolean.FALSE; + //registro del arma obtiene el codigo del propietario del arma + regarma = RegistroArmController.findByCodigo(armar.getCregistro().toString()); + tipoarmaexplosivo = (TarmTipoArmaExplosivo) armar.getModifiedData().get("tipoarmaexplosivos"); + //clase del arma + clasearma = CatalogDetailController.findxCodigoCodcatalogo(tipoarmaexplosivo.getClase(), tipoarmaexplosivo.getClasecodigo()).getDescription(); + //tsancion=(List) armar.getModifiedData().get("tsancion"); + //documento habilitante por codigo del arma y codigo de la persona + System.out.println("codigo de la persona: " + armaactual.getModifiedData().get("persona") + " - codigo arma: " + armaactual.getCodigoarma()); + TarmDocumentoHabilitante permiso = null; + if (armaactual.getModifiedData().get("persona") != null && armaactual.getCodigoarma() != null) { + permiso = DocumentoHabilitanteController.findxarma(armaactual.getCodigoarma(), armaactual.getModifiedData().get("persona").toString()); + } + //lista de documentos habilitantes por codigo de la persona (lista las autorizaciones para el combo del dialog) 1 TIPOAUTORIZACION 0 AUTORIZACION + if (armaactual.getModifiedData().get("persona") != null && permiso == null) { + autorizacion = DocumentoHabilitanteController.findPorPersoncodeaut(armaactual.getModifiedData().get("persona").toString()); + } + try { + //se crea la sancion + sancionDecomisoController.create(); + sancionDecomisoController.getRecord().setFechainicio(new java.sql.Date(new Date().getTime())); + //no tiene documents + if (permiso == null && autorizacion.isEmpty()) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_nopermiso")); + //no tiene documentos la sancion va por default + sancion = DatosParaSancionesController.findxPk("0"); + sancion.getModifiedData().put("nfalta", null); + sancion.getModifiedData().put("ntipoFalta", null); + + btnEnviar = "true"; + aut = Boolean.FALSE; + tipsancion = "AUTORIZACION"; + //ltramite="1"; + isExistDocHabilitante = Boolean.FALSE; + } else if (permiso != null) { + aut = Boolean.FALSE; + sancion = new TarmTipoSancion(); +// permiso.setEstado("SAN"); + documentoHabilitanteController.setRecord(permiso); + //consulta el tramite + tramite = TarmTramiteController.find(documentoHabilitanteController.getRecord().getCtramite().toString()); + sancionDecomisoController.getRecord().setCdocumento(documentoHabilitanteController.getRecord().getPk()); + tipsancion = "PERMISO"; + //ltramite="6"; + isExistDocHabilitante = Boolean.TRUE; + //limpiamos la list + autorizacion = new ArrayList(); + } else { + //no tiene documentos la sancion va por default + sancion = DatosParaSancionesController.findxPk("0"); + sancion.getModifiedData().put("nfalta", null); + sancion.getModifiedData().put("ntipoFalta", null); + //documentoHabilitanteController.setRecord(new TarmDocumentoHabilitante()); + + isExistDocHabilitante = Boolean.FALSE; + //ltramite="1"; + aut = Boolean.TRUE; + // isExistDocHabilitante=Boolean.TRUE; + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Carga los datos de la sancion dentro del lrecord + */ + public void actualizarSancion() { + if (sancion == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_ingresesancion")); + return; + } + try { + TgeneCatalogDetail tiempo = CatalogDetailController.findxCodigoCodcatalogo(sancion.getTiempo(), sancion.getTiempocodigo()); + Calendar calendario = Calendar.getInstance(); + if (sancionDecomisoController.getRecord() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_ingresesancion")); + return; + } + try { + calendario.add(Calendar.DAY_OF_YEAR, Integer.parseInt(tiempo.getDescription())); + } catch (Exception e) { + e.printStackTrace(); + MessageHelper.setMessageError("EL CATALOGO SE ENCUENTRA MAL PARAMETRIZADO"); + return; + } + Date fechalaboral = calendario.getTime(); + sancionDecomisoController.getRecord().setCtiposancion(sancion.getPk()); + sancionDecomisoController.getRecord().getPk().setCdecomiso(decomiso.getPk()); + // PENDIENTE CFPH LINEA SUPERIOS COMENTADA + sancionDecomisoController.getRecord().setPersoncode(regarma.getPersoncode()); + sancionDecomisoController.getRecord().setFechafinal(new java.sql.Date(fechalaboral.getTime())); + sancionDecomisoController.getRecord().setCarma(armaactual.getPk()); + if (documentoHabilitanteController != null && documentoHabilitanteController.getRecord() != null && documentoHabilitanteController.getRecord().getPk() != null) { + sancionDecomisoController.getRecord().setCdocumento(documentoHabilitanteController.getRecord().getPk()); + //documento + if (documentoHabilitanteController != null) { + if (sancion.getSancion() == "1" || sancion.getSancion() == "1") { + documentoHabilitanteController.getRecord().setEstado("CAN"); + } else { + documentoHabilitanteController.getRecord().setEstado("SUS"); + } + } + documentoHabilitanteController.update(); + } + //seteamos el ARMA DECOMISADA + sancionDecomisoController.getRecord().getModifiedData().put("arma", armaactual); + //lista de las RECOMENDACIONES + sancionDecomisoController.getRecord().getModifiedData().put("recomendaciones", sancionRecomendacionController.getLrecord()); + sancionDecomisoController.update(); + + sanc = true; + //graba la sancion + save(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Crea una nueva recomendacion + */ + public void createRecomendacion() { + try { + sancionRecomendacionController.create(); + sancionRecomendacionController.getRecord().setPersoncode(personaUsuario.getPk().getPersoncode()); + sancionRecomendacionController.getRecord().getModifiedData().put("usuario", personaUsuario.getName()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Guarda la recomendacion en el lrecord de sanciones + */ + public void actualizarRecomendacion() { + try { + sancionRecomendacionController.update(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Obtiene los datos del lov de sancion + * + * @param event + * @throws Exception + */ + public void onReturnSancionLov(SelectEvent event) throws Exception { + sancion = (TarmTipoSancion) event.getObject(); + + } + + /** + * Abre el Lov de Sanciones + */ + public void openSancionarLov() { + if (tramite == null || tramite.getTipoautorizacion() == null) { + MessageHelper.setMessageError("DOCUMENTO SIN SIN TRAMITE"); + return; + } + if (tipoarmaexplosivo == null || tipoarmaexplosivo.getClase() == null) { + MessageHelper.setMessageError("ARMA SIN CLASE"); + return; + } + Map> params = new HashMap<>(); + + List tramitePa = new ArrayList(); + tramitePa.add(tramite.getTipoautorizacion()); + params.put("tramite", tramitePa); + List clasePa = new ArrayList(); + clasePa.add(tipoarmaexplosivo.getClase()); + params.put("clase", clasePa); + System.out.println("Tramite: " + tramite.getTipoautorizacion() + " clase arma: " + tipoarmaexplosivo.getClase()); + SancionarLovController.openLov(params);//, tipoarmaexplosivo, tsancion, + } + + public void reporteSancion() { + String gradoUsuario = ""; + + Calendar fechaActualCldr = Calendar.getInstance(); + String path = "armas/reports/sancionReporte"; + String filename = "Sancion"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + try { + String nombreUsuario; + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } else { + nombreUsuario = ""; + } + parameters.put("usuario", nombreUsuario); + //Fecha actual + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH) + 1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarFecha", fechaActualSB.toString()); + // parameters.put("transaccion",numeroTransaccionEnvioConvertido); + String format = "pdf"; + + InputStream file = this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + String xpathflujo = generarXpath(); + + alfrescoController.uploadFile(file, filename + ".pdf", xpathflujo); + // iniciarFlujo(xpathflujo+"/cm:"+numeroTransaccionEnvioConvertido+ ".pdf");//="cm:Decomiso/cm:A-2014/cm:M-10/cm:ENV-000000319/cm:ENV-000000319.pdf" + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } finally { + reporte = Boolean.FALSE; + } + } + + /** + * Metodo para generar la ruta del alfresco + * + * @return + */ + public String generarXpath() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta = new StringBuilder("cm:Decomiso"); + String centrocontrol = institucionCentroControl.replaceAll("\\s+", "_"); + ruta = ruta.append("/cm:").append(centrocontrol); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + + return ruta.toString(); + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + if (sancionDecomisoController.getLrecord() == null || sancionDecomisoController.getLrecord().isEmpty()) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_realiceunasancion")); + return; + } + try { + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + //cargado las sanciones + DtoSave dtosaveSancionDecomiso = sancionDecomisoController.getDtoSave(); + dtosaveSancionDecomiso.setPosition(1); + msave.put(this.sancionDecomisoController.getBeanalias(), dtosaveSancionDecomiso); + + //cargado las recomendaciones + DtoSave dtosaveSancionRecomend = sancionRecomendacionController.getDtoSave(); + dtosaveSancionRecomend.setPosition(2); + msave.put(this.sancionRecomendacionController.getBeanalias(), dtosaveSancionRecomend); + + //cargado para actualizarse + DtoSave dtosaveDocumentoHabilitante = documentoHabilitanteController.getDtoSave(); + dtosaveDocumentoHabilitante.setPosition(3); + msave.put(this.documentoHabilitanteController.getBeanalias(), dtosaveDocumentoHabilitante); + + //decomiso del arma(vacio) + DtoSave dtosaveDecomisoArma = decomisoArmaController.getDtoSave(); + dtosaveDecomisoArma.setPosition(4); + msave.put(this.decomisoArmaController.getBeanalias(), dtosaveDecomisoArma); + + //arma(vacio) + DtoSave dtosaveArmasController = armasController.getDtoSave(); + dtosaveArmasController.setPosition(5); + msave.put(this.armasController.getBeanalias(), dtosaveArmasController); + + request.setSaveTables(msave); + // query transaction Sancionar + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.sancionDecomisoController.postCommit(resp); + sancionDecomisoController.clearAll(); + this.sancionRecomendacionController.postCommit(resp); + sancionRecomendacionController.clearAll(); + this.documentoHabilitanteController.postCommit(resp); + this.decomisoArmaController.postCommit(resp); + this.armasController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + reporte = Boolean.TRUE; + //cambio a sancionada el arma + for (TarmArmas arma : larmas) { + if (arma.getPk().equals(armaactual.getPk())) { + arma.getModifiedData().put("sancionada", "true"); + } + } + checkenviar(); + //reporteSancion(); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } finally { + btnEnviar = "true"; + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); +// request.modifiedData().put("cdecomiso",cDecomiso); + request.modifiedData().put("TID", tid); + request.modifiedData().put("isnew", "Y"); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + btnEnviar = null; + isEnableEnviar = Boolean.FALSE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Seleccionar Arma para sancionarla + * + * @param event + */ + public void seleccionarArma1212(AjaxBehaviorEvent event) { + try { + SelectBooleanCheckbox booleanCheckbox = (SelectBooleanCheckbox) event.getComponent(); + decomisoArmaObj = (TarmDecomisoArma) booleanCheckbox.getAttributes().get("armaDecomisadaObj"); + boolean checked = (Boolean) booleanCheckbox.getValue(); + if (checked) { + decomisoArmaObj.setEnbodega("Y"); + } else { + decomisoArmaObj.setEnbodega(null); + } + decomisoArmaController.update(decomisoArmaObj); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Sancion Para la autorizacion + * + * @param pCdocumento + */ + public void sancionarAutorizaciona121212(Long pCdocumento) { + try { + sancionDecomisoController.create(); + sancionDecomisoController.getRecord().setCdocumento(pCdocumento); + tipsancion = "AUTORIZACION"; + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Busca la sancion + */ + public void changeType1212() { + sancion = DatosParaSancionesController.findxPk(sancion.getPk()); + } + + public DecomisoArmaController getDecomisoArmaController() { + return decomisoArmaController; + } + + public void setDecomisoArmaController( + DecomisoArmaController decomisoArmaController) { + this.decomisoArmaController = decomisoArmaController; + } + + public TarmDecomiso getDecomiso() { + return decomiso; + } + + public void setDecomiso(TarmDecomiso decomiso) { + this.decomiso = decomiso; + } + + public String getProvincia() { + return provincia; + } + + public void setProvincia(String provincia) { + this.provincia = provincia; + } + + public String getCanton() { + return canton; + } + + public void setCanton(String canton) { + this.canton = canton; + } + + public String getCiudad() { + return ciudad; + } + + public void setCiudad(String ciudad) { + this.ciudad = ciudad; + } + + public String getParroquia() { + return parroquia; + } + + public void setParroquia(String parroquia) { + this.parroquia = parroquia; + } + + public TgeneCatalogDetail getGradoCatalogDatail() { + return gradoCatalogDatail; + } + + public void setGradoCatalogDatail(TgeneCatalogDetail gradoCatalogDatail) { + this.gradoCatalogDatail = gradoCatalogDatail; + } + + public TgeneCatalogDetail getUnidadCatalogDatail() { + return unidadCatalogDatail; + } + + public void setUnidadCatalogDatail(TgeneCatalogDetail unidadCatalogDatail) { + this.unidadCatalogDatail = unidadCatalogDatail; + } + + public TarmDecomisoArma getDecomisoArmaObj() { + return decomisoArmaObj; + } + + public void setDecomisoArmaObj(TarmDecomisoArma decomisoArmaObj) { + this.decomisoArmaObj = decomisoArmaObj; + } + + public SancionDecomisoController getSancionDecomisoController() { + return sancionDecomisoController; + } + + public void setSancionDecomisoController( + SancionDecomisoController sancionDecomisoController) { + this.sancionDecomisoController = sancionDecomisoController; + } + + public SancionRecomendacionController getSancionRecomendacionController() { + return sancionRecomendacionController; + } + + public void setSancionRecomendacionController( + SancionRecomendacionController sancionRecomendacionController) { + this.sancionRecomendacionController = sancionRecomendacionController; + } + + public String getClasearma() { + return clasearma; + } + + public void setClasearma(String clasearma) { + this.clasearma = clasearma; + } + +// public List getTsancion() { +// return tsancion; +// } +// +// public void setTsancion(List tsancion) { +// this.tsancion = tsancion; +// } + public TarmTipoSancion getSancion() { + return sancion; + } + + public void setSancion(TarmTipoSancion sancion) { + this.sancion = sancion; + } + + public String getSanciontipo() { + return sanciontipo; + } + + public void setSanciontipo(String sanciontipo) { + this.sanciontipo = sanciontipo; + } + + public Boolean getGrillaAut() { + return grillaAut; + } + + public void setGrillaAut(Boolean grillaAut) { + this.grillaAut = grillaAut; + } + +// public Long getcDecomiso() { +// return cDecomiso; +// } +// +// public void setcDecomiso(Long cDecomiso) { +// this.cDecomiso = cDecomiso; +// } + public String getBtnEnviar() { + return btnEnviar; + } + + public Long getcTransaccion() { + return cTransaccion; + } + + public void setcTransaccion(Long cTransaccion) { + this.cTransaccion = cTransaccion; + } + + public void setBtnEnviar(String btnEnviar) { + this.btnEnviar = btnEnviar; + } + + public List getDocumentos() { + return documentos; + } + + public void setDocumentos(List documentos) { + this.documentos = documentos; + } + + public String getTipsancion() { + return tipsancion; + } + + public void setTipsancion(String tipsancion) { + this.tipsancion = tipsancion; + } + + public Boolean getSanc() { + return sanc; + } + + public void setSanc(Boolean sanc) { + this.sanc = sanc; + } + + public Boolean getIsExistDocHabilitante() { + return isExistDocHabilitante; + } + + public void setIsExistDocHabilitante(Boolean isExistDocHabilitante) { + this.isExistDocHabilitante = isExistDocHabilitante; + } + + public Boolean getIsEnableGrabar() { + return isEnableGrabar; + } + + public void setIsEnableGrabar(Boolean isEnableGrabar) { + this.isEnableGrabar = isEnableGrabar; + } + + public Boolean getIsEnableEnviar() { + return isEnableEnviar; + } + + public void setIsEnableEnviar(Boolean isEnableEnviar) { + this.isEnableEnviar = isEnableEnviar; + } + + public List getLarmas() { + return larmas; + } + + public void setLarmas(List larmas) { + this.larmas = larmas; + } + + public TarmRegistroArmas getRegarma() { + return regarma; + } + + public void setRegarma(TarmRegistroArmas regarma) { + this.regarma = regarma; + } + + public TarmArmas getArmaactual() { + return armaactual; + } + + public void setArmaactual(TarmArmas armaactual) { + this.armaactual = armaactual; + } + + public List getAutorizacion() { + return autorizacion; + } + + public void setAutorizacion(List autorizacion) { + this.autorizacion = autorizacion; + } + + public long getCdocumentohabilitanteaut() { + return cdocumentohabilitanteaut; + } + + public void setCdocumentohabilitanteaut(long cdocumentohabilitanteaut) { + this.cdocumentohabilitanteaut = cdocumentohabilitanteaut; + } + + public Boolean getAut() { + return aut; + } + + public void setAut(Boolean aut) { + this.aut = aut; + } + + public TarmCentroControl getCentrocontrol() { + return centroControl; + } + + public void setCentrocontrol(TarmCentroControl centrocontrol) { + this.centroControl = centrocontrol; + } + + public Boolean getReporte() { + return reporte; + } + + public void setReporte(Boolean reporte) { + this.reporte = reporte; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public TarmTipoArmaExplosivo getTipoarmaexplosivo() { + return tipoarmaexplosivo; + } + + public void setTipoarmaexplosivo(TarmTipoArmaExplosivo tipoarmaexplosivo) { + this.tipoarmaexplosivo = tipoarmaexplosivo; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public TcustPersonDetail getResponsableCentroControl() { + return responsableCentroControl; + } + + public void setResponsableCentroControl( + TcustPersonDetail responsableCentroControl) { + this.responsableCentroControl = responsableCentroControl; + } + + public TarmTramite getTramite() { + return tramite; + } + + public void setTramite(TarmTramite tramite) { + this.tramite = tramite; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public ReportController getReportController() { + return reportController; + } + + public ArmasController getArmasController() { + return armasController; + } + + public void setArmasController(ArmasController armasController) { + this.armasController = armasController; + } + + public TcustPersonDetail getPersonaUsuario() { + return personaUsuario; + } + + public void setPersonaUsuario(TcustPersonDetail personaUsuario) { + this.personaUsuario = personaUsuario; + } + + public DocumentoHabilitanteController getDocumentoHabilitanteController() { + return documentoHabilitanteController; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudAgenciaSucursalController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudAgenciaSucursalController.java new file mode 100644 index 0000000..2ae8488 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudAgenciaSucursalController.java @@ -0,0 +1,151 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmSolicitudAgenciaSucursal; + +/** + * Controlador que maneja {@link TarmSolicitudAgenciaSucursal} + * + * @author dcruz + * + */ +@ManagedBean +@ViewScoped +public class SolicitudAgenciaSucursalController extends + AbstractController { + + private static final long serialVersionUID = 1L; + + public SolicitudAgenciaSucursalController() throws Exception { + super(TarmSolicitudAgenciaSucursal.class); + } + + @PostConstruct + public void postConstruct() { + this.init(); +// this.querydatabase(); + } + + private void init() { + this.lrecord = new ArrayList<>(); + this.beanalias = "SOLICITUDAGENCIA"; + this.recperpage = 15; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = this.getDtoQuery(); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto);//se puede aniadir mas tablas + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response response = callerhelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList<>(); + MessageHelper.setMessageError(response); + } else { + this.lrecord = (List) response.get(beanalias); + this.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + SubQuery subQueryNombre = new SubQuery("TarmAgenciaSucursal", "nombre", "nombre", " i.pk=t.pk.cagencia"); + dto.addSubQuery(subQueryNombre); + + SubQuery subQueryResponsable = new SubQuery("TarmAgenciaSucursal", "responsable", "responsable", " i.pk=t.pk.cagencia"); + dto.addSubQuery(subQueryResponsable); + + SubQuery subQueryTipo = new SubQuery("TgeneCatalogDetail", "description", "ntipo", "i.pk.catalog = (select o.tipo from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)" + + " and i.pk.catalogcode=(select o.tipocodigo from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)"); + dto.addSubQuery(subQueryTipo); + SubQuery subQueryEstado = new SubQuery("TgeneCatalogDetail", "description", "nestado", "i.pk.catalog = (select o.estado from TarmAgenciaSucursal o where o.pk=t.pk.cagencia) " + + " and i.pk.catalogcode=(select o.estadocodigo from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)"); + dto.addSubQuery(subQueryEstado); + SubQuery subQueryProvincia = new SubQuery("TgeneProvince", "description", "nprovincia", "i.pk.provincecode=(select o.provincecode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)" + + " and i.pk.countrycode= (select o.countrycode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)"); + dto.addSubQuery(subQueryProvincia); + SubQuery subQueryCanton = new SubQuery("TgeneCanton", "description", "ncanton", "i.pk.countrycode= (select o.countrycode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)" + + " and i.pk.provincecode=(select o.provincecode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)" + + " and i.pk.cantoncode= (select o.cantoncode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)"); + dto.addSubQuery(subQueryCanton); + SubQuery subQueryParroquia = new SubQuery("TgeneParroquia", "description", "nparroquia", "i.pk.countrycode= (select o.countrycode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia) " + + " and i.pk.provincecode=(select o.provincecode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia) " + + " and i.pk.cantoncode= (select o.cantoncode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia) " + + " and i.pk.parroquiacode=(select o.parroquiacode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)"); + dto.addSubQuery(subQueryParroquia); + SubQuery subQueryCiudad = new SubQuery("TgeneCity", "description", "nciudad", "i.pk.countrycode= (select o.countrycode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia) " + + " and i.pk.provincecode=(select o.provincecode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)" + + " and i.pk.cantoncode=(select o.cantoncode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)" + + " and i.pk.citycode=(select o.citycode from TarmAgenciaSucursal o where o.pk=t.pk.cagencia)"); + dto.addSubQuery(subQueryCiudad); + return dto; + } + + @Override + public void save() { + try { + DtoSave dto = super.getDtoSave(); + if (!dto.pendingProcess()) { + return; + } + HashMap msaves = new HashMap(); + msaves.put(beanalias, dto); + Request request = callerhelper.getRequest(); + request.setSaveTables(msaves); + Response response = callerhelper.executeSave(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(response); + MessageHelper.setMessageInfo(response); + } else { + MessageHelper.setMessageError(response); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * M\u00e9todo para encontrar por solicitud + * + * @param solicitudCode + * @return List + */ + public static List findPorSolicitud(String solicitudCode) { + try { + SolicitudAgenciaSucursalController cc = new SolicitudAgenciaSucursalController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.csolicitud", solicitudCode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudArmasBPMController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudArmasBPMController.java new file mode 100644 index 0000000..3a2f9a1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudArmasBPMController.java @@ -0,0 +1,158 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.util.EstadosSolicitudBPM; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmSolicitud; + +/** + * Clase controladora del bean TarmSolicitud. + * + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SolicitudArmasBPMController extends AbstractController { + + public SolicitudArmasBPMController() throws Exception { + super(TarmSolicitud.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); +// beanalias = "SOLICITUDBPM"; +// listaEstadoSolicitud= new ArrayList(); + this.create(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { +// listaEstadoSolicitud = new ArrayList<>(); + DtoQuery dto = super.getDtoQuery(true); + dto.setMultirecord(false); + //nombre + SubQuery snombre = new SubQuery("TcustPersonDetail", "name", "nombre", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery snumerodocumento = new SubQuery("TcustPersonDetail", "identification", "identification", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery identificationcatalog = new SubQuery("TcustPersonDetail", "identificationcatalog", "identificationcatalog", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery identificationcatalogcode = new SubQuery("TcustPersonDetail", "identificationcatalogcode", "identificationcatalogcode", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + //tramite +// TarmTramite + SubQuery codigoTramite = new SubQuery("TarmTramite", "pk", "pk", "i.pk = t.ctramite"); + SubQuery tramitetipoautorizacion = new SubQuery("TarmTramite", "tipoautorizacion", "tipoautorizacion", "i.pk = t.ctramite"); + SubQuery tramitetipoautorizacioncode = new SubQuery("TarmTramite", "tipoautorizacioncodigo", "tipoautorizacioncodigo", "i.pk = t.ctramite"); + SubQuery tramitecategoria = new SubQuery("TarmTramite", "categoria", "categoria", "i.pk = t.ctramite"); + SubQuery tramitecategoriacodigo = new SubQuery("TarmTramite", "categoriacodigo", "categoriacodigo", "i.pk = t.ctramite"); + SubQuery tramiteusoactividad = new SubQuery("TarmTramite", "usoactividad", "usoactividad", "i.pk = t.ctramite"); + SubQuery tramiteusoactividadcodigo = new SubQuery("TarmTramite", "usoactividadcodigo", "usoactividadcodigo", "i.pk = t.ctramite"); + //estado + SubQuery estado = new SubQuery("TgeneCatalogDetail", "description", "estadoSolicitud", "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(estado); + + dto.addSubQuery(snumerodocumento); + dto.addSubQuery(snombre); + dto.addSubQuery(identificationcatalog); + dto.addSubQuery(identificationcatalogcode); + + dto.addSubQuery(codigoTramite); + dto.addSubQuery(tramitetipoautorizacion); + dto.addSubQuery(tramitetipoautorizacioncode); + dto.addSubQuery(tramitecategoria); + dto.addSubQuery(tramitecategoriacodigo); + dto.addSubQuery(tramiteusoactividad); + dto.addSubQuery(tramiteusoactividadcodigo); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); +// request.put("queryalias", "ESTADOSSOLICITUDBPMQUERY"); +// request.put("codigosolicitudbpm", this.getMfilters().get("numerosolicitud")); + + Response resp = callerhelper.executeQuery(request); +// if(resp.get("LISTASESTADOSOLICITUDBPM")!=null){ +// System.out.println("------------"+resp.get("LISTASESTADOSOLICITUDBPM").toString()); +// List listaEstadosSolicitud = (List)resp.get("LISTASESTADOSOLICITUDBPM"); +// for (Object[] item : listaEstadosSolicitud) { +// EstadosSolicitudBPM estados = new EstadosSolicitudBPM(); +// estados.setActividad(item[0]!=null?item[0].toString():""); +// estados.setUsuarioasignado(item[1]!=null?item[1].toString():""); +// estados.setGrupoasignado(item[2]!=null?item[2].toString():""); +// estados.setEstado(item[3]!=null?item[3].toString():""); +// estados.setFechacreacion(item[4]!=null?(Date)item[4]:null); +// estados.setFechainicio(item[5]!=null?(Date)item[5]:null); +// estados.setFechacompleta(item[6]!=null?(Date)item[6]:null); +// listaEstadoSolicitud.add(estados); +// } +// } + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + record = (TarmSolicitud) resp.get(beanalias); + super.postQuery((AbstractDataTransport) resp.get(beanalias)); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + } + +// public List getListaEstadoSolicitud() { +// return listaEstadoSolicitud; +// } +// +// public void setListaEstadoSolicitud( +// List listaEstadoSolicitud) { +// this.listaEstadoSolicitud = listaEstadoSolicitud; +// } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudArmasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudArmasController.java new file mode 100644 index 0000000..ef55949 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudArmasController.java @@ -0,0 +1,338 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.util.EstadosSolicitudBPM; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; + +/** + * Clase controladora del bean TarmSolicitud. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SolicitudArmasController extends AbstractController { + + private List listaEstadoSolicitud; + + public SolicitudArmasController() throws Exception { + super(TarmSolicitud.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "SOLICITUD"; + listaEstadoSolicitud = new ArrayList(); + this.create(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + listaEstadoSolicitud = new ArrayList<>(); + DtoQuery dto = super.getDtoQuery(true); + dto.setMultirecord(false); + //nombre + SubQuery snombre = new SubQuery("TcustPersonDetail", "name", "nombre", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery snumerodocumento = new SubQuery("TcustPersonDetail", "identification", "identification", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery identificationcatalog = new SubQuery("TcustPersonDetail", "identificationcatalog", "identificationcatalog", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + SubQuery identificationcatalogcode = new SubQuery("TcustPersonDetail", "identificationcatalogcode", "identificationcatalogcode", "i.pk.personcode = t.personcode and i.pk.dateto=(select max(dt.pk.dateto) from TcustPersonDetail dt where dt.pk.personcode=t.personcode)"); + //tramite +// TarmTramite + SubQuery codigoTramite = new SubQuery("TarmTramite", "pk", "pk", "i.pk = t.ctramite"); + SubQuery tramitetipoautorizacion = new SubQuery("TarmTramite", "tipoautorizacion", "tipoautorizacion", "i.pk = t.ctramite"); + SubQuery tramitetipoautorizacioncode = new SubQuery("TarmTramite", "tipoautorizacioncodigo", "tipoautorizacioncodigo", "i.pk = t.ctramite"); + SubQuery tramitecategoria = new SubQuery("TarmTramite", "categoria", "categoria", "i.pk = t.ctramite"); + SubQuery tramitecategoriacodigo = new SubQuery("TarmTramite", "categoriacodigo", "categoriacodigo", "i.pk = t.ctramite"); + SubQuery tramiteusoactividad = new SubQuery("TarmTramite", "usoactividad", "usoactividad", "i.pk = t.ctramite"); + SubQuery tramiteusoactividadcodigo = new SubQuery("TarmTramite", "usoactividadcodigo", "usoactividadcodigo", "i.pk = t.ctramite"); + //estado + SubQuery estado = new SubQuery("TgeneCatalogDetail", "description", "estadoSolicitud", "i.pk.catalog=t.estado and i.pk.catalogcode=t.estadocodigo"); + dto.addSubQuery(estado); + + dto.addSubQuery(snumerodocumento); + dto.addSubQuery(snombre); + dto.addSubQuery(identificationcatalog); + dto.addSubQuery(identificationcatalogcode); + + dto.addSubQuery(codigoTramite); + dto.addSubQuery(tramitetipoautorizacion); + dto.addSubQuery(tramitetipoautorizacioncode); + dto.addSubQuery(tramitecategoria); + dto.addSubQuery(tramitecategoriacodigo); + dto.addSubQuery(tramiteusoactividad); + dto.addSubQuery(tramiteusoactividadcodigo); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + if (this.getMfilters().get("numerosolicitud") != null) { + request.put("queryalias", "ESTADOSSOLICITUDBPMQUERY"); + request.put("codigosolicitudbpm", this.getMfilters().get("numerosolicitud")); + } + + Response resp = callerhelper.executeQuery(request); + if (resp.get("LISTASESTADOSOLICITUDBPM") != null) { + System.out.println("------------" + resp.get("LISTASESTADOSOLICITUDBPM").toString()); + List listaEstadosSolicitud = (List) resp.get("LISTASESTADOSOLICITUDBPM"); + for (Object[] item : listaEstadosSolicitud) { + EstadosSolicitudBPM estados = new EstadosSolicitudBPM(); + estados.setActividad(item[0] != null ? item[0].toString() : ""); + estados.setUsuarioasignado(item[1] != null ? item[1].toString() : ""); + estados.setGrupoasignado(item[2] != null ? item[2].toString() : ""); + estados.setEstado(item[3] != null ? item[3].toString() : ""); + estados.setFechacreacion(item[4] != null ? (Date) item[4] : null); + estados.setFechainicio(item[5] != null ? (Date) item[5] : null); + estados.setFechacompleta(item[6] != null ? (Date) item[6] : null); + listaEstadoSolicitud.add(estados); + } + } + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + record = (TarmSolicitud) resp.get(beanalias); + super.postQuery((AbstractDataTransport) resp.get(beanalias)); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + public void fijaPersona(TcustPersonDetail persondetail) throws Exception { + if (persondetail == null) { + return; + } + record.setPersoncode(persondetail.getPk().getPersoncode()); + } + + public void fijaInicioFlujoEnNO() throws Exception { + record.setInicioFlujo("N"); + } + + public void fijaInicioFlujoEnYES() throws Exception { + record.setInicioFlujo("Y"); + } + + public static TarmSolicitud findxSolicitudCodpersona(String codigoSolicitud, String codigoPersona) { + try { + SolicitudArmasController cc = new SolicitudArmasController(); + cc.init(); + cc.recperpage = 10000; + cc.addFilter("pk", codigoSolicitud); + cc.addFilter("personcode", codigoPersona); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmSolicitud findByCSolicitud(String cSolicitud) { + try { + SolicitudArmasController cc = new SolicitudArmasController(); + cc.init(); + cc.recperpage = 10000; + cc.addFilter("pk", cSolicitud); + cc.queryDBNormal(); + if (cc.lrecord.size() > 0) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findByCTramite(String cTramite) { + try { + SolicitudArmasController cc = new SolicitudArmasController(); + cc.init(); + cc.recperpage = 10000; + cc.addFilter("ctramite", cTramite); + cc.queryDBNormal(); + if (cc.lrecord.size() > 0) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * + * Metodo para encopntrar los tramites pertenecientes a una persona + * + * @param cPersona codigo de la persona + * @param cTramite codigo del tramite + * @return Listado de las solicitudes encontradas + */ + public static List findByPersonaCTramite(Integer cPersona, String cTramite) { + try { + SolicitudArmasController cc = new SolicitudArmasController(); + cc.init(); + cc.recperpage = 10000; + cc.addFilter("ctramite", cTramite); + cc.addFilter("personcode", String.valueOf(cPersona)); + + cc.queryDBNormal(); + if (cc.lrecord.size() > 0) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + // Version del metodo querydatabase normal sin filtros adicionales + @SuppressWarnings("unchecked") + protected void queryDBNormal() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + // Subquery + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void update(TarmSolicitud bean) throws Exception { + record = bean; + super.update(); + } + + public static TarmSolicitud find(String codigoSolicitud) { + try { + if (codigoSolicitud == null || codigoSolicitud.isEmpty()) { + return null; + } + SolicitudArmasController cc = new SolicitudArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", codigoSolicitud); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public List getListaEstadoSolicitud() { + return listaEstadoSolicitud; + } + + public void setListaEstadoSolicitud( + List listaEstadoSolicitud) { + this.listaEstadoSolicitud = listaEstadoSolicitud; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudCambioDepositoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudCambioDepositoController.java new file mode 100644 index 0000000..14c1676 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudCambioDepositoController.java @@ -0,0 +1,244 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TarmSolicitudTramite. Se reemplaza el archivo de + * deposito, se filtra por el codigo de solicitud + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SolicitudCambioDepositoController extends AbstractController { + + public SolicitudCambioDepositoController() throws Exception { + super(TarmSolicitudTramite.class); + } + + /** + * Variable que nos permite cargar el documento al Alfresco + */ + private UploadedFile uploadedFile; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "SOLICITUDDEPOSITO"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if (getMfilters().get("numerotramite") == null + && getMfilters().get("numerotramite").toString().trim().isEmpty()) { + MessageHelper.setMessageError("Ingrese el codigo de solicitud"); + return; + } + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void update() { + try { + String pathRuta = ""; + + String xPathLocation = getRutaDocumentoSolBase(record.getXpathcomprobante()); + if (uploadedFile != null && uploadedFile.getFileName() != null) { + String nombreArchivo = uploadedFile.getFileName(); + if (alfrescoController.uploadFile(uploadedFile.getInputstream(), nombreArchivo, xPathLocation)) { + pathRuta = xPathLocation + "/cm:" + nombreArchivo; + record.setXpathcomprobanteorignal(record.getXpathcomprobante()); + record.setXpathcomprobante(pathRuta); + TsafeUserDetail userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + record.setUsuariocambio(userDetail.getNickname()); + super.update(); + } else { + MessageHelper.setMessageError("Adjunte el documento"); + return; + } + } else { + MessageHelper.setMessageError("Adjunte el documento"); + return; + } + save(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase(String xpath) { + int index = xpath.lastIndexOf('/'); + xpath = xpath.substring(0, index); + xpath = xpath + "/cm:Cambio"; + System.out.println(xpath); + return xpath; + } + + /** + * Metodo que retorna la extencion del documento que se desea subir al + * alfresco + */ + public String getNombre(String ruta) { + int index = ruta.lastIndexOf('/'); + if (index == -1) { + return "cambiodocumento.jpg"; + } else { + return (ruta.substring(index + 1)).replace("cm:", ""); + } + } + + /** + * Carga el archivo a grabar en la memoria para su posterior persistencia en + * el Alfresco + */ + public void handleUpload(FileUploadEvent event) { + uploadedFile = event.getFile(); + } + + /** + * Recorta el nombre del archivo a cargarse + * + * @param nombre + * @return nombre recortado + */ + public String recorteNombre(String nombre) { + String fielname = nombre; + if (fielname.length() > 30) { + fielname = fielname.substring(0, 30) + extencionArchivo(nombre); + } + return fielname; + } + + /** + * Obtiene la extencion del archivo a cargar + * + * @param nombre + * @return + */ + private String extencionArchivo(String nombre) { + int pos = nombre.lastIndexOf('.'); + nombre = nombre.substring(pos); + return nombre; + } + + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudCertificadoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudCertificadoController.java new file mode 100644 index 0000000..b29e8ab --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudCertificadoController.java @@ -0,0 +1,455 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.apache.commons.io.FilenameUtils; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.model.UploadedFile; + +import com.fp.common.helper.Constant; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +//import com.fp.frontend.controller.pgeneral.menu.MenuController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmCertificadoFiscalia; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora para subir solicitudes de Certificados de Fiscalia. + * + * @author Manuel Cepeda. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SolicitudCertificadoController extends AbstractController { + +// @ManagedProperty(value = "#{menuController}") +// private MenuController menuController; + /** + * Propiedad que premite controlar operaciones de cargar archivos al + * Alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + /** + * codigo de la provincia del usuario logeado + */ + private String cprovincia; + + /** + * Variable que nos permite cargar el comprobante de deposito al Alfresco + */ + private UploadedFile uploadedFile; + private TsafeUserDetail tsafeUserDetail; + private String cargado; + /** + * Deshabilita la pantalla después de grabar la solicitud + */ + private boolean deshabilitarPantalla; + /** + * Indica si el flujo ya fue iniciado, sirve para controlar que no iniciar + * el flujo mas de una vez. + */ + private boolean flujoiniciado; + private boolean grabarInformacion; + + public SolicitudCertificadoController() throws Exception { + super(TarmCertificadoFiscalia.class); + } + + /** + * Método que se ejecuta después del constructor + */ + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + /** + * Inicializa valores del controlador + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + record = new TarmCertificadoFiscalia(); + beanalias = "CERTIFICADOFISCALIA"; + tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + record.setNrsolicitud(null); + TarmCentroControl centroControl = Utilidades.obtenerCentroControl(); + cprovincia = centroControl.getProvincecode(); + grabarInformacion = true; + flujoiniciado = true; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if (deshabilitarPantalla) { + return; + } + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("pk desc"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + if (request.containsKey("querytype")) { + request.remove("querytype"); + } + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + if (lrecord != null && !lrecord.isEmpty()) { + record = lrecord.get(0); + super.postQuery(this.lrecord); + } + + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() throws Exception { + // TODO Auto-generated method stub + super.next(); + } + + @Override + public void save() { + try { + if (grabarInformacion) { + return; + } + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + uploadCertificado(); + if (tsafeUserDetail != null) { + record.setPersoncode(tsafeUserDetail.getPk().getPersoncode()); + } + Request request = callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + deshabilitarPantalla = Boolean.TRUE; + flujoiniciado = Boolean.FALSE; + grabarInformacion = Boolean.TRUE; + MessageHelper.setMessageInfo(resp); +// init(); + } else { + //MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + //MessageHelper.setMessageError(e); + } + } + + /** + * Método para el inicio de flujo + */ + public void iniciarFlujo() { + try { + if (flujoiniciado) { + return; + } + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + request.modifiedData().put("isnew", "Y"); + request.modifiedData().put("csolicitud", record.getNrsolicitud()); + request.modifiedData().put("numerosolicitud", record.getNrsolicitud()); + request.modifiedData().put("cprovincia", cprovincia); + request.modifiedData().put("xpath", record.getXpath()); + + request.setLogsolicitude(record.getNrsolicitud()); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.setShowRow(true); + + deshabilitarPantalla = Boolean.FALSE; + flujoiniciado = Boolean.TRUE; + grabarInformacion = Boolean.TRUE; + + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + " SOLICITUD: " + record.getNrsolicitud()); + +// RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void updateAutorizacion() throws Exception { + super.update(); + } + + /** + * Método que se ejecuta al carga edición + * + * @throws Exception + */ + public void loadEdit() throws Exception { +// setSelectedDocumentos(record.getDocumento().split(", ")); + } + + @Override + public void create() throws Exception { + super.create(); + if (record != null) { + record.setFcreacion(new Date()); + if (tsafeUserDetail != null) { + TcustPersonDetail personDetail = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + if (personDetail != null) { + record.setNombresolicitante(personDetail.getName()); + } + } + try { + obtenerSecuencialSolicitud(); + } catch (Throwable e) { + e.printStackTrace(); + } + uploadedFile = null; + setCargado(Constant.STR_N); + setGrabarInformacion(true); + setFlujoiniciado(false); + } + } + + public void update(TarmCertificadoFiscalia bean) throws Exception { + record = bean; + updateAutorizacion(); + } + + public void actualizar(TarmCertificadoFiscalia arma) throws Exception { + record = arma; + super.update(); + } + + /** + * Permite obtener el Archivo previamente cargado en la pagina + * + * @param event + */ + public void handleUpload(FileUploadEvent event) { + uploadedFile = event.getFile(); + setCargado(Constant.STR_Y); + } + + /** + * Método de carga de archivos en Alfresco + * + * @param event + */ + public void uploadCertificado() { + try { + if (uploadedFile != null && uploadedFile.getFileName() != null && !"".equals(uploadedFile.getFileName())) { + String xPathLocation = getRutaDocumentoCertificadoBase() + "/cm:" + record.getNrsolicitud(); + String nombreArchivo = "Certificado_01." + FilenameUtils.getExtension(uploadedFile.getFileName()); + if (alfrescoController.uploadFile(uploadedFile.getInputstream(), nombreArchivo, xPathLocation)) { + setCargado(Constant.STR_Y); + record.setXpath(xPathLocation + "/cm:" + nombreArchivo); + + } + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoCertificadoBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta = new StringBuilder("cm:Certificados"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + return ruta.toString(); + } + + /** + * Arma la petición al core para solicitar un número de + * secuencial para la solicitud antes de guardarla + * + * @throws Throwable + */ + private void obtenerSecuencialSolicitud() throws Throwable { + Request request = callerhelper.getRequest(); + DtoQuery dtoQuery = super.getDtoQuery(true); + HashMap mapQuery = new HashMap(); + mapQuery.put(beanalias, dtoQuery); + request.put("querytype", "T"); + request.setQueryTables(mapQuery); + Response response = callerhelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(response); + } else { + getRecord().setNrsolicitud(response.get("SECUENCIALCERTIFICADOFISCAL").toString()); + } + } + + /** + * Metodod que devuelve un CertificadoFiscalia por el codigo de solicitud + * + * @param codigoSolicitud + * @return TarmCertificadoFiscalia + */ + public static TarmCertificadoFiscalia findPorSolicitud(String codigoSolicitud) { + try { + if (codigoSolicitud == null || codigoSolicitud.isEmpty()) { + return null; + } + SolicitudCertificadoController cc = new SolicitudCertificadoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("nrsolicitud", codigoSolicitud); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + @Override + public void update() throws Exception { + grabarInformacion = Boolean.FALSE; + flujoiniciado = Boolean.TRUE; + deshabilitarPantalla = Boolean.TRUE; + super.update(); + } + +// public MenuController getMenuController() { +// return menuController; +// } +// +// public void setMenuController(MenuController menuController) { +// this.menuController = menuController; +// } + /** + * @return the uploadedFile + */ + public UploadedFile getUploadedFile() { + return uploadedFile; + } + + /** + * @param uploadedFile the uploadedFile to set + */ + public void setUploadedFile(UploadedFile uploadedFile) { + this.uploadedFile = uploadedFile; + } + + /** + * @return the alfrescoController + */ + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + /** + * @param alfrescoController the alfrescoController to set + */ + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + /** + * @return the cargado + */ + public String getCargado() { + return cargado; + } + + /** + * @param cargado the cargado to set + */ + public void setCargado(String cargado) { + this.cargado = cargado; + } + + public boolean isDeshabilitarPantalla() { + return deshabilitarPantalla; + } + + public void setDeshabilitarPantalla(boolean deshabilitarPantalla) { + this.deshabilitarPantalla = deshabilitarPantalla; + } + + public boolean isFlujoiniciado() { + return flujoiniciado; + } + + public void setFlujoiniciado(boolean flujoiniciado) { + this.flujoiniciado = flujoiniciado; + } + + public String getCprovincia() { + return cprovincia; + } + + public void setCprovincia(String cprovincia) { + this.cprovincia = cprovincia; + } + + /** + * @return the grabarInformacion + */ + public boolean isGrabarInformacion() { + return grabarInformacion; + } + + /** + * @param grabarInformacion the grabarInformacion to set + */ + public void setGrabarInformacion(boolean grabarInformacion) { + this.grabarInformacion = grabarInformacion; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudController.java new file mode 100644 index 0000000..d314913 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudController.java @@ -0,0 +1,223 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmSolicitud; + +/** + * Controlador que se encarga del manejo de {@link TarmSolicitud} + * + * @author dcruz + * + */ +public class SolicitudController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public SolicitudController() throws Exception { + super(TarmSolicitud.class); + } + + @PostConstruct + public void postConstruct() { + this.init(); +// super.startQuery(); + } + + private void init() { + this.beanalias = "SOLICITUD"; + this.recperpage = 15; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + SubQuery qryprovorigen = new SubQuery("TgeneProvince", "description", "provinciaorigen", "i.pk.countrycode = t.cpaisorigen and i.pk.provincecode=t.cprovinciaorigen"); + dto.addSubQuery(qryprovorigen); + SubQuery qryctnorigen = new SubQuery("TgeneCanton", "description", "cantonorigen", "i.pk.countrycode = t.cpaisorigen and i.pk.provincecode=t.cprovinciaorigen and i.pk.cantoncode=t.ccantonorigen"); + dto.addSubQuery(qryctnorigen); + SubQuery qryprovdest = new SubQuery("TgeneProvince", "description", "provinciadestino", "i.pk.countrycode = t.cpaisdestino and i.pk.provincecode=t.cprovinciadestino"); + dto.addSubQuery(qryprovdest); + SubQuery qryctndest = new SubQuery("TgeneCanton", "description", "cantondestino", "i.pk.countrycode = t.cpaisdestino and i.pk.provincecode=t.cprovinciadestino and i.pk.cantoncode=t.ccantondestino"); + dto.addSubQuery(qryctndest); + SubQuery qrycprovincecode = new SubQuery("TarmCentroControl", "provincecode", "provincecode", "i.pk = t.ccentrocontrol"); + dto.addSubQuery(qrycprovincecode); + //dto.setOrderby("t.nombre"); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static List find() { + return null; + } + + public static List findSolicitudxPersona(String personcode) { + try { + SolicitudController cc = new SolicitudController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("personcode", personcode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmSolicitud findSolicitudxcodsolicitud(String csolicitud) { + System.out.println("Codigo de solicitud SolicitudCOntroller.." + csolicitud); + try { + SolicitudController cc = new SolicitudController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", csolicitud); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para encontrar por numero de solicitud + * + * @param numeroSolicitud + * @return solicitud encontrada con este numero + */ + public static TarmSolicitud findSolicitudxnumerosolicitud(String numeroSolicitud) { + try { + SolicitudController cc = new SolicitudController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("numerosolicitud", numeroSolicitud); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que obtiene una solicitud por el codigo del tramite + * + * @param csolicitud + * @return + */ + public static TarmSolicitud findSolicitudByCtramite(String ctramite) { + try { + SolicitudController cc = new SolicitudController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("ctramite", ctramite); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Find con el cual se valida una persona con una solicitud + * + * @param personcode + * @param csolicitud + * @return + */ + public static Boolean existeRegistroPersona(Integer personcode, String csolicitud) { + try { + SolicitudController cc = new SolicitudController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", csolicitud); + cc.addFilter("personcode", personcode.toString()); + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return true; + } + return false; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return false; + } + + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void updateSolicitud(TarmSolicitud bean) throws Exception { + this.beanalias = "SOLICITUD"; + this.record = bean; + super.update(); + this.save(); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudGuardiasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudGuardiasController.java new file mode 100644 index 0000000..e7aedf3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudGuardiasController.java @@ -0,0 +1,217 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.GuardiasController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitudGuardias; + +@ManagedBean +@ViewScoped +public class SolicitudGuardiasController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public SolicitudGuardiasController() throws Exception { + super(TarmSolicitudGuardias.class); + } + + /** + * Método que se ejecuta despues del controlador + */ + @PostConstruct + public void postConstruct() { + this.init(); + super.startQuery(); + this.getMfilters().clear(); + } + + /** + * Inicializa variables + */ + private void init() { + try { + recperpage = 300; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); +// record = new TarmSolicitudGuardias(); + beanalias = "SOLICITUDGUARDIAS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dtoQuery = super.getDtoQuery(Boolean.TRUE); + HashMap mtables = new HashMap(); + dtoQuery.setOrderby("pk.csolicitud"); + mtables.put(beanalias, dtoQuery); + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response response = this.callerhelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(response); + } else { + this.lrecord = (List) response.get(beanalias); + for (TarmSolicitudGuardias tarmSolicitudGuardias : this.lrecord) { + TarmGuardias guardia = new TarmGuardias(); + guardia = GuardiasController.find(String.valueOf(tarmSolicitudGuardias.getPk().getCguardia()), String.valueOf(tarmSolicitudGuardias.getPk().getCempresa())); + //tarmSolicitudGuardias.modifiedData().put("guardia",guardia!=null?guardia:new TarmGuardias()); + tarmSolicitudGuardias.modifiedData().put("nombre", guardia == null ? "" : guardia.getModifiedData().get("gnombre")); + tarmSolicitudGuardias.modifiedData().put("identificador", guardia == null ? "" : guardia.getModifiedData().get("gcedula")); + tarmSolicitudGuardias.modifiedData().put("estado", guardia == null ? "" : guardia.getEstado()); + tarmSolicitudGuardias.modifiedData().put("guardia", guardia == null ? "" : guardia.getPk()); + + } + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaseGuardia() { + try { + DtoQuery dtoQuery = super.getDtoQuery(Boolean.TRUE); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dtoQuery); + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + Response response = this.callerhelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(response); + } else { + this.lrecord = (List) response.get(beanalias); + for (TarmSolicitudGuardias tarmSolicitudGuardias : this.lrecord) { + TarmGuardias guardia = new TarmGuardias(); + guardia = GuardiasController.find(String.valueOf(tarmSolicitudGuardias.getPk().getCguardia()), String.valueOf(tarmSolicitudGuardias.getPk().getCempresa())); + //tarmSolicitudGuardias.modifiedData().put("guardia",guardia!=null?guardia:new TarmGuardias()); + tarmSolicitudGuardias.modifiedData().put("nombre", guardia == null ? "" : guardia.getModifiedData().get("gnombre")); + tarmSolicitudGuardias.modifiedData().put("identificador", guardia == null ? "" : guardia.getModifiedData().get("gcedula")); + tarmSolicitudGuardias.modifiedData().put("estado", guardia == null ? "" : guardia.getModifiedData().get("estado")); + + } + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Retorna guardias en base a un criterio + * + * @param solicitudCode código de la solicitud + * @return + */ + public List findPorSolicitud(String solicitudCode) { + try { + SolicitudGuardiasController cc = new SolicitudGuardiasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.csolicitud", solicitudCode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Devuelve todas las solicitudes encontradas + * + * @return + */ + public static List find() { + try { + SolicitudGuardiasController cc = new SolicitudGuardiasController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + @Override + public void save() { + try { + DtoSave dtoSave = super.getDtoSave(); + dtoSave.setReturnpk(Boolean.TRUE); + if (!dtoSave.pendingProcess()) { + return; + } + HashMap msaves = new HashMap(); + msaves.put(beanalias, dtoSave); + Request request = callerhelper.getRequest(); + request.setSaveTables(msaves); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para el inicio de flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("pk.csolicitud", "1"); + request.modifiedData().put("csolicitud", "1"); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudRequisitosController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudRequisitosController.java new file mode 100644 index 0000000..fa24d32 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudRequisitosController.java @@ -0,0 +1,317 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.event.ActionEvent; + +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang.StringUtils; +import org.primefaces.event.FileUploadEvent; + +import com.fp.common.helper.Constant; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.RequisitoPorTipoTramiteController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmRequisitoPorTipoTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitos; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitosKey; + +/** + * Clase controladora del bean TarmSolicitud. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SolicitudRequisitosController extends AbstractController { + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + private Boolean auxBotonVerificacion; + + public SolicitudRequisitosController() throws Exception { + super(TarmSolicitudRequisitos.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 100; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "REQUISITOPORTIPOTRAMITE"; + auxBotonVerificacion = Boolean.FALSE; + this.create(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + // dto.setOrderby("t.nombre"); + + SubQuery subNombre = new SubQuery("TarmRequisito", "nombre", "nombre", "i.pk = t.pk.crequisito"); + + dto.addSubQuery(subNombre); + SubQuery subDesCorta = new SubQuery("TarmRequisito", "descripcioncorta", "descripcion", "i.pk = t.pk.crequisito"); + + dto.addSubQuery(subDesCorta); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + public void fijaSolicitud(String csolicitud) throws Exception { + if (csolicitud == null) { + return; + } + record.getPk().setCsolicitud(csolicitud); + } + + public void consultaPorTipoTramite(String ctipotramite) throws Exception { + if (record == null) { + super.create(); + } + List lrequisitos = RequisitoPorTipoTramiteController.find(ctipotramite); + for (TarmRequisitoPorTipoTramite obj : lrequisitos) { + TarmSolicitudRequisitosKey key = new TarmSolicitudRequisitosKey(); + key.setCrequisito(obj.getPk().getCrequisito()); + // key.setCtipotramite(obj.getPk().getCtipotramite()); + TarmSolicitudRequisitos sol = new TarmSolicitudRequisitos(); + sol.setPk(key); + sol.modifiedData.put("nrequisito", obj.modifiedData.get("nrequisito")); + sol.setCargado("N"); + lrecord.add(sol); + } + } + + /** + * Retorna la ruta de documento base en donde se almacenará dicho + * archivo + * + * @return + */ + public String getRutaDocumentoSolBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta = new StringBuilder("cm:Solicitudes"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + return ruta.toString(); + } + + /** + * guarda actualiza el numero de documentos subidos a alfresco + */ + public void guardarRegistro(ActionEvent event) { + System.out.println("Actualizo la fila requisito"); + System.out.println(event.getComponent().getAttributes().get("xPathLocation")); + record.setCargado(Constant.STR_Y); + } + + public static List find(String codigoSolicitud) { + try { + SolicitudRequisitosController cc = new SolicitudRequisitosController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.csolicitud", codigoSolicitud); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Método para manejar el evento change en el CheckBox + * + * @throws Exception + */ + public void onActualizar(TarmSolicitudRequisitos bean) throws Exception { + record = bean; + update(); + } + + /** + * Método para manejar el evento change en el CheckBox + * + * @throws Exception + */ + public void onChangeAprobado(TarmSolicitudRequisitos principal) throws Exception { + if (principal.getEstadovalidacion() == null || principal.getEstadovalidacion().equals("N")) { + principal.setEstadovalidacion("Y"); + } else { + principal.setEstadovalidacion("N"); + } + record = principal; + update(); + validaiones(); + } + + public void validaiones() { + auxBotonVerificacion = Boolean.TRUE; + for (TarmSolicitudRequisitos item : lrecord) { + if (item.getEstadovalidacion() == null || item.getEstadovalidacion().equals("N")) { + auxBotonVerificacion = Boolean.FALSE; + return; + } + } + } + + /** + * Método de carga de archivos en Alfresco + * + * @param event + */ + public void uploadRequisitos(FileUploadEvent event) { + TarmSolicitudRequisitos solicitudRequisitos = null; + try { + String xPathLocation = (String) event.getComponent().getAttributes().get("xPathLocation"); + solicitudRequisitos = (TarmSolicitudRequisitos) event.getComponent().getAttributes().get("record"); + String nombreArchivo = "Documento_" + obtieneNombreLimpio(solicitudRequisitos.getModifiedData().get("crequisito") != null ? solicitudRequisitos.getModifiedData().get("crequisito").toString() : "") + "." + FilenameUtils.getExtension(event.getFile().getFileName()); + if (solicitudRequisitos != null + && alfrescoController.uploadFile(event.getFile().getInputstream(), + nombreArchivo, + xPathLocation)) { + solicitudRequisitos.setCargado(Constant.STR_Y); + solicitudRequisitos.setXpathrequisito(xPathLocation + "/cm:" + nombreArchivo); + this.record = solicitudRequisitos; + this.record.setIsnew(Boolean.FALSE); + this.update(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Reemplazo un string los caracteres en blanco y reemplazo caracteres + * especiales + * + * @param toConvert + * @return la cadena convertida + */ + private String obtieneNombreLimpio(String toConvert) { + return StringUtils.replaceEach(StringUtils.deleteWhitespace(toConvert), + new String[]{"\u00e1", "\u00e9", "\u00ed", "\u00f3", "\u00fa", "\u00c1", "\u00c9", "\u00cd", "\u00d3", "\u00da", "\u00F1", "\u00d1"}, + new String[]{"a", "e", "i", "o", "u", "A", "E", "I", "O", "U", "n", "N"}); + } + + /** + * Entrega el valor de: alfrescoController + * + * @return AlfrescoController + */ + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + /** + * Fija el valor de: alfrescoController + * + * @param alfrescoController Valor a fijar en el atributo. + */ + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public Boolean getAuxBotonVerificacion() { + return auxBotonVerificacion; + } + + public void setAuxBotonVerificacion(Boolean auxBotonVerificacion) { + this.auxBotonVerificacion = auxBotonVerificacion; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudTramiteController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudTramiteController.java new file mode 100644 index 0000000..de910b3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/SolicitudTramiteController.java @@ -0,0 +1,295 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.apache.commons.httpclient.methods.GetMethod; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pentaho.PentahoController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SolicitudTramiteController extends AbstractController { + + /** + * Constructor + * + * @throws Exception + */ + public SolicitudTramiteController() throws Exception { + super(TarmSolicitudTramite.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "SOLICITUDTRAM"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + + SubQuery subqueryestadosolicitud = new SubQuery("TarmSolicitud", "estado", "estadoSolicitud", "i.pk=t.pk.csolicitud"); + dto.addSubQuery(subqueryestadosolicitud); + + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + if (getMfilelds().get("cargadeposito") != null) { + Filter filtro = new Filter(); + filtro.setSql(getMfilelds().get("cargadeposito").toString()); + dto.addFiltro(filtro); + } + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void updateSolicitud(TarmSolicitudTramite bean) throws Exception { + this.setRecord(bean); + super.update(); + } + + /** + * Metod para actualizar registro + * + * @param bean + * @throws Exception + */ + public void updateSimple(TarmSolicitudTramite bean) throws Exception { + try { + this.record = bean; + super.update(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * Metod para crear un nuevo registro y poner en la lista new + * + * @param bean + * @throws Exception + */ + public void update(TarmSolicitudTramite bean) throws Exception { + super.create(); + record.getPk().setCsolicitud(bean.getPk().getCsolicitud()); + record.getPk().setCtramite(bean.getPk().getCtramite()); + record.setNumerotramite(bean.getNumerotramite()); + record.setValorapagar(bean.getValorapagar()); + record.setValorcustodios(bean.getValorcustodios()); + record.setValortramitearmas(bean.getValortramitearmas()); + record.setValormulta(bean.getValormulta()); + record.setEstadotramite(bean.getEstadotramite()); + record.setEstadotramitecodigo(bean.getEstadotramitecodigo()); + super.update(); + } + + public static TarmSolicitudTramite findByCSolicitud(String csolicitud) { + try { + SolicitudTramiteController cc = new SolicitudTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.csolicitud", csolicitud); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmSolicitudTramite findByNumTramite(String numerotramite) { + try { + SolicitudTramiteController cc = new SolicitudTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("numerotramite", numerotramite); + cc.querydatabase(); + if (cc.lrecord != null) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmSolicitudTramite findByNumeroTramiteCarga(String numerotramite) { + try { + SolicitudTramiteController cc = new SolicitudTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("numerotramite", numerotramite); + cc.getMfilelds().put("cargadeposito", "numerocomprobante is null ");//and csolicitud =" + //+ "(select o.pk from TarmSolicitud o where o.estado='APB' and o.pk=(select p.numerotramite from TarmSolicitudTramite p where p.numerotramite='"+numerotramite+"'))");// + cc.querydatabase(); + if (cc.lrecord != null && cc.lrecord.size() > 0) { + if (codigoParametro("ACEPTADO").equals(cc.lrecord.get(0).getModifiedData().get("estadoSolicitud"))) {//"APB" + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Método para obtener los codigos de la tabla de parametros + * + * @return codigoAceptado + * @throws Exception + */ + private static String codigoParametro(String codigo) throws Exception { + TgeneParameters f = ParametersController.find(codigo, "1");//APB ESTADOSOLICITUD + return f.getTextvalue(); + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + protected void querydatabaseNumeroComprobante() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + Filter filtro = new Filter(); + filtro.setSql("(t.estadotramite<>'ANU' AND t.estadotramite<>'ANUDEP')"); + dto.addFiltro(filtro); + SubQuery subqueryestadosolicitud = new SubQuery("TarmSolicitud", "estado", "estadoSolicitud", "i.pk=t.pk.csolicitud"); + dto.addSubQuery(subqueryestadosolicitud); + + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static List findByNumeroComprobante(String numComprobante) { + try { + SolicitudTramiteController cc = new SolicitudTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("numerocomprobante", numComprobante); + cc.querydatabaseNumeroComprobante(); + return cc.lrecord; + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + public static List findByEstado(String estado) { + try { + SolicitudTramiteController cc = new SolicitudTramiteController(); + cc.init(); + cc.recperpage = 30; + cc.addFilter("estadotramite", estado); + cc.querydatabase(); + return cc.lrecord; + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/TarmSolicitudArmasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/TarmSolicitudArmasController.java new file mode 100644 index 0000000..5e9979b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/TarmSolicitudArmasController.java @@ -0,0 +1,235 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.Utilidades; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class TarmSolicitudArmasController extends AbstractController { + + String csolicitud; + String aprobada; + String porDevolucion; + + private List lArmas = new ArrayList(); + + public TarmSolicitudArmasController() throws Exception { + super(TarmSolicitudArmas.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + } + + private void init() { + try { + recperpage = 100; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "TARMSOLICITUDARMASCONTROLLER"; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + + if (csolicitud != null) { + dto.addFiltro(new Filter("pk.csolicitud", csolicitud)); + } + + if (porDevolucion != null) { + dto.addFiltro(new Filter("pordevolucion", porDevolucion)); + } + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + + lArmas.clear(); + + //Obteniendo los datos de las armas + for (TarmSolicitudArmas solicitudArmas : lrecord) { + TarmArmas tarmArma = new TarmArmas(); + tarmArma = ArmasController.findPorCodigo(solicitudArmas.getPk().getCarma()); + lArmas.add(tarmArma); + solicitudArmas.modifiedData().put("clase", tarmArma == null || tarmArma.getModifiedData().get("clase") == null ? "" : tarmArma.getModifiedData().get("clase")); + solicitudArmas.modifiedData().put("tipo", tarmArma == null || tarmArma.getModifiedData().get("tipo") == null ? "" : tarmArma.getModifiedData().get("tipo")); + solicitudArmas.modifiedData().put("calibre", tarmArma == null || tarmArma.getModifiedData().get("calibre") == null ? "" : Utilidades.formatearDecimalesEnTexto(tarmArma.getModifiedData().get("calibre").toString(), "#.000")); + solicitudArmas.modifiedData().put("modelo", tarmArma == null || tarmArma.getModelo() == null || tarmArma.getModelo().isEmpty() ? "" : tarmArma.getModelo()); + solicitudArmas.modifiedData().put("marca", tarmArma == null || tarmArma.getMarca() == null || tarmArma.getMarca().isEmpty() || tarmArma.getMarcacodigo() == null || tarmArma.getMarcacodigo().isEmpty() ? "" : CatalogDetailController.findxCodigoCodcatalogo(tarmArma.getMarca(), tarmArma.getMarcacodigo()).getDescription()); + solicitudArmas.modifiedData().put("color", tarmArma == null || tarmArma.getColor() == null || tarmArma.getColor().isEmpty() || tarmArma.getColorcodigo() == null || tarmArma.getColorcodigo().isEmpty() ? "" : CatalogDetailController.findxCodigoCodcatalogo(tarmArma.getColor(), tarmArma.getColorcodigo()).getDescription()); + solicitudArmas.modifiedData().put("carma", tarmArma == null ? "" : tarmArma.getPk()); + solicitudArmas.modifiedData().put("seriecannon", tarmArma == null || tarmArma.getSeriecanon() == null || tarmArma.getSeriecanon().isEmpty() ? "" : tarmArma.getSeriecanon()); + solicitudArmas.modifiedData().put("estado", tarmArma == null || tarmArma.getEstado() == null || tarmArma.getEstado().isEmpty() || tarmArma.getEstadocodigo() == null || tarmArma.getEstadocodigo().isEmpty() ? "" : CatalogDetailController.findxCodigoCodcatalogo(tarmArma.getEstado(), tarmArma.getEstadocodigo()).getDescription()); + solicitudArmas.modifiedData().put("cantidad", tarmArma == null || tarmArma.getCantidad() == null ? "" : tarmArma.getCantidad()); + solicitudArmas.modifiedData().put("unidadmedida", tarmArma == null || tarmArma.getUnidadmedidacantidad() == null ? "" : tarmArma.getUnidadmedidacantidad()); + solicitudArmas.modifiedData().put("lote", tarmArma == null || tarmArma.getLote() == null ? "" : tarmArma.getLote()); + solicitudArmas.modifiedData().put("modelo", tarmArma == null || tarmArma.getModelo() == null ? "" : tarmArma.getModelo()); + solicitudArmas.modifiedData().put("peso", tarmArma == null || tarmArma.getPeso() == null ? "" : tarmArma.getPeso()); + } + + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private void querydatabaseCountArmas() { + try { + DtoQuery dto = super.getDtoQuery(true); + HashMap mtables = new HashMap(); + mtables.put("TARMSOLICITUDARMASCONTROLLER", dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get("TARMSOLICITUDARMASCONTROLLER"); + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static List findPorSolicitud(Integer personcode) { + try { + TarmSolicitudArmasController cc = new TarmSolicitudArmasController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("personcode", personcode.toString()); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * M\u00e9todo para calcular el n\u00famero de armas de una solicitud. + * Recibe codigo de solicitud + * + * @param cSolicitud + * + */ + public static Integer getNumeroArmasPorSolicitud(String cSolicitud) { + TarmSolicitudArmasController solicitudArmasController; + try { + solicitudArmasController = new TarmSolicitudArmasController(); + solicitudArmasController.addFilter("pk.csolicitud", cSolicitud); + solicitudArmasController.setRecperpage(15000); + solicitudArmasController.querydatabaseCountArmas(); + return solicitudArmasController.lrecord.size(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return 0; + } + + } + + /** + * M\u00e9todo para encontrar por solicitud + * + * @param solicitudCode + * @return + */ + public static List findPorCSolicitud(String solicitudCode) { + try { + TarmSolicitudArmasController cc = new TarmSolicitudArmasController(); + cc.init(); + cc.recperpage = 30000; + cc.addFilter("pk.csolicitud", solicitudCode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public String getAprobada() { + return aprobada; + } + + public void setAprobada(String aprobada) { + this.aprobada = aprobada; + } + + public List getlArmas() { + return lArmas; + } + + public void setlArmas(List lArmas) { + this.lArmas = lArmas; + } + + public String getPorDevolucion() { + return porDevolucion; + } + + public void setPorDevolucion(String porDevolucion) { + this.porDevolucion = porDevolucion; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/TarmSolicitudDocumentoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/TarmSolicitudDocumentoController.java new file mode 100644 index 0000000..d12fe4f --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/TarmSolicitudDocumentoController.java @@ -0,0 +1,419 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +@ManagedBean +@ViewScoped +public class TarmSolicitudDocumentoController extends AbstractController { + + List documentos; +// String csolicitud; + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddressController; + + public TarmSolicitudDocumentoController() throws Exception { + super(TarmSolicitudDocumento.class); + // TODO Auto-generated constructor stub + } + + /** + * + */ + private static final long serialVersionUID = -1407102577264256543L; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta +// super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "DOCUMENTOSCONTROLLER"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + //Quemando el codigo de solicitud +// this.csolicitud="1"; + + DtoQuery dto = this.getDtoQuery(); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (lrecord != null && !lrecord.isEmpty()) { + for (TarmSolicitudDocumento doc : lrecord) { + doc.put("seleccionado", Boolean.FALSE); + } + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + SubQuery subQueryNumeroDoc = new SubQuery("TarmDocumentoHabilitante", "numerodocumento", "numerodocumento", "i.pk=t.pk.cdocumento"); + dto.addSubQuery(subQueryNumeroDoc); + SubQuery subQueryFechaEmision = new SubQuery("TarmDocumentoHabilitante", "fechaemision", "fechaemision", "i.pk=t.pk.cdocumento"); + dto.addSubQuery(subQueryFechaEmision); + SubQuery subQueryFechaExpiracion = new SubQuery("TarmDocumentoHabilitante", "fechaexpiracion", "fechaexpiracion", "i.pk=t.pk.cdocumento"); + dto.addSubQuery(subQueryFechaExpiracion); + // + SubQuery subQueryTipoTramite = new SubQuery("TgeneCatalogDetail", "description", "tipoTramite", "i.pk.catalog= (select o.tipotramite from TarmTramite o where o.pk=(select p.ctramite from TarmDocumentoHabilitante p where p.pk=t.pk.cdocumento )) " + + " and i.pk.catalogcode=(select o.tipotramitecodigo from TarmTramite o where o.pk=(select p.ctramite from TarmDocumentoHabilitante p where p.pk=t.pk.cdocumento ))"); + dto.addSubQuery(subQueryTipoTramite); + SubQuery subQueryTramite = new SubQuery("TgeneCatalogDetail", "description", "tramite", "i.pk.catalog= (select o.tipoautorizacion from TarmTramite o where o.pk=(select p.ctramite from TarmDocumentoHabilitante p where p.pk=t.pk.cdocumento )) " + + " and i.pk.catalogcode=(select o.tipoautorizacioncodigo from TarmTramite o where o.pk=(select p.ctramite from TarmDocumentoHabilitante p where p.pk=t.pk.cdocumento ))"); + dto.addSubQuery(subQueryTramite); + SubQuery subQueryCategoria = new SubQuery("TgeneCatalogDetail", "description", "categoria", "i.pk.catalog= (select o.categoria from TarmTramite o where o.pk=(select p.ctramite from TarmDocumentoHabilitante p where p.pk=t.pk.cdocumento )) " + + " and i.pk.catalogcode=(select o.categoriacodigo from TarmTramite o where o.pk=(select p.ctramite from TarmDocumentoHabilitante p where p.pk=t.pk.cdocumento ))"); + dto.addSubQuery(subQueryCategoria); + SubQuery subQueryUsoActivid = new SubQuery("TgeneCatalogDetail", "description", "usoactividad", "i.pk.catalog= (select o.usoactividad from TarmTramite o where o.pk=(select p.ctramite from TarmDocumentoHabilitante p where p.pk=t.pk.cdocumento )) " + + " and i.pk.catalogcode=(select o.usoactividadcodigo from TarmTramite o where o.pk=(select p.ctramite from TarmDocumentoHabilitante p where p.pk=t.pk.cdocumento ))"); + dto.addSubQuery(subQueryUsoActivid); + + SubQuery subQueryEstado = new SubQuery("TgeneCatalogDetail", "description", "estado", "i.pk.catalog= (select p.estado from TarmDocumentoHabilitante p where p.pk=t.pk.cdocumento ) " + + " and i.pk.catalogcode=(select p.estadocode from TarmDocumentoHabilitante p where p.pk=t.pk.cdocumento )"); + dto.addSubQuery(subQueryEstado); +// SubQuery subQueryFechaEmision = new SubQuery("TarmDocumentoHabilitante","fechaemision","fechaemision","i.pk=t.pk.cdocumento"); +// dto.addSubQuery(subQueryFechaEmision); +// SubQuery subQueryFechaCaducidad = new SubQuery("TarmDocumentoHabilitante","fechaexpiracion","fechaexpiracion","i.pk=t.pk.cdocumento"); +// dto.addSubQuery(subQueryFechaCaducidad); + //arma + SubQuery subcodigoArma = new SubQuery("TarmArmas", "pk", "carma", "i.pk= (select p.carma from TarmDocumentoHabilitante p where p.pk=t.pk.cdocumento)"); + dto.addSubQuery(subcodigoArma); + + SubQuery subQueryClase = new SubQuery("TgeneCatalogDetail", "description", "clase", "i.pk.catalog= (select o.clase from TarmTipoArmaExplosivo o where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=(select q.carma from TarmDocumentoHabilitante q where q.pk=t.pk.cdocumento))) " + + " and i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=(select q.carma from TarmDocumentoHabilitante q where q.pk=t.pk.cdocumento))) "); + dto.addSubQuery(subQueryClase); + SubQuery subQueryTipo = new SubQuery("TgeneCatalogDetail", "description", "tipoarmaexplosivo", "i.pk.catalog= (select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=(select q.carma from TarmDocumentoHabilitante q where q.pk=t.pk.cdocumento))) " + + " and i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=(select q.carma from TarmDocumentoHabilitante q where q.pk=t.pk.cdocumento))) "); + dto.addSubQuery(subQueryTipo); + SubQuery subQueryMarca = new SubQuery("TarmArmas", "marca", "marca", "i.pk=(select q.carma from TarmDocumentoHabilitante q where q.pk=t.pk.cdocumento) "); + dto.addSubQuery(subQueryMarca); + + SubQuery subQueryCalibre = new SubQuery("TgeneCatalogDetail", "description", "calibre", "i.pk.catalog= (select o.calibre from TarmTipoArmaExplosivo o where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=(select q.carma from TarmDocumentoHabilitante q where q.pk=t.pk.cdocumento))) " + + " and i.pk.catalogcode=(select o.calibrecodigo from TarmTipoArmaExplosivo o where o.pk=(select p.ctipoarmaexplosivo from TarmArmas p where p.pk=(select q.carma from TarmDocumentoHabilitante q where q.pk=t.pk.cdocumento))) "); + dto.addSubQuery(subQueryCalibre); + + SubQuery subQueryLote = new SubQuery("TarmArmas", "lote", "lote", "i.pk=(select q.carma from TarmDocumentoHabilitante q where q.pk=t.pk.cdocumento) "); + dto.addSubQuery(subQueryLote); + return dto; + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Devueleve el tipo de tramite de un documento + * + * @param documento + * @return + */ + public String tipoTramite(TarmSolicitudDocumento documento) { + String tipo = ""; + String codigoSolicitud; + try { + TarmDocumentoHabilitante documentoHabilitante = DocumentoHabilitanteController.find(String.valueOf(documento.getPk().getCdocumento())); + codigoSolicitud = documentoHabilitante.getCsolicitud(); + + //Obteniendo la solicitud + TarmSolicitud solicitud = SolicitudArmasController.find(codigoSolicitud); + + if (solicitud != null) { + TarmTramite tramite = TarmTramiteController.find(solicitud.getCtramite().toString()); + if (tramite != null && tramite.getTipotramite() != null && !tramite.getTipotramite().isEmpty() + && tramite.getTipotramitecodigo() != null && !tramite.getTipotramitecodigo().isEmpty()) { + TgeneCatalogDetail catalogoTipoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + if (catalogoTipoTramite != null) { + tipo = catalogoTipoTramite.getDescription(); + } + } + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + return tipo; + } + + public String tramite(TarmSolicitudDocumento documento) { + String tipo = ""; + String codigoSolicitud; + try { + TarmDocumentoHabilitante documentoHabilitante = DocumentoHabilitanteController.find(String.valueOf(documento.getPk().getCdocumento())); + codigoSolicitud = documentoHabilitante.getCsolicitud(); + //Obteniendo la solicitud + TarmSolicitud solicitud = SolicitudArmasController.find(codigoSolicitud); + + if (solicitud != null) { + TarmTramite tramite = TarmTramiteController.find(solicitud.getCtramite().toString()); + if (tramite != null && tramite.getTipoautorizacion() != null && !tramite.getTipoautorizacion().isEmpty() + && tramite.getTipoautorizacioncodigo() != null && !tramite.getTipoautorizacioncodigo().isEmpty()) { + TgeneCatalogDetail catalogoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + if (catalogoTramite != null) { + tipo = catalogoTramite.getDescription(); + } + } + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + return tipo; + } + + /** + * Devueleve la categoria de un documento + * + * @param documento + * @return + */ + public String categoria(TarmSolicitudDocumento documento) { + String categoria = ""; + String codigoSolicitud; + try { + TarmDocumentoHabilitante documentoHabilitante = DocumentoHabilitanteController.find(String.valueOf(documento.getPk().getCdocumento())); + codigoSolicitud = documentoHabilitante.getCsolicitud(); + //Obteniendo la solicitud + TarmSolicitud solicitud = SolicitudArmasController.find(codigoSolicitud); + + if (solicitud != null) { + TarmTramite tramite = TarmTramiteController.find(solicitud.getCtramite().toString()); + if (tramite != null && tramite.getCategoria() != null && !tramite.getCategoria().isEmpty() + && tramite.getCategoriacodigo() != null && !tramite.getCategoriacodigo().isEmpty()) { + TgeneCatalogDetail catalogoCategoria = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + if (catalogoCategoria != null) { + categoria = catalogoCategoria.getDescription(); + } + } + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + return categoria; + } + + /** + * Devueleve la categoria de un documento + * + * @param documento + * @return + */ + public String usoActividad(TarmSolicitudDocumento documento) { + String usoActividad = ""; + String codigoSolicitud; + try { + TarmDocumentoHabilitante documentoHabilitante = DocumentoHabilitanteController.find(String.valueOf(documento.getPk().getCdocumento())); + codigoSolicitud = documentoHabilitante.getCsolicitud(); + //Obteniendo la solicitud + TarmSolicitud solicitud = SolicitudArmasController.find(codigoSolicitud); + + if (solicitud != null) { + TarmTramite tramite = TarmTramiteController.find(solicitud.getCtramite().toString()); + if (tramite != null && tramite.getUsoactividad() != null && !tramite.getUsoactividad().isEmpty() + && tramite.getUsoactividadcodigo() != null && !tramite.getUsoactividadcodigo().isEmpty()) { + TgeneCatalogDetail catalogoUso = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + if (catalogoUso != null) { + usoActividad = catalogoUso.getDescription(); + } + } + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + return usoActividad; + } + + /** + * Devueleve la categoria de un documento + * + * @param documento + * @return + */ + public String ubicacion(TarmSolicitudDocumento documento) { + String ubicacion = ""; + try { + //Obteniendo el documento habilitante + TarmDocumentoHabilitante documentoHabilitante = DocumentoHabilitanteController.find(documento.getPk().getCdocumento().toString()); + + TcustPersonDetail detallesPersona = PersonDetailController.find(String.valueOf(documentoHabilitante.getPersoncode().toString())); + + if (detallesPersona != null) { + String tipoDireccion = ""; + + switch (detallesPersona.getIdentificationcatalog()) { + case "CED": + tipoDireccion = "1"; + break; + case "RUC": + tipoDireccion = "2"; + break; + default: + tipoDireccion = ""; + break; + } + + // personAddressController.findPersonaPorDireccionTipoCatalogo(String.valueOf(documentoHabilitante.getPersoncode()), tipoDireccion); + personAddressController.findPrincipal(String.valueOf(documentoHabilitante.getPersoncode())); + if (personAddressController.getLprovinces() != null && !personAddressController.getLprovinces().isEmpty()) { + ubicacion = personAddressController.getLprovinces().get(0).getDescription(); + } + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + return ubicacion; + } + + /** + * Devuelve las armas de un documento + * + * @param documento + * @return + */ + public TarmArmas armas(TarmSolicitudDocumento documento) { + try { + TarmDocumentoHabilitante documentoHabilitante = DocumentoHabilitanteController.find(documento.getPk().getCdocumento().toString()); + return ArmasController.findPorCodigo(documentoHabilitante.getCarma()); + } catch (Exception e) { + return null; + } + } + + /** + * M\u00e9todo para encontrar por solicitud + * + * @param solicitudCode + * @return List + */ + public static List findPorSolicitud(String solicitudCode) { + try { + TarmSolicitudDocumentoController cc = new TarmSolicitudDocumentoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.csolicitud", solicitudCode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public List getDocumentos() { + return documentos; + } + + public void setDocumentos(List documentos) { + this.documentos = documentos; + } + + public PersonAddressController getPersonAddressController() { + return personAddressController; + } + + public void setPersonAddressController( + PersonAddressController personAddressController) { + this.personAddressController = personAddressController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/TarmSolicitudTramiteController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/TarmSolicitudTramiteController.java new file mode 100644 index 0000000..3561c94 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/TarmSolicitudTramiteController.java @@ -0,0 +1,277 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.context.FacesContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +public class TarmSolicitudTramiteController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 3067036498159997318L; + + private static TsafeUserDetail tsafeUserDetailUsuario = null; + + private static TarmCentroControl centroControl = null; + + protected TarmSolicitudTramiteController() throws Exception { + super(TarmSolicitudTramite.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + super.getMfilters().clear(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "TARMSOLICITUDTRAMITECONTROLLER"; + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + this.centroControl = new TarmCentroControl(); + this.create(); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk desc"); + Filter f = new Filter(); + if (this.getMfilelds().get("tramites") != null) { + f.setSql(this.getMfilelds().get("tramites").toString()); + dto.addFiltro(f); + } + + SubQuery qry2 = new SubQuery("TgeneCatalogDetail", "description", "tipotramitedesc", + "i.pk.catalog = (select a.tipoautorizacion from TarmTramite a where a.pk = t.pk.ctramite) "// t.pk.csolicitud + + " and " + + "i.pk.catalogcode = (select a.tipoautorizacioncodigo from TarmTramite a where a.pk = t.pk.ctramite)"); + dto.addSubQuery(qry2); + + SubQuery qry3 = new SubQuery("TgeneCatalogDetail", "description", "categoriadesc", + "i.pk.catalog = (select a.categoria from TarmTramite a where a.pk = t.pk.ctramite) "// t.pk.csolicitud + + " and " + + "i.pk.catalogcode = (select a.categoriacodigo from TarmTramite a where a.pk = t.pk.ctramite)"); + dto.addSubQuery(qry3); + + SubQuery qry4 = new SubQuery("TgeneCatalogDetail", "description", "usodesc", + "i.pk.catalog = (select a.usoactividad from TarmTramite a where a.pk = t.pk.ctramite) "// t.pk.csolicitud + + " and " + + "i.pk.catalogcode = (select a.usoactividadcodigo from TarmTramite a where a.pk = t.pk.ctramite)"); + dto.addSubQuery(qry4); + + SubQuery qry5 = new SubQuery("TcustPersonDetail", "identification", "cedula", + "i.pk.personcode = (select a.personcode from TarmSolicitud a where a.pk = t.pk.csolicitud) and i.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(qry5); + + SubQuery qry6 = new SubQuery("TcustPersonDetail", "name", "nombre", + "i.pk.personcode = (select a.personcode from TarmSolicitud a where a.pk = t.pk.csolicitud) and i.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(qry6); + + SubQuery qry7 = new SubQuery("TcustPersonDetail", "pk.personcode", "personcode", + "i.pk.personcode = (select a.personcode from TarmSolicitud a where a.pk = t.pk.csolicitud) and i.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(qry7); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void cambiarEstado(String estadoTramite, String estadoTramiteCodigo) { + record.setEstadotramite(estadoTramite); + record.setEstadotramitecodigo(estadoTramiteCodigo); + } + + @Override + public void save() { + try { + update(); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @throws Exception + * + */ + private static String obtenerCentroControl() throws Exception { + + tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + if (tcustPersonAddres == null) { + return null; + } + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + return CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } + + public static TarmSolicitudTramite findPorCtramite(String ctramite) { + try { + TarmSolicitudTramiteController cc = new TarmSolicitudTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.ctramite", ctramite); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findPorCodigoTramite(String ctramite) { + try { + TarmSolicitudTramiteController cc = new TarmSolicitudTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.ctramite", ctramite); + cc.querydatabase(); + if (cc.record != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmSolicitudTramite findPorCSolicitud(String csolicitud) { + try { + if (csolicitud == null || csolicitud.isEmpty()) { + return null; + } + TarmSolicitudTramiteController cc = new TarmSolicitudTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.csolicitud", csolicitud); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static TarmSolicitudTramite findPorCSolicitudYCTramite(String csolicitud, String ctramite) { + try { + TarmSolicitudTramiteController cc = new TarmSolicitudTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.csolicitud", csolicitud); + cc.addFilter("pk.ctramite", ctramite); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findTramites() { + try { + TarmSolicitudTramiteController cc = new TarmSolicitudTramiteController(); + cc.init(); + cc.recperpage = 30000000; + obtenerCentroControl(); + cc.addField("tramites", " ctramite in (select b.pk from TarmTramite b where b.tipoautorizacion = 1 and b.categoria = 14) and estadotramite in ('APB','FIN') and csolicitud in (select a.pk from TarmSolicitud a where a.ccentrocontrol = '" + centroControl.getPk() + "') and csolicitud in (select d.csolicitud from TarmDocumentoHabilitante d where d.estado = 'APR' )" + + " AND EXISTS(SELECT ARM FROM TarmSolicitudArmas solarm, TarmArmas arm WHERE solarm.pk.csolicitud = t.pk.csolicitud AND solarm.pk.carma = arm.pk AND arm.lote is null)"); + cc.querydatabase(); + if (cc.record != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/TarmTramiteController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/TarmTramiteController.java new file mode 100644 index 0000000..91f5781 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/TarmTramiteController.java @@ -0,0 +1,582 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class TarmTramiteController extends AbstractController { + + public TarmTramiteController() throws Exception { + super(TarmTramite.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "TARMTRAMITECONTROLLER"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + + //Tipo de tramite + SubQuery subqueryTipoTramite = new SubQuery("TgeneCatalogDetail", "description", "tipotramite", "i.pk.catalog=t.tipotramite and i.pk.catalogcode=t.tipotramitecodigo"); + dto.addSubQuery(subqueryTipoTramite); + + SubQuery subqueryTramite = new SubQuery("TgeneCatalogDetail", "description", "tipoautorizacion", "i.pk.catalog=t.tipoautorizacion and i.pk.catalogcode=t.tipoautorizacioncodigo"); + dto.addSubQuery(subqueryTramite); + + //Uso/Actividad + SubQuery subqueryUsoActividad = new SubQuery("TgeneCatalogDetail", "description", "usoactividad", "i.pk.catalog=t.usoactividad and i.pk.catalogcode=t.usoactividadcodigo"); + dto.addSubQuery(subqueryUsoActividad); + + //Categoria + SubQuery subqueryCategoria = new SubQuery("TgeneCatalogDetail", "description", "categoria", "i.pk.catalog=t.categoria and i.pk.catalogcode=t.categoriacodigo"); + dto.addSubQuery(subqueryCategoria); + + /* + //No. Tramite + SubQuery subqueryNoTramite= new SubQuery("TarmSolicitudTramite","numerotramite","numerotramite","i.pk.ctramite=t.pk"); + dto.addSubQuery(subqueryNoTramite); + + //Codigo de solicitud + SubQuery subqueryCSolicitud= new SubQuery("TarmSolicitudTramite","pk.csolicitud","csolicitud","i.pk.ctramite=t.pk"); + dto.addSubQuery(subqueryCSolicitud); + + //No. Documento + SubQuery subqueryNoDocumento= new SubQuery("TarmDocumentoHabilitante","numerodocumento","nodocumento","i.ctramite=t.pk"); + dto.addSubQuery(subqueryNoDocumento); + + //Fecha emision + SubQuery subqueryFechaEmision= new SubQuery("TarmDocumentoHabilitante","fechaemision","fechaemision","i.ctramite=t.pk"); + dto.addSubQuery(subqueryFechaEmision); + + //Fecha expiracion + SubQuery subqueryFechaExpiracion= new SubQuery("TarmDocumentoHabilitante","fechaexpiracion","fechaexpiracion","i.ctramite=t.pk"); + dto.addSubQuery(subqueryFechaExpiracion); + */ + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + + //Tipo de autorizacion + if (record.getTipoautorizacion() != null && !record.getTipoautorizacion().isEmpty() + && record.getTipoautorizacioncodigo() != null && !record.getTipoautorizacioncodigo().isEmpty()) { + TgeneCatalogDetail tipoAturizacion = CatalogDetailController.findxCodigoCodcatalogo(record.getTipoautorizacion(), record.getTipoautorizacioncodigo()); + if (tipoAturizacion != null) { + record.getModifiedData().put("tipoautorizacion", tipoAturizacion.getDescription()); + } + } + + //Poniendo el nombre de la persona al tramite + if (record.getModifiedData().get("csolicitud") != null) { + TarmSolicitud solicitud = SolicitudController.findSolicitudxcodsolicitud(record.getModifiedData().get("csolicitud").toString()); + if (solicitud != null) { + TcustPersonDetail detallesPersona = PersonDetailController.find(solicitud.getPersoncode().toString()); + if (detallesPersona != null) { + record.getModifiedData().put("nombre", detallesPersona.getName()); + } + } + } + + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Query por criterios de tramite + */ + protected void querydatabaseCriteriosTramite(String tipoAutorizacion, String tipoTramiteCodigo, String tipoTramiteCodigo2) { + try { + DtoQuery dto = super.getDtoQuery(true); + + Filter tipoTramiteFiltro = new Filter(); + /* if(tipoAutorizacion!=null){ + cc.addFilter("tipoautorizacion", tipoAutorizacion); + } + */ + tipoTramiteFiltro.setSql("t.tipoautorizacion = " + tipoAutorizacion + " and (t.tipotramite = " + tipoTramiteCodigo + " or t.tipotramite = " + tipoTramiteCodigo2 + ")"); + + dto.addFiltro(tipoTramiteFiltro); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + + //Tipo de autorizacion + if (record.getTipoautorizacion() != null && !record.getTipoautorizacion().isEmpty() + && record.getTipoautorizacioncodigo() != null && !record.getTipoautorizacioncodigo().isEmpty()) { + TgeneCatalogDetail tipoAturizacion = CatalogDetailController.findxCodigoCodcatalogo(record.getTipoautorizacion(), record.getTipoautorizacioncodigo()); + if (tipoAturizacion != null) { + record.getModifiedData().put("tipoautorizacion", tipoAturizacion.getDescription()); + } + } + + //Poniendo el nombre de la persona al tramite + if (record.getModifiedData().get("csolicitud") != null) { + TarmSolicitud solicitud = SolicitudController.findSolicitudxcodsolicitud(record.getModifiedData().get("csolicitud").toString()); + if (solicitud != null) { + TcustPersonDetail detallesPersona = PersonDetailController.find(solicitud.getPersoncode().toString()); + if (detallesPersona != null) { + record.getModifiedData().put("nombre", detallesPersona.getName()); + } + } + } + + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Query por criterios de tramite + */ + protected void querydatabaseCriteriosTramite(String tipoAutorizacion) { + try { + DtoQuery dto = super.getDtoQuery(true); + + Filter tipoTramiteFiltro = new Filter(); + + tipoTramiteFiltro.setSql("t.tipotramitecodigo = 'TIPOTRAMITE' and t.tipoautorizacion = " + tipoAutorizacion); + + dto.addFiltro(tipoTramiteFiltro); + + SubQuery stipoAutorizacion = new SubQuery("TgeneCatalogDetail", "description", "tipotramite", "i.pk.catalog=t.tipotramite and i.pk.catalogcode=t.tipotramitecodigo and t.tipotramitecodigo = 'TIPOTRAMITE'"); + + dto.addSubQuery(stipoAutorizacion); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + + lrecord = (List) resp.get(beanalias); + + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + + //Tipo de autorizacion + if (record.getTipoautorizacion() != null && !record.getTipoautorizacion().isEmpty() + && record.getTipoautorizacioncodigo() != null && !record.getTipoautorizacioncodigo().isEmpty()) { + TgeneCatalogDetail tipoAturizacion = CatalogDetailController.findxCodigoCodcatalogo(record.getTipoautorizacion(), record.getTipoautorizacioncodigo()); + if (tipoAturizacion != null) { + record.getModifiedData().put("tipoautorizacion", tipoAturizacion.getDescription()); + } + } + + //Poniendo el nombre de la persona al tramite + if (record.getModifiedData().get("csolicitud") != null) { + TarmSolicitud solicitud = SolicitudController.findSolicitudxcodsolicitud(record.getModifiedData().get("csolicitud").toString()); + if (solicitud != null) { + TcustPersonDetail detallesPersona = PersonDetailController.find(solicitud.getPersoncode().toString()); + if (detallesPersona != null) { + record.getModifiedData().put("nombre", detallesPersona.getName()); + } + } + } + + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Query por criterios de tramite + */ + protected void querydatabaseCriteriosTramite(String tipoAutorizacion, String tipoTramite) { + try { + DtoQuery dto = super.getDtoQuery(true); + + Filter tipoTramiteFiltro = new Filter(); + + tipoTramiteFiltro.setSql("t.tipotramitecodigo = 'TIPOTRAMITE' and t.tipoautorizacion = " + tipoAutorizacion); + + dto.addFiltro(tipoTramiteFiltro); + + SubQuery stipoAutorizacion = new SubQuery("TgeneCatalogDetail", "description", "tipotramite", "i.pk.catalog=t.tipotramite and i.pk.catalogcode=t.tipotramitecodigo and t.tipotramitecodigo = 'TIPOTRAMITE'"); + + dto.addSubQuery(stipoAutorizacion); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + + lrecord = (List) resp.get(beanalias); + + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + + //Tipo de autorizacion + if (record.getTipoautorizacion() != null && !record.getTipoautorizacion().isEmpty() + && record.getTipoautorizacioncodigo() != null && !record.getTipoautorizacioncodigo().isEmpty()) { + TgeneCatalogDetail tipoAturizacion = CatalogDetailController.findxCodigoCodcatalogo(record.getTipoautorizacion(), record.getTipoautorizacioncodigo()); + if (tipoAturizacion != null) { + record.getModifiedData().put("tipoautorizacion", tipoAturizacion.getDescription()); + } + } + + //Poniendo el nombre de la persona al tramite + if (record.getModifiedData().get("csolicitud") != null) { + TarmSolicitud solicitud = SolicitudController.findSolicitudxcodsolicitud(record.getModifiedData().get("csolicitud").toString()); + if (solicitud != null) { + TcustPersonDetail detallesPersona = PersonDetailController.find(solicitud.getPersoncode().toString()); + if (detallesPersona != null) { + record.getModifiedData().put("nombre", detallesPersona.getName()); + } + } + } + + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + protected void querydatabaseDesaduanizacion() { + try { + DtoQuery dto = super.getDtoQuery(true); + + //Tipo de tramite + SubQuery subqueryTipoTramite = new SubQuery("TgeneCatalogDetail", "description", "tipotramite", "i.pk.catalog=t.tipotramite and i.pk.catalogcode=t.tipotramitecodigo"); + dto.addSubQuery(subqueryTipoTramite); + + //Uso/Actividad + SubQuery subqueryUsoActividad = new SubQuery("TgeneCatalogDetail", "description", "usoactividad", "i.pk.catalog=t.usoactividad and i.pk.catalogcode=t.usoactividadcodigo"); + dto.addSubQuery(subqueryUsoActividad); + + //Categoria + SubQuery subqueryCategoria = new SubQuery("TgeneCatalogDetail", "description", "categoria", "i.pk.catalog=t.categoria and i.pk.catalogcode=t.categoriacodigo"); + dto.addSubQuery(subqueryCategoria); + + /* + //No. Tramite + SubQuery subqueryNoTramite= new SubQuery("TarmSolicitudTramite","numerotramite","numerotramite","i.pk.ctramite=t.pk"); + dto.addSubQuery(subqueryNoTramite); + + //Codigo de solicitud + SubQuery subqueryCSolicitud= new SubQuery("TarmSolicitudTramite","pk.csolicitud","csolicitud","i.pk.ctramite=t.pk"); + dto.addSubQuery(subqueryCSolicitud); + + //Estado tramite + SubQuery subqueryEstado= new SubQuery("TarmSolicitudTramite","estadotramite","estadotramite","i.pk.ctramite=t.pk"); + dto.addSubQuery(subqueryEstado); + + //No. Documento + SubQuery subqueryNoDocumento= new SubQuery("TarmDocumentoHabilitante","numerodocumento","nodocumento","i.ctramite=t.pk"); + dto.addSubQuery(subqueryNoDocumento); + + //Fecha emision + SubQuery subqueryFechaEmision= new SubQuery("TarmDocumentoHabilitante","fechaemision","fechaemision","i.ctramite=t.pk"); + dto.addSubQuery(subqueryFechaEmision); + + //Fecha expiracion + SubQuery subqueryFechaExpiracion= new SubQuery("TarmDocumentoHabilitante","fechaexpiracion","fechaexpiracion","i.ctramite=t.pk"); + dto.addSubQuery(subqueryFechaExpiracion); + */ + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + protected void querydatabaseSimple() { + try { + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Entrega una lista de requisitos. + * + * @return List + */ + public static TarmTramite find(String ctramite) { + try { + TarmTramiteController cc = new TarmTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", ctramite); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para buscar tramite por criterios de busqueda + * + * @param tipoAutorizacion el codigo del tipo de autorizacion + * @return el registro de tramite encontrado + */ + public static List findPorCriteriosTramite(String tipoAutorizacion) { + try { + TarmTramiteController cc = new TarmTramiteController(); + cc.init(); + cc.recperpage = 30000; + + cc.querydatabaseCriteriosTramite(tipoAutorizacion); + + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para buscar tramite por criterios de busqueda + * + * @param tipoTramite el codigo del tipo de tramite + * @param tipoTramite2 otro codigo de tipo de tramite + * @param tipoAutorizacion el codigo del tipo de autorizacion + * @return el registro de tramite encontrado + */ + public static List findPorCriteriosTramite(String tipoTramite, String tipoTramite2, String tipoAutorizacion) { + try { + TarmTramiteController cc = new TarmTramiteController(); + cc.init(); + cc.recperpage = 30000; + + cc.querydatabaseCriteriosTramite(tipoAutorizacion, tipoTramite, tipoTramite2); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Entrega una lista de requisitos. + * + * @return List + */ + public static TarmTramite findSimple(String ctramite) { + try { + TarmTramiteController cc = new TarmTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", ctramite); + cc.querydatabaseSimple(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca tramites para desaduanizacion + */ + public static List findTramitesDesaduanizar() { + try { + TarmTramiteController cc = new TarmTramiteController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("tipoautorizacion", "1"); + cc.addFilter("categoria", "14"); + //cc.addFilter("usoactividad", "27"); + cc.querydatabaseDesaduanizacion(); + if (cc.lrecord != null) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/TramiteArmasController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/TramiteArmasController.java new file mode 100644 index 0000000..15fb600 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/TramiteArmasController.java @@ -0,0 +1,2844 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.annotation.PostConstruct; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.PredicateUtils; +import org.apache.commons.collections.TransformerUtils; +import org.apache.commons.lang.StringUtils; +import org.primefaces.context.RequestContext; +import org.primefaces.event.SelectEvent; + +import com.fp.common.helper.Constant; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.eval.EvaluacionController; +import com.fp.frontend.controller.armas.funcionalidad.CargaController; +import com.fp.frontend.controller.armas.funcionalidad.RegistroArmController; +import com.fp.frontend.controller.armas.lov.CargasLovController; +import com.fp.frontend.controller.armas.parametros.BuscarTramiteLovController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.ClaseLovController; +import com.fp.frontend.controller.armas.parametros.GuardiasController; +import com.fp.frontend.controller.armas.parametros.OrigenTramiteController; +import com.fp.frontend.controller.armas.parametros.RequisitoPorTramiteController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PeopleController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.PersonPhoneController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.controller.pgeneral.safe.UserDetailController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.CommonTransformer; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.frontend.utility.Utilidades; +import com.fp.frontend.webservices.snap.cedula.ClienteCedula; +import com.fp.frontend.webservices.snap.ruc.ClienteRUC; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmOrigenTramite; +import com.fp.persistence.parmas.param.TarmRequisitoPorTipoTramite; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.parmas.soli.TarmSolicitudGuardias; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitos; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitosKey; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +import ec.gob.registrocivil.consultacedula.Cedula; +import ec.gov.sri.wsconsultacontribuyente.Contribuyente; + +/** + * Clase controladora de ingreso de tramites de control de armas. + * + * @author Jorge Vaca. + * @author dcruz + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class TramiteArmasController extends AbstractController { + + private Boolean mostrarFiltroAUCP = Boolean.FALSE; + + private String filterAUCP; + + /** + * Responsable de centro de control + */ + private TcustPersonDetail responsableCentroControl = null; + /** + * Detalle de Usuarios + */ + private TsafeUserDetail tsafeUserDetailUsuario = null; + /** + * Referencia al Centro de control; + */ + private TarmCentroControl centroControl = new TarmCentroControl(); + /** + * Nombre de la Institucion + */ + private String nombreInstitucion; + /** + * Lista de tipos de persona. + */ + private List ltipopersona; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de + * identificación + */ + private List ltipopago; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de + * identificación + */ + private List ltipoidenti; + + + /** + * Lista de tipos de trámite. + */ + private List ltipotramite; + + /** + * Lista de origen de adquisición + */ + private List lorigenadquisicion; + + /** + * Lista de origen de tipos de pagos + */ + + /** + * Lista de provincias + */ + private List lprovincias; + + /** + * Lista de cantones de origen + */ + private List lcantonOrigen; + + /** + * Lista de cantones de destino + */ + private List lcantonDestino; + /** + * Longitud de la identificacion de una persona. + */ + private Integer longitudid; + + /** + * Indica si se debe activar la pestana de ingresar requisitos + */ + private boolean ingresarRequisitos; + + /** + * Indica si se debe activar la pestana de seleccionar armas + */ + private boolean seleccionarArmas; + + /** + * Indica si se debe activar la pestana seleccionar guardias + */ + private boolean seleccionarGuardias; + + /** + * Indica si se debe activar la pestana seleccionar agencias + */ + private boolean seleccionarAgencias; + + /** + * Indica si se debe activar la pestana listar guardias + */ + private boolean listarDocumentos; + + /** + * Atributo para activar el keyFilter + */ + private boolean activarRegExIdentificacion; + + /** + * Indica si el flujo ya fue iniciado, sirve para controlar que no iniciar + * el flujo mas de una vez. + */ + private boolean flujoiniciado = false; + + private boolean esaprobacion = false; + + /** + * Deshabilita la pantalla después de grabar la solicitud + */ + private boolean deshabilitarPantalla; + + /** + * Muestra el botón de ingreso de armas + */ + private boolean mostrarIngresoArmas; + /** + * codigo de la persona que hace la solicitud + */ + private Integer cpersona = 0; + /** + * Atributo que oculpa botones del flujo + */ + private boolean ocultarBotonInicioFlujo = true; + + /** + * Fecha actual + */ + private Date fechaActual = new Date(); + + private String csolicitud; + + /** + * Bandera de tipo booleano para indicar si se ha grabado el reporte + * generado + * + */ + private Boolean isEnableGrabar; + /** + * Trámite seleccionado + */ + private TarmTramite tarmTramite; + + /** + * Habilita campos en actualización de datos generales + */ + private boolean actualizaDatosGenerales; + + /** + * Aprueba si es guía de libre tránsito + */ + private boolean guiaLibreTransito; + + /** + * Lista Personas vendedoreas + */ + private Set listaPersonasDetailVen; + /** + * Vendedor seleccionado + */ + private Integer selecionaCodigoVendedor; + + /** + * Controlador de login + */ + @ManagedProperty(value = "#{loginController}") + private LoginController login; + + /** + * Controlador que maneja el usuario + */ + @ManagedProperty(value = "#{userDetailController}") + private UserDetailController detalleusuario; + + /** + * Controlador que maneja las armas dentro de la solicitud + */ + @ManagedProperty(value = "#{solicitudArmasController}") + private SolicitudArmasController solicitud; + + /** + * Controlador que maneja cargas para previa importacion + */ + @ManagedProperty(value = "#{cargaController}") + private CargaController cargaController; + + /** + * Controlador que maneja la persona + */ + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController detallepersona; + + /** + * Controlador que maneja los datos de personas naturales + */ + @ManagedProperty(value = "#{peopleController}") + private PeopleController natural; + + /** + * Controlador que maneja direcciones de la persona + */ + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController direccion; + + /** + * Controlador que maneja teléfonos de la persona + */ + @ManagedProperty(value = "#{personPhoneController}") + private PersonPhoneController telefono; + + /** + * Controlador que maneja requisitos dentro de la solicitud + */ + @ManagedProperty(value = "#{solicitudRequisitosController}") + private SolicitudRequisitosController requisitos; + + /** + * Controlador que maneja los requisitos + */ + @ManagedProperty(value = "#{requisitoPorTramiteController}") + private RequisitoPorTramiteController requisitoPorTramite; + + /** + * Controlador que maneja guardias + */ + @ManagedProperty(value = "#{guardiasController}") + private GuardiasController guardias; + + /** + * Controlador que maneja los guardias en la solicitud + */ + @ManagedProperty(value = "#{solicitudGuardiasController}") + private SolicitudGuardiasController solicitudGuardias; + + /** + * Controlador que maneja armas + */ + @ManagedProperty(value = "#{armasController}") + private ArmasController armas; + + /** + * Controlador que maneja las armas dentro de la solicitud + */ + @ManagedProperty(value = "#{recepcionArmasController}") + private RecepcionArmasController solicitudArmas; + + /** + * Controlador que maneja registro de armas + */ + @ManagedProperty(value = "#{registroArmController}") + private RegistroArmController registroArmas; + + /** + * Controlador que maneja agencias y sucursales + */ + @ManagedProperty(value = "#{agenciaSucursalController}") + private AgenciaSucursalController agenciaSucursal; + + /** + * Controlador que maneja las agencias y sucursales dentro de la solicitud + */ + @ManagedProperty(value = "#{solicitudAgenciaSucursalController}") + private SolicitudAgenciaSucursalController solicitudAgenciaSucursal; + + /** + * Controlador que maneja los documentos habilitantes + */ + @ManagedProperty(value = "#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitante; + + /** + * Controlador que maneja los documentos dentro de la solicitud + */ + @ManagedProperty(value = "#{tarmSolicitudDocumentoController}") + private TarmSolicitudDocumentoController solicitudDocumento; + /** + * Controlador Inyectado ReportController + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + /** + * Controlador que maneja las evaluaciones de las personas + */ + @ManagedProperty(value = "#{evaluacionController}") + private EvaluacionController evaluacionController; + /** + * Controlador que maneja las armas asociadas a las agencias + */ + @ManagedProperty(value = "#{agenciaArmaController}") + private AgenciaArmaController agenciaArma; + + TgeneCatalogDetail tipoTramite = null; + TgeneCatalogDetail tipoAutorizacion = null; + TgeneCatalogDetail actividad = null; + /** + * codigo de la provincia del usuario logueado + */ + private String cprovincia; + + private List centroControlList; + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List tipoDocumento; + + /** + * codigo del ruc + */ + private String codigoRuc; + /** + * codigo del ruc + */ + private String codigoCedula; + + /** + * codigo del ruc + */ + private String codigoPasaporte; + + /** + * Atributo para setear el vendedor + */ + private TcustPersonDetail tcustPersonDetailVendedor; + + public TramiteArmasController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + try { + this.init(); + ltipopersona = CatalogDetailController.find("PERSONTYPE"); + ltipoidenti = CatalogDetailController.find("IDENTIFICATION"); + ltipotramite = CatalogDetailController.find("TIPOTRAMITE"); + ltipopago = CatalogDetailController.find("TIPOPAGOSOLICITUD"); + lprovincias = ProvinceController.find("EC"); + lorigenadquisicion = new ArrayList(); + // Inicializa autoconsulta +// super.startQuery(); + ocultarBotonInicioFlujo = true; + isEnableGrabar = Boolean.TRUE; + if (super.getMfilters().get("pk.csolicitud") != null) { + esaprobacion = true; + } + centroControlList = CentroControlArmasController.findEstadoInst("Y", "1");//Departamento + this.querydatabase(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + * + * @throws Exception + */ + private void init() throws Exception { + this.beanalias = "SOLICITUD"; + this.responsableCentroControl = new TcustPersonDetail(); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + tipoDocumento = CatalogDetailController.find("IDENTIFICATION"); + listaPersonasDetailVen = new HashSet(); + tcustPersonDetailVendedor = null; + codigoRuc = codigos("CODIGO.RUC"); + codigoCedula = codigos("CODIGO.CEDULA"); + codigoPasaporte = codigos("CODIGO.PASAPORTE"); + this.obtenerCentroControl(); + this.obtenerResponsableCentroControl(); + } + +// public String onFlowProcess(FlowEvent event) { +// if (!flujoiniciado) { +// this.saveCabecera(); +// } +// return event.getNewStep(); +// } + @Override + public void save() { + try { + if (deshabilitarPantalla) { + return; + } + try { + if (!noValidaDocumentoHabilitante(tipoTramite, tipoAutorizacion, actividad)) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_listardocumentos_solo")); + return; + } + } catch (Exception e) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_listardocumentos")); + return; + } + + //validamos si tcustPersonDetailPortador este lleno o si han seleccionado sin portador para asignarle el por default + if (tcustPersonDetailVendedor == null && tarmTramite.getTipoautorizacion().equals("4")) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_seleccionesinportadoroverifiqueusuarioexistentevendedor")); + return; + } + + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + solicitud.fijaPersona(detallepersona.getRecord()); + solicitud.fijaInicioFlujoEnNO(); + solicitud.update(); + + DtoSave dtosavesol = solicitud.getDtoSave(); + dtosavesol.setIsForm(true); + dtosavesol.setReturnpk(true); + dtosavesol.setPosition(1); + msave.put(solicitud.getBeanalias(), dtosavesol); // adicionar metadata de mantenimiento para cada tabla. + + DtoSave dtosavereq = requisitos.getDtoSave(); + dtosavereq.setReturnpk(true); + dtosavereq.setPosition(2); + msave.put(requisitos.getBeanalias(), dtosavereq); // adicionar metadata de mantenimiento para cada tabla. + + request.modifiedData().put("csolicitud", solicitud.getRecord().getPk()); + request.modifiedData().put("isnew", "N"); + request.setSaveTables(msave); + + //this.setearCodigoCentroControl(); + this.modificaDatosGenerales(); + + this.actualizaDirecciones(); + + this.actualizarTelefonos(); + + //guardias + this.copiaGuardias(); + + //armas + this.copiaArmas(); + + //agencias + this.copiaAgencias(); + + //documentos + this.copiaDocumentos(); + + //agencia armas + this.copiaAgenciaArmas(); + + if (!validacionFormulario()) { + return; + } + + //guardias + DtoSave dtosaveguardias = solicitudGuardias.getDtoSave(); + dtosaveguardias.setReturnpk(Boolean.TRUE); + dtosaveguardias.setPosition(3); + msave.put(solicitudGuardias.getBeanalias(), dtosaveguardias); + + //armas + DtoSave dtosavearmas = solicitudArmas.getDtoSave(); + dtosavearmas.setReturnpk(Boolean.TRUE); + dtosavearmas.setPosition(4); + msave.put(solicitudArmas.getBeanalias(), dtosavearmas); + + //agencias + DtoSave dtosaveagencias = solicitudAgenciaSucursal.getDtoSave(); + dtosaveagencias.setReturnpk(Boolean.TRUE); + dtosaveagencias.setPosition(5); + msave.put(solicitudAgenciaSucursal.getBeanalias(), dtosaveagencias); + + //solicitud_documentos + DtoSave dtosavedocumentos = solicitudDocumento.getDtoSave(); + dtosavedocumentos.setReturnpk(Boolean.TRUE); + dtosavedocumentos.setPosition(6); + msave.put(solicitudDocumento.getBeanalias(), dtosavedocumentos); + + //direcciones + DtoSave dtosavedirecciones = direccion.getDtoSave(); + dtosavedirecciones.setReturnpk(Boolean.TRUE); + dtosavedirecciones.setPosition(7); + msave.put(direccion.getBeanalias(), dtosavedirecciones); + + DtoSave dtosavetelefono = telefono.getDtoSave(); + dtosavetelefono.setReturnpk(Boolean.TRUE); + dtosavetelefono.setPosition(8); + msave.put(telefono.getBeanalias(), dtosavetelefono); + + DtoSave dtodatosgenerales = detallepersona.getDtoSave(); + dtodatosgenerales.setReturnpk(Boolean.TRUE); + dtodatosgenerales.setPosition(9); + msave.put(detallepersona.getBeanalias(), dtodatosgenerales); + + DtoSave dtosaveagenciaarmas = agenciaArma.getDtoSave(); + dtosaveagenciaarmas.setPosition(10); + msave.put(agenciaArma.getBeanalias(), dtosaveagenciaarmas); + + //documentoHabilitante + DtoSave dtosaveDocumentoHabilitante = documentoHabilitante.getDtoSave(); + dtosaveDocumentoHabilitante.setReturnpk(Boolean.TRUE); + dtosaveDocumentoHabilitante.setPosition(11); + msave.put(documentoHabilitante.getBeanalias(), dtosaveDocumentoHabilitante); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + managedSaveResponse(resp); + // CATEGORIA 14 PREVIA IMPORTACION + if (tarmTramite.getCategoria().equals("14")) { + asociarCargaSolicitud(); + } + MessageHelper.setMessageInfo(resp); + FacesContext context = FacesContext.getCurrentInstance(); + context.addMessage(null, new FacesMessage("RECUERDE", MsgControlArmas.getProperty("msg_recuerdeClickContinuarTramite"))); + } else { + ocultarBotonInicioFlujo = true; + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void asociarCargaSolicitud() { + try { + TarmCarga carga = CargaController.findByAUCP(solicitud.getRecord().getAucp()); + if (carga != null) { + carga.setCsolicitud(solicitud.getRecord().getPk()); + cargaController.update(carga); + cargaController.save(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void saveInicioFlujoEnYES() { + try { + + solicitud.fijaInicioFlujoEnYES(); + solicitud.update(); + + DtoSave dtoSolicitud = solicitud.getDtoSave(); + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + msave.put(solicitud.getBeanalias(), dtoSolicitud); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + solicitud.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private void managedSaveResponse(Response response) throws Exception { + csolicitud = response.get("csolicitud").toString(); + solicitud.postCommit(response); + requisitos.postCommit(response); + solicitudGuardias.postCommit(response); + solicitudArmas.postCommit(response); + solicitudAgenciaSucursal.postCommit(response); + solicitudDocumento.postCommit(response); + // flujoiniciado = Boolean.TRUE; + isEnableGrabar = Boolean.FALSE; + deshabilitarPantalla = Boolean.TRUE; + solicitud.getMfilelds().put("estadoSolicitud", "REGISTRADO"); + } + + /** + * Metodo que valida si ha sido seleccionado ams de un documento en el + * criterio validado + * + * @param tipoTramite + * @param tipoAutorizacion + * @param actividad + * @return + * @throws Exception + */ + private boolean noValidaDocumentoHabilitante(TgeneCatalogDetail tipoTramite, TgeneCatalogDetail tipoAutorizacion, TgeneCatalogDetail actividad) throws Exception { + int count = 0; + if (tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipoautorizacion"), MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())) { + + for (TarmDocumentoHabilitante documento : documentoHabilitante.getLrecord()) { + if (documento.getModifiedData().get("seleccionado").equals(Boolean.TRUE)) { + count++; + } + if (count > 1) { + return false; + } + } + if (count == 0) { + throw new Exception(MsgControlArmas.getProperty("msg_error_listardocumentos")); + + } + } + + if ((tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipoautorizacion"), MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())) + || (tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipoautorizacion"), MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog())) + || (tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipoautorizacion"), MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog()))) { + //validamos si el tramite esta chequeado documentohabilitante + if (tarmTramite.getDocumentohabilitante().equals(Constant.STR_Y)) { + for (TarmDocumentoHabilitante documento : documentoHabilitante.getLrecord()) { + if (count > 0) { + break; + } + + if (documento.getModifiedData().get("seleccionado").equals(Boolean.TRUE)) { + count++; + } + } + if (count == 0) { + throw new Exception(MsgControlArmas.getProperty("msg_error_listardocumentos")); + } + } + } + + return true; + } + + /** + * Actualizo datos de la persona + * + * @throws Exception + */ + private void modificaDatosGenerales() throws Exception { + detallepersona.update(); + } + + /** + * Actualizo el valor de las direcciones siempre y cuando haya existido un + * cambio en su valor + */ + private void actualizaDirecciones() { + TcustPersonAddress direccionPersona = null; + direccionPersona = direccion.findPrincipal(detallepersona.getRecord().getPk().getPersoncode().toString()); + + if (direccionPersona != null) { + direccion.setRecord(direccionPersona); + direccion.getRecord().setCountrycode(direccion.getMfilelds().get("solcodpais").toString()); + direccion.getRecord().setProvincecode(direccion.getMfilelds().get("solcodprovincia").toString()); + direccion.getRecord().setCantoncode(direccion.getMfilelds().get("solcodcanton").toString()); + direccion.getRecord().setCitycode(direccion.getMfilelds().get("solcodciudad").toString()); + direccion.getRecord().setParroquiacode(direccion.getMfilelds().get("solcodparroquia").toString()); + direccion.getRecord().setAddress(direccion.getMfilelds().get("soldireccion").toString()); + direccion.update(); + } + + TcustPersonAddress correo = (TcustPersonAddress) CollectionUtils.find(direccion.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getAddresstypecatalog"), PredicateUtils.equalPredicate("3"))); + if (correo != null) { + direccion.setRecord(correo); + direccion.getRecord().setAddress(direccion.getMfilelds().get("solcorreopersona").toString()); + direccion.update(); + } + } + + /** + * Actualizo los números de teléfono si es que existe un + * cambio + * + * @throws Exception + */ + private void actualizarTelefonos() throws Exception { + TcustPersonPhone telefonoLocal = null; + telefonoLocal = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(new CommonTransformer("phonetypecatalog"), PredicateUtils.equalPredicate("1"))); + TcustPersonAddress direccionPrincipal = (TcustPersonAddress) CollectionUtils.find(direccion.getLrecord(), PredicateUtils.transformedPredicate(new CommonTransformer("principal"), PredicateUtils.equalPredicate(Constant.STR_Y))); + Integer codigodireccion = direccionPrincipal != null ? direccionPrincipal.getPk().getAddressnumber() : null; + if (telefonoLocal != null) { + telefono.setRecord(telefonoLocal); + telefono.getRecord().setPhonenumber(telefono.getMfilelds().get("soltelfijo") != null ? telefono.getMfilelds().get("soltelfijo").toString() : null); + telefono.update(); + } else { + telefono.create(); + telefono.getRecord().getPk().setPersoncode(cpersona); + telefono.getRecord().getPk().setPhonesequence(1); + telefono.getRecord().getPk().setDateto(Utilidades.getFechaExpiracion()); + telefono.getRecord().setPhonenumber(telefono.getMfilelds().get("soltelfijo") != null ? telefono.getMfilelds().get("soltelfijo").toString() : null); + telefono.getRecord().setDatefrom(new Timestamp(System.currentTimeMillis())); + telefono.getRecord().setPhonetypecatalogcode("PHONETYPE"); + telefono.getRecord().setPhonetypecatalog("1"); + telefono.getRecord().setAddressnumber(codigodireccion); + telefono.update(); + } + TcustPersonPhone telefonoCelular = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(new CommonTransformer("phonetypecatalog"), PredicateUtils.equalPredicate("2"))); + if (telefonoCelular != null) { + telefono.setRecord(telefonoCelular); + telefono.getRecord().setPhonenumber(telefono.getMfilelds().get("soltelcelular") != null ? telefono.getMfilelds().get("soltelcelular").toString() : null); + telefono.update(); + } else { + telefono.create(); + telefono.getRecord().getPk().setPersoncode(cpersona); + telefono.getRecord().getPk().setPhonesequence(2); + telefono.getRecord().getPk().setDateto(Utilidades.getFechaExpiracion()); + telefono.getRecord().setPhonenumber(telefono.getMfilelds().get("soltelcelular") != null ? telefono.getMfilelds().get("soltelcelular").toString() : null); + telefono.getRecord().setDatefrom(new Timestamp(System.currentTimeMillis())); + telefono.getRecord().setPhonetypecatalogcode("PHONETYPE"); + telefono.getRecord().setPhonetypecatalog("2"); + telefono.getRecord().setAddressnumber(codigodireccion); + telefono.update(); + } + } + + /** + * Copia los guardias de la tabla {@link TarmGuardias} a + * {@link TarmSolicitudGuardias} + * + * @throws Exception + */ + private void copiaGuardias() throws Exception { + if (seleccionarGuardias && guardias.getLrecord() != null && !guardias.getLrecord().isEmpty()) { + for (TarmGuardias guardia : guardias.getLrecord()) { + TarmSolicitudGuardias guardiaSeleccionado = (TarmSolicitudGuardias) CollectionUtils.find(solicitudGuardias.getLrecord(), + PredicateUtils.andPredicate( + PredicateUtils.transformedPredicate(new CommonTransformer("pk.cempresa"), PredicateUtils.equalPredicate(cpersona)), + PredicateUtils.transformedPredicate(new CommonTransformer("pk.cguardia"), PredicateUtils.equalPredicate(guardia.getPk())))); + if (guardia.getModifiedData().get("seleccionado") != null && Boolean.valueOf(guardia.getModifiedData().get("seleccionado").toString())) { + if (guardiaSeleccionado == null) { + solicitudGuardias.create(); + solicitudGuardias.getRecord().getPk().setCempresa(cpersona); + solicitudGuardias.getRecord().getPk().setCguardia(guardia.getPk()); + solicitudGuardias.update(); + } + } else if (guardiaSeleccionado != null) { + solicitudGuardias.setRecord(guardiaSeleccionado); + solicitudGuardias.remove(); +// solicitudGuardias.update(); + } + } + } + } + + /** + * Copia las armas a {@link TarmSolicitudArmas} + * + * @throws Exception + */ + private void copiaArmas() throws Exception { + if (seleccionarArmas && armas.getLrecord() != null && !armas.getLrecord().isEmpty()) { + for (TarmArmas arma : armas.getLrecord()) { + TarmSolicitudArmas armaSeleccionada = (TarmSolicitudArmas) CollectionUtils.find(solicitudArmas.getLrecord(), + PredicateUtils.andPredicate( + PredicateUtils.transformedPredicate(new CommonTransformer("pk.personcode"), PredicateUtils.equalPredicate(cpersona)), + PredicateUtils.transformedPredicate(new CommonTransformer("pk.carma"), PredicateUtils.equalPredicate(arma.getPk())))); + if (arma.getModifiedData().get("seleccionado") != null && Boolean.valueOf(arma.getModifiedData().get("seleccionado").toString())) { + if (armaSeleccionada == null) { + solicitudArmas.create(); + solicitudArmas.getRecord().getPk().setPersoncode(cpersona); + solicitudArmas.getRecord().getPk().setCarma(arma.getPk()); + solicitudArmas.update(); + } + } else if (armaSeleccionada != null) { + solicitudArmas.setRecord(armaSeleccionada); + solicitudArmas.remove(); +// solicitudArmas.update(); + } + } + } + } + + /** + * Copia las agencias a {@link TarmSolicitud} + * + * @throws Exception + */ + private void copiaAgencias() throws Exception { + if (seleccionarAgencias && agenciaSucursal.getLrecord() != null && !agenciaSucursal.getLrecord().isEmpty()) { + for (TarmAgenciaSucursal agencia : agenciaSucursal.getLrecord()) { + TarmSolicitudAgenciaSucursal agenciaSeleccionada = (TarmSolicitudAgenciaSucursal) CollectionUtils.find(solicitudAgenciaSucursal.getLrecord(), + PredicateUtils.transformedPredicate(new CommonTransformer("pk.cagencia"), PredicateUtils.equalPredicate(agencia.getPk()))); + if (agencia.getModifiedData().get("seleccionado") != null && Boolean.valueOf(agencia.getModifiedData().get("seleccionado").toString())) { + if (agenciaSeleccionada == null) { + solicitudAgenciaSucursal.create(); + solicitudAgenciaSucursal.getRecord().getPk().setCagencia(agencia.getPk()); + solicitudAgenciaSucursal.update(); + } + } else if (agenciaSeleccionada != null) { + solicitudAgenciaSucursal.setRecord(agenciaSeleccionada); + solicitudAgenciaSucursal.remove(); +// solicitudAgenciaSucursal.update(); + } + } + } + } + + /** + * Copia los documentos para procesarse en la solcitud + * + * @throws Exception + */ + private void copiaDocumentos() throws Exception { + if (listarDocumentos && documentoHabilitante.getLrecord() != null && !documentoHabilitante.getLrecord().isEmpty()) { + for (TarmDocumentoHabilitante docHabilitante : documentoHabilitante.getLrecord()) { + TarmSolicitudDocumento documentoSeleccionado = (TarmSolicitudDocumento) CollectionUtils.find(solicitudDocumento.getLrecord(), + PredicateUtils.transformedPredicate(new CommonTransformer("pk.cdocumento"), PredicateUtils.equalPredicate(docHabilitante.getPk()))); + if (docHabilitante.getModifiedData().get("seleccionado") != null && Boolean.valueOf(docHabilitante.getModifiedData().get("seleccionado").toString())) { + if (documentoSeleccionado == null) { + solicitudDocumento.create(); + solicitudDocumento.getRecord().getPk().setCdocumento(docHabilitante.getPk()); + solicitudDocumento.update(); + // Cambiar el centro de control del documento al centro control de armas actual + if (docHabilitante.getCentrocontrol().equalsIgnoreCase("999999")) { + docHabilitante.setCentrocontrol(centroControl.getPk()); + documentoHabilitante.update(docHabilitante); + } + } + } else if (documentoSeleccionado != null) { + solicitudDocumento.setRecord(documentoSeleccionado); + solicitudDocumento.remove(); +// solicitudDocumento.update(); + } + } + } + } + + /** + * Copia las armas seleccionadas a la agencia seleccionada debe ejecutarse + * después de + * + * @throws Exception + */ + private void copiaAgenciaArmas() throws Exception { + if (seleccionarAgencias) { + Long cagencia = solicitudAgenciaSucursal.getLrecord().iterator().next().getPk().getCagencia(); + for (TarmSolicitudArmas tarmSolicitudArmas : solicitudArmas.getLrecord()) { + agenciaArma.create(); + agenciaArma.getRecord().getPk().setCagencia(cagencia); + agenciaArma.getRecord().getPk().setCarma(tarmSolicitudArmas.getPk().getCarma()); + agenciaArma.update(); + } + } + } + + /** + * Valida que solo se seleccione una agencia en la solicitud + * + * @param event + */ + public void validaAgenciaUnica(AjaxBehaviorEvent event) { + Boolean valorComponente = (Boolean) (event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value") : null); + if (valorComponente) { + int cont = 0; + for (TarmAgenciaSucursal tarmAgenciaSucursal : agenciaSucursal.getLrecord()) { + if (tarmAgenciaSucursal.getModifiedData().get("seleccionado") != null && Boolean.parseBoolean(tarmAgenciaSucursal.getModifiedData().get("seleccionado").toString())) { + cont++; + } + if (cont > 1) { + agenciaSucursal.getLrecord().get(Integer.parseInt(event.getComponent().getAttributes().get("indiceActual").toString())).getModifiedData().put("seleccionado", Boolean.FALSE); + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_unicidad_agencia")); + break; + } + } + } + } + + /** + * Realiza las validaciones pertinentes del formulario + * + * @return + */ + private boolean validacionFormulario() { + //Valido el tramite que se ha escogido un tramite + Boolean valido = Boolean.TRUE; + if (solicitud.getRecord().getCtramite() == null) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_tramite")); + valido = Boolean.FALSE; + } + if (ingresarRequisitos) { + int tamReq = requisitos.getLrecord().size(); + int tamReqSel = 0; + for (TarmSolicitudRequisitos solicitudRequisitos : requisitos.getLrecord()) { + if (solicitudRequisitos.getCargado() != null && solicitudRequisitos.getCargado().equals(Constant.STR_Y)) { + tamReqSel++; + } + } + if (tamReq == 0) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_no_requisitos")); + valido = Boolean.FALSE; + } else if (tamReq != tamReqSel) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_requisitos")); + valido = Boolean.FALSE; + } + } + if (seleccionarArmas) { + //tramite autorizacion primera vez/renovacion Estableciiento de agencias Companias de vigilancia y seguridad + TgeneParameters parametro = ParametersController.find("CODIGO.TRAMITE.NOVALIDAARMAS", "1"); + List codigoTramiteNoValidaArma = null; + if (parametro != null) { + codigoTramiteNoValidaArma = new ArrayList<>(); + String[] arrayTramitesNoValidaArmas = parametro.getTextvalue().split(","); + for (String item : arrayTramitesNoValidaArmas) { + codigoTramiteNoValidaArma.add(Long.parseLong(item)); + } + } + + if (this.tarmTramite != null && codigoTramiteNoValidaArma != null && codigoTramiteNoValidaArma.contains(this.tarmTramite.getPk())) { + System.err.println("Tramite-" + this.tarmTramite.getPk()); + //pasa + } else if (solicitudArmas.getLrecord() == null || solicitudArmas.getLrecord().isEmpty()) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_armas")); + valido = Boolean.FALSE; + } else if (tarmTramite.getNumeromaxarmas() != null && tarmTramite.getNumeromaxarmas().intValue() < solicitudArmas.getLrecord().size()) { + MessageHelper.setMessageWarn(MsgControlArmas.getProperty("msg_error_maximo_armas"), tarmTramite.getNumeromaxarmas()); + valido = Boolean.FALSE; + } + } + if (seleccionarGuardias) { + if (solicitudGuardias.getLrecord() == null || solicitudGuardias.getLrecord().isEmpty()) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_guardias")); + valido = Boolean.FALSE; + } + } + if (seleccionarAgencias) { + if (solicitudAgenciaSucursal.getLrecord() == null || solicitudAgenciaSucursal.getLrecord().isEmpty()) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_agencias")); + valido = Boolean.FALSE; + } + } + if (listarDocumentos) { + if (documentoHabilitante.getLrecord() == null || documentoHabilitante.getLrecord().isEmpty()) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_noexistendocumentos")); + valido = Boolean.FALSE; + } else if (solicitudDocumento.getLrecord() == null || solicitudDocumento.getLrecord().isEmpty()) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_documento")); + valido = Boolean.FALSE; + } + } + return valido; + } + +// public void saveCabecera() { +// try { +// Request request = callerhelper.getRequest(); +// HashMap msave = new HashMap(); +// solicitud.fijaPersona(detallepersona.getRecord()); +// solicitud.update(); +// +// DtoSave dtosavesol = solicitud.getDtoSave(); +// dtosavesol.setIsForm(true); +// dtosavesol.setReturnpk(true); +// dtosavesol.setPosition(1); +// msave.put(solicitud.getBeanalias(), dtosavesol); // adicionar metadata de mantenimiento para cada tabla. +// +// request.setSaveTables(msave); +// request.modifiedData().put("csolicitud", solicitud.getRecord().getPk()); +// request.modifiedData().put("isnew", "N"); +// +// Response resp = callerhelper.executeSave(request); +// if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { +// solicitud.postCommit(resp); +// ocultarBotonInicioFlujo = false; +// MessageHelper.setMessageInfo(resp); +// } else { +// ocultarBotonInicioFlujo = true; +// MessageHelper.setMessageError(resp); +// } +// +// } catch (Throwable e) { +// MessageHelper.setMessageError(e); +// } +// } + @Override + protected void querydatabase() { + try { + if (deshabilitarPantalla) { + return; + } + detalleusuario.getMfilters().clear(); + detalleusuario.getMfilters().put("pk.usercode", login.getRequest().getUser()); + detalleusuario.addFilterDateto(); + detalleusuario.query(); + if (detalleusuario.getRecord() == null || detalleusuario.getRecord().getPk().getPersoncode() == null) { + return; + } + + cpersona = detalleusuario.getRecord().getPk().getPersoncode(); + detallepersona.getMfilters().clear(); + detallepersona.getMfilters().put("pk.personcode", cpersona.toString()); + detallepersona.addFilterDateto(); + detallepersona.query(); + + natural.getMfilters().clear(); + natural.addPersoncodeFilter(cpersona.toString()); + natural.addFilterDateto(); + natural.query(); + + direccion.getMfilters().clear(); + direccion.addPersoncodeFilter(cpersona.toString()); + direccion.addFilterDateto(); + direccion.query(); + + this.obtenerDireccionesGenerales(); + + telefono.getMfilters().clear(); + telefono.addPersoncodeFilter(cpersona.toString()); + telefono.addFilterDateto(); + telefono.query(); + + this.obtenerTelefonos(); + + this.setearDatosGenerales(); + //creamos una solicitud por default cuando se consulta por primera vez y al transaccion es 20 + if (this.getLoginController().getRequest().getTransactionModule().equals("30") && this.getLoginController().getRequest().getTransactionCode() == 20) { + solicitud.create(); + solicitud.getRecord().setFregistro(new java.sql.Date(System.currentTimeMillis())); + this.obtenerSecuencialSolicitud(); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Muestra un mensaje de error siempre y cuando sea un error de componente y + * se lo muestra como general + * + * @return + */ + public Boolean getExisteMensajesError() { + Boolean resp = Boolean.FALSE; + FacesContext facesContext = FacesContext.getCurrentInstance(); + final Iterator idComponentesMensajes = facesContext.getClientIdsWithMessages(); + while (idComponentesMensajes.hasNext()) { + String idComp = idComponentesMensajes.next(); + if (StringUtils.isNotBlank(idComp)) { + facesContext.validationFailed(); + resp = Boolean.TRUE; + RequestContext.getCurrentInstance().execute("$('#" + idComp.replace(":", "\\\\:") + "').focus();"); + break; + } + } + return resp; + } + + /** + * En base a la provincia y sus jurisdicciones se obtiene y se coloca el + * centro de control + */ +// private void setearCodigoCentroControl(){ +// TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(direccion.getMfilelds().get("solcodprovincia") != null ? +// direccion.getMfilelds().get("solcodprovincia").toString() : StringUtils.EMPTY); +// if(centroControlJur != null){ +// this.solicitud.getRecord().setCcentrocontrol(centroControlJur.getCcentrocontrol()); +// } +// } + /** + * Ingresa datos que se necesitan en arma + */ + private void setearDatosGenerales() { + TcustPersonDetail tcustPersonDetail = PersonDetailController.find(cpersona.toString()); + armas.getMfilelds().put("numdoc", tcustPersonDetail.getIdentification()); + armas.getMfilelds().put("tipodoc", tcustPersonDetail.getIdentificationcatalog()); + } + + /** + * Arma la petición al core para solicitar un número de + * secuencial para la solicitud antes de guardarla + * + * @throws Throwable + */ + private void obtenerSecuencialSolicitud() throws Throwable { + Request request = callerhelper.getRequest(); + DtoQuery dtoQuery = super.getDtoQuery(true); + HashMap mapQuery = new HashMap(); + mapQuery.put(beanalias, dtoQuery); + request.put("querytype", "T"); + request.setQueryTables(mapQuery); + Response response = callerhelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(response); + } else { + solicitud.getRecord().setNumerosolicitud(response.get("SECUENCIALSOLICITUD").toString()); + } + } + + /** + * Recupera en base al tipo de identificación la dirección de + * la oficina o de la casa + */ + private void obtenerDireccionesGenerales() { + TcustPersonAddress direccionPersona = null; + direccionPersona = direccion.findPrincipal(detallepersona.getRecord().getPk().getPersoncode().toString()); + + if (direccionPersona != null) { + direccion.getMfilelds().put("solcodpais", direccionPersona.getCountrycode()); + direccion.setLprovinces(ProvinceController.find(direccionPersona.getCountrycode())); + direccion.getMfilelds().put("solcodprovincia", direccionPersona.getProvincecode()); + direccion.setLcantones(CantonController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode())); + direccion.getMfilelds().put("solcodcanton", direccionPersona.getCantoncode()); + direccion.setLcities(CityController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode(), direccionPersona.getCantoncode())); + direccion.getMfilelds().put("solcodciudad", direccionPersona.getCitycode()); + direccion.setLparroquias(ParroquiaController.find(direccionPersona.getCountrycode(), direccionPersona.getProvincecode(), direccionPersona.getCantoncode())); + direccion.getMfilelds().put("solcodparroquia", direccionPersona.getParroquiacode()); + direccion.getMfilelds().put("soldireccion", direccionPersona.getAddress()); + } + + TcustPersonAddress correo = (TcustPersonAddress) CollectionUtils.find(direccion.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getAddresstypecatalog"), PredicateUtils.equalPredicate("3"))); + if (correo != null) { + direccion.getMfilelds().put("solcorreopersona", correo.getAddress()); + } + } + + /** + * Retorna el telefono fijo y celular de la persona + */ + private void obtenerTelefonos() { + TcustPersonPhone telf = null; + telf = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getPhonetypecatalog"), PredicateUtils.equalPredicate("1"))); + if (telf != null) { + telefono.getMfilelds().put("soltelfijo", telf.getPhonenumber()); + } + telf = (TcustPersonPhone) CollectionUtils.find(telefono.getLrecord(), PredicateUtils.transformedPredicate(TransformerUtils.invokerTransformer("getPhonetypecatalog"), PredicateUtils.equalPredicate("2"))); + if (telf != null) { + telefono.getMfilelds().put("soltelcelular", telf.getPhonenumber()); + } + } + + /** + * Método para el inicio de flujo + */ + public void iniciarFlujo() { + try { + cprovincia = null; + for (TarmCentroControl centro : centroControlList) { + if (solicitud.getRecord().getCcentrocontrol().equals(centro.getPk())) { + cprovincia = centro.getProvincecode(); + } + } + ; + if (cprovincia == null || cprovincia.length() == 0) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinprovincia")); + return; + } + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + + request.modifiedData().put("csolicitud", solicitud.getRecord().getPk()); + request.modifiedData().put("numerosolicitud", solicitud.getRecord().getNumerosolicitud()); + request.modifiedData().put("numerotransaccion", solicitud.getRecord().getCtramite()); + request.modifiedData().put("cprovincia", cprovincia); + request.modifiedData().put("isnew", "Y"); + + request.setLogsolicitude(solicitud.getRecord().getNumerosolicitud()); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.setShowRow(true); + flujoiniciado = true; + deshabilitarPantalla = Boolean.TRUE; + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + " SOLICITUD: " + solicitud.getRecord().getNumerosolicitud()); + saveInicioFlujoEnYES(); +// RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para el inicio de flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + + request.modifiedData().put("csolicitud", solicitud.getRecord().getPk()); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Evento que se ejecuta cuando cambia el origen de adquisición + */ + public void executeOrigenAdquisicion() { + + TarmTramite tramite = this.solicitud.getRecord().getCtramite() != null ? TarmTramiteController.find(this.solicitud.getRecord().getCtramite().toString()) : null; + if ((this.solicitud.getRecord().getOrigenadquisicion() != null && this.solicitud.getRecord().getOrigenadquisicion().equals("DEC")) + || (tramite != null && tramite.getTipoautorizacion().equals("1") && tramite.getCategoria().equals("10"))) { + this.mostrarIngresoArmas = Boolean.TRUE; + } else { + this.mostrarIngresoArmas = Boolean.FALSE; + } + } + /***/ + public void executeTipoPago() { + + TarmTramite tramite = this.solicitud.getRecord().getCtramite() != null ? TarmTramiteController.find(this.solicitud.getRecord().getCtramite().toString()) : null; + if ((this.solicitud.getRecord().getOrigenadquisicion() != null && this.solicitud.getRecord().getOrigenadquisicion().equals("DEC")) + || (tramite != null && tramite.getTipoautorizacion().equals("1") && tramite.getCategoria().equals("10"))) { + this.mostrarIngresoArmas = Boolean.TRUE; + } else { + this.mostrarIngresoArmas = Boolean.FALSE; + } + } + + @Override + public void postCommit(Response response) throws Exception { + } + + /** + * Datos de control de la identificacion de la persona. + */ + public void onChangeTipoId() { + String tipoid = super.getMfilelds().get("tipoidentificacion").toString(); + switch (tipoid) { + case "CED": + longitudid = 10; + activarRegExIdentificacion = true; + break; + case "RUC": + longitudid = 13; + activarRegExIdentificacion = true; + break; + default: + longitudid = 13; + activarRegExIdentificacion = false; + break; + } + } + + /** + * Abre el LOV de trámite + */ + public void openLovTramite() { + Map> params = new HashMap>(); + List ltipopersona = new ArrayList<>(); + if (validaNumeros(detallepersona.getRecord().getIdentification())) { + if (detallepersona.getRecord().getIdentification().length() == 10) { + ltipopersona.add(ParametersController.find("CODIGO.PERSONTYPE.NATURAL", "1").getTextvalue());//1 + } else { + ltipopersona.add(ParametersController.find("CODIGO.PERSONTYPE.JURIDICA", "1").getTextvalue());//2 + } + } + params.put("tipopersonasol", ltipopersona); + BuscarTramiteLovController.openLov(params); + } + + private boolean validaNumeros(String cadena) { + Boolean aux = Boolean.FALSE; + if (cadena.matches("[0-9]*")) { + aux = Boolean.TRUE; + } else { + aux = Boolean.FALSE; + } + return aux; + } + + /** + * Abre el LOV de la clase del arma + */ + public void openLovClase() { + Map> params = new HashMap>(); + ClaseLovController.openLov(params); + } + + /** + * Regresa del LOV de armas + * + * @param event + */ + public void onReturnClase(SelectEvent event) { + TgeneCatalogDetail clase = (TgeneCatalogDetail) event.getObject(); + this.armas.getRecord().getModifiedData().put("clase", clase.getDescription()); + this.armas.setClase(clase.getPk().getCatalog()); + } + + /** + * Regresa del LOV para cargar valores + * + * @param event {@link SelectEvent} + */ + public void onReturnTramite(SelectEvent event) { + try { + TarmTramite tramite = (TarmTramite) event.getObject(); + this.tarmTramite = tramite; +// if(!procedeTramite(TarmTramiteController.find(tramite.getCtramitepadre() != null ? tramite.getCtramitepadre().toString() : "-1"),tramite.getPk())){ + if (!procedeTramite(tramite)) { + return; + } + if (!verificaAptitudPersona(tarmTramite)) { + return; + } + + this.armas.setTarmTramite(this.tarmTramite); + solicitud.getRecord().setCtramite(tramite.getPk()); + tipoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + tipoAutorizacion = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + TgeneCatalogDetail categoria = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + actividad = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + this.getSolicitud().addField("tipoTramite", tipoTramite.getDescription()); + this.getSolicitud().addField("tipoAutorizacion", tipoAutorizacion.getDescription()); + this.getSolicitud().addField("categoria", categoria.getDescription()); + this.getSolicitud().addField("actividad", actividad.getDescription()); + + if (tarmTramite.getTipotramite().equals(ParametersController.find("CODIGO.TRAMITEREIMPRESION", "1").getTextvalue())) { + this.actualizaDatosGenerales = Boolean.TRUE; + } else { + this.actualizaDatosGenerales = Boolean.FALSE; + } + + if (tarmTramite.getTipoautorizacion().equals("4")) {//Guia de libre transito + this.guiaLibreTransito = Boolean.TRUE; + if (!this.actualizaDatosGenerales) { + this.actualizaDatosGenerales = Boolean.TRUE; + } + } else { + this.guiaLibreTransito = Boolean.FALSE; + } + + this.ingresarRequisitos = Boolean.TRUE; + if (Constant.ifYes(tramite.getRegistroarmas())) { + this.seleccionarArmas = Boolean.TRUE; + this.cargaArmas(); + } else { + this.seleccionarArmas = Boolean.FALSE; + this.solicitudArmas.clearAll(); + } + if (Constant.ifYes(tramite.getRegistroguardia())) { + this.seleccionarGuardias = Boolean.TRUE; + this.cargaGuardias(); + } else { + this.seleccionarGuardias = Boolean.FALSE; + this.solicitudGuardias.clearAll(); + } + if (Constant.ifYes(tramite.getRegistroagenciasucursal())) { + this.seleccionarAgencias = Boolean.TRUE; + this.cargarAgencias(); + } else { + this.seleccionarAgencias = Boolean.FALSE; + this.solicitudAgenciaSucursal.clearAll(); + } + + if (Constant.ifYes(tramite.getDocumentohabilitante()) || tipoTramite.getPk().getCatalog().equals(ParametersController.find("CODIGO.TRAMITEREIMPRESION", "1").getTextvalue())) { + this.listarDocumentos = Boolean.TRUE; + listarDocumentos(tipoTramite, tipoAutorizacion, actividad);//Se listan los documentos en el tab listar documentos + } else { + this.listarDocumentos = Boolean.FALSE; + this.solicitudDocumento.clearAll(); + } + + if (tramite != null) { + requisitoPorTramite.getMfilters().put("pk.ctramite", tramite.getPk().toString()); + requisitoPorTramite.setRecperpage(3000000); + requisitoPorTramite.setcTramite(tramite.getPk()); + requisitoPorTramite.query(); + requisitos.clearAll();//limpio los datos del requisito anterior + for (TarmRequisitoPorTipoTramite requisitoPorTipoTramite : requisitoPorTramite.getLrecord()) { + requisitos.create(); + requisitos.getRecord().setCargado(Constant.STR_N); + requisitos.getRecord().setPk(new TarmSolicitudRequisitosKey()); + requisitos.getRecord().getPk().setCrequisito(requisitoPorTipoTramite.getPk().getCrequisito()); + requisitos.getRecord().getPk().setCtramite(tramite.getPk()); + requisitos.getRecord().getModifiedData().put("crequisito", requisitoPorTipoTramite.getModifiedData().get("crequisito")); + requisitos.getRecord().getModifiedData().put("nrequisito", requisitoPorTipoTramite.getModifiedData().get("nrequisito")); + requisitos.getRecord().getModifiedData().put("ndescripcion", requisitoPorTipoTramite.getModifiedData().get("ndescripcion")); + requisitos.update(); + } + } + + if (tarmTramite.getUsoactividad().equals("2") || tarmTramite.getUsoactividad().equals("24")) {//2 AGENCIA // 24 SUCURSAL + if (agenciaSucursal != null && agenciaSucursal.getTipoAgencias() != null && agenciaSucursal.getTipoAgencias().size() > 0) { + TgeneCatalogDetail remover = new TgeneCatalogDetail(); + agenciaSucursal.setTipoAgencias(CatalogDetailController.find("TIPOAGENCIA")); + for (TgeneCatalogDetail item : agenciaSucursal.getTipoAgencias()) { + if (!tarmTramite.getUsoactividad().equals("2")) { + if (item.getPk().getCatalog().equals(ParametersController.find("CODIGO.AGENCIA.TIPOAGENCIA", "1").getTextvalue())) {//"AGE" + remover = item; + } + } + if (!tarmTramite.getUsoactividad().equals("24")) { + if (item.getPk().getCatalog().equals(ParametersController.find("CODIGO.SUCURSAL.TIPOAGENCIA", "1").getTextvalue())) {//"SUC" + remover = item; + } + } + } + agenciaSucursal.getTipoAgencias().remove(remover); + } + } + + //AQUI VA EL CODIGO PARA LLENAR LAS ADQUISICION + lorigenadquisicion = null; + lorigenadquisicion = new ArrayList(); + List origenTramites = OrigenTramiteController.findOrigenTramite(tarmTramite); + if (origenTramites != null && !origenTramites.isEmpty()) { + for (int i = 0; i < origenTramites.size(); i++) { + TarmOrigenTramite origenTramite = origenTramites.get(i); + if (origenTramite != null && origenTramite.getPk().getOrigencatalog() != null && origenTramite.getPk().getOrigencatalogcode() != null + && !origenTramite.getPk().getOrigencatalog().isEmpty() && !origenTramite.getPk().getOrigencatalogcode().isEmpty()) { + lorigenadquisicion.add(CatalogDetailController.findCatalogo(origenTramite.getPk().getOrigencatalogcode(), origenTramite.getPk().getOrigencatalog())); + } + } + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + /** + * Metodo para listar el listado de documentos para los diferentes + * critesrios de seleccion + * + * @param tipoTramite tipo del tramite + * @param tipoAutorizacion tipo de la autorizacion + * @param actividad actividad + * @throws Exception + */ + private void listarDocumentos(TgeneCatalogDetail tipoTramite, TgeneCatalogDetail tipoAutorizacion, TgeneCatalogDetail actividad) throws Exception { + if (tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipoautorizacion"), MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())) { + this.cargarDocumentos(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipoautorizacion"), MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog()); + } + if (tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipoautorizacion"), MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_actualizacionDeDatos")).getPk().getCatalog())) { + this.cargarTodosDocumentosPersona(); + } + if (tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_reimpresion_tipo")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipoautorizacion"), MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_perdida")).getPk().getCatalog())) { + this.cargarDocumentos(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_renovacion")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipoautorizacion"), MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog()); + } + if (tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipoautorizacion"), MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog())) { + this.cargarDocumentos(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_renovacion")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipoautorizacion"), MsgControlArmas.getProperty("ctg_autorizacion")).getPk().getCatalog()); + } + if (tipoTramite.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog()) + && tipoAutorizacion.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipoautorizacion"), MsgControlArmas.getProperty("ctg_certificados")).getPk().getCatalog()) + && actividad.getPk().getCatalog().equals(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_usoactividad"), MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog())) { + this.cargarDocumentos(CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_primeravez")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipotramite"), MsgControlArmas.getProperty("ctg_renovacion")).getPk().getCatalog(), + CatalogDetailController.findByCatalogcodeDescrption(MsgControlArmas.getProperty("ctg_tipoautorizacion"), MsgControlArmas.getProperty("ctg_permiso")).getPk().getCatalog()); + } + if (documentoHabilitante.getLrecord() == null || documentoHabilitante.getLrecord().isEmpty()) { + MessageHelper.setMessageWarn(MsgControlArmas.getProperty("msg_error_noexistendocumentos")); + } + } + + /** + * Verifica si el trámite ingresado cumple la prevalidación + * TarmTramite tramite es el tramite padre validamos si este tiene codigo + * alterno Creado FPAZMINO + * + * @return + */ + private boolean procedeTramite(TarmTramite tramite) { + if (tramite.getCtramitepadre() == null && tramite.getCtramitepadrealt() == null) { + return Boolean.TRUE; + } + Boolean procede = Boolean.FALSE; + String msgErrorTramitePadre = ""; + //consulta del tramite padre + TarmTramite tramitePadre = TarmTramiteController.find(tramite.getCtramitepadre() != null ? tramite.getCtramitepadre().toString() : "-1"); + //consulta por tramite padre + if (tramitePadre != null) { + Boolean debeValidarCaducidad = (tramite.getValidacaducidadpadre() != null && tramite.getValidacaducidadpadre().equalsIgnoreCase("Y")) ? true : false; + //consulta documento habilitante del codigo padre alterno + documentoHabilitante.querydatabaseDocumentosCriterioFiltro(Arrays.asList(tramitePadre), debeValidarCaducidad, cpersona.toString()); + if (documentoHabilitante.getLrecord() != null && !documentoHabilitante.getLrecord().isEmpty()) { + if (tramitePadre.getCtramitepadre() == null && tramitePadre.getCtramitepadrealt() == null) { + return Boolean.TRUE; + } else { + procede = procedeTramite(tramitePadre); + } + } else { + procede = Boolean.FALSE; + msgErrorTramitePadre = MsgControlArmas.getProperty("msg_error_tramite_padre", tramitePadre.getModifiedData().get("tipotramite"), tramitePadre.getModifiedData().get("tipoautorizacion"), tramitePadre.getModifiedData().get("categoria"), tramitePadre.getModifiedData().get("usoactividad")); +// MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_tramite_padre", tramite.getModifiedData().get("tipotramite"), tramite.getModifiedData().get("tipoautorizacion"), tramite.getModifiedData().get("categoria") , tramite.getModifiedData().get("usoactividad"))); + } + } + //consulta del tramite padre alterno, seria el tramite de renovacion + TarmTramite tramitePadreAlterno = TarmTramiteController.find(tramite.getCtramitepadrealt() != null ? tramite.getCtramitepadrealt().toString() : "-1"); + //consulta por tramite padre alterno + if (tramitePadreAlterno != null && !procede) { + Boolean debeValidarCaducidad = (tramite.getValidacaducidadpadre() != null && tramite.getValidacaducidadpadre().equalsIgnoreCase("Y")) ? true : false; + //consulta documento habilitante del codigo padre alterno + documentoHabilitante.querydatabaseDocumentosCriterioFiltro(Arrays.asList(tramitePadreAlterno), debeValidarCaducidad, cpersona.toString()); + if (documentoHabilitante.getLrecord() != null && !documentoHabilitante.getLrecord().isEmpty()) { + if (tramitePadreAlterno.getCtramitepadre() == null && tramitePadreAlterno.getCtramitepadrealt() == null) { + return Boolean.TRUE; + } else { + procede = procedeTramite(tramitePadreAlterno); + } + } else { + procede = Boolean.FALSE; + msgErrorTramitePadre = MsgControlArmas.getProperty("msg_error_tramite_padre", tramitePadreAlterno.getModifiedData().get("tipotramite"), tramitePadreAlterno.getModifiedData().get("tipoautorizacion"), tramitePadreAlterno.getModifiedData().get("categoria"), tramitePadreAlterno.getModifiedData().get("usoactividad")); +// MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_tramite_padre", tramite.getModifiedData().get("tipotramite"), tramite.getModifiedData().get("tipoautorizacion"), tramite.getModifiedData().get("categoria") , tramite.getModifiedData().get("usoactividad"))); + } + } + + if (!procede && !msgErrorTramitePadre.equalsIgnoreCase("")) { + MessageHelper.setMessageInfo(msgErrorTramitePadre); + } + return procede; + } + + /** + * Verifica si la persona es apta para dicho tramite + * + * @param tramite + * @return + * @throws Exception + */ + private boolean verificaAptitudPersona(TarmTramite tramite) throws Exception { + boolean verificaApto = Boolean.TRUE; + if (tramite.getRequiereevaluacion() != null && tramite.getRequiereevaluacion().equals(Constant.STR_Y)) { + evaluacionController.addFilter("personcode", cpersona.toString()); + evaluacionController.addFilter("resultado", MsgControlArmas.getProperty("ctg_resultado_aprobado")); + evaluacionController.addFilter("resultadocodigo", MsgControlArmas.getProperty("ctg_resultado_codigo")); + evaluacionController.addFilter("tipoevaluacion", MsgControlArmas.getProperty("ctg_tipo_evaluacion_conocimiento")); + evaluacionController.addFilter("tipoevaluacioncodigo", MsgControlArmas.getProperty("ctg_tipo_evaluacion_codigo")); + evaluacionController.setTipoTest("CONOCIMIENTO"); + evaluacionController.query(); + if (evaluacionController.getLrecord() == null || evaluacionController.getLrecord().isEmpty()) { + verificaApto = Boolean.FALSE; + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_requiere_validacion_tecnica")); + } + evaluacionController.clearAll(); + evaluacionController.addFilter("personcode", cpersona.toString()); + evaluacionController.addFilter("resultado", MsgControlArmas.getProperty("ctg_resultado_aprobado")); + evaluacionController.addFilter("resultadocodigo", MsgControlArmas.getProperty("ctg_resultado_codigo")); + evaluacionController.addFilter("tipoevaluacion", MsgControlArmas.getProperty("ctg_tipo_evaluacion_psicologica")); + evaluacionController.addFilter("tipoevaluacioncodigo", MsgControlArmas.getProperty("ctg_tipo_evaluacion_codigo")); + evaluacionController.setTipoTest("PSICOLOGICA"); + evaluacionController.query(); + if (evaluacionController.getLrecord() == null || evaluacionController.getLrecord().isEmpty()) { + verificaApto = Boolean.FALSE; + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_requiere_validacion_psicologica")); + } + } + return verificaApto; + } + + /** + * Método en el cual se cargan los guardias de seguridad de una + * determina empresa + * + * @throws Exception + */ + private void cargaGuardias() throws Exception { + guardias.addFilter("cempresa", this.cpersona.toString()); + guardias.addFilter("estado", "APT"); + guardias.setRecperpage(3000000); + guardias.query(); + } + + /** + * Método en el cual se cargan las armas de la persona registrada + * + * @throws Exception + */ + public void cargaArmas() throws Exception { + String estadosarma; + String tipoFab; + armas.setRecperpage(5000); + String fechaCaducidad = null; + estadosarma = tarmTramite.getEstados(); + tipoFab = tarmTramite.getTipofabricacion(); + if (tarmTramite.getTipoautorizacion().equals("3")) {//devolucion 3 + armas.addField("sancion", Constant.STR_Y); + armas.addField("personcode", cpersona.toString()); + } + if (estadosarma != null && estadosarma.contains("REN")) { + armas.addField("TRAMITE", tarmTramite); + } + if (tipoFab != null) { + armas.addField("TIPOFABRICACION", tipoFab); + } + + if (tarmTramite.getTipotramite().equals("1")) {//primera vez + if (!tarmTramite.getCategoria().equals("1") + && //Categoria APERTURA + !tarmTramite.getTipoautorizacion().equals("2") && !tarmTramite.getTipoautorizacion().equals("4")) {//tipoautorizacion=CERTIFICADOS 2 GUiA DE LIBRE TRaNSITO 4 + fechaCaducidad = " is null "; + } + } else if (tarmTramite.getTipotramite().equals("3")) {//renovacion + fechaCaducidad = " <> null "; + } else if (tarmTramite.getTipotramite().equals("2")) {//reimpresion + Date fechaActual = new Date(); + SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy"); + fechaCaducidad = " > " + "to_date(" + format.format(fechaActual + ",'dd/MM/yyyy')"); + } + // CATEGORIA 14 PREVIA IMPORTACION + if (!tarmTramite.getCategoria().equals("14")) { + armas.setLrecord(armas.findxPersona(cpersona.longValue(), estadosarma, tipoFab, tarmTramite.getClase(), fechaCaducidad)); + mostrarFiltroAUCP = Boolean.FALSE; + } else { + armas.setLrecord(new ArrayList()); + mostrarFiltroAUCP = Boolean.TRUE; + } + // + listaPersonasDetailVen = new HashSet(); + Set listaCodigos = new HashSet(); + for (TarmArmas arma : armas.getLrecord()) { + if (arma.getLote() == null) { + arma.setLote(" "); + } + //carga los posibles vendedoeres + if (this.guiaLibreTransito) { + System.err.println("guiaLibreTransito " + guiaLibreTransito); + List listaArmas = AuxArmasController.findListXCodigoArma(arma.getCodigoarma()); + if (listaArmas != null && listaArmas.size() > 0) { + for (TarmArmas tarmArmasVendedor : listaArmas) { + System.out.println("arma.getCregistro(): " + tarmArmasVendedor.getModifiedData().get("personcode")); + if (tarmArmasVendedor.getModifiedData().get("personcode") != null + && !listaCodigos.contains(tarmArmasVendedor.getModifiedData().get("personcode").toString())) { + listaCodigos.add(tarmArmasVendedor.getModifiedData().get("personcode").toString()); + TcustPersonDetail personaDetail = PersonDetailController.find(tarmArmasVendedor.getModifiedData().get("personcode").toString()); + listaPersonasDetailVen.add(personaDetail); + + } + } + } + } + + } + System.out.println("listaPersonasDetailVen: " + listaPersonasDetailVen.size()); + + Collections.sort(armas.getLrecord(), new Comparator() { + public int compare(TarmArmas p1, TarmArmas p2) { + return p1.getLote().compareTo(p2.getLote()); + } + }); + + if (armas.getLrecord() == null || armas.getLrecord().isEmpty()) { + MessageHelper.setMessageWarn(MsgControlArmas.getProperty("msg_error_armas_inexistentes")); + } + } + + /** + * Método en el cual se cargan las agencias de la persona registrada + * + * @throws Exception + */ + private void cargarAgencias() throws Exception { + agenciaSucursal.setRecperpage(3000000); + agenciaSucursal.addFilter("personcode", this.cpersona.toString()); + agenciaSucursal.query(); + // agenciaSucursal.record.fautorizacion + } + + /** + * Método en el cual se cargan los documentos habilitantes de la + * persona registrada + * + * @throws Exception + */ + private void cargarTodosDocumentosPersona() { + try { + documentoHabilitante.setRecperpage(3000000); + documentoHabilitante.documentosXPersona(cpersona); + + } catch (Exception e) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_noexistendocumentos")); + return; + + } + } + + /** + * Método en el cual se cargan los documentos habilitantes de la + * persona registrada + * + * @throws Exception + */ + private void cargarDocumentos(String tipoTramite, String tipoTramite2, String tipoAutorizacion) { + try { + List listTramites = TarmTramiteController.findPorCriteriosTramite(tipoTramite, tipoTramite2, tipoAutorizacion); +// List listSolicitudes = new ArrayList<>(); +// for(TarmTramite tramite:listTramites){ +// List listSolicitud = SolicitudArmasController.findByPersonaCTramite(cpersona, String.valueOf(tramite.getPk())); +// if(listSolicitud!=null && !listSolicitud.isEmpty()){ +// listSolicitudes.addAll(listSolicitud); +// } +// } + if (listTramites == null || listTramites.isEmpty()) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_noexistendocumentos")); + return; + } + documentoHabilitante.setRecperpage(3000000); + documentoHabilitante.documentosXTramite(listTramites, cpersona); + } catch (Exception e) { + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("msg_error_noexistendocumentos")); + return; + + } + } + + /** + * Se almacena las agencias en su tabla + * + * @throws Exception + */ + public void guardarAgencias() throws Exception { + agenciaSucursal.getRecord().setPersoncode(cpersona); + agenciaSucursal.update(); + agenciaSucursal.save(); + this.cargarAgencias(); + agenciaSucursal.setRecord(null); + } + + /** + * Elimina las agencias sucursales de la base de datos + * + * @throws Exception + */ + public void eliminarAgencias() throws Exception { + agenciaSucursal.remove(); + agenciaSucursal.update(); + agenciaSucursal.save(); + agenciaSucursal.setRecord(null); + } + + /** + * Guarda las armas + * + * @throws Exception + */ + public void guardarArmas() throws Exception { + armas.getRegistroArmas().getRecord().setPersoncode(cpersona); +// armas.getRegistroArmas().update(); +// armas.update(); + armas.saveArmaSolicitud(); + if (this.armas.isExisteTipoArmaExplosivo()) { + armas.setRecord(null); + } + } + + /** + * Elimina armas de la base de datos + * + * @throws Exception + */ + public void eliminarArmas() throws Exception { + armas.remove(); + armas.update(); + armas.save(); + cargaArmas(); + armas.setRecord(null); + } + + /** + * Datos de control de ingreso de informacion dado el tipo de tramite. + */ + public void onChangeTipoTramite() throws Exception { + String ctipotramite = solicitud.getRecord().getCcentrocontrol();//getCtipotramite(); + requisitos.consultaPorTipoTramite(ctipotramite); + } + + /** + * Cambia país + */ + public void executePais() { + if (direccion.getMfilelds().get("solcodpais") != null && StringUtils.isNotBlank(direccion.getMfilelds().get("solcodpais").toString())) { + direccion.setLprovinces(ProvinceController.find(direccion.getMfilelds().get("solcodpais").toString())); + direccion.setLcantones(new ArrayList()); + direccion.setLparroquias(new ArrayList()); + direccion.setLcities(new ArrayList()); + } + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvincia() { + if (direccion.getMfilelds().get("solcodpais") != null && StringUtils.isNotBlank(direccion.getMfilelds().get("solcodpais").toString())) { + direccion.setLcantones(CantonController.find(direccion.getMfilelds().get("solcodpais").toString(), direccion.getMfilelds().get("solcodprovincia").toString())); + direccion.setLparroquias(new ArrayList()); + direccion.setLcities(new ArrayList()); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton() { + if (direccion.getMfilelds().get("solcodpais") != null && StringUtils.isNotBlank(direccion.getMfilelds().get("solcodpais").toString())) { + direccion.setLparroquias(ParroquiaController.find(direccion.getMfilelds().get("solcodpais").toString(), direccion.getMfilelds().get("solcodprovincia").toString(), direccion.getMfilelds().get("solcodcanton").toString())); + direccion.setLcities(CityController.find(direccion.getMfilelds().get("solcodpais").toString(), direccion.getMfilelds().get("solcodprovincia").toString(), direccion.getMfilelds().get("solcodcanton").toString())); + } + } + + /** + * Cambio la provincia de origen + */ + public void cambioProvinciasOrigen() { + if (solicitud.getRecord().getCprovinciaorigen() != null) { + this.lcantonOrigen = CantonController.find("EC", solicitud.getRecord().getCprovinciaorigen()); + this.solicitud.getRecord().setCpaisorigen("EC"); + } else { + this.lcantonOrigen.clear(); + this.solicitud.getRecord().setCpaisorigen(null); + } + } + + /** + * Cambio la provincia destino + */ + public void cambioProvinciaDestino() { + if (solicitud.getRecord().getCprovinciadestino() != null) { + this.lcantonDestino = CantonController.find("EC", solicitud.getRecord().getCprovinciadestino()); + this.solicitud.getRecord().setCpaisdestino("EC"); + } else { + this.lcantonDestino.clear(); + this.solicitud.getRecord().setCpaisdestino(null); + } + } + + /** + * Metodo que genera el reporte + * + * @param fila + */ + public void imprimir() { + boolean flagArmas = false; + boolean flagGuardias = false; + boolean flagAgencia = false; + + if (tarmTramite == null) { + MessageHelper.setMessageError("ERROR NO MANEJADO POR LA APLICACION CONTACTE AL PROVEEDOR"); + return; + } + if (tarmTramite.getRegistroguardia().equalsIgnoreCase("Y")) { + flagGuardias = true; + } + if (tarmTramite.getRegistroarmas().equalsIgnoreCase("Y")) { + flagArmas = true; + } + if (tarmTramite.getRegistroagenciasucursal().equalsIgnoreCase("Y")) { + flagAgencia = true; + } + this.reporteGeneral(csolicitud, flagAgencia, flagArmas, flagGuardias); + + FacesContext context = FacesContext.getCurrentInstance(); + context.addMessage(null, new FacesMessage("RECUERDE", MsgControlArmas.getProperty("msg_recuerdeClickContinuarTramite"))); + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + String institucionCentroControl = ""; + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetailUsuario.getPk().getPersoncode().toString()); + //cprovincia=tcustPersonAddres.getProvincecode(); + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + this.centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + this.nombreInstitucion = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + institucionCentroControl = this.nombreInstitucion; + + return institucionCentroControl; + } + + /** + * Obtiene el responsable del Centro de Control + */ + public void obtenerResponsableCentroControl() { + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + + } + + public TarmCentroControl obtenerCentro() { + for (TarmCentroControl centro : this.centroControlList) { + if (this.solicitud.getRecord().getCcentrocontrol().equals(centro.getPk())) { + return centro; + } + } + return null; + } + + public void reporteGeneral(String solicitud, boolean flagAgencia, boolean flagArmas, boolean flagGuardias) { + try { + querydatabase(); + String gradoUsuario = ""; + String path = "armas/reports/generalReport"; + String filename = "Solicitud"; + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if (grado != null) { + gradoUsuario = grado.getDescription() + " - " + this.responsableCentroControl.getName(); + } else { + gradoUsuario = "Sin Grado - " + this.responsableCentroControl.getName(); + } + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("csolicitud", solicitud); + + //Obteniendo la solicitud + TarmSolicitud s = SolicitudController.findSolicitudxcodsolicitud(solicitud); + TarmTramite t; + Boolean datosTramiteVacios = false; + + // + if (this.obtenerCentro() != null) { + parameters.put("centroControl", this.obtenerCentro().modifiedData().get("desnombreinstitucion")); + } + + if (s != null) { + //Obteniendo el tramite + t = TarmTramiteController.find(s.getCtramite().toString()); + + //Obteniendo la solicitud trmite + TarmSolicitudTramite st = TarmSolicitudTramiteController.findPorCSolicitud(solicitud); + + if (t != null) { + + //No de solicitud + if (st != null) { + parameters.put("noSolicitud", s.getNumerosolicitud()); + } else { + parameters.put("noSolicitud", " "); + } + //No de tramite + if (st != null) { + parameters.put("noTramite", st.getNumerotramite()); + } else { + parameters.put("noTramite", " "); + } + + //Tipo de tramite + if (t.getModifiedData().get("tipotramite") != null) { + parameters.put("tipoTramite", t.getModifiedData().get("tipotramite")); + } else { + parameters.put("tipoTramite", " "); + } + + //Tipo de autorizacion + if (t.getModifiedData().get("tipoautorizacion") != null) { + parameters.put("tipoAutorizacion", t.getModifiedData().get("tipoautorizacion")); + } else { + parameters.put("tipoAutorizacion", " "); + } + + //Categoria + if (t.getModifiedData().get("categoria") != null) { + parameters.put("categoria", t.getModifiedData().get("categoria")); + } else { + parameters.put("categoria", " "); + } + + //Uso actividad + if (t.getModifiedData().get("usoactividad") != null) { + parameters.put("usoActividad", t.getModifiedData().get("usoactividad")); + } else { + parameters.put("usoActividad", " "); + } + + //Cabecera + if (t.getCabecera() != null) { + parameters.put("cabecera", t.getCabecera()); + } else { + parameters.put("cabecera", " "); + } + + } else { + datosTramiteVacios = true; + } + } else { + datosTramiteVacios = true; + } + + if (datosTramiteVacios) { + parameters.put("noTramite", " "); + parameters.put("tipoTramite", " "); + parameters.put("tipoAutorizacion", " "); + parameters.put("categoria", " "); + parameters.put("usoActividad", " "); + parameters.put("cabecera", " "); + } + + //Obteniendo la direccion + String email = " ", direccion = " "; + List direcciones = PersonAddressController.findAllByPersonCode(s.getPersoncode().toString()); + for (TcustPersonAddress d : direcciones) { + Calendar calendario = Calendar.getInstance(); + calendario.setTime(d.getPk().getDateto()); + if (calendario.get(Calendar.YEAR) == 2999) { + if (d.getAddresstypecatalog().equalsIgnoreCase("3")) { + email = d.getAddress(); + } else if (d.getPrincipal() != null && d.getPrincipal().equalsIgnoreCase("Y")) { + direccion = d.getAddress(); + } + } + } + + //Email + parameters.put("email", email); + + //Direccion + parameters.put("direccion", direccion); + + //Actividad Economica + TcustPersonDetail person = PersonDetailController.find(s.getPersoncode().toString()); + if (person != null && person.getEconimicact() != null) { + parameters.put("actividadeco", person.getEconimicact()); + } else { + parameters.put("actividadeco", ""); + } + + //Fecha + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + parameters.put("flagAgencia", flagAgencia); + parameters.put("flagArmas", flagArmas); + parameters.put("flagGuardias", flagGuardias); + //parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("usuario", PersonDetailController.find(this.tsafeUserDetailUsuario.getPk().getPersoncode().toString()).getName()); + parameters.put("codResponsable", this.responsableCentroControl.getPk().getPersoncode()); + + parameters.put("codigoQR", (s != null ? s.getNumerosolicitud() : solicitud) + " " + sdf.format(Calendar.getInstance().getTime()) + " " + + gradoUsuario + " " + this.nombreInstitucion); + + String format = "pdf"; + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Abre el LOV de busqueda de importaciones por codigo solicitud (AUCP) + */ + public void openCargaPrevia() { + Map> params = new HashMap<>(); + List lPersoncodeParam = new ArrayList<>(); + lPersoncodeParam.add(detallepersona.getRecord().getPk().getPersoncode().toString()); + params.put("personcode", lPersoncodeParam); + CargasLovController.openLov(params); + } + + /** + * Regresa del LOV de carga + * + * @param event + */ + public void onReturnCarga(SelectEvent event) { + TarmCarga carga = (TarmCarga) event.getObject(); + filterAUCP = carga.getAucp(); + solicitud.getRecord().setAucp(filterAUCP); + TarmRegistroArmas registro = RegistroArmController.findByCodigo(carga.getCregistro().toString()); + armas.setLrecord(ArmasController.findxRegistro(registro.getPk().toString())); + if (armas.getLrecord() == null) { + armas.setLrecord(new ArrayList()); + } + } + + /** + * Método que valida la persona vendedora en las tablas de maia y en + * la snap + * + */ + public void validarVendedor() { + tcustPersonDetailVendedor = null; + if (selecionaCodigoVendedor == null) { + MessageHelper.setMessageError("Seleccione el vendedor"); + return; + } + tcustPersonDetailVendedor = PersonDetailController.find(selecionaCodigoVendedor.toString()); + solicitud.getRecord().setNumerodocumentoorigen(tcustPersonDetailVendedor.getIdentification()); + solicitud.getRecord().setTipodocumentoorigen(tcustPersonDetailVendedor.getIdentificationcatalog()); + solicitud.getRecord().setNombrerazonsocialorigen(tcustPersonDetailVendedor.getName()); + /* + if(solicitud.getRecord().getNumerodocumentoorigen()==null || solicitud.getRecord().getTipodocumentoorigen()==null){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_seleccioneeltipodedocumentooingreselacedulavendedor")); + return; + } + if(solicitud.getRecord().getTipodocumentoorigen().equals(codigoCedula)){ + //----------validamos si es valida la CEDULA + if(!ValidateIdentification.cedula(solicitud.getRecord().getNumerodocumentoorigen())){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalidovendedor")); + return; + } + //envia a buscar en MAIA + tcustPersonDetailVendedor=buscarPersonaMaia(solicitud.getRecord().getNumerodocumentoorigen(),solicitud.getRecord().getTipodocumentoorigen()); + if(tcustPersonDetailVendedor==null){ + //envia a buscar en la SNAP + tcustPersonDetailVendedor=buscarPersonaSnap(solicitud.getRecord().getNumerodocumentoorigen(),solicitud.getRecord().getTipodocumentoorigen()); + } + }else if(solicitud.getRecord().getTipodocumentoorigen().equals(codigoRuc)){ + //----------validamos si es valida el RUC + if(!ValidateIdentification.ruc(solicitud.getRecord().getNumerodocumentoorigen())){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_nodocumentoinvalidovendedor")); + return; + } + //envia a buscar en maia + tcustPersonDetailVendedor=buscarPersonaMaia(solicitud.getRecord().getNumerodocumentoorigen(),solicitud.getRecord().getTipodocumentoorigen()); + if(tcustPersonDetailVendedor==null){ + //envia a buscar en la snap + tcustPersonDetailVendedor=buscarPersonaSnap(solicitud.getRecord().getNumerodocumentoorigen(),solicitud.getRecord().getTipodocumentoorigen()); + } + }else{ + //----------si es PASAPORTE + tcustPersonDetailVendedor=buscarPersonaMaia(solicitud.getRecord().getNumerodocumentoorigen(),solicitud.getRecord().getTipodocumentoorigen()); + if(tcustPersonDetailVendedor==null){ + MessageHelper.setMessageInfo(MsgControlArmas.getProperty("mg_error_usuarionoencontradovendedor")); + tcustPersonDetailVendedor= new TcustPersonDetail(); + tcustPersonDetailVendedor.setIdentification(solicitud.getRecord().getNumerodocumentoorigen()); + tcustPersonDetailVendedor.setIdentificationcatalog(solicitud.getRecord().getTipodocumentoorigen()); + tcustPersonDetailVendedor.setIdentificationcatalogcode("IDENTIFICATION"); + tcustPersonDetailVendedor.setName(solicitud.getRecord().getNombrerazonsocialorigen()); + //solicitud.getRecord().setNombrerazonsocialorigen(null); + } + } + //validamos que existe la persona en Maia o SNAP + if(tcustPersonDetailVendedor!=null && tcustPersonDetailVendedor.getIdentification()!=null && tcustPersonDetailVendedor.getName()!=null){ + //seteamos el nombre para visualizarle + solicitud.getRecord().setNombrerazonsocialorigen(tcustPersonDetailVendedor.getName()); + }else if(!solicitud.getRecord().getTipodocumentoorigen().equals(codigoPasaporte)){ + MessageHelper.setMessageError(MsgControlArmas.getProperty("mg_error_usuarionoencontradovendedor")); + tcustPersonDetailVendedor= new TcustPersonDetail(); + solicitud.getRecord().setNombrerazonsocialorigen(null); + } + */ + } + + /** + * Método para validar si la persona existe en la BD de Maia + * + * @param numeroDocumento + * @param tipoDocumento + * @return TcustPersonDetail + */ + public TcustPersonDetail buscarPersonaMaia(String numeroDocumento, String tipoDocumento) { + return PersonDetailController.findxidentification(numeroDocumento, tipoDocumento); + } + /** ============================= buscar EstadoTramite =============================*/ + + /** + * Método para obtener los codigos + */ + public String codigos(String parametro) { + TgeneParameters tgeneParameters = ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + /** + * Método para buscar a la persona en la snap + * + * @param documento + */ + /** ================= GENERAR SQL =================== */ + + public TcustPersonDetail buscarPersonaSnap(String documento, String tipoDocumento) { + if (tipoDocumento.equals(codigoCedula)) { + Cedula cedula = ClienteCedula.obtenerCedula(documento); + if (cedula != null) { + TcustPersonDetail detail = new TcustPersonDetail(); + detail.setName(cedula.getNombre()); + detail.setIdentification(cedula.getCedula()); + detail.setIdentificationcatalog("CED"); + detail.setIdentificationcatalogcode("IDENTIFICATION"); + return detail; + } else { + return null; + } + } else { + Contribuyente contribuyente = ClienteRUC.obtenerRUC(documento); + if (contribuyente != null) { + TcustPersonDetail detail = new TcustPersonDetail(); + detail.setName(contribuyente.getRazonSocial()); + detail.setIdentification(contribuyente.getNumeroRuc()); + detail.setIdentificationcatalog("RUC"); + detail.setIdentificationcatalogcode("IDENTIFICATION"); + return detail; + } else { + return null; + } + } + } + + /** + * Entrega el valor de: ltipopersona + * + * @return List + */ + public List getLtipopersona() { + return ltipopersona; + } + + /** + * Entrega el valor de: ltipoidenti + * + * @return List + */ + public List getLtipoidenti() { + return ltipoidenti; + } + + /************** AGREGADOS PARA EL TIPO DE PAGO ************ */ + public List getLtipopago() { + return ltipopago; + } + + public void setLtipopago(List ltipopago) { + this.ltipopago = ltipopago; + } + + + + + /** + * Entrega el valor de: ltipotramite + * + * @return List + */ + public List getLtipotramite() { + return ltipotramite; + } + + /** + * Entrega el valor de: longitudid + * + * @return Integer + */ + public Integer getLongitudid() { + return longitudid; + } + + /** + * Entrega el valor de: activarRegExIdentificacion + * + * @return boolean + */ + public boolean isActivarRegExIdentificacion() { + return activarRegExIdentificacion; + } + + /** + * Entrega el valor de: solicitud + * + * @return SolicitudArmasController + */ + public SolicitudArmasController getSolicitud() { + return solicitud; + } + + /** + * Fija el valor de: solicitud + * + * @param solicitud Valor a fijar en el atributo. + */ + public void setSolicitud(SolicitudArmasController solicitud) { + this.solicitud = solicitud; + } + + /** + * Entrega el valor de: detallepersona + * + * @return PersonDetailController + */ + public PersonDetailController getDetallepersona() { + return detallepersona; + } + + /** + * Fija el valor de: detallepersona + * + * @param detallepersona Valor a fijar en el atributo. + */ + public void setDetallepersona(PersonDetailController detallepersona) { + this.detallepersona = detallepersona; + } + + /** + * Entrega el valor de: natural + * + * @return PeopleController + */ + public PeopleController getNatural() { + return natural; + } + + /** + * Fija el valor de: natural + * + * @param natural Valor a fijar en el atributo. + */ + public void setNatural(PeopleController natural) { + this.natural = natural; + } + + /** + * Entrega el valor de: direccion + * + * @return PersonAddressController + */ + public PersonAddressController getDireccion() { + return direccion; + } + + /** + * Fija el valor de: direccion + * + * @param direccion Valor a fijar en el atributo. + */ + public void setDireccion(PersonAddressController direccion) { + this.direccion = direccion; + } + + /** + * Entrega el valor de: telefono + * + * @return PersonPhoneController + */ + public PersonPhoneController getTelefono() { + return telefono; + } + + /** + * Fija el valor de: telefono + * + * @param telefono Valor a fijar en el atributo. + */ + public void setTelefono(PersonPhoneController telefono) { + this.telefono = telefono; + } + + /** + * Entrega el valor de: requisitos + * + * @return SolicitudRequisitosController + */ + public SolicitudRequisitosController getRequisitos() { + return requisitos; + } + + /** + * Fija el valor de: requisitos + * + * @param requisitos Valor a fijar en el atributo. + */ + public void setRequisitos(SolicitudRequisitosController requisitos) { + this.requisitos = requisitos; + } + + /** + * Entrega el valor de: flujoiniciado + * + * @return boolean + */ + public boolean isFlujoiniciado() { + return flujoiniciado; + } + + /** + * Entrega el valor de: ocultarBotonInicioFlujo + * + * @return boolean + */ + public boolean isOcultarBotonInicioFlujo() { + return ocultarBotonInicioFlujo; + } + + /** + * Fija el valor de: ocultarBotonInicioFlujo + * + * @param ocultarBotonInicioFlujo Valor a fijar en el atributo. + */ + public void setOcultarBotonInicioFlujo(boolean ocultarBotonInicioFlujo) { + this.ocultarBotonInicioFlujo = ocultarBotonInicioFlujo; + } + + /** + * Entrega el valor de: esaprobacion + * + * @return boolean + */ + public boolean isEsaprobacion() { + return esaprobacion; + } + + public LoginController getLogin() { + return login; + } + + public void setLogin(LoginController login) { + this.login = login; + } + + public UserDetailController getDetalleusuario() { + return detalleusuario; + } + + public void setDetalleusuario(UserDetailController detalleusuario) { + this.detalleusuario = detalleusuario; + } + + public List getLorigenadquisicion() { + return lorigenadquisicion; + } + + public void setLorigenadquisicion(List lorigenadquisicion) { + this.lorigenadquisicion = lorigenadquisicion; + } + + public boolean isIngresarRequisitos() { + return ingresarRequisitos; + } + + public void setIngresarRequisitos(boolean ingresarRequisitos) { + this.ingresarRequisitos = ingresarRequisitos; + } + + public boolean isSeleccionarArmas() { + return seleccionarArmas; + } + + public void setSeleccionarArmas(boolean seleccionarArmas) { + this.seleccionarArmas = seleccionarArmas; + } + + public boolean isSeleccionarGuardias() { + return seleccionarGuardias; + } + + public void setSeleccionarGuardias(boolean seleccionarGuardias) { + this.seleccionarGuardias = seleccionarGuardias; + } + + public boolean isSeleccionarAgencias() { + return seleccionarAgencias; + } + + public void setSeleccionarAgencias(boolean seleccionarAgencias) { + this.seleccionarAgencias = seleccionarAgencias; + } + + public boolean isListarDocumentos() { + return listarDocumentos; + } + + public void setListarDocumentos(boolean listarDocumentos) { + this.listarDocumentos = listarDocumentos; + } + + public RequisitoPorTramiteController getRequisitoPorTramite() { + return requisitoPorTramite; + } + + public void setRequisitoPorTramite( + RequisitoPorTramiteController requisitoPorTramite) { + this.requisitoPorTramite = requisitoPorTramite; + } + + public GuardiasController getGuardias() { + return guardias; + } + + public void setGuardias(GuardiasController guardias) { + this.guardias = guardias; + } + + public SolicitudGuardiasController getSolicitudGuardias() { + return solicitudGuardias; + } + + public void setSolicitudGuardias(SolicitudGuardiasController solicitudGuardias) { + this.solicitudGuardias = solicitudGuardias; + } + + public ArmasController getArmas() { + return armas; + } + + public void setArmas(ArmasController armas) { + this.armas = armas; + } + + public RegistroArmController getRegistroArmas() { + return registroArmas; + } + + public void setRegistroArmas(RegistroArmController registroArmas) { + this.registroArmas = registroArmas; + } + + public AgenciaSucursalController getAgenciaSucursal() { + return agenciaSucursal; + } + + public void setAgenciaSucursal(AgenciaSucursalController agenciaSucursal) { + this.agenciaSucursal = agenciaSucursal; + } + + public RecepcionArmasController getSolicitudArmas() { + return solicitudArmas; + } + + public void setSolicitudArmas(RecepcionArmasController solicitudArmas) { + this.solicitudArmas = solicitudArmas; + } + + public SolicitudAgenciaSucursalController getSolicitudAgenciaSucursal() { + return solicitudAgenciaSucursal; + } + + public void setSolicitudAgenciaSucursal( + SolicitudAgenciaSucursalController solicitudAgenciaSucursal) { + this.solicitudAgenciaSucursal = solicitudAgenciaSucursal; + } + + public TarmSolicitudDocumentoController getSolicitudDocumento() { + return solicitudDocumento; + } + + public void setSolicitudDocumento( + TarmSolicitudDocumentoController solicitudDocumento) { + this.solicitudDocumento = solicitudDocumento; + } + + public DocumentoHabilitanteController getDocumentoHabilitante() { + return documentoHabilitante; + } + + public void setDocumentoHabilitante( + DocumentoHabilitanteController documentoHabilitante) { + this.documentoHabilitante = documentoHabilitante; + } + + public Date getFechaActual() { + return fechaActual; + } + + public void setFechaActual(Date fechaActual) { + this.fechaActual = fechaActual; + } + + public boolean isDeshabilitarPantalla() { + return deshabilitarPantalla; + } + + public void setDeshabilitarPantalla(boolean deshabilitarPantalla) { + this.deshabilitarPantalla = deshabilitarPantalla; + } + + public boolean isMostrarIngresoArmas() { + return mostrarIngresoArmas; + } + + public void setMostrarIngresoArmas(boolean mostrarIngresoArmas) { + this.mostrarIngresoArmas = mostrarIngresoArmas; + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public Boolean getIsEnableGrabar() { + return isEnableGrabar; + } + + public void setIsEnableGrabar(Boolean isEnableGrabar) { + this.isEnableGrabar = isEnableGrabar; + } + + public boolean isActualizaDatosGenerales() { + return actualizaDatosGenerales; + } + + public void setActualizaDatosGenerales(boolean actualizaDatosGenerales) { + this.actualizaDatosGenerales = actualizaDatosGenerales; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public boolean isGuiaLibreTransito() { + return guiaLibreTransito; + } + + public void setGuiaLibreTransito(boolean guiaLibreTransito) { + this.guiaLibreTransito = guiaLibreTransito; + } + + public EvaluacionController getEvaluacionController() { + return evaluacionController; + } + + public void setEvaluacionController(EvaluacionController evaluacionController) { + this.evaluacionController = evaluacionController; + } + + public AgenciaArmaController getAgenciaArma() { + return agenciaArma; + } + + public void setAgenciaArma(AgenciaArmaController agenciaArma) { + this.agenciaArma = agenciaArma; + } + + public List getLprovincias() { + return lprovincias; + } + + public void setLprovincias(List lprovincias) { + this.lprovincias = lprovincias; + } + + public List getLcantonOrigen() { + return lcantonOrigen; + } + + public void setLcantonOrigen(List lcantonOrigen) { + this.lcantonOrigen = lcantonOrigen; + } + + public List getLcantonDestino() { + return lcantonDestino; + } + + public void setLcantonDestino(List lcantonDestino) { + this.lcantonDestino = lcantonDestino; + } + + public List getCentroControlList() { + return centroControlList; + } + + public void setCentroControlList(List centroControlList) { + this.centroControlList = centroControlList; + } + + public List getTipoDocumento() { + return tipoDocumento; + } + + public void setTipoDocumento(List tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } + + public Boolean getMostrarFiltroAUCP() { + return mostrarFiltroAUCP; + } + + public void setMostrarFiltroAUCP(Boolean mostrarFiltroAUCP) { + this.mostrarFiltroAUCP = mostrarFiltroAUCP; + } + + public String getFilterAUCP() { + return filterAUCP; + } + + public void setFilterAUCP(String filterAUCP) { + this.filterAUCP = filterAUCP; + } + + public CargaController getCargaController() { + return cargaController; + } + + public void setCargaController(CargaController cargaController) { + this.cargaController = cargaController; + } + + public Set getListaPersonasDetailVen() { + return listaPersonasDetailVen; + } + + public void setListaPersonasDetailVen( + Set listaPersonasDetailVen) { + this.listaPersonasDetailVen = listaPersonasDetailVen; + } + + public Integer getSelecionaCodigoVendedor() { + return selecionaCodigoVendedor; + } + + public void setSelecionaCodigoVendedor(Integer selecionaCodigoVendedor) { + this.selecionaCodigoVendedor = selecionaCodigoVendedor; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/TransaccionArmaBodegaController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/TransaccionArmaBodegaController.java new file mode 100644 index 0000000..f896e0c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/TransaccionArmaBodegaController.java @@ -0,0 +1,146 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmTransaccionArmaBodega; + +/** + * Clase controladora del bean TarmTransaccionArmaBodega. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class TransaccionArmaBodegaController extends AbstractController { + + public TransaccionArmaBodegaController() throws Exception { + super(TarmTransaccionArmaBodega.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TRANSACCIONARMABODEGA"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + SubQuery subqueryCentroControlOrig = new SubQuery("TgeneCatalogDetail", "description", "nombreinstitucionorig", + "i.pk.catalog= (select o.nombreinstitucion from TarmCentroControl o where o.pk=t.ccentrocontrolorigen)" + + " and i.pk.catalogcode=(select o.nombreinstitucioncodigo from TarmCentroControl o where o.pk=t.ccentrocontrolorigen)"); + dto.addSubQuery(subqueryCentroControlOrig); + + SubQuery subqueryCentroControlDest = new SubQuery("TgeneCatalogDetail", "description", "nombreinstituciondest", + "i.pk.catalog= (select o.nombreinstitucion from TarmCentroControl o where o.pk=t.ccentrocontroldestino)" + + " and i.pk.catalogcode=(select o.nombreinstitucioncodigo from TarmCentroControl o where o.pk=t.ccentrocontroldestino)"); + dto.addSubQuery(subqueryCentroControlDest); + + SubQuery subqueryPaisDes = new SubQuery("TarmCentroControl", "provincecode", "provincecodeorig", "i.pk=t.ccentrocontrolorigen"); + dto.addSubQuery(subqueryPaisDes); + + SubQuery subqueryNombreinstitucion = new SubQuery("TarmCentroControl", "nombreinstitucion", "nombreinstitucion", "i.pk=t.ccentrocontrolorigen"); + dto.addSubQuery(subqueryNombreinstitucion); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * + * @param codigo + * @return + */ + public static TarmTransaccionArmaBodega find(String codigo) { + try { + TransaccionArmaBodegaController cc = new TransaccionArmaBodegaController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("cdecomisoarmatransaccion", codigo); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ValidacionTramiteLibreTransitoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ValidacionTramiteLibreTransitoController.java new file mode 100644 index 0000000..5bcec61 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ValidacionTramiteLibreTransitoController.java @@ -0,0 +1,795 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.general.mail.EnvioMail; +import com.fp.general.mail.dto.EnvioCorreoDTO; +import com.fp.general.mail.exception.EnvioMailException; +import com.fp.general.mail.factory.EnvioMailFactory; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ValidacionTramiteLibreTransitoController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 1L; + + TarmSolicitudTramite solicitudTramite = new TarmSolicitudTramite(); + TarmTramite tramite = new TarmTramite(); + TcustPersonDetail detallesPersona = new TcustPersonDetail(); + TarmSolicitudArmas solicitudArmas = new TarmSolicitudArmas(); + + private String provincia; + private String canton; + private String ciudad; + private TgeneParroquia parroquia; + private TcustPersonAddress direccionCliente; + String tipoDireccion = ""; + private List lArmas; + private String direccion; + private String estadoTramite; + private String tipoDocumento; + private String tipoTramite; + private String usoActividad; + private String observaciones = "Prueba observaciones"; + private String gradoFuncionario = ""; + private TcustPersonDetail usuario; + private String nombreInstitucion; + private TarmCentroControl centroControl; + private String csolicitud = ""; + private String opcion = ""; + private String numeroSolicitud; + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddressController; + + @ManagedProperty(value = "#{tarmSolicitudTramiteController}") + private TarmSolicitudTramiteController tarmSolicitudTramiteController; + + @ManagedProperty(value = "#{tarmSolicitudArmasController}") + private TarmSolicitudArmasController tarmSolicitudArmasController; + + public ValidacionTramiteLibreTransitoController() throws Exception { + super(TarmSolicitud.class); + } + + @PostConstruct + private void postconstruct() { + try { + startQuery(); + this.init(); + // Inicializa autoconsulta + super.getMfilters().clear(); + super.query(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + csolicitud = super.getMfilters().get("csolicitud"); + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "VALIDACIONTRANSITO"; + + // this.csolicitud="1"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @Override + public void query() throws Exception { + // TODO Auto-generated method stub + MessageHelper.setMessageError("msg_notQuery"); + super.query(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + + //Filtrando las armas + tarmSolicitudArmasController.setCsolicitud(csolicitud); + tarmSolicitudArmasController.getMfilters().clear(); + tarmSolicitudArmasController.query(); + + Filter filtro = new Filter("pk", csolicitud); + dto.addFiltro(filtro); + + SubQuery sNumeroTramite = new SubQuery("TarmSolicitudTramite", "numerotramite", "ntramite", "i.pk.csolicitud = t.pk"); + dto.addSubQuery(sNumeroTramite); + + SubQuery sEstadoSolicitud = new SubQuery("TarmSolicitudTramite", "numerotramite", "ntramite", "i.pk.csolicitud = t.pk"); + dto.addSubQuery(sEstadoSolicitud); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + + //Obteniendo la solicitud + TarmSolicitud solicitud = ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(this.csolicitud); + numeroSolicitud = solicitud.getNumerosolicitud(); + //Obteniendo el tramite + solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(record.getPk()); + + if (solicitudTramite != null && solicitudTramite.getPk().getCtramite() != null) { + tarmSolicitudTramiteController = new TarmSolicitudTramiteController(); + tarmSolicitudTramiteController.setRecord(solicitudTramite); + tramite = TarmTramiteController.find(solicitudTramite.getPk().getCtramite().toString()); + + //Estado tramite + TgeneCatalogDetail catalogDetailTramite = null; + if (solicitudTramite.getEstadotramite() != null && solicitudTramite.getEstadotramitecodigo() != null) { + catalogDetailTramite = CatalogDetailController.findxCodigoCodcatalogo(solicitudTramite.getEstadotramite(), solicitudTramite.getEstadotramitecodigo()); + } + + if (catalogDetailTramite != null) { + estadoTramite = catalogDetailTramite.getDescription(); + } + + //Tipo tramite + if (tramite.getTipotramite() != null && tramite.getTipotramitecodigo() != null) { + catalogDetailTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + + if (catalogDetailTramite != null) { + tipoTramite = catalogDetailTramite.getDescription(); + } + + //Uso actividad + catalogDetailTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + if (catalogDetailTramite != null && tramite.getUsoactividad() != null && tramite.getUsoactividadcodigo() != null) { + usoActividad = catalogDetailTramite.getDescription(); + } + } + } + + //Datos de la persona + detallesPersona = PersonDetailController.find(String.valueOf(record.getPersoncode().toString())); + switch (detallesPersona.getIdentificationcatalog()) { + case "CED": + tipoDireccion = "1"; + break; + case "RUC": + tipoDireccion = "2"; + break; + default: + tipoDireccion = ""; + break; + } + + //Tipo de documento + TgeneCatalogDetail catalogDetailDocumento = null; + if (detallesPersona.getIdentificationcatalog() != null && detallesPersona.getIdentificationcatalogcode() != null) { + catalogDetailDocumento = CatalogDetailController.findxCodigoCodcatalogo(detallesPersona.getIdentificationcatalog(), detallesPersona.getIdentificationcatalogcode()); + + if (catalogDetailDocumento != null) { + tipoDocumento = catalogDetailDocumento.getDescription(); + } + } + + //Obteniendo la direccion del cliente + //this.direccionCliente=personAddressController.findPersonaPorDireccionTipoCatalogo(String.valueOf(record.getPersoncode()), tipoDireccion); + this.direccionCliente = personAddressController.findPrincipal(String.valueOf(record.getPersoncode())); + provincia = direccionCliente.modifiedData().get("provincia") == null ? null : direccionCliente.modifiedData().get("provincia").toString(); //personAddressController.getLprovinces()==null || personAddressController.getLprovinces().isEmpty()?null:personAddressController.getLprovinces().get(0); + canton = direccionCliente.modifiedData().get("canton") == null ? null : direccionCliente.modifiedData().get("canton").toString();//personAddressController.getLcantones()==null || personAddressController.getLcantones().isEmpty()?null:personAddressController.getLcantones().get(0); + ciudad = direccionCliente.modifiedData().get("ciudad") == null ? null : direccionCliente.modifiedData().get("ciudad").toString();//personAddressController.getLcities()==null || personAddressController.getLcities().isEmpty()?null:personAddressController.getLcities().get(0); + direccion = direccionCliente.getAddress(); + + //Obteniendo las armas + lArmas = new ArrayList(); + List listaSolicitudArmas = TarmSolicitudArmasController.findPorCSolicitud(record.getPk()); + + for (TarmSolicitudArmas sa : listaSolicitudArmas) { + TarmArmas arma = ArmasController.find(sa.getPk().getCarma(), "REG"); + lArmas.add(arma); + } + + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + //Obteniendo el grado del funcionario + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(usuario.getMilitarygrade(), usuario.getMilitarygradecode()); + if (grado != null) { + gradoFuncionario = grado.getDescription() + " - "; + } + + //Obteniendo el centro de control + centroControl = CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + if (centroControl != null && centroControl.getNombreinstitucion() != null && !centroControl.getNombreinstitucion().isEmpty() + && centroControl.getNombreinstitucioncodigo() != null && !centroControl.getNombreinstitucioncodigo().isEmpty()) { + + TgeneCatalogDetail catalogoInstitucion = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()); + this.nombreInstitucion = catalogoInstitucion.getDescription(); + } + + } + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaseSolicitud() { + try { + DtoQuery dto = super.getDtoQuery(true); + + SubQuery sNumeroTramite = new SubQuery("TarmSolicitudTramite", "numerotramite", "ntramite", "i.pk.csolicitud = t.pk"); + dto.addSubQuery(sNumeroTramite); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + //Aqui se le cambia el estado a TarmSolicitudTramite + //segun se apruebe o se anule + /* + if(condicionAprobado){ + this.tarmSolicitudTramiteController.cambiarEstado(estadoTramiteAprobado, estadoTramiteAprobadoCodigo); + }else{ + this.tarmSolicitudTramiteController.cambiarEstado(estadoTramiteAnulado, estadoTramiteAnuladoCodigo); + }*/ + DtoSave dtosaveSolicitudTramite = this.tarmSolicitudTramiteController.getDtoSave(); + if (dtosaveSolicitudTramite.pendingProcess()) { + dtosaveSolicitudTramite.setReturnpk(true); + msave.put(this.tarmSolicitudTramiteController.getBeanalias(), dtosaveSolicitudTramite); + } + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.tarmSolicitudTramiteController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Metodo que envia un mail de notificacion de tramite anulado + */ + public void enviarNotificacion() { + try { + if (this.opcion != null && !this.opcion.isEmpty() && this.opcion.equalsIgnoreCase("D")) { + String asunto = MsgControlArmas.getProperty("msg_asuntoNotificacionGuiaTranistoAnulada"); + String cuerpo = MessageFormat.format(MsgControlArmas.getProperty("msg_cuerpoNotificacionGuiaTransitoAnulada"), detallesPersona.getName(), + this.record.getModifiedData().get("ntramite"), this.observaciones, this.gradoFuncionario + usuario.getName(), this.nombreInstitucion); + + EnvioCorreoDTO envioCorreo = new EnvioCorreoDTO(); + envioCorreo.setCorreoDesde(MsgControlArmas.getProperty("correoDesde")); + //Cambiar por el correo del cliente + envioCorreo.setCorreoPara(new String[]{MsgControlArmas.getProperty("correoDestino")}); + envioCorreo.setAsunto(asunto); + envioCorreo.setMensajeHTML(cuerpo); + EnvioMail envioMail = EnvioMailFactory.getInstancia(); + envioMail.envioMail(envioCorreo); + + } + completarTarea(); + } catch (EnvioMailException e) { + MessageHelper.setMessageError(new Throwable("Se produjo un error al enviar el correo.")); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("csolicitud", csolicitud); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + if (bpmDataStatus != null && bpmDataStatus.equals("D")) { + Map datosmail = new HashMap(); + datosmail.put("razons", detallesPersona.getName()); + datosmail.put("sol", numeroSolicitud); + datosmail.put("observaciones", bpmDataComment); + //grado funcionario de la persona logeada + TsafeUserDetail userDetailObj = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personDetailObj = PersonDetailController.find(userDetailObj.getPk().getPersoncode().toString()); + datosmail.put("grado", personDetailObj.getMilitarygrade()); + datosmail.put("funcionario", personDetailObj.getName()); + // Centro de control de armas + datosmail.put("centrocontrol", centroControl.getModifiedData().get("desinstitucion")); + request.modifiedData().put("datosmail", datosmail); + } + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Busca una solicitud por su codigo + * + * @param codigoSolicitud + * @return + */ + public static TarmSolicitud findPorSolicitud(String codigoSolicitud) { + try { + ValidacionTramiteLibreTransitoController cc = new ValidacionTramiteLibreTransitoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", codigoSolicitud); + cc.querydatabase(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Busca una solicitud por su codigo + * + * @param codigoSolicitud + * @return + */ + public static TarmSolicitud findPorSolicitudSimple(String codigoSolicitud) { + try { + ValidacionTramiteLibreTransitoController cc = new ValidacionTramiteLibreTransitoController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", codigoSolicitud); + cc.querydatabaseSolicitud(); + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Incrementa el numero del arma + * + * @param arma + * @return + */ + public int incrementarRowkey(TarmArmas arma) { + int n = 0; + + for (int i = 0; i < lArmas.size(); i++) { + if (arma.getPk() == lArmas.get(i).getPk()) { + n = i + 1; + break; + } + } + + return n; + } + + /** + * Obtiene los detalles de las armas segun el catalogo + * + * @param catalogo + * @param catalogoCode + * @return + */ + public String aspectoArmaCatalogo(String catalogo, String catalogoCode) { + if (catalogo != null && catalogoCode != null && !catalogo.isEmpty() && !catalogoCode.isEmpty()) { + return CatalogDetailController.findxCodigoCodcatalogo(catalogo, catalogoCode).getDescription(); + } + return null; + } + + /** + * Devuelve una descripcion de catalogo segun un tipo de aspecto + * + * @param arma + * @param tipoAspecto + * @return + */ + public String aspectoArmaExplosivoCatalogo(TarmArmas arma, String tipoAspecto) { + String aspecto = ""; + + try { + TarmTipoArmaExplosivo explosivo = TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo()); + if (explosivo != null) { + if (tipoAspecto.equalsIgnoreCase("clase") && explosivo.getClase() != null && !explosivo.getClase().isEmpty() + && explosivo.getClasecodigo() != null && !explosivo.getClasecodigo().isEmpty()) { + aspecto = CatalogDetailController.findxCodigoCodcatalogo(explosivo.getClase(), explosivo.getClasecodigo()).getDescription(); + + } else if (tipoAspecto.equalsIgnoreCase("tipo") && explosivo.getTipoarmaexplosivo() != null && !explosivo.getTipoarmaexplosivo().isEmpty() + && explosivo.getTipoarmaexplosivocodigo() != null && !explosivo.getTipoarmaexplosivocodigo().isEmpty()) { + aspecto = CatalogDetailController.findxCodigoCodcatalogo(explosivo.getTipoarmaexplosivo(), explosivo.getTipoarmaexplosivocodigo()).getDescription(); + + } else if (tipoAspecto.equalsIgnoreCase("calibre") && explosivo.getCalibre() != null && !explosivo.getCalibre().isEmpty() + && explosivo.getCalibrecodigo() != null && !explosivo.getCalibrecodigo().isEmpty()) { + aspecto = CatalogDetailController.findxCodigoCodcatalogo(explosivo.getCalibre(), explosivo.getCalibrecodigo()).getDescription(); + } + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + return aspecto; + } + + public TarmTipoArmaExplosivo explosivoPorArma(TarmArmas arma) { + TarmTipoArmaExplosivo explosivo = new TarmTipoArmaExplosivo(); + + try { + explosivo = TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo()); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + return explosivo; + } + + public TarmSolicitudTramite getSolicitudTramite() { + return solicitudTramite; + } + + public void setSolicitudTramite(TarmSolicitudTramite solicitudTramite) { + this.solicitudTramite = solicitudTramite; + } + + public TarmTramite getTramite() { + return tramite; + } + + public void setTramite(TarmTramite tramite) { + this.tramite = tramite; + } + + public TcustPersonDetail getDetallesPersona() { + return detallesPersona; + } + + public void setDetallesPersona(TcustPersonDetail detallesPersona) { + this.detallesPersona = detallesPersona; + } + + public String getProvincia() { + return provincia; + } + + public void setProvincia(String provincia) { + this.provincia = provincia; + } + + public String getCanton() { + return canton; + } + + public void setCanton(String canton) { + this.canton = canton; + } + + public String getCiudad() { + return ciudad; + } + + public void setCiudad(String ciudad) { + this.ciudad = ciudad; + } + + public String getNumeroSolicitud() { + return numeroSolicitud; + } + + public void setNumeroSolicitud(String numeroSolicitud) { + this.numeroSolicitud = numeroSolicitud; + } + + public List getlArmas() { + return lArmas; + } + + public void setlArmas(List lArmas) { + this.lArmas = lArmas; + } + + public PersonAddressController getPersonAddressController() { + return personAddressController; + } + + public void setPersonAddressController( + PersonAddressController personAddressController) { + this.personAddressController = personAddressController; + } + + public TarmSolicitudArmas getSolicitudArmas() { + return solicitudArmas; + } + + public void setSolicitudArmas(TarmSolicitudArmas solicitudArmas) { + this.solicitudArmas = solicitudArmas; + } + + public String getDireccion() { + return direccion; + } + + public void setDireccion(String direccion) { + this.direccion = direccion; + } + + public String getEstadoTramite() { + return estadoTramite; + } + + public void setEstadoTramite(String estadoTramite) { + this.estadoTramite = estadoTramite; + } + + public String getTipoDocumento() { + return tipoDocumento; + } + + public void setTipoDocumento(String tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } + + public String getTipoTramite() { + return tipoTramite; + } + + public void setTipoTramite(String tipoTramite) { + this.tipoTramite = tipoTramite; + } + + public String getUsoActividad() { + return usoActividad; + } + + public void setUsoActividad(String usoActividad) { + this.usoActividad = usoActividad; + } + + public TarmSolicitudTramiteController getTarmSolicitudTramiteController() { + return tarmSolicitudTramiteController; + } + + public void setTarmSolicitudTramiteController( + TarmSolicitudTramiteController tarmSolicitudTramiteController) { + this.tarmSolicitudTramiteController = tarmSolicitudTramiteController; + } + + public TarmSolicitudArmasController getTarmSolicitudArmasController() { + return tarmSolicitudArmasController; + } + + public void setTarmSolicitudArmasController( + TarmSolicitudArmasController tarmSolicitudArmasController) { + this.tarmSolicitudArmasController = tarmSolicitudArmasController; + } + + public TgeneParroquia getParroquia() { + return parroquia; + } + + public void setParroquia(TgeneParroquia parroquia) { + this.parroquia = parroquia; + } + + public TcustPersonAddress getDireccionCliente() { + return direccionCliente; + } + + public void setDireccionCliente(TcustPersonAddress direccionCliente) { + this.direccionCliente = direccionCliente; + } + + public String getTipoDireccion() { + return tipoDireccion; + } + + public void setTipoDireccion(String tipoDireccion) { + this.tipoDireccion = tipoDireccion; + } + + public String getObservaciones() { + return observaciones; + } + + public void setObservaciones(String observaciones) { + this.observaciones = observaciones; + } + + public String getGradoFuncionario() { + return gradoFuncionario; + } + + public void setGradoFuncionario(String gradoFuncionario) { + this.gradoFuncionario = gradoFuncionario; + } + + public TcustPersonDetail getUsuario() { + return usuario; + } + + public void setUsuario(TcustPersonDetail usuario) { + this.usuario = usuario; + } + + public String getNombreInstitucion() { + return nombreInstitucion; + } + + public void setNombreInstitucion(String nombreInstitucion) { + this.nombreInstitucion = nombreInstitucion; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public String getOpcion() { + return opcion; + } + + public void setOpcion(String opcion) { + this.opcion = opcion; + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ValidarDepositoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ValidarDepositoController.java new file mode 100644 index 0000000..2cb329c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/ValidarDepositoController.java @@ -0,0 +1,886 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.CargaController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.IngresoDatosTipoTramite; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.date.TgeneNotAccountingDayController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.ConvertNumberToText; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmAgenciaArma; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora para la validacion del deposito + * + * @author CHRISTIAN PAZMINO + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ValidarDepositoController extends AbstractController { + + /** + * Codigo de solicitud + */ + private String csolicitud; + /** + * Variable del tipo TgeneCatalogDetail(catalogo del tramite) + */ + private TgeneCatalogDetail nombreTramite; + /** + * Variable del tipo TgeneCatalogDetail(catalogo de la categoria) + */ + private TgeneCatalogDetail nombreCategoria; + /** + * Variable del tipo TgeneCatalogDetail(catalogo del uso actividad del + * tramite) + */ + private TgeneCatalogDetail nombreUsoActividad; + /** + * Opciones de aceptar o rechazar + */ + private List accionList; + /** + * Propiedad usada para el manejo del Alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + /** + * Propiedad usada para el manejo del numero de armas de la solicitud + */ + @ManagedProperty(value = "#{recepcionArmasController}") + private RecepcionArmasController recepcionArmasController; + /** + * Propiedad usada para el manejo del centro de control de armas + */ + @ManagedProperty(value = "#{centroControlArmasController}") + private CentroControlArmasController centroControlArmasController; + /** + * controlador de la solicitud + */ + @ManagedProperty(value = "#{solicitudArmasController}") + private SolicitudArmasController solicitudMP; + + /** + * Propiedad usada para el manejo de reportes + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + /** + * Controlador que maneja las armas asociadas a las agencias + */ + @ManagedProperty(value = "#{agenciaArmaController}") + private AgenciaArmaController agenciaArma; + + /** + * Controlador que maneja cargas para previa importacion + */ + @ManagedProperty(value = "#{cargaController}") + private CargaController cargaController; + + /** + * Propiedad usada para el manejo de la solicitud actual + */ + private TarmSolicitud solicitud; + /** + * Accion tomada por el usuario, aprobar o rechazar + */ + private String accionTomada; + /** + * Constante usada para referirse a la opcion general aprobar + */ + private final String APROBAR = "APR"; + /** + * Constante usada para referirse a la opcion general rechazar + */ + private final String REPROBAR = "RECH"; + /** + * Constante usada para referirse a la opcion aprobar deposito + */ + private final String APROBAR_DEPOSITO = "APBDEP"; + /** + * Constante usada para referirse a la opcion rechazar deposito + */ + private final String ANULAR_DEPOSITO = "ANUDEP"; + /** + * Propiedad usada para el manejo del tramite actual + */ + private TarmTramite tramite; + /** + * Fecha de atencion del proximo tramite + */ + private Date fechaAtencionTramite; + /** + * Variable que indica si el usuario esta negado para continuar en la + * pantalla + */ + private Boolean isDenied; + /** + * Variable auxiliar usada para diferenciar cuando se presenta o no el + * mensaje de validacion de fecha expiracion solicitud + */ + private Boolean isOnlyMsj; + /** + * Obtiene el centro d control de armas de la solicitud actual + */ + private TarmCentroControl centroControlObj; + /** + * Bandera de tipo booleano para indicar si se habilita el boton de + * completar tarea + */ + private Boolean isEnableCompletarTarea = Boolean.FALSE; + + /** + * Nombre del centro de control + */ + private String nombreCentroControl; + + private Boolean requiereNoSolAucpBln; + + private Boolean btnImprimir; + + public ValidarDepositoController() throws Exception { + super(TarmSolicitudTramite.class); + } + + @PostConstruct + private void postconstruct() { + super.startQuery(); + csolicitud = this.getMfilters().get("csolicitud"); + this.getMfilters().clear(); + init(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + this.beanalias = "VALIDARDEPOSITO"; + // Recuperamos el centro de control de armas correspondiente al solicitante + accionList = CatalogDetailController.find("ACCION"); + this.record = SolicitudTramiteController.findByCSolicitud(csolicitud); + isOnlyMsj = false; + btnImprimir = Boolean.FALSE; + requiereNoSolAucpBln = Boolean.FALSE; + try { + isDenied = true; + if (record != null) { + solicitud = SolicitudArmasController.find(csolicitud); + if (solicitud != null && solicitud.getCtramite() != null) { + + tramite = IngresoDatosTipoTramite.find(solicitud.getCtramite().toString()); + if (tramite != null) { + //Tramite + nombreTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoautorizacion(), tramite.getTipoautorizacioncodigo()); + nombreCategoria = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + nombreUsoActividad = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + if (tramite.getCategoria().equals("14")) { + requiereNoSolAucpBln = Boolean.TRUE; + } else { + requiereNoSolAucpBln = Boolean.FALSE; + } + } else { + MessageHelper.setMessageError("NO EXISTE UN TIPO DE TR\u00c1MITE ASOCIADO A LA SOLICITUD"); + return; + } + } else { + MessageHelper.setMessageError("NO EXISTE UNA SOLICITUD ASOCIADA AL TR\u00c1MITE"); + return; + } + //Obteniendo el centro de control +// TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); +// PersonAddressController direccion = new PersonAddressController(); +// TcustPersonAddress tcustPersonAddres= direccion.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); +// TarmCentroControlJur jurisdiccionCentroControl; +// jurisdiccionCentroControl= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControlObj = CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + this.setNombreCentroControl(CatalogDetailController.findxCodigoCodcatalogo(centroControlObj.getNombreinstitucion(), + centroControlObj.getNombreinstitucioncodigo()).getDescription()); + } else { + MessageHelper.setMessageError("NO EXISTE EL TR\u00c1MITE EN LA BASE DE DATOS"); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que devuelve el centro de control al que pertenece el cliente + * dueno de la solicitud + * + * @throws Exception + */ +// private String obtenerCentroControlSolicitante() throws Exception { +// PersonAddressController personAddressController = new PersonAddressController(); +// TcustPersonAddress tcustPersonAddres=personAddressController.findPrincipal(solicitud.getPersoncode().toString()); +// TarmCentroControlJur centroControlJur= TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); +// TarmCentroControl centroControl= CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); +// String institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo( centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); +// return institucionCentroControl; +// } + /** + * ? + */ + public void cancelar() { + init(); + } + + /** + * Genera la fecha disponible para el proximo tramite en el centro de + * control de armas respectivo + */ + public void generarFechaProximoTramite() { + try { + // Validamos si ya existe una fecha para realizar el proximo tramite + centroControlObj.isnew = false; + Date fechaActual = new Date(Calendar.getInstance().getTimeInMillis()); + if (centroControlObj.getFechaproximotramite() == null || centroControlObj.getFechaproximotramite().before(fechaActual)) { + fechaAtencionTramite = TgeneNotAccountingDayController.diasLaborablesPosterioresAUnaFecha(new Date(), 1); + } else { + fechaAtencionTramite = centroControlObj.getFechaproximotramite(); + } + // Numero de armas de la solicitud + List armasList = RecepcionArmasController.findPorSolicitud(csolicitud); + int numArmasSolicitud = armasList.size(); + int salvedad = 10; + int capacidadCentroUltDia = 0; + if (centroControlObj.getCuposlibresultimodia() != null) { + capacidadCentroUltDia = centroControlObj.getCuposlibresultimodia(); + } else { + capacidadCentroUltDia = centroControlObj.getTramitespordia(); + } + // Si la capacidad del centro en el ultimo dia es mayor al numero de armas a revisarse + if (numArmasSolicitud < capacidadCentroUltDia) { + centroControlObj.setCuposlibresultimodia(capacidadCentroUltDia - numArmasSolicitud); + centroControlArmasController.update(centroControlObj); + centroControlArmasController.save(); + + } else if ((numArmasSolicitud == capacidadCentroUltDia) || (numArmasSolicitud <= (capacidadCentroUltDia + salvedad))) { + // Si la capacidad del centro es igual al numero de armas a revisarse o ajusta cupo con la salvedad + centroControlObj.setCuposlibresultimodia(centroControlObj.getTramitespordia()); + Date newFechaAtencionTramite = TgeneNotAccountingDayController.diasLaborablesPosterioresAUnaFecha(fechaAtencionTramite, 1); + centroControlObj.setFechaproximotramite(new java.sql.Date(newFechaAtencionTramite.getTime())); + centroControlArmasController.update(centroControlObj); + centroControlArmasController.save(); + + } else { + // Cociente y residuo para los casos donde se tiene 50 armas o mas a tramitarse + int diasRequeridos = numArmasSolicitud / centroControlObj.getTramitespordia(); + // Requerido para el calculo de los cupos disponibles para el ultimo dia + int residuoDiasRequeridos = numArmasSolicitud % centroControlObj.getTramitespordia(); + fechaAtencionTramite = TgeneNotAccountingDayController.diasLaborablesPosterioresAUnaFecha(fechaAtencionTramite, 1); + Date newFechaAtencionTramite; + + centroControlObj.setCuposlibresultimodia(centroControlObj.getTramitespordia() - residuoDiasRequeridos); + newFechaAtencionTramite = TgeneNotAccountingDayController.diasLaborablesPosterioresAUnaFecha(fechaAtencionTramite, diasRequeridos); + + centroControlObj.setFechaproximotramite(new java.sql.Date(newFechaAtencionTramite.getTime())); + centroControlArmasController.update(centroControlObj); + centroControlArmasController.save(); + + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + + } + } + + /** + * Método para finalizar la tarea del flujo + */ + public void completarTarea() { + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("csolicitud", csolicitud); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + // Completar tarea en el flujo + Map datosmail = new HashMap(); + if (accionTomada.equalsIgnoreCase(APROBAR)) { + request.modifiedData().put("BPMStatus", "A"); + if (tramite != null && tramite.getTipotramite() != null) { + // En el caso de permisos enviamos una notificacion al cliente con algunos parametros adicionales + if (tramite.getTipoautorizacion().equalsIgnoreCase("6")) { + datosmail.put("razonsocial", solicitud.getModifiedData().get("nombre")); +// datosmail.put("csolicitud",csolicitud); +// datosmail.put("numcomprobante",record.getNumerocomprobante()); + TsafeUserDetail userDetailObj = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personDetailObj = PersonDetailController.find(userDetailObj.getPk().getPersoncode().toString()); + // Datos del funcionario que valida + datosmail.put("funcionario", personDetailObj.getName()); + datosmail.put("grado", personDetailObj.getMilitarygrade() == null ? "" : personDetailObj.getMilitarygrade()); + String nombreCCA = CatalogDetailController.findxCodigoCodcatalogo(centroControlObj.getNombreinstitucion(), centroControlObj.getNombreinstitucioncodigo()).getDescription(); + datosmail.put("nombreCCA", nombreCCA); + datosmail.put("nombreCCACliente", nombreCCA); + datosmail.put("numeroTramite", solicitud.getNumerosolicitud().replace("SOL", "TRA")); + generarFechaProximoTramite(); + SimpleDateFormat sdf = new SimpleDateFormat(MsgGeneral.getProperty("dateformat")); + datosmail.put("fechaGenerada", sdf.format(fechaAtencionTramite)); + } + } + } else { + request.modifiedData().put("BPMStatus", "D"); + datosmail.put("razonsocial", solicitud.getModifiedData().get("nombre")); + datosmail.put("numeroSolicitud", solicitud.getNumerosolicitud()); + datosmail.put("numcomprobante", record.getNumerocomprobante()); + TsafeUserDetail userDetailObj = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personDetailObj = PersonDetailController.find(userDetailObj.getPk().getPersoncode().toString()); + // Datos del funcionario que valida + datosmail.put("funcionario", personDetailObj.getName()); + datosmail.put("grado", personDetailObj.getMilitarygrade() == null ? "" : personDetailObj.getMilitarygrade()); + String nombreCCA = CatalogDetailController.findxCodigoCodcatalogo(centroControlObj.getNombreinstitucion(), centroControlObj.getNombreinstitucioncodigo()).getDescription(); + datosmail.put("nombreCCA", nombreCCA); + + } + request.modifiedData().put("datosmail", datosmail); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + btnImprimir = Boolean.FALSE; + if (!accionTomada.equalsIgnoreCase(APROBAR)) { + saveAnularSolicitud(); + } + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + isDenied = true; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Throwable e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public void saveAnularSolicitud() { + try { + // CATEGORIA 14 PREVIA IMPORTACION + if (tramite.getCategoria().equals("14")) { + desasociarCargaSolicitud(); + } + //Poner la solicitud en estado anulado deposito + solicitud.setEstado("ANUDEP"); + solicitud.setAucp(null); + solicitudMP.setRecord(solicitud); + solicitudMP.update(); + DtoSave dtoSolicitud = solicitudMP.getDtoSave(); + + if (record != null) { + record.setIsnew(false); + record.setEstadotramite("ANUDEP"); + super.update(); + } + + //Desasociar las armas en apertura de agencias y apertura de sucursales + if (solicitud.getCtramite() == 44 || solicitud.getCtramite() == 48) { + List armasSolicitudList = RecepcionArmasController.findPorSolicitud(solicitud.getPk()); + for (TarmSolicitudArmas armaObj : armasSolicitudList) { + + // Codigo agencia de la solicitud + List solicitudAgenciaLst = SolicitudAgenciaSucursalController.findPorSolicitud(solicitud.getPk()); + for (TarmSolicitudAgenciaSucursal solicitudAgenciaSucursalObj : solicitudAgenciaLst) { + String cAgencia = solicitudAgenciaSucursalObj.getPk().getCagencia().toString(); + TarmAgenciaArma agenciaArmaObj = AgenciaArmaController.findByCArma(armaObj.getPk().getCarma(), cAgencia); + agenciaArma.setRecord(agenciaArmaObj); + agenciaArma.remove(); + } + } + } + + DtoSave dtoSolicitudTramite = this.getDtoSave(); + DtoSave dtoAgenciaArma = agenciaArma.getDtoSave(); + + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + msave.put(solicitudMP.getBeanalias(), dtoSolicitud); // adicionar metadata de mantenimiento para cada tabla. + msave.put(this.getBeanalias(), dtoSolicitudTramite); + msave.put(agenciaArma.getBeanalias(), dtoAgenciaArma); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + solicitudMP.postCommit(resp); + agenciaArma.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void desasociarCargaSolicitud() { + try { + TarmCarga carga = CargaController.findByAUCP(solicitud.getAucp()); + if (carga != null) { + carga.setCsolicitud(null); + cargaController.update(carga); + cargaController.save(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + super.update(); + DtoSave dtosave = super.getDtoSave(); + HashMap msave = new HashMap(); + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + if (accionTomada.equalsIgnoreCase(APROBAR)) { + record.setEstadotramite(APROBAR_DEPOSITO); + btnImprimir = Boolean.TRUE; + } else { + record.setEstadotramite(ANULAR_DEPOSITO); + } + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + isDenied = true; + isEnableCompletarTarea = Boolean.TRUE; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Throwable e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + protected void querydatabase() { + try { + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Consulta y retorna el codigo de un aprobado + */ + public String codigoAceptado() throws Exception { + TgeneParameters f = ParametersController.find("ACEPTADO", "1"); + return f.getTextvalue(); + } + + /** + * Retorna la ruta de documento base en donde se almacenará dicho + * archivo + * + * @return + */ + public String getRutaDocumentoSolBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(solicitud.getFregistro()); + StringBuilder ruta = new StringBuilder("cm:Solicitudes"); + ruta = ruta.append("/cm:").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + return ruta.toString(); + } + + /** + * Metodo para validar el valor a pagar + */ + public void validarValorDelDeposito() { + if (record.getValorapagar().compareTo(record.getValorverificado()) != 0) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_vVerificDiferenteDeVAPagar")); + } + } + + /** + * Genera el reporte del comprobante de caja + * + * @param name Nombre del reporte a generar. + */ + public void generateReport() { + String path = "armas/reports/comprobanteCaja"; + String filename = MsgControlArmas.getProperty("lbl_comprobanteCaja"); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + //RUC de COMACO + String rucComaco = "-"; + TgeneParameters parametroRUC = ParametersController.find("RUCCOMACO", "1"); + if (parametroRUC != null) { + rucComaco = parametroRUC.getTextvalue(); + } + parameters.put("rucComaco", rucComaco); + + //Nombre centro + parameters.put("nombreCentro", this.getNombreCentroControl()); + + //No comprobante + String noComprobante = "-"; + TarmSolicitudTramite solicitudTramite = SolicitudTramiteController.findByCSolicitud(this.solicitud.getPk()); + if (solicitudTramite != null) { + noComprobante = solicitudTramite.getNumerotramite(); + } + parameters.put("noComprobante", noComprobante); + + //Fecha de emision + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("fechaSistema", sdf.format(Calendar.getInstance().getTime())); + + //Ruc del usuario + if (this.solicitud.getModifiedData().get("identification") != null) { + parameters.put("ruc", this.solicitud.getModifiedData().get("identification")); + } else { + parameters.put("ruc", " "); + } + + //Nombre-razon social + if (this.solicitud.getModifiedData().get("nombre") != null) { + parameters.put("nombreRazon", this.solicitud.getModifiedData().get("nombre")); + } else { + parameters.put("nombreRazon", " "); + } + + //Cantidad en letras + String cantidadLetras = ConvertNumberToText.convertNumberToLetter(this.record.getValorapagar().toString()); + parameters.put("cantidadLetras", cantidadLetras); + + //Tramite-categoria-uso + if (this.nombreTramite != null && this.nombreCategoria != null && this.nombreUsoActividad != null) { + parameters.put("tramiteCategoriaUso", this.nombreTramite.getDescription() + "-" + this.nombreCategoria.getDescription() + "-" + this.nombreUsoActividad.getDescription()); + } else { + parameters.put("tramiteCategoriaUso", " "); + } + + //No comprobante del deposito + String noComprobanteDeposito = this.record.getNumerocomprobante().replace("-", "").toLowerCase(); + Boolean caracterEliminado = false; + for (int i = 0; i < noComprobanteDeposito.length(); i++) { + if (caracterEliminado) { + i = 0; + caracterEliminado = false; + } + if (noComprobanteDeposito.toCharArray()[i] != '0' && noComprobanteDeposito.toCharArray()[i] != '1' && noComprobanteDeposito.toCharArray()[i] != '2' + && noComprobanteDeposito.toCharArray()[i] != '3' && noComprobanteDeposito.toCharArray()[i] != '4' && noComprobanteDeposito.toCharArray()[i] != '5' + && noComprobanteDeposito.toCharArray()[i] != '6' && noComprobanteDeposito.toCharArray()[i] != '7' && noComprobanteDeposito.toCharArray()[i] != '8' + && noComprobanteDeposito.toCharArray()[i] != '9') { + + String caracterExtranno = ""; + caracterExtranno += noComprobanteDeposito.toCharArray()[i]; + noComprobanteDeposito = noComprobanteDeposito.replace(caracterExtranno, ""); + caracterEliminado = true; + } + } + parameters.put("noComprobanteDeposito", noComprobanteDeposito); + + //Banco-cuenta + String banco = "-"; + TgeneParameters parametroBanco = ParametersController.find("BANCODEPOSITO", "1"); + if (parametroBanco != null) { + banco = parametroBanco.getTextvalue(); + } + + String cuenta = "-"; + TgeneParameters parametroCuenta = ParametersController.find("CUENTADEPOSITO", "1"); + if (parametroCuenta != null) { + cuenta = parametroCuenta.getTextvalue(); + } + + //Banco-Cuenta + parameters.put("banco", "Banco " + banco + " " + "No. " + cuenta); + + //Valor deposito + parameters.put("valorDeposito", this.record.getValorapagar().toString()); + + //Fecha deposito + parameters.put("fechaDeposito", sdf.format(this.record.getFechacomprobante())); + + String format = "pdf"; + + try { + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + + + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public TgeneCatalogDetail getNombreTramite() { + return nombreTramite; + } + + public void setNombreTramite(TgeneCatalogDetail nombreTramite) { + this.nombreTramite = nombreTramite; + } + + public TgeneCatalogDetail getNombreCategoria() { + return nombreCategoria; + } + + public void setNombreCategoria(TgeneCatalogDetail nombreCategoria) { + this.nombreCategoria = nombreCategoria; + } + + public TgeneCatalogDetail getNombreUsoActividad() { + return nombreUsoActividad; + } + + public void setNombreUsoActividad(TgeneCatalogDetail nombreUsoActividad) { + this.nombreUsoActividad = nombreUsoActividad; + } + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + public Boolean getIsDenied() { + return isDenied; + } + + public void setIsDenied(Boolean isDenied) { + this.isDenied = isDenied; + } + + public Boolean getIsOnlyMsj() { + return isOnlyMsj; + } + + public void setIsOnlyMsj(Boolean isOnlyMsj) { + this.isOnlyMsj = isOnlyMsj; + } + + public List getAccionList() { + return accionList; + } + + public void setAccionList(List accionList) { + this.accionList = accionList; + } + + public String getAccionTomada() { + return accionTomada; + } + + public void setAccionTomada(String accionTomada) { + this.accionTomada = accionTomada; + } + + public RecepcionArmasController getRecepcionArmasController() { + return recepcionArmasController; + } + + public void setRecepcionArmasController( + RecepcionArmasController recepcionArmasController) { + this.recepcionArmasController = recepcionArmasController; + } + + public CentroControlArmasController getCentroControlArmasController() { + return centroControlArmasController; + } + + public void setCentroControlArmasController( + CentroControlArmasController centroControlArmasController) { + this.centroControlArmasController = centroControlArmasController; + } + + public Boolean getIsEnableCompletarTarea() { + return isEnableCompletarTarea; + } + + public void setIsEnableCompletarTarea(Boolean isEnableCompletarTarea) { + this.isEnableCompletarTarea = isEnableCompletarTarea; + } + + /** + * Metodo utilizado para determinar la accion a tomar, de forma automatica + * la accion es reprobar en caso de encontrarse un valor de deposito + * incorrecto + */ + public void aceptar() { + if (record.getValorapagar().compareTo(record.getValorverificado()) != 0) { + accionTomada = REPROBAR; + isDenied = true; + } else { + accionTomada = ""; + isDenied = false; + } + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public TarmTramite getTramite() { + return tramite; + } + + public void setTramite(TarmTramite tramite) { + this.tramite = tramite; + } + + public Date getFechaAtencionTramite() { + return fechaAtencionTramite; + } + + public void setFechaAtencionTramite(Date fechaAtencionTramite) { + this.fechaAtencionTramite = fechaAtencionTramite; + } + + public TarmCentroControl getCentroControlObj() { + return centroControlObj; + } + + public void setCentroControlObj(TarmCentroControl centroControlObj) { + this.centroControlObj = centroControlObj; + } + + public String getAPROBAR() { + return APROBAR; + } + + public String getREPROBAR() { + return REPROBAR; + } + + public String getAPROBAR_DEPOSITO() { + return APROBAR_DEPOSITO; + } + + public String getANULAR_DEPOSITO() { + return ANULAR_DEPOSITO; + } + + public Boolean getBtnImprimir() { + return btnImprimir; + } + + public void setBtnImprimir(Boolean btnImprimir) { + this.btnImprimir = btnImprimir; + } + + public SolicitudArmasController getSolicitudMP() { + return solicitudMP; + } + + public void setSolicitudMP(SolicitudArmasController solicitudMP) { + this.solicitudMP = solicitudMP; + } + + public AgenciaArmaController getAgenciaArma() { + return agenciaArma; + } + + public void setAgenciaArma(AgenciaArmaController agenciaArma) { + this.agenciaArma = agenciaArma; + } + + public CargaController getCargaController() { + return cargaController; + } + + public void setCargaController(CargaController cargaController) { + this.cargaController = cargaController; + } + + public Boolean getRequiereNoSolAucpBln() { + return requiereNoSolAucpBln; + } + + public void setRequiereNoSolAucpBln(Boolean requiereNoSolAucpBln) { + this.requiereNoSolAucpBln = requiereNoSolAucpBln; + } + + public String getNombreCentroControl() { + return nombreCentroControl; + } + + public void setNombreCentroControl(String nombreCentroControl) { + this.nombreCentroControl = nombreCentroControl; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/VerificacionBodegaController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/VerificacionBodegaController.java new file mode 100644 index 0000000..3b633f1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/VerificacionBodegaController.java @@ -0,0 +1,1113 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.AjaxBehaviorEvent; +import javax.faces.model.SelectItem; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.parmas.soli.TarmDecomisoArmaTransaccion; +import com.fp.persistence.parmas.soli.TarmTransaccionArmaBodega; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TarmDecomisoArma. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class VerificacionBodegaController extends AbstractController { + + /** + * prefijo para la generacion del numero de transaccion + */ + private static final String prefijo = "REC"; + + @ManagedProperty(value = "#{decomisoArmaTransaccionController}") + private DecomisoArmaTransaccionController decomisoArmaTransaccionController; + + @ManagedProperty(value = "#{transaccionArmaBodegaController}") + private TransaccionArmaBodegaController transaccionArmaBodegaController; + + @ManagedProperty(value = "#{bodegaController}") + private BodegaController bodegaController; + + @ManagedProperty(value = "#{decomisoController}") + private DecomisoController decomisoController; + + /** + * Controlador para generar el reporte + */ + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + /** + * Controlador para caragar el archivo al alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + private Boolean isCentroDpto = Boolean.FALSE; + + /** + * ruta para cargar el archivo + */ + private String xpathflujo; + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ +// private List linstitucion; + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ +// private List lnombreInstitucion; + /** + * Fecha de corte + */ + private Date fechaCorte; + /** + * Codigo del centro de control + */ + private String codigoOrganismoControl; + /** + * codigo de la unidad de control + */ + private String codigoUnidadControl; + /** + * numero de custodia del arma + */ +// private String numeroDecomiso; + + private String numerotransaccionEnvio; + /** + * atributo con los datos del usuario logeado + */ + private TsafeUserDetail userDetail; + /** + * catalogo de tipos de reporte + */ + private List lTipoReporte; + /** + * atributo para habilitar o desabilitar al boton guaradr + */ + private Boolean btnSave; + /** + * Deshabilita la pantalla después de grabar la solicitud + */ + private boolean btnSelTodos; + /** + * Deshabilita la pantalla después de grabar la solicitud + */ + private boolean cmbTransaccionenvio; + /** + * atributo para habilitar o desabilitar al boton genera acta + */ + private Boolean btnGenerarActa; + /** + * Atributo para el numero de transacion de recibido que se genera al pulsar + * el boton generar acta + */ + private String numRecepcionGenerado; + /** + * Atributo para el numero de transacion de recibido que se genera al pulsar + * el boton generar acta + */ + private String numRecepcionGeneradoAux; + /** + * clave primaria de la tabla TarmDecomisoArmaTransaccion + */ + private String numerotransaccionpk; + /** + * clave primaria de la tabla TarmDecomisoArmaTransaccion + */ + private String numerotransaccionpkAux; + /** + * fecha con la que se realizo el reporte + */ + private Date fechaCorteg; + /** + * formato del reporte PDF + */ + private String format; + /** + * Tipo de reporte PDF + */ + private String tipoReporte; + /** + * centro de control + */ + private TarmCentroControl centroControl; + /** + * nombre del centro de control + */ + private String institucionCentroControl; + /** + * nombre del centro de control + */ + private String instiCentroControlCode; + /** + * codigo del decomiso del catalogo ESTADOARMA + */ + private String codigoDecomiso; + /** + * codigo de la incautacion del catalogo ESTADOARMA + */ + private String codigoIncautacion; + /** + * codigo de entrega voluntaria del catalogo ESTADOARMA + */ + private String entregaVoluntaria; + /** + * codigo de abandono del catalogo ESTADOARMA + */ + private String abandono; + /** + * codigo del reclamo del catalogo ESTADOARMA + */ + private String codigoReclamo; + /** + * codigo de la provincia del usuario que se logeo + */ + private String cprovincia; + + private Boolean itemsUnidadBolean; + + //Manu + /** + * centro de control destino + */ + private String organismoControlDestino; + /** + * codigo de la unidad de control + */ + private String unidadControlDestino; + /** + * unidad de control destino + */ + private String codigoUnidadControlDestino; + + private String centroControlOrigenStr; + private String unidadOrigenStr; + /** + * estado operacion del decomiso del catalogo ESTADOARMA + */ + private String estadoOperacion; + + private List itemUnidadDestino; + private List listaEnviosRealizados; + + public VerificacionBodegaController() throws Exception { + super(TarmDecomisoArma.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 100000; // Cambiar al # reg a mirar. + lrecord = new ArrayList(); + beanalias = "DECOMARMTRANRECECCION"; + //boton desabilitado + btnSave = Boolean.TRUE; + btnGenerarActa = Boolean.TRUE; + btnSelTodos = Boolean.TRUE; + cmbTransaccionenvio = Boolean.TRUE; + //fecha actual para el corte + fechaCorte = new Date(); + //CARGA DE CATALOGOS +// linstitucion=CatalogDetailController.find("INSTITUCION"); + lTipoReporte = CatalogDetailController.find("TIPOREPORTE"); + //obtiene el centro de control + obtenerCentroControl(); + format = "pdf"; + numerotransaccionpk = null; + codigoDecomiso = codigos("CODIGO.DECOMISADA");//DEC + codigoIncautacion = codigos("CODIGO.INCAUTADA");//INC + entregaVoluntaria = codigos("CODIGO.ENTV"); + abandono = codigos("CODIGO.ABAN"); + codigoReclamo = codigos("CODIGO.RECL");//RECLAMO + xpathflujo = null; + itemsUnidadBolean = Boolean.FALSE; + estadoOperacion = "ENVIO"; + + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + codigoUnidadControlDestino = tsafeUserDetail.getCcentrocontrol(); + + organismoControlDestino = tsafeUserDetail.getModifiedData().get("centrocontrol").toString(); + unidadControlDestino = tsafeUserDetail.getModifiedData().get("unidad").toString(); + + //codigoOrganismoControl = tsafeUserDetail.getCcentrocontrol(); + codigoUnidadControl = tsafeUserDetail.getCcentrocontrol(); + listaEnviosRealizados = DecomisoArmaTransaccionController.findParaReception(codigoUnidadControl); +// System.out.println(listaDecomisoArmaTrans1.size()); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para obtener el centro de control + * + * @throws Exception + */ + private void obtenerCentroControl() throws Exception { + userDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + centroControl = CentroControlArmasController.findPorCodigo(userDetail.getCcentrocontrol()); + cprovincia = centroControl.getProvincecode(); + itemUnidadDestino = new ArrayList(); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + //codigo del centro de control de pichincha + TgeneParameters paramCentroControlDestino = ParametersController.find("CODIGO.CENT.CONTROL.PICHINCHA", "1");//000030//CAPI + //validamos si la persona que ingreso pertenece al centro de control pichincha para darle al opcion de seleccionar el deparatmento de control para la recepcion + if (paramCentroControlDestino.getTextvalue().equals(centroControl.getNombreinstitucion())) { + itemUnidadDestino.add(new SelectItem(centroControl.getPk(), institucionCentroControl)); + //codigo del departamento de control + TgeneParameters paramDepartamentoControl = ParametersController.find("CODIGO.DEPT.CONTROL", "1");//DPCA + TarmCentroControl institCentroControlDestino = CentroControlArmasController.findPorCentroControl(paramDepartamentoControl.getTextvalue());//000077 + itemUnidadDestino.add(new SelectItem(institCentroControlDestino.getPk(), "" + institCentroControlDestino.getModifiedData().get("desnombreinstitucion"))); + } else { + instiCentroControlCode = centroControl.getPk(); + } + } + + /** + * Metodo para obtener los codigos + */ + private String codigos(String parametro) { + TgeneParameters tgeneParameters = ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if (fechaCorte != null) { + DtoQuery dto = this.getDtoQuery(); + dto.setOrderby("t.fdecomiso"); + if (numerotransaccionpk != null) { + SimpleDateFormat formato = new SimpleDateFormat("yyyy-MM-dd"); + Filter decomisoFiltro = new Filter(); + decomisoFiltro.setSql("t.fdecomiso <= " + "TO_DATE('" + + formato.format(fechaCorte) + "','yyyy-MM-dd') and (t.estado='" + codigoDecomiso + "' or t.estado='" + codigoIncautacion + "' or t.estado='" + abandono + "' or t.estado='" + codigoReclamo + "') and t.cdecarmtranrecepcion = " + numerotransaccionpk); + dto.addFiltro(decomisoFiltro); + } else {//aniadimos los filtros de busqueda + dto = filtroVerificarArmas(dto); + numRecepcionGenerado = null; + //codigoOrganismoControlDestino = null; + //codigoUnidadControlDestino = null; + } + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + Response resp = callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + btnSelTodos = Boolean.TRUE; + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + //metodo para completar la informacion + completarInformacionArma(); + btnSave = Boolean.TRUE; + btnSelTodos = Boolean.FALSE; + btnGenerarActa = Boolean.TRUE; + numerotransaccionpk = null; + super.postQuery(lrecord); + } + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Retorna un {@link DtoQuery} con los atributos a presentarse + * + * @return + * @throws Exception + */ + private DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + + SubQuery subqueryNumRec = new SubQuery("TarmDecomiso", "numerorecibo", "nrecibo", "i.pk=t.cdecomiso"); + dto.addSubQuery(subqueryNumRec); + SubQuery subqueryNumTransac = new SubQuery("TarmDecomiso", "numerotransaccion", "numerotransaccion", "i.pk=t.cdecomiso"); + dto.addSubQuery(subqueryNumTransac); + SubQuery subqueryCentroControl = new SubQuery("TarmDecomiso", "ccentrocontrol", "ccentrocontrol", "i.pk=t.cdecomiso"); + dto.addSubQuery(subqueryCentroControl); + SubQuery subqueryMarca = new SubQuery("TgeneCatalogDetail", "description", "nmarca", + "i.pk.catalog=(select o.marca from TarmArmas o where o.pk=t.carma)" + + " and i.pk.catalogcode=(select o.marcacodigo from TarmArmas o where o.pk=t.carma)"); + dto.addSubQuery(subqueryMarca); + SubQuery subquerySerieArma = new SubQuery("TarmArmas", "lote", "nserie", "i.pk=t.carma"); + dto.addSubQuery(subquerySerieArma); + + SubQuery subqueryCalibre = new SubQuery("TgeneCatalogDetail", "description", "ncalibre", + "i.pk.catalog =(select o.calibre from TarmTipoArmaExplosivo o where o.pk=(select a.ctipoarmaexplosivo from TarmArmas a where a.pk=t.carma))" + + " and i.pk.catalogcode=(select o.calibrecodigo from TarmTipoArmaExplosivo o where o.pk=(select a.ctipoarmaexplosivo from TarmArmas a where a.pk=t.carma))");//calibrecodigo + dto.addSubQuery(subqueryCalibre); + + SubQuery subqueryCodigoReg = new SubQuery("TarmArmas", "cregistro", "cregistro", "i.pk=t.carma"); + dto.addSubQuery(subqueryCodigoReg); + SubQuery subqueryCodigoArmaExplo = new SubQuery("TarmArmas", "ctipoarmaexplosivo", "ctipoarmaexplosivo", "i.pk=t.carma"); + dto.addSubQuery(subqueryCodigoArmaExplo); + //tipo, clase, unidad de TarmTipoArmaExplosivo + SubQuery subqueryTipo = new SubQuery("TgeneCatalogDetail", "description", "ntipo", + "i.pk.catalog =(select o.tipoarmaexplosivo from TarmTipoArmaExplosivo o where o.pk=(select a.ctipoarmaexplosivo from TarmArmas a where a.pk=t.carma))" + + " and i.pk.catalogcode=(select o.tipoarmaexplosivocodigo from TarmTipoArmaExplosivo o where o.pk=(select a.ctipoarmaexplosivo from TarmArmas a where a.pk=t.carma))"); + dto.addSubQuery(subqueryTipo); + SubQuery subqueryClase = new SubQuery("TgeneCatalogDetail", "description", "nclase", + "i.pk.catalog =(select o.clase from TarmTipoArmaExplosivo o where o.pk=(select a.ctipoarmaexplosivo from TarmArmas a where a.pk=t.carma))" + + " and i.pk.catalogcode=(select o.clasecodigo from TarmTipoArmaExplosivo o where o.pk=(select a.ctipoarmaexplosivo from TarmArmas a where a.pk=t.carma))"); + dto.addSubQuery(subqueryClase); + SubQuery subqueryUnidad = new SubQuery("TgeneCatalogDetail", "description", "nunidad", + "i.pk.catalog =(select o.unidadmedidapeso from TarmTipoArmaExplosivo o where o.pk=(select a.ctipoarmaexplosivo from TarmArmas a where a.pk=t.carma))" + + " and i.pk.catalogcode=(select o.unidadmedidapesocodigo from TarmTipoArmaExplosivo o where o.pk=(select a.ctipoarmaexplosivo from TarmArmas a where a.pk=t.carma))"); + dto.addSubQuery(subqueryUnidad); + //personcode + //TarmRegistroArmas registroArma = RegistroArmController.findByCodigo(decomisoArma.getModifiedData().get("cregistro").toString()); + SubQuery subqueryPersonCode = new SubQuery("TarmRegistroArmas", "personcode", "personcode", " i.pk =(select o.cregistro from TarmArmas o where o.pk=t.carma)"); + dto.addSubQuery(subqueryPersonCode); + + SubQuery subquerEstadoFlujo = new SubQuery("TarmDecomisoArmaTransaccion", "estadoflujo", "estadoflujo", "i.pk=t.cdecomisoarmatransaccion"); + dto.addSubQuery(subquerEstadoFlujo); + return dto; + } + + @Override + public void save() { + try { + Boolean seleccion = Boolean.FALSE; + for (TarmDecomisoArma decomisoArma : this.lrecord) { + record = decomisoArma; + if (record.getModifiedData().get("seleccion").equals(Boolean.TRUE)) { + seleccion = true; + record.setCdecarmtranrecepcion(0l); + record.setCoperaciontransaccion("RECEPCION"); + } + this.update(); + } + if (!seleccion) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_verificararmas")); + return; + } + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + + Calendar cal = Calendar.getInstance(); + cal.setTime(fechaCorte); + java.sql.Date fechaCorteRegistro = new java.sql.Date(cal.getTimeInMillis()); + + this.decomisoArmaTransaccionController.create(); + this.decomisoArmaTransaccionController.getRecord().setFtransaccion(null); + this.decomisoArmaTransaccionController.getRecord().setFcorte(fechaCorteRegistro); + this.decomisoArmaTransaccionController.getRecord().setCcentrocontrol(codigoUnidadControlDestino);//de la persona que revcibe//centroControl.getPk() codigoUnidadControlDestino + + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TarmCentroControl centroControlLogin = CentroControlArmasController.findPorCodigo(tsafeUserDetail.getCcentrocontrol()); + + if (!"1".equals(CatalogDetailController.findxCodigoCodcatalogo(centroControlLogin.getInstitucion(), centroControlLogin.getInstituciontipo()).getPk().getCatalog())) { + this.decomisoArmaTransaccionController.getRecord().setEstadofirma("Y"); + this.decomisoArmaTransaccionController.getRecord().setEstadoflujo("ENV"); + isCentroDpto = Boolean.FALSE; + } else { + this.decomisoArmaTransaccionController.getRecord().setEstadofirma("N"); + this.decomisoArmaTransaccionController.getRecord().setEstadoflujo("NOENV"); + isCentroDpto = Boolean.TRUE; + } + + this.decomisoArmaTransaccionController.update(); + DtoSave dtosaveDecomisoTran = this.decomisoArmaTransaccionController.getDtoSave(true); + dtosaveDecomisoTran.setReturnpk(true); + dtosaveDecomisoTran.setPosition(1); + msave.put(decomisoArmaTransaccionController.getBeanalias(), dtosaveDecomisoTran); + + DtoSave dtosaveDecomiso = this.getDtoSave(true); + dtosaveDecomiso.setReturnpk(true); + dtosaveDecomiso.setPosition(2); + msave.put(getBeanalias(), dtosaveDecomiso); + + //transacciones del arma + DtoSave dtosaveArmaBodega = transaccionArmaBodegaController.getDtoSave(true); + dtosaveArmaBodega.setReturnpk(true); + dtosaveArmaBodega.setPosition(3); + msave.put(transaccionArmaBodegaController.getBeanalias(), dtosaveArmaBodega); + //bodega del arma + DtoSave dtosaveBodega = bodegaController.getDtoSave(true); + dtosaveBodega.setReturnpk(true); + dtosaveBodega.setPosition(4); + msave.put(bodegaController.getBeanalias(), dtosaveBodega); + + //para la actualizacion del centro de control destino + DtoSave dtosaveDecomisoCab = decomisoController.getDtoSave(true); + dtosaveDecomisoCab.setPosition(5); + msave.put(decomisoController.getBeanalias(), dtosaveDecomisoCab); + + request.setSaveTables(msave); + //prefijo + request.put("prefijo", prefijo); + // para el flujo + request.modifiedData().put("isnew", "N");//para que ejecute desde un boton + //completa la informacion en un transaction rule DecomisoArmaRecepcion + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.decomisoArmaTransaccionController.postCommit(resp); + this.postCommit(resp); + TarmDecomisoArmaTransaccion decomisoArmaTransaccion = (TarmDecomisoArmaTransaccion) dtosaveDecomisoTran.getLinsert().get(0); + numerotransaccionpk = decomisoArmaTransaccion.getPk().toString(); + numerotransaccionpkAux = decomisoArmaTransaccion.getPk().toString(); + //numereo de transaccion + numRecepcionGenerado = resp.get("numerotransaccionrecep").toString(); + numRecepcionGeneradoAux = resp.get("numerotransaccionrecep").toString(); + fechaCorteg = decomisoArmaTransaccion.getFcorte(); + //metodo para generar el acta + querydatabase(); + btnSave = Boolean.TRUE; + btnSelTodos = Boolean.TRUE; + cmbTransaccionenvio = Boolean.FALSE; + btnGenerarActa = Boolean.FALSE; +// numerotransaccionEnvio = ""; + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Método para el evento change del combo transaccion + */ + public void executeTransaccion() { + List decomisoArmaTransaccionOrigen = DecomisoArmaTransaccionController.findPorEnvio(numerotransaccionEnvio, true); + if (decomisoArmaTransaccionOrigen != null && !decomisoArmaTransaccionOrigen.isEmpty()) { +// codigoUnidadControlDestino = decomisoArmaTransaccionOrigen.get(0).getCcentrocontrol(); + TarmCentroControl centroControlOrigen = CentroControlArmasController.findPorCodigo(decomisoArmaTransaccionOrigen.get(0).getCcentrocontrol()); + centroControlOrigenStr = CatalogDetailController.findxCodigoCodcatalogo(centroControlOrigen.getInstitucion(), centroControlOrigen.getInstituciontipo()).getDescription(); + unidadOrigenStr = CatalogDetailController.findxCodigoCodcatalogo(centroControlOrigen.getNombreinstitucion(), centroControlOrigen.getNombreinstitucioncodigo()).getDescription(); + } + } + + /** + * Completa las caracteristicas del arma de los catalogos correspondientes + */ + public void completarInformacionArma() { + List armasNoenviadas = new ArrayList(); + for (TarmDecomisoArma decomisoArma : lrecord) { + decomisoArma.getModifiedData().put("seleccion", false); + //TarmRegistroArmas registroArma = RegistroArmController.findByCodigo(decomisoArma.getModifiedData().get("cregistro").toString()); + if (decomisoArma.getModifiedData().get("personcode") != null) { + TcustPersonDetail tcustPersonDetail = PersonDetailController.find(decomisoArma.getModifiedData().get("personcode").toString()); + decomisoArma.getModifiedData().put("nrazons", tcustPersonDetail.getName()); + decomisoArma.getModifiedData().put("documento", tcustPersonDetail.getIdentification()); + } + if (decomisoArma.getModifiedData().get("estadoflujo") != null && decomisoArma.getModifiedData().get("estadoflujo").equals("NOENV")) { + armasNoenviadas.add(decomisoArma); + } + } + + for (TarmDecomisoArma decomisoArma : armasNoenviadas) { + lrecord.remove(decomisoArma); + } + } + + /** + * Método para habilitar o desabilitar el btn Arma a decomisar + * + * @throws Exception + */ + public void onChange(TarmDecomisoArma decomisoArma) throws Exception { + btnSave = Boolean.TRUE; + itemsUnidadBolean = Boolean.FALSE; + for (TarmDecomisoArma t : lrecord) { + if (t.getModifiedData().get("seleccion").equals(Boolean.TRUE)) { + btnSave = Boolean.FALSE; + itemsUnidadBolean = Boolean.TRUE; + } + } + } + + /** + * Metodo para filtrar por Unidad de Control + * + * @param dto Dto sobre el que se va a ejecutar el filtro + * @throws Exception + */ + private DtoQuery filtroVerificarArmas(DtoQuery dto) throws Exception { + Filter decomisoFiltro = new Filter(); + List listaDecomisoArmaTrans = new ArrayList<>(); + if (numerotransaccionEnvio != null && !"".equals(numerotransaccionEnvio)) { + listaDecomisoArmaTrans = DecomisoArmaTransaccionController.findPorEnvio(numerotransaccionEnvio, true); + } else { + listaDecomisoArmaTrans = DecomisoArmaTransaccionController.findPorOrganismoUnidad(codigoUnidadControl, fechaCorte, estadoOperacion); + } + + String filtroDecomisoArmaTrans = ""; + if (listaDecomisoArmaTrans != null && !listaDecomisoArmaTrans.isEmpty()) { + StringBuffer lstBuffer = new StringBuffer(); + for (TarmDecomisoArmaTransaccion decomisoArmaTrans : listaDecomisoArmaTrans) { + if (!lstBuffer.toString().isEmpty()) { + lstBuffer.append(" or "); + } + lstBuffer.append("t.cdecomisoarmatransaccion = " + decomisoArmaTrans.getPk()); + } + filtroDecomisoArmaTrans = (!lstBuffer.toString().trim().isEmpty()) ? " and (" + lstBuffer.toString() + ")" : ""; + } else { + filtroDecomisoArmaTrans = "and (t.cdecomisoarmatransaccion = 999999)"; + } + decomisoFiltro.setSql("(t.estado='" + codigoDecomiso + "' or t.estado='" + codigoIncautacion + "' or t.estado='" + entregaVoluntaria + "' or t.estado='" + abandono + "' or t.estado='" + codigoReclamo + "') and t.cdecomiso is not null and t.coperaciontransaccion = '" + estadoOperacion + "' and t.enbodega='Y'" + filtroDecomisoArmaTrans); + dto.addFiltro(decomisoFiltro); + return dto; + } + + /** + * Seleccionado todos los registros de la tabla + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if (Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")) { + valorColocar = Boolean.TRUE; + } + + btnSave = Boolean.TRUE; + for (TarmDecomisoArma decomisoArma : lrecord) { + decomisoArma.getModifiedData().put("seleccion", valorColocar); + if (decomisoArma.getModifiedData().get("seleccion").equals(Boolean.TRUE)) { + btnSave = Boolean.FALSE; + //itemsUnidadBolean=Boolean.TRUE; + } + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para generar el acta de recepcion y cargar el archivo en el + * alfresco + */ + public void generarActa() { + if (fechaCorteg != null) { + Calendar fechaActualCldr = Calendar.getInstance(); + + String codigoreporte = numerotransaccionpkAux; + String path = "armas/reports/repo2"; + String filename = numRecepcionGenerado; + String gradoUsuario = ""; + TcustPersonDetail usuario = PersonDetailController.find(this.userDetail.getPk().getPersoncode().toString()); + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(usuario.getMilitarygrade(), usuario.getMilitarygradecode()); + if (grado != null) { + gradoUsuario = grado.getDescription() + " - " + usuario.getName(); + } else { + gradoUsuario = "Sin Grado - " + usuario.getName(); + } + + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + try { + // Usuario logueado en la aplicacion + String nombreUsuario; + if (userDetail.getPk().getPersoncode() != null) { + nombreUsuario = PersonDetailController.find(userDetail.getPk().getPersoncode().toString()).getName(); + } else { + nombreUsuario = ""; + } + +// TarmCentroControl centroControlDestino = CentroControlArmasController.findPorCodigo(codigoUnidadControlDestino); +// String centroControlDestinoStr = CatalogDetailController.findxCodigoCodcatalogo( centroControlDestino.getInstitucion(), centroControlDestino.getInstituciontipo()).getDescription(); +// String unidadControlDestinoStr = CatalogDetailController.findxCodigoCodcatalogo( centroControlDestino.getNombreinstitucion(), centroControlDestino.getNombreinstitucioncodigo()).getDescription(); + parameters.put("user", nombreUsuario); + parameters.put("organismoControlOrigen", centroControlOrigenStr); + parameters.put("unidadControlOrigen", unidadOrigenStr); + parameters.put("organismoControlDestino", organismoControlDestino); + parameters.put("unidadControlDestino", unidadControlDestino); + parameters.put("codigodec", codigoreporte.toString());//este + parameters.put("fechaCorte", new SimpleDateFormat("dd-MM-yyyy").format(fechaCorteg));//este + parameters.put("numtransaccion", numRecepcionGeneradoAux); + parameters.put("personcode", userDetail.getPk().getPersoncode()); + parameters.put("nombregrado", gradoUsuario);//este + // Fecha actual + StringBuilder fechaActualSB = new StringBuilder(); + fechaActualSB = fechaActualSB.append((fechaActualCldr.get(Calendar.DAY_OF_MONTH)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.DAY_OF_MONTH)) : (fechaActualCldr.get(Calendar.DAY_OF_MONTH))); + fechaActualSB = fechaActualSB.append("-").append((fechaActualCldr.get(Calendar.MONTH) + 1) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MONTH) + 1) : (fechaActualCldr.get(Calendar.MONTH) + 1)); + fechaActualSB = fechaActualSB.append("-").append(fechaActualCldr.get(Calendar.YEAR)); + fechaActualSB = fechaActualSB.append(" ").append(fechaActualCldr.get(Calendar.HOUR_OF_DAY)); + fechaActualSB = fechaActualSB.append(":").append((fechaActualCldr.get(Calendar.MINUTE)) <= 9 ? "0" + (fechaActualCldr.get(Calendar.MINUTE)) : (fechaActualCldr.get(Calendar.MINUTE))); + parameters.put("lugarFecha", fechaActualSB.toString()); + + TgeneCatalogDetail orgControl = CatalogDetailController.findCatalogo("NOMBREINSTITUCION", this.codigoUnidadControl); + if (orgControl != null) { + parameters.put("orgControl", orgControl.getDescription()); + } else { + parameters.put("orgControl", ""); + } + + format = "pdf"; + InputStream file = this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + xpathflujo = generarXpath(); + if (!alfrescoController.uploadFile(file, numRecepcionGeneradoAux + ".pdf", xpathflujo)) { + xpathflujo = null; + } + System.out.println(xpathflujo + "/cm:" + numRecepcionGeneradoAux + ".pdf"); + numerotransaccionEnvio = ""; + //="cm:Decomiso/cm:A-2016/cm:M-01/cm:CENTRO CONTROL/cm:ABANDONO/cm:REC/cm:REC-000000319.pdf" + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + } + + /** + * Metodo para generar la ruta donde se carga el archivo + * + * @return + */ + public String generarXpath() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + StringBuilder ruta = new StringBuilder("cm:Decomiso"); + + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + String centrocontrol = unidadControlDestino.replaceAll("\\s+", "_"); + ruta = ruta.append("/cm:").append(centrocontrol); + ruta = ruta.append("/cm:" + "REC"); + + return ruta.toString(); + } + + /** + * Validacion de las fechas que no se amayor a la actual + * + * @param fech + */ + public void validarfecha(Date fech) { + if (fech.getTime() > (new Date()).getTime()) { + fech = new Date(); + fechaCorte = new java.sql.Date(new Date().getTime()); + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_fechadecomisonopuedesermayoralaactual")); + } + } + + /** + * Ejecuta un reporte de armas a destruir Método para el inicio de + * flujo + */ + public void iniciarFlujo() { + try { + if (xpathflujo == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generereporte")); + return; + } + if (cprovincia == null || cprovincia.length() == 0) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinprovincia")); + return; + } + + //instiCentroControlCode + TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(instiCentroControlCode); + if (centroControl == null || centroControl.getPk() == null) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_sinprovincia")); + return; + } + TgeneParameters paramDepartamentoControl = ParametersController.find("CODIGO.DEPT.CONTROL", "1");//DPCA + if (centroControl.getNombreinstitucion().equals(paramDepartamentoControl.getTextvalue())) { + cprovincia = paramDepartamentoControl.getTextvalue(); + } + //itemUnidadDestino + + String xpath = xpathflujo + "/cm:" + numRecepcionGeneradoAux + ".pdf"; + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + //codigo de la tabla TarmDecomisoArmaTransaccion + request.modifiedData().put("numerotransaccion", numerotransaccionpkAux); + request.modifiedData().put("cprovincia", cprovincia); + request.modifiedData().put("numerosolicitud", numRecepcionGeneradoAux); + //ruta del archivo para la firma + //TODO Falta crear la variable en maia 2-8 + request.modifiedData().put("xpath", xpath); + request.modifiedData().put("isnew", "Y"); + request.setLogsolicitude(numRecepcionGeneradoAux); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.setShowRow(true); + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + " TRANSACCION: " + numerotransaccionpkAux); + xpathflujo = null; + btnGenerarActa = Boolean.TRUE; + btnSelTodos = Boolean.TRUE; + cmbTransaccionenvio = Boolean.FALSE; + btnSave = Boolean.TRUE; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void executeUnidad() { + + for (SelectItem item : itemUnidadDestino) { + if (item.getValue().equals(instiCentroControlCode)) { + institucionCentroControl = item.getLabel(); + } + } + } + + public List getlTipoReporte() { + return lTipoReporte; + } + + public void setlTipoReporte(List lTipoReporte) { + this.lTipoReporte = lTipoReporte; + } + + public Date getFechaCorte() { + return fechaCorte; + } + + public void setFechaCorte(Date fechaCorte) { + this.fechaCorte = fechaCorte; + } + + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getTipoReporte() { + return tipoReporte; + } + + public void setTipoReporte(String tipoReporte) { + this.tipoReporte = tipoReporte; + } + + public TsafeUserDetail getUserDetail() { + return userDetail; + } + + public void setUserDetail(TsafeUserDetail userDetail) { + this.userDetail = userDetail; + } + + public TarmCentroControl getCentroControl() { + return centroControl; + } + + public void setCentroControl(TarmCentroControl centroControl) { + this.centroControl = centroControl; + } + + /** + * @return the listaEnviosRealizados + */ + public List getListaEnviosRealizados() { + return listaEnviosRealizados; + } + + /** + * @param listaEnviosRealizados the listaEnviosRealizados to set + */ + public void setListaEnviosRealizados( + List listaEnviosRealizados) { + this.listaEnviosRealizados = listaEnviosRealizados; + } + + public String getCodigoOrganismoControl() { + return codigoOrganismoControl; + } + + public void setCodigoOrganismoControl(String codigoOrganismoControl) { + this.codigoOrganismoControl = codigoOrganismoControl; + } + + public String getCodigoUnidadControl() { + return codigoUnidadControl; + } + + public void setCodigoUnidadControl(String codigoUnidadControl) { + this.codigoUnidadControl = codigoUnidadControl; + } + + public Boolean getBtnSave() { + return btnSave; + } + + public void setBtnSave(Boolean btnSave) { + this.btnSave = btnSave; + } + + public String getNumRecepcionGenerado() { + return numRecepcionGenerado; + } + + public void setNumRecepcionGenerado(String numRecepcionGenerado) { + this.numRecepcionGenerado = numRecepcionGenerado; + } + + public DecomisoArmaTransaccionController getDecomisoArmaTransaccionController() { + return decomisoArmaTransaccionController; + } + + public void setDecomisoArmaTransaccionController( + DecomisoArmaTransaccionController decomisoArmaTransaccionController) { + this.decomisoArmaTransaccionController = decomisoArmaTransaccionController; + } + + public String getNumerotransaccionEnvio() { + return numerotransaccionEnvio; + } + + public void setNumerotransaccionEnvio(String numerotransaccionEnvio) { + this.numerotransaccionEnvio = numerotransaccionEnvio; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + public String getNumerotransaccionpk() { + return numerotransaccionpk; + } + + public void setNumerotransaccionpk(String numerotransaccionpk) { + this.numerotransaccionpk = numerotransaccionpk; + } + + public Boolean getBtnGenerarActa() { + return btnGenerarActa; + } + + public void setBtnGenerarActa(Boolean btnGenerarActa) { + this.btnGenerarActa = btnGenerarActa; + } + + public TransaccionArmaBodegaController getTransaccionArmaBodegaController() { + return transaccionArmaBodegaController; + } + + public void setTransaccionArmaBodegaController( + TransaccionArmaBodegaController transaccionArmaBodegaController) { + this.transaccionArmaBodegaController = transaccionArmaBodegaController; + } + + public BodegaController getBodegaController() { + return bodegaController; + } + + public void setBodegaController(BodegaController bodegaController) { + this.bodegaController = bodegaController; + } + + public String getInstiCentroControlCode() { + return instiCentroControlCode; + } + + public void setInstiCentroControlCode(String instiCentroControlCode) { + this.instiCentroControlCode = instiCentroControlCode; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public void setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + } + + public List getItemUnidadDestino() { + return itemUnidadDestino; + } + + public void setItemUnidadDestino(List itemUnidadDestino) { + this.itemUnidadDestino = itemUnidadDestino; + } + + public Boolean getItemsUnidadBolean() { + return itemsUnidadBolean; + } + + public void setItemsUnidadBolean(Boolean itemsUnidadBolean) { + this.itemsUnidadBolean = itemsUnidadBolean; + } + + public DecomisoController getDecomisoController() { + return decomisoController; + } + + public void setDecomisoController(DecomisoController decomisoController) { + this.decomisoController = decomisoController; + } + + /** + * @return the organismoControlDestino + */ + public String getOrganismoControlDestino() { + return organismoControlDestino; + } + + /** + * @param organismoControlDestino the organismoControlDestino to set + */ + public void setOrganismoControlDestino(String organismoControlDestino) { + this.organismoControlDestino = organismoControlDestino; + } + + /** + * @return the unidadControlDestino + */ + public String getUnidadControlDestino() { + return unidadControlDestino; + } + + /** + * @param unidadControlDestino the unidadControlDestino to set + */ + public void setUnidadControlDestino(String unidadControlDestino) { + this.unidadControlDestino = unidadControlDestino; + } + + public String getCodigoUnidadControlDestino() { + return codigoUnidadControlDestino; + } + + public void setCodigoUnidadControlDestino(String codigoUnidadControlDestino) { + this.codigoUnidadControlDestino = codigoUnidadControlDestino; + } + + public String getCentroControlOrigenStr() { + return centroControlOrigenStr; + } + + public void setCentroControlOrigenStr(String centroControlOrigenStr) { + this.centroControlOrigenStr = centroControlOrigenStr; + } + + public String getUnidadOrigenStr() { + return unidadOrigenStr; + } + + public void setUnidadOrigenStr(String unidadOrigenStr) { + this.unidadOrigenStr = unidadOrigenStr; + } + + public Boolean getIsCentroDpto() { + return isCentroDpto; + } + + public void setIsCentroDpto(Boolean isCentroDpto) { + this.isCentroDpto = isCentroDpto; + } + + public boolean isBtnSelTodos() { + return btnSelTodos; + } + + public void setBtnSelTodos(boolean btnSelTodos) { + this.btnSelTodos = btnSelTodos; + } + + public boolean isCmbTransaccionenvio() { + return cmbTransaccionenvio; + } + + public void setCmbTransaccionenvio(boolean cmbTransaccionenvio) { + this.cmbTransaccionenvio = cmbTransaccionenvio; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/VerificacionInformacionCertificado.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/VerificacionInformacionCertificado.java new file mode 100644 index 0000000..bc221af --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/VerificacionInformacionCertificado.java @@ -0,0 +1,375 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.sql.Date; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.event.AjaxBehaviorEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.inte.TarmColadeImpresion; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class VerificacionInformacionCertificado extends AbstractController { + + /* + * Variable que indica si se seleciona el check o no + */ + private Boolean verifica = false; + /* + * Variable que almacena el código de solicitud + */ + private String csolicitud; + /* + * Bean de tipo TarmSolicitud + */ + private TarmSolicitud solicitud = new TarmSolicitud(); + /* + * Bean del tipo ColaImpresionController + */ + private ColaImpresionController colaimpresion = new ColaImpresionController(); + + @ManagedProperty(value = "#{docHabilitanteController}") + private DocumentoHabilitanteController docHabilitanteController; + + @ManagedProperty(value = "#{solicitudController}") + private SolicitudController solicitudController; + + @ManagedProperty(value = "#{recepcionArmasController}") + private RecepcionArmasController recepcionArmasController; + + /** + * Constructor + * + * @throws Exception + */ + public VerificacionInformacionCertificado() throws Exception { + super(TarmSolicitudDocumento.class); + } + + /** + * Método invocado después de instanciar el controlador + * + * @throws Exception + */ + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + this.solicitud = SolicitudController.findSolicitudxcodsolicitud("135"); + this.getMfilters().put("pk.csolicitud", this.solicitud.getPk()); + this.getMfilelds().put("numerosolicitud", this.solicitud.getNumerosolicitud()); + + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se está utilizando una + * página que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "VERIFICARDOCUMENTOS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + SubQuery qry = new SubQuery("TarmSolicitud", "ccentrocontrol", "ccentrocontrol", "i.pk = t.pk.csolicitud"); + dto.addSubQuery(qry); + SubQuery qry2 = new SubQuery("TgeneCatalogDetail", "description", "tramitedesc", + "i.pk.catalog = (select a.tipotramite from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud)) and " + + "i.pk.catalogcode = (select a.tipotramitecodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud))"); + dto.addSubQuery(qry2); + SubQuery qry3 = new SubQuery("TgeneCatalogDetail", "description", "categoriadesc", + "i.pk.catalog = (select a.categoria from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud)) and " + + "i.pk.catalogcode = (select a.categoriacodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud))"); + dto.addSubQuery(qry3); + SubQuery qry4 = new SubQuery("TgeneCatalogDetail", "description", "usoactdesc", + "i.pk.catalog = (select a.usoactividad from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud)) and " + + "i.pk.catalogcode = (select a.usoactividadcodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud))"); + dto.addSubQuery(qry4); + SubQuery qry5 = new SubQuery("TarmDocumentoHabilitante", "fechaemision", "fechaemision", "i.pk = t.pk.cdocumento and i.csolicitud = t.pk.csolicitud"); + dto.addSubQuery(qry5); + SubQuery qry6 = new SubQuery("TarmDocumentoHabilitante", "fechaexpiracion", "fechaexpiracion", "i.pk = t.pk.cdocumento and i.csolicitud = t.pk.csolicitud"); + dto.addSubQuery(qry6); + SubQuery qry7 = new SubQuery("TgeneCatalogDetail", "description", "estado", + "i.pk.catalog = (select a.estado from TarmDocumentoHabilitante a where a.csolicitud = t.pk.csolicitud and a.pk = t.pk.cdocumento) and " + + "i.pk.catalogcode = (select a.estadocode from TarmDocumentoHabilitante a where a.csolicitud = t.pk.csolicitud and a.pk = t.pk.cdocumento)"); + dto.addSubQuery(qry7); + SubQuery qry8 = new SubQuery("TarmDocumentoHabilitante", "carma", "carma", "i.pk = t.pk.cdocumento and i.csolicitud = t.pk.csolicitud"); + dto.addSubQuery(qry8); + SubQuery qry9 = new SubQuery("TarmDocumentoHabilitante", "codigoarma", "codigoarma", "i.pk = t.pk.cdocumento and i.csolicitud = t.pk.csolicitud"); + dto.addSubQuery(qry9); + SubQuery qry10 = new SubQuery("TgeneCatalogDetail", "description", "tipoautorizacion", + "i.pk.catalog = (select a.tipoautorizacion from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud)) and " + + "i.pk.catalogcode = (select a.tipoautorizacioncodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud))"); + dto.addSubQuery(qry10); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + request.put("querytype", "P"); + request.put("queryalias", "VDOCUMENTO"); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + this.completaArmas(); + super.postQuery(this.lrecord); + lista(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Verifica la selección del documento según el check de + * reimpresion + */ + public void lista() { + for (TarmSolicitudDocumento solicituddoc : lrecord) { + if (solicituddoc.getChkcertificado() != null && solicituddoc.getChkcertificado().equals("Y")) { + solicituddoc.getModifiedData().put("verificador", Boolean.TRUE); + } else { + solicituddoc.getModifiedData().put("verificador", Boolean.FALSE); + } + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + this.actualizaVerificado(); + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Selecciona los registros para establecer si el registro se reimprime o + * no. + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if (Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")) { + valorColocar = Boolean.TRUE; + } + for (TarmSolicitudDocumento solicituddoc : lrecord) { + solicituddoc.getModifiedData().put("verificador", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Actualiza la selección del documento según el check de + * reimpresion + * + * @throws Exception + */ + public void actualizaVerificado() throws Exception { + for (TarmSolicitudDocumento solicituddoc : lrecord) { + if (solicituddoc.getModifiedData().get("verificador").equals(Boolean.TRUE)) { + solicituddoc.setChkcertificado("Y"); + } else { + solicituddoc.setChkcertificado("N"); + } + record = solicituddoc; + super.update(); + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaseDocumentos() { + try { + + DtoQuery dto = super.getDtoQuery(true); + + if (csolicitud != null) { + dto.addFiltro(new Filter("pk.csolicitud", csolicitud)); + } + + //solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(codigoSolicitud); + solicitud = ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(csolicitud); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (lrecord != null && !lrecord.isEmpty()) { + record = lrecord.get(0); + + seleccionarDocumentos(); + } + super.postQuery(lrecord); + + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método que asigna la selección del documento según + * el check de reimpresion + * + * @throws Exception + */ + @SuppressWarnings("unused") + private void seleccionarDocumentos() throws Exception { + for (int i = 0; i < lrecord.size(); i++) { + TarmSolicitudDocumento docSeleccionada = lrecord.get(i); + + if (docSeleccionada.getVerificado().equalsIgnoreCase("Y")) { + docSeleccionada.modifiedData().put("seleccion", Boolean.TRUE); + } else { + docSeleccionada.modifiedData().put("seleccion", Boolean.FALSE); + } + } + + } + + /** + * Método que completa la información del arma para los + * registros de la tabla TarmSolicitudDocumento + */ + public void completaArmas() { + for (int i = 0; i < this.lrecord.size(); i++) { + if (lrecord.get(i).getModifiedData().get("carma") != null) { + TarmArmas arm = ArmasController.findxCodigo(lrecord.get(i).getModifiedData().get("carma").toString()); + try { + lrecord.get(i).getModifiedData().put("clasearma", arm.modifiedData.get("clase").toString()); + } catch (Exception e) { + e.printStackTrace(); + } + try { + lrecord.get(i).getModifiedData().put("tipoarma", arm.modifiedData.get("tipo").toString()); + } catch (Exception e) { + e.printStackTrace(); + } + try { + lrecord.get(i).getModifiedData().put("marcaarma", arm.modifiedData.get("marca").toString()); + } catch (Exception e) { + e.printStackTrace(); + } + try { + lrecord.get(i).getModifiedData().put("calibrearma", arm.modifiedData.get("calibre").toString()); + } catch (Exception e) { + e.printStackTrace(); + } + try { + lrecord.get(i).getModifiedData().put("seriearma", arm.modifiedData.get("lote").toString()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + } + } + + public Boolean getVerifica() { + return verifica; + } + + public void setVerifica(Boolean verifica) { + this.verifica = verifica; + } + + public SolicitudController getSolicitudController() { + return solicitudController; + } + + public void setSolicitudController(SolicitudController solicitudController) { + this.solicitudController = solicitudController; + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public RecepcionArmasController getRecepcionArmasController() { + return recepcionArmasController; + } + + public void setRecepcionArmasController( + RecepcionArmasController recepcionArmasController) { + this.recepcionArmasController = recepcionArmasController; + } + + public DocumentoHabilitanteController getDocHabilitanteController() { + return docHabilitanteController; + } + + public void setDocHabilitanteController( + DocumentoHabilitanteController docHabilitanteController) { + this.docHabilitanteController = docHabilitanteController; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/VerificacionInformacionDevolucionController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/VerificacionInformacionDevolucionController.java new file mode 100644 index 0000000..1e7fc30 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/VerificacionInformacionDevolucionController.java @@ -0,0 +1,657 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.apache.commons.fileupload.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.armas.parametros.TiposArmasExplosivosController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTipoArmaExplosivo; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class VerificacionInformacionDevolucionController extends AbstractController { + + private TarmCentroControl centroControl; + TarmCentroControlJur jurisdiccionCentroControl; + private String nombreCentroControl; + TcustPersonDetail jefeCentroControl; + String gradoFuncionario = ""; + + private String csolicitud; + + private List lArmas = new ArrayList(); + + private Boolean seleccionTodas = false; + + TarmSolicitudTramite solicitudTramite; + TcustPersonDetail detallesPersona; + TcustPersonDetail usuario; + String numeroTramite; + String nombreRazonSocial; + String tipoDocumento; + private Boolean generaReporte = Boolean.FALSE; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + public VerificacionInformacionDevolucionController() throws Exception { + super(TarmSolicitudArmas.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + startQuery(); + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + csolicitud = super.getMfilters().get("csolicitud");//"cm:Decomiso/cm:A-2014/cm:M-10/cm:ENV-000000319/cm:ENV-000000319.pdf";// + if (csolicitud != null) { + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("CSOLICITUD", csolicitud); + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("TID", tid); + } + if (csolicitud == null) { + csolicitud = FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("CSOLICITUD").toString(); + } + if (tid == null) { + tid = "" + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TID"); + } + super.getMfilters().clear(); + super.getMfilters().put("pk.csolicitud", csolicitud); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "VERIFICACIONINFORMACIONCONTROLLER"; + querydatabase(); + + //Obteniendo el centro de control + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController direccion = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = direccion.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + this.jurisdiccionCentroControl = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + centroControl = CentroControlArmasController.findPorCodigo(this.jurisdiccionCentroControl.getCcentrocontrol()); + this.nombreCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), + centroControl.getNombreinstitucioncodigo()).getDescription(); + + //Obteniendo el jefe del centro de control + this.jefeCentroControl = PersonDetailController.find(this.centroControl.getPersoncode().toString()); + + //Obteniendo el grado del jefe del centro de control + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.jefeCentroControl.getMilitarygrade(), this.jefeCentroControl.getMilitarygradecode()); + if (grado != null) { + gradoFuncionario = grado.getDescription() + " - "; + } + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @Override + public void query() throws Exception { + // TODO Auto-generated method stub + MessageHelper.setMessageError("msg_notQuery"); + super.query(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + this.lArmas.clear(); + + DtoQuery dto = super.getDtoQuery(true); + + //Quemando el codigo de la solicitud + if (csolicitud != null) { + Filter filtro = new Filter("pk.csolicitud", csolicitud); + dto.addFiltro(filtro); + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("CSOLICITUD", csolicitud); + } else { + Filter filtro = new Filter("pk.csolicitud", "" + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("CSOLICITUD")); + dto.addFiltro(filtro); + } + + //Obteniendo el tramite + solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(csolicitud); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (lrecord != null && !lrecord.isEmpty()) { + + record = lrecord.get(0); + + //Numero de tramite + if (solicitudTramite != null) { + this.numeroTramite = solicitudTramite.getNumerotramite(); + this.record.put("ntramite", solicitudTramite.getNumerotramite()); + } + + //Obteniendo la solicitud + TarmSolicitud solicitud = ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(solicitudTramite.getPk().getCsolicitud()); + if (solicitud != null) { + detallesPersona = PersonDetailController.find(String.valueOf(solicitud.getPersoncode())); + } + + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + //Obteniendo las armas + for (TarmSolicitudArmas solicitudArmas : lrecord) { + TarmArmas arma = ArmasController.findPorCodigo(solicitudArmas.getPk().getCarma()); + if (arma != null) { + lArmas.add(arma); + } + } + actualizarArmas(); + } + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaseArmas() { + try { + this.lArmas.clear(); + + DtoQuery dto = super.getDtoQuery(true); + + if (csolicitud != null) { + dto.addFiltro(new Filter("pk.csolicitud", csolicitud)); + } + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (lrecord != null && !lrecord.isEmpty()) { + + record = lrecord.get(0); + + //Obteniendo las armas + for (TarmSolicitudArmas solicitudArmas : lrecord) { + TarmArmas arma = ArmasController.findPorCodigo(solicitudArmas.getPk().getCarma()); + if (arma != null) { + lArmas.add(ArmasController.findPorCodigo(solicitudArmas.getPk().getCarma())); + } + } + actualizarArmas(); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + + //Actualizando el estado de las armas + for (TarmArmas armaSeleccionada : lArmas) { + for (TarmSolicitudArmas solicitudArmas : lrecord) { + if (armaSeleccionada.getPk().equals(solicitudArmas.getPk().getCarma())) { + record = solicitudArmas; + if (armaSeleccionada.modifiedData().containsValue(Boolean.TRUE)) { + record.setPordevolucion("Y"); + } else { + record.setPordevolucion("N"); + } + update(); + } + } + } + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + generateReport(); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + if (!generaReporte) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generereporte")); + return; + } + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + //completa la tarea del flujo + request.modifiedData().put("csolicitud", csolicitud); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + request.modifiedData().put("isnew", "Y"); + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + MessageHelper.setMessageInfo("COMPLETA LA TAREA DEL FLUJO"); + generaReporte = Boolean.FALSE; + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().remove("TID"); + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().remove("CSOLICITUD"); + org.primefaces.context.RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Salva los datos de la verificaion + */ + public String saveVerification() { + String direccion = ""; + try { + + //Actualizando el estado de las armas + for (TarmArmas armaSeleccionada : lArmas) { + for (TarmSolicitudArmas solicitudArmas : lrecord) { + if (armaSeleccionada.getPk().equals(solicitudArmas.getPk().getCarma())) { + record = solicitudArmas; + if (armaSeleccionada.modifiedData().containsValue(Boolean.TRUE)) { + record.setPordevolucion("Y"); + } else { + record.setPordevolucion("N"); + } + update(); + } + } + } + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + direccion = "/pages/armas/registrarNovedad?faces-redirect=true?csolicitud=" + csolicitud; + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + return direccion; + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Genera el reporte de la verificacion de las armas + * + * @param name Nombre del reporte a generar. + */ + public void generateReport() { + String path = "armas/reports/actaDevolucion2"; + String filename = MsgControlArmas.getProperty("lbl_actaDeDevolucion"); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + parameters.put("numeroTramite", this.numeroTramite); + + //Nombre del centro de control + parameters.put("nombreCentro", this.nombreCentroControl); + + //Fecha + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + + //Nombre y cedula + parameters.put("nombreRazon", detallesPersona.getName()); + parameters.put("cedula", detallesPersona.getIdentification()); + + //Codigo persona + parameters.put("personcode", usuario.getPk().getPersoncode()); + + //Funcionario + parameters.put("gradoNombreFuncionario", gradoFuncionario + this.jefeCentroControl.getName()); + parameters.put("personcode", this.jefeCentroControl.getPk().getPersoncode()); + parameters.put("centroControl", "JEFE DEL " + this.nombreCentroControl); + + //Usuario + parameters.put("usuario", this.usuario.getName()); + sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + String fechaHora = sdf.format(Calendar.getInstance().getTime()); + parameters.put("fechaHora", fechaHora); + + String format = "pdf"; + + try { + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + // + generaReporte = Boolean.TRUE; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Metodod que asigna la seleccion del arma segun el estado de la solicitud + * arma + * + * @throws Exception + */ + @SuppressWarnings("unused") + private void actualizarArmas() throws Exception { + for (TarmSolicitudArmas solicitudArmas : lrecord) { + for (int i = 0; i < lArmas.size(); i++) { + TarmArmas armaSeleccionada = lArmas.get(i); + if (armaSeleccionada.getPk().equals(solicitudArmas.getPk().getCarma())) { + if (solicitudArmas.getPordevolucion() != null && !solicitudArmas.getPordevolucion().isEmpty() + && solicitudArmas.getPordevolucion().equalsIgnoreCase("Y")) { + armaSeleccionada.modifiedData().put("seleccion", Boolean.TRUE); + } else { + armaSeleccionada.modifiedData().put("seleccion", Boolean.FALSE); + } + } + } + } + } + + /** + * Metodo que selecciona todas las armas + */ + public void seleccionarTodasArmas() { + for (TarmArmas arma : lArmas) { + arma.put("seleccion", Boolean.TRUE); + } + } + + /** + * Obtiene los detalles de las armas segun el catalogo + * + * @param catalogo + * @param catalogoCode + * @return + */ + public String aspectoArmaCatalogo(String catalogo, String catalogoCode) { + if (catalogo != null && catalogoCode != null && !catalogo.isEmpty() && !catalogoCode.isEmpty()) { + return CatalogDetailController.findxCodigoCodcatalogo(catalogo, catalogoCode).getDescription(); + } + return null; + } + + /** + * Devuelve una descripcion de catalogo segun un tipo de aspecto + * + * @param arma + * @param tipoAspecto + * @return + */ + public String aspectoArmaExplosivoCatalogo(TarmArmas arma, String tipoAspecto) { + String aspecto = ""; + + try { + TarmTipoArmaExplosivo explosivo = TiposArmasExplosivosController.findarma(arma.getCtipoarmaexplosivo()); + if (explosivo != null) { + if (tipoAspecto.equalsIgnoreCase("clase") && explosivo.getClase() != null && !explosivo.getClase().isEmpty() + && explosivo.getClasecodigo() != null && !explosivo.getClasecodigo().isEmpty()) { + aspecto = CatalogDetailController.findxCodigoCodcatalogo(explosivo.getClase(), explosivo.getClasecodigo()).getDescription(); + + } else if (tipoAspecto.equalsIgnoreCase("tipo") && explosivo.getTipoarmaexplosivo() != null && !explosivo.getTipoarmaexplosivo().isEmpty() + && explosivo.getTipoarmaexplosivocodigo() != null && !explosivo.getTipoarmaexplosivocodigo().isEmpty()) { + aspecto = CatalogDetailController.findxCodigoCodcatalogo(explosivo.getTipoarmaexplosivo(), explosivo.getTipoarmaexplosivocodigo()).getDescription(); + + } else if (tipoAspecto.equalsIgnoreCase("calibre") && explosivo.getCalibre() != null && !explosivo.getCalibre().isEmpty() + && explosivo.getCalibrecodigo() != null && !explosivo.getCalibrecodigo().isEmpty()) { + aspecto = CatalogDetailController.findxCodigoCodcatalogo(explosivo.getCalibre(), explosivo.getCalibrecodigo()).getDescription(); + } + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + return aspecto; + } + + public String aspectoExplosivoArma(TarmSolicitudArmas solicitudArma, String aspecto) { + String descripcionAspecto = ""; + try { + TarmArmas arma = ArmasController.findPorCodigo(solicitudArma.getPk().getCarma()); + + if (arma != null) { + return this.aspectoArmaExplosivoCatalogo(arma, aspecto); + } + + } catch (Exception e) { + MessageHelper.setMessageWarn(e.getMessage()); + } + + return descripcionAspecto; + } + + /** + * Incrementa el numero del arma + * + * @param arma + * @return + */ + public int incrementarRowkey(TarmArmas arma) { + int n = 0; + + for (int i = 0; i < lArmas.size(); i++) { + if (arma.getPk() == lArmas.get(i).getPk()) { + n = i + 1; + break; + } + } + + return n; + } + + /** + * M\u00e9todo para encontrar por solicitud + * + * @param solicitudCode + * @return + */ + public static List findSolicitudArmas(String solicitudCode) { + try { + VerificacionInformacionDevolucionController cc = new VerificacionInformacionDevolucionController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.csolicitud", solicitudCode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public List getlArmas() { + return lArmas; + } + + public void setlArmas(List lArmas) { + this.lArmas = lArmas; + } + + public Boolean getSeleccionTodas() { + int verificadas = 0; + for (TarmArmas arma : lArmas) { + if (Boolean.parseBoolean(arma.modifiedData.get("seleccion").toString()) == Boolean.TRUE) { + verificadas++; + } + } + if (verificadas == lArmas.size()) { + seleccionTodas = true; + } else { + seleccionTodas = false; + } + + return seleccionTodas; + } + + public void setSeleccionTodas(Boolean seleccionTodas) { + this.seleccionTodas = seleccionTodas; + + if (this.seleccionTodas) { + for (TarmArmas arma : lArmas) { + arma.put("seleccion", Boolean.TRUE); + } + } else { + for (TarmArmas arma : lArmas) { + arma.put("seleccion", Boolean.FALSE); + } + } + + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public Boolean getGeneraReporte() { + return generaReporte; + } + + public void setGeneraReporte(Boolean generaReporte) { + this.generaReporte = generaReporte; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/VerificacionReimpresion.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/VerificacionReimpresion.java new file mode 100644 index 0000000..f7e1db5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/VerificacionReimpresion.java @@ -0,0 +1,555 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.event.AjaxBehaviorEvent; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.inte.TarmColadeImpresion; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmArmas; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudDocumento; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class VerificacionReimpresion extends AbstractController { + + /* + * Variable que indica si se seleciona el check o no + */ + private Boolean verifica = false; + + /** + * Variable que indica si se ha seleccionado un registro + */ + private boolean esCola = false; + + /** + * Hailita el boton del flujo + */ + private boolean btnFlujo = false; + /* + * Variable que almacena el código de solicitud + */ + private String csolicitud; + /* + * Bean de tipo TarmSolicitud + */ + private TarmSolicitud solicitud = new TarmSolicitud(); + + @ManagedProperty(value = "#{docHabilitanteController}") + private DocumentoHabilitanteController docHabilitanteController; + + @ManagedProperty(value = "#{solicitudController}") + private SolicitudController solicitudController; + + @ManagedProperty(value = "#{recepcionArmasController}") + private RecepcionArmasController recepcionArmasController; + + @ManagedProperty(value = "#{colaImpresionController}") + private ColaImpresionController colaImpresionController; + + /** + * Constructor + * + * @throws Exception + */ + public VerificacionReimpresion() throws Exception { + super(TarmSolicitudDocumento.class); + } + + /** + * Método invocado después de instanciar el controlador + * + * @throws Exception + */ + @PostConstruct + private void postconstruct() throws Exception { + // Inicializa autoconsulta + this.pasteBpmScreenParameters(); + super.startQuery(); + + if (super.getMfilters().get("csolicitud") == null || super.getMfilters().get("csolicitud").isEmpty()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_noexistesolicitud")); + return; + } + + csolicitud = super.getMfilters().get("csolicitud"); + this.getMfilters().clear(); + //this.getMfilters().put("pk.csolicitud", csolicitud); + this.solicitud = SolicitudController.findSolicitudxcodsolicitud(csolicitud); + this.getMfilelds().put("numerosolicitud", this.solicitud.getNumerosolicitud()); + + this.init(); + } + + /** + * Incializa variables del controlador, cuando se está utilizando una + * página que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "VERIFICARDOCUMENTOS"; + querydatabase(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + Filter filtroSinImpresionSolicitud = new Filter(); + filtroSinImpresionSolicitud.setSql("(t.chkimpresion='N' or t.chkimpresion is null) and t.pk.csolicitud = '" + this.solicitud.getPk() + "'"); + dto.addFiltro(filtroSinImpresionSolicitud); + + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + SubQuery qry = new SubQuery("TarmSolicitud", "ccentrocontrol", "ccentrocontrol", "i.pk = t.pk.csolicitud"); + dto.addSubQuery(qry); + SubQuery qry2 = new SubQuery("TgeneCatalogDetail", "description", "tramitedesc", + "i.pk.catalog = (select a.tipotramite from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento))) "// t.pk.csolicitud + + " and " + + "i.pk.catalogcode = (select a.tipotramitecodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))"); + dto.addSubQuery(qry2); + SubQuery qry3 = new SubQuery("TgeneCatalogDetail", "description", "categoriadesc", + "i.pk.catalog = (select a.categoria from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))" + + " and " + + "i.pk.catalogcode = (select a.categoriacodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))"); + dto.addSubQuery(qry3); + SubQuery qry4 = new SubQuery("TgeneCatalogDetail", "description", "usoactdesc", + "i.pk.catalog = (select a.usoactividad from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))" + + " and " + + "i.pk.catalogcode = (select a.usoactividadcodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = (select o.csolicitud from TarmDocumentoHabilitante o where o.pk=t.pk.cdocumento)))"); + dto.addSubQuery(qry4); + + //ubicacion + SubQuery qryUbicacion = new SubQuery("TgeneProvince", "description", "ubicaciondesc", + "i.pk.countrycode = 'EC'" + + " and " + + "i.pk.provincecode = (select a.provincecode from TcustPersonAddress a where a.pk.personcode =(select o.personcode from TarmDocumentoHabilitante o where o.pk= t.pk.cdocumento )" + + " and a.principal='Y'" + + " and a.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD') )");// + dto.addSubQuery(qryUbicacion); + //TarmSolicitudDocumento + + SubQuery qry5 = new SubQuery("TarmDocumentoHabilitante", "fechaemision", "fechaemision", "i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry5); + SubQuery qry6 = new SubQuery("TarmDocumentoHabilitante", "fechaexpiracion", "fechaexpiracion", "i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry6); + SubQuery qry61 = new SubQuery("TarmDocumentoHabilitante", "estado ", "estado1", "i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry61); + SubQuery qry611 = new SubQuery("TarmDocumentoHabilitante", "estadocode ", "estado11", "i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry611); + SubQuery qry7 = new SubQuery("TgeneCatalogDetail", "description", "estado", + "i.pk.catalog = (select a.estado from TarmDocumentoHabilitante a where a.pk= t.pk.cdocumento) and " + + "i.pk.catalogcode = (select a.estadocode from TarmDocumentoHabilitante a where a.pk= t.pk.cdocumento)"); + dto.addSubQuery(qry7); + SubQuery qry8 = new SubQuery("TarmDocumentoHabilitante", "carma", "carma", "i.pk = t.pk.cdocumento and i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry8); + SubQuery qry9 = new SubQuery("TarmDocumentoHabilitante", "codigoarma", "codigoarma", "i.pk= t.pk.cdocumento"); + dto.addSubQuery(qry9); + SubQuery qry10 = new SubQuery("TgeneCatalogDetail", "description", "tipoautorizacion", + "i.pk.catalog = (select a.tipoautorizacion from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud)) and " + + "i.pk.catalogcode = (select a.tipoautorizacioncodigo from TarmTramite a where a.pk = (select s.ctramite from TarmSolicitud s where s.pk = t.pk.csolicitud))"); + dto.addSubQuery(qry10); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + request.put("querytype", "P"); + request.put("queryalias", "VDOCUMENTO"); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + this.completaArmas(); + super.postQuery(this.lrecord); + lista(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Verifica la selección del documento según el check de + * reimpresion + */ + public void lista() { + for (TarmSolicitudDocumento solicituddoc : lrecord) { + if (solicituddoc.getChkimpresion() != null && solicituddoc.getChkimpresion().equals("Y")) { + solicituddoc.getModifiedData().put("verificador", Boolean.TRUE); + } else { + solicituddoc.getModifiedData().put("verificador", Boolean.FALSE); + } + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + if (!validaSeleccion()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_reimpresion")); + return; + } + + this.actualizaVerificado(); + + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + dtosave.setPosition(2); + +// if(!dtosave.pendingProcess()){ +// return; +// } + //En caso de que los documentos sean de tipo de cola de impresion + enviaColaImpresion(); + + DtoSave dtosacola = colaImpresionController.getDtoSave(); + dtosacola.setReturnpk(true); + dtosacola.setPosition(1); + + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + msave.put(colaImpresionController.getBeanalias(), dtosacola); + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + btnFlujo = Boolean.TRUE; + this.postCommit(resp); + this.colaImpresionController.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Selecciona los registros para establecer si el registro se reimprime o + * no. + */ + public void seleccionarTodos(AjaxBehaviorEvent event) { + try { + Boolean valorColocar = Boolean.FALSE; + if (Boolean.valueOf(event.getComponent().getAttributes().get("value") != null ? event.getComponent().getAttributes().get("value").toString() : "false")) { + valorColocar = Boolean.TRUE; + } + for (TarmSolicitudDocumento solicituddoc : lrecord) { + solicituddoc.getModifiedData().put("verificador", valorColocar); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Actualiza la selección del documento según el check de + * reimpresion + * + * @throws Exception + */ + public void actualizaVerificado() throws Exception { + for (TarmSolicitudDocumento solicituddoc : lrecord) { + if (solicituddoc.getModifiedData().get("verificador").equals(Boolean.TRUE)) { + solicituddoc.setChkimpresion("Y"); + } else { + solicituddoc.setChkimpresion("N"); + } + record = solicituddoc; + super.update(); + } + } + + /** + * + */ + @SuppressWarnings("unchecked") + protected void querydatabaseDocumentos() { + try { + + DtoQuery dto = super.getDtoQuery(true); + + if (csolicitud != null) { + dto.addFiltro(new Filter("pk.csolicitud", csolicitud)); + } + + //solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(codigoSolicitud); + solicitud = ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(csolicitud); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (lrecord != null && !lrecord.isEmpty()) { + record = lrecord.get(0); + + seleccionarDocumentos(); + } + super.postQuery(lrecord); + + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método que asigna la selección del documento según + * el check de reimpresion + * + * @throws Exception + */ + @SuppressWarnings("unused") + private void seleccionarDocumentos() throws Exception { + for (int i = 0; i < lrecord.size(); i++) { + TarmSolicitudDocumento docSeleccionada = lrecord.get(i); + if (docSeleccionada.getVerificado().equalsIgnoreCase("Y")) { + docSeleccionada.modifiedData().put("seleccion", Boolean.TRUE); + } else { + docSeleccionada.modifiedData().put("seleccion", Boolean.FALSE); + } + } + + } + + /** + * Método que completa la información del arma para los + * registros de la tabla TarmSolicitudDocumento + */ + public void completaArmas() { + for (int i = 0; i < this.lrecord.size(); i++) { + if (lrecord.get(i).getModifiedData().get("carma") != null) { + TarmArmas arm = ArmasController.findxCodigo(lrecord.get(i).getModifiedData().get("carma").toString()); + try { + lrecord.get(i).getModifiedData().put("codigoarma", arm.getCodigoarma() == null ? "" : arm.getCodigoarma()); + } catch (Exception e) { + e.printStackTrace(); + } + + try { + lrecord.get(i).getModifiedData().put("clasearma", arm.modifiedData.get("clase") == null ? "" : arm.modifiedData.get("clase").toString()); + } catch (Exception e) { + e.printStackTrace(); + } + try { + lrecord.get(i).getModifiedData().put("tipoarma", arm.modifiedData.get("tipo") == null ? "" : arm.modifiedData.get("tipo").toString()); + } catch (Exception e) { + e.printStackTrace(); + } + try { + lrecord.get(i).getModifiedData().put("marcaarma", arm.modifiedData.get("marca") == null ? "" : arm.modifiedData.get("marca").toString()); + } catch (Exception e) { + e.printStackTrace(); + } + try { + lrecord.get(i).getModifiedData().put("calibrearma", arm.modifiedData.get("calibre") == null ? "" : arm.modifiedData.get("calibre").toString()); + } catch (Exception e) { + e.printStackTrace(); + } + try { + lrecord.get(i).getModifiedData().put("seriearma", arm.getLote() == null ? "" : arm.getLote()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + } + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + //request.modifiedData().put("csolicitud", this.solicitud.getPk()); + request.modifiedData().put("TID", tid); + if (esCola) { + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); + } else { + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "D" : bpmDataStatus); + } + // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + btnFlujo = Boolean.FALSE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Valida que se haya seleccionado documento + * + * @return + */ + private boolean validaSeleccion() { + for (TarmSolicitudDocumento documento : this.lrecord) { //modifiedData['verificador'] + if (documento.getModifiedData().get("verificador") != null && documento.getModifiedData().get("verificador").toString().equals("true")) { + return true; + } + } + return false; + } + + /** + * Método que envia cada registro a la cola de impresión + * cuando el tipo de autorización es PERMISO + * + * @throws Exception + */ + public void enviaColaImpresion() throws Exception { + for (TarmSolicitudDocumento documento : this.lrecord) { + if (documento.getModifiedData().get("verificador").equals(Boolean.TRUE)) { + TarmDocumentoHabilitante habilitante = DocumentoHabilitanteController.findPorCDocumento(documento.getPk().getCdocumento().toString()); + TarmTramite tramite = TarmTramiteController.findSimple(String.valueOf(habilitante.getCtramite())); + if (tramite == null || tramite.getTipoarchivo() == null || tramite.getTipoarchivo().isEmpty() || tramite.getTipoarchivocodigo() == null || tramite.getTipoarchivocodigo().isEmpty()) { + throw new Exception(); + } + TgeneCatalogDetail tipoArchivoTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipoarchivo(), tramite.getTipoarchivocodigo()); + if ("CARNET".equalsIgnoreCase(tipoArchivoTramite.getDescription())) {// + // Verifico si el documento se encuentra en cola de impresion + List documentosEnColaList = ColaImpresionController.findByDocumentoEstado(habilitante.getPk().toString(), "PIMPR"); + if (documentosEnColaList == null || documentosEnColaList.size() == 0) { + esCola = true; + TarmColadeImpresion colaimpr = new TarmColadeImpresion(); + colaimpr.setCdocumento(habilitante.getPk()); + colaimpr.setEstadoimpresion("PIMPR"); + colaimpr.setEstadoimpresioncode("ESTADOIMPRESION"); + colaimpr.setFecharegistro(habilitante.getFechaemision()); + colaimpr.setIsnew(Boolean.TRUE); + colaImpresionController.update(colaimpr); + } + } + } + + } + } + + public Boolean getVerifica() { + return verifica; + } + + public void setVerifica(Boolean verifica) { + this.verifica = verifica; + } + + public SolicitudController getSolicitudController() { + return solicitudController; + } + + public void setSolicitudController(SolicitudController solicitudController) { + this.solicitudController = solicitudController; + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public RecepcionArmasController getRecepcionArmasController() { + return recepcionArmasController; + } + + public void setRecepcionArmasController( + RecepcionArmasController recepcionArmasController) { + this.recepcionArmasController = recepcionArmasController; + } + + public DocumentoHabilitanteController getDocHabilitanteController() { + return docHabilitanteController; + } + + public void setDocHabilitanteController( + DocumentoHabilitanteController docHabilitanteController) { + this.docHabilitanteController = docHabilitanteController; + } + + public ColaImpresionController getColaImpresionController() { + return colaImpresionController; + } + + public void setColaImpresionController( + ColaImpresionController colaImpresionController) { + this.colaImpresionController = colaImpresionController; + } + + public boolean isBtnFlujo() { + return btnFlujo; + } + + public void setBtnFlujo(boolean btnFlujo) { + this.btnFlujo = btnFlujo; + } + + public boolean isEsCola() { + return esCola; + } + + public void setEsCola(boolean esCola) { + this.esCola = esCola; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/VerificacionRequisitosSolicitudController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/VerificacionRequisitosSolicitudController.java new file mode 100644 index 0000000..7b602df --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/VerificacionRequisitosSolicitudController.java @@ -0,0 +1,1125 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.math.BigDecimal; +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.funcionalidad.CargaController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.IngresoDatosTipoTramite; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.date.TgeneNotAccountingDayController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.parmas.fun.TarmCarga; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmAgenciaArma; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudAgenciaSucursal; +import com.fp.persistence.parmas.soli.TarmSolicitudArmas; +import com.fp.persistence.parmas.soli.TarmSolicitudRequisitos; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.parmas.soli.TarmSolicitudTramiteKey; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora para la verificacion de los requisitos del tramite. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class VerificacionRequisitosSolicitudController extends AbstractController { + + /** + * codigo del flujo + */ + private String codigoSolicitud; + private BigDecimal costoTramite = new BigDecimal("0"); + private BigDecimal numeroArmas = new BigDecimal("0"); + private BigDecimal numeroDocuementos = new BigDecimal("0"); + private BigDecimal cantidad = new BigDecimal("0"); + private String numeroTramite; + private String tipoautorizacion; + private String usoactividad; + private Boolean btnGuardar = Boolean.FALSE; + private Boolean requiereCustodiosBln; + private Boolean requiereNoSolAucpBln; + + private List armas; + /** + * Fecha de atencion del proximo tramite + */ + private java.util.Date fechaAtencionTramite; + /** + * Bandera de tipo booleano para indicar si se habilita el boton de + * completar tarea + */ + private Boolean isEnableCompletarTarea = Boolean.FALSE; + + /** + * Codigo de la tabla TGENECATALOGDETAIL para indicar que el tipo de costo + * es Total + */ + private final String TIPOCOSTOTOTAL = "2"; + /** + * Codigo de la tabla TGENECATALOGDETAIL para indicar que el registro a + * buscarse eN CATALOG es COSTOCUSTODIO + */ + private final String CODIGOCOSTOCUSTODIO = "COSTOCUSTODIO"; + + /** + * Variable del tipo TarmSolicitudnal + */ + private TarmSolicitud recordsolicitud; + /** + * Variable del tipo TarmSolicitudnal + */ + TarmSolicitudTramite recordSolicitudTra; + + /** + * Variable del tipo TgeneCatalogDetail(catalogo del tipo de documento) + */ + private TgeneCatalogDetail nombreDocumento; + /** + * Variable del tipo TgeneCatalogDetail(catalogo del tramite) + */ + private TgeneCatalogDetail nombreTramite; + /** + * Variable del tipo TgeneCatalogDetail(catalogo de la categoria) + */ + private TgeneCatalogDetail nombreCategoria; + /** + * Variable del tipo TgeneCatalogDetail(catalogo del uso actividad del + * tramite) + */ + private TgeneCatalogDetail nombreUsoActividad; + /** + * lista del catalogo de las acciones (Aceptar o rechazar) + */ + private List laccion; + /** + * atributo para el estado de la solicitud aprobado o anulado + */ + private String estado; + /** + * observacion de la solicitud + */ + private String observacion; + /** + * controlador de los requisitos de la solicitud + */ + @ManagedProperty(value = "#{solicitudRequisitosController}") + private SolicitudRequisitosController requisitos; + /** + * controlador si aprueban la solicitud se genera el numero de tramite + */ + @ManagedProperty(value = "#{solicitudTramiteController}") + private SolicitudTramiteController solicitudTramiteController; + /** + * controlador de la solicitud + */ + @ManagedProperty(value = "#{solicitudArmasController}") + private SolicitudArmasController solicitud; + /** + * controlador para el manejo de los archivos del alfresco + */ + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + /** + * Controlador del tramite + */ + @ManagedProperty(value = "#{ingresoDatosTipoTramite}") + private IngresoDatosTipoTramite tramite; + + /** + * Propiedad usada para el manejo del centro de control de armas + */ + @ManagedProperty(value = "#{centroControlArmasController}") + private CentroControlArmasController centroControlArmasController; + + /** + * Controlador de Documento Habilitante + */ + @ManagedProperty(value = "#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitanteController; + + /** + * Controlador que maneja las armas asociadas a las agencias + */ + @ManagedProperty(value = "#{agenciaArmaController}") + private AgenciaArmaController agenciaArma; + + /** + * Referencia al Centro de control; + */ + private TarmCentroControl centroControl = new TarmCentroControl(); + + /** + * Nombre de la Institucion + */ + private String nombreInstitucion; + + public VerificacionRequisitosSolicitudController() throws Exception { + super(AbstractDataTransport.class); + } + + /** + * Controlador que maneja cargas para previa importacion + */ + @ManagedProperty(value = "#{cargaController}") + private CargaController cargaController; + + @PostConstruct + private void postconstruct() { + + try { + super.startQuery(); + fechaAtencionTramite = new Date(new java.util.Date().getTime()); + /** IMPORTANTE BORRAR SACAR TAMBIEN LA VENTANA DE CLIENTE*/ + codigoSolicitud = this.getMfilters().get("codigoSolicitud") + != null ?this.getMfilters().get("codigoSolicitud") : "4290"; + + int numArmasInt = TarmSolicitudArmasController.getNumeroArmasPorSolicitud(codigoSolicitud); + + numeroArmas = new BigDecimal(numArmasInt); + habilitarIngresoCustodios(); + this.getMfilters().clear(); + this.getRequisitos().getMfilters().clear(); + this.getSolicitud().getMfilters().clear(); + this.getSolicitudTramiteController().getMfilters().clear(); + this.getTramite().getMfilters().clear(); + this.init(); + cargaDatos(); + mostrarNoSolAucp(); + } catch (Exception e) { + e.printStackTrace(); + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que se encarga de determinar si se requiere o no ingresar numero + * de custodios + */ + private void habilitarIngresoCustodios() { + TgeneParameters minArmasReqCustodiaObj = ParametersController.find("NUMERO.ARMAS.FLUJO", "1"); + if (numeroArmas.compareTo(minArmasReqCustodiaObj.getNumbervalue()) <= 0) { + requiereCustodiosBln = Boolean.FALSE; + } else { + requiereCustodiosBln = Boolean.TRUE; + } + } + + /** + * Metodo que se encarga de mostrar el numero de solicitud aucp o no si la + * categoria es igual previa importacion + */ + private void mostrarNoSolAucp() { + // CATEGORIA 14 PREVIA IMPORTACION + TarmTramite tarmTramite = TarmTramiteController.find(this.recordsolicitud.getCtramite().toString()); + if (tarmTramite.getCategoria().equals("14")) { + requiereNoSolAucpBln = Boolean.TRUE; + } else { + requiereNoSolAucpBln = Boolean.FALSE; + } + + } + + /** + * Metodo para obtener los datos iniciales + * + * @throws Exception + */ + public void cargaDatos() throws Exception { + //solicitud(Persona tramite) + recordsolicitud = SolicitudArmasController.find(codigoSolicitud); + this.armas = TarmSolicitudArmasController.findPorCSolicitud(this.codigoSolicitud); + //Comprobando que tenga tramites anteriores caducados + //Obteniendo la solicitud + TarmSolicitud solicitud = SolicitudController.findSolicitudxcodsolicitud(this.codigoSolicitud); + +// if(solicitud!=null){ + //Obteniendo el tramite de la solicitud +// TarmTramite tramite=TarmTramiteController.find(solicitud.getCtramite().toString()); + //Validando que el tipo de tramite sea de Renovacion +// if(tramite.getTipotramite().equalsIgnoreCase("3")){ + //Obteniendo los documentos habilitantes +// List documentosPersona=DocumentoHabilitanteController.findPorPersoncode(solicitud.getPersoncode().toString()); +// List documentosTramite=new ArrayList(); +// List tramites=new ArrayList(); +// for (TarmDocumentoHabilitante d : documentosPersona) { +// //Obteniendo el tramite del documento +// TarmTramite t=TarmTramiteController.find(d.getCtramite().toString()); +// if(t!=null && t.getTipoautorizacion().equalsIgnoreCase(tramite.getTipoautorizacion()) +// && t.getCategoria().equalsIgnoreCase(tramite.getCategoria()) +// && t.getUsoactividad().equalsIgnoreCase(tramite.getUsoactividad())){ +// tramites.add(t); +// documentosTramite.add(d); +// } +// } + //Obteniendo el documento de mayor fecha(ultimo documento) +// TarmDocumentoHabilitante ultimoDocumento=documentosTramite.get(0); +// TarmTramite ultimoTramite=tramites.get(0); +// +// for (int i = 1; i < documentosTramite.size(); i++) { +// if(documentosTramite.get(i).getFechaemision().after(ultimoDocumento.getFechaemision())){ +// ultimoDocumento=documentosTramite.get(i); +// ultimoTramite=tramites.get(i); +// } +// } + //Verificando que el documento este caducado +// Date fechaActual=new Date(Calendar.getInstance().getTimeInMillis()); +// if(ultimoDocumento.getFechaexpiracion().before(fechaActual)){ +// //Calculando el valor de la multa +// Long MILISEGUNDOS_POR_DIA = 24 * 60 * 60 * 1000L; //Milisegundos al dia +// java.util.Date fechaActual2=Calendar.getInstance().getTime(); +// +// Calendar calendar=Calendar.getInstance(); +// calendar.setTime(ultimoDocumento.getFechaexpiracion()); +// java.sql.Date fechaAnterior = new java.sql.Date(calendar.getTimeInMillis()); +// +// Long diferenciaDias = ( fechaActual2.getTime() - fechaAnterior.getTime() )/MILISEGUNDOS_POR_DIA; +// Double valorMulta=0.0; +// Double multaConfig=0.0; +// if(tramite.getMulta()!=null){ +// multaConfig=Double.parseDouble(tramite.getMulta().toString()); +// } +// +// //Autorizacion +// if(ultimoTramite.getTipoautorizacion().equalsIgnoreCase("1")){ +// if(diferenciaDias>30){ +// valorMulta=multaConfig*((diferenciaDias-30)/365); +// } +// +// //Permiso +// }else if(ultimoTramite.getTipoautorizacion().equalsIgnoreCase("6")){ +// //Obteniendo las armas +// this.armas= TarmSolicitudArmasController.findPorCSolicitud(this.codigoSolicitud); +// int totalArmas=this.armas.size(); +// valorMulta=(multaConfig/12)*(diferenciaDias/30)*totalArmas; +// } +// +// this.recordsolicitud.setMulta(new BigDecimal(valorMulta.toString())); +// this.recordsolicitud.setMulta(BigDecimal.ZERO); +// } +// } +// } + //nombre documento + nombreDocumento = CatalogDetailController.findxCodigoCodcatalogo(recordsolicitud.getModifiedData().get("identificationcatalog").toString(), recordsolicitud.getModifiedData().get("identificationcatalogcode").toString()); + if (nombreDocumento != null) { + //Tramite + nombreTramite = CatalogDetailController.findxCodigoCodcatalogo(recordsolicitud.getModifiedData().get("tipoautorizacion").toString(), recordsolicitud.getModifiedData().get("tipoautorizacioncodigo").toString()); + nombreCategoria = CatalogDetailController.findxCodigoCodcatalogo(recordsolicitud.getModifiedData().get("categoria").toString(), recordsolicitud.getModifiedData().get("categoriacodigo").toString()); + nombreUsoActividad = CatalogDetailController.findxCodigoCodcatalogo(recordsolicitud.getModifiedData().get("usoactividad").toString(), recordsolicitud.getModifiedData().get("usoactividadcodigo").toString()); + //lista de requisitos + requisitos.getMfilters().put("pk.csolicitud", codigoSolicitud); + requisitos.query(); + //variable para validar el boton + requisitos.setAuxBotonVerificacion(Boolean.TRUE); + for (TarmSolicitudRequisitos item : requisitos.getLrecord()) { + if (item.getEstadovalidacion() != null && item.getEstadovalidacion().equals("Y")) { + item.modifiedData().put("estado", Boolean.TRUE); + } else { + //item.modifiedData().put("estado", Boolean.FALSE); + requisitos.setAuxBotonVerificacion(Boolean.FALSE); + } + } + this.obtenerCentroControl(solicitud); + //valida lo del combo del flujo + validacioComboFlujo(); + } else { + MessageHelper.setMessageError("NO EXISTE SOLICITUD PENDIENTE"); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + @SuppressWarnings("unused") + private void init() { + TgeneParameters parametersAutorizacion = ParametersController.find("CODIGO.GUIA.LIBRETRANSITO", "1"); //4 + TgeneParameters parametersUsoActividad = ParametersController.find("CODIGO.FUEGOS.PIROTECNICOS", "1");//17 + tipoautorizacion = parametersAutorizacion.getTextvalue(); + usoactividad = parametersUsoActividad.getTextvalue(); + } + + /** + * Metodo para cargar actualizar la solicitud validando que el numero de + * custodio sea mayor a cero y cumpla con la condicion + * + * @throws Exception + */ + public void cargarSolicitud() throws Exception { + recordsolicitud.setFverificarequisitos(new Date(new java.util.Date().getTime())); + if (codigoAceptado().equals(estado)) { + //validacion drf Tramite es Guia de Libre Transito y el Uso/Actividad es diferente a Fuegos Pirotecnicos, el campo No. Custodios sea mayor que cero. + if (recordsolicitud.getModifiedData().get("tipoautorizacion").toString().equals(tipoautorizacion) + && !recordsolicitud.getModifiedData().get("usoactividad").toString().equals(usoactividad)) { + if (recordsolicitud.getNumerocustodios() < 0) { + MessageHelper.setMessageError("EL N\u00DAMERO DE CUSTODIOS DEBE SER POSITIVO"); + return; + } + } + recordsolicitud.setObservacion(observacion); + recordsolicitud.setEstado(estado); + recordsolicitud.setEstadocodigo("ESTADOSOLICITUD"); + solicitud.update(recordsolicitud); + } else { + recordsolicitud.setObservacion(observacion); + recordsolicitud.setEstadocodigo("ESTADOSOLICITUD"); + recordsolicitud.setEstado(estado);//ACCION + solicitud.update(recordsolicitud); + } + + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @param solicitud + * @throws Exception + * + */ + private void obtenerCentroControl(TarmSolicitud solicitud) throws Exception { + + this.centroControl = CentroControlArmasController.findPorCodigo(solicitud.getCcentrocontrol()); + this.setNombreInstitucion(CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + + } + + /** + * Metodo para cargar el registro de la solicitud tramite en la lista new + * + * @throws Exception + */ + public void cargaDatosSolicitudTramite() throws Exception { + recordSolicitudTra = new TarmSolicitudTramite(); + TarmSolicitudTramiteKey pk = new TarmSolicitudTramiteKey(); + // Setear el valor a pagar en la tabla tramite + TarmTramite tramiteActual = IngresoDatosTipoTramite.find(recordsolicitud.getCtramite().toString()); + List ldocumentos = this.documentoHabilitanteController.findXSolicitudNueva(codigoSolicitud); + // Valor a pagar por concepto de custudios + BigDecimal valorAPagarArmas = new BigDecimal("0"); + /*if(tramiteActual.getTipocosto().equals("2")){ + valorAPagarArmas = tramiteActual.getCosto(); + } + else{ +// numeroArmas = new BigDecimal(TarmSolicitudArmasController.getNumeroArmasPorSolicitud(codigoSolicitud)); + BigDecimal costoPorArma = tramiteActual.getCosto(); + valorAPagarArmas = costoPorArma.multiply(numeroArmas); + } */ + if (tramiteActual.getTipocosto().equals("2")) { + valorAPagarArmas = tramiteActual.getCosto(); + } else if (numeroArmas != null && numeroArmas.compareTo(new BigDecimal(0)) > 0) { + numeroArmas = new BigDecimal(TarmSolicitudArmasController.getNumeroArmasPorSolicitud(codigoSolicitud)); + this.cantidad = this.numeroArmas; + BigDecimal costoPorArma = tramiteActual.getCosto(); + valorAPagarArmas = costoPorArma.multiply(numeroArmas); + } else { + numeroDocuementos = new BigDecimal(ldocumentos.size()); + this.cantidad = this.numeroDocuementos; + BigDecimal costoPorArma = tramiteActual.getCosto(); + valorAPagarArmas = costoPorArma.multiply(numeroDocuementos); + } + recordSolicitudTra.setValortramitearmas(valorAPagarArmas); + // Valor a pagar por concepto de custudios + BigDecimal numeroCustodios = new BigDecimal("0"); + + if (recordsolicitud.getNumerocustodios() != null) { + numeroCustodios = new BigDecimal(recordsolicitud.getNumerocustodios()); + } + BigDecimal numeroDiasCustodios = new BigDecimal("0"); + if(recordsolicitud.getNumerodiascustodios()!= null){ + numeroDiasCustodios = new BigDecimal(recordsolicitud.getNumerodiascustodios()); + } + BigDecimal costoCustodio = new BigDecimal("0"); + if (tramiteActual.getCostocustodio() != null) { + costoCustodio = tramiteActual.getCostocustodio(); + } + /** + * AGREGAMOS A LA MULTIPLICACION EL NUMERO DE DIAS DE LOS CUSTODIOS + */ + BigDecimal valorAPagarCustodio = costoCustodio.multiply(numeroCustodios).multiply(numeroDiasCustodios); + recordSolicitudTra.setValorcustodios(valorAPagarCustodio); + // Valor a pagar por concepto de multas + BigDecimal multa = new BigDecimal("0"); + if (recordsolicitud.getMulta() != null) { + multa = recordsolicitud.getMulta(); + } + recordSolicitudTra.setValormulta(multa); + // Sumamos el valor de a pagar de las armas, custodios y multa + costoTramite = valorAPagarArmas.add(valorAPagarCustodio).add(multa); + + recordSolicitudTra.setValorapagar(costoTramite); + pk.setCsolicitud(codigoSolicitud); + pk.setCtramite(Long.valueOf(recordsolicitud.getModifiedData().get("pk").toString())); + recordSolicitudTra.setPk(pk); + numeroTramite = recordsolicitud.getNumerosolicitud().replace("SOL", "TRA"); + recordSolicitudTra.setNumerotramite(numeroTramite); + recordSolicitudTra.setEstadotramite(codigo("CODIGO.REG.ESTADOSOLICITUD"));//CODIGO.REG.ESTADOSOLICITUD REG + recordSolicitudTra.setEstadotramitecodigo("ESTADOSOLICITUD"); + solicitudTramiteController.update(recordSolicitudTra); + } + + /** + * Metodo para generar el numero de tramite + */ + public void generaNumeroTramite() { + if (recordsolicitud.getModifiedData().get("tipoautorizacion").toString().equals(tipoautorizacion) + && !recordsolicitud.getModifiedData().get("usoactividad").toString().equals(usoactividad)) { + if (recordsolicitud.getNumerocustodios() == null || recordsolicitud.getNumerocustodios() < 0) { + MessageHelper.setMessageError("EL N\u00DAMERO DE CUSTODIOS DEBE SER POSITIVO"); + return; + } + } + numeroTramite = recordsolicitud.getNumerosolicitud().replace("SOL", "TRA"); + validacioComboFlujo(); + } + + public void validacioComboFlujo() { + try { + TgeneParameters tgeneparam = ParametersController.find("CODIGO.AR", "1"); + laccion = CatalogDetailController.find("ESTADOSOLICITUD", tgeneparam.getTextvalue()); + TgeneCatalogDetail catalogDetail = null; + for (TgeneCatalogDetail item : laccion) { + if (requisitos.getAuxBotonVerificacion()) { + if (!item.getPk().getCatalog().equals(codigoAceptado())) { + catalogDetail = item; + estado = "APB"; + } + } else if (item.getPk().getCatalog().equals(codigoAceptado())) { + catalogDetail = item; + estado = "ANU"; + } + } + laccion.remove(catalogDetail); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("TID", tid); + request.modifiedData().put("csolicitud", recordsolicitud.getPk()); + Map datosmail = new HashMap(); + if (codigoAceptado().equals(estado)) { + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + datosmail.put("razonsocial", recordsolicitud.getModifiedData().get("nombre")); + datosmail.put("tipoTramite", nombreTramite.getDescription()); + datosmail.put("actividad", nombreUsoActividad.getDescription()); + datosmail.put("categoria", nombreCategoria.getDescription()); + datosmail.put("numeroTramite", numeroTramite); + datosmail.put("costoTramite", costoTramite); + datosmail.put("abrevMoneda", ParametersController.find("ABREVMONEDA", "1").getTextvalue()); + datosmail.put("nombreDelBanco", ParametersController.find("BANCODEPOSITO", "1").getTextvalue()); + datosmail.put("cuentaCorriente", ParametersController.find("CUENTADEPOSITO", "1").getTextvalue()); + datosmail.put("diasLaborablesDeposito", ParametersController.find("DIASDEPOSITO", "1").getNumbervalue().toString()); + TsafeUserDetail userDetailObj = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personDetailObj = PersonDetailController.find(userDetailObj.getPk().getPersoncode().toString()); + // Datos del funcionario que valida + datosmail.put("funcionario", personDetailObj.getName()); + datosmail.put("grado", personDetailObj.getMilitarygrade() == null ? "" : personDetailObj.getMilitarygrade()); + // Centro de control de armas + TarmCentroControl centroControlObj = CentroControlArmasController.findPorCodigo(solicitud.getRecord().getCcentrocontrol()); + datosmail.put("nombreCCAsignado", centroControlObj.getModifiedData().get("desnombreinstitucion")); + datosmail.put("nombreCCA", centroControlObj.getModifiedData().get("desnombreinstitucion")); //Pendiente + if (recordsolicitud.getModifiedData().get("tipoautorizacion") != null && costoTramite.compareTo(new BigDecimal("0")) == 0) { + // En el caso de permisos enviamos una notificacion al cliente con algunos parametros adicionales + if (recordsolicitud.getModifiedData().get("tipoautorizacion").toString().equalsIgnoreCase("6")) { + generarFechaProximoTramite(); + SimpleDateFormat sdf = new SimpleDateFormat(MsgGeneral.getProperty("dateformat")); + datosmail.put("fechaGenerada", sdf.format(fechaAtencionTramite)); + datosmail.put("nombreCCACliente", obtenerCentroControlSolicitante()); + } + } + } else { + datosmail.put("razonsocial", recordsolicitud.getModifiedData().get("nombre")); + datosmail.put("nombre", recordsolicitud.getModifiedData().get("nombre")); + datosmail.put("numerosolicitud", recordsolicitud.getNumerosolicitud()); + SimpleDateFormat fm = new SimpleDateFormat("dd-MM-yyyy"); + datosmail.put("fechasolicitud", fm.format(recordsolicitud.getFregistro())); + datosmail.put("observaciones", observacion); + //grado funcionario de la persona logeada + TsafeUserDetail userDetailObj = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail personDetailObj = PersonDetailController.find(userDetailObj.getPk().getPersoncode().toString()); + datosmail.put("grado", personDetailObj.getMilitarygrade()); + datosmail.put("funcionario", personDetailObj.getName()); + // Centro de control de armas + TarmCentroControl centroControlObj = CentroControlArmasController.findPorCodigo(solicitud.getRecord().getCcentrocontrol()); + String nombreCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControlObj.getNombreinstitucion(), + centroControlObj.getNombreinstitucioncodigo()).getDescription(); + datosmail.put("centrocontrol", nombreCentroControl); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "D" : bpmDataStatus); // A,D,R + } + + datosmail.put("costoTramite", costoTramite); + request.modifiedData().put("datosmail", datosmail); + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + if (estado.equalsIgnoreCase("ANU")) { + saveAnularSolicitud(); + } + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void saveAnularSolicitud() { + try { + // CATEGORIA 14 PREVIA IMPORTACION + TarmTramite tarmTramite = TarmTramiteController.find(this.solicitud.getRecord().getCtramite().toString()); + if (tarmTramite.getCategoria().equals("14")) { + desasociarCargaSolicitud(); + } + + //Poner la solicitud en estado anulado + recordsolicitud.setEstado("ANU"); + recordsolicitud.setAucp(null); + solicitud.setRecord(recordsolicitud); + solicitud.update(); + DtoSave dtoSolicitud = solicitud.getDtoSave(); + + TarmSolicitudTramite solicitudTramiteObj = SolicitudTramiteController.findByCSolicitud(recordsolicitud.getPk()); + if (solicitudTramiteObj != null) { + solicitudTramiteObj.setIsnew(false); + solicitudTramiteObj.setEstadotramite("ANU"); + solicitudTramiteController.updateSolicitud(solicitudTramiteObj); + } + //Desasociar las armas en apertura de agencias y apertura de sucursales + if (recordsolicitud.getCtramite() == 44 || recordsolicitud.getCtramite() == 48) { + List armasSolicitudList = RecepcionArmasController.findPorSolicitud(recordsolicitud.getPk()); + for (TarmSolicitudArmas armaObj : armasSolicitudList) { + + // Codigo agencia de la solicitud + List solicitudAgenciaLst = SolicitudAgenciaSucursalController.findPorSolicitud(recordsolicitud.getPk()); + for (TarmSolicitudAgenciaSucursal solicitudAgenciaSucursalObj : solicitudAgenciaLst) { + String cAgencia = solicitudAgenciaSucursalObj.getPk().getCagencia().toString(); + TarmAgenciaArma agenciaArmaObj = AgenciaArmaController.findByCArma(armaObj.getPk().getCarma(), cAgencia); + agenciaArma.setRecord(agenciaArmaObj); + agenciaArma.remove(); + } + } + } + + DtoSave dtoSolicitudTramite = solicitudTramiteController.getDtoSave(); + DtoSave dtoAgenciaArma = agenciaArma.getDtoSave(); + + HashMap msave = new HashMap(); + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + msave.put(solicitud.getBeanalias(), dtoSolicitud); // adicionar metadata de mantenimiento para cada tabla. + msave.put(solicitudTramiteController.getBeanalias(), dtoSolicitudTramite); + msave.put(agenciaArma.getBeanalias(), dtoAgenciaArma); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + solicitud.postCommit(resp); + solicitudTramiteController.postCommit(resp); + agenciaArma.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Genera la fecha disponible para el proximo tramite en el centro de + * control de armas respectivo + */ + public void generarFechaProximoTramite() { + try { + // Validamos si ya existe una fecha para realizar el proximo tramite + TarmCentroControl centroControlObj = CentroControlArmasController.findPorCodigo(recordsolicitud.getCcentrocontrol()); + centroControlObj.isnew = false; + Date fechaActual = new Date(Calendar.getInstance().getTimeInMillis()); + if (centroControlObj.getFechaproximotramite() == null || centroControlObj.getFechaproximotramite().before(fechaActual)) { + fechaAtencionTramite = TgeneNotAccountingDayController.diasLaborablesPosterioresAUnaFecha(new java.util.Date(), 1); + } else { + fechaAtencionTramite = centroControlObj.getFechaproximotramite(); + } + // Numero de armas de la solicitud + List armasList = RecepcionArmasController.findPorSolicitud(recordsolicitud.getPk()); + int numArmasSolicitud = armasList.size(); + int salvedad = 10; + int capacidadCentroUltDia = 0; + if (centroControlObj.getCuposlibresultimodia() != null) { + capacidadCentroUltDia = centroControlObj.getCuposlibresultimodia(); + } else { + capacidadCentroUltDia = centroControlObj.getTramitespordia(); + } + // Si la capacidad del centro en el ultimo dia es mayor al numero de armas a revisarse + if (numArmasSolicitud < capacidadCentroUltDia) { + centroControlObj.setCuposlibresultimodia(capacidadCentroUltDia - numArmasSolicitud); + centroControlArmasController.update(centroControlObj); + centroControlArmasController.save(); + + } else if ((numArmasSolicitud == capacidadCentroUltDia) || (numArmasSolicitud <= (capacidadCentroUltDia + salvedad))) { + // Si la capacidad del centro es igual al numero de armas a revisarse o ajusta cupo con la salvedad + centroControlObj.setCuposlibresultimodia(centroControlObj.getTramitespordia()); + java.util.Date newFechaAtencionTramite = TgeneNotAccountingDayController.diasLaborablesPosterioresAUnaFecha(fechaAtencionTramite, 1); + centroControlObj.setFechaproximotramite(new java.sql.Date(newFechaAtencionTramite.getTime())); + centroControlArmasController.update(centroControlObj); + centroControlArmasController.save(); + + } else { + // Cociente y residuo para los casos donde se tiene 50 armas o mas a tramitarse + int diasRequeridos = numArmasSolicitud / centroControlObj.getTramitespordia(); + // Requerido para el calculo de los cupos disponibles para el ultimo dia + int residuoDiasRequeridos = numArmasSolicitud % centroControlObj.getTramitespordia(); + fechaAtencionTramite = TgeneNotAccountingDayController.diasLaborablesPosterioresAUnaFecha(fechaAtencionTramite, 1); + java.util.Date newFechaAtencionTramite; + + centroControlObj.setCuposlibresultimodia(centroControlObj.getTramitespordia() - residuoDiasRequeridos); + newFechaAtencionTramite = TgeneNotAccountingDayController.diasLaborablesPosterioresAUnaFecha(fechaAtencionTramite, diasRequeridos); + + centroControlObj.setFechaproximotramite(new java.sql.Date(newFechaAtencionTramite.getTime())); + centroControlArmasController.update(centroControlObj); + centroControlArmasController.save(); + + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + + } + } + + /** + * Metodo que devuelve el centro de control al que pertenece el cliente + * dueno de la solicitud + * + * @throws Exception + */ + private String obtenerCentroControlSolicitante() throws Exception { + String institucionCentroControl = ""; + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(recordsolicitud.getPersoncode().toString()); + if (tcustPersonAddres != null && tcustPersonAddres.getProvincecode() != null) { + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + if (centroControlJur != null && centroControlJur.getCcentrocontrol() != null) { + TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + institucionCentroControl = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription(); + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_laprovinciasinccontrol")); + return MsgControlArmas.getProperty("msg_error_laprovinciasinccontrol"); + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_notienedireccionprincipal")); + return MsgControlArmas.getProperty("msg_error_notienedireccionprincipal"); + } + + return institucionCentroControl; + } + + @Override + public void save() { + try { + Request request = callerhelper.getRequest(); + // validamos si cargamos los datos cuando apruebe + if (codigoAceptado().equals(estado)) { + cargaDatosSolicitudTramite(); + } + HashMap msave = new HashMap(); + cargarSolicitud(); + // actualiza los requisitos + DtoSave dtosavereq = requisitos.getDtoSave(); + dtosavereq.setReturnpk(true); + dtosavereq.setPosition(1); + msave.put(requisitos.getBeanalias(), dtosavereq); + + // inserta un nuevo registro en tarmSolicitudTramite + DtoSave dtosavesol = solicitudTramiteController.getDtoSave(); + dtosavesol.setIsForm(true); + dtosavesol.setReturnpk(true); + dtosavesol.setPosition(2); + msave.put(solicitudTramiteController.getBeanalias(), dtosavesol); + + // actualiza la solicitud el numero de custodios + DtoSave dtossolicitud = solicitud.getDtoSave(); + dtosavesol.setIsForm(true); + dtosavesol.setReturnpk(true); + dtosavesol.setPosition(3); + msave.put(solicitud.getBeanalias(), dtossolicitud); + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + requisitos.postCommit(resp); + solicitudTramiteController.postCommit(resp); + // ocultarBotonInicioFlujo = false; + MessageHelper.setMessageInfo(resp); + btnGuardar = Boolean.TRUE; + isEnableCompletarTarea = Boolean.TRUE; + } else { + // ocultarBotonInicioFlujo = true; + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void desasociarCargaSolicitud() { + try { + TarmCarga carga = CargaController.findByAUCP(solicitud.getRecord().getAucp()); + if (carga != null) { + carga.setCsolicitud(null); + cargaController.update(carga); + cargaController.save(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public String codigoAceptado() throws Exception { + TgeneParameters f = ParametersController.find("ACEPTADO", "1");//APB ESTADOSOLICITUD + return f.getTextvalue(); + } + + public String codigo(String codigo) throws Exception { + TgeneParameters f = ParametersController.find(codigo, "1");//APB ESTADOSOLICITUD + return f.getTextvalue(); + } + + @Override + protected void querydatabase() { + try { + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + } + + public String getCodigoSolicitud() { + return codigoSolicitud; + } + + public void setCodigoSolicitud(String codigoSolicitud) { + this.codigoSolicitud = codigoSolicitud; + } + + public SolicitudRequisitosController getRequisitos() { + return requisitos; + } + + public void setRequisitos(SolicitudRequisitosController requisitos) { + this.requisitos = requisitos; + } + + public TarmSolicitud getRecordsolicitud() { + return recordsolicitud; + } + + public void setRecordsolicitud(TarmSolicitud recordsolicitud) { + this.recordsolicitud = recordsolicitud; + } + + public TgeneCatalogDetail getNombreDocumento() { + return nombreDocumento; + } + + public void setNombreDocumento(TgeneCatalogDetail nombreDocumento) { + this.nombreDocumento = nombreDocumento; + } + + public TgeneCatalogDetail getNombreTramite() { + return nombreTramite; + } + + public void setNombreTramite(TgeneCatalogDetail nombreTramite) { + this.nombreTramite = nombreTramite; + } + + public TgeneCatalogDetail getNombreCategoria() { + return nombreCategoria; + } + + public void setNombreCategoria(TgeneCatalogDetail nombreCategoria) { + this.nombreCategoria = nombreCategoria; + } + + public TgeneCatalogDetail getNombreUsoActividad() { + return nombreUsoActividad; + } + + public void setNombreUsoActividad(TgeneCatalogDetail nombreUsoActividad) { + this.nombreUsoActividad = nombreUsoActividad; + } + + public SolicitudTramiteController getSolicitudTramiteController() { + return solicitudTramiteController; + } + + public void setSolicitudTramiteController( + SolicitudTramiteController solicitudTramiteController) { + this.solicitudTramiteController = solicitudTramiteController; + } + + public List getLaccion() { + return laccion; + } + + public void setLaccion(List laccion) { + this.laccion = laccion; + } + + public SolicitudArmasController getSolicitud() { + return solicitud; + } + + public void setSolicitud(SolicitudArmasController solicitud) { + this.solicitud = solicitud; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public IngresoDatosTipoTramite getTramite() { + return tramite; + } + + public void setTramite(IngresoDatosTipoTramite tramite) { + this.tramite = tramite; + } + + public BigDecimal getCostoTramite() { + return costoTramite; + } + + public void setCostoTramite(BigDecimal costoTramite) { + this.costoTramite = costoTramite; + } + + public BigDecimal getNumeroArmas() { + return numeroArmas; + } + + public void setNumeroArmas(BigDecimal numeroArmas) { + this.numeroArmas = numeroArmas; + } + + public String getNumeroTramite() { + return numeroTramite; + } + + public void setNumeroTramite(String numeroTramite) { + this.numeroTramite = numeroTramite; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public String getObservacion() { + return observacion; + } + + public void setObservacion(String observacion) { + this.observacion = observacion; + } + + public String getTipoautorizacion() { + return tipoautorizacion; + } + + public void setTipoautorizacion(String tipoautorizacion) { + this.tipoautorizacion = tipoautorizacion; + } + + public String getUsoactividad() { + return usoactividad; + } + + public void setUsoactividad(String usoactividad) { + this.usoactividad = usoactividad; + } + + public Boolean getBtnGuardar() { + return btnGuardar; + } + + public void setBtnGuardar(Boolean btnGuardar) { + this.btnGuardar = btnGuardar; + } + + public Boolean getIsEnableCompletarTarea() { + return isEnableCompletarTarea; + } + + public void setIsEnableCompletarTarea(Boolean isEnableCompletarTarea) { + this.isEnableCompletarTarea = isEnableCompletarTarea; + } + + public java.util.Date getFechaAtencionTramite() { + return fechaAtencionTramite; + } + + public void setFechaAtencionTramite(java.util.Date fechaAtencionTramite) { + this.fechaAtencionTramite = fechaAtencionTramite; + } + + public CentroControlArmasController getCentroControlArmasController() { + return centroControlArmasController; + } + + public void setCentroControlArmasController( + CentroControlArmasController centroControlArmasController) { + this.centroControlArmasController = centroControlArmasController; + } + + public Boolean getRequiereCustodiosBln() { + return requiereCustodiosBln; + } + + public void setRequiereCustodiosBln(Boolean requiereCustodiosBln) { + this.requiereCustodiosBln = requiereCustodiosBln; + } + + public void changeEstado() { + System.out.println("EL ESTADO ACTUAL ES:" + estado); + } + + public DocumentoHabilitanteController getDocumentoHabilitanteController() { + return documentoHabilitanteController; + } + + public void setDocumentoHabilitanteController( + DocumentoHabilitanteController documentoHabilitanteController) { + this.documentoHabilitanteController = documentoHabilitanteController; + } + + public BigDecimal getCantidad() { + return cantidad; + } + + public void setCantidad(BigDecimal cantidad) { + this.cantidad = cantidad; + } + + public List getArmas() { + return armas; + } + + public void setArmas(List armas) { + this.armas = armas; + } + + public TarmSolicitudTramite getRecordSolicitudTra() { + return recordSolicitudTra; + } + + public void setRecordSolicitudTra(TarmSolicitudTramite recordSolicitudTra) { + this.recordSolicitudTra = recordSolicitudTra; + } + + public AgenciaArmaController getAgenciaArma() { + return agenciaArma; + } + + public void setAgenciaArma(AgenciaArmaController agenciaArma) { + this.agenciaArma = agenciaArma; + } + + public CargaController getCargaController() { + return cargaController; + } + + public void setCargaController(CargaController cargaController) { + this.cargaController = cargaController; + } + + public Boolean getRequiereNoSolAucpBln() { + return requiereNoSolAucpBln; + } + + public void setRequiereNoSolAucpBln(Boolean requiereNoSolAucpBln) { + this.requiereNoSolAucpBln = requiereNoSolAucpBln; + } + + public String getNombreInstitucion() { + return nombreInstitucion; + } + + public String setNombreInstitucion(String nombreInstitucion) { + if (nombreInstitucion != null && !nombreInstitucion.isEmpty()) { + this.nombreInstitucion = nombreInstitucion; + } else { + this.nombreInstitucion = ""; + } + + return nombreInstitucion; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/VerificarMaterialDecomisadoController.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/VerificarMaterialDecomisadoController.java new file mode 100644 index 0000000..bacc2d6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/VerificarMaterialDecomisadoController.java @@ -0,0 +1,388 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.event.AjaxBehaviorEvent; + +import org.primefaces.component.selectbooleancheckbox.SelectBooleanCheckbox; +import org.primefaces.context.RequestContext; +import org.primefaces.event.TabChangeEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmDecomiso; +import com.fp.persistence.parmas.soli.TarmDecomisoArma; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class VerificarMaterialDecomisadoController extends AbstractController { + + /** + * Código de decomiso + */ + private String cDecomiso; + + /** + * Manejador de decomiso armas controller + */ + @ManagedProperty(value = "#{decomisoArmaController}") + private DecomisoArmaController decomisoArmaController; + + /** + * Variable que incluye datos de la cabecera de decomiso + */ + private TarmDecomiso decomiso; + /** + * Variable que incluye datos del detalle del decomiso + */ + private TarmDecomisoArma decomisoArmaObj; + /** + * Provincia + */ + private String provincia; + /** + * Cantón + */ + private String canton; + /** + * Ciudad + */ + private String ciudad; + /** + * Parroquia + */ + private String parroquia; + + /** + * Variable usada para activar el botón de generar reporte + */ + private Boolean isEnableImprimir; + /** + * Cat´logo Grado + */ + private TgeneCatalogDetail gradoCatalogDatail; + /** + * Cat´logo Unidad + */ + private TgeneCatalogDetail unidadCatalogDatail; + + private Boolean btnFlujo; + //private List armasDecomisadasLst = new ArrayList(); + + public VerificarMaterialDecomisadoController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postconstruct() { + // Inicializa autoconsulta + startQuery(); + // cDecomiso="357"; + if (cDecomiso != null) { + this.init(); + this.query(); + } else { + decomisoArmaController.setLrecord(new ArrayList()); + } + } + + public void startQuery() { + try { + this.pasteBpmScreenParameters(); + cDecomiso = super.getMfilters().get("cdecomiso"); + super.getMfilters().clear(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + decomiso = DecomisoController.findByCodigo(cDecomiso); + if (decomiso != null) { + provincia = ProvinceController.getDescProvByCodigo(decomiso.getCountrycode(), decomiso.getProvincecode()); + canton = CantonController.getDescCantonByCodigo(decomiso.getCountrycode(), decomiso.getProvincecode(), decomiso.getCantoncode()); + ciudad = CityController.getDescCiudadByCodigo(decomiso.getCountrycode(), decomiso.getProvincecode(), decomiso.getCantoncode(), decomiso.getCitycode()); + parroquia = ParroquiaController.getDescParroquiaByCodigo(decomiso.getCountrycode(), decomiso.getProvincecode(), decomiso.getCantoncode(), decomiso.getParroquiacode()); + gradoCatalogDatail = CatalogDetailController.findxCodigoCodcatalogo(decomiso.getGradofuncionario(), decomiso.getGradofuncionariocode()); + TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(decomiso.getCcentrocontrol()); + unidadCatalogDatail = CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()); + decomisoArmaController.addFilter("cdecomiso", cDecomiso); + decomisoArmaController.query(); + isEnableImprimir = Boolean.FALSE; + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_numReciboNoRegistrado")); + } + btnFlujo = Boolean.FALSE; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void query() { + try { + this.decomisoArmaController.query(); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() { + try { + if (cDecomiso != null) { + this.decomisoArmaController.next(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void previous() { + try { + if (cDecomiso != null) { + this.decomisoArmaController.previous(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + if (decomisoArmaObj == null || decomisoArmaObj.getEnbodega() == null || decomisoArmaObj.getEnbodega().compareTo("Y") != 0) { + MessageHelper.setMessageWarn(MsgControlArmas.getProperty("msg_proceso")); + return; + } + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + DtoSave dtosaveDA = decomisoArmaController.getDtoSave(); + + if (dtosaveDA.pendingProcess()) { + dtosaveDA.setReturnpk(true); + msave.put(this.decomisoArmaController.getBeanalias(), dtosaveDA); + } + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.decomisoArmaController.postCommit(resp); + isEnableImprimir = Boolean.TRUE; + btnFlujo = Boolean.TRUE; + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para finalizar la tarea del flujo + */ + public void completarTarea() { + + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("cdecomiso", cDecomiso); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + btnFlujo = Boolean.FALSE; + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + public DecomisoArmaController getDecomisoArmaController() { + return decomisoArmaController; + } + + public void setDecomisoArmaController( + DecomisoArmaController decomisoArmaController) { + this.decomisoArmaController = decomisoArmaController; + } + + public TarmDecomiso getDecomiso() { + return decomiso; + } + + public void setDecomiso(TarmDecomiso decomiso) { + this.decomiso = decomiso; + } + + public String getProvincia() { + return provincia; + } + + public void setProvincia(String provincia) { + this.provincia = provincia; + } + + public String getCanton() { + return canton; + } + + public void setCanton(String canton) { + this.canton = canton; + } + + public String getCiudad() { + return ciudad; + } + + public void setCiudad(String ciudad) { + this.ciudad = ciudad; + } + + public String getParroquia() { + return parroquia; + } + + public void setParroquia(String parroquia) { + this.parroquia = parroquia; + } + + public TgeneCatalogDetail getGradoCatalogDatail() { + return gradoCatalogDatail; + } + + public void setGradoCatalogDatail(TgeneCatalogDetail gradoCatalogDatail) { + this.gradoCatalogDatail = gradoCatalogDatail; + } + + public TgeneCatalogDetail getUnidadCatalogDatail() { + return unidadCatalogDatail; + } + + public void setUnidadCatalogDatail(TgeneCatalogDetail unidadCatalogDatail) { + this.unidadCatalogDatail = unidadCatalogDatail; + } + + public TarmDecomisoArma getDecomisoArmaObj() { + return decomisoArmaObj; + } + + public void setDecomisoArmaObj(TarmDecomisoArma decomisoArmaObj) { + this.decomisoArmaObj = decomisoArmaObj; + } + + public Boolean getIsEnableImprimir() { + return isEnableImprimir; + } + + public void setIsEnableImprimir(Boolean isEnableImprimir) { + this.isEnableImprimir = isEnableImprimir; + } + + public void seleccionarArma(AjaxBehaviorEvent event) { + try { + SelectBooleanCheckbox booleanCheckbox = (SelectBooleanCheckbox) event.getComponent(); + decomisoArmaObj = (TarmDecomisoArma) booleanCheckbox.getAttributes().get("armaDecomisadaObj"); + boolean checked = (Boolean) booleanCheckbox.getValue(); + if (checked) { + decomisoArmaObj.setEnbodega("Y"); + } else { + decomisoArmaObj.setEnbodega(null); + } + decomisoArmaController.update(decomisoArmaObj); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public Boolean getBtnFlujo() { + return btnFlujo; + } + + public void setBtnFlujo(Boolean btnFlujo) { + this.btnFlujo = btnFlujo; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/emitirDocumentoHabilitanteportransaccion.java b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/emitirDocumentoHabilitanteportransaccion.java new file mode 100644 index 0000000..3360e57 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/armas/solicitud/emitirDocumentoHabilitanteportransaccion.java @@ -0,0 +1,960 @@ +package com.fp.frontend.controller.armas.solicitud; + +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmDocumentoHabilitante; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class emitirDocumentoHabilitanteportransaccion extends AbstractController { + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + @ManagedProperty(value = "#{documentoHabilitanteController}") + private DocumentoHabilitanteController documentoHabilitanteController; + + @ManagedProperty(value = "#{pesonAddressController}") + private PersonAddressController pesonAddressController; + + @ManagedProperty(value = "#{solicitudController}") + private SolicitudController solicitudController; + + TarmSolicitudTramite solicitudTramite; + TarmSolicitud solicitud; + TarmTramite fila; + TcustPersonDetail detallesPersona; + TcustPersonDetail usuario; + TarmDocumentoHabilitante documentoHabilitante; + String numeroTramite; + String nombreRazonSocial; + private String xpathflujo = "";//cm:Pruebas/cm:ID_1715819825001"; + private String formato = "pdf"; + private String mostrarFormato = "PDF"; +// TcustPersonDetail detallesPersona; + List lsolicitud; +// String numeroTramite; +// String nombreRazonSocial; + String identificacion; + String tipoidentificacion; + private String tramiteflujo = ""; + private String solicitudflujo = ""; + + private List ldocumentos; + private String institucionCentroControl = ""; + private TarmCentroControl centroControl = new TarmCentroControl(); + private TcustPersonDetail responsableCentroControl = null; + private String tramiteingresado; + + public emitirDocumentoHabilitanteportransaccion() throws Exception { + super(TarmSolicitudTramite.class); + } + + @PostConstruct + private void postconstruct() { + try { + this.pasteBpmScreenParameters(); + tramiteflujo = super.getMfilters().get("numerotransaccion"); + solicitudflujo = super.getMfilters().get("csolicitud"); + this.init(); + super.getMfilters().clear(); + + super.query(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + private void init() { + try { + recperpage = 15; // Cambiar al # reg a mirar. + // lrecord = new ArrayList<>(); + beanalias = "EMITIRDOCUMENTOHABILITANTE"; + ldocumentos = new ArrayList(); + ldocumentos = CatalogDetailController.find("IDENTIFICATION"); + //Obteniendo el tramite + solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(solicitudflujo); + + //Obteniendo la solicitud + solicitud = ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(solicitudflujo); + //valida el tipo de tramite ingresado + validarTramite(); + if (solicitudTramite != null) { + this.numeroTramite = solicitudTramite.getNumerotramite(); + } + + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + usuario = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + + //Obteniendo el documento habilitante + documentoHabilitante = DocumentoHabilitanteController.findPorSolicitud(solicitudflujo); + obtenerCentroControl(); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + private void validarTramite() { + tramiteingresado = "OTROS"; + TgeneParameters parametrofichanoletal = ParametersController.find("CODIGO.FICHANOLETAL", "1"); + if (parametrofichanoletal != null && parametrofichanoletal.getTextvalue() != null && !parametrofichanoletal.getTextvalue().trim().isEmpty()) { + String[] arrayCodTramite = parametrofichanoletal.getTextvalue().split(","); + List listaCodTraite = Arrays.asList(arrayCodTramite); + for (String item : listaCodTraite) { + Long codigotramite = Long.parseLong(item); + if (solicitud.getCtramite().equals(codigotramite) + || codigotramite.longValue() == solicitud.getCtramite().longValue()) { + tramiteingresado = "NOLETAL"; + } + } + } + } + + public String getNumeroTramite() { + return numeroTramite; + } + + public void setNumeroTramite(String numeroTramite) { + this.numeroTramite = numeroTramite; + } + + @Override + protected void querydatabase() { + + try { + addFilter("numerotramite", numeroTramite); + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + SubQuery subqueryUso = new SubQuery("TarmTramite", "usoactividad", "actividad", "i.pk=t.pk.ctramite"); + dto.addSubQuery(subqueryUso); + SubQuery subqueryPersona = new SubQuery("TarmSolicitud", "personcode", "persona", "i.pk=t.pk.csolicitud"); + dto.addSubQuery(subqueryPersona); + SubQuery subqueryTipo = new SubQuery("TarmTramite", "tipoautorizacion", "tramite", "i.pk=t.pk.ctramite"); + dto.addSubQuery(subqueryTipo); + SubQuery subqueryTipocodigo = new SubQuery("TarmTramite", "tipoautorizacioncodigo", "tramitecodigo", "i.pk=t.pk.ctramite"); + dto.addSubQuery(subqueryTipocodigo); + SubQuery subqueryEstado = new SubQuery("TgeneCatalogDetail", "description", "desc", "i.pk.catalog=t.estadotramite and i.pk.catalogcode=t.estadotramitecodigo"); + dto.addSubQuery(subqueryEstado); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + for (int i = 0; i < this.lrecord.size(); i++) { + this.lrecord.get(i).getModifiedData().put("usodes", CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("actividad").toString(), "USOACTIVIDAD").getDescription()); + TcustPersonDetail person = PersonDetailController.find(this.lrecord.get(i).getModifiedData().get("persona").toString()); + this.lrecord.get(i).getModifiedData().put("nombre", person.getName()); + this.lrecord.get(i).getModifiedData().put("identificacion", person.getIdentification()); + TgeneCatalogDetail tipo = CatalogDetailController.findxCodigoCodcatalogo(this.lrecord.get(i).getModifiedData().get("tramite").toString(), this.lrecord.get(i).getModifiedData().get("tramitecodigo").toString()); + this.lrecord.get(i).getModifiedData().put("tipotramdesc", tipo.getDescription()); + } + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para completar la tarea + */ + public void completarTarea() { + try { + if (xpathflujo == null || xpathflujo.isEmpty()) { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generarReporteRequerido")); + return; + } + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment == null ? "OK" : bpmDataComment); + + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + public void imprimir(TarmSolicitudTramite fila) { + try { + boolean flagRequisitos = false; + boolean flagArmas = false; + boolean flagGuardias = false; + boolean flagAgencia = false; + boolean flagDoc = false; + String tipotramite = fila.getModifiedData().get("tramite").toString(); + String nombreArchivo = fila.getModifiedData().get("tipotramdesc").toString(); + TarmSolicitud solicitud = SolicitudController.findSolicitudxcodsolicitud(fila.getPk().getCsolicitud()); + TarmTramite tramite = TarmTramiteController.findSimple(fila.getPk().getCtramite().toString()); + documentoHabilitante = documentoHabilitanteController.findPorSolicitud(fila.getPk().getCsolicitud()); + + xpathflujo = generarXpath(fila.getNumerotramite()); + System.out.println("..." + xpathflujo); + + //solicitud=ValidacionTramiteLibreTransitoController.findPorSolicitudSimple(tipotramite); + if (tipotramite == null) { + MessageHelper.setMessageError("ERROR NO MANEJADO POR LA APLICACION CONTACTE AL PROVEEDOR"); + return; + } + if (tipotramite.equals("2")) { + if (tramite.getRegistroagenciasucursal().equalsIgnoreCase("Y")) { + flagAgencia = true; + } + if (tramite.getRegistroarmas().equalsIgnoreCase("Y")) { + flagArmas = true; + } + if (tramite.getRegistroguardia().equalsIgnoreCase("Y")) { + flagGuardias = true; + } + if (tramite.getDocumentohabilitante().equalsIgnoreCase("Y")) { + flagDoc = true; + } + //this.reporteCertificados(solicitud.getPk(), flagAgencia, flagArmas, flagDoc, flagGuardias); + InputStream pdf = this.reporteCertificados(solicitud.getPk(), flagAgencia, flagArmas, flagDoc, flagGuardias); + alfrescoController.uploadFile(pdf, documentoHabilitante.getNumerodocumento() + ".pdf", xpathflujo); + xpathflujo = xpathflujo + "/cm:" + documentoHabilitante.getNumerodocumento() + ".pdf"; + actualizarXpath(documentoHabilitante, xpathflujo); + return; + } else if (tipotramite.equals("4")) { + InputStream pdf = this.reporteGuiaLibreTransito(); + alfrescoController.uploadFile(pdf, documentoHabilitante.getNumerodocumento() + ".pdf", xpathflujo); + xpathflujo = xpathflujo + "/cm:" + documentoHabilitante.getNumerodocumento() + ".pdf"; + actualizarXpath(documentoHabilitante, xpathflujo); + return; + } else { + if (tramite.getRegistroagenciasucursal().equalsIgnoreCase("Y")) { + flagAgencia = true; + } + if (tramite.getRegistroarmas().equalsIgnoreCase("Y")) { + flagArmas = true; + } + if (tramite.getRegistroguardia().equalsIgnoreCase("Y")) { + flagGuardias = true; + } + if (tramite.getDocumentohabilitante().equalsIgnoreCase("Y")) { + flagDoc = true; + } + } + InputStream pdf = this.reporteGeneral(solicitud.getPk(), flagAgencia, flagArmas, flagDoc, flagGuardias, flagRequisitos, nombreArchivo); + alfrescoController.uploadFile(pdf, documentoHabilitante.getNumerodocumento() + ".pdf", xpathflujo); + xpathflujo = xpathflujo + "/cm:" + documentoHabilitante.getNumerodocumento() + ".pdf"; + actualizarXpath(documentoHabilitante, xpathflujo); + + } catch (Exception e) { + xpathflujo = null; + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_generar_reporte")); + } + } + + /** + * Metodo para actualziar en la tabla tarmdocumentohabilitante con el xpath + * de la ruta de alfreco donde se guardo el documento + * + * @param documentoHabilitante + * @param xPath + * @throws Exception + */ + private void actualizarXpath(TarmDocumentoHabilitante documentoHabilitante, String xPath) throws Exception { + documentoHabilitanteController.setRecord(documentoHabilitante); + documentoHabilitanteController.getRecord().setXpath(xPath); + documentoHabilitanteController.update(); + documentoHabilitanteController.save(); + } + + public String generarXpath(String tramite) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + tramite = tramite.replace("TRA", "SOL"); + StringBuilder ruta = new StringBuilder("cm:Solicitud"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + ruta = ruta.append("/cm:" + tramite); + return ruta.toString(); + } + + public String encontrarUsuario() { + if (identificacion == null || identificacion == "") { + return null; + } + detallesPersona = PersonDetailController.findxidentification(identificacion, tipoidentificacion); + if (detallesPersona == null) { + return null; + } + lsolicitud = SolicitudController.findSolicitudxPersona(detallesPersona.getPk().getPersoncode().toString()); + + String csolicitud = null; + for (TarmSolicitud soli : lsolicitud) { + if (csolicitud == null) { + csolicitud = "csolicitud='" + soli.getPk() + "'"; + } else { + csolicitud += " or csolicitud='" + soli.getPk() + "'"; + } + } + return csolicitud; + } + + @Override + public void save() { + // TODO Auto-generated method stub + super.save(); + } + + /** + * Ejecuta un reporte de armas + * + * @param name Nombre del reporte a generar. + */ + public InputStream reporteGuiaLibreTransito() { + try { + String path = "armas/reports/guiaLibreTransito"; + String filename = MsgControlArmas.getProperty("lbl_guiaLibreTransito"); + + detallesPersona = PersonDetailController.find(String.valueOf(solicitud.getPersoncode().toString())); + solicitudTramite = TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + TarmSolicitud sol = this.solicitudController.findSolicitudxcodsolicitud(this.solicitudflujo); + //No. Guia + parameters.put("noGuia", this.numeroTramite); + + //Codigo de barras + String codigoBarras = this.numeroTramite.replace("-", "").toLowerCase(); + Boolean caracterEliminado = false; + for (int i = 0; i < codigoBarras.length(); i++) { + if (caracterEliminado) { + i = 0; + caracterEliminado = false; + } + if (codigoBarras.toCharArray()[i] != '0' && codigoBarras.toCharArray()[i] != '1' && codigoBarras.toCharArray()[i] != '2' + && codigoBarras.toCharArray()[i] != '3' && codigoBarras.toCharArray()[i] != '4' && codigoBarras.toCharArray()[i] != '5' + && codigoBarras.toCharArray()[i] != '6' && codigoBarras.toCharArray()[i] != '7' && codigoBarras.toCharArray()[i] != '8' + && codigoBarras.toCharArray()[i] != '9') { + + String caracterExtranno = ""; + caracterExtranno += codigoBarras.toCharArray()[i]; + codigoBarras = codigoBarras.replace(caracterExtranno, ""); + caracterEliminado = true; + } + } + parameters.put("codigoBarras", codigoBarras); + + //Nombre/Razon Social + parameters.put("nombreRazon", detallesPersona.getName()); + + //Cedula + parameters.put("cedula", detallesPersona.getIdentification()); + + //Desde + parameters.put("desde", solicitud.getLugarorigen()); + + //Hasta + parameters.put("hasta", solicitud.getLugardestino()); + + //Fechas + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + if (documentoHabilitante != null) { + parameters.put("fechaExpide", sdf.format(documentoHabilitante.getFechaemision())); + parameters.put("fechaCaduca", sdf.format(documentoHabilitante.getFechaexpiracion())); + } else { + parameters.put("fechaExpide", " "); + parameters.put("fechaCaduca", " "); + } + + //Grado + String gradoFuncionario = ""; + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), + this.responsableCentroControl.getMilitarygradecode()); + if (grado != null) { + gradoFuncionario = grado.getDescription() + " - "; + } + + //Lugar origen y destino + if (sol != null) { + parameters.put("provinciaorigen", sol.modifiedData().get("provinciaorigen").toString()); + parameters.put("cantonorigen", sol.modifiedData().get("cantonorigen").toString()); + parameters.put("lugarorigen", sol.getLugarorigen().toString()); + parameters.put("provinciadestino", sol.modifiedData().get("provinciadestino").toString()); + parameters.put("cantondestino", sol.modifiedData().get("cantondestino").toString()); + parameters.put("lugardestino", sol.getLugardestino().toString()); + + } + + //Funcionario + parameters.put("gradoNombreFuncionario", gradoFuncionario + this.responsableCentroControl.getName()); + parameters.put("personcode", this.responsableCentroControl.getPk().getPersoncode()); + parameters.put("centroControl", "JEFE DEL " + this.institucionCentroControl); + parameters.put("nombreCentro", this.institucionCentroControl); + //Usuario + parameters.put("usuario", this.usuario.getName()); + sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + String fechaHora = sdf.format(Calendar.getInstance().getTime()); + parameters.put("fechaHora", fechaHora); + + System.out.println("1. emitirDocumento"); + parameters.put("codigoQR", solicitudTramite.getNumerotramite() + " " + parameters.get("fechaExpide") + " " + + parameters.get("fechaCaduca") + " " + gradoFuncionario + this.responsableCentroControl.getName() + " " + this.institucionCentroControl); + + String format = "pdf"; + InputStream pdf = this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + return pdf; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + return null; + } + + /** + * Ejecuta un reporte de certificado de armas + * + * @param name Nombre del reporte a generar. + */ + public void reporteCertificadoArmas() { + try { + String path = "armas/reports/certificadoArmas"; + String filename = "certificadoarmas"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + + //Fecha + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + + //Grado + String gradoFuncionario = ""; + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), + this.responsableCentroControl.getMilitarygradecode()); + if (grado != null) { + gradoFuncionario = grado.getDescription() + " - "; + } + System.out.println("2. emitirDocumento"); + parameters.put("codigoQR", solicitudTramite.getNumerotramite() + " " + + sdf.format(Calendar.getInstance().getTime()) + " " + gradoFuncionario + this.responsableCentroControl.getName() + " " + this.institucionCentroControl); + + String format = "pdf"; + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Ejecuta un reporte de certificado de armas + * + * @param name Nombre del reporte a generar. + */ + public void reporteAgencias() { + try { + String path = "armas/reports/aperturaAgenciasSucursales"; + String filename = "aperturaagenciassucursales"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + parameters.put("csolicitud", solicitudTramite.getPk().getCsolicitud()); + + //Fecha + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + + //Grado + String gradoFuncionario = ""; + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), + this.responsableCentroControl.getMilitarygradecode()); + if (grado != null) { + gradoFuncionario = grado.getDescription() + " - "; + } + System.out.println("3. emitirDocumento"); + parameters.put("codigoQR", solicitudTramite.getNumerotramite() + " " + sdf.format(Calendar.getInstance().getTime()) + " " + + gradoFuncionario + this.responsableCentroControl.getName() + " " + this.institucionCentroControl); + + String format = "pdf"; + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /* public void reporteInscripcion(TarmSolicitud solicitud) { + try { + String path = "armas/reports/reporteInscripcion"; + String filename="armas"; + + detallesPersona = PersonDetailController.find(String.valueOf(solicitud.getPersoncode().toString())); + solicitudTramite=TarmSolicitudTramiteController.findPorCSolicitud(solicitud.getPk()); + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + + //No. Guia + parameters.put("nombreCompania", detallesPersona.getName()); + + //Nombre/Razon Social + parameters.put("nombrepersona",detallesPersona.getLegalrepresent()); + SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy"); + parameters.put("fecha", sdf.format(solicitud.getFregistro())); + parameters.put("ciudad", "Quito"); + + String format = "pdf"; + + + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + */ + /** + * Ejecuta reporte general de informacion de armas, guardias, agencias y + * sucursales + * + * @param name Nombre del reporte a generar. + */ + public InputStream reporteGeneral(String solicitud, boolean flagAgencia, boolean flagArmas, boolean flagDoc, boolean flagGuardias, boolean flagRequisitos, String nombreArchivo) { + try { + String path = "armas/reports/generalReportHabilita"; + String filename = nombreArchivo; + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail user = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); +// TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(user.getMilitarygrade(), user.getMilitarygradecode()); + TgeneCatalogDetail grado = null; + if (this.responsableCentroControl.getMilitarygrade() != null && this.responsableCentroControl.getMilitarygradecode() != null) { + grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + } + + String gradoUsuario = ""; + if (grado != null) { + gradoUsuario = grado.getDescription() + " - " + this.responsableCentroControl.getName(); + } else { + gradoUsuario = this.responsableCentroControl.getName(); + } + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("csolicitud", solicitudflujo); + + //Obteniendo la solicitud + TarmSolicitud s = SolicitudController.findSolicitudxcodsolicitud(solicitudflujo); + TarmTramite t; + Boolean datosTramiteVacios = false; + + if (s != null) { + //Obteniendo el tramite + t = TarmTramiteController.find(s.getCtramite().toString()); + + //Obteniendo la solicitud trmite + TarmSolicitudTramite st = TarmSolicitudTramiteController.findPorCSolicitud(solicitudflujo); + + if (t != null) { + + //No de tramite + if (st != null) { + parameters.put("noTramite", st.getNumerotramite()); + } else { + parameters.put("noTramite", " "); + } + + //Tipo de tramite + if (t.getModifiedData().get("tipotramite") != null) { + parameters.put("tipoTramite", t.getModifiedData().get("tipotramite")); + } else { + parameters.put("tipoTramite", " "); + } + + //Tipo de autorizacion + if (t.getModifiedData().get("tipoautorizacion") != null) { + parameters.put("tipoAutorizacion", t.getModifiedData().get("tipoautorizacion")); + } else { + parameters.put("tipoAutorizacion", " "); + } + + //Categoria + if (t.getModifiedData().get("categoria") != null) { + parameters.put("categoria", t.getModifiedData().get("categoria")); + } else { + parameters.put("categoria", " "); + } + + //Uso actividad + if (t.getModifiedData().get("usoactividad") != null) { + parameters.put("usoActividad", t.getModifiedData().get("usoactividad")); + } else { + parameters.put("usoActividad", " "); + } + + //Cabecera + if (t.getCabecera() != null) { + parameters.put("cabecera", t.getCabecera()); + } else { + parameters.put("cabecera", " "); + } + + //Pie + if (t.getPie() != null) { + parameters.put("pie", t.getPie()); + } else { + parameters.put("pie", " "); + } + + //fecha de solicitud + if (s.getFregistro() != null) { + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + parameters.put("fecSolicitud", sdf.format(s.getFregistro())); + } else { + parameters.put("fecSolicitud", ""); + } + + } else { + datosTramiteVacios = true; + } + } else { + datosTramiteVacios = true; + } + + if (datosTramiteVacios) { + parameters.put("noTramite", " "); + parameters.put("tipoTramite", " "); + parameters.put("tipoAutorizacion", " "); + parameters.put("categoria", " "); + parameters.put("usoActividad", " "); + parameters.put("cabecera", " "); + parameters.put("pie", " "); + } + + //Obteniendo la direccion + String email = " ", direccion = " "; + List direcciones = PersonAddressController.findAllByPersonCode(s.getPersoncode().toString()); + for (TcustPersonAddress d : direcciones) { + Calendar calendario = Calendar.getInstance(); + calendario.setTime(d.getPk().getDateto()); + if (calendario.get(Calendar.YEAR) == 2999) { + if (d.getAddresstypecatalog().equalsIgnoreCase("3")) { + email = d.getAddress(); + } else if (d.getPrincipal() != null && d.getPrincipal().equalsIgnoreCase("Y")) { + direccion = d.getAddress(); + } + } + } + + //Email + parameters.put("email", email); + + //Direccion + parameters.put("direccion", direccion); + + //Fecha + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + parameters.put("flagAgencia", flagAgencia); + parameters.put("flagArmas", flagArmas); + parameters.put("flagDoc", flagDoc); + parameters.put("flagGuardias", flagGuardias); + parameters.put("flagRequisitos", flagRequisitos); + parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("codResponsable", this.responsableCentroControl.getPk().getPersoncode()); + parameters.put("usuario", user.getName()); + + System.out.println("4. emitirDocumento"); + parameters.put("codigoQR", solicitud + " " + sdf.format(Calendar.getInstance().getTime()) + " " + gradoUsuario + " " + this.institucionCentroControl); + + String format = "pdf"; + InputStream pdf = this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + return pdf; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + return null; + } + + /** + * Obtiene el centro de control segun usurio logeado. + * + * @throws Exception + * + */ + private String obtenerCentroControl() throws Exception { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController direccion = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = direccion.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + this.centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + //Reponsable + Integer responsable = this.centroControl.getPersoncode(); + this.responsableCentroControl = PersonDetailController.find(responsable.toString()); + return setInstitucionCentroControl(CatalogDetailController.findxCodigoCodcatalogo(centroControl.getNombreinstitucion(), centroControl.getNombreinstitucioncodigo()).getDescription()); + + } + + /** + * Ejecuta reporte general de informacion de armas, guardias, agencias y + * sucursales + * + * @param name Nombre del reporte a generar. + */ + public InputStream reporteCertificados(String solicitud, boolean flagAgencia, boolean flagArmas, boolean flagDoc, boolean flagGuardias) { + try { + String gradoUsuario = ""; + String path = "armas/reports/reporteCertificado"; + if (tramiteingresado.equals("NOLETAL")) { + path = "armas/reports/reporteCertificadoNoLetal"; + } + String filename = "reporteCertificado"; + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + TcustPersonDetail user = PersonDetailController.find(tsafeUserDetail.getPk().getPersoncode().toString()); + TgeneCatalogDetail grado = CatalogDetailController.findxCodigoCodcatalogo(this.responsableCentroControl.getMilitarygrade(), this.responsableCentroControl.getMilitarygradecode()); + if (grado != null) { + gradoUsuario = grado.getDescription() + " - " + this.responsableCentroControl.getName(); + } else { + gradoUsuario = "Sin Grado - " + this.responsableCentroControl.getName(); + } + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("csolicitud", solicitud); + //Obteniendo la solicitud + TarmSolicitud s = SolicitudController.findSolicitudxcodsolicitud(solicitudflujo); + //Obteniendo la direccion + String email = " ", direccion = " "; + List direcciones = PersonAddressController.findAllByPersonCode(s.getPersoncode().toString()); + for (TcustPersonAddress d : direcciones) { + Calendar calendario = Calendar.getInstance(); + calendario.setTime(d.getPk().getDateto()); + if (calendario.get(Calendar.YEAR) == 2999) { + if (d.getAddresstypecatalog().equalsIgnoreCase("3")) { + email = d.getAddress(); + } else if (d.getAddresstypecatalog().equalsIgnoreCase("1")) { + direccion = d.getAddress(); + } + } + } + + //Email + parameters.put("email", email); + //Fecha + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy / hh:mm:ss"); + parameters.put("lugarFecha", sdf.format(Calendar.getInstance().getTime())); + parameters.put("fechaExpiracion", sdf.format(documentoHabilitante.getFechaexpiracion())); + parameters.put("flagAgencia", flagAgencia); + parameters.put("flagArmas", flagArmas); + parameters.put("flagDoc", flagDoc); + parameters.put("flagGuardias", flagGuardias); + parameters.put("centroControl", this.obtenerCentroControl()); + parameters.put("gradoUsuario", gradoUsuario); + parameters.put("usuario", user.getName()); + parameters.put("codResponsable", this.responsableCentroControl.getPk().getPersoncode()); + + System.out.println("5. emitirDocumento"); + parameters.put("codigoQR", solicitud + " " + sdf.format(Calendar.getInstance().getTime()) + " " + + gradoUsuario + " " + this.institucionCentroControl); + + String format = "pdf"; + //this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + InputStream pdf = this.reportController.jaspertoInputstream(path, parameters, format, filename, this.getLoginController()); + return pdf; + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + return null; + } + + public List getLdocumentos() { + return ldocumentos; + } + + public String getXpathflujo() { + return xpathflujo; + } + + public void setXpathflujo(String xpathflujo) { + this.xpathflujo = xpathflujo; + } + + public void setLdocumentos(List ldocumentos) { + this.ldocumentos = ldocumentos; + } + + public String getIdentificacion() { + return identificacion; + } + + public void setIdentificacion(String identificacion) { + this.identificacion = identificacion; + } + + public String getTipoidentificacion() { + return tipoidentificacion; + } + + public void setTipoidentificacion(String tipoidentificacion) { + this.tipoidentificacion = tipoidentificacion; + } + + TarmTramite getFila() { + return fila; + } + + public void setFila(TarmTramite fila) { + this.fila = fila; + } + + public String getFormato() { + return formato; + } + + public void setFormato(String formato) { + this.formato = formato; + } + + public String getMostrarFormato() { + return mostrarFormato; + } + + public void setMostrarFormato(String mostrarFormato) { + this.mostrarFormato = mostrarFormato; + } + + public String getTramiteflujo() { + return tramiteflujo; + } + + public void setTramiteflujo(String tramiteflujo) { + this.tramiteflujo = tramiteflujo; + } + + public String getInstitucionCentroControl() { + return institucionCentroControl; + } + + public String setInstitucionCentroControl(String institucionCentroControl) { + this.institucionCentroControl = institucionCentroControl; + return institucionCentroControl; + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public DocumentoHabilitanteController getDocumentoHabilitanteController() { + return documentoHabilitanteController; + } + + public void setDocumentoHabilitanteController( + DocumentoHabilitanteController documentoHabilitanteController) { + this.documentoHabilitanteController = documentoHabilitanteController; + } + + public PersonAddressController getPesonAddressController() { + return pesonAddressController; + } + + public void setPesonAddressController( + PersonAddressController pesonAddressController) { + this.pesonAddressController = pesonAddressController; + } + + public SolicitudController getSolicitudController() { + return solicitudController; + } + + public void setSolicitudController(SolicitudController solicitudController) { + this.solicitudController = solicitudController; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/entries new file mode 100644 index 0000000..d23424e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/entries @@ -0,0 +1,507 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/bpm +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +AssignmentsController.java +file + + + + +2022-07-28T03:39:55.806600Z +c6017ad5b9f8aec76930bf7c7bd39152 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +5731 + +ExportFlowsController.java +file + + + + +2022-07-28T03:39:55.806600Z +e78e690d610b4c72e5ef69242c46c59f +2021-05-14T20:37:22.948846Z +4633 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +7042 + +GroupsUsersController.java +file + + + + +2022-07-28T03:39:55.808600Z +6daa4e9c665d162bdc7302cdae874bd2 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +6931 + +FieldTransactionOriginController.java +file + + + + +2022-07-28T03:39:55.807600Z +0e21d69202d38b797d36619817b44ad6 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +6120 + +FieldTransactionMappingController.java +file + + + + +2022-07-28T03:39:55.808600Z +97bb9caf88eeabe885e40e5ca0f114d8 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +6275 + +FieldsController.java +file + + + + +2022-07-28T03:39:55.808600Z +b3526ea82a03dfd44d23a2ec36edeb27 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +3349 + +NotifyController.java +file + + + + +2022-07-28T03:39:55.809600Z +01dba5ffcd04193dd1de2d409b71c3b0 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +5130 + +lov +dir + +InboxController.java +file + + + + +2022-07-28T03:39:55.807600Z +3bfd66b693a0d4c78b08f09837239e31 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +18437 + +GroupsController.java +file + + + + +2022-07-28T03:39:55.807600Z +185f3c72dd9ba295b6cfcab7b5f31c31 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +3765 + +TransactionLogController.java +file + + + + +2022-07-28T03:39:55.808600Z +0211523c74132352ae537206c844fa7f +2014-11-04T10:22:15.189612Z +2294 +jvaca + + + + + + + + + + + + + + + + + + + + + +21572 + +TaskServerController.java +file + + + + +2022-07-28T03:39:55.809600Z +82597fd35a78385f7353800899ad5297 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +5147 + +RulesController.java +file + + + + +2022-07-28T03:39:55.810600Z +8e9b2b7e1d72d9d2dc9596f41e2e8db2 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +7174 + +FlowsController.java +file + + + + +2022-07-28T03:39:55.810600Z +b47013e3fcea2b51847cf0820f66d967 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +3770 + +EndedFlowsController.java +file + + + + +2022-07-28T03:39:55.809600Z +5c86563ec74c93171b6f12a373ebd9eb +2014-11-10T13:22:42.728556Z +2560 +cpiedra + + + + + + + + + + + + + + + + + + + + + +10295 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/AssignmentsController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/AssignmentsController.java.svn-base new file mode 100644 index 0000000..e26f1d0 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/AssignmentsController.java.svn-base @@ -0,0 +1,215 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.safe.UserDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; + +/** + * Clase controladora del bean AbstractDataTransport. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class AssignmentsController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public AssignmentsController() throws Exception { + super(AbstractDataTransport.class); + } + + @ManagedProperty(value = "#{userDetailController}") + private UserDetailController userdetail; + + /** + * Atributo para la lista de objetos del QueryAlias + */ + private List> ltasks; + + /** + * Atributo para obtener los datos del query + */ + private Map recordmap; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recordmap = new HashMap(); + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "tasks"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + request.put("querytype", "P"); + request.put("userCri",super.getMfilters().get("user")); + request.put("cri",""); + request.put("queryalias", "ASIGNEDTASKS"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.ltasks = new ArrayList>(); + MessageHelper.setMessageError(resp); + } else { + this.ltasks = (List>) resp.get(this.beanalias); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + MessageHelper.setMessageError("msg_notSave"); + } + + /** + * Método que llama al lov de Personas + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Maneja la respuesta del Lov de Personas + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + this.userdetail.getMfilters().clear(); + this.userdetail.addFilter("pk.personcode", t.getPk().getPersoncode().toString()); + this.userdetail.query(); + if(this.userdetail.getRecord()==null){ + MessageHelper.setMessageError("msg_userNotFound"); + return; + } + if(this.userdetail.getRecord().getIsuserbpm()==null || this.userdetail.getRecord().getIsuserbpm().equals("N")){ + MessageHelper.setMessageError("msg_notUserBpm"); + return; + } + this.recordmap.put("userasigned", this.userdetail.getRecord().getPk().getUsercode()); + this.recordmap.put("nameasigned", t.getName()); + } + + /** + * Ejecuta el action del asigned + */ + public void assigned(){ + try { + Request request = this.callerhelper.getRequest(); + request.setUser((String)this.recordmap.get("userasigned")); + request.put("TID", this.recordmap.get("tid")); + + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + this.querydatabase(); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Entrega una lista de mapas + * @return ltasks Lista de mapas + */ + public List> getLtasks() { + return ltasks; + } + + /** + * Fija una lista de mapas + * @param ltasks Lista de mapas + */ + public void setLtasks(List> ltasks) { + this.ltasks = ltasks; + } + + /** + * Entrega una mapa + * @return recordmap Mapas + */ + public Map getRecordmap() { + return recordmap; + } + + /** + * Fija una mapa + * @param recordmap Mapas + */ + public void setRecordmap(Map recordmap) { + this.recordmap = recordmap; + } + + /** + * Entrega el valor de: userdetail + * + * @return UserDetailController + */ + public UserDetailController getUserdetail() { + return this.userdetail; + } + + /** + * Fija el valor de: userdetail + * + * @param userdetail Valor a fijar en el atributo. + */ + public void setUserdetail(UserDetailController userdetail) { + this.userdetail = userdetail; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/EndedFlowsController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/EndedFlowsController.java.svn-base new file mode 100644 index 0000000..4fff21a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/EndedFlowsController.java.svn-base @@ -0,0 +1,354 @@ +package com.fp.frontend.controller.bpm; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.common.properties.PropertiesHandler; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.bpm.lov.TransactionBpmELovController; +import com.fp.frontend.controller.pgeneral.date.TgeneAccountingDateBranchController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.log.TgeneTransactionLog; + +/** + * Clase controladora del bean TgeneTransactionLog. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class EndedFlowsController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public EndedFlowsController() throws Exception { + super(TgeneTransactionLog.class); + } + + /** + * Atributo para la lista de objetos del QueryAlias + */ + private List> ltransactionlog; + + /** + * Atributo para la lista de objetos del QueryAlias + */ + private List> ltbpmactivities; + + /** + * Atributo para obtener los datos del query + */ + private Map recordmap; + + /** + * Atributo para el detalle de la actividad realizada + */ + private Map activityDetail; + + /** + * Atributo para el filtro de fecha desde + */ + private Date fromdate; + + /** + * Atributo para el filtro de fecha hasta + */ + private Date todate; + + @PostConstruct + private void postconstruct() { + this.init(); + // this.initDates(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TRANSACTIONLOG"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if (super.getMfilters().get("transactionmodule") == null) { + MessageHelper.setMessageError("msg_catalogrequird"); + return; + } + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + request.put("querytype", "P"); + request.put("creationdate", this.fromdate); + request.put("enddate", this.todate); + request.put("queryalias", "ENDEDFLOWS"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.ltransactionlog = new ArrayList>(); + MessageHelper.setMessageError(resp); + } else { + this.ltransactionlog = (List>) resp.get(this.beanalias); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + MessageHelper.setMessageError("msg_notSave"); + } + + /** + * Abre el lov de transacciones + */ + public void openTransactionLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("TRANSACTION"); // valor del parametro + params.put("processtype", l); + + TransactionBpmELovController.openLov(params); + } + + /** + * Gestiona la respuesta del lov + * + * @param event + * @throws Exception + */ + public void onReturnTransactionLov(SelectEvent event) throws Exception { + + Object obj = event.getObject(); + Map t = (Map) obj; + super.addFilter("transactionmodule", String.valueOf(t.get("pk_transactionmodule"))); + super.addFilter("transactioncode", String.valueOf(t.get("pk_transactioncode"))); + super.addFilter("transactionversion", String.valueOf(t.get("pk_transactionversion"))); + super.addField("transactionname", String.valueOf(t.get("name"))); + // this.query(); + } + + /** + * Inicializa las fechas + */ + public void initDates() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(this.getWorkingDate()); + this.todate = calendar.getTime(); + calendar.add(Calendar.YEAR, -1); + calendar.add(Calendar.DATE, -1); + this.fromdate = calendar.getTime(); + } + + /** + * Entrega la fecha de trabajo de la aplicacin. + * + * @return Fecah Fecha de trabajo. + * @throws Exception + */ + public Date getWorkingDate() { + Date workingDate = null; + try { + TgeneAccountingDateBranchController c = new TgeneAccountingDateBranchController(); + c.getMfilters().clear(); + c.getMfilters().put("pk.branchcode", "0"); + c.getMfilters().put("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + c.query(); + workingDate = c.getRecord().getWorkingdate(); + } catch (Exception ex) { + // + } + return workingDate; + } + + /** + * Entrega la fecha en String + * + * @param fecha Date + * @return Fecha en String + */ + public String dateToString(Date fecha) { + String formato = ""; + try { + PropertiesHandler ph = new PropertiesHandler("general_es"); + formato = ph.getStringValue("dateformat"); + } catch (Exception e) { + // nothing + } + SimpleDateFormat date = new SimpleDateFormat(formato); + return date.format(fecha); + } + + /** + * Consulta el detalle de los flujos + */ + public void queryRequestDetail() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = new DtoQuery("com.fp.persistence.pbpm.gene.TbpmActivities", this.page, 20, true, new HashMap()); + + HashMap mtables = new HashMap(); + mtables.put("TBPMACTIVITIES", dto); + request.setQueryTables(mtables); + request.put("querytype", "P"); + request.put("queryalias", "FLOWDETAIL"); + System.out.println("JOURNAL IDDDDDD " + this.recordmap.get("id")); + request.put("ID", this.recordmap.get("id")); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.ltbpmactivities = new ArrayList>(); + MessageHelper.setMessageError(resp); + } else { + this.ltbpmactivities = (List>) resp.get("TBPMACTIVITIES"); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Entrega una lista de objetos + * + * @return ltransactionlog Lista de objetos + */ + public List> getLtransactionlog() { + return ltransactionlog; + } + + /** + * Fija una lista de objetos + * + * @aram ltransactionlog Lista de objetos + */ + public void setLtransactionlog(List> ltransactionlog) { + this.ltransactionlog = ltransactionlog; + } + + /** + * Entrega el ojbeto Date + * + * @return fromdate + */ + public Date getFromdate() { + return fromdate; + } + + /** + * Fija el ojbeto Date + * + * @param fromdate + */ + public void setFromdate(Date fromdate) { + this.fromdate = fromdate; + } + + /** + * Entrega el ojbeto Date + * + * @return todate + */ + public Date getTodate() { + return todate; + } + + /** + * Fija el ojbeto Date + * + * @param todate + */ + public void setTodate(Date todate) { + this.todate = todate; + } + + /** + * Entrega un Map + * + * @return recordmap + */ + public Map getRecordmap() { + return recordmap; + } + + /** + * Fija un Map + * + * @param recordmap + */ + public void setRecordmap(Map recordmap) { + this.recordmap = recordmap; + } + + /** + * Entrega una list de Map con las actividades del flujo + * + * @return ltbpmactivities + */ + public List> getLtbpmactivities() { + return ltbpmactivities; + } + + /** + * Fija una list de Map con las actividades del flujo + * + * @param ltbpmactivities + */ + public void setLtbpmactivities(List> ltbpmactivities) { + this.ltbpmactivities = ltbpmactivities; + } + + /** + * Entrega un mapa activityDetail + * + * @return activityDetail + */ + public Map getActivityDetail() { + return activityDetail; + } + + /** + * Fija un mapa activityDetail + * + * @param activityDetail + */ + public void setActivityDetail(Map activityDetail) { + this.activityDetail = activityDetail; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/ExportFlowsController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/ExportFlowsController.java.svn-base new file mode 100644 index 0000000..264e828 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/ExportFlowsController.java.svn-base @@ -0,0 +1,255 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.pgeneral.date.TgeneAccountingDateBranchController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora para exportar flujos. + * + * @author WPA + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ExportFlowsController extends AbstractController { + + + public ExportFlowsController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + this.initDates(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Atributo fecha desde + */ + private Date fromdate; + + /** + * Atributo fecha hasta + */ + private Date todate; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + private String solicitud; + private Date fec_actual; + private String codCentroControl; + private TcustPersonDetail customerperson; + private TsafeUserDetail userDetail; + private TsafeUserDetail tsafeUserDetailUsuario = null; + @ManagedProperty(value = "#{logincontroller}") + private LoginController logincontroller; + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + //this.beanalias = "TBPM"; + this.beanalias = "REPORTE"; + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + MessageHelper.setMessageError("msg_notQuery"); + return; + } + + @Override + public void save(){ + MessageHelper.setMessageError("msg_notSave"); + return; + } + + /** + * Ejecuta un QueryAlias + */ + public void getFileContent(){ + byte[] file = null; + try { + Request request = this.callerhelper.getRequest(); + request.put("queryalias", "EXPORTBPM"); + request.put("querytype", "P"); + request.put("creationdate", this.fromdate); + request.put("enddate", this.todate); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(resp); + } else { + file = (byte[])resp.get("file"); + super.downloadFile(file, (String)resp.get("contentType"), (String)resp.get("extension")); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Inicializa las fechas + */ + private void initDates() { + int val = this.getAniosParameter(); + Calendar calendar = Calendar.getInstance(); +// calendar.setTime(this.getWorkingDate()); + this.todate = calendar.getTime(); + calendar.add(Calendar.YEAR, -val); + calendar.add(Calendar.DATE, -1); + this.fromdate = calendar.getTime(); + } + + /** + * Entrega la fecha de trabajo de la aplicacin. + * @return Fecah Fecha de trabajo. + * @throws Exception + */ + private Date getWorkingDate() { + Date workingDate = null; + try{ + TgeneAccountingDateBranchController c = new TgeneAccountingDateBranchController(); + c.getMfilters().clear(); + c.getMfilters().put("pk.branchcode", "0"); + c.getMfilters().put("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + c.query(); + workingDate = c.getRecord().getWorkingdate(); + }catch(Exception ex){ + // + } + return workingDate; + } + + /** + * Obtiene el valor del número de anios máximos para la consulta de flujos + * @return value + */ + private Integer getAniosParameter(){ + Integer value = null; + TgeneParameters parameter = ParametersController.find("MAX_BACK", super.getLoginController().getRequest().getCompany().toString()); + if(parameter!=null){ + value = parameter.getNumbervalue().intValue(); + }else value = 1; + return value; + } + + /** + * Entrega la fecha desde + * @return formdate Fecha desde + */ + public Date getFromdate() { + return fromdate; + } + + /** + * Fija la fecha desde + * @param formdate Fecha desde + */ + public void setFromdate(Date fromdate) { + this.fromdate = fromdate; + } + + /** + * Entrega la fecha hasta + * @return formdate Fecha hasta + */ + public Date getTodate() { + return todate; + } + + /** + * Fija la fecha hasta + * @param fromdate Fecha hasta + */ + public void setTodate(Date todate) { + this.todate = todate; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + + public String getSolicitud() { + return solicitud; + } + + public void setSolicitud(String solicitud) { + this.solicitud = solicitud; + } + + + public LoginController getLogincontroller() { + return logincontroller; + } + + public void setLogincontroller(LoginController logincontroller) { + this.logincontroller = logincontroller; + } + + public void reporteFlujoSolicitudXls() { + try { + String gradoUsuario =""; + String path = "general/reports/flujoSolicitud"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename="reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("solicitud", solicitud); + String format = "xls"; + + try { + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/FieldTransactionMappingController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/FieldTransactionMappingController.java.svn-base new file mode 100644 index 0000000..593fc07 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/FieldTransactionMappingController.java.svn-base @@ -0,0 +1,212 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.TransactionLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmField; +import com.fp.persistence.pbpm.gene.TbpmFieldTransactionMaping; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * Clase controladora del bean TbpmFieldTransactionMaping. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class FieldTransactionMappingController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public FieldTransactionMappingController() throws Exception { + super(TbpmFieldTransactionMaping.class); + } + + /** + * Atributo para la lista de objetos TbpmField + */ + private List lfield; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //Listas + this.lfield = FieldsController.find(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TBPMFIELDTRANSACTIONORIGIN"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + if(super.getMfilters().get("pk.transactionmodule")==null){ + MessageHelper.setMessageError("msg_catalogrequird"); + return; + } + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.fieldname"); + + //Subquery + SubQuery subquery = new SubQuery("TbpmField", "description", "descriptionfield", "i.pk = t.pk.fieldname"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void create() throws Exception{ + if(super.getMfilters().get("pk.transactionmodule")==null){ + MessageHelper.setMessageError("msg_catalogrequird"); + return; + } + super.create(); + this.record.getPk().setTransactionmodule(super.getMfilters().get("pk.transactionmodule")); + this.record.getPk().setTransactioncode(new Integer(super.getMfilters().get("pk.transactioncode"))); + this.record.getPk().setTransactionversion(new Integer(super.getMfilters().get("pk.transactionversion"))); + } + + @Override + public void update() throws Exception{ + if(super.getMfilters().get("pk.transactionmodule")==null){ + MessageHelper.setMessageError("msg_catalogrequird"); + return; + } + super.update(); + } + + /** + * Abre el lov de transacciones + */ + public void openTransactionLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("TRANSACTION"); // valor del parametro + params.put("processtype", l); + + TransactionLovController.openLov(params); + } + + /** + * Gestiona la respuesta del lov + * @param event + * @throws Exception + */ + public void onReturnTransactionLov(SelectEvent event) throws Exception { + TgeneTransaction t = (TgeneTransaction) event.getObject(); + super.addFilter("pk.transactionmodule", t.getPk().getTransactionmodule()); + super.addFilter("pk.transactioncode", t.getPk().getTransactioncode().toString()); + super.addFilter("pk.transactionversion", t.getPk().getTransactionversion().toString()); + super.addField("transactionname", t.getName()); + this.query(); + } + + /** + * Controla el combo + */ + public void onChangeField(){ + if(this.record.getPk().getFieldname()!=null){ + for(TbpmField field: this.lfield){ + if(this.record.getPk().getFieldname().compareTo(field.getPk())==0){ + System.out.println("DESCRIPTION "+field.getDescription()); + this.record.put("descriptionfield", field.getDescription()); + System.out.println("DOS "+this.record.getModifiedData().get("descriptionfield")); + } + } + }else{ + this.record.put("descriptionfield", null); + } + } + + /** + * Entrega una lista de objetos TbpmField + * @return lfield Lista de objetos TbpmField + */ + public List getLfield() { + return lfield; + } + + /** + * Fija una lista de objetos TbpmField + * @param lfield Lista de objetos TbpmField + */ + public void setLfield(List lfield) { + this.lfield = lfield; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/FieldTransactionOriginController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/FieldTransactionOriginController.java.svn-base new file mode 100644 index 0000000..51808e9 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/FieldTransactionOriginController.java.svn-base @@ -0,0 +1,210 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.TransactionLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmField; +import com.fp.persistence.pbpm.gene.TbpmFieldTransactionOrigin; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * Clase controladora del bean TbpmFieldTransactionOrigin. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class FieldTransactionOriginController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public FieldTransactionOriginController() throws Exception { + super(TbpmFieldTransactionOrigin.class); + } + + /** + * Atributo para la lista de objetos TbpmField + */ + private List lfield; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //Listas + this.lfield = FieldsController.find(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TBPMFIELDTRANSACTIONORIGIN"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + if(super.getMfilters().get("pk.transactionmodule")==null){ + MessageHelper.setMessageError("msg_catalogrequird"); + return; + } + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.fieldname"); + + //Subquery + SubQuery subquery = new SubQuery("TbpmField", "description", "descriptionfield", "i.pk = t.pk.fieldname"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void create() throws Exception{ + if(super.getMfilters().get("pk.transactionmodule")==null){ + MessageHelper.setMessageError("msg_catalogrequird"); + return; + } + super.create(); + this.record.getPk().setTransactionmodule(super.getMfilters().get("pk.transactionmodule")); + this.record.getPk().setTransactioncode(new Integer(super.getMfilters().get("pk.transactioncode"))); + this.record.getPk().setTransactionversion(new Integer(super.getMfilters().get("pk.transactionversion"))); + } + + @Override + public void update() throws Exception{ + if(super.getMfilters().get("pk.transactionmodule")==null){ + MessageHelper.setMessageError("msg_catalogrequird"); + return; + } + super.update(); + } + + /** + * Abre el lov de transacciones + */ + public void openTransactionLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("TRANSACTION"); // valor del parametro + params.put("processtype", l); + + TransactionLovController.openLov(params); + } + + /** + * Gestiona la respuesta del lov + * @param event + * @throws Exception + */ + public void onReturnTransactionLov(SelectEvent event) throws Exception { + TgeneTransaction t = (TgeneTransaction) event.getObject(); + super.addFilter("pk.transactionmodule", t.getPk().getTransactionmodule()); + super.addFilter("pk.transactioncode", t.getPk().getTransactioncode().toString()); + super.addFilter("pk.transactionversion", t.getPk().getTransactionversion().toString()); + super.addField("transactionname", t.getName()); + this.query(); + } + + /** + * Controla el combo + */ + public void onChangeField(){ + if(this.record.getPk().getFieldname()!=null){ + for(TbpmField field: this.lfield){ + if(this.record.getPk().getFieldname().compareTo(field.getPk())==0){ + this.record.put("descriptionfield", field.getDescription()); + } + } + }else{ + this.record.put("descriptionfield", null); + } + } + + /** + * Entrega una lista de objetos TbpmField + * @return lfield Lista de objetos TbpmField + */ + public List getLfield() { + return lfield; + } + + /** + * Fija una lista de objetos TbpmField + * @param lfield Lista de objetos TbpmField + */ + public void setLfield(List lfield) { + this.lfield = lfield; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/FieldsController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/FieldsController.java.svn-base new file mode 100644 index 0000000..dd5d360 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/FieldsController.java.svn-base @@ -0,0 +1,129 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmField; + +/** + * Clase controladora del bean TsafeUserDetail. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class FieldsController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public FieldsController() throws Exception { + super(TbpmField.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TBPMFIELD"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Entrega una lista de objetos TbpmField + * @return lrecord Lista de objetos TbpmField + */ + public static List find() { + try { + FieldsController cc = new FieldsController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/FlowsController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/FlowsController.java.svn-base new file mode 100644 index 0000000..cb84712 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/FlowsController.java.svn-base @@ -0,0 +1,140 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmFlows; + +/** + * Clase controladora del bean TbpmFlows. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class FlowsController extends AbstractController { + + private static final long serialVersionUID = -759951425037143358L; + + public FlowsController() throws Exception { + super(TbpmFlows.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TBPMFLOWS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.flowcode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void create() throws Exception{ + super.create(); + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + } + + /** + * Entrega una lista de objetos TbpmGroups + * @param companycode Código de compania + * @return lrecord Lista de objetos TbpmGroups + */ + public static List find(String companycode) { + try { + FlowsController cc = new FlowsController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.companycode", companycode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/GroupsController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/GroupsController.java.svn-base new file mode 100644 index 0000000..4843d33 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/GroupsController.java.svn-base @@ -0,0 +1,140 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmGroups; + +/** + * Clase controladora del bean TbpmGroups. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class GroupsController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public GroupsController() throws Exception { + super(TbpmGroups.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TBPMGROUPS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.groupcode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void create() throws Exception{ + super.create(); + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + } + + /** + * Entrega una lista de objetos TbpmGroups + * @param companycode Código de compania + * @return lrecord Lista de objetos TbpmGroups + */ + public static List find(String companycode) { + try { + GroupsController cc = new GroupsController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.companycode", companycode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/GroupsUsersController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/GroupsUsersController.java.svn-base new file mode 100644 index 0000000..18dc725 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/GroupsUsersController.java.svn-base @@ -0,0 +1,226 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.bpm.lov.GroupsLovController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.safe.UserDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmGroups; +import com.fp.persistence.pbpm.gene.TbpmGroupsUsers; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.sun.mail.handlers.message_rfc822; + +/** + * Clase controladora del bean TgeneCatalogDetail. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class GroupsUsersController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public GroupsUsersController() throws Exception { + super(TbpmGroupsUsers.class); + } + + @ManagedProperty(value = "#{userDetailController}") + private UserDetailController userdetail; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "GROUPSUSERS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.groupcode") == null) { + MessageHelper.setMessageError("msg_grouprequird"); + return; + } + super.create(); + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + this.record.getPk().setGroupcode(super.getMfilters().get("pk.groupcode")); + } + + @Override + public void update() throws Exception { + if(record.getPk().getUsercode() == null){ + MessageHelper.setMessageError("msg_userrequired"); + }else{ + super.update(); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + + if(super.getMfilters().get("pk.groupcode")==null){ + MessageHelper.setMessageError("msg_grouprequird"); + return; + } + + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.groupcode"); + + //Subquery + SubQuery subquery2 = new SubQuery("TcustPersonDetail", "name", "username", + "i.pk.dateto = to_date('2999-12-31', 'yyyy-MM-dd') and " + + "i.pk.personcode = (select a.personcode from TsafeUser a where a.pk = t.pk.usercode and a.companycode=t.pk.companycode)"); + dto.addSubQuery(subquery2); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + + HashMap msave = new HashMap(); + Request request = this.callerhelper.getRequest(); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + + if(!dtosave.pendingProcess()){ + return; + } + + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public void openGroupsLov() { + Map> params = new HashMap<>(); + GroupsLovController.openLov(params); + } + + public void onReturnGroupsLov(SelectEvent event) throws Exception { + TbpmGroups t = (TbpmGroups) event.getObject(); + super.addFilter("pk.groupcode", t.getPk().getGroupcode()); + super.addField("description", t.getDescription()); + this.query(); + } + + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + this.userdetail.getMfilters().clear(); + this.userdetail.addFilter("pk.personcode", t.getPk().getPersoncode().toString()); + this.userdetail.query(); + if(this.userdetail.getRecord()==null){ + this.record.getPk().setUsercode(null); + this.record.getModifiedData().put("username", null); + MessageHelper.setMessageError("msg_userNotFound"); + return; + } + if(this.userdetail.getRecord().getIsuserbpm()==null || this.userdetail.getRecord().getIsuserbpm().equals("N")){ + this.record.getPk().setUsercode(null); + this.record.getModifiedData().put("username", null); + MessageHelper.setMessageError("msg_notUserBpm"); + return; + } + this.record.getPk().setUsercode(this.userdetail.getRecord().getPk().getUsercode()); + this.record.getModifiedData().put("username", t.getName()); + } + + /** + * Entrega el valor de: userdetail + * + * @return UserDetailController + */ + public UserDetailController getUserdetail() { + return this.userdetail; + } + + /** + * Fija el valor de: userdetail + * + * @param userdetail Valor a fijar en el atributo. + */ + public void setUserdetail(UserDetailController userdetail) { + this.userdetail = userdetail; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/InboxController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/InboxController.java.netbeans-base new file mode 100644 index 0000000..cc0622b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/InboxController.java.netbeans-base @@ -0,0 +1,561 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.component.accordionpanel.AccordionPanel; +import org.primefaces.event.TabChangeEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmGroupsUsers; +import com.fp.persistence.pgeneral.log.TgeneTransactionLog; + +/** + * Clase que muestra + * + * @author amerchan + * @version 2.1 + */ +@ManagedBean +@SessionScoped +public class InboxController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private List lBpmGroups; + + private List> lTransactionsByGroup; + + private List> lTransactions; + + private String beanGroupsName; + + private String codBpmGroupSelected; + + private String bpmDataStatus; + + private String bpmDataComment; + + private String filterTaskName; + + private int tabDiaryId; + + private int accordionTaskTabId; + + private int accordionGroupTabId; + + private List ltaskidinprocess = new ArrayList<>(); + + public InboxController() throws Exception { + super(TgeneTransactionLog.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + beanGroupsName = "BPMGROUPS"; + this.listGroups(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + + } + + @SuppressWarnings("unchecked") + protected void listGroups() { + try { + Request request = callerhelper.getRequest(); + Map mGroupsFilter = new HashMap(); + mGroupsFilter.put("pk.usercode", super.getLoginController().getRequest().getUser()); + mGroupsFilter.put("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + DtoQuery dto = new DtoQuery(TbpmGroupsUsers.class.getName(), page, 100, true, mGroupsFilter); + SubQuery subquery = new SubQuery("TbpmGroups", "description", "groupName", + "i.pk.groupcode = t.pk.groupcode and i.pk.companycode=t.pk.companycode"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(beanGroupsName, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lBpmGroups = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lBpmGroups = (List) resp.get(beanGroupsName); + if ((lBpmGroups != null) && !lBpmGroups.isEmpty()) { + codBpmGroupSelected = lBpmGroups.get(0).getPk().getGroupcode(); + } + super.postQuery((List) resp.get(beanGroupsName)); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void queryTransactionsByGroup() { + try { + ltaskidinprocess = new ArrayList<>(); + this.initBpmData(); + Request request = callerhelper.getRequest(); + request.put("queryalias", "INBOX_TRN_GROUP"); + request.put("querytype", "P"); + request.put("groupId", codBpmGroupSelected); + + Response resp = callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lTransactionsByGroup = new ArrayList>(); + MessageHelper.setMessageError(resp); + } else { + lTransactionsByGroup = (List>) resp.get("transactions"); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + if ((lTransactionsByGroup != null) && !lTransactionsByGroup.isEmpty()) { + this.fillTransactions(lTransactionsByGroup, true); + } + } + + @SuppressWarnings("unchecked") + public void queryTransactions() { + try { + ltaskidinprocess = new ArrayList<>(); + this.initBpmData(); + Request request = callerhelper.getRequest(); + request.put("queryalias", "INBOX_TRN"); + request.put("querytype", "P"); + + Response resp = callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lTransactions = new ArrayList>(); + MessageHelper.setMessageError(resp); + } else { + lTransactions = (List>) resp.get("transactions"); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + if ((lTransactions != null) && !lTransactions.isEmpty()) { + // no hacer la consulta entrega el detalle de la tarea. + // this.fillTransactions(this.lTransactions, false); + } + } + + private void fillTransactions(List> lTransactions, boolean isGroup) { + for (Map map : lTransactions) { + String tModule = (String) map.get("m"); + Integer tCode = (Integer) map.get("t"); + Integer tVersion = (Integer) map.get("v"); + this.fillTasks(map, tModule, tCode, tVersion, isGroup); + } + } + + @SuppressWarnings("unchecked") + private void fillTasks(Map map, String tModule, Integer tCode, Integer tVersion, boolean isGroup) { + try { + Request request = callerhelper.getNewRequest(tModule, tCode, tVersion); + String filtertasks = filterTaskName; + if (isGroup) { + request.put("queryalias", "INBOX_TASK_TRN_GROUP"); + request.put("querytype", "P"); + request.put("groupId", codBpmGroupSelected); + } else { + request.put("queryalias", "INBOX_TASK_TRN"); + } + + if ((filtertasks == null) || filtertasks.isEmpty()) { + filtertasks = "%"; + } + request.put("cri", filtertasks); + + Response resp = callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(resp); + } else { + List> lTasks = (List>) resp.get("tasks"); + map.put("tasks", lTasks); + for (Map mapTask : lTasks) { + this.fillTaskDetail(mapTask); + } + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + private void fillTaskDetail(Map mapTask) { + try { + Request request = callerhelper.getNewRequest(null, null, null); + request.put("queryalias", "INBOX_TASK_DETAIL"); + request.put("querytype", "P"); + request.put("TID", mapTask.get("tid")); + + Response resp = callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(resp); + } else { + Map param = (Map) resp.get("param"); + param.put("TID", mapTask.get("tid")); + param.put("KIND", resp.get("k")); + mapTask.put("taskDetail", resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void initBpmData() throws Exception { + lTransactionsByGroup = new ArrayList>(); + lTransactions = new ArrayList>(); + bpmDataStatus = ""; + bpmDataComment = ""; + filterTaskName = ""; + String tabDiaryId = super.getRequestParameter("tabDiary"); + try { + this.tabDiaryId = Integer.parseInt(tabDiaryId); + } catch (Exception e) { + } + } + + public void enableBpmData() { + try { + String kind = super.getRequestParameter("kind"); + String status = super.getRequestParameter("s"); + if (kind == null) { + return; + } + if (status.compareTo("Reserved") == 0) { + this.initTask(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void initTask() throws Throwable { + String tid = super.getRequestParameter("tid"); + if (ltaskidinprocess.contains(tid)) { + return; + } + Request request = callerhelper.getNewRequest("2", 2001, 1); + request.modifiedData().put("TID", tid); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + ltaskidinprocess.add(tid); + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } + + public void assignTask() { + try { + String taskId = super.getRequestParameter("tid"); + Request request = callerhelper.getNewRequest("2", 2000, 1); + request.modifiedData().put("TID", taskId); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void filterTasks() { + try { + String tModule = super.getRequestParameter("tModule"); + Integer tCode = Integer.parseInt(super.getRequestParameter("tCode")); + Integer tVersion = Integer.parseInt(super.getRequestParameter("tVersion")); + filterTaskName = super.getRequestParameter("filterTaskName"); + + Map map = this.getTransactionMap(lTransactions, tModule, tCode, tVersion); + this.fillTasks(map, tModule, tCode, tVersion, false); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void filterTasksGroups() { + try { + String tModule = super.getRequestParameter("tModule"); + Integer tCode = Integer.parseInt(super.getRequestParameter("tCode")); + Integer tVersion = Integer.parseInt(super.getRequestParameter("tVersion")); + filterTaskName = super.getRequestParameter("filterTaskName"); + + Map map = this.getTransactionMap(lTransactionsByGroup, tModule, tCode, tVersion); + + this.fillTasks(map, tModule, tCode, tVersion, true); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private Map getTransactionMap(List> lTransactions, String tModule, Integer tCode, Integer tVersion) { + for (Map map : lTransactions) { + String module = (String) map.get("m"); + Integer transaction = (Integer) map.get("t"); + Integer version = (Integer) map.get("v"); + + if ((tModule.compareTo(module) == 0) && (tCode.compareTo(transaction) == 0) && (tVersion.compareTo(version) == 0)) { + return map; + } + } + return null; + } + + public void onAccordionTasksTabChange(TabChangeEvent event) { + // System.out.println(((AccordionPanel)event.getSource()).getPage()); + accordionTaskTabId = Integer.parseInt(((AccordionPanel) event.getSource()).getActiveIndex()); + } + + public void onAccordionGroupsTabChange(TabChangeEvent event) { + // event.getTab().getId() + accordionGroupTabId = Integer.parseInt(((AccordionPanel) event.getSource()).getActiveIndex()); + } + + /** + * Entrega el valor de: beanGroupsName + * + * @return String + */ + public String getBeanGroupsName() { + return beanGroupsName; + } + + /** + * Fija el valor de: beanGroupsName + * + * @param beanGroupsName Valor a fijar en el atributo + */ + public void setBeanGroupsName(String beanGroupsName) { + this.beanGroupsName = beanGroupsName; + } + + /** + * Entrega el valor de: lBpmGroups + * + * @return List + */ + public List getlBpmGroups() { + return lBpmGroups; + } + + /** + * Fija el valor de: lBpmGroups + * + * @param lBpmGroups Valor a fijar en el atributo + */ + public void setlBpmGroups(List lBpmGroups) { + this.lBpmGroups = lBpmGroups; + } + + /** + * Entrega el valor de: lTransactionsByGroup + * + * @return List> + */ + public List> getlTransactionsByGroup() { + return lTransactionsByGroup; + } + + /** + * Fija el valor de: lTransactionsByGroup + * + * @param lTransactionsByGroup Valor a fijar en el atributo + */ + public void setlTransactionsByGroup(List> lTransactionsByGroup) { + this.lTransactionsByGroup = lTransactionsByGroup; + } + + /** + * Entrega el valor de: lTransactions + * + * @return List> + */ + public List> getlTransactions() { + return lTransactions; + } + + /** + * Fija el valor de: lTransactions + * + * @param lTransactions Valor a fijar en el atributo + */ + public void setlTransactions(List> lTransactions) { + this.lTransactions = lTransactions; + } + + /** + * Entrega el valor de: bpmDataStatus + * + * @return String + */ + @Override + public String getBpmDataStatus() { + return bpmDataStatus; + } + + /** + * Fija el valor de: bpmDataStatus + * + * @param bpmDataStatus Valor a fijar en el atributo + */ + @Override + public void setBpmDataStatus(String bpmDataStatus) { + this.bpmDataStatus = bpmDataStatus; + } + + /** + * Entrega el valor de: bpmDataComment + * + * @return String + */ + @Override + public String getBpmDataComment() { + return bpmDataComment; + } + + /** + * Fija el valor de: bpmDataComment + * + * @param bpmDataComment Valor a fijar en el atributo + */ + @Override + public void setBpmDataComment(String bpmDataComment) { + this.bpmDataComment = bpmDataComment; + } + + /** + * Entrega el valor de: taskFilter + * + * @return String + */ + public String getFilterTaskName() { + return filterTaskName; + } + + /** + * Fija el valor de: taskFilter + * + * @param taskFilter Valor a fijar en el atributo + */ + public void setFilterTaskName(String taskFilter) { + filterTaskName = taskFilter; + } + + /** + * Entrega el valor de: tabDiaryId + * + * @return int + */ + public int getTabDiaryId() { + return tabDiaryId; + } + + /** + * Fija el valor de: tabDiaryId + * + * @param tabDiaryId Valor a fijar en el atributo + */ + public void setTabDiaryId(int tabDiaryId) { + this.tabDiaryId = tabDiaryId; + } + + /** + * Entrega el valor de: accordionTaskTabId + * + * @return int + */ + public int getAccordionTaskTabId() { + return accordionTaskTabId; + } + + /** + * Fija el valor de: accordionTaskTabId + * + * @param accordionTaskTabId Valor a fijar en el atributo + */ + public void setAccordionTaskTabId(int accordionTaskTabId) { + this.accordionTaskTabId = accordionTaskTabId; + } + + /** + * Entrega el valor de: accordionGroupTabId + * + * @return int + */ + public int getAccordionGroupTabId() { + return accordionGroupTabId; + } + + /** + * Fija el valor de: accordionGroupTabId + * + * @param accordionGroupTabId Valor a fijar en el atributo + */ + public void setAccordionGroupTabId(int accordionGroupTabId) { + this.accordionGroupTabId = accordionGroupTabId; + } + + /** + * Entrega el valor de: codBpmGroupSelected + * + * @return String + */ + public String getCodBpmGroupSelected() { + return codBpmGroupSelected; + } + + /** + * Fija el valor de: codBpmGroupSelected + * + * @param codBpmGroupSelected Valor a fijar en el atributo + */ + public void setCodBpmGroupSelected(String codBpmGroupSelected) { + this.codBpmGroupSelected = codBpmGroupSelected; + } + + public void logout() { + FacesContext fc = FacesContext.getCurrentInstance(); + if(fc!=null){ + fc.getExternalContext().invalidateSession(); + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/InboxController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/InboxController.java.svn-base new file mode 100644 index 0000000..cc0622b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/InboxController.java.svn-base @@ -0,0 +1,561 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.component.accordionpanel.AccordionPanel; +import org.primefaces.event.TabChangeEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmGroupsUsers; +import com.fp.persistence.pgeneral.log.TgeneTransactionLog; + +/** + * Clase que muestra + * + * @author amerchan + * @version 2.1 + */ +@ManagedBean +@SessionScoped +public class InboxController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private List lBpmGroups; + + private List> lTransactionsByGroup; + + private List> lTransactions; + + private String beanGroupsName; + + private String codBpmGroupSelected; + + private String bpmDataStatus; + + private String bpmDataComment; + + private String filterTaskName; + + private int tabDiaryId; + + private int accordionTaskTabId; + + private int accordionGroupTabId; + + private List ltaskidinprocess = new ArrayList<>(); + + public InboxController() throws Exception { + super(TgeneTransactionLog.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + beanGroupsName = "BPMGROUPS"; + this.listGroups(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + + } + + @SuppressWarnings("unchecked") + protected void listGroups() { + try { + Request request = callerhelper.getRequest(); + Map mGroupsFilter = new HashMap(); + mGroupsFilter.put("pk.usercode", super.getLoginController().getRequest().getUser()); + mGroupsFilter.put("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + DtoQuery dto = new DtoQuery(TbpmGroupsUsers.class.getName(), page, 100, true, mGroupsFilter); + SubQuery subquery = new SubQuery("TbpmGroups", "description", "groupName", + "i.pk.groupcode = t.pk.groupcode and i.pk.companycode=t.pk.companycode"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(beanGroupsName, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lBpmGroups = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lBpmGroups = (List) resp.get(beanGroupsName); + if ((lBpmGroups != null) && !lBpmGroups.isEmpty()) { + codBpmGroupSelected = lBpmGroups.get(0).getPk().getGroupcode(); + } + super.postQuery((List) resp.get(beanGroupsName)); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void queryTransactionsByGroup() { + try { + ltaskidinprocess = new ArrayList<>(); + this.initBpmData(); + Request request = callerhelper.getRequest(); + request.put("queryalias", "INBOX_TRN_GROUP"); + request.put("querytype", "P"); + request.put("groupId", codBpmGroupSelected); + + Response resp = callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lTransactionsByGroup = new ArrayList>(); + MessageHelper.setMessageError(resp); + } else { + lTransactionsByGroup = (List>) resp.get("transactions"); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + if ((lTransactionsByGroup != null) && !lTransactionsByGroup.isEmpty()) { + this.fillTransactions(lTransactionsByGroup, true); + } + } + + @SuppressWarnings("unchecked") + public void queryTransactions() { + try { + ltaskidinprocess = new ArrayList<>(); + this.initBpmData(); + Request request = callerhelper.getRequest(); + request.put("queryalias", "INBOX_TRN"); + request.put("querytype", "P"); + + Response resp = callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lTransactions = new ArrayList>(); + MessageHelper.setMessageError(resp); + } else { + lTransactions = (List>) resp.get("transactions"); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + if ((lTransactions != null) && !lTransactions.isEmpty()) { + // no hacer la consulta entrega el detalle de la tarea. + // this.fillTransactions(this.lTransactions, false); + } + } + + private void fillTransactions(List> lTransactions, boolean isGroup) { + for (Map map : lTransactions) { + String tModule = (String) map.get("m"); + Integer tCode = (Integer) map.get("t"); + Integer tVersion = (Integer) map.get("v"); + this.fillTasks(map, tModule, tCode, tVersion, isGroup); + } + } + + @SuppressWarnings("unchecked") + private void fillTasks(Map map, String tModule, Integer tCode, Integer tVersion, boolean isGroup) { + try { + Request request = callerhelper.getNewRequest(tModule, tCode, tVersion); + String filtertasks = filterTaskName; + if (isGroup) { + request.put("queryalias", "INBOX_TASK_TRN_GROUP"); + request.put("querytype", "P"); + request.put("groupId", codBpmGroupSelected); + } else { + request.put("queryalias", "INBOX_TASK_TRN"); + } + + if ((filtertasks == null) || filtertasks.isEmpty()) { + filtertasks = "%"; + } + request.put("cri", filtertasks); + + Response resp = callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(resp); + } else { + List> lTasks = (List>) resp.get("tasks"); + map.put("tasks", lTasks); + for (Map mapTask : lTasks) { + this.fillTaskDetail(mapTask); + } + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + private void fillTaskDetail(Map mapTask) { + try { + Request request = callerhelper.getNewRequest(null, null, null); + request.put("queryalias", "INBOX_TASK_DETAIL"); + request.put("querytype", "P"); + request.put("TID", mapTask.get("tid")); + + Response resp = callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(resp); + } else { + Map param = (Map) resp.get("param"); + param.put("TID", mapTask.get("tid")); + param.put("KIND", resp.get("k")); + mapTask.put("taskDetail", resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void initBpmData() throws Exception { + lTransactionsByGroup = new ArrayList>(); + lTransactions = new ArrayList>(); + bpmDataStatus = ""; + bpmDataComment = ""; + filterTaskName = ""; + String tabDiaryId = super.getRequestParameter("tabDiary"); + try { + this.tabDiaryId = Integer.parseInt(tabDiaryId); + } catch (Exception e) { + } + } + + public void enableBpmData() { + try { + String kind = super.getRequestParameter("kind"); + String status = super.getRequestParameter("s"); + if (kind == null) { + return; + } + if (status.compareTo("Reserved") == 0) { + this.initTask(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void initTask() throws Throwable { + String tid = super.getRequestParameter("tid"); + if (ltaskidinprocess.contains(tid)) { + return; + } + Request request = callerhelper.getNewRequest("2", 2001, 1); + request.modifiedData().put("TID", tid); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + ltaskidinprocess.add(tid); + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } + + public void assignTask() { + try { + String taskId = super.getRequestParameter("tid"); + Request request = callerhelper.getNewRequest("2", 2000, 1); + request.modifiedData().put("TID", taskId); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void filterTasks() { + try { + String tModule = super.getRequestParameter("tModule"); + Integer tCode = Integer.parseInt(super.getRequestParameter("tCode")); + Integer tVersion = Integer.parseInt(super.getRequestParameter("tVersion")); + filterTaskName = super.getRequestParameter("filterTaskName"); + + Map map = this.getTransactionMap(lTransactions, tModule, tCode, tVersion); + this.fillTasks(map, tModule, tCode, tVersion, false); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void filterTasksGroups() { + try { + String tModule = super.getRequestParameter("tModule"); + Integer tCode = Integer.parseInt(super.getRequestParameter("tCode")); + Integer tVersion = Integer.parseInt(super.getRequestParameter("tVersion")); + filterTaskName = super.getRequestParameter("filterTaskName"); + + Map map = this.getTransactionMap(lTransactionsByGroup, tModule, tCode, tVersion); + + this.fillTasks(map, tModule, tCode, tVersion, true); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private Map getTransactionMap(List> lTransactions, String tModule, Integer tCode, Integer tVersion) { + for (Map map : lTransactions) { + String module = (String) map.get("m"); + Integer transaction = (Integer) map.get("t"); + Integer version = (Integer) map.get("v"); + + if ((tModule.compareTo(module) == 0) && (tCode.compareTo(transaction) == 0) && (tVersion.compareTo(version) == 0)) { + return map; + } + } + return null; + } + + public void onAccordionTasksTabChange(TabChangeEvent event) { + // System.out.println(((AccordionPanel)event.getSource()).getPage()); + accordionTaskTabId = Integer.parseInt(((AccordionPanel) event.getSource()).getActiveIndex()); + } + + public void onAccordionGroupsTabChange(TabChangeEvent event) { + // event.getTab().getId() + accordionGroupTabId = Integer.parseInt(((AccordionPanel) event.getSource()).getActiveIndex()); + } + + /** + * Entrega el valor de: beanGroupsName + * + * @return String + */ + public String getBeanGroupsName() { + return beanGroupsName; + } + + /** + * Fija el valor de: beanGroupsName + * + * @param beanGroupsName Valor a fijar en el atributo + */ + public void setBeanGroupsName(String beanGroupsName) { + this.beanGroupsName = beanGroupsName; + } + + /** + * Entrega el valor de: lBpmGroups + * + * @return List + */ + public List getlBpmGroups() { + return lBpmGroups; + } + + /** + * Fija el valor de: lBpmGroups + * + * @param lBpmGroups Valor a fijar en el atributo + */ + public void setlBpmGroups(List lBpmGroups) { + this.lBpmGroups = lBpmGroups; + } + + /** + * Entrega el valor de: lTransactionsByGroup + * + * @return List> + */ + public List> getlTransactionsByGroup() { + return lTransactionsByGroup; + } + + /** + * Fija el valor de: lTransactionsByGroup + * + * @param lTransactionsByGroup Valor a fijar en el atributo + */ + public void setlTransactionsByGroup(List> lTransactionsByGroup) { + this.lTransactionsByGroup = lTransactionsByGroup; + } + + /** + * Entrega el valor de: lTransactions + * + * @return List> + */ + public List> getlTransactions() { + return lTransactions; + } + + /** + * Fija el valor de: lTransactions + * + * @param lTransactions Valor a fijar en el atributo + */ + public void setlTransactions(List> lTransactions) { + this.lTransactions = lTransactions; + } + + /** + * Entrega el valor de: bpmDataStatus + * + * @return String + */ + @Override + public String getBpmDataStatus() { + return bpmDataStatus; + } + + /** + * Fija el valor de: bpmDataStatus + * + * @param bpmDataStatus Valor a fijar en el atributo + */ + @Override + public void setBpmDataStatus(String bpmDataStatus) { + this.bpmDataStatus = bpmDataStatus; + } + + /** + * Entrega el valor de: bpmDataComment + * + * @return String + */ + @Override + public String getBpmDataComment() { + return bpmDataComment; + } + + /** + * Fija el valor de: bpmDataComment + * + * @param bpmDataComment Valor a fijar en el atributo + */ + @Override + public void setBpmDataComment(String bpmDataComment) { + this.bpmDataComment = bpmDataComment; + } + + /** + * Entrega el valor de: taskFilter + * + * @return String + */ + public String getFilterTaskName() { + return filterTaskName; + } + + /** + * Fija el valor de: taskFilter + * + * @param taskFilter Valor a fijar en el atributo + */ + public void setFilterTaskName(String taskFilter) { + filterTaskName = taskFilter; + } + + /** + * Entrega el valor de: tabDiaryId + * + * @return int + */ + public int getTabDiaryId() { + return tabDiaryId; + } + + /** + * Fija el valor de: tabDiaryId + * + * @param tabDiaryId Valor a fijar en el atributo + */ + public void setTabDiaryId(int tabDiaryId) { + this.tabDiaryId = tabDiaryId; + } + + /** + * Entrega el valor de: accordionTaskTabId + * + * @return int + */ + public int getAccordionTaskTabId() { + return accordionTaskTabId; + } + + /** + * Fija el valor de: accordionTaskTabId + * + * @param accordionTaskTabId Valor a fijar en el atributo + */ + public void setAccordionTaskTabId(int accordionTaskTabId) { + this.accordionTaskTabId = accordionTaskTabId; + } + + /** + * Entrega el valor de: accordionGroupTabId + * + * @return int + */ + public int getAccordionGroupTabId() { + return accordionGroupTabId; + } + + /** + * Fija el valor de: accordionGroupTabId + * + * @param accordionGroupTabId Valor a fijar en el atributo + */ + public void setAccordionGroupTabId(int accordionGroupTabId) { + this.accordionGroupTabId = accordionGroupTabId; + } + + /** + * Entrega el valor de: codBpmGroupSelected + * + * @return String + */ + public String getCodBpmGroupSelected() { + return codBpmGroupSelected; + } + + /** + * Fija el valor de: codBpmGroupSelected + * + * @param codBpmGroupSelected Valor a fijar en el atributo + */ + public void setCodBpmGroupSelected(String codBpmGroupSelected) { + this.codBpmGroupSelected = codBpmGroupSelected; + } + + public void logout() { + FacesContext fc = FacesContext.getCurrentInstance(); + if(fc!=null){ + fc.getExternalContext().invalidateSession(); + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/NotifyController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/NotifyController.java.svn-base new file mode 100644 index 0000000..e6855d9 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/NotifyController.java.svn-base @@ -0,0 +1,172 @@ +package com.fp.frontend.controller.bpm; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.date.TgeneAccountingDateBranchController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.commondb.helper.APPDates; +import com.fp.persistence.pbpm.gene.TbpmNotify; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TbpmNotify. + * + * @author WPA. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class NotifyController extends AbstractController { + + /** + * Constructor + * @throws Exception + */ + public NotifyController() throws Exception { + super(TbpmNotify.class); + } + + /** + * Atributo para la lista de catalogos + */ + private List lcatalog; + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //Lista + this.lcatalog = CatalogDetailController.find("NOTIFYTOCATALOG"); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + super.create(); + super.record.setNotifytocatalogcode("NOTIFYTOCATALOG"); + super.record.setRegisterdate(new Timestamp(this.getWorkingDate().getTime())); + super.record.setUserwhoreg(super.getLoginController().getRequest().getUser()); + this.lrecord = new ArrayList<>(); + this.beanalias = "TBPMNOTIFY"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Entrega la fecha de trabajo de la aplicacin. + * @return Fecah Fecha de trabajo. + */ + private Date getWorkingDate() { + Date workingDate = null; + try{ + TgeneAccountingDateBranchController c = new TgeneAccountingDateBranchController(); + c.getMfilters().clear(); + c.getMfilters().put("pk.branchcode", "0"); + c.getMfilters().put("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + c.query(); + workingDate = c.getRecord().getWorkingdate(); + }catch(Exception ex){ + // + } + return workingDate; + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(false); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.record = new TbpmNotify(); + MessageHelper.setMessageError(resp); + } else { + this.record = (TbpmNotify) resp.get(this.beanalias); + if (this.record != null) { + super.postQuery((AbstractDataTransport) resp.get(this.beanalias)); + } else { + this.create(); + } + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + this.update(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Entrega la lista de objetos TgeneCatalogDetail + * @return lcatalog + */ + public List getLcatalog() { + return lcatalog; + } + + /** + * Fija la lista de objetos TgeneCatalogDetail + * @param lcatalog + */ + public void setLcatalog(List lcatalog) { + this.lcatalog = lcatalog; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/RulesController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/RulesController.java.svn-base new file mode 100644 index 0000000..02599a1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/RulesController.java.svn-base @@ -0,0 +1,268 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletRequest; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.MessageTemplatesLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmRules; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplates; + +/** + * Clase controladora del bean TbpmRules. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class RulesController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public RulesController() throws Exception { + super(TbpmRules.class); + } + + /** + * Atributo para el tipo de archivo + */ + private List lfiletype; + /** + * Atributo para Si/No + */ + private List lyesnot; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //Listas + this.getListFileType(); + this.getList(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TBPMRULES"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.rulecode"); + + //Subquery + SubQuery subquery = new SubQuery("TgeneMessageTemplates", "description", "messagedesc", "i.pk = t.messagecode"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + public void refresh(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = new DtoSave(); + List l = new ArrayList(); + l.add(this.record); + dtosave.addNew(l); + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + request.modifiedData().put("refresh", "Y"); + Response resp = this.callerhelper.executeSave(request); + request.modifiedData().remove("refresh"); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void create() throws Exception{ + super.create(); + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + this.record.setSnapshot("LATEST"); + this.record.setParametertype("java.util.Map"); + } + + /** + * Metodo que llena lal lista de tipo de archivo + */ + private void getListFileType(){ + this.lfiletype = new ArrayList(); + String[] flows = {"F", "FLUJOS"}; + String[] rules = {"R", "REGLAS"}; + this.lfiletype.add(flows); + this.lfiletype.add(rules); + } + + /** + * Metodo que llena lal lista de tipo de archivo + */ + private void getList(){ + this.lyesnot = new ArrayList(); + String[] no = {"N", "NO"}; + String[] yes = {"Y", "SI"}; + this.lyesnot.add(no); + this.lyesnot.add(yes); + } + + /** + * Abre el Lov de Mensajes + */ + public void openMessagesLov() { + Map> params = new HashMap<>(); + MessageTemplatesLovController.openLov(params); + } + + /** + * Gestiona la respuesta del lov + * @param event + * @throws Exception + */ + public void onReturnMessagesLov(SelectEvent event) throws Exception { + TgeneMessageTemplates t = (TgeneMessageTemplates) event.getObject(); + this.record.setMessagecode(t.getPk()); + this.record.getModifiedData().put("messagedesc", t.getDescription()); + } + + + + /** + * Entrega la lista de tpos de archivo + * @return lfiletype Lista de tpos de archivo + */ + public List getLfiletype() { + return lfiletype; + } + + /** + * Fija la lista de tpos de archivo + * @param lfiletype Lista de tpos de archivo + */ + public void setLfiletype(List lfiletype) { + this.lfiletype = lfiletype; + } + + /** + * Entrega la lista Si/No + * @return lyesnot Lista Si/No + */ + public List getLyesnot() { + return lyesnot; + } + + /** + * Fija la lista Si/No + * @param lyesnot Lista Si/No + */ + public void setLyesnot(List lyesnot) { + this.lyesnot = lyesnot; + } + + /** + * Elimina el mensaje + */ + public void removemessage(){ + if(this.record!=null){ + this.record.setMessagecode(null); + this.record.put("messagedesc", null); + } + } + + /** + * Fija el paquete segun el tipo de archivo + */ + public void changeFile(){ + if(this.record.getFiletype().equals("F")){ + this.record.setPackagename("maia.flows"); + }else if(this.record.getFiletype().equals("R")){ + this.record.setPackagename("maia.rules"); + }else{ + this.record.setPackagename(null); + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/TaskServerController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/TaskServerController.java.svn-base new file mode 100644 index 0000000..27dd302 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/TaskServerController.java.svn-base @@ -0,0 +1,231 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.ServicesController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneServices; + +/** + * Clase controladora del TaskServer. + * + * @author WPA. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class TaskServerController extends AbstractController { + + /** + * Constructor + * @throws Exception + */ + public TaskServerController() throws Exception { + super(AbstractDataTransport.class); + } + + /** + * Atributo para la url de la página + */ + private String page; + + /** + * Atributo para habilitar el inicio + */ + private boolean lockStart; + + /** + * Atributo para habilitar el detener + */ + private boolean lockStop; + + /** + * Atributo para la lista de servicios + */ + private List lservices; + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //List + this.lservices = ServicesController.find(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "SERVICES"; + //page + this.page = "/resources/images/blanck.jpg"; + //lock + this.lockStart = false; + this.lockStop = false; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + MessageHelper.setMessageError("msg_notQuery"); + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + MessageHelper.setMessageError("msg_notSave"); + } + + public void queryTransaction(){ + try { + if(super.getMfilters().get("servicecode")==null){ + this.init(); + return; + } + + Request request = this.callerhelper.getRequest(); + request.put("querytype", "T"); + request.put("code",super.getMfilters().get("servicecode")); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(resp); + } else { + this.responseService((Boolean)resp.get("TSStatus")); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Ejecuta una peticion + * @param status I/S + */ + public void processServer(String status){ + try { + Request request = this.callerhelper.getRequest(); + request.put("status", status); + request.put("code", super.getMfilters().get("servicecode")); + + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.responseService((Boolean)resp.get("TSStatus")); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Procesa la respuesta + * @param response + */ + public void responseService(boolean response){ + if(response){ + this.page = "/resources/images/green.jpg"; + this.lockStart = false; + this.lockStop = true; + }else{ + this.page = "/resources/images/red.jpg"; + this.lockStart = true; + this.lockStop = false; + } + } + + /** + * Entrega una lista de objetos TgeneServices + * @return lservices + */ + public List getLservices() { + return lservices; + } + + /** + * Fija una lista de objetos TgeneServices + * @param lservices + */ + public void setLservices(List lservices) { + this.lservices = lservices; + } + + /** + * Entrega el valor de page + * @return page + */ + public String getPage() { + return page; + } + + /** + * Fija el valor de page + * @param page + */ + public void setPage(String page) { + this.page = page; + } + + /** + * Entrega V/F lockStart + * @return lockStart + */ + public boolean isLockStart() { + return lockStart; + } + + /** + * Fija V/F lockStart + * @param lockStart + */ + public void setLockStart(boolean lockStart) { + this.lockStart = lockStart; + } + + /** + * Entrega V/F lockStop + * @return lockStop + */ + public boolean isLockStop() { + return lockStop; + } + + /** + * Fija V/F lockStop + * @param lockStop + */ + public void setLockStop(boolean lockStop) { + this.lockStop = lockStop; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/TransactionLogController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/TransactionLogController.java.svn-base new file mode 100644 index 0000000..c68d785 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/.svn/text-base/TransactionLogController.java.svn-base @@ -0,0 +1,709 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.json.Serializer; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.TransactionLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.log.TgeneTransactionLog; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; +import com.fp.simple.dto.TaskInfo; +import com.fp.simple.dto.metadata.ProcessInstanceMeta; + +/** + * Clase que muestra + * + * @author amerchan + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TransactionLogController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private List> lTransactionLogResult; + + private Map tLogResult; + + // monitor + private List> lorigin; + + private List lstatus; + + private List lpim; + + private Map first; + + private List> lLast; + + private List lLastA; + + private List lActualTaskInfo; + + private List> ltaskDetailData; + + private List> ltaskDetailComments; + + private TaskInfo taskInfoSelected; + + private String actualTaskName; + + private boolean enableFlowButton; + + private String flowJson; + + private String lFlowsResponseJson; + + private Long processId; + + private String trn; + + private String aname; + + private String comment; + + private String imageFlowName = "/resources/images/bpm/stackTraceOff.png"; + + public TransactionLogController() throws Exception { + super(TgeneTransactionLog.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.lrecord = new ArrayList<>(); + this.beanalias = "TRANSACTIONLOG"; + this.enableFlowButton = false; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + private void initFlowInfo() { + this.lorigin = new ArrayList>(); + this.lstatus = new ArrayList(); + this.lpim = new ArrayList(); + this.lActualTaskInfo = new ArrayList(); + this.lLast = new ArrayList>(); + this.lLastA = new ArrayList(); + this.first = new HashMap(); + this.ltaskDetailData = new ArrayList>(); + this.ltaskDetailComments = new ArrayList>(); + this.taskInfoSelected = new TaskInfo(); + this.enableFlowButton = false; + this.trn = ""; + this.aname = ""; + this.imageFlowName = ""; + this.actualTaskName = ""; + this.flowJson = ""; + this.lFlowsResponseJson = ""; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if (!this.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); + request.setQueryTables(mtables); + request.put("querytype", "P"); + request.put("queryalias", "TRANSACTIONLOGRESULT"); + + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lTransactionLogResult = new ArrayList>(); + MessageHelper.setMessageError(resp); + } else { + this.lTransactionLogResult = (List>) resp.get(this.beanalias); + this.lrecord.add(null); // dummy para que funcione la paginacion en el metodo next() + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void queryMonitor() { + try { + this.initFlowInfo(); + Request request = this.callerhelper.getRequest(); + request.put("querytype", "T"); + request.put("queryalias", "TRANSACTIONLOGRESULT"); + request.put("PID", this.processId); + + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lorigin = new ArrayList>(); + this.lstatus = new ArrayList(); + this.lpim = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lorigin = (List>) resp.get("origin"); + this.lstatus = (ArrayList) resp.get("status"); + this.lpim = this.lstatus; + this.trn = (String) resp.get("TRN"); + // System.out.println(this.lorigin); + } + this.showFlow(); + this.first = (Map) resp.get("FIRST"); + this.showDefaultTask(); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void queryTaskDetail() { + try { + Request request = this.callerhelper.getRequest(); + request.put("querytype", "P"); + request.put("queryalias", "TASKDETAIL"); + request.put("PID", this.processId); + request.put("TID", this.taskInfoSelected.getTaskId()); + request.put("JID", this.taskInfoSelected.getJournalId()); + + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.ltaskDetailData = new ArrayList>(); + this.ltaskDetailComments = new ArrayList>(); + MessageHelper.setMessageError(resp); + } else { + this.ltaskDetailData = (List>) resp.get("data"); + this.ltaskDetailComments = (List>) resp.get("comments"); + // super.cloneOriginalBean((List) resp.get(this.beanalias)); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void showTask() { + try { + String taskName = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("taskName"); + // System.out.println("taskName::"+taskName); + Request request = this.callerhelper.getRequest(); + request.put("querytype", "P"); + request.put("queryalias", "TASKHISTORY"); + request.put("PID", this.processId); + request.put("SPID", this.processId); + request.put("NAME", taskName); + + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lActualTaskInfo = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.showActualInfo(taskName, (List) ((Map) resp.get("DATA")).values().toArray()[0]); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void saveComment() { + try { + Request request = this.callerhelper.getNewRequest(this.callerhelper.getRequest().getTransactionModule(), 2002, 1); + request.modifiedData().put("TID", this.taskInfoSelected.getTaskId()); + request.modifiedData().put("BPMObs", this.comment); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + this.comment = ""; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + private void showDefaultTask() { + try { + Map mapTasks = null; + if (this.first != null) { + mapTasks = (Map) this.first.values().toArray()[0]; + } + String key = null; + List lTaskValues = null; + if (mapTasks != null) { + key = (String) mapTasks.keySet().toArray()[0]; + lTaskValues = (List) mapTasks.values().toArray()[0]; + } + + this.showActualInfo(key, lTaskValues); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void showFlow() throws Exception { + String pMetaId = super.getRequestParameter("pMetaId"); + // System.out.println("pMetaId:"+pMetaId); + if (pMetaId != null && !pMetaId.isEmpty()) { + this.enableFlowButton = true; + this.lLast.add(this.lLast.size(), this.lpim); + this.lLastA.add(this.lLastA.size(), this.aname); + this.lpim = this.getSubFlow(pMetaId); + } + this.showImage(!this.lpim.isEmpty() ? this.lpim.get(0) : null); + } + + public void showLastFlow() throws Exception { + this.lpim = this.lLast.get(this.lLast.size() - 1); + this.lLast.remove(this.lLast.size() - 1); + + if (this.lLast.size() < 1) { + this.enableFlowButton = false; + this.showDefaultTask(); + } + this.showImage(this.lpim.get(0)); + } + + private List getSubFlow(String pMetaid) { + Long metaId = Long.parseLong(pMetaid); + for (ProcessInstanceMeta processInstanceMeta : this.lpim) { + if (processInstanceMeta.getPmetaid().compareTo(metaId) == 0) { + return processInstanceMeta.getSub(); + } + } + return null; + } + + @SuppressWarnings("unchecked") + private void showImage(ProcessInstanceMeta pFlow) throws Exception { + if (pFlow == null) { + return; + } + this.processId = pFlow.getPid(); + if (pFlow != null) { + this.showActualInfo("", pFlow.getVariables() == null || pFlow.getVariables().get("actualTask") == null ? null : (List) pFlow + .getVariables().get("actualTask")); + } + this.imageFlowName = "/resources/images/bpm/flows/" + pFlow.getName() + "-" + pFlow.getVersion() + ".png"; + } + + private void showActualInfo(String name, List lActualTaskInfo) throws Exception { + this.actualTaskName = name; + this.aname = name; + this.lActualTaskInfo = lActualTaskInfo; + Response r = new Response("", ""); + r.put("flows", this.lpim); + Serializer ser = new Serializer(r); + + // System.out.println(ser.toJSON()); + this.lFlowsResponseJson = ser.toJSON(); + } + + public void openTransactionLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("TRANSACTION"); // valor del parametro + params.put("processtype", l); + + TransactionLovController.openLov(params); + } + + public void onReturnTransactionLov(SelectEvent event) throws Exception { + TgeneTransaction t = (TgeneTransaction) event.getObject(); + super.addFilter("transactionmodule", t.getPk().getTransactionmodule()); + super.addFilter("transactioncode", t.getPk().getTransactioncode().toString()); + super.addFilter("transactionversion", t.getPk().getTransactionversion().toString()); + super.addField("transactionname", t.getName()); + this.query(); + } + + /** + * Entrega el valor de: lTransactionLogResult + * + * @return List> + */ + public List> getlTransactionLogResult() { + return this.lTransactionLogResult; + } + + /** + * Fija el valor de: lTransactionLogResult + * + * @param lTransactionLogResult Valor a fijar en el atributo + */ + public void setlTransactionLogResult(List> lTransactionLogResult) { + this.lTransactionLogResult = lTransactionLogResult; + } + + /** + * Entrega el valor de: tLogResult + * + * @return Map + */ + public Map gettLogResult() { + return this.tLogResult; + } + + /** + * Fija el valor de: tLogResult + * + * @param tLogResult Valor a fijar en el atributo + */ + public void settLogResult(Map tLogResult) { + this.tLogResult = tLogResult; + } + + /** + * Entrega el valor de: lorigin + * + * @return List> + */ + public List> getLorigin() { + return this.lorigin; + } + + /** + * Fija el valor de: lorigin + * + * @param lorigin Valor a fijar en el atributo + */ + public void setLorigin(List> lorigin) { + this.lorigin = lorigin; + } + + /** + * Entrega el valor de: lstatus + * + * @return List + */ + public List getLstatus() { + return this.lstatus; + } + + /** + * Fija el valor de: lstatus + * + * @param lstatus Valor a fijar en el atributo + */ + public void setLstatus(List lstatus) { + this.lstatus = lstatus; + } + + /** + * Entrega el valor de: lpim + * + * @return List + */ + public List getLpim() { + return this.lpim; + } + + /** + * Fija el valor de: lpim + * + * @param lpim Valor a fijar en el atributo + */ + public void setLpim(List lpim) { + this.lpim = lpim; + } + + /** + * Entrega el valor de: lLast + * + * @return List + */ + public List> getlLast() { + return this.lLast; + } + + /** + * Fija el valor de: lLast + * + * @param lLast Valor a fijar en el atributo + */ + public void setlLast(List> lLast) { + this.lLast = lLast; + } + + /** + * Entrega el valor de: lLastA + * + * @return List + */ + public List getlLastA() { + return this.lLastA; + } + + /** + * Fija el valor de: lLastA + * + * @param lLastA Valor a fijar en el atributo + */ + public void setlLastA(List lLastA) { + this.lLastA = lLastA; + } + + /** + * Entrega el valor de: lActualTaskInfo + * + * @return List + */ + public List getlActualTaskInfo() { + return this.lActualTaskInfo; + } + + /** + * Fija el valor de: lActualTaskInfo + * + * @param lActualTaskInfo Valor a fijar en el atributo + */ + public void setlActualTaskInfo(List lActualTaskInfo) { + this.lActualTaskInfo = lActualTaskInfo; + } + + /** + * Entrega el valor de: ltaskDetailData + * + * @return List> + */ + public List> getLtaskDetailData() { + return this.ltaskDetailData; + } + + /** + * Fija el valor de: ltaskDetailData + * + * @param ltaskDetailData Valor a fijar en el atributo + */ + public void setLtaskDetailData(List> ltaskDetailData) { + this.ltaskDetailData = ltaskDetailData; + } + + /** + * Entrega el valor de: ltaskDetailComments + * + * @return List> + */ + public List> getLtaskDetailComments() { + return this.ltaskDetailComments; + } + + /** + * Fija el valor de: ltaskDetailComments + * + * @param ltaskDetailComments Valor a fijar en el atributo + */ + public void setLtaskDetailComments(List> ltaskDetailComments) { + this.ltaskDetailComments = ltaskDetailComments; + } + + /** + * Entrega el valor de: taskInfoSelected + * + * @return TaskInfo + */ + public TaskInfo getTaskInfoSelected() { + return this.taskInfoSelected; + } + + /** + * Fija el valor de: taskInfoSelected + * + * @param taskInfoSelected Valor a fijar en el atributo + */ + public void setTaskInfoSelected(TaskInfo taskInfoSelected) { + this.taskInfoSelected = taskInfoSelected; + } + + /** + * Entrega el valor de: lFlowsResponseJson + * + * @return String + */ + public String getlFlowsResponseJson() { + return this.lFlowsResponseJson; + } + + /** + * Fija el valor de: lFlowsResponseJson + * + * @param lFlowsResponseJson Valor a fijar en el atributo + */ + public void setlFlowsResponseJson(String lFlowsResponseJson) { + this.lFlowsResponseJson = lFlowsResponseJson; + } + + /** + * Entrega el valor de: flowJson + * + * @return String + */ + public String getFlowJson() { + return this.flowJson; + } + + /** + * Fija el valor de: flowJson + * + * @param flowJson Valor a fijar en el atributo + */ + public void setFlowJson(String flowJson) { + this.flowJson = flowJson; + } + + /** + * Entrega el valor de: processId + * + * @return String + */ + public Long getProcessId() { + return this.processId; + } + + /** + * Fija el valor de: processId + * + * @param processId Valor a fijar en el atributo + */ + public void setProcessId(Long processId) { + this.processId = processId; + } + + /** + * Entrega el valor de: trn + * + * @return String + */ + public String getTrn() { + return this.trn; + } + + /** + * Fija el valor de: trn + * + * @param trn Valor a fijar en el atributo + */ + public void setTrn(String trn) { + this.trn = trn; + } + + /** + * Entrega el valor de: aname + * + * @return String + */ + public String getAname() { + return this.aname; + } + + /** + * Fija el valor de: aname + * + * @param aname Valor a fijar en el atributo + */ + public void setAname(String aname) { + this.aname = aname; + } + + /** + * Entrega el valor de: comment + * + * @return String + */ + public String getComment() { + return this.comment; + } + + /** + * Fija el valor de: comment + * + * @param comment Valor a fijar en el atributo + */ + public void setComment(String comment) { + this.comment = comment; + } + + /** + * Entrega el valor de: actualTaskName + * + * @return String + */ + public String getActualTaskName() { + return this.actualTaskName; + } + + /** + * Fija el valor de: actualTaskName + * + * @param actualTaskName Valor a fijar en el atributo + */ + public void setActualTaskName(String actualTaskName) { + this.actualTaskName = actualTaskName; + } + + /** + * Entrega el valor de: enableFlowButton + * + * @return boolean + */ + public boolean isEnableFlowButton() { + return this.enableFlowButton; + } + + /** + * Fija el valor de: enableFlowButton + * + * @param enableFlowButton Valor a fijar en el atributo + */ + public void setEnableFlowButton(boolean enableFlowButton) { + this.enableFlowButton = enableFlowButton; + } + + /** + * Entrega el valor de: imageFlowName + * + * @return String + */ + public String getImageFlowName() { + return this.imageFlowName; + } + + /** + * Fija el valor de: imageFlowName + * + * @param imageFlowName Valor a fijar en el atributo + */ + public void setImageFlowName(String imageFlowName) { + this.imageFlowName = imageFlowName; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/AssignmentsController.java b/frontend/src/main/java/com/fp/frontend/controller/bpm/AssignmentsController.java new file mode 100644 index 0000000..1cd2c78 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/AssignmentsController.java @@ -0,0 +1,221 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.safe.UserDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; + +/** + * Clase controladora del bean AbstractDataTransport. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class AssignmentsController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public AssignmentsController() throws Exception { + super(AbstractDataTransport.class); + } + + @ManagedProperty(value = "#{userDetailController}") + private UserDetailController userdetail; + + /** + * Atributo para la lista de objetos del QueryAlias + */ + private List> ltasks; + + /** + * Atributo para obtener los datos del query + */ + private Map recordmap; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recordmap = new HashMap(); + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "tasks"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + request.put("querytype", "P"); + request.put("userCri", super.getMfilters().get("user")); + request.put("cri", ""); + request.put("queryalias", "ASIGNEDTASKS"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.ltasks = new ArrayList>(); + MessageHelper.setMessageError(resp); + } else { + this.ltasks = (List>) resp.get(this.beanalias); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + MessageHelper.setMessageError("msg_notSave"); + } + + /** + * Método que llama al lov de Personas + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Maneja la respuesta del Lov de Personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + this.userdetail.getMfilters().clear(); + this.userdetail.addFilter("pk.personcode", t.getPk().getPersoncode().toString()); + this.userdetail.query(); + if (this.userdetail.getRecord() == null) { + MessageHelper.setMessageError("msg_userNotFound"); + return; + } + if (this.userdetail.getRecord().getIsuserbpm() == null || this.userdetail.getRecord().getIsuserbpm().equals("N")) { + MessageHelper.setMessageError("msg_notUserBpm"); + return; + } + this.recordmap.put("userasigned", this.userdetail.getRecord().getPk().getUsercode()); + this.recordmap.put("nameasigned", t.getName()); + } + + /** + * Ejecuta el action del asigned + */ + public void assigned() { + try { + Request request = this.callerhelper.getRequest(); + request.setUser((String) this.recordmap.get("userasigned")); + request.put("TID", this.recordmap.get("tid")); + + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + this.querydatabase(); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Entrega una lista de mapas + * + * @return ltasks Lista de mapas + */ + public List> getLtasks() { + return ltasks; + } + + /** + * Fija una lista de mapas + * + * @param ltasks Lista de mapas + */ + public void setLtasks(List> ltasks) { + this.ltasks = ltasks; + } + + /** + * Entrega una mapa + * + * @return recordmap Mapas + */ + public Map getRecordmap() { + return recordmap; + } + + /** + * Fija una mapa + * + * @param recordmap Mapas + */ + public void setRecordmap(Map recordmap) { + this.recordmap = recordmap; + } + + /** + * Entrega el valor de: userdetail + * + * @return UserDetailController + */ + public UserDetailController getUserdetail() { + return this.userdetail; + } + + /** + * Fija el valor de: userdetail + * + * @param userdetail Valor a fijar en el atributo. + */ + public void setUserdetail(UserDetailController userdetail) { + this.userdetail = userdetail; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/EndedFlowsController.java b/frontend/src/main/java/com/fp/frontend/controller/bpm/EndedFlowsController.java new file mode 100644 index 0000000..45ab0d9 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/EndedFlowsController.java @@ -0,0 +1,355 @@ +package com.fp.frontend.controller.bpm; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.common.properties.PropertiesHandler; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.bpm.lov.TransactionBpmELovController; +import com.fp.frontend.controller.pgeneral.date.TgeneAccountingDateBranchController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.log.TgeneTransactionLog; + +/** + * Clase controladora del bean TgeneTransactionLog. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class EndedFlowsController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public EndedFlowsController() throws Exception { + super(TgeneTransactionLog.class); + } + + /** + * Atributo para la lista de objetos del QueryAlias + */ + private List> ltransactionlog; + + /** + * Atributo para la lista de objetos del QueryAlias + */ + private List> ltbpmactivities; + + /** + * Atributo para obtener los datos del query + */ + private Map recordmap; + + /** + * Atributo para el detalle de la actividad realizada + */ + private Map activityDetail; + + /** + * Atributo para el filtro de fecha desde + */ + private Date fromdate; + + /** + * Atributo para el filtro de fecha hasta + */ + private Date todate; + + @PostConstruct + private void postconstruct() { + this.init(); + // this.initDates(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TRANSACTIONLOG"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if (super.getMfilters().get("transactionmodule") == null) { + MessageHelper.setMessageError("msg_catalogrequird"); + return; + } + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + request.put("querytype", "P"); + request.put("creationdate", this.fromdate); + request.put("enddate", this.todate); + request.put("queryalias", "ENDEDFLOWS"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.ltransactionlog = new ArrayList>(); + MessageHelper.setMessageError(resp); + } else { + this.ltransactionlog = (List>) resp.get(this.beanalias); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + MessageHelper.setMessageError("msg_notSave"); + } + + /** + * Abre el lov de transacciones + */ + public void openTransactionLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("TRANSACTION"); // valor del parametro + params.put("processtype", l); + + TransactionBpmELovController.openLov(params); + } + + /** + * Gestiona la respuesta del lov + * + * @param event + * @throws Exception + */ + public void onReturnTransactionLov(SelectEvent event) throws Exception { + + Object obj = event.getObject(); + Map t = (Map) obj; + super.addFilter("transactionmodule", String.valueOf(t.get("pk_transactionmodule"))); + super.addFilter("transactioncode", String.valueOf(t.get("pk_transactioncode"))); + super.addFilter("transactionversion", String.valueOf(t.get("pk_transactionversion"))); + super.addField("transactionname", String.valueOf(t.get("name"))); + // this.query(); + } + + /** + * Inicializa las fechas + */ + public void initDates() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(this.getWorkingDate()); + this.todate = calendar.getTime(); + calendar.add(Calendar.YEAR, -1); + calendar.add(Calendar.DATE, -1); + this.fromdate = calendar.getTime(); + } + + /** + * Entrega la fecha de trabajo de la aplicacin. + * + * @return Fecah Fecha de trabajo. + * @throws Exception + */ + public Date getWorkingDate() { + Date workingDate = null; + try { + TgeneAccountingDateBranchController c = new TgeneAccountingDateBranchController(); + c.getMfilters().clear(); + c.getMfilters().put("pk.branchcode", "0"); + c.getMfilters().put("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + c.query(); + workingDate = c.getRecord().getWorkingdate(); + } catch (Exception ex) { + // + } + return workingDate; + } + + /** + * Entrega la fecha en String + * + * @param fecha Date + * @return Fecha en String + */ + public String dateToString(Date fecha) { + String formato = ""; + try { + PropertiesHandler ph = new PropertiesHandler("general_es"); + formato = ph.getStringValue("dateformat"); + } catch (Exception e) { + // nothing + } + SimpleDateFormat date = new SimpleDateFormat(formato); + return date.format(fecha); + } + + /** + * Consulta el detalle de los flujos + */ + public void queryRequestDetail() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = new DtoQuery("com.fp.persistence.pbpm.gene.TbpmActivities", this.page, 20, true, new HashMap()); + + HashMap mtables = new HashMap(); + mtables.put("TBPMACTIVITIES", dto); + request.setQueryTables(mtables); + request.put("querytype", "P"); + request.put("queryalias", "FLOWDETAIL"); + System.out.println("JOURNAL IDDDDDD " + this.recordmap.get("id")); + request.put("ID", this.recordmap.get("id")); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.ltbpmactivities = new ArrayList>(); + MessageHelper.setMessageError(resp); + } else { + this.ltbpmactivities = (List>) resp.get("TBPMACTIVITIES"); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Entrega una lista de objetos + * + * @return ltransactionlog Lista de objetos + */ + public List> getLtransactionlog() { + return ltransactionlog; + } + + /** + * Fija una lista de objetos + * + * @aram ltransactionlog Lista de objetos + */ + public void setLtransactionlog(List> ltransactionlog) { + this.ltransactionlog = ltransactionlog; + } + + /** + * Entrega el ojbeto Date + * + * @return fromdate + */ + public Date getFromdate() { + return fromdate; + } + + /** + * Fija el ojbeto Date + * + * @param fromdate + */ + public void setFromdate(Date fromdate) { + this.fromdate = fromdate; + } + + /** + * Entrega el ojbeto Date + * + * @return todate + */ + public Date getTodate() { + return todate; + } + + /** + * Fija el ojbeto Date + * + * @param todate + */ + public void setTodate(Date todate) { + this.todate = todate; + } + + /** + * Entrega un Map + * + * @return recordmap + */ + public Map getRecordmap() { + return recordmap; + } + + /** + * Fija un Map + * + * @param recordmap + */ + public void setRecordmap(Map recordmap) { + this.recordmap = recordmap; + } + + /** + * Entrega una list de Map con las actividades del flujo + * + * @return ltbpmactivities + */ + public List> getLtbpmactivities() { + return ltbpmactivities; + } + + /** + * Fija una list de Map con las actividades del flujo + * + * @param ltbpmactivities + */ + public void setLtbpmactivities(List> ltbpmactivities) { + this.ltbpmactivities = ltbpmactivities; + } + + /** + * Entrega un mapa activityDetail + * + * @return activityDetail + */ + public Map getActivityDetail() { + return activityDetail; + } + + /** + * Fija un mapa activityDetail + * + * @param activityDetail + */ + public void setActivityDetail(Map activityDetail) { + this.activityDetail = activityDetail; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/ExportFlowsController.java b/frontend/src/main/java/com/fp/frontend/controller/bpm/ExportFlowsController.java new file mode 100644 index 0000000..d643f80 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/ExportFlowsController.java @@ -0,0 +1,263 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.pgeneral.date.TgeneAccountingDateBranchController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora para exportar flujos. + * + * @author WPA + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ExportFlowsController extends AbstractController { + + public ExportFlowsController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + this.initDates(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Atributo fecha desde + */ + private Date fromdate; + + /** + * Atributo fecha hasta + */ + private Date todate; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + private String solicitud; + private Date fec_actual; + private String codCentroControl; + private TcustPersonDetail customerperson; + private TsafeUserDetail userDetail; + private TsafeUserDetail tsafeUserDetailUsuario = null; + @ManagedProperty(value = "#{logincontroller}") + private LoginController logincontroller; + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + //this.beanalias = "TBPM"; + this.beanalias = "REPORTE"; + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + MessageHelper.setMessageError("msg_notQuery"); + return; + } + + @Override + public void save() { + MessageHelper.setMessageError("msg_notSave"); + return; + } + + /** + * Ejecuta un QueryAlias + */ + public void getFileContent() { + byte[] file = null; + try { + Request request = this.callerhelper.getRequest(); + request.put("queryalias", "EXPORTBPM"); + request.put("querytype", "P"); + request.put("creationdate", this.fromdate); + request.put("enddate", this.todate); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(resp); + } else { + file = (byte[]) resp.get("file"); + super.downloadFile(file, (String) resp.get("contentType"), (String) resp.get("extension")); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Inicializa las fechas + */ + private void initDates() { + int val = this.getAniosParameter(); + Calendar calendar = Calendar.getInstance(); +// calendar.setTime(this.getWorkingDate()); + this.todate = calendar.getTime(); + calendar.add(Calendar.YEAR, -val); + calendar.add(Calendar.DATE, -1); + this.fromdate = calendar.getTime(); + } + + /** + * Entrega la fecha de trabajo de la aplicacin. + * + * @return Fecah Fecha de trabajo. + * @throws Exception + */ + private Date getWorkingDate() { + Date workingDate = null; + try { + TgeneAccountingDateBranchController c = new TgeneAccountingDateBranchController(); + c.getMfilters().clear(); + c.getMfilters().put("pk.branchcode", "0"); + c.getMfilters().put("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + c.query(); + workingDate = c.getRecord().getWorkingdate(); + } catch (Exception ex) { + // + } + return workingDate; + } + + /** + * Obtiene el valor del número de anios máximos para la + * consulta de flujos + * + * @return value + */ + private Integer getAniosParameter() { + Integer value = null; + TgeneParameters parameter = ParametersController.find("MAX_BACK", super.getLoginController().getRequest().getCompany().toString()); + if (parameter != null) { + value = parameter.getNumbervalue().intValue(); + } else { + value = 1; + } + return value; + } + + /** + * Entrega la fecha desde + * + * @return formdate Fecha desde + */ + public Date getFromdate() { + return fromdate; + } + + /** + * Fija la fecha desde + * + * @param formdate Fecha desde + */ + public void setFromdate(Date fromdate) { + this.fromdate = fromdate; + } + + /** + * Entrega la fecha hasta + * + * @return formdate Fecha hasta + */ + public Date getTodate() { + return todate; + } + + /** + * Fija la fecha hasta + * + * @param fromdate Fecha hasta + */ + public void setTodate(Date todate) { + this.todate = todate; + } + + public ReportController getReportController() { + return reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getSolicitud() { + return solicitud; + } + + public void setSolicitud(String solicitud) { + this.solicitud = solicitud; + } + + public LoginController getLogincontroller() { + return logincontroller; + } + + public void setLogincontroller(LoginController logincontroller) { + this.logincontroller = logincontroller; + } + + public void reporteFlujoSolicitudXls() { + try { + String gradoUsuario = ""; + String path = "general/reports/flujoSolicitud"; + //String filename=MsgControlArmas.getProperty("lbl_tramitesXcentro"); + String filename = "reporte"; + + //Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + parameters.put("solicitud", solicitud); + String format = "xls"; + + try { + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/FieldTransactionMappingController.java b/frontend/src/main/java/com/fp/frontend/controller/bpm/FieldTransactionMappingController.java new file mode 100644 index 0000000..e2e0bd0 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/FieldTransactionMappingController.java @@ -0,0 +1,216 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.TransactionLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmField; +import com.fp.persistence.pbpm.gene.TbpmFieldTransactionMaping; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * Clase controladora del bean TbpmFieldTransactionMaping. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class FieldTransactionMappingController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public FieldTransactionMappingController() throws Exception { + super(TbpmFieldTransactionMaping.class); + } + + /** + * Atributo para la lista de objetos TbpmField + */ + private List lfield; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //Listas + this.lfield = FieldsController.find(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TBPMFIELDTRANSACTIONORIGIN"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + if (super.getMfilters().get("pk.transactionmodule") == null) { + MessageHelper.setMessageError("msg_catalogrequird"); + return; + } + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.fieldname"); + + //Subquery + SubQuery subquery = new SubQuery("TbpmField", "description", "descriptionfield", "i.pk = t.pk.fieldname"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.transactionmodule") == null) { + MessageHelper.setMessageError("msg_catalogrequird"); + return; + } + super.create(); + this.record.getPk().setTransactionmodule(super.getMfilters().get("pk.transactionmodule")); + this.record.getPk().setTransactioncode(new Integer(super.getMfilters().get("pk.transactioncode"))); + this.record.getPk().setTransactionversion(new Integer(super.getMfilters().get("pk.transactionversion"))); + } + + @Override + public void update() throws Exception { + if (super.getMfilters().get("pk.transactionmodule") == null) { + MessageHelper.setMessageError("msg_catalogrequird"); + return; + } + super.update(); + } + + /** + * Abre el lov de transacciones + */ + public void openTransactionLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("TRANSACTION"); // valor del parametro + params.put("processtype", l); + + TransactionLovController.openLov(params); + } + + /** + * Gestiona la respuesta del lov + * + * @param event + * @throws Exception + */ + public void onReturnTransactionLov(SelectEvent event) throws Exception { + TgeneTransaction t = (TgeneTransaction) event.getObject(); + super.addFilter("pk.transactionmodule", t.getPk().getTransactionmodule()); + super.addFilter("pk.transactioncode", t.getPk().getTransactioncode().toString()); + super.addFilter("pk.transactionversion", t.getPk().getTransactionversion().toString()); + super.addField("transactionname", t.getName()); + this.query(); + } + + /** + * Controla el combo + */ + public void onChangeField() { + if (this.record.getPk().getFieldname() != null) { + for (TbpmField field : this.lfield) { + if (this.record.getPk().getFieldname().compareTo(field.getPk()) == 0) { + System.out.println("DESCRIPTION " + field.getDescription()); + this.record.put("descriptionfield", field.getDescription()); + System.out.println("DOS " + this.record.getModifiedData().get("descriptionfield")); + } + } + } else { + this.record.put("descriptionfield", null); + } + } + + /** + * Entrega una lista de objetos TbpmField + * + * @return lfield Lista de objetos TbpmField + */ + public List getLfield() { + return lfield; + } + + /** + * Fija una lista de objetos TbpmField + * + * @param lfield Lista de objetos TbpmField + */ + public void setLfield(List lfield) { + this.lfield = lfield; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/FieldTransactionOriginController.java b/frontend/src/main/java/com/fp/frontend/controller/bpm/FieldTransactionOriginController.java new file mode 100644 index 0000000..594a3b1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/FieldTransactionOriginController.java @@ -0,0 +1,214 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.TransactionLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmField; +import com.fp.persistence.pbpm.gene.TbpmFieldTransactionOrigin; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * Clase controladora del bean TbpmFieldTransactionOrigin. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class FieldTransactionOriginController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public FieldTransactionOriginController() throws Exception { + super(TbpmFieldTransactionOrigin.class); + } + + /** + * Atributo para la lista de objetos TbpmField + */ + private List lfield; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //Listas + this.lfield = FieldsController.find(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TBPMFIELDTRANSACTIONORIGIN"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + if (super.getMfilters().get("pk.transactionmodule") == null) { + MessageHelper.setMessageError("msg_catalogrequird"); + return; + } + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.fieldname"); + + //Subquery + SubQuery subquery = new SubQuery("TbpmField", "description", "descriptionfield", "i.pk = t.pk.fieldname"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.transactionmodule") == null) { + MessageHelper.setMessageError("msg_catalogrequird"); + return; + } + super.create(); + this.record.getPk().setTransactionmodule(super.getMfilters().get("pk.transactionmodule")); + this.record.getPk().setTransactioncode(new Integer(super.getMfilters().get("pk.transactioncode"))); + this.record.getPk().setTransactionversion(new Integer(super.getMfilters().get("pk.transactionversion"))); + } + + @Override + public void update() throws Exception { + if (super.getMfilters().get("pk.transactionmodule") == null) { + MessageHelper.setMessageError("msg_catalogrequird"); + return; + } + super.update(); + } + + /** + * Abre el lov de transacciones + */ + public void openTransactionLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("TRANSACTION"); // valor del parametro + params.put("processtype", l); + + TransactionLovController.openLov(params); + } + + /** + * Gestiona la respuesta del lov + * + * @param event + * @throws Exception + */ + public void onReturnTransactionLov(SelectEvent event) throws Exception { + TgeneTransaction t = (TgeneTransaction) event.getObject(); + super.addFilter("pk.transactionmodule", t.getPk().getTransactionmodule()); + super.addFilter("pk.transactioncode", t.getPk().getTransactioncode().toString()); + super.addFilter("pk.transactionversion", t.getPk().getTransactionversion().toString()); + super.addField("transactionname", t.getName()); + this.query(); + } + + /** + * Controla el combo + */ + public void onChangeField() { + if (this.record.getPk().getFieldname() != null) { + for (TbpmField field : this.lfield) { + if (this.record.getPk().getFieldname().compareTo(field.getPk()) == 0) { + this.record.put("descriptionfield", field.getDescription()); + } + } + } else { + this.record.put("descriptionfield", null); + } + } + + /** + * Entrega una lista de objetos TbpmField + * + * @return lfield Lista de objetos TbpmField + */ + public List getLfield() { + return lfield; + } + + /** + * Fija una lista de objetos TbpmField + * + * @param lfield Lista de objetos TbpmField + */ + public void setLfield(List lfield) { + this.lfield = lfield; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/FieldsController.java b/frontend/src/main/java/com/fp/frontend/controller/bpm/FieldsController.java new file mode 100644 index 0000000..9dbf2ef --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/FieldsController.java @@ -0,0 +1,131 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmField; + +/** + * Clase controladora del bean TsafeUserDetail. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class FieldsController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public FieldsController() throws Exception { + super(TbpmField.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TBPMFIELD"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Entrega una lista de objetos TbpmField + * + * @return lrecord Lista de objetos TbpmField + */ + public static List find() { + try { + FieldsController cc = new FieldsController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/FlowsController.java b/frontend/src/main/java/com/fp/frontend/controller/bpm/FlowsController.java new file mode 100644 index 0000000..05ba4bf --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/FlowsController.java @@ -0,0 +1,142 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmFlows; + +/** + * Clase controladora del bean TbpmFlows. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class FlowsController extends AbstractController { + + private static final long serialVersionUID = -759951425037143358L; + + public FlowsController() throws Exception { + super(TbpmFlows.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TBPMFLOWS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.flowcode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void create() throws Exception { + super.create(); + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + } + + /** + * Entrega una lista de objetos TbpmGroups + * + * @param companycode Código de compania + * @return lrecord Lista de objetos TbpmGroups + */ + public static List find(String companycode) { + try { + FlowsController cc = new FlowsController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.companycode", companycode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/GroupsController.java b/frontend/src/main/java/com/fp/frontend/controller/bpm/GroupsController.java new file mode 100644 index 0000000..777086d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/GroupsController.java @@ -0,0 +1,142 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmGroups; + +/** + * Clase controladora del bean TbpmGroups. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class GroupsController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public GroupsController() throws Exception { + super(TbpmGroups.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TBPMGROUPS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.groupcode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void create() throws Exception { + super.create(); + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + } + + /** + * Entrega una lista de objetos TbpmGroups + * + * @param companycode Código de compania + * @return lrecord Lista de objetos TbpmGroups + */ + public static List find(String companycode) { + try { + GroupsController cc = new GroupsController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.companycode", companycode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/GroupsUsersController.java b/frontend/src/main/java/com/fp/frontend/controller/bpm/GroupsUsersController.java new file mode 100644 index 0000000..bf2a5a4 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/GroupsUsersController.java @@ -0,0 +1,228 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.bpm.lov.GroupsLovController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.safe.UserDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmGroups; +import com.fp.persistence.pbpm.gene.TbpmGroupsUsers; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.sun.mail.handlers.message_rfc822; + +/** + * Clase controladora del bean TgeneCatalogDetail. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class GroupsUsersController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public GroupsUsersController() throws Exception { + super(TbpmGroupsUsers.class); + } + + @ManagedProperty(value = "#{userDetailController}") + private UserDetailController userdetail; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "GROUPSUSERS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.groupcode") == null) { + MessageHelper.setMessageError("msg_grouprequird"); + return; + } + super.create(); + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + this.record.getPk().setGroupcode(super.getMfilters().get("pk.groupcode")); + } + + @Override + public void update() throws Exception { + if (record.getPk().getUsercode() == null) { + MessageHelper.setMessageError("msg_userrequired"); + } else { + super.update(); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + + if (super.getMfilters().get("pk.groupcode") == null) { + MessageHelper.setMessageError("msg_grouprequird"); + return; + } + + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.groupcode"); + + //Subquery + SubQuery subquery2 = new SubQuery("TcustPersonDetail", "name", "username", + "i.pk.dateto = to_date('2999-12-31', 'yyyy-MM-dd') and " + + "i.pk.personcode = (select a.personcode from TsafeUser a where a.pk = t.pk.usercode and a.companycode=t.pk.companycode)"); + dto.addSubQuery(subquery2); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + + HashMap msave = new HashMap(); + Request request = this.callerhelper.getRequest(); + + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + + if (!dtosave.pendingProcess()) { + return; + } + + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public void openGroupsLov() { + Map> params = new HashMap<>(); + GroupsLovController.openLov(params); + } + + public void onReturnGroupsLov(SelectEvent event) throws Exception { + TbpmGroups t = (TbpmGroups) event.getObject(); + super.addFilter("pk.groupcode", t.getPk().getGroupcode()); + super.addField("description", t.getDescription()); + this.query(); + } + + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + this.userdetail.getMfilters().clear(); + this.userdetail.addFilter("pk.personcode", t.getPk().getPersoncode().toString()); + this.userdetail.query(); + if (this.userdetail.getRecord() == null) { + this.record.getPk().setUsercode(null); + this.record.getModifiedData().put("username", null); + MessageHelper.setMessageError("msg_userNotFound"); + return; + } + if (this.userdetail.getRecord().getIsuserbpm() == null || this.userdetail.getRecord().getIsuserbpm().equals("N")) { + this.record.getPk().setUsercode(null); + this.record.getModifiedData().put("username", null); + MessageHelper.setMessageError("msg_notUserBpm"); + return; + } + this.record.getPk().setUsercode(this.userdetail.getRecord().getPk().getUsercode()); + this.record.getModifiedData().put("username", t.getName()); + } + + /** + * Entrega el valor de: userdetail + * + * @return UserDetailController + */ + public UserDetailController getUserdetail() { + return this.userdetail; + } + + /** + * Fija el valor de: userdetail + * + * @param userdetail Valor a fijar en el atributo. + */ + public void setUserdetail(UserDetailController userdetail) { + this.userdetail = userdetail; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/InboxController.java b/frontend/src/main/java/com/fp/frontend/controller/bpm/InboxController.java new file mode 100644 index 0000000..bc31eb3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/InboxController.java @@ -0,0 +1,562 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.component.accordionpanel.AccordionPanel; +import org.primefaces.event.TabChangeEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmGroupsUsers; +import com.fp.persistence.pgeneral.log.TgeneTransactionLog; + +/** + * Clase que muestra + * + * @author amerchan + * @version 2.1 + */ +@ManagedBean +@SessionScoped +public class InboxController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private List lBpmGroups; + + private List> lTransactionsByGroup; + + private List> lTransactions; + + private String beanGroupsName; + + private String codBpmGroupSelected; + + private String bpmDataStatus; + + private String bpmDataComment; + + private String filterTaskName; + + private int tabDiaryId; + + private int accordionTaskTabId; + + private int accordionGroupTabId; + + private List ltaskidinprocess = new ArrayList<>(); + + public InboxController() throws Exception { + super(TgeneTransactionLog.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + beanGroupsName = "BPMGROUPS"; + this.listGroups(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + + } + + @SuppressWarnings("unchecked") + protected void listGroups() { + try { + Request request = callerhelper.getRequest(); + Map mGroupsFilter = new HashMap(); + mGroupsFilter.put("pk.usercode", super.getLoginController().getRequest().getUser()); + mGroupsFilter.put("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + DtoQuery dto = new DtoQuery(TbpmGroupsUsers.class.getName(), page, 100, true, mGroupsFilter); + SubQuery subquery = new SubQuery("TbpmGroups", "description", "groupName", + "i.pk.groupcode = t.pk.groupcode and i.pk.companycode=t.pk.companycode"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(beanGroupsName, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lBpmGroups = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lBpmGroups = (List) resp.get(beanGroupsName); + if ((lBpmGroups != null) && !lBpmGroups.isEmpty()) { + codBpmGroupSelected = lBpmGroups.get(0).getPk().getGroupcode(); + } + super.postQuery((List) resp.get(beanGroupsName)); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void queryTransactionsByGroup() { + try { + ltaskidinprocess = new ArrayList<>(); + this.initBpmData(); + Request request = callerhelper.getRequest(); + request.put("queryalias", "INBOX_TRN_GROUP"); + request.put("querytype", "P"); + request.put("groupId", codBpmGroupSelected); + + Response resp = callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lTransactionsByGroup = new ArrayList>(); + MessageHelper.setMessageError(resp); + } else { + lTransactionsByGroup = (List>) resp.get("transactions"); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + if ((lTransactionsByGroup != null) && !lTransactionsByGroup.isEmpty()) { + this.fillTransactions(lTransactionsByGroup, true); + } + } + + @SuppressWarnings("unchecked") + public void queryTransactions() { + try { + ltaskidinprocess = new ArrayList<>(); + this.initBpmData(); + Request request = callerhelper.getRequest(); + request.put("queryalias", "INBOX_TRN"); + request.put("querytype", "P"); + + Response resp = callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lTransactions = new ArrayList>(); + MessageHelper.setMessageError(resp); + } else { + lTransactions = (List>) resp.get("transactions"); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + if ((lTransactions != null) && !lTransactions.isEmpty()) { + // no hacer la consulta entrega el detalle de la tarea. + // this.fillTransactions(this.lTransactions, false); + } + } + + private void fillTransactions(List> lTransactions, boolean isGroup) { + for (Map map : lTransactions) { + String tModule = (String) map.get("m"); + Integer tCode = (Integer) map.get("t"); + Integer tVersion = (Integer) map.get("v"); + this.fillTasks(map, tModule, tCode, tVersion, isGroup); + } + } + + @SuppressWarnings("unchecked") + private void fillTasks(Map map, String tModule, Integer tCode, Integer tVersion, boolean isGroup) { + try { + Request request = callerhelper.getNewRequest(tModule, tCode, tVersion); + String filtertasks = filterTaskName; + if (isGroup) { + request.put("queryalias", "INBOX_TASK_TRN_GROUP"); + request.put("querytype", "P"); + request.put("groupId", codBpmGroupSelected); + } else { + request.put("queryalias", "INBOX_TASK_TRN"); + } + + if ((filtertasks == null) || filtertasks.isEmpty()) { + filtertasks = "%"; + } + request.put("cri", filtertasks); + + Response resp = callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(resp); + } else { + List> lTasks = (List>) resp.get("tasks"); + map.put("tasks", lTasks); + for (Map mapTask : lTasks) { + this.fillTaskDetail(mapTask); + } + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + private void fillTaskDetail(Map mapTask) { + try { + Request request = callerhelper.getNewRequest(null, null, null); + request.put("queryalias", "INBOX_TASK_DETAIL"); + request.put("querytype", "P"); + request.put("TID", mapTask.get("tid")); + + Response resp = callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(resp); + } else { + Map param = (Map) resp.get("param"); + param.put("TID", mapTask.get("tid")); + param.put("KIND", resp.get("k")); + mapTask.put("taskDetail", resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void initBpmData() throws Exception { + lTransactionsByGroup = new ArrayList>(); + lTransactions = new ArrayList>(); + bpmDataStatus = ""; + bpmDataComment = ""; + filterTaskName = ""; + String tabDiaryId = super.getRequestParameter("tabDiary"); + try { + this.tabDiaryId = Integer.parseInt(tabDiaryId); + } catch (Exception e) { + } + } + + public void enableBpmData() { + try { + String kind = super.getRequestParameter("kind"); + String status = super.getRequestParameter("s"); + if (kind == null) { + return; + } + if (status.compareTo("Reserved") == 0) { + this.initTask(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void initTask() throws Throwable { + String tid = super.getRequestParameter("tid"); + if (ltaskidinprocess.contains(tid)) { + return; + } + Request request = callerhelper.getNewRequest("2", 2001, 1); + request.modifiedData().put("TID", tid); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + ltaskidinprocess.add(tid); + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } + + public void assignTask() { + try { + String taskId = super.getRequestParameter("tid"); + Request request = callerhelper.getNewRequest("2", 2000, 1); + request.modifiedData().put("TID", taskId); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void filterTasks() { + try { + String tModule = super.getRequestParameter("tModule"); + Integer tCode = Integer.parseInt(super.getRequestParameter("tCode")); + Integer tVersion = Integer.parseInt(super.getRequestParameter("tVersion")); + filterTaskName = super.getRequestParameter("filterTaskName"); + + Map map = this.getTransactionMap(lTransactions, tModule, tCode, tVersion); + this.fillTasks(map, tModule, tCode, tVersion, false); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void filterTasksGroups() { + try { + String tModule = super.getRequestParameter("tModule"); + Integer tCode = Integer.parseInt(super.getRequestParameter("tCode")); + Integer tVersion = Integer.parseInt(super.getRequestParameter("tVersion")); + filterTaskName = super.getRequestParameter("filterTaskName"); + + Map map = this.getTransactionMap(lTransactionsByGroup, tModule, tCode, tVersion); + + this.fillTasks(map, tModule, tCode, tVersion, true); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private Map getTransactionMap(List> lTransactions, String tModule, Integer tCode, Integer tVersion) { + for (Map map : lTransactions) { + String module = (String) map.get("m"); + Integer transaction = (Integer) map.get("t"); + Integer version = (Integer) map.get("v"); + + if ((tModule.compareTo(module) == 0) && (tCode.compareTo(transaction) == 0) && (tVersion.compareTo(version) == 0)) { + return map; + } + } + return null; + } + + public void onAccordionTasksTabChange(TabChangeEvent event) { + // System.out.println(((AccordionPanel)event.getSource()).getPage()); + accordionTaskTabId = Integer.parseInt(((AccordionPanel) event.getSource()).getActiveIndex()); + } + + public void onAccordionGroupsTabChange(TabChangeEvent event) { + // event.getTab().getId() + accordionGroupTabId = Integer.parseInt(((AccordionPanel) event.getSource()).getActiveIndex()); + } + + /** + * Entrega el valor de: beanGroupsName + * + * @return String + */ + public String getBeanGroupsName() { + return beanGroupsName; + } + + /** + * Fija el valor de: beanGroupsName + * + * @param beanGroupsName Valor a fijar en el atributo + */ + public void setBeanGroupsName(String beanGroupsName) { + this.beanGroupsName = beanGroupsName; + } + + /** + * Entrega el valor de: lBpmGroups + * + * @return List + */ + public List getlBpmGroups() { + return lBpmGroups; + } + + /** + * Fija el valor de: lBpmGroups + * + * @param lBpmGroups Valor a fijar en el atributo + */ + public void setlBpmGroups(List lBpmGroups) { + this.lBpmGroups = lBpmGroups; + } + + /** + * Entrega el valor de: lTransactionsByGroup + * + * @return List> + */ + public List> getlTransactionsByGroup() { + return lTransactionsByGroup; + } + + /** + * Fija el valor de: lTransactionsByGroup + * + * @param lTransactionsByGroup Valor a fijar en el atributo + */ + public void setlTransactionsByGroup(List> lTransactionsByGroup) { + this.lTransactionsByGroup = lTransactionsByGroup; + } + + /** + * Entrega el valor de: lTransactions + * + * @return List> + */ + public List> getlTransactions() { + return lTransactions; + } + + /** + * Fija el valor de: lTransactions + * + * @param lTransactions Valor a fijar en el atributo + */ + public void setlTransactions(List> lTransactions) { + this.lTransactions = lTransactions; + } + + /** + * Entrega el valor de: bpmDataStatus + * + * @return String + */ + @Override + public String getBpmDataStatus() { + return bpmDataStatus; + } + + /** + * Fija el valor de: bpmDataStatus + * + * @param bpmDataStatus Valor a fijar en el atributo + */ + @Override + public void setBpmDataStatus(String bpmDataStatus) { + this.bpmDataStatus = bpmDataStatus; + } + + /** + * Entrega el valor de: bpmDataComment + * + * @return String + */ + @Override + public String getBpmDataComment() { + return bpmDataComment; + } + + /** + * Fija el valor de: bpmDataComment + * + * @param bpmDataComment Valor a fijar en el atributo + */ + @Override + public void setBpmDataComment(String bpmDataComment) { + this.bpmDataComment = bpmDataComment; + } + + /** + * Entrega el valor de: taskFilter + * + * @return String + */ + public String getFilterTaskName() { + return filterTaskName; + } + + /** + * Fija el valor de: taskFilter + * + * @param taskFilter Valor a fijar en el atributo + */ + public void setFilterTaskName(String taskFilter) { + filterTaskName = taskFilter; + } + + /** + * Entrega el valor de: tabDiaryId + * + * @return int + */ + public int getTabDiaryId() { + return tabDiaryId; + } + + /** + * Fija el valor de: tabDiaryId + * + * @param tabDiaryId Valor a fijar en el atributo + */ + public void setTabDiaryId(int tabDiaryId) { + this.tabDiaryId = tabDiaryId; + } + + /** + * Entrega el valor de: accordionTaskTabId + * + * @return int + */ + public int getAccordionTaskTabId() { + return accordionTaskTabId; + } + + /** + * Fija el valor de: accordionTaskTabId + * + * @param accordionTaskTabId Valor a fijar en el atributo + */ + public void setAccordionTaskTabId(int accordionTaskTabId) { + this.accordionTaskTabId = accordionTaskTabId; + } + + /** + * Entrega el valor de: accordionGroupTabId + * + * @return int + */ + public int getAccordionGroupTabId() { + return accordionGroupTabId; + } + + /** + * Fija el valor de: accordionGroupTabId + * + * @param accordionGroupTabId Valor a fijar en el atributo + */ + public void setAccordionGroupTabId(int accordionGroupTabId) { + this.accordionGroupTabId = accordionGroupTabId; + } + + /** + * Entrega el valor de: codBpmGroupSelected + * + * @return String + */ + public String getCodBpmGroupSelected() { + return codBpmGroupSelected; + } + + /** + * Fija el valor de: codBpmGroupSelected + * + * @param codBpmGroupSelected Valor a fijar en el atributo + */ + public void setCodBpmGroupSelected(String codBpmGroupSelected) { + this.codBpmGroupSelected = codBpmGroupSelected; + } + + public void logout() { + FacesContext fc = FacesContext.getCurrentInstance(); + if (fc != null) { + fc.getExternalContext().invalidateSession(); + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/NotifyController.java b/frontend/src/main/java/com/fp/frontend/controller/bpm/NotifyController.java new file mode 100644 index 0000000..3a5fcd3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/NotifyController.java @@ -0,0 +1,177 @@ +package com.fp.frontend.controller.bpm; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.date.TgeneAccountingDateBranchController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.commondb.helper.APPDates; +import com.fp.persistence.pbpm.gene.TbpmNotify; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TbpmNotify. + * + * @author WPA. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class NotifyController extends AbstractController { + + /** + * Constructor + * + * @throws Exception + */ + public NotifyController() throws Exception { + super(TbpmNotify.class); + } + + /** + * Atributo para la lista de catalogos + */ + private List lcatalog; + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //Lista + this.lcatalog = CatalogDetailController.find("NOTIFYTOCATALOG"); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + super.create(); + super.record.setNotifytocatalogcode("NOTIFYTOCATALOG"); + super.record.setRegisterdate(new Timestamp(this.getWorkingDate().getTime())); + super.record.setUserwhoreg(super.getLoginController().getRequest().getUser()); + this.lrecord = new ArrayList<>(); + this.beanalias = "TBPMNOTIFY"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Entrega la fecha de trabajo de la aplicacin. + * + * @return Fecah Fecha de trabajo. + */ + private Date getWorkingDate() { + Date workingDate = null; + try { + TgeneAccountingDateBranchController c = new TgeneAccountingDateBranchController(); + c.getMfilters().clear(); + c.getMfilters().put("pk.branchcode", "0"); + c.getMfilters().put("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + c.query(); + workingDate = c.getRecord().getWorkingdate(); + } catch (Exception ex) { + // + } + return workingDate; + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(false); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.record = new TbpmNotify(); + MessageHelper.setMessageError(resp); + } else { + this.record = (TbpmNotify) resp.get(this.beanalias); + if (this.record != null) { + super.postQuery((AbstractDataTransport) resp.get(this.beanalias)); + } else { + this.create(); + } + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + this.update(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Entrega la lista de objetos TgeneCatalogDetail + * + * @return lcatalog + */ + public List getLcatalog() { + return lcatalog; + } + + /** + * Fija la lista de objetos TgeneCatalogDetail + * + * @param lcatalog + */ + public void setLcatalog(List lcatalog) { + this.lcatalog = lcatalog; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/RulesController.java b/frontend/src/main/java/com/fp/frontend/controller/bpm/RulesController.java new file mode 100644 index 0000000..a976842 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/RulesController.java @@ -0,0 +1,271 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletRequest; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.MessageTemplatesLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmRules; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplates; + +/** + * Clase controladora del bean TbpmRules. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class RulesController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public RulesController() throws Exception { + super(TbpmRules.class); + } + + /** + * Atributo para el tipo de archivo + */ + private List lfiletype; + /** + * Atributo para Si/No + */ + private List lyesnot; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //Listas + this.getListFileType(); + this.getList(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TBPMRULES"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.rulecode"); + + //Subquery + SubQuery subquery = new SubQuery("TgeneMessageTemplates", "description", "messagedesc", "i.pk = t.messagecode"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void refresh() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = new DtoSave(); + List l = new ArrayList(); + l.add(this.record); + dtosave.addNew(l); + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + request.modifiedData().put("refresh", "Y"); + Response resp = this.callerhelper.executeSave(request); + request.modifiedData().remove("refresh"); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void create() throws Exception { + super.create(); + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + this.record.setSnapshot("LATEST"); + this.record.setParametertype("java.util.Map"); + } + + /** + * Metodo que llena lal lista de tipo de archivo + */ + private void getListFileType() { + this.lfiletype = new ArrayList(); + String[] flows = {"F", "FLUJOS"}; + String[] rules = {"R", "REGLAS"}; + this.lfiletype.add(flows); + this.lfiletype.add(rules); + } + + /** + * Metodo que llena lal lista de tipo de archivo + */ + private void getList() { + this.lyesnot = new ArrayList(); + String[] no = {"N", "NO"}; + String[] yes = {"Y", "SI"}; + this.lyesnot.add(no); + this.lyesnot.add(yes); + } + + /** + * Abre el Lov de Mensajes + */ + public void openMessagesLov() { + Map> params = new HashMap<>(); + MessageTemplatesLovController.openLov(params); + } + + /** + * Gestiona la respuesta del lov + * + * @param event + * @throws Exception + */ + public void onReturnMessagesLov(SelectEvent event) throws Exception { + TgeneMessageTemplates t = (TgeneMessageTemplates) event.getObject(); + this.record.setMessagecode(t.getPk()); + this.record.getModifiedData().put("messagedesc", t.getDescription()); + } + + /** + * Entrega la lista de tpos de archivo + * + * @return lfiletype Lista de tpos de archivo + */ + public List getLfiletype() { + return lfiletype; + } + + /** + * Fija la lista de tpos de archivo + * + * @param lfiletype Lista de tpos de archivo + */ + public void setLfiletype(List lfiletype) { + this.lfiletype = lfiletype; + } + + /** + * Entrega la lista Si/No + * + * @return lyesnot Lista Si/No + */ + public List getLyesnot() { + return lyesnot; + } + + /** + * Fija la lista Si/No + * + * @param lyesnot Lista Si/No + */ + public void setLyesnot(List lyesnot) { + this.lyesnot = lyesnot; + } + + /** + * Elimina el mensaje + */ + public void removemessage() { + if (this.record != null) { + this.record.setMessagecode(null); + this.record.put("messagedesc", null); + } + } + + /** + * Fija el paquete segun el tipo de archivo + */ + public void changeFile() { + if (this.record.getFiletype().equals("F")) { + this.record.setPackagename("maia.flows"); + } else if (this.record.getFiletype().equals("R")) { + this.record.setPackagename("maia.rules"); + } else { + this.record.setPackagename(null); + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/TaskServerController.java b/frontend/src/main/java/com/fp/frontend/controller/bpm/TaskServerController.java new file mode 100644 index 0000000..21f7d2b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/TaskServerController.java @@ -0,0 +1,243 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.ServicesController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneServices; + +/** + * Clase controladora del TaskServer. + * + * @author WPA. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class TaskServerController extends AbstractController { + + /** + * Constructor + * + * @throws Exception + */ + public TaskServerController() throws Exception { + super(AbstractDataTransport.class); + } + + /** + * Atributo para la url de la página + */ + private String page; + + /** + * Atributo para habilitar el inicio + */ + private boolean lockStart; + + /** + * Atributo para habilitar el detener + */ + private boolean lockStop; + + /** + * Atributo para la lista de servicios + */ + private List lservices; + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //List + this.lservices = ServicesController.find(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "SERVICES"; + //page + this.page = "/resources/images/blanck.jpg"; + //lock + this.lockStart = false; + this.lockStop = false; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + MessageHelper.setMessageError("msg_notQuery"); + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + MessageHelper.setMessageError("msg_notSave"); + } + + public void queryTransaction() { + try { + if (super.getMfilters().get("servicecode") == null) { + this.init(); + return; + } + + Request request = this.callerhelper.getRequest(); + request.put("querytype", "T"); + request.put("code", super.getMfilters().get("servicecode")); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(resp); + } else { + this.responseService((Boolean) resp.get("TSStatus")); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Ejecuta una peticion + * + * @param status I/S + */ + public void processServer(String status) { + try { + Request request = this.callerhelper.getRequest(); + request.put("status", status); + request.put("code", super.getMfilters().get("servicecode")); + + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.responseService((Boolean) resp.get("TSStatus")); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Procesa la respuesta + * + * @param response + */ + public void responseService(boolean response) { + if (response) { + this.page = "/resources/images/green.jpg"; + this.lockStart = false; + this.lockStop = true; + } else { + this.page = "/resources/images/red.jpg"; + this.lockStart = true; + this.lockStop = false; + } + } + + /** + * Entrega una lista de objetos TgeneServices + * + * @return lservices + */ + public List getLservices() { + return lservices; + } + + /** + * Fija una lista de objetos TgeneServices + * + * @param lservices + */ + public void setLservices(List lservices) { + this.lservices = lservices; + } + + /** + * Entrega el valor de page + * + * @return page + */ + public String getPage() { + return page; + } + + /** + * Fija el valor de page + * + * @param page + */ + public void setPage(String page) { + this.page = page; + } + + /** + * Entrega V/F lockStart + * + * @return lockStart + */ + public boolean isLockStart() { + return lockStart; + } + + /** + * Fija V/F lockStart + * + * @param lockStart + */ + public void setLockStart(boolean lockStart) { + this.lockStart = lockStart; + } + + /** + * Entrega V/F lockStop + * + * @return lockStop + */ + public boolean isLockStop() { + return lockStop; + } + + /** + * Fija V/F lockStop + * + * @param lockStop + */ + public void setLockStop(boolean lockStop) { + this.lockStop = lockStop; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/TransactionLogController.java b/frontend/src/main/java/com/fp/frontend/controller/bpm/TransactionLogController.java new file mode 100644 index 0000000..0c80603 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/TransactionLogController.java @@ -0,0 +1,710 @@ +package com.fp.frontend.controller.bpm; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.json.Serializer; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.TransactionLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.log.TgeneTransactionLog; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; +import com.fp.simple.dto.TaskInfo; +import com.fp.simple.dto.metadata.ProcessInstanceMeta; + +/** + * Clase que muestra + * + * @author amerchan + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TransactionLogController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private List> lTransactionLogResult; + + private Map tLogResult; + + // monitor + private List> lorigin; + + private List lstatus; + + private List lpim; + + private Map first; + + private List> lLast; + + private List lLastA; + + private List lActualTaskInfo; + + private List> ltaskDetailData; + + private List> ltaskDetailComments; + + private TaskInfo taskInfoSelected; + + private String actualTaskName; + + private boolean enableFlowButton; + + private String flowJson; + + private String lFlowsResponseJson; + + private Long processId; + + private String trn; + + private String aname; + + private String comment; + + private String imageFlowName = "/resources/images/bpm/stackTraceOff.png"; + + public TransactionLogController() throws Exception { + super(TgeneTransactionLog.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.lrecord = new ArrayList<>(); + this.beanalias = "TRANSACTIONLOG"; + this.enableFlowButton = false; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + private void initFlowInfo() { + this.lorigin = new ArrayList>(); + this.lstatus = new ArrayList(); + this.lpim = new ArrayList(); + this.lActualTaskInfo = new ArrayList(); + this.lLast = new ArrayList>(); + this.lLastA = new ArrayList(); + this.first = new HashMap(); + this.ltaskDetailData = new ArrayList>(); + this.ltaskDetailComments = new ArrayList>(); + this.taskInfoSelected = new TaskInfo(); + this.enableFlowButton = false; + this.trn = ""; + this.aname = ""; + this.imageFlowName = ""; + this.actualTaskName = ""; + this.flowJson = ""; + this.lFlowsResponseJson = ""; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if (!this.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); + request.setQueryTables(mtables); + request.put("querytype", "P"); + request.put("queryalias", "TRANSACTIONLOGRESULT"); + + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lTransactionLogResult = new ArrayList>(); + MessageHelper.setMessageError(resp); + } else { + this.lTransactionLogResult = (List>) resp.get(this.beanalias); + this.lrecord.add(null); // dummy para que funcione la paginacion en el metodo next() + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void queryMonitor() { + try { + this.initFlowInfo(); + Request request = this.callerhelper.getRequest(); + request.put("querytype", "T"); + request.put("queryalias", "TRANSACTIONLOGRESULT"); + request.put("PID", this.processId); + + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lorigin = new ArrayList>(); + this.lstatus = new ArrayList(); + this.lpim = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lorigin = (List>) resp.get("origin"); + this.lstatus = (ArrayList) resp.get("status"); + this.lpim = this.lstatus; + this.trn = (String) resp.get("TRN"); + // System.out.println(this.lorigin); + } + this.showFlow(); + this.first = (Map) resp.get("FIRST"); + this.showDefaultTask(); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void queryTaskDetail() { + try { + Request request = this.callerhelper.getRequest(); + request.put("querytype", "P"); + request.put("queryalias", "TASKDETAIL"); + request.put("PID", this.processId); + request.put("TID", this.taskInfoSelected.getTaskId()); + request.put("JID", this.taskInfoSelected.getJournalId()); + + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.ltaskDetailData = new ArrayList>(); + this.ltaskDetailComments = new ArrayList>(); + MessageHelper.setMessageError(resp); + } else { + this.ltaskDetailData = (List>) resp.get("data"); + this.ltaskDetailComments = (List>) resp.get("comments"); + // super.cloneOriginalBean((List) resp.get(this.beanalias)); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void showTask() { + try { + String taskName = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("taskName"); + // System.out.println("taskName::"+taskName); + Request request = this.callerhelper.getRequest(); + request.put("querytype", "P"); + request.put("queryalias", "TASKHISTORY"); + request.put("PID", this.processId); + request.put("SPID", this.processId); + request.put("NAME", taskName); + + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lActualTaskInfo = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.showActualInfo(taskName, (List) ((Map) resp.get("DATA")).values().toArray()[0]); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void saveComment() { + try { + Request request = this.callerhelper.getNewRequest(this.callerhelper.getRequest().getTransactionModule(), 2002, 1); + request.modifiedData().put("TID", this.taskInfoSelected.getTaskId()); + request.modifiedData().put("BPMObs", this.comment); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + this.comment = ""; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + private void showDefaultTask() { + try { + Map mapTasks = null; + if (this.first != null) { + mapTasks = (Map) this.first.values().toArray()[0]; + } + String key = null; + List lTaskValues = null; + if (mapTasks != null) { + key = (String) mapTasks.keySet().toArray()[0]; + lTaskValues = (List) mapTasks.values().toArray()[0]; + } + + this.showActualInfo(key, lTaskValues); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void showFlow() throws Exception { + String pMetaId = super.getRequestParameter("pMetaId"); + // System.out.println("pMetaId:"+pMetaId); + if (pMetaId != null && !pMetaId.isEmpty()) { + this.enableFlowButton = true; + this.lLast.add(this.lLast.size(), this.lpim); + this.lLastA.add(this.lLastA.size(), this.aname); + this.lpim = this.getSubFlow(pMetaId); + } + this.showImage(!this.lpim.isEmpty() ? this.lpim.get(0) : null); + } + + public void showLastFlow() throws Exception { + this.lpim = this.lLast.get(this.lLast.size() - 1); + this.lLast.remove(this.lLast.size() - 1); + + if (this.lLast.size() < 1) { + this.enableFlowButton = false; + this.showDefaultTask(); + } + this.showImage(this.lpim.get(0)); + } + + private List getSubFlow(String pMetaid) { + Long metaId = Long.parseLong(pMetaid); + for (ProcessInstanceMeta processInstanceMeta : this.lpim) { + if (processInstanceMeta.getPmetaid().compareTo(metaId) == 0) { + return processInstanceMeta.getSub(); + } + } + return null; + } + + @SuppressWarnings("unchecked") + private void showImage(ProcessInstanceMeta pFlow) throws Exception { + if (pFlow == null) { + return; + } + this.processId = pFlow.getPid(); + if (pFlow != null) { + this.showActualInfo("", pFlow.getVariables() == null || pFlow.getVariables().get("actualTask") == null ? null : (List) pFlow + .getVariables().get("actualTask")); + } + this.imageFlowName = "/resources/images/bpm/flows/" + pFlow.getName() + "-" + pFlow.getVersion() + ".png"; + } + + private void showActualInfo(String name, List lActualTaskInfo) throws Exception { + this.actualTaskName = name; + this.aname = name; + this.lActualTaskInfo = lActualTaskInfo; + Response r = new Response("", ""); + r.put("flows", this.lpim); + Serializer ser = new Serializer(r); + + // System.out.println(ser.toJSON()); + this.lFlowsResponseJson = ser.toJSON(); + } + + public void openTransactionLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("TRANSACTION"); // valor del parametro + params.put("processtype", l); + + TransactionLovController.openLov(params); + } + + public void onReturnTransactionLov(SelectEvent event) throws Exception { + TgeneTransaction t = (TgeneTransaction) event.getObject(); + super.addFilter("transactionmodule", t.getPk().getTransactionmodule()); + super.addFilter("transactioncode", t.getPk().getTransactioncode().toString()); + super.addFilter("transactionversion", t.getPk().getTransactionversion().toString()); + super.addField("transactionname", t.getName()); + this.query(); + } + + /** + * Entrega el valor de: lTransactionLogResult + * + * @return List> + */ + public List> getlTransactionLogResult() { + return this.lTransactionLogResult; + } + + /** + * Fija el valor de: lTransactionLogResult + * + * @param lTransactionLogResult Valor a fijar en el atributo + */ + public void setlTransactionLogResult(List> lTransactionLogResult) { + this.lTransactionLogResult = lTransactionLogResult; + } + + /** + * Entrega el valor de: tLogResult + * + * @return Map + */ + public Map gettLogResult() { + return this.tLogResult; + } + + /** + * Fija el valor de: tLogResult + * + * @param tLogResult Valor a fijar en el atributo + */ + public void settLogResult(Map tLogResult) { + this.tLogResult = tLogResult; + } + + /** + * Entrega el valor de: lorigin + * + * @return List> + */ + public List> getLorigin() { + return this.lorigin; + } + + /** + * Fija el valor de: lorigin + * + * @param lorigin Valor a fijar en el atributo + */ + public void setLorigin(List> lorigin) { + this.lorigin = lorigin; + } + + /** + * Entrega el valor de: lstatus + * + * @return List + */ + public List getLstatus() { + return this.lstatus; + } + + /** + * Fija el valor de: lstatus + * + * @param lstatus Valor a fijar en el atributo + */ + public void setLstatus(List lstatus) { + this.lstatus = lstatus; + } + + /** + * Entrega el valor de: lpim + * + * @return List + */ + public List getLpim() { + return this.lpim; + } + + /** + * Fija el valor de: lpim + * + * @param lpim Valor a fijar en el atributo + */ + public void setLpim(List lpim) { + this.lpim = lpim; + } + + /** + * Entrega el valor de: lLast + * + * @return List + */ + public List> getlLast() { + return this.lLast; + } + + /** + * Fija el valor de: lLast + * + * @param lLast Valor a fijar en el atributo + */ + public void setlLast(List> lLast) { + this.lLast = lLast; + } + + /** + * Entrega el valor de: lLastA + * + * @return List + */ + public List getlLastA() { + return this.lLastA; + } + + /** + * Fija el valor de: lLastA + * + * @param lLastA Valor a fijar en el atributo + */ + public void setlLastA(List lLastA) { + this.lLastA = lLastA; + } + + /** + * Entrega el valor de: lActualTaskInfo + * + * @return List + */ + public List getlActualTaskInfo() { + return this.lActualTaskInfo; + } + + /** + * Fija el valor de: lActualTaskInfo + * + * @param lActualTaskInfo Valor a fijar en el atributo + */ + public void setlActualTaskInfo(List lActualTaskInfo) { + this.lActualTaskInfo = lActualTaskInfo; + } + + /** + * Entrega el valor de: ltaskDetailData + * + * @return List> + */ + public List> getLtaskDetailData() { + return this.ltaskDetailData; + } + + /** + * Fija el valor de: ltaskDetailData + * + * @param ltaskDetailData Valor a fijar en el atributo + */ + public void setLtaskDetailData(List> ltaskDetailData) { + this.ltaskDetailData = ltaskDetailData; + } + + /** + * Entrega el valor de: ltaskDetailComments + * + * @return List> + */ + public List> getLtaskDetailComments() { + return this.ltaskDetailComments; + } + + /** + * Fija el valor de: ltaskDetailComments + * + * @param ltaskDetailComments Valor a fijar en el atributo + */ + public void setLtaskDetailComments(List> ltaskDetailComments) { + this.ltaskDetailComments = ltaskDetailComments; + } + + /** + * Entrega el valor de: taskInfoSelected + * + * @return TaskInfo + */ + public TaskInfo getTaskInfoSelected() { + return this.taskInfoSelected; + } + + /** + * Fija el valor de: taskInfoSelected + * + * @param taskInfoSelected Valor a fijar en el atributo + */ + public void setTaskInfoSelected(TaskInfo taskInfoSelected) { + this.taskInfoSelected = taskInfoSelected; + } + + /** + * Entrega el valor de: lFlowsResponseJson + * + * @return String + */ + public String getlFlowsResponseJson() { + return this.lFlowsResponseJson; + } + + /** + * Fija el valor de: lFlowsResponseJson + * + * @param lFlowsResponseJson Valor a fijar en el atributo + */ + public void setlFlowsResponseJson(String lFlowsResponseJson) { + this.lFlowsResponseJson = lFlowsResponseJson; + } + + /** + * Entrega el valor de: flowJson + * + * @return String + */ + public String getFlowJson() { + return this.flowJson; + } + + /** + * Fija el valor de: flowJson + * + * @param flowJson Valor a fijar en el atributo + */ + public void setFlowJson(String flowJson) { + this.flowJson = flowJson; + } + + /** + * Entrega el valor de: processId + * + * @return String + */ + public Long getProcessId() { + return this.processId; + } + + /** + * Fija el valor de: processId + * + * @param processId Valor a fijar en el atributo + */ + public void setProcessId(Long processId) { + this.processId = processId; + } + + /** + * Entrega el valor de: trn + * + * @return String + */ + public String getTrn() { + return this.trn; + } + + /** + * Fija el valor de: trn + * + * @param trn Valor a fijar en el atributo + */ + public void setTrn(String trn) { + this.trn = trn; + } + + /** + * Entrega el valor de: aname + * + * @return String + */ + public String getAname() { + return this.aname; + } + + /** + * Fija el valor de: aname + * + * @param aname Valor a fijar en el atributo + */ + public void setAname(String aname) { + this.aname = aname; + } + + /** + * Entrega el valor de: comment + * + * @return String + */ + public String getComment() { + return this.comment; + } + + /** + * Fija el valor de: comment + * + * @param comment Valor a fijar en el atributo + */ + public void setComment(String comment) { + this.comment = comment; + } + + /** + * Entrega el valor de: actualTaskName + * + * @return String + */ + public String getActualTaskName() { + return this.actualTaskName; + } + + /** + * Fija el valor de: actualTaskName + * + * @param actualTaskName Valor a fijar en el atributo + */ + public void setActualTaskName(String actualTaskName) { + this.actualTaskName = actualTaskName; + } + + /** + * Entrega el valor de: enableFlowButton + * + * @return boolean + */ + public boolean isEnableFlowButton() { + return this.enableFlowButton; + } + + /** + * Fija el valor de: enableFlowButton + * + * @param enableFlowButton Valor a fijar en el atributo + */ + public void setEnableFlowButton(boolean enableFlowButton) { + this.enableFlowButton = enableFlowButton; + } + + /** + * Entrega el valor de: imageFlowName + * + * @return String + */ + public String getImageFlowName() { + return this.imageFlowName; + } + + /** + * Fija el valor de: imageFlowName + * + * @param imageFlowName Valor a fijar en el atributo + */ + public void setImageFlowName(String imageFlowName) { + this.imageFlowName = imageFlowName; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/lov/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/bpm/lov/.svn/entries new file mode 100644 index 0000000..f6cbed5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/lov/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/bpm/lov +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +GroupsLovController.java +file + + + + +2022-07-28T03:39:55.717600Z +85640011a044adde053fd4d1c67630cf +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +3545 + +TransactionBpmELovController.java +file + + + + +2022-07-28T03:39:55.717600Z +d43690d0fbd92c3204bd12a67cbc77e1 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +4676 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/lov/.svn/text-base/GroupsLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/bpm/lov/.svn/text-base/GroupsLovController.java.svn-base new file mode 100644 index 0000000..022195c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/lov/.svn/text-base/GroupsLovController.java.svn-base @@ -0,0 +1,114 @@ +package com.fp.frontend.controller.bpm.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmGroups; + +/** + * Clase controladora del lov bean TbpmGroups. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class GroupsLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public GroupsLovController() throws Exception { + super(TbpmGroups.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "GROUPSLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.groupcode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Fija el registro seleccionado + */ + public void setGroup() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + /** + * Fija el registro seleccionado + */ + public void setGroup(TbpmGroups tbpmGroups) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tbpmGroups); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/bpm/lov/groupslov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/lov/.svn/text-base/TransactionBpmELovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/bpm/lov/.svn/text-base/TransactionBpmELovController.java.svn-base new file mode 100644 index 0000000..6c3b3e9 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/lov/.svn/text-base/TransactionBpmELovController.java.svn-base @@ -0,0 +1,155 @@ +package com.fp.frontend.controller.bpm.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * Clase controladora del bean TgeneTransactionLog. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TransactionBpmELovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public TransactionBpmELovController() throws Exception { + super(TgeneTransaction.class); + } + + /** + * Atributo para almacenar la respuesta del quieryalias + */ + private List> lTransactionLog; + + /** + * Atributo para almacenar un arreglo de objetos + */ + private Object objeto; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENETRANSACTION"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + + request.put("querytype", "P"); + request.put("queryalias", "ENDEDFLOW"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lTransactionLog = new ArrayList>(); + MessageHelper.setMessageError(resp); + } else { + this.lTransactionLog = (List>) resp.get(this.beanalias); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setTransaction() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.objeto); + } + + public void setTransaction(TgeneTransaction tgeneTransaction) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneTransaction); + } + + public void setTransaction(Map transactionLog){ + RequestContext.getCurrentInstance().closeDialog(transactionLog); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put("modal", true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/bpm/lov/transactionbpmeLov.xhtml", options, params); + } + + /** + * Entrega la data del QueryAlias + * @return lTransactionLog Data del QueryAlias + */ + public List> getlTransactionLog() { + return lTransactionLog; + } + + /** + * Fija la data del QueryAlias + * @param lTransactionLog Data del QueryAlias + */ + public void setlTransactionLog(List> lTransactionLog) { + this.lTransactionLog = lTransactionLog; + } + + /** + * Entrega un arreglo de objetos + * @return objeto Arreglo de objetos + */ + public Object getObjeto() { + return objeto; + } + + /** + * Fija un arreglo de objetos + * @param objeto Arreglo de objetos + */ + public void setObjeto(Object objeto) { + this.objeto = objeto; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/lov/GroupsLovController.java b/frontend/src/main/java/com/fp/frontend/controller/bpm/lov/GroupsLovController.java new file mode 100644 index 0000000..05fe15a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/lov/GroupsLovController.java @@ -0,0 +1,115 @@ +package com.fp.frontend.controller.bpm.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmGroups; + +/** + * Clase controladora del lov bean TbpmGroups. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class GroupsLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public GroupsLovController() throws Exception { + super(TbpmGroups.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "GROUPSLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.groupcode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Fija el registro seleccionado + */ + public void setGroup() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + /** + * Fija el registro seleccionado + */ + public void setGroup(TbpmGroups tbpmGroups) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tbpmGroups); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/bpm/lov/groupslov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/bpm/lov/TransactionBpmELovController.java b/frontend/src/main/java/com/fp/frontend/controller/bpm/lov/TransactionBpmELovController.java new file mode 100644 index 0000000..88e7e7e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/bpm/lov/TransactionBpmELovController.java @@ -0,0 +1,159 @@ +package com.fp.frontend.controller.bpm.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * Clase controladora del bean TgeneTransactionLog. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TransactionBpmELovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public TransactionBpmELovController() throws Exception { + super(TgeneTransaction.class); + } + + /** + * Atributo para almacenar la respuesta del quieryalias + */ + private List> lTransactionLog; + + /** + * Atributo para almacenar un arreglo de objetos + */ + private Object objeto; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENETRANSACTION"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + + request.put("querytype", "P"); + request.put("queryalias", "ENDEDFLOW"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lTransactionLog = new ArrayList>(); + MessageHelper.setMessageError(resp); + } else { + this.lTransactionLog = (List>) resp.get(this.beanalias); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setTransaction() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.objeto); + } + + public void setTransaction(TgeneTransaction tgeneTransaction) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneTransaction); + } + + public void setTransaction(Map transactionLog) { + RequestContext.getCurrentInstance().closeDialog(transactionLog); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put("modal", true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/bpm/lov/transactionbpmeLov.xhtml", options, params); + } + + /** + * Entrega la data del QueryAlias + * + * @return lTransactionLog Data del QueryAlias + */ + public List> getlTransactionLog() { + return lTransactionLog; + } + + /** + * Fija la data del QueryAlias + * + * @param lTransactionLog Data del QueryAlias + */ + public void setlTransactionLog(List> lTransactionLog) { + this.lTransactionLog = lTransactionLog; + } + + /** + * Entrega un arreglo de objetos + * + * @return objeto Arreglo de objetos + */ + public Object getObjeto() { + return objeto; + } + + /** + * Fija un arreglo de objetos + * + * @param objeto Arreglo de objetos + */ + public void setObjeto(Object objeto) { + this.objeto = objeto; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/error/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/error/.svn/entries new file mode 100644 index 0000000..4d3b027 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/error/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/error +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ErrorController.java +file + + + + +2022-07-28T03:39:54.836596Z +1c116570f430592233db1a38af0da7cc +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1219 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/error/.svn/text-base/ErrorController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/error/.svn/text-base/ErrorController.java.svn-base new file mode 100644 index 0000000..28d1bd7 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/error/.svn/text-base/ErrorController.java.svn-base @@ -0,0 +1,47 @@ +package com.fp.frontend.controller.error; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.RequestScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletRequest; + +@ManagedBean +@RequestScoped +public class ErrorController { + + private String statusCode; + private String errorMessage; + private HttpServletRequest request; + + public ErrorController() { + FacesContext fc = FacesContext.getCurrentInstance(); + this.request = ((HttpServletRequest)fc.getExternalContext().getRequest()); + } + + public HttpServletRequest getRequest() { + return this.request; + } + + public void setRequest(HttpServletRequest request) { + this.request = request; + } + + public String getStatusCode() { + this.statusCode = this.request.getAttribute("javax.servlet.error.status_code").toString(); + return this.statusCode; + } + + public void setStatusCode(String statusCode) { + this.statusCode = statusCode; + } + + public String getErrorMessage() { + this.errorMessage = this.request.getAttribute("javax.servlet.error.message").toString(); + return this.errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/error/ErrorController.java b/frontend/src/main/java/com/fp/frontend/controller/error/ErrorController.java new file mode 100644 index 0000000..1818612 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/error/ErrorController.java @@ -0,0 +1,47 @@ +package com.fp.frontend.controller.error; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.RequestScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletRequest; + +@ManagedBean +@RequestScoped +public class ErrorController { + + private String statusCode; + private String errorMessage; + private HttpServletRequest request; + + public ErrorController() { + FacesContext fc = FacesContext.getCurrentInstance(); + this.request = ((HttpServletRequest) fc.getExternalContext().getRequest()); + } + + public HttpServletRequest getRequest() { + return this.request; + } + + public void setRequest(HttpServletRequest request) { + this.request = request; + } + + public String getStatusCode() { + this.statusCode = this.request.getAttribute("javax.servlet.error.status_code").toString(); + return this.statusCode; + } + + public void setStatusCode(String statusCode) { + this.statusCode = statusCode; + } + + public String getErrorMessage() { + this.errorMessage = this.request.getAttribute("javax.servlet.error.message").toString(); + return this.errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/general/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/general/.svn/entries new file mode 100644 index 0000000..9a61185 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/general/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/general +svn://172.17.26.185/COMACO + + + +2015-01-16T05:41:34.695076Z +3760 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +audit +dir + diff --git a/frontend/src/main/java/com/fp/frontend/controller/general/audit/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/general/audit/.svn/entries new file mode 100644 index 0000000..b68dc9e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/general/audit/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/general/audit +svn://172.17.26.185/COMACO + + + +2015-01-16T05:41:34.695076Z +3760 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +AuditReportController.java +file + + + + +2022-07-28T03:39:54.911596Z +a3786c8a74d07849a0eed3a33f6f5f08 +2015-01-16T05:41:34.695076Z +3760 +cpiedra +has-props + + + + + + + + + + + + + + + + + + + + +13988 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/general/audit/.svn/prop-base/AuditReportController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/general/audit/.svn/prop-base/AuditReportController.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/general/audit/.svn/prop-base/AuditReportController.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/controller/general/audit/.svn/text-base/AuditReportController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/general/audit/.svn/text-base/AuditReportController.java.netbeans-base new file mode 100644 index 0000000..a8342ca --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/general/audit/.svn/text-base/AuditReportController.java.netbeans-base @@ -0,0 +1,511 @@ +package com.fp.frontend.controller.general.audit; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.lov.EntityLovController; +import com.fp.frontend.controller.pgeneral.lov.TransactionLovController; +import com.fp.frontend.controller.pgeneral.lov.UserLovController; +import com.fp.frontend.controller.pgeneral.product.ModuleController; +import com.fp.frontend.controller.pgeneral.safe.AuditInsDelController; +import com.fp.frontend.controller.pgeneral.safe.SafeAuditController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneEntity; +import com.fp.persistence.pgeneral.product.TgeneModule; +import com.fp.persistence.pgeneral.safe.TsafeAudit; +import com.fp.persistence.pgeneral.safe.TsafeAuditInsDel; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * Clase que se utliza para la llanada del reporte de Auditoria + * + * @author Jacqueline Arias + * + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class AuditReportController extends AbstractController { + + /** + * Fecha desde + */ + private Date dateFrom; + + /** + * Fecha desde + */ + private Date maxDateTo; + + private Date minDateFrom; + /** + * Fecha hasta + */ + private Date dateTo; + + private String user; + + private String userName; + + private String transactioncode; + + private String transactionmodule; + + private String transactionname; + + private String transactionversion; + + private String entityName; + + private String clientCode; + + private String clientName; + + private String moduleCode; + + private List listModule; + + @ManagedProperty(value = "#{safeAuditController}") + private SafeAuditController safeAudit; + + @ManagedProperty(value = "#{auditInsDelController}") + private AuditInsDelController auditinsdel; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + public AuditReportController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + public void postConstruct() { + this.init(); + } + + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTAUDIT"; + this.recperpage = 15; + this.listModule = ModuleController.find(); + // this.create(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + try { + Request request = this.callerhelper.getRequest(); + + DtoQuery dtoQuerySafeUpdate = this.safeAudit.getDtoSafeAudit(); + DtoQuery dtoinsdel = this.auditinsdel.getDtoAuditInsDel(); + if ((this.dateFrom != null) && (this.dateTo != null)) { + Filter f = null; + f = new Filter(); + f.setSql("t.pk.changedate >= to_date('" + this.dateFrom + "', 'yyyy-MM-dd') and t.pk.changedate <= to_date('" + this.dateTo + + "', 'yyyy-MM-dd') "); + dtoinsdel.addFiltro(f); + dtoQuerySafeUpdate.addFiltro(f); + } + + HashMap mtables = new HashMap(); + mtables.put(this.safeAudit.getBeanalias(), dtoQuerySafeUpdate); + mtables.put(this.auditinsdel.getBeanalias(), dtoinsdel); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList<>(); + this.safeAudit.setLrecord(new ArrayList()); + this.auditinsdel.setLrecord(new ArrayList()); + MessageHelper.setMessageError(resp); + } else { + + this.safeAudit.setLrecord((List) resp.get(this.safeAudit.getBeanalias())); + this.auditinsdel.setLrecord((List) resp.get(this.auditinsdel.getBeanalias())); + + this.safeAudit.postQuery(this.safeAudit.getLrecord()); + this.auditinsdel.postQuery(this.auditinsdel.getLrecord()); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + /** + * Metodo que obtiene abre el lov de Personas + */ + public void openUserLov() { + Map> params = new HashMap<>(); + UserLovController.openLov(params); + } + + /** + * Metodo que pega los valores del lov de personas + * + * @param event + * @throws Exception + */ + public void onReturnUserLov(SelectEvent event) throws Exception { + TsafeUserDetail t = (TsafeUserDetail) event.getObject(); + this.setUser(t.getPk().getUsercode()); + this.setUserName(t.getModifiedData().get("personname") != null ? t.getModifiedData().get("personname").toString() : ""); + this.auditinsdel.addFilter("usercode", this.user); + this.safeAudit.addFilter("usercode", this.user); + } + + /** + * Metodo que obtiene abre el lov de Personas + */ + public void openTransactionLov() { + if ((this.moduleCode != null) && !this.moduleCode.isEmpty()) { + Map> params = new HashMap<>(); + List lmodule = new ArrayList<>(); + lmodule.add(this.moduleCode); + params.put("moduleCode", lmodule); + TransactionLovController.openLov(params); + } else { + MessageHelper.setMessageError("msg_modulerequird"); + return; + } + + } + + /** + * Metodo que pega los valores del lov de personas + * + * @param event + * @throws Exception + */ + public void onReturnTransactionLov(SelectEvent event) throws Exception { + TgeneTransaction t = (TgeneTransaction) event.getObject(); + this.setTransactionmodule(t.getPk().getTransactionmodule()); + this.setTransactioncode(t.getPk().getTransactioncode().toString()); + this.setTransactionname(t.getName()); + this.setTransactionversion(t.getPk().getTransactionversion().toString()); + this.auditinsdel.addFilter("transactionmodule", this.transactioncode); + this.safeAudit.addFilter("transactionmodule", this.transactioncode); + } + + /** + */ + public void openEntityLov() { + Map> params = new HashMap<>(); + List logList = new ArrayList<>(); + logList.add("1"); + params.put("log", logList); + EntityLovController.openLov(params); + } + + /** + * Metodo que pega los valores del lov de personas + * + * @param event + * @throws Exception + */ + public void onReturnEntityLov(SelectEvent event) throws Exception { + TgeneEntity t = (TgeneEntity) event.getObject(); + this.setEntityName(t.getPk().getTname()); + this.auditinsdel.addFilter("pk.tablename", this.entityName); + this.safeAudit.addFilter("pk.tablename", this.entityName); + } + + /** + * Metodo que obtiene abre el lov de Personas + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Metodo que pega los valores del lov de personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + this.setClientCode(t.getPk().getPersoncode().toString()); + this.setClientName(t.getName()); + this.auditinsdel.addFilter("personcode", this.clientCode); + this.safeAudit.addFilter("personcode", this.clientCode); + + } + + /** + * Listener del lov de transacciones + */ + public void listenerTransaction() { + this.transactionmodule = null; + this.transactioncode = null; + this.transactionname = null; + this.auditinsdel.addFilter("transactionmodule", this.moduleCode); + this.safeAudit.addFilter("transactionmodule", this.moduleCode); + } + + /** + * Metodo que llama al reporte en xlsx + */ + public void generateXls() { + this.generateReport("general/reports/auditoria_final", "Auditoria", "xlsx"); + + } + + /** + * Metodo de envio de parametros del reporte + * + * @param name + * @param filename + * @param format + */ + private void generateReport(String name, String filename, String format) { + String path = name; + + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("dateFrom", this.dateFrom.toString()); + parameters.put("dateTo", this.dateTo.toString()); + parameters.put("userCode", this.user); + parameters.put("transactionModule", this.transactionmodule); + if(moduleCode!=null && transactionmodule==null){ + parameters.put("transactionModule", moduleCode); + } + parameters.put("transactionCode", this.transactioncode); + parameters.put("tableName", this.entityName); + parameters.put("personcode", this.clientCode); + parameters.put("transactionVersion", this.transactionversion); + parameters.put("company", Integer.parseInt(super.getLoginController().getRequest().getCompany().toString())); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + if (format == null) { + format = "pdf"; + } + try { + if (format.equals("xlsx") || format.equals("xls")) { + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } else { + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Metodo que llama al reporte en pdf + */ + public void generateAudit() { + this.generateReport("general/reports/auditoria_final", "Auditoria", null); + } + + public Date getDateFrom() { + return this.dateFrom; + } + + /** + * Validacion de los 7 dias para el calendario + */ + public void initDatesTo() { + if (this.dateFrom != null) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(this.dateFrom); + calendar.add(Calendar.DATE, 6); + this.maxDateTo = calendar.getTime(); + } + + } + + /** + * Validacion de los 7 dias para el calendario + */ + public void initDatesFrom() { + if (this.dateTo != null) { + Calendar calendarTo = Calendar.getInstance(); + calendarTo.setTime(this.dateTo); + calendarTo.add(Calendar.DATE, -6); + this.minDateFrom = calendarTo.getTime(); + } + + } + + public void setDateFrom(Date dateFrom) { + this.dateFrom = dateFrom; + } + + public Date getDateTo() { + return this.dateTo; + } + + public void setDateTo(Date dateTo) { + this.dateTo = dateTo; + } + + public String getTransactioncode() { + return this.transactioncode; + } + + public void setTransactioncode(String transactioncode) { + this.transactioncode = transactioncode; + } + + public String getTransactionmodule() { + return this.transactionmodule; + } + + public void setTransactionmodule(String transactionmodule) { + this.transactionmodule = transactionmodule; + } + + public String getTransactionname() { + return this.transactionname; + } + + public void setTransactionname(String transactionname) { + this.transactionname = transactionname; + } + + public String getEntityName() { + return this.entityName; + } + + public void setEntityName(String entityName) { + this.entityName = entityName; + } + + public String getClientCode() { + return this.clientCode; + } + + public void setClientCode(String clientCode) { + this.clientCode = clientCode; + } + + public String getClientName() { + return this.clientName; + } + + public void setClientName(String clientName) { + this.clientName = clientName; + } + + public String getModuleCode() { + return this.moduleCode; + } + + public void setModuleCode(String moduleCode) { + this.moduleCode = moduleCode; + } + + public List getListModule() { + return this.listModule; + } + + public void setListModule(List listModule) { + this.listModule = listModule; + } + + public String getUser() { + return this.user; + } + + public void setUser(String user) { + this.user = user; + } + + public String getUserName() { + return this.userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public SafeAuditController getSafeAudit() { + return this.safeAudit; + } + + public void setSafeAudit(SafeAuditController safeAudit) { + this.safeAudit = safeAudit; + } + + public ReportController getReportController() { + return this.reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getTransactionversion() { + return this.transactionversion; + } + + public void setTransactionversion(String transactionversion) { + this.transactionversion = transactionversion; + } + + public AuditInsDelController getAuditinsdel() { + return this.auditinsdel; + } + + public void setAuditinsdel(AuditInsDelController auditinsdel) { + this.auditinsdel = auditinsdel; + } + + /** + * @return the maxDateTo + */ + public Date getMaxDateTo() { + return this.maxDateTo; + } + + /** + * @param maxDateTo + * the maxDateTo to set + */ + public void setMaxDateTo(Date maxDateTo) { + this.maxDateTo = maxDateTo; + } + + public Date getMinDateFrom() { + return this.minDateFrom; + } + + public void setMinDateFrom(Date minDateFrom) { + this.minDateFrom = minDateFrom; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/general/audit/.svn/text-base/AuditReportController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/general/audit/.svn/text-base/AuditReportController.java.svn-base new file mode 100644 index 0000000..a8342ca --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/general/audit/.svn/text-base/AuditReportController.java.svn-base @@ -0,0 +1,511 @@ +package com.fp.frontend.controller.general.audit; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.lov.EntityLovController; +import com.fp.frontend.controller.pgeneral.lov.TransactionLovController; +import com.fp.frontend.controller.pgeneral.lov.UserLovController; +import com.fp.frontend.controller.pgeneral.product.ModuleController; +import com.fp.frontend.controller.pgeneral.safe.AuditInsDelController; +import com.fp.frontend.controller.pgeneral.safe.SafeAuditController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneEntity; +import com.fp.persistence.pgeneral.product.TgeneModule; +import com.fp.persistence.pgeneral.safe.TsafeAudit; +import com.fp.persistence.pgeneral.safe.TsafeAuditInsDel; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * Clase que se utliza para la llanada del reporte de Auditoria + * + * @author Jacqueline Arias + * + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class AuditReportController extends AbstractController { + + /** + * Fecha desde + */ + private Date dateFrom; + + /** + * Fecha desde + */ + private Date maxDateTo; + + private Date minDateFrom; + /** + * Fecha hasta + */ + private Date dateTo; + + private String user; + + private String userName; + + private String transactioncode; + + private String transactionmodule; + + private String transactionname; + + private String transactionversion; + + private String entityName; + + private String clientCode; + + private String clientName; + + private String moduleCode; + + private List listModule; + + @ManagedProperty(value = "#{safeAuditController}") + private SafeAuditController safeAudit; + + @ManagedProperty(value = "#{auditInsDelController}") + private AuditInsDelController auditinsdel; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + public AuditReportController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + public void postConstruct() { + this.init(); + } + + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTAUDIT"; + this.recperpage = 15; + this.listModule = ModuleController.find(); + // this.create(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + try { + Request request = this.callerhelper.getRequest(); + + DtoQuery dtoQuerySafeUpdate = this.safeAudit.getDtoSafeAudit(); + DtoQuery dtoinsdel = this.auditinsdel.getDtoAuditInsDel(); + if ((this.dateFrom != null) && (this.dateTo != null)) { + Filter f = null; + f = new Filter(); + f.setSql("t.pk.changedate >= to_date('" + this.dateFrom + "', 'yyyy-MM-dd') and t.pk.changedate <= to_date('" + this.dateTo + + "', 'yyyy-MM-dd') "); + dtoinsdel.addFiltro(f); + dtoQuerySafeUpdate.addFiltro(f); + } + + HashMap mtables = new HashMap(); + mtables.put(this.safeAudit.getBeanalias(), dtoQuerySafeUpdate); + mtables.put(this.auditinsdel.getBeanalias(), dtoinsdel); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList<>(); + this.safeAudit.setLrecord(new ArrayList()); + this.auditinsdel.setLrecord(new ArrayList()); + MessageHelper.setMessageError(resp); + } else { + + this.safeAudit.setLrecord((List) resp.get(this.safeAudit.getBeanalias())); + this.auditinsdel.setLrecord((List) resp.get(this.auditinsdel.getBeanalias())); + + this.safeAudit.postQuery(this.safeAudit.getLrecord()); + this.auditinsdel.postQuery(this.auditinsdel.getLrecord()); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + /** + * Metodo que obtiene abre el lov de Personas + */ + public void openUserLov() { + Map> params = new HashMap<>(); + UserLovController.openLov(params); + } + + /** + * Metodo que pega los valores del lov de personas + * + * @param event + * @throws Exception + */ + public void onReturnUserLov(SelectEvent event) throws Exception { + TsafeUserDetail t = (TsafeUserDetail) event.getObject(); + this.setUser(t.getPk().getUsercode()); + this.setUserName(t.getModifiedData().get("personname") != null ? t.getModifiedData().get("personname").toString() : ""); + this.auditinsdel.addFilter("usercode", this.user); + this.safeAudit.addFilter("usercode", this.user); + } + + /** + * Metodo que obtiene abre el lov de Personas + */ + public void openTransactionLov() { + if ((this.moduleCode != null) && !this.moduleCode.isEmpty()) { + Map> params = new HashMap<>(); + List lmodule = new ArrayList<>(); + lmodule.add(this.moduleCode); + params.put("moduleCode", lmodule); + TransactionLovController.openLov(params); + } else { + MessageHelper.setMessageError("msg_modulerequird"); + return; + } + + } + + /** + * Metodo que pega los valores del lov de personas + * + * @param event + * @throws Exception + */ + public void onReturnTransactionLov(SelectEvent event) throws Exception { + TgeneTransaction t = (TgeneTransaction) event.getObject(); + this.setTransactionmodule(t.getPk().getTransactionmodule()); + this.setTransactioncode(t.getPk().getTransactioncode().toString()); + this.setTransactionname(t.getName()); + this.setTransactionversion(t.getPk().getTransactionversion().toString()); + this.auditinsdel.addFilter("transactionmodule", this.transactioncode); + this.safeAudit.addFilter("transactionmodule", this.transactioncode); + } + + /** + */ + public void openEntityLov() { + Map> params = new HashMap<>(); + List logList = new ArrayList<>(); + logList.add("1"); + params.put("log", logList); + EntityLovController.openLov(params); + } + + /** + * Metodo que pega los valores del lov de personas + * + * @param event + * @throws Exception + */ + public void onReturnEntityLov(SelectEvent event) throws Exception { + TgeneEntity t = (TgeneEntity) event.getObject(); + this.setEntityName(t.getPk().getTname()); + this.auditinsdel.addFilter("pk.tablename", this.entityName); + this.safeAudit.addFilter("pk.tablename", this.entityName); + } + + /** + * Metodo que obtiene abre el lov de Personas + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Metodo que pega los valores del lov de personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + this.setClientCode(t.getPk().getPersoncode().toString()); + this.setClientName(t.getName()); + this.auditinsdel.addFilter("personcode", this.clientCode); + this.safeAudit.addFilter("personcode", this.clientCode); + + } + + /** + * Listener del lov de transacciones + */ + public void listenerTransaction() { + this.transactionmodule = null; + this.transactioncode = null; + this.transactionname = null; + this.auditinsdel.addFilter("transactionmodule", this.moduleCode); + this.safeAudit.addFilter("transactionmodule", this.moduleCode); + } + + /** + * Metodo que llama al reporte en xlsx + */ + public void generateXls() { + this.generateReport("general/reports/auditoria_final", "Auditoria", "xlsx"); + + } + + /** + * Metodo de envio de parametros del reporte + * + * @param name + * @param filename + * @param format + */ + private void generateReport(String name, String filename, String format) { + String path = name; + + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("dateFrom", this.dateFrom.toString()); + parameters.put("dateTo", this.dateTo.toString()); + parameters.put("userCode", this.user); + parameters.put("transactionModule", this.transactionmodule); + if(moduleCode!=null && transactionmodule==null){ + parameters.put("transactionModule", moduleCode); + } + parameters.put("transactionCode", this.transactioncode); + parameters.put("tableName", this.entityName); + parameters.put("personcode", this.clientCode); + parameters.put("transactionVersion", this.transactionversion); + parameters.put("company", Integer.parseInt(super.getLoginController().getRequest().getCompany().toString())); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + if (format == null) { + format = "pdf"; + } + try { + if (format.equals("xlsx") || format.equals("xls")) { + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } else { + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Metodo que llama al reporte en pdf + */ + public void generateAudit() { + this.generateReport("general/reports/auditoria_final", "Auditoria", null); + } + + public Date getDateFrom() { + return this.dateFrom; + } + + /** + * Validacion de los 7 dias para el calendario + */ + public void initDatesTo() { + if (this.dateFrom != null) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(this.dateFrom); + calendar.add(Calendar.DATE, 6); + this.maxDateTo = calendar.getTime(); + } + + } + + /** + * Validacion de los 7 dias para el calendario + */ + public void initDatesFrom() { + if (this.dateTo != null) { + Calendar calendarTo = Calendar.getInstance(); + calendarTo.setTime(this.dateTo); + calendarTo.add(Calendar.DATE, -6); + this.minDateFrom = calendarTo.getTime(); + } + + } + + public void setDateFrom(Date dateFrom) { + this.dateFrom = dateFrom; + } + + public Date getDateTo() { + return this.dateTo; + } + + public void setDateTo(Date dateTo) { + this.dateTo = dateTo; + } + + public String getTransactioncode() { + return this.transactioncode; + } + + public void setTransactioncode(String transactioncode) { + this.transactioncode = transactioncode; + } + + public String getTransactionmodule() { + return this.transactionmodule; + } + + public void setTransactionmodule(String transactionmodule) { + this.transactionmodule = transactionmodule; + } + + public String getTransactionname() { + return this.transactionname; + } + + public void setTransactionname(String transactionname) { + this.transactionname = transactionname; + } + + public String getEntityName() { + return this.entityName; + } + + public void setEntityName(String entityName) { + this.entityName = entityName; + } + + public String getClientCode() { + return this.clientCode; + } + + public void setClientCode(String clientCode) { + this.clientCode = clientCode; + } + + public String getClientName() { + return this.clientName; + } + + public void setClientName(String clientName) { + this.clientName = clientName; + } + + public String getModuleCode() { + return this.moduleCode; + } + + public void setModuleCode(String moduleCode) { + this.moduleCode = moduleCode; + } + + public List getListModule() { + return this.listModule; + } + + public void setListModule(List listModule) { + this.listModule = listModule; + } + + public String getUser() { + return this.user; + } + + public void setUser(String user) { + this.user = user; + } + + public String getUserName() { + return this.userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public SafeAuditController getSafeAudit() { + return this.safeAudit; + } + + public void setSafeAudit(SafeAuditController safeAudit) { + this.safeAudit = safeAudit; + } + + public ReportController getReportController() { + return this.reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getTransactionversion() { + return this.transactionversion; + } + + public void setTransactionversion(String transactionversion) { + this.transactionversion = transactionversion; + } + + public AuditInsDelController getAuditinsdel() { + return this.auditinsdel; + } + + public void setAuditinsdel(AuditInsDelController auditinsdel) { + this.auditinsdel = auditinsdel; + } + + /** + * @return the maxDateTo + */ + public Date getMaxDateTo() { + return this.maxDateTo; + } + + /** + * @param maxDateTo + * the maxDateTo to set + */ + public void setMaxDateTo(Date maxDateTo) { + this.maxDateTo = maxDateTo; + } + + public Date getMinDateFrom() { + return this.minDateFrom; + } + + public void setMinDateFrom(Date minDateFrom) { + this.minDateFrom = minDateFrom; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/general/audit/AuditReportController.java b/frontend/src/main/java/com/fp/frontend/controller/general/audit/AuditReportController.java new file mode 100644 index 0000000..0b2d824 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/general/audit/AuditReportController.java @@ -0,0 +1,510 @@ +package com.fp.frontend.controller.general.audit; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.lov.EntityLovController; +import com.fp.frontend.controller.pgeneral.lov.TransactionLovController; +import com.fp.frontend.controller.pgeneral.lov.UserLovController; +import com.fp.frontend.controller.pgeneral.product.ModuleController; +import com.fp.frontend.controller.pgeneral.safe.AuditInsDelController; +import com.fp.frontend.controller.pgeneral.safe.SafeAuditController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneEntity; +import com.fp.persistence.pgeneral.product.TgeneModule; +import com.fp.persistence.pgeneral.safe.TsafeAudit; +import com.fp.persistence.pgeneral.safe.TsafeAuditInsDel; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * Clase que se utliza para la llanada del reporte de Auditoria + * + * @author Jacqueline Arias + * + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class AuditReportController extends AbstractController { + + /** + * Fecha desde + */ + private Date dateFrom; + + /** + * Fecha desde + */ + private Date maxDateTo; + + private Date minDateFrom; + /** + * Fecha hasta + */ + private Date dateTo; + + private String user; + + private String userName; + + private String transactioncode; + + private String transactionmodule; + + private String transactionname; + + private String transactionversion; + + private String entityName; + + private String clientCode; + + private String clientName; + + private String moduleCode; + + private List listModule; + + @ManagedProperty(value = "#{safeAuditController}") + private SafeAuditController safeAudit; + + @ManagedProperty(value = "#{auditInsDelController}") + private AuditInsDelController auditinsdel; + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + public AuditReportController() throws Exception { + super(AbstractDataTransport.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + public void postConstruct() { + this.init(); + } + + private void init() { + try { + + this.lrecord = new ArrayList<>(); + this.beanalias = "REPORTAUDIT"; + this.recperpage = 15; + this.listModule = ModuleController.find(); + // this.create(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + + try { + Request request = this.callerhelper.getRequest(); + + DtoQuery dtoQuerySafeUpdate = this.safeAudit.getDtoSafeAudit(); + DtoQuery dtoinsdel = this.auditinsdel.getDtoAuditInsDel(); + if ((this.dateFrom != null) && (this.dateTo != null)) { + Filter f = null; + f = new Filter(); + f.setSql("t.pk.changedate >= to_date('" + this.dateFrom + "', 'yyyy-MM-dd') and t.pk.changedate <= to_date('" + this.dateTo + + "', 'yyyy-MM-dd') "); + dtoinsdel.addFiltro(f); + dtoQuerySafeUpdate.addFiltro(f); + } + + HashMap mtables = new HashMap(); + mtables.put(this.safeAudit.getBeanalias(), dtoQuerySafeUpdate); + mtables.put(this.auditinsdel.getBeanalias(), dtoinsdel); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList<>(); + this.safeAudit.setLrecord(new ArrayList()); + this.auditinsdel.setLrecord(new ArrayList()); + MessageHelper.setMessageError(resp); + } else { + + this.safeAudit.setLrecord((List) resp.get(this.safeAudit.getBeanalias())); + this.auditinsdel.setLrecord((List) resp.get(this.auditinsdel.getBeanalias())); + + this.safeAudit.postQuery(this.safeAudit.getLrecord()); + this.auditinsdel.postQuery(this.auditinsdel.getLrecord()); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + /** + * Metodo que obtiene abre el lov de Personas + */ + public void openUserLov() { + Map> params = new HashMap<>(); + UserLovController.openLov(params); + } + + /** + * Metodo que pega los valores del lov de personas + * + * @param event + * @throws Exception + */ + public void onReturnUserLov(SelectEvent event) throws Exception { + TsafeUserDetail t = (TsafeUserDetail) event.getObject(); + this.setUser(t.getPk().getUsercode()); + this.setUserName(t.getModifiedData().get("personname") != null ? t.getModifiedData().get("personname").toString() : ""); + this.auditinsdel.addFilter("usercode", this.user); + this.safeAudit.addFilter("usercode", this.user); + } + + /** + * Metodo que obtiene abre el lov de Personas + */ + public void openTransactionLov() { + if ((this.moduleCode != null) && !this.moduleCode.isEmpty()) { + Map> params = new HashMap<>(); + List lmodule = new ArrayList<>(); + lmodule.add(this.moduleCode); + params.put("moduleCode", lmodule); + TransactionLovController.openLov(params); + } else { + MessageHelper.setMessageError("msg_modulerequird"); + return; + } + + } + + /** + * Metodo que pega los valores del lov de personas + * + * @param event + * @throws Exception + */ + public void onReturnTransactionLov(SelectEvent event) throws Exception { + TgeneTransaction t = (TgeneTransaction) event.getObject(); + this.setTransactionmodule(t.getPk().getTransactionmodule()); + this.setTransactioncode(t.getPk().getTransactioncode().toString()); + this.setTransactionname(t.getName()); + this.setTransactionversion(t.getPk().getTransactionversion().toString()); + this.auditinsdel.addFilter("transactionmodule", this.transactioncode); + this.safeAudit.addFilter("transactionmodule", this.transactioncode); + } + + /** + */ + public void openEntityLov() { + Map> params = new HashMap<>(); + List logList = new ArrayList<>(); + logList.add("1"); + params.put("log", logList); + EntityLovController.openLov(params); + } + + /** + * Metodo que pega los valores del lov de personas + * + * @param event + * @throws Exception + */ + public void onReturnEntityLov(SelectEvent event) throws Exception { + TgeneEntity t = (TgeneEntity) event.getObject(); + this.setEntityName(t.getPk().getTname()); + this.auditinsdel.addFilter("pk.tablename", this.entityName); + this.safeAudit.addFilter("pk.tablename", this.entityName); + } + + /** + * Metodo que obtiene abre el lov de Personas + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + /** + * Metodo que pega los valores del lov de personas + * + * @param event + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + this.setClientCode(t.getPk().getPersoncode().toString()); + this.setClientName(t.getName()); + this.auditinsdel.addFilter("personcode", this.clientCode); + this.safeAudit.addFilter("personcode", this.clientCode); + + } + + /** + * Listener del lov de transacciones + */ + public void listenerTransaction() { + this.transactionmodule = null; + this.transactioncode = null; + this.transactionname = null; + this.auditinsdel.addFilter("transactionmodule", this.moduleCode); + this.safeAudit.addFilter("transactionmodule", this.moduleCode); + } + + /** + * Metodo que llama al reporte en xlsx + */ + public void generateXls() { + this.generateReport("general/reports/auditoria_final", "Auditoria", "xlsx"); + + } + + /** + * Metodo de envio de parametros del reporte + * + * @param name + * @param filename + * @param format + */ + private void generateReport(String name, String filename, String format) { + String path = name; + + // Fija parametros del report. + HashMap parameters = new HashMap<>(); + parameters.put("dateFrom", this.dateFrom.toString()); + parameters.put("dateTo", this.dateTo.toString()); + parameters.put("userCode", this.user); + parameters.put("transactionModule", this.transactionmodule); + if (moduleCode != null && transactionmodule == null) { + parameters.put("transactionModule", moduleCode); + } + parameters.put("transactionCode", this.transactioncode); + parameters.put("tableName", this.entityName); + parameters.put("personcode", this.clientCode); + parameters.put("transactionVersion", this.transactionversion); + parameters.put("company", Integer.parseInt(super.getLoginController().getRequest().getCompany().toString())); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + + if (format == null) { + format = "pdf"; + } + try { + if (format.equals("xlsx") || format.equals("xls")) { + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } else { + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Metodo que llama al reporte en pdf + */ + public void generateAudit() { + this.generateReport("general/reports/auditoria_final", "Auditoria", null); + } + + public Date getDateFrom() { + return this.dateFrom; + } + + /** + * Validacion de los 7 dias para el calendario + */ + public void initDatesTo() { + if (this.dateFrom != null) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(this.dateFrom); + calendar.add(Calendar.DATE, 6); + this.maxDateTo = calendar.getTime(); + } + + } + + /** + * Validacion de los 7 dias para el calendario + */ + public void initDatesFrom() { + if (this.dateTo != null) { + Calendar calendarTo = Calendar.getInstance(); + calendarTo.setTime(this.dateTo); + calendarTo.add(Calendar.DATE, -6); + this.minDateFrom = calendarTo.getTime(); + } + + } + + public void setDateFrom(Date dateFrom) { + this.dateFrom = dateFrom; + } + + public Date getDateTo() { + return this.dateTo; + } + + public void setDateTo(Date dateTo) { + this.dateTo = dateTo; + } + + public String getTransactioncode() { + return this.transactioncode; + } + + public void setTransactioncode(String transactioncode) { + this.transactioncode = transactioncode; + } + + public String getTransactionmodule() { + return this.transactionmodule; + } + + public void setTransactionmodule(String transactionmodule) { + this.transactionmodule = transactionmodule; + } + + public String getTransactionname() { + return this.transactionname; + } + + public void setTransactionname(String transactionname) { + this.transactionname = transactionname; + } + + public String getEntityName() { + return this.entityName; + } + + public void setEntityName(String entityName) { + this.entityName = entityName; + } + + public String getClientCode() { + return this.clientCode; + } + + public void setClientCode(String clientCode) { + this.clientCode = clientCode; + } + + public String getClientName() { + return this.clientName; + } + + public void setClientName(String clientName) { + this.clientName = clientName; + } + + public String getModuleCode() { + return this.moduleCode; + } + + public void setModuleCode(String moduleCode) { + this.moduleCode = moduleCode; + } + + public List getListModule() { + return this.listModule; + } + + public void setListModule(List listModule) { + this.listModule = listModule; + } + + public String getUser() { + return this.user; + } + + public void setUser(String user) { + this.user = user; + } + + public String getUserName() { + return this.userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public SafeAuditController getSafeAudit() { + return this.safeAudit; + } + + public void setSafeAudit(SafeAuditController safeAudit) { + this.safeAudit = safeAudit; + } + + public ReportController getReportController() { + return this.reportController; + } + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public String getTransactionversion() { + return this.transactionversion; + } + + public void setTransactionversion(String transactionversion) { + this.transactionversion = transactionversion; + } + + public AuditInsDelController getAuditinsdel() { + return this.auditinsdel; + } + + public void setAuditinsdel(AuditInsDelController auditinsdel) { + this.auditinsdel = auditinsdel; + } + + /** + * @return the maxDateTo + */ + public Date getMaxDateTo() { + return this.maxDateTo; + } + + /** + * @param maxDateTo the maxDateTo to set + */ + public void setMaxDateTo(Date maxDateTo) { + this.maxDateTo = maxDateTo; + } + + public Date getMinDateFrom() { + return this.minDateFrom; + } + + public void setMinDateFrom(Date minDateFrom) { + this.minDateFrom = minDateFrom; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pbpm/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/pbpm/.svn/entries new file mode 100644 index 0000000..59d19b3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pbpm/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/pbpm +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +lov +dir + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pbpm/lov/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/pbpm/lov/.svn/entries new file mode 100644 index 0000000..253cbd5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pbpm/lov/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/pbpm/lov +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TbpmFlowsLovController.java +file + + + + +2022-07-28T03:39:55.839600Z +d99e84716cf8028f578618b71554478d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3530 + +TbpmRulesLovController.java +file + + + + +2022-07-28T03:39:55.840600Z +99baf337ed5c45b258fed79dee6c9c38 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3855 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pbpm/lov/.svn/text-base/TbpmFlowsLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pbpm/lov/.svn/text-base/TbpmFlowsLovController.java.svn-base new file mode 100644 index 0000000..49ecff9 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pbpm/lov/.svn/text-base/TbpmFlowsLovController.java.svn-base @@ -0,0 +1,109 @@ +package com.fp.frontend.controller.pbpm.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmFlows; + +/** + * Clase controladora del lov asociado al bean TbpmFlows. + * + * @author Andres E. Carpio. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TbpmFlowsLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public TbpmFlowsLovController() throws Exception { + super(TbpmFlows.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TBPMFLOWSLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + super.addFilter("pk.companycode", this.getLoginController().getRequest().getCompany().toString()); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.flowcode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setTbpmFlows() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setTbpmFlows(TbpmFlows tbpmFlows) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put("modal", true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 580); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/bpmFlowsLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pbpm/lov/.svn/text-base/TbpmRulesLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pbpm/lov/.svn/text-base/TbpmRulesLovController.java.svn-base new file mode 100644 index 0000000..946c74a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pbpm/lov/.svn/text-base/TbpmRulesLovController.java.svn-base @@ -0,0 +1,117 @@ +package com.fp.frontend.controller.pbpm.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmRules; + +/** + * Clase controladora del lov asociado al bean TbpmRules. + * + * @author Andres E. Carpio. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TbpmRulesLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public TbpmRulesLovController() throws Exception { + super(TbpmRules.class); + } + + @PostConstruct + private void postconstruct() throws Exception{ + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //FileType + String filetype = CallerHelper.getLovParameter("filetype"); + if(filetype==null){ + MessageHelper.setMessageError("msg_fileTypeNotFound"); + return; + } + super.addFilter("filetype", filetype); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TBPMRULESLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + super.addFilter("pk.companycode", this.getLoginController().getRequest().getCompany().toString()); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.rulecode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setTbpmRules() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setTbpmRules(TbpmRules tbpmRules) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tbpmRules); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put("modal", true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 580); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/bpmRulesLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pbpm/lov/TbpmFlowsLovController.java b/frontend/src/main/java/com/fp/frontend/controller/pbpm/lov/TbpmFlowsLovController.java new file mode 100644 index 0000000..16303ee --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pbpm/lov/TbpmFlowsLovController.java @@ -0,0 +1,109 @@ +package com.fp.frontend.controller.pbpm.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmFlows; + +/** + * Clase controladora del lov asociado al bean TbpmFlows. + * + * @author Andres E. Carpio. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TbpmFlowsLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public TbpmFlowsLovController() throws Exception { + super(TbpmFlows.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TBPMFLOWSLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + super.addFilter("pk.companycode", this.getLoginController().getRequest().getCompany().toString()); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.flowcode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setTbpmFlows() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setTbpmFlows(TbpmFlows tbpmFlows) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put("modal", true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 580); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/bpmFlowsLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pbpm/lov/TbpmRulesLovController.java b/frontend/src/main/java/com/fp/frontend/controller/pbpm/lov/TbpmRulesLovController.java new file mode 100644 index 0000000..1c31368 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pbpm/lov/TbpmRulesLovController.java @@ -0,0 +1,117 @@ +package com.fp.frontend.controller.pbpm.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmRules; + +/** + * Clase controladora del lov asociado al bean TbpmRules. + * + * @author Andres E. Carpio. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TbpmRulesLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public TbpmRulesLovController() throws Exception { + super(TbpmRules.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //FileType + String filetype = CallerHelper.getLovParameter("filetype"); + if (filetype == null) { + MessageHelper.setMessageError("msg_fileTypeNotFound"); + return; + } + super.addFilter("filetype", filetype); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TBPMRULESLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + super.addFilter("pk.companycode", this.getLoginController().getRequest().getCompany().toString()); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.rulecode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setTbpmRules() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setTbpmRules(TbpmRules tbpmRules) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tbpmRules); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put("modal", true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 580); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/bpmRulesLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/entries new file mode 100644 index 0000000..b08e9b0 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/entries @@ -0,0 +1,371 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/pcustomer +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +lov +dir + +PersonAddressController.java +file + + + + +2022-07-28T03:39:46.529560Z +88b06592a862b10a5613b5d77800f2ae +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +24054 + +JuridicalPersonController.java +file + + + + +2022-07-28T03:39:46.529560Z +0d19c4ef80508f85e10e94cb056b0199 +2015-10-19T06:22:25.984481Z +4297 +fpazmino + + + + + + + + + + + + + + + + + + + + + +33431 + +PersonPhoneController.java +file + + + + +2022-07-28T03:39:46.530560Z +376049e2047363ce56345aa8175c7728 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +9240 + +PersonViewController.java +file + + + + +2022-07-28T03:39:46.530560Z +d270ccbc550f7f159815e3f388d12ffb +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +8878 + +FileDetailController.java +file + + + + +2022-07-28T03:39:46.530560Z +2ec7962fdbb7e7c5c0d4eff5e44b32f0 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +4084 + +PeopleFastController.java +file + + + + +2022-07-28T03:39:46.531560Z +30efd6187f8a05b36029f6dbd60032e8 +2015-06-23T07:23:37.626271Z +4132 +cpiedra + + + + + + + + + + + + + + + + + + + + + +34811 + +PersonViewLovController.java +file + + + + +2022-07-28T03:39:46.531560Z +e3d1e26c094d4edd9dae883cf46902dc +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +4348 + +PeopleController.java +file + + + + +2022-07-28T03:39:46.531560Z +9b2b2a5056f6fd0c80aff442f97cd3ff +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +5503 + +CompanyController.java +file + + + + +2022-07-28T03:39:46.532560Z +4a75bc75802dbb190af3af6c742658d5 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +7934 + +PersonDetailController.java +file + + + + +2022-07-28T03:39:46.532560Z +36fbdea2f516f763537da5fe8eae45f3 +2014-12-22T07:26:40.587822Z +3616 +fpazmino + + + + + + + + + + + + + + + + + + + + + +8701 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/CompanyController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/CompanyController.java.svn-base new file mode 100644 index 0000000..a364cf9 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/CompanyController.java.svn-base @@ -0,0 +1,300 @@ +package com.fp.frontend.controller.pcustomer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.company.TcustCompany; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TcustCompany + * + * @author MAV. + * @version 1.0 + */ +@ManagedBean +@ViewScoped +public class CompanyController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private String personcode; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de tipo de empresa + * + */ + private List lbusinesstype; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de clases de empresa + */ + private List lbussinesclass; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de tipo de institucion + */ + private List linstitutiontype; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de estdo de operatividad + */ + private List loperativestatus; + + + public CompanyController() throws Exception { + super(TcustCompany.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + this.lbusinesstype = CatalogDetailController.find("BUSINESSTYPE"); + this.lbussinesclass = CatalogDetailController.find("BUSINESSCLASS"); + this.linstitutiontype = CatalogDetailController.find("PERSONTYPE"); + this.loperativestatus = CatalogDetailController.find("OPERATIVESTATUS"); + } + + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + super.create(); + this.beanalias = "TCUSTCOMPANY"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Agrega un par´metro para la conulta + * + * @param personcode + * Código de company + */ + public void addPersoncodeFilter(String personcode) { + this.personcode = personcode; + super.addFilter("pk.personcode", personcode); + this.record.getPk().setPersoncode(Integer.parseInt(personcode)); + } + + /** + * Método para armar la consulta + * + * @return dto Objeto DtoQuery + * @throws Exception + */ + public DtoQuery getDtoQuery() throws Exception { + super.addFilterDateto(); + DtoQuery dto = super.getDtoQuery(false); + + SubQuery institutiontype = new SubQuery( + "TgeneCatalogDetail", + "description", + "institutiontypedesc", + "i.pk.catalog = t.institutiontypecatalog and i.pk.catalogcode= 'INSTITUTIONTYPE' " ); + dto.addSubQuery(institutiontype); + + return dto; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = getDtoQuery(true); + + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(lrecord!=null && !lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Controla la respuesta de la consulta + * + * @param resp + * Objeto Response + * @throws Exception + */ + public void manageResponseCompany(Response resp) throws Exception { + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.record = null; + MessageHelper.setMessageError(resp); + } else { + this.record = (TcustCompany) resp.get(this.beanalias); + if (this.record == null) { + super.create(); + this.record.getPk().setPersoncode( + Integer.parseInt(this.personcode)); + } + super.postQuery(this.record); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Busca una solicitud por su codigo + * @param codigoSolicitud + * @return + */ + public static TcustCompany findByPersonCode(String personCode) { + try { + CompanyController cc = new CompanyController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.personcode", personCode); + cc.addFilterDateto(); + cc.querydatabase(); + + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * @return the personcode + */ + public String getPersoncode() { + return personcode; + } + + /** + * @param personcode the personcode to set + */ + public void setPersoncode(String personcode) { + this.personcode = personcode; + } + + /** + * @return the lbusinesstype + */ + public List getLbusinesstype() { + return lbusinesstype; + } + + /** + * @param lbusinesstype the lbusinesstype to set + */ + public void setLbusinesstype(List lbusinesstype) { + this.lbusinesstype = lbusinesstype; + } + + /** + * @return the lbussinesclass + */ + public List getLbussinesclass() { + return lbussinesclass; + } + + /** + * @param lbussinesclass the lbussinesclass to set + */ + public void setLbussinesclass(List lbussinesclass) { + this.lbussinesclass = lbussinesclass; + } + + /** + * @return the linstitutiontype + */ + public List getLinstitutiontype() { + return linstitutiontype; + } + + /** + * @param linstitutiontype the linstitutiontype to set + */ + public void setLinstitutiontype(List linstitutiontype) { + this.linstitutiontype = linstitutiontype; + } + + /** + * @return the loperativestatus + */ + public List getLoperativestatus() { + return loperativestatus; + } + + /** + * @param loperativestatus the loperativestatus to set + */ + public void setLoperativestatus(List loperativestatus) { + this.loperativestatus = loperativestatus; + } + + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/FileDetailController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/FileDetailController.java.svn-base new file mode 100644 index 0000000..25e8eb2 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/FileDetailController.java.svn-base @@ -0,0 +1,132 @@ +package com.fp.frontend.controller.pcustomer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.common.helper.Constant; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonAddressKey; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; + +/** + * Clase controladora del bean TcustPersonAddress. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class FileDetailController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public FileDetailController() throws Exception { + super(TgeneFilesDetail.class); + } + + + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "FILEDETAIL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(lrecord!=null && !lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para encontrar por codigo de imagen + * @param imagecode + * @return + */ + public static TgeneFilesDetail find(String imagecode) { + try { + if(imagecode==null){ + return null; + } + FileDetailController cc = new FileDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.code", imagecode); + cc.addFilterDateto(); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/JuridicalPersonController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/JuridicalPersonController.java.svn-base new file mode 100644 index 0000000..aeb47c1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/JuridicalPersonController.java.svn-base @@ -0,0 +1,973 @@ +package com.fp.frontend.controller.pcustomer; + +import java.awt.image.BufferedImage; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Field; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.ExternalContext; +import javax.faces.context.FacesContext; +import javax.imageio.ImageIO; +import javax.servlet.ServletContext; + +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.FlowEvent; +import org.primefaces.event.SelectEvent; +import org.primefaces.model.DefaultStreamedContent; +import org.primefaces.model.StreamedContent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.helper.FileHelper; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.lov.JuridicalPersonLovController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.date.TgeneAccountingDateBranchController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.LanguageController; +import com.fp.frontend.controller.pgeneral.lov.ActivityLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.pcustomer.company.TcustCompany; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pcustomer.gene.TgeneActivity; +import com.fp.persistence.pcustomer.people.TcustPeople; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneLanguage; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de JuridicalPerson. + * + * @author MAV. + * @version 1.0 + */ +@ManagedBean +@ViewScoped +public class JuridicalPersonController extends AbstractController { + + private static final long serialVersionUID = 1L; + + + @ManagedProperty(value = "#{companyController}") + private CompanyController companyController; + + @ManagedProperty(value = "#{peopleFastController}") + private PeopleFastController peopleFastController; + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController addressController; + + @ManagedProperty(value = "#{personPhoneController}") + private PersonPhoneController phonesController; + + @ManagedProperty(value = "#{fileDetailController}") + private FileDetailController fileDetail; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de identificacion + */ + private List lidentification; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de tipo de cliente + */ + private List ltypeclient; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de sector + * económico + */ + private List leconomicsector; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de actividad no + * económica + */ + private List lnotactivity; + + /** + * Atributo para el listado de géneros + */ + private List lgender; + + /** + * Atributo para el listado de idiomas + */ + private List llenguage; + + /** + * Atributo para activar el keyFilter + */ + private boolean activeRegEx; + + /** + * Atributo para la longitud de la identificación + */ + private String lengthId; + + /** + * atributo para el código de persona + */ + private String personcode; + + private Boolean existingperson; + + /** + * Atributo para deshabilitar el boton save + */ + private Boolean isDisableSave = Boolean.FALSE; + + /** + * Atributo para el control de checkBox exencto de impuesto a la renta + */ + private boolean exentoImpuesto; + + /** + * Atributos relacionados con el logo + */ + UploadedFile selectedPicture; + Boolean fotoCargada=false; + StreamedContent foto; + String rutaFoto; + + private String extensionFoto = "jpg"; + + private String imageUrl; + + TsafeUserDetail usuario; + + List fileH = new ArrayList(); + + public JuridicalPersonController() throws Exception { + super(TcustPersonDetail.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + this.lengthId = "13"; + this.init(); + //super.buildTransactionPages("juridicalPersonController"); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.create(); + this.lrecord = new ArrayList<>(); + this.record=new TcustPersonDetail(); + this.record.setIsnew(true); + this.beanalias = "JURIDICALPERSONCONTROLLER"; + + this.companyController.create(); + this.companyController.setRecord(new TcustCompany()); + this.companyController.getRecord().setIsnew(true); + + this.addressController.create(); + this.addressController.setRecord(new TcustPersonAddress()); + this.addressController.getRecord().setIsnew(true); + + this.phonesController.create(); + this.phonesController.setRecord(new TcustPersonPhone()); + this.phonesController.getRecord().setIsnew(true); + + //Llenando las listas + this.lidentification = CatalogDetailController.find("IDENTIFICATION","2"); + this.leconomicsector = CatalogDetailController.find("ECONOMICSECTOR"); + this.ltypeclient = CatalogDetailController.findClientType("CLIENTTYPE", "2"); + this.lnotactivity = CatalogDetailController.find("NOTACTIVITY"); + this.lgender = CatalogDetailController.getListGender(); + this.llenguage = LanguageController.find(); + this.getRecord().setLanguagecode("ES"); + + //Obteniendo los datos del usuario logueado + usuario=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + try { + if(super.getMfilters().get("pk.personcode")==null || super.getMfilters().get("pk.personcode").equals("null")){ + return; + } + super.addFilterDateto(); + + //Obteniendo la compannia + + TcustCompany compannia=CompanyController.findByPersonCode(super.getMfilters().get("pk.personcode")); + if(compannia!=null){ + this.companyController.setRecord(compannia); + } + + //Obteniendo las direcciones + List direcciones=PersonAddressController.findAllByPersonCode(this.getMfilters().get("pk.personcode")); + this.addressController.setLrecord(direcciones); + + //Obteniendo los telefonos + List telefonos=PersonPhoneController.findAllByPersonCode(this.getMfilters().get("pk.personcode")); + this.phonesController.setLrecord(telefonos); + + Request request = this.callerhelper.getRequest(); + + DtoQuery dto = super.getDtoQuery(false); + + // subqueries + SubQuery subquery = new SubQuery("TgeneActivity", "description", + "activitydesc", "i.pk = t.activitycode"); + dto.addSubQuery(subquery); + + SubQuery subquery1 = new SubQuery("TgeneActivity", + "segmenttypecatalog", "segmenttypecatalog", + "i.pk = t.activitycode"); + dto.addSubQuery(subquery1); + + SubQuery subquery2 = new SubQuery( + "TgeneCatalogDetail", + "description", + "segmentdesc", + "i.pk.catalogcode = 'SEGMENTTYPE' and i.pk.catalog = (select a.segmenttypecatalog from TgeneActivity a where a.pk = t.activitycode)"); + dto.addSubQuery(subquery2); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.record = new TcustPersonDetail(); + this.companyController.setRecord(new TcustCompany()); + MessageHelper.setMessageError(resp); + } else { + + if(resp.get(this.beanalias)!=null){ + this.record = (TcustPersonDetail) resp.get(this.beanalias); + this.record.setIsnew(false); + } + + if(this.companyController.getRecord()==null) + { + this.companyController.setRecord(new TcustCompany()); + this.companyController.getRecord().setIsnew(true); + }else{ + //Cargando la imagen + if(this.companyController.getRecord()!=null && this.companyController.getRecord().getLogo()!=null){ + + TgeneFilesDetail fileDetalle = fileDetail.find((this.companyController==null || this.companyController.getRecord().getLogo()==null)?null:String.valueOf(this.companyController.getRecord().getLogo())); + extensionFoto = fileDetalle!=null?fileDetalle.getExtension():extensionFoto; + if(fileDetalle!=null && fileDetalle.getImage()!=null){ + InputStream input=new ByteArrayInputStream(fileDetalle.getImage()); + this.foto=new DefaultStreamedContent(input); + this.fotoCargada=true; + + //Almacenando la imagen temporalmente + ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); + ServletContext servletContext = (ServletContext) externalContext.getContext(); + String tempUrl = servletContext.getRealPath("/");; + String imageName=UUID.randomUUID().toString(); + String imageUrl=tempUrl + "resources/images/" + imageName +"."+extensionFoto; + imageUrl = imageUrl.replace("\\", "/"); + File outputfile = new File(imageUrl); + BufferedImage image=ImageIO.read(input); + Boolean saved=ImageIO.write(image, extensionFoto, outputfile); + + this.rutaFoto="/resources/images/"+imageName+"."+extensionFoto; + } + }else{ + this.fotoCargada=false; + } + + } + } + + + this.personcode = String.valueOf(this.getMfilters().get("pk.personcode")); + +// this.addressController.addPersoncodeFilter(this.personcode); +// this.addressController.addFilterDateto(); +// this.addressController.query(); + + /* + this.phonesController.addPersoncodeFilter(this.personcode); + this.phonesController.addFilterDateto(); + this.phonesController.query();*/ + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + public void save() { + try { + //Validando las direcciones y telefonos + if (this.addressController.getLrecord().size() == 0) { + MessageHelper.setMessageError("msg_requireAddress"); + return; + }else{ + for (TcustPersonAddress direccion : this.addressController.getLrecord()) { + if(direccion.isnew){ + direccion.setIngressusercode(this.usuario.getPk().getUsercode()); + }else{ + direccion.setModifyusercode(this.usuario.getPk().getUsercode()); + } + } + } + if (this.phonesController.getLrecord().size() == 0) { + MessageHelper.setMessageError("msg_requirePhones"); + return; + }else{ + for (TcustPersonPhone telefono : this.phonesController.getLrecord()) { + if(telefono.isnew){ + telefono.setIngressusercode(this.usuario.getPk().getUsercode()); + }else{ + telefono.setModifyusercode(this.usuario.getPk().getUsercode()); + } + } + } + + //Asignando los campos + this.record.setDatefrom(new Timestamp(Calendar.getInstance().getTimeInMillis())); + this.record.setIdentificationcatalogcode("IDENTIFICATION"); + if(this.record.isnew){ + this.record.setIngressuser(this.usuario.getPk().getUsercode()); + }else{ + this.record.setModifyuser(this.usuario.getPk().getUsercode()); + } + + this.record.setPersontypecatalog("2"); + this.record.setPersontypecatalogcode("PERSONTYPE"); + this.record.setRegisterdate(new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + this.record.setClienttypecatalogcode("CLIENTTYPE"); + this.record.setEconomicsectorcatalogcode("ECONOMICSECTOR"); + + if(this.selectedPicture!=null){ + this.companyController.getRecord().setPicture(this.selectedPicture.getContents()); + } + + DtoSave dtosave = super.getDtoSave(true); + dtosave.setReturnpk(true); + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + dtosave.setPosition(3); + msave.put(this.beanalias, dtosave); + + // DIRECCIONES + DtoSave dtosaveAddress = addressController.getDtoSave(); + dtosaveAddress.setPosition(1); + msave.put(addressController.getBeanalias(), dtosaveAddress); + + // TELEFONOS + DtoSave dtosavePhone = phonesController.getDtoSave(); + dtosavePhone.setPosition(2); + msave.put(phonesController.getBeanalias(), dtosavePhone); + + request.setSaveTables(msave); + + request.getModifiedData().put("PERSON", this.record); + request.getModifiedData().put("COMPANY", this.companyController.getRecord()); + request.getModifiedData().put("ADDRESSES", this.addressController.getLrecord()); + + guardarInformacionImagenes(); + + request.getModifiedData().put("file", fileH); + request.getModifiedData().put("logocode",companyController.getRecord()!=null?companyController.getRecord().getLogo()!= null?companyController.getRecord().getLogo():null:null); + request.getModifiedData().put("pk_personcode", companyController.getRecord()!=null?companyController.getRecord().getPk()!=null?companyController.getRecord().getPk().getPersoncode():null:null); + request.getModifiedData().put("PHONES", this.phonesController.getLrecord()); + + Response resp = this.callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.companyController.postCommit(resp); + this.addressController.postCommit(resp); + this.phonesController.postCommit(resp); + this.personcode = String.valueOf(resp.get("personcode")); + super.addFilter("pk.personcode", this.personcode); + isDisableSave = Boolean.TRUE; + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para guardar informacion de las imagenes en la base de datos + * @throws IOException + */ + private void guardarInformacionImagenes() throws IOException{ + FileHelper archivoPicture = new FileHelper(); + archivoPicture.setName(""); + fileH = new ArrayList(); + + if(selectedPicture!=null){ + long size = selectedPicture.getSize(); + InputStream stream = selectedPicture.getInputstream(); + byte[] buffer = new byte[(int) size]; + stream.read(buffer, 0, (int) size); + stream.close(); + archivoPicture.setContentType(selectedPicture.getContentType()); + archivoPicture.setExtension(extensionFoto); + archivoPicture.setImage(buffer); + archivoPicture.setName(selectedPicture.getFileName()); + archivoPicture.setSize(selectedPicture.getFileName().length()); + } + + fileH.add(archivoPicture); + + } + + /** + * Método que abre el lov de activudad económica + */ + public void openActivityLov() { + Map> params = new HashMap<>(); + ActivityLovController.openLov(params); + } + + @Override + public void forcedQuery() throws Exception { + Field f[] = this.getClass().getDeclaredFields(); + //super.forcedQuery(f, this); + super.forcedQuery(); + } + + /** + * Método para cargar datos en el editar + */ + public void loadEdit(){ + if(this.record.getTaxexempt()!=null) + { + this.exentoImpuesto = this.record.getTaxexempt().equals("Y")?true:false; + } + } + + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeTaxexempt(){ + if(this.exentoImpuesto){ + this.record.setTaxexempt("Y"); + }else{ + this.record.setTaxexempt("N"); + } + } + + + /** + * Verifica el ingreso de una actividad económica + * + * @param person + * Objeto TcustPersonDetail + * @param people + * Objeto TcustPeople + * @return result V/F + */ + private boolean activity(TcustPersonDetail person, TcustPeople people) { + boolean result = false; + if (((person.getActivitycode() == null) || person.getActivitycode() + .equals("")) + && ((people.getNotactivitycatalog() == null) || people + .getNotactivitycatalog().equals(""))) { + result = true; + } + return result; + } + + /** + * Ejecuta el evento change del combo actividad no económica + */ + public void onChangeNotactivity() { + this.getRecord().setActivitycode(null); + this.getRecord().put("activitydesc", null); + this.getRecord().put("segmenttypecatalog", null); + this.getRecord().put("segmentdesc", null); + } + + /** + * Método para abrir el lov de personas + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + List juridical = new ArrayList(); + juridical.add("RUC"); + params.put("isJuridical", juridical); + JuridicalPersonLovController.openLov(params); + } + + /** + * Método para abrir el lov de personas + */ + public void openPersonLovComplete() { + Map> params = new HashMap<>(); + + PersonLovController.openLov(params); + } + + + /** + * Método para abrir el lov de Instituciones Finacieras + */ + public void openInstitucionTypeLov() { + Map> params = new HashMap<>(); + // InstitutionTypeLovController.openLov(params); + } + + public void onReturnInstitucionTypeLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + this.companyController.getRecord().getModifiedData().put("institutiontypedesc", t.getDescription()); + this.companyController.getRecord().setInstitutiontypecatalog(t.getPk().getCatalog()); + this.companyController.getRecord().setInstitutiontypecatalogcode(t.getPk().getCatalogcode()); + + } + + + + /** + * Retorna los valores del lov + * + * @param event + * Evento ajax + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + super.addFilter("pk.personcode", t.getPk().getPersoncode().toString()); + super.addField("personname", t.getName()); + super.query(); + } + + /** + * Controla la respuesta del lov de activudad económica + * + * @param event + * @throws Exception + */ + public void onReturnActivityLov(SelectEvent event) throws Exception { + + + TgeneActivity t = (TgeneActivity) event.getObject(); + + super.addField("activitydesc", t.getDescription()); + this.getRecord().setActivitycode(t.getPk()); + this.getRecord().modifiedData.put("activitydesc", + t.getDescription()); + this.getRecord().modifiedData.put("segmenttypecatalog", + t.getSegmenttypecatalog()); + this.getRecord().modifiedData.put("segmentdesc", + t.get("segmentdesc")); + } + + public void onChangeId() { + if (this.getRecord().getIdentificationcatalog() + .compareTo("CED") == 0) { + this.lengthId = "10"; + this.activeRegEx = false; + } else if (this.getRecord().getIdentificationcatalog() + .compareTo("RUC") == 0) { + this.lengthId = "13"; + this.activeRegEx = false; + } else if (this.getRecord().getIdentificationcatalog() + .compareTo("PAS") == 0) { + this.lengthId = "13"; + this.activeRegEx = true; + } + } + + public String onFlowProcess(FlowEvent event) { + + System.out.println("WIZARD NEW "+event.getNewStep()); + System.out.println("WIZARD OLD "+event.getNewStep()); + if(this.getRecord().getActivitycode()==null){ + MessageHelper.setMessageError("msg_requireActivity"); + return event.getOldStep(); + } + return event.getNewStep(); + } + + + public String workingdate() { + String dateString = null; + try { + Date date = TgeneAccountingDateBranchController.find( + this.getLoginController().getRequest().getCompany()) + .getWorkingdate(); + dateString = (new SimpleDateFormat( + MsgGeneral.getProperty("dateformat")).format(date)); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + return dateString; + } + + /** + * Metodo que carga la foto + */ + @SuppressWarnings("unused") + public void uploadPicture(FileUploadEvent event){ + try { + selectedPicture = event.getFile(); + + InputStream is=new ByteArrayInputStream(selectedPicture.getContents()); + //this.foto=new DefaultStreamedContent(is, selectedPicture.getContentType(), selectedPicture.getFileName()); + this.foto=new DefaultStreamedContent(event.getFile().getInputstream()); + this.fotoCargada=true; + + //Obteniendo la extension de la imagen + String extension=""; + int pos=-1; + for (int i = selectedPicture.getFileName().length()-1; i>=0; i--) { + if(selectedPicture.getFileName().toCharArray()[i]=='.'){ + pos=i; + break; + } + } + if(pos!=-1){ + extension=selectedPicture.getFileName().substring(pos+1, selectedPicture.getFileName().length()); + } + + //Almacenando la imagen temporalmente +/* ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); + ServletContext servletContext = (ServletContext) externalContext.getContext(); + String tempUrl = "/resources/images/temp/"; + String imageName=UUID.randomUUID().toString(); + String imageUrl=servletContext.getRealPath(tempUrl)+File.separator+imageName+"."+extension; + File outputfile = new File(imageUrl); + InputStream input=new ByteArrayInputStream(selectedPicture.getContents()); + BufferedImage image=ImageIO.read(input); + Boolean saved=ImageIO.write(image, extension, outputfile); + + this.rutaFoto="/resources/images/temp/"+imageName+"."+extension;*/ + + //Almacenando la imagen temporalmente + ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); + ServletContext servletContext = (ServletContext) externalContext.getContext(); + + String tempUrl = servletContext.getRealPath("/");; + String imageName=UUID.randomUUID().toString(); + imageUrl=tempUrl + "resources/images/" + imageName +"."+extensionFoto; + imageUrl = imageUrl.replace("\\", "/"); + File outputfile = new File(imageUrl); + InputStream input=new ByteArrayInputStream(selectedPicture.getContents()); + BufferedImage image=ImageIO.read(input); + Boolean saved=ImageIO.write(image, extensionFoto, outputfile); + this.rutaFoto="/resources/images/"+imageName+"."+extensionFoto; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Entrega lista de objetos TgeneCatalogDetail tipo de identificación + * + * @return lidentification Lista de objetos TgeneCatalogDetail + */ + public List getLidentification() { + return this.lidentification; + } + + /** + * Fija lista de objetos TgeneCatalogDetail tipo de identificación + * + * @param lidentification + * Lista de objetos TgeneCatalogDetail + */ + public void setLidentification(List lidentification) { + this.lidentification = lidentification; + } + + /** + * Entrega Verdadero/Falso + * + * @return activeNotEconomic V/F + */ + public boolean isActiveRegEx() { + return this.activeRegEx; + } + + /** + * Fija Verdadero/Falso + * + * @param activeNotEconomic + * V/F + */ + public void setActiveRegEx(boolean activeRegEx) { + this.activeRegEx = activeRegEx; + } + + /** + * Entrega el número de digitos para el tipo de identificaci&oacuye;n + * + * @return lengthId Número de digitos + */ + public String getLengthId() { + return this.lengthId; + } + + /** + * Fija el número de digitos para el tipo de identificaci&oacuye;n + * + * @param lengthId + * Número de digitos + */ + public void setLengthId(String lengthId) { + this.lengthId = lengthId; + } + + /** + * Entrega lista de objetos TgeneCatalogDetail de sector económico + * + * @return leconomicsector Lista de objetos TgeneCatalogDetail + */ + public List getLeconomicsector() { + return this.leconomicsector; + } + + /** + * Fija lista de objetos TgeneCatalogDetail de sector económico + * + * @param leconomicsector + * Lista de objetos TgeneCatalogDetail + */ + public void setLeconomicsector(List leconomicsector) { + this.leconomicsector = leconomicsector; + } + + /** + * Entrega lista de objetos TgeneCatalogDetail de tipo cliente + * + * @return ltypeclient Lista de objetos TgeneCatalogDetail + */ + public List getLtypeclient() { + return this.ltypeclient; + } + + /** + * Fija lista de objetos TgeneCatalogDetail de tipo cliente + * + * @param ltypeclient + * Lista de objetos TgeneCatalogDetail + */ + public void setLtypeclient(List ltypeclient) { + this.ltypeclient = ltypeclient; + } + + /** + * Entrega lista de objetos TgeneCatalogDetail + * + * @return lnotactivity Lista de objetos TgeneCatalogDetail + */ + public List getLnotactivity() { + return this.lnotactivity; + } + + /** + * Fija lista de objetos TgeneCatalogDetail + * + * @param lnotactivity + * Lista de objetos TgeneCatalogDetail + */ + public void setLnotactivity(List lnotactivity) { + this.lnotactivity = lnotactivity; + } + + /** + * Entrega la lista de géneros + * + * @return lgender Lista de géneros + */ + public List getLgender() { + return this.lgender; + } + + /** + * Fija la lista de géneros + * + * @param lgender + * Lista de géneros + */ + public void setLgender(List lgender) { + this.lgender = lgender; + } + + public List getLlenguage() { + return llenguage; + } + + public void setLlenguage(List llenguage) { + this.llenguage = llenguage; + } + + public Boolean getExistingperson() { + return existingperson; + } + + public void setExistingperson(Boolean existingperson) { + this.existingperson = existingperson; + } + /** + * @return the personcode + */ + public String getPersoncode() { + return personcode; + } + + /** + * @param personcode the personcode to set + */ + public void setPersoncode(String personcode) { + this.personcode = personcode; + } + + /** + * @return the exentoImpuesto + */ + public boolean isExentoImpuesto() { + return exentoImpuesto; + } + + /** + * @param exentoImpuesto the exentoImpuesto to set + */ + public void setExentoImpuesto(boolean exentoImpuesto) { + this.exentoImpuesto = exentoImpuesto; + } + + public PeopleFastController getPeopleFastController() { + return peopleFastController; + } + + public void setPeopleFastController(PeopleFastController peopleFastController) { + this.peopleFastController = peopleFastController; + } + + public UploadedFile getSelectedPicture() { + return selectedPicture; + } + + public void setSelectedPicture(UploadedFile selectedPicture) { + this.selectedPicture = selectedPicture; + } + + public Boolean getFotoCargada() { + return fotoCargada; + } + + public void setFotoCargada(Boolean fotoCargada) { + this.fotoCargada = fotoCargada; + } + + public StreamedContent getFoto() { + return foto; + } + + public void setFoto(StreamedContent foto) { + this.foto = foto; + } + + public String getRutaFoto() { + return rutaFoto; + } + + public void setRutaFoto(String rutaFoto) { + this.rutaFoto = rutaFoto; + } + + public CompanyController getCompanyController() { + return companyController; + } + + public void setCompanyController(CompanyController companyController) { + this.companyController = companyController; + } + + public PersonAddressController getAddressController() { + return addressController; + } + + public void setAddressController(PersonAddressController addressController) { + this.addressController = addressController; + } + + public PersonPhoneController getPhonesController() { + return phonesController; + } + + public void setPhonesController(PersonPhoneController phonesController) { + this.phonesController = phonesController; + } + + public FileDetailController getFileDetail() { + return fileDetail; + } + + public void setFileDetail(FileDetailController fileDetail) { + this.fileDetail = fileDetail; + } + + public TsafeUserDetail getUsuario() { + return usuario; + } + + public void setUsuario(TsafeUserDetail usuario) { + this.usuario = usuario; + } + + public String getImageUrl() { + return imageUrl; + } + + public void setImageUrl(String imageUrl) { + this.imageUrl = imageUrl; + } + + public Boolean getIsDisableSave() { + return isDisableSave; + } + + public void setIsDisableSave(Boolean isDisableSave) { + this.isDisableSave = isDisableSave; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/PeopleController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/PeopleController.java.svn-base new file mode 100644 index 0000000..dd4ec32 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/PeopleController.java.svn-base @@ -0,0 +1,169 @@ +package com.fp.frontend.controller.pcustomer; + +import java.util.ArrayList; +import java.util.HashMap; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.people.TcustPeople; + +/** + * Clase controladora del bean TcustPeople. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class PeopleController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private String personcode; + + public PeopleController() throws Exception { + super(TcustPeople.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + super.create(); + beanalias = "TCUSTPEOPLE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Agrega un par´metro para la conulta + * + * @param personcode Código de persona + */ + public void addPersoncodeFilter(String personcode) { + this.personcode = personcode; + super.addFilter("pk.personcode", personcode); + record.getPk().setPersoncode(Integer.parseInt(personcode)); + } + + /** + * Método para armar la consulta + * + * @return dto Objeto DtoQuery + * @throws Exception + */ + public DtoQuery getDtoQuery() throws Exception { + super.addFilterDateto(); + DtoQuery dto = super.getDtoQuery(false); + + // subqueries + // SubQuery subquery = new SubQuery("TgeneChannels", "description", "chanelname", "i.pk = t.channelcode"); + // dto.addSubQuery(subquery); + return dto; + } + + @Override + protected void querydatabase() { + try { + Request request = callerhelper.getRequest(); + super.addFilterDateto(); + DtoQuery dto = this.getDtoQuery(); + + SubQuery subqueryprof = new SubQuery("TgeneCatalogDetail", "description", "nprofesion", + "i.pk.catalogcode = 'PROFESSION' and i.pk.catalog = t.professioncatalog"); + dto.addSubQuery(subqueryprof); + + SubQuery subqueryestciv = new SubQuery("TgeneCatalogDetail", "description", "nestcivil", + "i.pk.catalogcode = 'MARITALSTATUS' and i.pk.catalog = t.maritalstatuscatalog"); + dto.addSubQuery(subqueryestciv); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + this.manageResponsePeople(resp); + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Controla la respuesta de la consulta + * + * @param resp Objeto Response + * @throws Exception + */ + public void manageResponsePeople(Response resp) throws Exception { + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + record = null; + MessageHelper.setMessageError(resp); + return; + } else { + record = (TcustPeople) resp.get(beanalias); + if (record == null) { + super.create(); + record.getPk().setPersoncode(Integer.parseInt(personcode)); + } + } + if (record.getGender() != null && record.getGender().equals("M")) { + record.modifiedData.put("ngenero", "MASCULINO"); + } else if (record.getGender() != null && record.getGender().equals("F")) { + record.modifiedData.put("ngenero", "FEMENINO"); + } + + super.postQuery(record); + } + + @Override + public void save() { + try { + Request request = callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/PeopleFastController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/PeopleFastController.java.svn-base new file mode 100644 index 0000000..864328e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/PeopleFastController.java.svn-base @@ -0,0 +1,1020 @@ +package com.fp.frontend.controller.pcustomer; + +import java.awt.image.BufferedImage; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.ExternalContext; +import javax.faces.context.FacesContext; +import javax.imageio.ImageIO; +import javax.servlet.ServletContext; + +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.SelectEvent; +import org.primefaces.model.DefaultStreamedContent; +import org.primefaces.model.StreamedContent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.helper.FileHelper; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.lov.ActivityLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pcustomer.gene.TgeneActivity; +import com.fp.persistence.pcustomer.people.TcustPeople; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TsafeUserDetail. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class PeopleFastController extends AbstractController { + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController persondetail; + + @ManagedProperty(value = "#{peopleController}") + private PeopleController people; + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController address; + + @ManagedProperty(value = "#{personPhoneController}") + private PersonPhoneController phones; + + @ManagedProperty(value = "#{fileDetailController}") + private FileDetailController fileDetail; + + private List direccionesEliminadas=new ArrayList(); + private List telefonosEliminados=new ArrayList(); + private List profesionList = new ArrayList(); + private List estadocivilList = new ArrayList(); + private List militarygrades; + + /** + * Id de profesion + */ + private String idProfesion; + + /** + * Estado civil + */ + private String idEstadoCivil; + + private String imageUrl; + + + + public PeopleFastController() throws Exception { + super(AbstractDataTransport.class); + } + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de identificacion + */ + private List lidentification; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de tipo de cliente + */ + private List ltypeclient; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de sector económico + */ + private List leconomicsector; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de actividad no económica + */ + private List lnotactivity; + + /** + * Atributo para el listado de géneros + */ + private List lgender; + + /** + * Atributo para activar el keyFilter + */ + private boolean activeRegEx; + + /** + * Atributo para la longitud de la identificación + */ + private String lengthId; + + /** + * atributo para el código de persona + */ + private String personcode; + + private boolean flagHabilita; + + /** + * Atributo para la firma digital + */ + UploadedFile selectedSign; + Boolean firmaCargada=false; + StreamedContent firma; + String rutaFirma; + TsafeUserDetail usuario; + + UploadedFile selectedPicture; + Boolean fotoCargada=false; + StreamedContent foto; + String rutaFoto; + String extensionFoto = "jpg"; + String extensionFirma = "jpg"; + List fileH = new ArrayList(); + + @PostConstruct + private void postconstruct() { + + this.lengthId = "10"; + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + // LLenamos Listas + this.lidentification = CatalogDetailController.find("IDENTIFICATION", "1"); + this.leconomicsector = CatalogDetailController.find("ECONOMICSECTOR"); + this.ltypeclient = CatalogDetailController.find("PERSONTYPE"); + this.lnotactivity = CatalogDetailController.find("NOTACTIVITY"); + this.estadocivilList = CatalogDetailController.find("MARITALSTATUS"); + this.profesionList = CatalogDetailController.find("PROFESSION"); + this.militarygrades=CatalogDetailController.find("MILITARYGRADE"); + this.lgender = CatalogDetailController.getListGender(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.personcode = null; + this.lrecord = new ArrayList<>(); + this.beanalias = "PEOPLEFAST"; + + //Obteniendo los datos del usuario logueado + this.usuario=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("static-access") + @Override + protected void querydatabase() { + try { + + if ((super.getFieldvalue("pk.personcode") == null) || super.getFieldvalue("pk.personcode").equals("")) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + this.personcode = String.valueOf(super.getFieldvalue("pk.personcode")); + + //Request request = this.callerhelper.getRequest(); + + this.persondetail.addPersoncodeFilter(this.personcode); + this.persondetail.query(); + + this.people.addPersoncodeFilter(this.personcode); + this.people.query(); + + //Cargando la firma y la foto + if(people.getRecord()!=null){ + if(super.getFieldvalue("personname")!=null){ + people.getRecord().setFirstname(super.getFieldvalue("personname").toString()); + } + //Firma + if(people.getRecord().getSignaturecode()!=null){ + TgeneFilesDetail fileDetalle = fileDetail.find(String.valueOf(people.getRecord().getSignaturecode())); + extensionFirma = fileDetalle!=null?fileDetalle.getExtension():extensionFirma; + + if(fileDetalle!= null && fileDetalle.getImage()!=null){ + InputStream input=new ByteArrayInputStream(fileDetalle.getImage()); + this.firma=new DefaultStreamedContent(input); + this.firmaCargada=true; + + //Almacenando la imagen temporalmente + ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); + ServletContext servletContext = (ServletContext) externalContext.getContext(); + + String tempUrl = servletContext.getRealPath("/");; + String imageName=UUID.randomUUID().toString(); + imageUrl=tempUrl + "resources/images/" + imageName +"."+extensionFirma; + imageUrl = imageUrl.replace("\\", "/"); + File outputfile = new File(imageUrl); + BufferedImage image=ImageIO.read(input); + ImageIO.write(image, extensionFirma, outputfile); + + this.rutaFirma="/resources/images/"+imageName+"."+extensionFirma; + }else{ + this.firma=null; + imageUrl=null; + this.rutaFirma=null; + this.firmaCargada=false; + } + }else{ + this.firma=null; + imageUrl=null; + this.rutaFirma=null; + this.firmaCargada=false; + } + //Foto + if(people.getRecord().getPhotocode()!=null){ + TgeneFilesDetail fileDetalle = fileDetail.find(String.valueOf(people.getRecord().getPhotocode())); + extensionFoto = fileDetalle!=null?fileDetalle.getExtension():extensionFoto; + + if(fileDetalle!=null && fileDetalle.getImage()!=null){ + InputStream input=new ByteArrayInputStream(fileDetalle.getImage()); + this.foto=new DefaultStreamedContent(input); + this.fotoCargada=true; + + //Almacenando la imagen temporalmente + ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); + ServletContext servletContext = (ServletContext) externalContext.getContext(); + + String tempUrl = servletContext.getRealPath("/");; + String imageName=UUID.randomUUID().toString(); + imageUrl=tempUrl + "resources/images/" + imageName +"."+extensionFoto; + imageUrl = imageUrl.replace("\\", "/"); + File outputfile = new File(imageUrl); + BufferedImage image=ImageIO.read(input); + ImageIO.write(image, extensionFoto, outputfile); + this.rutaFoto="/resources/images/"+imageName+"."+extensionFoto; + }else{ + this.foto=null; + imageUrl=null; + this.rutaFoto=null; + this.fotoCargada=false; + } + }else{ + this.foto=null; + imageUrl=null; + this.rutaFoto=null; + this.fotoCargada=false; + } + } + + + + this.address.addPersoncodeFilter(this.personcode); + this.address.addFilterDateto(); + this.address.query(); + + this.phones.addPersoncodeFilter(this.personcode); + this.phones.addFilterDateto(); + this.phones.query(); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + if(this.persondetail.getRecord().getPk() == null || this.persondetail.getRecord().getPk().getPersoncode() == null){ + TcustPersonDetail per=PersonDetailController.findByIdentification(this.persondetail.getRecord().getIdentification()); + if(per != null && per.getIdentification()!=null){ + MessageHelper.setMessageError("CDULA YA REGISTRADA"); + return; + } + } + if ((this.personcode != null) && !this.personcode.equals("")) { + request.put("personcode", this.personcode); + request.put("identification", this.persondetail.getRecord().getIdentification()); + // this.reqAddressPhone(); + } else { + if (this.address.getLrecord().size() == 0) { + MessageHelper.setMessageError("msg_requireAddress"); + return; + } + if (this.phones.getLrecord().size() == 0) { + MessageHelper.setMessageError("msg_requirePhones"); + return; + } + } + + //Asignando la foto + if(this.selectedPicture!=null){ + this.persondetail.getRecord().setPicture(this.selectedPicture.getContents()); + request.getModifiedData().put("EXTENSION", this.extensionFoto); + request.getModifiedData().put("NAME", this.selectedPicture.getFileName()); + } + + if(this.persondetail.getRecord().getMilitarygrade()!=null){ + this.persondetail.getRecord().setMilitarygradecode("MILITARYGRADE"); + } + + //Asignando la firma + if(this.selectedSign!=null){ + this.persondetail.getRecord().setSign(this.selectedSign.getContents()); + } + + // Preparamos los objetos a ser enviados + this.persondetail.update(); + this.people.update(); + + // Definimos los formularios + DtoSave dtoSavePerson = this.persondetail.getDtoSave(true); + DtoSave dtoSavePeople = this.people.getDtoSave(true); + DtoSave dtoSaveAddress = this.address.getDtoSave(true); + DtoSave dtoSavePhone = this.phones.getDtoSave(true); + + // Verificamos y agregamos al request + if (dtoSavePeople.pendingProcess()) { + this.persondetail.getRecord().setName(this.people.getRecord().getFirstname()); + // this.people.getRecord().getLastname()); + //+ " " + this.people.getRecord().getSurename() + " " + // + this.people.getRecord().getFirstname() + " " + this.people.getRecord().getMiddlename() + dtoSavePerson = this.persondetail.getDtoSave(true); + msave.put(this.people.getBeanalias(), dtoSavePeople); + } + if (dtoSavePerson.pendingProcess()) { + msave.put(this.persondetail.getBeanalias(), dtoSavePerson); + } + if (dtoSaveAddress.pendingProcess()) { + msave.put(this.address.getBeanalias(), dtoSaveAddress); + } + if (dtoSavePhone.pendingProcess()) { + msave.put(this.phones.getBeanalias(), dtoSavePhone); + } + + request.setSaveTables(msave); + + request.getModifiedData().put("DETALLESPERSONA", persondetail.getRecord()); + request.getModifiedData().put("DIRECCIONESELIMINADAS",this.direccionesEliminadas); + request.getModifiedData().put("TELEFONOSELIMINADOS", this.telefonosEliminados); + + + request.getModifiedData().put("USUARIO", this.usuario); + + guardarInformacionImagenes(); + + request.getModifiedData().put("file", fileH); + request.getModifiedData().put("photocode",people.getRecord()!=null?people.getRecord().getPhotocode():null); + request.getModifiedData().put("signaturecode", people.getRecord()!=null?people.getRecord().getSignaturecode():null); + request.getModifiedData().put("pk_personcode", people.getRecord()!=null?people.getRecord().getPk().getPersoncode():null); + + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.people.postCommit(resp); + this.persondetail.postCommit(resp); + this.address.postCommit(resp); + this.phones.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para guardar informacion de las imagenes en la base de datos + * @throws IOException + */ + private void guardarInformacionImagenes() throws IOException{ + FileHelper archivoPicture = new FileHelper(); + archivoPicture.setName(""); + + fileH = new ArrayList(); + + if(selectedPicture!=null){ + long size = selectedPicture.getSize(); + InputStream stream = selectedPicture.getInputstream(); + byte[] buffer = new byte[(int) size]; + stream.read(buffer, 0, (int) size); + stream.close(); + archivoPicture.setContentType(selectedPicture.getContentType()); + archivoPicture.setExtension(extensionFoto); + archivoPicture.setImage(buffer); + archivoPicture.setName(selectedPicture.getFileName()); + archivoPicture.setSize(selectedPicture.getFileName().length()); + } + fileH.add(archivoPicture); + + + FileHelper archivoFirma = new FileHelper(); + archivoFirma.setName(""); + + if(selectedSign!=null){ + long sizeFirma = selectedSign.getSize(); + InputStream streamFirma = selectedSign.getInputstream(); + byte[] bufferFirma = new byte[(int) sizeFirma]; + streamFirma.read(bufferFirma, 0, (int) sizeFirma); + streamFirma.close(); + archivoFirma.setContentType(selectedSign.getContentType()); + archivoFirma.setExtension(extensionFirma); + archivoFirma.setImage(bufferFirma); + archivoFirma.setName(selectedSign.getFileName()); + archivoFirma.setSize(selectedSign.getFileName().length()); + } + fileH.add(archivoFirma); + } + + + @Override + public void postCommit(Response response) throws Exception { + this.persondetail.postCommit(response); + } + + /** + * Elimina una direccion + */ + public void removeAddress(TcustPersonAddress direccion){ + try { + this.direccionesEliminadas.add(direccion); + //this.address.setRecord(direccion); + //this.address.getRecord().getPk().setDateto(new Timestamp(Calendar.getInstance().getTimeInMillis())); + //this.address.update(); + this.address.remove(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Elimina una telefono + */ + public void removePhone(TcustPersonPhone telefono){ + try { + this.telefonosEliminados.add(telefono); + this.phones.remove(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Verifica los valores requeridos + * + * @throws Exception + */ + public void reqAddressPhone() throws Exception { + if (this.activity(this.persondetail.getRecord(), this.people.getRecord())) { + MessageHelper.setMessageError("msg_requireActivity"); + return; + } + if (!this.address.getDtoSave().pendingProcess()) { + MessageHelper.setMessageError("msg_requireAddress"); + return; + } + if (!this.phones.getDtoSave().pendingProcess()) { + MessageHelper.setMessageError("msg_requirePhones"); + return; + } + } + + /** + * Verifica el ingreso de una actividad económica + * + * @param person Objeto TcustPersonDetail + * @param people Objeto TcustPeople + * @return result V/F + */ + private boolean activity(TcustPersonDetail person, TcustPeople people) { + boolean result = false; + if (((person.getActivitycode() == null) || person.getActivitycode().equals("")) + && ((people.getNotactivitycatalog() == null) || people.getNotactivitycatalog().equals(""))) { + result = true; + } + return result; + } + + /** + * Ejecuta el evento change del combo actividad no económica + */ + public void onChangeNotactivity() { + this.people.getRecord().setNotactivitycatalogcode("NOTACTIVITY"); + this.persondetail.getRecord().setActivitycode(null); + this.persondetail.getRecord().put("activitydesc", null); + this.persondetail.getRecord().put("segmenttypecatalog", null); + this.persondetail.getRecord().put("segmentdesc", null); + } + + public String getImageUrl() { + return imageUrl; + } + + public void setImageUrl(String imageUrl) { + this.imageUrl = imageUrl; + } + + public String getIdProfesion() { + return idProfesion; + } + + public void setIdProfesion(String idProfesion) { + this.idProfesion = idProfesion; + } + + /** + * Método para abrir el lov de personas + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + List natural = new ArrayList(); + natural.add("CED"); + params.put("natural", natural); + PersonLovController.openLov(params); + } + + /** + * Retorna los valores del lov + * + * @param event Evento ajax + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + super.addField("pk.personcode", t.getPk().getPersoncode().toString()); + super.addField("personname", t.getName()); + super.query(); + } + + /** + * Método que abre el lov de activudad económica + */ + public void openActivityLov() { + Map> params = new HashMap<>(); + ActivityLovController.openLov(params); + } + + /** + * Controla la respuesta del lov de activudad económica + * + * @param event + * @throws Exception + */ + public void onReturnActivityLov(SelectEvent event) throws Exception { + TgeneActivity t = (TgeneActivity) event.getObject(); + this.people.getRecord().setNotactivitycatalog(null); + this.people.getRecord().setNotactivitycatalogcode(null); + this.persondetail.getRecord().setActivitycode(t.getPk()); + this.persondetail.getRecord().modifiedData.put("activitydesc", t.getDescription()); + this.persondetail.getRecord().modifiedData.put("segmenttypecatalog", t.getSegmenttypecatalog()); + this.persondetail.getRecord().modifiedData.put("segmentdesc", t.get("segmentdesc")); + } + + public void onChangeId() { + if (this.persondetail.getRecord().getIdentificationcatalog().compareTo("CED") == 0) { + this.lengthId = "10"; + this.activeRegEx = false; + } else if (this.persondetail.getRecord().getIdentificationcatalog().compareTo("RUC") == 0) { + this.lengthId = "13"; + this.activeRegEx = false; + } else if (this.persondetail.getRecord().getIdentificationcatalog().compareTo("PAS") == 0) { + this.lengthId = "13"; + this.activeRegEx = true; + } + } + + /** + * Metodo que carga la firma digital + */ + public void uploadSign(FileUploadEvent event){ + try { + selectedSign = event.getFile(); + + InputStream is=new ByteArrayInputStream(selectedSign.getContents()); + this.firma=new DefaultStreamedContent(is, selectedSign.getContentType(), selectedSign.getFileName()); + this.firmaCargada=true; + + + + //Obteniendo la extension de la imagen + extensionFirma=""; + int pos=-1; + for (int i = selectedSign.getFileName().length()-1; i>=0; i--) { + if(selectedSign.getFileName().toCharArray()[i]=='.'){ + pos=i; + break; + } + } + if(pos!=-1){ + extensionFirma=selectedSign.getFileName().substring(pos+1, selectedSign.getFileName().length()); + } + + //Almacenando la imagen temporalmente + ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); + ServletContext servletContext = (ServletContext) externalContext.getContext(); + String tempUrl = servletContext.getRealPath("/"); + String imageName=UUID.randomUUID().toString(); + //String imageUrl=servletContext.getRealPath(tempUrl)+File.separator+imageName+"."+extension; + imageUrl=tempUrl + "resources/images/" + imageName +"."+extensionFirma; + imageUrl = imageUrl.replace("\\", "/"); + File outputfile = new File(imageUrl); + InputStream input=new ByteArrayInputStream(selectedSign.getContents()); + BufferedImage image=ImageIO.read(input); + ImageIO.write(image, extensionFirma, outputfile); + + this.rutaFirma="/resources/images/"+imageName+"."+extensionFirma; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que carga la foto + */ + @SuppressWarnings("unused") + public void uploadPicture(FileUploadEvent event){ + try { + selectedPicture = event.getFile(); + + InputStream is=new ByteArrayInputStream(selectedPicture.getContents()); + this.foto=new DefaultStreamedContent(is, selectedPicture.getContentType(), selectedPicture.getFileName()); + this.fotoCargada=true; + + +/* long size = selectedPicture.getSize(); + InputStream stream = selectedPicture.getInputstream(); + byte[] buffer = new byte[(int) size]; + stream.read(buffer, 0, (int) size); + stream.close();*/ + + //Obteniendo la extension de la imagen + this.extensionFoto=""; + int pos=-1; + for (int i = selectedPicture.getFileName().length()-1; i>=0; i--) { + if(selectedPicture.getFileName().toCharArray()[i]=='.'){ + pos=i; + break; + } + } + if(pos!=-1){ + extensionFoto=selectedPicture.getFileName().substring(pos+1, selectedPicture.getFileName().length()); + } + + //Almacenando la imagen temporalmente + ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); + ServletContext servletContext = (ServletContext) externalContext.getContext(); + + String tempUrl = servletContext.getRealPath("/");; + String imageName=UUID.randomUUID().toString(); + imageUrl=tempUrl + "resources/images/" + imageName +"."+extensionFoto; + imageUrl = imageUrl.replace("\\", "/"); + File outputfile = new File(imageUrl); + InputStream input=new ByteArrayInputStream(selectedPicture.getContents()); + BufferedImage image=ImageIO.read(input); + Boolean saved=ImageIO.write(image, extensionFoto, outputfile); + + this.rutaFoto="/resources/images/"+imageName+"."+extensionFoto; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + e.printStackTrace(); + } + } + + /** + * Entrega el valor de: persondetail + * + * @return PersonDetailController + */ + public PersonDetailController getPersondetail() { + return this.persondetail; + } + + /** + * Fija el valor de: persondetail + * + * @param persondetail Valor a fijar en el atributo. + */ + public void setPersondetail(PersonDetailController persondetail) { + this.persondetail = persondetail; + } + + /** + * Entrega el valor de: persondetail + * + * @return PersonDetailController + */ + public PeopleController getPeople() { + return this.people; + } + + /** + * Fija el valor de: persondetail + * + * @param people Valor a fijar en el atributo. + */ + public void setPeople(PeopleController people) { + this.people = people; + } + + /** + * Entrega el valor de: address + * + * @return PersonAddressController + */ + public PersonAddressController getAddress() { + return this.address; + } + + /** + * Fija el valor de: address + * + * @param PersonAddressController + */ + public void setAddress(PersonAddressController address) { + this.address = address; + } + + /** + * Entrega el valor de: phones + * + * @return PersonPhoneController + */ + public PersonPhoneController getPhones() { + return this.phones; + } + + /** + * Fija el valor de: phones + * + * @param PersonPhoneController + */ + public void setPhones(PersonPhoneController phones) { + this.phones = phones; + } + + /** + * Entrega lista de objetos TgeneCatalogDetail tipo de identificación + * + * @return lidentification Lista de objetos TgeneCatalogDetail + */ + public List getLidentification() { + return this.lidentification; + } + + /** + * Fija lista de objetos TgeneCatalogDetail tipo de identificación + * + * @param lidentification Lista de objetos TgeneCatalogDetail + */ + public void setLidentification(List lidentification) { + this.lidentification = lidentification; + } + + /** + * Entrega Verdadero/Falso + * + * @return activeNotEconomic V/F + */ + public boolean isActiveRegEx() { + return this.activeRegEx; + } + + /** + * Fija Verdadero/Falso + * + * @param activeNotEconomic V/F + */ + public void setActiveRegEx(boolean activeRegEx) { + this.activeRegEx = activeRegEx; + } + + /** + * Entrega el número de digitos para el tipo de identificaci&oacuye;n + * + * @return lengthId Número de digitos + */ + public String getLengthId() { + return this.lengthId; + } + + /** + * Fija el número de digitos para el tipo de identificaci&oacuye;n + * + * @param lengthId Número de digitos + */ + public void setLengthId(String lengthId) { + this.lengthId = lengthId; + } + + /** + * Entrega lista de objetos TgeneCatalogDetail de sector económico + * + * @return leconomicsector Lista de objetos TgeneCatalogDetail + */ + public List getLeconomicsector() { + return this.leconomicsector; + } + + /** + * Fija lista de objetos TgeneCatalogDetail de sector económico + * + * @param leconomicsector Lista de objetos TgeneCatalogDetail + */ + public void setLeconomicsector(List leconomicsector) { + this.leconomicsector = leconomicsector; + } + + /** + * Entrega lista de objetos TgeneCatalogDetail de tipo cliente + * + * @return ltypeclient Lista de objetos TgeneCatalogDetail + */ + public List getLtypeclient() { + return this.ltypeclient; + } + + /** + * Fija lista de objetos TgeneCatalogDetail de tipo cliente + * + * @param ltypeclient Lista de objetos TgeneCatalogDetail + */ + public void setLtypeclient(List ltypeclient) { + this.ltypeclient = ltypeclient; + } + + /** + * Entrega lista de objetos TgeneCatalogDetail + * + * @return lnotactivity Lista de objetos TgeneCatalogDetail + */ + public List getLnotactivity() { + return this.lnotactivity; + } + + /** + * Fija lista de objetos TgeneCatalogDetail + * + * @param lnotactivity Lista de objetos TgeneCatalogDetail + */ + public void setLnotactivity(List lnotactivity) { + this.lnotactivity = lnotactivity; + } + + /** + * Entrega la lista de géneros + * + * @return lgender Lista de géneros + */ + public List getLgender() { + return this.lgender; + } + + /** + * Fija la lista de géneros + * + * @param lgender Lista de géneros + */ + public void setLgender(List lgender) { + this.lgender = lgender; + } + + public Boolean getFirmaCargada() { + return firmaCargada; + } + + public void setFirmaCargada(Boolean firmaCargada) { + this.firmaCargada = firmaCargada; + } + + public UploadedFile getSelectedSign() { + return selectedSign; + } + + public void setSelectedSign(UploadedFile selectedSign) { + this.selectedSign = selectedSign; + } + + public UploadedFile getSelectedPicture() { + return selectedPicture; + } + + public void setSelectedPicture(UploadedFile selectedPicture) { + this.selectedPicture = selectedPicture; + } + + public Boolean getFotoCargada() { + return fotoCargada; + } + + public void setFotoCargada(Boolean fotoCargada) { + this.fotoCargada = fotoCargada; + } + + public StreamedContent getFirma() throws IOException { + if(selectedSign!=null){ + FacesContext.getCurrentInstance().getExternalContext().getMimeType(selectedSign.getContentType()); + return new DefaultStreamedContent(selectedSign.getInputstream(), "image/png"); + } + return null; + } + + public void setFirma(StreamedContent firma) { + this.firma = firma; + } + + public StreamedContent getFoto() throws IOException { + if(selectedPicture!=null){ + FacesContext.getCurrentInstance().getExternalContext().getMimeType(selectedPicture.getContentType()); + return new DefaultStreamedContent(selectedPicture.getInputstream(), "image/png"); + } + return null; + + } + + public void setFoto(StreamedContent foto) { + this.foto = foto; + } + + public String getRutaFoto() { + return rutaFoto; + } + + public void setRutaFoto(String rutaFoto) { + this.rutaFoto = rutaFoto; + } + + public String getRutaFirma() { + return rutaFirma; + } + + public void setRutaFirma(String rutaFirma) { + this.rutaFirma = rutaFirma; + } + + public List getProfesionList() { + return profesionList; + } + + public void setProfesionList(List profesionList) { + this.profesionList = profesionList; + } + + public List getEstadocivilList() { + return estadocivilList; + } + + public String getIdEstadoCivil() { + return idEstadoCivil; + } + + public void setIdEstadoCivil(String idEstadoCivil) { + this.idEstadoCivil = idEstadoCivil; + } + + + + public void setEstadocivilList(List estadocivilList) { + this.estadocivilList = estadocivilList; + } + + public FileDetailController getFileDetail() { + return fileDetail; + } + + public void setFileDetail(FileDetailController fileDetail) { + this.fileDetail = fileDetail; + } + + public List getMilitarygrades() { + return militarygrades; + } + + public void setMilitarygrades(List militarygrades) { + this.militarygrades = militarygrades; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/PersonAddressController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/PersonAddressController.java.svn-base new file mode 100644 index 0000000..753fe47 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/PersonAddressController.java.svn-base @@ -0,0 +1,702 @@ +package com.fp.frontend.controller.pcustomer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.common.helper.Constant; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.company.TcustCompany; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonAddressKey; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Clase controladora del bean TcustPersonAddress. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class PersonAddressController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public PersonAddressController() throws Exception { + super(TcustPersonAddress.class); + } + + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List laddresstype; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List lcountries; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lprovinces; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcantones; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lparroquias; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcities; + + /** + * Atributo para el control de checkBox de principal + */ + private boolean principal; + + /** + * Atributo para el código de persona + */ + private Integer personcode; + + private boolean typeaddress; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + laddresstype = CatalogDetailController.find("ADDRESSTYPE"); + lcountries = CountryController.find(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + record = new TcustPersonAddress(); + record.setPk(new TcustPersonAddressKey()); + beanalias = "TCUSTPERSONADDRESS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Agrega un par´metro para la conulta + * + * @param personcode Código de persona + */ + public void addPersoncodeFilter(String personcode) { + this.personcode = new Integer(personcode); + super.addFilter("pk.personcode", personcode); + } + + /** + * Método para armar la consulta + * + * @return dto Objeto DtoQuery + * @throws Exception + */ + public DtoQuery getDtoQuery() throws Exception { + super.addFilterDateto(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.addressnumber"); // En en string van todos los campos de + // orden ("t.pk, t.nombre, t.cpais"). + // subqueries + SubQuery subquery = new SubQuery("TgeneCatalogDetail", "description", "addresstype", + "i.pk.catalogcode = t.addresstypecatalogcode and i.pk.catalog = t.addresstypecatalog"); + dto.addSubQuery(subquery); + + SubQuery subqueryProvincia = new SubQuery("TgeneProvince", "description", "provincia", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode"); + dto.addSubQuery(subqueryProvincia); + + SubQuery subqueryCanton = new SubQuery("TgeneCanton", "description", "canton", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode and i.pk.cantoncode=t.cantoncode"); + dto.addSubQuery(subqueryCanton); + + SubQuery subqueryCiudad = new SubQuery("TgeneCity", "description", "ciudad", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode and i.pk.cantoncode=t.cantoncode and i.pk.citycode=t.citycode"); + dto.addSubQuery(subqueryCiudad); + + SubQuery subqueryParroquia = new SubQuery("TgeneParroquia", "description", "parroquia", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode and i.pk.cantoncode=t.cantoncode and i.pk.parroquiacode=t.parroquiacode"); + dto.addSubQuery(subqueryParroquia); + + return dto; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + super.addFilterDateto(); + + //Cargando el tipo de direccion + SubQuery subQueryTipoDireccion= new SubQuery("TgeneCatalogDetail","description", + "addresstype","i.pk.catalog=t.addresstypecatalog and i.pk.catalogcode=t.addresstypecatalogcode"); + dto.addSubQuery(subQueryTipoDireccion); + + SubQuery subqueryProvincia = new SubQuery("TgeneProvince", "description", "provincia", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode"); + dto.addSubQuery(subqueryProvincia); + + SubQuery subqueryCanton = new SubQuery("TgeneCanton", "description", "canton", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode and i.pk.cantoncode=t.cantoncode"); + dto.addSubQuery(subqueryCanton); + + SubQuery subqueryCiudad = new SubQuery("TgeneCity", "description", "ciudad", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode and i.pk.cantoncode=t.cantoncode and i.pk.citycode=t.citycode"); + dto.addSubQuery(subqueryCiudad); + + SubQuery subqueryParroquia = new SubQuery("TgeneParroquia", "description", "parroquia", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode and i.pk.cantoncode=t.cantoncode and i.pk.parroquiacode=t.parroquiacode"); + dto.addSubQuery(subqueryParroquia); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(lrecord!=null && !lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaseAll() { + try { + DtoQuery dto = super.getDtoQuery(true); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Controla la respuesta de la consulta + * + * @param resp Objeto Response + * @throws Exception + */ + @SuppressWarnings("unchecked") + public void manageResponseAddress(Response resp) throws Exception { + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery((List) resp.get(beanalias)); + } + } + + @Override + public void save() { + try { + Request request = callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public TcustPersonAddress findPersonaPorDireccionTipoCatalogo(String codigopersona, String direcciontipoCatalogo) { + try { + PersonAddressController cc = new PersonAddressController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.personcode", codigopersona); + cc.addFilter("addresstypecatalog", direcciontipoCatalogo); + cc.addFilterDateto(); + cc.querydatabaseAll(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + record = cc.lrecord.get(0); + lprovinces = ProvinceController.findPorCodigo(record.getCountrycode(),record.getProvincecode()); + lcantones = CantonController.findPorCodigo(record.getCountrycode(),record.getProvincecode(),record.getCantoncode()); + lcities = CityController.findPorCodigo(record.getCountrycode(),record.getProvincecode(),record.getCantoncode(),record.getCitycode()); + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + return record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public TcustPersonAddress findByPersonCode(String codigopersona,String codigoCorreo) { + try { + PersonAddressController cc = new PersonAddressController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.personcode", codigopersona); + cc.addFilter("addresstypecatalog", codigoCorreo); + cc.addFilterDateto(); + cc.querydatabaseAll(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + record = cc.lrecord.get(0); + lprovinces = ProvinceController.findPorCodigo(record.getCountrycode(),record.getProvincecode()); + lcantones = CantonController.findPorCodigo(record.getCountrycode(),record.getProvincecode(),record.getCantoncode()); + lcities = CityController.findPorCodigo(record.getCountrycode(),record.getProvincecode(),record.getCantoncode(),record.getCitycode()); + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + return record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Obtiene todas las direcciones de una persona + * @param codigopersona + * @return + */ + public static List findAllByPersonCode(String codigopersona) { + try { + PersonAddressController cc = new PersonAddressController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.personcode", codigopersona); + cc.addFilter("pk.dateto", "2999-12-31"); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + /** + * Metodo que retorna la direccion que sea diferente a la del mail + * @param codigopersona + * @param direcciontipoCatalogo + * @return + */ + public static TcustPersonAddress findDifAMail(String codigopersona, String direcciontipoCatalogo) { + try { + PersonAddressController cc = new PersonAddressController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.personcode", codigopersona); + cc.addFilter("addresstypecatalog", "!="+direcciontipoCatalogo); + cc.querydatabaseAll(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Retorna la dirección marcada como principal + * @param codigoPersona + * @return + */ + public TcustPersonAddress findPrincipal(String codigoPersona) { + try { + PersonAddressController cc = new PersonAddressController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.personcode", codigoPersona); + cc.addFilter("principal", Constant.STR_Y); + cc.addFilterDateto(); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + return null; + } + + /** + * Retorna la dirección marcada como principal + * @param codigoPersona + * @return + */ + public static TcustPersonAddress find(String codigoPersona) { + try { + PersonAddressController cc = new PersonAddressController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.personcode", codigoPersona); + cc.addFilter("principal", Constant.STR_Y); + cc.addFilterDateto(); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + return null; + } + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Método para el evento change del combo países + */ + public void executeCountry() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lprovinces = ProvinceController.find(record.getCountrycode()); + lcantones = new ArrayList<>(); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + lcities = CityController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + } + } + + + /** + * Método para cargar datos en el editar + */ + public void loadEdit() { + this.onChangeType(); + principal = ((record.getPrincipal() != null) && record.getPrincipal().equals("Y") ? true : false); + lprovinces = ProvinceController.find(record.getCountrycode()); + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + lcities = CityController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + } + + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangePrincipal() { + if (principal) { + record.setPrincipal("Y"); + } else { + record.setPrincipal("N"); + } + } + + @Override + public void update() { + try { + +// record.getPk().setPersoncode(((personcode == null) || personcode.equals(0)) ? null : personcode); + /* + if ((personcode == null) || (personcode == 0)) { + record.getPk().setAddressnumber(this.getMaxNumber()); + } + if(record.isnew){ + record.getPk().setAddressnumber(this.getMaxNumber()); + } + */ + record.setAddresstypecatalogcode("ADDRESSTYPE"); + for (TgeneCatalogDetail detail : laddresstype) { + if (detail.getPk().getCatalog().equals(record.getAddresstypecatalog())) { + record.modifiedData.put("addresstype", detail.getDescription()); + } + } + super.update(); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método que obtiene el max de direcciones + * + * @return max Número max + */ + private Integer getMaxNumber() { + Integer max = 0; + if (lrecord.size() > 0) { + for (TcustPersonAddress address : lrecord) { + if (max.compareTo(address.getPk().getAddressnumber()) < 0) { + max = address.getPk().getAddressnumber(); + } + } + } + return max + 1; + } + + /** + * Método para manejar el evento change en el combo tipod e dirección + */ + public void onChangeType() { + if (record.getAddresstypecatalog().compareTo("3") == 0) { + typeaddress = true; + } else { + typeaddress = false; + } + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail tipo de direcciones + * + * @return laddresstype Lista de objetos TgeneCatalogDetail tipo de direcciones + */ + public List getLaddresstype() { + return laddresstype; + } + + /** + * Fija una lista de objetos TgeneCatalogDetail tipo de direcciones + * + * @param laddresstype Lista de objetos TgeneCatalogDetail tipo de direcciones + */ + public void setLaddresstype(List laddresstype) { + this.laddresstype = laddresstype; + } + + /** + * Entrega una lista de objetos TgeneCountry países + * + * @return lcountries Lista de objetos TgeneCountry + */ + public List getLcountries() { + return lcountries; + } + + /** + * Fija una lista de objetos TgeneCountry países + * + * @param lcountries Lista de objetos TgeneCountry + */ + public void setLcountries(List lcountries) { + this.lcountries = lcountries; + } + + /** + * Entrega una lista de objetos TgeneProvince provincias + * + * @return lprovinces Lista de objetos TgeneProvince + */ + public List getLprovinces() { + return lprovinces; + } + + /** + * Fija una lista de objetos TgeneProvince provincias + * + * @param lprovinces Lista de objetos TgeneProvince + */ + public void setLprovinces(List lprovinces) { + this.lprovinces = lprovinces; + } + + /** + * Entrega una lista de objetos TgeneCanton cantones + * + * @return lcantones Lista de objetos TgeneCanton + */ + public List getLcantones() { + return lcantones; + } + + /** + * Fija una lista de objetos TgeneCanton cantones + * + * @param lcantones Lista de objetos TgeneCanton + */ + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + /** + * Entrega una lista de objetos TgeneParroquia parroquias + * + * @return lparroquias Lista de objetos TgeneParroquia + */ + public List getLparroquias() { + return lparroquias; + } + + /** + * Fija una lista de objetos TgeneParroquia parroquias + * + * @param lparroquias Lista de objetos TgeneParroquia + */ + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + /** + * Entrega una lista de objetos TgeneCity ciudades + * + * @return lcities Lista de objetos TgeneCity + */ + public List getLcities() { + return lcities; + } + + /** + * Fija una lista de objetos TgeneCity ciudades + * + * @param lcities Lista de objetos TgeneCity + */ + public void setLcities(List lcities) { + this.lcities = lcities; + } + + /** + * Entrega Verdadero o Falso + * + * @return principal V/F + */ + public boolean isPrincipal() { + return principal; + } + + /** + * Fija Verdadero o Falso + * + * @param principal V/F + */ + public void setPrincipal(boolean principal) { + this.principal = principal; + } + + /** + * Entrega el código de persona + * + * @return personcode Código de persona + */ + public Integer getPersoncode() { + return personcode; + } + + /** + * Fija el código de persona + * + * @param personcode Código de persona + */ + public void setPersoncode(Integer personcode) { + this.personcode = personcode; + } + + /** + * Entrega Verdadero o Falso + * + * @return typeaddress V/F + */ + public boolean isTypeaddress() { + return typeaddress; + } + + /** + * Fija Verdadero o Falso + * + * @param typeaddress V/F + */ + public void setTypeaddress(boolean typeaddress) { + this.typeaddress = typeaddress; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/PersonDetailController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/PersonDetailController.java.svn-base new file mode 100644 index 0000000..237c66f --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/PersonDetailController.java.svn-base @@ -0,0 +1,259 @@ +package com.fp.frontend.controller.pcustomer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; + +/** + * Clase controladora del bean TcustPersonDetail. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class PersonDetailController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public PersonDetailController() throws Exception { + super(TcustPersonDetail.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + super.create(); + beanalias = "TCUSTPERSONDETAIL"; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Agrega un par´metro para la conulta + * + * @param personcode Código de persona + */ + public void addPersoncodeFilter(String personcode) { + super.addFilter("pk.personcode", personcode); + record.getPk().setPersoncode(Integer.parseInt(personcode)); + } + + /** + * Método para procesar la consulta + * + * @return dto Objeto DtoQuery + * @throws Exception + */ + public DtoQuery getDtoQuery() throws Exception { + super.addFilterDateto(); + + DtoQuery dto = super.getDtoQuery(false); + + // subqueries + SubQuery subquery = new SubQuery("TgeneActivity", "description", "activitydesc", "i.pk = t.activitycode"); + dto.addSubQuery(subquery); + + SubQuery subquery1 = new SubQuery("TgeneActivity", "segmenttypecatalog", "segmenttypecatalog", "i.pk = t.activitycode"); + dto.addSubQuery(subquery1); + + SubQuery subquery2 = new SubQuery("TgeneCatalogDetail", "description", "segmentdesc", + "i.pk.catalogcode = 'SEGMENTTYPE' and i.pk.catalog = (select a.segmenttypecatalog from TgeneActivity a where a.pk = t.activitycode)"); + dto.addSubQuery(subquery2); + + SubQuery subqueryTipoIdentificacion= new SubQuery + ("TgeneCatalogDetail", "description", "destipoidentificacion", "i.pk.catalog = t.identificationcatalog and i.pk.catalogcode=t.identificationcatalogcode"); + dto.addSubQuery(subqueryTipoIdentificacion); + return dto; + } + + @Override + protected void querydatabase() { + try { + Request request = callerhelper.getRequest(); + + DtoQuery dto = this.getDtoQuery(); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + this.manageResponsePerson(resp); + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaseAll() { + try { + DtoQuery dto = super.getDtoQuery(true); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + SubQuery subqueryTipoIdentificacion= new SubQuery + ("TgeneCatalogDetail", "description", "destipoidentificacion", "i.pk.catalog = t.identificationcatalog and i.pk.catalogcode=t.identificationcatalogcode"); + dto.addSubQuery(subqueryTipoIdentificacion); + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Controla la respuesta de la consulta + * + * @param resp Objeto Response + * @throws Exception + */ + public void manageResponsePerson(Response resp) throws Exception { + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + record = null; + MessageHelper.setMessageError(resp); + } else { + record = (TcustPersonDetail) resp.get(beanalias); + super.postQuery((AbstractDataTransport) resp.get(beanalias)); + } + } + + @Override + public void save() { + try { + Request request = callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + public static TcustPersonDetail find(String codigopersona) { + try { + PersonDetailController cc = new PersonDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.personcode", codigopersona); + cc.addFilterDateto(); + cc.querydatabaseAll(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Autor Andres Cevallos + * @param identificacion + * @param tipoidentificacion + * @return + * Find para encontrar una persona por su identificacion y tipo de identificacion + */ + public static TcustPersonDetail findxidentification(String identificacion, String tipoidentificacion) { + try { + PersonDetailController cc = new PersonDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("identification",identificacion); + cc.addFilter("identificationcatalog",tipoidentificacion); + cc.addFilterDateto(); + cc.querydatabaseAll(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + /** + * @param identificacion + * @param tipoidentificacion + * @return + * Find para encontrar una persona por su identificacion + */ + public static TcustPersonDetail findByIdentification(String identificacion) { + try { + PersonDetailController cc = new PersonDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("identification",identificacion); + cc.addFilterDateto(); + cc.querydatabaseAll(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/PersonPhoneController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/PersonPhoneController.java.svn-base new file mode 100644 index 0000000..e880dc7 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/PersonPhoneController.java.svn-base @@ -0,0 +1,300 @@ +package com.fp.frontend.controller.pcustomer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.company.TcustCompany; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pcustomer.gene.TcustPersonPhoneKey; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TcustPersonPhone. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class PersonPhoneController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public PersonPhoneController() throws Exception { + super(TcustPersonPhone.class); + } + + /** + * Atributo para la lista de objetos TgeneCatalogDetail para tipo de teléfono + */ + private List lphonetype; + + /** + * Atributo para el código de persona + */ + private Integer personcode; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + this.lphonetype = CatalogDetailController.find("PHONETYPE"); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.record = new TcustPersonPhone(); + this.record.setPk(new TcustPersonPhoneKey()); + this.beanalias = "TCUSTPERSONPHONE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Agrega el código de persona para la consulta + * @param personcode código de persona + */ + public void addPersoncodeFilter(String personcode){ + this.personcode = new Integer(personcode); + super.addFilter("pk.personcode", personcode); + } + + /** + * Método para armar la consulta + * @return dto Objeto DtoQuery + * @throws Exception + */ + public DtoQuery getDtoQuery() throws Exception{ + super.addFilterDateto(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.phonesequence"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + // subqueries + SubQuery subquery = new SubQuery("TgeneCatalogDetail", "description", "phonetype", + "i.pk.catalogcode = t.phonetypecatalogcode and i.pk.catalog = t.phonetypecatalog"); + dto.addSubQuery(subquery); + return dto; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + + //Cargando el tipo de telefono + SubQuery subQueryTipoTelefono= new SubQuery("TgeneCatalogDetail","description", + "phonetype","i.pk.catalog=t.phonetypecatalog and i.pk.catalogcode=t.phonetypecatalogcode"); + dto.addSubQuery(subQueryTipoTelefono); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(lrecord!=null && !lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Controla la respuesta de la consulta + * @param resp Objeto Response + * @throws Exception + */ + @SuppressWarnings("unchecked") + public void manageResponsePhones(Response resp) throws Exception { + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void update(){ + try{ +// this.record.getPk().setPersoncode(((this.personcode==null) || this.personcode.equals(0))?null:this.personcode); + if((this.personcode==null) || (this.personcode==0)){ + // this.record.getPk().setPhonesequence(this.getMaxNumber()); + } + this.record.setPhonetypecatalogcode("PHONETYPE"); + for(TgeneCatalogDetail detail: this.lphonetype){ + if(detail.getPk().getCatalog().equals(this.record.getPhonetypecatalog())){ + this.record.modifiedData.put("phonetype", detail.getDescription()); + } + } + super.update(); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Método que obtiene el max de direcciones + * @return max Número max + */ + private Integer getMaxNumber(){ + Integer max = 0; + if(this.lrecord.size() > 0){ + for(TcustPersonPhone phone: this.lrecord){ + if(max.compareTo(phone.getPk().getPhonesequence()) < 0 ){ + max = phone.getPk().getPhonesequence(); + } + } + } + return max+1; + } + + /** + * Actualiza el registro + */ + public void actualizar(){ + try { + super.update(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public static TcustPersonPhone find(String codigopersona,String codigoTelFijo) { + try { + PersonPhoneController cc = new PersonPhoneController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.personcode", codigopersona); + cc.addFilter("phonetypecatalog", codigoTelFijo); + cc.addFilterDateto(); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Obtiene todos los telefonos de una persona + * @param codigopersona + * @return + */ + public static List findAllByPersonCode(String codigopersona) { + try { + PersonPhoneController cc = new PersonPhoneController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.personcode", codigopersona); + cc.addFilter("pk.dateto", "2999-12-31"); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail tipo de teléfono + * @return lphonetype Lista de objetos TgeneCatalogDetail tipo de teléfono + */ + public List getLphonetype() { + return this.lphonetype; + } + + /** + * Fija una lista de objetos TgeneCatalogDetail tipo de teléfono + * @param lphonetype Lista de objetos TgeneCatalogDetail tipo de teléfono + */ + public void setLphonetype(List lphonetype) { + this.lphonetype = lphonetype; + } + + /** + * Entrega el código de persona + * @return personcode Código de persona + */ + public Integer getPersoncode() { + return this.personcode; + } + + /** + * Fija el código de persona + * @param personcode Código de persona + */ + public void setPersoncode(Integer personcode) { + this.personcode = personcode; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/PersonViewController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/PersonViewController.java.svn-base new file mode 100644 index 0000000..2a1df1b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/PersonViewController.java.svn-base @@ -0,0 +1,321 @@ +package com.fp.frontend.controller.pcustomer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmGroups; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TsafeUserDetail. + * + * @author Andres E. Carpio + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class PersonViewController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public PersonViewController() throws Exception { + super(TcustPersonDetail.class); + } + + @ManagedProperty(value = "#{peopleController}") + private PeopleController people; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de identificacion + */ + private List lidentification; + + /** + * Atributo para el listado de géneros + */ + private List lgender; + + /** + * Atributo para activar el keyFilter + */ + private boolean activeRegEx; + /** + * Atributo para la longitud de la identificación + */ + private String lengthId; + + @PostConstruct + private void postconstruct() { + this.lengthId = "10"; + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //List + this.lidentification = CatalogDetailController.find("IDENTIFICATION", "1"); + this.lgender = CatalogDetailController.getListGender(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.create(); + this.lrecord = new ArrayList<>(); + this.beanalias = "TCUSTPERSONDETAIL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if(super.getMfilters().get("sbsemployee")==null){ + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + super.addFilterDateto(); + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(false); + dto.setOrderby("t.pk.personcode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.create(); + //this.record = new TcustPersonDetail(); + MessageHelper.setMessageError(resp); + } else { + this.record = (TcustPersonDetail) resp.get(this.beanalias); + if(this.record!=null){ + this.people.addPersoncodeFilter(this.record.getPk().getPersoncode().toString()); + this.people.query(); + }else{ + this.create(); + } + super.postQuery(this.record); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + this.update(); + this.people.update(); + + DtoSave dtoSave = super.getDtoSave(true); + DtoSave dtoSavePeople = this.people.getDtoSave(true); + + HashMap msave = new HashMap(); + + if(dtoSave.pendingProcess()){ + msave.put(this.beanalias, dtoSave); + } + + if (dtoSavePeople.pendingProcess()) { + msave.put(this.people.getBeanalias(), dtoSavePeople); + } + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.people.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Cambio del ID + */ + public void onChangeId() { + if (this.record.getIdentificationcatalog().compareTo("CED") == 0) { + this.lengthId = "10"; + this.activeRegEx = false; + } else if (this.record.getIdentificationcatalog().compareTo("PAS") == 0) { + this.lengthId = "13"; + this.activeRegEx = true; + } + } + + /** + * Abre el lob de empleados sbs + */ + public void openPersonViewLov() { + Map> params = new HashMap<>(); + PersonViewLovController.openLov(params); + } + + /** + * Maneja la respuesta del lov de empleados sbs + * @param event + * @throws Exception + */ + public void onReturnPersonViewLov(SelectEvent event) throws Exception { + Object[] t = (Object[]) event.getObject(); + super.addFilter("sbsemployee", (String)t[0]); + super.addField("personname", (String)t[2] +" "+(String)t[1]); + this.querydatabase(); + + if(this.record.getPk().getPersoncode()==null){ + this.record.setName((String)t[2] +" "+(String)t[1]); + this.record.setIdentification((String)t[4]); + this.record.setSbsemployee((String)t[0]); + this.record.setSbsusercode((String)t[3]); + this.record.setIdentificationcatalogcode("IDENTIFICATION"); + this.people.getRecord().setFirstname(this.getName((String)t[2], true));; + this.people.getRecord().setMiddlename(this.getName((String)t[2], false)); + this.people.getRecord().setLastname(this.getName((String)t[1], true)); + this.people.getRecord().setSurename(this.getName((String)t[1], false)); + } + + } + + /** + * Arma el nombre del funcionario + * @param firstname nombre + * @param first v/f + * @return name + */ + public String getName(String firstname, boolean first){ + String[] value = firstname.split(" "); + String name = ""; + for(int i=0; i0 && !first){ + name = name+((name.length()==0)?"":" ")+value[i]; + } + } + return name; + } + + /** + * Entrega Verdadero/Falso + * + * @return activeNotEconomic V/F + */ + public boolean isActiveRegEx() { + return this.activeRegEx; + } + + /** + * Fija Verdadero/Falso + * + * @param activeNotEconomic V/F + */ + public void setActiveRegEx(boolean activeRegEx) { + this.activeRegEx = activeRegEx; + } + + /** + * Entrega el número de digitos para el tipo de identificaci&oacuye;n + * + * @return lengthId Número de digitos + */ + public String getLengthId() { + return this.lengthId; + } + + /** + * Fija el número de digitos para el tipo de identificaci&oacuye;n + * + * @param lengthId Número de digitos + */ + public void setLengthId(String lengthId) { + this.lengthId = lengthId; + } + + /** + * Entrega lista de objetos TgeneCatalogDetail tipo de identificación + * + * @return lidentification Lista de objetos TgeneCatalogDetail + */ + public List getLidentification() { + return this.lidentification; + } + + /** + * Fija lista de objetos TgeneCatalogDetail tipo de identificación + * + * @param lidentification Lista de objetos TgeneCatalogDetail + */ + public void setLidentification(List lidentification) { + this.lidentification = lidentification; + } + + /** + * Entrega la lista de géneros + * + * @return lgender Lista de géneros + */ + public List getLgender() { + return this.lgender; + } + + /** + * Fija la lista de géneros + * + * @param lgender Lista de géneros + */ + public void setLgender(List lgender) { + this.lgender = lgender; + } + + /** + * Entrega el valor de: persondetail + * + * @return PersonDetailController + */ + public PeopleController getPeople() { + return this.people; + } + + /** + * Fija el valor de: persondetail + * + * @param people Valor a fijar en el atributo. + */ + public void setPeople(PeopleController people) { + this.people = people; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/PersonViewLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/PersonViewLovController.java.svn-base new file mode 100644 index 0000000..eb49b64 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/.svn/text-base/PersonViewLovController.java.svn-base @@ -0,0 +1,152 @@ +package com.fp.frontend.controller.pcustomer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; + +/** + * Clase controladora del bean TsafeUserDetail. + * + * @author Andres E. Carpio + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class PersonViewLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public PersonViewLovController() throws Exception { + super(AbstractDataTransport.class); + } + + /** + * Atributo para la lista de empleados sbs + */ + private List lemployee; + + /** + *Atributo para el objeto empleado seleccionado + */ + private Object[] employee; + + /** + * Post construct + * @throws Exception + */ + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "EMPLOYEESBS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + request.put("querytype", "P"); + request.put("queryalias", "EMPLOYEESBS"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lemployee = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + this.lemployee = (List) resp.get(this.beanalias); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setEmployee() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.employee); + } + + + public static void openLov(Map> params) { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + // lovpersona es el nombre de la pagina + RequestContext.getCurrentInstance().openDialog("/pages/customer/lov/personViewLov.xhtml", options, params); + } + + /** + * Entrega una lista de arreglo de objetos + * @return lemployee + */ + public List getLemployee() { + return lemployee; + } + + /** + * Fija una lista de arreglo de objetos + * @param lemployee + */ + public void setLemployee(List lemployee) { + this.lemployee = lemployee; + } + + /** + * Entrega un objeto employee + * @return employee + */ + public Object[] getEmployee() { + return employee; + } + + /** + * FIna un objeto employee + * @param employee + */ + public void setEmployee(Object[] employee) { + this.employee = employee; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/CompanyController.java b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/CompanyController.java new file mode 100644 index 0000000..4344426 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/CompanyController.java @@ -0,0 +1,297 @@ +package com.fp.frontend.controller.pcustomer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.company.TcustCompany; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TcustCompany + * + * @author MAV. + * @version 1.0 + */ +@ManagedBean +@ViewScoped +public class CompanyController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private String personcode; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de tipo de empresa + * + */ + private List lbusinesstype; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de clases de empresa + */ + private List lbussinesclass; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de tipo de + * institucion + */ + private List linstitutiontype; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de estdo de + * operatividad + */ + private List loperativestatus; + + public CompanyController() throws Exception { + super(TcustCompany.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + this.lbusinesstype = CatalogDetailController.find("BUSINESSTYPE"); + this.lbussinesclass = CatalogDetailController.find("BUSINESSCLASS"); + this.linstitutiontype = CatalogDetailController.find("PERSONTYPE"); + this.loperativestatus = CatalogDetailController.find("OPERATIVESTATUS"); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + super.create(); + this.beanalias = "TCUSTCOMPANY"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Agrega un par´metro para la conulta + * + * @param personcode Código de company + */ + public void addPersoncodeFilter(String personcode) { + this.personcode = personcode; + super.addFilter("pk.personcode", personcode); + this.record.getPk().setPersoncode(Integer.parseInt(personcode)); + } + + /** + * Método para armar la consulta + * + * @return dto Objeto DtoQuery + * @throws Exception + */ + public DtoQuery getDtoQuery() throws Exception { + super.addFilterDateto(); + DtoQuery dto = super.getDtoQuery(false); + + SubQuery institutiontype = new SubQuery( + "TgeneCatalogDetail", + "description", + "institutiontypedesc", + "i.pk.catalog = t.institutiontypecatalog and i.pk.catalogcode= 'INSTITUTIONTYPE' "); + dto.addSubQuery(institutiontype); + + return dto; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (lrecord != null && !lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Controla la respuesta de la consulta + * + * @param resp Objeto Response + * @throws Exception + */ + public void manageResponseCompany(Response resp) throws Exception { + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.record = null; + MessageHelper.setMessageError(resp); + } else { + this.record = (TcustCompany) resp.get(this.beanalias); + if (this.record == null) { + super.create(); + this.record.getPk().setPersoncode( + Integer.parseInt(this.personcode)); + } + super.postQuery(this.record); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Busca una solicitud por su codigo + * + * @param codigoSolicitud + * @return + */ + public static TcustCompany findByPersonCode(String personCode) { + try { + CompanyController cc = new CompanyController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.personcode", personCode); + cc.addFilterDateto(); + cc.querydatabase(); + + if (cc.record != null) { + return cc.record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * @return the personcode + */ + public String getPersoncode() { + return personcode; + } + + /** + * @param personcode the personcode to set + */ + public void setPersoncode(String personcode) { + this.personcode = personcode; + } + + /** + * @return the lbusinesstype + */ + public List getLbusinesstype() { + return lbusinesstype; + } + + /** + * @param lbusinesstype the lbusinesstype to set + */ + public void setLbusinesstype(List lbusinesstype) { + this.lbusinesstype = lbusinesstype; + } + + /** + * @return the lbussinesclass + */ + public List getLbussinesclass() { + return lbussinesclass; + } + + /** + * @param lbussinesclass the lbussinesclass to set + */ + public void setLbussinesclass(List lbussinesclass) { + this.lbussinesclass = lbussinesclass; + } + + /** + * @return the linstitutiontype + */ + public List getLinstitutiontype() { + return linstitutiontype; + } + + /** + * @param linstitutiontype the linstitutiontype to set + */ + public void setLinstitutiontype(List linstitutiontype) { + this.linstitutiontype = linstitutiontype; + } + + /** + * @return the loperativestatus + */ + public List getLoperativestatus() { + return loperativestatus; + } + + /** + * @param loperativestatus the loperativestatus to set + */ + public void setLoperativestatus(List loperativestatus) { + this.loperativestatus = loperativestatus; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/FacturaController.java b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/FacturaController.java new file mode 100644 index 0000000..9c684c2 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/FacturaController.java @@ -0,0 +1,102 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package com.fp.frontend.controller.pcustomer; + + +import com.fp.frontend.controller.armas.solicitud.SolicitudController; +import com.fp.frontend.controller.armas.solicitud.SolicitudTramiteController; +import com.fp.frontend.controller.armas.solicitud.TarmTramiteController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.PersonPhoneController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; + +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.math.BigDecimal; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.SessionScoped; +import javax.faces.bean.ViewScoped; +import javax.faces.context.ExternalContext; +import javax.faces.context.FacesContext; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import javax.persistence.Query; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import com.fp.frontend.controller.AbstractController; +import com.fp.persistence.parmas.soli.TarmArmaPruebas; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import org.openide.util.Exceptions; +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/** + * + * @author developer2 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class FacturaController { + /** + * Controlador que maneja los datos de generacion ultima vez del reporte + */ + private static final long serialVersionUID = 8843091476010012919L; + + @ManagedProperty(value = "#{parametersController}") + private ParametersController parametersController; + + private TgeneParameters sequence; + private EntityManagerFactory emf; + + + @PostConstruct + public void postConstruct(){ + try { + this.parametersController = new ParametersController(); + //this.crearManager(); + } catch (Exception ex) { + Exceptions.printStackTrace(ex); + } + + } + + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/FileDetailController.java b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/FileDetailController.java new file mode 100644 index 0000000..6d52a3c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/FileDetailController.java @@ -0,0 +1,128 @@ +package com.fp.frontend.controller.pcustomer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.common.helper.Constant; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonAddressKey; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; + +/** + * Clase controladora del bean TcustPersonAddress. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class FileDetailController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public FileDetailController() throws Exception { + super(TgeneFilesDetail.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "FILEDETAIL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (lrecord != null && !lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para encontrar por codigo de imagen + * + * @param imagecode + * @return + */ + public static TgeneFilesDetail find(String imagecode) { + try { + if (imagecode == null) { + return null; + } + FileDetailController cc = new FileDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.code", imagecode); + cc.addFilterDateto(); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/JuridicalPersonController.java b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/JuridicalPersonController.java new file mode 100644 index 0000000..03bdd86 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/JuridicalPersonController.java @@ -0,0 +1,943 @@ +package com.fp.frontend.controller.pcustomer; + +import java.awt.image.BufferedImage; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Field; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.ExternalContext; +import javax.faces.context.FacesContext; +import javax.imageio.ImageIO; +import javax.servlet.ServletContext; + +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.FlowEvent; +import org.primefaces.event.SelectEvent; +import org.primefaces.model.DefaultStreamedContent; +import org.primefaces.model.StreamedContent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.helper.FileHelper; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.lov.JuridicalPersonLovController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.date.TgeneAccountingDateBranchController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.LanguageController; +import com.fp.frontend.controller.pgeneral.lov.ActivityLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgGeneral; +import com.fp.persistence.pcustomer.company.TcustCompany; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pcustomer.gene.TgeneActivity; +import com.fp.persistence.pcustomer.people.TcustPeople; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneLanguage; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de JuridicalPerson. + * + * @author MAV. + * @version 1.0 + */ +@ManagedBean +@ViewScoped +public class JuridicalPersonController extends AbstractController { + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{companyController}") + private CompanyController companyController; + + @ManagedProperty(value = "#{peopleFastController}") + private PeopleFastController peopleFastController; + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController addressController; + + @ManagedProperty(value = "#{personPhoneController}") + private PersonPhoneController phonesController; + + @ManagedProperty(value = "#{fileDetailController}") + private FileDetailController fileDetail; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de identificacion + */ + private List lidentification; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de tipo de cliente + */ + private List ltypeclient; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de sector + * económico + */ + private List leconomicsector; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de actividad no + * económica + */ + private List lnotactivity; + + /** + * Atributo para el listado de géneros + */ + private List lgender; + + /** + * Atributo para el listado de idiomas + */ + private List llenguage; + + /** + * Atributo para activar el keyFilter + */ + private boolean activeRegEx; + + /** + * Atributo para la longitud de la identificación + */ + private String lengthId; + + /** + * atributo para el código de persona + */ + private String personcode; + + private Boolean existingperson; + + /** + * Atributo para deshabilitar el boton save + */ + private Boolean isDisableSave = Boolean.FALSE; + + /** + * Atributo para el control de checkBox exencto de impuesto a la renta + */ + private boolean exentoImpuesto; + + /** + * Atributos relacionados con el logo + */ + UploadedFile selectedPicture; + Boolean fotoCargada = false; + StreamedContent foto; + String rutaFoto; + + private String extensionFoto = "jpg"; + + private String imageUrl; + + TsafeUserDetail usuario; + + List fileH = new ArrayList(); + + public JuridicalPersonController() throws Exception { + super(TcustPersonDetail.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + this.lengthId = "13"; + this.init(); + //super.buildTransactionPages("juridicalPersonController"); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.create(); + this.lrecord = new ArrayList<>(); + this.record = new TcustPersonDetail(); + this.record.setIsnew(true); + this.beanalias = "JURIDICALPERSONCONTROLLER"; + + this.companyController.create(); + this.companyController.setRecord(new TcustCompany()); + this.companyController.getRecord().setIsnew(true); + + this.addressController.create(); + this.addressController.setRecord(new TcustPersonAddress()); + this.addressController.getRecord().setIsnew(true); + + this.phonesController.create(); + this.phonesController.setRecord(new TcustPersonPhone()); + this.phonesController.getRecord().setIsnew(true); + + //Llenando las listas + this.lidentification = CatalogDetailController.find("IDENTIFICATION", "2"); + this.leconomicsector = CatalogDetailController.find("ECONOMICSECTOR"); + this.ltypeclient = CatalogDetailController.findClientType("CLIENTTYPE", "2"); + this.lnotactivity = CatalogDetailController.find("NOTACTIVITY"); + this.lgender = CatalogDetailController.getListGender(); + this.llenguage = LanguageController.find(); + this.getRecord().setLanguagecode("ES"); + + //Obteniendo los datos del usuario logueado + usuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + try { + if (super.getMfilters().get("pk.personcode") == null || super.getMfilters().get("pk.personcode").equals("null")) { + return; + } + super.addFilterDateto(); + + //Obteniendo la compannia + TcustCompany compannia = CompanyController.findByPersonCode(super.getMfilters().get("pk.personcode")); + if (compannia != null) { + this.companyController.setRecord(compannia); + } + + //Obteniendo las direcciones + List direcciones = PersonAddressController.findAllByPersonCode(this.getMfilters().get("pk.personcode")); + this.addressController.setLrecord(direcciones); + + //Obteniendo los telefonos + List telefonos = PersonPhoneController.findAllByPersonCode(this.getMfilters().get("pk.personcode")); + this.phonesController.setLrecord(telefonos); + + Request request = this.callerhelper.getRequest(); + + DtoQuery dto = super.getDtoQuery(false); + + // subqueries + SubQuery subquery = new SubQuery("TgeneActivity", "description", + "activitydesc", "i.pk = t.activitycode"); + dto.addSubQuery(subquery); + + SubQuery subquery1 = new SubQuery("TgeneActivity", + "segmenttypecatalog", "segmenttypecatalog", + "i.pk = t.activitycode"); + dto.addSubQuery(subquery1); + + SubQuery subquery2 = new SubQuery( + "TgeneCatalogDetail", + "description", + "segmentdesc", + "i.pk.catalogcode = 'SEGMENTTYPE' and i.pk.catalog = (select a.segmenttypecatalog from TgeneActivity a where a.pk = t.activitycode)"); + dto.addSubQuery(subquery2); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.record = new TcustPersonDetail(); + this.companyController.setRecord(new TcustCompany()); + MessageHelper.setMessageError(resp); + } else { + + if (resp.get(this.beanalias) != null) { + this.record = (TcustPersonDetail) resp.get(this.beanalias); + this.record.setIsnew(false); + } + + if (this.companyController.getRecord() == null) { + this.companyController.setRecord(new TcustCompany()); + this.companyController.getRecord().setIsnew(true); + } else //Cargando la imagen + if (this.companyController.getRecord() != null && this.companyController.getRecord().getLogo() != null) { + + TgeneFilesDetail fileDetalle = fileDetail.find((this.companyController == null || this.companyController.getRecord().getLogo() == null) ? null : String.valueOf(this.companyController.getRecord().getLogo())); + extensionFoto = fileDetalle != null ? fileDetalle.getExtension() : extensionFoto; + if (fileDetalle != null && fileDetalle.getImage() != null) { + InputStream input = new ByteArrayInputStream(fileDetalle.getImage()); + this.foto = new DefaultStreamedContent(input); + this.fotoCargada = true; + + //Almacenando la imagen temporalmente + ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); + ServletContext servletContext = (ServletContext) externalContext.getContext(); + String tempUrl = servletContext.getRealPath("/");; + String imageName = UUID.randomUUID().toString(); + String imageUrl = tempUrl + "resources/images/" + imageName + "." + extensionFoto; + imageUrl = imageUrl.replace("\\", "/"); + File outputfile = new File(imageUrl); + BufferedImage image = ImageIO.read(input); + Boolean saved = ImageIO.write(image, extensionFoto, outputfile); + + this.rutaFoto = "/resources/images/" + imageName + "." + extensionFoto; + } + } else { + this.fotoCargada = false; + } + } + + this.personcode = String.valueOf(this.getMfilters().get("pk.personcode")); + +// this.addressController.addPersoncodeFilter(this.personcode); +// this.addressController.addFilterDateto(); +// this.addressController.query(); + /* + this.phonesController.addPersoncodeFilter(this.personcode); + this.phonesController.addFilterDateto(); + this.phonesController.query();*/ + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + //Validando las direcciones y telefonos + if (this.addressController.getLrecord().size() == 0) { + MessageHelper.setMessageError("msg_requireAddress"); + return; + } else { + for (TcustPersonAddress direccion : this.addressController.getLrecord()) { + if (direccion.isnew) { + direccion.setIngressusercode(this.usuario.getPk().getUsercode()); + } else { + direccion.setModifyusercode(this.usuario.getPk().getUsercode()); + } + } + } + if (this.phonesController.getLrecord().size() == 0) { + MessageHelper.setMessageError("msg_requirePhones"); + return; + } else { + for (TcustPersonPhone telefono : this.phonesController.getLrecord()) { + if (telefono.isnew) { + telefono.setIngressusercode(this.usuario.getPk().getUsercode()); + } else { + telefono.setModifyusercode(this.usuario.getPk().getUsercode()); + } + } + } + + //Asignando los campos + this.record.setDatefrom(new Timestamp(Calendar.getInstance().getTimeInMillis())); + this.record.setIdentificationcatalogcode("IDENTIFICATION"); + if (this.record.isnew) { + this.record.setIngressuser(this.usuario.getPk().getUsercode()); + } else { + this.record.setModifyuser(this.usuario.getPk().getUsercode()); + } + + this.record.setPersontypecatalog("2"); + this.record.setPersontypecatalogcode("PERSONTYPE"); + this.record.setRegisterdate(new java.sql.Date(Calendar.getInstance().getTimeInMillis())); + this.record.setClienttypecatalogcode("CLIENTTYPE"); + this.record.setEconomicsectorcatalogcode("ECONOMICSECTOR"); + + if (this.selectedPicture != null) { + this.companyController.getRecord().setPicture(this.selectedPicture.getContents()); + } + + DtoSave dtosave = super.getDtoSave(true); + dtosave.setReturnpk(true); + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + dtosave.setPosition(3); + msave.put(this.beanalias, dtosave); + + // DIRECCIONES + DtoSave dtosaveAddress = addressController.getDtoSave(); + dtosaveAddress.setPosition(1); + msave.put(addressController.getBeanalias(), dtosaveAddress); + + // TELEFONOS + DtoSave dtosavePhone = phonesController.getDtoSave(); + dtosavePhone.setPosition(2); + msave.put(phonesController.getBeanalias(), dtosavePhone); + + request.setSaveTables(msave); + + request.getModifiedData().put("PERSON", this.record); + request.getModifiedData().put("COMPANY", this.companyController.getRecord()); + request.getModifiedData().put("ADDRESSES", this.addressController.getLrecord()); + + guardarInformacionImagenes(); + + request.getModifiedData().put("file", fileH); + request.getModifiedData().put("logocode", companyController.getRecord() != null ? companyController.getRecord().getLogo() != null ? companyController.getRecord().getLogo() : null : null); + request.getModifiedData().put("pk_personcode", companyController.getRecord() != null ? companyController.getRecord().getPk() != null ? companyController.getRecord().getPk().getPersoncode() : null : null); + request.getModifiedData().put("PHONES", this.phonesController.getLrecord()); + + Response resp = this.callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.companyController.postCommit(resp); + this.addressController.postCommit(resp); + this.phonesController.postCommit(resp); + this.personcode = String.valueOf(resp.get("personcode")); + super.addFilter("pk.personcode", this.personcode); + isDisableSave = Boolean.TRUE; + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para guardar informacion de las imagenes en la base de datos + * + * @throws IOException + */ + private void guardarInformacionImagenes() throws IOException { + FileHelper archivoPicture = new FileHelper(); + archivoPicture.setName(""); + fileH = new ArrayList(); + + if (selectedPicture != null) { + long size = selectedPicture.getSize(); + InputStream stream = selectedPicture.getInputstream(); + byte[] buffer = new byte[(int) size]; + stream.read(buffer, 0, (int) size); + stream.close(); + archivoPicture.setContentType(selectedPicture.getContentType()); + archivoPicture.setExtension(extensionFoto); + archivoPicture.setImage(buffer); + archivoPicture.setName(selectedPicture.getFileName()); + archivoPicture.setSize(selectedPicture.getFileName().length()); + } + + fileH.add(archivoPicture); + + } + + /** + * Método que abre el lov de activudad económica + */ + public void openActivityLov() { + Map> params = new HashMap<>(); + ActivityLovController.openLov(params); + } + + @Override + public void forcedQuery() throws Exception { + Field f[] = this.getClass().getDeclaredFields(); + //super.forcedQuery(f, this); + super.forcedQuery(); + } + + /** + * Método para cargar datos en el editar + */ + public void loadEdit() { + if (this.record.getTaxexempt() != null) { + this.exentoImpuesto = this.record.getTaxexempt().equals("Y") ? true : false; + } + } + + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangeTaxexempt() { + if (this.exentoImpuesto) { + this.record.setTaxexempt("Y"); + } else { + this.record.setTaxexempt("N"); + } + } + + /** + * Verifica el ingreso de una actividad económica + * + * @param person Objeto TcustPersonDetail + * @param people Objeto TcustPeople + * @return result V/F + */ + private boolean activity(TcustPersonDetail person, TcustPeople people) { + boolean result = false; + if (((person.getActivitycode() == null) || person.getActivitycode() + .equals("")) + && ((people.getNotactivitycatalog() == null) || people + .getNotactivitycatalog().equals(""))) { + result = true; + } + return result; + } + + /** + * Ejecuta el evento change del combo actividad no económica + */ + public void onChangeNotactivity() { + this.getRecord().setActivitycode(null); + this.getRecord().put("activitydesc", null); + this.getRecord().put("segmenttypecatalog", null); + this.getRecord().put("segmentdesc", null); + } + + /** + * Método para abrir el lov de personas + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + List juridical = new ArrayList(); + juridical.add("RUC"); + params.put("isJuridical", juridical); + JuridicalPersonLovController.openLov(params); + } + + /** + * Método para abrir el lov de personas + */ + public void openPersonLovComplete() { + Map> params = new HashMap<>(); + + PersonLovController.openLov(params); + } + + /** + * Método para abrir el lov de Instituciones Finacieras + */ + public void openInstitucionTypeLov() { + Map> params = new HashMap<>(); + // InstitutionTypeLovController.openLov(params); + } + + public void onReturnInstitucionTypeLov(SelectEvent event) throws Exception { + TgeneCatalogDetail t = (TgeneCatalogDetail) event.getObject(); + this.companyController.getRecord().getModifiedData().put("institutiontypedesc", t.getDescription()); + this.companyController.getRecord().setInstitutiontypecatalog(t.getPk().getCatalog()); + this.companyController.getRecord().setInstitutiontypecatalogcode(t.getPk().getCatalogcode()); + + } + + /** + * Retorna los valores del lov + * + * @param event Evento ajax + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + super.addFilter("pk.personcode", t.getPk().getPersoncode().toString()); + super.addField("personname", t.getName()); + super.query(); + } + + /** + * Controla la respuesta del lov de activudad económica + * + * @param event + * @throws Exception + */ + public void onReturnActivityLov(SelectEvent event) throws Exception { + + TgeneActivity t = (TgeneActivity) event.getObject(); + + super.addField("activitydesc", t.getDescription()); + this.getRecord().setActivitycode(t.getPk()); + this.getRecord().modifiedData.put("activitydesc", + t.getDescription()); + this.getRecord().modifiedData.put("segmenttypecatalog", + t.getSegmenttypecatalog()); + this.getRecord().modifiedData.put("segmentdesc", + t.get("segmentdesc")); + } + + public void onChangeId() { + if (this.getRecord().getIdentificationcatalog() + .compareTo("CED") == 0) { + this.lengthId = "10"; + this.activeRegEx = false; + } else if (this.getRecord().getIdentificationcatalog() + .compareTo("RUC") == 0) { + this.lengthId = "13"; + this.activeRegEx = false; + } else if (this.getRecord().getIdentificationcatalog() + .compareTo("PAS") == 0) { + this.lengthId = "13"; + this.activeRegEx = true; + } + } + + public String onFlowProcess(FlowEvent event) { + + System.out.println("WIZARD NEW " + event.getNewStep()); + System.out.println("WIZARD OLD " + event.getNewStep()); + if (this.getRecord().getActivitycode() == null) { + MessageHelper.setMessageError("msg_requireActivity"); + return event.getOldStep(); + } + return event.getNewStep(); + } + + public String workingdate() { + String dateString = null; + try { + Date date = TgeneAccountingDateBranchController.find( + this.getLoginController().getRequest().getCompany()) + .getWorkingdate(); + dateString = (new SimpleDateFormat( + MsgGeneral.getProperty("dateformat")).format(date)); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + return dateString; + } + + /** + * Metodo que carga la foto + */ + @SuppressWarnings("unused") + public void uploadPicture(FileUploadEvent event) { + try { + selectedPicture = event.getFile(); + + InputStream is = new ByteArrayInputStream(selectedPicture.getContents()); + //this.foto=new DefaultStreamedContent(is, selectedPicture.getContentType(), selectedPicture.getFileName()); + this.foto = new DefaultStreamedContent(event.getFile().getInputstream()); + this.fotoCargada = true; + + //Obteniendo la extension de la imagen + String extension = ""; + int pos = -1; + for (int i = selectedPicture.getFileName().length() - 1; i >= 0; i--) { + if (selectedPicture.getFileName().toCharArray()[i] == '.') { + pos = i; + break; + } + } + if (pos != -1) { + extension = selectedPicture.getFileName().substring(pos + 1, selectedPicture.getFileName().length()); + } + + //Almacenando la imagen temporalmente +/* ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); + ServletContext servletContext = (ServletContext) externalContext.getContext(); + String tempUrl = "/resources/images/temp/"; + String imageName=UUID.randomUUID().toString(); + String imageUrl=servletContext.getRealPath(tempUrl)+File.separator+imageName+"."+extension; + File outputfile = new File(imageUrl); + InputStream input=new ByteArrayInputStream(selectedPicture.getContents()); + BufferedImage image=ImageIO.read(input); + Boolean saved=ImageIO.write(image, extension, outputfile); + + this.rutaFoto="/resources/images/temp/"+imageName+"."+extension;*/ + //Almacenando la imagen temporalmente + ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); + ServletContext servletContext = (ServletContext) externalContext.getContext(); + + String tempUrl = servletContext.getRealPath("/");; + String imageName = UUID.randomUUID().toString(); + imageUrl = tempUrl + "resources/images/" + imageName + "." + extensionFoto; + imageUrl = imageUrl.replace("\\", "/"); + File outputfile = new File(imageUrl); + InputStream input = new ByteArrayInputStream(selectedPicture.getContents()); + BufferedImage image = ImageIO.read(input); + Boolean saved = ImageIO.write(image, extensionFoto, outputfile); + this.rutaFoto = "/resources/images/" + imageName + "." + extensionFoto; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Entrega lista de objetos TgeneCatalogDetail tipo de identificación + * + * @return lidentification Lista de objetos TgeneCatalogDetail + */ + public List getLidentification() { + return this.lidentification; + } + + /** + * Fija lista de objetos TgeneCatalogDetail tipo de identificación + * + * @param lidentification Lista de objetos TgeneCatalogDetail + */ + public void setLidentification(List lidentification) { + this.lidentification = lidentification; + } + + /** + * Entrega Verdadero/Falso + * + * @return activeNotEconomic V/F + */ + public boolean isActiveRegEx() { + return this.activeRegEx; + } + + /** + * Fija Verdadero/Falso + * + * @param activeNotEconomic V/F + */ + public void setActiveRegEx(boolean activeRegEx) { + this.activeRegEx = activeRegEx; + } + + /** + * Entrega el número de digitos para el tipo de identificaci&oacuye;n + * + * @return lengthId Número de digitos + */ + public String getLengthId() { + return this.lengthId; + } + + /** + * Fija el número de digitos para el tipo de identificaci&oacuye;n + * + * @param lengthId Número de digitos + */ + public void setLengthId(String lengthId) { + this.lengthId = lengthId; + } + + /** + * Entrega lista de objetos TgeneCatalogDetail de sector económico + * + * @return leconomicsector Lista de objetos TgeneCatalogDetail + */ + public List getLeconomicsector() { + return this.leconomicsector; + } + + /** + * Fija lista de objetos TgeneCatalogDetail de sector económico + * + * @param leconomicsector Lista de objetos TgeneCatalogDetail + */ + public void setLeconomicsector(List leconomicsector) { + this.leconomicsector = leconomicsector; + } + + /** + * Entrega lista de objetos TgeneCatalogDetail de tipo cliente + * + * @return ltypeclient Lista de objetos TgeneCatalogDetail + */ + public List getLtypeclient() { + return this.ltypeclient; + } + + /** + * Fija lista de objetos TgeneCatalogDetail de tipo cliente + * + * @param ltypeclient Lista de objetos TgeneCatalogDetail + */ + public void setLtypeclient(List ltypeclient) { + this.ltypeclient = ltypeclient; + } + + /** + * Entrega lista de objetos TgeneCatalogDetail + * + * @return lnotactivity Lista de objetos TgeneCatalogDetail + */ + public List getLnotactivity() { + return this.lnotactivity; + } + + /** + * Fija lista de objetos TgeneCatalogDetail + * + * @param lnotactivity Lista de objetos TgeneCatalogDetail + */ + public void setLnotactivity(List lnotactivity) { + this.lnotactivity = lnotactivity; + } + + /** + * Entrega la lista de géneros + * + * @return lgender Lista de géneros + */ + public List getLgender() { + return this.lgender; + } + + /** + * Fija la lista de géneros + * + * @param lgender Lista de géneros + */ + public void setLgender(List lgender) { + this.lgender = lgender; + } + + public List getLlenguage() { + return llenguage; + } + + public void setLlenguage(List llenguage) { + this.llenguage = llenguage; + } + + public Boolean getExistingperson() { + return existingperson; + } + + public void setExistingperson(Boolean existingperson) { + this.existingperson = existingperson; + } + + /** + * @return the personcode + */ + public String getPersoncode() { + return personcode; + } + + /** + * @param personcode the personcode to set + */ + public void setPersoncode(String personcode) { + this.personcode = personcode; + } + + /** + * @return the exentoImpuesto + */ + public boolean isExentoImpuesto() { + return exentoImpuesto; + } + + /** + * @param exentoImpuesto the exentoImpuesto to set + */ + public void setExentoImpuesto(boolean exentoImpuesto) { + this.exentoImpuesto = exentoImpuesto; + } + + public PeopleFastController getPeopleFastController() { + return peopleFastController; + } + + public void setPeopleFastController(PeopleFastController peopleFastController) { + this.peopleFastController = peopleFastController; + } + + public UploadedFile getSelectedPicture() { + return selectedPicture; + } + + public void setSelectedPicture(UploadedFile selectedPicture) { + this.selectedPicture = selectedPicture; + } + + public Boolean getFotoCargada() { + return fotoCargada; + } + + public void setFotoCargada(Boolean fotoCargada) { + this.fotoCargada = fotoCargada; + } + + public StreamedContent getFoto() { + return foto; + } + + public void setFoto(StreamedContent foto) { + this.foto = foto; + } + + public String getRutaFoto() { + return rutaFoto; + } + + public void setRutaFoto(String rutaFoto) { + this.rutaFoto = rutaFoto; + } + + public CompanyController getCompanyController() { + return companyController; + } + + public void setCompanyController(CompanyController companyController) { + this.companyController = companyController; + } + + public PersonAddressController getAddressController() { + return addressController; + } + + public void setAddressController(PersonAddressController addressController) { + this.addressController = addressController; + } + + public PersonPhoneController getPhonesController() { + return phonesController; + } + + public void setPhonesController(PersonPhoneController phonesController) { + this.phonesController = phonesController; + } + + public FileDetailController getFileDetail() { + return fileDetail; + } + + public void setFileDetail(FileDetailController fileDetail) { + this.fileDetail = fileDetail; + } + + public TsafeUserDetail getUsuario() { + return usuario; + } + + public void setUsuario(TsafeUserDetail usuario) { + this.usuario = usuario; + } + + public String getImageUrl() { + return imageUrl; + } + + public void setImageUrl(String imageUrl) { + this.imageUrl = imageUrl; + } + + public Boolean getIsDisableSave() { + return isDisableSave; + } + + public void setIsDisableSave(Boolean isDisableSave) { + this.isDisableSave = isDisableSave; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/PeopleController.java b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/PeopleController.java new file mode 100644 index 0000000..9abb4b2 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/PeopleController.java @@ -0,0 +1,170 @@ +package com.fp.frontend.controller.pcustomer; + +import java.util.ArrayList; +import java.util.HashMap; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.people.TcustPeople; + +/** + * Clase controladora del bean TcustPeople. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class PeopleController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private String personcode; + + public PeopleController() throws Exception { + super(TcustPeople.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + super.create(); + beanalias = "TCUSTPEOPLE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Agrega un par´metro para la conulta + * + * @param personcode Código de persona + */ + public void addPersoncodeFilter(String personcode) { + this.personcode = personcode; + super.addFilter("pk.personcode", personcode); + record.getPk().setPersoncode(Integer.parseInt(personcode)); + } + + /** + * Método para armar la consulta + * + * @return dto Objeto DtoQuery + * @throws Exception + */ + public DtoQuery getDtoQuery() throws Exception { + super.addFilterDateto(); + DtoQuery dto = super.getDtoQuery(false); + + // subqueries + // SubQuery subquery = new SubQuery("TgeneChannels", "description", "chanelname", "i.pk = t.channelcode"); + // dto.addSubQuery(subquery); + return dto; + } + + @Override + protected void querydatabase() { + try { + Request request = callerhelper.getRequest(); + super.addFilterDateto(); + DtoQuery dto = this.getDtoQuery(); + + SubQuery subqueryprof = new SubQuery("TgeneCatalogDetail", "description", "nprofesion", + "i.pk.catalogcode = 'PROFESSION' and i.pk.catalog = t.professioncatalog"); + dto.addSubQuery(subqueryprof); + + SubQuery subqueryestciv = new SubQuery("TgeneCatalogDetail", "description", "nestcivil", + "i.pk.catalogcode = 'MARITALSTATUS' and i.pk.catalog = t.maritalstatuscatalog"); + dto.addSubQuery(subqueryestciv); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + this.manageResponsePeople(resp); + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Controla la respuesta de la consulta + * + * @param resp Objeto Response + * @throws Exception + */ + public void manageResponsePeople(Response resp) throws Exception { + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + record = null; + MessageHelper.setMessageError(resp); + return; + } else { + record = (TcustPeople) resp.get(beanalias); + if (record == null) { + super.create(); + record.getPk().setPersoncode(Integer.parseInt(personcode)); + } + } + if (record.getGender() != null && record.getGender().equals("M")) { + record.modifiedData.put("ngenero", "MASCULINO"); + } else if (record.getGender() != null && record.getGender().equals("F")) { + record.modifiedData.put("ngenero", "FEMENINO"); + } + + super.postQuery(record); + } + + @Override + public void save() { + try { + Request request = callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/PeopleFastController.java b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/PeopleFastController.java new file mode 100644 index 0000000..7a299a2 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/PeopleFastController.java @@ -0,0 +1,1010 @@ +package com.fp.frontend.controller.pcustomer; + +import java.awt.image.BufferedImage; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.ExternalContext; +import javax.faces.context.FacesContext; +import javax.imageio.ImageIO; +import javax.servlet.ServletContext; + +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.SelectEvent; +import org.primefaces.model.DefaultStreamedContent; +import org.primefaces.model.StreamedContent; +import org.primefaces.model.UploadedFile; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.helper.FileHelper; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.lov.ActivityLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pcustomer.gene.TgeneActivity; +import com.fp.persistence.pcustomer.people.TcustPeople; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.image.TgeneFilesDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TsafeUserDetail. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class PeopleFastController extends AbstractController { + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{personDetailController}") + private PersonDetailController persondetail; + + @ManagedProperty(value = "#{peopleController}") + private PeopleController people; + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController address; + + @ManagedProperty(value = "#{personPhoneController}") + private PersonPhoneController phones; + + @ManagedProperty(value = "#{fileDetailController}") + private FileDetailController fileDetail; + + private List direccionesEliminadas = new ArrayList(); + private List telefonosEliminados = new ArrayList(); + private List profesionList = new ArrayList(); + private List estadocivilList = new ArrayList(); + private List militarygrades; + + /** + * Id de profesion + */ + private String idProfesion; + + /** + * Estado civil + */ + private String idEstadoCivil; + + private String imageUrl; + + public PeopleFastController() throws Exception { + super(AbstractDataTransport.class); + } + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de identificacion + */ + private List lidentification; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de tipo de cliente + */ + private List ltypeclient; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de sector + * económico + */ + private List leconomicsector; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de actividad no + * económica + */ + private List lnotactivity; + + /** + * Atributo para el listado de géneros + */ + private List lgender; + + /** + * Atributo para activar el keyFilter + */ + private boolean activeRegEx; + + /** + * Atributo para la longitud de la identificación + */ + private String lengthId; + + /** + * atributo para el código de persona + */ + private String personcode; + + private boolean flagHabilita; + + /** + * Atributo para la firma digital + */ + UploadedFile selectedSign; + Boolean firmaCargada = false; + StreamedContent firma; + String rutaFirma; + TsafeUserDetail usuario; + + UploadedFile selectedPicture; + Boolean fotoCargada = false; + StreamedContent foto; + String rutaFoto; + String extensionFoto = "jpg"; + String extensionFirma = "jpg"; + List fileH = new ArrayList(); + + @PostConstruct + private void postconstruct() { + + this.lengthId = "10"; + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + // LLenamos Listas + this.lidentification = CatalogDetailController.find("IDENTIFICATION", "1"); + this.leconomicsector = CatalogDetailController.find("ECONOMICSECTOR"); + this.ltypeclient = CatalogDetailController.find("PERSONTYPE"); + this.lnotactivity = CatalogDetailController.find("NOTACTIVITY"); + this.estadocivilList = CatalogDetailController.find("MARITALSTATUS"); + this.profesionList = CatalogDetailController.find("PROFESSION"); + this.militarygrades = CatalogDetailController.find("MILITARYGRADE"); + this.lgender = CatalogDetailController.getListGender(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.personcode = null; + this.lrecord = new ArrayList<>(); + this.beanalias = "PEOPLEFAST"; + + //Obteniendo los datos del usuario logueado + this.usuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("static-access") + @Override + protected void querydatabase() { + try { + + if ((super.getFieldvalue("pk.personcode") == null) || super.getFieldvalue("pk.personcode").equals("")) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + this.personcode = String.valueOf(super.getFieldvalue("pk.personcode")); + + //Request request = this.callerhelper.getRequest(); + this.persondetail.addPersoncodeFilter(this.personcode); + this.persondetail.query(); + + this.people.addPersoncodeFilter(this.personcode); + this.people.query(); + + //Cargando la firma y la foto + if (people.getRecord() != null) { + if (super.getFieldvalue("personname") != null) { + people.getRecord().setFirstname(super.getFieldvalue("personname").toString()); + } + //Firma + if (people.getRecord().getSignaturecode() != null) { + TgeneFilesDetail fileDetalle = fileDetail.find(String.valueOf(people.getRecord().getSignaturecode())); + extensionFirma = fileDetalle != null ? fileDetalle.getExtension() : extensionFirma; + + if (fileDetalle != null && fileDetalle.getImage() != null) { + InputStream input = new ByteArrayInputStream(fileDetalle.getImage()); + this.firma = new DefaultStreamedContent(input); + this.firmaCargada = true; + + //Almacenando la imagen temporalmente + ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); + ServletContext servletContext = (ServletContext) externalContext.getContext(); + + String tempUrl = servletContext.getRealPath("/");; + String imageName = UUID.randomUUID().toString(); + imageUrl = tempUrl + "resources/images/" + imageName + "." + extensionFirma; + imageUrl = imageUrl.replace("\\", "/"); + File outputfile = new File(imageUrl); + BufferedImage image = ImageIO.read(input); + ImageIO.write(image, extensionFirma, outputfile); + + this.rutaFirma = "/resources/images/" + imageName + "." + extensionFirma; + } else { + this.firma = null; + imageUrl = null; + this.rutaFirma = null; + this.firmaCargada = false; + } + } else { + this.firma = null; + imageUrl = null; + this.rutaFirma = null; + this.firmaCargada = false; + } + //Foto + if (people.getRecord().getPhotocode() != null) { + TgeneFilesDetail fileDetalle = fileDetail.find(String.valueOf(people.getRecord().getPhotocode())); + extensionFoto = fileDetalle != null ? fileDetalle.getExtension() : extensionFoto; + + if (fileDetalle != null && fileDetalle.getImage() != null) { + InputStream input = new ByteArrayInputStream(fileDetalle.getImage()); + this.foto = new DefaultStreamedContent(input); + this.fotoCargada = true; + + //Almacenando la imagen temporalmente + ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); + ServletContext servletContext = (ServletContext) externalContext.getContext(); + + String tempUrl = servletContext.getRealPath("/");; + String imageName = UUID.randomUUID().toString(); + imageUrl = tempUrl + "resources/images/" + imageName + "." + extensionFoto; + imageUrl = imageUrl.replace("\\", "/"); + File outputfile = new File(imageUrl); + BufferedImage image = ImageIO.read(input); + ImageIO.write(image, extensionFoto, outputfile); + this.rutaFoto = "/resources/images/" + imageName + "." + extensionFoto; + } else { + this.foto = null; + imageUrl = null; + this.rutaFoto = null; + this.fotoCargada = false; + } + } else { + this.foto = null; + imageUrl = null; + this.rutaFoto = null; + this.fotoCargada = false; + } + } + + this.address.addPersoncodeFilter(this.personcode); + this.address.addFilterDateto(); + this.address.query(); + + this.phones.addPersoncodeFilter(this.personcode); + this.phones.addFilterDateto(); + this.phones.query(); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + if (this.persondetail.getRecord().getPk() == null || this.persondetail.getRecord().getPk().getPersoncode() == null) { + TcustPersonDetail per = PersonDetailController.findByIdentification(this.persondetail.getRecord().getIdentification()); + if (per != null && per.getIdentification() != null) { + MessageHelper.setMessageError("CDULA YA REGISTRADA"); + return; + } + } + if ((this.personcode != null) && !this.personcode.equals("")) { + request.put("personcode", this.personcode); + request.put("identification", this.persondetail.getRecord().getIdentification()); + // this.reqAddressPhone(); + } else { + if (this.address.getLrecord().size() == 0) { + MessageHelper.setMessageError("msg_requireAddress"); + return; + } + if (this.phones.getLrecord().size() == 0) { + MessageHelper.setMessageError("msg_requirePhones"); + return; + } + } + + //Asignando la foto + if (this.selectedPicture != null) { + this.persondetail.getRecord().setPicture(this.selectedPicture.getContents()); + request.getModifiedData().put("EXTENSION", this.extensionFoto); + request.getModifiedData().put("NAME", this.selectedPicture.getFileName()); + } + + if (this.persondetail.getRecord().getMilitarygrade() != null) { + this.persondetail.getRecord().setMilitarygradecode("MILITARYGRADE"); + } + + //Asignando la firma + if (this.selectedSign != null) { + this.persondetail.getRecord().setSign(this.selectedSign.getContents()); + } + + // Preparamos los objetos a ser enviados + this.persondetail.update(); + this.people.update(); + + // Definimos los formularios + DtoSave dtoSavePerson = this.persondetail.getDtoSave(true); + DtoSave dtoSavePeople = this.people.getDtoSave(true); + DtoSave dtoSaveAddress = this.address.getDtoSave(true); + DtoSave dtoSavePhone = this.phones.getDtoSave(true); + + // Verificamos y agregamos al request + if (dtoSavePeople.pendingProcess()) { + this.persondetail.getRecord().setName(this.people.getRecord().getFirstname()); + // this.people.getRecord().getLastname()); + //+ " " + this.people.getRecord().getSurename() + " " + // + this.people.getRecord().getFirstname() + " " + this.people.getRecord().getMiddlename() + dtoSavePerson = this.persondetail.getDtoSave(true); + msave.put(this.people.getBeanalias(), dtoSavePeople); + } + if (dtoSavePerson.pendingProcess()) { + msave.put(this.persondetail.getBeanalias(), dtoSavePerson); + } + if (dtoSaveAddress.pendingProcess()) { + msave.put(this.address.getBeanalias(), dtoSaveAddress); + } + if (dtoSavePhone.pendingProcess()) { + msave.put(this.phones.getBeanalias(), dtoSavePhone); + } + + request.setSaveTables(msave); + + request.getModifiedData().put("DETALLESPERSONA", persondetail.getRecord()); + request.getModifiedData().put("DIRECCIONESELIMINADAS", this.direccionesEliminadas); + request.getModifiedData().put("TELEFONOSELIMINADOS", this.telefonosEliminados); + + request.getModifiedData().put("USUARIO", this.usuario); + + guardarInformacionImagenes(); + + request.getModifiedData().put("file", fileH); + request.getModifiedData().put("photocode", people.getRecord() != null ? people.getRecord().getPhotocode() : null); + request.getModifiedData().put("signaturecode", people.getRecord() != null ? people.getRecord().getSignaturecode() : null); + request.getModifiedData().put("pk_personcode", people.getRecord() != null ? people.getRecord().getPk().getPersoncode() : null); + + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.people.postCommit(resp); + this.persondetail.postCommit(resp); + this.address.postCommit(resp); + this.phones.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo para guardar informacion de las imagenes en la base de datos + * + * @throws IOException + */ + private void guardarInformacionImagenes() throws IOException { + FileHelper archivoPicture = new FileHelper(); + archivoPicture.setName(""); + + fileH = new ArrayList(); + + if (selectedPicture != null) { + long size = selectedPicture.getSize(); + InputStream stream = selectedPicture.getInputstream(); + byte[] buffer = new byte[(int) size]; + stream.read(buffer, 0, (int) size); + stream.close(); + archivoPicture.setContentType(selectedPicture.getContentType()); + archivoPicture.setExtension(extensionFoto); + archivoPicture.setImage(buffer); + archivoPicture.setName(selectedPicture.getFileName()); + archivoPicture.setSize(selectedPicture.getFileName().length()); + } + fileH.add(archivoPicture); + + FileHelper archivoFirma = new FileHelper(); + archivoFirma.setName(""); + + if (selectedSign != null) { + long sizeFirma = selectedSign.getSize(); + InputStream streamFirma = selectedSign.getInputstream(); + byte[] bufferFirma = new byte[(int) sizeFirma]; + streamFirma.read(bufferFirma, 0, (int) sizeFirma); + streamFirma.close(); + archivoFirma.setContentType(selectedSign.getContentType()); + archivoFirma.setExtension(extensionFirma); + archivoFirma.setImage(bufferFirma); + archivoFirma.setName(selectedSign.getFileName()); + archivoFirma.setSize(selectedSign.getFileName().length()); + } + fileH.add(archivoFirma); + } + + @Override + public void postCommit(Response response) throws Exception { + this.persondetail.postCommit(response); + } + + /** + * Elimina una direccion + */ + public void removeAddress(TcustPersonAddress direccion) { + try { + this.direccionesEliminadas.add(direccion); + //this.address.setRecord(direccion); + //this.address.getRecord().getPk().setDateto(new Timestamp(Calendar.getInstance().getTimeInMillis())); + //this.address.update(); + this.address.remove(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Elimina una telefono + */ + public void removePhone(TcustPersonPhone telefono) { + try { + this.telefonosEliminados.add(telefono); + this.phones.remove(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Verifica los valores requeridos + * + * @throws Exception + */ + public void reqAddressPhone() throws Exception { + if (this.activity(this.persondetail.getRecord(), this.people.getRecord())) { + MessageHelper.setMessageError("msg_requireActivity"); + return; + } + if (!this.address.getDtoSave().pendingProcess()) { + MessageHelper.setMessageError("msg_requireAddress"); + return; + } + if (!this.phones.getDtoSave().pendingProcess()) { + MessageHelper.setMessageError("msg_requirePhones"); + return; + } + } + + /** + * Verifica el ingreso de una actividad económica + * + * @param person Objeto TcustPersonDetail + * @param people Objeto TcustPeople + * @return result V/F + */ + private boolean activity(TcustPersonDetail person, TcustPeople people) { + boolean result = false; + if (((person.getActivitycode() == null) || person.getActivitycode().equals("")) + && ((people.getNotactivitycatalog() == null) || people.getNotactivitycatalog().equals(""))) { + result = true; + } + return result; + } + + /** + * Ejecuta el evento change del combo actividad no económica + */ + public void onChangeNotactivity() { + this.people.getRecord().setNotactivitycatalogcode("NOTACTIVITY"); + this.persondetail.getRecord().setActivitycode(null); + this.persondetail.getRecord().put("activitydesc", null); + this.persondetail.getRecord().put("segmenttypecatalog", null); + this.persondetail.getRecord().put("segmentdesc", null); + } + + public String getImageUrl() { + return imageUrl; + } + + public void setImageUrl(String imageUrl) { + this.imageUrl = imageUrl; + } + + public String getIdProfesion() { + return idProfesion; + } + + public void setIdProfesion(String idProfesion) { + this.idProfesion = idProfesion; + } + + /** + * Método para abrir el lov de personas + */ + public void openPersonLov() { + Map> params = new HashMap<>(); + List natural = new ArrayList(); + natural.add("CED"); + params.put("natural", natural); + PersonLovController.openLov(params); + } + + /** + * Retorna los valores del lov + * + * @param event Evento ajax + * @throws Exception + */ + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + super.addField("pk.personcode", t.getPk().getPersoncode().toString()); + super.addField("personname", t.getName()); + super.query(); + } + + /** + * Método que abre el lov de activudad económica + */ + public void openActivityLov() { + Map> params = new HashMap<>(); + ActivityLovController.openLov(params); + } + + /** + * Controla la respuesta del lov de activudad económica + * + * @param event + * @throws Exception + */ + public void onReturnActivityLov(SelectEvent event) throws Exception { + TgeneActivity t = (TgeneActivity) event.getObject(); + this.people.getRecord().setNotactivitycatalog(null); + this.people.getRecord().setNotactivitycatalogcode(null); + this.persondetail.getRecord().setActivitycode(t.getPk()); + this.persondetail.getRecord().modifiedData.put("activitydesc", t.getDescription()); + this.persondetail.getRecord().modifiedData.put("segmenttypecatalog", t.getSegmenttypecatalog()); + this.persondetail.getRecord().modifiedData.put("segmentdesc", t.get("segmentdesc")); + } + + public void onChangeId() { + if (this.persondetail.getRecord().getIdentificationcatalog().compareTo("CED") == 0) { + this.lengthId = "10"; + this.activeRegEx = false; + } else if (this.persondetail.getRecord().getIdentificationcatalog().compareTo("RUC") == 0) { + this.lengthId = "13"; + this.activeRegEx = false; + } else if (this.persondetail.getRecord().getIdentificationcatalog().compareTo("PAS") == 0) { + this.lengthId = "13"; + this.activeRegEx = true; + } + } + + /** + * Metodo que carga la firma digital + */ + public void uploadSign(FileUploadEvent event) { + try { + selectedSign = event.getFile(); + + InputStream is = new ByteArrayInputStream(selectedSign.getContents()); + this.firma = new DefaultStreamedContent(is, selectedSign.getContentType(), selectedSign.getFileName()); + this.firmaCargada = true; + + //Obteniendo la extension de la imagen + extensionFirma = ""; + int pos = -1; + for (int i = selectedSign.getFileName().length() - 1; i >= 0; i--) { + if (selectedSign.getFileName().toCharArray()[i] == '.') { + pos = i; + break; + } + } + if (pos != -1) { + extensionFirma = selectedSign.getFileName().substring(pos + 1, selectedSign.getFileName().length()); + } + + //Almacenando la imagen temporalmente + ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); + ServletContext servletContext = (ServletContext) externalContext.getContext(); + String tempUrl = servletContext.getRealPath("/"); + String imageName = UUID.randomUUID().toString(); + //String imageUrl=servletContext.getRealPath(tempUrl)+File.separator+imageName+"."+extension; + imageUrl = tempUrl + "resources/images/" + imageName + "." + extensionFirma; + imageUrl = imageUrl.replace("\\", "/"); + File outputfile = new File(imageUrl); + InputStream input = new ByteArrayInputStream(selectedSign.getContents()); + BufferedImage image = ImageIO.read(input); + ImageIO.write(image, extensionFirma, outputfile); + + this.rutaFirma = "/resources/images/" + imageName + "." + extensionFirma; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Metodo que carga la foto + */ + @SuppressWarnings("unused") + public void uploadPicture(FileUploadEvent event) { + try { + selectedPicture = event.getFile(); + + InputStream is = new ByteArrayInputStream(selectedPicture.getContents()); + this.foto = new DefaultStreamedContent(is, selectedPicture.getContentType(), selectedPicture.getFileName()); + this.fotoCargada = true; + + /* long size = selectedPicture.getSize(); + InputStream stream = selectedPicture.getInputstream(); + byte[] buffer = new byte[(int) size]; + stream.read(buffer, 0, (int) size); + stream.close();*/ + //Obteniendo la extension de la imagen + this.extensionFoto = ""; + int pos = -1; + for (int i = selectedPicture.getFileName().length() - 1; i >= 0; i--) { + if (selectedPicture.getFileName().toCharArray()[i] == '.') { + pos = i; + break; + } + } + if (pos != -1) { + extensionFoto = selectedPicture.getFileName().substring(pos + 1, selectedPicture.getFileName().length()); + } + + //Almacenando la imagen temporalmente + ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); + ServletContext servletContext = (ServletContext) externalContext.getContext(); + + String tempUrl = servletContext.getRealPath("/");; + String imageName = UUID.randomUUID().toString(); + imageUrl = tempUrl + "resources/images/" + imageName + "." + extensionFoto; + imageUrl = imageUrl.replace("\\", "/"); + File outputfile = new File(imageUrl); + InputStream input = new ByteArrayInputStream(selectedPicture.getContents()); + BufferedImage image = ImageIO.read(input); + Boolean saved = ImageIO.write(image, extensionFoto, outputfile); + + this.rutaFoto = "/resources/images/" + imageName + "." + extensionFoto; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + e.printStackTrace(); + } + } + + /** + * Entrega el valor de: persondetail + * + * @return PersonDetailController + */ + public PersonDetailController getPersondetail() { + return this.persondetail; + } + + /** + * Fija el valor de: persondetail + * + * @param persondetail Valor a fijar en el atributo. + */ + public void setPersondetail(PersonDetailController persondetail) { + this.persondetail = persondetail; + } + + /** + * Entrega el valor de: persondetail + * + * @return PersonDetailController + */ + public PeopleController getPeople() { + return this.people; + } + + /** + * Fija el valor de: persondetail + * + * @param people Valor a fijar en el atributo. + */ + public void setPeople(PeopleController people) { + this.people = people; + } + + /** + * Entrega el valor de: address + * + * @return PersonAddressController + */ + public PersonAddressController getAddress() { + return this.address; + } + + /** + * Fija el valor de: address + * + * @param PersonAddressController + */ + public void setAddress(PersonAddressController address) { + this.address = address; + } + + /** + * Entrega el valor de: phones + * + * @return PersonPhoneController + */ + public PersonPhoneController getPhones() { + return this.phones; + } + + /** + * Fija el valor de: phones + * + * @param PersonPhoneController + */ + public void setPhones(PersonPhoneController phones) { + this.phones = phones; + } + + /** + * Entrega lista de objetos TgeneCatalogDetail tipo de identificación + * + * @return lidentification Lista de objetos TgeneCatalogDetail + */ + public List getLidentification() { + return this.lidentification; + } + + /** + * Fija lista de objetos TgeneCatalogDetail tipo de identificación + * + * @param lidentification Lista de objetos TgeneCatalogDetail + */ + public void setLidentification(List lidentification) { + this.lidentification = lidentification; + } + + /** + * Entrega Verdadero/Falso + * + * @return activeNotEconomic V/F + */ + public boolean isActiveRegEx() { + return this.activeRegEx; + } + + /** + * Fija Verdadero/Falso + * + * @param activeNotEconomic V/F + */ + public void setActiveRegEx(boolean activeRegEx) { + this.activeRegEx = activeRegEx; + } + + /** + * Entrega el número de digitos para el tipo de identificaci&oacuye;n + * + * @return lengthId Número de digitos + */ + public String getLengthId() { + return this.lengthId; + } + + /** + * Fija el número de digitos para el tipo de identificaci&oacuye;n + * + * @param lengthId Número de digitos + */ + public void setLengthId(String lengthId) { + this.lengthId = lengthId; + } + + /** + * Entrega lista de objetos TgeneCatalogDetail de sector económico + * + * @return leconomicsector Lista de objetos TgeneCatalogDetail + */ + public List getLeconomicsector() { + return this.leconomicsector; + } + + /** + * Fija lista de objetos TgeneCatalogDetail de sector económico + * + * @param leconomicsector Lista de objetos TgeneCatalogDetail + */ + public void setLeconomicsector(List leconomicsector) { + this.leconomicsector = leconomicsector; + } + + /** + * Entrega lista de objetos TgeneCatalogDetail de tipo cliente + * + * @return ltypeclient Lista de objetos TgeneCatalogDetail + */ + public List getLtypeclient() { + return this.ltypeclient; + } + + /** + * Fija lista de objetos TgeneCatalogDetail de tipo cliente + * + * @param ltypeclient Lista de objetos TgeneCatalogDetail + */ + public void setLtypeclient(List ltypeclient) { + this.ltypeclient = ltypeclient; + } + + /** + * Entrega lista de objetos TgeneCatalogDetail + * + * @return lnotactivity Lista de objetos TgeneCatalogDetail + */ + public List getLnotactivity() { + return this.lnotactivity; + } + + /** + * Fija lista de objetos TgeneCatalogDetail + * + * @param lnotactivity Lista de objetos TgeneCatalogDetail + */ + public void setLnotactivity(List lnotactivity) { + this.lnotactivity = lnotactivity; + } + + /** + * Entrega la lista de géneros + * + * @return lgender Lista de géneros + */ + public List getLgender() { + return this.lgender; + } + + /** + * Fija la lista de géneros + * + * @param lgender Lista de géneros + */ + public void setLgender(List lgender) { + this.lgender = lgender; + } + + public Boolean getFirmaCargada() { + return firmaCargada; + } + + public void setFirmaCargada(Boolean firmaCargada) { + this.firmaCargada = firmaCargada; + } + + public UploadedFile getSelectedSign() { + return selectedSign; + } + + public void setSelectedSign(UploadedFile selectedSign) { + this.selectedSign = selectedSign; + } + + public UploadedFile getSelectedPicture() { + return selectedPicture; + } + + public void setSelectedPicture(UploadedFile selectedPicture) { + this.selectedPicture = selectedPicture; + } + + public Boolean getFotoCargada() { + return fotoCargada; + } + + public void setFotoCargada(Boolean fotoCargada) { + this.fotoCargada = fotoCargada; + } + + public StreamedContent getFirma() throws IOException { + if (selectedSign != null) { + FacesContext.getCurrentInstance().getExternalContext().getMimeType(selectedSign.getContentType()); + return new DefaultStreamedContent(selectedSign.getInputstream(), "image/png"); + } + return null; + } + + public void setFirma(StreamedContent firma) { + this.firma = firma; + } + + public StreamedContent getFoto() throws IOException { + if (selectedPicture != null) { + FacesContext.getCurrentInstance().getExternalContext().getMimeType(selectedPicture.getContentType()); + return new DefaultStreamedContent(selectedPicture.getInputstream(), "image/png"); + } + return null; + + } + + public void setFoto(StreamedContent foto) { + this.foto = foto; + } + + public String getRutaFoto() { + return rutaFoto; + } + + public void setRutaFoto(String rutaFoto) { + this.rutaFoto = rutaFoto; + } + + public String getRutaFirma() { + return rutaFirma; + } + + public void setRutaFirma(String rutaFirma) { + this.rutaFirma = rutaFirma; + } + + public List getProfesionList() { + return profesionList; + } + + public void setProfesionList(List profesionList) { + this.profesionList = profesionList; + } + + public List getEstadocivilList() { + return estadocivilList; + } + + public String getIdEstadoCivil() { + return idEstadoCivil; + } + + public void setIdEstadoCivil(String idEstadoCivil) { + this.idEstadoCivil = idEstadoCivil; + } + + public void setEstadocivilList(List estadocivilList) { + this.estadocivilList = estadocivilList; + } + + public FileDetailController getFileDetail() { + return fileDetail; + } + + public void setFileDetail(FileDetailController fileDetail) { + this.fileDetail = fileDetail; + } + + public List getMilitarygrades() { + return militarygrades; + } + + public void setMilitarygrades(List militarygrades) { + this.militarygrades = militarygrades; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/PersonAddressController.java b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/PersonAddressController.java new file mode 100644 index 0000000..ccece79 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/PersonAddressController.java @@ -0,0 +1,728 @@ +package com.fp.frontend.controller.pcustomer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.common.helper.Constant; +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CantonController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.CityController; +import com.fp.frontend.controller.pgeneral.gene.CountryController; +import com.fp.frontend.controller.pgeneral.gene.ParroquiaController; +import com.fp.frontend.controller.pgeneral.gene.ProvinceController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.company.TcustCompany; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonAddressKey; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Clase controladora del bean TcustPersonAddress. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class PersonAddressController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public PersonAddressController() throws Exception { + super(TcustPersonAddress.class); + } + + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List laddresstype; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List lcountries; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lprovinces; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcantones; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lparroquias; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lcities; + + /** + * Atributo para el control de checkBox de principal + */ + private boolean principal; + + /** + * Atributo para el código de persona + */ + private Integer personcode; + + private boolean typeaddress; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + laddresstype = CatalogDetailController.find("ADDRESSTYPE"); + lcountries = CountryController.find(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + record = new TcustPersonAddress(); + record.setPk(new TcustPersonAddressKey()); + beanalias = "TCUSTPERSONADDRESS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Agrega un par´metro para la conulta + * + * @param personcode Código de persona + */ + public void addPersoncodeFilter(String personcode) { + this.personcode = new Integer(personcode); + super.addFilter("pk.personcode", personcode); + } + + /** + * Método para armar la consulta + * + * @return dto Objeto DtoQuery + * @throws Exception + */ + public DtoQuery getDtoQuery() throws Exception { + super.addFilterDateto(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.addressnumber"); // En en string van todos los campos de + // orden ("t.pk, t.nombre, t.cpais"). + // subqueries + SubQuery subquery = new SubQuery("TgeneCatalogDetail", "description", "addresstype", + "i.pk.catalogcode = t.addresstypecatalogcode and i.pk.catalog = t.addresstypecatalog"); + dto.addSubQuery(subquery); + + SubQuery subqueryProvincia = new SubQuery("TgeneProvince", "description", "provincia", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode"); + dto.addSubQuery(subqueryProvincia); + + SubQuery subqueryCanton = new SubQuery("TgeneCanton", "description", "canton", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode and i.pk.cantoncode=t.cantoncode"); + dto.addSubQuery(subqueryCanton); + + SubQuery subqueryCiudad = new SubQuery("TgeneCity", "description", "ciudad", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode and i.pk.cantoncode=t.cantoncode and i.pk.citycode=t.citycode"); + dto.addSubQuery(subqueryCiudad); + + SubQuery subqueryParroquia = new SubQuery("TgeneParroquia", "description", "parroquia", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode and i.pk.cantoncode=t.cantoncode and i.pk.parroquiacode=t.parroquiacode"); + dto.addSubQuery(subqueryParroquia); + + return dto; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + super.addFilterDateto(); + + //Cargando el tipo de direccion + SubQuery subQueryTipoDireccion = new SubQuery("TgeneCatalogDetail", "description", + "addresstype", "i.pk.catalog=t.addresstypecatalog and i.pk.catalogcode=t.addresstypecatalogcode"); + dto.addSubQuery(subQueryTipoDireccion); + + SubQuery subqueryProvincia = new SubQuery("TgeneProvince", "description", "provincia", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode"); + dto.addSubQuery(subqueryProvincia); + + SubQuery subqueryCanton = new SubQuery("TgeneCanton", "description", "canton", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode and i.pk.cantoncode=t.cantoncode"); + dto.addSubQuery(subqueryCanton); + + SubQuery subqueryCiudad = new SubQuery("TgeneCity", "description", "ciudad", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode and i.pk.cantoncode=t.cantoncode and i.pk.citycode=t.citycode"); + dto.addSubQuery(subqueryCiudad); + + SubQuery subqueryParroquia = new SubQuery("TgeneParroquia", "description", "parroquia", + "i.pk.provincecode = t.provincecode and i.pk.countrycode = t.countrycode and i.pk.cantoncode=t.cantoncode and i.pk.parroquiacode=t.parroquiacode"); + dto.addSubQuery(subqueryParroquia); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (lrecord != null && !lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaseAll() { + try { + DtoQuery dto = super.getDtoQuery(true); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Controla la respuesta de la consulta + * + * @param resp Objeto Response + * @throws Exception + */ + @SuppressWarnings("unchecked") + public void manageResponseAddress(Response resp) throws Exception { + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery((List) resp.get(beanalias)); + } + } + + @Override + public void save() { + try { + Request request = callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public TcustPersonAddress findPersonaPorDireccionTipoCatalogo(String codigopersona, String direcciontipoCatalogo) { + try { + PersonAddressController cc = new PersonAddressController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.personcode", codigopersona); + cc.addFilter("addresstypecatalog", direcciontipoCatalogo); + cc.addFilterDateto(); + cc.querydatabaseAll(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + record = cc.lrecord.get(0); + lprovinces = ProvinceController.findPorCodigo(record.getCountrycode(), record.getProvincecode()); + lcantones = CantonController.findPorCodigo(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + lcities = CityController.findPorCodigo(record.getCountrycode(), record.getProvincecode(), record.getCantoncode(), record.getCitycode()); + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + return record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public TcustPersonAddress findByPersonCode(String codigopersona, String codigoCorreo) { + try { + PersonAddressController cc = new PersonAddressController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.personcode", codigopersona); + cc.addFilter("addresstypecatalog", codigoCorreo); + cc.addFilterDateto(); + cc.querydatabaseAll(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + record = cc.lrecord.get(0); + lprovinces = ProvinceController.findPorCodigo(record.getCountrycode(), record.getProvincecode()); + lcantones = CantonController.findPorCodigo(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + lcities = CityController.findPorCodigo(record.getCountrycode(), record.getProvincecode(), record.getCantoncode(), record.getCitycode()); + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + return record; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public static List findByPersonCodeList(String codigopersona, String codigoCorreo) { + try { + PersonAddressController cc = new PersonAddressController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.personcode", codigopersona); + cc.addFilter("addresstypecatalog", codigoCorreo); + cc.addFilterDateto(); + cc.querydatabaseAll(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Obtiene todas las direcciones de una persona + * + * @param codigopersona + * @return + */ + public static List findAllByPersonCode(String codigopersona) { + try { + PersonAddressController cc = new PersonAddressController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.personcode", codigopersona); + cc.addFilter("pk.dateto", "2999-12-31"); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que retorna la direccion que sea diferente a la del mail + * + * @param codigopersona + * @param direcciontipoCatalogo + * @return + */ + public static TcustPersonAddress findDifAMail(String codigopersona, String direcciontipoCatalogo) { + try { + PersonAddressController cc = new PersonAddressController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.personcode", codigopersona); + cc.addFilter("addresstypecatalog", "!=" + direcciontipoCatalogo); + cc.querydatabaseAll(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Retorna la dirección marcada como principal + * + * @param codigoPersona + * @return + */ + public TcustPersonAddress findPrincipal(String codigoPersona) { + try { + PersonAddressController cc = new PersonAddressController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.personcode", codigoPersona); + cc.addFilter("principal", Constant.STR_Y); + cc.addFilterDateto(); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + return null; + } + + /** + * Retorna la dirección marcada como principal + * + * @param codigoPersona + * @return + */ + public static TcustPersonAddress find(String codigoPersona) { + try { + PersonAddressController cc = new PersonAddressController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.personcode", codigoPersona); + cc.addFilter("principal", Constant.STR_Y); + cc.addFilterDateto(); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + return null; + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + /** + * Método para el evento change del combo países + */ + public void executeCountry() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lprovinces = ProvinceController.find(record.getCountrycode()); + lcantones = new ArrayList<>(); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo provincias + */ + public void executeProvince() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + lparroquias = new ArrayList<>(); + lcities = new ArrayList<>(); + } + } + + /** + * Método para el evento change del combo cantones + */ + public void executeCanton() { + if ((record.getCountrycode() != null) && (record.getCountrycode().compareTo("") != 0)) { + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + lcities = CityController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + } + } + + /** + * Método para cargar datos en el editar + */ + public void loadEdit() { + this.onChangeType(); + principal = ((record.getPrincipal() != null) && record.getPrincipal().equals("Y") ? true : false); + lprovinces = ProvinceController.find(record.getCountrycode()); + lcantones = CantonController.find(record.getCountrycode(), record.getProvincecode()); + lparroquias = ParroquiaController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + lcities = CityController.find(record.getCountrycode(), record.getProvincecode(), record.getCantoncode()); + } + + /** + * Método para manejar el evento change en el CheckBox + */ + public void onChangePrincipal() { + if (principal) { + record.setPrincipal("Y"); + } else { + record.setPrincipal("N"); + } + } + + @Override + public void update() { + try { + +// record.getPk().setPersoncode(((personcode == null) || personcode.equals(0)) ? null : personcode); + /* + if ((personcode == null) || (personcode == 0)) { + record.getPk().setAddressnumber(this.getMaxNumber()); + } + if(record.isnew){ + record.getPk().setAddressnumber(this.getMaxNumber()); + } + */ + record.setAddresstypecatalogcode("ADDRESSTYPE"); + for (TgeneCatalogDetail detail : laddresstype) { + if (detail.getPk().getCatalog().equals(record.getAddresstypecatalog())) { + record.modifiedData.put("addresstype", detail.getDescription()); + } + } + super.update(); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método que obtiene el max de direcciones + * + * @return max Número max + */ + private Integer getMaxNumber() { + Integer max = 0; + if (lrecord.size() > 0) { + for (TcustPersonAddress address : lrecord) { + if (max.compareTo(address.getPk().getAddressnumber()) < 0) { + max = address.getPk().getAddressnumber(); + } + } + } + return max + 1; + } + + /** + * Método para manejar el evento change en el combo tipod e + * dirección + */ + public void onChangeType() { + if (record.getAddresstypecatalog().compareTo("3") == 0) { + typeaddress = true; + } else { + typeaddress = false; + } + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail tipo de direcciones + * + * @return laddresstype Lista de objetos TgeneCatalogDetail tipo de + * direcciones + */ + public List getLaddresstype() { + return laddresstype; + } + + /** + * Fija una lista de objetos TgeneCatalogDetail tipo de direcciones + * + * @param laddresstype Lista de objetos TgeneCatalogDetail tipo de + * direcciones + */ + public void setLaddresstype(List laddresstype) { + this.laddresstype = laddresstype; + } + + /** + * Entrega una lista de objetos TgeneCountry países + * + * @return lcountries Lista de objetos TgeneCountry + */ + public List getLcountries() { + return lcountries; + } + + /** + * Fija una lista de objetos TgeneCountry países + * + * @param lcountries Lista de objetos TgeneCountry + */ + public void setLcountries(List lcountries) { + this.lcountries = lcountries; + } + + /** + * Entrega una lista de objetos TgeneProvince provincias + * + * @return lprovinces Lista de objetos TgeneProvince + */ + public List getLprovinces() { + return lprovinces; + } + + /** + * Fija una lista de objetos TgeneProvince provincias + * + * @param lprovinces Lista de objetos TgeneProvince + */ + public void setLprovinces(List lprovinces) { + this.lprovinces = lprovinces; + } + + /** + * Entrega una lista de objetos TgeneCanton cantones + * + * @return lcantones Lista de objetos TgeneCanton + */ + public List getLcantones() { + return lcantones; + } + + /** + * Fija una lista de objetos TgeneCanton cantones + * + * @param lcantones Lista de objetos TgeneCanton + */ + public void setLcantones(List lcantones) { + this.lcantones = lcantones; + } + + /** + * Entrega una lista de objetos TgeneParroquia parroquias + * + * @return lparroquias Lista de objetos TgeneParroquia + */ + public List getLparroquias() { + return lparroquias; + } + + /** + * Fija una lista de objetos TgeneParroquia parroquias + * + * @param lparroquias Lista de objetos TgeneParroquia + */ + public void setLparroquias(List lparroquias) { + this.lparroquias = lparroquias; + } + + /** + * Entrega una lista de objetos TgeneCity ciudades + * + * @return lcities Lista de objetos TgeneCity + */ + public List getLcities() { + return lcities; + } + + /** + * Fija una lista de objetos TgeneCity ciudades + * + * @param lcities Lista de objetos TgeneCity + */ + public void setLcities(List lcities) { + this.lcities = lcities; + } + + /** + * Entrega Verdadero o Falso + * + * @return principal V/F + */ + public boolean isPrincipal() { + return principal; + } + + /** + * Fija Verdadero o Falso + * + * @param principal V/F + */ + public void setPrincipal(boolean principal) { + this.principal = principal; + } + + /** + * Entrega el código de persona + * + * @return personcode Código de persona + */ + public Integer getPersoncode() { + return personcode; + } + + /** + * Fija el código de persona + * + * @param personcode Código de persona + */ + public void setPersoncode(Integer personcode) { + this.personcode = personcode; + } + + /** + * Entrega Verdadero o Falso + * + * @return typeaddress V/F + */ + public boolean isTypeaddress() { + return typeaddress; + } + + /** + * Fija Verdadero o Falso + * + * @param typeaddress V/F + */ + public void setTypeaddress(boolean typeaddress) { + this.typeaddress = typeaddress; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/PersonDetailController.java b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/PersonDetailController.java new file mode 100644 index 0000000..5ba6bdb --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/PersonDetailController.java @@ -0,0 +1,257 @@ +package com.fp.frontend.controller.pcustomer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; + +/** + * Clase controladora del bean TcustPersonDetail. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class PersonDetailController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public PersonDetailController() throws Exception { + super(TcustPersonDetail.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + super.create(); + beanalias = "TCUSTPERSONDETAIL"; + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Agrega un par´metro para la conulta + * + * @param personcode Código de persona + */ + public void addPersoncodeFilter(String personcode) { + super.addFilter("pk.personcode", personcode); + record.getPk().setPersoncode(Integer.parseInt(personcode)); + } + + /** + * Método para procesar la consulta + * + * @return dto Objeto DtoQuery + * @throws Exception + */ + public DtoQuery getDtoQuery() throws Exception { + super.addFilterDateto(); + + DtoQuery dto = super.getDtoQuery(false); + + // subqueries + SubQuery subquery = new SubQuery("TgeneActivity", "description", "activitydesc", "i.pk = t.activitycode"); + dto.addSubQuery(subquery); + + SubQuery subquery1 = new SubQuery("TgeneActivity", "segmenttypecatalog", "segmenttypecatalog", "i.pk = t.activitycode"); + dto.addSubQuery(subquery1); + + SubQuery subquery2 = new SubQuery("TgeneCatalogDetail", "description", "segmentdesc", + "i.pk.catalogcode = 'SEGMENTTYPE' and i.pk.catalog = (select a.segmenttypecatalog from TgeneActivity a where a.pk = t.activitycode)"); + dto.addSubQuery(subquery2); + + SubQuery subqueryTipoIdentificacion = new SubQuery("TgeneCatalogDetail", "description", "destipoidentificacion", "i.pk.catalog = t.identificationcatalog and i.pk.catalogcode=t.identificationcatalogcode"); + dto.addSubQuery(subqueryTipoIdentificacion); + return dto; + } + + @Override + protected void querydatabase() { + try { + Request request = callerhelper.getRequest(); + + DtoQuery dto = this.getDtoQuery(); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + this.manageResponsePerson(resp); + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + protected void querydatabaseAll() { + try { + DtoQuery dto = super.getDtoQuery(true); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + SubQuery subqueryTipoIdentificacion = new SubQuery("TgeneCatalogDetail", "description", "destipoidentificacion", "i.pk.catalog = t.identificationcatalog and i.pk.catalogcode=t.identificationcatalogcode"); + dto.addSubQuery(subqueryTipoIdentificacion); + Request request = callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + super.postQuery(lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Controla la respuesta de la consulta + * + * @param resp Objeto Response + * @throws Exception + */ + public void manageResponsePerson(Response resp) throws Exception { + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + record = null; + MessageHelper.setMessageError(resp); + } else { + record = (TcustPersonDetail) resp.get(beanalias); + super.postQuery((AbstractDataTransport) resp.get(beanalias)); + } + } + + @Override + public void save() { + try { + Request request = callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, beanalias); + } + + public static TcustPersonDetail find(String codigopersona) { + try { + PersonDetailController cc = new PersonDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.personcode", codigopersona); + cc.addFilterDateto(); + cc.querydatabaseAll(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Autor Andres Cevallos + * + * @param identificacion + * @param tipoidentificacion + * @return Find para encontrar una persona por su identificacion y tipo de + * identificacion + */ + public static TcustPersonDetail findxidentification(String identificacion, String tipoidentificacion) { + try { + PersonDetailController cc = new PersonDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("identification", identificacion); + cc.addFilter("identificationcatalog", tipoidentificacion); + cc.addFilterDateto(); + cc.querydatabaseAll(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * @param identificacion + * @param tipoidentificacion + * @return Find para encontrar una persona por su identificacion + */ + public static TcustPersonDetail findByIdentification(String identificacion) { + try { + PersonDetailController cc = new PersonDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("identification", identificacion); + cc.addFilterDateto(); + cc.querydatabaseAll(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/PersonPhoneController.java b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/PersonPhoneController.java new file mode 100644 index 0000000..0714658 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/PersonPhoneController.java @@ -0,0 +1,331 @@ +package com.fp.frontend.controller.pcustomer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.company.TcustCompany; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pcustomer.gene.TcustPersonPhoneKey; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TcustPersonPhone. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class PersonPhoneController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public PersonPhoneController() throws Exception { + super(TcustPersonPhone.class); + } + + /** + * Atributo para la lista de objetos TgeneCatalogDetail para tipo de + * teléfono + */ + private List lphonetype; + + /** + * Atributo para el código de persona + */ + private Integer personcode; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + this.lphonetype = CatalogDetailController.find("PHONETYPE"); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.record = new TcustPersonPhone(); + this.record.setPk(new TcustPersonPhoneKey()); + this.beanalias = "TCUSTPERSONPHONE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Agrega el código de persona para la consulta + * + * @param personcode código de persona + */ + public void addPersoncodeFilter(String personcode) { + this.personcode = new Integer(personcode); + super.addFilter("pk.personcode", personcode); + } + + /** + * Método para armar la consulta + * + * @return dto Objeto DtoQuery + * @throws Exception + */ + public DtoQuery getDtoQuery() throws Exception { + super.addFilterDateto(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.phonesequence"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + // subqueries + SubQuery subquery = new SubQuery("TgeneCatalogDetail", "description", "phonetype", + "i.pk.catalogcode = t.phonetypecatalogcode and i.pk.catalog = t.phonetypecatalog"); + dto.addSubQuery(subquery); + return dto; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + + //Cargando el tipo de telefono + SubQuery subQueryTipoTelefono = new SubQuery("TgeneCatalogDetail", "description", + "phonetype", "i.pk.catalog=t.phonetypecatalog and i.pk.catalogcode=t.phonetypecatalogcode"); + dto.addSubQuery(subQueryTipoTelefono); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (lrecord != null && !lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Controla la respuesta de la consulta + * + * @param resp Objeto Response + * @throws Exception + */ + @SuppressWarnings("unchecked") + public void manageResponsePhones(Response resp) throws Exception { + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void update() { + try { +// this.record.getPk().setPersoncode(((this.personcode==null) || this.personcode.equals(0))?null:this.personcode); + if ((this.personcode == null) || (this.personcode == 0)) { + // this.record.getPk().setPhonesequence(this.getMaxNumber()); + } + this.record.setPhonetypecatalogcode("PHONETYPE"); + for (TgeneCatalogDetail detail : this.lphonetype) { + if (detail.getPk().getCatalog().equals(this.record.getPhonetypecatalog())) { + this.record.modifiedData.put("phonetype", detail.getDescription()); + } + } + super.update(); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Método que obtiene el max de direcciones + * + * @return max Número max + */ + private Integer getMaxNumber() { + Integer max = 0; + if (this.lrecord.size() > 0) { + for (TcustPersonPhone phone : this.lrecord) { + if (max.compareTo(phone.getPk().getPhonesequence()) < 0) { + max = phone.getPk().getPhonesequence(); + } + } + } + return max + 1; + } + + /** + * Actualiza el registro + */ + public void actualizar() { + try { + super.update(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + public static List findAll(String codigopersona, String codigoTelFijo) { + try { + PersonPhoneController cc = new PersonPhoneController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.personcode", codigopersona); + cc.addFilter("phonetypecatalog", codigoTelFijo); + cc.addFilterDateto(); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + public static TcustPersonPhone find(String codigopersona, String codigoTelFijo) { + try { + PersonPhoneController cc = new PersonPhoneController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.personcode", codigopersona); + cc.addFilter("phonetypecatalog", codigoTelFijo); + cc.addFilterDateto(); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + /** + * Obtiene todos los telefonos de una persona + * + * @param codigopersona + * @return + */ + public static List findAllByPersonCode(String codigopersona) { + try { + PersonPhoneController cc = new PersonPhoneController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.personcode", codigopersona); + cc.addFilter("pk.dateto", "2999-12-31"); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail tipo de teléfono + * + * @return lphonetype Lista de objetos TgeneCatalogDetail tipo de + * teléfono + */ + public List getLphonetype() { + return this.lphonetype; + } + + /** + * Fija una lista de objetos TgeneCatalogDetail tipo de teléfono + * + * @param lphonetype Lista de objetos TgeneCatalogDetail tipo de + * teléfono + */ + public void setLphonetype(List lphonetype) { + this.lphonetype = lphonetype; + } + + /** + * Entrega el código de persona + * + * @return personcode Código de persona + */ + public Integer getPersoncode() { + return this.personcode; + } + + /** + * Fija el código de persona + * + * @param personcode Código de persona + */ + public void setPersoncode(Integer personcode) { + this.personcode = personcode; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/PersonViewController.java b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/PersonViewController.java new file mode 100644 index 0000000..24f3221 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/PersonViewController.java @@ -0,0 +1,324 @@ +package com.fp.frontend.controller.pcustomer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmGroups; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TsafeUserDetail. + * + * @author Andres E. Carpio + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class PersonViewController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public PersonViewController() throws Exception { + super(TcustPersonDetail.class); + } + + @ManagedProperty(value = "#{peopleController}") + private PeopleController people; + + /** + * Atributo para la lista de objetos TgeneCatalogDetail de identificacion + */ + private List lidentification; + + /** + * Atributo para el listado de géneros + */ + private List lgender; + + /** + * Atributo para activar el keyFilter + */ + private boolean activeRegEx; + /** + * Atributo para la longitud de la identificación + */ + private String lengthId; + + @PostConstruct + private void postconstruct() { + this.lengthId = "10"; + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //List + this.lidentification = CatalogDetailController.find("IDENTIFICATION", "1"); + this.lgender = CatalogDetailController.getListGender(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.create(); + this.lrecord = new ArrayList<>(); + this.beanalias = "TCUSTPERSONDETAIL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if (super.getMfilters().get("sbsemployee") == null) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + super.addFilterDateto(); + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(false); + dto.setOrderby("t.pk.personcode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.create(); + //this.record = new TcustPersonDetail(); + MessageHelper.setMessageError(resp); + } else { + this.record = (TcustPersonDetail) resp.get(this.beanalias); + if (this.record != null) { + this.people.addPersoncodeFilter(this.record.getPk().getPersoncode().toString()); + this.people.query(); + } else { + this.create(); + } + super.postQuery(this.record); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + this.update(); + this.people.update(); + + DtoSave dtoSave = super.getDtoSave(true); + DtoSave dtoSavePeople = this.people.getDtoSave(true); + + HashMap msave = new HashMap(); + + if (dtoSave.pendingProcess()) { + msave.put(this.beanalias, dtoSave); + } + + if (dtoSavePeople.pendingProcess()) { + msave.put(this.people.getBeanalias(), dtoSavePeople); + } + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.people.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Cambio del ID + */ + public void onChangeId() { + if (this.record.getIdentificationcatalog().compareTo("CED") == 0) { + this.lengthId = "10"; + this.activeRegEx = false; + } else if (this.record.getIdentificationcatalog().compareTo("PAS") == 0) { + this.lengthId = "13"; + this.activeRegEx = true; + } + } + + /** + * Abre el lob de empleados sbs + */ + public void openPersonViewLov() { + Map> params = new HashMap<>(); + PersonViewLovController.openLov(params); + } + + /** + * Maneja la respuesta del lov de empleados sbs + * + * @param event + * @throws Exception + */ + public void onReturnPersonViewLov(SelectEvent event) throws Exception { + Object[] t = (Object[]) event.getObject(); + super.addFilter("sbsemployee", (String) t[0]); + super.addField("personname", (String) t[2] + " " + (String) t[1]); + this.querydatabase(); + + if (this.record.getPk().getPersoncode() == null) { + this.record.setName((String) t[2] + " " + (String) t[1]); + this.record.setIdentification((String) t[4]); + this.record.setSbsemployee((String) t[0]); + this.record.setSbsusercode((String) t[3]); + this.record.setIdentificationcatalogcode("IDENTIFICATION"); + this.people.getRecord().setFirstname(this.getName((String) t[2], true));; + this.people.getRecord().setMiddlename(this.getName((String) t[2], false)); + this.people.getRecord().setLastname(this.getName((String) t[1], true)); + this.people.getRecord().setSurename(this.getName((String) t[1], false)); + } + + } + + /** + * Arma el nombre del funcionario + * + * @param firstname nombre + * @param first v/f + * @return name + */ + public String getName(String firstname, boolean first) { + String[] value = firstname.split(" "); + String name = ""; + for (int i = 0; i < value.length; i++) { + if (i == 0 && first) { + name = value[i]; + } else if (i > 0 && !first) { + name = name + ((name.length() == 0) ? "" : " ") + value[i]; + } + } + return name; + } + + /** + * Entrega Verdadero/Falso + * + * @return activeNotEconomic V/F + */ + public boolean isActiveRegEx() { + return this.activeRegEx; + } + + /** + * Fija Verdadero/Falso + * + * @param activeNotEconomic V/F + */ + public void setActiveRegEx(boolean activeRegEx) { + this.activeRegEx = activeRegEx; + } + + /** + * Entrega el número de digitos para el tipo de identificaci&oacuye;n + * + * @return lengthId Número de digitos + */ + public String getLengthId() { + return this.lengthId; + } + + /** + * Fija el número de digitos para el tipo de identificaci&oacuye;n + * + * @param lengthId Número de digitos + */ + public void setLengthId(String lengthId) { + this.lengthId = lengthId; + } + + /** + * Entrega lista de objetos TgeneCatalogDetail tipo de identificación + * + * @return lidentification Lista de objetos TgeneCatalogDetail + */ + public List getLidentification() { + return this.lidentification; + } + + /** + * Fija lista de objetos TgeneCatalogDetail tipo de identificación + * + * @param lidentification Lista de objetos TgeneCatalogDetail + */ + public void setLidentification(List lidentification) { + this.lidentification = lidentification; + } + + /** + * Entrega la lista de géneros + * + * @return lgender Lista de géneros + */ + public List getLgender() { + return this.lgender; + } + + /** + * Fija la lista de géneros + * + * @param lgender Lista de géneros + */ + public void setLgender(List lgender) { + this.lgender = lgender; + } + + /** + * Entrega el valor de: persondetail + * + * @return PersonDetailController + */ + public PeopleController getPeople() { + return this.people; + } + + /** + * Fija el valor de: persondetail + * + * @param people Valor a fijar en el atributo. + */ + public void setPeople(PeopleController people) { + this.people = people; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/PersonViewLovController.java b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/PersonViewLovController.java new file mode 100644 index 0000000..456a779 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/PersonViewLovController.java @@ -0,0 +1,156 @@ +package com.fp.frontend.controller.pcustomer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; + +/** + * Clase controladora del bean TsafeUserDetail. + * + * @author Andres E. Carpio + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class PersonViewLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public PersonViewLovController() throws Exception { + super(AbstractDataTransport.class); + } + + /** + * Atributo para la lista de empleados sbs + */ + private List lemployee; + + /** + * Atributo para el objeto empleado seleccionado + */ + private Object[] employee; + + /** + * Post construct + * + * @throws Exception + */ + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "EMPLOYEESBS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + request.put("querytype", "P"); + request.put("queryalias", "EMPLOYEESBS"); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lemployee = new ArrayList<>(); + MessageHelper.setMessageError(resp); + } else { + this.lemployee = (List) resp.get(this.beanalias); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setEmployee() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.employee); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + // lovpersona es el nombre de la pagina + RequestContext.getCurrentInstance().openDialog("/pages/customer/lov/personViewLov.xhtml", options, params); + } + + /** + * Entrega una lista de arreglo de objetos + * + * @return lemployee + */ + public List getLemployee() { + return lemployee; + } + + /** + * Fija una lista de arreglo de objetos + * + * @param lemployee + */ + public void setLemployee(List lemployee) { + this.lemployee = lemployee; + } + + /** + * Entrega un objeto employee + * + * @return employee + */ + public Object[] getEmployee() { + return employee; + } + + /** + * FIna un objeto employee + * + * @param employee + */ + public void setEmployee(Object[] employee) { + this.employee = employee; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/lov/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/lov/.svn/entries new file mode 100644 index 0000000..ad7f349 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/lov/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/pcustomer/lov +svn://172.17.26.185/COMACO + + + +2016-01-20T17:08:28.980461Z +4390 +mcepeda + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +JuridicalPersonLovController.java +file + + + + +2022-07-28T03:39:46.368559Z +d254584e8de4b8a61aef69842c3a19ec +2015-04-11T04:37:08.350787Z +4025 +cpiedra + + + + + + + + + + + + + + + + + + + + + +6156 + +PersonLovController.java +file + + + + +2022-07-28T03:39:46.368559Z +fa8f6e7606e5fa076d14edcbb339d185 +2016-01-20T17:08:28.980461Z +4390 +mcepeda + + + + + + + + + + + + + + + + + + + + + +8204 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/lov/.svn/text-base/JuridicalPersonLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/lov/.svn/text-base/JuridicalPersonLovController.java.svn-base new file mode 100644 index 0000000..a02177c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/lov/.svn/text-base/JuridicalPersonLovController.java.svn-base @@ -0,0 +1,183 @@ +package com.fp.frontend.controller.pcustomer.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +/** + * Clase controladora del lov asociado al bean TsafeUserDetail. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class JuridicalPersonLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public JuridicalPersonLovController() throws Exception { + super(TcustPersonDetail.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + /** + * codigo del telefono fijo + */ + private String codigoTelefonoFijo; + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PERSONLOV"; + codigoTelefonoFijo=codigos("CODIGO.PHONE.FIJO"); + String juridica = CallerHelper.getLovParameter("isJuridical"); + if(juridica!=null){ + this.getMfilters().put("identificationcatalog", juridica); + this.getMfilters().put("pk.dateto", "2999-12-31"); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void querydatabaseFiltro(String documento) { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.name"); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + Filter sql= new Filter(); + sql.setSql("t.identificationcatalog='PAS' or t.identificationcatalog='RUC'"); + dto.addFiltro(sql); + + //super.addFilter("identificationcatalog", documento); + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.name"); + this.getMfilters().put("pk.dateto", "2999-12-31"); + addFilterDateto(); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if(!lrecord.isEmpty()){ + record=lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setperson() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setPerson(TcustPersonDetail person) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(person); + } + + /** + * Entrega los datos vigentes de una persona dado el codigo de persona. + * @param personcode + * @return + * @throws Exception + */ + public static TcustPersonDetail find(String personcode) throws Exception{ + PersonLovController p = new PersonLovController(); + p.addFilter("pk.personcode", personcode); + p.querydatabase(); + List l = p.getLrecord(); + if(!l.isEmpty()){ + return l.get(0); + } + return null; + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), true); + + // lovpersona es el nombre de la pagina + RequestContext.getCurrentInstance().openDialog("/pages/customer/lov/juridicalLov.xhtml", options, params); + } + + /** + * Metodo para obtener los codigos + */ + public String codigos(String parametro){ + TgeneParameters tgeneParameters= ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/lov/.svn/text-base/PersonLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/lov/.svn/text-base/PersonLovController.java.svn-base new file mode 100644 index 0000000..d395f94 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/lov/.svn/text-base/PersonLovController.java.svn-base @@ -0,0 +1,207 @@ +package com.fp.frontend.controller.pcustomer.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +/** + * Clase controladora del lov asociado al bean TsafeUserDetail. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class PersonLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public PersonLovController() throws Exception { + super(TcustPersonDetail.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + /** + * codigo del telefono fijo + */ + private String codigoTelefonoFijo; + String natural; + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + public void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PERSONLOV"; + codigoTelefonoFijo=codigos("CODIGO.PHONE.FIJO"); + natural = CallerHelper.getLovParameter("natural"); +// if(natural!=null){ +// this.getMfilters().put("identificationcatalog", natural); +// } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void querydatabaseFiltro(String documento) { + try { +// if (!super.existAtLeastOneFilterValue()) { +// MessageHelper.setMessageError("msg_filterrequird"); +// return; +// } + super.addFilterDateto(); + // super.addFilter("identificationcatalog", documento); + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.name"); + + SubQuery subqueryTipoIdentificacion= new SubQuery + ("TgeneCatalogDetail", "description", "destipoidentificacion", "i.pk.catalog = t.identificationcatalog and i.pk.catalogcode=t.identificationcatalogcode"); + dto.addSubQuery(subqueryTipoIdentificacion); + + SubQuery subqueryTelefono= new SubQuery + ("TcustPersonPhone", "phonenumber", "telefono", "i.pk.personcode = t.pk.personcode and i.pk.dateto=t.pk.dateto and i.phonetypecatalog="+codigoTelefonoFijo+" and i.pk.phonesequence = (select max(b.pk.phonesequence) from TcustPersonPhone b where b.pk.personcode = t.pk.personcode and b.phonetypecatalog = "+codigoTelefonoFijo+")"); + dto.addSubQuery(subqueryTelefono); + + if(natural!=null){ + Filter filter= new Filter(); + filter.setSql(" (t.identificationcatalog='CED' or t.identificationcatalog='PAS') "); + dto.addFiltro(filter); + } + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { +// if (!super.existAtLeastOneFilterValue()) { +// MessageHelper.setMessageError("msg_filterrequird"); +// return; +// } + super.addFilterDateto(); + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.name"); + + SubQuery subqueryTipoIdentificacion= new SubQuery + ("TgeneCatalogDetail", "description", "destipoidentificacion", "i.pk.catalog = t.identificationcatalog and i.pk.catalogcode=t.identificationcatalogcode"); + dto.addSubQuery(subqueryTipoIdentificacion); + + SubQuery subqueryTelefono= new SubQuery + ("TcustPersonPhone", "phonenumber", "telefono", "i.pk.personcode = t.pk.personcode and i.pk.dateto=t.pk.dateto and i.phonetypecatalog="+codigoTelefonoFijo+" and i.pk.phonesequence = (select max(b.pk.phonesequence) from TcustPersonPhone b where b.pk.personcode = t.pk.personcode and b.phonetypecatalog = "+codigoTelefonoFijo+")"); + dto.addSubQuery(subqueryTelefono); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setperson() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setPerson(TcustPersonDetail person) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(person); + } + + /** + * Entrega los datos vigentes de una persona dado el codigo de persona. + * @param personcode + * @return + * @throws Exception + */ + public static TcustPersonDetail find(String personcode) throws Exception{ + PersonLovController p = new PersonLovController(); + p.addFilter("pk.personcode", personcode); + p.querydatabase(); + List l = p.getLrecord(); + if(!l.isEmpty()){ + return l.get(0); + } + return null; + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), true); + + // lovpersona es el nombre de la pagina + RequestContext.getCurrentInstance().openDialog("/pages/customer/lov/personLov.xhtml", options, params); + } + + /** + * Metodo para obtener los codigos + */ + public String codigos(String parametro){ + TgeneParameters tgeneParameters= ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/lov/JuridicalPersonLovController.java b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/lov/JuridicalPersonLovController.java new file mode 100644 index 0000000..ed003e1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/lov/JuridicalPersonLovController.java @@ -0,0 +1,184 @@ +package com.fp.frontend.controller.pcustomer.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +/** + * Clase controladora del lov asociado al bean TsafeUserDetail. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class JuridicalPersonLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public JuridicalPersonLovController() throws Exception { + super(TcustPersonDetail.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + /** + * codigo del telefono fijo + */ + private String codigoTelefonoFijo; + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PERSONLOV"; + codigoTelefonoFijo = codigos("CODIGO.PHONE.FIJO"); + String juridica = CallerHelper.getLovParameter("isJuridical"); + if (juridica != null) { + this.getMfilters().put("identificationcatalog", juridica); + this.getMfilters().put("pk.dateto", "2999-12-31"); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void querydatabaseFiltro(String documento) { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.name"); + + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + Filter sql = new Filter(); + sql.setSql("t.identificationcatalog='PAS' or t.identificationcatalog='RUC'"); + dto.addFiltro(sql); + + //super.addFilter("identificationcatalog", documento); + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.name"); + this.getMfilters().put("pk.dateto", "2999-12-31"); + addFilterDateto(); + HashMap mtables = new HashMap(); + mtables.put(beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + lrecord = (List) resp.get(beanalias); + if (!lrecord.isEmpty()) { + record = lrecord.get(0); + } + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setperson() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setPerson(TcustPersonDetail person) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(person); + } + + /** + * Entrega los datos vigentes de una persona dado el codigo de persona. + * + * @param personcode + * @return + * @throws Exception + */ + public static TcustPersonDetail find(String personcode) throws Exception { + PersonLovController p = new PersonLovController(); + p.addFilter("pk.personcode", personcode); + p.querydatabase(); + List l = p.getLrecord(); + if (!l.isEmpty()) { + return l.get(0); + } + return null; + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), true); + + // lovpersona es el nombre de la pagina + RequestContext.getCurrentInstance().openDialog("/pages/customer/lov/juridicalLov.xhtml", options, params); + } + + /** + * Metodo para obtener los codigos + */ + public String codigos(String parametro) { + TgeneParameters tgeneParameters = ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pcustomer/lov/PersonLovController.java b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/lov/PersonLovController.java new file mode 100644 index 0000000..eda8191 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pcustomer/lov/PersonLovController.java @@ -0,0 +1,205 @@ +package com.fp.frontend.controller.pcustomer.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +/** + * Clase controladora del lov asociado al bean TsafeUserDetail. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class PersonLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public PersonLovController() throws Exception { + super(TcustPersonDetail.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + /** + * codigo del telefono fijo + */ + private String codigoTelefonoFijo; + String natural; + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + public void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PERSONLOV"; + codigoTelefonoFijo = codigos("CODIGO.PHONE.FIJO"); + natural = CallerHelper.getLovParameter("natural"); +// if(natural!=null){ +// this.getMfilters().put("identificationcatalog", natural); +// } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void querydatabaseFiltro(String documento) { + try { +// if (!super.existAtLeastOneFilterValue()) { +// MessageHelper.setMessageError("msg_filterrequird"); +// return; +// } + super.addFilterDateto(); + // super.addFilter("identificationcatalog", documento); + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.name"); + + SubQuery subqueryTipoIdentificacion = new SubQuery("TgeneCatalogDetail", "description", "destipoidentificacion", "i.pk.catalog = t.identificationcatalog and i.pk.catalogcode=t.identificationcatalogcode"); + dto.addSubQuery(subqueryTipoIdentificacion); + + SubQuery subqueryTelefono = new SubQuery("TcustPersonPhone", "phonenumber", "telefono", "i.pk.personcode = t.pk.personcode and i.pk.dateto=t.pk.dateto and i.phonetypecatalog='" + codigoTelefonoFijo + "' and i.pk.phonesequence = (select max(b.pk.phonesequence) from TcustPersonPhone b where b.pk.personcode = t.pk.personcode and b.phonetypecatalog = '" + codigoTelefonoFijo + "')"); + dto.addSubQuery(subqueryTelefono); + + if (natural != null) { + Filter filter = new Filter(); + filter.setSql(" (t.identificationcatalog='CED' or t.identificationcatalog='PAS') "); + dto.addFiltro(filter); + } + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { +// if (!super.existAtLeastOneFilterValue()) { +// MessageHelper.setMessageError("msg_filterrequird"); +// return; +// } + super.addFilterDateto(); + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.name"); + + SubQuery subqueryTipoIdentificacion = new SubQuery("TgeneCatalogDetail", "description", "destipoidentificacion", "i.pk.catalog = t.identificationcatalog and i.pk.catalogcode=t.identificationcatalogcode"); + dto.addSubQuery(subqueryTipoIdentificacion); + + SubQuery subqueryTelefono = new SubQuery("TcustPersonPhone", "phonenumber", "telefono", "i.pk.personcode = t.pk.personcode and i.pk.dateto=t.pk.dateto and i.phonetypecatalog='" + codigoTelefonoFijo + "' and i.pk.phonesequence = (select max(b.pk.phonesequence) from TcustPersonPhone b where b.pk.personcode = t.pk.personcode and b.phonetypecatalog = '" + codigoTelefonoFijo + "')"); + dto.addSubQuery(subqueryTelefono); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setperson() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setPerson(TcustPersonDetail person) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(person); + } + + /** + * Entrega los datos vigentes de una persona dado el codigo de persona. + * + * @param personcode + * @return + * @throws Exception + */ + public static TcustPersonDetail find(String personcode) throws Exception { + PersonLovController p = new PersonLovController(); + p.addFilter("pk.personcode", personcode); + p.querydatabase(); + List l = p.getLrecord(); + if (!l.isEmpty()) { + return l.get(0); + } + return null; + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), true); + + // lovpersona es el nombre de la pagina + RequestContext.getCurrentInstance().openDialog("/pages/customer/lov/personLov.xhtml", options, params); + } + + /** + * Metodo para obtener los codigos + */ + public String codigos(String parametro) { + TgeneParameters tgeneParameters = ParametersController.find(parametro, "1"); + return tgeneParameters.getTextvalue(); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pentaho/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/pentaho/.svn/entries new file mode 100644 index 0000000..777f2f5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pentaho/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/pentaho +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +PentahoController.java +file + + + + +2022-07-28T03:39:55.911601Z +8801e94e5b11e6dee8b268e3268e3b34 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +7331 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pentaho/.svn/text-base/PentahoController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pentaho/.svn/text-base/PentahoController.java.svn-base new file mode 100644 index 0000000..828d74e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pentaho/.svn/text-base/PentahoController.java.svn-base @@ -0,0 +1,255 @@ +package com.fp.frontend.controller.pentaho; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.primefaces.model.DefaultStreamedContent; +import org.primefaces.model.StreamedContent; + +import com.fp.common.properties.PropertiesHandler; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.utility.Content; + +/** + * Clase controladora de Pentaho + * @author WPA + * + */ +@ManagedBean +@ViewScoped +public class PentahoController { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Constuctor + */ + public PentahoController() { + // TODO Auto-generated constructor stub + } + /** + * Inject LoginController + */ + @ManagedProperty(value= "#{loginController}") + private LoginController logincontroler; + /** + * Atributo para la lista tipos de formato + */ + protected List lcontent; + /** + * Atributo para el tipo de formato + */ + private String type; + /** + * Atributo para activar un componente + */ + private boolean active; + /** + * Atributo para el reporte a descargar + */ + private StreamedContent streamedContent; + /** + * Post construct + */ + @PostConstruct + public void postConstruct(){ + this.loadContent(); + } + + /** + * Carga la lista del content type + */ + public void loadContent() { + this.lcontent = new ArrayList(); + this.lcontent.add(new Content("PDF", "application/pdf", "pdf")); + this.lcontent.add(new Content("EXCEL", "application/vnd.ms-excel", "xls")); + } + /** + * Obtiene la url del BI-Server + * @param reporte nombre del reporte.xaction + * @param parameters Mapa de parametros + * @param type Tipo de archivo + * @return url + * @throws Exception + */ + private String getUrlPentaho(String reporte, Map parameters, String type) throws Exception { + PropertiesHandler ph = new PropertiesHandler("pentaho"); + + String url = ph.getStringValue("url_pentaho"); + String auth = ph.getStringValue("pentaho_authenticate"); + + StringBuilder urlPentaho = new StringBuilder(url); + if(auth.equals("N")){ + urlPentaho.append(reporte).append(".xaction").append("&userid=").append("&password="); + }else{ + urlPentaho.append(reporte).append(".xaction").append("&userid=").append(ph.getStringValue("usr_pentaho")).append("&password=").append(ph.getStringValue("pass_pentaho")); + } + Set keys = parameters.keySet(); + for (String key : keys) { + urlPentaho.append("&").append(key).append("=").append(parameters.get(key)); + } + return urlPentaho.append("&outputType=").append(type).toString(); + } + + /** + * Crea el reporte. + * + * @param reporte Nombre del reporte + * @param parameters Mapa de parámetros + * @param type Tipo de reporte + * @throws Exception + */ + private StreamedContent generateReport(String reporte, Map parameters, String type) throws Exception { + String content = ""; + + // se ejecuta la llamada al recurso xaction de pentaho + InputStream inputStream = this.generateTemporalReport(reporte, parameters, type); + + for (Content con : this.lcontent) { + if (type.equals(con.getExtension())) { + content = con.getContentType(); + } + } + return new DefaultStreamedContent(inputStream, content, reporte+"."+type); + } + + /** + * Crea el reporte. + * + * @param reporte Nombre del reporte + * @param parameters Mapa de parámetros + * @param type Tipo de reporte + * @throws Exception + */ + //@SuppressWarnings("deprecation") + public InputStream generateTemporalReport(String reporte, Map parameters, String type) throws Exception { + + // Cliente java + DefaultHttpClient cliente = new DefaultHttpClient(); + //HttpClient cliente = HttpClientBuilder.create().build(); + + String url = this.getUrlPentaho(reporte, parameters, type).replace(" ", "%20"); + + // ACTION HTTP POST + + HttpPost httpPost = new HttpPost(url); + HttpResponse httpResponse = cliente.execute(httpPost); + InputStream inputStream = httpResponse.getEntity().getContent(); + //cliente.close(); + return inputStream; + } + /** + * Llamada al reporte pentaho + * @throws Exception + */ + public void getReport(String nomReporte, Map parameters) throws Exception { + this.streamedContent = this.generateReport(nomReporte, parameters, this.type==null?"pdf":this.type); + } + /** + * Evento al cambiar el tipo de reporte + * @throws Exception + */ + public void changeType() throws Exception{ + if(this.type.equals("PDF")){ + this.active = true; + //this.generarReporte(); + }else{ + this.active = true; + } + } + /** + * Entrega la instancia de LoginController + * @return loginController + */ + public LoginController getLogincontroler() { + return logincontroler; + } + /** + * Fija la instancia de LoginController + * @param loginController + */ + public void setLogincontroler(LoginController logincontroler) { + this.logincontroler = logincontroler; + } + /** + * Entrega la lista de contentType + * + * @return lcontent + */ + public List getLcontent() { + return this.lcontent; + } + + /** + * Fija una lista de contentType + * + * @param lcontent + */ + public void setLcontent(List lcontent) { + this.lcontent = lcontent; + } + /** + * Entrega ek tipo de formato + * @return type + */ + public String getType() { + return type; + } + /** + * Fija ek tipo de formato + * @param type + */ + public void setType(String type) { + this.type = type; + } + /** + * Entrega V/F si es activo + * @return active + */ + public boolean isActive() { + return active; + } + /** + * False V/F si es activo + * @param active + */ + public void setActive(boolean active) { + this.active = active; + } + /** + * Entrega el objeto StreamedContent + * @return streamedContent + */ + public StreamedContent getStreamedContent() { + if (FacesContext.getCurrentInstance().getRenderResponse()) { + return new DefaultStreamedContent(); + } else { + return streamedContent; + } + } + + /** + * Fija el objeto StreamedContent + * @param streamedContent + */ + public void setStreamedContent(StreamedContent streamedContent) { + this.streamedContent = streamedContent; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pentaho/PentahoController.java b/frontend/src/main/java/com/fp/frontend/controller/pentaho/PentahoController.java new file mode 100644 index 0000000..a9588c9 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pentaho/PentahoController.java @@ -0,0 +1,278 @@ +package com.fp.frontend.controller.pentaho; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.primefaces.model.DefaultStreamedContent; +import org.primefaces.model.StreamedContent; + +import com.fp.common.properties.PropertiesHandler; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.utility.Content; + +/** + * Clase controladora de Pentaho + * + * @author WPA + * + */ +@ManagedBean +@ViewScoped +public class PentahoController { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Constuctor + */ + public PentahoController() { + // TODO Auto-generated constructor stub + } + /** + * Inject LoginController + */ + @ManagedProperty(value = "#{loginController}") + private LoginController logincontroler; + /** + * Atributo para la lista tipos de formato + */ + protected List lcontent; + /** + * Atributo para el tipo de formato + */ + private String type; + /** + * Atributo para activar un componente + */ + private boolean active; + /** + * Atributo para el reporte a descargar + */ + private StreamedContent streamedContent; + + /** + * Post construct + */ + @PostConstruct + public void postConstruct() { + this.loadContent(); + } + + /** + * Carga la lista del content type + */ + public void loadContent() { + this.lcontent = new ArrayList(); + this.lcontent.add(new Content("PDF", "application/pdf", "pdf")); + this.lcontent.add(new Content("EXCEL", "application/vnd.ms-excel", "xls")); + } + + /** + * Obtiene la url del BI-Server + * + * @param reporte nombre del reporte.xaction + * @param parameters Mapa de parametros + * @param type Tipo de archivo + * @return url + * @throws Exception + */ + private String getUrlPentaho(String reporte, Map parameters, String type) throws Exception { + PropertiesHandler ph = new PropertiesHandler("pentaho"); + + String url = ph.getStringValue("url_pentaho"); + String auth = ph.getStringValue("pentaho_authenticate"); + + StringBuilder urlPentaho = new StringBuilder(url); + if (auth.equals("N")) { + urlPentaho.append(reporte).append(".xaction").append("&userid=").append("&password="); + } else { + urlPentaho.append(reporte).append(".xaction").append("&userid=").append(ph.getStringValue("usr_pentaho")).append("&password=").append(ph.getStringValue("pass_pentaho")); + } + Set keys = parameters.keySet(); + for (String key : keys) { + urlPentaho.append("&").append(key).append("=").append(parameters.get(key)); + } + return urlPentaho.append("&outputType=").append(type).toString(); + } + + /** + * Crea el reporte. + * + * @param reporte Nombre del reporte + * @param parameters Mapa de parámetros + * @param type Tipo de reporte + * @throws Exception + */ + private StreamedContent generateReport(String reporte, Map parameters, String type) throws Exception { + String content = ""; + + // se ejecuta la llamada al recurso xaction de pentaho + InputStream inputStream = this.generateTemporalReport(reporte, parameters, type); + + for (Content con : this.lcontent) { + if (type.equals(con.getExtension())) { + content = con.getContentType(); + } + } + return new DefaultStreamedContent(inputStream, content, reporte + "." + type); + } + + /** + * Crea el reporte. + * + * @param reporte Nombre del reporte + * @param parameters Mapa de parámetros + * @param type Tipo de reporte + * @throws Exception + */ + //@SuppressWarnings("deprecation") + public InputStream generateTemporalReport(String reporte, Map parameters, String type) throws Exception { + + // Cliente java + DefaultHttpClient cliente = new DefaultHttpClient(); + //HttpClient cliente = HttpClientBuilder.create().build(); + + String url = this.getUrlPentaho(reporte, parameters, type).replace(" ", "%20"); + + // ACTION HTTP POST + HttpPost httpPost = new HttpPost(url); + HttpResponse httpResponse = cliente.execute(httpPost); + InputStream inputStream = httpResponse.getEntity().getContent(); + //cliente.close(); + return inputStream; + } + + /** + * Llamada al reporte pentaho + * + * @throws Exception + */ + public void getReport(String nomReporte, Map parameters) throws Exception { + this.streamedContent = this.generateReport(nomReporte, parameters, this.type == null ? "pdf" : this.type); + } + + /** + * Evento al cambiar el tipo de reporte + * + * @throws Exception + */ + public void changeType() throws Exception { + if (this.type.equals("PDF")) { + this.active = true; + //this.generarReporte(); + } else { + this.active = true; + } + } + + /** + * Entrega la instancia de LoginController + * + * @return loginController + */ + public LoginController getLogincontroler() { + return logincontroler; + } + + /** + * Fija la instancia de LoginController + * + * @param loginController + */ + public void setLogincontroler(LoginController logincontroler) { + this.logincontroler = logincontroler; + } + + /** + * Entrega la lista de contentType + * + * @return lcontent + */ + public List getLcontent() { + return this.lcontent; + } + + /** + * Fija una lista de contentType + * + * @param lcontent + */ + public void setLcontent(List lcontent) { + this.lcontent = lcontent; + } + + /** + * Entrega ek tipo de formato + * + * @return type + */ + public String getType() { + return type; + } + + /** + * Fija ek tipo de formato + * + * @param type + */ + public void setType(String type) { + this.type = type; + } + + /** + * Entrega V/F si es activo + * + * @return active + */ + public boolean isActive() { + return active; + } + + /** + * False V/F si es activo + * + * @param active + */ + public void setActive(boolean active) { + this.active = active; + } + + /** + * Entrega el objeto StreamedContent + * + * @return streamedContent + */ + public StreamedContent getStreamedContent() { + if (FacesContext.getCurrentInstance().getRenderResponse()) { + return new DefaultStreamedContent(); + } else { + return streamedContent; + } + } + + /** + * Fija el objeto StreamedContent + * + * @param streamedContent + */ + public void setStreamedContent(StreamedContent streamedContent) { + this.streamedContent = streamedContent; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/.svn/entries new file mode 100644 index 0000000..d3767c3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/.svn/entries @@ -0,0 +1,64 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/pgeneral +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +lov +dir + +product +dir + +firmas +dir + +proc +dir + +menu +dir + +message +dir + +acco +dir + +trans +dir + +date +dir + +gene +dir + +result +dir + +safe +dir + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/acco/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/acco/.svn/entries new file mode 100644 index 0000000..02dafea --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/acco/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/pgeneral/acco +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +AccountStatusController.java +file + + + + +2022-07-28T03:39:55.352598Z +a60590645bf290ad1dcaafc000de70ad +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4355 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/acco/.svn/text-base/AccountStatusController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/acco/.svn/text-base/AccountStatusController.java.svn-base new file mode 100644 index 0000000..3901803 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/acco/.svn/text-base/AccountStatusController.java.svn-base @@ -0,0 +1,155 @@ +package com.fp.frontend.controller.pgeneral.acco; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.CatalogLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.acco.TgeneAccountStatus; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; + +/** + * Clase controladora del bean TgeneCatalogDetail. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class AccountStatusController extends AbstractController { + + public AccountStatusController() throws Exception { + super(TgeneAccountStatus.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 50; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "ACCOUNTSTATUS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public void openCatalogLov() { + Map> params = new HashMap<>(); + CatalogLovController.openLov(params); + } + + public void onReturnCatalogLov(SelectEvent event) throws Exception { + TgeneCatalog t = (TgeneCatalog) event.getObject(); + super.addFilter("pk.catalogcode", t.getPk()); + super.addField("catalogname", t.getDescription()); + this.query(); + } + + /** + * Entrega una lista de TgeneAccountStatus. + * @param modulecode Codigo de modulo a buscar estatus de cuentas. + * @return + */ + public static List find(String modulecode) { + try { + AccountStatusController asc = new AccountStatusController(); + asc.init(); + asc.recperpage = 300; + asc.addFilter("pk.modulecode", modulecode); + asc.addFilter("isaccountstatus", "Y"); + asc.querydatabase(); + if ((asc.lrecord != null) && !asc.lrecord.isEmpty()) { + return asc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/acco/AccountStatusController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/acco/AccountStatusController.java new file mode 100644 index 0000000..2a0f799 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/acco/AccountStatusController.java @@ -0,0 +1,154 @@ +package com.fp.frontend.controller.pgeneral.acco; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.CatalogLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.acco.TgeneAccountStatus; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; + +/** + * Clase controladora del bean TgeneCatalogDetail. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class AccountStatusController extends AbstractController { + + public AccountStatusController() throws Exception { + super(TgeneAccountStatus.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 50; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "ACCOUNTSTATUS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public void openCatalogLov() { + Map> params = new HashMap<>(); + CatalogLovController.openLov(params); + } + + public void onReturnCatalogLov(SelectEvent event) throws Exception { + TgeneCatalog t = (TgeneCatalog) event.getObject(); + super.addFilter("pk.catalogcode", t.getPk()); + super.addField("catalogname", t.getDescription()); + this.query(); + } + + /** + * Entrega una lista de TgeneAccountStatus. + * + * @param modulecode Codigo de modulo a buscar estatus de cuentas. + * @return + */ + public static List find(String modulecode) { + try { + AccountStatusController asc = new AccountStatusController(); + asc.init(); + asc.recperpage = 300; + asc.addFilter("pk.modulecode", modulecode); + asc.addFilter("isaccountstatus", "Y"); + asc.querydatabase(); + if ((asc.lrecord != null) && !asc.lrecord.isEmpty()) { + return asc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/date/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/date/.svn/entries new file mode 100644 index 0000000..d0acdbe --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/date/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/pgeneral/date +svn://172.17.26.185/COMACO + + + +2014-11-05T06:52:57.748518Z +2340 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TgeneNotAccountingDayController.java +file + + + + +2022-07-28T03:39:55.455599Z +7ddb790ba13347ad1233146417d0c66d +2014-11-05T06:52:57.748518Z +2340 +fpazmino + + + + + + + + + + + + + + + + + + + + + +10003 + +GenerateAccountingDateController.java +file + + + + +2022-07-28T03:39:55.455599Z +9c5d6338077c910ad17cd8e11f36b718 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5343 + +TgeneAccountingDateBranchController.java +file + + + + +2022-07-28T03:39:55.456599Z +fdc12ef3ee7ed26819244cf97da5a239 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4126 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/date/.svn/text-base/GenerateAccountingDateController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/date/.svn/text-base/GenerateAccountingDateController.java.svn-base new file mode 100644 index 0000000..21043fb --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/date/.svn/text-base/GenerateAccountingDateController.java.svn-base @@ -0,0 +1,200 @@ +package com.fp.frontend.controller.pgeneral.date; + +import java.sql.Date; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; + +/** + * Clase controladora que se encarga de la genracion de calendario de fechas en la tabla TgeneAccountingDate. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class GenerateAccountingDateController extends AbstractController { + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{tgeneAccountingDateBranchController}") + private TgeneAccountingDateBranchController accountingdate; + + /** + * Lista de dias de domingo a sabado a indicar si es contable o no. + */ + List> ldays; + /** + * Fecha desde la cual se genera el calendaio contable. + */ + private Date initdate; + /** + * Fecha hasta la cual se genera el calendario contable. + */ + private Date enddate; + + public GenerateAccountingDateController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "LISTACCOUNTINDATE"; + ldays = new ArrayList<>(); + this.consultadias(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Entrega el valor de: accountingdate + * @return TgeneAccountingDateBranchController + */ + public TgeneAccountingDateBranchController getAccountingdate() { + return accountingdate; + } + + /** + * Fija el valor de: accountingdate + * @param accountingdate Valor a fijar en el atributo. + */ + + public void setAccountingdate(TgeneAccountingDateBranchController accountingdate) { + this.accountingdate = accountingdate; + } + + /** + * Entrega el valor de: ldays + * @return List> + */ + public List> getLdays() { + return ldays; + } + + /** + * Fija el valor de: ldays + * @param ldays Valor a fijar en el atributo. + */ + public void setLdays(List> ldays) { + this.ldays = ldays; + } + + /** + * Entrega el valor de: initdate + * @return Date + */ + public Date getInitdate() { + return initdate; + } + + /** + * Fija el valor de: initdate + * @param initdate Valor a fijar en el atributo. + */ + + public void setInitdate(Date initdate) { + this.initdate = initdate; + } + + /** + * Entrega el valor de: enddate + * @return Date + */ + public Date getEnddate() { + return enddate; + } + + /** + * Fija el valor de: enddate + * @param enddate Valor a fijar en el atributo. + */ + + public void setEnddate(Date enddate) { + this.enddate = enddate; + } + + @Override + protected void querydatabase() { + } + + @SuppressWarnings("unchecked") + private void consultadias() throws Exception { + try { + Request request = this.callerhelper.getRequest(); + request.modifiedData().put("querytype", "P"); + request.modifiedData().put("queryalias", "LISTACCOUNTINDATE"); + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.ldays.clear(); + MessageHelper.setMessageError(resp); + } else { + this.ldays = (List>) resp.get(this.beanalias); + super.addField("branchcodemin", resp.get("branchcodemin")); + super.addField("branchcodemax", resp.get("branchcodemax")); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + //DtoSave dtosave = super.getDtoSave(); + //HashMap msave = new HashMap(); + //msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + //request.setSaveTables(msave); + request.modifiedData().put("branchcodemin", super.getMfilelds().get("branchcodemin")); + request.modifiedData().put("branchcodemax", super.getMfilelds().get("branchcodemax")); + request.modifiedData().put("initdate", this.initdate); + request.modifiedData().put("enddate", this.enddate); + request.modifiedData().put("LISTACCOUNTINDATE", ldays); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/date/.svn/text-base/TgeneAccountingDateBranchController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/date/.svn/text-base/TgeneAccountingDateBranchController.java.svn-base new file mode 100644 index 0000000..56d697f --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/date/.svn/text-base/TgeneAccountingDateBranchController.java.svn-base @@ -0,0 +1,142 @@ +package com.fp.frontend.controller.pgeneral.date; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; + +/** + * Clase controladora del bean TgeneAccountingDateBranch. + * + * @author Andres E. Carpio + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class TgeneAccountingDateBranchController extends AbstractController { + + public TgeneAccountingDateBranchController() throws Exception { + super(TgeneAccountingDateBranch.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "ACCOUNTINGDATE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(false); + dto.setOrderby("t.pk"); // En en string van todos los campos de + // orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(resp); + } else { + this.record = (TgeneAccountingDateBranch) resp.get(this.beanalias); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Entrega la fecha contable de la aplicacin. + * @return Fecah contable. + * @throws Exception + */ + public Date getAccountingDate() throws Exception { + TgeneAccountingDateBranchController c = new TgeneAccountingDateBranchController(); + c.getMfilters().clear(); + c.getMfilters().put("pk.branchcode", "0"); + c.getMfilters().put("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + c.querydatabase(); + return c.record.getAccountingdate(); + } + + /** + * Entrega la fecha contable de la aplicacin. + * @return Fecah contable. + * @throws Exception + */ + public static TgeneAccountingDateBranch find(Integer company) throws Exception { + TgeneAccountingDateBranchController c = new TgeneAccountingDateBranchController(); + c.getMfilters().clear(); + c.getMfilters().put("pk.branchcode", "0"); + c.getMfilters().put("pk.companycode", company.toString()); + c.querydatabase(); + return c.record; + } +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/date/.svn/text-base/TgeneNotAccountingDayController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/date/.svn/text-base/TgeneNotAccountingDayController.java.svn-base new file mode 100644 index 0000000..243bef1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/date/.svn/text-base/TgeneNotAccountingDayController.java.svn-base @@ -0,0 +1,302 @@ +package com.fp.frontend.controller.pgeneral.date; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.solicitud.SolicitudArmasController; +import com.fp.frontend.controller.armas.solicitud.SolicitudTramiteController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pgeneral.date.TgeneNotAccountingDay; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TgeneNotAccountingDay. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TgeneNotAccountingDayController extends AbstractController { + + private static final long serialVersionUID = 1L; + private List lmonths; + + + public TgeneNotAccountingDayController() throws Exception { + super(TgeneNotAccountingDay.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "NONACCOUNTINGDATE"; + lmonths = CatalogDetailController.find("MONTHS"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void create() throws Exception { + super.create(); + record.setCatalogcode("MONTHS"); + record.modifiedData.put("monthdesc", lmonths.get(0).getDescription()); + } + + /** + * Entrega el valor de: lmonths + * @return List + */ + public List getLmonths() { + return lmonths; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.catalog, t.pk.day"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + SubQuery subquery = new SubQuery("TgeneCatalogDetail", "description", "monthdesc", + "i.pk.catalogcode = t.catalogcode and i.pk.catalog = t.pk.catalog"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public void refreshMonth() { + for (TgeneCatalogDetail catdet : lmonths) { + if (catdet.getPk().getCatalog().compareTo(record.getPk().getCatalog()) == 0) { + record.modifiedData.put("monthdesc", catdet.getDescription()); + break; + } + } + } + + /* + * Metodo que retorna una fecha la cual es NDiasLaborablesPrevios anteriores a la fecha que es pasada como parametro + * @param NDiasLaborablesPrevios - Entero positivo que indica el numero de dias previos buscados + * */ + public static Date diasLaborablesPreviosAUnaFecha(Date fecha, int NDiasLaborablesPrevios){ + try { + TgeneNotAccountingDayController cc = new TgeneNotAccountingDayController(); + Calendar fechaCalendar = Calendar.getInstance(); + fechaCalendar.setTime(fecha); + int numDiasEncontrados = 0; + while(numDiasEncontrados < NDiasLaborablesPrevios){ + fechaCalendar.add(Calendar.DAY_OF_MONTH, -1); + if(fechaCalendar.get(Calendar.DAY_OF_WEEK)!=Calendar.SATURDAY && fechaCalendar.get(Calendar.DAY_OF_WEEK)!=Calendar.SUNDAY){ + cc.init(); + cc.recperpage = 300; + String codigoMes = String.valueOf(fechaCalendar.get(Calendar.MONTH)); + codigoMes=((codigoMes.length()==1)?"0"+codigoMes:codigoMes); + + Integer dia = fechaCalendar.get(Calendar.DAY_OF_MONTH); + TgeneNotAccountingDay diaNoLaborable = findByCatalogDay(codigoMes, dia); + if(diaNoLaborable==null){ + numDiasEncontrados+=1; + } + continue; + } + else{ + fechaCalendar.add(Calendar.DAY_OF_MONTH, -1); + } + } + return fechaCalendar.getTime(); + + } catch (Throwable e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return null; + } + } + + /* + * Metodo que retorna una fecha la cual es NDiasLaborablesPrevios posterior a la fecha que es pasada como parametro + * @param NDiasLaborablesPosteriores - Entero positivo que indica el numero de dias posterior de la fecha buscada + * */ + public static Date diasLaborablesPosterioresAUnaFecha(Date fecha, int NDiasLaborablesPosteriores){ + try { + TgeneNotAccountingDayController cc = new TgeneNotAccountingDayController(); + Calendar fechaCalendar = Calendar.getInstance(); + fechaCalendar.setTime(fecha); + int numDiasEncontrados = 0; + while(numDiasEncontrados < NDiasLaborablesPosteriores){ + fechaCalendar.add(Calendar.DAY_OF_MONTH, 1); + if(fechaCalendar.get(Calendar.DAY_OF_WEEK)!=Calendar.SATURDAY && fechaCalendar.get(Calendar.DAY_OF_WEEK)!=Calendar.SUNDAY){ + cc.init(); + cc.recperpage = 300; + String codigoMes = String.valueOf(fechaCalendar.get(Calendar.MONTH)); + codigoMes=((codigoMes.length()==1)?"0"+codigoMes:codigoMes); + + Integer dia = fechaCalendar.get(Calendar.DAY_OF_MONTH); + TgeneNotAccountingDay diaNoLaborable = findByCatalogDay(codigoMes, dia); + if(diaNoLaborable==null){ + numDiasEncontrados+=1; + } + continue; + } + else{ + fechaCalendar.add(Calendar.DAY_OF_MONTH, 1); + } + } + return fechaCalendar.getTime(); + + } catch (Throwable e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return null; + } + } + + public static TgeneNotAccountingDay findByCatalogDay(String codigoMes, Integer dia){ + try { + TgeneNotAccountingDayController cc = new TgeneNotAccountingDayController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalog", codigoMes); + cc.addFilter("pk.day", dia.toString()); + cc.querydatabase(); + if (cc.lrecord.size()>0) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + public static Boolean findDay(Integer codigoMes, Integer dia){ + try { + TgeneNotAccountingDayController cc = new TgeneNotAccountingDayController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalog", codigoMes.toString()); + cc.addFilter("pk.day", dia.toString()); + cc.querydatabase(); + if (cc.lrecord.size()>0) { + return true; + } + return false; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + public static Date isfechalaboral(Date fechalaboral){ + Calendar calendario = Calendar.getInstance(); + calendario.setTime(fechalaboral); + if(calendario.get(Calendar.DAY_OF_WEEK)==Calendar.SATURDAY || calendario.get(Calendar.DAY_OF_WEEK)==Calendar.SUNDAY){ + calendario.add(Calendar.DAY_OF_YEAR,1); + fechalaboral=isfechalaboral(calendario.getTime()); + } + + if(findDay(fechalaboral.getMonth(),fechalaboral.getDay())){ + calendario.add(Calendar.DAY_OF_YEAR,1); + fechalaboral=isfechalaboral(calendario.getTime()); + } + + + return fechalaboral; + + } + public static Boolean findDaynuevo(String codigoMes, Integer dia){ + try { + TgeneNotAccountingDayController cc = new TgeneNotAccountingDayController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalog", codigoMes); + cc.addFilter("pk.day", dia.toString()); + cc.querydatabase(); + if (cc.lrecord.size()>0) { + return true; + } + return false; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/date/GenerateAccountingDateController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/date/GenerateAccountingDateController.java new file mode 100644 index 0000000..e85555c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/date/GenerateAccountingDateController.java @@ -0,0 +1,206 @@ +package com.fp.frontend.controller.pgeneral.date; + +import java.sql.Date; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; + +/** + * Clase controladora que se encarga de la genracion de calendario de fechas en + * la tabla TgeneAccountingDate. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class GenerateAccountingDateController extends AbstractController { + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{tgeneAccountingDateBranchController}") + private TgeneAccountingDateBranchController accountingdate; + + /** + * Lista de dias de domingo a sabado a indicar si es contable o no. + */ + List> ldays; + /** + * Fecha desde la cual se genera el calendaio contable. + */ + private Date initdate; + /** + * Fecha hasta la cual se genera el calendario contable. + */ + private Date enddate; + + public GenerateAccountingDateController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "LISTACCOUNTINDATE"; + ldays = new ArrayList<>(); + this.consultadias(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Entrega el valor de: accountingdate + * + * @return TgeneAccountingDateBranchController + */ + public TgeneAccountingDateBranchController getAccountingdate() { + return accountingdate; + } + + /** + * Fija el valor de: accountingdate + * + * @param accountingdate Valor a fijar en el atributo. + */ + public void setAccountingdate(TgeneAccountingDateBranchController accountingdate) { + this.accountingdate = accountingdate; + } + + /** + * Entrega el valor de: ldays + * + * @return List> + */ + public List> getLdays() { + return ldays; + } + + /** + * Fija el valor de: ldays + * + * @param ldays Valor a fijar en el atributo. + */ + public void setLdays(List> ldays) { + this.ldays = ldays; + } + + /** + * Entrega el valor de: initdate + * + * @return Date + */ + public Date getInitdate() { + return initdate; + } + + /** + * Fija el valor de: initdate + * + * @param initdate Valor a fijar en el atributo. + */ + public void setInitdate(Date initdate) { + this.initdate = initdate; + } + + /** + * Entrega el valor de: enddate + * + * @return Date + */ + public Date getEnddate() { + return enddate; + } + + /** + * Fija el valor de: enddate + * + * @param enddate Valor a fijar en el atributo. + */ + public void setEnddate(Date enddate) { + this.enddate = enddate; + } + + @Override + protected void querydatabase() { + } + + @SuppressWarnings("unchecked") + private void consultadias() throws Exception { + try { + Request request = this.callerhelper.getRequest(); + request.modifiedData().put("querytype", "P"); + request.modifiedData().put("queryalias", "LISTACCOUNTINDATE"); + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.ldays.clear(); + MessageHelper.setMessageError(resp); + } else { + this.ldays = (List>) resp.get(this.beanalias); + super.addField("branchcodemin", resp.get("branchcodemin")); + super.addField("branchcodemax", resp.get("branchcodemax")); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + //DtoSave dtosave = super.getDtoSave(); + //HashMap msave = new HashMap(); + //msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + //request.setSaveTables(msave); + request.modifiedData().put("branchcodemin", super.getMfilelds().get("branchcodemin")); + request.modifiedData().put("branchcodemax", super.getMfilelds().get("branchcodemax")); + request.modifiedData().put("initdate", this.initdate); + request.modifiedData().put("enddate", this.enddate); + request.modifiedData().put("LISTACCOUNTINDATE", ldays); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/date/TgeneAccountingDateBranchController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/date/TgeneAccountingDateBranchController.java new file mode 100644 index 0000000..7b5b5ef --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/date/TgeneAccountingDateBranchController.java @@ -0,0 +1,144 @@ +package com.fp.frontend.controller.pgeneral.date; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.date.TgeneAccountingDateBranch; + +/** + * Clase controladora del bean TgeneAccountingDateBranch. + * + * @author Andres E. Carpio + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class TgeneAccountingDateBranchController extends AbstractController { + + public TgeneAccountingDateBranchController() throws Exception { + super(TgeneAccountingDateBranch.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "ACCOUNTINGDATE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(false); + dto.setOrderby("t.pk"); // En en string van todos los campos de + // orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + MessageHelper.setMessageError(resp); + } else { + this.record = (TgeneAccountingDateBranch) resp.get(this.beanalias); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Entrega la fecha contable de la aplicacin. + * + * @return Fecah contable. + * @throws Exception + */ + public Date getAccountingDate() throws Exception { + TgeneAccountingDateBranchController c = new TgeneAccountingDateBranchController(); + c.getMfilters().clear(); + c.getMfilters().put("pk.branchcode", "0"); + c.getMfilters().put("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + c.querydatabase(); + return c.record.getAccountingdate(); + } + + /** + * Entrega la fecha contable de la aplicacin. + * + * @return Fecah contable. + * @throws Exception + */ + public static TgeneAccountingDateBranch find(Integer company) throws Exception { + TgeneAccountingDateBranchController c = new TgeneAccountingDateBranchController(); + c.getMfilters().clear(); + c.getMfilters().put("pk.branchcode", "0"); + c.getMfilters().put("pk.companycode", company.toString()); + c.querydatabase(); + return c.record; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/date/TgeneNotAccountingDayController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/date/TgeneNotAccountingDayController.java new file mode 100644 index 0000000..0168cec --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/date/TgeneNotAccountingDayController.java @@ -0,0 +1,300 @@ +package com.fp.frontend.controller.pgeneral.date; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.solicitud.SolicitudArmasController; +import com.fp.frontend.controller.armas.solicitud.SolicitudTramiteController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pgeneral.date.TgeneNotAccountingDay; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TgeneNotAccountingDay. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TgeneNotAccountingDayController extends AbstractController { + + private static final long serialVersionUID = 1L; + private List lmonths; + + public TgeneNotAccountingDayController() throws Exception { + super(TgeneNotAccountingDay.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "NONACCOUNTINGDATE"; + lmonths = CatalogDetailController.find("MONTHS"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void create() throws Exception { + super.create(); + record.setCatalogcode("MONTHS"); + record.modifiedData.put("monthdesc", lmonths.get(0).getDescription()); + } + + /** + * Entrega el valor de: lmonths + * + * @return List + */ + public List getLmonths() { + return lmonths; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.catalog, t.pk.day"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + SubQuery subquery = new SubQuery("TgeneCatalogDetail", "description", "monthdesc", + "i.pk.catalogcode = t.catalogcode and i.pk.catalog = t.pk.catalog"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public void refreshMonth() { + for (TgeneCatalogDetail catdet : lmonths) { + if (catdet.getPk().getCatalog().compareTo(record.getPk().getCatalog()) == 0) { + record.modifiedData.put("monthdesc", catdet.getDescription()); + break; + } + } + } + + /* + * Metodo que retorna una fecha la cual es NDiasLaborablesPrevios anteriores a la fecha que es pasada como parametro + * @param NDiasLaborablesPrevios - Entero positivo que indica el numero de dias previos buscados + * */ + public static Date diasLaborablesPreviosAUnaFecha(Date fecha, int NDiasLaborablesPrevios) { + try { + TgeneNotAccountingDayController cc = new TgeneNotAccountingDayController(); + Calendar fechaCalendar = Calendar.getInstance(); + fechaCalendar.setTime(fecha); + int numDiasEncontrados = 0; + while (numDiasEncontrados < NDiasLaborablesPrevios) { + fechaCalendar.add(Calendar.DAY_OF_MONTH, -1); + if (fechaCalendar.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && fechaCalendar.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) { + cc.init(); + cc.recperpage = 300; + String codigoMes = String.valueOf(fechaCalendar.get(Calendar.MONTH)); + codigoMes = ((codigoMes.length() == 1) ? "0" + codigoMes : codigoMes); + + Integer dia = fechaCalendar.get(Calendar.DAY_OF_MONTH); + TgeneNotAccountingDay diaNoLaborable = findByCatalogDay(codigoMes, dia); + if (diaNoLaborable == null) { + numDiasEncontrados += 1; + } + continue; + } else { + fechaCalendar.add(Calendar.DAY_OF_MONTH, -1); + } + } + return fechaCalendar.getTime(); + + } catch (Throwable e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return null; + } + } + + /* + * Metodo que retorna una fecha la cual es NDiasLaborablesPrevios posterior a la fecha que es pasada como parametro + * @param NDiasLaborablesPosteriores - Entero positivo que indica el numero de dias posterior de la fecha buscada + * */ + public static Date diasLaborablesPosterioresAUnaFecha(Date fecha, int NDiasLaborablesPosteriores) { + try { + TgeneNotAccountingDayController cc = new TgeneNotAccountingDayController(); + Calendar fechaCalendar = Calendar.getInstance(); + fechaCalendar.setTime(fecha); + int numDiasEncontrados = 0; + while (numDiasEncontrados < NDiasLaborablesPosteriores) { + fechaCalendar.add(Calendar.DAY_OF_MONTH, 1); + if (fechaCalendar.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && fechaCalendar.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) { + cc.init(); + cc.recperpage = 300; + String codigoMes = String.valueOf(fechaCalendar.get(Calendar.MONTH)); + codigoMes = ((codigoMes.length() == 1) ? "0" + codigoMes : codigoMes); + + Integer dia = fechaCalendar.get(Calendar.DAY_OF_MONTH); + TgeneNotAccountingDay diaNoLaborable = findByCatalogDay(codigoMes, dia); + if (diaNoLaborable == null) { + numDiasEncontrados += 1; + } + continue; + } else { + fechaCalendar.add(Calendar.DAY_OF_MONTH, 1); + } + } + return fechaCalendar.getTime(); + + } catch (Throwable e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return null; + } + } + + public static TgeneNotAccountingDay findByCatalogDay(String codigoMes, Integer dia) { + try { + TgeneNotAccountingDayController cc = new TgeneNotAccountingDayController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalog", codigoMes); + cc.addFilter("pk.day", dia.toString()); + cc.querydatabase(); + if (cc.lrecord.size() > 0) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + public static Boolean findDay(Integer codigoMes, Integer dia) { + try { + TgeneNotAccountingDayController cc = new TgeneNotAccountingDayController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalog", codigoMes.toString()); + cc.addFilter("pk.day", dia.toString()); + cc.querydatabase(); + if (cc.lrecord.size() > 0) { + return true; + } + return false; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + public static Date isfechalaboral(Date fechalaboral) { + Calendar calendario = Calendar.getInstance(); + calendario.setTime(fechalaboral); + if (calendario.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calendario.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) { + calendario.add(Calendar.DAY_OF_YEAR, 1); + fechalaboral = isfechalaboral(calendario.getTime()); + } + + if (findDay(fechalaboral.getMonth(), fechalaboral.getDay())) { + calendario.add(Calendar.DAY_OF_YEAR, 1); + fechalaboral = isfechalaboral(calendario.getTime()); + } + + return fechalaboral; + + } + + public static Boolean findDaynuevo(String codigoMes, Integer dia) { + try { + TgeneNotAccountingDayController cc = new TgeneNotAccountingDayController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalog", codigoMes); + cc.addFilter("pk.day", dia.toString()); + cc.querydatabase(); + if (cc.lrecord.size() > 0) { + return true; + } + return false; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/firmas/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/firmas/.svn/entries new file mode 100644 index 0000000..bdf11cd --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/firmas/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/pgeneral/firmas +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +CertificadosController.java +file + + + + +2022-07-28T03:39:55.077597Z +86d8d67e9f36b23a801bcda349a447de +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +10648 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/firmas/.svn/text-base/CertificadosController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/firmas/.svn/text-base/CertificadosController.java.svn-base new file mode 100644 index 0000000..bdb786b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/firmas/.svn/text-base/CertificadosController.java.svn-base @@ -0,0 +1,291 @@ +package com.fp.frontend.controller.pgeneral.firmas; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.sql.Date; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.crypto.BadPaddingException; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.apache.commons.io.IOUtils; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.SelectEvent; + +import com.fp.base.persistence.TfirmDatosFirmante; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.firmas.rules.common.CertificateUtils; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pfirmas.param.TfirmCertificado; + +@ManagedBean +@ViewScoped +public class CertificadosController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private boolean existeCertificado; + + public CertificadosController() throws Exception { + super(TfirmCertificado.class); + } + + @PostConstruct + public void postConstruct() { + this.init(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "USUARIOCERTIFICADOS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + Request request = callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + + HashMap mtable = new HashMap(); + mtable.put(beanalias, dto); + + request.setQueryTables(mtable); + + request.put("queryalias", beanalias); + + Response response = callerhelper.executeQuery(request); + + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(response); + } else { + lrecord = (List) response.get(beanalias); + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = callerhelper.getRequest(); + DtoSave dto = super.getDtoSave(); + if (!dto.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(beanalias, dto); + request.setSaveTables(msave); + Response response = callerhelper.executeSave(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(response); + + MessageHelper.setMessageInfo(response); + } else { + MessageHelper.setMessageError(response); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método que abre el LOV de empleados y setea los parámetros definidos + */ + public void abrirLovEmpleado() { + Map> paramsLov = new HashMap>(); + // LovEmpleadoSbsController.openLov(paramsLov); + } + + /** + * Método que se invoca al regresar desde el LOV de empleados un p:dialog + * + * @param event + * @throws Exception + */ + public void retornoServidor(SelectEvent event) throws Exception { + /* + * Empleado e = (Empleado) event.getObject(); this.addFilter("codigousuario", e.getUsuarioweb()); + * this.addField("nom_servidor", e.getNombre()); + */ + } + + /** + * Método que se invoca al retornar del segundo LOV de empleados + * + * @param event + */ + public void retornoPopupCreacion(SelectEvent event) { + /* + * Empleado e = (Empleado) event.getObject(); // this.record.modifiedData.put("codigousuario", e.getCodigo()); + * this.record.modifiedData.put("nom_servidor", e.getNombre()); // + * this.record.modifiedData.put("cargo_servidor", e.getCargo()); + * this.record.setCodigousuario(e.getUsuarioweb()); this.record.setCargo(e.getCargo()); + */ + } + + /** + * Sobreescribo el metodo update del popup para que genere los datos del certificado + */ + @Override + public void update() throws Exception { + try { + if (record.modifiedData.get("nom_servidor") == null) { + throw new RuntimeException("Debe ingresar el empleado"); + } + if (record.modifiedData.get("valor_certificado_bin") != null) { + // valido los datos adicionales a agregar para enviar datos a la capa de negocio donde se procesara la + // logica de almacenamiento + TfirmDatosFirmante datosFirmante = generacionDatosArchivo(record.getPk().getIdcertificado(), new ByteArrayInputStream((byte[]) record + .getModifiedData().get("valor_certificado_bin"))); + record.getPk().setFcaducidad(new Date(datosFirmante.getFechaVigencia().getTime())); + record.setFingreso(new Date(System.currentTimeMillis())); + record.setFvigencia(new Date(datosFirmante.getFechaInicioVigencia().getTime())); + record.modifiedData.put("nom_certificado", datosFirmante.getNombre()); + record.modifiedData.put("estado_certificado", + datosFirmante.getFechaVigencia().compareTo(new Date(System.currentTimeMillis())) >= 0 ? "VIGENTE" : "CADUCADO"); + super.update(); + } else { + throw new RuntimeException("Debe a\u00f1adir un archivo para grabar"); + } + } catch (IOException e) { + FacesContext.getCurrentInstance().validationFailed(); + if (e.getCause() instanceof BadPaddingException) { + MessageHelper.setMessageError(new RuntimeException("La clave del certificado es incorrecta")); + } + } catch (Throwable e) { + FacesContext.getCurrentInstance().validationFailed(); + MessageHelper.setMessageError(e); + } + } + + /** + * Carga un documento y lo almacena en memoria + * + * @param event + */ + public void uploadCertificado(FileUploadEvent event) { + try { + // this.existeCertificado = true; + APPLogger.getLogger().info("Ingreso a subir el documento"); + record.getPk().setIdcertificado(event.getFile().getFileName()); + record.modifiedData.put("valor_certificado_bin", IOUtils.toByteArray(event.getFile().getInputstream())); + + FacesContext.getCurrentInstance().addMessage(null, + new FacesMessage(FacesMessage.SEVERITY_INFO, "Archivo subido correctamente", "Archivo subido correctamente")); + } catch (IOException e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Retorna datos del firmante antes de que se envie los datos a grabar + * + * @param nombreArchivo + * @param datosArchivo + * @return + * @throws KeyStoreException + * @throws NoSuchAlgorithmException + * @throws CertificateException + * @throws IOException + */ + private TfirmDatosFirmante generacionDatosArchivo(String nombreArchivo, InputStream datosArchivo) throws KeyStoreException, + NoSuchAlgorithmException, CertificateException, IOException { + KeyStore ks = KeyStore.getInstance("PKCS12"); + ks.load(datosArchivo, record.modifiedData.get("password_certificado").toString().toCharArray()); + Certificate certificate = CertificateUtils.obtainCertificateInAlias(ks, ks.aliases()); + return CertificateUtils.obtainDataForCertificate(certificate); + } + + /** + * Entrega una lista de objetos TfirmCertificado + * + * @return lrecord Lista de objetos TfirmCertificado + */ + public static List find() { + try { + CertificadosController cc = new CertificadosController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * + * @param certificado Có de certificado + * @return record Objeto TfirmCertificado + */ + public static TfirmCertificado find(String usuario) { + try { + CertificadosController cc = new CertificadosController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("codigousuario", usuario); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Entrega V/F + * + * @return existeCertificado + */ + public boolean isExisteCertificado() { + return existeCertificado; + } + + /** + * Fija V/F + * + * @param existeCertificado + */ + public void setExisteCertificado(boolean existeCertificado) { + this.existeCertificado = existeCertificado; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/firmas/CertificadosController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/firmas/CertificadosController.java new file mode 100644 index 0000000..19829e2 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/firmas/CertificadosController.java @@ -0,0 +1,295 @@ +package com.fp.frontend.controller.pgeneral.firmas; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.sql.Date; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.crypto.BadPaddingException; +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.apache.commons.io.IOUtils; +import org.primefaces.event.FileUploadEvent; +import org.primefaces.event.SelectEvent; + +import com.fp.base.persistence.TfirmDatosFirmante; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.firmas.rules.common.CertificateUtils; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pfirmas.param.TfirmCertificado; + +@ManagedBean +@ViewScoped +public class CertificadosController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private boolean existeCertificado; + + public CertificadosController() throws Exception { + super(TfirmCertificado.class); + } + + @PostConstruct + public void postConstruct() { + this.init(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + recperpage = 10; // Cambiar al # reg a mirar. + lrecord = new ArrayList<>(); + beanalias = "USUARIOCERTIFICADOS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + public void querydatabase() { + try { + Request request = callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(Boolean.TRUE); + + HashMap mtable = new HashMap(); + mtable.put(beanalias, dto); + + request.setQueryTables(mtable); + + request.put("queryalias", beanalias); + + Response response = callerhelper.executeQuery(request); + + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + lrecord = new ArrayList(); + MessageHelper.setMessageError(response); + } else { + lrecord = (List) response.get(beanalias); + super.postQuery(lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = callerhelper.getRequest(); + DtoSave dto = super.getDtoSave(); + if (!dto.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(beanalias, dto); + request.setSaveTables(msave); + Response response = callerhelper.executeSave(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(response); + + MessageHelper.setMessageInfo(response); + } else { + MessageHelper.setMessageError(response); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método que abre el LOV de empleados y setea los parámetros + * definidos + */ + public void abrirLovEmpleado() { + Map> paramsLov = new HashMap>(); + // LovEmpleadoSbsController.openLov(paramsLov); + } + + /** + * Método que se invoca al regresar desde el LOV de empleados un + * p:dialog + * + * @param event + * @throws Exception + */ + public void retornoServidor(SelectEvent event) throws Exception { + /* + * Empleado e = (Empleado) event.getObject(); this.addFilter("codigousuario", e.getUsuarioweb()); + * this.addField("nom_servidor", e.getNombre()); + */ + } + + /** + * Método que se invoca al retornar del segundo LOV de empleados + * + * @param event + */ + public void retornoPopupCreacion(SelectEvent event) { + /* + * Empleado e = (Empleado) event.getObject(); // this.record.modifiedData.put("codigousuario", e.getCodigo()); + * this.record.modifiedData.put("nom_servidor", e.getNombre()); // + * this.record.modifiedData.put("cargo_servidor", e.getCargo()); + * this.record.setCodigousuario(e.getUsuarioweb()); this.record.setCargo(e.getCargo()); + */ + } + + /** + * Sobreescribo el metodo update del popup para que genere los datos del + * certificado + */ + @Override + public void update() throws Exception { + try { + if (record.modifiedData.get("nom_servidor") == null) { + throw new RuntimeException("Debe ingresar el empleado"); + } + if (record.modifiedData.get("valor_certificado_bin") != null) { + // valido los datos adicionales a agregar para enviar datos a la capa de negocio donde se procesara la + // logica de almacenamiento + TfirmDatosFirmante datosFirmante = generacionDatosArchivo(record.getPk().getIdcertificado(), new ByteArrayInputStream((byte[]) record + .getModifiedData().get("valor_certificado_bin"))); + record.getPk().setFcaducidad(new Date(datosFirmante.getFechaVigencia().getTime())); + record.setFingreso(new Date(System.currentTimeMillis())); + record.setFvigencia(new Date(datosFirmante.getFechaInicioVigencia().getTime())); + record.modifiedData.put("nom_certificado", datosFirmante.getNombre()); + record.modifiedData.put("estado_certificado", + datosFirmante.getFechaVigencia().compareTo(new Date(System.currentTimeMillis())) >= 0 ? "VIGENTE" : "CADUCADO"); + super.update(); + } else { + throw new RuntimeException("Debe a\u00f1adir un archivo para grabar"); + } + } catch (IOException e) { + FacesContext.getCurrentInstance().validationFailed(); + if (e.getCause() instanceof BadPaddingException) { + MessageHelper.setMessageError(new RuntimeException("La clave del certificado es incorrecta")); + } + } catch (Throwable e) { + FacesContext.getCurrentInstance().validationFailed(); + MessageHelper.setMessageError(e); + } + } + + /** + * Carga un documento y lo almacena en memoria + * + * @param event + */ + public void uploadCertificado(FileUploadEvent event) { + try { + // this.existeCertificado = true; + APPLogger.getLogger().info("Ingreso a subir el documento"); + record.getPk().setIdcertificado(event.getFile().getFileName()); + record.modifiedData.put("valor_certificado_bin", IOUtils.toByteArray(event.getFile().getInputstream())); + + FacesContext.getCurrentInstance().addMessage(null, + new FacesMessage(FacesMessage.SEVERITY_INFO, "Archivo subido correctamente", "Archivo subido correctamente")); + } catch (IOException e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Retorna datos del firmante antes de que se envie los datos a grabar + * + * @param nombreArchivo + * @param datosArchivo + * @return + * @throws KeyStoreException + * @throws NoSuchAlgorithmException + * @throws CertificateException + * @throws IOException + */ + private TfirmDatosFirmante generacionDatosArchivo(String nombreArchivo, InputStream datosArchivo) throws KeyStoreException, + NoSuchAlgorithmException, CertificateException, IOException { + KeyStore ks = KeyStore.getInstance("PKCS12"); + ks.load(datosArchivo, record.modifiedData.get("password_certificado").toString().toCharArray()); + Certificate certificate = CertificateUtils.obtainCertificateInAlias(ks, ks.aliases()); + return CertificateUtils.obtainDataForCertificate(certificate); + } + + /** + * Entrega una lista de objetos TfirmCertificado + * + * @return lrecord Lista de objetos TfirmCertificado + */ + public static List find() { + try { + CertificadosController cc = new CertificadosController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * + * @param certificado Có de certificado + * @return record Objeto TfirmCertificado + */ + public static TfirmCertificado find(String usuario) { + try { + CertificadosController cc = new CertificadosController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("codigousuario", usuario); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Entrega V/F + * + * @return existeCertificado + */ + public boolean isExisteCertificado() { + return existeCertificado; + } + + /** + * Fija V/F + * + * @param existeCertificado + */ + public void setExisteCertificado(boolean existeCertificado) { + this.existeCertificado = existeCertificado; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/entries new file mode 100644 index 0000000..acecab3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/entries @@ -0,0 +1,946 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +OfficeController.java +file + + + + +2022-07-28T03:39:55.546599Z +3a0177f2db35d5cbffa80e6104d49a3b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5733 + +CatalogDetailBpmController.java +file + + + + +2022-07-28T03:39:55.547599Z +eeda72be93ff2009cb01151c36c82fd1 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4176 + +OfficeAndBranchController.java +file + + + + +2022-07-28T03:39:55.547599Z +c308a5e849ed6749520ba9569d0b542b +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +7708 + +CatalogDetailController.java +file + + + + +2022-07-28T03:39:55.547599Z +33041317256348f20cb3d2f4a1170089 +2015-12-29T18:39:25.156109Z +4363 +cvasquez + + + + + + + + + + + + + + + + + + + + + +11115 + +BranchController.java +file + + + + +2022-07-28T03:39:55.547599Z +85ccb307670ca78aaaefcf418fa82316 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4599 + +BalanceGroupController.java +file + + + + +2022-07-28T03:39:55.548599Z +236755917ed017df6443ff49e8bb57a4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4036 + +CountryController.java +file + + + + +2022-07-28T03:39:55.548599Z +9c58be641c161c05a631b07ed33f2209 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +4849 + +ParametersController.java +file + + + + +2022-07-28T03:39:55.548599Z +a6ca963bfcb45f20802256e4d0cd84ff +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +4265 + +ParroquiaController.java +file + + + + +2022-07-28T03:39:55.548599Z +b4fdf86161109c0604eaa5b314413233 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +6152 + +QueryProcessController.java +file + + + + +2022-07-28T03:39:55.549599Z +8ba706a7be398ffda0d4e514febddac0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4943 + +QueryController.java +file + + + + +2022-07-28T03:39:55.549599Z +f3e738316adf6b9c8b1451495aafcacf +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4548 + +CityController.java +file + + + + +2022-07-28T03:39:55.550599Z +6e70254a61345dd1d69b7ef0608de745 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +6962 + +ChannelController.java +file + + + + +2022-07-28T03:39:55.549599Z +2d1e29853506412ac378658340e8cdad +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +3677 + +AreaController.java +file + + + + +2022-07-28T03:39:55.549599Z +9c5e24e963d679fc6437a26e3563a513 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +3706 + +CatalogController.java +file + + + + +2022-07-28T03:39:55.550599Z +2972086b81e57b439d881c8bbf7449e4 +2014-10-30T13:23:37.177735Z +2257 +wpatino + + + + + + + + + + + + + + + + + + + + + +3450 + +TransactionQueryController.java +file + + + + +2022-07-28T03:39:55.550599Z +4656f7b5b11caaba5ac1c59e00d33b4e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8309 + +ChargesController.java +file + + + + +2022-07-28T03:39:55.550599Z +14f6ad010b59f915a071caa1a59a32ae +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4178 + +TerminosCondicionesController.java +file + + + + +2022-07-28T03:39:55.551599Z +ae898997f4ef7bc217755ac24a84c848 +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +3729 + +CantonController.java +file + + + + +2022-07-28T03:39:55.551599Z +fd61704d3c4cf97cb7c166de03500afe +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +6692 + +LanguageController.java +file + + + + +2022-07-28T03:39:55.551599Z +545fdbe4cf710e810c1005b68492b50e +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +3697 + +ServicesController.java +file + + + + +2022-07-28T03:39:55.551599Z +d948157cb2ff5a5e2ab4355bbb913c24 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +4711 + +ChargesDefinitionController.java +file + + + + +2022-07-28T03:39:55.552599Z +16d497ff1325363f87ae35c387451e85 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +11120 + +ProvinceController.java +file + + + + +2022-07-28T03:39:55.552599Z +74bcde7943f5fc6bb6f505b4d48a3fd9 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +7412 + +BalanceTypeController.java +file + + + + +2022-07-28T03:39:55.552599Z +3045fbfceaf1b0a196cbbd607ad7f6ed +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3919 + +SubProductChargesController.java +file + + + + +2022-07-28T03:39:55.552599Z +4a9efb3f1c932c8ba59da64530313520 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5121 + +ChargesGroupController.java +file + + + + +2022-07-28T03:39:55.553599Z +dc4fa76179dabb6a0e7a3e9e8a002f77 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6610 + +CurrencyController.java +file + + + + +2022-07-28T03:39:55.553599Z +f832b5a0085ffbb84514750b16b6b578 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3689 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/AreaController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/AreaController.java.svn-base new file mode 100644 index 0000000..65f48d1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/AreaController.java.svn-base @@ -0,0 +1,142 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneArea; + +/** + * Clase controladora del bean TgeneArea. + * + * @author Andres E. Carpio + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class AreaController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public AreaController() throws Exception { + super(TgeneArea.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CHANNEL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de + // orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Entrega una lista de objetos TgeneArea + * + * @return lchannels Lista de objetos TgeneArea + */ + public static List find(String company) { + try { + AreaController cc = new AreaController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.companycode", company); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/BalanceGroupController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/BalanceGroupController.java.svn-base new file mode 100644 index 0000000..d8637db --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/BalanceGroupController.java.svn-base @@ -0,0 +1,129 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneBalanceGroup; + +/** + * Clase controladora del bean TgeneBalanceGroup. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class BalanceGroupController extends AbstractController { + + public BalanceGroupController() throws Exception { + super(TgeneBalanceGroup.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "BALANCEGROUP"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + + public static List find() { + try { + BalanceGroupController bgc = new BalanceGroupController(); + bgc.init(); + bgc.recperpage = 300; + bgc.querydatabase(); + if (bgc.lrecord != null && !bgc.lrecord.isEmpty()) { + return bgc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/BalanceTypeController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/BalanceTypeController.java.svn-base new file mode 100644 index 0000000..b92ffe9 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/BalanceTypeController.java.svn-base @@ -0,0 +1,143 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.product.ModuleController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneBalanceGroup; +import com.fp.persistence.pgeneral.gene.TgeneBalanceType; +import com.fp.persistence.pgeneral.product.TgeneModule; + +/** + * Clase controladora del bean TgeneBalanceType. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class BalanceTypeController extends AbstractController { + /** + * Lista de modulos. + */ + private List lmodule; + /** + * Lista de grupos de balance. + */ + private List lbalancegroup; + + public BalanceTypeController() throws Exception { + super(TgeneBalanceType.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "BALANCETYPE"; + lmodule = ModuleController.find(); + lbalancegroup = BalanceGroupController.find(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Entrega el valor de: lmodule + * @return List + */ + public List getLmodule() { + return lmodule; + } + + /** + * Entrega el valor de: lbalancegroup + * @return List + */ + public List getLbalancegroup() { + return lbalancegroup; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.balancetype"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/BranchController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/BranchController.java.svn-base new file mode 100644 index 0000000..0dc06a5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/BranchController.java.svn-base @@ -0,0 +1,151 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneBranch; + +/** + * Clase controladora del bean TgeneCatalogDetail. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class BranchController extends AbstractController { + + + private static final long serialVersionUID = 1L; + + public BranchController() throws Exception { + super(TgeneBranch.class); + } + + + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEBRANCH"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Inicializa las paginas en la consulta + */ + public void initRecPage(){ + this.page = 0; + this.recperpage = 10; + } + + @Override + public void create(){ + try{ + super.create(); + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + }catch(Exception ex){ + + } + } + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + //super.getMfilters().put("pk.branchcode", "!=0"); + if(super.getMfilters().get("pk.companycode")==null || super.getMfilters().get("pk.companycode").equals("")){ + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + } + + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.branchcode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static List find(String company) { + try { + BranchController bc = new BranchController(); + bc.init(); + bc.recperpage = 300; + bc.addFilter("pk.companycode", company); + bc.querydatabase(); + if (bc.lrecord != null && !bc.lrecord.isEmpty()) { + return bc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/CantonController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/CantonController.java.svn-base new file mode 100644 index 0000000..b856af6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/CantonController.java.svn-base @@ -0,0 +1,198 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Clase controladora del bean TgeneProvince. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class CantonController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public CantonController() throws Exception { + super(TgeneCanton.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CANTON"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Método que entrega el listado objetos TgeneCanton provincias + * + * @param countrycode Código de país + * @param provincecode Código de provincia + * @return lrecord Lista de objetos TgeneCanton + */ + public static List find(String countrycode, String provincecode) { + try { + CantonController cc = new CantonController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.addFilter("pk.provincecode", provincecode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Metodo para buscar por codigo de ciudad + * @param citycode + * @return + */ + public static List findPorCodigo(String countrycode, String provincecode, String cantoncode){ + try { + CantonController cc = new CantonController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.addFilter("pk.provincecode", provincecode); + cc.addFilter("pk.cantoncode", cantoncode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para buscar el nombre del canton atraves del codigo + * @param provincecode + * @return + */ + public static String getDescCantonByCodigo(String countrycode, String provincecode, String cantoncode){ + try { + if(countrycode==null || provincecode==null || cantoncode==null || countrycode.isEmpty() || provincecode.isEmpty() || cantoncode.isEmpty()){ + return null; + } + CantonController cc = new CantonController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.addFilter("pk.provincecode", provincecode); + cc.addFilter("pk.cantoncode", cantoncode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TgeneCanton canton = cc.lrecord.get(0); + if(canton.getDescription()!=null){ + return canton.getDescription(); + }else{ + return ""; + } + } + return ""; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return ""; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/CatalogController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/CatalogController.java.svn-base new file mode 100644 index 0000000..3cb0caa --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/CatalogController.java.svn-base @@ -0,0 +1,119 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pentaho.PentahoController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; + +/** + * Clase controladora del bean TgeneCatalog. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CatalogController extends AbstractController { + + /** + * Constructor + * @throws Exception + */ + public CatalogController() throws Exception { + super(TgeneCatalog.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOG"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/CatalogDetailBpmController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/CatalogDetailBpmController.java.svn-base new file mode 100644 index 0000000..71e0af0 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/CatalogDetailBpmController.java.svn-base @@ -0,0 +1,146 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.CatalogLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailTest; + +/** + * Clase controladora del bean TgeneCatalogDetailTest. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class CatalogDetailBpmController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public CatalogDetailBpmController() throws Exception { + super(TgeneCatalogDetailTest.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOGDETAIL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.catalogcode") == null) { + MessageHelper.setMessageError("msg_catalogrequird"); + return; + } + super.create(); + this.record.getPk().setCatalogcode(super.getMfilters().get("pk.catalogcode")); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.catalog"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void openCatalogLov() { + Map> params = new HashMap<>(); + CatalogLovController.openLov(params); + } + + public void onReturnCatalogLov(SelectEvent event) throws Exception { + TgeneCatalog t = (TgeneCatalog) event.getObject(); + super.addFilter("pk.catalogcode", t.getPk()); + super.addField("catalogname", t.getDescription()); + this.query(); + } + + + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/CatalogDetailController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/CatalogDetailController.java.svn-base new file mode 100644 index 0000000..0dd5aff --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/CatalogDetailController.java.svn-base @@ -0,0 +1,367 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.CatalogLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TgeneCatalogDetail. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CatalogDetailController extends AbstractController { + + public CatalogDetailController() throws Exception { + super(TgeneCatalogDetail.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOGDETAIL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.catalogcode") == null) { + MessageHelper.setMessageError("msg_catalogrequird"); + return; + } + super.create(); + this.record.getPk().setCatalogcode(super.getMfilters().get("pk.catalogcode")); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void openCatalogLov() { + Map> params = new HashMap<>(); + CatalogLovController.openLov(params); + } + + public void onReturnCatalogLov(SelectEvent event) throws Exception { + TgeneCatalog t = (TgeneCatalog) event.getObject(); + super.addFilter("pk.catalogcode", t.getPk()); + super.addField("catalogname", t.getDescription()); + this.query(); + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * @param catalogcode Có de catálogo + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static List find(String catalogcode) { + try { + CatalogDetailController cc = new CatalogDetailController(); + cc.init(); + cc.recperpage = 10000; + cc.addFilter("pk.catalogcode", catalogcode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * @param catalogcode Có de catálogo + * @param legalcode Código legal + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static List find(String catalogcode, String legalcode) { + try { + CatalogDetailController cc = new CatalogDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalogcode", catalogcode); + cc.addFilter("legalcode", legalcode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * @param catalogcode Có de catálogo + * @param catalog Código catalogo + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static List findCatalog(String catalogcode, String catalog) { + try { + CatalogDetailController cc = new CatalogDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalogcode", catalogcode); + cc.addFilter("pk.catalog", catalog); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Encuentra por los codigos de catalogo + * @param catalogcode + * @param catalog + * @return + */ + public static TgeneCatalogDetail findCatalogo(String catalogcode, String catalog) { + try { + if(catalogcode==null || catalog ==null || catalogcode.isEmpty() || catalog.isEmpty()){ + return null; + } + CatalogDetailController cc = new CatalogDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalogcode", catalogcode); + cc.addFilter("pk.catalog", catalog); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que consulta por Catalog y Catalogcode ambos requeridos + */ + public static TgeneCatalogDetail findxCodigoCodcatalogo(String catalog, String catalogcode) { + try {//TgeneCatalogDetailKey + if(catalog!=null && catalogcode!=null){ + CatalogDetailController cc = new CatalogDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalogcode", catalogcode); + cc.addFilter("pk.catalog", catalog); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Obtiene un elemento del catalogo por su codigo + * @param catalog + * @return + */ + public static TgeneCatalogDetail findxCodigo(String catalog) { + try {//TgeneCatalogDetailKey + CatalogDetailController cc = new CatalogDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalog", catalog); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Obtiene un elemento del catalogo por su codigo de catalogo + * @param catalog + * @return + */ + public static List findByCatalogcode(String catalogcode) { + try {//TgeneCatalogDetailKey + CatalogDetailController cc = new CatalogDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalogcode", catalogcode); + cc.querydatabase(); + if (cc.lrecord !=null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + /** + * Obtiene un elemento del catalogo por su codigo de catalogo + * y descripcion + * @param catalog + * @return + */ + public static TgeneCatalogDetail findByCatalogcodeDescrption(String catalogcode,String descrption) { + try {//TgeneCatalogDetailKey + + if(catalogcode==null || descrption ==null || catalogcode.isEmpty() || descrption.isEmpty()){ + return null; + } + CatalogDetailController cc = new CatalogDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalogcode", catalogcode); + cc.addFilter("description", descrption); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que llena lal lista de géneros + */ + public static List getListGender(){ + List gender = new ArrayList(); + String[] male = {"M", "MASCULINO"}; + String[] female = {"F", "FEMENINO"}; + gender.add(male); + gender.add(female); + return gender; + } + + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * @param catalogcode Có de catálogo + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static List findClientType(String catalogcode, String legalcode) { + try { + CatalogDetailController cc = new CatalogDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalogcode", catalogcode); + cc.addFilter("legalcode", legalcode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ChannelController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ChannelController.java.svn-base new file mode 100644 index 0000000..4cde231 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ChannelController.java.svn-base @@ -0,0 +1,135 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneChannels; + +/** + * Clase controladora del bean TgeneChannels. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ChannelController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public ChannelController() throws Exception { + super(TgeneChannels.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CHANNEL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Entrega una lista de objetos TgeneChannels + * @return lchannels Lista de objetos TgeneChannels + */ + public static List find(){ + try { + ChannelController cc = new ChannelController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ChargesController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ChargesController.java.svn-base new file mode 100644 index 0000000..46c9444 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ChargesController.java.svn-base @@ -0,0 +1,140 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.BalanceTypeLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.charge.TgeneCharges; +import com.fp.persistence.pgeneral.gene.TgeneBalanceType; + +/** + * Clase controladora del bean TgeneCharges. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ChargesController extends AbstractController { + + + public ChargesController() throws Exception { + super(TgeneCharges.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 12; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CHARGES"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.modulecode") == null) { + MessageHelper.setMessageError("msg_modulerequird"); + return; + } + super.create(); + this.record.getPk().setModulecode( super.getMfilters().get("pk.modulecode")); + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + if(super.getMfilters().get("pk.modulecode")==null){ + MessageHelper.setMessageError("msg_modulerequird"); + return; + } + //super.addFilter("pk.modulecode", super.getMfilelds().get("modulecode").toString()); + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.balancetype, t.pk.balancegroup"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ChargesDefinitionController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ChargesDefinitionController.java.svn-base new file mode 100644 index 0000000..3376c0c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ChargesDefinitionController.java.svn-base @@ -0,0 +1,399 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; +import org.primefaces.event.TabChangeEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.acco.AccountStatusController; +import com.fp.frontend.controller.pgeneral.lov.BalanceTypeLovController; +import com.fp.frontend.controller.pgeneral.product.ModuleController; +import com.fp.frontend.controller.pgeneral.product.ProductController; +import com.fp.frontend.controller.pgeneral.product.SubProductController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.acco.TgeneAccountStatus; +import com.fp.persistence.pgeneral.gene.TgeneBalanceType; +import com.fp.persistence.pgeneral.gene.TgeneCurrency; +import com.fp.persistence.pgeneral.product.TgeneModule; +import com.fp.persistence.pgeneral.product.TgeneProduct; +import com.fp.persistence.pgeneral.product.TgeneSubProduct; + +/** + * Clase controladora de definicion de cargos generales y cargos por subproducto. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ChargesDefinitionController extends AbstractController { + + public ChargesDefinitionController() throws Exception { + super(AbstractDataTransport.class); + } + + @ManagedProperty(value = "#{chargesController}") + private ChargesController charges; + + @ManagedProperty(value = "#{subProductChargesController}") + private SubProductChargesController subproduct; + + /** + * Id del tab activo. + */ + private String tabid = "charges"; + + /** + * Atributo lista de objetos TgeneModule + */ + private List lmodules; + + /** + * Lista de estatus de cuentas asociados a un modulo. + */ + private List laccountstatus; + + /** + * Atributo para la lista de objetos TgeneCurrency + */ + private List lcurrency; + + /** + * Atributo V/F render button + */ + private boolean active; + + /** + * Lista de productos pertenecientes a un modulo. + */ + private List lproduct; + /** + * Lista de subproductos pertenecientes al producto. + */ + private List lsubproduct; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.lmodules = ModuleController.find(); + this.lcurrency = CurrencyController.find(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void onTabChange(TabChangeEvent event) throws Exception { + this.tabid = event.getTab().getId(); + if(this.tabid.equals("charges")){ + this.active = false; + }else{ + this.active = true; + } + } + + + @Override + public void query() { + try { + if(this.tabid.equals("charges") ){ + this.charges.query(); + }else { + this.subproduct.query(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() { + try { + try { + if(this.tabid.equals("charges") ){ + this.charges.next(); + }else { + this.subproduct.next(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void previous() { + try { + if(this.tabid.equals("charges") ){ + this.charges.previous(); + }else { + this.subproduct.previous(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + + DtoSave dtosaveprod = this.charges.getDtoSave(); + if(dtosaveprod.pendingProcess()){ + dtosaveprod.setReturnpk(true); + msave.put(this.charges.getBeanalias(), dtosaveprod); // adicionar metadata de mantenimiento para cada tabla. + } + DtoSave dtosavesubpro = this.subproduct.getDtoSave(); + if(dtosavesubpro.pendingProcess()){ + dtosavesubpro.setReturnpk(true); + msave.put(this.subproduct.getBeanalias(), dtosavesubpro); // adicionar metadata de mantenimiento para cada tabla. + } + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.charges.postCommit(resp); + this.subproduct.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + } + + @Override + public void postCommit(Response response) throws Exception { + } + + + + /** + * Actualzia el campo modulecode en cada controlador que esta inyectado. La actualizacion se realiza cuando cambia el modulo en la pantalla. + * @throws Exception + */ + public void updatemodule() throws Exception { + String modulecode = super.getMfilters().get("pk.modulecode"); + this.charges.addFilter("pk.modulecode", modulecode); + this.subproduct.addFilter("pk.modulecode", modulecode); + this.subproduct.addFilter("pk.productcode", null); + this.subproduct.addFilter("pk.subproductcode", null); + this.getProducts(); + laccountstatus = AccountStatusController.find(modulecode); + this.charges.setLrecord(null); + } + + /** + * Refresca la lista de productos dado un codigo de modulo. + * @param modulecode Codigo de modulo. + * @throws Exception + */ + public void getProducts() { + try{ + if(super.getMfilters().get("pk.modulecode")!=null){ + this.lproduct = ProductController.find(super.getMfilters().get("pk.modulecode")); + this.lsubproduct = new ArrayList<>(); + this.subproduct.setLrecord(null); + }else{ + this.lproduct = new ArrayList<>(); + this.lsubproduct = new ArrayList<>(); + this.subproduct.setLrecord(null); + } + }catch(Exception ex){ + MessageHelper.setMessageError(ex); + } + + } + + /** + * Refresca lista de subproductos, dado el codigo de modulo y de producto. + * @param modulecode Codigo de modulo. + * @param productcode Codigo de producto. + * @throws Exception + */ + public void getSubProducts() { + try{ + if(super.getMfilters().get("pk.productcode")!=null){ + this.subproduct.addFilter("pk.productcode", super.getMfilters().get("pk.productcode")); + this.lsubproduct = SubProductController.find( super.getMfilters().get("pk.modulecode"), super.getMfilters().get("pk.productcode")); + this.subproduct.setLrecord(null); + }else{ + this.lsubproduct = new ArrayList<>(); + this.subproduct.addFilter("pk.productcode", null); + } + + }catch(Exception ex){ + MessageHelper.setMessageError(ex); + } + } + + public void refreshSubProduct(){ + if(super.getMfilters().get("pk.subproductcode")!=null){ + this.subproduct.addFilter("pk.subproductcode", super.getMfilters().get("pk.subproductcode")); + }else{ + this.subproduct.addFilter("pk.subproductcode", null); + this.subproduct.setLrecord(null); + } + } + + /** + * Lov de tipos de saldo. + */ + public void openBalancetypeLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add(super.getMfilters().get("pk.modulecode").toString()); + + params.put("modulecode", l); + List lcat = new ArrayList<>(); + lcat.add("CHARGES"); + params.put("category", lcat); + BalanceTypeLovController.openLov(params); + } + + /** + * Fija datos del tipo de saldo al cerrar el lov. + * @param event + * @throws Exception + */ + public void onReturnBalancetypeLovCharges(SelectEvent event) throws Exception { + TgeneBalanceType t = (TgeneBalanceType) event.getObject(); + this.charges.getRecord().getPk().setBalancetype(t.getPk().getBalancetype()); + this.charges.getRecord().getPk().setBalancegroup(t.getPk().getBalancegroup()); + } + + /** + * Fija datos del tipo de saldo al cerrar el lov. + * @param event + * @throws Exception + */ + public void onReturnBalancetypeLovSub(SelectEvent event) throws Exception { + TgeneBalanceType t = (TgeneBalanceType) event.getObject(); + this.subproduct.getRecord().getPk().setBalancetype(t.getPk().getBalancetype()); + this.subproduct.getRecord().getPk().setBalancegroup(t.getPk().getBalancegroup()); + } + + /** + * Entrega el valor de: lmodules + * @return List + */ + public List getLmodules() { + return this.lmodules; + } + + /** + * Entrega el valor de: charges + * @return ChargesController + */ + public ChargesController getCharges() { + return this.charges; + } + + /** + * Fija el valor de: charges + * @param charges Valor a fijar en el atributo. + */ + + public void setCharges(ChargesController charges) { + this.charges = charges; + } + + /** + * Entrega el valor de: subproduct + * @return SubProductChargesController + */ + public SubProductChargesController getSubproduct() { + return this.subproduct; + } + + /** + * Fija el valor de: subproduct + * @param subproduct Valor a fijar en el atributo. + */ + + public void setSubproduct(SubProductChargesController subproduct) { + this.subproduct = subproduct; + } + + /** + * Entrega el valor de: laccountstatus + * @return List + */ + public List getLaccountstatus() { + return this.laccountstatus; + } + + + /** + * Entrega el valor de: lcurrency + * @return List + */ + public List getLcurrency() { + return this.lcurrency; + } + + /** + * Entrega V/F si es activo + * @return active + */ + public boolean isActive() { + return active; + } + + /** + * Fina V/F si es activo o no + * @param active + */ + public void setActive(boolean active) { + this.active = active; + } + + /** + * Entrega el valor de: lproduct + * @return List + */ + public List getLproduct() { + return lproduct; + } + + /** + * Entrega el valor de: lsubproduct + * @return List + */ + public List getLsubproduct() { + return lsubproduct; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ChargesGroupController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ChargesGroupController.java.svn-base new file mode 100644 index 0000000..ce06f43 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ChargesGroupController.java.svn-base @@ -0,0 +1,223 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.acco.AccountStatusController; +import com.fp.frontend.controller.pgeneral.lov.BalanceTypeLovController; +import com.fp.frontend.controller.pgeneral.product.ModuleController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.acco.TgeneAccountStatus; +import com.fp.persistence.pgeneral.charge.TgeneChargesGroup; +import com.fp.persistence.pgeneral.gene.TgeneBalanceType; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCurrency; +import com.fp.persistence.pgeneral.product.TgeneModule; + +/** + * Clase controladora del bean TgeneChargesGroup. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ChargesGroupController extends AbstractController { + + private List lmodules; + private List lgroups; + /** + * Lista de estatus de cuentas asociados a un modulo. + */ + private List laccountstatus; + + private List lcurrency; + + public ChargesGroupController() throws Exception { + super(TgeneChargesGroup.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CHARGESGROUP"; + lgroups = CatalogDetailController.find("CHARGES"); + lmodules = ModuleController.find(); + lmodules = ModuleController.find(); + lcurrency = CurrencyController.find(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + String modulecode = super.getMfilters().get("pk.modulecode"); + if (modulecode == null) { + MessageHelper.setMessageError("msg_modulerequird"); + return; + } + super.create(); + this.record.getPk().setModulecode( modulecode ); + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + this.record.getPk().setChargecatalogcode("CHARGES"); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.balancetype, t.pk.balancegroup"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + dtosave.setReturnpk(true); + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Lov de tipos de saldo. + */ + public void openBalancetypeLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add(super.getMfilters().get("pk.modulecode").toString()); + + params.put("modulecode", l); + List lcat = new ArrayList<>(); + lcat.add("CHARGES"); + params.put("category", lcat); + BalanceTypeLovController.openLov(params); + } + + /** + * Fija datos del tipo de saldo al cerrar el lov. + * @param event + * @throws Exception + */ + public void onReturnBalancetypeLov(SelectEvent event) throws Exception { + TgeneBalanceType t = (TgeneBalanceType) event.getObject(); + this.record.getPk().setBalancetype(t.getPk().getBalancetype()); + this.record.getPk().setBalancegroup(t.getPk().getBalancegroup()); + } + + /** + * Actualzia el campo modulecode en cada controlador que esta inyectado. La actualizacion se realiza cuando cambia el modulo en la pantalla. + * @throws Exception + */ + public void updatemodule() throws Exception { + String modulecode = super.getMfilters().get("pk.modulecode"); + laccountstatus = AccountStatusController.find(modulecode); + + } + + /** + * Entrega el valor de: lmodules + * @return List + */ + public List getLmodules() { + return lmodules; + } + + /** + * Entrega el valor de: lgroups + * @return List + */ + public List getLgroups() { + return lgroups; + } + + /** + * Entrega el valor de: laccountstatus + * @return List + */ + public List getLaccountstatus() { + return laccountstatus; + } + + /** + * Entrega el valor de: lcurrency + * @return List + */ + public List getLcurrency() { + return lcurrency; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/CityController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/CityController.java.svn-base new file mode 100644 index 0000000..5307711 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/CityController.java.svn-base @@ -0,0 +1,202 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Clase controladora del bean TgeneCity. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class CityController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public CityController() throws Exception { + super(TgeneCity.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CITY"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Método que entrega el listado objetos TgeneCity provincias + * + * @param countrycode Código de país + * @param provincecode Código de provincia + * @param cantoncode Código de cantón + * @return lrecord Lista de objetos TgeneCity + */ + public static List find(String countrycode, String provincecode, String cantoncode) { + try { + CityController cc = new CityController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.addFilter("pk.provincecode", provincecode); + cc.addFilter("pk.cantoncode", cantoncode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + + /** + * Metodo para buscar por codigo de ciudad + * @param citycode + * @return + */ + public static List findPorCodigo(String countrycode, String provincecode, String cantoncode, String citycode){ + try { + CityController cc = new CityController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.addFilter("pk.provincecode", provincecode); + cc.addFilter("pk.cantoncode", cantoncode); + cc.addFilter("pk.citycode", citycode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para buscar el nombre de la ciudad atraves del codigo + * @param provincecode + * @return + */ + public static String getDescCiudadByCodigo(String countrycode, String provincecode, String cantoncode, String citycode){ + try { + if(countrycode==null || provincecode==null || cantoncode==null || citycode==null || countrycode.isEmpty() || provincecode.isEmpty() || cantoncode.isEmpty() || citycode.isEmpty()){ + return null; + } + CityController cc = new CityController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.addFilter("pk.provincecode", provincecode); + cc.addFilter("pk.cantoncode", cantoncode); + cc.addFilter("pk.citycode", citycode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TgeneCity ciudad = cc.lrecord.get(0); + if(ciudad.getDescription()!=null){ + return ciudad.getDescription(); + }else{ + return ""; + } + } + return ""; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return ""; + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/CountryController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/CountryController.java.svn-base new file mode 100644 index 0000000..8a71e3b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/CountryController.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCountry; + +/** + * Clase controladora del bean TgeneCountry. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class CountryController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public CountryController() throws Exception { + super(TgeneCountry.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "COUNTRY"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Método que entrega una lista objetos TgeneCountry países + * + * @return lrecord Lista de objetos TgeneCountry + */ + public static List find() { + try { + CountryController cc = new CountryController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + + public static TgeneCountry findcountry(String country) { + try { + CountryController cc = new CountryController(); + + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", country); + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/CurrencyController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/CurrencyController.java.svn-base new file mode 100644 index 0000000..9490128 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/CurrencyController.java.svn-base @@ -0,0 +1,133 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCurrency; + +/** + * Clase controladora del bean TgeneCurrency. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CurrencyController extends AbstractController { + + public CurrencyController() throws Exception { + super(TgeneCurrency.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CURRENCY"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Metodo que entrega el listado objetos TgeneCurrency + * @return lrecord Lista de objetos TgeneCurrency + */ + public static List find() { + try { + CurrencyController cc = new CurrencyController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/LanguageController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/LanguageController.java.svn-base new file mode 100644 index 0000000..a91cbc7 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/LanguageController.java.svn-base @@ -0,0 +1,140 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneLanguage; + +/** + * Clase controladora del bean TgeneLanguage. + * + * @author Andres E. Carpio + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class LanguageController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public LanguageController() throws Exception { + super(TgeneLanguage.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CHANNEL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de + // orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Entrega una lista de objetos TgeneLanguage + * + * @return lchannels Lista de objetos TgeneLanguage + */ + public static List find() { + try { + LanguageController cc = new LanguageController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/OfficeAndBranchController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/OfficeAndBranchController.java.svn-base new file mode 100644 index 0000000..327462a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/OfficeAndBranchController.java.svn-base @@ -0,0 +1,300 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.BranchLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneBranch; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Clase controladora del bean TgeneMenu. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class OfficeAndBranchController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public OfficeAndBranchController() throws Exception { + super(AbstractDataTransport.class); + } + + @ManagedProperty(value = "#{branchController}") + private BranchController branch; + + @ManagedProperty(value = "#{officeController}") + private OfficeController office; + + /** + * Atributo para la lista de objetos TgeneCountry + */ + private List lCountry; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lProvince; + + /** + * Atributo para la lista de objetos TgeneCanton + */ + private List lCanton; + + /** + * Atributo para la lista de objetos TgeneCity + */ + private List lCity; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //Listas + this.lCountry = CountryController.find(); + this.lProvince = new ArrayList(); + this.lCanton = new ArrayList(); + this.lCity = new ArrayList(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 4; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEMENU"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + + try { + this.branch.query(); + + if(this.office.getMfilters().get("")!=null && !this.office.getMfilters().get("pk.branchcode").equals("")){ + this.office.query(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + //Dto General + //DtoSave dtosave = super.getDtoSave(); + + //Dto Sucursal + DtoSave dtosavebranch = this.branch.getDtoSave(); + + //Dto Oficina + DtoSave dtosaveoffice = this.office.getDtoSave(); + + if(!dtosavebranch.pendingProcess() && !dtosaveoffice.pendingProcess()){ + return; + } + + HashMap msave = new HashMap(); + + if(dtosavebranch.pendingProcess()){ + msave.put(this.branch.getBeanalias(), dtosavebranch); + } + if(dtosaveoffice.pendingProcess()){ + msave.put(this.office.getBeanalias(), dtosaveoffice); + } + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + //this.postCommit(resp); + this.branch.postCommit(resp); + this.office.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Llama al Lov MenuLevel + */ + public void openBranchLov() { + Map> params = new HashMap<>(); + BranchLovController.openLov(params); + } + + /** + * Gestiona la respuesta del Lov MenuLevel para transacciones por nivel + * @param event + * @throws Exception + */ + public void onReturnBranchLov(SelectEvent event) throws Exception { + TgeneBranch t = (TgeneBranch) event.getObject(); + this.office.initRecPage(); + this.office.addFilter("pk.branchcode", t.getPk().getBranchcode().toString()); + this.office.getMfilelds().put("branchdesc", t.getDescription()); + this.office.query(); + } + + public void onChangeCountry(){ + if(this.office.getRecord().getCountrycode()!=null){ + this.lProvince = ProvinceController.find(this.office.getRecord().getCountrycode()); + this.lCanton = new ArrayList(); + this.lCity = new ArrayList(); + } + } + + public void onChangeProvince(){ + if(this.office.getRecord().getProvincecode()!=null){ + this.lCanton = CantonController.find(this.office.getRecord().getCountrycode(), this.office.getRecord().getProvincecode()); + this.lCity = new ArrayList(); + } + } + + public void onChangeCanton(){ + if(this.office.getRecord().getCantoncode()!=null){ + this.lCity = CityController.find(this.office.getRecord().getCountrycode(), this.office.getRecord().getProvincecode(), this.office.getRecord().getCantoncode()); + } + } + + /** + * Consulta las listas al abrir el editar + */ + public void openEdit(){ + if(this.office.getRecord()!=null){ + this.lProvince = ProvinceController.find(this.office.getRecord().getCountrycode()); + this.lCanton = CantonController.find(this.office.getRecord().getCountrycode(), this.office.getRecord().getProvincecode()); + this.lCity = CityController.find(this.office.getRecord().getCountrycode(), this.office.getRecord().getProvincecode(), this.office.getRecord().getCantoncode()); + } + } + + /** + * Entrega el valor de OfficeController + * @return office + */ + public OfficeController getOffice() { + return office; + } + + /** + * Fija el valor de OfficeController + * @param office + */ + public void setOffice(OfficeController office) { + this.office = office; + } + + /** + * Entrega el valor de BranchController + * @return branch + */ + public BranchController getBranch() { + return branch; + } + + /** + * fija el valor de BranchController + * @param branch + */ + public void setBranch(BranchController branch) { + this.branch = branch; + } + + /** + * Entrega el valor de lCountry + * @return lCountry + */ + public List getlCountry() { + return lCountry; + } + + /** + * Fija el valor de lCountry + * @param lCountry + */ + public void setlCountry(List lCountry) { + this.lCountry = lCountry; + } + + /** + * Entrega el valor de lProvince + * @return lProvince + */ + public List getlProvince() { + return lProvince; + } + + /** + * Fija el valor de lProvince + * @param lProvince + */ + public void setlProvince(List lProvince) { + this.lProvince = lProvince; + } + + /** + * Entrega el valor de lCanton + * @return lCanton + */ + public List getlCanton() { + return lCanton; + } + + /** + * Fija el valor de lCanton + * @param lCanton + */ + public void setlCanton(List lCanton) { + this.lCanton = lCanton; + } + + /** + * Entrega el valor de lCity + * @return lCity + */ + public List getlCity() { + return lCity; + } + + /** + * Fija el valor de lCity + * @param lCity + */ + public void setlCity(List lCity) { + this.lCity = lCity; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/OfficeController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/OfficeController.java.svn-base new file mode 100644 index 0000000..bba073b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/OfficeController.java.svn-base @@ -0,0 +1,174 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneOffice; + +/** + * Clase controladora del bean TgeneOffice. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class OfficeController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public OfficeController() throws Exception { + super(TgeneOffice.class); + } + + + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEOFFICE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Inicializa las paginas en la consulta + */ + public void initRecPage(){ + this.page = 0; + this.recperpage = 10; + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.branchcode") == null || super.getMfilters().get("pk.branchcode").equals("")) { + MessageHelper.setMessageError("msg_branchRequired"); + return; + } + super.create(); + this.record.put("branchdesc", super.getMfilelds().get("branchdesc")); + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + this.record.getPk().setBranchcode(new Integer(super.getMfilters().get("pk.branchcode"))); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if (super.getMfilters().get("pk.branchcode") == null) { + MessageHelper.setMessageError("msg_branchRequired"); + return; + } + if(super.getMfilters().get("pk.companycode")==null || super.getMfilters().get("pk.companycode").equals("")){ + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + } + + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.officecode"); + + // subqueries + SubQuery subquery = new SubQuery("TgeneBranch", "description", "branchdesc", + "i.pk.companycode = t.pk.companycode and i.pk.branchcode = t.pk.branchcode"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public static List find(String branch, String companycode) { + try { + OfficeController oc = new OfficeController(); + oc.init(); + oc.recperpage = 300; + oc.addFilter("pk.branchcode", branch); + oc.addFilter("pk.companycode", companycode); + oc.querydatabase(); + if (oc.lrecord != null && !oc.lrecord.isEmpty()) { + return oc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} + + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ParametersController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ParametersController.java.netbeans-base new file mode 100644 index 0000000..2857eda --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ParametersController.java.netbeans-base @@ -0,0 +1,156 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +/** + * Clase controladora del lov asociado al bean TgeneParameters. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ParametersController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public ParametersController() throws Exception { + super(TgeneParameters.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + // + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PARAMETERS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void update(){ + try{ + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + super.update(); + }catch(Exception ex){ + MessageHelper.setMessageError(ex); + } + } + + public void update(TgeneParameters bean){ + try { + this.record = bean; + super.update(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.code"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Entrega un objeto TgeneParameters + * @param code Có de parámetro + * @param companycode Código de compania + * @return record Objetos TgeneParameters + */ + public static TgeneParameters find(String code, String companycode) { + try { + ParametersController cc = new ParametersController(); + cc.init(); + cc.recperpage = 10; + cc.addFilter("pk.code", code); + cc.addFilter("pk.companycode", companycode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ParametersController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ParametersController.java.svn-base new file mode 100644 index 0000000..2857eda --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ParametersController.java.svn-base @@ -0,0 +1,156 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneParameters; + +/** + * Clase controladora del lov asociado al bean TgeneParameters. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ParametersController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public ParametersController() throws Exception { + super(TgeneParameters.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + // + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PARAMETERS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void update(){ + try{ + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + super.update(); + }catch(Exception ex){ + MessageHelper.setMessageError(ex); + } + } + + public void update(TgeneParameters bean){ + try { + this.record = bean; + super.update(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.code"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Entrega un objeto TgeneParameters + * @param code Có de parámetro + * @param companycode Código de compania + * @return record Objetos TgeneParameters + */ + public static TgeneParameters find(String code, String companycode) { + try { + ParametersController cc = new ParametersController(); + cc.init(); + cc.recperpage = 10; + cc.addFilter("pk.code", code); + cc.addFilter("pk.companycode", companycode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ParroquiaController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ParroquiaController.java.svn-base new file mode 100644 index 0000000..f6c77a8 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ParroquiaController.java.svn-base @@ -0,0 +1,177 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; + +/** + * Clase controladora del bean TgeneProvince. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ParroquiaController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public ParroquiaController() throws Exception { + super(TgeneParroquia.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PARROQUIA"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Método que entrega el listado objetos TgeneParroquia parroquias + * + * @param countrycode Código de país + * @param provincecode Código de provincia + * @param cantoncode Código de cantón + * @return lrecord Lista de objetos TgeneParroquia + */ + public static List find(String countrycode, String provincecode, String cantoncode) { + try { + ParroquiaController cc = new ParroquiaController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.addFilter("pk.provincecode", provincecode); + cc.addFilter("pk.cantoncode", cantoncode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + + /** + * Metodo para buscar el nombre de la parroquia atraves del codigo + * @param provincecode + * @return + */ + public static String getDescParroquiaByCodigo(String countrycode, String provincecode, String cantoncode, String parroquiacode){ + try { + if(countrycode==null || provincecode==null || cantoncode==null || parroquiacode==null || countrycode.isEmpty() || provincecode.isEmpty() || cantoncode.isEmpty() || parroquiacode.isEmpty()){ + return null; + } + ParroquiaController cc = new ParroquiaController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.addFilter("pk.provincecode", provincecode); + cc.addFilter("pk.cantoncode", cantoncode); + cc.addFilter("pk.parroquiacode", parroquiacode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TgeneParroquia parroquia = cc.lrecord.get(0); + if(parroquia.getDescription()!=null){ + return parroquia.getDescription(); + }else{ + return ""; + } + } + return ""; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return ""; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ProvinceController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ProvinceController.java.svn-base new file mode 100644 index 0000000..6b17715 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ProvinceController.java.svn-base @@ -0,0 +1,225 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Clase controladora del bean TgeneProvince. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ProvinceController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public ProvinceController() throws Exception { + super(TgeneProvince.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PROVINCE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Método que entrega el listado objetos TgeneProvince provincias + * + * @param countrycode Código de país + * @return lrecord Lista de objetos TgeneProvince + */ + public static List find(String countrycode) { + try { + ProvinceController cc = new ProvinceController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Metodo para buscar por codigo de provincia + * @param provincecode + * @return + */ + public static List findPorCodigo(String countrycode, String provincecode){ + try { + ProvinceController cc = new ProvinceController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.addFilter("pk.provincecode", provincecode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + + /** + * Metodo para buscar el nombre de la provincia atraves del codigo + * @param provincecode + * @return + */ + public static String getDescProvByCodigo(String countrycode, String provincecode){ + try { + if(countrycode==null || provincecode==null || countrycode.isEmpty() || provincecode.isEmpty()){ + return null; + } + ProvinceController cc = new ProvinceController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.addFilter("pk.provincecode", provincecode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TgeneProvince provincia = cc.lrecord.get(0); + if(provincia.getDescription()!=null){ + return provincia.getDescription(); + }else{ + return ""; + } + } + return ""; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return ""; + } + } + + public static List findxDescripcion(String countrycode,String codigoProvincia,String descripcion) { + try { + ProvinceController cc = new ProvinceController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + if(codigoProvincia!=null && codigoProvincia.length()>0){ + cc.addFilter("pk.provincecode", codigoProvincia); + } + if(descripcion!=null && descripcion.length()>0){ + cc.addFilter("description", descripcion); + } + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/QueryController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/QueryController.java.svn-base new file mode 100644 index 0000000..5a854dc --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/QueryController.java.svn-base @@ -0,0 +1,173 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.HashMap; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.TabChangeEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; + +/** + * Clase controladora del bean AbstractDataTransport. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class QueryController extends AbstractController { + + @ManagedProperty(value = "#{queryProcessController}") + private QueryProcessController queryprocess; + + @ManagedProperty(value = "#{transactionQueryController}") + private TransactionQueryController transactionquery; + + private String tabid = "ttransaction"; + + public QueryController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void onTabChange(TabChangeEvent event) throws Exception { + this.tabid = event.getTab().getId(); + } + + @Override + public void query() { + try { + if(this.tabid.equals("queryprocess") ){ + this.queryprocess.query(); + }else{ + this.transactionquery.query(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() { + try { + if (this.tabid.equals("queryprocess")) { + this.queryprocess.next(); + } else { + this.transactionquery.next(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void previous() { + try { + if (this.tabid.equals("queryprocess")) { + this.queryprocess.previous(); + } else { + this.transactionquery.previous(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + + DtoSave dtosavetq = this.transactionquery.getDtoSave(); + if(dtosavetq.pendingProcess()){ + dtosavetq.setReturnpk(true); + msave.put(this.transactionquery.getBeanalias(), dtosavetq); // adicionar metadata de mantenimiento para cada tabla. + } + DtoSave dtosaveqp = this.queryprocess.getDtoSave(); + if(dtosaveqp.pendingProcess()){ + dtosaveqp.setReturnpk(true); + msave.put(this.queryprocess.getBeanalias(), dtosaveqp); // adicionar metadata de mantenimiento para cada tabla. + } + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.transactionquery.postCommit(resp); + this.queryprocess.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + } + + /** + * Entrega el valor de: queryprocess + * @return QueryProcessController + */ + public QueryProcessController getQueryprocess() { + return this.queryprocess; + } + + /** + * Fija el valor de: queryprocess + * @param queryprocess Valor a fijar en el atributo. + */ + + public void setQueryprocess(QueryProcessController queryprocess) { + this.queryprocess = queryprocess; + } + + /** + * Entrega el valor de: transactionquery + * @return TransactionQueryController + */ + public TransactionQueryController getTransactionquery() { + return this.transactionquery; + } + + /** + * Fija el valor de: transactionquery + * @param transactionquery Valor a fijar en el atributo. + */ + + public void setTransactionquery(TransactionQueryController transactionquery) { + this.transactionquery = transactionquery; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/QueryProcessController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/QueryProcessController.java.svn-base new file mode 100644 index 0000000..0954507 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/QueryProcessController.java.svn-base @@ -0,0 +1,166 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.ProcessLovControler; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneQueryProcess; +import com.fp.persistence.pgeneral.proc.TgeneProcess; + +/** + * Clase controladora del bean TgeneQueryProcess. + * + * @author Andres E. Carpio + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class QueryProcessController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public QueryProcessController() throws Exception { + super(TgeneQueryProcess.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "QUERYPROCESS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneQueryProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + /** + * Actualiza datos de registros nuevos o modifiados, si el registro es nuevo + * se adiciona a lista de nuevos, si es actualizado se adiciona a la lista + * de actualizados. + * + * @throws Exception + */ + @Override + public void update() throws Exception { + if(this.record.getProcesscode() == null){ + MessageHelper.setMessageError("msg_processrequired"); + return; + } + super.update(); + } + + public DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden + // ("t.pk, t.nombre, t.cpais"). + + // subqueries + SubQuery subquery = new SubQuery( + "TgeneProcess", + "shortdesc", + "shortdesc", + "i.pk.processcode = t.processcode and i.pk.catalogtypeprocess = t.catalogtypeprocess and i.pk.catalogcodetypeprocess = t.catalogcodetypeprocess"); + dto.addSubQuery(subquery); + return dto; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = this.getDtoQuery(); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void openProcessLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("QUERY"); // valor del parametro + params.put("processtype", l); + ProcessLovControler.openLov(params); + } + + public void onReturnProcessLov(SelectEvent event) throws Exception { + TgeneProcess t = (TgeneProcess) event.getObject(); + this.record.setProcesscode(t.getPk().getProcesscode()); + this.record.put("messagedesc", t.getDescription()); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ServicesController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ServicesController.java.svn-base new file mode 100644 index 0000000..ecd5aa3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/ServicesController.java.svn-base @@ -0,0 +1,193 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneServices; + +/** + * Clase controladora del bean TgeneServices. + * + * @author WPA. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ServicesController extends AbstractController { + + /** + * Constructor + * @throws Exception + */ + public ServicesController() throws Exception { + super(TgeneServices.class); + } + + /** + * Atributo para el checkbox + */ + private boolean check; + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "SERVICES"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea el nuevo registro + */ + @Override + public void create(){ + try{ + this.check = false; + super.create(); + }catch(Exception ex){ + MessageHelper.setMessageError(ex); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Ejecuta el check + */ + public void changeCheck(){ + if(this.check){ + this.record.setAutomatic("Y"); + }else{ + this.record.setAutomatic("N"); + } + } + + /** + * Ejecuta el check en el edit + */ + public void checkEdit(){ + if(this.record.getAutomatic().equals("Y")){ + this.check = true; + }else{ + this.check = false; + } + } + + /** + * Entrega una lista de objetos TgeneServices + * @return lrecord Lista de objetos TgeneServices + */ + public static List find() { + try { + ServicesController sc = new ServicesController(); + sc.init(); + sc.recperpage = 300; + sc.querydatabase(); + if ((sc.lrecord != null) && !sc.lrecord.isEmpty()) { + return sc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Entrega V/F + * @return check + */ + public boolean isCheck() { + return check; + } + + /** + * Fija V/F + * @param check + */ + public void setCheck(boolean check) { + this.check = check; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/SubProductChargesController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/SubProductChargesController.java.svn-base new file mode 100644 index 0000000..336d5de --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/SubProductChargesController.java.svn-base @@ -0,0 +1,165 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.BalanceTypeLovController; +import com.fp.frontend.controller.pgeneral.product.ProductController; +import com.fp.frontend.controller.pgeneral.product.SubProductController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.charge.TgeneSubProductCharges; +import com.fp.persistence.pgeneral.gene.TgeneBalanceType; +import com.fp.persistence.pgeneral.product.TgeneProduct; +import com.fp.persistence.pgeneral.product.TgeneSubProduct; + +/** + * Clase controladora del bean TgeneSubProductCharges. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SubProductChargesController extends AbstractController { + + public SubProductChargesController() throws Exception { + super(TgeneSubProductCharges.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "SUBPRODUCTCHARGES"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if(!this.validaterequired()){ + return; + } + super.create(); + this.record.getPk().setModulecode( super.getMfilters().get("pk.modulecode")); + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + this.record.getPk().setProductcode(super.getMfilters().get("pk.productcode")); + this.record.getPk().setSubproductcode(super.getMfilters().get("pk.subproductcode")); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if(!this.validaterequired()){ + return; + } + Request request = this.callerhelper.getRequest(); + //super.addFilter("pk.modulecode", super.getMfilelds().get("modulecode").toString()); + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.balancetype, t.pk.balancegroup"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Valida filtros + * @return + * @throws Exception + */ + private boolean validaterequired() throws Exception { + if (super.getMfilters().get("pk.modulecode") == null) { + MessageHelper.setMessageError("msg_modulerequird"); + return false; + } + if (super.getMfilters().get("pk.productcode") == null) { + MessageHelper.setMessageError("msg_productrequird"); + return false; + } + if (super.getMfilters().get("pk.subproductcode") == null) { + MessageHelper.setMessageError("msg_subproductrequird"); + return false; + } + return true; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/TerminosCondicionesController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/TerminosCondicionesController.java.svn-base new file mode 100644 index 0000000..9fbb5f3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/TerminosCondicionesController.java.svn-base @@ -0,0 +1,127 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmTerminos; + + +@SuppressWarnings("serial") +@ManagedBean +@SessionScoped +public class TerminosCondicionesController extends AbstractController { + + /** + * Constructor + * @throws Exception + */ + public TerminosCondicionesController() throws Exception { + super(TarmTerminos.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOG"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + public static TarmTerminos findxIdentificacion(String identificacion) { + try { + TerminosCondicionesController cc = new TerminosCondicionesController(); + cc.init(); + cc.recperpage = 10; + cc.addFilter("identificacion", identificacion); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/TransactionQueryController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/TransactionQueryController.java.svn-base new file mode 100644 index 0000000..5e6c39b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/.svn/text-base/TransactionQueryController.java.svn-base @@ -0,0 +1,223 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pbpm.lov.TbpmRulesLovController; +import com.fp.frontend.controller.pgeneral.lov.ProcessLovControler; +import com.fp.frontend.controller.pgeneral.lov.TransactionLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmRules; +import com.fp.persistence.pgeneral.gene.TgeneTransactionQuery; +import com.fp.persistence.pgeneral.proc.TgeneProcess; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * Clase controladora del bean TgeneTransactionQuery. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TransactionQueryController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public TransactionQueryController() throws Exception { + super(TgeneTransactionQuery.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TRANSACTIONPROCESS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Actualiza datos de registros nuevos o modifiados, si el registro es nuevo + * se adiciona a lista de nuevos, si es actualizado se adiciona a la lista + * de actualizados. + * + * @throws Exception + */ + @Override + public void update() throws Exception { + if(this.record.getProcesscode() == null){ + MessageHelper.setMessageError("msg_processrequired"); + return; + } + super.update(); + } + + public void openTransactionLov() { + Map> params = new HashMap<>(); + TransactionLovController.openLov(params); + } + + public void onReturnTransactionLov(SelectEvent event) throws Exception { + TgeneTransaction t = (TgeneTransaction) event.getObject(); + super.addFilter("pk.transactionmodule", t.getPk().getTransactionmodule()); + super.addFilter("pk.transactioncode", t.getPk().getTransactioncode().toString()); + super.addFilter("pk.transactionversion", t.getPk().getTransactionversion().toString()); + super.addField("name", t.getName()); + this.query(); + } + + /** + * Crea una instancia de TgeneTransactionQuery y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.transactionmodule") == null) { + MessageHelper.setMessageError("msg_transactionrequird"); + return; + } + super.create(); + this.record.getPk().setTransactionmodule(super.getMfilters().get("pk.transactionmodule")); + this.record.getPk().setTransactioncode(Integer.valueOf(super.getMfilters().get("pk.transactioncode"))); + this.record.getPk().setTransactionversion(Integer.valueOf(super.getMfilters().get("pk.transactionversion"))); + this.record.setCatalogtypeprocess("QUERY"); + this.record.setCatalogcodetypeprocess("PROCESSTYPE"); + } + + public DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.executionorder"); + // subqueries + SubQuery subquery = new SubQuery("TgeneProcess", "shortdesc", "shortdesc", "i.pk.processcode = t.processcode"); + dto.addSubQuery(subquery); + return dto; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + if (super.getMfilters().get("pk.transactionmodule") == null) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = this.getDtoQuery(); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public void openProcessLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("QUERY"); // valor del parametro + params.put("processtype", l); + ProcessLovControler.openLov(params); + } + + public void onReturnProcessLov(SelectEvent event) throws Exception { + TgeneProcess t = (TgeneProcess) event.getObject(); + this.record.setProcesscode(t.getPk().getProcesscode()); + this.record.put("shortdesc", t.getShortdesc()); + } + + public void openRuleLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("R"); // valor del parametro + params.put("filetype", l); + TbpmRulesLovController.openLov(params); + } + + public void onReturnRuleLov(SelectEvent event) throws Exception { + TbpmRules t = (TbpmRules) event.getObject(); + // this.record.setProcesscode(t.getPk().getRulecode()); + this.record.setRulename(t.getPk().getRulecode()); + this.record.put("ruledesc", t.getDescription()); + } + + public void openFlowLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("F"); // valor del parametro + params.put("filetype", l); + TbpmRulesLovController.openLov(params); + } + + public void onReturnFlowLov(SelectEvent event) throws Exception { + TbpmRules t = (TbpmRules) event.getObject(); + this.record.setProcessname(t.getPk().getRulecode()); + this.record.put("flowdesc", t.getDescription()); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/AreaController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/AreaController.java new file mode 100644 index 0000000..5159ce5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/AreaController.java @@ -0,0 +1,142 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneArea; + +/** + * Clase controladora del bean TgeneArea. + * + * @author Andres E. Carpio + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class AreaController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public AreaController() throws Exception { + super(TgeneArea.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CHANNEL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de + // orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Entrega una lista de objetos TgeneArea + * + * @return lchannels Lista de objetos TgeneArea + */ + public static List find(String company) { + try { + AreaController cc = new AreaController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.companycode", company); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/BalanceGroupController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/BalanceGroupController.java new file mode 100644 index 0000000..549218b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/BalanceGroupController.java @@ -0,0 +1,128 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneBalanceGroup; + +/** + * Clase controladora del bean TgeneBalanceGroup. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class BalanceGroupController extends AbstractController { + + public BalanceGroupController() throws Exception { + super(TgeneBalanceGroup.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "BALANCEGROUP"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public static List find() { + try { + BalanceGroupController bgc = new BalanceGroupController(); + bgc.init(); + bgc.recperpage = 300; + bgc.querydatabase(); + if (bgc.lrecord != null && !bgc.lrecord.isEmpty()) { + return bgc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/BalanceTypeController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/BalanceTypeController.java new file mode 100644 index 0000000..cc4db01 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/BalanceTypeController.java @@ -0,0 +1,146 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.product.ModuleController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneBalanceGroup; +import com.fp.persistence.pgeneral.gene.TgeneBalanceType; +import com.fp.persistence.pgeneral.product.TgeneModule; + +/** + * Clase controladora del bean TgeneBalanceType. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class BalanceTypeController extends AbstractController { + + /** + * Lista de modulos. + */ + private List lmodule; + /** + * Lista de grupos de balance. + */ + private List lbalancegroup; + + public BalanceTypeController() throws Exception { + super(TgeneBalanceType.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "BALANCETYPE"; + lmodule = ModuleController.find(); + lbalancegroup = BalanceGroupController.find(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Entrega el valor de: lmodule + * + * @return List + */ + public List getLmodule() { + return lmodule; + } + + /** + * Entrega el valor de: lbalancegroup + * + * @return List + */ + public List getLbalancegroup() { + return lbalancegroup; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.balancetype"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/BranchController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/BranchController.java new file mode 100644 index 0000000..b3d1a74 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/BranchController.java @@ -0,0 +1,148 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneBranch; + +/** + * Clase controladora del bean TgeneCatalogDetail. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class BranchController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public BranchController() throws Exception { + super(TgeneBranch.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEBRANCH"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Inicializa las paginas en la consulta + */ + public void initRecPage() { + this.page = 0; + this.recperpage = 10; + } + + @Override + public void create() { + try { + super.create(); + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + } catch (Exception ex) { + + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + //super.getMfilters().put("pk.branchcode", "!=0"); + if (super.getMfilters().get("pk.companycode") == null || super.getMfilters().get("pk.companycode").equals("")) { + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + } + + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.branchcode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static List find(String company) { + try { + BranchController bc = new BranchController(); + bc.init(); + bc.recperpage = 300; + bc.addFilter("pk.companycode", company); + bc.querydatabase(); + if (bc.lrecord != null && !bc.lrecord.isEmpty()) { + return bc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/CantonController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/CantonController.java new file mode 100644 index 0000000..1c0283e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/CantonController.java @@ -0,0 +1,201 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Clase controladora del bean TgeneProvince. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class CantonController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public CantonController() throws Exception { + super(TgeneCanton.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CANTON"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Método que entrega el listado objetos TgeneCanton provincias + * + * @param countrycode Código de país + * @param provincecode Código de provincia + * @return lrecord Lista de objetos TgeneCanton + */ + public static List find(String countrycode, String provincecode) { + try { + CantonController cc = new CantonController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.addFilter("pk.provincecode", provincecode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Metodo para buscar por codigo de ciudad + * + * @param citycode + * @return + */ + public static List findPorCodigo(String countrycode, String provincecode, String cantoncode) { + try { + CantonController cc = new CantonController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.addFilter("pk.provincecode", provincecode); + cc.addFilter("pk.cantoncode", cantoncode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para buscar el nombre del canton atraves del codigo + * + * @param provincecode + * @return + */ + public static String getDescCantonByCodigo(String countrycode, String provincecode, String cantoncode) { + try { + if (countrycode == null || provincecode == null || cantoncode == null || countrycode.isEmpty() || provincecode.isEmpty() || cantoncode.isEmpty()) { + return null; + } + CantonController cc = new CantonController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.addFilter("pk.provincecode", provincecode); + cc.addFilter("pk.cantoncode", cantoncode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TgeneCanton canton = cc.lrecord.get(0); + if (canton.getDescription() != null) { + return canton.getDescription(); + } else { + return ""; + } + } + return ""; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return ""; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/CatalogController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/CatalogController.java new file mode 100644 index 0000000..bff530a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/CatalogController.java @@ -0,0 +1,121 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pentaho.PentahoController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; + +/** + * Clase controladora del bean TgeneCatalog. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CatalogController extends AbstractController { + + /** + * Constructor + * + * @throws Exception + */ + public CatalogController() throws Exception { + super(TgeneCatalog.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOG"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/CatalogDetailBpmController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/CatalogDetailBpmController.java new file mode 100644 index 0000000..7cd463f --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/CatalogDetailBpmController.java @@ -0,0 +1,144 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.CatalogLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetailTest; + +/** + * Clase controladora del bean TgeneCatalogDetailTest. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class CatalogDetailBpmController extends AbstractController { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public CatalogDetailBpmController() throws Exception { + super(TgeneCatalogDetailTest.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOGDETAIL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.catalogcode") == null) { + MessageHelper.setMessageError("msg_catalogrequird"); + return; + } + super.create(); + this.record.getPk().setCatalogcode(super.getMfilters().get("pk.catalogcode")); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.catalog"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void openCatalogLov() { + Map> params = new HashMap<>(); + CatalogLovController.openLov(params); + } + + public void onReturnCatalogLov(SelectEvent event) throws Exception { + TgeneCatalog t = (TgeneCatalog) event.getObject(); + super.addFilter("pk.catalogcode", t.getPk()); + super.addField("catalogname", t.getDescription()); + this.query(); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/CatalogDetailController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/CatalogDetailController.java new file mode 100644 index 0000000..d352ec9 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/CatalogDetailController.java @@ -0,0 +1,374 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.CatalogLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora del bean TgeneCatalogDetail. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CatalogDetailController extends AbstractController { + + public CatalogDetailController() throws Exception { + super(TgeneCatalogDetail.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOGDETAIL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.catalogcode") == null) { + MessageHelper.setMessageError("msg_catalogrequird"); + return; + } + super.create(); + this.record.getPk().setCatalogcode(super.getMfilters().get("pk.catalogcode")); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void openCatalogLov() { + Map> params = new HashMap<>(); + CatalogLovController.openLov(params); + } + + public void onReturnCatalogLov(SelectEvent event) throws Exception { + TgeneCatalog t = (TgeneCatalog) event.getObject(); + super.addFilter("pk.catalogcode", t.getPk()); + super.addField("catalogname", t.getDescription()); + this.query(); + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * + * @param catalogcode Có de catálogo + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static List find(String catalogcode) { + try { + CatalogDetailController cc = new CatalogDetailController(); + cc.init(); + cc.recperpage = 10000; + cc.addFilter("pk.catalogcode", catalogcode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * + * @param catalogcode Có de catálogo + * @param legalcode Código legal + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static List find(String catalogcode, String legalcode) { + try { + CatalogDetailController cc = new CatalogDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalogcode", catalogcode); + cc.addFilter("legalcode", legalcode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * + * @param catalogcode Có de catálogo + * @param catalog Código catalogo + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static List findCatalog(String catalogcode, String catalog) { + try { + CatalogDetailController cc = new CatalogDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalogcode", catalogcode); + cc.addFilter("pk.catalog", catalog); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Encuentra por los codigos de catalogo + * + * @param catalogcode + * @param catalog + * @return + */ + public static TgeneCatalogDetail findCatalogo(String catalogcode, String catalog) { + try { + if (catalogcode == null || catalog == null || catalogcode.isEmpty() || catalog.isEmpty()) { + return null; + } + CatalogDetailController cc = new CatalogDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalogcode", catalogcode); + cc.addFilter("pk.catalog", catalog); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que consulta por Catalog y Catalogcode ambos requeridos + */ + public static TgeneCatalogDetail findxCodigoCodcatalogo(String catalog, String catalogcode) { + try {//TgeneCatalogDetailKey + if (catalog != null && catalogcode != null) { + CatalogDetailController cc = new CatalogDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalogcode", catalogcode); + cc.addFilter("pk.catalog", catalog); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Obtiene un elemento del catalogo por su codigo + * + * @param catalog + * @return + */ + public static TgeneCatalogDetail findxCodigo(String catalog) { + try {//TgeneCatalogDetailKey + CatalogDetailController cc = new CatalogDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalog", catalog); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Obtiene un elemento del catalogo por su codigo de catalogo + * + * @param catalog + * @return + */ + public static List findByCatalogcode(String catalogcode) { + try {//TgeneCatalogDetailKey + CatalogDetailController cc = new CatalogDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalogcode", catalogcode); + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Obtiene un elemento del catalogo por su codigo de catalogo y descripcion + * + * @param catalog + * @return + */ + public static TgeneCatalogDetail findByCatalogcodeDescrption(String catalogcode, String descrption) { + try {//TgeneCatalogDetailKey + + if (catalogcode == null || descrption == null || catalogcode.isEmpty() || descrption.isEmpty()) { + return null; + } + CatalogDetailController cc = new CatalogDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalogcode", catalogcode); + cc.addFilter("description", descrption); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo que llena lal lista de géneros + */ + public static List getListGender() { + List gender = new ArrayList(); + String[] male = {"M", "MASCULINO"}; + String[] female = {"F", "FEMENINO"}; + gender.add(male); + gender.add(female); + return gender; + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * + * @param catalogcode Có de catálogo + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static List findClientType(String catalogcode, String legalcode) { + try { + CatalogDetailController cc = new CatalogDetailController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.catalogcode", catalogcode); + cc.addFilter("legalcode", legalcode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ChannelController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ChannelController.java new file mode 100644 index 0000000..3704447 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ChannelController.java @@ -0,0 +1,136 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneChannels; + +/** + * Clase controladora del bean TgeneChannels. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ChannelController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public ChannelController() throws Exception { + super(TgeneChannels.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CHANNEL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Entrega una lista de objetos TgeneChannels + * + * @return lchannels Lista de objetos TgeneChannels + */ + public static List find() { + try { + ChannelController cc = new ChannelController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ChargesController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ChargesController.java new file mode 100644 index 0000000..93232f6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ChargesController.java @@ -0,0 +1,142 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.BalanceTypeLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.charge.TgeneCharges; +import com.fp.persistence.pgeneral.gene.TgeneBalanceType; + +/** + * Clase controladora del bean TgeneCharges. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ChargesController extends AbstractController { + + public ChargesController() throws Exception { + super(TgeneCharges.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 12; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CHARGES"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.modulecode") == null) { + MessageHelper.setMessageError("msg_modulerequird"); + return; + } + super.create(); + this.record.getPk().setModulecode(super.getMfilters().get("pk.modulecode")); + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + if (super.getMfilters().get("pk.modulecode") == null) { + MessageHelper.setMessageError("msg_modulerequird"); + return; + } + //super.addFilter("pk.modulecode", super.getMfilelds().get("modulecode").toString()); + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.balancetype, t.pk.balancegroup"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ChargesDefinitionController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ChargesDefinitionController.java new file mode 100644 index 0000000..f095991 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ChargesDefinitionController.java @@ -0,0 +1,412 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; +import org.primefaces.event.TabChangeEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.acco.AccountStatusController; +import com.fp.frontend.controller.pgeneral.lov.BalanceTypeLovController; +import com.fp.frontend.controller.pgeneral.product.ModuleController; +import com.fp.frontend.controller.pgeneral.product.ProductController; +import com.fp.frontend.controller.pgeneral.product.SubProductController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.acco.TgeneAccountStatus; +import com.fp.persistence.pgeneral.gene.TgeneBalanceType; +import com.fp.persistence.pgeneral.gene.TgeneCurrency; +import com.fp.persistence.pgeneral.product.TgeneModule; +import com.fp.persistence.pgeneral.product.TgeneProduct; +import com.fp.persistence.pgeneral.product.TgeneSubProduct; + +/** + * Clase controladora de definicion de cargos generales y cargos por + * subproducto. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ChargesDefinitionController extends AbstractController { + + public ChargesDefinitionController() throws Exception { + super(AbstractDataTransport.class); + } + + @ManagedProperty(value = "#{chargesController}") + private ChargesController charges; + + @ManagedProperty(value = "#{subProductChargesController}") + private SubProductChargesController subproduct; + + /** + * Id del tab activo. + */ + private String tabid = "charges"; + + /** + * Atributo lista de objetos TgeneModule + */ + private List lmodules; + + /** + * Lista de estatus de cuentas asociados a un modulo. + */ + private List laccountstatus; + + /** + * Atributo para la lista de objetos TgeneCurrency + */ + private List lcurrency; + + /** + * Atributo V/F render button + */ + private boolean active; + + /** + * Lista de productos pertenecientes a un modulo. + */ + private List lproduct; + /** + * Lista de subproductos pertenecientes al producto. + */ + private List lsubproduct; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.lmodules = ModuleController.find(); + this.lcurrency = CurrencyController.find(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void onTabChange(TabChangeEvent event) throws Exception { + this.tabid = event.getTab().getId(); + if (this.tabid.equals("charges")) { + this.active = false; + } else { + this.active = true; + } + } + + @Override + public void query() { + try { + if (this.tabid.equals("charges")) { + this.charges.query(); + } else { + this.subproduct.query(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() { + try { + try { + if (this.tabid.equals("charges")) { + this.charges.next(); + } else { + this.subproduct.next(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void previous() { + try { + if (this.tabid.equals("charges")) { + this.charges.previous(); + } else { + this.subproduct.previous(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + + DtoSave dtosaveprod = this.charges.getDtoSave(); + if (dtosaveprod.pendingProcess()) { + dtosaveprod.setReturnpk(true); + msave.put(this.charges.getBeanalias(), dtosaveprod); // adicionar metadata de mantenimiento para cada tabla. + } + DtoSave dtosavesubpro = this.subproduct.getDtoSave(); + if (dtosavesubpro.pendingProcess()) { + dtosavesubpro.setReturnpk(true); + msave.put(this.subproduct.getBeanalias(), dtosavesubpro); // adicionar metadata de mantenimiento para cada tabla. + } + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.charges.postCommit(resp); + this.subproduct.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + } + + @Override + public void postCommit(Response response) throws Exception { + } + + /** + * Actualzia el campo modulecode en cada controlador que esta inyectado. La + * actualizacion se realiza cuando cambia el modulo en la pantalla. + * + * @throws Exception + */ + public void updatemodule() throws Exception { + String modulecode = super.getMfilters().get("pk.modulecode"); + this.charges.addFilter("pk.modulecode", modulecode); + this.subproduct.addFilter("pk.modulecode", modulecode); + this.subproduct.addFilter("pk.productcode", null); + this.subproduct.addFilter("pk.subproductcode", null); + this.getProducts(); + laccountstatus = AccountStatusController.find(modulecode); + this.charges.setLrecord(null); + } + + /** + * Refresca la lista de productos dado un codigo de modulo. + * + * @param modulecode Codigo de modulo. + * @throws Exception + */ + public void getProducts() { + try { + if (super.getMfilters().get("pk.modulecode") != null) { + this.lproduct = ProductController.find(super.getMfilters().get("pk.modulecode")); + this.lsubproduct = new ArrayList<>(); + this.subproduct.setLrecord(null); + } else { + this.lproduct = new ArrayList<>(); + this.lsubproduct = new ArrayList<>(); + this.subproduct.setLrecord(null); + } + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + + } + + /** + * Refresca lista de subproductos, dado el codigo de modulo y de producto. + * + * @param modulecode Codigo de modulo. + * @param productcode Codigo de producto. + * @throws Exception + */ + public void getSubProducts() { + try { + if (super.getMfilters().get("pk.productcode") != null) { + this.subproduct.addFilter("pk.productcode", super.getMfilters().get("pk.productcode")); + this.lsubproduct = SubProductController.find(super.getMfilters().get("pk.modulecode"), super.getMfilters().get("pk.productcode")); + this.subproduct.setLrecord(null); + } else { + this.lsubproduct = new ArrayList<>(); + this.subproduct.addFilter("pk.productcode", null); + } + + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public void refreshSubProduct() { + if (super.getMfilters().get("pk.subproductcode") != null) { + this.subproduct.addFilter("pk.subproductcode", super.getMfilters().get("pk.subproductcode")); + } else { + this.subproduct.addFilter("pk.subproductcode", null); + this.subproduct.setLrecord(null); + } + } + + /** + * Lov de tipos de saldo. + */ + public void openBalancetypeLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add(super.getMfilters().get("pk.modulecode").toString()); + + params.put("modulecode", l); + List lcat = new ArrayList<>(); + lcat.add("CHARGES"); + params.put("category", lcat); + BalanceTypeLovController.openLov(params); + } + + /** + * Fija datos del tipo de saldo al cerrar el lov. + * + * @param event + * @throws Exception + */ + public void onReturnBalancetypeLovCharges(SelectEvent event) throws Exception { + TgeneBalanceType t = (TgeneBalanceType) event.getObject(); + this.charges.getRecord().getPk().setBalancetype(t.getPk().getBalancetype()); + this.charges.getRecord().getPk().setBalancegroup(t.getPk().getBalancegroup()); + } + + /** + * Fija datos del tipo de saldo al cerrar el lov. + * + * @param event + * @throws Exception + */ + public void onReturnBalancetypeLovSub(SelectEvent event) throws Exception { + TgeneBalanceType t = (TgeneBalanceType) event.getObject(); + this.subproduct.getRecord().getPk().setBalancetype(t.getPk().getBalancetype()); + this.subproduct.getRecord().getPk().setBalancegroup(t.getPk().getBalancegroup()); + } + + /** + * Entrega el valor de: lmodules + * + * @return List + */ + public List getLmodules() { + return this.lmodules; + } + + /** + * Entrega el valor de: charges + * + * @return ChargesController + */ + public ChargesController getCharges() { + return this.charges; + } + + /** + * Fija el valor de: charges + * + * @param charges Valor a fijar en el atributo. + */ + public void setCharges(ChargesController charges) { + this.charges = charges; + } + + /** + * Entrega el valor de: subproduct + * + * @return SubProductChargesController + */ + public SubProductChargesController getSubproduct() { + return this.subproduct; + } + + /** + * Fija el valor de: subproduct + * + * @param subproduct Valor a fijar en el atributo. + */ + public void setSubproduct(SubProductChargesController subproduct) { + this.subproduct = subproduct; + } + + /** + * Entrega el valor de: laccountstatus + * + * @return List + */ + public List getLaccountstatus() { + return this.laccountstatus; + } + + /** + * Entrega el valor de: lcurrency + * + * @return List + */ + public List getLcurrency() { + return this.lcurrency; + } + + /** + * Entrega V/F si es activo + * + * @return active + */ + public boolean isActive() { + return active; + } + + /** + * Fina V/F si es activo o no + * + * @param active + */ + public void setActive(boolean active) { + this.active = active; + } + + /** + * Entrega el valor de: lproduct + * + * @return List + */ + public List getLproduct() { + return lproduct; + } + + /** + * Entrega el valor de: lsubproduct + * + * @return List + */ + public List getLsubproduct() { + return lsubproduct; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ChargesGroupController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ChargesGroupController.java new file mode 100644 index 0000000..81c07e1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ChargesGroupController.java @@ -0,0 +1,231 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.acco.AccountStatusController; +import com.fp.frontend.controller.pgeneral.lov.BalanceTypeLovController; +import com.fp.frontend.controller.pgeneral.product.ModuleController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.acco.TgeneAccountStatus; +import com.fp.persistence.pgeneral.charge.TgeneChargesGroup; +import com.fp.persistence.pgeneral.gene.TgeneBalanceType; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCurrency; +import com.fp.persistence.pgeneral.product.TgeneModule; + +/** + * Clase controladora del bean TgeneChargesGroup. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ChargesGroupController extends AbstractController { + + private List lmodules; + private List lgroups; + /** + * Lista de estatus de cuentas asociados a un modulo. + */ + private List laccountstatus; + + private List lcurrency; + + public ChargesGroupController() throws Exception { + super(TgeneChargesGroup.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CHARGESGROUP"; + lgroups = CatalogDetailController.find("CHARGES"); + lmodules = ModuleController.find(); + lmodules = ModuleController.find(); + lcurrency = CurrencyController.find(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + String modulecode = super.getMfilters().get("pk.modulecode"); + if (modulecode == null) { + MessageHelper.setMessageError("msg_modulerequird"); + return; + } + super.create(); + this.record.getPk().setModulecode(modulecode); + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + this.record.getPk().setChargecatalogcode("CHARGES"); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.balancetype, t.pk.balancegroup"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + dtosave.setReturnpk(true); + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Lov de tipos de saldo. + */ + public void openBalancetypeLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add(super.getMfilters().get("pk.modulecode").toString()); + + params.put("modulecode", l); + List lcat = new ArrayList<>(); + lcat.add("CHARGES"); + params.put("category", lcat); + BalanceTypeLovController.openLov(params); + } + + /** + * Fija datos del tipo de saldo al cerrar el lov. + * + * @param event + * @throws Exception + */ + public void onReturnBalancetypeLov(SelectEvent event) throws Exception { + TgeneBalanceType t = (TgeneBalanceType) event.getObject(); + this.record.getPk().setBalancetype(t.getPk().getBalancetype()); + this.record.getPk().setBalancegroup(t.getPk().getBalancegroup()); + } + + /** + * Actualzia el campo modulecode en cada controlador que esta inyectado. La + * actualizacion se realiza cuando cambia el modulo en la pantalla. + * + * @throws Exception + */ + public void updatemodule() throws Exception { + String modulecode = super.getMfilters().get("pk.modulecode"); + laccountstatus = AccountStatusController.find(modulecode); + + } + + /** + * Entrega el valor de: lmodules + * + * @return List + */ + public List getLmodules() { + return lmodules; + } + + /** + * Entrega el valor de: lgroups + * + * @return List + */ + public List getLgroups() { + return lgroups; + } + + /** + * Entrega el valor de: laccountstatus + * + * @return List + */ + public List getLaccountstatus() { + return laccountstatus; + } + + /** + * Entrega el valor de: lcurrency + * + * @return List + */ + public List getLcurrency() { + return lcurrency; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/CityController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/CityController.java new file mode 100644 index 0000000..db8dd5b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/CityController.java @@ -0,0 +1,226 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Clase controladora del bean TgeneCity. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class CityController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public CityController() throws Exception { + super(TgeneCity.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CITY"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Método que entrega el listado objetos TgeneCity provincias + * + * @param countrycode Código de país + * @param provincecode Código de provincia + * @param cantoncode Código de cantón + * @return lrecord Lista de objetos TgeneCity + */ + public static List find(String countrycode, String provincecode, String cantoncode) { + try { + CityController cc = new CityController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.addFilter("pk.provincecode", provincecode); + cc.addFilter("pk.cantoncode", cantoncode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + public static TgeneCity findOnlyOne(String countrycode, String provincecode, String cantoncode, String citycode) { + try { + CityController cc = new CityController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.addFilter("pk.provincecode", provincecode); + cc.addFilter("pk.cantoncode", cantoncode); + cc.addFilter("pk.citycode", citycode); + + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Metodo para buscar por codigo de ciudad + * + * @param citycode + * @return + */ + public static List findPorCodigo(String countrycode, String provincecode, String cantoncode, String citycode) { + try { + CityController cc = new CityController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.addFilter("pk.provincecode", provincecode); + cc.addFilter("pk.cantoncode", cantoncode); + cc.addFilter("pk.citycode", citycode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para buscar el nombre de la ciudad atraves del codigo + * + * @param provincecode + * @return + */ + public static String getDescCiudadByCodigo(String countrycode, String provincecode, String cantoncode, String citycode) { + try { + if (countrycode == null || provincecode == null || cantoncode == null || citycode == null || countrycode.isEmpty() || provincecode.isEmpty() || cantoncode.isEmpty() || citycode.isEmpty()) { + return null; + } + CityController cc = new CityController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.addFilter("pk.provincecode", provincecode); + cc.addFilter("pk.cantoncode", cantoncode); + cc.addFilter("pk.citycode", citycode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TgeneCity ciudad = cc.lrecord.get(0); + if (ciudad.getDescription() != null) { + return ciudad.getDescription(); + } else { + return ""; + } + } + return ""; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return ""; + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/CountryController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/CountryController.java new file mode 100644 index 0000000..0ae9700 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/CountryController.java @@ -0,0 +1,156 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCountry; + +/** + * Clase controladora del bean TgeneCountry. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class CountryController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public CountryController() throws Exception { + super(TgeneCountry.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "COUNTRY"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Método que entrega una lista objetos TgeneCountry países + * + * @return lrecord Lista de objetos TgeneCountry + */ + public static List find() { + try { + CountryController cc = new CountryController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + public static TgeneCountry findcountry(String country) { + try { + CountryController cc = new CountryController(); + + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", country); + cc.querydatabase(); + + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/CurrencyController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/CurrencyController.java new file mode 100644 index 0000000..4968862 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/CurrencyController.java @@ -0,0 +1,135 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCurrency; + +/** + * Clase controladora del bean TgeneCurrency. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class CurrencyController extends AbstractController { + + public CurrencyController() throws Exception { + super(TgeneCurrency.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CURRENCY"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Metodo que entrega el listado objetos TgeneCurrency + * + * @return lrecord Lista de objetos TgeneCurrency + */ + public static List find() { + try { + CurrencyController cc = new CurrencyController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/LanguageController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/LanguageController.java new file mode 100644 index 0000000..ead5565 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/LanguageController.java @@ -0,0 +1,140 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneLanguage; + +/** + * Clase controladora del bean TgeneLanguage. + * + * @author Andres E. Carpio + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class LanguageController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public LanguageController() throws Exception { + super(TgeneLanguage.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CHANNEL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de + // orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Entrega una lista de objetos TgeneLanguage + * + * @return lchannels Lista de objetos TgeneLanguage + */ + public static List find() { + try { + LanguageController cc = new LanguageController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/OfficeAndBranchController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/OfficeAndBranchController.java new file mode 100644 index 0000000..acbc3d2 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/OfficeAndBranchController.java @@ -0,0 +1,314 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.BranchLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneBranch; +import com.fp.persistence.pgeneral.gene.TgeneCanton; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneCountry; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Clase controladora del bean TgeneMenu. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class OfficeAndBranchController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public OfficeAndBranchController() throws Exception { + super(AbstractDataTransport.class); + } + + @ManagedProperty(value = "#{branchController}") + private BranchController branch; + + @ManagedProperty(value = "#{officeController}") + private OfficeController office; + + /** + * Atributo para la lista de objetos TgeneCountry + */ + private List lCountry; + + /** + * Atributo para la lista de objetos TgeneProvince + */ + private List lProvince; + + /** + * Atributo para la lista de objetos TgeneCanton + */ + private List lCanton; + + /** + * Atributo para la lista de objetos TgeneCity + */ + private List lCity; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //Listas + this.lCountry = CountryController.find(); + this.lProvince = new ArrayList(); + this.lCanton = new ArrayList(); + this.lCity = new ArrayList(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 4; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEMENU"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + + try { + this.branch.query(); + + if (this.office.getMfilters().get("") != null && !this.office.getMfilters().get("pk.branchcode").equals("")) { + this.office.query(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + //Dto General + //DtoSave dtosave = super.getDtoSave(); + + //Dto Sucursal + DtoSave dtosavebranch = this.branch.getDtoSave(); + + //Dto Oficina + DtoSave dtosaveoffice = this.office.getDtoSave(); + + if (!dtosavebranch.pendingProcess() && !dtosaveoffice.pendingProcess()) { + return; + } + + HashMap msave = new HashMap(); + + if (dtosavebranch.pendingProcess()) { + msave.put(this.branch.getBeanalias(), dtosavebranch); + } + if (dtosaveoffice.pendingProcess()) { + msave.put(this.office.getBeanalias(), dtosaveoffice); + } + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + //this.postCommit(resp); + this.branch.postCommit(resp); + this.office.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Llama al Lov MenuLevel + */ + public void openBranchLov() { + Map> params = new HashMap<>(); + BranchLovController.openLov(params); + } + + /** + * Gestiona la respuesta del Lov MenuLevel para transacciones por nivel + * + * @param event + * @throws Exception + */ + public void onReturnBranchLov(SelectEvent event) throws Exception { + TgeneBranch t = (TgeneBranch) event.getObject(); + this.office.initRecPage(); + this.office.addFilter("pk.branchcode", t.getPk().getBranchcode().toString()); + this.office.getMfilelds().put("branchdesc", t.getDescription()); + this.office.query(); + } + + public void onChangeCountry() { + if (this.office.getRecord().getCountrycode() != null) { + this.lProvince = ProvinceController.find(this.office.getRecord().getCountrycode()); + this.lCanton = new ArrayList(); + this.lCity = new ArrayList(); + } + } + + public void onChangeProvince() { + if (this.office.getRecord().getProvincecode() != null) { + this.lCanton = CantonController.find(this.office.getRecord().getCountrycode(), this.office.getRecord().getProvincecode()); + this.lCity = new ArrayList(); + } + } + + public void onChangeCanton() { + if (this.office.getRecord().getCantoncode() != null) { + this.lCity = CityController.find(this.office.getRecord().getCountrycode(), this.office.getRecord().getProvincecode(), this.office.getRecord().getCantoncode()); + } + } + + /** + * Consulta las listas al abrir el editar + */ + public void openEdit() { + if (this.office.getRecord() != null) { + this.lProvince = ProvinceController.find(this.office.getRecord().getCountrycode()); + this.lCanton = CantonController.find(this.office.getRecord().getCountrycode(), this.office.getRecord().getProvincecode()); + this.lCity = CityController.find(this.office.getRecord().getCountrycode(), this.office.getRecord().getProvincecode(), this.office.getRecord().getCantoncode()); + } + } + + /** + * Entrega el valor de OfficeController + * + * @return office + */ + public OfficeController getOffice() { + return office; + } + + /** + * Fija el valor de OfficeController + * + * @param office + */ + public void setOffice(OfficeController office) { + this.office = office; + } + + /** + * Entrega el valor de BranchController + * + * @return branch + */ + public BranchController getBranch() { + return branch; + } + + /** + * fija el valor de BranchController + * + * @param branch + */ + public void setBranch(BranchController branch) { + this.branch = branch; + } + + /** + * Entrega el valor de lCountry + * + * @return lCountry + */ + public List getlCountry() { + return lCountry; + } + + /** + * Fija el valor de lCountry + * + * @param lCountry + */ + public void setlCountry(List lCountry) { + this.lCountry = lCountry; + } + + /** + * Entrega el valor de lProvince + * + * @return lProvince + */ + public List getlProvince() { + return lProvince; + } + + /** + * Fija el valor de lProvince + * + * @param lProvince + */ + public void setlProvince(List lProvince) { + this.lProvince = lProvince; + } + + /** + * Entrega el valor de lCanton + * + * @return lCanton + */ + public List getlCanton() { + return lCanton; + } + + /** + * Fija el valor de lCanton + * + * @param lCanton + */ + public void setlCanton(List lCanton) { + this.lCanton = lCanton; + } + + /** + * Entrega el valor de lCity + * + * @return lCity + */ + public List getlCity() { + return lCity; + } + + /** + * Fija el valor de lCity + * + * @param lCity + */ + public void setlCity(List lCity) { + this.lCity = lCity; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/OfficeController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/OfficeController.java new file mode 100644 index 0000000..3f59cde --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/OfficeController.java @@ -0,0 +1,171 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneOffice; + +/** + * Clase controladora del bean TgeneOffice. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class OfficeController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public OfficeController() throws Exception { + super(TgeneOffice.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEOFFICE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Inicializa las paginas en la consulta + */ + public void initRecPage() { + this.page = 0; + this.recperpage = 10; + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.branchcode") == null || super.getMfilters().get("pk.branchcode").equals("")) { + MessageHelper.setMessageError("msg_branchRequired"); + return; + } + super.create(); + this.record.put("branchdesc", super.getMfilelds().get("branchdesc")); + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + this.record.getPk().setBranchcode(new Integer(super.getMfilters().get("pk.branchcode"))); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if (super.getMfilters().get("pk.branchcode") == null) { + MessageHelper.setMessageError("msg_branchRequired"); + return; + } + if (super.getMfilters().get("pk.companycode") == null || super.getMfilters().get("pk.companycode").equals("")) { + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + } + + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.officecode"); + + // subqueries + SubQuery subquery = new SubQuery("TgeneBranch", "description", "branchdesc", + "i.pk.companycode = t.pk.companycode and i.pk.branchcode = t.pk.branchcode"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public static List find(String branch, String companycode) { + try { + OfficeController oc = new OfficeController(); + oc.init(); + oc.recperpage = 300; + oc.addFilter("pk.branchcode", branch); + oc.addFilter("pk.companycode", companycode); + oc.querydatabase(); + if (oc.lrecord != null && !oc.lrecord.isEmpty()) { + return oc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ParametersController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ParametersController.java new file mode 100644 index 0000000..b4d10bf --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ParametersController.java @@ -0,0 +1,609 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.solicitud.SolicitudController; +import com.fp.frontend.controller.armas.solicitud.SolicitudTramiteController; +import com.fp.frontend.controller.armas.solicitud.TarmTramiteController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.PersonDetailController; +import com.fp.frontend.controller.pcustomer.PersonPhoneController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmInvoiceHistory; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pcustomer.gene.TcustPersonPhone; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Date; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import javax.faces.context.ExternalContext; +import javax.faces.context.FacesContext; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import org.openide.util.Exceptions; +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import com.fp.frontend.controller.armas.solicitud.InvoiceHistoryController; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.sql.Timestamp; +/** + * Clase controladora del lov asociado al bean TgeneParameters. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ParametersController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public ParametersController() throws Exception { + super(TgeneParameters.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + // + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PARAMETERS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void update() { + try { + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + super.update(); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + public void update(TgeneParameters bean) { + try { + this.record = bean; + super.update(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.code"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Entrega un objeto TgeneParameters + * + * @param code Có de parámetro + * @param companycode Código de compania + * @return record Objetos TgeneParameters + */ + public static TgeneParameters find(String code, String companycode) { + try { + ParametersController cc = new ParametersController(); + cc.init(); + cc.recperpage = 10; + cc.addFilter("pk.code", code); + cc.addFilter("pk.companycode", companycode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** ==================================== GUARDAR PARAMETROS ====================*/ + public void updateParametro(TgeneParameters bean) throws Exception { + this.record = bean; + //this.update(); + super.update(); + this.save(); + } + + + + /** =================================== vamo a intentar generar la factura =============*/ + + + public void crearAgregarHijo(Document doc, Element padre, String nombreElemento, String textoElemento) { + Element hijo = crearElemento(doc, nombreElemento, textoElemento); + agregarHijoPadre(doc, padre, hijo); + } + + public void crearAtributo(Document doc, Element elemento, String nombreAtributo, String valorAtributo) { + Attr attr = doc.createAttribute(nombreAtributo); + attr.setValue(valorAtributo); + elemento.setAttributeNode(attr); + } + + public void crearAgregarHijoAtributo(Document doc, Element padre, String nombreElemento, String textoElemento, String nombreAtributo, String textoAtributo) { + Element hijo = crearElemento(doc, nombreElemento, textoElemento); + crearAtributo(doc, hijo, nombreAtributo, textoAtributo); + agregarHijoPadre(doc, padre, hijo); + } + + public Element crearElemento(Document doc, String nombreElemento, String textoElemento) { + Element elemento1 = doc.createElement(nombreElemento); + elemento1.setTextContent(textoElemento); + return elemento1; + } + + public Element crearElementoSinTexto(Document doc, String nombreElemento) { + Element elemento1 = doc.createElement(nombreElemento); + return elemento1; + } + + public void agregarHijoPadre(Document doc, Element padre, Element hijo) { + padre.appendChild(hijo); + + } + + + + public File sacarFactura(String codigoSolicitud, File carpetaBase, TsafeUserDetail tsafeUserDetail) throws Exception { + CentroControlArmasController cac = new CentroControlArmasController(); + /** + * ============================ NO ESTATICAS ===============0 + */ + TgeneParameters tCustodio = find("CUSTODIOSFACTURA", "1"); + + String noDisponible = ""; + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); + + //Elemento raz + Document doc = docBuilder.newDocument(); + Element factura = doc.createElement("factura"); + doc.appendChild(factura); + + PersonAddressController pac = new PersonAddressController(); + + TarmSolicitudTramite solicitudTramite = SolicitudTramiteController.findByCSolicitud(codigoSolicitud); + TarmSolicitud solicitud = SolicitudController.findSolicitudxcodsolicitud(codigoSolicitud); + Integer personCode = solicitud.getPersoncode(); + TcustPersonDetail persona = PersonDetailController.find(personCode.toString()); + TgeneParameters parametroRUC = find("RUCCOMACO", "1"); + TarmTramite tTramite = TarmTramiteController.findSimple(solicitud.getCtramite().toString()); + String rucComaco = parametroRUC.getTextvalue(); + + crearAgregarHijo(doc, factura, "ruc", rucComaco); + + + String ccentro = solicitud.getCcentrocontrol(); + TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(ccentro); + String serie = centroControl != null && centroControl.getPuntofacturacion() != null ? + centroControl.getPuntofacturacion().replace("-", "") : ""; + + crearAgregarHijo(doc, factura, "secuencia",String.format("%09d", centroControl.getSecuenciafacturacion())); + + //String claveNombreInstitucion = centroControl.getNombreinstitucion(); + //String puntoFact= tciudad != null ? tciudad.getPuntofacturacion() : null; + centroControl.setSecuenciafacturacion(centroControl.getSecuenciafacturacion()+1); + cac.update(centroControl); + cac.save(); + crearAgregarHijo(doc, factura, "serie", serie); + + //Fecha de emision + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + String fechaEmision = sdf.format(Calendar.getInstance().getTime()); + crearAgregarHijo(doc, factura, "fecha", fechaEmision); + + /** + * ============================= DATOS DE PERSONA + */ + String tipoDocumento = persona.getIdentificationcatalog(); + String nombre = persona.getName(); + String identificacion = persona.getIdentification(); + crearAgregarHijo(doc, factura, "tipoIdComprador", tipoDocumento); + crearAgregarHijo(doc, factura, "razonSocialComprador", nombre); + crearAgregarHijo(doc, factura, "identificacionComprador", identificacion); + + /** + * *********************** Direccion + */ + TcustPersonAddress direccionDomicilio = null; + List lstdireccionDomicilio = PersonAddressController.findByPersonCodeList(personCode.toString(), "1"); + + + /**lstdireccionDomicilio = (lstdireccionDomicilio == null || lstdireccionDomicilio.isEmpty()) ? + pac.findByPersonCodeList(personCode.toString(), "2") : lstdireccionDomicilio;*/ + + if (lstdireccionDomicilio != null && !lstdireccionDomicilio.isEmpty()) { + for (TcustPersonAddress tcustPersonAddress : lstdireccionDomicilio) { + if (tcustPersonAddress.getPrincipal().equalsIgnoreCase("Y")) { + direccionDomicilio = tcustPersonAddress; + break; + } + } + } + List lstCorreos = PersonAddressController.findByPersonCodeList(personCode.toString(), "3"); + + TcustPersonAddress correo = null; + int masBajo = 0; + /** ====================== buscar por menor addresNumber */ + correo = lstCorreos != null || !lstCorreos.isEmpty() ? lstCorreos.get(0) : null; + + TcustPersonPhone telefono = null; + List lstTelefonos = PersonPhoneController.findAll(personCode.toString(), "1"); + masBajo = 0; + Integer index = null; + + if (lstTelefonos != null && !lstTelefonos.isEmpty()) { + for (int j = 0; j < lstTelefonos.size(); j++) { + if (j == 0) { + masBajo = lstTelefonos.get(j).getAddressnumber(); + index = j; + } else { + if (lstTelefonos.get(j).getAddressnumber() < masBajo) { + masBajo = lstTelefonos.get(j).getAddressnumber(); + index = j; + } + } + } + + telefono =index != null ? lstTelefonos.get(index) : null; + } + + PersonPhoneController.find(personCode.toString(), "1"); + Double valorAPagar = solicitudTramite.getValorapagar().doubleValue(); + crearAgregarHijo(doc, factura, "direccionComprador", direccionDomicilio != null ? direccionDomicilio.getAddress() : noDisponible); + crearAgregarHijo(doc, factura, "totalSinImpuestos", valorAPagar.toString()); + crearAgregarHijo(doc, factura, "totalDescuento", "0.00"); + /** + * ================== impuestoTotal ================ + */ + String impuesto = "IVA"; + int porcentajeDescuento = 0; + + Double descuento = 0.00; + Element impuestoTotal = crearElementoSinTexto(doc, "impuestoTotal"); + Element totalImpuesto1 = crearElementoSinTexto(doc, "totalImpuesto"); + Element totalImpuesto2 = crearElementoSinTexto(doc, "totalImpuesto"); + + crearAgregarHijo(doc, totalImpuesto1, "codigo", impuesto); + crearAgregarHijo(doc, totalImpuesto1, "Porcentaje", porcentajeDescuento + ""); + crearAgregarHijo(doc, totalImpuesto1, "baseImponible", valorAPagar.toString()); + + + crearAgregarHijo(doc, totalImpuesto2, "baseImponible", impuesto); + crearAgregarHijo(doc, totalImpuesto2, "Porcentaje", "12"); + crearAgregarHijo(doc, totalImpuesto2, "baseImponible", "0.00"); + agregarHijoPadre(doc, impuestoTotal, totalImpuesto1); + agregarHijoPadre(doc, impuestoTotal, totalImpuesto2); + agregarHijoPadre(doc, factura, impuestoTotal); + crearAgregarHijo(doc, factura, "totalFactura", valorAPagar.toString()); + /** + * ========================= Detalles ================================ + */ + + // aun no estoy seguro de esos datos + TgeneCatalogDetail tTipoAutorizacion = CatalogDetailController.findCatalogo(tTramite.getTipoautorizacion(), tTramite.getTipoautorizacioncodigo()); + String []servicios = tTramite.getServicio() != null ? tTramite.getServicio().split("-"):null; + + String codigoPrincipal = servicios != null ? servicios[0]: ""; /**IMPORTANTE REVISAR*/ + String descripcion = servicios != null ? servicios[1]: ""; + //tTipoAutorizacion != null ? tTipoAutorizacion.getDescription() : ""; + int cantidad = 1; + Double precioUnitario = solicitudTramite.getValortramitearmas().doubleValue(); + Double precioTotalSinImpuestos = precioUnitario * cantidad; + Element detalles = crearElementoSinTexto(doc, "detalles"); + Element detalle1 = crearElementoSinTexto(doc, "detalle"); + crearAgregarHijo(doc, detalle1, "codigoPrincipal", codigoPrincipal); + crearAgregarHijo(doc, detalle1, "descripcion", descripcion); + crearAgregarHijo(doc, detalle1, "cantidad", cantidad + ""); + crearAgregarHijo(doc, detalle1, "precioUnitario", precioUnitario.toString()); + crearAgregarHijo(doc, detalle1, "descuento", "0.00"); + crearAgregarHijo(doc, detalle1, "precioTotalSinImpuesto", precioTotalSinImpuestos.toString()); + + Element impuestoItem = crearElementoSinTexto(doc, "impuestoItem"); + Element impueste = crearElementoSinTexto(doc, "impuesto"); + + crearAgregarHijo(doc, impueste, "impuesto", impuesto); + crearAgregarHijo(doc, impueste, "Porcentaje", porcentajeDescuento + ""); + crearAgregarHijo(doc, impueste, "baseImponible", precioTotalSinImpuestos + ""); + agregarHijoPadre(doc, impuestoItem, impueste); + agregarHijoPadre(doc, detalle1, impuestoItem); + agregarHijoPadre(doc, detalles, detalle1); + String porcentaje = "0"; + Double baseImponible = precioTotalSinImpuestos; + /** + * **** custodios + */ + if (solicitudTramite.getValorcustodios() != null && solicitudTramite.getValorcustodios().doubleValue() > 0) { + Element detalle2 = crearElementoSinTexto(doc, "detalle"); + String codigoPrincipal2 = tCustodio.getNumbervalue().toString().contains(".") + ? tCustodio.getNumbervalue().toString().split("\\.")[0] : tCustodio.getNumbervalue().toString() ; int numeroDias = solicitud != null && solicitud.getNumerodiascustodios() != null ? solicitud.getNumerodiascustodios() : null; + int numeroCustodios=solicitud != null ? solicitud.getNumerocustodios() : null; + /** + * ======================= no tengo la menor idea + */ + String descripcion2 = String.format(tCustodio.getTextvalue(), numeroDias); + Double precioUnitario2 = solicitudTramite.getValorcustodios().doubleValue()/ numeroCustodios; + Double precioTotalSinImpuestos2 = solicitudTramite.getValorcustodios().doubleValue() ; + + crearAgregarHijo(doc, detalle2, "codigoPrincipal", codigoPrincipal2); + crearAgregarHijo(doc, detalle2, "descripcion", descripcion2); + crearAgregarHijo(doc, detalle2, "cantidad", numeroCustodios + ""); + crearAgregarHijo(doc, detalle2, "precioUnitario", precioUnitario2.toString()); + crearAgregarHijo(doc, detalle2, "descuento", "0.00"); + crearAgregarHijo(doc, detalle2, "precioTotalSinImpuesto", precioTotalSinImpuestos2.toString()); + + Element impuestoItem2 = crearElementoSinTexto(doc, "impuestoItem"); + Element impueste2 = crearElementoSinTexto(doc, "impuesto"); + crearAgregarHijo(doc, impueste2, "impuesto", impuesto); + crearAgregarHijo(doc, impueste2, "Porcentaje", porcentajeDescuento + ""); + crearAgregarHijo(doc, impueste2, "baseImponible", precioTotalSinImpuestos2.toString()); + agregarHijoPadre(doc, impuestoItem2, impueste2); + agregarHijoPadre(doc, detalle2, impuestoItem2); + agregarHijoPadre(doc, detalles, detalle2); + + + } + agregarHijoPadre(doc, factura, detalles); + + /** + * ========================= Pagos ================================ + */ + Element pagos = crearElementoSinTexto(doc, "pagos"); + + Element pago = crearElementoSinTexto(doc, "pago"); + String formaPago = "EF"; + /** + * de momento, tocaria ver los nemonicos a futuro para pago con tarjeta + */ + Double totalPagar = valorAPagar; + crearAgregarHijo(doc, pago, "formaPago", formaPago); + crearAgregarHijo(doc, pago, "total", totalPagar.toString()); + agregarHijoPadre(doc, pagos, pago); + agregarHijoPadre(doc, factura, pagos); + /** + * ========================= INFOAdicional ======================== + */ + String mail = correo != null ? correo.getAddress() : noDisponible; + String telefonoFijo = telefono != null ? telefono.getPhonenumber() : noDisponible; + if (telefonoFijo.contains("-")) { + telefonoFijo = telefonoFijo.split("-")[1]; + } + TgeneCity Tciudad = null; + if (direccionDomicilio != null) { + Tciudad = CityController.findOnlyOne(direccionDomicilio.getCountrycode(), + direccionDomicilio.getProvincecode(), direccionDomicilio.getCantoncode(), direccionDomicilio.getCitycode()); + } + + String ciudad = Tciudad != null ? Tciudad.getDescription() : noDisponible; + + Element infoAdicional = crearElementoSinTexto(doc, "infoAdicional"); + crearAgregarHijoAtributo(doc, infoAdicional, "campoAdicional", mail, "nombre", "Mail"); + crearAgregarHijoAtributo(doc, infoAdicional, "campoAdicional", telefonoFijo, "nombre", "Telefono"); + crearAgregarHijoAtributo(doc, infoAdicional, "campoAdicional", ciudad, "nombre", "Ciudad"); + agregarHijoPadre(doc, factura, infoAdicional); + + //Se escribe el contenido del XML en un archivo + TransformerFactory transformerFactory = TransformerFactory.newInstance(); + Transformer transformer = transformerFactory.newTransformer(); + DOMSource source = new DOMSource(doc); + /** + * String path = carpetaBase.getAbsolutePath(); if(!path.endsWith("/")){ + * path = path.concat("/"); + } + */ + //path=path.concat(String.format("Factura-%s.xml", solicitud.getNumerosolicitud())); + File archivo = new File(carpetaBase, String.format("%s.xml", solicitud.getNumerosolicitud())); + StreamResult result = new StreamResult(archivo); + transformer.transform(source, result); + + try { + crearAuditoria(1201, solicitud.getPk(), tsafeUserDetail.getPk().getUsercode(), + solicitud.getNumerosolicitud(), solicitudTramite.getNumerotramite(), + archivo.getAbsolutePath()); + + } catch (Exception e) { + System.out.println("Error al generar auditoria desde el front>>< "+ e.toString()); + e.printStackTrace(); + } + return archivo; + } + public String obtenerContenidoArchivo(String archivo) throws FileNotFoundException, IOException { + StringBuilder sb = new StringBuilder(); + FileReader f = new FileReader(archivo); + String cadena; + BufferedReader b = new BufferedReader(f); + while((cadena = b.readLine())!=null) { + sb.append(cadena.concat("\n")); + } + b.close(); + return sb.toString(); + } + public void crearAuditoria(Integer id, String csoli,String user, String solicitudNumber, String tramiteNumber,String path) throws Exception{ + InvoiceHistoryController iv = new InvoiceHistoryController(); /**========> NO OPTIMO, USADO PARA PRUEBAS*/ + TarmInvoiceHistory tih = new TarmInvoiceHistory(); + tih.setPk(id); + tih.setCsolicitud(csoli); + tih.setUsercode(user); + tih.setRegistrationdate(new java.sql.Timestamp(Calendar.getInstance().getTimeInMillis())); + tih.setSolicitudnumber(solicitudNumber); + tih.setTramitenumber(tramiteNumber); + tih.setPathfile(path); + tih.setContentfile(obtenerContenidoArchivo(path)); + iv.update(tih); + iv.save(); + } + + public void generarFacturas(String csolicitud) { + try { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + String folderPath = find("PATHFACTURASXML", "1").getTextvalue(); + //String fechaActual = new Date().toString().replace("/", "-").replace(" ", "_").replace(":", ""); + folderPath = folderPath.concat("FRONTEND").concat("/"); + File carpetaBase = new File(folderPath); + carpetaBase.mkdirs(); + File arch = sacarFactura(csolicitud, carpetaBase, tsafeUserDetail ); + //factSq = factSq + acum; + + + byte[] fileContent = Files.readAllBytes(Paths.get(arch.getAbsolutePath())); + downloadFile(fileContent, "application/xml", arch.getName()); + /** ================== DEBERIA HABERSE ECHO POR CONTROLLER PERO POR ERRORES SE MANTIENE CON QUERY */ +// Query qu = entityManager.createNativeQuery(sUpdate.toString()) +// .setParameter("numero", factSq); + // qu.executeUpdate(); + //sequence.setNumbervalue(new BigDecimal(factSq)); + //TgeneCatalogDetail sequencia = CatalogDetailController.findCatalogo( "QUERY", "SEQ"); + //sequencia.setRecordversion(factSq); + //CatalogDetailController dc = new CatalogDetailController(); + ///dc.setRecord(sequencia); + //dc.update(); + //dc.save(); + + //sequence.setIsnew(false); + //setRecord(sequence); + //update(); + //save(); + //updateParametro(sequence); + + + } catch (Exception ex) { + System.out.println("Error al guardar el parametro >>>> " + ex.toString()); + Exceptions.printStackTrace(ex); + } + } + + /** ======================= COPIADO DE ABRASTRACT CONTROLLER ==================*/ + public void downloadFile(byte[] fileByte, String contentType, String filename) { + try { + int read = 0; + byte[] bytes = new byte[1024]; + + InputStream input = new ByteArrayInputStream(fileByte); + FacesContext context = FacesContext.getCurrentInstance(); + ExternalContext external = context.getExternalContext(); + HttpServletResponse response = (HttpServletResponse) external + .getResponse(); + response.setContentType(contentType); + response.setHeader("Content-Disposition", + "attachment; filename=\"" + filename+"\""); + ServletOutputStream out = response.getOutputStream(); + + while ((read = input.read(bytes)) != -1) { + out.write(bytes, 0, read); + } + out.flush(); + out.close(); + context.responseComplete(); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ParroquiaController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ParroquiaController.java new file mode 100644 index 0000000..c262d0c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ParroquiaController.java @@ -0,0 +1,178 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCity; +import com.fp.persistence.pgeneral.gene.TgeneParroquia; + +/** + * Clase controladora del bean TgeneProvince. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ParroquiaController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public ParroquiaController() throws Exception { + super(TgeneParroquia.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PARROQUIA"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Método que entrega el listado objetos TgeneParroquia parroquias + * + * @param countrycode Código de país + * @param provincecode Código de provincia + * @param cantoncode Código de cantón + * @return lrecord Lista de objetos TgeneParroquia + */ + public static List find(String countrycode, String provincecode, String cantoncode) { + try { + ParroquiaController cc = new ParroquiaController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.addFilter("pk.provincecode", provincecode); + cc.addFilter("pk.cantoncode", cantoncode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Metodo para buscar el nombre de la parroquia atraves del codigo + * + * @param provincecode + * @return + */ + public static String getDescParroquiaByCodigo(String countrycode, String provincecode, String cantoncode, String parroquiacode) { + try { + if (countrycode == null || provincecode == null || cantoncode == null || parroquiacode == null || countrycode.isEmpty() || provincecode.isEmpty() || cantoncode.isEmpty() || parroquiacode.isEmpty()) { + return null; + } + ParroquiaController cc = new ParroquiaController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.addFilter("pk.provincecode", provincecode); + cc.addFilter("pk.cantoncode", cantoncode); + cc.addFilter("pk.parroquiacode", parroquiacode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TgeneParroquia parroquia = cc.lrecord.get(0); + if (parroquia.getDescription() != null) { + return parroquia.getDescription(); + } else { + return ""; + } + } + return ""; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return ""; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ProvinceController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ProvinceController.java new file mode 100644 index 0000000..94196bf --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ProvinceController.java @@ -0,0 +1,224 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; +import com.fp.persistence.pgeneral.gene.TgeneProvince; + +/** + * Clase controladora del bean TgeneProvince. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ProvinceController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public ProvinceController() throws Exception { + super(TgeneProvince.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PROVINCE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Método que entrega el listado objetos TgeneProvince provincias + * + * @param countrycode Código de país + * @return lrecord Lista de objetos TgeneProvince + */ + public static List find(String countrycode) { + try { + ProvinceController cc = new ProvinceController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Metodo para buscar por codigo de provincia + * + * @param provincecode + * @return + */ + public static List findPorCodigo(String countrycode, String provincecode) { + try { + ProvinceController cc = new ProvinceController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.addFilter("pk.provincecode", provincecode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Metodo para buscar el nombre de la provincia atraves del codigo + * + * @param provincecode + * @return + */ + public static String getDescProvByCodigo(String countrycode, String provincecode) { + try { + if (countrycode == null || provincecode == null || countrycode.isEmpty() || provincecode.isEmpty()) { + return null; + } + ProvinceController cc = new ProvinceController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + cc.addFilter("pk.provincecode", provincecode); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + TgeneProvince provincia = cc.lrecord.get(0); + if (provincia.getDescription() != null) { + return provincia.getDescription(); + } else { + return ""; + } + } + return ""; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return ""; + } + } + + public static List findxDescripcion(String countrycode, String codigoProvincia, String descripcion) { + try { + ProvinceController cc = new ProvinceController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.countrycode", countrycode); + if (codigoProvincia != null && codigoProvincia.length() > 0) { + cc.addFilter("pk.provincecode", codigoProvincia); + } + if (descripcion != null && descripcion.length() > 0) { + cc.addFilter("description", descripcion); + } + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/QueryController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/QueryController.java new file mode 100644 index 0000000..96bc9c1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/QueryController.java @@ -0,0 +1,176 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.HashMap; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.TabChangeEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; + +/** + * Clase controladora del bean AbstractDataTransport. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class QueryController extends AbstractController { + + @ManagedProperty(value = "#{queryProcessController}") + private QueryProcessController queryprocess; + + @ManagedProperty(value = "#{transactionQueryController}") + private TransactionQueryController transactionquery; + + private String tabid = "ttransaction"; + + public QueryController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void onTabChange(TabChangeEvent event) throws Exception { + this.tabid = event.getTab().getId(); + } + + @Override + public void query() { + try { + if (this.tabid.equals("queryprocess")) { + this.queryprocess.query(); + } else { + this.transactionquery.query(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() { + try { + if (this.tabid.equals("queryprocess")) { + this.queryprocess.next(); + } else { + this.transactionquery.next(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void previous() { + try { + if (this.tabid.equals("queryprocess")) { + this.queryprocess.previous(); + } else { + this.transactionquery.previous(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + + DtoSave dtosavetq = this.transactionquery.getDtoSave(); + if (dtosavetq.pendingProcess()) { + dtosavetq.setReturnpk(true); + msave.put(this.transactionquery.getBeanalias(), dtosavetq); // adicionar metadata de mantenimiento para cada tabla. + } + DtoSave dtosaveqp = this.queryprocess.getDtoSave(); + if (dtosaveqp.pendingProcess()) { + dtosaveqp.setReturnpk(true); + msave.put(this.queryprocess.getBeanalias(), dtosaveqp); // adicionar metadata de mantenimiento para cada tabla. + } + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.transactionquery.postCommit(resp); + this.queryprocess.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + } + + /** + * Entrega el valor de: queryprocess + * + * @return QueryProcessController + */ + public QueryProcessController getQueryprocess() { + return this.queryprocess; + } + + /** + * Fija el valor de: queryprocess + * + * @param queryprocess Valor a fijar en el atributo. + */ + public void setQueryprocess(QueryProcessController queryprocess) { + this.queryprocess = queryprocess; + } + + /** + * Entrega el valor de: transactionquery + * + * @return TransactionQueryController + */ + public TransactionQueryController getTransactionquery() { + return this.transactionquery; + } + + /** + * Fija el valor de: transactionquery + * + * @param transactionquery Valor a fijar en el atributo. + */ + public void setTransactionquery(TransactionQueryController transactionquery) { + this.transactionquery = transactionquery; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/QueryProcessController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/QueryProcessController.java new file mode 100644 index 0000000..178a71b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/QueryProcessController.java @@ -0,0 +1,165 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.ProcessLovControler; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneQueryProcess; +import com.fp.persistence.pgeneral.proc.TgeneProcess; + +/** + * Clase controladora del bean TgeneQueryProcess. + * + * @author Andres E. Carpio + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class QueryProcessController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public QueryProcessController() throws Exception { + super(TgeneQueryProcess.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "QUERYPROCESS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneQueryProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + /** + * Actualiza datos de registros nuevos o modifiados, si el registro es nuevo + * se adiciona a lista de nuevos, si es actualizado se adiciona a la lista + * de actualizados. + * + * @throws Exception + */ + @Override + public void update() throws Exception { + if (this.record.getProcesscode() == null) { + MessageHelper.setMessageError("msg_processrequired"); + return; + } + super.update(); + } + + public DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden + // ("t.pk, t.nombre, t.cpais"). + + // subqueries + SubQuery subquery = new SubQuery( + "TgeneProcess", + "shortdesc", + "shortdesc", + "i.pk.processcode = t.processcode and i.pk.catalogtypeprocess = t.catalogtypeprocess and i.pk.catalogcodetypeprocess = t.catalogcodetypeprocess"); + dto.addSubQuery(subquery); + return dto; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = this.getDtoQuery(); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void openProcessLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("QUERY"); // valor del parametro + params.put("processtype", l); + ProcessLovControler.openLov(params); + } + + public void onReturnProcessLov(SelectEvent event) throws Exception { + TgeneProcess t = (TgeneProcess) event.getObject(); + this.record.setProcesscode(t.getPk().getProcesscode()); + this.record.put("messagedesc", t.getDescription()); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ServicesController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ServicesController.java new file mode 100644 index 0000000..0baa7a9 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/ServicesController.java @@ -0,0 +1,197 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneServices; + +/** + * Clase controladora del bean TgeneServices. + * + * @author WPA. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ServicesController extends AbstractController { + + /** + * Constructor + * + * @throws Exception + */ + public ServicesController() throws Exception { + super(TgeneServices.class); + } + + /** + * Atributo para el checkbox + */ + private boolean check; + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "SERVICES"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea el nuevo registro + */ + @Override + public void create() { + try { + this.check = false; + super.create(); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Ejecuta el check + */ + public void changeCheck() { + if (this.check) { + this.record.setAutomatic("Y"); + } else { + this.record.setAutomatic("N"); + } + } + + /** + * Ejecuta el check en el edit + */ + public void checkEdit() { + if (this.record.getAutomatic().equals("Y")) { + this.check = true; + } else { + this.check = false; + } + } + + /** + * Entrega una lista de objetos TgeneServices + * + * @return lrecord Lista de objetos TgeneServices + */ + public static List find() { + try { + ServicesController sc = new ServicesController(); + sc.init(); + sc.recperpage = 300; + sc.querydatabase(); + if ((sc.lrecord != null) && !sc.lrecord.isEmpty()) { + return sc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Entrega V/F + * + * @return check + */ + public boolean isCheck() { + return check; + } + + /** + * Fija V/F + * + * @param check + */ + public void setCheck(boolean check) { + this.check = check; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/SubProductChargesController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/SubProductChargesController.java new file mode 100644 index 0000000..5f0bc2c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/SubProductChargesController.java @@ -0,0 +1,168 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.BalanceTypeLovController; +import com.fp.frontend.controller.pgeneral.product.ProductController; +import com.fp.frontend.controller.pgeneral.product.SubProductController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.charge.TgeneSubProductCharges; +import com.fp.persistence.pgeneral.gene.TgeneBalanceType; +import com.fp.persistence.pgeneral.product.TgeneProduct; +import com.fp.persistence.pgeneral.product.TgeneSubProduct; + +/** + * Clase controladora del bean TgeneSubProductCharges. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SubProductChargesController extends AbstractController { + + public SubProductChargesController() throws Exception { + super(TgeneSubProductCharges.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "SUBPRODUCTCHARGES"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (!this.validaterequired()) { + return; + } + super.create(); + this.record.getPk().setModulecode(super.getMfilters().get("pk.modulecode")); + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + this.record.getPk().setProductcode(super.getMfilters().get("pk.productcode")); + this.record.getPk().setSubproductcode(super.getMfilters().get("pk.subproductcode")); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if (!this.validaterequired()) { + return; + } + Request request = this.callerhelper.getRequest(); + //super.addFilter("pk.modulecode", super.getMfilelds().get("modulecode").toString()); + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.balancetype, t.pk.balancegroup"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Valida filtros + * + * @return + * @throws Exception + */ + private boolean validaterequired() throws Exception { + if (super.getMfilters().get("pk.modulecode") == null) { + MessageHelper.setMessageError("msg_modulerequird"); + return false; + } + if (super.getMfilters().get("pk.productcode") == null) { + MessageHelper.setMessageError("msg_productrequird"); + return false; + } + if (super.getMfilters().get("pk.subproductcode") == null) { + MessageHelper.setMessageError("msg_subproductrequird"); + return false; + } + return true; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/TerminosCondicionesController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/TerminosCondicionesController.java new file mode 100644 index 0000000..b8fed19 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/TerminosCondicionesController.java @@ -0,0 +1,127 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.soli.TarmTerminos; + +@SuppressWarnings("serial") +@ManagedBean +@SessionScoped +public class TerminosCondicionesController extends AbstractController { + + /** + * Constructor + * + * @throws Exception + */ + public TerminosCondicionesController() throws Exception { + super(TarmTerminos.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOG"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public static TarmTerminos findxIdentificacion(String identificacion) { + try { + TerminosCondicionesController cc = new TerminosCondicionesController(); + cc.init(); + cc.recperpage = 10; + cc.addFilter("identificacion", identificacion); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/TransactionQueryController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/TransactionQueryController.java new file mode 100644 index 0000000..e8d9015 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/gene/TransactionQueryController.java @@ -0,0 +1,223 @@ +package com.fp.frontend.controller.pgeneral.gene; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pbpm.lov.TbpmRulesLovController; +import com.fp.frontend.controller.pgeneral.lov.ProcessLovControler; +import com.fp.frontend.controller.pgeneral.lov.TransactionLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmRules; +import com.fp.persistence.pgeneral.gene.TgeneTransactionQuery; +import com.fp.persistence.pgeneral.proc.TgeneProcess; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * Clase controladora del bean TgeneTransactionQuery. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TransactionQueryController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public TransactionQueryController() throws Exception { + super(TgeneTransactionQuery.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TRANSACTIONPROCESS"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Actualiza datos de registros nuevos o modifiados, si el registro es nuevo + * se adiciona a lista de nuevos, si es actualizado se adiciona a la lista + * de actualizados. + * + * @throws Exception + */ + @Override + public void update() throws Exception { + if (this.record.getProcesscode() == null) { + MessageHelper.setMessageError("msg_processrequired"); + return; + } + super.update(); + } + + public void openTransactionLov() { + Map> params = new HashMap<>(); + TransactionLovController.openLov(params); + } + + public void onReturnTransactionLov(SelectEvent event) throws Exception { + TgeneTransaction t = (TgeneTransaction) event.getObject(); + super.addFilter("pk.transactionmodule", t.getPk().getTransactionmodule()); + super.addFilter("pk.transactioncode", t.getPk().getTransactioncode().toString()); + super.addFilter("pk.transactionversion", t.getPk().getTransactionversion().toString()); + super.addField("name", t.getName()); + this.query(); + } + + /** + * Crea una instancia de TgeneTransactionQuery y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.transactionmodule") == null) { + MessageHelper.setMessageError("msg_transactionrequird"); + return; + } + super.create(); + this.record.getPk().setTransactionmodule(super.getMfilters().get("pk.transactionmodule")); + this.record.getPk().setTransactioncode(Integer.valueOf(super.getMfilters().get("pk.transactioncode"))); + this.record.getPk().setTransactionversion(Integer.valueOf(super.getMfilters().get("pk.transactionversion"))); + this.record.setCatalogtypeprocess("QUERY"); + this.record.setCatalogcodetypeprocess("PROCESSTYPE"); + } + + public DtoQuery getDtoQuery() throws Exception { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.executionorder"); + // subqueries + SubQuery subquery = new SubQuery("TgeneProcess", "shortdesc", "shortdesc", "i.pk.processcode = t.processcode"); + dto.addSubQuery(subquery); + return dto; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + if (super.getMfilters().get("pk.transactionmodule") == null) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = this.getDtoQuery(); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public void openProcessLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("QUERY"); // valor del parametro + params.put("processtype", l); + ProcessLovControler.openLov(params); + } + + public void onReturnProcessLov(SelectEvent event) throws Exception { + TgeneProcess t = (TgeneProcess) event.getObject(); + this.record.setProcesscode(t.getPk().getProcesscode()); + this.record.put("shortdesc", t.getShortdesc()); + } + + public void openRuleLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("R"); // valor del parametro + params.put("filetype", l); + TbpmRulesLovController.openLov(params); + } + + public void onReturnRuleLov(SelectEvent event) throws Exception { + TbpmRules t = (TbpmRules) event.getObject(); + // this.record.setProcesscode(t.getPk().getRulecode()); + this.record.setRulename(t.getPk().getRulecode()); + this.record.put("ruledesc", t.getDescription()); + } + + public void openFlowLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("F"); // valor del parametro + params.put("filetype", l); + TbpmRulesLovController.openLov(params); + } + + public void onReturnFlowLov(SelectEvent event) throws Exception { + TbpmRules t = (TbpmRules) event.getObject(); + this.record.setProcessname(t.getPk().getRulecode()); + this.record.put("flowdesc", t.getDescription()); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/entries new file mode 100644 index 0000000..5eb9b44 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/entries @@ -0,0 +1,470 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +CatalogLovController.java +file + + + + +2022-07-28T03:39:54.994597Z +4c40f72e754c3c27f4675d93deb10648 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3426 + +ActivityLovController.java +file + + + + +2022-07-28T03:39:54.994597Z +f9c2f7c4eb4b0e3bf0f73bf7c0c7df89 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +3860 + +EntityLovController.java +file + + + + +2022-07-28T03:39:54.995597Z +c7fd2c9e84bce32ae6e0982c5ba254d8 +2014-12-29T09:02:02.697591Z +3668 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +3073 + +BranchLovController.java +file + + + + +2022-07-28T03:39:54.995597Z +5e7cdfe21bb662df7f62bfc1682bc478 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +3505 + +UserLovController.java +file + + + + +2022-07-28T03:39:54.995597Z +3aed1a97cea8854b3ecae2491c6bbc73 +2014-12-29T09:02:02.697591Z +3668 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +4203 + +ProfileLovController.java +file + + + + +2022-07-28T03:39:54.996597Z +745bd8be2f97863832389366a7f14710 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3474 + +SubLevelLovController.java +file + + + + +2022-07-28T03:39:54.996597Z +cd1ab41807294e6f1f0b8d09e84f9793 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +4732 + +ProcessLovControler.java +file + + + + +2022-07-28T03:39:54.996597Z +71d531ed34923fdafa460370dae0e56a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3923 + +UserLovControler.java +file + + + + +2022-07-28T03:39:54.996597Z +e3885abace61e26c87c88627f5990e38 +2014-12-29T09:02:02.697591Z +3668 +dcruz + + + + + + + + + + + + + + + + + + + + + +4201 + +MessageTemplatesLovController.java +file + + + + +2022-07-28T03:39:54.997597Z +72efab815cbcfb422d44c28e59d79e7e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3733 + +TransactionLovController.java +file + + + + +2022-07-28T03:39:54.997597Z +8822b235245237c56c9706d2f372cc2c +2014-12-29T09:02:02.697591Z +3668 +dcruz + + + + + + + + + + + + + + + + + + + + + +4324 + +BalanceTypeLovController.java +file + + + + +2022-07-28T03:39:54.997597Z +a4bbc8d7b962b607112df754753ca3a1 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4192 + +LevelLovController.java +file + + + + +2022-07-28T03:39:54.997597Z +6e525ae7e8ea9cefa4c856ffc918a40d +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +4251 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/prop-base/EntityLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/prop-base/EntityLovController.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/prop-base/EntityLovController.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/prop-base/UserLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/prop-base/UserLovController.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/prop-base/UserLovController.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/ActivityLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/ActivityLovController.java.svn-base new file mode 100644 index 0000000..95136ba --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/ActivityLovController.java.svn-base @@ -0,0 +1,117 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TgeneActivity; + +/** + * Clase controladora del lov asociado al bean TsafeUserDetail. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ActivityLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public ActivityLovController() throws Exception { + super(TgeneActivity.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "ACTIVITYLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + //SubQuery + SubQuery subquerya = new SubQuery("TgeneCatalogDetail", "description", "segmentdesc", + "i.pk.catalogcode = t.segmenttypecatalogcode and i.pk.catalog = t.segmenttypecatalog "); + dto.addSubQuery(subquerya); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setactivity() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setactivity(TgeneActivity tgeneActivity) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneActivity); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put("modal", true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + // lovpersona es el nombre de la pagina + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/activitypersegmentsLov.xhtml", options, params); + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/BalanceTypeLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/BalanceTypeLovController.java.svn-base new file mode 100644 index 0000000..4cc7202 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/BalanceTypeLovController.java.svn-base @@ -0,0 +1,122 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneBalanceType; + +/** + * Clase controladora del lov asociado al bean TgeneProcess. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class BalanceTypeLovController extends AbstractController { + + public BalanceTypeLovController() throws Exception { + super(TgeneBalanceType.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + String category = CallerHelper.getLovParameter("category"); + if (category != null) { + super.addFilter("balancecategory", category); + } + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PROCESSLOV"; + super.addField("modulecode", CallerHelper.getLovParameter("modulecode")); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.balancetype, t.pk.balancegroup "); + if(super.getFieldvalue("modulecode") != null){ + String value = super.getFieldvalue("modulecode").toString(); + Filter f = new Filter(); + f.setSql("(modulecode = '"+value+"' or modulecode is null) "); + dto.addFiltro(f); + } + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setBalancetype() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setBalancetype(TgeneBalanceType tgeneBalanceType) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneBalanceType); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put("modal", true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/balanceTypeLov.xhtml", options, params); + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/BranchLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/BranchLovController.java.svn-base new file mode 100644 index 0000000..c1f9bd4 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/BranchLovController.java.svn-base @@ -0,0 +1,108 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneBranch; + +/** + * Clase controladora del lov asociado al bean TgeneBranch. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class BranchLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public BranchLovController() throws Exception { + super(TgeneBranch.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "BRANCHLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.branchcode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setBranch() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setBranch(TgeneBranch tgeneBranch) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneBranch); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put("modal", true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/branchLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/CatalogLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/CatalogLovController.java.svn-base new file mode 100644 index 0000000..79d4dc1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/CatalogLovController.java.svn-base @@ -0,0 +1,107 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class CatalogLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public CatalogLovController() throws Exception { + super(TgeneCatalog.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOGLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setcatalog() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setcatalog(TgeneCatalog tgeneCatalog) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneCatalog); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/catalogLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/EntityLovController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/EntityLovController.java.netbeans-base new file mode 100644 index 0000000..52074fe --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/EntityLovController.java.netbeans-base @@ -0,0 +1,108 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneEntity; + +/** + * + * @author Jacqueline Arias + * + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class EntityLovController extends AbstractController { + + public EntityLovController() throws Exception { + super(TgeneEntity.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + public void postConstruct() { + this.init(); + try { + String log; + log = CallerHelper.getLovParameter("log"); + if (log != null) { + this.addFilter("log", log); + } + this.query(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + private void init() { + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEENTITY"; + this.recperpage = 10; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + try { + Request request = this.callerhelper.getRequest(); + + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); + request.setQueryTables(mtables); + Response response = this.callerhelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(response); + } else { + this.lrecord = (List) response.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + // TODO: handle exception + MessageHelper.setMessageError(e); + } + + } + + public void setentity() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setentity(TgeneEntity tgeneEntity) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneEntity); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/entityLov.xhtml", options, params); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/EntityLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/EntityLovController.java.svn-base new file mode 100644 index 0000000..52074fe --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/EntityLovController.java.svn-base @@ -0,0 +1,108 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneEntity; + +/** + * + * @author Jacqueline Arias + * + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class EntityLovController extends AbstractController { + + public EntityLovController() throws Exception { + super(TgeneEntity.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + public void postConstruct() { + this.init(); + try { + String log; + log = CallerHelper.getLovParameter("log"); + if (log != null) { + this.addFilter("log", log); + } + this.query(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + private void init() { + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEENTITY"; + this.recperpage = 10; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + try { + Request request = this.callerhelper.getRequest(); + + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); + request.setQueryTables(mtables); + Response response = this.callerhelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(response); + } else { + this.lrecord = (List) response.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + // TODO: handle exception + MessageHelper.setMessageError(e); + } + + } + + public void setentity() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setentity(TgeneEntity tgeneEntity) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneEntity); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/entityLov.xhtml", options, params); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/LevelLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/LevelLovController.java.svn-base new file mode 100644 index 0000000..6f3d797 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/LevelLovController.java.svn-base @@ -0,0 +1,129 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelDesc; + +/** + * Clase controladora del lov asociado al bean TgeneMenuLevelDesc. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class LevelLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public LevelLovController() throws Exception { + super(TgeneMenuLevelDesc.class); + } + + @PostConstruct + private void postconstruct() throws Exception{ + this.init(); + // Inicializa autoconsulta + super.startQuery(); + // + String menucode = CallerHelper.getLovParameter("pk.menucode"); + if(menucode==null){ + MessageHelper.setMessageError("msg_menuNotFound"); + return; + } + super.getMfilters().put("pk.menucode", menucode); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "MENULEVELLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if(super.getMfilters().get("pk.menucode")==null){ + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + this.getMfilters().put("pk.languagecode", this.getLoginController().getRequest().getLanguage()); + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.levelcode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el valor del Lov + */ + public void setMenuLevel() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + /** + * Obtiene el valor del Lov + */ + public void setMenuLevel(TgeneMenuLevelDesc tgeneMenuLevelDesc) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneMenuLevelDesc); + } + + /** + * Abre el lov de MenuLevel + * @param params + */ + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put("modal", true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/menulevelLov.xhtml", options, params); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/MessageTemplatesLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/MessageTemplatesLovController.java.svn-base new file mode 100644 index 0000000..3bad4c5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/MessageTemplatesLovController.java.svn-base @@ -0,0 +1,112 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplates; + +/** + * Clase controladora del lov asociado al bean TgeneMessageTemplates. + * + * @author Andres E Carpio. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class MessageTemplatesLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public MessageTemplatesLovController() throws Exception { + super(TgeneMessageTemplates.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "MESSAGETEMPLATESLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if (!super.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk, t.description"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setmessage() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setmessage(TgeneMessageTemplates tgeneMessageTemplates) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneMessageTemplates); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 580); //580 porque se abre desde un dialogo + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/messageTemplatesLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/ProcessLovControler.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/ProcessLovControler.java.svn-base new file mode 100644 index 0000000..d15fabf --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/ProcessLovControler.java.svn-base @@ -0,0 +1,119 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.proc.TgeneProcess; + +/** + * Clase controladora del lov asociado al bean TgeneProcess. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ProcessLovControler extends AbstractController { + + public ProcessLovControler() throws Exception { + super(TgeneProcess.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + String processtype = CallerHelper.getLovParameter("processtype"); + if (processtype != null) { + super.addFilter("pk.catalogtypeprocess", processtype); + } + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PROCESSLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if (!super.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.processcode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setprocess() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setprocess(TgeneProcess tgeneProcess) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneProcess); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put("modal", true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 580); // no cambiar de 580 para que funcione en un ipad + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/processLov.xhtml", options, params); + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/ProfileLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/ProfileLovController.java.svn-base new file mode 100644 index 0000000..6e1cf0a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/ProfileLovController.java.svn-base @@ -0,0 +1,108 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.safe.TsafeProfile; + +/** + * Clase controladora del lov asociado al bean TsafeProfile. + * @author David López P. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ProfileLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public ProfileLovController() throws Exception { + super(TsafeProfile.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PROFILELOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setProfile() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setProfile(TsafeProfile tsafeProfile) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tsafeProfile); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put("modal", true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 580); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/profileLov.xhtml", options, params); + } +} + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/SubLevelLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/SubLevelLovController.java.svn-base new file mode 100644 index 0000000..068170d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/SubLevelLovController.java.svn-base @@ -0,0 +1,139 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelDesc; + +/** + * Clase controladora del lov asociado al bean TgeneMenuLevelDesc. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class SubLevelLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public SubLevelLovController() throws Exception { + super(TgeneMenuSubLevelDesc.class); + } + + @PostConstruct + private void postconstruct() throws Exception{ + this.init(); + // Inicializa autoconsulta + super.startQuery(); + // + String menucode = CallerHelper.getLovParameter("pk.menucode"); + String levelcode = CallerHelper.getLovParameter("pk.levelcode"); + if(menucode==null){ + MessageHelper.setMessageError("msg_menuNotFound"); + return; + } + if(levelcode==null){ + MessageHelper.setMessageError("msg_levelNotFound"); + return; + } + super.getMfilters().put("pk.menucode", menucode); + super.getMfilters().put("pk.levelcode", levelcode); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "MENUSUBLEVELLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if(super.getMfilters().get("pk.menucode")==null){ + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + if(super.getMfilters().get("pk.levelcode")==null){ + MessageHelper.setMessageError("msg_menuLevelRequired"); + return; + } + this.getMfilters().put("pk.languagecode", this.getLoginController().getRequest().getLanguage()); + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.levelcode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el valor del Lov + */ + public void setMenuSubLevel() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + /** + * Obtiene el valor del Lov + */ + public void setMenuSubLevel(TgeneMenuSubLevelDesc tgeneMenuSubLevelDesc) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneMenuSubLevelDesc); + } + + /** + * Abre el lov de MenuLevel + * @param params + */ + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put("modal", true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/menusublevelLov.xhtml", options, params); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/TransactionLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/TransactionLovController.java.svn-base new file mode 100644 index 0000000..4cbf74d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/TransactionLovController.java.svn-base @@ -0,0 +1,144 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class TransactionLovController extends AbstractController { + + private String moduleCode = null; + + public TransactionLovController() throws Exception { + super(TgeneTransaction.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + try { + this.moduleCode = CallerHelper.getLovParameter("moduleCode"); + } catch (Exception e) { + // TODO: handle exception + } + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TRANSACTIONLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if ((this.moduleCode == null) || this.moduleCode.isEmpty()) { + if (!super.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + } + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.transactionmodule, t.pk.transactioncode, t.pk.transactionversion"); + + if ((this.moduleCode != null) && !this.moduleCode.isEmpty()) { + Filter f = null; + if ((super.getMfilters().get("pk.transactionmodule") != null) && !super.getMfilters().get("pk.transactionmodule").equals("")) { + f = new Filter(); + f.setSql("t.pk.transactionmodule = '" + this.moduleCode + "'"); + } else { + f = new Filter("pk.transactionmodule", "=" + this.moduleCode); + } + dto.addFiltro(f); + } + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void settransaction() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void settransaction(TgeneTransaction tgeneTransaction) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneTransaction); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 400); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + // lovpersona es el nombre de la pagina + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/transactionLov.xhtml", options, params); + } + + public String getModuleCode() { + return this.moduleCode; + } + + public void setModuleCode(String moduleCode) { + this.moduleCode = moduleCode; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/UserLovControler.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/UserLovControler.java.netbeans-base new file mode 100644 index 0000000..5395e19 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/UserLovControler.java.netbeans-base @@ -0,0 +1,127 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de bean TsafeUserDetail + * + * @author Jacqueline Arias + * + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class UserLovControler extends AbstractController { + + private String userName = null; + + public UserLovControler() throws Exception { + super(TsafeUserDetail.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + public void postConstruct() { + this.init(); + } + + private void init() { + this.beanalias = "USERLOV"; + this.lrecord = new ArrayList<>(); + this.recperpage = 10; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + try { + Request request = this.callerhelper.getRequest(); + super.addFilterDateto(); + super.addFilter("companycode", super.getLoginController().getRequest().getCompany().toString()); + super.addFilter("branchcode", super.getLoginController().getRequest().getBranchCode().toString()); + super.addFilter("officecode", super.getLoginController().getRequest().getOfficeCode().toString()); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + if ((this.userName != null) && !this.userName.isEmpty()) { + Filter f = null; + f = new Filter(); + f.setSql(" t.pk.personcode in (select p.pk.personcode from com.fp.persistence.pcustomer.gene.TcustPersonDetail p where p.name like '" + + this.userName + + "' and p.pk.dateto = to_date('2999-12-31', 'yyyy-MM-dd') and p.companycode =" + + super.getLoginController().getRequest().getCompany().toString() + ")"); + dto.addFiltro(f); + + } + SubQuery subquery = new SubQuery("TcustPersonDetail", "name", "personname", + "i.pk.personcode = t.pk.personcode and i.pk.dateto = to_date('2999-12-31', 'yyyy-MM-dd') and i.companycode=" + + super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); + request.setQueryTables(mtables); + Response response = this.callerhelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(response); + } else { + this.lrecord = (List) response.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + // TODO: handle exception + MessageHelper.setMessageError(e); + } + + } + + public void setuser() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setuser(TsafeUserDetail tsafeUserDetail) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tsafeUserDetail); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/usersLov.xhtml", options, params); + } + + public String getUserName() { + return this.userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/UserLovControler.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/UserLovControler.java.svn-base new file mode 100644 index 0000000..5395e19 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/UserLovControler.java.svn-base @@ -0,0 +1,127 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de bean TsafeUserDetail + * + * @author Jacqueline Arias + * + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class UserLovControler extends AbstractController { + + private String userName = null; + + public UserLovControler() throws Exception { + super(TsafeUserDetail.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + public void postConstruct() { + this.init(); + } + + private void init() { + this.beanalias = "USERLOV"; + this.lrecord = new ArrayList<>(); + this.recperpage = 10; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + try { + Request request = this.callerhelper.getRequest(); + super.addFilterDateto(); + super.addFilter("companycode", super.getLoginController().getRequest().getCompany().toString()); + super.addFilter("branchcode", super.getLoginController().getRequest().getBranchCode().toString()); + super.addFilter("officecode", super.getLoginController().getRequest().getOfficeCode().toString()); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + if ((this.userName != null) && !this.userName.isEmpty()) { + Filter f = null; + f = new Filter(); + f.setSql(" t.pk.personcode in (select p.pk.personcode from com.fp.persistence.pcustomer.gene.TcustPersonDetail p where p.name like '" + + this.userName + + "' and p.pk.dateto = to_date('2999-12-31', 'yyyy-MM-dd') and p.companycode =" + + super.getLoginController().getRequest().getCompany().toString() + ")"); + dto.addFiltro(f); + + } + SubQuery subquery = new SubQuery("TcustPersonDetail", "name", "personname", + "i.pk.personcode = t.pk.personcode and i.pk.dateto = to_date('2999-12-31', 'yyyy-MM-dd') and i.companycode=" + + super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); + request.setQueryTables(mtables); + Response response = this.callerhelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(response); + } else { + this.lrecord = (List) response.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + // TODO: handle exception + MessageHelper.setMessageError(e); + } + + } + + public void setuser() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setuser(TsafeUserDetail tsafeUserDetail) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tsafeUserDetail); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/usersLov.xhtml", options, params); + } + + public String getUserName() { + return this.userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/UserLovController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/UserLovController.java.svn-base new file mode 100644 index 0000000..a25c77e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/.svn/text-base/UserLovController.java.svn-base @@ -0,0 +1,127 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de bean TsafeUserDetail + * + * @author Jacqueline Arias + * + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class UserLovController extends AbstractController { + + private String userName = null; + + public UserLovController() throws Exception { + super(TsafeUserDetail.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + public void postConstruct() { + this.init(); + } + + private void init() { + this.beanalias = "USERLOV"; + this.lrecord = new ArrayList<>(); + this.recperpage = 10; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + try { + Request request = this.callerhelper.getRequest(); + super.addFilterDateto(); + super.addFilter("companycode", super.getLoginController().getRequest().getCompany().toString()); + super.addFilter("branchcode", super.getLoginController().getRequest().getBranchCode().toString()); + super.addFilter("officecode", super.getLoginController().getRequest().getOfficeCode().toString()); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + if ((this.userName != null) && !this.userName.isEmpty()) { + Filter f = null; + f = new Filter(); + f.setSql(" t.pk.personcode in (select p.pk.personcode from com.fp.persistence.pcustomer.gene.TcustPersonDetail p where p.name like '" + + this.userName + + "' and p.pk.dateto = to_date('2999-12-31', 'yyyy-MM-dd') and p.companycode =" + + super.getLoginController().getRequest().getCompany().toString() + ")"); + dto.addFiltro(f); + + } + SubQuery subquery = new SubQuery("TcustPersonDetail", "name", "personname", + "i.pk.personcode = t.pk.personcode and i.pk.dateto = to_date('2999-12-31', 'yyyy-MM-dd') and i.companycode=" + + super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); + request.setQueryTables(mtables); + Response response = this.callerhelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(response); + } else { + this.lrecord = (List) response.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + // TODO: handle exception + MessageHelper.setMessageError(e); + } + + } + + public void setuser() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setuser(TsafeUserDetail tsafeUserDetail) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tsafeUserDetail); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/usersLov.xhtml", options, params); + } + + public String getUserName() { + return this.userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/ActivityLovController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/ActivityLovController.java new file mode 100644 index 0000000..b8b0b68 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/ActivityLovController.java @@ -0,0 +1,117 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TgeneActivity; + +/** + * Clase controladora del lov asociado al bean TsafeUserDetail. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ActivityLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public ActivityLovController() throws Exception { + super(TgeneActivity.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "ACTIVITYLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + //SubQuery + SubQuery subquerya = new SubQuery("TgeneCatalogDetail", "description", "segmentdesc", + "i.pk.catalogcode = t.segmenttypecatalogcode and i.pk.catalog = t.segmenttypecatalog "); + dto.addSubQuery(subquerya); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setactivity() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setactivity(TgeneActivity tgeneActivity) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneActivity); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put("modal", true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + // lovpersona es el nombre de la pagina + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/activitypersegmentsLov.xhtml", options, params); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/BalanceTypeLovController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/BalanceTypeLovController.java new file mode 100644 index 0000000..b948908 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/BalanceTypeLovController.java @@ -0,0 +1,121 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneBalanceType; + +/** + * Clase controladora del lov asociado al bean TgeneProcess. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class BalanceTypeLovController extends AbstractController { + + public BalanceTypeLovController() throws Exception { + super(TgeneBalanceType.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + String category = CallerHelper.getLovParameter("category"); + if (category != null) { + super.addFilter("balancecategory", category); + } + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PROCESSLOV"; + super.addField("modulecode", CallerHelper.getLovParameter("modulecode")); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.balancetype, t.pk.balancegroup "); + if (super.getFieldvalue("modulecode") != null) { + String value = super.getFieldvalue("modulecode").toString(); + Filter f = new Filter(); + f.setSql("(modulecode = '" + value + "' or modulecode is null) "); + dto.addFiltro(f); + } + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setBalancetype() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setBalancetype(TgeneBalanceType tgeneBalanceType) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneBalanceType); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put("modal", true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/balanceTypeLov.xhtml", options, params); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/BranchLovController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/BranchLovController.java new file mode 100644 index 0000000..b5650e4 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/BranchLovController.java @@ -0,0 +1,109 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneBranch; + +/** + * Clase controladora del lov asociado al bean TgeneBranch. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class BranchLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public BranchLovController() throws Exception { + super(TgeneBranch.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "BRANCHLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.branchcode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setBranch() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setBranch(TgeneBranch tgeneBranch) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneBranch); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put("modal", true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/branchLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/CatalogLovController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/CatalogLovController.java new file mode 100644 index 0000000..d2c0044 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/CatalogLovController.java @@ -0,0 +1,108 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class CatalogLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public CatalogLovController() throws Exception { + super(TgeneCatalog.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOGLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setcatalog() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setcatalog(TgeneCatalog tgeneCatalog) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneCatalog); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/catalogLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/EntityLovController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/EntityLovController.java new file mode 100644 index 0000000..988e0f5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/EntityLovController.java @@ -0,0 +1,108 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneEntity; + +/** + * + * @author Jacqueline Arias + * + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class EntityLovController extends AbstractController { + + public EntityLovController() throws Exception { + super(TgeneEntity.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + public void postConstruct() { + this.init(); + try { + String log; + log = CallerHelper.getLovParameter("log"); + if (log != null) { + this.addFilter("log", log); + } + this.query(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + private void init() { + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEENTITY"; + this.recperpage = 10; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + try { + Request request = this.callerhelper.getRequest(); + + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); + request.setQueryTables(mtables); + Response response = this.callerhelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(response); + } else { + this.lrecord = (List) response.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + // TODO: handle exception + MessageHelper.setMessageError(e); + } + + } + + public void setentity() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setentity(TgeneEntity tgeneEntity) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneEntity); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/entityLov.xhtml", options, params); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/LevelLovController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/LevelLovController.java new file mode 100644 index 0000000..a75dadc --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/LevelLovController.java @@ -0,0 +1,131 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelDesc; + +/** + * Clase controladora del lov asociado al bean TgeneMenuLevelDesc. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class LevelLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public LevelLovController() throws Exception { + super(TgeneMenuLevelDesc.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + // + String menucode = CallerHelper.getLovParameter("pk.menucode"); + if (menucode == null) { + MessageHelper.setMessageError("msg_menuNotFound"); + return; + } + super.getMfilters().put("pk.menucode", menucode); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "MENULEVELLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if (super.getMfilters().get("pk.menucode") == null) { + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + this.getMfilters().put("pk.languagecode", this.getLoginController().getRequest().getLanguage()); + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.levelcode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el valor del Lov + */ + public void setMenuLevel() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + /** + * Obtiene el valor del Lov + */ + public void setMenuLevel(TgeneMenuLevelDesc tgeneMenuLevelDesc) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneMenuLevelDesc); + } + + /** + * Abre el lov de MenuLevel + * + * @param params + */ + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put("modal", true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/menulevelLov.xhtml", options, params); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/MessageTemplatesLovController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/MessageTemplatesLovController.java new file mode 100644 index 0000000..59ff7b3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/MessageTemplatesLovController.java @@ -0,0 +1,112 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplates; + +/** + * Clase controladora del lov asociado al bean TgeneMessageTemplates. + * + * @author Andres E Carpio. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class MessageTemplatesLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public MessageTemplatesLovController() throws Exception { + super(TgeneMessageTemplates.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "MESSAGETEMPLATESLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if (!super.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk, t.description"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setmessage() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setmessage(TgeneMessageTemplates tgeneMessageTemplates) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneMessageTemplates); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 580); //580 porque se abre desde un dialogo + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/messageTemplatesLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/ProcessLovControler.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/ProcessLovControler.java new file mode 100644 index 0000000..d7e972a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/ProcessLovControler.java @@ -0,0 +1,118 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.proc.TgeneProcess; + +/** + * Clase controladora del lov asociado al bean TgeneProcess. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ProcessLovControler extends AbstractController { + + public ProcessLovControler() throws Exception { + super(TgeneProcess.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + String processtype = CallerHelper.getLovParameter("processtype"); + if (processtype != null) { + super.addFilter("pk.catalogtypeprocess", processtype); + } + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PROCESSLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if (!super.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.processcode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setprocess() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setprocess(TgeneProcess tgeneProcess) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneProcess); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put("modal", true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 580); // no cambiar de 580 para que funcione en un ipad + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/processLov.xhtml", options, params); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/ProfileLovController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/ProfileLovController.java new file mode 100644 index 0000000..c377ab4 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/ProfileLovController.java @@ -0,0 +1,109 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.safe.TsafeProfile; + +/** + * Clase controladora del lov asociado al bean TsafeProfile. + * + * @author David López P. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ProfileLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public ProfileLovController() throws Exception { + super(TsafeProfile.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PROFILELOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void setProfile() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setProfile(TsafeProfile tsafeProfile) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tsafeProfile); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put("modal", true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 580); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/profileLov.xhtml", options, params); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/SubLevelLovController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/SubLevelLovController.java new file mode 100644 index 0000000..6fb4b92 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/SubLevelLovController.java @@ -0,0 +1,141 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelDesc; + +/** + * Clase controladora del lov asociado al bean TgeneMenuLevelDesc. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class SubLevelLovController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public SubLevelLovController() throws Exception { + super(TgeneMenuSubLevelDesc.class); + } + + @PostConstruct + private void postconstruct() throws Exception { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + // + String menucode = CallerHelper.getLovParameter("pk.menucode"); + String levelcode = CallerHelper.getLovParameter("pk.levelcode"); + if (menucode == null) { + MessageHelper.setMessageError("msg_menuNotFound"); + return; + } + if (levelcode == null) { + MessageHelper.setMessageError("msg_levelNotFound"); + return; + } + super.getMfilters().put("pk.menucode", menucode); + super.getMfilters().put("pk.levelcode", levelcode); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "MENUSUBLEVELLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if (super.getMfilters().get("pk.menucode") == null) { + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + if (super.getMfilters().get("pk.levelcode") == null) { + MessageHelper.setMessageError("msg_menuLevelRequired"); + return; + } + this.getMfilters().put("pk.languagecode", this.getLoginController().getRequest().getLanguage()); + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.levelcode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Obtiene el valor del Lov + */ + public void setMenuSubLevel() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + /** + * Obtiene el valor del Lov + */ + public void setMenuSubLevel(TgeneMenuSubLevelDesc tgeneMenuSubLevelDesc) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneMenuSubLevelDesc); + } + + /** + * Abre el lov de MenuLevel + * + * @param params + */ + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put("modal", true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/menusublevelLov.xhtml", options, params); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/TransactionLovController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/TransactionLovController.java new file mode 100644 index 0000000..fe10cdf --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/TransactionLovController.java @@ -0,0 +1,144 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * Clase controladora del lov asociado al bean TgeneCatalog. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class TransactionLovController extends AbstractController { + + private String moduleCode = null; + + public TransactionLovController() throws Exception { + super(TgeneTransaction.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + try { + this.moduleCode = CallerHelper.getLovParameter("moduleCode"); + } catch (Exception e) { + // TODO: handle exception + } + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TRANSACTIONLOV"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + if ((this.moduleCode == null) || this.moduleCode.isEmpty()) { + if (!super.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + } + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.transactionmodule, t.pk.transactioncode, t.pk.transactionversion"); + + if ((this.moduleCode != null) && !this.moduleCode.isEmpty()) { + Filter f = null; + if ((super.getMfilters().get("pk.transactionmodule") != null) && !super.getMfilters().get("pk.transactionmodule").equals("")) { + f = new Filter(); + f.setSql("t.pk.transactionmodule = '" + this.moduleCode + "'"); + } else { + f = new Filter("pk.transactionmodule", "=" + this.moduleCode); + } + dto.addFiltro(f); + } + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void settransaction() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void settransaction(TgeneTransaction tgeneTransaction) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tgeneTransaction); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + // hint: ver EnumLovOption para las opciones del modal + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 400); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + + // lovpersona es el nombre de la pagina + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/transactionLov.xhtml", options, params); + } + + public String getModuleCode() { + return this.moduleCode; + } + + public void setModuleCode(String moduleCode) { + this.moduleCode = moduleCode; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/UserLovControler.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/UserLovControler.java new file mode 100644 index 0000000..6e9f0c8 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/UserLovControler.java @@ -0,0 +1,127 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de bean TsafeUserDetail + * + * @author Jacqueline Arias + * + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class UserLovControler extends AbstractController { + + private String userName = null; + + public UserLovControler() throws Exception { + super(TsafeUserDetail.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + public void postConstruct() { + this.init(); + } + + private void init() { + this.beanalias = "USERLOV"; + this.lrecord = new ArrayList<>(); + this.recperpage = 10; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + try { + Request request = this.callerhelper.getRequest(); + super.addFilterDateto(); + super.addFilter("companycode", super.getLoginController().getRequest().getCompany().toString()); + super.addFilter("branchcode", super.getLoginController().getRequest().getBranchCode().toString()); + super.addFilter("officecode", super.getLoginController().getRequest().getOfficeCode().toString()); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + if ((this.userName != null) && !this.userName.isEmpty()) { + Filter f = null; + f = new Filter(); + f.setSql(" t.pk.personcode in (select p.pk.personcode from com.fp.persistence.pcustomer.gene.TcustPersonDetail p where p.name like '" + + this.userName + + "' and p.pk.dateto = to_date('2999-12-31', 'yyyy-MM-dd') and p.companycode =" + + super.getLoginController().getRequest().getCompany().toString() + ")"); + dto.addFiltro(f); + + } + SubQuery subquery = new SubQuery("TcustPersonDetail", "name", "personname", + "i.pk.personcode = t.pk.personcode and i.pk.dateto = to_date('2999-12-31', 'yyyy-MM-dd') and i.companycode=" + + super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); + request.setQueryTables(mtables); + Response response = this.callerhelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(response); + } else { + this.lrecord = (List) response.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + // TODO: handle exception + MessageHelper.setMessageError(e); + } + + } + + public void setuser() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setuser(TsafeUserDetail tsafeUserDetail) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tsafeUserDetail); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/usersLov.xhtml", options, params); + } + + public String getUserName() { + return this.userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/UserLovController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/UserLovController.java new file mode 100644 index 0000000..8c59d4c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/lov/UserLovController.java @@ -0,0 +1,127 @@ +package com.fp.frontend.controller.pgeneral.lov; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.Filter; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.enums.EnumLovOption; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de bean TsafeUserDetail + * + * @author Jacqueline Arias + * + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class UserLovController extends AbstractController { + + private String userName = null; + + public UserLovController() throws Exception { + super(TsafeUserDetail.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + public void postConstruct() { + this.init(); + } + + private void init() { + this.beanalias = "USERLOV"; + this.lrecord = new ArrayList<>(); + this.recperpage = 10; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + try { + Request request = this.callerhelper.getRequest(); + super.addFilterDateto(); + super.addFilter("companycode", super.getLoginController().getRequest().getCompany().toString()); + super.addFilter("branchcode", super.getLoginController().getRequest().getBranchCode().toString()); + super.addFilter("officecode", super.getLoginController().getRequest().getOfficeCode().toString()); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + if ((this.userName != null) && !this.userName.isEmpty()) { + Filter f = null; + f = new Filter(); + f.setSql(" t.pk.personcode in (select p.pk.personcode from com.fp.persistence.pcustomer.gene.TcustPersonDetail p where p.name like '" + + this.userName + + "' and p.pk.dateto = to_date('2999-12-31', 'yyyy-MM-dd') and p.companycode =" + + super.getLoginController().getRequest().getCompany().toString() + ")"); + dto.addFiltro(f); + + } + SubQuery subquery = new SubQuery("TcustPersonDetail", "name", "personname", + "i.pk.personcode = t.pk.personcode and i.pk.dateto = to_date('2999-12-31', 'yyyy-MM-dd') and i.companycode=" + + super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); + request.setQueryTables(mtables); + Response response = this.callerhelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(response); + } else { + this.lrecord = (List) response.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + // TODO: handle exception + MessageHelper.setMessageError(e); + } + + } + + public void setuser() { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(this.record); + } + + public void setuser(TsafeUserDetail tsafeUserDetail) { + // se utiliza en la pagina del lov. + RequestContext.getCurrentInstance().closeDialog(tsafeUserDetail); + } + + public static void openLov(Map> params) { + Map options = new HashMap(); + options.put(EnumLovOption.MODAL.getLabel(), true); + options.put(EnumLovOption.HEIGHT.getLabel(), 450); + options.put(EnumLovOption.WIDTH.getLabel(), 700); + options.put(EnumLovOption.RESIZABLE.getLabel(), false); + RequestContext.getCurrentInstance().openDialog("/pages/general/lov/usersLov.xhtml", options, params); + } + + public String getUserName() { + return this.userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/entries new file mode 100644 index 0000000..cc1e627 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/entries @@ -0,0 +1,266 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +MenuSubLevelTranController.java +file + + + + +2022-07-28T03:39:55.204597Z +e1aea43347a6790efa980af1ddeb7a04 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +7944 + +SubLevelDescController.java +file + + + + +2022-07-28T03:39:55.205597Z +fb2cff21ae3423b2d1e17983893b41b5 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +7145 + +MenuLevelTranController.java +file + + + + +2022-07-28T03:39:55.205597Z +27546577e7d631078c26859ac99b6c22 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +6379 + +SubLevelController.java +file + + + + +2022-07-28T03:39:55.205597Z +20576f2efc45e047948a434c1cbb15d8 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +2345 + +MenuController.java +file + + + + +2022-07-28T03:39:55.205597Z +37d5d83245dfe1b8787b98666d5b7e56 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +18657 + +LevelDescController.java +file + + + + +2022-07-28T03:39:55.205597Z +2318992f9f522701f8fafd1ab636e54e +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +5581 + +LevelController.java +file + + + + +2022-07-28T03:39:55.206597Z +c44556a8756d0e3ae7e2957479a1cc5e +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +2261 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/text-base/LevelController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/text-base/LevelController.java.svn-base new file mode 100644 index 0000000..cf1f165 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/text-base/LevelController.java.svn-base @@ -0,0 +1,90 @@ +package com.fp.frontend.controller.pgeneral.menu; + +import java.math.BigDecimal; +import java.util.ArrayList; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevel; + +/** + * Clase controladora del bean TgeneMenuLevel. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class LevelController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public LevelController() throws Exception { + super(TgeneMenuLevel.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEMENULEVEL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + protected void querydatabase() { + MessageHelper.setMessageError("msg_notQuery"); + } + + @Override + public void save(){ + MessageHelper.setMessageError("msg_notSave"); + } + + /** + * Obtiene el codigo del levelcode + */ + public Integer getLevelCode( Integer menucode){ + Integer levelcode = null; + try { + Request request = this.callerhelper.getRequest(); + request.put("queryalias", "EXECUTESQL"); + request.put("querytype", "P"); + request.put("isUniqueResult", "Y"); + request.put("sql", "select coalesce(max(LEVELCODE), 0)+1 from TGENEMENULEVEL where MENUCODE = "+menucode); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + levelcode = null; + MessageHelper.setMessageError(resp); + } else { + levelcode = ((BigDecimal)resp.get("result")).intValue(); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + return levelcode; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/text-base/LevelDescController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/text-base/LevelDescController.java.svn-base new file mode 100644 index 0000000..7f8c999 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/text-base/LevelDescController.java.svn-base @@ -0,0 +1,205 @@ +package com.fp.frontend.controller.pgeneral.menu; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenu; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelDesc; + +/** + * Clase controladora del bean TgeneMenuLevelDesc. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class LevelDescController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public LevelDescController() throws Exception { + super(TgeneMenuLevelDesc.class); + } + + @ManagedProperty(value = "#{levelController}") + private LevelController level; + + /** + * Atributo para el objeto TgeneMenu + */ + private TgeneMenu genemenu; + /** + * Atributo para el codigo levelcode + */ + private Integer levelcode; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.genemenu = null; + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEMENULEVELDESC"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Inicializa las paginas en la consulta + */ + public void initRecPage(){ + this.page = 0; + this.recperpage = 10; + this.levelcode = this.level.getLevelCode(this.genemenu.getPk()); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + //Filtros + this.getMfilters().put("pk.menucode", this.genemenu!=null?this.genemenu.getPk().toString():null); + this.getMfilters().put("pk.languagecode", this.getLoginController().getRequest().getLanguage()); + + if(super.getMfilters().get("pk.menucode")==null){ + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.levelcode"); // En en string van todos los campos de + + // subqueries 1 + SubQuery subquery = new SubQuery("TgeneMenuLevel", "presentationorder", "presentationorder", + "i.pk.menucode = t.pk.menucode and i.pk.levelcode = t.pk.levelcode"); + dto.addSubQuery(subquery); + + // subqueries 2 + SubQuery subquery1 = new SubQuery("TgeneMenu", "description", "menudesc", + "i.pk = t.pk.menucode"); + dto.addSubQuery(subquery1); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.menucode") == null) { + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + super.create(); + this.record.put("menudesc", this.genemenu.getDescription()); + this.record.getPk().setMenucode(this.genemenu.getPk()); + this.record.getPk().setLevelcode(this.levelcode++); + this.record.getPk().setLanguagecode(this.getLoginController().getRequest().getLanguage()); + } + + + /** + * Entrega el objeto TgeneMenu + * @return genemenu + */ + public TgeneMenu getGenemenu() { + return genemenu; + } + + /** + * Fija el objeto TgeneMenu + * @param genemenu + */ + public void setGenemenu(TgeneMenu genemenu) { + this.genemenu = genemenu; + } + + /** + * Entrega el valor de level + * @return level + */ + public LevelController getLevel() { + return level; + } + + /** + * Fija el valor de level + * @param level + */ + public void setLevel(LevelController level) { + this.level = level; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/text-base/MenuController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/text-base/MenuController.java.svn-base new file mode 100644 index 0000000..9750254 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/text-base/MenuController.java.svn-base @@ -0,0 +1,539 @@ +package com.fp.frontend.controller.pgeneral.menu; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.lov.LevelLovController; +import com.fp.frontend.controller.pgeneral.lov.SubLevelLovController; +import com.fp.frontend.controller.pgeneral.lov.TransactionLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.menu.TgeneMenu; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelDesc; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelTran; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelDesc; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelTran; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * Clase controladora del bean TgeneMenu. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class MenuController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public MenuController() throws Exception { + super(TgeneMenu.class); + } + + @ManagedProperty(value = "#{levelDescController}") + private LevelDescController levelDesc; + + @ManagedProperty(value = "#{levelController}") + private LevelController level; + + @ManagedProperty(value = "#{subLevelDescController}") + private SubLevelDescController subLevelDesc; + + @ManagedProperty(value = "#{subLevelController}") + private SubLevelController subLevel; + + @ManagedProperty(value = "#{menuLevelTranController}") + private MenuLevelTranController levelTran; + + @ManagedProperty(value = "#{menuSubLevelTranController}") + private MenuSubLevelTranController subLevelTran; + + private TgeneMenuLevelDesc menuleveldesc; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + // Consulta + this.querydatabase(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.menuleveldesc = null; + this.recperpage = 4; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEMENU"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void update(){ + try{ + //Menu level + this.levelDesc.setGenemenu(this.record); + this.levelDesc.initRecPage(); + this.levelDesc.setLrecord(new ArrayList()); + + //Menu Sublevel + super.getMfilelds().put("pk.levelcode", null); + super.getMfilelds().put("leveldescription", null); + this.subLevelDesc.setGenemenu(this.record); + this.subLevelDesc.setLrecord(new ArrayList()); + + //Menu levelTran + super.getMfilelds().put("pk.levelcodetran", null); + super.getMfilelds().put("leveldescriptiontran", null); + this.levelTran.setGenemenu(this.record); + this.levelTran.setLrecord(new ArrayList()); + + //Menu levelTran + this.menuleveldesc = null; + super.getMfilelds().put("pk.levelcodesubtran", null); + super.getMfilelds().put("leveldescriptionsubtran", null); + super.getMfilelds().put("pk.sublevelcodesubtran", null); + super.getMfilelds().put("subLeveldescriptionsubtran", null); + this.subLevelTran.setGenemenu(this.record); + this.subLevelTran.setLrecord(new ArrayList()); + + super.update(); + }catch(Exception ex){ + MessageHelper.setMessageError(ex); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + boolean parentSave = true + ; + Request request = this.callerhelper.getRequest(); + //Dto Menu + DtoSave dtosave = super.getDtoSave(); + //Dto Menu Level Desc + DtoSave dtosaveleveldesc = this.levelDesc.getDtoSave(); + //Dto Menu Level + DtoSave dtosavelevel = this.level.getDtoSave(); + //Dto Menu SubLevel Desc + DtoSave dtosavesubleveldesc = this.subLevelDesc.getDtoSave(); + //Dto Menu SubLevel + DtoSave dtosavesublevel = this.subLevel.getDtoSave(); + //Dto Menu Level Tran + DtoSave dtosaveleveltran = this.levelTran.getDtoSave(); + //Dto Menu SubLevel Tran + DtoSave dtosavesubleveltran = this.subLevelTran.getDtoSave(); + + // if(!dtosave.pendingProcess() && !dtosaveleveldesc.pendingProcess() && !dtosavesubleveldesc.pendingProcess() && !dtosaveleveltran.pendingProcess() && !dtosavesubleveltran.pendingProcess()){ + // return; + // } + + HashMap msave = new HashMap(); + + if(dtosave.pendingProcess()){ + msave.put(this.beanalias, dtosave); + parentSave = false; + } + if(parentSave){ + if(dtosaveleveldesc.pendingProcess()){ + msave.put(this.levelDesc.getBeanalias(), dtosaveleveldesc); + msave.put(this.level.getBeanalias(), dtosavelevel); + } + if(dtosavesubleveldesc.pendingProcess()){ + msave.put(this.subLevelDesc.getBeanalias(), dtosavesubleveldesc); + msave.put(this.subLevel.getBeanalias(), dtosavesublevel); + } + if(dtosaveleveltran.pendingProcess()){ + msave.put(this.levelTran.getBeanalias(), dtosaveleveltran); + } + if(dtosavesubleveltran.pendingProcess()){ + msave.put(this.subLevelTran.getBeanalias(), dtosavesubleveltran); + } + } + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + if(!parentSave){ + this.save(); + }else{ + this.levelDesc.postCommit(resp); + this.subLevelDesc.postCommit(resp); + this.levelTran.postCommit(resp); + this.subLevelTran.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void generateQuery(TgeneMenu tgenemenu) throws Exception{ + this.record = tgenemenu; + this.generateQuery(); + } + + /** + * Método que ejecuta el evento de seleccion del menu + * @throws Exception + */ + public void generateQuery() throws Exception{ + + //Menu level + this.levelDesc.setGenemenu(this.record); + this.levelDesc.initRecPage(); + this.levelDesc.query(); + + //Menu Sublevel + super.getMfilelds().put("pk.levelcode", null); + super.getMfilelds().put("leveldescription", null); + this.subLevelDesc.setGenemenu(this.record); + this.subLevelDesc.setLrecord(new ArrayList()); + + //Menu levelTran + super.getMfilelds().put("pk.levelcodetran", null); + super.getMfilelds().put("leveldescriptiontran", null); + this.levelTran.setGenemenu(this.record); + this.levelTran.setLrecord(new ArrayList()); + + //Menu levelTran + this.menuleveldesc = null; + super.getMfilelds().put("pk.levelcodesubtran", null); + super.getMfilelds().put("leveldescriptionsubtran", null); + super.getMfilelds().put("pk.sublevelcodesubtran", null); + super.getMfilelds().put("subLeveldescriptionsubtran", null); + this.subLevelTran.setGenemenu(this.record); + this.subLevelTran.setLrecord(new ArrayList()); + } + + /** + * Entrega una lista de objetos TgeneMenu + * @return lrecord Lista de objetos TgeneMenu + */ + public static List find() { + try { + MenuController cc = new MenuController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Encuentra por el id de TgeneMenu + * @param id + * @return + */ + public static TgeneMenu findPerfil(Integer id) { + try { + if(id==null || id == 0){ + return null; + } + MenuController cc = new MenuController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", id.toString()); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Llama al Lov MenuLevel + */ + public void openMenuLevelLov() { + if(this.record==null){ + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + List values = new ArrayList(); + values.add(this.record.getPk().toString()); + Map> params = new HashMap<>(); + params.put("pk.menucode", values); + LevelLovController.openLov(params); + } + + /** + * Llama al Lov MenuSubLevel + */ + public void openMenuSubLevelLov() { + if(this.record==null){ + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + if(this.menuleveldesc==null){ + MessageHelper.setMessageError("msg_menuLevelRequired"); + return; + } + List menucode = new ArrayList(); + List levelcode = new ArrayList(); + menucode.add(this.menuleveldesc.getPk().getMenucode().toString()); + levelcode.add(this.menuleveldesc.getPk().getLevelcode().toString()); + Map> params = new HashMap<>(); + params.put("pk.menucode", menucode); + params.put("pk.levelcode", levelcode); + SubLevelLovController.openLov(params); + } + + /** + * Gestiona la respuesta del Lov MenuLevel + * @param event + * @throws Exception + */ + public void onReturnMenuLevelLov(SelectEvent event) throws Exception { + TgeneMenuLevelDesc t = (TgeneMenuLevelDesc) event.getObject(); + super.addField("pk.levelcode", t.getPk().getLevelcode().toString()); + super.addField("leveldescription", t.getDescription()); + this.subLevelDesc.setGenemenulevel(t); + this.subLevelDesc.initRecPage(); + this.subLevelDesc.query(); + } + + /** + * Gestiona la respuesta del Lov MenuLevel para transacciones por nivel + * @param event + * @throws Exception + */ + public void onReturnMenuLevelTranLov(SelectEvent event) throws Exception { + TgeneMenuLevelDesc t = (TgeneMenuLevelDesc) event.getObject(); + super.addField("pk.levelcodetran", t.getPk().getLevelcode().toString()); + super.addField("leveldescriptiontran", t.getDescription()); + this.levelTran.setGenemenulevel(t); + this.levelTran.initRecPage(); + this.levelTran.query(); + } + + /** + * Gestiona la respuesta del Lov MenuLevel para transacciones por subnivel + * @param event + * @throws Exception + */ + public void onReturnMenuLevelTran2Lov(SelectEvent event) throws Exception { + TgeneMenuLevelDesc t = (TgeneMenuLevelDesc) event.getObject(); + this.menuleveldesc = t; + super.addField("pk.levelcodesubtran", t.getPk().getLevelcode().toString()); + super.addField("leveldescriptionsubtran", t.getDescription()); + super.addField("pk.sublevelcodesubtran", null);// + super.addField("subLeveldescriptionsubtran", null);// + this.subLevelTran.setLrecord(null); + this.subLevelTran.setGenemenulevel(t); + } + + /** + * Gestiona la respuesta del Lov MenuLevel + * @param event + * @throws Exception + */ + public void onReturnMenuSubLevelLov(SelectEvent event) throws Exception { + TgeneMenuSubLevelDesc t = (TgeneMenuSubLevelDesc) event.getObject(); + super.addField("pk.sublevelcodesubtran", t.getPk().getSublevel().toString()); + super.addField("subLeveldescriptionsubtran", t.getDescription()); + this.subLevelTran.setGenemenusublevel(t); + this.subLevelTran.initRecPage(); + this.subLevelTran.query(); + } + + /** + * Abre el lov de transacciones + */ + public void openTransactionLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("TRANSACTION"); // valor del parametro + params.put("processtype", l); + + TransactionLovController.openLov(params); + } + + /** + * Gestiona la respuesta del lov + * @param event + * @throws Exception + */ + public void onReturnTransactionLov(SelectEvent event) throws Exception { + TgeneTransaction t = (TgeneTransaction) event.getObject(); + this.levelTran.getRecord().getPk().setTransactionmodule(t.getPk().getTransactionmodule()); + this.levelTran.getRecord().getPk().setTransactioncode(t.getPk().getTransactioncode()); + this.levelTran.getRecord().getPk().setTransactionversion(t.getPk().getTransactionversion()); + this.levelTran.getRecord().put("name", t.getName()); + } + + /** + * Gestiona la respuesta del lov para el subnivel + * @param event + * @throws Exception + */ + public void onReturnSubTransactionLov(SelectEvent event) throws Exception { + TgeneTransaction t = (TgeneTransaction) event.getObject(); + this.subLevelTran.getRecord().getPk().setTransactionmodule(t.getPk().getTransactionmodule()); + this.subLevelTran.getRecord().getPk().setTransactioncode(t.getPk().getTransactioncode()); + this.subLevelTran.getRecord().getPk().setTransactionversion(t.getPk().getTransactionversion()); + this.subLevelTran.getRecord().put("name", t.getName()); + } + + /** + * Entrega el valor de levelDesc + * @return levelDesc + */ + public LevelDescController getLevelDesc() { + return levelDesc; + } + + /** + * Fija el valor de levelDesc + * @param levelDesc + */ + public void setLevelDesc(LevelDescController levelDesc) { + this.levelDesc = levelDesc; + } + + /** + * Entrega el valor de level + * @return level + */ + public LevelController getLevel() { + return level; + } + + /** + * Fija el valor de level + * @param level + */ + public void setLevel(LevelController level) { + this.level = level; + } + + /** + * Entrega el valor de subLevelDesc + * @return subLevelDesc + */ + public SubLevelDescController getSubLevelDesc() { + return subLevelDesc; + } + + /** + * Fija el valor de subLevelDesc + * @param subLevelDesc + */ + public void setSubLevelDesc(SubLevelDescController subLevelDesc) { + this.subLevelDesc = subLevelDesc; + } + + /** + * Entrega el valor de menuLevel + * @return menuLevel + */ + public MenuLevelTranController getLevelTran() { + return levelTran; + } + + /** + * Fija el valor de menuLevel + * @param menuLevel + */ + public void setLevelTran(MenuLevelTranController levelTran) { + this.levelTran = levelTran; + } + + /** + * Entrega el valor de subLevelTran + * @return subLevelTran + */ + public MenuSubLevelTranController getSubLevelTran() { + return subLevelTran; + } + + /** + * Fija el valor de subLevelTran + * @param subLevelTran + */ + public void setSubLevelTran(MenuSubLevelTranController subLevelTran) { + this.subLevelTran = subLevelTran; + } + + /** + * Entrega el valor de subLevel + * @return subLevel + */ + public SubLevelController getSubLevel() { + return subLevel; + } + + /** + * Fija el valor de subLevel + * @param subLevel + */ + public void setSubLevel(SubLevelController subLevel) { + this.subLevel = subLevel; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/text-base/MenuLevelTranController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/text-base/MenuLevelTranController.java.svn-base new file mode 100644 index 0000000..277d269 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/text-base/MenuLevelTranController.java.svn-base @@ -0,0 +1,217 @@ +package com.fp.frontend.controller.pgeneral.menu; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenu; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelDesc; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelTran; + +/** + * Clase controladora del bean TgeneMenuLevelTran. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class MenuLevelTranController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public MenuLevelTranController() throws Exception { + super(TgeneMenuLevelTran.class); + } + + /** + * Atributo para el objeto TgeneMenu + */ + private TgeneMenu genemenu; + + /** + * Atributo para el objeto TgeneMenu + */ + private TgeneMenuLevelDesc genemenulevel; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.genemenu = null; + this.genemenulevel = null; + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEMENULEVELTRAN"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Inicializa las paginas en la consulta + */ + public void initRecPage(){ + this.page = 0; + this.recperpage = 10; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + //Filtros + this.getMfilters().put("pk.menucode", this.genemenu!=null?this.genemenu.getPk().toString():null); + this.getMfilters().put("pk.levelcode", this.genemenulevel!=null?this.genemenulevel.getPk().getLevelcode().toString():null); + + if(super.getMfilters().get("pk.menucode")==null){ + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + if(super.getMfilters().get("pk.levelcode")==null){ + MessageHelper.setMessageError("msg_menuLevelRequired"); + return; + } + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.presentationorder"); // En en string van todos los campos de + + // subqueries + SubQuery subquery = new SubQuery("TgeneTransaction", "name", "name", + "i.pk.transactionmodule = t.pk.transactionmodule and " + + "i.pk.transactioncode = t.pk.transactioncode and " + + "i.pk.transactionversion = t.pk.transactionversion"); + dto.addSubQuery(subquery); + + // subqueries 1 + SubQuery subquery1 = new SubQuery("TgeneMenuLevelDesc", "description", "leveldescription", + "i.pk.menucode = t.pk.menucode and i.pk.levelcode = t.pk.levelcode and i.pk.languagecode = '"+this.getLoginController().getRequest().getLanguage()+"'"); + dto.addSubQuery(subquery1); + + // subqueries 2 + SubQuery subquery2 = new SubQuery("TgeneMenu", "description", "menudesc", + "i.pk = t.pk.menucode"); + dto.addSubQuery(subquery2); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (this.genemenu == null) { + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + if(this.genemenulevel==null){ + MessageHelper.setMessageError("msg_menuLevelRequired"); + return; + } + super.create(); + System.out.println("REGISTRO "+this.record); + this.record.put("menudesc", this.genemenu.getDescription()); + this.record.put("leveldescription", this.genemenulevel.getDescription()); + this.record.getPk().setMenucode(this.genemenulevel.getPk().getMenucode()); + this.record.getPk().setLevelcode(this.genemenulevel.getPk().getLevelcode()); + } + + + /** + * Entrega el objeto TgeneMenuLevelDesc + * @return genemenulevel + */ + public TgeneMenuLevelDesc getGenemenulevel() { + return genemenulevel; + } + + /** + * Fija el objeto TgeneMenuLevelDesc + * @param genemenulevel + */ + public void setGenemenulevel(TgeneMenuLevelDesc genemenulevel) { + this.genemenulevel = genemenulevel; + } + + /** + * Entrega el objeto TgeneMenu + * @return genemenu + */ + public TgeneMenu getGenemenu() { + return genemenu; + } + + /** + * Entrega el objeto TgeneMenu + * @return genemenu + */ + public void setGenemenu(TgeneMenu genemenu) { + this.genemenu = genemenu; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/text-base/MenuSubLevelTranController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/text-base/MenuSubLevelTranController.java.svn-base new file mode 100644 index 0000000..9d06982 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/text-base/MenuSubLevelTranController.java.svn-base @@ -0,0 +1,257 @@ +package com.fp.frontend.controller.pgeneral.menu; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenu; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelDesc; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelDesc; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelTran; + +/** + * Clase controladora del bean TgeneMenuSubLevelTran. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class MenuSubLevelTranController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public MenuSubLevelTranController() throws Exception { + super(TgeneMenuSubLevelTran.class); + } + + /** + * Atributo para el objeto TgeneMenu + */ + private TgeneMenu genemenu; + + /** + * Atributo para el objeto TgeneMenu + */ + private TgeneMenuLevelDesc genemenulevel; + + /** + * Atributo para el objeto TgeneMenuSubLevelDesc + */ + private TgeneMenuSubLevelDesc genemenusublevel; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.genemenu = null; + this.genemenulevel = null; + this.genemenusublevel = null; + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEMENUSUBLEVELTRAN"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Inicializa las paginas en la consulta + */ + public void initRecPage(){ + this.page = 0; + this.recperpage = 10; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + //Filtros + this.getMfilters().put("pk.menucode", this.genemenu!=null?this.genemenu.getPk().toString():null); + this.getMfilters().put("pk.levelcode", this.genemenulevel!=null?this.genemenulevel.getPk().getLevelcode().toString():null); + this.getMfilters().put("pk.sublevel", this.genemenusublevel!=null?this.genemenusublevel.getPk().getSublevel().toString():null); + + if(super.getMfilters().get("pk.menucode")==null){ + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + if(super.getMfilters().get("pk.levelcode")==null){ + MessageHelper.setMessageError("msg_menuLevelRequired"); + return; + } + if(super.getMfilters().get("pk.sublevel")==null){ + MessageHelper.setMessageError("msg_menuSubLevelRequired"); + return; + } + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.presentationorder"); // En en string van todos los campos de + + // subqueries + SubQuery subquery = new SubQuery("TgeneTransaction", "name", "name", + "i.pk.transactionmodule = t.pk.transactionmodule and " + + "i.pk.transactioncode = t.pk.transactioncode and " + + "i.pk.transactionversion = t.pk.transactionversion"); + dto.addSubQuery(subquery); + + // subqueries 1 + SubQuery subquery1 = new SubQuery("TgeneMenuLevelDesc", "description", "leveldescription", + "i.pk.menucode = t.pk.menucode and i.pk.levelcode = t.pk.levelcode and i.pk.languagecode = '"+this.getLoginController().getRequest().getLanguage()+"'"); + dto.addSubQuery(subquery1); + + // subqueries 2 + SubQuery subquery2 = new SubQuery("TgeneMenuSubLevelDesc", "description", "subleveldescription", + "i.pk.menucode = t.pk.menucode and i.pk.levelcode = t.pk.levelcode and i.pk.sublevel = t.pk.sublevel and i.pk.languagecode = '"+this.getLoginController().getRequest().getLanguage()+"'"); + dto.addSubQuery(subquery2); + + // subqueries 3 + SubQuery subquery3 = new SubQuery("TgeneMenu", "description", "menudesc", + "i.pk = t.pk.menucode"); + dto.addSubQuery(subquery3); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (this.genemenu == null) { + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + if(this.genemenulevel==null){ + MessageHelper.setMessageError("msg_menuLevelRequired"); + return; + } + if(this.genemenusublevel==null){ + MessageHelper.setMessageError("msg_menuSubLevelRequired"); + return; + } + super.create(); + System.out.println("REGISTRO "+this.record); + this.record.put("menudesc", this.genemenu.getDescription()); + this.record.put("leveldescription", this.genemenulevel.getDescription()); + this.record.put("subleveldescription", this.genemenusublevel.getDescription()); + this.record.getPk().setMenucode(this.genemenusublevel.getPk().getMenucode()); + this.record.getPk().setLevelcode(this.genemenusublevel.getPk().getLevelcode()); + this.record.getPk().setSublevel(this.genemenusublevel.getPk().getSublevel()); + } + + + /** + * Entrega el objeto TgeneMenuLevelDesc + * @return genemenulevel + */ + public TgeneMenuLevelDesc getGenemenulevel() { + return genemenulevel; + } + + /** + * Fija el objeto TgeneMenuLevelDesc + * @param genemenulevel + */ + public void setGenemenulevel(TgeneMenuLevelDesc genemenulevel) { + this.genemenulevel = genemenulevel; + } + + /** + * Entrega el objeto TgeneMenu + * @return genemenu + */ + public TgeneMenu getGenemenu() { + return genemenu; + } + + /** + * Fija el objeto TgeneMenu + * @param genemenu + */ + public void setGenemenu(TgeneMenu genemenu) { + this.genemenu = genemenu; + } + + /** + * Entrega el objeto TgeneMenuSubLevelDesc + * @return genemenusublevel + */ + public TgeneMenuSubLevelDesc getGenemenusublevel() { + return genemenusublevel; + } + + /** + * Fija el objeto TgeneMenuSubLevelDesc + * @param genemenusublevel + */ + public void setGenemenusublevel(TgeneMenuSubLevelDesc genemenusublevel) { + this.genemenusublevel = genemenusublevel; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/text-base/SubLevelController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/text-base/SubLevelController.java.svn-base new file mode 100644 index 0000000..4963de4 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/text-base/SubLevelController.java.svn-base @@ -0,0 +1,90 @@ +package com.fp.frontend.controller.pgeneral.menu; + +import java.math.BigDecimal; +import java.util.ArrayList; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevel; + +/** + * Clase controladora del bean TgeneMenuLevel. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class SubLevelController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public SubLevelController() throws Exception { + super(TgeneMenuSubLevel.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEMENUSUBLEVEL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + protected void querydatabase() { + MessageHelper.setMessageError("msg_notQuery"); + } + + @Override + public void save(){ + MessageHelper.setMessageError("msg_notSave"); + } + + /** + * Obtiene el codigo del levelcode + */ + public Integer getSubLevelCode( Integer menucode, Integer levelcode){ + Integer sublevelcode = null; + try { + Request request = this.callerhelper.getRequest(); + request.put("queryalias", "EXECUTESQL"); + request.put("querytype", "P"); + request.put("isUniqueResult", "Y"); + request.put("sql", "select coalesce(max(SUBLEVEL), 0)+1 from TGENEMENUSUBLEVEL where MENUCODE = "+menucode+" and LEVELCODE = "+levelcode); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + sublevelcode = null; + MessageHelper.setMessageError(resp); + } else { + sublevelcode = ((BigDecimal)resp.get("result")).intValue(); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + return sublevelcode; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/text-base/SubLevelDescController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/text-base/SubLevelDescController.java.svn-base new file mode 100644 index 0000000..3148b38 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/.svn/text-base/SubLevelDescController.java.svn-base @@ -0,0 +1,242 @@ +package com.fp.frontend.controller.pgeneral.menu; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenu; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelDesc; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelDesc; + + +/** + * Clase controladora del bean TgeneMenuSubLevelDesc. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class SubLevelDescController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public SubLevelDescController() throws Exception { + super(TgeneMenuSubLevelDesc.class); + } + + @ManagedProperty(value = "#{subLevelController}") + private SubLevelController subLevel; + + /** + * Atributo para el objeto TgeneMenu + */ + private TgeneMenu genemenu; + + /** + * Atributo para el objeto TgeneMenu + */ + private TgeneMenuLevelDesc genemenulevel; + + /** + * Atributo para el codigo de subnivel + */ + private Integer sublevelcode; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.genemenu = null; + this.genemenulevel = null; + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEMENUSUBLEVELDESC"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Inicializa las paginas en la consulta + */ + public void initRecPage(){ + this.page = 0; + this.recperpage = 10; + this.sublevelcode = this.subLevel.getSubLevelCode(this.genemenulevel.getPk().getMenucode(), this.genemenulevel.getPk().getLevelcode()); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + //Filtros + this.getMfilters().put("pk.menucode", this.genemenu!=null?this.genemenu.getPk().toString():null); + this.getMfilters().put("pk.levelcode", this.genemenulevel!=null?this.genemenulevel.getPk().getLevelcode().toString():null); + this.getMfilters().put("pk.languagecode", this.getLoginController().getRequest().getLanguage()); + + if(super.getMfilters().get("pk.menucode")==null){ + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + if(super.getMfilters().get("pk.levelcode")==null){ + MessageHelper.setMessageError("msg_menuLevelRequired"); + return; + } + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.levelcode"); // En en string van todos los campos de + + // subqueries + SubQuery subquery = new SubQuery("TgeneMenuSubLevel", "presentationorder", "presentationorder", + "i.pk.menucode = t.pk.menucode and i.pk.levelcode = t.pk.levelcode and i.pk.sublevel = t.pk.sublevel"); + dto.addSubQuery(subquery); + + // subqueries 1 + SubQuery subquery1 = new SubQuery("TgeneMenuLevelDesc", "description", "leveldescription", + "i.pk.menucode = t.pk.menucode and i.pk.levelcode = t.pk.levelcode and i.pk.languagecode = t.pk.languagecode"); + dto.addSubQuery(subquery1); + + // subqueries 2 + SubQuery subquery2 = new SubQuery("TgeneMenu", "description", "menudesc", + "i.pk = t.pk.menucode"); + dto.addSubQuery(subquery2); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (this.genemenu == null) { + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + if(this.genemenulevel==null){ + MessageHelper.setMessageError("msg_menuLevelRequired"); + return; + } + super.create(); + this.record.put("menudesc", this.genemenu.getDescription()); + this.record.put("leveldescription", this.genemenulevel.getDescription()); + this.record.getPk().setMenucode(this.genemenulevel.getPk().getMenucode()); + this.record.getPk().setLevelcode(this.genemenulevel.getPk().getLevelcode()); + this.record.getPk().setSublevel(this.sublevelcode++); + this.record.getPk().setLanguagecode(this.getLoginController().getRequest().getLanguage()); + System.out.println("RECORDDDDDDDDDDDD "+this.record); + } + + + /** + * Entrega el objeto TgeneMenuLevelDesc + * @return genemenulevel + */ + public TgeneMenuLevelDesc getGenemenulevel() { + return genemenulevel; + } + + /** + * Fija el objeto TgeneMenuLevelDesc + * @param genemenulevel + */ + public void setGenemenulevel(TgeneMenuLevelDesc genemenulevel) { + this.genemenulevel = genemenulevel; + } + + /** + * Entrega el objeto SubLevelController + * @return subLevel + */ + public SubLevelController getSubLevel() { + return subLevel; + } + + /** + * Fija el objeto SubLevelController + * @param subLevel + */ + public void setSubLevel(SubLevelController subLevel) { + this.subLevel = subLevel; + } + + + public TgeneMenu getGenemenu() { + return genemenu; + } + + /** + * Entrega el objeto TgeneMenu + * @return genemenu + */ + public void setGenemenu(TgeneMenu genemenu) { + this.genemenu = genemenu; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/LevelController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/LevelController.java new file mode 100644 index 0000000..df02e50 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/LevelController.java @@ -0,0 +1,90 @@ +package com.fp.frontend.controller.pgeneral.menu; + +import java.math.BigDecimal; +import java.util.ArrayList; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevel; + +/** + * Clase controladora del bean TgeneMenuLevel. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class LevelController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public LevelController() throws Exception { + super(TgeneMenuLevel.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEMENULEVEL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + MessageHelper.setMessageError("msg_notQuery"); + } + + @Override + public void save() { + MessageHelper.setMessageError("msg_notSave"); + } + + /** + * Obtiene el codigo del levelcode + */ + public Integer getLevelCode(Integer menucode) { + Integer levelcode = null; + try { + Request request = this.callerhelper.getRequest(); + request.put("queryalias", "EXECUTESQL"); + request.put("querytype", "P"); + request.put("isUniqueResult", "Y"); + request.put("sql", "select coalesce(max(LEVELCODE), 0)+1 from TGENEMENULEVEL where MENUCODE = " + menucode); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + levelcode = null; + MessageHelper.setMessageError(resp); + } else { + levelcode = ((BigDecimal) resp.get("result")).intValue(); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + return levelcode; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/LevelDescController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/LevelDescController.java new file mode 100644 index 0000000..f129af3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/LevelDescController.java @@ -0,0 +1,208 @@ +package com.fp.frontend.controller.pgeneral.menu; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenu; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelDesc; + +/** + * Clase controladora del bean TgeneMenuLevelDesc. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class LevelDescController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public LevelDescController() throws Exception { + super(TgeneMenuLevelDesc.class); + } + + @ManagedProperty(value = "#{levelController}") + private LevelController level; + + /** + * Atributo para el objeto TgeneMenu + */ + private TgeneMenu genemenu; + /** + * Atributo para el codigo levelcode + */ + private Integer levelcode; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.genemenu = null; + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEMENULEVELDESC"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Inicializa las paginas en la consulta + */ + public void initRecPage() { + this.page = 0; + this.recperpage = 10; + this.levelcode = this.level.getLevelCode(this.genemenu.getPk()); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + //Filtros + this.getMfilters().put("pk.menucode", this.genemenu != null ? this.genemenu.getPk().toString() : null); + this.getMfilters().put("pk.languagecode", this.getLoginController().getRequest().getLanguage()); + + if (super.getMfilters().get("pk.menucode") == null) { + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.levelcode"); // En en string van todos los campos de + + // subqueries 1 + SubQuery subquery = new SubQuery("TgeneMenuLevel", "presentationorder", "presentationorder", + "i.pk.menucode = t.pk.menucode and i.pk.levelcode = t.pk.levelcode"); + dto.addSubQuery(subquery); + + // subqueries 2 + SubQuery subquery1 = new SubQuery("TgeneMenu", "description", "menudesc", + "i.pk = t.pk.menucode"); + dto.addSubQuery(subquery1); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.menucode") == null) { + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + super.create(); + this.record.put("menudesc", this.genemenu.getDescription()); + this.record.getPk().setMenucode(this.genemenu.getPk()); + this.record.getPk().setLevelcode(this.levelcode++); + this.record.getPk().setLanguagecode(this.getLoginController().getRequest().getLanguage()); + } + + /** + * Entrega el objeto TgeneMenu + * + * @return genemenu + */ + public TgeneMenu getGenemenu() { + return genemenu; + } + + /** + * Fija el objeto TgeneMenu + * + * @param genemenu + */ + public void setGenemenu(TgeneMenu genemenu) { + this.genemenu = genemenu; + } + + /** + * Entrega el valor de level + * + * @return level + */ + public LevelController getLevel() { + return level; + } + + /** + * Fija el valor de level + * + * @param level + */ + public void setLevel(LevelController level) { + this.level = level; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/MenuController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/MenuController.java new file mode 100644 index 0000000..650ec16 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/MenuController.java @@ -0,0 +1,559 @@ +package com.fp.frontend.controller.pgeneral.menu; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.lov.LevelLovController; +import com.fp.frontend.controller.pgeneral.lov.SubLevelLovController; +import com.fp.frontend.controller.pgeneral.lov.TransactionLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.menu.TgeneMenu; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelDesc; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelTran; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelDesc; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelTran; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * Clase controladora del bean TgeneMenu. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class MenuController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public MenuController() throws Exception { + super(TgeneMenu.class); + } + + @ManagedProperty(value = "#{levelDescController}") + private LevelDescController levelDesc; + + @ManagedProperty(value = "#{levelController}") + private LevelController level; + + @ManagedProperty(value = "#{subLevelDescController}") + private SubLevelDescController subLevelDesc; + + @ManagedProperty(value = "#{subLevelController}") + private SubLevelController subLevel; + + @ManagedProperty(value = "#{menuLevelTranController}") + private MenuLevelTranController levelTran; + + @ManagedProperty(value = "#{menuSubLevelTranController}") + private MenuSubLevelTranController subLevelTran; + + private TgeneMenuLevelDesc menuleveldesc; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + // Consulta + this.querydatabase(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.menuleveldesc = null; + this.recperpage = 4; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEMENU"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void update() { + try { + //Menu level + this.levelDesc.setGenemenu(this.record); + this.levelDesc.initRecPage(); + this.levelDesc.setLrecord(new ArrayList()); + + //Menu Sublevel + super.getMfilelds().put("pk.levelcode", null); + super.getMfilelds().put("leveldescription", null); + this.subLevelDesc.setGenemenu(this.record); + this.subLevelDesc.setLrecord(new ArrayList()); + + //Menu levelTran + super.getMfilelds().put("pk.levelcodetran", null); + super.getMfilelds().put("leveldescriptiontran", null); + this.levelTran.setGenemenu(this.record); + this.levelTran.setLrecord(new ArrayList()); + + //Menu levelTran + this.menuleveldesc = null; + super.getMfilelds().put("pk.levelcodesubtran", null); + super.getMfilelds().put("leveldescriptionsubtran", null); + super.getMfilelds().put("pk.sublevelcodesubtran", null); + super.getMfilelds().put("subLeveldescriptionsubtran", null); + this.subLevelTran.setGenemenu(this.record); + this.subLevelTran.setLrecord(new ArrayList()); + + super.update(); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + boolean parentSave = true; + Request request = this.callerhelper.getRequest(); + //Dto Menu + DtoSave dtosave = super.getDtoSave(); + //Dto Menu Level Desc + DtoSave dtosaveleveldesc = this.levelDesc.getDtoSave(); + //Dto Menu Level + DtoSave dtosavelevel = this.level.getDtoSave(); + //Dto Menu SubLevel Desc + DtoSave dtosavesubleveldesc = this.subLevelDesc.getDtoSave(); + //Dto Menu SubLevel + DtoSave dtosavesublevel = this.subLevel.getDtoSave(); + //Dto Menu Level Tran + DtoSave dtosaveleveltran = this.levelTran.getDtoSave(); + //Dto Menu SubLevel Tran + DtoSave dtosavesubleveltran = this.subLevelTran.getDtoSave(); + + // if(!dtosave.pendingProcess() && !dtosaveleveldesc.pendingProcess() && !dtosavesubleveldesc.pendingProcess() && !dtosaveleveltran.pendingProcess() && !dtosavesubleveltran.pendingProcess()){ + // return; + // } + HashMap msave = new HashMap(); + + if (dtosave.pendingProcess()) { + msave.put(this.beanalias, dtosave); + parentSave = false; + } + if (parentSave) { + if (dtosaveleveldesc.pendingProcess()) { + msave.put(this.levelDesc.getBeanalias(), dtosaveleveldesc); + msave.put(this.level.getBeanalias(), dtosavelevel); + } + if (dtosavesubleveldesc.pendingProcess()) { + msave.put(this.subLevelDesc.getBeanalias(), dtosavesubleveldesc); + msave.put(this.subLevel.getBeanalias(), dtosavesublevel); + } + if (dtosaveleveltran.pendingProcess()) { + msave.put(this.levelTran.getBeanalias(), dtosaveleveltran); + } + if (dtosavesubleveltran.pendingProcess()) { + msave.put(this.subLevelTran.getBeanalias(), dtosavesubleveltran); + } + } + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + if (!parentSave) { + this.save(); + } else { + this.levelDesc.postCommit(resp); + this.subLevelDesc.postCommit(resp); + this.levelTran.postCommit(resp); + this.subLevelTran.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void generateQuery(TgeneMenu tgenemenu) throws Exception { + this.record = tgenemenu; + this.generateQuery(); + } + + /** + * Método que ejecuta el evento de seleccion del menu + * + * @throws Exception + */ + public void generateQuery() throws Exception { + + //Menu level + this.levelDesc.setGenemenu(this.record); + this.levelDesc.initRecPage(); + this.levelDesc.query(); + + //Menu Sublevel + super.getMfilelds().put("pk.levelcode", null); + super.getMfilelds().put("leveldescription", null); + this.subLevelDesc.setGenemenu(this.record); + this.subLevelDesc.setLrecord(new ArrayList()); + + //Menu levelTran + super.getMfilelds().put("pk.levelcodetran", null); + super.getMfilelds().put("leveldescriptiontran", null); + this.levelTran.setGenemenu(this.record); + this.levelTran.setLrecord(new ArrayList()); + + //Menu levelTran + this.menuleveldesc = null; + super.getMfilelds().put("pk.levelcodesubtran", null); + super.getMfilelds().put("leveldescriptionsubtran", null); + super.getMfilelds().put("pk.sublevelcodesubtran", null); + super.getMfilelds().put("subLeveldescriptionsubtran", null); + this.subLevelTran.setGenemenu(this.record); + this.subLevelTran.setLrecord(new ArrayList()); + } + + /** + * Entrega una lista de objetos TgeneMenu + * + * @return lrecord Lista de objetos TgeneMenu + */ + public static List find() { + try { + MenuController cc = new MenuController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Encuentra por el id de TgeneMenu + * + * @param id + * @return + */ + public static TgeneMenu findPerfil(Integer id) { + try { + if (id == null || id == 0) { + return null; + } + MenuController cc = new MenuController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk", id.toString()); + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord.get(0); + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + /** + * Llama al Lov MenuLevel + */ + public void openMenuLevelLov() { + if (this.record == null) { + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + List values = new ArrayList(); + values.add(this.record.getPk().toString()); + Map> params = new HashMap<>(); + params.put("pk.menucode", values); + LevelLovController.openLov(params); + } + + /** + * Llama al Lov MenuSubLevel + */ + public void openMenuSubLevelLov() { + if (this.record == null) { + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + if (this.menuleveldesc == null) { + MessageHelper.setMessageError("msg_menuLevelRequired"); + return; + } + List menucode = new ArrayList(); + List levelcode = new ArrayList(); + menucode.add(this.menuleveldesc.getPk().getMenucode().toString()); + levelcode.add(this.menuleveldesc.getPk().getLevelcode().toString()); + Map> params = new HashMap<>(); + params.put("pk.menucode", menucode); + params.put("pk.levelcode", levelcode); + SubLevelLovController.openLov(params); + } + + /** + * Gestiona la respuesta del Lov MenuLevel + * + * @param event + * @throws Exception + */ + public void onReturnMenuLevelLov(SelectEvent event) throws Exception { + TgeneMenuLevelDesc t = (TgeneMenuLevelDesc) event.getObject(); + super.addField("pk.levelcode", t.getPk().getLevelcode().toString()); + super.addField("leveldescription", t.getDescription()); + this.subLevelDesc.setGenemenulevel(t); + this.subLevelDesc.initRecPage(); + this.subLevelDesc.query(); + } + + /** + * Gestiona la respuesta del Lov MenuLevel para transacciones por nivel + * + * @param event + * @throws Exception + */ + public void onReturnMenuLevelTranLov(SelectEvent event) throws Exception { + TgeneMenuLevelDesc t = (TgeneMenuLevelDesc) event.getObject(); + super.addField("pk.levelcodetran", t.getPk().getLevelcode().toString()); + super.addField("leveldescriptiontran", t.getDescription()); + this.levelTran.setGenemenulevel(t); + this.levelTran.initRecPage(); + this.levelTran.query(); + } + + /** + * Gestiona la respuesta del Lov MenuLevel para transacciones por subnivel + * + * @param event + * @throws Exception + */ + public void onReturnMenuLevelTran2Lov(SelectEvent event) throws Exception { + TgeneMenuLevelDesc t = (TgeneMenuLevelDesc) event.getObject(); + this.menuleveldesc = t; + super.addField("pk.levelcodesubtran", t.getPk().getLevelcode().toString()); + super.addField("leveldescriptionsubtran", t.getDescription()); + super.addField("pk.sublevelcodesubtran", null);// + super.addField("subLeveldescriptionsubtran", null);// + this.subLevelTran.setLrecord(null); + this.subLevelTran.setGenemenulevel(t); + } + + /** + * Gestiona la respuesta del Lov MenuLevel + * + * @param event + * @throws Exception + */ + public void onReturnMenuSubLevelLov(SelectEvent event) throws Exception { + TgeneMenuSubLevelDesc t = (TgeneMenuSubLevelDesc) event.getObject(); + super.addField("pk.sublevelcodesubtran", t.getPk().getSublevel().toString()); + super.addField("subLeveldescriptionsubtran", t.getDescription()); + this.subLevelTran.setGenemenusublevel(t); + this.subLevelTran.initRecPage(); + this.subLevelTran.query(); + } + + /** + * Abre el lov de transacciones + */ + public void openTransactionLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("TRANSACTION"); // valor del parametro + params.put("processtype", l); + + TransactionLovController.openLov(params); + } + + /** + * Gestiona la respuesta del lov + * + * @param event + * @throws Exception + */ + public void onReturnTransactionLov(SelectEvent event) throws Exception { + TgeneTransaction t = (TgeneTransaction) event.getObject(); + this.levelTran.getRecord().getPk().setTransactionmodule(t.getPk().getTransactionmodule()); + this.levelTran.getRecord().getPk().setTransactioncode(t.getPk().getTransactioncode()); + this.levelTran.getRecord().getPk().setTransactionversion(t.getPk().getTransactionversion()); + this.levelTran.getRecord().put("name", t.getName()); + } + + /** + * Gestiona la respuesta del lov para el subnivel + * + * @param event + * @throws Exception + */ + public void onReturnSubTransactionLov(SelectEvent event) throws Exception { + TgeneTransaction t = (TgeneTransaction) event.getObject(); + this.subLevelTran.getRecord().getPk().setTransactionmodule(t.getPk().getTransactionmodule()); + this.subLevelTran.getRecord().getPk().setTransactioncode(t.getPk().getTransactioncode()); + this.subLevelTran.getRecord().getPk().setTransactionversion(t.getPk().getTransactionversion()); + this.subLevelTran.getRecord().put("name", t.getName()); + } + + /** + * Entrega el valor de levelDesc + * + * @return levelDesc + */ + public LevelDescController getLevelDesc() { + return levelDesc; + } + + /** + * Fija el valor de levelDesc + * + * @param levelDesc + */ + public void setLevelDesc(LevelDescController levelDesc) { + this.levelDesc = levelDesc; + } + + /** + * Entrega el valor de level + * + * @return level + */ + public LevelController getLevel() { + return level; + } + + /** + * Fija el valor de level + * + * @param level + */ + public void setLevel(LevelController level) { + this.level = level; + } + + /** + * Entrega el valor de subLevelDesc + * + * @return subLevelDesc + */ + public SubLevelDescController getSubLevelDesc() { + return subLevelDesc; + } + + /** + * Fija el valor de subLevelDesc + * + * @param subLevelDesc + */ + public void setSubLevelDesc(SubLevelDescController subLevelDesc) { + this.subLevelDesc = subLevelDesc; + } + + /** + * Entrega el valor de menuLevel + * + * @return menuLevel + */ + public MenuLevelTranController getLevelTran() { + return levelTran; + } + + /** + * Fija el valor de menuLevel + * + * @param menuLevel + */ + public void setLevelTran(MenuLevelTranController levelTran) { + this.levelTran = levelTran; + } + + /** + * Entrega el valor de subLevelTran + * + * @return subLevelTran + */ + public MenuSubLevelTranController getSubLevelTran() { + return subLevelTran; + } + + /** + * Fija el valor de subLevelTran + * + * @param subLevelTran + */ + public void setSubLevelTran(MenuSubLevelTranController subLevelTran) { + this.subLevelTran = subLevelTran; + } + + /** + * Entrega el valor de subLevel + * + * @return subLevel + */ + public SubLevelController getSubLevel() { + return subLevel; + } + + /** + * Fija el valor de subLevel + * + * @param subLevel + */ + public void setSubLevel(SubLevelController subLevel) { + this.subLevel = subLevel; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/MenuLevelTranController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/MenuLevelTranController.java new file mode 100644 index 0000000..0a57389 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/MenuLevelTranController.java @@ -0,0 +1,221 @@ +package com.fp.frontend.controller.pgeneral.menu; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenu; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelDesc; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelTran; + +/** + * Clase controladora del bean TgeneMenuLevelTran. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class MenuLevelTranController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public MenuLevelTranController() throws Exception { + super(TgeneMenuLevelTran.class); + } + + /** + * Atributo para el objeto TgeneMenu + */ + private TgeneMenu genemenu; + + /** + * Atributo para el objeto TgeneMenu + */ + private TgeneMenuLevelDesc genemenulevel; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.genemenu = null; + this.genemenulevel = null; + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEMENULEVELTRAN"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Inicializa las paginas en la consulta + */ + public void initRecPage() { + this.page = 0; + this.recperpage = 10; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + //Filtros + this.getMfilters().put("pk.menucode", this.genemenu != null ? this.genemenu.getPk().toString() : null); + this.getMfilters().put("pk.levelcode", this.genemenulevel != null ? this.genemenulevel.getPk().getLevelcode().toString() : null); + + if (super.getMfilters().get("pk.menucode") == null) { + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + if (super.getMfilters().get("pk.levelcode") == null) { + MessageHelper.setMessageError("msg_menuLevelRequired"); + return; + } + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.presentationorder"); // En en string van todos los campos de + + // subqueries + SubQuery subquery = new SubQuery("TgeneTransaction", "name", "name", + "i.pk.transactionmodule = t.pk.transactionmodule and " + + "i.pk.transactioncode = t.pk.transactioncode and " + + "i.pk.transactionversion = t.pk.transactionversion"); + dto.addSubQuery(subquery); + + // subqueries 1 + SubQuery subquery1 = new SubQuery("TgeneMenuLevelDesc", "description", "leveldescription", + "i.pk.menucode = t.pk.menucode and i.pk.levelcode = t.pk.levelcode and i.pk.languagecode = '" + this.getLoginController().getRequest().getLanguage() + "'"); + dto.addSubQuery(subquery1); + + // subqueries 2 + SubQuery subquery2 = new SubQuery("TgeneMenu", "description", "menudesc", + "i.pk = t.pk.menucode"); + dto.addSubQuery(subquery2); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (this.genemenu == null) { + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + if (this.genemenulevel == null) { + MessageHelper.setMessageError("msg_menuLevelRequired"); + return; + } + super.create(); + System.out.println("REGISTRO " + this.record); + this.record.put("menudesc", this.genemenu.getDescription()); + this.record.put("leveldescription", this.genemenulevel.getDescription()); + this.record.getPk().setMenucode(this.genemenulevel.getPk().getMenucode()); + this.record.getPk().setLevelcode(this.genemenulevel.getPk().getLevelcode()); + } + + /** + * Entrega el objeto TgeneMenuLevelDesc + * + * @return genemenulevel + */ + public TgeneMenuLevelDesc getGenemenulevel() { + return genemenulevel; + } + + /** + * Fija el objeto TgeneMenuLevelDesc + * + * @param genemenulevel + */ + public void setGenemenulevel(TgeneMenuLevelDesc genemenulevel) { + this.genemenulevel = genemenulevel; + } + + /** + * Entrega el objeto TgeneMenu + * + * @return genemenu + */ + public TgeneMenu getGenemenu() { + return genemenu; + } + + /** + * Entrega el objeto TgeneMenu + * + * @return genemenu + */ + public void setGenemenu(TgeneMenu genemenu) { + this.genemenu = genemenu; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/MenuSubLevelTranController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/MenuSubLevelTranController.java new file mode 100644 index 0000000..a8cecd8 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/MenuSubLevelTranController.java @@ -0,0 +1,263 @@ +package com.fp.frontend.controller.pgeneral.menu; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenu; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelDesc; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelDesc; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelTran; + +/** + * Clase controladora del bean TgeneMenuSubLevelTran. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class MenuSubLevelTranController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public MenuSubLevelTranController() throws Exception { + super(TgeneMenuSubLevelTran.class); + } + + /** + * Atributo para el objeto TgeneMenu + */ + private TgeneMenu genemenu; + + /** + * Atributo para el objeto TgeneMenu + */ + private TgeneMenuLevelDesc genemenulevel; + + /** + * Atributo para el objeto TgeneMenuSubLevelDesc + */ + private TgeneMenuSubLevelDesc genemenusublevel; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.genemenu = null; + this.genemenulevel = null; + this.genemenusublevel = null; + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEMENUSUBLEVELTRAN"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Inicializa las paginas en la consulta + */ + public void initRecPage() { + this.page = 0; + this.recperpage = 10; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + //Filtros + this.getMfilters().put("pk.menucode", this.genemenu != null ? this.genemenu.getPk().toString() : null); + this.getMfilters().put("pk.levelcode", this.genemenulevel != null ? this.genemenulevel.getPk().getLevelcode().toString() : null); + this.getMfilters().put("pk.sublevel", this.genemenusublevel != null ? this.genemenusublevel.getPk().getSublevel().toString() : null); + + if (super.getMfilters().get("pk.menucode") == null) { + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + if (super.getMfilters().get("pk.levelcode") == null) { + MessageHelper.setMessageError("msg_menuLevelRequired"); + return; + } + if (super.getMfilters().get("pk.sublevel") == null) { + MessageHelper.setMessageError("msg_menuSubLevelRequired"); + return; + } + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.presentationorder"); // En en string van todos los campos de + + // subqueries + SubQuery subquery = new SubQuery("TgeneTransaction", "name", "name", + "i.pk.transactionmodule = t.pk.transactionmodule and " + + "i.pk.transactioncode = t.pk.transactioncode and " + + "i.pk.transactionversion = t.pk.transactionversion"); + dto.addSubQuery(subquery); + + // subqueries 1 + SubQuery subquery1 = new SubQuery("TgeneMenuLevelDesc", "description", "leveldescription", + "i.pk.menucode = t.pk.menucode and i.pk.levelcode = t.pk.levelcode and i.pk.languagecode = '" + this.getLoginController().getRequest().getLanguage() + "'"); + dto.addSubQuery(subquery1); + + // subqueries 2 + SubQuery subquery2 = new SubQuery("TgeneMenuSubLevelDesc", "description", "subleveldescription", + "i.pk.menucode = t.pk.menucode and i.pk.levelcode = t.pk.levelcode and i.pk.sublevel = t.pk.sublevel and i.pk.languagecode = '" + this.getLoginController().getRequest().getLanguage() + "'"); + dto.addSubQuery(subquery2); + + // subqueries 3 + SubQuery subquery3 = new SubQuery("TgeneMenu", "description", "menudesc", + "i.pk = t.pk.menucode"); + dto.addSubQuery(subquery3); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (this.genemenu == null) { + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + if (this.genemenulevel == null) { + MessageHelper.setMessageError("msg_menuLevelRequired"); + return; + } + if (this.genemenusublevel == null) { + MessageHelper.setMessageError("msg_menuSubLevelRequired"); + return; + } + super.create(); + System.out.println("REGISTRO " + this.record); + this.record.put("menudesc", this.genemenu.getDescription()); + this.record.put("leveldescription", this.genemenulevel.getDescription()); + this.record.put("subleveldescription", this.genemenusublevel.getDescription()); + this.record.getPk().setMenucode(this.genemenusublevel.getPk().getMenucode()); + this.record.getPk().setLevelcode(this.genemenusublevel.getPk().getLevelcode()); + this.record.getPk().setSublevel(this.genemenusublevel.getPk().getSublevel()); + } + + /** + * Entrega el objeto TgeneMenuLevelDesc + * + * @return genemenulevel + */ + public TgeneMenuLevelDesc getGenemenulevel() { + return genemenulevel; + } + + /** + * Fija el objeto TgeneMenuLevelDesc + * + * @param genemenulevel + */ + public void setGenemenulevel(TgeneMenuLevelDesc genemenulevel) { + this.genemenulevel = genemenulevel; + } + + /** + * Entrega el objeto TgeneMenu + * + * @return genemenu + */ + public TgeneMenu getGenemenu() { + return genemenu; + } + + /** + * Fija el objeto TgeneMenu + * + * @param genemenu + */ + public void setGenemenu(TgeneMenu genemenu) { + this.genemenu = genemenu; + } + + /** + * Entrega el objeto TgeneMenuSubLevelDesc + * + * @return genemenusublevel + */ + public TgeneMenuSubLevelDesc getGenemenusublevel() { + return genemenusublevel; + } + + /** + * Fija el objeto TgeneMenuSubLevelDesc + * + * @param genemenusublevel + */ + public void setGenemenusublevel(TgeneMenuSubLevelDesc genemenusublevel) { + this.genemenusublevel = genemenusublevel; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/SubLevelController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/SubLevelController.java new file mode 100644 index 0000000..19b263d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/SubLevelController.java @@ -0,0 +1,90 @@ +package com.fp.frontend.controller.pgeneral.menu; + +import java.math.BigDecimal; +import java.util.ArrayList; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevel; + +/** + * Clase controladora del bean TgeneMenuLevel. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class SubLevelController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public SubLevelController() throws Exception { + super(TgeneMenuSubLevel.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEMENUSUBLEVEL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + MessageHelper.setMessageError("msg_notQuery"); + } + + @Override + public void save() { + MessageHelper.setMessageError("msg_notSave"); + } + + /** + * Obtiene el codigo del levelcode + */ + public Integer getSubLevelCode(Integer menucode, Integer levelcode) { + Integer sublevelcode = null; + try { + Request request = this.callerhelper.getRequest(); + request.put("queryalias", "EXECUTESQL"); + request.put("querytype", "P"); + request.put("isUniqueResult", "Y"); + request.put("sql", "select coalesce(max(SUBLEVEL), 0)+1 from TGENEMENUSUBLEVEL where MENUCODE = " + menucode + " and LEVELCODE = " + levelcode); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + sublevelcode = null; + MessageHelper.setMessageError(resp); + } else { + sublevelcode = ((BigDecimal) resp.get("result")).intValue(); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + return sublevelcode; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/SubLevelDescController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/SubLevelDescController.java new file mode 100644 index 0000000..880525c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/menu/SubLevelDescController.java @@ -0,0 +1,245 @@ +package com.fp.frontend.controller.pgeneral.menu; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenu; +import com.fp.persistence.pgeneral.menu.TgeneMenuLevelDesc; +import com.fp.persistence.pgeneral.menu.TgeneMenuSubLevelDesc; + +/** + * Clase controladora del bean TgeneMenuSubLevelDesc. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class SubLevelDescController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public SubLevelDescController() throws Exception { + super(TgeneMenuSubLevelDesc.class); + } + + @ManagedProperty(value = "#{subLevelController}") + private SubLevelController subLevel; + + /** + * Atributo para el objeto TgeneMenu + */ + private TgeneMenu genemenu; + + /** + * Atributo para el objeto TgeneMenu + */ + private TgeneMenuLevelDesc genemenulevel; + + /** + * Atributo para el codigo de subnivel + */ + private Integer sublevelcode; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.genemenu = null; + this.genemenulevel = null; + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEMENUSUBLEVELDESC"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Inicializa las paginas en la consulta + */ + public void initRecPage() { + this.page = 0; + this.recperpage = 10; + this.sublevelcode = this.subLevel.getSubLevelCode(this.genemenulevel.getPk().getMenucode(), this.genemenulevel.getPk().getLevelcode()); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + //Filtros + this.getMfilters().put("pk.menucode", this.genemenu != null ? this.genemenu.getPk().toString() : null); + this.getMfilters().put("pk.levelcode", this.genemenulevel != null ? this.genemenulevel.getPk().getLevelcode().toString() : null); + this.getMfilters().put("pk.languagecode", this.getLoginController().getRequest().getLanguage()); + + if (super.getMfilters().get("pk.menucode") == null) { + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + if (super.getMfilters().get("pk.levelcode") == null) { + MessageHelper.setMessageError("msg_menuLevelRequired"); + return; + } + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.levelcode"); // En en string van todos los campos de + + // subqueries + SubQuery subquery = new SubQuery("TgeneMenuSubLevel", "presentationorder", "presentationorder", + "i.pk.menucode = t.pk.menucode and i.pk.levelcode = t.pk.levelcode and i.pk.sublevel = t.pk.sublevel"); + dto.addSubQuery(subquery); + + // subqueries 1 + SubQuery subquery1 = new SubQuery("TgeneMenuLevelDesc", "description", "leveldescription", + "i.pk.menucode = t.pk.menucode and i.pk.levelcode = t.pk.levelcode and i.pk.languagecode = t.pk.languagecode"); + dto.addSubQuery(subquery1); + + // subqueries 2 + SubQuery subquery2 = new SubQuery("TgeneMenu", "description", "menudesc", + "i.pk = t.pk.menucode"); + dto.addSubQuery(subquery2); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (this.genemenu == null) { + MessageHelper.setMessageError("msg_menucodeRequired"); + return; + } + if (this.genemenulevel == null) { + MessageHelper.setMessageError("msg_menuLevelRequired"); + return; + } + super.create(); + this.record.put("menudesc", this.genemenu.getDescription()); + this.record.put("leveldescription", this.genemenulevel.getDescription()); + this.record.getPk().setMenucode(this.genemenulevel.getPk().getMenucode()); + this.record.getPk().setLevelcode(this.genemenulevel.getPk().getLevelcode()); + this.record.getPk().setSublevel(this.sublevelcode++); + this.record.getPk().setLanguagecode(this.getLoginController().getRequest().getLanguage()); + System.out.println("RECORDDDDDDDDDDDD " + this.record); + } + + /** + * Entrega el objeto TgeneMenuLevelDesc + * + * @return genemenulevel + */ + public TgeneMenuLevelDesc getGenemenulevel() { + return genemenulevel; + } + + /** + * Fija el objeto TgeneMenuLevelDesc + * + * @param genemenulevel + */ + public void setGenemenulevel(TgeneMenuLevelDesc genemenulevel) { + this.genemenulevel = genemenulevel; + } + + /** + * Entrega el objeto SubLevelController + * + * @return subLevel + */ + public SubLevelController getSubLevel() { + return subLevel; + } + + /** + * Fija el objeto SubLevelController + * + * @param subLevel + */ + public void setSubLevel(SubLevelController subLevel) { + this.subLevel = subLevel; + } + + public TgeneMenu getGenemenu() { + return genemenu; + } + + /** + * Entrega el objeto TgeneMenu + * + * @return genemenu + */ + public void setGenemenu(TgeneMenu genemenu) { + this.genemenu = genemenu; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/message/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/message/.svn/entries new file mode 100644 index 0000000..ae337a8 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/message/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/pgeneral/message +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +MessageTemplatesDescController.java +file + + + + +2022-07-28T03:39:55.312598Z +b8c1ff9e5f400755255fd2d2acdeb7c7 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +5025 + +MessageTemplatesController.java +file + + + + +2022-07-28T03:39:55.312598Z +7543857643bc3c243dd2f78851f6025a +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3925 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/message/.svn/text-base/MessageTemplatesController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/message/.svn/text-base/MessageTemplatesController.java.svn-base new file mode 100644 index 0000000..8291b7b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/message/.svn/text-base/MessageTemplatesController.java.svn-base @@ -0,0 +1,145 @@ +package com.fp.frontend.controller.pgeneral.message; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplates; + +/** + * Clase controladora del bean TgeneMessageTemplates. + * + * @author Andres E Carpio. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class MessageTemplatesController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public MessageTemplatesController() throws Exception { + super(TgeneMessageTemplates.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "MESSAGETEMPLATE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = new DtoQuery(this.classType.getName(), this.page, this.recperpage, true, + super.getMfilters()); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public static List find() { + try { + MessageTemplatesController cc = new MessageTemplatesController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/message/.svn/text-base/MessageTemplatesDescController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/message/.svn/text-base/MessageTemplatesDescController.java.svn-base new file mode 100644 index 0000000..e06231b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/message/.svn/text-base/MessageTemplatesDescController.java.svn-base @@ -0,0 +1,177 @@ +package com.fp.frontend.controller.pgeneral.message; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.LanguageController; +import com.fp.frontend.controller.pgeneral.lov.MessageTemplatesLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneLanguage; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplates; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDesc; + +/** + * Clase controladora del bean TgeneMessageTemplatesDesc. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class MessageTemplatesDescController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public MessageTemplatesDescController() throws Exception { + super(TgeneMessageTemplatesDesc.class); + } + + /** + * Atributo para la lista de lenguajes + */ + private List lLanguage; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //Lista + this.lLanguage = LanguageController.find(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "MESSAGETEMPLATESDESC"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.code"); + + // subqueries 1 + SubQuery subquery = new SubQuery("TgeneMessageTemplates", "description", "messagedescription", + "i.pk = t.pk.code"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void update() throws Exception{ + if(this.record.getPk().getCode()==null){ + MessageHelper.setMessageError("msg_messageRequired"); + return; + } + super.update(); + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Llama al Lov de mensajes + */ + public void openMessageLov() { + Map> params = new HashMap<>(); + MessageTemplatesLovController.openLov(params); + } + + /** + * Gestiona respuesta del lov de mensajes + * @param event + * @throws Exception + */ + public void onReturnMessageNewLov(SelectEvent event) throws Exception { + TgeneMessageTemplates t = (TgeneMessageTemplates) event.getObject(); + this.record.getPk().setCode(t.getPk()); + this.record.put("messagedescription", t.getDescription()); + } + + /** + * Entrega una lista de objetos TgeneLanguage + * @return lLanguage + */ + public List getlLanguage() { + return lLanguage; + } + + /** + * Fija una lista de objetos TgeneLanguage + * @param lLanguage + */ + public void setlLanguage(List lLanguage) { + this.lLanguage = lLanguage; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/message/MessageTemplatesController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/message/MessageTemplatesController.java new file mode 100644 index 0000000..e9890dd --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/message/MessageTemplatesController.java @@ -0,0 +1,145 @@ +package com.fp.frontend.controller.pgeneral.message; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplates; + +/** + * Clase controladora del bean TgeneMessageTemplates. + * + * @author Andres E Carpio. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class MessageTemplatesController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public MessageTemplatesController() throws Exception { + super(TgeneMessageTemplates.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "MESSAGETEMPLATE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = new DtoQuery(this.classType.getName(), this.page, this.recperpage, true, + super.getMfilters()); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los + // registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public static List find() { + try { + MessageTemplatesController cc = new MessageTemplatesController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/message/MessageTemplatesDescController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/message/MessageTemplatesDescController.java new file mode 100644 index 0000000..de513c8 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/message/MessageTemplatesDescController.java @@ -0,0 +1,180 @@ +package com.fp.frontend.controller.pgeneral.message; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.LanguageController; +import com.fp.frontend.controller.pgeneral.lov.MessageTemplatesLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneLanguage; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplates; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDesc; + +/** + * Clase controladora del bean TgeneMessageTemplatesDesc. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class MessageTemplatesDescController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public MessageTemplatesDescController() throws Exception { + super(TgeneMessageTemplatesDesc.class); + } + + /** + * Atributo para la lista de lenguajes + */ + private List lLanguage; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //Lista + this.lLanguage = LanguageController.find(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "MESSAGETEMPLATESDESC"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.code"); + + // subqueries 1 + SubQuery subquery = new SubQuery("TgeneMessageTemplates", "description", "messagedescription", + "i.pk = t.pk.code"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void update() throws Exception { + if (this.record.getPk().getCode() == null) { + MessageHelper.setMessageError("msg_messageRequired"); + return; + } + super.update(); + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Llama al Lov de mensajes + */ + public void openMessageLov() { + Map> params = new HashMap<>(); + MessageTemplatesLovController.openLov(params); + } + + /** + * Gestiona respuesta del lov de mensajes + * + * @param event + * @throws Exception + */ + public void onReturnMessageNewLov(SelectEvent event) throws Exception { + TgeneMessageTemplates t = (TgeneMessageTemplates) event.getObject(); + this.record.getPk().setCode(t.getPk()); + this.record.put("messagedescription", t.getDescription()); + } + + /** + * Entrega una lista de objetos TgeneLanguage + * + * @return lLanguage + */ + public List getlLanguage() { + return lLanguage; + } + + /** + * Fija una lista de objetos TgeneLanguage + * + * @param lLanguage + */ + public void setlLanguage(List lLanguage) { + this.lLanguage = lLanguage; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/proc/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/proc/.svn/entries new file mode 100644 index 0000000..783a288 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/proc/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/pgeneral/proc +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ProcessController.java +file + + + + +2022-07-28T03:39:55.116597Z +e1bcb9e0c050a4a12fd4b37315f12f68 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3886 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/proc/.svn/text-base/ProcessController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/proc/.svn/text-base/ProcessController.java.svn-base new file mode 100644 index 0000000..28b1bfe --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/proc/.svn/text-base/ProcessController.java.svn-base @@ -0,0 +1,141 @@ +package com.fp.frontend.controller.pgeneral.proc; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.proc.TgeneProcess; + +/** + * Clase controladora del bean TgeneProcess. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ProcessController extends AbstractController { + + private static final long serialVersionUID = 1L; + List lprocesstype; + + public ProcessController() throws Exception { + super(TgeneProcess.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + + // Inicializa autoconsulta + super.startQuery(); + + } + + public List getLprocesstype() { + return lprocesstype; + } + + public void setLprocesstype(List lprocesstype) { + this.lprocesstype = lprocesstype; + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PROCESS"; + lprocesstype = CatalogDetailController.find("PROCESSTYPE"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + this.record.getPk().setCatalogcodetypeprocess("PROCESSTYPE"); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.processcode"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + +} + + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/proc/ProcessController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/proc/ProcessController.java new file mode 100644 index 0000000..5219c91 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/proc/ProcessController.java @@ -0,0 +1,139 @@ +package com.fp.frontend.controller.pgeneral.proc; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.proc.TgeneProcess; + +/** + * Clase controladora del bean TgeneProcess. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ProcessController extends AbstractController { + + private static final long serialVersionUID = 1L; + List lprocesstype; + + public ProcessController() throws Exception { + super(TgeneProcess.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + + // Inicializa autoconsulta + super.startQuery(); + + } + + public List getLprocesstype() { + return lprocesstype; + } + + public void setLprocesstype(List lprocesstype) { + this.lprocesstype = lprocesstype; + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PROCESS"; + lprocesstype = CatalogDetailController.find("PROCESSTYPE"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + this.record.getPk().setCatalogcodetypeprocess("PROCESSTYPE"); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.processcode"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/.svn/entries new file mode 100644 index 0000000..cb9873d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/.svn/entries @@ -0,0 +1,198 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ProductController.java +file + + + + +2022-07-28T03:39:55.040597Z +988091a4f9cf54435ada6f982f355295 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4802 + +ModuleController.java +file + + + + +2022-07-28T03:39:55.040597Z +41011ce013ad57452cef8a2eb7183622 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4215 + +SubProductCurrencyController.java +file + + + + +2022-07-28T03:39:55.040597Z +a03a5811a4ed56ee0c30255359ad182e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7548 + +ProductDefinitionController.java +file + + + + +2022-07-28T03:39:55.041597Z +463f79d04e1e6263be87fc608ad6c05f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5577 + +SubProductController.java +file + + + + +2022-07-28T03:39:55.041597Z +68224e4a4dbc73a94e6a39b3dd82311f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5506 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/.svn/text-base/ModuleController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/.svn/text-base/ModuleController.java.svn-base new file mode 100644 index 0000000..5ed848a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/.svn/text-base/ModuleController.java.svn-base @@ -0,0 +1,138 @@ +package com.fp.frontend.controller.pgeneral.product; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.product.TgeneModule; + +/** + * Clase controladora del bean TgeneModule. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ModuleController extends AbstractController { + + public ModuleController() throws Exception { + super(TgeneModule.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "MODULE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + + public static List find() { + try { + ModuleController cc = new ModuleController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/.svn/text-base/ProductController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/.svn/text-base/ProductController.java.svn-base new file mode 100644 index 0000000..bd66d97 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/.svn/text-base/ProductController.java.svn-base @@ -0,0 +1,173 @@ +package com.fp.frontend.controller.pgeneral.product; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.product.TgeneModule; +import com.fp.persistence.pgeneral.product.TgeneProduct; + +/** + * Clase controladora del bean TgeneProduct. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ProductController extends AbstractController { + + + List lmodules; + + public ProductController() throws Exception { + super(TgeneProduct.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + this.lmodules = ModuleController.find(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 500; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PRODUCT"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + this.record.getPk().setModulecode(super.getMfilters().get("pk.modulecode")); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + String module = super.getMfilters().get("pk.modulecode"); + if ((module==null) || module.isEmpty()) { + MessageHelper.setMessageError("msg_modulerequird"); + return; + } + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.productcode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + + public void changemodule() throws Exception { + //Metodo dummy es necesario para actualizar datos del filtro para ejecutar la consulta. + this.querydatabase(); + } + + public static List find(String modulecode) { + try { + ProductController pc = new ProductController(); + pc.addFilter("pk.modulecode", modulecode); + pc.init(); + pc.recperpage = 300; + pc.querydatabase(); + if ((pc.lrecord != null) && !pc.lrecord.isEmpty()) { + return pc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Entrega el valor de: lmodules + * @return List + */ + public List getLmodules() { + return this.lmodules; + } + + /** + * Fija el valor de: lmodules + * @param lmodules Valor a fijar en el atributo. + */ + + public void setLmodules(List lmodules) { + this.lmodules = lmodules; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/.svn/text-base/ProductDefinitionController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/.svn/text-base/ProductDefinitionController.java.svn-base new file mode 100644 index 0000000..424e982 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/.svn/text-base/ProductDefinitionController.java.svn-base @@ -0,0 +1,212 @@ +package com.fp.frontend.controller.pgeneral.product; + +import java.util.HashMap; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.TabChangeEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; + +/** + * Clase controladora de definicion de productos, subproductos y monedas por subproducto. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ProductDefinitionController extends AbstractController { + + private String tabid = "product"; + + @ManagedProperty(value = "#{productController}") + private ProductController product; + + @ManagedProperty(value = "#{subProductController}") + private SubProductController subproduct; + + @ManagedProperty(value = "#{subProductCurrencyController}") + private SubProductCurrencyController subproductcurrency; + + public ProductDefinitionController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + } + + + public void tabChange(TabChangeEvent event) throws Exception { + this.tabid = event.getTab().getId(); + } + + @Override + public void query() { + try { + if(this.tabid.equals("product") ){ + this.product.query(); + }else if(this.tabid.equals("subproduct") ) { + this.subproduct.query(); + }else{ + this.subproductcurrency.query(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() { + try { + try { + if(this.tabid.equals("product") ){ + this.product.next(); + }else if(this.tabid.equals("subproduct") ) { + this.subproduct.next(); + }else{ + this.subproductcurrency.next(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void previous() { + try { + if(this.tabid.equals("product") ){ + this.product.previous(); + }else if(this.tabid.equals("subproduct") ) { + this.subproduct.previous(); + }else{ + this.subproductcurrency.previous(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + + DtoSave dtosaveprod = this.product.getDtoSave(); + if(dtosaveprod.pendingProcess()){ + msave.put(this.product.getBeanalias(), dtosaveprod); // adicionar metadata de mantenimiento para cada tabla. + } + DtoSave dtosavesubpro = this.subproduct.getDtoSave(); + if(dtosavesubpro.pendingProcess()){ + msave.put(this.subproduct.getBeanalias(), dtosavesubpro); // adicionar metadata de mantenimiento para cada tabla. + } + DtoSave dtosavesubprocurr = this.subproductcurrency.getDtoSave(); + if(dtosavesubprocurr.pendingProcess()){ + msave.put(this.subproductcurrency.getBeanalias(), dtosavesubprocurr); // adicionar metadata de mantenimiento para cada tabla. + } + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.product.postCommit(resp); + this.subproduct.postCommit(resp); + this.subproductcurrency.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + + } + + @Override + public void postCommit(Response response) throws Exception { + + } + + /** + * Entrega el valor de: product + * @return ProductController + */ + public ProductController getProduct() { + return this.product; + } + + /** + * Fija el valor de: product + * @param product Valor a fijar en el atributo. + */ + + public void setProduct(ProductController product) { + this.product = product; + } + + /** + * Entrega el valor de: subproduct + * @return SubProductController + */ + public SubProductController getSubproduct() { + return this.subproduct; + } + + /** + * Fija el valor de: subproduct + * @param subproduct Valor a fijar en el atributo. + */ + + public void setSubproduct(SubProductController subproduct) { + this.subproduct = subproduct; + } + + /** + * Entrega el valor de: subproductcurrency + * @return SubProductCurrencyController + */ + public SubProductCurrencyController getSubproductcurrency() { + return this.subproductcurrency; + } + + /** + * Fija el valor de: subproductcurrency + * @param subproductcurrency Valor a fijar en el atributo. + */ + + public void setSubproductcurrency( + SubProductCurrencyController subproductcurrency) { + this.subproductcurrency = subproductcurrency; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/.svn/text-base/SubProductController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/.svn/text-base/SubProductController.java.svn-base new file mode 100644 index 0000000..2d91bae --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/.svn/text-base/SubProductController.java.svn-base @@ -0,0 +1,187 @@ +package com.fp.frontend.controller.pgeneral.product; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.product.TgeneModule; +import com.fp.persistence.pgeneral.product.TgeneProduct; +import com.fp.persistence.pgeneral.product.TgeneSubProduct; + +/** + * Clase controladora del bean TgeneSubProduct. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SubProductController extends AbstractController { + + List lmodules; + List lproduct; + + public SubProductController() throws Exception { + super(TgeneSubProduct.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + this.lmodules = ModuleController.find(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 500; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "SUBPRODUCT"; + this.lproduct = new ArrayList<>(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + this.record.getPk().setModulecode(super.getMfilters().get("pk.modulecode")); + this.record.getPk().setProductcode(super.getMfilters().get("pk.productcode")); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + String module = super.getMfilters().get("pk.modulecode"); + String product = super.getMfilters().get("pk.productcode"); + if ((module==null) || module.isEmpty()) { + MessageHelper.setMessageError("msg_modulerequird"); + return; + } + if ((product==null) || product.isEmpty()) { + MessageHelper.setMessageError("msg_productrequird"); + return; + } + + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + + public static List find(String modulecode, String productcode) { + try { + SubProductController sc = new SubProductController(); + sc.addFilter("pk.modulecode", modulecode); + sc.addFilter("pk.productcode", productcode); + sc.init(); + sc.recperpage = 300; + sc.querydatabase(); + if ((sc.lrecord != null) && !sc.lrecord.isEmpty()) { + return sc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public void changemodule() throws Exception { + this.lproduct = ProductController.find(super.getMfilters().get("pk.modulecode")); + this.lrecord = new ArrayList<>(); + super.getMfilters().put("pk.productcode", ""); + } + + public void changeproduct() throws Exception { + //Metodo dummy es necesario para actualizar datos del filtro para ejecutar la consulta. + this.querydatabase(); + } + + /** + * Entrega el valor de: lmodules + * @return List + */ + public List getLmodules() { + return this.lmodules; + } + + /** + * Entrega el valor de: lproduct + * @return List + */ + public List getLproduct() { + return this.lproduct; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/.svn/text-base/SubProductCurrencyController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/.svn/text-base/SubProductCurrencyController.java.svn-base new file mode 100644 index 0000000..295e0f1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/.svn/text-base/SubProductCurrencyController.java.svn-base @@ -0,0 +1,240 @@ +package com.fp.frontend.controller.pgeneral.product; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CurrencyController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCurrency; +import com.fp.persistence.pgeneral.product.TgeneModule; +import com.fp.persistence.pgeneral.product.TgeneProduct; +import com.fp.persistence.pgeneral.product.TgeneSubProduct; +import com.fp.persistence.pgeneral.product.TgeneSubProductCurrency; + +/** + * Clase controladora del bean TgeneSubProductCurrency. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SubProductCurrencyController extends AbstractController { + + List lmodules; + List lcurrency; + List lproduct; + List lsubproduct; + + public SubProductCurrencyController() throws Exception { + super(TgeneSubProductCurrency.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + this.lmodules = ModuleController.find(); + this.lcurrency = CurrencyController.find(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 500; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "SUBPRODUCTCURRENCY"; + this.lproduct = new ArrayList<>(); + this.lsubproduct = new ArrayList<>(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + this.record.getPk().setModulecode(super.getMfilters().get("pk.modulecode")); + this.record.getPk().setProductcode(super.getMfilters().get("pk.productcode")); + this.record.getPk().setSubproductcode(super.getMfilters().get("pk.subproductcode")); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + String module = super.getMfilters().get("pk.modulecode"); + String product = super.getMfilters().get("pk.productcode"); + String subproduct = super.getMfilters().get("pk.subproductcode"); + if ((module==null) || module.isEmpty()) { + MessageHelper.setMessageError("msg_modulerequird"); + return; + } + if ((product==null) || product.isEmpty()) { + MessageHelper.setMessageError("msg_productrequird"); + return; + } + if ((subproduct==null) || subproduct.isEmpty()) { + MessageHelper.setMessageError("msg_subproductrequird"); + return; + } + + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.currencycode"); + // subqueries + SubQuery subquery = new SubQuery("TgeneCurrency", "description", "currencydesc", + "i.pk = t.pk.currencycode"); + dto.addSubQuery(subquery); + + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + + public static List find(String modulecode, String productcode, String subproductcode) { + try { + SubProductCurrencyController sc = new SubProductCurrencyController(); + sc.addFilter("pk.modulecode", modulecode); + sc.addFilter("pk.productcode", productcode); + sc.addFilter("pk.subproductcode", subproductcode); + sc.init(); + sc.recperpage = 300; + sc.querydatabase(); + if ((sc.lrecord != null) && !sc.lrecord.isEmpty()) { + return sc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public void changemodule() throws Exception { + this.lproduct = ProductController.find(super.getMfilters().get("pk.modulecode")); + this.lsubproduct = new ArrayList<>(); + this.lrecord = new ArrayList<>(); + super.getMfilters().put("pk.productcode", ""); + super.getMfilters().put("pk.subproductcode", ""); + } + + public void changeproduct() throws Exception { + this.lsubproduct = SubProductController.find(super.getMfilters().get("pk.modulecode"), super.getMfilters().get("pk.productcode")); + this.lrecord = new ArrayList<>(); + super.getMfilters().put("pk.subproductcode", ""); + } + + public void changesubproduct() throws Exception { + //Metodo dummy es necesario para actualizar datos del filtro para ejecutar la consulta. + this.querydatabase(); + } + + public void refreshCurrency() { + for (TgeneCurrency obj : this.lcurrency) { + if (obj.getPk().compareTo(this.record.getPk().getCurrencycode()) == 0) { + this.record.modifiedData.put("currencydesc", obj.getDescription()); + break; + } + } + } + + /** + * Entrega el valor de: lmodules + * @return List + */ + public List getLmodules() { + return this.lmodules; + } + + /** + * Entrega el valor de: lproduct + * @return List + */ + public List getLproduct() { + return this.lproduct; + } + + /** + * Entrega el valor de: lsubproduct + * @return List + */ + public List getLsubproduct() { + return this.lsubproduct; + } + + /** + * Entrega el valor de: lcurrency + * @return List + */ + public List getLcurrency() { + return this.lcurrency; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/ModuleController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/ModuleController.java new file mode 100644 index 0000000..6f016e9 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/ModuleController.java @@ -0,0 +1,139 @@ +package com.fp.frontend.controller.pgeneral.product; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.product.TgeneModule; + +/** + * Clase controladora del bean TgeneModule. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ModuleController extends AbstractController { + + public ModuleController() throws Exception { + super(TgeneModule.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "MODULE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public static List find() { + try { + ModuleController cc = new ModuleController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/ProductController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/ProductController.java new file mode 100644 index 0000000..8aecf29 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/ProductController.java @@ -0,0 +1,173 @@ +package com.fp.frontend.controller.pgeneral.product; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.product.TgeneModule; +import com.fp.persistence.pgeneral.product.TgeneProduct; + +/** + * Clase controladora del bean TgeneProduct. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ProductController extends AbstractController { + + List lmodules; + + public ProductController() throws Exception { + super(TgeneProduct.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + this.lmodules = ModuleController.find(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 500; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PRODUCT"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + this.record.getPk().setModulecode(super.getMfilters().get("pk.modulecode")); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + String module = super.getMfilters().get("pk.modulecode"); + if ((module == null) || module.isEmpty()) { + MessageHelper.setMessageError("msg_modulerequird"); + return; + } + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.productcode"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public void changemodule() throws Exception { + //Metodo dummy es necesario para actualizar datos del filtro para ejecutar la consulta. + this.querydatabase(); + } + + public static List find(String modulecode) { + try { + ProductController pc = new ProductController(); + pc.addFilter("pk.modulecode", modulecode); + pc.init(); + pc.recperpage = 300; + pc.querydatabase(); + if ((pc.lrecord != null) && !pc.lrecord.isEmpty()) { + return pc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Entrega el valor de: lmodules + * + * @return List + */ + public List getLmodules() { + return this.lmodules; + } + + /** + * Fija el valor de: lmodules + * + * @param lmodules Valor a fijar en el atributo. + */ + public void setLmodules(List lmodules) { + this.lmodules = lmodules; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/ProductDefinitionController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/ProductDefinitionController.java new file mode 100644 index 0000000..f162423 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/ProductDefinitionController.java @@ -0,0 +1,214 @@ +package com.fp.frontend.controller.pgeneral.product; + +import java.util.HashMap; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.TabChangeEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; + +/** + * Clase controladora de definicion de productos, subproductos y monedas por + * subproducto. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ProductDefinitionController extends AbstractController { + + private String tabid = "product"; + + @ManagedProperty(value = "#{productController}") + private ProductController product; + + @ManagedProperty(value = "#{subProductController}") + private SubProductController subproduct; + + @ManagedProperty(value = "#{subProductCurrencyController}") + private SubProductCurrencyController subproductcurrency; + + public ProductDefinitionController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + } + + public void tabChange(TabChangeEvent event) throws Exception { + this.tabid = event.getTab().getId(); + } + + @Override + public void query() { + try { + if (this.tabid.equals("product")) { + this.product.query(); + } else if (this.tabid.equals("subproduct")) { + this.subproduct.query(); + } else { + this.subproductcurrency.query(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void next() { + try { + try { + if (this.tabid.equals("product")) { + this.product.next(); + } else if (this.tabid.equals("subproduct")) { + this.subproduct.next(); + } else { + this.subproductcurrency.next(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void previous() { + try { + if (this.tabid.equals("product")) { + this.product.previous(); + } else if (this.tabid.equals("subproduct")) { + this.subproduct.previous(); + } else { + this.subproductcurrency.previous(); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + + DtoSave dtosaveprod = this.product.getDtoSave(); + if (dtosaveprod.pendingProcess()) { + msave.put(this.product.getBeanalias(), dtosaveprod); // adicionar metadata de mantenimiento para cada tabla. + } + DtoSave dtosavesubpro = this.subproduct.getDtoSave(); + if (dtosavesubpro.pendingProcess()) { + msave.put(this.subproduct.getBeanalias(), dtosavesubpro); // adicionar metadata de mantenimiento para cada tabla. + } + DtoSave dtosavesubprocurr = this.subproductcurrency.getDtoSave(); + if (dtosavesubprocurr.pendingProcess()) { + msave.put(this.subproductcurrency.getBeanalias(), dtosavesubprocurr); // adicionar metadata de mantenimiento para cada tabla. + } + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.product.postCommit(resp); + this.subproduct.postCommit(resp); + this.subproductcurrency.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + + } + + @Override + public void postCommit(Response response) throws Exception { + + } + + /** + * Entrega el valor de: product + * + * @return ProductController + */ + public ProductController getProduct() { + return this.product; + } + + /** + * Fija el valor de: product + * + * @param product Valor a fijar en el atributo. + */ + public void setProduct(ProductController product) { + this.product = product; + } + + /** + * Entrega el valor de: subproduct + * + * @return SubProductController + */ + public SubProductController getSubproduct() { + return this.subproduct; + } + + /** + * Fija el valor de: subproduct + * + * @param subproduct Valor a fijar en el atributo. + */ + public void setSubproduct(SubProductController subproduct) { + this.subproduct = subproduct; + } + + /** + * Entrega el valor de: subproductcurrency + * + * @return SubProductCurrencyController + */ + public SubProductCurrencyController getSubproductcurrency() { + return this.subproductcurrency; + } + + /** + * Fija el valor de: subproductcurrency + * + * @param subproductcurrency Valor a fijar en el atributo. + */ + public void setSubproductcurrency( + SubProductCurrencyController subproductcurrency) { + this.subproductcurrency = subproductcurrency; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/SubProductController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/SubProductController.java new file mode 100644 index 0000000..455d83d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/SubProductController.java @@ -0,0 +1,189 @@ +package com.fp.frontend.controller.pgeneral.product; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.product.TgeneModule; +import com.fp.persistence.pgeneral.product.TgeneProduct; +import com.fp.persistence.pgeneral.product.TgeneSubProduct; + +/** + * Clase controladora del bean TgeneSubProduct. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SubProductController extends AbstractController { + + List lmodules; + List lproduct; + + public SubProductController() throws Exception { + super(TgeneSubProduct.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + this.lmodules = ModuleController.find(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 500; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "SUBPRODUCT"; + this.lproduct = new ArrayList<>(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + this.record.getPk().setModulecode(super.getMfilters().get("pk.modulecode")); + this.record.getPk().setProductcode(super.getMfilters().get("pk.productcode")); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + String module = super.getMfilters().get("pk.modulecode"); + String product = super.getMfilters().get("pk.productcode"); + if ((module == null) || module.isEmpty()) { + MessageHelper.setMessageError("msg_modulerequird"); + return; + } + if ((product == null) || product.isEmpty()) { + MessageHelper.setMessageError("msg_productrequird"); + return; + } + + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.description"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public static List find(String modulecode, String productcode) { + try { + SubProductController sc = new SubProductController(); + sc.addFilter("pk.modulecode", modulecode); + sc.addFilter("pk.productcode", productcode); + sc.init(); + sc.recperpage = 300; + sc.querydatabase(); + if ((sc.lrecord != null) && !sc.lrecord.isEmpty()) { + return sc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public void changemodule() throws Exception { + this.lproduct = ProductController.find(super.getMfilters().get("pk.modulecode")); + this.lrecord = new ArrayList<>(); + super.getMfilters().put("pk.productcode", ""); + } + + public void changeproduct() throws Exception { + //Metodo dummy es necesario para actualizar datos del filtro para ejecutar la consulta. + this.querydatabase(); + } + + /** + * Entrega el valor de: lmodules + * + * @return List + */ + public List getLmodules() { + return this.lmodules; + } + + /** + * Entrega el valor de: lproduct + * + * @return List + */ + public List getLproduct() { + return this.lproduct; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/SubProductCurrencyController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/SubProductCurrencyController.java new file mode 100644 index 0000000..1835929 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/product/SubProductCurrencyController.java @@ -0,0 +1,243 @@ +package com.fp.frontend.controller.pgeneral.product; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CurrencyController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCurrency; +import com.fp.persistence.pgeneral.product.TgeneModule; +import com.fp.persistence.pgeneral.product.TgeneProduct; +import com.fp.persistence.pgeneral.product.TgeneSubProduct; +import com.fp.persistence.pgeneral.product.TgeneSubProductCurrency; + +/** + * Clase controladora del bean TgeneSubProductCurrency. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SubProductCurrencyController extends AbstractController { + + List lmodules; + List lcurrency; + List lproduct; + List lsubproduct; + + public SubProductCurrencyController() throws Exception { + super(TgeneSubProductCurrency.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + this.lmodules = ModuleController.find(); + this.lcurrency = CurrencyController.find(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 500; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "SUBPRODUCTCURRENCY"; + this.lproduct = new ArrayList<>(); + this.lsubproduct = new ArrayList<>(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + super.create(); + this.record.getPk().setModulecode(super.getMfilters().get("pk.modulecode")); + this.record.getPk().setProductcode(super.getMfilters().get("pk.productcode")); + this.record.getPk().setSubproductcode(super.getMfilters().get("pk.subproductcode")); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + String module = super.getMfilters().get("pk.modulecode"); + String product = super.getMfilters().get("pk.productcode"); + String subproduct = super.getMfilters().get("pk.subproductcode"); + if ((module == null) || module.isEmpty()) { + MessageHelper.setMessageError("msg_modulerequird"); + return; + } + if ((product == null) || product.isEmpty()) { + MessageHelper.setMessageError("msg_productrequird"); + return; + } + if ((subproduct == null) || subproduct.isEmpty()) { + MessageHelper.setMessageError("msg_subproductrequird"); + return; + } + + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.currencycode"); + // subqueries + SubQuery subquery = new SubQuery("TgeneCurrency", "description", "currencydesc", + "i.pk = t.pk.currencycode"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public static List find(String modulecode, String productcode, String subproductcode) { + try { + SubProductCurrencyController sc = new SubProductCurrencyController(); + sc.addFilter("pk.modulecode", modulecode); + sc.addFilter("pk.productcode", productcode); + sc.addFilter("pk.subproductcode", subproductcode); + sc.init(); + sc.recperpage = 300; + sc.querydatabase(); + if ((sc.lrecord != null) && !sc.lrecord.isEmpty()) { + return sc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + } + + public void changemodule() throws Exception { + this.lproduct = ProductController.find(super.getMfilters().get("pk.modulecode")); + this.lsubproduct = new ArrayList<>(); + this.lrecord = new ArrayList<>(); + super.getMfilters().put("pk.productcode", ""); + super.getMfilters().put("pk.subproductcode", ""); + } + + public void changeproduct() throws Exception { + this.lsubproduct = SubProductController.find(super.getMfilters().get("pk.modulecode"), super.getMfilters().get("pk.productcode")); + this.lrecord = new ArrayList<>(); + super.getMfilters().put("pk.subproductcode", ""); + } + + public void changesubproduct() throws Exception { + //Metodo dummy es necesario para actualizar datos del filtro para ejecutar la consulta. + this.querydatabase(); + } + + public void refreshCurrency() { + for (TgeneCurrency obj : this.lcurrency) { + if (obj.getPk().compareTo(this.record.getPk().getCurrencycode()) == 0) { + this.record.modifiedData.put("currencydesc", obj.getDescription()); + break; + } + } + } + + /** + * Entrega el valor de: lmodules + * + * @return List + */ + public List getLmodules() { + return this.lmodules; + } + + /** + * Entrega el valor de: lproduct + * + * @return List + */ + public List getLproduct() { + return this.lproduct; + } + + /** + * Entrega el valor de: lsubproduct + * + * @return List + */ + public List getLsubproduct() { + return this.lsubproduct; + } + + /** + * Entrega el valor de: lcurrency + * + * @return List + */ + public List getLcurrency() { + return this.lcurrency; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/result/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/result/.svn/entries new file mode 100644 index 0000000..b961e84 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/result/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/pgeneral/result +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ResultsController.java +file + + + + +2022-07-28T03:39:55.569599Z +6ebabecc6aacd69def4f97c2b1ebae88 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4081 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/result/.svn/text-base/ResultsController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/result/.svn/text-base/ResultsController.java.svn-base new file mode 100644 index 0000000..1461dcb --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/result/.svn/text-base/ResultsController.java.svn-base @@ -0,0 +1,125 @@ +package com.fp.frontend.controller.pgeneral.result; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.result.TgeneResults; + +/** + * Clase controladora del bean TgeneCatalog. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ResultsController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public ResultsController() throws Exception { + super(TgeneResults.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOG"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public static TgeneResults find(String resultcode) throws Exception { + ResultsController rc = new ResultsController(); + rc.init(); + rc.addFilter("pk.resultcode", resultcode); + rc.addFilter("pk.languagecode", rc.getLoginController().getRequest().getLanguage()); + rc.querydatabase(); + if (rc.lrecord != null && !rc.lrecord.isEmpty()) { + return rc.lrecord.get(0); + } + return null; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/result/ResultsController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/result/ResultsController.java new file mode 100644 index 0000000..56d6214 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/result/ResultsController.java @@ -0,0 +1,126 @@ +package com.fp.frontend.controller.pgeneral.result; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.result.TgeneResults; + +/** + * Clase controladora del bean TgeneCatalog. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ResultsController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public ResultsController() throws Exception { + super(TgeneResults.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOG"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public static TgeneResults find(String resultcode) throws Exception { + ResultsController rc = new ResultsController(); + rc.init(); + rc.addFilter("pk.resultcode", resultcode); + rc.addFilter("pk.languagecode", rc.getLoginController().getRequest().getLanguage()); + rc.querydatabase(); + if (rc.lrecord != null && !rc.lrecord.isEmpty()) { + return rc.lrecord.get(0); + } + return null; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/entries new file mode 100644 index 0000000..f21c812 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/entries @@ -0,0 +1,300 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe +svn://172.17.26.185/COMACO + + + +2015-09-18T03:29:01.430566Z +4280 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TerminalController.java +file + + + + +2022-07-28T03:39:55.612599Z +2658aa956a0f3ad791b76c00fe26c785 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +7327 + +UserProfileController.java +file + + + + +2022-07-28T03:39:55.612599Z +83af7bc16b6de7437492985b151afa26 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +3454 + +UserChangePassAdmin.java +file + + + + +2022-07-28T03:39:55.612599Z +738c92453206d520f0faa524b3fd0a5d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +4431 + +UserDetailController.java +file + + + + +2022-07-28T03:39:55.612599Z +8a04584380d959a138832604dd30c421 +2014-11-14T09:58:28.653202Z +2806 +fpazmino + + + + + + + + + + + + + + + + + + + + + +6098 + +AuditInsDelController.java +file + + + + +2022-07-28T03:39:55.613599Z +88cc9090bbd6e684728d7a8cd5be21d5 +2014-12-29T09:02:08.504102Z +3669 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +4919 + +ProfileHoraryController.java +file + + + + +2022-07-28T03:39:55.613599Z +0b6a832f1d4191d4fa7b77a3980ab4ac +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +8989 + +SafeAuditController.java +file + + + + +2022-07-28T03:39:55.613599Z +2cb7986aaf3f5a2daab76a6d135ede56 +2014-12-29T09:02:08.504102Z +3669 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +3345 + +UserPerfilAssiggnationController.java +file + + + + +2022-07-28T03:39:55.614599Z +6d77fc66c28f49f7637461ac00cb8a46 +2015-09-18T03:29:01.430566Z +4280 +fpazmino + + + + + + + + + + + + + + + + + + + + + +7247 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/prop-base/AuditInsDelController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/prop-base/AuditInsDelController.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/prop-base/AuditInsDelController.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/prop-base/SafeAuditController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/prop-base/SafeAuditController.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/prop-base/SafeAuditController.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/AuditInsDelController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/AuditInsDelController.java.svn-base new file mode 100644 index 0000000..bfd3e25 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/AuditInsDelController.java.svn-base @@ -0,0 +1,163 @@ +package com.fp.frontend.controller.pgeneral.safe; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.safe.TsafeAuditInsDel; + +/** + * Clase controladora del bean TsafeAuditInsDel. + * + * @author MAV. + * @version 1.0 + */ +@ManagedBean +@ViewScoped +public class AuditInsDelController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public AuditInsDelController() throws Exception { + super(TsafeAuditInsDel.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 5; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "SAUDITINSDEL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + public DtoQuery getDtoAuditInsDel() throws Exception{ + //super.addFilterDateto(); + + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.changedate"); + + //subquery + SubQuery subqueryBranch = new SubQuery("TgeneBranch", "description", "branchdesc", + "i.pk.branchcode = t.branchcode and i.pk.companycode = t.companycode and i.pk.companycode=" + + super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subqueryBranch); + + SubQuery subqueryOffice = new SubQuery("TgeneOffice", "description", "officedesc", + "i.pk.officecode = t.officecode and i.pk.branchcode = t.branchcode and i.pk.companycode = t.companycode and i.pk.companycode=" + + super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subqueryOffice); + + SubQuery subqueryPerson = new SubQuery("TcustPersonDetail", "name", "personname", + "i.pk.personcode = t.personcode and i.pk.dateto = to_date('2999-12-31', 'yyyy-MM-dd') and i.companycode = t.companycode and i.companycode=" + + super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subqueryPerson); + + SubQuery subqueryTransaction = new SubQuery("TgeneTransaction", "name", "transactiondesc", + "i.pk.transactioncode = t.transactioncode and i.pk.transactionmodule = t.transactionmodule"); + dto.addSubQuery(subqueryTransaction); + //subquery + + return dto; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = this.getDtoAuditInsDel(); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + this.manageResponseAudit(resp); + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Controla la respuesta de la consulta + * + * @param resp + * Objeto Response + * @throws Exception + */ + @SuppressWarnings("unchecked") + public void manageResponseAudit(Response resp) throws Exception { + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = null; + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + + super.postQuery(this.lrecord); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/ProfileHoraryController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/ProfileHoraryController.java.svn-base new file mode 100644 index 0000000..4a4f359 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/ProfileHoraryController.java.svn-base @@ -0,0 +1,304 @@ +package com.fp.frontend.controller.pgeneral.safe; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.lov.ProfileLovController; +import com.fp.frontend.controller.pgeneral.lov.TransactionLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeProfile; +import com.fp.persistence.pgeneral.safe.TsafeProfileHorary; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + + +/** + * Clase controladora del bean TsafeProfileHorary. + * + * @author David López P. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ProfileHoraryController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private static SimpleDateFormat TIMEFORMAT = new SimpleDateFormat("HH:mm"); + + private Date initTime; + + private Date endTime; + + private Date actualDate; + + public ProfileHoraryController() throws Exception { + super(TsafeProfileHorary.class); + } + + private List tdays; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PHORARY"; + this.tdays = CatalogDetailController.find("DAYS"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TsafeProfileHorary y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.transactionmodule") == null ) { + MessageHelper.setMessageError("msg_transactionrequird"); + return; + } + if ( super.getMfilters().get("pk.profilecode")==null) { + MessageHelper.setMessageError("msg_profilerequird"); + return; + } + super.create(); + this.record.getPk().setProfilecode(super.getMfilters().get("pk.profilecode")); + this.record.getPk().setTransactionmodule(super.getMfilters().get("pk.transactionmodule")); + this.record.getPk().setTransactioncode(Integer.valueOf(super.getMfilters().get("pk.transactioncode"))); + this.record.getPk().setTransactionversion(Integer.valueOf(super.getMfilters().get("pk.transactionversion"))); + } + + @Override + public void update() throws Exception { + if(record.getInittime().compareTo(record.getFinishtime()) > 0 ){ + MessageHelper.setMessageError("msg_validatetimehour"); + return; + } + String registercode = record.getPk().getProfilecode()+record.getPk().getTransactionmodule()+record.getPk().getTransactioncode()+record.getPk().getTransactionversion()+record.getPk().getDay(); + if(record.getRegistercode() == null || !record.getRegistercode().equals(registercode)){ + record.setRegistercode(registercode); + } + super.update(); + } + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + if ((super.getMfilters().get("pk.transactionmodule") == null) || (super.getMfilters().get("pk.profilecode")==null)) { + MessageHelper.setMessageError("msg_transactionrequird"); + return; + } + try { + //super.addFilter("catalogtypeprocess", "REPORT"); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.profilecode"); + + // subqueries + SubQuery subquery = new SubQuery("TsafeProfile", "description", "descrip", + "i.pk = t.pk.profilecode"); + dto.addSubQuery(subquery); + + SubQuery subquery2 = new SubQuery("TgeneCatalogDetail", "description", "days", + "i.legalcode = t.pk.day and i.pk.catalogcode='DAYS'"); + + dto.addSubQuery(subquery); + dto.addSubQuery(subquery2); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public void openTransactionLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("TRANSACTION"); // valor del parametro + params.put("processtype", l); + TransactionLovController.openLov(params); + } + + public void onReturnTransactionLov(SelectEvent event) throws Exception { + TgeneTransaction t = (TgeneTransaction) event.getObject(); + super.addFilter("pk.transactionmodule", t.getPk().getTransactionmodule()); + super.addFilter("pk.transactioncode", t.getPk().getTransactioncode().toString()); + super.addFilter("pk.transactionversion", t.getPk().getTransactionversion().toString()); + super.addField("name", t.getName()); + + } + + public void openProfileLov() { + Map> params = new HashMap<>(); + ProfileLovController.openLov(params); + } + + public void onReturnProfileLov(SelectEvent event) throws Exception { + TsafeProfile t = (TsafeProfile) event.getObject(); + super.addFilter("pk.profilecode", t.getPk()); + super.addField("description", t.getDescription()); + + } + + /** + * Obtiene dias a partir del codigo enviado. + */ + public String getDay(int daycode){ + String dayOfWeek = ""; + for(TgeneCatalogDetail day: this.tdays){ + if(day.getLegalcode().compareTo(String.valueOf(daycode))==0){ + dayOfWeek = day.getDescription(); + } + } + return dayOfWeek; + } + + public List getTdays() { + return this.tdays; + } + + public void setTdays(List tdays) { + this.tdays = tdays; + } + + /** + * Entrega el valor de: initTime + * @return Date + */ + public Date getInitTime() { + java.util.Date dt = null; + try{ + if(record != null && record.getInittime() != null){ + dt = TIMEFORMAT.parse(this.record.getInittime()); + } + } catch (Exception e) { + e.printStackTrace(); + } + return dt; + } + + /** + * Fija el valor de: initTime + * @param initTime Valor a fijar en el atributo + */ + public void setInitTime(Date initTime) { + this.initTime = initTime; + this.record.setInittime(TIMEFORMAT.format(initTime)); + } + + + + /** + * Entrega el valor de: endTime + * @return Date + */ + public Date getEndTime() { + java.util.Date dt = null; + try{ + if(record != null && record.getInittime() != null){ + dt = TIMEFORMAT.parse(this.record.getFinishtime()); + } + } catch (Exception e) { + e.printStackTrace(); + } + return dt; + } + + /** + * Fija el valor de: endTime + * @param endTime Valor a fijar en el atributo + */ + public void setEndTime(Date endTime) { + this.endTime = endTime; + this.record.setFinishtime(TIMEFORMAT.format(endTime)); + } + + public String getRecordDayDescription(){ + if(this.record!=null){ + for (TgeneCatalogDetail day : this.tdays) { + if(day.getLegalcode().compareTo(this.record.getPk().getDay().toString())==0){ + return day.getDescription(); + } + } + } + return null; + } + +} + + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/SafeAuditController.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/SafeAuditController.java.netbeans-base new file mode 100644 index 0000000..ba507c6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/SafeAuditController.java.netbeans-base @@ -0,0 +1,106 @@ +package com.fp.frontend.controller.pgeneral.safe; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.safe.TsafeAudit; + +/** + * + * @author Jacqueline Arias + * + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SafeAuditController extends AbstractController { + + public SafeAuditController() throws Exception { + super(TsafeAudit.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postConstruct() { + this.init(); + } + + private void init() { + try { + this.recperpage = 15; + this.lrecord = new ArrayList<>(); + this.beanalias = "TSAFEAUDIT"; + super.create(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = this.getDtoSafeAudit(); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + public DtoQuery getDtoSafeAudit() throws Exception { + + DtoQuery dto = super.getDtoQuery(true); + + dto.setOrderby("t.pk"); + SubQuery subqueryBranch = new SubQuery("TgeneBranch", "description", "branchdesc", + "i.pk.branchcode = t.branchcode and i.pk.companycode = t.companycode and i.pk.companycode=" + + super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subqueryBranch); + + SubQuery subqueryOffice = new SubQuery("TgeneOffice", "description", "officedesc", + "i.pk.officecode = t.officecode and i.pk.branchcode = t.branchcode and i.pk.companycode = t.companycode and i.pk.companycode=" + + super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subqueryOffice); + + SubQuery subqueryPerson = new SubQuery("TcustPersonDetail", "name", "personname", + "i.pk.personcode = t.personcode and i.pk.dateto = to_date('2999-12-31', 'yyyy-MM-dd') and i.companycode = t.companycode and i.companycode=" + + super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subqueryPerson); + + SubQuery subqueryTransaction = new SubQuery("TgeneTransaction", "name", "transactiondesc", + "i.pk.transactioncode = t.transactioncode and i.pk.transactionmodule = t.transactionmodule"); + dto.addSubQuery(subqueryTransaction); + + return dto; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/SafeAuditController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/SafeAuditController.java.svn-base new file mode 100644 index 0000000..ba507c6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/SafeAuditController.java.svn-base @@ -0,0 +1,106 @@ +package com.fp.frontend.controller.pgeneral.safe; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.safe.TsafeAudit; + +/** + * + * @author Jacqueline Arias + * + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SafeAuditController extends AbstractController { + + public SafeAuditController() throws Exception { + super(TsafeAudit.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postConstruct() { + this.init(); + } + + private void init() { + try { + this.recperpage = 15; + this.lrecord = new ArrayList<>(); + this.beanalias = "TSAFEAUDIT"; + super.create(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = this.getDtoSafeAudit(); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + public DtoQuery getDtoSafeAudit() throws Exception { + + DtoQuery dto = super.getDtoQuery(true); + + dto.setOrderby("t.pk"); + SubQuery subqueryBranch = new SubQuery("TgeneBranch", "description", "branchdesc", + "i.pk.branchcode = t.branchcode and i.pk.companycode = t.companycode and i.pk.companycode=" + + super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subqueryBranch); + + SubQuery subqueryOffice = new SubQuery("TgeneOffice", "description", "officedesc", + "i.pk.officecode = t.officecode and i.pk.branchcode = t.branchcode and i.pk.companycode = t.companycode and i.pk.companycode=" + + super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subqueryOffice); + + SubQuery subqueryPerson = new SubQuery("TcustPersonDetail", "name", "personname", + "i.pk.personcode = t.personcode and i.pk.dateto = to_date('2999-12-31', 'yyyy-MM-dd') and i.companycode = t.companycode and i.companycode=" + + super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subqueryPerson); + + SubQuery subqueryTransaction = new SubQuery("TgeneTransaction", "name", "transactiondesc", + "i.pk.transactioncode = t.transactioncode and i.pk.transactionmodule = t.transactionmodule"); + dto.addSubQuery(subqueryTransaction); + + return dto; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/TerminalController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/TerminalController.java.svn-base new file mode 100644 index 0000000..9fe1c4b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/TerminalController.java.svn-base @@ -0,0 +1,220 @@ +package com.fp.frontend.controller.pgeneral.safe; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.AreaController; +import com.fp.frontend.controller.pgeneral.gene.BranchController; +import com.fp.frontend.controller.pgeneral.gene.OfficeController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneArea; +import com.fp.persistence.pgeneral.gene.TgeneBranch; +import com.fp.persistence.pgeneral.gene.TgeneOffice; +import com.fp.persistence.pgeneral.safe.TsafeTerminal; + +/** + * Clase controladora del bean TsafeTerminal. + * + * @author David López P. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TerminalController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public TerminalController() throws Exception { + super(TsafeTerminal.class); + } + /** + * Atributo para la lista de sucursales + */ + private List lbranch; + /** + * Atributo para la lista de oficinas + */ + private List loffice; + /** + * Atributo para la lista de areas + */ + private List larea; + /** + * Atrubuto V/F + */ + private boolean activate; + + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + //Listas + this.lbranch = BranchController.find(super.getLoginController().getRequest().getCompany().toString()); + this.larea = AreaController.find(super.getLoginController().getRequest().getCompany().toString()); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TERMINAL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Entrega el valor de: lbranch + * + * @return List + */ + public List getLbranch() { + return lbranch; + } + + /** + * Entrega el valor de: loffice + * + * @return List + */ + public List getLoffice() { + return loffice; + } + + /** + * Entrega el valor de: larea + * + * @return List + */ + public List getLarea() { + return larea; + } + + /** + * Crea una instancia de TsafeProfileHorary y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("branchcode") == null || getMfilters().get("officecode") == null || super.getMfilters().get("areacode") == null) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + super.create(); + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + this.record.setBranchcode(Integer.valueOf(super.getMfilters().get("branchcode"))); + this.record.setOfficecode(Integer.valueOf(super.getMfilters().get("officecode"))); + this.record.setAreacode(Integer.valueOf(super.getMfilters().get("branchcode"))); + + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + if ((super.getMfilters().get("branchcode") == null || getMfilters().get("officecode") == null || super.getMfilters().get("areacode") == null) && !this.activate) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + try { + if(!this.activate){ + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + } + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.terminalcode"); + + // subqueries + + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public void loadOffice() { + this.loffice = OfficeController.find(super.getMfilters().get("branchcode"), super.getLoginController().getRequest().getCompany().toString()); + } + + /** + * Entrega una lista de objetos TsafeTerminal + * + * @param companycode Código de la compania + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static List find(String companycode) { + try { + TerminalController cc = new TerminalController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.companycode", companycode); + cc.activate = true; + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/UserChangePassAdmin.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/UserChangePassAdmin.java.svn-base new file mode 100644 index 0000000..2bd0a3f --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/UserChangePassAdmin.java.svn-base @@ -0,0 +1,142 @@ +package com.fp.frontend.controller.pgeneral.safe; + +import java.util.ArrayList; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TsafeUserDetail. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class UserChangePassAdmin extends AbstractController { + + private static final long serialVersionUID = 1L; + @ManagedProperty(value = "#{userDetailController}") + private UserDetailController userdetail; + + public UserChangePassAdmin() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.lrecord = new ArrayList<>(); + this.beanalias = "CHANGEPASSADMIN"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + try { + if (!this.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + this.userdetail.getMfilters().clear(); + this.userdetail.getMfilelds().clear(); + this.userdetail.getMfilters().put("pk.usercode", this.getMfilters().get("pk.usercode")); + this.userdetail.querydatabase(); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + if (!this.passwordvalidate()) { + return; + } + TsafeUserDetail tsud = userdetail.getRecord(); + tsud.setPassword(callerhelper.getPasswordEncriptado(super.getMfilelds().get("p").toString())); + tsud.setChangepassword("Y"); + userdetail.update(); + userdetail.save(); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Valida que el usuario ingrese la contrasena y la contrasena de validacion + * y que las dos sean iguales. + * + * @return boolean + * @throws Exception + */ + private boolean passwordvalidate() throws Exception { + Object p = super.getFieldvalue("p"); + Object np = super.getFieldvalue("np"); + if (p == null || np == null) { + MessageHelper.setMessageError("msg_passwordrequired"); + return false; + } + if (!p.equals(np)) { + MessageHelper.setMessageError("msg_passwordnomatch"); + return false; + } + return true; + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Entrega el valor de: userdetail + * + * @return UserDetailController + */ + public UserDetailController getUserdetail() { + return userdetail; + } + + /** + * Fija el valor de: userdetail + * + * @param userdetail Valor a fijar en el atributo. + */ + public void setUserdetail(UserDetailController userdetail) { + this.userdetail = userdetail; + } + + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + this.userdetail.getMfilters().clear(); + this.getMfilelds().clear(); + this.userdetail.addFilter("pk.personcode", t.getPk().getPersoncode().toString()); + this.userdetail.addField("personname", t.getName()); + this.userdetail.querydatabase(); + this.addFilter("pk.usercode", this.userdetail.getRecord().getPk().getUsercode()); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/UserDetailController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/UserDetailController.java.svn-base new file mode 100644 index 0000000..2973e1e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/UserDetailController.java.svn-base @@ -0,0 +1,193 @@ +package com.fp.frontend.controller.pgeneral.safe; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TsafeUserDetail. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class UserDetailController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public UserDetailController() throws Exception { + super(TsafeUserDetail.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.record = new TsafeUserDetail(); + this.lrecord = new ArrayList<>(); + this.beanalias = "USERDETAIL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void create() throws Exception { + super.create(); + if (this.getMfilters().get("pk.personcode") != null) { + this.record.getPk().setPersoncode(Integer.valueOf(this.getMfilters().get("pk.personcode"))); + } + this.record.setCompanycode(super.getLoginController().getRequest().getCompany()); + this.record.setUserstatuscatalogcode("USERSTATUS"); + this.record.setUserstatuscatalog("ENT"); + this.record.setChangepassword("Y"); + } + + @Override + protected void querydatabase() { + try { + if (!super.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + Request request = this.callerhelper.getRequest(); + super.addFilterDateto(); + super.addFilter("companycode", super.getLoginController().getRequest().getCompany() + .toString()); + DtoQuery dto = super.getDtoQuery(false); + dto.setOrderby("t.pk"); // En en string van todos los campos de + // orden ("t.pk, t.nombre, t.cpais"). + + // subqueries + SubQuery subquery = new SubQuery("TgeneChannels", "description", "chanelname", "i.pk = t.channelcode"); + dto.addSubQuery(subquery); + + SubQuery subquerya = new SubQuery("TgeneArea", "descripction", "areaname", + "i.pk.companycode = t.companycode and i.pk.areacode = t.areacode "); + dto.addSubQuery(subquerya); + + SubQuery subquerys = new SubQuery("TgeneCatalogDetail", "description", "statusdesc", + "i.pk.catalogcode = t.userstatuscatalogcode and i.pk.catalog = t.userstatuscatalog "); + dto.addSubQuery(subquerys); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.record = null; + MessageHelper.setMessageError(resp); + } else { + this.manageresponse(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private void manageresponse(Response resp) throws Exception { + + this.record = (TsafeUserDetail) resp.get(this.beanalias); + if (this.record == null) { + //si no existe crea un registro para permitir el ingreso.s + this.create(); + } else { + super.addFilter("pk.usercode", this.record.getPk().getUsercode()); + super.postQuery((AbstractDataTransport) resp.get(this.beanalias)); + } + if ((super.getMfilelds().get("personname") == null)) { + if ((super.getMfilters().get("pk.personcode") != null) || (this.record.getPk().getPersoncode() != null)) { + String personcode = super.getMfilters().get("pk.personcode") != null ? super.getMfilters().get("pk.personcode") : this.record.getPk().getPersoncode().toString(); + TcustPersonDetail tcpd = PersonLovController.find(personcode); + super.addField("personname", tcpd != null ? tcpd.getName() : ""); + } + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + super.addFilter("pk.personcode", t.getPk().getPersoncode().toString()); + super.addField("personname", t.getName()); + } + + public void update(TsafeUserDetail bean) throws Exception { + record=bean; + update(); + } + +} + + + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/UserPerfilAssiggnationController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/UserPerfilAssiggnationController.java.svn-base new file mode 100644 index 0000000..eb31320 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/UserPerfilAssiggnationController.java.svn-base @@ -0,0 +1,249 @@ +package com.fp.frontend.controller.pgeneral.safe; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.AreaController; +import com.fp.frontend.controller.pgeneral.gene.BranchController; +import com.fp.frontend.controller.pgeneral.gene.ChannelController; +import com.fp.frontend.controller.pgeneral.gene.LanguageController; +import com.fp.frontend.controller.pgeneral.gene.OfficeController; +import com.fp.frontend.controller.pgeneral.lov.ProfileLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneArea; +import com.fp.persistence.pgeneral.gene.TgeneBranch; +import com.fp.persistence.pgeneral.gene.TgeneChannels; +import com.fp.persistence.pgeneral.gene.TgeneLanguage; +import com.fp.persistence.pgeneral.gene.TgeneOffice; +import com.fp.persistence.pgeneral.safe.TsafeProfile; + +/** + * Clase controladora del bean TsafeUserDetail. + * + * @author Andres E. Carpio + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class UserPerfilAssiggnationController extends AbstractController { + + private static final long serialVersionUID = 1L; + List lChannel; + List lBranch; + List lOffice; + List lArea; + List lLanguage; + + @ManagedProperty(value = "#{userDetailController}") + private UserDetailController userdetail; + + @ManagedProperty(value = "#{userProfileController}") + private UserProfileController userProfile; + + public UserPerfilAssiggnationController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + this.lChannel = ChannelController.find(); + this.lBranch = BranchController.find(super.getLoginController().getRequest().getCompany() + .toString()); + this.lArea = AreaController.find(super.getLoginController().getRequest().getCompany() + .toString()); + this.lLanguage = LanguageController.find(); + + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.lrecord = new ArrayList<>(); + this.beanalias = "CHANGEPASSADMIN"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void loadOffice() { + this.lOffice = OfficeController.find( + this.userdetail.getRecord().getBranchcode().toString(), super.getLoginController() + .getRequest().getCompany().toString()); + } + + @Override + protected void querydatabase() { + try { + if (!this.userdetail.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + this.userdetail.querydatabase(); + if(this.userdetail.getRecord().getPk().getUsercode() != null){ + this.userProfile.getMfilters().put("pk.usercode", this.userdetail.getRecord().getPk().getUsercode()); + this.userProfile.querydatabase(); + this.loadOffice(); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + this.userdetail.update(); + + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + + DtoSave dtosave = this.userdetail.getDtoSave(); + if (dtosave.pendingProcess()) { + dtosave.setIsForm(true); + msave.put(this.userdetail.getBeanalias(), dtosave); + } + DtoSave dtosaveup = this.userProfile.getDtoSave(); + if (dtosaveup.pendingProcess()) { + msave.put(this.userProfile.getBeanalias(), dtosaveup); + } + request.put("PANTALLA", "USUARIOSPERFIL_MOD1_TX120"); + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + this.userdetail.postCommit(response); + this.userProfile.postCommit(response); + } + + /** + * Entrega el valor de: userdetail + * + * @return UserDetailController + */ + public UserDetailController getUserdetail() { + return this.userdetail; + } + + /** + * Fija el valor de: userdetail + * + * @param userdetail + * Valor a fijar en el atributo. + */ + + public void setUserdetail(UserDetailController userdetail) { + this.userdetail = userdetail; + } + + /** + * @return the userProfile + */ + public UserProfileController getUserProfile() { + return this.userProfile; + } + + /** + * @param userProfile the userProfile to set + */ + public void setUserProfile(UserProfileController userProfile) { + this.userProfile = userProfile; + } + + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + this.userdetail.addFilter("pk.personcode", t.getPk().getPersoncode().toString()); + this.userdetail.addField("personname", t.getName()); + this.querydatabase(); + } + + public List getlChannel() { + return this.lChannel; + } + + public void setlChannel(List lChannel) { + this.lChannel = lChannel; + } + + public List getlBranch() { + return this.lBranch; + } + + public void setlBranch(List lBranch) { + this.lBranch = lBranch; + } + + public List getlOffice() { + return this.lOffice; + } + + public void setlOffice(List lOffice) { + this.lOffice = lOffice; + } + + public List getlArea() { + return this.lArea; + } + + public void setlArea(List lArea) { + this.lArea = lArea; + } + + public List getlLanguage() { + return this.lLanguage; + } + + public void setlLanguage(List lLanguage) { + this.lLanguage = lLanguage; + } + + public void openProfileLov() { + Map> params = new HashMap<>(); + ProfileLovController.openLov(params); + } + + public void onReturnProfileLov(SelectEvent event) throws Exception { + TsafeProfile t = (TsafeProfile) event.getObject(); + //super.addFilter("pk.profilecode", t.getPk()); + //super.addField("description", t.getDescription()); + this.userProfile.create(); + this.userProfile.getRecord().getPk().setUsercode(this.userdetail.getRecord().getPk().getUsercode()); + this.userProfile.getRecord().getPk().setProfilecode(t.getPk()); + this.userProfile.getRecord().put("profiledesc", t.getDescription()); + this.userProfile.update(); + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/UserProfileController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/UserProfileController.java.svn-base new file mode 100644 index 0000000..126103a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/.svn/text-base/UserProfileController.java.svn-base @@ -0,0 +1,127 @@ +package com.fp.frontend.controller.pgeneral.safe; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.safe.TsafeUserProfile; + +/** + * Clase controladora del bean TsafeUserProfile. + * + * @author Andres E. Carpio + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class UserProfileController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public UserProfileController() throws Exception { + super(TsafeUserProfile.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "SPROFILE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + super.addFilterDateto(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.profilecode"); + + // subqueries + SubQuery subquery = new SubQuery("TsafeProfile", "description", "profiledesc", + "i.pk = t.pk.profilecode"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/AuditInsDelController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/AuditInsDelController.java new file mode 100644 index 0000000..3676137 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/AuditInsDelController.java @@ -0,0 +1,160 @@ +package com.fp.frontend.controller.pgeneral.safe; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.safe.TsafeAuditInsDel; + +/** + * Clase controladora del bean TsafeAuditInsDel. + * + * @author MAV. + * @version 1.0 + */ +@ManagedBean +@ViewScoped +public class AuditInsDelController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public AuditInsDelController() throws Exception { + super(TsafeAuditInsDel.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 5; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "SAUDITINSDEL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public DtoQuery getDtoAuditInsDel() throws Exception { + //super.addFilterDateto(); + + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.changedate"); + + //subquery + SubQuery subqueryBranch = new SubQuery("TgeneBranch", "description", "branchdesc", + "i.pk.branchcode = t.branchcode and i.pk.companycode = t.companycode and i.pk.companycode=" + + super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subqueryBranch); + + SubQuery subqueryOffice = new SubQuery("TgeneOffice", "description", "officedesc", + "i.pk.officecode = t.officecode and i.pk.branchcode = t.branchcode and i.pk.companycode = t.companycode and i.pk.companycode=" + + super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subqueryOffice); + + SubQuery subqueryPerson = new SubQuery("TcustPersonDetail", "name", "personname", + "i.pk.personcode = t.personcode and i.pk.dateto = to_date('2999-12-31', 'yyyy-MM-dd') and i.companycode = t.companycode and i.companycode=" + + super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subqueryPerson); + + SubQuery subqueryTransaction = new SubQuery("TgeneTransaction", "name", "transactiondesc", + "i.pk.transactioncode = t.transactioncode and i.pk.transactionmodule = t.transactionmodule"); + dto.addSubQuery(subqueryTransaction); + //subquery + + return dto; + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = this.getDtoAuditInsDel(); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + this.manageResponseAudit(resp); + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Controla la respuesta de la consulta + * + * @param resp Objeto Response + * @throws Exception + */ + @SuppressWarnings("unchecked") + public void manageResponseAudit(Response resp) throws Exception { + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = null; + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + + super.postQuery(this.lrecord); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/ProfileHoraryController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/ProfileHoraryController.java new file mode 100644 index 0000000..7c0f8f6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/ProfileHoraryController.java @@ -0,0 +1,302 @@ +package com.fp.frontend.controller.pgeneral.safe; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.lov.ProfileLovController; +import com.fp.frontend.controller.pgeneral.lov.TransactionLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeProfile; +import com.fp.persistence.pgeneral.safe.TsafeProfileHorary; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * Clase controladora del bean TsafeProfileHorary. + * + * @author David López P. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ProfileHoraryController extends AbstractController { + + private static final long serialVersionUID = 1L; + + private static SimpleDateFormat TIMEFORMAT = new SimpleDateFormat("HH:mm"); + + private Date initTime; + + private Date endTime; + + private Date actualDate; + + public ProfileHoraryController() throws Exception { + super(TsafeProfileHorary.class); + } + + private List tdays; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "PHORARY"; + this.tdays = CatalogDetailController.find("DAYS"); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TsafeProfileHorary y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.transactionmodule") == null) { + MessageHelper.setMessageError("msg_transactionrequird"); + return; + } + if (super.getMfilters().get("pk.profilecode") == null) { + MessageHelper.setMessageError("msg_profilerequird"); + return; + } + super.create(); + this.record.getPk().setProfilecode(super.getMfilters().get("pk.profilecode")); + this.record.getPk().setTransactionmodule(super.getMfilters().get("pk.transactionmodule")); + this.record.getPk().setTransactioncode(Integer.valueOf(super.getMfilters().get("pk.transactioncode"))); + this.record.getPk().setTransactionversion(Integer.valueOf(super.getMfilters().get("pk.transactionversion"))); + } + + @Override + public void update() throws Exception { + if (record.getInittime().compareTo(record.getFinishtime()) > 0) { + MessageHelper.setMessageError("msg_validatetimehour"); + return; + } + String registercode = record.getPk().getProfilecode() + record.getPk().getTransactionmodule() + record.getPk().getTransactioncode() + record.getPk().getTransactionversion() + record.getPk().getDay(); + if (record.getRegistercode() == null || !record.getRegistercode().equals(registercode)) { + record.setRegistercode(registercode); + } + super.update(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + if ((super.getMfilters().get("pk.transactionmodule") == null) || (super.getMfilters().get("pk.profilecode") == null)) { + MessageHelper.setMessageError("msg_transactionrequird"); + return; + } + try { + //super.addFilter("catalogtypeprocess", "REPORT"); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.profilecode"); + + // subqueries + SubQuery subquery = new SubQuery("TsafeProfile", "description", "descrip", + "i.pk = t.pk.profilecode"); + dto.addSubQuery(subquery); + + SubQuery subquery2 = new SubQuery("TgeneCatalogDetail", "description", "days", + "i.legalcode = t.pk.day and i.pk.catalogcode='DAYS'"); + + dto.addSubQuery(subquery); + dto.addSubQuery(subquery2); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public void openTransactionLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("TRANSACTION"); // valor del parametro + params.put("processtype", l); + TransactionLovController.openLov(params); + } + + public void onReturnTransactionLov(SelectEvent event) throws Exception { + TgeneTransaction t = (TgeneTransaction) event.getObject(); + super.addFilter("pk.transactionmodule", t.getPk().getTransactionmodule()); + super.addFilter("pk.transactioncode", t.getPk().getTransactioncode().toString()); + super.addFilter("pk.transactionversion", t.getPk().getTransactionversion().toString()); + super.addField("name", t.getName()); + + } + + public void openProfileLov() { + Map> params = new HashMap<>(); + ProfileLovController.openLov(params); + } + + public void onReturnProfileLov(SelectEvent event) throws Exception { + TsafeProfile t = (TsafeProfile) event.getObject(); + super.addFilter("pk.profilecode", t.getPk()); + super.addField("description", t.getDescription()); + + } + + /** + * Obtiene dias a partir del codigo enviado. + */ + public String getDay(int daycode) { + String dayOfWeek = ""; + for (TgeneCatalogDetail day : this.tdays) { + if (day.getLegalcode().compareTo(String.valueOf(daycode)) == 0) { + dayOfWeek = day.getDescription(); + } + } + return dayOfWeek; + } + + public List getTdays() { + return this.tdays; + } + + public void setTdays(List tdays) { + this.tdays = tdays; + } + + /** + * Entrega el valor de: initTime + * + * @return Date + */ + public Date getInitTime() { + java.util.Date dt = null; + try { + if (record != null && record.getInittime() != null) { + dt = TIMEFORMAT.parse(this.record.getInittime()); + } + } catch (Exception e) { + e.printStackTrace(); + } + return dt; + } + + /** + * Fija el valor de: initTime + * + * @param initTime Valor a fijar en el atributo + */ + public void setInitTime(Date initTime) { + this.initTime = initTime; + this.record.setInittime(TIMEFORMAT.format(initTime)); + } + + /** + * Entrega el valor de: endTime + * + * @return Date + */ + public Date getEndTime() { + java.util.Date dt = null; + try { + if (record != null && record.getInittime() != null) { + dt = TIMEFORMAT.parse(this.record.getFinishtime()); + } + } catch (Exception e) { + e.printStackTrace(); + } + return dt; + } + + /** + * Fija el valor de: endTime + * + * @param endTime Valor a fijar en el atributo + */ + public void setEndTime(Date endTime) { + this.endTime = endTime; + this.record.setFinishtime(TIMEFORMAT.format(endTime)); + } + + public String getRecordDayDescription() { + if (this.record != null) { + for (TgeneCatalogDetail day : this.tdays) { + if (day.getLegalcode().compareTo(this.record.getPk().getDay().toString()) == 0) { + return day.getDescription(); + } + } + } + return null; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/SafeAuditController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/SafeAuditController.java new file mode 100644 index 0000000..093dd6b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/SafeAuditController.java @@ -0,0 +1,106 @@ +package com.fp.frontend.controller.pgeneral.safe; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.safe.TsafeAudit; + +/** + * + * @author Jacqueline Arias + * + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class SafeAuditController extends AbstractController { + + public SafeAuditController() throws Exception { + super(TsafeAudit.class); + // TODO Auto-generated constructor stub + } + + @PostConstruct + private void postConstruct() { + this.init(); + } + + private void init() { + try { + this.recperpage = 15; + this.lrecord = new ArrayList<>(); + this.beanalias = "TSAFEAUDIT"; + super.create(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + // TODO Auto-generated method stub + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = this.getDtoSafeAudit(); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + + } + + public DtoQuery getDtoSafeAudit() throws Exception { + + DtoQuery dto = super.getDtoQuery(true); + + dto.setOrderby("t.pk"); + SubQuery subqueryBranch = new SubQuery("TgeneBranch", "description", "branchdesc", + "i.pk.branchcode = t.branchcode and i.pk.companycode = t.companycode and i.pk.companycode=" + + super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subqueryBranch); + + SubQuery subqueryOffice = new SubQuery("TgeneOffice", "description", "officedesc", + "i.pk.officecode = t.officecode and i.pk.branchcode = t.branchcode and i.pk.companycode = t.companycode and i.pk.companycode=" + + super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subqueryOffice); + + SubQuery subqueryPerson = new SubQuery("TcustPersonDetail", "name", "personname", + "i.pk.personcode = t.personcode and i.pk.dateto = to_date('2999-12-31', 'yyyy-MM-dd') and i.companycode = t.companycode and i.companycode=" + + super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subqueryPerson); + + SubQuery subqueryTransaction = new SubQuery("TgeneTransaction", "name", "transactiondesc", + "i.pk.transactioncode = t.transactioncode and i.pk.transactionmodule = t.transactionmodule"); + dto.addSubQuery(subqueryTransaction); + + return dto; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/TerminalController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/TerminalController.java new file mode 100644 index 0000000..b1948c3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/TerminalController.java @@ -0,0 +1,218 @@ +package com.fp.frontend.controller.pgeneral.safe; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.AreaController; +import com.fp.frontend.controller.pgeneral.gene.BranchController; +import com.fp.frontend.controller.pgeneral.gene.OfficeController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneArea; +import com.fp.persistence.pgeneral.gene.TgeneBranch; +import com.fp.persistence.pgeneral.gene.TgeneOffice; +import com.fp.persistence.pgeneral.safe.TsafeTerminal; + +/** + * Clase controladora del bean TsafeTerminal. + * + * @author David López P. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TerminalController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public TerminalController() throws Exception { + super(TsafeTerminal.class); + } + /** + * Atributo para la lista de sucursales + */ + private List lbranch; + /** + * Atributo para la lista de oficinas + */ + private List loffice; + /** + * Atributo para la lista de areas + */ + private List larea; + /** + * Atrubuto V/F + */ + private boolean activate; + + @PostConstruct + private void postconstruct() { + this.init(); + super.startQuery(); + //Listas + this.lbranch = BranchController.find(super.getLoginController().getRequest().getCompany().toString()); + this.larea = AreaController.find(super.getLoginController().getRequest().getCompany().toString()); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TERMINAL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Entrega el valor de: lbranch + * + * @return List + */ + public List getLbranch() { + return lbranch; + } + + /** + * Entrega el valor de: loffice + * + * @return List + */ + public List getLoffice() { + return loffice; + } + + /** + * Entrega el valor de: larea + * + * @return List + */ + public List getLarea() { + return larea; + } + + /** + * Crea una instancia de TsafeProfileHorary y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("branchcode") == null || getMfilters().get("officecode") == null || super.getMfilters().get("areacode") == null) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + super.create(); + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + this.record.setBranchcode(Integer.valueOf(super.getMfilters().get("branchcode"))); + this.record.setOfficecode(Integer.valueOf(super.getMfilters().get("officecode"))); + this.record.setAreacode(Integer.valueOf(super.getMfilters().get("branchcode"))); + + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + if ((super.getMfilters().get("branchcode") == null || getMfilters().get("officecode") == null || super.getMfilters().get("areacode") == null) && !this.activate) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + try { + if (!this.activate) { + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + } + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.terminalcode"); + + // subqueries + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public void loadOffice() { + this.loffice = OfficeController.find(super.getMfilters().get("branchcode"), super.getLoginController().getRequest().getCompany().toString()); + } + + /** + * Entrega una lista de objetos TsafeTerminal + * + * @param companycode Código de la compania + * @return lrecord Lista de objetos TgeneCatalogDetail + */ + public static List find(String companycode) { + try { + TerminalController cc = new TerminalController(); + cc.init(); + cc.recperpage = 300; + cc.addFilter("pk.companycode", companycode); + cc.activate = true; + cc.querydatabase(); + if (cc.lrecord != null && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/UserChangePassAdmin.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/UserChangePassAdmin.java new file mode 100644 index 0000000..5061b09 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/UserChangePassAdmin.java @@ -0,0 +1,142 @@ +package com.fp.frontend.controller.pgeneral.safe; + +import java.util.ArrayList; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TsafeUserDetail. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class UserChangePassAdmin extends AbstractController { + + private static final long serialVersionUID = 1L; + @ManagedProperty(value = "#{userDetailController}") + private UserDetailController userdetail; + + public UserChangePassAdmin() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.lrecord = new ArrayList<>(); + this.beanalias = "CHANGEPASSADMIN"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + try { + if (!this.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + this.userdetail.getMfilters().clear(); + this.userdetail.getMfilelds().clear(); + this.userdetail.getMfilters().put("pk.usercode", this.getMfilters().get("pk.usercode")); + this.userdetail.querydatabase(); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + if (!this.passwordvalidate()) { + return; + } + TsafeUserDetail tsud = userdetail.getRecord(); + tsud.setPassword(callerhelper.getPasswordEncriptado(super.getMfilelds().get("p").toString())); + tsud.setChangepassword("Y"); + userdetail.update(); + userdetail.save(); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Valida que el usuario ingrese la contrasena y la contrasena de validacion + * y que las dos sean iguales. + * + * @return boolean + * @throws Exception + */ + private boolean passwordvalidate() throws Exception { + Object p = super.getFieldvalue("p"); + Object np = super.getFieldvalue("np"); + if (p == null || np == null) { + MessageHelper.setMessageError("msg_passwordrequired"); + return false; + } + if (!p.equals(np)) { + MessageHelper.setMessageError("msg_passwordnomatch"); + return false; + } + return true; + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Entrega el valor de: userdetail + * + * @return UserDetailController + */ + public UserDetailController getUserdetail() { + return userdetail; + } + + /** + * Fija el valor de: userdetail + * + * @param userdetail Valor a fijar en el atributo. + */ + public void setUserdetail(UserDetailController userdetail) { + this.userdetail = userdetail; + } + + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + this.userdetail.getMfilters().clear(); + this.getMfilelds().clear(); + this.userdetail.addFilter("pk.personcode", t.getPk().getPersoncode().toString()); + this.userdetail.addField("personname", t.getName()); + this.userdetail.querydatabase(); + this.addFilter("pk.usercode", this.userdetail.getRecord().getPk().getUsercode()); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/UserDetailController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/UserDetailController.java new file mode 100644 index 0000000..4a86b39 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/UserDetailController.java @@ -0,0 +1,190 @@ +package com.fp.frontend.controller.pgeneral.safe; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.fun.TarmRegistroArmas; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TsafeUserDetail. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class UserDetailController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public UserDetailController() throws Exception { + super(TsafeUserDetail.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.record = new TsafeUserDetail(); + this.lrecord = new ArrayList<>(); + this.beanalias = "USERDETAIL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void create() throws Exception { + super.create(); + if (this.getMfilters().get("pk.personcode") != null) { + this.record.getPk().setPersoncode(Integer.valueOf(this.getMfilters().get("pk.personcode"))); + } + this.record.setCompanycode(super.getLoginController().getRequest().getCompany()); + this.record.setUserstatuscatalogcode("USERSTATUS"); + this.record.setUserstatuscatalog("ENT"); + this.record.setChangepassword("Y"); + } + + @Override + protected void querydatabase() { + try { + if (!super.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + Request request = this.callerhelper.getRequest(); + super.addFilterDateto(); + super.addFilter("companycode", super.getLoginController().getRequest().getCompany() + .toString()); + DtoQuery dto = super.getDtoQuery(false); + dto.setOrderby("t.pk"); // En en string van todos los campos de + // orden ("t.pk, t.nombre, t.cpais"). + + // subqueries + SubQuery subquery = new SubQuery("TgeneChannels", "description", "chanelname", "i.pk = t.channelcode"); + dto.addSubQuery(subquery); + + SubQuery subquerya = new SubQuery("TgeneArea", "descripction", "areaname", + "i.pk.companycode = t.companycode and i.pk.areacode = t.areacode "); + dto.addSubQuery(subquerya); + + SubQuery subquerys = new SubQuery("TgeneCatalogDetail", "description", "statusdesc", + "i.pk.catalogcode = t.userstatuscatalogcode and i.pk.catalog = t.userstatuscatalog "); + dto.addSubQuery(subquerys); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.record = null; + MessageHelper.setMessageError(resp); + } else { + this.manageresponse(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private void manageresponse(Response resp) throws Exception { + + this.record = (TsafeUserDetail) resp.get(this.beanalias); + if (this.record == null) { + //si no existe crea un registro para permitir el ingreso.s + this.create(); + } else { + super.addFilter("pk.usercode", this.record.getPk().getUsercode()); + super.postQuery((AbstractDataTransport) resp.get(this.beanalias)); + } + if ((super.getMfilelds().get("personname") == null)) { + if ((super.getMfilters().get("pk.personcode") != null) || (this.record.getPk().getPersoncode() != null)) { + String personcode = super.getMfilters().get("pk.personcode") != null ? super.getMfilters().get("pk.personcode") : this.record.getPk().getPersoncode().toString(); + TcustPersonDetail tcpd = PersonLovController.find(personcode); + super.addField("personname", tcpd != null ? tcpd.getName() : ""); + } + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + super.addFilter("pk.personcode", t.getPk().getPersoncode().toString()); + super.addField("personname", t.getName()); + } + + public void update(TsafeUserDetail bean) throws Exception { + record = bean; + update(); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/UserPerfilAssiggnationController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/UserPerfilAssiggnationController.java new file mode 100644 index 0000000..f167dd6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/UserPerfilAssiggnationController.java @@ -0,0 +1,247 @@ +package com.fp.frontend.controller.pgeneral.safe; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.AreaController; +import com.fp.frontend.controller.pgeneral.gene.BranchController; +import com.fp.frontend.controller.pgeneral.gene.ChannelController; +import com.fp.frontend.controller.pgeneral.gene.LanguageController; +import com.fp.frontend.controller.pgeneral.gene.OfficeController; +import com.fp.frontend.controller.pgeneral.lov.ProfileLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneArea; +import com.fp.persistence.pgeneral.gene.TgeneBranch; +import com.fp.persistence.pgeneral.gene.TgeneChannels; +import com.fp.persistence.pgeneral.gene.TgeneLanguage; +import com.fp.persistence.pgeneral.gene.TgeneOffice; +import com.fp.persistence.pgeneral.safe.TsafeProfile; + +/** + * Clase controladora del bean TsafeUserDetail. + * + * @author Andres E. Carpio + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class UserPerfilAssiggnationController extends AbstractController { + + private static final long serialVersionUID = 1L; + List lChannel; + List lBranch; + List lOffice; + List lArea; + List lLanguage; + + @ManagedProperty(value = "#{userDetailController}") + private UserDetailController userdetail; + + @ManagedProperty(value = "#{userProfileController}") + private UserProfileController userProfile; + + public UserPerfilAssiggnationController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + this.lChannel = ChannelController.find(); + this.lBranch = BranchController.find(super.getLoginController().getRequest().getCompany() + .toString()); + this.lArea = AreaController.find(super.getLoginController().getRequest().getCompany() + .toString()); + this.lLanguage = LanguageController.find(); + + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.lrecord = new ArrayList<>(); + this.beanalias = "CHANGEPASSADMIN"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void loadOffice() { + this.lOffice = OfficeController.find( + this.userdetail.getRecord().getBranchcode().toString(), super.getLoginController() + .getRequest().getCompany().toString()); + } + + @Override + protected void querydatabase() { + try { + if (!this.userdetail.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + this.userdetail.querydatabase(); + if (this.userdetail.getRecord().getPk().getUsercode() != null) { + this.userProfile.getMfilters().put("pk.usercode", this.userdetail.getRecord().getPk().getUsercode()); + this.userProfile.querydatabase(); + this.loadOffice(); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + this.userdetail.update(); + + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + + DtoSave dtosave = this.userdetail.getDtoSave(); + if (dtosave.pendingProcess()) { + dtosave.setIsForm(true); + msave.put(this.userdetail.getBeanalias(), dtosave); + } + DtoSave dtosaveup = this.userProfile.getDtoSave(); + if (dtosaveup.pendingProcess()) { + msave.put(this.userProfile.getBeanalias(), dtosaveup); + } + request.put("PANTALLA", "USUARIOSPERFIL_MOD1_TX120"); + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + this.userdetail.postCommit(response); + this.userProfile.postCommit(response); + } + + /** + * Entrega el valor de: userdetail + * + * @return UserDetailController + */ + public UserDetailController getUserdetail() { + return this.userdetail; + } + + /** + * Fija el valor de: userdetail + * + * @param userdetail Valor a fijar en el atributo. + */ + public void setUserdetail(UserDetailController userdetail) { + this.userdetail = userdetail; + } + + /** + * @return the userProfile + */ + public UserProfileController getUserProfile() { + return this.userProfile; + } + + /** + * @param userProfile the userProfile to set + */ + public void setUserProfile(UserProfileController userProfile) { + this.userProfile = userProfile; + } + + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + this.userdetail.addFilter("pk.personcode", t.getPk().getPersoncode().toString()); + this.userdetail.addField("personname", t.getName()); + this.querydatabase(); + } + + public List getlChannel() { + return this.lChannel; + } + + public void setlChannel(List lChannel) { + this.lChannel = lChannel; + } + + public List getlBranch() { + return this.lBranch; + } + + public void setlBranch(List lBranch) { + this.lBranch = lBranch; + } + + public List getlOffice() { + return this.lOffice; + } + + public void setlOffice(List lOffice) { + this.lOffice = lOffice; + } + + public List getlArea() { + return this.lArea; + } + + public void setlArea(List lArea) { + this.lArea = lArea; + } + + public List getlLanguage() { + return this.lLanguage; + } + + public void setlLanguage(List lLanguage) { + this.lLanguage = lLanguage; + } + + public void openProfileLov() { + Map> params = new HashMap<>(); + ProfileLovController.openLov(params); + } + + public void onReturnProfileLov(SelectEvent event) throws Exception { + TsafeProfile t = (TsafeProfile) event.getObject(); + //super.addFilter("pk.profilecode", t.getPk()); + //super.addField("description", t.getDescription()); + this.userProfile.create(); + this.userProfile.getRecord().getPk().setUsercode(this.userdetail.getRecord().getPk().getUsercode()); + this.userProfile.getRecord().getPk().setProfilecode(t.getPk()); + this.userProfile.getRecord().put("profiledesc", t.getDescription()); + this.userProfile.update(); + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/UserProfileController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/UserProfileController.java new file mode 100644 index 0000000..fb17f86 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/safe/UserProfileController.java @@ -0,0 +1,126 @@ +package com.fp.frontend.controller.pgeneral.safe; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.safe.TsafeUserProfile; + +/** + * Clase controladora del bean TsafeUserProfile. + * + * @author Andres E. Carpio + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class UserProfileController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public UserProfileController() throws Exception { + super(TsafeUserProfile.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "SPROFILE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + super.addFilterDateto(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.profilecode"); + + // subqueries + SubQuery subquery = new SubQuery("TsafeProfile", "description", "profiledesc", + "i.pk = t.pk.profilecode"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/trans/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/trans/.svn/entries new file mode 100644 index 0000000..2f391b7 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/trans/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/pgeneral/trans +svn://172.17.26.185/COMACO + + + +2014-10-30T10:05:26.090607Z +2228 +wpatino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +TransactionReportController.java +file + + + + +2022-07-28T03:39:55.405598Z +983e33bd675bbed3bd090010cb7a7b0e +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6266 + +TransactionProcessController.java +file + + + + +2022-07-28T03:39:55.405598Z +43cc90cc133a5a323d11792d7473ef74 +2014-10-30T10:05:26.090607Z +2228 +wpatino + + + + + + + + + + + + + + + + + + + + + +10471 + +TransactionController.java +file + + + + +2022-07-28T03:39:55.405598Z +6c1b86150c2419c7040a0ec9f5a123e4 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +5287 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/trans/.svn/text-base/TransactionController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/trans/.svn/text-base/TransactionController.java.svn-base new file mode 100644 index 0000000..16a671d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/trans/.svn/text-base/TransactionController.java.svn-base @@ -0,0 +1,192 @@ +package com.fp.frontend.controller.pgeneral.trans; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.MessageTemplatesLovController; +import com.fp.frontend.controller.pgeneral.message.MessageTemplatesController; +import com.fp.frontend.controller.pgeneral.product.ModuleController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplates; +import com.fp.persistence.pgeneral.product.TgeneModule; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * Clase controladora del bean TgeneTransaction. + * + * @author Andres E. Carpio + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TransactionController extends AbstractController { + + private static final long serialVersionUID = 1L; + List lmodule; + List lmessage; + + public TransactionController() throws Exception { + super(TgeneTransaction.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + this.lmodule = ModuleController.find(); + this.lmessage = MessageTemplatesController.find(); + + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TRANSACTION"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.transactionmodule, t.pk.transactioncode, t.pk.transactionversion, name"); + + // subqueries + SubQuery subquery = new SubQuery("TgeneMessageTemplates", "description", "messagedesc", + "i.pk = t.messagecode"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void openMessageTemplateLov() { + Map> params = new HashMap<>(); + MessageTemplatesLovController.openLov(params); + } + + public void onReturnMessageTemplateLov(SelectEvent event) throws Exception { + TgeneMessageTemplates t = (TgeneMessageTemplates) event.getObject(); + this.record.setMessagecode(t.getPk()); + this.record.put("messagedesc", t.getDescription()); + } + + public void removemessage() throws Exception { + if(record != null){ + record.setMessagecode(null); + record.modifiedData.put("messagedesc", null); + } + } + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Entrega el valor de: lmodule + * + * @return List + */ + public List getLmodule() { + return this.lmodule; + } + + /** + * Fija el valor de: lmodule + * + * @param lmodule Valor a fijar en el atributo. + */ + + public void setLmodule(List lmodule) { + this.lmodule = lmodule; + } + + /** + * Entrega el valor de: lmessage + * + * @return List + */ + public List getLmessage() { + return this.lmessage; + } + + /** + * Fija el valor de: lmessage + * + * @param lmessage Valor a fijar en el atributo. + */ + + public void setLmessage(List lmessage) { + this.lmessage = lmessage; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/trans/.svn/text-base/TransactionProcessController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/trans/.svn/text-base/TransactionProcessController.java.svn-base new file mode 100644 index 0000000..e410469 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/trans/.svn/text-base/TransactionProcessController.java.svn-base @@ -0,0 +1,333 @@ +package com.fp.frontend.controller.pgeneral.trans; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pbpm.lov.TbpmRulesLovController; +import com.fp.frontend.controller.pgeneral.lov.MessageTemplatesLovController; +import com.fp.frontend.controller.pgeneral.lov.ProcessLovControler; +import com.fp.frontend.controller.pgeneral.lov.TransactionLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmRules; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplates; +import com.fp.persistence.pgeneral.proc.TgeneProcess; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; +import com.fp.persistence.pgeneral.trans.TgeneTransactionProcess; + +/** + * Clase controladora del bean TgeneTransactionProcess. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TransactionProcessController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public TransactionProcessController() throws Exception { + super(TgeneTransactionProcess.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOG"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.transactionmodule") == null) { + MessageHelper.setMessageError("msg_transactionrequird"); + return; + } + super.create(); + this.record.getPk().setTransactionmodule(super.getMfilters().get("pk.transactionmodule")); + this.record.getPk().setTransactioncode(Integer.valueOf(super.getMfilters().get("pk.transactioncode"))); + this.record.getPk().setTransactionversion(Integer.valueOf(super.getMfilters().get("pk.transactionversion"))); + this.record.setCatalogcodetypeprocess("PROCESSTYPE"); + this.record.setCatalogtypeprocess("TRANSACTION"); + } + + /** + * Actualiza datos de registros nuevos o modifiados, si el registro es nuevo + * se adiciona a lista de nuevos, si es actualizado se adiciona a la lista + * de actualizados. + * + * @throws Exception + */ + @Override + public void update() throws Exception { + if(record.getProcesscode() == null){ + MessageHelper.setMessageError("msg_processrequired"); + return; + } + super.update(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + super.addFilter("catalogtypeprocess", "TRANSACTION"); + if(super.getMfilters().get("pk.transactioncode")==null){ + MessageHelper.setMessageError("msg_catalogrequird"); + return; + } + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.executionorder"); + + // subqueries + SubQuery subquery = new SubQuery("TgeneProcess", "shortdesc", "nprocess", + "i.pk.processcode = t.processcode and i.pk.catalogtypeprocess = t.catalogtypeprocess"); + dto.addSubQuery(subquery); + + // subqueries 1 + SubQuery subquery1 = new SubQuery("TgeneMessageTemplates", "description", "messagedesc", + "i.pk = t.flowmessagecode"); + dto.addSubQuery(subquery1); + + // subqueries 2 + SubQuery subquery2 = new SubQuery("TbpmRules", "description", "flowdesc", + "i.pk.rulecode = t.processname and i.pk.companycode = "+super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subquery2); + + // subqueries 3 + SubQuery subquery3 = new SubQuery("TgeneProcess", "shortdesc", "processdesc", + "i.pk.processcode = t.processcode and i.pk.catalogtypeprocess=t.catalogtypeprocess and i.pk.catalogcodetypeprocess=t.catalogcodetypeprocess"); + dto.addSubQuery(subquery3); + + // subqueries 3 + SubQuery subquery4 = new SubQuery("TbpmRules", "description", "ruledesc", + "i.pk.rulecode = t.rulename and i.pk.companycode = "+super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subquery4); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Abre el lov de transacciones + */ + public void openTransactionLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("TRANSACTION"); // valor del parametro + params.put("processtype", l); + + TransactionLovController.openLov(params); + } + + /** + * Gestiona la respuesta del lov de transacciones + * @param event + * @throws Exception + */ + public void onReturnTransactionLov(SelectEvent event) throws Exception { + TgeneTransaction t = (TgeneTransaction) event.getObject(); + super.addFilter("pk.transactionmodule", t.getPk().getTransactionmodule()); + super.addFilter("pk.transactioncode", t.getPk().getTransactioncode().toString()); + super.addFilter("pk.transactionversion", t.getPk().getTransactionversion().toString()); + super.addField("transactionname", t.getName()); + this.query(); + } + + /** + * Abre el lov de comandos + */ + public void openProcessLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("TRANSACTION"); // valor del parametro + params.put("processtype", l); + ProcessLovControler.openLov(params); + } + + /** + * Gestiona la respuesta del lov de comandos + * @param event + * @throws Exception + */ + public void onReturnPrcoessLov(SelectEvent event) throws Exception { + TgeneProcess t = (TgeneProcess) event.getObject(); + this.record.setProcesscode(t.getPk().getProcesscode()); + this.record.put("nprocess", t.getShortdesc()); + } + + /** + * Llama al Lov de Mensajes + */ + public void openMessageTemplateLov() { + Map> params = new HashMap<>(); + MessageTemplatesLovController.openLov(params); + } + + /** + * Gestiona la respuesta del Lov de Mensajes + * @param event + * @throws Exception + */ + public void onReturnMessageTemplateLov(SelectEvent event) throws Exception { + TgeneMessageTemplates t = (TgeneMessageTemplates) event.getObject(); + this.record.setFlowmessagecode(t.getPk().toString()); + this.record.put("messagedesc", t.getDescription()); + } + + /** + * Elimina el codigo de mensaje + * @throws Exception + */ + public void removemessage() throws Exception { + if(record != null){ + record.setFlowmessagecode(null); + record.modifiedData.put("messagedesc", null); + } + } + + /** + * Llama al Lov de Mensajes + */ + public void openFlowLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("F"); // valor del parametro + params.put("filetype", l); + TbpmRulesLovController.openLov(params); + } + + /** + * Gestiona la respuesta del Lov de Mensajes + * @param event + * @throws Exception + */ + public void onReturnFlowLov(SelectEvent event) throws Exception { + TbpmRules t = (TbpmRules) event.getObject(); + this.record.setProcessname(t.getPk().getRulecode()); + //this.record.setPackagename(t.getPackagename()); + this.record.put("flowdesc", t.getDescription()); + } + + /** + * Elimina el codigo de mensaje + * @throws Exception + */ + public void removeflow() throws Exception { + if(record != null){ + record.setProcessname(null); + record.modifiedData.put("flowdesc", null); + } + } + + /** + * Llama al Lov de Mensajes + */ + public void openRuleLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("R"); // valor del parametro + params.put("filetype", l); + TbpmRulesLovController.openLov(params); + } + + /** + * Gestiona la respuesta del Lov de Mensajes + * @param event + * @throws Exception + */ + public void onReturnRuleLov(SelectEvent event) throws Exception { + TbpmRules t = (TbpmRules) event.getObject(); + this.record.setRulename(t.getPk().getRulecode()); + this.record.put("ruledesc", t.getDescription()); + } + + /** + * Elimina el codigo de mensaje + * @throws Exception + */ + public void removerule() throws Exception { + if(record != null){ + record.setRulename(null); + record.modifiedData.put("ruledesc", null); + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/trans/.svn/text-base/TransactionReportController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/trans/.svn/text-base/TransactionReportController.java.svn-base new file mode 100644 index 0000000..62eb9ff --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/trans/.svn/text-base/TransactionReportController.java.svn-base @@ -0,0 +1,200 @@ +package com.fp.frontend.controller.pgeneral.trans; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.ProcessLovControler; +import com.fp.frontend.controller.pgeneral.lov.TransactionLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.proc.TgeneProcess; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; +import com.fp.persistence.pgeneral.trans.report.TgeneTransactionReports; + +/** + * Clase controladora del bean TgeneTransactionReports. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TransactionReportController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public TransactionReportController() throws Exception { + super(TgeneTransactionReports.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TREPORT"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionReports y marca el registro como nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.transactionmodule") == null) { + MessageHelper.setMessageError("msg_transactionrequird"); + return; + } + super.create(); + this.record.getPk().setTransactionmodule(super.getMfilters().get("pk.transactionmodule")); + this.record.getPk().setTransactioncode(Integer.valueOf(super.getMfilters().get("pk.transactioncode"))); + this.record.getPk().setTransactionversion(Integer.valueOf(super.getMfilters().get("pk.transactionversion"))); + this.record.setCatalogcodetypeprocess("PROCESSTYPE"); + this.record.setCatalogtypeprocess("REPORT"); + } + + /** + * Actualiza datos de registros nuevos o modifiados, si el registro es nuevo + * se adiciona a lista de nuevos, si es actualizado se adiciona a la lista + * de actualizados. + * + * @throws Exception + */ + @Override + public void update() throws Exception { + if(record.getProcesscode() == null){ + MessageHelper.setMessageError("msg_processrequired"); + return; + } + super.update(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + super.addFilter("catalogtypeprocess", "REPORT"); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.executionorder"); + + // subqueries + SubQuery subquery = new SubQuery("TgeneProcess", "shortdesc", "nprocess", + "i.pk.processcode = t.processcode and i.pk.catalogtypeprocess = t.catalogtypeprocess"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public void openTransactionLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("TRANSACTION"); // valor del parametro + params.put("processtype", l); + + TransactionLovController.openLov(params); + } + + public void onReturnTransactionLov(SelectEvent event) throws Exception { + TgeneTransaction t = (TgeneTransaction) event.getObject(); + super.addFilter("pk.transactionmodule", t.getPk().getTransactionmodule()); + super.addFilter("pk.transactioncode", t.getPk().getTransactioncode().toString()); + super.addFilter("pk.transactionversion", t.getPk().getTransactionversion().toString()); + super.addField("transactionname", t.getName()); + this.query(); + } + + /** + * Abre el lov de comandos + */ + public void openProcessLov() { + Map> params = new HashMap<>(); + ProcessLovControler.openLov(params); + } + + /** + * Gestiona la respuesta del lov de comandos + * @param event + * @throws Exception + */ + public void onReturnPrcoessLov(SelectEvent event) throws Exception { + TgeneProcess t = (TgeneProcess) event.getObject(); + this.record.setProcesscode(t.getPk().getProcesscode()); + this.record.put("processdesc", t.getShortdesc()); + } + +} + + diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/trans/TransactionController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/trans/TransactionController.java new file mode 100644 index 0000000..5335b5e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/trans/TransactionController.java @@ -0,0 +1,191 @@ +package com.fp.frontend.controller.pgeneral.trans; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.MessageTemplatesLovController; +import com.fp.frontend.controller.pgeneral.message.MessageTemplatesController; +import com.fp.frontend.controller.pgeneral.product.ModuleController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplates; +import com.fp.persistence.pgeneral.product.TgeneModule; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; + +/** + * Clase controladora del bean TgeneTransaction. + * + * @author Andres E. Carpio + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TransactionController extends AbstractController { + + private static final long serialVersionUID = 1L; + List lmodule; + List lmessage; + + public TransactionController() throws Exception { + super(TgeneTransaction.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + this.lmodule = ModuleController.find(); + this.lmessage = MessageTemplatesController.find(); + + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TRANSACTION"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk.transactionmodule, t.pk.transactioncode, t.pk.transactionversion, name"); + + // subqueries + SubQuery subquery = new SubQuery("TgeneMessageTemplates", "description", "messagedesc", + "i.pk = t.messagecode"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de + // mantenimiento para cada + // tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void openMessageTemplateLov() { + Map> params = new HashMap<>(); + MessageTemplatesLovController.openLov(params); + } + + public void onReturnMessageTemplateLov(SelectEvent event) throws Exception { + TgeneMessageTemplates t = (TgeneMessageTemplates) event.getObject(); + this.record.setMessagecode(t.getPk()); + this.record.put("messagedesc", t.getDescription()); + } + + public void removemessage() throws Exception { + if (record != null) { + record.setMessagecode(null); + record.modifiedData.put("messagedesc", null); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Entrega el valor de: lmodule + * + * @return List + */ + public List getLmodule() { + return this.lmodule; + } + + /** + * Fija el valor de: lmodule + * + * @param lmodule Valor a fijar en el atributo. + */ + public void setLmodule(List lmodule) { + this.lmodule = lmodule; + } + + /** + * Entrega el valor de: lmessage + * + * @return List + */ + public List getLmessage() { + return this.lmessage; + } + + /** + * Fija el valor de: lmessage + * + * @param lmessage Valor a fijar en el atributo. + */ + public void setLmessage(List lmessage) { + this.lmessage = lmessage; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/trans/TransactionProcessController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/trans/TransactionProcessController.java new file mode 100644 index 0000000..c9e0ee5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/trans/TransactionProcessController.java @@ -0,0 +1,343 @@ +package com.fp.frontend.controller.pgeneral.trans; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pbpm.lov.TbpmRulesLovController; +import com.fp.frontend.controller.pgeneral.lov.MessageTemplatesLovController; +import com.fp.frontend.controller.pgeneral.lov.ProcessLovControler; +import com.fp.frontend.controller.pgeneral.lov.TransactionLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pbpm.gene.TbpmRules; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplates; +import com.fp.persistence.pgeneral.proc.TgeneProcess; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; +import com.fp.persistence.pgeneral.trans.TgeneTransactionProcess; + +/** + * Clase controladora del bean TgeneTransactionProcess. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TransactionProcessController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public TransactionProcessController() throws Exception { + super(TgeneTransactionProcess.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOG"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionProcess y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.transactionmodule") == null) { + MessageHelper.setMessageError("msg_transactionrequird"); + return; + } + super.create(); + this.record.getPk().setTransactionmodule(super.getMfilters().get("pk.transactionmodule")); + this.record.getPk().setTransactioncode(Integer.valueOf(super.getMfilters().get("pk.transactioncode"))); + this.record.getPk().setTransactionversion(Integer.valueOf(super.getMfilters().get("pk.transactionversion"))); + this.record.setCatalogcodetypeprocess("PROCESSTYPE"); + this.record.setCatalogtypeprocess("TRANSACTION"); + } + + /** + * Actualiza datos de registros nuevos o modifiados, si el registro es nuevo + * se adiciona a lista de nuevos, si es actualizado se adiciona a la lista + * de actualizados. + * + * @throws Exception + */ + @Override + public void update() throws Exception { + if (record.getProcesscode() == null) { + MessageHelper.setMessageError("msg_processrequired"); + return; + } + super.update(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + super.addFilter("catalogtypeprocess", "TRANSACTION"); + if (super.getMfilters().get("pk.transactioncode") == null) { + MessageHelper.setMessageError("msg_catalogrequird"); + return; + } + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.executionorder"); + + // subqueries + SubQuery subquery = new SubQuery("TgeneProcess", "shortdesc", "nprocess", + "i.pk.processcode = t.processcode and i.pk.catalogtypeprocess = t.catalogtypeprocess"); + dto.addSubQuery(subquery); + + // subqueries 1 + SubQuery subquery1 = new SubQuery("TgeneMessageTemplates", "description", "messagedesc", + "i.pk = t.flowmessagecode"); + dto.addSubQuery(subquery1); + + // subqueries 2 + SubQuery subquery2 = new SubQuery("TbpmRules", "description", "flowdesc", + "i.pk.rulecode = t.processname and i.pk.companycode = " + super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subquery2); + + // subqueries 3 + SubQuery subquery3 = new SubQuery("TgeneProcess", "shortdesc", "processdesc", + "i.pk.processcode = t.processcode and i.pk.catalogtypeprocess=t.catalogtypeprocess and i.pk.catalogcodetypeprocess=t.catalogcodetypeprocess"); + dto.addSubQuery(subquery3); + + // subqueries 3 + SubQuery subquery4 = new SubQuery("TbpmRules", "description", "ruledesc", + "i.pk.rulecode = t.rulename and i.pk.companycode = " + super.getLoginController().getRequest().getCompany().toString()); + dto.addSubQuery(subquery4); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Abre el lov de transacciones + */ + public void openTransactionLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("TRANSACTION"); // valor del parametro + params.put("processtype", l); + + TransactionLovController.openLov(params); + } + + /** + * Gestiona la respuesta del lov de transacciones + * + * @param event + * @throws Exception + */ + public void onReturnTransactionLov(SelectEvent event) throws Exception { + TgeneTransaction t = (TgeneTransaction) event.getObject(); + super.addFilter("pk.transactionmodule", t.getPk().getTransactionmodule()); + super.addFilter("pk.transactioncode", t.getPk().getTransactioncode().toString()); + super.addFilter("pk.transactionversion", t.getPk().getTransactionversion().toString()); + super.addField("transactionname", t.getName()); + this.query(); + } + + /** + * Abre el lov de comandos + */ + public void openProcessLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("TRANSACTION"); // valor del parametro + params.put("processtype", l); + ProcessLovControler.openLov(params); + } + + /** + * Gestiona la respuesta del lov de comandos + * + * @param event + * @throws Exception + */ + public void onReturnPrcoessLov(SelectEvent event) throws Exception { + TgeneProcess t = (TgeneProcess) event.getObject(); + this.record.setProcesscode(t.getPk().getProcesscode()); + this.record.put("nprocess", t.getShortdesc()); + } + + /** + * Llama al Lov de Mensajes + */ + public void openMessageTemplateLov() { + Map> params = new HashMap<>(); + MessageTemplatesLovController.openLov(params); + } + + /** + * Gestiona la respuesta del Lov de Mensajes + * + * @param event + * @throws Exception + */ + public void onReturnMessageTemplateLov(SelectEvent event) throws Exception { + TgeneMessageTemplates t = (TgeneMessageTemplates) event.getObject(); + this.record.setFlowmessagecode(t.getPk().toString()); + this.record.put("messagedesc", t.getDescription()); + } + + /** + * Elimina el codigo de mensaje + * + * @throws Exception + */ + public void removemessage() throws Exception { + if (record != null) { + record.setFlowmessagecode(null); + record.modifiedData.put("messagedesc", null); + } + } + + /** + * Llama al Lov de Mensajes + */ + public void openFlowLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("F"); // valor del parametro + params.put("filetype", l); + TbpmRulesLovController.openLov(params); + } + + /** + * Gestiona la respuesta del Lov de Mensajes + * + * @param event + * @throws Exception + */ + public void onReturnFlowLov(SelectEvent event) throws Exception { + TbpmRules t = (TbpmRules) event.getObject(); + this.record.setProcessname(t.getPk().getRulecode()); + //this.record.setPackagename(t.getPackagename()); + this.record.put("flowdesc", t.getDescription()); + } + + /** + * Elimina el codigo de mensaje + * + * @throws Exception + */ + public void removeflow() throws Exception { + if (record != null) { + record.setProcessname(null); + record.modifiedData.put("flowdesc", null); + } + } + + /** + * Llama al Lov de Mensajes + */ + public void openRuleLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("R"); // valor del parametro + params.put("filetype", l); + TbpmRulesLovController.openLov(params); + } + + /** + * Gestiona la respuesta del Lov de Mensajes + * + * @param event + * @throws Exception + */ + public void onReturnRuleLov(SelectEvent event) throws Exception { + TbpmRules t = (TbpmRules) event.getObject(); + this.record.setRulename(t.getPk().getRulecode()); + this.record.put("ruledesc", t.getDescription()); + } + + /** + * Elimina el codigo de mensaje + * + * @throws Exception + */ + public void removerule() throws Exception { + if (record != null) { + record.setRulename(null); + record.modifiedData.put("ruledesc", null); + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/pgeneral/trans/TransactionReportController.java b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/trans/TransactionReportController.java new file mode 100644 index 0000000..3a4ca12 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/pgeneral/trans/TransactionReportController.java @@ -0,0 +1,201 @@ +package com.fp.frontend.controller.pgeneral.trans; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.lov.ProcessLovControler; +import com.fp.frontend.controller.pgeneral.lov.TransactionLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.proc.TgeneProcess; +import com.fp.persistence.pgeneral.trans.TgeneTransaction; +import com.fp.persistence.pgeneral.trans.report.TgeneTransactionReports; + +/** + * Clase controladora del bean TgeneTransactionReports. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class TransactionReportController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public TransactionReportController() throws Exception { + super(TgeneTransactionReports.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TREPORT"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Crea una instancia de TgeneTransactionReports y marca el registro como + * nuevo. + * + * @throws Exception + */ + @Override + public void create() throws Exception { + if (super.getMfilters().get("pk.transactionmodule") == null) { + MessageHelper.setMessageError("msg_transactionrequird"); + return; + } + super.create(); + this.record.getPk().setTransactionmodule(super.getMfilters().get("pk.transactionmodule")); + this.record.getPk().setTransactioncode(Integer.valueOf(super.getMfilters().get("pk.transactioncode"))); + this.record.getPk().setTransactionversion(Integer.valueOf(super.getMfilters().get("pk.transactionversion"))); + this.record.setCatalogcodetypeprocess("PROCESSTYPE"); + this.record.setCatalogtypeprocess("REPORT"); + } + + /** + * Actualiza datos de registros nuevos o modifiados, si el registro es nuevo + * se adiciona a lista de nuevos, si es actualizado se adiciona a la lista + * de actualizados. + * + * @throws Exception + */ + @Override + public void update() throws Exception { + if (record.getProcesscode() == null) { + MessageHelper.setMessageError("msg_processrequired"); + return; + } + super.update(); + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + super.addFilter("catalogtypeprocess", "REPORT"); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.executionorder"); + + // subqueries + SubQuery subquery = new SubQuery("TgeneProcess", "shortdesc", "nprocess", + "i.pk.processcode = t.processcode and i.pk.catalogtypeprocess = t.catalogtypeprocess"); + dto.addSubQuery(subquery); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + Request request = this.callerhelper.getRequest(); + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + DtoSave dtosave = super.getDtoSave(); + dtosave.setReturnpk(true); // Para que el core devuelva el pk de los registros nuevos. + HashMap msave = new HashMap(); + + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + public void openTransactionLov() { + Map> params = new HashMap<>(); + List l = new ArrayList<>(); + l.add("TRANSACTION"); // valor del parametro + params.put("processtype", l); + + TransactionLovController.openLov(params); + } + + public void onReturnTransactionLov(SelectEvent event) throws Exception { + TgeneTransaction t = (TgeneTransaction) event.getObject(); + super.addFilter("pk.transactionmodule", t.getPk().getTransactionmodule()); + super.addFilter("pk.transactioncode", t.getPk().getTransactioncode().toString()); + super.addFilter("pk.transactionversion", t.getPk().getTransactionversion().toString()); + super.addField("transactionname", t.getName()); + this.query(); + } + + /** + * Abre el lov de comandos + */ + public void openProcessLov() { + Map> params = new HashMap<>(); + ProcessLovControler.openLov(params); + } + + /** + * Gestiona la respuesta del lov de comandos + * + * @param event + * @throws Exception + */ + public void onReturnPrcoessLov(SelectEvent event) throws Exception { + TgeneProcess t = (TgeneProcess) event.getObject(); + this.record.setProcesscode(t.getPk().getProcesscode()); + this.record.put("processdesc", t.getShortdesc()); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/security/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/security/.svn/entries new file mode 100644 index 0000000..1d3bc54 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/security/.svn/entries @@ -0,0 +1,337 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/security +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ActivateUserController.java +file + + + + +2022-07-28T03:39:54.787596Z +9eb5222def02c980f5b3a25753b187b9 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +5479 + +ChangePassPersonalController.java +file + + + + +2022-07-28T03:39:54.787596Z +a936e25b114b784669526603ee4c0a56 +2021-11-16T16:51:39.601018Z +4651 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +19036 + +ProfileController.java +file + + + + +2022-07-28T03:39:54.787596Z +76312f2ce6c07b724b97977cd8d62f16 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +3437 + +ChangeExpiredPassPersonalController.java +file + + + + +2022-07-28T03:39:54.787596Z +bf1cb6e6811d2bd1b3609304ed692783 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +6383 + +PasswordController.java +file + + + + +2022-07-28T03:39:54.788596Z +86e9ffb27de2aaca2524bb560b76403e +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +6022 + +MenuProfileController.java +file + + + + +2022-07-28T03:39:54.788596Z +f3d81cf56d940f57fe8b19e35b0bd72d +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +5454 + +ModifyUserController.java +file + + + + +2022-07-28T03:39:54.788596Z +d39537c81b8e1ca955a20bd89e893259 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +16809 + +LoginController.java +file + + + + +2022-07-28T03:39:54.788596Z +9aeb65993656f2a0bda1d06c53dd452b +2021-12-02T13:46:41.478228Z +4655 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +19602 + +MaiaMenu.java +file + + + + +2022-07-28T03:39:54.789596Z +ccf771319c023632f9ec75f8de78d3b6 +2014-09-11T06:25:54.155494Z +660 +jvaca + + + + + + + + + + + + + + + + + + + + + +4293 + +reports +dir + diff --git a/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/ActivateUserController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/ActivateUserController.java.svn-base new file mode 100644 index 0000000..e04e3f0 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/ActivateUserController.java.svn-base @@ -0,0 +1,187 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.frontend.controller.security; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.safe.UserDetailController; +import com.fp.frontend.controller.pgeneral.safe.UserProfileController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; + +/** + * Clase controladora del bean TsafeUserDetail. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ActivateUserController extends AbstractController { + + private static final long serialVersionUID = 1L; + @ManagedProperty(value = "#{userDetailController}") + private UserDetailController userdetail; + @ManagedProperty(value = "#{userProfileController}") + private UserProfileController userprofile; + + public ActivateUserController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.lrecord = new ArrayList<>(); + this.beanalias = "CHANGEPASSADMIN"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + try { + if (!this.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + this.userdetail.getMfilters().clear(); + this.userdetail.getMfilelds().clear(); + this.userdetail.getMfilters().put("pk.usercode", this.getMfilters().get("pk.usercode")); + this.userdetail.query(); + this.getMfilelds().put("personname", this.userdetail.getMfilelds().get("personname")); + if (this.userdetail.getRecord().getPk().getUsercode() != null) { + this.userprofile.addFilter("pk.usercode", this.userdetail.getRecord().getPk().getUsercode()); + this.userprofile.query(); + }else{ + this.userprofile.setLrecord(null); + MessageHelper.setMessageError("msg_userNotFound"); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + if (this.validateUser()) { + MessageHelper.setMessageError("msg_userrequired"); + return; + } + if (this.userdetail.getRecord().getUserstatuscatalog().equals("ENT")) { + MessageHelper.setMessageError("msg_pendingActivation"); + return; + } + if(this.userdetail.getRecord().getPassword() == null){ + String passwd = this.callerhelper.getPasswordEncriptado(this.userdetail.getRecord().getPk().getUsercode()); + this.userdetail.getRecord().setPassword(passwd); + } + + this.userdetail.getRecord().setUserstatuscatalog("ACT"); + this.userdetail.update(); + this.userdetail.save(); + userdetail.getRecord().getModifiedData().put("statusdesc", "ACTIVO"); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private boolean validateUser() { + boolean result = false; + if (this.userdetail.getRecord().getPk() == null) { + result = true; + } + return result; + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Entrega el valor de: userdetail + * + * @return UserDetailController + */ + public UserDetailController getUserdetail() { + return this.userdetail; + } + + /** + * Fija el valor de: userdetail + * + * @param userdetail Valor a fijar en el atributo. + */ + public void setUserdetail(UserDetailController userdetail) { + this.userdetail = userdetail; + } + + /** + * Entrega el valor de: userprofile + * + * @return UserProfileController + */ + public UserProfileController getUserprofile() { + return this.userprofile; + } + + /** + * Fija el valor de: userprofile + * + * @param UserProfileController + */ + public void setUserprofile(UserProfileController userprofile) { + this.userprofile = userprofile; + } + + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + this.userdetail.getMfilters().clear(); + this.getMfilelds().clear(); + this.userdetail.addFilter("pk.personcode", t.getPk().getPersoncode().toString()); + this.userdetail.addField("personname", t.getName()); + this.userdetail.query(); + if(this.userdetail.getRecord().getPk().getUsercode()!=null){ + this.addFilter("pk.usercode", this.userdetail.getRecord().getPk().getUsercode()); + this.userprofile.addFilter("pk.usercode", this.userdetail.getRecord().getPk().getUsercode()); + this.userprofile.query(); + }else{ + MessageHelper.setMessageError("msg_userNotFound"); + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/ChangeExpiredPassPersonalController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/ChangeExpiredPassPersonalController.java.svn-base new file mode 100644 index 0000000..8169944 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/ChangeExpiredPassPersonalController.java.svn-base @@ -0,0 +1,209 @@ +/** + * + */ +package com.fp.frontend.controller.security; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TsafeUserDetail. + * + * @author amerchan + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ChangeExpiredPassPersonalController extends AbstractController implements Serializable{ + + private static final long serialVersionUID = 1L; + + public ChangeExpiredPassPersonalController() throws Exception { + super(TsafeUserDetail.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.create(); + this.lrecord = new ArrayList<>(); + this.beanalias = "TSAFEUSERDETAIL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void querydatabase() { + try { + + super.addFilter("pk.usercode", super.getLoginController().getRequest().getUser()); + super.addFilterDateto(); + super.addFilter("companycode", super.getLoginController().getRequest().getCompany().toString()); + + if (!this.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + + Request request = this.callerhelper.getRequest(); + request.setTransactionModule("1"); + request.setTransactionCode(123); + request.setTransactionVersion(1); + + DtoQuery dto = super.getDtoQuery(false); + dto.setOrderby("t.pk.personcode"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + // subqueries + SubQuery subquery = new SubQuery("TgeneChannels", "description", "chanelname", "i.pk = t.channelcode"); + dto.addSubQuery(subquery); + + SubQuery subquerya = new SubQuery("TgeneArea", "descripction", "areaname", + "i.pk.companycode = t.companycode and i.pk.areacode = t.areacode "); + dto.addSubQuery(subquerya); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.record = new TsafeUserDetail(); + MessageHelper.setMessageError(resp); + } else { + this.record = (TsafeUserDetail) resp.get(this.beanalias); + if (this.record != null) { + // this.userprofile.addFilter("pk.usercode", this.record.getPk().getUsercode()); + // this.userprofile.query(); + TcustPersonDetail tcpd = PersonLovController.find(this.record.getPk().getPersoncode().toString()); + super.addField("personname", tcpd != null ? tcpd.getName() : ""); + super.postQuery((AbstractDataTransport) resp.get(this.beanalias)); + } else { + // this.userprofile.setLrecord(null); + this.create(); + } + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + if (this.validateUser()) { + MessageHelper.setMessageError("msg_userrequired"); + return; + } + if (!this.passwordvalidate()) { + return; + } + + String oldPass = this.callerhelper.getPasswordEncriptado((String) this.getMfilelds().get("oldpassword")); + String newPass = this.callerhelper.getPasswordEncriptado((String) this.getMfilelds().get("newpassword")); + + this.record.put("newpassword", this.getMfilelds().get("newpassword")); + this.record.put("origination", newPass); + this.record.put("oldpassword", oldPass); + + this.record.setPassword(newPass); + if (this.record.getChangepassword().compareTo("Y") == 0) { + this.record.setChangepassword("N"); + } + this.update(); + + Request request = this.callerhelper.getRequest(); + request.setTransactionModule("1"); + request.setTransactionCode(123); + request.setTransactionVersion(1); + + HashMap msave = new HashMap(); + DtoSave dtoSavePassword = super.getDtoSave(); + dtoSavePassword.setIsForm(true); + if (!dtoSavePassword.pendingProcess()) { + return; + } + msave.put(this.beanalias, dtoSavePassword); + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private boolean validateUser() { + boolean result = false; + if (this.record.getPk() == null) { + result = true; + } + return result; + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + RequestContext.getCurrentInstance().execute("dialogChangePassword.hide()"); + } + + /** + * Valida que el usuario ingrese la contrasena y la contrasena de validacion + * y que las dos sean iguales. + * + * @return boolean + * @throws Exception + */ + private boolean passwordvalidate() throws Exception { + Object p = super.getFieldvalue("newpassword"); + Object np = super.getFieldvalue("confirmpassword"); + if ((p == null) || (np == null)) { + MessageHelper.setMessageError("msg_passwordrequired"); + return false; + } + if (!p.equals(np)) { + MessageHelper.setMessageError("msg_passwordnomatch"); + return false; + } + return true; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/ChangePassPersonalController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/ChangePassPersonalController.java.svn-base new file mode 100644 index 0000000..63b7b2c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/ChangePassPersonalController.java.svn-base @@ -0,0 +1,568 @@ +/** + * + */ +package com.fp.frontend.controller.security; + +import java.io.IOException; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.ExternalContext; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.message.MessageTemplatesController; +import com.fp.frontend.controller.pgeneral.message.MessageTemplatesDescController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.mail.Mail; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplates; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDesc; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TsafeUserDetail. + * + * @author Andres E. Carpio + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ChangePassPersonalController extends + AbstractController implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddress; + // @ManagedProperty(value = "#{userProfileController}") + // private UserProfileController userprofile; + + // Control para el mensaje de confirmacion + private boolean habilitaCampos = true; + + public ChangePassPersonalController() throws Exception { + super(TsafeUserDetail.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + // Query + this.querydatabase(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.create(); + this.lrecord = new ArrayList<>(); + this.beanalias = "TSAFEUSERDETAIL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + try { + + super.addFilter("pk.usercode", super.getLoginController() + .getRequest().getUser()); + super.addFilterDateto(); + super.addFilter("companycode", super.getLoginController() + .getRequest().getCompany().toString()); + + if (!this.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(false); + dto.setOrderby("t.pk.personcode"); // En en string van todos los + // campos de orden + // ("t.pk, t.nombre, t.cpais"). + + // subqueries + SubQuery subquery = new SubQuery("TgeneChannels", "description", + "chanelname", "i.pk = t.channelcode"); + dto.addSubQuery(subquery); + + SubQuery subqueryName = new SubQuery( + "TcustPersonDetail", + "name", + "name", + " i.pk.personcode = t.pk.personcode" + + " and i.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryName); + + SubQuery subquerya = new SubQuery("TgeneArea", "descripction", + "areaname", + "i.pk.companycode = t.companycode and i.pk.areacode = t.areacode "); + dto.addSubQuery(subquerya); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.record = new TsafeUserDetail(); + MessageHelper.setMessageError(resp); + } else { + this.record = (TsafeUserDetail) resp.get(this.beanalias); + if (this.record != null) { + // this.userprofile.addFilter("pk.usercode", + // this.record.getPk().getUsercode()); + // this.userprofile.query(); + TcustPersonDetail tcpd = PersonLovController + .find(this.record.getPk().getPersoncode() + .toString()); + super.addField("personname", tcpd != null ? tcpd.getName() + : ""); + TcustPersonAddress mail = personAddress + .findPersonaPorDireccionTipoCatalogo(this.record + .getPk().getPersoncode().toString(), "3"); + this.personAddress.setPersoncode(this.record.getPk() + .getPersoncode()); + if (mail != null) { + super.addField("email", mail.getAddress()); + personAddress.setRecord(mail); + } else { + personAddress.create(); + } + super.postQuery((AbstractDataTransport) resp + .get(this.beanalias)); + } else { + // this.userprofile.setLrecord(null); + this.create(); + } + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + if (this.validateUser()) { + MessageHelper.setMessageError("msg_userrequired"); + return; + } + if (!this.passwordvalidate()) { + return; + } + + String oldPass = this.callerhelper + .getPasswordEncriptado((String) this.getMfilelds().get( + "oldpassword")); + String newPass = this.callerhelper + .getPasswordEncriptado((String) this.getMfilelds().get( + "newpassword")); + + this.record.put("newpassword", this.getMfilelds() + .get("newpassword")); + this.record.put("origination", newPass); + this.record.put("oldpassword", oldPass); + + this.record.setPassword(newPass); + if (this.record.getChangepassword().compareTo("Y") == 0) { + this.record.setChangepassword("N"); + } + this.update(); + if (this.getMfilelds().get("email") != null) { + this.personAddress.getRecord().setAddress( + this.getMfilelds().get("email").toString()); + } + this.personAddress.update(); + + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + DtoSave dtoSavePassword = super.getDtoSave(); + dtoSavePassword.setIsForm(true); + dtoSavePassword.setPosition(1); + if (!dtoSavePassword.pendingProcess()) { + MessageHelper + .setMessageError(MsgControlArmas + .getProperty("msg_error_claveanteriornopuederserigualactual")); + return; + } + DtoSave dtosaveMail = personAddress.getDtoSave(); + dtosaveMail.setPosition(2); + msave.put(this.beanalias, dtoSavePassword); + msave.put(this.personAddress.getBeanalias(), dtosaveMail); + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.envioCorreoCambio(); + MessageHelper.setMessageInfo(resp); + confirmaChangePasswd(); + } else { + + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + + MessageHelper.setMessageError(e); + } + } + + public void saveUser() { + try { + if (this.validateUser()) { + MessageHelper.setMessageError("msg_userrequired"); + return; + } + if (!this.passwordvalidate()) { + return; + } + + String oldPass = this.callerhelper + .getPasswordEncriptado((String) this.getMfilelds().get( + "oldpassword")); + String newPass = this.callerhelper + .getPasswordEncriptado((String) this.getMfilelds().get( + "newpassword")); + System.out.println("Nuevo Password " + newPass); + System.out.println("Nuevo Password " + + (String) this.getMfilelds().get("newpassword")); + if (verificaPasswd((String) this.getMfilelds().get("newpassword"))) { + + this.record.put("newpassword", + this.getMfilelds().get("newpassword")); + this.record.put("origination", newPass); + this.record.put("oldpassword", oldPass); + + this.record.setPassword(newPass); + if (this.record.getChangepassword().compareTo("Y") == 0) { + this.record.setChangepassword("N"); + } + this.update(); + if (this.getMfilelds().get("email") != null) { + this.personAddress.getRecord().setAddress( + this.getMfilelds().get("email").toString()); + } + this.personAddress.update(); + + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + DtoSave dtoSavePassword = super.getDtoSave(); + dtoSavePassword.setIsForm(true); + dtoSavePassword.setPosition(1); + if (!dtoSavePassword.pendingProcess()) { + MessageHelper + .setMessageError(MsgControlArmas + .getProperty("msg_error_claveanteriornopuederserigualactual")); + return; + } + DtoSave dtosaveMail = personAddress.getDtoSave(); + dtosaveMail.setPosition(2); + msave.put(this.beanalias, dtoSavePassword); + msave.put(this.personAddress.getBeanalias(), dtosaveMail); + request.setSaveTables(msave); + + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + try { + this.envioCorreoCambio(); + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + } + + MessageHelper.setMessageInfo(resp); + //habilitaCampos = false; + confirmaChangePasswd(); + mensajeconfirmaChangePasswd(); + // mensajeconfirmaChangePasswd(); + // abre el dialogo que acepte + + } else { + + MessageHelper.setMessageError(resp); + } + } else { + MessageHelper + .setMessageError("LA CLAVE NO CUMPLE LAS POLTICAS DE SEGURIDAD"); + System.out + .println("La clave no cumple las politicas de seguridad nuevo Save"); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + e.printStackTrace(); + } + } + + /** + * Envía el correo de cambio de email + * + * @throws Exception + */ + /* + * private void envioCorreoCambio() throws Exception{ Mail m = new Mail(); + * m.config(ParametersController.find("MAIL.FROM", "1").getTextvalue(), + * ParametersController.find("MAIL.SMTP.SERVER", "1").getTextvalue(), + * ParametersController.find("MAIL.SMTP.PORT", + * "1").getNumbervalue().intValue(), + * ParametersController.find("MAIL.SMTP.USER", "1").getTextvalue(), + * ParametersController.find("MAIL.SMTP.PASSWORD", "1").getTextvalue(), + * Boolean.valueOf(ParametersController.find("MAIL.SMTP.AUTH", + * "1").getTextvalue()), + * Boolean.valueOf(ParametersController.find("MAIL.SMTPS", + * "1").getTextvalue())); m.setTo(personAddress.getRecord().getAddress()); + * MessageTemplatesController message = new MessageTemplatesController(); + * message.addFilter("pk", "62"); message.query(); if(message.getLrecord() + * != null && !message.getLrecord().isEmpty()){ TgeneMessageTemplates asunto + * = message.getLrecord().get(0); MessageTemplatesDescController content = + * new MessageTemplatesDescController(); content.addFilter("pk.code", "62"); + * content.addFilter("pk.languagecode", "ES"); content.query(); + * if(content.getLrecord() != null && !content.getLrecord().isEmpty()){ + * TgeneMessageTemplatesDesc descripcionContenido = + * content.getLrecord().get(0); //Velocity.init(); //VelocityContext context + * = new VelocityContext(); //context.put("nombreusuario", + * this.getLoginController().getRequest().getUser()); //context.put("clave", + * this.record.get("newpassword")); m.setSubject(asunto.getDescription()); + * //StringWriter sw = new StringWriter(); String + * sw=descripcionContenido.getTemplate().replace("$clave", + * this.record.get("newpassword").toString()); + * sw=sw.replace("$nombreusuario", this.record.get("name")+""); + * //Velocity.evaluate(context, sw, "", descripcionContenido.getTemplate()); + * m.setCont(sw.toString()); m.setContentMessageType("text/html"); m.send(); + * } } } + */ + private void envioCorreoCambio() throws Exception { + try { + Mail m = new Mail(); + m.config( + ParametersController.find("MAIL.FROM", "1").getTextvalue(), + ParametersController.find("MAIL.SMTP.SERVER", "1") + .getTextvalue(), + ParametersController.find("MAIL.SMTP.PORT", "1") + .getNumbervalue().intValue(), ParametersController + .find("MAIL.SMTP.USER", "1").getTextvalue(), + ParametersController.find("MAIL.SMTP.PASSWORD", "1") + .getTextvalue(), Boolean + .valueOf(ParametersController.find( + "MAIL.SMTP.AUTH", "1").getTextvalue()), + Boolean.valueOf(ParametersController + .find("MAIL.SMTPS", "1").getTextvalue())); + m.setTo(personAddress.getRecord().getAddress()); + MessageTemplatesController message = new MessageTemplatesController(); + message.addFilter("pk", "62"); + message.query(); + if (message.getLrecord() != null && !message.getLrecord().isEmpty()) { + TgeneMessageTemplates asunto = message.getLrecord().get(0); + MessageTemplatesDescController content = new MessageTemplatesDescController(); + content.addFilter("pk.code", "62"); + content.addFilter("pk.languagecode", "ES"); + content.query(); + if (content.getLrecord() != null + && !content.getLrecord().isEmpty()) { + TgeneMessageTemplatesDesc descripcionContenido = content + .getLrecord().get(0); + // Velocity.init(); + // VelocityContext context = new VelocityContext(); + // context.put("nombreusuario", + // this.getLoginController().getRequest().getUser()); + // context.put("clave", this.record.get("newpassword")); + m.setSubject(asunto.getDescription()); + // StringWriter sw = new StringWriter(); + String sw = descripcionContenido.getTemplate() + .replace("$clave", + this.record.get("newpassword").toString()); + sw = sw.replace("$nombreusuario", this.record.get("name") + + ""); + // Velocity.evaluate(context, sw, "", + // descripcionContenido.getTemplate()); + m.setCont(sw.toString()); + m.setContentMessageType("text/html"); + m.send(); + } + } + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + } + + } + + private boolean validateUser() { + boolean result = false; + if (this.record.getPk() == null) { + result = true; + } + return result; + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + RequestContext.getCurrentInstance().execute( + "PF('dialogChangePassword').hide()"); + } + + // /** + // * Entrega el valor de: userprofile + // * + // * @return UserProfileController + // */ + // public UserProfileController getUserprofile() { + // return userprofile; + // } + // + // /** + // * Fija el valor de: userprofile + // * + // * @param UserProfileController + // */ + // public void setUserprofile(UserProfileController userprofile) { + // this.userprofile = userprofile; + // } + /** + * Valida que el usuario ingrese la contrasena y la contrasena de validacion + * y que las dos sean iguales. + * + * @return boolean + * @throws Exception + */ + private boolean passwordvalidate() throws Exception { + Object p = super.getFieldvalue("newpassword"); + Object np = super.getFieldvalue("confirmpassword"); + if ((p == null) || (np == null)) { + MessageHelper.setMessageError("msg_passwordrequired"); + return false; + } + if (!p.equals(np)) { + MessageHelper.setMessageError("msg_passwordnomatch"); + return false; + } + return true; + } + + public PersonAddressController getPersonAddress() { + return personAddress; + } + + public void setPersonAddress(PersonAddressController personAddress) { + this.personAddress = personAddress; + } + + public boolean isHabilitaCampos() { + return habilitaCampos; + } + + public void setHabilitaCampos(boolean habilitaCampos) { + this.habilitaCampos = habilitaCampos; + } + + public void cancelChangePasswd() throws IOException { + // RequestContext.getCurrentInstance().execute("PF('dialog').show()"); + logout(); + ExternalContext ec = FacesContext.getCurrentInstance() + .getExternalContext(); + ec.redirect(ec.getRequestContextPath() + "/" + "login.xhtml"); + } + + public void confirmaChangePasswd() throws IOException { + // logout(); + MessageHelper + .setMessageInfo("SU CLAVE HA SIDO CAMBIADA SATISFACTORIAMENTE"); + // confirmaChangePswd(); + // ExternalContext ec = + // FacesContext.getCurrentInstance().getExternalContext(); + // ec.redirect(ec.getRequestContextPath() + "/" + "login.xhtml"); + // ec.redirect(ec.getRequestContextPath() + "/" + + // "passwordExpired.xhtml"); + } + + public void mensajeconfirmaChangePasswd() throws IOException { + logout(); + + ExternalContext ec = FacesContext.getCurrentInstance() + .getExternalContext(); + ec.redirect(ec.getRequestContextPath() + "/" + "login.xhtml"); + } + + public String logout() { + System.out.println("logout::cerrando session bean"); + FacesContext fc = FacesContext.getCurrentInstance(); + if (fc != null) { + fc.getExternalContext().invalidateSession(); + } + return "/login?faces-redirect=true"; + } + + // Procedimiento Verifica Seguridad de la Clave del Usuario + private boolean verificaPasswd(String clave) { + boolean minuscula = false; + boolean mayuscula = false; + boolean numero = false; + boolean caracter = false; + // Hace un barrido de los caracteres ingresados en la clave + for (int i = 0; i < clave.length(); i++) { + // Verifica que el codigo ASCII ( letras minusculas) + if (clave.charAt(i) >= 97 && clave.charAt(i) <= 122) { + minuscula = true; + // Verifica que el codigo ASCII ( letras mayusculas) + } else if (clave.charAt(i) >= 65 && clave.charAt(i) <= 90) { + mayuscula = true; + // Verifica que el codigo ASCII ( numeros) + } else if (clave.charAt(i) >= 48 && clave.charAt(i) <= 57) { + numero = true; + // Si no cumple las condiciones anteriores es caracter especial + } else { + caracter = true; + } + } + if ((minuscula == true) && (mayuscula == true) && (numero == true) + && (caracter == true)) { + return true; + } else { + return false; + } + } + + public String confirmaChangePswd() { + System.out.println("logout::cerrando session bean confirma clave"); + /* + * FacesContext fc = FacesContext.getCurrentInstance(); if (fc != null) + * { fc.getExternalContext().invalidateSession(); } + */ + return "/passwordExpired?faces-redirect=true"; + } + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/LoginController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/LoginController.java.svn-base new file mode 100644 index 0000000..827028b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/LoginController.java.svn-base @@ -0,0 +1,597 @@ +package com.fp.frontend.controller.security; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.TerminosCondicionesController; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.EnumParametros; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmTerminos; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetailKey; +import com.fp.persistence.pgeneral.safe.TsafeUserProfile; +import com.fp.persistence.pgeneral.safe.TsafeUserProfileKey; +import java.io.PrintStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.faces.application.Application; +import javax.faces.application.NavigationHandler; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import javax.faces.context.ExternalContext; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletRequest; +import org.primefaces.context.RequestContext; +import org.primefaces.model.StreamedContent; + +@ManagedBean +@SessionScoped +public class LoginController +{ + private Request request; + private MaiaMenu maiaMenu; + private Map mdata = new HashMap(); + private final Map mlocation = new HashMap(); + private List> lcompany; + private List lprofile; + private String changepassword; + private boolean renderBpmData = false; + private String casLogoutUrl; + private String profilecode; + private String rutaTerminos; + private StreamedContent content; + + @PostConstruct + private void postconstruct() + { + this.request = new Request(); + this.request.setCompany(Integer.valueOf(1)); + + HttpServletRequest httpServletRequest = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest(); + this.request.setTerminalCode(httpServletRequest.getRemoteAddr()); + this.request.put("ip", httpServletRequest.getRemoteAddr()); + this.request.put("host", httpServletRequest.getLocalAddr()); + + fillCompanies(); + this.maiaMenu = new MaiaMenu(); + } + + public void authenticate() + throws Throwable + { + System.out.println("autentificacion debe cambiar : "); + try + { + System.out.println("changepassword debe cambiar : "); + String user = this.mdata.get("a").toString(); + String pass = this.mdata.get("b").toString(); + this.request.put("login", user); + CallerHelper ch = new CallerHelper(); + Response resp = ch.login(this.request, user, pass); + + TarmTerminos terminos = TerminosCondicionesController.findxIdentificacion(user); + if ((resp.getResponseCode().compareTo("0") == 0) && (terminos == null)) + { + System.out.println("terminos"); + try + { + this.rutaTerminos = ParametersController.find("CODIGO.TERMINOS.COND", "1").getTextvalue(); + this.content = AlfrescoController.downloadDocument(this.rutaTerminos); + } + catch (Exception e) + { + System.out.println("error al obtener el parametro CODIGO.TERMINOS.COND"); + } + RequestContext requestContext = RequestContext.getCurrentInstance(); + requestContext.execute("PF('aceptaTerminosCond').show()"); + } + else if (resp.getResponseCode().compareTo("0") == 0) + { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail)resp.get("TSAFEUSERDETAIL"); + manageloginresponse(tsafeUserDetail); + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("TSAFEUSERDETAIL", tsafeUserDetail); + if (this.changepassword.equalsIgnoreCase("N")) + { + FacesContext ctx = FacesContext.getCurrentInstance(); + ExternalContext externalContext = ctx.getExternalContext(); + NavigationHandler handler = ctx.getApplication().getNavigationHandler(); + handler.handleNavigation(ctx, null, "workspace"); + + externalContext.redirect(externalContext.getRequestContextPath() + "/" + "pages/workspace.xhtml"); + + this.request.setBrowser(obtainBrowserName((String)externalContext.getRequestHeaderMap().get("User-Agent"))); + this.request.setOperativesystem(obtainSOName((String)externalContext.getRequestHeaderMap().get("User-Agent"))); + + changeprofile(); + } + else + { + ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext(); + ec.redirect(ec.getRequestContextPath() + "/" + "change-password.xhtml"); + System.out.println("debe cambiar la clave : " + ec.getRequestContextPath() + "/" + "passwordExpired.xhtml"); + } + } + else + { + MessageHelper.setMessageError(resp); + } + } + catch (Exception e) + { + MessageHelper.setMessageError(e); + } + } + + public void aceptaTerminosCondicion() + { + String user = this.mdata.get("a").toString(); + String pass = this.mdata.get("b").toString(); + try + { + CallerHelper ch = new CallerHelper(); + + this.request.put("terminos", "terminos"); + this.request.put("aceptaterminos", "SI"); + this.request.put("identificacionterminos", user); + this.request.put("documentoterminos", this.rutaTerminos); + + Response resp = ch.login(this.request, user, pass); + + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail)resp.get("TSAFEUSERDETAIL"); + manageloginresponse(tsafeUserDetail); + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("TSAFEUSERDETAIL", tsafeUserDetail); + if (tsafeUserDetail.getChangepassword().equalsIgnoreCase("N")) + { + FacesContext ctx = FacesContext.getCurrentInstance(); + ExternalContext externalContext = ctx.getExternalContext(); + NavigationHandler handler = ctx.getApplication().getNavigationHandler(); + handler.handleNavigation(ctx, null, "workspace"); + + externalContext.redirect(externalContext.getRequestContextPath() + "/" + "pages/workspace.xhtml"); + + this.request.setBrowser(obtainBrowserName((String)externalContext.getRequestHeaderMap().get("User-Agent"))); + this.request.setOperativesystem(obtainSOName((String)externalContext.getRequestHeaderMap().get("User-Agent"))); + + changeprofile(); + } + else + { + ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext(); + ec.redirect(ec.getRequestContextPath() + "/" + "change-password.xhtml"); + System.out.println("debe cambiar la clave : " + ec.getRequestContextPath() + "/" + "passwordExpired.xhtml"); + } + } + catch (Exception e) + { + e.printStackTrace(); + } + catch (Throwable e) + { + e.printStackTrace(); + } + } + + public void authenticateCas(String username, String urlCasLogout) + throws Throwable + { + try + { + this.casLogoutUrl = urlCasLogout; + this.request.put("login", username); + CallerHelper ch = new CallerHelper(); + Response resp = ch.loginCas(this.request, username, null); + if (resp.getResponseCode().compareTo("0") == 0) + { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail)resp.get("TSAFEUSERDETAIL"); + manageloginresponse(tsafeUserDetail); + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("TSAFEUSERDETAIL", tsafeUserDetail); + + changeprofile(); + } + else + { + throw new Exception(resp.getResponseCode() + " " + resp.getResponseUserMessage()); + } + } + catch (Exception e) + { + throw e; + } + } + + public void updateusesession() + { + System.out.println("logout::cerrando session"); + try + { + CallerHelper ch = new CallerHelper(); + ch.logout(this.request); + } + catch (Throwable e) {} + } + + public String logout() + { + System.out.println("logout::cerrando session bean"); + updateusesession(); + FacesContext fc = FacesContext.getCurrentInstance(); + if (fc != null) { + fc.getExternalContext().invalidateSession(); + } + return "/login?faces-redirect=true"; + } + + private void manageloginresponse(TsafeUserDetail userdetail) + { + this.mlocation.put("cia", userdetail.get("cn")); + this.mlocation.put("branch", userdetail.get("bn")); + this.mlocation.put("office", userdetail.get("on")); + this.mlocation.put("area", userdetail.get("an")); + this.mlocation.put("channel", userdetail.get("chn")); + this.mlocation.put("accodate", userdetail.get("ad")); + this.mlocation.put("workdate", userdetail.get("wd")); + this.mlocation.put("nickname", userdetail.getNickname()); + this.mlocation.put("sbsemployee", userdetail.get("sbsemployee")); + this.mlocation.put("sbsusercode", userdetail.get("sbsusercode")); + obtenerCentroControl(userdetail); + obtenerUnidadControl(userdetail); + this.request.setUser(userdetail.getPk().getUsercode()); + this.request.setCompany(userdetail.getCompanycode()); + this.request.setBranchCode(userdetail.getBranchcode()); + this.request.setOfficeCode(userdetail.getOfficecode()); + this.request.setChannelCode(userdetail.getChannelcode()); + this.request.setLanguage(userdetail.getLanguagecode()); + this.request.setCentrocontrol(userdetail.getCcentrocontrol()); + + this.changepassword = userdetail.getChangepassword(); + this.lprofile = ((List)userdetail.get("lprofile")); + this.request.setProfile(((TsafeUserProfile)this.lprofile.get(0)).getPk().getProfilecode()); + } + + private void obtenerCentroControl(TsafeUserDetail userdetail) + { + TgeneCatalogDetail tcentrocontrol = null; + try + { + TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(userdetail.getCcentrocontrol()); + if (centroControl != null) { + tcentrocontrol = CatalogDetailController.findCatalogo(centroControl.getInstituciontipo(), centroControl.getInstitucion()); + } + } + catch (CommondbException e) {}catch (Exception e) {} + if (tcentrocontrol != null) + { + userdetail.addAddtionalInfo("centrocontrol", tcentrocontrol.getDescription()); + this.mlocation.put("centrocontrol", tcentrocontrol.getDescription()); + } + else + { + userdetail.addAddtionalInfo("centrocontrol", ""); + this.mlocation.put("centrocontrol", ""); + } + } + + private void obtenerUnidadControl(TsafeUserDetail userdetail) + { + TgeneCatalogDetail unidad = null; + try + { + TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(userdetail.getCcentrocontrol()); + if (centroControl != null) { + unidad = CatalogDetailController.findCatalogo(centroControl.getNombreinstitucioncodigo(), centroControl.getNombreinstitucion()); + } + } + catch (CommondbException e) {}catch (Exception e) {} + if (unidad != null) + { + userdetail.addAddtionalInfo("unidad", unidad.getDescription()); + this.mlocation.put("unidad", unidad.getDescription()); + } + else + { + userdetail.addAddtionalInfo("unidad", ""); + this.mlocation.put("unidad", ""); + } + } + + public void changeprofile() + throws Exception + { + try + { + if (this.profilecode != null) { + this.request.setProfile(this.profilecode); + } + CallerHelper ch = new CallerHelper(); + Response resp = ch.menu(this.request); + if (resp.getResponseCode().compareTo("0") == 0) + { + Map rootmenu = (Map)resp.get("rootmenu"); + List> lmenu = (List)rootmenu.get("items"); + this.maiaMenu.buildMenu(lmenu); + } + else + { + MessageHelper.setMessageError(resp); + } + } + catch (Throwable e) + { + MessageHelper.setMessageError(e); + } + } + + private void fillCompanies() + { + try + { + CallerHelper ch = new CallerHelper(); + Request request = new Request(); + DtoQuery dto = new DtoQuery(null, null, null, true, null); + + HashMap mtables = new HashMap(); + mtables.put("CIAS", dto); + request.setCompany(Integer.valueOf(1)); + request.getModifiedData().put("queryalias", "COMPANY"); + request.setQueryTables(mtables); + + Response resp = ch.executeQuery(request); + if (resp.getResponseCode().compareTo("0") != 0) + { + this.lcompany = new ArrayList(); + MessageHelper.setMessageError(resp); + } + else + { + this.lcompany = ((List)resp.get("CIAS")); + } + } + catch (Throwable e) + { + MessageHelper.setMessageError(e); + } + } + + public void fijaRequestData(Request request, String transactionmodule, Integer transactioncode, Integer transactionversion) + throws Exception + { + request.setCompany(this.request.getCompany()); + request.setCentrocontrol(this.request.getCentrocontrol()); + request.setUnidad(this.request.getUnidad()); + request.setBranchCode(this.request.getBranchCode()); + request.setOfficeCode(this.request.getOfficeCode()); + request.setUser(this.request.getUser()); + request.setLanguage(this.request.getLanguage()); + request.setChannelCode(this.request.getChannelCode()); + request.setTerminalCode(this.request.getTerminalCode()); + request.setProfile(this.request.getProfile()); + request.setBrowser(this.request.getBrowser()); + request.setOperativesystem(this.request.getOperativesystem()); + + request.setTransactionModule(transactionmodule); + request.setTransactionCode(transactioncode); + request.setTransactionVersion(transactionversion); + } + + private String obtainBrowserName(String userAgent) + { + if (userAgent.contains("MSIE")) { + return buildBrowser(userAgent, "MSIE"); + } + if (userAgent.contains("Firefox")) { + return buildBrowser(userAgent, "Firefox"); + } + if (userAgent.contains("Chrome")) { + return buildBrowser(userAgent, "Chrome"); + } + if (userAgent.contains("Opera")) { + return buildBrowser(userAgent, "Opera"); + } + if (userAgent.contains("Safari")) { + return buildBrowser(userAgent, "Safari"); + } + return "Unknown"; + } + + private String obtainSOName(String userAgent) + { + String os = ""; + if (userAgent.contains("Windows")) { + os = buildOS(userAgent, "Windows"); + } else if (userAgent.contains("Mac")) { + os = buildOS(userAgent, "Mac"); + } else if (userAgent.contains("Linux")) { + os = buildOS(userAgent, "Linux"); + } else if (userAgent.contains("android")) { + os = buildOS(userAgent, "android"); + } else if (userAgent.contains("iphone")) { + os = buildOS(userAgent, "iphone"); + } else { + os = "UnKnown, More-Info: " + userAgent; + } + return os; + } + + private String buildBrowser(String userAgent, String id) + { + String browser = ""; + if (userAgent.contains("MSIE")) + { + String[] value = userAgent.substring(userAgent.indexOf(id), userAgent.length()).split(" "); + browser = value[0] + " " + value[1]; + } + else + { + String[] value = userAgent.substring(userAgent.indexOf(id), userAgent.length()).split(" "); + browser = value[0]; + } + return browser; + } + + private String buildOS(String userAgent, String id) + { + String so = ""; + if (userAgent.contains("Windows")) + { + String[] value = userAgent.substring(userAgent.indexOf(id), userAgent.length()).split(" "); + so = value[0] + " " + value[1] + " " + value[2]; + } + else + { + String[] value = userAgent.substring(userAgent.indexOf(id), userAgent.length()).split(" "); + so = value[0] + " " + value[1]; + } + return so; + } + + public List> getLcompany() + { + return this.lcompany; + } + + public void setLcompany(List> lcompany) + { + this.lcompany = lcompany; + } + + public List getLprofile() + { + return this.lprofile; + } + + public void setLprofile(List lprofile) + { + this.lprofile = lprofile; + } + + public String getChangepassword() + { + return this.changepassword; + } + + public void setChangepassword(String changepassword) + { + this.changepassword = changepassword; + } + + public Map getMdata() + { + return this.mdata; + } + + public void setMdata(Map mdata) + { + this.mdata = mdata; + } + + public Request getRequest() + { + return this.request; + } + + public void setRequest(Request request) + { + this.request = request; + } + + public MaiaMenu getMaiaMenu() + { + return this.maiaMenu; + } + + public void setMaiaMenu(MaiaMenu maiaMenu) + { + this.maiaMenu = maiaMenu; + } + + public Map getMlocation() + { + return this.mlocation; + } + + public boolean isRenderBpmData() + { + return this.renderBpmData; + } + + public void setRenderBpmData(boolean renderBpmData) + { + this.renderBpmData = renderBpmData; + } + + public String getCasLogoutUrl() + { + return this.casLogoutUrl; + } + + public void setCasLogoutUrl(String casLogoutUrl) + { + this.casLogoutUrl = casLogoutUrl; + } + + public String getProfilecode() + { + return this.profilecode; + } + + public void setProfilecode(String profilecode) + { + this.profilecode = profilecode; + } + + public void help() + throws Exception + { + String m = this.request.getTransactionModule(); + String t = this.request.getTransactionCode().toString(); + String v = this.request.getTransactionVersion().toString(); + String p = ParametersController.find(EnumParametros.PATH_ALFRESCO_AYUDA.getCodigo(), this.request.getCompany().toString()).getTextvalue(); + RequestContext.getCurrentInstance().execute("Maiaworkspace.loadHelp('" + m + "', '" + t + "', '" + v + "', '" + p + "')"); + } + + @PreDestroy + private void closeSessionMaia() + { + try + { + FacesContext fc = FacesContext.getCurrentInstance(); + if (fc != null) { + logout(); + } + } + catch (Exception e) {} + } + + public String getRutaTerminos() + { + return this.rutaTerminos; + } + + public void setRutaTerminos(String rutaTerminos) + { + this.rutaTerminos = rutaTerminos; + } + + public StreamedContent getContent() + { + return this.content; + } + + public void setContent(StreamedContent content) + { + this.content = content; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/MaiaMenu.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/MaiaMenu.java.svn-base new file mode 100644 index 0000000..62bdf25 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/MaiaMenu.java.svn-base @@ -0,0 +1,126 @@ +package com.fp.frontend.controller.security; + +import java.util.List; +import java.util.Map; + +import javax.faces.context.FacesContext; + +import org.primefaces.model.menu.DefaultMenuItem; +import org.primefaces.model.menu.DefaultMenuModel; +import org.primefaces.model.menu.DefaultSubMenu; +import org.primefaces.model.menu.MenuModel; +import org.primefaces.model.menu.Submenu; + +import com.fp.frontend.helper.MessageHelper; + +public class MaiaMenu { + + private MenuModel menuModel; + + private String maiaMenuJson; + + private String contextPath = ""; + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + public MaiaMenu() { + try { + maiaMenuJson = ""; + contextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void buildMenu(List> lmenu) throws Exception { + menuModel = new DefaultMenuModel(); + for (Map menu : lmenu) { + String label = (String) menu.get("t"); + DefaultSubMenu submenu = new DefaultSubMenu(); + submenu.setLabel(label); + menuModel.addElement(submenu); + + if (menu.get("items") instanceof Map) { + this.addMenuItem(submenu, (Map) menu.get("items")); + } else { + this.addSubmenu(submenu, (List>) menu.get("items")); + } + } + } + + @SuppressWarnings("unchecked") + private void addSubmenu(Submenu submenupadre, List> lsubmenu) throws Exception { + for (Map menu : lsubmenu) { + Object obj = menu.get("items"); + if (obj == null) { + this.addMenuItem(submenupadre, menu); + } else { + String label = (String) menu.get("t"); + DefaultSubMenu submenu = new DefaultSubMenu(); + submenu.setLabel(label); + submenupadre.getElements().add(submenu); + this.addSubmenu(submenu, (List>) menu.get("items")); + } + } + + } + + @SuppressWarnings("unchecked") + private void addMenuItem(Submenu submenu, Map mdata) throws Exception { + String tname = (String) mdata.get("t"); + String modulo = (String) mdata.get("m"); + Integer transaccion = (Integer) mdata.get("tr"); + Integer version = (Integer) mdata.get("v"); + String pagina = (String) mdata.get("jsfp"); + String autoconsulta = (String) mdata.get("a"); + String url = pagina + "?" + "m=" + modulo + "&t=" + transaccion + "&v=" + version + "&autoquery=" + autoconsulta; + String key = modulo + "-" + transaccion + "-" + version; + String nameMenu = tname + " (" + modulo + "-" + transaccion + ")"; + DefaultMenuItem menuItem = new DefaultMenuItem(); + menuItem.setValue(nameMenu); + menuItem.setUrl("javascript:Maiaworkspace.loadPage('" + url + "','" + nameMenu + "')"); + menuItem.setIcon("ui-icon-document"); + menuItem.setStyleClass("m-menuitem"); + submenu.getElements().add(menuItem); + maiaMenuJson = maiaMenuJson + "'" + key + "': {'url':'" + url + "','name':'" + nameMenu + "'},"; + } + + /** + * Entrega el valor de: menuModel + * + * @return MenuModel + */ + public MenuModel getMenuModel() { + return menuModel; + } + + /** + * Fija el valor de: menuModel + * + * @param Valor a fijar en el atributo. + */ + public void setMenuModel(MenuModel menuModel) { + this.menuModel = menuModel; + } + + /** + * Entrega el valor de: maiaMenuJson + * + * @return String + */ + public String getMaiaMenuJson() { + return maiaMenuJson; + } + + /** + * Fija el valor de: maiaMenuJson + * + * @param maiaMenuJson Valor a fijar en el atributo + */ + public void setMaiaMenuJson(String maiaMenuJson) { + this.maiaMenuJson = maiaMenuJson; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/MenuProfileController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/MenuProfileController.java.svn-base new file mode 100644 index 0000000..f362a9f --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/MenuProfileController.java.svn-base @@ -0,0 +1,213 @@ +package com.fp.frontend.controller.security; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.menu.MenuController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenu; +import com.fp.persistence.pgeneral.menu.TgeneMenuProfile; +import com.fp.persistence.pgeneral.safe.TsafeProfile; + +/** + * Clase controladora del bean TgeneMenuProfile. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class MenuProfileController extends AbstractController { + + + private static final long serialVersionUID = 1L; + + public MenuProfileController() throws Exception { + super(TgeneMenuProfile.class); + } + + private List lprofile; + private List lMenu; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //Listas + this.lprofile = ProfileController.find(); + this.lMenu = MenuController.find(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.create(); + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEMENUPROFILE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + // subqueries 1 + SubQuery subquery1 = new SubQuery("TsafeProfile", "description", "profiledesc", + "i.pk = t.pk"); + dto.addSubQuery(subquery1); + + // subqueries 2 + SubQuery subquery2 = new SubQuery("TgeneMenu", "description", "menudesc", + "i.pk = t.menucode"); + dto.addSubQuery(subquery2); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void create() throws Exception { + super.create(); + this.record.setPk(super.getMfilters().get("pk")); + } + + /** + * Entrega una lista de objetos TbpmGroups + * @param companycode Código de compania + * @return lrecord Lista de objetos TbpmGroups + */ + public static List find() { + try { + MenuProfileController cc = new MenuProfileController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Fija la descripcion del perfil en el record + */ + public void setProfileDesc(){ + for(TsafeProfile p: this.lprofile){ + if(p.getPk().compareTo(this.record.getPk())==0){ + this.record.put("profiledesc", p.getDescription()); + } + } + } + + /** + * Fija la descripcion del menu en el record + */ + public void setMenuDesc(){ + for(TgeneMenu m: this.lMenu){ + if(m.getPk().compareTo(this.record.getMenucode())==0){ + this.record.put("menudesc", m.getDescription()); + } + } + } + + /** + * Entrega una lista de objetos TsafeProfile + * @return lprofile + */ + public List getLprofile() { + return this.lprofile; + } + + /** + * Fija una lista de objetos TsafeProfile + * @param lprofile + */ + public void setLprofile(List lprofile) { + this.lprofile = lprofile; + } + + /** + * Entrega una lista de objetos TgeneMenu + * @return lMenu + */ + public List getlMenu() { + return this.lMenu; + } + + /** + * Fija una lista de objetos TgeneMenu + * @param lMenu + */ + public void setlMenu(List lMenu) { + this.lMenu = lMenu; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/ModifyUserController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/ModifyUserController.java.svn-base new file mode 100644 index 0000000..8217ea2 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/ModifyUserController.java.svn-base @@ -0,0 +1,552 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.frontend.controller.security; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.AreaController; +import com.fp.frontend.controller.pgeneral.gene.BranchController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ChannelController; +import com.fp.frontend.controller.pgeneral.gene.LanguageController; +import com.fp.frontend.controller.pgeneral.gene.OfficeController; +import com.fp.frontend.controller.pgeneral.lov.ProfileLovController; +import com.fp.frontend.controller.pgeneral.safe.TerminalController; +import com.fp.frontend.controller.pgeneral.safe.UserDetailController; +import com.fp.frontend.controller.pgeneral.safe.UserProfileController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneArea; +import com.fp.persistence.pgeneral.gene.TgeneBranch; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneChannels; +import com.fp.persistence.pgeneral.gene.TgeneLanguage; +import com.fp.persistence.pgeneral.gene.TgeneOffice; +import com.fp.persistence.pgeneral.safe.TsafeProfile; +import com.fp.persistence.pgeneral.safe.TsafeTerminal; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserProfile; + +/** + * Clase controladora de modifyuser + * + * @author BPTWPA + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ModifyUserController extends AbstractController { + + @ManagedProperty(value = "#{userDetailController}") + private UserDetailController userdetail; + @ManagedProperty(value = "#{userProfileController}") + private UserProfileController userprofile; + + public ModifyUserController() throws Exception { + super(AbstractDataTransport.class); + } + /** + * Atributo para la lista de objetos TgeneCatalogDetail para el Status del + * usuario + */ + private List luserStatus; + /** + * Atributo para la lista de objetos TsafeTerminal para el terminal + */ + private List lterminal; + /** + * Atributo para la lista de idiomas + */ + private List llanguage; + /** + * Atributo para los canales + */ + private List lchannel; + /** + * Atributo para la llist de sucursales + */ + private List lbranch; + /** + * Atributo para las oficinas + */ + private List loffice; + /** + * Atributo para las areas + */ + private List larea; + + private String centroControl; + + private String unidad; + + private List centroControls; + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List unidades; + /** + * Deshabilita la pantalla después de grabar la solicitud + */ + private boolean deshabilitarPantalla; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //list + this.luserStatus = CatalogDetailController.find("USERSTATUS"); + this.lterminal = TerminalController.find(super.getLoginController().getRequest().getCompany().toString()); + this.llanguage = LanguageController.find(); + this.lchannel = ChannelController.find(); + this.lbranch = BranchController.find(super.getLoginController().getRequest().getCompany().toString()); + this.larea = AreaController.find(super.getLoginController().getRequest().getCompany().toString()); + this.unidades = new ArrayList<>(); + this.unidad = ""; + this.centroControls = CatalogDetailController.find("INSTITUCION"); + this.deshabilitarPantalla = Boolean.TRUE; + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.lrecord = new ArrayList<>(); + this.beanalias = "CHANGEPASSADMIN"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + try { + if (!this.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + this.userdetail.getMfilters().clear(); + this.userdetail.getMfilelds().clear(); + this.userdetail.getMfilters().put("pk.usercode", this.getMfilters().get("pk.usercode")); + this.userdetail.query(); + + if (this.userdetail.getRecord().getPk().getUsercode() != null) { + this.deshabilitarPantalla = Boolean.FALSE; + loadCentroControlUnidad(); + this.loffice = OfficeController.find(this.userdetail.getRecord().getBranchcode().toString(), super.getLoginController().getRequest().getCompany().toString()); + this.userprofile.addFilter("pk.usercode", this.userdetail.getRecord().getPk().getUsercode()); + this.userprofile.query(); + } else { + this.deshabilitarPantalla = Boolean.TRUE; + this.userdetail.create(); + this.userdetail.getRecord().setUserstatuscatalogcode("USERSTATUS"); + this.userdetail.getRecord().setUserstatuscatalog(null); + this.userprofile.setLrecord(null); + MessageHelper.setMessageError("msg_userNotFound"); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Carga el centro de control por el tarm centro de control de armas + */ + private void loadCentroControlUnidad() { + //Consultar el centro de control de armas + if(userdetail.getRecord().getCcentrocontrol()!=null && !userdetail.getRecord().getCcentrocontrol().isEmpty()){ + TarmCentroControl tarmCentroControl = CentroControlArmasController.findPorCodigo(userdetail.getRecord().getCcentrocontrol()); + if (tarmCentroControl != null) { + centroControl = tarmCentroControl.getInstitucion(); + unidad = tarmCentroControl.getNombreinstitucion(); + seleccionaCentroControl(); + } else { + centroControl = ""; + unidad = ""; + } + }else{ + centroControl = ""; + unidad = ""; + } + } + + @Override + public void save() { + try { + if (this.validateUser()) { + MessageHelper.setMessageError("msg_userrequired"); + return; + } + + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail=(TsafeUserDetail)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + this.userdetail.getRecord().setModifyuser(tsafeUserDetail.getPk().getUsercode()); + //Consultar el centro de control de armas + TarmCentroControl tarmCentroControl = CentroControlArmasController.findxCcontrolUnidad(centroControl, unidad); + + if (tarmCentroControl != null && tarmCentroControl.getInstitucion().equals(centroControl)) { + this.userdetail.getRecord().setCcentrocontrol(tarmCentroControl.getPk()); + } else { + centroControl = ""; + } + + this.userdetail.update(); + + DtoSave dtosaveuserdet = this.userdetail.getDtoSave(); + if (dtosaveuserdet.pendingProcess()) { + dtosaveuserdet.setIsForm(true); + msave.put(this.userdetail.getBeanalias(), dtosaveuserdet); + } + + DtoSave dtosaveuserprofile = this.userprofile.getDtoSave(); + if (dtosaveuserprofile.pendingProcess()) { + msave.put(this.userprofile.getBeanalias(), dtosaveuserprofile); + } + + // this.userdetail.save(); + // this.userprofile.save(); + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.userdetail.postCommit(resp); + this.userprofile.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private boolean validateUser() { + boolean result = false; + if (this.userdetail.getRecord().getPk() == null) { + result = true; + } + return result; + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Carga las oficinas + */ + public void loadOffice() { + this.loffice = OfficeController.find(this.userdetail.getRecord().getBranchcode().toString(), super.getLoginController().getRequest().getCompany().toString()); + } + + /** + * Entrega el valor de: userdetail + * + * @return UserDetailController + */ + public UserDetailController getUserdetail() { + return this.userdetail; + } + + /** + * Fija el valor de: userdetail + * + * @param userdetail Valor a fijar en el atributo. + */ + public void setUserdetail(UserDetailController userdetail) { + this.userdetail = userdetail; + } + + /** + * Entrega el valor de: userprofile + * + * @return UserProfileController + */ + public UserProfileController getUserprofile() { + return this.userprofile; + } + + /** + * Fija el valor de: userprofile + * + * @param UserProfileController + */ + public void setUserprofile(UserProfileController userprofile) { + this.userprofile = userprofile; + } + + /** + * Carga las unidades de control por el centro de control + */ + public void seleccionaCentroControl(){ + if(centroControl!=null){ + unidades = CentroControlArmasController.findxInstitucion(centroControl); + }else{ + unidades=new ArrayList<>(); + userdetail.getRecord().setCcentrocontrol(null); + } + } + + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + this.userdetail.getMfilters().clear(); + this.getMfilelds().clear(); + this.userdetail.addFilter("pk.personcode", t.getPk().getPersoncode().toString()); + this.userdetail.addField("personname", t.getName()); + this.userdetail.query(); + + if(this.userdetail.getRecord().getPk().getUsercode()!=null){ + deshabilitarPantalla = Boolean.FALSE; + loadCentroControlUnidad(); + this.loffice = OfficeController.find(this.userdetail.getRecord().getBranchcode().toString(), super.getLoginController().getRequest().getCompany().toString()); + this.addFilter("pk.usercode", this.userdetail.getRecord().getPk().getUsercode()); + this.userprofile.addFilter("pk.usercode", this.userdetail.getRecord().getPk().getUsercode()); + this.userprofile.query(); + }else{ + deshabilitarPantalla = Boolean.TRUE; + this.userdetail.getRecord().setUserstatuscatalog(null); + MessageHelper.setMessageError("msg_userNotFound"); + } + } + + public void openProfileLov() { + Map> params = new HashMap<>(); + ProfileLovController.openLov(params); + } + + public void onReturnProfileLov(SelectEvent event) throws Exception { + TsafeProfile t = (TsafeProfile) event.getObject(); + this.userprofile.create(); + if (this.userdetail.getRecord().getPk() != null) { + this.userprofile.getRecord().getPk().setUsercode(this.userdetail.getRecord().getPk().getUsercode()); + this.userprofile.getRecord().getPk().setProfilecode(t.getPk()); + this.userprofile.getRecord().put("profiledesc", t.getDescription()); + if (this.verifyProfile()) { + MessageHelper.setMessageError("msg_userExist"); + } else { + this.userprofile.update(); + } + } else { + MessageHelper.setMessageError("msg_userrequired"); + } + } + + /** + * Verifica si hay un perfil seleccionado + * + * @return result V/F + */ + private boolean verifyProfile() { + boolean result = false; + if (!this.userprofile.getLrecord().isEmpty()) { + for (TsafeUserProfile profile : this.userprofile.getLrecord()) { + if (profile.getPk().getProfilecode().compareTo(this.userprofile.getRecord().getPk().getProfilecode()) == 0) { + result = true; + break; + } + } + } + return result; + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * + * @return luserStatus Lista de objetos TgeneCatalogDetail + */ + public List getLuserStatus() { + return this.luserStatus; + } + + /** + * Fija una lista de objetos TgeneCatalogDetail + * + * @param luserStatus Lista de objetos TgeneCatalogDetail + */ + public void setLuserStatus(List luserStatus) { + this.luserStatus = luserStatus; + } + + /** + * Entrega una lista de objetos TsafeTerminal + * + * @return lterminal Lista de objetos TsafeTerminal + */ + public List getLterminal() { + return this.lterminal; + } + + /** + * Fija una lista de objetos TsafeTerminal + * + * @param lterminal Lista de objetos TsafeTerminal + */ + public void setLterminal(List lterminal) { + this.lterminal = lterminal; + } + + /** + * Entrega una lista de objetos TgeneLanguage + * + * @return lterminal Lista de objetos TgeneLanguage + */ + public List getLlanguage() { + return this.llanguage; + } + + /** + * Fija una lista de objetos TgeneLanguage + * + * @param lterminal Lista de objetos TgeneLanguage + */ + public void setLlanguage(List llanguage) { + this.llanguage = llanguage; + } + + /** + * Entrega una lista de objetos TgeneChannels + * + * @param lchannel Lista de objetos TgeneLanguage + */ + public List getLchannel() { + return this.lchannel; + } + + /** + * Fija una lista de objetos TgeneChannels + * + * @param lchannel Lista de objetos TgeneChannels + */ + public void setLchannel(List lchannel) { + this.lchannel = lchannel; + } + + /** + * Entrega una lista de objetos TgeneBranch + * + * @return lbranch Lista de objetos TgeneLanguage + */ + public List getLbranch() { + return this.lbranch; + } + + /** + * Fija una lista de objetos TgeneBranch + * + * @param lbranch Lista de objetos TgeneLanguage + */ + public void setLbranch(List lbranch) { + this.lbranch = lbranch; + } + + /** + * Entrega una lista de objetos TgeneOffice + * + * @return loffice Lista de objetos TgeneOffice + */ + public List getLoffice() { + return this.loffice; + } + + /** + * Fija una lista de objetos TgeneOffice + * + * @param loffice Lista de objetos TgeneOffice + */ + public void setLoffice(List loffice) { + this.loffice = loffice; + } + + /** + * Entrega una lista de objetos TgeneArea + * + * @return larea Lista de objetos TgeneArea + */ + public List getLarea() { + return this.larea; + } + + /** + * Fija una lista de objetos TgeneArea + * + * @param larea Lista de objetos TgeneArea + */ + public void setLarea(List larea) { + this.larea = larea; + } + + public List getCentroControls() { + return centroControls; + } + + public void setCentroControls(List centroControls) { + this.centroControls = centroControls; + } + public List getUnidades() { + return unidades; + } + public void setUnidades(List unidades) { + this.unidades = unidades; + } + + public String getCentroControl() { + return centroControl; + } + + public void setCentroControl(String centroControl) { + this.centroControl = centroControl; + } + + public boolean isDeshabilitarPantalla() { + return deshabilitarPantalla; + } + + public void setDeshabilitarPantalla(boolean deshabilitarPantalla) { + this.deshabilitarPantalla = deshabilitarPantalla; + } + + public String getUnidad() { + return unidad; + } + + public void setUnidad(String unidad) { + this.unidad = unidad; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/PasswordController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/PasswordController.java.svn-base new file mode 100644 index 0000000..a15de2d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/PasswordController.java.svn-base @@ -0,0 +1,197 @@ +package com.fp.frontend.controller.security; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.ChannelController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneChannels; +import com.fp.persistence.pgeneral.safe.TsafePassword; + +/** + * Clase controladora del lov asociado al bean TsafePassword. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class PasswordController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public PasswordController() throws Exception { + super(TsafePassword.class); + } + + /** + * Atributo para la lista de objetos TgeneChannels + */ + private List lchannels; + + private boolean active; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + this.lchannels = ChannelController.find(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + public void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.record = null; + this.beanalias = "PASSWORD"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void execute(){ + this.active=true; + this.querydatabase(); + } + + @Override + public void create() { + try { + super.create(); + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + this.record.getPk().setChannelcode(super.getMfilters().get("pk.channelcode")); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + try { + if (!this.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + Request request = this.callerhelper.getRequest(); + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + + DtoQuery dto = super.getDtoQuery(false); + dto.setOrderby("t.pk.channelcode"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.record = new TsafePassword(); + MessageHelper.setMessageError(resp); + } else { + this.record = (TsafePassword) resp.get(this.beanalias); + if (this.record != null) { + super.postQuery((AbstractDataTransport) resp.get(this.beanalias)); + } else { + this.create(); + } + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + if (!this.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + if(this.record.getPk().getCompanycode()==null || this.record.getPk().getCompanycode().compareTo(0)==0){ + MessageHelper.setMessageError("msg_querydata"); + return; + } + Request request = this.callerhelper.getRequest(); + super.update(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Entrega una lista de objetos TgeneChannels + * + * @return lchannels Lista de objetos TgeneChannels + */ + public List getLchannels() { + return lchannels; + } + + /** + * Fija una lista de objetos TgeneChannels + * + * @param lchannels Lista de objetos TgeneChannels + */ + public void setLchannels(List lchannels) { + this.lchannels = lchannels; + } + + /** + * Entrega V/F + * @return active V/F + */ + public boolean isActive() { + return active; + } + + /** + * Fija V/F + * @param active V/F + */ + public void setActive(boolean active) { + this.active = active; + } + + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/ProfileController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/ProfileController.java.svn-base new file mode 100644 index 0000000..1736e1b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/security/.svn/text-base/ProfileController.java.svn-base @@ -0,0 +1,131 @@ +package com.fp.frontend.controller.security; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.safe.TsafeProfile; + +/** + * Clase controladora del bean TsafeProfile. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ProfileController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public ProfileController() throws Exception { + super(TsafeProfile.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TSAFEPROFILE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save(){ + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if(!dtosave.pendingProcess()){ + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Entrega una lista de objetos TbpmGroups + * @param companycode Código de compania + * @return lrecord Lista de objetos TbpmGroups + */ + public static List find() { + try { + ProfileController cc = new ProfileController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/security/ActivateUserController.java b/frontend/src/main/java/com/fp/frontend/controller/security/ActivateUserController.java new file mode 100644 index 0000000..16a546c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/security/ActivateUserController.java @@ -0,0 +1,187 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.frontend.controller.security; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Response; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.safe.UserDetailController; +import com.fp.frontend.controller.pgeneral.safe.UserProfileController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; + +/** + * Clase controladora del bean TsafeUserDetail. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ActivateUserController extends AbstractController { + + private static final long serialVersionUID = 1L; + @ManagedProperty(value = "#{userDetailController}") + private UserDetailController userdetail; + @ManagedProperty(value = "#{userProfileController}") + private UserProfileController userprofile; + + public ActivateUserController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.lrecord = new ArrayList<>(); + this.beanalias = "CHANGEPASSADMIN"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + try { + if (!this.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + this.userdetail.getMfilters().clear(); + this.userdetail.getMfilelds().clear(); + this.userdetail.getMfilters().put("pk.usercode", this.getMfilters().get("pk.usercode")); + this.userdetail.query(); + this.getMfilelds().put("personname", this.userdetail.getMfilelds().get("personname")); + if (this.userdetail.getRecord().getPk().getUsercode() != null) { + this.userprofile.addFilter("pk.usercode", this.userdetail.getRecord().getPk().getUsercode()); + this.userprofile.query(); + } else { + this.userprofile.setLrecord(null); + MessageHelper.setMessageError("msg_userNotFound"); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + if (this.validateUser()) { + MessageHelper.setMessageError("msg_userrequired"); + return; + } + if (this.userdetail.getRecord().getUserstatuscatalog().equals("ENT")) { + MessageHelper.setMessageError("msg_pendingActivation"); + return; + } + if (this.userdetail.getRecord().getPassword() == null) { + String passwd = this.callerhelper.getPasswordEncriptado(this.userdetail.getRecord().getPk().getUsercode()); + this.userdetail.getRecord().setPassword(passwd); + } + + this.userdetail.getRecord().setUserstatuscatalog("ACT"); + this.userdetail.update(); + this.userdetail.save(); + userdetail.getRecord().getModifiedData().put("statusdesc", "ACTIVO"); + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private boolean validateUser() { + boolean result = false; + if (this.userdetail.getRecord().getPk() == null) { + result = true; + } + return result; + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Entrega el valor de: userdetail + * + * @return UserDetailController + */ + public UserDetailController getUserdetail() { + return this.userdetail; + } + + /** + * Fija el valor de: userdetail + * + * @param userdetail Valor a fijar en el atributo. + */ + public void setUserdetail(UserDetailController userdetail) { + this.userdetail = userdetail; + } + + /** + * Entrega el valor de: userprofile + * + * @return UserProfileController + */ + public UserProfileController getUserprofile() { + return this.userprofile; + } + + /** + * Fija el valor de: userprofile + * + * @param UserProfileController + */ + public void setUserprofile(UserProfileController userprofile) { + this.userprofile = userprofile; + } + + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + this.userdetail.getMfilters().clear(); + this.getMfilelds().clear(); + this.userdetail.addFilter("pk.personcode", t.getPk().getPersoncode().toString()); + this.userdetail.addField("personname", t.getName()); + this.userdetail.query(); + if (this.userdetail.getRecord().getPk().getUsercode() != null) { + this.addFilter("pk.usercode", this.userdetail.getRecord().getPk().getUsercode()); + this.userprofile.addFilter("pk.usercode", this.userdetail.getRecord().getPk().getUsercode()); + this.userprofile.query(); + } else { + MessageHelper.setMessageError("msg_userNotFound"); + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/security/ChangeExpiredPassPersonalController.java b/frontend/src/main/java/com/fp/frontend/controller/security/ChangeExpiredPassPersonalController.java new file mode 100644 index 0000000..5a7ada8 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/security/ChangeExpiredPassPersonalController.java @@ -0,0 +1,208 @@ +/** + * + */ +package com.fp.frontend.controller.security; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TsafeUserDetail. + * + * @author amerchan + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ChangeExpiredPassPersonalController extends AbstractController implements Serializable { + + private static final long serialVersionUID = 1L; + + public ChangeExpiredPassPersonalController() throws Exception { + super(TsafeUserDetail.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.create(); + this.lrecord = new ArrayList<>(); + this.beanalias = "TSAFEUSERDETAIL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void querydatabase() { + try { + + super.addFilter("pk.usercode", super.getLoginController().getRequest().getUser()); + super.addFilterDateto(); + super.addFilter("companycode", super.getLoginController().getRequest().getCompany().toString()); + + if (!this.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + + Request request = this.callerhelper.getRequest(); + request.setTransactionModule("1"); + request.setTransactionCode(123); + request.setTransactionVersion(1); + + DtoQuery dto = super.getDtoQuery(false); + dto.setOrderby("t.pk.personcode"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + // subqueries + SubQuery subquery = new SubQuery("TgeneChannels", "description", "chanelname", "i.pk = t.channelcode"); + dto.addSubQuery(subquery); + + SubQuery subquerya = new SubQuery("TgeneArea", "descripction", "areaname", + "i.pk.companycode = t.companycode and i.pk.areacode = t.areacode "); + dto.addSubQuery(subquerya); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.record = new TsafeUserDetail(); + MessageHelper.setMessageError(resp); + } else { + this.record = (TsafeUserDetail) resp.get(this.beanalias); + if (this.record != null) { + // this.userprofile.addFilter("pk.usercode", this.record.getPk().getUsercode()); + // this.userprofile.query(); + TcustPersonDetail tcpd = PersonLovController.find(this.record.getPk().getPersoncode().toString()); + super.addField("personname", tcpd != null ? tcpd.getName() : ""); + super.postQuery((AbstractDataTransport) resp.get(this.beanalias)); + } else { + // this.userprofile.setLrecord(null); + this.create(); + } + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + if (this.validateUser()) { + MessageHelper.setMessageError("msg_userrequired"); + return; + } + if (!this.passwordvalidate()) { + return; + } + + String oldPass = this.callerhelper.getPasswordEncriptado((String) this.getMfilelds().get("oldpassword")); + String newPass = this.callerhelper.getPasswordEncriptado((String) this.getMfilelds().get("newpassword")); + + this.record.put("newpassword", this.getMfilelds().get("newpassword")); + this.record.put("origination", newPass); + this.record.put("oldpassword", oldPass); + + this.record.setPassword(newPass); + if (this.record.getChangepassword().compareTo("Y") == 0) { + this.record.setChangepassword("N"); + } + this.update(); + + Request request = this.callerhelper.getRequest(); + request.setTransactionModule("1"); + request.setTransactionCode(123); + request.setTransactionVersion(1); + + HashMap msave = new HashMap(); + DtoSave dtoSavePassword = super.getDtoSave(); + dtoSavePassword.setIsForm(true); + if (!dtoSavePassword.pendingProcess()) { + return; + } + msave.put(this.beanalias, dtoSavePassword); + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private boolean validateUser() { + boolean result = false; + if (this.record.getPk() == null) { + result = true; + } + return result; + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + RequestContext.getCurrentInstance().execute("dialogChangePassword.hide()"); + } + + /** + * Valida que el usuario ingrese la contrasena y la contrasena de validacion + * y que las dos sean iguales. + * + * @return boolean + * @throws Exception + */ + private boolean passwordvalidate() throws Exception { + Object p = super.getFieldvalue("newpassword"); + Object np = super.getFieldvalue("confirmpassword"); + if ((p == null) || (np == null)) { + MessageHelper.setMessageError("msg_passwordrequired"); + return false; + } + if (!p.equals(np)) { + MessageHelper.setMessageError("msg_passwordnomatch"); + return false; + } + return true; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/security/ChangePassPersonalController.java b/frontend/src/main/java/com/fp/frontend/controller/security/ChangePassPersonalController.java new file mode 100644 index 0000000..8527f2a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/security/ChangePassPersonalController.java @@ -0,0 +1,568 @@ +/** + * + */ +package com.fp.frontend.controller.security; + +import java.io.IOException; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.ExternalContext; +import javax.faces.context.FacesContext; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.message.MessageTemplatesController; +import com.fp.frontend.controller.pgeneral.message.MessageTemplatesDescController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.mail.Mail; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplates; +import com.fp.persistence.pgeneral.message.TgeneMessageTemplatesDesc; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora del bean TsafeUserDetail. + * + * @author Andres E. Carpio + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ChangePassPersonalController extends + AbstractController implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + + @ManagedProperty(value = "#{personAddressController}") + private PersonAddressController personAddress; + // @ManagedProperty(value = "#{userProfileController}") + // private UserProfileController userprofile; + + // Control para el mensaje de confirmacion + private boolean habilitaCampos = true; + + public ChangePassPersonalController() throws Exception { + super(TsafeUserDetail.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + // Query + this.querydatabase(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.create(); + this.lrecord = new ArrayList<>(); + this.beanalias = "TSAFEUSERDETAIL"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + try { + + super.addFilter("pk.usercode", super.getLoginController() + .getRequest().getUser()); + super.addFilterDateto(); + super.addFilter("companycode", super.getLoginController() + .getRequest().getCompany().toString()); + + if (!this.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(false); + dto.setOrderby("t.pk.personcode"); // En en string van todos los + // campos de orden + // ("t.pk, t.nombre, t.cpais"). + + // subqueries + SubQuery subquery = new SubQuery("TgeneChannels", "description", + "chanelname", "i.pk = t.channelcode"); + dto.addSubQuery(subquery); + + SubQuery subqueryName = new SubQuery( + "TcustPersonDetail", + "name", + "name", + " i.pk.personcode = t.pk.personcode" + + " and i.pk.dateto = to_date('2999-12-31', 'YYYY-MM-DD')"); + dto.addSubQuery(subqueryName); + + SubQuery subquerya = new SubQuery("TgeneArea", "descripction", + "areaname", + "i.pk.companycode = t.companycode and i.pk.areacode = t.areacode "); + dto.addSubQuery(subquerya); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una + // tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.record = new TsafeUserDetail(); + MessageHelper.setMessageError(resp); + } else { + this.record = (TsafeUserDetail) resp.get(this.beanalias); + if (this.record != null) { + // this.userprofile.addFilter("pk.usercode", + // this.record.getPk().getUsercode()); + // this.userprofile.query(); + TcustPersonDetail tcpd = PersonLovController + .find(this.record.getPk().getPersoncode() + .toString()); + super.addField("personname", tcpd != null ? tcpd.getName() + : ""); + TcustPersonAddress mail = personAddress + .findPersonaPorDireccionTipoCatalogo(this.record + .getPk().getPersoncode().toString(), "3"); + this.personAddress.setPersoncode(this.record.getPk() + .getPersoncode()); + if (mail != null) { + super.addField("email", mail.getAddress()); + personAddress.setRecord(mail); + } else { + personAddress.create(); + } + super.postQuery((AbstractDataTransport) resp + .get(this.beanalias)); + } else { + // this.userprofile.setLrecord(null); + this.create(); + } + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + if (this.validateUser()) { + MessageHelper.setMessageError("msg_userrequired"); + return; + } + if (!this.passwordvalidate()) { + return; + } + + String oldPass = this.callerhelper + .getPasswordEncriptado((String) this.getMfilelds().get( + "oldpassword")); + String newPass = this.callerhelper + .getPasswordEncriptado((String) this.getMfilelds().get( + "newpassword")); + + this.record.put("newpassword", this.getMfilelds() + .get("newpassword")); + this.record.put("origination", newPass); + this.record.put("oldpassword", oldPass); + + this.record.setPassword(newPass); + if (this.record.getChangepassword().compareTo("Y") == 0) { + this.record.setChangepassword("N"); + } + this.update(); + if (this.getMfilelds().get("email") != null) { + this.personAddress.getRecord().setAddress( + this.getMfilelds().get("email").toString()); + } + this.personAddress.update(); + + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + DtoSave dtoSavePassword = super.getDtoSave(); + dtoSavePassword.setIsForm(true); + dtoSavePassword.setPosition(1); + if (!dtoSavePassword.pendingProcess()) { + MessageHelper + .setMessageError(MsgControlArmas + .getProperty("msg_error_claveanteriornopuederserigualactual")); + return; + } + DtoSave dtosaveMail = personAddress.getDtoSave(); + dtosaveMail.setPosition(2); + msave.put(this.beanalias, dtoSavePassword); + msave.put(this.personAddress.getBeanalias(), dtosaveMail); + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.envioCorreoCambio(); + MessageHelper.setMessageInfo(resp); + confirmaChangePasswd(); + } else { + + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + + MessageHelper.setMessageError(e); + } + } + + public void saveUser() { + try { + if (this.validateUser()) { + MessageHelper.setMessageError("msg_userrequired"); + return; + } + if (!this.passwordvalidate()) { + return; + } + + String oldPass = this.callerhelper + .getPasswordEncriptado((String) this.getMfilelds().get( + "oldpassword")); + String newPass = this.callerhelper + .getPasswordEncriptado((String) this.getMfilelds().get( + "newpassword")); + System.out.println("Nuevo Password " + newPass); + System.out.println("Nuevo Password " + + (String) this.getMfilelds().get("newpassword")); + if (verificaPasswd((String) this.getMfilelds().get("newpassword"))) { + + this.record.put("newpassword", + this.getMfilelds().get("newpassword")); + this.record.put("origination", newPass); + this.record.put("oldpassword", oldPass); + + this.record.setPassword(newPass); + if (this.record.getChangepassword().compareTo("Y") == 0) { + this.record.setChangepassword("N"); + } + this.update(); + if (this.getMfilelds().get("email") != null) { + this.personAddress.getRecord().setAddress( + this.getMfilelds().get("email").toString()); + } + this.personAddress.update(); + + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + DtoSave dtoSavePassword = super.getDtoSave(); + dtoSavePassword.setIsForm(true); + dtoSavePassword.setPosition(1); + if (!dtoSavePassword.pendingProcess()) { + MessageHelper + .setMessageError(MsgControlArmas + .getProperty("msg_error_claveanteriornopuederserigualactual")); + return; + } + DtoSave dtosaveMail = personAddress.getDtoSave(); + dtosaveMail.setPosition(2); + msave.put(this.beanalias, dtoSavePassword); + msave.put(this.personAddress.getBeanalias(), dtosaveMail); + request.setSaveTables(msave); + + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + try { + this.envioCorreoCambio(); + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + } + + MessageHelper.setMessageInfo(resp); + //habilitaCampos = false; + confirmaChangePasswd(); + mensajeconfirmaChangePasswd(); + // mensajeconfirmaChangePasswd(); + // abre el dialogo que acepte + + } else { + + MessageHelper.setMessageError(resp); + } + } else { + MessageHelper + .setMessageError("LA CLAVE NO CUMPLE LAS POLTICAS DE SEGURIDAD"); + System.out + .println("La clave no cumple las politicas de seguridad nuevo Save"); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + e.printStackTrace(); + } + } + + /** + * Envía el correo de cambio de email + * + * @throws Exception + */ + /* + * private void envioCorreoCambio() throws Exception{ Mail m = new Mail(); + * m.config(ParametersController.find("MAIL.FROM", "1").getTextvalue(), + * ParametersController.find("MAIL.SMTP.SERVER", "1").getTextvalue(), + * ParametersController.find("MAIL.SMTP.PORT", + * "1").getNumbervalue().intValue(), + * ParametersController.find("MAIL.SMTP.USER", "1").getTextvalue(), + * ParametersController.find("MAIL.SMTP.PASSWORD", "1").getTextvalue(), + * Boolean.valueOf(ParametersController.find("MAIL.SMTP.AUTH", + * "1").getTextvalue()), + * Boolean.valueOf(ParametersController.find("MAIL.SMTPS", + * "1").getTextvalue())); m.setTo(personAddress.getRecord().getAddress()); + * MessageTemplatesController message = new MessageTemplatesController(); + * message.addFilter("pk", "62"); message.query(); if(message.getLrecord() + * != null && !message.getLrecord().isEmpty()){ TgeneMessageTemplates asunto + * = message.getLrecord().get(0); MessageTemplatesDescController content = + * new MessageTemplatesDescController(); content.addFilter("pk.code", "62"); + * content.addFilter("pk.languagecode", "ES"); content.query(); + * if(content.getLrecord() != null && !content.getLrecord().isEmpty()){ + * TgeneMessageTemplatesDesc descripcionContenido = + * content.getLrecord().get(0); //Velocity.init(); //VelocityContext context + * = new VelocityContext(); //context.put("nombreusuario", + * this.getLoginController().getRequest().getUser()); //context.put("clave", + * this.record.get("newpassword")); m.setSubject(asunto.getDescription()); + * //StringWriter sw = new StringWriter(); String + * sw=descripcionContenido.getTemplate().replace("$clave", + * this.record.get("newpassword").toString()); + * sw=sw.replace("$nombreusuario", this.record.get("name")+""); + * //Velocity.evaluate(context, sw, "", descripcionContenido.getTemplate()); + * m.setCont(sw.toString()); m.setContentMessageType("text/html"); m.send(); + * } } } + */ + private void envioCorreoCambio() throws Exception { + try { + Mail m = new Mail(); + m.config( + ParametersController.find("MAIL.FROM", "1").getTextvalue(), + ParametersController.find("MAIL.SMTP.SERVER", "1") + .getTextvalue(), + ParametersController.find("MAIL.SMTP.PORT", "1") + .getNumbervalue().intValue(), ParametersController + .find("MAIL.SMTP.USER", "1").getTextvalue(), + ParametersController.find("MAIL.SMTP.PASSWORD", "1") + .getTextvalue(), Boolean + .valueOf(ParametersController.find( + "MAIL.SMTP.AUTH", "1").getTextvalue()), + Boolean.valueOf(ParametersController + .find("MAIL.SMTPS", "1").getTextvalue())); + m.setTo(personAddress.getRecord().getAddress()); + MessageTemplatesController message = new MessageTemplatesController(); + message.addFilter("pk", "62"); + message.query(); + if (message.getLrecord() != null && !message.getLrecord().isEmpty()) { + TgeneMessageTemplates asunto = message.getLrecord().get(0); + MessageTemplatesDescController content = new MessageTemplatesDescController(); + content.addFilter("pk.code", "62"); + content.addFilter("pk.languagecode", "ES"); + content.query(); + if (content.getLrecord() != null + && !content.getLrecord().isEmpty()) { + TgeneMessageTemplatesDesc descripcionContenido = content + .getLrecord().get(0); + // Velocity.init(); + // VelocityContext context = new VelocityContext(); + // context.put("nombreusuario", + // this.getLoginController().getRequest().getUser()); + // context.put("clave", this.record.get("newpassword")); + m.setSubject(asunto.getDescription()); + // StringWriter sw = new StringWriter(); + String sw = descripcionContenido.getTemplate() + .replace("$clave", + this.record.get("newpassword").toString()); + sw = sw.replace("$nombreusuario", this.record.get("name") + + ""); + // Velocity.evaluate(context, sw, "", + // descripcionContenido.getTemplate()); + m.setCont(sw.toString()); + m.setContentMessageType("text/html"); + m.send(); + } + } + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + } + + } + + private boolean validateUser() { + boolean result = false; + if (this.record.getPk() == null) { + result = true; + } + return result; + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + RequestContext.getCurrentInstance().execute( + "PF('dialogChangePassword').hide()"); + } + + // /** + // * Entrega el valor de: userprofile + // * + // * @return UserProfileController + // */ + // public UserProfileController getUserprofile() { + // return userprofile; + // } + // + // /** + // * Fija el valor de: userprofile + // * + // * @param UserProfileController + // */ + // public void setUserprofile(UserProfileController userprofile) { + // this.userprofile = userprofile; + // } + /** + * Valida que el usuario ingrese la contrasena y la contrasena de validacion + * y que las dos sean iguales. + * + * @return boolean + * @throws Exception + */ + private boolean passwordvalidate() throws Exception { + Object p = super.getFieldvalue("newpassword"); + Object np = super.getFieldvalue("confirmpassword"); + if ((p == null) || (np == null)) { + MessageHelper.setMessageError("msg_passwordrequired"); + return false; + } + if (!p.equals(np)) { + MessageHelper.setMessageError("msg_passwordnomatch"); + return false; + } + return true; + } + + public PersonAddressController getPersonAddress() { + return personAddress; + } + + public void setPersonAddress(PersonAddressController personAddress) { + this.personAddress = personAddress; + } + + public boolean isHabilitaCampos() { + return habilitaCampos; + } + + public void setHabilitaCampos(boolean habilitaCampos) { + this.habilitaCampos = habilitaCampos; + } + + public void cancelChangePasswd() throws IOException { + // RequestContext.getCurrentInstance().execute("PF('dialog').show()"); + logout(); + ExternalContext ec = FacesContext.getCurrentInstance() + .getExternalContext(); + ec.redirect(ec.getRequestContextPath() + "/" + "login.xhtml"); + } + + public void confirmaChangePasswd() throws IOException { + // logout(); + MessageHelper + .setMessageInfo("SU CLAVE HA SIDO CAMBIADA SATISFACTORIAMENTE"); + // confirmaChangePswd(); + // ExternalContext ec = + // FacesContext.getCurrentInstance().getExternalContext(); + // ec.redirect(ec.getRequestContextPath() + "/" + "login.xhtml"); + // ec.redirect(ec.getRequestContextPath() + "/" + + // "passwordExpired.xhtml"); + } + + public void mensajeconfirmaChangePasswd() throws IOException { + logout(); + + ExternalContext ec = FacesContext.getCurrentInstance() + .getExternalContext(); + ec.redirect(ec.getRequestContextPath() + "/" + "login.xhtml"); + } + + public String logout() { + System.out.println("logout::cerrando session bean"); + FacesContext fc = FacesContext.getCurrentInstance(); + if (fc != null) { + fc.getExternalContext().invalidateSession(); + } + return "/login?faces-redirect=true"; + } + + // Procedimiento Verifica Seguridad de la Clave del Usuario + private boolean verificaPasswd(String clave) { + boolean minuscula = false; + boolean mayuscula = false; + boolean numero = false; + boolean caracter = false; + // Hace un barrido de los caracteres ingresados en la clave + for (int i = 0; i < clave.length(); i++) { + // Verifica que el codigo ASCII ( letras minusculas) + if (clave.charAt(i) >= 97 && clave.charAt(i) <= 122) { + minuscula = true; + // Verifica que el codigo ASCII ( letras mayusculas) + } else if (clave.charAt(i) >= 65 && clave.charAt(i) <= 90) { + mayuscula = true; + // Verifica que el codigo ASCII ( numeros) + } else if (clave.charAt(i) >= 48 && clave.charAt(i) <= 57) { + numero = true; + // Si no cumple las condiciones anteriores es caracter especial + } else { + caracter = true; + } + } + if ((minuscula == true) && (mayuscula == true) && (numero == true) + && (caracter == true)) { + return true; + } else { + return false; + } + } + + public String confirmaChangePswd() { + System.out.println("logout::cerrando session bean confirma clave"); + /* + * FacesContext fc = FacesContext.getCurrentInstance(); if (fc != null) + * { fc.getExternalContext().invalidateSession(); } + */ + return "/passwordExpired?faces-redirect=true"; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/security/LoginController.java b/frontend/src/main/java/com/fp/frontend/controller/security/LoginController.java new file mode 100644 index 0000000..8c55cd7 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/security/LoginController.java @@ -0,0 +1,501 @@ +package com.fp.frontend.controller.security; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ParametersController; +import com.fp.frontend.controller.pgeneral.gene.TerminosCondicionesController; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.EnumParametros; +import com.fp.persistence.commondb.exception.CommondbException; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.soli.TarmTerminos; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneParameters; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetailKey; +import com.fp.persistence.pgeneral.safe.TsafeUserProfile; +import com.fp.persistence.pgeneral.safe.TsafeUserProfileKey; +import java.io.PrintStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.faces.application.Application; +import javax.faces.application.NavigationHandler; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import javax.faces.context.ExternalContext; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpServletRequest; +import org.primefaces.context.RequestContext; +import org.primefaces.model.StreamedContent; + +@ManagedBean +@SessionScoped +public class LoginController { + + private Request request; + private MaiaMenu maiaMenu; + private Map mdata = new HashMap(); + private final Map mlocation = new HashMap(); + private List> lcompany; + private List lprofile; + private String changepassword; + private boolean renderBpmData = false; + private String casLogoutUrl; + private String profilecode; + private String rutaTerminos; + private StreamedContent content; + + @PostConstruct + private void postconstruct() { + this.request = new Request(); + this.request.setCompany(Integer.valueOf(1)); + + HttpServletRequest httpServletRequest = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest(); + this.request.setTerminalCode(httpServletRequest.getRemoteAddr()); + this.request.put("ip", httpServletRequest.getRemoteAddr()); + this.request.put("host", httpServletRequest.getLocalAddr()); + + fillCompanies(); + this.maiaMenu = new MaiaMenu(); + } + + public void authenticate() throws Throwable { + System.out.println("autentificacion debe cambiar : "); + try { + System.out.println("changepassword debe cambiar: "); + String user = this.mdata.get("a").toString(); + String pass = this.mdata.get("b").toString(); + this.request.put("login", user); + + CallerHelper ch = new CallerHelper(); + Response resp = ch.login(this.request, user, pass); + TarmTerminos terminos = TerminosCondicionesController.findxIdentificacion(user); + if ((resp.getResponseCode().compareTo("0") == 0) && (terminos == null)) { + System.out.println("terminos"); + try { + this.rutaTerminos = ParametersController.find("CODIGO.TERMINOS.COND", "1").getTextvalue(); + this.content = AlfrescoController.downloadDocument(this.rutaTerminos); + } catch (Exception e) { + System.out.println("error al obtener el parametro CODIGO.TERMINOS.COND"); + } + RequestContext requestContext = RequestContext.getCurrentInstance(); + requestContext.execute("PF('aceptaTerminosCond').show()"); + } else if (resp.getResponseCode().compareTo("0") == 0) { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) resp.get("TSAFEUSERDETAIL"); + manageloginresponse(tsafeUserDetail); + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("TSAFEUSERDETAIL", tsafeUserDetail); + if (this.changepassword.equalsIgnoreCase("N")) { + FacesContext ctx = FacesContext.getCurrentInstance(); + ExternalContext externalContext = ctx.getExternalContext(); + NavigationHandler handler = ctx.getApplication().getNavigationHandler(); + handler.handleNavigation(ctx, null, "workspace"); + + externalContext.redirect(externalContext.getRequestContextPath() + "/" + "pages/workspace.xhtml"); + + this.request.setBrowser(obtainBrowserName((String) externalContext.getRequestHeaderMap().get("User-Agent"))); + this.request.setOperativesystem(obtainSOName((String) externalContext.getRequestHeaderMap().get("User-Agent"))); + + changeprofile(); + } else { + ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext(); + ec.redirect(ec.getRequestContextPath() + "/" + "change-password.xhtml"); + System.out.println("debe cambiar la clave : " + ec.getRequestContextPath() + "/" + "passwordExpired.xhtml"); + } + } else { + MessageHelper.setMessageError(resp); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void aceptaTerminosCondicion() { + String user = this.mdata.get("a").toString(); + String pass = this.mdata.get("b").toString(); + try { + CallerHelper ch = new CallerHelper(); + + this.request.put("terminos", "terminos"); + this.request.put("aceptaterminos", "SI"); + this.request.put("identificacionterminos", user); + this.request.put("documentoterminos", this.rutaTerminos); + + Response resp = ch.login(this.request, user, pass); + + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) resp.get("TSAFEUSERDETAIL"); + manageloginresponse(tsafeUserDetail); + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("TSAFEUSERDETAIL", tsafeUserDetail); + if (tsafeUserDetail.getChangepassword().equalsIgnoreCase("N")) { + FacesContext ctx = FacesContext.getCurrentInstance(); + ExternalContext externalContext = ctx.getExternalContext(); + NavigationHandler handler = ctx.getApplication().getNavigationHandler(); + handler.handleNavigation(ctx, null, "workspace"); + + externalContext.redirect(externalContext.getRequestContextPath() + "/" + "pages/workspace.xhtml"); + + this.request.setBrowser(obtainBrowserName((String) externalContext.getRequestHeaderMap().get("User-Agent"))); + this.request.setOperativesystem(obtainSOName((String) externalContext.getRequestHeaderMap().get("User-Agent"))); + + changeprofile(); + } else { + ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext(); + ec.redirect(ec.getRequestContextPath() + "/" + "change-password.xhtml"); + System.out.println("debe cambiar la clave : " + ec.getRequestContextPath() + "/" + "passwordExpired.xhtml"); + } + } catch (Exception e) { + e.printStackTrace(); + } catch (Throwable e) { + e.printStackTrace(); + } + } + + public void authenticateCas(String username, String urlCasLogout) + throws Throwable { + try { + this.casLogoutUrl = urlCasLogout; + this.request.put("login", username); + CallerHelper ch = new CallerHelper(); + Response resp = ch.loginCas(this.request, username, null); + if (resp.getResponseCode().compareTo("0") == 0) { + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) resp.get("TSAFEUSERDETAIL"); + manageloginresponse(tsafeUserDetail); + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("TSAFEUSERDETAIL", tsafeUserDetail); + + changeprofile(); + } else { + throw new Exception(resp.getResponseCode() + " " + resp.getResponseUserMessage()); + } + } catch (Exception e) { + throw e; + } + } + + public void updateusesession() { + System.out.println("logout::cerrando session"); + try { + CallerHelper ch = new CallerHelper(); + ch.logout(this.request); + } catch (Throwable e) { + } + } + + public String logout() { + System.out.println("logout::cerrando session bean"); + updateusesession(); + FacesContext fc = FacesContext.getCurrentInstance(); + if (fc != null) { + fc.getExternalContext().invalidateSession(); + } + return "/login?faces-redirect=true"; + } + + private void manageloginresponse(TsafeUserDetail userdetail) { + this.mlocation.put("cia", userdetail.get("cn")); + this.mlocation.put("branch", userdetail.get("bn")); + this.mlocation.put("office", userdetail.get("on")); + this.mlocation.put("area", userdetail.get("an")); + this.mlocation.put("channel", userdetail.get("chn")); + this.mlocation.put("accodate", userdetail.get("ad")); + this.mlocation.put("workdate", userdetail.get("wd")); + this.mlocation.put("nickname", userdetail.getNickname()); + this.mlocation.put("sbsemployee", userdetail.get("sbsemployee")); + this.mlocation.put("sbsusercode", userdetail.get("sbsusercode")); + obtenerCentroControl(userdetail); + obtenerUnidadControl(userdetail); + this.request.setUser(userdetail.getPk().getUsercode()); + this.request.setCompany(userdetail.getCompanycode()); + this.request.setBranchCode(userdetail.getBranchcode()); + this.request.setOfficeCode(userdetail.getOfficecode()); + this.request.setChannelCode(userdetail.getChannelcode()); + this.request.setLanguage(userdetail.getLanguagecode()); + this.request.setCentrocontrol(userdetail.getCcentrocontrol()); + + this.changepassword = userdetail.getChangepassword(); + this.lprofile = ((List) userdetail.get("lprofile")); + this.request.setProfile(((TsafeUserProfile) this.lprofile.get(0)).getPk().getProfilecode()); + } + + private void obtenerCentroControl(TsafeUserDetail userdetail) { + TgeneCatalogDetail tcentrocontrol = null; + try { + TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(userdetail.getCcentrocontrol()); + if (centroControl != null) { + tcentrocontrol = CatalogDetailController.findCatalogo(centroControl.getInstituciontipo(), centroControl.getInstitucion()); + } + } catch (CommondbException e) { + } catch (Exception e) { + } + if (tcentrocontrol != null) { + userdetail.addAddtionalInfo("centrocontrol", tcentrocontrol.getDescription()); + this.mlocation.put("centrocontrol", tcentrocontrol.getDescription()); + } else { + userdetail.addAddtionalInfo("centrocontrol", ""); + this.mlocation.put("centrocontrol", ""); + } + } + + private void obtenerUnidadControl(TsafeUserDetail userdetail) { + TgeneCatalogDetail unidad = null; + try { + TarmCentroControl centroControl = CentroControlArmasController.findPorCodigo(userdetail.getCcentrocontrol()); + if (centroControl != null) { + unidad = CatalogDetailController.findCatalogo(centroControl.getNombreinstitucioncodigo(), centroControl.getNombreinstitucion()); + } + } catch (CommondbException e) { + } catch (Exception e) { + } + if (unidad != null) { + userdetail.addAddtionalInfo("unidad", unidad.getDescription()); + this.mlocation.put("unidad", unidad.getDescription()); + } else { + userdetail.addAddtionalInfo("unidad", ""); + this.mlocation.put("unidad", ""); + } + } + + public void changeprofile() + throws Exception { + try { + if (this.profilecode != null) { + this.request.setProfile(this.profilecode); + } + CallerHelper ch = new CallerHelper(); + Response resp = ch.menu(this.request); + if (resp.getResponseCode().compareTo("0") == 0) { + Map rootmenu = (Map) resp.get("rootmenu"); + List> lmenu = (List) rootmenu.get("items"); + this.maiaMenu.buildMenu(lmenu); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private void fillCompanies() { + try { + CallerHelper ch = new CallerHelper(); + Request request = new Request(); + DtoQuery dto = new DtoQuery(null, null, null, true, null); + + HashMap mtables = new HashMap(); + mtables.put("CIAS", dto); + request.setCompany(Integer.valueOf(1)); + request.getModifiedData().put("queryalias", "COMPANY"); + request.setQueryTables(mtables); + + Response resp = ch.executeQuery(request); + if (resp.getResponseCode().compareTo("0") != 0) { + this.lcompany = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lcompany = ((List) resp.get("CIAS")); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + public void fijaRequestData(Request request, String transactionmodule, Integer transactioncode, Integer transactionversion) + throws Exception { + request.setCompany(this.request.getCompany()); + request.setCentrocontrol(this.request.getCentrocontrol()); + request.setUnidad(this.request.getUnidad()); + request.setBranchCode(this.request.getBranchCode()); + request.setOfficeCode(this.request.getOfficeCode()); + request.setUser(this.request.getUser()); + request.setLanguage(this.request.getLanguage()); + request.setChannelCode(this.request.getChannelCode()); + request.setTerminalCode(this.request.getTerminalCode()); + request.setProfile(this.request.getProfile()); + request.setBrowser(this.request.getBrowser()); + request.setOperativesystem(this.request.getOperativesystem()); + + request.setTransactionModule(transactionmodule); + request.setTransactionCode(transactioncode); + request.setTransactionVersion(transactionversion); + } + + private String obtainBrowserName(String userAgent) { + if (userAgent.contains("MSIE")) { + return buildBrowser(userAgent, "MSIE"); + } + if (userAgent.contains("Firefox")) { + return buildBrowser(userAgent, "Firefox"); + } + if (userAgent.contains("Chrome")) { + return buildBrowser(userAgent, "Chrome"); + } + if (userAgent.contains("Opera")) { + return buildBrowser(userAgent, "Opera"); + } + if (userAgent.contains("Safari")) { + return buildBrowser(userAgent, "Safari"); + } + return "Unknown"; + } + + private String obtainSOName(String userAgent) { + String os = ""; + if (userAgent.contains("Windows")) { + os = buildOS(userAgent, "Windows"); + } else if (userAgent.contains("Mac")) { + os = buildOS(userAgent, "Mac"); + } else if (userAgent.contains("Linux")) { + os = buildOS(userAgent, "Linux"); + } else if (userAgent.contains("android")) { + os = buildOS(userAgent, "android"); + } else if (userAgent.contains("iphone")) { + os = buildOS(userAgent, "iphone"); + } else { + os = "UnKnown, More-Info: " + userAgent; + } + return os; + } + + private String buildBrowser(String userAgent, String id) { + String browser = ""; + if (userAgent.contains("MSIE")) { + String[] value = userAgent.substring(userAgent.indexOf(id), userAgent.length()).split(" "); + browser = value[0] + " " + value[1]; + } else { + String[] value = userAgent.substring(userAgent.indexOf(id), userAgent.length()).split(" "); + browser = value[0]; + } + return browser; + } + + private String buildOS(String userAgent, String id) { + String so = ""; + if (userAgent.contains("Windows")) { + String[] value = userAgent.substring(userAgent.indexOf(id), userAgent.length()).split(" "); + so = value[0] + " " + value[1] + " " + value[2]; + } else { + String[] value = userAgent.substring(userAgent.indexOf(id), userAgent.length()).split(" "); + so = value[0] + " " + value[1]; + } + return so; + } + + public List> getLcompany() { + return this.lcompany; + } + + public void setLcompany(List> lcompany) { + this.lcompany = lcompany; + } + + public List getLprofile() { + return this.lprofile; + } + + public void setLprofile(List lprofile) { + this.lprofile = lprofile; + } + + public String getChangepassword() { + return this.changepassword; + } + + public void setChangepassword(String changepassword) { + this.changepassword = changepassword; + } + + public Map getMdata() { + return this.mdata; + } + + public void setMdata(Map mdata) { + this.mdata = mdata; + } + + public Request getRequest() { + return this.request; + } + + public void setRequest(Request request) { + this.request = request; + } + + public MaiaMenu getMaiaMenu() { + return this.maiaMenu; + } + + public void setMaiaMenu(MaiaMenu maiaMenu) { + this.maiaMenu = maiaMenu; + } + + public Map getMlocation() { + return this.mlocation; + } + + public boolean isRenderBpmData() { + return this.renderBpmData; + } + + public void setRenderBpmData(boolean renderBpmData) { + this.renderBpmData = renderBpmData; + } + + public String getCasLogoutUrl() { + return this.casLogoutUrl; + } + + public void setCasLogoutUrl(String casLogoutUrl) { + this.casLogoutUrl = casLogoutUrl; + } + + public String getProfilecode() { + return this.profilecode; + } + + public void setProfilecode(String profilecode) { + this.profilecode = profilecode; + } + + public void help() + throws Exception { + String m = this.request.getTransactionModule(); + String t = this.request.getTransactionCode().toString(); + String v = this.request.getTransactionVersion().toString(); + String p = ParametersController.find(EnumParametros.PATH_ALFRESCO_AYUDA.getCodigo(), this.request.getCompany().toString()).getTextvalue(); + RequestContext.getCurrentInstance().execute("Maiaworkspace.loadHelp('" + m + "', '" + t + "', '" + v + "', '" + p + "')"); + } + + @PreDestroy + private void closeSessionMaia() { + try { + FacesContext fc = FacesContext.getCurrentInstance(); + if (fc != null) { + logout(); + } + } catch (Exception e) { + } + } + + public String getRutaTerminos() { + return this.rutaTerminos; + } + + public void setRutaTerminos(String rutaTerminos) { + this.rutaTerminos = rutaTerminos; + } + + public StreamedContent getContent() { + return this.content; + } + + public void setContent(StreamedContent content) { + this.content = content; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/security/MaiaMenu.java b/frontend/src/main/java/com/fp/frontend/controller/security/MaiaMenu.java new file mode 100644 index 0000000..92f1857 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/security/MaiaMenu.java @@ -0,0 +1,127 @@ +package com.fp.frontend.controller.security; + +import java.util.List; +import java.util.Map; + +import javax.faces.context.FacesContext; + +import org.primefaces.model.menu.DefaultMenuItem; +import org.primefaces.model.menu.DefaultMenuModel; +import org.primefaces.model.menu.DefaultSubMenu; +import org.primefaces.model.menu.MenuModel; +import org.primefaces.model.menu.Submenu; + +import com.fp.frontend.helper.MessageHelper; + +public class MaiaMenu { + + private MenuModel menuModel; + + private String maiaMenuJson; + + private String contextPath = ""; + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + public MaiaMenu() { + try { + maiaMenuJson = ""; + contextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + public void buildMenu(List> lmenu) throws Exception { + menuModel = new DefaultMenuModel(); + for (Map menu : lmenu) { + String label = (String) menu.get("t"); + DefaultSubMenu submenu = new DefaultSubMenu(); + submenu.setLabel(label); + menuModel.addElement(submenu); + + if (menu.get("items") instanceof Map) { + this.addMenuItem(submenu, (Map) menu.get("items")); + } else { + this.addSubmenu(submenu, (List>) menu.get("items")); + } + } + } + + @SuppressWarnings("unchecked") + private void addSubmenu(Submenu submenupadre, List> lsubmenu) throws Exception { + for (Map menu : lsubmenu) { + Object obj = menu.get("items"); + if (obj == null) { + this.addMenuItem(submenupadre, menu); + } else { + String label = (String) menu.get("t"); + DefaultSubMenu submenu = new DefaultSubMenu(); + submenu.setLabel(label); + submenupadre.getElements().add(submenu); + this.addSubmenu(submenu, (List>) menu.get("items")); + } + } + + } + + @SuppressWarnings("unchecked") + private void addMenuItem(Submenu submenu, Map mdata) throws Exception { + String tname = (String) mdata.get("t"); + String modulo = (String) mdata.get("m"); + Integer transaccion = (Integer) mdata.get("tr"); + Integer version = (Integer) mdata.get("v"); + String pagina = (String) mdata.get("jsfp"); + String autoconsulta = (String) mdata.get("a"); + String url = pagina + "?" + "m=" + modulo + "&t=" + transaccion + "&v=" + version + "&autoquery=" + autoconsulta; + String key = modulo + "-" + transaccion + "-" + version; + String nameMenu = tname + " (" + modulo + "-" + transaccion + ")"; + DefaultMenuItem menuItem = new DefaultMenuItem(); + menuItem.setValue(nameMenu); + menuItem.setUrl("javascript:Maiaworkspace.loadPage('" + url + "','" + nameMenu + "')"); + menuItem.setIcon("ui-icon-document"); + menuItem.setStyleClass("m-menuitem"); + submenu.getElements().add(menuItem); + maiaMenuJson = maiaMenuJson + "'" + key + "': {'url':'" + url + "','name':'" + nameMenu + "'},"; + } + + /** + * Entrega el valor de: menuModel + * + * @return MenuModel + */ + public MenuModel getMenuModel() { + return menuModel; + } + + /** + * Fija el valor de: menuModel + * + * @param Valor a fijar en el atributo. + */ + public void setMenuModel(MenuModel menuModel) { + this.menuModel = menuModel; + } + + /** + * Entrega el valor de: maiaMenuJson + * + * @return String + */ + public String getMaiaMenuJson() { + return maiaMenuJson; + } + + /** + * Fija el valor de: maiaMenuJson + * + * @param maiaMenuJson Valor a fijar en el atributo + */ + public void setMaiaMenuJson(String maiaMenuJson) { + this.maiaMenuJson = maiaMenuJson; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/security/MenuProfileController.java b/frontend/src/main/java/com/fp/frontend/controller/security/MenuProfileController.java new file mode 100644 index 0000000..55ba4a5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/security/MenuProfileController.java @@ -0,0 +1,218 @@ +package com.fp.frontend.controller.security; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.query.SubQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.menu.MenuController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.menu.TgeneMenu; +import com.fp.persistence.pgeneral.menu.TgeneMenuProfile; +import com.fp.persistence.pgeneral.safe.TsafeProfile; + +/** + * Clase controladora del bean TgeneMenuProfile. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class MenuProfileController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public MenuProfileController() throws Exception { + super(TgeneMenuProfile.class); + } + + private List lprofile; + private List lMenu; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //Listas + this.lprofile = ProfileController.find(); + this.lMenu = MenuController.find(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.create(); + this.lrecord = new ArrayList<>(); + this.beanalias = "TGENEMENUPROFILE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + // subqueries 1 + SubQuery subquery1 = new SubQuery("TsafeProfile", "description", "profiledesc", + "i.pk = t.pk"); + dto.addSubQuery(subquery1); + + // subqueries 2 + SubQuery subquery2 = new SubQuery("TgeneMenu", "description", "menudesc", + "i.pk = t.menucode"); + dto.addSubQuery(subquery2); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void create() throws Exception { + super.create(); + this.record.setPk(super.getMfilters().get("pk")); + } + + /** + * Entrega una lista de objetos TbpmGroups + * + * @param companycode Código de compania + * @return lrecord Lista de objetos TbpmGroups + */ + public static List find() { + try { + MenuProfileController cc = new MenuProfileController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } + + /** + * Fija la descripcion del perfil en el record + */ + public void setProfileDesc() { + for (TsafeProfile p : this.lprofile) { + if (p.getPk().compareTo(this.record.getPk()) == 0) { + this.record.put("profiledesc", p.getDescription()); + } + } + } + + /** + * Fija la descripcion del menu en el record + */ + public void setMenuDesc() { + for (TgeneMenu m : this.lMenu) { + if (m.getPk().compareTo(this.record.getMenucode()) == 0) { + this.record.put("menudesc", m.getDescription()); + } + } + } + + /** + * Entrega una lista de objetos TsafeProfile + * + * @return lprofile + */ + public List getLprofile() { + return this.lprofile; + } + + /** + * Fija una lista de objetos TsafeProfile + * + * @param lprofile + */ + public void setLprofile(List lprofile) { + this.lprofile = lprofile; + } + + /** + * Entrega una lista de objetos TgeneMenu + * + * @return lMenu + */ + public List getlMenu() { + return this.lMenu; + } + + /** + * Fija una lista de objetos TgeneMenu + * + * @param lMenu + */ + public void setlMenu(List lMenu) { + this.lMenu = lMenu; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/security/ModifyUserController.java b/frontend/src/main/java/com/fp/frontend/controller/security/ModifyUserController.java new file mode 100644 index 0000000..a9e3c67 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/security/ModifyUserController.java @@ -0,0 +1,554 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.fp.frontend.controller.security; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.primefaces.event.SelectEvent; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.lov.PersonLovController; +import com.fp.frontend.controller.pgeneral.gene.AreaController; +import com.fp.frontend.controller.pgeneral.gene.BranchController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.controller.pgeneral.gene.ChannelController; +import com.fp.frontend.controller.pgeneral.gene.LanguageController; +import com.fp.frontend.controller.pgeneral.gene.OfficeController; +import com.fp.frontend.controller.pgeneral.lov.ProfileLovController; +import com.fp.frontend.controller.pgeneral.safe.TerminalController; +import com.fp.frontend.controller.pgeneral.safe.UserDetailController; +import com.fp.frontend.controller.pgeneral.safe.UserProfileController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgControlArmas; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonDetail; +import com.fp.persistence.pgeneral.gene.TgeneArea; +import com.fp.persistence.pgeneral.gene.TgeneBranch; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.gene.TgeneChannels; +import com.fp.persistence.pgeneral.gene.TgeneLanguage; +import com.fp.persistence.pgeneral.gene.TgeneOffice; +import com.fp.persistence.pgeneral.safe.TsafeProfile; +import com.fp.persistence.pgeneral.safe.TsafeTerminal; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserProfile; + +/** + * Clase controladora de modifyuser + * + * @author BPTWPA + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ModifyUserController extends AbstractController { + + @ManagedProperty(value = "#{userDetailController}") + private UserDetailController userdetail; + @ManagedProperty(value = "#{userProfileController}") + private UserProfileController userprofile; + + public ModifyUserController() throws Exception { + super(AbstractDataTransport.class); + } + /** + * Atributo para la lista de objetos TgeneCatalogDetail para el Status del + * usuario + */ + private List luserStatus; + /** + * Atributo para la lista de objetos TsafeTerminal para el terminal + */ + private List lterminal; + /** + * Atributo para la lista de idiomas + */ + private List llanguage; + /** + * Atributo para los canales + */ + private List lchannel; + /** + * Atributo para la llist de sucursales + */ + private List lbranch; + /** + * Atributo para las oficinas + */ + private List loffice; + /** + * Atributo para las areas + */ + private List larea; + + private String centroControl; + + private String unidad; + + private List centroControls; + /** + * Atributo para la lista de objetos TgeneCatalogDetail + */ + private List unidades; + /** + * Deshabilita la pantalla después de grabar la solicitud + */ + private boolean deshabilitarPantalla; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + //list + this.luserStatus = CatalogDetailController.find("USERSTATUS"); + this.lterminal = TerminalController.find(super.getLoginController().getRequest().getCompany().toString()); + this.llanguage = LanguageController.find(); + this.lchannel = ChannelController.find(); + this.lbranch = BranchController.find(super.getLoginController().getRequest().getCompany().toString()); + this.larea = AreaController.find(super.getLoginController().getRequest().getCompany().toString()); + this.unidades = new ArrayList<>(); + this.unidad = ""; + this.centroControls = CatalogDetailController.find("INSTITUCION"); + this.deshabilitarPantalla = Boolean.TRUE; + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.lrecord = new ArrayList<>(); + this.beanalias = "CHANGEPASSADMIN"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + try { + if (!this.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + this.userdetail.getMfilters().clear(); + this.userdetail.getMfilelds().clear(); + this.userdetail.getMfilters().put("pk.usercode", this.getMfilters().get("pk.usercode")); + this.userdetail.query(); + + if (this.userdetail.getRecord().getPk().getUsercode() != null) { + this.deshabilitarPantalla = Boolean.FALSE; + loadCentroControlUnidad(); + this.loffice = OfficeController.find(this.userdetail.getRecord().getBranchcode().toString(), super.getLoginController().getRequest().getCompany().toString()); + this.userprofile.addFilter("pk.usercode", this.userdetail.getRecord().getPk().getUsercode()); + this.userprofile.query(); + } else { + this.deshabilitarPantalla = Boolean.TRUE; + this.userdetail.create(); + this.userdetail.getRecord().setUserstatuscatalogcode("USERSTATUS"); + this.userdetail.getRecord().setUserstatuscatalog(null); + this.userprofile.setLrecord(null); + MessageHelper.setMessageError("msg_userNotFound"); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Carga el centro de control por el tarm centro de control de armas + */ + private void loadCentroControlUnidad() { + //Consultar el centro de control de armas + if (userdetail.getRecord().getCcentrocontrol() != null && !userdetail.getRecord().getCcentrocontrol().isEmpty()) { + TarmCentroControl tarmCentroControl = CentroControlArmasController.findPorCodigo(userdetail.getRecord().getCcentrocontrol()); + if (tarmCentroControl != null) { + centroControl = tarmCentroControl.getInstitucion(); + unidad = tarmCentroControl.getNombreinstitucion(); + seleccionaCentroControl(); + } else { + centroControl = ""; + unidad = ""; + } + } else { + centroControl = ""; + unidad = ""; + } + } + + @Override + public void save() { + try { + if (this.validateUser()) { + MessageHelper.setMessageError("msg_userrequired"); + return; + } + + Request request = this.callerhelper.getRequest(); + HashMap msave = new HashMap(); + //Obteniendo los datos del usuario logueado + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + this.userdetail.getRecord().setModifyuser(tsafeUserDetail.getPk().getUsercode()); + //Consultar el centro de control de armas + TarmCentroControl tarmCentroControl = CentroControlArmasController.findxCcontrolUnidad(centroControl, unidad); + + if (tarmCentroControl != null && tarmCentroControl.getInstitucion().equals(centroControl)) { + this.userdetail.getRecord().setCcentrocontrol(tarmCentroControl.getPk()); + } else { + centroControl = ""; + } + + this.userdetail.update(); + + DtoSave dtosaveuserdet = this.userdetail.getDtoSave(); + if (dtosaveuserdet.pendingProcess()) { + dtosaveuserdet.setIsForm(true); + msave.put(this.userdetail.getBeanalias(), dtosaveuserdet); + } + + DtoSave dtosaveuserprofile = this.userprofile.getDtoSave(); + if (dtosaveuserprofile.pendingProcess()) { + msave.put(this.userprofile.getBeanalias(), dtosaveuserprofile); + } + + // this.userdetail.save(); + // this.userprofile.save(); + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + this.userdetail.postCommit(resp); + this.userprofile.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + private boolean validateUser() { + boolean result = false; + if (this.userdetail.getRecord().getPk() == null) { + result = true; + } + return result; + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Carga las oficinas + */ + public void loadOffice() { + this.loffice = OfficeController.find(this.userdetail.getRecord().getBranchcode().toString(), super.getLoginController().getRequest().getCompany().toString()); + } + + /** + * Entrega el valor de: userdetail + * + * @return UserDetailController + */ + public UserDetailController getUserdetail() { + return this.userdetail; + } + + /** + * Fija el valor de: userdetail + * + * @param userdetail Valor a fijar en el atributo. + */ + public void setUserdetail(UserDetailController userdetail) { + this.userdetail = userdetail; + } + + /** + * Entrega el valor de: userprofile + * + * @return UserProfileController + */ + public UserProfileController getUserprofile() { + return this.userprofile; + } + + /** + * Fija el valor de: userprofile + * + * @param UserProfileController + */ + public void setUserprofile(UserProfileController userprofile) { + this.userprofile = userprofile; + } + + /** + * Carga las unidades de control por el centro de control + */ + public void seleccionaCentroControl() { + if (centroControl != null) { + unidades = CentroControlArmasController.findxInstitucion(centroControl); + } else { + unidades = new ArrayList<>(); + userdetail.getRecord().setCcentrocontrol(null); + } + } + + public void openPersonLov() { + Map> params = new HashMap<>(); + PersonLovController.openLov(params); + } + + public void onReturnPersonLov(SelectEvent event) throws Exception { + TcustPersonDetail t = (TcustPersonDetail) event.getObject(); + this.userdetail.getMfilters().clear(); + this.getMfilelds().clear(); + this.userdetail.addFilter("pk.personcode", t.getPk().getPersoncode().toString()); + this.userdetail.addField("personname", t.getName()); + this.userdetail.query(); + + if (this.userdetail.getRecord().getPk().getUsercode() != null) { + deshabilitarPantalla = Boolean.FALSE; + loadCentroControlUnidad(); + this.loffice = OfficeController.find(this.userdetail.getRecord().getBranchcode().toString(), super.getLoginController().getRequest().getCompany().toString()); + this.addFilter("pk.usercode", this.userdetail.getRecord().getPk().getUsercode()); + this.userprofile.addFilter("pk.usercode", this.userdetail.getRecord().getPk().getUsercode()); + this.userprofile.query(); + } else { + deshabilitarPantalla = Boolean.TRUE; + this.userdetail.getRecord().setUserstatuscatalog(null); + MessageHelper.setMessageError("msg_userNotFound"); + } + } + + public void openProfileLov() { + Map> params = new HashMap<>(); + ProfileLovController.openLov(params); + } + + public void onReturnProfileLov(SelectEvent event) throws Exception { + TsafeProfile t = (TsafeProfile) event.getObject(); + this.userprofile.create(); + if (this.userdetail.getRecord().getPk() != null) { + this.userprofile.getRecord().getPk().setUsercode(this.userdetail.getRecord().getPk().getUsercode()); + this.userprofile.getRecord().getPk().setProfilecode(t.getPk()); + this.userprofile.getRecord().put("profiledesc", t.getDescription()); + if (this.verifyProfile()) { + MessageHelper.setMessageError("msg_userExist"); + } else { + this.userprofile.update(); + } + } else { + MessageHelper.setMessageError("msg_userrequired"); + } + } + + /** + * Verifica si hay un perfil seleccionado + * + * @return result V/F + */ + private boolean verifyProfile() { + boolean result = false; + if (!this.userprofile.getLrecord().isEmpty()) { + for (TsafeUserProfile profile : this.userprofile.getLrecord()) { + if (profile.getPk().getProfilecode().compareTo(this.userprofile.getRecord().getPk().getProfilecode()) == 0) { + result = true; + break; + } + } + } + return result; + } + + /** + * Entrega una lista de objetos TgeneCatalogDetail + * + * @return luserStatus Lista de objetos TgeneCatalogDetail + */ + public List getLuserStatus() { + return this.luserStatus; + } + + /** + * Fija una lista de objetos TgeneCatalogDetail + * + * @param luserStatus Lista de objetos TgeneCatalogDetail + */ + public void setLuserStatus(List luserStatus) { + this.luserStatus = luserStatus; + } + + /** + * Entrega una lista de objetos TsafeTerminal + * + * @return lterminal Lista de objetos TsafeTerminal + */ + public List getLterminal() { + return this.lterminal; + } + + /** + * Fija una lista de objetos TsafeTerminal + * + * @param lterminal Lista de objetos TsafeTerminal + */ + public void setLterminal(List lterminal) { + this.lterminal = lterminal; + } + + /** + * Entrega una lista de objetos TgeneLanguage + * + * @return lterminal Lista de objetos TgeneLanguage + */ + public List getLlanguage() { + return this.llanguage; + } + + /** + * Fija una lista de objetos TgeneLanguage + * + * @param lterminal Lista de objetos TgeneLanguage + */ + public void setLlanguage(List llanguage) { + this.llanguage = llanguage; + } + + /** + * Entrega una lista de objetos TgeneChannels + * + * @param lchannel Lista de objetos TgeneLanguage + */ + public List getLchannel() { + return this.lchannel; + } + + /** + * Fija una lista de objetos TgeneChannels + * + * @param lchannel Lista de objetos TgeneChannels + */ + public void setLchannel(List lchannel) { + this.lchannel = lchannel; + } + + /** + * Entrega una lista de objetos TgeneBranch + * + * @return lbranch Lista de objetos TgeneLanguage + */ + public List getLbranch() { + return this.lbranch; + } + + /** + * Fija una lista de objetos TgeneBranch + * + * @param lbranch Lista de objetos TgeneLanguage + */ + public void setLbranch(List lbranch) { + this.lbranch = lbranch; + } + + /** + * Entrega una lista de objetos TgeneOffice + * + * @return loffice Lista de objetos TgeneOffice + */ + public List getLoffice() { + return this.loffice; + } + + /** + * Fija una lista de objetos TgeneOffice + * + * @param loffice Lista de objetos TgeneOffice + */ + public void setLoffice(List loffice) { + this.loffice = loffice; + } + + /** + * Entrega una lista de objetos TgeneArea + * + * @return larea Lista de objetos TgeneArea + */ + public List getLarea() { + return this.larea; + } + + /** + * Fija una lista de objetos TgeneArea + * + * @param larea Lista de objetos TgeneArea + */ + public void setLarea(List larea) { + this.larea = larea; + } + + public List getCentroControls() { + return centroControls; + } + + public void setCentroControls(List centroControls) { + this.centroControls = centroControls; + } + + public List getUnidades() { + return unidades; + } + + public void setUnidades(List unidades) { + this.unidades = unidades; + } + + public String getCentroControl() { + return centroControl; + } + + public void setCentroControl(String centroControl) { + this.centroControl = centroControl; + } + + public boolean isDeshabilitarPantalla() { + return deshabilitarPantalla; + } + + public void setDeshabilitarPantalla(boolean deshabilitarPantalla) { + this.deshabilitarPantalla = deshabilitarPantalla; + } + + public String getUnidad() { + return unidad; + } + + public void setUnidad(String unidad) { + this.unidad = unidad; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/security/PasswordController.java b/frontend/src/main/java/com/fp/frontend/controller/security/PasswordController.java new file mode 100644 index 0000000..8fa8cc6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/security/PasswordController.java @@ -0,0 +1,198 @@ +package com.fp.frontend.controller.security; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.pgeneral.gene.ChannelController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneChannels; +import com.fp.persistence.pgeneral.safe.TsafePassword; + +/** + * Clase controladora del lov asociado al bean TsafePassword. + * + * @author WPA. + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class PasswordController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public PasswordController() throws Exception { + super(TsafePassword.class); + } + + /** + * Atributo para la lista de objetos TgeneChannels + */ + private List lchannels; + + private boolean active; + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + this.lchannels = ChannelController.find(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + public void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.record = null; + this.beanalias = "PASSWORD"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void execute() { + this.active = true; + this.querydatabase(); + } + + @Override + public void create() { + try { + super.create(); + this.record.getPk().setCompanycode(super.getLoginController().getRequest().getCompany()); + this.record.getPk().setChannelcode(super.getMfilters().get("pk.channelcode")); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + try { + if (!this.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + Request request = this.callerhelper.getRequest(); + super.addFilter("pk.companycode", super.getLoginController().getRequest().getCompany().toString()); + + DtoQuery dto = super.getDtoQuery(false); + dto.setOrderby("t.pk.channelcode"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.record = new TsafePassword(); + MessageHelper.setMessageError(resp); + } else { + this.record = (TsafePassword) resp.get(this.beanalias); + if (this.record != null) { + super.postQuery((AbstractDataTransport) resp.get(this.beanalias)); + } else { + this.create(); + } + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + if (!this.existAtLeastOneFilterValue()) { + MessageHelper.setMessageError("msg_filterrequird"); + return; + } + if (this.record.getPk().getCompanycode() == null || this.record.getPk().getCompanycode().compareTo(0) == 0) { + MessageHelper.setMessageError("msg_querydata"); + return; + } + Request request = this.callerhelper.getRequest(); + super.update(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + super.postCommitGeneric(response, this.beanalias); + } + + /** + * Entrega una lista de objetos TgeneChannels + * + * @return lchannels Lista de objetos TgeneChannels + */ + public List getLchannels() { + return lchannels; + } + + /** + * Fija una lista de objetos TgeneChannels + * + * @param lchannels Lista de objetos TgeneChannels + */ + public void setLchannels(List lchannels) { + this.lchannels = lchannels; + } + + /** + * Entrega V/F + * + * @return active V/F + */ + public boolean isActive() { + return active; + } + + /** + * Fija V/F + * + * @param active V/F + */ + public void setActive(boolean active) { + this.active = active; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/security/ProfileController.java b/frontend/src/main/java/com/fp/frontend/controller/security/ProfileController.java new file mode 100644 index 0000000..4dd0edf --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/security/ProfileController.java @@ -0,0 +1,133 @@ +package com.fp.frontend.controller.security; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.safe.TsafeProfile; + +/** + * Clase controladora del bean TsafeProfile. + * + * @author WPA + * @version 2.1 + */ +@ManagedBean +@ViewScoped +public class ProfileController extends AbstractController { + + private static final long serialVersionUID = 1L; + + public ProfileController() throws Exception { + super(TsafeProfile.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "TSAFEPROFILE"; + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + + request.setQueryTables(mtables); + + Response resp = this.callerhelper.executeQuery(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void save() { + try { + Request request = this.callerhelper.getRequest(); + DtoSave dtosave = super.getDtoSave(); + if (!dtosave.pendingProcess()) { + return; + } + HashMap msave = new HashMap(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Entrega una lista de objetos TbpmGroups + * + * @param companycode Código de compania + * @return lrecord Lista de objetos TbpmGroups + */ + public static List find() { + try { + ProfileController cc = new ProfileController(); + cc.init(); + cc.recperpage = 300; + cc.querydatabase(); + if ((cc.lrecord != null) && !cc.lrecord.isEmpty()) { + return cc.lrecord; + } + return null; + } catch (Throwable e) { + MessageHelper.setMessageError(e); + return null; + } + + } +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/security/reports/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/security/reports/.svn/entries new file mode 100644 index 0000000..4847e4a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/security/reports/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/security/reports +svn://172.17.26.185/COMACO + + + +2021-05-14T20:37:22.948846Z +4633 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ReportUserController.java +file + + + + +2022-07-28T03:39:54.761596Z +413298f8d4720fc46712d88f73e6af97 +2021-05-14T20:37:22.948846Z +4633 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +5030 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/security/reports/.svn/text-base/ReportUserController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/security/reports/.svn/text-base/ReportUserController.java.svn-base new file mode 100644 index 0000000..ddc8e4f --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/security/reports/.svn/text-base/ReportUserController.java.svn-base @@ -0,0 +1,164 @@ +package com.fp.frontend.controller.security.reports; + +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.controller.security.ProfileController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.safe.TsafeProfile; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de ipresion de usuarios. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReportUserController extends AbstractController { + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + private List lsafeprofile; + + @ManagedProperty(value = "#{logincontroller}") + private LoginController logincontroller; + private TsafeUserDetail tsafeUserDetailUsuario = null; + + public ReportUserController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + //super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + /*this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOGDETAIL";*/ + this.beanalias = "REPORTE"; + this.lsafeprofile = ProfileController.find(); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + } + + /** + * Ejecuta un reporte de usuarios. + */ + public void reportuser() { + //String path = "security/reports/user"; + String path = "security/reports/usuarios"; + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + //String format = "pdf"; + String format = "xls"; + String filename = "usuarios"; + try { + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Ejecuta un reporte de usuarios. + */ + public void reportuserperprofile() { + String path = "security/reports/userperprofile"; + //String path = "security/reports/user"; + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + //parameters.put("cmoneda", "USD"); + //String format = "pdf"; + String format = "xls"; + String filename = "usuariosporperfil"; + try { + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Ejecuta un reporte de usuarios. + */ + public void reporttransactionperprofile() { + String path = "security/reports/transactionsperprofile"; + HashMap parameters = new HashMap<>(); + //parameters.put("cmoneda", "USD"); + String format = "pdf"; + String filename = "transaccionesporperfil"; + try { + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Entrega el valor de: reportController + * @return ReportController + */ + public ReportController getReportController() { + return this.reportController; + } + + /** + * Fija el valor de: reportController + * @param reportController Valor a fijar en el atributo. + */ + + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public List getLsafeprofile() { + return lsafeprofile; + } + + public void setLsafeprofile(List lsafeprofile) { + this.lsafeprofile = lsafeprofile; + } + + public LoginController getLogincontroller() { + return logincontroller; + } + + public void setLogincontroller(LoginController logincontroller) { + this.logincontroller = logincontroller; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/security/reports/ReportUserController.java b/frontend/src/main/java/com/fp/frontend/controller/security/reports/ReportUserController.java new file mode 100644 index 0000000..78741b1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/security/reports/ReportUserController.java @@ -0,0 +1,165 @@ +package com.fp.frontend.controller.security.reports; + +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import com.fp.dto.AbstractDataTransport; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.ReportController; +import com.fp.frontend.controller.security.LoginController; +import com.fp.frontend.controller.security.ProfileController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.safe.TsafeProfile; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Clase controladora de ipresion de usuarios. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ReportUserController extends AbstractController { + + @ManagedProperty(value = "#{reportController}") + private ReportController reportController; + + private List lsafeprofile; + + @ManagedProperty(value = "#{logincontroller}") + private LoginController logincontroller; + private TsafeUserDetail tsafeUserDetailUsuario = null; + + public ReportUserController() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + //super.startQuery(); + + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + try { + /*this.recperpage = 15; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOGDETAIL";*/ + this.beanalias = "REPORTE"; + this.lsafeprofile = ProfileController.find(); + this.tsafeUserDetailUsuario = new TsafeUserDetail(); + this.tsafeUserDetailUsuario = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + } + + /** + * Ejecuta un reporte de usuarios. + */ + public void reportuser() { + //String path = "security/reports/user"; + String path = "security/reports/usuarios"; + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + //String format = "pdf"; + String format = "xls"; + String filename = "usuarios"; + try { + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Ejecuta un reporte de usuarios. + */ + public void reportuserperprofile() { + String path = "security/reports/userperprofile"; + //String path = "security/reports/user"; + HashMap parameters = new HashMap<>(); + parameters.put("pathLogoIzquierda", "repo:/maia/1/image/comandoconjunto"); + parameters.put("pathLogoDerecha", "repo:/maia/1/image/selloarmas"); + //parameters.put("cmoneda", "USD"); + //String format = "pdf"; + String format = "xls"; + String filename = "usuariosporperfil"; + try { + this.reportController.executeXls(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Ejecuta un reporte de usuarios. + */ + public void reporttransactionperprofile() { + String path = "security/reports/transactionsperprofile"; + HashMap parameters = new HashMap<>(); + //parameters.put("cmoneda", "USD"); + String format = "pdf"; + String filename = "transaccionesporperfil"; + try { + this.reportController.execute(path, parameters, format, filename, this.getLoginController()); + } catch (Exception ex) { + MessageHelper.setMessageError(ex); + } + } + + /** + * Entrega el valor de: reportController + * + * @return ReportController + */ + public ReportController getReportController() { + return this.reportController; + } + + /** + * Fija el valor de: reportController + * + * @param reportController Valor a fijar en el atributo. + */ + public void setReportController(ReportController reportController) { + this.reportController = reportController; + } + + public List getLsafeprofile() { + return lsafeprofile; + } + + public void setLsafeprofile(List lsafeprofile) { + this.lsafeprofile = lsafeprofile; + } + + public LoginController getLogincontroller() { + return logincontroller; + } + + public void setLogincontroller(LoginController logincontroller) { + this.logincontroller = logincontroller; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/test/.svn/entries b/frontend/src/main/java/com/fp/frontend/controller/test/.svn/entries new file mode 100644 index 0000000..6abf1cc --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/test/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/controller/test +svn://172.17.26.185/COMACO + + + +2014-10-17T04:21:42.578486Z +1660 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +BpmCatalogController.java +file + + + + +2022-07-28T03:39:46.245559Z +1b8c042bb48a7df41dfd92bb02730a26 +2014-10-17T04:21:42.578486Z +1660 +jvaca + + + + + + + + + + + + + + + + + + + + + +4056 + diff --git a/frontend/src/main/java/com/fp/frontend/controller/test/.svn/text-base/BpmCatalogController.java.svn-base b/frontend/src/main/java/com/fp/frontend/controller/test/.svn/text-base/BpmCatalogController.java.svn-base new file mode 100644 index 0000000..4c5a0ff --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/test/.svn/text-base/BpmCatalogController.java.svn-base @@ -0,0 +1,126 @@ +package com.fp.frontend.controller.test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; + +/** + * Clase controladora del bean TgeneCatalog. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class BpmCatalogController extends AbstractController { + + /** + * Constructor + * @throws Exception + */ + public BpmCatalogController() throws Exception { + super(TgeneCatalog.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOG"; + super.create(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save(){ + //la pagina no tiene save + } + + + /** + * Método para el inicio de flujo + */ + public void completarTarea() { + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", + bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment); + request.modifiedData().put("validate", "Y"); + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/controller/test/BpmCatalogController.java b/frontend/src/main/java/com/fp/frontend/controller/test/BpmCatalogController.java new file mode 100644 index 0000000..008be46 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/controller/test/BpmCatalogController.java @@ -0,0 +1,126 @@ +package com.fp.frontend.controller.test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import org.primefaces.context.RequestContext; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.query.DtoQuery; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.pgeneral.gene.TgeneCatalog; + +/** + * Clase controladora del bean TgeneCatalog. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class BpmCatalogController extends AbstractController { + + /** + * Constructor + * + * @throws Exception + */ + public BpmCatalogController() throws Exception { + super(TgeneCatalog.class); + } + + /** + * Metodo invocado despues de instanciar el controlador + */ + @PostConstruct + private void postconstruct() { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } + + /** + * Incializa variables del controlador, cuando se esta utilizando una pagina + * que utliza el controlador. + */ + private void init() { + try { + this.recperpage = 10; // Cambiar al # reg a mirar. + this.lrecord = new ArrayList<>(); + this.beanalias = "CATALOG"; + super.create(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#querydatabase() + */ + @SuppressWarnings("unchecked") + @Override + protected void querydatabase() { + try { + Request request = this.callerhelper.getRequest(); + DtoQuery dto = super.getDtoQuery(true); + dto.setOrderby("t.pk"); // En en string van todos los campos de orden ("t.pk, t.nombre, t.cpais"). + + HashMap mtables = new HashMap(); + mtables.put(this.beanalias, dto); // permite adicionar mas de una tabla. + request.setQueryTables(mtables); + Response resp = this.callerhelper.executeQuery(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) != 0) { + this.lrecord = new ArrayList(); + MessageHelper.setMessageError(resp); + } else { + this.lrecord = (List) resp.get(this.beanalias); + super.postQuery(this.lrecord); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /* (non-Javadoc) + * @see com.fp.frontend.controller.AbstractController#save() + */ + @Override + public void save() { + //la pagina no tiene save + } + + /** + * Método para el inicio de flujo + */ + public void completarTarea() { + try { + Request request = callerhelper.getRequest(); + // limpiar request para finalizar la tarea. + super.cleanRequest(request); + request.modifiedData().put("TID", tid); + request.modifiedData().put("BPMStatus", + bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R + request.modifiedData().put("BPMObs", bpmDataComment); + request.modifiedData().put("validate", "Y"); + Response resp = callerhelper.executeSave(request); + + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/converters/.svn/entries b/frontend/src/main/java/com/fp/frontend/converters/.svn/entries new file mode 100644 index 0000000..83d696e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/converters/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/converters +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +DateConverter.java +file + + + + +2022-07-28T03:39:59.327615Z +a91133e3434f828161b33b046e91494f +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1018 + diff --git a/frontend/src/main/java/com/fp/frontend/converters/.svn/text-base/DateConverter.java.svn-base b/frontend/src/main/java/com/fp/frontend/converters/.svn/text-base/DateConverter.java.svn-base new file mode 100644 index 0000000..a537c41 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/converters/.svn/text-base/DateConverter.java.svn-base @@ -0,0 +1,36 @@ +package com.fp.frontend.converters; + +import java.text.SimpleDateFormat; + +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.convert.Converter; +import javax.faces.convert.FacesConverter; + +/** + * Clase que se encarga de convertir un String a java.sql.Date y viceversa. + * @author Jorge Vaca. + * @version 2.1 + */ +@FacesConverter("converter.date") +public class DateConverter implements Converter{ + private static SimpleDateFormat FORMATOFECHA = new SimpleDateFormat("dd-MM-yyyy"); + + @Override + public Object getAsObject(FacesContext context, UIComponent component, String value) { + java.sql.Date sqlDate = null; + try { + java.util.Date dt = FORMATOFECHA.parse(value); + sqlDate = new java.sql.Date(dt.getTime()); + } catch (Exception e) { + e.printStackTrace(); + } + return sqlDate; + } + + @Override + public String getAsString(FacesContext context, UIComponent component, Object value) { + return FORMATOFECHA.format(value); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/converters/DateConverter.java b/frontend/src/main/java/com/fp/frontend/converters/DateConverter.java new file mode 100644 index 0000000..f22c9fb --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/converters/DateConverter.java @@ -0,0 +1,38 @@ +package com.fp.frontend.converters; + +import java.text.SimpleDateFormat; + +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.convert.Converter; +import javax.faces.convert.FacesConverter; + +/** + * Clase que se encarga de convertir un String a java.sql.Date y viceversa. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@FacesConverter("converter.date") +public class DateConverter implements Converter { + + private static SimpleDateFormat FORMATOFECHA = new SimpleDateFormat("dd-MM-yyyy"); + + @Override + public Object getAsObject(FacesContext context, UIComponent component, String value) { + java.sql.Date sqlDate = null; + try { + java.util.Date dt = FORMATOFECHA.parse(value); + sqlDate = new java.sql.Date(dt.getTime()); + } catch (Exception e) { + e.printStackTrace(); + } + return sqlDate; + } + + @Override + public String getAsString(FacesContext context, UIComponent component, Object value) { + return FORMATOFECHA.format(value); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/enums/.svn/entries b/frontend/src/main/java/com/fp/frontend/enums/.svn/entries new file mode 100644 index 0000000..c7741c9 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/enums/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/enums +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +EnumLovOption.java +file + + + + +2022-07-28T03:39:57.856609Z +c987febf6737767a6aca2fc3101ac5f7 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1148 + diff --git a/frontend/src/main/java/com/fp/frontend/enums/.svn/text-base/EnumLovOption.java.svn-base b/frontend/src/main/java/com/fp/frontend/enums/.svn/text-base/EnumLovOption.java.svn-base new file mode 100644 index 0000000..3b36e2f --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/enums/.svn/text-base/EnumLovOption.java.svn-base @@ -0,0 +1,56 @@ +package com.fp.frontend.enums; + +/** + * Numeracion usada para las opciones del modal. + * + * @author amerchan + */ +public enum EnumLovOption { + + MODAL("modal"), DRAGGABLE("draggable"), RESIZABLE("resizable"), WIDTH("width"), + HEIGHT("height"), CONTENT_WIDTH("contentWidth"), CONTENT_HEIGHT("contentHeight"); + + /** Etiqueta que describe el enumerado. */ + private String label; + + /** + * Instancia un nuevo enumerado afirmacion. + * + * @param label Etiqueta + */ + private EnumLovOption(String label) { + this.label = label; + } + + /** + * Gets the label. + * + * @return the label + */ + public String getLabel() { + return this.label; + } + + /** + * Instancia un objeto de tipo EnumLovOption. + * + * @param Codigo de la enumeracion + * @return Objeto tipo EnumAfirmacion + */ + public static EnumLovOption getEnumLovOption(String code) { + for (EnumLovOption sts : EnumLovOption.values()) { + if (sts.name().compareTo(code) == 0) { + return sts; + } + } + return null; + } + + /* (non-Javadoc) + * @see java.lang.Enum#toString() + */ + @Override + public String toString() { + return this.label; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/enums/EnumLovOption.java b/frontend/src/main/java/com/fp/frontend/enums/EnumLovOption.java new file mode 100644 index 0000000..d48bfd8 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/enums/EnumLovOption.java @@ -0,0 +1,58 @@ +package com.fp.frontend.enums; + +/** + * Numeracion usada para las opciones del modal. + * + * @author amerchan + */ +public enum EnumLovOption { + + MODAL("modal"), DRAGGABLE("draggable"), RESIZABLE("resizable"), WIDTH("width"), + HEIGHT("height"), CONTENT_WIDTH("contentWidth"), CONTENT_HEIGHT("contentHeight"); + + /** + * Etiqueta que describe el enumerado. + */ + private String label; + + /** + * Instancia un nuevo enumerado afirmacion. + * + * @param label Etiqueta + */ + private EnumLovOption(String label) { + this.label = label; + } + + /** + * Gets the label. + * + * @return the label + */ + public String getLabel() { + return this.label; + } + + /** + * Instancia un objeto de tipo EnumLovOption. + * + * @param Codigo de la enumeracion + * @return Objeto tipo EnumAfirmacion + */ + public static EnumLovOption getEnumLovOption(String code) { + for (EnumLovOption sts : EnumLovOption.values()) { + if (sts.name().compareTo(code) == 0) { + return sts; + } + } + return null; + } + + /* (non-Javadoc) + * @see java.lang.Enum#toString() + */ + @Override + public String toString() { + return this.label; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/filter/.svn/entries b/frontend/src/main/java/com/fp/frontend/filter/.svn/entries new file mode 100644 index 0000000..2e5b636 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/filter/.svn/entries @@ -0,0 +1,201 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/filter +svn://172.17.26.185/COMACO + + + +2021-11-16T16:51:39.601018Z +4651 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +GZIPFilter.java +file + + + + +2022-07-28T03:39:57.018605Z +a5a2925a19392a56edb7b902e65250eb +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2188 + +GZIPResponseStream.java +file + + + + +2022-07-28T03:39:57.019605Z +ef20b6e0fd91e63fde658ef62040f692 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2677 + +security +dir + +TimeoutManagerFilter.java +file + + + + +2022-07-28T03:39:57.019605Z +77bea39946d4313968d2f4091d6f95fb +2014-12-22T12:08:44.230989Z +3627 +dcruz +has-props + + + + + + + + + + + + + + + + + + + + +3941 + +GZIPResponseWrapper.java +file + + + + +2022-07-28T03:39:57.019605Z +2387e64d57b6d22690b715b85f4dc998 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +2364 + +ControlAcceso.java +file + + + + +2022-07-28T03:39:57.019605Z +a58dd311d15fe4d1f4c1206061850445 +2021-11-16T16:51:39.601018Z +4651 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +2299 + diff --git a/frontend/src/main/java/com/fp/frontend/filter/.svn/prop-base/TimeoutManagerFilter.java.svn-base b/frontend/src/main/java/com/fp/frontend/filter/.svn/prop-base/TimeoutManagerFilter.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/filter/.svn/prop-base/TimeoutManagerFilter.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/filter/.svn/text-base/ControlAcceso.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/filter/.svn/text-base/ControlAcceso.java.netbeans-base new file mode 100644 index 0000000..22c0aa4 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/filter/.svn/text-base/ControlAcceso.java.netbeans-base @@ -0,0 +1,71 @@ +package com.fp.frontend.filter; + +import java.io.IOException; + +import javax.faces.context.FacesContext; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.annotation.WebFilter; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Servlet Filter implementation class ControlAcceso + */ +@WebFilter(filterName="ControlAcceso",urlPatterns = {"/pages/*"} ) +public class ControlAcceso implements Filter { + + /** + * Default constructor. + */ + public ControlAcceso() { + // TODO Auto-generated constructor stub + } + + /** + * @see Filter#destroy() + */ + public void destroy() { + // TODO Auto-generated method stub + } + + /** + * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain) + */ + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { + // TODO Auto-generated method stub + // place your code here + System.out.println("Ingresa Control Acceso permitido Filtro : "); + FacesContext facesContext = FacesContext.getCurrentInstance(); + HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(false); + TsafeUserDetail currentUser = session!=null ? (TsafeUserDetail) session.getAttribute("TSAFEUSERDETAIL"):null; + // pass the request along the filter chain + if (currentUser!=null && currentUser.getChangepassword().equalsIgnoreCase("N")) { + System.out.println("Control Acceso permitido : "); + //facesContext.getExternalContext().dispatch("/pages/workspace.xhtml"); + chain.doFilter(request, response); + + } else { + System.out.println(" Acceso no autorizado "); + facesContext.getExternalContext().dispatch("/login.xhtml"); + } + + + + } + + /** + * @see Filter#init(FilterConfig) + */ + public void init(FilterConfig fConfig) throws ServletException { + // TODO Auto-generated method stub + } + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/filter/.svn/text-base/ControlAcceso.java.svn-base b/frontend/src/main/java/com/fp/frontend/filter/.svn/text-base/ControlAcceso.java.svn-base new file mode 100644 index 0000000..22c0aa4 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/filter/.svn/text-base/ControlAcceso.java.svn-base @@ -0,0 +1,71 @@ +package com.fp.frontend.filter; + +import java.io.IOException; + +import javax.faces.context.FacesContext; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.annotation.WebFilter; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Servlet Filter implementation class ControlAcceso + */ +@WebFilter(filterName="ControlAcceso",urlPatterns = {"/pages/*"} ) +public class ControlAcceso implements Filter { + + /** + * Default constructor. + */ + public ControlAcceso() { + // TODO Auto-generated constructor stub + } + + /** + * @see Filter#destroy() + */ + public void destroy() { + // TODO Auto-generated method stub + } + + /** + * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain) + */ + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { + // TODO Auto-generated method stub + // place your code here + System.out.println("Ingresa Control Acceso permitido Filtro : "); + FacesContext facesContext = FacesContext.getCurrentInstance(); + HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(false); + TsafeUserDetail currentUser = session!=null ? (TsafeUserDetail) session.getAttribute("TSAFEUSERDETAIL"):null; + // pass the request along the filter chain + if (currentUser!=null && currentUser.getChangepassword().equalsIgnoreCase("N")) { + System.out.println("Control Acceso permitido : "); + //facesContext.getExternalContext().dispatch("/pages/workspace.xhtml"); + chain.doFilter(request, response); + + } else { + System.out.println(" Acceso no autorizado "); + facesContext.getExternalContext().dispatch("/login.xhtml"); + } + + + + } + + /** + * @see Filter#init(FilterConfig) + */ + public void init(FilterConfig fConfig) throws ServletException { + // TODO Auto-generated method stub + } + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/filter/.svn/text-base/GZIPFilter.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/filter/.svn/text-base/GZIPFilter.java.netbeans-base new file mode 100644 index 0000000..68beda5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/filter/.svn/text-base/GZIPFilter.java.netbeans-base @@ -0,0 +1,68 @@ +package com.fp.frontend.filter; + +import java.io.IOException; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * Clase que se encarga de comprimir el contenido + * + * @author Jorge Vaca + * @version 2.1 + */ +public class GZIPFilter implements Filter { + + /** + * Metodo que sobrescribe el metodo init de la clase Filter Este metodo no debe hacer nada + * + * @param filterConfig + * @throws ServletException + */ + @Override + public void init(FilterConfig filterConfig) throws ServletException { + } + + /** + * Metodo que se encarga de filtrar los contenidos + * + * @param request + * @param response + * @param chain + * @throws IOException + * @throws ServletException + */ + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { + if (request instanceof HttpServletRequest) { + HttpServletRequest httpServletRequest = (HttpServletRequest) request; + HttpServletResponse httpServletResponse = (HttpServletResponse) response; + try { + String aceptEncoding = httpServletRequest.getHeader("accept-encoding"); + if ((aceptEncoding != null) && (aceptEncoding.indexOf("gzip") != -1)) { + GZIPResponseWrapper wrappedResponse = new GZIPResponseWrapper(httpServletResponse); + chain.doFilter(request, wrappedResponse); + wrappedResponse.finishResponse(); + return; + } + } catch (Exception e) { + return; + } + + chain.doFilter(request, response); + } + } + + /** + * Metodo que sobrescribe el metodo destroy de la clase Filter Este metodo no debe hacer nada + */ + @Override + public void destroy() { + } +} diff --git a/frontend/src/main/java/com/fp/frontend/filter/.svn/text-base/GZIPFilter.java.svn-base b/frontend/src/main/java/com/fp/frontend/filter/.svn/text-base/GZIPFilter.java.svn-base new file mode 100644 index 0000000..68beda5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/filter/.svn/text-base/GZIPFilter.java.svn-base @@ -0,0 +1,68 @@ +package com.fp.frontend.filter; + +import java.io.IOException; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * Clase que se encarga de comprimir el contenido + * + * @author Jorge Vaca + * @version 2.1 + */ +public class GZIPFilter implements Filter { + + /** + * Metodo que sobrescribe el metodo init de la clase Filter Este metodo no debe hacer nada + * + * @param filterConfig + * @throws ServletException + */ + @Override + public void init(FilterConfig filterConfig) throws ServletException { + } + + /** + * Metodo que se encarga de filtrar los contenidos + * + * @param request + * @param response + * @param chain + * @throws IOException + * @throws ServletException + */ + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { + if (request instanceof HttpServletRequest) { + HttpServletRequest httpServletRequest = (HttpServletRequest) request; + HttpServletResponse httpServletResponse = (HttpServletResponse) response; + try { + String aceptEncoding = httpServletRequest.getHeader("accept-encoding"); + if ((aceptEncoding != null) && (aceptEncoding.indexOf("gzip") != -1)) { + GZIPResponseWrapper wrappedResponse = new GZIPResponseWrapper(httpServletResponse); + chain.doFilter(request, wrappedResponse); + wrappedResponse.finishResponse(); + return; + } + } catch (Exception e) { + return; + } + + chain.doFilter(request, response); + } + } + + /** + * Metodo que sobrescribe el metodo destroy de la clase Filter Este metodo no debe hacer nada + */ + @Override + public void destroy() { + } +} diff --git a/frontend/src/main/java/com/fp/frontend/filter/.svn/text-base/GZIPResponseStream.java.svn-base b/frontend/src/main/java/com/fp/frontend/filter/.svn/text-base/GZIPResponseStream.java.svn-base new file mode 100644 index 0000000..fb80ce6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/filter/.svn/text-base/GZIPResponseStream.java.svn-base @@ -0,0 +1,108 @@ +package com.fp.frontend.filter; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.zip.GZIPOutputStream; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; + +/** + * Clase que devuelve filtrado el contenido + * + * @author Jorge Vaca + * @version 2.1 + */ +public class GZIPResponseStream extends ServletOutputStream { + + protected ByteArrayOutputStream baos = null; + + protected GZIPOutputStream gzipstream = null; + + protected boolean closed = false; + + protected HttpServletResponse response = null; + + protected ServletOutputStream output = null; + + public GZIPResponseStream(HttpServletResponse response) throws IOException { + super(); + closed = false; + this.response = response; + this.output = response.getOutputStream(); + baos = new ByteArrayOutputStream(); + gzipstream = new GZIPOutputStream(baos); + } + + /** + * + * @throws IOException + */ + @Override + public void close() throws IOException { + if (closed) { + throw new IOException("This output stream has already been closed"); + } + gzipstream.finish(); + byte[] bytes = baos.toByteArray(); + response.addHeader("Content-Length", Integer.toString(bytes.length)); + response.addHeader("Content-Encoding", "gzip"); + output.write(bytes); + output.flush(); + output.close(); + closed = true; + } + + /** + * + * @throws IOException + */ + @Override + public void flush() throws IOException { + if (closed) { + throw new IOException("Cannot flush a closed output stream"); + } + gzipstream.flush(); + } + + @Override + public void write(int b) throws IOException { + if (closed) { + throw new IOException("Cannot write to a closed output stream"); + } + gzipstream.write((byte) b); + } + + /** + * + * @param b + * @throws IOException + */ + @Override + public void write(byte b[]) throws IOException { + write(b, 0, b.length); + } + + /** + * + * @param b + * @param off + * @param len + * @throws IOException + */ + @Override + public void write(byte b[], int off, int len) throws IOException { + if (closed) { + throw new IOException("Cannot write to a closed output stream"); + } + gzipstream.write(b, off, len); + } + + public boolean closed() { + return (this.closed); + } + + public void reset() { + // noop + } +} diff --git a/frontend/src/main/java/com/fp/frontend/filter/.svn/text-base/GZIPResponseWrapper.java.svn-base b/frontend/src/main/java/com/fp/frontend/filter/.svn/text-base/GZIPResponseWrapper.java.svn-base new file mode 100644 index 0000000..7e53692 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/filter/.svn/text-base/GZIPResponseWrapper.java.svn-base @@ -0,0 +1,97 @@ +package com.fp.frontend.filter; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpServletResponseWrapper; + +/** + * Clase para envolver los filtros gzip + * + * @author Jorge Vaca + * @version 2.1 + */ +public class GZIPResponseWrapper extends HttpServletResponseWrapper { + + protected HttpServletResponse origResponse = null; + + protected ServletOutputStream stream = null; + + protected PrintWriter writer = null; + + public GZIPResponseWrapper(HttpServletResponse response) { + super(response); + origResponse = response; + } + + public ServletOutputStream createOutputStream() throws IOException { + return (new GZIPResponseStream(origResponse)); + } + + public void finishResponse() { + try { + if (writer != null) { + writer.close(); + } else { + if (stream != null) { + stream.close(); + } + } + } catch (IOException e) { + } + } + + /** + * + * @throws IOException + */ + @Override + public void flushBuffer() throws IOException { + stream.flush(); + } + + /** + * + * @return + * @throws IOException + */ + @Override + public ServletOutputStream getOutputStream() throws IOException { + if (writer != null) { + throw new IllegalStateException("getWriter() has already been called!"); + } + if (stream == null) { + stream = createOutputStream(); + } + return (stream); + } + + /** + * + * @return + * @throws IOException + */ + @Override + public PrintWriter getWriter() throws IOException { + if (writer != null) { + return (writer); + } + if (stream != null) { + throw new IllegalStateException("getOutputStream() has already been called!"); + } + stream = createOutputStream(); + writer = new PrintWriter(new OutputStreamWriter(stream, "UTF-8")); + return (writer); + } + + /** + * + * @param length + */ + @Override + public void setContentLength(int length) { + } +} diff --git a/frontend/src/main/java/com/fp/frontend/filter/.svn/text-base/TimeoutManagerFilter.java.svn-base b/frontend/src/main/java/com/fp/frontend/filter/.svn/text-base/TimeoutManagerFilter.java.svn-base new file mode 100644 index 0000000..e106f88 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/filter/.svn/text-base/TimeoutManagerFilter.java.svn-base @@ -0,0 +1,96 @@ +package com.fp.frontend.filter; + +import java.io.IOException; + +import javax.faces.FactoryFinder; +import javax.faces.component.UIViewRoot; +import javax.faces.context.FacesContext; +import javax.faces.context.FacesContextFactory; +import javax.faces.lifecycle.Lifecycle; +import javax.faces.lifecycle.LifecycleFactory; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +public class TimeoutManagerFilter implements Filter { + + + private String contextPath; + + @Override + public void doFilter(ServletRequest paramServletRequest, ServletResponse paramServletResponse, FilterChain paramFilterChain) throws IOException, ServletException { + HttpServletRequest request = (HttpServletRequest) paramServletRequest; + HttpServletResponse response = (HttpServletResponse) paramServletResponse; + String path = request.getServletPath(); + + + if ((path.contains("/javax.faces.resource/")) || ((!path.endsWith(".jsf")) && (!path.endsWith(".xhtml")))) + { + paramFilterChain.doFilter(paramServletRequest, paramServletResponse); + return; + } + if(this.contextPath==null) { + this.contextPath = request.getContextPath(); + } + + try { + FacesContext facesContext = FacesContext.getCurrentInstance(); + if (facesContext == null) + { + FacesContextFactory contextFactory = (FacesContextFactory) FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY); + LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY); + Lifecycle lifecycle = lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE); + + ServletContext servletContext = request.getSession().getServletContext(); + facesContext = contextFactory.getFacesContext(servletContext, paramServletRequest, paramServletResponse, lifecycle); + InnerFacesContext.setFacesContextAsCurrentInstance(facesContext); + if (null == facesContext.getViewRoot()) + { + facesContext.setViewRoot(new UIViewRoot()); + } + } + HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(false); + + TsafeUserDetail currentUser = session!=null ? (TsafeUserDetail) session.getAttribute("TSAFEUSERDETAIL"):null; + boolean isIndexPage = path.endsWith("index.xhtml") || path.endsWith(this.contextPath+"/"); + boolean isLoginPage = path.endsWith("login.xhtml"); + + if (!isLoginPage && !isIndexPage && (currentUser == null)) { + response.sendRedirect(this.contextPath+"/login.xhtml"); + }else if(isLoginPage && (currentUser!=null)){ + response.sendRedirect(this.contextPath+"/pages/workspace.xhtml"); + } + + } catch (Throwable e) { + e.printStackTrace(); + return; + } + paramFilterChain.doFilter(paramServletRequest, paramServletResponse); + } + + private abstract static class InnerFacesContext extends FacesContext + { + protected static void setFacesContextAsCurrentInstance(final FacesContext facesContext) + { + FacesContext.setCurrentInstance(facesContext); + } + } + + @Override + public void destroy() { + } + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + } + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/filter/ControlAcceso.java b/frontend/src/main/java/com/fp/frontend/filter/ControlAcceso.java new file mode 100644 index 0000000..b76d57a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/filter/ControlAcceso.java @@ -0,0 +1,64 @@ +package com.fp.frontend.filter; + +import java.io.IOException; + +import javax.faces.context.FacesContext; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.annotation.WebFilter; +import javax.servlet.http.HttpSession; + +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +/** + * Servlet Filter implementation class ControlAcceso + */ +@WebFilter(filterName = "ControlAcceso", urlPatterns = {"/pages/*"}) +public class ControlAcceso implements Filter { + + /** + * Default constructor. + */ + public ControlAcceso() { + // TODO Auto-generated constructor stub + } + + /** + * @see Filter#destroy() + */ + public void destroy() { + // TODO Auto-generated method stub + } + + /** + * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain) + */ + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { + // TODO Auto-generated method stub + // place your code here + FacesContext facesContext = FacesContext.getCurrentInstance(); + HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(false); + TsafeUserDetail currentUser = session != null ? (TsafeUserDetail) session.getAttribute("TSAFEUSERDETAIL") : null; + // pass the request along the filter chain + if (currentUser != null && currentUser.getChangepassword().equalsIgnoreCase("N")) { + //facesContext.getExternalContext().dispatch("/pages/workspace.xhtml"); + chain.doFilter(request, response); + + } else { + facesContext.getExternalContext().dispatch("/login.xhtml"); + } + + } + + /** + * @see Filter#init(FilterConfig) + */ + public void init(FilterConfig fConfig) throws ServletException { + // TODO Auto-generated method stub + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/filter/GZIPFilter.java b/frontend/src/main/java/com/fp/frontend/filter/GZIPFilter.java new file mode 100644 index 0000000..e27104e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/filter/GZIPFilter.java @@ -0,0 +1,70 @@ +package com.fp.frontend.filter; + +import java.io.IOException; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * Clase que se encarga de comprimir el contenido + * + * @author Jorge Vaca + * @version 2.1 + */ +public class GZIPFilter implements Filter { + + /** + * Metodo que sobrescribe el metodo init de la clase Filter Este metodo no + * debe hacer nada + * + * @param filterConfig + * @throws ServletException + */ + @Override + public void init(FilterConfig filterConfig) throws ServletException { + } + + /** + * Metodo que se encarga de filtrar los contenidos + * + * @param request + * @param response + * @param chain + * @throws IOException + * @throws ServletException + */ + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { + if (request instanceof HttpServletRequest) { + HttpServletRequest httpServletRequest = (HttpServletRequest) request; + HttpServletResponse httpServletResponse = (HttpServletResponse) response; + try { + String aceptEncoding = httpServletRequest.getHeader("accept-encoding"); + if ((aceptEncoding != null) && (aceptEncoding.indexOf("gzip") != -1)) { + GZIPResponseWrapper wrappedResponse = new GZIPResponseWrapper(httpServletResponse); + chain.doFilter(request, wrappedResponse); + wrappedResponse.finishResponse(); + return; + } + } catch (Exception e) { + return; + } + + chain.doFilter(request, response); + } + } + + /** + * Metodo que sobrescribe el metodo destroy de la clase Filter Este metodo + * no debe hacer nada + */ + @Override + public void destroy() { + } +} diff --git a/frontend/src/main/java/com/fp/frontend/filter/GZIPResponseStream.java b/frontend/src/main/java/com/fp/frontend/filter/GZIPResponseStream.java new file mode 100644 index 0000000..36a9353 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/filter/GZIPResponseStream.java @@ -0,0 +1,108 @@ +package com.fp.frontend.filter; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.zip.GZIPOutputStream; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; + +/** + * Clase que devuelve filtrado el contenido + * + * @author Jorge Vaca + * @version 2.1 + */ +public class GZIPResponseStream extends ServletOutputStream { + + protected ByteArrayOutputStream baos = null; + + protected GZIPOutputStream gzipstream = null; + + protected boolean closed = false; + + protected HttpServletResponse response = null; + + protected ServletOutputStream output = null; + + public GZIPResponseStream(HttpServletResponse response) throws IOException { + super(); + closed = false; + this.response = response; + this.output = response.getOutputStream(); + baos = new ByteArrayOutputStream(); + gzipstream = new GZIPOutputStream(baos); + } + + /** + * + * @throws IOException + */ + @Override + public void close() throws IOException { + if (closed) { + throw new IOException("This output stream has already been closed"); + } + gzipstream.finish(); + byte[] bytes = baos.toByteArray(); + response.addHeader("Content-Length", Integer.toString(bytes.length)); + response.addHeader("Content-Encoding", "gzip"); + output.write(bytes); + output.flush(); + output.close(); + closed = true; + } + + /** + * + * @throws IOException + */ + @Override + public void flush() throws IOException { + if (closed) { + throw new IOException("Cannot flush a closed output stream"); + } + gzipstream.flush(); + } + + @Override + public void write(int b) throws IOException { + if (closed) { + throw new IOException("Cannot write to a closed output stream"); + } + gzipstream.write((byte) b); + } + + /** + * + * @param b + * @throws IOException + */ + @Override + public void write(byte b[]) throws IOException { + write(b, 0, b.length); + } + + /** + * + * @param b + * @param off + * @param len + * @throws IOException + */ + @Override + public void write(byte b[], int off, int len) throws IOException { + if (closed) { + throw new IOException("Cannot write to a closed output stream"); + } + gzipstream.write(b, off, len); + } + + public boolean closed() { + return (this.closed); + } + + public void reset() { + // noop + } +} diff --git a/frontend/src/main/java/com/fp/frontend/filter/GZIPResponseWrapper.java b/frontend/src/main/java/com/fp/frontend/filter/GZIPResponseWrapper.java new file mode 100644 index 0000000..1e8924d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/filter/GZIPResponseWrapper.java @@ -0,0 +1,93 @@ +package com.fp.frontend.filter; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpServletResponseWrapper; + +/** + * Clase para envolver los filtros gzip + * + * @author Jorge Vaca + * @version 2.1 + */ +public class GZIPResponseWrapper extends HttpServletResponseWrapper { + + protected HttpServletResponse origResponse = null; + + protected ServletOutputStream stream = null; + + protected PrintWriter writer = null; + + public GZIPResponseWrapper(HttpServletResponse response) { + super(response); + origResponse = response; + } + + public ServletOutputStream createOutputStream() throws IOException { + return (new GZIPResponseStream(origResponse)); + } + + public void finishResponse() { + try { + if (writer != null) { + writer.close(); + } else if (stream != null) { + stream.close(); + } + } catch (IOException e) { + } + } + + /** + * + * @throws IOException + */ + @Override + public void flushBuffer() throws IOException { + stream.flush(); + } + + /** + * + * @return @throws IOException + */ + @Override + public ServletOutputStream getOutputStream() throws IOException { + if (writer != null) { + throw new IllegalStateException("getWriter() has already been called!"); + } + if (stream == null) { + stream = createOutputStream(); + } + return (stream); + } + + /** + * + * @return @throws IOException + */ + @Override + public PrintWriter getWriter() throws IOException { + if (writer != null) { + return (writer); + } + if (stream != null) { + throw new IllegalStateException("getOutputStream() has already been called!"); + } + stream = createOutputStream(); + writer = new PrintWriter(new OutputStreamWriter(stream, "UTF-8")); + return (writer); + } + + /** + * + * @param length + */ + @Override + public void setContentLength(int length) { + } +} diff --git a/frontend/src/main/java/com/fp/frontend/filter/TimeoutManagerFilter.java b/frontend/src/main/java/com/fp/frontend/filter/TimeoutManagerFilter.java new file mode 100644 index 0000000..52633bb --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/filter/TimeoutManagerFilter.java @@ -0,0 +1,90 @@ +package com.fp.frontend.filter; + +import java.io.IOException; + +import javax.faces.FactoryFinder; +import javax.faces.component.UIViewRoot; +import javax.faces.context.FacesContext; +import javax.faces.context.FacesContextFactory; +import javax.faces.lifecycle.Lifecycle; +import javax.faces.lifecycle.LifecycleFactory; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +public class TimeoutManagerFilter implements Filter { + + private String contextPath; + + @Override + public void doFilter(ServletRequest paramServletRequest, ServletResponse paramServletResponse, FilterChain paramFilterChain) throws IOException, ServletException { + HttpServletRequest request = (HttpServletRequest) paramServletRequest; + HttpServletResponse response = (HttpServletResponse) paramServletResponse; + String path = request.getServletPath(); + + if ((path.contains("/javax.faces.resource/")) || ((!path.endsWith(".jsf")) && (!path.endsWith(".xhtml")))) { + paramFilterChain.doFilter(paramServletRequest, paramServletResponse); + return; + } + if (this.contextPath == null) { + this.contextPath = request.getContextPath(); + } + + try { + FacesContext facesContext = FacesContext.getCurrentInstance(); + if (facesContext == null) { + FacesContextFactory contextFactory = (FacesContextFactory) FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY); + LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY); + Lifecycle lifecycle = lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE); + + ServletContext servletContext = request.getSession().getServletContext(); + facesContext = contextFactory.getFacesContext(servletContext, paramServletRequest, paramServletResponse, lifecycle); + InnerFacesContext.setFacesContextAsCurrentInstance(facesContext); + if (null == facesContext.getViewRoot()) { + facesContext.setViewRoot(new UIViewRoot()); + } + } + HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(false); + + TsafeUserDetail currentUser = session != null ? (TsafeUserDetail) session.getAttribute("TSAFEUSERDETAIL") : null; + boolean isIndexPage = path.endsWith("index.xhtml") || path.endsWith(this.contextPath + "/"); + boolean isLoginPage = path.endsWith("login.xhtml"); + + if (!isLoginPage && !isIndexPage && (currentUser == null)) { + response.sendRedirect(this.contextPath + "/login.xhtml"); + } else if (isLoginPage && (currentUser != null)) { + response.sendRedirect(this.contextPath + "/pages/workspace.xhtml"); + } + + } catch (Throwable e) { + e.printStackTrace(); + return; + } + paramFilterChain.doFilter(paramServletRequest, paramServletResponse); + } + + private abstract static class InnerFacesContext extends FacesContext { + + protected static void setFacesContextAsCurrentInstance(final FacesContext facesContext) { + FacesContext.setCurrentInstance(facesContext); + } + } + + @Override + public void destroy() { + } + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/filter/security/.svn/entries b/frontend/src/main/java/com/fp/frontend/filter/security/.svn/entries new file mode 100644 index 0000000..f204f8e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/filter/security/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/filter/security +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +AuthorizationListener.java +file + + + + +2022-07-28T03:39:56.447603Z +474b4909d8f4f4d66c4275f92338521d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1787 + diff --git a/frontend/src/main/java/com/fp/frontend/filter/security/.svn/text-base/AuthorizationListener.java.svn-base b/frontend/src/main/java/com/fp/frontend/filter/security/.svn/text-base/AuthorizationListener.java.svn-base new file mode 100644 index 0000000..6e61d7a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/filter/security/.svn/text-base/AuthorizationListener.java.svn-base @@ -0,0 +1,59 @@ +package com.fp.frontend.filter.security; + +import javax.faces.application.NavigationHandler; +import javax.faces.context.FacesContext; +import javax.faces.event.PhaseEvent; +import javax.faces.event.PhaseId; +import javax.faces.event.PhaseListener; +import javax.servlet.http.HttpSession; + +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +public class AuthorizationListener implements PhaseListener { + + /** + * + */ + private static final long serialVersionUID = 1L; + + @Override + public void afterPhase(PhaseEvent event) { + FacesContext facesContext = event.getFacesContext(); + String currentPage = facesContext.getViewRoot().getViewId(); + + boolean isLoginPage = (currentPage.lastIndexOf("login.xhtml") > -1); + HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(false); + + NavigationHandler nh = facesContext.getApplication().getNavigationHandler(); + //NavigationHandler nh = FacesContext.getCurrentInstance().getApplication().getNavigationHandler(); + + TsafeUserDetail currentUser = session!=null ? (TsafeUserDetail) session.getAttribute("TSAFEUSERDETAIL"):null; + + if (!isLoginPage && (currentUser == null)) { + //nh.handleNavigation(facesContext, null, "login"); + try { + facesContext.getExternalContext().dispatch("/login.xhtml"); + } catch (Exception e) { + e.printStackTrace(); + } + }else if(isLoginPage && (currentUser!=null)){ + //nh.handleNavigation(facesContext, null, "workspace"); + try { + facesContext.getExternalContext().dispatch("/pages/workspace.xhtml"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + } + + @Override + public void beforePhase(PhaseEvent event) { + + } + + @Override + public PhaseId getPhaseId() { + return PhaseId.RESTORE_VIEW; + } +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/filter/security/AuthorizationListener.java b/frontend/src/main/java/com/fp/frontend/filter/security/AuthorizationListener.java new file mode 100644 index 0000000..f131f48 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/filter/security/AuthorizationListener.java @@ -0,0 +1,59 @@ +package com.fp.frontend.filter.security; + +import javax.faces.application.NavigationHandler; +import javax.faces.context.FacesContext; +import javax.faces.event.PhaseEvent; +import javax.faces.event.PhaseId; +import javax.faces.event.PhaseListener; +import javax.servlet.http.HttpSession; + +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +public class AuthorizationListener implements PhaseListener { + + /** + * + */ + private static final long serialVersionUID = 1L; + + @Override + public void afterPhase(PhaseEvent event) { + FacesContext facesContext = event.getFacesContext(); + String currentPage = facesContext.getViewRoot().getViewId(); + + boolean isLoginPage = (currentPage.lastIndexOf("login.xhtml") > -1); + HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(false); + + NavigationHandler nh = facesContext.getApplication().getNavigationHandler(); + //NavigationHandler nh = FacesContext.getCurrentInstance().getApplication().getNavigationHandler(); + + TsafeUserDetail currentUser = session != null ? (TsafeUserDetail) session.getAttribute("TSAFEUSERDETAIL") : null; + + if (!isLoginPage && (currentUser == null)) { + //nh.handleNavigation(facesContext, null, "login"); + try { + facesContext.getExternalContext().dispatch("/login.xhtml"); + } catch (Exception e) { + e.printStackTrace(); + } + } else if (isLoginPage && (currentUser != null)) { + //nh.handleNavigation(facesContext, null, "workspace"); + try { + facesContext.getExternalContext().dispatch("/pages/workspace.xhtml"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + } + + @Override + public void beforePhase(PhaseEvent event) { + + } + + @Override + public PhaseId getPhaseId() { + return PhaseId.RESTORE_VIEW; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/helper/.svn/entries b/frontend/src/main/java/com/fp/frontend/helper/.svn/entries new file mode 100644 index 0000000..6882509 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/helper/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/helper +svn://172.17.26.185/COMACO + + + +2015-11-05T06:39:24.825849Z +4308 +fpazmino + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +CallerHelper.java +file + + + + +2022-07-28T03:39:45.604556Z +aa8539fcde8ed51143b173de008b70f5 +2014-10-17T05:13:58.096524Z +1666 +cpiedra + + + + + + + + + + + + + + + + + + + + + +10526 + +MessageHelper.java +file + + + + +2022-07-28T03:39:45.604556Z +04adc56fb9ab99e5fe73d2ffed5bffb6 +2015-11-05T06:39:24.825849Z +4308 +fpazmino + + + + + + + + + + + + + + + + + + + + + +8942 + diff --git a/frontend/src/main/java/com/fp/frontend/helper/.svn/text-base/CallerHelper.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/helper/.svn/text-base/CallerHelper.java.netbeans-base new file mode 100644 index 0000000..2c21fa0 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/helper/.svn/text-base/CallerHelper.java.netbeans-base @@ -0,0 +1,276 @@ +package com.fp.frontend.helper; + +import java.security.MessageDigest; +import java.util.Map; + +import javax.ejb.EJB; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpSession; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.facadeclient.ejb.FacadeBeanJsfRemote; +import com.fp.facadeclient.helper.ServiceLocatorJsf; +import com.fp.frontend.controller.security.LoginController; + +/** + * Clase utilitaria que se encarga de ejecutar acciones en el core. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class CallerHelper { + + @EJB + private FacadeBeanJsfRemote fremote; + + private final Request request; + + public CallerHelper() throws Exception { + // se utiliza en el login + this.request = new Request(); + } + + /** + * Constructor de la clase utilitaria para realizar las peticiones hacia el core + * + * @param facesContext + * @throws Exception + */ + public CallerHelper(FacesContext facesContext) throws Exception { + LoginController logincontroler = (LoginController) facesContext.getExternalContext().getSessionMap().get("loginController"); + Map params = facesContext.getExternalContext().getRequestParameterValuesMap(); + String m = ""; + Integer t = 0; + Integer v = 0; + if ((params.get("m") == null) && (params.get("t") == null) ) { + // Object[] tran = (Object[])params.get("tran"); ejemplo de prametros de un dialogo en runtime ejemplo LOV. + m = logincontroler.getRequest().getTransactionModule(); + t = logincontroler.getRequest().getTransactionCode(); + v = logincontroler.getRequest().getTransactionVersion(); + } else { + Object[] maux = params.get("m"); + Object[] taux = params.get("t"); + Object[] vaux = params.get("v"); + m = (String) maux[0]; + t = Integer.valueOf((String) taux[0]); + v = Integer.valueOf((String) vaux[0]); + logincontroler.getRequest().setTransactionModule(m); + logincontroler.getRequest().setTransactionCode(t); + logincontroler.getRequest().setTransactionVersion(v); + } + + this.request = new Request(); + try { + logincontroler.fijaRequestData(this.request, m, t, v); + } catch (NullPointerException e) { + Response r = new Response("BGEN-0000", "USUARIO NO HA INICIADO SESSION DE TRABAJO"); + MessageHelper.setMessageError(r); + } + } + + /** + * Metodo que ejecuta consultas, en el core de maia. + * + * @param request Request que contiene la metadata de consultas. + * @return Response + * @throws Throwable + */ + public Response executeQuery(Request request) throws Throwable { + // siempre obtener una referencia al ejb de consulta del servicelocator. + this.fremote = ServiceLocatorJsf.getInstance().getFacadeRemote("querybean"); + Response resp = (Response) this.fremote.process(request); + return resp; + } + + /** + * Metodo que ejecuta insert, update, delete, en el core de maia. + * + * @param request Request que contiene la metadata del mantenimiento + * @return Response + * @throws Throwable + */ + public Response executeSave(Request request) throws Throwable { + // siempre obtener una referencia al ejb de consulta del servicelocator. + this.fremote = ServiceLocatorJsf.getInstance().getFacadeRemote("savebean"); + Response resp = (Response) this.fremote.process(request); + return resp; + } + + /** + * Metodo que ejecuta insert, update, delete, en el core de maia. + * + * @param request Request que contiene la metadata del mantenimiento + * @return Response + * @throws Throwable + */ + public boolean executeReport(Request request) throws Throwable { + // siempre obtener una referencia al ejb de consulta del servicelocator. + this.fremote = ServiceLocatorJsf.getInstance().getFacadeRemote("reportbean"); + Object resp = this.fremote.process(request); + return (Boolean)resp; + } + + /** + * Metodo que ejecuta insert, update, delete, en el core de maia. + * + * @param request Request que contiene la metadata del mantenimiento + * @return Response + * @throws Throwable + */ + public Response login(Request request, String user, String password) throws Throwable { + request.setUser(user); + request.put("itemValue", this.getPasswordEncriptado(password)); + request.setTransactionModule("1"); + request.setTransactionCode(9998); + request.setTransactionVersion(1); + request.put("querytype", "T"); + HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false); + request.modifiedData().put("jsessionid", session.getId()); + // siempre obtener una referencia al ejb de consulta del servicelocator. + this.fremote = ServiceLocatorJsf.getInstance().getFacadeRemote("querywithcommitbean"); + Response resp = (Response) this.fremote.process(request); + return resp; + } + + /** + * Metodo que ejecuta insert, update, delete, en el core de maia. + * + * @param request Request que contiene la metadata del mantenimiento + * @return Response + * @throws Throwable + */ + public Response loginCas(Request request, String user, String password) throws Throwable { + request.put("itemValue", this.getPasswordEncriptado(password)); + request.setTransactionModule("1"); + request.setTransactionCode(9997); + request.setTransactionVersion(1); + request.put("querytype", "T"); + // siempre obtener una referencia al ejb de consulta del servicelocator. + this.fremote = ServiceLocatorJsf.getInstance().getFacadeRemote("querywithcommitbean"); + Response resp = (Response) this.fremote.process(request); + return resp; + } + + /** + * Metodo que ejecuta insert, update, delete, en el core de maia. + * + * @param request Request que contiene la metadata del mantenimiento + * @return Response + * @throws Throwable + */ + public Response logout(Request request) throws Throwable { + request.setTransactionModule("1"); + request.setTransactionCode(9999); + request.setTransactionVersion(1); + // siempre obtener una referencia al ejb de consulta del servicelocator. + this.fremote = ServiceLocatorJsf.getInstance().getFacadeRemote("savebean"); + Response resp = (Response) this.fremote.process(request); + return resp; + } + + /** + * Entrega el password encriptado. + * @param password Password a encriptar. + * @return String + * @throws Exception + */ + public String getPasswordEncriptado(String password) throws Exception { + if(password==null){ + return null; + } + MessageDigest messageDigest = MessageDigest.getInstance("SHA-1"); + messageDigest.reset(); + messageDigest.update(password.getBytes()); + String encriptado = toHexadecimal(messageDigest.digest()); + return encriptado; + } + /** + * Metodo que ejecuta insert, update, delete, en el core de maia. + * + * @param request Request que contiene la metadata del mantenimiento + * @return Response + * @throws Throwable + */ + public Response menu(Request request) throws Throwable { + Request rq = new Request(); + rq.setCompany(request.getCompany()); + rq.setProfile(request.getProfile()); + rq.setLanguage(request.getLanguage()); + rq.setTransactionModule(null); + rq.setTransactionCode(null); + rq.setTransactionVersion(null); + rq.put("querytype", "P"); + rq.put("queryalias", "MENU"); + // siempre obtener una referencia al ejb de consulta del servicelocator. + this.fremote = ServiceLocatorJsf.getInstance().getFacadeRemote("querywithcommitbean"); + Response resp = (Response) this.fremote.process(rq); + return resp; + } + + private static String toHexadecimal(byte[] digest) { + String hash = ""; + for (byte aux : digest) { + int b = aux & 0xff; + if (Integer.toHexString(b).length() == 1) { + hash += "0"; + } + hash += Integer.toHexString(b); + } + return hash; + } + + /** + * Verifica el parametro de la pagina autoquery es Y. + * + * @return boolean + * @throws Exception + */ + public boolean isautoquery() throws Exception { + Map m = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); + if ((m.get("autoquery") != null) && "Y".equals(m.get("autoquery"))) { + return true; + } + return false; + } + + /** + * Entrega el valor de un parametro del lov. Si no existe retorna null. + * + * @param parametername Nombre del parametro. + * @return String. + * @throws Exception + */ + public static String getLovParameter(String parametername) throws Exception { + Map params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterValuesMap(); + String[] obj = params.get(parametername); + if (obj == null) { + return null; + } + return obj[0]; + } + + /** + * Entrega el valor de: request + * + * @return Request + */ + public Request getRequest() { + return this.request; + } + + public Request getNewRequest(String module, Integer transaction, Integer version) throws Exception { + FacesContext facesContext = FacesContext.getCurrentInstance(); + LoginController logincontroler = (LoginController) facesContext.getExternalContext().getSessionMap().get("loginController"); + + Request newRequest = new Request(); + try { + logincontroler.fijaRequestData(newRequest, module, transaction, version); + } catch (NullPointerException e) { + Response r = new Response("BGEN-0000", "USUARIO NO HA INICIADO SESSION DE TRABAJO"); + MessageHelper.setMessageError(r); + } + return newRequest; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/helper/.svn/text-base/CallerHelper.java.svn-base b/frontend/src/main/java/com/fp/frontend/helper/.svn/text-base/CallerHelper.java.svn-base new file mode 100644 index 0000000..2c21fa0 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/helper/.svn/text-base/CallerHelper.java.svn-base @@ -0,0 +1,276 @@ +package com.fp.frontend.helper; + +import java.security.MessageDigest; +import java.util.Map; + +import javax.ejb.EJB; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpSession; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.facadeclient.ejb.FacadeBeanJsfRemote; +import com.fp.facadeclient.helper.ServiceLocatorJsf; +import com.fp.frontend.controller.security.LoginController; + +/** + * Clase utilitaria que se encarga de ejecutar acciones en el core. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class CallerHelper { + + @EJB + private FacadeBeanJsfRemote fremote; + + private final Request request; + + public CallerHelper() throws Exception { + // se utiliza en el login + this.request = new Request(); + } + + /** + * Constructor de la clase utilitaria para realizar las peticiones hacia el core + * + * @param facesContext + * @throws Exception + */ + public CallerHelper(FacesContext facesContext) throws Exception { + LoginController logincontroler = (LoginController) facesContext.getExternalContext().getSessionMap().get("loginController"); + Map params = facesContext.getExternalContext().getRequestParameterValuesMap(); + String m = ""; + Integer t = 0; + Integer v = 0; + if ((params.get("m") == null) && (params.get("t") == null) ) { + // Object[] tran = (Object[])params.get("tran"); ejemplo de prametros de un dialogo en runtime ejemplo LOV. + m = logincontroler.getRequest().getTransactionModule(); + t = logincontroler.getRequest().getTransactionCode(); + v = logincontroler.getRequest().getTransactionVersion(); + } else { + Object[] maux = params.get("m"); + Object[] taux = params.get("t"); + Object[] vaux = params.get("v"); + m = (String) maux[0]; + t = Integer.valueOf((String) taux[0]); + v = Integer.valueOf((String) vaux[0]); + logincontroler.getRequest().setTransactionModule(m); + logincontroler.getRequest().setTransactionCode(t); + logincontroler.getRequest().setTransactionVersion(v); + } + + this.request = new Request(); + try { + logincontroler.fijaRequestData(this.request, m, t, v); + } catch (NullPointerException e) { + Response r = new Response("BGEN-0000", "USUARIO NO HA INICIADO SESSION DE TRABAJO"); + MessageHelper.setMessageError(r); + } + } + + /** + * Metodo que ejecuta consultas, en el core de maia. + * + * @param request Request que contiene la metadata de consultas. + * @return Response + * @throws Throwable + */ + public Response executeQuery(Request request) throws Throwable { + // siempre obtener una referencia al ejb de consulta del servicelocator. + this.fremote = ServiceLocatorJsf.getInstance().getFacadeRemote("querybean"); + Response resp = (Response) this.fremote.process(request); + return resp; + } + + /** + * Metodo que ejecuta insert, update, delete, en el core de maia. + * + * @param request Request que contiene la metadata del mantenimiento + * @return Response + * @throws Throwable + */ + public Response executeSave(Request request) throws Throwable { + // siempre obtener una referencia al ejb de consulta del servicelocator. + this.fremote = ServiceLocatorJsf.getInstance().getFacadeRemote("savebean"); + Response resp = (Response) this.fremote.process(request); + return resp; + } + + /** + * Metodo que ejecuta insert, update, delete, en el core de maia. + * + * @param request Request que contiene la metadata del mantenimiento + * @return Response + * @throws Throwable + */ + public boolean executeReport(Request request) throws Throwable { + // siempre obtener una referencia al ejb de consulta del servicelocator. + this.fremote = ServiceLocatorJsf.getInstance().getFacadeRemote("reportbean"); + Object resp = this.fremote.process(request); + return (Boolean)resp; + } + + /** + * Metodo que ejecuta insert, update, delete, en el core de maia. + * + * @param request Request que contiene la metadata del mantenimiento + * @return Response + * @throws Throwable + */ + public Response login(Request request, String user, String password) throws Throwable { + request.setUser(user); + request.put("itemValue", this.getPasswordEncriptado(password)); + request.setTransactionModule("1"); + request.setTransactionCode(9998); + request.setTransactionVersion(1); + request.put("querytype", "T"); + HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false); + request.modifiedData().put("jsessionid", session.getId()); + // siempre obtener una referencia al ejb de consulta del servicelocator. + this.fremote = ServiceLocatorJsf.getInstance().getFacadeRemote("querywithcommitbean"); + Response resp = (Response) this.fremote.process(request); + return resp; + } + + /** + * Metodo que ejecuta insert, update, delete, en el core de maia. + * + * @param request Request que contiene la metadata del mantenimiento + * @return Response + * @throws Throwable + */ + public Response loginCas(Request request, String user, String password) throws Throwable { + request.put("itemValue", this.getPasswordEncriptado(password)); + request.setTransactionModule("1"); + request.setTransactionCode(9997); + request.setTransactionVersion(1); + request.put("querytype", "T"); + // siempre obtener una referencia al ejb de consulta del servicelocator. + this.fremote = ServiceLocatorJsf.getInstance().getFacadeRemote("querywithcommitbean"); + Response resp = (Response) this.fremote.process(request); + return resp; + } + + /** + * Metodo que ejecuta insert, update, delete, en el core de maia. + * + * @param request Request que contiene la metadata del mantenimiento + * @return Response + * @throws Throwable + */ + public Response logout(Request request) throws Throwable { + request.setTransactionModule("1"); + request.setTransactionCode(9999); + request.setTransactionVersion(1); + // siempre obtener una referencia al ejb de consulta del servicelocator. + this.fremote = ServiceLocatorJsf.getInstance().getFacadeRemote("savebean"); + Response resp = (Response) this.fremote.process(request); + return resp; + } + + /** + * Entrega el password encriptado. + * @param password Password a encriptar. + * @return String + * @throws Exception + */ + public String getPasswordEncriptado(String password) throws Exception { + if(password==null){ + return null; + } + MessageDigest messageDigest = MessageDigest.getInstance("SHA-1"); + messageDigest.reset(); + messageDigest.update(password.getBytes()); + String encriptado = toHexadecimal(messageDigest.digest()); + return encriptado; + } + /** + * Metodo que ejecuta insert, update, delete, en el core de maia. + * + * @param request Request que contiene la metadata del mantenimiento + * @return Response + * @throws Throwable + */ + public Response menu(Request request) throws Throwable { + Request rq = new Request(); + rq.setCompany(request.getCompany()); + rq.setProfile(request.getProfile()); + rq.setLanguage(request.getLanguage()); + rq.setTransactionModule(null); + rq.setTransactionCode(null); + rq.setTransactionVersion(null); + rq.put("querytype", "P"); + rq.put("queryalias", "MENU"); + // siempre obtener una referencia al ejb de consulta del servicelocator. + this.fremote = ServiceLocatorJsf.getInstance().getFacadeRemote("querywithcommitbean"); + Response resp = (Response) this.fremote.process(rq); + return resp; + } + + private static String toHexadecimal(byte[] digest) { + String hash = ""; + for (byte aux : digest) { + int b = aux & 0xff; + if (Integer.toHexString(b).length() == 1) { + hash += "0"; + } + hash += Integer.toHexString(b); + } + return hash; + } + + /** + * Verifica el parametro de la pagina autoquery es Y. + * + * @return boolean + * @throws Exception + */ + public boolean isautoquery() throws Exception { + Map m = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); + if ((m.get("autoquery") != null) && "Y".equals(m.get("autoquery"))) { + return true; + } + return false; + } + + /** + * Entrega el valor de un parametro del lov. Si no existe retorna null. + * + * @param parametername Nombre del parametro. + * @return String. + * @throws Exception + */ + public static String getLovParameter(String parametername) throws Exception { + Map params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterValuesMap(); + String[] obj = params.get(parametername); + if (obj == null) { + return null; + } + return obj[0]; + } + + /** + * Entrega el valor de: request + * + * @return Request + */ + public Request getRequest() { + return this.request; + } + + public Request getNewRequest(String module, Integer transaction, Integer version) throws Exception { + FacesContext facesContext = FacesContext.getCurrentInstance(); + LoginController logincontroler = (LoginController) facesContext.getExternalContext().getSessionMap().get("loginController"); + + Request newRequest = new Request(); + try { + logincontroler.fijaRequestData(newRequest, module, transaction, version); + } catch (NullPointerException e) { + Response r = new Response("BGEN-0000", "USUARIO NO HA INICIADO SESSION DE TRABAJO"); + MessageHelper.setMessageError(r); + } + return newRequest; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/helper/.svn/text-base/MessageHelper.java.svn-base b/frontend/src/main/java/com/fp/frontend/helper/.svn/text-base/MessageHelper.java.svn-base new file mode 100644 index 0000000..b215ab9 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/helper/.svn/text-base/MessageHelper.java.svn-base @@ -0,0 +1,223 @@ +package com.fp.frontend.helper; + +import javax.faces.application.FacesMessage; +import javax.faces.context.FacesContext; + +import com.fp.common.exception.ExceptionHandler; +import com.fp.dto.Response; +import com.fp.frontend.utility.MsgGeneral; + +/** + * Clase a extender en las clases encargadas de obtener direcciones email a las cuales se envía notificaciones de flujos + * de trabajo.. + * + * @version 2.1 + * @author Jorge Vaca + */ +public class MessageHelper { + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza correctamente. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una transaccion. + */ + public static void setMessageError(Response response) { + MessageHelper.setMessage(response, FacesMessage.SEVERITY_ERROR); + } + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza correctamente. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una transaccion. + */ + public static void setMessageInfo(Response response) { + MessageHelper.setMessage(response, FacesMessage.SEVERITY_INFO); + } + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza correctamente agregado un parametro. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una transaccion. + * @param parametro Parametro a mostrar adjunto al mensaje + */ + public static void setMessageInfo(Response response, String parametro) { + MessageHelper.setMessage(response, FacesMessage.SEVERITY_INFO, parametro); + } + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza correctamente. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una transaccion. + */ + public static void setMessageInfo(String messagecode, String idComponent, Object... parameters) { + MessageHelper.setMessage(FacesMessage.SEVERITY_INFO, messagecode, idComponent, parameters); + } + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza correctamente. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una transaccion. + */ + public static void setMessageError(String messagecode, Object... parameters) { + MessageHelper.setMessageError(messagecode, null, parameters); + } + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza correctamente. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una transaccion. + * @param filename Nombre del campo al cual se asocia el mensaje de error. + */ + public static void setMessageError(String messagecode, String idComponent, Object... parameters) { + MessageHelper.setMessage(FacesMessage.SEVERITY_ERROR, messagecode, idComponent, parameters); + FacesContext.getCurrentInstance().validationFailed(); + } + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza correctamente. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una transaccion. + */ + public static void setMessageWarn(String messagecode, Object... parameters) { + MessageHelper.setMessageWarn(messagecode, null, parameters); + } + + /** + * Manejo de mensaje de advertencia bajo alguna condicion. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una transaccion. + * @param filename Nombre del campo al cual se asocia el mensaje de error. + */ + public static void setMessageWarn(String messagecode, String idComponent, Object... parameters) { + MessageHelper.setMessage(FacesMessage.SEVERITY_WARN, messagecode, idComponent, parameters); + FacesContext.getCurrentInstance().validationFailed(); + } + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza correctamente. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una transaccion. + * @param filename Nombre del campo al cual se asocia el mensaje de error. + */ + private static void setMessage(FacesMessage.Severity type, String messagecode, String idComponent, Object... parameters) { + String message = messagecode; + try { + message = MsgGeneral.getProperty(messagecode, parameters); + } catch (Exception e) { + // NO hacer nada se presenta el codigo de mensaje. + } + + MessageHelper.setMessage(message, type, idComponent); + FacesContext.getCurrentInstance().validationFailed(); + } + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza correctamente. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una transaccion. + */ + public static void setMessageWarn(Response response) { + MessageHelper.setMessage(response, FacesMessage.SEVERITY_WARN); + } + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza correctamente. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una transaccion. + */ + private static void setMessage(Response response, FacesMessage.Severity type) { + try { + FacesMessage fm = new FacesMessage(); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + fm.setSummary("TRANSACCION FINALIZADA"); + } else { + fm.setSummary(response.getResponseCode() + " " + response.getResponseUserMessage()); + FacesContext.getCurrentInstance().validationFailed(); + } + + fm.setDetail(""); + fm.setSeverity(type); // con esto saca la imagen en el browser. + FacesContext.getCurrentInstance().addMessage(null, fm); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Manejo de un mensaje personalizado + * @param message + */ + public static void setMessageInfo(String message){ + try { + FacesMessage fm = new FacesMessage(); + fm.setSummary(message); + FacesContext.getCurrentInstance().addMessage(null, fm); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza correctamente. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una transaccion. + * @param severity Severity error + * @param param valor a mostrar adjunto al mensaje + */ + private static void setMessage(Response response, FacesMessage.Severity type, String param) { + try { + FacesMessage fm = new FacesMessage(); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + fm.setSummary("TRANSACCION FINALIZADA "+param); + } else { + fm.setSummary(response.getResponseCode() + " " + response.getResponseUserMessage()); + FacesContext.getCurrentInstance().validationFailed(); + } + + fm.setDetail(""); + fm.setSeverity(type); // con esto saca la imagen en el browser. + FacesContext.getCurrentInstance().addMessage(null, fm); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Manejo del mensaje de respuesta cuando en la ejecucion de una transaccion se presenta una excepcion. + * + * @param ex + */ + public static void setMessageError(Throwable ex) { + try { + ExceptionHandler eh = new ExceptionHandler(ex, "es"); + FacesMessage fm = new FacesMessage(); + fm.setSummary(eh.getUserMessage()); + fm.setDetail(eh.getTechnicalMessage()); + fm.setSeverity(FacesMessage.SEVERITY_ERROR); + FacesContext.getCurrentInstance().addMessage(null, fm); + ex.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza correctamente. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una transaccion. + */ + private static void setMessage(String messagecode, FacesMessage.Severity type, String idComponent) { + try { + FacesMessage fm = new FacesMessage(); + fm.setSummary(messagecode); + fm.setDetail(""); + fm.setSeverity(type); + + FacesContext.getCurrentInstance().addMessage(idComponent, fm); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/helper/CallerHelper.java b/frontend/src/main/java/com/fp/frontend/helper/CallerHelper.java new file mode 100644 index 0000000..763454c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/helper/CallerHelper.java @@ -0,0 +1,280 @@ +package com.fp.frontend.helper; + +import java.security.MessageDigest; +import java.util.Map; + +import javax.ejb.EJB; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpSession; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.facadeclient.ejb.FacadeBeanJsfRemote; +import com.fp.facadeclient.helper.ServiceLocatorJsf; +import com.fp.frontend.controller.security.LoginController; + +/** + * Clase utilitaria que se encarga de ejecutar acciones en el core. + * + * @author Jorge Vaca. + * @version 2.1 + */ +public class CallerHelper { + + @EJB + private FacadeBeanJsfRemote fremote; + + private final Request request; + + public CallerHelper() throws Exception { + // se utiliza en el login + this.request = new Request(); + } + + /** + * Constructor de la clase utilitaria para realizar las peticiones hacia el + * core + * + * @param facesContext + * @throws Exception + */ + public CallerHelper(FacesContext facesContext) throws Exception { + LoginController logincontroler = (LoginController) facesContext.getExternalContext().getSessionMap().get("loginController"); + Map params = facesContext.getExternalContext().getRequestParameterValuesMap(); + String m = ""; + Integer t = 0; + Integer v = 0; + if ((params.get("m") == null) && (params.get("t") == null)) { + // Object[] tran = (Object[])params.get("tran"); ejemplo de prametros de un dialogo en runtime ejemplo LOV. + m = logincontroler.getRequest().getTransactionModule(); + t = logincontroler.getRequest().getTransactionCode(); + v = logincontroler.getRequest().getTransactionVersion(); + } else { + Object[] maux = params.get("m"); + Object[] taux = params.get("t"); + Object[] vaux = params.get("v"); + m = (String) maux[0]; + t = Integer.valueOf((String) taux[0]); + v = Integer.valueOf((String) vaux[0]); + logincontroler.getRequest().setTransactionModule(m); + logincontroler.getRequest().setTransactionCode(t); + logincontroler.getRequest().setTransactionVersion(v); + } + + this.request = new Request(); + try { + logincontroler.fijaRequestData(this.request, m, t, v); + } catch (NullPointerException e) { + Response r = new Response("BGEN-0000", "USUARIO NO HA INICIADO SESSION DE TRABAJO"); + MessageHelper.setMessageError(r); + } + } + + /** + * Metodo que ejecuta consultas, en el core de maia. + * + * @param request Request que contiene la metadata de consultas. + * @return Response + * @throws Throwable + */ + public Response executeQuery(Request request) throws Throwable { + // siempre obtener una referencia al ejb de consulta del servicelocator. + this.fremote = ServiceLocatorJsf.getInstance().getFacadeRemote("querybean"); + Response resp = (Response) this.fremote.process(request); + + return resp; + } + + /** + * Metodo que ejecuta insert, update, delete, en el core de maia. + * + * @param request Request que contiene la metadata del mantenimiento + * @return Response + * @throws Throwable + */ + public Response executeSave(Request request) throws Throwable { + // siempre obtener una referencia al ejb de consulta del servicelocator. + this.fremote = ServiceLocatorJsf.getInstance().getFacadeRemote("savebean"); + Response resp = (Response) this.fremote.process(request); + return resp; + } + + /** + * Metodo que ejecuta insert, update, delete, en el core de maia. + * + * @param request Request que contiene la metadata del mantenimiento + * @return Response + * @throws Throwable + */ + public boolean executeReport(Request request) throws Throwable { + // siempre obtener una referencia al ejb de consulta del servicelocator. + this.fremote = ServiceLocatorJsf.getInstance().getFacadeRemote("reportbean"); + Object resp = this.fremote.process(request); + return (Boolean) resp; + } + + /** + * Metodo que ejecuta insert, update, delete, en el core de maia. + * + * @param request Request que contiene la metadata del mantenimiento + * @return Response + * @throws Throwable + */ + public Response login(Request request, String user, String password) throws Throwable { + request.setUser(user); + request.put("itemValue", this.getPasswordEncriptado(password)); + request.setTransactionModule("1"); + request.setTransactionCode(9998); + request.setTransactionVersion(1); + request.put("querytype", "T"); + HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false); + request.modifiedData().put("jsessionid", session.getId()); + // siempre obtener una referencia al ejb de consulta del servicelocator. + this.fremote = ServiceLocatorJsf.getInstance().getFacadeRemote("querywithcommitbean"); + Response resp = (Response) this.fremote.process(request); + return resp; + } + + /** + * Metodo que ejecuta insert, update, delete, en el core de maia. + * + * @param request Request que contiene la metadata del mantenimiento + * @return Response + * @throws Throwable + */ + public Response loginCas(Request request, String user, String password) throws Throwable { + request.put("itemValue", this.getPasswordEncriptado(password)); + request.setTransactionModule("1"); + request.setTransactionCode(9997); + request.setTransactionVersion(1); + request.put("querytype", "T"); + // siempre obtener una referencia al ejb de consulta del servicelocator. + this.fremote = ServiceLocatorJsf.getInstance().getFacadeRemote("querywithcommitbean"); + Response resp = (Response) this.fremote.process(request); + return resp; + } + + /** + * Metodo que ejecuta insert, update, delete, en el core de maia. + * + * @param request Request que contiene la metadata del mantenimiento + * @return Response + * @throws Throwable + */ + public Response logout(Request request) throws Throwable { + request.setTransactionModule("1"); + request.setTransactionCode(9999); + request.setTransactionVersion(1); + // siempre obtener una referencia al ejb de consulta del servicelocator. + this.fremote = ServiceLocatorJsf.getInstance().getFacadeRemote("savebean"); + Response resp = (Response) this.fremote.process(request); + return resp; + } + + /** + * Entrega el password encriptado. + * + * @param password Password a encriptar. + * @return String + * @throws Exception + */ + public String getPasswordEncriptado(String password) throws Exception { + if (password == null) { + return null; + } + MessageDigest messageDigest = MessageDigest.getInstance("SHA-1"); + messageDigest.reset(); + messageDigest.update(password.getBytes()); + String encriptado = toHexadecimal(messageDigest.digest()); + return encriptado; + } + + /** + * Metodo que ejecuta insert, update, delete, en el core de maia. + * + * @param request Request que contiene la metadata del mantenimiento + * @return Response + * @throws Throwable + */ + public Response menu(Request request) throws Throwable { + Request rq = new Request(); + rq.setCompany(request.getCompany()); + rq.setProfile(request.getProfile()); + rq.setLanguage(request.getLanguage()); + rq.setTransactionModule(null); + rq.setTransactionCode(null); + rq.setTransactionVersion(null); + rq.put("querytype", "P"); + rq.put("queryalias", "MENU"); + // siempre obtener una referencia al ejb de consulta del servicelocator. + this.fremote = ServiceLocatorJsf.getInstance().getFacadeRemote("querywithcommitbean"); + Response resp = (Response) this.fremote.process(rq); + return resp; + } + + private static String toHexadecimal(byte[] digest) { + String hash = ""; + for (byte aux : digest) { + int b = aux & 0xff; + if (Integer.toHexString(b).length() == 1) { + hash += "0"; + } + hash += Integer.toHexString(b); + } + return hash; + } + + /** + * Verifica el parametro de la pagina autoquery es Y. + * + * @return boolean + * @throws Exception + */ + public boolean isautoquery() throws Exception { + Map m = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); + if ((m.get("autoquery") != null) && "Y".equals(m.get("autoquery"))) { + return true; + } + return false; + } + + /** + * Entrega el valor de un parametro del lov. Si no existe retorna null. + * + * @param parametername Nombre del parametro. + * @return String. + * @throws Exception + */ + public static String getLovParameter(String parametername) throws Exception { + Map params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterValuesMap(); + String[] obj = params.get(parametername); + if (obj == null) { + return null; + } + return obj[0]; + } + + /** + * Entrega el valor de: request + * + * @return Request + */ + public Request getRequest() { + return this.request; + } + + public Request getNewRequest(String module, Integer transaction, Integer version) throws Exception { + FacesContext facesContext = FacesContext.getCurrentInstance(); + LoginController logincontroler = (LoginController) facesContext.getExternalContext().getSessionMap().get("loginController"); + + Request newRequest = new Request(); + try { + logincontroler.fijaRequestData(newRequest, module, transaction, version); + } catch (NullPointerException e) { + Response r = new Response("BGEN-0000", "USUARIO NO HA INICIADO SESSION DE TRABAJO"); + MessageHelper.setMessageError(r); + } + return newRequest; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/helper/MessageHelper.java b/frontend/src/main/java/com/fp/frontend/helper/MessageHelper.java new file mode 100644 index 0000000..4478382 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/helper/MessageHelper.java @@ -0,0 +1,250 @@ +package com.fp.frontend.helper; + +import javax.faces.application.FacesMessage; +import javax.faces.context.FacesContext; + +import com.fp.common.exception.ExceptionHandler; +import com.fp.dto.Response; +import com.fp.frontend.utility.MsgGeneral; + +/** + * Clase a extender en las clases encargadas de obtener direcciones email a las + * cuales se envía notificaciones de flujos de trabajo.. + * + * @version 2.1 + * @author Jorge Vaca + */ +public class MessageHelper { + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza + * correctamente. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una + * transaccion. + */ + public static void setMessageError(Response response) { + MessageHelper.setMessage(response, FacesMessage.SEVERITY_ERROR); + } + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza + * correctamente. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una + * transaccion. + */ + public static void setMessageInfo(Response response) { + MessageHelper.setMessage(response, FacesMessage.SEVERITY_INFO); + } + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza + * correctamente agregado un parametro. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una + * transaccion. + * @param parametro Parametro a mostrar adjunto al mensaje + */ + public static void setMessageInfo(Response response, String parametro) { + MessageHelper.setMessage(response, FacesMessage.SEVERITY_INFO, parametro); + } + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza + * correctamente. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una + * transaccion. + */ + public static void setMessageInfo(String messagecode, String idComponent, Object... parameters) { + MessageHelper.setMessage(FacesMessage.SEVERITY_INFO, messagecode, idComponent, parameters); + } + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza + * correctamente. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una + * transaccion. + */ + public static void setMessageError(String messagecode, Object... parameters) { + MessageHelper.setMessageError(messagecode, null, parameters); + } + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza + * correctamente. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una + * transaccion. + * @param filename Nombre del campo al cual se asocia el mensaje de error. + */ + public static void setMessageError(String messagecode, String idComponent, Object... parameters) { + MessageHelper.setMessage(FacesMessage.SEVERITY_ERROR, messagecode, idComponent, parameters); + FacesContext.getCurrentInstance().validationFailed(); + } + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza + * correctamente. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una + * transaccion. + */ + public static void setMessageWarn(String messagecode, Object... parameters) { + MessageHelper.setMessageWarn(messagecode, null, parameters); + } + + /** + * Manejo de mensaje de advertencia bajo alguna condicion. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una + * transaccion. + * @param filename Nombre del campo al cual se asocia el mensaje de error. + */ + public static void setMessageWarn(String messagecode, String idComponent, Object... parameters) { + MessageHelper.setMessage(FacesMessage.SEVERITY_WARN, messagecode, idComponent, parameters); + FacesContext.getCurrentInstance().validationFailed(); + } + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza + * correctamente. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una + * transaccion. + * @param filename Nombre del campo al cual se asocia el mensaje de error. + */ + private static void setMessage(FacesMessage.Severity type, String messagecode, String idComponent, Object... parameters) { + String message = messagecode; + try { + message = MsgGeneral.getProperty(messagecode, parameters); + } catch (Exception e) { + // NO hacer nada se presenta el codigo de mensaje. + } + + MessageHelper.setMessage(message, type, idComponent); + FacesContext.getCurrentInstance().validationFailed(); + } + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza + * correctamente. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una + * transaccion. + */ + public static void setMessageWarn(Response response) { + MessageHelper.setMessage(response, FacesMessage.SEVERITY_WARN); + } + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza + * correctamente. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una + * transaccion. + */ + private static void setMessage(Response response, FacesMessage.Severity type) { + try { + FacesMessage fm = new FacesMessage(); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + fm.setSummary("TRANSACCION FINALIZADA"); + } else { + fm.setSummary(response.getResponseCode() + " " + response.getResponseUserMessage()); + FacesContext.getCurrentInstance().validationFailed(); + } + + fm.setDetail(""); + fm.setSeverity(type); // con esto saca la imagen en el browser. + FacesContext.getCurrentInstance().addMessage(null, fm); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Manejo de un mensaje personalizado + * + * @param message + */ + public static void setMessageInfo(String message) { + try { + FacesMessage fm = new FacesMessage(); + fm.setSummary(message); + FacesContext.getCurrentInstance().addMessage(null, fm); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza + * correctamente. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una + * transaccion. + * @param severity Severity error + * @param param valor a mostrar adjunto al mensaje + */ + private static void setMessage(Response response, FacesMessage.Severity type, String param) { + try { + FacesMessage fm = new FacesMessage(); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + fm.setSummary("TRANSACCION FINALIZADA " + param); + } else { + fm.setSummary(response.getResponseCode() + " " + response.getResponseUserMessage()); + FacesContext.getCurrentInstance().validationFailed(); + } + + fm.setDetail(""); + fm.setSeverity(type); // con esto saca la imagen en el browser. + FacesContext.getCurrentInstance().addMessage(null, fm); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Manejo del mensaje de respuesta cuando en la ejecucion de una transaccion + * se presenta una excepcion. + * + * @param ex + */ + public static void setMessageError(Throwable ex) { + try { + ExceptionHandler eh = new ExceptionHandler(ex, "es"); + FacesMessage fm = new FacesMessage(); + fm.setSummary(eh.getUserMessage()); + fm.setDetail(eh.getTechnicalMessage()); + fm.setSeverity(FacesMessage.SEVERITY_ERROR); + FacesContext.getCurrentInstance().addMessage(null, fm); + ex.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Manejo de mensaje de error cuando en el core una transaccion no finaliza + * correctamente. + * + * @param response Objeto que contiene la respuesta de la ejecucion de una + * transaccion. + */ + private static void setMessage(String messagecode, FacesMessage.Severity type, String idComponent) { + try { + FacesMessage fm = new FacesMessage(); + fm.setSummary(messagecode); + fm.setDetail(""); + fm.setSeverity(type); + + FacesContext.getCurrentInstance().addMessage(idComponent, fm); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/prueba/.svn/entries b/frontend/src/main/java/com/fp/frontend/prueba/.svn/entries new file mode 100644 index 0000000..6470c57 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/prueba/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/prueba +svn://172.17.26.185/COMACO + + + +2014-10-25T06:58:33.492240Z +1945 +cguzman + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ValidarDepositoFlowController.java +file + + + + +2022-07-28T03:40:00.196619Z +0aa95bcdcfb6810f2664beb453b0e1c2 +2014-09-12T08:01:36.959332Z +700 +fpazmino + + + + + + + + + + + + + + + + + + + + + +8869 + +PruebaInicioFlujo.java +file + + + + +2022-07-28T03:40:00.196619Z +1b5607398b3721daf5fa12fc04d690ac +2014-10-25T06:58:33.492240Z +1945 +cguzman + + + + + + + + + + + + + + + + + + + + + +4529 + diff --git a/frontend/src/main/java/com/fp/frontend/prueba/.svn/text-base/PruebaInicioFlujo.java.svn-base b/frontend/src/main/java/com/fp/frontend/prueba/.svn/text-base/PruebaInicioFlujo.java.svn-base new file mode 100644 index 0000000..dcb4988 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/prueba/.svn/text-base/PruebaInicioFlujo.java.svn-base @@ -0,0 +1,143 @@ +package com.fp.frontend.prueba; + +import java.util.HashMap; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgGeneral; + +/** + * Clase controladora para la verificacion de los requisitos del tramite. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class PruebaInicioFlujo extends AbstractController { + + public PruebaInicioFlujo() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + + try { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + } + + + /** + * Metodo para cargar el registro de la solicitud tramite en la lista new + */ + + @Override + public void save() { + try { + System.out.println("--------------------------prueba------------------"); + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + request.setSaveTables(msave); + request.modifiedData().put("csolicitud", "1"); + request.modifiedData().put("isnew", "Y"); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + + + @Override + protected void querydatabase() { + try { + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para el inicio de flujo + */ + public void iniciarFlujo() { + try { + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + request.modifiedData().put("csolicitud", "1"); + request.modifiedData().put("numerotransaccion", "32"); + request.modifiedData().put("xpath", "emisiondocumentohabilitante"); + request.modifiedData().put("isnew", "Y"); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.setShowRow(true); + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + " SOLICITUD: 1 " ); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para el inicio de flujo + */ + public void completarTarea() { + + try { +// Request request = callerhelper.getRequest(); +// // limpiar request para finalizar la tarea. +// super.cleanRequest(request); +// +// request.modifiedData().put("csolicitud", solicitud.getRecord().getPk()); +// request.modifiedData().put("TID", tid); +// request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R +// request.modifiedData().put("BPMObs", bpmDataComment); +// +// Response resp = callerhelper.executeSave(request); +// +// if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { +// MessageHelper.setMessageInfo(resp); +// RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); +// } else { +// MessageHelper.setMessageError(resp); +// } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/prueba/.svn/text-base/ValidarDepositoFlowController.java.svn-base b/frontend/src/main/java/com/fp/frontend/prueba/.svn/text-base/ValidarDepositoFlowController.java.svn-base new file mode 100644 index 0000000..2a4dc83 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/prueba/.svn/text-base/ValidarDepositoFlowController.java.svn-base @@ -0,0 +1,283 @@ +package com.fp.frontend.prueba; + +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.IngresoDatosTipoTramite; +import com.fp.frontend.controller.armas.solicitud.SolicitudArmasController; +import com.fp.frontend.controller.armas.solicitud.SolicitudTramiteController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora para la validacion del deposito + * + * @author CHRISTIAN PAZMINO + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ValidarDepositoFlowController extends AbstractController { + +private String csolicitud="1"; + + /** + * Variable del tipo TgeneCatalogDetail(catalogo del tramite) + */ + private TgeneCatalogDetail nombreTramite; + /** + * Variable del tipo TgeneCatalogDetail(catalogo de la categoria) + */ + private TgeneCatalogDetail nombreCategoria; + /** + * Variable del tipo TgeneCatalogDetail(catalogo del uso actividad del tramite) + */ + private TgeneCatalogDetail nombreUsoActividad; + /** + * Opciones de aceptar o rechazar + */ + private List accionList; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + private TarmSolicitud solicitud; + + private String accionTomada; + + private final String APROBAR = "APR"; + private final String REPROBAR = "RECH"; + + private final String APROBAR_DEPOSITO = "APBDEP"; + private final String ANULAR_DEPOSITO = "ANUDEP"; + + /** + * Variable que indica si el usuario esta negado para continuar en la pantalla + */ + private Boolean isDenied; + + /** + * Variable auxiliar usada para diferenciar cuando se presenta o no el mensaje de validacion de fecha expiracion solicitud + */ + private Boolean isOnlyMsj; + + public ValidarDepositoFlowController() throws Exception { + super(TarmSolicitudTramite.class); + } + + @PostConstruct + private void postconstruct() { + init(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza el controlador. + */ + private void init() { + this.beanalias = "VALIDARDEPOSITO"; + accionList=CatalogDetailController.find("ACCION"); + this.record = SolicitudTramiteController.findByCSolicitud(csolicitud); + isOnlyMsj = false; + try { + isDenied = true; + if(record!=null){ + solicitud = SolicitudArmasController.find(csolicitud); + if(solicitud!=null && solicitud.getCtramite()!=null){ + TarmTramite tramite = IngresoDatosTipoTramite.find(solicitud.getCtramite().toString()); + if(tramite!=null){ + //Tramite + nombreTramite= CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + nombreCategoria= CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + nombreUsoActividad= CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + } + else{ + MessageHelper.setMessageError("NO EXISTE UN TIPO DE TR\u00c1MITE ASOCIADO A LA SOLICITUD"); + } + } + else{ + MessageHelper.setMessageError("NO EXISTE UNA SOLICITUD ASOCIADA AL TR\u00c1MITE"); + } + } + else{ + MessageHelper.setMessageError("NO EXISTE EL TR\u00c1MITE EN LA BASE DE DATOS"); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void cancelar(){ + init(); + } + + @Override + public void save() { + try { + if(accionTomada.equalsIgnoreCase(APROBAR)){ + record.setEstadotramite(APROBAR_DEPOSITO); + }else{ + record.setEstadotramite(ANULAR_DEPOSITO); + } + super.update(); + DtoSave dtosave = super.getDtoSave(); + HashMap msave = new HashMap(); + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + isDenied = true; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Throwable e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + protected void querydatabase() { + try { + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Retorna la ruta de documento base en donde se almacenará dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(solicitud.getFregistro()); + StringBuilder ruta = new StringBuilder("cm:Solicitudes"); + ruta = ruta.append("/cm:").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + return ruta.toString(); + } + + /** + * Metodo para validar el valor a pagar + */ + public void validarValorDelDeposito(){ + if(record.getValorapagar().compareTo(record.getValorverificado())!=0){ + MessageHelper.setMessageError("EL VALOR VERIFICADO ES DIFERENTE DEL VALOR A PAGAR Y SE ANULAR"); + } + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public TgeneCatalogDetail getNombreTramite() { + return nombreTramite; + } + + public void setNombreTramite(TgeneCatalogDetail nombreTramite) { + this.nombreTramite = nombreTramite; + } + + public TgeneCatalogDetail getNombreCategoria() { + return nombreCategoria; + } + + public void setNombreCategoria(TgeneCatalogDetail nombreCategoria) { + this.nombreCategoria = nombreCategoria; + } + + public TgeneCatalogDetail getNombreUsoActividad() { + return nombreUsoActividad; + } + + public void setNombreUsoActividad(TgeneCatalogDetail nombreUsoActividad) { + this.nombreUsoActividad = nombreUsoActividad; + } + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + public Boolean getIsDenied() { + return isDenied; + } + + public void setIsDenied(Boolean isDenied) { + this.isDenied = isDenied; + } + + public Boolean getIsOnlyMsj() { + return isOnlyMsj; + } + + public void setIsOnlyMsj(Boolean isOnlyMsj) { + this.isOnlyMsj = isOnlyMsj; + } + + public List getAccionList() { + return accionList; + } + + public void setAccionList(List accionList) { + this.accionList = accionList; + } + + public String getAccionTomada() { + return accionTomada; + } + + public void setAccionTomada(String accionTomada) { + this.accionTomada = accionTomada; + } + + public void aceptar(){ + if(record.getValorapagar().compareTo(record.getValorverificado())!=0){ + accionTomada = REPROBAR; + isDenied = true; + }else{ + accionTomada = ""; + isDenied = false; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/prueba/PruebaInicioFlujo.java b/frontend/src/main/java/com/fp/frontend/prueba/PruebaInicioFlujo.java new file mode 100644 index 0000000..df0ec71 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/prueba/PruebaInicioFlujo.java @@ -0,0 +1,139 @@ +package com.fp.frontend.prueba; + +import java.util.HashMap; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.AbstractDataTransport; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.frontend.utility.MsgGeneral; + +/** + * Clase controladora para la verificacion de los requisitos del tramite. + * + * @author C.P. + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class PruebaInicioFlujo extends AbstractController { + + public PruebaInicioFlujo() throws Exception { + super(AbstractDataTransport.class); + } + + @PostConstruct + private void postconstruct() { + + try { + this.init(); + // Inicializa autoconsulta + super.startQuery(); + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + } + + /** + * Metodo para cargar el registro de la solicitud tramite en la lista new + */ + @Override + public void save() { + try { + System.out.println("--------------------------prueba------------------"); + Request request = callerhelper.getRequest(); + HashMap msave = new HashMap(); + request.setSaveTables(msave); + request.modifiedData().put("csolicitud", "1"); + request.modifiedData().put("isnew", "Y"); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + MessageHelper.setMessageInfo(resp); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + protected void querydatabase() { + try { + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para el inicio de flujo + */ + public void iniciarFlujo() { + try { + + Request request = callerhelper.getRequest(); + super.cleanRequest(request); + request.modifiedData().put("csolicitud", "1"); + request.modifiedData().put("numerotransaccion", "32"); + request.modifiedData().put("xpath", "emisiondocumentohabilitante"); + request.modifiedData().put("isnew", "Y"); + Response resp = callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.setShowRow(true); + MessageHelper.setMessageInfo(resp, MsgGeneral.getProperty("msg_initFlow") + " SOLICITUD: 1 "); + } else { + MessageHelper.setMessageError(resp); + } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Método para el inicio de flujo + */ + public void completarTarea() { + + try { +// Request request = callerhelper.getRequest(); +// // limpiar request para finalizar la tarea. +// super.cleanRequest(request); +// +// request.modifiedData().put("csolicitud", solicitud.getRecord().getPk()); +// request.modifiedData().put("TID", tid); +// request.modifiedData().put("BPMStatus", bpmDataStatus == null ? "A" : bpmDataStatus); // A,D,R +// request.modifiedData().put("BPMObs", bpmDataComment); +// +// Response resp = callerhelper.executeSave(request); +// +// if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { +// MessageHelper.setMessageInfo(resp); +// RequestContext.getCurrentInstance().execute("Maia.refreshusertasks()"); +// } else { +// MessageHelper.setMessageError(resp); +// } + } catch (Throwable e) { + MessageHelper.setMessageError(e); + } + } + + @Override + public void postCommit(Response response) throws Exception { + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/prueba/ValidarDepositoFlowController.java b/frontend/src/main/java/com/fp/frontend/prueba/ValidarDepositoFlowController.java new file mode 100644 index 0000000..6d6f8c7 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/prueba/ValidarDepositoFlowController.java @@ -0,0 +1,285 @@ +package com.fp.frontend.prueba; + +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.ViewScoped; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.dto.save.DtoSave; +import com.fp.frontend.controller.AbstractController; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.controller.armas.parametros.IngresoDatosTipoTramite; +import com.fp.frontend.controller.armas.solicitud.SolicitudArmasController; +import com.fp.frontend.controller.armas.solicitud.SolicitudTramiteController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmTramite; +import com.fp.persistence.parmas.soli.TarmSolicitud; +import com.fp.persistence.parmas.soli.TarmSolicitudTramite; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; + +/** + * Clase controladora para la validacion del deposito + * + * @author CHRISTIAN PAZMINO + * @version 2.1 + */ +@SuppressWarnings("serial") +@ManagedBean +@ViewScoped +public class ValidarDepositoFlowController extends AbstractController { + + private String csolicitud = "1"; + + /** + * Variable del tipo TgeneCatalogDetail(catalogo del tramite) + */ + private TgeneCatalogDetail nombreTramite; + /** + * Variable del tipo TgeneCatalogDetail(catalogo de la categoria) + */ + private TgeneCatalogDetail nombreCategoria; + /** + * Variable del tipo TgeneCatalogDetail(catalogo del uso actividad del + * tramite) + */ + private TgeneCatalogDetail nombreUsoActividad; + /** + * Opciones de aceptar o rechazar + */ + private List accionList; + + @ManagedProperty(value = "#{alfrescoController}") + private AlfrescoController alfrescoController; + + private TarmSolicitud solicitud; + + private String accionTomada; + + private final String APROBAR = "APR"; + private final String REPROBAR = "RECH"; + + private final String APROBAR_DEPOSITO = "APBDEP"; + private final String ANULAR_DEPOSITO = "ANUDEP"; + + /** + * Variable que indica si el usuario esta negado para continuar en la + * pantalla + */ + private Boolean isDenied; + + /** + * Variable auxiliar usada para diferenciar cuando se presenta o no el + * mensaje de validacion de fecha expiracion solicitud + */ + private Boolean isOnlyMsj; + + public ValidarDepositoFlowController() throws Exception { + super(TarmSolicitudTramite.class); + } + + @PostConstruct + private void postconstruct() { + init(); + } + + /** + * Incializa el controlador, cuando se esta utilizando una pagina que utliza + * el controlador. + */ + private void init() { + this.beanalias = "VALIDARDEPOSITO"; + accionList = CatalogDetailController.find("ACCION"); + this.record = SolicitudTramiteController.findByCSolicitud(csolicitud); + isOnlyMsj = false; + try { + isDenied = true; + if (record != null) { + solicitud = SolicitudArmasController.find(csolicitud); + if (solicitud != null && solicitud.getCtramite() != null) { + TarmTramite tramite = IngresoDatosTipoTramite.find(solicitud.getCtramite().toString()); + if (tramite != null) { + //Tramite + nombreTramite = CatalogDetailController.findxCodigoCodcatalogo(tramite.getTipotramite(), tramite.getTipotramitecodigo()); + nombreCategoria = CatalogDetailController.findxCodigoCodcatalogo(tramite.getCategoria(), tramite.getCategoriacodigo()); + nombreUsoActividad = CatalogDetailController.findxCodigoCodcatalogo(tramite.getUsoactividad(), tramite.getUsoactividadcodigo()); + } else { + MessageHelper.setMessageError("NO EXISTE UN TIPO DE TR\u00c1MITE ASOCIADO A LA SOLICITUD"); + } + } else { + MessageHelper.setMessageError("NO EXISTE UNA SOLICITUD ASOCIADA AL TR\u00c1MITE"); + } + } else { + MessageHelper.setMessageError("NO EXISTE EL TR\u00c1MITE EN LA BASE DE DATOS"); + } + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + public void cancelar() { + init(); + } + + @Override + public void save() { + try { + if (accionTomada.equalsIgnoreCase(APROBAR)) { + record.setEstadotramite(APROBAR_DEPOSITO); + } else { + record.setEstadotramite(ANULAR_DEPOSITO); + } + super.update(); + DtoSave dtosave = super.getDtoSave(); + HashMap msave = new HashMap(); + Request request = this.callerhelper.getRequest(); + msave.put(this.beanalias, dtosave); // adicionar metadata de mantenimiento para cada tabla. + + request.setSaveTables(msave); + Response resp = this.callerhelper.executeSave(request); + if (resp.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + this.postCommit(resp); + MessageHelper.setMessageInfo(resp); + isDenied = true; + } else { + MessageHelper.setMessageError(resp); + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Throwable e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Override + protected void querydatabase() { + try { + + } catch (Exception e) { + MessageHelper.setMessageError(e); + } + } + + /** + * Retorna la ruta de documento base en donde se almacenará dicho + * archivo + * + * @return + */ + public String getRutaDocumentoSolBase() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(solicitud.getFregistro()); + StringBuilder ruta = new StringBuilder("cm:Solicitudes"); + ruta = ruta.append("/cm:").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + return ruta.toString(); + } + + /** + * Metodo para validar el valor a pagar + */ + public void validarValorDelDeposito() { + if (record.getValorapagar().compareTo(record.getValorverificado()) != 0) { + MessageHelper.setMessageError("EL VALOR VERIFICADO ES DIFERENTE DEL VALOR A PAGAR Y SE ANULAR"); + } + } + + public AlfrescoController getAlfrescoController() { + return alfrescoController; + } + + public void setAlfrescoController(AlfrescoController alfrescoController) { + this.alfrescoController = alfrescoController; + } + + public String getCsolicitud() { + return csolicitud; + } + + public void setCsolicitud(String csolicitud) { + this.csolicitud = csolicitud; + } + + public TgeneCatalogDetail getNombreTramite() { + return nombreTramite; + } + + public void setNombreTramite(TgeneCatalogDetail nombreTramite) { + this.nombreTramite = nombreTramite; + } + + public TgeneCatalogDetail getNombreCategoria() { + return nombreCategoria; + } + + public void setNombreCategoria(TgeneCatalogDetail nombreCategoria) { + this.nombreCategoria = nombreCategoria; + } + + public TgeneCatalogDetail getNombreUsoActividad() { + return nombreUsoActividad; + } + + public void setNombreUsoActividad(TgeneCatalogDetail nombreUsoActividad) { + this.nombreUsoActividad = nombreUsoActividad; + } + + public TarmSolicitud getSolicitud() { + return solicitud; + } + + public void setSolicitud(TarmSolicitud solicitud) { + this.solicitud = solicitud; + } + + public Boolean getIsDenied() { + return isDenied; + } + + public void setIsDenied(Boolean isDenied) { + this.isDenied = isDenied; + } + + public Boolean getIsOnlyMsj() { + return isOnlyMsj; + } + + public void setIsOnlyMsj(Boolean isOnlyMsj) { + this.isOnlyMsj = isOnlyMsj; + } + + public List getAccionList() { + return accionList; + } + + public void setAccionList(List accionList) { + this.accionList = accionList; + } + + public String getAccionTomada() { + return accionTomada; + } + + public void setAccionTomada(String accionTomada) { + this.accionTomada = accionTomada; + } + + public void aceptar() { + if (record.getValorapagar().compareTo(record.getValorverificado()) != 0) { + accionTomada = REPROBAR; + isDenied = true; + } else { + accionTomada = ""; + isDenied = false; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/servlet/.svn/entries b/frontend/src/main/java/com/fp/frontend/servlet/.svn/entries new file mode 100644 index 0000000..2f6aa76 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/servlet/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/servlet +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +CloseSessionMaia.java +file + + + + +2022-07-28T03:39:56.104601Z +75e74198a57951546c9dfa65754d8b48 +2014-11-25T11:50:52.382306Z +3092 +gbenavides +has-props + + + + + + + + + + + + + + + + + + + + +2604 + +HelpServlet.java +file + + + + +2022-07-28T03:39:56.105601Z +bfad079a4f4bd41f81e54338eb44a792 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +5779 + +LogoutServlet.java +file + + + + +2022-07-28T03:39:56.105601Z +5c95d6e2d58ae4a7b6b11a223fd86de9 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1935 + diff --git a/frontend/src/main/java/com/fp/frontend/servlet/.svn/prop-base/CloseSessionMaia.java.svn-base b/frontend/src/main/java/com/fp/frontend/servlet/.svn/prop-base/CloseSessionMaia.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/servlet/.svn/prop-base/CloseSessionMaia.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/servlet/.svn/text-base/CloseSessionMaia.java.svn-base b/frontend/src/main/java/com/fp/frontend/servlet/.svn/text-base/CloseSessionMaia.java.svn-base new file mode 100644 index 0000000..78e4bf8 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/servlet/.svn/text-base/CloseSessionMaia.java.svn-base @@ -0,0 +1,68 @@ +package com.fp.frontend.servlet; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.fp.frontend.controller.security.LoginController; + +/** + * Clase que se encarga de convertir cerrar la session del usuario al monento de cerrar el browser.. + * @author Jorge Vaca. + * @version 2.1 + */ +@WebServlet(name = "closeSessionMaia", urlPatterns = { "/closeSessionMaia" }) +public class CloseSessionMaia extends HttpServlet { + + private static final long serialVersionUID = 1L; + + /** + * Handles the HTTP GET method. + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + this.processRequest(request, response); + } + + /** + * Handles the HTTP POST method. + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + this.processRequest(request, response); + } + + /** + * Processes requests for both HTTP GET and POST methods. + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + try { + LoginController loginController = (LoginController) request.getSession().getAttribute("loginController"); + if (loginController != null) { + loginController.updateusesession(); + request.getSession().invalidate(); + loginController = null; + } +// loginController.logout(); + } catch (Exception e) { + // no hace nada la session esta cerrada. + e.printStackTrace(); + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/servlet/.svn/text-base/HelpServlet.java.svn-base b/frontend/src/main/java/com/fp/frontend/servlet/.svn/text-base/HelpServlet.java.svn-base new file mode 100644 index 0000000..0ad7241 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/servlet/.svn/text-base/HelpServlet.java.svn-base @@ -0,0 +1,158 @@ +package com.fp.frontend.servlet; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.io.StringWriter; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringEscapeUtils; + +import com.fp.frontend.controller.alfresco.AlfrescoController; + + +/** + * Servlet que se encarga de abrir la ayuda + * + * @author WPA + */ +@WebServlet(name = "HelpServlet", urlPatterns = {"/HelpServlet"}) +public class HelpServlet extends HttpServlet { + + private static final long serialVersionUID = 6934418044442466664L; + private boolean shuttingDown = false; + + //Access methods for shuttingDown + protected synchronized void setShuttingDown(boolean flag) { + shuttingDown = flag; + } + + protected synchronized boolean isShuttingDown() { + return shuttingDown; + } + + /** + * Processes requests for both HTTP + * GET and + * POST methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + OutputStream outputStream = response.getOutputStream(); + response.setContentType("text/html"); + try { + response.setHeader("Pragma", "no-cache"); + + String module = request.getParameter("cmodule"); + String transaction = request.getParameter("ctransaction"); +// String version = request.getParameter("version"); + String path = request.getParameter("path"); + String name = "cm:help_"+module+"_"+transaction+".pdf"; + InputStream inputStream = AlfrescoController.getDocument(name, path); + response.setContentType("application/pdf"); + + if (inputStream != null) { + + IOUtils.copy(inputStream, outputStream); + IOUtils.closeQuietly(inputStream); + IOUtils.closeQuietly(outputStream); + + outputStream.flush(); + } else { + PrintWriter printWriter = new PrintWriter(outputStream); + printWriter.println(""); + printWriter.println(""); + printWriter.println("Ayuda"); + printWriter.println(""); + printWriter.println(""); + printWriter.println("

Archivo " + name + ".pdf no disponible en el sistema

"); + printWriter.println(""); + printWriter.println(""); + printWriter.write(""); + printWriter.close(); + } + } catch (Throwable ex) { + String mensaje = getStackTrace(ex); + if (mensaje == null) { + mensaje = ""; + } + PrintWriter printWriter = new PrintWriter(outputStream); + printWriter.println(""); + printWriter.println(""); + printWriter.println("Ayuda"); + printWriter.println(""); + printWriter.println(""); + printWriter.println("

" + ex.getMessage() + "

"); + printWriter.println("
" + StringEscapeUtils.escapeHtml(mensaje) + "
"); + printWriter.println(""); + printWriter.println(""); + printWriter.close(); + } finally { + outputStream.close(); + } + } + + /** + * Handles the HTTP + * POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP + * GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Método que devuelve la excepcion como tal + * + * @param ex + * @return + */ + public String getStackTrace(Throwable ex) { + try { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + if (ex.getCause() != null) { + ex.getCause().printStackTrace(pw); + } else { + ex.printStackTrace(pw); + } + String data = sw.toString(); + pw.close(); + return data; + } catch (Exception e) { + return null; + } + } +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/servlet/.svn/text-base/LogoutServlet.java.svn-base b/frontend/src/main/java/com/fp/frontend/servlet/.svn/text-base/LogoutServlet.java.svn-base new file mode 100644 index 0000000..280da86 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/servlet/.svn/text-base/LogoutServlet.java.svn-base @@ -0,0 +1,59 @@ +package com.fp.frontend.servlet; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import com.fp.frontend.controller.security.LoginController; + +/** + * Servlet implementation class LogoutServlet + */ +@WebServlet(name = "logoutServlet", urlPatterns = { "/logoutServlet" }) +public class LogoutServlet extends HttpServlet { + + private static final long serialVersionUID = 1L; + + /** + * @see HttpServlet#HttpServlet() + */ + public LogoutServlet() { + super(); + // TODO Auto-generated constructor stub + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + this.logout(request, response); + } + + /** + * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + this.logout(request, response); + } + + public void logout(HttpServletRequest request, HttpServletResponse response) { + HttpSession httpSession = request.getSession(); + Object user = request.getParameter("user"); + Object cia = request.getParameter("cia"); + LoginController loginController = (LoginController) httpSession.getAttribute("loginController"); + if (loginController != null) { + loginController.updateusesession(); + httpSession.invalidate(); + loginController = null; + } + + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/servlet/CloseSessionMaia.java b/frontend/src/main/java/com/fp/frontend/servlet/CloseSessionMaia.java new file mode 100644 index 0000000..d304090 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/servlet/CloseSessionMaia.java @@ -0,0 +1,74 @@ +package com.fp.frontend.servlet; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.fp.frontend.controller.security.LoginController; + +/** + * Clase que se encarga de convertir cerrar la session del usuario al monento de + * cerrar el browser.. + * + * @author Jorge Vaca. + * @version 2.1 + */ +@WebServlet(name = "closeSessionMaia", urlPatterns = {"/closeSessionMaia"}) +public class CloseSessionMaia extends HttpServlet { + + private static final long serialVersionUID = 1L; + + /** + * Handles the HTTP GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + this.processRequest(request, response); + } + + /** + * Handles the HTTP POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + this.processRequest(request, response); + } + + /** + * Processes requests for both HTTP GET and POST + * methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + try { + LoginController loginController = (LoginController) request.getSession().getAttribute("loginController"); + if (loginController != null) { + loginController.updateusesession(); + request.getSession().invalidate(); + loginController = null; + } +// loginController.logout(); + } catch (Exception e) { + // no hace nada la session esta cerrada. + e.printStackTrace(); + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/servlet/HelpServlet.java b/frontend/src/main/java/com/fp/frontend/servlet/HelpServlet.java new file mode 100644 index 0000000..0f9aaa5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/servlet/HelpServlet.java @@ -0,0 +1,154 @@ +package com.fp.frontend.servlet; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.io.StringWriter; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringEscapeUtils; + +import com.fp.frontend.controller.alfresco.AlfrescoController; + +/** + * Servlet que se encarga de abrir la ayuda + * + * @author WPA + */ +@WebServlet(name = "HelpServlet", urlPatterns = {"/HelpServlet"}) +public class HelpServlet extends HttpServlet { + + private static final long serialVersionUID = 6934418044442466664L; + private boolean shuttingDown = false; + + //Access methods for shuttingDown + protected synchronized void setShuttingDown(boolean flag) { + shuttingDown = flag; + } + + protected synchronized boolean isShuttingDown() { + return shuttingDown; + } + + /** + * Processes requests for both HTTP GET and POST + * methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + OutputStream outputStream = response.getOutputStream(); + response.setContentType("text/html"); + try { + response.setHeader("Pragma", "no-cache"); + + String module = request.getParameter("cmodule"); + String transaction = request.getParameter("ctransaction"); +// String version = request.getParameter("version"); + String path = request.getParameter("path"); + String name = "cm:help_" + module + "_" + transaction + ".pdf"; + InputStream inputStream = AlfrescoController.getDocument(name, path); + response.setContentType("application/pdf"); + + if (inputStream != null) { + + IOUtils.copy(inputStream, outputStream); + IOUtils.closeQuietly(inputStream); + IOUtils.closeQuietly(outputStream); + + outputStream.flush(); + } else { + PrintWriter printWriter = new PrintWriter(outputStream); + printWriter.println(""); + printWriter.println(""); + printWriter.println("Ayuda"); + printWriter.println(""); + printWriter.println(""); + printWriter.println("

Archivo " + name + ".pdf no disponible en el sistema

"); + printWriter.println(""); + printWriter.println(""); + printWriter.write(""); + printWriter.close(); + } + } catch (Throwable ex) { + String mensaje = getStackTrace(ex); + if (mensaje == null) { + mensaje = ""; + } + PrintWriter printWriter = new PrintWriter(outputStream); + printWriter.println(""); + printWriter.println(""); + printWriter.println("Ayuda"); + printWriter.println(""); + printWriter.println(""); + printWriter.println("

" + ex.getMessage() + "

"); + printWriter.println("
" + StringEscapeUtils.escapeHtml(mensaje) + "
"); + printWriter.println(""); + printWriter.println(""); + printWriter.close(); + } finally { + outputStream.close(); + } + } + + /** + * Handles the HTTP POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Método que devuelve la excepcion como tal + * + * @param ex + * @return + */ + public String getStackTrace(Throwable ex) { + try { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + if (ex.getCause() != null) { + ex.getCause().printStackTrace(pw); + } else { + ex.printStackTrace(pw); + } + String data = sw.toString(); + pw.close(); + return data; + } catch (Exception e) { + return null; + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/servlet/LogoutServlet.java b/frontend/src/main/java/com/fp/frontend/servlet/LogoutServlet.java new file mode 100644 index 0000000..fc718db --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/servlet/LogoutServlet.java @@ -0,0 +1,61 @@ +package com.fp.frontend.servlet; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import com.fp.frontend.controller.security.LoginController; + +/** + * Servlet implementation class LogoutServlet + */ +@WebServlet(name = "logoutServlet", urlPatterns = {"/logoutServlet"}) +public class LogoutServlet extends HttpServlet { + + private static final long serialVersionUID = 1L; + + /** + * @see HttpServlet#HttpServlet() + */ + public LogoutServlet() { + super(); + // TODO Auto-generated constructor stub + } + + /** + * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse + * response) + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + this.logout(request, response); + } + + /** + * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse + * response) + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + this.logout(request, response); + } + + public void logout(HttpServletRequest request, HttpServletResponse response) { + HttpSession httpSession = request.getSession(); + Object user = request.getParameter("user"); + Object cia = request.getParameter("cia"); + LoginController loginController = (LoginController) httpSession.getAttribute("loginController"); + if (loginController != null) { + loginController.updateusesession(); + httpSession.invalidate(); + loginController = null; + } + + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/utility/.svn/entries b/frontend/src/main/java/com/fp/frontend/utility/.svn/entries new file mode 100644 index 0000000..d1fa649 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/utility/.svn/entries @@ -0,0 +1,368 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/utility +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ConvertNumberToText.java +file + + + + +2022-07-28T03:39:56.086601Z +7463beff193d5e50d70ead5cd2a5765f +2022-01-20T04:13:16.137936Z +4661 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +6791 + +EnumParametros.java +file + + + + +2022-07-28T03:39:56.087601Z +9004a05a1a9d9c8b9c32d4171a2f581d +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +937 + +ValidateIdentification.java +file + + + + +2022-07-28T03:39:56.087601Z +f305cc437fca264db540cc807f2be5d3 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +4085 + +MsgGeneral.java +file + + + + +2022-07-28T03:39:56.087601Z +d71888d6f8cdb8cf56918f5814f78f1b +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1039 + +LifeCicleListener.java +file + + + + +2022-07-28T03:39:56.087601Z +1adc06d837e90c56bc20db3066bcd8ed +2014-09-11T11:14:55.288252Z +686 +jvaca + + + + + + + + + + + + + + + + + + + + + +2266 + +Utilidades.java +file + + + + +2022-07-28T03:39:56.087601Z +660ebcc5022afddcb9489c3457d758f1 +2015-10-19T06:22:25.984481Z +4297 +fpazmino + + + + + + + + + + + + + + + + + + + + + +9339 + +TextAreaValidationRequired.java +file + + + + +2022-07-28T03:39:56.088601Z +d5eb9b413d47e2514c8cab1876646812 +2014-09-16T05:27:08.612141Z +820 +dcruz + + + + + + + + + + + + + + + + + + + + + +4151 + +Content.java +file + + + + +2022-07-28T03:39:56.088601Z +9744b987637961ce03a609a9c16b98dd +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1320 + +CommonTransformer.java +file + + + + +2022-07-28T03:39:56.088601Z +ee79f9500cbdd663a470015d5436c392 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +920 + +MsgControlArmas.java +file + + + + +2022-07-28T03:39:56.089601Z +176453b605c8b55b544ab545fc26aa35 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1003 + diff --git a/frontend/src/main/java/com/fp/frontend/utility/.svn/prop-base/CommonTransformer.java.svn-base b/frontend/src/main/java/com/fp/frontend/utility/.svn/prop-base/CommonTransformer.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/utility/.svn/prop-base/CommonTransformer.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/utility/.svn/prop-base/MsgControlArmas.java.svn-base b/frontend/src/main/java/com/fp/frontend/utility/.svn/prop-base/MsgControlArmas.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/utility/.svn/prop-base/MsgControlArmas.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/CommonTransformer.java.svn-base b/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/CommonTransformer.java.svn-base new file mode 100644 index 0000000..b58e095 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/CommonTransformer.java.svn-base @@ -0,0 +1,38 @@ +package com.fp.frontend.utility; + +import org.apache.commons.collections.Transformer; + +import com.fp.common.helper.BeanManager; + +/** + * Este transformador actuara como un accesor sobre los campos a los que tiene se indique en su constructor + * Servira para saber cuales son los criterios de busqueda en las colecciones + * @author dcruz + */ +public class CommonTransformer implements Transformer{ + + private String fieldName; + + public CommonTransformer(String fieldName){ + this.fieldName = fieldName; + } + + public Object transform(Object input) { + Object value = null; + try { + value = BeanManager.getBeanAttributeValue(input, fieldName); + } catch (Exception e) { + value = null; + } + return value; + } + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/Content.java.svn-base b/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/Content.java.svn-base new file mode 100644 index 0000000..4155e53 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/Content.java.svn-base @@ -0,0 +1,80 @@ +package com.fp.frontend.utility; + +/** + * Clase para utilitaria para el tipo de contenido + * + * @author BPTWPA + * + */ +public class Content { + + /** + * Atributo para el nombre + */ + private String nombre; + + /** + * Atributo para el content type + */ + private String contentType; + + /** + * atributo para la extension + */ + private String extension; + + public Content(String nombre, String contenType, String extension){ + this.nombre = nombre; + this.contentType = contenType; + this.extension = extension; + } + + /** + * Entrega el nombre + * @return nombre + */ + public String getNombre() { + return nombre; + } + + /** + * FIja el nombre + * @param nombre + */ + public void setNombre(String nombre) { + this.nombre = nombre; + } + + /** + * Entrega el contentType + * @return contentType + */ + public String getContentType() { + return contentType; + } + + /** + * Fija el contentType + * @param contentType + */ + public void setContentType(String contentType) { + this.contentType = contentType; + } + + /** + * Entrega el extension + * @return extension + */ + public String getExtension() { + return extension; + } + + /** + * Fija el extension + * @param extension + */ + public void setExtension(String extension) { + this.extension = extension; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/ConvertNumberToText.java.svn-base b/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/ConvertNumberToText.java.svn-base new file mode 100644 index 0000000..5a7f79f --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/ConvertNumberToText.java.svn-base @@ -0,0 +1,178 @@ +package com.fp.frontend.utility; +import java.math.RoundingMode; +import java.text.DecimalFormat; +import java.util.regex.Pattern; +/** + * @web http://jc-mouse.blogspot.com/ + * @author Mouse + */ +public abstract class ConvertNumberToText { + + private static final String[] UNIDADES = { "", "UN ", "DOS ", "TRES ", + "CUATRO ", "CINCO ", "SEIS ", "SIETE ", "OCHO ", "NUEVE ", "DIEZ ", + "ONCE ", "DOCE ", "TRECE ", "CATORCE ", "QUINCE ", "DIECISEIS", + "DIECISIETE", "DIECIOCHO", "DIECINUEVE", "VEINTE" }; + + private static final String[] DECENAS = { "VENTI", "TREINTA ", "CUARENTA ", + "CINCUENTA ", "SESENTA ", "SETENTA ", "OCHENTA ", "NOVENTA ", + "CIEN " }; + + private static final String[] CENTENAS = { "CIENTO ", "DOSCIENTOS ", + "TRESCIENTOS ", "CUATROCIENTOS ", "QUINIENTOS ", "SEISCIENTOS ", + "SETECIENTOS ", "OCHOCIENTOS ", "NOVECIENTOS " }; + + /** + * Convierte a letras un numero de la forma $123,456.32 + * + * @param number + * Numero en representacion texto + * @throws NumberFormatException + * Si valor del numero no es valido (fuera de rango o ) + * @return Numero en letras + */ + public static String convertNumberToLetter(String number) + throws NumberFormatException { + return convertNumberToLetter(Double.parseDouble(number)); + } + + /** + * Convierte un numero en representacion numerica a uno en representacion de + * texto. El numero es valido si esta entre 0 y 999'999.999 + * + * @param number + * Numero a convertir + * @return Numero convertido a texto + * @throws NumberFormatException + * Si el numero esta fuera del rango + */ + public static String convertNumberToLetter(double doubleNumber) + throws NumberFormatException { + + StringBuilder converted = new StringBuilder(); + + String patternThreeDecimalPoints = "#,###"; + + DecimalFormat format = new DecimalFormat(patternThreeDecimalPoints); + format.setRoundingMode(RoundingMode.DOWN); + + // formateamos el numero, para ajustarlo a el formato de tres puntos + // decimales + String formatedDouble = format.format(doubleNumber); + doubleNumber = Double.parseDouble(formatedDouble); + + // Validamos que sea un numero legal + if (doubleNumber > 999999999) + throw new NumberFormatException( + "El numero es mayor de 999'999.999, " + + "no es posible convertirlo"); + + if (doubleNumber < 0) + throw new NumberFormatException("El numero debe ser positivo"); + + String splitNumber[] = String.valueOf(doubleNumber).replace('.', '#') + .split("#"); + + // Descompone el trio de millones + int millon = Integer.parseInt(String.valueOf(getDigitAt(splitNumber[0], + 8)) + + String.valueOf(getDigitAt(splitNumber[0], 7)) + + String.valueOf(getDigitAt(splitNumber[0], 6))); + if (millon == 1) + converted.append("UN MILLON "); + else if (millon > 1) + converted.append(convertNumber(String.valueOf(millon)) + + "MILLONES "); + + // Descompone el trio de miles + int miles = Integer.parseInt(String.valueOf(getDigitAt(splitNumber[0], + 5)) + + String.valueOf(getDigitAt(splitNumber[0], 4)) + + String.valueOf(getDigitAt(splitNumber[0], 3))); + if (miles == 1) + converted.append("MIL "); + else if (miles > 1) + converted.append(convertNumber(String.valueOf(miles)) + "MIL "); + + // Descompone el ultimo trio de unidades + int cientos = Integer.parseInt(String.valueOf(getDigitAt( + splitNumber[0], 2)) + + String.valueOf(getDigitAt(splitNumber[0], 1)) + + String.valueOf(getDigitAt(splitNumber[0], 0))); + if (cientos == 1) + converted.append("UN"); + + if (millon + miles + cientos == 0) + converted.append("CERO"); + if (cientos > 1) + converted.append(convertNumber(String.valueOf(cientos))); + + converted.append(MsgControlArmas.getProperty("lbl_dolares")); + + // Descompone los centavos + int centavos = Integer.parseInt(String.valueOf(getDigitAt( + splitNumber[1], 2)) + + String.valueOf(getDigitAt(splitNumber[1], 1)) + + String.valueOf(getDigitAt(splitNumber[1], 0))); + if (centavos == 1) + converted.append(" CON UN CENTAVO"); + else if (centavos > 1) + converted.append(" CON " + convertNumber(String.valueOf(centavos)) + + "CENTAVOS"); + + return converted.toString(); + } + + /** + * Convierte los trios de numeros que componen las unidades, las decenas y + * las centenas del numero. + * + * @param number + * Numero a convetir en digitos + * @return Numero convertido en letras + */ + private static String convertNumber(String number) { + + if (number.length() > 3) + throw new NumberFormatException( + "La longitud maxima debe ser 3 digitos"); + + // Caso especial con el 100 + if (number.equals("100")) { + return "CIEN"; + } + + StringBuilder output = new StringBuilder(); + if (getDigitAt(number, 2) != 0) + output.append(CENTENAS[getDigitAt(number, 2) - 1]); + + int k = Integer.parseInt(String.valueOf(getDigitAt(number, 1)) + + String.valueOf(getDigitAt(number, 0))); + + if (k <= 20) + output.append(UNIDADES[k]); + else if (k > 30 && getDigitAt(number, 0) != 0) + output.append(DECENAS[getDigitAt(number, 1) - 2] + "Y " + + UNIDADES[getDigitAt(number, 0)]); + else + output.append(DECENAS[getDigitAt(number, 1) - 2] + + UNIDADES[getDigitAt(number, 0)]); + + return output.toString(); + } + + /** + * Retorna el digito numerico en la posicion indicada de derecha a izquierda + * + * @param origin + * Cadena en la cual se busca el digito + * @param position + * Posicion de derecha a izquierda a retornar + * @return Digito ubicado en la posicion indicada + */ + private static int getDigitAt(String origin, int position) { + if (origin.length() > position && position >= 0) + return origin.charAt(origin.length() - position - 1) - 48; + return 0; + } + +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/EnumParametros.java.svn-base b/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/EnumParametros.java.svn-base new file mode 100644 index 0000000..6eb0e14 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/EnumParametros.java.svn-base @@ -0,0 +1,42 @@ +package com.fp.frontend.utility; + +public enum EnumParametros { + /** + * Código del parámetro para los dias acumulados + */ + VIA_01("VIA_01"), + + /** + * Código del parámetro para el xPath de una carpeta Alfresco + */ + PATH_ALFRESCO("PATH_ALFRESCO"), + /** + * Código del parámetro para el xPath de la carpeta de ayuda Alfresco + */ + PATH_ALFRESCO_AYUDA("PATH_ALFRESCO_AYUDA"), + /** + * Codigo parametro almacen certificados + */ + PATH_CERTIFICADO_BCE("PATH_CERTIFICADO_BCE"); + ; + + /** + * Atributo para obtener el valor + */ + private String codigo; + + /** + * @param texto + * @param codigo + */ + private EnumParametros(String codigo) { + this.codigo = codigo; + } + + /** + * @return the texto + */ + public String getCodigo() { + return codigo; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/LifeCicleListener.java.svn-base b/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/LifeCicleListener.java.svn-base new file mode 100644 index 0000000..6c770d1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/LifeCicleListener.java.svn-base @@ -0,0 +1,80 @@ +/** + * + */ +package com.fp.frontend.utility; + +import java.util.ResourceBundle; + +import javax.faces.component.UIComponent; +import javax.faces.event.PhaseEvent; +import javax.faces.event.PhaseId; +import javax.faces.event.PhaseListener; + +import org.primefaces.component.datatable.DataTable; + +/** + * @author Gbensvides + * + */ +public class LifeCicleListener implements PhaseListener { + + /** + * + */ + private static final long serialVersionUID = 1L; + private static ResourceBundle resource_bundleValidacion = ResourceBundle + .getBundle("validation_es"); + + /* (non-Javadoc) + * @see javax.faces.event.PhaseListener#afterPhase(javax.faces.event.PhaseEvent) + */ + @Override + public void afterPhase(PhaseEvent arg0) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see javax.faces.event.PhaseListener#beforePhase(javax.faces.event.PhaseEvent) + */ + @Override + public void beforePhase(PhaseEvent arg0) { + // TODO Auto-generated method stub +// //System.out.println(arg0.getPhaseId().toString()); + if(arg0.getPhaseId().equals(PhaseId.RENDER_RESPONSE)) + { + processViewTree(arg0.getFacesContext().getViewRoot()); + } + } + + /* (non-Javadoc) + * @see javax.faces.event.PhaseListener#getPhaseId() + */ + @Override + public PhaseId getPhaseId() { + // TODO Auto-generated method stub + return PhaseId.ANY_PHASE; + } + + private void processViewTree(UIComponent component) { + + // //System.out.println(component.getClientId() + " " + component.getClass() ); + for (UIComponent child: component.getChildren()) { + + ////System.out.println("+ " + child.getId() + " ["+child.getClass()+"]"); + if(child instanceof DataTable) + { + DataTable table = (DataTable)child; + Object mensajeEmpty = table.getAttributes().get("emptyMessage"); + if(mensajeEmpty!=null && mensajeEmpty.equals("No records found.")){ + table.getAttributes().put("emptyMessage", resource_bundleValidacion.getString("org.primefaces.component.datatable.emptyMesssage")); + } + } + + // Process next node + processViewTree(child); + } + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/MsgControlArmas.java.svn-base b/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/MsgControlArmas.java.svn-base new file mode 100644 index 0000000..5b941aa --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/MsgControlArmas.java.svn-base @@ -0,0 +1,41 @@ +package com.fp.frontend.utility; + +import java.text.MessageFormat; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class MsgControlArmas { + private static final String BUNDLE_NAME = "controlarmas_es"; + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + private MsgControlArmas() { + } + + public static String getProperty(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return "Archivo:"+BUNDLE_NAME+" no encontrado"; + } catch (Throwable e) { + return null; + } + } + + public static String getProperty(String pKey, Object... pParameters) { + try { + String msg = null; + try{ + msg = RESOURCE_BUNDLE.getString(pKey); + }catch(Exception e){ + + } + if(msg == null){ + msg = pKey; + } + return MessageFormat.format(msg, pParameters); + } catch (Throwable e) { + return null; + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/MsgGeneral.java.svn-base b/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/MsgGeneral.java.svn-base new file mode 100644 index 0000000..f39a1cf --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/MsgGeneral.java.svn-base @@ -0,0 +1,48 @@ +/** + * + */ +package com.fp.frontend.utility; + +import java.text.MessageFormat; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * @author amerchan + * + */ +public class MsgGeneral { + private static final String BUNDLE_NAME = "general_es"; + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + private MsgGeneral() { + } + + public static String getProperty(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return "Archivo:"+BUNDLE_NAME+" no encontrado"; + } catch (Throwable e) { + return null; + } + } + + public static String getProperty(String pKey, Object... pParameters) { + try { + String msg = null; + try{ + msg = RESOURCE_BUNDLE.getString(pKey); + }catch(Exception e){ + + } + if(msg == null){ + msg = pKey; + } + return MessageFormat.format(msg, pParameters); + } catch (Throwable e) { + return null; + } + } +} \ No newline at end of file diff --git a/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/TextAreaValidationRequired.java.svn-base b/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/TextAreaValidationRequired.java.svn-base new file mode 100644 index 0000000..e472e45 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/TextAreaValidationRequired.java.svn-base @@ -0,0 +1,125 @@ +package com.fp.frontend.utility; + +import java.text.MessageFormat; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +import javax.faces.application.FacesMessage; +import javax.faces.component.UIInput; +import javax.faces.component.html.HtmlInputTextarea; +import javax.faces.context.FacesContext; +import javax.faces.event.AbortProcessingException; +import javax.faces.event.SystemEvent; +import javax.faces.event.SystemEventListener; + +import org.primefaces.context.RequestContext; + +//@ListenerFor(sourceClass = HtmlInputTextarea.class, systemEventClass = PostValidateEvent.class) +public class TextAreaValidationRequired implements SystemEventListener { + + private static ResourceBundle resource_bundle = ResourceBundle + .getBundle("controlarmas_es"); + + private static ResourceBundle resource_bundleValidacion = ResourceBundle + .getBundle("validation_es"); + + + + @Override + public boolean isListenerForSource(Object arg0) { + // TODO Auto-generated method stub + + if (arg0 instanceof HtmlInputTextarea) { + UIInput source = (UIInput) arg0; + if (source.isValid()) { + HtmlInputTextarea auxTextArea = ((HtmlInputTextarea) arg0); + if (auxTextArea.getAttributes().get("required").toString() + .equalsIgnoreCase("true")) + return true; + } + } + return false; + } + + @Override + public void processEvent(SystemEvent event) throws AbortProcessingException { + + // TODO Auto-generated method stub + if (event.getSource() instanceof HtmlInputTextarea) { + UIInput source = (UIInput) event.getSource(); + Object object = source.getAttributes().get("maxlength"); + FacesMessage message = new FacesMessage(); + message.setSeverity(FacesMessage.SEVERITY_ERROR); + if (object != null + && object.toString() != "" + && Integer.parseInt(object.toString()) < source.getValue() + .toString().length()) { + source.setValid(false); + RequestContext.getCurrentInstance().addCallbackParam("validationFailed", true); + String mensajeValidacion = getMessagesResources(resource_bundle, + "msg_tamanioMaximoExcedido", + new Object[] { source.getRequiredMessage()== null?"":source.getRequiredMessage(), + object.toString() }); + message.setSummary(mensajeValidacion); + message.setDetail(mensajeValidacion); + message.setSeverity(FacesMessage.SEVERITY_ERROR); + FacesContext.getCurrentInstance().addMessage( + source.getClientId(), message); + + return; + } + if (source.getValue() != null + && source.getValue().toString().trim().equals("")) { + + source.setValid(false); + if (FacesContext.getCurrentInstance().getPartialViewContext() + .isAjaxRequest()) { + RequestContext.getCurrentInstance().addCallbackParam("validationFailed", true); + String mensajeValidacion =null; + mensajeValidacion = source.getRequiredMessage(); + if(mensajeValidacion==null|| mensajeValidacion.equals("")){ + mensajeValidacion = getMessagesResources(resource_bundleValidacion, + "javax.faces.component.UIInput.REQUIRED", + new Object[] { source.getRequiredMessage(), + object.toString() }); + message.setSummary(mensajeValidacion); + + String mensajeValidacionDetalle = getMessagesResources(resource_bundleValidacion, + "javax.faces.component.UIInput.REQUIRED_detail", + new Object[] { source.getRequiredMessage(), + object.toString() }); + message.setDetail(mensajeValidacionDetalle); + } + + + message.setSummary(mensajeValidacion); + + message.setSeverity(FacesMessage.SEVERITY_ERROR); + FacesContext.getCurrentInstance().addMessage( + source.getClientId(), message); + return; + + } + + } + + } + + } + + private String getMessagesResources(ResourceBundle resourceBundle, String key, Object[] argumentos) { + String resourceString = ""; + try { + + resourceString = resourceBundle.getString(key); + + } catch (MissingResourceException e) { + return key; + } + MessageFormat format = new MessageFormat(resourceString); + + return format.format(argumentos); + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/Utilidades.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/Utilidades.java.netbeans-base new file mode 100644 index 0000000..f88a0ed --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/utility/.svn/text-base/Utilidades.java.netbeans-base @@ -0,0 +1,238 @@ +package com.fp.frontend.utility; + +import java.sql.Timestamp; +import java.text.DecimalFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.apache.commons.lang.StringUtils; +import org.apache.poi.ss.usermodel.Cell; + +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@ManagedBean +@ViewScoped +public class Utilidades { + + + + /** + * Metodo para formatear los decimales que se encuentran dentro de un texto + * @param texto + * @return + */ + public static String formatearDecimalesEnTexto(String texto, String formato){//.177 + //NOTA:Se decide cambiar y no formatear los calibres como definicion de ultimo momento + +/* DecimalFormat fmt = new DecimalFormat(formato); + String patron ="(\\w+)?([0-9]+)?[\\.\\,]([0-9]+)(\\w+)?"; + Pattern p = Pattern.compile(patron); + Matcher m = p.matcher(texto); + String textoReemplazo=texto; + + while(m.find()) { + textoReemplazo = m.replaceFirst( (m.group(1)==null?"": m.group(1)) + fmt.format(Double.valueOf(m.group(2)!=null?m.group(2):"0" + "." +m.group(3))) + (m.group(4)!=null?m.group(4):"")); + } + + return textoReemplazo.replace(",", "."); */ + return texto; + } + + + public static Timestamp getFechaExpiracion() { + Timestamp fechaExpiracion = null; + Calendar calendar = Calendar.getInstance(); + calendar.set(Calendar.YEAR, 2999); + calendar.set(Calendar.MONTH, 11); + calendar.set(Calendar.DATE, 31); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + fechaExpiracion = new Timestamp(calendar.getTimeInMillis()); + return fechaExpiracion; + } + + /** + * Metodo para armar el formato de una fecha sin hora + * @param fechaCldr fecha en formato calendar + * @return + */ + public static String armarFormatoFechaSinHora(Calendar fechaCldr){ + return (new SimpleDateFormat("dd-MM-yyyy")).format(fechaCldr.getTime()); + + } + + /** + * Metodo para armar el formato de una fecha sin hora + * @param fechaCldr fecha en formato Date + * @return + */ + public static String armarFormatoFechaSinHora(Date fechaCldr){ + return (new SimpleDateFormat("dd-MM-yyyy")).format(fechaCldr); + + } + + + + /** + * Metodo para transformar el formato de una fecha con hora + * @param fechaCldr + * @return + */ + public static String armarFormatoFechaConHora(Calendar fechaCldr){ + return (new SimpleDateFormat("dd-MM-yyyy HH:mm:ss")).format(fechaCldr.getTime()); + } + + /* Reemplazo un string los caracteres en blanco y reemplazo caracteres especiales + * @param toConvert + * @return la cadena convertida + */ + public static String obtieneNombreLimpio(String toConvert){ + return StringUtils.replaceEach(StringUtils.deleteWhitespace(toConvert), + new String[]{"\u00e1","\u00e9","\u00ed","\u00f3","\u00fa","\u00c1","\u00c9","\u00cd","\u00d3","\u00da","\u00F1","\u00d1"}, + new String[]{"a","e","i","o","u","A","E","I","O","U","n","N"}); + } + + /** + * recorta el nombre + * @param nombre + * @return + */ + public static String recorteNombre(String nombre){ + String fielname=nombre; + if(fielname.length()>30){ + fielname=fielname.substring(0,30)+extencionArchivo(nombre); + } + return fielname; + } + + /** + * obtiene la extencion del archivo + * @param nombre + * @return + */ + private static String extencionArchivo(String nombre){ + int pos=nombre.lastIndexOf('.'); + nombre=nombre.substring(pos); + return nombre; + } + + /** + * Método que revisa si una cadena tiene caracteres especiales + * @param nombre + * @return + * @throws Exception + */ + public static String caractersEspeciales(String nombre) throws Exception{ + List caracteresEsp=CatalogDetailController.find("CARACTERESPECIAL"); + for(TgeneCatalogDetail caract:caracteresEsp){ + if(nombre.contains(caract.getPk().getCatalog())){ + throw new Exception(MsgControlArmas.getProperty("msg_error_elnombredelarchivonocaracteresespeciales")+": "+caract.getPk().getCatalog()); + } + } + String numero="1234567890"; + if(numero.contains(nombre.substring(0, 1))){ + throw new Exception(MsgControlArmas.getProperty("msg_error_elnombredelarchivonodebeiniciarconnum")); + } + if(nombre!=null && nombre.trim().contains(" ")){ + throw new Exception(MsgControlArmas.getProperty("msg_error_elnombredelarchivonodebecontenerespaciosenblanco")); + } + if(nombre.length()<9){ + nombre="DOCUMENTO-"+nombre; +// throw new Exception(MsgControlArmas.getProperty("msg_error_elnombredelarchivonodebesermenoracincoletras")); + } + return nombre; + } + + /** + * Funcion que reemplaza acentos y caracteres especiales de una cadena de texto + * @param input + * @return cadena de texto limpia de acentos y caracteres especiales. + */ + public static String reemplazaAcentosCaractEspeciales(String input) { + // Cadena de caracteres original a sustituir. + String original = "u"; + // Cadena de caracteres ASCII que reemplazarn los originales. + String ascii = "aaaeeeiiiooouuunAAAEEEIIIOOOUUUNcC"; + String output = input; + for (int i=0; i30){ + fielname=fielname.substring(0,30)+extencionArchivo(nombre); + } + return fielname; + } + + /** + * obtiene la extencion del archivo + * @param nombre + * @return + */ + private static String extencionArchivo(String nombre){ + int pos=nombre.lastIndexOf('.'); + nombre=nombre.substring(pos); + return nombre; + } + + /** + * Método que revisa si una cadena tiene caracteres especiales + * @param nombre + * @return + * @throws Exception + */ + public static String caractersEspeciales(String nombre) throws Exception{ + List caracteresEsp=CatalogDetailController.find("CARACTERESPECIAL"); + for(TgeneCatalogDetail caract:caracteresEsp){ + if(nombre.contains(caract.getPk().getCatalog())){ + throw new Exception(MsgControlArmas.getProperty("msg_error_elnombredelarchivonocaracteresespeciales")+": "+caract.getPk().getCatalog()); + } + } + String numero="1234567890"; + if(numero.contains(nombre.substring(0, 1))){ + throw new Exception(MsgControlArmas.getProperty("msg_error_elnombredelarchivonodebeiniciarconnum")); + } + if(nombre!=null && nombre.trim().contains(" ")){ + throw new Exception(MsgControlArmas.getProperty("msg_error_elnombredelarchivonodebecontenerespaciosenblanco")); + } + if(nombre.length()<9){ + nombre="DOCUMENTO-"+nombre; +// throw new Exception(MsgControlArmas.getProperty("msg_error_elnombredelarchivonodebesermenoracincoletras")); + } + return nombre; + } + + /** + * Funcion que reemplaza acentos y caracteres especiales de una cadena de texto + * @param input + * @return cadena de texto limpia de acentos y caracteres especiales. + */ + public static String reemplazaAcentosCaractEspeciales(String input) { + // Cadena de caracteres original a sustituir. + String original = "u"; + // Cadena de caracteres ASCII que reemplazarn los originales. + String ascii = "aaaeeeiiiooouuunAAAEEEIIIOOOUUUNcC"; + String output = input; + for (int i=0; i 9){ + temp = temp.subtract(new BigDecimal("9")); + } + verif = verif.add(temp); + } + if (verif.doubleValue() % 10 == 0){ + if (Integer.parseInt(id.substring(9, 10)) == 0){ + result = true; + } else{ + result = false; + } + } else if ((10 - (verif.doubleValue() % 10)) == Integer.parseInt(id.substring(9, 10))){ + result = true; + } else { + result = false; + } + } + return result; + } + + /** + * Método para validar el Ruc + * + * @param ruc Número del Ruc + * @return Retorna V/F según la validez del Ruc + */ + public static boolean ruc(String ruc) { + + boolean result = true; + + int[] modulo11 = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + + BigDecimal verif = new BigDecimal(0); + if (ruc.length() < 13) + result = false; + else if (Integer.parseInt(ruc.substring(0, 2)) < 1 + || Integer.parseInt(ruc.substring(0, 2)) > 25) { + result = false; + } else { + if (Integer.parseInt(ruc.substring(2, 3)) < 0 + || (Integer.parseInt(ruc.substring(2, 3)) > 6 && Integer + .parseInt(ruc.substring(2, 3)) < 9)) { + result = false; + } else { + if (Integer.parseInt(ruc.substring(2, 3)) == 9) { // sociedad privada o extranjeros + if (!ruc.substring(10, 13).equals("001")) + result = false; + else { + modulo11[0] = 4; + modulo11[1] = 3; + modulo11[2] = 2; + modulo11[3] = 7; + modulo11[4] = 6; + modulo11[5] = 5; + modulo11[6] = 4; + modulo11[7] = 3; + modulo11[8] = 2; + for (int i = 0; i < 9; i++) { + verif = verif.add(new BigDecimal(ruc.substring(i, + (i + 1))).multiply(new BigDecimal( + modulo11[i]))); + } + if (verif.doubleValue() % 11 == 0) + if (Integer.parseInt(ruc.substring(9, 10)) == 0) + result = true; + else + result = false; + else if ((11 - (verif.doubleValue() % 11)) == Integer + .parseInt(ruc.substring(9, 10))) + result = true; + else + result = false; + } + } else if (Integer.parseInt(ruc.substring(2, 3)) == 6) { // sociedad publicas + + if (!ruc.substring(10, 13).equals("001")) + result = false; + else { + modulo11[0] = 3; + modulo11[1] = 2; + modulo11[2] = 7; + modulo11[3] = 6; + modulo11[4] = 5; + modulo11[5] = 4; + modulo11[6] = 3; + modulo11[7] = 2; + for (int i = 0; i < 8; i++) { + verif = verif.add(new BigDecimal(ruc.substring(i, + (i + 1))).multiply(new BigDecimal( + modulo11[i]))); + } + if (verif.doubleValue() % 11 == 0) + if (Integer.parseInt(ruc.substring(8, 9)) == 0) + result = true; + else + result = false; + else if ((11 - (verif.doubleValue() % 11)) == Integer + .parseInt(ruc.substring(8, 9))) + result = true; + else + result = false; + } + } else if (Integer.parseInt(ruc.substring(2, 3)) < 6 + && Integer.parseInt(ruc.substring(2, 3)) >= 0) { // personas naturales + + if (!ruc.substring(10, 13).equals("001")) + result = false; + else { + result = cedula(ruc.substring(0, 10)); + } + } + } + } + return result; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/utility/CommonTransformer.java b/frontend/src/main/java/com/fp/frontend/utility/CommonTransformer.java new file mode 100644 index 0000000..eec2dd8 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/utility/CommonTransformer.java @@ -0,0 +1,40 @@ +package com.fp.frontend.utility; + +import org.apache.commons.collections.Transformer; + +import com.fp.common.helper.BeanManager; + +/** + * Este transformador actuara como un accesor sobre los campos a los que tiene + * se indique en su constructor Servira para saber cuales son los criterios de + * busqueda en las colecciones + * + * @author dcruz + */ +public class CommonTransformer implements Transformer { + + private String fieldName; + + public CommonTransformer(String fieldName) { + this.fieldName = fieldName; + } + + public Object transform(Object input) { + Object value = null; + try { + value = BeanManager.getBeanAttributeValue(input, fieldName); + } catch (Exception e) { + value = null; + } + return value; + } + + public String getFieldName() { + return fieldName; + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/utility/Content.java b/frontend/src/main/java/com/fp/frontend/utility/Content.java new file mode 100644 index 0000000..71f0227 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/utility/Content.java @@ -0,0 +1,86 @@ +package com.fp.frontend.utility; + +/** + * Clase para utilitaria para el tipo de contenido + * + * @author BPTWPA + * + */ +public class Content { + + /** + * Atributo para el nombre + */ + private String nombre; + + /** + * Atributo para el content type + */ + private String contentType; + + /** + * atributo para la extension + */ + private String extension; + + public Content(String nombre, String contenType, String extension) { + this.nombre = nombre; + this.contentType = contenType; + this.extension = extension; + } + + /** + * Entrega el nombre + * + * @return nombre + */ + public String getNombre() { + return nombre; + } + + /** + * FIja el nombre + * + * @param nombre + */ + public void setNombre(String nombre) { + this.nombre = nombre; + } + + /** + * Entrega el contentType + * + * @return contentType + */ + public String getContentType() { + return contentType; + } + + /** + * Fija el contentType + * + * @param contentType + */ + public void setContentType(String contentType) { + this.contentType = contentType; + } + + /** + * Entrega el extension + * + * @return extension + */ + public String getExtension() { + return extension; + } + + /** + * Fija el extension + * + * @param extension + */ + public void setExtension(String extension) { + this.extension = extension; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/utility/ConvertNumberToText.java b/frontend/src/main/java/com/fp/frontend/utility/ConvertNumberToText.java new file mode 100644 index 0000000..309f683 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/utility/ConvertNumberToText.java @@ -0,0 +1,186 @@ +package com.fp.frontend.utility; + +import java.math.RoundingMode; +import java.text.DecimalFormat; +import java.util.regex.Pattern; + +/** + * @web http://jc-mouse.blogspot.com/ + * @author Mouse + */ +public abstract class ConvertNumberToText { + + private static final String[] UNIDADES = {"", "UN ", "DOS ", "TRES ", + "CUATRO ", "CINCO ", "SEIS ", "SIETE ", "OCHO ", "NUEVE ", "DIEZ ", + "ONCE ", "DOCE ", "TRECE ", "CATORCE ", "QUINCE ", "DIECISEIS", + "DIECISIETE", "DIECIOCHO", "DIECINUEVE", "VEINTE"}; + + private static final String[] DECENAS = {"VENTI", "TREINTA ", "CUARENTA ", + "CINCUENTA ", "SESENTA ", "SETENTA ", "OCHENTA ", "NOVENTA ", + "CIEN "}; + + private static final String[] CENTENAS = {"CIENTO ", "DOSCIENTOS ", + "TRESCIENTOS ", "CUATROCIENTOS ", "QUINIENTOS ", "SEISCIENTOS ", + "SETECIENTOS ", "OCHOCIENTOS ", "NOVECIENTOS "}; + + /** + * Convierte a letras un numero de la forma $123,456.32 + * + * @param number Numero en representacion texto + * @throws NumberFormatException Si valor del numero no es valido (fuera de + * rango o ) + * @return Numero en letras + */ + public static String convertNumberToLetter(String number) + throws NumberFormatException { + return convertNumberToLetter(Double.parseDouble(number)); + } + + /** + * Convierte un numero en representacion numerica a uno en representacion de + * texto. El numero es valido si esta entre 0 y 999'999.999 + * + * @param number Numero a convertir + * @return Numero convertido a texto + * @throws NumberFormatException Si el numero esta fuera del rango + */ + public static String convertNumberToLetter(double doubleNumber) + throws NumberFormatException { + + StringBuilder converted = new StringBuilder(); + + String patternThreeDecimalPoints = "#,###"; + + DecimalFormat format = new DecimalFormat(patternThreeDecimalPoints); + format.setRoundingMode(RoundingMode.DOWN); + + // formateamos el numero, para ajustarlo a el formato de tres puntos + // decimales + String formatedDouble = format.format(doubleNumber); + doubleNumber = Double.parseDouble(formatedDouble); + + // Validamos que sea un numero legal + if (doubleNumber > 999999999) { + throw new NumberFormatException( + "El numero es mayor de 999'999.999, " + + "no es posible convertirlo"); + } + + if (doubleNumber < 0) { + throw new NumberFormatException("El numero debe ser positivo"); + } + + String splitNumber[] = String.valueOf(doubleNumber).replace('.', '#') + .split("#"); + + // Descompone el trio de millones + int millon = Integer.parseInt(String.valueOf(getDigitAt(splitNumber[0], + 8)) + + String.valueOf(getDigitAt(splitNumber[0], 7)) + + String.valueOf(getDigitAt(splitNumber[0], 6))); + if (millon == 1) { + converted.append("UN MILLON "); + } else if (millon > 1) { + converted.append(convertNumber(String.valueOf(millon)) + + "MILLONES "); + } + + // Descompone el trio de miles + int miles = Integer.parseInt(String.valueOf(getDigitAt(splitNumber[0], + 5)) + + String.valueOf(getDigitAt(splitNumber[0], 4)) + + String.valueOf(getDigitAt(splitNumber[0], 3))); + if (miles == 1) { + converted.append("MIL "); + } else if (miles > 1) { + converted.append(convertNumber(String.valueOf(miles)) + "MIL "); + } + + // Descompone el ultimo trio de unidades + int cientos = Integer.parseInt(String.valueOf(getDigitAt( + splitNumber[0], 2)) + + String.valueOf(getDigitAt(splitNumber[0], 1)) + + String.valueOf(getDigitAt(splitNumber[0], 0))); + if (cientos == 1) { + converted.append("UN"); + } + + if (millon + miles + cientos == 0) { + converted.append("CERO"); + } + if (cientos > 1) { + converted.append(convertNumber(String.valueOf(cientos))); + } + + converted.append(MsgControlArmas.getProperty("lbl_dolares")); + + // Descompone los centavos + int centavos = Integer.parseInt(String.valueOf(getDigitAt( + splitNumber[1], 2)) + + String.valueOf(getDigitAt(splitNumber[1], 1)) + + String.valueOf(getDigitAt(splitNumber[1], 0))); + if (centavos == 1) { + converted.append(" CON UN CENTAVO"); + } else if (centavos > 1) { + converted.append(" CON " + convertNumber(String.valueOf(centavos)) + + "CENTAVOS"); + } + + return converted.toString(); + } + + /** + * Convierte los trios de numeros que componen las unidades, las decenas y + * las centenas del numero. + * + * @param number Numero a convetir en digitos + * @return Numero convertido en letras + */ + private static String convertNumber(String number) { + + if (number.length() > 3) { + throw new NumberFormatException( + "La longitud maxima debe ser 3 digitos"); + } + + // Caso especial con el 100 + if (number.equals("100")) { + return "CIEN"; + } + + StringBuilder output = new StringBuilder(); + if (getDigitAt(number, 2) != 0) { + output.append(CENTENAS[getDigitAt(number, 2) - 1]); + } + + int k = Integer.parseInt(String.valueOf(getDigitAt(number, 1)) + + String.valueOf(getDigitAt(number, 0))); + + if (k <= 20) { + output.append(UNIDADES[k]); + } else if (k > 30 && getDigitAt(number, 0) != 0) { + output.append(DECENAS[getDigitAt(number, 1) - 2] + "Y " + + UNIDADES[getDigitAt(number, 0)]); + } else { + output.append(DECENAS[getDigitAt(number, 1) - 2] + + UNIDADES[getDigitAt(number, 0)]); + } + + return output.toString(); + } + + /** + * Retorna el digito numerico en la posicion indicada de derecha a izquierda + * + * @param origin Cadena en la cual se busca el digito + * @param position Posicion de derecha a izquierda a retornar + * @return Digito ubicado en la posicion indicada + */ + private static int getDigitAt(String origin, int position) { + if (origin.length() > position && position >= 0) { + return origin.charAt(origin.length() - position - 1) - 48; + } + return 0; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/utility/EnumParametros.java b/frontend/src/main/java/com/fp/frontend/utility/EnumParametros.java new file mode 100644 index 0000000..2d7910b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/utility/EnumParametros.java @@ -0,0 +1,42 @@ +package com.fp.frontend.utility; + +public enum EnumParametros { + /** + * Código del parámetro para los dias acumulados + */ + VIA_01("VIA_01"), + /** + * Código del parámetro para el xPath de una carpeta Alfresco + */ + PATH_ALFRESCO("PATH_ALFRESCO"), + /** + * Código del parámetro para el xPath de la carpeta de ayuda + * Alfresco + */ + PATH_ALFRESCO_AYUDA("PATH_ALFRESCO_AYUDA"), + /** + * Codigo parametro almacen certificados + */ + PATH_CERTIFICADO_BCE("PATH_CERTIFICADO_BCE"); + ; + + /** + * Atributo para obtener el valor + */ + private String codigo; + + /** + * @param texto + * @param codigo + */ + private EnumParametros(String codigo) { + this.codigo = codigo; + } + + /** + * @return the texto + */ + public String getCodigo() { + return codigo; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/utility/LifeCicleListener.java b/frontend/src/main/java/com/fp/frontend/utility/LifeCicleListener.java new file mode 100644 index 0000000..62bbe67 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/utility/LifeCicleListener.java @@ -0,0 +1,77 @@ +/** + * + */ +package com.fp.frontend.utility; + +import java.util.ResourceBundle; + +import javax.faces.component.UIComponent; +import javax.faces.event.PhaseEvent; +import javax.faces.event.PhaseId; +import javax.faces.event.PhaseListener; + +import org.primefaces.component.datatable.DataTable; + +/** + * @author Gbensvides + * + */ +public class LifeCicleListener implements PhaseListener { + + /** + * + */ + private static final long serialVersionUID = 1L; + private static ResourceBundle resource_bundleValidacion = ResourceBundle + .getBundle("validation_es"); + + /* (non-Javadoc) + * @see javax.faces.event.PhaseListener#afterPhase(javax.faces.event.PhaseEvent) + */ + @Override + public void afterPhase(PhaseEvent arg0) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see javax.faces.event.PhaseListener#beforePhase(javax.faces.event.PhaseEvent) + */ + @Override + public void beforePhase(PhaseEvent arg0) { + // TODO Auto-generated method stub +// //System.out.println(arg0.getPhaseId().toString()); + if (arg0.getPhaseId().equals(PhaseId.RENDER_RESPONSE)) { + processViewTree(arg0.getFacesContext().getViewRoot()); + } + } + + /* (non-Javadoc) + * @see javax.faces.event.PhaseListener#getPhaseId() + */ + @Override + public PhaseId getPhaseId() { + // TODO Auto-generated method stub + return PhaseId.ANY_PHASE; + } + + private void processViewTree(UIComponent component) { + + // //System.out.println(component.getClientId() + " " + component.getClass() ); + for (UIComponent child : component.getChildren()) { + + ////System.out.println("+ " + child.getId() + " ["+child.getClass()+"]"); + if (child instanceof DataTable) { + DataTable table = (DataTable) child; + Object mensajeEmpty = table.getAttributes().get("emptyMessage"); + if (mensajeEmpty != null && mensajeEmpty.equals("No records found.")) { + table.getAttributes().put("emptyMessage", resource_bundleValidacion.getString("org.primefaces.component.datatable.emptyMesssage")); + } + } + + // Process next node + processViewTree(child); + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/utility/MsgControlArmas.java b/frontend/src/main/java/com/fp/frontend/utility/MsgControlArmas.java new file mode 100644 index 0000000..6cada56 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/utility/MsgControlArmas.java @@ -0,0 +1,42 @@ +package com.fp.frontend.utility; + +import java.text.MessageFormat; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class MsgControlArmas { + + private static final String BUNDLE_NAME = "controlarmas_es"; + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + private MsgControlArmas() { + } + + public static String getProperty(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return "Archivo:" + BUNDLE_NAME + " no encontrado"; + } catch (Throwable e) { + return null; + } + } + + public static String getProperty(String pKey, Object... pParameters) { + try { + String msg = null; + try { + msg = RESOURCE_BUNDLE.getString(pKey); + } catch (Exception e) { + + } + if (msg == null) { + msg = pKey; + } + return MessageFormat.format(msg, pParameters); + } catch (Throwable e) { + return null; + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/utility/MsgGeneral.java b/frontend/src/main/java/com/fp/frontend/utility/MsgGeneral.java new file mode 100644 index 0000000..a6b077a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/utility/MsgGeneral.java @@ -0,0 +1,49 @@ +/** + * + */ +package com.fp.frontend.utility; + +import java.text.MessageFormat; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * @author amerchan + * + */ +public class MsgGeneral { + + private static final String BUNDLE_NAME = "general_es"; + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + private MsgGeneral() { + } + + public static String getProperty(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return "Archivo:" + BUNDLE_NAME + " no encontrado"; + } catch (Throwable e) { + return null; + } + } + + public static String getProperty(String pKey, Object... pParameters) { + try { + String msg = null; + try { + msg = RESOURCE_BUNDLE.getString(pKey); + } catch (Exception e) { + + } + if (msg == null) { + msg = pKey; + } + return MessageFormat.format(msg, pParameters); + } catch (Throwable e) { + return null; + } + } +} diff --git a/frontend/src/main/java/com/fp/frontend/utility/TextAreaValidationRequired.java b/frontend/src/main/java/com/fp/frontend/utility/TextAreaValidationRequired.java new file mode 100644 index 0000000..e3ac070 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/utility/TextAreaValidationRequired.java @@ -0,0 +1,122 @@ +package com.fp.frontend.utility; + +import java.text.MessageFormat; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +import javax.faces.application.FacesMessage; +import javax.faces.component.UIInput; +import javax.faces.component.html.HtmlInputTextarea; +import javax.faces.context.FacesContext; +import javax.faces.event.AbortProcessingException; +import javax.faces.event.SystemEvent; +import javax.faces.event.SystemEventListener; + +import org.primefaces.context.RequestContext; + +//@ListenerFor(sourceClass = HtmlInputTextarea.class, systemEventClass = PostValidateEvent.class) +public class TextAreaValidationRequired implements SystemEventListener { + + private static ResourceBundle resource_bundle = ResourceBundle + .getBundle("controlarmas_es"); + + private static ResourceBundle resource_bundleValidacion = ResourceBundle + .getBundle("validation_es"); + + @Override + public boolean isListenerForSource(Object arg0) { + // TODO Auto-generated method stub + + if (arg0 instanceof HtmlInputTextarea) { + UIInput source = (UIInput) arg0; + if (source.isValid()) { + HtmlInputTextarea auxTextArea = ((HtmlInputTextarea) arg0); + if (auxTextArea.getAttributes().get("required").toString() + .equalsIgnoreCase("true")) { + return true; + } + } + } + return false; + } + + @Override + public void processEvent(SystemEvent event) throws AbortProcessingException { + + // TODO Auto-generated method stub + if (event.getSource() instanceof HtmlInputTextarea) { + UIInput source = (UIInput) event.getSource(); + Object object = source.getAttributes().get("maxlength"); + FacesMessage message = new FacesMessage(); + message.setSeverity(FacesMessage.SEVERITY_ERROR); + if (object != null + && object.toString() != "" + && Integer.parseInt(object.toString()) < source.getValue() + .toString().length()) { + source.setValid(false); + RequestContext.getCurrentInstance().addCallbackParam("validationFailed", true); + String mensajeValidacion = getMessagesResources(resource_bundle, + "msg_tamanioMaximoExcedido", + new Object[]{source.getRequiredMessage() == null ? "" : source.getRequiredMessage(), + object.toString()}); + message.setSummary(mensajeValidacion); + message.setDetail(mensajeValidacion); + message.setSeverity(FacesMessage.SEVERITY_ERROR); + FacesContext.getCurrentInstance().addMessage( + source.getClientId(), message); + + return; + } + if (source.getValue() != null + && source.getValue().toString().trim().equals("")) { + + source.setValid(false); + if (FacesContext.getCurrentInstance().getPartialViewContext() + .isAjaxRequest()) { + RequestContext.getCurrentInstance().addCallbackParam("validationFailed", true); + String mensajeValidacion = null; + mensajeValidacion = source.getRequiredMessage(); + if (mensajeValidacion == null || mensajeValidacion.equals("")) { + mensajeValidacion = getMessagesResources(resource_bundleValidacion, + "javax.faces.component.UIInput.REQUIRED", + new Object[]{source.getRequiredMessage(), + object.toString()}); + message.setSummary(mensajeValidacion); + + String mensajeValidacionDetalle = getMessagesResources(resource_bundleValidacion, + "javax.faces.component.UIInput.REQUIRED_detail", + new Object[]{source.getRequiredMessage(), + object.toString()}); + message.setDetail(mensajeValidacionDetalle); + } + + message.setSummary(mensajeValidacion); + + message.setSeverity(FacesMessage.SEVERITY_ERROR); + FacesContext.getCurrentInstance().addMessage( + source.getClientId(), message); + return; + + } + + } + + } + + } + + private String getMessagesResources(ResourceBundle resourceBundle, String key, Object[] argumentos) { + String resourceString = ""; + try { + + resourceString = resourceBundle.getString(key); + + } catch (MissingResourceException e) { + return key; + } + MessageFormat format = new MessageFormat(resourceString); + + return format.format(argumentos); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/utility/Utilidades.java b/frontend/src/main/java/com/fp/frontend/utility/Utilidades.java new file mode 100644 index 0000000..37340a3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/utility/Utilidades.java @@ -0,0 +1,246 @@ +package com.fp.frontend.utility; + +import java.sql.Timestamp; +import java.text.DecimalFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import javax.faces.context.FacesContext; + +import org.apache.commons.lang.StringUtils; +import org.apache.poi.ss.usermodel.Cell; + +import com.fp.frontend.controller.armas.parametros.CentroControlArmasController; +import com.fp.frontend.controller.armas.parametros.TarmCentroControlJurController; +import com.fp.frontend.controller.pcustomer.PersonAddressController; +import com.fp.frontend.controller.pgeneral.gene.CatalogDetailController; +import com.fp.frontend.helper.MessageHelper; +import com.fp.persistence.parmas.param.TarmCentroControl; +import com.fp.persistence.parmas.param.TarmCentroControlJur; +import com.fp.persistence.pcustomer.gene.TcustPersonAddress; +import com.fp.persistence.pgeneral.gene.TgeneCatalogDetail; +import com.fp.persistence.pgeneral.safe.TsafeUserDetail; + +@ManagedBean +@ViewScoped +public class Utilidades { + + /** + * Metodo para formatear los decimales que se encuentran dentro de un texto + * + * @param texto + * @return + */ + public static String formatearDecimalesEnTexto(String texto, String formato) {//.177 + //NOTA:Se decide cambiar y no formatear los calibres como definicion de ultimo momento + + /* DecimalFormat fmt = new DecimalFormat(formato); + String patron ="(\\w+)?([0-9]+)?[\\.\\,]([0-9]+)(\\w+)?"; + Pattern p = Pattern.compile(patron); + Matcher m = p.matcher(texto); + String textoReemplazo=texto; + + while(m.find()) { + textoReemplazo = m.replaceFirst( (m.group(1)==null?"": m.group(1)) + fmt.format(Double.valueOf(m.group(2)!=null?m.group(2):"0" + "." +m.group(3))) + (m.group(4)!=null?m.group(4):"")); + } + + return textoReemplazo.replace(",", "."); */ + return texto; + } + + public static Timestamp getFechaExpiracion() { + Timestamp fechaExpiracion = null; + Calendar calendar = Calendar.getInstance(); + calendar.set(Calendar.YEAR, 2999); + calendar.set(Calendar.MONTH, 11); + calendar.set(Calendar.DATE, 31); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + fechaExpiracion = new Timestamp(calendar.getTimeInMillis()); + return fechaExpiracion; + } + + /** + * Metodo para armar el formato de una fecha sin hora + * + * @param fechaCldr fecha en formato calendar + * @return + */ + public static String armarFormatoFechaSinHora(Calendar fechaCldr) { + return (new SimpleDateFormat("dd-MM-yyyy")).format(fechaCldr.getTime()); + + } + + /** + * Metodo para armar el formato de una fecha sin hora + * + * @param fechaCldr fecha en formato Date + * @return + */ + public static String armarFormatoFechaSinHora(Date fechaCldr) { + return (new SimpleDateFormat("dd-MM-yyyy")).format(fechaCldr); + + } + + /** + * Metodo para transformar el formato de una fecha con hora + * + * @param fechaCldr + * @return + */ + public static String armarFormatoFechaConHora(Calendar fechaCldr) { + return (new SimpleDateFormat("dd-MM-yyyy HH:mm:ss")).format(fechaCldr.getTime()); + } + + /* Reemplazo un string los caracteres en blanco y reemplazo caracteres especiales + * @param toConvert + * @return la cadena convertida + */ + public static String obtieneNombreLimpio(String toConvert) { + return StringUtils.replaceEach(StringUtils.deleteWhitespace(toConvert), + new String[]{"\u00e1", "\u00e9", "\u00ed", "\u00f3", "\u00fa", "\u00c1", "\u00c9", "\u00cd", "\u00d3", "\u00da", "\u00F1", "\u00d1"}, + new String[]{"a", "e", "i", "o", "u", "A", "E", "I", "O", "U", "n", "N"}); + } + + /** + * recorta el nombre + * + * @param nombre + * @return + */ + public static String recorteNombre(String nombre) { + String fielname = nombre; + if (fielname.length() > 30) { + fielname = fielname.substring(0, 30) + extencionArchivo(nombre); + } + return fielname; + } + + /** + * obtiene la extencion del archivo + * + * @param nombre + * @return + */ + private static String extencionArchivo(String nombre) { + int pos = nombre.lastIndexOf('.'); + nombre = nombre.substring(pos); + return nombre; + } + + /** + * Método que revisa si una cadena tiene caracteres especiales + * + * @param nombre + * @return + * @throws Exception + */ + public static String caractersEspeciales(String nombre) throws Exception { + List caracteresEsp = CatalogDetailController.find("CARACTERESPECIAL"); + for (TgeneCatalogDetail caract : caracteresEsp) { + if (nombre.contains(caract.getPk().getCatalog())) { + throw new Exception(MsgControlArmas.getProperty("msg_error_elnombredelarchivonocaracteresespeciales") + ": " + caract.getPk().getCatalog()); + } + } + String numero = "1234567890"; + if (numero.contains(nombre.substring(0, 1))) { + throw new Exception(MsgControlArmas.getProperty("msg_error_elnombredelarchivonodebeiniciarconnum")); + } + if (nombre != null && nombre.trim().contains(" ")) { + throw new Exception(MsgControlArmas.getProperty("msg_error_elnombredelarchivonodebecontenerespaciosenblanco")); + } + if (nombre.length() < 9) { + nombre = "DOCUMENTO-" + nombre; +// throw new Exception(MsgControlArmas.getProperty("msg_error_elnombredelarchivonodebesermenoracincoletras")); + } + return nombre; + } + + /** + * Funcion que reemplaza acentos y caracteres especiales de una cadena de + * texto + * + * @param input + * @return cadena de texto limpia de acentos y caracteres especiales. + */ + public static String reemplazaAcentosCaractEspeciales(String input) { + // Cadena de caracteres original a sustituir. + String original = "u"; + // Cadena de caracteres ASCII que reemplazarn los originales. + String ascii = "aaaeeeiiiooouuunAAAEEEIIIOOOUUUNcC"; + String output = input; + for (int i = 0; i < original.length(); i++) { + // Reemplazamos los caracteres especiales. + output = output.replace(original.charAt(i), ascii.charAt(i)); + } + output = output.replace("-", " ").replace("*", " ").replace("(", " ").replace(")", " ").replace("_", " ").replace("^", " ").replace("@", " ").replace("/", " "); + output = output.replace(",", "").replace("$", " ").replace("%", " ").replace("", " ").replace("?", " "); //.replace("&", " ") + return output; + } + + /** + * Método que revisa si una cadena tiene el signo % + * + * @param nombre + * @throws Exception + */ + public static void caracterEspecial(String nombre) throws Exception { + if (nombre.contains("%")) { + throw new Exception(MsgControlArmas.getProperty("msg_error_ingresenumsolicitudexacto")); + } + } + + /** + * Metodo para setear una celda de excell + * + * @param celda + * @return la celda seteada como String + */ + public static String setearValorCelda(Cell celda) { + if (celda == null) { + return null; + } + if (celda.getCellType() == Cell.CELL_TYPE_NUMERIC) { + Double datoNumerico = celda.getNumericCellValue(); + return datoNumerico.toString(); + } else if (celda.getCellType() == Cell.CELL_TYPE_STRING) { + return celda.getStringCellValue(); + } + return null; + } + + /** + * Método para obtener el centro de control + * + * @throws Exception + */ + public static TarmCentroControl obtenerCentroControl() throws Exception { + TarmCentroControl centroControl = null; + TsafeUserDetail tsafeUserDetail = (TsafeUserDetail) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("TSAFEUSERDETAIL"); + PersonAddressController personAddressController = new PersonAddressController(); + TcustPersonAddress tcustPersonAddres = personAddressController.findPrincipal(tsafeUserDetail.getPk().getPersoncode().toString()); + if (tcustPersonAddres != null && tcustPersonAddres.getProvincecode() != null) { + //cprovincia=tcustPersonAddres.getProvincecode(); + TarmCentroControlJur centroControlJur = TarmCentroControlJurController.findxProvincia(tcustPersonAddres.getProvincecode()); + if (centroControlJur != null && centroControlJur.getCcentrocontrol() != null) { + centroControl = CentroControlArmasController.findPorCodigo(centroControlJur.getCcentrocontrol()); + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_laprovinciasinccontrol")); + return null; + } + } else { + MessageHelper.setMessageError(MsgControlArmas.getProperty("msg_error_notienedireccionprincipal")); + return null; + } + return centroControl; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/utility/ValidateIdentification.java b/frontend/src/main/java/com/fp/frontend/utility/ValidateIdentification.java new file mode 100644 index 0000000..0c6110d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/utility/ValidateIdentification.java @@ -0,0 +1,146 @@ +package com.fp.frontend.utility; + +import java.math.BigDecimal; + +/** + * Clase para validar la cédula y el RUC de una persona + * + * @author BPTWPA + * @version 2.1 + */ +public class ValidateIdentification { + + /** + * Método para validar la cédula + * + * @param id Número de la cédula + * @return result Retorna V/F según la validez de la cédula + */ + public static boolean cedula(String id) { + + boolean result = true; + + int[] modulo9 = {2, 1, 2, 1, 2, 1, 2, 1, 2}; + + BigDecimal verif = new BigDecimal(0); + if (id.length() != 10) { + result = false; + } else { + for (int i = 0; i < 9; i++) { + BigDecimal temp = new BigDecimal(new BigDecimal(id.substring(i, (i + 1))).multiply(new BigDecimal(modulo9[i])).toString()); + if (temp.doubleValue() > 9) { + temp = temp.subtract(new BigDecimal("9")); + } + verif = verif.add(temp); + } + if (verif.doubleValue() % 10 == 0) { + if (Integer.parseInt(id.substring(9, 10)) == 0) { + result = true; + } else { + result = false; + } + } else if ((10 - (verif.doubleValue() % 10)) == Integer.parseInt(id.substring(9, 10))) { + result = true; + } else { + result = false; + } + } + return result; + } + + /** + * Método para validar el Ruc + * + * @param ruc Número del Ruc + * @return Retorna V/F según la validez del Ruc + */ + public static boolean ruc(String ruc) { + + boolean result = true; + + int[] modulo11 = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + + BigDecimal verif = new BigDecimal(0); + if (ruc.length() < 13) { + result = false; + } else if (Integer.parseInt(ruc.substring(0, 2)) < 1 + || Integer.parseInt(ruc.substring(0, 2)) > 25) { + result = false; + } else if (Integer.parseInt(ruc.substring(2, 3)) < 0 + || (Integer.parseInt(ruc.substring(2, 3)) > 6 && Integer + .parseInt(ruc.substring(2, 3)) < 9)) { + result = false; + } else if (Integer.parseInt(ruc.substring(2, 3)) == 9) { // sociedad privada o extranjeros + if (!ruc.substring(10, 13).equals("001")) { + result = false; + } else { + modulo11[0] = 4; + modulo11[1] = 3; + modulo11[2] = 2; + modulo11[3] = 7; + modulo11[4] = 6; + modulo11[5] = 5; + modulo11[6] = 4; + modulo11[7] = 3; + modulo11[8] = 2; + for (int i = 0; i < 9; i++) { + verif = verif.add(new BigDecimal(ruc.substring(i, + (i + 1))).multiply(new BigDecimal( + modulo11[i]))); + } + if (verif.doubleValue() % 11 == 0) { + if (Integer.parseInt(ruc.substring(9, 10)) == 0) { + result = true; + } else { + result = false; + } + } else if ((11 - (verif.doubleValue() % 11)) == Integer + .parseInt(ruc.substring(9, 10))) { + result = true; + } else { + result = false; + } + } + } else if (Integer.parseInt(ruc.substring(2, 3)) == 6) { // sociedad publicas + + if (!ruc.substring(10, 13).equals("001")) { + result = false; + } else { + modulo11[0] = 3; + modulo11[1] = 2; + modulo11[2] = 7; + modulo11[3] = 6; + modulo11[4] = 5; + modulo11[5] = 4; + modulo11[6] = 3; + modulo11[7] = 2; + for (int i = 0; i < 8; i++) { + verif = verif.add(new BigDecimal(ruc.substring(i, + (i + 1))).multiply(new BigDecimal( + modulo11[i]))); + } + if (verif.doubleValue() % 11 == 0) { + if (Integer.parseInt(ruc.substring(8, 9)) == 0) { + result = true; + } else { + result = false; + } + } else if ((11 - (verif.doubleValue() % 11)) == Integer + .parseInt(ruc.substring(8, 9))) { + result = true; + } else { + result = false; + } + } + } else if (Integer.parseInt(ruc.substring(2, 3)) < 6 + && Integer.parseInt(ruc.substring(2, 3)) >= 0) { // personas naturales + + if (!ruc.substring(10, 13).equals("001")) { + result = false; + } else { + result = cedula(ruc.substring(0, 10)); + } + } + return result; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/validators/.svn/entries b/frontend/src/main/java/com/fp/frontend/validators/.svn/entries new file mode 100644 index 0000000..20379d2 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/validators/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/validators +svn://172.17.26.185/COMACO + + + +2016-07-28T21:02:11.275748Z +4551 +cvasquez + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +CedulaValidator.java +file + + + + +2022-07-28T03:39:58.554612Z +dbef52335979386a98d98796ddb1aa0a +2014-09-02T08:04:37.389946Z +468 +ogarcia + + + + + + + + + + + + + + + + + + + + + +2024 + +DocFirmaValidator.java +file + + + + +2022-07-28T03:39:58.554612Z +ba192e7a822157ed3607d0b337d9e2e6 +2016-07-28T21:02:11.275748Z +4551 +cvasquez + + + + + + + + + + + + + + + + + + + + + +631 + diff --git a/frontend/src/main/java/com/fp/frontend/validators/.svn/text-base/CedulaValidator.java.svn-base b/frontend/src/main/java/com/fp/frontend/validators/.svn/text-base/CedulaValidator.java.svn-base new file mode 100644 index 0000000..ac24a4a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/validators/.svn/text-base/CedulaValidator.java.svn-base @@ -0,0 +1,67 @@ +package com.fp.frontend.validators; + +import java.math.BigDecimal; + +import javax.faces.application.FacesMessage; +import javax.faces.component.UIComponent; +import javax.faces.component.html.HtmlInputText; +import javax.faces.context.FacesContext; +import javax.faces.validator.FacesValidator; +import javax.faces.validator.Validator; +import javax.faces.validator.ValidatorException; + +import com.fp.frontend.utility.ValidateIdentification; + + + +@FacesValidator(value="cedulaValidator") +public class CedulaValidator implements Validator{ + + @Override + public void validate(FacesContext context, UIComponent component, Object value) + throws ValidatorException { + + try { + if(value.toString().length()!=10 || !ValidateIdentification.cedula(value.toString())){ + throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,"El n\u00famero ingresado no es v\u00e1lido. Por favor verificar","El n\u00famero ingresado no es v\u00e1lido. Por favor verificar.")); + } + } catch (Throwable e) { + throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage(), e.getMessage())); + } + + } + + public static boolean validarCedula(String id) { + + boolean result = true; + + int[] modulo9 = { 2, 1, 2, 1, 2, 1, 2, 1, 2 }; + + BigDecimal verif = BigDecimal.ZERO; + if (id.length() != 10) + result = false; + else { + for (int i = 0; i < 9; i++) { + BigDecimal temp = new BigDecimal(new BigDecimal(id.substring(i, (i + 1))).multiply(new BigDecimal(modulo9[i])).toString()); + if (temp.doubleValue() > 9){ + temp = temp.subtract(new BigDecimal("9")); + } + verif = verif.add(temp); + } + if (verif.doubleValue() % 10 == 0){ + if (Integer.parseInt(id.substring(9, 10)) == 0){ + result = true; + } else{ + result = false; + } + } else if ((10 - (verif.doubleValue() % 10)) == Integer.parseInt(id.substring(9, 10))){ + result = true; + } else { + result = false; + } + } + return result; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/validators/.svn/text-base/DocFirmaValidator.java.svn-base b/frontend/src/main/java/com/fp/frontend/validators/.svn/text-base/DocFirmaValidator.java.svn-base new file mode 100644 index 0000000..6773046 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/validators/.svn/text-base/DocFirmaValidator.java.svn-base @@ -0,0 +1,31 @@ +package com.fp.frontend.validators; + +import java.io.InputStream; + +import com.lowagie.text.pdf.AcroFields; +import com.lowagie.text.pdf.PdfReader; + +public class DocFirmaValidator { + + public static boolean validDocSign(InputStream path) { + boolean validSign = false; + try { + PdfReader reader = new PdfReader(path); + if (reader != null) { + AcroFields af = reader.getAcroFields(); + if (af != null) { + if (af.getSignatureNames() != null + && af.getSignatureNames().size() != 0) { + + validSign = true; + } + } + } + + } catch (Exception e) { + + } + return validSign; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/validators/CedulaValidator.java b/frontend/src/main/java/com/fp/frontend/validators/CedulaValidator.java new file mode 100644 index 0000000..940cdd3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/validators/CedulaValidator.java @@ -0,0 +1,64 @@ +package com.fp.frontend.validators; + +import java.math.BigDecimal; + +import javax.faces.application.FacesMessage; +import javax.faces.component.UIComponent; +import javax.faces.component.html.HtmlInputText; +import javax.faces.context.FacesContext; +import javax.faces.validator.FacesValidator; +import javax.faces.validator.Validator; +import javax.faces.validator.ValidatorException; + +import com.fp.frontend.utility.ValidateIdentification; + +@FacesValidator(value = "cedulaValidator") +public class CedulaValidator implements Validator { + + @Override + public void validate(FacesContext context, UIComponent component, Object value) + throws ValidatorException { + + try { + if (value.toString().length() != 10 || !ValidateIdentification.cedula(value.toString())) { + throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "El n\u00famero ingresado no es v\u00e1lido. Por favor verificar", "El n\u00famero ingresado no es v\u00e1lido. Por favor verificar.")); + } + } catch (Throwable e) { + throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage(), e.getMessage())); + } + + } + + public static boolean validarCedula(String id) { + + boolean result = true; + + int[] modulo9 = {2, 1, 2, 1, 2, 1, 2, 1, 2}; + + BigDecimal verif = BigDecimal.ZERO; + if (id.length() != 10) { + result = false; + } else { + for (int i = 0; i < 9; i++) { + BigDecimal temp = new BigDecimal(new BigDecimal(id.substring(i, (i + 1))).multiply(new BigDecimal(modulo9[i])).toString()); + if (temp.doubleValue() > 9) { + temp = temp.subtract(new BigDecimal("9")); + } + verif = verif.add(temp); + } + if (verif.doubleValue() % 10 == 0) { + if (Integer.parseInt(id.substring(9, 10)) == 0) { + result = true; + } else { + result = false; + } + } else if ((10 - (verif.doubleValue() % 10)) == Integer.parseInt(id.substring(9, 10))) { + result = true; + } else { + result = false; + } + } + return result; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/validators/DocFirmaValidator.java b/frontend/src/main/java/com/fp/frontend/validators/DocFirmaValidator.java new file mode 100644 index 0000000..8999aa7 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/validators/DocFirmaValidator.java @@ -0,0 +1,31 @@ +package com.fp.frontend.validators; + +import java.io.InputStream; + +import com.lowagie.text.pdf.AcroFields; +import com.lowagie.text.pdf.PdfReader; + +public class DocFirmaValidator { + + public static boolean validDocSign(InputStream path) { + boolean validSign = false; + try { + PdfReader reader = new PdfReader(path); + if (reader != null) { + AcroFields af = reader.getAcroFields(); + if (af != null) { + if (af.getSignatureNames() != null + && af.getSignatureNames().size() != 0) { + + validSign = true; + } + } + } + + } catch (Exception e) { + + } + return validSign; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/.svn/entries b/frontend/src/main/java/com/fp/frontend/webservices/.svn/entries new file mode 100644 index 0000000..59aa309 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/.svn/entries @@ -0,0 +1,241 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/webservices +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +InventarioService.java +file + + + + +2022-07-28T03:39:46.195559Z +eb42477ccc57f29c61e935f9427ca316 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1270 + +impl +dir + +snap +dir + +ArmaService.java +file + + + + +2022-07-28T03:39:46.195559Z +9da85af514b57c37a9e931919dd4dd1c +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1369 + +DocumentosService.java +file + + + + +2022-07-28T03:39:46.196559Z +f16bdb47b2d0ef1e8efff50add7c6684 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +739 + +ConsultaLoginService.java +file + + + + +2022-07-28T03:39:46.197559Z +a1d7360f009248cafd448bc65ac03411 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1020 + +ColaImpresionService.java +file + + + + +2022-07-28T03:39:46.197559Z +2ef1af1babd66d8d38570705b5b5383b +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1999 + +rest +dir + +DatosSnapService.java +file + + + + +2022-07-28T03:39:46.198559Z +8d3eae9cd43268818607dd5c7475a73c +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +771 + diff --git a/frontend/src/main/java/com/fp/frontend/webservices/.svn/prop-base/ArmaService.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/.svn/prop-base/ArmaService.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/.svn/prop-base/ArmaService.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/.svn/prop-base/ColaImpresionService.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/.svn/prop-base/ColaImpresionService.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/.svn/prop-base/ColaImpresionService.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/.svn/prop-base/ConsultaLoginService.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/.svn/prop-base/ConsultaLoginService.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/.svn/prop-base/ConsultaLoginService.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/.svn/prop-base/DocumentosService.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/.svn/prop-base/DocumentosService.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/.svn/prop-base/DocumentosService.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/.svn/prop-base/InventarioService.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/.svn/prop-base/InventarioService.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/.svn/prop-base/InventarioService.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/.svn/text-base/ArmaService.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/.svn/text-base/ArmaService.java.svn-base new file mode 100644 index 0000000..72635e2 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/.svn/text-base/ArmaService.java.svn-base @@ -0,0 +1,51 @@ +package com.fp.frontend.webservices; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; + +import com.fp.persistence.parmas.dto.ws.ArmaDto; + +/** + * Servicio en el cual se van a determinar todas las operaciones definidas para un arma + * @author dcruz + * + */ +@WebService +public interface ArmaService { + + /** + * Retorna el arma encontrada por id + * @param carma + * @return + */ + @WebMethod + public ArmaDto obtenerArmaId(@WebParam(name="codigoarma") String carma); + + /** + * Retorna un codigo de respuesta del servicio 0, el arma fue vinculada con el tag, 1 el arma que se quiere vincular con el tag no existe + * @param codigoarma + * @param codigotag + * @return + */ + @WebMethod + public String vinculaTagArma(@WebParam(name="codigoarma")String codigoarma, @WebParam(name="codigotag") String codigotag); + + /** + * Retorna un código de respuesta del estado de la operación + * @param codigoarma + * @param codigotag + * @return + */ + @WebMethod + public String desvinculaTagArma(@WebParam(name="codigoarma")String codigoarma, @WebParam(name="codigotag") String codigotag) ; + + /** + * Retorna el arma encontrada por el codigo del tag + * @param codigotag + * @return + */ + @WebMethod + public ArmaDto obtenerArmaPorTag(@WebParam(name = "codigotag") String codigotag); + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/.svn/text-base/ColaImpresionService.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/.svn/text-base/ColaImpresionService.java.svn-base new file mode 100644 index 0000000..873c864 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/.svn/text-base/ColaImpresionService.java.svn-base @@ -0,0 +1,62 @@ +package com.fp.frontend.webservices; + +import java.util.List; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; + +import com.fp.persistence.parmas.dto.ws.ColaImpresionDto; +import com.fp.persistence.parmas.dto.ws.ImagenDto; +import com.fp.persistence.parmas.dto.ws.JefeCentroControlDto; + +/** + * Servicio que contiene los métodos que retornan colas de impresión + * @author dcruz + * + */ +@WebService +public interface ColaImpresionService { + + /** + * Devuelve los documentos por imprimir por usuario + * @param usercode + * @return + */ + @WebMethod + public List obtenerDatosPendientesImprimir(@WebParam(name="usercode") String usercode); + + /** + * Invoca al componente que realiza la invocación de las colas de impresion presentes de dicho documento + * @param codigoproceso + * @return una {@link List} de {@link ColaImpresionDto} + */ + @WebMethod + public List obtenerDocumentosImpresionProceso(@WebParam(name="codigoproceso") String codigoproceso); + + /** + * Retorna los datos del Jefe del centro de control + * @param numerodocumento + * @return + */ + @WebMethod + public JefeCentroControlDto obtenerJefeCentroArmas(@WebParam(name="numerodocumento") String numerodocumento); + + /** + * Retorna los datos de la imagen de la persona + * @param numeroidentificacion Número de identificación + * @return + */ + @WebMethod + public ImagenDto obtenerImagenPersona(@WebParam(name="numeroidentificacion") String numeroidentificacion); + + /** + * Envia los datos del documento y lo almacena en Alfresco + * @param documento + * @param numerosolicitud + * @return 0 éxito, 1 los parámetros son obligatorios, 2 ocurrió un error en el servidor, 3 no existe el path asignado + */ + @WebMethod + public String envioInforme(@WebParam(name="documento") byte[] documento, @WebParam(name="numerosolicitud") String numerosolicitud); +} + diff --git a/frontend/src/main/java/com/fp/frontend/webservices/.svn/text-base/ConsultaLoginService.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/.svn/text-base/ConsultaLoginService.java.svn-base new file mode 100644 index 0000000..932f9e5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/.svn/text-base/ConsultaLoginService.java.svn-base @@ -0,0 +1,32 @@ +package com.fp.frontend.webservices; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; + +/** + * Servicio web que maneja el login de un usuario ingresado + * @author dcruz + * + */ +@WebService +public interface ConsultaLoginService { + + /** + * Retorna un string especificando la respuesta del servicio + * @param login + * @return 0 existe el login, 1 el login no existe, 2 existe un error en el servidor + */ + @WebMethod + public String consultaLogin(@WebParam(name="usercode") String usercode); + + /** + * Retorna la localidad del usuario ingresado siempre y cuando el login y el password son correctos + * @param login el nombre de usuario + * @param password password del usuario + * @return La localidad del usuario ó 1 existe un error en el login o la contrasena , 2 existe un error en el servidor + */ + @WebMethod + public String consultaLoginPassword(@WebParam(name="usercode") String usercode, @WebParam(name="password") String password); + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/.svn/text-base/DatosSnapService.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/.svn/text-base/DatosSnapService.java.svn-base new file mode 100644 index 0000000..eb02549 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/.svn/text-base/DatosSnapService.java.svn-base @@ -0,0 +1,31 @@ +package com.fp.frontend.webservices; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; +import javax.xml.bind.JAXBException; + +import com.fp.frontend.webservices.snap.modelo.SoapEnvelopWrapper; + +/** + * + * @author Manuel Cepeda + * + */ +@WebService +public interface DatosSnapService { + + /** + * Definicion del metodo que permite obtener la informacion de armas a ser publicada + * @param institucion + * @param nroDicumento + * @param serie + * @return + * @throws JAXBException + */ + @WebMethod + public SoapEnvelopWrapper obtenerDatos(@WebParam(name="institucion") String institucion, @WebParam(name="nroDocumento") String nroDocumento, + @WebParam(name="serie") String serie) throws JAXBException; + +} + diff --git a/frontend/src/main/java/com/fp/frontend/webservices/.svn/text-base/DocumentosService.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/.svn/text-base/DocumentosService.java.svn-base new file mode 100644 index 0000000..796fb0e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/.svn/text-base/DocumentosService.java.svn-base @@ -0,0 +1,26 @@ +package com.fp.frontend.webservices; + +import java.util.Date; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; + +/** + * Servicio que contiene todas las operaciones de los documentos habilitantes + * @author dcruz + * + */ +@WebService +public interface DocumentosService { + + /** + * Actualiza los datos en la cola de impresión y en la persona + * @param foto + * @param codigoproceso + * @param fechaimpresion + * @return + */ + @WebMethod + public String guardaDatosDocumentos(@WebParam(name="foto") byte[] foto, @WebParam(name="codigoproceso") String codigoproceso, @WebParam(name="codigotarjeta") String codigotarjeta, @WebParam(name="fechaimpresion") Date fechaimpresion); +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/.svn/text-base/InventarioService.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/.svn/text-base/InventarioService.java.svn-base new file mode 100644 index 0000000..3ab2ecc --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/.svn/text-base/InventarioService.java.svn-base @@ -0,0 +1,33 @@ +package com.fp.frontend.webservices; + +import java.util.Date; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; + +/** + * Servicio que contiene todas las operaciones del servicio web de inventario + * @author dcruz + * + */ +@WebService +public interface InventarioService { + + /** + * Operación en la cual se ingresa los tag leídos desde la hand held + * @param tagslectura tags leídos en la lectura + * @param fechalectura fecha en la que se realizó la lectura + * @param locacionlectura lugar en la que se realizo la lectura + * @param idportal id del portal de donde se está receptando la información + * @param tipooperacion el tipo de operación; 1 si es lectura hand held, 2 si es portal + * @return 0 si la operació se realizo correctamente, 1 si ocurrio un error en el cliente, 2 si ocurrió algún error interno + */ + @WebMethod + public String guardaDatosLectura( + @WebParam(name="tagslectura")String tagslectura, + @WebParam(name="fechalectura")Date fechalectura, + @WebParam(name="locacionlectura")String locacionlectura, + @WebParam(name="idportal")String idportal, + @WebParam(name="tipolectura")String tipooperacion); +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/ArmaService.java b/frontend/src/main/java/com/fp/frontend/webservices/ArmaService.java new file mode 100644 index 0000000..17210ba --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/ArmaService.java @@ -0,0 +1,58 @@ +package com.fp.frontend.webservices; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; + +import com.fp.persistence.parmas.dto.ws.ArmaDto; + +/** + * Servicio en el cual se van a determinar todas las operaciones definidas para + * un arma + * + * @author dcruz + * + */ +@WebService +public interface ArmaService { + + /** + * Retorna el arma encontrada por id + * + * @param carma + * @return + */ + @WebMethod + public ArmaDto obtenerArmaId(@WebParam(name = "codigoarma") String carma); + + /** + * Retorna un codigo de respuesta del servicio 0, el arma fue vinculada con + * el tag, 1 el arma que se quiere vincular con el tag no existe + * + * @param codigoarma + * @param codigotag + * @return + */ + @WebMethod + public String vinculaTagArma(@WebParam(name = "codigoarma") String codigoarma, @WebParam(name = "codigotag") String codigotag); + + /** + * Retorna un código de respuesta del estado de la operación + * + * @param codigoarma + * @param codigotag + * @return + */ + @WebMethod + public String desvinculaTagArma(@WebParam(name = "codigoarma") String codigoarma, @WebParam(name = "codigotag") String codigotag); + + /** + * Retorna el arma encontrada por el codigo del tag + * + * @param codigotag + * @return + */ + @WebMethod + public ArmaDto obtenerArmaPorTag(@WebParam(name = "codigotag") String codigotag); + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/ColaImpresionService.java b/frontend/src/main/java/com/fp/frontend/webservices/ColaImpresionService.java new file mode 100644 index 0000000..f09a63c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/ColaImpresionService.java @@ -0,0 +1,70 @@ +package com.fp.frontend.webservices; + +import java.util.List; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; + +import com.fp.persistence.parmas.dto.ws.ColaImpresionDto; +import com.fp.persistence.parmas.dto.ws.ImagenDto; +import com.fp.persistence.parmas.dto.ws.JefeCentroControlDto; + +/** + * Servicio que contiene los métodos que retornan colas de + * impresión + * + * @author dcruz + * + */ +@WebService +public interface ColaImpresionService { + + /** + * Devuelve los documentos por imprimir por usuario + * + * @param usercode + * @return + */ + @WebMethod + public List obtenerDatosPendientesImprimir(@WebParam(name = "usercode") String usercode); + + /** + * Invoca al componente que realiza la invocación de las colas de + * impresion presentes de dicho documento + * + * @param codigoproceso + * @return una {@link List} de {@link ColaImpresionDto} + */ + @WebMethod + public List obtenerDocumentosImpresionProceso(@WebParam(name = "codigoproceso") String codigoproceso); + + /** + * Retorna los datos del Jefe del centro de control + * + * @param numerodocumento + * @return + */ + @WebMethod + public JefeCentroControlDto obtenerJefeCentroArmas(@WebParam(name = "numerodocumento") String numerodocumento); + + /** + * Retorna los datos de la imagen de la persona + * + * @param numeroidentificacion Número de identificación + * @return + */ + @WebMethod + public ImagenDto obtenerImagenPersona(@WebParam(name = "numeroidentificacion") String numeroidentificacion); + + /** + * Envia los datos del documento y lo almacena en Alfresco + * + * @param documento + * @param numerosolicitud + * @return 0 éxito, 1 los parámetros son obligatorios, 2 + * ocurrió un error en el servidor, 3 no existe el path asignado + */ + @WebMethod + public String envioInforme(@WebParam(name = "documento") byte[] documento, @WebParam(name = "numerosolicitud") String numerosolicitud); +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/ConsultaLoginService.java b/frontend/src/main/java/com/fp/frontend/webservices/ConsultaLoginService.java new file mode 100644 index 0000000..e5c0294 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/ConsultaLoginService.java @@ -0,0 +1,38 @@ +package com.fp.frontend.webservices; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; + +/** + * Servicio web que maneja el login de un usuario ingresado + * + * @author dcruz + * + */ +@WebService +public interface ConsultaLoginService { + + /** + * Retorna un string especificando la respuesta del servicio + * + * @param login + * @return 0 existe el login, 1 el login no existe, 2 existe un error en el + * servidor + */ + @WebMethod + public String consultaLogin(@WebParam(name = "usercode") String usercode); + + /** + * Retorna la localidad del usuario ingresado siempre y cuando el login y el + * password son correctos + * + * @param login el nombre de usuario + * @param password password del usuario + * @return La localidad del usuario ó 1 existe un error en el login o + * la contrasena , 2 existe un error en el servidor + */ + @WebMethod + public String consultaLoginPassword(@WebParam(name = "usercode") String usercode, @WebParam(name = "password") String password); + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/DatosSnapService.java b/frontend/src/main/java/com/fp/frontend/webservices/DatosSnapService.java new file mode 100644 index 0000000..d7efa29 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/DatosSnapService.java @@ -0,0 +1,32 @@ +package com.fp.frontend.webservices; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; +import javax.xml.bind.JAXBException; + +import com.fp.frontend.webservices.snap.modelo.SoapEnvelopWrapper; + +/** + * + * @author Manuel Cepeda + * + */ +@WebService +public interface DatosSnapService { + + /** + * Definicion del metodo que permite obtener la informacion de armas a ser + * publicada + * + * @param institucion + * @param nroDicumento + * @param serie + * @return + * @throws JAXBException + */ + @WebMethod + public SoapEnvelopWrapper obtenerDatos(@WebParam(name = "institucion") String institucion, @WebParam(name = "nroDocumento") String nroDocumento, + @WebParam(name = "serie") String serie) throws JAXBException; + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/DocumentosService.java b/frontend/src/main/java/com/fp/frontend/webservices/DocumentosService.java new file mode 100644 index 0000000..9d1d72b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/DocumentosService.java @@ -0,0 +1,28 @@ +package com.fp.frontend.webservices; + +import java.util.Date; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; + +/** + * Servicio que contiene todas las operaciones de los documentos habilitantes + * + * @author dcruz + * + */ +@WebService +public interface DocumentosService { + + /** + * Actualiza los datos en la cola de impresión y en la persona + * + * @param foto + * @param codigoproceso + * @param fechaimpresion + * @return + */ + @WebMethod + public String guardaDatosDocumentos(@WebParam(name = "foto") byte[] foto, @WebParam(name = "codigoproceso") String codigoproceso, @WebParam(name = "codigotarjeta") String codigotarjeta, @WebParam(name = "fechaimpresion") Date fechaimpresion); +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/InventarioService.java b/frontend/src/main/java/com/fp/frontend/webservices/InventarioService.java new file mode 100644 index 0000000..a6122ba --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/InventarioService.java @@ -0,0 +1,39 @@ +package com.fp.frontend.webservices; + +import java.util.Date; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; + +/** + * Servicio que contiene todas las operaciones del servicio web de inventario + * + * @author dcruz + * + */ +@WebService +public interface InventarioService { + + /** + * Operación en la cual se ingresa los tag leídos desde la + * hand held + * + * @param tagslectura tags leídos en la lectura + * @param fechalectura fecha en la que se realizó la lectura + * @param locacionlectura lugar en la que se realizo la lectura + * @param idportal id del portal de donde se está receptando la + * información + * @param tipooperacion el tipo de operación; 1 si es lectura hand + * held, 2 si es portal + * @return 0 si la operació se realizo correctamente, 1 si ocurrio un + * error en el cliente, 2 si ocurrió algún error interno + */ + @WebMethod + public String guardaDatosLectura( + @WebParam(name = "tagslectura") String tagslectura, + @WebParam(name = "fechalectura") Date fechalectura, + @WebParam(name = "locacionlectura") String locacionlectura, + @WebParam(name = "idportal") String idportal, + @WebParam(name = "tipolectura") String tipooperacion); +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/entries b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/entries new file mode 100644 index 0000000..7110645 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/entries @@ -0,0 +1,266 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/webservices/impl +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +DatosSnapServiceImpl.java +file + + + + +2022-07-28T03:39:45.807557Z +63c53951455f8d8769410adb93907b5d +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +10636 + +InstitucionSnapEnum.java +file + + + + +2022-07-28T03:39:45.808557Z +77c5556d0aff50ff3780fdceb4f719a6 +2015-12-15T14:36:46.935255Z +4349 +mcepeda + + + + + + + + + + + + + + + + + + + + + +460 + +InventarioServiceImpl.java +file + + + + +2022-07-28T03:39:45.808557Z +4f437716c087730f9fdc92b0ac5e8d42 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1909 + +ArmaServiceImpl.java +file + + + + +2022-07-28T03:39:45.809557Z +f1103f09a803b404412bede533929efd +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +3256 + +DocumentosServiceImpl.java +file + + + + +2022-07-28T03:39:45.809557Z +50ad73fd3c11f2062921d15bb48fdac5 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1545 + +ConsultaLoginServiceImpl.java +file + + + + +2022-07-28T03:39:45.810557Z +5bae64aa11dc2835ea6483369b45faaf +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1843 + +ColaImpresionServiceImpl.java +file + + + + +2022-07-28T03:39:45.810557Z +fba967dd34408566cb465a0f34f51749 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +6971 + diff --git a/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/prop-base/ArmaServiceImpl.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/prop-base/ArmaServiceImpl.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/prop-base/ArmaServiceImpl.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/prop-base/ColaImpresionServiceImpl.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/prop-base/ColaImpresionServiceImpl.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/prop-base/ColaImpresionServiceImpl.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/prop-base/ConsultaLoginServiceImpl.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/prop-base/ConsultaLoginServiceImpl.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/prop-base/ConsultaLoginServiceImpl.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/prop-base/DocumentosServiceImpl.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/prop-base/DocumentosServiceImpl.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/prop-base/DocumentosServiceImpl.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/prop-base/InventarioServiceImpl.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/prop-base/InventarioServiceImpl.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/prop-base/InventarioServiceImpl.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/ArmaServiceImpl.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/ArmaServiceImpl.java.svn-base new file mode 100644 index 0000000..80b98d8 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/ArmaServiceImpl.java.svn-base @@ -0,0 +1,101 @@ +package com.fp.frontend.webservices.impl; + +import javax.jws.WebService; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.webservices.ArmaService; +import com.fp.persistence.parmas.dto.ws.ArmaDto; + +@WebService(endpointInterface="com.fp.frontend.webservices.ArmaService") +public class ArmaServiceImpl implements ArmaService { + + @Override + public ArmaDto obtenerArmaId(String carma) { + // TODO Auto-generated method stub + ArmaDto armaDto = null; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("queryalias", "ARMASWS"); + request.put("codigoarma", carma); + Response response = callerHelper.executeQuery(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + armaDto = (ArmaDto) response.get("ARMASWS"); + } + return armaDto; + } catch (Throwable e) { + return null; + } + } + + @Override + public String vinculaTagArma(String codigoarma, String codigotag) { + String respuesta = "0"; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("CODIGOARMA", codigoarma); + request.put("CODIGOTAG", codigotag); + request.setTransactionModule("30"); + request.setTransactionCode(9999); + request.setTransactionVersion(1); + Response response = callerHelper.executeSave(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + respuesta = (String) response.get("RESPONSESTATUS"); + } + } catch (Throwable e) { + respuesta = "2"; + APPLogger.getLogger().error(e.getMessage(), e); + } + return respuesta; + } + + @Override + public String desvinculaTagArma(String codigoarma, String codigotag) { + String respuesta = "0"; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("CODIGOARMA", codigoarma); + request.put("CODIGOTAG", codigotag); + request.setTransactionModule("30"); + request.setTransactionCode(9998); + request.setTransactionVersion(1); + Response response = callerHelper.executeSave(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + respuesta = (String) response.get("RESPONSESTATUS"); + } + } catch (Throwable e) { + respuesta = "2"; + APPLogger.getLogger().error(e.getMessage(), e); + } + return respuesta; + } + + @Override + public ArmaDto obtenerArmaPorTag(String codigotag) { + // TODO Auto-generated method stub + ArmaDto armaDto = null; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("queryalias", "ARMASWS"); + request.put("codigotag", codigotag); + Response response = callerHelper.executeQuery(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + armaDto = (ArmaDto) response.get("ARMASWS"); + } + return armaDto; + } catch (Throwable e) { + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/ColaImpresionServiceImpl.java.netbeans-base b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/ColaImpresionServiceImpl.java.netbeans-base new file mode 100644 index 0000000..7d4cf9f --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/ColaImpresionServiceImpl.java.netbeans-base @@ -0,0 +1,190 @@ +package com.fp.frontend.webservices.impl; + +import java.io.ByteArrayInputStream; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.jws.WebService; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.webservices.ColaImpresionService; +import com.fp.persistence.parmas.dto.ws.ColaImpresionDto; +import com.fp.persistence.parmas.dto.ws.ImagenDto; +import com.fp.persistence.parmas.dto.ws.JefeCentroControlDto; + +@WebService(endpointInterface="com.fp.frontend.webservices.ColaImpresionService") +public class ColaImpresionServiceImpl implements ColaImpresionService { + + @SuppressWarnings("unchecked") + @Override + public List obtenerDatosPendientesImprimir(String usercode) { + List lcolaImpresion = null; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("usercode", usercode); + request.put("estado", "PIMPR"); + request.put("queryalias", "COLAIMPRESION"); + Response response = callerHelper.executeQuery(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + lcolaImpresion = (List) response.get("COLAIMPRESION"); + } + } catch (Throwable e) { + lcolaImpresion = null; + APPLogger.getLogger().error(e.getMessage(), e); + } + return lcolaImpresion; + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerDocumentosImpresionProceso( + String codigoproceso) { + List lcolaImpresion = null; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("CODIGOSOLICITUD", codigoproceso); + request.put("queryalias", "IMPRESIONPROCESO"); + Response response = callerHelper.executeQuery(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + lcolaImpresion = (List) response.get("COLAIMPRESION"); + } + } catch (Throwable e) { + lcolaImpresion = null; + APPLogger.getLogger().error(e.getMessage(), e); + } + return lcolaImpresion; + } + + @Override + public JefeCentroControlDto obtenerJefeCentroArmas(String numerodocumento) { + JefeCentroControlDto jefeCentroControl = null; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("NUMERODOCUMENTO", numerodocumento); + request.put("queryalias", "JEFECENTRO"); + Response response = callerHelper.executeQuery(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + jefeCentroControl = (JefeCentroControlDto) response.get("JEFECENTRO"); + } + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + return jefeCentroControl; + } + + @Override + public ImagenDto obtenerImagenPersona(String numeroidentificacion) { + System.out.println("obtenerImagenPersona.........."+numeroidentificacion); + ImagenDto imagen = null; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("NUMEROIDENTIFICACION", numeroidentificacion); + request.put("queryalias", "IMAGENPERSONA"); + System.out.println("obtenerImagenPersona..........** "+numeroidentificacion); + Response response = callerHelper.executeQuery(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + imagen = (ImagenDto) response.get("IMAGENPERSONA"); + System.out.println("..Imagen.........."+imagen); + } + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + return imagen; + } + + @Override + public String envioInforme(byte[] documento, String numerosolicitud) { + System.out.println("envioInforme............................"+numerosolicitud); + String responseStatus = "0"; + try { + if(documento == null || numerosolicitud == null){ + return "1"; + } + + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("NUMEROSOLICITUD", numerosolicitud); + request.put("queryalias", "XPATHDOCUMENTOSOLICITUD"); + request.setTransactionModule("30"); + request.setTransactionCode(9995); + request.setTransactionVersion(1); + Response response = callerHelper.executeSave(request); + String xpathdocumento = null; + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + xpathdocumento = (String) response.get("XPATHDOCUMENTOSOLICITUD"); + responseStatus = (String) response.get("RESPONSESTATUS"); + + } + + if(xpathdocumento != null){ + AlfrescoController alfrescoController = new AlfrescoController(); + alfrescoController.uploadFileWebService(new ByteArrayInputStream(documento), obtenerNombreArchivoxPath(xpathdocumento), obtenerXpath(xpathdocumento),"admin"); + responseStatus = "0"; + } else{ + responseStatus = "3"; + } + } catch (Throwable e) { + responseStatus = "2"; + } + return responseStatus; + } + + /** + * Retorna el nombre del archivo del xpath enviado + * @param xpath + * @return + */ + private String obtenerNombreArchivoxPath(String xpath) { + String nombreArchivo = null; + int indice = xpath.lastIndexOf("/cm:"); + nombreArchivo = xpath.substring(indice + 4); + return nombreArchivo; + } + + /** + * Retorna el xpath de la ruta en donde se va a almacenar el documento + * @param xpath ruta en donde se almacenará el archivo + * @return + */ + private String obtenerXpath(String xpath) { + String rutaXpath = null; + int indice = xpath.lastIndexOf("/cm:"); + rutaXpath = xpath.substring(0, indice ); + return rutaXpath; + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase(Date fechaEmision, String numerosolicitud, String numerodocumento) { + StringBuilder ruta = null; + if (fechaEmision != null && numerosolicitud != null + && numerodocumento != null) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(fechaEmision); + ruta = new StringBuilder("cm:Solicitud"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + ruta = ruta.append("/cm:").append(numerosolicitud); + ruta = ruta.append("/cm:").append(numerodocumento+".pdf"); + } + return ruta != null ? ruta.toString() : null; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/ColaImpresionServiceImpl.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/ColaImpresionServiceImpl.java.svn-base new file mode 100644 index 0000000..7d4cf9f --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/ColaImpresionServiceImpl.java.svn-base @@ -0,0 +1,190 @@ +package com.fp.frontend.webservices.impl; + +import java.io.ByteArrayInputStream; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.jws.WebService; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.webservices.ColaImpresionService; +import com.fp.persistence.parmas.dto.ws.ColaImpresionDto; +import com.fp.persistence.parmas.dto.ws.ImagenDto; +import com.fp.persistence.parmas.dto.ws.JefeCentroControlDto; + +@WebService(endpointInterface="com.fp.frontend.webservices.ColaImpresionService") +public class ColaImpresionServiceImpl implements ColaImpresionService { + + @SuppressWarnings("unchecked") + @Override + public List obtenerDatosPendientesImprimir(String usercode) { + List lcolaImpresion = null; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("usercode", usercode); + request.put("estado", "PIMPR"); + request.put("queryalias", "COLAIMPRESION"); + Response response = callerHelper.executeQuery(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + lcolaImpresion = (List) response.get("COLAIMPRESION"); + } + } catch (Throwable e) { + lcolaImpresion = null; + APPLogger.getLogger().error(e.getMessage(), e); + } + return lcolaImpresion; + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerDocumentosImpresionProceso( + String codigoproceso) { + List lcolaImpresion = null; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("CODIGOSOLICITUD", codigoproceso); + request.put("queryalias", "IMPRESIONPROCESO"); + Response response = callerHelper.executeQuery(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + lcolaImpresion = (List) response.get("COLAIMPRESION"); + } + } catch (Throwable e) { + lcolaImpresion = null; + APPLogger.getLogger().error(e.getMessage(), e); + } + return lcolaImpresion; + } + + @Override + public JefeCentroControlDto obtenerJefeCentroArmas(String numerodocumento) { + JefeCentroControlDto jefeCentroControl = null; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("NUMERODOCUMENTO", numerodocumento); + request.put("queryalias", "JEFECENTRO"); + Response response = callerHelper.executeQuery(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + jefeCentroControl = (JefeCentroControlDto) response.get("JEFECENTRO"); + } + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + return jefeCentroControl; + } + + @Override + public ImagenDto obtenerImagenPersona(String numeroidentificacion) { + System.out.println("obtenerImagenPersona.........."+numeroidentificacion); + ImagenDto imagen = null; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("NUMEROIDENTIFICACION", numeroidentificacion); + request.put("queryalias", "IMAGENPERSONA"); + System.out.println("obtenerImagenPersona..........** "+numeroidentificacion); + Response response = callerHelper.executeQuery(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + imagen = (ImagenDto) response.get("IMAGENPERSONA"); + System.out.println("..Imagen.........."+imagen); + } + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + return imagen; + } + + @Override + public String envioInforme(byte[] documento, String numerosolicitud) { + System.out.println("envioInforme............................"+numerosolicitud); + String responseStatus = "0"; + try { + if(documento == null || numerosolicitud == null){ + return "1"; + } + + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("NUMEROSOLICITUD", numerosolicitud); + request.put("queryalias", "XPATHDOCUMENTOSOLICITUD"); + request.setTransactionModule("30"); + request.setTransactionCode(9995); + request.setTransactionVersion(1); + Response response = callerHelper.executeSave(request); + String xpathdocumento = null; + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + xpathdocumento = (String) response.get("XPATHDOCUMENTOSOLICITUD"); + responseStatus = (String) response.get("RESPONSESTATUS"); + + } + + if(xpathdocumento != null){ + AlfrescoController alfrescoController = new AlfrescoController(); + alfrescoController.uploadFileWebService(new ByteArrayInputStream(documento), obtenerNombreArchivoxPath(xpathdocumento), obtenerXpath(xpathdocumento),"admin"); + responseStatus = "0"; + } else{ + responseStatus = "3"; + } + } catch (Throwable e) { + responseStatus = "2"; + } + return responseStatus; + } + + /** + * Retorna el nombre del archivo del xpath enviado + * @param xpath + * @return + */ + private String obtenerNombreArchivoxPath(String xpath) { + String nombreArchivo = null; + int indice = xpath.lastIndexOf("/cm:"); + nombreArchivo = xpath.substring(indice + 4); + return nombreArchivo; + } + + /** + * Retorna el xpath de la ruta en donde se va a almacenar el documento + * @param xpath ruta en donde se almacenará el archivo + * @return + */ + private String obtenerXpath(String xpath) { + String rutaXpath = null; + int indice = xpath.lastIndexOf("/cm:"); + rutaXpath = xpath.substring(0, indice ); + return rutaXpath; + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase(Date fechaEmision, String numerosolicitud, String numerodocumento) { + StringBuilder ruta = null; + if (fechaEmision != null && numerosolicitud != null + && numerodocumento != null) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(fechaEmision); + ruta = new StringBuilder("cm:Solicitud"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH)+1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH)+1)); + ruta = ruta.append("/cm:").append(numerosolicitud); + ruta = ruta.append("/cm:").append(numerodocumento+".pdf"); + } + return ruta != null ? ruta.toString() : null; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/ConsultaLoginServiceImpl.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/ConsultaLoginServiceImpl.java.svn-base new file mode 100644 index 0000000..8b25b48 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/ConsultaLoginServiceImpl.java.svn-base @@ -0,0 +1,55 @@ +package com.fp.frontend.webservices.impl; + +import javax.jws.WebService; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.webservices.ConsultaLoginService; + +@WebService(endpointInterface="com.fp.frontend.webservices.ConsultaLoginService") +public class ConsultaLoginServiceImpl implements ConsultaLoginService { + + @Override + public String consultaLogin(String usercode) { + String respuesta = "0"; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("USERCODE", usercode); + request.put("queryalias", "CONSULTALOGIN"); + Response response = callerHelper.executeQuery(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + respuesta = (String) response.get("RESPUESTA"); + } + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + respuesta = "2"; + } + return respuesta; + } + + @Override + public String consultaLoginPassword(String usercode, String password) { + String respuesta = "0"; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("USERCODE", usercode); + request.put("PASSWORD", password); + request.put("queryalias", "CONSULTALOGIN"); + Response response = callerHelper.executeQuery(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + respuesta = (String) response.get("RESPUESTA");//esta contiene la localidad de la direccion principal del usuario + } + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + respuesta = "2"; + } + return respuesta; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/DatosSnapServiceImpl.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/DatosSnapServiceImpl.java.svn-base new file mode 100644 index 0000000..1ecece1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/DatosSnapServiceImpl.java.svn-base @@ -0,0 +1,238 @@ +package com.fp.frontend.webservices.impl; + +import java.io.IOException; +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.jws.WebService; +import javax.xml.bind.JAXBException; + +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.codec.binary.StringUtils; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.io.IOUtils; + +import com.fp.alfresco.client.AlfrescoApi; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.webservices.DatosSnapService; +import com.fp.frontend.webservices.snap.modelo.CabeceraXml; +import com.fp.frontend.webservices.snap.modelo.DatosArmaXml; +import com.fp.frontend.webservices.snap.modelo.EjecucionXml; +import com.fp.frontend.webservices.snap.modelo.GuardiaXml; +import com.fp.frontend.webservices.snap.modelo.ImagenXml; +import com.fp.frontend.webservices.snap.modelo.ResultadoXml; +import com.fp.frontend.webservices.snap.modelo.SoapEnvelopWrapper; +import com.fp.frontend.webservices.snap.modelo.TramiteXml; +import com.fp.persistence.parmas.dto.ws.DatosArmaDto; +import com.fp.persistence.parmas.dto.ws.DatosSnapDto; +import com.fp.persistence.parmas.dto.ws.InfoGuardiaDto; +import com.fp.persistence.parmas.dto.ws.TramiteDto; +/** + * Web Service para poner a disposicin la informacin de armas + * @author Manuel Cepeda + * + */ +@WebService(endpointInterface="com.fp.frontend.webservices.DatosSnapService") +public class DatosSnapServiceImpl implements DatosSnapService { + + /** + * Implementacion del metodo que permite obtener la informacion de armas a ser publicada + * @param institucion + * @param nroDocumento + * @param serie + */ + @Override + public SoapEnvelopWrapper obtenerDatos(String institucion, String nroDocumento, String serie) throws JAXBException { + + SimpleDateFormat formatoFecha = new SimpleDateFormat("dd/MM/yyyy"); + SimpleDateFormat formatoHora = new SimpleDateFormat("HH:mm:ss"); + if("EXITO".equals(verificarDatos(institucion, nroDocumento, serie))){ + CabeceraXml cabeceraXml = new CabeceraXml("XC001",formatoFecha.format(new Date()), formatoHora.format(new Date())); + + if(institucion.equals(InstitucionSnapEnum.MINISTERIO_MINAS.getNombre())){ + DatosSnapDto personaSnapDto = obtenerPersonDetail(nroDocumento, institucion, serie); + if(personaSnapDto != null){ + ResultadoXml resultadoXml = new ResultadoXml(personaSnapDto.getRazonSocial(), personaSnapDto.getDireccion(), personaSnapDto.getEmail(), personaSnapDto.getTelefonoFijo(), personaSnapDto.getTelefonoCelular()); + List listaTramites = new ArrayList<>(); + for(TramiteDto tramiteDto : personaSnapDto.getListaTramites()){ + TramiteXml tramiteXml = new TramiteXml(formatoFecha.format(tramiteDto.getFechaEmision()), formatoFecha.format(tramiteDto.getFechaExpiracion()), tramiteDto.getNumeroDocumento()); + listaTramites.add(tramiteXml); + } + resultadoXml.setListaTramites(listaTramites); + + EjecucionXml ejecucionXml = new EjecucionXml(1,"","","12345678"); + SoapEnvelopWrapper soap = new SoapEnvelopWrapper(cabeceraXml, ejecucionXml, resultadoXml); + return soap; + }else{ + return null; + } + + }else if(institucion.equals(InstitucionSnapEnum.CRIMINALISTICA.getNombre()) || institucion.equals(InstitucionSnapEnum.COPS.getNombre()) || institucion.equals(InstitucionSnapEnum.FISCALIA_GENERAL.getNombre())){ + DatosSnapDto personaSnapDto = obtenerPersonDetail(nroDocumento, institucion, serie); + if(personaSnapDto != null){ + ResultadoXml resultadoXml = new ResultadoXml(personaSnapDto.getRazonSocial(), personaSnapDto.getDireccion(), personaSnapDto.getEmail(), personaSnapDto.getTelefonoFijo(), personaSnapDto.getTelefonoCelular()); + String xPathLocation=personaSnapDto.getxPathLocation(); + if(institucion.equals(InstitucionSnapEnum.COPS.getNombre())){ + if(personaSnapDto.getTestPsicologico() != null && !"".equals(personaSnapDto.getTestPsicologico())){ + resultadoXml.setTestPsicologico(new ImagenXml(parseToString(xPathLocation + personaSnapDto.getTestPsicologico()), "TestPsicologico", FilenameUtils.getExtension(personaSnapDto.getTestPsicologico()))); + } + } + + List listaTramites = new ArrayList<>(); + for(TramiteDto tramiteDto : personaSnapDto.getListaTramites()){ + TramiteXml tramiteXml = new TramiteXml(formatoFecha.format(tramiteDto.getFechaEmision()), formatoFecha.format(tramiteDto.getFechaExpiracion()), tramiteDto.getNumeroDocumento()); + listaTramites.add(tramiteXml); + } + resultadoXml.setListaTramites(listaTramites); + + List listaGuardias = new ArrayList<>(); + if(personaSnapDto.getListaGuardias() != null && !personaSnapDto.getListaGuardias().isEmpty()){ + for(InfoGuardiaDto infoGuardiaDto : personaSnapDto.getListaGuardias()){ + GuardiaXml guardiaXml = new GuardiaXml(infoGuardiaDto.getNombre(), infoGuardiaDto.getEmpresa(), infoGuardiaDto.getEstado()); + listaGuardias.add(guardiaXml); + } + resultadoXml.setListaGuardias(listaGuardias); + } + + + try { + if(personaSnapDto.getListaDatosArma() != null && !personaSnapDto.getListaDatosArma().isEmpty()){ + List listaDatosArmaXml = new ArrayList<>(); + for(DatosArmaDto datosArmaDto : personaSnapDto.getListaDatosArma()){ + DatosArmaXml datosArmaXml = new DatosArmaXml(); + + datosArmaXml.setLote(datosArmaDto.getLote()); + datosArmaXml.setDescripcionClase(datosArmaDto.getDescripcionClase()); + datosArmaXml.setDescripcionTipo(datosArmaDto.getDescripcionTipo()); + datosArmaXml.setTipofabricante(datosArmaDto.getTipoFabricacion()); + datosArmaXml.setMarca(datosArmaDto.getMarca()); + datosArmaXml.setCalibre(datosArmaDto.getCalibre()); + datosArmaXml.setModeloArma(datosArmaDto.getModelo()); + datosArmaXml.setEstadoArma(datosArmaDto.getEstadoArma()); + List listaImagen = new ArrayList<>(); + if(institucion.equals(InstitucionSnapEnum.CRIMINALISTICA.getNombre())){ + if(datosArmaDto.getImagenImpronta() != null && !"".equals(datosArmaDto.getImagenImpronta())){ + listaImagen.add(new ImagenXml(parseToString(xPathLocation + datosArmaDto.getImagenImpronta()), "ImagenImpronta", FilenameUtils.getExtension(datosArmaDto.getImagenImpronta()))); + } + if(datosArmaDto.getImagenArma() != null && !"".equals(datosArmaDto.getImagenArma())){ + listaImagen.add(new ImagenXml(parseToString(xPathLocation + datosArmaDto.getImagenArma()), "ImagenArma", FilenameUtils.getExtension(datosArmaDto.getImagenArma()))); + } + } + if(datosArmaDto.getFichaTecnicaArma() != null && !"".equals(datosArmaDto.getFichaTecnicaArma())){ + listaImagen.add(new ImagenXml(parseToString(xPathLocation + datosArmaDto.getFichaTecnicaArma()), "FichaTecnicaArma", FilenameUtils.getExtension(datosArmaDto.getFichaTecnicaArma()))); + } + datosArmaXml.setListaImagen(listaImagen); + + listaDatosArmaXml.add(datosArmaXml); + } + resultadoXml.setListaDatosArma(listaDatosArmaXml); + } + } catch (Exception e) { + e.printStackTrace(); + } + EjecucionXml ejecucionXml = new EjecucionXml(1,"","","12345678"); + SoapEnvelopWrapper soap = new SoapEnvelopWrapper(cabeceraXml, ejecucionXml, resultadoXml); + return soap; + } + } + }else{ + CabeceraXml cabeceraXml = new CabeceraXml("XC001",formatoFecha.format(new Date()), formatoHora.format(new Date())); + EjecucionXml ejecucionXml = new EjecucionXml(0,verificarDatos(institucion, nroDocumento, serie),"",""); + ResultadoXml resultadoXml = new ResultadoXml(); + + SoapEnvelopWrapper soap = new SoapEnvelopWrapper(cabeceraXml, ejecucionXml, resultadoXml); + return soap; + } + // TODO Auto-generated method stub + return null; + } + + /** + * Permite hacer la conversion de un archivo a String en Base 64 + * @param path + * @return + */ + public String parseToString(String path){ + AlfrescoApi api = new AlfrescoApi("comaco"); + try { + InputStream is = api.downloadDocumentByXPathLocation(path); + if(is != null){ + byte[] targetArray = IOUtils.toByteArray(is); + if(targetArray != null){ + Base64 obj = new Base64(); + String aux = StringUtils.newStringUtf8(obj.encodeBase64(targetArray, false)); + //System.out.println("aux prueba string---------------- : " + aux); + return aux; + }else{ + return null; + } + } + } catch (IOException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + /** + * Permite validar los datos de ingreso del WS + * @param institucion + * @param nroDocumento + * @param serie + * @return + */ + public String verificarDatos(String institucion, String nroDocumento, String serie){ + if(institucion == null || "".equals(institucion)){ + return "Debe ingresar la institucion"; + } + + if(nroDocumento == null || "".equals(nroDocumento)){ + return "Debe ingresar la nroDocumento"; + } + if(!institucion.equals(InstitucionSnapEnum.MINISTERIO_MINAS.getNombre())){ + if(serie == null || "".equals(serie)){ + return "Debe ingresar la serie"; + } + } + + return "EXITO"; + } + + /** + * Obtiene la informacion necesaria de armas a ser expuesta por el WS de acuerdo a la institucion que solita. + * @param identificacion + * @param institucion + * @param serie + * @return + */ + public DatosSnapDto obtenerPersonDetail(String identificacion, String institucion, String serie) { + // TODO Auto-generated method stub + DatosSnapDto personaSnapDto = null; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("queryalias", "DATOSPERSONSNAP"); + request.put("identificacion", identificacion); + request.put("institucion", institucion); + request.put("serie", serie); + Response response = callerHelper.executeQuery(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + personaSnapDto = (DatosSnapDto) response.get("DATOSPERSONSNAP"); + } + return personaSnapDto; + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/DocumentosServiceImpl.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/DocumentosServiceImpl.java.svn-base new file mode 100644 index 0000000..6989fd7 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/DocumentosServiceImpl.java.svn-base @@ -0,0 +1,42 @@ +package com.fp.frontend.webservices.impl; + +import java.util.Date; + +import javax.jws.WebService; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.webservices.DocumentosService; + +@WebService(endpointInterface="com.fp.frontend.webservices.DocumentosService") +public class DocumentosServiceImpl implements DocumentosService { + + @Override + public String guardaDatosDocumentos(byte[] foto, String codigoproceso, String codigotarjeta, + Date fechaimpresion) { + String respuesta = "0"; + System.out.println("codigoproceso.."+codigoproceso+ " codigotarjeta.."+codigotarjeta+" fechaimpresion.."+fechaimpresion); + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.setTransactionModule("30"); + request.setTransactionCode(9997); + request.setTransactionVersion(1); + request.put("FOTO", foto); + request.put("CODIGOSOLICITUD", codigoproceso); + request.put("CODIGOTARJETA", codigotarjeta); + request.put("FECHAIMPRESION", fechaimpresion); + System.out.println("codigoproceso.."+codigoproceso+ " codigotarjeta.."+codigotarjeta+" fechaimpresion.."+fechaimpresion); + Response response = callerHelper.executeSave(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + respuesta = (String) response.get("RESPONSESTATUS"); + } + } catch (Throwable e) { + respuesta = "2"; + } + return respuesta; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/InstitucionSnapEnum.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/InstitucionSnapEnum.java.svn-base new file mode 100644 index 0000000..2ef054b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/InstitucionSnapEnum.java.svn-base @@ -0,0 +1,27 @@ +package com.fp.frontend.webservices.impl; + +public enum InstitucionSnapEnum { + + CRIMINALISTICA("CRIMINALISTICA"), + MINISTERIO_MINAS("MINERIA"), + COPS("COPS"), + FISCALIA_GENERAL("FGE"); + + private String nombre; + + private InstitucionSnapEnum(String nombre) { + this.nombre = nombre; + } + + /** + * @return the nombre + */ + public String getNombre() { + return nombre; + } + + @Override + public String toString() { + return this.nombre; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/InventarioServiceImpl.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/InventarioServiceImpl.java.svn-base new file mode 100644 index 0000000..3ee62ba --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/impl/.svn/text-base/InventarioServiceImpl.java.svn-base @@ -0,0 +1,55 @@ +package com.fp.frontend.webservices.impl; + +import java.util.Date; + +import javax.jws.WebService; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.webservices.InventarioService; + +@WebService(endpointInterface="com.fp.frontend.webservices.InventarioService") +public class InventarioServiceImpl implements InventarioService { + + @Override + public String guardaDatosLectura(String tagslectura, Date fechalectura, String locacionlectura, String idportal, String tipooperacion) { + String respuesta = "0"; + try { + System.out.println("INGRESO PORTAL ........"); + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.setTransactionModule("30"); + request.setTransactionCode(9996); + request.setTransactionVersion(1); + request.put("TAGSLECTURA", tagslectura); + if(tipooperacion.equals("HHD")){ + request.put("FECHALECTURA", new Date()); + }else{ + request.put("FECHALECTURA", fechalectura); + } + + request.put("LOCACIONLECTURA", locacionlectura); + request.put("IDPORTAL", idportal); + request.put("TIPOOPERACION", tipooperacion); + Response response = callerHelper.executeSave(request); + if(response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0){ + respuesta = (String) response.get("RESPONSESTATUS"); + } else{ + respuesta = "2"; + } + } catch (Throwable e) { + System.out.println("error:.........."+e); + respuesta = "1"; + APPLogger.getLogger().error(e.getMessage(), e); + } + return respuesta; + } + + public static void main(String[] args) { + InventarioServiceImpl guarda= new InventarioServiceImpl(); + System.out.println(guarda.guardaDatosLectura("E2003098851500251190A810", new Date(), "GUAYAS", "0001", "PTL")); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/impl/ArmaServiceImpl.java b/frontend/src/main/java/com/fp/frontend/webservices/impl/ArmaServiceImpl.java new file mode 100644 index 0000000..58506e7 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/impl/ArmaServiceImpl.java @@ -0,0 +1,101 @@ +package com.fp.frontend.webservices.impl; + +import javax.jws.WebService; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.webservices.ArmaService; +import com.fp.persistence.parmas.dto.ws.ArmaDto; + +@WebService(endpointInterface = "com.fp.frontend.webservices.ArmaService") +public class ArmaServiceImpl implements ArmaService { + + @Override + public ArmaDto obtenerArmaId(String carma) { + // TODO Auto-generated method stub + ArmaDto armaDto = null; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("queryalias", "ARMASWS"); + request.put("codigoarma", carma); + Response response = callerHelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + armaDto = (ArmaDto) response.get("ARMASWS"); + } + return armaDto; + } catch (Throwable e) { + return null; + } + } + + @Override + public String vinculaTagArma(String codigoarma, String codigotag) { + String respuesta = "0"; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("CODIGOARMA", codigoarma); + request.put("CODIGOTAG", codigotag); + request.setTransactionModule("30"); + request.setTransactionCode(9999); + request.setTransactionVersion(1); + Response response = callerHelper.executeSave(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + respuesta = (String) response.get("RESPONSESTATUS"); + } + } catch (Throwable e) { + respuesta = "2"; + APPLogger.getLogger().error(e.getMessage(), e); + } + return respuesta; + } + + @Override + public String desvinculaTagArma(String codigoarma, String codigotag) { + String respuesta = "0"; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("CODIGOARMA", codigoarma); + request.put("CODIGOTAG", codigotag); + request.setTransactionModule("30"); + request.setTransactionCode(9998); + request.setTransactionVersion(1); + Response response = callerHelper.executeSave(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + respuesta = (String) response.get("RESPONSESTATUS"); + } + } catch (Throwable e) { + respuesta = "2"; + APPLogger.getLogger().error(e.getMessage(), e); + } + return respuesta; + } + + @Override + public ArmaDto obtenerArmaPorTag(String codigotag) { + // TODO Auto-generated method stub + ArmaDto armaDto = null; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("queryalias", "ARMASWS"); + request.put("codigotag", codigotag); + Response response = callerHelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + armaDto = (ArmaDto) response.get("ARMASWS"); + } + return armaDto; + } catch (Throwable e) { + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/impl/ColaImpresionServiceImpl.java b/frontend/src/main/java/com/fp/frontend/webservices/impl/ColaImpresionServiceImpl.java new file mode 100644 index 0000000..6248570 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/impl/ColaImpresionServiceImpl.java @@ -0,0 +1,192 @@ +package com.fp.frontend.webservices.impl; + +import java.io.ByteArrayInputStream; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.jws.WebService; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.controller.alfresco.AlfrescoController; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.webservices.ColaImpresionService; +import com.fp.persistence.parmas.dto.ws.ColaImpresionDto; +import com.fp.persistence.parmas.dto.ws.ImagenDto; +import com.fp.persistence.parmas.dto.ws.JefeCentroControlDto; + +@WebService(endpointInterface = "com.fp.frontend.webservices.ColaImpresionService") +public class ColaImpresionServiceImpl implements ColaImpresionService { + + @SuppressWarnings("unchecked") + @Override + public List obtenerDatosPendientesImprimir(String usercode) { + List lcolaImpresion = null; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("usercode", usercode); + request.put("estado", "PIMPR"); + request.put("queryalias", "COLAIMPRESION"); + Response response = callerHelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + lcolaImpresion = (List) response.get("COLAIMPRESION"); + } + } catch (Throwable e) { + lcolaImpresion = null; + APPLogger.getLogger().error(e.getMessage(), e); + } + return lcolaImpresion; + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerDocumentosImpresionProceso( + String codigoproceso) { + List lcolaImpresion = null; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("CODIGOSOLICITUD", codigoproceso); + request.put("queryalias", "IMPRESIONPROCESO"); + Response response = callerHelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + lcolaImpresion = (List) response.get("COLAIMPRESION"); + } + } catch (Throwable e) { + lcolaImpresion = null; + APPLogger.getLogger().error(e.getMessage(), e); + } + return lcolaImpresion; + } + + @Override + public JefeCentroControlDto obtenerJefeCentroArmas(String numerodocumento) { + JefeCentroControlDto jefeCentroControl = null; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("NUMERODOCUMENTO", numerodocumento); + request.put("queryalias", "JEFECENTRO"); + Response response = callerHelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + jefeCentroControl = (JefeCentroControlDto) response.get("JEFECENTRO"); + } + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + return jefeCentroControl; + } + + @Override + public ImagenDto obtenerImagenPersona(String numeroidentificacion) { + System.out.println("obtenerImagenPersona.........." + numeroidentificacion); + ImagenDto imagen = null; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("NUMEROIDENTIFICACION", numeroidentificacion); + request.put("queryalias", "IMAGENPERSONA"); + System.out.println("obtenerImagenPersona..........** " + numeroidentificacion); + Response response = callerHelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + imagen = (ImagenDto) response.get("IMAGENPERSONA"); + System.out.println("..Imagen.........." + imagen); + } + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + return imagen; + } + + @Override + public String envioInforme(byte[] documento, String numerosolicitud) { + System.out.println("envioInforme............................" + numerosolicitud); + String responseStatus = "0"; + try { + if (documento == null || numerosolicitud == null) { + return "1"; + } + + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("NUMEROSOLICITUD", numerosolicitud); + request.put("queryalias", "XPATHDOCUMENTOSOLICITUD"); + request.setTransactionModule("30"); + request.setTransactionCode(9995); + request.setTransactionVersion(1); + Response response = callerHelper.executeSave(request); + String xpathdocumento = null; + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + xpathdocumento = (String) response.get("XPATHDOCUMENTOSOLICITUD"); + responseStatus = (String) response.get("RESPONSESTATUS"); + + } + + if (xpathdocumento != null) { + AlfrescoController alfrescoController = new AlfrescoController(); + alfrescoController.uploadFileWebService(new ByteArrayInputStream(documento), obtenerNombreArchivoxPath(xpathdocumento), obtenerXpath(xpathdocumento), "admin"); + responseStatus = "0"; + } else { + responseStatus = "3"; + } + } catch (Throwable e) { + responseStatus = "2"; + } + return responseStatus; + } + + /** + * Retorna el nombre del archivo del xpath enviado + * + * @param xpath + * @return + */ + private String obtenerNombreArchivoxPath(String xpath) { + String nombreArchivo = null; + int indice = xpath.lastIndexOf("/cm:"); + nombreArchivo = xpath.substring(indice + 4); + return nombreArchivo; + } + + /** + * Retorna el xpath de la ruta en donde se va a almacenar el documento + * + * @param xpath ruta en donde se almacenará el archivo + * @return + */ + private String obtenerXpath(String xpath) { + String rutaXpath = null; + int indice = xpath.lastIndexOf("/cm:"); + rutaXpath = xpath.substring(0, indice); + return rutaXpath; + } + + /** + * Retorna la ruta base donde se almacenara dicho archivo + * + * @return + */ + public String getRutaDocumentoSolBase(Date fechaEmision, String numerosolicitud, String numerodocumento) { + StringBuilder ruta = null; + if (fechaEmision != null && numerosolicitud != null + && numerodocumento != null) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(fechaEmision); + ruta = new StringBuilder("cm:Solicitud"); + ruta = ruta.append("/cm:A-").append(calendar.get(Calendar.YEAR)); + ruta = ruta.append("/cm:M-").append((calendar.get(Calendar.MONTH) + 1) <= 9 ? "0" + (calendar.get(Calendar.MONTH) + 1) : (calendar.get(Calendar.MONTH) + 1)); + ruta = ruta.append("/cm:").append(numerosolicitud); + ruta = ruta.append("/cm:").append(numerodocumento + ".pdf"); + } + return ruta != null ? ruta.toString() : null; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/impl/ConsultaLoginServiceImpl.java b/frontend/src/main/java/com/fp/frontend/webservices/impl/ConsultaLoginServiceImpl.java new file mode 100644 index 0000000..d77935b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/impl/ConsultaLoginServiceImpl.java @@ -0,0 +1,55 @@ +package com.fp.frontend.webservices.impl; + +import javax.jws.WebService; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.webservices.ConsultaLoginService; + +@WebService(endpointInterface = "com.fp.frontend.webservices.ConsultaLoginService") +public class ConsultaLoginServiceImpl implements ConsultaLoginService { + + @Override + public String consultaLogin(String usercode) { + String respuesta = "0"; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("USERCODE", usercode); + request.put("queryalias", "CONSULTALOGIN"); + Response response = callerHelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + respuesta = (String) response.get("RESPUESTA"); + } + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + respuesta = "2"; + } + return respuesta; + } + + @Override + public String consultaLoginPassword(String usercode, String password) { + String respuesta = "0"; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("USERCODE", usercode); + request.put("PASSWORD", password); + request.put("queryalias", "CONSULTALOGIN"); + Response response = callerHelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + respuesta = (String) response.get("RESPUESTA");//esta contiene la localidad de la direccion principal del usuario + } + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + respuesta = "2"; + } + return respuesta; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/impl/DatosSnapServiceImpl.java b/frontend/src/main/java/com/fp/frontend/webservices/impl/DatosSnapServiceImpl.java new file mode 100644 index 0000000..8c09ae2 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/impl/DatosSnapServiceImpl.java @@ -0,0 +1,245 @@ +package com.fp.frontend.webservices.impl; + +import java.io.IOException; +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.jws.WebService; +import javax.xml.bind.JAXBException; + +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.codec.binary.StringUtils; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.io.IOUtils; + +import com.fp.alfresco.client.AlfrescoApi; +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.webservices.DatosSnapService; +import com.fp.frontend.webservices.snap.modelo.CabeceraXml; +import com.fp.frontend.webservices.snap.modelo.DatosArmaXml; +import com.fp.frontend.webservices.snap.modelo.EjecucionXml; +import com.fp.frontend.webservices.snap.modelo.GuardiaXml; +import com.fp.frontend.webservices.snap.modelo.ImagenXml; +import com.fp.frontend.webservices.snap.modelo.ResultadoXml; +import com.fp.frontend.webservices.snap.modelo.SoapEnvelopWrapper; +import com.fp.frontend.webservices.snap.modelo.TramiteXml; +import com.fp.persistence.parmas.dto.ws.DatosArmaDto; +import com.fp.persistence.parmas.dto.ws.DatosSnapDto; +import com.fp.persistence.parmas.dto.ws.InfoGuardiaDto; +import com.fp.persistence.parmas.dto.ws.TramiteDto; + +/** + * Web Service para poner a disposicin la informacin de armas + * + * @author Manuel Cepeda + * + */ +@WebService(endpointInterface = "com.fp.frontend.webservices.DatosSnapService") +public class DatosSnapServiceImpl implements DatosSnapService { + + /** + * Implementacion del metodo que permite obtener la informacion de armas a + * ser publicada + * + * @param institucion + * @param nroDocumento + * @param serie + */ + @Override + public SoapEnvelopWrapper obtenerDatos(String institucion, String nroDocumento, String serie) throws JAXBException { + + SimpleDateFormat formatoFecha = new SimpleDateFormat("dd/MM/yyyy"); + SimpleDateFormat formatoHora = new SimpleDateFormat("HH:mm:ss"); + if ("EXITO".equals(verificarDatos(institucion, nroDocumento, serie))) { + CabeceraXml cabeceraXml = new CabeceraXml("XC001", formatoFecha.format(new Date()), formatoHora.format(new Date())); + + if (institucion.equals(InstitucionSnapEnum.MINISTERIO_MINAS.getNombre())) { + DatosSnapDto personaSnapDto = obtenerPersonDetail(nroDocumento, institucion, serie); + if (personaSnapDto != null) { + ResultadoXml resultadoXml = new ResultadoXml(personaSnapDto.getRazonSocial(), personaSnapDto.getDireccion(), personaSnapDto.getEmail(), personaSnapDto.getTelefonoFijo(), personaSnapDto.getTelefonoCelular()); + List listaTramites = new ArrayList<>(); + for (TramiteDto tramiteDto : personaSnapDto.getListaTramites()) { + TramiteXml tramiteXml = new TramiteXml(formatoFecha.format(tramiteDto.getFechaEmision()), formatoFecha.format(tramiteDto.getFechaExpiracion()), tramiteDto.getNumeroDocumento()); + listaTramites.add(tramiteXml); + } + resultadoXml.setListaTramites(listaTramites); + + EjecucionXml ejecucionXml = new EjecucionXml(1, "", "", "12345678"); + SoapEnvelopWrapper soap = new SoapEnvelopWrapper(cabeceraXml, ejecucionXml, resultadoXml); + return soap; + } else { + return null; + } + + } else if (institucion.equals(InstitucionSnapEnum.CRIMINALISTICA.getNombre()) || institucion.equals(InstitucionSnapEnum.COPS.getNombre()) || institucion.equals(InstitucionSnapEnum.FISCALIA_GENERAL.getNombre())) { + DatosSnapDto personaSnapDto = obtenerPersonDetail(nroDocumento, institucion, serie); + if (personaSnapDto != null) { + ResultadoXml resultadoXml = new ResultadoXml(personaSnapDto.getRazonSocial(), personaSnapDto.getDireccion(), personaSnapDto.getEmail(), personaSnapDto.getTelefonoFijo(), personaSnapDto.getTelefonoCelular()); + String xPathLocation = personaSnapDto.getxPathLocation(); + if (institucion.equals(InstitucionSnapEnum.COPS.getNombre())) { + if (personaSnapDto.getTestPsicologico() != null && !"".equals(personaSnapDto.getTestPsicologico())) { + resultadoXml.setTestPsicologico(new ImagenXml(parseToString(xPathLocation + personaSnapDto.getTestPsicologico()), "TestPsicologico", FilenameUtils.getExtension(personaSnapDto.getTestPsicologico()))); + } + } + + List listaTramites = new ArrayList<>(); + for (TramiteDto tramiteDto : personaSnapDto.getListaTramites()) { + TramiteXml tramiteXml = new TramiteXml(formatoFecha.format(tramiteDto.getFechaEmision()), formatoFecha.format(tramiteDto.getFechaExpiracion()), tramiteDto.getNumeroDocumento()); + listaTramites.add(tramiteXml); + } + resultadoXml.setListaTramites(listaTramites); + + List listaGuardias = new ArrayList<>(); + if (personaSnapDto.getListaGuardias() != null && !personaSnapDto.getListaGuardias().isEmpty()) { + for (InfoGuardiaDto infoGuardiaDto : personaSnapDto.getListaGuardias()) { + GuardiaXml guardiaXml = new GuardiaXml(infoGuardiaDto.getNombre(), infoGuardiaDto.getEmpresa(), infoGuardiaDto.getEstado()); + listaGuardias.add(guardiaXml); + } + resultadoXml.setListaGuardias(listaGuardias); + } + + try { + if (personaSnapDto.getListaDatosArma() != null && !personaSnapDto.getListaDatosArma().isEmpty()) { + List listaDatosArmaXml = new ArrayList<>(); + for (DatosArmaDto datosArmaDto : personaSnapDto.getListaDatosArma()) { + DatosArmaXml datosArmaXml = new DatosArmaXml(); + + datosArmaXml.setLote(datosArmaDto.getLote()); + datosArmaXml.setDescripcionClase(datosArmaDto.getDescripcionClase()); + datosArmaXml.setDescripcionTipo(datosArmaDto.getDescripcionTipo()); + datosArmaXml.setTipofabricante(datosArmaDto.getTipoFabricacion()); + datosArmaXml.setMarca(datosArmaDto.getMarca()); + datosArmaXml.setCalibre(datosArmaDto.getCalibre()); + datosArmaXml.setModeloArma(datosArmaDto.getModelo()); + datosArmaXml.setEstadoArma(datosArmaDto.getEstadoArma()); + List listaImagen = new ArrayList<>(); + if (institucion.equals(InstitucionSnapEnum.CRIMINALISTICA.getNombre())) { + if (datosArmaDto.getImagenImpronta() != null && !"".equals(datosArmaDto.getImagenImpronta())) { + listaImagen.add(new ImagenXml(parseToString(xPathLocation + datosArmaDto.getImagenImpronta()), "ImagenImpronta", FilenameUtils.getExtension(datosArmaDto.getImagenImpronta()))); + } + if (datosArmaDto.getImagenArma() != null && !"".equals(datosArmaDto.getImagenArma())) { + listaImagen.add(new ImagenXml(parseToString(xPathLocation + datosArmaDto.getImagenArma()), "ImagenArma", FilenameUtils.getExtension(datosArmaDto.getImagenArma()))); + } + } + if (datosArmaDto.getFichaTecnicaArma() != null && !"".equals(datosArmaDto.getFichaTecnicaArma())) { + listaImagen.add(new ImagenXml(parseToString(xPathLocation + datosArmaDto.getFichaTecnicaArma()), "FichaTecnicaArma", FilenameUtils.getExtension(datosArmaDto.getFichaTecnicaArma()))); + } + datosArmaXml.setListaImagen(listaImagen); + + listaDatosArmaXml.add(datosArmaXml); + } + resultadoXml.setListaDatosArma(listaDatosArmaXml); + } + } catch (Exception e) { + e.printStackTrace(); + } + EjecucionXml ejecucionXml = new EjecucionXml(1, "", "", "12345678"); + SoapEnvelopWrapper soap = new SoapEnvelopWrapper(cabeceraXml, ejecucionXml, resultadoXml); + return soap; + } + } + } else { + CabeceraXml cabeceraXml = new CabeceraXml("XC001", formatoFecha.format(new Date()), formatoHora.format(new Date())); + EjecucionXml ejecucionXml = new EjecucionXml(0, verificarDatos(institucion, nroDocumento, serie), "", ""); + ResultadoXml resultadoXml = new ResultadoXml(); + + SoapEnvelopWrapper soap = new SoapEnvelopWrapper(cabeceraXml, ejecucionXml, resultadoXml); + return soap; + } + // TODO Auto-generated method stub + return null; + } + + /** + * Permite hacer la conversion de un archivo a String en Base 64 + * + * @param path + * @return + */ + public String parseToString(String path) { + AlfrescoApi api = new AlfrescoApi("comaco"); + try { + InputStream is = api.downloadDocumentByXPathLocation(path); + if (is != null) { + byte[] targetArray = IOUtils.toByteArray(is); + if (targetArray != null) { + Base64 obj = new Base64(); + String aux = StringUtils.newStringUtf8(obj.encodeBase64(targetArray, false)); + //System.out.println("aux prueba string---------------- : " + aux); + return aux; + } else { + return null; + } + } + } catch (IOException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + /** + * Permite validar los datos de ingreso del WS + * + * @param institucion + * @param nroDocumento + * @param serie + * @return + */ + public String verificarDatos(String institucion, String nroDocumento, String serie) { + if (institucion == null || "".equals(institucion)) { + return "Debe ingresar la institucion"; + } + + if (nroDocumento == null || "".equals(nroDocumento)) { + return "Debe ingresar la nroDocumento"; + } + if (!institucion.equals(InstitucionSnapEnum.MINISTERIO_MINAS.getNombre())) { + if (serie == null || "".equals(serie)) { + return "Debe ingresar la serie"; + } + } + + return "EXITO"; + } + + /** + * Obtiene la informacion necesaria de armas a ser expuesta por el WS de + * acuerdo a la institucion que solita. + * + * @param identificacion + * @param institucion + * @param serie + * @return + */ + public DatosSnapDto obtenerPersonDetail(String identificacion, String institucion, String serie) { + // TODO Auto-generated method stub + DatosSnapDto personaSnapDto = null; + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("queryalias", "DATOSPERSONSNAP"); + request.put("identificacion", identificacion); + request.put("institucion", institucion); + request.put("serie", serie); + Response response = callerHelper.executeQuery(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + personaSnapDto = (DatosSnapDto) response.get("DATOSPERSONSNAP"); + } + return personaSnapDto; + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + + return null; + } + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/impl/DocumentosServiceImpl.java b/frontend/src/main/java/com/fp/frontend/webservices/impl/DocumentosServiceImpl.java new file mode 100644 index 0000000..61bc970 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/impl/DocumentosServiceImpl.java @@ -0,0 +1,42 @@ +package com.fp.frontend.webservices.impl; + +import java.util.Date; + +import javax.jws.WebService; + +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.webservices.DocumentosService; + +@WebService(endpointInterface = "com.fp.frontend.webservices.DocumentosService") +public class DocumentosServiceImpl implements DocumentosService { + + @Override + public String guardaDatosDocumentos(byte[] foto, String codigoproceso, String codigotarjeta, + Date fechaimpresion) { + String respuesta = "0"; + System.out.println("codigoproceso.." + codigoproceso + " codigotarjeta.." + codigotarjeta + " fechaimpresion.." + fechaimpresion); + try { + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.setTransactionModule("30"); + request.setTransactionCode(9997); + request.setTransactionVersion(1); + request.put("FOTO", foto); + request.put("CODIGOSOLICITUD", codigoproceso); + request.put("CODIGOTARJETA", codigotarjeta); + request.put("FECHAIMPRESION", fechaimpresion); + System.out.println("codigoproceso.." + codigoproceso + " codigotarjeta.." + codigotarjeta + " fechaimpresion.." + fechaimpresion); + Response response = callerHelper.executeSave(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + respuesta = (String) response.get("RESPONSESTATUS"); + } + } catch (Throwable e) { + respuesta = "2"; + } + return respuesta; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/impl/InstitucionSnapEnum.java b/frontend/src/main/java/com/fp/frontend/webservices/impl/InstitucionSnapEnum.java new file mode 100644 index 0000000..4cc05bd --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/impl/InstitucionSnapEnum.java @@ -0,0 +1,27 @@ +package com.fp.frontend.webservices.impl; + +public enum InstitucionSnapEnum { + + CRIMINALISTICA("CRIMINALISTICA"), + MINISTERIO_MINAS("MINERIA"), + COPS("COPS"), + FISCALIA_GENERAL("FGE"); + + private String nombre; + + private InstitucionSnapEnum(String nombre) { + this.nombre = nombre; + } + + /** + * @return the nombre + */ + public String getNombre() { + return nombre; + } + + @Override + public String toString() { + return this.nombre; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/impl/InventarioServiceImpl.java b/frontend/src/main/java/com/fp/frontend/webservices/impl/InventarioServiceImpl.java new file mode 100644 index 0000000..d65fb73 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/impl/InventarioServiceImpl.java @@ -0,0 +1,55 @@ +package com.fp.frontend.webservices.impl; + +import java.util.Date; + +import javax.jws.WebService; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.dto.Response; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.webservices.InventarioService; + +@WebService(endpointInterface = "com.fp.frontend.webservices.InventarioService") +public class InventarioServiceImpl implements InventarioService { + + @Override + public String guardaDatosLectura(String tagslectura, Date fechalectura, String locacionlectura, String idportal, String tipooperacion) { + String respuesta = "0"; + try { + System.out.println("INGRESO PORTAL ........"); + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.setTransactionModule("30"); + request.setTransactionCode(9996); + request.setTransactionVersion(1); + request.put("TAGSLECTURA", tagslectura); + if (tipooperacion.equals("HHD")) { + request.put("FECHALECTURA", new Date()); + } else { + request.put("FECHALECTURA", fechalectura); + } + + request.put("LOCACIONLECTURA", locacionlectura); + request.put("IDPORTAL", idportal); + request.put("TIPOOPERACION", tipooperacion); + Response response = callerHelper.executeSave(request); + if (response.getResponseCode().compareTo(Response.RESPONSE_OK) == 0) { + respuesta = (String) response.get("RESPONSESTATUS"); + } else { + respuesta = "2"; + } + } catch (Throwable e) { + System.out.println("error:.........." + e); + respuesta = "1"; + APPLogger.getLogger().error(e.getMessage(), e); + } + return respuesta; + } + + public static void main(String[] args) { + InventarioServiceImpl guarda = new InventarioServiceImpl(); + System.out.println(guarda.guardaDatosLectura("E2003098851500251190A810", new Date(), "GUAYAS", "0001", "PTL")); + } +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/rest/.svn/entries b/frontend/src/main/java/com/fp/frontend/webservices/rest/.svn/entries new file mode 100644 index 0000000..7253ebe --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/rest/.svn/entries @@ -0,0 +1,71 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/webservices/rest +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +RestApplication.java +file + + + + +2022-07-28T03:39:46.162558Z +a1a6243cee56be35a7c5e0b96258e2a4 +2022-01-20T04:13:52.171628Z +4662 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +204 + +services +dir + +dto +dir + +util +dir + diff --git a/frontend/src/main/java/com/fp/frontend/webservices/rest/.svn/text-base/RestApplication.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/rest/.svn/text-base/RestApplication.java.svn-base new file mode 100644 index 0000000..36e0d16 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/rest/.svn/text-base/RestApplication.java.svn-base @@ -0,0 +1,9 @@ +package com.fp.frontend.webservices.rest; + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; + +@ApplicationPath("/rs") +public class RestApplication extends Application { + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/rest/RestApplication.java b/frontend/src/main/java/com/fp/frontend/webservices/rest/RestApplication.java new file mode 100644 index 0000000..36e0d16 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/rest/RestApplication.java @@ -0,0 +1,9 @@ +package com.fp.frontend.webservices.rest; + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; + +@ApplicationPath("/rs") +public class RestApplication extends Application { + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/rest/dto/.svn/entries b/frontend/src/main/java/com/fp/frontend/webservices/rest/dto/.svn/entries new file mode 100644 index 0000000..66a17f4 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/rest/dto/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/webservices/rest/dto +svn://172.17.26.185/COMACO + + + +2022-01-20T04:13:52.171628Z +4662 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +LoginData.java +file + + + + +2022-07-28T03:39:46.094558Z +742d0a96e097108ee3c816f051d33920 +2022-01-20T04:13:52.171628Z +4662 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +514 + +LoginResult.java +file + + + + +2022-07-28T03:39:46.094558Z +d6b7d2be7e7d935f6173877ab5943fd3 +2022-01-20T04:13:52.171628Z +4662 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +651 + +StatusMessage.java +file + + + + +2022-07-28T03:39:46.094558Z +144cdfb31e85361746e2b92fe85e6c4f +2022-01-20T04:13:52.171628Z +4662 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +541 + diff --git a/frontend/src/main/java/com/fp/frontend/webservices/rest/dto/.svn/text-base/LoginData.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/rest/dto/.svn/text-base/LoginData.java.svn-base new file mode 100644 index 0000000..f7981aa --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/rest/dto/.svn/text-base/LoginData.java.svn-base @@ -0,0 +1,24 @@ +package com.fp.frontend.webservices.rest.dto; + +import java.io.Serializable; + +public class LoginData implements Serializable { + + private static final long serialVersionUID = 1L; + + private String username; + private String password; + + public String getUsername() { + return username; + } + public void setUsername(String username) { + this.username = username; + } + public String getPassword() { + return password; + } + public void setPassword(String password) { + this.password = password; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/rest/dto/.svn/text-base/LoginResult.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/rest/dto/.svn/text-base/LoginResult.java.svn-base new file mode 100644 index 0000000..dc7492f --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/rest/dto/.svn/text-base/LoginResult.java.svn-base @@ -0,0 +1,33 @@ +package com.fp.frontend.webservices.rest.dto; + +import java.io.Serializable; + +public class LoginResult implements Serializable { + + private static final long serialVersionUID = 1L; + + private String username; + private String token; + public LoginResult() {} + + public LoginResult(String username, String token) { + super(); + this.username = username; + this.token = token; + } + + public String getUsername() { + return username; + } + public void setUsername(String username) { + this.username = username; + } + public String getToken() { + return token; + } + public void setToken(String token) { + this.token = token; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/rest/dto/.svn/text-base/StatusMessage.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/rest/dto/.svn/text-base/StatusMessage.java.svn-base new file mode 100644 index 0000000..0778dc8 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/rest/dto/.svn/text-base/StatusMessage.java.svn-base @@ -0,0 +1,27 @@ +package com.fp.frontend.webservices.rest.dto; + +public class StatusMessage { + private int status; + private String message; + + public StatusMessage() { + super(); + } + public StatusMessage(int status, String message) { + super(); + this.status = status; + this.message = message; + } + public int getStatus() { + return status; + } + public void setStatus(int status) { + this.status = status; + } + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/rest/dto/LoginData.java b/frontend/src/main/java/com/fp/frontend/webservices/rest/dto/LoginData.java new file mode 100644 index 0000000..7145e23 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/rest/dto/LoginData.java @@ -0,0 +1,27 @@ +package com.fp.frontend.webservices.rest.dto; + +import java.io.Serializable; + +public class LoginData implements Serializable { + + private static final long serialVersionUID = 1L; + + private String username; + private String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/rest/dto/LoginResult.java b/frontend/src/main/java/com/fp/frontend/webservices/rest/dto/LoginResult.java new file mode 100644 index 0000000..b2f624b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/rest/dto/LoginResult.java @@ -0,0 +1,37 @@ +package com.fp.frontend.webservices.rest.dto; + +import java.io.Serializable; + +public class LoginResult implements Serializable { + + private static final long serialVersionUID = 1L; + + private String username; + private String token; + + public LoginResult() { + } + + public LoginResult(String username, String token) { + super(); + this.username = username; + this.token = token; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/rest/dto/StatusMessage.java b/frontend/src/main/java/com/fp/frontend/webservices/rest/dto/StatusMessage.java new file mode 100644 index 0000000..f62a602 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/rest/dto/StatusMessage.java @@ -0,0 +1,33 @@ +package com.fp.frontend.webservices.rest.dto; + +public class StatusMessage { + + private int status; + private String message; + + public StatusMessage() { + super(); + } + + public StatusMessage(int status, String message) { + super(); + this.status = status; + this.message = message; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/rest/services/.svn/entries b/frontend/src/main/java/com/fp/frontend/webservices/rest/services/.svn/entries new file mode 100644 index 0000000..de476a3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/rest/services/.svn/entries @@ -0,0 +1,130 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/webservices/rest/services +svn://172.17.26.185/COMACO + + + +2022-01-20T04:13:52.171628Z +4662 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +SecurityResource.java +file + + + + +2022-07-28T03:39:46.031558Z +c6aaf22b145c5ebef3da6ef2c9a4b9ce +2022-01-20T04:13:52.171628Z +4662 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +3012 + +CommonResource.java +file + + + + +2022-07-28T03:39:46.032558Z +d4543341a48602562df2401a1533bba5 +2022-01-20T04:13:52.171628Z +4662 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +4710 + +ArmasResource.java +file + + + + +2022-07-28T03:39:46.032558Z +45e30e272cf7c64a1b4f542dab79fdb2 +2022-01-20T04:13:52.171628Z +4662 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +2713 + diff --git a/frontend/src/main/java/com/fp/frontend/webservices/rest/services/.svn/text-base/ArmasResource.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/rest/services/.svn/text-base/ArmasResource.java.svn-base new file mode 100644 index 0000000..d003af5 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/rest/services/.svn/text-base/ArmasResource.java.svn-base @@ -0,0 +1,65 @@ +package com.fp.frontend.webservices.rest.services; + +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.webservices.rest.dto.StatusMessage; +import com.fp.frontend.webservices.rest.util.JwtValidateException; +import com.fp.persistence.parmas.dto.ws.ArmaDto; + +@Path("/arma") +@Produces(MediaType.APPLICATION_JSON) +public class ArmasResource extends CommonResource { + + @GET + @Path("/{serie}") + public Response consultarArma(@PathParam("serie") String serie, @HeaderParam("Authorization") String bearerToken) { + Response response = null; + try { + ArmaDto armaDto = null; + validateToken(bearerToken); + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("queryalias", "ARMASWS"); + request.put("codigoarma", serie); + com.fp.dto.Response responseMaia = callerHelper.executeQuery(request); + if(responseMaia.getResponseCode().compareTo(com.fp.dto.Response.RESPONSE_OK) == 0){ + armaDto = (ArmaDto) responseMaia.get("ARMASWS"); + if (armaDto == null) { + throw new WebApplicationException( + Response.status(Status.BAD_REQUEST) + .entity(new StatusMessage(Status.BAD_REQUEST.getStatusCode(), "El cod. arma no existe")).build()); + } + } else { + throw new WebApplicationException( + Response.status(Status.BAD_REQUEST) + .entity(new StatusMessage(Status.BAD_REQUEST.getStatusCode(), "Error al realizar la consulta del arma")).build()); + } + response = Response.ok().entity(armaDto).build(); + } catch (JwtValidateException e) { + APPLogger.getLogger().error(e.getMessage(), e); + response = Response.status(e.getStatusMessage().getStatus()).entity(e.getStatusMessage()).build(); + } catch (WebApplicationException e) { + APPLogger.getLogger().error(e.getMessage(), e); + response = e.getResponse(); + } catch (Exception e) { + APPLogger.getLogger().error(e.getMessage(), e); + response = Response.serverError().entity(new StatusMessage(Status.INTERNAL_SERVER_ERROR.getStatusCode(), e.getMessage())).build(); + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + response = Response.serverError().entity(new StatusMessage(Status.INTERNAL_SERVER_ERROR.getStatusCode(), e.getMessage())).build(); + } + return response; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/rest/services/.svn/text-base/CommonResource.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/rest/services/.svn/text-base/CommonResource.java.svn-base new file mode 100644 index 0000000..a7771ca --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/rest/services/.svn/text-base/CommonResource.java.svn-base @@ -0,0 +1,122 @@ +package com.fp.frontend.webservices.rest.services; + +import java.util.LinkedList; +import java.util.List; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; + +import org.apache.commons.lang.StringUtils; +import org.jose4j.jwk.JsonWebKey; +import org.jose4j.jwk.JsonWebKeySet; +import org.jose4j.jwk.RsaJsonWebKey; +import org.jose4j.jwk.RsaJwkGenerator; +import org.jose4j.jws.AlgorithmIdentifiers; +import org.jose4j.jws.JsonWebSignature; +import org.jose4j.jwt.JwtClaims; +import org.jose4j.jwt.consumer.InvalidJwtException; +import org.jose4j.jwt.consumer.JwtConsumer; +import org.jose4j.jwt.consumer.JwtConsumerBuilder; +import org.jose4j.lang.JoseException; + +import com.fp.common.logger.APPLogger; +import com.fp.frontend.webservices.rest.dto.StatusMessage; +import com.fp.frontend.webservices.rest.util.JwtValidateException; + +public class CommonResource { + + private static String BEARER = "Bearer "; + final static String ISSUER = "ccffaa.mil.ec"; + static List jwkList = null; + static { + APPLogger.getLogger().info("Inicializador estatico JWT..."); + jwkList = new LinkedList<>(); + for (int kid = 1; kid <= 3; kid++) { + JsonWebKey jwk = null; + try { + jwk = RsaJwkGenerator.generateJwk(2048); + APPLogger.getLogger().info("PUBLIC KEY (" + kid + "): " + + jwk.toJson(JsonWebKey.OutputControlLevel.PUBLIC_ONLY)); + } catch (JoseException e) { + APPLogger.getLogger().error(e.getMessage()); + } + jwk.setKeyId(String.valueOf(kid)); + jwkList.add(jwk); + } + } + + protected String generateTokenJwt(String username) { + RsaJsonWebKey senderJwk = (RsaJsonWebKey) jwkList.get(0); + senderJwk.setKeyId("1"); + // Create the Claims, which will be the content of the JWT + JwtClaims claims = new JwtClaims(); + claims.setIssuer(ISSUER); + claims.setExpirationTimeMinutesInTheFuture(60); + claims.setGeneratedJwtId(); + claims.setIssuedAtToNow(); + claims.setNotBeforeMinutesInThePast(2); + claims.setSubject(username); + JsonWebSignature jws = new JsonWebSignature(); + + jws.setPayload(claims.toJson()); + + jws.setKeyIdHeaderValue(senderJwk.getKeyId()); + jws.setKey(senderJwk.getPrivateKey()); + + jws.setAlgorithmHeaderValue(AlgorithmIdentifiers.RSA_USING_SHA256); + + String jwt = null; + try { + jwt = jws.getCompactSerialization(); + } catch (JoseException e) { + throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new StatusMessage(Status.BAD_REQUEST.getStatusCode(), "Error al generar el token JWT")).build()); + } + return jwt; + } + + public void validateToken(String bearerToken) { + try { + String token = getToken(bearerToken); + if (token == null || token.trim().isEmpty()) { + StatusMessage statusMessage = new StatusMessage(); + statusMessage.setStatus(Status.FORBIDDEN.getStatusCode()); + statusMessage.setMessage( + "Acceso Denegado debe enviar el token !!!"); + throw new JwtValidateException(statusMessage); + } + + JsonWebKeySet jwks = new JsonWebKeySet(jwkList); + JsonWebKey jwk = jwks.findJsonWebKey("1", null, null, null); + JwtConsumer jwtConsumer = new JwtConsumerBuilder() + .setRequireExpirationTime() + .setAllowedClockSkewInSeconds(30) + .setRequireSubject() + .setExpectedIssuer(ISSUER) + .setVerificationKey(jwk.getKey()) + .build(); + JwtClaims jwtClaims = jwtConsumer.processToClaims(token); + APPLogger.getLogger().info("JWT validation succeeded! " + jwtClaims); + } catch (InvalidJwtException e) { + APPLogger.getLogger().error("JWT el token no es valida: "); + StatusMessage statusMessage = new StatusMessage(); + statusMessage.setStatus(Status.FORBIDDEN.getStatusCode()); + statusMessage.setMessage("Acceso denegado el token no es valido !!!"); + throw new JwtValidateException(statusMessage); + } catch (Exception e) { + APPLogger.getLogger().error("JWT error a validar el token: "); + StatusMessage statusMessage = new StatusMessage(); + statusMessage.setStatus(Status.FORBIDDEN.getStatusCode()); + statusMessage.setMessage("Acceso denegado el token no es valido !!!"); + throw new JwtValidateException(statusMessage); + } + } + + private String getToken(String bearerToken) { + String token = null; + if (bearerToken.startsWith(BEARER)) { + token = bearerToken.replace(BEARER, StringUtils.EMPTY); + } + return token; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/rest/services/.svn/text-base/SecurityResource.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/rest/services/.svn/text-base/SecurityResource.java.svn-base new file mode 100644 index 0000000..81e593d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/rest/services/.svn/text-base/SecurityResource.java.svn-base @@ -0,0 +1,65 @@ +package com.fp.frontend.webservices.rest.services; + +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.webservices.rest.dto.LoginData; +import com.fp.frontend.webservices.rest.dto.LoginResult; +import com.fp.frontend.webservices.rest.dto.StatusMessage; +import com.fp.frontend.webservices.rest.util.JwtValidateException; + +@Path("/security") +@Produces(MediaType.APPLICATION_JSON) +public class SecurityResource extends CommonResource { + + @POST + @Path("/login") + @Consumes(MediaType.APPLICATION_JSON) + public Response login(LoginData loginData) { + APPLogger.getLogger().info("Ingresa a Login MOB"); + Response response = null; + try { + String respuesta = "0"; + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("USERCODE", loginData.getUsername()); + request.put("PASSWORD", callerHelper.getPasswordEncriptado(loginData.getPassword())); + request.put("queryalias", "CONSULTALOGIN"); + com.fp.dto.Response responseMaia = callerHelper.executeQuery(request); + if(responseMaia.getResponseCode().compareTo(com.fp.dto.Response.RESPONSE_OK) == 0){ + respuesta = (String) responseMaia.get("RESPUESTA");//esta contiene la localidad de la direccion principal del usuario + if (respuesta == null || respuesta.isEmpty()) { + throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new StatusMessage(Status.BAD_REQUEST.getStatusCode(), "Usuario/Password Incorrecto")).build()); + } + } else { + throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new StatusMessage(Status.BAD_REQUEST.getStatusCode(), "Usuario/Password Incorrecto")).build()); + } + String token = generateTokenJwt(loginData.getUsername()); + response = Response.ok().entity(new LoginResult(loginData.getUsername(), token)).build(); + } catch (JwtValidateException e) { + APPLogger.getLogger().error(e.getMessage(), e); + response = Response.status(e.getStatusMessage().getStatus()).entity(e.getStatusMessage()).build(); + } catch (WebApplicationException e) { + APPLogger.getLogger().error(e.getMessage(), e); + response = e.getResponse(); + } catch (Exception e) { + APPLogger.getLogger().error(e.getMessage(), e); + response = Response.serverError().entity(new StatusMessage(Status.INTERNAL_SERVER_ERROR.getStatusCode(), e.getMessage())).build(); + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + response = Response.serverError().entity(new StatusMessage(Status.INTERNAL_SERVER_ERROR.getStatusCode(), e.getMessage())).build(); + } + return response; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/rest/services/ArmasResource.java b/frontend/src/main/java/com/fp/frontend/webservices/rest/services/ArmasResource.java new file mode 100644 index 0000000..554f5a3 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/rest/services/ArmasResource.java @@ -0,0 +1,65 @@ +package com.fp.frontend.webservices.rest.services; + +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.webservices.rest.dto.StatusMessage; +import com.fp.frontend.webservices.rest.util.JwtValidateException; +import com.fp.persistence.parmas.dto.ws.ArmaDto; + +@Path("/arma") +@Produces(MediaType.APPLICATION_JSON) +public class ArmasResource extends CommonResource { + + @GET + @Path("/{serie}") + public Response consultarArma(@PathParam("serie") String serie, @HeaderParam("Authorization") String bearerToken) { + Response response = null; + try { + ArmaDto armaDto = null; + validateToken(bearerToken); + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("queryalias", "ARMASWS"); + request.put("codigoarma", serie); + com.fp.dto.Response responseMaia = callerHelper.executeQuery(request); + if (responseMaia.getResponseCode().compareTo(com.fp.dto.Response.RESPONSE_OK) == 0) { + armaDto = (ArmaDto) responseMaia.get("ARMASWS"); + if (armaDto == null) { + throw new WebApplicationException( + Response.status(Status.BAD_REQUEST) + .entity(new StatusMessage(Status.BAD_REQUEST.getStatusCode(), "El cod. arma no existe")).build()); + } + } else { + throw new WebApplicationException( + Response.status(Status.BAD_REQUEST) + .entity(new StatusMessage(Status.BAD_REQUEST.getStatusCode(), "Error al realizar la consulta del arma")).build()); + } + response = Response.ok().entity(armaDto).build(); + } catch (JwtValidateException e) { + APPLogger.getLogger().error(e.getMessage(), e); + response = Response.status(e.getStatusMessage().getStatus()).entity(e.getStatusMessage()).build(); + } catch (WebApplicationException e) { + APPLogger.getLogger().error(e.getMessage(), e); + response = e.getResponse(); + } catch (Exception e) { + APPLogger.getLogger().error(e.getMessage(), e); + response = Response.serverError().entity(new StatusMessage(Status.INTERNAL_SERVER_ERROR.getStatusCode(), e.getMessage())).build(); + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + response = Response.serverError().entity(new StatusMessage(Status.INTERNAL_SERVER_ERROR.getStatusCode(), e.getMessage())).build(); + } + return response; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/rest/services/CommonResource.java b/frontend/src/main/java/com/fp/frontend/webservices/rest/services/CommonResource.java new file mode 100644 index 0000000..930ba5e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/rest/services/CommonResource.java @@ -0,0 +1,123 @@ +package com.fp.frontend.webservices.rest.services; + +import java.util.LinkedList; +import java.util.List; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; + +import org.apache.commons.lang.StringUtils; +import org.jose4j.jwk.JsonWebKey; +import org.jose4j.jwk.JsonWebKeySet; +import org.jose4j.jwk.RsaJsonWebKey; +import org.jose4j.jwk.RsaJwkGenerator; +import org.jose4j.jws.AlgorithmIdentifiers; +import org.jose4j.jws.JsonWebSignature; +import org.jose4j.jwt.JwtClaims; +import org.jose4j.jwt.consumer.InvalidJwtException; +import org.jose4j.jwt.consumer.JwtConsumer; +import org.jose4j.jwt.consumer.JwtConsumerBuilder; +import org.jose4j.lang.JoseException; + +import com.fp.common.logger.APPLogger; +import com.fp.frontend.webservices.rest.dto.StatusMessage; +import com.fp.frontend.webservices.rest.util.JwtValidateException; + +public class CommonResource { + + private static String BEARER = "Bearer "; + final static String ISSUER = "ccffaa.mil.ec"; + static List jwkList = null; + + static { + APPLogger.getLogger().info("Inicializador estatico JWT..."); + jwkList = new LinkedList<>(); + for (int kid = 1; kid <= 3; kid++) { + JsonWebKey jwk = null; + try { + jwk = RsaJwkGenerator.generateJwk(2048); + APPLogger.getLogger().info("PUBLIC KEY (" + kid + "): " + + jwk.toJson(JsonWebKey.OutputControlLevel.PUBLIC_ONLY)); + } catch (JoseException e) { + APPLogger.getLogger().error(e.getMessage()); + } + jwk.setKeyId(String.valueOf(kid)); + jwkList.add(jwk); + } + } + + protected String generateTokenJwt(String username) { + RsaJsonWebKey senderJwk = (RsaJsonWebKey) jwkList.get(0); + senderJwk.setKeyId("1"); + // Create the Claims, which will be the content of the JWT + JwtClaims claims = new JwtClaims(); + claims.setIssuer(ISSUER); + claims.setExpirationTimeMinutesInTheFuture(60); + claims.setGeneratedJwtId(); + claims.setIssuedAtToNow(); + claims.setNotBeforeMinutesInThePast(2); + claims.setSubject(username); + JsonWebSignature jws = new JsonWebSignature(); + + jws.setPayload(claims.toJson()); + + jws.setKeyIdHeaderValue(senderJwk.getKeyId()); + jws.setKey(senderJwk.getPrivateKey()); + + jws.setAlgorithmHeaderValue(AlgorithmIdentifiers.RSA_USING_SHA256); + + String jwt = null; + try { + jwt = jws.getCompactSerialization(); + } catch (JoseException e) { + throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new StatusMessage(Status.BAD_REQUEST.getStatusCode(), "Error al generar el token JWT")).build()); + } + return jwt; + } + + public void validateToken(String bearerToken) { + try { + String token = getToken(bearerToken); + if (token == null || token.trim().isEmpty()) { + StatusMessage statusMessage = new StatusMessage(); + statusMessage.setStatus(Status.FORBIDDEN.getStatusCode()); + statusMessage.setMessage( + "Acceso Denegado debe enviar el token !!!"); + throw new JwtValidateException(statusMessage); + } + + JsonWebKeySet jwks = new JsonWebKeySet(jwkList); + JsonWebKey jwk = jwks.findJsonWebKey("1", null, null, null); + JwtConsumer jwtConsumer = new JwtConsumerBuilder() + .setRequireExpirationTime() + .setAllowedClockSkewInSeconds(30) + .setRequireSubject() + .setExpectedIssuer(ISSUER) + .setVerificationKey(jwk.getKey()) + .build(); + JwtClaims jwtClaims = jwtConsumer.processToClaims(token); + APPLogger.getLogger().info("JWT validation succeeded! " + jwtClaims); + } catch (InvalidJwtException e) { + APPLogger.getLogger().error("JWT el token no es valida: "); + StatusMessage statusMessage = new StatusMessage(); + statusMessage.setStatus(Status.FORBIDDEN.getStatusCode()); + statusMessage.setMessage("Acceso denegado el token no es valido !!!"); + throw new JwtValidateException(statusMessage); + } catch (Exception e) { + APPLogger.getLogger().error("JWT error a validar el token: "); + StatusMessage statusMessage = new StatusMessage(); + statusMessage.setStatus(Status.FORBIDDEN.getStatusCode()); + statusMessage.setMessage("Acceso denegado el token no es valido !!!"); + throw new JwtValidateException(statusMessage); + } + } + + private String getToken(String bearerToken) { + String token = null; + if (bearerToken.startsWith(BEARER)) { + token = bearerToken.replace(BEARER, StringUtils.EMPTY); + } + return token; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/rest/services/SecurityResource.java b/frontend/src/main/java/com/fp/frontend/webservices/rest/services/SecurityResource.java new file mode 100644 index 0000000..7e69b7e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/rest/services/SecurityResource.java @@ -0,0 +1,65 @@ +package com.fp.frontend.webservices.rest.services; + +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; + +import com.fp.common.logger.APPLogger; +import com.fp.dto.Request; +import com.fp.frontend.helper.CallerHelper; +import com.fp.frontend.webservices.rest.dto.LoginData; +import com.fp.frontend.webservices.rest.dto.LoginResult; +import com.fp.frontend.webservices.rest.dto.StatusMessage; +import com.fp.frontend.webservices.rest.util.JwtValidateException; + +@Path("/security") +@Produces(MediaType.APPLICATION_JSON) +public class SecurityResource extends CommonResource { + + @POST + @Path("/login") + @Consumes(MediaType.APPLICATION_JSON) + public Response login(LoginData loginData) { + APPLogger.getLogger().info("Ingresa a Login MOB"); + Response response = null; + try { + String respuesta = "0"; + CallerHelper callerHelper = new CallerHelper(); + Request request = callerHelper.getRequest(); + request.setCompany(1); + request.put("USERCODE", loginData.getUsername()); + request.put("PASSWORD", callerHelper.getPasswordEncriptado(loginData.getPassword())); + request.put("queryalias", "CONSULTALOGIN"); + com.fp.dto.Response responseMaia = callerHelper.executeQuery(request); + if (responseMaia.getResponseCode().compareTo(com.fp.dto.Response.RESPONSE_OK) == 0) { + respuesta = (String) responseMaia.get("RESPUESTA");//esta contiene la localidad de la direccion principal del usuario + if (respuesta == null || respuesta.isEmpty()) { + throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new StatusMessage(Status.BAD_REQUEST.getStatusCode(), "Usuario/Password Incorrecto")).build()); + } + } else { + throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity(new StatusMessage(Status.BAD_REQUEST.getStatusCode(), "Usuario/Password Incorrecto")).build()); + } + String token = generateTokenJwt(loginData.getUsername()); + response = Response.ok().entity(new LoginResult(loginData.getUsername(), token)).build(); + } catch (JwtValidateException e) { + APPLogger.getLogger().error(e.getMessage(), e); + response = Response.status(e.getStatusMessage().getStatus()).entity(e.getStatusMessage()).build(); + } catch (WebApplicationException e) { + APPLogger.getLogger().error(e.getMessage(), e); + response = e.getResponse(); + } catch (Exception e) { + APPLogger.getLogger().error(e.getMessage(), e); + response = Response.serverError().entity(new StatusMessage(Status.INTERNAL_SERVER_ERROR.getStatusCode(), e.getMessage())).build(); + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + response = Response.serverError().entity(new StatusMessage(Status.INTERNAL_SERVER_ERROR.getStatusCode(), e.getMessage())).build(); + } + return response; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/rest/util/.svn/entries b/frontend/src/main/java/com/fp/frontend/webservices/rest/util/.svn/entries new file mode 100644 index 0000000..9790449 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/rest/util/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/webservices/rest/util +svn://172.17.26.185/COMACO + + + +2022-01-20T04:13:52.171628Z +4662 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +JwtValidateException.java +file + + + + +2022-07-28T03:39:46.132558Z +9bf363babcfffc8476fc59830d976518 +2022-01-20T04:13:52.171628Z +4662 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +628 + diff --git a/frontend/src/main/java/com/fp/frontend/webservices/rest/util/.svn/text-base/JwtValidateException.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/rest/util/.svn/text-base/JwtValidateException.java.svn-base new file mode 100644 index 0000000..167d9d6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/rest/util/.svn/text-base/JwtValidateException.java.svn-base @@ -0,0 +1,26 @@ +package com.fp.frontend.webservices.rest.util; + +import javax.ws.rs.WebApplicationException; + +import com.fp.frontend.webservices.rest.dto.StatusMessage; + +public class JwtValidateException extends WebApplicationException { + + private static final long serialVersionUID = 1L; + + private StatusMessage statusMessage; + + public JwtValidateException(StatusMessage statusMessage) { + super(); + this.statusMessage = statusMessage; + } + + public StatusMessage getStatusMessage() { + return statusMessage; + } + + public void setStatusMessage(StatusMessage statusMessage) { + this.statusMessage = statusMessage; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/rest/util/JwtValidateException.java b/frontend/src/main/java/com/fp/frontend/webservices/rest/util/JwtValidateException.java new file mode 100644 index 0000000..1c5f604 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/rest/util/JwtValidateException.java @@ -0,0 +1,26 @@ +package com.fp.frontend.webservices.rest.util; + +import javax.ws.rs.WebApplicationException; + +import com.fp.frontend.webservices.rest.dto.StatusMessage; + +public class JwtValidateException extends WebApplicationException { + + private static final long serialVersionUID = 1L; + + private StatusMessage statusMessage; + + public JwtValidateException(StatusMessage statusMessage) { + super(); + this.statusMessage = statusMessage; + } + + public StatusMessage getStatusMessage() { + return statusMessage; + } + + public void setStatusMessage(StatusMessage statusMessage) { + this.statusMessage = statusMessage; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/.svn/entries b/frontend/src/main/java/com/fp/frontend/webservices/snap/.svn/entries new file mode 100644 index 0000000..877e4a6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/.svn/entries @@ -0,0 +1,37 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/webservices/snap +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +modelo +dir + +ruc +dir + +cedula +dir + diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/entries b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/entries new file mode 100644 index 0000000..322a88b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/entries @@ -0,0 +1,266 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +CedulaServicio.java +file + + + + +2022-07-28T03:39:45.955557Z +26b714d7bf0b4f0a824992a73191c24a +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1436 + +ClienteCedula.java +file + + + + +2022-07-28T03:39:45.955557Z +a856da5b2beef5b57ee55e909da83dc2 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1013 + +CedulaServicioService.java +file + + + + +2022-07-28T03:39:45.956557Z +ae1c580b0f22ecd4ffff17c5aadcbfcc +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +3387 + +package-info.java +file + + + + +2022-07-28T03:39:45.956557Z +5c75d4a75ff32727d68a65984db96cb8 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +142 + +ConsultarCedulaResponse.java +file + + + + +2022-07-28T03:39:45.956557Z +0d3de66e3ebcb44731f8ed1324aeb200 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1615 + +ConsultarCedula.java +file + + + + +2022-07-28T03:39:45.957557Z +8acf9234b0bab9a1c182e1506bd979ff +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1433 + +ObjectFactory.java +file + + + + +2022-07-28T03:39:45.957557Z +bf734609f1a3101777717a9b74c8ed28 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +2672 + diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/prop-base/CedulaServicio.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/prop-base/CedulaServicio.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/prop-base/CedulaServicio.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/prop-base/CedulaServicioService.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/prop-base/CedulaServicioService.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/prop-base/CedulaServicioService.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/prop-base/ClienteCedula.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/prop-base/ClienteCedula.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/prop-base/ClienteCedula.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/prop-base/ConsultarCedula.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/prop-base/ConsultarCedula.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/prop-base/ConsultarCedula.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/prop-base/ConsultarCedulaResponse.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/prop-base/ConsultarCedulaResponse.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/prop-base/ConsultarCedulaResponse.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/prop-base/ObjectFactory.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/prop-base/ObjectFactory.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/prop-base/ObjectFactory.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/prop-base/package-info.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/prop-base/package-info.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/prop-base/package-info.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/text-base/CedulaServicio.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/text-base/CedulaServicio.java.svn-base new file mode 100644 index 0000000..c083d0d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/text-base/CedulaServicio.java.svn-base @@ -0,0 +1,42 @@ + +package com.fp.frontend.webservices.snap.cedula; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; +import ec.gob.registrocivil.consultacedula.Cedula; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.6b21 + * Generated source version: 2.2 + * + */ +@WebService(name = "CedulaServicio", targetNamespace = "http://cedula.snap.webservices.fp.com/") +@XmlSeeAlso({ + com.fp.frontend.webservices.snap.cedula.ObjectFactory.class, + ec.gob.registrocivil.consultacedula.ObjectFactory.class +}) +public interface CedulaServicio { + + + /** + * + * @param cedula + * @return + * returns ec.gob.registrocivil.consultacedula.Cedula + */ + @WebMethod + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "consultarCedula", targetNamespace = "http://cedula.snap.webservices.fp.com/", className = "com.fp.frontend.webservices.snap.cedula.ConsultarCedula") + @ResponseWrapper(localName = "consultarCedulaResponse", targetNamespace = "http://cedula.snap.webservices.fp.com/", className = "com.fp.frontend.webservices.snap.cedula.ConsultarCedulaResponse") + public Cedula consultarCedula( + @WebParam(name = "cedula", targetNamespace = "") + String cedula); + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/text-base/CedulaServicioService.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/text-base/CedulaServicioService.java.svn-base new file mode 100644 index 0000000..e275c19 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/text-base/CedulaServicioService.java.svn-base @@ -0,0 +1,97 @@ + +package com.fp.frontend.webservices.snap.cedula; + +import java.net.MalformedURLException; +import java.net.URL; + +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceException; +import javax.xml.ws.WebServiceFeature; + +import com.fp.frontend.utility.MsgControlArmas; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.6b21 + * Generated source version: 2.2 + * + */ +@WebServiceClient(name = "CedulaServicioService", targetNamespace = "http://cedula.snap.webservices.fp.com/", wsdlLocation = "https://serviciosarmas.ccffaa.mil.ec:8085/serviceCedula?wsdl") +public class CedulaServicioService + extends Service +{ + + private final static URL CEDULASERVICIOSERVICE_WSDL_LOCATION; + private final static WebServiceException CEDULASERVICIOSERVICE_EXCEPTION; + private final static QName CEDULASERVICIOSERVICE_QNAME = new QName("http://cedula.snap.webservices.fp.com/", "CedulaServicioService"); + + static { + URL url = null; + WebServiceException e = null; + try { + url = new URL(MsgControlArmas.getProperty("url_snap_servicio_cedula")); + } catch (MalformedURLException ex) { + e = new WebServiceException(ex); + } + CEDULASERVICIOSERVICE_WSDL_LOCATION = url; + CEDULASERVICIOSERVICE_EXCEPTION = e; + } + + public CedulaServicioService() { + super(__getWsdlLocation(), CEDULASERVICIOSERVICE_QNAME); + } + + public CedulaServicioService(WebServiceFeature... features) { + super(__getWsdlLocation(), CEDULASERVICIOSERVICE_QNAME, features); + } + + public CedulaServicioService(URL wsdlLocation) { + super(wsdlLocation, CEDULASERVICIOSERVICE_QNAME); + } + + public CedulaServicioService(URL wsdlLocation, WebServiceFeature... features) { + super(wsdlLocation, CEDULASERVICIOSERVICE_QNAME, features); + } + + public CedulaServicioService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public CedulaServicioService(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * + * @return + * returns CedulaServicio + */ + @WebEndpoint(name = "CedulaServicioPort") + public CedulaServicio getCedulaServicioPort() { + return super.getPort(new QName("http://cedula.snap.webservices.fp.com/", "CedulaServicioPort"), CedulaServicio.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns CedulaServicio + */ + @WebEndpoint(name = "CedulaServicioPort") + public CedulaServicio getCedulaServicioPort(WebServiceFeature... features) { + return super.getPort(new QName("http://cedula.snap.webservices.fp.com/", "CedulaServicioPort"), CedulaServicio.class, features); + } + + private static URL __getWsdlLocation() { + if (CEDULASERVICIOSERVICE_EXCEPTION!= null) { + throw CEDULASERVICIOSERVICE_EXCEPTION; + } + return CEDULASERVICIOSERVICE_WSDL_LOCATION; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/text-base/ClienteCedula.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/text-base/ClienteCedula.java.svn-base new file mode 100644 index 0000000..607c288 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/text-base/ClienteCedula.java.svn-base @@ -0,0 +1,37 @@ +package com.fp.frontend.webservices.snap.cedula; + +import com.fp.common.logger.APPLogger; + +import ec.gob.registrocivil.consultacedula.Cedula; + +/** + * Clase que realiza consultas al WS de la SNAP del registro civil + * @author dcruz + * + */ +public class ClienteCedula { + + /** + * Retorna los datos de la persona en base su numero de cédula + * @param cedula + * @return + */ + public static Cedula obtenerCedula(String cedula) { + Cedula cedulaResult = null; + try { + CedulaServicioService cedulaServicioService = new CedulaServicioService(); + cedulaResult = cedulaServicioService.getCedulaServicioPort().consultarCedula(cedula); + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + return cedulaResult; + } + + public static void main(String[] args) { + Cedula ced=obtenerCedula("1716178676"); + System.out.println(" .. "+ced); + System.out.println(" .. "+ced.getNombre()); + System.out.println(" .. "+ced.getCalleDomicilio()); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/text-base/ConsultarCedula.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/text-base/ConsultarCedula.java.svn-base new file mode 100644 index 0000000..c145f0c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/text-base/ConsultarCedula.java.svn-base @@ -0,0 +1,60 @@ + +package com.fp.frontend.webservices.snap.cedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para consultarCedula complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="consultarCedula">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="cedula" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "consultarCedula", propOrder = { + "cedula" +}) +public class ConsultarCedula { + + protected String cedula; + + /** + * Obtiene el valor de la propiedad cedula. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCedula() { + return cedula; + } + + /** + * Define el valor de la propiedad cedula. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCedula(String value) { + this.cedula = value; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/text-base/ConsultarCedulaResponse.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/text-base/ConsultarCedulaResponse.java.svn-base new file mode 100644 index 0000000..abdd447 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/text-base/ConsultarCedulaResponse.java.svn-base @@ -0,0 +1,63 @@ + +package com.fp.frontend.webservices.snap.cedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; +import ec.gob.registrocivil.consultacedula.Cedula; + + +/** + *

Clase Java para consultarCedulaResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="consultarCedulaResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://www.registrocivil.gob.ec/ConsultaCedula}cedula" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "consultarCedulaResponse", propOrder = { + "_return" +}) +public class ConsultarCedulaResponse { + + @XmlElement(name = "return") + protected Cedula _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link Cedula } + * + */ + public Cedula getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link Cedula } + * + */ + public void setReturn(Cedula value) { + this._return = value; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/text-base/ObjectFactory.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/text-base/ObjectFactory.java.svn-base new file mode 100644 index 0000000..5b6743f --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/text-base/ObjectFactory.java.svn-base @@ -0,0 +1,71 @@ + +package com.fp.frontend.webservices.snap.cedula; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.fp.webservices.snap.cedula package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _ConsultarCedulaResponse_QNAME = new QName("http://cedula.snap.webservices.fp.com/", "consultarCedulaResponse"); + private final static QName _ConsultarCedula_QNAME = new QName("http://cedula.snap.webservices.fp.com/", "consultarCedula"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.fp.webservices.snap.cedula + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link ConsultarCedulaResponse } + * + */ + public ConsultarCedulaResponse createConsultarCedulaResponse() { + return new ConsultarCedulaResponse(); + } + + /** + * Create an instance of {@link ConsultarCedula } + * + */ + public ConsultarCedula createConsultarCedula() { + return new ConsultarCedula(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ConsultarCedulaResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://cedula.snap.webservices.fp.com/", name = "consultarCedulaResponse") + public JAXBElement createConsultarCedulaResponse(ConsultarCedulaResponse value) { + return new JAXBElement(_ConsultarCedulaResponse_QNAME, ConsultarCedulaResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ConsultarCedula }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://cedula.snap.webservices.fp.com/", name = "consultarCedula") + public JAXBElement createConsultarCedula(ConsultarCedula value) { + return new JAXBElement(_ConsultarCedula_QNAME, ConsultarCedula.class, null, value); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/text-base/package-info.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..e63509a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://cedula.snap.webservices.fp.com/") +package com.fp.frontend.webservices.snap.cedula; diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/CedulaServicio.java b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/CedulaServicio.java new file mode 100644 index 0000000..a2c5a83 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/CedulaServicio.java @@ -0,0 +1,36 @@ +package com.fp.frontend.webservices.snap.cedula; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; +import ec.gob.registrocivil.consultacedula.Cedula; + +/** + * This class was generated by the JAX-WS RI. JAX-WS RI 2.2.6b21 Generated + * source version: 2.2 + * + */ +@WebService(name = "CedulaServicio", targetNamespace = "http://cedula.snap.webservices.fp.com/") +@XmlSeeAlso({ + com.fp.frontend.webservices.snap.cedula.ObjectFactory.class, + ec.gob.registrocivil.consultacedula.ObjectFactory.class +}) +public interface CedulaServicio { + + /** + * + * @param cedula + * @return returns ec.gob.registrocivil.consultacedula.Cedula + */ + @WebMethod + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "consultarCedula", targetNamespace = "http://cedula.snap.webservices.fp.com/", className = "com.fp.frontend.webservices.snap.cedula.ConsultarCedula") + @ResponseWrapper(localName = "consultarCedulaResponse", targetNamespace = "http://cedula.snap.webservices.fp.com/", className = "com.fp.frontend.webservices.snap.cedula.ConsultarCedulaResponse") + public Cedula consultarCedula( + @WebParam(name = "cedula", targetNamespace = "") String cedula); + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/CedulaServicioService.java b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/CedulaServicioService.java new file mode 100644 index 0000000..51e361b --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/CedulaServicioService.java @@ -0,0 +1,92 @@ +package com.fp.frontend.webservices.snap.cedula; + +import java.net.MalformedURLException; +import java.net.URL; + +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceException; +import javax.xml.ws.WebServiceFeature; + +import com.fp.frontend.utility.MsgControlArmas; + +/** + * This class was generated by the JAX-WS RI. JAX-WS RI 2.2.6b21 Generated + * source version: 2.2 + * + */ +@WebServiceClient(name = "CedulaServicioService", targetNamespace = "http://cedula.snap.webservices.fp.com/", wsdlLocation = "https://serviciosarmas.ccffaa.mil.ec:8085/serviceCedula?wsdl") +public class CedulaServicioService + extends Service { + + private final static URL CEDULASERVICIOSERVICE_WSDL_LOCATION; + private final static WebServiceException CEDULASERVICIOSERVICE_EXCEPTION; + private final static QName CEDULASERVICIOSERVICE_QNAME = new QName("http://cedula.snap.webservices.fp.com/", "CedulaServicioService"); + + static { + URL url = null; + WebServiceException e = null; + try { + url = new URL(MsgControlArmas.getProperty("url_snap_servicio_cedula")); + } catch (MalformedURLException ex) { + e = new WebServiceException(ex); + } + CEDULASERVICIOSERVICE_WSDL_LOCATION = url; + CEDULASERVICIOSERVICE_EXCEPTION = e; + } + + public CedulaServicioService() { + super(__getWsdlLocation(), CEDULASERVICIOSERVICE_QNAME); + } + + public CedulaServicioService(WebServiceFeature... features) { + super(__getWsdlLocation(), CEDULASERVICIOSERVICE_QNAME, features); + } + + public CedulaServicioService(URL wsdlLocation) { + super(wsdlLocation, CEDULASERVICIOSERVICE_QNAME); + } + + public CedulaServicioService(URL wsdlLocation, WebServiceFeature... features) { + super(wsdlLocation, CEDULASERVICIOSERVICE_QNAME, features); + } + + public CedulaServicioService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public CedulaServicioService(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * + * @return returns CedulaServicio + */ + @WebEndpoint(name = "CedulaServicioPort") + public CedulaServicio getCedulaServicioPort() { + return super.getPort(new QName("http://cedula.snap.webservices.fp.com/", "CedulaServicioPort"), CedulaServicio.class); + } + + /** + * + * @param features A list of {@link javax.xml.ws.WebServiceFeature} to + * configure on the proxy. Supported features not in the + * features parameter will have their default values. + * @return returns CedulaServicio + */ + @WebEndpoint(name = "CedulaServicioPort") + public CedulaServicio getCedulaServicioPort(WebServiceFeature... features) { + return super.getPort(new QName("http://cedula.snap.webservices.fp.com/", "CedulaServicioPort"), CedulaServicio.class, features); + } + + private static URL __getWsdlLocation() { + if (CEDULASERVICIOSERVICE_EXCEPTION != null) { + throw CEDULASERVICIOSERVICE_EXCEPTION; + } + return CEDULASERVICIOSERVICE_WSDL_LOCATION; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/ClienteCedula.java b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/ClienteCedula.java new file mode 100644 index 0000000..8f9d35d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/ClienteCedula.java @@ -0,0 +1,39 @@ +package com.fp.frontend.webservices.snap.cedula; + +import com.fp.common.logger.APPLogger; + +import ec.gob.registrocivil.consultacedula.Cedula; + +/** + * Clase que realiza consultas al WS de la SNAP del registro civil + * + * @author dcruz + * + */ +public class ClienteCedula { + + /** + * Retorna los datos de la persona en base su numero de cédula + * + * @param cedula + * @return + */ + public static Cedula obtenerCedula(String cedula) { + Cedula cedulaResult = null; + try { + CedulaServicioService cedulaServicioService = new CedulaServicioService(); + cedulaResult = cedulaServicioService.getCedulaServicioPort().consultarCedula(cedula); + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + return cedulaResult; + } + + public static void main(String[] args) { + Cedula ced = obtenerCedula("1716178676"); + System.out.println(" .. " + ced); + System.out.println(" .. " + ced.getNombre()); + System.out.println(" .. " + ced.getCalleDomicilio()); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/ConsultarCedula.java b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/ConsultarCedula.java new file mode 100644 index 0000000..e82b2a0 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/ConsultarCedula.java @@ -0,0 +1,57 @@ +package com.fp.frontend.webservices.snap.cedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + +/** + *

+ * Clase Java para consultarCedula complex type. + * + *

+ * El siguiente fragmento de esquema especifica el contenido que se espera que + * haya en esta clase. + * + *

+ * <complexType name="consultarCedula">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="cedula" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "consultarCedula", propOrder = { + "cedula" +}) +public class ConsultarCedula { + + protected String cedula; + + /** + * Obtiene el valor de la propiedad cedula. + * + * @return possible object is {@link String } + * + */ + public String getCedula() { + return cedula; + } + + /** + * Define el valor de la propiedad cedula. + * + * @param value allowed object is {@link String } + * + */ + public void setCedula(String value) { + this.cedula = value; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/ConsultarCedulaResponse.java b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/ConsultarCedulaResponse.java new file mode 100644 index 0000000..e7333a6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/ConsultarCedulaResponse.java @@ -0,0 +1,60 @@ +package com.fp.frontend.webservices.snap.cedula; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; +import ec.gob.registrocivil.consultacedula.Cedula; + +/** + *

+ * Clase Java para consultarCedulaResponse complex type. + * + *

+ * El siguiente fragmento de esquema especifica el contenido que se espera que + * haya en esta clase. + * + *

+ * <complexType name="consultarCedulaResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://www.registrocivil.gob.ec/ConsultaCedula}cedula" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "consultarCedulaResponse", propOrder = { + "_return" +}) +public class ConsultarCedulaResponse { + + @XmlElement(name = "return") + protected Cedula _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return possible object is {@link Cedula } + * + */ + public Cedula getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value allowed object is {@link Cedula } + * + */ + public void setReturn(Cedula value) { + this._return = value; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/ObjectFactory.java b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/ObjectFactory.java new file mode 100644 index 0000000..14abed0 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/ObjectFactory.java @@ -0,0 +1,69 @@ +package com.fp.frontend.webservices.snap.cedula; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + +/** + * This object contains factory methods for each Java content interface and Java + * element interface generated in the com.fp.webservices.snap.cedula package. + *

+ * An ObjectFactory allows you to programatically construct new instances of the + * Java representation for XML content. The Java representation of XML content + * can consist of schema derived interfaces and classes representing the binding + * of schema type definitions, element declarations and model groups. Factory + * methods for each of these are provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _ConsultarCedulaResponse_QNAME = new QName("http://cedula.snap.webservices.fp.com/", "consultarCedulaResponse"); + private final static QName _ConsultarCedula_QNAME = new QName("http://cedula.snap.webservices.fp.com/", "consultarCedula"); + + /** + * Create a new ObjectFactory that can be used to create new instances of + * schema derived classes for package: com.fp.webservices.snap.cedula + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link ConsultarCedulaResponse } + * + */ + public ConsultarCedulaResponse createConsultarCedulaResponse() { + return new ConsultarCedulaResponse(); + } + + /** + * Create an instance of {@link ConsultarCedula } + * + */ + public ConsultarCedula createConsultarCedula() { + return new ConsultarCedula(); + } + + /** + * Create an instance of + * {@link JAXBElement }{@code <}{@link ConsultarCedulaResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://cedula.snap.webservices.fp.com/", name = "consultarCedulaResponse") + public JAXBElement createConsultarCedulaResponse(ConsultarCedulaResponse value) { + return new JAXBElement(_ConsultarCedulaResponse_QNAME, ConsultarCedulaResponse.class, null, value); + } + + /** + * Create an instance of + * {@link JAXBElement }{@code <}{@link ConsultarCedula }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://cedula.snap.webservices.fp.com/", name = "consultarCedula") + public JAXBElement createConsultarCedula(ConsultarCedula value) { + return new JAXBElement(_ConsultarCedula_QNAME, ConsultarCedula.class, null, value); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/package-info.java b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/package-info.java new file mode 100644 index 0000000..e63509a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/cedula/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://cedula.snap.webservices.fp.com/") +package com.fp.frontend.webservices.snap.cedula; diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/entries b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/entries new file mode 100644 index 0000000..4c1bc1f --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/entries @@ -0,0 +1,300 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ImagenXml.java +file + + + + +2022-07-28T03:39:45.894557Z +71b69dac62541667f090baff5a84f4cd +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1662 + +ResultadoXml.java +file + + + + +2022-07-28T03:39:45.894557Z +e5f080004017a2e68946198c7e6d45a5 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +5253 + +EjecucionXml.java +file + + + + +2022-07-28T03:39:45.895557Z +dba8b1cb4888e8cb8c3e23733deed986 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +2400 + +CabeceraXml.java +file + + + + +2022-07-28T03:39:45.895557Z +474338d26efa9bc7362c6c84c4c2d6fe +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1736 + +TramiteXml.java +file + + + + +2022-07-28T03:39:45.895557Z +bd6668b44f172db86968222a14337148 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +2231 + +DatosArmaXml.java +file + + + + +2022-07-28T03:39:45.895557Z +a8ff8c02f3e1cec5811be44abbfb0d8d +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +3511 + +SoapEnvelopWrapper.java +file + + + + +2022-07-28T03:39:45.896557Z +00844fc51d932e65d1a6be484e7fec2a +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +2107 + +GuardiaXml.java +file + + + + +2022-07-28T03:39:45.896557Z +1efcb1760f6207d3a0010a5923202138 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1624 + diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/CabeceraXml.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/CabeceraXml.java.svn-base new file mode 100644 index 0000000..e63eb1d --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/CabeceraXml.java.svn-base @@ -0,0 +1,95 @@ +/** + * + */ +package com.fp.frontend.webservices.snap.modelo; + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +/** + * Clase xml con los elementos de la cabecera de la salida del WS + * @author Manuel Cepeda + * + */ +@XmlRootElement(name="Cabecera") +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType (propOrder={"idMensaje","fecha","hora"}) +public class CabeceraXml implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1216982166335460756L; + + @XmlElement(name="IdMensaje") + private String idMensaje; + @XmlElement(name="Fecha") + private String fecha; + @XmlElement(name="Hora") + private String hora; + + /** + * + */ + public CabeceraXml() { + } + + public CabeceraXml(String idMensaje, String fecha, String hora) { + super(); + this.idMensaje = idMensaje; + this.fecha = fecha; + this.hora = hora; + } + + + + /** + * @return the idMensaje + */ + public String getIdMensaje() { + return idMensaje; + } + + /** + * @param idMensaje the idMensaje to set + */ + public void setIdMensaje(String idMensaje) { + this.idMensaje = idMensaje; + } + + /** + * @return the fecha + */ + public String getFecha() { + return fecha; + } + + /** + * @param fecha the fecha to set + */ + public void setFecha(String fecha) { + this.fecha = fecha; + } + + /** + * @return the hora + */ + public String getHora() { + return hora; + } + + /** + * @param hora the hora to set + */ + public void setHora(String hora) { + this.hora = hora; + } + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/DatosArmaXml.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/DatosArmaXml.java.svn-base new file mode 100644 index 0000000..54b5f3f --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/DatosArmaXml.java.svn-base @@ -0,0 +1,182 @@ +/** + * + */ +package com.fp.frontend.webservices.snap.modelo; + +import java.io.Serializable; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Clase xml con los datos de la arma + * @author Manuel Cepeda + * + */ +@XmlRootElement(name="DatosArma") +@XmlAccessorType(XmlAccessType.FIELD) +public class DatosArmaXml implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -431606681146448613L; + + @XmlElement(name="Lote") + private String lote; + @XmlElement(name="DescripcionClase") + private String descripcionClase; + @XmlElement(name="DescripcionTipo") + private String descripcionTipo; + @XmlElement(name="Tipofabricante") + private String tipofabricante; + @XmlElement(name="marca") + private String marca; + @XmlElement(name="Calibre") + private String calibre; + @XmlElement(name="ModeloArma") + private String modeloArma; + @XmlElement(name="EstadoArma") + private String estadoArma; + + @XmlElement(name="ListaImagen") + private List listaImagen; + + + /** + * + */ + public DatosArmaXml() { + } + + /** + * @return the lote + */ + public String getLote() { + return lote; + } + + /** + * @param lote the lote to set + */ + public void setLote(String lote) { + this.lote = lote; + } + + /** + * @return the descripcionClase + */ + public String getDescripcionClase() { + return descripcionClase; + } + + /** + * @param descripcionClase the descripcionClase to set + */ + public void setDescripcionClase(String descripcionClase) { + this.descripcionClase = descripcionClase; + } + + /** + * @return the descripcionTipo + */ + public String getDescripcionTipo() { + return descripcionTipo; + } + + /** + * @param descripcionTipo the descripcionTipo to set + */ + public void setDescripcionTipo(String descripcionTipo) { + this.descripcionTipo = descripcionTipo; + } + + /** + * @return the tipofabricante + */ + public String getTipofabricante() { + return tipofabricante; + } + + /** + * @param tipofabricante the tipofabricante to set + */ + public void setTipofabricante(String tipofabricante) { + this.tipofabricante = tipofabricante; + } + + /** + * @return the marca + */ + public String getMarca() { + return marca; + } + + /** + * @param marca the marca to set + */ + public void setMarca(String marca) { + this.marca = marca; + } + + /** + * @return the calibre + */ + public String getCalibre() { + return calibre; + } + + /** + * @param calibre the calibre to set + */ + public void setCalibre(String calibre) { + this.calibre = calibre; + } + + /** + * @return the modeloArma + */ + public String getModeloArma() { + return modeloArma; + } + + /** + * @param modeloArma the modeloArma to set + */ + public void setModeloArma(String modeloArma) { + this.modeloArma = modeloArma; + } + + /** + * @return the estadoArma + */ + public String getEstadoArma() { + return estadoArma; + } + + /** + * @param estadoArma the estadoArma to set + */ + public void setEstadoArma(String estadoArma) { + this.estadoArma = estadoArma; + } + + /** + * @return the listaImagen + */ + public List getListaImagen() { + return listaImagen; + } + + /** + * @param listaImagen the listaImagen to set + */ + public void setListaImagen(List listaImagen) { + this.listaImagen = listaImagen; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/EjecucionXml.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/EjecucionXml.java.svn-base new file mode 100644 index 0000000..84bb5ac --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/EjecucionXml.java.svn-base @@ -0,0 +1,122 @@ +/** + * + */ +package com.fp.frontend.webservices.snap.modelo; + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +/** + * Clase xml con los elementos de la ejecucion en la salida del WS + * @author Manuel Cepeda + * + */ +@XmlRootElement(name="Ejecucion") +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType (propOrder={"exito","codigoError","descripcionError","idToken"}) +public class EjecucionXml implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 6677743930807519383L; + + @XmlElement(name="Exito") + private Integer exito; + + @XmlElement(name="CodigoError") + private String codigoError; + + @XmlElement(name="DescripcionError") + private String descripcionError; + + @XmlElement(name="IdToken") + private String idToken; + + /** + * + */ + public EjecucionXml() { + } + + + + /** + * @param exito + * @param codigoError + * @param descripcionError + * @param idToken + */ + public EjecucionXml(Integer exito, String codigoError, + String descripcionError, String idToken) { + super(); + this.exito = exito; + this.codigoError = codigoError; + this.descripcionError = descripcionError; + this.idToken = idToken; + } + + + + /** + * @return the codigoError + */ + public String getCodigoError() { + return codigoError; + } + + /** + * @param codigoError the codigoError to set + */ + public void setCodigoError(String codigoError) { + this.codigoError = codigoError; + } + + /** + * @return the descripcionError + */ + public String getDescripcionError() { + return descripcionError; + } + + /** + * @param descripcionError the descripcionError to set + */ + public void setDescripcionError(String descripcionError) { + this.descripcionError = descripcionError; + } + + /** + * @return the idToken + */ + public String getIdToken() { + return idToken; + } + + /** + * @param idToken the idToken to set + */ + public void setIdToken(String idToken) { + this.idToken = idToken; + } + + /** + * @return the exito + */ + public Integer getExito() { + return exito; + } + + /** + * @param exito the exito to set + */ + public void setExito(Integer exito) { + this.exito = exito; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/GuardiaXml.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/GuardiaXml.java.svn-base new file mode 100644 index 0000000..3e0c956 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/GuardiaXml.java.svn-base @@ -0,0 +1,93 @@ +/** + * + */ +package com.fp.frontend.webservices.snap.modelo; + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Clase xml con los datos del guardia + * @author Manuel Cepeda + * + */ +@XmlRootElement(name="Guardia") +@XmlAccessorType(XmlAccessType.FIELD) +public class GuardiaXml implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -431606681146448613L; + + + @XmlElement(name="nombre") + private String nombre; + @XmlElement(name="Empresa") + private String empresa; + @XmlElement(name="Estado") + private String estado; + + /** + * + */ + public GuardiaXml() { + } + + public GuardiaXml(String nombre, String empresa, String estado) { + super(); + this.nombre = nombre; + this.empresa = empresa; + this.estado = estado; + } + + /** + * @return the nombre + */ + public String getNombre() { + return nombre; + } + + /** + * @param nombre the nombre to set + */ + public void setNombre(String nombre) { + this.nombre = nombre; + } + + /** + * @return the empresa + */ + public String getEmpresa() { + return empresa; + } + + /** + * @param empresa the empresa to set + */ + public void setEmpresa(String empresa) { + this.empresa = empresa; + } + + /** + * @return the estado + */ + public String getEstado() { + return estado; + } + + /** + * @param estado the estado to set + */ + public void setEstado(String estado) { + this.estado = estado; + } + + + + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/ImagenXml.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/ImagenXml.java.svn-base new file mode 100644 index 0000000..4e603d6 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/ImagenXml.java.svn-base @@ -0,0 +1,91 @@ +/** + * + */ +package com.fp.frontend.webservices.snap.modelo; + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Clase xml con los datos de un archivo imagenes o pdf + * @author Manuel Cepeda + * + */ +@XmlRootElement(name="Imagen") +@XmlAccessorType(XmlAccessType.FIELD) +public class ImagenXml implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -431606681146448613L; + + @XmlElement(name="Imagen") + private String imagen; + @XmlElement(name="Descripcion") + private String descripcion; + @XmlElement(name="Tipo") + private String tipo; + + + /** + * + */ + public ImagenXml() { + } + + public ImagenXml(String imagen, String descripcion, String tipo) { + super(); + this.imagen = imagen; + this.descripcion = descripcion; + this.tipo = tipo; + } + + /** + * @return the imagen + */ + public String getImagen() { + return imagen; + } + + /** + * @param imagen the imagen to set + */ + public void setImagen(String imagen) { + this.imagen = imagen; + } + + /** + * @return the descripcion + */ + public String getDescripcion() { + return descripcion; + } + + /** + * @param descripcion the descripcion to set + */ + public void setDescripcion(String descripcion) { + this.descripcion = descripcion; + } + + /** + * @return the tipo + */ + public String getTipo() { + return tipo; + } + + /** + * @param tipo the tipo to set + */ + public void setTipo(String tipo) { + this.tipo = tipo; + } + + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/ResultadoXml.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/ResultadoXml.java.svn-base new file mode 100644 index 0000000..bd83f88 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/ResultadoXml.java.svn-base @@ -0,0 +1,253 @@ +/** + * + */ +package com.fp.frontend.webservices.snap.modelo; + +import java.io.Serializable; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Clase xml con los elementos de la respuesta de la salida del WS + * @author Manuel Cepeda + * + */ +@XmlRootElement(name="Resultado") +@XmlAccessorType(XmlAccessType.FIELD) +public class ResultadoXml implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -431606681146448613L; + + @XmlElement(name="RazonSocial") + private String razonSocial; + @XmlElement(name="Direccion") + private String direccion; + @XmlElement(name="Email") + private String email; + @XmlElement(name="TelefonoFijo") + private String telefonoFijo; + @XmlElement(name="TelefonoCelular") + private String telefonoCelular; + @XmlElement(name="Empresa") + private String empresa; + @XmlElement(name="Estado") + private String estado; + @XmlElement(name="TestPsicologico") + private ImagenXml testPsicologico; + + @XmlElement(name="ListaTramites") + private List listaTramites; + + @XmlElement(name="ListaGuardias") + private List listaGuardias; + + @XmlElement(name="ListaDatosArma") + private List listaDatosArma; + +// @XmlElement(name="Tramite") +// private String tramite; +// @XmlElement(name="FechaEmision") +// private String fechaEmision; +// @XmlElement(name="FechaExpiracion") +// private String fechaExpiracion; +// @XmlElement(name="NumeroDocumento") +// private String numeroDocumento; + + + @XmlElement(name="TipoPermiso") + private String tipoPermiso; + + /** + * + */ + public ResultadoXml() { + } + + + public ResultadoXml(String razonSocial, String direccion, String email, String telefonoFijo, String telefonoCelular) { + super(); + this.razonSocial = razonSocial; + this.direccion = direccion; + this.email = email; + this.telefonoFijo = telefonoFijo; + this.telefonoCelular = telefonoCelular; + } + + + /** + * @return the razonSocial + */ + public String getRazonSocial() { + return razonSocial; + } + + /** + * @param razonSocial the razonSocial to set + */ + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + /** + * @return the direccion + */ + public String getDireccion() { + return direccion; + } + + /** + * @return the email + */ + public String getEmail() { + return email; + } + + + /** + * @param email the email to set + */ + public void setEmail(String email) { + this.email = email; + } + + + /** + * @param direccion the direccion to set + */ + public void setDireccion(String direccion) { + this.direccion = direccion; + } + + /** + * @return the telefonoFijo + */ + public String getTelefonoFijo() { + return telefonoFijo; + } + + /** + * @param telefonoFijo the telefonoFijo to set + */ + public void setTelefonoFijo(String telefonoFijo) { + this.telefonoFijo = telefonoFijo; + } + + /** + * @return the telefonoCelular + */ + public String getTelefonoCelular() { + return telefonoCelular; + } + + /** + * @param telefonoCelular the telefonoCelular to set + */ + public void setTelefonoCelular(String telefonoCelular) { + this.telefonoCelular = telefonoCelular; + } + + /** + * @return the empresa + */ + public String getEmpresa() { + return empresa; + } + + /** + * @param empresa the empresa to set + */ + public void setEmpresa(String empresa) { + this.empresa = empresa; + } + + /** + * @return the estado + */ + public String getEstado() { + return estado; + } + + /** + * @param estado the estado to set + */ + public void setEstado(String estado) { + this.estado = estado; + } + + /** + * @return the tipoPermiso + */ + public String getTipoPermiso() { + return tipoPermiso; + } + + /** + * @param tipoPermiso the tipoPermiso to set + */ + public void setTipoPermiso(String tipoPermiso) { + this.tipoPermiso = tipoPermiso; + } + + /** + * @return the listaTramites + */ + public List getListaTramites() { + return listaTramites; + } + + /** + * @param listaTramites the listaTramites to set + */ + public void setListaTramites(List listaTramites) { + this.listaTramites = listaTramites; + } + + /** + * @return the listaGuardias + */ + public List getListaGuardias() { + return listaGuardias; + } + + /** + * @param listaGuardias the listaGuardias to set + */ + public void setListaGuardias(List listaGuardias) { + this.listaGuardias = listaGuardias; + } + + /** + * @return the listaDatosArma + */ + public List getListaDatosArma() { + return listaDatosArma; + } + + /** + * @param listaDatosArma the listaDatosArma to set + */ + public void setListaDatosArma(List listaDatosArma) { + this.listaDatosArma = listaDatosArma; + } + + /** + * @return the testPsicologico + */ + public ImagenXml getTestPsicologico() { + return testPsicologico; + } + + /** + * @param testPsicologico the testPsicologico to set + */ + public void setTestPsicologico(ImagenXml testPsicologico) { + this.testPsicologico = testPsicologico; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/SoapEnvelopWrapper.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/SoapEnvelopWrapper.java.svn-base new file mode 100644 index 0000000..f170048 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/SoapEnvelopWrapper.java.svn-base @@ -0,0 +1,102 @@ +/** + * + */ +package com.fp.frontend.webservices.snap.modelo; + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +/** + * Clase xml con los elementos de la salida del WS + * @author Manuel Ceped + * + */ +@XmlRootElement(name="Respuesta") +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType (propOrder={"cabeceraXml","ejecucionXml","resultadoXml"}) +public class SoapEnvelopWrapper implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 3927908598537900589L; + + @XmlElementRef + private CabeceraXml cabeceraXml; + + @XmlElementRef + private EjecucionXml ejecucionXml; + + @XmlElementRef + private ResultadoXml resultadoXml; + + /** + * + */ + public SoapEnvelopWrapper() { + } + + + /** + * @param cabeceraXml + * @param ejecucionXml + * @param resultadoXml + */ + public SoapEnvelopWrapper(CabeceraXml cabeceraXml, + EjecucionXml ejecucionXml, ResultadoXml resultadoXml) { + super(); + this.cabeceraXml = cabeceraXml; + this.ejecucionXml = ejecucionXml; + this.resultadoXml = resultadoXml; + } + + + + /** + * @return the cabeceraXml + */ + public CabeceraXml getCabeceraXml() { + return cabeceraXml; + } + + /** + * @param cabeceraXml the cabeceraXml to set + */ + public void setCabeceraXml(CabeceraXml cabeceraXml) { + this.cabeceraXml = cabeceraXml; + } + + /** + * @return the ejecucionXml + */ + public EjecucionXml getEjecucionXml() { + return ejecucionXml; + } + + /** + * @param ejecucionXml the ejecucionXml to set + */ + public void setEjecucionXml(EjecucionXml ejecucionXml) { + this.ejecucionXml = ejecucionXml; + } + + /** + * @return the resultadoXml + */ + public ResultadoXml getResultadoXml() { + return resultadoXml; + } + + /** + * @param resultadoXml the resultadoXml to set + */ + public void setResultadoXml(ResultadoXml resultadoXml) { + this.resultadoXml = resultadoXml; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/TramiteXml.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/TramiteXml.java.svn-base new file mode 100644 index 0000000..cf098be --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/.svn/text-base/TramiteXml.java.svn-base @@ -0,0 +1,111 @@ +/** + * + */ +package com.fp.frontend.webservices.snap.modelo; + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Clase xml con los datos del tramite + * @author Manuel Cepeda + * + */ +@XmlRootElement(name="Tramite") +@XmlAccessorType(XmlAccessType.FIELD) +public class TramiteXml implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -431606681146448613L; + + + @XmlElement(name="Tramite") + private String tramite; + @XmlElement(name="FechaEmision") + private String fechaEmision; + @XmlElement(name="FechaExpiracion") + private String fechaExpiracion; + @XmlElement(name="NumeroDocumento") + private String numeroDocumento; + + + /** + * + */ + public TramiteXml() { + } + + + public TramiteXml (String fechaEmision, + String fechaExpiracion, String numeroDocumento) { + super(); + + this.fechaEmision = fechaEmision; + this.fechaExpiracion = fechaExpiracion; + this.numeroDocumento = numeroDocumento; + } + + + /** + * @return the tramite + */ + public String getTramite() { + return tramite; + } + + /** + * @param tramite the tramite to set + */ + public void setTramite(String tramite) { + this.tramite = tramite; + } + + /** + * @return the fechaEmision + */ + public String getFechaEmision() { + return fechaEmision; + } + + /** + * @param fechaEmision the fechaEmision to set + */ + public void setFechaEmision(String fechaEmision) { + this.fechaEmision = fechaEmision; + } + + /** + * @return the fechaExpiracion + */ + public String getFechaExpiracion() { + return fechaExpiracion; + } + + /** + * @param fechaExpiracion the fechaExpiracion to set + */ + public void setFechaExpiracion(String fechaExpiracion) { + this.fechaExpiracion = fechaExpiracion; + } + + /** + * @return the numeroDocumento + */ + public String getNumeroDocumento() { + return numeroDocumento; + } + + /** + * @param numeroDocumento the numeroDocumento to set + */ + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/CabeceraXml.java b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/CabeceraXml.java new file mode 100644 index 0000000..4d22c65 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/CabeceraXml.java @@ -0,0 +1,92 @@ +/** + * + */ +package com.fp.frontend.webservices.snap.modelo; + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +/** + * Clase xml con los elementos de la cabecera de la salida del WS + * + * @author Manuel Cepeda + * + */ +@XmlRootElement(name = "Cabecera") +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(propOrder = {"idMensaje", "fecha", "hora"}) +public class CabeceraXml implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1216982166335460756L; + + @XmlElement(name = "IdMensaje") + private String idMensaje; + @XmlElement(name = "Fecha") + private String fecha; + @XmlElement(name = "Hora") + private String hora; + + /** + * + */ + public CabeceraXml() { + } + + public CabeceraXml(String idMensaje, String fecha, String hora) { + super(); + this.idMensaje = idMensaje; + this.fecha = fecha; + this.hora = hora; + } + + /** + * @return the idMensaje + */ + public String getIdMensaje() { + return idMensaje; + } + + /** + * @param idMensaje the idMensaje to set + */ + public void setIdMensaje(String idMensaje) { + this.idMensaje = idMensaje; + } + + /** + * @return the fecha + */ + public String getFecha() { + return fecha; + } + + /** + * @param fecha the fecha to set + */ + public void setFecha(String fecha) { + this.fecha = fecha; + } + + /** + * @return the hora + */ + public String getHora() { + return hora; + } + + /** + * @param hora the hora to set + */ + public void setHora(String hora) { + this.hora = hora; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/DatosArmaXml.java b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/DatosArmaXml.java new file mode 100644 index 0000000..f1ef5c1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/DatosArmaXml.java @@ -0,0 +1,181 @@ +/** + * + */ +package com.fp.frontend.webservices.snap.modelo; + +import java.io.Serializable; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Clase xml con los datos de la arma + * + * @author Manuel Cepeda + * + */ +@XmlRootElement(name = "DatosArma") +@XmlAccessorType(XmlAccessType.FIELD) +public class DatosArmaXml implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -431606681146448613L; + + @XmlElement(name = "Lote") + private String lote; + @XmlElement(name = "DescripcionClase") + private String descripcionClase; + @XmlElement(name = "DescripcionTipo") + private String descripcionTipo; + @XmlElement(name = "Tipofabricante") + private String tipofabricante; + @XmlElement(name = "marca") + private String marca; + @XmlElement(name = "Calibre") + private String calibre; + @XmlElement(name = "ModeloArma") + private String modeloArma; + @XmlElement(name = "EstadoArma") + private String estadoArma; + + @XmlElement(name = "ListaImagen") + private List listaImagen; + + /** + * + */ + public DatosArmaXml() { + } + + /** + * @return the lote + */ + public String getLote() { + return lote; + } + + /** + * @param lote the lote to set + */ + public void setLote(String lote) { + this.lote = lote; + } + + /** + * @return the descripcionClase + */ + public String getDescripcionClase() { + return descripcionClase; + } + + /** + * @param descripcionClase the descripcionClase to set + */ + public void setDescripcionClase(String descripcionClase) { + this.descripcionClase = descripcionClase; + } + + /** + * @return the descripcionTipo + */ + public String getDescripcionTipo() { + return descripcionTipo; + } + + /** + * @param descripcionTipo the descripcionTipo to set + */ + public void setDescripcionTipo(String descripcionTipo) { + this.descripcionTipo = descripcionTipo; + } + + /** + * @return the tipofabricante + */ + public String getTipofabricante() { + return tipofabricante; + } + + /** + * @param tipofabricante the tipofabricante to set + */ + public void setTipofabricante(String tipofabricante) { + this.tipofabricante = tipofabricante; + } + + /** + * @return the marca + */ + public String getMarca() { + return marca; + } + + /** + * @param marca the marca to set + */ + public void setMarca(String marca) { + this.marca = marca; + } + + /** + * @return the calibre + */ + public String getCalibre() { + return calibre; + } + + /** + * @param calibre the calibre to set + */ + public void setCalibre(String calibre) { + this.calibre = calibre; + } + + /** + * @return the modeloArma + */ + public String getModeloArma() { + return modeloArma; + } + + /** + * @param modeloArma the modeloArma to set + */ + public void setModeloArma(String modeloArma) { + this.modeloArma = modeloArma; + } + + /** + * @return the estadoArma + */ + public String getEstadoArma() { + return estadoArma; + } + + /** + * @param estadoArma the estadoArma to set + */ + public void setEstadoArma(String estadoArma) { + this.estadoArma = estadoArma; + } + + /** + * @return the listaImagen + */ + public List getListaImagen() { + return listaImagen; + } + + /** + * @param listaImagen the listaImagen to set + */ + public void setListaImagen(List listaImagen) { + this.listaImagen = listaImagen; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/EjecucionXml.java b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/EjecucionXml.java new file mode 100644 index 0000000..455761c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/EjecucionXml.java @@ -0,0 +1,119 @@ +/** + * + */ +package com.fp.frontend.webservices.snap.modelo; + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +/** + * Clase xml con los elementos de la ejecucion en la salida del WS + * + * @author Manuel Cepeda + * + */ +@XmlRootElement(name = "Ejecucion") +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(propOrder = {"exito", "codigoError", "descripcionError", "idToken"}) +public class EjecucionXml implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 6677743930807519383L; + + @XmlElement(name = "Exito") + private Integer exito; + + @XmlElement(name = "CodigoError") + private String codigoError; + + @XmlElement(name = "DescripcionError") + private String descripcionError; + + @XmlElement(name = "IdToken") + private String idToken; + + /** + * + */ + public EjecucionXml() { + } + + /** + * @param exito + * @param codigoError + * @param descripcionError + * @param idToken + */ + public EjecucionXml(Integer exito, String codigoError, + String descripcionError, String idToken) { + super(); + this.exito = exito; + this.codigoError = codigoError; + this.descripcionError = descripcionError; + this.idToken = idToken; + } + + /** + * @return the codigoError + */ + public String getCodigoError() { + return codigoError; + } + + /** + * @param codigoError the codigoError to set + */ + public void setCodigoError(String codigoError) { + this.codigoError = codigoError; + } + + /** + * @return the descripcionError + */ + public String getDescripcionError() { + return descripcionError; + } + + /** + * @param descripcionError the descripcionError to set + */ + public void setDescripcionError(String descripcionError) { + this.descripcionError = descripcionError; + } + + /** + * @return the idToken + */ + public String getIdToken() { + return idToken; + } + + /** + * @param idToken the idToken to set + */ + public void setIdToken(String idToken) { + this.idToken = idToken; + } + + /** + * @return the exito + */ + public Integer getExito() { + return exito; + } + + /** + * @param exito the exito to set + */ + public void setExito(Integer exito) { + this.exito = exito; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/GuardiaXml.java b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/GuardiaXml.java new file mode 100644 index 0000000..7bb157c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/GuardiaXml.java @@ -0,0 +1,90 @@ +/** + * + */ +package com.fp.frontend.webservices.snap.modelo; + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Clase xml con los datos del guardia + * + * @author Manuel Cepeda + * + */ +@XmlRootElement(name = "Guardia") +@XmlAccessorType(XmlAccessType.FIELD) +public class GuardiaXml implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -431606681146448613L; + + @XmlElement(name = "nombre") + private String nombre; + @XmlElement(name = "Empresa") + private String empresa; + @XmlElement(name = "Estado") + private String estado; + + /** + * + */ + public GuardiaXml() { + } + + public GuardiaXml(String nombre, String empresa, String estado) { + super(); + this.nombre = nombre; + this.empresa = empresa; + this.estado = estado; + } + + /** + * @return the nombre + */ + public String getNombre() { + return nombre; + } + + /** + * @param nombre the nombre to set + */ + public void setNombre(String nombre) { + this.nombre = nombre; + } + + /** + * @return the empresa + */ + public String getEmpresa() { + return empresa; + } + + /** + * @param empresa the empresa to set + */ + public void setEmpresa(String empresa) { + this.empresa = empresa; + } + + /** + * @return the estado + */ + public String getEstado() { + return estado; + } + + /** + * @param estado the estado to set + */ + public void setEstado(String estado) { + this.estado = estado; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/ImagenXml.java b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/ImagenXml.java new file mode 100644 index 0000000..639eebe --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/ImagenXml.java @@ -0,0 +1,90 @@ +/** + * + */ +package com.fp.frontend.webservices.snap.modelo; + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Clase xml con los datos de un archivo imagenes o pdf + * + * @author Manuel Cepeda + * + */ +@XmlRootElement(name = "Imagen") +@XmlAccessorType(XmlAccessType.FIELD) +public class ImagenXml implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -431606681146448613L; + + @XmlElement(name = "Imagen") + private String imagen; + @XmlElement(name = "Descripcion") + private String descripcion; + @XmlElement(name = "Tipo") + private String tipo; + + /** + * + */ + public ImagenXml() { + } + + public ImagenXml(String imagen, String descripcion, String tipo) { + super(); + this.imagen = imagen; + this.descripcion = descripcion; + this.tipo = tipo; + } + + /** + * @return the imagen + */ + public String getImagen() { + return imagen; + } + + /** + * @param imagen the imagen to set + */ + public void setImagen(String imagen) { + this.imagen = imagen; + } + + /** + * @return the descripcion + */ + public String getDescripcion() { + return descripcion; + } + + /** + * @param descripcion the descripcion to set + */ + public void setDescripcion(String descripcion) { + this.descripcion = descripcion; + } + + /** + * @return the tipo + */ + public String getTipo() { + return tipo; + } + + /** + * @param tipo the tipo to set + */ + public void setTipo(String tipo) { + this.tipo = tipo; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/ResultadoXml.java b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/ResultadoXml.java new file mode 100644 index 0000000..4b99ccc --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/ResultadoXml.java @@ -0,0 +1,248 @@ +/** + * + */ +package com.fp.frontend.webservices.snap.modelo; + +import java.io.Serializable; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Clase xml con los elementos de la respuesta de la salida del WS + * + * @author Manuel Cepeda + * + */ +@XmlRootElement(name = "Resultado") +@XmlAccessorType(XmlAccessType.FIELD) +public class ResultadoXml implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -431606681146448613L; + + @XmlElement(name = "RazonSocial") + private String razonSocial; + @XmlElement(name = "Direccion") + private String direccion; + @XmlElement(name = "Email") + private String email; + @XmlElement(name = "TelefonoFijo") + private String telefonoFijo; + @XmlElement(name = "TelefonoCelular") + private String telefonoCelular; + @XmlElement(name = "Empresa") + private String empresa; + @XmlElement(name = "Estado") + private String estado; + @XmlElement(name = "TestPsicologico") + private ImagenXml testPsicologico; + + @XmlElement(name = "ListaTramites") + private List listaTramites; + + @XmlElement(name = "ListaGuardias") + private List listaGuardias; + + @XmlElement(name = "ListaDatosArma") + private List listaDatosArma; + +// @XmlElement(name="Tramite") +// private String tramite; +// @XmlElement(name="FechaEmision") +// private String fechaEmision; +// @XmlElement(name="FechaExpiracion") +// private String fechaExpiracion; +// @XmlElement(name="NumeroDocumento") +// private String numeroDocumento; + @XmlElement(name = "TipoPermiso") + private String tipoPermiso; + + /** + * + */ + public ResultadoXml() { + } + + public ResultadoXml(String razonSocial, String direccion, String email, String telefonoFijo, String telefonoCelular) { + super(); + this.razonSocial = razonSocial; + this.direccion = direccion; + this.email = email; + this.telefonoFijo = telefonoFijo; + this.telefonoCelular = telefonoCelular; + } + + /** + * @return the razonSocial + */ + public String getRazonSocial() { + return razonSocial; + } + + /** + * @param razonSocial the razonSocial to set + */ + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + /** + * @return the direccion + */ + public String getDireccion() { + return direccion; + } + + /** + * @return the email + */ + public String getEmail() { + return email; + } + + /** + * @param email the email to set + */ + public void setEmail(String email) { + this.email = email; + } + + /** + * @param direccion the direccion to set + */ + public void setDireccion(String direccion) { + this.direccion = direccion; + } + + /** + * @return the telefonoFijo + */ + public String getTelefonoFijo() { + return telefonoFijo; + } + + /** + * @param telefonoFijo the telefonoFijo to set + */ + public void setTelefonoFijo(String telefonoFijo) { + this.telefonoFijo = telefonoFijo; + } + + /** + * @return the telefonoCelular + */ + public String getTelefonoCelular() { + return telefonoCelular; + } + + /** + * @param telefonoCelular the telefonoCelular to set + */ + public void setTelefonoCelular(String telefonoCelular) { + this.telefonoCelular = telefonoCelular; + } + + /** + * @return the empresa + */ + public String getEmpresa() { + return empresa; + } + + /** + * @param empresa the empresa to set + */ + public void setEmpresa(String empresa) { + this.empresa = empresa; + } + + /** + * @return the estado + */ + public String getEstado() { + return estado; + } + + /** + * @param estado the estado to set + */ + public void setEstado(String estado) { + this.estado = estado; + } + + /** + * @return the tipoPermiso + */ + public String getTipoPermiso() { + return tipoPermiso; + } + + /** + * @param tipoPermiso the tipoPermiso to set + */ + public void setTipoPermiso(String tipoPermiso) { + this.tipoPermiso = tipoPermiso; + } + + /** + * @return the listaTramites + */ + public List getListaTramites() { + return listaTramites; + } + + /** + * @param listaTramites the listaTramites to set + */ + public void setListaTramites(List listaTramites) { + this.listaTramites = listaTramites; + } + + /** + * @return the listaGuardias + */ + public List getListaGuardias() { + return listaGuardias; + } + + /** + * @param listaGuardias the listaGuardias to set + */ + public void setListaGuardias(List listaGuardias) { + this.listaGuardias = listaGuardias; + } + + /** + * @return the listaDatosArma + */ + public List getListaDatosArma() { + return listaDatosArma; + } + + /** + * @param listaDatosArma the listaDatosArma to set + */ + public void setListaDatosArma(List listaDatosArma) { + this.listaDatosArma = listaDatosArma; + } + + /** + * @return the testPsicologico + */ + public ImagenXml getTestPsicologico() { + return testPsicologico; + } + + /** + * @param testPsicologico the testPsicologico to set + */ + public void setTestPsicologico(ImagenXml testPsicologico) { + this.testPsicologico = testPsicologico; + } +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/SoapEnvelopWrapper.java b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/SoapEnvelopWrapper.java new file mode 100644 index 0000000..e82c071 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/SoapEnvelopWrapper.java @@ -0,0 +1,100 @@ +/** + * + */ +package com.fp.frontend.webservices.snap.modelo; + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +/** + * Clase xml con los elementos de la salida del WS + * + * @author Manuel Ceped + * + */ +@XmlRootElement(name = "Respuesta") +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(propOrder = {"cabeceraXml", "ejecucionXml", "resultadoXml"}) +public class SoapEnvelopWrapper implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 3927908598537900589L; + + @XmlElementRef + private CabeceraXml cabeceraXml; + + @XmlElementRef + private EjecucionXml ejecucionXml; + + @XmlElementRef + private ResultadoXml resultadoXml; + + /** + * + */ + public SoapEnvelopWrapper() { + } + + /** + * @param cabeceraXml + * @param ejecucionXml + * @param resultadoXml + */ + public SoapEnvelopWrapper(CabeceraXml cabeceraXml, + EjecucionXml ejecucionXml, ResultadoXml resultadoXml) { + super(); + this.cabeceraXml = cabeceraXml; + this.ejecucionXml = ejecucionXml; + this.resultadoXml = resultadoXml; + } + + /** + * @return the cabeceraXml + */ + public CabeceraXml getCabeceraXml() { + return cabeceraXml; + } + + /** + * @param cabeceraXml the cabeceraXml to set + */ + public void setCabeceraXml(CabeceraXml cabeceraXml) { + this.cabeceraXml = cabeceraXml; + } + + /** + * @return the ejecucionXml + */ + public EjecucionXml getEjecucionXml() { + return ejecucionXml; + } + + /** + * @param ejecucionXml the ejecucionXml to set + */ + public void setEjecucionXml(EjecucionXml ejecucionXml) { + this.ejecucionXml = ejecucionXml; + } + + /** + * @return the resultadoXml + */ + public ResultadoXml getResultadoXml() { + return resultadoXml; + } + + /** + * @param resultadoXml the resultadoXml to set + */ + public void setResultadoXml(ResultadoXml resultadoXml) { + this.resultadoXml = resultadoXml; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/TramiteXml.java b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/TramiteXml.java new file mode 100644 index 0000000..f2d5c6e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/modelo/TramiteXml.java @@ -0,0 +1,108 @@ +/** + * + */ +package com.fp.frontend.webservices.snap.modelo; + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Clase xml con los datos del tramite + * + * @author Manuel Cepeda + * + */ +@XmlRootElement(name = "Tramite") +@XmlAccessorType(XmlAccessType.FIELD) +public class TramiteXml implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -431606681146448613L; + + @XmlElement(name = "Tramite") + private String tramite; + @XmlElement(name = "FechaEmision") + private String fechaEmision; + @XmlElement(name = "FechaExpiracion") + private String fechaExpiracion; + @XmlElement(name = "NumeroDocumento") + private String numeroDocumento; + + /** + * + */ + public TramiteXml() { + } + + public TramiteXml(String fechaEmision, + String fechaExpiracion, String numeroDocumento) { + super(); + + this.fechaEmision = fechaEmision; + this.fechaExpiracion = fechaExpiracion; + this.numeroDocumento = numeroDocumento; + } + + /** + * @return the tramite + */ + public String getTramite() { + return tramite; + } + + /** + * @param tramite the tramite to set + */ + public void setTramite(String tramite) { + this.tramite = tramite; + } + + /** + * @return the fechaEmision + */ + public String getFechaEmision() { + return fechaEmision; + } + + /** + * @param fechaEmision the fechaEmision to set + */ + public void setFechaEmision(String fechaEmision) { + this.fechaEmision = fechaEmision; + } + + /** + * @return the fechaExpiracion + */ + public String getFechaExpiracion() { + return fechaExpiracion; + } + + /** + * @param fechaExpiracion the fechaExpiracion to set + */ + public void setFechaExpiracion(String fechaExpiracion) { + this.fechaExpiracion = fechaExpiracion; + } + + /** + * @return the numeroDocumento + */ + public String getNumeroDocumento() { + return numeroDocumento; + } + + /** + * @param numeroDocumento the numeroDocumento to set + */ + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/entries b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/entries new file mode 100644 index 0000000..4a6a693 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/entries @@ -0,0 +1,266 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +ConsultarRucResponse.java +file + + + + +2022-07-28T03:39:45.930557Z +d965e3c834dc3ab6d72090699c7e0aae +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1643 + +ConsultarRuc.java +file + + + + +2022-07-28T03:39:45.930557Z +58e5753df02e91730463c0d9be2289e5 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1391 + +package-info.java +file + + + + +2022-07-28T03:39:45.930557Z +02810f215cb2f32937123d39bf791016 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +136 + +ClienteRUC.java +file + + + + +2022-07-28T03:39:45.931557Z +29b1de816792c2c32074b25007df33a4 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +763 + +RucServicio.java +file + + + + +2022-07-28T03:39:45.931557Z +a9b9552fe718fdc4708d4412e11973c2 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +1403 + +ObjectFactory.java +file + + + + +2022-07-28T03:39:45.931557Z +043dd86f5eb69c0c1174124027771ded +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +2567 + +RucServicioService.java +file + + + + +2022-07-28T03:39:45.932557Z +4427a8ca9749425d4ee3cab18e1f7dd1 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 +has-props + + + + + + + + + + + + + + + + + + + + +3267 + diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/prop-base/ClienteRUC.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/prop-base/ClienteRUC.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/prop-base/ClienteRUC.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/prop-base/ConsultarRuc.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/prop-base/ConsultarRuc.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/prop-base/ConsultarRuc.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/prop-base/ConsultarRucResponse.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/prop-base/ConsultarRucResponse.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/prop-base/ConsultarRucResponse.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/prop-base/ObjectFactory.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/prop-base/ObjectFactory.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/prop-base/ObjectFactory.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/prop-base/RucServicio.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/prop-base/RucServicio.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/prop-base/RucServicio.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/prop-base/RucServicioService.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/prop-base/RucServicioService.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/prop-base/RucServicioService.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/prop-base/package-info.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/prop-base/package-info.java.svn-base new file mode 100644 index 0000000..138f983 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/prop-base/package-info.java.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 10 +text/plain +END diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/text-base/ClienteRUC.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/text-base/ClienteRUC.java.svn-base new file mode 100644 index 0000000..90e790a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/text-base/ClienteRUC.java.svn-base @@ -0,0 +1,30 @@ +package com.fp.frontend.webservices.snap.ruc; + +import com.fp.common.logger.APPLogger; + +import ec.gov.sri.wsconsultacontribuyente.Contribuyente; + +/** + * Clase que maneja el servicio del SRI en la SNAP + * @author dcruz + * + */ +public class ClienteRUC { + + /** + * Obtiene los datos del contribuyente según el RUC enviado + * @param ruc + * @return + */ + public static Contribuyente obtenerRUC(String ruc) { + Contribuyente contribuyenteResult = null; + try { + RucServicioService rucServicioService = new RucServicioService(); + contribuyenteResult = rucServicioService.getRucServicioPort().consultarRuc(ruc); + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + return contribuyenteResult; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/text-base/ConsultarRuc.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/text-base/ConsultarRuc.java.svn-base new file mode 100644 index 0000000..9f03410 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/text-base/ConsultarRuc.java.svn-base @@ -0,0 +1,60 @@ + +package com.fp.frontend.webservices.snap.ruc; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Clase Java para consultarRuc complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="consultarRuc">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="ruc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "consultarRuc", propOrder = { + "ruc" +}) +public class ConsultarRuc { + + protected String ruc; + + /** + * Obtiene el valor de la propiedad ruc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRuc() { + return ruc; + } + + /** + * Define el valor de la propiedad ruc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRuc(String value) { + this.ruc = value; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/text-base/ConsultarRucResponse.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/text-base/ConsultarRucResponse.java.svn-base new file mode 100644 index 0000000..1047896 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/text-base/ConsultarRucResponse.java.svn-base @@ -0,0 +1,63 @@ + +package com.fp.frontend.webservices.snap.ruc; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; +import ec.gov.sri.wsconsultacontribuyente.Contribuyente; + + +/** + *

Clase Java para consultarRucResponse complex type. + * + *

El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. + * + *

+ * <complexType name="consultarRucResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://sri.gov.ec/wsConsultaContribuyente}contribuyente" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "consultarRucResponse", propOrder = { + "_return" +}) +public class ConsultarRucResponse { + + @XmlElement(name = "return") + protected Contribuyente _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return + * possible object is + * {@link Contribuyente } + * + */ + public Contribuyente getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value + * allowed object is + * {@link Contribuyente } + * + */ + public void setReturn(Contribuyente value) { + this._return = value; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/text-base/ObjectFactory.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/text-base/ObjectFactory.java.svn-base new file mode 100644 index 0000000..d3f2011 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/text-base/ObjectFactory.java.svn-base @@ -0,0 +1,71 @@ + +package com.fp.frontend.webservices.snap.ruc; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.fp.webservices.snap.ruc package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _ConsultarRuc_QNAME = new QName("http://ruc.snap.webservices.fp.com/", "consultarRuc"); + private final static QName _ConsultarRucResponse_QNAME = new QName("http://ruc.snap.webservices.fp.com/", "consultarRucResponse"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.fp.webservices.snap.ruc + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link ConsultarRucResponse } + * + */ + public ConsultarRucResponse createConsultarRucResponse() { + return new ConsultarRucResponse(); + } + + /** + * Create an instance of {@link ConsultarRuc } + * + */ + public ConsultarRuc createConsultarRuc() { + return new ConsultarRuc(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ConsultarRuc }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ruc.snap.webservices.fp.com/", name = "consultarRuc") + public JAXBElement createConsultarRuc(ConsultarRuc value) { + return new JAXBElement(_ConsultarRuc_QNAME, ConsultarRuc.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ConsultarRucResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ruc.snap.webservices.fp.com/", name = "consultarRucResponse") + public JAXBElement createConsultarRucResponse(ConsultarRucResponse value) { + return new JAXBElement(_ConsultarRucResponse_QNAME, ConsultarRucResponse.class, null, value); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/text-base/RucServicio.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/text-base/RucServicio.java.svn-base new file mode 100644 index 0000000..56215dc --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/text-base/RucServicio.java.svn-base @@ -0,0 +1,42 @@ + +package com.fp.frontend.webservices.snap.ruc; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; +import ec.gov.sri.wsconsultacontribuyente.Contribuyente; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.6b21 + * Generated source version: 2.2 + * + */ +@WebService(name = "RucServicio", targetNamespace = "http://ruc.snap.webservices.fp.com/") +@XmlSeeAlso({ + com.fp.frontend.webservices.snap.ruc.ObjectFactory.class, + ec.gov.sri.wsconsultacontribuyente.ObjectFactory.class +}) +public interface RucServicio { + + + /** + * + * @param ruc + * @return + * returns ec.gov.sri.wsconsultacontribuyente.Contribuyente + */ + @WebMethod + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "consultarRuc", targetNamespace = "http://ruc.snap.webservices.fp.com/", className = "com.fp.frontend.webservices.snap.ruc.ConsultarRuc") + @ResponseWrapper(localName = "consultarRucResponse", targetNamespace = "http://ruc.snap.webservices.fp.com/", className = "com.fp.frontend.webservices.snap.ruc.ConsultarRucResponse") + public Contribuyente consultarRuc( + @WebParam(name = "ruc", targetNamespace = "") + String ruc); + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/text-base/RucServicioService.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/text-base/RucServicioService.java.svn-base new file mode 100644 index 0000000..ea9afdc --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/text-base/RucServicioService.java.svn-base @@ -0,0 +1,97 @@ + +package com.fp.frontend.webservices.snap.ruc; + +import java.net.MalformedURLException; +import java.net.URL; + +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceException; +import javax.xml.ws.WebServiceFeature; + +import com.fp.frontend.utility.MsgControlArmas; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.2.6b21 + * Generated source version: 2.2 + * + */ +@WebServiceClient(name = "RucServicioService", targetNamespace = "http://ruc.snap.webservices.fp.com/", wsdlLocation = "https://serviciosarmas.ccffaa.mil.ec:8085/serviceRUC?wsdl") +public class RucServicioService + extends Service +{ + + private final static URL RUCSERVICIOSERVICE_WSDL_LOCATION; + private final static WebServiceException RUCSERVICIOSERVICE_EXCEPTION; + private final static QName RUCSERVICIOSERVICE_QNAME = new QName("http://ruc.snap.webservices.fp.com/", "RucServicioService"); + + static { + URL url = null; + WebServiceException e = null; + try { + url = new URL(MsgControlArmas.getProperty("url_snap_servicio_ruc")); + } catch (MalformedURLException ex) { + e = new WebServiceException(ex); + } + RUCSERVICIOSERVICE_WSDL_LOCATION = url; + RUCSERVICIOSERVICE_EXCEPTION = e; + } + + public RucServicioService() { + super(__getWsdlLocation(), RUCSERVICIOSERVICE_QNAME); + } + + public RucServicioService(WebServiceFeature... features) { + super(__getWsdlLocation(), RUCSERVICIOSERVICE_QNAME, features); + } + + public RucServicioService(URL wsdlLocation) { + super(wsdlLocation, RUCSERVICIOSERVICE_QNAME); + } + + public RucServicioService(URL wsdlLocation, WebServiceFeature... features) { + super(wsdlLocation, RUCSERVICIOSERVICE_QNAME, features); + } + + public RucServicioService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public RucServicioService(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * + * @return + * returns RucServicio + */ + @WebEndpoint(name = "RucServicioPort") + public RucServicio getRucServicioPort() { + return super.getPort(new QName("http://ruc.snap.webservices.fp.com/", "RucServicioPort"), RucServicio.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns RucServicio + */ + @WebEndpoint(name = "RucServicioPort") + public RucServicio getRucServicioPort(WebServiceFeature... features) { + return super.getPort(new QName("http://ruc.snap.webservices.fp.com/", "RucServicioPort"), RucServicio.class, features); + } + + private static URL __getWsdlLocation() { + if (RUCSERVICIOSERVICE_EXCEPTION!= null) { + throw RUCSERVICIOSERVICE_EXCEPTION; + } + return RUCSERVICIOSERVICE_WSDL_LOCATION; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/text-base/package-info.java.svn-base b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/text-base/package-info.java.svn-base new file mode 100644 index 0000000..aafd254 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/.svn/text-base/package-info.java.svn-base @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://ruc.snap.webservices.fp.com/") +package com.fp.frontend.webservices.snap.ruc; diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/ClienteRUC.java b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/ClienteRUC.java new file mode 100644 index 0000000..f00104e --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/ClienteRUC.java @@ -0,0 +1,32 @@ +package com.fp.frontend.webservices.snap.ruc; + +import com.fp.common.logger.APPLogger; + +import ec.gov.sri.wsconsultacontribuyente.Contribuyente; + +/** + * Clase que maneja el servicio del SRI en la SNAP + * + * @author dcruz + * + */ +public class ClienteRUC { + + /** + * Obtiene los datos del contribuyente según el RUC enviado + * + * @param ruc + * @return + */ + public static Contribuyente obtenerRUC(String ruc) { + Contribuyente contribuyenteResult = null; + try { + RucServicioService rucServicioService = new RucServicioService(); + contribuyenteResult = rucServicioService.getRucServicioPort().consultarRuc(ruc); + } catch (Throwable e) { + APPLogger.getLogger().error(e.getMessage(), e); + } + return contribuyenteResult; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/ConsultarRuc.java b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/ConsultarRuc.java new file mode 100644 index 0000000..63fefa1 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/ConsultarRuc.java @@ -0,0 +1,57 @@ +package com.fp.frontend.webservices.snap.ruc; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + +/** + *

+ * Clase Java para consultarRuc complex type. + * + *

+ * El siguiente fragmento de esquema especifica el contenido que se espera que + * haya en esta clase. + * + *

+ * <complexType name="consultarRuc">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="ruc" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "consultarRuc", propOrder = { + "ruc" +}) +public class ConsultarRuc { + + protected String ruc; + + /** + * Obtiene el valor de la propiedad ruc. + * + * @return possible object is {@link String } + * + */ + public String getRuc() { + return ruc; + } + + /** + * Define el valor de la propiedad ruc. + * + * @param value allowed object is {@link String } + * + */ + public void setRuc(String value) { + this.ruc = value; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/ConsultarRucResponse.java b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/ConsultarRucResponse.java new file mode 100644 index 0000000..490e90a --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/ConsultarRucResponse.java @@ -0,0 +1,60 @@ +package com.fp.frontend.webservices.snap.ruc; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; +import ec.gov.sri.wsconsultacontribuyente.Contribuyente; + +/** + *

+ * Clase Java para consultarRucResponse complex type. + * + *

+ * El siguiente fragmento de esquema especifica el contenido que se espera que + * haya en esta clase. + * + *

+ * <complexType name="consultarRucResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://sri.gov.ec/wsConsultaContribuyente}contribuyente" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "consultarRucResponse", propOrder = { + "_return" +}) +public class ConsultarRucResponse { + + @XmlElement(name = "return") + protected Contribuyente _return; + + /** + * Obtiene el valor de la propiedad return. + * + * @return possible object is {@link Contribuyente } + * + */ + public Contribuyente getReturn() { + return _return; + } + + /** + * Define el valor de la propiedad return. + * + * @param value allowed object is {@link Contribuyente } + * + */ + public void setReturn(Contribuyente value) { + this._return = value; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/ObjectFactory.java b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/ObjectFactory.java new file mode 100644 index 0000000..b473f9c --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/ObjectFactory.java @@ -0,0 +1,69 @@ +package com.fp.frontend.webservices.snap.ruc; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + +/** + * This object contains factory methods for each Java content interface and Java + * element interface generated in the com.fp.webservices.snap.ruc package. + *

+ * An ObjectFactory allows you to programatically construct new instances of the + * Java representation for XML content. The Java representation of XML content + * can consist of schema derived interfaces and classes representing the binding + * of schema type definitions, element declarations and model groups. Factory + * methods for each of these are provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _ConsultarRuc_QNAME = new QName("http://ruc.snap.webservices.fp.com/", "consultarRuc"); + private final static QName _ConsultarRucResponse_QNAME = new QName("http://ruc.snap.webservices.fp.com/", "consultarRucResponse"); + + /** + * Create a new ObjectFactory that can be used to create new instances of + * schema derived classes for package: com.fp.webservices.snap.ruc + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link ConsultarRucResponse } + * + */ + public ConsultarRucResponse createConsultarRucResponse() { + return new ConsultarRucResponse(); + } + + /** + * Create an instance of {@link ConsultarRuc } + * + */ + public ConsultarRuc createConsultarRuc() { + return new ConsultarRuc(); + } + + /** + * Create an instance of + * {@link JAXBElement }{@code <}{@link ConsultarRuc }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ruc.snap.webservices.fp.com/", name = "consultarRuc") + public JAXBElement createConsultarRuc(ConsultarRuc value) { + return new JAXBElement(_ConsultarRuc_QNAME, ConsultarRuc.class, null, value); + } + + /** + * Create an instance of + * {@link JAXBElement }{@code <}{@link ConsultarRucResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ruc.snap.webservices.fp.com/", name = "consultarRucResponse") + public JAXBElement createConsultarRucResponse(ConsultarRucResponse value) { + return new JAXBElement(_ConsultarRucResponse_QNAME, ConsultarRucResponse.class, null, value); + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/RucServicio.java b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/RucServicio.java new file mode 100644 index 0000000..d4100e7 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/RucServicio.java @@ -0,0 +1,36 @@ +package com.fp.frontend.webservices.snap.ruc; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; +import ec.gov.sri.wsconsultacontribuyente.Contribuyente; + +/** + * This class was generated by the JAX-WS RI. JAX-WS RI 2.2.6b21 Generated + * source version: 2.2 + * + */ +@WebService(name = "RucServicio", targetNamespace = "http://ruc.snap.webservices.fp.com/") +@XmlSeeAlso({ + com.fp.frontend.webservices.snap.ruc.ObjectFactory.class, + ec.gov.sri.wsconsultacontribuyente.ObjectFactory.class +}) +public interface RucServicio { + + /** + * + * @param ruc + * @return returns ec.gov.sri.wsconsultacontribuyente.Contribuyente + */ + @WebMethod + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "consultarRuc", targetNamespace = "http://ruc.snap.webservices.fp.com/", className = "com.fp.frontend.webservices.snap.ruc.ConsultarRuc") + @ResponseWrapper(localName = "consultarRucResponse", targetNamespace = "http://ruc.snap.webservices.fp.com/", className = "com.fp.frontend.webservices.snap.ruc.ConsultarRucResponse") + public Contribuyente consultarRuc( + @WebParam(name = "ruc", targetNamespace = "") String ruc); + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/RucServicioService.java b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/RucServicioService.java new file mode 100644 index 0000000..9f56ba7 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/RucServicioService.java @@ -0,0 +1,92 @@ +package com.fp.frontend.webservices.snap.ruc; + +import java.net.MalformedURLException; +import java.net.URL; + +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceException; +import javax.xml.ws.WebServiceFeature; + +import com.fp.frontend.utility.MsgControlArmas; + +/** + * This class was generated by the JAX-WS RI. JAX-WS RI 2.2.6b21 Generated + * source version: 2.2 + * + */ +@WebServiceClient(name = "RucServicioService", targetNamespace = "http://ruc.snap.webservices.fp.com/", wsdlLocation = "https://serviciosarmas.ccffaa.mil.ec:8085/serviceRUC?wsdl") +public class RucServicioService + extends Service { + + private final static URL RUCSERVICIOSERVICE_WSDL_LOCATION; + private final static WebServiceException RUCSERVICIOSERVICE_EXCEPTION; + private final static QName RUCSERVICIOSERVICE_QNAME = new QName("http://ruc.snap.webservices.fp.com/", "RucServicioService"); + + static { + URL url = null; + WebServiceException e = null; + try { + url = new URL(MsgControlArmas.getProperty("url_snap_servicio_ruc")); + } catch (MalformedURLException ex) { + e = new WebServiceException(ex); + } + RUCSERVICIOSERVICE_WSDL_LOCATION = url; + RUCSERVICIOSERVICE_EXCEPTION = e; + } + + public RucServicioService() { + super(__getWsdlLocation(), RUCSERVICIOSERVICE_QNAME); + } + + public RucServicioService(WebServiceFeature... features) { + super(__getWsdlLocation(), RUCSERVICIOSERVICE_QNAME, features); + } + + public RucServicioService(URL wsdlLocation) { + super(wsdlLocation, RUCSERVICIOSERVICE_QNAME); + } + + public RucServicioService(URL wsdlLocation, WebServiceFeature... features) { + super(wsdlLocation, RUCSERVICIOSERVICE_QNAME, features); + } + + public RucServicioService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public RucServicioService(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { + super(wsdlLocation, serviceName, features); + } + + /** + * + * @return returns RucServicio + */ + @WebEndpoint(name = "RucServicioPort") + public RucServicio getRucServicioPort() { + return super.getPort(new QName("http://ruc.snap.webservices.fp.com/", "RucServicioPort"), RucServicio.class); + } + + /** + * + * @param features A list of {@link javax.xml.ws.WebServiceFeature} to + * configure on the proxy. Supported features not in the + * features parameter will have their default values. + * @return returns RucServicio + */ + @WebEndpoint(name = "RucServicioPort") + public RucServicio getRucServicioPort(WebServiceFeature... features) { + return super.getPort(new QName("http://ruc.snap.webservices.fp.com/", "RucServicioPort"), RucServicio.class, features); + } + + private static URL __getWsdlLocation() { + if (RUCSERVICIOSERVICE_EXCEPTION != null) { + throw RUCSERVICIOSERVICE_EXCEPTION; + } + return RUCSERVICIOSERVICE_WSDL_LOCATION; + } + +} diff --git a/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/package-info.java b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/package-info.java new file mode 100644 index 0000000..aafd254 --- /dev/null +++ b/frontend/src/main/java/com/fp/frontend/webservices/snap/ruc/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://ruc.snap.webservices.fp.com/") +package com.fp.frontend.webservices.snap.ruc; diff --git a/frontend/src/main/resources/.svn/entries b/frontend/src/main/resources/.svn/entries new file mode 100644 index 0000000..ce102f2 --- /dev/null +++ b/frontend/src/main/resources/.svn/entries @@ -0,0 +1,368 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/resources +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +general_es.properties +file + + + + +2022-07-28T03:40:03.680634Z +86043316ac15f82240ff1dbb2b813a1d +2014-12-29T09:01:43.897077Z +3667 +dcruz + + + + + + + + + + + + + + + + + + + + + +14869 + +jasper.properties +file + + + + +2022-07-28T03:40:03.680634Z +75748eb58166e9936e768d2ce2942423 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +603 + +bpm_es.properties +file + + + + +2022-07-28T03:40:03.680634Z +3e4b8ee6de8e5286af86f857c467211b +2014-10-29T12:26:05.992964Z +2163 +wpatino + + + + + + + + + + + + + + + + + + + + + +2564 + +customer_es.properties +file + + + + +2022-07-28T03:40:03.680634Z +20f67663c1c35eed612816f1b2462486 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +961 + +firmas_es.properties +file + + + + +2022-07-28T03:40:03.680634Z +db1c532218537c0bf46d0f97ede664f2 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +338 + +viaticos_es.properties +file + + + + +2022-07-28T03:40:03.681634Z +bb642d86f0d306cf0e0765d689f8f947 +2014-09-11T11:36:06.951262Z +688 +jvaca + + + + + + + + + + + + + + + + + + + + + +4733 + +controlarmas_es.properties +file + + + + +2022-07-28T03:40:03.681634Z +7e02ea80e30ac1b19566d807d69f8c7f +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +47783 + +pentaho.properties +file + + + + +2022-07-28T03:40:03.681634Z +62a8dc122da0a52e005161a5514252e0 +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +349 + +security_es.properties +file + + + + +2022-07-28T03:40:03.681634Z +f5dc57b1b7bc490975ec0ec54c9f3e8a +2021-08-26T17:51:29.138509Z +4639 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +779 + +validation_es.properties +file + + + + +2022-07-28T03:40:03.681634Z +759c9a659644eb175741db66558e1f4d +2014-09-15T11:26:52.446762Z +804 +dcruz + + + + + + + + + + + + + + + + + + + + + +4920 + diff --git a/frontend/src/main/resources/.svn/text-base/bpm_es.properties.svn-base b/frontend/src/main/resources/.svn/text-base/bpm_es.properties.svn-base new file mode 100644 index 0000000..35f979f --- /dev/null +++ b/frontend/src/main/resources/.svn/text-base/bpm_es.properties.svn-base @@ -0,0 +1,105 @@ +################################################### +##### S\u00edmbolos unicode +#####\u00e1 -> +#####\u00e9 -> +#####\u00ed -> +#####\u00f3 -> +#####\u00fa -> +#####\u00c1 -> +#####\u00c9 -> +#####\u00cd -> +#####\u00d3 -> +#####\u00da -> +#####\u00f1 -> +#####\u00d1 -> +#####\u0020 -> Espacio en blanco +################################################### + +#Botones +btn_view_flow=Ver flujo +btn_cancell=Cancelar +btn_controlcambios=Existe cambios pendientes (YES) perder\u00E1 las modificaciones (NO) permite grabar +btn_create=Crear +btn_delete= +btn_edit= +btn_next= +btn_previous= +btn_query= +btn_save=Grabar +btn_update=Actualizar +btn_reload=Recargar +btn_detail=Detalle +btn_asign=Asignar +btn_accept=Aceptar +btn_exit=Salir +btn_initFlow=Iniciar flujo +btn_completeTask=Competar tarea +btn_sent=Enviar + +#Cabecera de tablas +htbl_monitoring=MONITOREO +htbl_groups=GRUPOS +htbl_users=USUARIOS +htbl_fields=CAMPOS +htbl_flows=FLUJOS +htbl_fieldTransaction=CAMPOS POR TRANSACCI\u00D3N +htbl_fieldMapping=MAPEO DE CAMPOS +htbl_flowsRules=FLUJOS / REGLAS + +lvh_groups=GRUPOS + + +#Etiquetas +lbl_origin_flow_transaction=Transacci\u00F3n originadora del flujo +lbl_selected_activity=Actividad seleccionada +lbl_waiting_time=Tiempo de espera +lbl_real_time=Tiempo real +lbl_comment=Comentario +lbl_commentate=Comentar +lbl_task_detail=Detalle tarea +lbl_code=C\u00F3digo +lbl_groups=Grupos +lbl_group=Grupo +lbl_description=Descripci\u00F3n +lbl_mail=Correo electr\u00F3nico +lbl_user=Usuario +lbl_field=Campo +lbl_experesion=Expresi\u00F3n lenguaje +lbl_package=Paquete +lbl_image=Imagen +lbl_message=Mensaje +lbl_type=Tipo +lbl_active=Activo +lbl_asociation=Asociaci\u00F3n +lbl_path=Ruta +lbl_filetype=Tipo archivo +lbl_todate=Fecha creaci\u00F3n hasta +lbl_fromdate=Fecha creaci\u00F3n desde +lbl_creation=Fecha creaci\u00F3n +lbl_ended=Fecha final +lbl_duration=Duraci\u00F3n +lbl_module=M\u00F3dulo +lbl_transaction=Transacci\u00F3n +lbl_version=Versi\u00F3n +lbl_name=Nombre +lbl_activityname=Actividad del flujo +lbl_created=Creaci\u00F3n +lbl_expectedtime=Tiempo de espera +lbl_realtime=Tiempo real +lbl_observation=Observaciones +lbl_response=Respuesta +lbl_userassign=Usuario asignado +lbl_branch=Sucursal +lbl_detail=Detalle +lbl_email=Correo electr\u00F3nico +lbl_office=Oficina +lbl_fieldscreen=Campo pantalla +lbl_task=Tarea +lbl_observations=Observaciones +lbl_notifyto=Notificar a +lbl_process=Proceso +lbl_registerdate=Fecha registro +lbl_resolution=Resoluci\u00F3n + +#Mensajes +msg_grouprequird=GRUPO REQUERIDO \ No newline at end of file diff --git a/frontend/src/main/resources/.svn/text-base/controlarmas_es.properties.netbeans-base b/frontend/src/main/resources/.svn/text-base/controlarmas_es.properties.netbeans-base new file mode 100644 index 0000000..e814afe --- /dev/null +++ b/frontend/src/main/resources/.svn/text-base/controlarmas_es.properties.netbeans-base @@ -0,0 +1,1014 @@ +################################################### +##### S\u00edmbolos unicode +#####\u00e1 -> +#####\u00e9 -> +#####\u00ed -> +#####\u00f3 -> +#####\u00fa -> +#####\u00c1 -> +#####\u00c9 -> +#####\u00cd -> +#####\u00d3 -> +#####\u00da -> +#####\u00F1 -> +#####\u00d1 -> +#####\u0020 -> Espacio en blanco +################################################### + +#ETIQUETAS +#Solcitud +lbl_fechasolicitud=Fecha Solicitud +lbl_fechasolicitud_aucp=Fecha Solicitud / Envio AUCP +lbl_autorizacion=Autorizaci\u00F3n +lbl_estadoDocumento=Estado del Documento +lbl_datosempresaseg=Datos Empresa Seguridad +lbl_psicologicanecesaria=NO SE HA REGISTRADO LA EVALUACI\u00D3N PSICOL\u00D3GICA +lbl_datosevaluado=Datos del Evaluado +lbl_datoscompaniaseg=Datos de la Compan\u00EDa de Seguridad +lbl_valordeposito=Valor Dep\u00F3sito +lbl_centromedico=Centro M\u00E9dico +lbl_centroControl=Centro de Control +lbl_tramitesXcentro=Tramites por Centro Control +lbl_si=S\u00CD +lbl_nombreexcel=ReporteDeArmas +lbl_nombreexcelhistorico=ReporteHistoricoDeArmas +msg_fechafinal=LA FECHA FINAL DEBE SER MAYOR A LA FECHA INICIAL +lbl_examenfinalizado=EXMEN FINALIZADO +lbl_reprobado=Reprobado +lbl_compania=Compa\u00F1\u00EDa de Seguridad +msg_proceso=El proceso debe continuar cuando el arma se encuentra en bodega. +lbl_fechaprox=LA FECHA PARA SU PR\u00D3XIMO INTENTO ES\: +lbl_detallesdetramite=DETALLES DE TR\u00C1MITE +lbl_sancionpermiso=SANCI\u00D3N PERMISO +lbl_recomendaciones=Recomendaciones +msg_ingresesancion=INGRESE UNA SANCI\u00D3N +msg_realiceunasancion=APLIQUE UNA SANCI\u00D3N +lbl_dias=d\u00EDas +lbl_verificaCertificado=VERIFICAR INFORMACI\u00D3N CERTIFICADO +lbl_reimpresion=Reimpresi\u00F3n +lbl_tiempo=Tiempo +msg_evaluado=LA PERSONA SELECCIONADA TIENE UN REGISTRO DE EVALUACI\u00D3N PSICOL\u00D3GICA +msg_nopermiso=NO SE ENCUENTRA UN PERMISO PARA EL ARMA SELECCIONADA +msg_persona=SELECCIONE UNA PERSONA +lbl_imprimir=Generar Reporte +lbl_imprimirXls==Generar Reporte Excel +lbl_verificarDocumentos=VERIFICAR DOCUMENTOS +lbl_psicologico=Psicol\u00F3gica +msg_debesubir=DEBE SUBIR UN ARCHIVO DE EVALUACI\u00D3N +lbl_informeevaluacion=Informe Evaluaci\u00F3n +lbl_recomendacion=Recomendaci\u00F3n +lbl_psicologo=Psic\u00F3logo Responsable +lbl_fechaevaluacion=Fecha Evaluaci\u00F3n +lbl_fechaexpiracion=Fecha Caducidad +lbl_fechadeexpiracion= Fecha de Expiraci\u00F3n +lbl_planInspeccionAnual=PlanDeInspecci\u00F3nAnual +msg_archivoImportacionSerie=EL ARCHIVO DE IMPORTACI\u00D3N NO DEBE CONTENER EL N\u00DAMERO DE SERIE +msg_serieVacia=La serie del arma no debe estar vac\u00EDa. +msg_limitecantidadarma=La cantidad del Arma de Fuego debe ser igual a 1 unidad +msg_claseVacia=La clase del arma no debe estar vac\u00EDa. +msg_tipoVacio=El tipo de arma no debe estar vac\u00EDo. +msg_marcaVacia=La marca del arma no debe estar vac\u00EDa. +msg_longitudVacia=La longitud del arma no debe estar vac\u00EDa. +msg_longitudNoVacia=La longitud del arma debe estar vac\u00EDa. +msg_calibreVacio=El calibre no debe estar vac\u00EDo. +msg_calibreNoVacio=El calibre debe estar vac\u00EDo. +msg_cantidadVacia=La cantidad no debe estar vac\u00EDa. +msg_cantidadNoVacia=La cantidad debe estar vac\u00EDa. +msg_unidadMedidaCantidadVacia=La U. Medida Cantidad no debe estar vac\u00EDa. +msg_unidadMedidaCantidadNoVacia=La U. Medida Cantidad debe estar vac\u00EDa. +msg_unidadMedidaSoloUna=Solo debe ingresar una unidad de medida. +msg_unidadMedidaNoExiste=La unidad de medida ingresada no existe. +msg_pesoVacio=El peso no debe estar vac\u00EDo. +msg_pesoNoVacio=El peso debe estar vac\u00EDo. +msg_unidadMedidaPesoVacia=La U. Medida Peso no debe estar vac\u00EDa. +msg_unidadMedidaPesoNoVacia=La U. Medida Peso debe estar vac\u00EDa. +msg_cantidadValorNumerico=La cantidad debe ser un valor n\u00FAmerico. +msg_pesoValorNumerico=El peso debe ser un valor num\u00E9rico. +msg_fuegosPirotecnicos=fuegos pirot\u00E9cnicos +msg_datosDuplicados=Existen datos duplicados. +msg_sustanciaQuimica=sustancia qu\u00EDmica +msg_calibreNoExisteCatalogo=El calibre no existe en el cat\u00E1logo. +msg_claseNoExisteCatalogo=No existe la clase en el cat\u00E1logo. +msg_longitudNoExisteCatalogo=No existe la longitud en el cat\u00E1logo. +msg_noExisteTipoArmaCatalogo=No existe el tipo de arma en el cat\u00E1logo. +msg_colorNoExisteCatalogo=No existe el color en el cat\u00E1logo. +msg_marcaNoExisteCatalogo=No existe la marca en el cat\u00E1logo. +msg_unicidad_agencia=S\u00D3LO UNA AGENCIA DEBE ESTAR SELECCIONADA +msg_seleccione_nombre=SELECCIONE UN NOMBRE O RAZ\u00D3N SOCIAL + +lbl_ordenTrabajoCustodios=OrdenDeTrabajoParaCustodios +lbl_guiaLibreTransito=Gu\u00EDa Libre de Tr\u00E1nsito +lbl_reportebalistico=ReporteRegistroBal\u00EDstico +lbl_fechaActual=Fecha Actual +lbl_actaDeDevolucion=ActaDevoluci\u00F3n +lbl_asuntoNotificarFecha=COMANDO CONJUNTO DE LAS FF. AA. - Notificaci\u00F3n Devoluci\u00F3n. +lbl_asuntoNotificarNovedad=COMANDO CONJUNTO DE LAS FF. AA. - Notificaci\u00F3n Novedad +lbl_notificarTramiteAnulado=Notificar Tr\u00E1mite Anulado +msg_asuntoNotificacionGuiaTranistoAnulada=COMANDO CONJUNTO DE LAS FF.AA. - Notificaci\u00F3n de tr\u00E1mite anulado en la Solicitud de Gu\u00EDa de Libre Tr\u00E1nsito. +msg_cuerpoNotificacionGuiaTransitoAnulada=DEPARTAMENTO DE CONTROL DE ARMAS
Estimado
{0}
Presente.-
Mediante la presente notificamos que su solicitud N\u00BA {1} para Emisi\u00F3n de Gu\u00EDa de Libre Tr\u00E1nsito ha sido rechazada debido a las siguientes observaciones\:

{2}

Atentamente,

{3}
{4}

NOTA\:
Este mensaje fue enviado autom\u00E1ticamente por el sistema, por favor no responda a esta cuenta de correo. +lbl_aprobacionLibreTransito=APROBACI\u00D3N DE LIBRE TR\u00C1NSITO +correoDesde=notificacion@controlarmas.ccffaa.mil.ec +correoDestino=ogarcia@bupartech.com +lbl_justificacion=Justificaci\u00F3n +cuerpo.mensaje.envio.correo=DEPARTAMENTO DE CONTROL DE ARMAS

Estimado(a)
{0}
Presente.-

El trámite de devolución No.{1} ha sido aprobado, por favor acercarse al COMANDO CONJUNTO DE LAS FF.AA a partir de {2} en horario de 8\:00 a 16\:00 para proceder con la devolución del material solicitado.

Atentamente,

{3}
{4}

NOTA\:
Este mensaje fue enviado automáticamente por el sistema, por favor no responda a esta cuenta de correo. +cuerpo.mensaje.envio.correo.novedad1=DEPARTAMENTO DE CONTROL DE ARMAS

Estimado(a)
{0}
Presente.-

El trámite de devolución No. {1}, no puede continuar porque se presenta las siguientes novedades\: +cuerpo.mensaje.envio.correo.novedad2={0}

Atentamente,

{1}
{2}

NOTA\:
Este mensaje fue enviado automáticamente por el sistema, por favor no responda a esta cuenta de correo. +cedulaDuplicada=Ya existe un custodio con esa c\u00E9dula. + + +btn_enviarNotificacion=Enviar Notificaci\u00F3n +btn_cancelar=Cancelar +htbl_sitiosalmacenamiento=SITIOS DE ALMACENAMIENTO +lbl_latitud=Latitud +lbl_estadosolicitud=Estado Solicitud +lbl_origenadquisicion=Origen de Adquisici\u00F3n +lbl_paisorigen=Pa\u00EDs +lbl_telfijo=Tel\u00E9fono Fijo +lbl_telcelular=Tel\u00E9fono Celular +lbl_correo=Correo Electr\u00F3nico +lbl_datoscapacidad=Datos Capacidad +lbl_almacenamiento=Almacenamiento +lbl_manejoarmas=Manejo de Armas +lbl_expiro_fecha_deposito=LA FECHA DE SOLICITUD EXPIR\u00D3, POR FAVOR VUELVA A INGRESAR EL TR\u00C1MITE NUEVAMENTE. +msg_error_valorDepositoNegativoCero=EL VALOR DE DEP\u00D3SITO DEBE SER MAYOR A CERO. +msg_error_vVerificDiferenteDeVAPagar=EL VALOR VERIFICADO ES DIFERENTE DEL VALOR A PAGAR Y SE ANULAR\u00C1 +lbl_seleccionar=Seleccionar +lbl_seleccionartodos= Seleccionar Todos +lbl_buscar=Buscar +lbl_cargararchivo=Cargar Archivo +lbl_requisitossolicitud=Requisitos Solicitud +lbl_seleccionarguardias=SELECCIONAR GUARDIAS DE SEGURIDAD +lbl_seleccionararmas=SELECCIONAR ARMAS +lbl_seleccionararticulos=SELECCIONAR ART\u00CDCULOS +lbl_detallematerialregistro=DETALLE MATERIAL REGISTRADO +msg_tamano_archivo_requisitos_jpg_png=EL TAMA\u00D1O M\u00C1XIMO PERMITIDO POR ARCHIVO ES DE 2 MB (.jpg .png) +msg_tamano_archivo_requisitos_jpg_png_1=EL TAMA\u00D1O M\u00C1XIMO PERMITIDO POR ARCHIVO ES DE 1 MB (.jpg .png) +msg_tamano_archivo_requisitos=EL TAMA\u00D1O M\u00C1XIMO PERMITIDO POR ARCHIVO ES DE 2 MB (.pdf .gif .jpg .png) +msg_tamano_archivo_requisitos_5=EL TAMA\u00D1O M\u00C1XIMO PERMITIDO POR ARCHIVO ES DE 5 MB (.pdf .gif .jpg .png) +msg_tamano_archivo_=EL TAMA\u00D1O M\u00C1XIMO PERMITIDO DEL ARCHIVO ES DE 2 MB (.pdf .gif .jpg .png) +msg_tamano_archivo_requisitos_pdf=EL TAMA\u00D1O M\u00C1XIMO PERMITIDO DEL ARCHIVO ES DE 2 MB (.pdf) +msg_tamano_archivo_requisitos_pdf_5=EL TAMA\u00D1O M\u00C1XIMO PERMITIDO DEL ARCHIVO ES DE 5 MB (.pdf) +msg_tamano_archivo_requisitos_pdf_jpg=EL TAMA\u00D1O M\u00C1XIMO PERMITIDO DEL PRIMER ARCHIVO ES DE 1 MB (.pdf) Y EL TAMA\u00D1O M\u00C1XIMO PERMITIDO POR ARCHIVO ES DE 2 MB (.jpg .png) +msg_escanear_documentos_originales=SE DEBE ESCANEAR LOS DOCUMENTOS ORIGINALES Y ACTUALIZADOS +#Seleccion de Agencias +lbl_seleccionaragencias=SELECCIONAR AGENCIAS/SUCURSALES +lbl_detalleAgencias=DETALLE DE AGENCIAS / SUCURSALES +lbl_responsable=Nombre y Apellido del Responsable +lbl_nom_apell_super=Nombre y Apellido del Supervisor +lbl_crearAgencia=CREAR AGENCIA - SUCURSAL +lbl_modificarAgencia=EDITAR AGENCIA - SUCURSAL +lbl_verAgencia=VER AGENCIA - SUCURSAL +btn_seleccionarArmas=Seleccionar Armas +lbl_datosCompania=DATOS COMPA\u00D1\u00CDA +lbl_datosAgencia=DATOS AGENCIA / SUCURSAL +lbl_fechaAutorizacion=Fecha Autorizaci\u00F3n +lbl_telefono=Tel\u00E9fono +lbl_documentos=DOCUMENTOS +lbl_ubicacion= Seleccione ubicaci\u00F3n por +lbl_coodenadas=Coordenadas +lbl_fechaEmision=Fecha de Emisi\u00F3n +lbl_numeroDeDocumento=No. Documento +lbl_listadoguardias=LISTADO DE GUARDIAS DE SEGURIDAD +lbl_eliminaragencia=ELIMINAR AGENCIA-SUCURSAL +lbl_eliminarmaterial=ELIMINAR MATERIAL +lbl_confirmacioneliminar=Est\u00E1 seguro de eliminar el registro? +msg_error_armas_inexistentes=NO EXISTEN ART\u00CDCULOS REGISTRADOS PARA ESTE TR\u00C1MITE +#Documentos + + +#Evaluaciones +lbl_tipoEvaluacion=Tipo Evaluaci\u00F3n +lbl_numerodocumento=No. Documento +lbl_tipoPersona=Tipo Persona +lbl_jurisdiccion=Jurisdiccin +lbl_descripcionPregunta=Descripci\u00F3n +lbl_numeroPregunta=No. Pregunta +tab_verRespuestas=Ver Respuestas +tab_Respuestas=Respuestas +tab_respuesta=Respuesta +tab_respuestaCorrecta=Respuesta Correcta +msg_seleccionepersona=POR FAVOR SELECCIONE UNA PERSONA +msg_tipoevaluacion=POR FAVOR INGRESE UN TIPO DE EVALUACIN +msg_numerointentos=USTED HA SUPERADO EL NMERO DE INTENTOS MXIMOS PARA LA EVALUACIN +msg_fechaprox=LA FECHA PARA SU PRXIMO INTENTO ES: +msg_ingreseresp=INGRESE UNA RESPUESTA +lbl_evaluacion=Evaluaci\u00F3n +lbl_detallevaluacion=Detalle de Evaluaciones +lbl_estadoevaluacion=Estado Evaluaci\u00F3n +lbl_fechadeevaluacion=Fecha Examen Psicol\u00F3 gico +lbl_fecharegistrotest=Fecha Registro Test +lbl_resultado=Resultado +lbl_resultado_busqueda=Resultados de b\u00FAsqueda +#tramite +lbl_cantidad=Cantidad +lbl_clase=Clase +lbl_tipo=Tipo +lbl_longitud=Longitud +lbl_calibre=Calibre +lbl_tipotramite=Tipo Tr\u00E1mite +lbl_tramite=Tr\u00E1mite +lbl_numeroTramite=No. Tr\u00E1mite +lbl_requisito=Requisito +lbl_descripcionrequisito=Descripci\u00F3n Requisito +lbl_tipopersona=Tipo Persona +lbl_tipoidentiicacion=Tipo Documento +lbl_identificacion=No. Documento +lbl_identificacionTxt=Identificaci\u00F3n +lbl_inicarFlujo=Continuar Tr\u00E1mite +lbl_imagencargada=Imagen Almacenada +lbl_estadocarga=Estado Carga +lbl_estadotramite=Estado Tr\u00E1mite +lbl_usoactividad=Uso / Actividad +lbl_NoTramite=No. Tr\u00E1mite +lbl_fechaDeDeposito=Fecha Dep\u00F3sito +lbl_numeroDeDeposito=No. Combrobante Dep\u00F3sito +lbl_factura=No. Factura / Documento +lbl_registro=No. Registro +lbl_valorDeDeposito=Valor Dep\u00F3sito +lbl_cargarComprobante=Cargar Comprobante +lbl_cargarResolucion=Cargar Resoluci\u00F3n +lbl_numeroDeTramite=No. Tr\u00E1mite +lbl_numeroDeComprobante=No. Comprobante +lbl_noComprobante=No. Comprobante +lbl_valorVerificado=Valor Verificado +lbl_archivoComprobante=Archivo Comprobante +lbl_imprimirComprobante=Imprimir Comprobante +lbl_ver=Ver +fct_registrarDeposito=Registrar Comprobante Dep\u00F3sito +fct_validarDeposito=Validar Comprobante Dep\u00F3sito + +# FIELDSETS +field_tipotramite=Datos Tipo Tr\u00E1mite +field_ubicacion=Ubicaci\u00F3n +field_tiposarmasexplosivos=Tipos Armas y Explosivos: +lbl_tipoTramite=Tipo Tr\u00E1mite +lbl_usoActividad=Uso/Actividad +lbl_costo=Costo +lbl_tipocosto=Tipo Costo +lbl_vigenciameses=Vigencia Meses +lbl_tipodocumento=Tipo Documento +lbl_usd=USD +lbl_registroguardia=Registro Guardia +lbl_registroarmas=Registro Armas +lbl_deposito=Dep\u00F3sito +lbl_registroagenciassucursales=Registro Agencias y Sucursales +lbl_requiereevaluacion=Requiere Evaluaci\u00F3n +lbl_requiereinspeccion=Requiere Inspecci\u00F3n +lbl_dochabilitantes=Documentos Habilitantes +lbl_docsolicitudcertificado=Solicitud de Certificado +lbl_certificadofiscal=Certificado Fiscal +lbl_actaentregareceptionSolicitud=ACTA ENTREGA RECEPCI\u00D3N - SOLICITUD +lbl_docactaentregareceptionSolicitud=Documento Acta Entrega Recepci\u00F3n - Solicitud +lbl_costoUSD=Costo(USD) +lbl_tipoautorizacion=Tipo Autorizaci\u00F3n +lbl_datostramite=DATOS DEL TR\u00C1MITE +#Tipo Archivo +lbl_tipoarchivo=Tipo Documento + +lbl_institucion=Instituci\u00F3n +lbl_nombre=Nombre +lbl_jefecentro=Jefe Centro +lbl_grado=Grado +lbl_direccion=Direcci\u00F3n +lbl_nueva_jurisdiccion=NUEVA JURISDICCI\u00D3N +lbl_jurisdicciones=Jurisdicciones +lbl_datosdejurisdicciones=DATOS DE JURISDICCIONES +lbl_nombrerazonsocial=Nombre/Raz\u00F3n Social +lbl_nombrerazonsocialcomprador=Comprador/Consumidor +lbl_numerodetramite=No. Tr\u00E1mite +lbl_numerocustodios=No. Custodios +lbl_No=No +lbl_solicitud=Solicitud +lbl_documento=Documento +lbl_noDocumento=No. Documento +lbl_noDocumentoPsicologo=No. Documento Psiclogo +lbl_tipodocumentoPsicologo=Tipo Documento Psiclogo +lbl_aprobado=Aprobado +lbl_aprobacion=APROBACI\u00D3N +lbl_generarValorACancelar=GENERAR VALOR A CANCELAR +lbl_valorCancelar=Valor a Cancelar +lbl_valorAPagar=Valor a Pagar + +lbl_accion=Acci\u00F3n +lbl_aceptar=Aceptar + +lbl_secuencial=Secuencial +lbl_tipoarmas=Tipo Arma +lbl_clasearma=Clase Arma +lbl_unidad=Unidad de Control +lbl_unidaddestino=Unidad de Control Destino + +lbl_unidadmedida=Unidad Medida +lbl_cupopeso=Cupo Peso +lbl_fecha=Fecha +lbl_tiporegistro=Tipo Registro +lbl_crearcupoautorizado=DETALLE DE CUPOS AUTORIZADOS +lbl_detalleunidadesmedida=DETALLE UNIDADES DE MEDIDA +lbl_unidadTipoClase=UNIDAD TIPO CLASE +lbl_cupo=Cupo +lbl_creartipounidad=CREAR UNIDAD DE MEDIDA +lbl_listadorequisitos=LISTADO DE REQUISITOS +lbl_datossolicitud=DATOS SOLICITUD +lbl_ordendetrabajono=Orden Trabajo No. +lbl_centrodecontrol=Centro Control +lbl_organismocontroldestino=Organismo de Control Destino +lbl_fechainspeccion=Fecha Inspecci\u00F3n +lbl_propietariorepresentantelegal=PROPIETARIO O REPRESENTANTE LEGAL +lbl_referencia=Referencia +lbl_representantelegal=Representante Legal +lbl_sitioinspeccion=SITIO INSPECCI\u00D3N +lbl_responsablem=RESPONSABLE +lbl_numerodecedula=No. C\u00E9dula +lbl_nombresapellidos=Nombres y Apellidos +lbl_telefonodomicilio=Tel\u00E9fono Domicilio +lbl_resultadoinspeccion=RESULTADO INSPECCI\u00D3N +lbl_continuartramiteproceso=Continuar Tr\u00E1mite o Proceso +lbl_negartramiteproceso=Negar Tr\u00E1mite o Proceso +lbl_aplicadecomiso=Aplica Decomiso +lbl_documentoinspeccion=Documento Inspecci\u00F3n +lbl_documentoinspeccionfecha=fecha +lbl_documentoinspeccioncodeuser=Identificaci\u00F3n +lbl_documentoinspeccioncodenombre=Nombres +lbl_fotografias=Fotograf\u00EDas +lbl_bodega=Bodega +lbl_sitiosalmacenanmiento=SITIOS DE ALMACENAMIENTO +lbl_registrarresultadoinspeccion=REGISTRAR RESULTADO INSPECCI\u00D3N +lbl_tipodecomercio=Tipo de Comercio +lbl_sitiosalmacenamiento=SITIOS DE ALMACENAMIENTO +lbl_tramites=TR\u00C1MITES +lbl_descripcionCorta=Descripci\u00F3n Corta +lbl_ingresodedecomiso=INGRESO DE DECOMISO / INCAUTACI\u00D3N +lbl_lugardeldecomiso=LUGAR DEL DECOMISO / INCAUTACI\u00D3N +lbl_datosdeldecomiso=DATOS DEL DECOMISO / INCAUTACI\u00D3N +lbl_tipodeproceso=Tipo Proceso +lbl_numerorecibo=No. Recibo +lbl_numerotransaccion=No. Transacci\u00F3n +lbl_fechadecomiso=Fecha Decomiso / Incautaci\u00F3n +lbl_organismocontrol=Organismo de Control +lbl_detalledeldecomiso=DETALLE DEL DECOMISO / INCAUTACI\u00D3N +lbl_datosdelciudadano=Datos del Ciudadano +lbl_decomisadopor=Control Realizado por +lbl_numerocedula=No. C\u00E9dula +lbl_funcionario=Funcionario +btn_registromaterial=Registro Material +btn_generarreciboregistro=Generar Recibo Registro +btn_consultarmaterial=Consultar Material +btn_entregarmaterial=Entregar Material +lbl_sinportador=Sin Portador +lbl_cant=Cant +lbl_umedida=U. Medida +lbl_fecdecimiso=Fecha Decomiso +lbl_motivo=Motivo +lbl_portadorarma=Portador Arma +lbl_registrodematerialdecomisadoincauto=REGISTRO MATERIAL +lbl_registrodematerialicautado=REGISTRO DE MATERIAL CUSTODIA TEMPORAL +lbl_propietario=Propietario +lbl_subir=Subir +lbl_cancelar=Cancelar +lbl_mensajearchivoinvalidom=EL TAMA\u00D1O DEL ARCHIVO DEBE SER M\u00C1XIMO DE +lbl_5mb=5 MB +lbl_2mb=2 MB +lbl_1mb=1 MB +lbl_sinidentificacion=Sin Identificaci\u00F3n +lbl_decomisoincautacion=Decomiso / Incautaci\u00F3n +lbl_cabecera=Cabecera +lbl_pie=Pie +lbl_crearsitiosdealmacenamiento=CREAR / EDITAR +lbl_modificarsitiosdealmacenamiento= CREAR / EDITAR +lbl_datosdecustodia=DATOS DE CUSTODIA +lbl_fechadecustodia=Fecha de Custodia +lbl_aerolinea=Aerolnea +lbl_novuelo=No. Vuelo +lbl_lugarOrigenm=LUGAR ORIGEN +lbl_lugarDestinom=LUGAR DESTINO +lbl_aeropuerto=Aeropuerto +btn_material=Material +lbl_ingresodedatosdesitiosdealmacenamiento=INGRESO DE DATOS DE SITIOS DE ALMACENAMIENTO +lbl_numerotransaccionenvio=No. Transacci\u00F3n Env\u00CDo +lbl_numerotransaccionrecepcion=No. Transacci\u00F3n Recepci\u00F3n +lbl_fecdecomiso=Fec Decomiso +htbl_detalledelmaterialm=DETALLE DEL MATERIAL +lbl_cantidadpeso=Cantidad/Peso +lbl_ingresocustodiatemporalenaeropuerto=INGRESAR CUSTODIA TEMPORAL EN AEROPUERTO +lbl_nodecomiso=No. Decomiso +btn_generaracta=Generar Acta +lbl_costocustodio=Costo Custodio +btn_iniciarproceso=Continuar Tr\u00E1mite +lbl_multa=Multa +lbl_flujotramite=Flujo Tr\u00E1mite +lbl_numeromaximoarmas=No M\u00E1ximo Armas +lbl_estadosarma=Estados Arma +lbl_tramitepadre=Tr\u00E1mite Padre +lbl_codigoplanificacion=C\u00F3digo Planificaci\u00F3n +lbl_mes=Mes +lbl_planificacioninsoeccion=PLANIFICACI\u00D3N DE INSPECCIONES +lbl_logo=Logo +lbl_limpiar=Limpiar +lbl_unidadcontrolrecepcion=Unidad de Control +lbl_unidadrecepcion=UNIDAD DE RECEPCI\u00D3N +lbl_sancionable=Sancionable +lbl_validaFechaExpiracion=Visualizar Fecha expiraci\u00F3n +lbl_validaPorFechaExpiracion=Visualizar por Fecha expiraci\u00F3n +lbl_validaCaducidadTramPadre=Validar caducidad tr\u00E1mite padre +lbl_validaCaducidadTramPadreAlt=Validar caducidad tr\u00E1mite padre alterno +lbl_seleccionararma=Seleccionar Arma +htbl_armas=Armas +lbl_dochabilitante=Doc. Habilitante +lbl_fechadochabilitante=Fecha Doc. Habilitante +lbl_fechasancion=Fecha Sanci\u00F3n +lbl_confirmacionguardarsancion=Est\u00E1 seguro de guardar la sanci\u00F3n ? +lbl_seleccionecentrocontroltramite=Seleccione el Centro de Control a Realizar el Tr\u00E1mite +lbl_longitud_minima=Longitud M\u00EDnima +lbl_numero_=N\u00FAmeros +lbl_caracteres_especiales=Caracter Especial +lbl_mayusculas=May\u00FAsculas +lbl_parametros_clave=La clave debe cumplir lo siguinete +btn_ubicar=Ubicar +btn_guardar_coordenadas =Guardar Coordenadas +nota_coordenadas =Al ingresar las coodernadas, verificar en el mapa que corresponda a la Ubicaci\u00F3n que esta haciendo referencia. +#TITULOS + +#ETIQUETAS CABECERA TABLAS +htbl_tipotramite=Tipo Tr\u00E1mite +htbl_requisitos=Requisitos +htbl_requisitosportipotramite=Requisitos por Tipo Tr\u00E1mite +htbl_TiposDeArmasExplosivos=TIPOS DE ARMAS Y EXPLOSIVOS +htbl_datospersonales=Datos Personales +htbl_seleccionetramite=SELECCIONE EL TR\u00C1MITE + +#ETIQUETAS TABS +tab_solgenerales=Datos Generales +tab_solrequisitos=Ingresar Requisitos +tab_requisitos=Requisitos +tab_solarmas=Seleccionar Armas +tab_solmateriales=Seleccionar Materiales +tab_solarticulos=Seleccionar Art\u00EDculos +tab_solguardias=Seleccionar Guardias +tab_tramite=Datos Tr\u00E1mite +tab_agencias=Seleccionar Agencias +tab_documentos=Listar Documentos +tab_depositoportramite=Dep\u00F3sito por Tr\u00E1mite +tab_depositoporcustodio=Dep\u00F3sito por Custodio +tab_seleccionar=Seleccionar +tab_eliminar=Eliminar +tab_modificar=Editar + + +#REQUISITO POR TIPO DE TRAMITE +lbl_depositoportramite=Dep\u00F3sito por Tr\u00E1mite +lbl_depositoporcustodio=Dep\u00F3sito por Custodio + +#RECEPCION/VERIFICACION DE ARMAS +lbl_recepcionarmas=Registro Entrega Armas +lbl_categoria=Categor\u00EDa +lbl_fecharegistro=Fecha Registro +lbl_provincia=Provincia +lbl_canton=Cant\u00F3n +lbl_ciudad=Ciudad +lbl_parroquia=Parroquia +lbl_fecharecepcion=Fecha Recepci\u00F3n +lbl_informacionarmas=INFORMACI\u00D3N DE ARMAS +lbl_informaciondocumentos=INFORMACI\u00D3N DE DOCUMENTOS +lbl_informacionagenciassucursales=INFORMACI\u00D3N DE AGENCIAS SUCURSALES +lbl_informacionpersonal=INFORMACI\u00D3N PERSONAL +lbl_codigo=C\u00F3digo +lbl_marca=Marca +lbl_modelo=Modelo +lbl_serie=Serie +lbl_color=Color +lbl_estado=Estado +lbl_estado_arma=Estado Arma +lbl_entregado=Entregado +lbl_pais=Pa\u00EDs Fabricaci\u00F3n + +#FICHA TECNICA ARMAS +lbl_observacion=Observaci\u00F3n +lbl_aptituddisparo=Aptitud Disparo +lbl_balastestigo=Balas Testigo +lbl_bainastestigo=Vainas Testigo +lbl_apruebaevaluacion=Aprueba Evaluaci\u00F3n +lbl_recuperadorbalisitico=RECUPERADOR BALISTICO +lbl_impronta=Impronta +lbl_fichatecnica=Ficha T\u00E9cnica +lbl_fotografia=Fotograf\u00EDa +lbl_archivocincomegas=5242880 +lbl_archivocuatromegas=4194304 +lbl_archivotresmegas=3145728 +lbl_archivodosmegas=2097152 +lbl_archivounmega=1048576 +lbl_mensajearchivoinvalido=El tama\u00F1o del archivo debe ser m\u00E1ximo de +lbl_observacionrequerido=El campo observaci\u00F3n es requerido +lbl_bainastestigorequerido=El campo vainas testigo es requerido +lbl_balastestigorequerido=El campo balas testigo es requerido +lbl_aptituddisparorequerido=El campo aptitud de disparo es requerido +lbl_informacionguardias=INFORMACI\u00D3N DE GUARDIAS +lbl_pruebasbalistica=PRUEBAS BALISTICA +lbl_impresionarma1=EL ARMA CON C\u00D3DIGO +lbl_impresionarma2=\ NO HA SIDO IMPRESA +lbl_isimpreso=FUE IMPRESO +lbl_imprimirarma=DEBE GENERAR REPORTE DEL ARMA ANTES DE ACEPTAR +lbl_subidaimagenes=LA SUBIDA DE IMAGENES ES REQUERIDA +lbl_subidaimagenes2=LA SUBIDA DE IMAGENES ES REQUERIDA. NO SE ENCUENTRAN SUBIDAS TODAS LAS IMAGENES +#LOV +lvh_requisitotramite=SELECCIONAR TR\u00C1MITE +lvh_clase=CLASE +lvh_longitud=LONGITUD +lvh_tipo=TIPO +lvh_calibre=CALIBRE +lvh_tipoarma=TIPO ARMA + + +#BOTONES +btn_descargarDocumentos=Descargar Documentos +btn_descargarDocumento=Descargar Documento +#Botones +btn_jurisdiccion=Jurisdicci\u00F3n +btn_buscar=Buscar +btn_crear=Crear +btn_eliminar=Eliminar +btn_imprimir=Generar Reporte +#MENSAJES +#msg_importeTotal=IMPORTE TOTAL DE VI\u00C1TICOS Y GASTOS DE VIAJES COMPROBADOS + +#Validacion de Tramite para la Gua de Libre Trnsito +lbl_datosTramite=DATOS TR\u00C1MITE +lbl_fechaSolicitud=Fecha Solicitud +lbl_tipoTramite2=Tipo Tr\u00E1mite + +lbl_tipoDocumento=Tipo Documento +lbl_numeroDocumento=No. Documento +lbl_nombreRazonSocial=Nombre / Raz\u00F3n Social +lbl_vendedor=Vendedor +lbl_lugarOrigen=Lugar Origen +lbl_lugarOrigenProvincia=Lugar Origen Provincia +lbl_lugarOrigenCanton=Lugar Origen Cant\u00F3n +lbl_comprador=Comprador +lbl_lugarDestino=Lugar Destino +lbl_lugarDestinoProvincia=Lugar Destino Provincia +lbl_lugarDestinoCanton=Lugar Destino Cant\u00F3n +lbl_estadoTramite=Estado Tr\u00E1mite +lbl_informacionArmas=INFORMACI\u00D3N ARMAS +lbl_numero=No. +lbl_tipo2=Tipo +lbl_calibre2=Calibre +btn_aceptar=Aceptar + +#Orden de trabajo para custodios +lbl_ordenTrabajo=ORDEN DE TRABAJO +lbl_numeroOrden=No. Orden Trabajo +lbl_fechaOrden=Fecha Orden Trabajo +lbl_documentoReferencia=Documento Referencia +lbl_comisionActividad=Comisi\u00F3n/Actividad +lbl_empresaSolicita=Empresa Solicita +lbl_lugarDireccionComision=Lugar y Direcci\u00F3n de la Comisi\u00F3n +lbl_ruta=Ruta +lbl_tiempoEstimado=Tiempo Estimado +lbl_fechaInicio=Fecha Inicio +lbl_fechaFinalizacion=Fecha Finalizaci\u00F3n +lbl_observaciones=Observaciones +lbl_datosCustodios=DATOS DE CUSTODIOS +lbl_nombreParticipante=Nombre Participante +lbl_apellidos=Apellidos +lbl_nombres=Nombres +lbl_cedula=No. C\u00E9dula +lbl_modificar=Editar +lbl_eliminar=Eliminar +lbl_ingresarCustodios=CREAR / EDITAR +lbl_modificarCustodios=CREAR / EDITAR +errorCedula=El n\u00FAmero ingresado no es v\u00E1lido. Por favor verificar. +#MENSAJES +#msg_importeTotal=IMPORTE TOTAL DE VI\u00C1TICOS Y GASTOS DE VIAJES COMPROBADOS + +#Actualizar Datos Generales +lbl_nombreRepresentanteLegal=Nombre Representante Legal +lbl_cedulaRepresentante=C\u00E9dula Representante Legal +lbl_actividadEconomica=Actividad Econ\u00F3mica +lbl_paisOrigen=Pa\u00EDs Origen +lbl_telefonoConvencional= Tel\u00E9fono Convencional +lbl_tlfCelular=Tel\u00E9fono Celular +lbl_estadoCivil=Estado Civil +lbl_genero=G\u00E9nero +lbl_estatura=Estatura (metros) +lbl_profesion=Profesi\u00F3n +lbl_correoElectronico=Correo Electr\u00F3nico +lbl_datosCapacidad=DATOS DE CAPACIDAD +lbl_manejoArmas=Manejo Armas +lbl_listarInformacion=LISTAR INFORMACI\u00D3N +lbl_seleccionarTodos=Seleccionar Todos +btn_registrarNovedad=Registrar Novedad +btn_actaDevolucion=Acta Devoluci\u00F3n +lbl_noTramite=No. Tr\u00E1mite +lbl_verificar=Verificar +lbl_registrarNovedad=Registrar Novedad +lbl_actaDevolucion=Acta Devoluci\u00F3n +lbl_unidadcontrol=Unidad De Control +xpathFujoDocumentoHabilitante=emisiondocumentohabilitante + +#Etiquetas para datos sanciones +lbl_tipoDeFalta=Tipo de Falta +lbl_falta=Falta +lbl_tiempoEnDias=Tiempo(d\u00EDas) +lbl_sancion=Sanci\u00F3n +htbl_datosParaSanciones =DATOS PARA SANCIONES +lov_tipoDeFalta=TIPOS DE FALTAS +lov_falta=FALTAS +lov_sancion=SANCIONES +lov_unidades=UNIDADES +lov_clase=CLASE +msg_error_seleccionClase = POR FAVOR SELECCIONE UNA CLASE DE ARMA O EXPLOSIVO + +#Verificacion de la Informacion de Devolucion + +#Carga de datos Excel +btn_cargar=Cargar +btn_limpiar=Limpiar +hfld_datosgenerales=Datos Generales +lbl_unidadcantidad=U. Medida Cantidad +lbl_peso=Peso +lbl_unidadpeso=U. Medida Peso +htbl_detalledelmaterial=Detalle del Material + +tramite=Tr\u00E1mite +lbl_dui=No. DUI +lbl_fob=Total FOB +lbl_paisdestino=Pa\u00EDs Destino +lbl_fabricante=Fabricante +lbl_aeropuertopuerto=Aeropuerto/Puerto +lbl_numerosolicitud=No. Solicitud +lbl_numerosolicitud_aucp=No. Solicitud / AUCP +lbl_datoscomprador=Datos Comprador +lbl_datostransaccion=Datos Transacci\u00F3n +lbl_tipotransaccion=Tipo Transacci\u00F3n +fct_datosPreguntasRespuestas = DATOS DE PREGUNTAS Y RESPUESTAS + +msg_error_lotenull=EL LOTE NO PUEDE SER NULO. +msg_error_armanovalida=TIPO DE ARMA NO VALIDA. +msg_error_cantidadnotnull=LA CANTIDAD NO PUEDE SER NULA. +msg_error_pesonull=EL PESO NO PUEDE SER NULO. +msg_error_nrseries=NO PUEDEN EXISTIR SERIES REPETIDAS. +msg_error_erroresexcel=ERROR DE REFERENCIA CON EL CAT\u00C1LOGO. +msg_error_claseytipo=LA CLASE Y EL TIPO NO PUEDEN TENER VALORES NULOS. +msg_error_nocontrolado=ERROR NO CONTROLADO, POR FAVOR REVISE SU DOCUMENTO. +msg_error_cantidadnumerica=LA CANTIDAD DEBE SER UN VALOR NUM\u00C9RICO. +msg_error_catalogo=ERROR EN EL CAT\u00C1LOGO DE TIPOARMAEXPLOSIVO +msg_error_pesonumerico=EL PESO DEBE SER UN VALOR NUM\u00C9RICO +##MESAJES SOLICITUD +msg_error_tramite=DEBE ESCOGER UN TR\u00C1MITE +msg_error_requisitos=DEBE INGRESAR TODOS LOS REQUISITOS SOLICITADOS +msg_error_no_requisitos=NO EXISTEN REQUISITOS DEFINIDOS PARA ESTE TIPO DE TR\u00C1MITE CONSULTE CON EL ADMINISTRADOR +msg_error_armas=DEBE SELECCIONAR AL MENOS UN ART\u00CDCULO EN EL TR\u00C1MITE +msg_error_maximo_armas=NO PUEDE SELECCIONAR MAS DE {0} ARMA(S), LAS ARMAS RESTANTES DEBEN SEGUIR EL TR\u00C1MITE PERTINENTE +msg_error_guardias=DEBE SELECCIONAR AL MENOS UN GUARDIA EN EL TR\u00C1MITE +msg_error_agencias=DEBE SELECCIONAR AL MENOS UNA AGENCIA EN EL TR\u00C1MITE +msg_error_documento=DEBE SELECCIONAR AL MENOS UN DOCUMENTO DE LA LISTA + +msg_error_imprimir_recepcion_armas=SE DEBEN ENCONTRAR SELECCIONADAS TODAS LAS ARMAS PARA PODER IMPRIMIR +msg_error_validar_seleccion_armas=SE DEBEN ENCONTRAR SELECCIONADAS TODAS LAS ARMAS PARA PODER GUARDAR +msg_error_requiere_validacion_tecnica=PARA EL TR\u00C1MITE SELECCIONADO, SE REQUIERE CUMPLIR CON EL SIGUIENTE REQUISITO PREVIO\: EVALUACI\u00D3N DE CONOCIMIENTOS +msg_error_requiere_validacion_psicologica=PARA EL TR\u00C1MITE SELECCIONADO, SE REQUIERE CUMPLIR CON EL SIGUIENTE REQUISITO PREVIO\: EVALUACI\u00D3N PSICOL\u00D3GICA + +msg_error_numerodocumento=SELECCIONE EL No. DOCUMENTO +msg_error_tipoarchivoinvalido=TIPO ARCHIVO INVALIDO +msg_error_exedeelnumero=EXEDE EL NUMERO DE ARCHIVOS + +msg_error_comprobanteDepositoUsado= \ EL DEP\u00D3SITO INGRESADO YA HA SIDO UTILIZADO EN OTRO TR\u00C1MITE. POR FAVOR VERIFICAR. +msg_error_tramiteSinDatosAsociados= EL N\u00DAMERO DE TR\u00C1MITE NO TIENE DATOS ASOCIADOS. +msg_error_decomisoSinDatosAsociados= EL DOCUMENTO DE DECOMISO NO TIENE DATOS ASOCIADOS. +msg_error_fechaDepositoMayorFechaActual= LA FECHA DE DEP\u00D3SITO NO PUEDE SER MAYOR A LA FECHA ACTUAL. +msg_error_archivo=EL FORMATO DEL ARCHIVO NO ES EL CORRECTO, RECUERDE QUE EL ARCHIVO DEBE SER PDF, PNG O JPEG Y NO DEBE SUPERAR 1MB. +msg_error_archivo_firma=EL FORMATO DEL ARCHIVO NO ES EL CORRECTO, RECUERDE QUE EL ARCHIVO DEBE SER PDF. +msg_error_sinarchivo=NO HA SUBIDO EL ARCHIVO FIRMADO A ALFRESCO. +msg_error_sinfirmararchivo=EL ARCHIVO NO EST\u00C1 FIRMADO PARA SUBIR AL ALFRESCO. +msg_error_nombrearchivo=EL NOMBRE DE ARCHIVO NO CORRESPONDE +msg_error_nombrearchivo_xpath=NO EXITE XPATH DEL ARCHIVO +msg_error_ingreseComprobanteDeposito=INGRESE EL COMPROBANTE DE DEP\u00D3SITO +msg_error_ingreseDocumentoDecomiso=INGRESE EL DOCUMENTO DE DECOMISO +msg_error_reimpresion=NO HA SELECCIONADO NINGUN REGISTRO O LOS REGISTROS SELECCIONADOS NO SON DE TIPO PERMISO +msg_error_verificararmas=NO HA SELECCIONADO NINGUN REGISTRO +msg_error_verificarcentcontdestino=NO HA SELECCIONADO NINGUN ORGANISMO DE CONTROL O UNIDAD DE CONTROL +msg_error_noexistendocumentos=NO TIENE DOCUMENTOS HABILITANTES EXISTENTES PARA ESTE TR\u00C1MITE +msg_error_noexistesolicitud=NO EXISTE SOLICITUD +msg_error_tramite_padre=REQUISITO PREVIO PARA ESTE TR\u00C1MITE\: {1}/{2}/{3} +msg_error_avanzar_flujo=DEBE IMPRIMIR ANTES DE HACER AVANZAR EL FLUJO +msg_error_adjuntar_resolucion=ERROR AL ADJUNTAR LA RESOLUCI\u00D3N + +##MESAJES DATOS SANCIONES +msg_error_tipoFaltaRequerido=SELECCIONE UN TIPO DE FALTA +msg_error_faltaRequerido=SELECCIONE UNA FALTA +msg_error_claseRequerido=SELECCIONE UNA CLASE +msg_error_sancionRequerido=SELECCIONE UNA SANCI\u00D3N + +#LABEL EVALUACIONES +ttl_evaluacion=TEST DE CONOCIMIENTOS +lbl_conocimientos=Conocimientos +lbl_test=Test +lbl_preguntas=Preguntas +lbl_mensaje=Lea detenidamente las preguntas del Test y seleccione una respuesta correcta. +btn_iniciar=Iniciar +#ARMAS +lbl_crearmaterial=CREAR MATERIAL +lbl_vermaterial=VER MATERIAL +lbl_modificarmaterial=EDITAR MATERIAL +htbl_detallematerial=DETALLE MATERIAL REGISTRADO +lbl_datospersonales=DATOS PERSONALES +lbl_datosmaterial=DATOS MATERIAL +lbl_fechaemisionpermiso=Fecha Emisi\u00F3n Permiso +lbl_tipofabricacion=Tipo Fabricaci\u00F3n +lbl_serielote=Serie/Lote +lbl_seriecanon=Serie/Ca\u00F1\u00F3n +lbl_datosdecomiso=DATOS DECOMISO / INCAUTACI\u00D3N +lbl_fechadecimiso=Fecha Decomiso / Incautaci\u00F3n +lbl_portadormaterial=Portador del Material +lbl_motivodecomiso=Motivo Decomiso / Incautaci\u00F3n +lbl_detallearma=FORMATO ARMA +lbl_datosarma=DATOS ARMA +lbl_codigoarma=C\u00F3digo de Arma +lbl_actualizar_propietario=ACTUALIZAR PROPIETARIO +lbl_datos_propietario_nuevo=Datos propietario nuevo + +#MATENIMIENTO DOCUMENTO ALFRESCO +lbl_crearmantenimientodocumento=CREAR MANTENIMIENTO DOCUMENTOS ALFRESCO +lbl_modificarmantenimientodocumento=EDITAR MANTENIMIENTO DOCUMENTOS ALFRESCO +lbl_vermantenimientodocumento=VER MANTENIMIENTO DOCUMENTOS ALFRESCO +htbl_detalledocumentoregistrados=DETALLE DE DOCUMENTOS REGISTRADO +lbl_datosPerfilDocumento= DOCUMENTOS POR PERFIL + +#MATENIMIENTO DOCUMENTO FISCALIA +lbl_crearcertificadofiscalia=CREAR CERTIFICADO FISCAL\u00CDA +lbl_modificarcertificadofiscalia=EDITAR CERTIFICADO FISCAL\u00CDA +lbl_datoscertificado=DATOS CERTIFICADO + +btn_generarReporte=Generar Reporte +btn_generarInforme=Generar Informe +btn_enviar=Enviar +btn_generarfecha=Generar Fecha +fct_materialParaDestruccion=MATERIAL PARA BAJA Y DESTRUCCI\u00D3N +lbl_fechaDeCorte=Fecha Corte +lbl_fechaNotificacion=Fecha Notificaci\u00F3n +lbl_formato = Formato +lbl_uniMedida= U. Medida +lbl_fecDecimiso=Fecha Decomiso / Incautaci\u00F3n +lbl_noRecibo=No. Recibo +fct_formatoReporteGenerar=FORMATO DEL REPORTE A GENERAR +fct_pnlunidaddestino=UNIDAD DE DESTINO +lbl_archivocash= Archivo Cash +lbl_plananual= Plan Anual +lbl_actadecomisoentrega= Acta de Entrega de Material Decomisado +lbl_actadecomisorecepcion= Acta de Recepci\u00F3n de Material Decomisado +lbl_documentodecomisoentrega= Documento Acta de Entrega de Material Decomisado +lbl_documentodecomisorecepcion= Documento Acta de Recepci\u00F3n de Material Decomisado +lbl_documentoplananual=Documento Plan Anual +lbl_tipodocumentos=Tipo de Documentos +lbl_numerodocumentos=No. Documentos + +lbl_combosolicitud=Solicitud +lbl_comboplanificacionanual=Planificaci\u00F3n Anual +lbl_comboashmanagement=Cash Management +lbl_combodecomiso=Decomisos +lbl_combofiscalia=Fiscal\u00EDa + + +#verificacion del material decomisado +fct_datosDelDecomiso=DATOS DEL DECOMISO / INCAUTACI\u00D3N +fct_datosDelArmaSancion=DATOS DEL ARMA / SANCI\u00D3N +lbl_numeroRecibo=No. Recibo +lbl_fechaDeDecomiso=Fecha Decomiso / Incautaci\u00F3n +lbl_cedulaRucPasaporte=C\u00E9dula/Ruc/Pasaporte +lbl_fechaDeRegistro=Fecha Registro +lbl_nocedula=No. C\u00E9dula +lbl_enBodega=En Bodega +tab_detalleDeArmas=DETALLE DE ARMAS +tab_sancion=SANCI\u00D3N + +##MENSAJES ARMAS +msg_error_tipoarmaexplosivonoexistente=TIPO DE ARMA EXPLOSIVO NO EXISTENTE, DEBE SELECCIONAR UNA COMBINACI\u00D3N V\u00C1LIDA +msg_error_camposrequeridos=ERROR, LOS CAMPOS MARCADOS CON (*) SON REQUERIDOS +msg_error_camponotificacion=EL CAMPO DE FECHA DE NOTIFICACIN NO HA SIDO GENERADO +msg_categoriaRequerida=DEBE SELECCIONAR UNA CATEGOR\u00CDA + +##MENSAJES INSPECCION +msg_error_ingreseelformatodeinspeccion=INGRESE EL FORMATO DE INSPECCI\u00D3N +msg_error_ingreselafoto1=INGRESE LA FOTO 1 +msg_error_ingreselafoto2=INGRESE LA FOTO 2 +msg_error_ingreselafoto3=INGRESE LA FOTO 3 +msg_error_seleccionesionoenaplicadecomiso=SELECCIONE SI O NO EN APLICA DECOMISO +msg_error_seleccionenegarocontinuartramiteproceso=SELECCIONE ALGUNA OPCI\u00D3N NEGAR O CONTINUAR TR\u00C1MITE O PROCESO +msg_error_seleccionenesitioinspeccion=SELECCIONE EL SITIO DE INSPECCI\u00D3N +msg_error_realizelabusqueda=REALIZE LA BUSQUEDA +mg_error_usuarionoencontrado=USUARIO NO ENCONTRADO +mg_error_usuarionoencontradovendedor=USUARIO NO ENCONTRADO +mg_error_usuarionoencontradocomprador=USUARIO NO ENCONTRADO +mg_error_ingreselosdatosdelpropietario=INGRESE LOS DATOS DEL PROPIETARIO +mg_error_seleccioneeltipodedocumentooingreselacedula=SELECCIONE EL TIPO DE DOCUMENTO E INGRESE EL N\u00DAMERO DE DOCUMENTO +mg_error_seleccioneeltipodedocumentooingreselacedulavendedor=SELECCIONE EL TIPO DE DOCUMENTO E INGRESE EL N\u00DAMERO DE DOCUMENTO +mg_error_seleccioneeltipodedocumentooingreselacedulacomprador=SELECCIONE EL TIPO DE DOCUMENTO E INGRESE EL N\u00DAMERO DE DOCUMENTO +mg_error_seleccioneeltipodedocumentooingreselongitudlatitud=SELECCIONE LA UBICACI\u00D3N +mg_error_seleccioneeltipoMapa=SELECCIONE TIPO DE UBICACI\u00D3N + +##MENSAJES DECOMISO +msg_error_numReciboNoRegistrado=EL N\u00DAMERO DE RECIBO NO SE ENCUENTRA REGISTRADO +msg_error_fechaCorteMayorAFechaActual=LA FECHA DE CORTE NO PUEDE SER MAYOR A LA FECHA ACTUAL +msg_error_fechaCorteRequerido=LA FECHA DE CORTE ES UN CAMPO REQUERIDO +msg_error_seleccioneAlmenosUnArma=DEBE SELECCIONAR AL MENOS UN ARMA DECOMISADA PARA GENERAR EL REPORTE +msg_error_noGuardoCorrectamenteReporte=NO SE HA PODIDO INICIAR EL PROCESO. ERROR AL GUARDAR EL REPORTE +msg_error_generarReporteRequerido= DEBE GENERAR EL REPORTE ANTES DE INICIAR EL PROCESO +msg_info_consultarArmasDecomidas=NO EXISTEN ARMAS DECOMISADAS AL MOMENTO DE CONSULTAR +##MENSAJES CUSTODIA TEMPORAL +msg_error_seleccionepropietario=SELECCIONE EL PROPIETARIO +msg_error_ingreselaobservacion=INGRESE LA OBSERVACI\u00D3N +msg_error_seleccioneelarmaacustodiatemporal=SELECCIONE EL ARMA A CUSTODIA TEMPORAL +msg_error_fechadecomisonopuedesermayoralaactual=LA FECHA DE DECOMISO/INCAUTACI\u00D3N NO PUEDE SER MAYOR A LA FECHA ACTUAL +msg_error_numerocomprobanterecibo=EL NO. COMPROBANTE/RECIBO YA EXISTE PARA LA ACTIVIDAD Y UNIDAD DE CONTROL SELECCIONADA +msg_error_validarnumerocomprobanterecibo=SELECCIONE ANTES ACTIVIDAD DE CONTROL PARA INSERTAR NO. COMPROBANTE/RECIBO +msg_error_nodocumentoinvalido=No Documento INVALIDO +msg_error_nodocumentoinvalidovendedor=No Documento INVALIDO +msg_error_nodocumentoinvalidocomprador=No Documento INVALIDO +msg_error_seleccionesinportadoroverifiqueusuarioexistente=SELECCIONE SIN PORTADOR O VERIFIQUE SI EL USUARIO EXISTE +msg_error_seleccionesinportadoroverifiqueusuarioexistentevendedor=SELECCIONE O VERIFIQUE SI EL USUARIO EXISTE +msg_error_seleccionesinportadoroverifiqueusuarioexistentecomprador=SELECCIONE O VERIFIQUE SI EL USUARIO EXISTE +msg_error_seleccioneelarmaarealizareldecomisoincautacion=SELECCIONE EL MATERIAL EN LA PESTA\u00D1A SELECCIONAR MATERIALES, PARA REALIZAR +msg_error_seleccionearchivodecomisoincautacion=SELECCIONE EL DOCUMENTO DE ACTIVIDAD DE CONTROL +msg_error_sin_decomisos=EL CENTRO DE CONTROL NO TIENE DECOMISOS +msg_error_sin_centrocontrol=NO SE ENCUENTRA ASIGNADO UN CENTRO DE CONTROL, REVISAR SI TIENE ASIGNADO UNA DIRECCI\u00D3N COMO PRINCIPAL Y PROVINCIA +msg_error_numero_recepcion=EL NUMERO DE RECEPCION NO TIENE EL FORMATO ESPERADO REC-000000000 +msg_error_solicitud_noencontrada=SOLICITUD NO ENCONTRADA +msg_error_listardocumentos_solo=SOLO PUEDE SELECCIONAR UN DOCUMENTO EN LA SECCI\u00D3N LISTAR DOCUMENTOS +msg_error_listardocumentos=SE DEBE SELECCIONAR AL MENOS UN DOCUMENTO EN LA SECCI\u00D3N LISTAR DOCUMENTOS +msg_error_psicologoinvalido=LA IDENTIFICACI\u00D3N DEL PSIC\u00D3LOGO RESPONSABLE ES INV\u00C1LIDA. + +##MENSAJES INFORMACION DEVOLUCION +msg_error_generereporte=GENERE EL REPORTE + +lbl_generarPlanInspeccionAnual=GENERAR PLAN DE INSPECCI\u00D3N ANUAL +lbl_datosPlanificacion=DATOS PLANIFICACI\u00D3N +lbl_anno=A\u00F1o +lbl_codigoPlanificacion=C\u00F3digo de Planificaci\u00F3n +lbl_planificacion=Planificaci\u00F3n +lbl_centroControlArmas=Centro de Control de Armas +lbl_fechaGeneracion=Fecha de Generaci\u00F3n +btn_generarPlanificacion=Generar Planificaci\u00F3n +btn_enviarPlanificacion=Enviar Planificaci\u00F3n +lbl_planificacionAnual=PLANIFICACI\u00D3N ANUAL +lbl_fechaCaducidad=Fecha Caducidad +lbl_estadoPermiso=Estado Permiso +msg_noExistenTramitesAnno=NO EXISTEN TR\u00C1MITES PARA EL A\u00D1O +lbl_editarRegistroInspeccion=EDITAR REGISTRO DE INSPECCI\u00D3N +msg_planificacionNoGenerada=NO SE HA GENERADO LA PLANIFICACI\u00D3N +lbl_aprobacionPlanificacion=APROBACION DE PLANIFICACI\u00D3N +dest_msg_mail_prueba=fpazmino@bupartech.com +lbl_filtrosBusqueda=FILTROS DE B\u00DASQUEDA +lbl_fechaDesaduanizacion=Fecha Desaduanizaci\u00F3n +lbl_datosGenerales=DATOS GENERALES +lbl_detalleMaterial=DETALLE DEL MATERIAL + +##PARAMETROS FIRMA +firma_coordenadallx=10 +firma_coordenadally=200 +firma_coordenadaurx=250 +firma_coordenadaury=1118 + +firma_coordenadallx2=370 +firma_coordenadally2=200 +firma_coordenadaurx2=610 +firma_coordenadaury2=1118 + +firma_mensaje=Por favor presione el bot\u00F3n +firma_mensaje2=Grabar +firma_mensaje3=para guardar el documento +firma_mensaje4=El archivo no est\u00E1 firmado para subir al alfresco +lbl_datosImportacion=DATOS DE IMPORTACI\u00D3N + +##CATALOGO +ctg_autorizacion=AUTORIZACI\u00D3N +ctg_primeravez=PRIMERA VEZ +ctg_renovacion=RENOVACI\u00D3N +ctg_permiso=PERMISO +ctg_certificados=CERTIFICADOS +ctg_perdida=P\u00C9RDIDA +ctg_actualizacionDeDatos=ACTUALIZACIN DE DATOS +ctg_reimpresion_tipo=REIMPRESION +ctg_reimpresion=REIMPRESI\u00D3N +ctg_tipotramite=TIPOTRAMITE +ctg_tipoautorizacion=TIPOAUTORIZACION +ctg_usoactividad=USOACTIVIDAD +ctg_resultado_aprobado=APROBADO +ctg_resultado_codigo=RESULTADO +ctg_tipo_evaluacion_conocimiento=CONOCIMIENTO +ctg_tipo_evaluacion_psicologica=PSICOLOGICA +lbl_test_psicologica=Test Psicol\u00F3gico +ctg_tipo_evaluacion_codigo=TIPOEVALUACION +##MENSAJE INFORMACION +msg_noplanificacion=No PLANIFICACI\u00D3N + +msg_armaDuplicada=EL ART\u00CDCULO QUE INTENTA CREAR YA SE ENCUENTRA REGISTRADO EN EL SISTEMA + +lbl_comprobanteCaja=ComprobanteDeCaja + +msg_error_generarlaplanificacion=GENERAR LA PLANIFICACI\u00D3N +tecnicoAlmacenamiento=T\u00C9CNICO DE ALMACENAMIENTO DEL +jefe=JEFE +msg_existePlanificacionAnno=YA EXISTE UNA PLANIFICACI\u00D3N PARA ESE A\u00D1O +lbl_fichaTecnicaArmas=FichaTecnicaArmas +lbl_registroBalistico=Registro bal\u00EDstico +lbl_dolares=D\u00D3LARES +msg_error_notienedireccionprincipal=NO TIENE DIRECCI\u00D3N PRINCIPAL +msg_error_laprovinciasinccontrol=LA PROVINCIA NO TIENE ASIGNADA UN CENTRO DE CONTROL +msg_error_sinprovincia=NO TIENE ASIGNADO UNA PROVINCIA +msg_error_singenerarreciboregistro=NO SE HA GENERADO UN RECIBO DE REGISTRO PARA EL DECOMISO +msg_error_notienedireccioncorreo=NO TIENE DIRECCI\u00D3N DE CORREO +msg_error_subiroarchivoregistrorecibo=ERROR AL OBTENER EL RECIBO DE REGISTRO DE DECOMISO + +msg_error_liqeco_fechaInicioMayorAFechaActual=SELECCIONE UNA FECHA DE INICIO MENOR A LA FECHA ACTUAL +msg_error_liqeco_fechaDecomisoMayorAFechaActual=SELECCIONE UNA FECHA DE DECOMISO MENOR A LA FECHA ACTUAL +msg_error_liqeco_fechaFinMayorAFechaActual=SELECCIONE UNA FECHA FIN MENOR A LA FECHA ACTUAL +msg_error_liqeco_fechaInicioMayorAFechaFin=LA FECHA DE INICIO SELECCIONADA DEBE SER MAYOR O IGUAL A LA FECHA FIN SELECCIONADA +msg_error_liqeco_fechaInicioMayorAFechaFin1=LA FECHA DE INICIO SELECCIONADA DEBE SER MENOR O IGUAL A LA FECHA FIN SELECCIONADA +msg_error_claveanteriornopuederserigualactual=CLAVE ANTERIOR NO PUEDE SER IGUAL A LA ACTUAL + +msg_error_coninv_fechaMayorAFechaActual=SELECCIONE UNA FECHA MENOR A LA FECHA ACTUAL + +msg_error_elnombredelarchivonocaracteresespeciales=EL NOMBRE DEL ARCHIVO NO PUEDE CONTENER CARACTERES ESPECIALES +msg_error_ingresenumsolicitudexacto=NO SE PUEDE REALIZAR LA CONSULTA CON %, INGRESE EL No. DE SOLICITUD COMPLETO +msg_error_elnombredelarchivonodebeiniciarconnum=EL NOMBRE DEL ARCHIVO NO DEBE INICIAR CON N\u00DAMEROS +msg_error_elnombredelarchivonodebecontenerespaciosenblanco=EL NOMBRE DEL ARCHIVO NO DEBE CONTENER ESPACIOS EN BLANCO +msg_error_elnombredelarchivonodebesermenoracincoletras=EL TAMA\u00D1O DEL NOMBRE DEL ARCHIVO NO DEBE SER MENOR A 5 CARACTERES + +#URL DE LOS SERVICIOS MANEJADOS DESDE LA SNAP +url_snap_servicio_cedula=https://serviciosarmas.ccffaa.mil.ec:8085/serviceCedula?wsdl +url_snap_servicio_ruc=https://serviciosarmas.ccffaa.mil.ec:8085/serviceRUC?wsdl + + +msg_error_nohaseleccionadoarmas=NO HA SELECCIONADO NINGUNA ARMA +msg_inf_digitadordel=COORDINADOR DEL +msg_error_ingrese_funcionario=INGRESE EL FUNCIONARIO + +codigo_estado_arma_busqueda_venta='REG','REN','APTA','DEV','ECO','COLE','PRO' + +msg_error_generar_reporte=ERROR AL GENERAR EL REPORTE + +msg_recuerdeClickContinuarTramite=PARA CONTINUAR SU TR\u00C1MITE\: DEBE DAR CLICK EN EL BOT\u00D3N CONTINUAR TR\u00C1MITE +msg_recuerdeUnicaCargaInventario=RECUERDE QUE EL INVENTARIO PARA UNA CATEGOR\u00CDA SELECCIONADA SOLO PODR\u00C1 SUBIRSE UNA \u00DANICA VEZ +msg_inventarioCargadoPreviamente=EL INVENTARIO PARA LA CATEGOR\u00CDA SELECCIONADA YA FUE CARGADO ANTERIORMENTE +msg_inventarioNoArmasFuegoNiNoLetales=No se permite el ingreso de armas de fuego ni tampoco de armas no letales +msg_reimpresionprevianopermitida=NO SE PUEDE REIMPRIMIR DOCUMENTOS CON FECHA DE EMISI\u00D3N PREVIA AL 15 DE JUNIO DEL 2015 +msg_recuerdeClickSeleccionarArmas=PARA VISUALIZAR LAS ARMAS DEBE DAR CLICK EN EL BOT\u00D3N SELECCIONAR ARMA +msg_recuerdeClickGenerarReciboRegistro=PARA TERMINAR EL REGISTRO\: DEBE DAR CLICK EN EL BOT\u00D3N GENERAR RECIBO REGISTRO PARA OBTENER EL REPORTE DE REGISTRO +msg_recuerdeClickCargarDocActControl=PARA CONTINUAR EL REGISTRO\: DEBE DAR CLICK EN EL BOT\u00D3N SELECCIONAR DE CARGA DOCUMENTO ACTIVIDAD DE CONTROL Y SEGUIDO DAR CLICK EN EL BOT\u00D3N SUBIR +msg_recuerdeClickBtnSave=PARA CONTINUAR EL REGISTRO\: DEBE DAR CLICK EN EL BOT\u00D3N GRABAR +msg_recuerdeClickBtnRegMaterial=PARA CONTINUAR EL REGISTRO\: DEBE DAR CLICK EN EL BOT\u00D3N REGISTRO MATERIAL +msg_recuerdeClickTabRegMaterial=PARA CONTINUAR EL REGISTRO\: DEBE SELECCIONAR MATERIAL EN LA PESTA\u00D1A SELECCIONAR MATERIALES +msg_recuerdeClickGenerarActa=PARA CONTINUAR SU TRAMITE\: DEBE DAR CLICK EN EL BOT\u00D3N GENERAR ACTA + +lbl_desde=Desde +lbl_hasta=Hasta +lbl_ultimaGeneracion=\u00DAltima Generaci\u00F3n + +lbl_aucp=AUCP +lbl_estaDesaduanizado=EST\u00C1 DESADUANIZADO? +msg_error_aucp_previamente_cargado=EL C\u00D3DIGO DE SOLICITUD AUCP YA HA SIDO CARGADO PREVIAMENTE +msg_error_carga_armas_inexistentes=NO EXISTEN ART\u00CDCULOS CREADOS PARA EL PRESENTE REGISTRO +msg_desea_iniciar_desaduanizacion=DESEA INICIAR LA DESADUANIZACI\u00D3N? +msg_desea_recuerde_desaduanizacion1=RECUERDE QUE UNA VEZ INICIADA LA DESADUANIZACI\u00D3N, NO PODR\u00C1 EDITAR +msg_desea_recuerde_desaduanizacion2=ART\u00CDCULOS DESDE LA PANTALLA INGRESO DE IMPORTACI\u00D3N +msg_desea_continuar=DESEA CONTINUAR? + +lbl_partida_arancelaria=Partida Arancelaria +msg_error_paisOrigenRequerido=Pa\u00EDs Origen Requerido +msg_error_provinciaRequerido=Provincia Requerida +msg_error_cantonRequerido=Cant\u00F3n Requerido +msg_error_ciudadRequerido=Ciudad Requerida +msg_error_aeropuertoRequerido=Aeropuerto Requerido +lbl_tipo_planificacion=Periodos de Planificacin +lbl_asignacion_presupuestaria=Asignacin Presupuestria +lbl_tipo_sancion=Tipo Sancin + +lbl_datosOrganismoControl=DATOS ORGANISMO CONTROL +lbl_datosUbicacionDecomiso=DATOS UBICACI\u00D3N ACTIVIDAD DE CONTROL +lbl_datosPortadorEnElDecomiso=DATOS DEL PORTADOR EN ACTIVIDAD DE CONTROL + +lbl_tipoDecomiso=Actividad de Control +lbl_numeroComprobanteRecibo=No. Comprobante/Recibo +lbl_fechaDecomiso=Fecha actividad de control +lbl_sinDocumento=Sin No. Documento +lbl_cargarDocumentoDecomiso=Carga Documento Actividad de Control + + + +#Certificado Fiscalia +lbl_cargarCertificadoFiscalia=Solicitud de Certificado +lbl_fiscalianrosolicitud=No. Solicitud +lbl_fiscalianombresolicitud=Nombre Solicitante +lbl_fiscalianroinstruccionfiscal=No. Expediente Fiscal +lbl_fiscalianfechaActual=Fecha Actual +lbl_fiscalianroficiofiscal=No. Oficio Fiscal\u00EDa +lbl_mensaje_noseencuentrandatosserie=No se encuentras datos, ingrese la serie, para generar el certificado +lbl_mensaje_noseencuentrandatosperson=No se encuentras datos, ingrese la identificaci\u00F3n y/o nombres, para generar el certificado + +# +lbl_organismo_control=Organismo de Control +lbl_centro_control=Centro de Control +lbl_numero_recibo=N\u00FAmero Recibo +lbl_numero_armas_procesadas=N\u00FAmero Armas Procesados +lbl_numero_armas_error=N\u00FAmero de Errores +lbl_numero_armas_correctas=Armas Correctas +lbl_numoficio=No. Oficio \ No newline at end of file diff --git a/frontend/src/main/resources/.svn/text-base/controlarmas_es.properties.svn-base b/frontend/src/main/resources/.svn/text-base/controlarmas_es.properties.svn-base new file mode 100644 index 0000000..e814afe --- /dev/null +++ b/frontend/src/main/resources/.svn/text-base/controlarmas_es.properties.svn-base @@ -0,0 +1,1014 @@ +################################################### +##### S\u00edmbolos unicode +#####\u00e1 -> +#####\u00e9 -> +#####\u00ed -> +#####\u00f3 -> +#####\u00fa -> +#####\u00c1 -> +#####\u00c9 -> +#####\u00cd -> +#####\u00d3 -> +#####\u00da -> +#####\u00F1 -> +#####\u00d1 -> +#####\u0020 -> Espacio en blanco +################################################### + +#ETIQUETAS +#Solcitud +lbl_fechasolicitud=Fecha Solicitud +lbl_fechasolicitud_aucp=Fecha Solicitud / Envio AUCP +lbl_autorizacion=Autorizaci\u00F3n +lbl_estadoDocumento=Estado del Documento +lbl_datosempresaseg=Datos Empresa Seguridad +lbl_psicologicanecesaria=NO SE HA REGISTRADO LA EVALUACI\u00D3N PSICOL\u00D3GICA +lbl_datosevaluado=Datos del Evaluado +lbl_datoscompaniaseg=Datos de la Compan\u00EDa de Seguridad +lbl_valordeposito=Valor Dep\u00F3sito +lbl_centromedico=Centro M\u00E9dico +lbl_centroControl=Centro de Control +lbl_tramitesXcentro=Tramites por Centro Control +lbl_si=S\u00CD +lbl_nombreexcel=ReporteDeArmas +lbl_nombreexcelhistorico=ReporteHistoricoDeArmas +msg_fechafinal=LA FECHA FINAL DEBE SER MAYOR A LA FECHA INICIAL +lbl_examenfinalizado=EXMEN FINALIZADO +lbl_reprobado=Reprobado +lbl_compania=Compa\u00F1\u00EDa de Seguridad +msg_proceso=El proceso debe continuar cuando el arma se encuentra en bodega. +lbl_fechaprox=LA FECHA PARA SU PR\u00D3XIMO INTENTO ES\: +lbl_detallesdetramite=DETALLES DE TR\u00C1MITE +lbl_sancionpermiso=SANCI\u00D3N PERMISO +lbl_recomendaciones=Recomendaciones +msg_ingresesancion=INGRESE UNA SANCI\u00D3N +msg_realiceunasancion=APLIQUE UNA SANCI\u00D3N +lbl_dias=d\u00EDas +lbl_verificaCertificado=VERIFICAR INFORMACI\u00D3N CERTIFICADO +lbl_reimpresion=Reimpresi\u00F3n +lbl_tiempo=Tiempo +msg_evaluado=LA PERSONA SELECCIONADA TIENE UN REGISTRO DE EVALUACI\u00D3N PSICOL\u00D3GICA +msg_nopermiso=NO SE ENCUENTRA UN PERMISO PARA EL ARMA SELECCIONADA +msg_persona=SELECCIONE UNA PERSONA +lbl_imprimir=Generar Reporte +lbl_imprimirXls==Generar Reporte Excel +lbl_verificarDocumentos=VERIFICAR DOCUMENTOS +lbl_psicologico=Psicol\u00F3gica +msg_debesubir=DEBE SUBIR UN ARCHIVO DE EVALUACI\u00D3N +lbl_informeevaluacion=Informe Evaluaci\u00F3n +lbl_recomendacion=Recomendaci\u00F3n +lbl_psicologo=Psic\u00F3logo Responsable +lbl_fechaevaluacion=Fecha Evaluaci\u00F3n +lbl_fechaexpiracion=Fecha Caducidad +lbl_fechadeexpiracion= Fecha de Expiraci\u00F3n +lbl_planInspeccionAnual=PlanDeInspecci\u00F3nAnual +msg_archivoImportacionSerie=EL ARCHIVO DE IMPORTACI\u00D3N NO DEBE CONTENER EL N\u00DAMERO DE SERIE +msg_serieVacia=La serie del arma no debe estar vac\u00EDa. +msg_limitecantidadarma=La cantidad del Arma de Fuego debe ser igual a 1 unidad +msg_claseVacia=La clase del arma no debe estar vac\u00EDa. +msg_tipoVacio=El tipo de arma no debe estar vac\u00EDo. +msg_marcaVacia=La marca del arma no debe estar vac\u00EDa. +msg_longitudVacia=La longitud del arma no debe estar vac\u00EDa. +msg_longitudNoVacia=La longitud del arma debe estar vac\u00EDa. +msg_calibreVacio=El calibre no debe estar vac\u00EDo. +msg_calibreNoVacio=El calibre debe estar vac\u00EDo. +msg_cantidadVacia=La cantidad no debe estar vac\u00EDa. +msg_cantidadNoVacia=La cantidad debe estar vac\u00EDa. +msg_unidadMedidaCantidadVacia=La U. Medida Cantidad no debe estar vac\u00EDa. +msg_unidadMedidaCantidadNoVacia=La U. Medida Cantidad debe estar vac\u00EDa. +msg_unidadMedidaSoloUna=Solo debe ingresar una unidad de medida. +msg_unidadMedidaNoExiste=La unidad de medida ingresada no existe. +msg_pesoVacio=El peso no debe estar vac\u00EDo. +msg_pesoNoVacio=El peso debe estar vac\u00EDo. +msg_unidadMedidaPesoVacia=La U. Medida Peso no debe estar vac\u00EDa. +msg_unidadMedidaPesoNoVacia=La U. Medida Peso debe estar vac\u00EDa. +msg_cantidadValorNumerico=La cantidad debe ser un valor n\u00FAmerico. +msg_pesoValorNumerico=El peso debe ser un valor num\u00E9rico. +msg_fuegosPirotecnicos=fuegos pirot\u00E9cnicos +msg_datosDuplicados=Existen datos duplicados. +msg_sustanciaQuimica=sustancia qu\u00EDmica +msg_calibreNoExisteCatalogo=El calibre no existe en el cat\u00E1logo. +msg_claseNoExisteCatalogo=No existe la clase en el cat\u00E1logo. +msg_longitudNoExisteCatalogo=No existe la longitud en el cat\u00E1logo. +msg_noExisteTipoArmaCatalogo=No existe el tipo de arma en el cat\u00E1logo. +msg_colorNoExisteCatalogo=No existe el color en el cat\u00E1logo. +msg_marcaNoExisteCatalogo=No existe la marca en el cat\u00E1logo. +msg_unicidad_agencia=S\u00D3LO UNA AGENCIA DEBE ESTAR SELECCIONADA +msg_seleccione_nombre=SELECCIONE UN NOMBRE O RAZ\u00D3N SOCIAL + +lbl_ordenTrabajoCustodios=OrdenDeTrabajoParaCustodios +lbl_guiaLibreTransito=Gu\u00EDa Libre de Tr\u00E1nsito +lbl_reportebalistico=ReporteRegistroBal\u00EDstico +lbl_fechaActual=Fecha Actual +lbl_actaDeDevolucion=ActaDevoluci\u00F3n +lbl_asuntoNotificarFecha=COMANDO CONJUNTO DE LAS FF. AA. - Notificaci\u00F3n Devoluci\u00F3n. +lbl_asuntoNotificarNovedad=COMANDO CONJUNTO DE LAS FF. AA. - Notificaci\u00F3n Novedad +lbl_notificarTramiteAnulado=Notificar Tr\u00E1mite Anulado +msg_asuntoNotificacionGuiaTranistoAnulada=COMANDO CONJUNTO DE LAS FF.AA. - Notificaci\u00F3n de tr\u00E1mite anulado en la Solicitud de Gu\u00EDa de Libre Tr\u00E1nsito. +msg_cuerpoNotificacionGuiaTransitoAnulada=DEPARTAMENTO DE CONTROL DE ARMAS
Estimado
{0}
Presente.-
Mediante la presente notificamos que su solicitud N\u00BA {1} para Emisi\u00F3n de Gu\u00EDa de Libre Tr\u00E1nsito ha sido rechazada debido a las siguientes observaciones\:

{2}

Atentamente,

{3}
{4}

NOTA\:
Este mensaje fue enviado autom\u00E1ticamente por el sistema, por favor no responda a esta cuenta de correo. +lbl_aprobacionLibreTransito=APROBACI\u00D3N DE LIBRE TR\u00C1NSITO +correoDesde=notificacion@controlarmas.ccffaa.mil.ec +correoDestino=ogarcia@bupartech.com +lbl_justificacion=Justificaci\u00F3n +cuerpo.mensaje.envio.correo=DEPARTAMENTO DE CONTROL DE ARMAS

Estimado(a)
{0}
Presente.-

El trámite de devolución No.{1} ha sido aprobado, por favor acercarse al COMANDO CONJUNTO DE LAS FF.AA a partir de {2} en horario de 8\:00 a 16\:00 para proceder con la devolución del material solicitado.

Atentamente,

{3}
{4}

NOTA\:
Este mensaje fue enviado automáticamente por el sistema, por favor no responda a esta cuenta de correo. +cuerpo.mensaje.envio.correo.novedad1=DEPARTAMENTO DE CONTROL DE ARMAS

Estimado(a)
{0}
Presente.-

El trámite de devolución No. {1}, no puede continuar porque se presenta las siguientes novedades\: +cuerpo.mensaje.envio.correo.novedad2={0}

Atentamente,

{1}
{2}

NOTA\:
Este mensaje fue enviado automáticamente por el sistema, por favor no responda a esta cuenta de correo. +cedulaDuplicada=Ya existe un custodio con esa c\u00E9dula. + + +btn_enviarNotificacion=Enviar Notificaci\u00F3n +btn_cancelar=Cancelar +htbl_sitiosalmacenamiento=SITIOS DE ALMACENAMIENTO +lbl_latitud=Latitud +lbl_estadosolicitud=Estado Solicitud +lbl_origenadquisicion=Origen de Adquisici\u00F3n +lbl_paisorigen=Pa\u00EDs +lbl_telfijo=Tel\u00E9fono Fijo +lbl_telcelular=Tel\u00E9fono Celular +lbl_correo=Correo Electr\u00F3nico +lbl_datoscapacidad=Datos Capacidad +lbl_almacenamiento=Almacenamiento +lbl_manejoarmas=Manejo de Armas +lbl_expiro_fecha_deposito=LA FECHA DE SOLICITUD EXPIR\u00D3, POR FAVOR VUELVA A INGRESAR EL TR\u00C1MITE NUEVAMENTE. +msg_error_valorDepositoNegativoCero=EL VALOR DE DEP\u00D3SITO DEBE SER MAYOR A CERO. +msg_error_vVerificDiferenteDeVAPagar=EL VALOR VERIFICADO ES DIFERENTE DEL VALOR A PAGAR Y SE ANULAR\u00C1 +lbl_seleccionar=Seleccionar +lbl_seleccionartodos= Seleccionar Todos +lbl_buscar=Buscar +lbl_cargararchivo=Cargar Archivo +lbl_requisitossolicitud=Requisitos Solicitud +lbl_seleccionarguardias=SELECCIONAR GUARDIAS DE SEGURIDAD +lbl_seleccionararmas=SELECCIONAR ARMAS +lbl_seleccionararticulos=SELECCIONAR ART\u00CDCULOS +lbl_detallematerialregistro=DETALLE MATERIAL REGISTRADO +msg_tamano_archivo_requisitos_jpg_png=EL TAMA\u00D1O M\u00C1XIMO PERMITIDO POR ARCHIVO ES DE 2 MB (.jpg .png) +msg_tamano_archivo_requisitos_jpg_png_1=EL TAMA\u00D1O M\u00C1XIMO PERMITIDO POR ARCHIVO ES DE 1 MB (.jpg .png) +msg_tamano_archivo_requisitos=EL TAMA\u00D1O M\u00C1XIMO PERMITIDO POR ARCHIVO ES DE 2 MB (.pdf .gif .jpg .png) +msg_tamano_archivo_requisitos_5=EL TAMA\u00D1O M\u00C1XIMO PERMITIDO POR ARCHIVO ES DE 5 MB (.pdf .gif .jpg .png) +msg_tamano_archivo_=EL TAMA\u00D1O M\u00C1XIMO PERMITIDO DEL ARCHIVO ES DE 2 MB (.pdf .gif .jpg .png) +msg_tamano_archivo_requisitos_pdf=EL TAMA\u00D1O M\u00C1XIMO PERMITIDO DEL ARCHIVO ES DE 2 MB (.pdf) +msg_tamano_archivo_requisitos_pdf_5=EL TAMA\u00D1O M\u00C1XIMO PERMITIDO DEL ARCHIVO ES DE 5 MB (.pdf) +msg_tamano_archivo_requisitos_pdf_jpg=EL TAMA\u00D1O M\u00C1XIMO PERMITIDO DEL PRIMER ARCHIVO ES DE 1 MB (.pdf) Y EL TAMA\u00D1O M\u00C1XIMO PERMITIDO POR ARCHIVO ES DE 2 MB (.jpg .png) +msg_escanear_documentos_originales=SE DEBE ESCANEAR LOS DOCUMENTOS ORIGINALES Y ACTUALIZADOS +#Seleccion de Agencias +lbl_seleccionaragencias=SELECCIONAR AGENCIAS/SUCURSALES +lbl_detalleAgencias=DETALLE DE AGENCIAS / SUCURSALES +lbl_responsable=Nombre y Apellido del Responsable +lbl_nom_apell_super=Nombre y Apellido del Supervisor +lbl_crearAgencia=CREAR AGENCIA - SUCURSAL +lbl_modificarAgencia=EDITAR AGENCIA - SUCURSAL +lbl_verAgencia=VER AGENCIA - SUCURSAL +btn_seleccionarArmas=Seleccionar Armas +lbl_datosCompania=DATOS COMPA\u00D1\u00CDA +lbl_datosAgencia=DATOS AGENCIA / SUCURSAL +lbl_fechaAutorizacion=Fecha Autorizaci\u00F3n +lbl_telefono=Tel\u00E9fono +lbl_documentos=DOCUMENTOS +lbl_ubicacion= Seleccione ubicaci\u00F3n por +lbl_coodenadas=Coordenadas +lbl_fechaEmision=Fecha de Emisi\u00F3n +lbl_numeroDeDocumento=No. Documento +lbl_listadoguardias=LISTADO DE GUARDIAS DE SEGURIDAD +lbl_eliminaragencia=ELIMINAR AGENCIA-SUCURSAL +lbl_eliminarmaterial=ELIMINAR MATERIAL +lbl_confirmacioneliminar=Est\u00E1 seguro de eliminar el registro? +msg_error_armas_inexistentes=NO EXISTEN ART\u00CDCULOS REGISTRADOS PARA ESTE TR\u00C1MITE +#Documentos + + +#Evaluaciones +lbl_tipoEvaluacion=Tipo Evaluaci\u00F3n +lbl_numerodocumento=No. Documento +lbl_tipoPersona=Tipo Persona +lbl_jurisdiccion=Jurisdiccin +lbl_descripcionPregunta=Descripci\u00F3n +lbl_numeroPregunta=No. Pregunta +tab_verRespuestas=Ver Respuestas +tab_Respuestas=Respuestas +tab_respuesta=Respuesta +tab_respuestaCorrecta=Respuesta Correcta +msg_seleccionepersona=POR FAVOR SELECCIONE UNA PERSONA +msg_tipoevaluacion=POR FAVOR INGRESE UN TIPO DE EVALUACIN +msg_numerointentos=USTED HA SUPERADO EL NMERO DE INTENTOS MXIMOS PARA LA EVALUACIN +msg_fechaprox=LA FECHA PARA SU PRXIMO INTENTO ES: +msg_ingreseresp=INGRESE UNA RESPUESTA +lbl_evaluacion=Evaluaci\u00F3n +lbl_detallevaluacion=Detalle de Evaluaciones +lbl_estadoevaluacion=Estado Evaluaci\u00F3n +lbl_fechadeevaluacion=Fecha Examen Psicol\u00F3 gico +lbl_fecharegistrotest=Fecha Registro Test +lbl_resultado=Resultado +lbl_resultado_busqueda=Resultados de b\u00FAsqueda +#tramite +lbl_cantidad=Cantidad +lbl_clase=Clase +lbl_tipo=Tipo +lbl_longitud=Longitud +lbl_calibre=Calibre +lbl_tipotramite=Tipo Tr\u00E1mite +lbl_tramite=Tr\u00E1mite +lbl_numeroTramite=No. Tr\u00E1mite +lbl_requisito=Requisito +lbl_descripcionrequisito=Descripci\u00F3n Requisito +lbl_tipopersona=Tipo Persona +lbl_tipoidentiicacion=Tipo Documento +lbl_identificacion=No. Documento +lbl_identificacionTxt=Identificaci\u00F3n +lbl_inicarFlujo=Continuar Tr\u00E1mite +lbl_imagencargada=Imagen Almacenada +lbl_estadocarga=Estado Carga +lbl_estadotramite=Estado Tr\u00E1mite +lbl_usoactividad=Uso / Actividad +lbl_NoTramite=No. Tr\u00E1mite +lbl_fechaDeDeposito=Fecha Dep\u00F3sito +lbl_numeroDeDeposito=No. Combrobante Dep\u00F3sito +lbl_factura=No. Factura / Documento +lbl_registro=No. Registro +lbl_valorDeDeposito=Valor Dep\u00F3sito +lbl_cargarComprobante=Cargar Comprobante +lbl_cargarResolucion=Cargar Resoluci\u00F3n +lbl_numeroDeTramite=No. Tr\u00E1mite +lbl_numeroDeComprobante=No. Comprobante +lbl_noComprobante=No. Comprobante +lbl_valorVerificado=Valor Verificado +lbl_archivoComprobante=Archivo Comprobante +lbl_imprimirComprobante=Imprimir Comprobante +lbl_ver=Ver +fct_registrarDeposito=Registrar Comprobante Dep\u00F3sito +fct_validarDeposito=Validar Comprobante Dep\u00F3sito + +# FIELDSETS +field_tipotramite=Datos Tipo Tr\u00E1mite +field_ubicacion=Ubicaci\u00F3n +field_tiposarmasexplosivos=Tipos Armas y Explosivos: +lbl_tipoTramite=Tipo Tr\u00E1mite +lbl_usoActividad=Uso/Actividad +lbl_costo=Costo +lbl_tipocosto=Tipo Costo +lbl_vigenciameses=Vigencia Meses +lbl_tipodocumento=Tipo Documento +lbl_usd=USD +lbl_registroguardia=Registro Guardia +lbl_registroarmas=Registro Armas +lbl_deposito=Dep\u00F3sito +lbl_registroagenciassucursales=Registro Agencias y Sucursales +lbl_requiereevaluacion=Requiere Evaluaci\u00F3n +lbl_requiereinspeccion=Requiere Inspecci\u00F3n +lbl_dochabilitantes=Documentos Habilitantes +lbl_docsolicitudcertificado=Solicitud de Certificado +lbl_certificadofiscal=Certificado Fiscal +lbl_actaentregareceptionSolicitud=ACTA ENTREGA RECEPCI\u00D3N - SOLICITUD +lbl_docactaentregareceptionSolicitud=Documento Acta Entrega Recepci\u00F3n - Solicitud +lbl_costoUSD=Costo(USD) +lbl_tipoautorizacion=Tipo Autorizaci\u00F3n +lbl_datostramite=DATOS DEL TR\u00C1MITE +#Tipo Archivo +lbl_tipoarchivo=Tipo Documento + +lbl_institucion=Instituci\u00F3n +lbl_nombre=Nombre +lbl_jefecentro=Jefe Centro +lbl_grado=Grado +lbl_direccion=Direcci\u00F3n +lbl_nueva_jurisdiccion=NUEVA JURISDICCI\u00D3N +lbl_jurisdicciones=Jurisdicciones +lbl_datosdejurisdicciones=DATOS DE JURISDICCIONES +lbl_nombrerazonsocial=Nombre/Raz\u00F3n Social +lbl_nombrerazonsocialcomprador=Comprador/Consumidor +lbl_numerodetramite=No. Tr\u00E1mite +lbl_numerocustodios=No. Custodios +lbl_No=No +lbl_solicitud=Solicitud +lbl_documento=Documento +lbl_noDocumento=No. Documento +lbl_noDocumentoPsicologo=No. Documento Psiclogo +lbl_tipodocumentoPsicologo=Tipo Documento Psiclogo +lbl_aprobado=Aprobado +lbl_aprobacion=APROBACI\u00D3N +lbl_generarValorACancelar=GENERAR VALOR A CANCELAR +lbl_valorCancelar=Valor a Cancelar +lbl_valorAPagar=Valor a Pagar + +lbl_accion=Acci\u00F3n +lbl_aceptar=Aceptar + +lbl_secuencial=Secuencial +lbl_tipoarmas=Tipo Arma +lbl_clasearma=Clase Arma +lbl_unidad=Unidad de Control +lbl_unidaddestino=Unidad de Control Destino + +lbl_unidadmedida=Unidad Medida +lbl_cupopeso=Cupo Peso +lbl_fecha=Fecha +lbl_tiporegistro=Tipo Registro +lbl_crearcupoautorizado=DETALLE DE CUPOS AUTORIZADOS +lbl_detalleunidadesmedida=DETALLE UNIDADES DE MEDIDA +lbl_unidadTipoClase=UNIDAD TIPO CLASE +lbl_cupo=Cupo +lbl_creartipounidad=CREAR UNIDAD DE MEDIDA +lbl_listadorequisitos=LISTADO DE REQUISITOS +lbl_datossolicitud=DATOS SOLICITUD +lbl_ordendetrabajono=Orden Trabajo No. +lbl_centrodecontrol=Centro Control +lbl_organismocontroldestino=Organismo de Control Destino +lbl_fechainspeccion=Fecha Inspecci\u00F3n +lbl_propietariorepresentantelegal=PROPIETARIO O REPRESENTANTE LEGAL +lbl_referencia=Referencia +lbl_representantelegal=Representante Legal +lbl_sitioinspeccion=SITIO INSPECCI\u00D3N +lbl_responsablem=RESPONSABLE +lbl_numerodecedula=No. C\u00E9dula +lbl_nombresapellidos=Nombres y Apellidos +lbl_telefonodomicilio=Tel\u00E9fono Domicilio +lbl_resultadoinspeccion=RESULTADO INSPECCI\u00D3N +lbl_continuartramiteproceso=Continuar Tr\u00E1mite o Proceso +lbl_negartramiteproceso=Negar Tr\u00E1mite o Proceso +lbl_aplicadecomiso=Aplica Decomiso +lbl_documentoinspeccion=Documento Inspecci\u00F3n +lbl_documentoinspeccionfecha=fecha +lbl_documentoinspeccioncodeuser=Identificaci\u00F3n +lbl_documentoinspeccioncodenombre=Nombres +lbl_fotografias=Fotograf\u00EDas +lbl_bodega=Bodega +lbl_sitiosalmacenanmiento=SITIOS DE ALMACENAMIENTO +lbl_registrarresultadoinspeccion=REGISTRAR RESULTADO INSPECCI\u00D3N +lbl_tipodecomercio=Tipo de Comercio +lbl_sitiosalmacenamiento=SITIOS DE ALMACENAMIENTO +lbl_tramites=TR\u00C1MITES +lbl_descripcionCorta=Descripci\u00F3n Corta +lbl_ingresodedecomiso=INGRESO DE DECOMISO / INCAUTACI\u00D3N +lbl_lugardeldecomiso=LUGAR DEL DECOMISO / INCAUTACI\u00D3N +lbl_datosdeldecomiso=DATOS DEL DECOMISO / INCAUTACI\u00D3N +lbl_tipodeproceso=Tipo Proceso +lbl_numerorecibo=No. Recibo +lbl_numerotransaccion=No. Transacci\u00F3n +lbl_fechadecomiso=Fecha Decomiso / Incautaci\u00F3n +lbl_organismocontrol=Organismo de Control +lbl_detalledeldecomiso=DETALLE DEL DECOMISO / INCAUTACI\u00D3N +lbl_datosdelciudadano=Datos del Ciudadano +lbl_decomisadopor=Control Realizado por +lbl_numerocedula=No. C\u00E9dula +lbl_funcionario=Funcionario +btn_registromaterial=Registro Material +btn_generarreciboregistro=Generar Recibo Registro +btn_consultarmaterial=Consultar Material +btn_entregarmaterial=Entregar Material +lbl_sinportador=Sin Portador +lbl_cant=Cant +lbl_umedida=U. Medida +lbl_fecdecimiso=Fecha Decomiso +lbl_motivo=Motivo +lbl_portadorarma=Portador Arma +lbl_registrodematerialdecomisadoincauto=REGISTRO MATERIAL +lbl_registrodematerialicautado=REGISTRO DE MATERIAL CUSTODIA TEMPORAL +lbl_propietario=Propietario +lbl_subir=Subir +lbl_cancelar=Cancelar +lbl_mensajearchivoinvalidom=EL TAMA\u00D1O DEL ARCHIVO DEBE SER M\u00C1XIMO DE +lbl_5mb=5 MB +lbl_2mb=2 MB +lbl_1mb=1 MB +lbl_sinidentificacion=Sin Identificaci\u00F3n +lbl_decomisoincautacion=Decomiso / Incautaci\u00F3n +lbl_cabecera=Cabecera +lbl_pie=Pie +lbl_crearsitiosdealmacenamiento=CREAR / EDITAR +lbl_modificarsitiosdealmacenamiento= CREAR / EDITAR +lbl_datosdecustodia=DATOS DE CUSTODIA +lbl_fechadecustodia=Fecha de Custodia +lbl_aerolinea=Aerolnea +lbl_novuelo=No. Vuelo +lbl_lugarOrigenm=LUGAR ORIGEN +lbl_lugarDestinom=LUGAR DESTINO +lbl_aeropuerto=Aeropuerto +btn_material=Material +lbl_ingresodedatosdesitiosdealmacenamiento=INGRESO DE DATOS DE SITIOS DE ALMACENAMIENTO +lbl_numerotransaccionenvio=No. Transacci\u00F3n Env\u00CDo +lbl_numerotransaccionrecepcion=No. Transacci\u00F3n Recepci\u00F3n +lbl_fecdecomiso=Fec Decomiso +htbl_detalledelmaterialm=DETALLE DEL MATERIAL +lbl_cantidadpeso=Cantidad/Peso +lbl_ingresocustodiatemporalenaeropuerto=INGRESAR CUSTODIA TEMPORAL EN AEROPUERTO +lbl_nodecomiso=No. Decomiso +btn_generaracta=Generar Acta +lbl_costocustodio=Costo Custodio +btn_iniciarproceso=Continuar Tr\u00E1mite +lbl_multa=Multa +lbl_flujotramite=Flujo Tr\u00E1mite +lbl_numeromaximoarmas=No M\u00E1ximo Armas +lbl_estadosarma=Estados Arma +lbl_tramitepadre=Tr\u00E1mite Padre +lbl_codigoplanificacion=C\u00F3digo Planificaci\u00F3n +lbl_mes=Mes +lbl_planificacioninsoeccion=PLANIFICACI\u00D3N DE INSPECCIONES +lbl_logo=Logo +lbl_limpiar=Limpiar +lbl_unidadcontrolrecepcion=Unidad de Control +lbl_unidadrecepcion=UNIDAD DE RECEPCI\u00D3N +lbl_sancionable=Sancionable +lbl_validaFechaExpiracion=Visualizar Fecha expiraci\u00F3n +lbl_validaPorFechaExpiracion=Visualizar por Fecha expiraci\u00F3n +lbl_validaCaducidadTramPadre=Validar caducidad tr\u00E1mite padre +lbl_validaCaducidadTramPadreAlt=Validar caducidad tr\u00E1mite padre alterno +lbl_seleccionararma=Seleccionar Arma +htbl_armas=Armas +lbl_dochabilitante=Doc. Habilitante +lbl_fechadochabilitante=Fecha Doc. Habilitante +lbl_fechasancion=Fecha Sanci\u00F3n +lbl_confirmacionguardarsancion=Est\u00E1 seguro de guardar la sanci\u00F3n ? +lbl_seleccionecentrocontroltramite=Seleccione el Centro de Control a Realizar el Tr\u00E1mite +lbl_longitud_minima=Longitud M\u00EDnima +lbl_numero_=N\u00FAmeros +lbl_caracteres_especiales=Caracter Especial +lbl_mayusculas=May\u00FAsculas +lbl_parametros_clave=La clave debe cumplir lo siguinete +btn_ubicar=Ubicar +btn_guardar_coordenadas =Guardar Coordenadas +nota_coordenadas =Al ingresar las coodernadas, verificar en el mapa que corresponda a la Ubicaci\u00F3n que esta haciendo referencia. +#TITULOS + +#ETIQUETAS CABECERA TABLAS +htbl_tipotramite=Tipo Tr\u00E1mite +htbl_requisitos=Requisitos +htbl_requisitosportipotramite=Requisitos por Tipo Tr\u00E1mite +htbl_TiposDeArmasExplosivos=TIPOS DE ARMAS Y EXPLOSIVOS +htbl_datospersonales=Datos Personales +htbl_seleccionetramite=SELECCIONE EL TR\u00C1MITE + +#ETIQUETAS TABS +tab_solgenerales=Datos Generales +tab_solrequisitos=Ingresar Requisitos +tab_requisitos=Requisitos +tab_solarmas=Seleccionar Armas +tab_solmateriales=Seleccionar Materiales +tab_solarticulos=Seleccionar Art\u00EDculos +tab_solguardias=Seleccionar Guardias +tab_tramite=Datos Tr\u00E1mite +tab_agencias=Seleccionar Agencias +tab_documentos=Listar Documentos +tab_depositoportramite=Dep\u00F3sito por Tr\u00E1mite +tab_depositoporcustodio=Dep\u00F3sito por Custodio +tab_seleccionar=Seleccionar +tab_eliminar=Eliminar +tab_modificar=Editar + + +#REQUISITO POR TIPO DE TRAMITE +lbl_depositoportramite=Dep\u00F3sito por Tr\u00E1mite +lbl_depositoporcustodio=Dep\u00F3sito por Custodio + +#RECEPCION/VERIFICACION DE ARMAS +lbl_recepcionarmas=Registro Entrega Armas +lbl_categoria=Categor\u00EDa +lbl_fecharegistro=Fecha Registro +lbl_provincia=Provincia +lbl_canton=Cant\u00F3n +lbl_ciudad=Ciudad +lbl_parroquia=Parroquia +lbl_fecharecepcion=Fecha Recepci\u00F3n +lbl_informacionarmas=INFORMACI\u00D3N DE ARMAS +lbl_informaciondocumentos=INFORMACI\u00D3N DE DOCUMENTOS +lbl_informacionagenciassucursales=INFORMACI\u00D3N DE AGENCIAS SUCURSALES +lbl_informacionpersonal=INFORMACI\u00D3N PERSONAL +lbl_codigo=C\u00F3digo +lbl_marca=Marca +lbl_modelo=Modelo +lbl_serie=Serie +lbl_color=Color +lbl_estado=Estado +lbl_estado_arma=Estado Arma +lbl_entregado=Entregado +lbl_pais=Pa\u00EDs Fabricaci\u00F3n + +#FICHA TECNICA ARMAS +lbl_observacion=Observaci\u00F3n +lbl_aptituddisparo=Aptitud Disparo +lbl_balastestigo=Balas Testigo +lbl_bainastestigo=Vainas Testigo +lbl_apruebaevaluacion=Aprueba Evaluaci\u00F3n +lbl_recuperadorbalisitico=RECUPERADOR BALISTICO +lbl_impronta=Impronta +lbl_fichatecnica=Ficha T\u00E9cnica +lbl_fotografia=Fotograf\u00EDa +lbl_archivocincomegas=5242880 +lbl_archivocuatromegas=4194304 +lbl_archivotresmegas=3145728 +lbl_archivodosmegas=2097152 +lbl_archivounmega=1048576 +lbl_mensajearchivoinvalido=El tama\u00F1o del archivo debe ser m\u00E1ximo de +lbl_observacionrequerido=El campo observaci\u00F3n es requerido +lbl_bainastestigorequerido=El campo vainas testigo es requerido +lbl_balastestigorequerido=El campo balas testigo es requerido +lbl_aptituddisparorequerido=El campo aptitud de disparo es requerido +lbl_informacionguardias=INFORMACI\u00D3N DE GUARDIAS +lbl_pruebasbalistica=PRUEBAS BALISTICA +lbl_impresionarma1=EL ARMA CON C\u00D3DIGO +lbl_impresionarma2=\ NO HA SIDO IMPRESA +lbl_isimpreso=FUE IMPRESO +lbl_imprimirarma=DEBE GENERAR REPORTE DEL ARMA ANTES DE ACEPTAR +lbl_subidaimagenes=LA SUBIDA DE IMAGENES ES REQUERIDA +lbl_subidaimagenes2=LA SUBIDA DE IMAGENES ES REQUERIDA. NO SE ENCUENTRAN SUBIDAS TODAS LAS IMAGENES +#LOV +lvh_requisitotramite=SELECCIONAR TR\u00C1MITE +lvh_clase=CLASE +lvh_longitud=LONGITUD +lvh_tipo=TIPO +lvh_calibre=CALIBRE +lvh_tipoarma=TIPO ARMA + + +#BOTONES +btn_descargarDocumentos=Descargar Documentos +btn_descargarDocumento=Descargar Documento +#Botones +btn_jurisdiccion=Jurisdicci\u00F3n +btn_buscar=Buscar +btn_crear=Crear +btn_eliminar=Eliminar +btn_imprimir=Generar Reporte +#MENSAJES +#msg_importeTotal=IMPORTE TOTAL DE VI\u00C1TICOS Y GASTOS DE VIAJES COMPROBADOS + +#Validacion de Tramite para la Gua de Libre Trnsito +lbl_datosTramite=DATOS TR\u00C1MITE +lbl_fechaSolicitud=Fecha Solicitud +lbl_tipoTramite2=Tipo Tr\u00E1mite + +lbl_tipoDocumento=Tipo Documento +lbl_numeroDocumento=No. Documento +lbl_nombreRazonSocial=Nombre / Raz\u00F3n Social +lbl_vendedor=Vendedor +lbl_lugarOrigen=Lugar Origen +lbl_lugarOrigenProvincia=Lugar Origen Provincia +lbl_lugarOrigenCanton=Lugar Origen Cant\u00F3n +lbl_comprador=Comprador +lbl_lugarDestino=Lugar Destino +lbl_lugarDestinoProvincia=Lugar Destino Provincia +lbl_lugarDestinoCanton=Lugar Destino Cant\u00F3n +lbl_estadoTramite=Estado Tr\u00E1mite +lbl_informacionArmas=INFORMACI\u00D3N ARMAS +lbl_numero=No. +lbl_tipo2=Tipo +lbl_calibre2=Calibre +btn_aceptar=Aceptar + +#Orden de trabajo para custodios +lbl_ordenTrabajo=ORDEN DE TRABAJO +lbl_numeroOrden=No. Orden Trabajo +lbl_fechaOrden=Fecha Orden Trabajo +lbl_documentoReferencia=Documento Referencia +lbl_comisionActividad=Comisi\u00F3n/Actividad +lbl_empresaSolicita=Empresa Solicita +lbl_lugarDireccionComision=Lugar y Direcci\u00F3n de la Comisi\u00F3n +lbl_ruta=Ruta +lbl_tiempoEstimado=Tiempo Estimado +lbl_fechaInicio=Fecha Inicio +lbl_fechaFinalizacion=Fecha Finalizaci\u00F3n +lbl_observaciones=Observaciones +lbl_datosCustodios=DATOS DE CUSTODIOS +lbl_nombreParticipante=Nombre Participante +lbl_apellidos=Apellidos +lbl_nombres=Nombres +lbl_cedula=No. C\u00E9dula +lbl_modificar=Editar +lbl_eliminar=Eliminar +lbl_ingresarCustodios=CREAR / EDITAR +lbl_modificarCustodios=CREAR / EDITAR +errorCedula=El n\u00FAmero ingresado no es v\u00E1lido. Por favor verificar. +#MENSAJES +#msg_importeTotal=IMPORTE TOTAL DE VI\u00C1TICOS Y GASTOS DE VIAJES COMPROBADOS + +#Actualizar Datos Generales +lbl_nombreRepresentanteLegal=Nombre Representante Legal +lbl_cedulaRepresentante=C\u00E9dula Representante Legal +lbl_actividadEconomica=Actividad Econ\u00F3mica +lbl_paisOrigen=Pa\u00EDs Origen +lbl_telefonoConvencional= Tel\u00E9fono Convencional +lbl_tlfCelular=Tel\u00E9fono Celular +lbl_estadoCivil=Estado Civil +lbl_genero=G\u00E9nero +lbl_estatura=Estatura (metros) +lbl_profesion=Profesi\u00F3n +lbl_correoElectronico=Correo Electr\u00F3nico +lbl_datosCapacidad=DATOS DE CAPACIDAD +lbl_manejoArmas=Manejo Armas +lbl_listarInformacion=LISTAR INFORMACI\u00D3N +lbl_seleccionarTodos=Seleccionar Todos +btn_registrarNovedad=Registrar Novedad +btn_actaDevolucion=Acta Devoluci\u00F3n +lbl_noTramite=No. Tr\u00E1mite +lbl_verificar=Verificar +lbl_registrarNovedad=Registrar Novedad +lbl_actaDevolucion=Acta Devoluci\u00F3n +lbl_unidadcontrol=Unidad De Control +xpathFujoDocumentoHabilitante=emisiondocumentohabilitante + +#Etiquetas para datos sanciones +lbl_tipoDeFalta=Tipo de Falta +lbl_falta=Falta +lbl_tiempoEnDias=Tiempo(d\u00EDas) +lbl_sancion=Sanci\u00F3n +htbl_datosParaSanciones =DATOS PARA SANCIONES +lov_tipoDeFalta=TIPOS DE FALTAS +lov_falta=FALTAS +lov_sancion=SANCIONES +lov_unidades=UNIDADES +lov_clase=CLASE +msg_error_seleccionClase = POR FAVOR SELECCIONE UNA CLASE DE ARMA O EXPLOSIVO + +#Verificacion de la Informacion de Devolucion + +#Carga de datos Excel +btn_cargar=Cargar +btn_limpiar=Limpiar +hfld_datosgenerales=Datos Generales +lbl_unidadcantidad=U. Medida Cantidad +lbl_peso=Peso +lbl_unidadpeso=U. Medida Peso +htbl_detalledelmaterial=Detalle del Material + +tramite=Tr\u00E1mite +lbl_dui=No. DUI +lbl_fob=Total FOB +lbl_paisdestino=Pa\u00EDs Destino +lbl_fabricante=Fabricante +lbl_aeropuertopuerto=Aeropuerto/Puerto +lbl_numerosolicitud=No. Solicitud +lbl_numerosolicitud_aucp=No. Solicitud / AUCP +lbl_datoscomprador=Datos Comprador +lbl_datostransaccion=Datos Transacci\u00F3n +lbl_tipotransaccion=Tipo Transacci\u00F3n +fct_datosPreguntasRespuestas = DATOS DE PREGUNTAS Y RESPUESTAS + +msg_error_lotenull=EL LOTE NO PUEDE SER NULO. +msg_error_armanovalida=TIPO DE ARMA NO VALIDA. +msg_error_cantidadnotnull=LA CANTIDAD NO PUEDE SER NULA. +msg_error_pesonull=EL PESO NO PUEDE SER NULO. +msg_error_nrseries=NO PUEDEN EXISTIR SERIES REPETIDAS. +msg_error_erroresexcel=ERROR DE REFERENCIA CON EL CAT\u00C1LOGO. +msg_error_claseytipo=LA CLASE Y EL TIPO NO PUEDEN TENER VALORES NULOS. +msg_error_nocontrolado=ERROR NO CONTROLADO, POR FAVOR REVISE SU DOCUMENTO. +msg_error_cantidadnumerica=LA CANTIDAD DEBE SER UN VALOR NUM\u00C9RICO. +msg_error_catalogo=ERROR EN EL CAT\u00C1LOGO DE TIPOARMAEXPLOSIVO +msg_error_pesonumerico=EL PESO DEBE SER UN VALOR NUM\u00C9RICO +##MESAJES SOLICITUD +msg_error_tramite=DEBE ESCOGER UN TR\u00C1MITE +msg_error_requisitos=DEBE INGRESAR TODOS LOS REQUISITOS SOLICITADOS +msg_error_no_requisitos=NO EXISTEN REQUISITOS DEFINIDOS PARA ESTE TIPO DE TR\u00C1MITE CONSULTE CON EL ADMINISTRADOR +msg_error_armas=DEBE SELECCIONAR AL MENOS UN ART\u00CDCULO EN EL TR\u00C1MITE +msg_error_maximo_armas=NO PUEDE SELECCIONAR MAS DE {0} ARMA(S), LAS ARMAS RESTANTES DEBEN SEGUIR EL TR\u00C1MITE PERTINENTE +msg_error_guardias=DEBE SELECCIONAR AL MENOS UN GUARDIA EN EL TR\u00C1MITE +msg_error_agencias=DEBE SELECCIONAR AL MENOS UNA AGENCIA EN EL TR\u00C1MITE +msg_error_documento=DEBE SELECCIONAR AL MENOS UN DOCUMENTO DE LA LISTA + +msg_error_imprimir_recepcion_armas=SE DEBEN ENCONTRAR SELECCIONADAS TODAS LAS ARMAS PARA PODER IMPRIMIR +msg_error_validar_seleccion_armas=SE DEBEN ENCONTRAR SELECCIONADAS TODAS LAS ARMAS PARA PODER GUARDAR +msg_error_requiere_validacion_tecnica=PARA EL TR\u00C1MITE SELECCIONADO, SE REQUIERE CUMPLIR CON EL SIGUIENTE REQUISITO PREVIO\: EVALUACI\u00D3N DE CONOCIMIENTOS +msg_error_requiere_validacion_psicologica=PARA EL TR\u00C1MITE SELECCIONADO, SE REQUIERE CUMPLIR CON EL SIGUIENTE REQUISITO PREVIO\: EVALUACI\u00D3N PSICOL\u00D3GICA + +msg_error_numerodocumento=SELECCIONE EL No. DOCUMENTO +msg_error_tipoarchivoinvalido=TIPO ARCHIVO INVALIDO +msg_error_exedeelnumero=EXEDE EL NUMERO DE ARCHIVOS + +msg_error_comprobanteDepositoUsado= \ EL DEP\u00D3SITO INGRESADO YA HA SIDO UTILIZADO EN OTRO TR\u00C1MITE. POR FAVOR VERIFICAR. +msg_error_tramiteSinDatosAsociados= EL N\u00DAMERO DE TR\u00C1MITE NO TIENE DATOS ASOCIADOS. +msg_error_decomisoSinDatosAsociados= EL DOCUMENTO DE DECOMISO NO TIENE DATOS ASOCIADOS. +msg_error_fechaDepositoMayorFechaActual= LA FECHA DE DEP\u00D3SITO NO PUEDE SER MAYOR A LA FECHA ACTUAL. +msg_error_archivo=EL FORMATO DEL ARCHIVO NO ES EL CORRECTO, RECUERDE QUE EL ARCHIVO DEBE SER PDF, PNG O JPEG Y NO DEBE SUPERAR 1MB. +msg_error_archivo_firma=EL FORMATO DEL ARCHIVO NO ES EL CORRECTO, RECUERDE QUE EL ARCHIVO DEBE SER PDF. +msg_error_sinarchivo=NO HA SUBIDO EL ARCHIVO FIRMADO A ALFRESCO. +msg_error_sinfirmararchivo=EL ARCHIVO NO EST\u00C1 FIRMADO PARA SUBIR AL ALFRESCO. +msg_error_nombrearchivo=EL NOMBRE DE ARCHIVO NO CORRESPONDE +msg_error_nombrearchivo_xpath=NO EXITE XPATH DEL ARCHIVO +msg_error_ingreseComprobanteDeposito=INGRESE EL COMPROBANTE DE DEP\u00D3SITO +msg_error_ingreseDocumentoDecomiso=INGRESE EL DOCUMENTO DE DECOMISO +msg_error_reimpresion=NO HA SELECCIONADO NINGUN REGISTRO O LOS REGISTROS SELECCIONADOS NO SON DE TIPO PERMISO +msg_error_verificararmas=NO HA SELECCIONADO NINGUN REGISTRO +msg_error_verificarcentcontdestino=NO HA SELECCIONADO NINGUN ORGANISMO DE CONTROL O UNIDAD DE CONTROL +msg_error_noexistendocumentos=NO TIENE DOCUMENTOS HABILITANTES EXISTENTES PARA ESTE TR\u00C1MITE +msg_error_noexistesolicitud=NO EXISTE SOLICITUD +msg_error_tramite_padre=REQUISITO PREVIO PARA ESTE TR\u00C1MITE\: {1}/{2}/{3} +msg_error_avanzar_flujo=DEBE IMPRIMIR ANTES DE HACER AVANZAR EL FLUJO +msg_error_adjuntar_resolucion=ERROR AL ADJUNTAR LA RESOLUCI\u00D3N + +##MESAJES DATOS SANCIONES +msg_error_tipoFaltaRequerido=SELECCIONE UN TIPO DE FALTA +msg_error_faltaRequerido=SELECCIONE UNA FALTA +msg_error_claseRequerido=SELECCIONE UNA CLASE +msg_error_sancionRequerido=SELECCIONE UNA SANCI\u00D3N + +#LABEL EVALUACIONES +ttl_evaluacion=TEST DE CONOCIMIENTOS +lbl_conocimientos=Conocimientos +lbl_test=Test +lbl_preguntas=Preguntas +lbl_mensaje=Lea detenidamente las preguntas del Test y seleccione una respuesta correcta. +btn_iniciar=Iniciar +#ARMAS +lbl_crearmaterial=CREAR MATERIAL +lbl_vermaterial=VER MATERIAL +lbl_modificarmaterial=EDITAR MATERIAL +htbl_detallematerial=DETALLE MATERIAL REGISTRADO +lbl_datospersonales=DATOS PERSONALES +lbl_datosmaterial=DATOS MATERIAL +lbl_fechaemisionpermiso=Fecha Emisi\u00F3n Permiso +lbl_tipofabricacion=Tipo Fabricaci\u00F3n +lbl_serielote=Serie/Lote +lbl_seriecanon=Serie/Ca\u00F1\u00F3n +lbl_datosdecomiso=DATOS DECOMISO / INCAUTACI\u00D3N +lbl_fechadecimiso=Fecha Decomiso / Incautaci\u00F3n +lbl_portadormaterial=Portador del Material +lbl_motivodecomiso=Motivo Decomiso / Incautaci\u00F3n +lbl_detallearma=FORMATO ARMA +lbl_datosarma=DATOS ARMA +lbl_codigoarma=C\u00F3digo de Arma +lbl_actualizar_propietario=ACTUALIZAR PROPIETARIO +lbl_datos_propietario_nuevo=Datos propietario nuevo + +#MATENIMIENTO DOCUMENTO ALFRESCO +lbl_crearmantenimientodocumento=CREAR MANTENIMIENTO DOCUMENTOS ALFRESCO +lbl_modificarmantenimientodocumento=EDITAR MANTENIMIENTO DOCUMENTOS ALFRESCO +lbl_vermantenimientodocumento=VER MANTENIMIENTO DOCUMENTOS ALFRESCO +htbl_detalledocumentoregistrados=DETALLE DE DOCUMENTOS REGISTRADO +lbl_datosPerfilDocumento= DOCUMENTOS POR PERFIL + +#MATENIMIENTO DOCUMENTO FISCALIA +lbl_crearcertificadofiscalia=CREAR CERTIFICADO FISCAL\u00CDA +lbl_modificarcertificadofiscalia=EDITAR CERTIFICADO FISCAL\u00CDA +lbl_datoscertificado=DATOS CERTIFICADO + +btn_generarReporte=Generar Reporte +btn_generarInforme=Generar Informe +btn_enviar=Enviar +btn_generarfecha=Generar Fecha +fct_materialParaDestruccion=MATERIAL PARA BAJA Y DESTRUCCI\u00D3N +lbl_fechaDeCorte=Fecha Corte +lbl_fechaNotificacion=Fecha Notificaci\u00F3n +lbl_formato = Formato +lbl_uniMedida= U. Medida +lbl_fecDecimiso=Fecha Decomiso / Incautaci\u00F3n +lbl_noRecibo=No. Recibo +fct_formatoReporteGenerar=FORMATO DEL REPORTE A GENERAR +fct_pnlunidaddestino=UNIDAD DE DESTINO +lbl_archivocash= Archivo Cash +lbl_plananual= Plan Anual +lbl_actadecomisoentrega= Acta de Entrega de Material Decomisado +lbl_actadecomisorecepcion= Acta de Recepci\u00F3n de Material Decomisado +lbl_documentodecomisoentrega= Documento Acta de Entrega de Material Decomisado +lbl_documentodecomisorecepcion= Documento Acta de Recepci\u00F3n de Material Decomisado +lbl_documentoplananual=Documento Plan Anual +lbl_tipodocumentos=Tipo de Documentos +lbl_numerodocumentos=No. Documentos + +lbl_combosolicitud=Solicitud +lbl_comboplanificacionanual=Planificaci\u00F3n Anual +lbl_comboashmanagement=Cash Management +lbl_combodecomiso=Decomisos +lbl_combofiscalia=Fiscal\u00EDa + + +#verificacion del material decomisado +fct_datosDelDecomiso=DATOS DEL DECOMISO / INCAUTACI\u00D3N +fct_datosDelArmaSancion=DATOS DEL ARMA / SANCI\u00D3N +lbl_numeroRecibo=No. Recibo +lbl_fechaDeDecomiso=Fecha Decomiso / Incautaci\u00F3n +lbl_cedulaRucPasaporte=C\u00E9dula/Ruc/Pasaporte +lbl_fechaDeRegistro=Fecha Registro +lbl_nocedula=No. C\u00E9dula +lbl_enBodega=En Bodega +tab_detalleDeArmas=DETALLE DE ARMAS +tab_sancion=SANCI\u00D3N + +##MENSAJES ARMAS +msg_error_tipoarmaexplosivonoexistente=TIPO DE ARMA EXPLOSIVO NO EXISTENTE, DEBE SELECCIONAR UNA COMBINACI\u00D3N V\u00C1LIDA +msg_error_camposrequeridos=ERROR, LOS CAMPOS MARCADOS CON (*) SON REQUERIDOS +msg_error_camponotificacion=EL CAMPO DE FECHA DE NOTIFICACIN NO HA SIDO GENERADO +msg_categoriaRequerida=DEBE SELECCIONAR UNA CATEGOR\u00CDA + +##MENSAJES INSPECCION +msg_error_ingreseelformatodeinspeccion=INGRESE EL FORMATO DE INSPECCI\u00D3N +msg_error_ingreselafoto1=INGRESE LA FOTO 1 +msg_error_ingreselafoto2=INGRESE LA FOTO 2 +msg_error_ingreselafoto3=INGRESE LA FOTO 3 +msg_error_seleccionesionoenaplicadecomiso=SELECCIONE SI O NO EN APLICA DECOMISO +msg_error_seleccionenegarocontinuartramiteproceso=SELECCIONE ALGUNA OPCI\u00D3N NEGAR O CONTINUAR TR\u00C1MITE O PROCESO +msg_error_seleccionenesitioinspeccion=SELECCIONE EL SITIO DE INSPECCI\u00D3N +msg_error_realizelabusqueda=REALIZE LA BUSQUEDA +mg_error_usuarionoencontrado=USUARIO NO ENCONTRADO +mg_error_usuarionoencontradovendedor=USUARIO NO ENCONTRADO +mg_error_usuarionoencontradocomprador=USUARIO NO ENCONTRADO +mg_error_ingreselosdatosdelpropietario=INGRESE LOS DATOS DEL PROPIETARIO +mg_error_seleccioneeltipodedocumentooingreselacedula=SELECCIONE EL TIPO DE DOCUMENTO E INGRESE EL N\u00DAMERO DE DOCUMENTO +mg_error_seleccioneeltipodedocumentooingreselacedulavendedor=SELECCIONE EL TIPO DE DOCUMENTO E INGRESE EL N\u00DAMERO DE DOCUMENTO +mg_error_seleccioneeltipodedocumentooingreselacedulacomprador=SELECCIONE EL TIPO DE DOCUMENTO E INGRESE EL N\u00DAMERO DE DOCUMENTO +mg_error_seleccioneeltipodedocumentooingreselongitudlatitud=SELECCIONE LA UBICACI\u00D3N +mg_error_seleccioneeltipoMapa=SELECCIONE TIPO DE UBICACI\u00D3N + +##MENSAJES DECOMISO +msg_error_numReciboNoRegistrado=EL N\u00DAMERO DE RECIBO NO SE ENCUENTRA REGISTRADO +msg_error_fechaCorteMayorAFechaActual=LA FECHA DE CORTE NO PUEDE SER MAYOR A LA FECHA ACTUAL +msg_error_fechaCorteRequerido=LA FECHA DE CORTE ES UN CAMPO REQUERIDO +msg_error_seleccioneAlmenosUnArma=DEBE SELECCIONAR AL MENOS UN ARMA DECOMISADA PARA GENERAR EL REPORTE +msg_error_noGuardoCorrectamenteReporte=NO SE HA PODIDO INICIAR EL PROCESO. ERROR AL GUARDAR EL REPORTE +msg_error_generarReporteRequerido= DEBE GENERAR EL REPORTE ANTES DE INICIAR EL PROCESO +msg_info_consultarArmasDecomidas=NO EXISTEN ARMAS DECOMISADAS AL MOMENTO DE CONSULTAR +##MENSAJES CUSTODIA TEMPORAL +msg_error_seleccionepropietario=SELECCIONE EL PROPIETARIO +msg_error_ingreselaobservacion=INGRESE LA OBSERVACI\u00D3N +msg_error_seleccioneelarmaacustodiatemporal=SELECCIONE EL ARMA A CUSTODIA TEMPORAL +msg_error_fechadecomisonopuedesermayoralaactual=LA FECHA DE DECOMISO/INCAUTACI\u00D3N NO PUEDE SER MAYOR A LA FECHA ACTUAL +msg_error_numerocomprobanterecibo=EL NO. COMPROBANTE/RECIBO YA EXISTE PARA LA ACTIVIDAD Y UNIDAD DE CONTROL SELECCIONADA +msg_error_validarnumerocomprobanterecibo=SELECCIONE ANTES ACTIVIDAD DE CONTROL PARA INSERTAR NO. COMPROBANTE/RECIBO +msg_error_nodocumentoinvalido=No Documento INVALIDO +msg_error_nodocumentoinvalidovendedor=No Documento INVALIDO +msg_error_nodocumentoinvalidocomprador=No Documento INVALIDO +msg_error_seleccionesinportadoroverifiqueusuarioexistente=SELECCIONE SIN PORTADOR O VERIFIQUE SI EL USUARIO EXISTE +msg_error_seleccionesinportadoroverifiqueusuarioexistentevendedor=SELECCIONE O VERIFIQUE SI EL USUARIO EXISTE +msg_error_seleccionesinportadoroverifiqueusuarioexistentecomprador=SELECCIONE O VERIFIQUE SI EL USUARIO EXISTE +msg_error_seleccioneelarmaarealizareldecomisoincautacion=SELECCIONE EL MATERIAL EN LA PESTA\u00D1A SELECCIONAR MATERIALES, PARA REALIZAR +msg_error_seleccionearchivodecomisoincautacion=SELECCIONE EL DOCUMENTO DE ACTIVIDAD DE CONTROL +msg_error_sin_decomisos=EL CENTRO DE CONTROL NO TIENE DECOMISOS +msg_error_sin_centrocontrol=NO SE ENCUENTRA ASIGNADO UN CENTRO DE CONTROL, REVISAR SI TIENE ASIGNADO UNA DIRECCI\u00D3N COMO PRINCIPAL Y PROVINCIA +msg_error_numero_recepcion=EL NUMERO DE RECEPCION NO TIENE EL FORMATO ESPERADO REC-000000000 +msg_error_solicitud_noencontrada=SOLICITUD NO ENCONTRADA +msg_error_listardocumentos_solo=SOLO PUEDE SELECCIONAR UN DOCUMENTO EN LA SECCI\u00D3N LISTAR DOCUMENTOS +msg_error_listardocumentos=SE DEBE SELECCIONAR AL MENOS UN DOCUMENTO EN LA SECCI\u00D3N LISTAR DOCUMENTOS +msg_error_psicologoinvalido=LA IDENTIFICACI\u00D3N DEL PSIC\u00D3LOGO RESPONSABLE ES INV\u00C1LIDA. + +##MENSAJES INFORMACION DEVOLUCION +msg_error_generereporte=GENERE EL REPORTE + +lbl_generarPlanInspeccionAnual=GENERAR PLAN DE INSPECCI\u00D3N ANUAL +lbl_datosPlanificacion=DATOS PLANIFICACI\u00D3N +lbl_anno=A\u00F1o +lbl_codigoPlanificacion=C\u00F3digo de Planificaci\u00F3n +lbl_planificacion=Planificaci\u00F3n +lbl_centroControlArmas=Centro de Control de Armas +lbl_fechaGeneracion=Fecha de Generaci\u00F3n +btn_generarPlanificacion=Generar Planificaci\u00F3n +btn_enviarPlanificacion=Enviar Planificaci\u00F3n +lbl_planificacionAnual=PLANIFICACI\u00D3N ANUAL +lbl_fechaCaducidad=Fecha Caducidad +lbl_estadoPermiso=Estado Permiso +msg_noExistenTramitesAnno=NO EXISTEN TR\u00C1MITES PARA EL A\u00D1O +lbl_editarRegistroInspeccion=EDITAR REGISTRO DE INSPECCI\u00D3N +msg_planificacionNoGenerada=NO SE HA GENERADO LA PLANIFICACI\u00D3N +lbl_aprobacionPlanificacion=APROBACION DE PLANIFICACI\u00D3N +dest_msg_mail_prueba=fpazmino@bupartech.com +lbl_filtrosBusqueda=FILTROS DE B\u00DASQUEDA +lbl_fechaDesaduanizacion=Fecha Desaduanizaci\u00F3n +lbl_datosGenerales=DATOS GENERALES +lbl_detalleMaterial=DETALLE DEL MATERIAL + +##PARAMETROS FIRMA +firma_coordenadallx=10 +firma_coordenadally=200 +firma_coordenadaurx=250 +firma_coordenadaury=1118 + +firma_coordenadallx2=370 +firma_coordenadally2=200 +firma_coordenadaurx2=610 +firma_coordenadaury2=1118 + +firma_mensaje=Por favor presione el bot\u00F3n +firma_mensaje2=Grabar +firma_mensaje3=para guardar el documento +firma_mensaje4=El archivo no est\u00E1 firmado para subir al alfresco +lbl_datosImportacion=DATOS DE IMPORTACI\u00D3N + +##CATALOGO +ctg_autorizacion=AUTORIZACI\u00D3N +ctg_primeravez=PRIMERA VEZ +ctg_renovacion=RENOVACI\u00D3N +ctg_permiso=PERMISO +ctg_certificados=CERTIFICADOS +ctg_perdida=P\u00C9RDIDA +ctg_actualizacionDeDatos=ACTUALIZACIN DE DATOS +ctg_reimpresion_tipo=REIMPRESION +ctg_reimpresion=REIMPRESI\u00D3N +ctg_tipotramite=TIPOTRAMITE +ctg_tipoautorizacion=TIPOAUTORIZACION +ctg_usoactividad=USOACTIVIDAD +ctg_resultado_aprobado=APROBADO +ctg_resultado_codigo=RESULTADO +ctg_tipo_evaluacion_conocimiento=CONOCIMIENTO +ctg_tipo_evaluacion_psicologica=PSICOLOGICA +lbl_test_psicologica=Test Psicol\u00F3gico +ctg_tipo_evaluacion_codigo=TIPOEVALUACION +##MENSAJE INFORMACION +msg_noplanificacion=No PLANIFICACI\u00D3N + +msg_armaDuplicada=EL ART\u00CDCULO QUE INTENTA CREAR YA SE ENCUENTRA REGISTRADO EN EL SISTEMA + +lbl_comprobanteCaja=ComprobanteDeCaja + +msg_error_generarlaplanificacion=GENERAR LA PLANIFICACI\u00D3N +tecnicoAlmacenamiento=T\u00C9CNICO DE ALMACENAMIENTO DEL +jefe=JEFE +msg_existePlanificacionAnno=YA EXISTE UNA PLANIFICACI\u00D3N PARA ESE A\u00D1O +lbl_fichaTecnicaArmas=FichaTecnicaArmas +lbl_registroBalistico=Registro bal\u00EDstico +lbl_dolares=D\u00D3LARES +msg_error_notienedireccionprincipal=NO TIENE DIRECCI\u00D3N PRINCIPAL +msg_error_laprovinciasinccontrol=LA PROVINCIA NO TIENE ASIGNADA UN CENTRO DE CONTROL +msg_error_sinprovincia=NO TIENE ASIGNADO UNA PROVINCIA +msg_error_singenerarreciboregistro=NO SE HA GENERADO UN RECIBO DE REGISTRO PARA EL DECOMISO +msg_error_notienedireccioncorreo=NO TIENE DIRECCI\u00D3N DE CORREO +msg_error_subiroarchivoregistrorecibo=ERROR AL OBTENER EL RECIBO DE REGISTRO DE DECOMISO + +msg_error_liqeco_fechaInicioMayorAFechaActual=SELECCIONE UNA FECHA DE INICIO MENOR A LA FECHA ACTUAL +msg_error_liqeco_fechaDecomisoMayorAFechaActual=SELECCIONE UNA FECHA DE DECOMISO MENOR A LA FECHA ACTUAL +msg_error_liqeco_fechaFinMayorAFechaActual=SELECCIONE UNA FECHA FIN MENOR A LA FECHA ACTUAL +msg_error_liqeco_fechaInicioMayorAFechaFin=LA FECHA DE INICIO SELECCIONADA DEBE SER MAYOR O IGUAL A LA FECHA FIN SELECCIONADA +msg_error_liqeco_fechaInicioMayorAFechaFin1=LA FECHA DE INICIO SELECCIONADA DEBE SER MENOR O IGUAL A LA FECHA FIN SELECCIONADA +msg_error_claveanteriornopuederserigualactual=CLAVE ANTERIOR NO PUEDE SER IGUAL A LA ACTUAL + +msg_error_coninv_fechaMayorAFechaActual=SELECCIONE UNA FECHA MENOR A LA FECHA ACTUAL + +msg_error_elnombredelarchivonocaracteresespeciales=EL NOMBRE DEL ARCHIVO NO PUEDE CONTENER CARACTERES ESPECIALES +msg_error_ingresenumsolicitudexacto=NO SE PUEDE REALIZAR LA CONSULTA CON %, INGRESE EL No. DE SOLICITUD COMPLETO +msg_error_elnombredelarchivonodebeiniciarconnum=EL NOMBRE DEL ARCHIVO NO DEBE INICIAR CON N\u00DAMEROS +msg_error_elnombredelarchivonodebecontenerespaciosenblanco=EL NOMBRE DEL ARCHIVO NO DEBE CONTENER ESPACIOS EN BLANCO +msg_error_elnombredelarchivonodebesermenoracincoletras=EL TAMA\u00D1O DEL NOMBRE DEL ARCHIVO NO DEBE SER MENOR A 5 CARACTERES + +#URL DE LOS SERVICIOS MANEJADOS DESDE LA SNAP +url_snap_servicio_cedula=https://serviciosarmas.ccffaa.mil.ec:8085/serviceCedula?wsdl +url_snap_servicio_ruc=https://serviciosarmas.ccffaa.mil.ec:8085/serviceRUC?wsdl + + +msg_error_nohaseleccionadoarmas=NO HA SELECCIONADO NINGUNA ARMA +msg_inf_digitadordel=COORDINADOR DEL +msg_error_ingrese_funcionario=INGRESE EL FUNCIONARIO + +codigo_estado_arma_busqueda_venta='REG','REN','APTA','DEV','ECO','COLE','PRO' + +msg_error_generar_reporte=ERROR AL GENERAR EL REPORTE + +msg_recuerdeClickContinuarTramite=PARA CONTINUAR SU TR\u00C1MITE\: DEBE DAR CLICK EN EL BOT\u00D3N CONTINUAR TR\u00C1MITE +msg_recuerdeUnicaCargaInventario=RECUERDE QUE EL INVENTARIO PARA UNA CATEGOR\u00CDA SELECCIONADA SOLO PODR\u00C1 SUBIRSE UNA \u00DANICA VEZ +msg_inventarioCargadoPreviamente=EL INVENTARIO PARA LA CATEGOR\u00CDA SELECCIONADA YA FUE CARGADO ANTERIORMENTE +msg_inventarioNoArmasFuegoNiNoLetales=No se permite el ingreso de armas de fuego ni tampoco de armas no letales +msg_reimpresionprevianopermitida=NO SE PUEDE REIMPRIMIR DOCUMENTOS CON FECHA DE EMISI\u00D3N PREVIA AL 15 DE JUNIO DEL 2015 +msg_recuerdeClickSeleccionarArmas=PARA VISUALIZAR LAS ARMAS DEBE DAR CLICK EN EL BOT\u00D3N SELECCIONAR ARMA +msg_recuerdeClickGenerarReciboRegistro=PARA TERMINAR EL REGISTRO\: DEBE DAR CLICK EN EL BOT\u00D3N GENERAR RECIBO REGISTRO PARA OBTENER EL REPORTE DE REGISTRO +msg_recuerdeClickCargarDocActControl=PARA CONTINUAR EL REGISTRO\: DEBE DAR CLICK EN EL BOT\u00D3N SELECCIONAR DE CARGA DOCUMENTO ACTIVIDAD DE CONTROL Y SEGUIDO DAR CLICK EN EL BOT\u00D3N SUBIR +msg_recuerdeClickBtnSave=PARA CONTINUAR EL REGISTRO\: DEBE DAR CLICK EN EL BOT\u00D3N GRABAR +msg_recuerdeClickBtnRegMaterial=PARA CONTINUAR EL REGISTRO\: DEBE DAR CLICK EN EL BOT\u00D3N REGISTRO MATERIAL +msg_recuerdeClickTabRegMaterial=PARA CONTINUAR EL REGISTRO\: DEBE SELECCIONAR MATERIAL EN LA PESTA\u00D1A SELECCIONAR MATERIALES +msg_recuerdeClickGenerarActa=PARA CONTINUAR SU TRAMITE\: DEBE DAR CLICK EN EL BOT\u00D3N GENERAR ACTA + +lbl_desde=Desde +lbl_hasta=Hasta +lbl_ultimaGeneracion=\u00DAltima Generaci\u00F3n + +lbl_aucp=AUCP +lbl_estaDesaduanizado=EST\u00C1 DESADUANIZADO? +msg_error_aucp_previamente_cargado=EL C\u00D3DIGO DE SOLICITUD AUCP YA HA SIDO CARGADO PREVIAMENTE +msg_error_carga_armas_inexistentes=NO EXISTEN ART\u00CDCULOS CREADOS PARA EL PRESENTE REGISTRO +msg_desea_iniciar_desaduanizacion=DESEA INICIAR LA DESADUANIZACI\u00D3N? +msg_desea_recuerde_desaduanizacion1=RECUERDE QUE UNA VEZ INICIADA LA DESADUANIZACI\u00D3N, NO PODR\u00C1 EDITAR +msg_desea_recuerde_desaduanizacion2=ART\u00CDCULOS DESDE LA PANTALLA INGRESO DE IMPORTACI\u00D3N +msg_desea_continuar=DESEA CONTINUAR? + +lbl_partida_arancelaria=Partida Arancelaria +msg_error_paisOrigenRequerido=Pa\u00EDs Origen Requerido +msg_error_provinciaRequerido=Provincia Requerida +msg_error_cantonRequerido=Cant\u00F3n Requerido +msg_error_ciudadRequerido=Ciudad Requerida +msg_error_aeropuertoRequerido=Aeropuerto Requerido +lbl_tipo_planificacion=Periodos de Planificacin +lbl_asignacion_presupuestaria=Asignacin Presupuestria +lbl_tipo_sancion=Tipo Sancin + +lbl_datosOrganismoControl=DATOS ORGANISMO CONTROL +lbl_datosUbicacionDecomiso=DATOS UBICACI\u00D3N ACTIVIDAD DE CONTROL +lbl_datosPortadorEnElDecomiso=DATOS DEL PORTADOR EN ACTIVIDAD DE CONTROL + +lbl_tipoDecomiso=Actividad de Control +lbl_numeroComprobanteRecibo=No. Comprobante/Recibo +lbl_fechaDecomiso=Fecha actividad de control +lbl_sinDocumento=Sin No. Documento +lbl_cargarDocumentoDecomiso=Carga Documento Actividad de Control + + + +#Certificado Fiscalia +lbl_cargarCertificadoFiscalia=Solicitud de Certificado +lbl_fiscalianrosolicitud=No. Solicitud +lbl_fiscalianombresolicitud=Nombre Solicitante +lbl_fiscalianroinstruccionfiscal=No. Expediente Fiscal +lbl_fiscalianfechaActual=Fecha Actual +lbl_fiscalianroficiofiscal=No. Oficio Fiscal\u00EDa +lbl_mensaje_noseencuentrandatosserie=No se encuentras datos, ingrese la serie, para generar el certificado +lbl_mensaje_noseencuentrandatosperson=No se encuentras datos, ingrese la identificaci\u00F3n y/o nombres, para generar el certificado + +# +lbl_organismo_control=Organismo de Control +lbl_centro_control=Centro de Control +lbl_numero_recibo=N\u00FAmero Recibo +lbl_numero_armas_procesadas=N\u00FAmero Armas Procesados +lbl_numero_armas_error=N\u00FAmero de Errores +lbl_numero_armas_correctas=Armas Correctas +lbl_numoficio=No. Oficio \ No newline at end of file diff --git a/frontend/src/main/resources/.svn/text-base/customer_es.properties.svn-base b/frontend/src/main/resources/.svn/text-base/customer_es.properties.svn-base new file mode 100644 index 0000000..170e751 --- /dev/null +++ b/frontend/src/main/resources/.svn/text-base/customer_es.properties.svn-base @@ -0,0 +1,42 @@ +################################################### +##### S\u00edmbolos unicode +#####\u00e1 -> +#####\u00e9 -> +#####\u00ed -> +#####\u00f3 -> +#####\u00fa -> +#####\u00c1 -> +#####\u00c9 -> +#####\u00cd -> +#####\u00d3 -> +#####\u00da -> +#####\u00f1 -> +#####\u00d1 -> +#####\u0020 -> Espacio en blanco +################################################### + +#Cabecera de tablas +htbl_profile=PERFIL +htbl_persons=PERSONAS + +lvh_persons=PERSONAS +lvh_destinos=DESTINOS + + +############Etiquetas +lbl_area=\u00C1rea +lbl_BPMuser=Usuario BPM +lbl_branch=Sucursal +lbl_branchterminal=Terminal de la sucursal +lbl_channel=Canal +lbl_identification=Identificaci\u00F3n +lbl_language=Lenguaje +lbl_office=Oficina +lbl_nickname=Sobrenombre +lbl_person=Persona +lbl_user=Usuario +lbl_usercode=C\u00F3digo de usuario +lbl_personcode=C\u00F3digo de persona +lbl_surname=Apellido +lbl_profession=Profesi\u00f3n +lbl_maritalststus=Estado civil \ No newline at end of file diff --git a/frontend/src/main/resources/.svn/text-base/firmas_es.properties.svn-base b/frontend/src/main/resources/.svn/text-base/firmas_es.properties.svn-base new file mode 100644 index 0000000..5919592 --- /dev/null +++ b/frontend/src/main/resources/.svn/text-base/firmas_es.properties.svn-base @@ -0,0 +1,14 @@ +lbl_codigo=C\u00F3digo +lbl_nombre=Nombre +lbl_cedula=C\u00E9dula +lbl_cargo=Cargo +lbl_unidad=Unidad +lbl_codservidor=Cod. Servidor +lbl_nomservidor=Nombre Servidor +lbl_servidor=Servidor +lbl_certificado=Certificado +lbl_vigencia=Vigencia +lbl_fechaDesde=Fecha Desde +lbl_fechaHasta=Fecha Hasta +lbl_estado=Estado +lbl_acciones=Acciones \ No newline at end of file diff --git a/frontend/src/main/resources/.svn/text-base/general_es.properties.netbeans-base b/frontend/src/main/resources/.svn/text-base/general_es.properties.netbeans-base new file mode 100644 index 0000000..d0bef92 --- /dev/null +++ b/frontend/src/main/resources/.svn/text-base/general_es.properties.netbeans-base @@ -0,0 +1,435 @@ +################################################### +##### S\u00edmbolos unicode +#####\u00e1 -> +#####\u00e9 -> +#####\u00ed -> +#####\u00f3 -> +#####\u00fa -> +#####\u00c1 -> +#####\u00c9 -> +#####\u00cd -> +#####\u00d3 -> +#####\u00da -> +#####\u00f1 -> +#####\u00d1 -> +#####\u0020 -> Espacio en blanco +################################################### + +dateformat=dd-MM-yyyy +lbl_numdocsitios=No. Documento +lbl_descripcionCorta=Descripci\u00F3n corta +datetimeformat=dd-MM-yyyy HH:mm:ss +numberformat= #,##,##0.000000 +time=HH:mm +decimals=2 + +#Controles Editor Prime +#source +lst_controls=bold italic underline strikethrough subscript superscript | font size style | color highlight removeformat | bullets numbering | outdent indent | alignleft center alignright justify | undo redo | rule image link unlink | cut copy paste pastetext | print + +#URL Images +url_blanck=/resources/images/blanck.jpg +url_green=/resources/images/green.jpg +url_red=/resources/images/red.jpg + +#Botones +btn_cancell=Cancelar +btn_controlcambios=Existe cambios pendientes, desea recargar la p\u00E1gina?. (Si) Perder\u00E1 los cambios realizados. +btn_create=Crear +btn_add=Agregar +btn_aceptar=Aceptar +btn_delete= +btn_edit= +btn_show= +btn_query= +btn_next= +btn_previous= +btn_save=Grabar +btn_update=Actualizar +btn_exit=Salir +btn_last=Anterior +btn_signature=Firmar +btn_confirmTask=Est\u00E1 seguro de completar la tarea? +btn_confirmFlow=Est\u00E1 seguro de Continuar el Tr\u00E1mite? +btn_transaction=Transacci\u00F3n (F2) +btn_reload=Recargar (F4) +btn_queryTran=Consultar (F5) +btn_saveTran=Guardar (F10) +btn_helpTran=Ayuda (F1) + +#Cabecera de tablas +htbl_catalog=CAT\u00C1LOGO +htbl_catalogdetail=DETALLE DE CAT\u00C1LOGO +htbl_password=CAMBIO DE CONTRASE\u00D1A +htbl_transaction=TRANSACCI\u00D3N +htbl_parameters=PAR\u00C1METROS +htbl_secutiryPolicies=POL\u00CDTICAS DE SEGURIDAD +htbl_address=DIRECCIONES +htbl_phones=TEL\u00C9FONOS +htbl_terminal=TERMINALES +htbl_profile=PERFIL +htbl_profiles=PERFILES +htbl_daysnotaccounting=D\u00CDAS NO CONTABLES +htbl_accountingdays=D\u00CDAS CONTABLES +htbl_product=PRODUCTOS +htbl_generals=GENERALES +htbl_subproduct=SUBPRODUCTOS +htbl_subproductcurrency=MONEDAS POR SUBPRODUCTO +htbl_messages=MENSAJES +htbl_module=M\u00D3DULOS +htbl_menus=MEN\u00DAS +htbl_balancetype=TIPOS DE SALDO +htbl_balancetypedetail=DETALLE DE TIPOS DE SALDO +htbl_menulevel=NIVEL DE MEN\u00DA +htbl_template=PLANTILLA +htbl_offices=OFICINAS +htbl_branches=SUCURSALES +htbl_compmantenimiento=COMPONENTES DE MANTENIMIENTO +htbl_componentes=COMPONENTES DE NEGOCIO +htbl_economicactivity=ACTIVIDAD ECON\u00D3MICA +htbl_rule=FLUJOS / REGLAS +htbl_message=MENSAJE +htbl_branch=SUCURSAL +htbl_catalogo=CAT\u00C1LOGO +htbl_menusublevel=SUBNIVEL DE MEN\u00DA +htbl_process=PROCESO +htbl_usuario=USUARIO +htbl_server=SERVIDOR +htbl_table=TABLA + +lvh_table=TABLA + +lvh_economicactivity=ACTIVIDAD ECON\u00D3MICA +lvh_balancetype=TIPO DE SALDO +lvh_rule=FLUJOS / REGLAS +lvh_message=MENSAJE +lvh_branch=SUCURSAL +lvh_catalogo=CAT\u00C1LOGO +lvh_menulevel=NIVEL DE MEN\u00DA +lvh_menusublevel=SUBNIVEL DE MEN\u00DA +lvh_process=PROCESO +lvh_profiles=PERFILES +lvh_transaction=TRANSACCI\u00D3N +lvh_usuario=USUARIO +lvh_help=AYUDA + +#TIENE QUE IR EN MAYUSCULAR POR ESTANDAR +lbl_filters=FILTROS DE B\u00DASQUEDA +#TIENE QUE IR EN MAYUSCULAR POR ESTANDAR +lbl_parametersgenerationdates=PAR\u00C1METROS GENERACI\u00D3N FECHAS CONTABLES + + +#Etiquetas +lbl_pendding_changes=MODIFICACIONES PENDIENTES +lbl_acco_date=Fecha contable +lbl_affectimmobilization=Afecta inmobilizaci\u00F3n +lbl_area=\u00C1rea +lbl_autoquery=Consulta autom\u00E1tica +lbl_branch=Sucursal +lbl_initbranch=Sucursal inicial +lbl_endbranch=Sucursal final +lbl_branchamong=Intersucursales +lbl_cache=Cach\u00E9 +lbl_catalogo=Cat\u00E1logo +lbl_channel=Canal +lbl_day=D\u00EDa +lbl_isaccounting=Contabilizar +lbl_isworking=Fecha de trabajo +lbl_executeprocessclass=Clase que ejecuta el proceso +lbl_compania=Compa\u00F1\u00EDa +lbl_completeitem=Completa \u00EDtem +lbl_confirmpassword=Confirmar Contrase\u00F1a +lbl_code=C\u00F3digo +lbl_query_code=C\u00F3digo de consulta +lbl_description=Descripci\u00F3n +lbl_inittdate=Fecha inicial +lbl_enddate=Fecha final +lbl_finishtime=Hora fin +lbl_flow=Flujo +lbl_inbox=Bandeja de entrada +lbl_inittime=Hora inicio +lbl_isflow=Es flujo +lbl_internal=Interna +lbl_language=Lenguaje +lbl_message=Mensaje +lbl_module=M\u00F3dulo +lbl_month=Mes +lbl_name=Nombre +lbl_office=Oficina +lbl_order=Orden +lbl_page=P\u00E1gina +lbl_password=Contrase\u00F1a +lbl_previousPassword=Contrase\u00F1a anterior +lbl_profiles=Perfiles +lbl_process=Proceso +lbl_processname=Nombre de proceso +lbl_processtype=Tipo de proceso +lbl_clase=Clase +lbl_queryagain=Consultar nuevamente +lbl_querycode=C\u00F3digo de consulta +lbl_rule=Regla +lbl_sequence=Secuencia +lbl_shortdescription=Descripci\u00F3n corta +lbl_signature=Firma +lbl_state=Estado +lbl_status=Estatus +lbl_transaction=Transacci\u00F3n +lbl_usuario=Usuario +lbl_person_code=C\u00F3digo de persona +lbl_validateamount=Validar monto +lbl_version=Versi\u00F3n +lbl_working_date=Fecha de trabajo +lbl_text_value=Valor texto +lbl_number_value=Valor num\u00E9rico +lbl_numberdoc=N\u00FAmero Documento +lbl_razonsocial=Nombre/Raz\u00F3n Social +lbl_generarmapa=Generar Mapa +lbl_limpiar=Limpiar +lbl_validitydays=D\u00EDas de validez de la contrase\u00F1a +lbl_messagedays=N\u00FAmero de d\u00EDas para presentar mensajes de advertencia por vencimiento de contrase\u00F1a +lbl_minlength=Longitud m\u00EDnima +lbl_minnotrepeated=N\u00FAmero hist\u00F3rico de contrase\u00F1as no permitidas +lbl_minnumber=N\u00FAmero m\u00EDnimo de d\u00EDgitos +lbl_minspecialcharacters=N\u00FAmero m\u00EDnimo de caracteres especiales +lbl_minuppercase=N\u00FAmero m\u00EDnimo de letras may\u00FAsculas +lbl_minlowercase=N\u00FAmero m\u00EDnimo de letras min\u00FAsculas +lbl_intentnumber=N\u00FAmero de intentos +lbl_identificationtype=Tipo de identificaci\u00F3n +lbl_identification=Identificaci\u00F3n +lbl_firstname=Nombre +lbl_lastname=Apellido +lbl_middlename=Segundo nombre +lbl_surname=Segundo apellido +lbl_gender=G\u00E9nero +lbl_person_height=Estatura +lbl_activitynoteconomic=Actividad no econ\u00F3mica +lbl_activityeconomic=Actividad econ\u00F3mica +lbl_economicsector=Sector econ\u00F3mico +lbl_typeclient=Tipo de cliente +lbl_profesion=Profesi\u00F3n +lbl_estadoCivil=Estado Civil +lbl_segment=Segmento +lbl_descriptionSegment=Descripci\u00F3n segmento +lbl_number=No. +lbl_addresstype=Tipo de direcci\u00F3n +lbl_principal=Principal +lbl_address=Direcci\u00F3n +lbl_phonetype=Tipo tel\u00E9fono +lbl_numaddress=No. direcci\u00F3n +lbl_numphone=No. telef\u00F3nico +lbl_numextension=No. extensi\u00F3n +lbl_country=Pa\u00EDs +lbl_province=Provincia +lbl_canton=Cant\u00F3n +lbl_parroquia=Parroquia +lbl_city=Ciudad +lbl_principalstreet=Calle principal +lbl_numberhome=N\u00FAmero +lbl_numberdept=No. Casa/Depto. +lbl_reference=Referencia +lbl_secondstreet=Calle secundaria +lbl_urbanization=Urbanizaci\u00F3n +lbl_terminal=Terminal +lbl_macaddress=Mac +lbl_ipaddress=Ip +lbl_printer=Impresora +lbl_date=Fecha +lbl_duration=Duraci\u00F3n +lbl_information=Informaci\u00F3n +lbl_value=Valor +lbl_creation=Creaci\u00F3n +lbl_history=Historia +lbl_generatereport=Generar reporte +lbl_messages=Mensajes +lbl_select_option=Seleccione una opci\u00F3n +lbl_action=Acci\u00F3n +lbl_product=Producto +lbl_subproduct=Subproducto +lbl_subproductcurrency=Subproductos por moneda +lbl_initials=Iniciales +lbl_category=Categor\u00EDa +lbl_balancetype=Tipo de saldo +lbl_balancegroup=Grupo de balance +lbl_charges=Cargos +lbl_chargesintable=Cargos por tabla +lbl_menu=Men\u00FA +lbl_loading=Cargando +lbl_currency=Moneda +lbl_currencycharge=Moneda cargo +lbl_minamount=Monto m\u00EDnimo +lbl_maxamount=Monto m\u00E1ximo +lbl_rate=Tasa +lbl_percentage=Porcentaje +lbl_minvalue=Valor m\u00EDnimo +lbl_maxvalue=Valor m\u00E1ximo +lbl_menulevel=Nivel men\u00FA +lbl_menusublevel=Subnivel men\u00FA +lbl_transactionlevel=Transacci\u00F3n por nivel +lbl_transactionsublevel=Transacci\u00F3n por subnivel +lbl_levels=Niveles +lbl_template=Plantilla +lbl_edit=Crear +lbl_createoredit=Crear / Editar +lbl_task=Tarea +lbl_completetask=Completar Tarea +lbl_options=OPCIONES +lbl_profile=Perfil +lbl_phone=Tel\u00E9fono +lbl_group=Grupo +lbl_classname=Clase +lbl_automatic=Autom\u00E1tico +lbl_service=Servicio +lbl_services=SERVICIOS +lbl_folder=Carpeta +lbl_upload=Subir archivos +lbl_descargarsubir=DESCARGAR/SUBIR DOCUMENTOS +lbl_firstnames=Nombres +lbl_lastnames=Apellidos +lbl_documentos=Documentos +lbl_imprimir=Imprimir +lbl_firmadoDoc=Firmar documento +lbl_motivo=Motivo +lbl_confirmTask=CONFIRMAR TAREA +lbl_confirmInitFlow=CONFIRMAR CONTINUAR TR\u00C1MITE +lbl_transaccion_no_existe=Transacci\u00F3n no definida para el perfil seleccionado. +lbl_auxiliar=Auxiliar +lbl_seleccionar=Seleccionar +lbl_subir=Subir +lbl_cancelar=Cancelar +lbl_correo_electronico=Correo Electr\u00F3nico + +#Etuqueta YES/NO +lbl_yes=SI +lbl_no=NO + +#Auditoria +lbl_table=Tabla +lbl_client=Cliente +lbl_filed=Campo +lbl_currentvalue=Valor actual +lbl_previousvalue=Valor anterior +lbl_realDate= Fecha real +lbl_accounting=Cuenta +lbl_insert=Inserci\u00F3n +lbl_delete=Eliminaci\u00F3n + +#Mensajes de validacion +msg_val_email=E-mail no v\u00E1lido + +#Mensajes +msg_catalogrequird=TRANSACCI\u00D3N REQUERIDA +msg_filterrequird=INGRESE UN CRITERIO DE B\u00DASQUEDA +msg_transactionrequird=TRANSACCI\u00D3N REQUERIDA +msg_modulerequird=M\u00D3DULO REQUERIDO +msg_productrequird=PRODUCTO REQUERIDO +msg_subproductrequird=SUBPRODUCTO REQUERIDO +msg_passwordnomatch=CONTRASE\u00D1A NO COINCIDE +msg_passwordrequired=CONTRASE\u00D1A REQUERIDA +msg_querydata=CONSULTE LOS DATOS +msg_querynodata=CONSULTA NO TIENE REGISTROS +msg_requireAddress=DIRECCI\u00D3N REQUERIDA +msg_requirePhones=TEL\u00C9FONO REQUERIDO +msg_requireActivity=ACTIVIDAD ECON\u00D3MICA REQUERIDA +msg_pendingActivation=USUARIO ACTIVO +msg_userrequired=USUARIO REQUERIDO +msg_userNotFound=USUARIO NO ENCONTRADO +msg_userExist=EL USUARIO YA EXISTE +msg_grouprequird=GRUPO REQUERIDO +msg_notUserBpm=NO ES USUARIO BPM +msg_foundRecord=REGISTRO YA INGRESADO +msg_notSave=FORMULARIO NO PERMITE REALIZAR CAMBIOS +msg_notQuery=FORMULARIO NO PERMITE CONSULTA +msg_menucodeRequired=MEN\u00DA REQUERIDO +msg_menulevel=Nivel men\u00FA +msg_menuNotFound=Men\u00FA no encontrado +msg_menuLevelRequired=NIVEL MEN\u00DA REQUERIDO +msg_menusublevel=Subnivel men\u00FA +msg_levelNotFound=Nivel no encontrado +msg_menuSubLevelRequired=SUBNIVEL MEN\u00DA REQUERIDO +msg_messageRequired=MENSAJE REQUERIDO +msg_fileTypeNotFound=Tipo de archivo no encontrado +msg_branchRequired=SUCURSAL REQUERIDA +msg_processrequired=PROCESO REQUERIDO +msg_profilerequird=PERFIL REQUERIDO +msg_validatetimehour=HORA DE FINALIZACI\u00D3N TIENE QUE SER MAYOR A LA HORA DE INICIO +msg_accodate_already_generated=LA FECHA CONTABLE YA HA SIDO GENERADA, VUELVA A RECARGAR +msg_serviceReq=SERVICIO REQUERIDO +#Mensajes alfresco +msg_error_subir_arch=OCURRI\u00D3 UN ERROR AL SUBIR EL ARCHIVO +msg_error_bajar_arch=OCURRI\u00D3 UN ERROR AL DESCARGAR EL ARCHIVO +msg_doc_no_existe=EL DOCUMENTO A BUSCAR NO EXISTE +msg_carp_no_existe=LA CARPETA {0} NO EXISTE +msg_error_consulta_docs=ERROR AL CONSULTAR LOS DOCUMENTOS +msg_invalid_file_ext=EXTENSI\u00D3N DE ARCHIVO NO PERMITIDA +msg_invalid_file_limit=LIMITE DE ARCHIVOS SUBIDOS SUPERADO +msg_location_req=SE REQUIERE LA UBICACI\u00D3N DEL ARCHIVO +msg_arch_subido_success=ARCHIVO(S) SUBIDO(S) EXITOSAMENTE +#mensajes Viaticos +msg_status_notFound=ESTADO NO ENCONTRADO +msg_funcionarioReq=FUNCIONARIO REQUERIDO +msg_fecViaticosReq=FECHAS DE VI\u00C1TICOS REQUERIDOS +msg_destinoReq=DESTINO REQUERIDO +msg_ejercicioFiscal=NO SE OBTUVO LA FECHA +msg_parametroReq=PAR\u00C1METRO REQUERIDO +msg_superaDias=SUPERA LOS 60 D\u00CDAS +msg_transporteReq=TRANSPORTE REQUERIDO +msg_codSolicitudReq=C\u00D3DIGO DE SOLICITUD REQUERIDO +msg_rubroRequerido=SE REQUERIERE AL MENOS UN RUBRO PARA LA COMISI\u00D3N +msg_fechasComReq=SE REQUIERE FECHA/HORA DE SALIDA Y LLEGADA DE LA COMISI\u00D3N +msg_solicitudReq=DEBE REGISTRAR UNA SOLICITUD +msg_ingresoTransporte=INGRESAR AL MENOS DOS REGISTROS DE TRANSPORTE +msg_codSolicitud=C\u00D3DIGO DE SOLICITUD +msg_solicitudNoRegistrada=NO SE HA REGISTRADO UNA SOLICITUD +msg_noPermiteRegistros=NO PERMITIDO EL INGRESO DE M\u00C1S REGISTROS +msg_fechaSalida=FECHA DE LLEGADA MENOR A LA FECHA DE SALIDA +msg_horaSalidaTra=HORA DE SALIDA MENOR A LA HORA DE INICIO DEL VI\u00C1TICO +msg_horaLlegasaTra=HORA LLEGADA MENOR A LA HORA DE INICIO DEL VI\u00C1TICO +msg_horaInicioTran=HORA DE SALIDA MAYOR A LA HORA DE FIN DEL VI\u00C1TICO +msg_horaFinTran=HORA DE LLEGADA MAYOR A LA HORA DE FIN DEL VI\u00C1TICO +msg_funcionarioIng=FUNCIONARIO YA INGRESADO +msg_codigoInfoReq=C\u00D3DIGO REQUERIDO +msg_fechaTransInvalid=LA HORA DE SALIDA DEL TRANSPORTE DEBE SER MAYOR A LA HORA DE LLEGADA +msg_horaTransInvalid=LA HORA DE SALIDA DE LA SOLICITUD DEBE SER MAYOR A LA HORA DE LLEGADA +msg_solicitudeNotSave=FLUJO DE TRABAJO INICIADO: SOLICITUD NO PERMITE REALIZAR CAMBIOS +msg_solicitudAnulada=SOLICITUD ANULADA +msg_solicitudRequerida=SOLICITUD REQUERIDA +msg_firmaExistente=EL DOCUMENTO YA HA SIDO FIRMADO +msg_firmaNecesaria=ES NECESARIO FIRMAR EL DOCUMENTO +msg_sinFirma=EL DOCUMENTO NO DEBE SER FIRMADO +msg_comprobantesreq=COMPROBANTES REQUERIDOS +msg_solicitudeNotSign=LA SOLICITUD NO FUE CREADA CON FIRMA ELECTR\u00D3NICA +msg_solicitudeSign=LA SOLICITUD FUE CREADA CON FIRMA ELECTR\u00D3NICA +msg_informNotSign=EL INFORME NO FUE CREADO CON FIRMA ELECTR\u00D3NICA +msg_informSign=EL INFORME FUE CREADO CON FIRMA ELECTR\u00D3NICA +msg_certificateNotParam=CERTIFICADO NO PARAMETRIZADO PARA EL USUARIO ACTUAL +msg_initFlow=FLUJO INICIADO +msg_fechaFueraRango=FECHA DE TRANSPORTE FUERA DEL PER\u00CDODO DEL VI\u00C1TICO +msg_idTaskRequired=ID DE LA TAREA REQUERIDO + +#Tab +tab_bycode=POR C\u00D3DIGO +tab_transactionprocess=PROCESO TRANSACCI\u00D3N +tab_generals=GENERALES +tab_address=DIRECCIONES +tab_telephones=TEL\u00C9FONOS +tab_menu=MEN\u00DA +tab_agenda=AGENDA +tab_my_tasks=MIS TAREAS +tab_groups=GRUPOS +tab_product=PRODUCTO +tab_subproduct=SUBPRODUCTO +tab_subproductcurr=SUBPRODUCTOS POR MONEDA +tab_menulavels=NIVELES DE MEN\u00DA +tab_menusublavels=SUBNIVEL MEN\u00DA +tab_transactionlavel=TRANSACCIONES POR NIVEL +tab_transactionsublevel=TRANSACCIONES POR SUBNIVEL +tab_charges=CARGOS GENERALES +tab_subproductcharges=CARGOS POR SUBPRODUCTO +tab_offices=OFICINAS +tab_branches=SUCURSALES +tab_new_delete=NUEVOS/ELIMINADOS +tab_updates=ACTUALIZADOS + +#Expresiones regulares +regExp_email=^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,3})$ +lbl_digitalSign=Firma digital\: diff --git a/frontend/src/main/resources/.svn/text-base/general_es.properties.svn-base b/frontend/src/main/resources/.svn/text-base/general_es.properties.svn-base new file mode 100644 index 0000000..d0bef92 --- /dev/null +++ b/frontend/src/main/resources/.svn/text-base/general_es.properties.svn-base @@ -0,0 +1,435 @@ +################################################### +##### S\u00edmbolos unicode +#####\u00e1 -> +#####\u00e9 -> +#####\u00ed -> +#####\u00f3 -> +#####\u00fa -> +#####\u00c1 -> +#####\u00c9 -> +#####\u00cd -> +#####\u00d3 -> +#####\u00da -> +#####\u00f1 -> +#####\u00d1 -> +#####\u0020 -> Espacio en blanco +################################################### + +dateformat=dd-MM-yyyy +lbl_numdocsitios=No. Documento +lbl_descripcionCorta=Descripci\u00F3n corta +datetimeformat=dd-MM-yyyy HH:mm:ss +numberformat= #,##,##0.000000 +time=HH:mm +decimals=2 + +#Controles Editor Prime +#source +lst_controls=bold italic underline strikethrough subscript superscript | font size style | color highlight removeformat | bullets numbering | outdent indent | alignleft center alignright justify | undo redo | rule image link unlink | cut copy paste pastetext | print + +#URL Images +url_blanck=/resources/images/blanck.jpg +url_green=/resources/images/green.jpg +url_red=/resources/images/red.jpg + +#Botones +btn_cancell=Cancelar +btn_controlcambios=Existe cambios pendientes, desea recargar la p\u00E1gina?. (Si) Perder\u00E1 los cambios realizados. +btn_create=Crear +btn_add=Agregar +btn_aceptar=Aceptar +btn_delete= +btn_edit= +btn_show= +btn_query= +btn_next= +btn_previous= +btn_save=Grabar +btn_update=Actualizar +btn_exit=Salir +btn_last=Anterior +btn_signature=Firmar +btn_confirmTask=Est\u00E1 seguro de completar la tarea? +btn_confirmFlow=Est\u00E1 seguro de Continuar el Tr\u00E1mite? +btn_transaction=Transacci\u00F3n (F2) +btn_reload=Recargar (F4) +btn_queryTran=Consultar (F5) +btn_saveTran=Guardar (F10) +btn_helpTran=Ayuda (F1) + +#Cabecera de tablas +htbl_catalog=CAT\u00C1LOGO +htbl_catalogdetail=DETALLE DE CAT\u00C1LOGO +htbl_password=CAMBIO DE CONTRASE\u00D1A +htbl_transaction=TRANSACCI\u00D3N +htbl_parameters=PAR\u00C1METROS +htbl_secutiryPolicies=POL\u00CDTICAS DE SEGURIDAD +htbl_address=DIRECCIONES +htbl_phones=TEL\u00C9FONOS +htbl_terminal=TERMINALES +htbl_profile=PERFIL +htbl_profiles=PERFILES +htbl_daysnotaccounting=D\u00CDAS NO CONTABLES +htbl_accountingdays=D\u00CDAS CONTABLES +htbl_product=PRODUCTOS +htbl_generals=GENERALES +htbl_subproduct=SUBPRODUCTOS +htbl_subproductcurrency=MONEDAS POR SUBPRODUCTO +htbl_messages=MENSAJES +htbl_module=M\u00D3DULOS +htbl_menus=MEN\u00DAS +htbl_balancetype=TIPOS DE SALDO +htbl_balancetypedetail=DETALLE DE TIPOS DE SALDO +htbl_menulevel=NIVEL DE MEN\u00DA +htbl_template=PLANTILLA +htbl_offices=OFICINAS +htbl_branches=SUCURSALES +htbl_compmantenimiento=COMPONENTES DE MANTENIMIENTO +htbl_componentes=COMPONENTES DE NEGOCIO +htbl_economicactivity=ACTIVIDAD ECON\u00D3MICA +htbl_rule=FLUJOS / REGLAS +htbl_message=MENSAJE +htbl_branch=SUCURSAL +htbl_catalogo=CAT\u00C1LOGO +htbl_menusublevel=SUBNIVEL DE MEN\u00DA +htbl_process=PROCESO +htbl_usuario=USUARIO +htbl_server=SERVIDOR +htbl_table=TABLA + +lvh_table=TABLA + +lvh_economicactivity=ACTIVIDAD ECON\u00D3MICA +lvh_balancetype=TIPO DE SALDO +lvh_rule=FLUJOS / REGLAS +lvh_message=MENSAJE +lvh_branch=SUCURSAL +lvh_catalogo=CAT\u00C1LOGO +lvh_menulevel=NIVEL DE MEN\u00DA +lvh_menusublevel=SUBNIVEL DE MEN\u00DA +lvh_process=PROCESO +lvh_profiles=PERFILES +lvh_transaction=TRANSACCI\u00D3N +lvh_usuario=USUARIO +lvh_help=AYUDA + +#TIENE QUE IR EN MAYUSCULAR POR ESTANDAR +lbl_filters=FILTROS DE B\u00DASQUEDA +#TIENE QUE IR EN MAYUSCULAR POR ESTANDAR +lbl_parametersgenerationdates=PAR\u00C1METROS GENERACI\u00D3N FECHAS CONTABLES + + +#Etiquetas +lbl_pendding_changes=MODIFICACIONES PENDIENTES +lbl_acco_date=Fecha contable +lbl_affectimmobilization=Afecta inmobilizaci\u00F3n +lbl_area=\u00C1rea +lbl_autoquery=Consulta autom\u00E1tica +lbl_branch=Sucursal +lbl_initbranch=Sucursal inicial +lbl_endbranch=Sucursal final +lbl_branchamong=Intersucursales +lbl_cache=Cach\u00E9 +lbl_catalogo=Cat\u00E1logo +lbl_channel=Canal +lbl_day=D\u00EDa +lbl_isaccounting=Contabilizar +lbl_isworking=Fecha de trabajo +lbl_executeprocessclass=Clase que ejecuta el proceso +lbl_compania=Compa\u00F1\u00EDa +lbl_completeitem=Completa \u00EDtem +lbl_confirmpassword=Confirmar Contrase\u00F1a +lbl_code=C\u00F3digo +lbl_query_code=C\u00F3digo de consulta +lbl_description=Descripci\u00F3n +lbl_inittdate=Fecha inicial +lbl_enddate=Fecha final +lbl_finishtime=Hora fin +lbl_flow=Flujo +lbl_inbox=Bandeja de entrada +lbl_inittime=Hora inicio +lbl_isflow=Es flujo +lbl_internal=Interna +lbl_language=Lenguaje +lbl_message=Mensaje +lbl_module=M\u00F3dulo +lbl_month=Mes +lbl_name=Nombre +lbl_office=Oficina +lbl_order=Orden +lbl_page=P\u00E1gina +lbl_password=Contrase\u00F1a +lbl_previousPassword=Contrase\u00F1a anterior +lbl_profiles=Perfiles +lbl_process=Proceso +lbl_processname=Nombre de proceso +lbl_processtype=Tipo de proceso +lbl_clase=Clase +lbl_queryagain=Consultar nuevamente +lbl_querycode=C\u00F3digo de consulta +lbl_rule=Regla +lbl_sequence=Secuencia +lbl_shortdescription=Descripci\u00F3n corta +lbl_signature=Firma +lbl_state=Estado +lbl_status=Estatus +lbl_transaction=Transacci\u00F3n +lbl_usuario=Usuario +lbl_person_code=C\u00F3digo de persona +lbl_validateamount=Validar monto +lbl_version=Versi\u00F3n +lbl_working_date=Fecha de trabajo +lbl_text_value=Valor texto +lbl_number_value=Valor num\u00E9rico +lbl_numberdoc=N\u00FAmero Documento +lbl_razonsocial=Nombre/Raz\u00F3n Social +lbl_generarmapa=Generar Mapa +lbl_limpiar=Limpiar +lbl_validitydays=D\u00EDas de validez de la contrase\u00F1a +lbl_messagedays=N\u00FAmero de d\u00EDas para presentar mensajes de advertencia por vencimiento de contrase\u00F1a +lbl_minlength=Longitud m\u00EDnima +lbl_minnotrepeated=N\u00FAmero hist\u00F3rico de contrase\u00F1as no permitidas +lbl_minnumber=N\u00FAmero m\u00EDnimo de d\u00EDgitos +lbl_minspecialcharacters=N\u00FAmero m\u00EDnimo de caracteres especiales +lbl_minuppercase=N\u00FAmero m\u00EDnimo de letras may\u00FAsculas +lbl_minlowercase=N\u00FAmero m\u00EDnimo de letras min\u00FAsculas +lbl_intentnumber=N\u00FAmero de intentos +lbl_identificationtype=Tipo de identificaci\u00F3n +lbl_identification=Identificaci\u00F3n +lbl_firstname=Nombre +lbl_lastname=Apellido +lbl_middlename=Segundo nombre +lbl_surname=Segundo apellido +lbl_gender=G\u00E9nero +lbl_person_height=Estatura +lbl_activitynoteconomic=Actividad no econ\u00F3mica +lbl_activityeconomic=Actividad econ\u00F3mica +lbl_economicsector=Sector econ\u00F3mico +lbl_typeclient=Tipo de cliente +lbl_profesion=Profesi\u00F3n +lbl_estadoCivil=Estado Civil +lbl_segment=Segmento +lbl_descriptionSegment=Descripci\u00F3n segmento +lbl_number=No. +lbl_addresstype=Tipo de direcci\u00F3n +lbl_principal=Principal +lbl_address=Direcci\u00F3n +lbl_phonetype=Tipo tel\u00E9fono +lbl_numaddress=No. direcci\u00F3n +lbl_numphone=No. telef\u00F3nico +lbl_numextension=No. extensi\u00F3n +lbl_country=Pa\u00EDs +lbl_province=Provincia +lbl_canton=Cant\u00F3n +lbl_parroquia=Parroquia +lbl_city=Ciudad +lbl_principalstreet=Calle principal +lbl_numberhome=N\u00FAmero +lbl_numberdept=No. Casa/Depto. +lbl_reference=Referencia +lbl_secondstreet=Calle secundaria +lbl_urbanization=Urbanizaci\u00F3n +lbl_terminal=Terminal +lbl_macaddress=Mac +lbl_ipaddress=Ip +lbl_printer=Impresora +lbl_date=Fecha +lbl_duration=Duraci\u00F3n +lbl_information=Informaci\u00F3n +lbl_value=Valor +lbl_creation=Creaci\u00F3n +lbl_history=Historia +lbl_generatereport=Generar reporte +lbl_messages=Mensajes +lbl_select_option=Seleccione una opci\u00F3n +lbl_action=Acci\u00F3n +lbl_product=Producto +lbl_subproduct=Subproducto +lbl_subproductcurrency=Subproductos por moneda +lbl_initials=Iniciales +lbl_category=Categor\u00EDa +lbl_balancetype=Tipo de saldo +lbl_balancegroup=Grupo de balance +lbl_charges=Cargos +lbl_chargesintable=Cargos por tabla +lbl_menu=Men\u00FA +lbl_loading=Cargando +lbl_currency=Moneda +lbl_currencycharge=Moneda cargo +lbl_minamount=Monto m\u00EDnimo +lbl_maxamount=Monto m\u00E1ximo +lbl_rate=Tasa +lbl_percentage=Porcentaje +lbl_minvalue=Valor m\u00EDnimo +lbl_maxvalue=Valor m\u00E1ximo +lbl_menulevel=Nivel men\u00FA +lbl_menusublevel=Subnivel men\u00FA +lbl_transactionlevel=Transacci\u00F3n por nivel +lbl_transactionsublevel=Transacci\u00F3n por subnivel +lbl_levels=Niveles +lbl_template=Plantilla +lbl_edit=Crear +lbl_createoredit=Crear / Editar +lbl_task=Tarea +lbl_completetask=Completar Tarea +lbl_options=OPCIONES +lbl_profile=Perfil +lbl_phone=Tel\u00E9fono +lbl_group=Grupo +lbl_classname=Clase +lbl_automatic=Autom\u00E1tico +lbl_service=Servicio +lbl_services=SERVICIOS +lbl_folder=Carpeta +lbl_upload=Subir archivos +lbl_descargarsubir=DESCARGAR/SUBIR DOCUMENTOS +lbl_firstnames=Nombres +lbl_lastnames=Apellidos +lbl_documentos=Documentos +lbl_imprimir=Imprimir +lbl_firmadoDoc=Firmar documento +lbl_motivo=Motivo +lbl_confirmTask=CONFIRMAR TAREA +lbl_confirmInitFlow=CONFIRMAR CONTINUAR TR\u00C1MITE +lbl_transaccion_no_existe=Transacci\u00F3n no definida para el perfil seleccionado. +lbl_auxiliar=Auxiliar +lbl_seleccionar=Seleccionar +lbl_subir=Subir +lbl_cancelar=Cancelar +lbl_correo_electronico=Correo Electr\u00F3nico + +#Etuqueta YES/NO +lbl_yes=SI +lbl_no=NO + +#Auditoria +lbl_table=Tabla +lbl_client=Cliente +lbl_filed=Campo +lbl_currentvalue=Valor actual +lbl_previousvalue=Valor anterior +lbl_realDate= Fecha real +lbl_accounting=Cuenta +lbl_insert=Inserci\u00F3n +lbl_delete=Eliminaci\u00F3n + +#Mensajes de validacion +msg_val_email=E-mail no v\u00E1lido + +#Mensajes +msg_catalogrequird=TRANSACCI\u00D3N REQUERIDA +msg_filterrequird=INGRESE UN CRITERIO DE B\u00DASQUEDA +msg_transactionrequird=TRANSACCI\u00D3N REQUERIDA +msg_modulerequird=M\u00D3DULO REQUERIDO +msg_productrequird=PRODUCTO REQUERIDO +msg_subproductrequird=SUBPRODUCTO REQUERIDO +msg_passwordnomatch=CONTRASE\u00D1A NO COINCIDE +msg_passwordrequired=CONTRASE\u00D1A REQUERIDA +msg_querydata=CONSULTE LOS DATOS +msg_querynodata=CONSULTA NO TIENE REGISTROS +msg_requireAddress=DIRECCI\u00D3N REQUERIDA +msg_requirePhones=TEL\u00C9FONO REQUERIDO +msg_requireActivity=ACTIVIDAD ECON\u00D3MICA REQUERIDA +msg_pendingActivation=USUARIO ACTIVO +msg_userrequired=USUARIO REQUERIDO +msg_userNotFound=USUARIO NO ENCONTRADO +msg_userExist=EL USUARIO YA EXISTE +msg_grouprequird=GRUPO REQUERIDO +msg_notUserBpm=NO ES USUARIO BPM +msg_foundRecord=REGISTRO YA INGRESADO +msg_notSave=FORMULARIO NO PERMITE REALIZAR CAMBIOS +msg_notQuery=FORMULARIO NO PERMITE CONSULTA +msg_menucodeRequired=MEN\u00DA REQUERIDO +msg_menulevel=Nivel men\u00FA +msg_menuNotFound=Men\u00FA no encontrado +msg_menuLevelRequired=NIVEL MEN\u00DA REQUERIDO +msg_menusublevel=Subnivel men\u00FA +msg_levelNotFound=Nivel no encontrado +msg_menuSubLevelRequired=SUBNIVEL MEN\u00DA REQUERIDO +msg_messageRequired=MENSAJE REQUERIDO +msg_fileTypeNotFound=Tipo de archivo no encontrado +msg_branchRequired=SUCURSAL REQUERIDA +msg_processrequired=PROCESO REQUERIDO +msg_profilerequird=PERFIL REQUERIDO +msg_validatetimehour=HORA DE FINALIZACI\u00D3N TIENE QUE SER MAYOR A LA HORA DE INICIO +msg_accodate_already_generated=LA FECHA CONTABLE YA HA SIDO GENERADA, VUELVA A RECARGAR +msg_serviceReq=SERVICIO REQUERIDO +#Mensajes alfresco +msg_error_subir_arch=OCURRI\u00D3 UN ERROR AL SUBIR EL ARCHIVO +msg_error_bajar_arch=OCURRI\u00D3 UN ERROR AL DESCARGAR EL ARCHIVO +msg_doc_no_existe=EL DOCUMENTO A BUSCAR NO EXISTE +msg_carp_no_existe=LA CARPETA {0} NO EXISTE +msg_error_consulta_docs=ERROR AL CONSULTAR LOS DOCUMENTOS +msg_invalid_file_ext=EXTENSI\u00D3N DE ARCHIVO NO PERMITIDA +msg_invalid_file_limit=LIMITE DE ARCHIVOS SUBIDOS SUPERADO +msg_location_req=SE REQUIERE LA UBICACI\u00D3N DEL ARCHIVO +msg_arch_subido_success=ARCHIVO(S) SUBIDO(S) EXITOSAMENTE +#mensajes Viaticos +msg_status_notFound=ESTADO NO ENCONTRADO +msg_funcionarioReq=FUNCIONARIO REQUERIDO +msg_fecViaticosReq=FECHAS DE VI\u00C1TICOS REQUERIDOS +msg_destinoReq=DESTINO REQUERIDO +msg_ejercicioFiscal=NO SE OBTUVO LA FECHA +msg_parametroReq=PAR\u00C1METRO REQUERIDO +msg_superaDias=SUPERA LOS 60 D\u00CDAS +msg_transporteReq=TRANSPORTE REQUERIDO +msg_codSolicitudReq=C\u00D3DIGO DE SOLICITUD REQUERIDO +msg_rubroRequerido=SE REQUERIERE AL MENOS UN RUBRO PARA LA COMISI\u00D3N +msg_fechasComReq=SE REQUIERE FECHA/HORA DE SALIDA Y LLEGADA DE LA COMISI\u00D3N +msg_solicitudReq=DEBE REGISTRAR UNA SOLICITUD +msg_ingresoTransporte=INGRESAR AL MENOS DOS REGISTROS DE TRANSPORTE +msg_codSolicitud=C\u00D3DIGO DE SOLICITUD +msg_solicitudNoRegistrada=NO SE HA REGISTRADO UNA SOLICITUD +msg_noPermiteRegistros=NO PERMITIDO EL INGRESO DE M\u00C1S REGISTROS +msg_fechaSalida=FECHA DE LLEGADA MENOR A LA FECHA DE SALIDA +msg_horaSalidaTra=HORA DE SALIDA MENOR A LA HORA DE INICIO DEL VI\u00C1TICO +msg_horaLlegasaTra=HORA LLEGADA MENOR A LA HORA DE INICIO DEL VI\u00C1TICO +msg_horaInicioTran=HORA DE SALIDA MAYOR A LA HORA DE FIN DEL VI\u00C1TICO +msg_horaFinTran=HORA DE LLEGADA MAYOR A LA HORA DE FIN DEL VI\u00C1TICO +msg_funcionarioIng=FUNCIONARIO YA INGRESADO +msg_codigoInfoReq=C\u00D3DIGO REQUERIDO +msg_fechaTransInvalid=LA HORA DE SALIDA DEL TRANSPORTE DEBE SER MAYOR A LA HORA DE LLEGADA +msg_horaTransInvalid=LA HORA DE SALIDA DE LA SOLICITUD DEBE SER MAYOR A LA HORA DE LLEGADA +msg_solicitudeNotSave=FLUJO DE TRABAJO INICIADO: SOLICITUD NO PERMITE REALIZAR CAMBIOS +msg_solicitudAnulada=SOLICITUD ANULADA +msg_solicitudRequerida=SOLICITUD REQUERIDA +msg_firmaExistente=EL DOCUMENTO YA HA SIDO FIRMADO +msg_firmaNecesaria=ES NECESARIO FIRMAR EL DOCUMENTO +msg_sinFirma=EL DOCUMENTO NO DEBE SER FIRMADO +msg_comprobantesreq=COMPROBANTES REQUERIDOS +msg_solicitudeNotSign=LA SOLICITUD NO FUE CREADA CON FIRMA ELECTR\u00D3NICA +msg_solicitudeSign=LA SOLICITUD FUE CREADA CON FIRMA ELECTR\u00D3NICA +msg_informNotSign=EL INFORME NO FUE CREADO CON FIRMA ELECTR\u00D3NICA +msg_informSign=EL INFORME FUE CREADO CON FIRMA ELECTR\u00D3NICA +msg_certificateNotParam=CERTIFICADO NO PARAMETRIZADO PARA EL USUARIO ACTUAL +msg_initFlow=FLUJO INICIADO +msg_fechaFueraRango=FECHA DE TRANSPORTE FUERA DEL PER\u00CDODO DEL VI\u00C1TICO +msg_idTaskRequired=ID DE LA TAREA REQUERIDO + +#Tab +tab_bycode=POR C\u00D3DIGO +tab_transactionprocess=PROCESO TRANSACCI\u00D3N +tab_generals=GENERALES +tab_address=DIRECCIONES +tab_telephones=TEL\u00C9FONOS +tab_menu=MEN\u00DA +tab_agenda=AGENDA +tab_my_tasks=MIS TAREAS +tab_groups=GRUPOS +tab_product=PRODUCTO +tab_subproduct=SUBPRODUCTO +tab_subproductcurr=SUBPRODUCTOS POR MONEDA +tab_menulavels=NIVELES DE MEN\u00DA +tab_menusublavels=SUBNIVEL MEN\u00DA +tab_transactionlavel=TRANSACCIONES POR NIVEL +tab_transactionsublevel=TRANSACCIONES POR SUBNIVEL +tab_charges=CARGOS GENERALES +tab_subproductcharges=CARGOS POR SUBPRODUCTO +tab_offices=OFICINAS +tab_branches=SUCURSALES +tab_new_delete=NUEVOS/ELIMINADOS +tab_updates=ACTUALIZADOS + +#Expresiones regulares +regExp_email=^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,3})$ +lbl_digitalSign=Firma digital\: diff --git a/frontend/src/main/resources/.svn/text-base/jasper.properties.netbeans-base b/frontend/src/main/resources/.svn/text-base/jasper.properties.netbeans-base new file mode 100644 index 0000000..11491cb --- /dev/null +++ b/frontend/src/main/resources/.svn/text-base/jasper.properties.netbeans-base @@ -0,0 +1,10 @@ +#http://172.17.26.185:8084/jasperserver/flow.html?_flowId=searchFlow&lastMode=true +#http\://172.17.26.185\:8084/jasperserver/services/repository +#produccion +#jasperserver.repository=http\://172.17.26.182\:8081/jasperserver/services/repository +#jasperserver.reportScheduler=http\://172.17.26.182\:8081/jasperserver/services/ReportScheduler +#desarrollo +jasperserver.repository=http\://172.17.26.185\:8084/jasperserver/services/repository +jasperserver.reportScheduler=http\://172.17.26.185\:8084/jasperserver/services/ReportScheduler +jasperserver.user=jasperadmin +jasperserver.password=jasperadmin \ No newline at end of file diff --git a/frontend/src/main/resources/.svn/text-base/jasper.properties.svn-base b/frontend/src/main/resources/.svn/text-base/jasper.properties.svn-base new file mode 100644 index 0000000..11491cb --- /dev/null +++ b/frontend/src/main/resources/.svn/text-base/jasper.properties.svn-base @@ -0,0 +1,10 @@ +#http://172.17.26.185:8084/jasperserver/flow.html?_flowId=searchFlow&lastMode=true +#http\://172.17.26.185\:8084/jasperserver/services/repository +#produccion +#jasperserver.repository=http\://172.17.26.182\:8081/jasperserver/services/repository +#jasperserver.reportScheduler=http\://172.17.26.182\:8081/jasperserver/services/ReportScheduler +#desarrollo +jasperserver.repository=http\://172.17.26.185\:8084/jasperserver/services/repository +jasperserver.reportScheduler=http\://172.17.26.185\:8084/jasperserver/services/ReportScheduler +jasperserver.user=jasperadmin +jasperserver.password=jasperadmin \ No newline at end of file diff --git a/frontend/src/main/resources/.svn/text-base/pentaho.properties.svn-base b/frontend/src/main/resources/.svn/text-base/pentaho.properties.svn-base new file mode 100644 index 0000000..4e06123 --- /dev/null +++ b/frontend/src/main/resources/.svn/text-base/pentaho.properties.svn-base @@ -0,0 +1,10 @@ +#Credenciales BI-SERVER PENTAHO +url_pentaho=http\://10.1.30.104\:8080/pentaho/ViewAction?solution\=samples&path\=VIA&action\= +usr_pentaho= +pass_pentaho= +pentaho_authenticate=N + +#url_pentaho=http\://10.103.0.64\:8090/pentaho/ViewAction?solution\=TEST&path\=VIA&action\= +#usr_pentaho=admin +#pass_pentaho=BptAdmin2013 +#pentaho_authenticate=Y diff --git a/frontend/src/main/resources/.svn/text-base/security_es.properties.svn-base b/frontend/src/main/resources/.svn/text-base/security_es.properties.svn-base new file mode 100644 index 0000000..0c75086 --- /dev/null +++ b/frontend/src/main/resources/.svn/text-base/security_es.properties.svn-base @@ -0,0 +1,31 @@ +################################################### +##### S\u00edmbolos unicode +#####\u00e1 -> +#####\u00e9 -> +#####\u00ed -> +#####\u00f3 -> +#####\u00fa -> +#####\u00c1 -> +#####\u00c9 -> +#####\u00cd -> +#####\u00d3 -> +#####\u00da -> +#####\u00f1 -> +#####\u00d1 -> +#####\u0020 -> Espacio en blanco +################################################### + +company=Compa\u00F1\u00EDa + +opcion=Opci\u00F3n +password=Password +profile=PERFIL + +select_company=Seleccione compa\u00F1\u00EDa +user=Usuario +lbl_change_password=Cambio Personal Password + + +lbl_heleido_terminos=He le\u00eddo y acepto los t\u00e9rminos y condiciones de uso +lbl_descarga_terminos=Descargue sus trminos y condiciones +lbl_aceptar_terminos=Aceptar trminos y condiciones \ No newline at end of file diff --git a/frontend/src/main/resources/.svn/text-base/validation_es.properties.svn-base b/frontend/src/main/resources/.svn/text-base/validation_es.properties.svn-base new file mode 100644 index 0000000..6118bbf --- /dev/null +++ b/frontend/src/main/resources/.svn/text-base/validation_es.properties.svn-base @@ -0,0 +1,64 @@ +################################################### +##### S\u00edmbolos unicode +#####\u00e1 -> +#####\u00e9 -> +#####\u00ed -> +#####\u00f3 -> +#####\u00fa -> +#####\u00c1 -> +#####\u00c9 -> +#####\u00cd -> +#####\u00d3 -> +#####\u00da -> +#####\u00f1 -> +#####\u00d1 -> +#####\u0020 -> Espacio en blanco +################################################### + +# Archivo de propiedades de mensajepara las validaciones de jsf + +javax.faces.component.UIInput.REQUIRED = Valor obligatorio. +javax.faces.component.UIInput.REQUIRED_detail = Valor obligatorio. + +javax.faces.converter.BigDecimalConverter.DECIMAL=''{0}'' Debe ser un nmero decimal. +javax.faces.converter.BigDecimalConverter.DECIMAL_detail= El campo solo acepta n\u00FAmeros decimales. Ejemplo\: {1} +javax.faces.converter.BigIntegerConverter.BIGINTEGER=''{0}'' Entero de uno o mu00e1s d\u00EDgitos. +javax.faces.converter.BigIntegerConverter.BIGINTEGER_detail=''{0}'' Entero de uno o m\u00E1s d\u00EDgitos. +javax.faces.converter.BooleanConverter.BOOLEAN=''{0}'' Solo acepta 'Verdadero' o 'Falso'. +javax.faces.converter.BooleanConverter.BOOLEAN_detail=''{0}'' Solo acepta 'Verdadero' o 'Falso'. +javax.faces.converter.ByteConverter.BYTE=''{0}'' Debe se un n\u00FAmero entre 0 y 255. +javax.faces.converter.ByteConverter.BYTE_detail=''{0}'' Debe ser un n\u00FAmero entre 0 y 255. +javax.faces.converter.CharacterConverter.CHARACTER=''{0}'' Debe ser un car\u00E1cter v\u00E1lido. +javax.faces.converter.CharacterConverter.CHARACTER_detail=''{0}'' Debe ser un car\u00E1cter ASCII v\u00E1lido. +javax.faces.converter.DateTimeConverter.DATE=''{0}'' Formato de fecha incorrecto. Ejemplo: {1} +javax.faces.converter.DateTimeConverter.DATE_detail=''{0}'' Formato de fecha incorrecto. Ejemplo: {1} +javax.faces.converter.DateTimeConverter.TIME=''{0}'' Formato de hora incorrecto. +javax.faces.converter.DateTimeConverter.TIME_detail=''{0}'' Formato de hora incorrecto. Ejemplo: {1} +javax.faces.converter.DateTimeConverter.DATETIME=''{0}'' Formato de fecha u hora incorrecto. +javax.faces.converter.DateTimeConverter.DATETIME_detail=''{0}'' Formato de fecha u hora incorrecto. Ejemplo: {1} +javax.faces.converter.DateTimeConverter.PATTERN_TYPE=Un 'modelo' o 'tipo' de atributo debe ser especificado para convertir el valor ''{0}''. +javax.faces.converter.DoubleConverter.DOUBLE=''{0}'' Debe ser un n\u00FAmero de uno o m\u00E1s d\u00EDgitos. +javax.faces.converter.DoubleConverter.DOUBLE_detail=''{0}'' Debe ser un n\u00FAmero entre 4.9E-324 and 1.7976931348623157E308 Ejemplo\: {1} +javax.faces.converter.EnumConverter.ENUM=''{0}'' Debe ser convertible a una enumeracin. +javax.faces.converter.EnumConverter.ENUM_detail=''{0}'' Convertible a una enumeracin de la enumeracin que contiene la constante ''{1}''. +javax.faces.converter.EnumConverter.ENUM_NO_CLASS=''{0}'' Debe ser convertible a una enumeracin, pero no se provee la clase. +javax.faces.converter.EnumConverter.ENUM_NO_CLASS_detail=''{0}'' Debe ser convertible a una enumeracin, pero no se provee la clase. +javax.faces.converter.FloatConverter.FLOAT=''{0}'' Debe ser un n\u00FAmero de uno o m\u00E1s d\u00EDgitos. +javax.faces.converter.FloatConverter.FLOAT_detail=''{0}'' Debe ser un n\u00FAmero entre 1.4E-45 y 3.4028235E38 Ejemplo\: {1} +javax.faces.converter.IntegerConverter.INTEGER=''{0}'' Debe ser un n\u00FAmero de uno o m\u00E1s d\u00EDgitos. +javax.faces.converter.IntegerConverter.INTEGER_detail=''{0}'' Debe ser un n\u00FAmero entre -2147483648 y 2147483647 Ejemplo\: {1} +javax.faces.converter.LongConverter.LONG=''{0}'' Debe ser un n\u00FAmero de uno o m\u00E1s d\u00EDgitos. +javax.faces.converter.LongConverter.LONG_detail=''{0}'' Debe ser un n\u00FAmero entre -9223372036854775808 y 9223372036854775807 Ejemplo\: {1} +javax.faces.converter.NumberConverter.CURRENCY=''{0}'' Formato de moneda incorrecto. +javax.faces.converter.NumberConverter.CURRENCY_detail=''{0}'' Formato de moneda incorrecto. Ejemplo: {1} +javax.faces.converter.NumberConverter.PERCENT=''{0}'' Formato de porcentaje incorrecto. +javax.faces.converter.NumberConverter.PERCENT_detail=''{0}'' Formato de porcentaje incorrecto. Ejemplo: {1} +javax.faces.converter.NumberConverter.NUMBER=''{0}'' No es un n\u00FAmero. +javax.faces.converter.NumberConverter.NUMBER_detail=''{0}'' No es un n\u00FAmero. Ejemplo\: {1} +javax.faces.converter.NumberConverter.PATTERN=''{0}'' No es un n\u00FAmero modelo. +javax.faces.converter.NumberConverter.PATTERN_detail=''{0}'' No es un n\u00FAmero modelo. Ejemplo\: {1} +javax.faces.converter.ShortConverter.SHORT=''{0}'' Debe ser un n\u00FAmero de uno o m\u00E1s d\u00EDgitos. +javax.faces.converter.ShortConverter.SHORT_detail=''{0}'' Debe ser un n\u00FAmero entre -32768 y 32767. Ejemplo\: {1} +javax.faces.converter.STRING=No se puede convertir ''{0}'' a un string. + +org.primefaces.component.datatable.emptyMesssage=No existen registros \ No newline at end of file diff --git a/frontend/src/main/resources/.svn/text-base/viaticos_es.properties.svn-base b/frontend/src/main/resources/.svn/text-base/viaticos_es.properties.svn-base new file mode 100644 index 0000000..c7e54ac --- /dev/null +++ b/frontend/src/main/resources/.svn/text-base/viaticos_es.properties.svn-base @@ -0,0 +1,146 @@ +################################################### +##### S\u00edmbolos unicode +#####\u00e1 -> +#####\u00e9 -> +#####\u00ed -> +#####\u00f3 -> +#####\u00fa -> +#####\u00c1 -> +#####\u00c9 -> +#####\u00cd -> +#####\u00d3 -> +#####\u00da -> +#####\u00F1 -> +#####\u00d1 -> +#####\u0020 -> Espacio en blanco +####### +#primefaces + + +#ETIQUETAS +lbl_funcionario=Funcionario +lbl_nomResDirFin=Responsable Direcci\u00F3n Nacional Financiera +lbl_tipoReporte=Tipo de reporte +lbl_exportar=Exportaci\u00F3n +lbl_gastos=Gastos +lbl_actividadesInforme=Informe de actividades y productos alcanzados +tab_liquidacionVia=LIQUIDACI\u00D3N DE VI\u00C1TICOS Y SUBSISTENCIAS +tab_informeservicios=INFORME DE SERVICIOS INSTITUCIONALES +lbl_codigo=C\u00F3digo +lbl_Editar=Editar +lbl_Ver=Ver +lbl_Eliminar=Eliminar +lbl_solicitud=Solicitud +lbl_valnum=Valor num\u00E9rico +lbl_valalpha=Valor alfanum\u00E9rico +lbl_descripcion=Descripci\u00F3n +lbl_estadosol=Estado de solicitud +lbl_diascomciu=D\u00EDas acumulados ciudad inclu\u00EDda comisi\u00F3n +lbl_diascomision=D\u00EDas comisi\u00F3n acumulados +lbl_jefe=Jefe inmediato +lbl_responsableund=Responsable unidad +lbl_numerocred=N\u00FAmero credencial +lbl_fecha=Fecha +lbl_viaticos=Vi\u00E1ticos +lbl_codSolicitud=C\u00F3digo de Solicitud +lbl_fechaDesde=Fecha Desde +lbl_fechaHasta=Fecha Hasta +lbl_fechaComision=Fecha de comisi\u00F3n de servicios +lbl_estadosSolicitud=Estados de la solicitud de vi\u00E1ticos +lbl_desde=Desde +lbl_hasta=Hasta +lbl_nomRespUni=Nombre - Responsable de la Unidad solicitante +lbl_nomAutoridadNomi=Nombre - Jefe Inmediato +lbl_cargoAutoridad=Cargo - Jefe Inmediato +htbl_estados=Consulta de estados de solicitud de vi\u00E1ticos +lbl_movilizacion=Movilizaciones +lbl_subsistencia=Subsistencias +lbl_alimentacion=Alimentaci\u00F3n +lbl_nombre=Nombre +lbl_cedula=C\u00E9dula +lbl_cargo=Cargo +lbl_unidad=Unidad +lbl_ciudadcom=Ciudad/Provincia comisi\u00F3n +lbl_fechasalida=Fecha salida +lbl_fechallegada=Fecha llegada +lbl_horasalida=Hora salida +lbl_horallegada=Hora llegada +lbl_rubro=Rubro +lbl_descactividades=Descripci\u00F3n de actividades +lbl_infoActividades=Informe de actividades y productos alcanzados +lbl_integrantes=Integrantes de servicios institucionales +lbl_detalleComprobantes=Detalle de comprobante de pago +lbl_comprobante=Comprobante de pago +lbl_empresaServicio=Empresa o Servicio +lbl_ruc=Ruc +lbl_tipo=Tipo +lbl_importe=Importe +lbl_diascom=D\u00EDas comisi\u00F3n +lbl_nombrefun=Nombre del funcionario +lbl_transporte=Nombre de transporte +lbl_ruta=Ruta +lbl_salida=Salida +lbl_llegada=Llegada +lbl_hora=Hora +lbl_tiptransporte=Tipo de transporte +lbl_numcuenta=N\u00FAmero de cuenta +lbl_tipcuenta=Tipo de cuenta +lbl_nombanco=Nombre del banco +lbl_nomarchivo=Nombre del archivo +lbl_alimetacion=Alimentaci\u00F3n +lbl_cargojefe=Cargo jefe +lbl_cargoresp=Cargo responsable +lbl_calculadias=Calcular d\u00EDas acumulados +lbl_inicarFlujo=Iniciar flujo +lbl_responsable=Responsable +lbl_actividad=Actividad +lbl_estado=Estado +lbl_comentarios=Comentarios +lbl_salir=Salir +lbl_diasacumulados=D\u00EDas acumulados +lbl_periodo=Per\u00EDodo +lbl_destino=Destino +lbl_usuario=Usuario +lbl_ciudad=Ciudad +lbl_nomusuario=Nombre de usuario +lbl_nomciudad=Nombre de ciudad +lbl_ingresaSol=Solicitud ingresada por el Servidor +lbl_subtotalTransporte=Subtotal de transporte +lbl_subtotalAlojamientoAlm=Subtotal alimentaci\u00F3n y alojamiento +lbl_totalGastos=Total de gastos +lbl_ver=Ver +lbl_lugarFecha=Lugar y fecha +lbl_cancelar=Cancelar +lbl_detalle=Detalle +lbl_detalleIntegrantes= Integrante de servicios institucionales + +#TITULOS + +#ETIQUETAS CABECERA TABLAS +htbl_parametros=Par\u00E1metros +htbl_destinos=Destinos +htbl_diasacumulados=D\u00EDas acumulados +htbl_usauriosciudad=Usuarios por ciudad +htbl_usauriosciudadtrans=Usuarios por ciudad tipo de transporte + +#ETIQUETAS TABS +tab_soldetalle=DETALLE DE LA SOLICITUD +tab_solautiriza=SOLICITUD DE AUTORIZACI\u00D3N PARA EL CUMPLIMIENTO DE SERVICIOS INSTITUCIONALES +tab_gendatos=DATOS GENERALES +tab_integrantes=INTEGRANTES DE SERVICIOS INSTITUCIONALES +tab_actividades=ACTIVIDADES +tab_transporte=TRANSPORTE +tab_trandatos=DATOS PARA TRANSFERENCIA +tab_archivo=ARCHIVOS + +#BOTONES +btn_descargarDocumentos=Descargar documentos +btn_anulaSolicitud=Anular solicitud +btn_firmar=Firmar + +#MENSAJES +msg_importeTotal=IMPORTE TOTAL DE VI\u00C1TICOS Y GASTOS DE VIAJES COMPROBADOS + +msg_tamanioMaximoExcedido = El valor {0}, no debe exceder los {1} caracteres. +msg_tamanioRucMinimo = El tama\u00F1o del valor ingresado es inferior al permitido (13). +msg_importeIncorrecto = El importe ingresado no est\u00E1 entre los valores esperados\: 0,01 y 9.999,99 \ No newline at end of file diff --git a/frontend/src/main/resources/bpm_es.properties b/frontend/src/main/resources/bpm_es.properties new file mode 100644 index 0000000..35f979f --- /dev/null +++ b/frontend/src/main/resources/bpm_es.properties @@ -0,0 +1,105 @@ +################################################### +##### S\u00edmbolos unicode +#####\u00e1 -> +#####\u00e9 -> +#####\u00ed -> +#####\u00f3 -> +#####\u00fa -> +#####\u00c1 -> +#####\u00c9 -> +#####\u00cd -> +#####\u00d3 -> +#####\u00da -> +#####\u00f1 -> +#####\u00d1 -> +#####\u0020 -> Espacio en blanco +################################################### + +#Botones +btn_view_flow=Ver flujo +btn_cancell=Cancelar +btn_controlcambios=Existe cambios pendientes (YES) perder\u00E1 las modificaciones (NO) permite grabar +btn_create=Crear +btn_delete= +btn_edit= +btn_next= +btn_previous= +btn_query= +btn_save=Grabar +btn_update=Actualizar +btn_reload=Recargar +btn_detail=Detalle +btn_asign=Asignar +btn_accept=Aceptar +btn_exit=Salir +btn_initFlow=Iniciar flujo +btn_completeTask=Competar tarea +btn_sent=Enviar + +#Cabecera de tablas +htbl_monitoring=MONITOREO +htbl_groups=GRUPOS +htbl_users=USUARIOS +htbl_fields=CAMPOS +htbl_flows=FLUJOS +htbl_fieldTransaction=CAMPOS POR TRANSACCI\u00D3N +htbl_fieldMapping=MAPEO DE CAMPOS +htbl_flowsRules=FLUJOS / REGLAS + +lvh_groups=GRUPOS + + +#Etiquetas +lbl_origin_flow_transaction=Transacci\u00F3n originadora del flujo +lbl_selected_activity=Actividad seleccionada +lbl_waiting_time=Tiempo de espera +lbl_real_time=Tiempo real +lbl_comment=Comentario +lbl_commentate=Comentar +lbl_task_detail=Detalle tarea +lbl_code=C\u00F3digo +lbl_groups=Grupos +lbl_group=Grupo +lbl_description=Descripci\u00F3n +lbl_mail=Correo electr\u00F3nico +lbl_user=Usuario +lbl_field=Campo +lbl_experesion=Expresi\u00F3n lenguaje +lbl_package=Paquete +lbl_image=Imagen +lbl_message=Mensaje +lbl_type=Tipo +lbl_active=Activo +lbl_asociation=Asociaci\u00F3n +lbl_path=Ruta +lbl_filetype=Tipo archivo +lbl_todate=Fecha creaci\u00F3n hasta +lbl_fromdate=Fecha creaci\u00F3n desde +lbl_creation=Fecha creaci\u00F3n +lbl_ended=Fecha final +lbl_duration=Duraci\u00F3n +lbl_module=M\u00F3dulo +lbl_transaction=Transacci\u00F3n +lbl_version=Versi\u00F3n +lbl_name=Nombre +lbl_activityname=Actividad del flujo +lbl_created=Creaci\u00F3n +lbl_expectedtime=Tiempo de espera +lbl_realtime=Tiempo real +lbl_observation=Observaciones +lbl_response=Respuesta +lbl_userassign=Usuario asignado +lbl_branch=Sucursal +lbl_detail=Detalle +lbl_email=Correo electr\u00F3nico +lbl_office=Oficina +lbl_fieldscreen=Campo pantalla +lbl_task=Tarea +lbl_observations=Observaciones +lbl_notifyto=Notificar a +lbl_process=Proceso +lbl_registerdate=Fecha registro +lbl_resolution=Resoluci\u00F3n + +#Mensajes +msg_grouprequird=GRUPO REQUERIDO \ No newline at end of file diff --git a/frontend/src/main/resources/controlarmas_es.properties b/frontend/src/main/resources/controlarmas_es.properties new file mode 100644 index 0000000..02066d8 --- /dev/null +++ b/frontend/src/main/resources/controlarmas_es.properties @@ -0,0 +1,1026 @@ +################################################### +##### S\u00edmbolos unicode +#####\u00e1 -> \u00e1 +#####\u00e9 -> \u00e9 +#####\u00ed -> \u00ed +#####\u00f3 -> \u00f3 +#####\u00fa -> \u00fa +#####\u00c1 -> \u00c1 +#####\u00c9 -> \u00c9 +#####\u00cd -> \u00cd +#####\u00d3 -> \u00d3 +#####\u00da -> \u00da +#####\u00f1 -> \u00f1 +#####\u00d1 -> \u00d1 +#####\u0020 -> Espacio en blanco +################################################### + +#ETIQUETAS +#Solcitud +lbl_fechasolicitud=Fecha Solicitud +lbl_fechasolicitud_aucp=Fecha Solicitud / Envio AUCP +lbl_autorizacion=Autorizaci\u00f3n +lbl_estadoDocumento=Estado del Documento +lbl_datosempresaseg=Datos Empresa Seguridad +lbl_psicologicanecesaria=NO SE HA REGISTRADO LA EVALUACI\u00d3N PSICOL\u00d3GICA +lbl_datosevaluado=Datos del Evaluado +lbl_datoscompaniaseg=Datos de la Compan\u00eda de Seguridad +lbl_valordeposito=Valor Dep\u00f3sito +lbl_centromedico=Centro M\u00e9dico +lbl_centroControl=Centro de Control +lbl_tramitesXcentro=Tramites por Centro Control +lbl_si=S\u00cd +lbl_nombreexcel=ReporteDeArmas +lbl_nombreexcelhistorico=ReporteHistoricoDeArmas +msg_fechafinal=LA FECHA FINAL DEBE SER MAYOR A LA FECHA INICIAL +lbl_examenfinalizado=EX\u00c1MEN FINALIZADO +lbl_reprobado=Reprobado +lbl_compania=Compa\u00f1\u00eda de Seguridad +msg_proceso=El proceso debe continuar cuando el arma se encuentra en bodega. +lbl_fechaprox=LA FECHA PARA SU PR\u00d3XIMO INTENTO ES\: +lbl_detallesdetramite=DETALLES DE TR\u00c1MITE +lbl_sancionpermiso=SANCI\u00d3N PERMISO +lbl_recomendaciones=Recomendaciones +msg_ingresesancion=INGRESE UNA SANCI\u00d3N +msg_realiceunasancion=APLIQUE UNA SANCI\u00d3N +lbl_dias=d\u00edas +lbl_verificaCertificado=VERIFICAR INFORMACI\u00d3N CERTIFICADO +lbl_reimpresion=Reimpresi\u00f3n +lbl_tiempo=Tiempo +msg_evaluado=LA PERSONA SELECCIONADA TIENE UN REGISTRO DE EVALUACI\u00d3N PSICOL\u00d3GICA +msg_nopermiso=NO SE ENCUENTRA UN PERMISO PARA EL ARMA SELECCIONADA +msg_persona=SELECCIONE UNA PERSONA +lbl_imprimir=Generar Reporte +lbl_imprimirXls==Generar Reporte Excel +lbl_verificarDocumentos=VERIFICAR DOCUMENTOS +lbl_psicologico=Psicol\u00f3gica +msg_debesubir=DEBE SUBIR UN ARCHIVO DE EVALUACI\u00d3N +lbl_informeevaluacion=Informe Evaluaci\u00f3n +lbl_recomendacion=Recomendaci\u00f3n +lbl_psicologo=Psic\u00f3logo Responsable +lbl_fechaevaluacion=Fecha Evaluaci\u00f3n +lbl_fechaexpiracion=Fecha Caducidad +lbl_fechadeexpiracion= Fecha de Expiraci\u00f3n +lbl_planInspeccionAnual=PlanDeInspecci\u00f3nAnual +msg_archivoImportacionSerie=EL ARCHIVO DE IMPORTACI\u00d3N NO DEBE CONTENER EL N\u00daMERO DE SERIE +msg_serieVacia=La serie del arma no debe estar vac\u00eda. +msg_limitecantidadarma=La cantidad del Arma de Fuego debe ser igual a 1 unidad +msg_claseVacia=La clase del arma no debe estar vac\u00eda. +msg_tipoVacio=El tipo de arma no debe estar vac\u00edo. +msg_marcaVacia=La marca del arma no debe estar vac\u00eda. +msg_longitudVacia=La longitud del arma no debe estar vac\u00eda. +msg_longitudNoVacia=La longitud del arma debe estar vac\u00eda. +msg_calibreVacio=El calibre no debe estar vac\u00edo. +msg_calibreNoVacio=El calibre debe estar vac\u00edo. +msg_cantidadVacia=La cantidad no debe estar vac\u00eda. +msg_cantidadNoVacia=La cantidad debe estar vac\u00eda. +msg_unidadMedidaCantidadVacia=La U. Medida Cantidad no debe estar vac\u00eda. +msg_unidadMedidaCantidadNoVacia=La U. Medida Cantidad debe estar vac\u00eda. +msg_unidadMedidaSoloUna=Solo debe ingresar una unidad de medida. +msg_unidadMedidaNoExiste=La unidad de medida ingresada no existe. +msg_pesoVacio=El peso no debe estar vac\u00edo. +msg_pesoNoVacio=El peso debe estar vac\u00edo. +msg_unidadMedidaPesoVacia=La U. Medida Peso no debe estar vac\u00eda. +msg_unidadMedidaPesoNoVacia=La U. Medida Peso debe estar vac\u00eda. +msg_cantidadValorNumerico=La cantidad debe ser un valor n\u00famerico. +msg_pesoValorNumerico=El peso debe ser un valor num\u00e9rico. +msg_fuegosPirotecnicos=fuegos pirot\u00e9cnicos +msg_datosDuplicados=Existen datos duplicados. +msg_sustanciaQuimica=sustancia qu\u00edmica +msg_calibreNoExisteCatalogo=El calibre no existe en el cat\u00e1logo. +msg_claseNoExisteCatalogo=No existe la clase en el cat\u00e1logo. +msg_longitudNoExisteCatalogo=No existe la longitud en el cat\u00e1logo. +msg_noExisteTipoArmaCatalogo=No existe el tipo de arma en el cat\u00e1logo. +msg_colorNoExisteCatalogo=No existe el color en el cat\u00e1logo. +msg_marcaNoExisteCatalogo=No existe la marca en el cat\u00e1logo. +msg_unicidad_agencia=S\u00d3LO UNA AGENCIA DEBE ESTAR SELECCIONADA +msg_seleccione_nombre=SELECCIONE UN NOMBRE O RAZ\u00d3N SOCIAL + +lbl_ordenTrabajoCustodios=OrdenDeTrabajoParaCustodios +lbl_guiaLibreTransito=Gu\u00eda Libre de Tr\u00e1nsito +lbl_reportebalistico=ReporteRegistroBal\u00edstico +lbl_fechaActual=Fecha Actual +lbl_actaDeDevolucion=ActaDevoluci\u00f3n +lbl_asuntoNotificarFecha=COMANDO CONJUNTO DE LAS FF. AA. - Notificaci\u00f3n Devoluci\u00f3n. +lbl_asuntoNotificarNovedad=COMANDO CONJUNTO DE LAS FF. AA. - Notificaci\u00f3n Novedad +lbl_notificarTramiteAnulado=Notificar Tr\u00e1mite Anulado +msg_asuntoNotificacionGuiaTranistoAnulada=COMANDO CONJUNTO DE LAS FF.AA. - Notificaci\u00f3n de tr\u00e1mite anulado en la Solicitud de Gu\u00eda de Libre Tr\u00e1nsito. +msg_cuerpoNotificacionGuiaTransitoAnulada=DEPARTAMENTO DE CONTROL DE ARMAS
Estimado
{0}
Presente.-
Mediante la presente notificamos que su solicitud N\u00ba {1} para Emisi\u00f3n de Gu\u00eda de Libre Tr\u00e1nsito ha sido rechazada debido a las siguientes observaciones\:

{2}

Atentamente,

{3}
{4}

NOTA\:
Este mensaje fue enviado autom\u00e1ticamente por el sistema, por favor no responda a esta cuenta de correo. +lbl_aprobacionLibreTransito=APROBACI\u00d3N DE LIBRE TR\u00c1NSITO +correoDesde=notificacion@controlarmas.ccffaa.mil.ec +correoDestino=ogarcia@bupartech.com +lbl_justificacion=Justificaci\u00f3n +cuerpo.mensaje.envio.correo=DEPARTAMENTO DE CONTROL DE ARMAS

Estimado(a)
{0}
Presente.-

El trámite de devolución No.{1} ha sido aprobado, por favor acercarse al COMANDO CONJUNTO DE LAS FF.AA a partir de {2} en horario de 8\:00 a 16\:00 para proceder con la devolución del material solicitado.

Atentamente,

{3}
{4}

NOTA\:
Este mensaje fue enviado automáticamente por el sistema, por favor no responda a esta cuenta de correo. +cuerpo.mensaje.envio.correo.novedad1=DEPARTAMENTO DE CONTROL DE ARMAS

Estimado(a)
{0}
Presente.-

El trámite de devolución No. {1}, no puede continuar porque se presenta las siguientes novedades\: +cuerpo.mensaje.envio.correo.novedad2={0}

Atentamente,

{1}
{2}

NOTA\:
Este mensaje fue enviado automáticamente por el sistema, por favor no responda a esta cuenta de correo. +cedulaDuplicada=Ya existe un custodio con esa c\u00e9dula. + + +btn_enviarNotificacion=Enviar Notificaci\u00f3n +btn_cancelar=Cancelar +htbl_sitiosalmacenamiento=SITIOS DE ALMACENAMIENTO +lbl_latitud=Latitud +lbl_estadosolicitud=Estado Solicitud +lbl_origenadquisicion=Origen de Adquisici\u00f3n +lbl_paisorigen=Pa\u00eds +lbl_telfijo=Tel\u00e9fono Fijo +lbl_telcelular=Tel\u00e9fono Celular +lbl_correo=Correo Electr\u00f3nico +lbl_datoscapacidad=Datos Capacidad +lbl_almacenamiento=Almacenamiento +lbl_manejoarmas=Manejo de Armas +lbl_expiro_fecha_deposito=LA FECHA DE SOLICITUD EXPIR\u00d3, POR FAVOR VUELVA A INGRESAR EL TR\u00c1MITE NUEVAMENTE. +msg_error_valorDepositoNegativoCero=EL VALOR DE DEP\u00d3SITO DEBE SER MAYOR A CERO. +msg_error_vVerificDiferenteDeVAPagar=EL VALOR VERIFICADO ES DIFERENTE DEL VALOR A PAGAR Y SE ANULAR\u00c1 +lbl_seleccionar=Seleccionar +lbl_seleccionartodos= Seleccionar Todos +lbl_buscar=Buscar +lbl_cargararchivo=Cargar Archivo +lbl_requisitossolicitud=Requisitos Solicitud +lbl_seleccionarguardias=SELECCIONAR GUARDIAS DE SEGURIDAD +lbl_seleccionararmas=SELECCIONAR ARMAS +lbl_seleccionararticulos=SELECCIONAR ART\u00cdCULOS +lbl_detallematerialregistro=DETALLE MATERIAL REGISTRADO +msg_tamano_archivo_requisitos_jpg_png=EL TAMA\u00d1O M\u00c1XIMO PERMITIDO POR ARCHIVO ES DE 2 MB (.jpg .png) +msg_tamano_archivo_requisitos_jpg_png_1=EL TAMA\u00d1O M\u00c1XIMO PERMITIDO POR ARCHIVO ES DE 1 MB (.jpg .png) +msg_tamano_archivo_requisitos=EL TAMA\u00d1O M\u00c1XIMO PERMITIDO POR ARCHIVO ES DE 2 MB (.pdf .gif .jpg .png) +msg_tamano_archivo_requisitos_5=EL TAMA\u00d1O M\u00c1XIMO PERMITIDO POR ARCHIVO ES DE 5 MB (.pdf .gif .jpg .png) +msg_tamano_archivo_=EL TAMA\u00d1O M\u00c1XIMO PERMITIDO DEL ARCHIVO ES DE 2 MB (.pdf .gif .jpg .png) +msg_tamano_archivo_requisitos_pdf=EL TAMA\u00d1O M\u00c1XIMO PERMITIDO DEL ARCHIVO ES DE 2 MB (.pdf) +msg_tamano_archivo_requisitos_pdf_5=EL TAMA\u00d1O M\u00c1XIMO PERMITIDO DEL ARCHIVO ES DE 5 MB (.pdf) +msg_tamano_archivo_requisitos_pdf_jpg=EL TAMA\u00d1O M\u00c1XIMO PERMITIDO DEL PRIMER ARCHIVO ES DE 1 MB (.pdf) Y EL TAMA\u00d1O M\u00c1XIMO PERMITIDO POR ARCHIVO ES DE 2 MB (.jpg .png) +msg_escanear_documentos_originales=SE DEBE ESCANEAR LOS DOCUMENTOS ORIGINALES Y ACTUALIZADOS +#Seleccion de Agencias +lbl_seleccionaragencias=SELECCIONAR AGENCIAS/SUCURSALES +lbl_detalleAgencias=DETALLE DE AGENCIAS / SUCURSALES +lbl_responsable=Nombre y Apellido del Responsable +lbl_nom_apell_super=Nombre y Apellido del Supervisor +lbl_crearAgencia=CREAR AGENCIA - SUCURSAL +lbl_modificarAgencia=EDITAR AGENCIA - SUCURSAL +lbl_verAgencia=VER AGENCIA - SUCURSAL +btn_seleccionarArmas=Seleccionar Armas +lbl_datosCompania=DATOS COMPA\u00d1\u00cdA +lbl_datosAgencia=DATOS AGENCIA / SUCURSAL +lbl_fechaAutorizacion=Fecha Autorizaci\u00f3n +lbl_telefono=Tel\u00e9fono +lbl_documentos=DOCUMENTOS +lbl_ubicacion= Seleccione ubicaci\u00f3n por +lbl_coodenadas=Coordenadas +lbl_fechaEmision=Fecha de Emisi\u00f3n +lbl_numeroDeDocumento=No. Documento +lbl_listadoguardias=LISTADO DE GUARDIAS DE SEGURIDAD +lbl_eliminaragencia=ELIMINAR AGENCIA-SUCURSAL +lbl_eliminarmaterial=ELIMINAR MATERIAL +lbl_confirmacioneliminar=Est\u00e1 seguro de eliminar el registro? +msg_error_armas_inexistentes=NO EXISTEN ART\u00cdCULOS REGISTRADOS PARA ESTE TR\u00c1MITE +#Documentos + + +#Evaluaciones +lbl_tipoEvaluacion=Tipo Evaluaci\u00f3n +lbl_numerodocumento=No. Documento +lbl_tipoPersona=Tipo Persona +lbl_jurisdiccion=Jurisdicci\u00f3n +lbl_descripcionPregunta=Descripci\u00f3n +lbl_numeroPregunta=No. Pregunta +tab_verRespuestas=Ver Respuestas +tab_Respuestas=Respuestas +tab_respuesta=Respuesta +tab_respuestaCorrecta=Respuesta Correcta +msg_seleccionepersona=POR FAVOR SELECCIONE UNA PERSONA +msg_tipoevaluacion=POR FAVOR INGRESE UN TIPO DE EVALUACI\u00d3N +msg_numerointentos=USTED HA SUPERADO EL N\u00daMERO DE INTENTOS M\u00c1XIMOS PARA LA EVALUACI\u00d3N +msg_fechaprox=LA FECHA PARA SU PR\u00d3XIMO INTENTO ES: +msg_ingreseresp=INGRESE UNA RESPUESTA +lbl_evaluacion=Evaluaci\u00f3n +lbl_detallevaluacion=Detalle de Evaluaciones +lbl_estadoevaluacion=Estado Evaluaci\u00f3n +lbl_fechadeevaluacion=Fecha Examen Psicol\u00f3 gico +lbl_fecharegistrotest=Fecha Registro Test +lbl_resultado=Resultado +lbl_resultado_busqueda=Resultados de b\u00fasqueda +#tramite +lbl_cantidad=Cantidad +lbl_clase=Clase +lbl_tipo=Tipo +lbl_longitud=Longitud +lbl_calibre=Calibre +lbl_tipotramite=Tipo Tr\u00e1mite +lbl_tramite=Tr\u00e1mite +lbl_numeroTramite=No. Tr\u00e1mite +lbl_requisito=Requisito +lbl_descripcionrequisito=Descripci\u00f3n Requisito +lbl_tipopersona=Tipo Persona +lbl_tipoidentiicacion=Tipo Documento +lbl_identificacion=No. Documento +lbl_identificacionTxt=Identificaci\u00f3n +lbl_inicarFlujo=Continuar Tr\u00e1mite +lbl_imagencargada=Imagen Almacenada +lbl_estadocarga=Estado Carga +lbl_estadotramite=Estado Tr\u00e1mite +lbl_usoactividad=Uso / Actividad +lbl_NoTramite=No. Tr\u00e1mite +lbl_fechaDeDeposito=Fecha Dep\u00f3sito +lbl_numeroDeDeposito=No. Combrobante Dep\u00f3sito +lbl_factura=No. Factura / Documento +lbl_registro=No. Registro +lbl_valorDeDeposito=Valor Dep\u00f3sito +lbl_cargarComprobante=Cargar Comprobante +lbl_cargarResolucion=Cargar Resoluci\u00f3n +lbl_numeroDeTramite=No. Tr\u00e1mite +lbl_numeroDeComprobante=No. Comprobante +lbl_noComprobante=No. Comprobante +lbl_valorVerificado=Valor Verificado +lbl_archivoComprobante=Archivo Comprobante +lbl_imprimirComprobante=Imprimir Comprobante +lbl_ver=Ver +fct_registrarDeposito=Registrar Comprobante Dep\u00f3sito +fct_validarDeposito=Validar Comprobante Dep\u00f3sito +lbl_tipoPago=Tipo de pago +# FIELDSETS +field_tipotramite=Datos Tipo Tr\u00e1mite +field_ubicacion=Ubicaci\u00f3n +field_tiposarmasexplosivos=Tipos Armas y Explosivos: +lbl_tipoTramite=Tipo Tr\u00e1mite +lbl_usoActividad=Uso/Actividad +lbl_costo=Costo +lbl_tipocosto=Tipo Costo +lbl_vigenciameses=Vigencia Meses +lbl_tipodocumento=Tipo Documento +lbl_usd=USD +lbl_registroguardia=Registro Guardia +lbl_registroarmas=Registro Armas +lbl_deposito=Dep\u00f3sito +lbl_registroagenciassucursales=Registro Agencias y Sucursales +lbl_requiereevaluacion=Requiere Evaluaci\u00f3n +lbl_requiereinspeccion=Requiere Inspecci\u00f3n +lbl_dochabilitantes=Documentos Habilitantes +lbl_docsolicitudcertificado=Solicitud de Certificado +lbl_certificadofiscal=Certificado Fiscal +lbl_actaentregareceptionSolicitud=ACTA ENTREGA RECEPCI\u00d3N - SOLICITUD +lbl_docactaentregareceptionSolicitud=Documento Acta Entrega Recepci\u00f3n - Solicitud +lbl_costoUSD=Costo(USD) +lbl_tipoautorizacion=Tipo Autorizaci\u00f3n +lbl_datostramite=DATOS DEL TR\u00c1MITE +#Tipo Archivo +lbl_tipoarchivo=Tipo Documento + +lbl_institucion=Instituci\u00f3n +lbl_nombre=Nombre +lbl_jefecentro=Jefe Centro +lbl_grado=Grado +lbl_direccion=Direcci\u00f3n +lbl_puntofacturacion=Punto Facturaci\u00f3n +lbl_Secuenciafacturacion=Secuencia Actual +lbl_nueva_jurisdiccion=NUEVA JURISDICCI\u00d3N +lbl_jurisdicciones=Jurisdicciones +lbl_datosdejurisdicciones=DATOS DE JURISDICCIONES +lbl_nombrerazonsocial=Nombre/Raz\u00f3n Social +lbl_nombrerazonsocialcomprador=Comprador/Consumidor +lbl_numerodetramite=No. Tr\u00e1mite +lbl_numerocustodios=No. Custodios +#numerodiasCustodios Agregar +lbl_numerodiascustodios=No. Dias de Custodios + +lbl_No=No +lbl_solicitud=Solicitud +lbl_documento=Documento +lbl_noDocumento=No. Documento +lbl_noDocumentoPsicologo=No. Documento Psic\u00f3logo +lbl_tipodocumentoPsicologo=Tipo Documento Psic\u00f3logo +lbl_aprobado=Aprobado +lbl_aprobacion=APROBACI\u00d3N +lbl_generarValorACancelar=GENERAR VALOR A CANCELAR +lbl_valorCancelar=Valor a Cancelar +lbl_valorAPagar=Valor a Pagar + +lbl_accion=Acci\u00f3n +lbl_aceptar=Aceptar + +lbl_secuencial=Secuencial +lbl_tipoarmas=Tipo Arma +lbl_clasearma=Clase Arma +lbl_unidad=Unidad de Control +lbl_unidaddestino=Unidad de Control Destino + +lbl_unidadmedida=Unidad Medida +lbl_cupopeso=Cupo Peso +lbl_fecha=Fecha +lbl_tiporegistro=Tipo Registro +lbl_crearcupoautorizado=DETALLE DE CUPOS AUTORIZADOS +lbl_detalleunidadesmedida=DETALLE UNIDADES DE MEDIDA +lbl_unidadTipoClase=UNIDAD TIPO CLASE +lbl_cupo=Cupo +lbl_creartipounidad=CREAR UNIDAD DE MEDIDA +lbl_listadorequisitos=LISTADO DE REQUISITOS +lbl_datossolicitud=DATOS SOLICITUD +lbl_ordendetrabajono=Orden Trabajo No. +lbl_centrodecontrol=Centro Control +lbl_organismocontroldestino=Organismo de Control Destino +lbl_fechainspeccion=Fecha Inspecci\u00f3n +lbl_propietariorepresentantelegal=PROPIETARIO O REPRESENTANTE LEGAL +lbl_referencia=Referencia +lbl_representantelegal=Representante Legal +lbl_sitioinspeccion=SITIO INSPECCI\u00d3N +lbl_responsablem=RESPONSABLE +lbl_numerodecedula=No. C\u00e9dula +lbl_nombresapellidos=Nombres y Apellidos +lbl_telefonodomicilio=Tel\u00e9fono Domicilio +lbl_resultadoinspeccion=RESULTADO INSPECCI\u00d3N +lbl_continuartramiteproceso=Continuar Tr\u00e1mite o Proceso +lbl_negartramiteproceso=Negar Tr\u00e1mite o Proceso +lbl_aplicadecomiso=Aplica Decomiso +lbl_documentoinspeccion=Documento Inspecci\u00f3n +lbl_documentoinspeccionfecha=fecha +lbl_documentoinspeccioncodeuser=Identificaci\u00f3n +lbl_documentoinspeccioncodenombre=Nombres +lbl_fotografias=Fotograf\u00edas +lbl_bodega=Bodega +lbl_sitiosalmacenanmiento=SITIOS DE ALMACENAMIENTO +lbl_registrarresultadoinspeccion=REGISTRAR RESULTADO INSPECCI\u00d3N +lbl_tipodecomercio=Tipo de Comercio +lbl_sitiosalmacenamiento=SITIOS DE ALMACENAMIENTO +lbl_tramites=TR\u00c1MITES +lbl_descripcionCorta=Descripci\u00f3n Corta +lbl_ingresodedecomiso=INGRESO DE DECOMISO / INCAUTACI\u00d3N +lbl_lugardeldecomiso=LUGAR DEL DECOMISO / INCAUTACI\u00d3N +lbl_datosdeldecomiso=DATOS DEL DECOMISO / INCAUTACI\u00d3N +lbl_tipodeproceso=Tipo Proceso +lbl_numerorecibo=No. Recibo +lbl_numerotransaccion=No. Transacci\u00f3n +lbl_fechadecomiso=Fecha Decomiso / Incautaci\u00f3n +lbl_organismocontrol=Organismo de Control +lbl_detalledeldecomiso=DETALLE DEL DECOMISO / INCAUTACI\u00d3N +lbl_datosdelciudadano=Datos del Ciudadano +lbl_decomisadopor=Control Realizado por +lbl_numerocedula=No. C\u00e9dula +lbl_funcionario=Funcionario +btn_registromaterial=Registro Material +btn_generarreciboregistro=Generar Recibo Registro +btn_consultarmaterial=Consultar Material +btn_entregarmaterial=Entregar Material +lbl_sinportador=Sin Portador +lbl_cant=Cant +lbl_umedida=U. Medida +lbl_fecdecimiso=Fecha Decomiso +lbl_motivo=Motivo +lbl_portadorarma=Portador Arma +lbl_registrodematerialdecomisadoincauto=REGISTRO MATERIAL +lbl_registrodematerialicautado=REGISTRO DE MATERIAL CUSTODIA TEMPORAL +lbl_propietario=Propietario +lbl_subir=Subir +lbl_cancelar=Cancelar +lbl_mensajearchivoinvalidom=EL TAMA\u00d1O DEL ARCHIVO DEBE SER M\u00c1XIMO DE +lbl_5mb=5 MB +lbl_2mb=2 MB +lbl_1mb=1 MB +lbl_sinidentificacion=Sin Identificaci\u00f3n +lbl_decomisoincautacion=Decomiso / Incautaci\u00f3n +lbl_cabecera=Cabecera +lbl_pie=Pie +#Agregado para poner el campo de servicio de facturacion +lbl_serviciofacturacion= Servicio de Facturaci\u00f3n +lbl_crearsitiosdealmacenamiento=CREAR / EDITAR +lbl_modificarsitiosdealmacenamiento= CREAR / EDITAR +lbl_datosdecustodia=DATOS DE CUSTODIA +lbl_fechadecustodia=Fecha de Custodia +lbl_aerolinea=Aerol\u00ednea +lbl_novuelo=No. Vuelo +lbl_lugarOrigenm=LUGAR ORIGEN +lbl_lugarDestinom=LUGAR DESTINO +lbl_aeropuerto=Aeropuerto +btn_material=Material +lbl_ingresodedatosdesitiosdealmacenamiento=INGRESO DE DATOS DE SITIOS DE ALMACENAMIENTO +lbl_numerotransaccionenvio=No. Transacci\u00f3n Env\u00cdo +lbl_numerotransaccionrecepcion=No. Transacci\u00f3n Recepci\u00f3n +lbl_fecdecomiso=Fec Decomiso +htbl_detalledelmaterialm=DETALLE DEL MATERIAL +lbl_cantidadpeso=Cantidad/Peso +lbl_ingresocustodiatemporalenaeropuerto=INGRESAR CUSTODIA TEMPORAL EN AEROPUERTO +lbl_nodecomiso=No. Decomiso +btn_generaracta=Generar Acta +lbl_costocustodio=Costo Custodio +btn_iniciarproceso=Continuar Tr\u00e1mite +lbl_multa=Multa +lbl_flujotramite=Flujo Tr\u00e1mite +lbl_numeromaximoarmas=No M\u00e1ximo Armas +lbl_estadosarma=Estados Arma +lbl_tramitepadre=Tr\u00e1mite Padre +lbl_codigoplanificacion=C\u00f3digo Planificaci\u00f3n +lbl_mes=Mes +lbl_planificacioninsoeccion=PLANIFICACI\u00d3N DE INSPECCIONES +lbl_logo=Logo +lbl_limpiar=Limpiar +lbl_unidadcontrolrecepcion=Unidad de Control +lbl_unidadrecepcion=UNIDAD DE RECEPCI\u00d3N +lbl_sancionable=Sancionable +lbl_validaFechaExpiracion=Visualizar Fecha expiraci\u00f3n +lbl_validaPorFechaExpiracion=Visualizar por Fecha expiraci\u00f3n +lbl_validaCaducidadTramPadre=Validar caducidad tr\u00e1mite padre +lbl_validaCaducidadTramPadreAlt=Validar caducidad tr\u00e1mite padre alterno +lbl_seleccionararma=Seleccionar Arma +htbl_armas=Armas +lbl_dochabilitante=Doc. Habilitante +lbl_fechadochabilitante=Fecha Doc. Habilitante +lbl_fechasancion=Fecha Sanci\u00f3n +lbl_confirmacionguardarsancion=Est\u00e1 seguro de guardar la sanci\u00f3n ? +lbl_seleccionecentrocontroltramite=Seleccione el Centro de Control a Realizar el Tr\u00e1mite +lbl_longitud_minima=Longitud M\u00ednima +lbl_numero_=N\u00fameros +lbl_caracteres_especiales=Caracter Especial +lbl_mayusculas=May\u00fasculas +lbl_parametros_clave=La clave debe cumplir lo siguinete +btn_ubicar=Ubicar +btn_guardar_coordenadas =Guardar Coordenadas +nota_coordenadas =Al ingresar las coodernadas, verificar en el mapa que corresponda a la Ubicaci\u00f3n que esta haciendo referencia. +#TITULOS + +#ETIQUETAS CABECERA TABLAS +htbl_tipotramite=Tipo Tr\u00e1mite +htbl_requisitos=Requisitos +htbl_requisitosportipotramite=Requisitos por Tipo Tr\u00e1mite +htbl_TiposDeArmasExplosivos=TIPOS DE ARMAS Y EXPLOSIVOS +htbl_datospersonales=Datos Personales +htbl_seleccionetramite=SELECCIONE EL TR\u00c1MITE + +#ETIQUETAS TABS +tab_solgenerales=Datos Generales +tab_solrequisitos=Ingresar Requisitos +tab_requisitos=Requisitos +tab_solarmas=Seleccionar Armas +tab_solmateriales=Seleccionar Materiales +tab_solarticulos=Seleccionar Art\u00edculos +tab_solguardias=Seleccionar Guardias +tab_tramite=Datos Tr\u00e1mite +tab_agencias=Seleccionar Agencias +tab_documentos=Listar Documentos +tab_depositoportramite=Dep\u00f3sito por Tr\u00e1mite +tab_depositoporcustodio=Dep\u00f3sito por Custodio +tab_seleccionar=Seleccionar +tab_eliminar=Eliminar +tab_modificar=Editar + + +#REQUISITO POR TIPO DE TRAMITE +lbl_depositoportramite=Dep\u00f3sito por Tr\u00e1mite +lbl_depositoporcustodio=Dep\u00f3sito por Custodio + +#RECEPCION/VERIFICACION DE ARMAS +lbl_recepcionarmas=Registro Entrega Armas +lbl_categoria=Categor\u00eda +lbl_fecharegistro=Fecha Registro +lbl_provincia=Provincia +lbl_canton=Cant\u00f3n +lbl_ciudad=Ciudad +lbl_parroquia=Parroquia +lbl_fecharecepcion=Fecha Recepci\u00f3n +lbl_informacionarmas=INFORMACI\u00d3N DE ARMAS +lbl_informaciondocumentos=INFORMACI\u00d3N DE DOCUMENTOS +lbl_informacionagenciassucursales=INFORMACI\u00d3N DE AGENCIAS SUCURSALES +lbl_informacionpersonal=INFORMACI\u00d3N PERSONAL +lbl_codigo=C\u00f3digo +lbl_marca=Marca +lbl_modelo=Modelo +lbl_serie=Serie +lbl_color=Color +lbl_estado=Estado +lbl_estado_arma=Estado Arma +lbl_entregado=Entregado +lbl_pais=Pa\u00eds Fabricaci\u00f3n + +#FICHA TECNICA ARMAS +lbl_observacion=Observaci\u00f3n +lbl_aptituddisparo=Aptitud Disparo +lbl_balastestigo=Balas Testigo +lbl_bainastestigo=Vainas Testigo +lbl_apruebaevaluacion=Aprueba Evaluaci\u00f3n +lbl_recuperadorbalisitico=RECUPERADOR BALISTICO +lbl_impronta=Impronta +lbl_fichatecnica=Ficha T\u00e9cnica +lbl_fotografia=Fotograf\u00eda +lbl_archivocincomegas=5242880 +lbl_archivocuatromegas=4194304 +lbl_archivotresmegas=3145728 +lbl_archivodosmegas=2097152 +lbl_archivounmega=1048576 +lbl_mensajearchivoinvalido=El tama\u00f1o del archivo debe ser m\u00e1ximo de +lbl_observacionrequerido=El campo observaci\u00f3n es requerido +lbl_bainastestigorequerido=El campo vainas testigo es requerido +lbl_balastestigorequerido=El campo balas testigo es requerido +lbl_aptituddisparorequerido=El campo aptitud de disparo es requerido +lbl_informacionguardias=INFORMACI\u00d3N DE GUARDIAS +lbl_pruebasbalistica=PRUEBAS BALISTICA +lbl_impresionarma1=EL ARMA CON C\u00d3DIGO +lbl_impresionarma2=\ NO HA SIDO IMPRESA +lbl_isimpreso=FUE IMPRESO +lbl_imprimirarma=DEBE GENERAR REPORTE DEL ARMA ANTES DE ACEPTAR +lbl_subidaimagenes=LA SUBIDA DE IMAGENES ES REQUERIDA +lbl_subidaimagenes2=LA SUBIDA DE IMAGENES ES REQUERIDA. NO SE ENCUENTRAN SUBIDAS TODAS LAS IMAGENES +#LOV +lvh_requisitotramite=SELECCIONAR TR\u00c1MITE +lvh_clase=CLASE +lvh_longitud=LONGITUD +lvh_tipo=TIPO +lvh_calibre=CALIBRE +lvh_tipoarma=TIPO ARMA + + +#BOTONES +btn_descargarDocumentos=Descargar Documentos +btn_descargarDocumento=Descargar Documento +#Botones +btn_jurisdiccion=Jurisdicci\u00f3n +btn_buscar=Buscar +btn_crear=Crear +btn_eliminar=Eliminar +btn_imprimir=Generar Reporte +#MENSAJES +#msg_importeTotal=IMPORTE TOTAL DE VI\u00c1TICOS Y GASTOS DE VIAJES COMPROBADOS + +#Validacion de Tramite para la Gu\u00eda de Libre Tr\u00e1nsito +lbl_datosTramite=DATOS TR\u00c1MITE +lbl_fechaSolicitud=Fecha Solicitud +lbl_tipoTramite2=Tipo Tr\u00e1mite + +lbl_tipoDocumento=Tipo Documento +lbl_numeroDocumento=No. Documento +lbl_nombreRazonSocial=Nombre / Raz\u00f3n Social +lbl_vendedor=Vendedor +lbl_lugarOrigen=Lugar Origen +lbl_lugarOrigenProvincia=Lugar Origen Provincia +lbl_lugarOrigenCanton=Lugar Origen Cant\u00f3n +lbl_comprador=Comprador +lbl_lugarDestino=Lugar Destino +lbl_lugarDestinoProvincia=Lugar Destino Provincia +lbl_lugarDestinoCanton=Lugar Destino Cant\u00f3n +lbl_estadoTramite=Estado Tr\u00e1mite +lbl_informacionArmas=INFORMACI\u00d3N ARMAS +lbl_numero=No. +lbl_tipo2=Tipo +lbl_calibre2=Calibre +btn_aceptar=Aceptar + +#Orden de trabajo para custodios +lbl_ordenTrabajo=ORDEN DE TRABAJO +lbl_numeroOrden=No. Orden Trabajo +lbl_fechaOrden=Fecha Orden Trabajo +lbl_documentoReferencia=Documento Referencia +lbl_comisionActividad=Comisi\u00f3n/Actividad +lbl_empresaSolicita=Empresa Solicita +lbl_lugarDireccionComision=Lugar y Direcci\u00f3n de la Comisi\u00f3n +lbl_ruta=Ruta +lbl_tiempoEstimado=Tiempo Estimado +lbl_fechaInicio=Fecha Inicio +lbl_fechaFinalizacion=Fecha Finalizaci\u00f3n +lbl_observaciones=Observaciones +lbl_datosCustodios=DATOS DE CUSTODIOS +lbl_nombreParticipante=Nombre Participante +lbl_apellidos=Apellidos +lbl_nombres=Nombres +lbl_cedula=No. C\u00e9dula +lbl_modificar=Editar +lbl_eliminar=Eliminar +lbl_ingresarCustodios=CREAR / EDITAR +lbl_modificarCustodios=CREAR / EDITAR +errorCedula=El n\u00famero ingresado no es v\u00e1lido. Por favor verificar. +#MENSAJES +#msg_importeTotal=IMPORTE TOTAL DE VI\u00c1TICOS Y GASTOS DE VIAJES COMPROBADOS + +#Actualizar Datos Generales +lbl_nombreRepresentanteLegal=Nombre Representante Legal +lbl_cedulaRepresentante=C\u00e9dula Representante Legal +lbl_actividadEconomica=Actividad Econ\u00f3mica +lbl_paisOrigen=Pa\u00eds Origen +lbl_telefonoConvencional= Tel\u00e9fono Convencional +lbl_tlfCelular=Tel\u00e9fono Celular +lbl_estadoCivil=Estado Civil +lbl_genero=G\u00e9nero +lbl_estatura=Estatura (metros) +lbl_profesion=Profesi\u00f3n +lbl_correoElectronico=Correo Electr\u00f3nico +lbl_datosCapacidad=DATOS DE CAPACIDAD +lbl_manejoArmas=Manejo Armas +lbl_listarInformacion=LISTAR INFORMACI\u00d3N +lbl_seleccionarTodos=Seleccionar Todos +btn_registrarNovedad=Registrar Novedad +btn_actaDevolucion=Acta Devoluci\u00f3n +lbl_noTramite=No. Tr\u00e1mite +lbl_verificar=Verificar +lbl_registrarNovedad=Registrar Novedad +lbl_actaDevolucion=Acta Devoluci\u00f3n +lbl_unidadcontrol=Unidad De Control +xpathFujoDocumentoHabilitante=emisiondocumentohabilitante + +#Etiquetas para datos sanciones +lbl_tipoDeFalta=Tipo de Falta +lbl_falta=Falta +lbl_tiempoEnDias=Tiempo(d\u00edas) +lbl_sancion=Sanci\u00f3n +htbl_datosParaSanciones =DATOS PARA SANCIONES +lov_tipoDeFalta=TIPOS DE FALTAS +lov_falta=FALTAS +lov_sancion=SANCIONES +lov_unidades=UNIDADES +lov_clase=CLASE +msg_error_seleccionClase = POR FAVOR SELECCIONE UNA CLASE DE ARMA O EXPLOSIVO + +#Verificacion de la Informacion de Devolucion + +#Carga de datos Excel +btn_cargar=Cargar +btn_limpiar=Limpiar +hfld_datosgenerales=Datos Generales +lbl_unidadcantidad=U. Medida Cantidad +lbl_peso=Peso +lbl_unidadpeso=U. Medida Peso +htbl_detalledelmaterial=Detalle del Material + +tramite=Tr\u00e1mite +lbl_dui=No. DUI +lbl_fob=Total FOB +lbl_paisdestino=Pa\u00eds Destino +lbl_fabricante=Fabricante +lbl_aeropuertopuerto=Aeropuerto/Puerto +lbl_numerosolicitud=No. Solicitud +lbl_numerosolicitud_aucp=No. Solicitud / AUCP +lbl_datoscomprador=Datos Comprador +lbl_datostransaccion=Datos Transacci\u00f3n +lbl_tipotransaccion=Tipo Transacci\u00f3n +fct_datosPreguntasRespuestas = DATOS DE PREGUNTAS Y RESPUESTAS + +msg_error_lotenull=EL LOTE NO PUEDE SER NULO. +msg_error_armanovalida=TIPO DE ARMA NO VALIDA. +msg_error_cantidadnotnull=LA CANTIDAD NO PUEDE SER NULA. +msg_error_pesonull=EL PESO NO PUEDE SER NULO. +msg_error_nrseries=NO PUEDEN EXISTIR SERIES REPETIDAS. +msg_error_erroresexcel=ERROR DE REFERENCIA CON EL CAT\u00c1LOGO. +msg_error_claseytipo=LA CLASE Y EL TIPO NO PUEDEN TENER VALORES NULOS. +msg_error_nocontrolado=ERROR NO CONTROLADO, POR FAVOR REVISE SU DOCUMENTO. +msg_error_cantidadnumerica=LA CANTIDAD DEBE SER UN VALOR NUM\u00c9RICO. +msg_error_catalogo=ERROR EN EL CAT\u00c1LOGO DE TIPOARMAEXPLOSIVO +msg_error_pesonumerico=EL PESO DEBE SER UN VALOR NUM\u00c9RICO +##MESAJES SOLICITUD +msg_error_tramite=DEBE ESCOGER UN TR\u00c1MITE +msg_error_requisitos=DEBE INGRESAR TODOS LOS REQUISITOS SOLICITADOS +msg_error_no_requisitos=NO EXISTEN REQUISITOS DEFINIDOS PARA ESTE TIPO DE TR\u00c1MITE CONSULTE CON EL ADMINISTRADOR +msg_error_armas=DEBE SELECCIONAR AL MENOS UN ART\u00cdCULO EN EL TR\u00c1MITE +msg_error_maximo_armas=NO PUEDE SELECCIONAR MAS DE {0} ARMA(S), LAS ARMAS RESTANTES DEBEN SEGUIR EL TR\u00c1MITE PERTINENTE +msg_error_guardias=DEBE SELECCIONAR AL MENOS UN GUARDIA EN EL TR\u00c1MITE +msg_error_agencias=DEBE SELECCIONAR AL MENOS UNA AGENCIA EN EL TR\u00c1MITE +msg_error_documento=DEBE SELECCIONAR AL MENOS UN DOCUMENTO DE LA LISTA + +msg_error_imprimir_recepcion_armas=SE DEBEN ENCONTRAR SELECCIONADAS TODAS LAS ARMAS PARA PODER IMPRIMIR +msg_error_validar_seleccion_armas=SE DEBEN ENCONTRAR SELECCIONADAS TODAS LAS ARMAS PARA PODER GUARDAR +msg_error_requiere_validacion_tecnica=PARA EL TR\u00c1MITE SELECCIONADO, SE REQUIERE CUMPLIR CON EL SIGUIENTE REQUISITO PREVIO\: EVALUACI\u00d3N DE CONOCIMIENTOS +msg_error_requiere_validacion_psicologica=PARA EL TR\u00c1MITE SELECCIONADO, SE REQUIERE CUMPLIR CON EL SIGUIENTE REQUISITO PREVIO\: EVALUACI\u00d3N PSICOL\u00d3GICA + +msg_error_numerodocumento=SELECCIONE EL No. DOCUMENTO +msg_error_tipoarchivoinvalido=TIPO ARCHIVO INVALIDO +msg_error_exedeelnumero=EXEDE EL NUMERO DE ARCHIVOS + +msg_error_comprobanteDepositoUsado= \ EL DEP\u00d3SITO INGRESADO YA HA SIDO UTILIZADO EN OTRO TR\u00c1MITE. POR FAVOR VERIFICAR. +msg_error_tramiteSinDatosAsociados= EL N\u00daMERO DE TR\u00c1MITE NO TIENE DATOS ASOCIADOS. +msg_error_decomisoSinDatosAsociados= EL DOCUMENTO DE DECOMISO NO TIENE DATOS ASOCIADOS. +msg_error_fechaDepositoMayorFechaActual= LA FECHA DE DEP\u00d3SITO NO PUEDE SER MAYOR A LA FECHA ACTUAL. +msg_error_archivo=EL FORMATO DEL ARCHIVO NO ES EL CORRECTO, RECUERDE QUE EL ARCHIVO DEBE SER PDF, PNG O JPEG Y NO DEBE SUPERAR 1MB. +msg_error_archivo_firma=EL FORMATO DEL ARCHIVO NO ES EL CORRECTO, RECUERDE QUE EL ARCHIVO DEBE SER PDF. +msg_error_sinarchivo=NO HA SUBIDO EL ARCHIVO FIRMADO A ALFRESCO. +msg_error_sinfirmararchivo=EL ARCHIVO NO EST\u00c1 FIRMADO PARA SUBIR AL ALFRESCO. +msg_error_nombrearchivo=EL NOMBRE DE ARCHIVO NO CORRESPONDE +msg_error_nombrearchivo_xpath=NO EXITE XPATH DEL ARCHIVO +msg_error_ingreseComprobanteDeposito=INGRESE EL COMPROBANTE DE DEP\u00d3SITO +msg_error_ingreseDocumentoDecomiso=INGRESE EL DOCUMENTO DE DECOMISO +msg_error_reimpresion=NO HA SELECCIONADO NINGUN REGISTRO O LOS REGISTROS SELECCIONADOS NO SON DE TIPO PERMISO +msg_error_verificararmas=NO HA SELECCIONADO NINGUN REGISTRO +msg_error_verificarcentcontdestino=NO HA SELECCIONADO NINGUN ORGANISMO DE CONTROL O UNIDAD DE CONTROL +msg_error_noexistendocumentos=NO TIENE DOCUMENTOS HABILITANTES EXISTENTES PARA ESTE TR\u00c1MITE +msg_error_noexistesolicitud=NO EXISTE SOLICITUD +msg_error_tramite_padre=REQUISITO PREVIO PARA ESTE TR\u00c1MITE\: {1}/{2}/{3} +msg_error_avanzar_flujo=DEBE IMPRIMIR ANTES DE HACER AVANZAR EL FLUJO +msg_error_adjuntar_resolucion=ERROR AL ADJUNTAR LA RESOLUCI\u00d3N + +##MESAJES DATOS SANCIONES +msg_error_tipoFaltaRequerido=SELECCIONE UN TIPO DE FALTA +msg_error_faltaRequerido=SELECCIONE UNA FALTA +msg_error_claseRequerido=SELECCIONE UNA CLASE +msg_error_sancionRequerido=SELECCIONE UNA SANCI\u00d3N + +#LABEL EVALUACIONES +ttl_evaluacion=TEST DE CONOCIMIENTOS +lbl_conocimientos=Conocimientos +lbl_test=Test +lbl_preguntas=Preguntas +lbl_mensaje=Lea detenidamente las preguntas del Test y seleccione una respuesta correcta. +btn_iniciar=Iniciar +#ARMAS +lbl_crearmaterial=CREAR MATERIAL +lbl_vermaterial=VER MATERIAL +lbl_modificarmaterial=EDITAR MATERIAL +htbl_detallematerial=DETALLE MATERIAL REGISTRADO +lbl_datospersonales=DATOS PERSONALES +lbl_datosmaterial=DATOS MATERIAL +lbl_fechaemisionpermiso=Fecha Emisi\u00f3n Permiso +lbl_tipofabricacion=Tipo Fabricaci\u00f3n +lbl_serielote=Serie/Lote +lbl_seriecanon=Serie/Ca\u00f1\u00f3n +lbl_datosdecomiso=DATOS DECOMISO / INCAUTACI\u00d3N +lbl_fechadecimiso=Fecha Decomiso / Incautaci\u00f3n +lbl_portadormaterial=Portador del Material +lbl_motivodecomiso=Motivo Decomiso / Incautaci\u00f3n +lbl_detallearma=FORMATO ARMA +lbl_datosarma=DATOS ARMA +lbl_codigoarma=C\u00f3digo de Arma +lbl_actualizar_propietario=ACTUALIZAR PROPIETARIO +lbl_datos_propietario_nuevo=Datos propietario nuevo + +#MATENIMIENTO DOCUMENTO ALFRESCO +lbl_crearmantenimientodocumento=CREAR MANTENIMIENTO DOCUMENTOS ALFRESCO +lbl_modificarmantenimientodocumento=EDITAR MANTENIMIENTO DOCUMENTOS ALFRESCO +lbl_vermantenimientodocumento=VER MANTENIMIENTO DOCUMENTOS ALFRESCO +htbl_detalledocumentoregistrados=DETALLE DE DOCUMENTOS REGISTRADO +lbl_datosPerfilDocumento= DOCUMENTOS POR PERFIL + +#MATENIMIENTO DOCUMENTO FISCALIA +lbl_crearcertificadofiscalia=CREAR CERTIFICADO FISCAL\u00cdA +lbl_modificarcertificadofiscalia=EDITAR CERTIFICADO FISCAL\u00cdA +lbl_datoscertificado=DATOS CERTIFICADO + +btn_generarReporte=Generar Reporte +btn_generarInforme=Generar Informe +btn_enviar=Enviar +btn_generarfecha=Generar Fecha +fct_materialParaDestruccion=MATERIAL PARA BAJA Y DESTRUCCI\u00d3N +lbl_fechaDeCorte=Fecha Corte +lbl_fechaNotificacion=Fecha Notificaci\u00f3n +lbl_formato = Formato +lbl_uniMedida= U. Medida +lbl_fecDecimiso=Fecha Decomiso / Incautaci\u00f3n +lbl_noRecibo=No. Recibo +fct_formatoReporteGenerar=FORMATO DEL REPORTE A GENERAR +fct_pnlunidaddestino=UNIDAD DE DESTINO +lbl_archivocash= Archivo Cash +lbl_plananual= Plan Anual +lbl_actadecomisoentrega= Acta de Entrega de Material Decomisado +lbl_actadecomisorecepcion= Acta de Recepci\u00f3n de Material Decomisado +lbl_documentodecomisoentrega= Documento Acta de Entrega de Material Decomisado +lbl_documentodecomisorecepcion= Documento Acta de Recepci\u00f3n de Material Decomisado +lbl_documentoplananual=Documento Plan Anual +lbl_tipodocumentos=Tipo de Documentos +lbl_numerodocumentos=No. Documentos + +lbl_combosolicitud=Solicitud +lbl_comboplanificacionanual=Planificaci\u00f3n Anual +lbl_comboashmanagement=Cash Management +lbl_combodecomiso=Decomisos +lbl_combofiscalia=Fiscal\u00eda + + +#verificacion del material decomisado +fct_datosDelDecomiso=DATOS DEL DECOMISO / INCAUTACI\u00d3N +fct_datosDelArmaSancion=DATOS DEL ARMA / SANCI\u00d3N +lbl_numeroRecibo=No. Recibo +lbl_fechaDeDecomiso=Fecha Decomiso / Incautaci\u00f3n +lbl_cedulaRucPasaporte=C\u00e9dula/Ruc/Pasaporte +lbl_fechaDeRegistro=Fecha Registro +lbl_nocedula=No. C\u00e9dula +lbl_enBodega=En Bodega +tab_detalleDeArmas=DETALLE DE ARMAS +tab_sancion=SANCI\u00d3N + +##MENSAJES ARMAS +msg_error_tipoarmaexplosivonoexistente=TIPO DE ARMA EXPLOSIVO NO EXISTENTE, DEBE SELECCIONAR UNA COMBINACI\u00d3N V\u00c1LIDA +msg_error_camposrequeridos=ERROR, LOS CAMPOS MARCADOS CON (*) SON REQUERIDOS +msg_error_camponotificacion=EL CAMPO DE FECHA DE NOTIFICACI\u00d3N NO HA SIDO GENERADO +msg_categoriaRequerida=DEBE SELECCIONAR UNA CATEGOR\u00cdA + +##MENSAJES INSPECCION +msg_error_ingreseelformatodeinspeccion=INGRESE EL FORMATO DE INSPECCI\u00d3N +msg_error_ingreselafoto1=INGRESE LA FOTO 1 +msg_error_ingreselafoto2=INGRESE LA FOTO 2 +msg_error_ingreselafoto3=INGRESE LA FOTO 3 +msg_error_seleccionesionoenaplicadecomiso=SELECCIONE SI O NO EN APLICA DECOMISO +msg_error_seleccionenegarocontinuartramiteproceso=SELECCIONE ALGUNA OPCI\u00d3N NEGAR O CONTINUAR TR\u00c1MITE O PROCESO +msg_error_seleccionenesitioinspeccion=SELECCIONE EL SITIO DE INSPECCI\u00d3N +msg_error_realizelabusqueda=REALIZE LA BUSQUEDA +mg_error_usuarionoencontrado=USUARIO NO ENCONTRADO +mg_error_usuarionoencontradovendedor=USUARIO NO ENCONTRADO +mg_error_usuarionoencontradocomprador=USUARIO NO ENCONTRADO +mg_error_ingreselosdatosdelpropietario=INGRESE LOS DATOS DEL PROPIETARIO +mg_error_seleccioneeltipodedocumentooingreselacedula=SELECCIONE EL TIPO DE DOCUMENTO E INGRESE EL N\u00daMERO DE DOCUMENTO +mg_error_seleccioneeltipodedocumentooingreselacedulavendedor=SELECCIONE EL TIPO DE DOCUMENTO E INGRESE EL N\u00daMERO DE DOCUMENTO +mg_error_seleccioneeltipodedocumentooingreselacedulacomprador=SELECCIONE EL TIPO DE DOCUMENTO E INGRESE EL N\u00daMERO DE DOCUMENTO +mg_error_seleccioneeltipodedocumentooingreselongitudlatitud=SELECCIONE LA UBICACI\u00d3N +mg_error_seleccioneeltipoMapa=SELECCIONE TIPO DE UBICACI\u00d3N + +##MENSAJES DECOMISO +msg_error_numReciboNoRegistrado=EL N\u00daMERO DE RECIBO NO SE ENCUENTRA REGISTRADO +msg_error_fechaCorteMayorAFechaActual=LA FECHA DE CORTE NO PUEDE SER MAYOR A LA FECHA ACTUAL +msg_error_fechaCorteRequerido=LA FECHA DE CORTE ES UN CAMPO REQUERIDO +msg_error_seleccioneAlmenosUnArma=DEBE SELECCIONAR AL MENOS UN ARMA DECOMISADA PARA GENERAR EL REPORTE +msg_error_noGuardoCorrectamenteReporte=NO SE HA PODIDO INICIAR EL PROCESO. ERROR AL GUARDAR EL REPORTE +msg_error_generarReporteRequerido= DEBE GENERAR EL REPORTE ANTES DE INICIAR EL PROCESO +msg_info_consultarArmasDecomidas=NO EXISTEN ARMAS DECOMISADAS AL MOMENTO DE CONSULTAR +##MENSAJES CUSTODIA TEMPORAL +msg_error_seleccionepropietario=SELECCIONE EL PROPIETARIO +msg_error_ingreselaobservacion=INGRESE LA OBSERVACI\u00d3N +msg_error_seleccioneelarmaacustodiatemporal=SELECCIONE EL ARMA A CUSTODIA TEMPORAL +msg_error_fechadecomisonopuedesermayoralaactual=LA FECHA DE DECOMISO/INCAUTACI\u00d3N NO PUEDE SER MAYOR A LA FECHA ACTUAL +msg_error_numerocomprobanterecibo=EL NO. COMPROBANTE/RECIBO YA EXISTE PARA LA ACTIVIDAD Y UNIDAD DE CONTROL SELECCIONADA +msg_error_validarnumerocomprobanterecibo=SELECCIONE ANTES ACTIVIDAD DE CONTROL PARA INSERTAR NO. COMPROBANTE/RECIBO +msg_error_nodocumentoinvalido=No Documento INVALIDO +msg_error_nodocumentoinvalidovendedor=No Documento INVALIDO +msg_error_nodocumentoinvalidocomprador=No Documento INVALIDO +msg_error_seleccionesinportadoroverifiqueusuarioexistente=SELECCIONE SIN PORTADOR O VERIFIQUE SI EL USUARIO EXISTE +msg_error_seleccionesinportadoroverifiqueusuarioexistentevendedor=SELECCIONE O VERIFIQUE SI EL USUARIO EXISTE +msg_error_seleccionesinportadoroverifiqueusuarioexistentecomprador=SELECCIONE O VERIFIQUE SI EL USUARIO EXISTE +msg_error_seleccioneelarmaarealizareldecomisoincautacion=SELECCIONE EL MATERIAL EN LA PESTA\u00d1A SELECCIONAR MATERIALES, PARA REALIZAR +msg_error_seleccionearchivodecomisoincautacion=SELECCIONE EL DOCUMENTO DE ACTIVIDAD DE CONTROL +msg_error_sin_decomisos=EL CENTRO DE CONTROL NO TIENE DECOMISOS +msg_error_sin_centrocontrol=NO SE ENCUENTRA ASIGNADO UN CENTRO DE CONTROL, REVISAR SI TIENE ASIGNADO UNA DIRECCI\u00d3N COMO PRINCIPAL Y PROVINCIA +msg_error_numero_recepcion=EL NUMERO DE RECEPCION NO TIENE EL FORMATO ESPERADO REC-000000000 +msg_error_solicitud_noencontrada=SOLICITUD NO ENCONTRADA +msg_error_listardocumentos_solo=SOLO PUEDE SELECCIONAR UN DOCUMENTO EN LA SECCI\u00d3N LISTAR DOCUMENTOS +msg_error_listardocumentos=SE DEBE SELECCIONAR AL MENOS UN DOCUMENTO EN LA SECCI\u00d3N LISTAR DOCUMENTOS +msg_error_psicologoinvalido=LA IDENTIFICACI\u00d3N DEL PSIC\u00d3LOGO RESPONSABLE ES INV\u00c1LIDA. + +##MENSAJES INFORMACION DEVOLUCION +msg_error_generereporte=GENERE EL REPORTE + +lbl_generarPlanInspeccionAnual=GENERAR PLAN DE INSPECCI\u00d3N ANUAL +lbl_datosPlanificacion=DATOS PLANIFICACI\u00d3N +lbl_anno=A\u00f1o +lbl_codigoPlanificacion=C\u00f3digo de Planificaci\u00f3n +lbl_planificacion=Planificaci\u00f3n +lbl_centroControlArmas=Centro de Control de Armas +lbl_fechaGeneracion=Fecha de Generaci\u00f3n +btn_generarPlanificacion=Generar Planificaci\u00f3n +btn_enviarPlanificacion=Enviar Planificaci\u00f3n +lbl_planificacionAnual=PLANIFICACI\u00d3N ANUAL +lbl_fechaCaducidad=Fecha Caducidad +lbl_estadoPermiso=Estado Permiso +msg_noExistenTramitesAnno=NO EXISTEN TR\u00c1MITES PARA EL A\u00d1O +lbl_editarRegistroInspeccion=EDITAR REGISTRO DE INSPECCI\u00d3N +msg_planificacionNoGenerada=NO SE HA GENERADO LA PLANIFICACI\u00d3N +lbl_aprobacionPlanificacion=APROBACION DE PLANIFICACI\u00d3N +dest_msg_mail_prueba=fpazmino@bupartech.com +lbl_filtrosBusqueda=FILTROS DE B\u00daSQUEDA +lbl_fechaDesaduanizacion=Fecha Desaduanizaci\u00f3n +lbl_datosGenerales=DATOS GENERALES +lbl_detalleMaterial=DETALLE DEL MATERIAL + +##PARAMETROS FIRMA +firma_coordenadallx=10 +firma_coordenadally=200 +firma_coordenadaurx=250 +firma_coordenadaury=1118 + +firma_coordenadallx2=370 +firma_coordenadally2=200 +firma_coordenadaurx2=610 +firma_coordenadaury2=1118 + +firma_mensaje=Por favor presione el bot\u00f3n +firma_mensaje2=Grabar +firma_mensaje3=para guardar el documento +firma_mensaje4=El archivo no est\u00e1 firmado para subir al alfresco +lbl_datosImportacion=DATOS DE IMPORTACI\u00d3N + +##CATALOGO +ctg_autorizacion=AUTORIZACI\u00d3N +ctg_primeravez=PRIMERA VEZ +ctg_renovacion=RENOVACI\u00d3N +ctg_permiso=PERMISO +ctg_certificados=CERTIFICADOS +ctg_perdida=P\u00c9RDIDA +ctg_actualizacionDeDatos=ACTUALIZACI\u00d3N DE DATOS +ctg_reimpresion_tipo=REIMPRESION +ctg_reimpresion=REIMPRESI\u00d3N +ctg_tipotramite=TIPOTRAMITE +ctg_tipoautorizacion=TIPOAUTORIZACION +ctg_usoactividad=USOACTIVIDAD +ctg_resultado_aprobado=APROBADO +ctg_resultado_codigo=RESULTADO +ctg_tipo_evaluacion_conocimiento=CONOCIMIENTO +ctg_tipo_evaluacion_psicologica=PSICOLOGICA +lbl_test_psicologica=Test Psicol\u00f3gico +ctg_tipo_evaluacion_codigo=TIPOEVALUACION +##MENSAJE INFORMACION +msg_noplanificacion=No PLANIFICACI\u00d3N + +msg_armaDuplicada=EL ART\u00cdCULO QUE INTENTA CREAR YA SE ENCUENTRA REGISTRADO EN EL SISTEMA + +lbl_comprobanteCaja=ComprobanteDeCaja + +msg_error_generarlaplanificacion=GENERAR LA PLANIFICACI\u00d3N +tecnicoAlmacenamiento=T\u00c9CNICO DE ALMACENAMIENTO DEL +jefe=JEFE +msg_existePlanificacionAnno=YA EXISTE UNA PLANIFICACI\u00d3N PARA ESE A\u00d1O +lbl_fichaTecnicaArmas=FichaTecnicaArmas +lbl_registroBalistico=Registro bal\u00edstico +lbl_dolares=D\u00d3LARES +msg_error_notienedireccionprincipal=NO TIENE DIRECCI\u00d3N PRINCIPAL +msg_error_laprovinciasinccontrol=LA PROVINCIA NO TIENE ASIGNADA UN CENTRO DE CONTROL +msg_error_sinprovincia=NO TIENE ASIGNADO UNA PROVINCIA +msg_error_singenerarreciboregistro=NO SE HA GENERADO UN RECIBO DE REGISTRO PARA EL DECOMISO +msg_error_notienedireccioncorreo=NO TIENE DIRECCI\u00d3N DE CORREO +msg_error_subiroarchivoregistrorecibo=ERROR AL OBTENER EL RECIBO DE REGISTRO DE DECOMISO + +msg_error_liqeco_fechaInicioMayorAFechaActual=SELECCIONE UNA FECHA DE INICIO MENOR A LA FECHA ACTUAL +msg_error_liqeco_fechaDecomisoMayorAFechaActual=SELECCIONE UNA FECHA DE DECOMISO MENOR A LA FECHA ACTUAL +msg_error_liqeco_fechaFinMayorAFechaActual=SELECCIONE UNA FECHA FIN MENOR A LA FECHA ACTUAL +msg_error_liqeco_fechaInicioMayorAFechaFin=LA FECHA DE INICIO SELECCIONADA DEBE SER MAYOR O IGUAL A LA FECHA FIN SELECCIONADA +msg_error_liqeco_fechaInicioMayorAFechaFin1=LA FECHA DE INICIO SELECCIONADA DEBE SER MENOR O IGUAL A LA FECHA FIN SELECCIONADA +msg_error_claveanteriornopuederserigualactual=CLAVE ANTERIOR NO PUEDE SER IGUAL A LA ACTUAL + +msg_error_coninv_fechaMayorAFechaActual=SELECCIONE UNA FECHA MENOR A LA FECHA ACTUAL + +msg_error_elnombredelarchivonocaracteresespeciales=EL NOMBRE DEL ARCHIVO NO PUEDE CONTENER CARACTERES ESPECIALES +msg_error_ingresenumsolicitudexacto=NO SE PUEDE REALIZAR LA CONSULTA CON %, INGRESE EL No. DE SOLICITUD COMPLETO +msg_error_elnombredelarchivonodebeiniciarconnum=EL NOMBRE DEL ARCHIVO NO DEBE INICIAR CON N\u00daMEROS +msg_error_elnombredelarchivonodebecontenerespaciosenblanco=EL NOMBRE DEL ARCHIVO NO DEBE CONTENER ESPACIOS EN BLANCO +msg_error_elnombredelarchivonodebesermenoracincoletras=EL TAMA\u00d1O DEL NOMBRE DEL ARCHIVO NO DEBE SER MENOR A 5 CARACTERES + +#URL DE LOS SERVICIOS MANEJADOS DESDE LA SNAP +url_snap_servicio_cedula=https://serviciosarmas.ccffaa.mil.ec:8085/serviceCedula?wsdl +url_snap_servicio_ruc=https://serviciosarmas.ccffaa.mil.ec:8085/serviceRUC?wsdl + + +msg_error_nohaseleccionadoarmas=NO HA SELECCIONADO NINGUNA ARMA +msg_inf_digitadordel=COORDINADOR DEL +msg_error_ingrese_funcionario=INGRESE EL FUNCIONARIO + +codigo_estado_arma_busqueda_venta='REG','REN','APTA','DEV','ECO','COLE','PRO' + +msg_error_generar_reporte=ERROR AL GENERAR EL REPORTE + +msg_recuerdeClickContinuarTramite=PARA CONTINUAR SU TR\u00c1MITE\: DEBE DAR CLICK EN EL BOT\u00d3N CONTINUAR TR\u00c1MITE +msg_recuerdeUnicaCargaInventario=RECUERDE QUE EL INVENTARIO PARA UNA CATEGOR\u00cdA SELECCIONADA SOLO PODR\u00c1 SUBIRSE UNA \u00daNICA VEZ +msg_inventarioCargadoPreviamente=EL INVENTARIO PARA LA CATEGOR\u00cdA SELECCIONADA YA FUE CARGADO ANTERIORMENTE +msg_inventarioNoArmasFuegoNiNoLetales=No se permite el ingreso de armas de fuego ni tampoco de armas no letales +msg_reimpresionprevianopermitida=NO SE PUEDE REIMPRIMIR DOCUMENTOS CON FECHA DE EMISI\u00d3N PREVIA AL 15 DE JUNIO DEL 2015 +msg_recuerdeClickSeleccionarArmas=PARA VISUALIZAR LAS ARMAS DEBE DAR CLICK EN EL BOT\u00d3N SELECCIONAR ARMA +msg_recuerdeClickGenerarReciboRegistro=PARA TERMINAR EL REGISTRO\: DEBE DAR CLICK EN EL BOT\u00d3N GENERAR RECIBO REGISTRO PARA OBTENER EL REPORTE DE REGISTRO +msg_recuerdeClickCargarDocActControl=PARA CONTINUAR EL REGISTRO\: DEBE DAR CLICK EN EL BOT\u00d3N SELECCIONAR DE CARGA DOCUMENTO ACTIVIDAD DE CONTROL Y SEGUIDO DAR CLICK EN EL BOT\u00d3N SUBIR +msg_recuerdeClickBtnSave=PARA CONTINUAR EL REGISTRO\: DEBE DAR CLICK EN EL BOT\u00d3N GRABAR +msg_recuerdeClickBtnRegMaterial=PARA CONTINUAR EL REGISTRO\: DEBE DAR CLICK EN EL BOT\u00d3N REGISTRO MATERIAL +msg_recuerdeClickTabRegMaterial=PARA CONTINUAR EL REGISTRO\: DEBE SELECCIONAR MATERIAL EN LA PESTA\u00d1A SELECCIONAR MATERIALES +msg_recuerdeClickGenerarActa=PARA CONTINUAR SU TRAMITE\: DEBE DAR CLICK EN EL BOT\u00d3N GENERAR ACTA + +lbl_desde=Desde +lbl_hasta=Hasta +lbl_ultimaGeneracion=\u00daltima Generaci\u00f3n + +lbl_aucp=AUCP +lbl_estaDesaduanizado=EST\u00c1 DESADUANIZADO? +msg_error_aucp_previamente_cargado=EL C\u00d3DIGO DE SOLICITUD AUCP YA HA SIDO CARGADO PREVIAMENTE +msg_error_carga_armas_inexistentes=NO EXISTEN ART\u00cdCULOS CREADOS PARA EL PRESENTE REGISTRO +msg_desea_iniciar_desaduanizacion=DESEA INICIAR LA DESADUANIZACI\u00d3N? +msg_desea_recuerde_desaduanizacion1=RECUERDE QUE UNA VEZ INICIADA LA DESADUANIZACI\u00d3N, NO PODR\u00c1 EDITAR +msg_desea_recuerde_desaduanizacion2=ART\u00cdCULOS DESDE LA PANTALLA INGRESO DE IMPORTACI\u00d3N +msg_desea_continuar=DESEA CONTINUAR? + +lbl_partida_arancelaria=Partida Arancelaria +msg_error_paisOrigenRequerido=Pa\u00eds Origen Requerido +msg_error_provinciaRequerido=Provincia Requerida +msg_error_cantonRequerido=Cant\u00f3n Requerido +msg_error_ciudadRequerido=Ciudad Requerida +msg_error_aeropuertoRequerido=Aeropuerto Requerido +lbl_tipo_planificacion=Periodos de Planificaci\u00f3n +lbl_asignacion_presupuestaria=Asignaci\u00f3n Presupuest\u00e1ria +lbl_tipo_sancion=Tipo Sanci\u00f3n + +lbl_datosOrganismoControl=DATOS ORGANISMO CONTROL +lbl_datosUbicacionDecomiso=DATOS UBICACI\u00d3N ACTIVIDAD DE CONTROL +lbl_datosPortadorEnElDecomiso=DATOS DEL PORTADOR EN ACTIVIDAD DE CONTROL + +lbl_tipoDecomiso=Actividad de Control +lbl_numeroComprobanteRecibo=No. Comprobante/Recibo +lbl_fechaDecomiso=Fecha actividad de control +lbl_sinDocumento=Sin No. Documento +lbl_cargarDocumentoDecomiso=Carga Documento Actividad de Control + + + +#Certificado Fiscalia +lbl_cargarCertificadoFiscalia=Solicitud de Certificado +lbl_fiscalianrosolicitud=No. Solicitud +lbl_fiscalianombresolicitud=Nombre Solicitante +lbl_fiscalianroinstruccionfiscal=No. Expediente Fiscal +lbl_fiscalianfechaActual=Fecha Actual +lbl_fiscalianroficiofiscal=No. Oficio Fiscal\u00eda +lbl_mensaje_noseencuentrandatosserie=No se encuentras datos, ingrese la serie, para generar el certificado +lbl_mensaje_noseencuentrandatosperson=No se encuentras datos, ingrese la identificaci\u00f3n y/o nombres, para generar el certificado + +# +lbl_organismo_control=Organismo de Control +lbl_centro_control=Centro de Control +lbl_numero_recibo=N\u00famero Recibo +lbl_numero_armas_procesadas=N\u00famero Armas Procesados +lbl_numero_armas_error=N\u00famero de Errores +lbl_numero_armas_correctas=Armas Correctas +lbl_numoficio=No. Oficio +lbl_boton_factura=Generar Factura + +# * PAGO CON TARJETA +lbl_total_pagar=Total a Pagar +lbl_interes_tarjeta=Interes por pago con tarjeta diff --git a/frontend/src/main/resources/customer_es.properties b/frontend/src/main/resources/customer_es.properties new file mode 100644 index 0000000..170e751 --- /dev/null +++ b/frontend/src/main/resources/customer_es.properties @@ -0,0 +1,42 @@ +################################################### +##### S\u00edmbolos unicode +#####\u00e1 -> +#####\u00e9 -> +#####\u00ed -> +#####\u00f3 -> +#####\u00fa -> +#####\u00c1 -> +#####\u00c9 -> +#####\u00cd -> +#####\u00d3 -> +#####\u00da -> +#####\u00f1 -> +#####\u00d1 -> +#####\u0020 -> Espacio en blanco +################################################### + +#Cabecera de tablas +htbl_profile=PERFIL +htbl_persons=PERSONAS + +lvh_persons=PERSONAS +lvh_destinos=DESTINOS + + +############Etiquetas +lbl_area=\u00C1rea +lbl_BPMuser=Usuario BPM +lbl_branch=Sucursal +lbl_branchterminal=Terminal de la sucursal +lbl_channel=Canal +lbl_identification=Identificaci\u00F3n +lbl_language=Lenguaje +lbl_office=Oficina +lbl_nickname=Sobrenombre +lbl_person=Persona +lbl_user=Usuario +lbl_usercode=C\u00F3digo de usuario +lbl_personcode=C\u00F3digo de persona +lbl_surname=Apellido +lbl_profession=Profesi\u00f3n +lbl_maritalststus=Estado civil \ No newline at end of file diff --git a/frontend/src/main/resources/firmas_es.properties b/frontend/src/main/resources/firmas_es.properties new file mode 100644 index 0000000..5919592 --- /dev/null +++ b/frontend/src/main/resources/firmas_es.properties @@ -0,0 +1,14 @@ +lbl_codigo=C\u00F3digo +lbl_nombre=Nombre +lbl_cedula=C\u00E9dula +lbl_cargo=Cargo +lbl_unidad=Unidad +lbl_codservidor=Cod. Servidor +lbl_nomservidor=Nombre Servidor +lbl_servidor=Servidor +lbl_certificado=Certificado +lbl_vigencia=Vigencia +lbl_fechaDesde=Fecha Desde +lbl_fechaHasta=Fecha Hasta +lbl_estado=Estado +lbl_acciones=Acciones \ No newline at end of file diff --git a/frontend/src/main/resources/general_es.properties b/frontend/src/main/resources/general_es.properties new file mode 100644 index 0000000..262f5c1 --- /dev/null +++ b/frontend/src/main/resources/general_es.properties @@ -0,0 +1,442 @@ +################################################### +##### S\u00edmbolos unicode +#####\u00e1 -> \u00e1 +#####\u00e9 -> \u00e9 +#####\u00ed -> \u00ed +#####\u00f3 -> \u00f3 +#####\u00fa -> \u00fa +#####\u00c1 -> \u00c1 +#####\u00c9 -> \u00c9 +#####\u00cd -> \u00cd +#####\u00d3 -> \u00d3 +#####\u00da -> \u00da +#####\u00f1 -> \u00f1 +#####\u00d1 -> \u00d1 +#####\u0020 -> Espacio en blanco +################################################### + +dateformat=dd-MM-yyyy +lbl_numdocsitios=No. Documento +lbl_descripcionCorta=Descripci\u00f3n corta +datetimeformat=dd-MM-yyyy HH:mm:ss +numberformat= #,##,##0.000000 +time=HH:mm +decimals=2 + +#Controles Editor Prime +#source +lst_controls=bold italic underline strikethrough subscript superscript | font size style | color highlight removeformat | bullets numbering | outdent indent | alignleft center alignright justify | undo redo | rule image link unlink | cut copy paste pastetext | print + +#URL Images +url_blanck=/resources/images/blanck.jpg +url_green=/resources/images/green.jpg +url_red=/resources/images/red.jpg + +#Botones +btn_cancell=Cancelar +btn_controlcambios=Existe cambios pendientes, desea recargar la p\u00e1gina?. (Si) Perder\u00e1 los cambios realizados. +btn_create=Crear +btn_add=Agregar +btn_aceptar=Aceptar +btn_delete= +btn_edit= +btn_show= +btn_query= +btn_next= +btn_previous= +btn_save=Grabar +btn_update=Actualizar +btn_exit=Salir +btn_last=Anterior +btn_signature=Firmar +btn_confirmTask=Est\u00e1 seguro de completar la tarea? +btn_confirmFlow=Est\u00e1 seguro de Continuar el Tr\u00e1mite? +btn_transaction=Transacci\u00f3n (F2) +btn_reload=Recargar (F4) +btn_queryTran=Consultar (F5) +btn_saveTran=Guardar (F10) +btn_helpTran=Ayuda (F1) + +#Cabecera de tablas +htbl_catalog=CAT\u00c1LOGO +htbl_catalogdetail=DETALLE DE CAT\u00c1LOGO +htbl_password=CAMBIO DE CONTRASE\u00d1A +htbl_transaction=TRANSACCI\u00d3N +htbl_parameters=PAR\u00c1METROS +htbl_secutiryPolicies=POL\u00cdTICAS DE SEGURIDAD +htbl_address=DIRECCIONES +htbl_phones=TEL\u00c9FONOS +htbl_terminal=TERMINALES +htbl_profile=PERFIL +htbl_profiles=PERFILES +htbl_daysnotaccounting=D\u00cdAS NO CONTABLES +htbl_accountingdays=D\u00cdAS CONTABLES +htbl_product=PRODUCTOS +htbl_generals=GENERALES +htbl_subproduct=SUBPRODUCTOS +htbl_subproductcurrency=MONEDAS POR SUBPRODUCTO +htbl_messages=MENSAJES +htbl_module=M\u00d3DULOS +htbl_menus=MEN\u00daS +htbl_balancetype=TIPOS DE SALDO +htbl_balancetypedetail=DETALLE DE TIPOS DE SALDO +htbl_menulevel=NIVEL DE MEN\u00da +htbl_template=PLANTILLA +htbl_offices=OFICINAS +htbl_branches=SUCURSALES +htbl_compmantenimiento=COMPONENTES DE MANTENIMIENTO +htbl_componentes=COMPONENTES DE NEGOCIO +htbl_economicactivity=ACTIVIDAD ECON\u00d3MICA +htbl_rule=FLUJOS / REGLAS +htbl_message=MENSAJE +htbl_branch=SUCURSAL +htbl_catalogo=CAT\u00c1LOGO +htbl_menusublevel=SUBNIVEL DE MEN\u00da +htbl_process=PROCESO +htbl_usuario=USUARIO +htbl_server=SERVIDOR +htbl_table=TABLA + +lvh_table=TABLA + +lvh_economicactivity=ACTIVIDAD ECON\u00d3MICA +lvh_balancetype=TIPO DE SALDO +lvh_rule=FLUJOS / REGLAS +lvh_message=MENSAJE +lvh_branch=SUCURSAL +lvh_catalogo=CAT\u00c1LOGO +lvh_menulevel=NIVEL DE MEN\u00da +lvh_menusublevel=SUBNIVEL DE MEN\u00da +lvh_process=PROCESO +lvh_profiles=PERFILES +lvh_transaction=TRANSACCI\u00d3N +lvh_usuario=USUARIO +lvh_help=AYUDA + +#TIENE QUE IR EN MAYUSCULAR POR ESTANDAR +lbl_filters=FILTROS DE B\u00daSQUEDA +#TIENE QUE IR EN MAYUSCULAR POR ESTANDAR +lbl_parametersgenerationdates=PAR\u00c1METROS GENERACI\u00d3N FECHAS CONTABLES + + +#Etiquetas +lbl_pendding_changes=MODIFICACIONES PENDIENTES +lbl_acco_date=Fecha contable +lbl_affectimmobilization=Afecta inmobilizaci\u00f3n +lbl_area=\u00c1rea +lbl_autoquery=Consulta autom\u00e1tica +lbl_branch=Sucursal +lbl_initbranch=Sucursal inicial +lbl_endbranch=Sucursal final +lbl_branchamong=Intersucursales +lbl_cache=Cach\u00e9 +lbl_catalogo=Cat\u00e1logo +lbl_channel=Canal +lbl_day=D\u00eda +lbl_isaccounting=Contabilizar +lbl_isworking=Fecha de trabajo +lbl_executeprocessclass=Clase que ejecuta el proceso +lbl_compania=Compa\u00f1\u00eda +lbl_completeitem=Completa \u00edtem +lbl_confirmpassword=Confirmar Contrase\u00f1a +lbl_code=C\u00f3digo +lbl_query_code=C\u00f3digo de consulta +lbl_description=Descripci\u00f3n +lbl_inittdate=Fecha inicial +lbl_enddate=Fecha final +lbl_finishtime=Hora fin +lbl_flow=Flujo +lbl_inbox=Bandeja de entrada +lbl_inittime=Hora inicio +lbl_isflow=Es flujo +lbl_internal=Interna +lbl_language=Lenguaje +lbl_message=Mensaje +lbl_module=M\u00f3dulo +lbl_month=Mes +lbl_name=Nombre +lbl_office=Oficina +lbl_order=Orden +lbl_page=P\u00e1gina +lbl_password=Contrase\u00f1a +lbl_previousPassword=Contrase\u00f1a anterior +lbl_profiles=Perfiles +lbl_process=Proceso +lbl_processname=Nombre de proceso +lbl_processtype=Tipo de proceso +lbl_clase=Clase +lbl_queryagain=Consultar nuevamente +lbl_querycode=C\u00f3digo de consulta +lbl_rule=Regla +lbl_sequence=Secuencia +lbl_shortdescription=Descripci\u00f3n corta +lbl_signature=Firma +lbl_state=Estado +lbl_status=Estatus +lbl_transaction=Transacci\u00f3n +lbl_usuario=Usuario +lbl_person_code=C\u00f3digo de persona +lbl_validateamount=Validar monto +lbl_version=Versi\u00f3n +lbl_working_date=Fecha de trabajo +lbl_text_value=Valor texto +lbl_number_value=Valor num\u00e9rico +lbl_numberdoc=N\u00famero Documento +lbl_razonsocial=Nombre/Raz\u00f3n Social +lbl_generarmapa=Generar Mapa +lbl_limpiar=Limpiar +lbl_validitydays=D\u00edas de validez de la contrase\u00f1a +lbl_messagedays=N\u00famero de d\u00edas para presentar mensajes de advertencia por vencimiento de contrase\u00f1a +lbl_minlength=Longitud m\u00ednima +lbl_minnotrepeated=N\u00famero hist\u00f3rico de contrase\u00f1as no permitidas +lbl_minnumber=N\u00famero m\u00ednimo de d\u00edgitos +lbl_minspecialcharacters=N\u00famero m\u00ednimo de caracteres especiales +lbl_minuppercase=N\u00famero m\u00ednimo de letras may\u00fasculas +lbl_minlowercase=N\u00famero m\u00ednimo de letras min\u00fasculas +lbl_intentnumber=N\u00famero de intentos +lbl_identificationtype=Tipo de identificaci\u00f3n +lbl_identification=Identificaci\u00f3n +lbl_firstname=Nombre +lbl_lastname=Apellido +lbl_middlename=Segundo nombre +lbl_surname=Segundo apellido +lbl_gender=G\u00e9nero +lbl_person_height=Estatura +lbl_activitynoteconomic=Actividad no econ\u00f3mica +lbl_activityeconomic=Actividad econ\u00f3mica +lbl_economicsector=Sector econ\u00f3mico +lbl_typeclient=Tipo de cliente +lbl_profesion=Profesi\u00f3n +lbl_estadoCivil=Estado Civil +lbl_segment=Segmento +lbl_descriptionSegment=Descripci\u00f3n segmento +lbl_number=No. +lbl_addresstype=Tipo de direcci\u00f3n +lbl_principal=Principal +lbl_address=Direcci\u00f3n +lbl_phonetype=Tipo tel\u00e9fono +lbl_numaddress=No. direcci\u00f3n +lbl_numphone=No. telef\u00f3nico +lbl_numextension=No. extensi\u00f3n +lbl_country=Pa\u00eds +lbl_province=Provincia +lbl_canton=Cant\u00f3n +lbl_parroquia=Parroquia +lbl_city=Ciudad +lbl_principalstreet=Calle principal +lbl_numberhome=N\u00famero +lbl_numberdept=No. Casa/Depto. +lbl_reference=Referencia +lbl_secondstreet=Calle secundaria +lbl_urbanization=Urbanizaci\u00f3n +lbl_terminal=Terminal +lbl_macaddress=Mac +lbl_ipaddress=Ip +lbl_printer=Impresora +lbl_date=Fecha +lbl_duration=Duraci\u00f3n +lbl_information=Informaci\u00f3n +lbl_value=Valor +lbl_creation=Creaci\u00f3n +lbl_history=Historia +lbl_generatereport=Generar reporte +lbl_messages=Mensajes +lbl_select_option=Seleccione una opci\u00f3n +lbl_action=Acci\u00f3n +lbl_product=Producto +lbl_subproduct=Subproducto +lbl_subproductcurrency=Subproductos por moneda +lbl_initials=Iniciales +lbl_category=Categor\u00eda +lbl_balancetype=Tipo de saldo +lbl_balancegroup=Grupo de balance +lbl_charges=Cargos +lbl_chargesintable=Cargos por tabla +lbl_menu=Men\u00fa +lbl_loading=Cargando +lbl_currency=Moneda +lbl_currencycharge=Moneda cargo +lbl_minamount=Monto m\u00ednimo +lbl_maxamount=Monto m\u00e1ximo +lbl_rate=Tasa +lbl_percentage=Porcentaje +lbl_minvalue=Valor m\u00ednimo +lbl_maxvalue=Valor m\u00e1ximo +lbl_menulevel=Nivel men\u00fa +lbl_menusublevel=Subnivel men\u00fa +lbl_transactionlevel=Transacci\u00f3n por nivel +lbl_transactionsublevel=Transacci\u00f3n por subnivel +lbl_levels=Niveles +lbl_template=Plantilla +lbl_edit=Crear +lbl_createoredit=Crear / Editar +lbl_task=Tarea +lbl_completetask=Completar Tarea +lbl_options=OPCIONES +lbl_profile=Perfil +lbl_phone=Tel\u00e9fono +lbl_group=Grupo +lbl_classname=Clase +lbl_automatic=Autom\u00e1tico +lbl_service=Servicio +lbl_services=SERVICIOS +lbl_folder=Carpeta +lbl_upload=Subir archivos +lbl_descargarsubir=DESCARGAR/SUBIR DOCUMENTOS +lbl_firstnames=Nombres +lbl_lastnames=Apellidos +lbl_documentos=Documentos +lbl_imprimir=Imprimir +lbl_firmadoDoc=Firmar documento +lbl_motivo=Motivo +lbl_confirmTask=CONFIRMAR TAREA +lbl_confirmInitFlow=CONFIRMAR CONTINUAR TR\u00c1MITE +lbl_transaccion_no_existe=Transacci\u00f3n no definida para el perfil seleccionado. +lbl_auxiliar=Auxiliar +lbl_seleccionar=Seleccionar +lbl_subir=Subir +lbl_cancelar=Cancelar +lbl_correo_electronico=Correo Electr\u00f3nico + +#Etuqueta YES/NO +lbl_yes=SI +lbl_no=NO + +#Auditoria +lbl_table=Tabla +lbl_client=Cliente +lbl_filed=Campo +lbl_currentvalue=Valor actual +lbl_previousvalue=Valor anterior +lbl_realDate= Fecha real +lbl_accounting=Cuenta +lbl_insert=Inserci\u00f3n +lbl_delete=Eliminaci\u00f3n + +#Mensajes de validacion +msg_val_email=E-mail no v\u00e1lido + +#Mensajes +msg_catalogrequird=TRANSACCI\u00d3N REQUERIDA +msg_filterrequird=INGRESE UN CRITERIO DE B\u00daSQUEDA +msg_transactionrequird=TRANSACCI\u00d3N REQUERIDA +msg_modulerequird=M\u00d3DULO REQUERIDO +msg_productrequird=PRODUCTO REQUERIDO +msg_subproductrequird=SUBPRODUCTO REQUERIDO +msg_passwordnomatch=CONTRASE\u00d1A NO COINCIDE +msg_passwordrequired=CONTRASE\u00d1A REQUERIDA +msg_querydata=CONSULTE LOS DATOS +msg_querynodata=CONSULTA NO TIENE REGISTROS +msg_requireAddress=DIRECCI\u00d3N REQUERIDA +msg_requirePhones=TEL\u00c9FONO REQUERIDO +msg_requireActivity=ACTIVIDAD ECON\u00d3MICA REQUERIDA +msg_pendingActivation=USUARIO ACTIVO +msg_userrequired=USUARIO REQUERIDO +msg_userNotFound=USUARIO NO ENCONTRADO +msg_userExist=EL USUARIO YA EXISTE +msg_grouprequird=GRUPO REQUERIDO +msg_notUserBpm=NO ES USUARIO BPM +msg_foundRecord=REGISTRO YA INGRESADO +msg_notSave=FORMULARIO NO PERMITE REALIZAR CAMBIOS +msg_notQuery=FORMULARIO NO PERMITE CONSULTA +msg_menucodeRequired=MEN\u00da REQUERIDO +msg_menulevel=Nivel men\u00fa +msg_menuNotFound=Men\u00fa no encontrado +msg_menuLevelRequired=NIVEL MEN\u00da REQUERIDO +msg_menusublevel=Subnivel men\u00fa +msg_levelNotFound=Nivel no encontrado +msg_menuSubLevelRequired=SUBNIVEL MEN\u00da REQUERIDO +msg_messageRequired=MENSAJE REQUERIDO +msg_fileTypeNotFound=Tipo de archivo no encontrado +msg_branchRequired=SUCURSAL REQUERIDA +msg_processrequired=PROCESO REQUERIDO +msg_profilerequird=PERFIL REQUERIDO +msg_validatetimehour=HORA DE FINALIZACI\u00d3N TIENE QUE SER MAYOR A LA HORA DE INICIO +msg_accodate_already_generated=LA FECHA CONTABLE YA HA SIDO GENERADA, VUELVA A RECARGAR +msg_serviceReq=SERVICIO REQUERIDO +#Mensajes alfresco +msg_error_subir_arch=OCURRI\u00d3 UN ERROR AL SUBIR EL ARCHIVO +msg_error_bajar_arch=OCURRI\u00d3 UN ERROR AL DESCARGAR EL ARCHIVO +msg_doc_no_existe=EL DOCUMENTO A BUSCAR NO EXISTE +msg_carp_no_existe=LA CARPETA {0} NO EXISTE +msg_error_consulta_docs=ERROR AL CONSULTAR LOS DOCUMENTOS +msg_invalid_file_ext=EXTENSI\u00d3N DE ARCHIVO NO PERMITIDA +msg_invalid_file_limit=LIMITE DE ARCHIVOS SUBIDOS SUPERADO +msg_location_req=SE REQUIERE LA UBICACI\u00d3N DEL ARCHIVO +msg_arch_subido_success=ARCHIVO(S) SUBIDO(S) EXITOSAMENTE +#mensajes Viaticos +msg_status_notFound=ESTADO NO ENCONTRADO +msg_funcionarioReq=FUNCIONARIO REQUERIDO +msg_fecViaticosReq=FECHAS DE VI\u00c1TICOS REQUERIDOS +msg_destinoReq=DESTINO REQUERIDO +msg_ejercicioFiscal=NO SE OBTUVO LA FECHA +msg_parametroReq=PAR\u00c1METRO REQUERIDO +msg_superaDias=SUPERA LOS 60 D\u00cdAS +msg_transporteReq=TRANSPORTE REQUERIDO +msg_codSolicitudReq=C\u00d3DIGO DE SOLICITUD REQUERIDO +msg_rubroRequerido=SE REQUERIERE AL MENOS UN RUBRO PARA LA COMISI\u00d3N +msg_fechasComReq=SE REQUIERE FECHA/HORA DE SALIDA Y LLEGADA DE LA COMISI\u00d3N +msg_solicitudReq=DEBE REGISTRAR UNA SOLICITUD +msg_ingresoTransporte=INGRESAR AL MENOS DOS REGISTROS DE TRANSPORTE +msg_codSolicitud=C\u00d3DIGO DE SOLICITUD +msg_solicitudNoRegistrada=NO SE HA REGISTRADO UNA SOLICITUD +msg_noPermiteRegistros=NO PERMITIDO EL INGRESO DE M\u00c1S REGISTROS +msg_fechaSalida=FECHA DE LLEGADA MENOR A LA FECHA DE SALIDA +msg_horaSalidaTra=HORA DE SALIDA MENOR A LA HORA DE INICIO DEL VI\u00c1TICO +msg_horaLlegasaTra=HORA LLEGADA MENOR A LA HORA DE INICIO DEL VI\u00c1TICO +msg_horaInicioTran=HORA DE SALIDA MAYOR A LA HORA DE FIN DEL VI\u00c1TICO +msg_horaFinTran=HORA DE LLEGADA MAYOR A LA HORA DE FIN DEL VI\u00c1TICO +msg_funcionarioIng=FUNCIONARIO YA INGRESADO +msg_codigoInfoReq=C\u00d3DIGO REQUERIDO +msg_fechaTransInvalid=LA HORA DE SALIDA DEL TRANSPORTE DEBE SER MAYOR A LA HORA DE LLEGADA +msg_horaTransInvalid=LA HORA DE SALIDA DE LA SOLICITUD DEBE SER MAYOR A LA HORA DE LLEGADA +msg_solicitudeNotSave=FLUJO DE TRABAJO INICIADO: SOLICITUD NO PERMITE REALIZAR CAMBIOS +msg_solicitudAnulada=SOLICITUD ANULADA +msg_solicitudRequerida=SOLICITUD REQUERIDA +msg_firmaExistente=EL DOCUMENTO YA HA SIDO FIRMADO +msg_firmaNecesaria=ES NECESARIO FIRMAR EL DOCUMENTO +msg_sinFirma=EL DOCUMENTO NO DEBE SER FIRMADO +msg_comprobantesreq=COMPROBANTES REQUERIDOS +msg_solicitudeNotSign=LA SOLICITUD NO FUE CREADA CON FIRMA ELECTR\u00d3NICA +msg_solicitudeSign=LA SOLICITUD FUE CREADA CON FIRMA ELECTR\u00d3NICA +msg_informNotSign=EL INFORME NO FUE CREADO CON FIRMA ELECTR\u00d3NICA +msg_informSign=EL INFORME FUE CREADO CON FIRMA ELECTR\u00d3NICA +msg_certificateNotParam=CERTIFICADO NO PARAMETRIZADO PARA EL USUARIO ACTUAL +msg_initFlow=FLUJO INICIADO +msg_fechaFueraRango=FECHA DE TRANSPORTE FUERA DEL PER\u00cdODO DEL VI\u00c1TICO +msg_idTaskRequired=ID DE LA TAREA REQUERIDO + +#Tab +tab_bycode=POR C\u00d3DIGO +tab_transactionprocess=PROCESO TRANSACCI\u00d3N +tab_generals=GENERALES +tab_address=DIRECCIONES +tab_telephones=TEL\u00c9FONOS +tab_menu=MEN\u00da +tab_agenda=AGENDA +tab_my_tasks=MIS TAREAS +tab_groups=GRUPOS +tab_product=PRODUCTO +tab_subproduct=SUBPRODUCTO +tab_subproductcurr=SUBPRODUCTOS POR MONEDA +tab_menulavels=NIVELES DE MEN\u00da +tab_menusublavels=SUBNIVEL MEN\u00da +tab_transactionlavel=TRANSACCIONES POR NIVEL +tab_transactionsublevel=TRANSACCIONES POR SUBNIVEL +tab_charges=CARGOS GENERALES +tab_subproductcharges=CARGOS POR SUBPRODUCTO +tab_offices=OFICINAS +tab_branches=SUCURSALES +tab_new_delete=NUEVOS/ELIMINADOS +tab_updates=ACTUALIZADOS + +#Expresiones regulares +regExp_email=^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,3})$ +lbl_digitalSign=Firma digital\: +# Dialogo de soporte +lbl_titulo_soporte=Importante\: +lbl_mensaje_soporte=\u00a1Queremos mejorar y estamos trabajando para ello!, Estamos actualizando nuestros sistemas para ofrecerle una mejor experiencia. +estado_display=display: block + +# * PAGO TARJETA +lbl_save_pay=Pagar y Guardar \ No newline at end of file diff --git a/frontend/src/main/resources/jasper.properties b/frontend/src/main/resources/jasper.properties new file mode 100644 index 0000000..11491cb --- /dev/null +++ b/frontend/src/main/resources/jasper.properties @@ -0,0 +1,10 @@ +#http://172.17.26.185:8084/jasperserver/flow.html?_flowId=searchFlow&lastMode=true +#http\://172.17.26.185\:8084/jasperserver/services/repository +#produccion +#jasperserver.repository=http\://172.17.26.182\:8081/jasperserver/services/repository +#jasperserver.reportScheduler=http\://172.17.26.182\:8081/jasperserver/services/ReportScheduler +#desarrollo +jasperserver.repository=http\://172.17.26.185\:8084/jasperserver/services/repository +jasperserver.reportScheduler=http\://172.17.26.185\:8084/jasperserver/services/ReportScheduler +jasperserver.user=jasperadmin +jasperserver.password=jasperadmin \ No newline at end of file diff --git a/frontend/src/main/resources/pentaho.properties b/frontend/src/main/resources/pentaho.properties new file mode 100644 index 0000000..4e06123 --- /dev/null +++ b/frontend/src/main/resources/pentaho.properties @@ -0,0 +1,10 @@ +#Credenciales BI-SERVER PENTAHO +url_pentaho=http\://10.1.30.104\:8080/pentaho/ViewAction?solution\=samples&path\=VIA&action\= +usr_pentaho= +pass_pentaho= +pentaho_authenticate=N + +#url_pentaho=http\://10.103.0.64\:8090/pentaho/ViewAction?solution\=TEST&path\=VIA&action\= +#usr_pentaho=admin +#pass_pentaho=BptAdmin2013 +#pentaho_authenticate=Y diff --git a/frontend/src/main/resources/security_es.properties b/frontend/src/main/resources/security_es.properties new file mode 100644 index 0000000..0c75086 --- /dev/null +++ b/frontend/src/main/resources/security_es.properties @@ -0,0 +1,31 @@ +################################################### +##### S\u00edmbolos unicode +#####\u00e1 -> +#####\u00e9 -> +#####\u00ed -> +#####\u00f3 -> +#####\u00fa -> +#####\u00c1 -> +#####\u00c9 -> +#####\u00cd -> +#####\u00d3 -> +#####\u00da -> +#####\u00f1 -> +#####\u00d1 -> +#####\u0020 -> Espacio en blanco +################################################### + +company=Compa\u00F1\u00EDa + +opcion=Opci\u00F3n +password=Password +profile=PERFIL + +select_company=Seleccione compa\u00F1\u00EDa +user=Usuario +lbl_change_password=Cambio Personal Password + + +lbl_heleido_terminos=He le\u00eddo y acepto los t\u00e9rminos y condiciones de uso +lbl_descarga_terminos=Descargue sus trminos y condiciones +lbl_aceptar_terminos=Aceptar trminos y condiciones \ No newline at end of file diff --git a/frontend/src/main/resources/validation_es.properties b/frontend/src/main/resources/validation_es.properties new file mode 100644 index 0000000..6118bbf --- /dev/null +++ b/frontend/src/main/resources/validation_es.properties @@ -0,0 +1,64 @@ +################################################### +##### S\u00edmbolos unicode +#####\u00e1 -> +#####\u00e9 -> +#####\u00ed -> +#####\u00f3 -> +#####\u00fa -> +#####\u00c1 -> +#####\u00c9 -> +#####\u00cd -> +#####\u00d3 -> +#####\u00da -> +#####\u00f1 -> +#####\u00d1 -> +#####\u0020 -> Espacio en blanco +################################################### + +# Archivo de propiedades de mensajepara las validaciones de jsf + +javax.faces.component.UIInput.REQUIRED = Valor obligatorio. +javax.faces.component.UIInput.REQUIRED_detail = Valor obligatorio. + +javax.faces.converter.BigDecimalConverter.DECIMAL=''{0}'' Debe ser un nmero decimal. +javax.faces.converter.BigDecimalConverter.DECIMAL_detail= El campo solo acepta n\u00FAmeros decimales. Ejemplo\: {1} +javax.faces.converter.BigIntegerConverter.BIGINTEGER=''{0}'' Entero de uno o mu00e1s d\u00EDgitos. +javax.faces.converter.BigIntegerConverter.BIGINTEGER_detail=''{0}'' Entero de uno o m\u00E1s d\u00EDgitos. +javax.faces.converter.BooleanConverter.BOOLEAN=''{0}'' Solo acepta 'Verdadero' o 'Falso'. +javax.faces.converter.BooleanConverter.BOOLEAN_detail=''{0}'' Solo acepta 'Verdadero' o 'Falso'. +javax.faces.converter.ByteConverter.BYTE=''{0}'' Debe se un n\u00FAmero entre 0 y 255. +javax.faces.converter.ByteConverter.BYTE_detail=''{0}'' Debe ser un n\u00FAmero entre 0 y 255. +javax.faces.converter.CharacterConverter.CHARACTER=''{0}'' Debe ser un car\u00E1cter v\u00E1lido. +javax.faces.converter.CharacterConverter.CHARACTER_detail=''{0}'' Debe ser un car\u00E1cter ASCII v\u00E1lido. +javax.faces.converter.DateTimeConverter.DATE=''{0}'' Formato de fecha incorrecto. Ejemplo: {1} +javax.faces.converter.DateTimeConverter.DATE_detail=''{0}'' Formato de fecha incorrecto. Ejemplo: {1} +javax.faces.converter.DateTimeConverter.TIME=''{0}'' Formato de hora incorrecto. +javax.faces.converter.DateTimeConverter.TIME_detail=''{0}'' Formato de hora incorrecto. Ejemplo: {1} +javax.faces.converter.DateTimeConverter.DATETIME=''{0}'' Formato de fecha u hora incorrecto. +javax.faces.converter.DateTimeConverter.DATETIME_detail=''{0}'' Formato de fecha u hora incorrecto. Ejemplo: {1} +javax.faces.converter.DateTimeConverter.PATTERN_TYPE=Un 'modelo' o 'tipo' de atributo debe ser especificado para convertir el valor ''{0}''. +javax.faces.converter.DoubleConverter.DOUBLE=''{0}'' Debe ser un n\u00FAmero de uno o m\u00E1s d\u00EDgitos. +javax.faces.converter.DoubleConverter.DOUBLE_detail=''{0}'' Debe ser un n\u00FAmero entre 4.9E-324 and 1.7976931348623157E308 Ejemplo\: {1} +javax.faces.converter.EnumConverter.ENUM=''{0}'' Debe ser convertible a una enumeracin. +javax.faces.converter.EnumConverter.ENUM_detail=''{0}'' Convertible a una enumeracin de la enumeracin que contiene la constante ''{1}''. +javax.faces.converter.EnumConverter.ENUM_NO_CLASS=''{0}'' Debe ser convertible a una enumeracin, pero no se provee la clase. +javax.faces.converter.EnumConverter.ENUM_NO_CLASS_detail=''{0}'' Debe ser convertible a una enumeracin, pero no se provee la clase. +javax.faces.converter.FloatConverter.FLOAT=''{0}'' Debe ser un n\u00FAmero de uno o m\u00E1s d\u00EDgitos. +javax.faces.converter.FloatConverter.FLOAT_detail=''{0}'' Debe ser un n\u00FAmero entre 1.4E-45 y 3.4028235E38 Ejemplo\: {1} +javax.faces.converter.IntegerConverter.INTEGER=''{0}'' Debe ser un n\u00FAmero de uno o m\u00E1s d\u00EDgitos. +javax.faces.converter.IntegerConverter.INTEGER_detail=''{0}'' Debe ser un n\u00FAmero entre -2147483648 y 2147483647 Ejemplo\: {1} +javax.faces.converter.LongConverter.LONG=''{0}'' Debe ser un n\u00FAmero de uno o m\u00E1s d\u00EDgitos. +javax.faces.converter.LongConverter.LONG_detail=''{0}'' Debe ser un n\u00FAmero entre -9223372036854775808 y 9223372036854775807 Ejemplo\: {1} +javax.faces.converter.NumberConverter.CURRENCY=''{0}'' Formato de moneda incorrecto. +javax.faces.converter.NumberConverter.CURRENCY_detail=''{0}'' Formato de moneda incorrecto. Ejemplo: {1} +javax.faces.converter.NumberConverter.PERCENT=''{0}'' Formato de porcentaje incorrecto. +javax.faces.converter.NumberConverter.PERCENT_detail=''{0}'' Formato de porcentaje incorrecto. Ejemplo: {1} +javax.faces.converter.NumberConverter.NUMBER=''{0}'' No es un n\u00FAmero. +javax.faces.converter.NumberConverter.NUMBER_detail=''{0}'' No es un n\u00FAmero. Ejemplo\: {1} +javax.faces.converter.NumberConverter.PATTERN=''{0}'' No es un n\u00FAmero modelo. +javax.faces.converter.NumberConverter.PATTERN_detail=''{0}'' No es un n\u00FAmero modelo. Ejemplo\: {1} +javax.faces.converter.ShortConverter.SHORT=''{0}'' Debe ser un n\u00FAmero de uno o m\u00E1s d\u00EDgitos. +javax.faces.converter.ShortConverter.SHORT_detail=''{0}'' Debe ser un n\u00FAmero entre -32768 y 32767. Ejemplo\: {1} +javax.faces.converter.STRING=No se puede convertir ''{0}'' a un string. + +org.primefaces.component.datatable.emptyMesssage=No existen registros \ No newline at end of file diff --git a/frontend/src/main/resources/viaticos_es.properties b/frontend/src/main/resources/viaticos_es.properties new file mode 100644 index 0000000..c7e54ac --- /dev/null +++ b/frontend/src/main/resources/viaticos_es.properties @@ -0,0 +1,146 @@ +################################################### +##### S\u00edmbolos unicode +#####\u00e1 -> +#####\u00e9 -> +#####\u00ed -> +#####\u00f3 -> +#####\u00fa -> +#####\u00c1 -> +#####\u00c9 -> +#####\u00cd -> +#####\u00d3 -> +#####\u00da -> +#####\u00F1 -> +#####\u00d1 -> +#####\u0020 -> Espacio en blanco +####### +#primefaces + + +#ETIQUETAS +lbl_funcionario=Funcionario +lbl_nomResDirFin=Responsable Direcci\u00F3n Nacional Financiera +lbl_tipoReporte=Tipo de reporte +lbl_exportar=Exportaci\u00F3n +lbl_gastos=Gastos +lbl_actividadesInforme=Informe de actividades y productos alcanzados +tab_liquidacionVia=LIQUIDACI\u00D3N DE VI\u00C1TICOS Y SUBSISTENCIAS +tab_informeservicios=INFORME DE SERVICIOS INSTITUCIONALES +lbl_codigo=C\u00F3digo +lbl_Editar=Editar +lbl_Ver=Ver +lbl_Eliminar=Eliminar +lbl_solicitud=Solicitud +lbl_valnum=Valor num\u00E9rico +lbl_valalpha=Valor alfanum\u00E9rico +lbl_descripcion=Descripci\u00F3n +lbl_estadosol=Estado de solicitud +lbl_diascomciu=D\u00EDas acumulados ciudad inclu\u00EDda comisi\u00F3n +lbl_diascomision=D\u00EDas comisi\u00F3n acumulados +lbl_jefe=Jefe inmediato +lbl_responsableund=Responsable unidad +lbl_numerocred=N\u00FAmero credencial +lbl_fecha=Fecha +lbl_viaticos=Vi\u00E1ticos +lbl_codSolicitud=C\u00F3digo de Solicitud +lbl_fechaDesde=Fecha Desde +lbl_fechaHasta=Fecha Hasta +lbl_fechaComision=Fecha de comisi\u00F3n de servicios +lbl_estadosSolicitud=Estados de la solicitud de vi\u00E1ticos +lbl_desde=Desde +lbl_hasta=Hasta +lbl_nomRespUni=Nombre - Responsable de la Unidad solicitante +lbl_nomAutoridadNomi=Nombre - Jefe Inmediato +lbl_cargoAutoridad=Cargo - Jefe Inmediato +htbl_estados=Consulta de estados de solicitud de vi\u00E1ticos +lbl_movilizacion=Movilizaciones +lbl_subsistencia=Subsistencias +lbl_alimentacion=Alimentaci\u00F3n +lbl_nombre=Nombre +lbl_cedula=C\u00E9dula +lbl_cargo=Cargo +lbl_unidad=Unidad +lbl_ciudadcom=Ciudad/Provincia comisi\u00F3n +lbl_fechasalida=Fecha salida +lbl_fechallegada=Fecha llegada +lbl_horasalida=Hora salida +lbl_horallegada=Hora llegada +lbl_rubro=Rubro +lbl_descactividades=Descripci\u00F3n de actividades +lbl_infoActividades=Informe de actividades y productos alcanzados +lbl_integrantes=Integrantes de servicios institucionales +lbl_detalleComprobantes=Detalle de comprobante de pago +lbl_comprobante=Comprobante de pago +lbl_empresaServicio=Empresa o Servicio +lbl_ruc=Ruc +lbl_tipo=Tipo +lbl_importe=Importe +lbl_diascom=D\u00EDas comisi\u00F3n +lbl_nombrefun=Nombre del funcionario +lbl_transporte=Nombre de transporte +lbl_ruta=Ruta +lbl_salida=Salida +lbl_llegada=Llegada +lbl_hora=Hora +lbl_tiptransporte=Tipo de transporte +lbl_numcuenta=N\u00FAmero de cuenta +lbl_tipcuenta=Tipo de cuenta +lbl_nombanco=Nombre del banco +lbl_nomarchivo=Nombre del archivo +lbl_alimetacion=Alimentaci\u00F3n +lbl_cargojefe=Cargo jefe +lbl_cargoresp=Cargo responsable +lbl_calculadias=Calcular d\u00EDas acumulados +lbl_inicarFlujo=Iniciar flujo +lbl_responsable=Responsable +lbl_actividad=Actividad +lbl_estado=Estado +lbl_comentarios=Comentarios +lbl_salir=Salir +lbl_diasacumulados=D\u00EDas acumulados +lbl_periodo=Per\u00EDodo +lbl_destino=Destino +lbl_usuario=Usuario +lbl_ciudad=Ciudad +lbl_nomusuario=Nombre de usuario +lbl_nomciudad=Nombre de ciudad +lbl_ingresaSol=Solicitud ingresada por el Servidor +lbl_subtotalTransporte=Subtotal de transporte +lbl_subtotalAlojamientoAlm=Subtotal alimentaci\u00F3n y alojamiento +lbl_totalGastos=Total de gastos +lbl_ver=Ver +lbl_lugarFecha=Lugar y fecha +lbl_cancelar=Cancelar +lbl_detalle=Detalle +lbl_detalleIntegrantes= Integrante de servicios institucionales + +#TITULOS + +#ETIQUETAS CABECERA TABLAS +htbl_parametros=Par\u00E1metros +htbl_destinos=Destinos +htbl_diasacumulados=D\u00EDas acumulados +htbl_usauriosciudad=Usuarios por ciudad +htbl_usauriosciudadtrans=Usuarios por ciudad tipo de transporte + +#ETIQUETAS TABS +tab_soldetalle=DETALLE DE LA SOLICITUD +tab_solautiriza=SOLICITUD DE AUTORIZACI\u00D3N PARA EL CUMPLIMIENTO DE SERVICIOS INSTITUCIONALES +tab_gendatos=DATOS GENERALES +tab_integrantes=INTEGRANTES DE SERVICIOS INSTITUCIONALES +tab_actividades=ACTIVIDADES +tab_transporte=TRANSPORTE +tab_trandatos=DATOS PARA TRANSFERENCIA +tab_archivo=ARCHIVOS + +#BOTONES +btn_descargarDocumentos=Descargar documentos +btn_anulaSolicitud=Anular solicitud +btn_firmar=Firmar + +#MENSAJES +msg_importeTotal=IMPORTE TOTAL DE VI\u00C1TICOS Y GASTOS DE VIAJES COMPROBADOS + +msg_tamanioMaximoExcedido = El valor {0}, no debe exceder los {1} caracteres. +msg_tamanioRucMinimo = El tama\u00F1o del valor ingresado es inferior al permitido (13). +msg_importeIncorrecto = El importe ingresado no est\u00E1 entre los valores esperados\: 0,01 y 9.999,99 \ No newline at end of file diff --git a/frontend/src/main/webapp/.svn/entries b/frontend/src/main/webapp/.svn/entries new file mode 100644 index 0000000..ead9708 --- /dev/null +++ b/frontend/src/main/webapp/.svn/entries @@ -0,0 +1,179 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/webapp +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +pages +dir + +app +dir + +change-password.xhtml +file + + + + +2022-07-28T03:40:15.554685Z +0d33ef7b1e7988146756c9b72a705250 +2021-11-16T16:51:39.601018Z +4651 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +5704 + +index.xhtml +file + + + + +2022-07-28T03:40:15.554685Z +0cdcaa3be1f997a9011827e7c134adc3 +2014-11-10T10:41:16.144812Z +2547 +dcruz + + + + + + + + + + + + + + + + + + + + + +100 + +login.xhtml +file + + + + +2022-07-28T03:40:15.554685Z +85a1596e7ff49228db62abb34e347dee +2021-11-16T16:51:39.601018Z +4651 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +5620 + +WEB-INF +dir + +errorPages +dir + +resources +dir + +passwordExpired.xhtml +file + + + + +2022-07-28T03:40:15.555685Z +e4f90b04e631b59c023d96d866278a57 +2021-11-16T16:51:39.601018Z +4651 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +1185 + diff --git a/frontend/src/main/webapp/.svn/text-base/change-password.xhtml.svn-base b/frontend/src/main/webapp/.svn/text-base/change-password.xhtml.svn-base new file mode 100644 index 0000000..1aa22b0 --- /dev/null +++ b/frontend/src/main/webapp/.svn/text-base/change-password.xhtml.svn-base @@ -0,0 +1,155 @@ + + + + + + SINCOAR + + + + + + + + + + + +
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+
+ +    + + + + + + Ingresar al Sistema + + +
+ +
+
+ + + + + + + + + + +

SU CLAVE HA SIDO CAMBIADA EXITOSAMENTE.

+
+
+
+
+ + +
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/frontend/src/main/webapp/.svn/text-base/index.xhtml.svn-base b/frontend/src/main/webapp/.svn/text-base/index.xhtml.svn-base new file mode 100644 index 0000000..6098bce --- /dev/null +++ b/frontend/src/main/webapp/.svn/text-base/index.xhtml.svn-base @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/main/webapp/.svn/text-base/login.xhtml.netbeans-base b/frontend/src/main/webapp/.svn/text-base/login.xhtml.netbeans-base new file mode 100644 index 0000000..7215d87 --- /dev/null +++ b/frontend/src/main/webapp/.svn/text-base/login.xhtml.netbeans-base @@ -0,0 +1,94 @@ + + + + + + Control de Armas + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ¿Olvidaste tu contraseña? + + + + + + + + +

+ + +
+ +
+
+
+
+
+ +
+
+ \ No newline at end of file diff --git a/frontend/src/main/webapp/.svn/text-base/login.xhtml.svn-base b/frontend/src/main/webapp/.svn/text-base/login.xhtml.svn-base new file mode 100644 index 0000000..7215d87 --- /dev/null +++ b/frontend/src/main/webapp/.svn/text-base/login.xhtml.svn-base @@ -0,0 +1,94 @@ + + + + + + Control de Armas + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ¿Olvidaste tu contraseña? + + + + + + + + +

+ + +
+ +
+
+
+
+
+ +
+
+ \ No newline at end of file diff --git a/frontend/src/main/webapp/.svn/text-base/passwordExpired.xhtml.svn-base b/frontend/src/main/webapp/.svn/text-base/passwordExpired.xhtml.svn-base new file mode 100644 index 0000000..03a6c46 --- /dev/null +++ b/frontend/src/main/webapp/.svn/text-base/passwordExpired.xhtml.svn-base @@ -0,0 +1,27 @@ + + + + + + + +

SU CLAVE HA SIDO CAMBIADA EXITOSAMENTE.

+ + + + + Ingresar al portal + + + + + + + +
+ \ No newline at end of file diff --git a/frontend/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia b/frontend/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia new file mode 100644 index 0000000..2447881 --- /dev/null +++ b/frontend/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + diff --git a/frontend/src/main/webapp/WEB-INF/.svn/entries b/frontend/src/main/webapp/WEB-INF/.svn/entries new file mode 100644 index 0000000..ee9c996 --- /dev/null +++ b/frontend/src/main/webapp/WEB-INF/.svn/entries @@ -0,0 +1,238 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/webapp/WEB-INF +svn://172.17.26.185/COMACO + + + +2020-11-16T08:48:06.664034Z +4632 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +.faces-config.xml.jsfdia +file + + + + +2022-07-28T03:40:14.544681Z +59343c028bb1ed04091d2809c7b744bf +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +1150 + +faces-config.xml +file + + + + +2022-07-28T03:40:14.544681Z +2ecaa24b84cda5b737ac4830a246b07b +2020-11-16T08:48:06.664034Z +4632 +usermaia1 + + + + + + + + + + + + + + + + + + + + + +2423 + +lib +dir + +beans.xml +file + + + + +2022-07-28T03:40:14.545681Z +7adc5582ddc405237aea0492953c2862 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +330 + +jboss-web.xml +file + + + + +2022-07-28T03:40:14.545681Z +a62b1ccb1cf39900f05998b4863146ba +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +65 + +jboss-deployment-structure.xml +file + + + + +2022-07-28T03:40:14.545681Z +fdb1b1d55cddff03d330c38d1f03a8d0 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +411 + +web.xml +file + + + + +2022-07-28T03:40:14.545681Z +52a019555eb9b46f1b27d0eeef1eac2e +2016-06-20T19:06:02.283608Z +4545 +cvasquez + + + + + + + + + + + + + + + + + + + + + +3214 + +templates +dir + diff --git a/frontend/src/main/webapp/WEB-INF/.svn/text-base/.faces-config.xml.jsfdia.svn-base b/frontend/src/main/webapp/WEB-INF/.svn/text-base/.faces-config.xml.jsfdia.svn-base new file mode 100644 index 0000000..2447881 --- /dev/null +++ b/frontend/src/main/webapp/WEB-INF/.svn/text-base/.faces-config.xml.jsfdia.svn-base @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + diff --git a/frontend/src/main/webapp/WEB-INF/.svn/text-base/beans.xml.svn-base b/frontend/src/main/webapp/WEB-INF/.svn/text-base/beans.xml.svn-base new file mode 100644 index 0000000..e79b3c2 --- /dev/null +++ b/frontend/src/main/webapp/WEB-INF/.svn/text-base/beans.xml.svn-base @@ -0,0 +1,10 @@ + + + + + + diff --git a/frontend/src/main/webapp/WEB-INF/.svn/text-base/faces-config.xml.svn-base b/frontend/src/main/webapp/WEB-INF/.svn/text-base/faces-config.xml.svn-base new file mode 100644 index 0000000..2a42831 --- /dev/null +++ b/frontend/src/main/webapp/WEB-INF/.svn/text-base/faces-config.xml.svn-base @@ -0,0 +1,65 @@ + + + + + + + + com.fp.frontend.utility.LifeCicleListener + + + + + com.fp.frontend.utility.TextAreaValidationRequired + javax.faces.event.PostValidateEvent + + + org.primefaces.application.DialogActionListener + org.primefaces.application.DialogNavigationHandler + org.primefaces.application.DialogViewHandler + + validation_es + msg_validation + + + security_es + msg_security + + + general_es + msg_general + + + customer_es + msg_customer + + + bpm_es + msg_bpm + + + controlarmas_es + msg_armas + + + firmas_es + msg_firmas + + validation_es + + + diff --git a/frontend/src/main/webapp/WEB-INF/.svn/text-base/jboss-deployment-structure.xml.netbeans-base b/frontend/src/main/webapp/WEB-INF/.svn/text-base/jboss-deployment-structure.xml.netbeans-base new file mode 100644 index 0000000..49211f8 --- /dev/null +++ b/frontend/src/main/webapp/WEB-INF/.svn/text-base/jboss-deployment-structure.xml.netbeans-base @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/frontend/src/main/webapp/WEB-INF/.svn/text-base/jboss-deployment-structure.xml.svn-base b/frontend/src/main/webapp/WEB-INF/.svn/text-base/jboss-deployment-structure.xml.svn-base new file mode 100644 index 0000000..49211f8 --- /dev/null +++ b/frontend/src/main/webapp/WEB-INF/.svn/text-base/jboss-deployment-structure.xml.svn-base @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/frontend/src/main/webapp/WEB-INF/.svn/text-base/jboss-web.xml.netbeans-base b/frontend/src/main/webapp/WEB-INF/.svn/text-base/jboss-web.xml.netbeans-base new file mode 100644 index 0000000..bc3149c --- /dev/null +++ b/frontend/src/main/webapp/WEB-INF/.svn/text-base/jboss-web.xml.netbeans-base @@ -0,0 +1,4 @@ + + + + diff --git a/frontend/src/main/webapp/WEB-INF/.svn/text-base/jboss-web.xml.svn-base b/frontend/src/main/webapp/WEB-INF/.svn/text-base/jboss-web.xml.svn-base new file mode 100644 index 0000000..bc3149c --- /dev/null +++ b/frontend/src/main/webapp/WEB-INF/.svn/text-base/jboss-web.xml.svn-base @@ -0,0 +1,4 @@ + + + + diff --git a/frontend/src/main/webapp/WEB-INF/.svn/text-base/web.xml.svn-base b/frontend/src/main/webapp/WEB-INF/.svn/text-base/web.xml.svn-base new file mode 100644 index 0000000..5927ad5 --- /dev/null +++ b/frontend/src/main/webapp/WEB-INF/.svn/text-base/web.xml.svn-base @@ -0,0 +1,112 @@ + + + + Web PrimeFaces + + web-primefaces + + + Manejo del timeout de session + TimeoutManagerFilter + com.fp.frontend.filter.TimeoutManagerFilter + + + + Servlet que se encarga de enviar la informacion comprimida + Compresion + com.fp.frontend.filter.GZIPFilter + + + + PrimeFaces FileUpload Filter + org.primefaces.webapp.filter.FileUploadFilter + + + + PrimeFaces FileUpload Filter + Faces Servlet + + + + TimeoutManagerFilter + /* + + + + Compresion + *.jsp + + + + Compresion + *.jsf + + + + Compresion + *.html + + + + Compresion + *.xhtml + + + + Compresion + *.js + + + + Compresion + *.css + + + + + + javax.faces.PROJECT_STAGE + Production + + + primefaces.THEME + maia-theme + + + javax.faces.FACELETS_SKIP_COMMENTS + true + + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + + Faces Servlet + *.xhtml + + + + Faces Servlet + *.faces + + + + + index.xhtml + + + + javax.faces.application.ViewExpiredException + /login.xhtml + + + + 60 + + \ No newline at end of file diff --git a/frontend/src/main/webapp/WEB-INF/beans.xml b/frontend/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 0000000..e79b3c2 --- /dev/null +++ b/frontend/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/frontend/src/main/webapp/WEB-INF/faces-config.xml b/frontend/src/main/webapp/WEB-INF/faces-config.xml new file mode 100644 index 0000000..2a42831 --- /dev/null +++ b/frontend/src/main/webapp/WEB-INF/faces-config.xml @@ -0,0 +1,65 @@ + + + + + + + + com.fp.frontend.utility.LifeCicleListener + + + + + com.fp.frontend.utility.TextAreaValidationRequired + javax.faces.event.PostValidateEvent + + + org.primefaces.application.DialogActionListener + org.primefaces.application.DialogNavigationHandler + org.primefaces.application.DialogViewHandler + + validation_es + msg_validation + + + security_es + msg_security + + + general_es + msg_general + + + customer_es + msg_customer + + + bpm_es + msg_bpm + + + controlarmas_es + msg_armas + + + firmas_es + msg_firmas + + validation_es + + + diff --git a/frontend/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/frontend/src/main/webapp/WEB-INF/jboss-deployment-structure.xml new file mode 100644 index 0000000..49211f8 --- /dev/null +++ b/frontend/src/main/webapp/WEB-INF/jboss-deployment-structure.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/frontend/src/main/webapp/WEB-INF/jboss-web.xml b/frontend/src/main/webapp/WEB-INF/jboss-web.xml new file mode 100644 index 0000000..bc3149c --- /dev/null +++ b/frontend/src/main/webapp/WEB-INF/jboss-web.xml @@ -0,0 +1,4 @@ + + + + diff --git a/frontend/src/main/webapp/WEB-INF/lib/.svn/entries b/frontend/src/main/webapp/WEB-INF/lib/.svn/entries new file mode 100644 index 0000000..edf4af9 --- /dev/null +++ b/frontend/src/main/webapp/WEB-INF/lib/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/webapp/WEB-INF/lib +svn://172.17.26.185/COMACO + + + +2015-12-03T18:39:09.005172Z +4329 +mcepeda + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +gmaps4jsf-core-3.0.0.jar +file + + + + +2022-07-28T03:40:14.455681Z +eb02e7c7a9efeac9236c4b6cd411f8a5 +2015-12-03T18:39:09.005172Z +4329 +mcepeda +has-props + + + + + + + + + + + + + + + + + + + + +142054 + diff --git a/frontend/src/main/webapp/WEB-INF/lib/.svn/prop-base/gmaps4jsf-core-3.0.0.jar.svn-base b/frontend/src/main/webapp/WEB-INF/lib/.svn/prop-base/gmaps4jsf-core-3.0.0.jar.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/frontend/src/main/webapp/WEB-INF/lib/.svn/prop-base/gmaps4jsf-core-3.0.0.jar.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/frontend/src/main/webapp/WEB-INF/lib/.svn/text-base/gmaps4jsf-core-3.0.0.jar.svn-base b/frontend/src/main/webapp/WEB-INF/lib/.svn/text-base/gmaps4jsf-core-3.0.0.jar.svn-base new file mode 100644 index 0000000..883c9a3 Binary files /dev/null and b/frontend/src/main/webapp/WEB-INF/lib/.svn/text-base/gmaps4jsf-core-3.0.0.jar.svn-base differ diff --git a/frontend/src/main/webapp/WEB-INF/lib/gmaps4jsf-core-3.0.0.jar b/frontend/src/main/webapp/WEB-INF/lib/gmaps4jsf-core-3.0.0.jar new file mode 100644 index 0000000..883c9a3 Binary files /dev/null and b/frontend/src/main/webapp/WEB-INF/lib/gmaps4jsf-core-3.0.0.jar differ diff --git a/frontend/src/main/webapp/WEB-INF/templates/.svn/entries b/frontend/src/main/webapp/WEB-INF/templates/.svn/entries new file mode 100644 index 0000000..8a79617 --- /dev/null +++ b/frontend/src/main/webapp/WEB-INF/templates/.svn/entries @@ -0,0 +1,96 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/webapp/WEB-INF/templates +svn://172.17.26.185/COMACO + + + +2015-12-03T18:38:33.144895Z +4328 +mcepeda + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +queryEvent.xhtml +file + + + + +2022-07-28T03:40:14.523681Z +bf0a3035aceed9244fc2209f19116488 +2014-09-11T11:14:33.272242Z +685 +jvaca + + + + + + + + + + + + + + + + + + + + + +1904 + +template.xhtml +file + + + + +2022-07-28T03:40:14.523681Z +c0c14b4ea7e5fabe00e5dc3ecdc3a16d +2015-12-03T18:38:33.144895Z +4328 +mcepeda + + + + + + + + + + + + + + + + + + + + + +1854 + diff --git a/frontend/src/main/webapp/WEB-INF/templates/.svn/text-base/queryEvent.xhtml.svn-base b/frontend/src/main/webapp/WEB-INF/templates/.svn/text-base/queryEvent.xhtml.svn-base new file mode 100644 index 0000000..98b7eee --- /dev/null +++ b/frontend/src/main/webapp/WEB-INF/templates/.svn/text-base/queryEvent.xhtml.svn-base @@ -0,0 +1,27 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/frontend/src/main/webapp/WEB-INF/templates/.svn/text-base/template.xhtml.netbeans-base b/frontend/src/main/webapp/WEB-INF/templates/.svn/text-base/template.xhtml.netbeans-base new file mode 100644 index 0000000..bce367e --- /dev/null +++ b/frontend/src/main/webapp/WEB-INF/templates/.svn/text-base/template.xhtml.netbeans-base @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frontend/src/main/webapp/WEB-INF/templates/.svn/text-base/template.xhtml.svn-base b/frontend/src/main/webapp/WEB-INF/templates/.svn/text-base/template.xhtml.svn-base new file mode 100644 index 0000000..bce367e --- /dev/null +++ b/frontend/src/main/webapp/WEB-INF/templates/.svn/text-base/template.xhtml.svn-base @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frontend/src/main/webapp/WEB-INF/templates/queryEvent.xhtml b/frontend/src/main/webapp/WEB-INF/templates/queryEvent.xhtml new file mode 100644 index 0000000..98b7eee --- /dev/null +++ b/frontend/src/main/webapp/WEB-INF/templates/queryEvent.xhtml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/frontend/src/main/webapp/WEB-INF/templates/template.xhtml b/frontend/src/main/webapp/WEB-INF/templates/template.xhtml new file mode 100644 index 0000000..1581227 --- /dev/null +++ b/frontend/src/main/webapp/WEB-INF/templates/template.xhtml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frontend/src/main/webapp/WEB-INF/web.xml b/frontend/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..5927ad5 --- /dev/null +++ b/frontend/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,112 @@ + + + + Web PrimeFaces + + web-primefaces + + + Manejo del timeout de session + TimeoutManagerFilter + com.fp.frontend.filter.TimeoutManagerFilter + + + + Servlet que se encarga de enviar la informacion comprimida + Compresion + com.fp.frontend.filter.GZIPFilter + + + + PrimeFaces FileUpload Filter + org.primefaces.webapp.filter.FileUploadFilter + + + + PrimeFaces FileUpload Filter + Faces Servlet + + + + TimeoutManagerFilter + /* + + + + Compresion + *.jsp + + + + Compresion + *.jsf + + + + Compresion + *.html + + + + Compresion + *.xhtml + + + + Compresion + *.js + + + + Compresion + *.css + + + + + + javax.faces.PROJECT_STAGE + Production + + + primefaces.THEME + maia-theme + + + javax.faces.FACELETS_SKIP_COMMENTS + true + + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + + Faces Servlet + *.xhtml + + + + Faces Servlet + *.faces + + + + + index.xhtml + + + + javax.faces.application.ViewExpiredException + /login.xhtml + + + + 60 + + \ No newline at end of file diff --git a/frontend/src/main/webapp/app/.svn/entries b/frontend/src/main/webapp/app/.svn/entries new file mode 100644 index 0000000..52e901c --- /dev/null +++ b/frontend/src/main/webapp/app/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/webapp/app +svn://172.17.26.185/COMACO + + + +2015-04-23T06:16:12.706922Z +4051 +cpiedra + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +bcprov-ext-jdk15on-1.49.jar +file + + + + +2022-07-28T03:40:14.265680Z +5d295451a3272515afbdef2927e31787 +2014-10-15T07:08:20.264330Z +1608 +cguzman +has-props + + + + + + + + + + + + + + + + + + + + +2552449 + +bcprov-jdk15on-1.49.jar +file + + + + +2022-07-28T03:40:14.268680Z +20f367d41a546f2c844314da5d97ea12 +2014-10-15T07:08:20.264330Z +1608 +cguzman +has-props + + + + + + + + + + + + + + + + + + + + +2476362 + +itextpdf-5.5.3.jar +file + + + + +2022-07-28T03:40:14.271680Z +1f8b7633f9f21668d178566e9e85fe7c +2014-10-15T07:08:20.264330Z +1608 +cguzman +has-props + + + + + + + + + + + + + + + + + + + + +2237618 + +appletFirma-2.1.jar +file + + + + +2022-07-28T03:40:14.272680Z +689146e46aa33f58eab5ebd0ec954760 +2015-04-23T06:16:12.706922Z +4051 +cpiedra +has-props + + + + + + + + + + + + + + + + + + + + +45946 + +bcmail-jdk15on-1.51.jar +file + + + + +2022-07-28T03:40:14.272680Z +0d1ea26cfdf65bf19e2d050d1d673b43 +2014-10-15T07:08:20.264330Z +1608 +cguzman +has-props + + + + + + + + + + + + + + + + + + + + +95486 + +bcpkix-jdk15on-1.49.jar +file + + + + +2022-07-28T03:40:14.273680Z +cb025ef84fb991e14fdf62f6bef7be53 +2014-10-15T07:08:20.264330Z +1608 +cguzman +has-props + + + + + + + + + + + + + + + + + + + + +629662 + diff --git a/frontend/src/main/webapp/app/.svn/prop-base/appletFirma-2.1.jar.svn-base b/frontend/src/main/webapp/app/.svn/prop-base/appletFirma-2.1.jar.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/frontend/src/main/webapp/app/.svn/prop-base/appletFirma-2.1.jar.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/frontend/src/main/webapp/app/.svn/prop-base/bcmail-jdk15on-1.51.jar.svn-base b/frontend/src/main/webapp/app/.svn/prop-base/bcmail-jdk15on-1.51.jar.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/frontend/src/main/webapp/app/.svn/prop-base/bcmail-jdk15on-1.51.jar.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/frontend/src/main/webapp/app/.svn/prop-base/bcpkix-jdk15on-1.49.jar.svn-base b/frontend/src/main/webapp/app/.svn/prop-base/bcpkix-jdk15on-1.49.jar.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/frontend/src/main/webapp/app/.svn/prop-base/bcpkix-jdk15on-1.49.jar.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/frontend/src/main/webapp/app/.svn/prop-base/bcprov-ext-jdk15on-1.49.jar.svn-base b/frontend/src/main/webapp/app/.svn/prop-base/bcprov-ext-jdk15on-1.49.jar.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/frontend/src/main/webapp/app/.svn/prop-base/bcprov-ext-jdk15on-1.49.jar.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/frontend/src/main/webapp/app/.svn/prop-base/bcprov-jdk15on-1.49.jar.svn-base b/frontend/src/main/webapp/app/.svn/prop-base/bcprov-jdk15on-1.49.jar.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/frontend/src/main/webapp/app/.svn/prop-base/bcprov-jdk15on-1.49.jar.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/frontend/src/main/webapp/app/.svn/prop-base/itextpdf-5.5.3.jar.svn-base b/frontend/src/main/webapp/app/.svn/prop-base/itextpdf-5.5.3.jar.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/frontend/src/main/webapp/app/.svn/prop-base/itextpdf-5.5.3.jar.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/frontend/src/main/webapp/app/.svn/text-base/appletFirma-2.1.jar.svn-base b/frontend/src/main/webapp/app/.svn/text-base/appletFirma-2.1.jar.svn-base new file mode 100644 index 0000000..c6ba4e6 Binary files /dev/null and b/frontend/src/main/webapp/app/.svn/text-base/appletFirma-2.1.jar.svn-base differ diff --git a/frontend/src/main/webapp/app/.svn/text-base/bcmail-jdk15on-1.51.jar.svn-base b/frontend/src/main/webapp/app/.svn/text-base/bcmail-jdk15on-1.51.jar.svn-base new file mode 100644 index 0000000..c17cd32 Binary files /dev/null and b/frontend/src/main/webapp/app/.svn/text-base/bcmail-jdk15on-1.51.jar.svn-base differ diff --git a/frontend/src/main/webapp/app/.svn/text-base/bcpkix-jdk15on-1.49.jar.svn-base b/frontend/src/main/webapp/app/.svn/text-base/bcpkix-jdk15on-1.49.jar.svn-base new file mode 100644 index 0000000..96d1985 Binary files /dev/null and b/frontend/src/main/webapp/app/.svn/text-base/bcpkix-jdk15on-1.49.jar.svn-base differ diff --git a/frontend/src/main/webapp/app/.svn/text-base/bcprov-ext-jdk15on-1.49.jar.svn-base b/frontend/src/main/webapp/app/.svn/text-base/bcprov-ext-jdk15on-1.49.jar.svn-base new file mode 100644 index 0000000..cb0e0be Binary files /dev/null and b/frontend/src/main/webapp/app/.svn/text-base/bcprov-ext-jdk15on-1.49.jar.svn-base differ diff --git a/frontend/src/main/webapp/app/.svn/text-base/bcprov-jdk15on-1.49.jar.svn-base b/frontend/src/main/webapp/app/.svn/text-base/bcprov-jdk15on-1.49.jar.svn-base new file mode 100644 index 0000000..e1d4bb3 Binary files /dev/null and b/frontend/src/main/webapp/app/.svn/text-base/bcprov-jdk15on-1.49.jar.svn-base differ diff --git a/frontend/src/main/webapp/app/.svn/text-base/itextpdf-5.5.3.jar.svn-base b/frontend/src/main/webapp/app/.svn/text-base/itextpdf-5.5.3.jar.svn-base new file mode 100644 index 0000000..0cff7af Binary files /dev/null and b/frontend/src/main/webapp/app/.svn/text-base/itextpdf-5.5.3.jar.svn-base differ diff --git a/frontend/src/main/webapp/app/appletFirma-2.1.jar b/frontend/src/main/webapp/app/appletFirma-2.1.jar new file mode 100644 index 0000000..c6ba4e6 Binary files /dev/null and b/frontend/src/main/webapp/app/appletFirma-2.1.jar differ diff --git a/frontend/src/main/webapp/app/bcmail-jdk15on-1.51.jar b/frontend/src/main/webapp/app/bcmail-jdk15on-1.51.jar new file mode 100644 index 0000000..c17cd32 Binary files /dev/null and b/frontend/src/main/webapp/app/bcmail-jdk15on-1.51.jar differ diff --git a/frontend/src/main/webapp/app/bcpkix-jdk15on-1.49.jar b/frontend/src/main/webapp/app/bcpkix-jdk15on-1.49.jar new file mode 100644 index 0000000..96d1985 Binary files /dev/null and b/frontend/src/main/webapp/app/bcpkix-jdk15on-1.49.jar differ diff --git a/frontend/src/main/webapp/app/bcprov-ext-jdk15on-1.49.jar b/frontend/src/main/webapp/app/bcprov-ext-jdk15on-1.49.jar new file mode 100644 index 0000000..cb0e0be Binary files /dev/null and b/frontend/src/main/webapp/app/bcprov-ext-jdk15on-1.49.jar differ diff --git a/frontend/src/main/webapp/app/bcprov-jdk15on-1.49.jar b/frontend/src/main/webapp/app/bcprov-jdk15on-1.49.jar new file mode 100644 index 0000000..e1d4bb3 Binary files /dev/null and b/frontend/src/main/webapp/app/bcprov-jdk15on-1.49.jar differ diff --git a/frontend/src/main/webapp/app/itextpdf-5.5.3.jar b/frontend/src/main/webapp/app/itextpdf-5.5.3.jar new file mode 100644 index 0000000..0cff7af Binary files /dev/null and b/frontend/src/main/webapp/app/itextpdf-5.5.3.jar differ diff --git a/frontend/src/main/webapp/change-password.xhtml b/frontend/src/main/webapp/change-password.xhtml new file mode 100644 index 0000000..1aa22b0 --- /dev/null +++ b/frontend/src/main/webapp/change-password.xhtml @@ -0,0 +1,155 @@ + + + + + + SINCOAR + + + + + + + + + + + +
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +    + + + + + + Ingresar al Sistema + + +
+ +
+
+
+ + + + + + + + + +

SU CLAVE HA SIDO CAMBIADA EXITOSAMENTE.

+
+
+
+
+ + +
+ +
+
+ + +
+
+ +
+
+ \ No newline at end of file diff --git a/frontend/src/main/webapp/errorPages/.svn/entries b/frontend/src/main/webapp/errorPages/.svn/entries new file mode 100644 index 0000000..4691a58 --- /dev/null +++ b/frontend/src/main/webapp/errorPages/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/webapp/errorPages +svn://172.17.26.185/COMACO + + + +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +maiaError.xhtml +file + + + + +2022-07-28T03:40:14.580681Z +a511029cdff36e3a9bcb0b27ac6b1378 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +794 + diff --git a/frontend/src/main/webapp/errorPages/.svn/text-base/maiaError.xhtml.svn-base b/frontend/src/main/webapp/errorPages/.svn/text-base/maiaError.xhtml.svn-base new file mode 100644 index 0000000..e5f8865 --- /dev/null +++ b/frontend/src/main/webapp/errorPages/.svn/text-base/maiaError.xhtml.svn-base @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/frontend/src/main/webapp/errorPages/maiaError.xhtml b/frontend/src/main/webapp/errorPages/maiaError.xhtml new file mode 100644 index 0000000..e5f8865 --- /dev/null +++ b/frontend/src/main/webapp/errorPages/maiaError.xhtml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/frontend/src/main/webapp/index.xhtml b/frontend/src/main/webapp/index.xhtml new file mode 100644 index 0000000..6098bce --- /dev/null +++ b/frontend/src/main/webapp/index.xhtml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/main/webapp/login.xhtml b/frontend/src/main/webapp/login.xhtml new file mode 100644 index 0000000..7d5f0ad --- /dev/null +++ b/frontend/src/main/webapp/login.xhtml @@ -0,0 +1,117 @@ + + + + + + Control de Armas + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ¿Olvidaste tu contraseña? + + + + + + + + +

+ + + +
+ + +
+
+
+ +
+
+ +
+
+ \ No newline at end of file diff --git a/frontend/src/main/webapp/pages/.svn/entries b/frontend/src/main/webapp/pages/.svn/entries new file mode 100644 index 0000000..fbd4c6e --- /dev/null +++ b/frontend/src/main/webapp/pages/.svn/entries @@ -0,0 +1,135 @@ +10 + +dir +4669 +svn://172.17.26.185/COMACO/sources/frontend/src/main/webapp/pages +svn://172.17.26.185/COMACO + + + +2022-04-19T02:20:17.053961Z +4664 +usermaia1 + + + + + + + + + + + + + + +a11ad980-3ca8-45f0-88f7-f0e618c262b7 + +test +dir + +firmas +dir + +sbs +dir + +workspace.xhtml +file + + + + +2022-07-28T03:40:13.777678Z +11945a9ce828f288aebee4c07fb87057 +2015-02-20T10:55:11.096147Z +3826 +cpiedra + + + + + + + + + + + + + + + + + + + + + +14595 + +accounting +dir + +safety +dir + +reports +dir + +customer +dir + +armas +dir + +application +dir + +prubaInicioFlujo +dir + +security +dir + +initialtab.xhtml +file + + + + +2022-07-28T03:40:13.777678Z +f444a8953867160389fbb6571f541938 +2014-07-18T11:55:42.487555Z +1 +jvaca + + + + + + + + + + + + + + + + + + + + + +524 + +general +dir + +bpm +dir + diff --git a/frontend/src/main/webapp/pages/.svn/text-base/initialtab.xhtml.netbeans-base b/frontend/src/main/webapp/pages/.svn/text-base/initialtab.xhtml.netbeans-base new file mode 100644 index 0000000..33bab5e --- /dev/null +++ b/frontend/src/main/webapp/pages/.svn/text-base/initialtab.xhtml.netbeans-base @@ -0,0 +1,10 @@ + + + \ No newline at end of file diff --git a/frontend/src/main/webapp/pages/.svn/text-base/initialtab.xhtml.svn-base b/frontend/src/main/webapp/pages/.svn/text-base/initialtab.xhtml.svn-base new file mode 100644 index 0000000..33bab5e --- /dev/null +++ b/frontend/src/main/webapp/pages/.svn/text-base/initialtab.xhtml.svn-base @@ -0,0 +1,10 @@ + + + \ No newline at end of file diff --git a/frontend/src/main/webapp/pages/.svn/text-base/workspace.xhtml.netbeans-base b/frontend/src/main/webapp/pages/.svn/text-base/workspace.xhtml.netbeans-base new file mode 100644 index 0000000..e5e0efa --- /dev/null +++ b/frontend/src/main/webapp/pages/.svn/text-base/workspace.xhtml.netbeans-base @@ -0,0 +1,306 @@ + + + + + Control de Armas + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +